eaiovnaovbqoebvqoeavibavo wordexp.h000064400000004741147631660250006425 0ustar00/* Copyright (C) 1991,1992,1996-1999,2001,2003,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _WORDEXP_H #define _WORDEXP_H 1 #include #define __need_size_t #include __BEGIN_DECLS /* Bits set in the FLAGS argument to `wordexp'. */ enum { WRDE_DOOFFS = (1 << 0), /* Insert PWORDEXP->we_offs NULLs. */ WRDE_APPEND = (1 << 1), /* Append to results of a previous call. */ WRDE_NOCMD = (1 << 2), /* Don't do command substitution. */ WRDE_REUSE = (1 << 3), /* Reuse storage in PWORDEXP. */ WRDE_SHOWERR = (1 << 4), /* Don't redirect stderr to /dev/null. */ WRDE_UNDEF = (1 << 5), /* Error for expanding undefined variables. */ __WRDE_FLAGS = (WRDE_DOOFFS | WRDE_APPEND | WRDE_NOCMD | WRDE_REUSE | WRDE_SHOWERR | WRDE_UNDEF) }; /* Structure describing a word-expansion run. */ typedef struct { size_t we_wordc; /* Count of words matched. */ char **we_wordv; /* List of expanded words. */ size_t we_offs; /* Slots to reserve in `we_wordv'. */ } wordexp_t; /* Possible nonzero return values from `wordexp'. */ enum { #ifdef __USE_XOPEN WRDE_NOSYS = -1, /* Never used since we support `wordexp'. */ #endif WRDE_NOSPACE = 1, /* Ran out of memory. */ WRDE_BADCHAR, /* A metachar appears in the wrong place. */ WRDE_BADVAL, /* Undefined var reference with WRDE_UNDEF. */ WRDE_CMDSUB, /* Command substitution with WRDE_NOCMD. */ WRDE_SYNTAX /* Shell syntax error. */ }; /* Do word expansion of WORDS into PWORDEXP. */ extern int wordexp (const char *__restrict __words, wordexp_t *__restrict __pwordexp, int __flags); /* Free the storage allocated by a `wordexp' call. */ extern void wordfree (wordexp_t *__wordexp) __THROW; __END_DECLS #endif /* wordexp.h */ gdfx.h000064400000004534147631660250005665 0ustar00#ifdef __cplusplus extern "C" { #endif #ifndef GDFX_H #define GDFX_H 1 #include "gd.h" /* im MUST be square, but can have any size. Returns a new image of width and height radius * 2, in which the X axis of the original has been remapped to theta (angle) and the Y axis of the original has been remapped to rho (distance from center). This is known as a "polar coordinate transform." */ BGD_DECLARE(gdImagePtr) gdImageSquareToCircle(gdImagePtr im, int radius); /* Draws the text 'top' and 'bottom' on 'im', curved along the edge of a circle of radius 'radius', with its center at 'cx' and 'cy'. 'top' is written clockwise along the top; 'bottom' is written counterclockwise along the bottom. 'textRadius' determines the 'height' of each character; if 'textRadius' is 1/2 of 'radius', characters extend halfway from the edge to the center. 'fillPortion' varies from 0 to 1.0, with useful values from about 0.4 to 0.9, and determines how much of the 180 degrees of arc assigned to each section of text is actually occupied by text; 0.9 looks better than 1.0 which is rather crowded. 'font' is a freetype font; see gdImageStringFT. 'points' is passed to the freetype engine and has an effect on hinting; although the size of the text is determined by radius, textRadius, and fillPortion, you should pass a point size that 'hints' appropriately -- if you know the text will be large, pass a large point size such as 24.0 to get the best results. 'fgcolor' can be any color, and may have an alpha component, do blending, etc. Returns 0 on success, or an error string. */ BGD_DECLARE(char *) gdImageStringFTCircle( gdImagePtr im, int cx, int cy, double radius, double textRadius, double fillPortion, char *font, double points, char *top, char *bottom, int fgcolor); /* 2.0.16: * Sharpen function added on 2003-11-19 * by Paul Troughton (paultroughtonieeeorg) * Simple 3x3 convolution kernel * Makes use of seperability * Faster, but less flexible, than full-blown unsharp masking * pct is sharpening percentage, and can be greater than 100 * Silently does nothing to non-truecolor images * Silently does nothing for pct<0, as not a useful blurring function * Leaves transparency/alpha-channel untouched */ BGD_DECLARE(void) gdImageSharpen (gdImagePtr im, int pct); #endif /* GDFX_H */ #ifdef __cplusplus } #endif netash/ash.h000064400000002515147631660250006767 0ustar00/* Definitions for use with Linux AF_ASH sockets. Copyright (C) 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _NETASH_ASH_H #define _NETASH_ASH_H 1 #include #include struct sockaddr_ash { __SOCKADDR_COMMON (sash_); /* Common data: address family etc. */ int sash_ifindex; /* Interface to use. */ unsigned char sash_channel; /* Realtime or control. */ unsigned int sash_plen; unsigned char sash_prefix[16]; }; /* Values for `channel' member. */ #define ASH_CHANNEL_ANY 0 #define ASH_CHANNEL_CONTROL 1 #define ASH_CHANNEL_REALTIME 2 #endif /* netash/ash.h */ setjmp.h000064400000007736147631660250006246 0ustar00/* Copyright (C) 1991-1999,2001,2002,2007,2009,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ /* * ISO C99 Standard: 7.13 Nonlocal jumps */ #ifndef _SETJMP_H #define _SETJMP_H 1 #include __BEGIN_DECLS #include /* Get `__jmp_buf'. */ #include /* Get `__sigset_t'. */ /* Calling environment, plus possibly a saved signal mask. */ struct __jmp_buf_tag { /* NOTE: The machine-dependent definitions of `__sigsetjmp' assume that a `jmp_buf' begins with a `__jmp_buf' and that `__mask_was_saved' follows it. Do not move these members or add others before it. */ __jmp_buf __jmpbuf; /* Calling environment. */ int __mask_was_saved; /* Saved the signal mask? */ __sigset_t __saved_mask; /* Saved signal mask. */ }; __BEGIN_NAMESPACE_STD typedef struct __jmp_buf_tag jmp_buf[1]; /* Store the calling environment in ENV, also saving the signal mask. Return 0. */ extern int setjmp (jmp_buf __env) __THROWNL; __END_NAMESPACE_STD /* Store the calling environment in ENV, also saving the signal mask if SAVEMASK is nonzero. Return 0. This is the internal name for `sigsetjmp'. */ extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROWNL; #ifndef __FAVOR_BSD /* Store the calling environment in ENV, not saving the signal mask. Return 0. */ extern int _setjmp (struct __jmp_buf_tag __env[1]) __THROWNL; /* Do not save the signal mask. This is equivalent to the `_setjmp' BSD function. */ # define setjmp(env) _setjmp (env) #else /* We are in 4.3 BSD-compatibility mode in which `setjmp' saves the signal mask like `sigsetjmp (ENV, 1)'. We have to define a macro since ISO C says `setjmp' is one. */ # define setjmp(env) setjmp (env) #endif /* Favor BSD. */ __BEGIN_NAMESPACE_STD /* Jump to the environment saved in ENV, making the `setjmp' call there return VAL, or 1 if VAL is 0. */ extern void longjmp (struct __jmp_buf_tag __env[1], int __val) __THROWNL __attribute__ ((__noreturn__)); __END_NAMESPACE_STD #if defined __USE_BSD || defined __USE_XOPEN /* Same. Usually `_longjmp' is used with `_setjmp', which does not save the signal mask. But it is how ENV was saved that determines whether `longjmp' restores the mask; `_longjmp' is just an alias. */ extern void _longjmp (struct __jmp_buf_tag __env[1], int __val) __THROWNL __attribute__ ((__noreturn__)); #endif #ifdef __USE_POSIX /* Use the same type for `jmp_buf' and `sigjmp_buf'. The `__mask_was_saved' flag determines whether or not `longjmp' will restore the signal mask. */ typedef struct __jmp_buf_tag sigjmp_buf[1]; /* Store the calling environment in ENV, also saving the signal mask if SAVEMASK is nonzero. Return 0. */ # define sigsetjmp(env, savemask) __sigsetjmp (env, savemask) /* Jump to the environment saved in ENV, making the sigsetjmp call there return VAL, or 1 if VAL is 0. Restore the signal mask if that sigsetjmp call saved it. This is just an alias `longjmp'. */ extern void siglongjmp (sigjmp_buf __env, int __val) __THROWNL __attribute__ ((__noreturn__)); #endif /* Use POSIX. */ /* Define helper functions to catch unsafe code. */ #if __USE_FORTIFY_LEVEL > 0 # include #endif __END_DECLS #endif /* setjmp.h */ com_err.h000064400000004106147631660250006356 0ustar00/* * Header file for common error description library. * * Copyright 1988, Student Information Processing Board of the * Massachusetts Institute of Technology. * * For copyright and distribution info, see the documentation supplied * with this package. */ #if !defined(__COM_ERR_H) && !defined(__COM_ERR_H__) #ifdef __GNUC__ #define COM_ERR_ATTR(x) __attribute__(x) #else #define COM_ERR_ATTR(x) #endif #include #include typedef long errcode_t; struct error_table { char const * const * msgs; long base; int n_msgs; }; struct et_list; extern void com_err (const char *, long, const char *, ...) COM_ERR_ATTR((format(printf, 3, 4))); extern void com_err_va (const char *whoami, errcode_t code, const char *fmt, va_list args) COM_ERR_ATTR((format(printf, 3, 0))); extern char const *error_message (long); extern void (*com_err_hook) (const char *, long, const char *, va_list); extern void (*set_com_err_hook (void (*) (const char *, long, const char *, va_list))) (const char *, long, const char *, va_list); extern void (*reset_com_err_hook (void)) (const char *, long, const char *, va_list); extern int init_error_table(const char * const *msgs, long base, int count); extern char *(*set_com_err_gettext (char *(*) (const char *))) (const char *); extern errcode_t add_error_table(const struct error_table * et); extern errcode_t remove_error_table(const struct error_table * et); extern void add_to_error_table(struct et_list *new_table); /* Provided for Heimdall compatibility */ extern const char *com_right(struct et_list *list, long code); extern const char *com_right_r(struct et_list *list, long code, char *str, size_t len); extern void initialize_error_table_r(struct et_list **list, const char **messages, int num_errors, long base); extern void free_error_table(struct et_list *et); /* Provided for compatibility with other com_err libraries */ extern int et_list_lock(void); extern int et_list_unlock(void); #define __COM_ERR_H #define __COM_ERR_H__ #endif /* !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)*/ complex.h000064400000007170147631660250006403 0ustar00/* Copyright (C) 1997-2000, 2006, 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ /* * ISO C99: 7.3 Complex arithmetic */ #ifndef _COMPLEX_H #define _COMPLEX_H 1 #include /* Get general and ISO C99 specific information. */ #include __BEGIN_DECLS /* We might need to add support for more compilers here. But since ISO C99 is out hopefully all maintained compilers will soon provide the data types `float complex' and `double complex'. */ #if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (2, 97) # define _Complex __complex__ #endif #define complex _Complex /* Narrowest imaginary unit. This depends on the floating-point evaluation method. XXX This probably has to go into a gcc related file. */ #define _Complex_I (__extension__ 1.0iF) /* Another more descriptive name is `I'. XXX Once we have the imaginary support switch this to _Imaginary_I. */ #undef I #define I _Complex_I #if defined __USE_ISOC11 && __GNUC_PREREQ (4, 7) /* Macros to expand into expression of specified complex type. */ # define CMPLX(x, y) __builtin_complex ((double) (x), (double) (y)) # define CMPLXF(x, y) __builtin_complex ((float) (x), (float) (y)) # ifndef __NO_LONG_DOUBLE_MATH # define CMPLXL(x, y) __builtin_complex ((long double) (x), (long double) (y)) # endif #endif /* The file contains the prototypes for all the actual math functions. These macros are used for those prototypes, so we can easily declare each function as both `name' and `__name', and can declare the float versions `namef' and `__namef'. */ #define __MATHCALL(function, args) \ __MATHDECL (_Mdouble_complex_,function, args) #define __MATHDECL(type, function, args) \ __MATHDECL_1(type, function, args); \ __MATHDECL_1(type, __CONCAT(__,function), args) #define __MATHDECL_1(type, function, args) \ extern type __MATH_PRECNAME(function) args __THROW #define _Mdouble_ double #define __MATH_PRECNAME(name) name #include #undef _Mdouble_ #undef __MATH_PRECNAME /* Now the float versions. */ #ifndef _Mfloat_ # define _Mfloat_ float #endif #define _Mdouble_ _Mfloat_ #define __MATH_PRECNAME(name) name##f #include #undef _Mdouble_ #undef __MATH_PRECNAME /* And the long double versions. It is non-critical to define them here unconditionally since `long double' is required in ISO C99. */ #if !(defined __NO_LONG_DOUBLE_MATH && defined _LIBC) \ || defined __LDBL_COMPAT # ifdef __LDBL_COMPAT # undef __MATHDECL_1 # define __MATHDECL_1(type, function, args) \ extern type __REDIRECT_NTH(__MATH_PRECNAME(function), args, function) # endif # ifndef _Mlong_double_ # define _Mlong_double_ long double # endif # define _Mdouble_ _Mlong_double_ # define __MATH_PRECNAME(name) name##l # include #endif #undef _Mdouble_ #undef __MATH_PRECNAME #undef __MATHDECL_1 #undef __MATHDECL #undef __MATHCALL __END_DECLS #endif /* complex.h */ aio.h000064400000016425147631660250005507 0ustar00/* Copyright (C) 1996-2000,2003,2004,2007,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ /* * ISO/IEC 9945-1:1996 6.7: Asynchronous Input and Output */ #ifndef _AIO_H #define _AIO_H 1 #include #include #define __need_sigevent_t #include #define __need_timespec #include __BEGIN_DECLS /* Asynchronous I/O control block. */ struct aiocb { int aio_fildes; /* File desriptor. */ int aio_lio_opcode; /* Operation to be performed. */ int aio_reqprio; /* Request priority offset. */ volatile void *aio_buf; /* Location of buffer. */ size_t aio_nbytes; /* Length of transfer. */ struct sigevent aio_sigevent; /* Signal number and value. */ /* Internal members. */ struct aiocb *__next_prio; int __abs_prio; int __policy; int __error_code; __ssize_t __return_value; #ifndef __USE_FILE_OFFSET64 __off_t aio_offset; /* File offset. */ char __pad[sizeof (__off64_t) - sizeof (__off_t)]; #else __off64_t aio_offset; /* File offset. */ #endif char __unused[32]; }; /* The same for the 64bit offsets. Please note that the members aio_fildes to __return_value have to be the same in aiocb and aiocb64. */ #ifdef __USE_LARGEFILE64 struct aiocb64 { int aio_fildes; /* File desriptor. */ int aio_lio_opcode; /* Operation to be performed. */ int aio_reqprio; /* Request priority offset. */ volatile void *aio_buf; /* Location of buffer. */ size_t aio_nbytes; /* Length of transfer. */ struct sigevent aio_sigevent; /* Signal number and value. */ /* Internal members. */ struct aiocb *__next_prio; int __abs_prio; int __policy; int __error_code; __ssize_t __return_value; __off64_t aio_offset; /* File offset. */ char __unused[32]; }; #endif #ifdef __USE_GNU /* To customize the implementation one can use the following struct. This implementation follows the one in Irix. */ struct aioinit { int aio_threads; /* Maximal number of threads. */ int aio_num; /* Number of expected simultanious requests. */ int aio_locks; /* Not used. */ int aio_usedba; /* Not used. */ int aio_debug; /* Not used. */ int aio_numusers; /* Not used. */ int aio_idle_time; /* Number of seconds before idle thread terminates. */ int aio_reserved; }; #endif /* Return values of cancelation function. */ enum { AIO_CANCELED, #define AIO_CANCELED AIO_CANCELED AIO_NOTCANCELED, #define AIO_NOTCANCELED AIO_NOTCANCELED AIO_ALLDONE #define AIO_ALLDONE AIO_ALLDONE }; /* Operation codes for `aio_lio_opcode'. */ enum { LIO_READ, #define LIO_READ LIO_READ LIO_WRITE, #define LIO_WRITE LIO_WRITE LIO_NOP #define LIO_NOP LIO_NOP }; /* Synchronization options for `lio_listio' function. */ enum { LIO_WAIT, #define LIO_WAIT LIO_WAIT LIO_NOWAIT #define LIO_NOWAIT LIO_NOWAIT }; /* Allow user to specify optimization. */ #ifdef __USE_GNU extern void aio_init (const struct aioinit *__init) __THROW __nonnull ((1)); #endif #ifndef __USE_FILE_OFFSET64 /* Enqueue read request for given number of bytes and the given priority. */ extern int aio_read (struct aiocb *__aiocbp) __THROW __nonnull ((1)); /* Enqueue write request for given number of bytes and the given priority. */ extern int aio_write (struct aiocb *__aiocbp) __THROW __nonnull ((1)); /* Initiate list of I/O requests. */ extern int lio_listio (int __mode, struct aiocb *const __list[__restrict_arr], int __nent, struct sigevent *__restrict __sig) __THROW __nonnull ((2)); /* Retrieve error status associated with AIOCBP. */ extern int aio_error (const struct aiocb *__aiocbp) __THROW __nonnull ((1)); /* Return status associated with AIOCBP. */ extern __ssize_t aio_return (struct aiocb *__aiocbp) __THROW __nonnull ((1)); /* Try to cancel asynchronous I/O requests outstanding against file descriptor FILDES. */ extern int aio_cancel (int __fildes, struct aiocb *__aiocbp) __THROW; /* Suspend calling thread until at least one of the asynchronous I/O operations referenced by LIST has completed. This function is a cancellation point and therefore not marked with __THROW. */ extern int aio_suspend (const struct aiocb *const __list[], int __nent, const struct timespec *__restrict __timeout) __nonnull ((1)); /* Force all operations associated with file desriptor described by `aio_fildes' member of AIOCBP. */ extern int aio_fsync (int __operation, struct aiocb *__aiocbp) __THROW __nonnull ((2)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (aio_read, (struct aiocb *__aiocbp), aio_read64) __nonnull ((1)); extern int __REDIRECT_NTH (aio_write, (struct aiocb *__aiocbp), aio_write64) __nonnull ((1)); extern int __REDIRECT_NTH (lio_listio, (int __mode, struct aiocb *const __list[__restrict_arr], int __nent, struct sigevent *__restrict __sig), lio_listio64) __nonnull ((2)); extern int __REDIRECT_NTH (aio_error, (const struct aiocb *__aiocbp), aio_error64) __nonnull ((1)); extern __ssize_t __REDIRECT_NTH (aio_return, (struct aiocb *__aiocbp), aio_return64) __nonnull ((1)); extern int __REDIRECT_NTH (aio_cancel, (int __fildes, struct aiocb *__aiocbp), aio_cancel64); extern int __REDIRECT_NTH (aio_suspend, (const struct aiocb *const __list[], int __nent, const struct timespec *__restrict __timeout), aio_suspend64) __nonnull ((1)); extern int __REDIRECT_NTH (aio_fsync, (int __operation, struct aiocb *__aiocbp), aio_fsync64) __nonnull ((2)); # else # define aio_read aio_read64 # define aio_write aio_write64 # define lio_listio lio_listio64 # define aio_error aio_error64 # define aio_return aio_return64 # define aio_cancel aio_cancel64 # define aio_suspend aio_suspend64 # define aio_fsync aio_fsync64 # endif #endif #ifdef __USE_LARGEFILE64 extern int aio_read64 (struct aiocb64 *__aiocbp) __THROW __nonnull ((1)); extern int aio_write64 (struct aiocb64 *__aiocbp) __THROW __nonnull ((1)); extern int lio_listio64 (int __mode, struct aiocb64 *const __list[__restrict_arr], int __nent, struct sigevent *__restrict __sig) __THROW __nonnull ((2)); extern int aio_error64 (const struct aiocb64 *__aiocbp) __THROW __nonnull ((1)); extern __ssize_t aio_return64 (struct aiocb64 *__aiocbp) __THROW __nonnull ((1)); extern int aio_cancel64 (int __fildes, struct aiocb64 *__aiocbp) __THROW; extern int aio_suspend64 (const struct aiocb64 *const __list[], int __nent, const struct timespec *__restrict __timeout) __THROW __nonnull ((1)); extern int aio_fsync64 (int __operation, struct aiocb64 *__aiocbp) __THROW __nonnull ((2)); #endif __END_DECLS #endif /* aio.h */ getopt.h000064400000015032147631660250006232 0ustar00/* Declarations for getopt. Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2009,2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _GETOPT_H #ifndef __need_getopt # define _GETOPT_H 1 #endif /* If __GNU_LIBRARY__ is not already defined, either we are being used standalone, or this is the first header included in the source file. If we are being used with glibc, we need to include , but that does not exist if we are standalone. So: if __GNU_LIBRARY__ is not defined, include , which will pull in for us if it's from glibc. (Why ctype.h? It's guaranteed to exist and it doesn't flood the namespace with stuff the way some other headers do.) */ #if !defined __GNU_LIBRARY__ # include #endif #ifndef __THROW # ifndef __GNUC_PREREQ # define __GNUC_PREREQ(maj, min) (0) # endif # if defined __cplusplus && __GNUC_PREREQ (2,8) # define __THROW throw () # else # define __THROW # endif #endif #ifdef __cplusplus extern "C" { #endif /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; #ifndef __need_getopt /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { const char *name; /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ # define no_argument 0 # define required_argument 1 # define optional_argument 2 #endif /* need getopt */ /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. Return the option character from OPTS just read. Return -1 when there are no more options. For unrecognized options, or options missing arguments, `optopt' is set to the option letter, and '?' is returned. The OPTS string is a list of characters which are recognized option letters, optionally followed by colons, specifying that that letter takes an argument, to be placed in `optarg'. If a letter in OPTS is followed by two colons, its argument is optional. This behavior is specific to the GNU `getopt'. The argument `--' causes premature termination of argument scanning, explicitly telling `getopt' that there are no more options. If OPTS begins with `--', then non-option arguments are treated as arguments to the option '\0'. This behavior is specific to the GNU `getopt'. */ #ifdef __GNU_LIBRARY__ /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) __THROW; # if defined __need_getopt && defined __USE_POSIX2 \ && !defined __USE_POSIX_IMPLICITLY && !defined __USE_GNU /* The GNU getopt has more functionality than the standard version. The additional functionality can be disable at runtime. This redirection helps to also do this at runtime. */ # ifdef __REDIRECT extern int __REDIRECT_NTH (getopt, (int ___argc, char *const *___argv, const char *__shortopts), __posix_getopt); # else extern int __posix_getopt (int ___argc, char *const *___argv, const char *__shortopts) __THROW; # define getopt __posix_getopt # endif # endif #else /* not __GNU_LIBRARY__ */ extern int getopt (); #endif /* __GNU_LIBRARY__ */ #ifndef __need_getopt extern int getopt_long (int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) __THROW; extern int getopt_long_only (int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) __THROW; #endif #ifdef __cplusplus } #endif /* Make sure we later can get all the definitions and declarations. */ #undef __need_getopt #endif /* getopt.h */ fmtmsg.h000064400000006272147631660250006233 0ustar00/* Message display handling. Copyright (C) 1997, 1999, 2000, 2003, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef __FMTMSG_H #define __FMTMSG_H 1 #include __BEGIN_DECLS /* Values to control `fmtmsg' function. */ enum { MM_HARD = 0x001, /* Source of the condition is hardware. */ #define MM_HARD MM_HARD MM_SOFT = 0x002, /* Source of the condition is software. */ #define MM_SOFT MM_SOFT MM_FIRM = 0x004, /* Source of the condition is firmware. */ #define MM_FIRM MM_FIRM MM_APPL = 0x008, /* Condition detected by application. */ #define MM_APPL MM_APPL MM_UTIL = 0x010, /* Condition detected by utility. */ #define MM_UTIL MM_UTIL MM_OPSYS = 0x020, /* Condition detected by operating system. */ #define MM_OPSYS MM_OPSYS MM_RECOVER = 0x040, /* Recoverable error. */ #define MM_RECOVER MM_RECOVER MM_NRECOV = 0x080, /* Non-recoverable error. */ #define MM_NRECOV MM_NRECOV MM_PRINT = 0x100, /* Display message in standard error. */ #define MM_PRINT MM_PRINT MM_CONSOLE = 0x200 /* Display message on system console. */ #define MM_CONSOLE MM_CONSOLE }; /* Values to be for SEVERITY parameter of `fmtmsg'. */ enum { MM_NOSEV = 0, /* No severity level provided for the message. */ #define MM_NOSEV MM_NOSEV MM_HALT, /* Error causing application to halt. */ #define MM_HALT MM_HALT MM_ERROR, /* Application has encountered a non-fatal fault. */ #define MM_ERROR MM_ERROR MM_WARNING, /* Application has detected unusual non-error condition. */ #define MM_WARNING MM_WARNING MM_INFO /* Informative message. */ #define MM_INFO MM_INFO }; /* Macros which can be used as null values for the arguments of `fmtmsg'. */ #define MM_NULLLBL ((char *) 0) #define MM_NULLSEV 0 #define MM_NULLMC ((long int) 0) #define MM_NULLTXT ((char *) 0) #define MM_NULLACT ((char *) 0) #define MM_NULLTAG ((char *) 0) /* Possible return values of `fmtmsg'. */ enum { MM_NOTOK = -1, #define MM_NOTOK MM_NOTOK MM_OK = 0, #define MM_OK MM_OK MM_NOMSG = 1, #define MM_NOMSG MM_NOMSG MM_NOCON = 4 #define MM_NOCON MM_NOCON }; /* Print message with given CLASSIFICATION, LABEL, SEVERITY, TEXT, ACTION and TAG to console or standard error. */ extern int fmtmsg (long int __classification, const char *__label, int __severity, const char *__text, const char *__action, const char *__tag); #ifdef __USE_SVID /* Add or remove severity level. */ extern int addseverity (int __severity, const char *__string) __THROW; #endif __END_DECLS #endif /* fmtmsg.h */ libexslt/exslt.h000064400000005712147631660250007721 0ustar00 #ifndef __EXSLT_H__ #define __EXSLT_H__ #include #include #include "exsltexports.h" #include #ifdef __cplusplus extern "C" { #endif EXSLTPUBVAR const char *exsltLibraryVersion; EXSLTPUBVAR const int exsltLibexsltVersion; EXSLTPUBVAR const int exsltLibxsltVersion; EXSLTPUBVAR const int exsltLibxmlVersion; /** * EXSLT_COMMON_NAMESPACE: * * Namespace for EXSLT common functions */ #define EXSLT_COMMON_NAMESPACE ((const xmlChar *) "http://exslt.org/common") /** * EXSLT_CRYPTO_NAMESPACE: * * Namespace for EXSLT crypto functions */ #define EXSLT_CRYPTO_NAMESPACE ((const xmlChar *) "http://exslt.org/crypto") /** * EXSLT_MATH_NAMESPACE: * * Namespace for EXSLT math functions */ #define EXSLT_MATH_NAMESPACE ((const xmlChar *) "http://exslt.org/math") /** * EXSLT_SETS_NAMESPACE: * * Namespace for EXSLT set functions */ #define EXSLT_SETS_NAMESPACE ((const xmlChar *) "http://exslt.org/sets") /** * EXSLT_FUNCTIONS_NAMESPACE: * * Namespace for EXSLT functions extension functions */ #define EXSLT_FUNCTIONS_NAMESPACE ((const xmlChar *) "http://exslt.org/functions") /** * EXSLT_STRINGS_NAMESPACE: * * Namespace for EXSLT strings functions */ #define EXSLT_STRINGS_NAMESPACE ((const xmlChar *) "http://exslt.org/strings") /** * EXSLT_DATE_NAMESPACE: * * Namespace for EXSLT date functions */ #define EXSLT_DATE_NAMESPACE ((const xmlChar *) "http://exslt.org/dates-and-times") /** * EXSLT_DYNAMIC_NAMESPACE: * * Namespace for EXSLT dynamic functions */ #define EXSLT_DYNAMIC_NAMESPACE ((const xmlChar *) "http://exslt.org/dynamic") /** * SAXON_NAMESPACE: * * Namespace for SAXON extensions functions */ #define SAXON_NAMESPACE ((const xmlChar *) "http://icl.com/saxon") EXSLTPUBFUN void EXSLTCALL exsltCommonRegister (void); #ifdef EXSLT_CRYPTO_ENABLED EXSLTPUBFUN void EXSLTCALL exsltCryptoRegister (void); #endif EXSLTPUBFUN void EXSLTCALL exsltMathRegister (void); EXSLTPUBFUN void EXSLTCALL exsltSetsRegister (void); EXSLTPUBFUN void EXSLTCALL exsltFuncRegister (void); EXSLTPUBFUN void EXSLTCALL exsltStrRegister (void); EXSLTPUBFUN void EXSLTCALL exsltDateRegister (void); EXSLTPUBFUN void EXSLTCALL exsltSaxonRegister (void); EXSLTPUBFUN void EXSLTCALL exsltDynRegister(void); EXSLTPUBFUN void EXSLTCALL exsltRegisterAll (void); EXSLTPUBFUN int EXSLTCALL exsltDateXpathCtxtRegister (xmlXPathContextPtr ctxt, const xmlChar *prefix); EXSLTPUBFUN int EXSLTCALL exsltMathXpathCtxtRegister (xmlXPathContextPtr ctxt, const xmlChar *prefix); EXSLTPUBFUN int EXSLTCALL exsltSetsXpathCtxtRegister (xmlXPathContextPtr ctxt, const xmlChar *prefix); EXSLTPUBFUN int EXSLTCALL exsltStrXpathCtxtRegister (xmlXPathContextPtr ctxt, const xmlChar *prefix); #ifdef __cplusplus } #endif #endif /* __EXSLT_H__ */ libexslt/exsltexports.h000064400000006467147631660250011356 0ustar00/* * exsltexports.h : macros for marking symbols as exportable/importable. * * See Copyright for the status of this software. * * igor@zlatkovic.com */ #ifndef __EXSLT_EXPORTS_H__ #define __EXSLT_EXPORTS_H__ /** * EXSLTPUBFUN, EXSLTPUBVAR, EXSLTCALL * * Macros which declare an exportable function, an exportable variable and * the calling convention used for functions. * * Please use an extra block for every platform/compiler combination when * modifying this, rather than overlong #ifdef lines. This helps * readability as well as the fact that different compilers on the same * platform might need different definitions. */ /** * EXSLTPUBFUN: * * Macros which declare an exportable function */ #define EXSLTPUBFUN /** * EXSLTPUBVAR: * * Macros which declare an exportable variable */ #define EXSLTPUBVAR extern /** * EXSLTCALL: * * Macros which declare the called convention for exported functions */ #define EXSLTCALL /** DOC_DISABLE */ /* Windows platform with MS compiler */ #if defined(_WIN32) && defined(_MSC_VER) #undef EXSLTPUBFUN #undef EXSLTPUBVAR #undef EXSLTCALL #if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC) #define EXSLTPUBFUN __declspec(dllexport) #define EXSLTPUBVAR __declspec(dllexport) #else #define EXSLTPUBFUN #if !defined(LIBEXSLT_STATIC) #define EXSLTPUBVAR __declspec(dllimport) extern #else #define EXSLTPUBVAR extern #endif #endif #define EXSLTCALL __cdecl #if !defined _REENTRANT #define _REENTRANT #endif #endif /* Windows platform with Borland compiler */ #if defined(_WIN32) && defined(__BORLANDC__) #undef EXSLTPUBFUN #undef EXSLTPUBVAR #undef EXSLTCALL #if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC) #define EXSLTPUBFUN __declspec(dllexport) #define EXSLTPUBVAR __declspec(dllexport) extern #else #define EXSLTPUBFUN #if !defined(LIBEXSLT_STATIC) #define EXSLTPUBVAR __declspec(dllimport) extern #else #define EXSLTPUBVAR extern #endif #endif #define EXSLTCALL __cdecl #if !defined _REENTRANT #define _REENTRANT #endif #endif /* Windows platform with GNU compiler (Mingw) */ #if defined(_WIN32) && defined(__MINGW32__) #undef EXSLTPUBFUN #undef EXSLTPUBVAR #undef EXSLTCALL /* #if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC) */ #if !defined(LIBEXSLT_STATIC) #define EXSLTPUBFUN __declspec(dllexport) #define EXSLTPUBVAR __declspec(dllexport) extern #else #define EXSLTPUBFUN #if !defined(LIBEXSLT_STATIC) #define EXSLTPUBVAR __declspec(dllimport) extern #else #define EXSLTPUBVAR extern #endif #endif #define EXSLTCALL __cdecl #if !defined _REENTRANT #define _REENTRANT #endif #endif /* Cygwin platform, GNU compiler */ #if defined(_WIN32) && defined(__CYGWIN__) #undef EXSLTPUBFUN #undef EXSLTPUBVAR #undef EXSLTCALL #if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC) #define EXSLTPUBFUN __declspec(dllexport) #define EXSLTPUBVAR __declspec(dllexport) #else #define EXSLTPUBFUN #if !defined(LIBEXSLT_STATIC) #define EXSLTPUBVAR __declspec(dllimport) extern #else #define EXSLTPUBVAR #endif #endif #define EXSLTCALL __cdecl #endif /* Compatibility */ #if !defined(LIBEXSLT_PUBLIC) #define LIBEXSLT_PUBLIC EXSLTPUBVAR #endif #endif /* __EXSLT_EXPORTS_H__ */ libexslt/exsltconfig.h000064400000002302147631660250011077 0ustar00/* * exsltconfig.h: compile-time version informations for the EXSLT library * * See Copyright for the status of this software. * * daniel@veillard.com */ #ifndef __XML_EXSLTCONFIG_H__ #define __XML_EXSLTCONFIG_H__ #ifdef __cplusplus extern "C" { #endif /** * LIBEXSLT_DOTTED_VERSION: * * the version string like "1.2.3" */ #define LIBEXSLT_DOTTED_VERSION "1.1.28" /** * LIBEXSLT_VERSION: * * the version number: 1.2.3 value is 10203 */ #define LIBEXSLT_VERSION 817 /** * LIBEXSLT_VERSION_STRING: * * the version number string, 1.2.3 value is "10203" */ #define LIBEXSLT_VERSION_STRING "817" /** * LIBEXSLT_VERSION_EXTRA: * * extra version information, used to show a CVS compilation */ #define LIBEXSLT_VERSION_EXTRA "" /** * WITH_CRYPTO: * * Whether crypto support is configured into exslt */ #if 1 #define EXSLT_CRYPTO_ENABLED #endif /** * ATTRIBUTE_UNUSED: * * This macro is used to flag unused function parameters to GCC */ #ifdef __GNUC__ #ifdef HAVE_ANSIDECL_H #include #endif #ifndef ATTRIBUTE_UNUSED #define ATTRIBUTE_UNUSED __attribute__((unused)) #endif #else #define ATTRIBUTE_UNUSED #endif #ifdef __cplusplus } #endif #endif /* __XML_EXSLTCONFIG_H__ */ regexp.h000064400000015614147631660250006230 0ustar00/* Copyright (C) 1996, 1997, 1998, 1999, 2004, 2008, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _REGEXP_H #define _REGEXP_H 1 /* The contents of this header file was first standardized in X/Open System Interface and Headers Issue 2, originally coming from SysV. In issue 4, version 2, it is marked as TO BE WITDRAWN, and it has been withdrawn in SUSv3. This code shouldn't be used in any newly written code. It is included only for compatibility reasons. Use the POSIX definition in for portable applications and a reasonable interface. */ #include #include #include #include #include /* The implementation provided here emulates the needed functionality by mapping to the POSIX regular expression matcher. The interface for the here included function is weird (this really is a harmless word). The user has to provide six macros before this header file can be included: INIT Declarations vor variables which can be used by the other macros. GETC() Return the value of the next character in the regular expression pattern. Successive calls should return successive characters. PEEKC() Return the value of the next character in the regular expression pattern. Immediately successive calls to PEEKC() should return the same character which should also be the next character returned by GETC(). UNGETC(c) Cause `c' to be returned by the next call to GETC() and PEEKC(). RETURN(ptr) Used for normal exit of the `compile' function. `ptr' is a pointer to the character after the last character of the compiled regular expression. ERROR(val) Used for abnormal return from `compile'. `val' is the error number. The error codes are: 11 Range endpoint too large. 16 Bad number. 25 \digit out of range. 36 Illegal or missing delimiter. 41 No remembered search string. 42 \( \) imbalance. 43 Too many \(. 44 More tan two numbers given in \{ \}. 45 } expected after \. 46 First number exceeds second in \{ \}. 49 [ ] imbalance. 50 Regular expression overflow. */ __BEGIN_DECLS /* Interface variables. They contain the results of the successful calls to `setp' and `advance'. */ extern char *loc1; extern char *loc2; /* The use of this variable in the `advance' function is not supported. */ extern char *locs; #ifndef __DO_NOT_DEFINE_COMPILE /* Get and compile the user supplied pattern up to end of line or string or until EOF is seen, whatever happens first. The result is placed in the buffer starting at EXPBUF and delimited by ENDBUF. This function cannot be defined in the libc itself since it depends on the macros. */ char * compile (char *__restrict instring, char *__restrict expbuf, const char *__restrict endbuf, int eof) { char *__input_buffer = NULL; size_t __input_size = 0; size_t __current_size = 0; int __ch; int __error; INIT /* Align the expression buffer according to the needs for an object of type `regex_t'. Then check for minimum size of the buffer for the compiled regular expression. */ regex_t *__expr_ptr; # if defined __GNUC__ && __GNUC__ >= 2 const size_t __req = __alignof__ (regex_t *); # else /* How shall we find out? We simply guess it and can change it is this really proofs to be wrong. */ const size_t __req = 8; # endif expbuf += __req; expbuf -= (expbuf - ((char *) 0)) % __req; if (endbuf < expbuf + sizeof (regex_t)) { ERROR (50); } __expr_ptr = (regex_t *) expbuf; /* The remaining space in the buffer can be used for the compiled pattern. */ __expr_ptr->__REPB_PREFIX (buffer) = expbuf + sizeof (regex_t); __expr_ptr->__REPB_PREFIX (allocated) = endbuf - (char *) __expr_ptr->__REPB_PREFIX (buffer); while ((__ch = (GETC ())) != eof) { if (__ch == '\0' || __ch == '\n') { UNGETC (__ch); break; } if (__current_size + 1 >= __input_size) { size_t __new_size = __input_size ? 2 * __input_size : 128; char *__new_room = (char *) alloca (__new_size); /* See whether we can use the old buffer. */ if (__new_room + __new_size == __input_buffer) { __input_size += __new_size; __input_buffer = (char *) memcpy (__new_room, __input_buffer, __current_size); } else if (__input_buffer + __input_size == __new_room) __input_size += __new_size; else { __input_size = __new_size; __input_buffer = (char *) memcpy (__new_room, __input_buffer, __current_size); } } __input_buffer[__current_size++] = __ch; } if (__current_size) __input_buffer[__current_size++] = '\0'; else __input_buffer = ""; /* Now compile the pattern. */ __error = regcomp (__expr_ptr, __input_buffer, REG_NEWLINE); if (__error != 0) /* Oh well, we have to translate POSIX error codes. */ switch (__error) { case REG_BADPAT: case REG_ECOLLATE: case REG_ECTYPE: case REG_EESCAPE: case REG_BADRPT: case REG_EEND: case REG_ERPAREN: default: /* There is no matching error code. */ RETURN (36); case REG_ESUBREG: RETURN (25); case REG_EBRACK: RETURN (49); case REG_EPAREN: RETURN (42); case REG_EBRACE: RETURN (44); case REG_BADBR: RETURN (46); case REG_ERANGE: RETURN (11); case REG_ESPACE: case REG_ESIZE: ERROR (50); } /* Everything is ok. */ RETURN ((char *) (__expr_ptr->__REPB_PREFIX (buffer) + __expr_ptr->__REPB_PREFIX (used))); } #endif /* Find the next match in STRING. The compiled regular expression is found in the buffer starting at EXPBUF. `loc1' will return the first character matched and `loc2' points to the next unmatched character. */ extern int step (const char *__restrict __string, const char *__restrict __expbuf) __THROW; /* Match the beginning of STRING with the compiled regular expression in EXPBUF. If the match is successful `loc2' will contain the position of the first unmatched character. */ extern int advance (const char *__restrict __string, const char *__restrict __expbuf) __THROW; __END_DECLS #endif /* regexp.h */ dlfcn.h000064400000015600147631660250006017 0ustar00/* User functions for run-time dynamic loading. Copyright (C) 1995-2001,2003,2004,2006,2009,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _DLFCN_H #define _DLFCN_H 1 #include #define __need_size_t #include /* Collect various system dependent definitions and declarations. */ #include #ifdef __USE_GNU /* If the first argument of `dlsym' or `dlvsym' is set to RTLD_NEXT the run-time address of the symbol called NAME in the next shared object is returned. The "next" relation is defined by the order the shared objects were loaded. */ # define RTLD_NEXT ((void *) -1l) /* If the first argument to `dlsym' or `dlvsym' is set to RTLD_DEFAULT the run-time address of the symbol called NAME in the global scope is returned. */ # define RTLD_DEFAULT ((void *) 0) /* Type for namespace indeces. */ typedef long int Lmid_t; /* Special namespace ID values. */ # define LM_ID_BASE 0 /* Initial namespace. */ # define LM_ID_NEWLM -1 /* For dlmopen: request new namespace. */ #endif __BEGIN_DECLS /* Open the shared object FILE and map it in; return a handle that can be passed to `dlsym' to get symbol values from it. */ extern void *dlopen (const char *__file, int __mode) __THROW; /* Unmap and close a shared object opened by `dlopen'. The handle cannot be used again after calling `dlclose'. */ extern int dlclose (void *__handle) __THROW __nonnull ((1)); /* Find the run-time address in the shared object HANDLE refers to of the symbol called NAME. */ extern void *dlsym (void *__restrict __handle, const char *__restrict __name) __THROW __nonnull ((2)); #ifdef __USE_GNU /* Like `dlopen', but request object to be allocated in a new namespace. */ extern void *dlmopen (Lmid_t __nsid, const char *__file, int __mode) __THROW; /* Find the run-time address in the shared object HANDLE refers to of the symbol called NAME with VERSION. */ extern void *dlvsym (void *__restrict __handle, const char *__restrict __name, const char *__restrict __version) __THROW __nonnull ((2, 3)); #endif /* When any of the above functions fails, call this function to return a string describing the error. Each call resets the error string so that a following call returns null. */ extern char *dlerror (void) __THROW; #ifdef __USE_GNU /* Structure containing information about object searched using `dladdr'. */ typedef struct { const char *dli_fname; /* File name of defining object. */ void *dli_fbase; /* Load address of that object. */ const char *dli_sname; /* Name of nearest symbol. */ void *dli_saddr; /* Exact value of nearest symbol. */ } Dl_info; /* Fill in *INFO with the following information about ADDRESS. Returns 0 iff no shared object's segments contain that address. */ extern int dladdr (const void *__address, Dl_info *__info) __THROW __nonnull ((2)); /* Same as `dladdr', but additionally sets *EXTRA_INFO according to FLAGS. */ extern int dladdr1 (const void *__address, Dl_info *__info, void **__extra_info, int __flags) __THROW __nonnull ((2)); /* These are the possible values for the FLAGS argument to `dladdr1'. This indicates what extra information is stored at *EXTRA_INFO. It may also be zero, in which case the EXTRA_INFO argument is not used. */ enum { /* Matching symbol table entry (const ElfNN_Sym *). */ RTLD_DL_SYMENT = 1, /* The object containing the address (struct link_map *). */ RTLD_DL_LINKMAP = 2 }; /* Get information about the shared object HANDLE refers to. REQUEST is from among the values below, and determines the use of ARG. On success, returns zero. On failure, returns -1 and records an error message to be fetched with `dlerror'. */ extern int dlinfo (void *__restrict __handle, int __request, void *__restrict __arg) __THROW __nonnull ((1, 3)); /* These are the possible values for the REQUEST argument to `dlinfo'. */ enum { /* Treat ARG as `lmid_t *'; store namespace ID for HANDLE there. */ RTLD_DI_LMID = 1, /* Treat ARG as `struct link_map **'; store the `struct link_map *' for HANDLE there. */ RTLD_DI_LINKMAP = 2, RTLD_DI_CONFIGADDR = 3, /* Unsupported, defined by Solaris. */ /* Treat ARG as `Dl_serinfo *' (see below), and fill in to describe the directories that will be searched for dependencies of this object. RTLD_DI_SERINFOSIZE fills in just the `dls_cnt' and `dls_size' entries to indicate the size of the buffer that must be passed to RTLD_DI_SERINFO to fill in the full information. */ RTLD_DI_SERINFO = 4, RTLD_DI_SERINFOSIZE = 5, /* Treat ARG as `char *', and store there the directory name used to expand $ORIGIN in this shared object's dependency file names. */ RTLD_DI_ORIGIN = 6, RTLD_DI_PROFILENAME = 7, /* Unsupported, defined by Solaris. */ RTLD_DI_PROFILEOUT = 8, /* Unsupported, defined by Solaris. */ /* Treat ARG as `size_t *', and store there the TLS module ID of this object's PT_TLS segment, as used in TLS relocations; store zero if this object does not define a PT_TLS segment. */ RTLD_DI_TLS_MODID = 9, /* Treat ARG as `void **', and store there a pointer to the calling thread's TLS block corresponding to this object's PT_TLS segment. Store a null pointer if this object does not define a PT_TLS segment, or if the calling thread has not allocated a block for it. */ RTLD_DI_TLS_DATA = 10, RTLD_DI_MAX = 10 }; /* This is the type of elements in `Dl_serinfo', below. The `dls_name' member points to space in the buffer passed to `dlinfo'. */ typedef struct { char *dls_name; /* Name of library search path directory. */ unsigned int dls_flags; /* Indicates where this directory came from. */ } Dl_serpath; /* This is the structure that must be passed (by reference) to `dlinfo' for the RTLD_DI_SERINFO and RTLD_DI_SERINFOSIZE requests. */ typedef struct { size_t dls_size; /* Size in bytes of the whole buffer. */ unsigned int dls_cnt; /* Number of elements in `dls_serpath'. */ Dl_serpath dls_serpath[1]; /* Actually longer, dls_cnt elements. */ } Dl_serinfo; #endif /* __USE_GNU */ __END_DECLS #endif /* dlfcn.h */ python3.6m/pyconfig-64.h000064400000126756147631660250010742 0ustar00/* pyconfig.h. Generated from pyconfig.h.in by configure. */ /* pyconfig.h.in. Generated from configure.ac by autoheader. */ #ifndef Py_PYCONFIG_H #define Py_PYCONFIG_H /* Define if building universal (internal helper macro) */ /* #undef AC_APPLE_UNIVERSAL_BUILD */ /* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want support for AIX C++ shared extension modules. */ /* #undef AIX_GENUINE_CPLUSPLUS */ /* The Android API level. */ /* #undef ANDROID_API_LEVEL */ /* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM mixed-endian order (byte order 45670123) */ /* #undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 */ /* Define if C doubles are 64-bit IEEE 754 binary format, stored with the most significant byte first */ /* #undef DOUBLE_IS_BIG_ENDIAN_IEEE754 */ /* Define if C doubles are 64-bit IEEE 754 binary format, stored with the least significant byte first */ #define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 1 /* Define if --enable-ipv6 is specified */ #define ENABLE_IPV6 1 /* Define if flock needs to be linked with bsd library. */ /* #undef FLOCK_NEEDS_LIBBSD */ /* Define if getpgrp() must be called as getpgrp(0). */ /* #undef GETPGRP_HAVE_ARG */ /* Define if gettimeofday() does not have second (timezone) argument This is the case on Motorola V4 (R40V4.2) */ /* #undef GETTIMEOFDAY_NO_TZ */ /* Define to 1 if you have the `accept4' function. */ #define HAVE_ACCEPT4 1 /* Define to 1 if you have the `acosh' function. */ #define HAVE_ACOSH 1 /* struct addrinfo (netdb.h) */ #define HAVE_ADDRINFO 1 /* Define to 1 if you have the `alarm' function. */ #define HAVE_ALARM 1 /* Define if aligned memory access is required */ /* #undef HAVE_ALIGNED_REQUIRED */ /* Define to 1 if you have the header file. */ #define HAVE_ALLOCA_H 1 /* Define this if your time.h defines altzone. */ /* #undef HAVE_ALTZONE */ /* Define to 1 if you have the `asinh' function. */ #define HAVE_ASINH 1 /* Define to 1 if you have the header file. */ #define HAVE_ASM_TYPES_H 1 /* Define to 1 if you have the `atanh' function. */ #define HAVE_ATANH 1 /* Define to 1 if you have the `bind_textdomain_codeset' function. */ #define HAVE_BIND_TEXTDOMAIN_CODESET 1 /* Define to 1 if you have the header file. */ #define HAVE_BLUETOOTH_BLUETOOTH_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_BLUETOOTH_H */ /* Define if mbstowcs(NULL, "text", 0) does not return the number of wide chars that would be converted. */ /* #undef HAVE_BROKEN_MBSTOWCS */ /* Define if nice() returns success/failure instead of the new priority. */ /* #undef HAVE_BROKEN_NICE */ /* Define if the system reports an invalid PIPE_BUF value. */ /* #undef HAVE_BROKEN_PIPE_BUF */ /* Define if poll() sets errno on invalid file descriptors. */ /* #undef HAVE_BROKEN_POLL */ /* Define if the Posix semaphores do not work on your system */ /* #undef HAVE_BROKEN_POSIX_SEMAPHORES */ /* Define if pthread_sigmask() does not work on your system. */ /* #undef HAVE_BROKEN_PTHREAD_SIGMASK */ /* define to 1 if your sem_getvalue is broken. */ /* #undef HAVE_BROKEN_SEM_GETVALUE */ /* Define if `unsetenv` does not return an int. */ /* #undef HAVE_BROKEN_UNSETENV */ /* Has builtin atomics */ #define HAVE_BUILTIN_ATOMIC 1 /* Define to 1 if you have the 'chflags' function. */ /* #undef HAVE_CHFLAGS */ /* Define to 1 if you have the `chown' function. */ #define HAVE_CHOWN 1 /* Define if you have the 'chroot' function. */ #define HAVE_CHROOT 1 /* Define to 1 if you have the `clock' function. */ #define HAVE_CLOCK 1 /* Define to 1 if you have the `clock_getres' function. */ #define HAVE_CLOCK_GETRES 1 /* Define to 1 if you have the `clock_gettime' function. */ #define HAVE_CLOCK_GETTIME 1 /* Define to 1 if you have the `clock_settime' function. */ #define HAVE_CLOCK_SETTIME 1 /* Define if the C compiler supports computed gotos. */ #define HAVE_COMPUTED_GOTOS 1 /* Define to 1 if you have the `confstr' function. */ #define HAVE_CONFSTR 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_CONIO_H */ /* Define to 1 if you have the `copysign' function. */ #define HAVE_COPYSIGN 1 /* Define to 1 if you have the header file. */ #define HAVE_CRYPT_H 1 /* Define to 1 if you have the `ctermid' function. */ #define HAVE_CTERMID 1 /* Define if you have the 'ctermid_r' function. */ /* #undef HAVE_CTERMID_R */ /* Define if you have the 'filter' function. */ #define HAVE_CURSES_FILTER 1 /* Define to 1 if you have the header file. */ #define HAVE_CURSES_H 1 /* Define if you have the 'has_key' function. */ #define HAVE_CURSES_HAS_KEY 1 /* Define if you have the 'immedok' function. */ #define HAVE_CURSES_IMMEDOK 1 /* Define if you have the 'is_pad' function or macro. */ #define HAVE_CURSES_IS_PAD 1 /* Define if you have the 'is_term_resized' function. */ #define HAVE_CURSES_IS_TERM_RESIZED 1 /* Define if you have the 'resizeterm' function. */ #define HAVE_CURSES_RESIZETERM 1 /* Define if you have the 'resize_term' function. */ #define HAVE_CURSES_RESIZE_TERM 1 /* Define if you have the 'syncok' function. */ #define HAVE_CURSES_SYNCOK 1 /* Define if you have the 'typeahead' function. */ #define HAVE_CURSES_TYPEAHEAD 1 /* Define if you have the 'use_env' function. */ #define HAVE_CURSES_USE_ENV 1 /* Define if you have the 'wchgat' function. */ #define HAVE_CURSES_WCHGAT 1 /* Define to 1 if you have the declaration of `isfinite', and to 0 if you don't. */ #define HAVE_DECL_ISFINITE 1 /* Define to 1 if you have the declaration of `isinf', and to 0 if you don't. */ #define HAVE_DECL_ISINF 1 /* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. */ #define HAVE_DECL_ISNAN 1 /* Define to 1 if you have the declaration of `RTLD_DEEPBIND', and to 0 if you don't. */ #define HAVE_DECL_RTLD_DEEPBIND 1 /* Define to 1 if you have the declaration of `RTLD_GLOBAL', and to 0 if you don't. */ #define HAVE_DECL_RTLD_GLOBAL 1 /* Define to 1 if you have the declaration of `RTLD_LAZY', and to 0 if you don't. */ #define HAVE_DECL_RTLD_LAZY 1 /* Define to 1 if you have the declaration of `RTLD_LOCAL', and to 0 if you don't. */ #define HAVE_DECL_RTLD_LOCAL 1 /* Define to 1 if you have the declaration of `RTLD_NODELETE', and to 0 if you don't. */ #define HAVE_DECL_RTLD_NODELETE 1 /* Define to 1 if you have the declaration of `RTLD_NOLOAD', and to 0 if you don't. */ #define HAVE_DECL_RTLD_NOLOAD 1 /* Define to 1 if you have the declaration of `RTLD_NOW', and to 0 if you don't. */ #define HAVE_DECL_RTLD_NOW 1 /* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. */ /* #undef HAVE_DECL_TZNAME */ /* Define to 1 if you have the device macros. */ #define HAVE_DEVICE_MACROS 1 /* Define to 1 if you have the /dev/ptc device file. */ /* #undef HAVE_DEV_PTC */ /* Define to 1 if you have the /dev/ptmx device file. */ #define HAVE_DEV_PTMX 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_DIRECT_H */ /* Define to 1 if the dirent structure has a d_type field */ #define HAVE_DIRENT_D_TYPE 1 /* Define to 1 if you have the header file, and it defines `DIR'. */ #define HAVE_DIRENT_H 1 /* Define if you have the 'dirfd' function or macro. */ #define HAVE_DIRFD 1 /* Define to 1 if you have the header file. */ #define HAVE_DLFCN_H 1 /* Define to 1 if you have the `dlopen' function. */ #define HAVE_DLOPEN 1 /* Define to 1 if you have the `dup2' function. */ #define HAVE_DUP2 1 /* Define to 1 if you have the `dup3' function. */ #define HAVE_DUP3 1 /* Defined when any dynamic module loading is enabled. */ #define HAVE_DYNAMIC_LOADING 1 /* Define to 1 if you have the header file. */ #define HAVE_ENDIAN_H 1 /* Define if you have the 'epoll' functions. */ #define HAVE_EPOLL 1 /* Define if you have the 'epoll_create1' function. */ #define HAVE_EPOLL_CREATE1 1 /* Define to 1 if you have the `erf' function. */ #define HAVE_ERF 1 /* Define to 1 if you have the `erfc' function. */ #define HAVE_ERFC 1 /* Define to 1 if you have the header file. */ #define HAVE_ERRNO_H 1 /* Define to 1 if you have the `execv' function. */ #define HAVE_EXECV 1 /* Define to 1 if you have the `expm1' function. */ #define HAVE_EXPM1 1 /* Define to 1 if you have the `faccessat' function. */ #define HAVE_FACCESSAT 1 /* Define if you have the 'fchdir' function. */ #define HAVE_FCHDIR 1 /* Define to 1 if you have the `fchmod' function. */ #define HAVE_FCHMOD 1 /* Define to 1 if you have the `fchmodat' function. */ #define HAVE_FCHMODAT 1 /* Define to 1 if you have the `fchown' function. */ #define HAVE_FCHOWN 1 /* Define to 1 if you have the `fchownat' function. */ #define HAVE_FCHOWNAT 1 /* Define to 1 if you have the header file. */ #define HAVE_FCNTL_H 1 /* Define if you have the 'fdatasync' function. */ #define HAVE_FDATASYNC 1 /* Define to 1 if you have the `fdopendir' function. */ #define HAVE_FDOPENDIR 1 /* Define to 1 if you have the `fexecve' function. */ #define HAVE_FEXECVE 1 /* Define to 1 if you have the `finite' function. */ #define HAVE_FINITE 1 /* Define to 1 if you have the `flock' function. */ #define HAVE_FLOCK 1 /* Define to 1 if you have the `fork' function. */ #define HAVE_FORK 1 /* Define to 1 if you have the `forkpty' function. */ #define HAVE_FORKPTY 1 /* Define to 1 if you have the `fpathconf' function. */ #define HAVE_FPATHCONF 1 /* Define to 1 if you have the `fseek64' function. */ /* #undef HAVE_FSEEK64 */ /* Define to 1 if you have the `fseeko' function. */ #define HAVE_FSEEKO 1 /* Define to 1 if you have the `fstatat' function. */ #define HAVE_FSTATAT 1 /* Define to 1 if you have the `fstatvfs' function. */ #define HAVE_FSTATVFS 1 /* Define if you have the 'fsync' function. */ #define HAVE_FSYNC 1 /* Define to 1 if you have the `ftell64' function. */ /* #undef HAVE_FTELL64 */ /* Define to 1 if you have the `ftello' function. */ #define HAVE_FTELLO 1 /* Define to 1 if you have the `ftime' function. */ #define HAVE_FTIME 1 /* Define to 1 if you have the `ftruncate' function. */ #define HAVE_FTRUNCATE 1 /* Define to 1 if you have the `futimens' function. */ #define HAVE_FUTIMENS 1 /* Define to 1 if you have the `futimes' function. */ #define HAVE_FUTIMES 1 /* Define to 1 if you have the `futimesat' function. */ #define HAVE_FUTIMESAT 1 /* Define to 1 if you have the `gai_strerror' function. */ #define HAVE_GAI_STRERROR 1 /* Define to 1 if you have the `gamma' function. */ #define HAVE_GAMMA 1 /* Define if we can use gcc inline assembler to get and set mc68881 fpcr */ /* #undef HAVE_GCC_ASM_FOR_MC68881 */ /* Define if we can use x64 gcc inline assembler */ #define HAVE_GCC_ASM_FOR_X64 1 /* Define if we can use gcc inline assembler to get and set x87 control word */ #define HAVE_GCC_ASM_FOR_X87 1 /* Define if your compiler provides __uint128_t */ #define HAVE_GCC_UINT128_T 1 /* Define if you have the getaddrinfo function. */ #define HAVE_GETADDRINFO 1 /* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */ #define HAVE_GETC_UNLOCKED 1 /* Define to 1 if you have the `getentropy' function. */ /* #undef HAVE_GETENTROPY */ /* Define to 1 if you have the `getgrouplist' function. */ #define HAVE_GETGROUPLIST 1 /* Define to 1 if you have the `getgroups' function. */ #define HAVE_GETGROUPS 1 /* Define to 1 if you have the `gethostbyname' function. */ /* #undef HAVE_GETHOSTBYNAME */ /* Define this if you have some version of gethostbyname_r() */ #define HAVE_GETHOSTBYNAME_R 1 /* Define this if you have the 3-arg version of gethostbyname_r(). */ /* #undef HAVE_GETHOSTBYNAME_R_3_ARG */ /* Define this if you have the 5-arg version of gethostbyname_r(). */ /* #undef HAVE_GETHOSTBYNAME_R_5_ARG */ /* Define this if you have the 6-arg version of gethostbyname_r(). */ #define HAVE_GETHOSTBYNAME_R_6_ARG 1 /* Define to 1 if you have the `getitimer' function. */ #define HAVE_GETITIMER 1 /* Define to 1 if you have the `getloadavg' function. */ #define HAVE_GETLOADAVG 1 /* Define to 1 if you have the `getlogin' function. */ #define HAVE_GETLOGIN 1 /* Define to 1 if you have the `getnameinfo' function. */ #define HAVE_GETNAMEINFO 1 /* Define if you have the 'getpagesize' function. */ #define HAVE_GETPAGESIZE 1 /* Define to 1 if you have the `getpeername' function. */ #define HAVE_GETPEERNAME 1 /* Define to 1 if you have the `getpgid' function. */ #define HAVE_GETPGID 1 /* Define to 1 if you have the `getpgrp' function. */ #define HAVE_GETPGRP 1 /* Define to 1 if you have the `getpid' function. */ #define HAVE_GETPID 1 /* Define to 1 if you have the `getpriority' function. */ #define HAVE_GETPRIORITY 1 /* Define to 1 if you have the `getpwent' function. */ #define HAVE_GETPWENT 1 /* Define to 1 if the getrandom() function is available */ /* #undef HAVE_GETRANDOM */ /* Define to 1 if the Linux getrandom() syscall is available */ #define HAVE_GETRANDOM_SYSCALL 1 /* Define to 1 if you have the `getresgid' function. */ #define HAVE_GETRESGID 1 /* Define to 1 if you have the `getresuid' function. */ #define HAVE_GETRESUID 1 /* Define to 1 if you have the `getsid' function. */ #define HAVE_GETSID 1 /* Define to 1 if you have the `getspent' function. */ #define HAVE_GETSPENT 1 /* Define to 1 if you have the `getspnam' function. */ #define HAVE_GETSPNAM 1 /* Define to 1 if you have the `gettimeofday' function. */ #define HAVE_GETTIMEOFDAY 1 /* Define to 1 if you have the `getwd' function. */ #define HAVE_GETWD 1 /* Define if glibc has incorrect _FORTIFY_SOURCE wrappers for memmove and bcopy. */ /* #undef HAVE_GLIBC_MEMMOVE_BUG */ /* Define to 1 if you have the header file. */ #define HAVE_GRP_H 1 /* Define if you have the 'hstrerror' function. */ #define HAVE_HSTRERROR 1 /* Define this if you have le64toh() */ #define HAVE_HTOLE64 1 /* Define to 1 if you have the `hypot' function. */ #define HAVE_HYPOT 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_IEEEFP_H */ /* Define to 1 if you have the 'if_nameindex' function. */ #define HAVE_IF_NAMEINDEX 1 /* Define if you have the 'inet_aton' function. */ #define HAVE_INET_ATON 1 /* Define if you have the 'inet_pton' function. */ #define HAVE_INET_PTON 1 /* Define to 1 if you have the `initgroups' function. */ #define HAVE_INITGROUPS 1 /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_IO_H */ /* Define if gcc has the ipa-pure-const bug. */ /* #undef HAVE_IPA_PURE_CONST_BUG */ /* Define to 1 if you have the `kill' function. */ #define HAVE_KILL 1 /* Define to 1 if you have the `killpg' function. */ #define HAVE_KILLPG 1 /* Define if you have the 'kqueue' functions. */ /* #undef HAVE_KQUEUE */ /* Define to 1 if you have the header file. */ #define HAVE_LANGINFO_H 1 /* Defined to enable large file support when an off_t is bigger than a long and long long is available and at least as big as an off_t. You may need to add some flags for configuration and compilation to enable this mode. (For Solaris and Linux, the necessary defines are already defined.) */ /* #undef HAVE_LARGEFILE_SUPPORT */ /* Define to 1 if you have the 'lchflags' function. */ /* #undef HAVE_LCHFLAGS */ /* Define to 1 if you have the `lchmod' function. */ /* #undef HAVE_LCHMOD */ /* Define to 1 if you have the `lchown' function. */ #define HAVE_LCHOWN 1 /* Define to 1 if you have the `lgamma' function. */ #define HAVE_LGAMMA 1 /* Define to 1 if you have the `dl' library (-ldl). */ #define HAVE_LIBDL 1 /* Define to 1 if you have the `dld' library (-ldld). */ /* #undef HAVE_LIBDLD */ /* Define to 1 if you have the `ieee' library (-lieee). */ /* #undef HAVE_LIBIEEE */ /* Define to 1 if you have the header file. */ #define HAVE_LIBINTL_H 1 /* Define if you have the readline library (-lreadline). */ #define HAVE_LIBREADLINE 1 /* Define to 1 if you have the `resolv' library (-lresolv). */ /* #undef HAVE_LIBRESOLV */ /* Define to 1 if you have the `sendfile' library (-lsendfile). */ /* #undef HAVE_LIBSENDFILE */ /* Define to 1 if you have the header file. */ /* #undef HAVE_LIBUTIL_H */ /* Define if you have the 'link' function. */ #define HAVE_LINK 1 /* Define to 1 if you have the `linkat' function. */ #define HAVE_LINKAT 1 /* Define to 1 if you have the header file. */ #define HAVE_LINUX_CAN_BCM_H 1 /* Define to 1 if you have the header file. */ #define HAVE_LINUX_CAN_H 1 /* Define if compiling using Linux 3.6 or later. */ #define HAVE_LINUX_CAN_RAW_FD_FRAMES 1 /* Define to 1 if you have the header file. */ #define HAVE_LINUX_CAN_RAW_H 1 /* Define to 1 if you have the header file. */ #define HAVE_LINUX_NETLINK_H 1 /* Define to 1 if you have the header file. */ #define HAVE_LINUX_RANDOM_H 1 /* Define to 1 if you have the header file. */ #define HAVE_LINUX_TIPC_H 1 /* Define to 1 if you have the 'lockf' function and the F_LOCK macro. */ #define HAVE_LOCKF 1 /* Define to 1 if you have the `log1p' function. */ #define HAVE_LOG1P 1 /* Define to 1 if you have the `log2' function. */ #define HAVE_LOG2 1 /* Define this if you have the type long double. */ #define HAVE_LONG_DOUBLE 1 /* Define to 1 if you have the `lstat' function. */ #define HAVE_LSTAT 1 /* Define to 1 if you have the `lutimes' function. */ #define HAVE_LUTIMES 1 /* Define this if you have the makedev macro. */ #define HAVE_MAKEDEV 1 /* Define to 1 if you have the `mbrtowc' function. */ #define HAVE_MBRTOWC 1 /* Define to 1 if you have the `memmove' function. */ #define HAVE_MEMMOVE 1 /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the `memrchr' function. */ #define HAVE_MEMRCHR 1 /* Define to 1 if you have the `mkdirat' function. */ #define HAVE_MKDIRAT 1 /* Define to 1 if you have the `mkfifo' function. */ #define HAVE_MKFIFO 1 /* Define to 1 if you have the `mkfifoat' function. */ #define HAVE_MKFIFOAT 1 /* Define to 1 if you have the `mknod' function. */ #define HAVE_MKNOD 1 /* Define to 1 if you have the `mknodat' function. */ #define HAVE_MKNODAT 1 /* Define to 1 if you have the `mktime' function. */ #define HAVE_MKTIME 1 /* Define to 1 if you have the `mmap' function. */ #define HAVE_MMAP 1 /* Define to 1 if you have the `mremap' function. */ #define HAVE_MREMAP 1 /* Define to 1 if you have the header file. */ #define HAVE_NCURSES_H 1 /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_NDIR_H */ /* Define to 1 if you have the header file. */ #define HAVE_NETPACKET_PACKET_H 1 /* Define to 1 if you have the header file. */ #define HAVE_NET_IF_H 1 /* Define to 1 if you have the `nice' function. */ #define HAVE_NICE 1 /* Define to 1 if you have the `openat' function. */ #define HAVE_OPENAT 1 /* Define to 1 if you have the `openpty' function. */ #define HAVE_OPENPTY 1 /* Define to 1 if you have the `pathconf' function. */ #define HAVE_PATHCONF 1 /* Define to 1 if you have the `pause' function. */ #define HAVE_PAUSE 1 /* Define to 1 if you have the `pipe2' function. */ #define HAVE_PIPE2 1 /* Define to 1 if you have the `plock' function. */ /* #undef HAVE_PLOCK */ /* Define to 1 if you have the `poll' function. */ #define HAVE_POLL 1 /* Define to 1 if you have the header file. */ #define HAVE_POLL_H 1 /* Define to 1 if you have the `posix_fadvise' function. */ #define HAVE_POSIX_FADVISE 1 /* Define to 1 if you have the `posix_fallocate' function. */ #define HAVE_POSIX_FALLOCATE 1 /* Define to 1 if you have the `pread' function. */ #define HAVE_PREAD 1 /* Define if you have the 'prlimit' functions. */ #define HAVE_PRLIMIT 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_PROCESS_H */ /* Define if your compiler supports function prototype */ #define HAVE_PROTOTYPES 1 /* Define to 1 if you have the `pthread_atfork' function. */ #define HAVE_PTHREAD_ATFORK 1 /* Defined for Solaris 2.6 bug in pthread header. */ /* #undef HAVE_PTHREAD_DESTRUCTOR */ /* Define to 1 if you have the header file. */ #define HAVE_PTHREAD_H 1 /* Define to 1 if you have the `pthread_init' function. */ /* #undef HAVE_PTHREAD_INIT */ /* Define to 1 if you have the `pthread_kill' function. */ #define HAVE_PTHREAD_KILL 1 /* Define to 1 if you have the `pthread_sigmask' function. */ #define HAVE_PTHREAD_SIGMASK 1 /* Define to 1 if you have the header file. */ #define HAVE_PTY_H 1 /* Define to 1 if you have the `putenv' function. */ #define HAVE_PUTENV 1 /* Define to 1 if you have the `pwrite' function. */ #define HAVE_PWRITE 1 /* Define to 1 if you have the `readlink' function. */ #define HAVE_READLINK 1 /* Define to 1 if you have the `readlinkat' function. */ #define HAVE_READLINKAT 1 /* Define to 1 if you have the `readv' function. */ #define HAVE_READV 1 /* Define to 1 if you have the `realpath' function. */ #define HAVE_REALPATH 1 /* Define to 1 if you have the `renameat' function. */ #define HAVE_RENAMEAT 1 /* Define if readline supports append_history */ #define HAVE_RL_APPEND_HISTORY 1 /* Define if you have readline 2.1 */ #define HAVE_RL_CALLBACK 1 /* Define if you can turn off readline's signal handling. */ #define HAVE_RL_CATCH_SIGNAL 1 /* Define if you have readline 2.2 */ #define HAVE_RL_COMPLETION_APPEND_CHARACTER 1 /* Define if you have readline 4.0 */ #define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1 /* Define if you have readline 4.2 */ #define HAVE_RL_COMPLETION_MATCHES 1 /* Define if you have rl_completion_suppress_append */ #define HAVE_RL_COMPLETION_SUPPRESS_APPEND 1 /* Define if you have readline 4.0 */ #define HAVE_RL_PRE_INPUT_HOOK 1 /* Define if you have readline 4.0 */ #define HAVE_RL_RESIZE_TERMINAL 1 /* Define to 1 if you have the `round' function. */ #define HAVE_ROUND 1 /* Define to 1 if you have the `sched_get_priority_max' function. */ #define HAVE_SCHED_GET_PRIORITY_MAX 1 /* Define to 1 if you have the header file. */ #define HAVE_SCHED_H 1 /* Define to 1 if you have the `sched_rr_get_interval' function. */ #define HAVE_SCHED_RR_GET_INTERVAL 1 /* Define to 1 if you have the `sched_setaffinity' function. */ #define HAVE_SCHED_SETAFFINITY 1 /* Define to 1 if you have the `sched_setparam' function. */ #define HAVE_SCHED_SETPARAM 1 /* Define to 1 if you have the `sched_setscheduler' function. */ #define HAVE_SCHED_SETSCHEDULER 1 /* Define to 1 if you have the `select' function. */ #define HAVE_SELECT 1 /* Define to 1 if you have the `sem_getvalue' function. */ #define HAVE_SEM_GETVALUE 1 /* Define to 1 if you have the `sem_open' function. */ #define HAVE_SEM_OPEN 1 /* Define to 1 if you have the `sem_timedwait' function. */ #define HAVE_SEM_TIMEDWAIT 1 /* Define to 1 if you have the `sem_unlink' function. */ #define HAVE_SEM_UNLINK 1 /* Define to 1 if you have the `sendfile' function. */ #define HAVE_SENDFILE 1 /* Define to 1 if you have the `setegid' function. */ #define HAVE_SETEGID 1 /* Define to 1 if you have the `seteuid' function. */ #define HAVE_SETEUID 1 /* Define to 1 if you have the `setgid' function. */ #define HAVE_SETGID 1 /* Define if you have the 'setgroups' function. */ #define HAVE_SETGROUPS 1 /* Define to 1 if you have the `sethostname' function. */ #define HAVE_SETHOSTNAME 1 /* Define to 1 if you have the `setitimer' function. */ #define HAVE_SETITIMER 1 /* Define to 1 if you have the `setlocale' function. */ #define HAVE_SETLOCALE 1 /* Define to 1 if you have the `setpgid' function. */ #define HAVE_SETPGID 1 /* Define to 1 if you have the `setpgrp' function. */ #define HAVE_SETPGRP 1 /* Define to 1 if you have the `setpriority' function. */ #define HAVE_SETPRIORITY 1 /* Define to 1 if you have the `setregid' function. */ #define HAVE_SETREGID 1 /* Define to 1 if you have the `setresgid' function. */ #define HAVE_SETRESGID 1 /* Define to 1 if you have the `setresuid' function. */ #define HAVE_SETRESUID 1 /* Define to 1 if you have the `setreuid' function. */ #define HAVE_SETREUID 1 /* Define to 1 if you have the `setsid' function. */ #define HAVE_SETSID 1 /* Define to 1 if you have the `setuid' function. */ #define HAVE_SETUID 1 /* Define to 1 if you have the `setvbuf' function. */ #define HAVE_SETVBUF 1 /* Define to 1 if you have the header file. */ #define HAVE_SHADOW_H 1 /* Define to 1 if you have the `sigaction' function. */ #define HAVE_SIGACTION 1 /* Define to 1 if you have the `sigaltstack' function. */ #define HAVE_SIGALTSTACK 1 /* Define to 1 if you have the `siginterrupt' function. */ #define HAVE_SIGINTERRUPT 1 /* Define to 1 if you have the header file. */ #define HAVE_SIGNAL_H 1 /* Define to 1 if you have the `sigpending' function. */ #define HAVE_SIGPENDING 1 /* Define to 1 if you have the `sigrelse' function. */ #define HAVE_SIGRELSE 1 /* Define to 1 if you have the `sigtimedwait' function. */ #define HAVE_SIGTIMEDWAIT 1 /* Define to 1 if you have the `sigwait' function. */ #define HAVE_SIGWAIT 1 /* Define to 1 if you have the `sigwaitinfo' function. */ #define HAVE_SIGWAITINFO 1 /* Define to 1 if you have the `snprintf' function. */ #define HAVE_SNPRINTF 1 /* struct sockaddr_alg (linux/if_alg.h) */ #define HAVE_SOCKADDR_ALG 1 /* Define if sockaddr has sa_len member */ /* #undef HAVE_SOCKADDR_SA_LEN */ /* struct sockaddr_storage (sys/socket.h) */ #define HAVE_SOCKADDR_STORAGE 1 /* Define if you have the 'socketpair' function. */ #define HAVE_SOCKETPAIR 1 /* Define to 1 if you have the header file. */ #define HAVE_SPAWN_H 1 /* Define if your compiler provides ssize_t */ #define HAVE_SSIZE_T 1 /* Define to 1 if you have the `statvfs' function. */ #define HAVE_STATVFS 1 /* Define if you have struct stat.st_mtim.tv_nsec */ #define HAVE_STAT_TV_NSEC 1 /* Define if you have struct stat.st_mtimensec */ /* #undef HAVE_STAT_TV_NSEC2 */ /* Define if your compiler supports variable length function prototypes (e.g. void fprintf(FILE *, char *, ...);) *and* */ #define HAVE_STDARG_PROTOTYPES 1 /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 /* Has stdatomic.h with atomic_int */ /* #undef HAVE_STD_ATOMIC */ /* Define to 1 if you have the `strdup' function. */ #define HAVE_STRDUP 1 /* Define to 1 if you have the `strftime' function. */ #define HAVE_STRFTIME 1 /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strlcpy' function. */ /* #undef HAVE_STRLCPY */ /* Define to 1 if you have the header file. */ /* #undef HAVE_STROPTS_H */ /* Define to 1 if `pw_gecos' is a member of `struct passwd'. */ #define HAVE_STRUCT_PASSWD_PW_GECOS 1 /* Define to 1 if `pw_passwd' is a member of `struct passwd'. */ #define HAVE_STRUCT_PASSWD_PW_PASSWD 1 /* Define to 1 if `st_birthtime' is a member of `struct stat'. */ /* #undef HAVE_STRUCT_STAT_ST_BIRTHTIME */ /* Define to 1 if `st_blksize' is a member of `struct stat'. */ #define HAVE_STRUCT_STAT_ST_BLKSIZE 1 /* Define to 1 if `st_blocks' is a member of `struct stat'. */ #define HAVE_STRUCT_STAT_ST_BLOCKS 1 /* Define to 1 if `st_flags' is a member of `struct stat'. */ /* #undef HAVE_STRUCT_STAT_ST_FLAGS */ /* Define to 1 if `st_gen' is a member of `struct stat'. */ /* #undef HAVE_STRUCT_STAT_ST_GEN */ /* Define to 1 if `st_rdev' is a member of `struct stat'. */ #define HAVE_STRUCT_STAT_ST_RDEV 1 /* Define to 1 if `tm_zone' is a member of `struct tm'. */ #define HAVE_STRUCT_TM_TM_ZONE 1 /* Define if you have the 'symlink' function. */ #define HAVE_SYMLINK 1 /* Define to 1 if you have the `symlinkat' function. */ #define HAVE_SYMLINKAT 1 /* Define to 1 if you have the `sync' function. */ #define HAVE_SYNC 1 /* Define to 1 if you have the `sysconf' function. */ #define HAVE_SYSCONF 1 /* Define to 1 if you have the header file. */ #define HAVE_SYSEXITS_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_AUDIOIO_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_BSDTTY_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_DEVPOLL_H */ /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_SYS_DIR_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_ENDIAN_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_EPOLL_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_EVENT_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_FILE_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_IOCTL_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_KERN_CONTROL_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_LOADAVG_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_LOCK_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_MKDEV_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_MODEM_H */ /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_SYS_NDIR_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_POLL_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_RANDOM_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_RESOURCE_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_SELECT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_SENDFILE_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_SOCKET_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_STATVFS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_SYSCALL_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_SYSMACROS_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_SYS_DOMAIN_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_TERMIO_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIMES_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_UIO_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_UN_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_UTSNAME_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_WAIT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_XATTR_H 1 /* Define to 1 if you have the `tcgetpgrp' function. */ #define HAVE_TCGETPGRP 1 /* Define to 1 if you have the `tcsetpgrp' function. */ #define HAVE_TCSETPGRP 1 /* Define to 1 if you have the `tempnam' function. */ #define HAVE_TEMPNAM 1 /* Define to 1 if you have the header file. */ #define HAVE_TERMIOS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_TERM_H 1 /* Define to 1 if you have the `tgamma' function. */ #define HAVE_TGAMMA 1 /* Define to 1 if you have the `timegm' function. */ #define HAVE_TIMEGM 1 /* Define to 1 if you have the `times' function. */ #define HAVE_TIMES 1 /* Define to 1 if you have the `tmpfile' function. */ #define HAVE_TMPFILE 1 /* Define to 1 if you have the `tmpnam' function. */ #define HAVE_TMPNAM 1 /* Define to 1 if you have the `tmpnam_r' function. */ #define HAVE_TMPNAM_R 1 /* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use `HAVE_STRUCT_TM_TM_ZONE' instead. */ #define HAVE_TM_ZONE 1 /* Define to 1 if you have the `truncate' function. */ #define HAVE_TRUNCATE 1 /* Define to 1 if you don't have `tm_zone' but do have the external array `tzname'. */ /* #undef HAVE_TZNAME */ /* Define this if you have tcl and TCL_UTF_MAX==6 */ /* #undef HAVE_UCS4_TCL */ /* Define to 1 if you have the `uname' function. */ #define HAVE_UNAME 1 /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the `unlinkat' function. */ #define HAVE_UNLINKAT 1 /* Define to 1 if you have the `unsetenv' function. */ #define HAVE_UNSETENV 1 /* Define if you have a useable wchar_t type defined in wchar.h; useable means wchar_t must be an unsigned type with at least 16 bits. (see Include/unicodeobject.h). */ /* #undef HAVE_USABLE_WCHAR_T */ /* Define to 1 if you have the header file. */ /* #undef HAVE_UTIL_H */ /* Define to 1 if you have the `utimensat' function. */ #define HAVE_UTIMENSAT 1 /* Define to 1 if you have the `utimes' function. */ #define HAVE_UTIMES 1 /* Define to 1 if you have the header file. */ #define HAVE_UTIME_H 1 /* Define to 1 if you have the `wait3' function. */ #define HAVE_WAIT3 1 /* Define to 1 if you have the `wait4' function. */ #define HAVE_WAIT4 1 /* Define to 1 if you have the `waitid' function. */ #define HAVE_WAITID 1 /* Define to 1 if you have the `waitpid' function. */ #define HAVE_WAITPID 1 /* Define if the compiler provides a wchar.h header file. */ #define HAVE_WCHAR_H 1 /* Define to 1 if you have the `wcscoll' function. */ #define HAVE_WCSCOLL 1 /* Define to 1 if you have the `wcsftime' function. */ #define HAVE_WCSFTIME 1 /* Define to 1 if you have the `wcsxfrm' function. */ #define HAVE_WCSXFRM 1 /* Define to 1 if you have the `wmemcmp' function. */ #define HAVE_WMEMCMP 1 /* Define if tzset() actually switches the local timezone in a meaningful way. */ #define HAVE_WORKING_TZSET 1 /* Define to 1 if you have the `writev' function. */ #define HAVE_WRITEV 1 /* Define if the zlib library has inflateCopy */ #define HAVE_ZLIB_COPY 1 /* Define to 1 if you have the `_getpty' function. */ /* #undef HAVE__GETPTY */ /* Define if log1p(-0.) is 0. rather than -0. */ /* #undef LOG1P_DROPS_ZERO_SIGN */ /* Define to 1 if `major', `minor', and `makedev' are declared in . */ /* #undef MAJOR_IN_MKDEV */ /* Define to 1 if `major', `minor', and `makedev' are declared in . */ /* #undef MAJOR_IN_SYSMACROS */ /* Define if mvwdelch in curses.h is an expression. */ #define MVWDELCH_IS_EXPRESSION 1 /* Define to the address where bug reports for this package should be sent. */ /* #undef PACKAGE_BUGREPORT */ /* Define to the full name of this package. */ /* #undef PACKAGE_NAME */ /* Define to the full name and version of this package. */ /* #undef PACKAGE_STRING */ /* Define to the one symbol short name of this package. */ /* #undef PACKAGE_TARNAME */ /* Define to the home page for this package. */ /* #undef PACKAGE_URL */ /* Define to the version of this package. */ /* #undef PACKAGE_VERSION */ /* Define if POSIX semaphores aren't enabled on your system */ /* #undef POSIX_SEMAPHORES_NOT_ENABLED */ /* Defined if PTHREAD_SCOPE_SYSTEM supported. */ #define PTHREAD_SYSTEM_SCHED_SUPPORTED 1 /* Define as the preferred size in bits of long digits */ /* #undef PYLONG_BITS_IN_DIGIT */ /* Define if you want to coerce the C locale to a UTF-8 based locale */ #define PY_COERCE_C_LOCALE 1 /* Define to printf format modifier for Py_ssize_t */ #define PY_FORMAT_SIZE_T "z" /* Default cipher suites list for ssl module. 1: Python's preferred selection, 2: leave OpenSSL defaults untouched, 0: custom string */ #define PY_SSL_DEFAULT_CIPHERS 2 /* Cipher suite string for PY_SSL_DEFAULT_CIPHERS=0 */ /* #undef PY_SSL_DEFAULT_CIPHER_STRING */ /* Define to emit a locale compatibility warning in the C locale */ #define PY_WARN_ON_C_LOCALE 1 /* Define if you want to build an interpreter with many run-time checks. */ /* #undef Py_DEBUG */ /* Defined if Python is built as a shared library. */ #define Py_ENABLE_SHARED 1 /* Define hash algorithm for str, bytes and memoryview. SipHash24: 1, FNV: 2, externally defined: 0 */ /* #undef Py_HASH_ALGORITHM */ /* assume C89 semantics that RETSIGTYPE is always void */ #define RETSIGTYPE void /* Define if setpgrp() must be called as setpgrp(0, 0). */ /* #undef SETPGRP_HAVE_ARG */ /* Define if i>>j for signed int i does not extend the sign bit when i < 0 */ /* #undef SIGNED_RIGHT_SHIFT_ZERO_FILLS */ /* The size of `double', as computed by sizeof. */ #define SIZEOF_DOUBLE 8 /* The size of `float', as computed by sizeof. */ #define SIZEOF_FLOAT 4 /* The size of `fpos_t', as computed by sizeof. */ #define SIZEOF_FPOS_T 16 /* The size of `int', as computed by sizeof. */ #define SIZEOF_INT 4 /* The size of `long', as computed by sizeof. */ #define SIZEOF_LONG 8 /* The size of `long double', as computed by sizeof. */ #define SIZEOF_LONG_DOUBLE 16 /* The size of `long long', as computed by sizeof. */ #define SIZEOF_LONG_LONG 8 /* The size of `off_t', as computed by sizeof. */ #define SIZEOF_OFF_T 8 /* The size of `pid_t', as computed by sizeof. */ #define SIZEOF_PID_T 4 /* The size of `pthread_t', as computed by sizeof. */ #define SIZEOF_PTHREAD_T 8 /* The size of `short', as computed by sizeof. */ #define SIZEOF_SHORT 2 /* The size of `size_t', as computed by sizeof. */ #define SIZEOF_SIZE_T 8 /* The size of `time_t', as computed by sizeof. */ #define SIZEOF_TIME_T 8 /* The size of `uintptr_t', as computed by sizeof. */ #define SIZEOF_UINTPTR_T 8 /* The size of `void *', as computed by sizeof. */ #define SIZEOF_VOID_P 8 /* The size of `wchar_t', as computed by sizeof. */ #define SIZEOF_WCHAR_T 4 /* The size of `_Bool', as computed by sizeof. */ #define SIZEOF__BOOL 1 /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define if you can safely include both and (which you can't on SCO ODT 3.0). */ #define SYS_SELECT_WITH_SYS_TIME 1 /* Define if tanh(-0.) is -0., or if platform doesn't have signed zeros */ #define TANH_PRESERVES_ZERO_SIGN 1 /* Library needed by timemodule.c: librt may be needed for clock_gettime() */ /* #undef TIMEMODULE_LIB */ /* Define to 1 if you can safely include both and . */ #define TIME_WITH_SYS_TIME 1 /* Define to 1 if your declares `struct tm'. */ /* #undef TM_IN_SYS_TIME */ /* Define if you want to use computed gotos in ceval.c. */ #define USE_COMPUTED_GOTOS 1 /* Define to use the C99 inline keyword. */ #define USE_INLINE 1 /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # define _ALL_SOURCE 1 #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # define _POSIX_PTHREAD_SEMANTICS 1 #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # define _TANDEM_SOURCE 1 #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # define __EXTENSIONS__ 1 #endif /* Define if you want SIGFPE handled (see Include/pyfpe.h). */ /* #undef WANT_SIGFPE_HANDLER */ /* Define if WINDOW in curses.h offers a field _flags. */ #define WINDOW_HAS_FLAGS 1 /* Define if you want documentation strings in extension modules */ #define WITH_DOC_STRINGS 1 /* Define if you want to compile in DTrace support */ #define WITH_DTRACE 1 /* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic linker (dyld) instead of the old-style (NextStep) dynamic linker (rld). Dyld is necessary to support frameworks. */ /* #undef WITH_DYLD */ /* Define to 1 if libintl is needed for locale functions. */ /* #undef WITH_LIBINTL */ /* Define if you want to produce an OpenStep/Rhapsody framework (shared library plus accessory files). */ /* #undef WITH_NEXT_FRAMEWORK */ /* Define if you want to compile in Python-specific mallocs */ #define WITH_PYMALLOC 1 /* Define if you want to compile in rudimentary thread support */ #define WITH_THREAD 1 /* Define if you want pymalloc to be disabled when running under valgrind */ /* #undef WITH_VALGRIND */ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN /* # undef WORDS_BIGENDIAN */ # endif #endif /* Define if arithmetic is subject to x87-style double rounding issue */ /* #undef X87_DOUBLE_ROUNDING */ /* Define on OpenBSD to activate all library features */ /* #undef _BSD_SOURCE */ /* Define on Irix to enable u_int */ #define _BSD_TYPES 1 /* Define on Darwin to activate all library features */ #define _DARWIN_C_SOURCE 1 /* This must be set to 64 on some systems to enable large file support. */ #define _FILE_OFFSET_BITS 64 /* Define on Linux to activate all library features */ #define _GNU_SOURCE 1 /* Define to include mbstate_t for mbrtowc */ /* #undef _INCLUDE__STDC_A1_SOURCE */ /* This must be defined on some systems to enable large file support. */ #define _LARGEFILE_SOURCE 1 /* This must be defined on AIX systems to enable large file support. */ /* #undef _LARGE_FILES */ /* Define to 1 if on MINIX. */ /* #undef _MINIX */ /* Define on NetBSD to activate all library features */ #define _NETBSD_SOURCE 1 /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ /* #undef _POSIX_1_SOURCE */ /* Define to activate features from IEEE Stds 1003.1-2008 */ #define _POSIX_C_SOURCE 200809L /* Define to 1 if you need to in order for `stat' and other things to work. */ /* #undef _POSIX_SOURCE */ /* Define if you have POSIX threads, and your system does not define that. */ /* #undef _POSIX_THREADS */ /* Define to force use of thread-safe errno, h_errno, and other functions */ /* #undef _REENTRANT */ /* Define to the level of X/Open that your system supports */ #define _XOPEN_SOURCE 700 /* Define to activate Unix95-and-earlier features */ #define _XOPEN_SOURCE_EXTENDED 1 /* Define on FreeBSD to activate all library features */ #define __BSD_VISIBLE 1 /* Define to 1 if type `char' is unsigned and you are not using gcc. */ #ifndef __CHAR_UNSIGNED__ /* # undef __CHAR_UNSIGNED__ */ #endif /* Define to 'long' if doesn't define. */ /* #undef clock_t */ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ /* Define to `int' if doesn't define. */ /* #undef gid_t */ /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus /* #undef inline */ #endif /* Define to `int' if does not define. */ /* #undef mode_t */ /* Define to `long int' if does not define. */ /* #undef off_t */ /* Define to `int' if does not define. */ /* #undef pid_t */ /* Define to empty if the keyword does not work. */ /* #undef signed */ /* Define to `unsigned int' if does not define. */ /* #undef size_t */ /* Define to `int' if does not define. */ /* #undef socklen_t */ /* Define to `int' if doesn't define. */ /* #undef uid_t */ /* Define to empty if the keyword does not work. */ /* #undef volatile */ /* Define the macros needed if on a UnixWare 7.x system. */ #if defined(__USLC__) && defined(__SCO_VERSION__) #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ #endif #endif /*Py_PYCONFIG_H*/ sqlda.h000064400000000473147631660250006037 0ustar00#ifndef ECPG_SQLDA_H #define ECPG_SQLDA_H #ifdef _ECPG_INFORMIX_H #include "sqlda-compat.h" typedef struct sqlvar_compat sqlvar_t; typedef struct sqlda_compat sqlda_t; #else #include "sqlda-native.h" typedef struct sqlvar_struct sqlvar_t; typedef struct sqlda_struct sqlda_t; #endif #endif /* ECPG_SQLDA_H */ argp.h000064400000061404147631660250005665 0ustar00/* Hierarchial argument parsing, layered over getopt. Copyright (C) 1995-1999, 2003, 2004, 2005, 2006, 2007, 2009, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _ARGP_H #define _ARGP_H #include #include #include #include #define __need_error_t #include #ifndef __error_t_defined typedef int error_t; # define __error_t_defined #endif __BEGIN_DECLS /* A description of a particular option. A pointer to an array of these is passed in the OPTIONS field of an argp structure. Each option entry can correspond to one long option and/or one short option; more names for the same option can be added by following an entry in an option array with options having the OPTION_ALIAS flag set. */ struct argp_option { /* The long option name. For more than one name for the same option, you can use following options with the OPTION_ALIAS flag set. */ const char *name; /* What key is returned for this option. If > 0 and printable, then it's also accepted as a short option. */ int key; /* If non-NULL, this is the name of the argument associated with this option, which is required unless the OPTION_ARG_OPTIONAL flag is set. */ const char *arg; /* OPTION_ flags. */ int flags; /* The doc string for this option. If both NAME and KEY are 0, This string will be printed outdented from the normal option column, making it useful as a group header (it will be the first thing printed in its group); in this usage, it's conventional to end the string with a `:'. */ const char *doc; /* The group this option is in. In a long help message, options are sorted alphabetically within each group, and the groups presented in the order 0, 1, 2, ..., n, -m, ..., -2, -1. Every entry in an options array with if this field 0 will inherit the group number of the previous entry, or zero if it's the first one, unless its a group header (NAME and KEY both 0), in which case, the previous entry + 1 is the default. Automagic options such as --help are put into group -1. */ int group; }; /* The argument associated with this option is optional. */ #define OPTION_ARG_OPTIONAL 0x1 /* This option isn't displayed in any help messages. */ #define OPTION_HIDDEN 0x2 /* This option is an alias for the closest previous non-alias option. This means that it will be displayed in the same help entry, and will inherit fields other than NAME and KEY from the aliased option. */ #define OPTION_ALIAS 0x4 /* This option isn't actually an option (and so should be ignored by the actual option parser), but rather an arbitrary piece of documentation that should be displayed in much the same manner as the options. If this flag is set, then the option NAME field is displayed unmodified (e.g., no `--' prefix is added) at the left-margin (where a *short* option would normally be displayed), and the documentation string in the normal place. For purposes of sorting, any leading whitespace and punctuation is ignored, except that if the first non-whitespace character is not `-', this entry is displayed after all options (and OPTION_DOC entries with a leading `-') in the same group. */ #define OPTION_DOC 0x8 /* This option shouldn't be included in `long' usage messages (but is still included in help messages). This is mainly intended for options that are completely documented in an argp's ARGS_DOC field, in which case including the option in the generic usage list would be redundant. For instance, if ARGS_DOC is "FOO BAR\n-x BLAH", and the `-x' option's purpose is to distinguish these two cases, -x should probably be marked OPTION_NO_USAGE. */ #define OPTION_NO_USAGE 0x10 struct argp; /* fwd declare this type */ struct argp_state; /* " */ struct argp_child; /* " */ /* The type of a pointer to an argp parsing function. */ typedef error_t (*argp_parser_t) (int __key, char *__arg, struct argp_state *__state); /* What to return for unrecognized keys. For special ARGP_KEY_ keys, such returns will simply be ignored. For user keys, this error will be turned into EINVAL (if the call to argp_parse is such that errors are propagated back to the user instead of exiting); returning EINVAL itself would result in an immediate stop to parsing in *all* cases. */ #define ARGP_ERR_UNKNOWN E2BIG /* Hurd should never need E2BIG. XXX */ /* Special values for the KEY argument to an argument parsing function. ARGP_ERR_UNKNOWN should be returned if they aren't understood. The sequence of keys to a parsing function is either (where each uppercased word should be prefixed by `ARGP_KEY_' and opt is a user key): INIT opt... NO_ARGS END SUCCESS -- No non-option arguments at all or INIT (opt | ARG)... END SUCCESS -- All non-option args parsed or INIT (opt | ARG)... SUCCESS -- Some non-option arg unrecognized The third case is where every parser returned ARGP_KEY_UNKNOWN for an argument, in which case parsing stops at that argument (returning the unparsed arguments to the caller of argp_parse if requested, or stopping with an error message if not). If an error occurs (either detected by argp, or because the parsing function returned an error value), then the parser is called with ARGP_KEY_ERROR, and no further calls are made. */ /* This is not an option at all, but rather a command line argument. If a parser receiving this key returns success, the fact is recorded, and the ARGP_KEY_NO_ARGS case won't be used. HOWEVER, if while processing the argument, a parser function decrements the NEXT field of the state it's passed, the option won't be considered processed; this is to allow you to actually modify the argument (perhaps into an option), and have it processed again. */ #define ARGP_KEY_ARG 0 /* There are remaining arguments not parsed by any parser, which may be found starting at (STATE->argv + STATE->next). If success is returned, but STATE->next left untouched, it's assumed that all arguments were consume, otherwise, the parser should adjust STATE->next to reflect any arguments consumed. */ #define ARGP_KEY_ARGS 0x1000006 /* There are no more command line arguments at all. */ #define ARGP_KEY_END 0x1000001 /* Because it's common to want to do some special processing if there aren't any non-option args, user parsers are called with this key if they didn't successfully process any non-option arguments. Called just before ARGP_KEY_END (where more general validity checks on previously parsed arguments can take place). */ #define ARGP_KEY_NO_ARGS 0x1000002 /* Passed in before any parsing is done. Afterwards, the values of each element of the CHILD_INPUT field, if any, in the state structure is copied to each child's state to be the initial value of the INPUT field. */ #define ARGP_KEY_INIT 0x1000003 /* Use after all other keys, including SUCCESS & END. */ #define ARGP_KEY_FINI 0x1000007 /* Passed in when parsing has successfully been completed (even if there are still arguments remaining). */ #define ARGP_KEY_SUCCESS 0x1000004 /* Passed in if an error occurs. */ #define ARGP_KEY_ERROR 0x1000005 /* An argp structure contains a set of options declarations, a function to deal with parsing one, documentation string, a possible vector of child argp's, and perhaps a function to filter help output. When actually parsing options, getopt is called with the union of all the argp structures chained together through their CHILD pointers, with conflicts being resolved in favor of the first occurrence in the chain. */ struct argp { /* An array of argp_option structures, terminated by an entry with both NAME and KEY having a value of 0. */ const struct argp_option *options; /* What to do with an option from this structure. KEY is the key associated with the option, and ARG is any associated argument (NULL if none was supplied). If KEY isn't understood, ARGP_ERR_UNKNOWN should be returned. If a non-zero, non-ARGP_ERR_UNKNOWN value is returned, then parsing is stopped immediately, and that value is returned from argp_parse(). For special (non-user-supplied) values of KEY, see the ARGP_KEY_ definitions below. */ argp_parser_t parser; /* A string describing what other arguments are wanted by this program. It is only used by argp_usage to print the `Usage:' message. If it contains newlines, the strings separated by them are considered alternative usage patterns, and printed on separate lines (lines after the first are prefix by ` or: ' instead of `Usage:'). */ const char *args_doc; /* If non-NULL, a string containing extra text to be printed before and after the options in a long help message (separated by a vertical tab `\v' character). */ const char *doc; /* A vector of argp_children structures, terminated by a member with a 0 argp field, pointing to child argps should be parsed with this one. Any conflicts are resolved in favor of this argp, or early argps in the CHILDREN list. This field is useful if you use libraries that supply their own argp structure, which you want to use in conjunction with your own. */ const struct argp_child *children; /* If non-zero, this should be a function to filter the output of help messages. KEY is either a key from an option, in which case TEXT is that option's help text, or a special key from the ARGP_KEY_HELP_ defines, below, describing which other help text TEXT is. The function should return either TEXT, if it should be used as-is, a replacement string, which should be malloced, and will be freed by argp, or NULL, meaning `print nothing'. The value for TEXT is *after* any translation has been done, so if any of the replacement text also needs translation, that should be done by the filter function. INPUT is either the input supplied to argp_parse, or NULL, if argp_help was called directly. */ char *(*help_filter) (int __key, const char *__text, void *__input); /* If non-zero the strings used in the argp library are translated using the domain described by this string. Otherwise the currently installed default domain is used. */ const char *argp_domain; }; /* Possible KEY arguments to a help filter function. */ #define ARGP_KEY_HELP_PRE_DOC 0x2000001 /* Help text preceeding options. */ #define ARGP_KEY_HELP_POST_DOC 0x2000002 /* Help text following options. */ #define ARGP_KEY_HELP_HEADER 0x2000003 /* Option header string. */ #define ARGP_KEY_HELP_EXTRA 0x2000004 /* After all other documentation; TEXT is NULL for this key. */ /* Explanatory note emitted when duplicate option arguments have been suppressed. */ #define ARGP_KEY_HELP_DUP_ARGS_NOTE 0x2000005 #define ARGP_KEY_HELP_ARGS_DOC 0x2000006 /* Argument doc string. */ /* When an argp has a non-zero CHILDREN field, it should point to a vector of argp_child structures, each of which describes a subsidiary argp. */ struct argp_child { /* The child parser. */ const struct argp *argp; /* Flags for this child. */ int flags; /* If non-zero, an optional header to be printed in help output before the child options. As a side-effect, a non-zero value forces the child options to be grouped together; to achieve this effect without actually printing a header string, use a value of "". */ const char *header; /* Where to group the child options relative to the other (`consolidated') options in the parent argp; the values are the same as the GROUP field in argp_option structs, but all child-groupings follow parent options at a particular group level. If both this field and HEADER are zero, then they aren't grouped at all, but rather merged with the parent options (merging the child's grouping levels with the parents). */ int group; }; /* Parsing state. This is provided to parsing functions called by argp, which may examine and, as noted, modify fields. */ struct argp_state { /* The top level ARGP being parsed. */ const struct argp *root_argp; /* The argument vector being parsed. May be modified. */ int argc; char **argv; /* The index in ARGV of the next arg that to be parsed. May be modified. */ int next; /* The flags supplied to argp_parse. May be modified. */ unsigned flags; /* While calling a parsing function with a key of ARGP_KEY_ARG, this is the number of the current arg, starting at zero, and incremented after each such call returns. At all other times, this is the number of such arguments that have been processed. */ unsigned arg_num; /* If non-zero, the index in ARGV of the first argument following a special `--' argument (which prevents anything following being interpreted as an option). Only set once argument parsing has proceeded past this point. */ int quoted; /* An arbitrary pointer passed in from the user. */ void *input; /* Values to pass to child parsers. This vector will be the same length as the number of children for the current parser. */ void **child_inputs; /* For the parser's use. Initialized to 0. */ void *hook; /* The name used when printing messages. This is initialized to ARGV[0], or PROGRAM_INVOCATION_NAME if that is unavailable. */ char *name; /* Streams used when argp prints something. */ FILE *err_stream; /* For errors; initialized to stderr. */ FILE *out_stream; /* For information; initialized to stdout. */ void *pstate; /* Private, for use by argp. */ }; /* Flags for argp_parse (note that the defaults are those that are convenient for program command line parsing): */ /* Don't ignore the first element of ARGV. Normally (and always unless ARGP_NO_ERRS is set) the first element of the argument vector is skipped for option parsing purposes, as it corresponds to the program name in a command line. */ #define ARGP_PARSE_ARGV0 0x01 /* Don't print error messages for unknown options to stderr; unless this flag is set, ARGP_PARSE_ARGV0 is ignored, as ARGV[0] is used as the program name in the error messages. This flag implies ARGP_NO_EXIT (on the assumption that silent exiting upon errors is bad behaviour). */ #define ARGP_NO_ERRS 0x02 /* Don't parse any non-option args. Normally non-option args are parsed by calling the parse functions with a key of ARGP_KEY_ARG, and the actual arg as the value. Since it's impossible to know which parse function wants to handle it, each one is called in turn, until one returns 0 or an error other than ARGP_ERR_UNKNOWN; if an argument is handled by no one, the argp_parse returns prematurely (but with a return value of 0). If all args have been parsed without error, all parsing functions are called one last time with a key of ARGP_KEY_END. This flag needn't normally be set, as the normal behavior is to stop parsing as soon as some argument can't be handled. */ #define ARGP_NO_ARGS 0x04 /* Parse options and arguments in the same order they occur on the command line -- normally they're rearranged so that all options come first. */ #define ARGP_IN_ORDER 0x08 /* Don't provide the standard long option --help, which causes usage and option help information to be output to stdout, and exit (0) called. */ #define ARGP_NO_HELP 0x10 /* Don't exit on errors (they may still result in error messages). */ #define ARGP_NO_EXIT 0x20 /* Use the gnu getopt `long-only' rules for parsing arguments. */ #define ARGP_LONG_ONLY 0x40 /* Turns off any message-printing/exiting options. */ #define ARGP_SILENT (ARGP_NO_EXIT | ARGP_NO_ERRS | ARGP_NO_HELP) /* Parse the options strings in ARGC & ARGV according to the options in ARGP. FLAGS is one of the ARGP_ flags above. If ARG_INDEX is non-NULL, the index in ARGV of the first unparsed option is returned in it. If an unknown option is present, ARGP_ERR_UNKNOWN is returned; if some parser routine returned a non-zero value, it is returned; otherwise 0 is returned. This function may also call exit unless the ARGP_NO_HELP flag is set. INPUT is a pointer to a value to be passed in to the parser. */ extern error_t argp_parse (const struct argp *__restrict __argp, int __argc, char **__restrict __argv, unsigned __flags, int *__restrict __arg_index, void *__restrict __input); extern error_t __argp_parse (const struct argp *__restrict __argp, int __argc, char **__restrict __argv, unsigned __flags, int *__restrict __arg_index, void *__restrict __input); /* Global variables. */ /* If defined or set by the user program to a non-zero value, then a default option --version is added (unless the ARGP_NO_HELP flag is used), which will print this string followed by a newline and exit (unless the ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */ extern const char *argp_program_version; /* If defined or set by the user program to a non-zero value, then a default option --version is added (unless the ARGP_NO_HELP flag is used), which calls this function with a stream to print the version to and a pointer to the current parsing state, and then exits (unless the ARGP_NO_EXIT flag is used). This variable takes precedent over ARGP_PROGRAM_VERSION. */ extern void (*argp_program_version_hook) (FILE *__restrict __stream, struct argp_state *__restrict __state); /* If defined or set by the user program, it should point to string that is the bug-reporting address for the program. It will be printed by argp_help if the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help messages), embedded in a sentence that says something like `Report bugs to ADDR.'. */ extern const char *argp_program_bug_address; /* The exit status that argp will use when exiting due to a parsing error. If not defined or set by the user program, this defaults to EX_USAGE from . */ extern error_t argp_err_exit_status; /* Flags for argp_help. */ #define ARGP_HELP_USAGE 0x01 /* a Usage: message. */ #define ARGP_HELP_SHORT_USAGE 0x02 /* " but don't actually print options. */ #define ARGP_HELP_SEE 0x04 /* a `Try ... for more help' message. */ #define ARGP_HELP_LONG 0x08 /* a long help message. */ #define ARGP_HELP_PRE_DOC 0x10 /* doc string preceding long help. */ #define ARGP_HELP_POST_DOC 0x20 /* doc string following long help. */ #define ARGP_HELP_DOC (ARGP_HELP_PRE_DOC | ARGP_HELP_POST_DOC) #define ARGP_HELP_BUG_ADDR 0x40 /* bug report address */ #define ARGP_HELP_LONG_ONLY 0x80 /* modify output appropriately to reflect ARGP_LONG_ONLY mode. */ /* These ARGP_HELP flags are only understood by argp_state_help. */ #define ARGP_HELP_EXIT_ERR 0x100 /* Call exit(1) instead of returning. */ #define ARGP_HELP_EXIT_OK 0x200 /* Call exit(0) instead of returning. */ /* The standard thing to do after a program command line parsing error, if an error message has already been printed. */ #define ARGP_HELP_STD_ERR \ (ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR) /* The standard thing to do after a program command line parsing error, if no more specific error message has been printed. */ #define ARGP_HELP_STD_USAGE \ (ARGP_HELP_SHORT_USAGE | ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR) /* The standard thing to do in response to a --help option. */ #define ARGP_HELP_STD_HELP \ (ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG | ARGP_HELP_EXIT_OK \ | ARGP_HELP_DOC | ARGP_HELP_BUG_ADDR) /* Output a usage message for ARGP to STREAM. FLAGS are from the set ARGP_HELP_*. */ extern void argp_help (const struct argp *__restrict __argp, FILE *__restrict __stream, unsigned __flags, char *__restrict __name); extern void __argp_help (const struct argp *__restrict __argp, FILE *__restrict __stream, unsigned __flags, char *__name); /* The following routines are intended to be called from within an argp parsing routine (thus taking an argp_state structure as the first argument). They may or may not print an error message and exit, depending on the flags in STATE -- in any case, the caller should be prepared for them *not* to exit, and should return an appropiate error after calling them. [argp_usage & argp_error should probably be called argp_state_..., but they're used often enough that they should be short] */ /* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are from the set ARGP_HELP_*. */ extern void argp_state_help (const struct argp_state *__restrict __state, FILE *__restrict __stream, unsigned int __flags); extern void __argp_state_help (const struct argp_state *__restrict __state, FILE *__restrict __stream, unsigned int __flags); /* Possibly output the standard usage message for ARGP to stderr and exit. */ extern void argp_usage (const struct argp_state *__state); extern void __argp_usage (const struct argp_state *__state); /* If appropriate, print the printf string FMT and following args, preceded by the program name and `:', to stderr, and followed by a `Try ... --help' message, then exit (1). */ extern void argp_error (const struct argp_state *__restrict __state, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); extern void __argp_error (const struct argp_state *__restrict __state, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); /* Similar to the standard gnu error-reporting function error(), but will respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print to STATE->err_stream. This is useful for argument parsing code that is shared between program startup (when exiting is desired) and runtime option parsing (when typically an error code is returned instead). The difference between this function and argp_error is that the latter is for *parsing errors*, and the former is for other problems that occur during parsing but don't reflect a (syntactic) problem with the input. */ extern void argp_failure (const struct argp_state *__restrict __state, int __status, int __errnum, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 4, 5))); extern void __argp_failure (const struct argp_state *__restrict __state, int __status, int __errnum, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 4, 5))); /* Returns true if the option OPT is a valid short option. */ extern int _option_is_short (const struct argp_option *__opt) __THROW; extern int __option_is_short (const struct argp_option *__opt) __THROW; /* Returns true if the option OPT is in fact the last (unused) entry in an options array. */ extern int _option_is_end (const struct argp_option *__opt) __THROW; extern int __option_is_end (const struct argp_option *__opt) __THROW; /* Return the input field for ARGP in the parser corresponding to STATE; used by the help routines. */ extern void *_argp_input (const struct argp *__restrict __argp, const struct argp_state *__restrict __state) __THROW; extern void *__argp_input (const struct argp *__restrict __argp, const struct argp_state *__restrict __state) __THROW; #ifdef __USE_EXTERN_INLINES # if !_LIBC # define __argp_usage argp_usage # define __argp_state_help argp_state_help # define __option_is_short _option_is_short # define __option_is_end _option_is_end # endif # ifndef ARGP_EI # define ARGP_EI __extern_inline # endif ARGP_EI void __argp_usage (const struct argp_state *__state) { __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE); } ARGP_EI int __NTH (__option_is_short (const struct argp_option *__opt)) { if (__opt->flags & OPTION_DOC) return 0; else { int __key = __opt->key; return __key > 0 && __key <= UCHAR_MAX && isprint (__key); } } ARGP_EI int __NTH (__option_is_end (const struct argp_option *__opt)) { return !__opt->key && !__opt->name && !__opt->doc && !__opt->group; } # if !_LIBC # undef __argp_usage # undef __argp_state_help # undef __option_is_short # undef __option_is_end # endif #endif /* Use extern inlines. */ __END_DECLS #endif /* argp.h */ X11/Xcms.h000064400000051542147631660250006221 0ustar00 /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * DESCRIPTION * Public include file for X Color Management System */ #ifndef _X11_XCMS_H_ #define _X11_XCMS_H_ #include /* The Xcms structs are full of implicit padding to properly align members. We can't clean that up without breaking ABI, so tell clang not to bother complaining about it. */ #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpadded" #endif /* * XCMS Status Values */ #define XcmsFailure 0 #define XcmsSuccess 1 #define XcmsSuccessWithCompression 2 /* * Color Space Format ID's * Color Space ID's are of XcmsColorFormat type. * * bit 31 * 0 == Device-Independent * 1 == Device-Dependent * * bit 30: * 0 == Registered with X Consortium * 1 == Unregistered */ #define XcmsUndefinedFormat (XcmsColorFormat)0x00000000 #define XcmsCIEXYZFormat (XcmsColorFormat)0x00000001 #define XcmsCIEuvYFormat (XcmsColorFormat)0x00000002 #define XcmsCIExyYFormat (XcmsColorFormat)0x00000003 #define XcmsCIELabFormat (XcmsColorFormat)0x00000004 #define XcmsCIELuvFormat (XcmsColorFormat)0x00000005 #define XcmsTekHVCFormat (XcmsColorFormat)0x00000006 #define XcmsRGBFormat (XcmsColorFormat)0x80000000 #define XcmsRGBiFormat (XcmsColorFormat)0x80000001 /* * State of XcmsPerScrnInfo */ #define XcmsInitNone 0x00 /* no initialization attempted */ #define XcmsInitSuccess 0x01 /* initialization successful */ #define XcmsInitFailure 0xff /* failure, use defaults */ #define DisplayOfCCC(ccc) ((ccc)->dpy) #define ScreenNumberOfCCC(ccc) ((ccc)->screenNumber) #define VisualOfCCC(ccc) ((ccc)->visual) #define ClientWhitePointOfCCC(ccc) (&(ccc)->clientWhitePt) #define ScreenWhitePointOfCCC(ccc) (&(ccc)->pPerScrnInfo->screenWhitePt) #define FunctionSetOfCCC(ccc) ((ccc)->pPerScrnInfo->functionSet) typedef unsigned long XcmsColorFormat; /* Color Space Format ID */ typedef double XcmsFloat; /* * Device RGB */ typedef struct { unsigned short red; /* scaled from 0x0000 to 0xffff */ unsigned short green; /* scaled from 0x0000 to 0xffff */ unsigned short blue; /* scaled from 0x0000 to 0xffff */ } XcmsRGB; /* * RGB Intensity */ typedef struct { XcmsFloat red; /* 0.0 - 1.0 */ XcmsFloat green; /* 0.0 - 1.0 */ XcmsFloat blue; /* 0.0 - 1.0 */ } XcmsRGBi; /* * CIE XYZ */ typedef struct { XcmsFloat X; XcmsFloat Y; XcmsFloat Z; } XcmsCIEXYZ; /* * CIE u'v'Y */ typedef struct { XcmsFloat u_prime; /* 0.0 - 1.0 */ XcmsFloat v_prime; /* 0.0 - 1.0 */ XcmsFloat Y; /* 0.0 - 1.0 */ } XcmsCIEuvY; /* * CIE xyY */ typedef struct { XcmsFloat x; /* 0.0 - 1.0 */ XcmsFloat y; /* 0.0 - 1.0 */ XcmsFloat Y; /* 0.0 - 1.0 */ } XcmsCIExyY; /* * CIE L*a*b* */ typedef struct { XcmsFloat L_star; /* 0.0 - 100.0 */ XcmsFloat a_star; XcmsFloat b_star; } XcmsCIELab; /* * CIE L*u*v* */ typedef struct { XcmsFloat L_star; /* 0.0 - 100.0 */ XcmsFloat u_star; XcmsFloat v_star; } XcmsCIELuv; /* * TekHVC */ typedef struct { XcmsFloat H; /* 0.0 - 360.0 */ XcmsFloat V; /* 0.0 - 100.0 */ XcmsFloat C; /* 0.0 - 100.0 */ } XcmsTekHVC; /* * PAD */ typedef struct { XcmsFloat pad0; XcmsFloat pad1; XcmsFloat pad2; XcmsFloat pad3; } XcmsPad; /* * XCMS Color Structure */ typedef struct { union { XcmsRGB RGB; XcmsRGBi RGBi; XcmsCIEXYZ CIEXYZ; XcmsCIEuvY CIEuvY; XcmsCIExyY CIExyY; XcmsCIELab CIELab; XcmsCIELuv CIELuv; XcmsTekHVC TekHVC; XcmsPad Pad; } spec; /* the color specification */ unsigned long pixel; /* pixel value (as needed) */ XcmsColorFormat format; /* the specification format */ } XcmsColor; /* * XCMS Per Screen related data */ typedef struct _XcmsPerScrnInfo { XcmsColor screenWhitePt; /* Screen White point */ XPointer functionSet; /* pointer to Screen Color Characterization */ /* Function Set structure */ XPointer screenData; /* pointer to corresponding Screen Color*/ /* Characterization Data */ unsigned char state; /* XcmsInitNone, XcmsInitSuccess, XcmsInitFailure */ char pad[3]; } XcmsPerScrnInfo; typedef struct _XcmsCCC *XcmsCCC; typedef Status (*XcmsCompressionProc)( /* Gamut Compression Proc */ XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); typedef Status (*XcmsWhiteAdjustProc)( /* White Point Adjust Proc */ XcmsCCC /* ccc */, XcmsColor* /* initial_white_point*/, XcmsColor* /* target_white_point*/, XcmsColorFormat /* target_format */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, Bool* /* compression_flags_return */ ); /* * XCMS Color Conversion Context */ typedef struct _XcmsCCC { Display *dpy; /* X Display */ int screenNumber; /* X screen number */ Visual *visual; /* X Visual */ XcmsColor clientWhitePt; /* Client White Point */ XcmsCompressionProc gamutCompProc; /* Gamut Compression Function */ XPointer gamutCompClientData; /* Gamut Comp Func Client Data */ XcmsWhiteAdjustProc whitePtAdjProc; /* White Point Adjustment Function */ XPointer whitePtAdjClientData; /* White Pt Adj Func Client Data */ XcmsPerScrnInfo *pPerScrnInfo; /* pointer to per screen information */ /* associated with the above display */ /* screenNumber */ } XcmsCCCRec; typedef Status (*XcmsScreenInitProc)( /* Screen Initialization Proc */ Display* /* dpy */, int /* screen_number */, XcmsPerScrnInfo* /* screen_info */ ); typedef void (*XcmsScreenFreeProc)( XPointer /* screenData */ ); /* * Function List Pointer -- pointer to an array of function pointers. * The end of list is indicated by a NULL pointer. */ /* * XXX: The use of the XcmsConversionProc type is broken. The * device-independent colour conversion code uses it as: typedef Status (*XcmsConversionProc)(XcmsCCC, XcmsColor *, XcmsColor *, unsigned int); * while the device-dependent code uses it as: typedef Status (*XcmsConversionProc)(XcmsCCC, XcmsColor *, unsigned int, Bool *); * Until this is reworked, it's probably best to leave it unprotoized. * The code works regardless. */ typedef Status (*XcmsDDConversionProc)( /* using device-dependent version */ XcmsCCC /* ccc */, XcmsColor* /* pcolors_in_out */, unsigned int /* ncolors */, Bool* /* pCompressed */ ); typedef Status (*XcmsDIConversionProc)( /* using device-independent version */ XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* pcolors_in_out */, unsigned int /* ncolors */ ); typedef XcmsDIConversionProc XcmsConversionProc; typedef XcmsConversionProc *XcmsFuncListPtr; typedef int (*XcmsParseStringProc)( /* Color String Parsing Proc */ char* /* color_string */, XcmsColor* /* color_return */ ); /* * Color Space -- per Color Space related data (Device-Independent * or Device-Dependent) */ typedef struct _XcmsColorSpace { const char *prefix; /* Prefix of string format. */ XcmsColorFormat id; /* Format ID number. */ XcmsParseStringProc parseString; /* String format parsing function */ XcmsFuncListPtr to_CIEXYZ; /* Pointer to an array of function */ /* pointers such that when the */ /* functions are executed in sequence */ /* will convert a XcmsColor structure */ /* from this color space to CIEXYZ */ /* space. */ XcmsFuncListPtr from_CIEXYZ;/* Pointer to an array of function */ /* pointers such that when the */ /* functions are executed in sequence */ /* will convert a XcmsColor structure */ /* from CIEXYZ space to this color */ /* space. */ int inverse_flag; /* If 1, indicates that for 0 <= i < n */ /* where n is the number of function */ /* pointers in the lists to_CIEXYZ */ /* and from_CIEXYZ; for each function */ /* to_CIEXYZ[i] its inverse function */ /* is from_CIEXYZ[n - i]. */ } XcmsColorSpace; /* * Screen Color Characterization Function Set -- per device class * color space conversion functions. */ typedef struct _XcmsFunctionSet { XcmsColorSpace **DDColorSpaces; /* Pointer to an array of pointers to */ /* Device-DEPENDENT color spaces */ /* understood by this SCCFuncSet. */ XcmsScreenInitProc screenInitProc; /* Screen initialization function that */ /* reads Screen Color Characterization*/ /* Data off properties on the screen's*/ /* root window. */ XcmsScreenFreeProc screenFreeProc; /* Function that frees the SCCData */ /* structures. */ } XcmsFunctionSet; _XFUNCPROTOBEGIN extern Status XcmsAddColorSpace ( XcmsColorSpace* /* pColorSpace */ ); extern Status XcmsAddFunctionSet ( XcmsFunctionSet* /* functionSet */ ); extern Status XcmsAllocColor ( Display* /* dpy */, Colormap /* colormap */, XcmsColor* /* color_in_out */, XcmsColorFormat /* result_format */ ); extern Status XcmsAllocNamedColor ( Display* /* dpy */, Colormap /* colormap */, _Xconst char* /* color_string */, XcmsColor* /* color_scrn_return */, XcmsColor* /* color_exact_return */, XcmsColorFormat /* result_format */ ); extern XcmsCCC XcmsCCCOfColormap ( Display* /* dpy */, Colormap /* colormap */ ); extern Status XcmsCIELabClipab( XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); extern Status XcmsCIELabClipL( XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); extern Status XcmsCIELabClipLab( XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); extern Status XcmsCIELabQueryMaxC ( XcmsCCC /* ccc */, XcmsFloat /* hue_angle */, XcmsFloat /* L_star */, XcmsColor* /* color_return */ ); extern Status XcmsCIELabQueryMaxL ( XcmsCCC /* ccc */, XcmsFloat /* hue_angle */, XcmsFloat /* chroma */, XcmsColor* /* color_return */ ); extern Status XcmsCIELabQueryMaxLC ( XcmsCCC /* ccc */, XcmsFloat /* hue_angle */, XcmsColor* /* color_return */ ); extern Status XcmsCIELabQueryMinL ( XcmsCCC /* ccc */, XcmsFloat /* hue_angle */, XcmsFloat /* chroma */, XcmsColor* /* color_return */ ); extern Status XcmsCIELabToCIEXYZ ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern Status XcmsCIELabWhiteShiftColors( XcmsCCC /* ccc */, XcmsColor* /* initial_white_point*/, XcmsColor* /* target_white_point*/, XcmsColorFormat /* target_format */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, Bool* /* compression_flags_return */ ); extern Status XcmsCIELuvClipL( XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); extern Status XcmsCIELuvClipLuv( XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); extern Status XcmsCIELuvClipuv( XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); extern Status XcmsCIELuvQueryMaxC ( XcmsCCC /* ccc */, XcmsFloat /* hue_angle */, XcmsFloat /* L_star */, XcmsColor* /* color_return */ ); extern Status XcmsCIELuvQueryMaxL ( XcmsCCC /* ccc */, XcmsFloat /* hue_angle */, XcmsFloat /* chroma */, XcmsColor* /* color_return */ ); extern Status XcmsCIELuvQueryMaxLC ( XcmsCCC /* ccc */, XcmsFloat /* hue_angle */, XcmsColor* /* color_return */ ); extern Status XcmsCIELuvQueryMinL ( XcmsCCC /* ccc */, XcmsFloat /* hue_angle */, XcmsFloat /* chroma */, XcmsColor* /* color_return */ ); extern Status XcmsCIELuvToCIEuvY ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern Status XcmsCIELuvWhiteShiftColors( XcmsCCC /* ccc */, XcmsColor* /* initial_white_point*/, XcmsColor* /* target_white_point*/, XcmsColorFormat /* target_format */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, Bool* /* compression_flags_return */ ); extern Status XcmsCIEXYZToCIELab ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern Status XcmsCIEXYZToCIEuvY ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern Status XcmsCIEXYZToCIExyY ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern Status XcmsCIEXYZToRGBi ( XcmsCCC /* ccc */, XcmsColor* /* colors */, unsigned int /* ncolors */, Bool* /* compression_flags_return */ ); extern Status XcmsCIEuvYToCIELuv ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern Status XcmsCIEuvYToCIEXYZ ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern Status XcmsCIEuvYToTekHVC ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern Status XcmsCIExyYToCIEXYZ ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern XcmsColor *XcmsClientWhitePointOfCCC ( XcmsCCC /* ccc */ ); extern Status XcmsConvertColors ( XcmsCCC /* ccc */, XcmsColor* /* colorArry_in_out */, unsigned int /* nColors */, XcmsColorFormat /* targetFormat */, Bool* /* compArry_return */ ); extern XcmsCCC XcmsCreateCCC ( Display* /* dpy */, int /* screenNumber */, Visual* /* visual */, XcmsColor* /* clientWhitePt */, XcmsCompressionProc /* gamutCompProc */, XPointer /* gamutCompClientData */, XcmsWhiteAdjustProc /* whitePtAdjProc */, XPointer /* whitePtAdjClientData */ ); extern XcmsCCC XcmsDefaultCCC ( Display* /* dpy */, int /* screenNumber */ ); extern Display *XcmsDisplayOfCCC ( XcmsCCC /* ccc */ ); extern XcmsColorFormat XcmsFormatOfPrefix ( char* /* prefix */ ); extern void XcmsFreeCCC ( XcmsCCC /* ccc */ ); extern Status XcmsLookupColor ( Display* /* dpy */, Colormap /* colormap */, _Xconst char* /* color_string */, XcmsColor* /* pColor_exact_in_out */, XcmsColor* /* pColor_scrn_in_out */, XcmsColorFormat /* result_format */ ); extern char *XcmsPrefixOfFormat ( XcmsColorFormat /* id */ ); extern Status XcmsQueryBlack ( XcmsCCC /* ccc */, XcmsColorFormat /* target_format */, XcmsColor* /* color_return */ ); extern Status XcmsQueryBlue ( XcmsCCC /* ccc */, XcmsColorFormat /* target_format */, XcmsColor* /* color_return */ ); extern Status XcmsQueryColor ( Display* /* dpy */, Colormap /* colormap */, XcmsColor* /* pColor_in_out */, XcmsColorFormat /* result_format */ ); extern Status XcmsQueryColors ( Display* /* dpy */, Colormap /* colormap */, XcmsColor* /* colorArry_in_out */, unsigned int /* nColors */, XcmsColorFormat /* result_format */ ); extern Status XcmsQueryGreen ( XcmsCCC /* ccc */, XcmsColorFormat /* target_format */, XcmsColor* /* color_return */ ); extern Status XcmsQueryRed ( XcmsCCC /* ccc */, XcmsColorFormat /* target_format */, XcmsColor* /* color_return */ ); extern Status XcmsQueryWhite ( XcmsCCC /* ccc */, XcmsColorFormat /* target_format */, XcmsColor* /* color_return */ ); extern Status XcmsRGBiToCIEXYZ ( XcmsCCC /* ccc */, XcmsColor* /* colors */, unsigned int /* ncolors */, Bool* /* compression_flags_return */ ); extern Status XcmsRGBiToRGB ( XcmsCCC /* ccc */, XcmsColor* /* colors */, unsigned int /* ncolors */, Bool* /* compression_flags_return */ ); extern Status XcmsRGBToRGBi ( XcmsCCC /* ccc */, XcmsColor* /* colors */, unsigned int /* ncolors */, Bool* /* compression_flags_return */ ); extern int XcmsScreenNumberOfCCC ( XcmsCCC /* ccc */ ); extern XcmsColor *XcmsScreenWhitePointOfCCC ( XcmsCCC /* ccc */ ); extern XcmsCCC XcmsSetCCCOfColormap( Display* /* dpy */, Colormap /* colormap */, XcmsCCC /* ccc */ ); extern XcmsCompressionProc XcmsSetCompressionProc ( XcmsCCC /* ccc */, XcmsCompressionProc /* compression_proc */, XPointer /* client_data */ ); extern XcmsWhiteAdjustProc XcmsSetWhiteAdjustProc ( XcmsCCC /* ccc */, XcmsWhiteAdjustProc /* white_adjust_proc */, XPointer /* client_data */ ); extern Status XcmsSetWhitePoint ( XcmsCCC /* ccc */, XcmsColor* /* color */ ); extern Status XcmsStoreColor ( Display* /* dpy */, Colormap /* colormap */, XcmsColor* /* pColor_in */ ); extern Status XcmsStoreColors ( Display* /* dpy */, Colormap /* colormap */, XcmsColor* /* colorArry_in */, unsigned int /* nColors */, Bool* /* compArry_return */ ); extern Status XcmsTekHVCClipC( XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); extern Status XcmsTekHVCClipV( XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); extern Status XcmsTekHVCClipVC( XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); extern Status XcmsTekHVCQueryMaxC ( XcmsCCC /* ccc */, XcmsFloat /* hue */, XcmsFloat /* value */, XcmsColor* /* color_return */ ); extern Status XcmsTekHVCQueryMaxV ( XcmsCCC /* ccc */, XcmsFloat /* hue */, XcmsFloat /* chroma */, XcmsColor* /* color_return */ ); extern Status XcmsTekHVCQueryMaxVC ( XcmsCCC /* ccc */, XcmsFloat /* hue */, XcmsColor* /* color_return */ ); extern Status XcmsTekHVCQueryMaxVSamples ( XcmsCCC /* ccc */, XcmsFloat /* hue */, XcmsColor* /* colors_return */, unsigned int /* nsamples */ ); extern Status XcmsTekHVCQueryMinV ( XcmsCCC /* ccc */, XcmsFloat /* hue */, XcmsFloat /* chroma */, XcmsColor* /* color_return */ ); extern Status XcmsTekHVCToCIEuvY ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern Status XcmsTekHVCWhiteShiftColors( XcmsCCC /* ccc */, XcmsColor* /* initial_white_point*/, XcmsColor* /* target_white_point*/, XcmsColorFormat /* target_format */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, Bool* /* compression_flags_return */ ); extern Visual *XcmsVisualOfCCC ( XcmsCCC /* ccc */ ); #ifdef __clang__ #pragma clang diagnostic pop #endif _XFUNCPROTOEND #endif /* _X11_XCMS_H_ */ X11/Xprotostr.h000064400000005365147631660250007335 0ustar00#ifndef XPROTOSTRUCTS_H #define XPROTOSTRUCTS_H /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include /* Used by PolySegment */ typedef struct _xSegment { INT16 x1 B16, y1 B16, x2 B16, y2 B16; } xSegment; /* POINT */ typedef struct _xPoint { INT16 x B16, y B16; } xPoint; typedef struct _xRectangle { INT16 x B16, y B16; CARD16 width B16, height B16; } xRectangle; /* ARC */ typedef struct _xArc { INT16 x B16, y B16; CARD16 width B16, height B16; INT16 angle1 B16, angle2 B16; } xArc; #endif /* XPROTOSTRUCTS_H */ X11/Xlib-xcb.h000064400000000772147631660250006756 0ustar00/* Copyright (C) 2003-2006 Jamey Sharp, Josh Triplett * This file is licensed under the MIT license. See the file COPYING. */ #ifndef _X11_XLIB_XCB_H_ #define _X11_XLIB_XCB_H_ #include #include #include _XFUNCPROTOBEGIN xcb_connection_t *XGetXCBConnection(Display *dpy); enum XEventQueueOwner { XlibOwnsEventQueue = 0, XCBOwnsEventQueue }; void XSetEventQueueOwner(Display *dpy, enum XEventQueueOwner owner); _XFUNCPROTOEND #endif /* _X11_XLIB_XCB_H_ */ X11/HPkeysym.h000064400000013636147631660250007062 0ustar00/* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Hewlett Packard or Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable for errors contained herein or direct, indirect, special, incidental or consequential damages in connection with the furnishing, performance, or use of this material. */ #ifndef _HPKEYSYM_H #define _HPKEYSYM_H #define hpXK_ClearLine 0x1000FF6F #define hpXK_InsertLine 0x1000FF70 #define hpXK_DeleteLine 0x1000FF71 #define hpXK_InsertChar 0x1000FF72 #define hpXK_DeleteChar 0x1000FF73 #define hpXK_BackTab 0x1000FF74 #define hpXK_KP_BackTab 0x1000FF75 #define hpXK_Modelock1 0x1000FF48 #define hpXK_Modelock2 0x1000FF49 #define hpXK_Reset 0x1000FF6C #define hpXK_System 0x1000FF6D #define hpXK_User 0x1000FF6E #define hpXK_mute_acute 0x100000A8 #define hpXK_mute_grave 0x100000A9 #define hpXK_mute_asciicircum 0x100000AA #define hpXK_mute_diaeresis 0x100000AB #define hpXK_mute_asciitilde 0x100000AC #define hpXK_lira 0x100000AF #define hpXK_guilder 0x100000BE #define hpXK_Ydiaeresis 0x100000EE #define hpXK_IO 0x100000EE #define hpXK_longminus 0x100000F6 #define hpXK_block 0x100000FC #ifndef _OSF_Keysyms #define _OSF_Keysyms #define osfXK_Copy 0x1004FF02 #define osfXK_Cut 0x1004FF03 #define osfXK_Paste 0x1004FF04 #define osfXK_BackTab 0x1004FF07 #define osfXK_BackSpace 0x1004FF08 #define osfXK_Clear 0x1004FF0B #define osfXK_Escape 0x1004FF1B #define osfXK_AddMode 0x1004FF31 #define osfXK_PrimaryPaste 0x1004FF32 #define osfXK_QuickPaste 0x1004FF33 #define osfXK_PageLeft 0x1004FF40 #define osfXK_PageUp 0x1004FF41 #define osfXK_PageDown 0x1004FF42 #define osfXK_PageRight 0x1004FF43 #define osfXK_Activate 0x1004FF44 #define osfXK_MenuBar 0x1004FF45 #define osfXK_Left 0x1004FF51 #define osfXK_Up 0x1004FF52 #define osfXK_Right 0x1004FF53 #define osfXK_Down 0x1004FF54 #define osfXK_EndLine 0x1004FF57 #define osfXK_BeginLine 0x1004FF58 #define osfXK_EndData 0x1004FF59 #define osfXK_BeginData 0x1004FF5A #define osfXK_PrevMenu 0x1004FF5B #define osfXK_NextMenu 0x1004FF5C #define osfXK_PrevField 0x1004FF5D #define osfXK_NextField 0x1004FF5E #define osfXK_Select 0x1004FF60 #define osfXK_Insert 0x1004FF63 #define osfXK_Undo 0x1004FF65 #define osfXK_Menu 0x1004FF67 #define osfXK_Cancel 0x1004FF69 #define osfXK_Help 0x1004FF6A #define osfXK_SelectAll 0x1004FF71 #define osfXK_DeselectAll 0x1004FF72 #define osfXK_Reselect 0x1004FF73 #define osfXK_Extend 0x1004FF74 #define osfXK_Restore 0x1004FF78 #define osfXK_Delete 0x1004FFFF #endif /* _OSF_Keysyms */ /************************************************************** * The use of the following macros is deprecated. * They are listed below only for backwards compatibility. */ #define XK_Reset 0x1000FF6C #define XK_System 0x1000FF6D #define XK_User 0x1000FF6E #define XK_ClearLine 0x1000FF6F #define XK_InsertLine 0x1000FF70 #define XK_DeleteLine 0x1000FF71 #define XK_InsertChar 0x1000FF72 #define XK_DeleteChar 0x1000FF73 #define XK_BackTab 0x1000FF74 #define XK_KP_BackTab 0x1000FF75 #define XK_Ext16bit_L 0x1000FF76 #define XK_Ext16bit_R 0x1000FF77 #define XK_mute_acute 0x100000a8 #define XK_mute_grave 0x100000a9 #define XK_mute_asciicircum 0x100000aa #define XK_mute_diaeresis 0x100000ab #define XK_mute_asciitilde 0x100000ac #define XK_lira 0x100000af #define XK_guilder 0x100000be #ifndef XK_Ydiaeresis #define XK_Ydiaeresis 0x100000ee #endif #define XK_IO 0x100000ee #define XK_longminus 0x100000f6 #define XK_block 0x100000fc #endif /* _HPKEYSYM_H */ X11/Sunkeysym.h000064400000007666147631660250007326 0ustar00/* * Copyright (c) 1991, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /************************************************************ Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ***********************************************************/ /* * Floating Accent */ #define SunXK_FA_Grave 0x1005FF00 #define SunXK_FA_Circum 0x1005FF01 #define SunXK_FA_Tilde 0x1005FF02 #define SunXK_FA_Acute 0x1005FF03 #define SunXK_FA_Diaeresis 0x1005FF04 #define SunXK_FA_Cedilla 0x1005FF05 /* * Miscellaneous Functions */ #define SunXK_F36 0x1005FF10 /* Labeled F11 */ #define SunXK_F37 0x1005FF11 /* Labeled F12 */ #define SunXK_Sys_Req 0x1005FF60 #define SunXK_Print_Screen 0x0000FF61 /* Same as XK_Print */ /* * International & Multi-Key Character Composition */ #define SunXK_Compose 0x0000FF20 /* Same as XK_Multi_key */ #define SunXK_AltGraph 0x0000FF7E /* Same as XK_Mode_switch */ /* * Cursor Control */ #define SunXK_PageUp 0x0000FF55 /* Same as XK_Prior */ #define SunXK_PageDown 0x0000FF56 /* Same as XK_Next */ /* * Open Look Functions */ #define SunXK_Undo 0x0000FF65 /* Same as XK_Undo */ #define SunXK_Again 0x0000FF66 /* Same as XK_Redo */ #define SunXK_Find 0x0000FF68 /* Same as XK_Find */ #define SunXK_Stop 0x0000FF69 /* Same as XK_Cancel */ #define SunXK_Props 0x1005FF70 #define SunXK_Front 0x1005FF71 #define SunXK_Copy 0x1005FF72 #define SunXK_Open 0x1005FF73 #define SunXK_Paste 0x1005FF74 #define SunXK_Cut 0x1005FF75 #define SunXK_PowerSwitch 0x1005FF76 #define SunXK_AudioLowerVolume 0x1005FF77 #define SunXK_AudioMute 0x1005FF78 #define SunXK_AudioRaiseVolume 0x1005FF79 #define SunXK_VideoDegauss 0x1005FF7A #define SunXK_VideoLowerBrightness 0x1005FF7B #define SunXK_VideoRaiseBrightness 0x1005FF7C #define SunXK_PowerSwitchShift 0x1005FF7D X11/keysymdef.h000064400000526231147631660250007311 0ustar00/*********************************************************** Copyright 1987, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* * The "X11 Window System Protocol" standard defines in Appendix A the * keysym codes. These 29-bit integer values identify characters or * functions associated with each key (e.g., via the visible * engraving) of a keyboard layout. This file assigns mnemonic macro * names for these keysyms. * * This file is also compiled (by src/util/makekeys.c in libX11) into * hash tables that can be accessed with X11 library functions such as * XStringToKeysym() and XKeysymToString(). * * Where a keysym corresponds one-to-one to an ISO 10646 / Unicode * character, this is noted in a comment that provides both the U+xxxx * Unicode position, as well as the official Unicode name of the * character. * * Where the correspondence is either not one-to-one or semantically * unclear, the Unicode position and name are enclosed in * parentheses. Such legacy keysyms should be considered deprecated * and are not recommended for use in future keyboard mappings. * * For any future extension of the keysyms with characters already * found in ISO 10646 / Unicode, the following algorithm shall be * used. The new keysym code position will simply be the character's * Unicode number plus 0x01000000. The keysym values in the range * 0x01000100 to 0x0110ffff are reserved to represent Unicode * characters in the range U+0100 to U+10FFFF. * * While most newer Unicode-based X11 clients do already accept * Unicode-mapped keysyms in the range 0x01000100 to 0x0110ffff, it * will remain necessary for clients -- in the interest of * compatibility with existing servers -- to also understand the * existing legacy keysym values in the range 0x0100 to 0x20ff. * * Where several mnemonic names are defined for the same keysym in this * file, all but the first one listed should be considered deprecated. * * Mnemonic names for keysyms are defined in this file with lines * that match one of these Perl regular expressions: * * /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\* U+([0-9A-F]{4,6}) (.*) \*\/\s*$/ * /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\*\(U+([0-9A-F]{4,6}) (.*)\)\*\/\s*$/ * /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*(\/\*\s*(.*)\s*\*\/)?\s*$/ * * Before adding new keysyms, please do consider the following: In * addition to the keysym names defined in this file, the * XStringToKeysym() and XKeysymToString() functions will also handle * any keysym string of the form "U0020" to "U007E" and "U00A0" to * "U10FFFF" for all possible Unicode characters. In other words, * every possible Unicode character has already a keysym string * defined algorithmically, even if it is not listed here. Therefore, * defining an additional keysym macro is only necessary where a * non-hexadecimal mnemonic name is needed, or where the new keysym * does not represent any existing Unicode character. * * When adding new keysyms to this file, do not forget to also update the * following as needed: * * - the mappings in src/KeyBind.c in the repo * git://anongit.freedesktop.org/xorg/lib/libX11.git * * - the protocol specification in specs/keysyms.xml * in the repo git://anongit.freedesktop.org/xorg/proto/x11proto.git * */ #define XK_VoidSymbol 0xffffff /* Void symbol */ #ifdef XK_MISCELLANY /* * TTY function keys, cleverly chosen to map to ASCII, for convenience of * programming, but could have been arbitrary (at the cost of lookup * tables in client code). */ #define XK_BackSpace 0xff08 /* Back space, back char */ #define XK_Tab 0xff09 #define XK_Linefeed 0xff0a /* Linefeed, LF */ #define XK_Clear 0xff0b #define XK_Return 0xff0d /* Return, enter */ #define XK_Pause 0xff13 /* Pause, hold */ #define XK_Scroll_Lock 0xff14 #define XK_Sys_Req 0xff15 #define XK_Escape 0xff1b #define XK_Delete 0xffff /* Delete, rubout */ /* International & multi-key character composition */ #define XK_Multi_key 0xff20 /* Multi-key character compose */ #define XK_Codeinput 0xff37 #define XK_SingleCandidate 0xff3c #define XK_MultipleCandidate 0xff3d #define XK_PreviousCandidate 0xff3e /* Japanese keyboard support */ #define XK_Kanji 0xff21 /* Kanji, Kanji convert */ #define XK_Muhenkan 0xff22 /* Cancel Conversion */ #define XK_Henkan_Mode 0xff23 /* Start/Stop Conversion */ #define XK_Henkan 0xff23 /* Alias for Henkan_Mode */ #define XK_Romaji 0xff24 /* to Romaji */ #define XK_Hiragana 0xff25 /* to Hiragana */ #define XK_Katakana 0xff26 /* to Katakana */ #define XK_Hiragana_Katakana 0xff27 /* Hiragana/Katakana toggle */ #define XK_Zenkaku 0xff28 /* to Zenkaku */ #define XK_Hankaku 0xff29 /* to Hankaku */ #define XK_Zenkaku_Hankaku 0xff2a /* Zenkaku/Hankaku toggle */ #define XK_Touroku 0xff2b /* Add to Dictionary */ #define XK_Massyo 0xff2c /* Delete from Dictionary */ #define XK_Kana_Lock 0xff2d /* Kana Lock */ #define XK_Kana_Shift 0xff2e /* Kana Shift */ #define XK_Eisu_Shift 0xff2f /* Alphanumeric Shift */ #define XK_Eisu_toggle 0xff30 /* Alphanumeric toggle */ #define XK_Kanji_Bangou 0xff37 /* Codeinput */ #define XK_Zen_Koho 0xff3d /* Multiple/All Candidate(s) */ #define XK_Mae_Koho 0xff3e /* Previous Candidate */ /* 0xff31 thru 0xff3f are under XK_KOREAN */ /* Cursor control & motion */ #define XK_Home 0xff50 #define XK_Left 0xff51 /* Move left, left arrow */ #define XK_Up 0xff52 /* Move up, up arrow */ #define XK_Right 0xff53 /* Move right, right arrow */ #define XK_Down 0xff54 /* Move down, down arrow */ #define XK_Prior 0xff55 /* Prior, previous */ #define XK_Page_Up 0xff55 #define XK_Next 0xff56 /* Next */ #define XK_Page_Down 0xff56 #define XK_End 0xff57 /* EOL */ #define XK_Begin 0xff58 /* BOL */ /* Misc functions */ #define XK_Select 0xff60 /* Select, mark */ #define XK_Print 0xff61 #define XK_Execute 0xff62 /* Execute, run, do */ #define XK_Insert 0xff63 /* Insert, insert here */ #define XK_Undo 0xff65 #define XK_Redo 0xff66 /* Redo, again */ #define XK_Menu 0xff67 #define XK_Find 0xff68 /* Find, search */ #define XK_Cancel 0xff69 /* Cancel, stop, abort, exit */ #define XK_Help 0xff6a /* Help */ #define XK_Break 0xff6b #define XK_Mode_switch 0xff7e /* Character set switch */ #define XK_script_switch 0xff7e /* Alias for mode_switch */ #define XK_Num_Lock 0xff7f /* Keypad functions, keypad numbers cleverly chosen to map to ASCII */ #define XK_KP_Space 0xff80 /* Space */ #define XK_KP_Tab 0xff89 #define XK_KP_Enter 0xff8d /* Enter */ #define XK_KP_F1 0xff91 /* PF1, KP_A, ... */ #define XK_KP_F2 0xff92 #define XK_KP_F3 0xff93 #define XK_KP_F4 0xff94 #define XK_KP_Home 0xff95 #define XK_KP_Left 0xff96 #define XK_KP_Up 0xff97 #define XK_KP_Right 0xff98 #define XK_KP_Down 0xff99 #define XK_KP_Prior 0xff9a #define XK_KP_Page_Up 0xff9a #define XK_KP_Next 0xff9b #define XK_KP_Page_Down 0xff9b #define XK_KP_End 0xff9c #define XK_KP_Begin 0xff9d #define XK_KP_Insert 0xff9e #define XK_KP_Delete 0xff9f #define XK_KP_Equal 0xffbd /* Equals */ #define XK_KP_Multiply 0xffaa #define XK_KP_Add 0xffab #define XK_KP_Separator 0xffac /* Separator, often comma */ #define XK_KP_Subtract 0xffad #define XK_KP_Decimal 0xffae #define XK_KP_Divide 0xffaf #define XK_KP_0 0xffb0 #define XK_KP_1 0xffb1 #define XK_KP_2 0xffb2 #define XK_KP_3 0xffb3 #define XK_KP_4 0xffb4 #define XK_KP_5 0xffb5 #define XK_KP_6 0xffb6 #define XK_KP_7 0xffb7 #define XK_KP_8 0xffb8 #define XK_KP_9 0xffb9 /* * Auxiliary functions; note the duplicate definitions for left and right * function keys; Sun keyboards and a few other manufacturers have such * function key groups on the left and/or right sides of the keyboard. * We've not found a keyboard with more than 35 function keys total. */ #define XK_F1 0xffbe #define XK_F2 0xffbf #define XK_F3 0xffc0 #define XK_F4 0xffc1 #define XK_F5 0xffc2 #define XK_F6 0xffc3 #define XK_F7 0xffc4 #define XK_F8 0xffc5 #define XK_F9 0xffc6 #define XK_F10 0xffc7 #define XK_F11 0xffc8 #define XK_L1 0xffc8 #define XK_F12 0xffc9 #define XK_L2 0xffc9 #define XK_F13 0xffca #define XK_L3 0xffca #define XK_F14 0xffcb #define XK_L4 0xffcb #define XK_F15 0xffcc #define XK_L5 0xffcc #define XK_F16 0xffcd #define XK_L6 0xffcd #define XK_F17 0xffce #define XK_L7 0xffce #define XK_F18 0xffcf #define XK_L8 0xffcf #define XK_F19 0xffd0 #define XK_L9 0xffd0 #define XK_F20 0xffd1 #define XK_L10 0xffd1 #define XK_F21 0xffd2 #define XK_R1 0xffd2 #define XK_F22 0xffd3 #define XK_R2 0xffd3 #define XK_F23 0xffd4 #define XK_R3 0xffd4 #define XK_F24 0xffd5 #define XK_R4 0xffd5 #define XK_F25 0xffd6 #define XK_R5 0xffd6 #define XK_F26 0xffd7 #define XK_R6 0xffd7 #define XK_F27 0xffd8 #define XK_R7 0xffd8 #define XK_F28 0xffd9 #define XK_R8 0xffd9 #define XK_F29 0xffda #define XK_R9 0xffda #define XK_F30 0xffdb #define XK_R10 0xffdb #define XK_F31 0xffdc #define XK_R11 0xffdc #define XK_F32 0xffdd #define XK_R12 0xffdd #define XK_F33 0xffde #define XK_R13 0xffde #define XK_F34 0xffdf #define XK_R14 0xffdf #define XK_F35 0xffe0 #define XK_R15 0xffe0 /* Modifiers */ #define XK_Shift_L 0xffe1 /* Left shift */ #define XK_Shift_R 0xffe2 /* Right shift */ #define XK_Control_L 0xffe3 /* Left control */ #define XK_Control_R 0xffe4 /* Right control */ #define XK_Caps_Lock 0xffe5 /* Caps lock */ #define XK_Shift_Lock 0xffe6 /* Shift lock */ #define XK_Meta_L 0xffe7 /* Left meta */ #define XK_Meta_R 0xffe8 /* Right meta */ #define XK_Alt_L 0xffe9 /* Left alt */ #define XK_Alt_R 0xffea /* Right alt */ #define XK_Super_L 0xffeb /* Left super */ #define XK_Super_R 0xffec /* Right super */ #define XK_Hyper_L 0xffed /* Left hyper */ #define XK_Hyper_R 0xffee /* Right hyper */ #endif /* XK_MISCELLANY */ /* * Keyboard (XKB) Extension function and modifier keys * (from Appendix C of "The X Keyboard Extension: Protocol Specification") * Byte 3 = 0xfe */ #ifdef XK_XKB_KEYS #define XK_ISO_Lock 0xfe01 #define XK_ISO_Level2_Latch 0xfe02 #define XK_ISO_Level3_Shift 0xfe03 #define XK_ISO_Level3_Latch 0xfe04 #define XK_ISO_Level3_Lock 0xfe05 #define XK_ISO_Level5_Shift 0xfe11 #define XK_ISO_Level5_Latch 0xfe12 #define XK_ISO_Level5_Lock 0xfe13 #define XK_ISO_Group_Shift 0xff7e /* Alias for mode_switch */ #define XK_ISO_Group_Latch 0xfe06 #define XK_ISO_Group_Lock 0xfe07 #define XK_ISO_Next_Group 0xfe08 #define XK_ISO_Next_Group_Lock 0xfe09 #define XK_ISO_Prev_Group 0xfe0a #define XK_ISO_Prev_Group_Lock 0xfe0b #define XK_ISO_First_Group 0xfe0c #define XK_ISO_First_Group_Lock 0xfe0d #define XK_ISO_Last_Group 0xfe0e #define XK_ISO_Last_Group_Lock 0xfe0f #define XK_ISO_Left_Tab 0xfe20 #define XK_ISO_Move_Line_Up 0xfe21 #define XK_ISO_Move_Line_Down 0xfe22 #define XK_ISO_Partial_Line_Up 0xfe23 #define XK_ISO_Partial_Line_Down 0xfe24 #define XK_ISO_Partial_Space_Left 0xfe25 #define XK_ISO_Partial_Space_Right 0xfe26 #define XK_ISO_Set_Margin_Left 0xfe27 #define XK_ISO_Set_Margin_Right 0xfe28 #define XK_ISO_Release_Margin_Left 0xfe29 #define XK_ISO_Release_Margin_Right 0xfe2a #define XK_ISO_Release_Both_Margins 0xfe2b #define XK_ISO_Fast_Cursor_Left 0xfe2c #define XK_ISO_Fast_Cursor_Right 0xfe2d #define XK_ISO_Fast_Cursor_Up 0xfe2e #define XK_ISO_Fast_Cursor_Down 0xfe2f #define XK_ISO_Continuous_Underline 0xfe30 #define XK_ISO_Discontinuous_Underline 0xfe31 #define XK_ISO_Emphasize 0xfe32 #define XK_ISO_Center_Object 0xfe33 #define XK_ISO_Enter 0xfe34 #define XK_dead_grave 0xfe50 #define XK_dead_acute 0xfe51 #define XK_dead_circumflex 0xfe52 #define XK_dead_tilde 0xfe53 #define XK_dead_perispomeni 0xfe53 /* alias for dead_tilde */ #define XK_dead_macron 0xfe54 #define XK_dead_breve 0xfe55 #define XK_dead_abovedot 0xfe56 #define XK_dead_diaeresis 0xfe57 #define XK_dead_abovering 0xfe58 #define XK_dead_doubleacute 0xfe59 #define XK_dead_caron 0xfe5a #define XK_dead_cedilla 0xfe5b #define XK_dead_ogonek 0xfe5c #define XK_dead_iota 0xfe5d #define XK_dead_voiced_sound 0xfe5e #define XK_dead_semivoiced_sound 0xfe5f #define XK_dead_belowdot 0xfe60 #define XK_dead_hook 0xfe61 #define XK_dead_horn 0xfe62 #define XK_dead_stroke 0xfe63 #define XK_dead_abovecomma 0xfe64 #define XK_dead_psili 0xfe64 /* alias for dead_abovecomma */ #define XK_dead_abovereversedcomma 0xfe65 #define XK_dead_dasia 0xfe65 /* alias for dead_abovereversedcomma */ #define XK_dead_doublegrave 0xfe66 #define XK_dead_belowring 0xfe67 #define XK_dead_belowmacron 0xfe68 #define XK_dead_belowcircumflex 0xfe69 #define XK_dead_belowtilde 0xfe6a #define XK_dead_belowbreve 0xfe6b #define XK_dead_belowdiaeresis 0xfe6c #define XK_dead_invertedbreve 0xfe6d #define XK_dead_belowcomma 0xfe6e #define XK_dead_currency 0xfe6f /* extra dead elements for German T3 layout */ #define XK_dead_lowline 0xfe90 #define XK_dead_aboveverticalline 0xfe91 #define XK_dead_belowverticalline 0xfe92 #define XK_dead_longsolidusoverlay 0xfe93 /* dead vowels for universal syllable entry */ #define XK_dead_a 0xfe80 #define XK_dead_A 0xfe81 #define XK_dead_e 0xfe82 #define XK_dead_E 0xfe83 #define XK_dead_i 0xfe84 #define XK_dead_I 0xfe85 #define XK_dead_o 0xfe86 #define XK_dead_O 0xfe87 #define XK_dead_u 0xfe88 #define XK_dead_U 0xfe89 #define XK_dead_small_schwa 0xfe8a #define XK_dead_capital_schwa 0xfe8b #define XK_dead_greek 0xfe8c #define XK_First_Virtual_Screen 0xfed0 #define XK_Prev_Virtual_Screen 0xfed1 #define XK_Next_Virtual_Screen 0xfed2 #define XK_Last_Virtual_Screen 0xfed4 #define XK_Terminate_Server 0xfed5 #define XK_AccessX_Enable 0xfe70 #define XK_AccessX_Feedback_Enable 0xfe71 #define XK_RepeatKeys_Enable 0xfe72 #define XK_SlowKeys_Enable 0xfe73 #define XK_BounceKeys_Enable 0xfe74 #define XK_StickyKeys_Enable 0xfe75 #define XK_MouseKeys_Enable 0xfe76 #define XK_MouseKeys_Accel_Enable 0xfe77 #define XK_Overlay1_Enable 0xfe78 #define XK_Overlay2_Enable 0xfe79 #define XK_AudibleBell_Enable 0xfe7a #define XK_Pointer_Left 0xfee0 #define XK_Pointer_Right 0xfee1 #define XK_Pointer_Up 0xfee2 #define XK_Pointer_Down 0xfee3 #define XK_Pointer_UpLeft 0xfee4 #define XK_Pointer_UpRight 0xfee5 #define XK_Pointer_DownLeft 0xfee6 #define XK_Pointer_DownRight 0xfee7 #define XK_Pointer_Button_Dflt 0xfee8 #define XK_Pointer_Button1 0xfee9 #define XK_Pointer_Button2 0xfeea #define XK_Pointer_Button3 0xfeeb #define XK_Pointer_Button4 0xfeec #define XK_Pointer_Button5 0xfeed #define XK_Pointer_DblClick_Dflt 0xfeee #define XK_Pointer_DblClick1 0xfeef #define XK_Pointer_DblClick2 0xfef0 #define XK_Pointer_DblClick3 0xfef1 #define XK_Pointer_DblClick4 0xfef2 #define XK_Pointer_DblClick5 0xfef3 #define XK_Pointer_Drag_Dflt 0xfef4 #define XK_Pointer_Drag1 0xfef5 #define XK_Pointer_Drag2 0xfef6 #define XK_Pointer_Drag3 0xfef7 #define XK_Pointer_Drag4 0xfef8 #define XK_Pointer_Drag5 0xfefd #define XK_Pointer_EnableKeys 0xfef9 #define XK_Pointer_Accelerate 0xfefa #define XK_Pointer_DfltBtnNext 0xfefb #define XK_Pointer_DfltBtnPrev 0xfefc /* Single-Stroke Multiple-Character N-Graph Keysyms For The X Input Method */ #define XK_ch 0xfea0 #define XK_Ch 0xfea1 #define XK_CH 0xfea2 #define XK_c_h 0xfea3 #define XK_C_h 0xfea4 #define XK_C_H 0xfea5 #endif /* XK_XKB_KEYS */ /* * 3270 Terminal Keys * Byte 3 = 0xfd */ #ifdef XK_3270 #define XK_3270_Duplicate 0xfd01 #define XK_3270_FieldMark 0xfd02 #define XK_3270_Right2 0xfd03 #define XK_3270_Left2 0xfd04 #define XK_3270_BackTab 0xfd05 #define XK_3270_EraseEOF 0xfd06 #define XK_3270_EraseInput 0xfd07 #define XK_3270_Reset 0xfd08 #define XK_3270_Quit 0xfd09 #define XK_3270_PA1 0xfd0a #define XK_3270_PA2 0xfd0b #define XK_3270_PA3 0xfd0c #define XK_3270_Test 0xfd0d #define XK_3270_Attn 0xfd0e #define XK_3270_CursorBlink 0xfd0f #define XK_3270_AltCursor 0xfd10 #define XK_3270_KeyClick 0xfd11 #define XK_3270_Jump 0xfd12 #define XK_3270_Ident 0xfd13 #define XK_3270_Rule 0xfd14 #define XK_3270_Copy 0xfd15 #define XK_3270_Play 0xfd16 #define XK_3270_Setup 0xfd17 #define XK_3270_Record 0xfd18 #define XK_3270_ChangeScreen 0xfd19 #define XK_3270_DeleteWord 0xfd1a #define XK_3270_ExSelect 0xfd1b #define XK_3270_CursorSelect 0xfd1c #define XK_3270_PrintScreen 0xfd1d #define XK_3270_Enter 0xfd1e #endif /* XK_3270 */ /* * Latin 1 * (ISO/IEC 8859-1 = Unicode U+0020..U+00FF) * Byte 3 = 0 */ #ifdef XK_LATIN1 #define XK_space 0x0020 /* U+0020 SPACE */ #define XK_exclam 0x0021 /* U+0021 EXCLAMATION MARK */ #define XK_quotedbl 0x0022 /* U+0022 QUOTATION MARK */ #define XK_numbersign 0x0023 /* U+0023 NUMBER SIGN */ #define XK_dollar 0x0024 /* U+0024 DOLLAR SIGN */ #define XK_percent 0x0025 /* U+0025 PERCENT SIGN */ #define XK_ampersand 0x0026 /* U+0026 AMPERSAND */ #define XK_apostrophe 0x0027 /* U+0027 APOSTROPHE */ #define XK_quoteright 0x0027 /* deprecated */ #define XK_parenleft 0x0028 /* U+0028 LEFT PARENTHESIS */ #define XK_parenright 0x0029 /* U+0029 RIGHT PARENTHESIS */ #define XK_asterisk 0x002a /* U+002A ASTERISK */ #define XK_plus 0x002b /* U+002B PLUS SIGN */ #define XK_comma 0x002c /* U+002C COMMA */ #define XK_minus 0x002d /* U+002D HYPHEN-MINUS */ #define XK_period 0x002e /* U+002E FULL STOP */ #define XK_slash 0x002f /* U+002F SOLIDUS */ #define XK_0 0x0030 /* U+0030 DIGIT ZERO */ #define XK_1 0x0031 /* U+0031 DIGIT ONE */ #define XK_2 0x0032 /* U+0032 DIGIT TWO */ #define XK_3 0x0033 /* U+0033 DIGIT THREE */ #define XK_4 0x0034 /* U+0034 DIGIT FOUR */ #define XK_5 0x0035 /* U+0035 DIGIT FIVE */ #define XK_6 0x0036 /* U+0036 DIGIT SIX */ #define XK_7 0x0037 /* U+0037 DIGIT SEVEN */ #define XK_8 0x0038 /* U+0038 DIGIT EIGHT */ #define XK_9 0x0039 /* U+0039 DIGIT NINE */ #define XK_colon 0x003a /* U+003A COLON */ #define XK_semicolon 0x003b /* U+003B SEMICOLON */ #define XK_less 0x003c /* U+003C LESS-THAN SIGN */ #define XK_equal 0x003d /* U+003D EQUALS SIGN */ #define XK_greater 0x003e /* U+003E GREATER-THAN SIGN */ #define XK_question 0x003f /* U+003F QUESTION MARK */ #define XK_at 0x0040 /* U+0040 COMMERCIAL AT */ #define XK_A 0x0041 /* U+0041 LATIN CAPITAL LETTER A */ #define XK_B 0x0042 /* U+0042 LATIN CAPITAL LETTER B */ #define XK_C 0x0043 /* U+0043 LATIN CAPITAL LETTER C */ #define XK_D 0x0044 /* U+0044 LATIN CAPITAL LETTER D */ #define XK_E 0x0045 /* U+0045 LATIN CAPITAL LETTER E */ #define XK_F 0x0046 /* U+0046 LATIN CAPITAL LETTER F */ #define XK_G 0x0047 /* U+0047 LATIN CAPITAL LETTER G */ #define XK_H 0x0048 /* U+0048 LATIN CAPITAL LETTER H */ #define XK_I 0x0049 /* U+0049 LATIN CAPITAL LETTER I */ #define XK_J 0x004a /* U+004A LATIN CAPITAL LETTER J */ #define XK_K 0x004b /* U+004B LATIN CAPITAL LETTER K */ #define XK_L 0x004c /* U+004C LATIN CAPITAL LETTER L */ #define XK_M 0x004d /* U+004D LATIN CAPITAL LETTER M */ #define XK_N 0x004e /* U+004E LATIN CAPITAL LETTER N */ #define XK_O 0x004f /* U+004F LATIN CAPITAL LETTER O */ #define XK_P 0x0050 /* U+0050 LATIN CAPITAL LETTER P */ #define XK_Q 0x0051 /* U+0051 LATIN CAPITAL LETTER Q */ #define XK_R 0x0052 /* U+0052 LATIN CAPITAL LETTER R */ #define XK_S 0x0053 /* U+0053 LATIN CAPITAL LETTER S */ #define XK_T 0x0054 /* U+0054 LATIN CAPITAL LETTER T */ #define XK_U 0x0055 /* U+0055 LATIN CAPITAL LETTER U */ #define XK_V 0x0056 /* U+0056 LATIN CAPITAL LETTER V */ #define XK_W 0x0057 /* U+0057 LATIN CAPITAL LETTER W */ #define XK_X 0x0058 /* U+0058 LATIN CAPITAL LETTER X */ #define XK_Y 0x0059 /* U+0059 LATIN CAPITAL LETTER Y */ #define XK_Z 0x005a /* U+005A LATIN CAPITAL LETTER Z */ #define XK_bracketleft 0x005b /* U+005B LEFT SQUARE BRACKET */ #define XK_backslash 0x005c /* U+005C REVERSE SOLIDUS */ #define XK_bracketright 0x005d /* U+005D RIGHT SQUARE BRACKET */ #define XK_asciicircum 0x005e /* U+005E CIRCUMFLEX ACCENT */ #define XK_underscore 0x005f /* U+005F LOW LINE */ #define XK_grave 0x0060 /* U+0060 GRAVE ACCENT */ #define XK_quoteleft 0x0060 /* deprecated */ #define XK_a 0x0061 /* U+0061 LATIN SMALL LETTER A */ #define XK_b 0x0062 /* U+0062 LATIN SMALL LETTER B */ #define XK_c 0x0063 /* U+0063 LATIN SMALL LETTER C */ #define XK_d 0x0064 /* U+0064 LATIN SMALL LETTER D */ #define XK_e 0x0065 /* U+0065 LATIN SMALL LETTER E */ #define XK_f 0x0066 /* U+0066 LATIN SMALL LETTER F */ #define XK_g 0x0067 /* U+0067 LATIN SMALL LETTER G */ #define XK_h 0x0068 /* U+0068 LATIN SMALL LETTER H */ #define XK_i 0x0069 /* U+0069 LATIN SMALL LETTER I */ #define XK_j 0x006a /* U+006A LATIN SMALL LETTER J */ #define XK_k 0x006b /* U+006B LATIN SMALL LETTER K */ #define XK_l 0x006c /* U+006C LATIN SMALL LETTER L */ #define XK_m 0x006d /* U+006D LATIN SMALL LETTER M */ #define XK_n 0x006e /* U+006E LATIN SMALL LETTER N */ #define XK_o 0x006f /* U+006F LATIN SMALL LETTER O */ #define XK_p 0x0070 /* U+0070 LATIN SMALL LETTER P */ #define XK_q 0x0071 /* U+0071 LATIN SMALL LETTER Q */ #define XK_r 0x0072 /* U+0072 LATIN SMALL LETTER R */ #define XK_s 0x0073 /* U+0073 LATIN SMALL LETTER S */ #define XK_t 0x0074 /* U+0074 LATIN SMALL LETTER T */ #define XK_u 0x0075 /* U+0075 LATIN SMALL LETTER U */ #define XK_v 0x0076 /* U+0076 LATIN SMALL LETTER V */ #define XK_w 0x0077 /* U+0077 LATIN SMALL LETTER W */ #define XK_x 0x0078 /* U+0078 LATIN SMALL LETTER X */ #define XK_y 0x0079 /* U+0079 LATIN SMALL LETTER Y */ #define XK_z 0x007a /* U+007A LATIN SMALL LETTER Z */ #define XK_braceleft 0x007b /* U+007B LEFT CURLY BRACKET */ #define XK_bar 0x007c /* U+007C VERTICAL LINE */ #define XK_braceright 0x007d /* U+007D RIGHT CURLY BRACKET */ #define XK_asciitilde 0x007e /* U+007E TILDE */ #define XK_nobreakspace 0x00a0 /* U+00A0 NO-BREAK SPACE */ #define XK_exclamdown 0x00a1 /* U+00A1 INVERTED EXCLAMATION MARK */ #define XK_cent 0x00a2 /* U+00A2 CENT SIGN */ #define XK_sterling 0x00a3 /* U+00A3 POUND SIGN */ #define XK_currency 0x00a4 /* U+00A4 CURRENCY SIGN */ #define XK_yen 0x00a5 /* U+00A5 YEN SIGN */ #define XK_brokenbar 0x00a6 /* U+00A6 BROKEN BAR */ #define XK_section 0x00a7 /* U+00A7 SECTION SIGN */ #define XK_diaeresis 0x00a8 /* U+00A8 DIAERESIS */ #define XK_copyright 0x00a9 /* U+00A9 COPYRIGHT SIGN */ #define XK_ordfeminine 0x00aa /* U+00AA FEMININE ORDINAL INDICATOR */ #define XK_guillemotleft 0x00ab /* U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */ #define XK_notsign 0x00ac /* U+00AC NOT SIGN */ #define XK_hyphen 0x00ad /* U+00AD SOFT HYPHEN */ #define XK_registered 0x00ae /* U+00AE REGISTERED SIGN */ #define XK_macron 0x00af /* U+00AF MACRON */ #define XK_degree 0x00b0 /* U+00B0 DEGREE SIGN */ #define XK_plusminus 0x00b1 /* U+00B1 PLUS-MINUS SIGN */ #define XK_twosuperior 0x00b2 /* U+00B2 SUPERSCRIPT TWO */ #define XK_threesuperior 0x00b3 /* U+00B3 SUPERSCRIPT THREE */ #define XK_acute 0x00b4 /* U+00B4 ACUTE ACCENT */ #define XK_mu 0x00b5 /* U+00B5 MICRO SIGN */ #define XK_paragraph 0x00b6 /* U+00B6 PILCROW SIGN */ #define XK_periodcentered 0x00b7 /* U+00B7 MIDDLE DOT */ #define XK_cedilla 0x00b8 /* U+00B8 CEDILLA */ #define XK_onesuperior 0x00b9 /* U+00B9 SUPERSCRIPT ONE */ #define XK_masculine 0x00ba /* U+00BA MASCULINE ORDINAL INDICATOR */ #define XK_guillemotright 0x00bb /* U+00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */ #define XK_onequarter 0x00bc /* U+00BC VULGAR FRACTION ONE QUARTER */ #define XK_onehalf 0x00bd /* U+00BD VULGAR FRACTION ONE HALF */ #define XK_threequarters 0x00be /* U+00BE VULGAR FRACTION THREE QUARTERS */ #define XK_questiondown 0x00bf /* U+00BF INVERTED QUESTION MARK */ #define XK_Agrave 0x00c0 /* U+00C0 LATIN CAPITAL LETTER A WITH GRAVE */ #define XK_Aacute 0x00c1 /* U+00C1 LATIN CAPITAL LETTER A WITH ACUTE */ #define XK_Acircumflex 0x00c2 /* U+00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX */ #define XK_Atilde 0x00c3 /* U+00C3 LATIN CAPITAL LETTER A WITH TILDE */ #define XK_Adiaeresis 0x00c4 /* U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS */ #define XK_Aring 0x00c5 /* U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE */ #define XK_AE 0x00c6 /* U+00C6 LATIN CAPITAL LETTER AE */ #define XK_Ccedilla 0x00c7 /* U+00C7 LATIN CAPITAL LETTER C WITH CEDILLA */ #define XK_Egrave 0x00c8 /* U+00C8 LATIN CAPITAL LETTER E WITH GRAVE */ #define XK_Eacute 0x00c9 /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */ #define XK_Ecircumflex 0x00ca /* U+00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX */ #define XK_Ediaeresis 0x00cb /* U+00CB LATIN CAPITAL LETTER E WITH DIAERESIS */ #define XK_Igrave 0x00cc /* U+00CC LATIN CAPITAL LETTER I WITH GRAVE */ #define XK_Iacute 0x00cd /* U+00CD LATIN CAPITAL LETTER I WITH ACUTE */ #define XK_Icircumflex 0x00ce /* U+00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX */ #define XK_Idiaeresis 0x00cf /* U+00CF LATIN CAPITAL LETTER I WITH DIAERESIS */ #define XK_ETH 0x00d0 /* U+00D0 LATIN CAPITAL LETTER ETH */ #define XK_Eth 0x00d0 /* deprecated */ #define XK_Ntilde 0x00d1 /* U+00D1 LATIN CAPITAL LETTER N WITH TILDE */ #define XK_Ograve 0x00d2 /* U+00D2 LATIN CAPITAL LETTER O WITH GRAVE */ #define XK_Oacute 0x00d3 /* U+00D3 LATIN CAPITAL LETTER O WITH ACUTE */ #define XK_Ocircumflex 0x00d4 /* U+00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX */ #define XK_Otilde 0x00d5 /* U+00D5 LATIN CAPITAL LETTER O WITH TILDE */ #define XK_Odiaeresis 0x00d6 /* U+00D6 LATIN CAPITAL LETTER O WITH DIAERESIS */ #define XK_multiply 0x00d7 /* U+00D7 MULTIPLICATION SIGN */ #define XK_Oslash 0x00d8 /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */ #define XK_Ooblique 0x00d8 /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */ #define XK_Ugrave 0x00d9 /* U+00D9 LATIN CAPITAL LETTER U WITH GRAVE */ #define XK_Uacute 0x00da /* U+00DA LATIN CAPITAL LETTER U WITH ACUTE */ #define XK_Ucircumflex 0x00db /* U+00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX */ #define XK_Udiaeresis 0x00dc /* U+00DC LATIN CAPITAL LETTER U WITH DIAERESIS */ #define XK_Yacute 0x00dd /* U+00DD LATIN CAPITAL LETTER Y WITH ACUTE */ #define XK_THORN 0x00de /* U+00DE LATIN CAPITAL LETTER THORN */ #define XK_Thorn 0x00de /* deprecated */ #define XK_ssharp 0x00df /* U+00DF LATIN SMALL LETTER SHARP S */ #define XK_agrave 0x00e0 /* U+00E0 LATIN SMALL LETTER A WITH GRAVE */ #define XK_aacute 0x00e1 /* U+00E1 LATIN SMALL LETTER A WITH ACUTE */ #define XK_acircumflex 0x00e2 /* U+00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX */ #define XK_atilde 0x00e3 /* U+00E3 LATIN SMALL LETTER A WITH TILDE */ #define XK_adiaeresis 0x00e4 /* U+00E4 LATIN SMALL LETTER A WITH DIAERESIS */ #define XK_aring 0x00e5 /* U+00E5 LATIN SMALL LETTER A WITH RING ABOVE */ #define XK_ae 0x00e6 /* U+00E6 LATIN SMALL LETTER AE */ #define XK_ccedilla 0x00e7 /* U+00E7 LATIN SMALL LETTER C WITH CEDILLA */ #define XK_egrave 0x00e8 /* U+00E8 LATIN SMALL LETTER E WITH GRAVE */ #define XK_eacute 0x00e9 /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */ #define XK_ecircumflex 0x00ea /* U+00EA LATIN SMALL LETTER E WITH CIRCUMFLEX */ #define XK_ediaeresis 0x00eb /* U+00EB LATIN SMALL LETTER E WITH DIAERESIS */ #define XK_igrave 0x00ec /* U+00EC LATIN SMALL LETTER I WITH GRAVE */ #define XK_iacute 0x00ed /* U+00ED LATIN SMALL LETTER I WITH ACUTE */ #define XK_icircumflex 0x00ee /* U+00EE LATIN SMALL LETTER I WITH CIRCUMFLEX */ #define XK_idiaeresis 0x00ef /* U+00EF LATIN SMALL LETTER I WITH DIAERESIS */ #define XK_eth 0x00f0 /* U+00F0 LATIN SMALL LETTER ETH */ #define XK_ntilde 0x00f1 /* U+00F1 LATIN SMALL LETTER N WITH TILDE */ #define XK_ograve 0x00f2 /* U+00F2 LATIN SMALL LETTER O WITH GRAVE */ #define XK_oacute 0x00f3 /* U+00F3 LATIN SMALL LETTER O WITH ACUTE */ #define XK_ocircumflex 0x00f4 /* U+00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX */ #define XK_otilde 0x00f5 /* U+00F5 LATIN SMALL LETTER O WITH TILDE */ #define XK_odiaeresis 0x00f6 /* U+00F6 LATIN SMALL LETTER O WITH DIAERESIS */ #define XK_division 0x00f7 /* U+00F7 DIVISION SIGN */ #define XK_oslash 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */ #define XK_ooblique 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */ #define XK_ugrave 0x00f9 /* U+00F9 LATIN SMALL LETTER U WITH GRAVE */ #define XK_uacute 0x00fa /* U+00FA LATIN SMALL LETTER U WITH ACUTE */ #define XK_ucircumflex 0x00fb /* U+00FB LATIN SMALL LETTER U WITH CIRCUMFLEX */ #define XK_udiaeresis 0x00fc /* U+00FC LATIN SMALL LETTER U WITH DIAERESIS */ #define XK_yacute 0x00fd /* U+00FD LATIN SMALL LETTER Y WITH ACUTE */ #define XK_thorn 0x00fe /* U+00FE LATIN SMALL LETTER THORN */ #define XK_ydiaeresis 0x00ff /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */ #endif /* XK_LATIN1 */ /* * Latin 2 * Byte 3 = 1 */ #ifdef XK_LATIN2 #define XK_Aogonek 0x01a1 /* U+0104 LATIN CAPITAL LETTER A WITH OGONEK */ #define XK_breve 0x01a2 /* U+02D8 BREVE */ #define XK_Lstroke 0x01a3 /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ #define XK_Lcaron 0x01a5 /* U+013D LATIN CAPITAL LETTER L WITH CARON */ #define XK_Sacute 0x01a6 /* U+015A LATIN CAPITAL LETTER S WITH ACUTE */ #define XK_Scaron 0x01a9 /* U+0160 LATIN CAPITAL LETTER S WITH CARON */ #define XK_Scedilla 0x01aa /* U+015E LATIN CAPITAL LETTER S WITH CEDILLA */ #define XK_Tcaron 0x01ab /* U+0164 LATIN CAPITAL LETTER T WITH CARON */ #define XK_Zacute 0x01ac /* U+0179 LATIN CAPITAL LETTER Z WITH ACUTE */ #define XK_Zcaron 0x01ae /* U+017D LATIN CAPITAL LETTER Z WITH CARON */ #define XK_Zabovedot 0x01af /* U+017B LATIN CAPITAL LETTER Z WITH DOT ABOVE */ #define XK_aogonek 0x01b1 /* U+0105 LATIN SMALL LETTER A WITH OGONEK */ #define XK_ogonek 0x01b2 /* U+02DB OGONEK */ #define XK_lstroke 0x01b3 /* U+0142 LATIN SMALL LETTER L WITH STROKE */ #define XK_lcaron 0x01b5 /* U+013E LATIN SMALL LETTER L WITH CARON */ #define XK_sacute 0x01b6 /* U+015B LATIN SMALL LETTER S WITH ACUTE */ #define XK_caron 0x01b7 /* U+02C7 CARON */ #define XK_scaron 0x01b9 /* U+0161 LATIN SMALL LETTER S WITH CARON */ #define XK_scedilla 0x01ba /* U+015F LATIN SMALL LETTER S WITH CEDILLA */ #define XK_tcaron 0x01bb /* U+0165 LATIN SMALL LETTER T WITH CARON */ #define XK_zacute 0x01bc /* U+017A LATIN SMALL LETTER Z WITH ACUTE */ #define XK_doubleacute 0x01bd /* U+02DD DOUBLE ACUTE ACCENT */ #define XK_zcaron 0x01be /* U+017E LATIN SMALL LETTER Z WITH CARON */ #define XK_zabovedot 0x01bf /* U+017C LATIN SMALL LETTER Z WITH DOT ABOVE */ #define XK_Racute 0x01c0 /* U+0154 LATIN CAPITAL LETTER R WITH ACUTE */ #define XK_Abreve 0x01c3 /* U+0102 LATIN CAPITAL LETTER A WITH BREVE */ #define XK_Lacute 0x01c5 /* U+0139 LATIN CAPITAL LETTER L WITH ACUTE */ #define XK_Cacute 0x01c6 /* U+0106 LATIN CAPITAL LETTER C WITH ACUTE */ #define XK_Ccaron 0x01c8 /* U+010C LATIN CAPITAL LETTER C WITH CARON */ #define XK_Eogonek 0x01ca /* U+0118 LATIN CAPITAL LETTER E WITH OGONEK */ #define XK_Ecaron 0x01cc /* U+011A LATIN CAPITAL LETTER E WITH CARON */ #define XK_Dcaron 0x01cf /* U+010E LATIN CAPITAL LETTER D WITH CARON */ #define XK_Dstroke 0x01d0 /* U+0110 LATIN CAPITAL LETTER D WITH STROKE */ #define XK_Nacute 0x01d1 /* U+0143 LATIN CAPITAL LETTER N WITH ACUTE */ #define XK_Ncaron 0x01d2 /* U+0147 LATIN CAPITAL LETTER N WITH CARON */ #define XK_Odoubleacute 0x01d5 /* U+0150 LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */ #define XK_Rcaron 0x01d8 /* U+0158 LATIN CAPITAL LETTER R WITH CARON */ #define XK_Uring 0x01d9 /* U+016E LATIN CAPITAL LETTER U WITH RING ABOVE */ #define XK_Udoubleacute 0x01db /* U+0170 LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */ #define XK_Tcedilla 0x01de /* U+0162 LATIN CAPITAL LETTER T WITH CEDILLA */ #define XK_racute 0x01e0 /* U+0155 LATIN SMALL LETTER R WITH ACUTE */ #define XK_abreve 0x01e3 /* U+0103 LATIN SMALL LETTER A WITH BREVE */ #define XK_lacute 0x01e5 /* U+013A LATIN SMALL LETTER L WITH ACUTE */ #define XK_cacute 0x01e6 /* U+0107 LATIN SMALL LETTER C WITH ACUTE */ #define XK_ccaron 0x01e8 /* U+010D LATIN SMALL LETTER C WITH CARON */ #define XK_eogonek 0x01ea /* U+0119 LATIN SMALL LETTER E WITH OGONEK */ #define XK_ecaron 0x01ec /* U+011B LATIN SMALL LETTER E WITH CARON */ #define XK_dcaron 0x01ef /* U+010F LATIN SMALL LETTER D WITH CARON */ #define XK_dstroke 0x01f0 /* U+0111 LATIN SMALL LETTER D WITH STROKE */ #define XK_nacute 0x01f1 /* U+0144 LATIN SMALL LETTER N WITH ACUTE */ #define XK_ncaron 0x01f2 /* U+0148 LATIN SMALL LETTER N WITH CARON */ #define XK_odoubleacute 0x01f5 /* U+0151 LATIN SMALL LETTER O WITH DOUBLE ACUTE */ #define XK_rcaron 0x01f8 /* U+0159 LATIN SMALL LETTER R WITH CARON */ #define XK_uring 0x01f9 /* U+016F LATIN SMALL LETTER U WITH RING ABOVE */ #define XK_udoubleacute 0x01fb /* U+0171 LATIN SMALL LETTER U WITH DOUBLE ACUTE */ #define XK_tcedilla 0x01fe /* U+0163 LATIN SMALL LETTER T WITH CEDILLA */ #define XK_abovedot 0x01ff /* U+02D9 DOT ABOVE */ #endif /* XK_LATIN2 */ /* * Latin 3 * Byte 3 = 2 */ #ifdef XK_LATIN3 #define XK_Hstroke 0x02a1 /* U+0126 LATIN CAPITAL LETTER H WITH STROKE */ #define XK_Hcircumflex 0x02a6 /* U+0124 LATIN CAPITAL LETTER H WITH CIRCUMFLEX */ #define XK_Iabovedot 0x02a9 /* U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE */ #define XK_Gbreve 0x02ab /* U+011E LATIN CAPITAL LETTER G WITH BREVE */ #define XK_Jcircumflex 0x02ac /* U+0134 LATIN CAPITAL LETTER J WITH CIRCUMFLEX */ #define XK_hstroke 0x02b1 /* U+0127 LATIN SMALL LETTER H WITH STROKE */ #define XK_hcircumflex 0x02b6 /* U+0125 LATIN SMALL LETTER H WITH CIRCUMFLEX */ #define XK_idotless 0x02b9 /* U+0131 LATIN SMALL LETTER DOTLESS I */ #define XK_gbreve 0x02bb /* U+011F LATIN SMALL LETTER G WITH BREVE */ #define XK_jcircumflex 0x02bc /* U+0135 LATIN SMALL LETTER J WITH CIRCUMFLEX */ #define XK_Cabovedot 0x02c5 /* U+010A LATIN CAPITAL LETTER C WITH DOT ABOVE */ #define XK_Ccircumflex 0x02c6 /* U+0108 LATIN CAPITAL LETTER C WITH CIRCUMFLEX */ #define XK_Gabovedot 0x02d5 /* U+0120 LATIN CAPITAL LETTER G WITH DOT ABOVE */ #define XK_Gcircumflex 0x02d8 /* U+011C LATIN CAPITAL LETTER G WITH CIRCUMFLEX */ #define XK_Ubreve 0x02dd /* U+016C LATIN CAPITAL LETTER U WITH BREVE */ #define XK_Scircumflex 0x02de /* U+015C LATIN CAPITAL LETTER S WITH CIRCUMFLEX */ #define XK_cabovedot 0x02e5 /* U+010B LATIN SMALL LETTER C WITH DOT ABOVE */ #define XK_ccircumflex 0x02e6 /* U+0109 LATIN SMALL LETTER C WITH CIRCUMFLEX */ #define XK_gabovedot 0x02f5 /* U+0121 LATIN SMALL LETTER G WITH DOT ABOVE */ #define XK_gcircumflex 0x02f8 /* U+011D LATIN SMALL LETTER G WITH CIRCUMFLEX */ #define XK_ubreve 0x02fd /* U+016D LATIN SMALL LETTER U WITH BREVE */ #define XK_scircumflex 0x02fe /* U+015D LATIN SMALL LETTER S WITH CIRCUMFLEX */ #endif /* XK_LATIN3 */ /* * Latin 4 * Byte 3 = 3 */ #ifdef XK_LATIN4 #define XK_kra 0x03a2 /* U+0138 LATIN SMALL LETTER KRA */ #define XK_kappa 0x03a2 /* deprecated */ #define XK_Rcedilla 0x03a3 /* U+0156 LATIN CAPITAL LETTER R WITH CEDILLA */ #define XK_Itilde 0x03a5 /* U+0128 LATIN CAPITAL LETTER I WITH TILDE */ #define XK_Lcedilla 0x03a6 /* U+013B LATIN CAPITAL LETTER L WITH CEDILLA */ #define XK_Emacron 0x03aa /* U+0112 LATIN CAPITAL LETTER E WITH MACRON */ #define XK_Gcedilla 0x03ab /* U+0122 LATIN CAPITAL LETTER G WITH CEDILLA */ #define XK_Tslash 0x03ac /* U+0166 LATIN CAPITAL LETTER T WITH STROKE */ #define XK_rcedilla 0x03b3 /* U+0157 LATIN SMALL LETTER R WITH CEDILLA */ #define XK_itilde 0x03b5 /* U+0129 LATIN SMALL LETTER I WITH TILDE */ #define XK_lcedilla 0x03b6 /* U+013C LATIN SMALL LETTER L WITH CEDILLA */ #define XK_emacron 0x03ba /* U+0113 LATIN SMALL LETTER E WITH MACRON */ #define XK_gcedilla 0x03bb /* U+0123 LATIN SMALL LETTER G WITH CEDILLA */ #define XK_tslash 0x03bc /* U+0167 LATIN SMALL LETTER T WITH STROKE */ #define XK_ENG 0x03bd /* U+014A LATIN CAPITAL LETTER ENG */ #define XK_eng 0x03bf /* U+014B LATIN SMALL LETTER ENG */ #define XK_Amacron 0x03c0 /* U+0100 LATIN CAPITAL LETTER A WITH MACRON */ #define XK_Iogonek 0x03c7 /* U+012E LATIN CAPITAL LETTER I WITH OGONEK */ #define XK_Eabovedot 0x03cc /* U+0116 LATIN CAPITAL LETTER E WITH DOT ABOVE */ #define XK_Imacron 0x03cf /* U+012A LATIN CAPITAL LETTER I WITH MACRON */ #define XK_Ncedilla 0x03d1 /* U+0145 LATIN CAPITAL LETTER N WITH CEDILLA */ #define XK_Omacron 0x03d2 /* U+014C LATIN CAPITAL LETTER O WITH MACRON */ #define XK_Kcedilla 0x03d3 /* U+0136 LATIN CAPITAL LETTER K WITH CEDILLA */ #define XK_Uogonek 0x03d9 /* U+0172 LATIN CAPITAL LETTER U WITH OGONEK */ #define XK_Utilde 0x03dd /* U+0168 LATIN CAPITAL LETTER U WITH TILDE */ #define XK_Umacron 0x03de /* U+016A LATIN CAPITAL LETTER U WITH MACRON */ #define XK_amacron 0x03e0 /* U+0101 LATIN SMALL LETTER A WITH MACRON */ #define XK_iogonek 0x03e7 /* U+012F LATIN SMALL LETTER I WITH OGONEK */ #define XK_eabovedot 0x03ec /* U+0117 LATIN SMALL LETTER E WITH DOT ABOVE */ #define XK_imacron 0x03ef /* U+012B LATIN SMALL LETTER I WITH MACRON */ #define XK_ncedilla 0x03f1 /* U+0146 LATIN SMALL LETTER N WITH CEDILLA */ #define XK_omacron 0x03f2 /* U+014D LATIN SMALL LETTER O WITH MACRON */ #define XK_kcedilla 0x03f3 /* U+0137 LATIN SMALL LETTER K WITH CEDILLA */ #define XK_uogonek 0x03f9 /* U+0173 LATIN SMALL LETTER U WITH OGONEK */ #define XK_utilde 0x03fd /* U+0169 LATIN SMALL LETTER U WITH TILDE */ #define XK_umacron 0x03fe /* U+016B LATIN SMALL LETTER U WITH MACRON */ #endif /* XK_LATIN4 */ /* * Latin 8 */ #ifdef XK_LATIN8 #define XK_Wcircumflex 0x1000174 /* U+0174 LATIN CAPITAL LETTER W WITH CIRCUMFLEX */ #define XK_wcircumflex 0x1000175 /* U+0175 LATIN SMALL LETTER W WITH CIRCUMFLEX */ #define XK_Ycircumflex 0x1000176 /* U+0176 LATIN CAPITAL LETTER Y WITH CIRCUMFLEX */ #define XK_ycircumflex 0x1000177 /* U+0177 LATIN SMALL LETTER Y WITH CIRCUMFLEX */ #define XK_Babovedot 0x1001e02 /* U+1E02 LATIN CAPITAL LETTER B WITH DOT ABOVE */ #define XK_babovedot 0x1001e03 /* U+1E03 LATIN SMALL LETTER B WITH DOT ABOVE */ #define XK_Dabovedot 0x1001e0a /* U+1E0A LATIN CAPITAL LETTER D WITH DOT ABOVE */ #define XK_dabovedot 0x1001e0b /* U+1E0B LATIN SMALL LETTER D WITH DOT ABOVE */ #define XK_Fabovedot 0x1001e1e /* U+1E1E LATIN CAPITAL LETTER F WITH DOT ABOVE */ #define XK_fabovedot 0x1001e1f /* U+1E1F LATIN SMALL LETTER F WITH DOT ABOVE */ #define XK_Mabovedot 0x1001e40 /* U+1E40 LATIN CAPITAL LETTER M WITH DOT ABOVE */ #define XK_mabovedot 0x1001e41 /* U+1E41 LATIN SMALL LETTER M WITH DOT ABOVE */ #define XK_Pabovedot 0x1001e56 /* U+1E56 LATIN CAPITAL LETTER P WITH DOT ABOVE */ #define XK_pabovedot 0x1001e57 /* U+1E57 LATIN SMALL LETTER P WITH DOT ABOVE */ #define XK_Sabovedot 0x1001e60 /* U+1E60 LATIN CAPITAL LETTER S WITH DOT ABOVE */ #define XK_sabovedot 0x1001e61 /* U+1E61 LATIN SMALL LETTER S WITH DOT ABOVE */ #define XK_Tabovedot 0x1001e6a /* U+1E6A LATIN CAPITAL LETTER T WITH DOT ABOVE */ #define XK_tabovedot 0x1001e6b /* U+1E6B LATIN SMALL LETTER T WITH DOT ABOVE */ #define XK_Wgrave 0x1001e80 /* U+1E80 LATIN CAPITAL LETTER W WITH GRAVE */ #define XK_wgrave 0x1001e81 /* U+1E81 LATIN SMALL LETTER W WITH GRAVE */ #define XK_Wacute 0x1001e82 /* U+1E82 LATIN CAPITAL LETTER W WITH ACUTE */ #define XK_wacute 0x1001e83 /* U+1E83 LATIN SMALL LETTER W WITH ACUTE */ #define XK_Wdiaeresis 0x1001e84 /* U+1E84 LATIN CAPITAL LETTER W WITH DIAERESIS */ #define XK_wdiaeresis 0x1001e85 /* U+1E85 LATIN SMALL LETTER W WITH DIAERESIS */ #define XK_Ygrave 0x1001ef2 /* U+1EF2 LATIN CAPITAL LETTER Y WITH GRAVE */ #define XK_ygrave 0x1001ef3 /* U+1EF3 LATIN SMALL LETTER Y WITH GRAVE */ #endif /* XK_LATIN8 */ /* * Latin 9 * Byte 3 = 0x13 */ #ifdef XK_LATIN9 #define XK_OE 0x13bc /* U+0152 LATIN CAPITAL LIGATURE OE */ #define XK_oe 0x13bd /* U+0153 LATIN SMALL LIGATURE OE */ #define XK_Ydiaeresis 0x13be /* U+0178 LATIN CAPITAL LETTER Y WITH DIAERESIS */ #endif /* XK_LATIN9 */ /* * Katakana * Byte 3 = 4 */ #ifdef XK_KATAKANA #define XK_overline 0x047e /* U+203E OVERLINE */ #define XK_kana_fullstop 0x04a1 /* U+3002 IDEOGRAPHIC FULL STOP */ #define XK_kana_openingbracket 0x04a2 /* U+300C LEFT CORNER BRACKET */ #define XK_kana_closingbracket 0x04a3 /* U+300D RIGHT CORNER BRACKET */ #define XK_kana_comma 0x04a4 /* U+3001 IDEOGRAPHIC COMMA */ #define XK_kana_conjunctive 0x04a5 /* U+30FB KATAKANA MIDDLE DOT */ #define XK_kana_middledot 0x04a5 /* deprecated */ #define XK_kana_WO 0x04a6 /* U+30F2 KATAKANA LETTER WO */ #define XK_kana_a 0x04a7 /* U+30A1 KATAKANA LETTER SMALL A */ #define XK_kana_i 0x04a8 /* U+30A3 KATAKANA LETTER SMALL I */ #define XK_kana_u 0x04a9 /* U+30A5 KATAKANA LETTER SMALL U */ #define XK_kana_e 0x04aa /* U+30A7 KATAKANA LETTER SMALL E */ #define XK_kana_o 0x04ab /* U+30A9 KATAKANA LETTER SMALL O */ #define XK_kana_ya 0x04ac /* U+30E3 KATAKANA LETTER SMALL YA */ #define XK_kana_yu 0x04ad /* U+30E5 KATAKANA LETTER SMALL YU */ #define XK_kana_yo 0x04ae /* U+30E7 KATAKANA LETTER SMALL YO */ #define XK_kana_tsu 0x04af /* U+30C3 KATAKANA LETTER SMALL TU */ #define XK_kana_tu 0x04af /* deprecated */ #define XK_prolongedsound 0x04b0 /* U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK */ #define XK_kana_A 0x04b1 /* U+30A2 KATAKANA LETTER A */ #define XK_kana_I 0x04b2 /* U+30A4 KATAKANA LETTER I */ #define XK_kana_U 0x04b3 /* U+30A6 KATAKANA LETTER U */ #define XK_kana_E 0x04b4 /* U+30A8 KATAKANA LETTER E */ #define XK_kana_O 0x04b5 /* U+30AA KATAKANA LETTER O */ #define XK_kana_KA 0x04b6 /* U+30AB KATAKANA LETTER KA */ #define XK_kana_KI 0x04b7 /* U+30AD KATAKANA LETTER KI */ #define XK_kana_KU 0x04b8 /* U+30AF KATAKANA LETTER KU */ #define XK_kana_KE 0x04b9 /* U+30B1 KATAKANA LETTER KE */ #define XK_kana_KO 0x04ba /* U+30B3 KATAKANA LETTER KO */ #define XK_kana_SA 0x04bb /* U+30B5 KATAKANA LETTER SA */ #define XK_kana_SHI 0x04bc /* U+30B7 KATAKANA LETTER SI */ #define XK_kana_SU 0x04bd /* U+30B9 KATAKANA LETTER SU */ #define XK_kana_SE 0x04be /* U+30BB KATAKANA LETTER SE */ #define XK_kana_SO 0x04bf /* U+30BD KATAKANA LETTER SO */ #define XK_kana_TA 0x04c0 /* U+30BF KATAKANA LETTER TA */ #define XK_kana_CHI 0x04c1 /* U+30C1 KATAKANA LETTER TI */ #define XK_kana_TI 0x04c1 /* deprecated */ #define XK_kana_TSU 0x04c2 /* U+30C4 KATAKANA LETTER TU */ #define XK_kana_TU 0x04c2 /* deprecated */ #define XK_kana_TE 0x04c3 /* U+30C6 KATAKANA LETTER TE */ #define XK_kana_TO 0x04c4 /* U+30C8 KATAKANA LETTER TO */ #define XK_kana_NA 0x04c5 /* U+30CA KATAKANA LETTER NA */ #define XK_kana_NI 0x04c6 /* U+30CB KATAKANA LETTER NI */ #define XK_kana_NU 0x04c7 /* U+30CC KATAKANA LETTER NU */ #define XK_kana_NE 0x04c8 /* U+30CD KATAKANA LETTER NE */ #define XK_kana_NO 0x04c9 /* U+30CE KATAKANA LETTER NO */ #define XK_kana_HA 0x04ca /* U+30CF KATAKANA LETTER HA */ #define XK_kana_HI 0x04cb /* U+30D2 KATAKANA LETTER HI */ #define XK_kana_FU 0x04cc /* U+30D5 KATAKANA LETTER HU */ #define XK_kana_HU 0x04cc /* deprecated */ #define XK_kana_HE 0x04cd /* U+30D8 KATAKANA LETTER HE */ #define XK_kana_HO 0x04ce /* U+30DB KATAKANA LETTER HO */ #define XK_kana_MA 0x04cf /* U+30DE KATAKANA LETTER MA */ #define XK_kana_MI 0x04d0 /* U+30DF KATAKANA LETTER MI */ #define XK_kana_MU 0x04d1 /* U+30E0 KATAKANA LETTER MU */ #define XK_kana_ME 0x04d2 /* U+30E1 KATAKANA LETTER ME */ #define XK_kana_MO 0x04d3 /* U+30E2 KATAKANA LETTER MO */ #define XK_kana_YA 0x04d4 /* U+30E4 KATAKANA LETTER YA */ #define XK_kana_YU 0x04d5 /* U+30E6 KATAKANA LETTER YU */ #define XK_kana_YO 0x04d6 /* U+30E8 KATAKANA LETTER YO */ #define XK_kana_RA 0x04d7 /* U+30E9 KATAKANA LETTER RA */ #define XK_kana_RI 0x04d8 /* U+30EA KATAKANA LETTER RI */ #define XK_kana_RU 0x04d9 /* U+30EB KATAKANA LETTER RU */ #define XK_kana_RE 0x04da /* U+30EC KATAKANA LETTER RE */ #define XK_kana_RO 0x04db /* U+30ED KATAKANA LETTER RO */ #define XK_kana_WA 0x04dc /* U+30EF KATAKANA LETTER WA */ #define XK_kana_N 0x04dd /* U+30F3 KATAKANA LETTER N */ #define XK_voicedsound 0x04de /* U+309B KATAKANA-HIRAGANA VOICED SOUND MARK */ #define XK_semivoicedsound 0x04df /* U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */ #define XK_kana_switch 0xff7e /* Alias for mode_switch */ #endif /* XK_KATAKANA */ /* * Arabic * Byte 3 = 5 */ #ifdef XK_ARABIC #define XK_Farsi_0 0x10006f0 /* U+06F0 EXTENDED ARABIC-INDIC DIGIT ZERO */ #define XK_Farsi_1 0x10006f1 /* U+06F1 EXTENDED ARABIC-INDIC DIGIT ONE */ #define XK_Farsi_2 0x10006f2 /* U+06F2 EXTENDED ARABIC-INDIC DIGIT TWO */ #define XK_Farsi_3 0x10006f3 /* U+06F3 EXTENDED ARABIC-INDIC DIGIT THREE */ #define XK_Farsi_4 0x10006f4 /* U+06F4 EXTENDED ARABIC-INDIC DIGIT FOUR */ #define XK_Farsi_5 0x10006f5 /* U+06F5 EXTENDED ARABIC-INDIC DIGIT FIVE */ #define XK_Farsi_6 0x10006f6 /* U+06F6 EXTENDED ARABIC-INDIC DIGIT SIX */ #define XK_Farsi_7 0x10006f7 /* U+06F7 EXTENDED ARABIC-INDIC DIGIT SEVEN */ #define XK_Farsi_8 0x10006f8 /* U+06F8 EXTENDED ARABIC-INDIC DIGIT EIGHT */ #define XK_Farsi_9 0x10006f9 /* U+06F9 EXTENDED ARABIC-INDIC DIGIT NINE */ #define XK_Arabic_percent 0x100066a /* U+066A ARABIC PERCENT SIGN */ #define XK_Arabic_superscript_alef 0x1000670 /* U+0670 ARABIC LETTER SUPERSCRIPT ALEF */ #define XK_Arabic_tteh 0x1000679 /* U+0679 ARABIC LETTER TTEH */ #define XK_Arabic_peh 0x100067e /* U+067E ARABIC LETTER PEH */ #define XK_Arabic_tcheh 0x1000686 /* U+0686 ARABIC LETTER TCHEH */ #define XK_Arabic_ddal 0x1000688 /* U+0688 ARABIC LETTER DDAL */ #define XK_Arabic_rreh 0x1000691 /* U+0691 ARABIC LETTER RREH */ #define XK_Arabic_comma 0x05ac /* U+060C ARABIC COMMA */ #define XK_Arabic_fullstop 0x10006d4 /* U+06D4 ARABIC FULL STOP */ #define XK_Arabic_0 0x1000660 /* U+0660 ARABIC-INDIC DIGIT ZERO */ #define XK_Arabic_1 0x1000661 /* U+0661 ARABIC-INDIC DIGIT ONE */ #define XK_Arabic_2 0x1000662 /* U+0662 ARABIC-INDIC DIGIT TWO */ #define XK_Arabic_3 0x1000663 /* U+0663 ARABIC-INDIC DIGIT THREE */ #define XK_Arabic_4 0x1000664 /* U+0664 ARABIC-INDIC DIGIT FOUR */ #define XK_Arabic_5 0x1000665 /* U+0665 ARABIC-INDIC DIGIT FIVE */ #define XK_Arabic_6 0x1000666 /* U+0666 ARABIC-INDIC DIGIT SIX */ #define XK_Arabic_7 0x1000667 /* U+0667 ARABIC-INDIC DIGIT SEVEN */ #define XK_Arabic_8 0x1000668 /* U+0668 ARABIC-INDIC DIGIT EIGHT */ #define XK_Arabic_9 0x1000669 /* U+0669 ARABIC-INDIC DIGIT NINE */ #define XK_Arabic_semicolon 0x05bb /* U+061B ARABIC SEMICOLON */ #define XK_Arabic_question_mark 0x05bf /* U+061F ARABIC QUESTION MARK */ #define XK_Arabic_hamza 0x05c1 /* U+0621 ARABIC LETTER HAMZA */ #define XK_Arabic_maddaonalef 0x05c2 /* U+0622 ARABIC LETTER ALEF WITH MADDA ABOVE */ #define XK_Arabic_hamzaonalef 0x05c3 /* U+0623 ARABIC LETTER ALEF WITH HAMZA ABOVE */ #define XK_Arabic_hamzaonwaw 0x05c4 /* U+0624 ARABIC LETTER WAW WITH HAMZA ABOVE */ #define XK_Arabic_hamzaunderalef 0x05c5 /* U+0625 ARABIC LETTER ALEF WITH HAMZA BELOW */ #define XK_Arabic_hamzaonyeh 0x05c6 /* U+0626 ARABIC LETTER YEH WITH HAMZA ABOVE */ #define XK_Arabic_alef 0x05c7 /* U+0627 ARABIC LETTER ALEF */ #define XK_Arabic_beh 0x05c8 /* U+0628 ARABIC LETTER BEH */ #define XK_Arabic_tehmarbuta 0x05c9 /* U+0629 ARABIC LETTER TEH MARBUTA */ #define XK_Arabic_teh 0x05ca /* U+062A ARABIC LETTER TEH */ #define XK_Arabic_theh 0x05cb /* U+062B ARABIC LETTER THEH */ #define XK_Arabic_jeem 0x05cc /* U+062C ARABIC LETTER JEEM */ #define XK_Arabic_hah 0x05cd /* U+062D ARABIC LETTER HAH */ #define XK_Arabic_khah 0x05ce /* U+062E ARABIC LETTER KHAH */ #define XK_Arabic_dal 0x05cf /* U+062F ARABIC LETTER DAL */ #define XK_Arabic_thal 0x05d0 /* U+0630 ARABIC LETTER THAL */ #define XK_Arabic_ra 0x05d1 /* U+0631 ARABIC LETTER REH */ #define XK_Arabic_zain 0x05d2 /* U+0632 ARABIC LETTER ZAIN */ #define XK_Arabic_seen 0x05d3 /* U+0633 ARABIC LETTER SEEN */ #define XK_Arabic_sheen 0x05d4 /* U+0634 ARABIC LETTER SHEEN */ #define XK_Arabic_sad 0x05d5 /* U+0635 ARABIC LETTER SAD */ #define XK_Arabic_dad 0x05d6 /* U+0636 ARABIC LETTER DAD */ #define XK_Arabic_tah 0x05d7 /* U+0637 ARABIC LETTER TAH */ #define XK_Arabic_zah 0x05d8 /* U+0638 ARABIC LETTER ZAH */ #define XK_Arabic_ain 0x05d9 /* U+0639 ARABIC LETTER AIN */ #define XK_Arabic_ghain 0x05da /* U+063A ARABIC LETTER GHAIN */ #define XK_Arabic_tatweel 0x05e0 /* U+0640 ARABIC TATWEEL */ #define XK_Arabic_feh 0x05e1 /* U+0641 ARABIC LETTER FEH */ #define XK_Arabic_qaf 0x05e2 /* U+0642 ARABIC LETTER QAF */ #define XK_Arabic_kaf 0x05e3 /* U+0643 ARABIC LETTER KAF */ #define XK_Arabic_lam 0x05e4 /* U+0644 ARABIC LETTER LAM */ #define XK_Arabic_meem 0x05e5 /* U+0645 ARABIC LETTER MEEM */ #define XK_Arabic_noon 0x05e6 /* U+0646 ARABIC LETTER NOON */ #define XK_Arabic_ha 0x05e7 /* U+0647 ARABIC LETTER HEH */ #define XK_Arabic_heh 0x05e7 /* deprecated */ #define XK_Arabic_waw 0x05e8 /* U+0648 ARABIC LETTER WAW */ #define XK_Arabic_alefmaksura 0x05e9 /* U+0649 ARABIC LETTER ALEF MAKSURA */ #define XK_Arabic_yeh 0x05ea /* U+064A ARABIC LETTER YEH */ #define XK_Arabic_fathatan 0x05eb /* U+064B ARABIC FATHATAN */ #define XK_Arabic_dammatan 0x05ec /* U+064C ARABIC DAMMATAN */ #define XK_Arabic_kasratan 0x05ed /* U+064D ARABIC KASRATAN */ #define XK_Arabic_fatha 0x05ee /* U+064E ARABIC FATHA */ #define XK_Arabic_damma 0x05ef /* U+064F ARABIC DAMMA */ #define XK_Arabic_kasra 0x05f0 /* U+0650 ARABIC KASRA */ #define XK_Arabic_shadda 0x05f1 /* U+0651 ARABIC SHADDA */ #define XK_Arabic_sukun 0x05f2 /* U+0652 ARABIC SUKUN */ #define XK_Arabic_madda_above 0x1000653 /* U+0653 ARABIC MADDAH ABOVE */ #define XK_Arabic_hamza_above 0x1000654 /* U+0654 ARABIC HAMZA ABOVE */ #define XK_Arabic_hamza_below 0x1000655 /* U+0655 ARABIC HAMZA BELOW */ #define XK_Arabic_jeh 0x1000698 /* U+0698 ARABIC LETTER JEH */ #define XK_Arabic_veh 0x10006a4 /* U+06A4 ARABIC LETTER VEH */ #define XK_Arabic_keheh 0x10006a9 /* U+06A9 ARABIC LETTER KEHEH */ #define XK_Arabic_gaf 0x10006af /* U+06AF ARABIC LETTER GAF */ #define XK_Arabic_noon_ghunna 0x10006ba /* U+06BA ARABIC LETTER NOON GHUNNA */ #define XK_Arabic_heh_doachashmee 0x10006be /* U+06BE ARABIC LETTER HEH DOACHASHMEE */ #define XK_Farsi_yeh 0x10006cc /* U+06CC ARABIC LETTER FARSI YEH */ #define XK_Arabic_farsi_yeh 0x10006cc /* U+06CC ARABIC LETTER FARSI YEH */ #define XK_Arabic_yeh_baree 0x10006d2 /* U+06D2 ARABIC LETTER YEH BARREE */ #define XK_Arabic_heh_goal 0x10006c1 /* U+06C1 ARABIC LETTER HEH GOAL */ #define XK_Arabic_switch 0xff7e /* Alias for mode_switch */ #endif /* XK_ARABIC */ /* * Cyrillic * Byte 3 = 6 */ #ifdef XK_CYRILLIC #define XK_Cyrillic_GHE_bar 0x1000492 /* U+0492 CYRILLIC CAPITAL LETTER GHE WITH STROKE */ #define XK_Cyrillic_ghe_bar 0x1000493 /* U+0493 CYRILLIC SMALL LETTER GHE WITH STROKE */ #define XK_Cyrillic_ZHE_descender 0x1000496 /* U+0496 CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER */ #define XK_Cyrillic_zhe_descender 0x1000497 /* U+0497 CYRILLIC SMALL LETTER ZHE WITH DESCENDER */ #define XK_Cyrillic_KA_descender 0x100049a /* U+049A CYRILLIC CAPITAL LETTER KA WITH DESCENDER */ #define XK_Cyrillic_ka_descender 0x100049b /* U+049B CYRILLIC SMALL LETTER KA WITH DESCENDER */ #define XK_Cyrillic_KA_vertstroke 0x100049c /* U+049C CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE */ #define XK_Cyrillic_ka_vertstroke 0x100049d /* U+049D CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE */ #define XK_Cyrillic_EN_descender 0x10004a2 /* U+04A2 CYRILLIC CAPITAL LETTER EN WITH DESCENDER */ #define XK_Cyrillic_en_descender 0x10004a3 /* U+04A3 CYRILLIC SMALL LETTER EN WITH DESCENDER */ #define XK_Cyrillic_U_straight 0x10004ae /* U+04AE CYRILLIC CAPITAL LETTER STRAIGHT U */ #define XK_Cyrillic_u_straight 0x10004af /* U+04AF CYRILLIC SMALL LETTER STRAIGHT U */ #define XK_Cyrillic_U_straight_bar 0x10004b0 /* U+04B0 CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE */ #define XK_Cyrillic_u_straight_bar 0x10004b1 /* U+04B1 CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE */ #define XK_Cyrillic_HA_descender 0x10004b2 /* U+04B2 CYRILLIC CAPITAL LETTER HA WITH DESCENDER */ #define XK_Cyrillic_ha_descender 0x10004b3 /* U+04B3 CYRILLIC SMALL LETTER HA WITH DESCENDER */ #define XK_Cyrillic_CHE_descender 0x10004b6 /* U+04B6 CYRILLIC CAPITAL LETTER CHE WITH DESCENDER */ #define XK_Cyrillic_che_descender 0x10004b7 /* U+04B7 CYRILLIC SMALL LETTER CHE WITH DESCENDER */ #define XK_Cyrillic_CHE_vertstroke 0x10004b8 /* U+04B8 CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE */ #define XK_Cyrillic_che_vertstroke 0x10004b9 /* U+04B9 CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE */ #define XK_Cyrillic_SHHA 0x10004ba /* U+04BA CYRILLIC CAPITAL LETTER SHHA */ #define XK_Cyrillic_shha 0x10004bb /* U+04BB CYRILLIC SMALL LETTER SHHA */ #define XK_Cyrillic_SCHWA 0x10004d8 /* U+04D8 CYRILLIC CAPITAL LETTER SCHWA */ #define XK_Cyrillic_schwa 0x10004d9 /* U+04D9 CYRILLIC SMALL LETTER SCHWA */ #define XK_Cyrillic_I_macron 0x10004e2 /* U+04E2 CYRILLIC CAPITAL LETTER I WITH MACRON */ #define XK_Cyrillic_i_macron 0x10004e3 /* U+04E3 CYRILLIC SMALL LETTER I WITH MACRON */ #define XK_Cyrillic_O_bar 0x10004e8 /* U+04E8 CYRILLIC CAPITAL LETTER BARRED O */ #define XK_Cyrillic_o_bar 0x10004e9 /* U+04E9 CYRILLIC SMALL LETTER BARRED O */ #define XK_Cyrillic_U_macron 0x10004ee /* U+04EE CYRILLIC CAPITAL LETTER U WITH MACRON */ #define XK_Cyrillic_u_macron 0x10004ef /* U+04EF CYRILLIC SMALL LETTER U WITH MACRON */ #define XK_Serbian_dje 0x06a1 /* U+0452 CYRILLIC SMALL LETTER DJE */ #define XK_Macedonia_gje 0x06a2 /* U+0453 CYRILLIC SMALL LETTER GJE */ #define XK_Cyrillic_io 0x06a3 /* U+0451 CYRILLIC SMALL LETTER IO */ #define XK_Ukrainian_ie 0x06a4 /* U+0454 CYRILLIC SMALL LETTER UKRAINIAN IE */ #define XK_Ukranian_je 0x06a4 /* deprecated */ #define XK_Macedonia_dse 0x06a5 /* U+0455 CYRILLIC SMALL LETTER DZE */ #define XK_Ukrainian_i 0x06a6 /* U+0456 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */ #define XK_Ukranian_i 0x06a6 /* deprecated */ #define XK_Ukrainian_yi 0x06a7 /* U+0457 CYRILLIC SMALL LETTER YI */ #define XK_Ukranian_yi 0x06a7 /* deprecated */ #define XK_Cyrillic_je 0x06a8 /* U+0458 CYRILLIC SMALL LETTER JE */ #define XK_Serbian_je 0x06a8 /* deprecated */ #define XK_Cyrillic_lje 0x06a9 /* U+0459 CYRILLIC SMALL LETTER LJE */ #define XK_Serbian_lje 0x06a9 /* deprecated */ #define XK_Cyrillic_nje 0x06aa /* U+045A CYRILLIC SMALL LETTER NJE */ #define XK_Serbian_nje 0x06aa /* deprecated */ #define XK_Serbian_tshe 0x06ab /* U+045B CYRILLIC SMALL LETTER TSHE */ #define XK_Macedonia_kje 0x06ac /* U+045C CYRILLIC SMALL LETTER KJE */ #define XK_Ukrainian_ghe_with_upturn 0x06ad /* U+0491 CYRILLIC SMALL LETTER GHE WITH UPTURN */ #define XK_Byelorussian_shortu 0x06ae /* U+045E CYRILLIC SMALL LETTER SHORT U */ #define XK_Cyrillic_dzhe 0x06af /* U+045F CYRILLIC SMALL LETTER DZHE */ #define XK_Serbian_dze 0x06af /* deprecated */ #define XK_numerosign 0x06b0 /* U+2116 NUMERO SIGN */ #define XK_Serbian_DJE 0x06b1 /* U+0402 CYRILLIC CAPITAL LETTER DJE */ #define XK_Macedonia_GJE 0x06b2 /* U+0403 CYRILLIC CAPITAL LETTER GJE */ #define XK_Cyrillic_IO 0x06b3 /* U+0401 CYRILLIC CAPITAL LETTER IO */ #define XK_Ukrainian_IE 0x06b4 /* U+0404 CYRILLIC CAPITAL LETTER UKRAINIAN IE */ #define XK_Ukranian_JE 0x06b4 /* deprecated */ #define XK_Macedonia_DSE 0x06b5 /* U+0405 CYRILLIC CAPITAL LETTER DZE */ #define XK_Ukrainian_I 0x06b6 /* U+0406 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I */ #define XK_Ukranian_I 0x06b6 /* deprecated */ #define XK_Ukrainian_YI 0x06b7 /* U+0407 CYRILLIC CAPITAL LETTER YI */ #define XK_Ukranian_YI 0x06b7 /* deprecated */ #define XK_Cyrillic_JE 0x06b8 /* U+0408 CYRILLIC CAPITAL LETTER JE */ #define XK_Serbian_JE 0x06b8 /* deprecated */ #define XK_Cyrillic_LJE 0x06b9 /* U+0409 CYRILLIC CAPITAL LETTER LJE */ #define XK_Serbian_LJE 0x06b9 /* deprecated */ #define XK_Cyrillic_NJE 0x06ba /* U+040A CYRILLIC CAPITAL LETTER NJE */ #define XK_Serbian_NJE 0x06ba /* deprecated */ #define XK_Serbian_TSHE 0x06bb /* U+040B CYRILLIC CAPITAL LETTER TSHE */ #define XK_Macedonia_KJE 0x06bc /* U+040C CYRILLIC CAPITAL LETTER KJE */ #define XK_Ukrainian_GHE_WITH_UPTURN 0x06bd /* U+0490 CYRILLIC CAPITAL LETTER GHE WITH UPTURN */ #define XK_Byelorussian_SHORTU 0x06be /* U+040E CYRILLIC CAPITAL LETTER SHORT U */ #define XK_Cyrillic_DZHE 0x06bf /* U+040F CYRILLIC CAPITAL LETTER DZHE */ #define XK_Serbian_DZE 0x06bf /* deprecated */ #define XK_Cyrillic_yu 0x06c0 /* U+044E CYRILLIC SMALL LETTER YU */ #define XK_Cyrillic_a 0x06c1 /* U+0430 CYRILLIC SMALL LETTER A */ #define XK_Cyrillic_be 0x06c2 /* U+0431 CYRILLIC SMALL LETTER BE */ #define XK_Cyrillic_tse 0x06c3 /* U+0446 CYRILLIC SMALL LETTER TSE */ #define XK_Cyrillic_de 0x06c4 /* U+0434 CYRILLIC SMALL LETTER DE */ #define XK_Cyrillic_ie 0x06c5 /* U+0435 CYRILLIC SMALL LETTER IE */ #define XK_Cyrillic_ef 0x06c6 /* U+0444 CYRILLIC SMALL LETTER EF */ #define XK_Cyrillic_ghe 0x06c7 /* U+0433 CYRILLIC SMALL LETTER GHE */ #define XK_Cyrillic_ha 0x06c8 /* U+0445 CYRILLIC SMALL LETTER HA */ #define XK_Cyrillic_i 0x06c9 /* U+0438 CYRILLIC SMALL LETTER I */ #define XK_Cyrillic_shorti 0x06ca /* U+0439 CYRILLIC SMALL LETTER SHORT I */ #define XK_Cyrillic_ka 0x06cb /* U+043A CYRILLIC SMALL LETTER KA */ #define XK_Cyrillic_el 0x06cc /* U+043B CYRILLIC SMALL LETTER EL */ #define XK_Cyrillic_em 0x06cd /* U+043C CYRILLIC SMALL LETTER EM */ #define XK_Cyrillic_en 0x06ce /* U+043D CYRILLIC SMALL LETTER EN */ #define XK_Cyrillic_o 0x06cf /* U+043E CYRILLIC SMALL LETTER O */ #define XK_Cyrillic_pe 0x06d0 /* U+043F CYRILLIC SMALL LETTER PE */ #define XK_Cyrillic_ya 0x06d1 /* U+044F CYRILLIC SMALL LETTER YA */ #define XK_Cyrillic_er 0x06d2 /* U+0440 CYRILLIC SMALL LETTER ER */ #define XK_Cyrillic_es 0x06d3 /* U+0441 CYRILLIC SMALL LETTER ES */ #define XK_Cyrillic_te 0x06d4 /* U+0442 CYRILLIC SMALL LETTER TE */ #define XK_Cyrillic_u 0x06d5 /* U+0443 CYRILLIC SMALL LETTER U */ #define XK_Cyrillic_zhe 0x06d6 /* U+0436 CYRILLIC SMALL LETTER ZHE */ #define XK_Cyrillic_ve 0x06d7 /* U+0432 CYRILLIC SMALL LETTER VE */ #define XK_Cyrillic_softsign 0x06d8 /* U+044C CYRILLIC SMALL LETTER SOFT SIGN */ #define XK_Cyrillic_yeru 0x06d9 /* U+044B CYRILLIC SMALL LETTER YERU */ #define XK_Cyrillic_ze 0x06da /* U+0437 CYRILLIC SMALL LETTER ZE */ #define XK_Cyrillic_sha 0x06db /* U+0448 CYRILLIC SMALL LETTER SHA */ #define XK_Cyrillic_e 0x06dc /* U+044D CYRILLIC SMALL LETTER E */ #define XK_Cyrillic_shcha 0x06dd /* U+0449 CYRILLIC SMALL LETTER SHCHA */ #define XK_Cyrillic_che 0x06de /* U+0447 CYRILLIC SMALL LETTER CHE */ #define XK_Cyrillic_hardsign 0x06df /* U+044A CYRILLIC SMALL LETTER HARD SIGN */ #define XK_Cyrillic_YU 0x06e0 /* U+042E CYRILLIC CAPITAL LETTER YU */ #define XK_Cyrillic_A 0x06e1 /* U+0410 CYRILLIC CAPITAL LETTER A */ #define XK_Cyrillic_BE 0x06e2 /* U+0411 CYRILLIC CAPITAL LETTER BE */ #define XK_Cyrillic_TSE 0x06e3 /* U+0426 CYRILLIC CAPITAL LETTER TSE */ #define XK_Cyrillic_DE 0x06e4 /* U+0414 CYRILLIC CAPITAL LETTER DE */ #define XK_Cyrillic_IE 0x06e5 /* U+0415 CYRILLIC CAPITAL LETTER IE */ #define XK_Cyrillic_EF 0x06e6 /* U+0424 CYRILLIC CAPITAL LETTER EF */ #define XK_Cyrillic_GHE 0x06e7 /* U+0413 CYRILLIC CAPITAL LETTER GHE */ #define XK_Cyrillic_HA 0x06e8 /* U+0425 CYRILLIC CAPITAL LETTER HA */ #define XK_Cyrillic_I 0x06e9 /* U+0418 CYRILLIC CAPITAL LETTER I */ #define XK_Cyrillic_SHORTI 0x06ea /* U+0419 CYRILLIC CAPITAL LETTER SHORT I */ #define XK_Cyrillic_KA 0x06eb /* U+041A CYRILLIC CAPITAL LETTER KA */ #define XK_Cyrillic_EL 0x06ec /* U+041B CYRILLIC CAPITAL LETTER EL */ #define XK_Cyrillic_EM 0x06ed /* U+041C CYRILLIC CAPITAL LETTER EM */ #define XK_Cyrillic_EN 0x06ee /* U+041D CYRILLIC CAPITAL LETTER EN */ #define XK_Cyrillic_O 0x06ef /* U+041E CYRILLIC CAPITAL LETTER O */ #define XK_Cyrillic_PE 0x06f0 /* U+041F CYRILLIC CAPITAL LETTER PE */ #define XK_Cyrillic_YA 0x06f1 /* U+042F CYRILLIC CAPITAL LETTER YA */ #define XK_Cyrillic_ER 0x06f2 /* U+0420 CYRILLIC CAPITAL LETTER ER */ #define XK_Cyrillic_ES 0x06f3 /* U+0421 CYRILLIC CAPITAL LETTER ES */ #define XK_Cyrillic_TE 0x06f4 /* U+0422 CYRILLIC CAPITAL LETTER TE */ #define XK_Cyrillic_U 0x06f5 /* U+0423 CYRILLIC CAPITAL LETTER U */ #define XK_Cyrillic_ZHE 0x06f6 /* U+0416 CYRILLIC CAPITAL LETTER ZHE */ #define XK_Cyrillic_VE 0x06f7 /* U+0412 CYRILLIC CAPITAL LETTER VE */ #define XK_Cyrillic_SOFTSIGN 0x06f8 /* U+042C CYRILLIC CAPITAL LETTER SOFT SIGN */ #define XK_Cyrillic_YERU 0x06f9 /* U+042B CYRILLIC CAPITAL LETTER YERU */ #define XK_Cyrillic_ZE 0x06fa /* U+0417 CYRILLIC CAPITAL LETTER ZE */ #define XK_Cyrillic_SHA 0x06fb /* U+0428 CYRILLIC CAPITAL LETTER SHA */ #define XK_Cyrillic_E 0x06fc /* U+042D CYRILLIC CAPITAL LETTER E */ #define XK_Cyrillic_SHCHA 0x06fd /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */ #define XK_Cyrillic_CHE 0x06fe /* U+0427 CYRILLIC CAPITAL LETTER CHE */ #define XK_Cyrillic_HARDSIGN 0x06ff /* U+042A CYRILLIC CAPITAL LETTER HARD SIGN */ #endif /* XK_CYRILLIC */ /* * Greek * (based on an early draft of, and not quite identical to, ISO/IEC 8859-7) * Byte 3 = 7 */ #ifdef XK_GREEK #define XK_Greek_ALPHAaccent 0x07a1 /* U+0386 GREEK CAPITAL LETTER ALPHA WITH TONOS */ #define XK_Greek_EPSILONaccent 0x07a2 /* U+0388 GREEK CAPITAL LETTER EPSILON WITH TONOS */ #define XK_Greek_ETAaccent 0x07a3 /* U+0389 GREEK CAPITAL LETTER ETA WITH TONOS */ #define XK_Greek_IOTAaccent 0x07a4 /* U+038A GREEK CAPITAL LETTER IOTA WITH TONOS */ #define XK_Greek_IOTAdieresis 0x07a5 /* U+03AA GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */ #define XK_Greek_IOTAdiaeresis 0x07a5 /* old typo */ #define XK_Greek_OMICRONaccent 0x07a7 /* U+038C GREEK CAPITAL LETTER OMICRON WITH TONOS */ #define XK_Greek_UPSILONaccent 0x07a8 /* U+038E GREEK CAPITAL LETTER UPSILON WITH TONOS */ #define XK_Greek_UPSILONdieresis 0x07a9 /* U+03AB GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */ #define XK_Greek_OMEGAaccent 0x07ab /* U+038F GREEK CAPITAL LETTER OMEGA WITH TONOS */ #define XK_Greek_accentdieresis 0x07ae /* U+0385 GREEK DIALYTIKA TONOS */ #define XK_Greek_horizbar 0x07af /* U+2015 HORIZONTAL BAR */ #define XK_Greek_alphaaccent 0x07b1 /* U+03AC GREEK SMALL LETTER ALPHA WITH TONOS */ #define XK_Greek_epsilonaccent 0x07b2 /* U+03AD GREEK SMALL LETTER EPSILON WITH TONOS */ #define XK_Greek_etaaccent 0x07b3 /* U+03AE GREEK SMALL LETTER ETA WITH TONOS */ #define XK_Greek_iotaaccent 0x07b4 /* U+03AF GREEK SMALL LETTER IOTA WITH TONOS */ #define XK_Greek_iotadieresis 0x07b5 /* U+03CA GREEK SMALL LETTER IOTA WITH DIALYTIKA */ #define XK_Greek_iotaaccentdieresis 0x07b6 /* U+0390 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS */ #define XK_Greek_omicronaccent 0x07b7 /* U+03CC GREEK SMALL LETTER OMICRON WITH TONOS */ #define XK_Greek_upsilonaccent 0x07b8 /* U+03CD GREEK SMALL LETTER UPSILON WITH TONOS */ #define XK_Greek_upsilondieresis 0x07b9 /* U+03CB GREEK SMALL LETTER UPSILON WITH DIALYTIKA */ #define XK_Greek_upsilonaccentdieresis 0x07ba /* U+03B0 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS */ #define XK_Greek_omegaaccent 0x07bb /* U+03CE GREEK SMALL LETTER OMEGA WITH TONOS */ #define XK_Greek_ALPHA 0x07c1 /* U+0391 GREEK CAPITAL LETTER ALPHA */ #define XK_Greek_BETA 0x07c2 /* U+0392 GREEK CAPITAL LETTER BETA */ #define XK_Greek_GAMMA 0x07c3 /* U+0393 GREEK CAPITAL LETTER GAMMA */ #define XK_Greek_DELTA 0x07c4 /* U+0394 GREEK CAPITAL LETTER DELTA */ #define XK_Greek_EPSILON 0x07c5 /* U+0395 GREEK CAPITAL LETTER EPSILON */ #define XK_Greek_ZETA 0x07c6 /* U+0396 GREEK CAPITAL LETTER ZETA */ #define XK_Greek_ETA 0x07c7 /* U+0397 GREEK CAPITAL LETTER ETA */ #define XK_Greek_THETA 0x07c8 /* U+0398 GREEK CAPITAL LETTER THETA */ #define XK_Greek_IOTA 0x07c9 /* U+0399 GREEK CAPITAL LETTER IOTA */ #define XK_Greek_KAPPA 0x07ca /* U+039A GREEK CAPITAL LETTER KAPPA */ #define XK_Greek_LAMDA 0x07cb /* U+039B GREEK CAPITAL LETTER LAMDA */ #define XK_Greek_LAMBDA 0x07cb /* U+039B GREEK CAPITAL LETTER LAMDA */ #define XK_Greek_MU 0x07cc /* U+039C GREEK CAPITAL LETTER MU */ #define XK_Greek_NU 0x07cd /* U+039D GREEK CAPITAL LETTER NU */ #define XK_Greek_XI 0x07ce /* U+039E GREEK CAPITAL LETTER XI */ #define XK_Greek_OMICRON 0x07cf /* U+039F GREEK CAPITAL LETTER OMICRON */ #define XK_Greek_PI 0x07d0 /* U+03A0 GREEK CAPITAL LETTER PI */ #define XK_Greek_RHO 0x07d1 /* U+03A1 GREEK CAPITAL LETTER RHO */ #define XK_Greek_SIGMA 0x07d2 /* U+03A3 GREEK CAPITAL LETTER SIGMA */ #define XK_Greek_TAU 0x07d4 /* U+03A4 GREEK CAPITAL LETTER TAU */ #define XK_Greek_UPSILON 0x07d5 /* U+03A5 GREEK CAPITAL LETTER UPSILON */ #define XK_Greek_PHI 0x07d6 /* U+03A6 GREEK CAPITAL LETTER PHI */ #define XK_Greek_CHI 0x07d7 /* U+03A7 GREEK CAPITAL LETTER CHI */ #define XK_Greek_PSI 0x07d8 /* U+03A8 GREEK CAPITAL LETTER PSI */ #define XK_Greek_OMEGA 0x07d9 /* U+03A9 GREEK CAPITAL LETTER OMEGA */ #define XK_Greek_alpha 0x07e1 /* U+03B1 GREEK SMALL LETTER ALPHA */ #define XK_Greek_beta 0x07e2 /* U+03B2 GREEK SMALL LETTER BETA */ #define XK_Greek_gamma 0x07e3 /* U+03B3 GREEK SMALL LETTER GAMMA */ #define XK_Greek_delta 0x07e4 /* U+03B4 GREEK SMALL LETTER DELTA */ #define XK_Greek_epsilon 0x07e5 /* U+03B5 GREEK SMALL LETTER EPSILON */ #define XK_Greek_zeta 0x07e6 /* U+03B6 GREEK SMALL LETTER ZETA */ #define XK_Greek_eta 0x07e7 /* U+03B7 GREEK SMALL LETTER ETA */ #define XK_Greek_theta 0x07e8 /* U+03B8 GREEK SMALL LETTER THETA */ #define XK_Greek_iota 0x07e9 /* U+03B9 GREEK SMALL LETTER IOTA */ #define XK_Greek_kappa 0x07ea /* U+03BA GREEK SMALL LETTER KAPPA */ #define XK_Greek_lamda 0x07eb /* U+03BB GREEK SMALL LETTER LAMDA */ #define XK_Greek_lambda 0x07eb /* U+03BB GREEK SMALL LETTER LAMDA */ #define XK_Greek_mu 0x07ec /* U+03BC GREEK SMALL LETTER MU */ #define XK_Greek_nu 0x07ed /* U+03BD GREEK SMALL LETTER NU */ #define XK_Greek_xi 0x07ee /* U+03BE GREEK SMALL LETTER XI */ #define XK_Greek_omicron 0x07ef /* U+03BF GREEK SMALL LETTER OMICRON */ #define XK_Greek_pi 0x07f0 /* U+03C0 GREEK SMALL LETTER PI */ #define XK_Greek_rho 0x07f1 /* U+03C1 GREEK SMALL LETTER RHO */ #define XK_Greek_sigma 0x07f2 /* U+03C3 GREEK SMALL LETTER SIGMA */ #define XK_Greek_finalsmallsigma 0x07f3 /* U+03C2 GREEK SMALL LETTER FINAL SIGMA */ #define XK_Greek_tau 0x07f4 /* U+03C4 GREEK SMALL LETTER TAU */ #define XK_Greek_upsilon 0x07f5 /* U+03C5 GREEK SMALL LETTER UPSILON */ #define XK_Greek_phi 0x07f6 /* U+03C6 GREEK SMALL LETTER PHI */ #define XK_Greek_chi 0x07f7 /* U+03C7 GREEK SMALL LETTER CHI */ #define XK_Greek_psi 0x07f8 /* U+03C8 GREEK SMALL LETTER PSI */ #define XK_Greek_omega 0x07f9 /* U+03C9 GREEK SMALL LETTER OMEGA */ #define XK_Greek_switch 0xff7e /* Alias for mode_switch */ #endif /* XK_GREEK */ /* * Technical * (from the DEC VT330/VT420 Technical Character Set, http://vt100.net/charsets/technical.html) * Byte 3 = 8 */ #ifdef XK_TECHNICAL #define XK_leftradical 0x08a1 /* U+23B7 RADICAL SYMBOL BOTTOM */ #define XK_topleftradical 0x08a2 /*(U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT)*/ #define XK_horizconnector 0x08a3 /*(U+2500 BOX DRAWINGS LIGHT HORIZONTAL)*/ #define XK_topintegral 0x08a4 /* U+2320 TOP HALF INTEGRAL */ #define XK_botintegral 0x08a5 /* U+2321 BOTTOM HALF INTEGRAL */ #define XK_vertconnector 0x08a6 /*(U+2502 BOX DRAWINGS LIGHT VERTICAL)*/ #define XK_topleftsqbracket 0x08a7 /* U+23A1 LEFT SQUARE BRACKET UPPER CORNER */ #define XK_botleftsqbracket 0x08a8 /* U+23A3 LEFT SQUARE BRACKET LOWER CORNER */ #define XK_toprightsqbracket 0x08a9 /* U+23A4 RIGHT SQUARE BRACKET UPPER CORNER */ #define XK_botrightsqbracket 0x08aa /* U+23A6 RIGHT SQUARE BRACKET LOWER CORNER */ #define XK_topleftparens 0x08ab /* U+239B LEFT PARENTHESIS UPPER HOOK */ #define XK_botleftparens 0x08ac /* U+239D LEFT PARENTHESIS LOWER HOOK */ #define XK_toprightparens 0x08ad /* U+239E RIGHT PARENTHESIS UPPER HOOK */ #define XK_botrightparens 0x08ae /* U+23A0 RIGHT PARENTHESIS LOWER HOOK */ #define XK_leftmiddlecurlybrace 0x08af /* U+23A8 LEFT CURLY BRACKET MIDDLE PIECE */ #define XK_rightmiddlecurlybrace 0x08b0 /* U+23AC RIGHT CURLY BRACKET MIDDLE PIECE */ #define XK_topleftsummation 0x08b1 #define XK_botleftsummation 0x08b2 #define XK_topvertsummationconnector 0x08b3 #define XK_botvertsummationconnector 0x08b4 #define XK_toprightsummation 0x08b5 #define XK_botrightsummation 0x08b6 #define XK_rightmiddlesummation 0x08b7 #define XK_lessthanequal 0x08bc /* U+2264 LESS-THAN OR EQUAL TO */ #define XK_notequal 0x08bd /* U+2260 NOT EQUAL TO */ #define XK_greaterthanequal 0x08be /* U+2265 GREATER-THAN OR EQUAL TO */ #define XK_integral 0x08bf /* U+222B INTEGRAL */ #define XK_therefore 0x08c0 /* U+2234 THEREFORE */ #define XK_variation 0x08c1 /* U+221D PROPORTIONAL TO */ #define XK_infinity 0x08c2 /* U+221E INFINITY */ #define XK_nabla 0x08c5 /* U+2207 NABLA */ #define XK_approximate 0x08c8 /* U+223C TILDE OPERATOR */ #define XK_similarequal 0x08c9 /* U+2243 ASYMPTOTICALLY EQUAL TO */ #define XK_ifonlyif 0x08cd /* U+21D4 LEFT RIGHT DOUBLE ARROW */ #define XK_implies 0x08ce /* U+21D2 RIGHTWARDS DOUBLE ARROW */ #define XK_identical 0x08cf /* U+2261 IDENTICAL TO */ #define XK_radical 0x08d6 /* U+221A SQUARE ROOT */ #define XK_includedin 0x08da /* U+2282 SUBSET OF */ #define XK_includes 0x08db /* U+2283 SUPERSET OF */ #define XK_intersection 0x08dc /* U+2229 INTERSECTION */ #define XK_union 0x08dd /* U+222A UNION */ #define XK_logicaland 0x08de /* U+2227 LOGICAL AND */ #define XK_logicalor 0x08df /* U+2228 LOGICAL OR */ #define XK_partialderivative 0x08ef /* U+2202 PARTIAL DIFFERENTIAL */ #define XK_function 0x08f6 /* U+0192 LATIN SMALL LETTER F WITH HOOK */ #define XK_leftarrow 0x08fb /* U+2190 LEFTWARDS ARROW */ #define XK_uparrow 0x08fc /* U+2191 UPWARDS ARROW */ #define XK_rightarrow 0x08fd /* U+2192 RIGHTWARDS ARROW */ #define XK_downarrow 0x08fe /* U+2193 DOWNWARDS ARROW */ #endif /* XK_TECHNICAL */ /* * Special * (from the DEC VT100 Special Graphics Character Set) * Byte 3 = 9 */ #ifdef XK_SPECIAL #define XK_blank 0x09df #define XK_soliddiamond 0x09e0 /* U+25C6 BLACK DIAMOND */ #define XK_checkerboard 0x09e1 /* U+2592 MEDIUM SHADE */ #define XK_ht 0x09e2 /* U+2409 SYMBOL FOR HORIZONTAL TABULATION */ #define XK_ff 0x09e3 /* U+240C SYMBOL FOR FORM FEED */ #define XK_cr 0x09e4 /* U+240D SYMBOL FOR CARRIAGE RETURN */ #define XK_lf 0x09e5 /* U+240A SYMBOL FOR LINE FEED */ #define XK_nl 0x09e8 /* U+2424 SYMBOL FOR NEWLINE */ #define XK_vt 0x09e9 /* U+240B SYMBOL FOR VERTICAL TABULATION */ #define XK_lowrightcorner 0x09ea /* U+2518 BOX DRAWINGS LIGHT UP AND LEFT */ #define XK_uprightcorner 0x09eb /* U+2510 BOX DRAWINGS LIGHT DOWN AND LEFT */ #define XK_upleftcorner 0x09ec /* U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT */ #define XK_lowleftcorner 0x09ed /* U+2514 BOX DRAWINGS LIGHT UP AND RIGHT */ #define XK_crossinglines 0x09ee /* U+253C BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */ #define XK_horizlinescan1 0x09ef /* U+23BA HORIZONTAL SCAN LINE-1 */ #define XK_horizlinescan3 0x09f0 /* U+23BB HORIZONTAL SCAN LINE-3 */ #define XK_horizlinescan5 0x09f1 /* U+2500 BOX DRAWINGS LIGHT HORIZONTAL */ #define XK_horizlinescan7 0x09f2 /* U+23BC HORIZONTAL SCAN LINE-7 */ #define XK_horizlinescan9 0x09f3 /* U+23BD HORIZONTAL SCAN LINE-9 */ #define XK_leftt 0x09f4 /* U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT */ #define XK_rightt 0x09f5 /* U+2524 BOX DRAWINGS LIGHT VERTICAL AND LEFT */ #define XK_bott 0x09f6 /* U+2534 BOX DRAWINGS LIGHT UP AND HORIZONTAL */ #define XK_topt 0x09f7 /* U+252C BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */ #define XK_vertbar 0x09f8 /* U+2502 BOX DRAWINGS LIGHT VERTICAL */ #endif /* XK_SPECIAL */ /* * Publishing * (these are probably from a long forgotten DEC Publishing * font that once shipped with DECwrite) * Byte 3 = 0x0a */ #ifdef XK_PUBLISHING #define XK_emspace 0x0aa1 /* U+2003 EM SPACE */ #define XK_enspace 0x0aa2 /* U+2002 EN SPACE */ #define XK_em3space 0x0aa3 /* U+2004 THREE-PER-EM SPACE */ #define XK_em4space 0x0aa4 /* U+2005 FOUR-PER-EM SPACE */ #define XK_digitspace 0x0aa5 /* U+2007 FIGURE SPACE */ #define XK_punctspace 0x0aa6 /* U+2008 PUNCTUATION SPACE */ #define XK_thinspace 0x0aa7 /* U+2009 THIN SPACE */ #define XK_hairspace 0x0aa8 /* U+200A HAIR SPACE */ #define XK_emdash 0x0aa9 /* U+2014 EM DASH */ #define XK_endash 0x0aaa /* U+2013 EN DASH */ #define XK_signifblank 0x0aac /*(U+2423 OPEN BOX)*/ #define XK_ellipsis 0x0aae /* U+2026 HORIZONTAL ELLIPSIS */ #define XK_doubbaselinedot 0x0aaf /* U+2025 TWO DOT LEADER */ #define XK_onethird 0x0ab0 /* U+2153 VULGAR FRACTION ONE THIRD */ #define XK_twothirds 0x0ab1 /* U+2154 VULGAR FRACTION TWO THIRDS */ #define XK_onefifth 0x0ab2 /* U+2155 VULGAR FRACTION ONE FIFTH */ #define XK_twofifths 0x0ab3 /* U+2156 VULGAR FRACTION TWO FIFTHS */ #define XK_threefifths 0x0ab4 /* U+2157 VULGAR FRACTION THREE FIFTHS */ #define XK_fourfifths 0x0ab5 /* U+2158 VULGAR FRACTION FOUR FIFTHS */ #define XK_onesixth 0x0ab6 /* U+2159 VULGAR FRACTION ONE SIXTH */ #define XK_fivesixths 0x0ab7 /* U+215A VULGAR FRACTION FIVE SIXTHS */ #define XK_careof 0x0ab8 /* U+2105 CARE OF */ #define XK_figdash 0x0abb /* U+2012 FIGURE DASH */ #define XK_leftanglebracket 0x0abc /*(U+27E8 MATHEMATICAL LEFT ANGLE BRACKET)*/ #define XK_decimalpoint 0x0abd /*(U+002E FULL STOP)*/ #define XK_rightanglebracket 0x0abe /*(U+27E9 MATHEMATICAL RIGHT ANGLE BRACKET)*/ #define XK_marker 0x0abf #define XK_oneeighth 0x0ac3 /* U+215B VULGAR FRACTION ONE EIGHTH */ #define XK_threeeighths 0x0ac4 /* U+215C VULGAR FRACTION THREE EIGHTHS */ #define XK_fiveeighths 0x0ac5 /* U+215D VULGAR FRACTION FIVE EIGHTHS */ #define XK_seveneighths 0x0ac6 /* U+215E VULGAR FRACTION SEVEN EIGHTHS */ #define XK_trademark 0x0ac9 /* U+2122 TRADE MARK SIGN */ #define XK_signaturemark 0x0aca /*(U+2613 SALTIRE)*/ #define XK_trademarkincircle 0x0acb #define XK_leftopentriangle 0x0acc /*(U+25C1 WHITE LEFT-POINTING TRIANGLE)*/ #define XK_rightopentriangle 0x0acd /*(U+25B7 WHITE RIGHT-POINTING TRIANGLE)*/ #define XK_emopencircle 0x0ace /*(U+25CB WHITE CIRCLE)*/ #define XK_emopenrectangle 0x0acf /*(U+25AF WHITE VERTICAL RECTANGLE)*/ #define XK_leftsinglequotemark 0x0ad0 /* U+2018 LEFT SINGLE QUOTATION MARK */ #define XK_rightsinglequotemark 0x0ad1 /* U+2019 RIGHT SINGLE QUOTATION MARK */ #define XK_leftdoublequotemark 0x0ad2 /* U+201C LEFT DOUBLE QUOTATION MARK */ #define XK_rightdoublequotemark 0x0ad3 /* U+201D RIGHT DOUBLE QUOTATION MARK */ #define XK_prescription 0x0ad4 /* U+211E PRESCRIPTION TAKE */ #define XK_permille 0x0ad5 /* U+2030 PER MILLE SIGN */ #define XK_minutes 0x0ad6 /* U+2032 PRIME */ #define XK_seconds 0x0ad7 /* U+2033 DOUBLE PRIME */ #define XK_latincross 0x0ad9 /* U+271D LATIN CROSS */ #define XK_hexagram 0x0ada #define XK_filledrectbullet 0x0adb /*(U+25AC BLACK RECTANGLE)*/ #define XK_filledlefttribullet 0x0adc /*(U+25C0 BLACK LEFT-POINTING TRIANGLE)*/ #define XK_filledrighttribullet 0x0add /*(U+25B6 BLACK RIGHT-POINTING TRIANGLE)*/ #define XK_emfilledcircle 0x0ade /*(U+25CF BLACK CIRCLE)*/ #define XK_emfilledrect 0x0adf /*(U+25AE BLACK VERTICAL RECTANGLE)*/ #define XK_enopencircbullet 0x0ae0 /*(U+25E6 WHITE BULLET)*/ #define XK_enopensquarebullet 0x0ae1 /*(U+25AB WHITE SMALL SQUARE)*/ #define XK_openrectbullet 0x0ae2 /*(U+25AD WHITE RECTANGLE)*/ #define XK_opentribulletup 0x0ae3 /*(U+25B3 WHITE UP-POINTING TRIANGLE)*/ #define XK_opentribulletdown 0x0ae4 /*(U+25BD WHITE DOWN-POINTING TRIANGLE)*/ #define XK_openstar 0x0ae5 /*(U+2606 WHITE STAR)*/ #define XK_enfilledcircbullet 0x0ae6 /*(U+2022 BULLET)*/ #define XK_enfilledsqbullet 0x0ae7 /*(U+25AA BLACK SMALL SQUARE)*/ #define XK_filledtribulletup 0x0ae8 /*(U+25B2 BLACK UP-POINTING TRIANGLE)*/ #define XK_filledtribulletdown 0x0ae9 /*(U+25BC BLACK DOWN-POINTING TRIANGLE)*/ #define XK_leftpointer 0x0aea /*(U+261C WHITE LEFT POINTING INDEX)*/ #define XK_rightpointer 0x0aeb /*(U+261E WHITE RIGHT POINTING INDEX)*/ #define XK_club 0x0aec /* U+2663 BLACK CLUB SUIT */ #define XK_diamond 0x0aed /* U+2666 BLACK DIAMOND SUIT */ #define XK_heart 0x0aee /* U+2665 BLACK HEART SUIT */ #define XK_maltesecross 0x0af0 /* U+2720 MALTESE CROSS */ #define XK_dagger 0x0af1 /* U+2020 DAGGER */ #define XK_doubledagger 0x0af2 /* U+2021 DOUBLE DAGGER */ #define XK_checkmark 0x0af3 /* U+2713 CHECK MARK */ #define XK_ballotcross 0x0af4 /* U+2717 BALLOT X */ #define XK_musicalsharp 0x0af5 /* U+266F MUSIC SHARP SIGN */ #define XK_musicalflat 0x0af6 /* U+266D MUSIC FLAT SIGN */ #define XK_malesymbol 0x0af7 /* U+2642 MALE SIGN */ #define XK_femalesymbol 0x0af8 /* U+2640 FEMALE SIGN */ #define XK_telephone 0x0af9 /* U+260E BLACK TELEPHONE */ #define XK_telephonerecorder 0x0afa /* U+2315 TELEPHONE RECORDER */ #define XK_phonographcopyright 0x0afb /* U+2117 SOUND RECORDING COPYRIGHT */ #define XK_caret 0x0afc /* U+2038 CARET */ #define XK_singlelowquotemark 0x0afd /* U+201A SINGLE LOW-9 QUOTATION MARK */ #define XK_doublelowquotemark 0x0afe /* U+201E DOUBLE LOW-9 QUOTATION MARK */ #define XK_cursor 0x0aff #endif /* XK_PUBLISHING */ /* * APL * Byte 3 = 0x0b */ #ifdef XK_APL #define XK_leftcaret 0x0ba3 /*(U+003C LESS-THAN SIGN)*/ #define XK_rightcaret 0x0ba6 /*(U+003E GREATER-THAN SIGN)*/ #define XK_downcaret 0x0ba8 /*(U+2228 LOGICAL OR)*/ #define XK_upcaret 0x0ba9 /*(U+2227 LOGICAL AND)*/ #define XK_overbar 0x0bc0 /*(U+00AF MACRON)*/ #define XK_downtack 0x0bc2 /* U+22A4 DOWN TACK */ #define XK_upshoe 0x0bc3 /*(U+2229 INTERSECTION)*/ #define XK_downstile 0x0bc4 /* U+230A LEFT FLOOR */ #define XK_underbar 0x0bc6 /*(U+005F LOW LINE)*/ #define XK_jot 0x0bca /* U+2218 RING OPERATOR */ #define XK_quad 0x0bcc /* U+2395 APL FUNCTIONAL SYMBOL QUAD */ #define XK_uptack 0x0bce /* U+22A5 UP TACK */ #define XK_circle 0x0bcf /* U+25CB WHITE CIRCLE */ #define XK_upstile 0x0bd3 /* U+2308 LEFT CEILING */ #define XK_downshoe 0x0bd6 /*(U+222A UNION)*/ #define XK_rightshoe 0x0bd8 /*(U+2283 SUPERSET OF)*/ #define XK_leftshoe 0x0bda /*(U+2282 SUBSET OF)*/ #define XK_lefttack 0x0bdc /* U+22A3 LEFT TACK */ #define XK_righttack 0x0bfc /* U+22A2 RIGHT TACK */ #endif /* XK_APL */ /* * Hebrew * Byte 3 = 0x0c */ #ifdef XK_HEBREW #define XK_hebrew_doublelowline 0x0cdf /* U+2017 DOUBLE LOW LINE */ #define XK_hebrew_aleph 0x0ce0 /* U+05D0 HEBREW LETTER ALEF */ #define XK_hebrew_bet 0x0ce1 /* U+05D1 HEBREW LETTER BET */ #define XK_hebrew_beth 0x0ce1 /* deprecated */ #define XK_hebrew_gimel 0x0ce2 /* U+05D2 HEBREW LETTER GIMEL */ #define XK_hebrew_gimmel 0x0ce2 /* deprecated */ #define XK_hebrew_dalet 0x0ce3 /* U+05D3 HEBREW LETTER DALET */ #define XK_hebrew_daleth 0x0ce3 /* deprecated */ #define XK_hebrew_he 0x0ce4 /* U+05D4 HEBREW LETTER HE */ #define XK_hebrew_waw 0x0ce5 /* U+05D5 HEBREW LETTER VAV */ #define XK_hebrew_zain 0x0ce6 /* U+05D6 HEBREW LETTER ZAYIN */ #define XK_hebrew_zayin 0x0ce6 /* deprecated */ #define XK_hebrew_chet 0x0ce7 /* U+05D7 HEBREW LETTER HET */ #define XK_hebrew_het 0x0ce7 /* deprecated */ #define XK_hebrew_tet 0x0ce8 /* U+05D8 HEBREW LETTER TET */ #define XK_hebrew_teth 0x0ce8 /* deprecated */ #define XK_hebrew_yod 0x0ce9 /* U+05D9 HEBREW LETTER YOD */ #define XK_hebrew_finalkaph 0x0cea /* U+05DA HEBREW LETTER FINAL KAF */ #define XK_hebrew_kaph 0x0ceb /* U+05DB HEBREW LETTER KAF */ #define XK_hebrew_lamed 0x0cec /* U+05DC HEBREW LETTER LAMED */ #define XK_hebrew_finalmem 0x0ced /* U+05DD HEBREW LETTER FINAL MEM */ #define XK_hebrew_mem 0x0cee /* U+05DE HEBREW LETTER MEM */ #define XK_hebrew_finalnun 0x0cef /* U+05DF HEBREW LETTER FINAL NUN */ #define XK_hebrew_nun 0x0cf0 /* U+05E0 HEBREW LETTER NUN */ #define XK_hebrew_samech 0x0cf1 /* U+05E1 HEBREW LETTER SAMEKH */ #define XK_hebrew_samekh 0x0cf1 /* deprecated */ #define XK_hebrew_ayin 0x0cf2 /* U+05E2 HEBREW LETTER AYIN */ #define XK_hebrew_finalpe 0x0cf3 /* U+05E3 HEBREW LETTER FINAL PE */ #define XK_hebrew_pe 0x0cf4 /* U+05E4 HEBREW LETTER PE */ #define XK_hebrew_finalzade 0x0cf5 /* U+05E5 HEBREW LETTER FINAL TSADI */ #define XK_hebrew_finalzadi 0x0cf5 /* deprecated */ #define XK_hebrew_zade 0x0cf6 /* U+05E6 HEBREW LETTER TSADI */ #define XK_hebrew_zadi 0x0cf6 /* deprecated */ #define XK_hebrew_qoph 0x0cf7 /* U+05E7 HEBREW LETTER QOF */ #define XK_hebrew_kuf 0x0cf7 /* deprecated */ #define XK_hebrew_resh 0x0cf8 /* U+05E8 HEBREW LETTER RESH */ #define XK_hebrew_shin 0x0cf9 /* U+05E9 HEBREW LETTER SHIN */ #define XK_hebrew_taw 0x0cfa /* U+05EA HEBREW LETTER TAV */ #define XK_hebrew_taf 0x0cfa /* deprecated */ #define XK_Hebrew_switch 0xff7e /* Alias for mode_switch */ #endif /* XK_HEBREW */ /* * Thai * Byte 3 = 0x0d */ #ifdef XK_THAI #define XK_Thai_kokai 0x0da1 /* U+0E01 THAI CHARACTER KO KAI */ #define XK_Thai_khokhai 0x0da2 /* U+0E02 THAI CHARACTER KHO KHAI */ #define XK_Thai_khokhuat 0x0da3 /* U+0E03 THAI CHARACTER KHO KHUAT */ #define XK_Thai_khokhwai 0x0da4 /* U+0E04 THAI CHARACTER KHO KHWAI */ #define XK_Thai_khokhon 0x0da5 /* U+0E05 THAI CHARACTER KHO KHON */ #define XK_Thai_khorakhang 0x0da6 /* U+0E06 THAI CHARACTER KHO RAKHANG */ #define XK_Thai_ngongu 0x0da7 /* U+0E07 THAI CHARACTER NGO NGU */ #define XK_Thai_chochan 0x0da8 /* U+0E08 THAI CHARACTER CHO CHAN */ #define XK_Thai_choching 0x0da9 /* U+0E09 THAI CHARACTER CHO CHING */ #define XK_Thai_chochang 0x0daa /* U+0E0A THAI CHARACTER CHO CHANG */ #define XK_Thai_soso 0x0dab /* U+0E0B THAI CHARACTER SO SO */ #define XK_Thai_chochoe 0x0dac /* U+0E0C THAI CHARACTER CHO CHOE */ #define XK_Thai_yoying 0x0dad /* U+0E0D THAI CHARACTER YO YING */ #define XK_Thai_dochada 0x0dae /* U+0E0E THAI CHARACTER DO CHADA */ #define XK_Thai_topatak 0x0daf /* U+0E0F THAI CHARACTER TO PATAK */ #define XK_Thai_thothan 0x0db0 /* U+0E10 THAI CHARACTER THO THAN */ #define XK_Thai_thonangmontho 0x0db1 /* U+0E11 THAI CHARACTER THO NANGMONTHO */ #define XK_Thai_thophuthao 0x0db2 /* U+0E12 THAI CHARACTER THO PHUTHAO */ #define XK_Thai_nonen 0x0db3 /* U+0E13 THAI CHARACTER NO NEN */ #define XK_Thai_dodek 0x0db4 /* U+0E14 THAI CHARACTER DO DEK */ #define XK_Thai_totao 0x0db5 /* U+0E15 THAI CHARACTER TO TAO */ #define XK_Thai_thothung 0x0db6 /* U+0E16 THAI CHARACTER THO THUNG */ #define XK_Thai_thothahan 0x0db7 /* U+0E17 THAI CHARACTER THO THAHAN */ #define XK_Thai_thothong 0x0db8 /* U+0E18 THAI CHARACTER THO THONG */ #define XK_Thai_nonu 0x0db9 /* U+0E19 THAI CHARACTER NO NU */ #define XK_Thai_bobaimai 0x0dba /* U+0E1A THAI CHARACTER BO BAIMAI */ #define XK_Thai_popla 0x0dbb /* U+0E1B THAI CHARACTER PO PLA */ #define XK_Thai_phophung 0x0dbc /* U+0E1C THAI CHARACTER PHO PHUNG */ #define XK_Thai_fofa 0x0dbd /* U+0E1D THAI CHARACTER FO FA */ #define XK_Thai_phophan 0x0dbe /* U+0E1E THAI CHARACTER PHO PHAN */ #define XK_Thai_fofan 0x0dbf /* U+0E1F THAI CHARACTER FO FAN */ #define XK_Thai_phosamphao 0x0dc0 /* U+0E20 THAI CHARACTER PHO SAMPHAO */ #define XK_Thai_moma 0x0dc1 /* U+0E21 THAI CHARACTER MO MA */ #define XK_Thai_yoyak 0x0dc2 /* U+0E22 THAI CHARACTER YO YAK */ #define XK_Thai_rorua 0x0dc3 /* U+0E23 THAI CHARACTER RO RUA */ #define XK_Thai_ru 0x0dc4 /* U+0E24 THAI CHARACTER RU */ #define XK_Thai_loling 0x0dc5 /* U+0E25 THAI CHARACTER LO LING */ #define XK_Thai_lu 0x0dc6 /* U+0E26 THAI CHARACTER LU */ #define XK_Thai_wowaen 0x0dc7 /* U+0E27 THAI CHARACTER WO WAEN */ #define XK_Thai_sosala 0x0dc8 /* U+0E28 THAI CHARACTER SO SALA */ #define XK_Thai_sorusi 0x0dc9 /* U+0E29 THAI CHARACTER SO RUSI */ #define XK_Thai_sosua 0x0dca /* U+0E2A THAI CHARACTER SO SUA */ #define XK_Thai_hohip 0x0dcb /* U+0E2B THAI CHARACTER HO HIP */ #define XK_Thai_lochula 0x0dcc /* U+0E2C THAI CHARACTER LO CHULA */ #define XK_Thai_oang 0x0dcd /* U+0E2D THAI CHARACTER O ANG */ #define XK_Thai_honokhuk 0x0dce /* U+0E2E THAI CHARACTER HO NOKHUK */ #define XK_Thai_paiyannoi 0x0dcf /* U+0E2F THAI CHARACTER PAIYANNOI */ #define XK_Thai_saraa 0x0dd0 /* U+0E30 THAI CHARACTER SARA A */ #define XK_Thai_maihanakat 0x0dd1 /* U+0E31 THAI CHARACTER MAI HAN-AKAT */ #define XK_Thai_saraaa 0x0dd2 /* U+0E32 THAI CHARACTER SARA AA */ #define XK_Thai_saraam 0x0dd3 /* U+0E33 THAI CHARACTER SARA AM */ #define XK_Thai_sarai 0x0dd4 /* U+0E34 THAI CHARACTER SARA I */ #define XK_Thai_saraii 0x0dd5 /* U+0E35 THAI CHARACTER SARA II */ #define XK_Thai_saraue 0x0dd6 /* U+0E36 THAI CHARACTER SARA UE */ #define XK_Thai_sarauee 0x0dd7 /* U+0E37 THAI CHARACTER SARA UEE */ #define XK_Thai_sarau 0x0dd8 /* U+0E38 THAI CHARACTER SARA U */ #define XK_Thai_sarauu 0x0dd9 /* U+0E39 THAI CHARACTER SARA UU */ #define XK_Thai_phinthu 0x0dda /* U+0E3A THAI CHARACTER PHINTHU */ #define XK_Thai_maihanakat_maitho 0x0dde #define XK_Thai_baht 0x0ddf /* U+0E3F THAI CURRENCY SYMBOL BAHT */ #define XK_Thai_sarae 0x0de0 /* U+0E40 THAI CHARACTER SARA E */ #define XK_Thai_saraae 0x0de1 /* U+0E41 THAI CHARACTER SARA AE */ #define XK_Thai_sarao 0x0de2 /* U+0E42 THAI CHARACTER SARA O */ #define XK_Thai_saraaimaimuan 0x0de3 /* U+0E43 THAI CHARACTER SARA AI MAIMUAN */ #define XK_Thai_saraaimaimalai 0x0de4 /* U+0E44 THAI CHARACTER SARA AI MAIMALAI */ #define XK_Thai_lakkhangyao 0x0de5 /* U+0E45 THAI CHARACTER LAKKHANGYAO */ #define XK_Thai_maiyamok 0x0de6 /* U+0E46 THAI CHARACTER MAIYAMOK */ #define XK_Thai_maitaikhu 0x0de7 /* U+0E47 THAI CHARACTER MAITAIKHU */ #define XK_Thai_maiek 0x0de8 /* U+0E48 THAI CHARACTER MAI EK */ #define XK_Thai_maitho 0x0de9 /* U+0E49 THAI CHARACTER MAI THO */ #define XK_Thai_maitri 0x0dea /* U+0E4A THAI CHARACTER MAI TRI */ #define XK_Thai_maichattawa 0x0deb /* U+0E4B THAI CHARACTER MAI CHATTAWA */ #define XK_Thai_thanthakhat 0x0dec /* U+0E4C THAI CHARACTER THANTHAKHAT */ #define XK_Thai_nikhahit 0x0ded /* U+0E4D THAI CHARACTER NIKHAHIT */ #define XK_Thai_leksun 0x0df0 /* U+0E50 THAI DIGIT ZERO */ #define XK_Thai_leknung 0x0df1 /* U+0E51 THAI DIGIT ONE */ #define XK_Thai_leksong 0x0df2 /* U+0E52 THAI DIGIT TWO */ #define XK_Thai_leksam 0x0df3 /* U+0E53 THAI DIGIT THREE */ #define XK_Thai_leksi 0x0df4 /* U+0E54 THAI DIGIT FOUR */ #define XK_Thai_lekha 0x0df5 /* U+0E55 THAI DIGIT FIVE */ #define XK_Thai_lekhok 0x0df6 /* U+0E56 THAI DIGIT SIX */ #define XK_Thai_lekchet 0x0df7 /* U+0E57 THAI DIGIT SEVEN */ #define XK_Thai_lekpaet 0x0df8 /* U+0E58 THAI DIGIT EIGHT */ #define XK_Thai_lekkao 0x0df9 /* U+0E59 THAI DIGIT NINE */ #endif /* XK_THAI */ /* * Korean * Byte 3 = 0x0e */ #ifdef XK_KOREAN #define XK_Hangul 0xff31 /* Hangul start/stop(toggle) */ #define XK_Hangul_Start 0xff32 /* Hangul start */ #define XK_Hangul_End 0xff33 /* Hangul end, English start */ #define XK_Hangul_Hanja 0xff34 /* Start Hangul->Hanja Conversion */ #define XK_Hangul_Jamo 0xff35 /* Hangul Jamo mode */ #define XK_Hangul_Romaja 0xff36 /* Hangul Romaja mode */ #define XK_Hangul_Codeinput 0xff37 /* Hangul code input mode */ #define XK_Hangul_Jeonja 0xff38 /* Jeonja mode */ #define XK_Hangul_Banja 0xff39 /* Banja mode */ #define XK_Hangul_PreHanja 0xff3a /* Pre Hanja conversion */ #define XK_Hangul_PostHanja 0xff3b /* Post Hanja conversion */ #define XK_Hangul_SingleCandidate 0xff3c /* Single candidate */ #define XK_Hangul_MultipleCandidate 0xff3d /* Multiple candidate */ #define XK_Hangul_PreviousCandidate 0xff3e /* Previous candidate */ #define XK_Hangul_Special 0xff3f /* Special symbols */ #define XK_Hangul_switch 0xff7e /* Alias for mode_switch */ /* Hangul Consonant Characters */ #define XK_Hangul_Kiyeog 0x0ea1 #define XK_Hangul_SsangKiyeog 0x0ea2 #define XK_Hangul_KiyeogSios 0x0ea3 #define XK_Hangul_Nieun 0x0ea4 #define XK_Hangul_NieunJieuj 0x0ea5 #define XK_Hangul_NieunHieuh 0x0ea6 #define XK_Hangul_Dikeud 0x0ea7 #define XK_Hangul_SsangDikeud 0x0ea8 #define XK_Hangul_Rieul 0x0ea9 #define XK_Hangul_RieulKiyeog 0x0eaa #define XK_Hangul_RieulMieum 0x0eab #define XK_Hangul_RieulPieub 0x0eac #define XK_Hangul_RieulSios 0x0ead #define XK_Hangul_RieulTieut 0x0eae #define XK_Hangul_RieulPhieuf 0x0eaf #define XK_Hangul_RieulHieuh 0x0eb0 #define XK_Hangul_Mieum 0x0eb1 #define XK_Hangul_Pieub 0x0eb2 #define XK_Hangul_SsangPieub 0x0eb3 #define XK_Hangul_PieubSios 0x0eb4 #define XK_Hangul_Sios 0x0eb5 #define XK_Hangul_SsangSios 0x0eb6 #define XK_Hangul_Ieung 0x0eb7 #define XK_Hangul_Jieuj 0x0eb8 #define XK_Hangul_SsangJieuj 0x0eb9 #define XK_Hangul_Cieuc 0x0eba #define XK_Hangul_Khieuq 0x0ebb #define XK_Hangul_Tieut 0x0ebc #define XK_Hangul_Phieuf 0x0ebd #define XK_Hangul_Hieuh 0x0ebe /* Hangul Vowel Characters */ #define XK_Hangul_A 0x0ebf #define XK_Hangul_AE 0x0ec0 #define XK_Hangul_YA 0x0ec1 #define XK_Hangul_YAE 0x0ec2 #define XK_Hangul_EO 0x0ec3 #define XK_Hangul_E 0x0ec4 #define XK_Hangul_YEO 0x0ec5 #define XK_Hangul_YE 0x0ec6 #define XK_Hangul_O 0x0ec7 #define XK_Hangul_WA 0x0ec8 #define XK_Hangul_WAE 0x0ec9 #define XK_Hangul_OE 0x0eca #define XK_Hangul_YO 0x0ecb #define XK_Hangul_U 0x0ecc #define XK_Hangul_WEO 0x0ecd #define XK_Hangul_WE 0x0ece #define XK_Hangul_WI 0x0ecf #define XK_Hangul_YU 0x0ed0 #define XK_Hangul_EU 0x0ed1 #define XK_Hangul_YI 0x0ed2 #define XK_Hangul_I 0x0ed3 /* Hangul syllable-final (JongSeong) Characters */ #define XK_Hangul_J_Kiyeog 0x0ed4 #define XK_Hangul_J_SsangKiyeog 0x0ed5 #define XK_Hangul_J_KiyeogSios 0x0ed6 #define XK_Hangul_J_Nieun 0x0ed7 #define XK_Hangul_J_NieunJieuj 0x0ed8 #define XK_Hangul_J_NieunHieuh 0x0ed9 #define XK_Hangul_J_Dikeud 0x0eda #define XK_Hangul_J_Rieul 0x0edb #define XK_Hangul_J_RieulKiyeog 0x0edc #define XK_Hangul_J_RieulMieum 0x0edd #define XK_Hangul_J_RieulPieub 0x0ede #define XK_Hangul_J_RieulSios 0x0edf #define XK_Hangul_J_RieulTieut 0x0ee0 #define XK_Hangul_J_RieulPhieuf 0x0ee1 #define XK_Hangul_J_RieulHieuh 0x0ee2 #define XK_Hangul_J_Mieum 0x0ee3 #define XK_Hangul_J_Pieub 0x0ee4 #define XK_Hangul_J_PieubSios 0x0ee5 #define XK_Hangul_J_Sios 0x0ee6 #define XK_Hangul_J_SsangSios 0x0ee7 #define XK_Hangul_J_Ieung 0x0ee8 #define XK_Hangul_J_Jieuj 0x0ee9 #define XK_Hangul_J_Cieuc 0x0eea #define XK_Hangul_J_Khieuq 0x0eeb #define XK_Hangul_J_Tieut 0x0eec #define XK_Hangul_J_Phieuf 0x0eed #define XK_Hangul_J_Hieuh 0x0eee /* Ancient Hangul Consonant Characters */ #define XK_Hangul_RieulYeorinHieuh 0x0eef #define XK_Hangul_SunkyeongeumMieum 0x0ef0 #define XK_Hangul_SunkyeongeumPieub 0x0ef1 #define XK_Hangul_PanSios 0x0ef2 #define XK_Hangul_KkogjiDalrinIeung 0x0ef3 #define XK_Hangul_SunkyeongeumPhieuf 0x0ef4 #define XK_Hangul_YeorinHieuh 0x0ef5 /* Ancient Hangul Vowel Characters */ #define XK_Hangul_AraeA 0x0ef6 #define XK_Hangul_AraeAE 0x0ef7 /* Ancient Hangul syllable-final (JongSeong) Characters */ #define XK_Hangul_J_PanSios 0x0ef8 #define XK_Hangul_J_KkogjiDalrinIeung 0x0ef9 #define XK_Hangul_J_YeorinHieuh 0x0efa /* Korean currency symbol */ #define XK_Korean_Won 0x0eff /*(U+20A9 WON SIGN)*/ #endif /* XK_KOREAN */ /* * Armenian */ #ifdef XK_ARMENIAN #define XK_Armenian_ligature_ew 0x1000587 /* U+0587 ARMENIAN SMALL LIGATURE ECH YIWN */ #define XK_Armenian_full_stop 0x1000589 /* U+0589 ARMENIAN FULL STOP */ #define XK_Armenian_verjaket 0x1000589 /* U+0589 ARMENIAN FULL STOP */ #define XK_Armenian_separation_mark 0x100055d /* U+055D ARMENIAN COMMA */ #define XK_Armenian_but 0x100055d /* U+055D ARMENIAN COMMA */ #define XK_Armenian_hyphen 0x100058a /* U+058A ARMENIAN HYPHEN */ #define XK_Armenian_yentamna 0x100058a /* U+058A ARMENIAN HYPHEN */ #define XK_Armenian_exclam 0x100055c /* U+055C ARMENIAN EXCLAMATION MARK */ #define XK_Armenian_amanak 0x100055c /* U+055C ARMENIAN EXCLAMATION MARK */ #define XK_Armenian_accent 0x100055b /* U+055B ARMENIAN EMPHASIS MARK */ #define XK_Armenian_shesht 0x100055b /* U+055B ARMENIAN EMPHASIS MARK */ #define XK_Armenian_question 0x100055e /* U+055E ARMENIAN QUESTION MARK */ #define XK_Armenian_paruyk 0x100055e /* U+055E ARMENIAN QUESTION MARK */ #define XK_Armenian_AYB 0x1000531 /* U+0531 ARMENIAN CAPITAL LETTER AYB */ #define XK_Armenian_ayb 0x1000561 /* U+0561 ARMENIAN SMALL LETTER AYB */ #define XK_Armenian_BEN 0x1000532 /* U+0532 ARMENIAN CAPITAL LETTER BEN */ #define XK_Armenian_ben 0x1000562 /* U+0562 ARMENIAN SMALL LETTER BEN */ #define XK_Armenian_GIM 0x1000533 /* U+0533 ARMENIAN CAPITAL LETTER GIM */ #define XK_Armenian_gim 0x1000563 /* U+0563 ARMENIAN SMALL LETTER GIM */ #define XK_Armenian_DA 0x1000534 /* U+0534 ARMENIAN CAPITAL LETTER DA */ #define XK_Armenian_da 0x1000564 /* U+0564 ARMENIAN SMALL LETTER DA */ #define XK_Armenian_YECH 0x1000535 /* U+0535 ARMENIAN CAPITAL LETTER ECH */ #define XK_Armenian_yech 0x1000565 /* U+0565 ARMENIAN SMALL LETTER ECH */ #define XK_Armenian_ZA 0x1000536 /* U+0536 ARMENIAN CAPITAL LETTER ZA */ #define XK_Armenian_za 0x1000566 /* U+0566 ARMENIAN SMALL LETTER ZA */ #define XK_Armenian_E 0x1000537 /* U+0537 ARMENIAN CAPITAL LETTER EH */ #define XK_Armenian_e 0x1000567 /* U+0567 ARMENIAN SMALL LETTER EH */ #define XK_Armenian_AT 0x1000538 /* U+0538 ARMENIAN CAPITAL LETTER ET */ #define XK_Armenian_at 0x1000568 /* U+0568 ARMENIAN SMALL LETTER ET */ #define XK_Armenian_TO 0x1000539 /* U+0539 ARMENIAN CAPITAL LETTER TO */ #define XK_Armenian_to 0x1000569 /* U+0569 ARMENIAN SMALL LETTER TO */ #define XK_Armenian_ZHE 0x100053a /* U+053A ARMENIAN CAPITAL LETTER ZHE */ #define XK_Armenian_zhe 0x100056a /* U+056A ARMENIAN SMALL LETTER ZHE */ #define XK_Armenian_INI 0x100053b /* U+053B ARMENIAN CAPITAL LETTER INI */ #define XK_Armenian_ini 0x100056b /* U+056B ARMENIAN SMALL LETTER INI */ #define XK_Armenian_LYUN 0x100053c /* U+053C ARMENIAN CAPITAL LETTER LIWN */ #define XK_Armenian_lyun 0x100056c /* U+056C ARMENIAN SMALL LETTER LIWN */ #define XK_Armenian_KHE 0x100053d /* U+053D ARMENIAN CAPITAL LETTER XEH */ #define XK_Armenian_khe 0x100056d /* U+056D ARMENIAN SMALL LETTER XEH */ #define XK_Armenian_TSA 0x100053e /* U+053E ARMENIAN CAPITAL LETTER CA */ #define XK_Armenian_tsa 0x100056e /* U+056E ARMENIAN SMALL LETTER CA */ #define XK_Armenian_KEN 0x100053f /* U+053F ARMENIAN CAPITAL LETTER KEN */ #define XK_Armenian_ken 0x100056f /* U+056F ARMENIAN SMALL LETTER KEN */ #define XK_Armenian_HO 0x1000540 /* U+0540 ARMENIAN CAPITAL LETTER HO */ #define XK_Armenian_ho 0x1000570 /* U+0570 ARMENIAN SMALL LETTER HO */ #define XK_Armenian_DZA 0x1000541 /* U+0541 ARMENIAN CAPITAL LETTER JA */ #define XK_Armenian_dza 0x1000571 /* U+0571 ARMENIAN SMALL LETTER JA */ #define XK_Armenian_GHAT 0x1000542 /* U+0542 ARMENIAN CAPITAL LETTER GHAD */ #define XK_Armenian_ghat 0x1000572 /* U+0572 ARMENIAN SMALL LETTER GHAD */ #define XK_Armenian_TCHE 0x1000543 /* U+0543 ARMENIAN CAPITAL LETTER CHEH */ #define XK_Armenian_tche 0x1000573 /* U+0573 ARMENIAN SMALL LETTER CHEH */ #define XK_Armenian_MEN 0x1000544 /* U+0544 ARMENIAN CAPITAL LETTER MEN */ #define XK_Armenian_men 0x1000574 /* U+0574 ARMENIAN SMALL LETTER MEN */ #define XK_Armenian_HI 0x1000545 /* U+0545 ARMENIAN CAPITAL LETTER YI */ #define XK_Armenian_hi 0x1000575 /* U+0575 ARMENIAN SMALL LETTER YI */ #define XK_Armenian_NU 0x1000546 /* U+0546 ARMENIAN CAPITAL LETTER NOW */ #define XK_Armenian_nu 0x1000576 /* U+0576 ARMENIAN SMALL LETTER NOW */ #define XK_Armenian_SHA 0x1000547 /* U+0547 ARMENIAN CAPITAL LETTER SHA */ #define XK_Armenian_sha 0x1000577 /* U+0577 ARMENIAN SMALL LETTER SHA */ #define XK_Armenian_VO 0x1000548 /* U+0548 ARMENIAN CAPITAL LETTER VO */ #define XK_Armenian_vo 0x1000578 /* U+0578 ARMENIAN SMALL LETTER VO */ #define XK_Armenian_CHA 0x1000549 /* U+0549 ARMENIAN CAPITAL LETTER CHA */ #define XK_Armenian_cha 0x1000579 /* U+0579 ARMENIAN SMALL LETTER CHA */ #define XK_Armenian_PE 0x100054a /* U+054A ARMENIAN CAPITAL LETTER PEH */ #define XK_Armenian_pe 0x100057a /* U+057A ARMENIAN SMALL LETTER PEH */ #define XK_Armenian_JE 0x100054b /* U+054B ARMENIAN CAPITAL LETTER JHEH */ #define XK_Armenian_je 0x100057b /* U+057B ARMENIAN SMALL LETTER JHEH */ #define XK_Armenian_RA 0x100054c /* U+054C ARMENIAN CAPITAL LETTER RA */ #define XK_Armenian_ra 0x100057c /* U+057C ARMENIAN SMALL LETTER RA */ #define XK_Armenian_SE 0x100054d /* U+054D ARMENIAN CAPITAL LETTER SEH */ #define XK_Armenian_se 0x100057d /* U+057D ARMENIAN SMALL LETTER SEH */ #define XK_Armenian_VEV 0x100054e /* U+054E ARMENIAN CAPITAL LETTER VEW */ #define XK_Armenian_vev 0x100057e /* U+057E ARMENIAN SMALL LETTER VEW */ #define XK_Armenian_TYUN 0x100054f /* U+054F ARMENIAN CAPITAL LETTER TIWN */ #define XK_Armenian_tyun 0x100057f /* U+057F ARMENIAN SMALL LETTER TIWN */ #define XK_Armenian_RE 0x1000550 /* U+0550 ARMENIAN CAPITAL LETTER REH */ #define XK_Armenian_re 0x1000580 /* U+0580 ARMENIAN SMALL LETTER REH */ #define XK_Armenian_TSO 0x1000551 /* U+0551 ARMENIAN CAPITAL LETTER CO */ #define XK_Armenian_tso 0x1000581 /* U+0581 ARMENIAN SMALL LETTER CO */ #define XK_Armenian_VYUN 0x1000552 /* U+0552 ARMENIAN CAPITAL LETTER YIWN */ #define XK_Armenian_vyun 0x1000582 /* U+0582 ARMENIAN SMALL LETTER YIWN */ #define XK_Armenian_PYUR 0x1000553 /* U+0553 ARMENIAN CAPITAL LETTER PIWR */ #define XK_Armenian_pyur 0x1000583 /* U+0583 ARMENIAN SMALL LETTER PIWR */ #define XK_Armenian_KE 0x1000554 /* U+0554 ARMENIAN CAPITAL LETTER KEH */ #define XK_Armenian_ke 0x1000584 /* U+0584 ARMENIAN SMALL LETTER KEH */ #define XK_Armenian_O 0x1000555 /* U+0555 ARMENIAN CAPITAL LETTER OH */ #define XK_Armenian_o 0x1000585 /* U+0585 ARMENIAN SMALL LETTER OH */ #define XK_Armenian_FE 0x1000556 /* U+0556 ARMENIAN CAPITAL LETTER FEH */ #define XK_Armenian_fe 0x1000586 /* U+0586 ARMENIAN SMALL LETTER FEH */ #define XK_Armenian_apostrophe 0x100055a /* U+055A ARMENIAN APOSTROPHE */ #endif /* XK_ARMENIAN */ /* * Georgian */ #ifdef XK_GEORGIAN #define XK_Georgian_an 0x10010d0 /* U+10D0 GEORGIAN LETTER AN */ #define XK_Georgian_ban 0x10010d1 /* U+10D1 GEORGIAN LETTER BAN */ #define XK_Georgian_gan 0x10010d2 /* U+10D2 GEORGIAN LETTER GAN */ #define XK_Georgian_don 0x10010d3 /* U+10D3 GEORGIAN LETTER DON */ #define XK_Georgian_en 0x10010d4 /* U+10D4 GEORGIAN LETTER EN */ #define XK_Georgian_vin 0x10010d5 /* U+10D5 GEORGIAN LETTER VIN */ #define XK_Georgian_zen 0x10010d6 /* U+10D6 GEORGIAN LETTER ZEN */ #define XK_Georgian_tan 0x10010d7 /* U+10D7 GEORGIAN LETTER TAN */ #define XK_Georgian_in 0x10010d8 /* U+10D8 GEORGIAN LETTER IN */ #define XK_Georgian_kan 0x10010d9 /* U+10D9 GEORGIAN LETTER KAN */ #define XK_Georgian_las 0x10010da /* U+10DA GEORGIAN LETTER LAS */ #define XK_Georgian_man 0x10010db /* U+10DB GEORGIAN LETTER MAN */ #define XK_Georgian_nar 0x10010dc /* U+10DC GEORGIAN LETTER NAR */ #define XK_Georgian_on 0x10010dd /* U+10DD GEORGIAN LETTER ON */ #define XK_Georgian_par 0x10010de /* U+10DE GEORGIAN LETTER PAR */ #define XK_Georgian_zhar 0x10010df /* U+10DF GEORGIAN LETTER ZHAR */ #define XK_Georgian_rae 0x10010e0 /* U+10E0 GEORGIAN LETTER RAE */ #define XK_Georgian_san 0x10010e1 /* U+10E1 GEORGIAN LETTER SAN */ #define XK_Georgian_tar 0x10010e2 /* U+10E2 GEORGIAN LETTER TAR */ #define XK_Georgian_un 0x10010e3 /* U+10E3 GEORGIAN LETTER UN */ #define XK_Georgian_phar 0x10010e4 /* U+10E4 GEORGIAN LETTER PHAR */ #define XK_Georgian_khar 0x10010e5 /* U+10E5 GEORGIAN LETTER KHAR */ #define XK_Georgian_ghan 0x10010e6 /* U+10E6 GEORGIAN LETTER GHAN */ #define XK_Georgian_qar 0x10010e7 /* U+10E7 GEORGIAN LETTER QAR */ #define XK_Georgian_shin 0x10010e8 /* U+10E8 GEORGIAN LETTER SHIN */ #define XK_Georgian_chin 0x10010e9 /* U+10E9 GEORGIAN LETTER CHIN */ #define XK_Georgian_can 0x10010ea /* U+10EA GEORGIAN LETTER CAN */ #define XK_Georgian_jil 0x10010eb /* U+10EB GEORGIAN LETTER JIL */ #define XK_Georgian_cil 0x10010ec /* U+10EC GEORGIAN LETTER CIL */ #define XK_Georgian_char 0x10010ed /* U+10ED GEORGIAN LETTER CHAR */ #define XK_Georgian_xan 0x10010ee /* U+10EE GEORGIAN LETTER XAN */ #define XK_Georgian_jhan 0x10010ef /* U+10EF GEORGIAN LETTER JHAN */ #define XK_Georgian_hae 0x10010f0 /* U+10F0 GEORGIAN LETTER HAE */ #define XK_Georgian_he 0x10010f1 /* U+10F1 GEORGIAN LETTER HE */ #define XK_Georgian_hie 0x10010f2 /* U+10F2 GEORGIAN LETTER HIE */ #define XK_Georgian_we 0x10010f3 /* U+10F3 GEORGIAN LETTER WE */ #define XK_Georgian_har 0x10010f4 /* U+10F4 GEORGIAN LETTER HAR */ #define XK_Georgian_hoe 0x10010f5 /* U+10F5 GEORGIAN LETTER HOE */ #define XK_Georgian_fi 0x10010f6 /* U+10F6 GEORGIAN LETTER FI */ #endif /* XK_GEORGIAN */ /* * Azeri (and other Turkic or Caucasian languages) */ #ifdef XK_CAUCASUS /* latin */ #define XK_Xabovedot 0x1001e8a /* U+1E8A LATIN CAPITAL LETTER X WITH DOT ABOVE */ #define XK_Ibreve 0x100012c /* U+012C LATIN CAPITAL LETTER I WITH BREVE */ #define XK_Zstroke 0x10001b5 /* U+01B5 LATIN CAPITAL LETTER Z WITH STROKE */ #define XK_Gcaron 0x10001e6 /* U+01E6 LATIN CAPITAL LETTER G WITH CARON */ #define XK_Ocaron 0x10001d1 /* U+01D2 LATIN CAPITAL LETTER O WITH CARON */ #define XK_Obarred 0x100019f /* U+019F LATIN CAPITAL LETTER O WITH MIDDLE TILDE */ #define XK_xabovedot 0x1001e8b /* U+1E8B LATIN SMALL LETTER X WITH DOT ABOVE */ #define XK_ibreve 0x100012d /* U+012D LATIN SMALL LETTER I WITH BREVE */ #define XK_zstroke 0x10001b6 /* U+01B6 LATIN SMALL LETTER Z WITH STROKE */ #define XK_gcaron 0x10001e7 /* U+01E7 LATIN SMALL LETTER G WITH CARON */ #define XK_ocaron 0x10001d2 /* U+01D2 LATIN SMALL LETTER O WITH CARON */ #define XK_obarred 0x1000275 /* U+0275 LATIN SMALL LETTER BARRED O */ #define XK_SCHWA 0x100018f /* U+018F LATIN CAPITAL LETTER SCHWA */ #define XK_schwa 0x1000259 /* U+0259 LATIN SMALL LETTER SCHWA */ #define XK_EZH 0x10001b7 /* U+01B7 LATIN CAPITAL LETTER EZH */ #define XK_ezh 0x1000292 /* U+0292 LATIN SMALL LETTER EZH */ /* those are not really Caucasus */ /* For Inupiak */ #define XK_Lbelowdot 0x1001e36 /* U+1E36 LATIN CAPITAL LETTER L WITH DOT BELOW */ #define XK_lbelowdot 0x1001e37 /* U+1E37 LATIN SMALL LETTER L WITH DOT BELOW */ #endif /* XK_CAUCASUS */ /* * Vietnamese */ #ifdef XK_VIETNAMESE #define XK_Abelowdot 0x1001ea0 /* U+1EA0 LATIN CAPITAL LETTER A WITH DOT BELOW */ #define XK_abelowdot 0x1001ea1 /* U+1EA1 LATIN SMALL LETTER A WITH DOT BELOW */ #define XK_Ahook 0x1001ea2 /* U+1EA2 LATIN CAPITAL LETTER A WITH HOOK ABOVE */ #define XK_ahook 0x1001ea3 /* U+1EA3 LATIN SMALL LETTER A WITH HOOK ABOVE */ #define XK_Acircumflexacute 0x1001ea4 /* U+1EA4 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE */ #define XK_acircumflexacute 0x1001ea5 /* U+1EA5 LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE */ #define XK_Acircumflexgrave 0x1001ea6 /* U+1EA6 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE */ #define XK_acircumflexgrave 0x1001ea7 /* U+1EA7 LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE */ #define XK_Acircumflexhook 0x1001ea8 /* U+1EA8 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */ #define XK_acircumflexhook 0x1001ea9 /* U+1EA9 LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */ #define XK_Acircumflextilde 0x1001eaa /* U+1EAA LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE */ #define XK_acircumflextilde 0x1001eab /* U+1EAB LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE */ #define XK_Acircumflexbelowdot 0x1001eac /* U+1EAC LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW */ #define XK_acircumflexbelowdot 0x1001ead /* U+1EAD LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW */ #define XK_Abreveacute 0x1001eae /* U+1EAE LATIN CAPITAL LETTER A WITH BREVE AND ACUTE */ #define XK_abreveacute 0x1001eaf /* U+1EAF LATIN SMALL LETTER A WITH BREVE AND ACUTE */ #define XK_Abrevegrave 0x1001eb0 /* U+1EB0 LATIN CAPITAL LETTER A WITH BREVE AND GRAVE */ #define XK_abrevegrave 0x1001eb1 /* U+1EB1 LATIN SMALL LETTER A WITH BREVE AND GRAVE */ #define XK_Abrevehook 0x1001eb2 /* U+1EB2 LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE */ #define XK_abrevehook 0x1001eb3 /* U+1EB3 LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE */ #define XK_Abrevetilde 0x1001eb4 /* U+1EB4 LATIN CAPITAL LETTER A WITH BREVE AND TILDE */ #define XK_abrevetilde 0x1001eb5 /* U+1EB5 LATIN SMALL LETTER A WITH BREVE AND TILDE */ #define XK_Abrevebelowdot 0x1001eb6 /* U+1EB6 LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW */ #define XK_abrevebelowdot 0x1001eb7 /* U+1EB7 LATIN SMALL LETTER A WITH BREVE AND DOT BELOW */ #define XK_Ebelowdot 0x1001eb8 /* U+1EB8 LATIN CAPITAL LETTER E WITH DOT BELOW */ #define XK_ebelowdot 0x1001eb9 /* U+1EB9 LATIN SMALL LETTER E WITH DOT BELOW */ #define XK_Ehook 0x1001eba /* U+1EBA LATIN CAPITAL LETTER E WITH HOOK ABOVE */ #define XK_ehook 0x1001ebb /* U+1EBB LATIN SMALL LETTER E WITH HOOK ABOVE */ #define XK_Etilde 0x1001ebc /* U+1EBC LATIN CAPITAL LETTER E WITH TILDE */ #define XK_etilde 0x1001ebd /* U+1EBD LATIN SMALL LETTER E WITH TILDE */ #define XK_Ecircumflexacute 0x1001ebe /* U+1EBE LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE */ #define XK_ecircumflexacute 0x1001ebf /* U+1EBF LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE */ #define XK_Ecircumflexgrave 0x1001ec0 /* U+1EC0 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE */ #define XK_ecircumflexgrave 0x1001ec1 /* U+1EC1 LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE */ #define XK_Ecircumflexhook 0x1001ec2 /* U+1EC2 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */ #define XK_ecircumflexhook 0x1001ec3 /* U+1EC3 LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */ #define XK_Ecircumflextilde 0x1001ec4 /* U+1EC4 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE */ #define XK_ecircumflextilde 0x1001ec5 /* U+1EC5 LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE */ #define XK_Ecircumflexbelowdot 0x1001ec6 /* U+1EC6 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW */ #define XK_ecircumflexbelowdot 0x1001ec7 /* U+1EC7 LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW */ #define XK_Ihook 0x1001ec8 /* U+1EC8 LATIN CAPITAL LETTER I WITH HOOK ABOVE */ #define XK_ihook 0x1001ec9 /* U+1EC9 LATIN SMALL LETTER I WITH HOOK ABOVE */ #define XK_Ibelowdot 0x1001eca /* U+1ECA LATIN CAPITAL LETTER I WITH DOT BELOW */ #define XK_ibelowdot 0x1001ecb /* U+1ECB LATIN SMALL LETTER I WITH DOT BELOW */ #define XK_Obelowdot 0x1001ecc /* U+1ECC LATIN CAPITAL LETTER O WITH DOT BELOW */ #define XK_obelowdot 0x1001ecd /* U+1ECD LATIN SMALL LETTER O WITH DOT BELOW */ #define XK_Ohook 0x1001ece /* U+1ECE LATIN CAPITAL LETTER O WITH HOOK ABOVE */ #define XK_ohook 0x1001ecf /* U+1ECF LATIN SMALL LETTER O WITH HOOK ABOVE */ #define XK_Ocircumflexacute 0x1001ed0 /* U+1ED0 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE */ #define XK_ocircumflexacute 0x1001ed1 /* U+1ED1 LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE */ #define XK_Ocircumflexgrave 0x1001ed2 /* U+1ED2 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE */ #define XK_ocircumflexgrave 0x1001ed3 /* U+1ED3 LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE */ #define XK_Ocircumflexhook 0x1001ed4 /* U+1ED4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */ #define XK_ocircumflexhook 0x1001ed5 /* U+1ED5 LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */ #define XK_Ocircumflextilde 0x1001ed6 /* U+1ED6 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE */ #define XK_ocircumflextilde 0x1001ed7 /* U+1ED7 LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE */ #define XK_Ocircumflexbelowdot 0x1001ed8 /* U+1ED8 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW */ #define XK_ocircumflexbelowdot 0x1001ed9 /* U+1ED9 LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW */ #define XK_Ohornacute 0x1001eda /* U+1EDA LATIN CAPITAL LETTER O WITH HORN AND ACUTE */ #define XK_ohornacute 0x1001edb /* U+1EDB LATIN SMALL LETTER O WITH HORN AND ACUTE */ #define XK_Ohorngrave 0x1001edc /* U+1EDC LATIN CAPITAL LETTER O WITH HORN AND GRAVE */ #define XK_ohorngrave 0x1001edd /* U+1EDD LATIN SMALL LETTER O WITH HORN AND GRAVE */ #define XK_Ohornhook 0x1001ede /* U+1EDE LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE */ #define XK_ohornhook 0x1001edf /* U+1EDF LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE */ #define XK_Ohorntilde 0x1001ee0 /* U+1EE0 LATIN CAPITAL LETTER O WITH HORN AND TILDE */ #define XK_ohorntilde 0x1001ee1 /* U+1EE1 LATIN SMALL LETTER O WITH HORN AND TILDE */ #define XK_Ohornbelowdot 0x1001ee2 /* U+1EE2 LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW */ #define XK_ohornbelowdot 0x1001ee3 /* U+1EE3 LATIN SMALL LETTER O WITH HORN AND DOT BELOW */ #define XK_Ubelowdot 0x1001ee4 /* U+1EE4 LATIN CAPITAL LETTER U WITH DOT BELOW */ #define XK_ubelowdot 0x1001ee5 /* U+1EE5 LATIN SMALL LETTER U WITH DOT BELOW */ #define XK_Uhook 0x1001ee6 /* U+1EE6 LATIN CAPITAL LETTER U WITH HOOK ABOVE */ #define XK_uhook 0x1001ee7 /* U+1EE7 LATIN SMALL LETTER U WITH HOOK ABOVE */ #define XK_Uhornacute 0x1001ee8 /* U+1EE8 LATIN CAPITAL LETTER U WITH HORN AND ACUTE */ #define XK_uhornacute 0x1001ee9 /* U+1EE9 LATIN SMALL LETTER U WITH HORN AND ACUTE */ #define XK_Uhorngrave 0x1001eea /* U+1EEA LATIN CAPITAL LETTER U WITH HORN AND GRAVE */ #define XK_uhorngrave 0x1001eeb /* U+1EEB LATIN SMALL LETTER U WITH HORN AND GRAVE */ #define XK_Uhornhook 0x1001eec /* U+1EEC LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE */ #define XK_uhornhook 0x1001eed /* U+1EED LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE */ #define XK_Uhorntilde 0x1001eee /* U+1EEE LATIN CAPITAL LETTER U WITH HORN AND TILDE */ #define XK_uhorntilde 0x1001eef /* U+1EEF LATIN SMALL LETTER U WITH HORN AND TILDE */ #define XK_Uhornbelowdot 0x1001ef0 /* U+1EF0 LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW */ #define XK_uhornbelowdot 0x1001ef1 /* U+1EF1 LATIN SMALL LETTER U WITH HORN AND DOT BELOW */ #define XK_Ybelowdot 0x1001ef4 /* U+1EF4 LATIN CAPITAL LETTER Y WITH DOT BELOW */ #define XK_ybelowdot 0x1001ef5 /* U+1EF5 LATIN SMALL LETTER Y WITH DOT BELOW */ #define XK_Yhook 0x1001ef6 /* U+1EF6 LATIN CAPITAL LETTER Y WITH HOOK ABOVE */ #define XK_yhook 0x1001ef7 /* U+1EF7 LATIN SMALL LETTER Y WITH HOOK ABOVE */ #define XK_Ytilde 0x1001ef8 /* U+1EF8 LATIN CAPITAL LETTER Y WITH TILDE */ #define XK_ytilde 0x1001ef9 /* U+1EF9 LATIN SMALL LETTER Y WITH TILDE */ #define XK_Ohorn 0x10001a0 /* U+01A0 LATIN CAPITAL LETTER O WITH HORN */ #define XK_ohorn 0x10001a1 /* U+01A1 LATIN SMALL LETTER O WITH HORN */ #define XK_Uhorn 0x10001af /* U+01AF LATIN CAPITAL LETTER U WITH HORN */ #define XK_uhorn 0x10001b0 /* U+01B0 LATIN SMALL LETTER U WITH HORN */ #endif /* XK_VIETNAMESE */ #ifdef XK_CURRENCY #define XK_EcuSign 0x10020a0 /* U+20A0 EURO-CURRENCY SIGN */ #define XK_ColonSign 0x10020a1 /* U+20A1 COLON SIGN */ #define XK_CruzeiroSign 0x10020a2 /* U+20A2 CRUZEIRO SIGN */ #define XK_FFrancSign 0x10020a3 /* U+20A3 FRENCH FRANC SIGN */ #define XK_LiraSign 0x10020a4 /* U+20A4 LIRA SIGN */ #define XK_MillSign 0x10020a5 /* U+20A5 MILL SIGN */ #define XK_NairaSign 0x10020a6 /* U+20A6 NAIRA SIGN */ #define XK_PesetaSign 0x10020a7 /* U+20A7 PESETA SIGN */ #define XK_RupeeSign 0x10020a8 /* U+20A8 RUPEE SIGN */ #define XK_WonSign 0x10020a9 /* U+20A9 WON SIGN */ #define XK_NewSheqelSign 0x10020aa /* U+20AA NEW SHEQEL SIGN */ #define XK_DongSign 0x10020ab /* U+20AB DONG SIGN */ #define XK_EuroSign 0x20ac /* U+20AC EURO SIGN */ #endif /* XK_CURRENCY */ #ifdef XK_MATHEMATICAL /* one, two and three are defined above. */ #define XK_zerosuperior 0x1002070 /* U+2070 SUPERSCRIPT ZERO */ #define XK_foursuperior 0x1002074 /* U+2074 SUPERSCRIPT FOUR */ #define XK_fivesuperior 0x1002075 /* U+2075 SUPERSCRIPT FIVE */ #define XK_sixsuperior 0x1002076 /* U+2076 SUPERSCRIPT SIX */ #define XK_sevensuperior 0x1002077 /* U+2077 SUPERSCRIPT SEVEN */ #define XK_eightsuperior 0x1002078 /* U+2078 SUPERSCRIPT EIGHT */ #define XK_ninesuperior 0x1002079 /* U+2079 SUPERSCRIPT NINE */ #define XK_zerosubscript 0x1002080 /* U+2080 SUBSCRIPT ZERO */ #define XK_onesubscript 0x1002081 /* U+2081 SUBSCRIPT ONE */ #define XK_twosubscript 0x1002082 /* U+2082 SUBSCRIPT TWO */ #define XK_threesubscript 0x1002083 /* U+2083 SUBSCRIPT THREE */ #define XK_foursubscript 0x1002084 /* U+2084 SUBSCRIPT FOUR */ #define XK_fivesubscript 0x1002085 /* U+2085 SUBSCRIPT FIVE */ #define XK_sixsubscript 0x1002086 /* U+2086 SUBSCRIPT SIX */ #define XK_sevensubscript 0x1002087 /* U+2087 SUBSCRIPT SEVEN */ #define XK_eightsubscript 0x1002088 /* U+2088 SUBSCRIPT EIGHT */ #define XK_ninesubscript 0x1002089 /* U+2089 SUBSCRIPT NINE */ #define XK_partdifferential 0x1002202 /* U+2202 PARTIAL DIFFERENTIAL */ #define XK_emptyset 0x1002205 /* U+2205 NULL SET */ #define XK_elementof 0x1002208 /* U+2208 ELEMENT OF */ #define XK_notelementof 0x1002209 /* U+2209 NOT AN ELEMENT OF */ #define XK_containsas 0x100220B /* U+220B CONTAINS AS MEMBER */ #define XK_squareroot 0x100221A /* U+221A SQUARE ROOT */ #define XK_cuberoot 0x100221B /* U+221B CUBE ROOT */ #define XK_fourthroot 0x100221C /* U+221C FOURTH ROOT */ #define XK_dintegral 0x100222C /* U+222C DOUBLE INTEGRAL */ #define XK_tintegral 0x100222D /* U+222D TRIPLE INTEGRAL */ #define XK_because 0x1002235 /* U+2235 BECAUSE */ #define XK_approxeq 0x1002248 /* U+2245 ALMOST EQUAL TO */ #define XK_notapproxeq 0x1002247 /* U+2247 NOT ALMOST EQUAL TO */ #define XK_notidentical 0x1002262 /* U+2262 NOT IDENTICAL TO */ #define XK_stricteq 0x1002263 /* U+2263 STRICTLY EQUIVALENT TO */ #endif /* XK_MATHEMATICAL */ #ifdef XK_BRAILLE #define XK_braille_dot_1 0xfff1 #define XK_braille_dot_2 0xfff2 #define XK_braille_dot_3 0xfff3 #define XK_braille_dot_4 0xfff4 #define XK_braille_dot_5 0xfff5 #define XK_braille_dot_6 0xfff6 #define XK_braille_dot_7 0xfff7 #define XK_braille_dot_8 0xfff8 #define XK_braille_dot_9 0xfff9 #define XK_braille_dot_10 0xfffa #define XK_braille_blank 0x1002800 /* U+2800 BRAILLE PATTERN BLANK */ #define XK_braille_dots_1 0x1002801 /* U+2801 BRAILLE PATTERN DOTS-1 */ #define XK_braille_dots_2 0x1002802 /* U+2802 BRAILLE PATTERN DOTS-2 */ #define XK_braille_dots_12 0x1002803 /* U+2803 BRAILLE PATTERN DOTS-12 */ #define XK_braille_dots_3 0x1002804 /* U+2804 BRAILLE PATTERN DOTS-3 */ #define XK_braille_dots_13 0x1002805 /* U+2805 BRAILLE PATTERN DOTS-13 */ #define XK_braille_dots_23 0x1002806 /* U+2806 BRAILLE PATTERN DOTS-23 */ #define XK_braille_dots_123 0x1002807 /* U+2807 BRAILLE PATTERN DOTS-123 */ #define XK_braille_dots_4 0x1002808 /* U+2808 BRAILLE PATTERN DOTS-4 */ #define XK_braille_dots_14 0x1002809 /* U+2809 BRAILLE PATTERN DOTS-14 */ #define XK_braille_dots_24 0x100280a /* U+280a BRAILLE PATTERN DOTS-24 */ #define XK_braille_dots_124 0x100280b /* U+280b BRAILLE PATTERN DOTS-124 */ #define XK_braille_dots_34 0x100280c /* U+280c BRAILLE PATTERN DOTS-34 */ #define XK_braille_dots_134 0x100280d /* U+280d BRAILLE PATTERN DOTS-134 */ #define XK_braille_dots_234 0x100280e /* U+280e BRAILLE PATTERN DOTS-234 */ #define XK_braille_dots_1234 0x100280f /* U+280f BRAILLE PATTERN DOTS-1234 */ #define XK_braille_dots_5 0x1002810 /* U+2810 BRAILLE PATTERN DOTS-5 */ #define XK_braille_dots_15 0x1002811 /* U+2811 BRAILLE PATTERN DOTS-15 */ #define XK_braille_dots_25 0x1002812 /* U+2812 BRAILLE PATTERN DOTS-25 */ #define XK_braille_dots_125 0x1002813 /* U+2813 BRAILLE PATTERN DOTS-125 */ #define XK_braille_dots_35 0x1002814 /* U+2814 BRAILLE PATTERN DOTS-35 */ #define XK_braille_dots_135 0x1002815 /* U+2815 BRAILLE PATTERN DOTS-135 */ #define XK_braille_dots_235 0x1002816 /* U+2816 BRAILLE PATTERN DOTS-235 */ #define XK_braille_dots_1235 0x1002817 /* U+2817 BRAILLE PATTERN DOTS-1235 */ #define XK_braille_dots_45 0x1002818 /* U+2818 BRAILLE PATTERN DOTS-45 */ #define XK_braille_dots_145 0x1002819 /* U+2819 BRAILLE PATTERN DOTS-145 */ #define XK_braille_dots_245 0x100281a /* U+281a BRAILLE PATTERN DOTS-245 */ #define XK_braille_dots_1245 0x100281b /* U+281b BRAILLE PATTERN DOTS-1245 */ #define XK_braille_dots_345 0x100281c /* U+281c BRAILLE PATTERN DOTS-345 */ #define XK_braille_dots_1345 0x100281d /* U+281d BRAILLE PATTERN DOTS-1345 */ #define XK_braille_dots_2345 0x100281e /* U+281e BRAILLE PATTERN DOTS-2345 */ #define XK_braille_dots_12345 0x100281f /* U+281f BRAILLE PATTERN DOTS-12345 */ #define XK_braille_dots_6 0x1002820 /* U+2820 BRAILLE PATTERN DOTS-6 */ #define XK_braille_dots_16 0x1002821 /* U+2821 BRAILLE PATTERN DOTS-16 */ #define XK_braille_dots_26 0x1002822 /* U+2822 BRAILLE PATTERN DOTS-26 */ #define XK_braille_dots_126 0x1002823 /* U+2823 BRAILLE PATTERN DOTS-126 */ #define XK_braille_dots_36 0x1002824 /* U+2824 BRAILLE PATTERN DOTS-36 */ #define XK_braille_dots_136 0x1002825 /* U+2825 BRAILLE PATTERN DOTS-136 */ #define XK_braille_dots_236 0x1002826 /* U+2826 BRAILLE PATTERN DOTS-236 */ #define XK_braille_dots_1236 0x1002827 /* U+2827 BRAILLE PATTERN DOTS-1236 */ #define XK_braille_dots_46 0x1002828 /* U+2828 BRAILLE PATTERN DOTS-46 */ #define XK_braille_dots_146 0x1002829 /* U+2829 BRAILLE PATTERN DOTS-146 */ #define XK_braille_dots_246 0x100282a /* U+282a BRAILLE PATTERN DOTS-246 */ #define XK_braille_dots_1246 0x100282b /* U+282b BRAILLE PATTERN DOTS-1246 */ #define XK_braille_dots_346 0x100282c /* U+282c BRAILLE PATTERN DOTS-346 */ #define XK_braille_dots_1346 0x100282d /* U+282d BRAILLE PATTERN DOTS-1346 */ #define XK_braille_dots_2346 0x100282e /* U+282e BRAILLE PATTERN DOTS-2346 */ #define XK_braille_dots_12346 0x100282f /* U+282f BRAILLE PATTERN DOTS-12346 */ #define XK_braille_dots_56 0x1002830 /* U+2830 BRAILLE PATTERN DOTS-56 */ #define XK_braille_dots_156 0x1002831 /* U+2831 BRAILLE PATTERN DOTS-156 */ #define XK_braille_dots_256 0x1002832 /* U+2832 BRAILLE PATTERN DOTS-256 */ #define XK_braille_dots_1256 0x1002833 /* U+2833 BRAILLE PATTERN DOTS-1256 */ #define XK_braille_dots_356 0x1002834 /* U+2834 BRAILLE PATTERN DOTS-356 */ #define XK_braille_dots_1356 0x1002835 /* U+2835 BRAILLE PATTERN DOTS-1356 */ #define XK_braille_dots_2356 0x1002836 /* U+2836 BRAILLE PATTERN DOTS-2356 */ #define XK_braille_dots_12356 0x1002837 /* U+2837 BRAILLE PATTERN DOTS-12356 */ #define XK_braille_dots_456 0x1002838 /* U+2838 BRAILLE PATTERN DOTS-456 */ #define XK_braille_dots_1456 0x1002839 /* U+2839 BRAILLE PATTERN DOTS-1456 */ #define XK_braille_dots_2456 0x100283a /* U+283a BRAILLE PATTERN DOTS-2456 */ #define XK_braille_dots_12456 0x100283b /* U+283b BRAILLE PATTERN DOTS-12456 */ #define XK_braille_dots_3456 0x100283c /* U+283c BRAILLE PATTERN DOTS-3456 */ #define XK_braille_dots_13456 0x100283d /* U+283d BRAILLE PATTERN DOTS-13456 */ #define XK_braille_dots_23456 0x100283e /* U+283e BRAILLE PATTERN DOTS-23456 */ #define XK_braille_dots_123456 0x100283f /* U+283f BRAILLE PATTERN DOTS-123456 */ #define XK_braille_dots_7 0x1002840 /* U+2840 BRAILLE PATTERN DOTS-7 */ #define XK_braille_dots_17 0x1002841 /* U+2841 BRAILLE PATTERN DOTS-17 */ #define XK_braille_dots_27 0x1002842 /* U+2842 BRAILLE PATTERN DOTS-27 */ #define XK_braille_dots_127 0x1002843 /* U+2843 BRAILLE PATTERN DOTS-127 */ #define XK_braille_dots_37 0x1002844 /* U+2844 BRAILLE PATTERN DOTS-37 */ #define XK_braille_dots_137 0x1002845 /* U+2845 BRAILLE PATTERN DOTS-137 */ #define XK_braille_dots_237 0x1002846 /* U+2846 BRAILLE PATTERN DOTS-237 */ #define XK_braille_dots_1237 0x1002847 /* U+2847 BRAILLE PATTERN DOTS-1237 */ #define XK_braille_dots_47 0x1002848 /* U+2848 BRAILLE PATTERN DOTS-47 */ #define XK_braille_dots_147 0x1002849 /* U+2849 BRAILLE PATTERN DOTS-147 */ #define XK_braille_dots_247 0x100284a /* U+284a BRAILLE PATTERN DOTS-247 */ #define XK_braille_dots_1247 0x100284b /* U+284b BRAILLE PATTERN DOTS-1247 */ #define XK_braille_dots_347 0x100284c /* U+284c BRAILLE PATTERN DOTS-347 */ #define XK_braille_dots_1347 0x100284d /* U+284d BRAILLE PATTERN DOTS-1347 */ #define XK_braille_dots_2347 0x100284e /* U+284e BRAILLE PATTERN DOTS-2347 */ #define XK_braille_dots_12347 0x100284f /* U+284f BRAILLE PATTERN DOTS-12347 */ #define XK_braille_dots_57 0x1002850 /* U+2850 BRAILLE PATTERN DOTS-57 */ #define XK_braille_dots_157 0x1002851 /* U+2851 BRAILLE PATTERN DOTS-157 */ #define XK_braille_dots_257 0x1002852 /* U+2852 BRAILLE PATTERN DOTS-257 */ #define XK_braille_dots_1257 0x1002853 /* U+2853 BRAILLE PATTERN DOTS-1257 */ #define XK_braille_dots_357 0x1002854 /* U+2854 BRAILLE PATTERN DOTS-357 */ #define XK_braille_dots_1357 0x1002855 /* U+2855 BRAILLE PATTERN DOTS-1357 */ #define XK_braille_dots_2357 0x1002856 /* U+2856 BRAILLE PATTERN DOTS-2357 */ #define XK_braille_dots_12357 0x1002857 /* U+2857 BRAILLE PATTERN DOTS-12357 */ #define XK_braille_dots_457 0x1002858 /* U+2858 BRAILLE PATTERN DOTS-457 */ #define XK_braille_dots_1457 0x1002859 /* U+2859 BRAILLE PATTERN DOTS-1457 */ #define XK_braille_dots_2457 0x100285a /* U+285a BRAILLE PATTERN DOTS-2457 */ #define XK_braille_dots_12457 0x100285b /* U+285b BRAILLE PATTERN DOTS-12457 */ #define XK_braille_dots_3457 0x100285c /* U+285c BRAILLE PATTERN DOTS-3457 */ #define XK_braille_dots_13457 0x100285d /* U+285d BRAILLE PATTERN DOTS-13457 */ #define XK_braille_dots_23457 0x100285e /* U+285e BRAILLE PATTERN DOTS-23457 */ #define XK_braille_dots_123457 0x100285f /* U+285f BRAILLE PATTERN DOTS-123457 */ #define XK_braille_dots_67 0x1002860 /* U+2860 BRAILLE PATTERN DOTS-67 */ #define XK_braille_dots_167 0x1002861 /* U+2861 BRAILLE PATTERN DOTS-167 */ #define XK_braille_dots_267 0x1002862 /* U+2862 BRAILLE PATTERN DOTS-267 */ #define XK_braille_dots_1267 0x1002863 /* U+2863 BRAILLE PATTERN DOTS-1267 */ #define XK_braille_dots_367 0x1002864 /* U+2864 BRAILLE PATTERN DOTS-367 */ #define XK_braille_dots_1367 0x1002865 /* U+2865 BRAILLE PATTERN DOTS-1367 */ #define XK_braille_dots_2367 0x1002866 /* U+2866 BRAILLE PATTERN DOTS-2367 */ #define XK_braille_dots_12367 0x1002867 /* U+2867 BRAILLE PATTERN DOTS-12367 */ #define XK_braille_dots_467 0x1002868 /* U+2868 BRAILLE PATTERN DOTS-467 */ #define XK_braille_dots_1467 0x1002869 /* U+2869 BRAILLE PATTERN DOTS-1467 */ #define XK_braille_dots_2467 0x100286a /* U+286a BRAILLE PATTERN DOTS-2467 */ #define XK_braille_dots_12467 0x100286b /* U+286b BRAILLE PATTERN DOTS-12467 */ #define XK_braille_dots_3467 0x100286c /* U+286c BRAILLE PATTERN DOTS-3467 */ #define XK_braille_dots_13467 0x100286d /* U+286d BRAILLE PATTERN DOTS-13467 */ #define XK_braille_dots_23467 0x100286e /* U+286e BRAILLE PATTERN DOTS-23467 */ #define XK_braille_dots_123467 0x100286f /* U+286f BRAILLE PATTERN DOTS-123467 */ #define XK_braille_dots_567 0x1002870 /* U+2870 BRAILLE PATTERN DOTS-567 */ #define XK_braille_dots_1567 0x1002871 /* U+2871 BRAILLE PATTERN DOTS-1567 */ #define XK_braille_dots_2567 0x1002872 /* U+2872 BRAILLE PATTERN DOTS-2567 */ #define XK_braille_dots_12567 0x1002873 /* U+2873 BRAILLE PATTERN DOTS-12567 */ #define XK_braille_dots_3567 0x1002874 /* U+2874 BRAILLE PATTERN DOTS-3567 */ #define XK_braille_dots_13567 0x1002875 /* U+2875 BRAILLE PATTERN DOTS-13567 */ #define XK_braille_dots_23567 0x1002876 /* U+2876 BRAILLE PATTERN DOTS-23567 */ #define XK_braille_dots_123567 0x1002877 /* U+2877 BRAILLE PATTERN DOTS-123567 */ #define XK_braille_dots_4567 0x1002878 /* U+2878 BRAILLE PATTERN DOTS-4567 */ #define XK_braille_dots_14567 0x1002879 /* U+2879 BRAILLE PATTERN DOTS-14567 */ #define XK_braille_dots_24567 0x100287a /* U+287a BRAILLE PATTERN DOTS-24567 */ #define XK_braille_dots_124567 0x100287b /* U+287b BRAILLE PATTERN DOTS-124567 */ #define XK_braille_dots_34567 0x100287c /* U+287c BRAILLE PATTERN DOTS-34567 */ #define XK_braille_dots_134567 0x100287d /* U+287d BRAILLE PATTERN DOTS-134567 */ #define XK_braille_dots_234567 0x100287e /* U+287e BRAILLE PATTERN DOTS-234567 */ #define XK_braille_dots_1234567 0x100287f /* U+287f BRAILLE PATTERN DOTS-1234567 */ #define XK_braille_dots_8 0x1002880 /* U+2880 BRAILLE PATTERN DOTS-8 */ #define XK_braille_dots_18 0x1002881 /* U+2881 BRAILLE PATTERN DOTS-18 */ #define XK_braille_dots_28 0x1002882 /* U+2882 BRAILLE PATTERN DOTS-28 */ #define XK_braille_dots_128 0x1002883 /* U+2883 BRAILLE PATTERN DOTS-128 */ #define XK_braille_dots_38 0x1002884 /* U+2884 BRAILLE PATTERN DOTS-38 */ #define XK_braille_dots_138 0x1002885 /* U+2885 BRAILLE PATTERN DOTS-138 */ #define XK_braille_dots_238 0x1002886 /* U+2886 BRAILLE PATTERN DOTS-238 */ #define XK_braille_dots_1238 0x1002887 /* U+2887 BRAILLE PATTERN DOTS-1238 */ #define XK_braille_dots_48 0x1002888 /* U+2888 BRAILLE PATTERN DOTS-48 */ #define XK_braille_dots_148 0x1002889 /* U+2889 BRAILLE PATTERN DOTS-148 */ #define XK_braille_dots_248 0x100288a /* U+288a BRAILLE PATTERN DOTS-248 */ #define XK_braille_dots_1248 0x100288b /* U+288b BRAILLE PATTERN DOTS-1248 */ #define XK_braille_dots_348 0x100288c /* U+288c BRAILLE PATTERN DOTS-348 */ #define XK_braille_dots_1348 0x100288d /* U+288d BRAILLE PATTERN DOTS-1348 */ #define XK_braille_dots_2348 0x100288e /* U+288e BRAILLE PATTERN DOTS-2348 */ #define XK_braille_dots_12348 0x100288f /* U+288f BRAILLE PATTERN DOTS-12348 */ #define XK_braille_dots_58 0x1002890 /* U+2890 BRAILLE PATTERN DOTS-58 */ #define XK_braille_dots_158 0x1002891 /* U+2891 BRAILLE PATTERN DOTS-158 */ #define XK_braille_dots_258 0x1002892 /* U+2892 BRAILLE PATTERN DOTS-258 */ #define XK_braille_dots_1258 0x1002893 /* U+2893 BRAILLE PATTERN DOTS-1258 */ #define XK_braille_dots_358 0x1002894 /* U+2894 BRAILLE PATTERN DOTS-358 */ #define XK_braille_dots_1358 0x1002895 /* U+2895 BRAILLE PATTERN DOTS-1358 */ #define XK_braille_dots_2358 0x1002896 /* U+2896 BRAILLE PATTERN DOTS-2358 */ #define XK_braille_dots_12358 0x1002897 /* U+2897 BRAILLE PATTERN DOTS-12358 */ #define XK_braille_dots_458 0x1002898 /* U+2898 BRAILLE PATTERN DOTS-458 */ #define XK_braille_dots_1458 0x1002899 /* U+2899 BRAILLE PATTERN DOTS-1458 */ #define XK_braille_dots_2458 0x100289a /* U+289a BRAILLE PATTERN DOTS-2458 */ #define XK_braille_dots_12458 0x100289b /* U+289b BRAILLE PATTERN DOTS-12458 */ #define XK_braille_dots_3458 0x100289c /* U+289c BRAILLE PATTERN DOTS-3458 */ #define XK_braille_dots_13458 0x100289d /* U+289d BRAILLE PATTERN DOTS-13458 */ #define XK_braille_dots_23458 0x100289e /* U+289e BRAILLE PATTERN DOTS-23458 */ #define XK_braille_dots_123458 0x100289f /* U+289f BRAILLE PATTERN DOTS-123458 */ #define XK_braille_dots_68 0x10028a0 /* U+28a0 BRAILLE PATTERN DOTS-68 */ #define XK_braille_dots_168 0x10028a1 /* U+28a1 BRAILLE PATTERN DOTS-168 */ #define XK_braille_dots_268 0x10028a2 /* U+28a2 BRAILLE PATTERN DOTS-268 */ #define XK_braille_dots_1268 0x10028a3 /* U+28a3 BRAILLE PATTERN DOTS-1268 */ #define XK_braille_dots_368 0x10028a4 /* U+28a4 BRAILLE PATTERN DOTS-368 */ #define XK_braille_dots_1368 0x10028a5 /* U+28a5 BRAILLE PATTERN DOTS-1368 */ #define XK_braille_dots_2368 0x10028a6 /* U+28a6 BRAILLE PATTERN DOTS-2368 */ #define XK_braille_dots_12368 0x10028a7 /* U+28a7 BRAILLE PATTERN DOTS-12368 */ #define XK_braille_dots_468 0x10028a8 /* U+28a8 BRAILLE PATTERN DOTS-468 */ #define XK_braille_dots_1468 0x10028a9 /* U+28a9 BRAILLE PATTERN DOTS-1468 */ #define XK_braille_dots_2468 0x10028aa /* U+28aa BRAILLE PATTERN DOTS-2468 */ #define XK_braille_dots_12468 0x10028ab /* U+28ab BRAILLE PATTERN DOTS-12468 */ #define XK_braille_dots_3468 0x10028ac /* U+28ac BRAILLE PATTERN DOTS-3468 */ #define XK_braille_dots_13468 0x10028ad /* U+28ad BRAILLE PATTERN DOTS-13468 */ #define XK_braille_dots_23468 0x10028ae /* U+28ae BRAILLE PATTERN DOTS-23468 */ #define XK_braille_dots_123468 0x10028af /* U+28af BRAILLE PATTERN DOTS-123468 */ #define XK_braille_dots_568 0x10028b0 /* U+28b0 BRAILLE PATTERN DOTS-568 */ #define XK_braille_dots_1568 0x10028b1 /* U+28b1 BRAILLE PATTERN DOTS-1568 */ #define XK_braille_dots_2568 0x10028b2 /* U+28b2 BRAILLE PATTERN DOTS-2568 */ #define XK_braille_dots_12568 0x10028b3 /* U+28b3 BRAILLE PATTERN DOTS-12568 */ #define XK_braille_dots_3568 0x10028b4 /* U+28b4 BRAILLE PATTERN DOTS-3568 */ #define XK_braille_dots_13568 0x10028b5 /* U+28b5 BRAILLE PATTERN DOTS-13568 */ #define XK_braille_dots_23568 0x10028b6 /* U+28b6 BRAILLE PATTERN DOTS-23568 */ #define XK_braille_dots_123568 0x10028b7 /* U+28b7 BRAILLE PATTERN DOTS-123568 */ #define XK_braille_dots_4568 0x10028b8 /* U+28b8 BRAILLE PATTERN DOTS-4568 */ #define XK_braille_dots_14568 0x10028b9 /* U+28b9 BRAILLE PATTERN DOTS-14568 */ #define XK_braille_dots_24568 0x10028ba /* U+28ba BRAILLE PATTERN DOTS-24568 */ #define XK_braille_dots_124568 0x10028bb /* U+28bb BRAILLE PATTERN DOTS-124568 */ #define XK_braille_dots_34568 0x10028bc /* U+28bc BRAILLE PATTERN DOTS-34568 */ #define XK_braille_dots_134568 0x10028bd /* U+28bd BRAILLE PATTERN DOTS-134568 */ #define XK_braille_dots_234568 0x10028be /* U+28be BRAILLE PATTERN DOTS-234568 */ #define XK_braille_dots_1234568 0x10028bf /* U+28bf BRAILLE PATTERN DOTS-1234568 */ #define XK_braille_dots_78 0x10028c0 /* U+28c0 BRAILLE PATTERN DOTS-78 */ #define XK_braille_dots_178 0x10028c1 /* U+28c1 BRAILLE PATTERN DOTS-178 */ #define XK_braille_dots_278 0x10028c2 /* U+28c2 BRAILLE PATTERN DOTS-278 */ #define XK_braille_dots_1278 0x10028c3 /* U+28c3 BRAILLE PATTERN DOTS-1278 */ #define XK_braille_dots_378 0x10028c4 /* U+28c4 BRAILLE PATTERN DOTS-378 */ #define XK_braille_dots_1378 0x10028c5 /* U+28c5 BRAILLE PATTERN DOTS-1378 */ #define XK_braille_dots_2378 0x10028c6 /* U+28c6 BRAILLE PATTERN DOTS-2378 */ #define XK_braille_dots_12378 0x10028c7 /* U+28c7 BRAILLE PATTERN DOTS-12378 */ #define XK_braille_dots_478 0x10028c8 /* U+28c8 BRAILLE PATTERN DOTS-478 */ #define XK_braille_dots_1478 0x10028c9 /* U+28c9 BRAILLE PATTERN DOTS-1478 */ #define XK_braille_dots_2478 0x10028ca /* U+28ca BRAILLE PATTERN DOTS-2478 */ #define XK_braille_dots_12478 0x10028cb /* U+28cb BRAILLE PATTERN DOTS-12478 */ #define XK_braille_dots_3478 0x10028cc /* U+28cc BRAILLE PATTERN DOTS-3478 */ #define XK_braille_dots_13478 0x10028cd /* U+28cd BRAILLE PATTERN DOTS-13478 */ #define XK_braille_dots_23478 0x10028ce /* U+28ce BRAILLE PATTERN DOTS-23478 */ #define XK_braille_dots_123478 0x10028cf /* U+28cf BRAILLE PATTERN DOTS-123478 */ #define XK_braille_dots_578 0x10028d0 /* U+28d0 BRAILLE PATTERN DOTS-578 */ #define XK_braille_dots_1578 0x10028d1 /* U+28d1 BRAILLE PATTERN DOTS-1578 */ #define XK_braille_dots_2578 0x10028d2 /* U+28d2 BRAILLE PATTERN DOTS-2578 */ #define XK_braille_dots_12578 0x10028d3 /* U+28d3 BRAILLE PATTERN DOTS-12578 */ #define XK_braille_dots_3578 0x10028d4 /* U+28d4 BRAILLE PATTERN DOTS-3578 */ #define XK_braille_dots_13578 0x10028d5 /* U+28d5 BRAILLE PATTERN DOTS-13578 */ #define XK_braille_dots_23578 0x10028d6 /* U+28d6 BRAILLE PATTERN DOTS-23578 */ #define XK_braille_dots_123578 0x10028d7 /* U+28d7 BRAILLE PATTERN DOTS-123578 */ #define XK_braille_dots_4578 0x10028d8 /* U+28d8 BRAILLE PATTERN DOTS-4578 */ #define XK_braille_dots_14578 0x10028d9 /* U+28d9 BRAILLE PATTERN DOTS-14578 */ #define XK_braille_dots_24578 0x10028da /* U+28da BRAILLE PATTERN DOTS-24578 */ #define XK_braille_dots_124578 0x10028db /* U+28db BRAILLE PATTERN DOTS-124578 */ #define XK_braille_dots_34578 0x10028dc /* U+28dc BRAILLE PATTERN DOTS-34578 */ #define XK_braille_dots_134578 0x10028dd /* U+28dd BRAILLE PATTERN DOTS-134578 */ #define XK_braille_dots_234578 0x10028de /* U+28de BRAILLE PATTERN DOTS-234578 */ #define XK_braille_dots_1234578 0x10028df /* U+28df BRAILLE PATTERN DOTS-1234578 */ #define XK_braille_dots_678 0x10028e0 /* U+28e0 BRAILLE PATTERN DOTS-678 */ #define XK_braille_dots_1678 0x10028e1 /* U+28e1 BRAILLE PATTERN DOTS-1678 */ #define XK_braille_dots_2678 0x10028e2 /* U+28e2 BRAILLE PATTERN DOTS-2678 */ #define XK_braille_dots_12678 0x10028e3 /* U+28e3 BRAILLE PATTERN DOTS-12678 */ #define XK_braille_dots_3678 0x10028e4 /* U+28e4 BRAILLE PATTERN DOTS-3678 */ #define XK_braille_dots_13678 0x10028e5 /* U+28e5 BRAILLE PATTERN DOTS-13678 */ #define XK_braille_dots_23678 0x10028e6 /* U+28e6 BRAILLE PATTERN DOTS-23678 */ #define XK_braille_dots_123678 0x10028e7 /* U+28e7 BRAILLE PATTERN DOTS-123678 */ #define XK_braille_dots_4678 0x10028e8 /* U+28e8 BRAILLE PATTERN DOTS-4678 */ #define XK_braille_dots_14678 0x10028e9 /* U+28e9 BRAILLE PATTERN DOTS-14678 */ #define XK_braille_dots_24678 0x10028ea /* U+28ea BRAILLE PATTERN DOTS-24678 */ #define XK_braille_dots_124678 0x10028eb /* U+28eb BRAILLE PATTERN DOTS-124678 */ #define XK_braille_dots_34678 0x10028ec /* U+28ec BRAILLE PATTERN DOTS-34678 */ #define XK_braille_dots_134678 0x10028ed /* U+28ed BRAILLE PATTERN DOTS-134678 */ #define XK_braille_dots_234678 0x10028ee /* U+28ee BRAILLE PATTERN DOTS-234678 */ #define XK_braille_dots_1234678 0x10028ef /* U+28ef BRAILLE PATTERN DOTS-1234678 */ #define XK_braille_dots_5678 0x10028f0 /* U+28f0 BRAILLE PATTERN DOTS-5678 */ #define XK_braille_dots_15678 0x10028f1 /* U+28f1 BRAILLE PATTERN DOTS-15678 */ #define XK_braille_dots_25678 0x10028f2 /* U+28f2 BRAILLE PATTERN DOTS-25678 */ #define XK_braille_dots_125678 0x10028f3 /* U+28f3 BRAILLE PATTERN DOTS-125678 */ #define XK_braille_dots_35678 0x10028f4 /* U+28f4 BRAILLE PATTERN DOTS-35678 */ #define XK_braille_dots_135678 0x10028f5 /* U+28f5 BRAILLE PATTERN DOTS-135678 */ #define XK_braille_dots_235678 0x10028f6 /* U+28f6 BRAILLE PATTERN DOTS-235678 */ #define XK_braille_dots_1235678 0x10028f7 /* U+28f7 BRAILLE PATTERN DOTS-1235678 */ #define XK_braille_dots_45678 0x10028f8 /* U+28f8 BRAILLE PATTERN DOTS-45678 */ #define XK_braille_dots_145678 0x10028f9 /* U+28f9 BRAILLE PATTERN DOTS-145678 */ #define XK_braille_dots_245678 0x10028fa /* U+28fa BRAILLE PATTERN DOTS-245678 */ #define XK_braille_dots_1245678 0x10028fb /* U+28fb BRAILLE PATTERN DOTS-1245678 */ #define XK_braille_dots_345678 0x10028fc /* U+28fc BRAILLE PATTERN DOTS-345678 */ #define XK_braille_dots_1345678 0x10028fd /* U+28fd BRAILLE PATTERN DOTS-1345678 */ #define XK_braille_dots_2345678 0x10028fe /* U+28fe BRAILLE PATTERN DOTS-2345678 */ #define XK_braille_dots_12345678 0x10028ff /* U+28ff BRAILLE PATTERN DOTS-12345678 */ #endif /* XK_BRAILLE */ /* * Sinhala (http://unicode.org/charts/PDF/U0D80.pdf) * http://www.nongnu.org/sinhala/doc/transliteration/sinhala-transliteration_6.html */ #ifdef XK_SINHALA #define XK_Sinh_ng 0x1000d82 /* U+0D82 SINHALA ANUSVARAYA */ #define XK_Sinh_h2 0x1000d83 /* U+0D83 SINHALA VISARGAYA */ #define XK_Sinh_a 0x1000d85 /* U+0D85 SINHALA AYANNA */ #define XK_Sinh_aa 0x1000d86 /* U+0D86 SINHALA AAYANNA */ #define XK_Sinh_ae 0x1000d87 /* U+0D87 SINHALA AEYANNA */ #define XK_Sinh_aee 0x1000d88 /* U+0D88 SINHALA AEEYANNA */ #define XK_Sinh_i 0x1000d89 /* U+0D89 SINHALA IYANNA */ #define XK_Sinh_ii 0x1000d8a /* U+0D8A SINHALA IIYANNA */ #define XK_Sinh_u 0x1000d8b /* U+0D8B SINHALA UYANNA */ #define XK_Sinh_uu 0x1000d8c /* U+0D8C SINHALA UUYANNA */ #define XK_Sinh_ri 0x1000d8d /* U+0D8D SINHALA IRUYANNA */ #define XK_Sinh_rii 0x1000d8e /* U+0D8E SINHALA IRUUYANNA */ #define XK_Sinh_lu 0x1000d8f /* U+0D8F SINHALA ILUYANNA */ #define XK_Sinh_luu 0x1000d90 /* U+0D90 SINHALA ILUUYANNA */ #define XK_Sinh_e 0x1000d91 /* U+0D91 SINHALA EYANNA */ #define XK_Sinh_ee 0x1000d92 /* U+0D92 SINHALA EEYANNA */ #define XK_Sinh_ai 0x1000d93 /* U+0D93 SINHALA AIYANNA */ #define XK_Sinh_o 0x1000d94 /* U+0D94 SINHALA OYANNA */ #define XK_Sinh_oo 0x1000d95 /* U+0D95 SINHALA OOYANNA */ #define XK_Sinh_au 0x1000d96 /* U+0D96 SINHALA AUYANNA */ #define XK_Sinh_ka 0x1000d9a /* U+0D9A SINHALA KAYANNA */ #define XK_Sinh_kha 0x1000d9b /* U+0D9B SINHALA MAHA. KAYANNA */ #define XK_Sinh_ga 0x1000d9c /* U+0D9C SINHALA GAYANNA */ #define XK_Sinh_gha 0x1000d9d /* U+0D9D SINHALA MAHA. GAYANNA */ #define XK_Sinh_ng2 0x1000d9e /* U+0D9E SINHALA KANTAJA NAASIKYAYA */ #define XK_Sinh_nga 0x1000d9f /* U+0D9F SINHALA SANYAKA GAYANNA */ #define XK_Sinh_ca 0x1000da0 /* U+0DA0 SINHALA CAYANNA */ #define XK_Sinh_cha 0x1000da1 /* U+0DA1 SINHALA MAHA. CAYANNA */ #define XK_Sinh_ja 0x1000da2 /* U+0DA2 SINHALA JAYANNA */ #define XK_Sinh_jha 0x1000da3 /* U+0DA3 SINHALA MAHA. JAYANNA */ #define XK_Sinh_nya 0x1000da4 /* U+0DA4 SINHALA TAALUJA NAASIKYAYA */ #define XK_Sinh_jnya 0x1000da5 /* U+0DA5 SINHALA TAALUJA SANYOOGA NAASIKYAYA */ #define XK_Sinh_nja 0x1000da6 /* U+0DA6 SINHALA SANYAKA JAYANNA */ #define XK_Sinh_tta 0x1000da7 /* U+0DA7 SINHALA TTAYANNA */ #define XK_Sinh_ttha 0x1000da8 /* U+0DA8 SINHALA MAHA. TTAYANNA */ #define XK_Sinh_dda 0x1000da9 /* U+0DA9 SINHALA DDAYANNA */ #define XK_Sinh_ddha 0x1000daa /* U+0DAA SINHALA MAHA. DDAYANNA */ #define XK_Sinh_nna 0x1000dab /* U+0DAB SINHALA MUURDHAJA NAYANNA */ #define XK_Sinh_ndda 0x1000dac /* U+0DAC SINHALA SANYAKA DDAYANNA */ #define XK_Sinh_tha 0x1000dad /* U+0DAD SINHALA TAYANNA */ #define XK_Sinh_thha 0x1000dae /* U+0DAE SINHALA MAHA. TAYANNA */ #define XK_Sinh_dha 0x1000daf /* U+0DAF SINHALA DAYANNA */ #define XK_Sinh_dhha 0x1000db0 /* U+0DB0 SINHALA MAHA. DAYANNA */ #define XK_Sinh_na 0x1000db1 /* U+0DB1 SINHALA DANTAJA NAYANNA */ #define XK_Sinh_ndha 0x1000db3 /* U+0DB3 SINHALA SANYAKA DAYANNA */ #define XK_Sinh_pa 0x1000db4 /* U+0DB4 SINHALA PAYANNA */ #define XK_Sinh_pha 0x1000db5 /* U+0DB5 SINHALA MAHA. PAYANNA */ #define XK_Sinh_ba 0x1000db6 /* U+0DB6 SINHALA BAYANNA */ #define XK_Sinh_bha 0x1000db7 /* U+0DB7 SINHALA MAHA. BAYANNA */ #define XK_Sinh_ma 0x1000db8 /* U+0DB8 SINHALA MAYANNA */ #define XK_Sinh_mba 0x1000db9 /* U+0DB9 SINHALA AMBA BAYANNA */ #define XK_Sinh_ya 0x1000dba /* U+0DBA SINHALA YAYANNA */ #define XK_Sinh_ra 0x1000dbb /* U+0DBB SINHALA RAYANNA */ #define XK_Sinh_la 0x1000dbd /* U+0DBD SINHALA DANTAJA LAYANNA */ #define XK_Sinh_va 0x1000dc0 /* U+0DC0 SINHALA VAYANNA */ #define XK_Sinh_sha 0x1000dc1 /* U+0DC1 SINHALA TAALUJA SAYANNA */ #define XK_Sinh_ssha 0x1000dc2 /* U+0DC2 SINHALA MUURDHAJA SAYANNA */ #define XK_Sinh_sa 0x1000dc3 /* U+0DC3 SINHALA DANTAJA SAYANNA */ #define XK_Sinh_ha 0x1000dc4 /* U+0DC4 SINHALA HAYANNA */ #define XK_Sinh_lla 0x1000dc5 /* U+0DC5 SINHALA MUURDHAJA LAYANNA */ #define XK_Sinh_fa 0x1000dc6 /* U+0DC6 SINHALA FAYANNA */ #define XK_Sinh_al 0x1000dca /* U+0DCA SINHALA AL-LAKUNA */ #define XK_Sinh_aa2 0x1000dcf /* U+0DCF SINHALA AELA-PILLA */ #define XK_Sinh_ae2 0x1000dd0 /* U+0DD0 SINHALA AEDA-PILLA */ #define XK_Sinh_aee2 0x1000dd1 /* U+0DD1 SINHALA DIGA AEDA-PILLA */ #define XK_Sinh_i2 0x1000dd2 /* U+0DD2 SINHALA IS-PILLA */ #define XK_Sinh_ii2 0x1000dd3 /* U+0DD3 SINHALA DIGA IS-PILLA */ #define XK_Sinh_u2 0x1000dd4 /* U+0DD4 SINHALA PAA-PILLA */ #define XK_Sinh_uu2 0x1000dd6 /* U+0DD6 SINHALA DIGA PAA-PILLA */ #define XK_Sinh_ru2 0x1000dd8 /* U+0DD8 SINHALA GAETTA-PILLA */ #define XK_Sinh_e2 0x1000dd9 /* U+0DD9 SINHALA KOMBUVA */ #define XK_Sinh_ee2 0x1000dda /* U+0DDA SINHALA DIGA KOMBUVA */ #define XK_Sinh_ai2 0x1000ddb /* U+0DDB SINHALA KOMBU DEKA */ #define XK_Sinh_o2 0x1000ddc /* U+0DDC SINHALA KOMBUVA HAA AELA-PILLA*/ #define XK_Sinh_oo2 0x1000ddd /* U+0DDD SINHALA KOMBUVA HAA DIGA AELA-PILLA*/ #define XK_Sinh_au2 0x1000dde /* U+0DDE SINHALA KOMBUVA HAA GAYANUKITTA */ #define XK_Sinh_lu2 0x1000ddf /* U+0DDF SINHALA GAYANUKITTA */ #define XK_Sinh_ruu2 0x1000df2 /* U+0DF2 SINHALA DIGA GAETTA-PILLA */ #define XK_Sinh_luu2 0x1000df3 /* U+0DF3 SINHALA DIGA GAYANUKITTA */ #define XK_Sinh_kunddaliya 0x1000df4 /* U+0DF4 SINHALA KUNDDALIYA */ #endif /* XK_SINHALA */ X11/Xlocale.h000064400000002421147631660250006666 0ustar00/* Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _X11_XLOCALE_H_ #define _X11_XLOCALE_H_ #include #include #include #endif /* _X11_XLOCALE_H_ */ X11/Xdefs.h000064400000004544147631660250006360 0ustar00/*********************************************************** Copyright (c) 1999 The XFree86 Project Inc. All Rights Reserved. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The XFree86 Project Inc. shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The XFree86 Project Inc.. */ /** ** Types definitions shared between server and clients **/ #ifndef _XDEFS_H #define _XDEFS_H #ifdef _XSERVER64 #include #endif #ifndef _XTYPEDEF_ATOM # define _XTYPEDEF_ATOM # ifndef _XSERVER64 typedef unsigned long Atom; # else typedef CARD32 Atom; # endif #endif #ifndef Bool # ifndef _XTYPEDEF_BOOL # define _XTYPEDEF_BOOL typedef int Bool; # endif #endif #ifndef _XTYPEDEF_POINTER # define _XTYPEDEF_POINTER typedef void *pointer; #endif #ifndef _XTYPEDEF_CLIENTPTR typedef struct _Client *ClientPtr; # define _XTYPEDEF_CLIENTPTR #endif #ifndef _XTYPEDEF_XID # define _XTYPEDEF_XID # ifndef _XSERVER64 typedef unsigned long XID; # else typedef CARD32 XID; # endif #endif #ifndef _XTYPEDEF_MASK # define _XTYPEDEF_MASK # ifndef _XSERVER64 typedef unsigned long Mask; # else typedef CARD32 Mask; # endif #endif #ifndef _XTYPEDEF_FONTPTR # define _XTYPEDEF_FONTPTR typedef struct _Font *FontPtr; /* also in fonts/include/font.h */ #endif #ifndef _XTYPEDEF_FONT # define _XTYPEDEF_FONT typedef XID Font; #endif #ifndef _XTYPEDEF_FSID # ifndef _XSERVER64 typedef unsigned long FSID; # else typedef CARD32 FSID; # endif #endif typedef FSID AccContext; /* OS independent time value XXX Should probably go in Xos.h */ typedef struct timeval **OSTimePtr; typedef void (* BlockHandlerProcPtr)(void * /* blockData */, OSTimePtr /* pTimeout */, void * /* pReadmask */); #endif X11/Xfuncs.h000064400000004321147631660250006546 0ustar00/* * Copyright 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * */ #ifndef _XFUNCS_H_ # define _XFUNCS_H_ # include /* the old Xfuncs.h, for pre-R6 */ # if !(defined(XFree86LOADER) && defined(IN_MODULE)) # ifdef X_USEBFUNCS void bcopy(); void bzero(); int bcmp(); # else # if defined(SYSV) && !defined(__SCO__) && !defined(__sun) && !defined(__UNIXWARE__) && !defined(_AIX) # include void bcopy(); # define bzero(b,len) memset(b, 0, len) # define bcmp(b1,b2,len) memcmp(b1, b2, len) # else # include # if defined(__SCO__) || defined(__sun) || defined(__UNIXWARE__) || defined(__CYGWIN__) || defined(_AIX) || defined(__APPLE__) # include # endif # define _XFUNCS_H_INCLUDED_STRING_H # endif # endif /* X_USEBFUNCS */ /* the new Xfuncs.h */ /* the ANSI C way */ # ifndef _XFUNCS_H_INCLUDED_STRING_H # include # endif # undef bzero # define bzero(b,len) memset(b,0,len) # if defined WIN32 && defined __MINGW32__ # define bcopy(b1,b2,len) memmove(b2, b1, (size_t)(len)) # endif # endif /* !(defined(XFree86LOADER) && defined(IN_MODULE)) */ #endif /* _XFUNCS_H_ */ X11/Xutil.h000064400000051551147631660250006414 0ustar00 /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef _X11_XUTIL_H_ #define _X11_XUTIL_H_ /* You must include before including this file */ #include #include /* The Xlib structs are full of implicit padding to properly align members. We can't clean that up without breaking ABI, so tell clang not to bother complaining about it. */ #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpadded" #endif /* * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding * value (x, y, width, height) was found in the parsed string. */ #define NoValue 0x0000 #define XValue 0x0001 #define YValue 0x0002 #define WidthValue 0x0004 #define HeightValue 0x0008 #define AllValues 0x000F #define XNegative 0x0010 #define YNegative 0x0020 /* * new version containing base_width, base_height, and win_gravity fields; * used with WM_NORMAL_HINTS. */ typedef struct { long flags; /* marks which fields in this structure are defined */ int x, y; /* obsolete for new window mgrs, but clients */ int width, height; /* should set so old wm's don't mess up */ int min_width, min_height; int max_width, max_height; int width_inc, height_inc; struct { int x; /* numerator */ int y; /* denominator */ } min_aspect, max_aspect; int base_width, base_height; /* added by ICCCM version 1 */ int win_gravity; /* added by ICCCM version 1 */ } XSizeHints; /* * The next block of definitions are for window manager properties that * clients and applications use for communication. */ /* flags argument in size hints */ #define USPosition (1L << 0) /* user specified x, y */ #define USSize (1L << 1) /* user specified width, height */ #define PPosition (1L << 2) /* program specified position */ #define PSize (1L << 3) /* program specified size */ #define PMinSize (1L << 4) /* program specified minimum size */ #define PMaxSize (1L << 5) /* program specified maximum size */ #define PResizeInc (1L << 6) /* program specified resize increments */ #define PAspect (1L << 7) /* program specified min and max aspect ratios */ #define PBaseSize (1L << 8) /* program specified base for incrementing */ #define PWinGravity (1L << 9) /* program specified window gravity */ /* obsolete */ #define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect) typedef struct { long flags; /* marks which fields in this structure are defined */ Bool input; /* does this application rely on the window manager to get keyboard input? */ int initial_state; /* see below */ Pixmap icon_pixmap; /* pixmap to be used as icon */ Window icon_window; /* window to be used as icon */ int icon_x, icon_y; /* initial position of icon */ Pixmap icon_mask; /* icon mask bitmap */ XID window_group; /* id of related window group */ /* this structure may be extended in the future */ } XWMHints; /* definition for flags of XWMHints */ #define InputHint (1L << 0) #define StateHint (1L << 1) #define IconPixmapHint (1L << 2) #define IconWindowHint (1L << 3) #define IconPositionHint (1L << 4) #define IconMaskHint (1L << 5) #define WindowGroupHint (1L << 6) #define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \ IconPositionHint|IconMaskHint|WindowGroupHint) #define XUrgencyHint (1L << 8) /* definitions for initial window state */ #define WithdrawnState 0 /* for windows that are not mapped */ #define NormalState 1 /* most applications want to start this way */ #define IconicState 3 /* application wants to start as an icon */ /* * Obsolete states no longer defined by ICCCM */ #define DontCareState 0 /* don't know or care */ #define ZoomState 2 /* application wants to start zoomed */ #define InactiveState 4 /* application believes it is seldom used; */ /* some wm's may put it on inactive menu */ /* * new structure for manipulating TEXT properties; used with WM_NAME, * WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND. */ typedef struct { unsigned char *value; /* same as Property routines */ Atom encoding; /* prop type */ int format; /* prop data format: 8, 16, or 32 */ unsigned long nitems; /* number of data items in value */ } XTextProperty; #define XNoMemory -1 #define XLocaleNotSupported -2 #define XConverterNotFound -3 typedef enum { XStringStyle, /* STRING */ XCompoundTextStyle, /* COMPOUND_TEXT */ XTextStyle, /* text in owner's encoding (current locale)*/ XStdICCTextStyle, /* STRING, else COMPOUND_TEXT */ /* The following is an XFree86 extension, introduced in November 2000 */ XUTF8StringStyle /* UTF8_STRING */ } XICCEncodingStyle; typedef struct { int min_width, min_height; int max_width, max_height; int width_inc, height_inc; } XIconSize; typedef struct { char *res_name; char *res_class; } XClassHint; #ifdef XUTIL_DEFINE_FUNCTIONS extern int XDestroyImage( XImage *ximage); extern unsigned long XGetPixel( XImage *ximage, int x, int y); extern int XPutPixel( XImage *ximage, int x, int y, unsigned long pixel); extern XImage *XSubImage( XImage *ximage, int x, int y, unsigned int width, unsigned int height); extern int XAddPixel( XImage *ximage, long value); #else /* * These macros are used to give some sugar to the image routines so that * naive people are more comfortable with them. */ #define XDestroyImage(ximage) \ ((*((ximage)->f.destroy_image))((ximage))) #define XGetPixel(ximage, x, y) \ ((*((ximage)->f.get_pixel))((ximage), (x), (y))) #define XPutPixel(ximage, x, y, pixel) \ ((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel))) #define XSubImage(ximage, x, y, width, height) \ ((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height))) #define XAddPixel(ximage, value) \ ((*((ximage)->f.add_pixel))((ximage), (value))) #endif /* * Compose sequence status structure, used in calling XLookupString. */ typedef struct _XComposeStatus { XPointer compose_ptr; /* state table pointer */ int chars_matched; /* match state */ } XComposeStatus; /* * Keysym macros, used on Keysyms to test for classes of symbols */ #define IsKeypadKey(keysym) \ (((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal)) #define IsPrivateKeypadKey(keysym) \ (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF)) #define IsCursorKey(keysym) \ (((KeySym)(keysym) >= XK_Home) && ((KeySym)(keysym) < XK_Select)) #define IsPFKey(keysym) \ (((KeySym)(keysym) >= XK_KP_F1) && ((KeySym)(keysym) <= XK_KP_F4)) #define IsFunctionKey(keysym) \ (((KeySym)(keysym) >= XK_F1) && ((KeySym)(keysym) <= XK_F35)) #define IsMiscFunctionKey(keysym) \ (((KeySym)(keysym) >= XK_Select) && ((KeySym)(keysym) <= XK_Break)) #ifdef XK_XKB_KEYS #define IsModifierKey(keysym) \ ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \ || (((KeySym)(keysym) >= XK_ISO_Lock) && \ ((KeySym)(keysym) <= XK_ISO_Level5_Lock)) \ || ((KeySym)(keysym) == XK_Mode_switch) \ || ((KeySym)(keysym) == XK_Num_Lock)) #else #define IsModifierKey(keysym) \ ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \ || ((KeySym)(keysym) == XK_Mode_switch) \ || ((KeySym)(keysym) == XK_Num_Lock)) #endif /* * opaque reference to Region data type */ typedef struct _XRegion *Region; /* Return values from XRectInRegion() */ #define RectangleOut 0 #define RectangleIn 1 #define RectanglePart 2 /* * Information used by the visual utility routines to find desired visual * type from the many visuals a display may support. */ typedef struct { Visual *visual; VisualID visualid; int screen; int depth; #if defined(__cplusplus) || defined(c_plusplus) int c_class; /* C++ */ #else int class; #endif unsigned long red_mask; unsigned long green_mask; unsigned long blue_mask; int colormap_size; int bits_per_rgb; } XVisualInfo; #define VisualNoMask 0x0 #define VisualIDMask 0x1 #define VisualScreenMask 0x2 #define VisualDepthMask 0x4 #define VisualClassMask 0x8 #define VisualRedMaskMask 0x10 #define VisualGreenMaskMask 0x20 #define VisualBlueMaskMask 0x40 #define VisualColormapSizeMask 0x80 #define VisualBitsPerRGBMask 0x100 #define VisualAllMask 0x1FF /* * This defines a window manager property that clients may use to * share standard color maps of type RGB_COLOR_MAP: */ typedef struct { Colormap colormap; unsigned long red_max; unsigned long red_mult; unsigned long green_max; unsigned long green_mult; unsigned long blue_max; unsigned long blue_mult; unsigned long base_pixel; VisualID visualid; /* added by ICCCM version 1 */ XID killid; /* added by ICCCM version 1 */ } XStandardColormap; #define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */ /* * return codes for XReadBitmapFile and XWriteBitmapFile */ #define BitmapSuccess 0 #define BitmapOpenFailed 1 #define BitmapFileInvalid 2 #define BitmapNoMemory 3 /**************************************************************** * * Context Management * ****************************************************************/ /* Associative lookup table return codes */ #define XCSUCCESS 0 /* No error. */ #define XCNOMEM 1 /* Out of memory */ #define XCNOENT 2 /* No entry in table */ typedef int XContext; #define XUniqueContext() ((XContext) XrmUniqueQuark()) #define XStringToContext(string) ((XContext) XrmStringToQuark(string)) _XFUNCPROTOBEGIN /* The following declarations are alphabetized. */ extern XClassHint *XAllocClassHint ( void ); extern XIconSize *XAllocIconSize ( void ); extern XSizeHints *XAllocSizeHints ( void ); extern XStandardColormap *XAllocStandardColormap ( void ); extern XWMHints *XAllocWMHints ( void ); extern int XClipBox( Region /* r */, XRectangle* /* rect_return */ ); extern Region XCreateRegion( void ); extern const char *XDefaultString (void); extern int XDeleteContext( Display* /* display */, XID /* rid */, XContext /* context */ ); extern int XDestroyRegion( Region /* r */ ); extern int XEmptyRegion( Region /* r */ ); extern int XEqualRegion( Region /* r1 */, Region /* r2 */ ); extern int XFindContext( Display* /* display */, XID /* rid */, XContext /* context */, XPointer* /* data_return */ ); extern Status XGetClassHint( Display* /* display */, Window /* w */, XClassHint* /* class_hints_return */ ); extern Status XGetIconSizes( Display* /* display */, Window /* w */, XIconSize** /* size_list_return */, int* /* count_return */ ); extern Status XGetNormalHints( Display* /* display */, Window /* w */, XSizeHints* /* hints_return */ ); extern Status XGetRGBColormaps( Display* /* display */, Window /* w */, XStandardColormap** /* stdcmap_return */, int* /* count_return */, Atom /* property */ ); extern Status XGetSizeHints( Display* /* display */, Window /* w */, XSizeHints* /* hints_return */, Atom /* property */ ); extern Status XGetStandardColormap( Display* /* display */, Window /* w */, XStandardColormap* /* colormap_return */, Atom /* property */ ); extern Status XGetTextProperty( Display* /* display */, Window /* window */, XTextProperty* /* text_prop_return */, Atom /* property */ ); extern XVisualInfo *XGetVisualInfo( Display* /* display */, long /* vinfo_mask */, XVisualInfo* /* vinfo_template */, int* /* nitems_return */ ); extern Status XGetWMClientMachine( Display* /* display */, Window /* w */, XTextProperty* /* text_prop_return */ ); extern XWMHints *XGetWMHints( Display* /* display */, Window /* w */ ); extern Status XGetWMIconName( Display* /* display */, Window /* w */, XTextProperty* /* text_prop_return */ ); extern Status XGetWMName( Display* /* display */, Window /* w */, XTextProperty* /* text_prop_return */ ); extern Status XGetWMNormalHints( Display* /* display */, Window /* w */, XSizeHints* /* hints_return */, long* /* supplied_return */ ); extern Status XGetWMSizeHints( Display* /* display */, Window /* w */, XSizeHints* /* hints_return */, long* /* supplied_return */, Atom /* property */ ); extern Status XGetZoomHints( Display* /* display */, Window /* w */, XSizeHints* /* zhints_return */ ); extern int XIntersectRegion( Region /* sra */, Region /* srb */, Region /* dr_return */ ); extern void XConvertCase( KeySym /* sym */, KeySym* /* lower */, KeySym* /* upper */ ); extern int XLookupString( XKeyEvent* /* event_struct */, char* /* buffer_return */, int /* bytes_buffer */, KeySym* /* keysym_return */, XComposeStatus* /* status_in_out */ ); extern Status XMatchVisualInfo( Display* /* display */, int /* screen */, int /* depth */, int /* class */, XVisualInfo* /* vinfo_return */ ); extern int XOffsetRegion( Region /* r */, int /* dx */, int /* dy */ ); extern Bool XPointInRegion( Region /* r */, int /* x */, int /* y */ ); extern Region XPolygonRegion( XPoint* /* points */, int /* n */, int /* fill_rule */ ); extern int XRectInRegion( Region /* r */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */ ); extern int XSaveContext( Display* /* display */, XID /* rid */, XContext /* context */, _Xconst char* /* data */ ); extern int XSetClassHint( Display* /* display */, Window /* w */, XClassHint* /* class_hints */ ); extern int XSetIconSizes( Display* /* display */, Window /* w */, XIconSize* /* size_list */, int /* count */ ); extern int XSetNormalHints( Display* /* display */, Window /* w */, XSizeHints* /* hints */ ); extern void XSetRGBColormaps( Display* /* display */, Window /* w */, XStandardColormap* /* stdcmaps */, int /* count */, Atom /* property */ ); extern int XSetSizeHints( Display* /* display */, Window /* w */, XSizeHints* /* hints */, Atom /* property */ ); extern int XSetStandardProperties( Display* /* display */, Window /* w */, _Xconst char* /* window_name */, _Xconst char* /* icon_name */, Pixmap /* icon_pixmap */, char** /* argv */, int /* argc */, XSizeHints* /* hints */ ); extern void XSetTextProperty( Display* /* display */, Window /* w */, XTextProperty* /* text_prop */, Atom /* property */ ); extern void XSetWMClientMachine( Display* /* display */, Window /* w */, XTextProperty* /* text_prop */ ); extern int XSetWMHints( Display* /* display */, Window /* w */, XWMHints* /* wm_hints */ ); extern void XSetWMIconName( Display* /* display */, Window /* w */, XTextProperty* /* text_prop */ ); extern void XSetWMName( Display* /* display */, Window /* w */, XTextProperty* /* text_prop */ ); extern void XSetWMNormalHints( Display* /* display */, Window /* w */, XSizeHints* /* hints */ ); extern void XSetWMProperties( Display* /* display */, Window /* w */, XTextProperty* /* window_name */, XTextProperty* /* icon_name */, char** /* argv */, int /* argc */, XSizeHints* /* normal_hints */, XWMHints* /* wm_hints */, XClassHint* /* class_hints */ ); extern void XmbSetWMProperties( Display* /* display */, Window /* w */, _Xconst char* /* window_name */, _Xconst char* /* icon_name */, char** /* argv */, int /* argc */, XSizeHints* /* normal_hints */, XWMHints* /* wm_hints */, XClassHint* /* class_hints */ ); extern void Xutf8SetWMProperties( Display* /* display */, Window /* w */, _Xconst char* /* window_name */, _Xconst char* /* icon_name */, char** /* argv */, int /* argc */, XSizeHints* /* normal_hints */, XWMHints* /* wm_hints */, XClassHint* /* class_hints */ ); extern void XSetWMSizeHints( Display* /* display */, Window /* w */, XSizeHints* /* hints */, Atom /* property */ ); extern int XSetRegion( Display* /* display */, GC /* gc */, Region /* r */ ); extern void XSetStandardColormap( Display* /* display */, Window /* w */, XStandardColormap* /* colormap */, Atom /* property */ ); extern int XSetZoomHints( Display* /* display */, Window /* w */, XSizeHints* /* zhints */ ); extern int XShrinkRegion( Region /* r */, int /* dx */, int /* dy */ ); extern Status XStringListToTextProperty( char** /* list */, int /* count */, XTextProperty* /* text_prop_return */ ); extern int XSubtractRegion( Region /* sra */, Region /* srb */, Region /* dr_return */ ); extern int XmbTextListToTextProperty( Display* display, char** list, int count, XICCEncodingStyle style, XTextProperty* text_prop_return ); extern int XwcTextListToTextProperty( Display* display, wchar_t** list, int count, XICCEncodingStyle style, XTextProperty* text_prop_return ); extern int Xutf8TextListToTextProperty( Display* display, char** list, int count, XICCEncodingStyle style, XTextProperty* text_prop_return ); extern void XwcFreeStringList( wchar_t** list ); extern Status XTextPropertyToStringList( XTextProperty* /* text_prop */, char*** /* list_return */, int* /* count_return */ ); extern int XmbTextPropertyToTextList( Display* display, const XTextProperty* text_prop, char*** list_return, int* count_return ); extern int XwcTextPropertyToTextList( Display* display, const XTextProperty* text_prop, wchar_t*** list_return, int* count_return ); extern int Xutf8TextPropertyToTextList( Display* display, const XTextProperty* text_prop, char*** list_return, int* count_return ); extern int XUnionRectWithRegion( XRectangle* /* rectangle */, Region /* src_region */, Region /* dest_region_return */ ); extern int XUnionRegion( Region /* sra */, Region /* srb */, Region /* dr_return */ ); extern int XWMGeometry( Display* /* display */, int /* screen_number */, _Xconst char* /* user_geometry */, _Xconst char* /* default_geometry */, unsigned int /* border_width */, XSizeHints* /* hints */, int* /* x_return */, int* /* y_return */, int* /* width_return */, int* /* height_return */, int* /* gravity_return */ ); extern int XXorRegion( Region /* sra */, Region /* srb */, Region /* dr_return */ ); #ifdef __clang__ #pragma clang diagnostic pop #endif _XFUNCPROTOEND #endif /* _X11_XUTIL_H_ */ X11/DECkeysym.h000064400000005404147631660250007140 0ustar00/*********************************************************** Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* * DEC private keysyms * (29th bit set) */ /* two-key compose sequence initiators, chosen to map to Latin1 characters */ #define DXK_ring_accent 0x1000FEB0 #define DXK_circumflex_accent 0x1000FE5E #define DXK_cedilla_accent 0x1000FE2C #define DXK_acute_accent 0x1000FE27 #define DXK_grave_accent 0x1000FE60 #define DXK_tilde 0x1000FE7E #define DXK_diaeresis 0x1000FE22 /* special keysym for LK2** "Remove" key on editing keypad */ #define DXK_Remove 0x1000FF00 /* Remove */ X11/Xauth.h000064400000007351147631660250006377 0ustar00/* Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _Xauth_h #define _Xauth_h /* struct xauth is full of implicit padding to properly align the pointers after the length fields. We can't clean that up without breaking ABI, so tell clang not to bother complaining about it. */ #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpadded" #endif typedef struct xauth { unsigned short family; unsigned short address_length; char *address; unsigned short number_length; char *number; unsigned short name_length; char *name; unsigned short data_length; char *data; } Xauth; #ifdef __clang__ #pragma clang diagnostic pop #endif #ifndef _XAUTH_STRUCT_ONLY # include # include # include # define FamilyLocal (256) /* not part of X standard (i.e. X.h) */ # define FamilyWild (65535) # define FamilyNetname (254) /* not part of X standard */ # define FamilyKrb5Principal (253) /* Kerberos 5 principal name */ # define FamilyLocalHost (252) /* for local non-net authentication */ _XFUNCPROTOBEGIN char *XauFileName(void); Xauth *XauReadAuth( FILE* /* auth_file */ ); int XauLockAuth( _Xconst char* /* file_name */, int /* retries */, int /* timeout */, long /* dead */ ); int XauUnlockAuth( _Xconst char* /* file_name */ ); int XauWriteAuth( FILE* /* auth_file */, Xauth* /* auth */ ); Xauth *XauGetAuthByAddr( #if NeedWidePrototypes unsigned int /* family */, unsigned int /* address_length */, #else unsigned short /* family */, unsigned short /* address_length */, #endif _Xconst char* /* address */, #if NeedWidePrototypes unsigned int /* number_length */, #else unsigned short /* number_length */, #endif _Xconst char* /* number */, #if NeedWidePrototypes unsigned int /* name_length */, #else unsigned short /* name_length */, #endif _Xconst char* /* name */ ); Xauth *XauGetBestAuthByAddr( #if NeedWidePrototypes unsigned int /* family */, unsigned int /* address_length */, #else unsigned short /* family */, unsigned short /* address_length */, #endif _Xconst char* /* address */, #if NeedWidePrototypes unsigned int /* number_length */, #else unsigned short /* number_length */, #endif _Xconst char* /* number */, int /* types_length */, char** /* type_names */, _Xconst int* /* type_lengths */ ); void XauDisposeAuth( Xauth* /* auth */ ); _XFUNCPROTOEND /* Return values from XauLockAuth */ # define LOCK_SUCCESS 0 /* lock succeeded */ # define LOCK_ERROR 1 /* lock unexpectely failed, check errno */ # define LOCK_TIMEOUT 2 /* lock failed, timeouts expired */ #endif /* _XAUTH_STRUCT_ONLY */ #endif /* _Xauth_h */ X11/Xlib.h000064400000302314147631660250006201 0ustar00/* Copyright 1985, 1986, 1987, 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Xlib.h - Header definition and support file for the C subroutine * interface library (Xlib) to the X Window System Protocol (V11). * Structures and symbols starting with "_" are private to the library. */ #ifndef _X11_XLIB_H_ #define _X11_XLIB_H_ #define XlibSpecificationRelease 6 #include #if defined(__SCO__) || defined(__UNIXWARE__) #include #endif #include /* applications should not depend on these two headers being included! */ #include #include #ifndef X_WCHAR #include #else #ifdef __UNIXOS2__ #include #else /* replace this with #include or typedef appropriate for your system */ typedef unsigned long wchar_t; #endif #endif extern int _Xmblen( char *str, int len ); /* API mentioning "UTF8" or "utf8" is an XFree86 extension, introduced in November 2000. Its presence is indicated through the following macro. */ #define X_HAVE_UTF8_STRING 1 /* The Xlib structs are full of implicit padding to properly align members. We can't clean that up without breaking ABI, so tell clang not to bother complaining about it. */ #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpadded" #endif typedef char *XPointer; #define Bool int #define Status int #define True 1 #define False 0 #define QueuedAlready 0 #define QueuedAfterReading 1 #define QueuedAfterFlush 2 #define ConnectionNumber(dpy) (((_XPrivDisplay)(dpy))->fd) #define RootWindow(dpy, scr) (ScreenOfDisplay(dpy,scr)->root) #define DefaultScreen(dpy) (((_XPrivDisplay)(dpy))->default_screen) #define DefaultRootWindow(dpy) (ScreenOfDisplay(dpy,DefaultScreen(dpy))->root) #define DefaultVisual(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_visual) #define DefaultGC(dpy, scr) (ScreenOfDisplay(dpy,scr)->default_gc) #define BlackPixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->black_pixel) #define WhitePixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->white_pixel) #define AllPlanes ((unsigned long)~0L) #define QLength(dpy) (((_XPrivDisplay)(dpy))->qlen) #define DisplayWidth(dpy, scr) (ScreenOfDisplay(dpy,scr)->width) #define DisplayHeight(dpy, scr) (ScreenOfDisplay(dpy,scr)->height) #define DisplayWidthMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mwidth) #define DisplayHeightMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mheight) #define DisplayPlanes(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_depth) #define DisplayCells(dpy, scr) (DefaultVisual(dpy,scr)->map_entries) #define ScreenCount(dpy) (((_XPrivDisplay)(dpy))->nscreens) #define ServerVendor(dpy) (((_XPrivDisplay)(dpy))->vendor) #define ProtocolVersion(dpy) (((_XPrivDisplay)(dpy))->proto_major_version) #define ProtocolRevision(dpy) (((_XPrivDisplay)(dpy))->proto_minor_version) #define VendorRelease(dpy) (((_XPrivDisplay)(dpy))->release) #define DisplayString(dpy) (((_XPrivDisplay)(dpy))->display_name) #define DefaultDepth(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_depth) #define DefaultColormap(dpy, scr)(ScreenOfDisplay(dpy,scr)->cmap) #define BitmapUnit(dpy) (((_XPrivDisplay)(dpy))->bitmap_unit) #define BitmapBitOrder(dpy) (((_XPrivDisplay)(dpy))->bitmap_bit_order) #define BitmapPad(dpy) (((_XPrivDisplay)(dpy))->bitmap_pad) #define ImageByteOrder(dpy) (((_XPrivDisplay)(dpy))->byte_order) #define NextRequest(dpy) (((_XPrivDisplay)(dpy))->request + 1) #define LastKnownRequestProcessed(dpy) (((_XPrivDisplay)(dpy))->last_request_read) /* macros for screen oriented applications (toolkit) */ #define ScreenOfDisplay(dpy, scr)(&((_XPrivDisplay)(dpy))->screens[scr]) #define DefaultScreenOfDisplay(dpy) ScreenOfDisplay(dpy,DefaultScreen(dpy)) #define DisplayOfScreen(s) ((s)->display) #define RootWindowOfScreen(s) ((s)->root) #define BlackPixelOfScreen(s) ((s)->black_pixel) #define WhitePixelOfScreen(s) ((s)->white_pixel) #define DefaultColormapOfScreen(s)((s)->cmap) #define DefaultDepthOfScreen(s) ((s)->root_depth) #define DefaultGCOfScreen(s) ((s)->default_gc) #define DefaultVisualOfScreen(s)((s)->root_visual) #define WidthOfScreen(s) ((s)->width) #define HeightOfScreen(s) ((s)->height) #define WidthMMOfScreen(s) ((s)->mwidth) #define HeightMMOfScreen(s) ((s)->mheight) #define PlanesOfScreen(s) ((s)->root_depth) #define CellsOfScreen(s) (DefaultVisualOfScreen((s))->map_entries) #define MinCmapsOfScreen(s) ((s)->min_maps) #define MaxCmapsOfScreen(s) ((s)->max_maps) #define DoesSaveUnders(s) ((s)->save_unders) #define DoesBackingStore(s) ((s)->backing_store) #define EventMaskOfScreen(s) ((s)->root_input_mask) /* * Extensions need a way to hang private data on some structures. */ typedef struct _XExtData { int number; /* number returned by XRegisterExtension */ struct _XExtData *next; /* next item on list of data for structure */ int (*free_private)( /* called to free private storage */ struct _XExtData *extension ); XPointer private_data; /* data private to this extension. */ } XExtData; /* * This file contains structures used by the extension mechanism. */ typedef struct { /* public to extension, cannot be changed */ int extension; /* extension number */ int major_opcode; /* major op-code assigned by server */ int first_event; /* first event number for the extension */ int first_error; /* first error number for the extension */ } XExtCodes; /* * Data structure for retrieving info about pixmap formats. */ typedef struct { int depth; int bits_per_pixel; int scanline_pad; } XPixmapFormatValues; /* * Data structure for setting graphics context. */ typedef struct { int function; /* logical operation */ unsigned long plane_mask;/* plane mask */ unsigned long foreground;/* foreground pixel */ unsigned long background;/* background pixel */ int line_width; /* line width */ int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */ int cap_style; /* CapNotLast, CapButt, CapRound, CapProjecting */ int join_style; /* JoinMiter, JoinRound, JoinBevel */ int fill_style; /* FillSolid, FillTiled, FillStippled, FillOpaeueStippled */ int fill_rule; /* EvenOddRule, WindingRule */ int arc_mode; /* ArcChord, ArcPieSlice */ Pixmap tile; /* tile pixmap for tiling operations */ Pixmap stipple; /* stipple 1 plane pixmap for stipping */ int ts_x_origin; /* offset for tile or stipple operations */ int ts_y_origin; Font font; /* default text font for text operations */ int subwindow_mode; /* ClipByChildren, IncludeInferiors */ Bool graphics_exposures;/* boolean, should exposures be generated */ int clip_x_origin; /* origin for clipping */ int clip_y_origin; Pixmap clip_mask; /* bitmap clipping; other calls for rects */ int dash_offset; /* patterned/dashed line information */ char dashes; } XGCValues; /* * Graphics context. The contents of this structure are implementation * dependent. A GC should be treated as opaque by application code. */ typedef struct _XGC #ifdef XLIB_ILLEGAL_ACCESS { XExtData *ext_data; /* hook for extension to hang data */ GContext gid; /* protocol ID for graphics context */ /* there is more to this structure, but it is private to Xlib */ } #endif *GC; /* * Visual structure; contains information about colormapping possible. */ typedef struct { XExtData *ext_data; /* hook for extension to hang data */ VisualID visualid; /* visual id of this visual */ #if defined(__cplusplus) || defined(c_plusplus) int c_class; /* C++ class of screen (monochrome, etc.) */ #else int class; /* class of screen (monochrome, etc.) */ #endif unsigned long red_mask, green_mask, blue_mask; /* mask values */ int bits_per_rgb; /* log base 2 of distinct color values */ int map_entries; /* color map entries */ } Visual; /* * Depth structure; contains information for each possible depth. */ typedef struct { int depth; /* this depth (Z) of the depth */ int nvisuals; /* number of Visual types at this depth */ Visual *visuals; /* list of visuals possible at this depth */ } Depth; /* * Information about the screen. The contents of this structure are * implementation dependent. A Screen should be treated as opaque * by application code. */ struct _XDisplay; /* Forward declare before use for C++ */ typedef struct { XExtData *ext_data; /* hook for extension to hang data */ struct _XDisplay *display;/* back pointer to display structure */ Window root; /* Root window id. */ int width, height; /* width and height of screen */ int mwidth, mheight; /* width and height of in millimeters */ int ndepths; /* number of depths possible */ Depth *depths; /* list of allowable depths on the screen */ int root_depth; /* bits per pixel */ Visual *root_visual; /* root visual */ GC default_gc; /* GC for the root root visual */ Colormap cmap; /* default color map */ unsigned long white_pixel; unsigned long black_pixel; /* White and Black pixel values */ int max_maps, min_maps; /* max and min color maps */ int backing_store; /* Never, WhenMapped, Always */ Bool save_unders; long root_input_mask; /* initial root input mask */ } Screen; /* * Format structure; describes ZFormat data the screen will understand. */ typedef struct { XExtData *ext_data; /* hook for extension to hang data */ int depth; /* depth of this image format */ int bits_per_pixel; /* bits/pixel at this depth */ int scanline_pad; /* scanline must padded to this multiple */ } ScreenFormat; /* * Data structure for setting window attributes. */ typedef struct { Pixmap background_pixmap; /* background or None or ParentRelative */ unsigned long background_pixel; /* background pixel */ Pixmap border_pixmap; /* border of the window */ unsigned long border_pixel; /* border pixel value */ int bit_gravity; /* one of bit gravity values */ int win_gravity; /* one of the window gravity values */ int backing_store; /* NotUseful, WhenMapped, Always */ unsigned long backing_planes;/* planes to be preseved if possible */ unsigned long backing_pixel;/* value to use in restoring planes */ Bool save_under; /* should bits under be saved? (popups) */ long event_mask; /* set of events that should be saved */ long do_not_propagate_mask; /* set of events that should not propagate */ Bool override_redirect; /* boolean value for override-redirect */ Colormap colormap; /* color map to be associated with window */ Cursor cursor; /* cursor to be displayed (or None) */ } XSetWindowAttributes; typedef struct { int x, y; /* location of window */ int width, height; /* width and height of window */ int border_width; /* border width of window */ int depth; /* depth of window */ Visual *visual; /* the associated visual structure */ Window root; /* root of screen containing window */ #if defined(__cplusplus) || defined(c_plusplus) int c_class; /* C++ InputOutput, InputOnly*/ #else int class; /* InputOutput, InputOnly*/ #endif int bit_gravity; /* one of bit gravity values */ int win_gravity; /* one of the window gravity values */ int backing_store; /* NotUseful, WhenMapped, Always */ unsigned long backing_planes;/* planes to be preserved if possible */ unsigned long backing_pixel;/* value to be used when restoring planes */ Bool save_under; /* boolean, should bits under be saved? */ Colormap colormap; /* color map to be associated with window */ Bool map_installed; /* boolean, is color map currently installed*/ int map_state; /* IsUnmapped, IsUnviewable, IsViewable */ long all_event_masks; /* set of events all people have interest in*/ long your_event_mask; /* my event mask */ long do_not_propagate_mask; /* set of events that should not propagate */ Bool override_redirect; /* boolean value for override-redirect */ Screen *screen; /* back pointer to correct screen */ } XWindowAttributes; /* * Data structure for host setting; getting routines. * */ typedef struct { int family; /* for example FamilyInternet */ int length; /* length of address, in bytes */ char *address; /* pointer to where to find the bytes */ } XHostAddress; /* * Data structure for ServerFamilyInterpreted addresses in host routines */ typedef struct { int typelength; /* length of type string, in bytes */ int valuelength; /* length of value string, in bytes */ char *type; /* pointer to where to find the type string */ char *value; /* pointer to where to find the address */ } XServerInterpretedAddress; /* * Data structure for "image" data, used by image manipulation routines. */ typedef struct _XImage { int width, height; /* size of image */ int xoffset; /* number of pixels offset in X direction */ int format; /* XYBitmap, XYPixmap, ZPixmap */ char *data; /* pointer to image data */ int byte_order; /* data byte order, LSBFirst, MSBFirst */ int bitmap_unit; /* quant. of scanline 8, 16, 32 */ int bitmap_bit_order; /* LSBFirst, MSBFirst */ int bitmap_pad; /* 8, 16, 32 either XY or ZPixmap */ int depth; /* depth of image */ int bytes_per_line; /* accelarator to next line */ int bits_per_pixel; /* bits per pixel (ZPixmap) */ unsigned long red_mask; /* bits in z arrangment */ unsigned long green_mask; unsigned long blue_mask; XPointer obdata; /* hook for the object routines to hang on */ struct funcs { /* image manipulation routines */ struct _XImage *(*create_image)( struct _XDisplay* /* display */, Visual* /* visual */, unsigned int /* depth */, int /* format */, int /* offset */, char* /* data */, unsigned int /* width */, unsigned int /* height */, int /* bitmap_pad */, int /* bytes_per_line */); int (*destroy_image) (struct _XImage *); unsigned long (*get_pixel) (struct _XImage *, int, int); int (*put_pixel) (struct _XImage *, int, int, unsigned long); struct _XImage *(*sub_image)(struct _XImage *, int, int, unsigned int, unsigned int); int (*add_pixel) (struct _XImage *, long); } f; } XImage; /* * Data structure for XReconfigureWindow */ typedef struct { int x, y; int width, height; int border_width; Window sibling; int stack_mode; } XWindowChanges; /* * Data structure used by color operations */ typedef struct { unsigned long pixel; unsigned short red, green, blue; char flags; /* do_red, do_green, do_blue */ char pad; } XColor; /* * Data structures for graphics operations. On most machines, these are * congruent with the wire protocol structures, so reformatting the data * can be avoided on these architectures. */ typedef struct { short x1, y1, x2, y2; } XSegment; typedef struct { short x, y; } XPoint; typedef struct { short x, y; unsigned short width, height; } XRectangle; typedef struct { short x, y; unsigned short width, height; short angle1, angle2; } XArc; /* Data structure for XChangeKeyboardControl */ typedef struct { int key_click_percent; int bell_percent; int bell_pitch; int bell_duration; int led; int led_mode; int key; int auto_repeat_mode; /* On, Off, Default */ } XKeyboardControl; /* Data structure for XGetKeyboardControl */ typedef struct { int key_click_percent; int bell_percent; unsigned int bell_pitch, bell_duration; unsigned long led_mask; int global_auto_repeat; char auto_repeats[32]; } XKeyboardState; /* Data structure for XGetMotionEvents. */ typedef struct { Time time; short x, y; } XTimeCoord; /* Data structure for X{Set,Get}ModifierMapping */ typedef struct { int max_keypermod; /* The server's max # of keys per modifier */ KeyCode *modifiermap; /* An 8 by max_keypermod array of modifiers */ } XModifierKeymap; /* * Display datatype maintaining display specific data. * The contents of this structure are implementation dependent. * A Display should be treated as opaque by application code. */ #ifndef XLIB_ILLEGAL_ACCESS typedef struct _XDisplay Display; #endif struct _XPrivate; /* Forward declare before use for C++ */ struct _XrmHashBucketRec; typedef struct #ifdef XLIB_ILLEGAL_ACCESS _XDisplay #endif { XExtData *ext_data; /* hook for extension to hang data */ struct _XPrivate *private1; int fd; /* Network socket. */ int private2; int proto_major_version;/* major version of server's X protocol */ int proto_minor_version;/* minor version of servers X protocol */ char *vendor; /* vendor of the server hardware */ XID private3; XID private4; XID private5; int private6; XID (*resource_alloc)( /* allocator function */ struct _XDisplay* ); int byte_order; /* screen byte order, LSBFirst, MSBFirst */ int bitmap_unit; /* padding and data requirements */ int bitmap_pad; /* padding requirements on bitmaps */ int bitmap_bit_order; /* LeastSignificant or MostSignificant */ int nformats; /* number of pixmap formats in list */ ScreenFormat *pixmap_format; /* pixmap format list */ int private8; int release; /* release of the server */ struct _XPrivate *private9, *private10; int qlen; /* Length of input event queue */ unsigned long last_request_read; /* seq number of last event read */ unsigned long request; /* sequence number of last request. */ XPointer private11; XPointer private12; XPointer private13; XPointer private14; unsigned max_request_size; /* maximum number 32 bit words in request*/ struct _XrmHashBucketRec *db; int (*private15)( struct _XDisplay* ); char *display_name; /* "host:display" string used on this connect*/ int default_screen; /* default screen for operations */ int nscreens; /* number of screens on this server*/ Screen *screens; /* pointer to list of screens */ unsigned long motion_buffer; /* size of motion buffer */ unsigned long private16; int min_keycode; /* minimum defined keycode */ int max_keycode; /* maximum defined keycode */ XPointer private17; XPointer private18; int private19; char *xdefaults; /* contents of defaults from server */ /* there is more to this structure, but it is private to Xlib */ } #ifdef XLIB_ILLEGAL_ACCESS Display, #endif *_XPrivDisplay; #undef _XEVENT_ #ifndef _XEVENT_ /* * Definitions of specific events. */ typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window it is reported relative to */ Window root; /* root window that the event occurred on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* pointer x, y coordinates in event window */ int x_root, y_root; /* coordinates relative to root */ unsigned int state; /* key or button mask */ unsigned int keycode; /* detail */ Bool same_screen; /* same screen flag */ } XKeyEvent; typedef XKeyEvent XKeyPressedEvent; typedef XKeyEvent XKeyReleasedEvent; typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window it is reported relative to */ Window root; /* root window that the event occurred on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* pointer x, y coordinates in event window */ int x_root, y_root; /* coordinates relative to root */ unsigned int state; /* key or button mask */ unsigned int button; /* detail */ Bool same_screen; /* same screen flag */ } XButtonEvent; typedef XButtonEvent XButtonPressedEvent; typedef XButtonEvent XButtonReleasedEvent; typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window reported relative to */ Window root; /* root window that the event occurred on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* pointer x, y coordinates in event window */ int x_root, y_root; /* coordinates relative to root */ unsigned int state; /* key or button mask */ char is_hint; /* detail */ Bool same_screen; /* same screen flag */ } XMotionEvent; typedef XMotionEvent XPointerMovedEvent; typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window reported relative to */ Window root; /* root window that the event occurred on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* pointer x, y coordinates in event window */ int x_root, y_root; /* coordinates relative to root */ int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */ int detail; /* * NotifyAncestor, NotifyVirtual, NotifyInferior, * NotifyNonlinear,NotifyNonlinearVirtual */ Bool same_screen; /* same screen flag */ Bool focus; /* boolean focus */ unsigned int state; /* key or button mask */ } XCrossingEvent; typedef XCrossingEvent XEnterWindowEvent; typedef XCrossingEvent XLeaveWindowEvent; typedef struct { int type; /* FocusIn or FocusOut */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* window of event */ int mode; /* NotifyNormal, NotifyWhileGrabbed, NotifyGrab, NotifyUngrab */ int detail; /* * NotifyAncestor, NotifyVirtual, NotifyInferior, * NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer, * NotifyPointerRoot, NotifyDetailNone */ } XFocusChangeEvent; typedef XFocusChangeEvent XFocusInEvent; typedef XFocusChangeEvent XFocusOutEvent; /* generated on EnterWindow and FocusIn when KeyMapState selected */ typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; char key_vector[32]; } XKeymapEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; int x, y; int width, height; int count; /* if non-zero, at least this many more */ } XExposeEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Drawable drawable; int x, y; int width, height; int count; /* if non-zero, at least this many more */ int major_code; /* core is CopyArea or CopyPlane */ int minor_code; /* not defined in the core */ } XGraphicsExposeEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Drawable drawable; int major_code; /* core is CopyArea or CopyPlane */ int minor_code; /* not defined in the core */ } XNoExposeEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; int state; /* Visibility state */ } XVisibilityEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window parent; /* parent of the window */ Window window; /* window id of window created */ int x, y; /* window location */ int width, height; /* size of window */ int border_width; /* border width */ Bool override_redirect; /* creation should be overridden */ } XCreateWindowEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; } XDestroyWindowEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; Bool from_configure; } XUnmapEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; Bool override_redirect; /* boolean, is override set... */ } XMapEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window parent; Window window; } XMapRequestEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; Window parent; int x, y; Bool override_redirect; } XReparentEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; int x, y; int width, height; int border_width; Window above; Bool override_redirect; } XConfigureEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; int x, y; } XGravityEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; int width, height; } XResizeRequestEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window parent; Window window; int x, y; int width, height; int border_width; Window above; int detail; /* Above, Below, TopIf, BottomIf, Opposite */ unsigned long value_mask; } XConfigureRequestEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; int place; /* PlaceOnTop, PlaceOnBottom */ } XCirculateEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window parent; Window window; int place; /* PlaceOnTop, PlaceOnBottom */ } XCirculateRequestEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; Atom atom; Time time; int state; /* NewValue, Deleted */ } XPropertyEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; Atom selection; Time time; } XSelectionClearEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window owner; Window requestor; Atom selection; Atom target; Atom property; Time time; } XSelectionRequestEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window requestor; Atom selection; Atom target; Atom property; /* ATOM or None */ Time time; } XSelectionEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; Colormap colormap; /* COLORMAP or None */ #if defined(__cplusplus) || defined(c_plusplus) Bool c_new; /* C++ */ #else Bool new; #endif int state; /* ColormapInstalled, ColormapUninstalled */ } XColormapEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; Atom message_type; int format; union { char b[20]; short s[10]; long l[5]; } data; } XClientMessageEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* unused */ int request; /* one of MappingModifier, MappingKeyboard, MappingPointer */ int first_keycode; /* first keycode */ int count; /* defines range of change w. first_keycode*/ } XMappingEvent; typedef struct { int type; Display *display; /* Display the event was read from */ XID resourceid; /* resource id */ unsigned long serial; /* serial number of failed request */ unsigned char error_code; /* error code of failed request */ unsigned char request_code; /* Major op-code of failed request */ unsigned char minor_code; /* Minor op-code of failed request */ } XErrorEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display;/* Display the event was read from */ Window window; /* window on which event was requested in event mask */ } XAnyEvent; /*************************************************************** * * GenericEvent. This event is the standard event for all newer extensions. */ typedef struct { int type; /* of event. Always GenericEvent */ unsigned long serial; /* # of last request processed */ Bool send_event; /* true if from SendEvent request */ Display *display; /* Display the event was read from */ int extension; /* major opcode of extension that caused the event */ int evtype; /* actual event type. */ } XGenericEvent; typedef struct { int type; /* of event. Always GenericEvent */ unsigned long serial; /* # of last request processed */ Bool send_event; /* true if from SendEvent request */ Display *display; /* Display the event was read from */ int extension; /* major opcode of extension that caused the event */ int evtype; /* actual event type. */ unsigned int cookie; void *data; } XGenericEventCookie; /* * this union is defined so Xlib can always use the same sized * event structure internally, to avoid memory fragmentation. */ typedef union _XEvent { int type; /* must not be changed; first element */ XAnyEvent xany; XKeyEvent xkey; XButtonEvent xbutton; XMotionEvent xmotion; XCrossingEvent xcrossing; XFocusChangeEvent xfocus; XExposeEvent xexpose; XGraphicsExposeEvent xgraphicsexpose; XNoExposeEvent xnoexpose; XVisibilityEvent xvisibility; XCreateWindowEvent xcreatewindow; XDestroyWindowEvent xdestroywindow; XUnmapEvent xunmap; XMapEvent xmap; XMapRequestEvent xmaprequest; XReparentEvent xreparent; XConfigureEvent xconfigure; XGravityEvent xgravity; XResizeRequestEvent xresizerequest; XConfigureRequestEvent xconfigurerequest; XCirculateEvent xcirculate; XCirculateRequestEvent xcirculaterequest; XPropertyEvent xproperty; XSelectionClearEvent xselectionclear; XSelectionRequestEvent xselectionrequest; XSelectionEvent xselection; XColormapEvent xcolormap; XClientMessageEvent xclient; XMappingEvent xmapping; XErrorEvent xerror; XKeymapEvent xkeymap; XGenericEvent xgeneric; XGenericEventCookie xcookie; long pad[24]; } XEvent; #endif #define XAllocID(dpy) ((*((_XPrivDisplay)(dpy))->resource_alloc)((dpy))) /* * per character font metric information. */ typedef struct { short lbearing; /* origin to left edge of raster */ short rbearing; /* origin to right edge of raster */ short width; /* advance to next char's origin */ short ascent; /* baseline to top edge of raster */ short descent; /* baseline to bottom edge of raster */ unsigned short attributes; /* per char flags (not predefined) */ } XCharStruct; /* * To allow arbitrary information with fonts, there are additional properties * returned. */ typedef struct { Atom name; unsigned long card32; } XFontProp; typedef struct { XExtData *ext_data; /* hook for extension to hang data */ Font fid; /* Font id for this font */ unsigned direction; /* hint about direction the font is painted */ unsigned min_char_or_byte2;/* first character */ unsigned max_char_or_byte2;/* last character */ unsigned min_byte1; /* first row that exists */ unsigned max_byte1; /* last row that exists */ Bool all_chars_exist;/* flag if all characters have non-zero size*/ unsigned default_char; /* char to print for undefined character */ int n_properties; /* how many properties there are */ XFontProp *properties; /* pointer to array of additional properties*/ XCharStruct min_bounds; /* minimum bounds over all existing char*/ XCharStruct max_bounds; /* maximum bounds over all existing char*/ XCharStruct *per_char; /* first_char to last_char information */ int ascent; /* log. extent above baseline for spacing */ int descent; /* log. descent below baseline for spacing */ } XFontStruct; /* * PolyText routines take these as arguments. */ typedef struct { char *chars; /* pointer to string */ int nchars; /* number of characters */ int delta; /* delta between strings */ Font font; /* font to print it in, None don't change */ } XTextItem; typedef struct { /* normal 16 bit characters are two bytes */ unsigned char byte1; unsigned char byte2; } XChar2b; typedef struct { XChar2b *chars; /* two byte characters */ int nchars; /* number of characters */ int delta; /* delta between strings */ Font font; /* font to print it in, None don't change */ } XTextItem16; typedef union { Display *display; GC gc; Visual *visual; Screen *screen; ScreenFormat *pixmap_format; XFontStruct *font; } XEDataObject; typedef struct { XRectangle max_ink_extent; XRectangle max_logical_extent; } XFontSetExtents; /* unused: typedef void (*XOMProc)(); */ typedef struct _XOM *XOM; typedef struct _XOC *XOC, *XFontSet; typedef struct { char *chars; int nchars; int delta; XFontSet font_set; } XmbTextItem; typedef struct { wchar_t *chars; int nchars; int delta; XFontSet font_set; } XwcTextItem; #define XNRequiredCharSet "requiredCharSet" #define XNQueryOrientation "queryOrientation" #define XNBaseFontName "baseFontName" #define XNOMAutomatic "omAutomatic" #define XNMissingCharSet "missingCharSet" #define XNDefaultString "defaultString" #define XNOrientation "orientation" #define XNDirectionalDependentDrawing "directionalDependentDrawing" #define XNContextualDrawing "contextualDrawing" #define XNFontInfo "fontInfo" typedef struct { int charset_count; char **charset_list; } XOMCharSetList; typedef enum { XOMOrientation_LTR_TTB, XOMOrientation_RTL_TTB, XOMOrientation_TTB_LTR, XOMOrientation_TTB_RTL, XOMOrientation_Context } XOrientation; typedef struct { int num_orientation; XOrientation *orientation; /* Input Text description */ } XOMOrientation; typedef struct { int num_font; XFontStruct **font_struct_list; char **font_name_list; } XOMFontInfo; typedef struct _XIM *XIM; typedef struct _XIC *XIC; typedef void (*XIMProc)( XIM, XPointer, XPointer ); typedef Bool (*XICProc)( XIC, XPointer, XPointer ); typedef void (*XIDProc)( Display*, XPointer, XPointer ); typedef unsigned long XIMStyle; typedef struct { unsigned short count_styles; XIMStyle *supported_styles; } XIMStyles; #define XIMPreeditArea 0x0001L #define XIMPreeditCallbacks 0x0002L #define XIMPreeditPosition 0x0004L #define XIMPreeditNothing 0x0008L #define XIMPreeditNone 0x0010L #define XIMStatusArea 0x0100L #define XIMStatusCallbacks 0x0200L #define XIMStatusNothing 0x0400L #define XIMStatusNone 0x0800L #define XNVaNestedList "XNVaNestedList" #define XNQueryInputStyle "queryInputStyle" #define XNClientWindow "clientWindow" #define XNInputStyle "inputStyle" #define XNFocusWindow "focusWindow" #define XNResourceName "resourceName" #define XNResourceClass "resourceClass" #define XNGeometryCallback "geometryCallback" #define XNDestroyCallback "destroyCallback" #define XNFilterEvents "filterEvents" #define XNPreeditStartCallback "preeditStartCallback" #define XNPreeditDoneCallback "preeditDoneCallback" #define XNPreeditDrawCallback "preeditDrawCallback" #define XNPreeditCaretCallback "preeditCaretCallback" #define XNPreeditStateNotifyCallback "preeditStateNotifyCallback" #define XNPreeditAttributes "preeditAttributes" #define XNStatusStartCallback "statusStartCallback" #define XNStatusDoneCallback "statusDoneCallback" #define XNStatusDrawCallback "statusDrawCallback" #define XNStatusAttributes "statusAttributes" #define XNArea "area" #define XNAreaNeeded "areaNeeded" #define XNSpotLocation "spotLocation" #define XNColormap "colorMap" #define XNStdColormap "stdColorMap" #define XNForeground "foreground" #define XNBackground "background" #define XNBackgroundPixmap "backgroundPixmap" #define XNFontSet "fontSet" #define XNLineSpace "lineSpace" #define XNCursor "cursor" #define XNQueryIMValuesList "queryIMValuesList" #define XNQueryICValuesList "queryICValuesList" #define XNVisiblePosition "visiblePosition" #define XNR6PreeditCallback "r6PreeditCallback" #define XNStringConversionCallback "stringConversionCallback" #define XNStringConversion "stringConversion" #define XNResetState "resetState" #define XNHotKey "hotKey" #define XNHotKeyState "hotKeyState" #define XNPreeditState "preeditState" #define XNSeparatorofNestedList "separatorofNestedList" #define XBufferOverflow -1 #define XLookupNone 1 #define XLookupChars 2 #define XLookupKeySym 3 #define XLookupBoth 4 typedef void *XVaNestedList; typedef struct { XPointer client_data; XIMProc callback; } XIMCallback; typedef struct { XPointer client_data; XICProc callback; } XICCallback; typedef unsigned long XIMFeedback; #define XIMReverse 1L #define XIMUnderline (1L<<1) #define XIMHighlight (1L<<2) #define XIMPrimary (1L<<5) #define XIMSecondary (1L<<6) #define XIMTertiary (1L<<7) #define XIMVisibleToForward (1L<<8) #define XIMVisibleToBackword (1L<<9) #define XIMVisibleToCenter (1L<<10) typedef struct _XIMText { unsigned short length; XIMFeedback *feedback; Bool encoding_is_wchar; union { char *multi_byte; wchar_t *wide_char; } string; } XIMText; typedef unsigned long XIMPreeditState; #define XIMPreeditUnKnown 0L #define XIMPreeditEnable 1L #define XIMPreeditDisable (1L<<1) typedef struct _XIMPreeditStateNotifyCallbackStruct { XIMPreeditState state; } XIMPreeditStateNotifyCallbackStruct; typedef unsigned long XIMResetState; #define XIMInitialState 1L #define XIMPreserveState (1L<<1) typedef unsigned long XIMStringConversionFeedback; #define XIMStringConversionLeftEdge (0x00000001) #define XIMStringConversionRightEdge (0x00000002) #define XIMStringConversionTopEdge (0x00000004) #define XIMStringConversionBottomEdge (0x00000008) #define XIMStringConversionConcealed (0x00000010) #define XIMStringConversionWrapped (0x00000020) typedef struct _XIMStringConversionText { unsigned short length; XIMStringConversionFeedback *feedback; Bool encoding_is_wchar; union { char *mbs; wchar_t *wcs; } string; } XIMStringConversionText; typedef unsigned short XIMStringConversionPosition; typedef unsigned short XIMStringConversionType; #define XIMStringConversionBuffer (0x0001) #define XIMStringConversionLine (0x0002) #define XIMStringConversionWord (0x0003) #define XIMStringConversionChar (0x0004) typedef unsigned short XIMStringConversionOperation; #define XIMStringConversionSubstitution (0x0001) #define XIMStringConversionRetrieval (0x0002) typedef enum { XIMForwardChar, XIMBackwardChar, XIMForwardWord, XIMBackwardWord, XIMCaretUp, XIMCaretDown, XIMNextLine, XIMPreviousLine, XIMLineStart, XIMLineEnd, XIMAbsolutePosition, XIMDontChange } XIMCaretDirection; typedef struct _XIMStringConversionCallbackStruct { XIMStringConversionPosition position; XIMCaretDirection direction; XIMStringConversionOperation operation; unsigned short factor; XIMStringConversionText *text; } XIMStringConversionCallbackStruct; typedef struct _XIMPreeditDrawCallbackStruct { int caret; /* Cursor offset within pre-edit string */ int chg_first; /* Starting change position */ int chg_length; /* Length of the change in character count */ XIMText *text; } XIMPreeditDrawCallbackStruct; typedef enum { XIMIsInvisible, /* Disable caret feedback */ XIMIsPrimary, /* UI defined caret feedback */ XIMIsSecondary /* UI defined caret feedback */ } XIMCaretStyle; typedef struct _XIMPreeditCaretCallbackStruct { int position; /* Caret offset within pre-edit string */ XIMCaretDirection direction; /* Caret moves direction */ XIMCaretStyle style; /* Feedback of the caret */ } XIMPreeditCaretCallbackStruct; typedef enum { XIMTextType, XIMBitmapType } XIMStatusDataType; typedef struct _XIMStatusDrawCallbackStruct { XIMStatusDataType type; union { XIMText *text; Pixmap bitmap; } data; } XIMStatusDrawCallbackStruct; typedef struct _XIMHotKeyTrigger { KeySym keysym; int modifier; int modifier_mask; } XIMHotKeyTrigger; typedef struct _XIMHotKeyTriggers { int num_hot_key; XIMHotKeyTrigger *key; } XIMHotKeyTriggers; typedef unsigned long XIMHotKeyState; #define XIMHotKeyStateON (0x0001L) #define XIMHotKeyStateOFF (0x0002L) typedef struct { unsigned short count_values; char **supported_values; } XIMValuesList; _XFUNCPROTOBEGIN #if defined(WIN32) && !defined(_XLIBINT_) #define _Xdebug (*_Xdebug_p) #endif extern int _Xdebug; extern XFontStruct *XLoadQueryFont( Display* /* display */, _Xconst char* /* name */ ); extern XFontStruct *XQueryFont( Display* /* display */, XID /* font_ID */ ); extern XTimeCoord *XGetMotionEvents( Display* /* display */, Window /* w */, Time /* start */, Time /* stop */, int* /* nevents_return */ ); extern XModifierKeymap *XDeleteModifiermapEntry( XModifierKeymap* /* modmap */, #if NeedWidePrototypes unsigned int /* keycode_entry */, #else KeyCode /* keycode_entry */, #endif int /* modifier */ ); extern XModifierKeymap *XGetModifierMapping( Display* /* display */ ); extern XModifierKeymap *XInsertModifiermapEntry( XModifierKeymap* /* modmap */, #if NeedWidePrototypes unsigned int /* keycode_entry */, #else KeyCode /* keycode_entry */, #endif int /* modifier */ ); extern XModifierKeymap *XNewModifiermap( int /* max_keys_per_mod */ ); extern XImage *XCreateImage( Display* /* display */, Visual* /* visual */, unsigned int /* depth */, int /* format */, int /* offset */, char* /* data */, unsigned int /* width */, unsigned int /* height */, int /* bitmap_pad */, int /* bytes_per_line */ ); extern Status XInitImage( XImage* /* image */ ); extern XImage *XGetImage( Display* /* display */, Drawable /* d */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */, unsigned long /* plane_mask */, int /* format */ ); extern XImage *XGetSubImage( Display* /* display */, Drawable /* d */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */, unsigned long /* plane_mask */, int /* format */, XImage* /* dest_image */, int /* dest_x */, int /* dest_y */ ); /* * X function declarations. */ extern Display *XOpenDisplay( _Xconst char* /* display_name */ ); extern void XrmInitialize( void ); extern char *XFetchBytes( Display* /* display */, int* /* nbytes_return */ ); extern char *XFetchBuffer( Display* /* display */, int* /* nbytes_return */, int /* buffer */ ); extern char *XGetAtomName( Display* /* display */, Atom /* atom */ ); extern Status XGetAtomNames( Display* /* dpy */, Atom* /* atoms */, int /* count */, char** /* names_return */ ); extern char *XGetDefault( Display* /* display */, _Xconst char* /* program */, _Xconst char* /* option */ ); extern char *XDisplayName( _Xconst char* /* string */ ); extern char *XKeysymToString( KeySym /* keysym */ ); extern int (*XSynchronize( Display* /* display */, Bool /* onoff */ ))( Display* /* display */ ); extern int (*XSetAfterFunction( Display* /* display */, int (*) ( Display* /* display */ ) /* procedure */ ))( Display* /* display */ ); extern Atom XInternAtom( Display* /* display */, _Xconst char* /* atom_name */, Bool /* only_if_exists */ ); extern Status XInternAtoms( Display* /* dpy */, char** /* names */, int /* count */, Bool /* onlyIfExists */, Atom* /* atoms_return */ ); extern Colormap XCopyColormapAndFree( Display* /* display */, Colormap /* colormap */ ); extern Colormap XCreateColormap( Display* /* display */, Window /* w */, Visual* /* visual */, int /* alloc */ ); extern Cursor XCreatePixmapCursor( Display* /* display */, Pixmap /* source */, Pixmap /* mask */, XColor* /* foreground_color */, XColor* /* background_color */, unsigned int /* x */, unsigned int /* y */ ); extern Cursor XCreateGlyphCursor( Display* /* display */, Font /* source_font */, Font /* mask_font */, unsigned int /* source_char */, unsigned int /* mask_char */, XColor _Xconst * /* foreground_color */, XColor _Xconst * /* background_color */ ); extern Cursor XCreateFontCursor( Display* /* display */, unsigned int /* shape */ ); extern Font XLoadFont( Display* /* display */, _Xconst char* /* name */ ); extern GC XCreateGC( Display* /* display */, Drawable /* d */, unsigned long /* valuemask */, XGCValues* /* values */ ); extern GContext XGContextFromGC( GC /* gc */ ); extern void XFlushGC( Display* /* display */, GC /* gc */ ); extern Pixmap XCreatePixmap( Display* /* display */, Drawable /* d */, unsigned int /* width */, unsigned int /* height */, unsigned int /* depth */ ); extern Pixmap XCreateBitmapFromData( Display* /* display */, Drawable /* d */, _Xconst char* /* data */, unsigned int /* width */, unsigned int /* height */ ); extern Pixmap XCreatePixmapFromBitmapData( Display* /* display */, Drawable /* d */, char* /* data */, unsigned int /* width */, unsigned int /* height */, unsigned long /* fg */, unsigned long /* bg */, unsigned int /* depth */ ); extern Window XCreateSimpleWindow( Display* /* display */, Window /* parent */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */, unsigned int /* border_width */, unsigned long /* border */, unsigned long /* background */ ); extern Window XGetSelectionOwner( Display* /* display */, Atom /* selection */ ); extern Window XCreateWindow( Display* /* display */, Window /* parent */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */, unsigned int /* border_width */, int /* depth */, unsigned int /* class */, Visual* /* visual */, unsigned long /* valuemask */, XSetWindowAttributes* /* attributes */ ); extern Colormap *XListInstalledColormaps( Display* /* display */, Window /* w */, int* /* num_return */ ); extern char **XListFonts( Display* /* display */, _Xconst char* /* pattern */, int /* maxnames */, int* /* actual_count_return */ ); extern char **XListFontsWithInfo( Display* /* display */, _Xconst char* /* pattern */, int /* maxnames */, int* /* count_return */, XFontStruct** /* info_return */ ); extern char **XGetFontPath( Display* /* display */, int* /* npaths_return */ ); extern char **XListExtensions( Display* /* display */, int* /* nextensions_return */ ); extern Atom *XListProperties( Display* /* display */, Window /* w */, int* /* num_prop_return */ ); extern XHostAddress *XListHosts( Display* /* display */, int* /* nhosts_return */, Bool* /* state_return */ ); _X_DEPRECATED extern KeySym XKeycodeToKeysym( Display* /* display */, #if NeedWidePrototypes unsigned int /* keycode */, #else KeyCode /* keycode */, #endif int /* index */ ); extern KeySym XLookupKeysym( XKeyEvent* /* key_event */, int /* index */ ); extern KeySym *XGetKeyboardMapping( Display* /* display */, #if NeedWidePrototypes unsigned int /* first_keycode */, #else KeyCode /* first_keycode */, #endif int /* keycode_count */, int* /* keysyms_per_keycode_return */ ); extern KeySym XStringToKeysym( _Xconst char* /* string */ ); extern long XMaxRequestSize( Display* /* display */ ); extern long XExtendedMaxRequestSize( Display* /* display */ ); extern char *XResourceManagerString( Display* /* display */ ); extern char *XScreenResourceString( Screen* /* screen */ ); extern unsigned long XDisplayMotionBufferSize( Display* /* display */ ); extern VisualID XVisualIDFromVisual( Visual* /* visual */ ); /* multithread routines */ extern Status XInitThreads( void ); extern void XLockDisplay( Display* /* display */ ); extern void XUnlockDisplay( Display* /* display */ ); /* routines for dealing with extensions */ extern XExtCodes *XInitExtension( Display* /* display */, _Xconst char* /* name */ ); extern XExtCodes *XAddExtension( Display* /* display */ ); extern XExtData *XFindOnExtensionList( XExtData** /* structure */, int /* number */ ); extern XExtData **XEHeadOfExtensionList( XEDataObject /* object */ ); /* these are routines for which there are also macros */ extern Window XRootWindow( Display* /* display */, int /* screen_number */ ); extern Window XDefaultRootWindow( Display* /* display */ ); extern Window XRootWindowOfScreen( Screen* /* screen */ ); extern Visual *XDefaultVisual( Display* /* display */, int /* screen_number */ ); extern Visual *XDefaultVisualOfScreen( Screen* /* screen */ ); extern GC XDefaultGC( Display* /* display */, int /* screen_number */ ); extern GC XDefaultGCOfScreen( Screen* /* screen */ ); extern unsigned long XBlackPixel( Display* /* display */, int /* screen_number */ ); extern unsigned long XWhitePixel( Display* /* display */, int /* screen_number */ ); extern unsigned long XAllPlanes( void ); extern unsigned long XBlackPixelOfScreen( Screen* /* screen */ ); extern unsigned long XWhitePixelOfScreen( Screen* /* screen */ ); extern unsigned long XNextRequest( Display* /* display */ ); extern unsigned long XLastKnownRequestProcessed( Display* /* display */ ); extern char *XServerVendor( Display* /* display */ ); extern char *XDisplayString( Display* /* display */ ); extern Colormap XDefaultColormap( Display* /* display */, int /* screen_number */ ); extern Colormap XDefaultColormapOfScreen( Screen* /* screen */ ); extern Display *XDisplayOfScreen( Screen* /* screen */ ); extern Screen *XScreenOfDisplay( Display* /* display */, int /* screen_number */ ); extern Screen *XDefaultScreenOfDisplay( Display* /* display */ ); extern long XEventMaskOfScreen( Screen* /* screen */ ); extern int XScreenNumberOfScreen( Screen* /* screen */ ); typedef int (*XErrorHandler) ( /* WARNING, this type not in Xlib spec */ Display* /* display */, XErrorEvent* /* error_event */ ); extern XErrorHandler XSetErrorHandler ( XErrorHandler /* handler */ ); typedef int (*XIOErrorHandler) ( /* WARNING, this type not in Xlib spec */ Display* /* display */ ); extern XIOErrorHandler XSetIOErrorHandler ( XIOErrorHandler /* handler */ ); extern XPixmapFormatValues *XListPixmapFormats( Display* /* display */, int* /* count_return */ ); extern int *XListDepths( Display* /* display */, int /* screen_number */, int* /* count_return */ ); /* ICCCM routines for things that don't require special include files; */ /* other declarations are given in Xutil.h */ extern Status XReconfigureWMWindow( Display* /* display */, Window /* w */, int /* screen_number */, unsigned int /* mask */, XWindowChanges* /* changes */ ); extern Status XGetWMProtocols( Display* /* display */, Window /* w */, Atom** /* protocols_return */, int* /* count_return */ ); extern Status XSetWMProtocols( Display* /* display */, Window /* w */, Atom* /* protocols */, int /* count */ ); extern Status XIconifyWindow( Display* /* display */, Window /* w */, int /* screen_number */ ); extern Status XWithdrawWindow( Display* /* display */, Window /* w */, int /* screen_number */ ); extern Status XGetCommand( Display* /* display */, Window /* w */, char*** /* argv_return */, int* /* argc_return */ ); extern Status XGetWMColormapWindows( Display* /* display */, Window /* w */, Window** /* windows_return */, int* /* count_return */ ); extern Status XSetWMColormapWindows( Display* /* display */, Window /* w */, Window* /* colormap_windows */, int /* count */ ); extern void XFreeStringList( char** /* list */ ); extern int XSetTransientForHint( Display* /* display */, Window /* w */, Window /* prop_window */ ); /* The following are given in alphabetical order */ extern int XActivateScreenSaver( Display* /* display */ ); extern int XAddHost( Display* /* display */, XHostAddress* /* host */ ); extern int XAddHosts( Display* /* display */, XHostAddress* /* hosts */, int /* num_hosts */ ); extern int XAddToExtensionList( struct _XExtData** /* structure */, XExtData* /* ext_data */ ); extern int XAddToSaveSet( Display* /* display */, Window /* w */ ); extern Status XAllocColor( Display* /* display */, Colormap /* colormap */, XColor* /* screen_in_out */ ); extern Status XAllocColorCells( Display* /* display */, Colormap /* colormap */, Bool /* contig */, unsigned long* /* plane_masks_return */, unsigned int /* nplanes */, unsigned long* /* pixels_return */, unsigned int /* npixels */ ); extern Status XAllocColorPlanes( Display* /* display */, Colormap /* colormap */, Bool /* contig */, unsigned long* /* pixels_return */, int /* ncolors */, int /* nreds */, int /* ngreens */, int /* nblues */, unsigned long* /* rmask_return */, unsigned long* /* gmask_return */, unsigned long* /* bmask_return */ ); extern Status XAllocNamedColor( Display* /* display */, Colormap /* colormap */, _Xconst char* /* color_name */, XColor* /* screen_def_return */, XColor* /* exact_def_return */ ); extern int XAllowEvents( Display* /* display */, int /* event_mode */, Time /* time */ ); extern int XAutoRepeatOff( Display* /* display */ ); extern int XAutoRepeatOn( Display* /* display */ ); extern int XBell( Display* /* display */, int /* percent */ ); extern int XBitmapBitOrder( Display* /* display */ ); extern int XBitmapPad( Display* /* display */ ); extern int XBitmapUnit( Display* /* display */ ); extern int XCellsOfScreen( Screen* /* screen */ ); extern int XChangeActivePointerGrab( Display* /* display */, unsigned int /* event_mask */, Cursor /* cursor */, Time /* time */ ); extern int XChangeGC( Display* /* display */, GC /* gc */, unsigned long /* valuemask */, XGCValues* /* values */ ); extern int XChangeKeyboardControl( Display* /* display */, unsigned long /* value_mask */, XKeyboardControl* /* values */ ); extern int XChangeKeyboardMapping( Display* /* display */, int /* first_keycode */, int /* keysyms_per_keycode */, KeySym* /* keysyms */, int /* num_codes */ ); extern int XChangePointerControl( Display* /* display */, Bool /* do_accel */, Bool /* do_threshold */, int /* accel_numerator */, int /* accel_denominator */, int /* threshold */ ); extern int XChangeProperty( Display* /* display */, Window /* w */, Atom /* property */, Atom /* type */, int /* format */, int /* mode */, _Xconst unsigned char* /* data */, int /* nelements */ ); extern int XChangeSaveSet( Display* /* display */, Window /* w */, int /* change_mode */ ); extern int XChangeWindowAttributes( Display* /* display */, Window /* w */, unsigned long /* valuemask */, XSetWindowAttributes* /* attributes */ ); extern Bool XCheckIfEvent( Display* /* display */, XEvent* /* event_return */, Bool (*) ( Display* /* display */, XEvent* /* event */, XPointer /* arg */ ) /* predicate */, XPointer /* arg */ ); extern Bool XCheckMaskEvent( Display* /* display */, long /* event_mask */, XEvent* /* event_return */ ); extern Bool XCheckTypedEvent( Display* /* display */, int /* event_type */, XEvent* /* event_return */ ); extern Bool XCheckTypedWindowEvent( Display* /* display */, Window /* w */, int /* event_type */, XEvent* /* event_return */ ); extern Bool XCheckWindowEvent( Display* /* display */, Window /* w */, long /* event_mask */, XEvent* /* event_return */ ); extern int XCirculateSubwindows( Display* /* display */, Window /* w */, int /* direction */ ); extern int XCirculateSubwindowsDown( Display* /* display */, Window /* w */ ); extern int XCirculateSubwindowsUp( Display* /* display */, Window /* w */ ); extern int XClearArea( Display* /* display */, Window /* w */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */, Bool /* exposures */ ); extern int XClearWindow( Display* /* display */, Window /* w */ ); extern int XCloseDisplay( Display* /* display */ ); extern int XConfigureWindow( Display* /* display */, Window /* w */, unsigned int /* value_mask */, XWindowChanges* /* values */ ); extern int XConnectionNumber( Display* /* display */ ); extern int XConvertSelection( Display* /* display */, Atom /* selection */, Atom /* target */, Atom /* property */, Window /* requestor */, Time /* time */ ); extern int XCopyArea( Display* /* display */, Drawable /* src */, Drawable /* dest */, GC /* gc */, int /* src_x */, int /* src_y */, unsigned int /* width */, unsigned int /* height */, int /* dest_x */, int /* dest_y */ ); extern int XCopyGC( Display* /* display */, GC /* src */, unsigned long /* valuemask */, GC /* dest */ ); extern int XCopyPlane( Display* /* display */, Drawable /* src */, Drawable /* dest */, GC /* gc */, int /* src_x */, int /* src_y */, unsigned int /* width */, unsigned int /* height */, int /* dest_x */, int /* dest_y */, unsigned long /* plane */ ); extern int XDefaultDepth( Display* /* display */, int /* screen_number */ ); extern int XDefaultDepthOfScreen( Screen* /* screen */ ); extern int XDefaultScreen( Display* /* display */ ); extern int XDefineCursor( Display* /* display */, Window /* w */, Cursor /* cursor */ ); extern int XDeleteProperty( Display* /* display */, Window /* w */, Atom /* property */ ); extern int XDestroyWindow( Display* /* display */, Window /* w */ ); extern int XDestroySubwindows( Display* /* display */, Window /* w */ ); extern int XDoesBackingStore( Screen* /* screen */ ); extern Bool XDoesSaveUnders( Screen* /* screen */ ); extern int XDisableAccessControl( Display* /* display */ ); extern int XDisplayCells( Display* /* display */, int /* screen_number */ ); extern int XDisplayHeight( Display* /* display */, int /* screen_number */ ); extern int XDisplayHeightMM( Display* /* display */, int /* screen_number */ ); extern int XDisplayKeycodes( Display* /* display */, int* /* min_keycodes_return */, int* /* max_keycodes_return */ ); extern int XDisplayPlanes( Display* /* display */, int /* screen_number */ ); extern int XDisplayWidth( Display* /* display */, int /* screen_number */ ); extern int XDisplayWidthMM( Display* /* display */, int /* screen_number */ ); extern int XDrawArc( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */, int /* angle1 */, int /* angle2 */ ); extern int XDrawArcs( Display* /* display */, Drawable /* d */, GC /* gc */, XArc* /* arcs */, int /* narcs */ ); extern int XDrawImageString( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, _Xconst char* /* string */, int /* length */ ); extern int XDrawImageString16( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, _Xconst XChar2b* /* string */, int /* length */ ); extern int XDrawLine( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x1 */, int /* y1 */, int /* x2 */, int /* y2 */ ); extern int XDrawLines( Display* /* display */, Drawable /* d */, GC /* gc */, XPoint* /* points */, int /* npoints */, int /* mode */ ); extern int XDrawPoint( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */ ); extern int XDrawPoints( Display* /* display */, Drawable /* d */, GC /* gc */, XPoint* /* points */, int /* npoints */, int /* mode */ ); extern int XDrawRectangle( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */ ); extern int XDrawRectangles( Display* /* display */, Drawable /* d */, GC /* gc */, XRectangle* /* rectangles */, int /* nrectangles */ ); extern int XDrawSegments( Display* /* display */, Drawable /* d */, GC /* gc */, XSegment* /* segments */, int /* nsegments */ ); extern int XDrawString( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, _Xconst char* /* string */, int /* length */ ); extern int XDrawString16( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, _Xconst XChar2b* /* string */, int /* length */ ); extern int XDrawText( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, XTextItem* /* items */, int /* nitems */ ); extern int XDrawText16( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, XTextItem16* /* items */, int /* nitems */ ); extern int XEnableAccessControl( Display* /* display */ ); extern int XEventsQueued( Display* /* display */, int /* mode */ ); extern Status XFetchName( Display* /* display */, Window /* w */, char** /* window_name_return */ ); extern int XFillArc( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */, int /* angle1 */, int /* angle2 */ ); extern int XFillArcs( Display* /* display */, Drawable /* d */, GC /* gc */, XArc* /* arcs */, int /* narcs */ ); extern int XFillPolygon( Display* /* display */, Drawable /* d */, GC /* gc */, XPoint* /* points */, int /* npoints */, int /* shape */, int /* mode */ ); extern int XFillRectangle( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */ ); extern int XFillRectangles( Display* /* display */, Drawable /* d */, GC /* gc */, XRectangle* /* rectangles */, int /* nrectangles */ ); extern int XFlush( Display* /* display */ ); extern int XForceScreenSaver( Display* /* display */, int /* mode */ ); extern int XFree( void* /* data */ ); extern int XFreeColormap( Display* /* display */, Colormap /* colormap */ ); extern int XFreeColors( Display* /* display */, Colormap /* colormap */, unsigned long* /* pixels */, int /* npixels */, unsigned long /* planes */ ); extern int XFreeCursor( Display* /* display */, Cursor /* cursor */ ); extern int XFreeExtensionList( char** /* list */ ); extern int XFreeFont( Display* /* display */, XFontStruct* /* font_struct */ ); extern int XFreeFontInfo( char** /* names */, XFontStruct* /* free_info */, int /* actual_count */ ); extern int XFreeFontNames( char** /* list */ ); extern int XFreeFontPath( char** /* list */ ); extern int XFreeGC( Display* /* display */, GC /* gc */ ); extern int XFreeModifiermap( XModifierKeymap* /* modmap */ ); extern int XFreePixmap( Display* /* display */, Pixmap /* pixmap */ ); extern int XGeometry( Display* /* display */, int /* screen */, _Xconst char* /* position */, _Xconst char* /* default_position */, unsigned int /* bwidth */, unsigned int /* fwidth */, unsigned int /* fheight */, int /* xadder */, int /* yadder */, int* /* x_return */, int* /* y_return */, int* /* width_return */, int* /* height_return */ ); extern int XGetErrorDatabaseText( Display* /* display */, _Xconst char* /* name */, _Xconst char* /* message */, _Xconst char* /* default_string */, char* /* buffer_return */, int /* length */ ); extern int XGetErrorText( Display* /* display */, int /* code */, char* /* buffer_return */, int /* length */ ); extern Bool XGetFontProperty( XFontStruct* /* font_struct */, Atom /* atom */, unsigned long* /* value_return */ ); extern Status XGetGCValues( Display* /* display */, GC /* gc */, unsigned long /* valuemask */, XGCValues* /* values_return */ ); extern Status XGetGeometry( Display* /* display */, Drawable /* d */, Window* /* root_return */, int* /* x_return */, int* /* y_return */, unsigned int* /* width_return */, unsigned int* /* height_return */, unsigned int* /* border_width_return */, unsigned int* /* depth_return */ ); extern Status XGetIconName( Display* /* display */, Window /* w */, char** /* icon_name_return */ ); extern int XGetInputFocus( Display* /* display */, Window* /* focus_return */, int* /* revert_to_return */ ); extern int XGetKeyboardControl( Display* /* display */, XKeyboardState* /* values_return */ ); extern int XGetPointerControl( Display* /* display */, int* /* accel_numerator_return */, int* /* accel_denominator_return */, int* /* threshold_return */ ); extern int XGetPointerMapping( Display* /* display */, unsigned char* /* map_return */, int /* nmap */ ); extern int XGetScreenSaver( Display* /* display */, int* /* timeout_return */, int* /* interval_return */, int* /* prefer_blanking_return */, int* /* allow_exposures_return */ ); extern Status XGetTransientForHint( Display* /* display */, Window /* w */, Window* /* prop_window_return */ ); extern int XGetWindowProperty( Display* /* display */, Window /* w */, Atom /* property */, long /* long_offset */, long /* long_length */, Bool /* delete */, Atom /* req_type */, Atom* /* actual_type_return */, int* /* actual_format_return */, unsigned long* /* nitems_return */, unsigned long* /* bytes_after_return */, unsigned char** /* prop_return */ ); extern Status XGetWindowAttributes( Display* /* display */, Window /* w */, XWindowAttributes* /* window_attributes_return */ ); extern int XGrabButton( Display* /* display */, unsigned int /* button */, unsigned int /* modifiers */, Window /* grab_window */, Bool /* owner_events */, unsigned int /* event_mask */, int /* pointer_mode */, int /* keyboard_mode */, Window /* confine_to */, Cursor /* cursor */ ); extern int XGrabKey( Display* /* display */, int /* keycode */, unsigned int /* modifiers */, Window /* grab_window */, Bool /* owner_events */, int /* pointer_mode */, int /* keyboard_mode */ ); extern int XGrabKeyboard( Display* /* display */, Window /* grab_window */, Bool /* owner_events */, int /* pointer_mode */, int /* keyboard_mode */, Time /* time */ ); extern int XGrabPointer( Display* /* display */, Window /* grab_window */, Bool /* owner_events */, unsigned int /* event_mask */, int /* pointer_mode */, int /* keyboard_mode */, Window /* confine_to */, Cursor /* cursor */, Time /* time */ ); extern int XGrabServer( Display* /* display */ ); extern int XHeightMMOfScreen( Screen* /* screen */ ); extern int XHeightOfScreen( Screen* /* screen */ ); extern int XIfEvent( Display* /* display */, XEvent* /* event_return */, Bool (*) ( Display* /* display */, XEvent* /* event */, XPointer /* arg */ ) /* predicate */, XPointer /* arg */ ); extern int XImageByteOrder( Display* /* display */ ); extern int XInstallColormap( Display* /* display */, Colormap /* colormap */ ); extern KeyCode XKeysymToKeycode( Display* /* display */, KeySym /* keysym */ ); extern int XKillClient( Display* /* display */, XID /* resource */ ); extern Status XLookupColor( Display* /* display */, Colormap /* colormap */, _Xconst char* /* color_name */, XColor* /* exact_def_return */, XColor* /* screen_def_return */ ); extern int XLowerWindow( Display* /* display */, Window /* w */ ); extern int XMapRaised( Display* /* display */, Window /* w */ ); extern int XMapSubwindows( Display* /* display */, Window /* w */ ); extern int XMapWindow( Display* /* display */, Window /* w */ ); extern int XMaskEvent( Display* /* display */, long /* event_mask */, XEvent* /* event_return */ ); extern int XMaxCmapsOfScreen( Screen* /* screen */ ); extern int XMinCmapsOfScreen( Screen* /* screen */ ); extern int XMoveResizeWindow( Display* /* display */, Window /* w */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */ ); extern int XMoveWindow( Display* /* display */, Window /* w */, int /* x */, int /* y */ ); extern int XNextEvent( Display* /* display */, XEvent* /* event_return */ ); extern int XNoOp( Display* /* display */ ); extern Status XParseColor( Display* /* display */, Colormap /* colormap */, _Xconst char* /* spec */, XColor* /* exact_def_return */ ); extern int XParseGeometry( _Xconst char* /* parsestring */, int* /* x_return */, int* /* y_return */, unsigned int* /* width_return */, unsigned int* /* height_return */ ); extern int XPeekEvent( Display* /* display */, XEvent* /* event_return */ ); extern int XPeekIfEvent( Display* /* display */, XEvent* /* event_return */, Bool (*) ( Display* /* display */, XEvent* /* event */, XPointer /* arg */ ) /* predicate */, XPointer /* arg */ ); extern int XPending( Display* /* display */ ); extern int XPlanesOfScreen( Screen* /* screen */ ); extern int XProtocolRevision( Display* /* display */ ); extern int XProtocolVersion( Display* /* display */ ); extern int XPutBackEvent( Display* /* display */, XEvent* /* event */ ); extern int XPutImage( Display* /* display */, Drawable /* d */, GC /* gc */, XImage* /* image */, int /* src_x */, int /* src_y */, int /* dest_x */, int /* dest_y */, unsigned int /* width */, unsigned int /* height */ ); extern int XQLength( Display* /* display */ ); extern Status XQueryBestCursor( Display* /* display */, Drawable /* d */, unsigned int /* width */, unsigned int /* height */, unsigned int* /* width_return */, unsigned int* /* height_return */ ); extern Status XQueryBestSize( Display* /* display */, int /* class */, Drawable /* which_screen */, unsigned int /* width */, unsigned int /* height */, unsigned int* /* width_return */, unsigned int* /* height_return */ ); extern Status XQueryBestStipple( Display* /* display */, Drawable /* which_screen */, unsigned int /* width */, unsigned int /* height */, unsigned int* /* width_return */, unsigned int* /* height_return */ ); extern Status XQueryBestTile( Display* /* display */, Drawable /* which_screen */, unsigned int /* width */, unsigned int /* height */, unsigned int* /* width_return */, unsigned int* /* height_return */ ); extern int XQueryColor( Display* /* display */, Colormap /* colormap */, XColor* /* def_in_out */ ); extern int XQueryColors( Display* /* display */, Colormap /* colormap */, XColor* /* defs_in_out */, int /* ncolors */ ); extern Bool XQueryExtension( Display* /* display */, _Xconst char* /* name */, int* /* major_opcode_return */, int* /* first_event_return */, int* /* first_error_return */ ); extern int XQueryKeymap( Display* /* display */, char [32] /* keys_return */ ); extern Bool XQueryPointer( Display* /* display */, Window /* w */, Window* /* root_return */, Window* /* child_return */, int* /* root_x_return */, int* /* root_y_return */, int* /* win_x_return */, int* /* win_y_return */, unsigned int* /* mask_return */ ); extern int XQueryTextExtents( Display* /* display */, XID /* font_ID */, _Xconst char* /* string */, int /* nchars */, int* /* direction_return */, int* /* font_ascent_return */, int* /* font_descent_return */, XCharStruct* /* overall_return */ ); extern int XQueryTextExtents16( Display* /* display */, XID /* font_ID */, _Xconst XChar2b* /* string */, int /* nchars */, int* /* direction_return */, int* /* font_ascent_return */, int* /* font_descent_return */, XCharStruct* /* overall_return */ ); extern Status XQueryTree( Display* /* display */, Window /* w */, Window* /* root_return */, Window* /* parent_return */, Window** /* children_return */, unsigned int* /* nchildren_return */ ); extern int XRaiseWindow( Display* /* display */, Window /* w */ ); extern int XReadBitmapFile( Display* /* display */, Drawable /* d */, _Xconst char* /* filename */, unsigned int* /* width_return */, unsigned int* /* height_return */, Pixmap* /* bitmap_return */, int* /* x_hot_return */, int* /* y_hot_return */ ); extern int XReadBitmapFileData( _Xconst char* /* filename */, unsigned int* /* width_return */, unsigned int* /* height_return */, unsigned char** /* data_return */, int* /* x_hot_return */, int* /* y_hot_return */ ); extern int XRebindKeysym( Display* /* display */, KeySym /* keysym */, KeySym* /* list */, int /* mod_count */, _Xconst unsigned char* /* string */, int /* bytes_string */ ); extern int XRecolorCursor( Display* /* display */, Cursor /* cursor */, XColor* /* foreground_color */, XColor* /* background_color */ ); extern int XRefreshKeyboardMapping( XMappingEvent* /* event_map */ ); extern int XRemoveFromSaveSet( Display* /* display */, Window /* w */ ); extern int XRemoveHost( Display* /* display */, XHostAddress* /* host */ ); extern int XRemoveHosts( Display* /* display */, XHostAddress* /* hosts */, int /* num_hosts */ ); extern int XReparentWindow( Display* /* display */, Window /* w */, Window /* parent */, int /* x */, int /* y */ ); extern int XResetScreenSaver( Display* /* display */ ); extern int XResizeWindow( Display* /* display */, Window /* w */, unsigned int /* width */, unsigned int /* height */ ); extern int XRestackWindows( Display* /* display */, Window* /* windows */, int /* nwindows */ ); extern int XRotateBuffers( Display* /* display */, int /* rotate */ ); extern int XRotateWindowProperties( Display* /* display */, Window /* w */, Atom* /* properties */, int /* num_prop */, int /* npositions */ ); extern int XScreenCount( Display* /* display */ ); extern int XSelectInput( Display* /* display */, Window /* w */, long /* event_mask */ ); extern Status XSendEvent( Display* /* display */, Window /* w */, Bool /* propagate */, long /* event_mask */, XEvent* /* event_send */ ); extern int XSetAccessControl( Display* /* display */, int /* mode */ ); extern int XSetArcMode( Display* /* display */, GC /* gc */, int /* arc_mode */ ); extern int XSetBackground( Display* /* display */, GC /* gc */, unsigned long /* background */ ); extern int XSetClipMask( Display* /* display */, GC /* gc */, Pixmap /* pixmap */ ); extern int XSetClipOrigin( Display* /* display */, GC /* gc */, int /* clip_x_origin */, int /* clip_y_origin */ ); extern int XSetClipRectangles( Display* /* display */, GC /* gc */, int /* clip_x_origin */, int /* clip_y_origin */, XRectangle* /* rectangles */, int /* n */, int /* ordering */ ); extern int XSetCloseDownMode( Display* /* display */, int /* close_mode */ ); extern int XSetCommand( Display* /* display */, Window /* w */, char** /* argv */, int /* argc */ ); extern int XSetDashes( Display* /* display */, GC /* gc */, int /* dash_offset */, _Xconst char* /* dash_list */, int /* n */ ); extern int XSetFillRule( Display* /* display */, GC /* gc */, int /* fill_rule */ ); extern int XSetFillStyle( Display* /* display */, GC /* gc */, int /* fill_style */ ); extern int XSetFont( Display* /* display */, GC /* gc */, Font /* font */ ); extern int XSetFontPath( Display* /* display */, char** /* directories */, int /* ndirs */ ); extern int XSetForeground( Display* /* display */, GC /* gc */, unsigned long /* foreground */ ); extern int XSetFunction( Display* /* display */, GC /* gc */, int /* function */ ); extern int XSetGraphicsExposures( Display* /* display */, GC /* gc */, Bool /* graphics_exposures */ ); extern int XSetIconName( Display* /* display */, Window /* w */, _Xconst char* /* icon_name */ ); extern int XSetInputFocus( Display* /* display */, Window /* focus */, int /* revert_to */, Time /* time */ ); extern int XSetLineAttributes( Display* /* display */, GC /* gc */, unsigned int /* line_width */, int /* line_style */, int /* cap_style */, int /* join_style */ ); extern int XSetModifierMapping( Display* /* display */, XModifierKeymap* /* modmap */ ); extern int XSetPlaneMask( Display* /* display */, GC /* gc */, unsigned long /* plane_mask */ ); extern int XSetPointerMapping( Display* /* display */, _Xconst unsigned char* /* map */, int /* nmap */ ); extern int XSetScreenSaver( Display* /* display */, int /* timeout */, int /* interval */, int /* prefer_blanking */, int /* allow_exposures */ ); extern int XSetSelectionOwner( Display* /* display */, Atom /* selection */, Window /* owner */, Time /* time */ ); extern int XSetState( Display* /* display */, GC /* gc */, unsigned long /* foreground */, unsigned long /* background */, int /* function */, unsigned long /* plane_mask */ ); extern int XSetStipple( Display* /* display */, GC /* gc */, Pixmap /* stipple */ ); extern int XSetSubwindowMode( Display* /* display */, GC /* gc */, int /* subwindow_mode */ ); extern int XSetTSOrigin( Display* /* display */, GC /* gc */, int /* ts_x_origin */, int /* ts_y_origin */ ); extern int XSetTile( Display* /* display */, GC /* gc */, Pixmap /* tile */ ); extern int XSetWindowBackground( Display* /* display */, Window /* w */, unsigned long /* background_pixel */ ); extern int XSetWindowBackgroundPixmap( Display* /* display */, Window /* w */, Pixmap /* background_pixmap */ ); extern int XSetWindowBorder( Display* /* display */, Window /* w */, unsigned long /* border_pixel */ ); extern int XSetWindowBorderPixmap( Display* /* display */, Window /* w */, Pixmap /* border_pixmap */ ); extern int XSetWindowBorderWidth( Display* /* display */, Window /* w */, unsigned int /* width */ ); extern int XSetWindowColormap( Display* /* display */, Window /* w */, Colormap /* colormap */ ); extern int XStoreBuffer( Display* /* display */, _Xconst char* /* bytes */, int /* nbytes */, int /* buffer */ ); extern int XStoreBytes( Display* /* display */, _Xconst char* /* bytes */, int /* nbytes */ ); extern int XStoreColor( Display* /* display */, Colormap /* colormap */, XColor* /* color */ ); extern int XStoreColors( Display* /* display */, Colormap /* colormap */, XColor* /* color */, int /* ncolors */ ); extern int XStoreName( Display* /* display */, Window /* w */, _Xconst char* /* window_name */ ); extern int XStoreNamedColor( Display* /* display */, Colormap /* colormap */, _Xconst char* /* color */, unsigned long /* pixel */, int /* flags */ ); extern int XSync( Display* /* display */, Bool /* discard */ ); extern int XTextExtents( XFontStruct* /* font_struct */, _Xconst char* /* string */, int /* nchars */, int* /* direction_return */, int* /* font_ascent_return */, int* /* font_descent_return */, XCharStruct* /* overall_return */ ); extern int XTextExtents16( XFontStruct* /* font_struct */, _Xconst XChar2b* /* string */, int /* nchars */, int* /* direction_return */, int* /* font_ascent_return */, int* /* font_descent_return */, XCharStruct* /* overall_return */ ); extern int XTextWidth( XFontStruct* /* font_struct */, _Xconst char* /* string */, int /* count */ ); extern int XTextWidth16( XFontStruct* /* font_struct */, _Xconst XChar2b* /* string */, int /* count */ ); extern Bool XTranslateCoordinates( Display* /* display */, Window /* src_w */, Window /* dest_w */, int /* src_x */, int /* src_y */, int* /* dest_x_return */, int* /* dest_y_return */, Window* /* child_return */ ); extern int XUndefineCursor( Display* /* display */, Window /* w */ ); extern int XUngrabButton( Display* /* display */, unsigned int /* button */, unsigned int /* modifiers */, Window /* grab_window */ ); extern int XUngrabKey( Display* /* display */, int /* keycode */, unsigned int /* modifiers */, Window /* grab_window */ ); extern int XUngrabKeyboard( Display* /* display */, Time /* time */ ); extern int XUngrabPointer( Display* /* display */, Time /* time */ ); extern int XUngrabServer( Display* /* display */ ); extern int XUninstallColormap( Display* /* display */, Colormap /* colormap */ ); extern int XUnloadFont( Display* /* display */, Font /* font */ ); extern int XUnmapSubwindows( Display* /* display */, Window /* w */ ); extern int XUnmapWindow( Display* /* display */, Window /* w */ ); extern int XVendorRelease( Display* /* display */ ); extern int XWarpPointer( Display* /* display */, Window /* src_w */, Window /* dest_w */, int /* src_x */, int /* src_y */, unsigned int /* src_width */, unsigned int /* src_height */, int /* dest_x */, int /* dest_y */ ); extern int XWidthMMOfScreen( Screen* /* screen */ ); extern int XWidthOfScreen( Screen* /* screen */ ); extern int XWindowEvent( Display* /* display */, Window /* w */, long /* event_mask */, XEvent* /* event_return */ ); extern int XWriteBitmapFile( Display* /* display */, _Xconst char* /* filename */, Pixmap /* bitmap */, unsigned int /* width */, unsigned int /* height */, int /* x_hot */, int /* y_hot */ ); extern Bool XSupportsLocale (void); extern char *XSetLocaleModifiers( const char* /* modifier_list */ ); extern XOM XOpenOM( Display* /* display */, struct _XrmHashBucketRec* /* rdb */, _Xconst char* /* res_name */, _Xconst char* /* res_class */ ); extern Status XCloseOM( XOM /* om */ ); extern char *XSetOMValues( XOM /* om */, ... ) _X_SENTINEL(0); extern char *XGetOMValues( XOM /* om */, ... ) _X_SENTINEL(0); extern Display *XDisplayOfOM( XOM /* om */ ); extern char *XLocaleOfOM( XOM /* om */ ); extern XOC XCreateOC( XOM /* om */, ... ) _X_SENTINEL(0); extern void XDestroyOC( XOC /* oc */ ); extern XOM XOMOfOC( XOC /* oc */ ); extern char *XSetOCValues( XOC /* oc */, ... ) _X_SENTINEL(0); extern char *XGetOCValues( XOC /* oc */, ... ) _X_SENTINEL(0); extern XFontSet XCreateFontSet( Display* /* display */, _Xconst char* /* base_font_name_list */, char*** /* missing_charset_list */, int* /* missing_charset_count */, char** /* def_string */ ); extern void XFreeFontSet( Display* /* display */, XFontSet /* font_set */ ); extern int XFontsOfFontSet( XFontSet /* font_set */, XFontStruct*** /* font_struct_list */, char*** /* font_name_list */ ); extern char *XBaseFontNameListOfFontSet( XFontSet /* font_set */ ); extern char *XLocaleOfFontSet( XFontSet /* font_set */ ); extern Bool XContextDependentDrawing( XFontSet /* font_set */ ); extern Bool XDirectionalDependentDrawing( XFontSet /* font_set */ ); extern Bool XContextualDrawing( XFontSet /* font_set */ ); extern XFontSetExtents *XExtentsOfFontSet( XFontSet /* font_set */ ); extern int XmbTextEscapement( XFontSet /* font_set */, _Xconst char* /* text */, int /* bytes_text */ ); extern int XwcTextEscapement( XFontSet /* font_set */, _Xconst wchar_t* /* text */, int /* num_wchars */ ); extern int Xutf8TextEscapement( XFontSet /* font_set */, _Xconst char* /* text */, int /* bytes_text */ ); extern int XmbTextExtents( XFontSet /* font_set */, _Xconst char* /* text */, int /* bytes_text */, XRectangle* /* overall_ink_return */, XRectangle* /* overall_logical_return */ ); extern int XwcTextExtents( XFontSet /* font_set */, _Xconst wchar_t* /* text */, int /* num_wchars */, XRectangle* /* overall_ink_return */, XRectangle* /* overall_logical_return */ ); extern int Xutf8TextExtents( XFontSet /* font_set */, _Xconst char* /* text */, int /* bytes_text */, XRectangle* /* overall_ink_return */, XRectangle* /* overall_logical_return */ ); extern Status XmbTextPerCharExtents( XFontSet /* font_set */, _Xconst char* /* text */, int /* bytes_text */, XRectangle* /* ink_extents_buffer */, XRectangle* /* logical_extents_buffer */, int /* buffer_size */, int* /* num_chars */, XRectangle* /* overall_ink_return */, XRectangle* /* overall_logical_return */ ); extern Status XwcTextPerCharExtents( XFontSet /* font_set */, _Xconst wchar_t* /* text */, int /* num_wchars */, XRectangle* /* ink_extents_buffer */, XRectangle* /* logical_extents_buffer */, int /* buffer_size */, int* /* num_chars */, XRectangle* /* overall_ink_return */, XRectangle* /* overall_logical_return */ ); extern Status Xutf8TextPerCharExtents( XFontSet /* font_set */, _Xconst char* /* text */, int /* bytes_text */, XRectangle* /* ink_extents_buffer */, XRectangle* /* logical_extents_buffer */, int /* buffer_size */, int* /* num_chars */, XRectangle* /* overall_ink_return */, XRectangle* /* overall_logical_return */ ); extern void XmbDrawText( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, XmbTextItem* /* text_items */, int /* nitems */ ); extern void XwcDrawText( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, XwcTextItem* /* text_items */, int /* nitems */ ); extern void Xutf8DrawText( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, XmbTextItem* /* text_items */, int /* nitems */ ); extern void XmbDrawString( Display* /* display */, Drawable /* d */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, _Xconst char* /* text */, int /* bytes_text */ ); extern void XwcDrawString( Display* /* display */, Drawable /* d */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, _Xconst wchar_t* /* text */, int /* num_wchars */ ); extern void Xutf8DrawString( Display* /* display */, Drawable /* d */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, _Xconst char* /* text */, int /* bytes_text */ ); extern void XmbDrawImageString( Display* /* display */, Drawable /* d */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, _Xconst char* /* text */, int /* bytes_text */ ); extern void XwcDrawImageString( Display* /* display */, Drawable /* d */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, _Xconst wchar_t* /* text */, int /* num_wchars */ ); extern void Xutf8DrawImageString( Display* /* display */, Drawable /* d */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, _Xconst char* /* text */, int /* bytes_text */ ); extern XIM XOpenIM( Display* /* dpy */, struct _XrmHashBucketRec* /* rdb */, char* /* res_name */, char* /* res_class */ ); extern Status XCloseIM( XIM /* im */ ); extern char *XGetIMValues( XIM /* im */, ... ) _X_SENTINEL(0); extern char *XSetIMValues( XIM /* im */, ... ) _X_SENTINEL(0); extern Display *XDisplayOfIM( XIM /* im */ ); extern char *XLocaleOfIM( XIM /* im*/ ); extern XIC XCreateIC( XIM /* im */, ... ) _X_SENTINEL(0); extern void XDestroyIC( XIC /* ic */ ); extern void XSetICFocus( XIC /* ic */ ); extern void XUnsetICFocus( XIC /* ic */ ); extern wchar_t *XwcResetIC( XIC /* ic */ ); extern char *XmbResetIC( XIC /* ic */ ); extern char *Xutf8ResetIC( XIC /* ic */ ); extern char *XSetICValues( XIC /* ic */, ... ) _X_SENTINEL(0); extern char *XGetICValues( XIC /* ic */, ... ) _X_SENTINEL(0); extern XIM XIMOfIC( XIC /* ic */ ); extern Bool XFilterEvent( XEvent* /* event */, Window /* window */ ); extern int XmbLookupString( XIC /* ic */, XKeyPressedEvent* /* event */, char* /* buffer_return */, int /* bytes_buffer */, KeySym* /* keysym_return */, Status* /* status_return */ ); extern int XwcLookupString( XIC /* ic */, XKeyPressedEvent* /* event */, wchar_t* /* buffer_return */, int /* wchars_buffer */, KeySym* /* keysym_return */, Status* /* status_return */ ); extern int Xutf8LookupString( XIC /* ic */, XKeyPressedEvent* /* event */, char* /* buffer_return */, int /* bytes_buffer */, KeySym* /* keysym_return */, Status* /* status_return */ ); extern XVaNestedList XVaCreateNestedList( int /*unused*/, ... ) _X_SENTINEL(0); /* internal connections for IMs */ extern Bool XRegisterIMInstantiateCallback( Display* /* dpy */, struct _XrmHashBucketRec* /* rdb */, char* /* res_name */, char* /* res_class */, XIDProc /* callback */, XPointer /* client_data */ ); extern Bool XUnregisterIMInstantiateCallback( Display* /* dpy */, struct _XrmHashBucketRec* /* rdb */, char* /* res_name */, char* /* res_class */, XIDProc /* callback */, XPointer /* client_data */ ); typedef void (*XConnectionWatchProc)( Display* /* dpy */, XPointer /* client_data */, int /* fd */, Bool /* opening */, /* open or close flag */ XPointer* /* watch_data */ /* open sets, close uses */ ); extern Status XInternalConnectionNumbers( Display* /* dpy */, int** /* fd_return */, int* /* count_return */ ); extern void XProcessInternalConnection( Display* /* dpy */, int /* fd */ ); extern Status XAddConnectionWatch( Display* /* dpy */, XConnectionWatchProc /* callback */, XPointer /* client_data */ ); extern void XRemoveConnectionWatch( Display* /* dpy */, XConnectionWatchProc /* callback */, XPointer /* client_data */ ); extern void XSetAuthorization( char * /* name */, int /* namelen */, char * /* data */, int /* datalen */ ); extern int _Xmbtowc( wchar_t * /* wstr */, char * /* str */, int /* len */ ); extern int _Xwctomb( char * /* str */, wchar_t /* wc */ ); extern Bool XGetEventData( Display* /* dpy */, XGenericEventCookie* /* cookie*/ ); extern void XFreeEventData( Display* /* dpy */, XGenericEventCookie* /* cookie*/ ); #ifdef __clang__ #pragma clang diagnostic pop #endif _XFUNCPROTOEND #endif /* _X11_XLIB_H_ */ X11/Xfuncproto.h000064400000017267147631660250007464 0ustar00/* * Copyright 1989, 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * */ /* Definitions to make function prototypes manageable */ #ifndef _XFUNCPROTO_H_ #define _XFUNCPROTO_H_ #ifndef NeedFunctionPrototypes #define NeedFunctionPrototypes 1 #endif /* NeedFunctionPrototypes */ #ifndef NeedVarargsPrototypes #define NeedVarargsPrototypes 1 #endif /* NeedVarargsPrototypes */ #if NeedFunctionPrototypes #ifndef NeedNestedPrototypes #define NeedNestedPrototypes 1 #endif /* NeedNestedPrototypes */ #ifndef _Xconst #define _Xconst const #endif /* _Xconst */ /* Function prototype configuration (see configure for more info) */ #if !defined(NARROWPROTO) && \ (defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) #define NARROWPROTO #endif #ifndef FUNCPROTO #define FUNCPROTO 15 #endif #ifndef NeedWidePrototypes #ifdef NARROWPROTO #define NeedWidePrototypes 0 #else #define NeedWidePrototypes 1 /* default to make interropt. easier */ #endif #endif /* NeedWidePrototypes */ #endif /* NeedFunctionPrototypes */ #ifndef _XFUNCPROTOBEGIN #if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */ #define _XFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */ #define _XFUNCPROTOEND } #else #define _XFUNCPROTOBEGIN #define _XFUNCPROTOEND #endif #endif /* _XFUNCPROTOBEGIN */ /* http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute */ #ifndef __has_attribute # define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ #endif #ifndef __has_feature # define __has_feature(x) 0 /* Compatibility with non-clang compilers. */ #endif #ifndef __has_extension # define __has_extension(x) 0 /* Compatibility with non-clang compilers. */ #endif /* Added in X11R6.9, so available in any version of modular xproto */ #if __has_attribute(__sentinel__) || (defined(__GNUC__) && (__GNUC__ >= 4)) # define _X_SENTINEL(x) __attribute__ ((__sentinel__(x))) #else # define _X_SENTINEL(x) #endif /* GNUC >= 4 */ /* Added in X11R6.9, so available in any version of modular xproto */ #if (__has_attribute(visibility) || (defined(__GNUC__) && (__GNUC__ >= 4))) \ && !defined(__CYGWIN__) && !defined(__MINGW32__) # define _X_EXPORT __attribute__((visibility("default"))) # define _X_HIDDEN __attribute__((visibility("hidden"))) # define _X_INTERNAL __attribute__((visibility("internal"))) #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) # define _X_EXPORT __global # define _X_HIDDEN __hidden # define _X_INTERNAL __hidden #else /* not gcc >= 4 and not Sun Studio >= 8 */ # define _X_EXPORT # define _X_HIDDEN # define _X_INTERNAL #endif /* GNUC >= 4 */ /* Branch prediction hints for individual conditionals */ /* requires xproto >= 7.0.9 */ #if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303) # define _X_LIKELY(x) __builtin_expect(!!(x), 1) # define _X_UNLIKELY(x) __builtin_expect(!!(x), 0) #else /* not gcc >= 3.3 */ # define _X_LIKELY(x) (x) # define _X_UNLIKELY(x) (x) #endif /* Bulk branch prediction hints via marking error path functions as "cold" */ /* requires xproto >= 7.0.25 */ #if __has_attribute(__cold__) || \ (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403)) /* 4.3+ */ # define _X_COLD __attribute__((__cold__)) #else # define _X_COLD /* nothing */ #endif /* Added in X11R6.9, so available in any version of modular xproto */ #if __has_attribute(deprecated) \ || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 301)) \ || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5130)) # define _X_DEPRECATED __attribute__((deprecated)) #else /* not gcc >= 3.1 */ # define _X_DEPRECATED #endif /* requires xproto >= 7.0.30 */ #if __has_extension(attribute_deprecated_with_message) || \ (defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)))) # define _X_DEPRECATED_MSG(_msg) __attribute__((deprecated(_msg))) #else # define _X_DEPRECATED_MSG(_msg) _X_DEPRECATED #endif /* requires xproto >= 7.0.17 */ #if __has_attribute(noreturn) \ || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)) \ || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define _X_NORETURN __attribute((noreturn)) #else # define _X_NORETURN #endif /* GNUC */ /* Added in X11R6.9, so available in any version of modular xproto */ #if __has_attribute(__format__) \ || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203) # define _X_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y))) #else /* not gcc >= 2.3 */ # define _X_ATTRIBUTE_PRINTF(x,y) #endif /* requires xproto >= 7.0.22 - since this uses either gcc or C99 variable argument macros, must be only used inside #ifdef _X_NONNULL guards, as many legacy X clients are compiled in C89 mode still. */ #if __has_attribute(nonnull) \ && defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */ #define _X_NONNULL(...) __attribute__((nonnull(__VA_ARGS__))) #elif __has_attribute(nonnull) \ || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303) #define _X_NONNULL(args...) __attribute__((nonnull(args))) #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */ #define _X_NONNULL(...) /* */ #endif /* requires xproto >= 7.0.22 */ #if __has_attribute(__unused__) \ || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205) #define _X_UNUSED __attribute__((__unused__)) #else #define _X_UNUSED /* */ #endif /* C99 keyword "inline" or equivalent extensions in pre-C99 compilers */ /* requires xproto >= 7.0.9 (introduced in 7.0.8 but didn't support all compilers until 7.0.9) */ #if defined(inline) /* assume autoconf set it correctly */ || \ (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */ || \ (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)) # define _X_INLINE inline #elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */ # define _X_INLINE __inline__ #else # define _X_INLINE #endif /* C99 keyword "restrict" or equivalent extensions in pre-C99 compilers */ /* requires xproto >= 7.0.21 */ #ifndef _X_RESTRICT_KYWD # if defined(restrict) /* assume autoconf set it correctly */ || \ (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */ \ && !defined(__cplusplus)) /* Workaround g++ issue on Solaris */ # define _X_RESTRICT_KYWD restrict # elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */ # define _X_RESTRICT_KYWD __restrict__ # else # define _X_RESTRICT_KYWD # endif #endif /* requires xproto >= 7.0.30 */ #if __has_attribute(no_sanitize_thread) # define _X_NOTSAN __attribute__((no_sanitize_thread)) #else # define _X_NOTSAN #endif #endif /* _XFUNCPROTO_H_ */ X11/xpm.h000064400000037525147631660250006120 0ustar00/* * Copyright (C) 1989-95 GROUPE BULL * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of GROUPE BULL shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from GROUPE BULL. */ /*****************************************************************************\ * xpm.h: * * * * XPM library * * Include file * * * * Developed by Arnaud Le Hors * \*****************************************************************************/ /* * The code related to FOR_MSW has been added by * HeDu (hedu@cul-ipn.uni-kiel.de) 4/94 */ /* * The code related to AMIGA has been added by * Lorens Younes (d93-hyo@nada.kth.se) 4/96 */ #ifndef XPM_h #define XPM_h /* * first some identification numbers: * the version and revision numbers are determined with the following rule: * SO Major number = LIB minor version number. * SO Minor number = LIB sub-minor version number. * e.g: Xpm version 3.2f * we forget the 3 which is the format number, 2 gives 2, and f gives 6. * thus we have XpmVersion = 2 and XpmRevision = 6 * which gives SOXPMLIBREV = 2.6 * * Then the XpmIncludeVersion number is built from these numbers. */ #define XpmFormat 3 #define XpmVersion 4 #define XpmRevision 11 #define XpmIncludeVersion ((XpmFormat * 100 + XpmVersion) * 100 + XpmRevision) #ifndef XPM_NUMBERS #ifdef FOR_MSW # define SYSV /* uses memcpy string.h etc. */ # include # include "simx.h" /* defines some X stuff using MSW types */ #define NEED_STRCASECMP /* at least for MSVC++ */ #else /* FOR_MSW */ # ifdef AMIGA # include "amigax.h" # else /* not AMIGA */ # include # include # endif /* not AMIGA */ #endif /* FOR_MSW */ /* let's define Pixel if it is not done yet */ #if ! defined(_XtIntrinsic_h) && ! defined(PIXEL_ALREADY_TYPEDEFED) typedef unsigned long Pixel; /* Index into colormap */ # define PIXEL_ALREADY_TYPEDEFED #endif /* Return ErrorStatus codes: * null if full success * positive if partial success * negative if failure */ #define XpmColorError 1 #define XpmSuccess 0 #define XpmOpenFailed -1 #define XpmFileInvalid -2 #define XpmNoMemory -3 #define XpmColorFailed -4 typedef struct { char *name; /* Symbolic color name */ char *value; /* Color value */ Pixel pixel; /* Color pixel */ } XpmColorSymbol; typedef struct { char *name; /* name of the extension */ unsigned int nlines; /* number of lines in this extension */ char **lines; /* pointer to the extension array of strings */ } XpmExtension; typedef struct { char *string; /* characters string */ char *symbolic; /* symbolic name */ char *m_color; /* monochrom default */ char *g4_color; /* 4 level grayscale default */ char *g_color; /* other level grayscale default */ char *c_color; /* color default */ } XpmColor; typedef struct { unsigned int width; /* image width */ unsigned int height; /* image height */ unsigned int cpp; /* number of characters per pixel */ unsigned int ncolors; /* number of colors */ XpmColor *colorTable; /* list of related colors */ unsigned int *data; /* image data */ } XpmImage; typedef struct { unsigned long valuemask; /* Specifies which attributes are defined */ char *hints_cmt; /* Comment of the hints section */ char *colors_cmt; /* Comment of the colors section */ char *pixels_cmt; /* Comment of the pixels section */ unsigned int x_hotspot; /* Returns the x hotspot's coordinate */ unsigned int y_hotspot; /* Returns the y hotspot's coordinate */ unsigned int nextensions; /* number of extensions */ XpmExtension *extensions; /* pointer to array of extensions */ } XpmInfo; typedef int (*XpmAllocColorFunc)( Display* /* display */, Colormap /* colormap */, char* /* colorname */, XColor* /* xcolor */, void* /* closure */ ); typedef int (*XpmFreeColorsFunc)( Display* /* display */, Colormap /* colormap */, Pixel* /* pixels */, int /* npixels */, void* /* closure */ ); typedef struct { unsigned long valuemask; /* Specifies which attributes are defined */ Visual *visual; /* Specifies the visual to use */ Colormap colormap; /* Specifies the colormap to use */ unsigned int depth; /* Specifies the depth */ unsigned int width; /* Returns the width of the created pixmap */ unsigned int height; /* Returns the height of the created pixmap */ unsigned int x_hotspot; /* Returns the x hotspot's coordinate */ unsigned int y_hotspot; /* Returns the y hotspot's coordinate */ unsigned int cpp; /* Specifies the number of char per pixel */ Pixel *pixels; /* List of used color pixels */ unsigned int npixels; /* Number of used pixels */ XpmColorSymbol *colorsymbols; /* List of color symbols to override */ unsigned int numsymbols; /* Number of symbols */ char *rgb_fname; /* RGB text file name */ unsigned int nextensions; /* Number of extensions */ XpmExtension *extensions; /* List of extensions */ unsigned int ncolors; /* Number of colors */ XpmColor *colorTable; /* List of colors */ /* 3.2 backward compatibility code */ char *hints_cmt; /* Comment of the hints section */ char *colors_cmt; /* Comment of the colors section */ char *pixels_cmt; /* Comment of the pixels section */ /* end 3.2 bc */ unsigned int mask_pixel; /* Color table index of transparent color */ /* Color Allocation Directives */ Bool exactColors; /* Only use exact colors for visual */ unsigned int closeness; /* Allowable RGB deviation */ unsigned int red_closeness; /* Allowable red deviation */ unsigned int green_closeness; /* Allowable green deviation */ unsigned int blue_closeness; /* Allowable blue deviation */ int color_key; /* Use colors from this color set */ Pixel *alloc_pixels; /* Returns the list of alloc'ed color pixels */ int nalloc_pixels; /* Returns the number of alloc'ed color pixels */ Bool alloc_close_colors; /* Specify whether close colors should be allocated using XAllocColor or not */ int bitmap_format; /* Specify the format of 1bit depth images: ZPixmap or XYBitmap */ /* Color functions */ XpmAllocColorFunc alloc_color; /* Application color allocator */ XpmFreeColorsFunc free_colors; /* Application color de-allocator */ void *color_closure; /* Application private data to pass to alloc_color and free_colors */ } XpmAttributes; /* XpmAttributes value masks bits */ #define XpmVisual (1L<<0) #define XpmColormap (1L<<1) #define XpmDepth (1L<<2) #define XpmSize (1L<<3) /* width & height */ #define XpmHotspot (1L<<4) /* x_hotspot & y_hotspot */ #define XpmCharsPerPixel (1L<<5) #define XpmColorSymbols (1L<<6) #define XpmRgbFilename (1L<<7) /* 3.2 backward compatibility code */ #define XpmInfos (1L<<8) #define XpmReturnInfos XpmInfos /* end 3.2 bc */ #define XpmReturnPixels (1L<<9) #define XpmExtensions (1L<<10) #define XpmReturnExtensions XpmExtensions #define XpmExactColors (1L<<11) #define XpmCloseness (1L<<12) #define XpmRGBCloseness (1L<<13) #define XpmColorKey (1L<<14) #define XpmColorTable (1L<<15) #define XpmReturnColorTable XpmColorTable #define XpmReturnAllocPixels (1L<<16) #define XpmAllocCloseColors (1L<<17) #define XpmBitmapFormat (1L<<18) #define XpmAllocColor (1L<<19) #define XpmFreeColors (1L<<20) #define XpmColorClosure (1L<<21) /* XpmInfo value masks bits */ #define XpmComments XpmInfos #define XpmReturnComments XpmComments /* XpmAttributes mask_pixel value when there is no mask */ #ifndef FOR_MSW #define XpmUndefPixel 0x80000000 #else /* int is only 16 bit for MSW */ #define XpmUndefPixel 0x8000 #endif /* * color keys for visual type, they must fit along with the number key of * each related element in xpmColorKeys[] defined in XpmI.h */ #define XPM_MONO 2 #define XPM_GREY4 3 #define XPM_GRAY4 3 #define XPM_GREY 4 #define XPM_GRAY 4 #define XPM_COLOR 5 /* macros for forward declarations of functions with prototypes */ #define FUNC(f, t, p) extern t f p #define LFUNC(f, t, p) static t f p /* * functions declarations */ _XFUNCPROTOBEGIN /* FOR_MSW, all ..Pixmap.. are excluded, only the ..XImage.. are used */ /* Same for Amiga! */ #if !defined(FOR_MSW) && !defined(AMIGA) FUNC(XpmCreatePixmapFromData, int, (Display *display, Drawable d, char **data, Pixmap *pixmap_return, Pixmap *shapemask_return, XpmAttributes *attributes)); FUNC(XpmCreateDataFromPixmap, int, (Display *display, char ***data_return, Pixmap pixmap, Pixmap shapemask, XpmAttributes *attributes)); FUNC(XpmReadFileToPixmap, int, (Display *display, Drawable d, const char *filename, Pixmap *pixmap_return, Pixmap *shapemask_return, XpmAttributes *attributes)); FUNC(XpmWriteFileFromPixmap, int, (Display *display, const char *filename, Pixmap pixmap, Pixmap shapemask, XpmAttributes *attributes)); #endif FUNC(XpmCreateImageFromData, int, (Display *display, char **data, XImage **image_return, XImage **shapemask_return, XpmAttributes *attributes)); FUNC(XpmCreateDataFromImage, int, (Display *display, char ***data_return, XImage *image, XImage *shapeimage, XpmAttributes *attributes)); FUNC(XpmReadFileToImage, int, (Display *display, const char *filename, XImage **image_return, XImage **shapeimage_return, XpmAttributes *attributes)); FUNC(XpmWriteFileFromImage, int, (Display *display, const char *filename, XImage *image, XImage *shapeimage, XpmAttributes *attributes)); FUNC(XpmCreateImageFromBuffer, int, (Display *display, char *buffer, XImage **image_return, XImage **shapemask_return, XpmAttributes *attributes)); #if !defined(FOR_MSW) && !defined(AMIGA) FUNC(XpmCreatePixmapFromBuffer, int, (Display *display, Drawable d, char *buffer, Pixmap *pixmap_return, Pixmap *shapemask_return, XpmAttributes *attributes)); FUNC(XpmCreateBufferFromImage, int, (Display *display, char **buffer_return, XImage *image, XImage *shapeimage, XpmAttributes *attributes)); FUNC(XpmCreateBufferFromPixmap, int, (Display *display, char **buffer_return, Pixmap pixmap, Pixmap shapemask, XpmAttributes *attributes)); #endif FUNC(XpmReadFileToBuffer, int, (const char *filename, char **buffer_return)); FUNC(XpmWriteFileFromBuffer, int, (const char *filename, char *buffer)); FUNC(XpmReadFileToData, int, (const char *filename, char ***data_return)); FUNC(XpmWriteFileFromData, int, (const char *filename, char **data)); FUNC(XpmAttributesSize, int, (void)); FUNC(XpmFreeAttributes, void, (XpmAttributes *attributes)); FUNC(XpmFreeExtensions, void, (XpmExtension *extensions, int nextensions)); FUNC(XpmFreeXpmImage, void, (XpmImage *image)); FUNC(XpmFreeXpmInfo, void, (XpmInfo *info)); FUNC(XpmGetErrorString, char *, (int errcode)); FUNC(XpmLibraryVersion, int, (void)); /* XpmImage functions */ FUNC(XpmReadFileToXpmImage, int, (const char *filename, XpmImage *image, XpmInfo *info)); FUNC(XpmWriteFileFromXpmImage, int, (const char *filename, XpmImage *image, XpmInfo *info)); #if !defined(FOR_MSW) && !defined(AMIGA) FUNC(XpmCreatePixmapFromXpmImage, int, (Display *display, Drawable d, XpmImage *image, Pixmap *pixmap_return, Pixmap *shapemask_return, XpmAttributes *attributes)); #endif FUNC(XpmCreateImageFromXpmImage, int, (Display *display, XpmImage *image, XImage **image_return, XImage **shapeimage_return, XpmAttributes *attributes)); FUNC(XpmCreateXpmImageFromImage, int, (Display *display, XImage *image, XImage *shapeimage, XpmImage *xpmimage, XpmAttributes *attributes)); #if !defined(FOR_MSW) && !defined(AMIGA) FUNC(XpmCreateXpmImageFromPixmap, int, (Display *display, Pixmap pixmap, Pixmap shapemask, XpmImage *xpmimage, XpmAttributes *attributes)); #endif FUNC(XpmCreateDataFromXpmImage, int, (char ***data_return, XpmImage *image, XpmInfo *info)); FUNC(XpmCreateXpmImageFromData, int, (char **data, XpmImage *image, XpmInfo *info)); FUNC(XpmCreateXpmImageFromBuffer, int, (char *buffer, XpmImage *image, XpmInfo *info)); FUNC(XpmCreateBufferFromXpmImage, int, (char **buffer_return, XpmImage *image, XpmInfo *info)); FUNC(XpmGetParseError, int, (char *filename, int *linenum_return, int *charnum_return)); FUNC(XpmFree, void, (void *ptr)); _XFUNCPROTOEND /* backward compatibility */ /* for version 3.0c */ #define XpmPixmapColorError XpmColorError #define XpmPixmapSuccess XpmSuccess #define XpmPixmapOpenFailed XpmOpenFailed #define XpmPixmapFileInvalid XpmFileInvalid #define XpmPixmapNoMemory XpmNoMemory #define XpmPixmapColorFailed XpmColorFailed #define XpmReadPixmapFile(dpy, d, file, pix, mask, att) \ XpmReadFileToPixmap(dpy, d, file, pix, mask, att) #define XpmWritePixmapFile(dpy, file, pix, mask, att) \ XpmWriteFileFromPixmap(dpy, file, pix, mask, att) /* for version 3.0b */ #define PixmapColorError XpmColorError #define PixmapSuccess XpmSuccess #define PixmapOpenFailed XpmOpenFailed #define PixmapFileInvalid XpmFileInvalid #define PixmapNoMemory XpmNoMemory #define PixmapColorFailed XpmColorFailed #define ColorSymbol XpmColorSymbol #define XReadPixmapFile(dpy, d, file, pix, mask, att) \ XpmReadFileToPixmap(dpy, d, file, pix, mask, att) #define XWritePixmapFile(dpy, file, pix, mask, att) \ XpmWriteFileFromPixmap(dpy, file, pix, mask, att) #define XCreatePixmapFromData(dpy, d, data, pix, mask, att) \ XpmCreatePixmapFromData(dpy, d, data, pix, mask, att) #define XCreateDataFromPixmap(dpy, data, pix, mask, att) \ XpmCreateDataFromPixmap(dpy, data, pix, mask, att) #endif /* XPM_NUMBERS */ #endif X11/Xproto.h000064400000157177147631660250006615 0ustar00/* Definitions for the X window system used by server and c bindings */ /* * This packet-construction scheme makes the following assumptions: * * 1. The compiler is able * to generate code which addresses one- and two-byte quantities. * In the worst case, this would be done with bit-fields. If bit-fields * are used it may be necessary to reorder the request fields in this file, * depending on the order in which the machine assigns bit fields to * machine words. There may also be a problem with sign extension, * as K+R specify that bitfields are always unsigned. * * 2. 2- and 4-byte fields in packet structures must be ordered by hand * such that they are naturally-aligned, so that no compiler will ever * insert padding bytes. * * 3. All packets are hand-padded to a multiple of 4 bytes, for * the same reason. */ #ifndef XPROTO_H #define XPROTO_H /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include #include /* * Define constants for the sizes of the network packets. The sz_ prefix is * used instead of something more descriptive so that the symbols are no more * than 32 characters in length (which causes problems for some compilers). */ #define sz_xSegment 8 #define sz_xPoint 4 #define sz_xRectangle 8 #define sz_xArc 12 #define sz_xConnClientPrefix 12 #define sz_xConnSetupPrefix 8 #define sz_xConnSetup 32 #define sz_xPixmapFormat 8 #define sz_xDepth 8 #define sz_xVisualType 24 #define sz_xWindowRoot 40 #define sz_xTimecoord 8 #define sz_xHostEntry 4 #define sz_xCharInfo 12 #define sz_xFontProp 8 #define sz_xTextElt 2 #define sz_xColorItem 12 #define sz_xrgb 8 #define sz_xGenericReply 32 #define sz_xGetWindowAttributesReply 44 #define sz_xGetGeometryReply 32 #define sz_xQueryTreeReply 32 #define sz_xInternAtomReply 32 #define sz_xGetAtomNameReply 32 #define sz_xGetPropertyReply 32 #define sz_xListPropertiesReply 32 #define sz_xGetSelectionOwnerReply 32 #define sz_xGrabPointerReply 32 #define sz_xQueryPointerReply 32 #define sz_xGetMotionEventsReply 32 #define sz_xTranslateCoordsReply 32 #define sz_xGetInputFocusReply 32 #define sz_xQueryKeymapReply 40 #define sz_xQueryFontReply 60 #define sz_xQueryTextExtentsReply 32 #define sz_xListFontsReply 32 #define sz_xGetFontPathReply 32 #define sz_xGetImageReply 32 #define sz_xListInstalledColormapsReply 32 #define sz_xAllocColorReply 32 #define sz_xAllocNamedColorReply 32 #define sz_xAllocColorCellsReply 32 #define sz_xAllocColorPlanesReply 32 #define sz_xQueryColorsReply 32 #define sz_xLookupColorReply 32 #define sz_xQueryBestSizeReply 32 #define sz_xQueryExtensionReply 32 #define sz_xListExtensionsReply 32 #define sz_xSetMappingReply 32 #define sz_xGetKeyboardControlReply 52 #define sz_xGetPointerControlReply 32 #define sz_xGetScreenSaverReply 32 #define sz_xListHostsReply 32 #define sz_xSetModifierMappingReply 32 #define sz_xError 32 #define sz_xEvent 32 #define sz_xKeymapEvent 32 #define sz_xReq 4 #define sz_xResourceReq 8 #define sz_xCreateWindowReq 32 #define sz_xChangeWindowAttributesReq 12 #define sz_xChangeSaveSetReq 8 #define sz_xReparentWindowReq 16 #define sz_xConfigureWindowReq 12 #define sz_xCirculateWindowReq 8 #define sz_xInternAtomReq 8 #define sz_xChangePropertyReq 24 #define sz_xDeletePropertyReq 12 #define sz_xGetPropertyReq 24 #define sz_xSetSelectionOwnerReq 16 #define sz_xConvertSelectionReq 24 #define sz_xSendEventReq 44 #define sz_xGrabPointerReq 24 #define sz_xGrabButtonReq 24 #define sz_xUngrabButtonReq 12 #define sz_xChangeActivePointerGrabReq 16 #define sz_xGrabKeyboardReq 16 #define sz_xGrabKeyReq 16 #define sz_xUngrabKeyReq 12 #define sz_xAllowEventsReq 8 #define sz_xGetMotionEventsReq 16 #define sz_xTranslateCoordsReq 16 #define sz_xWarpPointerReq 24 #define sz_xSetInputFocusReq 12 #define sz_xOpenFontReq 12 #define sz_xQueryTextExtentsReq 8 #define sz_xListFontsReq 8 #define sz_xSetFontPathReq 8 #define sz_xCreatePixmapReq 16 #define sz_xCreateGCReq 16 #define sz_xChangeGCReq 12 #define sz_xCopyGCReq 16 #define sz_xSetDashesReq 12 #define sz_xSetClipRectanglesReq 12 #define sz_xCopyAreaReq 28 #define sz_xCopyPlaneReq 32 #define sz_xPolyPointReq 12 #define sz_xPolySegmentReq 12 #define sz_xFillPolyReq 16 #define sz_xPutImageReq 24 #define sz_xGetImageReq 20 #define sz_xPolyTextReq 16 #define sz_xImageTextReq 16 #define sz_xCreateColormapReq 16 #define sz_xCopyColormapAndFreeReq 12 #define sz_xAllocColorReq 16 #define sz_xAllocNamedColorReq 12 #define sz_xAllocColorCellsReq 12 #define sz_xAllocColorPlanesReq 16 #define sz_xFreeColorsReq 12 #define sz_xStoreColorsReq 8 #define sz_xStoreNamedColorReq 16 #define sz_xQueryColorsReq 8 #define sz_xLookupColorReq 12 #define sz_xCreateCursorReq 32 #define sz_xCreateGlyphCursorReq 32 #define sz_xRecolorCursorReq 20 #define sz_xQueryBestSizeReq 12 #define sz_xQueryExtensionReq 8 #define sz_xChangeKeyboardControlReq 8 #define sz_xBellReq 4 #define sz_xChangePointerControlReq 12 #define sz_xSetScreenSaverReq 12 #define sz_xChangeHostsReq 8 #define sz_xListHostsReq 4 #define sz_xChangeModeReq 4 #define sz_xRotatePropertiesReq 12 #define sz_xReply 32 #define sz_xGrabKeyboardReply 32 #define sz_xListFontsWithInfoReply 60 #define sz_xSetPointerMappingReply 32 #define sz_xGetKeyboardMappingReply 32 #define sz_xGetPointerMappingReply 32 #define sz_xGetModifierMappingReply 32 #define sz_xListFontsWithInfoReq 8 #define sz_xPolyLineReq 12 #define sz_xPolyArcReq 12 #define sz_xPolyRectangleReq 12 #define sz_xPolyFillRectangleReq 12 #define sz_xPolyFillArcReq 12 #define sz_xPolyText8Req 16 #define sz_xPolyText16Req 16 #define sz_xImageText8Req 16 #define sz_xImageText16Req 16 #define sz_xSetPointerMappingReq 4 #define sz_xForceScreenSaverReq 4 #define sz_xSetCloseDownModeReq 4 #define sz_xClearAreaReq 16 #define sz_xSetAccessControlReq 4 #define sz_xGetKeyboardMappingReq 8 #define sz_xSetModifierMappingReq 4 #define sz_xPropIconSize 24 #define sz_xChangeKeyboardMappingReq 8 /* For the purpose of the structure definitions in this file, we must redefine the following types in terms of Xmd.h's types, which may include bit fields. All of these are #undef'd at the end of this file, restoring the definitions in X.h. */ #define Window CARD32 #define Drawable CARD32 #define Font CARD32 #define Pixmap CARD32 #define Cursor CARD32 #define Colormap CARD32 #define GContext CARD32 #define Atom CARD32 #define VisualID CARD32 #define Time CARD32 #define KeyCode CARD8 #define KeySym CARD32 #define X_TCP_PORT 6000 /* add display number */ #define xTrue 1 #define xFalse 0 typedef CARD16 KeyButMask; /***************** Connection setup structures. See Chapter 8: Connection Setup of the X Window System Protocol specification for details. *****************/ /* Client initiates handshake with this data, followed by the strings * for the auth protocol & data. */ typedef struct { CARD8 byteOrder; BYTE pad; CARD16 majorVersion B16, minorVersion B16; CARD16 nbytesAuthProto B16; /* Authorization protocol */ CARD16 nbytesAuthString B16; /* Authorization string */ CARD16 pad2 B16; } xConnClientPrefix; /* Server response to xConnClientPrefix. * * If success == Success, this is followed by xConnSetup and * numRoots xWindowRoot structs. * * If success == Failure, this is followed by a reason string. * * The protocol also defines a case of success == Authenticate, but * that doesn't seem to have ever been implemented by the X Consortium. */ typedef struct { CARD8 success; BYTE lengthReason; /*num bytes in string following if failure */ CARD16 majorVersion B16, minorVersion B16; CARD16 length B16; /* 1/4 additional bytes in setup info */ } xConnSetupPrefix; typedef struct { CARD32 release B32; CARD32 ridBase B32, ridMask B32; CARD32 motionBufferSize B32; CARD16 nbytesVendor B16; /* number of bytes in vendor string */ CARD16 maxRequestSize B16; CARD8 numRoots; /* number of roots structs to follow */ CARD8 numFormats; /* number of pixmap formats */ CARD8 imageByteOrder; /* LSBFirst, MSBFirst */ CARD8 bitmapBitOrder; /* LeastSignificant, MostSign...*/ CARD8 bitmapScanlineUnit, /* 8, 16, 32 */ bitmapScanlinePad; /* 8, 16, 32 */ KeyCode minKeyCode, maxKeyCode; CARD32 pad2 B32; } xConnSetup; typedef struct { CARD8 depth; CARD8 bitsPerPixel; CARD8 scanLinePad; CARD8 pad1; CARD32 pad2 B32; } xPixmapFormat; /* window root */ typedef struct { CARD8 depth; CARD8 pad1; CARD16 nVisuals B16; /* number of xVisualType structures following */ CARD32 pad2 B32; } xDepth; typedef struct { VisualID visualID B32; #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 bitsPerRGB; CARD16 colormapEntries B16; CARD32 redMask B32, greenMask B32, blueMask B32; CARD32 pad B32; } xVisualType; typedef struct { Window windowId B32; Colormap defaultColormap B32; CARD32 whitePixel B32, blackPixel B32; CARD32 currentInputMask B32; CARD16 pixWidth B16, pixHeight B16; CARD16 mmWidth B16, mmHeight B16; CARD16 minInstalledMaps B16, maxInstalledMaps B16; VisualID rootVisualID B32; CARD8 backingStore; BOOL saveUnders; CARD8 rootDepth; CARD8 nDepths; /* number of xDepth structures following */ } xWindowRoot; /***************************************************************** * Structure Defns * Structures needed for replies *****************************************************************/ /* Used in GetMotionEvents */ typedef struct { CARD32 time B32; INT16 x B16, y B16; } xTimecoord; typedef struct { CARD8 family; BYTE pad; CARD16 length B16; } xHostEntry; typedef struct { INT16 leftSideBearing B16, rightSideBearing B16, characterWidth B16, ascent B16, descent B16; CARD16 attributes B16; } xCharInfo; typedef struct { Atom name B32; CARD32 value B32; } xFontProp; /* * non-aligned big-endian font ID follows this struct */ typedef struct { /* followed by string */ CARD8 len; /* number of *characters* in string, or FontChange (255) for font change, or 0 if just delta given */ INT8 delta; } xTextElt; typedef struct { CARD32 pixel B32; CARD16 red B16, green B16, blue B16; CARD8 flags; /* DoRed, DoGreen, DoBlue booleans */ CARD8 pad; } xColorItem; typedef struct { CARD16 red B16, green B16, blue B16, pad B16; } xrgb; typedef CARD8 KEYCODE; /***************** * XRep: * meant to be 32 byte quantity *****************/ /* GenericReply is the common format of all replies. The "data" items are specific to each individual reply type. */ typedef struct { BYTE type; /* X_Reply */ BYTE data1; /* depends on reply type */ CARD16 sequenceNumber B16; /* of last request received by server */ CARD32 length B32; /* 4 byte quantities beyond size of GenericReply */ CARD32 data00 B32; CARD32 data01 B32; CARD32 data02 B32; CARD32 data03 B32; CARD32 data04 B32; CARD32 data05 B32; } xGenericReply; /* Individual reply formats. */ typedef struct { BYTE type; /* X_Reply */ CARD8 backingStore; CARD16 sequenceNumber B16; CARD32 length B32; /* NOT 0; this is an extra-large reply */ VisualID visualID B32; #if defined(__cplusplus) || defined(c_plusplus) CARD16 c_class B16; #else CARD16 class B16; #endif CARD8 bitGravity; CARD8 winGravity; CARD32 backingBitPlanes B32; CARD32 backingPixel B32; BOOL saveUnder; BOOL mapInstalled; CARD8 mapState; BOOL override; Colormap colormap B32; CARD32 allEventMasks B32; CARD32 yourEventMask B32; CARD16 doNotPropagateMask B16; CARD16 pad B16; } xGetWindowAttributesReply; typedef struct { BYTE type; /* X_Reply */ CARD8 depth; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window root B32; INT16 x B16, y B16; CARD16 width B16, height B16; CARD16 borderWidth B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; } xGetGeometryReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; Window root B32, parent B32; CARD16 nChildren B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xQueryTreeReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Atom atom B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xInternAtomReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* of additional bytes */ CARD16 nameLength B16; /* # of characters in name */ CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetAtomNameReply; typedef struct { BYTE type; /* X_Reply */ CARD8 format; CARD16 sequenceNumber B16; CARD32 length B32; /* of additional bytes */ Atom propertyType B32; CARD32 bytesAfter B32; CARD32 nItems B32; /* # of 8, 16, or 32-bit entities in reply */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xGetPropertyReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nProperties B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListPropertiesReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window owner B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetSelectionOwnerReply; typedef struct { BYTE type; /* X_Reply */ BYTE status; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGrabPointerReply; typedef xGrabPointerReply xGrabKeyboardReply; typedef struct { BYTE type; /* X_Reply */ BOOL sameScreen; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window root B32, child B32; INT16 rootX B16, rootY B16, winX B16, winY B16; CARD16 mask B16; CARD16 pad1 B16; CARD32 pad B32; } xQueryPointerReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 nEvents B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetMotionEventsReply; typedef struct { BYTE type; /* X_Reply */ BOOL sameScreen; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window child B32; INT16 dstX B16, dstY B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xTranslateCoordsReply; typedef struct { BYTE type; /* X_Reply */ CARD8 revertTo; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window focus B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xGetInputFocusReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 2, NOT 0; this is an extra-large reply */ BYTE map[32]; } xQueryKeymapReply; /* Warning: this MUST match (up to component renaming) xListFontsWithInfoReply */ typedef struct _xQueryFontReply { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* definitely > 0, even if "nCharInfos" is 0 */ xCharInfo minBounds; CARD32 walign1 B32; xCharInfo maxBounds; CARD32 walign2 B32; CARD16 minCharOrByte2 B16, maxCharOrByte2 B16; CARD16 defaultChar B16; CARD16 nFontProps B16; /* followed by this many xFontProp structures */ CARD8 drawDirection; CARD8 minByte1, maxByte1; BOOL allCharsExist; INT16 fontAscent B16, fontDescent B16; CARD32 nCharInfos B32; /* followed by this many xCharInfo structures */ } xQueryFontReply; typedef struct { BYTE type; /* X_Reply */ CARD8 drawDirection; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ INT16 fontAscent B16, fontDescent B16; INT16 overallAscent B16, overallDescent B16; INT32 overallWidth B32, overallLeft B32, overallRight B32; CARD32 pad B32; } xQueryTextExtentsReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nFonts B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListFontsReply; /* Warning: this MUST match (up to component renaming) xQueryFontReply */ typedef struct { BYTE type; /* X_Reply */ CARD8 nameLength; /* 0 indicates end-of-reply-sequence */ CARD16 sequenceNumber B16; CARD32 length B32; /* definitely > 0, even if "nameLength" is 0 */ xCharInfo minBounds; CARD32 walign1 B32; xCharInfo maxBounds; CARD32 walign2 B32; CARD16 minCharOrByte2 B16, maxCharOrByte2 B16; CARD16 defaultChar B16; CARD16 nFontProps B16; /* followed by this many xFontProp structures */ CARD8 drawDirection; CARD8 minByte1, maxByte1; BOOL allCharsExist; INT16 fontAscent B16, fontDescent B16; CARD32 nReplies B32; /* hint as to how many more replies might be coming */ } xListFontsWithInfoReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nPaths B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetFontPathReply; typedef struct { BYTE type; /* X_Reply */ CARD8 depth; CARD16 sequenceNumber B16; CARD32 length B32; VisualID visual B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetImageReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nColormaps B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListInstalledColormapsReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 red B16, green B16, blue B16; CARD16 pad2 B16; CARD32 pixel B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xAllocColorReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD32 pixel B32; CARD16 exactRed B16, exactGreen B16, exactBlue B16; CARD16 screenRed B16, screenGreen B16, screenBlue B16; CARD32 pad2 B32; CARD32 pad3 B32; } xAllocNamedColorReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nPixels B16, nMasks B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xAllocColorCellsReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nPixels B16; CARD16 pad2 B16; CARD32 redMask B32, greenMask B32, blueMask B32; CARD32 pad3 B32; CARD32 pad4 B32; } xAllocColorPlanesReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nColors B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xQueryColorsReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 exactRed B16, exactGreen B16, exactBlue B16; CARD16 screenRed B16, screenGreen B16, screenBlue B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xLookupColorReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 width B16, height B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xQueryBestSizeReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ BOOL present; CARD8 major_opcode; CARD8 first_event; CARD8 first_error; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xQueryExtensionReply; typedef struct { BYTE type; /* X_Reply */ CARD8 nExtensions; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListExtensionsReply; typedef struct { BYTE type; /* X_Reply */ CARD8 success; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xSetMappingReply; typedef xSetMappingReply xSetPointerMappingReply; typedef xSetMappingReply xSetModifierMappingReply; typedef struct { BYTE type; /* X_Reply */ CARD8 nElts; /* how many elements does the map have */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetPointerMappingReply; typedef struct { BYTE type; CARD8 keySymsPerKeyCode; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetKeyboardMappingReply; typedef struct { BYTE type; CARD8 numKeyPerModifier; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetModifierMappingReply; typedef struct { BYTE type; /* X_Reply */ BOOL globalAutoRepeat; CARD16 sequenceNumber B16; CARD32 length B32; /* 5 */ CARD32 ledMask B32; CARD8 keyClickPercent, bellPercent; CARD16 bellPitch B16, bellDuration B16; CARD16 pad B16; BYTE map[32]; /* bit masks start here */ } xGetKeyboardControlReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 accelNumerator B16, accelDenominator B16; CARD16 threshold B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetPointerControlReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 timeout B16, interval B16; BOOL preferBlanking; BOOL allowExposures; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetScreenSaverReply; typedef struct { BYTE type; /* X_Reply */ BOOL enabled; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nHosts B16; CARD16 pad1 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListHostsReply; /***************************************************************** * Xerror * All errors are 32 bytes *****************************************************************/ typedef struct { BYTE type; /* X_Error */ BYTE errorCode; CARD16 sequenceNumber B16; /* the nth request from this client */ CARD32 resourceID B32; CARD16 minorCode B16; CARD8 majorCode; BYTE pad1; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xError; /***************************************************************** * xEvent * All events are 32 bytes *****************************************************************/ typedef struct _xEvent { union { struct { BYTE type; BYTE detail; CARD16 sequenceNumber B16; } u; struct { CARD32 pad00 B32; Time time B32; Window root B32, event B32, child B32; INT16 rootX B16, rootY B16, eventX B16, eventY B16; KeyButMask state B16; BOOL sameScreen; BYTE pad1; } keyButtonPointer; struct { CARD32 pad00 B32; Time time B32; Window root B32, event B32, child B32; INT16 rootX B16, rootY B16, eventX B16, eventY B16; KeyButMask state B16; BYTE mode; /* really XMode */ BYTE flags; /* sameScreen and focus booleans, packed together */ #define ELFlagFocus (1<<0) #define ELFlagSameScreen (1<<1) } enterLeave; struct { CARD32 pad00 B32; Window window B32; BYTE mode; /* really XMode */ BYTE pad1, pad2, pad3; } focus; struct { CARD32 pad00 B32; Window window B32; CARD16 x B16, y B16, width B16, height B16; CARD16 count B16; CARD16 pad2 B16; } expose; struct { CARD32 pad00 B32; Drawable drawable B32; CARD16 x B16, y B16, width B16, height B16; CARD16 minorEvent B16; CARD16 count B16; BYTE majorEvent; BYTE pad1, pad2, pad3; } graphicsExposure; struct { CARD32 pad00 B32; Drawable drawable B32; CARD16 minorEvent B16; BYTE majorEvent; BYTE bpad; } noExposure; struct { CARD32 pad00 B32; Window window B32; CARD8 state; BYTE pad1, pad2, pad3; } visibility; struct { CARD32 pad00 B32; Window parent B32, window B32; INT16 x B16, y B16; CARD16 width B16, height B16, borderWidth B16; BOOL override; BYTE bpad; } createNotify; /* * The event fields in the structures for DestroyNotify, UnmapNotify, * MapNotify, ReparentNotify, ConfigureNotify, CirculateNotify, GravityNotify, * must be at the same offset because server internal code is depending upon * this to patch up the events before they are delivered. * Also note that MapRequest, ConfigureRequest and CirculateRequest have * the same offset for the event window. */ struct { CARD32 pad00 B32; Window event B32, window B32; } destroyNotify; struct { CARD32 pad00 B32; Window event B32, window B32; BOOL fromConfigure; BYTE pad1, pad2, pad3; } unmapNotify; struct { CARD32 pad00 B32; Window event B32, window B32; BOOL override; BYTE pad1, pad2, pad3; } mapNotify; struct { CARD32 pad00 B32; Window parent B32, window B32; } mapRequest; struct { CARD32 pad00 B32; Window event B32, window B32, parent B32; INT16 x B16, y B16; BOOL override; BYTE pad1, pad2, pad3; } reparent; struct { CARD32 pad00 B32; Window event B32, window B32, aboveSibling B32; INT16 x B16, y B16; CARD16 width B16, height B16, borderWidth B16; BOOL override; BYTE bpad; } configureNotify; struct { CARD32 pad00 B32; Window parent B32, window B32, sibling B32; INT16 x B16, y B16; CARD16 width B16, height B16, borderWidth B16; CARD16 valueMask B16; CARD32 pad1 B32; } configureRequest; struct { CARD32 pad00 B32; Window event B32, window B32; INT16 x B16, y B16; CARD32 pad1 B32, pad2 B32, pad3 B32, pad4 B32; } gravity; struct { CARD32 pad00 B32; Window window B32; CARD16 width B16, height B16; } resizeRequest; struct { /* The event field in the circulate record is really the parent when this is used as a CirculateRequest instead of a CirculateNotify */ CARD32 pad00 B32; Window event B32, window B32, parent B32; BYTE place; /* Top or Bottom */ BYTE pad1, pad2, pad3; } circulate; struct { CARD32 pad00 B32; Window window B32; Atom atom B32; Time time B32; BYTE state; /* NewValue or Deleted */ BYTE pad1; CARD16 pad2 B16; } property; struct { CARD32 pad00 B32; Time time B32; Window window B32; Atom atom B32; } selectionClear; struct { CARD32 pad00 B32; Time time B32; Window owner B32, requestor B32; Atom selection B32, target B32, property B32; } selectionRequest; struct { CARD32 pad00 B32; Time time B32; Window requestor B32; Atom selection B32, target B32, property B32; } selectionNotify; struct { CARD32 pad00 B32; Window window B32; Colormap colormap B32; #if defined(__cplusplus) || defined(c_plusplus) BOOL c_new; #else BOOL new; #endif BYTE state; /* Installed or UnInstalled */ BYTE pad1, pad2; } colormap; struct { CARD32 pad00 B32; CARD8 request; KeyCode firstKeyCode; CARD8 count; BYTE pad1; } mappingNotify; struct { CARD32 pad00 B32; Window window B32; union { struct { Atom type B32; INT32 longs0 B32; INT32 longs1 B32; INT32 longs2 B32; INT32 longs3 B32; INT32 longs4 B32; } l; struct { Atom type B32; INT16 shorts0 B16; INT16 shorts1 B16; INT16 shorts2 B16; INT16 shorts3 B16; INT16 shorts4 B16; INT16 shorts5 B16; INT16 shorts6 B16; INT16 shorts7 B16; INT16 shorts8 B16; INT16 shorts9 B16; } s; struct { Atom type B32; INT8 bytes[20]; } b; } u; } clientMessage; } u; } xEvent; /********************************************************* * * Generic event * * Those events are not part of the core protocol spec and can be used by * various extensions. * type is always GenericEvent * extension is the minor opcode of the extension the event belongs to. * evtype is the actual event type, unique __per extension__. * * GenericEvents can be longer than 32 bytes, with the length field * specifying the number of 4 byte blocks after the first 32 bytes. * * */ typedef struct { BYTE type; CARD8 extension; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 evtype B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGenericEvent; /* KeymapNotify events are not included in the above union because they are different from all other events: they do not have a "detail" or "sequenceNumber", so there is room for a 248-bit key mask. */ typedef struct { BYTE type; BYTE map[31]; } xKeymapEvent; #define XEventSize (sizeof(xEvent)) /* XReply is the union of all the replies above whose "fixed part" fits in 32 bytes. It does NOT include GetWindowAttributesReply, QueryFontReply, QueryKeymapReply, or GetKeyboardControlReply ListFontsWithInfoReply */ typedef union { xGenericReply generic; xGetGeometryReply geom; xQueryTreeReply tree; xInternAtomReply atom; xGetAtomNameReply atomName; xGetPropertyReply property; xListPropertiesReply listProperties; xGetSelectionOwnerReply selection; xGrabPointerReply grabPointer; xGrabKeyboardReply grabKeyboard; xQueryPointerReply pointer; xGetMotionEventsReply motionEvents; xTranslateCoordsReply coords; xGetInputFocusReply inputFocus; xQueryTextExtentsReply textExtents; xListFontsReply fonts; xGetFontPathReply fontPath; xGetImageReply image; xListInstalledColormapsReply colormaps; xAllocColorReply allocColor; xAllocNamedColorReply allocNamedColor; xAllocColorCellsReply colorCells; xAllocColorPlanesReply colorPlanes; xQueryColorsReply colors; xLookupColorReply lookupColor; xQueryBestSizeReply bestSize; xQueryExtensionReply extension; xListExtensionsReply extensions; xSetModifierMappingReply setModifierMapping; xGetModifierMappingReply getModifierMapping; xSetPointerMappingReply setPointerMapping; xGetKeyboardMappingReply getKeyboardMapping; xGetPointerMappingReply getPointerMapping; xGetPointerControlReply pointerControl; xGetScreenSaverReply screenSaver; xListHostsReply hosts; xError error; xEvent event; } xReply; /***************************************************************** * REQUESTS *****************************************************************/ /* Request structure */ typedef struct _xReq { CARD8 reqType; CARD8 data; /* meaning depends on request type */ CARD16 length B16; /* length in 4 bytes quantities of whole request, including this header */ } xReq; /***************************************************************** * structures that follow request. *****************************************************************/ /* ResourceReq is used for any request which has a resource ID (or Atom or Time) as its one and only argument. */ typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD32 id B32; /* a Window, Drawable, Font, GContext, Pixmap, etc. */ } xResourceReq; typedef struct { CARD8 reqType; CARD8 depth; CARD16 length B16; Window wid B32, parent B32; INT16 x B16, y B16; CARD16 width B16, height B16, borderWidth B16; #if defined(__cplusplus) || defined(c_plusplus) CARD16 c_class B16; #else CARD16 class B16; #endif VisualID visual B32; CARD32 mask B32; } xCreateWindowReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; CARD32 valueMask B32; } xChangeWindowAttributesReq; typedef struct { CARD8 reqType; BYTE mode; CARD16 length B16; Window window B32; } xChangeSaveSetReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32, parent B32; INT16 x B16, y B16; } xReparentWindowReq; typedef struct { CARD8 reqType; CARD8 pad; CARD16 length B16; Window window B32; CARD16 mask B16; CARD16 pad2 B16; } xConfigureWindowReq; typedef struct { CARD8 reqType; CARD8 direction; CARD16 length B16; Window window B32; } xCirculateWindowReq; typedef struct { /* followed by padded string */ CARD8 reqType; BOOL onlyIfExists; CARD16 length B16; CARD16 nbytes B16; /* number of bytes in string */ CARD16 pad B16; } xInternAtomReq; typedef struct { CARD8 reqType; CARD8 mode; CARD16 length B16; Window window B32; Atom property B32, type B32; CARD8 format; BYTE pad[3]; CARD32 nUnits B32; /* length of stuff following, depends on format */ } xChangePropertyReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; Atom property B32; } xDeletePropertyReq; typedef struct { CARD8 reqType; #if defined(__cplusplus) || defined(c_plusplus) BOOL c_delete; #else BOOL delete; #endif CARD16 length B16; Window window B32; Atom property B32, type B32; CARD32 longOffset B32; CARD32 longLength B32; } xGetPropertyReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; Atom selection B32; Time time B32; } xSetSelectionOwnerReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window requestor B32; Atom selection B32, target B32, property B32; Time time B32; } xConvertSelectionReq; typedef struct { CARD8 reqType; BOOL propagate; CARD16 length B16; Window destination B32; CARD32 eventMask B32; xEvent event; } xSendEventReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length B16; Window grabWindow B32; CARD16 eventMask B16; BYTE pointerMode, keyboardMode; Window confineTo B32; Cursor cursor B32; Time time B32; } xGrabPointerReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length B16; Window grabWindow B32; CARD16 eventMask B16; BYTE pointerMode, keyboardMode; Window confineTo B32; Cursor cursor B32; CARD8 button; BYTE pad; CARD16 modifiers B16; } xGrabButtonReq; typedef struct { CARD8 reqType; CARD8 button; CARD16 length B16; Window grabWindow B32; CARD16 modifiers B16; CARD16 pad B16; } xUngrabButtonReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Cursor cursor B32; Time time B32; CARD16 eventMask B16; CARD16 pad2 B16; } xChangeActivePointerGrabReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length B16; Window grabWindow B32; Time time B32; BYTE pointerMode, keyboardMode; CARD16 pad B16; } xGrabKeyboardReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length B16; Window grabWindow B32; CARD16 modifiers B16; CARD8 key; BYTE pointerMode, keyboardMode; BYTE pad1, pad2, pad3; } xGrabKeyReq; typedef struct { CARD8 reqType; CARD8 key; CARD16 length B16; Window grabWindow B32; CARD16 modifiers B16; CARD16 pad B16; } xUngrabKeyReq; typedef struct { CARD8 reqType; CARD8 mode; CARD16 length B16; Time time B32; } xAllowEventsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; Time start B32, stop B32; } xGetMotionEventsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window srcWid B32, dstWid B32; INT16 srcX B16, srcY B16; } xTranslateCoordsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window srcWid B32, dstWid B32; INT16 srcX B16, srcY B16; CARD16 srcWidth B16, srcHeight B16; INT16 dstX B16, dstY B16; } xWarpPointerReq; typedef struct { CARD8 reqType; CARD8 revertTo; CARD16 length B16; Window focus B32; Time time B32; } xSetInputFocusReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Font fid B32; CARD16 nbytes B16; BYTE pad1, pad2; /* string follows on word boundary */ } xOpenFontReq; typedef struct { CARD8 reqType; BOOL oddLength; CARD16 length B16; Font fid B32; } xQueryTextExtentsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD16 maxNames B16; CARD16 nbytes B16; /* followed immediately by string bytes */ } xListFontsReq; typedef xListFontsReq xListFontsWithInfoReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD16 nFonts B16; BYTE pad1, pad2; /* LISTofSTRING8 follows on word boundary */ } xSetFontPathReq; typedef struct { CARD8 reqType; CARD8 depth; CARD16 length B16; Pixmap pid B32; Drawable drawable B32; CARD16 width B16, height B16; } xCreatePixmapReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; GContext gc B32; Drawable drawable B32; CARD32 mask B32; } xCreateGCReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; GContext gc B32; CARD32 mask B32; } xChangeGCReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; GContext srcGC B32, dstGC B32; CARD32 mask B32; } xCopyGCReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; GContext gc B32; CARD16 dashOffset B16; CARD16 nDashes B16; /* length LISTofCARD8 of values following */ } xSetDashesReq; typedef struct { CARD8 reqType; BYTE ordering; CARD16 length B16; GContext gc B32; INT16 xOrigin B16, yOrigin B16; } xSetClipRectanglesReq; typedef struct { CARD8 reqType; BOOL exposures; CARD16 length B16; Window window B32; INT16 x B16, y B16; CARD16 width B16, height B16; } xClearAreaReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Drawable srcDrawable B32, dstDrawable B32; GContext gc B32; INT16 srcX B16, srcY B16, dstX B16, dstY B16; CARD16 width B16, height B16; } xCopyAreaReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Drawable srcDrawable B32, dstDrawable B32; GContext gc B32; INT16 srcX B16, srcY B16, dstX B16, dstY B16; CARD16 width B16, height B16; CARD32 bitPlane B32; } xCopyPlaneReq; typedef struct { CARD8 reqType; BYTE coordMode; CARD16 length B16; Drawable drawable B32; GContext gc B32; } xPolyPointReq; typedef xPolyPointReq xPolyLineReq; /* same request structure */ /* The following used for PolySegment, PolyRectangle, PolyArc, PolyFillRectangle, PolyFillArc */ typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Drawable drawable B32; GContext gc B32; } xPolySegmentReq; typedef xPolySegmentReq xPolyArcReq; typedef xPolySegmentReq xPolyRectangleReq; typedef xPolySegmentReq xPolyFillRectangleReq; typedef xPolySegmentReq xPolyFillArcReq; typedef struct _FillPolyReq { CARD8 reqType; BYTE pad; CARD16 length B16; Drawable drawable B32; GContext gc B32; BYTE shape; BYTE coordMode; CARD16 pad1 B16; } xFillPolyReq; typedef struct _PutImageReq { CARD8 reqType; CARD8 format; CARD16 length B16; Drawable drawable B32; GContext gc B32; CARD16 width B16, height B16; INT16 dstX B16, dstY B16; CARD8 leftPad; CARD8 depth; CARD16 pad B16; } xPutImageReq; typedef struct { CARD8 reqType; CARD8 format; CARD16 length B16; Drawable drawable B32; INT16 x B16, y B16; CARD16 width B16, height B16; CARD32 planeMask B32; } xGetImageReq; /* the following used by PolyText8 and PolyText16 */ typedef struct { CARD8 reqType; CARD8 pad; CARD16 length B16; Drawable drawable B32; GContext gc B32; INT16 x B16, y B16; /* items (xTextElt) start after struct */ } xPolyTextReq; typedef xPolyTextReq xPolyText8Req; typedef xPolyTextReq xPolyText16Req; typedef struct { CARD8 reqType; BYTE nChars; CARD16 length B16; Drawable drawable B32; GContext gc B32; INT16 x B16, y B16; } xImageTextReq; typedef xImageTextReq xImageText8Req; typedef xImageTextReq xImageText16Req; typedef struct { CARD8 reqType; BYTE alloc; CARD16 length B16; Colormap mid B32; Window window B32; VisualID visual B32; } xCreateColormapReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap mid B32; Colormap srcCmap B32; } xCopyColormapAndFreeReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; CARD16 red B16, green B16, blue B16; CARD16 pad2 B16; } xAllocColorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; CARD16 nbytes B16; /* followed by structure */ BYTE pad1, pad2; } xAllocNamedColorReq; typedef struct { CARD8 reqType; BOOL contiguous; CARD16 length B16; Colormap cmap B32; CARD16 colors B16, planes B16; } xAllocColorCellsReq; typedef struct { CARD8 reqType; BOOL contiguous; CARD16 length B16; Colormap cmap B32; CARD16 colors B16, red B16, green B16, blue B16; } xAllocColorPlanesReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; CARD32 planeMask B32; } xFreeColorsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; } xStoreColorsReq; typedef struct { CARD8 reqType; CARD8 flags; /* DoRed, DoGreen, DoBlue, as in xColorItem */ CARD16 length B16; Colormap cmap B32; CARD32 pixel B32; CARD16 nbytes B16; /* number of name string bytes following structure */ BYTE pad1, pad2; } xStoreNamedColorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; } xQueryColorsReq; typedef struct { /* followed by string of length len */ CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; CARD16 nbytes B16; /* number of string bytes following structure*/ BYTE pad1, pad2; } xLookupColorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Cursor cid B32; Pixmap source B32, mask B32; CARD16 foreRed B16, foreGreen B16, foreBlue B16; CARD16 backRed B16, backGreen B16, backBlue B16; CARD16 x B16, y B16; } xCreateCursorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Cursor cid B32; Font source B32, mask B32; CARD16 sourceChar B16, maskChar B16; CARD16 foreRed B16, foreGreen B16, foreBlue B16; CARD16 backRed B16, backGreen B16, backBlue B16; } xCreateGlyphCursorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Cursor cursor B32; CARD16 foreRed B16, foreGreen B16, foreBlue B16; CARD16 backRed B16, backGreen B16, backBlue B16; } xRecolorCursorReq; typedef struct { CARD8 reqType; #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD16 length B16; Drawable drawable B32; CARD16 width B16, height B16; } xQueryBestSizeReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD16 nbytes B16; /* number of string bytes following structure */ BYTE pad1, pad2; } xQueryExtensionReq; typedef struct { CARD8 reqType; CARD8 numKeyPerModifier; CARD16 length B16; } xSetModifierMappingReq; typedef struct { CARD8 reqType; CARD8 nElts; /* how many elements in the map */ CARD16 length B16; } xSetPointerMappingReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; KeyCode firstKeyCode; CARD8 count; CARD16 pad1 B16; } xGetKeyboardMappingReq; typedef struct { CARD8 reqType; CARD8 keyCodes; CARD16 length B16; KeyCode firstKeyCode; CARD8 keySymsPerKeyCode; CARD16 pad1 B16; } xChangeKeyboardMappingReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD32 mask B32; } xChangeKeyboardControlReq; typedef struct { CARD8 reqType; INT8 percent; /* -100 to 100 */ CARD16 length B16; } xBellReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; INT16 accelNum B16, accelDenum B16; INT16 threshold B16; BOOL doAccel, doThresh; } xChangePointerControlReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; INT16 timeout B16, interval B16; BYTE preferBlank, allowExpose; CARD16 pad2 B16; } xSetScreenSaverReq; typedef struct { CARD8 reqType; BYTE mode; CARD16 length B16; CARD8 hostFamily; BYTE pad; CARD16 hostLength B16; } xChangeHostsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; } xListHostsReq; typedef struct { CARD8 reqType; BYTE mode; CARD16 length B16; } xChangeModeReq; typedef xChangeModeReq xSetAccessControlReq; typedef xChangeModeReq xSetCloseDownModeReq; typedef xChangeModeReq xForceScreenSaverReq; typedef struct { /* followed by LIST of ATOM */ CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; CARD16 nAtoms B16; INT16 nPositions B16; } xRotatePropertiesReq; /* Reply codes */ #define X_Reply 1 /* Normal reply */ #define X_Error 0 /* Error */ /* Request codes */ #define X_CreateWindow 1 #define X_ChangeWindowAttributes 2 #define X_GetWindowAttributes 3 #define X_DestroyWindow 4 #define X_DestroySubwindows 5 #define X_ChangeSaveSet 6 #define X_ReparentWindow 7 #define X_MapWindow 8 #define X_MapSubwindows 9 #define X_UnmapWindow 10 #define X_UnmapSubwindows 11 #define X_ConfigureWindow 12 #define X_CirculateWindow 13 #define X_GetGeometry 14 #define X_QueryTree 15 #define X_InternAtom 16 #define X_GetAtomName 17 #define X_ChangeProperty 18 #define X_DeleteProperty 19 #define X_GetProperty 20 #define X_ListProperties 21 #define X_SetSelectionOwner 22 #define X_GetSelectionOwner 23 #define X_ConvertSelection 24 #define X_SendEvent 25 #define X_GrabPointer 26 #define X_UngrabPointer 27 #define X_GrabButton 28 #define X_UngrabButton 29 #define X_ChangeActivePointerGrab 30 #define X_GrabKeyboard 31 #define X_UngrabKeyboard 32 #define X_GrabKey 33 #define X_UngrabKey 34 #define X_AllowEvents 35 #define X_GrabServer 36 #define X_UngrabServer 37 #define X_QueryPointer 38 #define X_GetMotionEvents 39 #define X_TranslateCoords 40 #define X_WarpPointer 41 #define X_SetInputFocus 42 #define X_GetInputFocus 43 #define X_QueryKeymap 44 #define X_OpenFont 45 #define X_CloseFont 46 #define X_QueryFont 47 #define X_QueryTextExtents 48 #define X_ListFonts 49 #define X_ListFontsWithInfo 50 #define X_SetFontPath 51 #define X_GetFontPath 52 #define X_CreatePixmap 53 #define X_FreePixmap 54 #define X_CreateGC 55 #define X_ChangeGC 56 #define X_CopyGC 57 #define X_SetDashes 58 #define X_SetClipRectangles 59 #define X_FreeGC 60 #define X_ClearArea 61 #define X_CopyArea 62 #define X_CopyPlane 63 #define X_PolyPoint 64 #define X_PolyLine 65 #define X_PolySegment 66 #define X_PolyRectangle 67 #define X_PolyArc 68 #define X_FillPoly 69 #define X_PolyFillRectangle 70 #define X_PolyFillArc 71 #define X_PutImage 72 #define X_GetImage 73 #define X_PolyText8 74 #define X_PolyText16 75 #define X_ImageText8 76 #define X_ImageText16 77 #define X_CreateColormap 78 #define X_FreeColormap 79 #define X_CopyColormapAndFree 80 #define X_InstallColormap 81 #define X_UninstallColormap 82 #define X_ListInstalledColormaps 83 #define X_AllocColor 84 #define X_AllocNamedColor 85 #define X_AllocColorCells 86 #define X_AllocColorPlanes 87 #define X_FreeColors 88 #define X_StoreColors 89 #define X_StoreNamedColor 90 #define X_QueryColors 91 #define X_LookupColor 92 #define X_CreateCursor 93 #define X_CreateGlyphCursor 94 #define X_FreeCursor 95 #define X_RecolorCursor 96 #define X_QueryBestSize 97 #define X_QueryExtension 98 #define X_ListExtensions 99 #define X_ChangeKeyboardMapping 100 #define X_GetKeyboardMapping 101 #define X_ChangeKeyboardControl 102 #define X_GetKeyboardControl 103 #define X_Bell 104 #define X_ChangePointerControl 105 #define X_GetPointerControl 106 #define X_SetScreenSaver 107 #define X_GetScreenSaver 108 #define X_ChangeHosts 109 #define X_ListHosts 110 #define X_SetAccessControl 111 #define X_SetCloseDownMode 112 #define X_KillClient 113 #define X_RotateProperties 114 #define X_ForceScreenSaver 115 #define X_SetPointerMapping 116 #define X_GetPointerMapping 117 #define X_SetModifierMapping 118 #define X_GetModifierMapping 119 #define X_NoOperation 127 /* restore these definitions back to the typedefs in X.h */ #undef Window #undef Drawable #undef Font #undef Pixmap #undef Cursor #undef Colormap #undef GContext #undef Atom #undef VisualID #undef Time #undef KeyCode #undef KeySym #endif /* XPROTO_H */ X11/Xw32defs.h000064400000003566147631660250006717 0ustar00#ifndef _XW32DEFS_H # define _XW32DEFS_H # ifdef __GNUC__ /* mingw is more close to unix than msvc */ # if !defined(__daddr_t_defined) typedef char *caddr_t; # endif # define lstat stat # else typedef char *caddr_t; # define access _access # define alloca _alloca # define chdir _chdir # define chmod _chmod # define close _close # define creat _creat # define dup _dup # define dup2 _dup2 # define environ _environ # define execl _execl # define execle _execle # define execlp _execlp # define execlpe _execlpe # define execv _execv # define execve _execve # define execvp _execvp # define execvpe _execvpe # define fdopen _fdopen # define fileno _fileno # define fstat _fstat # define getcwd _getcwd # define getpid _getpid # define hypot _hypot # define isascii __isascii # define isatty _isatty # define lseek _lseek # define mkdir _mkdir # define mktemp _mktemp # define open _open # define putenv _putenv # define read _read # define rmdir _rmdir # define sleep(x) Sleep((x) * 1000) # define stat _stat # define sys_errlist _sys_errlist # define sys_nerr _sys_nerr # define umask _umask # define unlink _unlink # define write _write # define random rand # define srandom srand # define O_RDONLY _O_RDONLY # define O_WRONLY _O_WRONLY # define O_RDWR _O_RDWR # define O_APPEND _O_APPEND # define O_CREAT _O_CREAT # define O_TRUNC _O_TRUNC # define O_EXCL _O_EXCL # define O_TEXT _O_TEXT # define O_BINARY _O_BINARY # define O_RAW _O_BINARY # define S_IFMT _S_IFMT # define S_IFDIR _S_IFDIR # define S_IFCHR _S_IFCHR # define S_IFREG _S_IFREG # define S_IREAD _S_IREAD # define S_IWRITE _S_IWRITE # define S_IEXEC _S_IEXEC # define F_OK 0 # define X_OK 1 # define W_OK 2 # define R_OK 4 # endif /* __GNUC__ */ #endif X11/Xalloca.h000064400000010742147631660250006667 0ustar00/* Copyright 1995, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * The purpose of this header is to define the macros ALLOCATE_LOCAL and * DEALLOCATE_LOCAL appropriately for the platform being compiled on. * These macros are used to make fast, function-local memory allocations. * Their characteristics are as follows: * * void *ALLOCATE_LOCAL(int size) * Returns a pointer to size bytes of memory, or NULL if the allocation * failed. The memory must be freed with DEALLOCATE_LOCAL before the * function that made the allocation returns. You should not ask for * large blocks of memory with this function, since on many platforms * the memory comes from the stack, which may have limited size. * * void DEALLOCATE_LOCAL(void *) * Frees the memory allocated by ALLOCATE_LOCAL. Omission of this * step may be harmless on some platforms, but will result in * memory leaks or worse on others. * * Before including this file, you should define two macros, * ALLOCATE_LOCAL_FALLBACK and DEALLOCATE_LOCAL_FALLBACK, that have the * same characteristics as ALLOCATE_LOCAL and DEALLOCATE_LOCAL. The * header uses the fallbacks if it doesn't know a "better" way to define * ALLOCATE_LOCAL and DEALLOCATE_LOCAL. Typical usage would be: * * #define ALLOCATE_LOCAL_FALLBACK(_size) malloc(_size) * #define DEALLOCATE_LOCAL_FALLBACK(_ptr) free(_ptr) * #include "Xalloca.h" */ #ifndef XALLOCA_H #define XALLOCA_H 1 #ifndef INCLUDE_ALLOCA_H /* Need to add more here to match Imake *.cf's */ # if defined(HAVE_ALLOCA_H) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) # define INCLUDE_ALLOCA_H # endif #endif #ifdef INCLUDE_ALLOCA_H # include #endif #ifndef NO_ALLOCA /* * os-dependent definition of local allocation and deallocation * If you want something other than (DE)ALLOCATE_LOCAL_FALLBACK * for ALLOCATE/DEALLOCATE_LOCAL then you add that in here. */ # ifdef __GNUC__ # ifndef alloca # define alloca __builtin_alloca # endif /* !alloca */ # define ALLOCATE_LOCAL(size) alloca((int)(size)) # else /* ! __GNUC__ */ /* * warning: old mips alloca (pre 2.10) is unusable, new one is built in * Test is easy, the new one is named __builtin_alloca and comes * from alloca.h which #defines alloca. */ # if defined(__sun) || defined(alloca) /* * Some System V boxes extract alloca.o from /lib/libPW.a; if you * decide that you don't want to use alloca, you might want to fix it here. */ /* alloca might be a macro taking one arg (hi, Sun!), so give it one. */ # if !defined(__cplusplus) # define __Xnullarg /* as nothing */ extern void *alloca(__Xnullarg); # endif # define ALLOCATE_LOCAL(size) alloca((int)(size)) # endif /* who does alloca */ # endif /* __GNUC__ */ #endif /* NO_ALLOCA */ #if !defined(ALLOCATE_LOCAL) # if defined(ALLOCATE_LOCAL_FALLBACK) && defined(DEALLOCATE_LOCAL_FALLBACK) # define ALLOCATE_LOCAL(_size) ALLOCATE_LOCAL_FALLBACK(_size) # define DEALLOCATE_LOCAL(_ptr) DEALLOCATE_LOCAL_FALLBACK(_ptr) # else /* no fallbacks supplied; error */ # define ALLOCATE_LOCAL(_size) ALLOCATE_LOCAL_FALLBACK undefined! # define DEALLOCATE_LOCAL(_ptr) DEALLOCATE_LOCAL_FALLBACK undefined! # endif /* defined(ALLOCATE_LOCAL_FALLBACK && DEALLOCATE_LOCAL_FALLBACK) */ #else # if !defined(DEALLOCATE_LOCAL) # define DEALLOCATE_LOCAL(_ptr) do {} while(0) # endif #endif /* defined(ALLOCATE_LOCAL) */ #endif /* XALLOCA_H */ X11/dri/xf86driproto.h000064400000023735147631660250010446 0ustar00/************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. Copyright 2000 VA Linux Systems, Inc. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Kevin E. Martin * Jens Owen * Rickard E. (Rik) Faith * */ #ifndef _XF86DRISTR_H_ #define _XF86DRISTR_H_ #include "xf86dri.h" #define XF86DRINAME "XFree86-DRI" /* The DRI version number. This was originally set to be the same of the * XFree86 version number. However, this version is really indepedent of * the XFree86 version. * * Version History: * 4.0.0: Original * 4.0.1: Patch to bump clipstamp when windows are destroyed, 28 May 02 * 4.1.0: Add transition from single to multi in DRMInfo rec, 24 Jun 02 */ #define XF86DRI_MAJOR_VERSION 4 #define XF86DRI_MINOR_VERSION 1 #define XF86DRI_PATCH_VERSION 0 typedef struct _XF86DRIQueryVersion { CARD8 reqType; /* always DRIReqCode */ CARD8 driReqType; /* always X_DRIQueryVersion */ CARD16 length B16; } xXF86DRIQueryVersionReq; #define sz_xXF86DRIQueryVersionReq 4 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of DRI protocol */ CARD16 minorVersion B16; /* minor version of DRI protocol */ CARD32 patchVersion B32; /* patch version of DRI protocol */ CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86DRIQueryVersionReply; #define sz_xXF86DRIQueryVersionReply 32 typedef struct _XF86DRIQueryDirectRenderingCapable { CARD8 reqType; /* always DRIReqCode */ CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */ CARD16 length B16; CARD32 screen B32; } xXF86DRIQueryDirectRenderingCapableReq; #define sz_xXF86DRIQueryDirectRenderingCapableReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; BOOL isCapable; BOOL pad2; BOOL pad3; BOOL pad4; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; CARD32 pad8 B32; CARD32 pad9 B32; } xXF86DRIQueryDirectRenderingCapableReply; #define sz_xXF86DRIQueryDirectRenderingCapableReply 32 typedef struct _XF86DRIOpenConnection { CARD8 reqType; /* always DRIReqCode */ CARD8 driReqType; /* always X_DRIOpenConnection */ CARD16 length B16; CARD32 screen B32; } xXF86DRIOpenConnectionReq; #define sz_xXF86DRIOpenConnectionReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 hSAREALow B32; CARD32 hSAREAHigh B32; CARD32 busIdStringLength B32; CARD32 pad6 B32; CARD32 pad7 B32; CARD32 pad8 B32; } xXF86DRIOpenConnectionReply; #define sz_xXF86DRIOpenConnectionReply 32 typedef struct _XF86DRIAuthConnection { CARD8 reqType; /* always DRIReqCode */ CARD8 driReqType; /* always X_DRICloseConnection */ CARD16 length B16; CARD32 screen B32; CARD32 magic B32; } xXF86DRIAuthConnectionReq; #define sz_xXF86DRIAuthConnectionReq 12 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 authenticated B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86DRIAuthConnectionReply; #define zx_xXF86DRIAuthConnectionReply 32 typedef struct _XF86DRICloseConnection { CARD8 reqType; /* always DRIReqCode */ CARD8 driReqType; /* always X_DRICloseConnection */ CARD16 length B16; CARD32 screen B32; } xXF86DRICloseConnectionReq; #define sz_xXF86DRICloseConnectionReq 8 typedef struct _XF86DRIGetClientDriverName { CARD8 reqType; /* always DRIReqCode */ CARD8 driReqType; /* always X_DRIGetClientDriverName */ CARD16 length B16; CARD32 screen B32; } xXF86DRIGetClientDriverNameReq; #define sz_xXF86DRIGetClientDriverNameReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 ddxDriverMajorVersion B32; CARD32 ddxDriverMinorVersion B32; CARD32 ddxDriverPatchVersion B32; CARD32 clientDriverNameLength B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86DRIGetClientDriverNameReply; #define sz_xXF86DRIGetClientDriverNameReply 32 typedef struct _XF86DRICreateContext { CARD8 reqType; /* always DRIReqCode */ CARD8 driReqType; /* always X_DRICreateContext */ CARD16 length B16; CARD32 screen B32; CARD32 visual B32; CARD32 context B32; } xXF86DRICreateContextReq; #define sz_xXF86DRICreateContextReq 16 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 hHWContext B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86DRICreateContextReply; #define sz_xXF86DRICreateContextReply 32 typedef struct _XF86DRIDestroyContext { CARD8 reqType; /* always DRIReqCode */ CARD8 driReqType; /* always X_DRIDestroyContext */ CARD16 length B16; CARD32 screen B32; CARD32 context B32; } xXF86DRIDestroyContextReq; #define sz_xXF86DRIDestroyContextReq 12 typedef struct _XF86DRICreateDrawable { CARD8 reqType; /* always DRIReqCode */ CARD8 driReqType; /* always X_DRICreateDrawable */ CARD16 length B16; CARD32 screen B32; CARD32 drawable B32; } xXF86DRICreateDrawableReq; #define sz_xXF86DRICreateDrawableReq 12 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 hHWDrawable B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86DRICreateDrawableReply; #define sz_xXF86DRICreateDrawableReply 32 typedef struct _XF86DRIDestroyDrawable { CARD8 reqType; /* always DRIReqCode */ CARD8 driReqType; /* always X_DRIDestroyDrawable */ CARD16 length B16; CARD32 screen B32; CARD32 drawable B32; } xXF86DRIDestroyDrawableReq; #define sz_xXF86DRIDestroyDrawableReq 12 typedef struct _XF86DRIGetDrawableInfo { CARD8 reqType; /* always DRIReqCode */ CARD8 driReqType; /* always X_DRIGetDrawableInfo */ CARD16 length B16; CARD32 screen B32; CARD32 drawable B32; } xXF86DRIGetDrawableInfoReq; #define sz_xXF86DRIGetDrawableInfoReq 12 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 drawableTableIndex B32; CARD32 drawableTableStamp B32; INT16 drawableX B16; INT16 drawableY B16; INT16 drawableWidth B16; INT16 drawableHeight B16; CARD32 numClipRects B32; INT16 backX B16; INT16 backY B16; CARD32 numBackClipRects B32; } xXF86DRIGetDrawableInfoReply; #define sz_xXF86DRIGetDrawableInfoReply 36 typedef struct _XF86DRIGetDeviceInfo { CARD8 reqType; /* always DRIReqCode */ CARD8 driReqType; /* always X_DRIGetDeviceInfo */ CARD16 length B16; CARD32 screen B32; } xXF86DRIGetDeviceInfoReq; #define sz_xXF86DRIGetDeviceInfoReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 hFrameBufferLow B32; CARD32 hFrameBufferHigh B32; CARD32 framebufferOrigin B32; CARD32 framebufferSize B32; CARD32 framebufferStride B32; CARD32 devPrivateSize B32; } xXF86DRIGetDeviceInfoReply; #define sz_xXF86DRIGetDeviceInfoReply 32 typedef struct _XF86DRIOpenFullScreen { CARD8 reqType; /* always DRIReqCode */ CARD8 driReqType; /* always X_DRIOpenFullScreen */ CARD16 length B16; CARD32 screen B32; CARD32 drawable B32; } xXF86DRIOpenFullScreenReq; #define sz_xXF86DRIOpenFullScreenReq 12 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 isFullScreen B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86DRIOpenFullScreenReply; #define sz_xXF86DRIOpenFullScreenReply 32 typedef struct _XF86DRICloseFullScreen { CARD8 reqType; /* always DRIReqCode */ CARD8 driReqType; /* always X_DRICloseFullScreen */ CARD16 length B16; CARD32 screen B32; CARD32 drawable B32; } xXF86DRICloseFullScreenReq; #define sz_xXF86DRICloseFullScreenReq 12 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xXF86DRICloseFullScreenReply; #define sz_xXF86DRICloseFullScreenReply 32 #endif /* _XF86DRISTR_H_ */ X11/dri/xf86dristr.h000064400000000256147631660250010104 0ustar00#warning "xf86dristr.h is obsolete and may be removed in the future." #warning "include for the protocol defines." #include X11/dri/xf86dri.h000064400000004615147631660250007356 0ustar00/************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. Copyright 2000 VA Linux Systems, Inc. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /** * \file xf86dri.h * Protocol numbers and function prototypes for DRI X protocol. * * \author Kevin E. Martin * \author Jens Owen * \author Rickard E. (Rik) Faith */ #ifndef _XF86DRI_H_ #define _XF86DRI_H_ #include #define X_XF86DRIQueryVersion 0 #define X_XF86DRIQueryDirectRenderingCapable 1 #define X_XF86DRIOpenConnection 2 #define X_XF86DRICloseConnection 3 #define X_XF86DRIGetClientDriverName 4 #define X_XF86DRICreateContext 5 #define X_XF86DRIDestroyContext 6 #define X_XF86DRICreateDrawable 7 #define X_XF86DRIDestroyDrawable 8 #define X_XF86DRIGetDrawableInfo 9 #define X_XF86DRIGetDeviceInfo 10 #define X_XF86DRIAuthConnection 11 #define X_XF86DRIOpenFullScreen 12 /* Deprecated */ #define X_XF86DRICloseFullScreen 13 /* Deprecated */ #define XF86DRINumberEvents 0 #define XF86DRIClientNotLocal 0 #define XF86DRIOperationNotSupported 1 #define XF86DRINumberErrors (XF86DRIOperationNotSupported + 1) #endif /* _XF86DRI_H_ */ X11/cursorfont.h000064400000006056147631660250007513 0ustar00/* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _X11_CURSORFONT_H_ #define _X11_CURSORFONT_H_ #define XC_num_glyphs 154 #define XC_X_cursor 0 #define XC_arrow 2 #define XC_based_arrow_down 4 #define XC_based_arrow_up 6 #define XC_boat 8 #define XC_bogosity 10 #define XC_bottom_left_corner 12 #define XC_bottom_right_corner 14 #define XC_bottom_side 16 #define XC_bottom_tee 18 #define XC_box_spiral 20 #define XC_center_ptr 22 #define XC_circle 24 #define XC_clock 26 #define XC_coffee_mug 28 #define XC_cross 30 #define XC_cross_reverse 32 #define XC_crosshair 34 #define XC_diamond_cross 36 #define XC_dot 38 #define XC_dotbox 40 #define XC_double_arrow 42 #define XC_draft_large 44 #define XC_draft_small 46 #define XC_draped_box 48 #define XC_exchange 50 #define XC_fleur 52 #define XC_gobbler 54 #define XC_gumby 56 #define XC_hand1 58 #define XC_hand2 60 #define XC_heart 62 #define XC_icon 64 #define XC_iron_cross 66 #define XC_left_ptr 68 #define XC_left_side 70 #define XC_left_tee 72 #define XC_leftbutton 74 #define XC_ll_angle 76 #define XC_lr_angle 78 #define XC_man 80 #define XC_middlebutton 82 #define XC_mouse 84 #define XC_pencil 86 #define XC_pirate 88 #define XC_plus 90 #define XC_question_arrow 92 #define XC_right_ptr 94 #define XC_right_side 96 #define XC_right_tee 98 #define XC_rightbutton 100 #define XC_rtl_logo 102 #define XC_sailboat 104 #define XC_sb_down_arrow 106 #define XC_sb_h_double_arrow 108 #define XC_sb_left_arrow 110 #define XC_sb_right_arrow 112 #define XC_sb_up_arrow 114 #define XC_sb_v_double_arrow 116 #define XC_shuttle 118 #define XC_sizing 120 #define XC_spider 122 #define XC_spraycan 124 #define XC_star 126 #define XC_target 128 #define XC_tcross 130 #define XC_top_left_arrow 132 #define XC_top_left_corner 134 #define XC_top_right_corner 136 #define XC_top_side 138 #define XC_top_tee 140 #define XC_trek 142 #define XC_ul_angle 144 #define XC_umbrella 146 #define XC_ur_angle 148 #define XC_watch 150 #define XC_xterm 152 #endif /* _X11_CURSORFONT_H_ */ X11/ImUtil.h000064400000000713147631660250006504 0ustar00 #ifndef _X11_IMUTIL_H_ #define _X11_IMUTIL_H_ extern int _XGetScanlinePad( Display *dpy, int depth); extern int _XGetBitsPerPixel( Display *dpy, int depth); extern int _XSetImage( XImage *srcimg, register XImage *dstimg, register int x, register int y); extern int _XReverse_Bytes( register unsigned char *bpt, register int nb); extern void _XInitImageFuncPtrs( register XImage *image); #endif /* _X11_IMUTIL_H_ */ X11/extensions/dbe.h000064400000004157147631660250010240 0ustar00/****************************************************************************** * * Copyright (c) 1994, 1995 Hewlett-Packard Company * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the Hewlett-Packard * Company shall not be used in advertising or otherwise to promote the * sale, use or other dealings in this Software without prior written * authorization from the Hewlett-Packard Company. * * Header file for Xlib-related DBE * *****************************************************************************/ #ifndef DBE_H #define DBE_H /* Values for swap_action field of XdbeSwapInfo structure */ #define XdbeUndefined 0 #define XdbeBackground 1 #define XdbeUntouched 2 #define XdbeCopied 3 /* Errors */ #define XdbeBadBuffer 0 #define DBE_PROTOCOL_NAME "DOUBLE-BUFFER" /* Current version numbers */ #define DBE_MAJOR_VERSION 1 #define DBE_MINOR_VERSION 0 /* Used when adding extension; also used in Xdbe macros */ #define DbeNumberEvents 0 #define DbeBadBuffer 0 #define DbeNumberErrors (DbeBadBuffer + 1) #endif /* DBE_H */ X11/extensions/cupproto.h000064400000006171147631660250011357 0ustar00/* Copyright 1987, 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _XCUPPROTO_H_ /* { */ #define _XCUPPROTO_H_ #include #define X_XcupQueryVersion 0 #define X_XcupGetReservedColormapEntries 1 #define X_XcupStoreColors 2 typedef struct _XcupQueryVersion { CARD8 reqType; /* always XcupReqCode */ CARD8 xcupReqType; /* always X_XcupQueryVersion */ CARD16 length B16; CARD16 client_major_version B16; CARD16 client_minor_version B16; } xXcupQueryVersionReq; #define sz_xXcupQueryVersionReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequence_number B16; CARD32 length B32; CARD16 server_major_version B16; CARD16 server_minor_version B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXcupQueryVersionReply; #define sz_xXcupQueryVersionReply 32 typedef struct _XcupGetReservedColormapEntries { CARD8 reqType; /* always XcupReqCode */ CARD8 xcupReqType; /* always X_XcupGetReservedColormapEntries */ CARD16 length B16; CARD32 screen B32; } xXcupGetReservedColormapEntriesReq; #define sz_xXcupGetReservedColormapEntriesReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequence_number B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xXcupGetReservedColormapEntriesReply; #define sz_xXcupGetReservedColormapEntriesReply 32 typedef struct _XcupStoreColors { CARD8 reqType; /* always XcupReqCode */ CARD8 xcupReqType; /* always X_XcupStoreColors */ CARD16 length B16; CARD32 cmap B32; } xXcupStoreColorsReq; #define sz_xXcupStoreColorsReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequence_number B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xXcupStoreColorsReply; #define sz_xXcupStoreColorsReply 32 #endif /* } _XCUPPROTO_H_ */ X11/extensions/saver.h000064400000003554147631660250010626 0ustar00/* Copyright (c) 1992 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ #ifndef _SAVER_H_ #define _SAVER_H_ #define ScreenSaverName "MIT-SCREEN-SAVER" #define ScreenSaverPropertyName "_MIT_SCREEN_SAVER_ID" #define ScreenSaverNotifyMask 0x00000001 #define ScreenSaverCycleMask 0x00000002 #define ScreenSaverMajorVersion 1 #define ScreenSaverMinorVersion 1 #define ScreenSaverOff 0 #define ScreenSaverOn 1 #define ScreenSaverCycle 2 #define ScreenSaverDisabled 3 #define ScreenSaverBlanked 0 #define ScreenSaverInternal 1 #define ScreenSaverExternal 2 #define ScreenSaverNotify 0 #define ScreenSaverNumberEvents 1 #endif /* _SAVER_H_ */ X11/extensions/xf86dgastr.h000064400000000274147631660250011502 0ustar00#warning "xf86dgastr.h is obsolete and may be removed in the future." #warning "include for the protocol defines." #include X11/extensions/mitmiscproto.h000064400000004335147631660250012235 0ustar00/************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ********************************************************/ /* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */ #ifndef _MITMISCPROTO_H_ #define _MITMISCPROTO_H_ #include #define X_MITSetBugMode 0 #define X_MITGetBugMode 1 typedef struct _SetBugMode { CARD8 reqType; /* always MITReqCode */ CARD8 mitReqType; /* always X_MITSetBugMode */ CARD16 length B16; BOOL onOff; BYTE pad0; CARD16 pad1; } xMITSetBugModeReq; #define sz_xMITSetBugModeReq 8 typedef struct _GetBugMode { CARD8 reqType; /* always MITReqCode */ CARD8 mitReqType; /* always X_MITGetBugMode */ CARD16 length B16; } xMITGetBugModeReq; #define sz_xMITGetBugModeReq 4 typedef struct { BYTE type; /* X_Reply */ BOOL onOff; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xMITGetBugModeReply; #define sz_xMITGetBugModeReply 32 #endif /* _MITMISCPROTO_H_ */ X11/extensions/renderproto.h000064400000033245147631660250012051 0ustar00/* * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #ifndef _XRENDERP_H_ #define _XRENDERP_H_ #include #include #define Window CARD32 #define Drawable CARD32 #define Font CARD32 #define Pixmap CARD32 #define Cursor CARD32 #define Colormap CARD32 #define GContext CARD32 #define Atom CARD32 #define VisualID CARD32 #define Time CARD32 #define KeyCode CARD8 #define KeySym CARD32 #define Picture CARD32 #define PictFormat CARD32 #define Fixed INT32 #define Glyphset CARD32 /* * data structures */ typedef struct { CARD16 red B16; CARD16 redMask B16; CARD16 green B16; CARD16 greenMask B16; CARD16 blue B16; CARD16 blueMask B16; CARD16 alpha B16; CARD16 alphaMask B16; } xDirectFormat; #define sz_xDirectFormat 16 typedef struct { PictFormat id B32; CARD8 type; CARD8 depth; CARD16 pad1 B16; xDirectFormat direct; Colormap colormap; } xPictFormInfo; #define sz_xPictFormInfo 28 typedef struct { VisualID visual; PictFormat format; } xPictVisual; #define sz_xPictVisual 8 typedef struct { CARD8 depth; CARD8 pad1; CARD16 nPictVisuals B16; CARD32 pad2 B32; } xPictDepth; #define sz_xPictDepth 8 typedef struct { CARD32 nDepth B32; PictFormat fallback B32; } xPictScreen; #define sz_xPictScreen 8 typedef struct { CARD32 pixel B32; CARD16 red B16; CARD16 green B16; CARD16 blue B16; CARD16 alpha B16; } xIndexValue; #define sz_xIndexValue 12 typedef struct { CARD16 red B16; CARD16 green B16; CARD16 blue B16; CARD16 alpha B16; } xRenderColor; #define sz_xRenderColor 8 typedef struct { Fixed x B32; Fixed y B32; } xPointFixed; #define sz_xPointFixed 8 typedef struct { xPointFixed p1; xPointFixed p2; } xLineFixed; #define sz_xLineFixed 16 typedef struct { xPointFixed p1, p2, p3; } xTriangle; #define sz_xTriangle 24 typedef struct { Fixed top B32; Fixed bottom B32; xLineFixed left; xLineFixed right; } xTrapezoid; #define sz_xTrapezoid 40 typedef struct { CARD16 width B16; CARD16 height B16; INT16 x B16; INT16 y B16; INT16 xOff B16; INT16 yOff B16; } xGlyphInfo; #define sz_xGlyphInfo 12 typedef struct { CARD8 len; CARD8 pad1; CARD16 pad2; INT16 deltax; INT16 deltay; } xGlyphElt; #define sz_xGlyphElt 8 typedef struct { Fixed l, r, y; } xSpanFix; #define sz_xSpanFix 12 typedef struct { xSpanFix top, bot; } xTrap; #define sz_xTrap 24 /* * requests and replies */ typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; CARD32 majorVersion B32; CARD32 minorVersion B32; } xRenderQueryVersionReq; #define sz_xRenderQueryVersionReq 12 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 majorVersion B32; CARD32 minorVersion B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRenderQueryVersionReply; #define sz_xRenderQueryVersionReply 32 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; } xRenderQueryPictFormatsReq; #define sz_xRenderQueryPictFormatsReq 4 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 numFormats B32; CARD32 numScreens B32; CARD32 numDepths B32; CARD32 numVisuals B32; CARD32 numSubpixel B32; /* Version 0.6 */ CARD32 pad5 B32; } xRenderQueryPictFormatsReply; #define sz_xRenderQueryPictFormatsReply 32 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; PictFormat format B32; } xRenderQueryPictIndexValuesReq; #define sz_xRenderQueryPictIndexValuesReq 8 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 numIndexValues; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xRenderQueryPictIndexValuesReply; #define sz_xRenderQueryPictIndexValuesReply 32 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture pid B32; Drawable drawable B32; PictFormat format B32; CARD32 mask B32; } xRenderCreatePictureReq; #define sz_xRenderCreatePictureReq 20 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture picture B32; CARD32 mask B32; } xRenderChangePictureReq; #define sz_xRenderChangePictureReq 12 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture picture B32; INT16 xOrigin B16; INT16 yOrigin B16; } xRenderSetPictureClipRectanglesReq; #define sz_xRenderSetPictureClipRectanglesReq 12 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture picture B32; } xRenderFreePictureReq; #define sz_xRenderFreePictureReq 8 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; CARD8 op; CARD8 pad1; CARD16 pad2 B16; Picture src B32; Picture mask B32; Picture dst B32; INT16 xSrc B16; INT16 ySrc B16; INT16 xMask B16; INT16 yMask B16; INT16 xDst B16; INT16 yDst B16; CARD16 width B16; CARD16 height B16; } xRenderCompositeReq; #define sz_xRenderCompositeReq 36 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture src B32; Picture dst B32; CARD32 colorScale B32; CARD32 alphaScale B32; INT16 xSrc B16; INT16 ySrc B16; INT16 xDst B16; INT16 yDst B16; CARD16 width B16; CARD16 height B16; } xRenderScaleReq; #define sz_xRenderScaleReq 32 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; CARD8 op; CARD8 pad1; CARD16 pad2 B16; Picture src B32; Picture dst B32; PictFormat maskFormat B32; INT16 xSrc B16; INT16 ySrc B16; } xRenderTrapezoidsReq; #define sz_xRenderTrapezoidsReq 24 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; CARD8 op; CARD8 pad1; CARD16 pad2 B16; Picture src B32; Picture dst B32; PictFormat maskFormat B32; INT16 xSrc B16; INT16 ySrc B16; } xRenderTrianglesReq; #define sz_xRenderTrianglesReq 24 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; CARD8 op; CARD8 pad1; CARD16 pad2 B16; Picture src B32; Picture dst B32; PictFormat maskFormat B32; INT16 xSrc B16; INT16 ySrc B16; } xRenderTriStripReq; #define sz_xRenderTriStripReq 24 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; CARD8 op; CARD8 pad1; CARD16 pad2 B16; Picture src B32; Picture dst B32; PictFormat maskFormat B32; INT16 xSrc B16; INT16 ySrc B16; } xRenderTriFanReq; #define sz_xRenderTriFanReq 24 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Glyphset gsid B32; PictFormat format B32; } xRenderCreateGlyphSetReq; #define sz_xRenderCreateGlyphSetReq 12 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Glyphset gsid B32; Glyphset existing B32; } xRenderReferenceGlyphSetReq; #define sz_xRenderReferenceGlyphSetReq 24 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Glyphset glyphset B32; } xRenderFreeGlyphSetReq; #define sz_xRenderFreeGlyphSetReq 8 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Glyphset glyphset B32; CARD32 nglyphs; } xRenderAddGlyphsReq; #define sz_xRenderAddGlyphsReq 12 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Glyphset glyphset B32; } xRenderFreeGlyphsReq; #define sz_xRenderFreeGlyphsReq 8 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; CARD8 op; CARD8 pad1; CARD16 pad2 B16; Picture src B32; Picture dst B32; PictFormat maskFormat B32; Glyphset glyphset B32; INT16 xSrc B16; INT16 ySrc B16; } xRenderCompositeGlyphsReq, xRenderCompositeGlyphs8Req, xRenderCompositeGlyphs16Req, xRenderCompositeGlyphs32Req; #define sz_xRenderCompositeGlyphs8Req 28 #define sz_xRenderCompositeGlyphs16Req 28 #define sz_xRenderCompositeGlyphs32Req 28 /* 0.1 and higher */ typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; CARD8 op; CARD8 pad1; CARD16 pad2 B16; Picture dst B32; xRenderColor color; } xRenderFillRectanglesReq; #define sz_xRenderFillRectanglesReq 20 /* 0.5 and higher */ typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Cursor cid B32; Picture src B32; CARD16 x B16; CARD16 y B16; } xRenderCreateCursorReq; #define sz_xRenderCreateCursorReq 16 /* 0.6 and higher */ /* * This can't use an array because 32-bit values may be in bitfields */ typedef struct { Fixed matrix11 B32; Fixed matrix12 B32; Fixed matrix13 B32; Fixed matrix21 B32; Fixed matrix22 B32; Fixed matrix23 B32; Fixed matrix31 B32; Fixed matrix32 B32; Fixed matrix33 B32; } xRenderTransform; #define sz_xRenderTransform 36 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture picture B32; xRenderTransform transform; } xRenderSetPictureTransformReq; #define sz_xRenderSetPictureTransformReq 44 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Drawable drawable B32; } xRenderQueryFiltersReq; #define sz_xRenderQueryFiltersReq 8 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 numAliases B32; /* LISTofCARD16 */ CARD32 numFilters B32; /* LISTofSTRING8 */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRenderQueryFiltersReply; #define sz_xRenderQueryFiltersReply 32 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture picture B32; CARD16 nbytes B16; /* number of bytes in name */ CARD16 pad B16; } xRenderSetPictureFilterReq; #define sz_xRenderSetPictureFilterReq 12 /* 0.8 and higher */ typedef struct { Cursor cursor B32; CARD32 delay B32; } xAnimCursorElt; #define sz_xAnimCursorElt 8 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Cursor cid B32; } xRenderCreateAnimCursorReq; #define sz_xRenderCreateAnimCursorReq 8 /* 0.9 and higher */ typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture picture; INT16 xOff B16; INT16 yOff B16; } xRenderAddTrapsReq; #define sz_xRenderAddTrapsReq 12 /* 0.10 and higher */ typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture pid B32; xRenderColor color; } xRenderCreateSolidFillReq; #define sz_xRenderCreateSolidFillReq 16 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture pid B32; xPointFixed p1; xPointFixed p2; CARD32 nStops; } xRenderCreateLinearGradientReq; #define sz_xRenderCreateLinearGradientReq 28 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture pid B32; xPointFixed inner; xPointFixed outer; Fixed inner_radius; Fixed outer_radius; CARD32 nStops; } xRenderCreateRadialGradientReq; #define sz_xRenderCreateRadialGradientReq 36 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture pid B32; xPointFixed center; Fixed angle; /* in degrees */ CARD32 nStops; } xRenderCreateConicalGradientReq; #define sz_xRenderCreateConicalGradientReq 24 #undef Window #undef Drawable #undef Font #undef Pixmap #undef Cursor #undef Colormap #undef GContext #undef Atom #undef VisualID #undef Time #undef KeyCode #undef KeySym #undef Picture #undef PictFormat #undef Fixed #undef Glyphset #endif /* _XRENDERP_H_ */ X11/extensions/XKBgeom.h000064400000036710147631660250011002 0ustar00/************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XKBGEOM_H_ #define _XKBGEOM_H_ #include #ifdef XKB_IN_SERVER #define XkbAddGeomKeyAlias SrvXkbAddGeomKeyAlias #define XkbAddGeomColor SrvXkbAddGeomColor #define XkbAddGeomDoodad SrvXkbAddGeomDoodad #define XkbAddGeomKey SrvXkbAddGeomKey #define XkbAddGeomOutline SrvXkbAddGeomOutline #define XkbAddGeomOverlay SrvXkbAddGeomOverlay #define XkbAddGeomOverlayRow SrvXkbAddGeomOverlayRow #define XkbAddGeomOverlayKey SrvXkbAddGeomOverlayKey #define XkbAddGeomProperty SrvXkbAddGeomProperty #define XkbAddGeomRow SrvXkbAddGeomRow #define XkbAddGeomSection SrvXkbAddGeomSection #define XkbAddGeomShape SrvXkbAddGeomShape #define XkbAllocGeomKeyAliases SrvXkbAllocGeomKeyAliases #define XkbAllocGeomColors SrvXkbAllocGeomColors #define XkbAllocGeomDoodads SrvXkbAllocGeomDoodads #define XkbAllocGeomKeys SrvXkbAllocGeomKeys #define XkbAllocGeomOutlines SrvXkbAllocGeomOutlines #define XkbAllocGeomPoints SrvXkbAllocGeomPoints #define XkbAllocGeomProps SrvXkbAllocGeomProps #define XkbAllocGeomRows SrvXkbAllocGeomRows #define XkbAllocGeomSectionDoodads SrvXkbAllocGeomSectionDoodads #define XkbAllocGeomSections SrvXkbAllocGeomSections #define XkbAllocGeomOverlays SrvXkbAllocGeomOverlays #define XkbAllocGeomOverlayRows SrvXkbAllocGeomOverlayRows #define XkbAllocGeomOverlayKeys SrvXkbAllocGeomOverlayKeys #define XkbAllocGeomShapes SrvXkbAllocGeomShapes #define XkbAllocGeometry SrvXkbAllocGeometry #define XkbFreeGeomKeyAliases SrvXkbFreeGeomKeyAliases #define XkbFreeGeomColors SrvXkbFreeGeomColors #define XkbFreeGeomDoodads SrvXkbFreeGeomDoodads #define XkbFreeGeomProperties SrvXkbFreeGeomProperties #define XkbFreeGeomOverlayKeys SrvXkbFreeGeomOverlayKeys #define XkbFreeGeomOverlayRows SrvXkbFreeGeomOverlayRows #define XkbFreeGeomOverlays SrvXkbFreeGeomOverlays #define XkbFreeGeomKeys SrvXkbFreeGeomKeys #define XkbFreeGeomRows SrvXkbFreeGeomRows #define XkbFreeGeomSections SrvXkbFreeGeomSections #define XkbFreeGeomPoints SrvXkbFreeGeomPoints #define XkbFreeGeomOutlines SrvXkbFreeGeomOutlines #define XkbFreeGeomShapes SrvXkbFreeGeomShapes #define XkbFreeGeometry SrvXkbFreeGeometry #endif typedef struct _XkbProperty { char *name; char *value; } XkbPropertyRec,*XkbPropertyPtr; typedef struct _XkbColor { unsigned int pixel; char * spec; } XkbColorRec,*XkbColorPtr; typedef struct _XkbPoint { short x; short y; } XkbPointRec, *XkbPointPtr; typedef struct _XkbBounds { short x1,y1; short x2,y2; } XkbBoundsRec, *XkbBoundsPtr; #define XkbBoundsWidth(b) (((b)->x2)-((b)->x1)) #define XkbBoundsHeight(b) (((b)->y2)-((b)->y1)) /* * In the following structs, this pattern is used for dynamically sized arrays: * foo is an array for which sz_foo entries are allocated & num_foo are used */ typedef struct _XkbOutline { unsigned short num_points; unsigned short sz_points; unsigned short corner_radius; XkbPointPtr points; } XkbOutlineRec, *XkbOutlinePtr; typedef struct _XkbShape { Atom name; unsigned short num_outlines; unsigned short sz_outlines; XkbOutlinePtr outlines; XkbOutlinePtr approx; XkbOutlinePtr primary; XkbBoundsRec bounds; } XkbShapeRec, *XkbShapePtr; #define XkbOutlineIndex(s,o) ((int)((o)-&(s)->outlines[0])) typedef struct _XkbShapeDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; unsigned short color_ndx; unsigned short shape_ndx; } XkbShapeDoodadRec, *XkbShapeDoodadPtr; #define XkbShapeDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) #define XkbShapeDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) #define XkbSetShapeDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) #define XkbSetShapeDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0]) typedef struct _XkbTextDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; short width; short height; unsigned short color_ndx; char * text; char * font; } XkbTextDoodadRec, *XkbTextDoodadPtr; #define XkbTextDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) #define XkbSetTextDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) typedef struct _XkbIndicatorDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; unsigned short shape_ndx; unsigned short on_color_ndx; unsigned short off_color_ndx; } XkbIndicatorDoodadRec, *XkbIndicatorDoodadPtr; #define XkbIndicatorDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) #define XkbIndicatorDoodadOnColor(g,d) (&(g)->colors[(d)->on_color_ndx]) #define XkbIndicatorDoodadOffColor(g,d) (&(g)->colors[(d)->off_color_ndx]) #define XkbSetIndicatorDoodadOnColor(g,d,c) \ ((d)->on_color_ndx= (c)-&(g)->colors[0]) #define XkbSetIndicatorDoodadOffColor(g,d,c) \ ((d)->off_color_ndx= (c)-&(g)->colors[0]) #define XkbSetIndicatorDoodadShape(g,d,s) \ ((d)->shape_ndx= (s)-&(g)->shapes[0]) typedef struct _XkbLogoDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; unsigned short color_ndx; unsigned short shape_ndx; char * logo_name; } XkbLogoDoodadRec, *XkbLogoDoodadPtr; #define XkbLogoDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) #define XkbLogoDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) #define XkbSetLogoDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) #define XkbSetLogoDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0]) typedef struct _XkbAnyDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; } XkbAnyDoodadRec, *XkbAnyDoodadPtr; typedef union _XkbDoodad { XkbAnyDoodadRec any; XkbShapeDoodadRec shape; XkbTextDoodadRec text; XkbIndicatorDoodadRec indicator; XkbLogoDoodadRec logo; } XkbDoodadRec, *XkbDoodadPtr; #define XkbUnknownDoodad 0 #define XkbOutlineDoodad 1 #define XkbSolidDoodad 2 #define XkbTextDoodad 3 #define XkbIndicatorDoodad 4 #define XkbLogoDoodad 5 typedef struct _XkbKey { XkbKeyNameRec name; short gap; unsigned char shape_ndx; unsigned char color_ndx; } XkbKeyRec, *XkbKeyPtr; #define XkbKeyShape(g,k) (&(g)->shapes[(k)->shape_ndx]) #define XkbKeyColor(g,k) (&(g)->colors[(k)->color_ndx]) #define XkbSetKeyShape(g,k,s) ((k)->shape_ndx= (s)-&(g)->shapes[0]) #define XkbSetKeyColor(g,k,c) ((k)->color_ndx= (c)-&(g)->colors[0]) typedef struct _XkbRow { short top; short left; unsigned short num_keys; unsigned short sz_keys; int vertical; XkbKeyPtr keys; XkbBoundsRec bounds; } XkbRowRec, *XkbRowPtr; typedef struct _XkbSection { Atom name; unsigned char priority; short top; short left; unsigned short width; unsigned short height; short angle; unsigned short num_rows; unsigned short num_doodads; unsigned short num_overlays; unsigned short sz_rows; unsigned short sz_doodads; unsigned short sz_overlays; XkbRowPtr rows; XkbDoodadPtr doodads; XkbBoundsRec bounds; struct _XkbOverlay *overlays; } XkbSectionRec, *XkbSectionPtr; typedef struct _XkbOverlayKey { XkbKeyNameRec over; XkbKeyNameRec under; } XkbOverlayKeyRec,*XkbOverlayKeyPtr; typedef struct _XkbOverlayRow { unsigned short row_under; unsigned short num_keys; unsigned short sz_keys; XkbOverlayKeyPtr keys; } XkbOverlayRowRec,*XkbOverlayRowPtr; typedef struct _XkbOverlay { Atom name; XkbSectionPtr section_under; unsigned short num_rows; unsigned short sz_rows; XkbOverlayRowPtr rows; XkbBoundsPtr bounds; } XkbOverlayRec,*XkbOverlayPtr; typedef struct _XkbGeometry { Atom name; unsigned short width_mm; unsigned short height_mm; char * label_font; XkbColorPtr label_color; XkbColorPtr base_color; unsigned short sz_properties; unsigned short sz_colors; unsigned short sz_shapes; unsigned short sz_sections; unsigned short sz_doodads; unsigned short sz_key_aliases; unsigned short num_properties; unsigned short num_colors; unsigned short num_shapes; unsigned short num_sections; unsigned short num_doodads; unsigned short num_key_aliases; XkbPropertyPtr properties; XkbColorPtr colors; XkbShapePtr shapes; XkbSectionPtr sections; XkbDoodadPtr doodads; XkbKeyAliasPtr key_aliases; } XkbGeometryRec; #define XkbGeomColorIndex(g,c) ((int)((c)-&(g)->colors[0])) #define XkbGeomPropertiesMask (1<<0) #define XkbGeomColorsMask (1<<1) #define XkbGeomShapesMask (1<<2) #define XkbGeomSectionsMask (1<<3) #define XkbGeomDoodadsMask (1<<4) #define XkbGeomKeyAliasesMask (1<<5) #define XkbGeomAllMask (0x3f) typedef struct _XkbGeometrySizes { unsigned int which; unsigned short num_properties; unsigned short num_colors; unsigned short num_shapes; unsigned short num_sections; unsigned short num_doodads; unsigned short num_key_aliases; } XkbGeometrySizesRec,*XkbGeometrySizesPtr; _XFUNCPROTOBEGIN extern XkbPropertyPtr XkbAddGeomProperty( XkbGeometryPtr /* geom */, char * /* name */, char * /* value */ ); extern XkbKeyAliasPtr XkbAddGeomKeyAlias( XkbGeometryPtr /* geom */, char * /* alias */, char * /* real */ ); extern XkbColorPtr XkbAddGeomColor( XkbGeometryPtr /* geom */, char * /* spec */, unsigned int /* pixel */ ); extern XkbOutlinePtr XkbAddGeomOutline( XkbShapePtr /* shape */, int /* sz_points */ ); extern XkbShapePtr XkbAddGeomShape( XkbGeometryPtr /* geom */, Atom /* name */, int /* sz_outlines */ ); extern XkbKeyPtr XkbAddGeomKey( XkbRowPtr /* row */ ); extern XkbRowPtr XkbAddGeomRow( XkbSectionPtr /* section */, int /* sz_keys */ ); extern XkbSectionPtr XkbAddGeomSection( XkbGeometryPtr /* geom */, Atom /* name */, int /* sz_rows */, int /* sz_doodads */, int /* sz_overlays */ ); extern XkbOverlayPtr XkbAddGeomOverlay( XkbSectionPtr /* section */, Atom /* name */, int /* sz_rows */ ); extern XkbOverlayRowPtr XkbAddGeomOverlayRow( XkbOverlayPtr /* overlay */, int /* row_under */, int /* sz_keys */ ); extern XkbOverlayKeyPtr XkbAddGeomOverlayKey( XkbOverlayPtr /* overlay */, XkbOverlayRowPtr /* row */, char * /* over */, char * /* under */ ); extern XkbDoodadPtr XkbAddGeomDoodad( XkbGeometryPtr /* geom */, XkbSectionPtr /* section */, Atom /* name */ ); extern void XkbFreeGeomKeyAliases( XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomColors( XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomDoodads( XkbDoodadPtr /* doodads */, int /* nDoodads */, Bool /* freeAll */ ); extern void XkbFreeGeomProperties( XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomOverlayKeys( XkbOverlayRowPtr /* row */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomOverlayRows( XkbOverlayPtr /* overlay */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomOverlays( XkbSectionPtr /* section */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomKeys( XkbRowPtr /* row */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomRows( XkbSectionPtr /* section */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomSections( XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomPoints( XkbOutlinePtr /* outline */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomOutlines( XkbShapePtr /* shape */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomShapes( XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeometry( XkbGeometryPtr /* geom */, unsigned int /* which */, Bool /* freeMap */ ); extern Status XkbAllocGeomProps( XkbGeometryPtr /* geom */, int /* nProps */ ); extern Status XkbAllocGeomKeyAliases( XkbGeometryPtr /* geom */, int /* nAliases */ ); extern Status XkbAllocGeomColors( XkbGeometryPtr /* geom */, int /* nColors */ ); extern Status XkbAllocGeomShapes( XkbGeometryPtr /* geom */, int /* nShapes */ ); extern Status XkbAllocGeomSections( XkbGeometryPtr /* geom */, int /* nSections */ ); extern Status XkbAllocGeomOverlays( XkbSectionPtr /* section */, int /* num_needed */ ); extern Status XkbAllocGeomOverlayRows( XkbOverlayPtr /* overlay */, int /* num_needed */ ); extern Status XkbAllocGeomOverlayKeys( XkbOverlayRowPtr /* row */, int /* num_needed */ ); extern Status XkbAllocGeomDoodads( XkbGeometryPtr /* geom */, int /* nDoodads */ ); extern Status XkbAllocGeomSectionDoodads( XkbSectionPtr /* section */, int /* nDoodads */ ); extern Status XkbAllocGeomOutlines( XkbShapePtr /* shape */, int /* nOL */ ); extern Status XkbAllocGeomRows( XkbSectionPtr /* section */, int /* nRows */ ); extern Status XkbAllocGeomPoints( XkbOutlinePtr /* ol */, int /* nPts */ ); extern Status XkbAllocGeomKeys( XkbRowPtr /* row */, int /* nKeys */ ); extern Status XkbAllocGeometry( XkbDescPtr /* xkb */, XkbGeometrySizesPtr /* sizes */ ); extern Status XkbSetGeometry( Display * /* dpy */, unsigned /* deviceSpec */, XkbGeometryPtr /* geom */ ); extern Bool XkbComputeShapeTop( XkbShapePtr /* shape */, XkbBoundsPtr /* bounds */ ); extern Bool XkbComputeShapeBounds( XkbShapePtr /* shape */ ); extern Bool XkbComputeRowBounds( XkbGeometryPtr /* geom */, XkbSectionPtr /* section */, XkbRowPtr /* row */ ); extern Bool XkbComputeSectionBounds( XkbGeometryPtr /* geom */, XkbSectionPtr /* section */ ); extern char * XkbFindOverlayForKey( XkbGeometryPtr /* geom */, XkbSectionPtr /* wanted */, char * /* under */ ); extern Status XkbGetGeometry( Display * /* dpy */, XkbDescPtr /* xkb */ ); extern Status XkbGetNamedGeometry( Display * /* dpy */, XkbDescPtr /* xkb */, Atom /* name */ ); _XFUNCPROTOEND #endif /* _XKBSTR_H_ */ X11/extensions/xf86vmproto.h000064400000041011147631660250011716 0ustar00/* Copyright 1995 Kaleb S. KEITHLEY Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Kaleb S. KEITHLEY shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Kaleb S. KEITHLEY */ /* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */ #ifndef _XF86VIDMODEPROTO_H_ #define _XF86VIDMODEPROTO_H_ #include #define XF86VIDMODENAME "XFree86-VidModeExtension" #define XF86VIDMODE_MAJOR_VERSION 2 /* current version numbers */ #define XF86VIDMODE_MINOR_VERSION 2 #define X_XF86VidModeQueryVersion 0 #define X_XF86VidModeGetModeLine 1 #define X_XF86VidModeModModeLine 2 #define X_XF86VidModeSwitchMode 3 #define X_XF86VidModeGetMonitor 4 #define X_XF86VidModeLockModeSwitch 5 #define X_XF86VidModeGetAllModeLines 6 #define X_XF86VidModeAddModeLine 7 #define X_XF86VidModeDeleteModeLine 8 #define X_XF86VidModeValidateModeLine 9 #define X_XF86VidModeSwitchToMode 10 #define X_XF86VidModeGetViewPort 11 #define X_XF86VidModeSetViewPort 12 /* new for version 2.x of this extension */ #define X_XF86VidModeGetDotClocks 13 #define X_XF86VidModeSetClientVersion 14 #define X_XF86VidModeSetGamma 15 #define X_XF86VidModeGetGamma 16 #define X_XF86VidModeGetGammaRamp 17 #define X_XF86VidModeSetGammaRamp 18 #define X_XF86VidModeGetGammaRampSize 19 #define X_XF86VidModeGetPermissions 20 /* * major version 0 == uses parameter-to-wire functions in XFree86 libXxf86vm. * major version 1 == uses parameter-to-wire functions hard-coded in xvidtune * client. * major version 2 == uses new protocol version in XFree86 4.0. */ typedef struct _XF86VidModeQueryVersion { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; /* always X_XF86VidModeQueryVersion */ CARD16 length B16; } xXF86VidModeQueryVersionReq; #define sz_xXF86VidModeQueryVersionReq 4 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of XF86VidMode */ CARD16 minorVersion B16; /* minor version of XF86VidMode */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86VidModeQueryVersionReply; #define sz_xXF86VidModeQueryVersionReply 32 typedef struct _XF86VidModeGetModeLine { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; CARD16 length B16; CARD16 screen B16; CARD16 pad B16; } xXF86VidModeGetModeLineReq, xXF86VidModeGetAllModeLinesReq, xXF86VidModeGetMonitorReq, xXF86VidModeGetViewPortReq, xXF86VidModeGetDotClocksReq, xXF86VidModeGetPermissionsReq; #define sz_xXF86VidModeGetModeLineReq 8 #define sz_xXF86VidModeGetAllModeLinesReq 8 #define sz_xXF86VidModeGetMonitorReq 8 #define sz_xXF86VidModeGetViewPortReq 8 #define sz_xXF86VidModeGetDotClocksReq 8 #define sz_xXF86VidModeGetPermissionsReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 dotclock B32; CARD16 hdisplay B16; CARD16 hsyncstart B16; CARD16 hsyncend B16; CARD16 htotal B16; CARD16 hskew B16; CARD16 vdisplay B16; CARD16 vsyncstart B16; CARD16 vsyncend B16; CARD16 vtotal B16; CARD16 pad2 B16; CARD32 flags B32; CARD32 reserved1 B32; CARD32 reserved2 B32; CARD32 reserved3 B32; CARD32 privsize B32; } xXF86VidModeGetModeLineReply; #define sz_xXF86VidModeGetModeLineReply 52 /* 0.x version */ typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 dotclock B32; CARD16 hdisplay B16; CARD16 hsyncstart B16; CARD16 hsyncend B16; CARD16 htotal B16; CARD16 vdisplay B16; CARD16 vsyncstart B16; CARD16 vsyncend B16; CARD16 vtotal B16; CARD32 flags B32; CARD32 privsize B32; } xXF86OldVidModeGetModeLineReply; #define sz_xXF86OldVidModeGetModeLineReply 36 typedef struct { CARD32 dotclock B32; CARD16 hdisplay B16; CARD16 hsyncstart B16; CARD16 hsyncend B16; CARD16 htotal B16; CARD32 hskew B16; CARD16 vdisplay B16; CARD16 vsyncstart B16; CARD16 vsyncend B16; CARD16 vtotal B16; CARD16 pad1 B16; CARD32 flags B32; CARD32 reserved1 B32; CARD32 reserved2 B32; CARD32 reserved3 B32; CARD32 privsize B32; } xXF86VidModeModeInfo; /* 0.x version */ typedef struct { CARD32 dotclock B32; CARD16 hdisplay B16; CARD16 hsyncstart B16; CARD16 hsyncend B16; CARD16 htotal B16; CARD16 vdisplay B16; CARD16 vsyncstart B16; CARD16 vsyncend B16; CARD16 vtotal B16; CARD32 flags B32; CARD32 privsize B32; } xXF86OldVidModeModeInfo; typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 modecount B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86VidModeGetAllModeLinesReply; #define sz_xXF86VidModeGetAllModeLinesReply 32 typedef struct _XF86VidModeAddModeLine { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; /* always X_XF86VidModeAddMode */ CARD16 length B16; CARD32 screen B32; /* could be CARD16 but need the pad */ CARD32 dotclock B32; CARD16 hdisplay B16; CARD16 hsyncstart B16; CARD16 hsyncend B16; CARD16 htotal B16; CARD16 hskew B16; CARD16 vdisplay B16; CARD16 vsyncstart B16; CARD16 vsyncend B16; CARD16 vtotal B16; CARD16 pad1 B16; CARD32 flags B32; CARD32 reserved1 B32; CARD32 reserved2 B32; CARD32 reserved3 B32; CARD32 privsize B32; CARD32 after_dotclock B32; CARD16 after_hdisplay B16; CARD16 after_hsyncstart B16; CARD16 after_hsyncend B16; CARD16 after_htotal B16; CARD16 after_hskew B16; CARD16 after_vdisplay B16; CARD16 after_vsyncstart B16; CARD16 after_vsyncend B16; CARD16 after_vtotal B16; CARD16 pad2 B16; CARD32 after_flags B32; CARD32 reserved4 B32; CARD32 reserved5 B32; CARD32 reserved6 B32; } xXF86VidModeAddModeLineReq; #define sz_xXF86VidModeAddModeLineReq 92 /* 0.x version */ typedef struct _XF86OldVidModeAddModeLine { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; /* always X_XF86VidModeAddMode */ CARD16 length B16; CARD32 screen B32; /* could be CARD16 but need the pad */ CARD32 dotclock B32; CARD16 hdisplay B16; CARD16 hsyncstart B16; CARD16 hsyncend B16; CARD16 htotal B16; CARD16 vdisplay B16; CARD16 vsyncstart B16; CARD16 vsyncend B16; CARD16 vtotal B16; CARD32 flags B32; CARD32 privsize B32; CARD32 after_dotclock B32; CARD16 after_hdisplay B16; CARD16 after_hsyncstart B16; CARD16 after_hsyncend B16; CARD16 after_htotal B16; CARD16 after_vdisplay B16; CARD16 after_vsyncstart B16; CARD16 after_vsyncend B16; CARD16 after_vtotal B16; CARD32 after_flags B32; } xXF86OldVidModeAddModeLineReq; #define sz_xXF86OldVidModeAddModeLineReq 60 typedef struct _XF86VidModeModModeLine { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; /* always X_XF86VidModeModModeLine */ CARD16 length B16; CARD32 screen B32; /* could be CARD16 but need the pad */ CARD16 hdisplay B16; CARD16 hsyncstart B16; CARD16 hsyncend B16; CARD16 htotal B16; CARD16 hskew B16; CARD16 vdisplay B16; CARD16 vsyncstart B16; CARD16 vsyncend B16; CARD16 vtotal B16; CARD16 pad1 B16; CARD32 flags B32; CARD32 reserved1 B32; CARD32 reserved2 B32; CARD32 reserved3 B32; CARD32 privsize B32; } xXF86VidModeModModeLineReq; #define sz_xXF86VidModeModModeLineReq 48 /* 0.x version */ typedef struct _XF86OldVidModeModModeLine { CARD8 reqType; /* always XF86OldVidModeReqCode */ CARD8 xf86vidmodeReqType; /* always X_XF86OldVidModeModModeLine */ CARD16 length B16; CARD32 screen B32; /* could be CARD16 but need the pad */ CARD16 hdisplay B16; CARD16 hsyncstart B16; CARD16 hsyncend B16; CARD16 htotal B16; CARD16 vdisplay B16; CARD16 vsyncstart B16; CARD16 vsyncend B16; CARD16 vtotal B16; CARD32 flags B32; CARD32 privsize B32; } xXF86OldVidModeModModeLineReq; #define sz_xXF86OldVidModeModModeLineReq 32 typedef struct _XF86VidModeValidateModeLine { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; CARD16 length B16; CARD32 screen B32; /* could be CARD16 but need the pad */ CARD32 dotclock B32; CARD16 hdisplay B16; CARD16 hsyncstart B16; CARD16 hsyncend B16; CARD16 htotal B16; CARD16 hskew B16; CARD16 vdisplay B16; CARD16 vsyncstart B16; CARD16 vsyncend B16; CARD16 vtotal B16; CARD16 pad1 B16; CARD32 flags B32; CARD32 reserved1 B32; CARD32 reserved2 B32; CARD32 reserved3 B32; CARD32 privsize B32; } xXF86VidModeDeleteModeLineReq, xXF86VidModeValidateModeLineReq, xXF86VidModeSwitchToModeReq; #define sz_xXF86VidModeDeleteModeLineReq 52 #define sz_xXF86VidModeValidateModeLineReq 52 #define sz_xXF86VidModeSwitchToModeReq 52 /* 0.x version */ typedef struct _XF86OldVidModeValidateModeLine { CARD8 reqType; /* always XF86OldVidModeReqCode */ CARD8 xf86vidmodeReqType; CARD16 length B16; CARD32 screen B32; /* could be CARD16 but need the pad */ CARD32 dotclock B32; CARD16 hdisplay B16; CARD16 hsyncstart B16; CARD16 hsyncend B16; CARD16 htotal B16; CARD16 vdisplay B16; CARD16 vsyncstart B16; CARD16 vsyncend B16; CARD16 vtotal B16; CARD32 flags B32; CARD32 privsize B32; } xXF86OldVidModeDeleteModeLineReq, xXF86OldVidModeValidateModeLineReq, xXF86OldVidModeSwitchToModeReq; #define sz_xXF86OldVidModeDeleteModeLineReq 36 #define sz_xXF86OldVidModeValidateModeLineReq 36 #define sz_xXF86OldVidModeSwitchToModeReq 36 typedef struct _XF86VidModeSwitchMode { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; /* always X_XF86VidModeSwitchMode */ CARD16 length B16; CARD16 screen B16; CARD16 zoom B16; } xXF86VidModeSwitchModeReq; #define sz_xXF86VidModeSwitchModeReq 8 typedef struct _XF86VidModeLockModeSwitch { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; /* always X_XF86VidModeLockModeSwitch */ CARD16 length B16; CARD16 screen B16; CARD16 lock B16; } xXF86VidModeLockModeSwitchReq; #define sz_xXF86VidModeLockModeSwitchReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 status B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86VidModeValidateModeLineReply; #define sz_xXF86VidModeValidateModeLineReply 32 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD8 vendorLength; CARD8 modelLength; CARD8 nhsync; CARD8 nvsync; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86VidModeGetMonitorReply; #define sz_xXF86VidModeGetMonitorReply 32 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 x B32; CARD32 y B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXF86VidModeGetViewPortReply; #define sz_xXF86VidModeGetViewPortReply 32 typedef struct _XF86VidModeSetViewPort { CARD8 reqType; /* always VidModeReqCode */ CARD8 xf86vidmodeReqType; /* always X_XF86VidModeSetViewPort */ CARD16 length B16; CARD16 screen B16; CARD16 pad B16; CARD32 x B32; CARD32 y B32; } xXF86VidModeSetViewPortReq; #define sz_xXF86VidModeSetViewPortReq 16 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 flags B32; CARD32 clocks B32; CARD32 maxclocks B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xXF86VidModeGetDotClocksReply; #define sz_xXF86VidModeGetDotClocksReply 32 typedef struct _XF86VidModeSetClientVersion { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; CARD16 length B16; CARD16 major B16; CARD16 minor B16; } xXF86VidModeSetClientVersionReq; #define sz_xXF86VidModeSetClientVersionReq 8 typedef struct _XF86VidModeGetGamma { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; CARD16 length B16; CARD16 screen B16; CARD16 pad B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86VidModeGetGammaReq; #define sz_xXF86VidModeGetGammaReq 32 typedef struct { BYTE type; BOOL pad; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 red B32; CARD32 green B32; CARD32 blue B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xXF86VidModeGetGammaReply; #define sz_xXF86VidModeGetGammaReply 32 typedef struct _XF86VidModeSetGamma { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; CARD16 length B16; CARD16 screen B16; CARD16 pad B16; CARD32 red B32; CARD32 green B32; CARD32 blue B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xXF86VidModeSetGammaReq; #define sz_xXF86VidModeSetGammaReq 32 typedef struct _XF86VidModeSetGammaRamp { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; CARD16 length B16; CARD16 screen B16; CARD16 size B16; } xXF86VidModeSetGammaRampReq; #define sz_xXF86VidModeSetGammaRampReq 8 typedef struct _XF86VidModeGetGammaRamp { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; CARD16 length B16; CARD16 screen B16; CARD16 size B16; } xXF86VidModeGetGammaRampReq; #define sz_xXF86VidModeGetGammaRampReq 8 typedef struct { BYTE type; BOOL pad; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 size B16; CARD16 pad0 B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXF86VidModeGetGammaRampReply; #define sz_xXF86VidModeGetGammaRampReply 32 typedef struct _XF86VidModeGetGammaRampSize { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; CARD16 length B16; CARD16 screen B16; CARD16 pad B16; } xXF86VidModeGetGammaRampSizeReq; #define sz_xXF86VidModeGetGammaRampSizeReq 8 typedef struct { BYTE type; BOOL pad; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 size B16; CARD16 pad0 B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXF86VidModeGetGammaRampSizeReply; #define sz_xXF86VidModeGetGammaRampSizeReply 32 typedef struct { BYTE type; BOOL pad; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 permissions B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXF86VidModeGetPermissionsReply; #define sz_xXF86VidModeGetPermissionsReply 32 #endif /* _XF86VIDMODEPROTO_H_ */ X11/extensions/mitmiscconst.h000064400000002745147631660250012223 0ustar00/************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ********************************************************/ /* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */ #ifndef _MITMISCCONST_H_ #define _MITMISCCONST_H_ #define MITMiscNumberEvents 0 #define MITMiscNumberErrors 0 #define MITMISCNAME "MIT-SUNDRY-NONSTANDARD" #endif X11/extensions/bigreqsproto.h000064400000003650147631660250012223 0ustar00/* Copyright 1992, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _BIGREQSPROTO_H_ #define _BIGREQSPROTO_H_ #define X_BigReqEnable 0 #define XBigReqNumberEvents 0 #define XBigReqNumberErrors 0 #define XBigReqExtensionName "BIG-REQUESTS" typedef struct { CARD8 reqType; /* always XBigReqCode */ CARD8 brReqType; /* always X_BigReqEnable */ CARD16 length B16; } xBigReqEnableReq; #define sz_xBigReqEnableReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 max_request_size B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xBigReqEnableReply; #define sz_xBigReqEnableReply 32 typedef struct { CARD8 reqType; CARD8 data; CARD16 zero B16; CARD32 length B32; } xBigReq; #endif /* _BIGREQSPROTO_H_ */ X11/extensions/xtestproto.h000064400000006472147631660250011743 0ustar00/* Copyright 1992, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _XTESTPROTO_H_ #define _XTESTPROTO_H_ #include #define Window CARD32 #define Time CARD32 #define Cursor CARD32 #define X_XTestGetVersion 0 #define X_XTestCompareCursor 1 #define X_XTestFakeInput 2 #define X_XTestGrabControl 3 typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 xtReqType; /* always X_XTestGetVersion */ CARD16 length B16; CARD8 majorVersion; CARD8 pad; CARD16 minorVersion B16; } xXTestGetVersionReq; #define sz_xXTestGetVersionReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 majorVersion; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 minorVersion B16; CARD16 pad0 B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXTestGetVersionReply; #define sz_xXTestGetVersionReply 32 typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 xtReqType; /* always X_XTestCompareCursor */ CARD16 length B16; Window window B32; Cursor cursor B32; } xXTestCompareCursorReq; #define sz_xXTestCompareCursorReq 12 typedef struct { BYTE type; /* X_Reply */ BOOL same; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXTestCompareCursorReply; #define sz_xXTestCompareCursorReply 32 /* used only on the client side */ typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 xtReqType; /* always X_XTestFakeInput */ CARD16 length B16; BYTE type; BYTE detail; CARD16 pad0 B16; Time time B32; Window root B32; CARD32 pad1 B32; CARD32 pad2 B32; INT16 rootX B16, rootY B16; CARD32 pad3 B32; CARD16 pad4 B16; CARD8 pad5; CARD8 deviceid; } xXTestFakeInputReq; #define sz_xXTestFakeInputReq 36 typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 xtReqType; /* always X_XTestGrabControl */ CARD16 length B16; BOOL impervious; CARD8 pad0; CARD8 pad1; CARD8 pad2; } xXTestGrabControlReq; #define sz_xXTestGrabControlReq 8 #undef Window #undef Time #undef Cursor #endif /* _XTESTPROTO_H_ */ X11/extensions/XResproto.h000064400000012567147631660250011457 0ustar00/* Copyright (c) 2002 XFree86 Inc */ #ifndef _XRESPROTO_H #define _XRESPROTO_H #define XRES_MAJOR_VERSION 1 #define XRES_MINOR_VERSION 2 #define XRES_NAME "X-Resource" /* v1.0 */ #define X_XResQueryVersion 0 #define X_XResQueryClients 1 #define X_XResQueryClientResources 2 #define X_XResQueryClientPixmapBytes 3 /* Version 1.1 has been accidentally released from the version */ /* control and while it doesn't have differences to version 1.0, the */ /* next version is labeled 1.2 in order to remove the risk of confusion. */ /* v1.2 */ #define X_XResQueryClientIds 4 #define X_XResQueryResourceBytes 5 typedef struct { CARD32 resource_base; CARD32 resource_mask; } xXResClient; #define sz_xXResClient 8 typedef struct { CARD32 resource_type; CARD32 count; } xXResType; #define sz_xXResType 8 /* XResQueryVersion */ typedef struct _XResQueryVersion { CARD8 reqType; CARD8 XResReqType; CARD16 length B16; CARD8 client_major; CARD8 client_minor; CARD16 unused B16; } xXResQueryVersionReq; #define sz_xXResQueryVersionReq 8 typedef struct { CARD8 type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 server_major B16; CARD16 server_minor B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXResQueryVersionReply; #define sz_xXResQueryVersionReply 32 /* XResQueryClients */ typedef struct _XResQueryClients { CARD8 reqType; CARD8 XResReqType; CARD16 length B16; } xXResQueryClientsReq; #define sz_xXResQueryClientsReq 4 typedef struct { CARD8 type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 num_clients B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXResQueryClientsReply; #define sz_xXResQueryClientsReply 32 /* XResQueryClientResources */ typedef struct _XResQueryClientResources { CARD8 reqType; CARD8 XResReqType; CARD16 length B16; CARD32 xid B32; } xXResQueryClientResourcesReq; #define sz_xXResQueryClientResourcesReq 8 typedef struct { CARD8 type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 num_types B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXResQueryClientResourcesReply; #define sz_xXResQueryClientResourcesReply 32 /* XResQueryClientPixmapBytes */ typedef struct _XResQueryClientPixmapBytes { CARD8 reqType; CARD8 XResReqType; CARD16 length B16; CARD32 xid B32; } xXResQueryClientPixmapBytesReq; #define sz_xXResQueryClientPixmapBytesReq 8 typedef struct { CARD8 type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 bytes B32; CARD32 bytes_overflow B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXResQueryClientPixmapBytesReply; #define sz_xXResQueryClientPixmapBytesReply 32 /* v1.2 XResQueryClientIds */ #define X_XResClientXIDMask 0x01 #define X_XResLocalClientPIDMask 0x02 typedef struct _XResClientIdSpec { CARD32 client B32; CARD32 mask B32; } xXResClientIdSpec; #define sz_xXResClientIdSpec 8 typedef struct _XResClientIdValue { xXResClientIdSpec spec; CARD32 length B32; // followed by length CARD32s } xXResClientIdValue; #define sz_xResClientIdValue (sz_xXResClientIdSpec + 4) typedef struct _XResQueryClientIds { CARD8 reqType; CARD8 XResReqType; CARD16 length B16; CARD32 numSpecs B32; // followed by numSpecs times XResClientIdSpec } xXResQueryClientIdsReq; #define sz_xXResQueryClientIdsReq 8 typedef struct { CARD8 type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 numIds B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; // followed by numIds times XResClientIdValue } xXResQueryClientIdsReply; #define sz_xXResQueryClientIdsReply 32 /* v1.2 XResQueryResourceBytes */ typedef struct _XResResourceIdSpec { CARD32 resource; CARD32 type; } xXResResourceIdSpec; #define sz_xXResResourceIdSpec 8 typedef struct _XResQueryResourceBytes { CARD8 reqType; CARD8 XResReqType; CARD16 length B16; CARD32 client B32; CARD32 numSpecs B32; // followed by numSpecs times XResResourceIdSpec } xXResQueryResourceBytesReq; #define sz_xXResQueryResourceBytesReq 12 typedef struct _XResResourceSizeSpec { xXResResourceIdSpec spec; CARD32 bytes B32; CARD32 refCount B32; CARD32 useCount B32; } xXResResourceSizeSpec; #define sz_xXResResourceSizeSpec (sz_xXResResourceIdSpec + 12) typedef struct _XResResourceSizeValue { xXResResourceSizeSpec size; CARD32 numCrossReferences B32; // followed by numCrossReferences times XResResourceSizeSpec } xXResResourceSizeValue; #define sz_xXResResourceSizeValue (sz_xXResResourceSizeSpec + 4) typedef struct { CARD8 type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 numSizes B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; // followed by numSizes times XResResourceSizeValue } xXResQueryResourceBytesReply; #define sz_xXResQueryResourceBytesReply 32 #endif /* _XRESPROTO_H */ X11/extensions/xf86bigfproto.h000064400000005132147631660250012207 0ustar00/* * Declarations of request structures for the BIGFONT extension. * * Copyright (c) 1999-2000 Bruno Haible * Copyright (c) 1999-2000 The XFree86 Project, Inc. */ /* THIS IS NOT AN X CONSORTIUM STANDARD */ #ifndef _XF86BIGFPROTO_H_ #define _XF86BIGFPROTO_H_ #include #define XF86BIGFONTNAME "XFree86-Bigfont" #define XF86BIGFONT_MAJOR_VERSION 1 /* current version numbers */ #define XF86BIGFONT_MINOR_VERSION 1 typedef struct _XF86BigfontQueryVersion { CARD8 reqType; /* always XF86BigfontReqCode */ CARD8 xf86bigfontReqType; /* always X_XF86BigfontQueryVersion */ CARD16 length B16; } xXF86BigfontQueryVersionReq; #define sz_xXF86BigfontQueryVersionReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 capabilities; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of XFree86-Bigfont */ CARD16 minorVersion B16; /* minor version of XFree86-Bigfont */ CARD32 uid B32; CARD32 gid B32; CARD32 signature B32; CARD32 pad1 B32; CARD32 pad2 B32; } xXF86BigfontQueryVersionReply; #define sz_xXF86BigfontQueryVersionReply 32 /* Bit masks that can be set in the capabilities */ #define XF86Bigfont_CAP_LocalShm 1 typedef struct _XF86BigfontQueryFont { CARD8 reqType; /* always XF86BigfontReqCode */ CARD8 xf86bigfontReqType; /* always X_XF86BigfontQueryFont */ CARD16 length B16; CARD32 id B32; CARD32 flags B32; } xXF86BigfontQueryFontReq; #define sz_xXF86BigfontQueryFontReq 12 typedef struct { BYTE type; /* X_Reply */ CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; xCharInfo minBounds; #ifndef WORD64 CARD32 walign1 B32; #endif xCharInfo maxBounds; #ifndef WORD64 CARD32 walign2 B32; #endif CARD16 minCharOrByte2 B16; CARD16 maxCharOrByte2 B16; CARD16 defaultChar B16; CARD16 nFontProps B16; CARD8 drawDirection; CARD8 minByte1; CARD8 maxByte1; BOOL allCharsExist; INT16 fontAscent B16; INT16 fontDescent B16; CARD32 nCharInfos B32; CARD32 nUniqCharInfos B32; CARD32 shmid B32; CARD32 shmsegoffset B32; /* followed by nFontProps xFontProp structures */ /* and if nCharInfos > 0 && shmid == -1, followed by nUniqCharInfos xCharInfo structures and then by nCharInfos CARD16 indices (each >= 0, < nUniqCharInfos) and then, if nCharInfos is odd, one more CARD16 for padding. */ } xXF86BigfontQueryFontReply; #define sz_xXF86BigfontQueryFontReply 72 /* Bit masks that can be set in the flags */ #define XF86Bigfont_FLAGS_Shm 1 #endif /* _XF86BIGFPROTO_H_ */ X11/extensions/syncproto.h000064400000026410147631660250011542 0ustar00/* Copyright 1991, 1993, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /*********************************************************** Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts, and Olivetti Research Limited, Cambridge, England. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Olivetti not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef _SYNCPROTO_H_ #define _SYNCPROTO_H_ #include #define X_SyncInitialize 0 #define X_SyncListSystemCounters 1 #define X_SyncCreateCounter 2 #define X_SyncSetCounter 3 #define X_SyncChangeCounter 4 #define X_SyncQueryCounter 5 #define X_SyncDestroyCounter 6 #define X_SyncAwait 7 #define X_SyncCreateAlarm 8 #define X_SyncChangeAlarm 9 #define X_SyncQueryAlarm 10 #define X_SyncDestroyAlarm 11 #define X_SyncSetPriority 12 #define X_SyncGetPriority 13 #define X_SyncCreateFence 14 #define X_SyncTriggerFence 15 #define X_SyncResetFence 16 #define X_SyncDestroyFence 17 #define X_SyncQueryFence 18 #define X_SyncAwaitFence 19 /* cover up types from sync.h to make sure they're the right size for * protocol packaging. These will be undef'ed after all the protocol * structures are defined. */ #define XSyncCounter CARD32 #define XSyncAlarm CARD32 #define XSyncFence CARD32 #define Drawable CARD32 /* * Initialize */ typedef struct _xSyncInitialize { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; CARD8 majorVersion; CARD8 minorVersion; CARD16 pad B16; } xSyncInitializeReq; #define sz_xSyncInitializeReq 8 typedef struct { BYTE type; CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD8 majorVersion; CARD8 minorVersion; CARD16 pad B16; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xSyncInitializeReply; #define sz_xSyncInitializeReply 32 /* * ListSystemCounters */ typedef struct _xSyncListSystemCounters { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; } xSyncListSystemCountersReq; #define sz_xSyncListSystemCountersReq 4 typedef struct { BYTE type; CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; INT32 nCounters B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xSyncListSystemCountersReply; #define sz_xSyncListSystemCountersReply 32 typedef struct { XSyncCounter counter B32; INT32 resolution_hi B32; CARD32 resolution_lo B32; CARD16 name_length B16; } xSyncSystemCounter; #define sz_xSyncSystemCounter 14 /* * Create Counter */ typedef struct _xSyncCreateCounterReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncCounter cid B32; INT32 initial_value_hi B32; CARD32 initial_value_lo B32; } xSyncCreateCounterReq; #define sz_xSyncCreateCounterReq 16 /* * Change Counter */ typedef struct _xSyncChangeCounterReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncCounter cid B32; INT32 value_hi B32; CARD32 value_lo B32; } xSyncChangeCounterReq; #define sz_xSyncChangeCounterReq 16 /* * Set Counter */ typedef struct _xSyncSetCounterReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncCounter cid B32; INT32 value_hi B32; CARD32 value_lo B32; } xSyncSetCounterReq; #define sz_xSyncSetCounterReq 16 /* * Destroy Counter */ typedef struct _xSyncDestroyCounterReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncCounter counter B32; } xSyncDestroyCounterReq; #define sz_xSyncDestroyCounterReq 8 /* * Query Counter */ typedef struct _xSyncQueryCounterReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncCounter counter B32; } xSyncQueryCounterReq; #define sz_xSyncQueryCounterReq 8 typedef struct { BYTE type; CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; INT32 value_hi B32; CARD32 value_lo B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xSyncQueryCounterReply; #define sz_xSyncQueryCounterReply 32 /* * Await */ typedef struct _xSyncAwaitReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; } xSyncAwaitReq; #define sz_xSyncAwaitReq 4 typedef struct _xSyncWaitCondition { XSyncCounter counter B32; CARD32 value_type B32; INT32 wait_value_hi B32; CARD32 wait_value_lo B32; CARD32 test_type B32; INT32 event_threshold_hi B32; CARD32 event_threshold_lo B32; } xSyncWaitCondition; #define sz_xSyncWaitCondition 28 /* * Create Alarm */ typedef struct _xSyncCreateAlarmReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncAlarm id B32; CARD32 valueMask B32; } xSyncCreateAlarmReq; #define sz_xSyncCreateAlarmReq 12 /* * Destroy Alarm */ typedef struct _xSyncDestroyAlarmReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncAlarm alarm B32; } xSyncDestroyAlarmReq; #define sz_xSyncDestroyAlarmReq 8 /* * Query Alarm */ typedef struct _xSyncQueryAlarmReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncAlarm alarm B32; } xSyncQueryAlarmReq; #define sz_xSyncQueryAlarmReq 8 typedef struct { BYTE type; CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; XSyncCounter counter B32; CARD32 value_type B32; INT32 wait_value_hi B32; CARD32 wait_value_lo B32; CARD32 test_type B32; INT32 delta_hi B32; CARD32 delta_lo B32; BOOL events; BYTE state; BYTE pad0; BYTE pad1; } xSyncQueryAlarmReply; #define sz_xSyncQueryAlarmReply 40 /* * Change Alarm */ typedef struct _xSyncChangeAlarmReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncAlarm alarm B32; CARD32 valueMask B32; } xSyncChangeAlarmReq; #define sz_xSyncChangeAlarmReq 12 /* * SetPriority */ typedef struct _xSyncSetPriority{ CARD8 reqType; CARD8 syncReqType; CARD16 length B16; CARD32 id B32; INT32 priority B32; } xSyncSetPriorityReq; #define sz_xSyncSetPriorityReq 12 /* * Get Priority */ typedef struct _xSyncGetPriority{ CARD8 reqType; CARD8 syncReqType; CARD16 length B16; CARD32 id B32; /*XXX XID? */ } xSyncGetPriorityReq; #define sz_xSyncGetPriorityReq 8 typedef struct { BYTE type; CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; INT32 priority B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xSyncGetPriorityReply; #define sz_xSyncGetPriorityReply 32 /* * Create Fence */ typedef struct _xSyncCreateFenceReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; Drawable d B32; XSyncFence fid B32; BOOL initially_triggered; CARD8 pad0; CARD16 pad1; } xSyncCreateFenceReq; #define sz_xSyncCreateFenceReq 16 /* * Put a fence object in the "triggered" state. */ typedef struct _xSyncTriggerFenceReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncFence fid B32; } xSyncTriggerFenceReq; #define sz_xSyncTriggerFenceReq 8 /* * Put a fence in the "untriggered" state. */ typedef struct _xSyncResetFenceReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncFence fid B32; } xSyncResetFenceReq; #define sz_xSyncResetFenceReq 8 /* * Destroy a fence object */ typedef struct _xSyncDestroyFenceReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncFence fid B32; } xSyncDestroyFenceReq; #define sz_xSyncDestroyFenceReq 8 /* * Query a fence object */ typedef struct _xSyncQueryFenceReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncFence fid B32; } xSyncQueryFenceReq; #define sz_xSyncQueryFenceReq 8 /* * Wait for any of a list of fence sync objects * to reach the "triggered" state. */ typedef struct _xSyncAwaitFenceReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; } xSyncAwaitFenceReq; #define sz_xSyncAwaitFenceReq 4 typedef struct { BYTE type; CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; BOOL triggered; BYTE pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xSyncQueryFenceReply; #define sz_xSyncQueryFenceReply 32 /* * Events */ typedef struct _xSyncCounterNotifyEvent { BYTE type; BYTE kind; CARD16 sequenceNumber B16; XSyncCounter counter B32; INT32 wait_value_hi B32; CARD32 wait_value_lo B32; INT32 counter_value_hi B32; CARD32 counter_value_lo B32; CARD32 time B32; CARD16 count B16; BOOL destroyed; BYTE pad0; } xSyncCounterNotifyEvent; typedef struct _xSyncAlarmNotifyEvent { BYTE type; BYTE kind; CARD16 sequenceNumber B16; XSyncAlarm alarm B32; INT32 counter_value_hi B32; CARD32 counter_value_lo B32; INT32 alarm_value_hi B32; CARD32 alarm_value_lo B32; CARD32 time B32; CARD8 state; BYTE pad0; BYTE pad1; BYTE pad2; } xSyncAlarmNotifyEvent; #undef XSyncCounter #undef XSyncAlarm #undef XSyncFence #undef Drawable #endif /* _SYNCPROTO_H_ */ X11/extensions/Xeviestr.h000075500000000264147631660250011315 0ustar00#warning "Xeviestr.h is obsolete and may be removed in the future." #warning "include for the protocol defines." #include X11/extensions/dri2proto.h000064400000021272147631660250011427 0ustar00/* * Copyright © 2008 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Soft- * ware"), to deal in the Software without restriction, including without * limitation the rights to use, copy, modify, merge, publish, distribute, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, provided that the above copyright * notice(s) and this permission notice appear in all copies of the Soft- * ware and that both the above copyright notice(s) and this permission * notice appear in supporting documentation. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR- * MANCE OF THIS SOFTWARE. * * Except as contained in this notice, the name of a copyright holder shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization of * the copyright holder. * * Authors: * Kristian Høgsberg (krh@redhat.com) */ #ifndef _DRI2_PROTO_H_ #define _DRI2_PROTO_H_ #define DRI2_NAME "DRI2" #define DRI2_MAJOR 1 #define DRI2_MINOR 4 #define DRI2NumberErrors 0 #define DRI2NumberEvents 2 #define DRI2NumberRequests 14 #define X_DRI2QueryVersion 0 #define X_DRI2Connect 1 #define X_DRI2Authenticate 2 #define X_DRI2CreateDrawable 3 #define X_DRI2DestroyDrawable 4 #define X_DRI2GetBuffers 5 #define X_DRI2CopyRegion 6 #define X_DRI2GetBuffersWithFormat 7 #define X_DRI2SwapBuffers 8 #define X_DRI2GetMSC 9 #define X_DRI2WaitMSC 10 #define X_DRI2WaitSBC 11 #define X_DRI2SwapInterval 12 #define X_DRI2GetParam 13 /* * Events */ #define DRI2_BufferSwapComplete 0 #define DRI2_InvalidateBuffers 1 typedef struct { CARD32 attachment B32; CARD32 name B32; CARD32 pitch B32; CARD32 cpp B32; CARD32 flags B32; } xDRI2Buffer; typedef struct { CARD8 reqType; CARD8 dri2ReqType; CARD16 length B16; CARD32 majorVersion B32; CARD32 minorVersion B32; } xDRI2QueryVersionReq; #define sz_xDRI2QueryVersionReq 12 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 majorVersion B32; CARD32 minorVersion B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xDRI2QueryVersionReply; #define sz_xDRI2QueryVersionReply 32 typedef struct { CARD8 reqType; CARD8 dri2ReqType; CARD16 length B16; CARD32 window B32; CARD32 driverType B32; } xDRI2ConnectReq; #define sz_xDRI2ConnectReq 12 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 driverNameLength B32; CARD32 deviceNameLength B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xDRI2ConnectReply; #define sz_xDRI2ConnectReply 32 typedef struct { CARD8 reqType; CARD8 dri2ReqType; CARD16 length B16; CARD32 window B32; CARD32 magic B32; } xDRI2AuthenticateReq; #define sz_xDRI2AuthenticateReq 12 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 authenticated B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xDRI2AuthenticateReply; #define sz_xDRI2AuthenticateReply 32 typedef struct { CARD8 reqType; CARD8 dri2ReqType; CARD16 length B16; CARD32 drawable B32; } xDRI2CreateDrawableReq; #define sz_xDRI2CreateDrawableReq 8 typedef struct { CARD8 reqType; CARD8 dri2ReqType; CARD16 length B16; CARD32 drawable B32; } xDRI2DestroyDrawableReq; #define sz_xDRI2DestroyDrawableReq 8 typedef struct { CARD8 reqType; CARD8 dri2ReqType; CARD16 length B16; CARD32 drawable B32; CARD32 count B32; } xDRI2GetBuffersReq; #define sz_xDRI2GetBuffersReq 12 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 width B32; CARD32 height B32; CARD32 count B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xDRI2GetBuffersReply; #define sz_xDRI2GetBuffersReply 32 typedef struct { CARD8 reqType; CARD8 dri2ReqType; CARD16 length B16; CARD32 drawable B32; CARD32 region B32; CARD32 dest B32; CARD32 src B32; } xDRI2CopyRegionReq; #define sz_xDRI2CopyRegionReq 20 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xDRI2CopyRegionReply; #define sz_xDRI2CopyRegionReply 32 typedef struct { CARD8 reqType; CARD8 dri2ReqType; CARD16 length B16; CARD32 drawable B32; CARD32 target_msc_hi B32; CARD32 target_msc_lo B32; CARD32 divisor_hi B32; CARD32 divisor_lo B32; CARD32 remainder_hi B32; CARD32 remainder_lo B32; } xDRI2SwapBuffersReq; #define sz_xDRI2SwapBuffersReq 32 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 swap_hi B32; CARD32 swap_lo B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xDRI2SwapBuffersReply; #define sz_xDRI2SwapBuffersReply 32 typedef struct { CARD8 reqType; CARD8 dri2ReqType; CARD16 length B16; CARD32 drawable B32; } xDRI2GetMSCReq; #define sz_xDRI2GetMSCReq 8 typedef struct { CARD8 reqType; CARD8 dri2ReqType; CARD16 length B16; CARD32 drawable B32; CARD32 target_msc_hi B32; CARD32 target_msc_lo B32; CARD32 divisor_hi B32; CARD32 divisor_lo B32; CARD32 remainder_hi B32; CARD32 remainder_lo B32; } xDRI2WaitMSCReq; #define sz_xDRI2WaitMSCReq 32 typedef struct { CARD8 reqType; CARD8 dri2ReqType; CARD16 length B16; CARD32 drawable B32; CARD32 target_sbc_hi B32; CARD32 target_sbc_lo B32; } xDRI2WaitSBCReq; #define sz_xDRI2WaitSBCReq 16 typedef struct { CARD8 type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 ust_hi B32; CARD32 ust_lo B32; CARD32 msc_hi B32; CARD32 msc_lo B32; CARD32 sbc_hi B32; CARD32 sbc_lo B32; } xDRI2MSCReply; #define sz_xDRI2MSCReply 32 typedef struct { CARD8 reqType; CARD8 dri2ReqType; CARD16 length B16; CARD32 drawable B32; CARD32 interval B32; } xDRI2SwapIntervalReq; #define sz_xDRI2SwapIntervalReq 12 typedef struct { CARD8 type; CARD8 pad; CARD16 sequenceNumber B16; CARD16 event_type B16; CARD16 pad2; CARD32 drawable B32; CARD32 ust_hi B32; CARD32 ust_lo B32; CARD32 msc_hi B32; CARD32 msc_lo B32; CARD32 sbc_hi B32; CARD32 sbc_lo B32; } xDRI2BufferSwapComplete; #define sz_xDRI2BufferSwapComplete 32 typedef struct { CARD8 type; CARD8 pad; CARD16 sequenceNumber B16; CARD16 event_type B16; CARD16 pad2; CARD32 drawable B32; CARD32 ust_hi B32; CARD32 ust_lo B32; CARD32 msc_hi B32; CARD32 msc_lo B32; CARD32 sbc B32; } xDRI2BufferSwapComplete2; #define sz_xDRI2BufferSwapComplete2 32 typedef struct { CARD8 type; CARD8 pad; CARD16 sequenceNumber B16; CARD32 drawable B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xDRI2InvalidateBuffers; #define sz_xDRI2InvalidateBuffers 32 typedef struct { CARD8 reqType; CARD8 dri2ReqType; CARD16 length B16; CARD32 drawable B32; CARD32 param B32; } xDRI2GetParamReq; #define sz_xDRI2GetParamReq 12 typedef struct { BYTE type; /*X_Reply*/ BOOL is_param_recognized; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 value_hi B32; CARD32 value_lo B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xDRI2GetParamReply; #define sz_xDRI2GetParamReply 32 #endif X11/extensions/multibufproto.h000064400000021445147631660250012420 0ustar00/* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _MULTIBUFPROTO_H_ #define _MULTIBUFPROTO_H_ #include /* * Protocol requests constants and alignment values */ #define Window CARD32 #define Drawable CARD32 #define VisualID CARD32 #define Multibuffer CARD32 #define X_MbufGetBufferVersion 0 #define X_MbufCreateImageBuffers 1 #define X_MbufDestroyImageBuffers 2 #define X_MbufDisplayImageBuffers 3 #define X_MbufSetMBufferAttributes 4 #define X_MbufGetMBufferAttributes 5 #define X_MbufSetBufferAttributes 6 #define X_MbufGetBufferAttributes 7 #define X_MbufGetBufferInfo 8 #define X_MbufCreateStereoWindow 9 #define X_MbufClearImageBufferArea 10 typedef struct xMbufBufferInfo { CARD32 visualID B32; /* associated visual */ CARD16 maxBuffers B16; /* maximum supported buffers */ CARD8 depth; /* depth of visual (redundant) */ CARD8 unused; } xMbufBufferInfo; #define sz_xMbufBufferInfo 8 typedef struct { BYTE type; BYTE unused; CARD16 sequenceNumber B16; CARD32 buffer B32; /* affected buffer */ BYTE state; /* current status */ CARD8 unused1; CARD16 unused2 B16; CARD32 unused3 B32; CARD32 unused4 B32; CARD32 unused5 B32; CARD32 unused6 B32; CARD32 unused7 B32; } xMbufClobberNotifyEvent; typedef struct { BYTE type; BYTE unused; CARD16 sequenceNumber B16; CARD32 buffer B32; /* affected buffer */ CARD32 timeStamp B32; /* update time */ CARD32 unused1 B32; CARD32 unused2 B32; CARD32 unused3 B32; CARD32 unused4 B32; CARD32 unused5 B32; CARD32 unused6 B32; } xMbufUpdateNotifyEvent; typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufGetBufferVersion */ CARD16 length B16; } xMbufGetBufferVersionReq; #define sz_xMbufGetBufferVersionReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 majorVersion; /* major version of Multi-Buffering protocol */ CARD8 minorVersion; /* minor version of Multi-Buffering protocol */ CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xMbufGetBufferVersionReply; #define sz_xMbufGetBufferVersionReply 32 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufCreateImageBuffers */ CARD16 length B16; CARD32 window B32; /* associated window */ CARD8 updateAction; /* action at update */ CARD8 updateHint; /* hint as to frequency of updates */ CARD16 unused; } xMbufCreateImageBuffersReq; /* followed by buffer ids */ #define sz_xMbufCreateImageBuffersReq 12 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 numberBuffer B16; /* number successfully allocated */ CARD16 unused1 B16; CARD32 unused2 B32; CARD32 unused3 B32; CARD32 unused4 B32; CARD32 unused5 B32; CARD32 unused6 B32; } xMbufCreateImageBuffersReply; #define sz_xMbufCreateImageBuffersReply 32 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufDestroyImageBuffers */ CARD16 length B16; CARD32 window B32; /* associated window */ } xMbufDestroyImageBuffersReq; #define sz_xMbufDestroyImageBuffersReq 8 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufDisplayImageBuffers */ CARD16 length B16; CARD16 minDelay B16; /* minimum time between last update and now */ CARD16 maxDelay B16; /* maximum time between last update and now */ } xMbufDisplayImageBuffersReq; /* followed by list of buffers */ #define sz_xMbufDisplayImageBuffersReq 8 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufSetMBufferAttributes */ CARD16 length B16; CARD32 window B32; /* associated window */ CARD32 valueMask B32; /* modified entries */ } xMbufSetMBufferAttributesReq; /* followed by values */ #define sz_xMbufSetMBufferAttributesReq 12 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufGetMBufferAttributes */ CARD16 length B16; CARD32 window B32; /* associated window */ } xMbufGetMBufferAttributesReq; #define sz_xMbufGetMBufferAttributesReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 displayedBuffer B16; /* currently visible buffer */ CARD8 updateAction; CARD8 updateHint; CARD8 windowMode; CARD8 unused0; CARD16 unused1 B16; CARD32 unused2 B32; CARD32 unused3 B32; CARD32 unused4 B32; CARD32 unused5 B32; } xMbufGetMBufferAttributesReply; #define sz_xMbufGetMBufferAttributesReply 32 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufSetBufferAttributes */ CARD16 length B16; CARD32 buffer B32; CARD32 valueMask B32; } xMbufSetBufferAttributesReq; /* followed by values */ #define sz_xMbufSetBufferAttributesReq 12 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufGetBufferAttributes */ CARD16 length B16; CARD32 buffer B32; } xMbufGetBufferAttributesReq; #define sz_xMbufGetBufferAttributesReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 window B32; CARD32 eventMask B32; CARD16 bufferIndex B16; CARD8 side; CARD8 unused0; CARD32 unused1 B32; CARD32 unused2 B32; CARD32 unused3 B32; } xMbufGetBufferAttributesReply; #define sz_xMbufGetBufferAttributesReply 32 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufGetBufferInfo */ CARD16 length B16; Drawable drawable B32; } xMbufGetBufferInfoReq; #define sz_xMbufGetBufferInfoReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 normalInfo B16; CARD16 stereoInfo B16; CARD32 unused1 B32; CARD32 unused2 B32; CARD32 unused3 B32; CARD32 unused4 B32; CARD32 unused5 B32; } xMbufGetBufferInfoReply; /* followed by buffer infos */ #define sz_xMbufGetBufferInfoReply 32 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufCreateStereoWindow */ CARD16 length B16; CARD8 unused0; CARD8 unused1; CARD8 unused2; CARD8 depth; Window wid B32; Window parent B32; Multibuffer left B32; /* associated buffers */ Multibuffer right B32; INT16 x B16; INT16 y B16; CARD16 width B16; CARD16 height B16; CARD16 borderWidth B16; #if defined(__cplusplus) || defined(c_plusplus) CARD16 c_class B16; #else CARD16 class B16; #endif VisualID visual B32; CARD32 mask B32; } xMbufCreateStereoWindowReq; /* followed by value list */ #define sz_xMbufCreateStereoWindowReq 44 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufClearImageBufferArea */ CARD16 length B16; Multibuffer buffer B32; INT16 x B16; INT16 y B16; CARD16 width B16; CARD16 height B16; CARD8 unused0; CARD8 unused1; CARD8 unused2; BOOL exposures; } xMbufClearImageBufferAreaReq; #define sz_xMbufClearImageBufferAreaReq 20 #undef Window #undef Drawable #undef VisualID #undef Multibuffer #endif /* _MULTIBUFPROTO_H_ */ X11/extensions/EVIproto.h000064400000006036147631660250011213 0ustar00/************************************************************ Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _EVIPROTO_H_ #define _EVIPROTO_H_ #include #define X_EVIQueryVersion 0 #define X_EVIGetVisualInfo 1 #define VisualID CARD32 typedef CARD32 VisualID32; #define sz_VisualID32 4 typedef struct _xExtendedVisualInfo { VisualID core_visual_id B32; INT8 screen; INT8 level; CARD8 transparency_type; CARD8 pad0; CARD32 transparency_value B32; CARD8 min_hw_colormaps; CARD8 max_hw_colormaps; CARD16 num_colormap_conflicts B16; } xExtendedVisualInfo; #define sz_xExtendedVisualInfo 16 typedef struct _XEVIQueryVersion { CARD8 reqType; /* always XEVIReqCode */ CARD8 xeviReqType; /* always X_EVIQueryVersion */ CARD16 length B16; } xEVIQueryVersionReq; #define sz_xEVIQueryVersionReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of EVI protocol */ CARD16 minorVersion B16; /* minor version of EVI protocol */ CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xEVIQueryVersionReply; #define sz_xEVIQueryVersionReply 32 typedef struct _XEVIGetVisualInfoReq { CARD8 reqType; /* always XEVIReqCode */ CARD8 xeviReqType; /* always X_EVIGetVisualInfo */ CARD16 length B16; CARD32 n_visual B32; } xEVIGetVisualInfoReq; #define sz_xEVIGetVisualInfoReq 8 typedef struct _XEVIGetVisualInfoReply { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 n_info B32; CARD32 n_conflicts B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xEVIGetVisualInfoReply; #define sz_xEVIGetVisualInfoReply 32 #undef VisualID #endif /* _EVIPROTO_H_ */ X11/extensions/damageproto.h000064400000007224147631660250012006 0ustar00/* * Copyright © 2003 Keith Packard * Copyright © 2007 Eric Anholt * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _DAMAGEPROTO_H_ #define _DAMAGEPROTO_H_ #include #include #include #define Window CARD32 #define Drawable CARD32 #define Font CARD32 #define Pixmap CARD32 #define Cursor CARD32 #define Colormap CARD32 #define GContext CARD32 #define Atom CARD32 #define VisualID CARD32 #define Time CARD32 #define KeyCode CARD8 #define KeySym CARD32 #define Picture CARD32 #define Region CARD32 #define Damage CARD32 /************** Version 0 ******************/ typedef struct { CARD8 reqType; CARD8 damageReqType; CARD16 length B16; } xDamageReq; /* * requests and replies */ typedef struct { CARD8 reqType; CARD8 damageReqType; CARD16 length B16; CARD32 majorVersion B32; CARD32 minorVersion B32; } xDamageQueryVersionReq; #define sz_xDamageQueryVersionReq 12 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 majorVersion B32; CARD32 minorVersion B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xDamageQueryVersionReply; #define sz_xDamageQueryVersionReply 32 typedef struct { CARD8 reqType; CARD8 damageReqType; CARD16 length B16; Damage damage B32; Drawable drawable B32; CARD8 level; CARD8 pad1; CARD16 pad2 B16; } xDamageCreateReq; #define sz_xDamageCreateReq 16 typedef struct { CARD8 reqType; CARD8 damageReqType; CARD16 length B16; Damage damage B32; } xDamageDestroyReq; #define sz_xDamageDestroyReq 8 typedef struct { CARD8 reqType; CARD8 damageReqType; CARD16 length B16; Damage damage B32; Region repair B32; Region parts B32; } xDamageSubtractReq; #define sz_xDamageSubtractReq 16 typedef struct { CARD8 reqType; CARD8 damageReqType; CARD16 length B16; Drawable drawable B32; Region region B32; } xDamageAddReq; #define sz_xDamageAddReq 12 /* Events */ #define DamageNotifyMore 0x80 typedef struct { CARD8 type; CARD8 level; CARD16 sequenceNumber B16; Drawable drawable B32; Damage damage B32; Time timestamp B32; xRectangle area; xRectangle geometry; } xDamageNotifyEvent; #undef Damage #undef Region #undef Picture #undef Window #undef Drawable #undef Font #undef Pixmap #undef Cursor #undef Colormap #undef GContext #undef Atom #undef VisualID #undef Time #undef KeyCode #undef KeySym #endif /* _DAMAGEPROTO_H_ */ X11/extensions/xf86dga.h000064400000000561147631660250010750 0ustar00#ifdef _XF86DGA_SERVER_ #warning "xf86dga.h is obsolete and may be removed in the future." #warning "include instead." #include #else #warning "xf86dga.h is obsolete and may be removed in the future." #warning "include instead." #include #endif X11/extensions/evieproto.h000075500000010216147631660250011516 0ustar00/************************************************************ Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ************************************************************/ #ifndef _XEVIEPROTO_H_ #define _XEVIEPROTO_H_ #define XEVIENAME "XEVIE" #define XEVIE_MAJOR_VERSION 1 #define XEVIE_MINOR_VERSION 0 #define X_XevieQueryVersion 0 #define X_XevieStart 1 #define X_XevieEnd 2 #define X_XevieSend 3 #define X_XevieSelectInput 4 #define XevieNumberErrors 0 typedef struct _XevieQueryVersion { CARD8 reqType; CARD8 xevieReqType; CARD16 length B16; CARD16 client_major_version B16; CARD16 client_minor_version B16; } xXevieQueryVersionReq; #define sz_xXevieQueryVersionReq 8 typedef struct { BYTE type; BOOL pad1; CARD16 sequence_number B16; CARD32 length B32; CARD16 server_major_version B16; CARD16 server_minor_version B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXevieQueryVersionReply; #define sz_xXevieQueryVersionReply 32 typedef struct _XevieStart { CARD8 reqType; CARD8 xevieReqType; CARD16 length B16; CARD32 screen B32; } xXevieStartReq; #define sz_xXevieStartReq 8 typedef struct { BYTE type; BOOL pad1; CARD16 sequence_number B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xXevieStartReply; #define sz_xXevieStartReply 32 typedef struct _XevieEnd { CARD8 reqType; CARD8 xevieReqType; CARD16 length B16; CARD32 cmap B32; } xXevieEndReq; #define sz_xXevieEndReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequence_number B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xXevieEndReply; #define sz_xXevieEndReply 32 typedef struct _XevieSend { CARD8 reqType; CARD8 xevieReqType; CARD16 length B16; xEvent event; CARD32 dataType B32; } xXevieSendReq; #define sz_xXevieSendReq 104 typedef struct { BYTE type; BOOL pad1; CARD16 sequence_number B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xXevieSendReply; #define sz_xXevieSendReply 32 typedef struct _XevieSelectInput { CARD8 reqType; CARD8 xevieReqType; CARD16 length B16; CARD32 event_mask B32; } xXevieSelectInputReq; #define sz_xXevieSelectInputReq 8 typedef struct { BYTE type; BOOL pad1; CARD16 sequence_number B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xXevieSelectInputReply; #define sz_xXevieSelectInputReply 32 #endif /* } _XEVIEPROTO_H_ */ X11/extensions/ge.h000064400000003366147631660250010102 0ustar00/* * Copyright © 2007-2008 Peter Hutterer * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Authors: Peter Hutterer, University of South Australia, NICTA * */ #ifndef _GE_H_ #define _GE_H_ #define GE_NAME "Generic Event Extension" #define GE_MAJOR 1 #define GE_MINOR 0 /********************************************************* * * Requests * */ #define X_GEQueryVersion 0 #define GENumberRequests (X_GEQueryVersion + 1) /********************************************************* * * Events * */ #define GENumberEvents 0 /********************************************************* * * Errors * */ #define GENumberErrors 0 #endif /* _GE_H_ */ X11/extensions/cup.h000064400000002511147631660250010265 0ustar00/* Copyright 1987, 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _CUP_H_ #define _CUP_H_ #define XCUPNAME "TOG-CUP" #define XCUP_MAJOR_VERSION 1 /* current version numbers */ #define XCUP_MINOR_VERSION 0 #define XcupNumberErrors 0 #endif /* _CUP_H_ */ X11/extensions/recordstr.h000064400000000402147631660250011502 0ustar00#warning "recordstr.h is obsolete and may be removed in the future." #warning "include for the library interfaces." #warning "include for the protocol defines." #include X11/extensions/XKBproto.h000064400000074252147631660250011221 0ustar00/************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XKBPROTO_H_ #define _XKBPROTO_H_ #include #include #define Window CARD32 #define Atom CARD32 #define Time CARD32 #define KeyCode CARD8 #define KeySym CARD32 #define XkbPaddedSize(n) ((((unsigned int)(n)+3) >> 2) << 2) typedef struct _xkbUseExtension { CARD8 reqType; CARD8 xkbReqType; /* always X_KBUseExtension */ CARD16 length B16; CARD16 wantedMajor B16; CARD16 wantedMinor B16; } xkbUseExtensionReq; #define sz_xkbUseExtensionReq 8 typedef struct _xkbUseExtensionReply { BYTE type; /* X_Reply */ BOOL supported; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 serverMajor B16; CARD16 serverMinor B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xkbUseExtensionReply; #define sz_xkbUseExtensionReply 32 typedef struct _xkbSelectEvents { CARD8 reqType; CARD8 xkbReqType; /* X_KBSelectEvents */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 affectWhich B16; CARD16 clear B16; CARD16 selectAll B16; CARD16 affectMap B16; CARD16 map B16; } xkbSelectEventsReq; #define sz_xkbSelectEventsReq 16 typedef struct _xkbBell { CARD8 reqType; CARD8 xkbReqType; /* X_KBBell */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 bellClass B16; CARD16 bellID B16; INT8 percent; BOOL forceSound; BOOL eventOnly; CARD8 pad1; INT16 pitch B16; INT16 duration B16; CARD16 pad2 B16; Atom name B32; Window window B32; } xkbBellReq; #define sz_xkbBellReq 28 typedef struct _xkbGetState { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetState */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad B16; } xkbGetStateReq; #define sz_xkbGetStateReq 8 typedef struct _xkbGetStateReply { BYTE type; BYTE deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD8 mods; CARD8 baseMods; CARD8 latchedMods; CARD8 lockedMods; CARD8 group; CARD8 lockedGroup; INT16 baseGroup B16; INT16 latchedGroup B16; CARD8 compatState; CARD8 grabMods; CARD8 compatGrabMods; CARD8 lookupMods; CARD8 compatLookupMods; CARD8 pad1; CARD16 ptrBtnState B16; CARD16 pad2 B16; CARD32 pad3 B32; } xkbGetStateReply; #define sz_xkbGetStateReply 32 typedef struct _xkbLatchLockState { CARD8 reqType; CARD8 xkbReqType; /* always X_KBLatchLockState */ CARD16 length B16; CARD16 deviceSpec B16; CARD8 affectModLocks; CARD8 modLocks; BOOL lockGroup; CARD8 groupLock; CARD8 affectModLatches; CARD8 modLatches; CARD8 pad; BOOL latchGroup; INT16 groupLatch B16; } xkbLatchLockStateReq; #define sz_xkbLatchLockStateReq 16 typedef struct _xkbGetControls { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetControls */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad B16; } xkbGetControlsReq; #define sz_xkbGetControlsReq 8 typedef struct _xkbGetControlsReply { BYTE type; /* X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD8 mkDfltBtn; CARD8 numGroups; CARD8 groupsWrap; CARD8 internalMods; CARD8 ignoreLockMods; CARD8 internalRealMods; CARD8 ignoreLockRealMods; CARD8 pad1; CARD16 internalVMods B16; CARD16 ignoreLockVMods B16; CARD16 repeatDelay B16; CARD16 repeatInterval B16; CARD16 slowKeysDelay B16; CARD16 debounceDelay B16; CARD16 mkDelay B16; CARD16 mkInterval B16; CARD16 mkTimeToMax B16; CARD16 mkMaxSpeed B16; INT16 mkCurve B16; CARD16 axOptions B16; CARD16 axTimeout B16; CARD16 axtOptsMask B16; CARD16 axtOptsValues B16; CARD16 pad2 B16; CARD32 axtCtrlsMask B32; CARD32 axtCtrlsValues B32; CARD32 enabledCtrls B32; BYTE perKeyRepeat[XkbPerKeyBitArraySize]; } xkbGetControlsReply; #define sz_xkbGetControlsReply 92 typedef struct _xkbSetControls { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetControls */ CARD16 length B16; CARD16 deviceSpec B16; CARD8 affectInternalMods; CARD8 internalMods; CARD8 affectIgnoreLockMods; CARD8 ignoreLockMods; CARD16 affectInternalVMods B16; CARD16 internalVMods B16; CARD16 affectIgnoreLockVMods B16; CARD16 ignoreLockVMods B16; CARD8 mkDfltBtn; CARD8 groupsWrap; CARD16 axOptions B16; CARD16 pad1 B16; CARD32 affectEnabledCtrls B32; CARD32 enabledCtrls B32; CARD32 changeCtrls B32; CARD16 repeatDelay B16; CARD16 repeatInterval B16; CARD16 slowKeysDelay B16; CARD16 debounceDelay B16; CARD16 mkDelay B16; CARD16 mkInterval B16; CARD16 mkTimeToMax B16; CARD16 mkMaxSpeed B16; INT16 mkCurve B16; CARD16 axTimeout B16; CARD32 axtCtrlsMask B32; CARD32 axtCtrlsValues B32; CARD16 axtOptsMask B16; CARD16 axtOptsValues B16; BYTE perKeyRepeat[XkbPerKeyBitArraySize]; } xkbSetControlsReq; #define sz_xkbSetControlsReq 100 typedef struct _xkbKTMapEntryWireDesc { BOOL active; CARD8 mask; CARD8 level; CARD8 realMods; CARD16 virtualMods B16; CARD16 pad B16; } xkbKTMapEntryWireDesc; #define sz_xkbKTMapEntryWireDesc 8 typedef struct _xkbKTSetMapEntryWireDesc { CARD8 level; CARD8 realMods; CARD16 virtualMods B16; } xkbKTSetMapEntryWireDesc; #define sz_xkbKTSetMapEntryWireDesc 4 typedef struct _xkbModsWireDesc { CARD8 mask; /* GetMap only */ CARD8 realMods; CARD16 virtualMods B16; } xkbModsWireDesc; #define sz_xkbModsWireDesc 4 typedef struct _xkbKeyTypeWireDesc { CARD8 mask; CARD8 realMods; CARD16 virtualMods B16; CARD8 numLevels; CARD8 nMapEntries; BOOL preserve; CARD8 pad; } xkbKeyTypeWireDesc; #define sz_xkbKeyTypeWireDesc 8 typedef struct _xkbSymMapWireDesc { CARD8 ktIndex[XkbNumKbdGroups]; CARD8 groupInfo; CARD8 width; CARD16 nSyms B16; } xkbSymMapWireDesc; #define sz_xkbSymMapWireDesc 8 typedef struct _xkbVModMapWireDesc { KeyCode key; CARD8 pad; CARD16 vmods B16; } xkbVModMapWireDesc; #define sz_xkbVModMapWireDesc 4 typedef struct _xkbBehaviorWireDesc { CARD8 key; CARD8 type; CARD8 data; CARD8 pad; } xkbBehaviorWireDesc; #define sz_xkbBehaviorWireDesc 4 typedef struct _xkbActionWireDesc { CARD8 type; CARD8 data[7]; } xkbActionWireDesc; #define sz_xkbActionWireDesc 8 typedef struct _xkbGetMap { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetMap */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 full B16; CARD16 partial B16; CARD8 firstType; CARD8 nTypes; KeyCode firstKeySym; CARD8 nKeySyms; KeyCode firstKeyAct; CARD8 nKeyActs; KeyCode firstKeyBehavior; CARD8 nKeyBehaviors; CARD16 virtualMods B16; KeyCode firstKeyExplicit; CARD8 nKeyExplicit; KeyCode firstModMapKey; CARD8 nModMapKeys; KeyCode firstVModMapKey; CARD8 nVModMapKeys; CARD16 pad1 B16; } xkbGetMapReq; #define sz_xkbGetMapReq 28 typedef struct _xkbGetMapReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 pad1 B16; KeyCode minKeyCode; KeyCode maxKeyCode; CARD16 present B16; CARD8 firstType; CARD8 nTypes; CARD8 totalTypes; KeyCode firstKeySym; CARD16 totalSyms B16; CARD8 nKeySyms; KeyCode firstKeyAct; CARD16 totalActs B16; CARD8 nKeyActs; KeyCode firstKeyBehavior; CARD8 nKeyBehaviors; CARD8 totalKeyBehaviors; KeyCode firstKeyExplicit; CARD8 nKeyExplicit; CARD8 totalKeyExplicit; KeyCode firstModMapKey; CARD8 nModMapKeys; CARD8 totalModMapKeys; KeyCode firstVModMapKey; CARD8 nVModMapKeys; CARD8 totalVModMapKeys; CARD8 pad2; CARD16 virtualMods B16; } xkbGetMapReply; #define sz_xkbGetMapReply 40 #define XkbSetMapResizeTypes (1L<<0) #define XkbSetMapRecomputeActions (1L<<1) #define XkbSetMapAllFlags (0x3) typedef struct _xkbSetMap { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetMap */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 present B16; CARD16 flags B16; KeyCode minKeyCode; KeyCode maxKeyCode; CARD8 firstType; CARD8 nTypes; KeyCode firstKeySym; CARD8 nKeySyms; CARD16 totalSyms B16; KeyCode firstKeyAct; CARD8 nKeyActs; CARD16 totalActs B16; KeyCode firstKeyBehavior; CARD8 nKeyBehaviors; CARD8 totalKeyBehaviors; KeyCode firstKeyExplicit; CARD8 nKeyExplicit; CARD8 totalKeyExplicit; KeyCode firstModMapKey; CARD8 nModMapKeys; CARD8 totalModMapKeys; KeyCode firstVModMapKey; CARD8 nVModMapKeys; CARD8 totalVModMapKeys; CARD16 virtualMods B16; } xkbSetMapReq; #define sz_xkbSetMapReq 36 typedef struct _xkbSymInterpretWireDesc { CARD32 sym B32; CARD8 mods; CARD8 match; CARD8 virtualMod; CARD8 flags; xkbActionWireDesc act; } xkbSymInterpretWireDesc; #define sz_xkbSymInterpretWireDesc 16 typedef struct _xkbGetCompatMap { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetCompatMap */ CARD16 length B16; CARD16 deviceSpec B16; CARD8 groups; BOOL getAllSI; CARD16 firstSI B16; CARD16 nSI B16; } xkbGetCompatMapReq; #define sz_xkbGetCompatMapReq 12 typedef struct _xkbGetCompatMapReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD8 groups; CARD8 pad1; CARD16 firstSI B16; CARD16 nSI B16; CARD16 nTotalSI B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xkbGetCompatMapReply; #define sz_xkbGetCompatMapReply 32 typedef struct _xkbSetCompatMap { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetCompatMap */ CARD16 length B16; CARD16 deviceSpec B16; CARD8 pad1; BOOL recomputeActions; BOOL truncateSI; CARD8 groups; CARD16 firstSI B16; CARD16 nSI B16; CARD16 pad2 B16; } xkbSetCompatMapReq; #define sz_xkbSetCompatMapReq 16 typedef struct _xkbGetIndicatorState { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetIndicatorState */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad1 B16; } xkbGetIndicatorStateReq; #define sz_xkbGetIndicatorStateReq 8 typedef struct _xkbGetIndicatorStateReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 state B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xkbGetIndicatorStateReply; #define sz_xkbGetIndicatorStateReply 32 typedef struct _xkbGetIndicatorMap { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetIndicatorMap */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad B16; CARD32 which B32; } xkbGetIndicatorMapReq; #define sz_xkbGetIndicatorMapReq 12 typedef struct _xkbGetIndicatorMapReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 which B32; CARD32 realIndicators B32; CARD8 nIndicators; CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xkbGetIndicatorMapReply; #define sz_xkbGetIndicatorMapReply 32 typedef struct _xkbIndicatorMapWireDesc { CARD8 flags; CARD8 whichGroups; CARD8 groups; CARD8 whichMods; CARD8 mods; CARD8 realMods; CARD16 virtualMods B16; CARD32 ctrls B32; } xkbIndicatorMapWireDesc; #define sz_xkbIndicatorMapWireDesc 12 typedef struct _xkbSetIndicatorMap { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetIndicatorMap */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad1 B16; CARD32 which B32; } xkbSetIndicatorMapReq; #define sz_xkbSetIndicatorMapReq 12 typedef struct _xkbGetNamedIndicator { CARD8 reqType; CARD8 xkbReqType; /* X_KBGetNamedIndicator */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 ledClass B16; CARD16 ledID B16; CARD16 pad1 B16; Atom indicator B32; } xkbGetNamedIndicatorReq; #define sz_xkbGetNamedIndicatorReq 16 typedef struct _xkbGetNamedIndicatorReply { BYTE type; BYTE deviceID; CARD16 sequenceNumber B16; CARD32 length B32; Atom indicator B32; BOOL found; BOOL on; BOOL realIndicator; CARD8 ndx; CARD8 flags; CARD8 whichGroups; CARD8 groups; CARD8 whichMods; CARD8 mods; CARD8 realMods; CARD16 virtualMods B16; CARD32 ctrls B32; BOOL supported; CARD8 pad1; CARD16 pad2 B16; } xkbGetNamedIndicatorReply; #define sz_xkbGetNamedIndicatorReply 32 typedef struct _xkbSetNamedIndicator { CARD8 reqType; CARD8 xkbReqType; /* X_KBSetNamedIndicator */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 ledClass B16; CARD16 ledID B16; CARD16 pad1 B16; Atom indicator B32; BOOL setState; BOOL on; BOOL setMap; BOOL createMap; CARD8 pad2; CARD8 flags; CARD8 whichGroups; CARD8 groups; CARD8 whichMods; CARD8 realMods; CARD16 virtualMods B16; CARD32 ctrls B32; } xkbSetNamedIndicatorReq; #define sz_xkbSetNamedIndicatorReq 32 typedef struct _xkbGetNames { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetNames */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad B16; CARD32 which B32; } xkbGetNamesReq; #define sz_xkbGetNamesReq 12 typedef struct _xkbGetNamesReply { BYTE type; BYTE deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 which B32; KeyCode minKeyCode; KeyCode maxKeyCode; CARD8 nTypes; CARD8 groupNames; CARD16 virtualMods B16; KeyCode firstKey; CARD8 nKeys; CARD32 indicators B32; CARD8 nRadioGroups; CARD8 nKeyAliases; CARD16 nKTLevels B16; CARD32 pad3 B32; } xkbGetNamesReply; #define sz_xkbGetNamesReply 32 typedef struct _xkbSetNames { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetNames */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 virtualMods B16; CARD32 which B32; CARD8 firstType; CARD8 nTypes; CARD8 firstKTLevel; CARD8 nKTLevels; CARD32 indicators B32; CARD8 groupNames; CARD8 nRadioGroups; KeyCode firstKey; CARD8 nKeys; CARD8 nKeyAliases; CARD8 pad1; CARD16 totalKTLevelNames B16; } xkbSetNamesReq; #define sz_xkbSetNamesReq 28 typedef struct _xkbPointWireDesc { INT16 x B16; INT16 y B16; } xkbPointWireDesc; #define sz_xkbPointWireDesc 4 typedef struct _xkbOutlineWireDesc { CARD8 nPoints; CARD8 cornerRadius; CARD16 pad B16; } xkbOutlineWireDesc; #define sz_xkbOutlineWireDesc 4 typedef struct _xkbShapeWireDesc { Atom name B32; CARD8 nOutlines; CARD8 primaryNdx; CARD8 approxNdx; CARD8 pad; } xkbShapeWireDesc; #define sz_xkbShapeWireDesc 8 typedef struct _xkbSectionWireDesc { Atom name B32; INT16 top B16; INT16 left B16; CARD16 width B16; CARD16 height B16; INT16 angle B16; CARD8 priority; CARD8 nRows; CARD8 nDoodads; CARD8 nOverlays; CARD16 pad B16; } xkbSectionWireDesc; #define sz_xkbSectionWireDesc 20 typedef struct _xkbRowWireDesc { INT16 top B16; INT16 left B16; CARD8 nKeys; BOOL vertical; CARD16 pad B16; } xkbRowWireDesc; #define sz_xkbRowWireDesc 8 typedef struct _xkbKeyWireDesc { CARD8 name[XkbKeyNameLength]; INT16 gap B16; CARD8 shapeNdx; CARD8 colorNdx; } xkbKeyWireDesc; #define sz_xkbKeyWireDesc 8 typedef struct _xkbOverlayWireDesc { Atom name B32; CARD8 nRows; CARD8 pad1; CARD16 pad2 B16; } xkbOverlayWireDesc; #define sz_xkbOverlayWireDesc 8 typedef struct _xkbOverlayRowWireDesc { CARD8 rowUnder; CARD8 nKeys; CARD16 pad1 B16; } xkbOverlayRowWireDesc; #define sz_xkbOverlayRowWireDesc 4 typedef struct _xkbOverlayKeyWireDesc { CARD8 over[XkbKeyNameLength]; CARD8 under[XkbKeyNameLength]; } xkbOverlayKeyWireDesc; #define sz_xkbOverlayKeyWireDesc 8 typedef struct _xkbShapeDoodadWireDesc { Atom name B32; CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; INT16 angle B16; CARD8 colorNdx; CARD8 shapeNdx; CARD16 pad1 B16; CARD32 pad2 B32; } xkbShapeDoodadWireDesc; #define sz_xkbShapeDoodadWireDesc 20 typedef struct _xkbTextDoodadWireDesc { Atom name B32; CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; INT16 angle B16; CARD16 width B16; CARD16 height B16; CARD8 colorNdx; CARD8 pad1; CARD16 pad2 B16; } xkbTextDoodadWireDesc; #define sz_xkbTextDoodadWireDesc 20 typedef struct _xkbIndicatorDoodadWireDesc { Atom name B32; CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; INT16 angle B16; CARD8 shapeNdx; CARD8 onColorNdx; CARD8 offColorNdx; CARD8 pad1; CARD32 pad2 B32; } xkbIndicatorDoodadWireDesc; #define sz_xkbIndicatorDoodadWireDesc 20 typedef struct _xkbLogoDoodadWireDesc { Atom name B32; CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; INT16 angle B16; CARD8 colorNdx; CARD8 shapeNdx; CARD16 pad1 B16; CARD32 pad2 B32; } xkbLogoDoodadWireDesc; #define sz_xkbLogoDoodadWireDesc 20 typedef struct _xkbAnyDoodadWireDesc { Atom name B32; CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; INT16 angle B16; CARD32 pad2 B32; CARD32 pad3 B32; } xkbAnyDoodadWireDesc; #define sz_xkbAnyDoodadWireDesc 20 typedef union _xkbDoodadWireDesc { xkbAnyDoodadWireDesc any; xkbShapeDoodadWireDesc shape; xkbTextDoodadWireDesc text; xkbIndicatorDoodadWireDesc indicator; xkbLogoDoodadWireDesc logo; } xkbDoodadWireDesc; #define sz_xkbDoodadWireDesc 20 typedef struct _xkbGetGeometry { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetGeometry */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad B16; Atom name B32; } xkbGetGeometryReq; #define sz_xkbGetGeometryReq 12 typedef struct _xkbGetGeometryReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; Atom name B32; BOOL found; CARD8 pad; CARD16 widthMM B16; CARD16 heightMM B16; CARD16 nProperties B16; CARD16 nColors B16; CARD16 nShapes B16; CARD16 nSections B16; CARD16 nDoodads B16; CARD16 nKeyAliases B16; CARD8 baseColorNdx; CARD8 labelColorNdx; } xkbGetGeometryReply; #define sz_xkbGetGeometryReply 32 typedef struct _xkbSetGeometry { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetGeometry */ CARD16 length B16; CARD16 deviceSpec B16; CARD8 nShapes; CARD8 nSections; Atom name B32; CARD16 widthMM B16; CARD16 heightMM B16; CARD16 nProperties B16; CARD16 nColors B16; CARD16 nDoodads B16; CARD16 nKeyAliases B16; CARD8 baseColorNdx; CARD8 labelColorNdx; CARD16 pad B16; } xkbSetGeometryReq; #define sz_xkbSetGeometryReq 28 typedef struct _xkbPerClientFlags { CARD8 reqType; CARD8 xkbReqType;/* always X_KBPerClientFlags */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad1 B16; CARD32 change B32; CARD32 value B32; CARD32 ctrlsToChange B32; CARD32 autoCtrls B32; CARD32 autoCtrlValues B32; } xkbPerClientFlagsReq; #define sz_xkbPerClientFlagsReq 28 typedef struct _xkbPerClientFlagsReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 supported B32; CARD32 value B32; CARD32 autoCtrls B32; CARD32 autoCtrlValues B32; CARD32 pad1 B32; CARD32 pad2 B32; } xkbPerClientFlagsReply; #define sz_xkbPerClientFlagsReply 32 typedef struct _xkbListComponents { CARD8 reqType; CARD8 xkbReqType; /* always X_KBListComponents */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 maxNames B16; } xkbListComponentsReq; #define sz_xkbListComponentsReq 8 typedef struct _xkbListComponentsReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nKeymaps B16; CARD16 nKeycodes B16; CARD16 nTypes B16; CARD16 nCompatMaps B16; CARD16 nSymbols B16; CARD16 nGeometries B16; CARD16 extra B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; } xkbListComponentsReply; #define sz_xkbListComponentsReply 32 typedef struct _xkbGetKbdByName { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetKbdByName */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 need B16; /* combination of XkbGBN_* */ CARD16 want B16; /* combination of XkbGBN_* */ BOOL load; CARD8 pad; } xkbGetKbdByNameReq; #define sz_xkbGetKbdByNameReq 12 typedef struct _xkbGetKbdByNameReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; KeyCode minKeyCode; KeyCode maxKeyCode; BOOL loaded; BOOL newKeyboard; CARD16 found B16; /* combination of XkbGBN_* */ CARD16 reported B16; /* combination of XkbAllComponents */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xkbGetKbdByNameReply; #define sz_xkbGetKbdByNameReply 32 typedef struct _xkbDeviceLedsWireDesc { CARD16 ledClass B16; CARD16 ledID B16; CARD32 namesPresent B32; CARD32 mapsPresent B32; CARD32 physIndicators B32; CARD32 state B32; } xkbDeviceLedsWireDesc; #define sz_xkbDeviceLedsWireDesc 20 typedef struct _xkbGetDeviceInfo { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetDeviceInfo */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 wanted B16; BOOL allBtns; CARD8 firstBtn; CARD8 nBtns; CARD8 pad; CARD16 ledClass B16; CARD16 ledID B16; } xkbGetDeviceInfoReq; #define sz_xkbGetDeviceInfoReq 16 typedef struct _xkbGetDeviceInfoReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 present B16; CARD16 supported B16; CARD16 unsupported B16; CARD16 nDeviceLedFBs B16; CARD8 firstBtnWanted; CARD8 nBtnsWanted; CARD8 firstBtnRtrn; CARD8 nBtnsRtrn; CARD8 totalBtns; BOOL hasOwnState; CARD16 dfltKbdFB B16; CARD16 dfltLedFB B16; CARD16 pad B16; Atom devType B32; } xkbGetDeviceInfoReply; #define sz_xkbGetDeviceInfoReply 32 typedef struct _xkbSetDeviceInfo { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetDeviceInfo */ CARD16 length B16; CARD16 deviceSpec B16; CARD8 firstBtn; CARD8 nBtns; CARD16 change B16; CARD16 nDeviceLedFBs B16; } xkbSetDeviceInfoReq; #define sz_xkbSetDeviceInfoReq 12 typedef struct _xkbSetDebuggingFlags { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetDebuggingFlags */ CARD16 length B16; CARD16 msgLength B16; CARD16 pad B16; CARD32 affectFlags B32; CARD32 flags B32; CARD32 affectCtrls B32; CARD32 ctrls B32; } xkbSetDebuggingFlagsReq; #define sz_xkbSetDebuggingFlagsReq 24 typedef struct _xkbSetDebuggingFlagsReply { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 currentFlags B32; CARD32 currentCtrls B32; CARD32 supportedFlags B32; CARD32 supportedCtrls B32; CARD32 pad1 B32; CARD32 pad2 B32; } xkbSetDebuggingFlagsReply; #define sz_xkbSetDebuggingFlagsReply 32 /* * X KEYBOARD EXTENSION EVENT STRUCTURES */ typedef struct _xkbAnyEvent { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xkbAnyEvent; #define sz_xkbAnyEvent 32 typedef struct _xkbNewKeyboardNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 oldDeviceID; KeyCode minKeyCode; KeyCode maxKeyCode; KeyCode oldMinKeyCode; KeyCode oldMaxKeyCode; CARD8 requestMajor; CARD8 requestMinor; CARD16 changed B16; CARD8 detail; CARD8 pad1; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xkbNewKeyboardNotify; #define sz_xkbNewKeyboardNotify 32 typedef struct _xkbMapNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 ptrBtnActions; CARD16 changed B16; KeyCode minKeyCode; KeyCode maxKeyCode; CARD8 firstType; CARD8 nTypes; KeyCode firstKeySym; CARD8 nKeySyms; KeyCode firstKeyAct; CARD8 nKeyActs; KeyCode firstKeyBehavior; CARD8 nKeyBehaviors; KeyCode firstKeyExplicit; CARD8 nKeyExplicit; KeyCode firstModMapKey; CARD8 nModMapKeys; KeyCode firstVModMapKey; CARD8 nVModMapKeys; CARD16 virtualMods B16; CARD16 pad1 B16; } xkbMapNotify; #define sz_xkbMapNotify 32 typedef struct _xkbStateNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 mods; CARD8 baseMods; CARD8 latchedMods; CARD8 lockedMods; CARD8 group; INT16 baseGroup B16; INT16 latchedGroup B16; CARD8 lockedGroup; CARD8 compatState; CARD8 grabMods; CARD8 compatGrabMods; CARD8 lookupMods; CARD8 compatLookupMods; CARD16 ptrBtnState B16; CARD16 changed B16; KeyCode keycode; CARD8 eventType; CARD8 requestMajor; CARD8 requestMinor; } xkbStateNotify; #define sz_xkbStateNotify 32 typedef struct _xkbControlsNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 numGroups; CARD16 pad1 B16; CARD32 changedControls B32; CARD32 enabledControls B32; CARD32 enabledControlChanges B32; KeyCode keycode; CARD8 eventType; CARD8 requestMajor; CARD8 requestMinor; CARD32 pad2 B32; } xkbControlsNotify; #define sz_xkbControlsNotify 32 typedef struct _xkbIndicatorNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 pad1; CARD16 pad2 B16; CARD32 state B32; CARD32 changed B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xkbIndicatorNotify; #define sz_xkbIndicatorNotify 32 typedef struct _xkbNamesNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 pad1; CARD16 changed B16; CARD8 firstType; CARD8 nTypes; CARD8 firstLevelName; CARD8 nLevelNames; CARD8 pad2; CARD8 nRadioGroups; CARD8 nAliases; CARD8 changedGroupNames; CARD16 changedVirtualMods B16; CARD8 firstKey; CARD8 nKeys; CARD32 changedIndicators B32; CARD32 pad3 B32; } xkbNamesNotify; #define sz_xkbNamesNotify 32 typedef struct _xkbCompatMapNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 changedGroups; CARD16 firstSI B16; CARD16 nSI B16; CARD16 nTotalSI B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xkbCompatMapNotify; #define sz_xkbCompatMapNotify 32 typedef struct _xkbBellNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 bellClass; CARD8 bellID; CARD8 percent; CARD16 pitch B16; CARD16 duration B16; Atom name B32; Window window B32; BOOL eventOnly; CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; } xkbBellNotify; #define sz_xkbBellNotify 32 typedef struct _xkbActionMessage { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; KeyCode keycode; BOOL press; BOOL keyEventFollows; CARD8 mods; CARD8 group; CARD8 message[8]; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; } xkbActionMessage; #define sz_xkbActionMessage 32 typedef struct _xkbAccessXNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; KeyCode keycode; CARD16 detail B16; CARD16 slowKeysDelay B16; CARD16 debounceDelay B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xkbAccessXNotify; #define sz_xkbAccessXNotify 32 typedef struct _xkbExtensionDeviceNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 pad1; CARD16 reason B16; CARD16 ledClass B16; CARD16 ledID B16; CARD32 ledsDefined B32; CARD32 ledState B32; CARD8 firstBtn; CARD8 nBtns; CARD16 supported B16; CARD16 unsupported B16; CARD16 pad3 B16; } xkbExtensionDeviceNotify; #define sz_xkbExtensionDeviceNotify 32 typedef struct _xkbEvent { union { xkbAnyEvent any; xkbNewKeyboardNotify new_kbd; xkbMapNotify map; xkbStateNotify state; xkbControlsNotify ctrls; xkbIndicatorNotify indicators; xkbNamesNotify names; xkbCompatMapNotify compat; xkbBellNotify bell; xkbActionMessage message; xkbAccessXNotify accessx; xkbExtensionDeviceNotify device; } u; } xkbEvent; #define sz_xkbEvent 32 #undef Window #undef Atom #undef Time #undef KeyCode #undef KeySym #endif /* _XKBPROTO_H_ */ X11/extensions/recordproto.h000064400000017325147631660250012051 0ustar00/*************************************************************************** * Copyright 1995 Network Computing Devices * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Network Computing Devices * not be used in advertising or publicity pertaining to distribution * of the software without specific, written prior permission. * * NETWORK COMPUTING DEVICES DISCLAIMs ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **************************************************************************/ #ifndef _RECORDPROTO_H_ #define _RECORDPROTO_H_ #include /* only difference between 1.12 and 1.13 is byte order of device events, which the library doesn't deal with. */ /********************************************************* * * Protocol request constants * */ #define X_RecordQueryVersion 0 /* First request from client */ #define X_RecordCreateContext 1 /* Create client RC */ #define X_RecordRegisterClients 2 /* Add to client RC */ #define X_RecordUnregisterClients 3 /* Delete from client RC */ #define X_RecordGetContext 4 /* Query client RC */ #define X_RecordEnableContext 5 /* Enable interception and reporting */ #define X_RecordDisableContext 6 /* Disable interception and reporting */ #define X_RecordFreeContext 7 /* Free client RC */ #define sz_XRecordRange 32 #define sz_XRecordClientInfo 12 #define sz_XRecordState 16 #define sz_XRecordDatum 32 #define XRecordGlobaldef #define XRecordGlobalref extern #define RecordMaxEvent (128L-1L) #define RecordMinDeviceEvent (2L) #define RecordMaxDeviceEvent (6L) #define RecordMaxError (256L-1L) #define RecordMaxCoreRequest (128L-1L) #define RecordMaxExtRequest (256L-1L) #define RecordMinExtRequest (129L-1L) #define RECORD_RC CARD32 #define RECORD_XIDBASE CARD32 #define RECORD_CLIENTSPEC CARD32 #define RECORD_ELEMENT_HEADER CARD8 typedef RECORD_CLIENTSPEC RecordClientSpec, *RecordClientSpecPtr; typedef struct { CARD8 first; CARD8 last; } RECORD_RANGE8; typedef struct { CARD16 first B16; CARD16 last B16; } RECORD_RANGE16; typedef struct { RECORD_RANGE8 majorCode; RECORD_RANGE16 minorCode; } RECORD_EXTRANGE; typedef struct { RECORD_RANGE8 coreRequests; RECORD_RANGE8 coreReplies; RECORD_EXTRANGE extRequests; RECORD_EXTRANGE extReplies; RECORD_RANGE8 deliveredEvents; RECORD_RANGE8 deviceEvents; RECORD_RANGE8 errors; BOOL clientStarted; BOOL clientDied; } RECORDRANGE; #define sz_RECORDRANGE 24 /* typedef RECORDRANGE xRecordRange, *xRecordRangePtr; #define sz_xRecordRange 24 */ /* Cannot have structures within structures going over the wire */ typedef struct { CARD8 coreRequestsFirst; CARD8 coreRequestsLast; CARD8 coreRepliesFirst; CARD8 coreRepliesLast; CARD8 extRequestsMajorFirst; CARD8 extRequestsMajorLast; CARD16 extRequestsMinorFirst B16; CARD16 extRequestsMinorLast B16; CARD8 extRepliesMajorFirst; CARD8 extRepliesMajorLast; CARD16 extRepliesMinorFirst B16; CARD16 extRepliesMinorLast B16; CARD8 deliveredEventsFirst; CARD8 deliveredEventsLast; CARD8 deviceEventsFirst; CARD8 deviceEventsLast; CARD8 errorsFirst; CARD8 errorsLast; BOOL clientStarted; BOOL clientDied; } xRecordRange; #define sz_xRecordRange 24 typedef struct { RECORD_CLIENTSPEC clientResource B32; CARD32 nRanges B32; /* LISTofRECORDRANGE */ } RECORD_CLIENT_INFO; typedef RECORD_CLIENT_INFO xRecordClientInfo; /* * Initialize */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; CARD16 majorVersion B16; CARD16 minorVersion B16; } xRecordQueryVersionReq; #define sz_xRecordQueryVersionReq 8 typedef struct { CARD8 type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; CARD16 minorVersion B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRecordQueryVersionReply; #define sz_xRecordQueryVersionReply 32 /* * Create RC */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; RECORD_ELEMENT_HEADER elementHeader; CARD8 pad; CARD16 pad0 B16; CARD32 nClients B32; CARD32 nRanges B32; /* LISTofRECORD_CLIENTSPEC */ /* LISTofRECORDRANGE */ } xRecordCreateContextReq; #define sz_xRecordCreateContextReq 20 /* * Add to RC */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; RECORD_ELEMENT_HEADER elementHeader; CARD8 pad; CARD16 pad0 B16; CARD32 nClients B32; CARD32 nRanges B32; /* LISTofRECORD_CLIENTSPEC */ /* LISTofRECORDRANGE */ } xRecordRegisterClientsReq; #define sz_xRecordRegisterClientsReq 20 /* * Delete from RC */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; CARD32 nClients B32; /* LISTofRECORD_CLIENTSPEC */ } xRecordUnregisterClientsReq; #define sz_xRecordUnregisterClientsReq 12 /* * Query RC */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; } xRecordGetContextReq; #define sz_xRecordGetContextReq 8 typedef struct { CARD8 type; BOOL enabled; CARD16 sequenceNumber B16; CARD32 length B32; RECORD_ELEMENT_HEADER elementHeader; CARD8 pad; CARD16 pad0 B16; CARD32 nClients B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; /* LISTofCLIENT_INFO */ /* intercepted-clients */ } xRecordGetContextReply; #define sz_xRecordGetContextReply 32 /* * Enable data interception */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; } xRecordEnableContextReq; #define sz_xRecordEnableContextReq 8 typedef struct { CARD8 type; CARD8 category; CARD16 sequenceNumber B16; CARD32 length B32; RECORD_ELEMENT_HEADER elementHeader; BOOL clientSwapped; CARD16 pad1 B16; RECORD_XIDBASE idBase B32; CARD32 serverTime B32; CARD32 recordedSequenceNumber B32; CARD32 pad3 B32; CARD32 pad4 B32; /* BYTE data; */ } xRecordEnableContextReply; #define sz_xRecordEnableContextReply 32 /* * Disable data interception */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; } xRecordDisableContextReq; #define sz_xRecordDisableContextReq 8 /* * Free RC */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; } xRecordFreeContextReq; #define sz_xRecordFreeContextReq 8 #undef RECORD_RC #undef RECORD_XIDBASE #undef RECORD_ELEMENT_HEADER #undef RECORD_CLIENTSPEC #endif X11/extensions/xf86dga1str.h000064400000000277147631660250011566 0ustar00#warning "xf86dga1str.h is obsolete and may be removed in the future." #warning "include for the protocol defines." #include X11/extensions/dri2tokens.h000064400000004644147631660250011573 0ustar00/* * Copyright © 2008 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Soft- * ware"), to deal in the Software without restriction, including without * limitation the rights to use, copy, modify, merge, publish, distribute, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, provided that the above copyright * notice(s) and this permission notice appear in all copies of the Soft- * ware and that both the above copyright notice(s) and this permission * notice appear in supporting documentation. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR- * MANCE OF THIS SOFTWARE. * * Except as contained in this notice, the name of a copyright holder shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization of * the copyright holder. * * Authors: * Kristian Høgsberg (krh@redhat.com) */ #ifndef _DRI2_TOKENS_H_ #define _DRI2_TOKENS_H_ #define DRI2BufferFrontLeft 0 #define DRI2BufferBackLeft 1 #define DRI2BufferFrontRight 2 #define DRI2BufferBackRight 3 #define DRI2BufferDepth 4 #define DRI2BufferStencil 5 #define DRI2BufferAccum 6 #define DRI2BufferFakeFrontLeft 7 #define DRI2BufferFakeFrontRight 8 #define DRI2BufferDepthStencil 9 #define DRI2BufferHiz 10 /* keep bits 16 and above for prime IDs */ #define DRI2DriverPrimeMask 7 /* 0 - 7 - allows for 6 devices*/ #define DRI2DriverPrimeShift 16 #define DRI2DriverPrimeId(x) (((x) >> DRI2DriverPrimeShift) & (DRI2DriverPrimeMask)) #define DRI2DriverDRI 0 #define DRI2DriverVDPAU 1 /* Event sub-types for the swap complete event */ #define DRI2_EXCHANGE_COMPLETE 0x1 #define DRI2_BLIT_COMPLETE 0x2 #define DRI2_FLIP_COMPLETE 0x3 #endif X11/extensions/xf86dga1const.h000064400000001643147631660250012102 0ustar00/* Copyright (c) 1995 Jon Tombs Copyright (c) 1995 XFree86 Inc */ /************************************************************************ THIS IS THE OLD DGA API AND IS OBSOLETE. PLEASE DO NOT USE IT ANYMORE ************************************************************************/ #ifndef _XF86DGA1CONST_H_ #define _XF86DGA1CONST_H_ #define X_XF86DGAQueryVersion 0 #define X_XF86DGAGetVideoLL 1 #define X_XF86DGADirectVideo 2 #define X_XF86DGAGetViewPortSize 3 #define X_XF86DGASetViewPort 4 #define X_XF86DGAGetVidPage 5 #define X_XF86DGASetVidPage 6 #define X_XF86DGAInstallColormap 7 #define X_XF86DGAQueryDirectVideo 8 #define X_XF86DGAViewPortChanged 9 #define XF86DGADirectPresent 0x0001 #define XF86DGADirectGraphics 0x0002 #define XF86DGADirectMouse 0x0004 #define XF86DGADirectKeyb 0x0008 #define XF86DGAHasColormap 0x0100 #define XF86DGADirectColormap 0x0200 #endif /* _XF86DGA1CONST_H_ */ X11/extensions/XKBsrv.h000064400000066575147631660250010701 0ustar00/************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XKBSRV_H_ #define _XKBSRV_H_ #ifdef XKB_IN_SERVER #define XkbAllocClientMap SrvXkbAllocClientMap #define XkbAllocServerMap SrvXkbAllocServerMap #define XkbChangeTypesOfKey SrvXkbChangeTypesOfKey #define XkbAddKeyType SrvXkbAddKeyType #define XkbCopyKeyType SrvXkbCopyKeyType #define XkbCopyKeyTypes SrvXkbCopyKeyTypes #define XkbFreeClientMap SrvXkbFreeClientMap #define XkbFreeServerMap SrvXkbFreeServerMap #define XkbInitCanonicalKeyTypes SrvXkbInitCanonicalKeyTypes #define XkbKeyTypesForCoreSymbols SrvXkbKeyTypesForCoreSymbols #define XkbApplyCompatMapToKey SrvXkbApplyCompatMapToKey #define XkbUpdateMapFromCore SrvXkbUpdateMapFromCore #define XkbResizeKeyActions SrvXkbResizeKeyActions #define XkbResizeKeySyms SrvXkbResizeKeySyms #define XkbResizeKeyType SrvXkbResizeKeyType #define XkbAllocCompatMap SrvXkbAllocCompatMap #define XkbAllocControls SrvXkbAllocControls #define XkbAllocIndicatorMaps SrvXkbAllocIndicatorMaps #define XkbAllocKeyboard SrvXkbAllocKeyboard #define XkbAllocNames SrvXkbAllocNames #define XkbFreeCompatMap SrvXkbFreeCompatMap #define XkbFreeControls SrvXkbFreeControls #define XkbFreeIndicatorMaps SrvXkbFreeIndicatorMaps #define XkbFreeKeyboard SrvXkbFreeKeyboard #define XkbFreeNames SrvXkbFreeNames #define XkbAddDeviceLedInfo SrvXkbAddDeviceLedInfo #define XkbAllocDeviceInfo SrvXkbAllocDeviceInfo #define XkbFreeDeviceInfo SrvXkbFreeDeviceInfo #define XkbResizeDeviceButtonActions SrvXkbResizeDeviceButtonActions #define XkbLatchModifiers SrvXkbLatchModifiers #define XkbLatchGroup SrvXkbLatchGroup #define XkbVirtualModsToReal SrvXkbVirtualModsToReal #define XkbChangeKeycodeRange SrvXkbChangeKeycodeRange #define XkbApplyVirtualModChanges SrvXkbApplyVirtualModChanges #define XkbUpdateActionVirtualMods SrvXkbUpdateActionVirtualMods #define XkbUpdateKeyTypeVirtualMods SrvXkbUpdateKeyTypeVirtualMods #endif #include #include #include "inputstr.h" typedef struct _XkbInterest { DeviceIntPtr dev; ClientPtr client; XID resource; struct _XkbInterest * next; CARD16 extDevNotifyMask; CARD16 stateNotifyMask; CARD16 namesNotifyMask; CARD32 ctrlsNotifyMask; CARD8 compatNotifyMask; BOOL bellNotifyMask; BOOL actionMessageMask; CARD16 accessXNotifyMask; CARD32 iStateNotifyMask; CARD32 iMapNotifyMask; CARD16 altSymsNotifyMask; CARD32 autoCtrls; CARD32 autoCtrlValues; } XkbInterestRec,*XkbInterestPtr; typedef struct _XkbRadioGroup { CARD8 flags; CARD8 nMembers; CARD8 dfltDown; CARD8 currentDown; CARD8 members[XkbRGMaxMembers]; } XkbRadioGroupRec, *XkbRadioGroupPtr; typedef struct _XkbEventCause { CARD8 kc; CARD8 event; CARD8 mjr; CARD8 mnr; ClientPtr client; } XkbEventCauseRec,*XkbEventCausePtr; #define XkbSetCauseKey(c,k,e) { (c)->kc= (k),(c)->event= (e),\ (c)->mjr= (c)->mnr= 0; \ (c)->client= NULL; } #define XkbSetCauseReq(c,j,n,cl) { (c)->kc= (c)->event= 0,\ (c)->mjr= (j),(c)->mnr= (n);\ (c)->client= (cl); } #define XkbSetCauseCoreReq(c,e,cl) XkbSetCauseReq(c,e,0,cl) #define XkbSetCauseXkbReq(c,e,cl) XkbSetCauseReq(c,XkbReqCode,e,cl) #define XkbSetCauseUnknown(c) XkbSetCauseKey(c,0,0) #define _OFF_TIMER 0 #define _KRG_WARN_TIMER 1 #define _KRG_TIMER 2 #define _SK_TIMEOUT_TIMER 3 #define _ALL_TIMEOUT_TIMER 4 #define _BEEP_NONE 0 #define _BEEP_FEATURE_ON 1 #define _BEEP_FEATURE_OFF 2 #define _BEEP_FEATURE_CHANGE 3 #define _BEEP_SLOW_WARN 4 #define _BEEP_SLOW_PRESS 5 #define _BEEP_SLOW_ACCEPT 6 #define _BEEP_SLOW_REJECT 7 #define _BEEP_SLOW_RELEASE 8 #define _BEEP_STICKY_LATCH 9 #define _BEEP_STICKY_LOCK 10 #define _BEEP_STICKY_UNLOCK 11 #define _BEEP_LED_ON 12 #define _BEEP_LED_OFF 13 #define _BEEP_LED_CHANGE 14 #define _BEEP_BOUNCE_REJECT 15 typedef struct _XkbSrvInfo { XkbStateRec prev_state; XkbStateRec state; XkbDescPtr desc; DeviceIntPtr device; KbdCtrlProcPtr kbdProc; XkbRadioGroupPtr radioGroups; CARD8 nRadioGroups; CARD8 clearMods; CARD8 setMods; INT16 groupChange; CARD16 dfltPtrDelta; double mouseKeysCurve; double mouseKeysCurveFactor; INT16 mouseKeysDX; INT16 mouseKeysDY; CARD8 mouseKeysFlags; Bool mouseKeysAccel; CARD8 mouseKeysCounter; CARD8 lockedPtrButtons; CARD8 shiftKeyCount; KeyCode mouseKey; KeyCode inactiveKey; KeyCode slowKey; KeyCode repeatKey; CARD8 krgTimerActive; CARD8 beepType; CARD8 beepCount; CARD32 flags; CARD32 lastPtrEventTime; CARD32 lastShiftEventTime; OsTimerPtr beepTimer; OsTimerPtr mouseKeyTimer; OsTimerPtr slowKeysTimer; OsTimerPtr bounceKeysTimer; OsTimerPtr repeatKeyTimer; OsTimerPtr krgTimer; } XkbSrvInfoRec, *XkbSrvInfoPtr; #define XkbSLI_IsDefault (1L<<0) #define XkbSLI_HasOwnState (1L<<1) typedef struct _XkbSrvLedInfo { CARD16 flags; CARD16 class; CARD16 id; union { KbdFeedbackPtr kf; LedFeedbackPtr lf; } fb; CARD32 physIndicators; CARD32 autoState; CARD32 explicitState; CARD32 effectiveState; CARD32 mapsPresent; CARD32 namesPresent; XkbIndicatorMapPtr maps; Atom * names; CARD32 usesBase; CARD32 usesLatched; CARD32 usesLocked; CARD32 usesEffective; CARD32 usesCompat; CARD32 usesControls; CARD32 usedComponents; } XkbSrvLedInfoRec, *XkbSrvLedInfoPtr; /* * Settings for xkbClientFlags field (used by DIX) * These flags _must_ not overlap with XkbPCF_* */ #define _XkbClientInitialized (1<<15) #define _XkbWantsDetectableAutoRepeat(c)\ ((c)->xkbClientFlags&XkbPCF_DetectableAutoRepeatMask) /* * Settings for flags field */ #define _XkbStateNotifyInProgress (1<<0) typedef struct { ProcessInputProc processInputProc; ProcessInputProc realInputProc; DeviceUnwrapProc unwrapProc; } xkbDeviceInfoRec, *xkbDeviceInfoPtr; #define WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ device->public.processInputProc = proc; \ oldprocs->processInputProc = \ oldprocs->realInputProc = device->public.realInputProc; \ device->public.realInputProc = proc; \ oldprocs->unwrapProc = device->unwrapProc; \ device->unwrapProc = unwrapproc; #define COND_WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ if (device->public.processInputProc == device->public.realInputProc)\ device->public.processInputProc = proc; \ oldprocs->processInputProc = \ oldprocs->realInputProc = device->public.realInputProc; \ device->public.realInputProc = proc; \ oldprocs->unwrapProc = device->unwrapProc; \ device->unwrapProc = unwrapproc; #define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs) \ device->public.processInputProc = oldprocs->processInputProc; \ device->public.realInputProc = oldprocs->realInputProc; \ device->unwrapProc = oldprocs->unwrapProc; #define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr) (dev)->devPrivates[xkbDevicePrivateIndex].ptr) /***====================================================================***/ /***====================================================================***/ #define XkbAX_KRGMask (XkbSlowKeysMask|XkbBounceKeysMask) #define XkbAllFilteredEventsMask \ (XkbAccessXKeysMask|XkbRepeatKeysMask|XkbMouseKeysAccelMask|XkbAX_KRGMask) /***====================================================================***/ extern int XkbReqCode; extern int XkbEventBase; extern int XkbKeyboardErrorCode; extern int XkbDisableLockActions; extern char * XkbBaseDirectory; extern char * XkbBinDirectory; extern char * XkbInitialMap; extern int _XkbClientMajor; extern int _XkbClientMinor; extern unsigned int XkbXIUnsupported; extern char * XkbModelUsed,*XkbLayoutUsed,*XkbVariantUsed,*XkbOptionsUsed; extern Bool noXkbExtension; extern Bool XkbWantRulesProp; extern pointer XkbLastRepeatEvent; extern CARD32 xkbDebugFlags; extern CARD32 xkbDebugCtrls; #define _XkbAlloc(s) xalloc((s)) #define _XkbCalloc(n,s) Xcalloc((n)*(s)) #define _XkbRealloc(o,s) Xrealloc((o),(s)) #define _XkbTypedAlloc(t) ((t *)xalloc(sizeof(t))) #define _XkbTypedCalloc(n,t) ((t *)Xcalloc((n)*sizeof(t))) #define _XkbTypedRealloc(o,n,t) \ ((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t)) #define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t)) #define _XkbFree(p) Xfree(p) #define _XkbLibError(c,l,d) \ { _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); } #define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff))) #define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c)) #define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d))) extern int DeviceKeyPress,DeviceKeyRelease; extern int DeviceButtonPress,DeviceButtonRelease; #ifdef XINPUT #define _XkbIsPressEvent(t) (((t)==KeyPress)||((t)==DeviceKeyPress)) #define _XkbIsReleaseEvent(t) (((t)==KeyRelease)||((t)==DeviceKeyRelease)) #else #define _XkbIsPressEvent(t) ((t)==KeyPress) #define _XkbIsReleaseEvent(t) ((t)==KeyRelease) #endif #define _XkbCoreKeycodeInRange(c,k) (((k)>=(c)->curKeySyms.minKeyCode)&&\ ((k)<=(c)->curKeySyms.maxKeyCode)) #define _XkbCoreNumKeys(c) ((c)->curKeySyms.maxKeyCode-\ (c)->curKeySyms.minKeyCode+1) #define XConvertCase(s,l,u) XkbConvertCase(s,l,u) #undef IsKeypadKey #define IsKeypadKey(s) XkbKSIsKeypad(s) typedef int Status; typedef pointer XPointer; typedef struct _XDisplay Display; #ifndef True #define True 1 #define False 0 #endif #ifndef PATH_MAX #ifdef MAXPATHLEN #define PATH_MAX MAXPATHLEN #else #define PATH_MAX 1024 #endif #endif _XFUNCPROTOBEGIN extern void XkbUseMsg( void ); extern int XkbProcessArguments( int /* argc */, char ** /* argv */, int /* i */ ); extern void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc); extern void XkbFreeCompatMap( XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeMap */ ); extern void XkbFreeNames( XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeMap */ ); extern DeviceIntPtr _XkbLookupAnyDevice( int /* id */, int * /* why_rtrn */ ); extern DeviceIntPtr _XkbLookupKeyboard( int /* id */, int * /* why_rtrn */ ); extern DeviceIntPtr _XkbLookupBellDevice( int /* id */, int * /* why_rtrn */ ); extern DeviceIntPtr _XkbLookupLedDevice( int /* id */, int * /* why_rtrn */ ); extern DeviceIntPtr _XkbLookupButtonDevice( int /* id */, int * /* why_rtrn */ ); extern XkbDescPtr XkbAllocKeyboard( void ); extern Status XkbAllocClientMap( XkbDescPtr /* xkb */, unsigned int /* which */, unsigned int /* nTypes */ ); extern Status XkbAllocServerMap( XkbDescPtr /* xkb */, unsigned int /* which */, unsigned int /* nNewActions */ ); extern void XkbFreeClientMap( XkbDescPtr /* xkb */, unsigned int /* what */, Bool /* freeMap */ ); extern void XkbFreeServerMap( XkbDescPtr /* xkb */, unsigned int /* what */, Bool /* freeMap */ ); extern Status XkbAllocIndicatorMaps( XkbDescPtr /* xkb */ ); extern Status XkbAllocCompatMap( XkbDescPtr /* xkb */, unsigned int /* which */, unsigned int /* nInterpret */ ); extern Status XkbAllocNames( XkbDescPtr /* xkb */, unsigned int /* which */, int /* nTotalRG */, int /* nTotalAliases */ ); extern Status XkbAllocControls( XkbDescPtr /* xkb */, unsigned int /* which*/ ); extern Status XkbCopyKeyType( XkbKeyTypePtr /* from */, XkbKeyTypePtr /* into */ ); extern Status XkbCopyKeyTypes( XkbKeyTypePtr /* from */, XkbKeyTypePtr /* into */, int /* num_types */ ); extern Status XkbResizeKeyType( XkbDescPtr /* xkb */, int /* type_ndx */, int /* map_count */, Bool /* want_preserve */, int /* new_num_lvls */ ); extern void XkbFreeKeyboard( XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeDesc */ ); extern void XkbSetActionKeyMods( XkbDescPtr /* xkb */, XkbAction * /* act */, unsigned int /* mods */ ); extern Bool XkbCheckActionVMods( XkbDescPtr /* xkb */, XkbAction * /* act */, unsigned int /* changed */ ); extern Bool XkbApplyVModChanges( XkbSrvInfoPtr /* xkbi */, unsigned int /* changed */, XkbChangesPtr /* pChanges */, unsigned int * /* needChecksRtrn */, XkbEventCausePtr /* cause */ ); extern void XkbApplyVModChangesToAllDevices( DeviceIntPtr /* dev */, XkbDescPtr /* xkb */, unsigned int /* changed */, XkbEventCausePtr /* cause */ ); extern unsigned int XkbMaskForVMask( XkbDescPtr /* xkb */, unsigned int /* vmask */ ); extern Bool XkbVirtualModsToReal( XkbDescPtr /* xkb */, unsigned int /* virtua_mask */, unsigned int * /* mask_rtrn */ ); extern unsigned int XkbAdjustGroup( int /* group */, XkbControlsPtr /* ctrls */ ); extern KeySym *XkbResizeKeySyms( XkbDescPtr /* xkb */, int /* key */, int /* needed */ ); extern XkbAction *XkbResizeKeyActions( XkbDescPtr /* xkb */, int /* key */, int /* needed */ ); extern void XkbUpdateKeyTypesFromCore( DeviceIntPtr /* pXDev */, KeyCode /* first */, CARD8 /* num */, XkbChangesPtr /* pChanges */ ); extern void XkbUpdateDescActions( XkbDescPtr /* xkb */, KeyCode /* first */, CARD8 /* num */, XkbChangesPtr /* changes */ ); extern void XkbUpdateActions( DeviceIntPtr /* pXDev */, KeyCode /* first */, CARD8 /* num */, XkbChangesPtr /* pChanges */, unsigned int * /* needChecksRtrn */, XkbEventCausePtr /* cause */ ); extern void XkbUpdateCoreDescription( DeviceIntPtr /* keybd */, Bool /* resize */ ); extern void XkbApplyMappingChange( DeviceIntPtr /* pXDev */, CARD8 /* request */, KeyCode /* firstKey */, CARD8 /* num */, ClientPtr /* client */ ); extern void XkbSetIndicators( DeviceIntPtr /* pXDev */, CARD32 /* affect */, CARD32 /* values */, XkbEventCausePtr /* cause */ ); extern void XkbUpdateIndicators( DeviceIntPtr /* keybd */, CARD32 /* changed */, Bool /* check_edevs */, XkbChangesPtr /* pChanges */, XkbEventCausePtr /* cause */ ); extern XkbSrvLedInfoPtr XkbAllocSrvLedInfo( DeviceIntPtr /* dev */, KbdFeedbackPtr /* kf */, LedFeedbackPtr /* lf */, unsigned int /* needed_parts */ ); extern XkbSrvLedInfoPtr XkbFindSrvLedInfo( DeviceIntPtr /* dev */, unsigned int /* class */, unsigned int /* id */, unsigned int /* needed_parts */ ); extern void XkbApplyLedNameChanges( DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, unsigned int /* changed_names */, xkbExtensionDeviceNotify * /* ed */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern void XkbApplyLedMapChanges( DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, unsigned int /* changed_maps */, xkbExtensionDeviceNotify * /* ed */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern void XkbApplyLedStateChanges( DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, unsigned int /* changed_leds */, xkbExtensionDeviceNotify * /* ed */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern void XkbUpdateLedAutoState( DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, unsigned int /* maps_to_check */, xkbExtensionDeviceNotify * /* ed */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern void XkbFlushLedEvents( DeviceIntPtr /* dev */, DeviceIntPtr /* kbd */, XkbSrvLedInfoPtr /* sli */, xkbExtensionDeviceNotify * /* ed */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern void XkbUpdateAllDeviceIndicators( XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern unsigned int XkbIndicatorsToUpdate( DeviceIntPtr /* dev */, unsigned long /* state_changes */, Bool /* enabled_ctrl_changes */ ); extern void XkbComputeDerivedState( XkbSrvInfoPtr /* xkbi */ ); extern void XkbCheckSecondaryEffects( XkbSrvInfoPtr /* xkbi */, unsigned int /* which */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern void XkbCheckIndicatorMaps( DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, unsigned int /* which */ ); extern unsigned int XkbStateChangedFlags( XkbStatePtr /* old */, XkbStatePtr /* new */ ); extern void XkbSendStateNotify( DeviceIntPtr /* kbd */, xkbStateNotify * /* pSN */ ); extern void XkbSendMapNotify( DeviceIntPtr /* kbd */, xkbMapNotify * /* ev */ ); extern int XkbComputeControlsNotify( DeviceIntPtr /* kbd */, XkbControlsPtr /* old */, XkbControlsPtr /* new */, xkbControlsNotify * /* pCN */, Bool /* forceCtrlProc */ ); extern void XkbSendControlsNotify( DeviceIntPtr /* kbd */, xkbControlsNotify * /* ev */ ); extern void XkbSendCompatMapNotify( DeviceIntPtr /* kbd */, xkbCompatMapNotify * /* ev */ ); extern void XkbSendIndicatorNotify( DeviceIntPtr /* kbd */, int /* xkbType */, xkbIndicatorNotify * /* ev */ ); extern void XkbHandleBell( BOOL /* force */, BOOL /* eventOnly */, DeviceIntPtr /* kbd */, CARD8 /* percent */, pointer /* ctrl */, CARD8 /* class */, Atom /* name */, WindowPtr /* pWin */, ClientPtr /* pClient */ ); extern void XkbSendAccessXNotify( DeviceIntPtr /* kbd */, xkbAccessXNotify * /* pEv */ ); extern void XkbSendNamesNotify( DeviceIntPtr /* kbd */, xkbNamesNotify * /* ev */ ); extern void XkbSendCompatNotify( DeviceIntPtr /* kbd */, xkbCompatMapNotify * /* ev */ ); extern void XkbSendActionMessage( DeviceIntPtr /* kbd */, xkbActionMessage * /* ev */ ); extern void XkbSendExtensionDeviceNotify( DeviceIntPtr /* kbd */, ClientPtr /* client */, xkbExtensionDeviceNotify * /* ev */ ); extern void XkbSendNotification( DeviceIntPtr /* kbd */, XkbChangesPtr /* pChanges */, XkbEventCausePtr /* cause */ ); extern void XkbProcessKeyboardEvent( struct _xEvent * /* xE */, DeviceIntPtr /* keybd */, int /* count */ ); extern void XkbProcessOtherEvent( struct _xEvent * /* xE */, DeviceIntPtr /* keybd */, int /* count */ ); extern void XkbHandleActions( DeviceIntPtr /* dev */, DeviceIntPtr /* kbd */, struct _xEvent * /* xE */, int /* count */ ); extern Bool XkbEnableDisableControls( XkbSrvInfoPtr /* xkbi */, unsigned long /* change */, unsigned long /* newValues */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern void AccessXInit( DeviceIntPtr /* dev */ ); extern Bool AccessXFilterPressEvent( register struct _xEvent * /* xE */, register DeviceIntPtr /* keybd */, int /* count */ ); extern Bool AccessXFilterReleaseEvent( register struct _xEvent * /* xE */, register DeviceIntPtr /* keybd */, int /* count */ ); extern void AccessXCancelRepeatKey( XkbSrvInfoPtr /* xkbi */, KeyCode /* key */ ); extern void AccessXComputeCurveFactor( XkbSrvInfoPtr /* xkbi */, XkbControlsPtr /* ctrls */ ); extern XkbDeviceLedInfoPtr XkbAddDeviceLedInfo( XkbDeviceInfoPtr /* devi */, unsigned int /* ledClass */, unsigned int /* ledId */ ); extern XkbDeviceInfoPtr XkbAllocDeviceInfo( unsigned int /* deviceSpec */, unsigned int /* nButtons */, unsigned int /* szLeds */ ); extern void XkbFreeDeviceInfo( XkbDeviceInfoPtr /* devi */, unsigned int /* which */, Bool /* freeDevI */ ); extern Status XkbResizeDeviceButtonActions( XkbDeviceInfoPtr /* devi */, unsigned int /* newTotal */ ); extern XkbInterestPtr XkbFindClientResource( DevicePtr /* inDev */, ClientPtr /* client */ ); extern XkbInterestPtr XkbAddClientResource( DevicePtr /* inDev */, ClientPtr /* client */, XID /* id */ ); extern int XkbRemoveClient( DevicePtr /* inDev */, ClientPtr /* client */ ); extern int XkbRemoveResourceClient( DevicePtr /* inDev */, XID /* id */ ); extern int XkbDDXInitDevice( DeviceIntPtr /* dev */ ); extern int XkbDDXAccessXBeep( DeviceIntPtr /* dev */, unsigned int /* what */, unsigned int /* which */ ); extern void XkbDDXKeyClick( DeviceIntPtr /* dev */, int /* keycode */, int /* synthetic */ ); extern int XkbDDXUsesSoftRepeat( DeviceIntPtr /* dev */ ); extern void XkbDDXKeybdCtrlProc( DeviceIntPtr /* dev */, KeybdCtrl * /* ctrl */ ); extern void XkbDDXChangeControls( DeviceIntPtr /* dev */, XkbControlsPtr /* old */, XkbControlsPtr /* new */ ); extern void XkbDDXUpdateIndicators( DeviceIntPtr /* keybd */, CARD32 /* newState */ ); extern void XkbDDXUpdateDeviceIndicators( DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, CARD32 /* newState */ ); extern void XkbDDXFakePointerButton( int /* event */, int /* button */ ); extern void XkbDDXFakePointerMotion( unsigned int /* flags */, int /* x */, int /* y */ ); extern void XkbDDXFakeDeviceButton( DeviceIntPtr /* dev */, Bool /* press */, int /* button */ ); extern int XkbDDXTerminateServer( DeviceIntPtr /* dev */, KeyCode /* key */, XkbAction * /* act */ ); extern int XkbDDXSwitchScreen( DeviceIntPtr /* dev */, KeyCode /* key */, XkbAction * /* act */ ); extern int XkbDDXPrivate( DeviceIntPtr /* dev */, KeyCode /* key */, XkbAction * /* act */ ); extern void XkbDisableComputedAutoRepeats( DeviceIntPtr /* pXDev */, unsigned int /* key */ ); extern void XkbSetRepeatKeys( DeviceIntPtr /* pXDev */, int /* key */, int /* onoff */ ); extern int XkbLatchModifiers( DeviceIntPtr /* pXDev */, CARD8 /* mask */, CARD8 /* latches */ ); extern int XkbLatchGroup( DeviceIntPtr /* pXDev */, int /* group */ ); extern void XkbClearAllLatchesAndLocks( DeviceIntPtr /* dev */, XkbSrvInfoPtr /* xkbi */, Bool /* genEv */, XkbEventCausePtr /* cause */ ); extern void XkbSetRulesDflts( char * /* rulesFile */, char * /* model */, char * /* layout */, char * /* variant */, char * /* options */ ); extern void XkbInitDevice( DeviceIntPtr /* pXDev */ ); extern Bool XkbInitKeyboardDeviceStruct( DeviceIntPtr /* pXDev */, XkbComponentNamesPtr /* pNames */, KeySymsPtr /* pSyms */, CARD8 /* pMods */[], BellProcPtr /* bellProc */, KbdCtrlProcPtr /* ctrlProc */ ); extern int SProcXkbDispatch( ClientPtr /* client */ ); extern XkbGeometryPtr XkbLookupNamedGeometry( DeviceIntPtr /* dev */, Atom /* name */, Bool * /* shouldFree */ ); extern char * _XkbDupString( char * /* str */ ); extern void XkbConvertCase( KeySym /* sym */, KeySym * /* lower */, KeySym * /* upper */ ); extern Status XkbChangeKeycodeRange( XkbDescPtr /* xkb */, int /* minKC */, int /* maxKC */, XkbChangesPtr /* changes */ ); extern int XkbFinishDeviceInit( DeviceIntPtr /* pXDev */ ); extern void XkbFreeSrvLedInfo( XkbSrvLedInfoPtr /* sli */ ); extern void XkbFreeInfo( XkbSrvInfoPtr /* xkbi */ ); extern Status XkbChangeTypesOfKey( XkbDescPtr /* xkb */, int /* key */, int /* nGroups */, unsigned int /* groups */, int * /* newTypesIn */, XkbMapChangesPtr /* changes */ ); extern XkbKeyTypePtr XkbAddKeyType( XkbDescPtr /* xkb */, Atom /* name */, int /* map_count */, Bool /* want_preserve */, int /* num_lvls */ ); extern Status XkbInitCanonicalKeyTypes( XkbDescPtr /* xkb */, unsigned int /* which */, int /* keypadVMod */ ); extern int XkbKeyTypesForCoreSymbols( XkbDescPtr /* xkb */, int /* map_width */, KeySym * /* core_syms */, unsigned int /* protected */, int * /* types_inout */, KeySym * /* xkb_syms_rtrn */ ); extern Bool XkbApplyCompatMapToKey( XkbDescPtr /* xkb */, KeyCode /* key */, XkbChangesPtr /* changes */ ); extern Bool XkbUpdateMapFromCore( XkbDescPtr /* xkb */, KeyCode /* first_key */, int /* num_keys */, int /* map_width */, KeySym * /* core_keysyms */, XkbChangesPtr /* changes */ ); extern void XkbFreeControls( XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeMap */ ); extern void XkbFreeIndicatorMaps( XkbDescPtr /* xkb */ ); extern Bool XkbApplyVirtualModChanges( XkbDescPtr /* xkb */, unsigned int /* changed */, XkbChangesPtr /* changes */ ); extern Bool XkbUpdateActionVirtualMods( XkbDescPtr /* xkb */, XkbAction * /* act */, unsigned int /* changed */ ); extern void XkbUpdateKeyTypeVirtualMods( XkbDescPtr /* xkb */, XkbKeyTypePtr /* type */, unsigned int /* changed */, XkbChangesPtr /* changes */ ); extern void XkbSendNewKeyboardNotify( DeviceIntPtr /* kbd */, xkbNewKeyboardNotify * /* pNKN */ ); #ifdef XKBSRV_NEED_FILE_FUNCS #include #include #include #define _XkbListKeymaps 0 #define _XkbListKeycodes 1 #define _XkbListTypes 2 #define _XkbListCompat 3 #define _XkbListSymbols 4 #define _XkbListGeometry 5 #define _XkbListNumComponents 6 typedef struct _XkbSrvListInfo { int szPool; int nPool; char * pool; int maxRtrn; int nTotal; char * pattern[_XkbListNumComponents]; int nFound[_XkbListNumComponents]; } XkbSrvListInfoRec,*XkbSrvListInfoPtr; char * XkbGetRulesDflts( XkbRF_VarDefsPtr /* defs */ ); extern void XkbSetRulesUsed( XkbRF_VarDefsPtr /* defs */ ); extern Status XkbDDXList( DeviceIntPtr /* dev */, XkbSrvListInfoPtr /* listing */, ClientPtr /* client */ ); extern unsigned int XkbDDXLoadKeymapByNames( DeviceIntPtr /* keybd */, XkbComponentNamesPtr /* names */, unsigned int /* want */, unsigned int /* need */, XkbFileInfoPtr /* finfoRtrn */, char * /* keymapNameRtrn */, int /* keymapNameRtrnLen */ ); extern Bool XkbDDXNamesFromRules( DeviceIntPtr /* keybd */, char * /* rules */, XkbRF_VarDefsPtr /* defs */, XkbComponentNamesPtr /* names */ ); extern FILE *XkbDDXOpenConfigFile( char * /* mapName */, char * /* fileNameRtrn */, int /* fileNameRtrnLen */ ); extern Bool XkbDDXApplyConfig( XPointer /* cfg_in */, XkbSrvInfoPtr /* xkbi */ ); extern XPointer XkbDDXPreloadConfig( char ** /* rulesFileRtrn */, XkbRF_VarDefsPtr /* defs */, XkbComponentNamesPtr /* names */, DeviceIntPtr /* dev */ ); extern int _XkbStrCaseCmp( char * /* str1 */, char * /* str2 */ ); #endif /* XKBSRV_NEED_FILE_FUNCS */ _XFUNCPROTOEND #define XkbAtomGetString(d,s) NameForAtom(s) #endif /* _XKBSRV_H_ */ X11/extensions/recordconst.h000064400000004027147631660250012027 0ustar00/*************************************************************************** * Copyright 1995 Network Computing Devices * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Network Computing Devices * not be used in advertising or publicity pertaining to distribution * of the software without specific, written prior permission. * * NETWORK COMPUTING DEVICES DISCLAIMs ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **************************************************************************/ #ifndef _RECORDCONST_H_ #define _RECORDCONST_H_ #define RECORD_NAME "RECORD" #define RECORD_MAJOR_VERSION 1 #define RECORD_MINOR_VERSION 13 #define RECORD_LOWEST_MAJOR_VERSION 1 #define RECORD_LOWEST_MINOR_VERSION 12 #define XRecordBadContext 0 /* Not a valid RC */ #define RecordNumErrors (XRecordBadContext + 1) #define RecordNumEvents 0L /* * Constants for arguments of various requests */ #define XRecordFromServerTime 0x01 #define XRecordFromClientTime 0x02 #define XRecordFromClientSequence 0x04 #define XRecordCurrentClients 1 #define XRecordFutureClients 2 #define XRecordAllClients 3 #define XRecordFromServer 0 #define XRecordFromClient 1 #define XRecordClientStarted 2 #define XRecordClientDied 3 #define XRecordStartOfData 4 #define XRecordEndOfData 5 #endif /* _RECORD_H_ */ X11/extensions/secur.h000064400000004135147631660250010623 0ustar00/* Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _SECUR_H #define _SECUR_H #define SECURITY_EXTENSION_NAME "SECURITY" #define SECURITY_MAJOR_VERSION 1 #define SECURITY_MINOR_VERSION 0 #define XSecurityNumberEvents 1 #define XSecurityNumberErrors 2 #define XSecurityBadAuthorization 0 #define XSecurityBadAuthorizationProtocol 1 /* trust levels */ #define XSecurityClientTrusted 0 #define XSecurityClientUntrusted 1 /* authorization attribute masks */ #define XSecurityTimeout (1<<0) #define XSecurityTrustLevel (1<<1) #define XSecurityGroup (1<<2) #define XSecurityEventMask (1<<3) #define XSecurityAllAuthorizationAttributes \ (XSecurityTimeout | XSecurityTrustLevel | XSecurityGroup | XSecurityEventMask) /* event masks */ #define XSecurityAuthorizationRevokedMask (1<<0) #define XSecurityAllEventMasks XSecurityAuthorizationRevokedMask /* event offsets */ #define XSecurityAuthorizationRevoked 0 #define XSecurityAuthorizationName "XC-QUERY-SECURITY-1" #define XSecurityAuthorizationNameLen 19 #endif /* _SECUR_H */ X11/extensions/render.h000064400000015425147631660250010765 0ustar00/* * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #ifndef _RENDER_H_ #define _RENDER_H_ #include typedef XID Glyph; typedef XID GlyphSet; typedef XID Picture; typedef XID PictFormat; #define RENDER_NAME "RENDER" #define RENDER_MAJOR 0 #define RENDER_MINOR 11 #define X_RenderQueryVersion 0 #define X_RenderQueryPictFormats 1 #define X_RenderQueryPictIndexValues 2 /* 0.7 */ #define X_RenderQueryDithers 3 #define X_RenderCreatePicture 4 #define X_RenderChangePicture 5 #define X_RenderSetPictureClipRectangles 6 #define X_RenderFreePicture 7 #define X_RenderComposite 8 #define X_RenderScale 9 #define X_RenderTrapezoids 10 #define X_RenderTriangles 11 #define X_RenderTriStrip 12 #define X_RenderTriFan 13 #define X_RenderColorTrapezoids 14 #define X_RenderColorTriangles 15 /* #define X_RenderTransform 16 */ #define X_RenderCreateGlyphSet 17 #define X_RenderReferenceGlyphSet 18 #define X_RenderFreeGlyphSet 19 #define X_RenderAddGlyphs 20 #define X_RenderAddGlyphsFromPicture 21 #define X_RenderFreeGlyphs 22 #define X_RenderCompositeGlyphs8 23 #define X_RenderCompositeGlyphs16 24 #define X_RenderCompositeGlyphs32 25 #define X_RenderFillRectangles 26 /* 0.5 */ #define X_RenderCreateCursor 27 /* 0.6 */ #define X_RenderSetPictureTransform 28 #define X_RenderQueryFilters 29 #define X_RenderSetPictureFilter 30 /* 0.8 */ #define X_RenderCreateAnimCursor 31 /* 0.9 */ #define X_RenderAddTraps 32 /* 0.10 */ #define X_RenderCreateSolidFill 33 #define X_RenderCreateLinearGradient 34 #define X_RenderCreateRadialGradient 35 #define X_RenderCreateConicalGradient 36 #define RenderNumberRequests (X_RenderCreateConicalGradient+1) #define BadPictFormat 0 #define BadPicture 1 #define BadPictOp 2 #define BadGlyphSet 3 #define BadGlyph 4 #define RenderNumberErrors (BadGlyph+1) #define PictTypeIndexed 0 #define PictTypeDirect 1 #define PictOpMinimum 0 #define PictOpClear 0 #define PictOpSrc 1 #define PictOpDst 2 #define PictOpOver 3 #define PictOpOverReverse 4 #define PictOpIn 5 #define PictOpInReverse 6 #define PictOpOut 7 #define PictOpOutReverse 8 #define PictOpAtop 9 #define PictOpAtopReverse 10 #define PictOpXor 11 #define PictOpAdd 12 #define PictOpSaturate 13 #define PictOpMaximum 13 /* * Operators only available in version 0.2 */ #define PictOpDisjointMinimum 0x10 #define PictOpDisjointClear 0x10 #define PictOpDisjointSrc 0x11 #define PictOpDisjointDst 0x12 #define PictOpDisjointOver 0x13 #define PictOpDisjointOverReverse 0x14 #define PictOpDisjointIn 0x15 #define PictOpDisjointInReverse 0x16 #define PictOpDisjointOut 0x17 #define PictOpDisjointOutReverse 0x18 #define PictOpDisjointAtop 0x19 #define PictOpDisjointAtopReverse 0x1a #define PictOpDisjointXor 0x1b #define PictOpDisjointMaximum 0x1b #define PictOpConjointMinimum 0x20 #define PictOpConjointClear 0x20 #define PictOpConjointSrc 0x21 #define PictOpConjointDst 0x22 #define PictOpConjointOver 0x23 #define PictOpConjointOverReverse 0x24 #define PictOpConjointIn 0x25 #define PictOpConjointInReverse 0x26 #define PictOpConjointOut 0x27 #define PictOpConjointOutReverse 0x28 #define PictOpConjointAtop 0x29 #define PictOpConjointAtopReverse 0x2a #define PictOpConjointXor 0x2b #define PictOpConjointMaximum 0x2b /* * Operators only available in version 0.11 */ #define PictOpBlendMinimum 0x30 #define PictOpMultiply 0x30 #define PictOpScreen 0x31 #define PictOpOverlay 0x32 #define PictOpDarken 0x33 #define PictOpLighten 0x34 #define PictOpColorDodge 0x35 #define PictOpColorBurn 0x36 #define PictOpHardLight 0x37 #define PictOpSoftLight 0x38 #define PictOpDifference 0x39 #define PictOpExclusion 0x3a #define PictOpHSLHue 0x3b #define PictOpHSLSaturation 0x3c #define PictOpHSLColor 0x3d #define PictOpHSLLuminosity 0x3e #define PictOpBlendMaximum 0x3e #define PolyEdgeSharp 0 #define PolyEdgeSmooth 1 #define PolyModePrecise 0 #define PolyModeImprecise 1 #define CPRepeat (1 << 0) #define CPAlphaMap (1 << 1) #define CPAlphaXOrigin (1 << 2) #define CPAlphaYOrigin (1 << 3) #define CPClipXOrigin (1 << 4) #define CPClipYOrigin (1 << 5) #define CPClipMask (1 << 6) #define CPGraphicsExposure (1 << 7) #define CPSubwindowMode (1 << 8) #define CPPolyEdge (1 << 9) #define CPPolyMode (1 << 10) #define CPDither (1 << 11) #define CPComponentAlpha (1 << 12) #define CPLastBit 12 /* Filters included in 0.6 */ #define FilterNearest "nearest" #define FilterBilinear "bilinear" /* Filters included in 0.10 */ #define FilterConvolution "convolution" #define FilterFast "fast" #define FilterGood "good" #define FilterBest "best" #define FilterAliasNone -1 /* Subpixel orders included in 0.6 */ #define SubPixelUnknown 0 #define SubPixelHorizontalRGB 1 #define SubPixelHorizontalBGR 2 #define SubPixelVerticalRGB 3 #define SubPixelVerticalBGR 4 #define SubPixelNone 5 /* Extended repeat attributes included in 0.10 */ #define RepeatNone 0 #define RepeatNormal 1 #define RepeatPad 2 #define RepeatReflect 3 #endif /* _RENDER_H_ */ X11/extensions/dpmsconst.h000064400000003262147631660250011514 0ustar00/***************************************************************** Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ #ifndef _DPMSCONST_H #define _DPMSCONST_H 1 #define DPMSMajorVersion 1 #define DPMSMinorVersion 1 #define DPMSExtensionName "DPMS" #define DPMSModeOn 0 #define DPMSModeStandby 1 #define DPMSModeSuspend 2 #define DPMSModeOff 3 #endif /* !_DPMSCONST_H */ X11/extensions/XI.h000064400000023137147631660250010025 0ustar00/************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* Definitions used by the server, library and client */ #ifndef _XI_H_ #define _XI_H_ #define sz_xGetExtensionVersionReq 8 #define sz_xGetExtensionVersionReply 32 #define sz_xListInputDevicesReq 4 #define sz_xListInputDevicesReply 32 #define sz_xOpenDeviceReq 8 #define sz_xOpenDeviceReply 32 #define sz_xCloseDeviceReq 8 #define sz_xSetDeviceModeReq 8 #define sz_xSetDeviceModeReply 32 #define sz_xSelectExtensionEventReq 12 #define sz_xGetSelectedExtensionEventsReq 8 #define sz_xGetSelectedExtensionEventsReply 32 #define sz_xChangeDeviceDontPropagateListReq 12 #define sz_xGetDeviceDontPropagateListReq 8 #define sz_xGetDeviceDontPropagateListReply 32 #define sz_xGetDeviceMotionEventsReq 16 #define sz_xGetDeviceMotionEventsReply 32 #define sz_xChangeKeyboardDeviceReq 8 #define sz_xChangeKeyboardDeviceReply 32 #define sz_xChangePointerDeviceReq 8 #define sz_xChangePointerDeviceReply 32 #define sz_xGrabDeviceReq 20 #define sz_xGrabDeviceReply 32 #define sz_xUngrabDeviceReq 12 #define sz_xGrabDeviceKeyReq 20 #define sz_xGrabDeviceKeyReply 32 #define sz_xUngrabDeviceKeyReq 16 #define sz_xGrabDeviceButtonReq 20 #define sz_xGrabDeviceButtonReply 32 #define sz_xUngrabDeviceButtonReq 16 #define sz_xAllowDeviceEventsReq 12 #define sz_xGetDeviceFocusReq 8 #define sz_xGetDeviceFocusReply 32 #define sz_xSetDeviceFocusReq 16 #define sz_xGetFeedbackControlReq 8 #define sz_xGetFeedbackControlReply 32 #define sz_xChangeFeedbackControlReq 12 #define sz_xGetDeviceKeyMappingReq 8 #define sz_xGetDeviceKeyMappingReply 32 #define sz_xChangeDeviceKeyMappingReq 8 #define sz_xGetDeviceModifierMappingReq 8 #define sz_xSetDeviceModifierMappingReq 8 #define sz_xSetDeviceModifierMappingReply 32 #define sz_xGetDeviceButtonMappingReq 8 #define sz_xGetDeviceButtonMappingReply 32 #define sz_xSetDeviceButtonMappingReq 8 #define sz_xSetDeviceButtonMappingReply 32 #define sz_xQueryDeviceStateReq 8 #define sz_xQueryDeviceStateReply 32 #define sz_xSendExtensionEventReq 16 #define sz_xDeviceBellReq 8 #define sz_xSetDeviceValuatorsReq 8 #define sz_xSetDeviceValuatorsReply 32 #define sz_xGetDeviceControlReq 8 #define sz_xGetDeviceControlReply 32 #define sz_xChangeDeviceControlReq 8 #define sz_xChangeDeviceControlReply 32 #define sz_xListDevicePropertiesReq 8 #define sz_xListDevicePropertiesReply 32 #define sz_xChangeDevicePropertyReq 20 #define sz_xDeleteDevicePropertyReq 12 #define sz_xGetDevicePropertyReq 24 #define sz_xGetDevicePropertyReply 32 #define INAME "XInputExtension" #define XI_KEYBOARD "KEYBOARD" #define XI_MOUSE "MOUSE" #define XI_TABLET "TABLET" #define XI_TOUCHSCREEN "TOUCHSCREEN" #define XI_TOUCHPAD "TOUCHPAD" #define XI_BARCODE "BARCODE" #define XI_BUTTONBOX "BUTTONBOX" #define XI_KNOB_BOX "KNOB_BOX" #define XI_ONE_KNOB "ONE_KNOB" #define XI_NINE_KNOB "NINE_KNOB" #define XI_TRACKBALL "TRACKBALL" #define XI_QUADRATURE "QUADRATURE" #define XI_ID_MODULE "ID_MODULE" #define XI_SPACEBALL "SPACEBALL" #define XI_DATAGLOVE "DATAGLOVE" #define XI_EYETRACKER "EYETRACKER" #define XI_CURSORKEYS "CURSORKEYS" #define XI_FOOTMOUSE "FOOTMOUSE" #define XI_JOYSTICK "JOYSTICK" /* Indices into the versions[] array (XExtInt.c). Used as a index to * retrieve the minimum version of XI from _XiCheckExtInit */ #define Dont_Check 0 #define XInput_Initial_Release 1 #define XInput_Add_XDeviceBell 2 #define XInput_Add_XSetDeviceValuators 3 #define XInput_Add_XChangeDeviceControl 4 #define XInput_Add_DevicePresenceNotify 5 #define XInput_Add_DeviceProperties 6 /* DO NOT ADD TO HERE -> XI2 */ #define XI_Absent 0 #define XI_Present 1 #define XI_Initial_Release_Major 1 #define XI_Initial_Release_Minor 0 #define XI_Add_XDeviceBell_Major 1 #define XI_Add_XDeviceBell_Minor 1 #define XI_Add_XSetDeviceValuators_Major 1 #define XI_Add_XSetDeviceValuators_Minor 2 #define XI_Add_XChangeDeviceControl_Major 1 #define XI_Add_XChangeDeviceControl_Minor 3 #define XI_Add_DevicePresenceNotify_Major 1 #define XI_Add_DevicePresenceNotify_Minor 4 #define XI_Add_DeviceProperties_Major 1 #define XI_Add_DeviceProperties_Minor 5 #define DEVICE_RESOLUTION 1 #define DEVICE_ABS_CALIB 2 #define DEVICE_CORE 3 #define DEVICE_ENABLE 4 #define DEVICE_ABS_AREA 5 #define NoSuchExtension 1 #define COUNT 0 #define CREATE 1 #define NewPointer 0 #define NewKeyboard 1 #define XPOINTER 0 #define XKEYBOARD 1 #define UseXKeyboard 0xFF #define IsXPointer 0 #define IsXKeyboard 1 #define IsXExtensionDevice 2 #define IsXExtensionKeyboard 3 #define IsXExtensionPointer 4 #define AsyncThisDevice 0 #define SyncThisDevice 1 #define ReplayThisDevice 2 #define AsyncOtherDevices 3 #define AsyncAll 4 #define SyncAll 5 #define FollowKeyboard 3 #ifndef RevertToFollowKeyboard #define RevertToFollowKeyboard 3 #endif #define DvAccelNum (1L << 0) #define DvAccelDenom (1L << 1) #define DvThreshold (1L << 2) #define DvKeyClickPercent (1L<<0) #define DvPercent (1L<<1) #define DvPitch (1L<<2) #define DvDuration (1L<<3) #define DvLed (1L<<4) #define DvLedMode (1L<<5) #define DvKey (1L<<6) #define DvAutoRepeatMode (1L<<7) #define DvString (1L << 0) #define DvInteger (1L << 0) #define DeviceMode (1L << 0) #define Relative 0 #define Absolute 1 #define ProximityState (1L << 1) #define InProximity (0L << 1) #define OutOfProximity (1L << 1) #define AddToList 0 #define DeleteFromList 1 #define KeyClass 0 #define ButtonClass 1 #define ValuatorClass 2 #define FeedbackClass 3 #define ProximityClass 4 #define FocusClass 5 #define OtherClass 6 #define AttachClass 7 #define KbdFeedbackClass 0 #define PtrFeedbackClass 1 #define StringFeedbackClass 2 #define IntegerFeedbackClass 3 #define LedFeedbackClass 4 #define BellFeedbackClass 5 #define _devicePointerMotionHint 0 #define _deviceButton1Motion 1 #define _deviceButton2Motion 2 #define _deviceButton3Motion 3 #define _deviceButton4Motion 4 #define _deviceButton5Motion 5 #define _deviceButtonMotion 6 #define _deviceButtonGrab 7 #define _deviceOwnerGrabButton 8 #define _noExtensionEvent 9 #define _devicePresence 0 #define _deviceEnter 0 #define _deviceLeave 1 /* Device presence notify states */ #define DeviceAdded 0 #define DeviceRemoved 1 #define DeviceEnabled 2 #define DeviceDisabled 3 #define DeviceUnrecoverable 4 #define DeviceControlChanged 5 /* XI Errors */ #define XI_BadDevice 0 #define XI_BadEvent 1 #define XI_BadMode 2 #define XI_DeviceBusy 3 #define XI_BadClass 4 /* * Make XEventClass be a CARD32 for 64 bit servers. Don't affect client * definition of XEventClass since that would be a library interface change. * See the top of X.h for more _XSERVER64 magic. * * But, don't actually use the CARD32 type. We can't get it defined here * without polluting the namespace. */ #ifdef _XSERVER64 typedef unsigned int XEventClass; #else typedef unsigned long XEventClass; #endif /******************************************************************* * * Extension version structure. * */ typedef struct { int present; short major_version; short minor_version; } XExtensionVersion; #endif /* _XI_H_ */ X11/extensions/multibufconst.h000064400000005017147631660250012400 0ustar00/* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _MULTIBUFCONST_H_ #define _MULTIBUFCONST_H_ #define MULTIBUFFER_PROTOCOL_NAME "Multi-Buffering" #define MULTIBUFFER_MAJOR_VERSION 1 /* current version numbers */ #define MULTIBUFFER_MINOR_VERSION 1 /* has ClearImageBufferArea */ /* * update_action field */ #define MultibufferUpdateActionUndefined 0 #define MultibufferUpdateActionBackground 1 #define MultibufferUpdateActionUntouched 2 #define MultibufferUpdateActionCopied 3 /* * update_hint field */ #define MultibufferUpdateHintFrequent 0 #define MultibufferUpdateHintIntermittent 1 #define MultibufferUpdateHintStatic 2 /* * valuemask fields */ #define MultibufferWindowUpdateHint (1L << 0) #define MultibufferBufferEventMask (1L << 0) /* * mono vs. stereo and left vs. right */ #define MultibufferModeMono 0 #define MultibufferModeStereo 1 #define MultibufferSideMono 0 #define MultibufferSideLeft 1 #define MultibufferSideRight 2 /* * clobber state */ #define MultibufferUnclobbered 0 #define MultibufferPartiallyClobbered 1 #define MultibufferFullyClobbered 2 /* * event stuff */ #define MultibufferClobberNotifyMask 0x02000000 #define MultibufferUpdateNotifyMask 0x04000000 #define MultibufferClobberNotify 0 #define MultibufferUpdateNotify 1 #define MultibufferNumberEvents (MultibufferUpdateNotify + 1) #define MultibufferBadBuffer 0 #define MultibufferNumberErrors (MultibufferBadBuffer + 1) #endif /* _MULTIBUFCONST_H_ */ X11/extensions/presenttokens.h000064400000007015147631660250012406 0ustar00/* * Copyright © 2013 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _PRESENT_TOKENS_H_ #define _PRESENT_TOKENS_H_ #define PRESENT_NAME "Present" #define PRESENT_MAJOR 1 #define PRESENT_MINOR 2 #define PresentNumberErrors 0 #define PresentNumberEvents 0 /* Requests */ #define X_PresentQueryVersion 0 #define X_PresentPixmap 1 #define X_PresentNotifyMSC 2 #define X_PresentSelectInput 3 #define X_PresentQueryCapabilities 4 #define PresentNumberRequests 5 /* Present operation options */ #define PresentOptionNone 0 #define PresentOptionAsync (1 << 0) #define PresentOptionCopy (1 << 1) #define PresentOptionUST (1 << 2) #define PresentOptionSuboptimal (1 << 3) #define PresentAllOptions (PresentOptionAsync | \ PresentOptionCopy | \ PresentOptionUST | \ PresentOptionSuboptimal) /* Present capabilities */ #define PresentCapabilityNone 0 #define PresentCapabilityAsync 1 #define PresentCapabilityFence 2 #define PresentCapabilityUST 4 #define PresentAllCapabilities (PresentCapabilityAsync | \ PresentCapabilityFence | \ PresentCapabilityUST) /* Events */ #define PresentConfigureNotify 0 #define PresentCompleteNotify 1 #define PresentIdleNotify 2 #if PRESENT_FUTURE_VERSION #define PresentRedirectNotify 3 #endif /* Event Masks */ #define PresentConfigureNotifyMask 1 #define PresentCompleteNotifyMask 2 #define PresentIdleNotifyMask 4 #if PRESENT_FUTURE_VERSION #define PresentRedirectNotifyMask 8 #endif #if PRESENT_FUTURE_VERSION #define PRESENT_REDIRECT_NOTIFY_MASK PresentRedirectNotifyMask #else #define PRESENT_REDIRECT_NOTIFY_MASK 0 #endif #define PresentAllEvents (PresentConfigureNotifyMask | \ PresentCompleteNotifyMask | \ PresentIdleNotifyMask | \ PRESENT_REDIRECT_NOTIFY_MASK) /* Complete Kinds */ #define PresentCompleteKindPixmap 0 #define PresentCompleteKindNotifyMSC 1 /* Complete Modes */ #define PresentCompleteModeCopy 0 #define PresentCompleteModeFlip 1 #define PresentCompleteModeSkip 2 #define PresentCompleteModeSuboptimalCopy 3 #endif X11/extensions/xf86vm.h000064400000004075147631660250010643 0ustar00/* Copyright 1995 Kaleb S. KEITHLEY Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Kaleb S. KEITHLEY shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Kaleb S. KEITHLEY */ /* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */ #ifndef _XF86VM_H_ #define _XF86VM_H_ #include #define CLKFLAG_PROGRAMABLE 1 #ifdef XF86VIDMODE_EVENTS #define XF86VidModeNotify 0 #define XF86VidModeNumberEvents (XF86VidModeNotify + 1) #define XF86VidModeNotifyMask 0x00000001 #define XF86VidModeNonEvent 0 #define XF86VidModeModeChange 1 #else #define XF86VidModeNumberEvents 0 #endif #define XF86VidModeBadClock 0 #define XF86VidModeBadHTimings 1 #define XF86VidModeBadVTimings 2 #define XF86VidModeModeUnsuitable 3 #define XF86VidModeExtensionDisabled 4 #define XF86VidModeClientNotLocal 5 #define XF86VidModeZoomLocked 6 #define XF86VidModeNumberErrors (XF86VidModeZoomLocked + 1) #define XF86VM_READ_PERMISSION 1 #define XF86VM_WRITE_PERMISSION 2 #endif X11/extensions/xf86vmstr.h000064400000000271147631660250011366 0ustar00#warning "xf86vmstr.h is obsolete and may be removed in the future." #warning "include for the protocol defines." #include X11/extensions/syncstr.h000064400000012753147631660250011214 0ustar00/* Copyright 1991, 1993, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /*********************************************************** Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts, and Olivetti Research Limited, Cambridge, England. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Olivetti not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef _SYNCSTR_H_ #define _SYNCSTR_H_ #include #ifdef _SYNC_SERVER #define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */ typedef struct _SyncCounter { ClientPtr client; /* Owning client. 0 for system counters */ XSyncCounter id; /* resource ID */ CARD64 value; /* counter value */ struct _SyncTriggerList *pTriglist; /* list of triggers */ Bool beingDestroyed; /* in process of going away */ struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */ } SyncCounter; /* * The System Counter interface */ typedef enum { XSyncCounterNeverChanges, XSyncCounterNeverIncreases, XSyncCounterNeverDecreases, XSyncCounterUnrestricted } SyncCounterType; typedef struct _SysCounterInfo { char *name; CARD64 resolution; CARD64 bracket_greater; CARD64 bracket_less; SyncCounterType counterType; /* how can this counter change */ void (*QueryValue)( pointer /*pCounter*/, CARD64 * /*freshvalue*/ ); void (*BracketValues)( pointer /*pCounter*/, CARD64 * /*lessthan*/, CARD64 * /*greaterthan*/ ); } SysCounterInfo; typedef struct _SyncTrigger { SyncCounter *pCounter; CARD64 wait_value; /* wait value */ unsigned int value_type; /* Absolute or Relative */ unsigned int test_type; /* transition or Comparision type */ CARD64 test_value; /* trigger event threshold value */ Bool (*CheckTrigger)( struct _SyncTrigger * /*pTrigger*/, CARD64 /*newval*/ ); void (*TriggerFired)( struct _SyncTrigger * /*pTrigger*/ ); void (*CounterDestroyed)( struct _SyncTrigger * /*pTrigger*/ ); } SyncTrigger; typedef struct _SyncTriggerList { SyncTrigger *pTrigger; struct _SyncTriggerList *next; } SyncTriggerList; typedef struct _SyncAlarmClientList { ClientPtr client; XID delete_id; struct _SyncAlarmClientList *next; } SyncAlarmClientList; typedef struct _SyncAlarm { SyncTrigger trigger; ClientPtr client; XSyncAlarm alarm_id; CARD64 delta; int events; int state; SyncAlarmClientList *pEventClients; } SyncAlarm; typedef struct { ClientPtr client; CARD32 delete_id; int num_waitconditions; } SyncAwaitHeader; typedef struct { SyncTrigger trigger; CARD64 event_threshold; SyncAwaitHeader *pHeader; } SyncAwait; typedef union { SyncAwaitHeader header; SyncAwait await; } SyncAwaitUnion; extern pointer SyncCreateSystemCounter( char * /* name */, CARD64 /* inital_value */, CARD64 /* resolution */, SyncCounterType /* change characterization */, void (* /*QueryValue*/ ) ( pointer /* pCounter */, CARD64 * /* pValue_return */), /* XXX prototype */ void (* /*BracketValues*/) ( pointer /* pCounter */, CARD64 * /* pbracket_less */, CARD64 * /* pbracket_greater */) ); extern void SyncChangeCounter( SyncCounter * /* pCounter*/, CARD64 /* new_value */ ); extern void SyncDestroySystemCounter( pointer pCounter ); extern void InitServertime(void); #endif /* _SYNC_SERVER */ #endif /* _SYNCSTR_H_ */ X11/extensions/xtestext1const.h000064400000012477147631660250012532 0ustar00/* * xtestext1.h * * X11 Input Synthesis Extension include file */ /* Copyright 1986, 1987, 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Hewlett-Packard makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. This software is not subject to any license of the American Telephone and Telegraph Company or of the Regents of the University of California. */ #ifndef _XTESTEXT1CONST_H #define _XTESTEXT1CONST_H 1 #define XTestMAX_ACTION_LIST_SIZE 64 #define XTestACTIONS_SIZE 28 /* * used in the XTestPressButton and XTestPressKey functions */ #define XTestPRESS 1 << 0 #define XTestRELEASE 1 << 1 #define XTestSTROKE 1 << 2 /* * When doing a key or button stroke, the number of milliseconds * to delay between the press and the release of a key or button * in the XTestPressButton and XTestPressKey functions. */ #define XTestSTROKE_DELAY_TIME 10 /* * used in the XTestGetInput function */ #define XTestEXCLUSIVE 1 << 0 #define XTestPACKED_ACTIONS 1 << 1 #define XTestPACKED_MOTION 1 << 2 /* * used in the XTestFakeInput function */ #define XTestFAKE_ACK_NOT_NEEDED 0 #define XTestFAKE_ACK_REQUEST 1 /* * used in the XTest extension initialization routine */ #define XTestEXTENSION_NAME "XTestExtension1" #define XTestEVENT_COUNT 2 /* * This is the definition for the format of the header byte * in the input action structures. */ #define XTestACTION_TYPE_MASK 0x03 /* bits 0 and 1 */ #define XTestKEY_STATE_MASK 0x04 /* bit 2 (key action) */ #define XTestX_SIGN_BIT_MASK 0x04 /* bit 2 (motion action) */ #define XTestY_SIGN_BIT_MASK 0x08 /* bit 3 (motion action) */ #define XTestDEVICE_ID_MASK 0xf0 /* bits 4 through 7 */ #define XTestMAX_DEVICE_ID 0x0f #define XTestPackDeviceID(x) (((x) & XTestMAX_DEVICE_ID) << 4) #define XTestUnpackDeviceID(x) (((x) & XTestDEVICE_ID_MASK) >> 4) /* * These are the possible action types. */ #define XTestDELAY_ACTION 0 #define XTestKEY_ACTION 1 #define XTestMOTION_ACTION 2 #define XTestJUMP_ACTION 3 /* * These are the definitions for key/button motion input actions. */ #define XTestKEY_UP 0x04 #define XTestKEY_DOWN 0x00 /* * These are the definitions for pointer relative motion input * actions. * * The sign bits for the x and y relative motions are contained * in the header byte. The x and y relative motions are packed * into one byte to make things fit in 32 bits. If the relative * motion range is larger than +/-15, use the pointer jump action. */ #define XTestMOTION_MAX 15 #define XTestMOTION_MIN -15 #define XTestX_NEGATIVE 0x04 #define XTestY_NEGATIVE 0x08 #define XTestX_MOTION_MASK 0x0f #define XTestY_MOTION_MASK 0xf0 #define XTestPackXMotionValue(x) ((x) & XTestX_MOTION_MASK) #define XTestPackYMotionValue(x) (((x) << 4) & XTestY_MOTION_MASK) #define XTestUnpackXMotionValue(x) ((x) & XTestX_MOTION_MASK) #define XTestUnpackYMotionValue(x) (((x) & XTestY_MOTION_MASK) >> 4) /* * These are the definitions for a long delay input action. It is * used when more than XTestSHORT_DELAY_TIME milliseconds of delay * (approximately one minute) is needed. * * The device ID for a delay is always set to XTestDELAY_DEVICE_ID. * This guarantees that a header byte with a value of 0 is not * a valid header, so it can be used as a flag to indicate that * there are no more input actions in an XTestInputAction event. */ #define XTestSHORT_DELAY_TIME 0xffff #define XTestDELAY_DEVICE_ID 0x0f #endif /* _XTESTEXT1CONST_H */ X11/extensions/xf86dga1proto.h000064400000011370147631660250012115 0ustar00/* Copyright (c) 1995 Jon Tombs Copyright (c) 1995 XFree86 Inc. */ #ifndef _XF86DGAPROTO1_H_ #define _XF86DGAPROTO1_H_ #include typedef struct _XF86DGAQueryVersion { CARD8 reqType; /* always DGAReqCode */ CARD8 dgaReqType; /* always X_DGAQueryVersion */ CARD16 length B16; } xXF86DGAQueryVersionReq; #define sz_xXF86DGAQueryVersionReq 4 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of DGA protocol */ CARD16 minorVersion B16; /* minor version of DGA protocol */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86DGAQueryVersionReply; #define sz_xXF86DGAQueryVersionReply 32 typedef struct _XF86DGAGetVideoLL { CARD8 reqType; /* always DGAReqCode */ CARD8 dgaReqType; /* always X_XF86DGAGetVideoLL */ CARD16 length B16; CARD16 screen B16; CARD16 pad B16; } xXF86DGAGetVideoLLReq; #define sz_xXF86DGAGetVideoLLReq 8 typedef struct _XF86DGAInstallColormap{ CARD8 reqType; CARD8 dgaReqType; CARD16 length B16; CARD16 screen B16; CARD16 pad2; CARD32 id B32; /* colormap. */ } xXF86DGAInstallColormapReq; #define sz_xXF86DGAInstallColormapReq 12 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 offset B32; CARD32 width B32; CARD32 bank_size B32; CARD32 ram_size B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXF86DGAGetVideoLLReply; #define sz_xXF86DGAGetVideoLLReply 32 typedef struct _XF86DGADirectVideo { CARD8 reqType; /* always DGAReqCode */ CARD8 dgaReqType; /* always X_XF86DGADirectVideo */ CARD16 length B16; CARD16 screen B16; CARD16 enable B16; } xXF86DGADirectVideoReq; #define sz_xXF86DGADirectVideoReq 8 typedef struct _XF86DGAGetViewPortSize { CARD8 reqType; /* always DGAReqCode */ CARD8 dgaReqType; /* always X_XF86DGAGetViewPort */ CARD16 length B16; CARD16 screen B16; CARD16 pad B16; } xXF86DGAGetViewPortSizeReq; #define sz_xXF86DGAGetViewPortSizeReq 8 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 width B32; CARD32 height B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXF86DGAGetViewPortSizeReply; #define sz_xXF86DGAGetViewPortSizeReply 32 typedef struct _XF86DGASetViewPort { CARD8 reqType; /* always DGAReqCode */ CARD8 dgaReqType; /* always X_XF86DGASetViewPort */ CARD16 length B16; CARD16 screen B16; CARD16 pad B16; CARD32 x B32; CARD32 y B32; } xXF86DGASetViewPortReq; #define sz_xXF86DGASetViewPortReq 16 typedef struct _XF86DGAGetVidPage { CARD8 reqType; /* always DGAReqCode */ CARD8 dgaReqType; /* always X_XF86DGAGetVidPage */ CARD16 length B16; CARD16 screen B16; CARD16 pad B16; } xXF86DGAGetVidPageReq; #define sz_xXF86DGAGetVidPageReq 8 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 vpage B32; CARD32 pad B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXF86DGAGetVidPageReply; #define sz_xXF86DGAGetVidPageReply 32 typedef struct _XF86DGASetVidPage { CARD8 reqType; /* always DGAReqCode */ CARD8 dgaReqType; /* always X_XF86DGASetVidPage */ CARD16 length B16; CARD16 screen B16; CARD16 vpage B16; } xXF86DGASetVidPageReq; #define sz_xXF86DGASetVidPageReq 8 typedef struct _XF86DGAQueryDirectVideo { CARD8 reqType; /* always DGAReqCode */ CARD8 dgaReqType; /* always X_DGAQueryVersion */ CARD16 length B16; CARD16 screen B16; CARD16 pad B16; } xXF86DGAQueryDirectVideoReq; #define sz_xXF86DGAQueryDirectVideoReq 8 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 flags B32; CARD32 pad B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXF86DGAQueryDirectVideoReply; #define sz_xXF86DGAQueryDirectVideoReply 32 typedef struct _XF86DGAViewPortChanged { CARD8 reqType; /* always DGAReqCode */ CARD8 dgaReqType; /* always X_DGAQueryVersion */ CARD16 length B16; CARD16 screen B16; CARD16 n B16; } xXF86DGAViewPortChangedReq; #define sz_xXF86DGAViewPortChangedReq 8 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 result B32; CARD32 pad B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXF86DGAViewPortChangedReply; #define sz_xXF86DGAViewPortChangedReply 32 #endif /* _XF86DGAPROTO1_H_ */ X11/extensions/shmstr.h000064400000004113147631660250011016 0ustar00/************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ********************************************************/ /* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */ #ifndef _SHMSTR_H_ #define _SHMSTR_H_ #include #ifdef _XSHM_SERVER_ #define XSHM_PUT_IMAGE_ARGS \ DrawablePtr /* dst */, \ GCPtr /* pGC */, \ int /* depth */, \ unsigned int /* format */, \ int /* w */, \ int /* h */, \ int /* sx */, \ int /* sy */, \ int /* sw */, \ int /* sh */, \ int /* dx */, \ int /* dy */, \ char * /* data */ #define XSHM_CREATE_PIXMAP_ARGS \ ScreenPtr /* pScreen */, \ int /* width */, \ int /* height */, \ int /* depth */, \ char * /* addr */ typedef struct _ShmFuncs { PixmapPtr (* CreatePixmap)(XSHM_CREATE_PIXMAP_ARGS); void (* PutImage)(XSHM_PUT_IMAGE_ARGS); } ShmFuncs, *ShmFuncsPtr; #endif #endif /* _SHMSTR_H_ */ X11/extensions/damagewire.h000064400000003545147631660250011613 0ustar00/* * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _DAMAGEWIRE_H_ #define _DAMAGEWIRE_H_ #define DAMAGE_NAME "DAMAGE" #define DAMAGE_MAJOR 1 #define DAMAGE_MINOR 1 /************* Version 1 ****************/ /* Constants */ #define XDamageReportRawRectangles 0 #define XDamageReportDeltaRectangles 1 #define XDamageReportBoundingBox 2 #define XDamageReportNonEmpty 3 /* Requests */ #define X_DamageQueryVersion 0 #define X_DamageCreate 1 #define X_DamageDestroy 2 #define X_DamageSubtract 3 #define X_DamageAdd 4 #define XDamageNumberRequests (X_DamageAdd + 1) /* Events */ #define XDamageNotify 0 #define XDamageNumberEvents (XDamageNotify + 1) /* Errors */ #define BadDamage 0 #define XDamageNumberErrors (BadDamage + 1) #endif /* _DAMAGEWIRE_H_ */ X11/extensions/xf86dgaproto.h000064400000017063147631660250012041 0ustar00/* Copyright (c) 1995 Jon Tombs Copyright (c) 1995 XFree86 Inc. */ #ifndef _XF86DGAPROTO_H_ #define _XF86DGAPROTO_H_ #include #include #define XF86DGANAME "XFree86-DGA" #define XDGA_MAJOR_VERSION 2 /* current version numbers */ #define XDGA_MINOR_VERSION 0 typedef struct _XDGAQueryVersion { CARD8 reqType; /* always DGAReqCode */ CARD8 dgaReqType; /* always X_DGAQueryVersion */ CARD16 length B16; } xXDGAQueryVersionReq; #define sz_xXDGAQueryVersionReq 4 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of DGA protocol */ CARD16 minorVersion B16; /* minor version of DGA protocol */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXDGAQueryVersionReply; #define sz_xXDGAQueryVersionReply 32 typedef struct _XDGAQueryModes { CARD8 reqType; CARD8 dgaReqType; CARD16 length B16; CARD32 screen B32; } xXDGAQueryModesReq; #define sz_xXDGAQueryModesReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 number B32; /* number of modes available */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXDGAQueryModesReply; #define sz_xXDGAQueryModesReply 32 typedef struct _XDGASetMode { CARD8 reqType; CARD8 dgaReqType; CARD16 length B16; CARD32 screen B32; CARD32 mode B32; /* mode number to init */ CARD32 pid B32; /* Pixmap descriptor */ } xXDGASetModeReq; #define sz_xXDGASetModeReq 16 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 offset B32; /* offset into framebuffer map */ CARD32 flags B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXDGASetModeReply; #define sz_xXDGASetModeReply 32 typedef struct { CARD8 byte_order; CARD8 depth; CARD16 num B16; CARD16 bpp B16; CARD16 name_size B16; CARD32 vsync_num B32; CARD32 vsync_den B32; CARD32 flags B32; CARD16 image_width B16; CARD16 image_height B16; CARD16 pixmap_width B16; CARD16 pixmap_height B16; CARD32 bytes_per_scanline B32; CARD32 red_mask B32; CARD32 green_mask B32; CARD32 blue_mask B32; CARD16 visual_class B16; CARD16 pad1 B16; CARD16 viewport_width B16; CARD16 viewport_height B16; CARD16 viewport_xstep B16; CARD16 viewport_ystep B16; CARD16 viewport_xmax B16; CARD16 viewport_ymax B16; CARD32 viewport_flags B32; CARD32 reserved1 B32; CARD32 reserved2 B32; } xXDGAModeInfo; #define sz_xXDGAModeInfo 72 typedef struct _XDGAOpenFramebuffer { CARD8 reqType; CARD8 dgaReqType; CARD16 length B16; CARD32 screen B32; } xXDGAOpenFramebufferReq; #define sz_xXDGAOpenFramebufferReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* device name size if there is one */ CARD32 mem1 B32; /* physical memory */ CARD32 mem2 B32; /* spillover for _alpha_ */ CARD32 size B32; /* size of map in bytes */ CARD32 offset B32; /* optional offset into device */ CARD32 extra B32; /* extra info associated with the map */ CARD32 pad2 B32; } xXDGAOpenFramebufferReply; #define sz_xXDGAOpenFramebufferReply 32 typedef struct _XDGACloseFramebuffer { CARD8 reqType; CARD8 dgaReqType; CARD16 length B16; CARD32 screen B32; } xXDGACloseFramebufferReq; #define sz_xXDGACloseFramebufferReq 8 typedef struct _XDGASetViewport { CARD8 reqType; CARD8 dgaReqType; CARD16 length B16; CARD32 screen B32; CARD16 x B16; CARD16 y B16; CARD32 flags B32; } xXDGASetViewportReq; #define sz_xXDGASetViewportReq 16 typedef struct _XDGAInstallColormap { CARD8 reqType; CARD8 dgaReqType; CARD16 length B16; CARD32 screen B32; CARD32 cmap B32; } xXDGAInstallColormapReq; #define sz_xXDGAInstallColormapReq 12 typedef struct _XDGASelectInput { CARD8 reqType; CARD8 dgaReqType; CARD16 length B16; CARD32 screen B32; CARD32 mask B32; } xXDGASelectInputReq; #define sz_xXDGASelectInputReq 12 typedef struct _XDGAFillRectangle { CARD8 reqType; CARD8 dgaReqType; CARD16 length B16; CARD32 screen B32; CARD16 x B16; CARD16 y B16; CARD16 width B16; CARD16 height B16; CARD32 color B32; } xXDGAFillRectangleReq; #define sz_xXDGAFillRectangleReq 20 typedef struct _XDGACopyArea { CARD8 reqType; CARD8 dgaReqType; CARD16 length B16; CARD32 screen B32; CARD16 srcx B16; CARD16 srcy B16; CARD16 width B16; CARD16 height B16; CARD16 dstx B16; CARD16 dsty B16; } xXDGACopyAreaReq; #define sz_xXDGACopyAreaReq 20 typedef struct _XDGACopyTransparentArea { CARD8 reqType; CARD8 dgaReqType; CARD16 length B16; CARD32 screen B32; CARD16 srcx B16; CARD16 srcy B16; CARD16 width B16; CARD16 height B16; CARD16 dstx B16; CARD16 dsty B16; CARD32 key B32; } xXDGACopyTransparentAreaReq; #define sz_xXDGACopyTransparentAreaReq 24 typedef struct _XDGAGetViewportStatus { CARD8 reqType; CARD8 dgaReqType; CARD16 length B16; CARD32 screen B32; } xXDGAGetViewportStatusReq; #define sz_xXDGAGetViewportStatusReq 8 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 status B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXDGAGetViewportStatusReply; #define sz_xXDGAGetViewportStatusReply 32 typedef struct _XDGASync { CARD8 reqType; CARD8 dgaReqType; CARD16 length B16; CARD32 screen B32; } xXDGASyncReq; #define sz_xXDGASyncReq 8 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xXDGASyncReply; #define sz_xXDGASyncReply 32 typedef struct _XDGASetClientVersion { CARD8 reqType; CARD8 dgaReqType; CARD16 length B16; CARD16 major B16; CARD16 minor B16; } xXDGASetClientVersionReq; #define sz_xXDGASetClientVersionReq 8 typedef struct { CARD8 reqType; CARD8 dgaReqType; CARD16 length B16; CARD32 screen B32; CARD16 x B16; CARD16 y B16; CARD32 flags B32; } xXDGAChangePixmapModeReq; #define sz_xXDGAChangePixmapModeReq 16 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 x B16; CARD16 y B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xXDGAChangePixmapModeReply; #define sz_xXDGAChangePixmapModeReply 32 typedef struct _XDGACreateColormap { CARD8 reqType; CARD8 dgaReqType; CARD16 length B16; CARD32 screen B32; CARD32 id B32; CARD32 mode B32; CARD8 alloc; CARD8 pad1; CARD16 pad2; } xXDGACreateColormapReq; #define sz_xXDGACreateColormapReq 20 typedef struct { union { struct { BYTE type; BYTE detail; CARD16 sequenceNumber B16; } u; struct { CARD32 pad0 B32; CARD32 time B32; INT16 dx B16; INT16 dy B16; INT16 screen B16; CARD16 state B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } event; } u; } dgaEvent; #endif /* _XF86DGAPROTO_H_ */ X11/extensions/dpmsproto.h000064400000011432147631660250011527 0ustar00/***************************************************************** Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ #ifndef _DPMSPROTO_H_ #define _DPMSPROTO_H_ #include #define X_DPMSGetVersion 0 #define X_DPMSCapable 1 #define X_DPMSGetTimeouts 2 #define X_DPMSSetTimeouts 3 #define X_DPMSEnable 4 #define X_DPMSDisable 5 #define X_DPMSForceLevel 6 #define X_DPMSInfo 7 #define DPMSNumberEvents 0 #define DPMSNumberErrors 0 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSGetVersion */ CARD16 length B16; CARD16 majorVersion B16; CARD16 minorVersion B16; } xDPMSGetVersionReq; #define sz_xDPMSGetVersionReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; CARD16 minorVersion B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xDPMSGetVersionReply; #define sz_xDPMSGetVersionReply 32 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSCapable */ CARD16 length B16; } xDPMSCapableReq; #define sz_xDPMSCapableReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; BOOL capable; CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xDPMSCapableReply; #define sz_xDPMSCapableReply 32 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSGetTimeouts */ CARD16 length B16; } xDPMSGetTimeoutsReq; #define sz_xDPMSGetTimeoutsReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 standby B16; CARD16 suspend B16; CARD16 off B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xDPMSGetTimeoutsReply; #define sz_xDPMSGetTimeoutsReply 32 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSSetTimeouts */ CARD16 length B16; CARD16 standby B16; CARD16 suspend B16; CARD16 off B16; CARD16 pad0 B16; } xDPMSSetTimeoutsReq; #define sz_xDPMSSetTimeoutsReq 12 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSEnable */ CARD16 length B16; } xDPMSEnableReq; #define sz_xDPMSEnableReq 4 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSDisable */ CARD16 length B16; } xDPMSDisableReq; #define sz_xDPMSDisableReq 4 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSForceLevel */ CARD16 length B16; CARD16 level B16; /* power level requested */ CARD16 pad0 B16; } xDPMSForceLevelReq; #define sz_xDPMSForceLevelReq 8 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSInfo */ CARD16 length B16; } xDPMSInfoReq; #define sz_xDPMSInfoReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 power_level B16; BOOL state; CARD8 pad1; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xDPMSInfoReply; #define sz_xDPMSInfoReply 32 #endif /* _DPMSPROTO_H_ */ X11/extensions/xf86mscstr.h000064400000014555147631660250011540 0ustar00/* $XFree86: xc/include/extensions/xf86mscstr.h,v 3.12 2002/11/20 04:04:56 dawes Exp $ */ /* * Copyright (c) 1995, 1996 The XFree86 Project, Inc */ /* THIS IS NOT AN X CONSORTIUM STANDARD */ #ifndef _XF86MISCSTR_H_ #define _XF86MISCSTR_H_ #include #define XF86MISCNAME "XFree86-Misc" #define XF86MISC_MAJOR_VERSION 0 /* current version numbers */ #define XF86MISC_MINOR_VERSION 9 typedef struct _XF86MiscQueryVersion { CARD8 reqType; /* always XF86MiscReqCode */ CARD8 xf86miscReqType; /* always X_XF86MiscQueryVersion */ CARD16 length B16; } xXF86MiscQueryVersionReq; #define sz_xXF86MiscQueryVersionReq 4 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of XFree86-Misc */ CARD16 minorVersion B16; /* minor version of XFree86-Misc */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86MiscQueryVersionReply; #define sz_xXF86MiscQueryVersionReply 32 #ifdef _XF86MISC_SAVER_COMPAT_ typedef struct _XF86MiscGetSaver { CARD8 reqType; /* always XF86MiscReqCode */ CARD8 xf86miscReqType; /* always X_XF86MiscGetSaver */ CARD16 length B16; CARD16 screen B16; CARD16 pad B16; } xXF86MiscGetSaverReq; #define sz_xXF86MiscGetSaverReq 8 typedef struct _XF86MiscSetSaver { CARD8 reqType; /* always XF86MiscReqCode */ CARD8 xf86miscReqType; /* always X_XF86MiscSetSaver */ CARD16 length B16; CARD16 screen B16; CARD16 pad B16; CARD32 suspendTime B32; CARD32 offTime B32; } xXF86MiscSetSaverReq; #define sz_xXF86MiscSetSaverReq 16 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 suspendTime B32; CARD32 offTime B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXF86MiscGetSaverReply; #define sz_xXF86MiscGetSaverReply 32 #endif typedef struct _XF86MiscGetMouseSettings { CARD8 reqType; /* always XF86MiscReqCode */ CARD8 xf86miscReqType; /* always X_XF86MiscGetMouseSettings */ CARD16 length B16; } xXF86MiscGetMouseSettingsReq; #define sz_xXF86MiscGetMouseSettingsReq 4 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 mousetype B32; CARD32 baudrate B32; CARD32 samplerate B32; CARD32 resolution B32; CARD32 buttons B32; BOOL emulate3buttons; BOOL chordmiddle; CARD16 pad2 B16; CARD32 emulate3timeout B32; CARD32 flags B32; CARD32 devnamelen B32; /* strlen(device)+1 */ } xXF86MiscGetMouseSettingsReply; #define sz_xXF86MiscGetMouseSettingsReply 44 typedef struct _XF86MiscGetKbdSettings { CARD8 reqType; /* always XF86MiscReqCode */ CARD8 xf86miscReqType; /* always X_XF86MiscGetKbdSettings */ CARD16 length B16; } xXF86MiscGetKbdSettingsReq; #define sz_xXF86MiscGetKbdSettingsReq 4 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 kbdtype B32; CARD32 rate B32; CARD32 delay B32; BOOL servnumlock; BOOL pad2; CARD16 pad3 B16; CARD32 pad4 B32; CARD32 pad5 B32; } xXF86MiscGetKbdSettingsReply; #define sz_xXF86MiscGetKbdSettingsReply 32 typedef struct _XF86MiscSetMouseSettings { CARD8 reqType; /* always XF86MiscReqCode */ CARD8 xf86miscReqType; /* always X_XF86MiscSetMouseSettings */ CARD16 length B16; CARD32 mousetype B32; CARD32 baudrate B32; CARD32 samplerate B32; CARD32 resolution B32; CARD32 buttons B32; BOOL emulate3buttons; BOOL chordmiddle; CARD16 devnamelen B16; CARD32 emulate3timeout B32; CARD32 flags B32; } xXF86MiscSetMouseSettingsReq; #define sz_xXF86MiscSetMouseSettingsReq 36 typedef struct _XF86MiscSetKbdSettings { CARD8 reqType; /* always XF86MiscReqCode */ CARD8 xf86miscReqType; /* always X_XF86MiscSetKbdSettings */ CARD16 length B16; CARD32 kbdtype B32; CARD32 rate B32; CARD32 delay B32; BOOL servnumlock; BOOL pad1; CARD16 pad2 B16; } xXF86MiscSetKbdSettingsReq; #define sz_xXF86MiscSetKbdSettingsReq 20 typedef struct _XF86MiscSetGrabKeysState { CARD8 reqType; /* always XF86MiscReqCode */ CARD8 xf86miscReqType; /* always X_XF86MiscSetKbdSettings */ CARD16 length B16; BOOL enable; BOOL pad1; CARD16 pad2 B16; } xXF86MiscSetGrabKeysStateReq; #define sz_xXF86MiscSetGrabKeysStateReq 8 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 status B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86MiscSetGrabKeysStateReply; #define sz_xXF86MiscSetGrabKeysStateReply 32 typedef struct _XF86MiscSetClientVersion { CARD8 reqType; /* always XF86MiscReqCode */ CARD8 xf86miscReqType; CARD16 length B16; CARD16 major B16; CARD16 minor B16; } xXF86MiscSetClientVersionReq; #define sz_xXF86MiscSetClientVersionReq 8 typedef struct _XF86MiscGetFilePaths { CARD8 reqType; /* always XF86MiscReqCode */ CARD8 xf86miscReqType; /* always X_XF86MiscGetFilePaths */ CARD16 length B16; } xXF86MiscGetFilePathsReq; #define sz_xXF86MiscGetFilePathsReq 4 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 configlen B16; CARD16 modulelen B16; CARD16 loglen B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86MiscGetFilePathsReply; #define sz_xXF86MiscGetFilePathsReply 32 typedef struct _XF86MiscPassMessage { CARD8 reqType; /* always XF86MiscReqCode */ CARD8 xf86miscReqType; /* always X_XF86MiscPassMessage */ CARD16 length B16; CARD16 typelen B16; CARD16 vallen B16; CARD16 screen B16; CARD16 pad B16; } xXF86MiscPassMessageReq; #define sz_xXF86MiscPassMessageReq 12 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 mesglen B16; CARD16 pad2 B16; CARD32 status B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86MiscPassMessageReply; #define sz_xXF86MiscPassMessageReply 32 #endif /* _XF86MISCSTR_H_ */ X11/extensions/XvMC.h000064400000007044147631660250010321 0ustar00#ifndef _XVMC_H_ #define _XVMC_H_ #include #include #define XvMCName "XVideo-MotionCompensation" #define XvMCNumEvents 0 #define XvMCNumErrors 3 #define XvMCVersion 1 #define XvMCRevision 1 #define XvMCBadContext 0 #define XvMCBadSurface 1 #define XvMCBadSubpicture 2 /* Chroma formats */ #define XVMC_CHROMA_FORMAT_420 0x00000001 #define XVMC_CHROMA_FORMAT_422 0x00000002 #define XVMC_CHROMA_FORMAT_444 0x00000003 /* XvMCSurfaceInfo Flags */ #define XVMC_OVERLAID_SURFACE 0x00000001 #define XVMC_BACKEND_SUBPICTURE 0x00000002 #define XVMC_SUBPICTURE_INDEPENDENT_SCALING 0x00000004 #define XVMC_INTRA_UNSIGNED 0x00000008 /* Motion Compensation types */ #define XVMC_MOCOMP 0x00000000 #define XVMC_IDCT 0x00010000 #define XVMC_MPEG_1 0x00000001 #define XVMC_MPEG_2 0x00000002 #define XVMC_H263 0x00000003 #define XVMC_MPEG_4 0x00000004 #define XVMC_MB_TYPE_MOTION_FORWARD 0x02 #define XVMC_MB_TYPE_MOTION_BACKWARD 0x04 #define XVMC_MB_TYPE_PATTERN 0x08 #define XVMC_MB_TYPE_INTRA 0x10 #define XVMC_PREDICTION_FIELD 0x01 #define XVMC_PREDICTION_FRAME 0x02 #define XVMC_PREDICTION_DUAL_PRIME 0x03 #define XVMC_PREDICTION_16x8 0x02 #define XVMC_PREDICTION_4MV 0x04 #define XVMC_SELECT_FIRST_FORWARD 0x01 #define XVMC_SELECT_FIRST_BACKWARD 0x02 #define XVMC_SELECT_SECOND_FORWARD 0x04 #define XVMC_SELECT_SECOND_BACKWARD 0x08 #define XVMC_DCT_TYPE_FRAME 0x00 #define XVMC_DCT_TYPE_FIELD 0x01 #define XVMC_TOP_FIELD 0x00000001 #define XVMC_BOTTOM_FIELD 0x00000002 #define XVMC_FRAME_PICTURE (XVMC_TOP_FIELD | XVMC_BOTTOM_FIELD) #define XVMC_SECOND_FIELD 0x00000004 #define XVMC_DIRECT 0x00000001 #define XVMC_RENDERING 0x00000001 #define XVMC_DISPLAYING 0x00000002 typedef struct { int surface_type_id; int chroma_format; unsigned short max_width; unsigned short max_height; unsigned short subpicture_max_width; unsigned short subpicture_max_height; int mc_type; int flags; } XvMCSurfaceInfo; typedef struct { XID context_id; int surface_type_id; unsigned short width; unsigned short height; XvPortID port; int flags; void * privData; /* private to the library */ } XvMCContext; typedef struct { XID surface_id; XID context_id; int surface_type_id; unsigned short width; unsigned short height; void *privData; /* private to the library */ } XvMCSurface; typedef struct { XID subpicture_id; XID context_id; int xvimage_id; unsigned short width; unsigned short height; int num_palette_entries; int entry_bytes; char component_order[4]; void *privData; /* private to the library */ } XvMCSubpicture; typedef struct { unsigned int num_blocks; XID context_id; void *privData; short *blocks; } XvMCBlockArray; typedef struct { unsigned short x; unsigned short y; unsigned char macroblock_type; unsigned char motion_type; unsigned char motion_vertical_field_select; unsigned char dct_type; short PMV[2][2][2]; unsigned int index; unsigned short coded_block_pattern; unsigned short pad0; } XvMCMacroBlock; typedef struct { unsigned int num_blocks; XID context_id; void *privData; XvMCMacroBlock *macro_blocks; } XvMCMacroBlockArray; #endif X11/extensions/bigreqstr.h000064400000000273147631660250011503 0ustar00#warning "bigreqstr.h is obsolete and may be removed in the future." #warning "include for the protocol defines." #include X11/extensions/dri3proto.h000064400000014531147631660250011430 0ustar00/* * Copyright © 2013 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _DRI3_PROTO_H_ #define _DRI3_PROTO_H_ #define DRI3_NAME "DRI3" #define DRI3_MAJOR 1 #define DRI3_MINOR 2 #define DRI3NumberErrors 0 #define DRI3NumberEvents 0 #define X_DRI3QueryVersion 0 #define X_DRI3Open 1 #define X_DRI3PixmapFromBuffer 2 #define X_DRI3BufferFromPixmap 3 #define X_DRI3FenceFromFD 4 #define X_DRI3FDFromFence 5 /* v1.2 */ #define xDRI3GetSupportedModifiers 6 #define xDRI3PixmapFromBuffers 7 #define xDRI3BuffersFromPixmap 8 #define DRI3NumberRequests 9 typedef struct { CARD8 reqType; CARD8 dri3ReqType; CARD16 length B16; CARD32 majorVersion B32; CARD32 minorVersion B32; } xDRI3QueryVersionReq; #define sz_xDRI3QueryVersionReq 12 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 majorVersion B32; CARD32 minorVersion B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xDRI3QueryVersionReply; #define sz_xDRI3QueryVersionReply 32 typedef struct { CARD8 reqType; CARD8 dri3ReqType; CARD16 length B16; CARD32 drawable B32; CARD32 provider B32; } xDRI3OpenReq; #define sz_xDRI3OpenReq 12 typedef struct { BYTE type; /* X_Reply */ CARD8 nfd; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xDRI3OpenReply; #define sz_xDRI3OpenReply 32 typedef struct { CARD8 reqType; CARD8 dri3ReqType; CARD16 length B16; CARD32 pixmap B32; CARD32 drawable B32; CARD32 size B32; CARD16 width B16; CARD16 height B16; CARD16 stride B16; CARD8 depth; CARD8 bpp; } xDRI3PixmapFromBufferReq; #define sz_xDRI3PixmapFromBufferReq 24 typedef struct { CARD8 reqType; CARD8 dri3ReqType; CARD16 length B16; CARD32 pixmap B32; } xDRI3BufferFromPixmapReq; #define sz_xDRI3BufferFromPixmapReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 nfd; /* Number of file descriptors returned (1) */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 size B32; CARD16 width B16; CARD16 height B16; CARD16 stride B16; CARD8 depth; CARD8 bpp; CARD32 pad20 B32; CARD32 pad24 B32; CARD32 pad28 B32; } xDRI3BufferFromPixmapReply; #define sz_xDRI3BufferFromPixmapReply 32 typedef struct { CARD8 reqType; CARD8 dri3ReqType; CARD16 length B16; CARD32 drawable B32; CARD32 fence B32; BOOL initially_triggered; CARD8 pad13; CARD16 pad14 B16; } xDRI3FenceFromFDReq; #define sz_xDRI3FenceFromFDReq 16 typedef struct { CARD8 reqType; CARD8 dri3ReqType; CARD16 length B16; CARD32 drawable B32; CARD32 fence B32; } xDRI3FDFromFenceReq; #define sz_xDRI3FDFromFenceReq 12 typedef struct { BYTE type; /* X_Reply */ CARD8 nfd; /* Number of file descriptors returned (1) */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad08 B32; CARD32 pad12 B32; CARD32 pad16 B32; CARD32 pad20 B32; CARD32 pad24 B32; CARD32 pad28 B32; } xDRI3FDFromFenceReply; #define sz_xDRI3FDFromFenceReply 32 /* v1.2 */ typedef struct { CARD8 reqType; CARD8 dri3ReqType; CARD16 length B16; CARD32 window B32; CARD8 depth; CARD8 bpp; CARD16 pad10 B16; } xDRI3GetSupportedModifiersReq; #define sz_xDRI3GetSupportedModifiersReq 12 typedef struct { BYTE type; /* X_Reply */ CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 numWindowModifiers B32; CARD32 numScreenModifiers B32; CARD32 pad16 B32; CARD32 pad20 B32; CARD32 pad24 B32; CARD32 pad28 B32; } xDRI3GetSupportedModifiersReply; #define sz_xDRI3GetSupportedModifiersReply 32 typedef struct { CARD8 reqType; CARD8 dri3ReqType; CARD16 length B16; CARD32 pixmap B32; CARD32 window B32; CARD8 num_buffers; /* Number of file descriptors passed */ CARD8 pad13; CARD16 pad14 B16; CARD16 width B16; CARD16 height B16; CARD32 stride0 B32; CARD32 offset0 B32; CARD32 stride1 B32; CARD32 offset1 B32; CARD32 stride2 B32; CARD32 offset2 B32; CARD32 stride3 B32; CARD32 offset3 B32; CARD8 depth; CARD8 bpp; CARD16 pad54 B16; CARD64 modifier; } xDRI3PixmapFromBuffersReq; #define sz_xDRI3PixmapFromBuffersReq 64 typedef struct { CARD8 reqType; CARD8 dri3ReqType; CARD16 length B16; CARD32 pixmap B32; } xDRI3BuffersFromPixmapReq; #define sz_xDRI3BuffersFromPixmapReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 nfd; /* Number of file descriptors returned */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 width B16; CARD16 height B16; CARD32 pad12 B32; CARD64 modifier; CARD8 depth; CARD8 bpp; CARD16 pad26 B16; CARD32 pad28 B32; } xDRI3BuffersFromPixmapReply; #define sz_xDRI3BuffersFromPixmapReply 32 #endif X11/extensions/composite.h000064400000006072147631660250011506 0ustar00/* * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /* * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _COMPOSITE_H_ #define _COMPOSITE_H_ #include #define COMPOSITE_NAME "Composite" #define COMPOSITE_MAJOR 0 #define COMPOSITE_MINOR 4 #define CompositeRedirectAutomatic 0 #define CompositeRedirectManual 1 #define X_CompositeQueryVersion 0 #define X_CompositeRedirectWindow 1 #define X_CompositeRedirectSubwindows 2 #define X_CompositeUnredirectWindow 3 #define X_CompositeUnredirectSubwindows 4 #define X_CompositeCreateRegionFromBorderClip 5 #define X_CompositeNameWindowPixmap 6 #define X_CompositeGetOverlayWindow 7 #define X_CompositeReleaseOverlayWindow 8 #define CompositeNumberRequests (X_CompositeReleaseOverlayWindow + 1) #define CompositeNumberEvents 0 #endif /* _COMPOSITE_H_ */ X11/extensions/XKB.h000064400000067121147631660250010132 0ustar00/************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XKB_H_ #define _XKB_H_ /* * XKB request codes, used in: * - xkbReqType field of all requests * - requestMinor field of some events */ #define X_kbUseExtension 0 #define X_kbSelectEvents 1 #define X_kbBell 3 #define X_kbGetState 4 #define X_kbLatchLockState 5 #define X_kbGetControls 6 #define X_kbSetControls 7 #define X_kbGetMap 8 #define X_kbSetMap 9 #define X_kbGetCompatMap 10 #define X_kbSetCompatMap 11 #define X_kbGetIndicatorState 12 #define X_kbGetIndicatorMap 13 #define X_kbSetIndicatorMap 14 #define X_kbGetNamedIndicator 15 #define X_kbSetNamedIndicator 16 #define X_kbGetNames 17 #define X_kbSetNames 18 #define X_kbGetGeometry 19 #define X_kbSetGeometry 20 #define X_kbPerClientFlags 21 #define X_kbListComponents 22 #define X_kbGetKbdByName 23 #define X_kbGetDeviceInfo 24 #define X_kbSetDeviceInfo 25 #define X_kbSetDebuggingFlags 101 /* * In the X sense, XKB reports only one event. * The type field of all XKB events is XkbEventCode */ #define XkbEventCode 0 #define XkbNumberEvents (XkbEventCode+1) /* * XKB has a minor event code so it can use one X event code for * multiple purposes. * - reported in the xkbType field of all XKB events. * - XkbSelectEventDetails: Indicates the event for which event details * are being changed */ #define XkbNewKeyboardNotify 0 #define XkbMapNotify 1 #define XkbStateNotify 2 #define XkbControlsNotify 3 #define XkbIndicatorStateNotify 4 #define XkbIndicatorMapNotify 5 #define XkbNamesNotify 6 #define XkbCompatMapNotify 7 #define XkbBellNotify 8 #define XkbActionMessage 9 #define XkbAccessXNotify 10 #define XkbExtensionDeviceNotify 11 /* * Event Mask: * - XkbSelectEvents: Specifies event interest. */ #define XkbNewKeyboardNotifyMask (1L << 0) #define XkbMapNotifyMask (1L << 1) #define XkbStateNotifyMask (1L << 2) #define XkbControlsNotifyMask (1L << 3) #define XkbIndicatorStateNotifyMask (1L << 4) #define XkbIndicatorMapNotifyMask (1L << 5) #define XkbNamesNotifyMask (1L << 6) #define XkbCompatMapNotifyMask (1L << 7) #define XkbBellNotifyMask (1L << 8) #define XkbActionMessageMask (1L << 9) #define XkbAccessXNotifyMask (1L << 10) #define XkbExtensionDeviceNotifyMask (1L << 11) #define XkbAllEventsMask (0xFFF) /* * NewKeyboardNotify event details: */ #define XkbNKN_KeycodesMask (1L << 0) #define XkbNKN_GeometryMask (1L << 1) #define XkbNKN_DeviceIDMask (1L << 2) #define XkbAllNewKeyboardEventsMask (0x7) /* * AccessXNotify event types: * - The 'what' field of AccessXNotify events reports the * reason that the event was generated. */ #define XkbAXN_SKPress 0 #define XkbAXN_SKAccept 1 #define XkbAXN_SKReject 2 #define XkbAXN_SKRelease 3 #define XkbAXN_BKAccept 4 #define XkbAXN_BKReject 5 #define XkbAXN_AXKWarning 6 /* * AccessXNotify details: * - Used as an event detail mask to limit the conditions under which * AccessXNotify events are reported */ #define XkbAXN_SKPressMask (1L << 0) #define XkbAXN_SKAcceptMask (1L << 1) #define XkbAXN_SKRejectMask (1L << 2) #define XkbAXN_SKReleaseMask (1L << 3) #define XkbAXN_BKAcceptMask (1L << 4) #define XkbAXN_BKRejectMask (1L << 5) #define XkbAXN_AXKWarningMask (1L << 6) #define XkbAllAccessXEventsMask (0x7f) /* * Miscellaneous event details: * - event detail masks for assorted events that don't reall * have any details. */ #define XkbAllStateEventsMask XkbAllStateComponentsMask #define XkbAllMapEventsMask XkbAllMapComponentsMask #define XkbAllControlEventsMask XkbAllControlsMask #define XkbAllIndicatorEventsMask XkbAllIndicatorsMask #define XkbAllNameEventsMask XkbAllNamesMask #define XkbAllCompatMapEventsMask XkbAllCompatMask #define XkbAllBellEventsMask (1L << 0) #define XkbAllActionMessagesMask (1L << 0) /* * XKB reports one error: BadKeyboard * A further reason for the error is encoded into to most significant * byte of the resourceID for the error: * XkbErr_BadDevice - the device in question was not found * XkbErr_BadClass - the device was found but it doesn't belong to * the appropriate class. * XkbErr_BadId - the device was found and belongs to the right * class, but not feedback with a matching id was * found. * The low byte of the resourceID for this error contains the device * id, class specifier or feedback id that failed. */ #define XkbKeyboard 0 #define XkbNumberErrors 1 #define XkbErr_BadDevice 0xff #define XkbErr_BadClass 0xfe #define XkbErr_BadId 0xfd /* * Keyboard Components Mask: * - Specifies the components that follow a GetKeyboardByNameReply */ #define XkbClientMapMask (1L << 0) #define XkbServerMapMask (1L << 1) #define XkbCompatMapMask (1L << 2) #define XkbIndicatorMapMask (1L << 3) #define XkbNamesMask (1L << 4) #define XkbGeometryMask (1L << 5) #define XkbControlsMask (1L << 6) #define XkbAllComponentsMask (0x7f) /* * State detail mask: * - The 'changed' field of StateNotify events reports which of * the keyboard state components have changed. * - Used as an event detail mask to limit the conditions under * which StateNotify events are reported. */ #define XkbModifierStateMask (1L << 0) #define XkbModifierBaseMask (1L << 1) #define XkbModifierLatchMask (1L << 2) #define XkbModifierLockMask (1L << 3) #define XkbGroupStateMask (1L << 4) #define XkbGroupBaseMask (1L << 5) #define XkbGroupLatchMask (1L << 6) #define XkbGroupLockMask (1L << 7) #define XkbCompatStateMask (1L << 8) #define XkbGrabModsMask (1L << 9) #define XkbCompatGrabModsMask (1L << 10) #define XkbLookupModsMask (1L << 11) #define XkbCompatLookupModsMask (1L << 12) #define XkbPointerButtonMask (1L << 13) #define XkbAllStateComponentsMask (0x3fff) /* * Controls detail masks: * The controls specified in XkbAllControlsMask: * - The 'changed' field of ControlsNotify events reports which of * the keyboard controls have changed. * - The 'changeControls' field of the SetControls request specifies * the controls for which values are to be changed. * - Used as an event detail mask to limit the conditions under * which ControlsNotify events are reported. * * The controls specified in the XkbAllBooleanCtrlsMask: * - The 'enabledControls' field of ControlsNotify events reports the * current status of the boolean controls. * - The 'enabledControlsChanges' field of ControlsNotify events reports * any boolean controls that have been turned on or off. * - The 'affectEnabledControls' and 'enabledControls' fields of the * kbSetControls request change the set of enabled controls. * - The 'accessXTimeoutMask' and 'accessXTimeoutValues' fields of * an XkbControlsRec specify the controls to be changed if the keyboard * times out and the values to which they should be changed. * - The 'autoCtrls' and 'autoCtrlsValues' fields of the PerClientFlags * request specifies the specify the controls to be reset when the * client exits and the values to which they should be reset. * - The 'ctrls' field of an indicator map specifies the controls * that drive the indicator. * - Specifies the boolean controls affected by the SetControls and * LockControls key actions. */ #define XkbRepeatKeysMask (1L << 0) #define XkbSlowKeysMask (1L << 1) #define XkbBounceKeysMask (1L << 2) #define XkbStickyKeysMask (1L << 3) #define XkbMouseKeysMask (1L << 4) #define XkbMouseKeysAccelMask (1L << 5) #define XkbAccessXKeysMask (1L << 6) #define XkbAccessXTimeoutMask (1L << 7) #define XkbAccessXFeedbackMask (1L << 8) #define XkbAudibleBellMask (1L << 9) #define XkbOverlay1Mask (1L << 10) #define XkbOverlay2Mask (1L << 11) #define XkbIgnoreGroupLockMask (1L << 12) #define XkbGroupsWrapMask (1L << 27) #define XkbInternalModsMask (1L << 28) #define XkbIgnoreLockModsMask (1L << 29) #define XkbPerKeyRepeatMask (1L << 30) #define XkbControlsEnabledMask (1L << 31) #define XkbAccessXOptionsMask (XkbStickyKeysMask|XkbAccessXFeedbackMask) #define XkbAllBooleanCtrlsMask (0x00001FFF) #define XkbAllControlsMask (0xF8001FFF) #define XkbAllControlEventsMask XkbAllControlsMask /* * AccessX Options Mask * - The 'accessXOptions' field of an XkbControlsRec specifies the * AccessX options that are currently in effect. * - The 'accessXTimeoutOptionsMask' and 'accessXTimeoutOptionsValues' * fields of an XkbControlsRec specify the Access X options to be * changed if the keyboard times out and the values to which they * should be changed. */ #define XkbAX_SKPressFBMask (1L << 0) #define XkbAX_SKAcceptFBMask (1L << 1) #define XkbAX_FeatureFBMask (1L << 2) #define XkbAX_SlowWarnFBMask (1L << 3) #define XkbAX_IndicatorFBMask (1L << 4) #define XkbAX_StickyKeysFBMask (1L << 5) #define XkbAX_TwoKeysMask (1L << 6) #define XkbAX_LatchToLockMask (1L << 7) #define XkbAX_SKReleaseFBMask (1L << 8) #define XkbAX_SKRejectFBMask (1L << 9) #define XkbAX_BKRejectFBMask (1L << 10) #define XkbAX_DumbBellFBMask (1L << 11) #define XkbAX_FBOptionsMask (0xF3F) #define XkbAX_SKOptionsMask (0x0C0) #define XkbAX_AllOptionsMask (0xFFF) /* * XkbUseCoreKbd is used to specify the core keyboard without having * to look up its X input extension identifier. * XkbUseCorePtr is used to specify the core pointer without having * to look up its X input extension identifier. * XkbDfltXIClass is used to specify "don't care" any place that the * XKB protocol is looking for an X Input Extension * device class. * XkbDfltXIId is used to specify "don't care" any place that the * XKB protocol is looking for an X Input Extension * feedback identifier. * XkbAllXIClasses is used to get information about all device indicators, * whether they're part of the indicator feedback class * or the keyboard feedback class. * XkbAllXIIds is used to get information about all device indicator * feedbacks without having to list them. * XkbXINone is used to indicate that no class or id has been specified. * XkbLegalXILedClass(c) True if 'c' specifies a legal class with LEDs * XkbLegalXIBellClass(c) True if 'c' specifies a legal class with bells * XkbExplicitXIDevice(d) True if 'd' explicitly specifies a device * XkbExplicitXIClass(c) True if 'c' explicitly specifies a device class * XkbExplicitXIId(c) True if 'i' explicitly specifies a device id * XkbSingleXIClass(c) True if 'c' specifies exactly one device class, * including the default. * XkbSingleXIId(i) True if 'i' specifies exactly one device * identifier, including the default. */ #define XkbUseCoreKbd 0x0100 #define XkbUseCorePtr 0x0200 #define XkbDfltXIClass 0x0300 #define XkbDfltXIId 0x0400 #define XkbAllXIClasses 0x0500 #define XkbAllXIIds 0x0600 #define XkbXINone 0xff00 #define XkbLegalXILedClass(c) (((c)==KbdFeedbackClass)||\ ((c)==LedFeedbackClass)||\ ((c)==XkbDfltXIClass)||\ ((c)==XkbAllXIClasses)) #define XkbLegalXIBellClass(c) (((c)==KbdFeedbackClass)||\ ((c)==BellFeedbackClass)||\ ((c)==XkbDfltXIClass)||\ ((c)==XkbAllXIClasses)) #define XkbExplicitXIDevice(c) (((c)&(~0xff))==0) #define XkbExplicitXIClass(c) (((c)&(~0xff))==0) #define XkbExplicitXIId(c) (((c)&(~0xff))==0) #define XkbSingleXIClass(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIClass)) #define XkbSingleXIId(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIId)) #define XkbNoModifier 0xff #define XkbNoShiftLevel 0xff #define XkbNoShape 0xff #define XkbNoIndicator 0xff #define XkbNoModifierMask 0 #define XkbAllModifiersMask 0xff #define XkbAllVirtualModsMask 0xffff #define XkbNumKbdGroups 4 #define XkbMaxKbdGroup (XkbNumKbdGroups-1) #define XkbMaxMouseKeysBtn 4 /* * Group Index and Mask: * - Indices into the kt_index array of a key type. * - Mask specifies types to be changed for XkbChangeTypesOfKey */ #define XkbGroup1Index 0 #define XkbGroup2Index 1 #define XkbGroup3Index 2 #define XkbGroup4Index 3 #define XkbAnyGroup 254 #define XkbAllGroups 255 #define XkbGroup1Mask (1<<0) #define XkbGroup2Mask (1<<1) #define XkbGroup3Mask (1<<2) #define XkbGroup4Mask (1<<3) #define XkbAnyGroupMask (1<<7) #define XkbAllGroupsMask (0xf) /* * BuildCoreState: Given a keyboard group and a modifier state, * construct the value to be reported an event. * GroupForCoreState: Given the state reported in an event, * determine the keyboard group. * IsLegalGroup: Returns TRUE if 'g' is a valid group index. */ #define XkbBuildCoreState(m,g) ((((g)&0x3)<<13)|((m)&0xff)) #define XkbGroupForCoreState(s) (((s)>>13)&0x3) #define XkbIsLegalGroup(g) (((g)>=0)&&((g)type>=Xkb_SASetMods)&&((a)->type<=XkbSA_LockMods)) #define XkbIsGroupAction(a) (((a)->type>=XkbSA_SetGroup)&&((a)->type<=XkbSA_LockGroup)) #define XkbIsPtrAction(a) (((a)->type>=XkbSA_MovePtr)&&((a)->type<=XkbSA_SetPtrDflt)) /* * Key Behavior Qualifier: * KB_Permanent indicates that the behavior describes an unalterable * characteristic of the keyboard, not an XKB software-simulation of * the listed behavior. * Key Behavior Types: * Specifies the behavior of the underlying key. */ #define XkbKB_Permanent 0x80 #define XkbKB_OpMask 0x7f #define XkbKB_Default 0x00 #define XkbKB_Lock 0x01 #define XkbKB_RadioGroup 0x02 #define XkbKB_Overlay1 0x03 #define XkbKB_Overlay2 0x04 #define XkbKB_RGAllowNone 0x80 /* * Various macros which describe the range of legal keycodes. */ #define XkbMinLegalKeyCode 8 #define XkbMaxLegalKeyCode 255 #define XkbMaxKeyCount (XkbMaxLegalKeyCode-XkbMinLegalKeyCode+1) #define XkbPerKeyBitArraySize ((XkbMaxLegalKeyCode+1)/8) /* Seems kinda silly to check that an unsigned char is <= 255... */ #define XkbIsLegalKeycode(k) ((k)>=XkbMinLegalKeyCode) /* * Assorted constants and limits. */ #define XkbNumModifiers 8 #define XkbNumVirtualMods 16 #define XkbNumIndicators 32 #define XkbAllIndicatorsMask (0xffffffff) #define XkbMaxRadioGroups 32 #define XkbAllRadioGroupsMask (0xffffffff) #define XkbMaxShiftLevel 63 #define XkbMaxSymsPerKey (XkbMaxShiftLevel*XkbNumKbdGroups) #define XkbRGMaxMembers 12 #define XkbActionMessageLength 6 #define XkbKeyNameLength 4 #define XkbMaxRedirectCount 8 #define XkbGeomPtsPerMM 10 #define XkbGeomMaxColors 32 #define XkbGeomMaxLabelColors 3 #define XkbGeomMaxPriority 255 /* * Key Type index and mask for the four standard key types. */ #define XkbOneLevelIndex 0 #define XkbTwoLevelIndex 1 #define XkbAlphabeticIndex 2 #define XkbKeypadIndex 3 #define XkbLastRequiredType XkbKeypadIndex #define XkbNumRequiredTypes (XkbLastRequiredType+1) #define XkbMaxKeyTypes 255 #define XkbOneLevelMask (1<<0) #define XkbTwoLevelMask (1<<1) #define XkbAlphabeticMask (1<<2) #define XkbKeypadMask (1<<3) #define XkbAllRequiredTypes (0xf) #define XkbShiftLevel(n) ((n)-1) #define XkbShiftLevelMask(n) (1<<((n)-1)) /* * Extension name and version information */ #define XkbName "XKEYBOARD" #define XkbMajorVersion 1 #define XkbMinorVersion 0 /* * Explicit map components: * - Used in the 'explicit' field of an XkbServerMap. Specifies * the keyboard components that should _not_ be updated automatically * in response to core protocol keyboard mapping requests. */ #define XkbExplicitKeyTypesMask (0x0f) #define XkbExplicitKeyType1Mask (1<<0) #define XkbExplicitKeyType2Mask (1<<1) #define XkbExplicitKeyType3Mask (1<<2) #define XkbExplicitKeyType4Mask (1<<3) #define XkbExplicitInterpretMask (1<<4) #define XkbExplicitAutoRepeatMask (1<<5) #define XkbExplicitBehaviorMask (1<<6) #define XkbExplicitVModMapMask (1<<7) #define XkbAllExplicitMask (0xff) /* * Map components masks: * Those in AllMapComponentsMask: * - Specifies the individual fields to be loaded or changed for the * GetMap and SetMap requests. * Those in ClientInfoMask: * - Specifies the components to be allocated by XkbAllocClientMap. * Those in ServerInfoMask: * - Specifies the components to be allocated by XkbAllocServerMap. */ #define XkbKeyTypesMask (1<<0) #define XkbKeySymsMask (1<<1) #define XkbModifierMapMask (1<<2) #define XkbExplicitComponentsMask (1<<3) #define XkbKeyActionsMask (1<<4) #define XkbKeyBehaviorsMask (1<<5) #define XkbVirtualModsMask (1<<6) #define XkbVirtualModMapMask (1<<7) #define XkbAllClientInfoMask (XkbKeyTypesMask|XkbKeySymsMask|XkbModifierMapMask) #define XkbAllServerInfoMask (XkbExplicitComponentsMask|XkbKeyActionsMask|XkbKeyBehaviorsMask|XkbVirtualModsMask|XkbVirtualModMapMask) #define XkbAllMapComponentsMask (XkbAllClientInfoMask|XkbAllServerInfoMask) /* * Symbol interpretations flags: * - Used in the flags field of a symbol interpretation */ #define XkbSI_AutoRepeat (1<<0) #define XkbSI_LockingKey (1<<1) /* * Symbol interpretations match specification: * - Used in the match field of a symbol interpretation to specify * the conditions under which an interpretation is used. */ #define XkbSI_LevelOneOnly (0x80) #define XkbSI_OpMask (0x7f) #define XkbSI_NoneOf (0) #define XkbSI_AnyOfOrNone (1) #define XkbSI_AnyOf (2) #define XkbSI_AllOf (3) #define XkbSI_Exactly (4) /* * Indicator map flags: * - Used in the flags field of an indicator map to indicate the * conditions under which and indicator can be changed and the * effects of changing the indicator. */ #define XkbIM_NoExplicit (1L << 7) #define XkbIM_NoAutomatic (1L << 6) #define XkbIM_LEDDrivesKB (1L << 5) /* * Indicator map component specifications: * - Used by the 'which_groups' and 'which_mods' fields of an indicator * map to specify which keyboard components should be used to drive * the indicator. */ #define XkbIM_UseBase (1L << 0) #define XkbIM_UseLatched (1L << 1) #define XkbIM_UseLocked (1L << 2) #define XkbIM_UseEffective (1L << 3) #define XkbIM_UseCompat (1L << 4) #define XkbIM_UseNone 0 #define XkbIM_UseAnyGroup (XkbIM_UseBase|XkbIM_UseLatched|XkbIM_UseLocked\ |XkbIM_UseEffective) #define XkbIM_UseAnyMods (XkbIM_UseAnyGroup|XkbIM_UseCompat) /* * Compatibility Map Compontents: * - Specifies the components to be allocated in XkbAllocCompatMap. */ #define XkbSymInterpMask (1<<0) #define XkbGroupCompatMask (1<<1) #define XkbAllCompatMask (0x3) /* * Names component mask: * - Specifies the names to be loaded or changed for the GetNames and * SetNames requests. * - Specifies the names that have changed in a NamesNotify event. * - Specifies the names components to be allocated by XkbAllocNames. */ #define XkbKeycodesNameMask (1<<0) #define XkbGeometryNameMask (1<<1) #define XkbSymbolsNameMask (1<<2) #define XkbPhysSymbolsNameMask (1<<3) #define XkbTypesNameMask (1<<4) #define XkbCompatNameMask (1<<5) #define XkbKeyTypeNamesMask (1<<6) #define XkbKTLevelNamesMask (1<<7) #define XkbIndicatorNamesMask (1<<8) #define XkbKeyNamesMask (1<<9) #define XkbKeyAliasesMask (1<<10) #define XkbVirtualModNamesMask (1<<11) #define XkbGroupNamesMask (1<<12) #define XkbRGNamesMask (1<<13) #define XkbComponentNamesMask (0x3f) #define XkbAllNamesMask (0x3fff) /* * GetByName components: * - Specifies desired or necessary components to GetKbdByName request. * - Reports the components that were found in a GetKbdByNameReply */ #define XkbGBN_TypesMask (1L << 0) #define XkbGBN_CompatMapMask (1L << 1) #define XkbGBN_ClientSymbolsMask (1L << 2) #define XkbGBN_ServerSymbolsMask (1L << 3) #define XkbGBN_SymbolsMask (XkbGBN_ClientSymbolsMask|XkbGBN_ServerSymbolsMask) #define XkbGBN_IndicatorMapMask (1L << 4) #define XkbGBN_KeyNamesMask (1L << 5) #define XkbGBN_GeometryMask (1L << 6) #define XkbGBN_OtherNamesMask (1L << 7) #define XkbGBN_AllComponentsMask (0xff) /* * ListComponents flags */ #define XkbLC_Hidden (1L << 0) #define XkbLC_Default (1L << 1) #define XkbLC_Partial (1L << 2) #define XkbLC_AlphanumericKeys (1L << 8) #define XkbLC_ModifierKeys (1L << 9) #define XkbLC_KeypadKeys (1L << 10) #define XkbLC_FunctionKeys (1L << 11) #define XkbLC_AlternateGroup (1L << 12) /* * X Input Extension Interactions * - Specifies the possible interactions between XKB and the X input * extension * - Used to request (XkbGetDeviceInfo) or change (XKbSetDeviceInfo) * XKB information about an extension device. * - Reports the list of supported optional features in the reply to * XkbGetDeviceInfo or in an XkbExtensionDeviceNotify event. * XkbXI_UnsupportedFeature is reported in XkbExtensionDeviceNotify * events to indicate an attempt to use an unsupported feature. */ #define XkbXI_KeyboardsMask (1L << 0) #define XkbXI_ButtonActionsMask (1L << 1) #define XkbXI_IndicatorNamesMask (1L << 2) #define XkbXI_IndicatorMapsMask (1L << 3) #define XkbXI_IndicatorStateMask (1L << 4) #define XkbXI_UnsupportedFeatureMask (1L << 15) #define XkbXI_AllFeaturesMask (0x001f) #define XkbXI_AllDeviceFeaturesMask (0x001e) #define XkbXI_IndicatorsMask (0x001c) #define XkbAllExtensionDeviceEventsMask (0x801f) /* * Per-Client Flags: * - Specifies flags to be changed by the PerClientFlags request. */ #define XkbPCF_DetectableAutoRepeatMask (1L << 0) #define XkbPCF_GrabsUseXKBStateMask (1L << 1) #define XkbPCF_AutoResetControlsMask (1L << 2) #define XkbPCF_LookupStateWhenGrabbed (1L << 3) #define XkbPCF_SendEventUsesXKBState (1L << 4) #define XkbPCF_AllFlagsMask (0x1F) /* * Debugging flags and controls */ #define XkbDF_DisableLocks (1<<0) #endif /* _XKB_H_ */ X11/extensions/lbxproto.h000064400000062340147631660250011355 0ustar00/* * Copyright 1992 Network Computing Devices * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of NCD. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. NCD. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #ifndef _LBXPROTO_H_ #define _LBXPROTO_H_ #include /* * NOTE: any changes or additions to the opcodes needs to be reflected * in the lbxCacheable array in Xserver/lbx/lbxmain.c */ #define X_LbxQueryVersion 0 #define X_LbxStartProxy 1 #define X_LbxStopProxy 2 #define X_LbxSwitch 3 #define X_LbxNewClient 4 #define X_LbxCloseClient 5 #define X_LbxModifySequence 6 #define X_LbxAllowMotion 7 #define X_LbxIncrementPixel 8 #define X_LbxDelta 9 #define X_LbxGetModifierMapping 10 #define X_LbxInvalidateTag 12 #define X_LbxPolyPoint 13 #define X_LbxPolyLine 14 #define X_LbxPolySegment 15 #define X_LbxPolyRectangle 16 #define X_LbxPolyArc 17 #define X_LbxFillPoly 18 #define X_LbxPolyFillRectangle 19 #define X_LbxPolyFillArc 20 #define X_LbxGetKeyboardMapping 21 #define X_LbxQueryFont 22 #define X_LbxChangeProperty 23 #define X_LbxGetProperty 24 #define X_LbxTagData 25 #define X_LbxCopyArea 26 #define X_LbxCopyPlane 27 #define X_LbxPolyText8 28 #define X_LbxPolyText16 29 #define X_LbxImageText8 30 #define X_LbxImageText16 31 #define X_LbxQueryExtension 32 #define X_LbxPutImage 33 #define X_LbxGetImage 34 #define X_LbxBeginLargeRequest 35 #define X_LbxLargeRequestData 36 #define X_LbxEndLargeRequest 37 #define X_LbxInternAtoms 38 #define X_LbxGetWinAttrAndGeom 39 #define X_LbxGrabCmap 40 #define X_LbxReleaseCmap 41 #define X_LbxAllocColor 42 #define X_LbxSync 43 /* * Redefine some basic types used by structures defined herein. This removes * any possibility on 64-bit architectures of one entity viewing communicated * data as 32-bit quantities and another entity viewing the same data as 64-bit * quantities. */ #define XID CARD32 #define Atom CARD32 #define Colormap CARD32 #define Drawable CARD32 #define VisualID CARD32 #define Window CARD32 typedef struct { BOOL success; /* TRUE */ BOOL changeType; CARD16 majorVersion B16, minorVersion B16; CARD16 length B16; /* 1/4 additional bytes in setup info */ CARD32 tag B32; } xLbxConnSetupPrefix; typedef struct _LbxQueryVersion { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxQueryVersion */ CARD16 length B16; } xLbxQueryVersionReq; #define sz_xLbxQueryVersionReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of LBX protocol */ CARD16 minorVersion B16; /* minor version of LBX protocol */ CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xLbxQueryVersionReply; #define sz_xLbxQueryVersionReply 32 typedef struct _LbxStartProxy { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxStartProxy */ CARD16 length B16; } xLbxStartProxyReq; #define sz_xLbxStartProxyReq 4 typedef struct _LbxStopProxy { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxStopProxy */ CARD16 length B16; } xLbxStopProxyReq; #define sz_xLbxStopProxyReq 4 typedef struct _LbxSwitch { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxSwitch */ CARD16 length B16; CARD32 client B32; /* new client */ } xLbxSwitchReq; #define sz_xLbxSwitchReq 8 typedef struct _LbxNewClient { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxNewClient */ CARD16 length B16; CARD32 client B32; /* new client */ } xLbxNewClientReq; #define sz_xLbxNewClientReq 8 typedef struct _LbxCloseClient { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxCloseClient */ CARD16 length B16; CARD32 client B32; /* new client */ } xLbxCloseClientReq; #define sz_xLbxCloseClientReq 8 typedef struct _LbxModifySequence { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxModifySequence */ CARD16 length B16; CARD32 adjust B32; } xLbxModifySequenceReq; #define sz_xLbxModifySequenceReq 8 typedef struct _LbxAllowMotion { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxAllowMotion */ CARD16 length B16; CARD32 num B32; } xLbxAllowMotionReq; #define sz_xLbxAllowMotionReq 8 typedef struct { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxGrabCmap */ CARD16 length B16; Colormap cmap B32; } xLbxGrabCmapReq; #define sz_xLbxGrabCmapReq 8 #define LBX_SMART_GRAB 0x80 #define LBX_AUTO_RELEASE 0x40 #define LBX_3CHANNELS 0x20 #define LBX_2BYTE_PIXELS 0x10 #define LBX_RGB_BITS_MASK 0x0f #define LBX_LIST_END 0 #define LBX_PIXEL_PRIVATE 1 #define LBX_PIXEL_SHARED 2 #define LBX_PIXEL_RANGE_PRIVATE 3 #define LBX_PIXEL_RANGE_SHARED 4 #define LBX_NEXT_CHANNEL 5 typedef struct { BYTE type; /* X_Reply */ CARD8 flags; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad0 B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B16; } xLbxGrabCmapReply; #define sz_xLbxGrabCmapReply 32 #define sz_xLbxGrabCmapReplyHdr 8 typedef struct { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxReleaseCmap */ CARD16 length B16; Colormap cmap B32; } xLbxReleaseCmapReq; #define sz_xLbxReleaseCmapReq 8 typedef struct { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxAllocColor */ CARD16 length B16; Colormap cmap B32; CARD32 pixel B32; CARD16 red B16, green B16, blue B16; CARD16 pad B16; } xLbxAllocColorReq; #define sz_xLbxAllocColorReq 20 typedef struct _LbxIncrementPixel { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxIncrementPixel */ CARD16 length B16; CARD32 cmap B32; CARD32 pixel B32; } xLbxIncrementPixelReq; #define sz_xLbxIncrementPixelReq 12 typedef struct _LbxDelta { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxDelta */ CARD16 length B16; CARD8 diffs; /* number of diffs */ CARD8 cindex; /* cache index */ /* list of diffs follows */ } xLbxDeltaReq; #define sz_xLbxDeltaReq 6 typedef struct _LbxGetModifierMapping { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxGetModifierMapping */ CARD16 length B16; } xLbxGetModifierMappingReq; #define sz_xLbxGetModifierMappingReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 keyspermod; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 tag B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xLbxGetModifierMappingReply; #define sz_xLbxGetModifierMappingReply 32 typedef struct _LbxGetKeyboardMapping { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxGetKeyboardMapping */ CARD16 length B16; KeyCode firstKeyCode; CARD8 count; CARD16 pad1 B16; } xLbxGetKeyboardMappingReq; #define sz_xLbxGetKeyboardMappingReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 keysperkeycode; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 tag B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xLbxGetKeyboardMappingReply; #define sz_xLbxGetKeyboardMappingReply 32 typedef struct _LbxQueryFont { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxQueryFont */ CARD16 length B16; CARD32 fid B32; } xLbxQueryFontReq; #define sz_xLbxQueryFontReq 8 typedef struct _LbxInternAtoms { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxInternAtoms */ CARD16 length B16; CARD16 num B16; } xLbxInternAtomsReq; #define sz_xLbxInternAtomsReq 6 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 atomsStart B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xLbxInternAtomsReply; #define sz_xLbxInternAtomsReply 32 #define sz_xLbxInternAtomsReplyHdr 8 typedef struct _LbxGetWinAttrAndGeom { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxGetWinAttrAndGeom */ CARD16 length B16; CARD32 id B32; /* window id */ } xLbxGetWinAttrAndGeomReq; #define sz_xLbxGetWinAttrAndGeomReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 backingStore; CARD16 sequenceNumber B16; CARD32 length B32; /* NOT 0; this is an extra-large reply */ VisualID visualID B32; #if defined(__cplusplus) || defined(c_plusplus) CARD16 c_class B16; #else CARD16 class B16; #endif CARD8 bitGravity; CARD8 winGravity; CARD32 backingBitPlanes B32; CARD32 backingPixel B32; BOOL saveUnder; BOOL mapInstalled; CARD8 mapState; BOOL override; Colormap colormap B32; CARD32 allEventMasks B32; CARD32 yourEventMask B32; CARD16 doNotPropagateMask B16; CARD16 pad1 B16; Window root B32; INT16 x B16, y B16; CARD16 width B16, height B16; CARD16 borderWidth B16; CARD8 depth; CARD8 pad2; } xLbxGetWinAttrAndGeomReply; #define sz_xLbxGetWinAttrAndGeomReply 60 typedef struct { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxSync */ CARD16 length B16; } xLbxSyncReq; #define sz_xLbxSyncReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xLbxSyncReply; #define sz_xLbxSyncReply 32 /* an LBX squished charinfo packs the data in a CARD32 as follows */ #define LBX_WIDTH_SHIFT 26 #define LBX_LEFT_SHIFT 20 #define LBX_RIGHT_SHIFT 13 #define LBX_ASCENT_SHIFT 7 #define LBX_DESCENT_SHIFT 0 #define LBX_WIDTH_BITS 6 #define LBX_LEFT_BITS 6 #define LBX_RIGHT_BITS 7 #define LBX_ASCENT_BITS 6 #define LBX_DESCENT_BITS 7 #define LBX_WIDTH_MASK 0xfc000000 #define LBX_LEFT_MASK 0x03f00000 #define LBX_RIGHT_MASK 0x000fe000 #define LBX_ASCENT_MASK 0x00001f80 #define LBX_DESCENT_MASK 0x0000007f #define LBX_MASK_BITS(val, n) ((unsigned int) ((val) & ((1 << (n)) - 1))) typedef struct { CARD32 metrics B32; } xLbxCharInfo; /* note that this is identical to xQueryFontReply except for missing * first 2 words */ typedef struct { xCharInfo minBounds; /* XXX do we need to leave this gunk? */ #ifndef WORD64 CARD32 walign1 B32; #endif xCharInfo maxBounds; #ifndef WORD64 CARD32 walign2 B32; #endif CARD16 minCharOrByte2 B16, maxCharOrByte2 B16; CARD16 defaultChar B16; CARD16 nFontProps B16; /* followed by this many xFontProp structures */ CARD8 drawDirection; CARD8 minByte1, maxByte1; BOOL allCharsExist; INT16 fontAscent B16, fontDescent B16; CARD32 nCharInfos B32; /* followed by this many xLbxCharInfo structures */ } xLbxFontInfo; typedef struct { BYTE type; /* X_Reply */ CARD8 compression; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 tag B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; /* X_QueryFont sticks much of the data in the base reply packet, * but we hope that it won't be needed, (and it won't fit in 32 bytes * with the tag anyways) * * if any additional data is needed, its sent in a xLbxFontInfo */ } xLbxQueryFontReply; #define sz_xLbxQueryFontReply 32 typedef struct _LbxChangeProperty { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxChangeProperty */ CARD16 length B16; Window window B32; Atom property B32; Atom type B32; CARD8 format; CARD8 mode; BYTE pad[2]; CARD32 nUnits B32; } xLbxChangePropertyReq; #define sz_xLbxChangePropertyReq 24 typedef struct { BYTE type; /* X_Reply */ CARD8 pad; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 tag B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xLbxChangePropertyReply; #define sz_xLbxChangePropertyReply 32 typedef struct _LbxGetProperty { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxGetProperty */ CARD16 length B16; Window window B32; Atom property B32; Atom type B32; CARD8 delete; BYTE pad[3]; CARD32 longOffset B32; CARD32 longLength B32; } xLbxGetPropertyReq; #define sz_xLbxGetPropertyReq 28 typedef struct { BYTE type; /* X_Reply */ CARD8 format; CARD16 sequenceNumber B16; CARD32 length B32; Atom propertyType B32; CARD32 bytesAfter B32; CARD32 nItems B32; CARD32 tag B32; CARD32 pad1 B32; CARD32 pad2 B32; } xLbxGetPropertyReply; #define sz_xLbxGetPropertyReply 32 typedef struct _LbxTagData { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxTagData */ CARD16 length B16; XID tag B32; CARD32 real_length B32; /* data */ } xLbxTagDataReq; #define sz_xLbxTagDataReq 12 typedef struct _LbxInvalidateTag { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxInvalidateTag */ CARD16 length B16; CARD32 tag B32; } xLbxInvalidateTagReq; #define sz_xLbxInvalidateTagReq 8 typedef struct _LbxPutImage { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxPutImage */ CARD16 length B16; CARD8 compressionMethod; CARD8 cacheEnts; CARD8 bitPacked; /* rest is variable */ } xLbxPutImageReq; #define sz_xLbxPutImageReq 7 typedef struct { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxGetImage */ CARD16 length B16; Drawable drawable B32; INT16 x B16, y B16; CARD16 width B16, height B16; CARD32 planeMask B32; CARD8 format; CARD8 pad1; CARD16 pad2 B16; } xLbxGetImageReq; #define sz_xLbxGetImageReq 24 typedef struct { BYTE type; /* X_Reply */ CARD8 depth; CARD16 sequenceNumber B16; CARD32 lbxLength B32; CARD32 xLength B32; VisualID visual B32; CARD8 compressionMethod; CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xLbxGetImageReply; #define sz_xLbxGetImageReply 32 /* Following used for LbxPolyPoint, LbxPolyLine, LbxPolySegment, LbxPolyRectangle, LbxPolyArc, LbxPolyFillRectangle and LbxPolyFillArc */ #define GFX_CACHE_SIZE 15 #define GFXdCacheEnt(e) ((e) & 0xf) #define GFXgCacheEnt(e) (((e) >> 4) & 0xf) #define GFXCacheEnts(d,g) (((d) & 0xf) | (((g) & 0xf) << 4)) #define GFXCacheNone 0xf typedef struct _LbxPolyPoint { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; CARD16 length B16; CARD8 cacheEnts; CARD8 padBytes; } xLbxPolyPointReq; #define sz_xLbxPolyPointReq 6 typedef xLbxPolyPointReq xLbxPolyLineReq; typedef xLbxPolyPointReq xLbxPolySegmentReq; typedef xLbxPolyPointReq xLbxPolyRectangleReq; typedef xLbxPolyPointReq xLbxPolyArcReq; typedef xLbxPolyPointReq xLbxPolyFillRectangleReq; typedef xLbxPolyPointReq xLbxPolyFillArcReq; #define sz_xLbxPolyLineReq sz_xLbxPolyPointReq #define sz_xLbxPolySegmentReq sz_xLbxPolyPointReq #define sz_xLbxPolyRectangleReq sz_xLbxPolyPointReq #define sz_xLbxPolyArcReq sz_xLbxPolyPointReq #define sz_xLbxPolyFillRectangleReq sz_xLbxPolyPointReq #define sz_xLbxPolyFillArc sz_xLbxPolyPointReq typedef struct _LbxFillPoly { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; CARD16 length B16; CARD8 cacheEnts; BYTE shape; CARD8 padBytes; } xLbxFillPolyReq; #define sz_xLbxFillPolyReq 7 typedef struct _LbxCopyArea { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; CARD16 length B16; CARD8 srcCache; /* source drawable */ CARD8 cacheEnts; /* dest drawable and gc */ /* followed by encoded src x, src y, dst x, dst y, width, height */ } xLbxCopyAreaReq; #define sz_xLbxCopyAreaReq 6 typedef struct _LbxCopyPlane { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; CARD16 length B16; CARD32 bitPlane B32; CARD8 srcCache; /* source drawable */ CARD8 cacheEnts; /* dest drawable and gc */ /* followed by encoded src x, src y, dst x, dst y, width, height */ } xLbxCopyPlaneReq; #define sz_xLbxCopyPlaneReq 10 typedef struct _LbxPolyText { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; CARD16 length B16; CARD8 cacheEnts; /* followed by encoded src x, src y coordinates and text elts */ } xLbxPolyTextReq; #define sz_xLbxPolyTextReq 5 typedef xLbxPolyTextReq xLbxPolyText8Req; typedef xLbxPolyTextReq xLbxPolyText16Req; #define sz_xLbxPolyTextReq 5 #define sz_xLbxPolyText8Req 5 #define sz_xLbxPolyText16Req 5 typedef struct _LbxImageText { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; CARD16 length B16; CARD8 cacheEnts; CARD8 nChars; /* followed by encoded src x, src y coordinates and string */ } xLbxImageTextReq; typedef xLbxImageTextReq xLbxImageText8Req; typedef xLbxImageTextReq xLbxImageText16Req; #define sz_xLbxImageTextReq 6 #define sz_xLbxImageText8Req 6 #define sz_xLbxImageText16Req 6 typedef struct { CARD8 offset; CARD8 diff; } xLbxDiffItem; #define sz_xLbxDiffItem 2 typedef struct { BYTE type; /* X_Reply */ CARD8 nOpts; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 optDataStart B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xLbxStartReply; #define sz_xLbxStartReply 32 #define sz_xLbxStartReplyHdr 8 typedef struct _LbxQueryExtension { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxQueryExtension */ CARD16 length B16; CARD32 nbytes B32; } xLbxQueryExtensionReq; #define sz_xLbxQueryExtensionReq 8 typedef struct _LbxQueryExtensionReply { BYTE type; /* X_Reply */ CARD8 numReqs; CARD16 sequenceNumber B16; CARD32 length B32; BOOL present; CARD8 major_opcode; CARD8 first_event; CARD8 first_error; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; /* reply & event generating requests */ } xLbxQueryExtensionReply; #define sz_xLbxQueryExtensionReply 32 typedef struct _LbxBeginLargeRequest { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxBeginLargeRequest */ CARD16 length B16; CARD32 largeReqLength B32; } xLbxBeginLargeRequestReq; #define sz_BeginLargeRequestReq 8 typedef struct _LbxLargeRequestData { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxLargeRequestData */ CARD16 length B16; /* followed by LISTofCARD8 data */ } xLbxLargeRequestDataReq; #define sz_LargeRequestDataReq 4 typedef struct _LbxEndLargeRequest { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxEndLargeRequest */ CARD16 length B16; } xLbxEndLargeRequestReq; #define sz_EndLargeRequestReq 4 typedef struct _LbxSwitchEvent { BYTE type; /* always eventBase + LbxEvent */ BYTE lbxType; /* LbxSwitchEvent */ CARD16 pad B16; CARD32 client B32; } xLbxSwitchEvent; #define sz_xLbxSwitchEvent 8 typedef struct _LbxCloseEvent { BYTE type; /* always eventBase + LbxEvent */ BYTE lbxType; /* LbxCloseEvent */ CARD16 sequenceNumber B16; CARD32 client B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xLbxCloseEvent; #define sz_xLbxCloseEvent 32 typedef struct _LbxInvalidateTagEvent { BYTE type; /* always eventBase + LbxEvent */ BYTE lbxType; /* LbxInvalidateTagEvent */ CARD16 sequenceNumber B16; CARD32 tag B32; CARD32 tagType B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xLbxInvalidateTagEvent; #define sz_xLbxInvalidateTagEvent 32 typedef struct _LbxSendTagDataEvent { BYTE type; /* always eventBase + LbxEvent */ BYTE lbxType; /* LbxSendTagDataEvent */ CARD16 sequenceNumber B16; CARD32 tag B32; CARD32 tagType B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xLbxSendTagDataEvent; #define sz_xLbxSendTagDataEvent 32 typedef struct _LbxListenToOneEvent { BYTE type; /* always eventBase + LbxEvent */ BYTE lbxType; /* LbxListenToOneEvent */ CARD16 sequenceNumber B16; CARD32 client B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xLbxListenToOneEvent; #define sz_xLbxListenToOneEvent 32 typedef struct _LbxListenToAllEvent { BYTE type; /* always eventBase + LbxEvent */ BYTE lbxType; /* LbxListenToAllEvent */ CARD16 sequenceNumber B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xLbxListenToAllEvent; #define sz_xLbxListenToOneEvent 32 typedef struct _LbxReleaseCmapEvent { BYTE type; /* always eventBase + LbxEvent */ BYTE lbxType; /* LbxReleaseCmapEvent */ CARD16 sequenceNumber B16; Colormap colormap B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xLbxReleaseCmapEvent; #define sz_xLbxReleaseCmapEvent 32 typedef struct _LbxFreeCellsEvent { BYTE type; /* always eventBase + LbxEvent */ BYTE lbxType; /* LbxFreeCellsEvent */ CARD16 sequenceNumber B16; Colormap colormap B32; CARD32 pixelStart B32; CARD32 pixelEnd B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xLbxFreeCellsEvent; #define sz_xLbxFreeCellsEvent 32 /* * squished X event sizes. If these change, be sure to update lbxquish.c * and unsquish.c appropriately * * lbxsz_* is the padded squished length * lbxupsz_* is the unpadded squished length */ #define lbxsz_KeyButtonEvent 32 #define lbxupsz_KeyButtonEvent 31 #define lbxsz_EnterLeaveEvent 32 #define lbxupsz_EnterLeaveEvent 32 #define lbxsz_FocusEvent 12 #define lbxupsz_FocusEvent 9 #define lbxsz_KeymapEvent 32 #define lbxupsz_KeymapEvent 32 #define lbxsz_ExposeEvent 20 #define lbxupsz_ExposeEvent 18 #define lbxsz_GfxExposeEvent 24 #define lbxupsz_GfxExposeEvent 21 #define lbxsz_NoExposeEvent 12 #define lbxupsz_NoExposeEvent 11 #define lbxsz_VisibilityEvent 12 #define lbxupsz_VisibilityEvent 9 #define lbxsz_CreateNotifyEvent 24 #define lbxupsz_CreateNotifyEvent 23 #define lbxsz_DestroyNotifyEvent 12 #define lbxupsz_DestroyNotifyEvent 12 #define lbxsz_UnmapNotifyEvent 16 #define lbxupsz_UnmapNotifyEvent 13 #define lbxsz_MapNotifyEvent 16 #define lbxupsz_MapNotifyEvent 13 #define lbxsz_MapRequestEvent 12 #define lbxupsz_MapRequestEvent 12 #define lbxsz_ReparentEvent 24 #define lbxupsz_ReparentEvent 21 #define lbxsz_ConfigureNotifyEvent 28 #define lbxupsz_ConfigureNotifyEvent 27 #define lbxsz_ConfigureRequestEvent 28 #define lbxupsz_ConfigureRequestEvent 28 #define lbxsz_GravityEvent 16 #define lbxupsz_GravityEvent 16 #define lbxsz_ResizeRequestEvent 12 #define lbxupsz_ResizeRequestEvent 12 #define lbxsz_CirculateEvent 20 #define lbxupsz_CirculateEvent 17 #define lbxsz_PropertyEvent 20 #define lbxupsz_PropertyEvent 17 #define lbxsz_SelectionClearEvent 16 #define lbxupsz_SelectionClearEvent 16 #define lbxsz_SelectionRequestEvent 28 #define lbxupsz_SelectionRequestEvent 28 #define lbxsz_SelectionNotifyEvent 24 #define lbxupsz_SelectionNotifyEvent 24 #define lbxsz_ColormapEvent 16 #define lbxupsz_ColormapEvent 14 #define lbxsz_MappingNotifyEvent 8 #define lbxupsz_MappingNotifyEvent 7 #define lbxsz_ClientMessageEvent 32 #define lbxupsz_ClientMessageEvent 32 #define lbxsz_UnknownEvent 32 #ifdef DEBUG #define DBG_SWITCH 0x00000001 #define DBG_CLOSE 0x00000002 #define DBG_IO 0x00000004 #define DBG_READ_REQ 0x00000008 #define DBG_LEN 0x00000010 #define DBG_BLOCK 0x00000020 #define DBG_CLIENT 0x00000040 #define DBG_DELTA 0x00000080 #endif /* * Cancel the previous redefinition of the basic types, thus restoring their * X.h definitions. */ #undef XID #undef Atom #undef Colormap #undef Drawable #undef VisualID #undef Window #endif /* _LBXPROTO_H_ */ X11/extensions/xf86misc.h000064400000007476147631660250011164 0ustar00/* $XFree86: xc/include/extensions/xf86misc.h,v 3.16 2002/11/20 04:04:56 dawes Exp $ */ /* * Copyright (c) 1995, 1996 The XFree86 Project, Inc */ /* THIS IS NOT AN X CONSORTIUM STANDARD */ #ifndef _XF86MISC_H_ #define _XF86MISC_H_ #include #define X_XF86MiscQueryVersion 0 #ifdef _XF86MISC_SAVER_COMPAT_ #define X_XF86MiscGetSaver 1 #define X_XF86MiscSetSaver 2 #endif #define X_XF86MiscGetMouseSettings 3 #define X_XF86MiscGetKbdSettings 4 #define X_XF86MiscSetMouseSettings 5 #define X_XF86MiscSetKbdSettings 6 #define X_XF86MiscSetGrabKeysState 7 #define X_XF86MiscSetClientVersion 8 #define X_XF86MiscGetFilePaths 9 #define X_XF86MiscPassMessage 10 #define XF86MiscNumberEvents 0 #define XF86MiscBadMouseProtocol 0 #define XF86MiscBadMouseBaudRate 1 #define XF86MiscBadMouseFlags 2 #define XF86MiscBadMouseCombo 3 #define XF86MiscBadKbdType 4 #define XF86MiscModInDevDisabled 5 #define XF86MiscModInDevClientNotLocal 6 #define XF86MiscNoModule 7 #define XF86MiscNumberErrors (XF86MiscNoModule + 1) /* Never renumber these */ #define MTYPE_MICROSOFT 0 #define MTYPE_MOUSESYS 1 #define MTYPE_MMSERIES 2 #define MTYPE_LOGITECH 3 #define MTYPE_BUSMOUSE 4 #define MTYPE_LOGIMAN 5 #define MTYPE_PS_2 6 #define MTYPE_MMHIT 7 #define MTYPE_GLIDEPOINT 8 #define MTYPE_IMSERIAL 9 #define MTYPE_THINKING 10 #define MTYPE_IMPS2 11 #define MTYPE_THINKINGPS2 12 #define MTYPE_MMANPLUSPS2 13 #define MTYPE_GLIDEPOINTPS2 14 #define MTYPE_NETPS2 15 #define MTYPE_NETSCROLLPS2 16 #define MTYPE_SYSMOUSE 17 #define MTYPE_AUTOMOUSE 18 #define MTYPE_ACECAD 19 #define MTYPE_EXPPS2 20 #define MTYPE_XQUEUE 127 #define MTYPE_OSMOUSE 126 #define MTYPE_UNKNOWN 125 #define KTYPE_UNKNOWN 0 #define KTYPE_84KEY 1 #define KTYPE_101KEY 2 #define KTYPE_OTHER 3 #define KTYPE_XQUEUE 4 #define MF_CLEAR_DTR 1 #define MF_CLEAR_RTS 2 #define MF_REOPEN 128 #ifndef _XF86MISC_SERVER_ /* return values for XF86MiscSetGrabKeysState */ #define MiscExtGrabStateSuccess 0 /* No errors */ #define MiscExtGrabStateLocked 1 /* A client already requested that * grabs cannot be removed/killed */ #define MiscExtGrabStateAlready 2 /* Request for enabling/disabling * grab removeal/kill already done */ _XFUNCPROTOBEGIN typedef struct { char* device; int type; int baudrate; int samplerate; int resolution; int buttons; Bool emulate3buttons; int emulate3timeout; Bool chordmiddle; int flags; } XF86MiscMouseSettings; typedef struct { int type; int rate; int delay; Bool servnumlock; } XF86MiscKbdSettings; typedef struct { char* configfile; char* modulepath; char* logfile; } XF86MiscFilePaths; Bool XF86MiscQueryVersion( Display* /* dpy */, int* /* majorVersion */, int* /* minorVersion */ ); Bool XF86MiscQueryExtension( Display* /* dpy */, int* /* event_base */, int* /* error_base */ ); Bool XF86MiscSetClientVersion( Display *dpy /* dpy */ ); Status XF86MiscGetMouseSettings( Display* /* dpy */, XF86MiscMouseSettings* /* mouse info */ ); Status XF86MiscGetKbdSettings( Display* /* dpy */, XF86MiscKbdSettings* /* keyboard info */ ); Status XF86MiscSetMouseSettings( Display* /* dpy */, XF86MiscMouseSettings* /* mouse info */ ); Status XF86MiscSetKbdSettings( Display* /* dpy */, XF86MiscKbdSettings* /* keyboard info */ ); int XF86MiscSetGrabKeysState( Display* /* dpy */, Bool /* enabled */ ); Status XF86MiscGetFilePaths( Display* /* dpy */, XF86MiscFilePaths* /* file paths/locations */ ); Status XF86MiscPassMessage( Display* /* dpy */, int /* screen */, const char* /* message name/type */, const char* /* message contents/value */, char ** /* returned message */ ); _XFUNCPROTOEND #endif #endif X11/extensions/xf86bigfstr.h000064400000000277147631660250011661 0ustar00#warning "xf86bigfstr.h is obsolete and may be removed in the future." #warning "include for the protocol defines." #include X11/extensions/XI2.h000064400000024456147631660250010114 0ustar00/* * Copyright © 2009 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * */ #ifndef _XI2_H_ #define _XI2_H_ #define XInput_2_0 7 /* DO NOT ADD TO THIS LIST. These are libXi-specific defines. See commit libXi-1.4.2-21-ge8531dd */ #define XI_2_Major 2 #define XI_2_Minor 3 /* Property event flags */ #define XIPropertyDeleted 0 #define XIPropertyCreated 1 #define XIPropertyModified 2 /* Property modes */ #define XIPropModeReplace 0 #define XIPropModePrepend 1 #define XIPropModeAppend 2 /* Special property type used for XIGetProperty */ #define XIAnyPropertyType 0L /* Enter/Leave and Focus In/Out modes */ #define XINotifyNormal 0 #define XINotifyGrab 1 #define XINotifyUngrab 2 #define XINotifyWhileGrabbed 3 #define XINotifyPassiveGrab 4 #define XINotifyPassiveUngrab 5 /* Enter/Leave and focus In/out detail */ #define XINotifyAncestor 0 #define XINotifyVirtual 1 #define XINotifyInferior 2 #define XINotifyNonlinear 3 #define XINotifyNonlinearVirtual 4 #define XINotifyPointer 5 #define XINotifyPointerRoot 6 #define XINotifyDetailNone 7 /* Grab modes */ #define XIGrabModeSync 0 #define XIGrabModeAsync 1 #define XIGrabModeTouch 2 /* Grab reply status codes */ #define XIGrabSuccess 0 #define XIAlreadyGrabbed 1 #define XIGrabInvalidTime 2 #define XIGrabNotViewable 3 #define XIGrabFrozen 4 /* Grab owner events values */ #define XIOwnerEvents True #define XINoOwnerEvents False /* Passive grab types */ #define XIGrabtypeButton 0 #define XIGrabtypeKeycode 1 #define XIGrabtypeEnter 2 #define XIGrabtypeFocusIn 3 #define XIGrabtypeTouchBegin 4 /* Passive grab modifier */ #define XIAnyModifier (1U << 31) #define XIAnyButton 0 #define XIAnyKeycode 0 /* XIAllowEvents event-modes */ #define XIAsyncDevice 0 #define XISyncDevice 1 #define XIReplayDevice 2 #define XIAsyncPairedDevice 3 #define XIAsyncPair 4 #define XISyncPair 5 #define XIAcceptTouch 6 #define XIRejectTouch 7 /* DeviceChangedEvent change reasons */ #define XISlaveSwitch 1 #define XIDeviceChange 2 /* Hierarchy flags */ #define XIMasterAdded (1 << 0) #define XIMasterRemoved (1 << 1) #define XISlaveAdded (1 << 2) #define XISlaveRemoved (1 << 3) #define XISlaveAttached (1 << 4) #define XISlaveDetached (1 << 5) #define XIDeviceEnabled (1 << 6) #define XIDeviceDisabled (1 << 7) /* ChangeHierarchy constants */ #define XIAddMaster 1 #define XIRemoveMaster 2 #define XIAttachSlave 3 #define XIDetachSlave 4 #define XIAttachToMaster 1 #define XIFloating 2 /* Valuator modes */ #define XIModeRelative 0 #define XIModeAbsolute 1 /* Device types */ #define XIMasterPointer 1 #define XIMasterKeyboard 2 #define XISlavePointer 3 #define XISlaveKeyboard 4 #define XIFloatingSlave 5 /* Device classes: classes that are not identical to Xi 1.x classes must be * numbered starting from 8. */ #define XIKeyClass 0 #define XIButtonClass 1 #define XIValuatorClass 2 #define XIScrollClass 3 #define XITouchClass 8 /* Scroll class types */ #define XIScrollTypeVertical 1 #define XIScrollTypeHorizontal 2 /* Scroll class flags */ #define XIScrollFlagNoEmulation (1 << 0) #define XIScrollFlagPreferred (1 << 1) /* Device event flags (common) */ /* Device event flags (key events only) */ #define XIKeyRepeat (1 << 16) /* Device event flags (pointer events only) */ #define XIPointerEmulated (1 << 16) /* Device event flags (touch events only) */ #define XITouchPendingEnd (1 << 16) #define XITouchEmulatingPointer (1 << 17) /* Barrier event flags */ #define XIBarrierPointerReleased (1 << 0) #define XIBarrierDeviceIsGrabbed (1 << 1) /* Touch modes */ #define XIDirectTouch 1 #define XIDependentTouch 2 /* XI2 event mask macros */ #define XISetMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] |= (1 << ((event) & 7))) #define XIClearMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] &= ~(1 << ((event) & 7))) #define XIMaskIsSet(ptr, event) (((unsigned char*)(ptr))[(event)>>3] & (1 << ((event) & 7))) #define XIMaskLen(event) (((event) >> 3) + 1) /* Fake device ID's for event selection */ #define XIAllDevices 0 #define XIAllMasterDevices 1 /* Event types */ #define XI_DeviceChanged 1 #define XI_KeyPress 2 #define XI_KeyRelease 3 #define XI_ButtonPress 4 #define XI_ButtonRelease 5 #define XI_Motion 6 #define XI_Enter 7 #define XI_Leave 8 #define XI_FocusIn 9 #define XI_FocusOut 10 #define XI_HierarchyChanged 11 #define XI_PropertyEvent 12 #define XI_RawKeyPress 13 #define XI_RawKeyRelease 14 #define XI_RawButtonPress 15 #define XI_RawButtonRelease 16 #define XI_RawMotion 17 #define XI_TouchBegin 18 /* XI 2.2 */ #define XI_TouchUpdate 19 #define XI_TouchEnd 20 #define XI_TouchOwnership 21 #define XI_RawTouchBegin 22 #define XI_RawTouchUpdate 23 #define XI_RawTouchEnd 24 #define XI_BarrierHit 25 /* XI 2.3 */ #define XI_BarrierLeave 26 #define XI_LASTEVENT XI_BarrierLeave /* NOTE: XI2LASTEVENT in xserver/include/inputstr.h must be the same value * as XI_LASTEVENT if the server is supposed to handle masks etc. for this * type of event. */ /* Event masks. * Note: the protocol spec defines a mask to be of (1 << type). Clients are * free to create masks by bitshifting instead of using these defines. */ #define XI_DeviceChangedMask (1 << XI_DeviceChanged) #define XI_KeyPressMask (1 << XI_KeyPress) #define XI_KeyReleaseMask (1 << XI_KeyRelease) #define XI_ButtonPressMask (1 << XI_ButtonPress) #define XI_ButtonReleaseMask (1 << XI_ButtonRelease) #define XI_MotionMask (1 << XI_Motion) #define XI_EnterMask (1 << XI_Enter) #define XI_LeaveMask (1 << XI_Leave) #define XI_FocusInMask (1 << XI_FocusIn) #define XI_FocusOutMask (1 << XI_FocusOut) #define XI_HierarchyChangedMask (1 << XI_HierarchyChanged) #define XI_PropertyEventMask (1 << XI_PropertyEvent) #define XI_RawKeyPressMask (1 << XI_RawKeyPress) #define XI_RawKeyReleaseMask (1 << XI_RawKeyRelease) #define XI_RawButtonPressMask (1 << XI_RawButtonPress) #define XI_RawButtonReleaseMask (1 << XI_RawButtonRelease) #define XI_RawMotionMask (1 << XI_RawMotion) #define XI_TouchBeginMask (1 << XI_TouchBegin) #define XI_TouchEndMask (1 << XI_TouchEnd) #define XI_TouchOwnershipChangedMask (1 << XI_TouchOwnership) #define XI_TouchUpdateMask (1 << XI_TouchUpdate) #define XI_RawTouchBeginMask (1 << XI_RawTouchBegin) #define XI_RawTouchEndMask (1 << XI_RawTouchEnd) #define XI_RawTouchUpdateMask (1 << XI_RawTouchUpdate) #define XI_BarrierHitMask (1 << XI_BarrierHit) #define XI_BarrierLeaveMask (1 << XI_BarrierLeave) #endif /* _XI2_H_ */ X11/extensions/presentproto.h000064400000013175147631660250012252 0ustar00/* * Copyright © 2013 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _PRESENT_PROTO_H_ #define _PRESENT_PROTO_H_ #include #define Window CARD32 #define Pixmap CARD32 #define Region CARD32 #define XSyncFence CARD32 #define EventID CARD32 typedef struct { Window window B32; CARD32 serial B32; } xPresentNotify; #define sz_xPresentNotify 8 typedef struct { CARD8 reqType; CARD8 presentReqType; CARD16 length B16; CARD32 majorVersion B32; CARD32 minorVersion B32; } xPresentQueryVersionReq; #define sz_xPresentQueryVersionReq 12 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 majorVersion B32; CARD32 minorVersion B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xPresentQueryVersionReply; #define sz_xPresentQueryVersionReply 32 typedef struct { CARD8 reqType; CARD8 presentReqType; CARD16 length B16; Window window B32; Pixmap pixmap B32; CARD32 serial B32; Region valid B32; Region update B32; INT16 x_off B16; INT16 y_off B16; CARD32 target_crtc B32; XSyncFence wait_fence B32; XSyncFence idle_fence B32; CARD32 options B32; CARD32 pad1 B32; CARD64 target_msc; CARD64 divisor; CARD64 remainder; /* followed by a LISTofPRESENTNOTIFY */ } xPresentPixmapReq; #define sz_xPresentPixmapReq 72 typedef struct { CARD8 reqType; CARD8 presentReqType; CARD16 length B16; Window window B32; CARD32 serial B32; CARD32 pad0 B32; CARD64 target_msc; CARD64 divisor; CARD64 remainder; } xPresentNotifyMSCReq; #define sz_xPresentNotifyMSCReq 40 typedef struct { CARD8 reqType; CARD8 presentReqType; CARD16 length B16; CARD32 eid B32; CARD32 window B32; CARD32 eventMask B32; } xPresentSelectInputReq; #define sz_xPresentSelectInputReq 16 typedef struct { CARD8 reqType; CARD8 presentReqType; CARD16 length B16; CARD32 target B32; } xPresentQueryCapabilitiesReq; #define sz_xPresentQueryCapabilitiesReq 8 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 capabilities B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xPresentQueryCapabilitiesReply; #define sz_xPresentQueryCapabilitiesReply 32 /* * Events * * All Present events are X Generic Events */ typedef struct { CARD8 type; CARD8 extension; CARD16 sequenceNumber B16; CARD32 length; CARD16 evtype B16; CARD16 pad2; CARD32 eid B32; CARD32 window B32; INT16 x B16; INT16 y B16; CARD16 width B16; CARD16 height B16; INT16 off_x B16; INT16 off_y B16; CARD16 pixmap_width B16; CARD16 pixmap_height B16; CARD32 pixmap_flags B32; } xPresentConfigureNotify; #define sz_xPresentConfigureNotify 40 typedef struct { CARD8 type; CARD8 extension; CARD16 sequenceNumber B16; CARD32 length; CARD16 evtype B16; CARD8 kind; CARD8 mode; CARD32 eid B32; Window window B32; CARD32 serial B32; CARD64 ust; CARD64 msc; } xPresentCompleteNotify; #define sz_xPresentCompleteNotify 40 typedef struct { CARD8 type; CARD8 extension; CARD16 sequenceNumber B16; CARD32 length; CARD16 evtype B16; CARD16 pad2 B16; CARD32 eid B32; Window window B32; CARD32 serial B32; Pixmap pixmap B32; CARD32 idle_fence B32; } xPresentIdleNotify; #define sz_xPresentIdleNotify 32 #if PRESENT_FUTURE_VERSION typedef struct { CARD8 type; CARD8 extension; CARD16 sequenceNumber B16; CARD32 length; CARD16 evtype B16; CARD8 update_window; CARD8 pad1; CARD32 eid B32; Window event_window B32; Window window B32; Pixmap pixmap B32; CARD32 serial B32; /* 32-byte boundary */ Region valid_region B32; Region update_region B32; xRectangle valid_rect; xRectangle update_rect; INT16 x_off B16; INT16 y_off B16; CARD32 target_crtc B32; XSyncFence wait_fence B32; XSyncFence idle_fence B32; CARD32 options B32; CARD32 pad2 B32; CARD64 target_msc; CARD64 divisor; CARD64 remainder; } xPresentRedirectNotify; #define sz_xPresentRedirectNotify 104 #endif #undef Window #undef Pixmap #undef Region #undef XSyncFence #undef EventID #endif X11/extensions/shm.h000064400000003155147631660250010272 0ustar00/************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ********************************************************/ /* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */ #ifndef _SHM_H_ #define _SHM_H_ #define SHMNAME "MIT-SHM" #define SHM_MAJOR_VERSION 1 /* current version numbers */ #define SHM_MINOR_VERSION 2 #define ShmCompletion 0 #define ShmNumberEvents (ShmCompletion + 1) #define BadShmSeg 0 #define ShmNumberErrors (BadShmSeg + 1) #endif /* _SHM_H_ */ X11/extensions/panoramiXproto.h000064400000013144147631660250012524 0ustar00/***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ /* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */ #ifndef _PANORAMIXPROTO_H_ #define _PANORAMIXPROTO_H_ #define PANORAMIX_MAJOR_VERSION 1 /* current version number */ #define PANORAMIX_MINOR_VERSION 1 #define PANORAMIX_PROTOCOL_NAME "XINERAMA" #define X_PanoramiXQueryVersion 0 #define X_PanoramiXGetState 1 #define X_PanoramiXGetScreenCount 2 #define X_PanoramiXGetScreenSize 3 #define X_XineramaIsActive 4 #define X_XineramaQueryScreens 5 typedef struct _PanoramiXQueryVersion { CARD8 reqType; /* always PanoramiXReqCode */ CARD8 panoramiXReqType; /* always X_PanoramiXQueryVersion */ CARD16 length B16; CARD8 clientMajor; CARD8 clientMinor; CARD16 unused B16; } xPanoramiXQueryVersionReq; #define sz_xPanoramiXQueryVersionReq 8 typedef struct { CARD8 type; /* must be X_Reply */ CARD8 pad1; /* unused */ CARD16 sequenceNumber B16; /* last sequence number */ CARD32 length B32; /* 0 */ CARD16 majorVersion B16; CARD16 minorVersion B16; CARD32 pad2 B32; /* unused */ CARD32 pad3 B32; /* unused */ CARD32 pad4 B32; /* unused */ CARD32 pad5 B32; /* unused */ CARD32 pad6 B32; /* unused */ } xPanoramiXQueryVersionReply; #define sz_xPanoramiXQueryVersionReply 32 typedef struct _PanoramiXGetState { CARD8 reqType; /* always PanoramiXReqCode */ CARD8 panoramiXReqType; /* always X_PanoramiXGetState */ CARD16 length B16; CARD32 window B32; } xPanoramiXGetStateReq; #define sz_xPanoramiXGetStateReq 8 typedef struct { BYTE type; BYTE state; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 window B32; CARD32 pad1 B32; /* unused */ CARD32 pad2 B32; /* unused */ CARD32 pad3 B32; /* unused */ CARD32 pad4 B32; /* unused */ CARD32 pad5 B32; /* unused */ } xPanoramiXGetStateReply; #define sz_panoramiXGetStateReply 32 typedef struct _PanoramiXGetScreenCount { CARD8 reqType; /* always PanoramiXReqCode */ CARD8 panoramiXReqType; /* always X_PanoramiXGetScreenCount */ CARD16 length B16; CARD32 window B32; } xPanoramiXGetScreenCountReq; #define sz_xPanoramiXGetScreenCountReq 8 typedef struct { BYTE type; BYTE ScreenCount; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 window B32; CARD32 pad1 B32; /* unused */ CARD32 pad2 B32; /* unused */ CARD32 pad3 B32; /* unused */ CARD32 pad4 B32; /* unused */ CARD32 pad5 B32; /* unused */ } xPanoramiXGetScreenCountReply; #define sz_panoramiXGetScreenCountReply 32 typedef struct _PanoramiXGetScreenSize { CARD8 reqType; /* always PanoramiXReqCode */ CARD8 panoramiXReqType; /* always X_PanoramiXGetState */ CARD16 length B16; CARD32 window B32; CARD32 screen B32; } xPanoramiXGetScreenSizeReq; #define sz_xPanoramiXGetScreenSizeReq 12 typedef struct { BYTE type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 width B32; CARD32 height B32; CARD32 window B32; CARD32 screen B32; CARD32 pad2 B32; /* unused */ CARD32 pad3 B32; /* unused */ } xPanoramiXGetScreenSizeReply; #define sz_panoramiXGetScreenSizeReply 32 /************ Alternate protocol ******************/ typedef struct { CARD8 reqType; CARD8 panoramiXReqType; CARD16 length B16; } xXineramaIsActiveReq; #define sz_xXineramaIsActiveReq 4 typedef struct { BYTE type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 state B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXineramaIsActiveReply; #define sz_XineramaIsActiveReply 32 typedef struct { CARD8 reqType; CARD8 panoramiXReqType; CARD16 length B16; } xXineramaQueryScreensReq; #define sz_xXineramaQueryScreensReq 4 typedef struct { BYTE type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 number B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXineramaQueryScreensReply; #define sz_XineramaQueryScreensReply 32 typedef struct { INT16 x_org B16; INT16 y_org B16; CARD16 width B16; CARD16 height B16; } xXineramaScreenInfo; #define sz_XineramaScreenInfo 8 #endif X11/extensions/XIproto.h000064400000123176147631660250011115 0ustar00/************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XIPROTO_H #define _XIPROTO_H #include #include /* make sure types have right sizes for protocol structures. */ #define Window CARD32 #define Time CARD32 #define KeyCode CARD8 #define Mask CARD32 #define Atom CARD32 #define Cursor CARD32 /********************************************************* * * number of events, errors, and extension name. * */ #define MORE_EVENTS 0x80 #define DEVICE_BITS 0x7F #define InputClassBits 0x3F /* bits in mode field for input classes */ #define ModeBitsShift 6 /* amount to shift the remaining bits */ #define numInputClasses 7 #define IEVENTS 17 /* does NOT include generic events */ #define IERRORS 5 #define IREQUESTS 39 #define CLIENT_REQ 1 typedef struct _XExtEventInfo { Mask mask; BYTE type; BYTE word; } XExtEventInfo; #ifndef _XITYPEDEF_POINTER typedef void *Pointer; #endif struct tmask { Mask mask; void *dev; }; /********************************************************* * * Event constants used by library. * */ #define XI_DeviceValuator 0 #define XI_DeviceKeyPress 1 #define XI_DeviceKeyRelease 2 #define XI_DeviceButtonPress 3 #define XI_DeviceButtonRelease 4 #define XI_DeviceMotionNotify 5 #define XI_DeviceFocusIn 6 #define XI_DeviceFocusOut 7 #define XI_ProximityIn 8 #define XI_ProximityOut 9 #define XI_DeviceStateNotify 10 #define XI_DeviceMappingNotify 11 #define XI_ChangeDeviceNotify 12 #define XI_DeviceKeystateNotify 13 #define XI_DeviceButtonstateNotify 14 #define XI_DevicePresenceNotify 15 #define XI_DevicePropertyNotify 16 /********************************************************* * * Protocol request constants * */ #define X_GetExtensionVersion 1 #define X_ListInputDevices 2 #define X_OpenDevice 3 #define X_CloseDevice 4 #define X_SetDeviceMode 5 #define X_SelectExtensionEvent 6 #define X_GetSelectedExtensionEvents 7 #define X_ChangeDeviceDontPropagateList 8 #define X_GetDeviceDontPropagateList 9 #define X_GetDeviceMotionEvents 10 #define X_ChangeKeyboardDevice 11 #define X_ChangePointerDevice 12 #define X_GrabDevice 13 #define X_UngrabDevice 14 #define X_GrabDeviceKey 15 #define X_UngrabDeviceKey 16 #define X_GrabDeviceButton 17 #define X_UngrabDeviceButton 18 #define X_AllowDeviceEvents 19 #define X_GetDeviceFocus 20 #define X_SetDeviceFocus 21 #define X_GetFeedbackControl 22 #define X_ChangeFeedbackControl 23 #define X_GetDeviceKeyMapping 24 #define X_ChangeDeviceKeyMapping 25 #define X_GetDeviceModifierMapping 26 #define X_SetDeviceModifierMapping 27 #define X_GetDeviceButtonMapping 28 #define X_SetDeviceButtonMapping 29 #define X_QueryDeviceState 30 #define X_SendExtensionEvent 31 #define X_DeviceBell 32 #define X_SetDeviceValuators 33 #define X_GetDeviceControl 34 #define X_ChangeDeviceControl 35 /* XI 1.5 */ #define X_ListDeviceProperties 36 #define X_ChangeDeviceProperty 37 #define X_DeleteDeviceProperty 38 #define X_GetDeviceProperty 39 /********************************************************* * * Protocol request and reply structures. * * GetExtensionVersion. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GetExtensionVersion */ CARD16 length B16; CARD16 nbytes B16; CARD8 pad1, pad2; } xGetExtensionVersionReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetExtensionVersion */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 major_version B16; CARD16 minor_version B16; BOOL present; CARD8 pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; } xGetExtensionVersionReply; /********************************************************* * * ListInputDevices. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_ListInputDevices */ CARD16 length B16; } xListInputDevicesReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_ListInputDevices */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 ndevices; CARD8 pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xListInputDevicesReply; typedef struct _xDeviceInfo *xDeviceInfoPtr; typedef struct _xAnyClassinfo *xAnyClassPtr; typedef struct _xAnyClassinfo { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 length; } xAnyClassInfo; typedef struct _xDeviceInfo { CARD32 type B32; CARD8 id; CARD8 num_classes; CARD8 use; /* IsXPointer | IsXKeyboard | IsXExtension... */ CARD8 attached; /* id of master dev (if IsXExtension..) */ } xDeviceInfo; typedef struct _xKeyInfo *xKeyInfoPtr; typedef struct _xKeyInfo { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 length; KeyCode min_keycode; KeyCode max_keycode; CARD16 num_keys B16; CARD8 pad1,pad2; } xKeyInfo; typedef struct _xButtonInfo *xButtonInfoPtr; typedef struct _xButtonInfo { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 length; CARD16 num_buttons B16; } xButtonInfo; typedef struct _xValuatorInfo *xValuatorInfoPtr; typedef struct _xValuatorInfo { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 length; CARD8 num_axes; CARD8 mode; CARD32 motion_buffer_size B32; } xValuatorInfo; typedef struct _xAxisInfo *xAxisInfoPtr; typedef struct _xAxisInfo { CARD32 resolution B32; CARD32 min_value B32; CARD32 max_value B32; } xAxisInfo; /********************************************************* * * OpenDevice. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_OpenDevice */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xOpenDeviceReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_OpenDevice */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 num_classes; BYTE pad1, pad2, pad3; CARD32 pad00 B32; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; } xOpenDeviceReply; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 event_type_base; } xInputClassInfo; /********************************************************* * * CloseDevice. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_CloseDevice */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xCloseDeviceReq; /********************************************************* * * SetDeviceMode. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_SetDeviceMode */ CARD16 length B16; CARD8 deviceid; CARD8 mode; BYTE pad1, pad2; } xSetDeviceModeReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_SetDeviceMode */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xSetDeviceModeReply; /********************************************************* * * SelectExtensionEvent. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_SelectExtensionEvent */ CARD16 length B16; Window window B32; CARD16 count B16; CARD16 pad00 B16; } xSelectExtensionEventReq; /********************************************************* * * GetSelectedExtensionEvent. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_GetSelectedExtensionEvents */ CARD16 length B16; Window window B32; } xGetSelectedExtensionEventsReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* GetSelectedExtensionEvents */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 this_client_count B16; CARD16 all_clients_count B16; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xGetSelectedExtensionEventsReply; /********************************************************* * * ChangeDeviceDontPropagateList. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_ChangeDeviceDontPropagateList */ CARD16 length B16; Window window B32; CARD16 count B16; CARD8 mode; BYTE pad; } xChangeDeviceDontPropagateListReq; /********************************************************* * * GetDeviceDontPropagateList. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_GetDeviceDontPropagateList */ CARD16 length B16; Window window B32; } xGetDeviceDontPropagateListReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* GetDeviceDontPropagateList */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 count B16; CARD16 pad00 B16; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xGetDeviceDontPropagateListReply; /********************************************************* * * GetDeviceMotionEvents. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GetDeviceMotionEvents*/ CARD16 length B16; Time start B32; Time stop B32; CARD8 deviceid; BYTE pad1, pad2, pad3; } xGetDeviceMotionEventsReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetDeviceMotionEvents */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 nEvents B32; CARD8 axes; CARD8 mode; BYTE pad1, pad2; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; } xGetDeviceMotionEventsReply; /********************************************************* * * ChangeKeyboardDevice. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_ChangeKeyboardDevice */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xChangeKeyboardDeviceReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_ChangeKeyboardDevice*/ CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xChangeKeyboardDeviceReply; /********************************************************* * * ChangePointerDevice. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_ChangePointerDevice */ CARD16 length B16; CARD8 xaxis; CARD8 yaxis; CARD8 deviceid; BYTE pad1; } xChangePointerDeviceReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_ChangePointerDevice */ CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xChangePointerDeviceReply; /********************************************************* * * GrabDevice. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GrabDevice */ CARD16 length B16; Window grabWindow B32; Time time B32; CARD16 event_count B16; CARD8 this_device_mode; CARD8 other_devices_mode; BOOL ownerEvents; CARD8 deviceid; CARD16 pad01 B16; } xGrabDeviceReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GrabDevice */ CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xGrabDeviceReply; /********************************************************* * * UngrabDevice. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_UnGrabDevice */ CARD16 length B16; Time time B32; CARD8 deviceid; BYTE pad1, pad2, pad3; } xUngrabDeviceReq; /********************************************************* * * GrabDeviceKey. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GrabDeviceKey */ CARD16 length B16; Window grabWindow B32; CARD16 event_count B16; CARD16 modifiers B16; CARD8 modifier_device; CARD8 grabbed_device; CARD8 key; BYTE this_device_mode; BYTE other_devices_mode; BOOL ownerEvents; BYTE pad1, pad2; } xGrabDeviceKeyReq; /********************************************************* * * UngrabDeviceKey. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_UngrabDeviceKey */ CARD16 length B16; Window grabWindow B32; CARD16 modifiers B16; CARD8 modifier_device; CARD8 key; CARD8 grabbed_device; BYTE pad1, pad2, pad3; } xUngrabDeviceKeyReq; /********************************************************* * * GrabDeviceButton. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GrabDeviceButton */ CARD16 length B16; Window grabWindow B32; CARD8 grabbed_device; CARD8 modifier_device; CARD16 event_count B16; CARD16 modifiers B16; BYTE this_device_mode; BYTE other_devices_mode; CARD8 button; BOOL ownerEvents; BYTE pad1, pad2; } xGrabDeviceButtonReq; /********************************************************* * * UngrabDeviceButton. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_UngrabDeviceButton */ CARD16 length B16; Window grabWindow B32; CARD16 modifiers B16; CARD8 modifier_device; CARD8 button; CARD8 grabbed_device; BYTE pad1, pad2, pad3; } xUngrabDeviceButtonReq; /********************************************************* * * AllowDeviceEvents. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_AllowDeviceEvents */ CARD16 length B16; Time time B32; CARD8 mode; CARD8 deviceid; BYTE pad1, pad2; } xAllowDeviceEventsReq; /********************************************************* * * GetDeviceFocus. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GetDeviceFocus */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xGetDeviceFocusReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetDeviceFocus */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 focus B32; Time time B32; CARD8 revertTo; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; } xGetDeviceFocusReply; /********************************************************* * * SetDeviceFocus. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_SetDeviceFocus */ CARD16 length B16; Window focus B32; Time time B32; CARD8 revertTo; CARD8 device; CARD16 pad01 B16; } xSetDeviceFocusReq; /********************************************************* * * GetFeedbackControl. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_GetFeedbackControl */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xGetFeedbackControlReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetFeedbackControl */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 num_feedbacks B16; CARD16 pad01 B16; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; CARD32 pad06 B32; } xGetFeedbackControlReply; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class */ #else CARD8 class; /* feedback class */ #endif CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ } xFeedbackState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 id; CARD16 length B16; CARD16 pitch B16; CARD16 duration B16; CARD32 led_mask B32; CARD32 led_values B32; BOOL global_auto_repeat; CARD8 click; CARD8 percent; BYTE pad; BYTE auto_repeats[32]; } xKbdFeedbackState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 id; CARD16 length B16; CARD8 pad1,pad2; CARD16 accelNum B16; CARD16 accelDenom B16; CARD16 threshold B16; } xPtrFeedbackState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; CARD16 length B16; /* feedback length */ CARD32 resolution B32; INT32 min_value B32; INT32 max_value B32; } xIntegerFeedbackState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; CARD16 length B16; /* feedback length */ CARD16 max_symbols B16; CARD16 num_syms_supported B16; } xStringFeedbackState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; CARD16 length B16; /* feedback length */ CARD8 percent; BYTE pad1, pad2, pad3; CARD16 pitch B16; CARD16 duration B16; } xBellFeedbackState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; CARD16 length B16; /* feedback length */ CARD32 led_mask B32; CARD32 led_values B32; } xLedFeedbackState; /********************************************************* * * ChangeFeedbackControl. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_ChangeFeedbackControl */ CARD16 length B16; CARD32 mask B32; CARD8 deviceid; CARD8 feedbackid; BYTE pad1, pad2; } xChangeFeedbackControlReq; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ } xFeedbackCtl; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; /* feedback length */ CARD16 length B16; /* feedback length */ KeyCode key; CARD8 auto_repeat_mode; INT8 click; INT8 percent; INT16 pitch B16; INT16 duration B16; CARD32 led_mask B32; CARD32 led_values B32; } xKbdFeedbackCtl; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ CARD8 pad1,pad2; INT16 num B16; INT16 denom B16; INT16 thresh B16; } xPtrFeedbackCtl; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ INT32 int_to_display B32; } xIntegerFeedbackCtl; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ CARD8 pad1,pad2; CARD16 num_keysyms B16; } xStringFeedbackCtl; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ INT8 percent; BYTE pad1, pad2, pad3; INT16 pitch B16; INT16 duration B16; } xBellFeedbackCtl; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ CARD32 led_mask B32; CARD32 led_values B32; } xLedFeedbackCtl; /********************************************************* * * GetDeviceKeyMapping. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GetDeviceKeyMapping */ CARD16 length B16; CARD8 deviceid; KeyCode firstKeyCode; CARD8 count; BYTE pad1; } xGetDeviceKeyMappingReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetDeviceKeyMapping */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 keySymsPerKeyCode; CARD8 pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetDeviceKeyMappingReply; /********************************************************* * * ChangeDeviceKeyMapping. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_ChangeDeviceKeyMapping */ CARD16 length B16; CARD8 deviceid; KeyCode firstKeyCode; CARD8 keySymsPerKeyCode; CARD8 keyCodes; } xChangeDeviceKeyMappingReq; /********************************************************* * * GetDeviceModifierMapping. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GetDeviceModifierMapping */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xGetDeviceModifierMappingReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetDeviceModifierMapping */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 numKeyPerModifier; CARD8 pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetDeviceModifierMappingReply; /********************************************************* * * SetDeviceModifierMapping. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_SetDeviceModifierMapping */ CARD16 length B16; CARD8 deviceid; CARD8 numKeyPerModifier; CARD16 pad1 B16; } xSetDeviceModifierMappingReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_SetDeviceModifierMapping */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 success; CARD8 pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xSetDeviceModifierMappingReply; /********************************************************* * * GetDeviceButtonMapping. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_GetDeviceButtonMapping */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xGetDeviceButtonMappingReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetDeviceButtonMapping */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 nElts; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xGetDeviceButtonMappingReply; /********************************************************* * * SetDeviceButtonMapping. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_SetDeviceButtonMapping */ CARD16 length B16; CARD8 deviceid; CARD8 map_length; BYTE pad1, pad2; } xSetDeviceButtonMappingReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_SetDeviceButtonMapping */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 status; BYTE pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xSetDeviceButtonMappingReply; /********************************************************* * * QueryDeviceState. * */ typedef struct { CARD8 reqType; CARD8 ReqType; /* always X_QueryDeviceState */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xQueryDeviceStateReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_QueryDeviceState */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 num_classes; BYTE pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xQueryDeviceStateReply; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 length; CARD8 num_keys; BYTE pad1; CARD8 keys[32]; } xKeyState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 length; CARD8 num_buttons; BYTE pad1; CARD8 buttons[32]; } xButtonState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 length; CARD8 num_valuators; CARD8 mode; } xValuatorState; /********************************************************* * * SendExtensionEvent. * THIS REQUEST MUST BE KEPT A MULTIPLE OF 8 BYTES IN LENGTH! * MORE EVENTS MAY FOLLOW AND THEY MUST BE QUAD-ALIGNED! * */ typedef struct { CARD8 reqType; CARD8 ReqType; /* always X_SendExtensionEvent */ CARD16 length B16; Window destination B32; CARD8 deviceid; BOOL propagate; CARD16 count B16; CARD8 num_events; BYTE pad1,pad2,pad3; } xSendExtensionEventReq; /********************************************************* * * DeviceBell. * */ typedef struct { CARD8 reqType; CARD8 ReqType; /* always X_DeviceBell */ CARD16 length B16; CARD8 deviceid; CARD8 feedbackid; CARD8 feedbackclass; INT8 percent; } xDeviceBellReq; /********************************************************* * * SetDeviceValuators. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_SetDeviceValuators */ CARD16 length B16; CARD8 deviceid; CARD8 first_valuator; CARD8 num_valuators; BYTE pad1; } xSetDeviceValuatorsReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_SetDeviceValuators */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xSetDeviceValuatorsReply; /********************************************************* * * GetDeviceControl. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GetDeviceControl */ CARD16 length B16; CARD16 control B16; CARD8 deviceid; BYTE pad2; } xGetDeviceControlReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetDeviceControl */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xGetDeviceControlReply; typedef struct { CARD16 control B16; /* control type */ CARD16 length B16; /* control length */ } xDeviceState; typedef struct { CARD16 control B16; /* control type */ CARD16 length B16; /* control length */ CARD32 num_valuators B32; /* number of valuators */ } xDeviceResolutionState; typedef struct { CARD16 control B16; CARD16 length B16; INT32 min_x B32; INT32 max_x B32; INT32 min_y B32; INT32 max_y B32; CARD32 flip_x B32; CARD32 flip_y B32; CARD32 rotation B32; CARD32 button_threshold B32; } xDeviceAbsCalibState; typedef struct { CARD16 control B16; CARD16 length B16; CARD32 offset_x B32; CARD32 offset_y B32; CARD32 width B32; CARD32 height B32; CARD32 screen B32; CARD32 following B32; } xDeviceAbsAreaState; typedef struct { CARD16 control B16; /* control type */ CARD16 length B16; /* control length */ CARD8 status; CARD8 iscore; CARD16 pad1 B16; } xDeviceCoreState; typedef struct { CARD16 control B16; /* control type */ CARD16 length B16; /* control length */ CARD8 enable; CARD8 pad0; CARD16 pad1 B16; } xDeviceEnableState; /********************************************************* * * ChangeDeviceControl. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_ChangeDeviceControl */ CARD16 length B16; CARD16 control B16; CARD8 deviceid; BYTE pad0; } xChangeDeviceControlReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_ChangeDeviceControl */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xChangeDeviceControlReply; typedef struct { CARD16 control B16; /* control type */ CARD16 length B16; /* control length */ } xDeviceCtl; typedef struct { CARD16 control B16; /* control type */ CARD16 length B16; /* control length */ CARD8 first_valuator; /* first valuator to change */ CARD8 num_valuators; /* number of valuators to change*/ CARD8 pad1,pad2; } xDeviceResolutionCtl; typedef struct { CARD16 control B16; CARD16 length B16; INT32 min_x; INT32 max_x; INT32 min_y; INT32 max_y; CARD32 flip_x; CARD32 flip_y; CARD32 rotation; CARD32 button_threshold; } xDeviceAbsCalibCtl; typedef struct { CARD16 control B16; CARD16 length B16; CARD32 offset_x; CARD32 offset_y; INT32 width; INT32 height; INT32 screen; CARD32 following; } xDeviceAbsAreaCtl; typedef struct { CARD16 control B16; CARD16 length B16; CARD8 status; CARD8 pad0; CARD16 pad1 B16; } xDeviceCoreCtl; typedef struct { CARD16 control B16; CARD16 length B16; CARD8 enable; CARD8 pad0; CARD16 pad1 B16; } xDeviceEnableCtl; /* XI 1.5 */ /********************************************************* * * ListDeviceProperties. * */ typedef struct { CARD8 reqType; /* input extension major opcode */ CARD8 ReqType; /* always X_ListDeviceProperties */ CARD16 length B16; CARD8 deviceid; CARD8 pad0; CARD16 pad1 B16; } xListDevicePropertiesReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_ListDeviceProperties */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nAtoms B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xListDevicePropertiesReply; /********************************************************* * * ChangeDeviceProperty. * */ typedef struct { CARD8 reqType; /* input extension major opcode */ CARD8 ReqType; /* always X_ChangeDeviceProperty */ CARD16 length B16; Atom property B32; Atom type B32; CARD8 deviceid; CARD8 format; CARD8 mode; CARD8 pad; CARD32 nUnits B32; } xChangeDevicePropertyReq; /********************************************************* * * DeleteDeviceProperty. * */ typedef struct { CARD8 reqType; /* input extension major opcode */ CARD8 ReqType; /* always X_DeleteDeviceProperty */ CARD16 length B16; Atom property B32; CARD8 deviceid; CARD8 pad0; CARD16 pad1 B16; } xDeleteDevicePropertyReq; /********************************************************* * * GetDeviceProperty. * */ typedef struct { CARD8 reqType; /* input extension major opcode */ CARD8 ReqType; /* always X_GetDeviceProperty */ CARD16 length B16; Atom property B32; Atom type B32; CARD32 longOffset B32; CARD32 longLength B32; CARD8 deviceid; #if defined(__cplusplus) || defined(c_plusplus) BOOL c_delete; #else BOOL delete; #endif CARD16 pad; } xGetDevicePropertyReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetDeviceProperty */ CARD16 sequenceNumber B16; CARD32 length B32; Atom propertyType B32; CARD32 bytesAfter B32; CARD32 nItems B32; CARD8 format; CARD8 deviceid; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; } xGetDevicePropertyReply; /********************************************************** * * Input extension events. * * DeviceValuator * */ typedef struct { BYTE type; CARD8 deviceid; CARD16 sequenceNumber B16; KeyButMask device_state B16; CARD8 num_valuators; CARD8 first_valuator; INT32 valuator0 B32; INT32 valuator1 B32; INT32 valuator2 B32; INT32 valuator3 B32; INT32 valuator4 B32; INT32 valuator5 B32; } deviceValuator; /********************************************************** * * DeviceKeyButtonPointer. * * Used for: DeviceKeyPress, DeviceKeyRelease, * DeviceButtonPress, DeviceButtonRelease, * ProximityIn, ProximityOut * DeviceMotionNotify, * */ typedef struct { BYTE type; BYTE detail; CARD16 sequenceNumber B16; Time time B32; Window root B32; Window event B32; Window child B32; INT16 root_x B16; INT16 root_y B16; INT16 event_x B16; INT16 event_y B16; KeyButMask state B16; BOOL same_screen; CARD8 deviceid; } deviceKeyButtonPointer; /********************************************************** * * DeviceFocus. * */ typedef struct { BYTE type; BYTE detail; CARD16 sequenceNumber B16; Time time B32; Window window B32; BYTE mode; CARD8 deviceid; BYTE pad1, pad2; CARD32 pad00 B32; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; } deviceFocus; /********************************************************** * * DeviceStateNotify. * * Note that the two high-order bits in the classes_reported * field are the proximity state (InProximity or OutOfProximity), * and the device mode (Absolute or Relative), respectively. * */ typedef struct { BYTE type; BYTE deviceid; CARD16 sequenceNumber B16; Time time B32; CARD8 num_keys; CARD8 num_buttons; CARD8 num_valuators; CARD8 classes_reported; CARD8 buttons[4]; CARD8 keys[4]; INT32 valuator0 B32; INT32 valuator1 B32; INT32 valuator2 B32; } deviceStateNotify; /********************************************************** * * DeviceKeyStateNotify. * */ typedef struct { BYTE type; BYTE deviceid; CARD16 sequenceNumber B16; CARD8 keys[28]; } deviceKeyStateNotify; /********************************************************** * * DeviceButtonStateNotify. * */ typedef struct { BYTE type; BYTE deviceid; CARD16 sequenceNumber B16; CARD8 buttons[28]; } deviceButtonStateNotify; /********************************************************** * * DeviceMappingNotify. * Fields must be kept in sync with core mappingnotify event. * */ typedef struct { BYTE type; BYTE deviceid; CARD16 sequenceNumber B16; CARD8 request; KeyCode firstKeyCode; CARD8 count; BYTE pad1; Time time B32; CARD32 pad00 B32; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; } deviceMappingNotify; /********************************************************** * * ChangeDeviceNotify. * */ typedef struct { BYTE type; BYTE deviceid; CARD16 sequenceNumber B16; Time time B32; CARD8 request; BYTE pad1, pad2, pad3; CARD32 pad00 B32; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; } changeDeviceNotify; /********************************************************** * * devicePresenceNotify. * */ typedef struct { BYTE type; BYTE pad00; CARD16 sequenceNumber B16; Time time B32; BYTE devchange; /* Device{Added|Removed|Enabled|Disabled|ControlChanged} */ BYTE deviceid; CARD16 control B16; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; CARD32 pad06 B32; } devicePresenceNotify; /********************************************************* * DevicePropertyNotifyEvent * * Sent whenever a device's property changes. * */ typedef struct { BYTE type; BYTE state; /* NewValue or Deleted */ CARD16 sequenceNumber B16; CARD32 time B32; Atom atom B32; /* affected property */ CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD16 pad5 B16; CARD8 pad4; CARD8 deviceid; /* id of device */ } devicePropertyNotify; #undef Window #undef Time #undef KeyCode #undef Mask #undef Atom #undef Cursor #endif X11/extensions/saverproto.h000064400000012220147631660250011700 0ustar00/* Copyright (c) 1992 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ #ifndef _SAVERPROTO_H_ #define _SAVERPROTO_H_ #include #define Window CARD32 #define Drawable CARD32 #define Font CARD32 #define Pixmap CARD32 #define Cursor CARD32 #define Colormap CARD32 #define GContext CARD32 #define Atom CARD32 #define VisualID CARD32 #define Time CARD32 #define KeyCode CARD8 #define KeySym CARD32 #define X_ScreenSaverQueryVersion 0 typedef struct _ScreenSaverQueryVersion { CARD8 reqType; /* always ScreenSaverReqCode */ CARD8 saverReqType; /* always X_ScreenSaverQueryVersion */ CARD16 length B16; CARD8 clientMajor; CARD8 clientMinor; CARD16 unused B16; } xScreenSaverQueryVersionReq; #define sz_xScreenSaverQueryVersionReq 8 typedef struct { CARD8 type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of protocol */ CARD16 minorVersion B16; /* minor version of protocol */ CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xScreenSaverQueryVersionReply; #define sz_xScreenSaverQueryVersionReply 32 #define X_ScreenSaverQueryInfo 1 typedef struct _ScreenSaverQueryInfo { CARD8 reqType; /* always ScreenSaverReqCode */ CARD8 saverReqType; /* always X_ScreenSaverQueryInfo */ CARD16 length B16; Drawable drawable B32; } xScreenSaverQueryInfoReq; #define sz_xScreenSaverQueryInfoReq 8 typedef struct { CARD8 type; /* X_Reply */ BYTE state; /* Off, On */ CARD16 sequenceNumber B16; CARD32 length B32; Window window B32; CARD32 tilOrSince B32; CARD32 idle B32; CARD32 eventMask B32; BYTE kind; /* Blanked, Internal, External */ CARD8 pad0; CARD16 pad1 B16; CARD32 pad2 B32; } xScreenSaverQueryInfoReply; #define sz_xScreenSaverQueryInfoReply 32 #define X_ScreenSaverSelectInput 2 typedef struct _ScreenSaverSelectInput { CARD8 reqType; /* always ScreenSaverReqCode */ CARD8 saverReqType; /* always X_ScreenSaverSelectInput */ CARD16 length B16; Drawable drawable B32; CARD32 eventMask B32; } xScreenSaverSelectInputReq; #define sz_xScreenSaverSelectInputReq 12 #define X_ScreenSaverSetAttributes 3 typedef struct _ScreenSaverSetAttributes { CARD8 reqType; /* always ScreenSaverReqCode */ CARD8 saverReqType; /* always X_ScreenSaverSetAttributes */ CARD16 length B16; Drawable drawable B32; INT16 x B16, y B16; CARD16 width B16, height B16, borderWidth B16; BYTE c_class; CARD8 depth; VisualID visualID B32; CARD32 mask B32; } xScreenSaverSetAttributesReq; #define sz_xScreenSaverSetAttributesReq 28 #define X_ScreenSaverUnsetAttributes 4 typedef struct _ScreenSaverUnsetAttributes { CARD8 reqType; /* always ScreenSaverReqCode */ CARD8 saverReqType; /* always X_ScreenSaverUnsetAttributes */ CARD16 length B16; Drawable drawable B32; } xScreenSaverUnsetAttributesReq; #define sz_xScreenSaverUnsetAttributesReq 8 #define X_ScreenSaverSuspend 5 typedef struct _ScreenSaverSuspend { CARD8 reqType; CARD8 saverReqType; CARD16 length B16; Bool suspend B32; } xScreenSaverSuspendReq; #define sz_xScreenSaverSuspendReq 8 typedef struct _ScreenSaverNotify { CARD8 type; /* always eventBase + ScreenSaverNotify */ BYTE state; /* off, on, cycle */ CARD16 sequenceNumber B16; Time timestamp B32; Window root B32; Window window B32; /* screen saver window */ BYTE kind; /* blanked, internal, external */ BYTE forced; CARD16 pad0 B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xScreenSaverNotifyEvent; #define sz_xScreenSaverNotifyEvent 32 #undef Window #undef Drawable #undef Font #undef Pixmap #undef Cursor #undef Colormap #undef GContext #undef Atom #undef VisualID #undef Time #undef KeyCode #undef KeySym #endif /* _SAVERPROTO_H_ */ X11/extensions/Xvproto.h000064400000031502147631660250011161 0ustar00/*********************************************************** Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts, and the Massachusetts Institute of Technology, Cambridge, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or MIT not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef XVPROTO_H #define XVPROTO_H /* ** File: ** ** Xvproto.h --- Xv protocol header file ** ** Author: ** ** David Carver (Digital Workstation Engineering/Project Athena) ** ** Revisions: ** ** 11.06.91 Carver ** - changed SetPortControl to SetPortAttribute ** - changed GetPortControl to GetPortAttribute ** - changed QueryBestSize ** ** 15.05.91 Carver ** - version 2.0 upgrade ** ** 24.01.91 Carver ** - version 1.4 upgrade ** */ #include /* Symbols: These are undefined at the end of this file to restore the values they have in Xv.h */ #define XvPortID CARD32 #define XvEncodingID CARD32 #define ShmSeg CARD32 #define VisualID CARD32 #define Drawable CARD32 #define GContext CARD32 #define Time CARD32 #define Atom CARD32 /* Structures */ typedef struct { INT32 numerator B32; INT32 denominator B32; } xvRational; #define sz_xvRational 8 typedef struct { XvPortID base_id B32; CARD16 name_size B16; CARD16 num_ports B16; CARD16 num_formats B16; CARD8 type; CARD8 pad; } xvAdaptorInfo; #define sz_xvAdaptorInfo 12 typedef struct { XvEncodingID encoding B32; CARD16 name_size B16; CARD16 width B16, height B16; CARD16 pad B16; xvRational rate; } xvEncodingInfo; #define sz_xvEncodingInfo (12 + sz_xvRational) typedef struct { VisualID visual B32; CARD8 depth; CARD8 pad1; CARD16 pad2 B16; } xvFormat; #define sz_xvFormat 8 typedef struct { CARD32 flags B32; INT32 min B32; INT32 max B32; CARD32 size B32; } xvAttributeInfo; #define sz_xvAttributeInfo 16 typedef struct { CARD32 id B32; CARD8 type; CARD8 byte_order; CARD16 pad1 B16; CARD8 guid[16]; CARD8 bpp; CARD8 num_planes; CARD16 pad2 B16; CARD8 depth; CARD8 pad3; CARD16 pad4 B16; CARD32 red_mask B32; CARD32 green_mask B32; CARD32 blue_mask B32; CARD8 format; CARD8 pad5; CARD16 pad6 B16; CARD32 y_sample_bits B32; CARD32 u_sample_bits B32; CARD32 v_sample_bits B32; CARD32 horz_y_period B32; CARD32 horz_u_period B32; CARD32 horz_v_period B32; CARD32 vert_y_period B32; CARD32 vert_u_period B32; CARD32 vert_v_period B32; CARD8 comp_order[32]; CARD8 scanline_order; CARD8 pad7; CARD16 pad8 B16; CARD32 pad9 B32; CARD32 pad10 B32; } xvImageFormatInfo; #define sz_xvImageFormatInfo 128 /* Requests */ #define xv_QueryExtension 0 #define xv_QueryAdaptors 1 #define xv_QueryEncodings 2 #define xv_GrabPort 3 #define xv_UngrabPort 4 #define xv_PutVideo 5 #define xv_PutStill 6 #define xv_GetVideo 7 #define xv_GetStill 8 #define xv_StopVideo 9 #define xv_SelectVideoNotify 10 #define xv_SelectPortNotify 11 #define xv_QueryBestSize 12 #define xv_SetPortAttribute 13 #define xv_GetPortAttribute 14 #define xv_QueryPortAttributes 15 #define xv_ListImageFormats 16 #define xv_QueryImageAttributes 17 #define xv_PutImage 18 #define xv_ShmPutImage 19 #define xv_LastRequest xv_ShmPutImage #define xvNumRequests (xv_LastRequest + 1) typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; } xvQueryExtensionReq; #define sz_xvQueryExtensionReq 4 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; CARD32 window B32; } xvQueryAdaptorsReq; #define sz_xvQueryAdaptorsReq 8 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; CARD32 port B32; } xvQueryEncodingsReq; #define sz_xvQueryEncodingsReq 8 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Drawable drawable B32; GContext gc B32; INT16 vid_x B16; INT16 vid_y B16; CARD16 vid_w B16; CARD16 vid_h B16; INT16 drw_x B16; INT16 drw_y B16; CARD16 drw_w B16; CARD16 drw_h B16; } xvPutVideoReq; #define sz_xvPutVideoReq 32 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Drawable drawable B32; GContext gc B32; INT16 vid_x B16; INT16 vid_y B16; CARD16 vid_w B16; CARD16 vid_h B16; INT16 drw_x B16; INT16 drw_y B16; CARD16 drw_w B16; CARD16 drw_h B16; } xvPutStillReq; #define sz_xvPutStillReq 32 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Drawable drawable B32; GContext gc B32; INT16 vid_x B16; INT16 vid_y B16; CARD16 vid_w B16; CARD16 vid_h B16; INT16 drw_x B16; INT16 drw_y B16; CARD16 drw_w B16; CARD16 drw_h B16; } xvGetVideoReq; #define sz_xvGetVideoReq 32 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Drawable drawable B32; GContext gc B32; INT16 vid_x B16; INT16 vid_y B16; CARD16 vid_w B16; CARD16 vid_h B16; INT16 drw_x B16; INT16 drw_y B16; CARD16 drw_w B16; CARD16 drw_h B16; } xvGetStillReq; #define sz_xvGetStillReq 32 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Time time B32; } xvGrabPortReq; #define sz_xvGrabPortReq 12 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Time time B32; } xvUngrabPortReq; #define sz_xvUngrabPortReq 12 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; Drawable drawable B32; BOOL onoff; CARD8 pad1; CARD16 pad2; } xvSelectVideoNotifyReq; #define sz_xvSelectVideoNotifyReq 12 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; BOOL onoff; CARD8 pad1; CARD16 pad2; } xvSelectPortNotifyReq; #define sz_xvSelectPortNotifyReq 12 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Drawable drawable B32; } xvStopVideoReq; #define sz_xvStopVideoReq 12 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Atom attribute B32; INT32 value B32; } xvSetPortAttributeReq; #define sz_xvSetPortAttributeReq 16 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Atom attribute B32; } xvGetPortAttributeReq; #define sz_xvGetPortAttributeReq 12 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; CARD16 vid_w B16; CARD16 vid_h B16; CARD16 drw_w B16; CARD16 drw_h B16; CARD8 motion; CARD8 pad1; CARD16 pad2 B16; } xvQueryBestSizeReq; #define sz_xvQueryBestSizeReq 20 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; } xvQueryPortAttributesReq; #define sz_xvQueryPortAttributesReq 8 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Drawable drawable B32; GContext gc B32; CARD32 id B32; INT16 src_x B16; INT16 src_y B16; CARD16 src_w B16; CARD16 src_h B16; INT16 drw_x B16; INT16 drw_y B16; CARD16 drw_w B16; CARD16 drw_h B16; CARD16 width B16; CARD16 height B16; } xvPutImageReq; #define sz_xvPutImageReq 40 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Drawable drawable B32; GContext gc B32; ShmSeg shmseg B32; CARD32 id B32; CARD32 offset B32; INT16 src_x B16; INT16 src_y B16; CARD16 src_w B16; CARD16 src_h B16; INT16 drw_x B16; INT16 drw_y B16; CARD16 drw_w B16; CARD16 drw_h B16; CARD16 width B16; CARD16 height B16; CARD8 send_event; CARD8 pad1; CARD16 pad2 B16; } xvShmPutImageReq; #define sz_xvShmPutImageReq 52 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; } xvListImageFormatsReq; #define sz_xvListImageFormatsReq 8 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; CARD32 port B32; CARD32 id B32; CARD16 width B16; CARD16 height B16; } xvQueryImageAttributesReq; #define sz_xvQueryImageAttributesReq 16 /* Replies */ typedef struct _QueryExtensionReply { BYTE type; /* X_Reply */ CARD8 padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 version B16; CARD16 revision B16; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } xvQueryExtensionReply; #define sz_xvQueryExtensionReply 32 typedef struct _QueryAdaptorsReply { BYTE type; /* X_Reply */ CARD8 padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 num_adaptors B16; CARD16 pads3 B16; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } xvQueryAdaptorsReply; #define sz_xvQueryAdaptorsReply 32 typedef struct _QueryEncodingsReply { BYTE type; /* X_Reply */ CARD8 padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 num_encodings B16; CARD16 padl3 B16; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } xvQueryEncodingsReply; #define sz_xvQueryEncodingsReply 32 typedef struct { BYTE type; /* X_Reply */ BYTE result; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD32 padl3 B32; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } xvGrabPortReply; #define sz_xvGrabPortReply 32 typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ INT32 value B32; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } xvGetPortAttributeReply; #define sz_xvGetPortAttributeReply 32 typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 actual_width B16; CARD16 actual_height B16; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } xvQueryBestSizeReply; #define sz_xvQueryBestSizeReply 32 typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD32 num_attributes B32; CARD32 text_size B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } xvQueryPortAttributesReply; #define sz_xvQueryPortAttributesReply 32 typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 num_formats B32; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } xvListImageFormatsReply; #define sz_xvListImageFormatsReply 32 typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 num_planes B32; CARD32 data_size B32; CARD16 width B16; CARD16 height B16; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } xvQueryImageAttributesReply; #define sz_xvQueryImageAttributesReply 32 /* DEFINE EVENT STRUCTURE */ typedef struct { union { struct { BYTE type; BYTE detail; CARD16 sequenceNumber B16; } u; struct { BYTE type; BYTE reason; CARD16 sequenceNumber B16; Time time B32; Drawable drawable B32; XvPortID port B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } videoNotify; struct { BYTE type; BYTE padb1; CARD16 sequenceNumber B16; Time time B32; XvPortID port B32; Atom attribute B32; INT32 value B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } portNotify; } u; } xvEvent; #undef XvPortID #undef XvEncodingID #undef ShmSeg #undef VisualID #undef Drawable #undef GContext #undef Time #undef Atom #endif /* XVPROTO_H */ X11/extensions/securproto.h000064400000006366147631660250011717 0ustar00/* Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _SECURPROTO_H #define _SECURPROTO_H #include #define X_SecurityQueryVersion 0 #define X_SecurityGenerateAuthorization 1 #define X_SecurityRevokeAuthorization 2 typedef struct { CARD8 reqType; CARD8 securityReqType; CARD16 length B16; CARD16 majorVersion B16; CARD16 minorVersion B16; } xSecurityQueryVersionReq; #define sz_xSecurityQueryVersionReq 8 typedef struct { CARD8 type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; CARD16 minorVersion B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xSecurityQueryVersionReply; #define sz_xSecurityQueryVersionReply 32 typedef struct { CARD8 reqType; CARD8 securityReqType; CARD16 length B16; CARD16 nbytesAuthProto B16; CARD16 nbytesAuthData B16; CARD32 valueMask B32; /* auth protocol name padded to 4 bytes */ /* auth protocol data padded to 4 bytes */ /* list of CARD32 values, if any */ } xSecurityGenerateAuthorizationReq; #define sz_xSecurityGenerateAuthorizationReq 12 typedef struct { CARD8 type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 authId B32; CARD16 dataLength B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xSecurityGenerateAuthorizationReply; #define sz_xSecurityGenerateAuthorizationReply 32 typedef struct { CARD8 reqType; CARD8 securityReqType; CARD16 length B16; CARD32 authId B32; } xSecurityRevokeAuthorizationReq; #define sz_xSecurityRevokeAuthorizationReq 8 typedef struct _xSecurityAuthorizationRevokedEvent { BYTE type; BYTE detail; CARD16 sequenceNumber B16; CARD32 authId B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xSecurityAuthorizationRevokedEvent; #define sz_xSecurityAuthorizationRevokedEvent 32 #endif /* _SECURPROTO_H */ X11/extensions/XI2proto.h000064400000111216147631660250011167 0ustar00/* * Copyright © 2009 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * */ /* Conventions for this file: * Names: * structs: always typedef'd, prefixed with xXI, CamelCase * struct members: lower_case_with_underscores * Exceptions: reqType, ReqType, repType, RepType, sequenceNumber are * named as such for historical reasons. * request opcodes: X_XIRequestName as CamelCase * defines: defines used in client applications must go in XI2.h * defines used only in protocol handling: XISOMENAME * * Data types: unless there is a historical name for a datatype (e.g. * Window), use stdint types specifying the size of the datatype. * historical data type names must be defined and undefined at the top and * end of the file. * * General: * spaces, not tabs. * structs specific to a request or reply added before the request * definition. structs used in more than one request, reply or event * appended to the common structs section before the definition of the * first request. * members of structs vertically aligned on column 16 if datatypes permit. * otherwise alingned on next available 8n column. */ /** * Protocol definitions for the XI2 protocol. * This file should not be included by clients that merely use XI2, but do not * need the wire protocol. Such clients should include XI2.h, or the matching * header from the library. * */ #ifndef _XI2PROTO_H_ #define _XI2PROTO_H_ #include #include #include #include /* make sure types have right sizes for protocol structures. */ #define Window uint32_t #define Time uint32_t #define Atom uint32_t #define Cursor uint32_t #define Barrier uint32_t /** * XI2 Request opcodes */ #define X_XIQueryPointer 40 #define X_XIWarpPointer 41 #define X_XIChangeCursor 42 #define X_XIChangeHierarchy 43 #define X_XISetClientPointer 44 #define X_XIGetClientPointer 45 #define X_XISelectEvents 46 #define X_XIQueryVersion 47 #define X_XIQueryDevice 48 #define X_XISetFocus 49 #define X_XIGetFocus 50 #define X_XIGrabDevice 51 #define X_XIUngrabDevice 52 #define X_XIAllowEvents 53 #define X_XIPassiveGrabDevice 54 #define X_XIPassiveUngrabDevice 55 #define X_XIListProperties 56 #define X_XIChangeProperty 57 #define X_XIDeleteProperty 58 #define X_XIGetProperty 59 #define X_XIGetSelectedEvents 60 #define X_XIBarrierReleasePointer 61 /** Number of XI requests */ #define XI2REQUESTS (X_XIBarrierReleasePointer - X_XIQueryPointer + 1) /** Number of XI2 events */ #define XI2EVENTS (XI_LASTEVENT + 1) /************************************************************************************* * * * COMMON STRUCTS * * * *************************************************************************************/ /** Fixed point 16.16 */ typedef int32_t FP1616; /** Fixed point 32.32 */ typedef struct { int32_t integral; uint32_t frac; } FP3232; /** * Struct to describe a device. * * For a MasterPointer or a MasterKeyboard, 'attachment' specifies the * paired master device. * For a SlaveKeyboard or SlavePointer, 'attachment' specifies the master * device this device is attached to. * For a FloatingSlave, 'attachment' is undefined. */ typedef struct { uint16_t deviceid; uint16_t use; /**< ::XIMasterPointer, ::XIMasterKeyboard, ::XISlavePointer, ::XISlaveKeyboard, ::XIFloatingSlave */ uint16_t attachment; /**< Current attachment or pairing.*/ uint16_t num_classes; /**< Number of classes following this struct. */ uint16_t name_len; /**< Length of name in bytes. */ uint8_t enabled; /**< TRUE if device is enabled. */ uint8_t pad; } xXIDeviceInfo; /** * Default template for a device class. * A device class is equivalent to a device's capabilities. Multiple classes * are supported per device. */ typedef struct { uint16_t type; /**< One of *class */ uint16_t length; /**< Length in 4 byte units */ uint16_t sourceid; /**< source device for this class */ uint16_t pad; } xXIAnyInfo; /** * Denotes button capability on a device. * Struct is followed by num_buttons * Atom that names the buttons in the * device-native setup (i.e. ignoring button mappings). */ typedef struct { uint16_t type; /**< Always ButtonClass */ uint16_t length; /**< Length in 4 byte units */ uint16_t sourceid; /**< source device for this class */ uint16_t num_buttons; /**< Number of buttons provided */ } xXIButtonInfo; /** * Denotes key capability on a device. * Struct is followed by num_keys * CARD32 that lists the keycodes available * on the device. */ typedef struct { uint16_t type; /**< Always KeyClass */ uint16_t length; /**< Length in 4 byte units */ uint16_t sourceid; /**< source device for this class */ uint16_t num_keycodes; /**< Number of keys provided */ } xXIKeyInfo; /** * Denotes an valuator capability on a device. * One XIValuatorInfo describes exactly one valuator (axis) on the device. */ typedef struct { uint16_t type; /**< Always ValuatorClass */ uint16_t length; /**< Length in 4 byte units */ uint16_t sourceid; /**< source device for this class */ uint16_t number; /**< Valuator number */ Atom label; /**< Axis label */ FP3232 min; /**< Min value */ FP3232 max; /**< Max value */ FP3232 value; /**< Last published value */ uint32_t resolution; /**< Resolutions in units/m */ uint8_t mode; /**< ModeRelative or ModeAbsolute */ uint8_t pad1; uint16_t pad2; } xXIValuatorInfo; /*** * Denotes a scroll valuator on a device. * One XIScrollInfo describes exactly one scroll valuator that must have a * XIValuatorInfo struct. */ typedef struct { uint16_t type; /**< Always ValuatorClass */ uint16_t length; /**< Length in 4 byte units */ uint16_t sourceid; /**< source device for this class */ uint16_t number; /**< Valuator number */ uint16_t scroll_type; /**< ::XIScrollTypeVertical, ::XIScrollTypeHorizontal */ uint16_t pad0; uint32_t flags; /**< ::XIScrollFlagEmulate, ::XIScrollFlagPreferred */ FP3232 increment; /**< Increment for one unit of scrolling */ } xXIScrollInfo; /** * Denotes multitouch capability on a device. */ typedef struct { uint16_t type; /**< Always TouchClass */ uint16_t length; /**< Length in 4 byte units */ uint16_t sourceid; /**< source device for this class */ uint8_t mode; /**< DirectTouch or DependentTouch */ uint8_t num_touches; /**< Maximum number of touches (0==unlimited) */ } xXITouchInfo; /** * Used to select for events on a given window. * Struct is followed by (mask_len * CARD8), with each bit set representing * the event mask for the given type. A mask bit represents an event type if * (mask == (1 << type)). */ typedef struct { uint16_t deviceid; /**< Device id to select for */ uint16_t mask_len; /**< Length of mask in 4 byte units */ } xXIEventMask; /** * XKB modifier information. * The effective modifier is a binary mask of base, latched, and locked * modifiers. */ typedef struct { uint32_t base_mods; /**< Logically pressed modifiers */ uint32_t latched_mods; /**< Logically latched modifiers */ uint32_t locked_mods; /**< Logically locked modifiers */ uint32_t effective_mods; /**< Effective modifiers */ } xXIModifierInfo; /** * XKB group information. * The effective group is the mathematical sum of base, latched, and locked * group after group wrapping is taken into account. */ typedef struct { uint8_t base_group; /**< Logically "pressed" group */ uint8_t latched_group; /**< Logically latched group */ uint8_t locked_group; /**< Logically locked group */ uint8_t effective_group; /**< Effective group */ } xXIGroupInfo; /************************************************************************************* * * * REQUESTS * * * *************************************************************************************/ /** * Query the server for the supported X Input extension version. */ typedef struct { uint8_t reqType; /**< Input extension major code */ uint8_t ReqType; /**< Always ::X_XIQueryVersion */ uint16_t length; /**< Length in 4 byte units */ uint16_t major_version; uint16_t minor_version; } xXIQueryVersionReq; #define sz_xXIQueryVersionReq 8 typedef struct { uint8_t repType; /**< ::X_Reply */ uint8_t RepType; /**< Always ::X_XIQueryVersion */ uint16_t sequenceNumber; uint32_t length; uint16_t major_version; uint16_t minor_version; uint32_t pad1; uint32_t pad2; uint32_t pad3; uint32_t pad4; uint32_t pad5; } xXIQueryVersionReply; #define sz_xXIQueryVersionReply 32 /** * Query the server for information about a specific device or all input * devices. */ typedef struct { uint8_t reqType; /**< Input extension major code */ uint8_t ReqType; /**< Always ::X_XIQueryDevice */ uint16_t length; /**< Length in 4 byte units */ uint16_t deviceid; uint16_t pad; } xXIQueryDeviceReq; #define sz_xXIQueryDeviceReq 8 typedef struct { uint8_t repType; /**< ::X_Reply */ uint8_t RepType; /**< Always ::X_XIQueryDevice */ uint16_t sequenceNumber; uint32_t length; uint16_t num_devices; uint16_t pad0; uint32_t pad1; uint32_t pad2; uint32_t pad3; uint32_t pad4; uint32_t pad5; } xXIQueryDeviceReply; #define sz_xXIQueryDeviceReply 32 /** * Select for events on a given window. */ typedef struct { uint8_t reqType; /**< Input extension major code */ uint8_t ReqType; /**< Always ::X_XISelectEvents */ uint16_t length; /**< Length in 4 byte units */ Window win; uint16_t num_masks; uint16_t pad; } xXISelectEventsReq; #define sz_xXISelectEventsReq 12 /** * Query for selected events on a given window. */ typedef struct { uint8_t reqType; /**< Input extension major code */ uint8_t ReqType; /**< Always ::X_XIGetSelectedEvents */ uint16_t length; /**< Length in 4 byte units */ Window win; } xXIGetSelectedEventsReq; #define sz_xXIGetSelectedEventsReq 8 typedef struct { uint8_t repType; /**< Input extension major opcode */ uint8_t RepType; /**< Always ::X_XIGetSelectedEvents */ uint16_t sequenceNumber; uint32_t length; uint16_t num_masks; /**< Number of xXIEventMask structs trailing the reply */ uint16_t pad0; uint32_t pad1; uint32_t pad2; uint32_t pad3; uint32_t pad4; uint32_t pad5; } xXIGetSelectedEventsReply; #define sz_xXIGetSelectedEventsReply 32 /** * Query the given device's screen/window coordinates. */ typedef struct { uint8_t reqType; /**< Input extension major code */ uint8_t ReqType; /**< Always ::X_XIQueryPointer */ uint16_t length; /**< Length in 4 byte units */ Window win; uint16_t deviceid; uint16_t pad1; } xXIQueryPointerReq; #define sz_xXIQueryPointerReq 12 typedef struct { uint8_t repType; /**< Input extension major opcode */ uint8_t RepType; /**< Always ::X_XIQueryPointer */ uint16_t sequenceNumber; uint32_t length; Window root; Window child; FP1616 root_x; FP1616 root_y; FP1616 win_x; FP1616 win_y; uint8_t same_screen; uint8_t pad0; uint16_t buttons_len; xXIModifierInfo mods; xXIGroupInfo group; } xXIQueryPointerReply; #define sz_xXIQueryPointerReply 56 /** * Warp the given device's pointer to the specified position. */ typedef struct { uint8_t reqType; /**< Input extension major code */ uint8_t ReqType; /**< Always ::X_XIWarpPointer */ uint16_t length; /**< Length in 4 byte units */ Window src_win; Window dst_win; FP1616 src_x; FP1616 src_y; uint16_t src_width; uint16_t src_height; FP1616 dst_x; FP1616 dst_y; uint16_t deviceid; uint16_t pad1; } xXIWarpPointerReq; #define sz_xXIWarpPointerReq 36 /** * Change the given device's sprite to the given cursor. */ typedef struct { uint8_t reqType; /**< Input extension major code */ uint8_t ReqType; /**< Always ::X_XIChangeCursor */ uint16_t length; /**< Length in 4 byte units */ Window win; Cursor cursor; uint16_t deviceid; uint16_t pad1; } xXIChangeCursorReq; #define sz_xXIChangeCursorReq 16 /** * Modify the device hierarchy. */ typedef struct { uint8_t reqType; /**< Input extension major code */ uint8_t ReqType; /**< Always ::X_XIChangeHierarchy */ uint16_t length; /**< Length in 4 byte units */ uint8_t num_changes; uint8_t pad0; uint16_t pad1; } xXIChangeHierarchyReq; #define sz_xXIChangeHierarchyReq 8 /** * Generic header for any hierarchy change. */ typedef struct { uint16_t type; uint16_t length; /**< Length in 4 byte units */ } xXIAnyHierarchyChangeInfo; /** * Create a new master device. * Name of new master follows struct (4-byte padded) */ typedef struct { uint16_t type; /**< Always ::XIAddMaster */ uint16_t length; /**< 2 + (namelen + padding)/4 */ uint16_t name_len; uint8_t send_core; uint8_t enable; } xXIAddMasterInfo; /** * Delete a master device. Will automatically delete the master device paired * with the given master device. */ typedef struct { uint16_t type; /**< Always ::XIRemoveMaster */ uint16_t length; /**< 3 */ uint16_t deviceid; uint8_t return_mode; /**< ::XIAttachToMaster, ::XIFloating */ uint8_t pad; uint16_t return_pointer; /**< Pointer to attach slave ptr devices to */ uint16_t return_keyboard; /**< keyboard to attach slave keybd devices to*/ } xXIRemoveMasterInfo; /** * Attach an SD to a new device. * NewMaster has to be of same type (pointer->pointer, keyboard->keyboard); */ typedef struct { uint16_t type; /**< Always ::XIAttachSlave */ uint16_t length; /**< 2 */ uint16_t deviceid; uint16_t new_master; /**< id of new master device */ } xXIAttachSlaveInfo; /** * Detach an SD from its current master device. */ typedef struct { uint16_t type; /**< Always ::XIDetachSlave */ uint16_t length; /**< 2 */ uint16_t deviceid; uint16_t pad; } xXIDetachSlaveInfo; /** * Set the window/client's ClientPointer. */ typedef struct { uint8_t reqType; uint8_t ReqType; /**< Always ::X_XISetClientPointer */ uint16_t length; /**< Length in 4 byte units */ Window win; uint16_t deviceid; uint16_t pad1; } xXISetClientPointerReq; #define sz_xXISetClientPointerReq 12 /** * Query the given window/client's ClientPointer setting. */ typedef struct { uint8_t reqType; uint8_t ReqType; /**< Always ::X_GetClientPointer */ uint16_t length; /**< Length in 4 byte units */ Window win; } xXIGetClientPointerReq; #define sz_xXIGetClientPointerReq 8 typedef struct { uint8_t repType; /**< Input extension major opcode */ uint8_t RepType; /**< Always ::X_GetClientPointer */ uint16_t sequenceNumber; uint32_t length; BOOL set; /**< client pointer is set? */ uint8_t pad0; uint16_t deviceid; uint32_t pad1; uint32_t pad2; uint32_t pad3; uint32_t pad4; uint32_t pad5; } xXIGetClientPointerReply; #define sz_xXIGetClientPointerReply 32 /** * Set the input focus to the specified window. */ typedef struct { uint8_t reqType; uint8_t ReqType; /**< Always ::X_XISetFocus */ uint16_t length; /**< Length in 4 byte units */ Window focus; Time time; uint16_t deviceid; uint16_t pad0; } xXISetFocusReq; #define sz_xXISetFocusReq 16 /** * Query the current input focus. */ typedef struct { uint8_t reqType; uint8_t ReqType; /**< Always ::X_XIGetDeviceFocus */ uint16_t length; /**< Length in 4 byte units */ uint16_t deviceid; uint16_t pad0; } xXIGetFocusReq; #define sz_xXIGetFocusReq 8 typedef struct { uint8_t repType; /**< Input extension major opcode */ uint8_t RepType; /**< Always ::X_XIGetFocus */ uint16_t sequenceNumber; uint32_t length; Window focus; uint32_t pad1; uint32_t pad2; uint32_t pad3; uint32_t pad4; uint32_t pad5; } xXIGetFocusReply; #define sz_xXIGetFocusReply 32 /** * Grab the given device. */ typedef struct { uint8_t reqType; uint8_t ReqType; /**< Always ::X_XIGrabDevice */ uint16_t length; /**< Length in 4 byte units */ Window grab_window; Time time; Cursor cursor; uint16_t deviceid; uint8_t grab_mode; uint8_t paired_device_mode; uint8_t owner_events; uint8_t pad; uint16_t mask_len; } xXIGrabDeviceReq; #define sz_xXIGrabDeviceReq 24 /** * Return codes from a XIPassiveGrabDevice request. */ typedef struct { uint32_t modifiers; /**< Modifier state */ uint8_t status; /**< Grab status code */ uint8_t pad0; uint16_t pad1; } xXIGrabModifierInfo; typedef struct { uint8_t repType; /**< Input extension major opcode */ uint8_t RepType; /**< Always ::X_XIGrabDevice */ uint16_t sequenceNumber; uint32_t length; uint8_t status; uint8_t pad0; uint16_t pad1; uint32_t pad2; uint32_t pad3; uint32_t pad4; uint32_t pad5; uint32_t pad6; } xXIGrabDeviceReply; #define sz_xXIGrabDeviceReply 32 /** * Ungrab the specified device. * */ typedef struct { uint8_t reqType; uint8_t ReqType; /**< Always ::X_XIUngrabDevice */ uint16_t length; /**< Length in 4 byte units */ Time time; uint16_t deviceid; uint16_t pad; } xXIUngrabDeviceReq; #define sz_xXIUngrabDeviceReq 12 /** * Allow or replay events on the specified grabbed device. */ typedef struct { uint8_t reqType; uint8_t ReqType; /**< Always ::X_XIAllowEvents */ uint16_t length; /**< Length in 4 byte units */ Time time; uint16_t deviceid; uint8_t mode; uint8_t pad; } xXIAllowEventsReq; #define sz_xXIAllowEventsReq 12 /** * Allow or replay events on the specified grabbed device. * Since XI 2.2 */ typedef struct { uint8_t reqType; uint8_t ReqType; /**< Always ::X_XIAllowEvents */ uint16_t length; /**< Length in 4 byte units */ Time time; uint16_t deviceid; uint8_t mode; uint8_t pad; uint32_t touchid; /**< Since XI 2.2 */ Window grab_window; /**< Since XI 2.2 */ } xXI2_2AllowEventsReq; #define sz_xXI2_2AllowEventsReq 20 /** * Passively grab the device. */ typedef struct { uint8_t reqType; uint8_t ReqType; /**< Always ::X_XIPassiveGrabDevice */ uint16_t length; /**< Length in 4 byte units */ Time time; Window grab_window; Cursor cursor; uint32_t detail; uint16_t deviceid; uint16_t num_modifiers; uint16_t mask_len; uint8_t grab_type; uint8_t grab_mode; uint8_t paired_device_mode; uint8_t owner_events; uint16_t pad1; } xXIPassiveGrabDeviceReq; #define sz_xXIPassiveGrabDeviceReq 32 typedef struct { uint8_t repType; /**< Input extension major opcode */ uint8_t RepType; /**< Always ::X_XIPassiveGrabDevice */ uint16_t sequenceNumber; uint32_t length; uint16_t num_modifiers; uint16_t pad1; uint32_t pad2; uint32_t pad3; uint32_t pad4; uint32_t pad5; uint32_t pad6; } xXIPassiveGrabDeviceReply; #define sz_xXIPassiveGrabDeviceReply 32 /** * Delete a passive grab for the given device. */ typedef struct { uint8_t reqType; uint8_t ReqType; /**< Always ::X_XIPassiveUngrabDevice */ uint16_t length; /**< Length in 4 byte units */ Window grab_window; uint32_t detail; uint16_t deviceid; uint16_t num_modifiers; uint8_t grab_type; uint8_t pad0; uint16_t pad1; } xXIPassiveUngrabDeviceReq; #define sz_xXIPassiveUngrabDeviceReq 20 /** * List all device properties on the specified device. */ typedef struct { uint8_t reqType; uint8_t ReqType; /**< Always ::X_XIListProperties */ uint16_t length; /**< Length in 4 byte units */ uint16_t deviceid; uint16_t pad; } xXIListPropertiesReq; #define sz_xXIListPropertiesReq 8 typedef struct { uint8_t repType; /**< Input extension major opcode */ uint8_t RepType; /**< Always ::X_XIListProperties */ uint16_t sequenceNumber; uint32_t length; uint16_t num_properties; uint16_t pad0; uint32_t pad1; uint32_t pad2; uint32_t pad3; uint32_t pad4; uint32_t pad5; } xXIListPropertiesReply; #define sz_xXIListPropertiesReply 32 /** * Change a property on the specified device. */ typedef struct { uint8_t reqType; uint8_t ReqType; /**< Always ::X_XIChangeProperty */ uint16_t length; /**< Length in 4 byte units */ uint16_t deviceid; uint8_t mode; uint8_t format; Atom property; Atom type; uint32_t num_items; } xXIChangePropertyReq; #define sz_xXIChangePropertyReq 20 /** * Delete the specified property. */ typedef struct { uint8_t reqType; uint8_t ReqType; /**< Always X_XIDeleteProperty */ uint16_t length; /**< Length in 4 byte units */ uint16_t deviceid; uint16_t pad0; Atom property; } xXIDeletePropertyReq; #define sz_xXIDeletePropertyReq 12 /** * Query the specified property's values. */ typedef struct { uint8_t reqType; uint8_t ReqType; /**< Always X_XIGetProperty */ uint16_t length; /**< Length in 4 byte units */ uint16_t deviceid; #if defined(__cplusplus) || defined(c_plusplus) uint8_t c_delete; #else uint8_t delete; #endif uint8_t pad0; Atom property; Atom type; uint32_t offset; uint32_t len; } xXIGetPropertyReq; #define sz_xXIGetPropertyReq 24 typedef struct { uint8_t repType; /**< Input extension major opcode */ uint8_t RepType; /**< Always X_XIGetProperty */ uint16_t sequenceNumber; uint32_t length; Atom type; uint32_t bytes_after; uint32_t num_items; uint8_t format; uint8_t pad0; uint16_t pad1; uint32_t pad2; uint32_t pad3; } xXIGetPropertyReply; #define sz_xXIGetPropertyReply 32 typedef struct { uint16_t deviceid; uint16_t pad; Barrier barrier; uint32_t eventid; } xXIBarrierReleasePointerInfo; typedef struct { uint8_t reqType; /**< Input extension major opcode */ uint8_t ReqType; /**< Always X_XIBarrierReleasePointer */ uint16_t length; uint32_t num_barriers; /* array of xXIBarrierReleasePointerInfo */ } xXIBarrierReleasePointerReq; #define sz_xXIBarrierReleasePointerReq 8 /************************************************************************************* * * * EVENTS * * * *************************************************************************************/ /** * Generic XI2 event header. All XI2 events use the same header. */ typedef struct { uint8_t type; uint8_t extension; /**< XI extension offset */ uint16_t sequenceNumber; uint32_t length; uint16_t evtype; uint16_t deviceid; Time time; } xXIGenericDeviceEvent; /** * Device hierarchy information. */ typedef struct { uint16_t deviceid; uint16_t attachment; /**< ID of master or paired device */ uint8_t use; /**< ::XIMasterKeyboard, ::XIMasterPointer, ::XISlaveKeyboard, ::XISlavePointer, ::XIFloatingSlave */ BOOL enabled; /**< TRUE if the device is enabled */ uint16_t pad; uint32_t flags; /**< ::XIMasterAdded, ::XIMasterRemoved, ::XISlaveAttached, ::XISlaveDetached, ::XISlaveAdded, ::XISlaveRemoved, ::XIDeviceEnabled, ::XIDeviceDisabled */ } xXIHierarchyInfo; /** * The device hierarchy has been modified. This event includes the device * hierarchy after the modification has been applied. */ typedef struct { uint8_t type; /**< Always GenericEvent */ uint8_t extension; /**< XI extension offset */ uint16_t sequenceNumber; uint32_t length; /**< Length in 4 byte units */ uint16_t evtype; /**< ::XI_Hierarchy */ uint16_t deviceid; Time time; uint32_t flags; /**< ::XIMasterAdded, ::XIMasterDeleted, ::XISlaveAttached, ::XISlaveDetached, ::XISlaveAdded, ::XISlaveRemoved, ::XIDeviceEnabled, ::XIDeviceDisabled */ uint16_t num_info; uint16_t pad0; uint32_t pad1; uint32_t pad2; } xXIHierarchyEvent; /** * A device has changed capabilities. */ typedef struct { uint8_t type; /**< Always GenericEvent */ uint8_t extension; /**< XI extension offset */ uint16_t sequenceNumber; uint32_t length; /**< Length in 4 byte units */ uint16_t evtype; /**< XI_DeviceChanged */ uint16_t deviceid; /**< Device that has changed */ Time time; uint16_t num_classes; /**< Number of classes that have changed */ uint16_t sourceid; /**< Source of the new classes */ uint8_t reason; /**< ::XISlaveSwitch, ::XIDeviceChange */ uint8_t pad0; uint16_t pad1; uint32_t pad2; uint32_t pad3; } xXIDeviceChangedEvent; /** * The owner of a touch stream has passed on ownership to another client. */ typedef struct { uint8_t type; /**< Always GenericEvent */ uint8_t extension; /**< XI extension offset */ uint16_t sequenceNumber; uint32_t length; /**< Length in 4 byte units */ uint16_t evtype; /**< XI_TouchOwnership */ uint16_t deviceid; /**< Device that has changed */ Time time; uint32_t touchid; Window root; Window event; Window child; /* └──────── 32 byte boundary ────────┘ */ uint16_t sourceid; uint16_t pad0; uint32_t flags; uint32_t pad1; uint32_t pad2; } xXITouchOwnershipEvent; /** * Default input event for pointer, keyboard or touch input. */ typedef struct { uint8_t type; /**< Always GenericEvent */ uint8_t extension; /**< XI extension offset */ uint16_t sequenceNumber; uint32_t length; /**< Length in 4 byte uints */ uint16_t evtype; uint16_t deviceid; Time time; uint32_t detail; /**< Keycode or button */ Window root; Window event; Window child; /* └──────── 32 byte boundary ────────┘ */ FP1616 root_x; /**< Always screen coords, 16.16 fixed point */ FP1616 root_y; FP1616 event_x; /**< Always screen coords, 16.16 fixed point */ FP1616 event_y; uint16_t buttons_len; /**< Len of button flags in 4 b units */ uint16_t valuators_len; /**< Len of val. flags in 4 b units */ uint16_t sourceid; /**< The source device */ uint16_t pad0; uint32_t flags; /**< ::XIKeyRepeat */ xXIModifierInfo mods; xXIGroupInfo group; } xXIDeviceEvent; /** * Sent when an input event is generated. RawEvents include valuator * information in both device-specific data (i.e. unaccelerated) and * processed data (i.e. accelerated, if applicable). */ typedef struct { uint8_t type; /**< Always GenericEvent */ uint8_t extension; /**< XI extension offset */ uint16_t sequenceNumber; uint32_t length; /**< Length in 4 byte uints */ uint16_t evtype; /**< ::XI_RawEvent */ uint16_t deviceid; Time time; uint32_t detail; uint16_t sourceid; /**< The source device (XI 2.1) */ uint16_t valuators_len; /**< Length of trailing valuator mask in 4 byte units */ uint32_t flags; /**< ::XIKeyRepeat */ uint32_t pad2; } xXIRawEvent; /** * Note that the layout of root, event, child, root_x, root_y, event_x, * event_y must be identical to the xXIDeviceEvent. */ typedef struct { uint8_t type; /**< Always GenericEvent */ uint8_t extension; /**< XI extension offset */ uint16_t sequenceNumber; uint32_t length; /**< Length in 4 byte uints */ uint16_t evtype; /**< ::XI_Enter */ uint16_t deviceid; Time time; uint16_t sourceid; uint8_t mode; uint8_t detail; Window root; Window event; Window child; /* └──────── 32 byte boundary ────────┘ */ FP1616 root_x; FP1616 root_y; FP1616 event_x; FP1616 event_y; BOOL same_screen; BOOL focus; uint16_t buttons_len; /**< Length of trailing button mask in 4 byte units */ xXIModifierInfo mods; xXIGroupInfo group; } xXIEnterEvent; typedef xXIEnterEvent xXILeaveEvent; typedef xXIEnterEvent xXIFocusInEvent; typedef xXIEnterEvent xXIFocusOutEvent; /** * Sent when a device property is created, modified or deleted. Does not * include property data, the client is required to query the data. */ typedef struct { uint8_t type; /**< Always GenericEvent */ uint8_t extension; /**< XI extension offset */ uint16_t sequenceNumber; uint32_t length; /**< Length in 4 byte units */ uint16_t evtype; /**< ::XI_PropertyEvent */ uint16_t deviceid; Time time; Atom property; uint8_t what; /**< ::XIPropertyDeleted, ::XIPropertyCreated, ::XIPropertyMotified */ uint8_t pad0; uint16_t pad1; uint32_t pad2; uint32_t pad3; } xXIPropertyEvent; typedef struct { uint8_t type; /**< Always GenericEvent */ uint8_t extension; /**< XI extension offset */ uint16_t sequenceNumber; uint32_t length; /**< Length in 4 byte units */ uint16_t evtype; /**< ::XI_BarrierHit or ::XI_BarrierLeave */ uint16_t deviceid; Time time; uint32_t eventid; Window root; Window event; Barrier barrier; /* └──────── 32 byte boundary ────────┘ */ uint32_t dtime; uint32_t flags; /**< ::XIBarrierPointerReleased ::XIBarrierDeviceIsGrabbed */ uint16_t sourceid; int16_t pad; FP1616 root_x; FP1616 root_y; FP3232 dx; FP3232 dy; } xXIBarrierEvent; typedef xXIBarrierEvent xXIBarrierHitEvent; typedef xXIBarrierEvent xXIBarrierPointerReleasedEvent; typedef xXIBarrierEvent xXIBarrierLeaveEvent; #undef Window #undef Time #undef Atom #undef Cursor #undef Barrier #endif /* _XI2PROTO_H_ */ X11/extensions/xf86dgaconst.h000064400000004750147631660250012023 0ustar00/* Copyright (c) 1999 XFree86 Inc */ #ifndef _XF86DGACONST_H_ #define _XF86DGACONST_H_ #include #define X_XDGAQueryVersion 0 /* 1 through 9 are in xf86dga1.h */ /* 10 and 11 are reserved to avoid conflicts with rogue DGA extensions */ #define X_XDGAQueryModes 12 #define X_XDGASetMode 13 #define X_XDGASetViewport 14 #define X_XDGAInstallColormap 15 #define X_XDGASelectInput 16 #define X_XDGAFillRectangle 17 #define X_XDGACopyArea 18 #define X_XDGACopyTransparentArea 19 #define X_XDGAGetViewportStatus 20 #define X_XDGASync 21 #define X_XDGAOpenFramebuffer 22 #define X_XDGACloseFramebuffer 23 #define X_XDGASetClientVersion 24 #define X_XDGAChangePixmapMode 25 #define X_XDGACreateColormap 26 #define XDGAConcurrentAccess 0x00000001 #define XDGASolidFillRect 0x00000002 #define XDGABlitRect 0x00000004 #define XDGABlitTransRect 0x00000008 #define XDGAPixmap 0x00000010 #define XDGAInterlaced 0x00010000 #define XDGADoublescan 0x00020000 #define XDGAFlipImmediate 0x00000001 #define XDGAFlipRetrace 0x00000002 #define XDGANeedRoot 0x00000001 #define XF86DGANumberEvents 7 #define XDGAPixmapModeLarge 0 #define XDGAPixmapModeSmall 1 #define XF86DGAClientNotLocal 0 #define XF86DGANoDirectVideoMode 1 #define XF86DGAScreenNotActive 2 #define XF86DGADirectNotActivated 3 #define XF86DGAOperationNotSupported 4 #define XF86DGANumberErrors (XF86DGAOperationNotSupported + 1) typedef struct { int num; /* A unique identifier for the mode (num > 0) */ char *name; /* name of mode given in the XF86Config */ float verticalRefresh; int flags; /* DGA_CONCURRENT_ACCESS, etc... */ int imageWidth; /* linear accessible portion (pixels) */ int imageHeight; int pixmapWidth; /* Xlib accessible portion (pixels) */ int pixmapHeight; /* both fields ignored if no concurrent access */ int bytesPerScanline; int byteOrder; /* MSBFirst, LSBFirst */ int depth; int bitsPerPixel; unsigned long redMask; unsigned long greenMask; unsigned long blueMask; short visualClass; int viewportWidth; int viewportHeight; int xViewportStep; /* viewport position granularity */ int yViewportStep; int maxViewportX; /* max viewport origin */ int maxViewportY; int viewportFlags; /* types of page flipping possible */ int reserved1; int reserved2; } XDGAMode; typedef struct { XDGAMode mode; unsigned char *data; Pixmap pixmap; } XDGADevice; #endif /* _XF86DGACONST_H_ */ X11/extensions/shapeconst.h000064400000003526147631660250011654 0ustar00/************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ********************************************************/ #ifndef _SHAPECONST_H_ #define _SHAPECONST_H_ /* * Protocol requests constants and alignment values * These would really be in SHAPE's X.h and Xproto.h equivalents */ #define SHAPENAME "SHAPE" #define SHAPE_MAJOR_VERSION 1 /* current version numbers */ #define SHAPE_MINOR_VERSION 1 #define ShapeSet 0 #define ShapeUnion 1 #define ShapeIntersect 2 #define ShapeSubtract 3 #define ShapeInvert 4 #define ShapeBounding 0 #define ShapeClip 1 #define ShapeInput 2 #define ShapeNotifyMask (1L << 0) #define ShapeNotify 0 #define ShapeNumberEvents (ShapeNotify + 1) #endif /* _SHAPECONST_H_ */ X11/extensions/XvMCproto.h000064400000011422147631660250011400 0ustar00#ifndef _XVMCPROTO_H_ #define _XVMCPROTO_H_ #define xvmc_QueryVersion 0 #define xvmc_ListSurfaceTypes 1 #define xvmc_CreateContext 2 #define xvmc_DestroyContext 3 #define xvmc_CreateSurface 4 #define xvmc_DestroySurface 5 #define xvmc_CreateSubpicture 6 #define xvmc_DestroySubpicture 7 #define xvmc_ListSubpictureTypes 8 #define xvmc_GetDRInfo 9 #define xvmc_LastRequest xvmc_GetDRInfo #define xvmcNumRequest (xvmc_LastRequest + 1) typedef struct { CARD32 surface_type_id B32; CARD16 chroma_format B16; CARD16 pad0 B16; CARD16 max_width B16; CARD16 max_height B16; CARD16 subpicture_max_width B16; CARD16 subpicture_max_height B16; CARD32 mc_type B32; CARD32 flags B32; } xvmcSurfaceInfo; #define sz_xvmcSurfaceInfo 24; typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; } xvmcQueryVersionReq; #define sz_xvmcQueryVersionReq 4; typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 major B32; CARD32 minor B32; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; } xvmcQueryVersionReply; #define sz_xvmcQueryVersionReply 32 typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; CARD32 port B32; } xvmcListSurfaceTypesReq; #define sz_xvmcListSurfaceTypesReq 8; typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 num B32; CARD32 padl3 B32; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; } xvmcListSurfaceTypesReply; #define sz_xvmcListSurfaceTypesReply 32 typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; CARD32 context_id B32; CARD32 port B32; CARD32 surface_type_id B32; CARD16 width B16; CARD16 height B16; CARD32 flags B32; } xvmcCreateContextReq; #define sz_xvmcCreateContextReq 24; typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 width_actual B16; CARD16 height_actual B16; CARD32 flags_return B32; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; } xvmcCreateContextReply; #define sz_xvmcCreateContextReply 32 typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; CARD32 context_id B32; } xvmcDestroyContextReq; #define sz_xvmcDestroyContextReq 8; typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; CARD32 surface_id B32; CARD32 context_id B32; } xvmcCreateSurfaceReq; #define sz_xvmcCreateSurfaceReq 12; typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 padl2 B32; CARD32 padl3 B32; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; } xvmcCreateSurfaceReply; #define sz_xvmcCreateSurfaceReply 32 typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; CARD32 surface_id B32; } xvmcDestroySurfaceReq; #define sz_xvmcDestroySurfaceReq 8; typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; CARD32 subpicture_id B32; CARD32 context_id B32; CARD32 xvimage_id B32; CARD16 width B16; CARD16 height B16; } xvmcCreateSubpictureReq; #define sz_xvmcCreateSubpictureReq 20; typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 width_actual B16; CARD16 height_actual B16; CARD16 num_palette_entries B16; CARD16 entry_bytes B16; CARD8 component_order[4]; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; } xvmcCreateSubpictureReply; #define sz_xvmcCreateSubpictureReply 32 typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; CARD32 subpicture_id B32; } xvmcDestroySubpictureReq; #define sz_xvmcDestroySubpictureReq 8; typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; CARD32 port B32; CARD32 surface_type_id B32; } xvmcListSubpictureTypesReq; #define sz_xvmcListSubpictureTypesReq 12; typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 num B32; CARD32 padl2 B32; CARD32 padl3 B32; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; } xvmcListSubpictureTypesReply; #define sz_xvmcListSubpictureTypesReply 32 typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; CARD32 port B32; CARD32 shmKey B32; CARD32 magic B32; } xvmcGetDRInfoReq; #define sz_xvmcGetDRInfoReq 16; typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 major B32; CARD32 minor B32; CARD32 patchLevel B32; CARD32 nameLen B32; CARD32 busIDLen B32; CARD32 isLocal B32; } xvmcGetDRInfoReply; #define sz_xvmcGetDRInfoReply 32 #endif X11/extensions/dmx.h000064400000004505147631660250010273 0ustar00/* * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina. * * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation on the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial * portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * This file describes the interface to the client-side libdmx.a * library. All DMX-aware client-side applications should include this * file. */ #ifndef _DMX_H_ #define _DMX_H_ /* These values must be larger than LastExtensionError. The values in dmxext.h and dmxproto.h *MUST* match. */ #define DmxBadXinerama 1001 #define DmxBadValue 1002 #define DmxBadReply 1003 #define DMXScreenWindowWidth (1L<<0) #define DMXScreenWindowHeight (1L<<1) #define DMXScreenWindowXoffset (1L<<2) #define DMXScreenWindowYoffset (1L<<3) #define DMXRootWindowWidth (1L<<4) #define DMXRootWindowHeight (1L<<5) #define DMXRootWindowXoffset (1L<<6) #define DMXRootWindowYoffset (1L<<7) #define DMXRootWindowXorigin (1L<<8) #define DMXRootWindowYorigin (1L<<9) #define DMXDesktopWidth (1L<<0) #define DMXDesktopHeight (1L<<1) #define DMXDesktopShiftX (1L<<2) #define DMXDesktopShiftY (1L<<3) #define DMXInputType (1L<<0) #define DMXInputPhysicalScreen (1L<<1) #define DMXInputSendsCore (1L<<2) #endif X11/extensions/Xv.h000064400000005723147631660250010103 0ustar00/*********************************************************** Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts, and the Massachusetts Institute of Technology, Cambridge, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or MIT not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef XV_H #define XV_H /* ** File: ** ** Xv.h --- Xv shared library and server header file ** ** Author: ** ** David Carver (Digital Workstation Engineering/Project Athena) ** ** Revisions: ** ** 05.15.91 Carver ** - version 2.0 upgrade ** ** 01.24.91 Carver ** - version 1.4 upgrade ** */ #include #define XvName "XVideo" #define XvVersion 2 #define XvRevision 2 /* Symbols */ typedef XID XvPortID; typedef XID XvEncodingID; #define XvNone 0 #define XvInput 0 #define XvOutput 1 #define XvInputMask (1< /* * the typedefs for CARD8, CARD16, and CARD32 are defined in Xmd.h */ /* * XTest request type values * * used in the XTest extension protocol requests */ #define X_TestFakeInput 1 #define X_TestGetInput 2 #define X_TestStopInput 3 #define X_TestReset 4 #define X_TestQueryInputSize 5 /* * This defines the maximum size of a list of input actions * to be sent to the server. It should always be a multiple of * 4 so that the entire xTestFakeInputReq structure size is a * multiple of 4. */ typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 XTestReqType; /* always X_TestFakeInput */ CARD16 length B16; /* 2 + XTestMAX_ACTION_LIST_SIZE/4 */ CARD32 ack B32; CARD8 action_list[XTestMAX_ACTION_LIST_SIZE]; } xTestFakeInputReq; #define sz_xTestFakeInputReq (XTestMAX_ACTION_LIST_SIZE + 8) typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 XTestReqType; /* always X_TestGetInput */ CARD16 length B16; /* 2 */ CARD32 mode B32; } xTestGetInputReq; #define sz_xTestGetInputReq 8 typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 XTestReqType; /* always X_TestStopInput */ CARD16 length B32; /* 1 */ } xTestStopInputReq; #define sz_xTestStopInputReq 4 typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 XTestReqType; /* always X_TestReset */ CARD16 length B16; /* 1 */ } xTestResetReq; #define sz_xTestResetReq 4 typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 XTestReqType; /* always X_TestQueryInputSize */ CARD16 length B16; /* 1 */ } xTestQueryInputSizeReq; #define sz_xTestQueryInputSizeReq 4 /* * This is the definition of the reply for the xTestQueryInputSize * request. It should remain the same minimum size as other replies * (32 bytes). */ typedef struct { CARD8 type; /* always X_Reply */ CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* always 0 */ CARD32 size_return B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xTestQueryInputSizeReply; /* * This is the definition for the input action wire event structure. * This event is sent to the client when the server has one or * more user input actions to report to the client. It must * remain the same size as all other wire events (32 bytes). */ typedef struct { CARD8 type; /* always XTestInputActionType */ CARD8 pad00; CARD16 sequenceNumber B16; CARD8 actions[XTestACTIONS_SIZE]; } xTestInputActionEvent; /* * This is the definition for the xTestFakeAck wire event structure. * This event is sent to the client when the server has completely * processed its input action buffer, and is ready for more. * It must remain the same size as all other wire events (32 bytes). */ typedef struct { CARD8 type; /* always XTestFakeAckType */ CARD8 pad00; CARD16 sequenceNumber B16; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; CARD32 pad06 B32; CARD32 pad07 B32; CARD32 pad08 B32; } xTestFakeAckEvent; /* * These are the definitions for key/button motion input actions. */ typedef struct { CARD8 header; /* which device, key up/down */ CARD8 keycode; /* which key/button to move */ CARD16 delay_time B16; /* how long to delay (in ms) */ } XTestKeyInfo; /* * This is the definition for pointer jump input actions. */ typedef struct { CARD8 header; /* which pointer */ CARD8 pad1; /* unused padding byte */ CARD16 jumpx B16; /* x coord to jump to */ CARD16 jumpy B16; /* y coord to jump to */ CARD16 delay_time B16; /* how long to delay (in ms) */ } XTestJumpInfo; /* * These are the definitions for pointer relative motion input * actions. * * The sign bits for the x and y relative motions are contained * in the header byte. The x and y relative motions are packed * into one byte to make things fit in 32 bits. If the relative * motion range is larger than +/-15, use the pointer jump action. */ typedef struct { CARD8 header; /* which pointer */ CARD8 motion_data; /* x,y relative motion */ CARD16 delay_time B16; /* how long to delay (in ms) */ } XTestMotionInfo; /* * These are the definitions for a long delay input action. It is * used when more than XTestSHORT_DELAY_TIME milliseconds of delay * (approximately one minute) is needed. * * The device ID for a delay is always set to XTestDELAY_DEVICE_ID. * This guarantees that a header byte with a value of 0 is not * a valid header, so it can be used as a flag to indicate that * there are no more input actions in an XTestInputAction event. */ typedef struct { CARD8 header; /* always XTestDELAY_DEVICE_ID */ CARD8 pad1; /* unused padding byte */ CARD16 pad2 B16; /* unused padding word */ CARD32 delay_time B32; /* how long to delay (in ms) */ } XTestDelayInfo; #endif /* _XTESTEXT1PROTO_H */ X11/extensions/dmxproto.h000064400000033173147631660250011362 0ustar00/* * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina. * * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation on the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial * portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * Authors: * Rickard E. (Rik) Faith * */ /** \file * This file describes the structures necessary to implement the wire * protocol for the DMX protocol extension. It should be included only * in files that implement the client-side (or server-side) part of the * protocol (i.e., client-side applications should \b not include this * file). */ #ifndef _DMXSTR_H_ #define _DMXSTR_H_ #define DMX_EXTENSION_NAME "DMX" #define DMX_EXTENSION_MAJOR 2 #define DMX_EXTENSION_MINOR 2 #define DMX_EXTENSION_PATCH 20040604 /* These values must be larger than LastExtensionError. The values in dmxext.h and dmxproto.h *MUST* match. */ #define DMX_BAD_XINERAMA 1001 #define DMX_BAD_VALUE 1002 #define X_DMXQueryVersion 0 #define X_DMXGetScreenCount 1 #define X_DMXGetScreenInformationDEPRECATED 2 #define X_DMXGetWindowAttributes 3 #define X_DMXGetInputCount 4 #define X_DMXGetInputAttributes 5 #define X_DMXForceWindowCreationDEPRECATED 6 #define X_DMXReconfigureScreenDEPRECATED 7 #define X_DMXSync 8 #define X_DMXForceWindowCreation 9 #define X_DMXGetScreenAttributes 10 #define X_DMXChangeScreensAttributes 11 #define X_DMXAddScreen 12 #define X_DMXRemoveScreen 13 #define X_DMXGetDesktopAttributes 14 #define X_DMXChangeDesktopAttributes 15 #define X_DMXAddInput 16 #define X_DMXRemoveInput 17 /** Wire-level description of DMXQueryVersion protocol request. */ typedef struct { CARD8 reqType; /* dmxcode */ CARD8 dmxReqType; /* X_DMXQueryVersion */ CARD16 length B16; } xDMXQueryVersionReq; #define sz_xDMXQueryVersionReq 4 /** Wire-level description of DMXQueryVersion protocol reply. */ typedef struct { BYTE type; /* X_Reply */ CARD8 ununsed; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 majorVersion B32; CARD32 minorVersion B32; CARD32 patchVersion B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; } xDMXQueryVersionReply; #define sz_xDMXQueryVersionReply 32 /** Wire-level description of DMXSync protocol request. */ typedef struct { CARD8 reqType; /* DMXCode */ CARD8 dmxReqType; /* X_DMXSync */ CARD16 length B16; } xDMXSyncReq; #define sz_xDMXSyncReq 4 /** Wire-level description of DMXSync protocol reply. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 status B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xDMXSyncReply; #define sz_xDMXSyncReply 32 /** Wire-level description of DMXForceWindowCreation protocol request. */ typedef struct { CARD8 reqType; /* DMXCode */ CARD8 dmxReqType; /* X_DMXForceWindowCreation */ CARD16 length B16; CARD32 window B32; } xDMXForceWindowCreationReq; #define sz_xDMXForceWindowCreationReq 8 /** Wire-level description of DMXForceWindowCreation protocol reply. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 status B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xDMXForceWindowCreationReply; #define sz_xDMXForceWindowCreationReply 32 /** Wire-level description of DMXGetScreenCount protocol request. */ typedef struct { CARD8 reqType; /* DMXCode */ CARD8 dmxReqType; /* X_DMXGetScreenCount */ CARD16 length B16; } xDMXGetScreenCountReq; #define sz_xDMXGetScreenCountReq 4 /** Wire-level description of DMXGetScreenCount protocol reply. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 screenCount B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xDMXGetScreenCountReply; #define sz_xDMXGetScreenCountReply 32 /** Wire-level description of DMXGetScreenAttributes protocol request. */ typedef struct { CARD8 reqType; /* DMXCode */ CARD8 dmxReqType; /* X_DMXGetScreenAttributes */ CARD16 length B16; CARD32 physicalScreen B32; } xDMXGetScreenAttributesReq; #define sz_xDMXGetScreenAttributesReq 8 /** Wire-level description of DMXGetScreenAttributes protocol reply. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 displayNameLength B32; CARD32 logicalScreen B32; CARD16 screenWindowWidth B16; CARD16 screenWindowHeight B16; INT16 screenWindowXoffset B16; INT16 screenWindowYoffset B16; CARD16 rootWindowWidth B16; CARD16 rootWindowHeight B16; INT16 rootWindowXoffset B16; INT16 rootWindowYoffset B16; INT16 rootWindowXorigin B16; INT16 rootWindowYorigin B16; } xDMXGetScreenAttributesReply; #define sz_xDMXGetScreenAttributesReply 36 /** Wire-level description of DMXChangeScreensAttributes protocol request. */ typedef struct { CARD8 reqType; /* DMXCode */ CARD8 dmxReqType; /* X_DMXChangeScreensAttributes */ CARD16 length B16; CARD32 screenCount B32; CARD32 maskCount B32; } xDMXChangeScreensAttributesReq; #define sz_xDMXChangeScreensAttributesReq 12 /** Wire-level description of DMXChangeScreensAttributes protocol reply. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 status B32; CARD32 errorScreen B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xDMXChangeScreensAttributesReply; #define sz_xDMXChangeScreensAttributesReply 32 /** Wire-level description of DMXAddScreen protocol request. */ typedef struct { CARD8 reqType; /* DMXCode */ CARD8 dmxReqType; /* X_DMXAddScreen */ CARD16 length B16; CARD32 displayNameLength B32; CARD32 physicalScreen B32; CARD32 valueMask B32; } xDMXAddScreenReq; #define sz_xDMXAddScreenReq 16 /** Wire-level description of DMXAddScreen protocol reply. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 status B32; CARD32 physicalScreen B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xDMXAddScreenReply; #define sz_xDMXAddScreenReply 32 /** Wire-level description of DMXRemoveScreen protocol request. */ typedef struct { CARD8 reqType; /* DMXCode */ CARD8 dmxReqType; /* X_DMXRemoveScreen */ CARD16 length B16; CARD32 physicalScreen B32; } xDMXRemoveScreenReq; #define sz_xDMXRemoveScreenReq 8 /** Wire-level description of DMXRemoveScreen protocol reply. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 status B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xDMXRemoveScreenReply; #define sz_xDMXRemoveScreenReply 32 /** Wire-level description of DMXGetWindowAttributes protocol request. */ typedef struct { CARD8 reqType; /* DMXCode */ CARD8 dmxReqType; /* X_DMXGetWindowAttributes */ CARD16 length B16; CARD32 window B32; } xDMXGetWindowAttributesReq; #define sz_xDMXGetWindowAttributesReq 8 /** Wire-level description of DMXGetWindowAttributes protocol reply. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 screenCount B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xDMXGetWindowAttributesReply; #define sz_xDMXGetWindowAttributesReply 32 /** Wire-level description of DMXGetDesktopAttributes protocol request. */ typedef struct { CARD8 reqType; /* DMXCode */ CARD8 dmxReqType; /* X_DMXGetDesktopAttributes */ CARD16 length B16; } xDMXGetDesktopAttributesReq; #define sz_xDMXGetDesktopAttributesReq 4 /** Wire-level description of DMXGetDesktopAttributes protocol reply. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; INT16 width; INT16 height; INT16 shiftX; INT16 shiftY; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xDMXGetDesktopAttributesReply; #define sz_xDMXGetDesktopAttributesReply 32 /** Wire-level description of DMXChangeDesktopAttributes protocol request. */ typedef struct { CARD8 reqType; /* DMXCode */ CARD8 dmxReqType; /* X_DMXChangeDesktopAttributes */ CARD16 length B16; CARD32 valueMask B32; } xDMXChangeDesktopAttributesReq; #define sz_xDMXChangeDesktopAttributesReq 8 /** Wire-level description of DMXChangeDesktopAttributes protocol reply. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 status B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xDMXChangeDesktopAttributesReply; #define sz_xDMXChangeDesktopAttributesReply 32 /** Wire-level description of DMXGetInputCount protocol request. */ typedef struct { CARD8 reqType; /* DMXCode */ CARD8 dmxReqType; /* X_DMXGetInputCount */ CARD16 length B16; } xDMXGetInputCountReq; #define sz_xDMXGetInputCountReq 4 /** Wire-level description of DMXGetInputCount protocol reply. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 inputCount B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xDMXGetInputCountReply; #define sz_xDMXGetInputCountReply 32 /** Wire-level description of DMXGetInputAttributes protocol request. */ typedef struct { CARD8 reqType; /* DMXCode */ CARD8 dmxReqType; /* X_DMXGetInputAttributes */ CARD16 length B16; CARD32 deviceId B32; } xDMXGetInputAttributesReq; #define sz_xDMXGetInputAttributesReq 8 /** Wire-level description of DMXGetInputAttributes protocol reply. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 inputType B32; CARD32 physicalScreen B32; CARD32 physicalId B32; CARD32 nameLength B32; BOOL isCore; BOOL sendsCore; BOOL detached; CARD8 pad0; CARD32 pad1 B32; } xDMXGetInputAttributesReply; #define sz_xDMXGetInputAttributesReply 32 /** Wire-level description of DMXAddInput protocol request. */ typedef struct { CARD8 reqType; /* DMXCode */ CARD8 dmxReqType; /* X_DMXAddInput */ CARD16 length B16; CARD32 displayNameLength B32; CARD32 valueMask; } xDMXAddInputReq; #define sz_xDMXAddInputReq 12 /** Wire-level description of DMXAddInput protocol reply. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 status B32; CARD32 physicalId B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xDMXAddInputReply; #define sz_xDMXAddInputReply 32 /** Wire-level description of DMXRemoveInput protocol request. */ typedef struct { CARD8 reqType; /* DMXCode */ CARD8 dmxReqType; /* X_DMXRemoveInput */ CARD16 length B16; CARD32 physicalId B32; } xDMXRemoveInputReq; #define sz_xDMXRemoveInputReq 8 /** Wire-level description of DMXRemoveInput protocol reply. */ typedef struct { BYTE type; CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 status B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xDMXRemoveInputReply; #define sz_xDMXRemoveInputReply 32 #endif X11/extensions/xcmiscstr.h000064400000000271147631660250011516 0ustar00#warning "xcmiscstr.h is obsolete and may be removed in the future." #warning "include for the protocol defines." #include X11/extensions/xf86bigfont.h000064400000000636147631660250011650 0ustar00/* * Declarations for the BIGFONT extension. * * Copyright (c) 1999-2000 Bruno Haible * Copyright (c) 1999-2000 The XFree86 Project, Inc. */ /* THIS IS NOT AN X CONSORTIUM STANDARD */ #ifndef _XF86BIGFONT_H_ #define _XF86BIGFONT_H_ #define X_XF86BigfontQueryVersion 0 #define X_XF86BigfontQueryFont 1 #define XF86BigfontNumberEvents 0 #define XF86BigfontNumberErrors 0 #endif /* _XF86BIGFONT_H_ */ X11/extensions/ag.h000064400000003251147631660250010067 0ustar00/* Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _AG_H_ #define _AG_H_ #define XAGNAME "XC-APPGROUP" #define XAG_MAJOR_VERSION 1 /* current version numbers */ #define XAG_MINOR_VERSION 0 #define XagWindowTypeX11 0 #define XagWindowTypeMacintosh 1 #define XagWindowTypeWin32 2 #define XagWindowTypeWin16 3 #define XagBadAppGroup 0 #define XagNumberErrors (XagBadAppGroup + 1) #define XagNsingleScreen 7 #define XagNdefaultRoot 1 #define XagNrootVisual 2 #define XagNdefaultColormap 3 #define XagNblackPixel 4 #define XagNwhitePixel 5 #define XagNappGroupLeader 6 #endif /* _AG_H_ */ X11/extensions/xfixeswire.h000064400000012424147631660250011677 0ustar00/* * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * Copyright 2010 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /* * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _XFIXESWIRE_H_ #define _XFIXESWIRE_H_ #define XFIXES_NAME "XFIXES" #define XFIXES_MAJOR 5 #define XFIXES_MINOR 0 /*************** Version 1 ******************/ #define X_XFixesQueryVersion 0 #define X_XFixesChangeSaveSet 1 #define X_XFixesSelectSelectionInput 2 #define X_XFixesSelectCursorInput 3 #define X_XFixesGetCursorImage 4 /*************** Version 2 ******************/ #define X_XFixesCreateRegion 5 #define X_XFixesCreateRegionFromBitmap 6 #define X_XFixesCreateRegionFromWindow 7 #define X_XFixesCreateRegionFromGC 8 #define X_XFixesCreateRegionFromPicture 9 #define X_XFixesDestroyRegion 10 #define X_XFixesSetRegion 11 #define X_XFixesCopyRegion 12 #define X_XFixesUnionRegion 13 #define X_XFixesIntersectRegion 14 #define X_XFixesSubtractRegion 15 #define X_XFixesInvertRegion 16 #define X_XFixesTranslateRegion 17 #define X_XFixesRegionExtents 18 #define X_XFixesFetchRegion 19 #define X_XFixesSetGCClipRegion 20 #define X_XFixesSetWindowShapeRegion 21 #define X_XFixesSetPictureClipRegion 22 #define X_XFixesSetCursorName 23 #define X_XFixesGetCursorName 24 #define X_XFixesGetCursorImageAndName 25 #define X_XFixesChangeCursor 26 #define X_XFixesChangeCursorByName 27 /*************** Version 3 ******************/ #define X_XFixesExpandRegion 28 /*************** Version 4 ******************/ #define X_XFixesHideCursor 29 #define X_XFixesShowCursor 30 /*************** Version 5 ******************/ #define X_XFixesCreatePointerBarrier 31 #define X_XFixesDestroyPointerBarrier 32 #define XFixesNumberRequests (X_XFixesDestroyPointerBarrier+1) /* Selection events share one event number */ #define XFixesSelectionNotify 0 /* Within the selection, the 'subtype' field distinguishes */ #define XFixesSetSelectionOwnerNotify 0 #define XFixesSelectionWindowDestroyNotify 1 #define XFixesSelectionClientCloseNotify 2 #define XFixesSetSelectionOwnerNotifyMask (1L << 0) #define XFixesSelectionWindowDestroyNotifyMask (1L << 1) #define XFixesSelectionClientCloseNotifyMask (1L << 2) /* There's only one cursor event so far */ #define XFixesCursorNotify 1 #define XFixesDisplayCursorNotify 0 #define XFixesDisplayCursorNotifyMask (1L << 0) #define XFixesNumberEvents (2) /* errors */ #define BadRegion 0 #define BadBarrier 1 #define XFixesNumberErrors (BadBarrier+1) #define SaveSetNearest 0 #define SaveSetRoot 1 #define SaveSetMap 0 #define SaveSetUnmap 1 /*************** Version 2 ******************/ #define WindowRegionBounding 0 #define WindowRegionClip 1 /*************** Version 5 ******************/ #define BarrierPositiveX (1L << 0) #define BarrierPositiveY (1L << 1) #define BarrierNegativeX (1L << 2) #define BarrierNegativeY (1L << 3) #endif /* _XFIXESWIRE_H_ */ X11/extensions/compositeproto.h000064400000012767147631660250012602 0ustar00/* * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /* * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _COMPOSITEPROTO_H_ #define _COMPOSITEPROTO_H_ #include #include #define Window CARD32 #define Region CARD32 #define Pixmap CARD32 /* * requests and replies */ typedef struct { CARD8 reqType; CARD8 compositeReqType; CARD16 length B16; CARD32 majorVersion B32; CARD32 minorVersion B32; } xCompositeQueryVersionReq; #define sz_xCompositeQueryVersionReq 12 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 majorVersion B32; CARD32 minorVersion B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xCompositeQueryVersionReply; #define sz_xCompositeQueryVersionReply 32 typedef struct { CARD8 reqType; CARD8 compositeReqType; CARD16 length B16; Window window B32; CARD8 update; CARD8 pad1; CARD16 pad2 B16; } xCompositeRedirectWindowReq; #define sz_xCompositeRedirectWindowReq 12 typedef struct { CARD8 reqType; CARD8 compositeReqType; CARD16 length B16; Window window B32; CARD8 update; CARD8 pad1; CARD16 pad2 B16; } xCompositeRedirectSubwindowsReq; #define sz_xCompositeRedirectSubwindowsReq 12 typedef struct { CARD8 reqType; CARD8 compositeReqType; CARD16 length B16; Window window B32; CARD8 update; CARD8 pad1; CARD16 pad2 B16; } xCompositeUnredirectWindowReq; #define sz_xCompositeUnredirectWindowReq 12 typedef struct { CARD8 reqType; CARD8 compositeReqType; CARD16 length B16; Window window B32; CARD8 update; CARD8 pad1; CARD16 pad2 B16; } xCompositeUnredirectSubwindowsReq; #define sz_xCompositeUnredirectSubwindowsReq 12 typedef struct { CARD8 reqType; CARD8 compositeReqType; CARD16 length B16; Region region B32; Window window B32; } xCompositeCreateRegionFromBorderClipReq; #define sz_xCompositeCreateRegionFromBorderClipReq 12 /* Version 0.2 additions */ typedef struct { CARD8 reqType; CARD8 compositeReqType; CARD16 length; Window window B32; Pixmap pixmap B32; } xCompositeNameWindowPixmapReq; #define sz_xCompositeNameWindowPixmapReq 12 /* Version 0.3 additions */ typedef struct { CARD8 reqType; CARD8 compositeReqType; CARD16 length B16; Window window B32; } xCompositeGetOverlayWindowReq; #define sz_xCompositeGetOverlayWindowReq sizeof(xCompositeGetOverlayWindowReq) typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; Window overlayWin B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xCompositeGetOverlayWindowReply; #define sz_xCompositeGetOverlayWindowReply sizeof(xCompositeGetOverlayWindowReply) typedef struct { CARD8 reqType; CARD8 compositeReqType; CARD16 length B16; Window window B32; } xCompositeReleaseOverlayWindowReq; #define sz_xCompositeReleaseOverlayWindowReq sizeof(xCompositeReleaseOverlayWindowReq) #undef Window #undef Region #undef Pixmap #endif /* _COMPOSITEPROTO_H_ */ X11/extensions/XKBstr.h000064400000046273147631660250010670 0ustar00/************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XKBSTR_H_ #define _XKBSTR_H_ #include #define XkbCharToInt(v) ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f)) #define XkbIntTo2Chars(i,h,l) (((h)=((i>>8)&0xff)),((l)=((i)&0xff))) #define Xkb2CharsToInt(h,l) ((short)(((h)<<8)|(l))) /* * The Xkb structs are full of implicit padding to properly align members. * We can't clean that up without breaking ABI, so tell clang not to bother * complaining about it. */ #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpadded" #endif /* * Common data structures and access macros */ typedef struct _XkbStateRec { unsigned char group; unsigned char locked_group; unsigned short base_group; unsigned short latched_group; unsigned char mods; unsigned char base_mods; unsigned char latched_mods; unsigned char locked_mods; unsigned char compat_state; unsigned char grab_mods; unsigned char compat_grab_mods; unsigned char lookup_mods; unsigned char compat_lookup_mods; unsigned short ptr_buttons; } XkbStateRec,*XkbStatePtr; #define XkbModLocks(s) ((s)->locked_mods) #define XkbStateMods(s) ((s)->base_mods|(s)->latched_mods|XkbModLocks(s)) #define XkbGroupLock(s) ((s)->locked_group) #define XkbStateGroup(s) ((s)->base_group+(s)->latched_group+XkbGroupLock(s)) #define XkbStateFieldFromRec(s) XkbBuildCoreState((s)->lookup_mods,(s)->group) #define XkbGrabStateFromRec(s) XkbBuildCoreState((s)->grab_mods,(s)->group) typedef struct _XkbMods { unsigned char mask; /* effective mods */ unsigned char real_mods; unsigned short vmods; } XkbModsRec,*XkbModsPtr; typedef struct _XkbKTMapEntry { Bool active; unsigned char level; XkbModsRec mods; } XkbKTMapEntryRec,*XkbKTMapEntryPtr; typedef struct _XkbKeyType { XkbModsRec mods; unsigned char num_levels; unsigned char map_count; /* map is an array of map_count XkbKTMapEntryRec structs */ XkbKTMapEntryPtr map; /* preserve is an array of map_count XkbModsRec structs */ XkbModsPtr preserve; Atom name; /* level_names is an array of num_levels Atoms */ Atom * level_names; } XkbKeyTypeRec, *XkbKeyTypePtr; #define XkbNumGroups(g) ((g)&0x0f) #define XkbOutOfRangeGroupInfo(g) ((g)&0xf0) #define XkbOutOfRangeGroupAction(g) ((g)&0xc0) #define XkbOutOfRangeGroupNumber(g) (((g)&0x30)>>4) #define XkbSetGroupInfo(g,w,n) (((w)&0xc0)|(((n)&3)<<4)|((g)&0x0f)) #define XkbSetNumGroups(g,n) (((g)&0xf0)|((n)&0x0f)) /* * Structures and access macros used primarily by the server */ typedef struct _XkbBehavior { unsigned char type; unsigned char data; } XkbBehavior; #define XkbAnyActionDataSize 7 typedef struct _XkbAnyAction { unsigned char type; unsigned char data[XkbAnyActionDataSize]; } XkbAnyAction; typedef struct _XkbModAction { unsigned char type; unsigned char flags; unsigned char mask; unsigned char real_mods; unsigned char vmods1; unsigned char vmods2; } XkbModAction; #define XkbModActionVMods(a) \ ((short)(((a)->vmods1<<8)|((a)->vmods2))) #define XkbSetModActionVMods(a,v) \ (((a)->vmods1=(((v)>>8)&0xff)),(a)->vmods2=((v)&0xff)) typedef struct _XkbGroupAction { unsigned char type; unsigned char flags; char group_XXX; } XkbGroupAction; #define XkbSAGroup(a) (XkbCharToInt((a)->group_XXX)) #define XkbSASetGroup(a,g) ((a)->group_XXX=(g)) typedef struct _XkbISOAction { unsigned char type; unsigned char flags; unsigned char mask; unsigned char real_mods; char group_XXX; unsigned char affect; unsigned char vmods1; unsigned char vmods2; } XkbISOAction; typedef struct _XkbPtrAction { unsigned char type; unsigned char flags; unsigned char high_XXX; unsigned char low_XXX; unsigned char high_YYY; unsigned char low_YYY; } XkbPtrAction; #define XkbPtrActionX(a) (Xkb2CharsToInt((a)->high_XXX,(a)->low_XXX)) #define XkbPtrActionY(a) (Xkb2CharsToInt((a)->high_YYY,(a)->low_YYY)) #define XkbSetPtrActionX(a,x) (XkbIntTo2Chars(x,(a)->high_XXX,(a)->low_XXX)) #define XkbSetPtrActionY(a,y) (XkbIntTo2Chars(y,(a)->high_YYY,(a)->low_YYY)) typedef struct _XkbPtrBtnAction { unsigned char type; unsigned char flags; unsigned char count; unsigned char button; } XkbPtrBtnAction; typedef struct _XkbPtrDfltAction { unsigned char type; unsigned char flags; unsigned char affect; char valueXXX; } XkbPtrDfltAction; #define XkbSAPtrDfltValue(a) (XkbCharToInt((a)->valueXXX)) #define XkbSASetPtrDfltValue(a,c) ((a)->valueXXX= ((c)&0xff)) typedef struct _XkbSwitchScreenAction { unsigned char type; unsigned char flags; char screenXXX; } XkbSwitchScreenAction; #define XkbSAScreen(a) (XkbCharToInt((a)->screenXXX)) #define XkbSASetScreen(a,s) ((a)->screenXXX= ((s)&0xff)) typedef struct _XkbCtrlsAction { unsigned char type; unsigned char flags; unsigned char ctrls3; unsigned char ctrls2; unsigned char ctrls1; unsigned char ctrls0; } XkbCtrlsAction; #define XkbActionSetCtrls(a,c) (((a)->ctrls3=(((c)>>24)&0xff)),\ ((a)->ctrls2=(((c)>>16)&0xff)),\ ((a)->ctrls1=(((c)>>8)&0xff)),\ ((a)->ctrls0=((c)&0xff))) #define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|\ (((unsigned int)(a)->ctrls2)<<16)|\ (((unsigned int)(a)->ctrls1)<<8)|\ ((unsigned int)((a)->ctrls0))) typedef struct _XkbMessageAction { unsigned char type; unsigned char flags; unsigned char message[6]; } XkbMessageAction; typedef struct _XkbRedirectKeyAction { unsigned char type; unsigned char new_key; unsigned char mods_mask; unsigned char mods; unsigned char vmods_mask0; unsigned char vmods_mask1; unsigned char vmods0; unsigned char vmods1; } XkbRedirectKeyAction; #define XkbSARedirectVMods(a) ((((unsigned int)(a)->vmods1)<<8)|\ ((unsigned int)(a)->vmods0)) #define XkbSARedirectSetVMods(a,m) (((a)->vmods1=(((m)>>8)&0xff)),\ ((a)->vmods0=((m)&0xff))) #define XkbSARedirectVModsMask(a) ((((unsigned int)(a)->vmods_mask1)<<8)|\ ((unsigned int)(a)->vmods_mask0)) #define XkbSARedirectSetVModsMask(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\ ((a)->vmods_mask0=((m)&0xff))) typedef struct _XkbDeviceBtnAction { unsigned char type; unsigned char flags; unsigned char count; unsigned char button; unsigned char device; } XkbDeviceBtnAction; typedef struct _XkbDeviceValuatorAction { unsigned char type; unsigned char device; unsigned char v1_what; unsigned char v1_ndx; unsigned char v1_value; unsigned char v2_what; unsigned char v2_ndx; unsigned char v2_value; } XkbDeviceValuatorAction; typedef union _XkbAction { XkbAnyAction any; XkbModAction mods; XkbGroupAction group; XkbISOAction iso; XkbPtrAction ptr; XkbPtrBtnAction btn; XkbPtrDfltAction dflt; XkbSwitchScreenAction screen; XkbCtrlsAction ctrls; XkbMessageAction msg; XkbRedirectKeyAction redirect; XkbDeviceBtnAction devbtn; XkbDeviceValuatorAction devval; unsigned char type; } XkbAction; typedef struct _XkbControls { unsigned char mk_dflt_btn; unsigned char num_groups; unsigned char groups_wrap; XkbModsRec internal; XkbModsRec ignore_lock; unsigned int enabled_ctrls; unsigned short repeat_delay; unsigned short repeat_interval; unsigned short slow_keys_delay; unsigned short debounce_delay; unsigned short mk_delay; unsigned short mk_interval; unsigned short mk_time_to_max; unsigned short mk_max_speed; short mk_curve; unsigned short ax_options; unsigned short ax_timeout; unsigned short axt_opts_mask; unsigned short axt_opts_values; unsigned int axt_ctrls_mask; unsigned int axt_ctrls_values; unsigned char per_key_repeat[XkbPerKeyBitArraySize]; } XkbControlsRec, *XkbControlsPtr; #define XkbAX_AnyFeedback(c) ((c)->enabled_ctrls&XkbAccessXFeedbackMask) #define XkbAX_NeedOption(c,w) ((c)->ax_options&(w)) #define XkbAX_NeedFeedback(c,w) (XkbAX_AnyFeedback(c)&&XkbAX_NeedOption(c,w)) typedef struct _XkbServerMapRec { /* acts is an array of XkbActions structs, with size_acts entries allocated, and num_acts entries used. */ unsigned short num_acts; unsigned short size_acts; XkbAction *acts; /* behaviors, key_acts, explicit, & vmodmap are all arrays with (xkb->max_key_code + 1) entries allocated for each. */ XkbBehavior *behaviors; unsigned short *key_acts; #if defined(__cplusplus) || defined(c_plusplus) /* explicit is a C++ reserved word */ unsigned char *c_explicit; #else unsigned char *explicit; #endif unsigned char vmods[XkbNumVirtualMods]; unsigned short *vmodmap; } XkbServerMapRec, *XkbServerMapPtr; #define XkbSMKeyActionsPtr(m,k) (&(m)->acts[(m)->key_acts[k]]) /* * Structures and access macros used primarily by clients */ typedef struct _XkbSymMapRec { unsigned char kt_index[XkbNumKbdGroups]; unsigned char group_info; unsigned char width; unsigned short offset; } XkbSymMapRec, *XkbSymMapPtr; typedef struct _XkbClientMapRec { /* types is an array of XkbKeyTypeRec structs, with size_types entries allocated, and num_types entries used. */ unsigned char size_types; unsigned char num_types; XkbKeyTypePtr types; /* syms is an array of size_syms KeySyms, in which num_syms are used */ unsigned short size_syms; unsigned short num_syms; KeySym *syms; /* key_sym_map is an array of (max_key_code + 1) XkbSymMapRec structs */ XkbSymMapPtr key_sym_map; /* modmap is an array of (max_key_code + 1) unsigned chars */ unsigned char *modmap; } XkbClientMapRec, *XkbClientMapPtr; #define XkbCMKeyGroupInfo(m,k) ((m)->key_sym_map[k].group_info) #define XkbCMKeyNumGroups(m,k) (XkbNumGroups((m)->key_sym_map[k].group_info)) #define XkbCMKeyGroupWidth(m,k,g) (XkbCMKeyType(m,k,g)->num_levels) #define XkbCMKeyGroupsWidth(m,k) ((m)->key_sym_map[k].width) #define XkbCMKeyTypeIndex(m,k,g) ((m)->key_sym_map[k].kt_index[g&0x3]) #define XkbCMKeyType(m,k,g) (&(m)->types[XkbCMKeyTypeIndex(m,k,g)]) #define XkbCMKeyNumSyms(m,k) (XkbCMKeyGroupsWidth(m,k)*XkbCMKeyNumGroups(m,k)) #define XkbCMKeySymsOffset(m,k) ((m)->key_sym_map[k].offset) #define XkbCMKeySymsPtr(m,k) (&(m)->syms[XkbCMKeySymsOffset(m,k)]) /* * Compatibility structures and access macros */ typedef struct _XkbSymInterpretRec { KeySym sym; unsigned char flags; unsigned char match; unsigned char mods; unsigned char virtual_mod; XkbAnyAction act; } XkbSymInterpretRec,*XkbSymInterpretPtr; typedef struct _XkbCompatMapRec { /* sym_interpret is an array of XkbSymInterpretRec structs, in which size_si are allocated & num_si are used. */ XkbSymInterpretPtr sym_interpret; XkbModsRec groups[XkbNumKbdGroups]; unsigned short num_si; unsigned short size_si; } XkbCompatMapRec, *XkbCompatMapPtr; typedef struct _XkbIndicatorMapRec { unsigned char flags; unsigned char which_groups; unsigned char groups; unsigned char which_mods; XkbModsRec mods; unsigned int ctrls; } XkbIndicatorMapRec, *XkbIndicatorMapPtr; #define XkbIM_IsAuto(i) ((((i)->flags&XkbIM_NoAutomatic)==0)&&\ (((i)->which_groups&&(i)->groups)||\ ((i)->which_mods&&(i)->mods.mask)||\ ((i)->ctrls))) #define XkbIM_InUse(i) (((i)->flags)||((i)->which_groups)||\ ((i)->which_mods)||((i)->ctrls)) typedef struct _XkbIndicatorRec { unsigned long phys_indicators; XkbIndicatorMapRec maps[XkbNumIndicators]; } XkbIndicatorRec,*XkbIndicatorPtr; typedef struct _XkbKeyNameRec { char name[XkbKeyNameLength]; } XkbKeyNameRec,*XkbKeyNamePtr; typedef struct _XkbKeyAliasRec { char real[XkbKeyNameLength]; char alias[XkbKeyNameLength]; } XkbKeyAliasRec,*XkbKeyAliasPtr; /* * Names for everything */ typedef struct _XkbNamesRec { Atom keycodes; Atom geometry; Atom symbols; Atom types; Atom compat; Atom vmods[XkbNumVirtualMods]; Atom indicators[XkbNumIndicators]; Atom groups[XkbNumKbdGroups]; /* keys is an array of (xkb->max_key_code + 1) XkbKeyNameRec entries */ XkbKeyNamePtr keys; /* key_aliases is an array of num_key_aliases XkbKeyAliasRec entries */ XkbKeyAliasPtr key_aliases; /* radio_groups is an array of num_rg Atoms */ Atom *radio_groups; Atom phys_symbols; /* num_keys seems to be unused in libX11 */ unsigned char num_keys; unsigned char num_key_aliases; unsigned short num_rg; } XkbNamesRec,*XkbNamesPtr; typedef struct _XkbGeometry *XkbGeometryPtr; /* * Tie it all together into one big keyboard description */ typedef struct _XkbDesc { struct _XDisplay * dpy; unsigned short flags; unsigned short device_spec; KeyCode min_key_code; KeyCode max_key_code; XkbControlsPtr ctrls; XkbServerMapPtr server; XkbClientMapPtr map; XkbIndicatorPtr indicators; XkbNamesPtr names; XkbCompatMapPtr compat; XkbGeometryPtr geom; } XkbDescRec, *XkbDescPtr; #define XkbKeyKeyTypeIndex(d,k,g) (XkbCMKeyTypeIndex((d)->map,k,g)) #define XkbKeyKeyType(d,k,g) (XkbCMKeyType((d)->map,k,g)) #define XkbKeyGroupWidth(d,k,g) (XkbCMKeyGroupWidth((d)->map,k,g)) #define XkbKeyGroupsWidth(d,k) (XkbCMKeyGroupsWidth((d)->map,k)) #define XkbKeyGroupInfo(d,k) (XkbCMKeyGroupInfo((d)->map,(k))) #define XkbKeyNumGroups(d,k) (XkbCMKeyNumGroups((d)->map,(k))) #define XkbKeyNumSyms(d,k) (XkbCMKeyNumSyms((d)->map,(k))) #define XkbKeySymsPtr(d,k) (XkbCMKeySymsPtr((d)->map,(k))) #define XkbKeySym(d,k,n) (XkbKeySymsPtr(d,k)[n]) #define XkbKeySymEntry(d,k,sl,g) \ (XkbKeySym(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl)))) #define XkbKeyAction(d,k,n) \ (XkbKeyHasActions(d,k)?&XkbKeyActionsPtr(d,k)[n]:NULL) #define XkbKeyActionEntry(d,k,sl,g) \ (XkbKeyHasActions(d,k)?\ XkbKeyAction(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))):NULL) #define XkbKeyHasActions(d,k) ((d)->server->key_acts[k]!=0) #define XkbKeyNumActions(d,k) (XkbKeyHasActions(d,k)?XkbKeyNumSyms(d,k):1) #define XkbKeyActionsPtr(d,k) (XkbSMKeyActionsPtr((d)->server,k)) #define XkbKeycodeInRange(d,k) (((k)>=(d)->min_key_code)&&\ ((k)<=(d)->max_key_code)) #define XkbNumKeys(d) ((d)->max_key_code-(d)->min_key_code+1) /* * The following structures can be used to track changes * to a keyboard device */ typedef struct _XkbMapChanges { unsigned short changed; KeyCode min_key_code; KeyCode max_key_code; unsigned char first_type; unsigned char num_types; KeyCode first_key_sym; unsigned char num_key_syms; KeyCode first_key_act; unsigned char num_key_acts; KeyCode first_key_behavior; unsigned char num_key_behaviors; KeyCode first_key_explicit; unsigned char num_key_explicit; KeyCode first_modmap_key; unsigned char num_modmap_keys; KeyCode first_vmodmap_key; unsigned char num_vmodmap_keys; unsigned char pad; unsigned short vmods; } XkbMapChangesRec,*XkbMapChangesPtr; typedef struct _XkbControlsChanges { unsigned int changed_ctrls; unsigned int enabled_ctrls_changes; Bool num_groups_changed; } XkbControlsChangesRec,*XkbControlsChangesPtr; typedef struct _XkbIndicatorChanges { unsigned int state_changes; unsigned int map_changes; } XkbIndicatorChangesRec,*XkbIndicatorChangesPtr; typedef struct _XkbNameChanges { unsigned int changed; unsigned char first_type; unsigned char num_types; unsigned char first_lvl; unsigned char num_lvls; unsigned char num_aliases; unsigned char num_rg; unsigned char first_key; unsigned char num_keys; unsigned short changed_vmods; unsigned long changed_indicators; unsigned char changed_groups; } XkbNameChangesRec,*XkbNameChangesPtr; typedef struct _XkbCompatChanges { unsigned char changed_groups; unsigned short first_si; unsigned short num_si; } XkbCompatChangesRec,*XkbCompatChangesPtr; typedef struct _XkbChanges { unsigned short device_spec; unsigned short state_changes; XkbMapChangesRec map; XkbControlsChangesRec ctrls; XkbIndicatorChangesRec indicators; XkbNameChangesRec names; XkbCompatChangesRec compat; } XkbChangesRec, *XkbChangesPtr; /* * These data structures are used to construct a keymap from * a set of components or to list components in the server * database. */ typedef struct _XkbComponentNames { char * keymap; char * keycodes; char * types; char * compat; char * symbols; char * geometry; } XkbComponentNamesRec, *XkbComponentNamesPtr; typedef struct _XkbComponentName { unsigned short flags; char * name; } XkbComponentNameRec,*XkbComponentNamePtr; typedef struct _XkbComponentList { int num_keymaps; int num_keycodes; int num_types; int num_compat; int num_symbols; int num_geometry; XkbComponentNamePtr keymaps; XkbComponentNamePtr keycodes; XkbComponentNamePtr types; XkbComponentNamePtr compat; XkbComponentNamePtr symbols; XkbComponentNamePtr geometry; } XkbComponentListRec, *XkbComponentListPtr; /* * The following data structures describe and track changes to a * non-keyboard extension device */ typedef struct _XkbDeviceLedInfo { unsigned short led_class; unsigned short led_id; unsigned int phys_indicators; unsigned int maps_present; unsigned int names_present; unsigned int state; Atom names[XkbNumIndicators]; XkbIndicatorMapRec maps[XkbNumIndicators]; } XkbDeviceLedInfoRec,*XkbDeviceLedInfoPtr; typedef struct _XkbDeviceInfo { char * name; Atom type; unsigned short device_spec; Bool has_own_state; unsigned short supported; unsigned short unsupported; /* btn_acts is an array of num_btn XkbAction entries */ unsigned short num_btns; XkbAction * btn_acts; unsigned short sz_leds; unsigned short num_leds; unsigned short dflt_kbd_fb; unsigned short dflt_led_fb; /* leds is an array of XkbDeviceLedInfoRec in which sz_leds entries are allocated and num_leds entries are used */ XkbDeviceLedInfoPtr leds; } XkbDeviceInfoRec,*XkbDeviceInfoPtr; #define XkbXI_DevHasBtnActs(d) (((d)->num_btns>0)&&((d)->btn_acts!=NULL)) #define XkbXI_LegalDevBtn(d,b) (XkbXI_DevHasBtnActs(d)&&((b)<(d)->num_btns)) #define XkbXI_DevHasLeds(d) (((d)->num_leds>0)&&((d)->leds!=NULL)) typedef struct _XkbDeviceLedChanges { unsigned short led_class; unsigned short led_id; unsigned int defined; /* names or maps changed */ struct _XkbDeviceLedChanges *next; } XkbDeviceLedChangesRec,*XkbDeviceLedChangesPtr; typedef struct _XkbDeviceChanges { unsigned int changed; unsigned short first_btn; unsigned short num_btns; XkbDeviceLedChangesRec leds; } XkbDeviceChangesRec,*XkbDeviceChangesPtr; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif /* _XKBSTR_H_ */ X11/extensions/agproto.h000064400000012072147631660250011154 0ustar00/* Copyright 1996, 1998, 2001 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _AGPROTO_H_ /* { */ #define _AGPROTO_H_ #include #define X_XagQueryVersion 0 #define X_XagCreate 1 #define X_XagDestroy 2 #define X_XagGetAttr 3 #define X_XagQuery 4 #define X_XagCreateAssoc 5 #define X_XagDestroyAssoc 6 #define XAppGroup CARD32 /* * Redefine some basic types used by structures defined herein. This allows * both the library and server to view communicated data as 32-bit entities, * thus preventing problems on 64-bit architectures where libXext sees this * data as 64 bits and the server sees it as 32 bits. */ #define Colormap CARD32 #define VisualID CARD32 #define Window CARD32 typedef struct _XagQueryVersion { CARD8 reqType; /* always XagReqCode */ CARD8 xagReqType; /* always X_XagQueryVersion */ CARD16 length B16; CARD16 client_major_version B16; CARD16 client_minor_version B16; } xXagQueryVersionReq; #define sz_xXagQueryVersionReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequence_number B16; CARD32 length B32; CARD16 server_major_version B16; CARD16 server_minor_version B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXagQueryVersionReply; #define sz_xXagQueryVersionReply 32 /* Set AppGroup Attributes masks */ #define XagSingleScreenMask 1 << 0 #define XagDefaultRootMask 1 << XagNdefaultRoot #define XagRootVisualMask 1 << XagNrootVisual #define XagDefaultColormapMask 1 << XagNdefaultColormap #define XagBlackPixelMask 1 << XagNblackPixel #define XagWhitePixelMask 1 << XagNwhitePixel #define XagAppGroupLeaderMask 1 << XagNappGroupLeader typedef struct _XagCreate { CARD8 reqType; /* always XagReqCode */ CARD8 xagReqType; /* always X_XagCreate */ CARD16 length B16; XAppGroup app_group B32; CARD32 attrib_mask B32; /* LISTofVALUE follows */ } xXagCreateReq; #define sz_xXagCreateReq 12 typedef struct _XagDestroy { CARD8 reqType; /* always XagReqCode */ CARD8 xagReqType; /* always X_XagDestroy */ CARD16 length B16; XAppGroup app_group B32; } xXagDestroyReq; #define sz_xXagDestroyReq 8 typedef struct _XagGetAttr { CARD8 reqType; /* always XagReqCode */ CARD8 xagReqType; /* always X_XagGetAttr */ CARD16 length B16; XAppGroup app_group B32; } xXagGetAttrReq; #define sz_xXagGetAttrReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequence_number B16; CARD32 length B32; Window default_root B32; VisualID root_visual B32; Colormap default_colormap B32; CARD32 black_pixel B32; CARD32 white_pixel B32; BOOL single_screen; BOOL app_group_leader; CARD16 pad2 B16; } xXagGetAttrReply; #define sz_xXagGetAttrReply 32 typedef struct _XagQuery { CARD8 reqType; /* always XagReqCode */ CARD8 xagReqType; /* always X_XagQuery */ CARD16 length B16; CARD32 resource B32; } xXagQueryReq; #define sz_xXagQueryReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequence_number B16; CARD32 length B32; XAppGroup app_group B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXagQueryReply; #define sz_xXagQueryReply 32 typedef struct _XagCreateAssoc { CARD8 reqType; /* always XagReqCode */ CARD8 xagReqType; /* always X_XagCreateAssoc */ CARD16 length B16; Window window B32; CARD16 window_type B16; CARD16 system_window_len B16; /* LISTofCARD8 follows */ } xXagCreateAssocReq; #define sz_xXagCreateAssocReq 12 typedef struct _XagDestroyAssoc { CARD8 reqType; /* always XagReqCode */ CARD8 xagReqType; /* always X_XagDestroyAssoc */ CARD16 length B16; Window window B32; } xXagDestroyAssocReq; #define sz_xXagDestroyAssocReq 8 #undef XAppGroup /* * Cancel the previous redefinition of the basic types, thus restoring their * X.h definitions. */ #undef Window #undef Colormap #undef VisualID #endif /* } _AGPROTO_H_ */ X11/extensions/syncconst.h000064400000015136147631660250011530 0ustar00/* Copyright 1991, 1993, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /*********************************************************** Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts, and Olivetti Research Limited, Cambridge, England. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Olivetti not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef _SYNCCONST_H_ #define _SYNCCONST_H_ #define SYNC_NAME "SYNC" #define SYNC_MAJOR_VERSION 3 #define SYNC_MINOR_VERSION 1 #define XSyncCounterNotify 0 #define XSyncAlarmNotify 1 #define XSyncAlarmNotifyMask (1L << XSyncAlarmNotify) #define XSyncNumberEvents 2L #define XSyncBadCounter 0L #define XSyncBadAlarm 1L #define XSyncBadFence 2L #define XSyncNumberErrors (XSyncBadFence + 1) /* * Flags for Alarm Attributes */ #define XSyncCACounter (1L<<0) #define XSyncCAValueType (1L<<1) #define XSyncCAValue (1L<<2) #define XSyncCATestType (1L<<3) #define XSyncCADelta (1L<<4) #define XSyncCAEvents (1L<<5) /* The _XSync macros below are for library internal use only. They exist * so that if we have to make a fix, we can change it in this one place * and have both the macro and function variants inherit the fix. */ #define _XSyncIntToValue(pv, i) ((pv)->hi=((i<0)?~0:0),(pv)->lo=(i)) #define _XSyncIntsToValue(pv, l, h) ((pv)->lo = (l), (pv)->hi = (h)) #define _XSyncValueGreaterThan(a, b)\ ((a).hi>(b).hi || ((a).hi==(b).hi && (a).lo>(b).lo)) #define _XSyncValueLessThan(a, b)\ ((a).hi<(b).hi || ((a).hi==(b).hi && (a).lo<(b).lo)) #define _XSyncValueGreaterOrEqual(a, b)\ ((a).hi>(b).hi || ((a).hi==(b).hi && (a).lo>=(b).lo)) #define _XSyncValueLessOrEqual(a, b)\ ((a).hi<(b).hi || ((a).hi==(b).hi && (a).lo<=(b).lo)) #define _XSyncValueEqual(a, b) ((a).lo==(b).lo && (a).hi==(b).hi) #define _XSyncValueIsNegative(v) (((v).hi & 0x80000000) ? 1 : 0) #define _XSyncValueIsZero(a) ((a).lo==0 && (a).hi==0) #define _XSyncValueIsPositive(v) (((v).hi & 0x80000000) ? 0 : 1) #define _XSyncValueLow32(v) ((v).lo) #define _XSyncValueHigh32(v) ((v).hi) #define _XSyncValueAdd(presult,a,b,poverflow) {\ int t = (a).lo;\ Bool signa = XSyncValueIsNegative(a);\ Bool signb = XSyncValueIsNegative(b);\ ((presult)->lo = (a).lo + (b).lo);\ ((presult)->hi = (a).hi + (b).hi);\ if (t>(presult)->lo) (presult)->hi++;\ *poverflow = ((signa == signb) && !(signa == XSyncValueIsNegative(*presult)));\ } #define _XSyncValueSubtract(presult,a,b,poverflow) {\ int t = (a).lo;\ Bool signa = XSyncValueIsNegative(a);\ Bool signb = XSyncValueIsNegative(b);\ ((presult)->lo = (a).lo - (b).lo);\ ((presult)->hi = (a).hi - (b).hi);\ if (t<(presult)->lo) (presult)->hi--;\ *poverflow = ((signa == signb) && !(signa == XSyncValueIsNegative(*presult)));\ } #define _XSyncMaxValue(pv) ((pv)->hi = 0x7fffffff, (pv)->lo = 0xffffffff) #define _XSyncMinValue(pv) ((pv)->hi = 0x80000000, (pv)->lo = 0) /* * These are the publically usable macros. If you want the function version * of one of these, just #undef the macro to uncover the function. * (This is the same convention that the ANSI C library uses.) */ #define XSyncIntToValue(pv, i) _XSyncIntToValue(pv, i) #define XSyncIntsToValue(pv, l, h) _XSyncIntsToValue(pv, l, h) #define XSyncValueGreaterThan(a, b) _XSyncValueGreaterThan(a, b) #define XSyncValueLessThan(a, b) _XSyncValueLessThan(a, b) #define XSyncValueGreaterOrEqual(a, b) _XSyncValueGreaterOrEqual(a, b) #define XSyncValueLessOrEqual(a, b) _XSyncValueLessOrEqual(a, b) #define XSyncValueEqual(a, b) _XSyncValueEqual(a, b) #define XSyncValueIsNegative(v) _XSyncValueIsNegative(v) #define XSyncValueIsZero(a) _XSyncValueIsZero(a) #define XSyncValueIsPositive(v) _XSyncValueIsPositive(v) #define XSyncValueLow32(v) _XSyncValueLow32(v) #define XSyncValueHigh32(v) _XSyncValueHigh32(v) #define XSyncValueAdd(presult,a,b,poverflow) _XSyncValueAdd(presult,a,b,poverflow) #define XSyncValueSubtract(presult,a,b,poverflow) _XSyncValueSubtract(presult,a,b,poverflow) #define XSyncMaxValue(pv) _XSyncMaxValue(pv) #define XSyncMinValue(pv) _XSyncMinValue(pv) /* * Constants for the value_type argument of various requests */ typedef enum { XSyncAbsolute, XSyncRelative } XSyncValueType; /* * Alarm Test types */ typedef enum { XSyncPositiveTransition, XSyncNegativeTransition, XSyncPositiveComparison, XSyncNegativeComparison } XSyncTestType; /* * Alarm state constants */ typedef enum { XSyncAlarmActive, XSyncAlarmInactive, XSyncAlarmDestroyed } XSyncAlarmState; typedef XID XSyncCounter; typedef XID XSyncAlarm; typedef XID XSyncFence; typedef struct _XSyncValue { int hi; unsigned int lo; } XSyncValue; #endif /* _SYNCCONST_H_ */ X11/extensions/randr.h000064400000015375147631660250010620 0ustar00/* * Copyright © 2000 Compaq Computer Corporation * Copyright © 2002 Hewlett Packard Company * Copyright © 2006 Intel Corporation * Copyright © 2008 Red Hat, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * * Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc. * Keith Packard, Intel Corporation */ #ifndef _RANDR_H_ #define _RANDR_H_ typedef unsigned short Rotation; typedef unsigned short SizeID; typedef unsigned short SubpixelOrder; typedef unsigned short Connection; typedef unsigned short XRandrRotation; typedef unsigned short XRandrSizeID; typedef unsigned short XRandrSubpixelOrder; typedef unsigned long XRandrModeFlags; #define RANDR_NAME "RANDR" #define RANDR_MAJOR 1 #define RANDR_MINOR 6 #define RRNumberErrors 5 #define RRNumberEvents 2 #define RRNumberRequests 47 #define X_RRQueryVersion 0 /* we skip 1 to make old clients fail pretty immediately */ #define X_RROldGetScreenInfo 1 #define X_RR1_0SetScreenConfig 2 /* V1.0 apps share the same set screen config request id */ #define X_RRSetScreenConfig 2 #define X_RROldScreenChangeSelectInput 3 /* 3 used to be ScreenChangeSelectInput; deprecated */ #define X_RRSelectInput 4 #define X_RRGetScreenInfo 5 /* V1.2 additions */ #define X_RRGetScreenSizeRange 6 #define X_RRSetScreenSize 7 #define X_RRGetScreenResources 8 #define X_RRGetOutputInfo 9 #define X_RRListOutputProperties 10 #define X_RRQueryOutputProperty 11 #define X_RRConfigureOutputProperty 12 #define X_RRChangeOutputProperty 13 #define X_RRDeleteOutputProperty 14 #define X_RRGetOutputProperty 15 #define X_RRCreateMode 16 #define X_RRDestroyMode 17 #define X_RRAddOutputMode 18 #define X_RRDeleteOutputMode 19 #define X_RRGetCrtcInfo 20 #define X_RRSetCrtcConfig 21 #define X_RRGetCrtcGammaSize 22 #define X_RRGetCrtcGamma 23 #define X_RRSetCrtcGamma 24 /* V1.3 additions */ #define X_RRGetScreenResourcesCurrent 25 #define X_RRSetCrtcTransform 26 #define X_RRGetCrtcTransform 27 #define X_RRGetPanning 28 #define X_RRSetPanning 29 #define X_RRSetOutputPrimary 30 #define X_RRGetOutputPrimary 31 #define RRTransformUnit (1L << 0) #define RRTransformScaleUp (1L << 1) #define RRTransformScaleDown (1L << 2) #define RRTransformProjective (1L << 3) /* v1.4 */ #define X_RRGetProviders 32 #define X_RRGetProviderInfo 33 #define X_RRSetProviderOffloadSink 34 #define X_RRSetProviderOutputSource 35 #define X_RRListProviderProperties 36 #define X_RRQueryProviderProperty 37 #define X_RRConfigureProviderProperty 38 #define X_RRChangeProviderProperty 39 #define X_RRDeleteProviderProperty 40 #define X_RRGetProviderProperty 41 /* v1.5 */ #define X_RRGetMonitors 42 #define X_RRSetMonitor 43 #define X_RRDeleteMonitor 44 /* v1.6 */ #define X_RRCreateLease 45 #define X_RRFreeLease 46 /* Event selection bits */ #define RRScreenChangeNotifyMask (1L << 0) /* V1.2 additions */ #define RRCrtcChangeNotifyMask (1L << 1) #define RROutputChangeNotifyMask (1L << 2) #define RROutputPropertyNotifyMask (1L << 3) /* V1.4 additions */ #define RRProviderChangeNotifyMask (1L << 4) #define RRProviderPropertyNotifyMask (1L << 5) #define RRResourceChangeNotifyMask (1L << 6) /* V1.6 additions */ #define RRLeaseNotifyMask (1L << 7) /* Event codes */ #define RRScreenChangeNotify 0 /* V1.2 additions */ #define RRNotify 1 /* RRNotify Subcodes */ #define RRNotify_CrtcChange 0 #define RRNotify_OutputChange 1 #define RRNotify_OutputProperty 2 #define RRNotify_ProviderChange 3 #define RRNotify_ProviderProperty 4 #define RRNotify_ResourceChange 5 /* V1.6 additions */ #define RRNotify_Lease 6 /* used in the rotation field; rotation and reflection in 0.1 proto. */ #define RR_Rotate_0 1 #define RR_Rotate_90 2 #define RR_Rotate_180 4 #define RR_Rotate_270 8 /* new in 1.0 protocol, to allow reflection of screen */ #define RR_Reflect_X 16 #define RR_Reflect_Y 32 #define RRSetConfigSuccess 0 #define RRSetConfigInvalidConfigTime 1 #define RRSetConfigInvalidTime 2 #define RRSetConfigFailed 3 /* new in 1.2 protocol */ #define RR_HSyncPositive 0x00000001 #define RR_HSyncNegative 0x00000002 #define RR_VSyncPositive 0x00000004 #define RR_VSyncNegative 0x00000008 #define RR_Interlace 0x00000010 #define RR_DoubleScan 0x00000020 #define RR_CSync 0x00000040 #define RR_CSyncPositive 0x00000080 #define RR_CSyncNegative 0x00000100 #define RR_HSkewPresent 0x00000200 #define RR_BCast 0x00000400 #define RR_PixelMultiplex 0x00000800 #define RR_DoubleClock 0x00001000 #define RR_ClockDivideBy2 0x00002000 #define RR_Connected 0 #define RR_Disconnected 1 #define RR_UnknownConnection 2 #define BadRROutput 0 #define BadRRCrtc 1 #define BadRRMode 2 #define BadRRProvider 3 #define BadRRLease 4 /* Conventional RandR output properties */ #define RR_PROPERTY_BACKLIGHT "Backlight" #define RR_PROPERTY_RANDR_EDID "EDID" #define RR_PROPERTY_SIGNAL_FORMAT "SignalFormat" #define RR_PROPERTY_SIGNAL_PROPERTIES "SignalProperties" #define RR_PROPERTY_CONNECTOR_TYPE "ConnectorType" #define RR_PROPERTY_CONNECTOR_NUMBER "ConnectorNumber" #define RR_PROPERTY_COMPATIBILITY_LIST "CompatibilityList" #define RR_PROPERTY_CLONE_LIST "CloneList" #define RR_PROPERTY_BORDER "Border" #define RR_PROPERTY_BORDER_DIMENSIONS "BorderDimensions" #define RR_PROPERTY_GUID "GUID" #define RR_PROPERTY_RANDR_TILE "TILE" #define RR_PROPERTY_NON_DESKTOP "non-desktop" /* roles this device can carry out */ #define RR_Capability_None 0 #define RR_Capability_SourceOutput 1 #define RR_Capability_SinkOutput 2 #define RR_Capability_SourceOffload 4 #define RR_Capability_SinkOffload 8 #endif /* _RANDR_H_ */ X11/extensions/lbx.h000064400000004274147631660250010273 0ustar00/* * Copyright 1992 Network Computing Devices * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of NCD. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. NCD. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #ifndef _LBX_H_ #define _LBX_H_ #define LBXNAME "LBX" #define LBX_MAJOR_VERSION 1 #define LBX_MINOR_VERSION 0 #define LbxNumberReqs 44 #define LbxEvent 0 #define LbxQuickMotionDeltaEvent 1 #define LbxNumberEvents 2 /* This is always the master client */ #define LbxMasterClientIndex 0 /* LbxEvent lbxType sub-fields */ #define LbxSwitchEvent 0 #define LbxCloseEvent 1 #define LbxDeltaEvent 2 #define LbxInvalidateTagEvent 3 #define LbxSendTagDataEvent 4 #define LbxListenToOne 5 #define LbxListenToAll 6 #define LbxMotionDeltaEvent 7 #define LbxReleaseCmapEvent 8 #define LbxFreeCellsEvent 9 /* * Lbx image compression methods * * No compression is always assigned the value of 0. * * The rest of the compression method opcodes are assigned dynamically * at option negotiation time. */ #define LbxImageCompressNone 0 #define BadLbxClient 0 #define LbxNumberErrors (BadLbxClient + 1) /* tagged data types */ #define LbxTagTypeModmap 1 #define LbxTagTypeKeymap 2 #define LbxTagTypeProperty 3 #define LbxTagTypeFont 4 #define LbxTagTypeConnInfo 5 #endif X11/extensions/geproto.h000064400000004555147631660250011167 0ustar00/* * Copyright © 2007-2008 Peter Hutterer * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Authors: Peter Hutterer, University of South Australia, NICTA * */ #ifndef _GEPROTO_H_ #define _GEPROTO_H_ #include #include #include /********************************************************* * * Protocol request constants * */ #define X_GEGetExtensionVersion 1 /********************************************************* * * XGE protocol requests/replies * */ /* generic request */ typedef struct { CARD8 reqType; CARD8 ReqType; CARD16 length B16; } xGEReq; /* QueryVersion */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GEQueryVersion */ CARD16 length B16; CARD16 majorVersion B16; CARD16 minorVersion B16; } xGEQueryVersionReq; #define sz_xGEQueryVersionReq 8 typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GEQueryVersion */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; CARD16 minorVersion B16; CARD32 pad00 B32; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; } xGEQueryVersionReply; #define sz_xGEQueryVersionReply 32 #endif /* _GEPROTO_H_ */ X11/extensions/dbeproto.h000064400000016507147631660250011326 0ustar00/****************************************************************************** * * Copyright (c) 1994, 1995 Hewlett-Packard Company * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the Hewlett-Packard * Company shall not be used in advertising or otherwise to promote the * sale, use or other dealings in this Software without prior written * authorization from the Hewlett-Packard Company. * * Header file for Xlib-related DBE * *****************************************************************************/ #ifndef DBE_PROTO_H #define DBE_PROTO_H #include /* Request values used in (S)ProcDbeDispatch() */ #define X_DbeGetVersion 0 #define X_DbeAllocateBackBufferName 1 #define X_DbeDeallocateBackBufferName 2 #define X_DbeSwapBuffers 3 #define X_DbeBeginIdiom 4 #define X_DbeEndIdiom 5 #define X_DbeGetVisualInfo 6 #define X_DbeGetBackBufferAttributes 7 typedef CARD8 xDbeSwapAction; typedef CARD32 xDbeBackBuffer; /* TYPEDEFS */ /* Protocol data types */ typedef struct { CARD32 window B32; /* window */ xDbeSwapAction swapAction; /* swap action */ CARD8 pad1; /* unused */ CARD16 pad2 B16; } xDbeSwapInfo; typedef struct { CARD32 visualID B32; /* associated visual */ CARD8 depth; /* depth of visual */ CARD8 perfLevel; /* performance level hint */ CARD16 pad1 B16; } xDbeVisInfo; #define sz_xDbeVisInfo 8 typedef struct { CARD32 n B32; /* number of visual info items in list */ } xDbeScreenVisInfo; /* followed by n xDbeVisInfo items */ typedef struct { CARD32 window B32; /* window */ } xDbeBufferAttributes; /* Requests and replies */ typedef struct { CARD8 reqType; /* major-opcode: always codes->major_opcode */ CARD8 dbeReqType; /* minor-opcode: always X_DbeGetVersion (0) */ CARD16 length B16; /* request length: (2) */ CARD8 majorVersion; /* client-major-version */ CARD8 minorVersion; /* client-minor-version */ CARD16 unused B16; /* unused */ } xDbeGetVersionReq; #define sz_xDbeGetVersionReq 8 typedef struct { BYTE type; /* Reply: X_Reply (1) */ CARD8 unused; /* unused */ CARD16 sequenceNumber B16; /* sequence number */ CARD32 length B32; /* reply length: (0) */ CARD8 majorVersion; /* server-major-version */ CARD8 minorVersion; /* server-minor-version */ CARD16 pad1 B16; /* unused */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xDbeGetVersionReply; #define sz_xDbeGetVersionReply 32 typedef struct { CARD8 reqType; /* major-opcode: codes->major_opcode */ CARD8 dbeReqType; /* X_DbeAllocateBackBufferName (1) */ CARD16 length B16; /* request length: (4) */ CARD32 window B32; /* window */ xDbeBackBuffer buffer B32; /* back buffer name */ xDbeSwapAction swapAction; /* swap action hint */ CARD8 pad1; /* unused */ CARD16 pad2 B16; } xDbeAllocateBackBufferNameReq; #define sz_xDbeAllocateBackBufferNameReq 16 typedef struct { CARD8 reqType; /* major-opcode: codes->major_opcode */ CARD8 dbeReqType; /* X_DbeDeallocateBackBufferName (2) */ CARD16 length B16; /* request length: (2) */ xDbeBackBuffer buffer B32; /* back buffer name */ } xDbeDeallocateBackBufferNameReq; #define sz_xDbeDeallocateBackBufferNameReq 8 typedef struct { CARD8 reqType; /* major-opcode: always codes->major_opcode */ CARD8 dbeReqType; /* minor-opcode: always X_DbeSwapBuffers (3) */ CARD16 length B16; /* request length: (2+2n) */ CARD32 n B32; /* n, number of window/swap action pairs */ } xDbeSwapBuffersReq; /* followed by n window/swap action pairs */ #define sz_xDbeSwapBuffersReq 8 typedef struct { CARD8 reqType; /* major-opcode: always codes->major_opcode */ CARD8 dbeReqType; /* minor-opcode: always X_DbeBeginIdom (4) */ CARD16 length B16; /* request length: (1) */ } xDbeBeginIdiomReq; #define sz_xDbeBeginIdiomReq 4 typedef struct { CARD8 reqType; /* major-opcode: always codes->major_opcode */ CARD8 dbeReqType; /* minor-opcode: always X_DbeEndIdom (5) */ CARD16 length B16; /* request length: (1) */ } xDbeEndIdiomReq; #define sz_xDbeEndIdiomReq 4 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 dbeReqType; /* always X_DbeGetVisualInfo (6) */ CARD16 length B16; /* request length: (2+n) */ CARD32 n B32; /* n, number of drawables in list */ } xDbeGetVisualInfoReq; /* followed by n drawables */ #define sz_xDbeGetVisualInfoReq 8 typedef struct { BYTE type; /* Reply: X_Reply (1) */ CARD8 unused; /* unused */ CARD16 sequenceNumber B16; /* sequence number */ CARD32 length B32; /* reply length */ CARD32 m; /* m, number of visual infos in list */ CARD32 pad1 B32; /* unused */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xDbeGetVisualInfoReply; /* followed by m visual infos */ #define sz_xDbeGetVisualInfoReply 32 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 dbeReqType; /* X_DbeGetBackBufferAttributes (7) */ CARD16 length B16; /* request length: (2) */ xDbeBackBuffer buffer B32; /* back buffer name */ } xDbeGetBackBufferAttributesReq; #define sz_xDbeGetBackBufferAttributesReq 8 typedef struct { BYTE type; /* Reply: X_Reply (1) */ CARD8 unused; /* unused */ CARD16 sequenceNumber B16; /* sequence number */ CARD32 length B32; /* reply length: (0) */ CARD32 attributes; /* attributes */ CARD32 pad1 B32; /* unused */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xDbeGetBackBufferAttributesReply; #define sz_xDbeGetBackBufferAttributesReply 32 #endif /* DBE_PROTO_H */ X11/extensions/vldXvMC.h000064400000012456147631660250011032 0ustar00/***************************************************************************** * VLD XvMC Nonstandard extension API. * * Copyright (c) 2004 The Unichrome Project. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHOR(S) OR COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Author: Thomas Hellström, 2004. */ #ifndef _VLDXVMC_H #define _VLDXVMC_H #include #include /* * New "Motion compensation type". */ #define XVMC_VLD 0x0020000 /* * Below Flags to be passed in the XvMCMpegControl structure 'flag' field. */ #define XVMC_PROGRESSIVE_SEQUENCE 0x00000010 /* * Zig-Zag Scan / Alternative Scan. */ #define XVMC_ZIG_ZAG_SCAN 0x00000000 #define XVMC_ALTERNATE_SCAN 0x00000100 /* * Frame DCT and frame prediction are used. / * Field prediction */ #define XVMC_PRED_DCT_FRAME 0x00000040 #define XVMC_PRED_DCT_FIELD 0x00000000 /* * Top / Bottom field first */ #define XVMC_TOP_FIELD_FIRST 0x00000080 #define XVMC_BOTTOM_FIELD_FIRST 0x00000000 /* * Motion vectors coded in intra macroblocks */ #define XVMC_CONCEALMENT_MOTION_VECTORS 0x00000200 /* * Which of two mappings between quantiser_scale_code * and quantiser_scale shall apply. */ #define XVMC_Q_SCALE_TYPE 0x00000400 /* * Intra VLC Format: Bit = 0, Bit = 1 * Intra blocks B-14 B-15 * Non-intra blocks B-14 B-14 */ #define XVMC_INTRA_VLC_FORMAT 0x00000800 /* * Also XVMC_SECOND_FIELD should be set in flags if active. */ #define XVMC_I_PICTURE 1 #define XVMC_P_PICTURE 2 #define XVMC_B_PICTURE 3 typedef struct _XvMCMpegControl{ unsigned BVMV_range, /* Backward vertical motion vector range */ BHMV_range, /* Backward horizontal motion vector range */ FVMV_range, /* Forward vertical motion vector range */ FHMV_range, /* Forward horizontal motion vector range */ picture_structure, /* XVMC_TOP_FIELD, XVMC_BOTTOM_FIELD, * XVMC_FRAME_PICTURE */ intra_dc_precision, /* 0x00 - 0x03 corresponds to 8 to 11 bits prec. */ picture_coding_type,/* XVMC_X_PICTURE */ mpeg_coding, /* XVMC_MPEG_2 */ flags; /* See above */ }XvMCMpegControl; /* * The following function is called BEFORE starting sending slices to the * lib. It grabs the decoder hardware and prepares it for coming slices. * The function XvMCSyncSurface will release the hardware for other contexts * in addition to it's current functionality. */ extern Status XvMCBeginSurface(Display *display, XvMCContext *context, XvMCSurface *target_surface, XvMCSurface *past_surface, XvMCSurface *future_surface, const XvMCMpegControl *control); /* * The quantizer matrix structure. This should be filled in by the user and * uploaded whenever a change is needed. The lib initializes with * default matrices and will automatically load the hardware with new matrices * on decoder context switches. To load data, set the corresponding load flag * to true and fill in the values. The VIA MPEG2 engine only uses the * intra_quantiser_matrix and the non_intra_quantiser_matrix. */ typedef struct _XvMCQMatrix { int load_intra_quantiser_matrix; int load_non_intra_quantiser_matrix; int load_chroma_intra_quantiser_matrix; int load_chroma_non_intra_quantiser_matrix; unsigned char intra_quantiser_matrix[64]; unsigned char non_intra_quantiser_matrix[64]; unsigned char chroma_intra_quantiser_matrix[64]; unsigned char chroma_non_intra_quantiser_matrix[64]; } XvMCQMatrix; /* * Upload a XvMCQMatrix structure to the clientlib. * The hardware will start using it the next XvMCBeginSurface. */ extern Status XvMCLoadQMatrix(Display *display, XvMCContext *context, const XvMCQMatrix *qmx); /* * Put a slice to the decoder. The hardware will start processing it * immediately. */ extern Status XvMCPutSlice(Display *display,XvMCContext *context, char *slice, int nBytes); /* * Put a slice without the slice start code to the decoder. * The hardware will start processing it * immediately. This function is for client optimization. * XvMCPutSlice(display,context,slice,nBytes) is equivalent to * XvMCPutSlice2(display,context,slice+4,nBytes-4,slice[3]); */ extern Status XvMCPutSlice2(Display *display,XvMCContext *context, char *slice, int nBytes, int sliceCode); #endif X11/extensions/xtestconst.h000064400000002560147631660250011720 0ustar00/* Copyright 1992, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _XTEST_CONST_H_ #define _XTEST_CONST_H_ #define XTestNumberEvents 0 #define XTestNumberErrors 0 #define XTestCurrentCursor ((Cursor)1) #define XTestMajorVersion 2 #define XTestMinorVersion 2 #define XTestExtensionName "XTEST" #endif X11/extensions/xfixesproto.h000064400000032166147631660250012101 0ustar00/* * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * Copyright 2010 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /* * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _XFIXESPROTO_H_ #define _XFIXESPROTO_H_ #include #include #include #define Window CARD32 #define Drawable CARD32 #define Font CARD32 #define Pixmap CARD32 #define Cursor CARD32 #define Colormap CARD32 #define GContext CARD32 #define Atom CARD32 #define VisualID CARD32 #define Time CARD32 #define KeyCode CARD8 #define KeySym CARD32 #define Picture CARD32 /*************** Version 1 ******************/ typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; } xXFixesReq; /* * requests and replies */ typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; CARD32 majorVersion B32; CARD32 minorVersion B32; } xXFixesQueryVersionReq; #define sz_xXFixesQueryVersionReq 12 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 majorVersion B32; CARD32 minorVersion B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXFixesQueryVersionReply; #define sz_xXFixesQueryVersionReply 32 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; BYTE mode; /* SetModeInsert/SetModeDelete*/ BYTE target; /* SaveSetNearest/SaveSetRoot*/ BYTE map; /* SaveSetMap/SaveSetUnmap */ BYTE pad1; Window window; } xXFixesChangeSaveSetReq; #define sz_xXFixesChangeSaveSetReq 12 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Window window B32; Atom selection B32; CARD32 eventMask B32; } xXFixesSelectSelectionInputReq; #define sz_xXFixesSelectSelectionInputReq 16 typedef struct { CARD8 type; CARD8 subtype; CARD16 sequenceNumber B16; Window window B32; Window owner B32; Atom selection B32; Time timestamp B32; Time selectionTimestamp B32; CARD32 pad2 B32; CARD32 pad3 B32; } xXFixesSelectionNotifyEvent; typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Window window B32; CARD32 eventMask B32; } xXFixesSelectCursorInputReq; #define sz_xXFixesSelectCursorInputReq 12 typedef struct { CARD8 type; CARD8 subtype; CARD16 sequenceNumber B16; Window window B32; CARD32 cursorSerial B32; Time timestamp; Atom name B32; /* Version 2 */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xXFixesCursorNotifyEvent; typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; } xXFixesGetCursorImageReq; #define sz_xXFixesGetCursorImageReq 4 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; INT16 x B16; INT16 y B16; CARD16 width B16; CARD16 height B16; CARD16 xhot B16; CARD16 yhot B16; CARD32 cursorSerial B32; CARD32 pad2 B32; CARD32 pad3 B32; } xXFixesGetCursorImageReply; #define sz_xXFixesGetCursorImageReply 32 /*************** Version 2 ******************/ #define Region CARD32 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region region B32; /* LISTofRECTANGLE */ } xXFixesCreateRegionReq; #define sz_xXFixesCreateRegionReq 8 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region region B32; Pixmap bitmap B32; } xXFixesCreateRegionFromBitmapReq; #define sz_xXFixesCreateRegionFromBitmapReq 12 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region region B32; Window window B32; CARD8 kind; CARD8 pad1; CARD16 pad2 B16; } xXFixesCreateRegionFromWindowReq; #define sz_xXFixesCreateRegionFromWindowReq 16 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region region B32; GContext gc B32; } xXFixesCreateRegionFromGCReq; #define sz_xXFixesCreateRegionFromGCReq 12 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region region B32; Picture picture B32; } xXFixesCreateRegionFromPictureReq; #define sz_xXFixesCreateRegionFromPictureReq 12 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region region B32; } xXFixesDestroyRegionReq; #define sz_xXFixesDestroyRegionReq 8 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region region B32; /* LISTofRECTANGLE */ } xXFixesSetRegionReq; #define sz_xXFixesSetRegionReq 8 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region source B32; Region destination B32; } xXFixesCopyRegionReq; #define sz_xXFixesCopyRegionReq 12 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region source1 B32; Region source2 B32; Region destination B32; } xXFixesCombineRegionReq, xXFixesUnionRegionReq, xXFixesIntersectRegionReq, xXFixesSubtractRegionReq; #define sz_xXFixesCombineRegionReq 16 #define sz_xXFixesUnionRegionReq sz_xXFixesCombineRegionReq #define sz_xXFixesIntersectRegionReq sz_xXFixesCombineRegionReq #define sz_xXFixesSubtractRegionReq sz_xXFixesCombineRegionReq typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region source B32; INT16 x B16, y B16; CARD16 width B16, height B16; Region destination B32; } xXFixesInvertRegionReq; #define sz_xXFixesInvertRegionReq 20 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region region B32; INT16 dx B16, dy B16; } xXFixesTranslateRegionReq; #define sz_xXFixesTranslateRegionReq 12 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region source B32; Region destination B32; } xXFixesRegionExtentsReq; #define sz_xXFixesRegionExtentsReq 12 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region region B32; } xXFixesFetchRegionReq; #define sz_xXFixesFetchRegionReq 8 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; INT16 x B16, y B16; CARD16 width B16, height B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXFixesFetchRegionReply; #define sz_xXFixesFetchRegionReply 32 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; GContext gc B32; Region region B32; INT16 xOrigin B16, yOrigin B16; } xXFixesSetGCClipRegionReq; #define sz_xXFixesSetGCClipRegionReq 16 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Window dest; BYTE destKind; CARD8 pad1; CARD16 pad2 B16; INT16 xOff B16, yOff B16; Region region; } xXFixesSetWindowShapeRegionReq; #define sz_xXFixesSetWindowShapeRegionReq 20 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Picture picture B32; Region region B32; INT16 xOrigin B16, yOrigin B16; } xXFixesSetPictureClipRegionReq; #define sz_xXFixesSetPictureClipRegionReq 16 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Cursor cursor B32; CARD16 nbytes B16; CARD16 pad B16; } xXFixesSetCursorNameReq; #define sz_xXFixesSetCursorNameReq 12 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Cursor cursor B32; } xXFixesGetCursorNameReq; #define sz_xXFixesGetCursorNameReq 8 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; Atom atom B32; CARD16 nbytes B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXFixesGetCursorNameReply; #define sz_xXFixesGetCursorNameReply 32 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; } xXFixesGetCursorImageAndNameReq; #define sz_xXFixesGetCursorImageAndNameReq 4 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; INT16 x B16; INT16 y B16; CARD16 width B16; CARD16 height B16; CARD16 xhot B16; CARD16 yhot B16; CARD32 cursorSerial B32; Atom cursorName B32; CARD16 nbytes B16; CARD16 pad B16; } xXFixesGetCursorImageAndNameReply; #define sz_xXFixesGetCursorImageAndNameReply 32 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Cursor source B32; Cursor destination B32; } xXFixesChangeCursorReq; #define sz_xXFixesChangeCursorReq 12 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Cursor source B32; CARD16 nbytes; CARD16 pad; } xXFixesChangeCursorByNameReq; #define sz_xXFixesChangeCursorByNameReq 12 /*************** Version 3 ******************/ typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region source B32; Region destination B32; CARD16 left B16; CARD16 right B16; CARD16 top B16; CARD16 bottom B16; } xXFixesExpandRegionReq; #define sz_xXFixesExpandRegionReq 20 /*************** Version 4.0 ******************/ typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Window window B32; } xXFixesHideCursorReq; #define sz_xXFixesHideCursorReq sizeof(xXFixesHideCursorReq) typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Window window B32; } xXFixesShowCursorReq; #define sz_xXFixesShowCursorReq sizeof(xXFixesShowCursorReq) /*************** Version 5.0 ******************/ #define Barrier CARD32 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Barrier barrier B32; Window window B32; INT16 x1 B16; INT16 y1 B16; INT16 x2 B16; INT16 y2 B16; CARD32 directions; CARD16 pad B16; CARD16 num_devices B16; /* array of CARD16 devices */ } xXFixesCreatePointerBarrierReq; #define sz_xXFixesCreatePointerBarrierReq 28 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Barrier barrier B32; } xXFixesDestroyPointerBarrierReq; #define sz_xXFixesDestroyPointerBarrierReq 8 #undef Barrier #undef Region #undef Picture #undef Window #undef Drawable #undef Font #undef Pixmap #undef Cursor #undef Colormap #undef GContext #undef Atom #undef VisualID #undef Time #undef KeyCode #undef KeySym #endif /* _XFIXESPROTO_H_ */ X11/extensions/EVI.h000064400000003033147631660250010121 0ustar00/************************************************************ Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _EVI_H_ #define _EVI_H_ #define XEVI_TRANSPARENCY_NONE 0 #define XEVI_TRANSPARENCY_PIXEL 1 #define XEVI_TRANSPARENCY_MASK 2 #define EVINAME "Extended-Visual-Information" #define XEVI_MAJOR_VERSION 1 /* current version numbers */ #define XEVI_MINOR_VERSION 0 #endif X11/extensions/shapeproto.h000064400000015572147631660250011675 0ustar00/************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ********************************************************/ #ifndef _SHAPEPROTO_H_ #define _SHAPEPROTO_H_ #include /* * Protocol requests constants and alignment values * These would really be in SHAPE's X.h and Xproto.h equivalents */ #define Window CARD32 #define Time CARD32 #define X_ShapeQueryVersion 0 #define X_ShapeRectangles 1 #define X_ShapeMask 2 #define X_ShapeCombine 3 #define X_ShapeOffset 4 #define X_ShapeQueryExtents 5 #define X_ShapeSelectInput 6 #define X_ShapeInputSelected 7 #define X_ShapeGetRectangles 8 typedef struct _ShapeQueryVersion { CARD8 reqType; /* always ShapeReqCode */ CARD8 shapeReqType; /* always X_ShapeQueryVersion */ CARD16 length B16; } xShapeQueryVersionReq; #define sz_xShapeQueryVersionReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of SHAPE protocol */ CARD16 minorVersion B16; /* minor version of SHAPE protocol */ CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xShapeQueryVersionReply; #define sz_xShapeQueryVersionReply 32 typedef struct _ShapeRectangles { CARD8 reqType; /* always ShapeReqCode */ CARD8 shapeReqType; /* always X_ShapeRectangles */ CARD16 length B16; CARD8 op; /* Set, ... */ CARD8 destKind; /* ShapeBounding or ShapeClip */ CARD8 ordering; /* UnSorted, YSorted, YXSorted, YXBanded */ CARD8 pad0; /* not used */ Window dest B32; INT16 xOff B16; INT16 yOff B16; } xShapeRectanglesReq; /* followed by xRects */ #define sz_xShapeRectanglesReq 16 typedef struct _ShapeMask { CARD8 reqType; /* always ShapeReqCode */ CARD8 shapeReqType; /* always X_ShapeMask */ CARD16 length B16; CARD8 op; /* Set, ... */ CARD8 destKind; /* ShapeBounding or ShapeClip */ CARD16 junk B16; /* not used */ Window dest B32; INT16 xOff B16; INT16 yOff B16; CARD32 src B32; /* 1 bit pixmap */ } xShapeMaskReq; #define sz_xShapeMaskReq 20 typedef struct _ShapeCombine { CARD8 reqType; /* always ShapeReqCode */ CARD8 shapeReqType; /* always X_ShapeCombine */ CARD16 length B16; CARD8 op; /* Set, ... */ CARD8 destKind; /* ShapeBounding or ShapeClip */ CARD8 srcKind; /* ShapeBounding or ShapeClip */ CARD8 junk; /* not used */ Window dest B32; INT16 xOff B16; INT16 yOff B16; Window src B32; } xShapeCombineReq; #define sz_xShapeCombineReq 20 typedef struct _ShapeOffset { CARD8 reqType; /* always ShapeReqCode */ CARD8 shapeReqType; /* always X_ShapeOffset */ CARD16 length B16; CARD8 destKind; /* ShapeBounding or ShapeClip */ CARD8 junk1; /* not used */ CARD16 junk2 B16; /* not used */ Window dest B32; INT16 xOff B16; INT16 yOff B16; } xShapeOffsetReq; #define sz_xShapeOffsetReq 16 typedef struct _ShapeQueryExtents { CARD8 reqType; /* always ShapeReqCode */ CARD8 shapeReqType; /* always X_ShapeQueryExtents */ CARD16 length B16; Window window B32; } xShapeQueryExtentsReq; #define sz_xShapeQueryExtentsReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD8 boundingShaped; /* window has bounding shape */ CARD8 clipShaped; /* window has clip shape */ CARD16 unused1 B16; INT16 xBoundingShape B16; /* extents of bounding shape */ INT16 yBoundingShape B16; CARD16 widthBoundingShape B16; CARD16 heightBoundingShape B16; INT16 xClipShape B16; /* extents of clip shape */ INT16 yClipShape B16; CARD16 widthClipShape B16; CARD16 heightClipShape B16; CARD32 pad1 B32; } xShapeQueryExtentsReply; #define sz_xShapeQueryExtentsReply 32 typedef struct _ShapeSelectInput { CARD8 reqType; /* always ShapeReqCode */ CARD8 shapeReqType; /* always X_ShapeSelectInput */ CARD16 length B16; Window window B32; BYTE enable; /* xTrue -> send events */ BYTE pad1; CARD16 pad2 B16; } xShapeSelectInputReq; #define sz_xShapeSelectInputReq 12 typedef struct _ShapeNotify { BYTE type; /* always eventBase + ShapeNotify */ BYTE kind; /* either ShapeBounding or ShapeClip */ CARD16 sequenceNumber B16; Window window B32; INT16 x B16; INT16 y B16; /* extents of new shape */ CARD16 width B16; CARD16 height B16; Time time B32; /* time of change */ BYTE shaped; /* set when a shape actual exists */ BYTE pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; } xShapeNotifyEvent; #define sz_xShapeNotifyEvent 32 typedef struct _ShapeInputSelected { CARD8 reqType; /* always ShapeReqCode */ CARD8 shapeReqType; /* always X_ShapeInputSelected */ CARD16 length B16; Window window B32; } xShapeInputSelectedReq; #define sz_xShapeInputSelectedReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 enabled; /* current status */ CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD32 pad1 B32; /* unused */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xShapeInputSelectedReply; #define sz_xShapeInputSelectedReply 32 typedef struct _ShapeGetRectangles { CARD8 reqType; /* always ShapeReqCode */ CARD8 shapeReqType; /* always X_ShapeGetRectangles */ CARD16 length B16; Window window B32; CARD8 kind; /* ShapeBounding or ShapeClip */ CARD8 junk1; CARD16 junk2 B16; } xShapeGetRectanglesReq; #define sz_xShapeGetRectanglesReq 12 typedef struct { BYTE type; /* X_Reply */ CARD8 ordering; /* UnSorted, YSorted, YXSorted, YXBanded */ CARD16 sequenceNumber B16; CARD32 length B32; /* not zero */ CARD32 nrects B32; /* number of rectangles */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xShapeGetRectanglesReply; /* followed by xRectangles */ #define sz_xShapeGetRectanglesReply 32 #undef Window #undef Time #endif /* _SHAPEPROTO_H_ */ X11/extensions/shmproto.h000064400000014316147631660250011357 0ustar00/************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ********************************************************/ /* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */ #ifndef _SHMPROTO_H_ #define _SHMPROTO_H_ #include #define ShmSeg CARD32 #define Drawable CARD32 #define VisualID CARD32 #define GContext CARD32 #define Pixmap CARD32 #define X_ShmQueryVersion 0 #define X_ShmAttach 1 #define X_ShmDetach 2 #define X_ShmPutImage 3 #define X_ShmGetImage 4 #define X_ShmCreatePixmap 5 #define X_ShmAttachFd 6 #define X_ShmCreateSegment 7 typedef struct _ShmQueryVersion { CARD8 reqType; /* always ShmReqCode */ CARD8 shmReqType; /* always X_ShmQueryVersion */ CARD16 length B16; } xShmQueryVersionReq; #define sz_xShmQueryVersionReq 4 typedef struct { BYTE type; /* X_Reply */ BOOL sharedPixmaps; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of SHM protocol */ CARD16 minorVersion B16; /* minor version of SHM protocol */ CARD16 uid B16; CARD16 gid B16; CARD8 pixmapFormat; CARD8 pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xShmQueryVersionReply; #define sz_xShmQueryVersionReply 32 typedef struct _ShmAttach { CARD8 reqType; /* always ShmReqCode */ CARD8 shmReqType; /* always X_ShmAttach */ CARD16 length B16; ShmSeg shmseg B32; CARD32 shmid B32; BOOL readOnly; BYTE pad0; CARD16 pad1 B16; } xShmAttachReq; #define sz_xShmAttachReq 16 typedef struct _ShmDetach { CARD8 reqType; /* always ShmReqCode */ CARD8 shmReqType; /* always X_ShmDetach */ CARD16 length B16; ShmSeg shmseg B32; } xShmDetachReq; #define sz_xShmDetachReq 8 typedef struct _ShmPutImage { CARD8 reqType; /* always ShmReqCode */ CARD8 shmReqType; /* always X_ShmPutImage */ CARD16 length B16; Drawable drawable B32; GContext gc B32; CARD16 totalWidth B16; CARD16 totalHeight B16; CARD16 srcX B16; CARD16 srcY B16; CARD16 srcWidth B16; CARD16 srcHeight B16; INT16 dstX B16; INT16 dstY B16; CARD8 depth; CARD8 format; CARD8 sendEvent; CARD8 bpad; ShmSeg shmseg B32; CARD32 offset B32; } xShmPutImageReq; #define sz_xShmPutImageReq 40 typedef struct _ShmGetImage { CARD8 reqType; /* always ShmReqCode */ CARD8 shmReqType; /* always X_ShmGetImage */ CARD16 length B16; Drawable drawable B32; INT16 x B16; INT16 y B16; CARD16 width B16; CARD16 height B16; CARD32 planeMask B32; CARD8 format; CARD8 pad0; CARD8 pad1; CARD8 pad2; ShmSeg shmseg B32; CARD32 offset B32; } xShmGetImageReq; #define sz_xShmGetImageReq 32 typedef struct _ShmGetImageReply { BYTE type; /* X_Reply */ CARD8 depth; CARD16 sequenceNumber B16; CARD32 length B32; VisualID visual B32; CARD32 size B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xShmGetImageReply; #define sz_xShmGetImageReply 32 typedef struct _ShmCreatePixmap { CARD8 reqType; /* always ShmReqCode */ CARD8 shmReqType; /* always X_ShmCreatePixmap */ CARD16 length B16; Pixmap pid B32; Drawable drawable B32; CARD16 width B16; CARD16 height B16; CARD8 depth; CARD8 pad0; CARD8 pad1; CARD8 pad2; ShmSeg shmseg B32; CARD32 offset B32; } xShmCreatePixmapReq; #define sz_xShmCreatePixmapReq 28 typedef struct _ShmCompletion { BYTE type; /* always eventBase + ShmCompletion */ BYTE bpad0; CARD16 sequenceNumber B16; Drawable drawable B32; CARD16 minorEvent B16; BYTE majorEvent; BYTE bpad1; ShmSeg shmseg B32; CARD32 offset B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; } xShmCompletionEvent; #define sz_xShmCompletionEvent 32 /* Version 1.2 additions */ typedef struct _ShmAttachFd { CARD8 reqType; /* always ShmReqCode */ CARD8 shmReqType; /* always X_ShmAttachFd */ CARD16 length B16; ShmSeg shmseg B32; BOOL readOnly; BYTE pad0; CARD16 pad1 B16; } xShmAttachFdReq; /* File descriptor is passed with this request */ #define sz_xShmAttachFdReq 12 typedef struct _ShmCreateSegment { CARD8 reqType; /* always ShmReqCode */ CARD8 shmReqType; /* always X_ShmAttachFd */ CARD16 length B16; ShmSeg shmseg B32; CARD32 size B32; BOOL readOnly; BYTE pad0; CARD16 pad1 B16; } xShmCreateSegmentReq; #define sz_xShmCreateSegmentReq 16 typedef struct { CARD8 type; /* must be X_Reply */ CARD8 nfd; /* must be 1 */ CARD16 sequenceNumber B16; /* last sequence number */ CARD32 length B32; /* 0 */ CARD32 pad2 B32; /* unused */ CARD32 pad3 B32; /* unused */ CARD32 pad4 B32; /* unused */ CARD32 pad5 B32; /* unused */ CARD32 pad6 B32; /* unused */ CARD32 pad7 B32; /* unused */ } xShmCreateSegmentReply; /* File descriptor is passed with this reply */ #define sz_xShmCreateSegmentReply 32 #undef ShmSeg #undef Drawable #undef VisualID #undef GContext #undef Pixmap #endif /* _SHMPROTO_H_ */ X11/extensions/randrproto.h000064400000066150147631660250011701 0ustar00/* * Copyright © 2000 Compaq Computer Corporation * Copyright © 2002 Hewlett-Packard Company * Copyright © 2006 Intel Corporation * Copyright © 2008 Red Hat, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * * Author: Jim Gettys, Hewlett-Packard Company, Inc. * Keith Packard, Intel Corporation */ /* note that RANDR 1.0 is incompatible with version 0.0, or 0.1 */ /* V1.0 removes depth switching from the protocol */ #ifndef _XRANDRP_H_ #define _XRANDRP_H_ #include #include #define Window CARD32 #define Drawable CARD32 #define Font CARD32 #define Pixmap CARD32 #define Cursor CARD32 #define Colormap CARD32 #define GContext CARD32 #define Atom CARD32 #define Time CARD32 #define KeyCode CARD8 #define KeySym CARD32 #define RROutput CARD32 #define RRMode CARD32 #define RRCrtc CARD32 #define RRProvider CARD32 #define RRModeFlags CARD32 #define RRLease CARD32 #define Rotation CARD16 #define SizeID CARD16 #define SubpixelOrder CARD16 /* * data structures */ typedef struct { CARD16 widthInPixels B16; CARD16 heightInPixels B16; CARD16 widthInMillimeters B16; CARD16 heightInMillimeters B16; } xScreenSizes; #define sz_xScreenSizes 8 /* * requests and replies */ typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; CARD32 majorVersion B32; CARD32 minorVersion B32; } xRRQueryVersionReq; #define sz_xRRQueryVersionReq 12 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 majorVersion B32; CARD32 minorVersion B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRRQueryVersionReply; #define sz_xRRQueryVersionReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; } xRRGetScreenInfoReq; #define sz_xRRGetScreenInfoReq 8 /* * the xRRScreenInfoReply structure is followed by: * * the size information */ typedef struct { BYTE type; /* X_Reply */ BYTE setOfRotations; CARD16 sequenceNumber B16; CARD32 length B32; Window root B32; Time timestamp B32; Time configTimestamp B32; CARD16 nSizes B16; SizeID sizeID B16; Rotation rotation B16; CARD16 rate B16; CARD16 nrateEnts B16; CARD16 pad B16; } xRRGetScreenInfoReply; #define sz_xRRGetScreenInfoReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Drawable drawable B32; Time timestamp B32; Time configTimestamp B32; SizeID sizeID B16; Rotation rotation B16; } xRR1_0SetScreenConfigReq; #define sz_xRR1_0SetScreenConfigReq 20 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Drawable drawable B32; Time timestamp B32; Time configTimestamp B32; SizeID sizeID B16; Rotation rotation B16; CARD16 rate B16; CARD16 pad B16; } xRRSetScreenConfigReq; #define sz_xRRSetScreenConfigReq 24 typedef struct { BYTE type; /* X_Reply */ CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; Time newTimestamp B32; Time newConfigTimestamp B32; Window root; CARD16 subpixelOrder B16; CARD16 pad4 B16; CARD32 pad5 B32; CARD32 pad6 B32; } xRRSetScreenConfigReply; #define sz_xRRSetScreenConfigReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; CARD16 enable B16; CARD16 pad2 B16; } xRRSelectInputReq; #define sz_xRRSelectInputReq 12 /* * Additions for version 1.2 */ typedef struct _xRRModeInfo { RRMode id B32; CARD16 width B16; CARD16 height B16; CARD32 dotClock B32; CARD16 hSyncStart B16; CARD16 hSyncEnd B16; CARD16 hTotal B16; CARD16 hSkew B16; CARD16 vSyncStart B16; CARD16 vSyncEnd B16; CARD16 vTotal B16; CARD16 nameLength B16; RRModeFlags modeFlags B32; } xRRModeInfo; #define sz_xRRModeInfo 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; } xRRGetScreenSizeRangeReq; #define sz_xRRGetScreenSizeRangeReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 pad; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 minWidth B16; CARD16 minHeight B16; CARD16 maxWidth B16; CARD16 maxHeight B16; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xRRGetScreenSizeRangeReply; #define sz_xRRGetScreenSizeRangeReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; CARD16 width B16; CARD16 height B16; CARD32 widthInMillimeters B32; CARD32 heightInMillimeters B32; } xRRSetScreenSizeReq; #define sz_xRRSetScreenSizeReq 20 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; } xRRGetScreenResourcesReq; #define sz_xRRGetScreenResourcesReq 8 typedef struct { BYTE type; CARD8 pad; CARD16 sequenceNumber B16; CARD32 length B32; Time timestamp B32; Time configTimestamp B32; CARD16 nCrtcs B16; CARD16 nOutputs B16; CARD16 nModes B16; CARD16 nbytesNames B16; CARD32 pad1 B32; CARD32 pad2 B32; } xRRGetScreenResourcesReply; #define sz_xRRGetScreenResourcesReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RROutput output B32; Time configTimestamp B32; } xRRGetOutputInfoReq; #define sz_xRRGetOutputInfoReq 12 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; Time timestamp B32; RRCrtc crtc B32; CARD32 mmWidth B32; CARD32 mmHeight B32; CARD8 connection; CARD8 subpixelOrder; CARD16 nCrtcs B16; CARD16 nModes B16; CARD16 nPreferred B16; CARD16 nClones B16; CARD16 nameLength B16; } xRRGetOutputInfoReply; #define sz_xRRGetOutputInfoReply 36 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RROutput output B32; } xRRListOutputPropertiesReq; #define sz_xRRListOutputPropertiesReq 8 typedef struct { BYTE type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nAtoms B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xRRListOutputPropertiesReply; #define sz_xRRListOutputPropertiesReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RROutput output B32; Atom property B32; } xRRQueryOutputPropertyReq; #define sz_xRRQueryOutputPropertyReq 12 typedef struct { BYTE type; BYTE pad0; CARD16 sequenceNumber B16; CARD32 length B32; BOOL pending; BOOL range; BOOL immutable; BYTE pad1; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xRRQueryOutputPropertyReply; #define sz_xRRQueryOutputPropertyReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RROutput output B32; Atom property B32; BOOL pending; BOOL range; CARD16 pad B16; } xRRConfigureOutputPropertyReq; #define sz_xRRConfigureOutputPropertyReq 16 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RROutput output B32; Atom property B32; Atom type B32; CARD8 format; CARD8 mode; CARD16 pad; CARD32 nUnits B32; } xRRChangeOutputPropertyReq; #define sz_xRRChangeOutputPropertyReq 24 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RROutput output B32; Atom property B32; } xRRDeleteOutputPropertyReq; #define sz_xRRDeleteOutputPropertyReq 12 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RROutput output B32; Atom property B32; Atom type B32; CARD32 longOffset B32; CARD32 longLength B32; #ifdef __cplusplus BOOL _delete; #else BOOL delete; #endif BOOL pending; CARD16 pad1 B16; } xRRGetOutputPropertyReq; #define sz_xRRGetOutputPropertyReq 28 typedef struct { BYTE type; CARD8 format; CARD16 sequenceNumber B16; CARD32 length B32; Atom propertyType B32; CARD32 bytesAfter B32; CARD32 nItems B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xRRGetOutputPropertyReply; #define sz_xRRGetOutputPropertyReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; xRRModeInfo modeInfo; } xRRCreateModeReq; #define sz_xRRCreateModeReq 40 typedef struct { BYTE type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; RRMode mode B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRRCreateModeReply; #define sz_xRRCreateModeReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRMode mode B32; } xRRDestroyModeReq; #define sz_xRRDestroyModeReq 8 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RROutput output B32; RRMode mode B32; } xRRAddOutputModeReq; #define sz_xRRAddOutputModeReq 12 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RROutput output B32; RRMode mode B32; } xRRDeleteOutputModeReq; #define sz_xRRDeleteOutputModeReq 12 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRCrtc crtc B32; Time configTimestamp B32; } xRRGetCrtcInfoReq; #define sz_xRRGetCrtcInfoReq 12 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; Time timestamp B32; INT16 x B16; INT16 y B16; CARD16 width B16; CARD16 height B16; RRMode mode B32; Rotation rotation B16; Rotation rotations B16; CARD16 nOutput B16; CARD16 nPossibleOutput B16; } xRRGetCrtcInfoReply; #define sz_xRRGetCrtcInfoReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRCrtc crtc B32; Time timestamp B32; Time configTimestamp B32; INT16 x B16; INT16 y B16; RRMode mode B32; Rotation rotation B16; CARD16 pad B16; } xRRSetCrtcConfigReq; #define sz_xRRSetCrtcConfigReq 28 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; Time newTimestamp B32; CARD32 pad1 B32; CARD32 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRRSetCrtcConfigReply; #define sz_xRRSetCrtcConfigReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRCrtc crtc B32; } xRRGetCrtcGammaSizeReq; #define sz_xRRGetCrtcGammaSizeReq 8 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 size B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xRRGetCrtcGammaSizeReply; #define sz_xRRGetCrtcGammaSizeReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRCrtc crtc B32; } xRRGetCrtcGammaReq; #define sz_xRRGetCrtcGammaReq 8 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 size B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xRRGetCrtcGammaReply; #define sz_xRRGetCrtcGammaReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRCrtc crtc B32; CARD16 size B16; CARD16 pad1 B16; } xRRSetCrtcGammaReq; #define sz_xRRSetCrtcGammaReq 12 /* * Additions for V1.3 */ typedef xRRGetScreenResourcesReq xRRGetScreenResourcesCurrentReq; #define sz_xRRGetScreenResourcesCurrentReq sz_xRRGetScreenResourcesReq typedef xRRGetScreenResourcesReply xRRGetScreenResourcesCurrentReply; #define sz_xRRGetScreenResourcesCurrentReply sz_xRRGetScreenResourcesReply typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRCrtc crtc B32; xRenderTransform transform; CARD16 nbytesFilter; /* number of bytes in filter name */ CARD16 pad B16; } xRRSetCrtcTransformReq; #define sz_xRRSetCrtcTransformReq 48 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRCrtc crtc B32; } xRRGetCrtcTransformReq; #define sz_xRRGetCrtcTransformReq 8 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; xRenderTransform pendingTransform; BYTE hasTransforms; CARD8 pad0; CARD16 pad1 B16; xRenderTransform currentTransform; CARD32 pad2 B32; CARD16 pendingNbytesFilter B16; /* number of bytes in filter name */ CARD16 pendingNparamsFilter B16; /* number of filter params */ CARD16 currentNbytesFilter B16; /* number of bytes in filter name */ CARD16 currentNparamsFilter B16; /* number of filter params */ } xRRGetCrtcTransformReply; #define sz_xRRGetCrtcTransformReply 96 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; RROutput output B32; } xRRSetOutputPrimaryReq; #define sz_xRRSetOutputPrimaryReq 12 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; } xRRGetOutputPrimaryReq; #define sz_xRRGetOutputPrimaryReq 8 typedef struct { BYTE type; CARD8 pad; CARD16 sequenceNumber B16; CARD32 length B32; RROutput output B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRRGetOutputPrimaryReply; #define sz_xRRGetOutputPrimaryReply 32 /* * Additions for V1.4 */ typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; } xRRGetProvidersReq; #define sz_xRRGetProvidersReq 8 typedef struct { BYTE type; CARD8 pad; CARD16 sequenceNumber B16; CARD32 length B32; Time timestamp B32; CARD16 nProviders; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRRGetProvidersReply; #define sz_xRRGetProvidersReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRProvider provider B32; Time configTimestamp B32; } xRRGetProviderInfoReq; #define sz_xRRGetProviderInfoReq 12 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; Time timestamp B32; CARD32 capabilities B32; CARD16 nCrtcs B16; CARD16 nOutputs B16; CARD16 nAssociatedProviders B16; CARD16 nameLength B16; CARD32 pad1 B32; CARD32 pad2 B32; } xRRGetProviderInfoReply; #define sz_xRRGetProviderInfoReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRProvider provider B32; RRProvider source_provider B32; Time configTimestamp B32; } xRRSetProviderOutputSourceReq; #define sz_xRRSetProviderOutputSourceReq 16 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRProvider provider B32; RRProvider sink_provider B32; Time configTimestamp B32; } xRRSetProviderOffloadSinkReq; #define sz_xRRSetProviderOffloadSinkReq 16 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRProvider provider B32; } xRRListProviderPropertiesReq; #define sz_xRRListProviderPropertiesReq 8 typedef struct { BYTE type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nAtoms B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xRRListProviderPropertiesReply; #define sz_xRRListProviderPropertiesReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRProvider provider B32; Atom property B32; } xRRQueryProviderPropertyReq; #define sz_xRRQueryProviderPropertyReq 12 typedef struct { BYTE type; BYTE pad0; CARD16 sequenceNumber B16; CARD32 length B32; BOOL pending; BOOL range; BOOL immutable; BYTE pad1; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xRRQueryProviderPropertyReply; #define sz_xRRQueryProviderPropertyReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRProvider provider B32; Atom property B32; BOOL pending; BOOL range; CARD16 pad B16; } xRRConfigureProviderPropertyReq; #define sz_xRRConfigureProviderPropertyReq 16 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRProvider provider B32; Atom property B32; Atom type B32; CARD8 format; CARD8 mode; CARD16 pad; CARD32 nUnits B32; } xRRChangeProviderPropertyReq; #define sz_xRRChangeProviderPropertyReq 24 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRProvider provider B32; Atom property B32; } xRRDeleteProviderPropertyReq; #define sz_xRRDeleteProviderPropertyReq 12 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRProvider provider B32; Atom property B32; Atom type B32; CARD32 longOffset B32; CARD32 longLength B32; #ifdef __cplusplus BOOL _delete; #else BOOL delete; #endif BOOL pending; CARD16 pad1 B16; } xRRGetProviderPropertyReq; #define sz_xRRGetProviderPropertyReq 28 typedef struct { BYTE type; CARD8 format; CARD16 sequenceNumber B16; CARD32 length B32; Atom propertyType B32; CARD32 bytesAfter B32; CARD32 nItems B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xRRGetProviderPropertyReply; #define sz_xRRGetProviderPropertyReply 32 /* * Additions for V1.6 */ typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; RRLease lid B32; CARD16 nCrtcs B16; CARD16 nOutputs B16; } xRRCreateLeaseReq; #define sz_xRRCreateLeaseReq 16 typedef struct { BYTE type; CARD8 nfd; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xRRCreateLeaseReply; #define sz_xRRCreateLeaseReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRLease lid B32; BYTE terminate; CARD8 pad1; CARD16 pad2 B16; } xRRFreeLeaseReq; #define sz_xRRFreeLeaseReq 12 /* * event */ typedef struct { CARD8 type; /* always evBase + ScreenChangeNotify */ CARD8 rotation; /* new rotation */ CARD16 sequenceNumber B16; Time timestamp B32; /* time screen was changed */ Time configTimestamp B32; /* time config data was changed */ Window root B32; /* root window */ Window window B32; /* window requesting notification */ SizeID sizeID B16; /* new size ID */ CARD16 subpixelOrder B16; /* subpixel order */ CARD16 widthInPixels B16; /* new size */ CARD16 heightInPixels B16; CARD16 widthInMillimeters B16; CARD16 heightInMillimeters B16; } xRRScreenChangeNotifyEvent; #define sz_xRRScreenChangeNotifyEvent 32 typedef struct { CARD8 type; /* always evBase + RRNotify */ CARD8 subCode; /* RRNotify_CrtcChange */ CARD16 sequenceNumber B16; Time timestamp B32; /* time crtc was changed */ Window window B32; /* window requesting notification */ RRCrtc crtc B32; /* affected CRTC */ RRMode mode B32; /* current mode */ CARD16 rotation B16; /* rotation and reflection */ CARD16 pad1 B16; /* unused */ INT16 x B16; /* new location */ INT16 y B16; CARD16 width B16; /* new size */ CARD16 height B16; } xRRCrtcChangeNotifyEvent; #define sz_xRRCrtcChangeNotifyEvent 32 typedef struct { CARD8 type; /* always evBase + RRNotify */ CARD8 subCode; /* RRNotify_OutputChange */ CARD16 sequenceNumber B16; Time timestamp B32; /* time output was changed */ Time configTimestamp B32; /* time config was changed */ Window window B32; /* window requesting notification */ RROutput output B32; /* affected output */ RRCrtc crtc B32; /* current crtc */ RRMode mode B32; /* current mode */ CARD16 rotation B16; /* rotation and reflection */ CARD8 connection; /* connection status */ CARD8 subpixelOrder; /* subpixel order */ } xRROutputChangeNotifyEvent; #define sz_xRROutputChangeNotifyEvent 32 typedef struct { CARD8 type; /* always evBase + RRNotify */ CARD8 subCode; /* RRNotify_OutputProperty */ CARD16 sequenceNumber B16; Window window B32; /* window requesting notification */ RROutput output B32; /* affected output */ Atom atom B32; /* property name */ Time timestamp B32; /* time crtc was changed */ CARD8 state; /* NewValue or Deleted */ CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; } xRROutputPropertyNotifyEvent; #define sz_xRROutputPropertyNotifyEvent 32 typedef struct { CARD8 type; /* always evBase + RRNotify */ CARD8 subCode; /* RRNotify_ProviderChange */ CARD16 sequenceNumber B16; Time timestamp B32; /* time provider was changed */ Window window B32; /* window requesting notification */ RRProvider provider B32; /* affected provider */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xRRProviderChangeNotifyEvent; #define sz_xRRProviderChangeNotifyEvent 32 typedef struct { CARD8 type; /* always evBase + RRNotify */ CARD8 subCode; /* RRNotify_ProviderProperty */ CARD16 sequenceNumber B16; Window window B32; /* window requesting notification */ RRProvider provider B32; /* affected provider */ Atom atom B32; /* property name */ Time timestamp B32; /* time provider was changed */ CARD8 state; /* NewValue or Deleted */ CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; } xRRProviderPropertyNotifyEvent; #define sz_xRRProviderPropertyNotifyEvent 32 typedef struct { CARD8 type; /* always evBase + RRNotify */ CARD8 subCode; /* RRNotify_ResourceChange */ CARD16 sequenceNumber B16; Time timestamp B32; /* time resource was changed */ Window window B32; /* window requesting notification */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRRResourceChangeNotifyEvent; #define sz_xRRResourceChangeNotifyEvent 32 typedef struct { CARD8 type; /* always evBase + RRNotify */ CARD8 subCode; /* RRNotify_Lease */ CARD16 sequenceNumber B16; Time timestamp B32; /* time resource was changed */ Window window B32; /* window requesting notification */ RRLease lease B32; CARD8 created; /* created/deleted */ CARD8 pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xRRLeaseNotifyEvent; #define sz_xRRLeaseNotifyEvent 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRCrtc crtc B32; } xRRGetPanningReq; #define sz_xRRGetPanningReq 8 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; Time timestamp B32; CARD16 left B16; CARD16 top B16; CARD16 width B16; CARD16 height B16; CARD16 track_left B16; CARD16 track_top B16; CARD16 track_width B16; CARD16 track_height B16; INT16 border_left B16; INT16 border_top B16; INT16 border_right B16; INT16 border_bottom B16; } xRRGetPanningReply; #define sz_xRRGetPanningReply 36 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRCrtc crtc B32; Time timestamp B32; CARD16 left B16; CARD16 top B16; CARD16 width B16; CARD16 height B16; CARD16 track_left B16; CARD16 track_top B16; CARD16 track_width B16; CARD16 track_height B16; INT16 border_left B16; INT16 border_top B16; INT16 border_right B16; INT16 border_bottom B16; } xRRSetPanningReq; #define sz_xRRSetPanningReq 36 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; Time newTimestamp B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRRSetPanningReply; #define sz_xRRSetPanningReply 32 typedef struct { Atom name B32; BOOL primary; BOOL automatic; CARD16 noutput B16; INT16 x B16; INT16 y B16; CARD16 width B16; CARD16 height B16; CARD32 widthInMillimeters B32; CARD32 heightInMillimeters B32; } xRRMonitorInfo; #define sz_xRRMonitorInfo 24 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; BOOL get_active; CARD8 pad; CARD16 pad2; } xRRGetMonitorsReq; #define sz_xRRGetMonitorsReq 12 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; Time timestamp B32; CARD32 nmonitors B32; CARD32 noutputs B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xRRGetMonitorsReply; #define sz_xRRGetMonitorsReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; xRRMonitorInfo monitor; } xRRSetMonitorReq; #define sz_xRRSetMonitorReq 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; Atom name B32; } xRRDeleteMonitorReq; #define sz_xRRDeleteMonitorReq 12 #undef RRModeFlags #undef RRCrtc #undef RRMode #undef RROutput #undef RRMode #undef RRCrtc #undef RRProvider #undef Drawable #undef Window #undef Font #undef Pixmap #undef Cursor #undef Colormap #undef GContext #undef Atom #undef Time #undef KeyCode #undef KeySym #undef Rotation #undef SizeID #undef SubpixelOrder #endif /* _XRANDRP_H_ */ X11/extensions/xcmiscproto.h000064400000006153147631660250012056 0ustar00/* Copyright 1993, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _XCMISCPROTO_H_ #define _XCMISCPROTO_H_ #define X_XCMiscGetVersion 0 #define X_XCMiscGetXIDRange 1 #define X_XCMiscGetXIDList 2 #define XCMiscNumberEvents 0 #define XCMiscNumberErrors 0 #define XCMiscMajorVersion 1 #define XCMiscMinorVersion 1 #define XCMiscExtensionName "XC-MISC" typedef struct { CARD8 reqType; /* always XCMiscCode */ CARD8 miscReqType; /* always X_XCMiscGetVersion */ CARD16 length B16; CARD16 majorVersion B16; CARD16 minorVersion B16; } xXCMiscGetVersionReq; #define sz_xXCMiscGetVersionReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; CARD16 minorVersion B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXCMiscGetVersionReply; #define sz_xXCMiscGetVersionReply 32 typedef struct { CARD8 reqType; /* always XCMiscCode */ CARD8 miscReqType; /* always X_XCMiscGetXIDRange */ CARD16 length B16; } xXCMiscGetXIDRangeReq; #define sz_xXCMiscGetXIDRangeReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 start_id B32; CARD32 count B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xXCMiscGetXIDRangeReply; #define sz_xXCMiscGetXIDRangeReply 32 typedef struct { CARD8 reqType; /* always XCMiscCode */ CARD8 miscReqType; /* always X_XCMiscGetXIDList */ CARD16 length B16; CARD32 count B32; /* number of IDs requested */ } xXCMiscGetXIDListReq; #define sz_xXCMiscGetXIDListReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 count B32; /* number of IDs requested */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXCMiscGetXIDListReply; #define sz_xXCMiscGetXIDListReply 32 #endif /* _XCMISCPROTO_H_ */ X11/extensions/shapestr.h000064400000000374147631660250011334 0ustar00#ifndef _SHAPESTR_H_ #define _SHAPESTR_H_ #warning "shapestr.h is obsolete and may be removed in the future." #warning "include for the protocol defines." #include #endif /* _SHAPESTR_H_ */ X11/Xresource.h000064400000024604147631660250007265 0ustar00 /*********************************************************** Copyright 1987, 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef _X11_XRESOURCE_H_ #define _X11_XRESOURCE_H_ #ifndef _XP_PRINT_SERVER_ #include #endif /**************************************************************** **************************************************************** *** *** *** *** *** X Resource Manager Intrinsics *** *** *** *** *** **************************************************************** ****************************************************************/ _XFUNCPROTOBEGIN /**************************************************************** * * Memory Management * ****************************************************************/ extern char *Xpermalloc( unsigned int /* size */ ); /**************************************************************** * * Quark Management * ****************************************************************/ typedef int XrmQuark, *XrmQuarkList; #define NULLQUARK ((XrmQuark) 0) typedef char *XrmString; #define NULLSTRING ((XrmString) 0) /* find quark for string, create new quark if none already exists */ extern XrmQuark XrmStringToQuark( _Xconst char* /* string */ ); extern XrmQuark XrmPermStringToQuark( _Xconst char* /* string */ ); /* find string for quark */ extern XrmString XrmQuarkToString( XrmQuark /* quark */ ); extern XrmQuark XrmUniqueQuark( void ); #define XrmStringsEqual(a1, a2) (strcmp(a1, a2) == 0) /**************************************************************** * * Conversion of Strings to Lists * ****************************************************************/ typedef enum {XrmBindTightly, XrmBindLoosely} XrmBinding, *XrmBindingList; extern void XrmStringToQuarkList( _Xconst char* /* string */, XrmQuarkList /* quarks_return */ ); extern void XrmStringToBindingQuarkList( _Xconst char* /* string */, XrmBindingList /* bindings_return */, XrmQuarkList /* quarks_return */ ); /**************************************************************** * * Name and Class lists. * ****************************************************************/ typedef XrmQuark XrmName; typedef XrmQuarkList XrmNameList; #define XrmNameToString(name) XrmQuarkToString(name) #define XrmStringToName(string) XrmStringToQuark(string) #define XrmStringToNameList(str, name) XrmStringToQuarkList(str, name) typedef XrmQuark XrmClass; typedef XrmQuarkList XrmClassList; #define XrmClassToString(c_class) XrmQuarkToString(c_class) #define XrmStringToClass(c_class) XrmStringToQuark(c_class) #define XrmStringToClassList(str,c_class) XrmStringToQuarkList(str, c_class) /**************************************************************** * * Resource Representation Types and Values * ****************************************************************/ typedef XrmQuark XrmRepresentation; #define XrmStringToRepresentation(string) XrmStringToQuark(string) #define XrmRepresentationToString(type) XrmQuarkToString(type) typedef struct { unsigned int size; XPointer addr; } XrmValue, *XrmValuePtr; /**************************************************************** * * Resource Manager Functions * ****************************************************************/ typedef struct _XrmHashBucketRec *XrmHashBucket; typedef XrmHashBucket *XrmHashTable; typedef XrmHashTable XrmSearchList[]; typedef struct _XrmHashBucketRec *XrmDatabase; extern void XrmDestroyDatabase( XrmDatabase /* database */ ); extern void XrmQPutResource( XrmDatabase* /* database */, XrmBindingList /* bindings */, XrmQuarkList /* quarks */, XrmRepresentation /* type */, XrmValue* /* value */ ); extern void XrmPutResource( XrmDatabase* /* database */, _Xconst char* /* specifier */, _Xconst char* /* type */, XrmValue* /* value */ ); extern void XrmQPutStringResource( XrmDatabase* /* database */, XrmBindingList /* bindings */, XrmQuarkList /* quarks */, _Xconst char* /* value */ ); extern void XrmPutStringResource( XrmDatabase* /* database */, _Xconst char* /* specifier */, _Xconst char* /* value */ ); extern void XrmPutLineResource( XrmDatabase* /* database */, _Xconst char* /* line */ ); extern Bool XrmQGetResource( XrmDatabase /* database */, XrmNameList /* quark_name */, XrmClassList /* quark_class */, XrmRepresentation* /* quark_type_return */, XrmValue* /* value_return */ ); extern Bool XrmGetResource( XrmDatabase /* database */, _Xconst char* /* str_name */, _Xconst char* /* str_class */, char** /* str_type_return */, XrmValue* /* value_return */ ); extern Bool XrmQGetSearchList( XrmDatabase /* database */, XrmNameList /* names */, XrmClassList /* classes */, XrmSearchList /* list_return */, int /* list_length */ ); extern Bool XrmQGetSearchResource( XrmSearchList /* list */, XrmName /* name */, XrmClass /* class */, XrmRepresentation* /* type_return */, XrmValue* /* value_return */ ); /**************************************************************** * * Resource Database Management * ****************************************************************/ #ifndef _XP_PRINT_SERVER_ extern void XrmSetDatabase( Display* /* display */, XrmDatabase /* database */ ); extern XrmDatabase XrmGetDatabase( Display* /* display */ ); #endif /* !_XP_PRINT_SERVER_ */ extern XrmDatabase XrmGetFileDatabase( _Xconst char* /* filename */ ); extern Status XrmCombineFileDatabase( _Xconst char* /* filename */, XrmDatabase* /* target */, Bool /* override */ ); extern XrmDatabase XrmGetStringDatabase( _Xconst char* /* data */ /* null terminated string */ ); extern void XrmPutFileDatabase( XrmDatabase /* database */, _Xconst char* /* filename */ ); extern void XrmMergeDatabases( XrmDatabase /* source_db */, XrmDatabase* /* target_db */ ); extern void XrmCombineDatabase( XrmDatabase /* source_db */, XrmDatabase* /* target_db */, Bool /* override */ ); #define XrmEnumAllLevels 0 #define XrmEnumOneLevel 1 extern Bool XrmEnumerateDatabase( XrmDatabase /* db */, XrmNameList /* name_prefix */, XrmClassList /* class_prefix */, int /* mode */, Bool (*)( XrmDatabase* /* db */, XrmBindingList /* bindings */, XrmQuarkList /* quarks */, XrmRepresentation* /* type */, XrmValue* /* value */, XPointer /* closure */ ) /* proc */, XPointer /* closure */ ); extern const char *XrmLocaleOfDatabase( XrmDatabase /* database */ ); /**************************************************************** * * Command line option mapping to resource entries * ****************************************************************/ typedef enum { XrmoptionNoArg, /* Value is specified in OptionDescRec.value */ XrmoptionIsArg, /* Value is the option string itself */ XrmoptionStickyArg, /* Value is characters immediately following option */ XrmoptionSepArg, /* Value is next argument in argv */ XrmoptionResArg, /* Resource and value in next argument in argv */ XrmoptionSkipArg, /* Ignore this option and the next argument in argv */ XrmoptionSkipLine, /* Ignore this option and the rest of argv */ XrmoptionSkipNArgs /* Ignore this option and the next OptionDescRes.value arguments in argv */ } XrmOptionKind; typedef struct { char *option; /* Option abbreviation in argv */ char *specifier; /* Resource specifier */ XrmOptionKind argKind; /* Which style of option it is */ XPointer value; /* Value to provide if XrmoptionNoArg */ } XrmOptionDescRec, *XrmOptionDescList; extern void XrmParseCommand( XrmDatabase* /* database */, XrmOptionDescList /* table */, int /* table_count */, _Xconst char* /* name */, int* /* argc_in_out */, char** /* argv_in_out */ ); _XFUNCPROTOEND #endif /* _X11_XRESOURCE_H_ */ /* DON'T ADD STUFF AFTER THIS #endif */ X11/Xwinsock.h000064400000004326147631660250007112 0ustar00/* Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL- ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * This header file has for sole purpose to allow to include winsock.h * without getting any name conflicts with our code. * Conflicts come from the fact that including winsock.h actually pulls * in the whole Windows API... */ #undef _XFree86Server #ifdef XFree86Server # define _XFree86Server # undef XFree86Server #endif /* * mingw-w64 headers define BOOL as a typedef, protecting against macros * mingw.org headers define BOOL in terms of WINBOOL * ... so try to come up with something which works with both :-) */ #define _NO_BOOL_TYPEDEF #define BOOL WINBOOL #define INT32 wINT32 #undef Status #define Status wStatus #define ATOM wATOM #define BYTE wBYTE #define FreeResource wFreeResource #include #undef Status #define Status int #undef BYTE #undef BOOL #undef INT32 #undef ATOM #undef FreeResource #undef CreateWindowA #undef RT_FONT #undef RT_CURSOR /* * Older version of this header used to name the windows API bool type wBOOL, * rather than more standard name WINBOOL */ #define wBOOL WINBOOL #ifdef _XFree86Server # define XFree86Server # undef _XFree86Server #endif X11/XKBlib.h000064400000074423147631660250006425 0ustar00/************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _X11_XKBLIB_H_ #define _X11_XKBLIB_H_ #include #include typedef struct _XkbAnyEvent { int type; /* XkbAnyEvent */ unsigned long serial; /* # of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XKB event minor code */ unsigned int device; /* device ID */ } XkbAnyEvent; typedef struct _XkbNewKeyboardNotify { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbNewKeyboardNotify */ int device; /* device ID */ int old_device; /* device ID of previous keyboard */ int min_key_code; /* minimum key code */ int max_key_code; /* maximum key code */ int old_min_key_code;/* min key code of previous kbd */ int old_max_key_code;/* max key code of previous kbd */ unsigned int changed; /* changed aspects of the keyboard */ char req_major; /* major and minor opcode of req */ char req_minor; /* that caused change, if applicable */ } XkbNewKeyboardNotifyEvent; typedef struct _XkbMapNotifyEvent { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbMapNotify */ int device; /* device ID */ unsigned int changed; /* fields which have been changed */ unsigned int flags; /* reserved */ int first_type; /* first changed key type */ int num_types; /* number of changed key types */ KeyCode min_key_code; KeyCode max_key_code; KeyCode first_key_sym; KeyCode first_key_act; KeyCode first_key_behavior; KeyCode first_key_explicit; KeyCode first_modmap_key; KeyCode first_vmodmap_key; int num_key_syms; int num_key_acts; int num_key_behaviors; int num_key_explicit; int num_modmap_keys; int num_vmodmap_keys; unsigned int vmods; /* mask of changed virtual mods */ } XkbMapNotifyEvent; typedef struct _XkbStateNotifyEvent { int type; /* XkbAnyEvent */ unsigned long serial; /* # of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbStateNotify */ int device; /* device ID */ unsigned int changed; /* mask of changed state components */ int group; /* keyboard group */ int base_group; /* base keyboard group */ int latched_group; /* latched keyboard group */ int locked_group; /* locked keyboard group */ unsigned int mods; /* modifier state */ unsigned int base_mods; /* base modifier state */ unsigned int latched_mods; /* latched modifiers */ unsigned int locked_mods; /* locked modifiers */ int compat_state; /* compatibility state */ unsigned char grab_mods; /* mods used for grabs */ unsigned char compat_grab_mods;/* grab mods for non-XKB clients */ unsigned char lookup_mods; /* mods sent to clients */ unsigned char compat_lookup_mods; /* mods sent to non-XKB clients */ int ptr_buttons; /* pointer button state */ KeyCode keycode; /* keycode that caused the change */ char event_type; /* KeyPress or KeyRelease */ char req_major; /* Major opcode of request */ char req_minor; /* Minor opcode of request */ } XkbStateNotifyEvent; typedef struct _XkbControlsNotify { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbControlsNotify */ int device; /* device ID */ unsigned int changed_ctrls; /* controls with changed sub-values */ unsigned int enabled_ctrls; /* controls currently enabled */ unsigned int enabled_ctrl_changes;/* controls just {en,dis}abled */ int num_groups; /* total groups on keyboard */ KeyCode keycode; /* key that caused change or 0 */ char event_type; /* type of event that caused change */ char req_major; /* if keycode==0, major and minor */ char req_minor; /* opcode of req that caused change */ } XkbControlsNotifyEvent; typedef struct _XkbIndicatorNotify { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbIndicatorNotify */ int device; /* device ID */ unsigned int changed; /* indicators with new state or map */ unsigned int state; /* current state of all indicators */ } XkbIndicatorNotifyEvent; typedef struct _XkbNamesNotify { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbNamesNotify */ int device; /* device ID */ unsigned int changed; /* names that have changed */ int first_type; /* first key type with new name */ int num_types; /* number of key types with new names */ int first_lvl; /* first key type new new level names */ int num_lvls; /* # of key types w/new level names */ int num_aliases; /* total number of key aliases*/ int num_radio_groups;/* total number of radio groups */ unsigned int changed_vmods; /* virtual modifiers with new names */ unsigned int changed_groups; /* groups with new names */ unsigned int changed_indicators;/* indicators with new names */ int first_key; /* first key with new name */ int num_keys; /* number of keys with new names */ } XkbNamesNotifyEvent; typedef struct _XkbCompatMapNotify { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbCompatMapNotify */ int device; /* device ID */ unsigned int changed_groups; /* groups with new compat maps */ int first_si; /* first new symbol interp */ int num_si; /* number of new symbol interps */ int num_total_si; /* total # of symbol interps */ } XkbCompatMapNotifyEvent; typedef struct _XkbBellNotify { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbBellNotify */ int device; /* device ID */ int percent; /* requested volume as a % of maximum */ int pitch; /* requested pitch in Hz */ int duration; /* requested duration in useconds */ int bell_class; /* (input extension) feedback class */ int bell_id; /* (input extension) ID of feedback */ Atom name; /* "name" of requested bell */ Window window; /* window associated with event */ Bool event_only; /* "event only" requested */ } XkbBellNotifyEvent; typedef struct _XkbActionMessage { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbActionMessage */ int device; /* device ID */ KeyCode keycode; /* key that generated the event */ Bool press; /* true if act caused by key press */ Bool key_event_follows;/* true if key event also generated */ int group; /* effective group */ unsigned int mods; /* effective mods */ char message[XkbActionMessageLength+1]; /* message -- leave space for NUL */ } XkbActionMessageEvent; typedef struct _XkbAccessXNotify { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbAccessXNotify */ int device; /* device ID */ int detail; /* XkbAXN_* */ int keycode; /* key of event */ int sk_delay; /* current slow keys delay */ int debounce_delay; /* current debounce delay */ } XkbAccessXNotifyEvent; typedef struct _XkbExtensionDeviceNotify { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbExtensionDeviceNotify */ int device; /* device ID */ unsigned int reason; /* reason for the event */ unsigned int supported; /* mask of supported features */ unsigned int unsupported; /* mask of unsupported features */ /* that some app tried to use */ int first_btn; /* first button that changed */ int num_btns; /* range of buttons changed */ unsigned int leds_defined; /* indicators with names or maps */ unsigned int led_state; /* current state of the indicators */ int led_class; /* feedback class for led changes */ int led_id; /* feedback id for led changes */ } XkbExtensionDeviceNotifyEvent; typedef union _XkbEvent { int type; XkbAnyEvent any; XkbNewKeyboardNotifyEvent new_kbd; XkbMapNotifyEvent map; XkbStateNotifyEvent state; XkbControlsNotifyEvent ctrls; XkbIndicatorNotifyEvent indicators; XkbNamesNotifyEvent names; XkbCompatMapNotifyEvent compat; XkbBellNotifyEvent bell; XkbActionMessageEvent message; XkbAccessXNotifyEvent accessx; XkbExtensionDeviceNotifyEvent device; XEvent core; } XkbEvent; typedef struct _XkbKbdDpyState XkbKbdDpyStateRec,*XkbKbdDpyStatePtr; /* XkbOpenDisplay error codes */ #define XkbOD_Success 0 #define XkbOD_BadLibraryVersion 1 #define XkbOD_ConnectionRefused 2 #define XkbOD_NonXkbServer 3 #define XkbOD_BadServerVersion 4 /* Values for XlibFlags */ #define XkbLC_ForceLatin1Lookup (1<<0) #define XkbLC_ConsumeLookupMods (1<<1) #define XkbLC_AlwaysConsumeShiftAndLock (1<<2) #define XkbLC_IgnoreNewKeyboards (1<<3) #define XkbLC_ControlFallback (1<<4) #define XkbLC_ConsumeKeysOnComposeFail (1<<29) #define XkbLC_ComposeLED (1<<30) #define XkbLC_BeepOnComposeFail (1<<31) #define XkbLC_AllComposeControls (0xc0000000) #define XkbLC_AllControls (0xc000001f) _XFUNCPROTOBEGIN extern Bool XkbIgnoreExtension( Bool /* ignore */ ); extern Display *XkbOpenDisplay( char * /* name */, int * /* ev_rtrn */, int * /* err_rtrn */, int * /* major_rtrn */, int * /* minor_rtrn */, int * /* reason */ ); extern Bool XkbQueryExtension( Display * /* dpy */, int * /* opcodeReturn */, int * /* eventBaseReturn */, int * /* errorBaseReturn */, int * /* majorRtrn */, int * /* minorRtrn */ ); extern Bool XkbUseExtension( Display * /* dpy */, int * /* major_rtrn */, int * /* minor_rtrn */ ); extern Bool XkbLibraryVersion( int * /* libMajorRtrn */, int * /* libMinorRtrn */ ); extern unsigned int XkbSetXlibControls( Display* /* dpy */, unsigned int /* affect */, unsigned int /* values */ ); extern unsigned int XkbGetXlibControls( Display* /* dpy */ ); extern unsigned int XkbXlibControlsImplemented(void); typedef Atom (*XkbInternAtomFunc)( Display * /* dpy */, _Xconst char * /* name */, Bool /* only_if_exists */ ); typedef char * (*XkbGetAtomNameFunc)( Display * /* dpy */, Atom /* atom */ ); extern void XkbSetAtomFuncs( XkbInternAtomFunc /* getAtom */, XkbGetAtomNameFunc /* getName */ ); extern KeySym XkbKeycodeToKeysym( Display * /* dpy */, #if NeedWidePrototypes unsigned int /* kc */, #else KeyCode /* kc */, #endif int /* group */, int /* level */ ); extern unsigned int XkbKeysymToModifiers( Display * /* dpy */, KeySym /* ks */ ); extern Bool XkbLookupKeySym( Display * /* dpy */, KeyCode /* keycode */, unsigned int /* modifiers */, unsigned int * /* modifiers_return */, KeySym * /* keysym_return */ ); extern int XkbLookupKeyBinding( Display * /* dpy */, KeySym /* sym_rtrn */, unsigned int /* mods */, char * /* buffer */, int /* nbytes */, int * /* extra_rtrn */ ); extern Bool XkbTranslateKeyCode( XkbDescPtr /* xkb */, KeyCode /* keycode */, unsigned int /* modifiers */, unsigned int * /* modifiers_return */, KeySym * /* keysym_return */ ); extern int XkbTranslateKeySym( Display * /* dpy */, register KeySym * /* sym_return */, unsigned int /* modifiers */, char * /* buffer */, int /* nbytes */, int * /* extra_rtrn */ ); extern Bool XkbSetAutoRepeatRate( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* delay */, unsigned int /* interval */ ); extern Bool XkbGetAutoRepeatRate( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int * /* delayRtrn */, unsigned int * /* intervalRtrn */ ); extern Bool XkbChangeEnabledControls( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* affect */, unsigned int /* values */ ); extern Bool XkbDeviceBell( Display * /* dpy */, Window /* win */, int /* deviceSpec */, int /* bellClass */, int /* bellID */, int /* percent */, Atom /* name */ ); extern Bool XkbForceDeviceBell( Display * /* dpy */, int /* deviceSpec */, int /* bellClass */, int /* bellID */, int /* percent */ ); extern Bool XkbDeviceBellEvent( Display * /* dpy */, Window /* win */, int /* deviceSpec */, int /* bellClass */, int /* bellID */, int /* percent */, Atom /* name */ ); extern Bool XkbBell( Display * /* dpy */, Window /* win */, int /* percent */, Atom /* name */ ); extern Bool XkbForceBell( Display * /* dpy */, int /* percent */ ); extern Bool XkbBellEvent( Display * /* dpy */, Window /* win */, int /* percent */, Atom /* name */ ); extern Bool XkbSelectEvents( Display * /* dpy */, unsigned int /* deviceID */, unsigned int /* affect */, unsigned int /* values */ ); extern Bool XkbSelectEventDetails( Display * /* dpy */, unsigned int /* deviceID */, unsigned int /* eventType */, unsigned long /* affect */, unsigned long /* details */ ); extern void XkbNoteMapChanges( XkbMapChangesPtr /* old */, XkbMapNotifyEvent * /* new */, unsigned int /* wanted */ ); extern void XkbNoteNameChanges( XkbNameChangesPtr /* old */, XkbNamesNotifyEvent * /* new */, unsigned int /* wanted */ ); extern Status XkbGetIndicatorState( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int * /* pStateRtrn */ ); extern Status XkbGetDeviceIndicatorState( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* ledClass */, unsigned int /* ledID */, unsigned int * /* pStateRtrn */ ); extern Status XkbGetIndicatorMap( Display * /* dpy */, unsigned long /* which */, XkbDescPtr /* desc */ ); extern Bool XkbSetIndicatorMap( Display * /* dpy */, unsigned long /* which */, XkbDescPtr /* desc */ ); #define XkbNoteIndicatorMapChanges(o,n,w) \ ((o)->map_changes|=((n)->map_changes&(w))) #define XkbNoteIndicatorStateChanges(o,n,w)\ ((o)->state_changes|=((n)->state_changes&(w))) #define XkbGetIndicatorMapChanges(d,x,c) \ (XkbGetIndicatorMap((d),(c)->map_changes,x)) #define XkbChangeIndicatorMaps(d,x,c) \ (XkbSetIndicatorMap((d),(c)->map_changes,x)) extern Bool XkbGetNamedIndicator( Display * /* dpy */, Atom /* name */, int * /* pNdxRtrn */, Bool * /* pStateRtrn */, XkbIndicatorMapPtr /* pMapRtrn */, Bool * /* pRealRtrn */ ); extern Bool XkbGetNamedDeviceIndicator( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* ledClass */, unsigned int /* ledID */, Atom /* name */, int * /* pNdxRtrn */, Bool * /* pStateRtrn */, XkbIndicatorMapPtr /* pMapRtrn */, Bool * /* pRealRtrn */ ); extern Bool XkbSetNamedIndicator( Display * /* dpy */, Atom /* name */, Bool /* changeState */, Bool /* state */, Bool /* createNewMap */, XkbIndicatorMapPtr /* pMap */ ); extern Bool XkbSetNamedDeviceIndicator( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* ledClass */, unsigned int /* ledID */, Atom /* name */, Bool /* changeState */, Bool /* state */, Bool /* createNewMap */, XkbIndicatorMapPtr /* pMap */ ); extern Bool XkbLockModifiers( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* affect */, unsigned int /* values */ ); extern Bool XkbLatchModifiers( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* affect */, unsigned int /* values */ ); extern Bool XkbLockGroup( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* group */ ); extern Bool XkbLatchGroup( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* group */ ); extern Bool XkbSetServerInternalMods( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* affectReal */, unsigned int /* realValues */, unsigned int /* affectVirtual */, unsigned int /* virtualValues */ ); extern Bool XkbSetIgnoreLockMods( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* affectReal */, unsigned int /* realValues */, unsigned int /* affectVirtual */, unsigned int /* virtualValues */ ); extern Bool XkbVirtualModsToReal( XkbDescPtr /* xkb */, unsigned int /* virtual_mask */, unsigned int * /* mask_rtrn */ ); extern Bool XkbComputeEffectiveMap( XkbDescPtr /* xkb */, XkbKeyTypePtr /* type */, unsigned char * /* map_rtrn */ ); extern Status XkbInitCanonicalKeyTypes( XkbDescPtr /* xkb */, unsigned int /* which */, int /* keypadVMod */ ); extern XkbDescPtr XkbAllocKeyboard( void ); extern void XkbFreeKeyboard( XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeDesc */ ); extern Status XkbAllocClientMap( XkbDescPtr /* xkb */, unsigned int /* which */, unsigned int /* nTypes */ ); extern Status XkbAllocServerMap( XkbDescPtr /* xkb */, unsigned int /* which */, unsigned int /* nActions */ ); extern void XkbFreeClientMap( XkbDescPtr /* xkb */, unsigned int /* what */, Bool /* freeMap */ ); extern void XkbFreeServerMap( XkbDescPtr /* xkb */, unsigned int /* what */, Bool /* freeMap */ ); extern XkbKeyTypePtr XkbAddKeyType( XkbDescPtr /* xkb */, Atom /* name */, int /* map_count */, Bool /* want_preserve */, int /* num_lvls */ ); extern Status XkbAllocIndicatorMaps( XkbDescPtr /* xkb */ ); extern void XkbFreeIndicatorMaps( XkbDescPtr /* xkb */ ); extern XkbDescPtr XkbGetMap( Display * /* dpy */, unsigned int /* which */, unsigned int /* deviceSpec */ ); extern Status XkbGetUpdatedMap( Display * /* dpy */, unsigned int /* which */, XkbDescPtr /* desc */ ); extern Status XkbGetMapChanges( Display * /* dpy */, XkbDescPtr /* xkb */, XkbMapChangesPtr /* changes */ ); extern Status XkbRefreshKeyboardMapping( XkbMapNotifyEvent * /* event */ ); extern Status XkbGetKeyTypes( Display * /* dpy */, unsigned int /* first */, unsigned int /* num */, XkbDescPtr /* xkb */ ); extern Status XkbGetKeySyms( Display * /* dpy */, unsigned int /* first */, unsigned int /* num */, XkbDescPtr /* xkb */ ); extern Status XkbGetKeyActions( Display * /* dpy */, unsigned int /* first */, unsigned int /* num */, XkbDescPtr /* xkb */ ); extern Status XkbGetKeyBehaviors( Display * /* dpy */, unsigned int /* firstKey */, unsigned int /* nKeys */, XkbDescPtr /* desc */ ); extern Status XkbGetVirtualMods( Display * /* dpy */, unsigned int /* which */, XkbDescPtr /* desc */ ); extern Status XkbGetKeyExplicitComponents( Display * /* dpy */, unsigned int /* firstKey */, unsigned int /* nKeys */, XkbDescPtr /* desc */ ); extern Status XkbGetKeyModifierMap( Display * /* dpy */, unsigned int /* firstKey */, unsigned int /* nKeys */, XkbDescPtr /* desc */ ); extern Status XkbGetKeyVirtualModMap( Display * /* dpy */, unsigned int /* first */, unsigned int /* num */, XkbDescPtr /* xkb */ ); extern Status XkbAllocControls( XkbDescPtr /* xkb */, unsigned int /* which*/ ); extern void XkbFreeControls( XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeMap */ ); extern Status XkbGetControls( Display * /* dpy */, unsigned long /* which */, XkbDescPtr /* desc */ ); extern Bool XkbSetControls( Display * /* dpy */, unsigned long /* which */, XkbDescPtr /* desc */ ); extern void XkbNoteControlsChanges( XkbControlsChangesPtr /* old */, XkbControlsNotifyEvent * /* new */, unsigned int /* wanted */ ); #define XkbGetControlsChanges(d,x,c) XkbGetControls(d,(c)->changed_ctrls,x) #define XkbChangeControls(d,x,c) XkbSetControls(d,(c)->changed_ctrls,x) extern Status XkbAllocCompatMap( XkbDescPtr /* xkb */, unsigned int /* which */, unsigned int /* nInterpret */ ); extern void XkbFreeCompatMap( XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeMap */ ); extern Status XkbGetCompatMap( Display * /* dpy */, unsigned int /* which */, XkbDescPtr /* xkb */ ); extern Bool XkbSetCompatMap( Display * /* dpy */, unsigned int /* which */, XkbDescPtr /* xkb */, Bool /* updateActions */ ); extern XkbSymInterpretPtr XkbAddSymInterpret( XkbDescPtr /* xkb */, XkbSymInterpretPtr /* si */, Bool /* updateMap */, XkbChangesPtr /* changes */ ); extern Status XkbAllocNames( XkbDescPtr /* xkb */, unsigned int /* which */, int /* nTotalRG */, int /* nTotalAliases */ ); extern Status XkbGetNames( Display * /* dpy */, unsigned int /* which */, XkbDescPtr /* desc */ ); extern Bool XkbSetNames( Display * /* dpy */, unsigned int /* which */, unsigned int /* firstType */, unsigned int /* nTypes */, XkbDescPtr /* desc */ ); extern Bool XkbChangeNames( Display * /* dpy */, XkbDescPtr /* xkb */, XkbNameChangesPtr /* changes */ ); extern void XkbFreeNames( XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeMap */ ); extern Status XkbGetState( Display * /* dpy */, unsigned int /* deviceSpec */, XkbStatePtr /* rtrnState */ ); extern Bool XkbSetMap( Display * /* dpy */, unsigned int /* which */, XkbDescPtr /* desc */ ); extern Bool XkbChangeMap( Display* /* dpy */, XkbDescPtr /* desc */, XkbMapChangesPtr /* changes */ ); extern Bool XkbSetDetectableAutoRepeat( Display * /* dpy */, Bool /* detectable */, Bool * /* supported */ ); extern Bool XkbGetDetectableAutoRepeat( Display * /* dpy */, Bool * /* supported */ ); extern Bool XkbSetAutoResetControls( Display * /* dpy */, unsigned int /* changes */, unsigned int * /* auto_ctrls */, unsigned int * /* auto_values */ ); extern Bool XkbGetAutoResetControls( Display * /* dpy */, unsigned int * /* auto_ctrls */, unsigned int * /* auto_ctrl_values */ ); extern Bool XkbSetPerClientControls( Display * /* dpy */, unsigned int /* change */, unsigned int * /* values */ ); extern Bool XkbGetPerClientControls( Display * /* dpy */, unsigned int * /* ctrls */ ); extern Status XkbCopyKeyType( XkbKeyTypePtr /* from */, XkbKeyTypePtr /* into */ ); extern Status XkbCopyKeyTypes( XkbKeyTypePtr /* from */, XkbKeyTypePtr /* into */, int /* num_types */ ); extern Status XkbResizeKeyType( XkbDescPtr /* xkb */, int /* type_ndx */, int /* map_count */, Bool /* want_preserve */, int /* new_num_lvls */ ); extern KeySym *XkbResizeKeySyms( XkbDescPtr /* desc */, int /* forKey */, int /* symsNeeded */ ); extern XkbAction *XkbResizeKeyActions( XkbDescPtr /* desc */, int /* forKey */, int /* actsNeeded */ ); extern Status XkbChangeTypesOfKey( XkbDescPtr /* xkb */, int /* key */, int /* num_groups */, unsigned int /* groups */, int * /* newTypes */, XkbMapChangesPtr /* pChanges */ ); extern Status XkbChangeKeycodeRange( XkbDescPtr /* xkb */, int /* minKC */, int /* maxKC */, XkbChangesPtr /* changes */ ); /***====================================================================***/ extern XkbComponentListPtr XkbListComponents( Display * /* dpy */, unsigned int /* deviceSpec */, XkbComponentNamesPtr /* ptrns */, int * /* max_inout */ ); extern void XkbFreeComponentList( XkbComponentListPtr /* list */ ); extern XkbDescPtr XkbGetKeyboard( Display * /* dpy */, unsigned int /* which */, unsigned int /* deviceSpec */ ); extern XkbDescPtr XkbGetKeyboardByName( Display * /* dpy */, unsigned int /* deviceSpec */, XkbComponentNamesPtr /* names */, unsigned int /* want */, unsigned int /* need */, Bool /* load */ ); /***====================================================================***/ extern int XkbKeyTypesForCoreSymbols( /* returns # of groups */ XkbDescPtr /* xkb */, /* keyboard device */ int /* map_width */, /* width of core KeySym array */ KeySym * /* core_syms */, /* always mapWidth symbols */ unsigned int /* protected */, /* explicit key types */ int * /* types_inout */, /* always four type indices */ KeySym * /* xkb_syms_rtrn */ /* must have enough space */ ); extern Bool XkbApplyCompatMapToKey( /* False only on error */ XkbDescPtr /* xkb */, /* keymap to be edited */ KeyCode /* key */, /* key to be updated */ XkbChangesPtr /* changes */ /* resulting changes to map */ ); extern Bool XkbUpdateMapFromCore( /* False only on error */ XkbDescPtr /* xkb */, /* XKB keyboard to be edited */ KeyCode /* first_key */, /* first changed key */ int /* num_keys */, /* number of changed keys */ int /* map_width */, /* width of core keymap */ KeySym * /* core_keysyms */, /* symbols from core keymap */ XkbChangesPtr /* changes */ /* resulting changes */ ); /***====================================================================***/ extern XkbDeviceLedInfoPtr XkbAddDeviceLedInfo( XkbDeviceInfoPtr /* devi */, unsigned int /* ledClass */, unsigned int /* ledId */ ); extern Status XkbResizeDeviceButtonActions( XkbDeviceInfoPtr /* devi */, unsigned int /* newTotal */ ); extern XkbDeviceInfoPtr XkbAllocDeviceInfo( unsigned int /* deviceSpec */, unsigned int /* nButtons */, unsigned int /* szLeds */ ); extern void XkbFreeDeviceInfo( XkbDeviceInfoPtr /* devi */, unsigned int /* which */, Bool /* freeDevI */ ); extern void XkbNoteDeviceChanges( XkbDeviceChangesPtr /* old */, XkbExtensionDeviceNotifyEvent * /* new */, unsigned int /* wanted */ ); extern XkbDeviceInfoPtr XkbGetDeviceInfo( Display * /* dpy */, unsigned int /* which */, unsigned int /* deviceSpec */, unsigned int /* ledClass */, unsigned int /* ledID */ ); extern Status XkbGetDeviceInfoChanges( Display * /* dpy */, XkbDeviceInfoPtr /* devi */, XkbDeviceChangesPtr /* changes */ ); extern Status XkbGetDeviceButtonActions( Display * /* dpy */, XkbDeviceInfoPtr /* devi */, Bool /* all */, unsigned int /* first */, unsigned int /* nBtns */ ); extern Status XkbGetDeviceLedInfo( Display * /* dpy */, XkbDeviceInfoPtr /* devi */, unsigned int /* ledClass (class, XIDflt, XIAll) */, unsigned int /* ledId (id, XIDflt, XIAll) */, unsigned int /* which (XkbXI_Indicator{Names,Map}Mask */ ); extern Bool XkbSetDeviceInfo( Display * /* dpy */, unsigned int /* which */, XkbDeviceInfoPtr /* devi */ ); extern Bool XkbChangeDeviceInfo( Display* /* dpy */, XkbDeviceInfoPtr /* desc */, XkbDeviceChangesPtr /* changes */ ); extern Bool XkbSetDeviceLedInfo( Display * /* dpy */, XkbDeviceInfoPtr /* devi */, unsigned int /* ledClass */, unsigned int /* ledID */, unsigned int /* which */ ); extern Bool XkbSetDeviceButtonActions( Display * /* dpy */, XkbDeviceInfoPtr /* devi */, unsigned int /* first */, unsigned int /* nBtns */ ); /***====================================================================***/ extern char XkbToControl( char /* c */ ); /***====================================================================***/ extern Bool XkbSetDebuggingFlags( Display * /* dpy */, unsigned int /* mask */, unsigned int /* flags */, char * /* msg */, unsigned int /* ctrls_mask */, unsigned int /* ctrls */, unsigned int * /* rtrn_flags */, unsigned int * /* rtrn_ctrls */ ); extern Bool XkbApplyVirtualModChanges( XkbDescPtr /* xkb */, unsigned int /* changed */, XkbChangesPtr /* changes */ ); extern Bool XkbUpdateActionVirtualMods( XkbDescPtr /* xkb */, XkbAction * /* act */, unsigned int /* changed */ ); extern void XkbUpdateKeyTypeVirtualMods( XkbDescPtr /* xkb */, XkbKeyTypePtr /* type */, unsigned int /* changed */, XkbChangesPtr /* changes */ ); _XFUNCPROTOEND #endif /* _X11_XKBLIB_H_ */ X11/XWDFile.h000064400000007600147631660250006545 0ustar00/* Copyright 1985, 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * XWDFile.h MIT Project Athena, X Window system window raster * image dumper, dump file format header file. * * Author: Tony Della Fera, DEC * 27-Jun-85 * * Modifier: William F. Wyatt, SAO * 18-Nov-86 - version 6 for saving/restoring color maps */ #ifndef XWDFILE_H #define XWDFILE_H #include #define XWD_FILE_VERSION 7 #define sz_XWDheader 100 #define sz_XWDColor 12 typedef CARD32 xwdval; /* for old broken programs */ /* Values in the file are most significant byte first. */ typedef struct _xwd_file_header { /* header_size = SIZEOF(XWDheader) + length of null-terminated * window name. */ CARD32 header_size B32; CARD32 file_version B32; /* = XWD_FILE_VERSION above */ CARD32 pixmap_format B32; /* ZPixmap or XYPixmap */ CARD32 pixmap_depth B32; /* Pixmap depth */ CARD32 pixmap_width B32; /* Pixmap width */ CARD32 pixmap_height B32; /* Pixmap height */ CARD32 xoffset B32; /* Bitmap x offset, normally 0 */ CARD32 byte_order B32; /* of image data: MSBFirst, LSBFirst */ /* bitmap_unit applies to bitmaps (depth 1 format XY) only. * It is the number of bits that each scanline is padded to. */ CARD32 bitmap_unit B32; CARD32 bitmap_bit_order B32; /* bitmaps only: MSBFirst, LSBFirst */ /* bitmap_pad applies to pixmaps (non-bitmaps) only. * It is the number of bits that each scanline is padded to. */ CARD32 bitmap_pad B32; CARD32 bits_per_pixel B32; /* Bits per pixel */ /* bytes_per_line is pixmap_width padded to bitmap_unit (bitmaps) * or bitmap_pad (pixmaps). It is the delta (in bytes) to get * to the same x position on an adjacent row. */ CARD32 bytes_per_line B32; CARD32 visual_class B32; /* Class of colormap */ CARD32 red_mask B32; /* Z red mask */ CARD32 green_mask B32; /* Z green mask */ CARD32 blue_mask B32; /* Z blue mask */ CARD32 bits_per_rgb B32; /* Log2 of distinct color values */ CARD32 colormap_entries B32; /* Number of entries in colormap; not used? */ CARD32 ncolors B32; /* Number of XWDColor structures */ CARD32 window_width B32; /* Window width */ CARD32 window_height B32; /* Window height */ CARD32 window_x B32; /* Window upper left X coordinate */ CARD32 window_y B32; /* Window upper left Y coordinate */ CARD32 window_bdrwidth B32; /* Window border width */ } XWDFileHeader; /* Null-terminated window name follows the above structure. */ /* Next comes XWDColor structures, at offset XWDFileHeader.header_size in * the file. XWDFileHeader.ncolors tells how many XWDColor structures * there are. */ typedef struct { CARD32 pixel B32; CARD16 red B16; CARD16 green B16; CARD16 blue B16; CARD8 flags; CARD8 pad; } XWDColor; /* Last comes the image data in the format described by XWDFileHeader. */ #endif /* XWDFILE_H */ X11/XlibConf.h000064400000003037147631660250007007 0ustar00/* include/X11/XlibConf.h. Generated from XlibConf.h.in by configure. */ /* * Copyright © 2005 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _XLIBCONF_H_ #define _XLIBCONF_H_ /* * This header file exports defines necessary to correctly * use Xlibint.h both inside Xlib and by external libraries * such as extensions. */ /* Threading support? */ #define XTHREADS 1 /* Use multi-threaded libc functions? */ #define XUSE_MTSAFE_API 1 #endif /* _XLIBCONF_H_ */ X11/PM/PMproto.h000064400000004204147631660250007214 0ustar00/* $Xorg: PMproto.h,v 1.4 2001/02/09 02:05:34 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* Proxy Management Protocol */ #ifndef _PMPROTO_H_ #define _PMPROTO_H_ typedef struct { CARD8 majorOpcode; CARD8 minorOpcode; /* == 1 */ CARD16 authLen B16; CARD32 length B32; /* STRING proxy-service */ /* STRING server-address */ /* STRING host-address */ /* STRING start-options */ /* STRING auth-name (if authLen > 0) */ /* LISTofCARD8 auth-data (if authLen > 0) */ } pmGetProxyAddrMsg; #define sz_pmGetProxyAddrMsg 8 typedef struct { CARD8 majorOpcode; CARD8 minorOpcode; /* == 2 */ CARD8 status; CARD8 unused; CARD32 length B32; /* STRING proxy-address */ /* STRING failure-reason */ } pmGetProxyAddrReplyMsg; #define sz_pmGetProxyAddrReplyMsg 8 typedef struct { CARD8 majorOpcode; CARD8 minorOpcode; /* == 3 */ CARD16 unused B16; CARD32 length B32; /* STRING proxy-service */ } pmStartProxyMsg; #define sz_pmStartProxyMsg 8 #endif /* _PMPROTO_H_ */ X11/PM/PM.h000064400000003207147631660250006132 0ustar00/* $Xorg: PM.h,v 1.4 2001/02/09 02:05:34 xorgcvs Exp $ */ /* Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* Proxy Management Protocol */ #ifndef _PM_H_ #define _PM_H_ #define PM_PROTOCOL_NAME "PROXY_MANAGEMENT" #define PM_MAJOR_VERSION 1 #define PM_MINOR_VERSION 0 /* * PM minor opcodes */ #define PM_Error ICE_Error /* == 0 */ #define PM_GetProxyAddr 1 #define PM_GetProxyAddrReply 2 #define PM_StartProxy 3 /* * status return codes for GetProxyAddrReply */ #define PM_Unable 0 #define PM_Success 1 #define PM_Failure 2 #endif /* _PM_H_ */ X11/Xos_r.h000064400000101635147631660250006400 0ustar00/* Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Various and sundry Thread-Safe functions used by X11, Motif, and CDE. * * Use this file in MT-safe code where you would have included * for readdir() * for getgrgid() or getgrnam() * for gethostbyname(), gethostbyaddr(), or getservbyname() * for getpwnam() or getpwuid() * for strtok() * for asctime(), ctime(), localtime(), or gmtime() * for getlogin() or ttyname() * or their thread-safe analogs. * * If you are on a platform that defines XTHREADS but does not have * MT-safe system API (e.g. UnixWare) you must define _Xos_processLock * and _Xos_processUnlock macros before including this header. * * For convenience XOS_USE_XLIB_LOCKING or XOS_USE_XT_LOCKING may be defined * to obtain either Xlib-only or Xt-based versions of these macros. These * macros won't result in truly thread-safe calls, but they are better than * nothing. If you do not want locking in this situation define * XOS_USE_NO_LOCKING. * * NOTE: On systems lacking appropriate _r functions Gethostbyname(), * Gethostbyaddr(), and Getservbyname() do NOT copy the host or * protocol lists! * * NOTE: On systems lacking appropriate _r functions Getgrgid() and * Getgrnam() do NOT copy the list of group members! * * This header is nominally intended to simplify porting X11, Motif, and * CDE; it may be useful to other people too. The structure below is * complicated, mostly because P1003.1c (the IEEE POSIX Threads spec) * went through lots of drafts, and some vendors shipped systems based * on draft API that were changed later. Unfortunately POSIX did not * provide a feature-test macro for distinguishing each of the drafts. */ /* * This header has several parts. Search for "Effective prototypes" * to locate the beginning of a section. */ /* This header can be included multiple times with different defines! */ #ifndef _XOS_R_H_ # define _XOS_R_H_ # include # include # ifndef X_NOT_POSIX # ifdef _POSIX_SOURCE # include # else # define _POSIX_SOURCE # include # undef _POSIX_SOURCE # endif # ifndef LINE_MAX # define X_LINE_MAX 2048 # else # define X_LINE_MAX LINE_MAX # endif # endif #endif /* _XOS_R_H */ #ifndef WIN32 #ifdef __cplusplus extern "C" { #endif # if defined(XOS_USE_XLIB_LOCKING) # ifndef XAllocIDs /* Xlibint.h does not have multiple include protection */ typedef struct _LockInfoRec *LockInfoPtr; extern LockInfoPtr _Xglobal_lock; # endif # ifndef _Xos_isThreadInitialized # define _Xos_isThreadInitialized (_Xglobal_lock) # endif # if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) # ifndef XAllocIDs /* Xlibint.h does not have multiple include protection */ # include /* for NeedFunctionPrototypes */ extern void (*_XLockMutex_fn)( # if NeedFunctionPrototypes LockInfoPtr /* lock */, char * /* file */, int /* line */ # endif ); extern void (*_XUnlockMutex_fn)( # if NeedFunctionPrototypes LockInfoPtr /* lock */, char * /* file */, int /* line */ # endif ); # endif # ifndef _Xos_processLock # define _Xos_processLock \ (_XLockMutex_fn ? (*_XLockMutex_fn)(_Xglobal_lock,__FILE__,__LINE__) : 0) # endif # ifndef _Xos_processUnlock # define _Xos_processUnlock \ (_XUnlockMutex_fn ? (*_XUnlockMutex_fn)(_Xglobal_lock,__FILE__,__LINE__) : 0) # endif # else # ifndef XAllocIDs /* Xlibint.h does not have multiple include protection */ # include /* for NeedFunctionPrototypes */ extern void (*_XLockMutex_fn)( # if NeedFunctionPrototypes LockInfoPtr /* lock */ # endif ); extern void (*_XUnlockMutex_fn)( # if NeedFunctionPrototypes LockInfoPtr /* lock */ # endif ); # endif # ifndef _Xos_processLock # define _Xos_processLock \ (_XLockMutex_fn ? ((*_XLockMutex_fn)(_Xglobal_lock), 0) : 0) # endif # ifndef _Xos_processUnlock # define _Xos_processUnlock \ (_XUnlockMutex_fn ? ((*_XUnlockMutex_fn)(_Xglobal_lock), 0) : 0) # endif # endif # elif defined(XOS_USE_XT_LOCKING) # ifndef _XtThreadsI_h extern void (*_XtProcessLock)(void); # endif # ifndef _XtintrinsicP_h # include /* for NeedFunctionPrototypes */ extern void XtProcessLock( # if NeedFunctionPrototypes void # endif ); extern void XtProcessUnlock( # if NeedFunctionPrototypes void # endif ); # endif # ifndef _Xos_isThreadInitialized # define _Xos_isThreadInitialized _XtProcessLock # endif # ifndef _Xos_processLock # define _Xos_processLock XtProcessLock() # endif # ifndef _Xos_processUnlock # define _Xos_processUnlock XtProcessUnlock() # endif # elif defined(XOS_USE_NO_LOCKING) # ifndef _Xos_isThreadInitialized # define _Xos_isThreadInitialized 0 # endif # ifndef _Xos_processLock # define _Xos_processLock 0 # endif # ifndef _Xos_processUnlock # define _Xos_processUnlock 0 # endif # endif #endif /* !defined WIN32 */ /* * Solaris defines the POSIX thread-safe feature test macro, but * uses the older SVR4 thread-safe functions unless the POSIX ones * are specifically requested. Fix the feature test macro. */ #if defined(__sun) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && \ (_POSIX_C_SOURCE - 0 < 199506L) && !defined(_POSIX_PTHREAD_SEMANTICS) # undef _POSIX_THREAD_SAFE_FUNCTIONS #endif /***** wrappers *****/ /* * Effective prototypes for wrappers: * * #define X_INCLUDE_PWD_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xgetpwparams; * * struct passwd* _XGetpwnam(const char *name, _Xgetpwparams); * struct passwd* _XGetpwuid(uid_t uid, _Xgetpwparams); */ #if defined(X_INCLUDE_PWD_H) && !defined(_XOS_INCLUDED_PWD_H) # include # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_PWDAPI) # define XOS_USE_MTSAFE_PWDAPI 1 # endif #endif #undef X_NEEDS_PWPARAMS #if !defined(X_INCLUDE_PWD_H) || defined(_XOS_INCLUDED_PWD_H) /* Do nothing */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ # if defined(X_NOT_POSIX) && !defined(__i386__) && !defined(SYSV) extern struct passwd *getpwuid(), *getpwnam(); # endif typedef int _Xgetpwparams; /* dummy */ # define _XGetpwuid(u,p) getpwuid((u)) # define _XGetpwnam(u,p) getpwnam((u)) #elif !defined(XOS_USE_MTSAFE_PWDAPI) || defined(XNO_MTSAFE_PWDAPI) /* UnixWare 2.0, or other systems with thread support but no _r API. */ # define X_NEEDS_PWPARAMS typedef struct { struct passwd pws; char pwbuf[1024]; struct passwd* pwp; size_t len; } _Xgetpwparams; /* * NetBSD and FreeBSD, at least, are missing several of the unixware passwd * fields. */ #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ defined(__APPLE__) || defined(__DragonFly__) static __inline__ void _Xpw_copyPasswd(_Xgetpwparams p) { memcpy(&(p).pws, (p).pwp, sizeof(struct passwd)); (p).pws.pw_name = (p).pwbuf; (p).len = strlen((p).pwp->pw_name); strcpy((p).pws.pw_name, (p).pwp->pw_name); (p).pws.pw_passwd = (p).pws.pw_name + (p).len + 1; (p).len = strlen((p).pwp->pw_passwd); strcpy((p).pws.pw_passwd,(p).pwp->pw_passwd); (p).pws.pw_class = (p).pws.pw_passwd + (p).len + 1; (p).len = strlen((p).pwp->pw_class); strcpy((p).pws.pw_class, (p).pwp->pw_class); (p).pws.pw_gecos = (p).pws.pw_class + (p).len + 1; (p).len = strlen((p).pwp->pw_gecos); strcpy((p).pws.pw_gecos, (p).pwp->pw_gecos); (p).pws.pw_dir = (p).pws.pw_gecos + (p).len + 1; (p).len = strlen((p).pwp->pw_dir); strcpy((p).pws.pw_dir, (p).pwp->pw_dir); (p).pws.pw_shell = (p).pws.pw_dir + (p).len + 1; (p).len = strlen((p).pwp->pw_shell); strcpy((p).pws.pw_shell, (p).pwp->pw_shell); (p).pwp = &(p).pws; } #else # define _Xpw_copyPasswd(p) \ (memcpy(&(p).pws, (p).pwp, sizeof(struct passwd)), \ ((p).pws.pw_name = (p).pwbuf), \ ((p).len = strlen((p).pwp->pw_name)), \ strcpy((p).pws.pw_name, (p).pwp->pw_name), \ ((p).pws.pw_passwd = (p).pws.pw_name + (p).len + 1), \ ((p).len = strlen((p).pwp->pw_passwd)), \ strcpy((p).pws.pw_passwd,(p).pwp->pw_passwd), \ ((p).pws.pw_age = (p).pws.pw_passwd + (p).len + 1), \ ((p).len = strlen((p).pwp->pw_age)), \ strcpy((p).pws.pw_age, (p).pwp->pw_age), \ ((p).pws.pw_comment = (p).pws.pw_age + (p).len + 1), \ ((p).len = strlen((p).pwp->pw_comment)), \ strcpy((p).pws.pw_comment, (p).pwp->pw_comment), \ ((p).pws.pw_gecos = (p).pws.pw_comment + (p).len + 1), \ ((p).len = strlen((p).pwp->pw_gecos)), \ strcpy((p).pws.pw_gecos, (p).pwp->pw_gecos), \ ((p).pws.pw_dir = (p).pws.pw_comment + (p).len + 1), \ ((p).len = strlen((p).pwp->pw_dir)), \ strcpy((p).pws.pw_dir, (p).pwp->pw_dir), \ ((p).pws.pw_shell = (p).pws.pw_dir + (p).len + 1), \ ((p).len = strlen((p).pwp->pw_shell)), \ strcpy((p).pws.pw_shell, (p).pwp->pw_shell), \ ((p).pwp = &(p).pws), \ 0 ) #endif # define _XGetpwuid(u,p) \ ( (_Xos_processLock), \ (((p).pwp = getpwuid((u))) ? _Xpw_copyPasswd(p), 0 : 0), \ (_Xos_processUnlock), \ (p).pwp ) # define _XGetpwnam(u,p) \ ( (_Xos_processLock), \ (((p).pwp = getpwnam((u))) ? _Xpw_copyPasswd(p), 0 : 0), \ (_Xos_processUnlock), \ (p).pwp ) #elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(__APPLE__) # define X_NEEDS_PWPARAMS typedef struct { struct passwd pws; char pwbuf[X_LINE_MAX]; } _Xgetpwparams; # if defined(_POSIX_REENTRANT_FUNCTIONS) || !defined(SVR4) # define _XGetpwuid(u,p) \ ((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) # define _XGetpwnam(u,p) \ ((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) # else /* SVR4 */ # define _XGetpwuid(u,p) \ ((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == NULL) ? NULL : &(p).pws) # define _XGetpwnam(u,p) \ ((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == NULL) ? NULL : &(p).pws) # endif /* SVR4 */ #else /* _POSIX_THREAD_SAFE_FUNCTIONS */ # define X_NEEDS_PWPARAMS typedef struct { struct passwd pws; char pwbuf[X_LINE_MAX]; struct passwd* pwp; } _Xgetpwparams; typedef int _Xgetpwret; # define _XGetpwuid(u,p) \ ((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf),&(p).pwp) == 0) ? \ (p).pwp : NULL) # define _XGetpwnam(u,p) \ ((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf),&(p).pwp) == 0) ? \ (p).pwp : NULL) #endif /* X_INCLUDE_PWD_H */ #if defined(X_INCLUDE_PWD_H) && !defined(_XOS_INCLUDED_PWD_H) # define _XOS_INCLUDED_PWD_H #endif /***** wrappers *****/ /* * Effective prototypes for wrappers: * * NOTE: On systems lacking the appropriate _r functions Gethostbyname(), * Gethostbyaddr(), and Getservbyname() do NOT copy the host or * protocol lists! * * #define X_INCLUDE_NETDB_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xgethostbynameparams; * typedef ... _Xgetservbynameparams; * * struct hostent* _XGethostbyname(const char* name,_Xgethostbynameparams); * struct hostent* _XGethostbyaddr(const char* addr, int len, int type, * _Xgethostbynameparams); * struct servent* _XGetservbyname(const char* name, const char* proto, * _Xgetservbynameparams); */ #undef XTHREADS_NEEDS_BYNAMEPARAMS #if defined(X_INCLUDE_NETDB_H) && !defined(_XOS_INCLUDED_NETDB_H) \ && !defined(WIN32) # include # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_NETDBAPI) # define XOS_USE_MTSAFE_NETDBAPI 1 # endif #endif #if !defined(X_INCLUDE_NETDB_H) || defined(_XOS_INCLUDED_NETDB_H) /* Do nothing. */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ typedef int _Xgethostbynameparams; /* dummy */ typedef int _Xgetservbynameparams; /* dummy */ # define _XGethostbyname(h,hp) gethostbyname((h)) # define _XGethostbyaddr(a,al,t,hp) gethostbyaddr((a),(al),(t)) # define _XGetservbyname(s,p,sp) getservbyname((s),(p)) #elif !defined(XOS_USE_MTSAFE_NETDBAPI) || defined(XNO_MTSAFE_NETDBAPI) /* WARNING: The h_addr_list and s_aliases values are *not* copied! */ #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) #include #endif typedef struct { struct hostent hent; char h_name[MAXHOSTNAMELEN]; struct hostent *hptr; } _Xgethostbynameparams; typedef struct { struct servent sent; char s_name[255]; char s_proto[255]; struct servent *sptr; } _Xgetservbynameparams; # define XTHREADS_NEEDS_BYNAMEPARAMS # define _Xg_copyHostent(hp) \ (memcpy(&(hp).hent, (hp).hptr, sizeof(struct hostent)), \ strcpy((hp).h_name, (hp).hptr->h_name), \ ((hp).hent.h_name = (hp).h_name), \ ((hp).hptr = &(hp).hent), \ 0 ) # define _Xg_copyServent(sp) \ (memcpy(&(sp).sent, (sp).sptr, sizeof(struct servent)), \ strcpy((sp).s_name, (sp).sptr->s_name), \ ((sp).sent.s_name = (sp).s_name), \ strcpy((sp).s_proto, (sp).sptr->s_proto), \ ((sp).sent.s_proto = (sp).s_proto), \ ((sp).sptr = &(sp).sent), \ 0 ) # define _XGethostbyname(h,hp) \ ((_Xos_processLock), \ (((hp).hptr = gethostbyname((h))) ? _Xg_copyHostent(hp) : 0), \ (_Xos_processUnlock), \ (hp).hptr ) # define _XGethostbyaddr(a,al,t,hp) \ ((_Xos_processLock), \ (((hp).hptr = gethostbyaddr((a),(al),(t))) ? _Xg_copyHostent(hp) : 0), \ (_Xos_processUnlock), \ (hp).hptr ) # define _XGetservbyname(s,p,sp) \ ((_Xos_processLock), \ (((sp).sptr = getservbyname((s),(p))) ? _Xg_copyServent(sp) : 0), \ (_Xos_processUnlock), \ (sp).sptr ) #elif defined(XUSE_NETDB_R_API) /* * POSIX does not specify _r equivalents for API, but some * vendors provide them anyway. Use them only when explicitly asked. */ # ifdef _POSIX_REENTRANT_FUNCTIONS # ifndef _POSIX_THREAD_SAFE_FUNCTIONS # endif # endif # ifdef _POSIX_THREAD_SAFE_FUNCTIONS # define X_POSIX_THREAD_SAFE_FUNCTIONS 1 # endif # define XTHREADS_NEEDS_BYNAMEPARAMS # ifndef X_POSIX_THREAD_SAFE_FUNCTIONS typedef struct { struct hostent hent; char hbuf[X_LINE_MAX]; int herr; } _Xgethostbynameparams; typedef struct { struct servent sent; char sbuf[X_LINE_MAX]; } _Xgetservbynameparams; # define _XGethostbyname(h,hp) \ gethostbyname_r((h),&(hp).hent,(hp).hbuf,sizeof((hp).hbuf),&(hp).herr) # define _XGethostbyaddr(a,al,t,hp) \ gethostbyaddr_r((a),(al),(t),&(hp).hent,(hp).hbuf,sizeof((hp).hbuf),&(hp).herr) # define _XGetservbyname(s,p,sp) \ getservbyname_r((s),(p),&(sp).sent,(sp).sbuf,sizeof((sp).sbuf)) # else typedef struct { struct hostent hent; struct hostent_data hdata; } _Xgethostbynameparams; typedef struct { struct servent sent; struct servent_data sdata; } _Xgetservbynameparams; # define _XGethostbyname(h,hp) \ (bzero((char*)&(hp).hdata,sizeof((hp).hdata)), \ ((gethostbyname_r((h),&(hp).hent,&(hp).hdata) == -1) ? NULL : &(hp).hent)) # define _XGethostbyaddr(a,al,t,hp) \ (bzero((char*)&(hp).hdata,sizeof((hp).hdata)), \ ((gethostbyaddr_r((a),(al),(t),&(hp).hent,&(hp).hdata) == -1) ? NULL : &(hp).hent)) # define _XGetservbyname(s,p,sp) \ (bzero((char*)&(sp).sdata,sizeof((sp).sdata)), \ ((getservbyname_r((s),(p),&(sp).sent,&(sp).sdata) == -1) ? NULL : &(sp).sent) ) # endif # ifdef X_POSIX_THREAD_SAFE_FUNCTIONS # undef X_POSIX_THREAD_SAFE_FUNCTIONS # endif #else /* The regular API is assumed to be MT-safe under POSIX. */ typedef int _Xgethostbynameparams; /* dummy */ typedef int _Xgetservbynameparams; /* dummy */ # define _XGethostbyname(h,hp) gethostbyname((h)) # define _XGethostbyaddr(a,al,t,hp) gethostbyaddr((a),(al),(t)) # define _XGetservbyname(s,p,sp) getservbyname((s),(p)) #endif /* X_INCLUDE_NETDB_H */ #if defined(X_INCLUDE_NETDB_H) && !defined(_XOS_INCLUDED_NETDB_H) # define _XOS_INCLUDED_NETDB_H #endif /***** wrappers *****/ /* * Effective prototypes for wrappers: * * #define X_INCLUDE_DIRENT_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xreaddirparams; * * struct dirent *_XReaddir(DIR *dir_pointer, _Xreaddirparams); */ #if defined(X_INCLUDE_DIRENT_H) && !defined(_XOS_INCLUDED_DIRENT_H) # include # if !defined(X_NOT_POSIX) || defined(SYSV) # include # else # include # ifndef dirent # define dirent direct # endif # endif # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_DIRENTAPI) # define XOS_USE_MTSAFE_DIRENTAPI 1 # endif #endif #if !defined(X_INCLUDE_DIRENT_H) || defined(_XOS_INCLUDED_DIRENT_H) /* Do nothing. */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ typedef int _Xreaddirparams; /* dummy */ # define _XReaddir(d,p) readdir(d) #elif !defined(XOS_USE_MTSAFE_DIRENTAPI) || defined(XNO_MTSAFE_DIRENTAPI) /* Systems with thread support but no _r API. */ typedef struct { struct dirent *result; struct dirent dir_entry; # ifdef _POSIX_PATH_MAX char buf[_POSIX_PATH_MAX]; # elif defined(NAME_MAX) char buf[NAME_MAX]; # else char buf[255]; # endif } _Xreaddirparams; # define _XReaddir(d,p) \ ( (_Xos_processLock), \ (((p).result = readdir((d))) ? \ (memcpy(&((p).dir_entry), (p).result, (p).result->d_reclen), \ ((p).result = &(p).dir_entry), 0) : \ 0), \ (_Xos_processUnlock), \ (p).result ) #else typedef struct { struct dirent *result; struct dirent dir_entry; # ifdef _POSIX_PATH_MAX char buf[_POSIX_PATH_MAX]; # elif defined(NAME_MAX) char buf[NAME_MAX]; # else char buf[255]; # endif } _Xreaddirparams; # if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(__APPLE__) /* POSIX final API, returns (int)0 on success. */ # define _XReaddir(d,p) \ (readdir_r((d), &((p).dir_entry), &((p).result)) ? NULL : (p).result) # elif defined(_POSIX_REENTRANT_FUNCTIONS) /* POSIX draft API, returns (int)0 on success. */ # define _XReaddir(d,p) \ (readdir_r((d),&((p).dir_entry)) ? NULL : &((p).dir_entry)) # elif defined(SVR4) /* Pre-POSIX API, returns non-NULL on success. */ # define _XReaddir(d,p) (readdir_r((d), &(p).dir_entry)) # else /* We have no idea what is going on. Fake it all using process locks. */ # define _XReaddir(d,p) \ ( (_Xos_processLock), \ (((p).result = readdir((d))) ? \ (memcpy(&((p).dir_entry), (p).result, (p).result->d_reclen), \ ((p).result = &(p).dir_entry), 0) : \ 0), \ (_Xos_processUnlock), \ (p).result ) # endif #endif /* X_INCLUDE_DIRENT_H */ #if defined(X_INCLUDE_DIRENT_H) && !defined(_XOS_INCLUDED_DIRENT_H) # define _XOS_INCLUDED_DIRENT_H #endif /***** wrappers *****/ /* * Effective prototypes for wrappers: * * #define X_INCLUDE_UNISTD_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xgetloginparams; * typedef ... _Xttynameparams; * * char *_XGetlogin(_Xgetloginparams); * char *_XTtyname(int, _Xttynameparams); */ #if defined(X_INCLUDE_UNISTD_H) && !defined(_XOS_INCLUDED_UNISTD_H) /* already included by */ # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_UNISTDAPI) # define XOS_USE_MTSAFE_UNISTDAPI 1 # endif #endif #if !defined(X_INCLUDE_UNISTD_H) || defined(_XOS_INCLUDED_UNISTD_H) /* Do nothing. */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ typedef int _Xgetloginparams; /* dummy */ typedef int _Xttynameparams; /* dummy */ # define _XGetlogin(p) getlogin() # define _XTtyname(f) ttyname((f)) #elif !defined(XOS_USE_MTSAFE_UNISTDAPI) || defined(XNO_MTSAFE_UNISTDAPI) /* Systems with thread support but no _r API. */ typedef struct { char *result; # if defined(MAXLOGNAME) char buf[MAXLOGNAME]; # elif defined(LOGIN_NAME_MAX) char buf[LOGIN_NAME_MAX]; # else char buf[64]; # endif } _Xgetloginparams; typedef struct { char *result; # ifdef TTY_NAME_MAX char buf[TTY_NAME_MAX]; # elif defined(_POSIX_TTY_NAME_MAX) char buf[_POSIX_TTY_NAME_MAX]; # elif defined(_POSIX_PATH_MAX) char buf[_POSIX_PATH_MAX]; # else char buf[256]; # endif } _Xttynameparams; # define _XGetlogin(p) \ ( (_Xos_processLock), \ (((p).result = getlogin()) ? \ (strncpy((p).buf, (p).result, sizeof((p).buf)), \ ((p).buf[sizeof((p).buf)-1] = '\0'), \ ((p).result = (p).buf), 0) : 0), \ (_Xos_processUnlock), \ (p).result ) #define _XTtyname(f,p) \ ( (_Xos_processLock), \ (((p).result = ttyname(f)) ? \ (strncpy((p).buf, (p).result, sizeof((p).buf)), \ ((p).buf[sizeof((p).buf)-1] = '\0'), \ ((p).result = (p).buf), 0) : 0), \ (_Xos_processUnlock), \ (p).result ) #elif defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_POSIX_REENTRANT_FUNCTIONS) /* POSIX API. * * extern int getlogin_r(char *, size_t); * extern int ttyname_r(int, char *, size_t); */ typedef struct { # if defined(MAXLOGNAME) char buf[MAXLOGNAME]; # elif defined(LOGIN_NAME_MAX) char buf[LOGIN_NAME_MAX]; # else char buf[64]; # endif } _Xgetloginparams; typedef struct { # ifdef TTY_NAME_MAX char buf[TTY_NAME_MAX]; # elif defined(_POSIX_TTY_NAME_MAX) char buf[_POSIX_TTY_NAME_MAX]; # elif defined(_POSIX_PATH_MAX) char buf[_POSIX_PATH_MAX]; # else char buf[256]; # endif } _Xttynameparams; # define _XGetlogin(p) (getlogin_r((p).buf, sizeof((p).buf)) ? NULL : (p).buf) # define _XTtyname(f,p) \ (ttyname_r((f), (p).buf, sizeof((p).buf)) ? NULL : (p).buf) #else /* Pre-POSIX API. * * extern char *getlogin_r(char *, size_t); * extern char *ttyname_r(int, char *, size_t); */ typedef struct { # if defined(MAXLOGNAME) char buf[MAXLOGNAME]; # elif defined(LOGIN_NAME_MAX) char buf[LOGIN_NAME_MAX]; # else char buf[64]; # endif } _Xgetloginparams; typedef struct { # ifdef TTY_NAME_MAX char buf[TTY_NAME_MAX]; # elif defined(_POSIX_TTY_NAME_MAX) char buf[_POSIX_TTY_NAME_MAX]; # elif defined(_POSIX_PATH_MAX) char buf[_POSIX_PATH_MAX]; # else char buf[256]; # endif } _Xttynameparams; # define _XGetlogin(p) getlogin_r((p).buf, sizeof((p).buf)) # define _XTtyname(f,p) ttyname_r((f), (p).buf, sizeof((p).buf)) #endif /* X_INCLUDE_UNISTD_H */ #if defined(X_INCLUDE_UNISTD_H) && !defined(_XOS_INCLUDED_UNISTD_H) # define _XOS_INCLUDED_UNISTD_H #endif /***** wrappers *****/ /* * Effective prototypes for wrappers: * * #define X_INCLUDE_STRING_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xstrtokparams; * * char *_XStrtok(char *, const char*, _Xstrtokparams); */ #if defined(X_INCLUDE_STRING_H) && !defined(_XOS_INCLUDED_STRING_H) /* has already been included by */ # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_STRINGAPI) # define XOS_USE_MTSAFE_STRINGAPI 1 # endif #endif #if !defined(X_INCLUDE_STRING_H) || defined(_XOS_INCLUDED_STRING_H) /* Do nothing. */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ typedef int _Xstrtokparams; /* dummy */ # define _XStrtok(s1,s2,p) \ ( p = 0, (void)p, strtok((s1),(s2)) ) #elif !defined(XOS_USE_MTSAFE_STRINGAPI) || defined(XNO_MTSAFE_STRINGAPI) /* Systems with thread support but no _r API. */ typedef char *_Xstrtokparams; # define _XStrtok(s1,s2,p) \ ( (_Xos_processLock), \ ((p) = strtok((s1),(s2))), \ (_Xos_processUnlock), \ (p) ) #else /* POSIX or pre-POSIX API. */ typedef char * _Xstrtokparams; # define _XStrtok(s1,s2,p) strtok_r((s1),(s2),&(p)) #endif /* X_INCLUDE_STRING_H */ /***** wrappers *****/ /* * Effective prototypes for wrappers: * * #define X_INCLUDE_TIME_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xatimeparams; * typedef ... _Xctimeparams; * typedef ... _Xgtimeparams; * typedef ... _Xltimeparams; * * char *_XAsctime(const struct tm *, _Xatimeparams); * char *_XCtime(const time_t *, _Xctimeparams); * struct tm *_XGmtime(const time_t *, _Xgtimeparams); * struct tm *_XLocaltime(const time_t *, _Xltimeparams); */ #if defined(X_INCLUDE_TIME_H) && !defined(_XOS_INCLUDED_TIME_H) # include # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_TIMEAPI) # define XOS_USE_MTSAFE_TIMEAPI 1 # endif #endif #if !defined(X_INCLUDE_TIME_H) || defined(_XOS_INCLUDED_TIME_H) /* Do nothing. */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ typedef int _Xatimeparams; /* dummy */ # define _XAsctime(t,p) asctime((t)) typedef int _Xctimeparams; /* dummy */ # define _XCtime(t,p) ctime((t)) typedef int _Xgtimeparams; /* dummy */ # define _XGmtime(t,p) gmtime((t)) typedef int _Xltimeparams; /* dummy */ # define _XLocaltime(t,p) localtime((t)) #elif !defined(XOS_USE_MTSAFE_TIMEAPI) || defined(XNO_MTSAFE_TIMEAPI) /* Systems with thread support but no _r API. */ typedef struct { # ifdef TIMELEN char buf[TIMELEN]; # else char buf[26]; # endif char *result; } _Xctimeparams, _Xatimeparams; typedef struct { struct tm buf; struct tm *result; } _Xgtimeparams, _Xltimeparams; # define _XAsctime(t,p) \ ( (_Xos_processLock), \ (((p).result = asctime((t))) ? \ (strncpy((p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \ 0), \ (_Xos_processUnlock), \ (p).result ) # define _XCtime(t,p) \ ( (_Xos_processLock), \ (((p).result = ctime((t))) ? \ (strncpy((p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \ 0), \ (_Xos_processUnlock), \ (p).result ) # define _XGmtime(t,p) \ ( (_Xos_processLock), \ (((p).result = gmtime(t)) ? \ (memcpy(&(p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \ 0), \ (_Xos_processUnlock), \ (p).result ) # define _XLocaltime(t,p) \ ( (_Xos_processLock), \ (((p).result = localtime(t)) ? \ (memcpy(&(p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \ 0), \ (_Xos_processUnlock), \ (p).result ) #elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(hpV4) /* Returns (int)0 on success. * * extern int asctime_r(const struct tm *timeptr, char *buffer, int buflen); * extern int ctime_r(const time_t *timer, char *buffer, int buflen); * extern int gmtime_r(const time_t *timer, struct tm *result); * extern int localtime_r(const time_t *timer, struct tm *result); */ # ifdef TIMELEN typedef char _Xatimeparams[TIMELEN]; typedef char _Xctimeparams[TIMELEN]; # else typedef char _Xatimeparams[26]; typedef char _Xctimeparams[26]; # endif typedef struct tm _Xgtimeparams; typedef struct tm _Xltimeparams; # define _XAsctime(t,p) (asctime_r((t),(p),sizeof((p))) ? NULL : (p)) # define _XCtime(t,p) (ctime_r((t),(p),sizeof((p))) ? NULL : (p)) # define _XGmtime(t,p) (gmtime_r((t),&(p)) ? NULL : &(p)) # define _XLocaltime(t,p) (localtime_r((t),&(p)) ? NULL : &(p)) #elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(__sun) /* Returns NULL on failure. Solaris 2.5 * * extern char *asctime_r(const struct tm *tm,char *buf, int buflen); * extern char *ctime_r(const time_t *clock, char *buf, int buflen); * extern struct tm *gmtime_r(const time_t *clock, struct tm *res); * extern struct tm *localtime_r(const time_t *clock, struct tm *res); */ # ifdef TIMELEN typedef char _Xatimeparams[TIMELEN]; typedef char _Xctimeparams[TIMELEN]; # else typedef char _Xatimeparams[26]; typedef char _Xctimeparams[26]; # endif typedef struct tm _Xgtimeparams; typedef struct tm _Xltimeparams; # define _XAsctime(t,p) asctime_r((t),(p),sizeof((p))) # define _XCtime(t,p) ctime_r((t),(p),sizeof((p))) # define _XGmtime(t,p) gmtime_r((t),&(p)) # define _XLocaltime(t,p) localtime_r((t),&(p)) #else /* defined(_POSIX_THREAD_SAFE_FUNCTIONS) */ /* POSIX final API. * extern char *asctime_r(const struct tm *timeptr, char *buffer); * extern char *ctime_r(const time_t *timer, char *buffer); * extern struct tm *gmtime_r(const time_t *timer, struct tm *result); * extern struct tm *localtime_r(const time_t *timer, struct tm *result); */ # ifdef TIMELEN typedef char _Xatimeparams[TIMELEN]; typedef char _Xctimeparams[TIMELEN]; # else typedef char _Xatimeparams[26]; typedef char _Xctimeparams[26]; # endif typedef struct tm _Xgtimeparams; typedef struct tm _Xltimeparams; # define _XAsctime(t,p) asctime_r((t),(p)) # define _XCtime(t,p) ctime_r((t),(p)) # define _XGmtime(t,p) gmtime_r((t),&(p)) # define _XLocaltime(t,p) localtime_r((t),&(p)) #endif /* X_INCLUDE_TIME_H */ #if defined(X_INCLUDE_TIME_H) && !defined(_XOS_INCLUDED_TIME_H) # define _XOS_INCLUDED_TIME_H #endif /***** wrappers *****/ /* * Effective prototypes for wrappers: * * NOTE: On systems lacking appropriate _r functions Getgrgid() and * Getgrnam() do NOT copy the list of group members! * * Remember that fgetgrent(), setgrent(), getgrent(), and endgrent() * are not included in POSIX. * * #define X_INCLUDE_GRP_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xgetgrparams; * * struct group *_XGetgrgid(gid_t, _Xgetgrparams); * struct group *_XGetgrnam(const char *, _Xgetgrparams); */ #if defined(X_INCLUDE_GRP_H) && !defined(_XOS_INCLUDED_GRP_H) # include # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_GRPAPI) # define XOS_USE_MTSAFE_GRPAPI 1 # endif #endif #if !defined(X_INCLUDE_GRP_H) || defined(_XOS_INCLUDED_GRP_H) /* Do nothing. */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ typedef int _Xgetgrparams; /* dummy */ #define _XGetgrgid(g,p) getgrgid((g)) #define _XGetgrnam(n,p) getgrnam((n)) #elif !defined(XOS_USE_MTSAFE_GRPAPI) || defined(XNO_MTSAFE_GRPAPI) /* Systems with thread support but no _r API. UnixWare 2.0. */ typedef struct { struct group grp; char buf[X_LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ struct group *pgrp; size_t len; } _Xgetgrparams; #ifdef SVR4 /* Copy the gr_passwd field too. */ # define _Xgrp_copyGroup(p) \ ( memcpy(&(p).grp, (p).pgrp, sizeof(struct group)), \ ((p).grp.gr_name = (p).buf), \ ((p).len = strlen((p).pgrp->gr_name)), \ strcpy((p).grp.gr_name, (p).pgrp->gr_name), \ ((p).grp.gr_passwd = (p).grp.gr_name + (p).len + 1), \ ((p).pgrp = &(p).grp), \ 0 ) #else # define _Xgrp_copyGroup(p) \ ( memcpy(&(p).grp, (p).pgrp, sizeof(struct group)), \ ((p).grp.gr_name = (p).buf), \ strcpy((p).grp.gr_name, (p).pgrp->gr_name), \ ((p).pgrp = &(p).grp), \ 0 ) #endif #define _XGetgrgid(g,p) \ ( (_Xos_processLock), \ (((p).pgrp = getgrgid((g))) ? _Xgrp_copyGroup(p) : 0), \ (_Xos_processUnlock), \ (p).pgrp ) #define _XGetgrnam(n,p) \ ( (_Xos_processLock), \ (((p).pgrp = getgrnam((n))) ? _Xgrp_copyGroup(p) : 0), \ (_Xos_processUnlock), \ (p).pgrp ) #elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(__sun) /* Non-POSIX API. Solaris. * * extern struct group *getgrgid_r(gid_t, struct group *, char *, int); * extern struct group *getgrnam_r(const char *, struct group *, char *, int); */ typedef struct { struct group grp; char buf[X_LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ } _Xgetgrparams; #define _XGetgrgid(g,p) getgrgid_r((g), &(p).grp, (p).buf, sizeof((p).buf)) #define _XGetgrnam(n,p) getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf)) #elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) /* Non-POSIX API. * extern int getgrgid_r(gid_t, struct group *, char *, int); * extern int getgrnam_r(const char *, struct group *, char *, int); */ typedef struct { struct group grp; char buf[X_LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ } _Xgetgrparams; #define _XGetgrgid(g,p) \ ((getgrgid_r((g), &(p).grp, (p).buf, sizeof((p).buf)) ? NULL : &(p).grp)) #define _XGetgrnam(n,p) \ ((getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf)) ? NULL : &(p).grp)) #else /* POSIX final API. * * int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **); * int getgrnam_r(const char *, struct group *, char *, size_t, struct group **); */ typedef struct { struct group grp; char buf[X_LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ struct group *result; } _Xgetgrparams; #define _XGetgrgid(g,p) \ ((getgrgid_r((g), &(p).grp, (p).buf, sizeof((p).buf), &(p).result) ? \ NULL : (p).result)) #define _XGetgrnam(n,p) \ ((getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf), &(p).result) ? \ NULL : (p).result)) #endif #if defined(X_INCLUDE_GRP_H) && !defined(_XOS_INCLUDED_GRP_H) # define _XOS_INCLUDED_GRP_H #endif #ifdef __cplusplus } /* Close scope of 'extern "C"' declaration which encloses file. */ #endif X11/Xosdefs.h000064400000006053147631660250006717 0ustar00/* * O/S-dependent (mis)feature macro definitions * Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _XOSDEFS_H_ # define _XOSDEFS_H_ /* * X_NOT_POSIX means does not have POSIX header files. Lack of this * symbol does NOT mean that the POSIX environment is the default. * You may still have to define _POSIX_SOURCE to get it. */ # ifdef _SCO_DS # ifndef __SCO__ # define __SCO__ # endif # endif # ifdef __i386__ # ifdef SYSV # if !defined(__SCO__) && \ !defined(__UNIXWARE__) && !defined(__sun) # if !defined(_POSIX_SOURCE) # define X_NOT_POSIX # endif # endif # endif # endif # ifdef __sun /* Imake configs define SVR4 on Solaris, but cc & gcc only define __SVR4 * This check allows non-Imake configured programs to build correctly. */ # if defined(__SVR4) && !defined(SVR4) # define SVR4 1 # endif # ifdef SVR4 /* define this to whatever it needs to be */ # define X_POSIX_C_SOURCE 199300L # endif # endif # ifdef WIN32 # ifndef _POSIX_ # define X_NOT_POSIX # endif # endif # ifdef __APPLE__ # define NULL_NOT_ZERO /* Defining any of these will sanitize the namespace to JUST want is defined by * that particular standard. If that happens, we don't get some expected * prototypes, typedefs, etc (like fd_mask). We can define _DARWIN_C_SOURCE to * loosen our belts a tad. */ # if defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) # ifndef _DARWIN_C_SOURCE # define _DARWIN_C_SOURCE # endif # endif # endif # ifdef __GNU__ # ifndef PATH_MAX # define PATH_MAX 4096 # endif # ifndef MAXPATHLEN # define MAXPATHLEN 4096 # endif # endif # if defined(__SCO__) || defined(__UNIXWARE__) # ifndef PATH_MAX # define PATH_MAX 1024 # endif # ifndef MAXPATHLEN # define MAXPATHLEN 1024 # endif # endif # if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) \ || defined(__APPLE__) || defined(__DragonFly__) # ifndef CSRG_BASED # define CSRG_BASED # endif # endif #endif /* _XOSDEFS_H_ */ X11/Xatom.h000064400000004726147631660250006401 0ustar00#ifndef XATOM_H #define XATOM_H 1 /* THIS IS A GENERATED FILE * * Do not change! Changing this file implies a protocol change! */ #define XA_PRIMARY ((Atom) 1) #define XA_SECONDARY ((Atom) 2) #define XA_ARC ((Atom) 3) #define XA_ATOM ((Atom) 4) #define XA_BITMAP ((Atom) 5) #define XA_CARDINAL ((Atom) 6) #define XA_COLORMAP ((Atom) 7) #define XA_CURSOR ((Atom) 8) #define XA_CUT_BUFFER0 ((Atom) 9) #define XA_CUT_BUFFER1 ((Atom) 10) #define XA_CUT_BUFFER2 ((Atom) 11) #define XA_CUT_BUFFER3 ((Atom) 12) #define XA_CUT_BUFFER4 ((Atom) 13) #define XA_CUT_BUFFER5 ((Atom) 14) #define XA_CUT_BUFFER6 ((Atom) 15) #define XA_CUT_BUFFER7 ((Atom) 16) #define XA_DRAWABLE ((Atom) 17) #define XA_FONT ((Atom) 18) #define XA_INTEGER ((Atom) 19) #define XA_PIXMAP ((Atom) 20) #define XA_POINT ((Atom) 21) #define XA_RECTANGLE ((Atom) 22) #define XA_RESOURCE_MANAGER ((Atom) 23) #define XA_RGB_COLOR_MAP ((Atom) 24) #define XA_RGB_BEST_MAP ((Atom) 25) #define XA_RGB_BLUE_MAP ((Atom) 26) #define XA_RGB_DEFAULT_MAP ((Atom) 27) #define XA_RGB_GRAY_MAP ((Atom) 28) #define XA_RGB_GREEN_MAP ((Atom) 29) #define XA_RGB_RED_MAP ((Atom) 30) #define XA_STRING ((Atom) 31) #define XA_VISUALID ((Atom) 32) #define XA_WINDOW ((Atom) 33) #define XA_WM_COMMAND ((Atom) 34) #define XA_WM_HINTS ((Atom) 35) #define XA_WM_CLIENT_MACHINE ((Atom) 36) #define XA_WM_ICON_NAME ((Atom) 37) #define XA_WM_ICON_SIZE ((Atom) 38) #define XA_WM_NAME ((Atom) 39) #define XA_WM_NORMAL_HINTS ((Atom) 40) #define XA_WM_SIZE_HINTS ((Atom) 41) #define XA_WM_ZOOM_HINTS ((Atom) 42) #define XA_MIN_SPACE ((Atom) 43) #define XA_NORM_SPACE ((Atom) 44) #define XA_MAX_SPACE ((Atom) 45) #define XA_END_SPACE ((Atom) 46) #define XA_SUPERSCRIPT_X ((Atom) 47) #define XA_SUPERSCRIPT_Y ((Atom) 48) #define XA_SUBSCRIPT_X ((Atom) 49) #define XA_SUBSCRIPT_Y ((Atom) 50) #define XA_UNDERLINE_POSITION ((Atom) 51) #define XA_UNDERLINE_THICKNESS ((Atom) 52) #define XA_STRIKEOUT_ASCENT ((Atom) 53) #define XA_STRIKEOUT_DESCENT ((Atom) 54) #define XA_ITALIC_ANGLE ((Atom) 55) #define XA_X_HEIGHT ((Atom) 56) #define XA_QUAD_WIDTH ((Atom) 57) #define XA_WEIGHT ((Atom) 58) #define XA_POINT_SIZE ((Atom) 59) #define XA_RESOLUTION ((Atom) 60) #define XA_COPYRIGHT ((Atom) 61) #define XA_NOTICE ((Atom) 62) #define XA_FONT_NAME ((Atom) 63) #define XA_FAMILY_NAME ((Atom) 64) #define XA_FULL_NAME ((Atom) 65) #define XA_CAP_HEIGHT ((Atom) 66) #define XA_WM_CLASS ((Atom) 67) #define XA_WM_TRANSIENT_FOR ((Atom) 68) #define XA_LAST_PREDEFINED ((Atom) 68) #endif /* XATOM_H */ X11/Xthreads.h000064400000030153147631660250007064 0ustar00/* * Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * * */ #ifndef _XTHREADS_H_ # define _XTHREADS_H_ /* Redefine these to XtMalloc/XtFree or whatever you want before including * this header file. */ # ifndef xmalloc # define xmalloc malloc # endif # ifndef xfree # define xfree free # endif # ifdef CTHREADS # include typedef cthread_t xthread_t; typedef struct condition xcondition_rec; typedef struct mutex xmutex_rec; # define xthread_init() cthread_init() # define xthread_self cthread_self # define xthread_fork(func,closure) cthread_fork(func,closure) # define xthread_yield() cthread_yield() # define xthread_exit(v) cthread_exit(v) # define xthread_set_name(t,str) cthread_set_name(t,str) # define xmutex_init(m) mutex_init(m) # define xmutex_clear(m) mutex_clear(m) # define xmutex_lock(m) mutex_lock(m) # define xmutex_unlock(m) mutex_unlock(m) # define xmutex_set_name(m,str) mutex_set_name(m,str) # define xcondition_init(cv) condition_init(cv) # define xcondition_clear(cv) condition_clear(cv) # define xcondition_wait(cv,m) condition_wait(cv,m) # define xcondition_signal(cv) condition_signal(cv) # define xcondition_broadcast(cv) condition_broadcast(cv) # define xcondition_set_name(cv,str) condition_set_name(cv,str) # else /* !CTHREADS */ # if defined(SVR4) # include # include typedef thread_t xthread_t; typedef thread_key_t xthread_key_t; typedef cond_t xcondition_rec; typedef mutex_t xmutex_rec; # if defined(__UNIXWARE__) extern xthread_t (*_x11_thr_self)(); # define xthread_self (_x11_thr_self) # else # define xthread_self thr_self # endif # define xthread_fork(func,closure) thr_create(NULL,0,func,closure,THR_NEW_LWP|THR_DETACHED,NULL) # define xthread_yield() thr_yield() # define xthread_exit(v) thr_exit(v) # define xthread_key_create(kp,d) thr_keycreate(kp,d) # ifdef __sun # define xthread_key_delete(k) 0 # else # define xthread_key_delete(k) thr_keydelete(k) # endif # define xthread_set_specific(k,v) thr_setspecific(k,v) # define xthread_get_specific(k,vp) thr_getspecific(k,vp) # define xmutex_init(m) mutex_init(m,USYNC_THREAD,0) # define xmutex_clear(m) mutex_destroy(m) # define xmutex_lock(m) mutex_lock(m) # define xmutex_unlock(m) mutex_unlock(m) # define xcondition_init(cv) cond_init(cv,USYNC_THREAD,0) # define xcondition_clear(cv) cond_destroy(cv) # define xcondition_wait(cv,m) cond_wait(cv,m) # define xcondition_signal(cv) cond_signal(cv) # define xcondition_broadcast(cv) cond_broadcast(cv) # else /* !SVR4 */ # ifdef WIN32 # include typedef DWORD xthread_t; typedef DWORD xthread_key_t; struct _xthread_waiter { HANDLE sem; struct _xthread_waiter *next; }; typedef struct { CRITICAL_SECTION cs; struct _xthread_waiter *waiters; } xcondition_rec; typedef CRITICAL_SECTION xmutex_rec; extern void _Xthread_init(void); # define xthread_init() _Xthread_init() # define xthread_self GetCurrentThreadId # define xthread_fork(func,closure) { \ DWORD _tmptid; \ CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, (LPVOID)closure, 0, \ &_tmptid); \ } # define xthread_yield() Sleep(0) # define xthread_exit(v) ExitThread((DWORD)(v)) # define xthread_key_create(kp,d) *(kp) = TlsAlloc() # define xthread_key_delete(k) TlsFree(k) # define xthread_set_specific(k,v) TlsSetValue(k,v) # define xthread_get_specific(k,vp) TlsGetValue(k) # define xmutex_init(m) InitializeCriticalSection(m) # define xmutex_clear(m) DeleteCriticalSection(m) # define _XMUTEX_NESTS # define xmutex_lock(m) EnterCriticalSection(m) # define xmutex_unlock(m) LeaveCriticalSection(m) # define xcondition_init(cv) { \ InitializeCriticalSection(&(cv)->cs); \ (cv)->waiters = NULL; \ } # define xcondition_clear(cv) DeleteCriticalSection(&(cv)->cs) extern struct _xthread_waiter *_Xthread_waiter(); # define xcondition_wait(cv,m) { \ struct _xthread_waiter *_tmpthr = _Xthread_waiter(); \ EnterCriticalSection(&(cv)->cs); \ _tmpthr->next = (cv)->waiters; \ (cv)->waiters = _tmpthr; \ LeaveCriticalSection(&(cv)->cs); \ LeaveCriticalSection(m); \ WaitForSingleObject(_tmpthr->sem, INFINITE); \ EnterCriticalSection(m); \ } # define xcondition_signal(cv) { \ EnterCriticalSection(&(cv)->cs); \ if ((cv)->waiters) { \ ReleaseSemaphore((cv)->waiters->sem, 1, NULL); \ (cv)->waiters = (cv)->waiters->next; \ } \ LeaveCriticalSection(&(cv)->cs); \ } # define xcondition_broadcast(cv) { \ struct _xthread_waiter *_tmpthr; \ EnterCriticalSection(&(cv)->cs); \ for (_tmpthr = (cv)->waiters; _tmpthr; _tmpthr = _tmpthr->next) \ ReleaseSemaphore(_tmpthr->sem, 1, NULL); \ (cv)->waiters = NULL; \ LeaveCriticalSection(&(cv)->cs); \ } # else /* !WIN32 */ # ifdef USE_TIS_SUPPORT /* * TIS support is intended for thread safe libraries. * This should not be used for general client programming. */ # include typedef pthread_t xthread_t; typedef pthread_key_t xthread_key_t; typedef pthread_cond_t xcondition_rec; typedef pthread_mutex_t xmutex_rec; # define xthread_self tis_self # define xthread_fork(func,closure) { pthread_t _tmpxthr; \ pthread_create(&_tmpxthr,NULL,func,closure); } # define xthread_yield() pthread_yield_np() # define xthread_exit(v) pthread_exit(v) # define xthread_key_create(kp,d) tis_key_create(kp,d) # define xthread_key_delete(k) tis_key_delete(k) # define xthread_set_specific(k,v) tis_setspecific(k,v) # define xthread_get_specific(k,vp) *(vp) = tis_getspecific(k) # define XMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER # define xmutex_init(m) tis_mutex_init(m) # define xmutex_clear(m) tis_mutex_destroy(m) # define xmutex_lock(m) tis_mutex_lock(m) # define xmutex_unlock(m) tis_mutex_unlock(m) # define xcondition_init(c) tis_cond_init(c) # define xcondition_clear(c) tis_cond_destroy(c) # define xcondition_wait(c,m) tis_cond_wait(c,m) # define xcondition_signal(c) tis_cond_signal(c) # define xcondition_broadcast(c) tis_cond_broadcast(c) # else # ifdef USE_NBSD_THREADLIB /* * NetBSD threadlib support is intended for thread safe libraries. * This should not be used for general client programming. */ # include typedef thr_t xthread_t; typedef thread_key_t xthread_key_t; typedef cond_t xcondition_rec; typedef mutex_t xmutex_rec; # define xthread_self thr_self # define xthread_fork(func,closure) { thr_t _tmpxthr; \ /* XXX Create it detached? --thorpej */ \ thr_create(&_tmpxthr,NULL,func,closure); } # define xthread_yield() thr_yield() # define xthread_exit(v) thr_exit(v) # define xthread_key_create(kp,d) thr_keycreate(kp,d) # define xthread_key_delete(k) thr_keydelete(k) # define xthread_set_specific(k,v) thr_setspecific(k,v) # define xthread_get_specific(k,vp) *(vp) = thr_getspecific(k) # define XMUTEX_INITIALIZER MUTEX_INITIALIZER # define xmutex_init(m) mutex_init(m, 0) # define xmutex_clear(m) mutex_destroy(m) # define xmutex_lock(m) mutex_lock(m) # define xmutex_unlock(m) mutex_unlock(m) # define xcondition_init(c) cond_init(c, 0, 0) # define xcondition_clear(c) cond_destroy(c) # define xcondition_wait(c,m) cond_wait(c,m) # define xcondition_signal(c) cond_signal(c) # define xcondition_broadcast(c) cond_broadcast(c) # else # include typedef pthread_t xthread_t; typedef pthread_key_t xthread_key_t; typedef pthread_cond_t xcondition_rec; typedef pthread_mutex_t xmutex_rec; # define xthread_self pthread_self # define xthread_yield() pthread_yield() # define xthread_exit(v) pthread_exit(v) # define xthread_set_specific(k,v) pthread_setspecific(k,v) # define xmutex_clear(m) pthread_mutex_destroy(m) # define xmutex_lock(m) pthread_mutex_lock(m) # define xmutex_unlock(m) pthread_mutex_unlock(m) # ifndef XPRE_STANDARD_API # define xthread_key_create(kp,d) pthread_key_create(kp,d) # define xthread_key_delete(k) pthread_key_delete(k) # define xthread_get_specific(k,vp) *(vp) = pthread_getspecific(k) # define xthread_fork(func,closure) { pthread_t _tmpxthr; \ pthread_create(&_tmpxthr,NULL,func,closure); } # define XMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER # define xmutex_init(m) pthread_mutex_init(m, NULL) # define xcondition_init(c) pthread_cond_init(c, NULL) # else /* XPRE_STANDARD_API */ # define xthread_key_create(kp,d) pthread_keycreate(kp,d) # define xthread_key_delete(k) 0 # define xthread_get_specific(k,vp) pthread_getspecific(k,vp) # define xthread_fork(func,closure) { pthread_t _tmpxthr; \ pthread_create(&_tmpxthr,pthread_attr_default,func,closure); } # define xmutex_init(m) pthread_mutex_init(m, pthread_mutexattr_default) # define xcondition_init(c) pthread_cond_init(c, pthread_condattr_default) # endif /* XPRE_STANDARD_API */ # define xcondition_clear(c) pthread_cond_destroy(c) # define xcondition_wait(c,m) pthread_cond_wait(c,m) # define xcondition_signal(c) pthread_cond_signal(c) # define xcondition_broadcast(c) pthread_cond_broadcast(c) # if defined(_DECTHREADS_) static xthread_t _X_no_thread_id; # define xthread_have_id(id) !pthread_equal(id, _X_no_thread_id) # define xthread_clear_id(id) id = _X_no_thread_id # define xthread_equal(id1,id2) pthread_equal(id1, id2) # endif /* _DECTHREADS_ */ # if defined(__linux__) # define xthread_have_id(id) !pthread_equal(id, 0) # define xthread_clear_id(id) id = 0 # define xthread_equal(id1,id2) pthread_equal(id1, id2) # endif /* linux */ # if defined(_CMA_VENDOR_) && defined(_CMA__IBM) && (_CMA_VENDOR_ == _CMA__IBM) # ifdef DEBUG /* too much of a hack to enable normally */ /* see also cma__obj_set_name() */ # define xmutex_set_name(m,str) ((char**)(m)->field1)[5] = (str) # define xcondition_set_name(cv,str) ((char**)(cv)->field1)[5] = (str) # endif /* DEBUG */ # endif /* _CMA_VENDOR_ == _CMA__IBM */ # endif /* USE_NBSD_THREADLIB */ # endif /* USE_TIS_SUPPORT */ # endif /* WIN32 */ # endif /* SVR4 */ # endif /* CTHREADS */ typedef xcondition_rec *xcondition_t; typedef xmutex_rec *xmutex_t; # ifndef xcondition_malloc # define xcondition_malloc() (xcondition_t)xmalloc(sizeof(xcondition_rec)) # endif # ifndef xcondition_free # define xcondition_free(c) xfree((char *)c) # endif # ifndef xmutex_malloc # define xmutex_malloc() (xmutex_t)xmalloc(sizeof(xmutex_rec)) # endif # ifndef xmutex_free # define xmutex_free(m) xfree((char *)m) # endif # ifndef xthread_have_id # define xthread_have_id(id) id # endif # ifndef xthread_clear_id # define xthread_clear_id(id) id = 0 # endif # ifndef xthread_equal # define xthread_equal(id1,id2) ((id1) == (id2)) # endif /* aids understood by some debuggers */ # ifndef xthread_set_name # define xthread_set_name(t,str) # endif # ifndef xmutex_set_name # define xmutex_set_name(m,str) # endif # ifndef xcondition_set_name # define xcondition_set_name(cv,str) # endif #endif /* _XTHREADS_H_ */ X11/X.h000064400000047355147631660250005525 0ustar00/* Definitions for the X window system likely to be used by applications */ #ifndef X_H #define X_H /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #define X_PROTOCOL 11 /* current protocol version */ #define X_PROTOCOL_REVISION 0 /* current minor version */ /* Resources */ /* * _XSERVER64 must ONLY be defined when compiling X server sources on * systems where unsigned long is not 32 bits, must NOT be used in * client or library code. */ #ifndef _XSERVER64 # ifndef _XTYPEDEF_XID # define _XTYPEDEF_XID typedef unsigned long XID; # endif # ifndef _XTYPEDEF_MASK # define _XTYPEDEF_MASK typedef unsigned long Mask; # endif # ifndef _XTYPEDEF_ATOM # define _XTYPEDEF_ATOM typedef unsigned long Atom; /* Also in Xdefs.h */ # endif typedef unsigned long VisualID; typedef unsigned long Time; #else # include # ifndef _XTYPEDEF_XID # define _XTYPEDEF_XID typedef CARD32 XID; # endif # ifndef _XTYPEDEF_MASK # define _XTYPEDEF_MASK typedef CARD32 Mask; # endif # ifndef _XTYPEDEF_ATOM # define _XTYPEDEF_ATOM typedef CARD32 Atom; # endif typedef CARD32 VisualID; typedef CARD32 Time; #endif typedef XID Window; typedef XID Drawable; #ifndef _XTYPEDEF_FONT # define _XTYPEDEF_FONT typedef XID Font; #endif typedef XID Pixmap; typedef XID Cursor; typedef XID Colormap; typedef XID GContext; typedef XID KeySym; typedef unsigned char KeyCode; /***************************************************************** * RESERVED RESOURCE AND CONSTANT DEFINITIONS *****************************************************************/ #ifndef None #define None 0L /* universal null resource or null atom */ #endif #define ParentRelative 1L /* background pixmap in CreateWindow and ChangeWindowAttributes */ #define CopyFromParent 0L /* border pixmap in CreateWindow and ChangeWindowAttributes special VisualID and special window class passed to CreateWindow */ #define PointerWindow 0L /* destination window in SendEvent */ #define InputFocus 1L /* destination window in SendEvent */ #define PointerRoot 1L /* focus window in SetInputFocus */ #define AnyPropertyType 0L /* special Atom, passed to GetProperty */ #define AnyKey 0L /* special Key Code, passed to GrabKey */ #define AnyButton 0L /* special Button Code, passed to GrabButton */ #define AllTemporary 0L /* special Resource ID passed to KillClient */ #define CurrentTime 0L /* special Time */ #define NoSymbol 0L /* special KeySym */ /***************************************************************** * EVENT DEFINITIONS *****************************************************************/ /* Input Event Masks. Used as event-mask window attribute and as arguments to Grab requests. Not to be confused with event names. */ #define NoEventMask 0L #define KeyPressMask (1L<<0) #define KeyReleaseMask (1L<<1) #define ButtonPressMask (1L<<2) #define ButtonReleaseMask (1L<<3) #define EnterWindowMask (1L<<4) #define LeaveWindowMask (1L<<5) #define PointerMotionMask (1L<<6) #define PointerMotionHintMask (1L<<7) #define Button1MotionMask (1L<<8) #define Button2MotionMask (1L<<9) #define Button3MotionMask (1L<<10) #define Button4MotionMask (1L<<11) #define Button5MotionMask (1L<<12) #define ButtonMotionMask (1L<<13) #define KeymapStateMask (1L<<14) #define ExposureMask (1L<<15) #define VisibilityChangeMask (1L<<16) #define StructureNotifyMask (1L<<17) #define ResizeRedirectMask (1L<<18) #define SubstructureNotifyMask (1L<<19) #define SubstructureRedirectMask (1L<<20) #define FocusChangeMask (1L<<21) #define PropertyChangeMask (1L<<22) #define ColormapChangeMask (1L<<23) #define OwnerGrabButtonMask (1L<<24) /* Event names. Used in "type" field in XEvent structures. Not to be confused with event masks above. They start from 2 because 0 and 1 are reserved in the protocol for errors and replies. */ #define KeyPress 2 #define KeyRelease 3 #define ButtonPress 4 #define ButtonRelease 5 #define MotionNotify 6 #define EnterNotify 7 #define LeaveNotify 8 #define FocusIn 9 #define FocusOut 10 #define KeymapNotify 11 #define Expose 12 #define GraphicsExpose 13 #define NoExpose 14 #define VisibilityNotify 15 #define CreateNotify 16 #define DestroyNotify 17 #define UnmapNotify 18 #define MapNotify 19 #define MapRequest 20 #define ReparentNotify 21 #define ConfigureNotify 22 #define ConfigureRequest 23 #define GravityNotify 24 #define ResizeRequest 25 #define CirculateNotify 26 #define CirculateRequest 27 #define PropertyNotify 28 #define SelectionClear 29 #define SelectionRequest 30 #define SelectionNotify 31 #define ColormapNotify 32 #define ClientMessage 33 #define MappingNotify 34 #define GenericEvent 35 #define LASTEvent 36 /* must be bigger than any event # */ /* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer, state in various key-, mouse-, and button-related events. */ #define ShiftMask (1<<0) #define LockMask (1<<1) #define ControlMask (1<<2) #define Mod1Mask (1<<3) #define Mod2Mask (1<<4) #define Mod3Mask (1<<5) #define Mod4Mask (1<<6) #define Mod5Mask (1<<7) /* modifier names. Used to build a SetModifierMapping request or to read a GetModifierMapping request. These correspond to the masks defined above. */ #define ShiftMapIndex 0 #define LockMapIndex 1 #define ControlMapIndex 2 #define Mod1MapIndex 3 #define Mod2MapIndex 4 #define Mod3MapIndex 5 #define Mod4MapIndex 6 #define Mod5MapIndex 7 /* button masks. Used in same manner as Key masks above. Not to be confused with button names below. */ #define Button1Mask (1<<8) #define Button2Mask (1<<9) #define Button3Mask (1<<10) #define Button4Mask (1<<11) #define Button5Mask (1<<12) #define AnyModifier (1<<15) /* used in GrabButton, GrabKey */ /* button names. Used as arguments to GrabButton and as detail in ButtonPress and ButtonRelease events. Not to be confused with button masks above. Note that 0 is already defined above as "AnyButton". */ #define Button1 1 #define Button2 2 #define Button3 3 #define Button4 4 #define Button5 5 /* Notify modes */ #define NotifyNormal 0 #define NotifyGrab 1 #define NotifyUngrab 2 #define NotifyWhileGrabbed 3 #define NotifyHint 1 /* for MotionNotify events */ /* Notify detail */ #define NotifyAncestor 0 #define NotifyVirtual 1 #define NotifyInferior 2 #define NotifyNonlinear 3 #define NotifyNonlinearVirtual 4 #define NotifyPointer 5 #define NotifyPointerRoot 6 #define NotifyDetailNone 7 /* Visibility notify */ #define VisibilityUnobscured 0 #define VisibilityPartiallyObscured 1 #define VisibilityFullyObscured 2 /* Circulation request */ #define PlaceOnTop 0 #define PlaceOnBottom 1 /* protocol families */ #define FamilyInternet 0 /* IPv4 */ #define FamilyDECnet 1 #define FamilyChaos 2 #define FamilyInternet6 6 /* IPv6 */ /* authentication families not tied to a specific protocol */ #define FamilyServerInterpreted 5 /* Property notification */ #define PropertyNewValue 0 #define PropertyDelete 1 /* Color Map notification */ #define ColormapUninstalled 0 #define ColormapInstalled 1 /* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes */ #define GrabModeSync 0 #define GrabModeAsync 1 /* GrabPointer, GrabKeyboard reply status */ #define GrabSuccess 0 #define AlreadyGrabbed 1 #define GrabInvalidTime 2 #define GrabNotViewable 3 #define GrabFrozen 4 /* AllowEvents modes */ #define AsyncPointer 0 #define SyncPointer 1 #define ReplayPointer 2 #define AsyncKeyboard 3 #define SyncKeyboard 4 #define ReplayKeyboard 5 #define AsyncBoth 6 #define SyncBoth 7 /* Used in SetInputFocus, GetInputFocus */ #define RevertToNone (int)None #define RevertToPointerRoot (int)PointerRoot #define RevertToParent 2 /***************************************************************** * ERROR CODES *****************************************************************/ #define Success 0 /* everything's okay */ #define BadRequest 1 /* bad request code */ #define BadValue 2 /* int parameter out of range */ #define BadWindow 3 /* parameter not a Window */ #define BadPixmap 4 /* parameter not a Pixmap */ #define BadAtom 5 /* parameter not an Atom */ #define BadCursor 6 /* parameter not a Cursor */ #define BadFont 7 /* parameter not a Font */ #define BadMatch 8 /* parameter mismatch */ #define BadDrawable 9 /* parameter not a Pixmap or Window */ #define BadAccess 10 /* depending on context: - key/button already grabbed - attempt to free an illegal cmap entry - attempt to store into a read-only color map entry. - attempt to modify the access control list from other than the local host. */ #define BadAlloc 11 /* insufficient resources */ #define BadColor 12 /* no such colormap */ #define BadGC 13 /* parameter not a GC */ #define BadIDChoice 14 /* choice not in range or already used */ #define BadName 15 /* font or color name doesn't exist */ #define BadLength 16 /* Request length incorrect */ #define BadImplementation 17 /* server is defective */ #define FirstExtensionError 128 #define LastExtensionError 255 /***************************************************************** * WINDOW DEFINITIONS *****************************************************************/ /* Window classes used by CreateWindow */ /* Note that CopyFromParent is already defined as 0 above */ #define InputOutput 1 #define InputOnly 2 /* Window attributes for CreateWindow and ChangeWindowAttributes */ #define CWBackPixmap (1L<<0) #define CWBackPixel (1L<<1) #define CWBorderPixmap (1L<<2) #define CWBorderPixel (1L<<3) #define CWBitGravity (1L<<4) #define CWWinGravity (1L<<5) #define CWBackingStore (1L<<6) #define CWBackingPlanes (1L<<7) #define CWBackingPixel (1L<<8) #define CWOverrideRedirect (1L<<9) #define CWSaveUnder (1L<<10) #define CWEventMask (1L<<11) #define CWDontPropagate (1L<<12) #define CWColormap (1L<<13) #define CWCursor (1L<<14) /* ConfigureWindow structure */ #define CWX (1<<0) #define CWY (1<<1) #define CWWidth (1<<2) #define CWHeight (1<<3) #define CWBorderWidth (1<<4) #define CWSibling (1<<5) #define CWStackMode (1<<6) /* Bit Gravity */ #define ForgetGravity 0 #define NorthWestGravity 1 #define NorthGravity 2 #define NorthEastGravity 3 #define WestGravity 4 #define CenterGravity 5 #define EastGravity 6 #define SouthWestGravity 7 #define SouthGravity 8 #define SouthEastGravity 9 #define StaticGravity 10 /* Window gravity + bit gravity above */ #define UnmapGravity 0 /* Used in CreateWindow for backing-store hint */ #define NotUseful 0 #define WhenMapped 1 #define Always 2 /* Used in GetWindowAttributes reply */ #define IsUnmapped 0 #define IsUnviewable 1 #define IsViewable 2 /* Used in ChangeSaveSet */ #define SetModeInsert 0 #define SetModeDelete 1 /* Used in ChangeCloseDownMode */ #define DestroyAll 0 #define RetainPermanent 1 #define RetainTemporary 2 /* Window stacking method (in configureWindow) */ #define Above 0 #define Below 1 #define TopIf 2 #define BottomIf 3 #define Opposite 4 /* Circulation direction */ #define RaiseLowest 0 #define LowerHighest 1 /* Property modes */ #define PropModeReplace 0 #define PropModePrepend 1 #define PropModeAppend 2 /***************************************************************** * GRAPHICS DEFINITIONS *****************************************************************/ /* graphics functions, as in GC.alu */ #define GXclear 0x0 /* 0 */ #define GXand 0x1 /* src AND dst */ #define GXandReverse 0x2 /* src AND NOT dst */ #define GXcopy 0x3 /* src */ #define GXandInverted 0x4 /* NOT src AND dst */ #define GXnoop 0x5 /* dst */ #define GXxor 0x6 /* src XOR dst */ #define GXor 0x7 /* src OR dst */ #define GXnor 0x8 /* NOT src AND NOT dst */ #define GXequiv 0x9 /* NOT src XOR dst */ #define GXinvert 0xa /* NOT dst */ #define GXorReverse 0xb /* src OR NOT dst */ #define GXcopyInverted 0xc /* NOT src */ #define GXorInverted 0xd /* NOT src OR dst */ #define GXnand 0xe /* NOT src OR NOT dst */ #define GXset 0xf /* 1 */ /* LineStyle */ #define LineSolid 0 #define LineOnOffDash 1 #define LineDoubleDash 2 /* capStyle */ #define CapNotLast 0 #define CapButt 1 #define CapRound 2 #define CapProjecting 3 /* joinStyle */ #define JoinMiter 0 #define JoinRound 1 #define JoinBevel 2 /* fillStyle */ #define FillSolid 0 #define FillTiled 1 #define FillStippled 2 #define FillOpaqueStippled 3 /* fillRule */ #define EvenOddRule 0 #define WindingRule 1 /* subwindow mode */ #define ClipByChildren 0 #define IncludeInferiors 1 /* SetClipRectangles ordering */ #define Unsorted 0 #define YSorted 1 #define YXSorted 2 #define YXBanded 3 /* CoordinateMode for drawing routines */ #define CoordModeOrigin 0 /* relative to the origin */ #define CoordModePrevious 1 /* relative to previous point */ /* Polygon shapes */ #define Complex 0 /* paths may intersect */ #define Nonconvex 1 /* no paths intersect, but not convex */ #define Convex 2 /* wholly convex */ /* Arc modes for PolyFillArc */ #define ArcChord 0 /* join endpoints of arc */ #define ArcPieSlice 1 /* join endpoints to center of arc */ /* GC components: masks used in CreateGC, CopyGC, ChangeGC, OR'ed into GC.stateChanges */ #define GCFunction (1L<<0) #define GCPlaneMask (1L<<1) #define GCForeground (1L<<2) #define GCBackground (1L<<3) #define GCLineWidth (1L<<4) #define GCLineStyle (1L<<5) #define GCCapStyle (1L<<6) #define GCJoinStyle (1L<<7) #define GCFillStyle (1L<<8) #define GCFillRule (1L<<9) #define GCTile (1L<<10) #define GCStipple (1L<<11) #define GCTileStipXOrigin (1L<<12) #define GCTileStipYOrigin (1L<<13) #define GCFont (1L<<14) #define GCSubwindowMode (1L<<15) #define GCGraphicsExposures (1L<<16) #define GCClipXOrigin (1L<<17) #define GCClipYOrigin (1L<<18) #define GCClipMask (1L<<19) #define GCDashOffset (1L<<20) #define GCDashList (1L<<21) #define GCArcMode (1L<<22) #define GCLastBit 22 /***************************************************************** * FONTS *****************************************************************/ /* used in QueryFont -- draw direction */ #define FontLeftToRight 0 #define FontRightToLeft 1 #define FontChange 255 /***************************************************************** * IMAGING *****************************************************************/ /* ImageFormat -- PutImage, GetImage */ #define XYBitmap 0 /* depth 1, XYFormat */ #define XYPixmap 1 /* depth == drawable depth */ #define ZPixmap 2 /* depth == drawable depth */ /***************************************************************** * COLOR MAP STUFF *****************************************************************/ /* For CreateColormap */ #define AllocNone 0 /* create map with no entries */ #define AllocAll 1 /* allocate entire map writeable */ /* Flags used in StoreNamedColor, StoreColors */ #define DoRed (1<<0) #define DoGreen (1<<1) #define DoBlue (1<<2) /***************************************************************** * CURSOR STUFF *****************************************************************/ /* QueryBestSize Class */ #define CursorShape 0 /* largest size that can be displayed */ #define TileShape 1 /* size tiled fastest */ #define StippleShape 2 /* size stippled fastest */ /***************************************************************** * KEYBOARD/POINTER STUFF *****************************************************************/ #define AutoRepeatModeOff 0 #define AutoRepeatModeOn 1 #define AutoRepeatModeDefault 2 #define LedModeOff 0 #define LedModeOn 1 /* masks for ChangeKeyboardControl */ #define KBKeyClickPercent (1L<<0) #define KBBellPercent (1L<<1) #define KBBellPitch (1L<<2) #define KBBellDuration (1L<<3) #define KBLed (1L<<4) #define KBLedMode (1L<<5) #define KBKey (1L<<6) #define KBAutoRepeatMode (1L<<7) #define MappingSuccess 0 #define MappingBusy 1 #define MappingFailed 2 #define MappingModifier 0 #define MappingKeyboard 1 #define MappingPointer 2 /***************************************************************** * SCREEN SAVER STUFF *****************************************************************/ #define DontPreferBlanking 0 #define PreferBlanking 1 #define DefaultBlanking 2 #define DisableScreenSaver 0 #define DisableScreenInterval 0 #define DontAllowExposures 0 #define AllowExposures 1 #define DefaultExposures 2 /* for ForceScreenSaver */ #define ScreenSaverReset 0 #define ScreenSaverActive 1 /***************************************************************** * HOSTS AND CONNECTIONS *****************************************************************/ /* for ChangeHosts */ #define HostInsert 0 #define HostDelete 1 /* for ChangeAccessControl */ #define EnableAccess 1 #define DisableAccess 0 /* Display classes used in opening the connection * Note that the statically allocated ones are even numbered and the * dynamically changeable ones are odd numbered */ #define StaticGray 0 #define GrayScale 1 #define StaticColor 2 #define PseudoColor 3 #define TrueColor 4 #define DirectColor 5 /* Byte order used in imageByteOrder and bitmapBitOrder */ #define LSBFirst 0 #define MSBFirst 1 #endif /* X_H */ X11/XF86keysym.h000064400000032101147631660250007232 0ustar00/* * XFree86 vendor specific keysyms. * * The XFree86 keysym range is 0x10080001 - 0x1008FFFF. * * X.Org will not be adding to the XF86 set of keysyms, though they have * been adopted and are considered a "standard" part of X keysym definitions. * XFree86 never properly commented these keysyms, so we have done our * best to explain the semantic meaning of these keys. * * XFree86 has removed their mail archives of the period, that might have * shed more light on some of these definitions. Until/unless we resurrect * these archives, these are from memory and usage. */ /* * ModeLock * * This one is old, and not really used any more since XKB offers this * functionality. */ #define XF86XK_ModeLock 0x1008FF01 /* Mode Switch Lock */ /* Backlight controls. */ #define XF86XK_MonBrightnessUp 0x1008FF02 /* Monitor/panel brightness */ #define XF86XK_MonBrightnessDown 0x1008FF03 /* Monitor/panel brightness */ #define XF86XK_KbdLightOnOff 0x1008FF04 /* Keyboards may be lit */ #define XF86XK_KbdBrightnessUp 0x1008FF05 /* Keyboards may be lit */ #define XF86XK_KbdBrightnessDown 0x1008FF06 /* Keyboards may be lit */ /* * Keys found on some "Internet" keyboards. */ #define XF86XK_Standby 0x1008FF10 /* System into standby mode */ #define XF86XK_AudioLowerVolume 0x1008FF11 /* Volume control down */ #define XF86XK_AudioMute 0x1008FF12 /* Mute sound from the system */ #define XF86XK_AudioRaiseVolume 0x1008FF13 /* Volume control up */ #define XF86XK_AudioPlay 0x1008FF14 /* Start playing of audio > */ #define XF86XK_AudioStop 0x1008FF15 /* Stop playing audio */ #define XF86XK_AudioPrev 0x1008FF16 /* Previous track */ #define XF86XK_AudioNext 0x1008FF17 /* Next track */ #define XF86XK_HomePage 0x1008FF18 /* Display user's home page */ #define XF86XK_Mail 0x1008FF19 /* Invoke user's mail program */ #define XF86XK_Start 0x1008FF1A /* Start application */ #define XF86XK_Search 0x1008FF1B /* Search */ #define XF86XK_AudioRecord 0x1008FF1C /* Record audio application */ /* These are sometimes found on PDA's (e.g. Palm, PocketPC or elsewhere) */ #define XF86XK_Calculator 0x1008FF1D /* Invoke calculator program */ #define XF86XK_Memo 0x1008FF1E /* Invoke Memo taking program */ #define XF86XK_ToDoList 0x1008FF1F /* Invoke To Do List program */ #define XF86XK_Calendar 0x1008FF20 /* Invoke Calendar program */ #define XF86XK_PowerDown 0x1008FF21 /* Deep sleep the system */ #define XF86XK_ContrastAdjust 0x1008FF22 /* Adjust screen contrast */ #define XF86XK_RockerUp 0x1008FF23 /* Rocker switches exist up */ #define XF86XK_RockerDown 0x1008FF24 /* and down */ #define XF86XK_RockerEnter 0x1008FF25 /* and let you press them */ /* Some more "Internet" keyboard symbols */ #define XF86XK_Back 0x1008FF26 /* Like back on a browser */ #define XF86XK_Forward 0x1008FF27 /* Like forward on a browser */ #define XF86XK_Stop 0x1008FF28 /* Stop current operation */ #define XF86XK_Refresh 0x1008FF29 /* Refresh the page */ #define XF86XK_PowerOff 0x1008FF2A /* Power off system entirely */ #define XF86XK_WakeUp 0x1008FF2B /* Wake up system from sleep */ #define XF86XK_Eject 0x1008FF2C /* Eject device (e.g. DVD) */ #define XF86XK_ScreenSaver 0x1008FF2D /* Invoke screensaver */ #define XF86XK_WWW 0x1008FF2E /* Invoke web browser */ #define XF86XK_Sleep 0x1008FF2F /* Put system to sleep */ #define XF86XK_Favorites 0x1008FF30 /* Show favorite locations */ #define XF86XK_AudioPause 0x1008FF31 /* Pause audio playing */ #define XF86XK_AudioMedia 0x1008FF32 /* Launch media collection app */ #define XF86XK_MyComputer 0x1008FF33 /* Display "My Computer" window */ #define XF86XK_VendorHome 0x1008FF34 /* Display vendor home web site */ #define XF86XK_LightBulb 0x1008FF35 /* Light bulb keys exist */ #define XF86XK_Shop 0x1008FF36 /* Display shopping web site */ #define XF86XK_History 0x1008FF37 /* Show history of web surfing */ #define XF86XK_OpenURL 0x1008FF38 /* Open selected URL */ #define XF86XK_AddFavorite 0x1008FF39 /* Add URL to favorites list */ #define XF86XK_HotLinks 0x1008FF3A /* Show "hot" links */ #define XF86XK_BrightnessAdjust 0x1008FF3B /* Invoke brightness adj. UI */ #define XF86XK_Finance 0x1008FF3C /* Display financial site */ #define XF86XK_Community 0x1008FF3D /* Display user's community */ #define XF86XK_AudioRewind 0x1008FF3E /* "rewind" audio track */ #define XF86XK_BackForward 0x1008FF3F /* ??? */ #define XF86XK_Launch0 0x1008FF40 /* Launch Application */ #define XF86XK_Launch1 0x1008FF41 /* Launch Application */ #define XF86XK_Launch2 0x1008FF42 /* Launch Application */ #define XF86XK_Launch3 0x1008FF43 /* Launch Application */ #define XF86XK_Launch4 0x1008FF44 /* Launch Application */ #define XF86XK_Launch5 0x1008FF45 /* Launch Application */ #define XF86XK_Launch6 0x1008FF46 /* Launch Application */ #define XF86XK_Launch7 0x1008FF47 /* Launch Application */ #define XF86XK_Launch8 0x1008FF48 /* Launch Application */ #define XF86XK_Launch9 0x1008FF49 /* Launch Application */ #define XF86XK_LaunchA 0x1008FF4A /* Launch Application */ #define XF86XK_LaunchB 0x1008FF4B /* Launch Application */ #define XF86XK_LaunchC 0x1008FF4C /* Launch Application */ #define XF86XK_LaunchD 0x1008FF4D /* Launch Application */ #define XF86XK_LaunchE 0x1008FF4E /* Launch Application */ #define XF86XK_LaunchF 0x1008FF4F /* Launch Application */ #define XF86XK_ApplicationLeft 0x1008FF50 /* switch to application, left */ #define XF86XK_ApplicationRight 0x1008FF51 /* switch to application, right*/ #define XF86XK_Book 0x1008FF52 /* Launch bookreader */ #define XF86XK_CD 0x1008FF53 /* Launch CD/DVD player */ #define XF86XK_Calculater 0x1008FF54 /* Launch Calculater */ #define XF86XK_Clear 0x1008FF55 /* Clear window, screen */ #define XF86XK_Close 0x1008FF56 /* Close window */ #define XF86XK_Copy 0x1008FF57 /* Copy selection */ #define XF86XK_Cut 0x1008FF58 /* Cut selection */ #define XF86XK_Display 0x1008FF59 /* Output switch key */ #define XF86XK_DOS 0x1008FF5A /* Launch DOS (emulation) */ #define XF86XK_Documents 0x1008FF5B /* Open documents window */ #define XF86XK_Excel 0x1008FF5C /* Launch spread sheet */ #define XF86XK_Explorer 0x1008FF5D /* Launch file explorer */ #define XF86XK_Game 0x1008FF5E /* Launch game */ #define XF86XK_Go 0x1008FF5F /* Go to URL */ #define XF86XK_iTouch 0x1008FF60 /* Logitch iTouch- don't use */ #define XF86XK_LogOff 0x1008FF61 /* Log off system */ #define XF86XK_Market 0x1008FF62 /* ?? */ #define XF86XK_Meeting 0x1008FF63 /* enter meeting in calendar */ #define XF86XK_MenuKB 0x1008FF65 /* distingush keyboard from PB */ #define XF86XK_MenuPB 0x1008FF66 /* distinuish PB from keyboard */ #define XF86XK_MySites 0x1008FF67 /* Favourites */ #define XF86XK_New 0x1008FF68 /* New (folder, document... */ #define XF86XK_News 0x1008FF69 /* News */ #define XF86XK_OfficeHome 0x1008FF6A /* Office home (old Staroffice)*/ #define XF86XK_Open 0x1008FF6B /* Open */ #define XF86XK_Option 0x1008FF6C /* ?? */ #define XF86XK_Paste 0x1008FF6D /* Paste */ #define XF86XK_Phone 0x1008FF6E /* Launch phone; dial number */ #define XF86XK_Q 0x1008FF70 /* Compaq's Q - don't use */ #define XF86XK_Reply 0x1008FF72 /* Reply e.g., mail */ #define XF86XK_Reload 0x1008FF73 /* Reload web page, file, etc. */ #define XF86XK_RotateWindows 0x1008FF74 /* Rotate windows e.g. xrandr */ #define XF86XK_RotationPB 0x1008FF75 /* don't use */ #define XF86XK_RotationKB 0x1008FF76 /* don't use */ #define XF86XK_Save 0x1008FF77 /* Save (file, document, state */ #define XF86XK_ScrollUp 0x1008FF78 /* Scroll window/contents up */ #define XF86XK_ScrollDown 0x1008FF79 /* Scrool window/contentd down */ #define XF86XK_ScrollClick 0x1008FF7A /* Use XKB mousekeys instead */ #define XF86XK_Send 0x1008FF7B /* Send mail, file, object */ #define XF86XK_Spell 0x1008FF7C /* Spell checker */ #define XF86XK_SplitScreen 0x1008FF7D /* Split window or screen */ #define XF86XK_Support 0x1008FF7E /* Get support (??) */ #define XF86XK_TaskPane 0x1008FF7F /* Show tasks */ #define XF86XK_Terminal 0x1008FF80 /* Launch terminal emulator */ #define XF86XK_Tools 0x1008FF81 /* toolbox of desktop/app. */ #define XF86XK_Travel 0x1008FF82 /* ?? */ #define XF86XK_UserPB 0x1008FF84 /* ?? */ #define XF86XK_User1KB 0x1008FF85 /* ?? */ #define XF86XK_User2KB 0x1008FF86 /* ?? */ #define XF86XK_Video 0x1008FF87 /* Launch video player */ #define XF86XK_WheelButton 0x1008FF88 /* button from a mouse wheel */ #define XF86XK_Word 0x1008FF89 /* Launch word processor */ #define XF86XK_Xfer 0x1008FF8A #define XF86XK_ZoomIn 0x1008FF8B /* zoom in view, map, etc. */ #define XF86XK_ZoomOut 0x1008FF8C /* zoom out view, map, etc. */ #define XF86XK_Away 0x1008FF8D /* mark yourself as away */ #define XF86XK_Messenger 0x1008FF8E /* as in instant messaging */ #define XF86XK_WebCam 0x1008FF8F /* Launch web camera app. */ #define XF86XK_MailForward 0x1008FF90 /* Forward in mail */ #define XF86XK_Pictures 0x1008FF91 /* Show pictures */ #define XF86XK_Music 0x1008FF92 /* Launch music application */ #define XF86XK_Battery 0x1008FF93 /* Display battery information */ #define XF86XK_Bluetooth 0x1008FF94 /* Enable/disable Bluetooth */ #define XF86XK_WLAN 0x1008FF95 /* Enable/disable WLAN */ #define XF86XK_UWB 0x1008FF96 /* Enable/disable UWB */ #define XF86XK_AudioForward 0x1008FF97 /* fast-forward audio track */ #define XF86XK_AudioRepeat 0x1008FF98 /* toggle repeat mode */ #define XF86XK_AudioRandomPlay 0x1008FF99 /* toggle shuffle mode */ #define XF86XK_Subtitle 0x1008FF9A /* cycle through subtitle */ #define XF86XK_AudioCycleTrack 0x1008FF9B /* cycle through audio tracks */ #define XF86XK_CycleAngle 0x1008FF9C /* cycle through angles */ #define XF86XK_FrameBack 0x1008FF9D /* video: go one frame back */ #define XF86XK_FrameForward 0x1008FF9E /* video: go one frame forward */ #define XF86XK_Time 0x1008FF9F /* display, or shows an entry for time seeking */ #define XF86XK_Select 0x1008FFA0 /* Select button on joypads and remotes */ #define XF86XK_View 0x1008FFA1 /* Show a view options/properties */ #define XF86XK_TopMenu 0x1008FFA2 /* Go to a top-level menu in a video */ #define XF86XK_Red 0x1008FFA3 /* Red button */ #define XF86XK_Green 0x1008FFA4 /* Green button */ #define XF86XK_Yellow 0x1008FFA5 /* Yellow button */ #define XF86XK_Blue 0x1008FFA6 /* Blue button */ #define XF86XK_Suspend 0x1008FFA7 /* Sleep to RAM */ #define XF86XK_Hibernate 0x1008FFA8 /* Sleep to disk */ #define XF86XK_TouchpadToggle 0x1008FFA9 /* Toggle between touchpad/trackstick */ #define XF86XK_TouchpadOn 0x1008FFB0 /* The touchpad got switched on */ #define XF86XK_TouchpadOff 0x1008FFB1 /* The touchpad got switched off */ #define XF86XK_AudioMicMute 0x1008FFB2 /* Mute the Mic from the system */ #define XF86XK_Keyboard 0x1008FFB3 /* User defined keyboard related action */ #define XF86XK_WWAN 0x1008FFB4 /* Toggle WWAN (LTE, UMTS, etc.) radio */ #define XF86XK_RFKill 0x1008FFB5 /* Toggle radios on/off */ #define XF86XK_AudioPreset 0x1008FFB6 /* Select equalizer preset, e.g. theatre-mode */ /* Keys for special action keys (hot keys) */ /* Virtual terminals on some operating systems */ #define XF86XK_Switch_VT_1 0x1008FE01 #define XF86XK_Switch_VT_2 0x1008FE02 #define XF86XK_Switch_VT_3 0x1008FE03 #define XF86XK_Switch_VT_4 0x1008FE04 #define XF86XK_Switch_VT_5 0x1008FE05 #define XF86XK_Switch_VT_6 0x1008FE06 #define XF86XK_Switch_VT_7 0x1008FE07 #define XF86XK_Switch_VT_8 0x1008FE08 #define XF86XK_Switch_VT_9 0x1008FE09 #define XF86XK_Switch_VT_10 0x1008FE0A #define XF86XK_Switch_VT_11 0x1008FE0B #define XF86XK_Switch_VT_12 0x1008FE0C #define XF86XK_Ungrab 0x1008FE20 /* force ungrab */ #define XF86XK_ClearGrab 0x1008FE21 /* kill application with grab */ #define XF86XK_Next_VMode 0x1008FE22 /* next video mode available */ #define XF86XK_Prev_VMode 0x1008FE23 /* prev. video mode available */ #define XF86XK_LogWindowTree 0x1008FE24 /* print window tree to log */ #define XF86XK_LogGrabInfo 0x1008FE25 /* print all active grabs to log */ X11/Xmd.h000064400000012002147631660250006023 0ustar00/*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef XMD_H # define XMD_H 1 /* * Xmd.h: MACHINE DEPENDENT DECLARATIONS. */ /* * Special per-machine configuration flags. */ # if defined(__sun) && defined(__SVR4) # include /* Solaris: defines _LP64 if necessary */ # endif # if defined (_LP64) || defined(__LP64__) || \ defined(__alpha) || defined(__alpha__) || \ defined(__ia64__) || defined(ia64) || \ defined(__sparc64__) || \ defined(__s390x__) || \ defined(__amd64__) || defined(amd64) || \ defined(__powerpc64__) # if !defined(__ILP32__) /* amd64-x32 is 32bit */ # define LONG64 /* 32/64-bit architecture */ # endif /* !__ILP32__ */ # endif /* * Definition of macro used to set constants for size of network structures; * machines with preprocessors that can't handle all of the sz_ symbols * can define this macro to be sizeof(x) if and only if their compiler doesn't * pad out structures (esp. the xTextElt structure which contains only two * one-byte fields). Network structures should always define sz_symbols. * * The sz_ prefix is used instead of something more descriptive so that the * symbols are no more than 32 characters long (which causes problems for some * compilers and preprocessors). * * The extra indirection is to get macro arguments to expand correctly before * the concatenation, rather than afterward. */ # define _SIZEOF(x) sz_##x # define SIZEOF(x) _SIZEOF(x) /* * Bitfield suffixes for the protocol structure elements, if you * need them. Note that bitfields are not guaranteed to be signed * (or even unsigned) according to ANSI C. */ # define B32 /* bitfield not needed on architectures with native 32-bit type */ # define B16 /* bitfield not needed on architectures with native 16-bit type */ # ifdef LONG64 typedef long INT64; typedef int INT32; # else typedef long INT32; # endif typedef short INT16; typedef signed char INT8; # ifdef LONG64 typedef unsigned long CARD64; typedef unsigned int CARD32; # else typedef unsigned long long CARD64; typedef unsigned long CARD32; # endif typedef unsigned short CARD16; typedef unsigned char CARD8; typedef CARD32 BITS32; typedef CARD16 BITS16; typedef CARD8 BYTE; typedef CARD8 BOOL; /* * was definitions for sign-extending bitfields on architectures without * native types smaller than 64-bit, now just backwards compatibility */ # define cvtINT8toInt(val) (val) # define cvtINT16toInt(val) (val) # define cvtINT32toInt(val) (val) # define cvtINT8toShort(val) (val) # define cvtINT16toShort(val) (val) # define cvtINT32toShort(val) (val) # define cvtINT8toLong(val) (val) # define cvtINT16toLong(val) (val) # define cvtINT32toLong(val) (val) /* * this version should leave result of type (t *), but that should only be * used when not in MUSTCOPY */ # define NEXTPTR(p,t) (((t *)(p)) + 1) #endif /* XMD_H */ X11/Xarch.h000064400000005607147631660250006355 0ustar00#ifndef _XARCH_H_ # define _XARCH_H_ /* * Copyright 1997 Metro Link Incorporated * * All Rights Reserved * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of the above listed copyright holder(s) * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. The above listed * copyright holder(s) make(s) no representations about the suitability of * this software for any purpose. It is provided "as is" without express or * implied warranty. * * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Determine the machine's byte order. */ /* See if it is set in the imake config first */ # ifdef X_BYTE_ORDER # define X_BIG_ENDIAN 4321 # define X_LITTLE_ENDIAN 1234 # else # if defined(SVR4) || defined(__SVR4) # include # include # elif defined(CSRG_BASED) # if defined(__NetBSD__) || defined(__OpenBSD__) # include # endif # include # elif defined(linux) # if defined __STRICT_ANSI__ # undef __STRICT_ANSI__ # include # define __STRICT_ANSI__ # else # include # endif /* 'endian.h' might have been included before 'Xarch.h' */ # if !defined(LITTLE_ENDIAN) && defined(__LITTLE_ENDIAN) # define LITTLE_ENDIAN __LITTLE_ENDIAN # endif # if !defined(BIG_ENDIAN) && defined(__BIG_ENDIAN) # define BIG_ENDIAN __BIG_ENDIAN # endif # if !defined(PDP_ENDIAN) && defined(__PDP_ENDIAN) # define PDP_ENDIAN __PDP_ENDIAN # endif # if !defined(BYTE_ORDER) && defined(__BYTE_ORDER) # define BYTE_ORDER __BYTE_ORDER # endif # endif # ifndef BYTE_ORDER # define LITTLE_ENDIAN 1234 # define BIG_ENDIAN 4321 # if defined(__sun) && defined(__SVR4) # include # ifdef _LITTLE_ENDIAN # define BYTE_ORDER LITTLE_ENDIAN # endif # ifdef _BIG_ENDIAN # define BYTE_ORDER BIG_ENDIAN # endif # endif /* sun */ # endif /* BYTE_ORDER */ # define X_BYTE_ORDER BYTE_ORDER # define X_BIG_ENDIAN BIG_ENDIAN # define X_LITTLE_ENDIAN LITTLE_ENDIAN # endif /* not in imake config */ #endif /* _XARCH_H_ */ X11/keysym.h000064400000005326147631660250006627 0ustar00/*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* default keysyms */ #define XK_MISCELLANY #define XK_XKB_KEYS #define XK_LATIN1 #define XK_LATIN2 #define XK_LATIN3 #define XK_LATIN4 #define XK_LATIN8 #define XK_LATIN9 #define XK_CAUCASUS #define XK_GREEK #define XK_KATAKANA #define XK_ARABIC #define XK_CYRILLIC #define XK_HEBREW #define XK_THAI #define XK_KOREAN #define XK_ARMENIAN #define XK_GEORGIAN #define XK_VIETNAMESE #define XK_CURRENCY #define XK_MATHEMATICAL #define XK_BRAILLE #define XK_SINHALA #include X11/Xos.h000064400000010412147631660250006047 0ustar00/* * Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * * The X Window System is a Trademark of The Open Group. * */ /* This is a collection of things to try and minimize system dependencies * in a "significant" number of source files. */ #ifndef _XOS_H_ # define _XOS_H_ # include /* * Get major data types (esp. caddr_t) */ # include # if defined(__SCO__) || defined(__UNIXWARE__) # include # endif /* * Just about everyone needs the strings routines. We provide both forms here, * index/rindex and strchr/strrchr, so any systems that don't provide them all * need to have #defines here. * * These macros are defined this way, rather than, e.g.: * #defined index(s,c) strchr(s,c) * because someone might be using them as function pointers, and such * a change would break compatibility for anyone who's relying on them * being the way they currently are. So we're stuck with them this way, * which can be really inconvenient. :-( */ # include # if defined(__SCO__) || defined(__UNIXWARE__) || defined(__sun) || defined(__CYGWIN__) || defined(_AIX) || defined(__APPLE__) # include # else # ifndef index # define index(s,c) (strchr((s),(c))) # endif # ifndef rindex # define rindex(s,c) (strrchr((s),(c))) # endif # endif /* * Get open(2) constants */ # if defined(X_NOT_POSIX) # include # if defined(USL) || defined(__i386__) && (defined(SYSV) || defined(SVR4)) # include # endif # ifdef WIN32 # include # else # include # endif # else /* X_NOT_POSIX */ # include # include # endif /* X_NOT_POSIX else */ /* * Get struct timeval and struct tm */ # if defined(_POSIX_SOURCE) && defined(SVR4) /* need to omit _POSIX_SOURCE in order to get what we want in SVR4 */ # undef _POSIX_SOURCE # include # define _POSIX_SOURCE # elif defined(WIN32) # include # if !defined(_WINSOCKAPI_) && !defined(_WILLWINSOCK_) && !defined(_TIMEVAL_DEFINED) && !defined(_STRUCT_TIMEVAL) struct timeval { long tv_sec; /* seconds */ long tv_usec; /* and microseconds */ }; # define _TIMEVAL_DEFINED # endif # include # define gettimeofday(t) \ { \ struct _timeb _gtodtmp; \ _ftime (&_gtodtmp); \ (t)->tv_sec = _gtodtmp.time; \ (t)->tv_usec = _gtodtmp.millitm * 1000; \ } # else # include # include # endif /* defined(_POSIX_SOURCE) && defined(SVR4) */ /* define X_GETTIMEOFDAY macro, a portable gettimeofday() */ # if defined(_XOPEN_XPG4) || defined(_XOPEN_UNIX) /* _XOPEN_UNIX is XPG4.2 */ # define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0) # else # if defined(SVR4) || defined(__SVR4) || defined(WIN32) # define X_GETTIMEOFDAY(t) gettimeofday(t) # else # define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0) # endif # endif /* XPG4 else */ # ifdef __GNU__ # define PATH_MAX 4096 # define MAXPATHLEN 4096 # define OPEN_MAX 256 /* We define a reasonable limit. */ # endif /* use POSIX name for signal */ # if defined(X_NOT_POSIX) && defined(SYSV) && !defined(SIGCHLD) # define SIGCHLD SIGCLD # endif # include #endif /* _XOS_H_ */ X11/ap_keysym.h000064400000004372147631660250007307 0ustar00/****************************************************************** Copyright 1987 by Apollo Computer Inc., Chelmsford, Massachusetts. Copyright 1989 by Hewlett-Packard Company. All Rights Reserved Permission to use, duplicate, change, and distribute this software and its documentation for any purpose and without fee is granted, provided that the above copyright notice appear in such copy and that this copyright notice appear in all supporting documentation, and that the names of Apollo Computer Inc., the Hewlett-Packard Company, or the X Consortium not be used in advertising or publicity pertaining to distribution of the software without written prior permission. HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable for errors contained herein or direct, indirect, special, incidental or consequential damages in connection with the furnishing, performance, or use of this material. This software is not subject to any license of the American Telephone and Telegraph Company or of the Regents of the University of California. ******************************************************************/ #define apXK_LineDel 0x1000FF00 #define apXK_CharDel 0x1000FF01 #define apXK_Copy 0x1000FF02 #define apXK_Cut 0x1000FF03 #define apXK_Paste 0x1000FF04 #define apXK_Move 0x1000FF05 #define apXK_Grow 0x1000FF06 #define apXK_Cmd 0x1000FF07 #define apXK_Shell 0x1000FF08 #define apXK_LeftBar 0x1000FF09 #define apXK_RightBar 0x1000FF0A #define apXK_LeftBox 0x1000FF0B #define apXK_RightBox 0x1000FF0C #define apXK_UpBox 0x1000FF0D #define apXK_DownBox 0x1000FF0E #define apXK_Pop 0x1000FF0F #define apXK_Read 0x1000FF10 #define apXK_Edit 0x1000FF11 #define apXK_Save 0x1000FF12 #define apXK_Exit 0x1000FF13 #define apXK_Repeat 0x1000FF14 #define apXK_KP_parenleft 0x1000FFA8 #define apXK_KP_parenright 0x1000FFA9 X11/Xwindows.h000064400000006323147631660250007126 0ustar00/* Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL- ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * This header file has the sole purpose of allowing the inclusion of * windows.h without getting any name conflicts with X headers code, by * renaming or disabling the conflicting definitions from windows.h */ /* * Mingw.org versions of the Windows API headers actually avoid * making the conflicting definitions if XFree86Server is defined, so we * need to remember if that was defined and undefine it during including * windows.h (so the conflicting definitions get wrapped correctly), and * then redefine it afterwards. (This was never the correct thing to * do as it's no help at all to X11 clients which also need to use the * Win32 API) */ #undef _XFree86Server #ifdef XFree86Server # define _XFree86Server # undef XFree86Server #endif /* * There doesn't seem to be a good way to wrap the min/max macros from * windows.h, so we simply avoid defining them completely, allowing any * pre-existing definition to stand. * */ #define NOMINMAX /* * mingw-w64 headers define BOOL as a typedef, protecting against macros * mingw.org headers define BOOL in terms of WINBOOL * ... so try to come up with something which works with both :-) */ #define _NO_BOOL_TYPEDEF #define BOOL WINBOOL #define INT32 wINT32 #ifdef __x86_64__ #define INT64 wINT64 #define LONG64 wLONG64 #endif #undef Status #define Status wStatus #define ATOM wATOM #define BYTE wBYTE #define FreeResource wFreeResource #include #undef NOMINMAX #undef Status #define Status int #undef BYTE #undef BOOL #undef INT32 #undef INT64 #undef LONG64 #undef ATOM #undef FreeResource #undef CreateWindowA /* * Older version of this header used to name the windows API bool type wBOOL, * rather than more standard name WINBOOL */ #define wBOOL WINBOOL #ifdef RESOURCE_H # undef RT_FONT # undef RT_CURSOR # define RT_FONT ((RESTYPE)4) # define RT_CURSOR ((RESTYPE)5) #endif #ifndef __CYGWIN__ #define sleep(x) Sleep((x) * 1000) #endif #if defined(WIN32) && (!defined(PATH_MAX) || PATH_MAX < 1024) # undef PATH_MAX # define PATH_MAX 1024 #endif #ifdef _XFree86Server # define XFree86Server # undef _XFree86Server #endif X11/Xpoll.h000064400000017077147631660250006412 0ustar00/* Copyright 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Copyright © 2005 Daniel Stone * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Daniel Stone not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. Daniel Stone makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * DANIEL STONE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * DANIEL STONE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef _XPOLL_H_ #define _XPOLL_H_ #if !defined(WIN32) || defined(__CYGWIN__) #ifndef USE_POLL #include #include /* Get the FD_* macros. */ #include #ifdef CSRG_BASED #include # if BSD < 199103 typedef long fd_mask; # endif #endif #if defined(FD_SETSIZE) && FD_SETSIZE < 512 # define XFD_SETSIZE FD_SETSIZE #else # define XFD_SETSIZE 512 # ifndef FD_SETSIZE # define FD_SETSIZE XFD_SETSIZE # endif #endif #ifndef NBBY #define NBBY 8 /* number of bits in a byte */ #endif #ifndef NFDBITS #define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ #endif #ifndef howmany #define howmany(x,y) (((x)+((y)-1))/(y)) #endif #if defined(BSD) && BSD < 198911 typedef struct fd_set { fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; } fd_set; #endif # define Select(n,r,w,e,t) select(n,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval*)t) #define __X_FDS_BITS __fds_bits #ifndef __FDS_BITS # define __FDS_BITS(p) ((p)->__X_FDS_BITS) #endif #define __XFDS_BITS(p, n) (__FDS_BITS(p))[n] #ifndef FD_SET #define FD_SET(n, p) (__XFDS_BITS(p, ((n)/NFDBITS)) |= ((fd_mask)1 << ((n) % NFDBITS))) #endif #ifndef FD_CLR #define FD_CLR(n, p) (__XFDS_BITS((p), ((n)/NFDBITS)) &= ~((fd_mask)1 << ((n) % NFDBITS))) #endif #ifndef FD_ISSET #define FD_ISSET(n, p) ((__XFDS_BITS((p), ((n)/NFDBITS))) & ((fd_mask)1 << ((n) % NFDBITS))) #endif #ifndef FD_ZERO #define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) #endif /* * The howmany(FD_SETSIZE, NFDBITS) computes the number of elements in the * array. before accessing an element in the array we check it exists. * If it does not exist then the compiler discards the code to access it. */ #define XFD_ANYSET(p) \ ((howmany(FD_SETSIZE, NFDBITS) > 0 && (__XFDS_BITS(p, 0))) || \ (howmany(FD_SETSIZE, NFDBITS) > 1 && (__XFDS_BITS(p, 1))) || \ (howmany(FD_SETSIZE, NFDBITS) > 2 && (__XFDS_BITS(p, 2))) || \ (howmany(FD_SETSIZE, NFDBITS) > 3 && (__XFDS_BITS(p, 3))) || \ (howmany(FD_SETSIZE, NFDBITS) > 4 && (__XFDS_BITS(p, 4))) || \ (howmany(FD_SETSIZE, NFDBITS) > 5 && (__XFDS_BITS(p, 5))) || \ (howmany(FD_SETSIZE, NFDBITS) > 6 && (__XFDS_BITS(p, 6))) || \ (howmany(FD_SETSIZE, NFDBITS) > 7 && (__XFDS_BITS(p, 7))) || \ (howmany(FD_SETSIZE, NFDBITS) > 8 && (__XFDS_BITS(p, 8))) || \ (howmany(FD_SETSIZE, NFDBITS) > 9 && (__XFDS_BITS(p, 9))) || \ (howmany(FD_SETSIZE, NFDBITS) > 10 && (__XFDS_BITS(p, 10))) || \ (howmany(FD_SETSIZE, NFDBITS) > 11 && (__XFDS_BITS(p, 11))) || \ (howmany(FD_SETSIZE, NFDBITS) > 12 && (__XFDS_BITS(p, 12))) || \ (howmany(FD_SETSIZE, NFDBITS) > 13 && (__XFDS_BITS(p, 13))) || \ (howmany(FD_SETSIZE, NFDBITS) > 14 && (__XFDS_BITS(p, 14))) || \ (howmany(FD_SETSIZE, NFDBITS) > 15 && (__XFDS_BITS(p, 15)))) #define XFD_COPYSET(src,dst) { \ int __i__; \ for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \ __XFDS_BITS((dst), __i__) = __XFDS_BITS((src), __i__); \ } #define XFD_ANDSET(dst,b1,b2) { \ int __i__; \ for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \ __XFDS_BITS((dst), __i__) = ((__XFDS_BITS((b1), __i__)) & (__XFDS_BITS((b2), __i__))); \ } #define XFD_ORSET(dst,b1,b2) { \ int __i__; \ for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \ __XFDS_BITS((dst), __i__) = ((__XFDS_BITS((b1), __i__)) | (__XFDS_BITS((b2), __i__))); \ } #define XFD_UNSET(dst,b1) { \ int __i__; \ for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \ __XFDS_BITS((dst), __i__) &= ~(__XFDS_BITS((b1), __i__)); \ } #else /* USE_POLL */ #include #endif /* USE_POLL */ #else /* WIN32 */ #define XFD_SETSIZE 512 #ifndef FD_SETSIZE #define FD_SETSIZE XFD_SETSIZE #endif #include #define Select(n,r,w,e,t) select(0,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval*)t) #define XFD_SETCOUNT(p) (((fd_set FAR *)(p))->fd_count) #define XFD_FD(p,i) (((fd_set FAR *)(p))->fd_array[i]) #define XFD_ANYSET(p) XFD_SETCOUNT(p) #define XFD_COPYSET(src,dst) { \ u_int __i; \ FD_ZERO(dst); \ for (__i = 0; __i < XFD_SETCOUNT(src) ; __i++) { \ XFD_FD(dst,__i) = XFD_FD(src,__i); \ } \ XFD_SETCOUNT(dst) = XFD_SETCOUNT(src); \ } #define XFD_ANDSET(dst,b1,b2) { \ u_int __i; \ FD_ZERO(dst); \ for (__i = 0; __i < XFD_SETCOUNT(b1) ; __i++) { \ if (FD_ISSET(XFD_FD(b1,__i), b2)) \ FD_SET(XFD_FD(b1,__i), dst); \ } \ } #define XFD_ORSET(dst,b1,b2) { \ u_int __i; \ if (dst != b1) XFD_COPYSET(b1,dst); \ for (__i = 0; __i < XFD_SETCOUNT(b2) ; __i++) { \ if (!FD_ISSET(XFD_FD(b2,__i), dst)) \ FD_SET(XFD_FD(b2,__i), dst); \ } \ } /* this one is really sub-optimal */ #define XFD_UNSET(dst,b1) { \ u_int __i; \ for (__i = 0; __i < XFD_SETCOUNT(b1) ; __i++) { \ FD_CLR(XFD_FD(b1,__i), dst); \ } \ } /* we have to pay the price of having an array here, unlike with bitmasks calling twice FD_SET with the same fd is not transparent, so be careful */ #undef FD_SET #define FD_SET(fd,set) do { \ if (XFD_SETCOUNT(set) < FD_SETSIZE && !FD_ISSET(fd,set)) \ XFD_FD(set,XFD_SETCOUNT(set)++)=(fd); \ } while(0) #define getdtablesize() FD_SETSIZE #endif /* WIN32 */ #endif /* _XPOLL_H_ */ X11/Xregion.h000064400000013475147631660250006725 0ustar00/************************************************************************ Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ************************************************************************/ #ifndef _X11_XREGION_H_ #define _X11_XREGION_H_ typedef struct { short x1, x2, y1, y2; } Box, BOX, BoxRec, *BoxPtr; typedef struct { short x, y, width, height; }RECTANGLE, RectangleRec, *RectanglePtr; #define TRUE 1 #define FALSE 0 #define MAXSHORT 32767 #define MINSHORT -MAXSHORT #ifndef MAX #define MAX(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef MIN #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif /* * clip region */ typedef struct _XRegion { long size; long numRects; BOX *rects; BOX extents; } REGION; /* Xutil.h contains the declaration: * typedef struct _XRegion *Region; */ /* 1 if two BOXs overlap. * 0 if two BOXs do not overlap. * Remember, x2 and y2 are not in the region */ #define EXTENTCHECK(r1, r2) \ ((r1)->x2 > (r2)->x1 && \ (r1)->x1 < (r2)->x2 && \ (r1)->y2 > (r2)->y1 && \ (r1)->y1 < (r2)->y2) /* * update region extents */ #define EXTENTS(r,idRect){\ if((r)->x1 < (idRect)->extents.x1)\ (idRect)->extents.x1 = (r)->x1;\ if((r)->y1 < (idRect)->extents.y1)\ (idRect)->extents.y1 = (r)->y1;\ if((r)->x2 > (idRect)->extents.x2)\ (idRect)->extents.x2 = (r)->x2;\ if((r)->y2 > (idRect)->extents.y2)\ (idRect)->extents.y2 = (r)->y2;\ } /* * Check to see if there is enough memory in the present region. */ #define MEMCHECK(reg, rect, firstrect){\ if ((reg)->numRects >= ((reg)->size - 1)){\ BoxPtr tmpRect = Xrealloc ((firstrect), \ (2 * (sizeof(BOX)) * ((reg)->size))); \ if (tmpRect == NULL) \ return(0);\ (firstrect) = tmpRect; \ (reg)->size *= 2;\ (rect) = &(firstrect)[(reg)->numRects];\ }\ } /* this routine checks to see if the previous rectangle is the same * or subsumes the new rectangle to add. */ #define CHECK_PREVIOUS(Reg, R, Rx1, Ry1, Rx2, Ry2)\ (!(((Reg)->numRects > 0)&&\ ((R-1)->y1 == (Ry1)) &&\ ((R-1)->y2 == (Ry2)) &&\ ((R-1)->x1 <= (Rx1)) &&\ ((R-1)->x2 >= (Rx2)))) /* add a rectangle to the given Region */ #define ADDRECT(reg, r, rx1, ry1, rx2, ry2){\ if (((rx1) < (rx2)) && ((ry1) < (ry2)) &&\ CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\ (r)->x1 = (rx1);\ (r)->y1 = (ry1);\ (r)->x2 = (rx2);\ (r)->y2 = (ry2);\ EXTENTS((r), (reg));\ (reg)->numRects++;\ (r)++;\ }\ } /* add a rectangle to the given Region */ #define ADDRECTNOX(reg, r, rx1, ry1, rx2, ry2){\ if ((rx1 < rx2) && (ry1 < ry2) &&\ CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\ (r)->x1 = (rx1);\ (r)->y1 = (ry1);\ (r)->x2 = (rx2);\ (r)->y2 = (ry2);\ (reg)->numRects++;\ (r)++;\ }\ } #define EMPTY_REGION(pReg) pReg->numRects = 0 #define REGION_NOT_EMPTY(pReg) pReg->numRects #define INBOX(r, x, y) \ ( ( ((r).x2 > x)) && \ ( ((r).x1 <= x)) && \ ( ((r).y2 > y)) && \ ( ((r).y1 <= y)) ) /* * number of points to buffer before sending them off * to scanlines() : Must be an even number */ #define NUMPTSTOBUFFER 200 /* * used to allocate buffers for points and link * the buffers together */ typedef struct _POINTBLOCK { XPoint pts[NUMPTSTOBUFFER]; struct _POINTBLOCK *next; } POINTBLOCK; #endif /* _X11_XREGION_H_ */ X11/Xlibint.h000064400000117077147631660250006726 0ustar00 /* Copyright 1984, 1985, 1987, 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _X11_XLIBINT_H_ #define _X11_XLIBINT_H_ 1 /* * Xlibint.h - Header definition and support file for the internal * support routines used by the C subroutine interface * library (Xlib) to the X Window System. * * Warning, there be dragons here.... */ #include #include #include /* to declare xEvent */ #include /* for configured options like XTHREADS */ /* The Xlib structs are full of implicit padding to properly align members. We can't clean that up without breaking ABI, so tell clang not to bother complaining about it. */ #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpadded" #endif #ifdef WIN32 #define _XFlush _XFlushIt #endif struct _XGC { XExtData *ext_data; /* hook for extension to hang data */ GContext gid; /* protocol ID for graphics context */ Bool rects; /* boolean: TRUE if clipmask is list of rectangles */ Bool dashes; /* boolean: TRUE if dash-list is really a list */ unsigned long dirty;/* cache dirty bits */ XGCValues values; /* shadow structure of values */ }; struct _XDisplay { XExtData *ext_data; /* hook for extension to hang data */ struct _XFreeFuncs *free_funcs; /* internal free functions */ int fd; /* Network socket. */ int conn_checker; /* ugly thing used by _XEventsQueued */ int proto_major_version;/* maj. version of server's X protocol */ int proto_minor_version;/* minor version of server's X protocol */ char *vendor; /* vendor of the server hardware */ XID resource_base; /* resource ID base */ XID resource_mask; /* resource ID mask bits */ XID resource_id; /* allocator current ID */ int resource_shift; /* allocator shift to correct bits */ XID (*resource_alloc)( /* allocator function */ struct _XDisplay* ); int byte_order; /* screen byte order, LSBFirst, MSBFirst */ int bitmap_unit; /* padding and data requirements */ int bitmap_pad; /* padding requirements on bitmaps */ int bitmap_bit_order; /* LeastSignificant or MostSignificant */ int nformats; /* number of pixmap formats in list */ ScreenFormat *pixmap_format; /* pixmap format list */ int vnumber; /* Xlib's X protocol version number. */ int release; /* release of the server */ struct _XSQEvent *head, *tail; /* Input event queue. */ int qlen; /* Length of input event queue */ unsigned long last_request_read; /* seq number of last event read */ unsigned long request; /* sequence number of last request. */ char *last_req; /* beginning of last request, or dummy */ char *buffer; /* Output buffer starting address. */ char *bufptr; /* Output buffer index pointer. */ char *bufmax; /* Output buffer maximum+1 address. */ unsigned max_request_size; /* maximum number 32 bit words in request*/ struct _XrmHashBucketRec *db; int (*synchandler)( /* Synchronization handler */ struct _XDisplay* ); char *display_name; /* "host:display" string used on this connect*/ int default_screen; /* default screen for operations */ int nscreens; /* number of screens on this server*/ Screen *screens; /* pointer to list of screens */ unsigned long motion_buffer; /* size of motion buffer */ volatile unsigned long flags; /* internal connection flags */ int min_keycode; /* minimum defined keycode */ int max_keycode; /* maximum defined keycode */ KeySym *keysyms; /* This server's keysyms */ XModifierKeymap *modifiermap; /* This server's modifier keymap */ int keysyms_per_keycode;/* number of rows */ char *xdefaults; /* contents of defaults from server */ char *scratch_buffer; /* place to hang scratch buffer */ unsigned long scratch_length; /* length of scratch buffer */ int ext_number; /* extension number on this display */ struct _XExten *ext_procs; /* extensions initialized on this display */ /* * the following can be fixed size, as the protocol defines how * much address space is available. * While this could be done using the extension vector, there * may be MANY events processed, so a search through the extension * list to find the right procedure for each event might be * expensive if many extensions are being used. */ Bool (*event_vec[128])( /* vector for wire to event */ Display * /* dpy */, XEvent * /* re */, xEvent * /* event */ ); Status (*wire_vec[128])( /* vector for event to wire */ Display * /* dpy */, XEvent * /* re */, xEvent * /* event */ ); KeySym lock_meaning; /* for XLookupString */ struct _XLockInfo *lock; /* multi-thread state, display lock */ struct _XInternalAsync *async_handlers; /* for internal async */ unsigned long bigreq_size; /* max size of big requests */ struct _XLockPtrs *lock_fns; /* pointers to threads functions */ void (*idlist_alloc)( /* XID list allocator function */ Display * /* dpy */, XID * /* ids */, int /* count */ ); /* things above this line should not move, for binary compatibility */ struct _XKeytrans *key_bindings; /* for XLookupString */ Font cursor_font; /* for XCreateFontCursor */ struct _XDisplayAtoms *atoms; /* for XInternAtom */ unsigned int mode_switch; /* keyboard group modifiers */ unsigned int num_lock; /* keyboard numlock modifiers */ struct _XContextDB *context_db; /* context database */ Bool (**error_vec)( /* vector for wire to error */ Display * /* display */, XErrorEvent * /* he */, xError * /* we */ ); /* * Xcms information */ struct { XPointer defaultCCCs; /* pointer to an array of default XcmsCCC */ XPointer clientCmaps; /* pointer to linked list of XcmsCmapRec */ XPointer perVisualIntensityMaps; /* linked list of XcmsIntensityMap */ } cms; struct _XIMFilter *im_filters; struct _XSQEvent *qfree; /* unallocated event queue elements */ unsigned long next_event_serial_num; /* inserted into next queue elt */ struct _XExten *flushes; /* Flush hooks */ struct _XConnectionInfo *im_fd_info; /* _XRegisterInternalConnection */ int im_fd_length; /* number of im_fd_info */ struct _XConnWatchInfo *conn_watchers; /* XAddConnectionWatch */ int watcher_count; /* number of conn_watchers */ XPointer filedes; /* struct pollfd cache for _XWaitForReadable */ int (*savedsynchandler)( /* user synchandler when Xlib usurps */ Display * /* dpy */ ); XID resource_max; /* allocator max ID */ int xcmisc_opcode; /* major opcode for XC-MISC */ struct _XkbInfoRec *xkb_info; /* XKB info */ struct _XtransConnInfo *trans_conn; /* transport connection object */ struct _X11XCBPrivate *xcb; /* XCB glue private data */ /* Generic event cookie handling */ unsigned int next_cookie; /* next event cookie */ /* vector for wire to generic event, index is (extension - 128) */ Bool (*generic_event_vec[128])( Display * /* dpy */, XGenericEventCookie * /* Xlib event */, xEvent * /* wire event */); /* vector for event copy, index is (extension - 128) */ Bool (*generic_event_copy_vec[128])( Display * /* dpy */, XGenericEventCookie * /* in */, XGenericEventCookie * /* out*/); void *cookiejar; /* cookie events returned but not claimed */ #ifndef LONG64 unsigned long last_request_read_upper32bit; unsigned long request_upper32bit; #endif struct _XErrorThreadInfo *error_threads; }; #define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n) /* * access "last_request_read" and "request" with 64bit * warning: the value argument of the SET-macros must not * have any side-effects because it may get called twice. */ #ifndef LONG64 /* accessors for 32-bit unsigned long */ #define X_DPY_GET_REQUEST(dpy) \ ( \ ((uint64_t)(((struct _XDisplay*)dpy)->request)) \ + (((uint64_t)(((struct _XDisplay*)dpy)->request_upper32bit)) << 32) \ ) #define X_DPY_SET_REQUEST(dpy, value) \ ( \ (((struct _XDisplay*)dpy)->request = \ (value) & 0xFFFFFFFFUL), \ (((struct _XDisplay*)dpy)->request_upper32bit = \ ((uint64_t)(value)) >> 32), \ (void)0 /* don't use the result */ \ ) #define X_DPY_GET_LAST_REQUEST_READ(dpy) \ ( \ ((uint64_t)(((struct _XDisplay*)dpy)->last_request_read)) \ + ( \ ((uint64_t)( \ ((struct _XDisplay*)dpy)->last_request_read_upper32bit \ )) << 32 \ ) \ ) #define X_DPY_SET_LAST_REQUEST_READ(dpy, value) \ ( \ (((struct _XDisplay*)dpy)->last_request_read = \ (value) & 0xFFFFFFFFUL), \ (((struct _XDisplay*)dpy)->last_request_read_upper32bit = \ ((uint64_t)(value)) >> 32), \ (void)0 /* don't use the result */ \ ) /* * widen a 32-bit sequence number to a 64 sequence number. * This macro makes the following assumptions: * - ulseq refers to a sequence that has already been sent * - ulseq means the most recent possible sequence number * with these lower 32 bits. * * The following optimization is used: * The comparison result is taken a 0 or 1 to avoid a branch. */ #define X_DPY_WIDEN_UNSIGNED_LONG_SEQ(dpy, ulseq) \ ( \ ((uint64_t)ulseq) \ + \ (( \ ((uint64_t)(((struct _XDisplay*)dpy)->request_upper32bit)) \ - (uint64_t)( \ (ulseq) > (((struct _XDisplay*)dpy)->request) \ ) \ ) << 32) \ ) #define X_DPY_REQUEST_INCREMENT(dpy) \ ( \ ((struct _XDisplay*)dpy)->request++, \ ( \ (((struct _XDisplay*)dpy)->request == 0) ? ( \ ((struct _XDisplay*)dpy)->request_upper32bit++ \ ) : 0 \ ), \ (void)0 /* don't use the result */ \ ) #define X_DPY_REQUEST_DECREMENT(dpy) \ ( \ ( \ (((struct _XDisplay*)dpy)->request == 0) ? (\ ((struct _XDisplay*)dpy)->request--, /* wrap */ \ ((struct _XDisplay*)dpy)->request_upper32bit-- \ ) : ( \ ((struct _XDisplay*)dpy)->request-- \ ) \ ), \ (void)0 /* don't use the result */ \ ) #else /* accessors for 64-bit unsigned long */ #define X_DPY_GET_REQUEST(dpy) \ (((struct _XDisplay*)dpy)->request) #define X_DPY_SET_REQUEST(dpy, value) \ ((struct _XDisplay*)dpy)->request = (value) #define X_DPY_GET_LAST_REQUEST_READ(dpy) \ (((struct _XDisplay*)dpy)->last_request_read) #define X_DPY_SET_LAST_REQUEST_READ(dpy, value) \ ((struct _XDisplay*)dpy)->last_request_read = (value) #define X_DPY_WIDEN_UNSIGNED_LONG_SEQ(dpy, ulseq) ulseq #define X_DPY_REQUEST_INCREMENT(dpy) ((struct _XDisplay*)dpy)->request++ #define X_DPY_REQUEST_DECREMENT(dpy) ((struct _XDisplay*)dpy)->request-- #endif #ifndef _XEVENT_ /* * _QEvent datatype for use in input queueing. */ typedef struct _XSQEvent { struct _XSQEvent *next; XEvent event; unsigned long qserial_num; /* so multi-threaded code can find new ones */ } _XQEvent; #endif #include #ifdef __sgi #define _SGI_MP_SOURCE /* turn this on to get MP safe errno */ #endif #include #define _XBCOPYFUNC _Xbcopy #include #include /* Utek leaves kernel macros around in include files (bleah) */ #ifdef dirty #undef dirty #endif #include #include #include _XFUNCPROTOBEGIN /* * The following definitions can be used for locking requests in multi-threaded * address spaces. */ #ifdef XTHREADS /* Author: Stephen Gildea, MIT X Consortium * * declarations for C Threads locking */ typedef struct _LockInfoRec *LockInfoPtr; /* interfaces for locking.c */ struct _XLockPtrs { /* used by all, including extensions; do not move */ void (*lock_display)( Display *dpy #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char *file , int line #endif ); void (*unlock_display)( Display *dpy #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char *file , int line #endif ); }; #if defined(WIN32) && !defined(_XLIBINT_) #define _XCreateMutex_fn (*_XCreateMutex_fn_p) #define _XFreeMutex_fn (*_XFreeMutex_fn_p) #define _XLockMutex_fn (*_XLockMutex_fn_p) #define _XUnlockMutex_fn (*_XUnlockMutex_fn_p) #define _Xglobal_lock (*_Xglobal_lock_p) #endif /* in XlibInt.c */ extern void (*_XCreateMutex_fn)( LockInfoPtr /* lock */ ); extern void (*_XFreeMutex_fn)( LockInfoPtr /* lock */ ); extern void (*_XLockMutex_fn)( LockInfoPtr /* lock */ #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char * /* file */ , int /* line */ #endif ); extern void (*_XUnlockMutex_fn)( LockInfoPtr /* lock */ #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char * /* file */ , int /* line */ #endif ); extern LockInfoPtr _Xglobal_lock; #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) #define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)((d),__FILE__,__LINE__) #define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)((d),__FILE__,__LINE__) #define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock,__FILE__,__LINE__) #define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock,__FILE__,__LINE__) #else /* used everywhere, so must be fast if not using threads */ #define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)(d) #define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)(d) #define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock) #define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock) #endif #define _XCreateMutex(lock) if (_XCreateMutex_fn) (*_XCreateMutex_fn)(lock); #define _XFreeMutex(lock) if (_XFreeMutex_fn) (*_XFreeMutex_fn)(lock); #else /* XTHREADS */ #define LockDisplay(dis) #define _XLockMutex(lock) #define _XUnlockMutex(lock) #define UnlockDisplay(dis) #define _XCreateMutex(lock) #define _XFreeMutex(lock) #endif #define Xfree(ptr) free((ptr)) /* * Note that some machines do not return a valid pointer for malloc(0), in * which case we provide an alternate under the control of the * define MALLOC_0_RETURNS_NULL. This is necessary because some * Xlib code expects malloc(0) to return a valid pointer to storage. */ #if defined(MALLOC_0_RETURNS_NULL) || defined(__clang_analyzer__) # define Xmalloc(size) malloc(((size) == 0 ? 1 : (size))) # define Xrealloc(ptr, size) realloc((ptr), ((size) == 0 ? 1 : (size))) # define Xcalloc(nelem, elsize) calloc(((nelem) == 0 ? 1 : (nelem)), (elsize)) #else # define Xmalloc(size) malloc((size)) # define Xrealloc(ptr, size) realloc((ptr), (size)) # define Xcalloc(nelem, elsize) calloc((nelem), (elsize)) #endif #include #define LOCKED 1 #define UNLOCKED 0 #ifndef BUFSIZE #define BUFSIZE 2048 /* X output buffer size. */ #endif #ifndef PTSPERBATCH #define PTSPERBATCH 1024 /* point batching */ #endif #ifndef WLNSPERBATCH #define WLNSPERBATCH 50 /* wide line batching */ #endif #ifndef ZLNSPERBATCH #define ZLNSPERBATCH 1024 /* thin line batching */ #endif #ifndef WRCTSPERBATCH #define WRCTSPERBATCH 10 /* wide line rectangle batching */ #endif #ifndef ZRCTSPERBATCH #define ZRCTSPERBATCH 256 /* thin line rectangle batching */ #endif #ifndef FRCTSPERBATCH #define FRCTSPERBATCH 256 /* filled rectangle batching */ #endif #ifndef FARCSPERBATCH #define FARCSPERBATCH 256 /* filled arc batching */ #endif #ifndef CURSORFONT #define CURSORFONT "cursor" /* standard cursor fonts */ #endif /* * Display flags */ #define XlibDisplayIOError (1L << 0) #define XlibDisplayClosing (1L << 1) #define XlibDisplayNoXkb (1L << 2) #define XlibDisplayPrivSync (1L << 3) #define XlibDisplayProcConni (1L << 4) /* in _XProcessInternalConnection */ #define XlibDisplayReadEvents (1L << 5) /* in _XReadEvents */ #define XlibDisplayReply (1L << 5) /* in _XReply */ #define XlibDisplayWriting (1L << 6) /* in _XFlushInt, _XSend */ #define XlibDisplayDfltRMDB (1L << 7) /* mark if RM db from XGetDefault */ /* * X Protocol packetizing macros. */ /* Leftover from CRAY support - was defined empty on all non-Cray systems */ #define WORD64ALIGN /** * Return a len-sized request buffer for the request type. This function may * flush the output queue. * * @param dpy The display connection * @param type The request type * @param len Length of the request in bytes * * @returns A pointer to the request buffer with a few default values * initialized. */ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len); /* GetReqSized is the same as GetReq but allows the caller to specify the * size in bytes. 'sz' must be a multiple of 4! */ #define GetReqSized(name, sz, req) \ req = (x##name##Req *) _XGetRequest(dpy, X_##name, sz) /* * GetReq - Get the next available X request packet in the buffer and * return it. * * "name" is the name of the request, e.g. CreatePixmap, OpenFont, etc. * "req" is the name of the request pointer. * */ #define GetReq(name, req) \ GetReqSized(name, SIZEOF(x##name##Req), req) /* GetReqExtra is the same as GetReq, but allocates "n" additional bytes after the request. "n" must be a multiple of 4! */ #define GetReqExtra(name, n, req) \ GetReqSized(name, SIZEOF(x##name##Req) + n, req) /* * GetResReq is for those requests that have a resource ID * (Window, Pixmap, GContext, etc.) as their single argument. * "rid" is the name of the resource. */ #define GetResReq(name, rid, req) \ req = (xResourceReq *) _XGetRequest(dpy, X_##name, SIZEOF(xResourceReq)); \ req->id = (rid) /* * GetEmptyReq is for those requests that have no arguments * at all. */ #define GetEmptyReq(name, req) \ req = (xReq *) _XGetRequest(dpy, X_##name, SIZEOF(xReq)) /* * MakeBigReq sets the CARD16 "req->length" to 0 and inserts a new CARD32 * length, after req->length, before the data in the request. The new length * includes the "n" extra 32-bit words. * * Do not use MakeBigReq if there is no data already in the request. * req->length must already be >= 2. */ #ifdef LONG64 #define MakeBigReq(req,n) \ { \ CARD64 _BRdat; \ CARD32 _BRlen = req->length - 1; \ req->length = 0; \ _BRdat = ((CARD32 *)req)[_BRlen]; \ memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ ((CARD32 *)req)[1] = _BRlen + n + 2; \ Data32(dpy, &_BRdat, 4); \ } #else #define MakeBigReq(req,n) \ { \ CARD32 _BRdat; \ CARD32 _BRlen = req->length - 1; \ req->length = 0; \ _BRdat = ((CARD32 *)req)[_BRlen]; \ memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ ((CARD32 *)req)[1] = _BRlen + n + 2; \ Data32(dpy, &_BRdat, 4); \ } #endif /* * SetReqLen increases the count of 32-bit words in the request by "n", * or by "badlen" if "n" is too large. * * Do not use SetReqLen if "req" does not already have data after the * xReq header. req->length must already be >= 2. */ #ifndef __clang_analyzer__ #define SetReqLen(req,n,badlen) \ if ((req->length + n) > (unsigned)65535) { \ if (dpy->bigreq_size) { \ MakeBigReq(req,n) \ } else { \ n = badlen; \ req->length += n; \ } \ } else \ req->length += n #else #define SetReqLen(req,n,badlen) \ req->length += n #endif #define SyncHandle() \ if (dpy->synchandler) (*dpy->synchandler)(dpy) extern void _XFlushGCCache(Display *dpy, GC gc); #define FlushGC(dpy, gc) \ if ((gc)->dirty) _XFlushGCCache((dpy), (gc)) /* * Data - Place data in the buffer and pad the end to provide * 32 bit word alignment. Transmit if the buffer fills. * * "dpy" is a pointer to a Display. * "data" is a pointer to a data buffer. * "len" is the length of the data buffer. */ #ifndef DataRoutineIsProcedure #define Data(dpy, data, len) {\ if (dpy->bufptr + (len) <= dpy->bufmax) {\ memcpy(dpy->bufptr, data, (int)len);\ dpy->bufptr += ((len) + 3) & ~3;\ } else\ _XSend(dpy, data, len);\ } #endif /* DataRoutineIsProcedure */ /* Allocate bytes from the buffer. No padding is done, so if * the length is not a multiple of 4, the caller must be * careful to leave the buffer aligned after sending the * current request. * * "type" is the type of the pointer being assigned to. * "ptr" is the pointer being assigned to. * "n" is the number of bytes to allocate. * * Example: * xTextElt *elt; * BufAlloc (xTextElt *, elt, nbytes) */ #define BufAlloc(type, ptr, n) \ if (dpy->bufptr + (n) > dpy->bufmax) \ _XFlush (dpy); \ ptr = (type) dpy->bufptr; \ memset(ptr, '\0', n); \ dpy->bufptr += (n); #define Data16(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len)) #define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len)) #define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len)) #ifdef LONG64 #define Data32(dpy, data, len) _XData32(dpy, (_Xconst long *)data, len) extern int _XData32( Display *dpy, register _Xconst long *data, unsigned len ); extern void _XRead32( Display *dpy, register long *data, long len ); #else #define Data32(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len)) #define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len)) #endif #define PackData16(dpy,data,len) Data16 (dpy, data, len) #define PackData32(dpy,data,len) Data32 (dpy, data, len) /* Xlib manual is bogus */ #define PackData(dpy,data,len) PackData16 (dpy, data, len) #define min(a,b) (((a) < (b)) ? (a) : (b)) #define max(a,b) (((a) > (b)) ? (a) : (b)) #define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \ (((cs)->rbearing|(cs)->lbearing| \ (cs)->ascent|(cs)->descent) == 0)) /* * CI_GET_CHAR_INFO_1D - return the charinfo struct for the indicated 8bit * character. If the character is in the column and exists, then return the * appropriate metrics (note that fonts with common per-character metrics will * return min_bounds). If none of these hold true, try again with the default * char. */ #define CI_GET_CHAR_INFO_1D(fs,col,def,cs) \ { \ cs = def; \ if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ if (fs->per_char == NULL) { \ cs = &fs->min_bounds; \ } else { \ cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \ if (CI_NONEXISTCHAR(cs)) cs = def; \ } \ } \ } #define CI_GET_DEFAULT_INFO_1D(fs,cs) \ CI_GET_CHAR_INFO_1D (fs, fs->default_char, NULL, cs) /* * CI_GET_CHAR_INFO_2D - return the charinfo struct for the indicated row and * column. This is used for fonts that have more than row zero. */ #define CI_GET_CHAR_INFO_2D(fs,row,col,def,cs) \ { \ cs = def; \ if (row >= fs->min_byte1 && row <= fs->max_byte1 && \ col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ if (fs->per_char == NULL) { \ cs = &fs->min_bounds; \ } else { \ cs = &fs->per_char[((row - fs->min_byte1) * \ (fs->max_char_or_byte2 - \ fs->min_char_or_byte2 + 1)) + \ (col - fs->min_char_or_byte2)]; \ if (CI_NONEXISTCHAR(cs)) cs = def; \ } \ } \ } #define CI_GET_DEFAULT_INFO_2D(fs,cs) \ { \ unsigned int r = (fs->default_char >> 8); \ unsigned int c = (fs->default_char & 0xff); \ CI_GET_CHAR_INFO_2D (fs, r, c, NULL, cs); \ } /* srcvar must be a variable for large architecture version */ #define OneDataCard32(dpy,dstaddr,srcvar) \ { *(CARD32 *)(dstaddr) = (srcvar); } typedef struct _XInternalAsync { struct _XInternalAsync *next; /* * handler arguments: * rep is the generic reply that caused this handler * to be invoked. It must also be passed to _XGetAsyncReply. * buf and len are opaque values that must be passed to * _XGetAsyncReply or _XGetAsyncData. * data is the closure stored in this struct. * The handler returns True iff it handled this reply. */ Bool (*handler)( Display* /* dpy */, xReply* /* rep */, char* /* buf */, int /* len */, XPointer /* data */ ); XPointer data; } _XAsyncHandler; /* * This struct is part of the ABI and is defined by value * in user-code. This means that we cannot make * the sequence-numbers 64bit. */ typedef struct _XAsyncEState { unsigned long min_sequence_number; unsigned long max_sequence_number; unsigned char error_code; unsigned char major_opcode; unsigned short minor_opcode; unsigned char last_error_received; int error_count; } _XAsyncErrorState; extern void _XDeqAsyncHandler(Display *dpy, _XAsyncHandler *handler); #define DeqAsyncHandler(dpy,handler) { \ if (dpy->async_handlers == (handler)) \ dpy->async_handlers = (handler)->next; \ else \ _XDeqAsyncHandler(dpy, handler); \ } typedef void (*FreeFuncType) ( Display* /* display */ ); typedef int (*FreeModmapType) ( XModifierKeymap* /* modmap */ ); /* * This structure is private to the library. */ typedef struct _XFreeFuncs { FreeFuncType atoms; /* _XFreeAtomTable */ FreeModmapType modifiermap; /* XFreeModifiermap */ FreeFuncType key_bindings; /* _XFreeKeyBindings */ FreeFuncType context_db; /* _XFreeContextDB */ FreeFuncType defaultCCCs; /* _XcmsFreeDefaultCCCs */ FreeFuncType clientCmaps; /* _XcmsFreeClientCmaps */ FreeFuncType intensityMaps; /* _XcmsFreeIntensityMaps */ FreeFuncType im_filters; /* _XFreeIMFilters */ FreeFuncType xkb; /* _XkbFreeInfo */ } _XFreeFuncRec; /* types for InitExt.c */ typedef int (*CreateGCType) ( Display* /* display */, GC /* gc */, XExtCodes* /* codes */ ); typedef int (*CopyGCType)( Display* /* display */, GC /* gc */, XExtCodes* /* codes */ ); typedef int (*FlushGCType) ( Display* /* display */, GC /* gc */, XExtCodes* /* codes */ ); typedef int (*FreeGCType) ( Display* /* display */, GC /* gc */, XExtCodes* /* codes */ ); typedef int (*CreateFontType) ( Display* /* display */, XFontStruct* /* fs */, XExtCodes* /* codes */ ); typedef int (*FreeFontType) ( Display* /* display */, XFontStruct* /* fs */, XExtCodes* /* codes */ ); typedef int (*CloseDisplayType) ( Display* /* display */, XExtCodes* /* codes */ ); typedef int (*ErrorType) ( Display* /* display */, xError* /* err */, XExtCodes* /* codes */, int* /* ret_code */ ); typedef char* (*ErrorStringType) ( Display* /* display */, int /* code */, XExtCodes* /* codes */, char* /* buffer */, int /* nbytes */ ); typedef void (*PrintErrorType)( Display* /* display */, XErrorEvent* /* ev */, void* /* fp */ ); typedef void (*BeforeFlushType)( Display* /* display */, XExtCodes* /* codes */, _Xconst char* /* data */, long /* len */ ); /* * This structure is private to the library. */ typedef struct _XExten { /* private to extension mechanism */ struct _XExten *next; /* next in list */ XExtCodes codes; /* public information, all extension told */ CreateGCType create_GC; /* routine to call when GC created */ CopyGCType copy_GC; /* routine to call when GC copied */ FlushGCType flush_GC; /* routine to call when GC flushed */ FreeGCType free_GC; /* routine to call when GC freed */ CreateFontType create_Font; /* routine to call when Font created */ FreeFontType free_Font; /* routine to call when Font freed */ CloseDisplayType close_display; /* routine to call when connection closed */ ErrorType error; /* who to call when an error occurs */ ErrorStringType error_string; /* routine to supply error string */ char *name; /* name of this extension */ PrintErrorType error_values; /* routine to supply error values */ BeforeFlushType before_flush; /* routine to call when sending data */ struct _XExten *next_flush; /* next in list of those with flushes */ } _XExtension; /* Temporary definition until we can depend on an xproto release with it */ #ifdef _X_COLD # define _XLIB_COLD _X_COLD #elif defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403) /* 4.3+ */ # define _XLIB_COLD __attribute__((__cold__)) #else # define _XLIB_COLD /* nothing */ #endif /* extension hooks */ #ifdef DataRoutineIsProcedure extern void Data(Display *dpy, char *data, long len); #endif extern int _XError( Display* /* dpy */, xError* /* rep */ ); extern int _XIOError( Display* /* dpy */ ) _X_NORETURN; extern int (*_XIOErrorFunction)( Display* /* dpy */ ); extern int (*_XErrorFunction)( Display* /* dpy */, XErrorEvent* /* error_event */ ); extern void _XEatData( Display* /* dpy */, unsigned long /* n */ ) _XLIB_COLD; extern void _XEatDataWords( Display* /* dpy */, unsigned long /* n */ ) _XLIB_COLD; #if defined(__SUNPRO_C) /* Studio compiler alternative to "cold" attribute */ # pragma rarely_called(_XEatData, _XEatDataWords) #endif extern char *_XAllocScratch( Display* /* dpy */, unsigned long /* nbytes */ ); extern char *_XAllocTemp( Display* /* dpy */, unsigned long /* nbytes */ ); extern void _XFreeTemp( Display* /* dpy */, char* /* buf */, unsigned long /* nbytes */ ); extern Visual *_XVIDtoVisual( Display* /* dpy */, VisualID /* id */ ); extern unsigned long _XSetLastRequestRead( Display* /* dpy */, xGenericReply* /* rep */ ); extern int _XGetHostname( char* /* buf */, int /* maxlen */ ); extern Screen *_XScreenOfWindow( Display* /* dpy */, Window /* w */ ); extern Bool _XAsyncErrorHandler( Display* /* dpy */, xReply* /* rep */, char* /* buf */, int /* len */, XPointer /* data */ ); extern char *_XGetAsyncReply( Display* /* dpy */, char* /* replbuf */, xReply* /* rep */, char* /* buf */, int /* len */, int /* extra */, Bool /* discard */ ); extern void _XGetAsyncData( Display* /* dpy */, char * /* data */, char * /* buf */, int /* len */, int /* skip */, int /* datalen */, int /* discardtotal */ ); extern void _XFlush( Display* /* dpy */ ); extern int _XEventsQueued( Display* /* dpy */, int /* mode */ ); extern void _XReadEvents( Display* /* dpy */ ); extern int _XRead( Display* /* dpy */, char* /* data */, long /* size */ ); extern void _XReadPad( Display* /* dpy */, char* /* data */, long /* size */ ); extern void _XSend( Display* /* dpy */, _Xconst char* /* data */, long /* size */ ); extern Status _XReply( Display* /* dpy */, xReply* /* rep */, int /* extra */, Bool /* discard */ ); extern void _XEnq( Display* /* dpy */, xEvent* /* event */ ); extern void _XDeq( Display* /* dpy */, _XQEvent* /* prev */, _XQEvent* /* qelt */ ); extern Bool _XUnknownWireEvent( Display* /* dpy */, XEvent* /* re */, xEvent* /* event */ ); extern Bool _XUnknownWireEventCookie( Display* /* dpy */, XGenericEventCookie* /* re */, xEvent* /* event */ ); extern Bool _XUnknownCopyEventCookie( Display* /* dpy */, XGenericEventCookie* /* in */, XGenericEventCookie* /* out */ ); extern Status _XUnknownNativeEvent( Display* /* dpy */, XEvent* /* re */, xEvent* /* event */ ); extern Bool _XWireToEvent(Display *dpy, XEvent *re, xEvent *event); extern Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we); extern Bool _XPollfdCacheInit(Display *dpy); extern void _XPollfdCacheAdd(Display *dpy, int fd); extern void _XPollfdCacheDel(Display *dpy, int fd); extern XID _XAllocID(Display *dpy); extern void _XAllocIDs(Display *dpy, XID *ids, int count); extern int _XFreeExtData( XExtData* /* extension */ ); extern int (*XESetCreateGC( Display* /* display */, int /* extension */, int (*) ( Display* /* display */, GC /* gc */, XExtCodes* /* codes */ ) /* proc */ ))( Display*, GC, XExtCodes* ); extern int (*XESetCopyGC( Display* /* display */, int /* extension */, int (*) ( Display* /* display */, GC /* gc */, XExtCodes* /* codes */ ) /* proc */ ))( Display*, GC, XExtCodes* ); extern int (*XESetFlushGC( Display* /* display */, int /* extension */, int (*) ( Display* /* display */, GC /* gc */, XExtCodes* /* codes */ ) /* proc */ ))( Display*, GC, XExtCodes* ); extern int (*XESetFreeGC( Display* /* display */, int /* extension */, int (*) ( Display* /* display */, GC /* gc */, XExtCodes* /* codes */ ) /* proc */ ))( Display*, GC, XExtCodes* ); extern int (*XESetCreateFont( Display* /* display */, int /* extension */, int (*) ( Display* /* display */, XFontStruct* /* fs */, XExtCodes* /* codes */ ) /* proc */ ))( Display*, XFontStruct*, XExtCodes* ); extern int (*XESetFreeFont( Display* /* display */, int /* extension */, int (*) ( Display* /* display */, XFontStruct* /* fs */, XExtCodes* /* codes */ ) /* proc */ ))( Display*, XFontStruct*, XExtCodes* ); extern int (*XESetCloseDisplay( Display* /* display */, int /* extension */, int (*) ( Display* /* display */, XExtCodes* /* codes */ ) /* proc */ ))( Display*, XExtCodes* ); extern int (*XESetError( Display* /* display */, int /* extension */, int (*) ( Display* /* display */, xError* /* err */, XExtCodes* /* codes */, int* /* ret_code */ ) /* proc */ ))( Display*, xError*, XExtCodes*, int* ); extern char* (*XESetErrorString( Display* /* display */, int /* extension */, char* (*) ( Display* /* display */, int /* code */, XExtCodes* /* codes */, char* /* buffer */, int /* nbytes */ ) /* proc */ ))( Display*, int, XExtCodes*, char*, int ); extern void (*XESetPrintErrorValues ( Display* /* display */, int /* extension */, void (*)( Display* /* display */, XErrorEvent* /* ev */, void* /* fp */ ) /* proc */ ))( Display*, XErrorEvent*, void* ); extern Bool (*XESetWireToEvent( Display* /* display */, int /* event_number */, Bool (*) ( Display* /* display */, XEvent* /* re */, xEvent* /* event */ ) /* proc */ ))( Display*, XEvent*, xEvent* ); extern Bool (*XESetWireToEventCookie( Display* /* display */, int /* extension */, Bool (*) ( Display* /* display */, XGenericEventCookie* /* re */, xEvent* /* event */ ) /* proc */ ))( Display*, XGenericEventCookie*, xEvent* ); extern Bool (*XESetCopyEventCookie( Display* /* display */, int /* extension */, Bool (*) ( Display* /* display */, XGenericEventCookie* /* in */, XGenericEventCookie* /* out */ ) /* proc */ ))( Display*, XGenericEventCookie*, XGenericEventCookie* ); extern Status (*XESetEventToWire( Display* /* display */, int /* event_number */, Status (*) ( Display* /* display */, XEvent* /* re */, xEvent* /* event */ ) /* proc */ ))( Display*, XEvent*, xEvent* ); extern Bool (*XESetWireToError( Display* /* display */, int /* error_number */, Bool (*) ( Display* /* display */, XErrorEvent* /* he */, xError* /* we */ ) /* proc */ ))( Display*, XErrorEvent*, xError* ); extern void (*XESetBeforeFlush( Display* /* display */, int /* error_number */, void (*) ( Display* /* display */, XExtCodes* /* codes */, _Xconst char* /* data */, long /* len */ ) /* proc */ ))( Display*, XExtCodes*, _Xconst char*, long ); /* internal connections for IMs */ typedef void (*_XInternalConnectionProc)( Display* /* dpy */, int /* fd */, XPointer /* call_data */ ); extern Status _XRegisterInternalConnection( Display* /* dpy */, int /* fd */, _XInternalConnectionProc /* callback */, XPointer /* call_data */ ); extern void _XUnregisterInternalConnection( Display* /* dpy */, int /* fd */ ); extern void _XProcessInternalConnection( Display* /* dpy */, struct _XConnectionInfo* /* conn_info */ ); /* Display structure has pointers to these */ struct _XConnectionInfo { /* info from _XRegisterInternalConnection */ int fd; _XInternalConnectionProc read_callback; XPointer call_data; XPointer *watch_data; /* set/used by XConnectionWatchProc */ struct _XConnectionInfo *next; }; struct _XConnWatchInfo { /* info from XAddConnectionWatch */ XConnectionWatchProc fn; XPointer client_data; struct _XConnWatchInfo *next; }; #ifdef __UNIXOS2__ extern char* __XOS2RedirRoot( char* ); #endif extern int _XTextHeight( XFontStruct* /* font_struct */, _Xconst char* /* string */, int /* count */ ); extern int _XTextHeight16( XFontStruct* /* font_struct */, _Xconst XChar2b* /* string */, int /* count */ ); #if defined(WIN32) extern int _XOpenFile( _Xconst char* /* path */, int /* flags */ ); extern int _XOpenFileMode( _Xconst char* /* path */, int /* flags */, mode_t /* mode */ ); extern void* _XFopenFile( _Xconst char* /* path */, _Xconst char* /* mode */ ); extern int _XAccessFile( _Xconst char* /* path */ ); #else #define _XOpenFile(path,flags) open(path,flags) #define _XOpenFileMode(path,flags,mode) open(path,flags,mode) #define _XFopenFile(path,mode) fopen(path,mode) #endif /* EvToWire.c */ extern Status _XEventToWire(Display *dpy, XEvent *re, xEvent *event); extern int _XF86LoadQueryLocaleFont( Display* /* dpy */, _Xconst char* /* name*/, XFontStruct** /* xfp*/, Font* /* fidp */ ); extern void _XProcessWindowAttributes ( register Display *dpy, xChangeWindowAttributesReq *req, register unsigned long valuemask, register XSetWindowAttributes *attributes); extern int _XDefaultError( Display *dpy, XErrorEvent *event); extern int _XDefaultIOError( Display *dpy); extern void _XSetClipRectangles ( register Display *dpy, GC gc, int clip_x_origin, int clip_y_origin, XRectangle *rectangles, int n, int ordering); Status _XGetWindowAttributes( register Display *dpy, Window w, XWindowAttributes *attr); int _XPutBackEvent ( register Display *dpy, register XEvent *event); extern Bool _XIsEventCookie( Display *dpy, XEvent *ev); extern void _XFreeEventCookies( Display *dpy); extern void _XStoreEventCookie( Display *dpy, XEvent *ev); extern Bool _XFetchEventCookie( Display *dpy, XGenericEventCookie *ev); extern Bool _XCopyEventCookie( Display *dpy, XGenericEventCookie *in, XGenericEventCookie *out); /* lcFile.c */ extern void xlocaledir( char *buf, int buf_len ); #ifdef __clang__ #pragma clang diagnostic pop #endif _XFUNCPROTOEND #endif /* _X11_XLIBINT_H_ */ X11/fonts/fontproto.h000064400000006607147631660250010474 0ustar00/*********************************************************** Copyright (c) 1999 The XFree86 Project Inc. All Rights Reserved. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The XFree86 Project Inc. shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The XFree86 Project Inc.. */ #ifndef _FONTPROTO_H #define _FONTPROTO_H #include /* Externally provided functions required by libXfont */ extern _X_EXPORT int RegisterFPEFunctions ( NameCheckFunc name_func, InitFpeFunc init_func, FreeFpeFunc free_func, ResetFpeFunc reset_func, OpenFontFunc open_func, CloseFontFunc close_func, ListFontsFunc list_func, StartLfwiFunc start_lfwi_func, NextLfwiFunc next_lfwi_func, WakeupFpeFunc wakeup_func, ClientDiedFunc client_died, LoadGlyphsFunc load_glyphs, StartLaFunc start_list_alias_func, NextLaFunc next_list_alias_func, SetPathFunc set_path_func); extern _X_EXPORT int GetDefaultPointSize ( void ); extern _X_EXPORT int init_fs_handlers ( FontPathElementPtr fpe, BlockHandlerProcPtr block_handler); extern _X_EXPORT void remove_fs_handlers ( FontPathElementPtr fpe, BlockHandlerProcPtr block_handler, Bool all ); extern _X_EXPORT int client_auth_generation ( ClientPtr client ); #ifndef ___CLIENTSIGNAL_DEFINED___ #define ___CLIENTSIGNAL_DEFINED___ extern Bool ClientSignal ( ClientPtr client ); #endif /* ___CLIENTSIGNAL_DEFINED___ */ extern _X_EXPORT void DeleteFontClientID ( Font id ); extern _X_EXPORT Font GetNewFontClientID ( void ); extern _X_EXPORT int StoreFontClientFont ( FontPtr pfont, Font id ); extern _X_EXPORT void FontFileRegisterFpeFunctions ( void ); extern _X_EXPORT void FontFileCheckRegisterFpeFunctions ( void ); extern Bool XpClientIsBitmapClient ( ClientPtr client ); extern Bool XpClientIsPrintClient( ClientPtr client, FontPathElementPtr fpe ); extern void PrinterFontRegisterFpeFunctions ( void ); extern void fs_register_fpe_functions ( void ); extern void check_fs_register_fpe_functions ( void ); /* util/private.c */ extern FontPtr CreateFontRec (void); extern void DestroyFontRec (FontPtr font); extern Bool _FontSetNewPrivate (FontPtr /* pFont */, int /* n */, void * /* ptr */); extern int AllocateFontPrivateIndex (void); extern void ResetFontPrivateIndex (void); /* Type1/t1funcs.c */ extern void Type1RegisterFontFileFunctions(void); extern void CIDRegisterFontFileFunctions(void); /* Speedo/spfuncs.c */ extern void SpeedoRegisterFontFileFunctions(void); /* FreeType/ftfuncs.c */ extern void FreeTypeRegisterFontFileFunctions(void); #endif X11/fonts/fsmasks.h000064400000007633147631660250010111 0ustar00/* * Copyright 1990, 1991 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of Network Computing Devices or Digital * not be used in advertising or publicity pertaining to distribution * of the software without specific, written prior permission. * Network Computing Devices and Digital make no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES * OR DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ /* Portions Copyright 1987, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * masks & values used by the font lib and the font server */ #ifndef _FSMASKS_H_ #define _FSMASKS_H_ #include /* font format macros */ #define BitmapFormatByteOrderMask (1L << 0) #define BitmapFormatBitOrderMask (1L << 1) #define BitmapFormatImageRectMask (3L << 2) #define BitmapFormatScanlinePadMask (3L << 8) #define BitmapFormatScanlineUnitMask (3L << 12) #define BitmapFormatByteOrderLSB (0) #define BitmapFormatByteOrderMSB (1L << 0) #define BitmapFormatBitOrderLSB (0) #define BitmapFormatBitOrderMSB (1L << 1) #define BitmapFormatImageRectMin (0L << 2) #define BitmapFormatImageRectMaxWidth (1L << 2) #define BitmapFormatImageRectMax (2L << 2) #define BitmapFormatScanlinePad8 (0L << 8) #define BitmapFormatScanlinePad16 (1L << 8) #define BitmapFormatScanlinePad32 (2L << 8) #define BitmapFormatScanlinePad64 (3L << 8) #define BitmapFormatScanlineUnit8 (0L << 12) #define BitmapFormatScanlineUnit16 (1L << 12) #define BitmapFormatScanlineUnit32 (2L << 12) #define BitmapFormatScanlineUnit64 (3L << 12) #define BitmapFormatMaskByte (1L << 0) #define BitmapFormatMaskBit (1L << 1) #define BitmapFormatMaskImageRectangle (1L << 2) #define BitmapFormatMaskScanLinePad (1L << 3) #define BitmapFormatMaskScanLineUnit (1L << 4) typedef CARD32 fsBitmapFormat; typedef CARD32 fsBitmapFormatMask; #endif /* _FSMASKS_H_ */ X11/fonts/font.h000064400000010235147631660250007400 0ustar00/*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef FONT_H #define FONT_H #include #ifndef BitmapFormatByteOrderMask #include "fsmasks.h" #endif /* data structures */ #ifndef _XTYPEDEF_FONTPTR typedef struct _Font *FontPtr; #define _XTYPEDEF_FONTPTR #endif typedef struct _FontInfo *FontInfoPtr; typedef struct _FontProp *FontPropPtr; typedef struct _ExtentInfo *ExtentInfoPtr; typedef struct _FontPathElement *FontPathElementPtr; #ifndef _XTYPEDEF_CHARINFOPTR typedef struct _CharInfo *CharInfoPtr; #define _XTYPEDEF_CHARINFOPTR #endif typedef struct _FontNames *FontNamesPtr; typedef struct _FontResolution *FontResolutionPtr; #define NullCharInfo ((CharInfoPtr) 0) #define NullFont ((FontPtr) 0) #define NullFontInfo ((FontInfoPtr) 0) /* draw direction */ #define LeftToRight 0 #define RightToLeft 1 #define BottomToTop 2 #define TopToBottom 3 typedef int DrawDirection; #define NO_SUCH_CHAR -1 #define FontAliasType 0x1000 #define AllocError 80 #define StillWorking 81 #define FontNameAlias 82 #define BadFontName 83 #define Suspended 84 #define Successful 85 #define BadFontPath 86 #define BadCharRange 87 #define BadFontFormat 88 #define FPEResetFailed 89 /* for when an FPE reset won't work */ /* OpenFont flags */ #define FontLoadInfo 0x0001 #define FontLoadProps 0x0002 #define FontLoadMetrics 0x0004 #define FontLoadBitmaps 0x0008 #define FontLoadAll 0x000f #define FontOpenSync 0x0010 #define FontReopen 0x0020 /* Query flags */ #define LoadAll 0x1 #define FinishRamge 0x2 #define EightBitFont 0x4 #define SixteenBitFont 0x8 /* Glyph Caching Modes */ #define CACHING_OFF 0 #define CACHE_16_BIT_GLYPHS 1 #define CACHE_ALL_GLYPHS 2 #define DEFAULT_GLYPH_CACHING_MODE CACHE_16_BIT_GLYPHS extern int glyphCachingMode; struct _Client; extern int StartListFontsWithInfo( struct _Client * /*client*/, int /*length*/, unsigned char * /*pattern*/, int /*max_names*/ ); extern FontNamesPtr MakeFontNamesRecord( unsigned /* size */ ); extern void FreeFontNames( FontNamesPtr /* pFN*/ ); extern int AddFontNamesName( FontNamesPtr /* names */, char * /* name */, int /* length */ ); #if 0 /* unused */ extern int FontToFSError(); extern FontResolutionPtr GetClientResolution(); #endif typedef struct _FontPatternCache *FontPatternCachePtr; extern FontPatternCachePtr MakeFontPatternCache ( void ); extern void FreeFontPatternCache ( FontPatternCachePtr /* cache */ ); extern void EmptyFontPatternCache ( FontPatternCachePtr /* cache */ ); extern void CacheFontPattern ( FontPatternCachePtr /* cache */, const char * /* pattern */, int /* patlen */, FontPtr /* pFont */ ); extern _X_EXPORT FontResolutionPtr GetClientResolutions( int * /* num */ ); extern FontPtr FindCachedFontPattern ( FontPatternCachePtr /* cache */, const char * /* pattern */, int /* patlen */ ); extern void RemoveCachedFontPattern ( FontPatternCachePtr /* cache */, FontPtr /* pFont */ ); typedef enum { Linear8Bit, TwoD8Bit, Linear16Bit, TwoD16Bit } FontEncoding; #endif /* FONT_H */ X11/fonts/FS.h000064400000007756147631660250006760 0ustar00/* * Copyright 1990, 1991 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of Network Computing Devices or Digital * not be used in advertising or publicity pertaining to distribution * of the software without specific, written prior permission. * Network Computing Devices and Digital make no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES * OR DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ /* Portions Copyright 1987, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _FS_H_ #define _FS_H_ #include #include #define FS_PROTOCOL 2 #define FS_PROTOCOL_MINOR 0 #ifndef X_PROTOCOL /* protocol familes */ #define FamilyInternet 0 #define FamilyDECnet 1 #define FamilyChaos 2 #define FamilyInternet6 6 typedef unsigned int FSDrawDirection; #endif #ifndef None #define None 0L #endif #define LeftToRightDrawDirection 0 #define RightToLeftDrawDirection 1 /* font info flags */ #define FontInfoAllCharsExist (1L << 0) #define FontInfoInkInside (1L << 1) #define FontInfoHorizontalOverlap (1L << 2) /* auth status flags */ #define AuthSuccess 0 #define AuthContinue 1 #define AuthBusy 2 #define AuthDenied 3 /* property types */ #define PropTypeString 0 #define PropTypeUnsigned 1 #define PropTypeSigned 2 #ifndef LSBFirst /* byte order */ #define LSBFirst 0 #define MSBFirst 1 #endif /* event masks */ #define CatalogueChangeNotifyMask (1L << 0) #define FontChangeNotifyMask (1L << 1) /* errors */ #define FSSuccess -1 #define FSBadRequest 0 #define FSBadFormat 1 #define FSBadFont 2 #define FSBadRange 3 #define FSBadEventMask 4 #define FSBadAccessContext 5 #define FSBadIDChoice 6 #define FSBadName 7 #define FSBadResolution 8 #define FSBadAlloc 9 #define FSBadLength 10 #define FSBadImplementation 11 #define FirstExtensionError 128 #define LastExtensionError 255 /* events */ #define KeepAlive 0 #define CatalogueChangeNotify 1 #define FontChangeNotify 2 #define FSLASTEvent 3 #endif /* _FS_H_ */ X11/fonts/FSproto.h000064400000050023147631660250010025 0ustar00/* Copyright 1990, 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * Copyright 1990, 1991 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of Network Computing Devices, or Digital * not be used in advertising or publicity pertaining to distribution * of the software without specific, written prior permission. * * NETWORK COMPUTING DEVICES, AND DIGITAL DISCLAIM ALL WARRANTIES WITH * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES, * OR DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ #ifndef _FS_PROTO_H_ #define _FS_PROTO_H_ #include #define sz_fsPropOffset 20 #define sz_fsPropInfo 8 #define sz_fsResolution 6 #define sz_fsChar2b 2 #define sz_fsChar2b_version1 2 #define sz_fsOffset32 8 #define sz_fsRange 4 #define sz_fsXCharInfo 12 #define sz_fsXFontInfoHeader 40 #define sz_fsConnClientPrefix 8 #define sz_fsConnSetup 12 #define sz_fsConnSetupExtra 8 #define sz_fsConnSetupAccept 12 /* request sizes */ #define sz_fsReq 4 #define sz_fsListExtensionsReq 4 #define sz_fsResourceReq 8 #define sz_fsNoopReq 4 #define sz_fsListExtensionReq 4 #define sz_fsQueryExtensionReq 4 #define sz_fsListCataloguesReq 12 #define sz_fsSetCataloguesReq 4 #define sz_fsGetCataloguesReq 4 #define sz_fsSetEventMaskReq 8 #define sz_fsGetEventMaskReq 4 #define sz_fsCreateACReq 8 #define sz_fsFreeACReq 8 #define sz_fsSetAuthorizationReq 8 #define sz_fsSetResolutionReq 4 #define sz_fsGetResolutionReq 4 #define sz_fsListFontsReq 12 #define sz_fsListFontsWithXInfoReq 12 #define sz_fsOpenBitmapFontReq 16 #define sz_fsQueryXInfoReq 8 #define sz_fsQueryXExtents8Req 12 #define sz_fsQueryXExtents16Req 12 #define sz_fsQueryXBitmaps8Req 16 #define sz_fsQueryXBitmaps16Req 16 #define sz_fsCloseReq 8 /* reply sizes */ #define sz_fsReply 8 #define sz_fsGenericReply 8 #define sz_fsListExtensionsReply 8 #define sz_fsQueryExtensionReply 20 #define sz_fsListCataloguesReply 16 #define sz_fsGetCataloguesReply 8 #define sz_fsGetEventMaskReply 12 #define sz_fsCreateACReply 12 #define sz_fsGetResolutionReply 8 #define sz_fsListFontsReply 16 #define sz_fsListFontsWithXInfoReply (12 + sz_fsXFontInfoHeader) #define sz_fsOpenBitmapFontReply 16 #define sz_fsQueryXInfoReply (8 + sz_fsXFontInfoHeader) #define sz_fsQueryXExtents8Reply 12 #define sz_fsQueryXExtents16Reply 12 #define sz_fsQueryXBitmaps8Reply 20 #define sz_fsQueryXBitmaps16Reply 20 #define sz_fsError 16 #define sz_fsEvent 12 #define sz_fsKeepAliveEvent 12 #define fsTrue 1 #define fsFalse 0 /* temp decls */ #define Mask CARD32 #define Font CARD32 #define AccContext CARD32 typedef CARD32 fsTimestamp; #ifdef NOTDEF /* in fsmasks.h */ typedef CARD32 fsBitmapFormat; typedef CARD32 fsBitmapFormatMask; #endif #define sz_fsBitmapFormat 4 typedef struct { INT16 left B16, right B16; INT16 width B16; INT16 ascent B16, descent B16; CARD16 attributes B16; } fsXCharInfo; typedef struct { CARD8 high; CARD8 low; } fsChar2b; typedef struct { CARD8 low; CARD8 high; } fsChar2b_version1; typedef struct { CARD8 min_char_high; CARD8 min_char_low; CARD8 max_char_high; CARD8 max_char_low; } fsRange; typedef struct { CARD32 position B32; CARD32 length B32; } fsOffset32; typedef struct { fsOffset32 name; fsOffset32 value; CARD8 type; BYTE pad0; CARD16 pad1 B16; } fsPropOffset; typedef struct { CARD32 num_offsets B32; CARD32 data_len B32; /* offsets */ /* data */ } fsPropInfo; typedef struct { CARD16 x_resolution B16; CARD16 y_resolution B16; CARD16 point_size B16; } fsResolution; typedef struct { CARD32 flags B32; CARD8 char_range_min_char_high; CARD8 char_range_min_char_low; CARD8 char_range_max_char_high; CARD8 char_range_max_char_low; CARD8 draw_direction; CARD8 pad; CARD8 default_char_high; CARD8 default_char_low; INT16 min_bounds_left B16; INT16 min_bounds_right B16; INT16 min_bounds_width B16; INT16 min_bounds_ascent B16; INT16 min_bounds_descent B16; CARD16 min_bounds_attributes B16; INT16 max_bounds_left B16; INT16 max_bounds_right B16; INT16 max_bounds_width B16; INT16 max_bounds_ascent B16; INT16 max_bounds_descent B16; CARD16 max_bounds_attributes B16; INT16 font_ascent B16; INT16 font_descent B16; /* propinfo */ } fsXFontInfoHeader; /* requests */ typedef struct { BYTE byteOrder; CARD8 num_auths; CARD16 major_version B16; CARD16 minor_version B16; CARD16 auth_len B16; /* auth data */ } fsConnClientPrefix; typedef struct { CARD16 status B16; CARD16 major_version B16; CARD16 minor_version B16; CARD8 num_alternates; CARD8 auth_index; CARD16 alternate_len B16; CARD16 auth_len B16; /* alternates */ /* auth data */ } fsConnSetup; typedef struct { CARD32 length B32; CARD16 status B16; CARD16 pad B16; /* more auth data */ } fsConnSetupExtra; typedef struct { CARD32 length B32; CARD16 max_request_len B16; CARD16 vendor_len B16; CARD32 release_number B32; /* vendor string */ } fsConnSetupAccept; typedef struct { CARD8 reqType; CARD8 data; CARD16 length B16; } fsReq; /* * The fsFakeReq structure is never used in the protocol; it is prepended * to incoming packets when setting up a connection so we can index * through InitialVector. To avoid alignment problems, it is padded * to the size of a word on the largest machine this code runs on. * Hence no sz_fsFakeReq constant is necessary. */ typedef struct { CARD8 reqType; CARD8 data; CARD16 length B16; CARD32 pad B32; /* to fill out to multiple of 64 bits */ } fsFakeReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Font id B32; } fsResourceReq; typedef fsReq fsNoopReq; typedef fsReq fsListExtensionsReq; typedef struct { CARD8 reqType; BYTE nbytes; CARD16 length B16; /* name */ } fsQueryExtensionReq; typedef struct { CARD8 reqType; CARD8 data; CARD16 length B16; CARD32 maxNames B32; CARD16 nbytes B16; CARD16 pad2 B16; /* pattern */ } fsListCataloguesReq; typedef struct { CARD8 reqType; BYTE num_catalogues; CARD16 length B16; /* catalogues */ } fsSetCataloguesReq; typedef fsReq fsGetCataloguesReq; typedef struct { CARD8 reqType; CARD8 ext_opcode; CARD16 length B16; Mask event_mask; } fsSetEventMaskReq; typedef struct { CARD8 reqType; CARD8 ext_opcode; CARD16 length B16; } fsGetEventMaskReq; typedef struct { CARD8 reqType; BYTE num_auths; CARD16 length B16; AccContext acid B32; /* auth protocols */ } fsCreateACReq; typedef fsResourceReq fsFreeACReq; typedef fsResourceReq fsSetAuthorizationReq; typedef struct { CARD8 reqType; BYTE num_resolutions; CARD16 length B16; /* resolutions */ } fsSetResolutionReq; typedef fsReq fsGetResolutionReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD32 maxNames B32; CARD16 nbytes B16; CARD16 pad2 B16; /* pattern */ } fsListFontsReq; typedef fsListFontsReq fsListFontsWithXInfoReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Font fid B32; fsBitmapFormatMask format_mask B32; fsBitmapFormat format_hint B32; /* pattern */ } fsOpenBitmapFontReq; typedef fsResourceReq fsQueryXInfoReq; typedef struct { CARD8 reqType; BOOL range; CARD16 length B16; Font fid B32; CARD32 num_ranges B32; /* list of chars */ } fsQueryXExtents8Req; typedef fsQueryXExtents8Req fsQueryXExtents16Req; typedef struct { CARD8 reqType; BOOL range; CARD16 length B16; Font fid B32; fsBitmapFormat format B32; CARD32 num_ranges B32; /* list of chars */ } fsQueryXBitmaps8Req; typedef fsQueryXBitmaps8Req fsQueryXBitmaps16Req; typedef fsResourceReq fsCloseReq; /* replies */ typedef struct { BYTE type; BYTE data1; CARD16 sequenceNumber B16; CARD32 length B32; } fsGenericReply; typedef struct { BYTE type; CARD8 nExtensions; CARD16 sequenceNumber B16; CARD32 length B32; /* extension names */ } fsListExtensionsReply; typedef struct { BYTE type; CARD8 present; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 major_version B16; CARD16 minor_version B16; CARD8 major_opcode; CARD8 first_event; CARD8 num_events; CARD8 first_error; CARD8 num_errors; CARD8 pad1; CARD16 pad2 B16; } fsQueryExtensionReply; typedef struct { BYTE type; BYTE pad; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 num_replies B32; CARD32 num_catalogues B32; /* catalog names */ } fsListCataloguesReply; typedef struct { BYTE type; CARD8 num_catalogues; CARD16 sequenceNumber B16; CARD32 length B32; /* catalogue names */ } fsGetCataloguesReply; typedef struct { BYTE type; BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 event_mask B32; } fsGetEventMaskReply; typedef struct { BYTE type; CARD8 auth_index; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 status B16; CARD16 pad B16; /* auth data */ } fsCreateACReply; typedef struct { CARD32 length B32; CARD16 status B16; CARD16 pad B16; /* auth data */ } fsCreateACExtraReply; typedef struct { BYTE type; CARD8 num_resolutions; CARD16 sequenceNumber B16; CARD32 length B32; /* resolutions */ } fsGetResolutionReply; typedef struct { BYTE type; BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 following B32; CARD32 nFonts B32; /* font names */ } fsListFontsReply; /* * this one is messy. the reply itself is variable length (unknown * number of replies) and the contents of each is variable (unknown * number of properties) * */ typedef struct { BYTE type; CARD8 nameLength; /* 0 is end-of-reply */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 nReplies B32; CARD32 font_header_flags B32; CARD8 font_hdr_char_range_min_char_high; CARD8 font_hdr_char_range_min_char_low; CARD8 font_hdr_char_range_max_char_high; CARD8 font_hdr_char_range_max_char_low; CARD8 font_header_draw_direction; CARD8 font_header_pad; CARD8 font_header_default_char_high; CARD8 font_header_default_char_low; INT16 font_header_min_bounds_left B16; INT16 font_header_min_bounds_right B16; INT16 font_header_min_bounds_width B16; INT16 font_header_min_bounds_ascent B16; INT16 font_header_min_bounds_descent B16; CARD16 font_header_min_bounds_attributes B16; INT16 font_header_max_bounds_left B16; INT16 font_header_max_bounds_right B16; INT16 font_header_max_bounds_width B16; INT16 font_header_max_bounds_ascent B16; INT16 font_header_max_bounds_descent B16; CARD16 font_header_max_bounds_attributes B16; INT16 font_header_font_ascent B16; INT16 font_header_font_descent B16; /* propinfo */ /* name */ } fsListFontsWithXInfoReply; typedef struct { BYTE type; CARD8 otherid_valid; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 otherid B32; BYTE cachable; BYTE pad1; CARD16 pad2 B16; } fsOpenBitmapFontReply; typedef struct { BYTE type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 font_header_flags B32; CARD8 font_hdr_char_range_min_char_high; CARD8 font_hdr_char_range_min_char_low; CARD8 font_hdr_char_range_max_char_high; CARD8 font_hdr_char_range_max_char_low; CARD8 font_header_draw_direction; CARD8 font_header_pad; CARD8 font_header_default_char_high; CARD8 font_header_default_char_low; INT16 font_header_min_bounds_left B16; INT16 font_header_min_bounds_right B16; INT16 font_header_min_bounds_width B16; INT16 font_header_min_bounds_ascent B16; INT16 font_header_min_bounds_descent B16; CARD16 font_header_min_bounds_attributes B16; INT16 font_header_max_bounds_left B16; INT16 font_header_max_bounds_right B16; INT16 font_header_max_bounds_width B16; INT16 font_header_max_bounds_ascent B16; INT16 font_header_max_bounds_descent B16; CARD16 font_header_max_bounds_attributes B16; INT16 font_header_font_ascent B16; INT16 font_header_font_descent B16; /* propinfo */ } fsQueryXInfoReply; typedef struct { BYTE type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 num_extents B32; /* extents */ } fsQueryXExtents8Reply; typedef fsQueryXExtents8Reply fsQueryXExtents16Reply; typedef struct { BYTE type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 replies_hint B32; CARD32 num_chars B32; CARD32 nbytes B32; /* offsets */ /* glyphs */ } fsQueryXBitmaps8Reply; typedef fsQueryXBitmaps8Reply fsQueryXBitmaps16Reply; typedef union { fsGenericReply generic; fsListExtensionsReply extensions; fsGetResolutionReply getres; } fsReply; /* errors */ typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; } fsError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; } fsRequestError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; fsBitmapFormat format B32; } fsFormatError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; Font fontid; } fsFontError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; fsRange range; } fsRangeError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; Mask event_mask; } fsEventMaskError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; AccContext acid; } fsAccessContextError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; Font fontid; } fsIDChoiceError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; } fsNameError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; fsResolution resolution; } fsResolutionError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; } fsAllocError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; CARD32 bad_length B32; } fsLengthError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; } fsImplementationError; /* events */ typedef struct { BYTE type; BYTE event_code; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; } fsKeepAliveEvent; typedef struct { BYTE type; BYTE event_code; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; BOOL added; BOOL deleted; CARD16 pad B16; } fsCatalogueChangeNotifyEvent; typedef fsCatalogueChangeNotifyEvent fsFontChangeNotifyEvent; typedef fsCatalogueChangeNotifyEvent fsEvent; /* reply codes */ #define FS_Reply 0 /* normal reply */ #define FS_Error 1 /* error */ #define FS_Event 2 /* request codes */ #define FS_Noop 0 #define FS_ListExtensions 1 #define FS_QueryExtension 2 #define FS_ListCatalogues 3 #define FS_SetCatalogues 4 #define FS_GetCatalogues 5 #define FS_SetEventMask 6 #define FS_GetEventMask 7 #define FS_CreateAC 8 #define FS_FreeAC 9 #define FS_SetAuthorization 10 #define FS_SetResolution 11 #define FS_GetResolution 12 #define FS_ListFonts 13 #define FS_ListFontsWithXInfo 14 #define FS_OpenBitmapFont 15 #define FS_QueryXInfo 16 #define FS_QueryXExtents8 17 #define FS_QueryXExtents16 18 #define FS_QueryXBitmaps8 19 #define FS_QueryXBitmaps16 20 #define FS_CloseFont 21 /* restore decls */ #undef Mask #undef Font #undef AccContext #endif /* _FS_PROTO_H_ */ X11/fonts/fontstruct.h000064400000022271147631660250010650 0ustar00/*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef FONTSTR_H #define FONTSTR_H #include #include "font.h" #include #include /* * This version of the server font data strucutre is only for describing * the in memory data structure. The file structure is not necessarily a * copy of this. That is up to the compiler and the OS layer font loading * machinery. */ #define GLYPHPADOPTIONS 4 /* 1, 2, 4, or 8 */ typedef struct _FontProp { long name; long value; /* assumes ATOM is not larger than INT32 */ } FontPropRec; typedef struct _FontResolution { unsigned short x_resolution; unsigned short y_resolution; unsigned short point_size; } FontResolutionRec; typedef struct _ExtentInfo { DrawDirection drawDirection; int fontAscent; int fontDescent; int overallAscent; int overallDescent; int overallWidth; int overallLeft; int overallRight; } ExtentInfoRec; typedef struct _CharInfo { xCharInfo metrics; /* info preformatted for Queries */ char *bits; /* pointer to glyph image */ } CharInfoRec; /* * Font is created at font load time. It is specific to a single encoding. * e.g. not all of the glyphs in a font may be part of a single encoding. */ typedef struct _FontInfo { unsigned short firstCol; unsigned short lastCol; unsigned short firstRow; unsigned short lastRow; unsigned short defaultCh; unsigned int noOverlap:1; unsigned int terminalFont:1; unsigned int constantMetrics:1; unsigned int constantWidth:1; unsigned int inkInside:1; unsigned int inkMetrics:1; unsigned int allExist:1; unsigned int drawDirection:2; unsigned int cachable:1; unsigned int anamorphic:1; short maxOverlap; short pad; xCharInfo maxbounds; xCharInfo minbounds; xCharInfo ink_maxbounds; xCharInfo ink_minbounds; short fontAscent; short fontDescent; int nprops; FontPropPtr props; char *isStringProp; } FontInfoRec; typedef struct _Font { int refcnt; FontInfoRec info; char bit; char byte; char glyph; char scan; fsBitmapFormat format; int (*get_glyphs) (FontPtr /* font */, unsigned long /* count */, unsigned char * /* chars */, FontEncoding /* encoding */, unsigned long * /* count */, CharInfoPtr * /* glyphs */); int (*get_metrics) (FontPtr /* font */, unsigned long /* count */, unsigned char * /* chars */, FontEncoding /* encoding */, unsigned long * /* count */, xCharInfo ** /* glyphs */); void (*unload_font) (FontPtr /* font */); void (*unload_glyphs) (FontPtr /* font */); FontPathElementPtr fpe; void *svrPrivate; void *fontPrivate; void *fpePrivate; int maxPrivate; void **devPrivates; } FontRec; #define FontGetPrivate(pFont,n) ((n) > (pFont)->maxPrivate ? (void *) 0 : \ (pFont)->devPrivates[n]) #define FontSetPrivate(pFont,n,ptr) ((n) > (pFont)->maxPrivate ? \ _FontSetNewPrivate (pFont, n, ptr) : \ ((((pFont)->devPrivates[n] = (ptr)) != 0) || TRUE)) typedef struct _FontNames { int nnames; int size; int *length; char **names; } FontNamesRec; /* External view of font paths */ typedef struct _FontPathElement { int name_length; #if FONT_PATH_ELEMENT_NAME_CONST const #endif char *name; int type; int refcount; void *private; } FontPathElementRec; typedef Bool (*NameCheckFunc) (const char *name); typedef int (*InitFpeFunc) (FontPathElementPtr fpe); typedef int (*FreeFpeFunc) (FontPathElementPtr fpe); typedef int (*ResetFpeFunc) (FontPathElementPtr fpe); typedef int (*OpenFontFunc) ( void *client, FontPathElementPtr fpe, Mask flags, const char* name, int namelen, fsBitmapFormat format, fsBitmapFormatMask fmask, XID id, FontPtr* pFont, char** aliasName, FontPtr non_cachable_font); typedef void (*CloseFontFunc) (FontPathElementPtr fpe, FontPtr pFont); typedef int (*ListFontsFunc) (void *client, FontPathElementPtr fpe, const char* pat, int len, int max, FontNamesPtr names); typedef int (*StartLfwiFunc) (void *client, FontPathElementPtr fpe, const char* pat, int len, int max, void ** privatep); typedef int (*NextLfwiFunc) (void *client, FontPathElementPtr fpe, char** name, int* namelen, FontInfoPtr* info, int* numFonts, void *private); typedef int (*WakeupFpeFunc) (FontPathElementPtr fpe, unsigned long* LastSelectMask); typedef void (*ClientDiedFunc) (void *client, FontPathElementPtr fpe); typedef int (*LoadGlyphsFunc) (void *client, FontPtr pfont, Bool range_flag, unsigned int nchars, int item_size, unsigned char* data); typedef int (*StartLaFunc) (void *client, FontPathElementPtr fpe, const char* pat, int len, int max, void ** privatep); typedef int (*NextLaFunc) (void *client, FontPathElementPtr fpe, char** namep, int* namelenp, char** resolvedp, int* resolvedlenp, void *private); typedef void (*SetPathFunc)(void); typedef struct _FPEFunctions { NameCheckFunc name_check; InitFpeFunc init_fpe; ResetFpeFunc reset_fpe; FreeFpeFunc free_fpe; OpenFontFunc open_font; CloseFontFunc close_font; ListFontsFunc list_fonts; StartLaFunc start_list_fonts_and_aliases; NextLaFunc list_next_font_or_alias; StartLfwiFunc start_list_fonts_with_info; NextLfwiFunc list_next_font_with_info; WakeupFpeFunc wakeup_fpe; ClientDiedFunc client_died; /* for load_glyphs, range_flag = 0 -> nchars = # of characters in data item_size = bytes/char data = list of characters range_flag = 1 -> nchars = # of fsChar2b's in data item_size is ignored data = list of fsChar2b's */ LoadGlyphsFunc load_glyphs; SetPathFunc set_path_hook; } FPEFunctionsRec, FPEFunctions; /* * Various macros for computing values based on contents of * the above structures */ #define GLYPHWIDTHPIXELS(pci) \ ((pci)->metrics.rightSideBearing - (pci)->metrics.leftSideBearing) #define GLYPHHEIGHTPIXELS(pci) \ ((pci)->metrics.ascent + (pci)->metrics.descent) #define GLYPHWIDTHBYTES(pci) (((GLYPHWIDTHPIXELS(pci))+7) >> 3) #define GLYPHWIDTHPADDED(bc) (((bc)+7) & ~0x7) #define BYTES_PER_ROW(bits, nbytes) \ ((nbytes) == 1 ? (((bits)+7)>>3) /* pad to 1 byte */ \ :(nbytes) == 2 ? ((((bits)+15)>>3)&~1) /* pad to 2 bytes */ \ :(nbytes) == 4 ? ((((bits)+31)>>3)&~3) /* pad to 4 bytes */ \ :(nbytes) == 8 ? ((((bits)+63)>>3)&~7) /* pad to 8 bytes */ \ : 0) #define BYTES_FOR_GLYPH(ci,pad) (GLYPHHEIGHTPIXELS(ci) * \ BYTES_PER_ROW(GLYPHWIDTHPIXELS(ci),pad)) /* * Macros for computing different bounding boxes for fonts; from * the font protocol */ #define FONT_MAX_ASCENT(pi) ((pi)->fontAscent > (pi)->ink_maxbounds.ascent ? \ (pi)->fontAscent : (pi)->ink_maxbounds.ascent) #define FONT_MAX_DESCENT(pi) ((pi)->fontDescent > (pi)->ink_maxbounds.descent ? \ (pi)->fontDescent : (pi)->ink_maxbounds.descent) #define FONT_MAX_HEIGHT(pi) (FONT_MAX_ASCENT(pi) + FONT_MAX_DESCENT(pi)) #define FONT_MIN_LEFT(pi) ((pi)->ink_minbounds.leftSideBearing < 0 ? \ (pi)->ink_minbounds.leftSideBearing : 0) #define FONT_MAX_RIGHT(pi) ((pi)->ink_maxbounds.rightSideBearing > \ (pi)->ink_maxbounds.characterWidth ? \ (pi)->ink_maxbounds.rightSideBearing : \ (pi)->ink_maxbounds.characterWidth) #define FONT_MAX_WIDTH(pi) (FONT_MAX_RIGHT(pi) - FONT_MIN_LEFT(pi)) #include "fontproto.h" #endif /* FONTSTR_H */ cpufreq.h000064400000012434147631660250006400 0ustar00/* * cpufreq.h - definitions for libcpufreq * * Copyright (C) 2004-2009 Dominik Brodowski * * 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, version 2 of the License. * * 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. */ #ifndef __CPUPOWER_CPUFREQ_H__ #define __CPUPOWER_CPUFREQ_H__ struct cpufreq_policy { unsigned long min; unsigned long max; char *governor; }; struct cpufreq_available_governors { char *governor; struct cpufreq_available_governors *next; struct cpufreq_available_governors *first; }; struct cpufreq_available_frequencies { unsigned long frequency; struct cpufreq_available_frequencies *next; struct cpufreq_available_frequencies *first; }; struct cpufreq_affected_cpus { unsigned int cpu; struct cpufreq_affected_cpus *next; struct cpufreq_affected_cpus *first; }; struct cpufreq_stats { unsigned long frequency; unsigned long long time_in_state; struct cpufreq_stats *next; struct cpufreq_stats *first; }; #ifdef __cplusplus extern "C" { #endif /* determine current CPU frequency * - _kernel variant means kernel's opinion of CPU frequency * - _hardware variant means actual hardware CPU frequency, * which is only available to root. * * returns 0 on failure, else frequency in kHz. */ unsigned long cpufreq_get_freq_kernel(unsigned int cpu); unsigned long cpufreq_get_freq_hardware(unsigned int cpu); #define cpufreq_get(cpu) cpufreq_get_freq_kernel(cpu); /* determine CPU transition latency * * returns 0 on failure, else transition latency in 10^(-9) s = nanoseconds */ unsigned long cpufreq_get_transition_latency(unsigned int cpu); /* determine hardware CPU frequency limits * * These may be limited further by thermal, energy or other * considerations by cpufreq policy notifiers in the kernel. */ int cpufreq_get_hardware_limits(unsigned int cpu, unsigned long *min, unsigned long *max); /* determine CPUfreq driver used * * Remember to call cpufreq_put_driver when no longer needed * to avoid memory leakage, please. */ char *cpufreq_get_driver(unsigned int cpu); void cpufreq_put_driver(char *ptr); /* determine CPUfreq policy currently used * * Remember to call cpufreq_put_policy when no longer needed * to avoid memory leakage, please. */ struct cpufreq_policy *cpufreq_get_policy(unsigned int cpu); void cpufreq_put_policy(struct cpufreq_policy *policy); /* determine CPUfreq governors currently available * * may be modified by modprobe'ing or rmmod'ing other governors. Please * free allocated memory by calling cpufreq_put_available_governors * after use. */ struct cpufreq_available_governors *cpufreq_get_available_governors(unsigned int cpu); void cpufreq_put_available_governors( struct cpufreq_available_governors *first); /* determine CPU frequency states available * * Only present on _some_ ->target() cpufreq drivers. For information purposes * only. Please free allocated memory by calling * cpufreq_put_available_frequencies after use. */ struct cpufreq_available_frequencies *cpufreq_get_available_frequencies(unsigned int cpu); void cpufreq_put_available_frequencies( struct cpufreq_available_frequencies *first); /* determine affected CPUs * * Remember to call cpufreq_put_affected_cpus when no longer needed * to avoid memory leakage, please. */ struct cpufreq_affected_cpus *cpufreq_get_affected_cpus(unsigned int cpu); void cpufreq_put_affected_cpus(struct cpufreq_affected_cpus *first); /* determine related CPUs * * Remember to call cpufreq_put_related_cpus when no longer needed * to avoid memory leakage, please. */ struct cpufreq_affected_cpus *cpufreq_get_related_cpus(unsigned int cpu); void cpufreq_put_related_cpus(struct cpufreq_affected_cpus *first); /* determine stats for cpufreq subsystem * * This is not available in all kernel versions or configurations. */ struct cpufreq_stats *cpufreq_get_stats(unsigned int cpu, unsigned long long *total_time); void cpufreq_put_stats(struct cpufreq_stats *stats); unsigned long cpufreq_get_transitions(unsigned int cpu); /* set new cpufreq policy * * Tries to set the passed policy as new policy as close as possible, * but results may differ depending e.g. on governors being available. */ int cpufreq_set_policy(unsigned int cpu, struct cpufreq_policy *policy); /* modify a policy by only changing min/max freq or governor * * Does not check whether result is what was intended. */ int cpufreq_modify_policy_min(unsigned int cpu, unsigned long min_freq); int cpufreq_modify_policy_max(unsigned int cpu, unsigned long max_freq); int cpufreq_modify_policy_governor(unsigned int cpu, char *governor); /* set a specific frequency * * Does only work if userspace governor can be used and no external * interference (other calls to this function or to set/modify_policy) * occurs. Also does not work on ->range() cpufreq drivers. */ int cpufreq_set_frequency(unsigned int cpu, unsigned long target_frequency); #ifdef __cplusplus } #endif #endif /* _CPUFREQ_H */ lzma/index_hash.h000064400000007512147631660250010011 0ustar00/** * \file lzma/index_hash.h * \brief Validate Index by using a hash function * * Hashing makes it possible to use constant amount of memory to validate * Index of arbitrary size. */ /* * Author: Lasse Collin * * This file has been put into the public domain. * You can do whatever you want with this file. * * See ../lzma.h for information about liblzma as a whole. */ #ifndef LZMA_H_INTERNAL # error Never include this file directly. Use instead. #endif /** * \brief Opaque data type to hold the Index hash */ typedef struct lzma_index_hash_s lzma_index_hash; /** * \brief Allocate and initialize a new lzma_index_hash structure * * If index_hash is NULL, a new lzma_index_hash structure is allocated, * initialized, and a pointer to it returned. If allocation fails, NULL * is returned. * * If index_hash is non-NULL, it is reinitialized and the same pointer * returned. In this case, return value cannot be NULL or a different * pointer than the index_hash that was given as an argument. */ extern LZMA_API(lzma_index_hash *) lzma_index_hash_init( lzma_index_hash *index_hash, const lzma_allocator *allocator) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Deallocate lzma_index_hash structure */ extern LZMA_API(void) lzma_index_hash_end( lzma_index_hash *index_hash, const lzma_allocator *allocator) lzma_nothrow; /** * \brief Add a new Record to an Index hash * * \param index Pointer to a lzma_index_hash structure * \param unpadded_size Unpadded Size of a Block * \param uncompressed_size Uncompressed Size of a Block * * \return - LZMA_OK * - LZMA_DATA_ERROR: Compressed or uncompressed size of the * Stream or size of the Index field would grow too big. * - LZMA_PROG_ERROR: Invalid arguments or this function is being * used when lzma_index_hash_decode() has already been used. */ extern LZMA_API(lzma_ret) lzma_index_hash_append(lzma_index_hash *index_hash, lzma_vli unpadded_size, lzma_vli uncompressed_size) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Decode and validate the Index field * * After telling the sizes of all Blocks with lzma_index_hash_append(), * the actual Index field is decoded with this function. Specifically, * once decoding of the Index field has been started, no more Records * can be added using lzma_index_hash_append(). * * This function doesn't use lzma_stream structure to pass the input data. * Instead, the input buffer is specified using three arguments. This is * because it matches better the internal APIs of liblzma. * * \param index_hash Pointer to a lzma_index_hash structure * \param in Pointer to the beginning of the input buffer * \param in_pos in[*in_pos] is the next byte to process * \param in_size in[in_size] is the first byte not to process * * \return - LZMA_OK: So far good, but more input is needed. * - LZMA_STREAM_END: Index decoded successfully and it matches * the Records given with lzma_index_hash_append(). * - LZMA_DATA_ERROR: Index is corrupt or doesn't match the * information given with lzma_index_hash_append(). * - LZMA_BUF_ERROR: Cannot progress because *in_pos >= in_size. * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_index_hash_decode(lzma_index_hash *index_hash, const uint8_t *in, size_t *in_pos, size_t in_size) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Get the size of the Index field as bytes * * This is needed to verify the Backward Size field in the Stream Footer. */ extern LZMA_API(lzma_vli) lzma_index_hash_size( const lzma_index_hash *index_hash) lzma_nothrow lzma_attr_pure; lzma/check.h000064400000010237147631660250006752 0ustar00/** * \file lzma/check.h * \brief Integrity checks */ /* * Author: Lasse Collin * * This file has been put into the public domain. * You can do whatever you want with this file. * * See ../lzma.h for information about liblzma as a whole. */ #ifndef LZMA_H_INTERNAL # error Never include this file directly. Use instead. #endif /** * \brief Type of the integrity check (Check ID) * * The .xz format supports multiple types of checks that are calculated * from the uncompressed data. They vary in both speed and ability to * detect errors. */ typedef enum { LZMA_CHECK_NONE = 0, /**< * No Check is calculated. * * Size of the Check field: 0 bytes */ LZMA_CHECK_CRC32 = 1, /**< * CRC32 using the polynomial from the IEEE 802.3 standard * * Size of the Check field: 4 bytes */ LZMA_CHECK_CRC64 = 4, /**< * CRC64 using the polynomial from the ECMA-182 standard * * Size of the Check field: 8 bytes */ LZMA_CHECK_SHA256 = 10 /**< * SHA-256 * * Size of the Check field: 32 bytes */ } lzma_check; /** * \brief Maximum valid Check ID * * The .xz file format specification specifies 16 Check IDs (0-15). Some * of them are only reserved, that is, no actual Check algorithm has been * assigned. When decoding, liblzma still accepts unknown Check IDs for * future compatibility. If a valid but unsupported Check ID is detected, * liblzma can indicate a warning; see the flags LZMA_TELL_NO_CHECK, * LZMA_TELL_UNSUPPORTED_CHECK, and LZMA_TELL_ANY_CHECK in container.h. */ #define LZMA_CHECK_ID_MAX 15 /** * \brief Test if the given Check ID is supported * * Return true if the given Check ID is supported by this liblzma build. * Otherwise false is returned. It is safe to call this with a value that * is not in the range [0, 15]; in that case the return value is always false. * * You can assume that LZMA_CHECK_NONE and LZMA_CHECK_CRC32 are always * supported (even if liblzma is built with limited features). */ extern LZMA_API(lzma_bool) lzma_check_is_supported(lzma_check check) lzma_nothrow lzma_attr_const; /** * \brief Get the size of the Check field with the given Check ID * * Although not all Check IDs have a check algorithm associated, the size of * every Check is already frozen. This function returns the size (in bytes) of * the Check field with the specified Check ID. The values are: * { 0, 4, 4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 32, 64, 64, 64 } * * If the argument is not in the range [0, 15], UINT32_MAX is returned. */ extern LZMA_API(uint32_t) lzma_check_size(lzma_check check) lzma_nothrow lzma_attr_const; /** * \brief Maximum size of a Check field */ #define LZMA_CHECK_SIZE_MAX 64 /** * \brief Calculate CRC32 * * Calculate CRC32 using the polynomial from the IEEE 802.3 standard. * * \param buf Pointer to the input buffer * \param size Size of the input buffer * \param crc Previously returned CRC value. This is used to * calculate the CRC of a big buffer in smaller chunks. * Set to zero when starting a new calculation. * * \return Updated CRC value, which can be passed to this function * again to continue CRC calculation. */ extern LZMA_API(uint32_t) lzma_crc32( const uint8_t *buf, size_t size, uint32_t crc) lzma_nothrow lzma_attr_pure; /** * \brief Calculate CRC64 * * Calculate CRC64 using the polynomial from the ECMA-182 standard. * * This function is used similarly to lzma_crc32(). See its documentation. */ extern LZMA_API(uint64_t) lzma_crc64( const uint8_t *buf, size_t size, uint64_t crc) lzma_nothrow lzma_attr_pure; /* * SHA-256 functions are currently not exported to public API. * Contact Lasse Collin if you think it should be. */ /** * \brief Get the type of the integrity check * * This function can be called only immediately after lzma_code() has * returned LZMA_NO_CHECK, LZMA_UNSUPPORTED_CHECK, or LZMA_GET_CHECK. * Calling this function in any other situation has undefined behavior. */ extern LZMA_API(lzma_check) lzma_get_check(const lzma_stream *strm) lzma_nothrow; lzma/version.h000064400000006651147631660250007367 0ustar00/** * \file lzma/version.h * \brief Version number */ /* * Author: Lasse Collin * * This file has been put into the public domain. * You can do whatever you want with this file. * * See ../lzma.h for information about liblzma as a whole. */ #ifndef LZMA_H_INTERNAL # error Never include this file directly. Use instead. #endif /* * Version number split into components */ #define LZMA_VERSION_MAJOR 5 #define LZMA_VERSION_MINOR 2 #define LZMA_VERSION_PATCH 2 #define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE #ifndef LZMA_VERSION_COMMIT # define LZMA_VERSION_COMMIT "" #endif /* * Map symbolic stability levels to integers. */ #define LZMA_VERSION_STABILITY_ALPHA 0 #define LZMA_VERSION_STABILITY_BETA 1 #define LZMA_VERSION_STABILITY_STABLE 2 /** * \brief Compile-time version number * * The version number is of format xyyyzzzs where * - x = major * - yyy = minor * - zzz = revision * - s indicates stability: 0 = alpha, 1 = beta, 2 = stable * * The same xyyyzzz triplet is never reused with different stability levels. * For example, if 5.1.0alpha has been released, there will never be 5.1.0beta * or 5.1.0 stable. * * \note The version number of liblzma has nothing to with * the version number of Igor Pavlov's LZMA SDK. */ #define LZMA_VERSION (LZMA_VERSION_MAJOR * UINT32_C(10000000) \ + LZMA_VERSION_MINOR * UINT32_C(10000) \ + LZMA_VERSION_PATCH * UINT32_C(10) \ + LZMA_VERSION_STABILITY) /* * Macros to construct the compile-time version string */ #if LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_ALPHA # define LZMA_VERSION_STABILITY_STRING "alpha" #elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_BETA # define LZMA_VERSION_STABILITY_STRING "beta" #elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_STABLE # define LZMA_VERSION_STABILITY_STRING "" #else # error Incorrect LZMA_VERSION_STABILITY #endif #define LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit) \ #major "." #minor "." #patch stability commit #define LZMA_VERSION_STRING_C(major, minor, patch, stability, commit) \ LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit) /** * \brief Compile-time version as a string * * This can be for example "4.999.5alpha", "4.999.8beta", or "5.0.0" (stable * versions don't have any "stable" suffix). In future, a snapshot built * from source code repository may include an additional suffix, for example * "4.999.8beta-21-g1d92". The commit ID won't be available in numeric form * in LZMA_VERSION macro. */ #define LZMA_VERSION_STRING LZMA_VERSION_STRING_C( \ LZMA_VERSION_MAJOR, LZMA_VERSION_MINOR, \ LZMA_VERSION_PATCH, LZMA_VERSION_STABILITY_STRING, \ LZMA_VERSION_COMMIT) /* #ifndef is needed for use with windres (MinGW or Cygwin). */ #ifndef LZMA_H_INTERNAL_RC /** * \brief Run-time version number as an integer * * Return the value of LZMA_VERSION macro at the compile time of liblzma. * This allows the application to compare if it was built against the same, * older, or newer version of liblzma that is currently running. */ extern LZMA_API(uint32_t) lzma_version_number(void) lzma_nothrow lzma_attr_const; /** * \brief Run-time version as a string * * This function may be useful if you want to display which version of * liblzma your application is currently using. */ extern LZMA_API(const char *) lzma_version_string(void) lzma_nothrow lzma_attr_const; #endif lzma/block.h000064400000053132147631660250006770 0ustar00/** * \file lzma/block.h * \brief .xz Block handling */ /* * Author: Lasse Collin * * This file has been put into the public domain. * You can do whatever you want with this file. * * See ../lzma.h for information about liblzma as a whole. */ #ifndef LZMA_H_INTERNAL # error Never include this file directly. Use instead. #endif /** * \brief Options for the Block and Block Header encoders and decoders * * Different Block handling functions use different parts of this structure. * Some read some members, other functions write, and some do both. Only the * members listed for reading need to be initialized when the specified * functions are called. The members marked for writing will be assigned * new values at some point either by calling the given function or by * later calls to lzma_code(). */ typedef struct { /** * \brief Block format version * * To prevent API and ABI breakages when new features are needed, * a version number is used to indicate which fields in this * structure are in use: * - liblzma >= 5.0.0: version = 0 is supported. * - liblzma >= 5.1.4beta: Support for version = 1 was added, * which adds the ignore_check field. * * If version is greater than one, most Block related functions * will return LZMA_OPTIONS_ERROR (lzma_block_header_decode() works * with any version value). * * Read by: * - All functions that take pointer to lzma_block as argument, * including lzma_block_header_decode(). * * Written by: * - lzma_block_header_decode() */ uint32_t version; /** * \brief Size of the Block Header field * * This is always a multiple of four. * * Read by: * - lzma_block_header_encode() * - lzma_block_header_decode() * - lzma_block_compressed_size() * - lzma_block_unpadded_size() * - lzma_block_total_size() * - lzma_block_decoder() * - lzma_block_buffer_decode() * * Written by: * - lzma_block_header_size() * - lzma_block_buffer_encode() */ uint32_t header_size; # define LZMA_BLOCK_HEADER_SIZE_MIN 8 # define LZMA_BLOCK_HEADER_SIZE_MAX 1024 /** * \brief Type of integrity Check * * The Check ID is not stored into the Block Header, thus its value * must be provided also when decoding. * * Read by: * - lzma_block_header_encode() * - lzma_block_header_decode() * - lzma_block_compressed_size() * - lzma_block_unpadded_size() * - lzma_block_total_size() * - lzma_block_encoder() * - lzma_block_decoder() * - lzma_block_buffer_encode() * - lzma_block_buffer_decode() */ lzma_check check; /** * \brief Size of the Compressed Data in bytes * * Encoding: If this is not LZMA_VLI_UNKNOWN, Block Header encoder * will store this value to the Block Header. Block encoder doesn't * care about this value, but will set it once the encoding has been * finished. * * Decoding: If this is not LZMA_VLI_UNKNOWN, Block decoder will * verify that the size of the Compressed Data field matches * compressed_size. * * Usually you don't know this value when encoding in streamed mode, * and thus cannot write this field into the Block Header. * * In non-streamed mode you can reserve space for this field before * encoding the actual Block. After encoding the data, finish the * Block by encoding the Block Header. Steps in detail: * * - Set compressed_size to some big enough value. If you don't know * better, use LZMA_VLI_MAX, but remember that bigger values take * more space in Block Header. * * - Call lzma_block_header_size() to see how much space you need to * reserve for the Block Header. * * - Encode the Block using lzma_block_encoder() and lzma_code(). * It sets compressed_size to the correct value. * * - Use lzma_block_header_encode() to encode the Block Header. * Because space was reserved in the first step, you don't need * to call lzma_block_header_size() anymore, because due to * reserving, header_size has to be big enough. If it is "too big", * lzma_block_header_encode() will add enough Header Padding to * make Block Header to match the size specified by header_size. * * Read by: * - lzma_block_header_size() * - lzma_block_header_encode() * - lzma_block_compressed_size() * - lzma_block_unpadded_size() * - lzma_block_total_size() * - lzma_block_decoder() * - lzma_block_buffer_decode() * * Written by: * - lzma_block_header_decode() * - lzma_block_compressed_size() * - lzma_block_encoder() * - lzma_block_decoder() * - lzma_block_buffer_encode() * - lzma_block_buffer_decode() */ lzma_vli compressed_size; /** * \brief Uncompressed Size in bytes * * This is handled very similarly to compressed_size above. * * uncompressed_size is needed by fewer functions than * compressed_size. This is because uncompressed_size isn't * needed to validate that Block stays within proper limits. * * Read by: * - lzma_block_header_size() * - lzma_block_header_encode() * - lzma_block_decoder() * - lzma_block_buffer_decode() * * Written by: * - lzma_block_header_decode() * - lzma_block_encoder() * - lzma_block_decoder() * - lzma_block_buffer_encode() * - lzma_block_buffer_decode() */ lzma_vli uncompressed_size; /** * \brief Array of filters * * There can be 1-4 filters. The end of the array is marked with * .id = LZMA_VLI_UNKNOWN. * * Read by: * - lzma_block_header_size() * - lzma_block_header_encode() * - lzma_block_encoder() * - lzma_block_decoder() * - lzma_block_buffer_encode() * - lzma_block_buffer_decode() * * Written by: * - lzma_block_header_decode(): Note that this does NOT free() * the old filter options structures. All unused filters[] will * have .id == LZMA_VLI_UNKNOWN and .options == NULL. If * decoding fails, all filters[] are guaranteed to be * LZMA_VLI_UNKNOWN and NULL. * * \note Because of the array is terminated with * .id = LZMA_VLI_UNKNOWN, the actual array must * have LZMA_FILTERS_MAX + 1 members or the Block * Header decoder will overflow the buffer. */ lzma_filter *filters; /** * \brief Raw value stored in the Check field * * After successful coding, the first lzma_check_size(check) bytes * of this array contain the raw value stored in the Check field. * * Note that CRC32 and CRC64 are stored in little endian byte order. * Take it into account if you display the Check values to the user. * * Written by: * - lzma_block_encoder() * - lzma_block_decoder() * - lzma_block_buffer_encode() * - lzma_block_buffer_decode() */ uint8_t raw_check[LZMA_CHECK_SIZE_MAX]; /* * Reserved space to allow possible future extensions without * breaking the ABI. You should not touch these, because the names * of these variables may change. These are and will never be used * with the currently supported options, so it is safe to leave these * uninitialized. */ void *reserved_ptr1; void *reserved_ptr2; void *reserved_ptr3; uint32_t reserved_int1; uint32_t reserved_int2; lzma_vli reserved_int3; lzma_vli reserved_int4; lzma_vli reserved_int5; lzma_vli reserved_int6; lzma_vli reserved_int7; lzma_vli reserved_int8; lzma_reserved_enum reserved_enum1; lzma_reserved_enum reserved_enum2; lzma_reserved_enum reserved_enum3; lzma_reserved_enum reserved_enum4; /** * \brief A flag to Block decoder to not verify the Check field * * This field is supported by liblzma >= 5.1.4beta if .version >= 1. * * If this is set to true, the integrity check won't be calculated * and verified. Unless you know what you are doing, you should * leave this to false. (A reason to set this to true is when the * file integrity is verified externally anyway and you want to * speed up the decompression, which matters mostly when using * SHA-256 as the integrity check.) * * If .version >= 1, read by: * - lzma_block_decoder() * - lzma_block_buffer_decode() * * Written by (.version is ignored): * - lzma_block_header_decode() always sets this to false */ lzma_bool ignore_check; lzma_bool reserved_bool2; lzma_bool reserved_bool3; lzma_bool reserved_bool4; lzma_bool reserved_bool5; lzma_bool reserved_bool6; lzma_bool reserved_bool7; lzma_bool reserved_bool8; } lzma_block; /** * \brief Decode the Block Header Size field * * To decode Block Header using lzma_block_header_decode(), the size of the * Block Header has to be known and stored into lzma_block.header_size. * The size can be calculated from the first byte of a Block using this macro. * Note that if the first byte is 0x00, it indicates beginning of Index; use * this macro only when the byte is not 0x00. * * There is no encoding macro, because Block Header encoder is enough for that. */ #define lzma_block_header_size_decode(b) (((uint32_t)(b) + 1) * 4) /** * \brief Calculate Block Header Size * * Calculate the minimum size needed for the Block Header field using the * settings specified in the lzma_block structure. Note that it is OK to * increase the calculated header_size value as long as it is a multiple of * four and doesn't exceed LZMA_BLOCK_HEADER_SIZE_MAX. Increasing header_size * just means that lzma_block_header_encode() will add Header Padding. * * \return - LZMA_OK: Size calculated successfully and stored to * block->header_size. * - LZMA_OPTIONS_ERROR: Unsupported version, filters or * filter options. * - LZMA_PROG_ERROR: Invalid values like compressed_size == 0. * * \note This doesn't check that all the options are valid i.e. this * may return LZMA_OK even if lzma_block_header_encode() or * lzma_block_encoder() would fail. If you want to validate the * filter chain, consider using lzma_memlimit_encoder() which as * a side-effect validates the filter chain. */ extern LZMA_API(lzma_ret) lzma_block_header_size(lzma_block *block) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Encode Block Header * * The caller must have calculated the size of the Block Header already with * lzma_block_header_size(). If a value larger than the one calculated by * lzma_block_header_size() is used, the Block Header will be padded to the * specified size. * * \param out Beginning of the output buffer. This must be * at least block->header_size bytes. * \param block Block options to be encoded. * * \return - LZMA_OK: Encoding was successful. block->header_size * bytes were written to output buffer. * - LZMA_OPTIONS_ERROR: Invalid or unsupported options. * - LZMA_PROG_ERROR: Invalid arguments, for example * block->header_size is invalid or block->filters is NULL. */ extern LZMA_API(lzma_ret) lzma_block_header_encode( const lzma_block *block, uint8_t *out) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Decode Block Header * * block->version should (usually) be set to the highest value supported * by the application. If the application sets block->version to a value * higher than supported by the current liblzma version, this function will * downgrade block->version to the highest value supported by it. Thus one * should check the value of block->version after calling this function if * block->version was set to a non-zero value and the application doesn't * otherwise know that the liblzma version being used is new enough to * support the specified block->version. * * The size of the Block Header must have already been decoded with * lzma_block_header_size_decode() macro and stored to block->header_size. * * The integrity check type from Stream Header must have been stored * to block->check. * * block->filters must have been allocated, but they don't need to be * initialized (possible existing filter options are not freed). * * \param block Destination for Block options. * \param allocator lzma_allocator for custom allocator functions. * Set to NULL to use malloc() (and also free() * if an error occurs). * \param in Beginning of the input buffer. This must be * at least block->header_size bytes. * * \return - LZMA_OK: Decoding was successful. block->header_size * bytes were read from the input buffer. * - LZMA_OPTIONS_ERROR: The Block Header specifies some * unsupported options such as unsupported filters. This can * happen also if block->version was set to a too low value * compared to what would be required to properly represent * the information stored in the Block Header. * - LZMA_DATA_ERROR: Block Header is corrupt, for example, * the CRC32 doesn't match. * - LZMA_PROG_ERROR: Invalid arguments, for example * block->header_size is invalid or block->filters is NULL. */ extern LZMA_API(lzma_ret) lzma_block_header_decode(lzma_block *block, const lzma_allocator *allocator, const uint8_t *in) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Validate and set Compressed Size according to Unpadded Size * * Block Header stores Compressed Size, but Index has Unpadded Size. If the * application has already parsed the Index and is now decoding Blocks, * it can calculate Compressed Size from Unpadded Size. This function does * exactly that with error checking: * * - Compressed Size calculated from Unpadded Size must be positive integer, * that is, Unpadded Size must be big enough that after Block Header and * Check fields there's still at least one byte for Compressed Size. * * - If Compressed Size was present in Block Header, the new value * calculated from Unpadded Size is compared against the value * from Block Header. * * \note This function must be called _after_ decoding the Block Header * field so that it can properly validate Compressed Size if it * was present in Block Header. * * \return - LZMA_OK: block->compressed_size was set successfully. * - LZMA_DATA_ERROR: unpadded_size is too small compared to * block->header_size and lzma_check_size(block->check). * - LZMA_PROG_ERROR: Some values are invalid. For example, * block->header_size must be a multiple of four and * between 8 and 1024 inclusive. */ extern LZMA_API(lzma_ret) lzma_block_compressed_size( lzma_block *block, lzma_vli unpadded_size) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Calculate Unpadded Size * * The Index field stores Unpadded Size and Uncompressed Size. The latter * can be taken directly from the lzma_block structure after coding a Block, * but Unpadded Size needs to be calculated from Block Header Size, * Compressed Size, and size of the Check field. This is where this function * is needed. * * \return Unpadded Size on success, or zero on error. */ extern LZMA_API(lzma_vli) lzma_block_unpadded_size(const lzma_block *block) lzma_nothrow lzma_attr_pure; /** * \brief Calculate the total encoded size of a Block * * This is equivalent to lzma_block_unpadded_size() except that the returned * value includes the size of the Block Padding field. * * \return On success, total encoded size of the Block. On error, * zero is returned. */ extern LZMA_API(lzma_vli) lzma_block_total_size(const lzma_block *block) lzma_nothrow lzma_attr_pure; /** * \brief Initialize .xz Block encoder * * Valid actions for lzma_code() are LZMA_RUN, LZMA_SYNC_FLUSH (only if the * filter chain supports it), and LZMA_FINISH. * * \return - LZMA_OK: All good, continue with lzma_code(). * - LZMA_MEM_ERROR * - LZMA_OPTIONS_ERROR * - LZMA_UNSUPPORTED_CHECK: block->check specifies a Check ID * that is not supported by this buid of liblzma. Initializing * the encoder failed. * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_block_encoder( lzma_stream *strm, lzma_block *block) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Initialize .xz Block decoder * * Valid actions for lzma_code() are LZMA_RUN and LZMA_FINISH. Using * LZMA_FINISH is not required. It is supported only for convenience. * * \return - LZMA_OK: All good, continue with lzma_code(). * - LZMA_UNSUPPORTED_CHECK: Initialization was successful, but * the given Check ID is not supported, thus Check will be * ignored. * - LZMA_PROG_ERROR * - LZMA_MEM_ERROR */ extern LZMA_API(lzma_ret) lzma_block_decoder( lzma_stream *strm, lzma_block *block) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Calculate maximum output size for single-call Block encoding * * This is equivalent to lzma_stream_buffer_bound() but for .xz Blocks. * See the documentation of lzma_stream_buffer_bound(). */ extern LZMA_API(size_t) lzma_block_buffer_bound(size_t uncompressed_size) lzma_nothrow; /** * \brief Single-call .xz Block encoder * * In contrast to the multi-call encoder initialized with * lzma_block_encoder(), this function encodes also the Block Header. This * is required to make it possible to write appropriate Block Header also * in case the data isn't compressible, and different filter chain has to be * used to encode the data in uncompressed form using uncompressed chunks * of the LZMA2 filter. * * When the data isn't compressible, header_size, compressed_size, and * uncompressed_size are set just like when the data was compressible, but * it is possible that header_size is too small to hold the filter chain * specified in block->filters, because that isn't necessarily the filter * chain that was actually used to encode the data. lzma_block_unpadded_size() * still works normally, because it doesn't read the filters array. * * \param block Block options: block->version, block->check, * and block->filters must have been initialized. * \param allocator lzma_allocator for custom allocator functions. * Set to NULL to use malloc() and free(). * \param in Beginning of the input buffer * \param in_size Size of the input buffer * \param out Beginning of the output buffer * \param out_pos The next byte will be written to out[*out_pos]. * *out_pos is updated only if encoding succeeds. * \param out_size Size of the out buffer; the first byte into * which no data is written to is out[out_size]. * * \return - LZMA_OK: Encoding was successful. * - LZMA_BUF_ERROR: Not enough output buffer space. * - LZMA_UNSUPPORTED_CHECK * - LZMA_OPTIONS_ERROR * - LZMA_MEM_ERROR * - LZMA_DATA_ERROR * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_block_buffer_encode( lzma_block *block, const lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Single-call uncompressed .xz Block encoder * * This is like lzma_block_buffer_encode() except this doesn't try to * compress the data and instead encodes the data using LZMA2 uncompressed * chunks. The required output buffer size can be determined with * lzma_block_buffer_bound(). * * Since the data won't be compressed, this function ignores block->filters. * This function doesn't take lzma_allocator because this function doesn't * allocate any memory from the heap. */ extern LZMA_API(lzma_ret) lzma_block_uncomp_encode(lzma_block *block, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Single-call .xz Block decoder * * This is single-call equivalent of lzma_block_decoder(), and requires that * the caller has already decoded Block Header and checked its memory usage. * * \param block Block options just like with lzma_block_decoder(). * \param allocator lzma_allocator for custom allocator functions. * Set to NULL to use malloc() and free(). * \param in Beginning of the input buffer * \param in_pos The next byte will be read from in[*in_pos]. * *in_pos is updated only if decoding succeeds. * \param in_size Size of the input buffer; the first byte that * won't be read is in[in_size]. * \param out Beginning of the output buffer * \param out_pos The next byte will be written to out[*out_pos]. * *out_pos is updated only if encoding succeeds. * \param out_size Size of the out buffer; the first byte into * which no data is written to is out[out_size]. * * \return - LZMA_OK: Decoding was successful. * - LZMA_OPTIONS_ERROR * - LZMA_DATA_ERROR * - LZMA_MEM_ERROR * - LZMA_BUF_ERROR: Output buffer was too small. * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_block_buffer_decode( lzma_block *block, const lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow; lzma/index.h000064400000055304147631660250007010 0ustar00/** * \file lzma/index.h * \brief Handling of .xz Index and related information */ /* * Author: Lasse Collin * * This file has been put into the public domain. * You can do whatever you want with this file. * * See ../lzma.h for information about liblzma as a whole. */ #ifndef LZMA_H_INTERNAL # error Never include this file directly. Use instead. #endif /** * \brief Opaque data type to hold the Index(es) and other information * * lzma_index often holds just one .xz Index and possibly the Stream Flags * of the same Stream and size of the Stream Padding field. However, * multiple lzma_indexes can be concatenated with lzma_index_cat() and then * there may be information about multiple Streams in the same lzma_index. * * Notes about thread safety: Only one thread may modify lzma_index at * a time. All functions that take non-const pointer to lzma_index * modify it. As long as no thread is modifying the lzma_index, getting * information from the same lzma_index can be done from multiple threads * at the same time with functions that take a const pointer to * lzma_index or use lzma_index_iter. The same iterator must be used * only by one thread at a time, of course, but there can be as many * iterators for the same lzma_index as needed. */ typedef struct lzma_index_s lzma_index; /** * \brief Iterator to get information about Blocks and Streams */ typedef struct { struct { /** * \brief Pointer to Stream Flags * * This is NULL if Stream Flags have not been set for * this Stream with lzma_index_stream_flags(). */ const lzma_stream_flags *flags; const void *reserved_ptr1; const void *reserved_ptr2; const void *reserved_ptr3; /** * \brief Stream number in the lzma_index * * The first Stream is 1. */ lzma_vli number; /** * \brief Number of Blocks in the Stream * * If this is zero, the block structure below has * undefined values. */ lzma_vli block_count; /** * \brief Compressed start offset of this Stream * * The offset is relative to the beginning of the lzma_index * (i.e. usually the beginning of the .xz file). */ lzma_vli compressed_offset; /** * \brief Uncompressed start offset of this Stream * * The offset is relative to the beginning of the lzma_index * (i.e. usually the beginning of the .xz file). */ lzma_vli uncompressed_offset; /** * \brief Compressed size of this Stream * * This includes all headers except the possible * Stream Padding after this Stream. */ lzma_vli compressed_size; /** * \brief Uncompressed size of this Stream */ lzma_vli uncompressed_size; /** * \brief Size of Stream Padding after this Stream * * If it hasn't been set with lzma_index_stream_padding(), * this defaults to zero. Stream Padding is always * a multiple of four bytes. */ lzma_vli padding; lzma_vli reserved_vli1; lzma_vli reserved_vli2; lzma_vli reserved_vli3; lzma_vli reserved_vli4; } stream; struct { /** * \brief Block number in the file * * The first Block is 1. */ lzma_vli number_in_file; /** * \brief Compressed start offset of this Block * * This offset is relative to the beginning of the * lzma_index (i.e. usually the beginning of the .xz file). * Normally this is where you should seek in the .xz file * to start decompressing this Block. */ lzma_vli compressed_file_offset; /** * \brief Uncompressed start offset of this Block * * This offset is relative to the beginning of the lzma_index * (i.e. usually the beginning of the .xz file). * * When doing random-access reading, it is possible that * the target offset is not exactly at Block boundary. One * will need to compare the target offset against * uncompressed_file_offset or uncompressed_stream_offset, * and possibly decode and throw away some amount of data * before reaching the target offset. */ lzma_vli uncompressed_file_offset; /** * \brief Block number in this Stream * * The first Block is 1. */ lzma_vli number_in_stream; /** * \brief Compressed start offset of this Block * * This offset is relative to the beginning of the Stream * containing this Block. */ lzma_vli compressed_stream_offset; /** * \brief Uncompressed start offset of this Block * * This offset is relative to the beginning of the Stream * containing this Block. */ lzma_vli uncompressed_stream_offset; /** * \brief Uncompressed size of this Block * * You should pass this to the Block decoder if you will * decode this Block. It will allow the Block decoder to * validate the uncompressed size. */ lzma_vli uncompressed_size; /** * \brief Unpadded size of this Block * * You should pass this to the Block decoder if you will * decode this Block. It will allow the Block decoder to * validate the unpadded size. */ lzma_vli unpadded_size; /** * \brief Total compressed size * * This includes all headers and padding in this Block. * This is useful if you need to know how many bytes * the Block decoder will actually read. */ lzma_vli total_size; lzma_vli reserved_vli1; lzma_vli reserved_vli2; lzma_vli reserved_vli3; lzma_vli reserved_vli4; const void *reserved_ptr1; const void *reserved_ptr2; const void *reserved_ptr3; const void *reserved_ptr4; } block; /* * Internal data which is used to store the state of the iterator. * The exact format may vary between liblzma versions, so don't * touch these in any way. */ union { const void *p; size_t s; lzma_vli v; } internal[6]; } lzma_index_iter; /** * \brief Operation mode for lzma_index_iter_next() */ typedef enum { LZMA_INDEX_ITER_ANY = 0, /**< * \brief Get the next Block or Stream * * Go to the next Block if the current Stream has at least * one Block left. Otherwise go to the next Stream even if * it has no Blocks. If the Stream has no Blocks * (lzma_index_iter.stream.block_count == 0), * lzma_index_iter.block will have undefined values. */ LZMA_INDEX_ITER_STREAM = 1, /**< * \brief Get the next Stream * * Go to the next Stream even if the current Stream has * unread Blocks left. If the next Stream has at least one * Block, the iterator will point to the first Block. * If there are no Blocks, lzma_index_iter.block will have * undefined values. */ LZMA_INDEX_ITER_BLOCK = 2, /**< * \brief Get the next Block * * Go to the next Block if the current Stream has at least * one Block left. If the current Stream has no Blocks left, * the next Stream with at least one Block is located and * the iterator will be made to point to the first Block of * that Stream. */ LZMA_INDEX_ITER_NONEMPTY_BLOCK = 3 /**< * \brief Get the next non-empty Block * * This is like LZMA_INDEX_ITER_BLOCK except that it will * skip Blocks whose Uncompressed Size is zero. */ } lzma_index_iter_mode; /** * \brief Calculate memory usage of lzma_index * * On disk, the size of the Index field depends on both the number of Records * stored and how big values the Records store (due to variable-length integer * encoding). When the Index is kept in lzma_index structure, the memory usage * depends only on the number of Records/Blocks stored in the Index(es), and * in case of concatenated lzma_indexes, the number of Streams. The size in * RAM is almost always significantly bigger than in the encoded form on disk. * * This function calculates an approximate amount of memory needed hold * the given number of Streams and Blocks in lzma_index structure. This * value may vary between CPU architectures and also between liblzma versions * if the internal implementation is modified. */ extern LZMA_API(uint64_t) lzma_index_memusage( lzma_vli streams, lzma_vli blocks) lzma_nothrow; /** * \brief Calculate the memory usage of an existing lzma_index * * This is a shorthand for lzma_index_memusage(lzma_index_stream_count(i), * lzma_index_block_count(i)). */ extern LZMA_API(uint64_t) lzma_index_memused(const lzma_index *i) lzma_nothrow; /** * \brief Allocate and initialize a new lzma_index structure * * \return On success, a pointer to an empty initialized lzma_index is * returned. If allocation fails, NULL is returned. */ extern LZMA_API(lzma_index *) lzma_index_init(const lzma_allocator *allocator) lzma_nothrow; /** * \brief Deallocate lzma_index * * If i is NULL, this does nothing. */ extern LZMA_API(void) lzma_index_end( lzma_index *i, const lzma_allocator *allocator) lzma_nothrow; /** * \brief Add a new Block to lzma_index * * \param i Pointer to a lzma_index structure * \param allocator Pointer to lzma_allocator, or NULL to * use malloc() * \param unpadded_size Unpadded Size of a Block. This can be * calculated with lzma_block_unpadded_size() * after encoding or decoding the Block. * \param uncompressed_size Uncompressed Size of a Block. This can be * taken directly from lzma_block structure * after encoding or decoding the Block. * * Appending a new Block does not invalidate iterators. For example, * if an iterator was pointing to the end of the lzma_index, after * lzma_index_append() it is possible to read the next Block with * an existing iterator. * * \return - LZMA_OK * - LZMA_MEM_ERROR * - LZMA_DATA_ERROR: Compressed or uncompressed size of the * Stream or size of the Index field would grow too big. * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_index_append( lzma_index *i, const lzma_allocator *allocator, lzma_vli unpadded_size, lzma_vli uncompressed_size) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Set the Stream Flags * * Set the Stream Flags of the last (and typically the only) Stream * in lzma_index. This can be useful when reading information from the * lzma_index, because to decode Blocks, knowing the integrity check type * is needed. * * The given Stream Flags are copied into internal preallocated structure * in the lzma_index, thus the caller doesn't need to keep the *stream_flags * available after calling this function. * * \return - LZMA_OK * - LZMA_OPTIONS_ERROR: Unsupported stream_flags->version. * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_index_stream_flags( lzma_index *i, const lzma_stream_flags *stream_flags) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Get the types of integrity Checks * * If lzma_index_stream_flags() is used to set the Stream Flags for * every Stream, lzma_index_checks() can be used to get a bitmask to * indicate which Check types have been used. It can be useful e.g. if * showing the Check types to the user. * * The bitmask is 1 << check_id, e.g. CRC32 is 1 << 1 and SHA-256 is 1 << 10. */ extern LZMA_API(uint32_t) lzma_index_checks(const lzma_index *i) lzma_nothrow lzma_attr_pure; /** * \brief Set the amount of Stream Padding * * Set the amount of Stream Padding of the last (and typically the only) * Stream in the lzma_index. This is needed when planning to do random-access * reading within multiple concatenated Streams. * * By default, the amount of Stream Padding is assumed to be zero bytes. * * \return - LZMA_OK * - LZMA_DATA_ERROR: The file size would grow too big. * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_index_stream_padding( lzma_index *i, lzma_vli stream_padding) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Get the number of Streams */ extern LZMA_API(lzma_vli) lzma_index_stream_count(const lzma_index *i) lzma_nothrow lzma_attr_pure; /** * \brief Get the number of Blocks * * This returns the total number of Blocks in lzma_index. To get number * of Blocks in individual Streams, use lzma_index_iter. */ extern LZMA_API(lzma_vli) lzma_index_block_count(const lzma_index *i) lzma_nothrow lzma_attr_pure; /** * \brief Get the size of the Index field as bytes * * This is needed to verify the Backward Size field in the Stream Footer. */ extern LZMA_API(lzma_vli) lzma_index_size(const lzma_index *i) lzma_nothrow lzma_attr_pure; /** * \brief Get the total size of the Stream * * If multiple lzma_indexes have been combined, this works as if the Blocks * were in a single Stream. This is useful if you are going to combine * Blocks from multiple Streams into a single new Stream. */ extern LZMA_API(lzma_vli) lzma_index_stream_size(const lzma_index *i) lzma_nothrow lzma_attr_pure; /** * \brief Get the total size of the Blocks * * This doesn't include the Stream Header, Stream Footer, Stream Padding, * or Index fields. */ extern LZMA_API(lzma_vli) lzma_index_total_size(const lzma_index *i) lzma_nothrow lzma_attr_pure; /** * \brief Get the total size of the file * * When no lzma_indexes have been combined with lzma_index_cat() and there is * no Stream Padding, this function is identical to lzma_index_stream_size(). * If multiple lzma_indexes have been combined, this includes also the headers * of each separate Stream and the possible Stream Padding fields. */ extern LZMA_API(lzma_vli) lzma_index_file_size(const lzma_index *i) lzma_nothrow lzma_attr_pure; /** * \brief Get the uncompressed size of the file */ extern LZMA_API(lzma_vli) lzma_index_uncompressed_size(const lzma_index *i) lzma_nothrow lzma_attr_pure; /** * \brief Initialize an iterator * * \param iter Pointer to a lzma_index_iter structure * \param i lzma_index to which the iterator will be associated * * This function associates the iterator with the given lzma_index, and calls * lzma_index_iter_rewind() on the iterator. * * This function doesn't allocate any memory, thus there is no * lzma_index_iter_end(). The iterator is valid as long as the * associated lzma_index is valid, that is, until lzma_index_end() or * using it as source in lzma_index_cat(). Specifically, lzma_index doesn't * become invalid if new Blocks are added to it with lzma_index_append() or * if it is used as the destination in lzma_index_cat(). * * It is safe to make copies of an initialized lzma_index_iter, for example, * to easily restart reading at some particular position. */ extern LZMA_API(void) lzma_index_iter_init( lzma_index_iter *iter, const lzma_index *i) lzma_nothrow; /** * \brief Rewind the iterator * * Rewind the iterator so that next call to lzma_index_iter_next() will * return the first Block or Stream. */ extern LZMA_API(void) lzma_index_iter_rewind(lzma_index_iter *iter) lzma_nothrow; /** * \brief Get the next Block or Stream * * \param iter Iterator initialized with lzma_index_iter_init() * \param mode Specify what kind of information the caller wants * to get. See lzma_index_iter_mode for details. * * \return If next Block or Stream matching the mode was found, *iter * is updated and this function returns false. If no Block or * Stream matching the mode is found, *iter is not modified * and this function returns true. If mode is set to an unknown * value, *iter is not modified and this function returns true. */ extern LZMA_API(lzma_bool) lzma_index_iter_next( lzma_index_iter *iter, lzma_index_iter_mode mode) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Locate a Block * * If it is possible to seek in the .xz file, it is possible to parse * the Index field(s) and use lzma_index_iter_locate() to do random-access * reading with granularity of Block size. * * \param iter Iterator that was earlier initialized with * lzma_index_iter_init(). * \param target Uncompressed target offset which the caller would * like to locate from the Stream * * If the target is smaller than the uncompressed size of the Stream (can be * checked with lzma_index_uncompressed_size()): * - Information about the Stream and Block containing the requested * uncompressed offset is stored into *iter. * - Internal state of the iterator is adjusted so that * lzma_index_iter_next() can be used to read subsequent Blocks or Streams. * - This function returns false. * * If target is greater than the uncompressed size of the Stream, *iter * is not modified, and this function returns true. */ extern LZMA_API(lzma_bool) lzma_index_iter_locate( lzma_index_iter *iter, lzma_vli target) lzma_nothrow; /** * \brief Concatenate lzma_indexes * * Concatenating lzma_indexes is useful when doing random-access reading in * multi-Stream .xz file, or when combining multiple Streams into single * Stream. * * \param dest lzma_index after which src is appended * \param src lzma_index to be appended after dest. If this * function succeeds, the memory allocated for src * is freed or moved to be part of dest, and all * iterators pointing to src will become invalid. * \param allocator Custom memory allocator; can be NULL to use * malloc() and free(). * * \return - LZMA_OK: lzma_indexes were concatenated successfully. * src is now a dangling pointer. * - LZMA_DATA_ERROR: *dest would grow too big. * - LZMA_MEM_ERROR * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_index_cat(lzma_index *dest, lzma_index *src, const lzma_allocator *allocator) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Duplicate lzma_index * * \return A copy of the lzma_index, or NULL if memory allocation failed. */ extern LZMA_API(lzma_index *) lzma_index_dup( const lzma_index *i, const lzma_allocator *allocator) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Initialize .xz Index encoder * * \param strm Pointer to properly prepared lzma_stream * \param i Pointer to lzma_index which should be encoded. * * The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH. * It is enough to use only one of them (you can choose freely; use LZMA_RUN * to support liblzma versions older than 5.0.0). * * \return - LZMA_OK: Initialization succeeded, continue with lzma_code(). * - LZMA_MEM_ERROR * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_index_encoder( lzma_stream *strm, const lzma_index *i) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Initialize .xz Index decoder * * \param strm Pointer to properly prepared lzma_stream * \param i The decoded Index will be made available via * this pointer. Initially this function will * set *i to NULL (the old value is ignored). If * decoding succeeds (lzma_code() returns * LZMA_STREAM_END), *i will be set to point * to a new lzma_index, which the application * has to later free with lzma_index_end(). * \param memlimit How much memory the resulting lzma_index is * allowed to require. * * The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH. * It is enough to use only one of them (you can choose freely; use LZMA_RUN * to support liblzma versions older than 5.0.0). * * \return - LZMA_OK: Initialization succeeded, continue with lzma_code(). * - LZMA_MEM_ERROR * - LZMA_MEMLIMIT_ERROR * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_index_decoder( lzma_stream *strm, lzma_index **i, uint64_t memlimit) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Single-call .xz Index encoder * * \param i lzma_index to be encoded * \param out Beginning of the output buffer * \param out_pos The next byte will be written to out[*out_pos]. * *out_pos is updated only if encoding succeeds. * \param out_size Size of the out buffer; the first byte into * which no data is written to is out[out_size]. * * \return - LZMA_OK: Encoding was successful. * - LZMA_BUF_ERROR: Output buffer is too small. Use * lzma_index_size() to find out how much output * space is needed. * - LZMA_PROG_ERROR * * \note This function doesn't take allocator argument since all * the internal data is allocated on stack. */ extern LZMA_API(lzma_ret) lzma_index_buffer_encode(const lzma_index *i, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow; /** * \brief Single-call .xz Index decoder * * \param i If decoding succeeds, *i will point to a new * lzma_index, which the application has to * later free with lzma_index_end(). If an error * occurs, *i will be NULL. The old value of *i * is always ignored and thus doesn't need to be * initialized by the caller. * \param memlimit Pointer to how much memory the resulting * lzma_index is allowed to require. The value * pointed by this pointer is modified if and only * if LZMA_MEMLIMIT_ERROR is returned. * \param allocator Pointer to lzma_allocator, or NULL to use malloc() * \param in Beginning of the input buffer * \param in_pos The next byte will be read from in[*in_pos]. * *in_pos is updated only if decoding succeeds. * \param in_size Size of the input buffer; the first byte that * won't be read is in[in_size]. * * \return - LZMA_OK: Decoding was successful. * - LZMA_MEM_ERROR * - LZMA_MEMLIMIT_ERROR: Memory usage limit was reached. * The minimum required memlimit value was stored to *memlimit. * - LZMA_DATA_ERROR * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_index_buffer_decode(lzma_index **i, uint64_t *memlimit, const lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size) lzma_nothrow; lzma/vli.h000064400000014623147631660250006472 0ustar00/** * \file lzma/vli.h * \brief Variable-length integer handling * * In the .xz format, most integers are encoded in a variable-length * representation, which is sometimes called little endian base-128 encoding. * This saves space when smaller values are more likely than bigger values. * * The encoding scheme encodes seven bits to every byte, using minimum * number of bytes required to represent the given value. Encodings that use * non-minimum number of bytes are invalid, thus every integer has exactly * one encoded representation. The maximum number of bits in a VLI is 63, * thus the vli argument must be less than or equal to UINT64_MAX / 2. You * should use LZMA_VLI_MAX for clarity. */ /* * Author: Lasse Collin * * This file has been put into the public domain. * You can do whatever you want with this file. * * See ../lzma.h for information about liblzma as a whole. */ #ifndef LZMA_H_INTERNAL # error Never include this file directly. Use instead. #endif /** * \brief Maximum supported value of a variable-length integer */ #define LZMA_VLI_MAX (UINT64_MAX / 2) /** * \brief VLI value to denote that the value is unknown */ #define LZMA_VLI_UNKNOWN UINT64_MAX /** * \brief Maximum supported encoded length of variable length integers */ #define LZMA_VLI_BYTES_MAX 9 /** * \brief VLI constant suffix */ #define LZMA_VLI_C(n) UINT64_C(n) /** * \brief Variable-length integer type * * Valid VLI values are in the range [0, LZMA_VLI_MAX]. Unknown value is * indicated with LZMA_VLI_UNKNOWN, which is the maximum value of the * underlaying integer type. * * lzma_vli will be uint64_t for the foreseeable future. If a bigger size * is needed in the future, it is guaranteed that 2 * LZMA_VLI_MAX will * not overflow lzma_vli. This simplifies integer overflow detection. */ typedef uint64_t lzma_vli; /** * \brief Validate a variable-length integer * * This is useful to test that application has given acceptable values * for example in the uncompressed_size and compressed_size variables. * * \return True if the integer is representable as VLI or if it * indicates unknown value. */ #define lzma_vli_is_valid(vli) \ ((vli) <= LZMA_VLI_MAX || (vli) == LZMA_VLI_UNKNOWN) /** * \brief Encode a variable-length integer * * This function has two modes: single-call and multi-call. Single-call mode * encodes the whole integer at once; it is an error if the output buffer is * too small. Multi-call mode saves the position in *vli_pos, and thus it is * possible to continue encoding if the buffer becomes full before the whole * integer has been encoded. * * \param vli Integer to be encoded * \param vli_pos How many VLI-encoded bytes have already been written * out. When starting to encode a new integer in * multi-call mode, *vli_pos must be set to zero. * To use single-call encoding, set vli_pos to NULL. * \param out Beginning of the output buffer * \param out_pos The next byte will be written to out[*out_pos]. * \param out_size Size of the out buffer; the first byte into * which no data is written to is out[out_size]. * * \return Slightly different return values are used in multi-call and * single-call modes. * * Single-call (vli_pos == NULL): * - LZMA_OK: Integer successfully encoded. * - LZMA_PROG_ERROR: Arguments are not sane. This can be due * to too little output space; single-call mode doesn't use * LZMA_BUF_ERROR, since the application should have checked * the encoded size with lzma_vli_size(). * * Multi-call (vli_pos != NULL): * - LZMA_OK: So far all OK, but the integer is not * completely written out yet. * - LZMA_STREAM_END: Integer successfully encoded. * - LZMA_BUF_ERROR: No output space was provided. * - LZMA_PROG_ERROR: Arguments are not sane. */ extern LZMA_API(lzma_ret) lzma_vli_encode(lzma_vli vli, size_t *vli_pos, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow; /** * \brief Decode a variable-length integer * * Like lzma_vli_encode(), this function has single-call and multi-call modes. * * \param vli Pointer to decoded integer. The decoder will * initialize it to zero when *vli_pos == 0, so * application isn't required to initialize *vli. * \param vli_pos How many bytes have already been decoded. When * starting to decode a new integer in multi-call * mode, *vli_pos must be initialized to zero. To * use single-call decoding, set vli_pos to NULL. * \param in Beginning of the input buffer * \param in_pos The next byte will be read from in[*in_pos]. * \param in_size Size of the input buffer; the first byte that * won't be read is in[in_size]. * * \return Slightly different return values are used in multi-call and * single-call modes. * * Single-call (vli_pos == NULL): * - LZMA_OK: Integer successfully decoded. * - LZMA_DATA_ERROR: Integer is corrupt. This includes hitting * the end of the input buffer before the whole integer was * decoded; providing no input at all will use LZMA_DATA_ERROR. * - LZMA_PROG_ERROR: Arguments are not sane. * * Multi-call (vli_pos != NULL): * - LZMA_OK: So far all OK, but the integer is not * completely decoded yet. * - LZMA_STREAM_END: Integer successfully decoded. * - LZMA_DATA_ERROR: Integer is corrupt. * - LZMA_BUF_ERROR: No input was provided. * - LZMA_PROG_ERROR: Arguments are not sane. */ extern LZMA_API(lzma_ret) lzma_vli_decode(lzma_vli *vli, size_t *vli_pos, const uint8_t *in, size_t *in_pos, size_t in_size) lzma_nothrow; /** * \brief Get the number of bytes required to encode a VLI * * \return Number of bytes on success (1-9). If vli isn't valid, * zero is returned. */ extern LZMA_API(uint32_t) lzma_vli_size(lzma_vli vli) lzma_nothrow lzma_attr_pure; lzma/lzma12.h000064400000034627147631660250007014 0ustar00/** * \file lzma/lzma12.h * \brief LZMA1 and LZMA2 filters */ /* * Author: Lasse Collin * * This file has been put into the public domain. * You can do whatever you want with this file. * * See ../lzma.h for information about liblzma as a whole. */ #ifndef LZMA_H_INTERNAL # error Never include this file directly. Use instead. #endif /** * \brief LZMA1 Filter ID * * LZMA1 is the very same thing as what was called just LZMA in LZMA Utils, * 7-Zip, and LZMA SDK. It's called LZMA1 here to prevent developers from * accidentally using LZMA when they actually want LZMA2. * * LZMA1 shouldn't be used for new applications unless you _really_ know * what you are doing. LZMA2 is almost always a better choice. */ #define LZMA_FILTER_LZMA1 LZMA_VLI_C(0x4000000000000001) /** * \brief LZMA2 Filter ID * * Usually you want this instead of LZMA1. Compared to LZMA1, LZMA2 adds * support for LZMA_SYNC_FLUSH, uncompressed chunks (smaller expansion * when trying to compress uncompressible data), possibility to change * lc/lp/pb in the middle of encoding, and some other internal improvements. */ #define LZMA_FILTER_LZMA2 LZMA_VLI_C(0x21) /** * \brief Match finders * * Match finder has major effect on both speed and compression ratio. * Usually hash chains are faster than binary trees. * * If you will use LZMA_SYNC_FLUSH often, the hash chains may be a better * choice, because binary trees get much higher compression ratio penalty * with LZMA_SYNC_FLUSH. * * The memory usage formulas are only rough estimates, which are closest to * reality when dict_size is a power of two. The formulas are more complex * in reality, and can also change a little between liblzma versions. Use * lzma_raw_encoder_memusage() to get more accurate estimate of memory usage. */ typedef enum { LZMA_MF_HC3 = 0x03, /**< * \brief Hash Chain with 2- and 3-byte hashing * * Minimum nice_len: 3 * * Memory usage: * - dict_size <= 16 MiB: dict_size * 7.5 * - dict_size > 16 MiB: dict_size * 5.5 + 64 MiB */ LZMA_MF_HC4 = 0x04, /**< * \brief Hash Chain with 2-, 3-, and 4-byte hashing * * Minimum nice_len: 4 * * Memory usage: * - dict_size <= 32 MiB: dict_size * 7.5 * - dict_size > 32 MiB: dict_size * 6.5 */ LZMA_MF_BT2 = 0x12, /**< * \brief Binary Tree with 2-byte hashing * * Minimum nice_len: 2 * * Memory usage: dict_size * 9.5 */ LZMA_MF_BT3 = 0x13, /**< * \brief Binary Tree with 2- and 3-byte hashing * * Minimum nice_len: 3 * * Memory usage: * - dict_size <= 16 MiB: dict_size * 11.5 * - dict_size > 16 MiB: dict_size * 9.5 + 64 MiB */ LZMA_MF_BT4 = 0x14 /**< * \brief Binary Tree with 2-, 3-, and 4-byte hashing * * Minimum nice_len: 4 * * Memory usage: * - dict_size <= 32 MiB: dict_size * 11.5 * - dict_size > 32 MiB: dict_size * 10.5 */ } lzma_match_finder; /** * \brief Test if given match finder is supported * * Return true if the given match finder is supported by this liblzma build. * Otherwise false is returned. It is safe to call this with a value that * isn't listed in lzma_match_finder enumeration; the return value will be * false. * * There is no way to list which match finders are available in this * particular liblzma version and build. It would be useless, because * a new match finder, which the application developer wasn't aware, * could require giving additional options to the encoder that the older * match finders don't need. */ extern LZMA_API(lzma_bool) lzma_mf_is_supported(lzma_match_finder match_finder) lzma_nothrow lzma_attr_const; /** * \brief Compression modes * * This selects the function used to analyze the data produced by the match * finder. */ typedef enum { LZMA_MODE_FAST = 1, /**< * \brief Fast compression * * Fast mode is usually at its best when combined with * a hash chain match finder. */ LZMA_MODE_NORMAL = 2 /**< * \brief Normal compression * * This is usually notably slower than fast mode. Use this * together with binary tree match finders to expose the * full potential of the LZMA1 or LZMA2 encoder. */ } lzma_mode; /** * \brief Test if given compression mode is supported * * Return true if the given compression mode is supported by this liblzma * build. Otherwise false is returned. It is safe to call this with a value * that isn't listed in lzma_mode enumeration; the return value will be false. * * There is no way to list which modes are available in this particular * liblzma version and build. It would be useless, because a new compression * mode, which the application developer wasn't aware, could require giving * additional options to the encoder that the older modes don't need. */ extern LZMA_API(lzma_bool) lzma_mode_is_supported(lzma_mode mode) lzma_nothrow lzma_attr_const; /** * \brief Options specific to the LZMA1 and LZMA2 filters * * Since LZMA1 and LZMA2 share most of the code, it's simplest to share * the options structure too. For encoding, all but the reserved variables * need to be initialized unless specifically mentioned otherwise. * lzma_lzma_preset() can be used to get a good starting point. * * For raw decoding, both LZMA1 and LZMA2 need dict_size, preset_dict, and * preset_dict_size (if preset_dict != NULL). LZMA1 needs also lc, lp, and pb. */ typedef struct { /** * \brief Dictionary size in bytes * * Dictionary size indicates how many bytes of the recently processed * uncompressed data is kept in memory. One method to reduce size of * the uncompressed data is to store distance-length pairs, which * indicate what data to repeat from the dictionary buffer. Thus, * the bigger the dictionary, the better the compression ratio * usually is. * * Maximum size of the dictionary depends on multiple things: * - Memory usage limit * - Available address space (not a problem on 64-bit systems) * - Selected match finder (encoder only) * * Currently the maximum dictionary size for encoding is 1.5 GiB * (i.e. (UINT32_C(1) << 30) + (UINT32_C(1) << 29)) even on 64-bit * systems for certain match finder implementation reasons. In the * future, there may be match finders that support bigger * dictionaries. * * Decoder already supports dictionaries up to 4 GiB - 1 B (i.e. * UINT32_MAX), so increasing the maximum dictionary size of the * encoder won't cause problems for old decoders. * * Because extremely small dictionaries sizes would have unneeded * overhead in the decoder, the minimum dictionary size is 4096 bytes. * * \note When decoding, too big dictionary does no other harm * than wasting memory. */ uint32_t dict_size; # define LZMA_DICT_SIZE_MIN UINT32_C(4096) # define LZMA_DICT_SIZE_DEFAULT (UINT32_C(1) << 23) /** * \brief Pointer to an initial dictionary * * It is possible to initialize the LZ77 history window using * a preset dictionary. It is useful when compressing many * similar, relatively small chunks of data independently from * each other. The preset dictionary should contain typical * strings that occur in the files being compressed. The most * probable strings should be near the end of the preset dictionary. * * This feature should be used only in special situations. For * now, it works correctly only with raw encoding and decoding. * Currently none of the container formats supported by * liblzma allow preset dictionary when decoding, thus if * you create a .xz or .lzma file with preset dictionary, it * cannot be decoded with the regular decoder functions. In the * future, the .xz format will likely get support for preset * dictionary though. */ const uint8_t *preset_dict; /** * \brief Size of the preset dictionary * * Specifies the size of the preset dictionary. If the size is * bigger than dict_size, only the last dict_size bytes are * processed. * * This variable is read only when preset_dict is not NULL. * If preset_dict is not NULL but preset_dict_size is zero, * no preset dictionary is used (identical to only setting * preset_dict to NULL). */ uint32_t preset_dict_size; /** * \brief Number of literal context bits * * How many of the highest bits of the previous uncompressed * eight-bit byte (also known as `literal') are taken into * account when predicting the bits of the next literal. * * E.g. in typical English text, an upper-case letter is * often followed by a lower-case letter, and a lower-case * letter is usually followed by another lower-case letter. * In the US-ASCII character set, the highest three bits are 010 * for upper-case letters and 011 for lower-case letters. * When lc is at least 3, the literal coding can take advantage of * this property in the uncompressed data. * * There is a limit that applies to literal context bits and literal * position bits together: lc + lp <= 4. Without this limit the * decoding could become very slow, which could have security related * results in some cases like email servers doing virus scanning. * This limit also simplifies the internal implementation in liblzma. * * There may be LZMA1 streams that have lc + lp > 4 (maximum possible * lc would be 8). It is not possible to decode such streams with * liblzma. */ uint32_t lc; # define LZMA_LCLP_MIN 0 # define LZMA_LCLP_MAX 4 # define LZMA_LC_DEFAULT 3 /** * \brief Number of literal position bits * * lp affects what kind of alignment in the uncompressed data is * assumed when encoding literals. A literal is a single 8-bit byte. * See pb below for more information about alignment. */ uint32_t lp; # define LZMA_LP_DEFAULT 0 /** * \brief Number of position bits * * pb affects what kind of alignment in the uncompressed data is * assumed in general. The default means four-byte alignment * (2^ pb =2^2=4), which is often a good choice when there's * no better guess. * * When the aligment is known, setting pb accordingly may reduce * the file size a little. E.g. with text files having one-byte * alignment (US-ASCII, ISO-8859-*, UTF-8), setting pb=0 can * improve compression slightly. For UTF-16 text, pb=1 is a good * choice. If the alignment is an odd number like 3 bytes, pb=0 * might be the best choice. * * Even though the assumed alignment can be adjusted with pb and * lp, LZMA1 and LZMA2 still slightly favor 16-byte alignment. * It might be worth taking into account when designing file formats * that are likely to be often compressed with LZMA1 or LZMA2. */ uint32_t pb; # define LZMA_PB_MIN 0 # define LZMA_PB_MAX 4 # define LZMA_PB_DEFAULT 2 /** Compression mode */ lzma_mode mode; /** * \brief Nice length of a match * * This determines how many bytes the encoder compares from the match * candidates when looking for the best match. Once a match of at * least nice_len bytes long is found, the encoder stops looking for * better candidates and encodes the match. (Naturally, if the found * match is actually longer than nice_len, the actual length is * encoded; it's not truncated to nice_len.) * * Bigger values usually increase the compression ratio and * compression time. For most files, 32 to 128 is a good value, * which gives very good compression ratio at good speed. * * The exact minimum value depends on the match finder. The maximum * is 273, which is the maximum length of a match that LZMA1 and * LZMA2 can encode. */ uint32_t nice_len; /** Match finder ID */ lzma_match_finder mf; /** * \brief Maximum search depth in the match finder * * For every input byte, match finder searches through the hash chain * or binary tree in a loop, each iteration going one step deeper in * the chain or tree. The searching stops if * - a match of at least nice_len bytes long is found; * - all match candidates from the hash chain or binary tree have * been checked; or * - maximum search depth is reached. * * Maximum search depth is needed to prevent the match finder from * wasting too much time in case there are lots of short match * candidates. On the other hand, stopping the search before all * candidates have been checked can reduce compression ratio. * * Setting depth to zero tells liblzma to use an automatic default * value, that depends on the selected match finder and nice_len. * The default is in the range [4, 200] or so (it may vary between * liblzma versions). * * Using a bigger depth value than the default can increase * compression ratio in some cases. There is no strict maximum value, * but high values (thousands or millions) should be used with care: * the encoder could remain fast enough with typical input, but * malicious input could cause the match finder to slow down * dramatically, possibly creating a denial of service attack. */ uint32_t depth; /* * Reserved space to allow possible future extensions without * breaking the ABI. You should not touch these, because the names * of these variables may change. These are and will never be used * with the currently supported options, so it is safe to leave these * uninitialized. */ uint32_t reserved_int1; uint32_t reserved_int2; uint32_t reserved_int3; uint32_t reserved_int4; uint32_t reserved_int5; uint32_t reserved_int6; uint32_t reserved_int7; uint32_t reserved_int8; lzma_reserved_enum reserved_enum1; lzma_reserved_enum reserved_enum2; lzma_reserved_enum reserved_enum3; lzma_reserved_enum reserved_enum4; void *reserved_ptr1; void *reserved_ptr2; } lzma_options_lzma; /** * \brief Set a compression preset to lzma_options_lzma structure * * 0 is the fastest and 9 is the slowest. These match the switches -0 .. -9 * of the xz command line tool. In addition, it is possible to bitwise-or * flags to the preset. Currently only LZMA_PRESET_EXTREME is supported. * The flags are defined in container.h, because the flags are used also * with lzma_easy_encoder(). * * The preset values are subject to changes between liblzma versions. * * This function is available only if LZMA1 or LZMA2 encoder has been enabled * when building liblzma. * * \return On success, false is returned. If the preset is not * supported, true is returned. */ extern LZMA_API(lzma_bool) lzma_lzma_preset( lzma_options_lzma *options, uint32_t preset) lzma_nothrow; lzma/bcj.h000064400000005106147631660250006432 0ustar00/** * \file lzma/bcj.h * \brief Branch/Call/Jump conversion filters */ /* * Author: Lasse Collin * * This file has been put into the public domain. * You can do whatever you want with this file. * * See ../lzma.h for information about liblzma as a whole. */ #ifndef LZMA_H_INTERNAL # error Never include this file directly. Use instead. #endif /* Filter IDs for lzma_filter.id */ #define LZMA_FILTER_X86 LZMA_VLI_C(0x04) /**< * Filter for x86 binaries */ #define LZMA_FILTER_POWERPC LZMA_VLI_C(0x05) /**< * Filter for Big endian PowerPC binaries */ #define LZMA_FILTER_IA64 LZMA_VLI_C(0x06) /**< * Filter for IA-64 (Itanium) binaries. */ #define LZMA_FILTER_ARM LZMA_VLI_C(0x07) /**< * Filter for ARM binaries. */ #define LZMA_FILTER_ARMTHUMB LZMA_VLI_C(0x08) /**< * Filter for ARM-Thumb binaries. */ #define LZMA_FILTER_SPARC LZMA_VLI_C(0x09) /**< * Filter for SPARC binaries. */ /** * \brief Options for BCJ filters * * The BCJ filters never change the size of the data. Specifying options * for them is optional: if pointer to options is NULL, default value is * used. You probably never need to specify options to BCJ filters, so just * set the options pointer to NULL and be happy. * * If options with non-default values have been specified when encoding, * the same options must also be specified when decoding. * * \note At the moment, none of the BCJ filters support * LZMA_SYNC_FLUSH. If LZMA_SYNC_FLUSH is specified, * LZMA_OPTIONS_ERROR will be returned. If there is need, * partial support for LZMA_SYNC_FLUSH can be added in future. * Partial means that flushing would be possible only at * offsets that are multiple of 2, 4, or 16 depending on * the filter, except x86 which cannot be made to support * LZMA_SYNC_FLUSH predictably. */ typedef struct { /** * \brief Start offset for conversions * * This setting is useful only when the same filter is used * _separately_ for multiple sections of the same executable file, * and the sections contain cross-section branch/call/jump * instructions. In that case it is beneficial to set the start * offset of the non-first sections so that the relative addresses * of the cross-section branch/call/jump instructions will use the * same absolute addresses as in the first section. * * When the pointer to options is NULL, the default value (zero) * is used. */ uint32_t start_offset; } lzma_options_bcj; lzma/base.h000064400000060022147631660250006604 0ustar00/** * \file lzma/base.h * \brief Data types and functions used in many places in liblzma API */ /* * Author: Lasse Collin * * This file has been put into the public domain. * You can do whatever you want with this file. * * See ../lzma.h for information about liblzma as a whole. */ #ifndef LZMA_H_INTERNAL # error Never include this file directly. Use instead. #endif /** * \brief Boolean * * This is here because C89 doesn't have stdbool.h. To set a value for * variables having type lzma_bool, you can use * - C99's `true' and `false' from stdbool.h; * - C++'s internal `true' and `false'; or * - integers one (true) and zero (false). */ typedef unsigned char lzma_bool; /** * \brief Type of reserved enumeration variable in structures * * To avoid breaking library ABI when new features are added, several * structures contain extra variables that may be used in future. Since * sizeof(enum) can be different than sizeof(int), and sizeof(enum) may * even vary depending on the range of enumeration constants, we specify * a separate type to be used for reserved enumeration variables. All * enumeration constants in liblzma API will be non-negative and less * than 128, which should guarantee that the ABI won't break even when * new constants are added to existing enumerations. */ typedef enum { LZMA_RESERVED_ENUM = 0 } lzma_reserved_enum; /** * \brief Return values used by several functions in liblzma * * Check the descriptions of specific functions to find out which return * values they can return. With some functions the return values may have * more specific meanings than described here; those differences are * described per-function basis. */ typedef enum { LZMA_OK = 0, /**< * \brief Operation completed successfully */ LZMA_STREAM_END = 1, /**< * \brief End of stream was reached * * In encoder, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, or * LZMA_FINISH was finished. In decoder, this indicates * that all the data was successfully decoded. * * In all cases, when LZMA_STREAM_END is returned, the last * output bytes should be picked from strm->next_out. */ LZMA_NO_CHECK = 2, /**< * \brief Input stream has no integrity check * * This return value can be returned only if the * LZMA_TELL_NO_CHECK flag was used when initializing * the decoder. LZMA_NO_CHECK is just a warning, and * the decoding can be continued normally. * * It is possible to call lzma_get_check() immediately after * lzma_code has returned LZMA_NO_CHECK. The result will * naturally be LZMA_CHECK_NONE, but the possibility to call * lzma_get_check() may be convenient in some applications. */ LZMA_UNSUPPORTED_CHECK = 3, /**< * \brief Cannot calculate the integrity check * * The usage of this return value is different in encoders * and decoders. * * Encoders can return this value only from the initialization * function. If initialization fails with this value, the * encoding cannot be done, because there's no way to produce * output with the correct integrity check. * * Decoders can return this value only from lzma_code() and * only if the LZMA_TELL_UNSUPPORTED_CHECK flag was used when * initializing the decoder. The decoding can still be * continued normally even if the check type is unsupported, * but naturally the check will not be validated, and possible * errors may go undetected. * * With decoder, it is possible to call lzma_get_check() * immediately after lzma_code() has returned * LZMA_UNSUPPORTED_CHECK. This way it is possible to find * out what the unsupported Check ID was. */ LZMA_GET_CHECK = 4, /**< * \brief Integrity check type is now available * * This value can be returned only by the lzma_code() function * and only if the decoder was initialized with the * LZMA_TELL_ANY_CHECK flag. LZMA_GET_CHECK tells the * application that it may now call lzma_get_check() to find * out the Check ID. This can be used, for example, to * implement a decoder that accepts only files that have * strong enough integrity check. */ LZMA_MEM_ERROR = 5, /**< * \brief Cannot allocate memory * * Memory allocation failed, or the size of the allocation * would be greater than SIZE_MAX. * * Due to internal implementation reasons, the coding cannot * be continued even if more memory were made available after * LZMA_MEM_ERROR. */ LZMA_MEMLIMIT_ERROR = 6, /** * \brief Memory usage limit was reached * * Decoder would need more memory than allowed by the * specified memory usage limit. To continue decoding, * the memory usage limit has to be increased with * lzma_memlimit_set(). */ LZMA_FORMAT_ERROR = 7, /**< * \brief File format not recognized * * The decoder did not recognize the input as supported file * format. This error can occur, for example, when trying to * decode .lzma format file with lzma_stream_decoder, * because lzma_stream_decoder accepts only the .xz format. */ LZMA_OPTIONS_ERROR = 8, /**< * \brief Invalid or unsupported options * * Invalid or unsupported options, for example * - unsupported filter(s) or filter options; or * - reserved bits set in headers (decoder only). * * Rebuilding liblzma with more features enabled, or * upgrading to a newer version of liblzma may help. */ LZMA_DATA_ERROR = 9, /**< * \brief Data is corrupt * * The usage of this return value is different in encoders * and decoders. In both encoder and decoder, the coding * cannot continue after this error. * * Encoders return this if size limits of the target file * format would be exceeded. These limits are huge, thus * getting this error from an encoder is mostly theoretical. * For example, the maximum compressed and uncompressed * size of a .xz Stream is roughly 8 EiB (2^63 bytes). * * Decoders return this error if the input data is corrupt. * This can mean, for example, invalid CRC32 in headers * or invalid check of uncompressed data. */ LZMA_BUF_ERROR = 10, /**< * \brief No progress is possible * * This error code is returned when the coder cannot consume * any new input and produce any new output. The most common * reason for this error is that the input stream being * decoded is truncated or corrupt. * * This error is not fatal. Coding can be continued normally * by providing more input and/or more output space, if * possible. * * Typically the first call to lzma_code() that can do no * progress returns LZMA_OK instead of LZMA_BUF_ERROR. Only * the second consecutive call doing no progress will return * LZMA_BUF_ERROR. This is intentional. * * With zlib, Z_BUF_ERROR may be returned even if the * application is doing nothing wrong, so apps will need * to handle Z_BUF_ERROR specially. The above hack * guarantees that liblzma never returns LZMA_BUF_ERROR * to properly written applications unless the input file * is truncated or corrupt. This should simplify the * applications a little. */ LZMA_PROG_ERROR = 11, /**< * \brief Programming error * * This indicates that the arguments given to the function are * invalid or the internal state of the decoder is corrupt. * - Function arguments are invalid or the structures * pointed by the argument pointers are invalid * e.g. if strm->next_out has been set to NULL and * strm->avail_out > 0 when calling lzma_code(). * - lzma_* functions have been called in wrong order * e.g. lzma_code() was called right after lzma_end(). * - If errors occur randomly, the reason might be flaky * hardware. * * If you think that your code is correct, this error code * can be a sign of a bug in liblzma. See the documentation * how to report bugs. */ } lzma_ret; /** * \brief The `action' argument for lzma_code() * * After the first use of LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, LZMA_FULL_BARRIER, * or LZMA_FINISH, the same `action' must is used until lzma_code() returns * LZMA_STREAM_END. Also, the amount of input (that is, strm->avail_in) must * not be modified by the application until lzma_code() returns * LZMA_STREAM_END. Changing the `action' or modifying the amount of input * will make lzma_code() return LZMA_PROG_ERROR. */ typedef enum { LZMA_RUN = 0, /**< * \brief Continue coding * * Encoder: Encode as much input as possible. Some internal * buffering will probably be done (depends on the filter * chain in use), which causes latency: the input used won't * usually be decodeable from the output of the same * lzma_code() call. * * Decoder: Decode as much input as possible and produce as * much output as possible. */ LZMA_SYNC_FLUSH = 1, /**< * \brief Make all the input available at output * * Normally the encoder introduces some latency. * LZMA_SYNC_FLUSH forces all the buffered data to be * available at output without resetting the internal * state of the encoder. This way it is possible to use * compressed stream for example for communication over * network. * * Only some filters support LZMA_SYNC_FLUSH. Trying to use * LZMA_SYNC_FLUSH with filters that don't support it will * make lzma_code() return LZMA_OPTIONS_ERROR. For example, * LZMA1 doesn't support LZMA_SYNC_FLUSH but LZMA2 does. * * Using LZMA_SYNC_FLUSH very often can dramatically reduce * the compression ratio. With some filters (for example, * LZMA2), fine-tuning the compression options may help * mitigate this problem significantly (for example, * match finder with LZMA2). * * Decoders don't support LZMA_SYNC_FLUSH. */ LZMA_FULL_FLUSH = 2, /**< * \brief Finish encoding of the current Block * * All the input data going to the current Block must have * been given to the encoder (the last bytes can still be * pending in *next_in). Call lzma_code() with LZMA_FULL_FLUSH * until it returns LZMA_STREAM_END. Then continue normally * with LZMA_RUN or finish the Stream with LZMA_FINISH. * * This action is currently supported only by Stream encoder * and easy encoder (which uses Stream encoder). If there is * no unfinished Block, no empty Block is created. */ LZMA_FULL_BARRIER = 4, /**< * \brief Finish encoding of the current Block * * This is like LZMA_FULL_FLUSH except that this doesn't * necessarily wait until all the input has been made * available via the output buffer. That is, lzma_code() * might return LZMA_STREAM_END as soon as all the input * has been consumed (avail_in == 0). * * LZMA_FULL_BARRIER is useful with a threaded encoder if * one wants to split the .xz Stream into Blocks at specific * offsets but doesn't care if the output isn't flushed * immediately. Using LZMA_FULL_BARRIER allows keeping * the threads busy while LZMA_FULL_FLUSH would make * lzma_code() wait until all the threads have finished * until more data could be passed to the encoder. * * With a lzma_stream initialized with the single-threaded * lzma_stream_encoder() or lzma_easy_encoder(), * LZMA_FULL_BARRIER is an alias for LZMA_FULL_FLUSH. */ LZMA_FINISH = 3 /**< * \brief Finish the coding operation * * All the input data must have been given to the encoder * (the last bytes can still be pending in next_in). * Call lzma_code() with LZMA_FINISH until it returns * LZMA_STREAM_END. Once LZMA_FINISH has been used, * the amount of input must no longer be changed by * the application. * * When decoding, using LZMA_FINISH is optional unless the * LZMA_CONCATENATED flag was used when the decoder was * initialized. When LZMA_CONCATENATED was not used, the only * effect of LZMA_FINISH is that the amount of input must not * be changed just like in the encoder. */ } lzma_action; /** * \brief Custom functions for memory handling * * A pointer to lzma_allocator may be passed via lzma_stream structure * to liblzma, and some advanced functions take a pointer to lzma_allocator * as a separate function argument. The library will use the functions * specified in lzma_allocator for memory handling instead of the default * malloc() and free(). C++ users should note that the custom memory * handling functions must not throw exceptions. * * Single-threaded mode only: liblzma doesn't make an internal copy of * lzma_allocator. Thus, it is OK to change these function pointers in * the middle of the coding process, but obviously it must be done * carefully to make sure that the replacement `free' can deallocate * memory allocated by the earlier `alloc' function(s). * * Multithreaded mode: liblzma might internally store pointers to the * lzma_allocator given via the lzma_stream structure. The application * must not change the allocator pointer in lzma_stream or the contents * of the pointed lzma_allocator structure until lzma_end() has been used * to free the memory associated with that lzma_stream. The allocation * functions might be called simultaneously from multiple threads, and * thus they must be thread safe. */ typedef struct { /** * \brief Pointer to a custom memory allocation function * * If you don't want a custom allocator, but still want * custom free(), set this to NULL and liblzma will use * the standard malloc(). * * \param opaque lzma_allocator.opaque (see below) * \param nmemb Number of elements like in calloc(). liblzma * will always set nmemb to 1, so it is safe to * ignore nmemb in a custom allocator if you like. * The nmemb argument exists only for * compatibility with zlib and libbzip2. * \param size Size of an element in bytes. * liblzma never sets this to zero. * * \return Pointer to the beginning of a memory block of * `size' bytes, or NULL if allocation fails * for some reason. When allocation fails, functions * of liblzma return LZMA_MEM_ERROR. * * The allocator should not waste time zeroing the allocated buffers. * This is not only about speed, but also memory usage, since the * operating system kernel doesn't necessarily allocate the requested * memory in physical memory until it is actually used. With small * input files, liblzma may actually need only a fraction of the * memory that it requested for allocation. * * \note LZMA_MEM_ERROR is also used when the size of the * allocation would be greater than SIZE_MAX. Thus, * don't assume that the custom allocator must have * returned NULL if some function from liblzma * returns LZMA_MEM_ERROR. */ void *(LZMA_API_CALL *alloc)(void *opaque, size_t nmemb, size_t size); /** * \brief Pointer to a custom memory freeing function * * If you don't want a custom freeing function, but still * want a custom allocator, set this to NULL and liblzma * will use the standard free(). * * \param opaque lzma_allocator.opaque (see below) * \param ptr Pointer returned by lzma_allocator.alloc(), * or when it is set to NULL, a pointer returned * by the standard malloc(). */ void (LZMA_API_CALL *free)(void *opaque, void *ptr); /** * \brief Pointer passed to .alloc() and .free() * * opaque is passed as the first argument to lzma_allocator.alloc() * and lzma_allocator.free(). This intended to ease implementing * custom memory allocation functions for use with liblzma. * * If you don't need this, you should set this to NULL. */ void *opaque; } lzma_allocator; /** * \brief Internal data structure * * The contents of this structure is not visible outside the library. */ typedef struct lzma_internal_s lzma_internal; /** * \brief Passing data to and from liblzma * * The lzma_stream structure is used for * - passing pointers to input and output buffers to liblzma; * - defining custom memory hander functions; and * - holding a pointer to coder-specific internal data structures. * * Typical usage: * * - After allocating lzma_stream (on stack or with malloc()), it must be * initialized to LZMA_STREAM_INIT (see LZMA_STREAM_INIT for details). * * - Initialize a coder to the lzma_stream, for example by using * lzma_easy_encoder() or lzma_auto_decoder(). Some notes: * - In contrast to zlib, strm->next_in and strm->next_out are * ignored by all initialization functions, thus it is safe * to not initialize them yet. * - The initialization functions always set strm->total_in and * strm->total_out to zero. * - If the initialization function fails, no memory is left allocated * that would require freeing with lzma_end() even if some memory was * associated with the lzma_stream structure when the initialization * function was called. * * - Use lzma_code() to do the actual work. * * - Once the coding has been finished, the existing lzma_stream can be * reused. It is OK to reuse lzma_stream with different initialization * function without calling lzma_end() first. Old allocations are * automatically freed. * * - Finally, use lzma_end() to free the allocated memory. lzma_end() never * frees the lzma_stream structure itself. * * Application may modify the values of total_in and total_out as it wants. * They are updated by liblzma to match the amount of data read and * written but aren't used for anything else except as a possible return * values from lzma_get_progress(). */ typedef struct { const uint8_t *next_in; /**< Pointer to the next input byte. */ size_t avail_in; /**< Number of available input bytes in next_in. */ uint64_t total_in; /**< Total number of bytes read by liblzma. */ uint8_t *next_out; /**< Pointer to the next output position. */ size_t avail_out; /**< Amount of free space in next_out. */ uint64_t total_out; /**< Total number of bytes written by liblzma. */ /** * \brief Custom memory allocation functions * * In most cases this is NULL which makes liblzma use * the standard malloc() and free(). * * \note In 5.0.x this is not a const pointer. */ const lzma_allocator *allocator; /** Internal state is not visible to applications. */ lzma_internal *internal; /* * Reserved space to allow possible future extensions without * breaking the ABI. Excluding the initialization of this structure, * you should not touch these, because the names of these variables * may change. */ void *reserved_ptr1; void *reserved_ptr2; void *reserved_ptr3; void *reserved_ptr4; uint64_t reserved_int1; uint64_t reserved_int2; size_t reserved_int3; size_t reserved_int4; lzma_reserved_enum reserved_enum1; lzma_reserved_enum reserved_enum2; } lzma_stream; /** * \brief Initialization for lzma_stream * * When you declare an instance of lzma_stream, you can immediately * initialize it so that initialization functions know that no memory * has been allocated yet: * * lzma_stream strm = LZMA_STREAM_INIT; * * If you need to initialize a dynamically allocated lzma_stream, you can use * memset(strm_pointer, 0, sizeof(lzma_stream)). Strictly speaking, this * violates the C standard since NULL may have different internal * representation than zero, but it should be portable enough in practice. * Anyway, for maximum portability, you can use something like this: * * lzma_stream tmp = LZMA_STREAM_INIT; * *strm = tmp; */ #define LZMA_STREAM_INIT \ { NULL, 0, 0, NULL, 0, 0, NULL, NULL, \ NULL, NULL, NULL, NULL, 0, 0, 0, 0, \ LZMA_RESERVED_ENUM, LZMA_RESERVED_ENUM } /** * \brief Encode or decode data * * Once the lzma_stream has been successfully initialized (e.g. with * lzma_stream_encoder()), the actual encoding or decoding is done * using this function. The application has to update strm->next_in, * strm->avail_in, strm->next_out, and strm->avail_out to pass input * to and get output from liblzma. * * See the description of the coder-specific initialization function to find * out what `action' values are supported by the coder. */ extern LZMA_API(lzma_ret) lzma_code(lzma_stream *strm, lzma_action action) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Free memory allocated for the coder data structures * * \param strm Pointer to lzma_stream that is at least initialized * with LZMA_STREAM_INIT. * * After lzma_end(strm), strm->internal is guaranteed to be NULL. No other * members of the lzma_stream structure are touched. * * \note zlib indicates an error if application end()s unfinished * stream structure. liblzma doesn't do this, and assumes that * application knows what it is doing. */ extern LZMA_API(void) lzma_end(lzma_stream *strm) lzma_nothrow; /** * \brief Get progress information * * In single-threaded mode, applications can get progress information from * strm->total_in and strm->total_out. In multi-threaded mode this is less * useful because a significant amount of both input and output data gets * buffered internally by liblzma. This makes total_in and total_out give * misleading information and also makes the progress indicator updates * non-smooth. * * This function gives realistic progress information also in multi-threaded * mode by taking into account the progress made by each thread. In * single-threaded mode *progress_in and *progress_out are set to * strm->total_in and strm->total_out, respectively. */ extern LZMA_API(void) lzma_get_progress(lzma_stream *strm, uint64_t *progress_in, uint64_t *progress_out) lzma_nothrow; /** * \brief Get the memory usage of decoder filter chain * * This function is currently supported only when *strm has been initialized * with a function that takes a memlimit argument. With other functions, you * should use e.g. lzma_raw_encoder_memusage() or lzma_raw_decoder_memusage() * to estimate the memory requirements. * * This function is useful e.g. after LZMA_MEMLIMIT_ERROR to find out how big * the memory usage limit should have been to decode the input. Note that * this may give misleading information if decoding .xz Streams that have * multiple Blocks, because each Block can have different memory requirements. * * \return How much memory is currently allocated for the filter * decoders. If no filter chain is currently allocated, * some non-zero value is still returned, which is less than * or equal to what any filter chain would indicate as its * memory requirement. * * If this function isn't supported by *strm or some other error * occurs, zero is returned. */ extern LZMA_API(uint64_t) lzma_memusage(const lzma_stream *strm) lzma_nothrow lzma_attr_pure; /** * \brief Get the current memory usage limit * * This function is supported only when *strm has been initialized with * a function that takes a memlimit argument. * * \return On success, the current memory usage limit is returned * (always non-zero). On error, zero is returned. */ extern LZMA_API(uint64_t) lzma_memlimit_get(const lzma_stream *strm) lzma_nothrow lzma_attr_pure; /** * \brief Set the memory usage limit * * This function is supported only when *strm has been initialized with * a function that takes a memlimit argument. * * \return - LZMA_OK: New memory usage limit successfully set. * - LZMA_MEMLIMIT_ERROR: The new limit is too small. * The limit was not changed. * - LZMA_PROG_ERROR: Invalid arguments, e.g. *strm doesn't * support memory usage limit or memlimit was zero. */ extern LZMA_API(lzma_ret) lzma_memlimit_set( lzma_stream *strm, uint64_t memlimit) lzma_nothrow; lzma/container.h000064400000056700147631660250007664 0ustar00/** * \file lzma/container.h * \brief File formats */ /* * Author: Lasse Collin * * This file has been put into the public domain. * You can do whatever you want with this file. * * See ../lzma.h for information about liblzma as a whole. */ #ifndef LZMA_H_INTERNAL # error Never include this file directly. Use instead. #endif /************ * Encoding * ************/ /** * \brief Default compression preset * * It's not straightforward to recommend a default preset, because in some * cases keeping the resource usage relatively low is more important that * getting the maximum compression ratio. */ #define LZMA_PRESET_DEFAULT UINT32_C(6) /** * \brief Mask for preset level * * This is useful only if you need to extract the level from the preset * variable. That should be rare. */ #define LZMA_PRESET_LEVEL_MASK UINT32_C(0x1F) /* * Preset flags * * Currently only one flag is defined. */ /** * \brief Extreme compression preset * * This flag modifies the preset to make the encoding significantly slower * while improving the compression ratio only marginally. This is useful * when you don't mind wasting time to get as small result as possible. * * This flag doesn't affect the memory usage requirements of the decoder (at * least not significantly). The memory usage of the encoder may be increased * a little but only at the lowest preset levels (0-3). */ #define LZMA_PRESET_EXTREME (UINT32_C(1) << 31) /** * \brief Multithreading options */ typedef struct { /** * \brief Flags * * Set this to zero if no flags are wanted. * * No flags are currently supported. */ uint32_t flags; /** * \brief Number of worker threads to use */ uint32_t threads; /** * \brief Maximum uncompressed size of a Block * * The encoder will start a new .xz Block every block_size bytes. * Using LZMA_FULL_FLUSH or LZMA_FULL_BARRIER with lzma_code() * the caller may tell liblzma to start a new Block earlier. * * With LZMA2, a recommended block size is 2-4 times the LZMA2 * dictionary size. With very small dictionaries, it is recommended * to use at least 1 MiB block size for good compression ratio, even * if this is more than four times the dictionary size. Note that * these are only recommendations for typical use cases; feel free * to use other values. Just keep in mind that using a block size * less than the LZMA2 dictionary size is waste of RAM. * * Set this to 0 to let liblzma choose the block size depending * on the compression options. For LZMA2 it will be 3*dict_size * or 1 MiB, whichever is more. * * For each thread, about 3 * block_size bytes of memory will be * allocated. This may change in later liblzma versions. If so, * the memory usage will probably be reduced, not increased. */ uint64_t block_size; /** * \brief Timeout to allow lzma_code() to return early * * Multithreading can make liblzma to consume input and produce * output in a very bursty way: it may first read a lot of input * to fill internal buffers, then no input or output occurs for * a while. * * In single-threaded mode, lzma_code() won't return until it has * either consumed all the input or filled the output buffer. If * this is done in multithreaded mode, it may cause a call * lzma_code() to take even tens of seconds, which isn't acceptable * in all applications. * * To avoid very long blocking times in lzma_code(), a timeout * (in milliseconds) may be set here. If lzma_code() would block * longer than this number of milliseconds, it will return with * LZMA_OK. Reasonable values are 100 ms or more. The xz command * line tool uses 300 ms. * * If long blocking times are fine for you, set timeout to a special * value of 0, which will disable the timeout mechanism and will make * lzma_code() block until all the input is consumed or the output * buffer has been filled. * * \note Even with a timeout, lzma_code() might sometimes take * somewhat long time to return. No timing guarantees * are made. */ uint32_t timeout; /** * \brief Compression preset (level and possible flags) * * The preset is set just like with lzma_easy_encoder(). * The preset is ignored if filters below is non-NULL. */ uint32_t preset; /** * \brief Filter chain (alternative to a preset) * * If this is NULL, the preset above is used. Otherwise the preset * is ignored and the filter chain specified here is used. */ const lzma_filter *filters; /** * \brief Integrity check type * * See check.h for available checks. The xz command line tool * defaults to LZMA_CHECK_CRC64, which is a good choice if you * are unsure. */ lzma_check check; /* * Reserved space to allow possible future extensions without * breaking the ABI. You should not touch these, because the names * of these variables may change. These are and will never be used * with the currently supported options, so it is safe to leave these * uninitialized. */ lzma_reserved_enum reserved_enum1; lzma_reserved_enum reserved_enum2; lzma_reserved_enum reserved_enum3; uint32_t reserved_int1; uint32_t reserved_int2; uint32_t reserved_int3; uint32_t reserved_int4; uint64_t reserved_int5; uint64_t reserved_int6; uint64_t reserved_int7; uint64_t reserved_int8; void *reserved_ptr1; void *reserved_ptr2; void *reserved_ptr3; void *reserved_ptr4; } lzma_mt; /** * \brief Calculate approximate memory usage of easy encoder * * This function is a wrapper for lzma_raw_encoder_memusage(). * * \param preset Compression preset (level and possible flags) * * \return Number of bytes of memory required for the given * preset when encoding. If an error occurs, for example * due to unsupported preset, UINT64_MAX is returned. */ extern LZMA_API(uint64_t) lzma_easy_encoder_memusage(uint32_t preset) lzma_nothrow lzma_attr_pure; /** * \brief Calculate approximate decoder memory usage of a preset * * This function is a wrapper for lzma_raw_decoder_memusage(). * * \param preset Compression preset (level and possible flags) * * \return Number of bytes of memory required to decompress a file * that was compressed using the given preset. If an error * occurs, for example due to unsupported preset, UINT64_MAX * is returned. */ extern LZMA_API(uint64_t) lzma_easy_decoder_memusage(uint32_t preset) lzma_nothrow lzma_attr_pure; /** * \brief Initialize .xz Stream encoder using a preset number * * This function is intended for those who just want to use the basic features * if liblzma (that is, most developers out there). * * \param strm Pointer to lzma_stream that is at least initialized * with LZMA_STREAM_INIT. * \param preset Compression preset to use. A preset consist of level * number and zero or more flags. Usually flags aren't * used, so preset is simply a number [0, 9] which match * the options -0 ... -9 of the xz command line tool. * Additional flags can be be set using bitwise-or with * the preset level number, e.g. 6 | LZMA_PRESET_EXTREME. * \param check Integrity check type to use. See check.h for available * checks. The xz command line tool defaults to * LZMA_CHECK_CRC64, which is a good choice if you are * unsure. LZMA_CHECK_CRC32 is good too as long as the * uncompressed file is not many gigabytes. * * \return - LZMA_OK: Initialization succeeded. Use lzma_code() to * encode your data. * - LZMA_MEM_ERROR: Memory allocation failed. * - LZMA_OPTIONS_ERROR: The given compression preset is not * supported by this build of liblzma. * - LZMA_UNSUPPORTED_CHECK: The given check type is not * supported by this liblzma build. * - LZMA_PROG_ERROR: One or more of the parameters have values * that will never be valid. For example, strm == NULL. * * If initialization fails (return value is not LZMA_OK), all the memory * allocated for *strm by liblzma is always freed. Thus, there is no need * to call lzma_end() after failed initialization. * * If initialization succeeds, use lzma_code() to do the actual encoding. * Valid values for `action' (the second argument of lzma_code()) are * LZMA_RUN, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, and LZMA_FINISH. In future, * there may be compression levels or flags that don't support LZMA_SYNC_FLUSH. */ extern LZMA_API(lzma_ret) lzma_easy_encoder( lzma_stream *strm, uint32_t preset, lzma_check check) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Single-call .xz Stream encoding using a preset number * * The maximum required output buffer size can be calculated with * lzma_stream_buffer_bound(). * * \param preset Compression preset to use. See the description * in lzma_easy_encoder(). * \param check Type of the integrity check to calculate from * uncompressed data. * \param allocator lzma_allocator for custom allocator functions. * Set to NULL to use malloc() and free(). * \param in Beginning of the input buffer * \param in_size Size of the input buffer * \param out Beginning of the output buffer * \param out_pos The next byte will be written to out[*out_pos]. * *out_pos is updated only if encoding succeeds. * \param out_size Size of the out buffer; the first byte into * which no data is written to is out[out_size]. * * \return - LZMA_OK: Encoding was successful. * - LZMA_BUF_ERROR: Not enough output buffer space. * - LZMA_UNSUPPORTED_CHECK * - LZMA_OPTIONS_ERROR * - LZMA_MEM_ERROR * - LZMA_DATA_ERROR * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_easy_buffer_encode( uint32_t preset, lzma_check check, const lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow; /** * \brief Initialize .xz Stream encoder using a custom filter chain * * \param strm Pointer to properly prepared lzma_stream * \param filters Array of filters. This must be terminated with * filters[n].id = LZMA_VLI_UNKNOWN. See filter.h for * more information. * \param check Type of the integrity check to calculate from * uncompressed data. * * \return - LZMA_OK: Initialization was successful. * - LZMA_MEM_ERROR * - LZMA_UNSUPPORTED_CHECK * - LZMA_OPTIONS_ERROR * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_stream_encoder(lzma_stream *strm, const lzma_filter *filters, lzma_check check) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Calculate approximate memory usage of multithreaded .xz encoder * * Since doing the encoding in threaded mode doesn't affect the memory * requirements of single-threaded decompressor, you can use * lzma_easy_decoder_memusage(options->preset) or * lzma_raw_decoder_memusage(options->filters) to calculate * the decompressor memory requirements. * * \param options Compression options * * \return Number of bytes of memory required for encoding with the * given options. If an error occurs, for example due to * unsupported preset or filter chain, UINT64_MAX is returned. */ extern LZMA_API(uint64_t) lzma_stream_encoder_mt_memusage( const lzma_mt *options) lzma_nothrow lzma_attr_pure; /** * \brief Initialize multithreaded .xz Stream encoder * * This provides the functionality of lzma_easy_encoder() and * lzma_stream_encoder() as a single function for multithreaded use. * * The supported actions for lzma_code() are LZMA_RUN, LZMA_FULL_FLUSH, * LZMA_FULL_BARRIER, and LZMA_FINISH. Support for LZMA_SYNC_FLUSH might be * added in the future. * * \param strm Pointer to properly prepared lzma_stream * \param options Pointer to multithreaded compression options * * \return - LZMA_OK * - LZMA_MEM_ERROR * - LZMA_UNSUPPORTED_CHECK * - LZMA_OPTIONS_ERROR * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_stream_encoder_mt( lzma_stream *strm, const lzma_mt *options) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Initialize .lzma encoder (legacy file format) * * The .lzma format is sometimes called the LZMA_Alone format, which is the * reason for the name of this function. The .lzma format supports only the * LZMA1 filter. There is no support for integrity checks like CRC32. * * Use this function if and only if you need to create files readable by * legacy LZMA tools such as LZMA Utils 4.32.x. Moving to the .xz format * is strongly recommended. * * The valid action values for lzma_code() are LZMA_RUN and LZMA_FINISH. * No kind of flushing is supported, because the file format doesn't make * it possible. * * \return - LZMA_OK * - LZMA_MEM_ERROR * - LZMA_OPTIONS_ERROR * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_alone_encoder( lzma_stream *strm, const lzma_options_lzma *options) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Calculate output buffer size for single-call Stream encoder * * When trying to compress uncompressible data, the encoded size will be * slightly bigger than the input data. This function calculates how much * output buffer space is required to be sure that lzma_stream_buffer_encode() * doesn't return LZMA_BUF_ERROR. * * The calculated value is not exact, but it is guaranteed to be big enough. * The actual maximum output space required may be slightly smaller (up to * about 100 bytes). This should not be a problem in practice. * * If the calculated maximum size doesn't fit into size_t or would make the * Stream grow past LZMA_VLI_MAX (which should never happen in practice), * zero is returned to indicate the error. * * \note The limit calculated by this function applies only to * single-call encoding. Multi-call encoding may (and probably * will) have larger maximum expansion when encoding * uncompressible data. Currently there is no function to * calculate the maximum expansion of multi-call encoding. */ extern LZMA_API(size_t) lzma_stream_buffer_bound(size_t uncompressed_size) lzma_nothrow; /** * \brief Single-call .xz Stream encoder * * \param filters Array of filters. This must be terminated with * filters[n].id = LZMA_VLI_UNKNOWN. See filter.h * for more information. * \param check Type of the integrity check to calculate from * uncompressed data. * \param allocator lzma_allocator for custom allocator functions. * Set to NULL to use malloc() and free(). * \param in Beginning of the input buffer * \param in_size Size of the input buffer * \param out Beginning of the output buffer * \param out_pos The next byte will be written to out[*out_pos]. * *out_pos is updated only if encoding succeeds. * \param out_size Size of the out buffer; the first byte into * which no data is written to is out[out_size]. * * \return - LZMA_OK: Encoding was successful. * - LZMA_BUF_ERROR: Not enough output buffer space. * - LZMA_UNSUPPORTED_CHECK * - LZMA_OPTIONS_ERROR * - LZMA_MEM_ERROR * - LZMA_DATA_ERROR * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_stream_buffer_encode( lzma_filter *filters, lzma_check check, const lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow lzma_attr_warn_unused_result; /************ * Decoding * ************/ /** * This flag makes lzma_code() return LZMA_NO_CHECK if the input stream * being decoded has no integrity check. Note that when used with * lzma_auto_decoder(), all .lzma files will trigger LZMA_NO_CHECK * if LZMA_TELL_NO_CHECK is used. */ #define LZMA_TELL_NO_CHECK UINT32_C(0x01) /** * This flag makes lzma_code() return LZMA_UNSUPPORTED_CHECK if the input * stream has an integrity check, but the type of the integrity check is not * supported by this liblzma version or build. Such files can still be * decoded, but the integrity check cannot be verified. */ #define LZMA_TELL_UNSUPPORTED_CHECK UINT32_C(0x02) /** * This flag makes lzma_code() return LZMA_GET_CHECK as soon as the type * of the integrity check is known. The type can then be got with * lzma_get_check(). */ #define LZMA_TELL_ANY_CHECK UINT32_C(0x04) /** * This flag makes lzma_code() not calculate and verify the integrity check * of the compressed data in .xz files. This means that invalid integrity * check values won't be detected and LZMA_DATA_ERROR won't be returned in * such cases. * * This flag only affects the checks of the compressed data itself; the CRC32 * values in the .xz headers will still be verified normally. * * Don't use this flag unless you know what you are doing. Possible reasons * to use this flag: * * - Trying to recover data from a corrupt .xz file. * * - Speeding up decompression, which matters mostly with SHA-256 * or with files that have compressed extremely well. It's recommended * to not use this flag for this purpose unless the file integrity is * verified externally in some other way. * * Support for this flag was added in liblzma 5.1.4beta. */ #define LZMA_IGNORE_CHECK UINT32_C(0x10) /** * This flag enables decoding of concatenated files with file formats that * allow concatenating compressed files as is. From the formats currently * supported by liblzma, only the .xz format allows concatenated files. * Concatenated files are not allowed with the legacy .lzma format. * * This flag also affects the usage of the `action' argument for lzma_code(). * When LZMA_CONCATENATED is used, lzma_code() won't return LZMA_STREAM_END * unless LZMA_FINISH is used as `action'. Thus, the application has to set * LZMA_FINISH in the same way as it does when encoding. * * If LZMA_CONCATENATED is not used, the decoders still accept LZMA_FINISH * as `action' for lzma_code(), but the usage of LZMA_FINISH isn't required. */ #define LZMA_CONCATENATED UINT32_C(0x08) /** * \brief Initialize .xz Stream decoder * * \param strm Pointer to properly prepared lzma_stream * \param memlimit Memory usage limit as bytes. Use UINT64_MAX * to effectively disable the limiter. * \param flags Bitwise-or of zero or more of the decoder flags: * LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK, * LZMA_TELL_ANY_CHECK, LZMA_CONCATENATED * * \return - LZMA_OK: Initialization was successful. * - LZMA_MEM_ERROR: Cannot allocate memory. * - LZMA_OPTIONS_ERROR: Unsupported flags * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_stream_decoder( lzma_stream *strm, uint64_t memlimit, uint32_t flags) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Decode .xz Streams and .lzma files with autodetection * * This decoder autodetects between the .xz and .lzma file formats, and * calls lzma_stream_decoder() or lzma_alone_decoder() once the type * of the input file has been detected. * * \param strm Pointer to properly prepared lzma_stream * \param memlimit Memory usage limit as bytes. Use UINT64_MAX * to effectively disable the limiter. * \param flags Bitwise-or of flags, or zero for no flags. * * \return - LZMA_OK: Initialization was successful. * - LZMA_MEM_ERROR: Cannot allocate memory. * - LZMA_OPTIONS_ERROR: Unsupported flags * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_auto_decoder( lzma_stream *strm, uint64_t memlimit, uint32_t flags) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Initialize .lzma decoder (legacy file format) * * Valid `action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH. * There is no need to use LZMA_FINISH, but allowing it may simplify * certain types of applications. * * \return - LZMA_OK * - LZMA_MEM_ERROR * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_alone_decoder( lzma_stream *strm, uint64_t memlimit) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Single-call .xz Stream decoder * * \param memlimit Pointer to how much memory the decoder is allowed * to allocate. The value pointed by this pointer is * modified if and only if LZMA_MEMLIMIT_ERROR is * returned. * \param flags Bitwise-or of zero or more of the decoder flags: * LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK, * LZMA_CONCATENATED. Note that LZMA_TELL_ANY_CHECK * is not allowed and will return LZMA_PROG_ERROR. * \param allocator lzma_allocator for custom allocator functions. * Set to NULL to use malloc() and free(). * \param in Beginning of the input buffer * \param in_pos The next byte will be read from in[*in_pos]. * *in_pos is updated only if decoding succeeds. * \param in_size Size of the input buffer; the first byte that * won't be read is in[in_size]. * \param out Beginning of the output buffer * \param out_pos The next byte will be written to out[*out_pos]. * *out_pos is updated only if decoding succeeds. * \param out_size Size of the out buffer; the first byte into * which no data is written to is out[out_size]. * * \return - LZMA_OK: Decoding was successful. * - LZMA_FORMAT_ERROR * - LZMA_OPTIONS_ERROR * - LZMA_DATA_ERROR * - LZMA_NO_CHECK: This can be returned only if using * the LZMA_TELL_NO_CHECK flag. * - LZMA_UNSUPPORTED_CHECK: This can be returned only if using * the LZMA_TELL_UNSUPPORTED_CHECK flag. * - LZMA_MEM_ERROR * - LZMA_MEMLIMIT_ERROR: Memory usage limit was reached. * The minimum required memlimit value was stored to *memlimit. * - LZMA_BUF_ERROR: Output buffer was too small. * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_stream_buffer_decode( uint64_t *memlimit, uint32_t flags, const lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow lzma_attr_warn_unused_result; lzma/delta.h000064400000003511147631660250006763 0ustar00/** * \file lzma/delta.h * \brief Delta filter */ /* * Author: Lasse Collin * * This file has been put into the public domain. * You can do whatever you want with this file. * * See ../lzma.h for information about liblzma as a whole. */ #ifndef LZMA_H_INTERNAL # error Never include this file directly. Use instead. #endif /** * \brief Filter ID * * Filter ID of the Delta filter. This is used as lzma_filter.id. */ #define LZMA_FILTER_DELTA LZMA_VLI_C(0x03) /** * \brief Type of the delta calculation * * Currently only byte-wise delta is supported. Other possible types could * be, for example, delta of 16/32/64-bit little/big endian integers, but * these are not currently planned since byte-wise delta is almost as good. */ typedef enum { LZMA_DELTA_TYPE_BYTE } lzma_delta_type; /** * \brief Options for the Delta filter * * These options are needed by both encoder and decoder. */ typedef struct { /** For now, this must always be LZMA_DELTA_TYPE_BYTE. */ lzma_delta_type type; /** * \brief Delta distance * * With the only currently supported type, LZMA_DELTA_TYPE_BYTE, * the distance is as bytes. * * Examples: * - 16-bit stereo audio: distance = 4 bytes * - 24-bit RGB image data: distance = 3 bytes */ uint32_t dist; # define LZMA_DELTA_DIST_MIN 1 # define LZMA_DELTA_DIST_MAX 256 /* * Reserved space to allow possible future extensions without * breaking the ABI. You should not touch these, because the names * of these variables may change. These are and will never be used * when type is LZMA_DELTA_TYPE_BYTE, so it is safe to leave these * uninitialized. */ uint32_t reserved_int1; uint32_t reserved_int2; uint32_t reserved_int3; uint32_t reserved_int4; void *reserved_ptr1; void *reserved_ptr2; } lzma_options_delta; lzma/stream_flags.h000064400000020075147631660250010345 0ustar00/** * \file lzma/stream_flags.h * \brief .xz Stream Header and Stream Footer encoder and decoder */ /* * Author: Lasse Collin * * This file has been put into the public domain. * You can do whatever you want with this file. * * See ../lzma.h for information about liblzma as a whole. */ #ifndef LZMA_H_INTERNAL # error Never include this file directly. Use instead. #endif /** * \brief Size of Stream Header and Stream Footer * * Stream Header and Stream Footer have the same size and they are not * going to change even if a newer version of the .xz file format is * developed in future. */ #define LZMA_STREAM_HEADER_SIZE 12 /** * \brief Options for encoding/decoding Stream Header and Stream Footer */ typedef struct { /** * \brief Stream Flags format version * * To prevent API and ABI breakages if new features are needed in * Stream Header or Stream Footer, a version number is used to * indicate which fields in this structure are in use. For now, * version must always be zero. With non-zero version, the * lzma_stream_header_encode() and lzma_stream_footer_encode() * will return LZMA_OPTIONS_ERROR. * * lzma_stream_header_decode() and lzma_stream_footer_decode() * will always set this to the lowest value that supports all the * features indicated by the Stream Flags field. The application * must check that the version number set by the decoding functions * is supported by the application. Otherwise it is possible that * the application will decode the Stream incorrectly. */ uint32_t version; /** * \brief Backward Size * * Backward Size must be a multiple of four bytes. In this Stream * format version, Backward Size is the size of the Index field. * * Backward Size isn't actually part of the Stream Flags field, but * it is convenient to include in this structure anyway. Backward * Size is present only in the Stream Footer. There is no need to * initialize backward_size when encoding Stream Header. * * lzma_stream_header_decode() always sets backward_size to * LZMA_VLI_UNKNOWN so that it is convenient to use * lzma_stream_flags_compare() when both Stream Header and Stream * Footer have been decoded. */ lzma_vli backward_size; # define LZMA_BACKWARD_SIZE_MIN 4 # define LZMA_BACKWARD_SIZE_MAX (LZMA_VLI_C(1) << 34) /** * \brief Check ID * * This indicates the type of the integrity check calculated from * uncompressed data. */ lzma_check check; /* * Reserved space to allow possible future extensions without * breaking the ABI. You should not touch these, because the * names of these variables may change. * * (We will never be able to use all of these since Stream Flags * is just two bytes plus Backward Size of four bytes. But it's * nice to have the proper types when they are needed.) */ lzma_reserved_enum reserved_enum1; lzma_reserved_enum reserved_enum2; lzma_reserved_enum reserved_enum3; lzma_reserved_enum reserved_enum4; lzma_bool reserved_bool1; lzma_bool reserved_bool2; lzma_bool reserved_bool3; lzma_bool reserved_bool4; lzma_bool reserved_bool5; lzma_bool reserved_bool6; lzma_bool reserved_bool7; lzma_bool reserved_bool8; uint32_t reserved_int1; uint32_t reserved_int2; } lzma_stream_flags; /** * \brief Encode Stream Header * * \param options Stream Header options to be encoded. * options->backward_size is ignored and doesn't * need to be initialized. * \param out Beginning of the output buffer of * LZMA_STREAM_HEADER_SIZE bytes. * * \return - LZMA_OK: Encoding was successful. * - LZMA_OPTIONS_ERROR: options->version is not supported by * this liblzma version. * - LZMA_PROG_ERROR: Invalid options. */ extern LZMA_API(lzma_ret) lzma_stream_header_encode( const lzma_stream_flags *options, uint8_t *out) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Encode Stream Footer * * \param options Stream Footer options to be encoded. * \param out Beginning of the output buffer of * LZMA_STREAM_HEADER_SIZE bytes. * * \return - LZMA_OK: Encoding was successful. * - LZMA_OPTIONS_ERROR: options->version is not supported by * this liblzma version. * - LZMA_PROG_ERROR: Invalid options. */ extern LZMA_API(lzma_ret) lzma_stream_footer_encode( const lzma_stream_flags *options, uint8_t *out) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Decode Stream Header * * \param options Target for the decoded Stream Header options. * \param in Beginning of the input buffer of * LZMA_STREAM_HEADER_SIZE bytes. * * options->backward_size is always set to LZMA_VLI_UNKNOWN. This is to * help comparing Stream Flags from Stream Header and Stream Footer with * lzma_stream_flags_compare(). * * \return - LZMA_OK: Decoding was successful. * - LZMA_FORMAT_ERROR: Magic bytes don't match, thus the given * buffer cannot be Stream Header. * - LZMA_DATA_ERROR: CRC32 doesn't match, thus the header * is corrupt. * - LZMA_OPTIONS_ERROR: Unsupported options are present * in the header. * * \note When decoding .xz files that contain multiple Streams, it may * make sense to print "file format not recognized" only if * decoding of the Stream Header of the _first_ Stream gives * LZMA_FORMAT_ERROR. If non-first Stream Header gives * LZMA_FORMAT_ERROR, the message used for LZMA_DATA_ERROR is * probably more appropriate. * * For example, Stream decoder in liblzma uses LZMA_DATA_ERROR if * LZMA_FORMAT_ERROR is returned by lzma_stream_header_decode() * when decoding non-first Stream. */ extern LZMA_API(lzma_ret) lzma_stream_header_decode( lzma_stream_flags *options, const uint8_t *in) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Decode Stream Footer * * \param options Target for the decoded Stream Header options. * \param in Beginning of the input buffer of * LZMA_STREAM_HEADER_SIZE bytes. * * \return - LZMA_OK: Decoding was successful. * - LZMA_FORMAT_ERROR: Magic bytes don't match, thus the given * buffer cannot be Stream Footer. * - LZMA_DATA_ERROR: CRC32 doesn't match, thus the Stream Footer * is corrupt. * - LZMA_OPTIONS_ERROR: Unsupported options are present * in Stream Footer. * * \note If Stream Header was already decoded successfully, but * decoding Stream Footer returns LZMA_FORMAT_ERROR, the * application should probably report some other error message * than "file format not recognized", since the file more likely * is corrupt (possibly truncated). Stream decoder in liblzma * uses LZMA_DATA_ERROR in this situation. */ extern LZMA_API(lzma_ret) lzma_stream_footer_decode( lzma_stream_flags *options, const uint8_t *in) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Compare two lzma_stream_flags structures * * backward_size values are compared only if both are not * LZMA_VLI_UNKNOWN. * * \return - LZMA_OK: Both are equal. If either had backward_size set * to LZMA_VLI_UNKNOWN, backward_size values were not * compared or validated. * - LZMA_DATA_ERROR: The structures differ. * - LZMA_OPTIONS_ERROR: version in either structure is greater * than the maximum supported version (currently zero). * - LZMA_PROG_ERROR: Invalid value, e.g. invalid check or * backward_size. */ extern LZMA_API(lzma_ret) lzma_stream_flags_compare( const lzma_stream_flags *a, const lzma_stream_flags *b) lzma_nothrow lzma_attr_pure; lzma/hardware.h000064400000005055147631660250007474 0ustar00/** * \file lzma/hardware.h * \brief Hardware information * * Since liblzma can consume a lot of system resources, it also provides * ways to limit the resource usage. Applications linking against liblzma * need to do the actual decisions how much resources to let liblzma to use. * To ease making these decisions, liblzma provides functions to find out * the relevant capabilities of the underlaying hardware. Currently there * is only a function to find out the amount of RAM, but in the future there * will be also a function to detect how many concurrent threads the system * can run. * * \note On some operating systems, these function may temporarily * load a shared library or open file descriptor(s) to find out * the requested hardware information. Unless the application * assumes that specific file descriptors are not touched by * other threads, this should have no effect on thread safety. * Possible operations involving file descriptors will restart * the syscalls if they return EINTR. */ /* * Author: Lasse Collin * * This file has been put into the public domain. * You can do whatever you want with this file. * * See ../lzma.h for information about liblzma as a whole. */ #ifndef LZMA_H_INTERNAL # error Never include this file directly. Use instead. #endif /** * \brief Get the total amount of physical memory (RAM) in bytes * * This function may be useful when determining a reasonable memory * usage limit for decompressing or how much memory it is OK to use * for compressing. * * \return On success, the total amount of physical memory in bytes * is returned. If the amount of RAM cannot be determined, * zero is returned. This can happen if an error occurs * or if there is no code in liblzma to detect the amount * of RAM on the specific operating system. */ extern LZMA_API(uint64_t) lzma_physmem(void) lzma_nothrow; /** * \brief Get the number of processor cores or threads * * This function may be useful when determining how many threads to use. * If the hardware supports more than one thread per CPU core, the number * of hardware threads is returned if that information is available. * * \brief On success, the number of available CPU threads or cores is * returned. If this information isn't available or an error * occurs, zero is returned. */ extern LZMA_API(uint32_t) lzma_cputhreads(void) lzma_nothrow; lzma/filter.h000064400000040055147631660250007163 0ustar00/** * \file lzma/filter.h * \brief Common filter related types and functions */ /* * Author: Lasse Collin * * This file has been put into the public domain. * You can do whatever you want with this file. * * See ../lzma.h for information about liblzma as a whole. */ #ifndef LZMA_H_INTERNAL # error Never include this file directly. Use instead. #endif /** * \brief Maximum number of filters in a chain * * A filter chain can have 1-4 filters, of which three are allowed to change * the size of the data. Usually only one or two filters are needed. */ #define LZMA_FILTERS_MAX 4 /** * \brief Filter options * * This structure is used to pass Filter ID and a pointer filter's * options to liblzma. A few functions work with a single lzma_filter * structure, while most functions expect a filter chain. * * A filter chain is indicated with an array of lzma_filter structures. * The array is terminated with .id = LZMA_VLI_UNKNOWN. Thus, the filter * array must have LZMA_FILTERS_MAX + 1 elements (that is, five) to * be able to hold any arbitrary filter chain. This is important when * using lzma_block_header_decode() from block.h, because too small * array would make liblzma write past the end of the filters array. */ typedef struct { /** * \brief Filter ID * * Use constants whose name begin with `LZMA_FILTER_' to specify * different filters. In an array of lzma_filter structures, use * LZMA_VLI_UNKNOWN to indicate end of filters. * * \note This is not an enum, because on some systems enums * cannot be 64-bit. */ lzma_vli id; /** * \brief Pointer to filter-specific options structure * * If the filter doesn't need options, set this to NULL. If id is * set to LZMA_VLI_UNKNOWN, options is ignored, and thus * doesn't need be initialized. */ void *options; } lzma_filter; /** * \brief Test if the given Filter ID is supported for encoding * * Return true if the give Filter ID is supported for encoding by this * liblzma build. Otherwise false is returned. * * There is no way to list which filters are available in this particular * liblzma version and build. It would be useless, because the application * couldn't know what kind of options the filter would need. */ extern LZMA_API(lzma_bool) lzma_filter_encoder_is_supported(lzma_vli id) lzma_nothrow lzma_attr_const; /** * \brief Test if the given Filter ID is supported for decoding * * Return true if the give Filter ID is supported for decoding by this * liblzma build. Otherwise false is returned. */ extern LZMA_API(lzma_bool) lzma_filter_decoder_is_supported(lzma_vli id) lzma_nothrow lzma_attr_const; /** * \brief Copy the filters array * * Copy the Filter IDs and filter-specific options from src to dest. * Up to LZMA_FILTERS_MAX filters are copied, plus the terminating * .id == LZMA_VLI_UNKNOWN. Thus, dest should have at least * LZMA_FILTERS_MAX + 1 elements space unless the caller knows that * src is smaller than that. * * Unless the filter-specific options is NULL, the Filter ID has to be * supported by liblzma, because liblzma needs to know the size of every * filter-specific options structure. The filter-specific options are not * validated. If options is NULL, any unsupported Filter IDs are copied * without returning an error. * * Old filter-specific options in dest are not freed, so dest doesn't * need to be initialized by the caller in any way. * * If an error occurs, memory possibly already allocated by this function * is always freed. * * \return - LZMA_OK * - LZMA_MEM_ERROR * - LZMA_OPTIONS_ERROR: Unsupported Filter ID and its options * is not NULL. * - LZMA_PROG_ERROR: src or dest is NULL. */ extern LZMA_API(lzma_ret) lzma_filters_copy( const lzma_filter *src, lzma_filter *dest, const lzma_allocator *allocator) lzma_nothrow; /** * \brief Calculate approximate memory requirements for raw encoder * * This function can be used to calculate the memory requirements for * Block and Stream encoders too because Block and Stream encoders don't * need significantly more memory than raw encoder. * * \param filters Array of filters terminated with * .id == LZMA_VLI_UNKNOWN. * * \return Number of bytes of memory required for the given * filter chain when encoding. If an error occurs, * for example due to unsupported filter chain, * UINT64_MAX is returned. */ extern LZMA_API(uint64_t) lzma_raw_encoder_memusage(const lzma_filter *filters) lzma_nothrow lzma_attr_pure; /** * \brief Calculate approximate memory requirements for raw decoder * * This function can be used to calculate the memory requirements for * Block and Stream decoders too because Block and Stream decoders don't * need significantly more memory than raw decoder. * * \param filters Array of filters terminated with * .id == LZMA_VLI_UNKNOWN. * * \return Number of bytes of memory required for the given * filter chain when decoding. If an error occurs, * for example due to unsupported filter chain, * UINT64_MAX is returned. */ extern LZMA_API(uint64_t) lzma_raw_decoder_memusage(const lzma_filter *filters) lzma_nothrow lzma_attr_pure; /** * \brief Initialize raw encoder * * This function may be useful when implementing custom file formats. * * \param strm Pointer to properly prepared lzma_stream * \param filters Array of lzma_filter structures. The end of the * array must be marked with .id = LZMA_VLI_UNKNOWN. * * The `action' with lzma_code() can be LZMA_RUN, LZMA_SYNC_FLUSH (if the * filter chain supports it), or LZMA_FINISH. * * \return - LZMA_OK * - LZMA_MEM_ERROR * - LZMA_OPTIONS_ERROR * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_raw_encoder( lzma_stream *strm, const lzma_filter *filters) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Initialize raw decoder * * The initialization of raw decoder goes similarly to raw encoder. * * The `action' with lzma_code() can be LZMA_RUN or LZMA_FINISH. Using * LZMA_FINISH is not required, it is supported just for convenience. * * \return - LZMA_OK * - LZMA_MEM_ERROR * - LZMA_OPTIONS_ERROR * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_raw_decoder( lzma_stream *strm, const lzma_filter *filters) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Update the filter chain in the encoder * * This function is for advanced users only. This function has two slightly * different purposes: * * - After LZMA_FULL_FLUSH when using Stream encoder: Set a new filter * chain, which will be used starting from the next Block. * * - After LZMA_SYNC_FLUSH using Raw, Block, or Stream encoder: Change * the filter-specific options in the middle of encoding. The actual * filters in the chain (Filter IDs) cannot be changed. In the future, * it might become possible to change the filter options without * using LZMA_SYNC_FLUSH. * * While rarely useful, this function may be called also when no data has * been compressed yet. In that case, this function will behave as if * LZMA_FULL_FLUSH (Stream encoder) or LZMA_SYNC_FLUSH (Raw or Block * encoder) had been used right before calling this function. * * \return - LZMA_OK * - LZMA_MEM_ERROR * - LZMA_MEMLIMIT_ERROR * - LZMA_OPTIONS_ERROR * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_filters_update( lzma_stream *strm, const lzma_filter *filters) lzma_nothrow; /** * \brief Single-call raw encoder * * \param filters Array of lzma_filter structures. The end of the * array must be marked with .id = LZMA_VLI_UNKNOWN. * \param allocator lzma_allocator for custom allocator functions. * Set to NULL to use malloc() and free(). * \param in Beginning of the input buffer * \param in_size Size of the input buffer * \param out Beginning of the output buffer * \param out_pos The next byte will be written to out[*out_pos]. * *out_pos is updated only if encoding succeeds. * \param out_size Size of the out buffer; the first byte into * which no data is written to is out[out_size]. * * \return - LZMA_OK: Encoding was successful. * - LZMA_BUF_ERROR: Not enough output buffer space. * - LZMA_OPTIONS_ERROR * - LZMA_MEM_ERROR * - LZMA_DATA_ERROR * - LZMA_PROG_ERROR * * \note There is no function to calculate how big output buffer * would surely be big enough. (lzma_stream_buffer_bound() * works only for lzma_stream_buffer_encode(); raw encoder * won't necessarily meet that bound.) */ extern LZMA_API(lzma_ret) lzma_raw_buffer_encode( const lzma_filter *filters, const lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow; /** * \brief Single-call raw decoder * * \param filters Array of lzma_filter structures. The end of the * array must be marked with .id = LZMA_VLI_UNKNOWN. * \param allocator lzma_allocator for custom allocator functions. * Set to NULL to use malloc() and free(). * \param in Beginning of the input buffer * \param in_pos The next byte will be read from in[*in_pos]. * *in_pos is updated only if decoding succeeds. * \param in_size Size of the input buffer; the first byte that * won't be read is in[in_size]. * \param out Beginning of the output buffer * \param out_pos The next byte will be written to out[*out_pos]. * *out_pos is updated only if encoding succeeds. * \param out_size Size of the out buffer; the first byte into * which no data is written to is out[out_size]. */ extern LZMA_API(lzma_ret) lzma_raw_buffer_decode( const lzma_filter *filters, const lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow; /** * \brief Get the size of the Filter Properties field * * This function may be useful when implementing custom file formats * using the raw encoder and decoder. * * \param size Pointer to uint32_t to hold the size of the properties * \param filter Filter ID and options (the size of the properties may * vary depending on the options) * * \return - LZMA_OK * - LZMA_OPTIONS_ERROR * - LZMA_PROG_ERROR * * \note This function validates the Filter ID, but does not * necessarily validate the options. Thus, it is possible * that this returns LZMA_OK while the following call to * lzma_properties_encode() returns LZMA_OPTIONS_ERROR. */ extern LZMA_API(lzma_ret) lzma_properties_size( uint32_t *size, const lzma_filter *filter) lzma_nothrow; /** * \brief Encode the Filter Properties field * * \param filter Filter ID and options * \param props Buffer to hold the encoded options. The size of * buffer must have been already determined with * lzma_properties_size(). * * \return - LZMA_OK * - LZMA_OPTIONS_ERROR * - LZMA_PROG_ERROR * * \note Even this function won't validate more options than actually * necessary. Thus, it is possible that encoding the properties * succeeds but using the same options to initialize the encoder * will fail. * * \note If lzma_properties_size() indicated that the size * of the Filter Properties field is zero, calling * lzma_properties_encode() is not required, but it * won't do any harm either. */ extern LZMA_API(lzma_ret) lzma_properties_encode( const lzma_filter *filter, uint8_t *props) lzma_nothrow; /** * \brief Decode the Filter Properties field * * \param filter filter->id must have been set to the correct * Filter ID. filter->options doesn't need to be * initialized (it's not freed by this function). The * decoded options will be stored to filter->options. * filter->options is set to NULL if there are no * properties or if an error occurs. * \param allocator Custom memory allocator used to allocate the * options. Set to NULL to use the default malloc(), * and in case of an error, also free(). * \param props Input buffer containing the properties. * \param props_size Size of the properties. This must be the exact * size; giving too much or too little input will * return LZMA_OPTIONS_ERROR. * * \return - LZMA_OK * - LZMA_OPTIONS_ERROR * - LZMA_MEM_ERROR */ extern LZMA_API(lzma_ret) lzma_properties_decode( lzma_filter *filter, const lzma_allocator *allocator, const uint8_t *props, size_t props_size) lzma_nothrow; /** * \brief Calculate encoded size of a Filter Flags field * * Knowing the size of Filter Flags is useful to know when allocating * memory to hold the encoded Filter Flags. * * \param size Pointer to integer to hold the calculated size * \param filter Filter ID and associated options whose encoded * size is to be calculated * * \return - LZMA_OK: *size set successfully. Note that this doesn't * guarantee that filter->options is valid, thus * lzma_filter_flags_encode() may still fail. * - LZMA_OPTIONS_ERROR: Unknown Filter ID or unsupported options. * - LZMA_PROG_ERROR: Invalid options * * \note If you need to calculate size of List of Filter Flags, * you need to loop over every lzma_filter entry. */ extern LZMA_API(lzma_ret) lzma_filter_flags_size( uint32_t *size, const lzma_filter *filter) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Encode Filter Flags into given buffer * * In contrast to some functions, this doesn't allocate the needed buffer. * This is due to how this function is used internally by liblzma. * * \param filter Filter ID and options to be encoded * \param out Beginning of the output buffer * \param out_pos out[*out_pos] is the next write position. This * is updated by the encoder. * \param out_size out[out_size] is the first byte to not write. * * \return - LZMA_OK: Encoding was successful. * - LZMA_OPTIONS_ERROR: Invalid or unsupported options. * - LZMA_PROG_ERROR: Invalid options or not enough output * buffer space (you should have checked it with * lzma_filter_flags_size()). */ extern LZMA_API(lzma_ret) lzma_filter_flags_encode(const lzma_filter *filter, uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow lzma_attr_warn_unused_result; /** * \brief Decode Filter Flags from given buffer * * The decoded result is stored into *filter. The old value of * filter->options is not free()d. * * \return - LZMA_OK * - LZMA_OPTIONS_ERROR * - LZMA_MEM_ERROR * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_filter_flags_decode( lzma_filter *filter, const lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size) lzma_nothrow lzma_attr_warn_unused_result; fpu_control.h000064400000006777147631660250007302 0ustar00/* FPU control word bits. x86 version. Copyright (C) 1993-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Olaf Flebbe. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _FPU_CONTROL_H #define _FPU_CONTROL_H 1 /* Note that this file sets on x86-64 only the x87 FPU, it does not touch the SSE unit. */ /* Here is the dirty part. Set up your 387 through the control word * (cw) register. * * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0 * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM * * IM: Invalid operation mask * DM: Denormalized operand mask * ZM: Zero-divide mask * OM: Overflow mask * UM: Underflow mask * PM: Precision (inexact result) mask * * Mask bit is 1 means no interrupt. * * PC: Precision control * 11 - round to extended precision * 10 - round to double precision * 00 - round to single precision * * RC: Rounding control * 00 - rounding to nearest * 01 - rounding down (toward - infinity) * 10 - rounding up (toward + infinity) * 11 - rounding toward zero * * IC: Infinity control * That is for 8087 and 80287 only. * * The hardware default is 0x037f which we use. */ #include /* masking of interrupts */ #define _FPU_MASK_IM 0x01 #define _FPU_MASK_DM 0x02 #define _FPU_MASK_ZM 0x04 #define _FPU_MASK_OM 0x08 #define _FPU_MASK_UM 0x10 #define _FPU_MASK_PM 0x20 /* precision control */ #define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */ #define _FPU_DOUBLE 0x200 #define _FPU_SINGLE 0x0 /* rounding control */ #define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */ #define _FPU_RC_DOWN 0x400 #define _FPU_RC_UP 0x800 #define _FPU_RC_ZERO 0xC00 #define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */ /* The fdlibm code requires strict IEEE double precision arithmetic, and no interrupts for exceptions, rounding to nearest. */ #define _FPU_DEFAULT 0x037f /* IEEE: same as above. */ #define _FPU_IEEE 0x037f /* Type of the control word. */ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__))); /* Macros for accessing the hardware control word. "*&" is used to work around a bug in older versions of GCC. __volatile__ is used to support combination of writing the control register and reading it back. Without __volatile__, the old value may be used for reading back under compiler optimization. Note that the use of these macros is not sufficient anymore with recent hardware nor on x86-64. Some floating point operations are executed in the SSE/SSE2 engines which have their own control and status register. */ #define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw)) #define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw)) /* Default control word set at startup. */ extern fpu_control_t __fpu_control; #endif /* fpu_control.h */ libpng15/pnglibconf.h000064400000014465147631660250010503 0ustar00/* pnglibconf.h - library build configuration */ /* libpng version 1.5.13 - September 27, 2012 */ /* Copyright (c) 1998-2011 Glenn Randers-Pehrson */ /* This code is released under the libpng license. */ /* For conditions of distribution and use, see the disclaimer */ /* and license in png.h */ /* pnglibconf.h */ /* Machine generated file: DO NOT EDIT */ /* Derived from: scripts/pnglibconf.dfa */ #ifndef PNGLCONF_H #define PNGLCONF_H /* settings */ #define PNG_MAX_GAMMA_8 11 #define PNG_CALLOC_SUPPORTED #define PNG_QUANTIZE_RED_BITS 5 #define PNG_QUANTIZE_GREEN_BITS 5 #define PNG_API_RULE 0 #define PNG_QUANTIZE_BLUE_BITS 5 #define PNG_USER_CHUNK_CACHE_MAX 1000 #define PNG_sCAL_PRECISION 5 #define PNG_COST_SHIFT 3 #define PNG_WEIGHT_SHIFT 8 #define PNG_USER_CHUNK_MALLOC_MAX 1000000000 #define PNG_DEFAULT_READ_MACROS 1 #define PNG_ZBUF_SIZE 8192 #define PNG_GAMMA_THRESHOLD_FIXED 5000 /* end of settings */ /* options */ #define PNG_INFO_IMAGE_SUPPORTED 1 #define PNG_HANDLE_AS_UNKNOWN_SUPPORTED 1 #define PNG_POINTER_INDEXING_SUPPORTED 1 #define PNG_WARNINGS_SUPPORTED 1 #define PNG_FLOATING_ARITHMETIC_SUPPORTED 1 #define PNG_WRITE_SUPPORTED 1 #define PNG_WRITE_INTERLACING_SUPPORTED 1 #define PNG_WRITE_16BIT_SUPPORTED 1 #define PNG_EASY_ACCESS_SUPPORTED 1 #define PNG_ALIGN_MEMORY_SUPPORTED 1 #define PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED 1 #define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED 1 #define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED 1 #define PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED 1 #define PNG_FIXED_POINT_SUPPORTED 1 /*#undef PNG_ERROR_NUMBERS_SUPPORTED*/ #define PNG_ERROR_TEXT_SUPPORTED 1 #define PNG_READ_SUPPORTED 1 #define PNG_BENIGN_ERRORS_SUPPORTED 1 #define PNG_SETJMP_SUPPORTED 1 #define PNG_TIME_RFC1123_SUPPORTED 1 #define PNG_WRITE_FLUSH_SUPPORTED 1 #define PNG_MNG_FEATURES_SUPPORTED 1 #define PNG_SAFE_LIMITS_SUPPORTED 1 #define PNG_FLOATING_POINT_SUPPORTED 1 #define PNG_WRITE_OPTIMIZE_CMF_SUPPORTED 1 #define PNG_INCH_CONVERSIONS_SUPPORTED 1 #define PNG_STDIO_SUPPORTED 1 #define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED 1 #define PNG_USER_MEM_SUPPORTED 1 #define PNG_IO_STATE_SUPPORTED 1 #define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED 1 #define PNG_WRITE_INT_FUNCTIONS_SUPPORTED 1 #define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED 1 #define PNG_WRITE_FILTER_SUPPORTED 1 #define PNG_WRITE_zTXt_SUPPORTED 1 #define PNG_WRITE_iCCP_SUPPORTED 1 #define PNG_READ_TRANSFORMS_SUPPORTED 1 #define PNG_READ_bKGD_SUPPORTED 1 #define PNG_UNKNOWN_CHUNKS_SUPPORTED 1 #define PNG_READ_sCAL_SUPPORTED 1 #define PNG_WRITE_hIST_SUPPORTED 1 #define PNG_READ_OPT_PLTE_SUPPORTED 1 #define PNG_WRITE_gAMA_SUPPORTED 1 #define PNG_READ_GRAY_TO_RGB_SUPPORTED 1 #define PNG_WRITE_pCAL_SUPPORTED 1 #define PNG_READ_INVERT_ALPHA_SUPPORTED 1 #define PNG_WRITE_TRANSFORMS_SUPPORTED 1 #define PNG_READ_ALPHA_MODE_SUPPORTED 1 #define PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED 1 #define PNG_READ_sBIT_SUPPORTED 1 #define PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED 1 #define PNG_READ_PACK_SUPPORTED 1 #define PNG_WRITE_iTXt_SUPPORTED 1 #define PNG_WRITE_SWAP_SUPPORTED 1 #define PNG_READ_cHRM_SUPPORTED 1 #define PNG_READ_STRIP_16_TO_8_SUPPORTED 1 #define PNG_WRITE_tIME_SUPPORTED 1 #define PNG_READ_INTERLACING_SUPPORTED 1 #define PNG_READ_tRNS_SUPPORTED 1 #define PNG_WRITE_pHYs_SUPPORTED 1 #define PNG_WRITE_INVERT_SUPPORTED 1 #define PNG_READ_RGB_TO_GRAY_SUPPORTED 1 #define PNG_WRITE_sRGB_SUPPORTED 1 #define PNG_READ_oFFs_SUPPORTED 1 #define PNG_WRITE_FILLER_SUPPORTED 1 #define PNG_WRITE_SHIFT_SUPPORTED 1 #define PNG_PROGRESSIVE_READ_SUPPORTED 1 #define PNG_READ_SHIFT_SUPPORTED 1 #define PNG_CONVERT_tIME_SUPPORTED 1 #define PNG_READ_USER_TRANSFORM_SUPPORTED 1 #define PNG_READ_INT_FUNCTIONS_SUPPORTED 1 #define PNG_READ_USER_CHUNKS_SUPPORTED 1 #define PNG_READ_hIST_SUPPORTED 1 #define PNG_READ_16BIT_SUPPORTED 1 #define PNG_READ_SWAP_ALPHA_SUPPORTED 1 #define PNG_READ_COMPOSITE_NODIV_SUPPORTED 1 #define PNG_SEQUENTIAL_READ_SUPPORTED 1 #define PNG_READ_BACKGROUND_SUPPORTED 1 #define PNG_READ_QUANTIZE_SUPPORTED 1 #define PNG_READ_zTXt_SUPPORTED 1 #define PNG_USER_LIMITS_SUPPORTED 1 #define PNG_READ_iCCP_SUPPORTED 1 #define PNG_READ_STRIP_ALPHA_SUPPORTED 1 #define PNG_READ_PACKSWAP_SUPPORTED 1 #define PNG_READ_sRGB_SUPPORTED 1 #define PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED 1 #define PNG_READ_pCAL_SUPPORTED 1 #define PNG_WRITE_sPLT_SUPPORTED 1 #define PNG_READ_iTXt_SUPPORTED 1 #define PNG_READ_SWAP_SUPPORTED 1 #define PNG_READ_tIME_SUPPORTED 1 #define PNG_READ_pHYs_SUPPORTED 1 #define PNG_WRITE_SWAP_ALPHA_SUPPORTED 1 #define PNG_READ_SCALE_16_TO_8_SUPPORTED 1 #define PNG_WRITE_BGR_SUPPORTED 1 #define PNG_USER_CHUNKS_SUPPORTED 1 #define PNG_CONSOLE_IO_SUPPORTED 1 #define PNG_WRITE_COMPRESSED_TEXT_SUPPORTED 1 #define PNG_WRITE_PACK_SUPPORTED 1 #define PNG_READ_FILLER_SUPPORTED 1 #define PNG_WRITE_bKGD_SUPPORTED 1 #define PNG_WRITE_tRNS_SUPPORTED 1 #define PNG_READ_sPLT_SUPPORTED 1 #define PNG_WRITE_sCAL_SUPPORTED 1 #define PNG_WRITE_oFFs_SUPPORTED 1 #define PNG_SET_USER_LIMITS_SUPPORTED 1 #define PNG_WRITE_sBIT_SUPPORTED 1 #define PNG_READ_INVERT_SUPPORTED 1 #define PNG_WRITE_cHRM_SUPPORTED 1 #define PNG_16BIT_SUPPORTED 1 #define PNG_WRITE_USER_TRANSFORM_SUPPORTED 1 #define PNG_READ_BGR_SUPPORTED 1 #define PNG_WRITE_PACKSWAP_SUPPORTED 1 #define PNG_WRITE_INVERT_ALPHA_SUPPORTED 1 #define PNG_sCAL_SUPPORTED 1 #define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED 1 #define PNG_READ_GAMMA_SUPPORTED 1 #define PNG_USER_TRANSFORM_INFO_SUPPORTED 1 #define PNG_sBIT_SUPPORTED 1 #define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED 1 #define PNG_cHRM_SUPPORTED 1 #define PNG_bKGD_SUPPORTED 1 #define PNG_tRNS_SUPPORTED 1 #define PNG_oFFs_SUPPORTED 1 #define PNG_READ_EXPAND_16_SUPPORTED 1 #define PNG_USER_TRANSFORM_PTR_SUPPORTED 1 #define PNG_WRITE_TEXT_SUPPORTED 1 #define PNG_READ_COMPRESSED_TEXT_SUPPORTED 1 #define PNG_hIST_SUPPORTED 1 #define PNG_zTXt_SUPPORTED 1 #define PNG_iCCP_SUPPORTED 1 #define PNG_sRGB_SUPPORTED 1 #define PNG_pCAL_SUPPORTED 1 #define PNG_WRITE_tEXt_SUPPORTED 1 #define PNG_CHECK_cHRM_SUPPORTED 1 #define PNG_READ_gAMA_SUPPORTED 1 #define PNG_iTXt_SUPPORTED 1 #define PNG_tIME_SUPPORTED 1 #define PNG_READ_EXPAND_SUPPORTED 1 #define PNG_pHYs_SUPPORTED 1 #define PNG_READ_TEXT_SUPPORTED 1 #define PNG_SAVE_INT_32_SUPPORTED 1 #define PNG_sPLT_SUPPORTED 1 #define PNG_READ_tEXt_SUPPORTED 1 #define PNG_gAMA_SUPPORTED 1 #define PNG_TEXT_SUPPORTED 1 #define PNG_tEXt_SUPPORTED 1 /* end of options */ #endif /* PNGLCONF_H */ fcntl.h000064400000023615147631660250006044 0ustar00/* Copyright (C) 1991-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ /* * POSIX Standard: 6.5 File Control Operations */ #ifndef _FCNTL_H #define _FCNTL_H 1 #include /* This must be early so can define types winningly. */ __BEGIN_DECLS /* Get __mode_t, __dev_t and __off_t .*/ #include /* Get the definitions of O_*, F_*, FD_*: all the numbers and flag bits for `open', `fcntl', et al. */ #include /* Detect if open needs mode as a third argument (or for openat as a fourth argument). */ #ifdef __O_TMPFILE # define __OPEN_NEEDS_MODE(oflag) \ (((oflag) & O_CREAT) != 0 || ((oflag) & __O_TMPFILE) == __O_TMPFILE) #else # define __OPEN_NEEDS_MODE(oflag) (((oflag) & O_CREAT) != 0) #endif /* POSIX.1-2001 specifies that these types are defined by . Earlier POSIX standards permitted any type ending in `_t' to be defined by any POSIX header, so we don't conditionalize the definitions here. */ #ifndef __mode_t_defined typedef __mode_t mode_t; # define __mode_t_defined #endif #ifndef __off_t_defined # ifndef __USE_FILE_OFFSET64 typedef __off_t off_t; # else typedef __off64_t off_t; # endif # define __off_t_defined #endif #if defined __USE_LARGEFILE64 && !defined __off64_t_defined typedef __off64_t off64_t; # define __off64_t_defined #endif #ifndef __pid_t_defined typedef __pid_t pid_t; # define __pid_t_defined #endif /* For XPG all symbols from should also be available. */ #if defined __USE_XOPEN || defined __USE_XOPEN2K8 # define __need_timespec # include # include # define S_IFMT __S_IFMT # define S_IFDIR __S_IFDIR # define S_IFCHR __S_IFCHR # define S_IFBLK __S_IFBLK # define S_IFREG __S_IFREG # ifdef __S_IFIFO # define S_IFIFO __S_IFIFO # endif # ifdef __S_IFLNK # define S_IFLNK __S_IFLNK # endif # if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) && defined __S_IFSOCK # define S_IFSOCK __S_IFSOCK # endif /* Protection bits. */ # define S_ISUID __S_ISUID /* Set user ID on execution. */ # define S_ISGID __S_ISGID /* Set group ID on execution. */ # if defined __USE_BSD || defined __USE_MISC || defined __USE_XOPEN /* Save swapped text after use (sticky bit). This is pretty well obsolete. */ # define S_ISVTX __S_ISVTX # endif # define S_IRUSR __S_IREAD /* Read by owner. */ # define S_IWUSR __S_IWRITE /* Write by owner. */ # define S_IXUSR __S_IEXEC /* Execute by owner. */ /* Read, write, and execute by owner. */ # define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC) # define S_IRGRP (S_IRUSR >> 3) /* Read by group. */ # define S_IWGRP (S_IWUSR >> 3) /* Write by group. */ # define S_IXGRP (S_IXUSR >> 3) /* Execute by group. */ /* Read, write, and execute by group. */ # define S_IRWXG (S_IRWXU >> 3) # define S_IROTH (S_IRGRP >> 3) /* Read by others. */ # define S_IWOTH (S_IWGRP >> 3) /* Write by others. */ # define S_IXOTH (S_IXGRP >> 3) /* Execute by others. */ /* Read, write, and execute by others. */ # define S_IRWXO (S_IRWXG >> 3) #endif #ifdef __USE_MISC # ifndef R_OK /* Verbatim from . Ugh. */ /* Values for the second argument to access. These may be OR'd together. */ # define R_OK 4 /* Test for read permission. */ # define W_OK 2 /* Test for write permission. */ # define X_OK 1 /* Test for execute permission. */ # define F_OK 0 /* Test for existence. */ # endif #endif /* Use misc. */ /* XPG wants the following symbols. has the same definitions. */ #if defined __USE_XOPEN || defined __USE_XOPEN2K8 # define SEEK_SET 0 /* Seek from beginning of file. */ # define SEEK_CUR 1 /* Seek from current position. */ # define SEEK_END 2 /* Seek from end of file. */ #endif /* XPG */ #ifdef __USE_ATFILE # define AT_FDCWD -100 /* Special value used to indicate the *at functions should use the current working directory. */ # define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */ # define AT_REMOVEDIR 0x200 /* Remove directory instead of unlinking file. */ # define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ # ifdef __USE_GNU # define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal. */ # define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname. */ # endif # define AT_EACCESS 0x200 /* Test access permitted for effective IDs, not real IDs. */ #endif /* Do the file control operation described by CMD on FD. The remaining arguments are interpreted depending on CMD. This function is a cancellation point and therefore not marked with __THROW. */ extern int fcntl (int __fd, int __cmd, ...); /* Open FILE and return a new file descriptor for it, or -1 on error. OFLAG determines the type of access used. If O_CREAT or O_TMPFILE is set in OFLAG, the third argument is taken as a `mode_t', the mode of the created file. This function is a cancellation point and therefore not marked with __THROW. */ #ifndef __USE_FILE_OFFSET64 extern int open (const char *__file, int __oflag, ...) __nonnull ((1)); #else # ifdef __REDIRECT extern int __REDIRECT (open, (const char *__file, int __oflag, ...), open64) __nonnull ((1)); # else # define open open64 # endif #endif #ifdef __USE_LARGEFILE64 extern int open64 (const char *__file, int __oflag, ...) __nonnull ((1)); #endif #ifdef __USE_ATFILE /* Similar to `open' but a relative path name is interpreted relative to the directory for which FD is a descriptor. NOTE: some other `openat' implementation support additional functionality through this interface, especially using the O_XATTR flag. This is not yet supported here. This function is a cancellation point and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int openat (int __fd, const char *__file, int __oflag, ...) __nonnull ((2)); # else # ifdef __REDIRECT extern int __REDIRECT (openat, (int __fd, const char *__file, int __oflag, ...), openat64) __nonnull ((2)); # else # define openat openat64 # endif # endif # ifdef __USE_LARGEFILE64 extern int openat64 (int __fd, const char *__file, int __oflag, ...) __nonnull ((2)); # endif #endif /* Create and open FILE, with mode MODE. This takes an `int' MODE argument because that is what `mode_t' will be widened to. This function is a cancellation point and therefore not marked with __THROW. */ #ifndef __USE_FILE_OFFSET64 extern int creat (const char *__file, mode_t __mode) __nonnull ((1)); #else # ifdef __REDIRECT extern int __REDIRECT (creat, (const char *__file, mode_t __mode), creat64) __nonnull ((1)); # else # define creat creat64 # endif #endif #ifdef __USE_LARGEFILE64 extern int creat64 (const char *__file, mode_t __mode) __nonnull ((1)); #endif #if !defined F_LOCK && (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \ && !defined __USE_POSIX)) /* NOTE: These declarations also appear in ; be sure to keep both files consistent. Some systems have them there and some here, and some software depends on the macros being defined without including both. */ /* `lockf' is a simpler interface to the locking facilities of `fcntl'. LEN is always relative to the current file position. The CMD argument is one of the following. */ # define F_ULOCK 0 /* Unlock a previously locked region. */ # define F_LOCK 1 /* Lock a region for exclusive use. */ # define F_TLOCK 2 /* Test and lock a region for exclusive use. */ # define F_TEST 3 /* Test a region for other processes locks. */ # ifndef __USE_FILE_OFFSET64 extern int lockf (int __fd, int __cmd, off_t __len); # else # ifdef __REDIRECT extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64); # else # define lockf lockf64 # endif # endif # ifdef __USE_LARGEFILE64 extern int lockf64 (int __fd, int __cmd, off64_t __len); # endif #endif #ifdef __USE_XOPEN2K /* Advice the system about the expected behaviour of the application with respect to the file associated with FD. */ # ifndef __USE_FILE_OFFSET64 extern int posix_fadvise (int __fd, off_t __offset, off_t __len, int __advise) __THROW; # else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (posix_fadvise, (int __fd, __off64_t __offset, __off64_t __len, int __advise), posix_fadvise64); # else # define posix_fadvise posix_fadvise64 # endif # endif # ifdef __USE_LARGEFILE64 extern int posix_fadvise64 (int __fd, off64_t __offset, off64_t __len, int __advise) __THROW; # endif /* Reserve storage for the data of the file associated with FD. This function is a possible cancellation point and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int posix_fallocate (int __fd, off_t __offset, off_t __len); # else # ifdef __REDIRECT extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset, __off64_t __len), posix_fallocate64); # else # define posix_fallocate posix_fallocate64 # endif # endif # ifdef __USE_LARGEFILE64 extern int posix_fallocate64 (int __fd, off64_t __offset, off64_t __len); # endif #endif /* Define some inlines helping to catch common problems. */ #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \ && defined __va_arg_pack_len # include #endif __END_DECLS #endif /* fcntl.h */ ecpgtype.h000064400000005075147631660250006556 0ustar00/* * This file implements a data structure that is built and maintained by the * preprocessor. * * All types that can be handled for host variable declarations has to * be handled eventually. * * src/interfaces/ecpg/include/ecpgtype.h */ /* * Here are all the types that we are to handle. Note that it is the type * that is registered and that has nothing whatsoever to do with the storage * class. * * Simple types * integers: char, short, int, long (signed and unsigned) * floats: float, double * * Complex types: * VARCHAR, VARCHAR2 - Strings with length (maxlen is given in the declaration) * Arrays of simple types and of VARCHAR, VARCHAR2 (size given in declaration) * Records build of simple types, arrays and other structs. * * Complicating things: * typedefs and struct names! * * Conclusion: * This is a typically recursive definition. A structure of typed list elements * would probably work fine: */ #ifndef _ECPGTYPE_H #define _ECPGTYPE_H #ifdef __cplusplus extern "C" { #endif enum ECPGttype { ECPGt_char = 1, ECPGt_unsigned_char, ECPGt_short, ECPGt_unsigned_short, ECPGt_int, ECPGt_unsigned_int, ECPGt_long, ECPGt_unsigned_long, ECPGt_long_long, ECPGt_unsigned_long_long, ECPGt_bool, ECPGt_float, ECPGt_double, ECPGt_varchar, ECPGt_varchar2, ECPGt_numeric, /* this is a decimal that stores its digits in * a malloced array */ ECPGt_decimal, /* this is a decimal that stores its digits in * a fixed array */ ECPGt_date, ECPGt_timestamp, ECPGt_interval, ECPGt_array, ECPGt_struct, ECPGt_union, ECPGt_descriptor, /* sql descriptor, no C variable */ ECPGt_char_variable, ECPGt_const, /* a constant is needed sometimes */ ECPGt_EOIT, /* End of insert types. */ ECPGt_EORT, /* End of result types. */ ECPGt_NO_INDICATOR, /* no indicator */ ECPGt_string, /* trimmed (char *) type */ ECPGt_sqlda /* C struct descriptor */ }; /* descriptor items */ enum ECPGdtype { ECPGd_count = 1, ECPGd_data, ECPGd_di_code, ECPGd_di_precision, ECPGd_indicator, ECPGd_key_member, ECPGd_length, ECPGd_name, ECPGd_nullable, ECPGd_octet, ECPGd_precision, ECPGd_ret_length, ECPGd_ret_octet, ECPGd_scale, ECPGd_type, ECPGd_EODT, /* End of descriptor types. */ ECPGd_cardinality }; #define IS_SIMPLE_TYPE(type) (((type) >= ECPGt_char && (type) <= ECPGt_interval) || ((type) == ECPGt_string)) /* we also have to handle different statement types */ enum ECPG_statement_type { ECPGst_normal, ECPGst_execute, ECPGst_exec_immediate, ECPGst_prepnormal }; #ifdef __cplusplus } #endif #endif /* _ECPGTYPE_H */ jmorecfg.h000064400000032777147631660250006543 0ustar00/* * jmorecfg.h * * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. * Modifications: * Copyright (C) 2009, 2011, D. R. Commander. * For conditions of distribution and use, see the accompanying README file. * * This file contains additional configuration options that customize the * JPEG software for special applications or support machine-dependent * optimizations. Most users will not need to touch this file. */ /* * Define BITS_IN_JSAMPLE as either * 8 for 8-bit sample values (the usual setting) * 12 for 12-bit sample values * Only 8 and 12 are legal data precisions for lossy JPEG according to the * JPEG standard, and the IJG code does not support anything else! * We do not support run-time selection of data precision, sorry. */ #define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ /* * Maximum number of components (color channels) allowed in JPEG image. * To meet the letter of the JPEG spec, set this to 255. However, darn * few applications need more than 4 channels (maybe 5 for CMYK + alpha * mask). We recommend 10 as a reasonable compromise; use 4 if you are * really short on memory. (Each allowed component costs a hundred or so * bytes of storage, whether actually used in an image or not.) */ #define MAX_COMPONENTS 10 /* maximum number of image components */ /* * Basic data types. * You may need to change these if you have a machine with unusual data * type sizes; for example, "char" not 8 bits, "short" not 16 bits, * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits, * but it had better be at least 16. */ /* Representation of a single sample (pixel element value). * We frequently allocate large arrays of these, so it's important to keep * them small. But if you have memory to burn and access to char or short * arrays is very slow on your hardware, you might want to change these. */ #if BITS_IN_JSAMPLE == 8 /* JSAMPLE should be the smallest type that will hold the values 0..255. * You can use a signed char by having GETJSAMPLE mask it with 0xFF. */ #ifdef HAVE_UNSIGNED_CHAR typedef unsigned char JSAMPLE; #define GETJSAMPLE(value) ((int) (value)) #else /* not HAVE_UNSIGNED_CHAR */ typedef char JSAMPLE; #ifdef __CHAR_UNSIGNED__ #define GETJSAMPLE(value) ((int) (value)) #else #define GETJSAMPLE(value) ((int) (value) & 0xFF) #endif /* __CHAR_UNSIGNED__ */ #endif /* HAVE_UNSIGNED_CHAR */ #define MAXJSAMPLE 255 #define CENTERJSAMPLE 128 #endif /* BITS_IN_JSAMPLE == 8 */ #if BITS_IN_JSAMPLE == 12 /* JSAMPLE should be the smallest type that will hold the values 0..4095. * On nearly all machines "short" will do nicely. */ typedef short JSAMPLE; #define GETJSAMPLE(value) ((int) (value)) #define MAXJSAMPLE 4095 #define CENTERJSAMPLE 2048 #endif /* BITS_IN_JSAMPLE == 12 */ /* Representation of a DCT frequency coefficient. * This should be a signed value of at least 16 bits; "short" is usually OK. * Again, we allocate large arrays of these, but you can change to int * if you have memory to burn and "short" is really slow. */ typedef short JCOEF; /* Compressed datastreams are represented as arrays of JOCTET. * These must be EXACTLY 8 bits wide, at least once they are written to * external storage. Note that when using the stdio data source/destination * managers, this is also the data type passed to fread/fwrite. */ #ifdef HAVE_UNSIGNED_CHAR typedef unsigned char JOCTET; #define GETJOCTET(value) (value) #else /* not HAVE_UNSIGNED_CHAR */ typedef char JOCTET; #ifdef __CHAR_UNSIGNED__ #define GETJOCTET(value) (value) #else #define GETJOCTET(value) ((value) & 0xFF) #endif /* __CHAR_UNSIGNED__ */ #endif /* HAVE_UNSIGNED_CHAR */ /* These typedefs are used for various table entries and so forth. * They must be at least as wide as specified; but making them too big * won't cost a huge amount of memory, so we don't provide special * extraction code like we did for JSAMPLE. (In other words, these * typedefs live at a different point on the speed/space tradeoff curve.) */ /* UINT8 must hold at least the values 0..255. */ #ifdef HAVE_UNSIGNED_CHAR typedef unsigned char UINT8; #else /* not HAVE_UNSIGNED_CHAR */ #ifdef __CHAR_UNSIGNED__ typedef char UINT8; #else /* not __CHAR_UNSIGNED__ */ typedef short UINT8; #endif /* __CHAR_UNSIGNED__ */ #endif /* HAVE_UNSIGNED_CHAR */ /* UINT16 must hold at least the values 0..65535. */ #ifdef HAVE_UNSIGNED_SHORT typedef unsigned short UINT16; #else /* not HAVE_UNSIGNED_SHORT */ typedef unsigned int UINT16; #endif /* HAVE_UNSIGNED_SHORT */ /* INT16 must hold at least the values -32768..32767. */ #ifndef XMD_H /* X11/xmd.h correctly defines INT16 */ typedef short INT16; #endif /* INT32 must hold at least signed 32-bit values. */ #ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ typedef long INT32; #endif /* Datatype used for image dimensions. The JPEG standard only supports * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore * "unsigned int" is sufficient on all machines. However, if you need to * handle larger images and you don't mind deviating from the spec, you * can change this datatype. */ typedef unsigned int JDIMENSION; #define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */ /* These macros are used in all function definitions and extern declarations. * You could modify them if you need to change function linkage conventions; * in particular, you'll need to do that to make the library a Windows DLL. * Another application is to make all functions global for use with debuggers * or code profilers that require it. */ /* a function called through method pointers: */ #define METHODDEF(type) static type /* a function used only in its module: */ #define LOCAL(type) static type /* a function referenced thru EXTERNs: */ #define GLOBAL(type) type /* a reference to a GLOBAL function: */ #define EXTERN(type) extern type /* This macro is used to declare a "method", that is, a function pointer. * We want to supply prototype parameters if the compiler can cope. * Note that the arglist parameter must be parenthesized! * Again, you can customize this if you need special linkage keywords. */ #ifdef HAVE_PROTOTYPES #define JMETHOD(type,methodname,arglist) type (*methodname) arglist #else #define JMETHOD(type,methodname,arglist) type (*methodname) () #endif /* Here is the pseudo-keyword for declaring pointers that must be "far" * on 80x86 machines. Most of the specialized coding for 80x86 is handled * by just saying "FAR *" where such a pointer is needed. In a few places * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol. */ #ifdef NEED_FAR_POINTERS #ifndef FAR #define FAR far #endif #else #undef FAR #define FAR #endif /* * On a few systems, type boolean and/or its values FALSE, TRUE may appear * in standard header files. Or you may have conflicts with application- * specific header files that you want to include together with these files. * Defining HAVE_BOOLEAN before including jpeglib.h should make it work. */ #ifndef HAVE_BOOLEAN typedef int boolean; #endif #ifndef FALSE /* in case these macros already exist */ #define FALSE 0 /* values of boolean */ #endif #ifndef TRUE #define TRUE 1 #endif /* * The remaining options affect code selection within the JPEG library, * but they don't need to be visible to most applications using the library. * To minimize application namespace pollution, the symbols won't be * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined. */ #ifdef JPEG_INTERNALS #define JPEG_INTERNAL_OPTIONS #endif #ifdef JPEG_INTERNAL_OPTIONS /* * These defines indicate whether to include various optional functions. * Undefining some of these symbols will produce a smaller but less capable * library. Note that you can leave certain source files out of the * compilation/linking process if you've #undef'd the corresponding symbols. * (You may HAVE to do that if your compiler doesn't like null source files.) */ /* Capability options common to encoder and decoder: */ #define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */ #define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */ #define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */ /* Encoder capability options: */ #define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ #define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ #define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ /* Note: if you selected 12-bit data precision, it is dangerous to turn off * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit * precision, so jchuff.c normally uses entropy optimization to compute * usable tables for higher precision. If you don't want to do optimization, * you'll have to supply different default Huffman tables. * The exact same statements apply for progressive JPEG: the default tables * don't work for progressive mode. (This may get fixed, however.) */ #define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */ /* Decoder capability options: */ #define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ #define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ #define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */ #define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */ #define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */ #undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */ #define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */ #define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */ #define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */ /* more capability options later, no doubt */ /* * Ordering of RGB data in scanlines passed to or from the application. * If your application wants to deal with data in the order B,G,R, just * change these macros. You can also deal with formats such as R,G,B,X * (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing * the offsets will also change the order in which colormap data is organized. * RESTRICTIONS: * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats. * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not * useful if you are using JPEG color spaces other than YCbCr or grayscale. * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE * is not 3 (they don't understand about dummy color components!). So you * can't use color quantization if you change that value. */ #define RGB_RED 0 /* Offset of Red in an RGB scanline element */ #define RGB_GREEN 1 /* Offset of Green */ #define RGB_BLUE 2 /* Offset of Blue */ #define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ #define JPEG_NUMCS 16 #define EXT_RGB_RED 0 #define EXT_RGB_GREEN 1 #define EXT_RGB_BLUE 2 #define EXT_RGB_PIXELSIZE 3 #define EXT_RGBX_RED 0 #define EXT_RGBX_GREEN 1 #define EXT_RGBX_BLUE 2 #define EXT_RGBX_PIXELSIZE 4 #define EXT_BGR_RED 2 #define EXT_BGR_GREEN 1 #define EXT_BGR_BLUE 0 #define EXT_BGR_PIXELSIZE 3 #define EXT_BGRX_RED 2 #define EXT_BGRX_GREEN 1 #define EXT_BGRX_BLUE 0 #define EXT_BGRX_PIXELSIZE 4 #define EXT_XBGR_RED 3 #define EXT_XBGR_GREEN 2 #define EXT_XBGR_BLUE 1 #define EXT_XBGR_PIXELSIZE 4 #define EXT_XRGB_RED 1 #define EXT_XRGB_GREEN 2 #define EXT_XRGB_BLUE 3 #define EXT_XRGB_PIXELSIZE 4 static const int rgb_red[JPEG_NUMCS] = { -1, -1, RGB_RED, -1, -1, -1, EXT_RGB_RED, EXT_RGBX_RED, EXT_BGR_RED, EXT_BGRX_RED, EXT_XBGR_RED, EXT_XRGB_RED, EXT_RGBX_RED, EXT_BGRX_RED, EXT_XBGR_RED, EXT_XRGB_RED }; static const int rgb_green[JPEG_NUMCS] = { -1, -1, RGB_GREEN, -1, -1, -1, EXT_RGB_GREEN, EXT_RGBX_GREEN, EXT_BGR_GREEN, EXT_BGRX_GREEN, EXT_XBGR_GREEN, EXT_XRGB_GREEN, EXT_RGBX_GREEN, EXT_BGRX_GREEN, EXT_XBGR_GREEN, EXT_XRGB_GREEN }; static const int rgb_blue[JPEG_NUMCS] = { -1, -1, RGB_BLUE, -1, -1, -1, EXT_RGB_BLUE, EXT_RGBX_BLUE, EXT_BGR_BLUE, EXT_BGRX_BLUE, EXT_XBGR_BLUE, EXT_XRGB_BLUE, EXT_RGBX_BLUE, EXT_BGRX_BLUE, EXT_XBGR_BLUE, EXT_XRGB_BLUE }; static const int rgb_pixelsize[JPEG_NUMCS] = { -1, -1, RGB_PIXELSIZE, -1, -1, -1, EXT_RGB_PIXELSIZE, EXT_RGBX_PIXELSIZE, EXT_BGR_PIXELSIZE, EXT_BGRX_PIXELSIZE, EXT_XBGR_PIXELSIZE, EXT_XRGB_PIXELSIZE, EXT_RGBX_PIXELSIZE, EXT_BGRX_PIXELSIZE, EXT_XBGR_PIXELSIZE, EXT_XRGB_PIXELSIZE }; /* Definitions for speed-related optimizations. */ /* On some machines (notably 68000 series) "int" is 32 bits, but multiplying * two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER * as short on such a machine. MULTIPLIER must be at least 16 bits wide. */ #ifndef MULTIPLIER #ifndef WITH_SIMD #define MULTIPLIER int /* type for fastest integer multiply */ #else #define MULTIPLIER short /* prefer 16-bit with SIMD for parellelism */ #endif #endif /* FAST_FLOAT should be either float or double, whichever is done faster * by your compiler. (Note that this type is only used in the floating point * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.) * Typically, float is faster in ANSI C compilers, while double is faster in * pre-ANSI compilers (because they insist on converting to double anyway). * The code below therefore chooses float if we have ANSI-style prototypes. */ #ifndef FAST_FLOAT #ifdef HAVE_PROTOTYPES #define FAST_FLOAT float #else #define FAST_FLOAT double #endif #endif #endif /* JPEG_INTERNAL_OPTIONS */ netiucv/iucv.h000064400000002300147631660250007345 0ustar00/* Copyright (C) 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef __NETIUCV_IUCV_H #define __NETIUCV_IUCV_H 1 #include #include __BEGIN_DECLS struct sockaddr_iucv { __SOCKADDR_COMMON (siucv_); unsigned short siucv_port; /* Reserved */ unsigned int siucv_addr; /* Reserved */ char siucv_nodeid[8]; /* Reserved */ char siucv_user_id[8]; /* Guest User Id */ char siucv_name[8]; /* Application Name */ }; __END_DECLS #endif obstack.h000064400000045536147631660250006372 0ustar00/* obstack.h - object stack macros Copyright (C) 1988-1994,1996-1999,2003,2004,2005,2009,2011,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ /* Summary: All the apparent functions defined here are macros. The idea is that you would use these pre-tested macros to solve a very specific set of problems, and they would run fast. Caution: no side-effects in arguments please!! They may be evaluated MANY times!! These macros operate a stack of objects. Each object starts life small, and may grow to maturity. (Consider building a word syllable by syllable.) An object can move while it is growing. Once it has been "finished" it never changes address again. So the "top of the stack" is typically an immature growing object, while the rest of the stack is of mature, fixed size and fixed address objects. These routines grab large chunks of memory, using a function you supply, called `obstack_chunk_alloc'. On occasion, they free chunks, by calling `obstack_chunk_free'. You must define them and declare them before using any obstack macros. Each independent stack is represented by a `struct obstack'. Each of the obstack macros expects a pointer to such a structure as the first argument. One motivation for this package is the problem of growing char strings in symbol tables. Unless you are "fascist pig with a read-only mind" --Gosper's immortal quote from HAKMEM item 154, out of context--you would not like to put any arbitrary upper limit on the length of your symbols. In practice this often means you will build many short symbols and a few long symbols. At the time you are reading a symbol you don't know how long it is. One traditional method is to read a symbol into a buffer, realloc()ating the buffer every time you try to read a symbol that is longer than the buffer. This is beaut, but you still will want to copy the symbol from the buffer to a more permanent symbol-table entry say about half the time. With obstacks, you can work differently. Use one obstack for all symbol names. As you read a symbol, grow the name in the obstack gradually. When the name is complete, finalize it. Then, if the symbol exists already, free the newly read name. The way we do this is to take a large chunk, allocating memory from low addresses. When you want to build a symbol in the chunk you just add chars above the current "high water mark" in the chunk. When you have finished adding chars, because you got to the end of the symbol, you know how long the chars are, and you can create a new object. Mostly the chars will not burst over the highest address of the chunk, because you would typically expect a chunk to be (say) 100 times as long as an average object. In case that isn't clear, when we have enough chars to make up the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed) so we just point to it where it lies. No moving of chars is needed and this is the second win: potentially long strings need never be explicitly shuffled. Once an object is formed, it does not change its address during its lifetime. When the chars burst over a chunk boundary, we allocate a larger chunk, and then copy the partly formed object from the end of the old chunk to the beginning of the new larger chunk. We then carry on accreting characters to the end of the object as we normally would. A special macro is provided to add a single char at a time to a growing object. This allows the use of register variables, which break the ordinary 'growth' macro. Summary: We allocate large chunks. We carve out one object at a time from the current chunk. Once carved, an object never moves. We are free to append data of any size to the currently growing object. Exactly one object is growing in an obstack at any one time. You can run one obstack per control block. You may have as many control blocks as you dare. Because of the way we do it, you can `unwind' an obstack back to a previous state. (You may remove objects much as you would with a stack.) */ /* Don't do the contents of this file more than once. */ #ifndef _OBSTACK_H #define _OBSTACK_H 1 #ifdef __cplusplus extern "C" { #endif /* We need the type of a pointer subtraction. If __PTRDIFF_TYPE__ is defined, as with GNU C, use that; that way we don't pollute the namespace with 's symbols. Otherwise, include and use ptrdiff_t. */ #ifdef __PTRDIFF_TYPE__ # define PTR_INT_TYPE __PTRDIFF_TYPE__ #else # include # define PTR_INT_TYPE ptrdiff_t #endif /* If B is the base of an object addressed by P, return the result of aligning P to the next multiple of A + 1. B and P must be of type char *. A + 1 must be a power of 2. */ #define __BPTR_ALIGN(B, P, A) ((B) + (((P) - (B) + (A)) & ~(A))) /* Similiar to _BPTR_ALIGN (B, P, A), except optimize the common case where pointers can be converted to integers, aligned as integers, and converted back again. If PTR_INT_TYPE is narrower than a pointer (e.g., the AS/400), play it safe and compute the alignment relative to B. Otherwise, use the faster strategy of computing the alignment relative to 0. */ #define __PTR_ALIGN(B, P, A) \ __BPTR_ALIGN (sizeof (PTR_INT_TYPE) < sizeof (void *) ? (B) : (char *) 0, \ P, A) #include struct _obstack_chunk /* Lives at front of each chunk. */ { char *limit; /* 1 past end of this chunk */ struct _obstack_chunk *prev; /* address of prior chunk or NULL */ char contents[4]; /* objects begin here */ }; struct obstack /* control current object in current chunk */ { long chunk_size; /* preferred size to allocate chunks in */ struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */ char *object_base; /* address of object we are building */ char *next_free; /* where to add next char to current object */ char *chunk_limit; /* address of char after current chunk */ union { PTR_INT_TYPE tempint; void *tempptr; } temp; /* Temporary for some macros. */ int alignment_mask; /* Mask of alignment for each object. */ /* These prototypes vary based on `use_extra_arg', and we use casts to the prototypeless function type in all assignments, but having prototypes here quiets -Wstrict-prototypes. */ struct _obstack_chunk *(*chunkfun) (void *, long); void (*freefun) (void *, struct _obstack_chunk *); void *extra_arg; /* first arg for chunk alloc/dealloc funcs */ unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */ unsigned maybe_empty_object:1;/* There is a possibility that the current chunk contains a zero-length object. This prevents freeing the chunk if we allocate a bigger chunk to replace it. */ unsigned alloc_failed:1; /* No longer used, as we now call the failed handler on error, but retained for binary compatibility. */ }; /* Declare the external functions we use; they are in obstack.c. */ extern void _obstack_newchunk (struct obstack *, int); extern int _obstack_begin (struct obstack *, int, int, void *(*) (long), void (*) (void *)); extern int _obstack_begin_1 (struct obstack *, int, int, void *(*) (void *, long), void (*) (void *, void *), void *); extern int _obstack_memory_used (struct obstack *); void obstack_free (struct obstack *__obstack, void *__block); /* Error handler called when `obstack_chunk_alloc' failed to allocate more memory. This can be set to a user defined function which should either abort gracefully or use longjump - but shouldn't return. The default action is to print a message and abort. */ extern void (*obstack_alloc_failed_handler) (void); /* Exit value used when `print_and_abort' is used. */ extern int obstack_exit_failure; /* Pointer to beginning of object being allocated or to be allocated next. Note that this might not be the final address of the object because a new chunk might be needed to hold the final size. */ #define obstack_base(h) ((void *) (h)->object_base) /* Size for allocating ordinary chunks. */ #define obstack_chunk_size(h) ((h)->chunk_size) /* Pointer to next byte not yet allocated in current chunk. */ #define obstack_next_free(h) ((h)->next_free) /* Mask specifying low bits that should be clear in address of an object. */ #define obstack_alignment_mask(h) ((h)->alignment_mask) /* To prevent prototype warnings provide complete argument list. */ #define obstack_init(h) \ _obstack_begin ((h), 0, 0, \ (void *(*) (long)) obstack_chunk_alloc, \ (void (*) (void *)) obstack_chunk_free) #define obstack_begin(h, size) \ _obstack_begin ((h), (size), 0, \ (void *(*) (long)) obstack_chunk_alloc, \ (void (*) (void *)) obstack_chunk_free) #define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ _obstack_begin ((h), (size), (alignment), \ (void *(*) (long)) (chunkfun), \ (void (*) (void *)) (freefun)) #define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ _obstack_begin_1 ((h), (size), (alignment), \ (void *(*) (void *, long)) (chunkfun), \ (void (*) (void *, void *)) (freefun), (arg)) #define obstack_chunkfun(h, newchunkfun) \ ((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun)) #define obstack_freefun(h, newfreefun) \ ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun)) #define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar)) #define obstack_blank_fast(h,n) ((h)->next_free += (n)) #define obstack_memory_used(h) _obstack_memory_used (h) #if defined __GNUC__ /* For GNU C, if not -traditional, we can define these macros to compute all args only once without using a global variable. Also, we can avoid using the `temp' slot, to make faster code. */ # define obstack_object_size(OBSTACK) \ __extension__ \ ({ struct obstack const *__o = (OBSTACK); \ (unsigned) (__o->next_free - __o->object_base); }) # define obstack_room(OBSTACK) \ __extension__ \ ({ struct obstack const *__o = (OBSTACK); \ (unsigned) (__o->chunk_limit - __o->next_free); }) # define obstack_make_room(OBSTACK,length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ int __len = (length); \ if (__o->chunk_limit - __o->next_free < __len) \ _obstack_newchunk (__o, __len); \ (void) 0; }) # define obstack_empty_p(OBSTACK) \ __extension__ \ ({ struct obstack const *__o = (OBSTACK); \ (__o->chunk->prev == 0 \ && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \ __o->chunk->contents, \ __o->alignment_mask)); }) # define obstack_grow(OBSTACK,where,length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ int __len = (length); \ if (__o->next_free + __len > __o->chunk_limit) \ _obstack_newchunk (__o, __len); \ memcpy (__o->next_free, where, __len); \ __o->next_free += __len; \ (void) 0; }) # define obstack_grow0(OBSTACK,where,length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ int __len = (length); \ if (__o->next_free + __len + 1 > __o->chunk_limit) \ _obstack_newchunk (__o, __len + 1); \ memcpy (__o->next_free, where, __len); \ __o->next_free += __len; \ *(__o->next_free)++ = 0; \ (void) 0; }) # define obstack_1grow(OBSTACK,datum) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ if (__o->next_free + 1 > __o->chunk_limit) \ _obstack_newchunk (__o, 1); \ obstack_1grow_fast (__o, datum); \ (void) 0; }) /* These assume that the obstack alignment is good enough for pointers or ints, and that the data added so far to the current object shares that much alignment. */ # define obstack_ptr_grow(OBSTACK,datum) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ if (__o->next_free + sizeof (void *) > __o->chunk_limit) \ _obstack_newchunk (__o, sizeof (void *)); \ obstack_ptr_grow_fast (__o, datum); }) \ # define obstack_int_grow(OBSTACK,datum) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ if (__o->next_free + sizeof (int) > __o->chunk_limit) \ _obstack_newchunk (__o, sizeof (int)); \ obstack_int_grow_fast (__o, datum); }) # define obstack_ptr_grow_fast(OBSTACK,aptr) \ __extension__ \ ({ struct obstack *__o1 = (OBSTACK); \ *(const void **) __o1->next_free = (aptr); \ __o1->next_free += sizeof (const void *); \ (void) 0; }) # define obstack_int_grow_fast(OBSTACK,aint) \ __extension__ \ ({ struct obstack *__o1 = (OBSTACK); \ *(int *) __o1->next_free = (aint); \ __o1->next_free += sizeof (int); \ (void) 0; }) # define obstack_blank(OBSTACK,length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ int __len = (length); \ if (__o->chunk_limit - __o->next_free < __len) \ _obstack_newchunk (__o, __len); \ obstack_blank_fast (__o, __len); \ (void) 0; }) # define obstack_alloc(OBSTACK,length) \ __extension__ \ ({ struct obstack *__h = (OBSTACK); \ obstack_blank (__h, (length)); \ obstack_finish (__h); }) # define obstack_copy(OBSTACK,where,length) \ __extension__ \ ({ struct obstack *__h = (OBSTACK); \ obstack_grow (__h, (where), (length)); \ obstack_finish (__h); }) # define obstack_copy0(OBSTACK,where,length) \ __extension__ \ ({ struct obstack *__h = (OBSTACK); \ obstack_grow0 (__h, (where), (length)); \ obstack_finish (__h); }) /* The local variable is named __o1 to avoid a name conflict when obstack_blank is called. */ # define obstack_finish(OBSTACK) \ __extension__ \ ({ struct obstack *__o1 = (OBSTACK); \ void *__value = (void *) __o1->object_base; \ if (__o1->next_free == __value) \ __o1->maybe_empty_object = 1; \ __o1->next_free \ = __PTR_ALIGN (__o1->object_base, __o1->next_free, \ __o1->alignment_mask); \ if (__o1->next_free - (char *)__o1->chunk \ > __o1->chunk_limit - (char *)__o1->chunk) \ __o1->next_free = __o1->chunk_limit; \ __o1->object_base = __o1->next_free; \ __value; }) # define obstack_free(OBSTACK, OBJ) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ void *__obj = (OBJ); \ if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \ __o->next_free = __o->object_base = (char *)__obj; \ else (obstack_free) (__o, __obj); }) #else /* not __GNUC__ */ # define obstack_object_size(h) \ (unsigned) ((h)->next_free - (h)->object_base) # define obstack_room(h) \ (unsigned) ((h)->chunk_limit - (h)->next_free) # define obstack_empty_p(h) \ ((h)->chunk->prev == 0 \ && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \ (h)->chunk->contents, \ (h)->alignment_mask)) /* Note that the call to _obstack_newchunk is enclosed in (..., 0) so that we can avoid having void expressions in the arms of the conditional expression. Casting the third operand to void was tried before, but some compilers won't accept it. */ # define obstack_make_room(h,length) \ ( (h)->temp.tempint = (length), \ (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0)) # define obstack_grow(h,where,length) \ ( (h)->temp.tempint = (length), \ (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \ memcpy ((h)->next_free, where, (h)->temp.tempint), \ (h)->next_free += (h)->temp.tempint) # define obstack_grow0(h,where,length) \ ( (h)->temp.tempint = (length), \ (((h)->next_free + (h)->temp.tempint + 1 > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), (h)->temp.tempint + 1), 0) : 0), \ memcpy ((h)->next_free, where, (h)->temp.tempint), \ (h)->next_free += (h)->temp.tempint, \ *((h)->next_free)++ = 0) # define obstack_1grow(h,datum) \ ( (((h)->next_free + 1 > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), 1), 0) : 0), \ obstack_1grow_fast (h, datum)) # define obstack_ptr_grow(h,datum) \ ( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ obstack_ptr_grow_fast (h, datum)) # define obstack_int_grow(h,datum) \ ( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ obstack_int_grow_fast (h, datum)) # define obstack_ptr_grow_fast(h,aptr) \ (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr)) # define obstack_int_grow_fast(h,aint) \ (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint)) # define obstack_blank(h,length) \ ( (h)->temp.tempint = (length), \ (((h)->chunk_limit - (h)->next_free < (h)->temp.tempint) \ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \ obstack_blank_fast (h, (h)->temp.tempint)) # define obstack_alloc(h,length) \ (obstack_blank ((h), (length)), obstack_finish ((h))) # define obstack_copy(h,where,length) \ (obstack_grow ((h), (where), (length)), obstack_finish ((h))) # define obstack_copy0(h,where,length) \ (obstack_grow0 ((h), (where), (length)), obstack_finish ((h))) # define obstack_finish(h) \ ( ((h)->next_free == (h)->object_base \ ? (((h)->maybe_empty_object = 1), 0) \ : 0), \ (h)->temp.tempptr = (h)->object_base, \ (h)->next_free \ = __PTR_ALIGN ((h)->object_base, (h)->next_free, \ (h)->alignment_mask), \ (((h)->next_free - (char *) (h)->chunk \ > (h)->chunk_limit - (char *) (h)->chunk) \ ? ((h)->next_free = (h)->chunk_limit) : 0), \ (h)->object_base = (h)->next_free, \ (h)->temp.tempptr) # define obstack_free(h,obj) \ ( (h)->temp.tempint = (char *) (obj) - (char *) (h)->chunk, \ ((((h)->temp.tempint > 0 \ && (h)->temp.tempint < (h)->chunk_limit - (char *) (h)->chunk)) \ ? (((h)->next_free = (h)->object_base \ = (h)->temp.tempint + (char *) (h)->chunk), 0) \ : ((obstack_free) ((h), (h)->temp.tempint + (char *) (h)->chunk), 0))) #endif /* not __GNUC__ */ #ifdef __cplusplus } /* C++ */ #endif #endif /* obstack.h */ utmp.h000064400000006242147631660260005721 0ustar00/* Copyright (C) 1993, 1996-1999, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _UTMP_H #define _UTMP_H 1 #include #include __BEGIN_DECLS /* Get system dependent values and data structures. */ #include /* Compatibility names for the strings of the canonical file names. */ #define UTMP_FILE _PATH_UTMP #define UTMP_FILENAME _PATH_UTMP #define WTMP_FILE _PATH_WTMP #define WTMP_FILENAME _PATH_WTMP /* Make FD be the controlling terminal, stdin, stdout, and stderr; then close FD. Returns 0 on success, nonzero on error. */ extern int login_tty (int __fd) __THROW; /* Write the given entry into utmp and wtmp. */ extern void login (const struct utmp *__entry) __THROW; /* Write the utmp entry to say the user on UT_LINE has logged out. */ extern int logout (const char *__ut_line) __THROW; /* Append to wtmp an entry for the current time and the given info. */ extern void logwtmp (const char *__ut_line, const char *__ut_name, const char *__ut_host) __THROW; /* Append entry UTMP to the wtmp-like file WTMP_FILE. */ extern void updwtmp (const char *__wtmp_file, const struct utmp *__utmp) __THROW; /* Change name of the utmp file to be examined. */ extern int utmpname (const char *__file) __THROW; /* Read next entry from a utmp-like file. */ extern struct utmp *getutent (void) __THROW; /* Reset the input stream to the beginning of the file. */ extern void setutent (void) __THROW; /* Close the current open file. */ extern void endutent (void) __THROW; /* Search forward from the current point in the utmp file until the next entry with a ut_type matching ID->ut_type. */ extern struct utmp *getutid (const struct utmp *__id) __THROW; /* Search forward from the current point in the utmp file until the next entry with a ut_line matching LINE->ut_line. */ extern struct utmp *getutline (const struct utmp *__line) __THROW; /* Write out entry pointed to by UTMP_PTR into the utmp file. */ extern struct utmp *pututline (const struct utmp *__utmp_ptr) __THROW; #ifdef __USE_MISC /* Reentrant versions of the file for handling utmp files. */ extern int getutent_r (struct utmp *__buffer, struct utmp **__result) __THROW; extern int getutid_r (const struct utmp *__id, struct utmp *__buffer, struct utmp **__result) __THROW; extern int getutline_r (const struct utmp *__line, struct utmp *__buffer, struct utmp **__result) __THROW; #endif /* Use misc. */ __END_DECLS #endif /* utmp.h */ signal.h000064400000032464147631660260006216 0ustar00/* Copyright (C) 1991-2004,2007,2009,2010,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ /* * ISO C99 Standard: 7.14 Signal handling */ #ifndef _SIGNAL_H #if !defined __need_sig_atomic_t && !defined __need_sigset_t # define _SIGNAL_H #endif #include __BEGIN_DECLS #include /* __sigset_t, __sig_atomic_t. */ /* An integral type that can be modified atomically, without the possibility of a signal arriving in the middle of the operation. */ #if defined __need_sig_atomic_t || defined _SIGNAL_H # ifndef __sig_atomic_t_defined # define __sig_atomic_t_defined __BEGIN_NAMESPACE_STD typedef __sig_atomic_t sig_atomic_t; __END_NAMESPACE_STD # endif # undef __need_sig_atomic_t #endif #if defined __need_sigset_t || (defined _SIGNAL_H && defined __USE_POSIX) # ifndef __sigset_t_defined # define __sigset_t_defined typedef __sigset_t sigset_t; # endif # undef __need_sigset_t #endif #ifdef _SIGNAL_H #include #include #if defined __USE_XOPEN || defined __USE_XOPEN2K # ifndef __pid_t_defined typedef __pid_t pid_t; # define __pid_t_defined #endif #ifdef __USE_XOPEN # endif # ifndef __uid_t_defined typedef __uid_t uid_t; # define __uid_t_defined # endif #endif /* Unix98 */ #ifdef __USE_POSIX199309 /* We need `struct timespec' later on. */ # define __need_timespec # include #endif #if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED /* Get the `siginfo_t' type plus the needed symbols. */ # include #endif /* Type of a signal handler. */ typedef void (*__sighandler_t) (int); /* The X/Open definition of `signal' specifies the SVID semantic. Use the additional function `sysv_signal' when X/Open compatibility is requested. */ extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler) __THROW; #ifdef __USE_GNU extern __sighandler_t sysv_signal (int __sig, __sighandler_t __handler) __THROW; #endif /* Set the handler for the signal SIG to HANDLER, returning the old handler, or SIG_ERR on error. By default `signal' has the BSD semantic. */ __BEGIN_NAMESPACE_STD #ifdef __USE_BSD extern __sighandler_t signal (int __sig, __sighandler_t __handler) __THROW; #else /* Make sure the used `signal' implementation is the SVID version. */ # ifdef __REDIRECT_NTH extern __sighandler_t __REDIRECT_NTH (signal, (int __sig, __sighandler_t __handler), __sysv_signal); # else # define signal __sysv_signal # endif #endif __END_NAMESPACE_STD #ifdef __USE_XOPEN /* The X/Open definition of `signal' conflicts with the BSD version. So they defined another function `bsd_signal'. */ extern __sighandler_t bsd_signal (int __sig, __sighandler_t __handler) __THROW; #endif /* Send signal SIG to process number PID. If PID is zero, send SIG to all processes in the current process's process group. If PID is < -1, send SIG to all processes in process group - PID. */ #ifdef __USE_POSIX extern int kill (__pid_t __pid, int __sig) __THROW; #endif /* Use POSIX. */ #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Send SIG to all processes in process group PGRP. If PGRP is zero, send SIG to all processes in the current process's process group. */ extern int killpg (__pid_t __pgrp, int __sig) __THROW; #endif /* Use BSD || X/Open Unix. */ __BEGIN_NAMESPACE_STD /* Raise signal SIG, i.e., send SIG to yourself. */ extern int raise (int __sig) __THROW; __END_NAMESPACE_STD #ifdef __USE_SVID /* SVID names for the same things. */ extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) __THROW; extern int gsignal (int __sig) __THROW; #endif /* Use SVID. */ #if defined __USE_MISC || defined __USE_XOPEN2K /* Print a message describing the meaning of the given signal number. */ extern void psignal (int __sig, const char *__s); #endif /* Use misc or POSIX 2008. */ #ifdef __USE_XOPEN2K /* Print a message describing the meaning of the given signal information. */ extern void psiginfo (const siginfo_t *__pinfo, const char *__s); #endif /* POSIX 2008. */ /* The `sigpause' function has two different interfaces. The original BSD definition defines the argument as a mask of the signal, while the more modern interface in X/Open defines it as the signal number. We go with the BSD version unless the user explicitly selects the X/Open version. This function is a cancellation point and therefore not marked with __THROW. */ extern int __sigpause (int __sig_or_mask, int __is_sig); #ifdef __FAVOR_BSD /* Set the mask of blocked signals to MASK, wait for a signal to arrive, and then restore the mask. */ extern int sigpause (int __mask) __THROW __attribute_deprecated__; #else # ifdef __USE_XOPEN # ifdef __GNUC__ extern int sigpause (int __sig) __asm__ ("__xpg_sigpause"); # else /* Remove a signal from the signal mask and suspend the process. */ # define sigpause(sig) __sigpause ((sig), 1) # endif # endif #endif #ifdef __USE_BSD /* None of the following functions should be used anymore. They are here only for compatibility. A single word (`int') is not guaranteed to be enough to hold a complete signal mask and therefore these functions simply do not work in many situations. Use `sigprocmask' instead. */ /* Compute mask for signal SIG. */ # define sigmask(sig) __sigmask(sig) /* Block signals in MASK, returning the old mask. */ extern int sigblock (int __mask) __THROW __attribute_deprecated__; /* Set the mask of blocked signals to MASK, returning the old mask. */ extern int sigsetmask (int __mask) __THROW __attribute_deprecated__; /* Return currently selected signal mask. */ extern int siggetmask (void) __THROW __attribute_deprecated__; #endif /* Use BSD. */ #ifdef __USE_MISC # define NSIG _NSIG #endif #ifdef __USE_GNU typedef __sighandler_t sighandler_t; #endif /* 4.4 BSD uses the name `sig_t' for this. */ #ifdef __USE_BSD typedef __sighandler_t sig_t; #endif #ifdef __USE_POSIX /* Clear all signals from SET. */ extern int sigemptyset (sigset_t *__set) __THROW __nonnull ((1)); /* Set all signals in SET. */ extern int sigfillset (sigset_t *__set) __THROW __nonnull ((1)); /* Add SIGNO to SET. */ extern int sigaddset (sigset_t *__set, int __signo) __THROW __nonnull ((1)); /* Remove SIGNO from SET. */ extern int sigdelset (sigset_t *__set, int __signo) __THROW __nonnull ((1)); /* Return 1 if SIGNO is in SET, 0 if not. */ extern int sigismember (const sigset_t *__set, int __signo) __THROW __nonnull ((1)); # ifdef __USE_GNU /* Return non-empty value is SET is not empty. */ extern int sigisemptyset (const sigset_t *__set) __THROW __nonnull ((1)); /* Build new signal set by combining the two inputs set using logical AND. */ extern int sigandset (sigset_t *__set, const sigset_t *__left, const sigset_t *__right) __THROW __nonnull ((1, 2, 3)); /* Build new signal set by combining the two inputs set using logical OR. */ extern int sigorset (sigset_t *__set, const sigset_t *__left, const sigset_t *__right) __THROW __nonnull ((1, 2, 3)); # endif /* GNU */ /* Get the system-specific definitions of `struct sigaction' and the `SA_*' and `SIG_*'. constants. */ # include /* Get and/or change the set of blocked signals. */ extern int sigprocmask (int __how, const sigset_t *__restrict __set, sigset_t *__restrict __oset) __THROW; /* Change the set of blocked signals to SET, wait until a signal arrives, and restore the set of blocked signals. This function is a cancellation point and therefore not marked with __THROW. */ extern int sigsuspend (const sigset_t *__set) __nonnull ((1)); /* Get and/or set the action for signal SIG. */ extern int sigaction (int __sig, const struct sigaction *__restrict __act, struct sigaction *__restrict __oact) __THROW; /* Put in SET all signals that are blocked and waiting to be delivered. */ extern int sigpending (sigset_t *__set) __THROW __nonnull ((1)); /* Select any of pending signals from SET or wait for any to arrive. This function is a cancellation point and therefore not marked with __THROW. */ extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig) __nonnull ((1, 2)); # ifdef __USE_POSIX199309 /* Select any of pending signals from SET and place information in INFO. This function is a cancellation point and therefore not marked with __THROW. */ extern int sigwaitinfo (const sigset_t *__restrict __set, siginfo_t *__restrict __info) __nonnull ((1)); /* Select any of pending signals from SET and place information in INFO. Wait the time specified by TIMEOUT if no signal is pending. This function is a cancellation point and therefore not marked with __THROW. */ extern int sigtimedwait (const sigset_t *__restrict __set, siginfo_t *__restrict __info, const struct timespec *__restrict __timeout) __nonnull ((1)); /* Send signal SIG to the process PID. Associate data in VAL with the signal. */ extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val) __THROW; # endif /* Use POSIX 199306. */ #endif /* Use POSIX. */ #ifdef __USE_BSD /* Names of the signals. This variable exists only for compatibility. Use `strsignal' instead (see ). */ extern const char *const _sys_siglist[_NSIG]; extern const char *const sys_siglist[_NSIG]; /* Structure passed to `sigvec'. */ struct sigvec { __sighandler_t sv_handler; /* Signal handler. */ int sv_mask; /* Mask of signals to be blocked. */ int sv_flags; /* Flags (see below). */ # define sv_onstack sv_flags /* 4.2 BSD compatibility. */ }; /* Bits in `sv_flags'. */ # define SV_ONSTACK (1 << 0)/* Take the signal on the signal stack. */ # define SV_INTERRUPT (1 << 1)/* Do not restart system calls. */ # define SV_RESETHAND (1 << 2)/* Reset handler to SIG_DFL on receipt. */ /* If VEC is non-NULL, set the handler for SIG to the `sv_handler' member of VEC. The signals in `sv_mask' will be blocked while the handler runs. If the SV_RESETHAND bit is set in `sv_flags', the handler for SIG will be reset to SIG_DFL before `sv_handler' is entered. If OVEC is non-NULL, it is filled in with the old information for SIG. */ extern int sigvec (int __sig, const struct sigvec *__vec, struct sigvec *__ovec) __THROW; /* Get machine-dependent `struct sigcontext' and signal subcodes. */ # include /* Restore the state saved in SCP. */ extern int sigreturn (struct sigcontext *__scp) __THROW; #endif /* use BSD. */ #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 # define __need_size_t # include /* If INTERRUPT is nonzero, make signal SIG interrupt system calls (causing them to fail with EINTR); if INTERRUPT is zero, make system calls be restarted after signal SIG. */ extern int siginterrupt (int __sig, int __interrupt) __THROW; # include # if defined __USE_XOPEN || defined __USE_XOPEN2K8 /* This will define `ucontext_t' and `mcontext_t'. */ # include # endif /* Run signals handlers on the stack specified by SS (if not NULL). If OSS is not NULL, it is filled in with the old signal stack status. This interface is obsolete and on many platform not implemented. */ extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) __THROW __attribute_deprecated__; /* Alternate signal handler stack interface. This interface should always be preferred over `sigstack'. */ extern int sigaltstack (const struct sigaltstack *__restrict __ss, struct sigaltstack *__restrict __oss) __THROW; #endif /* use BSD or X/Open Unix. */ #ifdef __USE_XOPEN_EXTENDED /* Simplified interface for signal management. */ /* Add SIG to the calling process' signal mask. */ extern int sighold (int __sig) __THROW; /* Remove SIG from the calling process' signal mask. */ extern int sigrelse (int __sig) __THROW; /* Set the disposition of SIG to SIG_IGN. */ extern int sigignore (int __sig) __THROW; /* Set the disposition of SIG. */ extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW; #endif #if defined __USE_POSIX199506 || defined __USE_UNIX98 /* Some of the functions for handling signals in threaded programs must be defined here. */ # include # include #endif /* use Unix98 */ /* The following functions are used internally in the C library and in other code which need deep insights. */ /* Return number of available real-time signal with highest priority. */ extern int __libc_current_sigrtmin (void) __THROW; /* Return number of available real-time signal with lowest priority. */ extern int __libc_current_sigrtmax (void) __THROW; #endif /* signal.h */ __END_DECLS #endif /* not signal.h */ libaio.h000064400000017466147631660260006205 0ustar00/* /usr/include/libaio.h * * Copyright 2000,2001,2002 Red Hat, Inc. * * Written by Benjamin LaHaise * * libaio Linux async I/O interface * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __LIBAIO_H #define __LIBAIO_H #ifdef __cplusplus extern "C" { #endif #include #include struct timespec; struct sockaddr; struct iovec; typedef struct io_context *io_context_t; typedef enum io_iocb_cmd { IO_CMD_PREAD = 0, IO_CMD_PWRITE = 1, IO_CMD_FSYNC = 2, IO_CMD_FDSYNC = 3, IO_CMD_POLL = 5, /* Never implemented in mainline, see io_prep_poll */ IO_CMD_NOOP = 6, IO_CMD_PREADV = 7, IO_CMD_PWRITEV = 8, } io_iocb_cmd_t; #if defined(__i386__) /* little endian, 32 bits */ #define PADDED(x, y) x; unsigned y #define PADDEDptr(x, y) x; unsigned y #define PADDEDul(x, y) unsigned long x; unsigned y #elif defined(__ia64__) || defined(__x86_64__) || defined(__alpha__) #define PADDED(x, y) x, y #define PADDEDptr(x, y) x #define PADDEDul(x, y) unsigned long x #elif defined(__powerpc64__) /* big endian, 64 bits */ #define PADDED(x, y) unsigned y; x #define PADDEDptr(x,y) x #define PADDEDul(x, y) unsigned long x #elif defined(__PPC__) /* big endian, 32 bits */ #define PADDED(x, y) unsigned y; x #define PADDEDptr(x, y) unsigned y; x #define PADDEDul(x, y) unsigned y; unsigned long x #elif defined(__s390x__) /* big endian, 64 bits */ #define PADDED(x, y) unsigned y; x #define PADDEDptr(x,y) x #define PADDEDul(x, y) unsigned long x #elif defined(__s390__) /* big endian, 32 bits */ #define PADDED(x, y) unsigned y; x #define PADDEDptr(x, y) unsigned y; x #define PADDEDul(x, y) unsigned y; unsigned long x #elif defined(__arm__) # if defined (__ARMEB__) /* big endian, 32 bits */ #define PADDED(x, y) unsigned y; x #define PADDEDptr(x, y) unsigned y; x #define PADDEDul(x, y) unsigned y; unsigned long x # else /* little endian, 32 bits */ #define PADDED(x, y) x; unsigned y #define PADDEDptr(x, y) x; unsigned y #define PADDEDul(x, y) unsigned long x; unsigned y # endif #elif defined(__aarch64__) # if defined (__AARCH64EB__) /* big endian, 64 bits */ #define PADDED(x, y) unsigned y; x #define PADDEDptr(x,y) x #define PADDEDul(x, y) unsigned long x # elif defined(__AARCH64EL__) /* little endian, 64 bits */ #define PADDED(x, y) x, y #define PADDEDptr(x, y) x #define PADDEDul(x, y) unsigned long x # endif #else #error endian? #endif struct io_iocb_poll { PADDED(int events, __pad1); }; /* result code is the set of result flags or -'ve errno */ struct io_iocb_sockaddr { struct sockaddr *addr; int len; }; /* result code is the length of the sockaddr, or -'ve errno */ struct io_iocb_common { PADDEDptr(void *buf, __pad1); PADDEDul(nbytes, __pad2); long long offset; long long __pad3; unsigned flags; unsigned resfd; }; /* result code is the amount read or -'ve errno */ struct io_iocb_vector { const struct iovec *vec; int nr; long long offset; }; /* result code is the amount read or -'ve errno */ struct iocb { PADDEDptr(void *data, __pad1); /* Return in the io completion event */ PADDED(unsigned key, __pad2); /* For use in identifying io requests */ short aio_lio_opcode; short aio_reqprio; int aio_fildes; union { struct io_iocb_common c; struct io_iocb_vector v; struct io_iocb_poll poll; struct io_iocb_sockaddr saddr; } u; }; struct io_event { PADDEDptr(void *data, __pad1); PADDEDptr(struct iocb *obj, __pad2); PADDEDul(res, __pad3); PADDEDul(res2, __pad4); }; #undef PADDED #undef PADDEDptr #undef PADDEDul typedef void (*io_callback_t)(io_context_t ctx, struct iocb *iocb, long res, long res2); /* library wrappers */ extern int io_queue_init(int maxevents, io_context_t *ctxp); /*extern int io_queue_grow(io_context_t ctx, int new_maxevents);*/ extern int io_queue_release(io_context_t ctx); /*extern int io_queue_wait(io_context_t ctx, struct timespec *timeout);*/ extern int io_queue_run(io_context_t ctx); /* Actual syscalls */ extern int io_setup(int maxevents, io_context_t *ctxp); extern int io_destroy(io_context_t ctx); extern int io_submit(io_context_t ctx, long nr, struct iocb *ios[]); extern int io_cancel(io_context_t ctx, struct iocb *iocb, struct io_event *evt); extern int io_getevents(io_context_t ctx_id, long min_nr, long nr, struct io_event *events, struct timespec *timeout); static inline void io_set_callback(struct iocb *iocb, io_callback_t cb) { iocb->data = (void *)cb; } static inline void io_prep_pread(struct iocb *iocb, int fd, void *buf, size_t count, long long offset) { memset(iocb, 0, sizeof(*iocb)); iocb->aio_fildes = fd; iocb->aio_lio_opcode = IO_CMD_PREAD; iocb->aio_reqprio = 0; iocb->u.c.buf = buf; iocb->u.c.nbytes = count; iocb->u.c.offset = offset; } static inline void io_prep_pwrite(struct iocb *iocb, int fd, void *buf, size_t count, long long offset) { memset(iocb, 0, sizeof(*iocb)); iocb->aio_fildes = fd; iocb->aio_lio_opcode = IO_CMD_PWRITE; iocb->aio_reqprio = 0; iocb->u.c.buf = buf; iocb->u.c.nbytes = count; iocb->u.c.offset = offset; } static inline void io_prep_preadv(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset) { memset(iocb, 0, sizeof(*iocb)); iocb->aio_fildes = fd; iocb->aio_lio_opcode = IO_CMD_PREADV; iocb->aio_reqprio = 0; iocb->u.c.buf = (void *)iov; iocb->u.c.nbytes = iovcnt; iocb->u.c.offset = offset; } static inline void io_prep_pwritev(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset) { memset(iocb, 0, sizeof(*iocb)); iocb->aio_fildes = fd; iocb->aio_lio_opcode = IO_CMD_PWRITEV; iocb->aio_reqprio = 0; iocb->u.c.buf = (void *)iov; iocb->u.c.nbytes = iovcnt; iocb->u.c.offset = offset; } /* Jeff Moyer says this was implemented in Red Hat AS2.1 and RHEL3. * AFAICT, it was never in mainline, and should not be used. --RR */ static inline void io_prep_poll(struct iocb *iocb, int fd, int events) { memset(iocb, 0, sizeof(*iocb)); iocb->aio_fildes = fd; iocb->aio_lio_opcode = IO_CMD_POLL; iocb->aio_reqprio = 0; iocb->u.poll.events = events; } static inline int io_poll(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd, int events) { io_prep_poll(iocb, fd, events); io_set_callback(iocb, cb); return io_submit(ctx, 1, &iocb); } static inline void io_prep_fsync(struct iocb *iocb, int fd) { memset(iocb, 0, sizeof(*iocb)); iocb->aio_fildes = fd; iocb->aio_lio_opcode = IO_CMD_FSYNC; iocb->aio_reqprio = 0; } static inline int io_fsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd) { io_prep_fsync(iocb, fd); io_set_callback(iocb, cb); return io_submit(ctx, 1, &iocb); } static inline void io_prep_fdsync(struct iocb *iocb, int fd) { memset(iocb, 0, sizeof(*iocb)); iocb->aio_fildes = fd; iocb->aio_lio_opcode = IO_CMD_FDSYNC; iocb->aio_reqprio = 0; } static inline int io_fdsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd) { io_prep_fdsync(iocb, fd); io_set_callback(iocb, cb); return io_submit(ctx, 1, &iocb); } static inline void io_set_eventfd(struct iocb *iocb, int eventfd) { iocb->u.c.flags |= (1 << 0) /* IOCB_FLAG_RESFD */; iocb->u.c.resfd = eventfd; } #ifdef __cplusplus } #endif #endif /* __LIBAIO_H */ stringprep.h000064400000020001147631660260007116 0ustar00/* stringprep.h --- Header file for stringprep functions. Copyright (C) 2002-2013 Simon Josefsson This file is part of GNU Libidn. GNU Libidn is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * 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. or both in parallel, as here. GNU Libidn 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 copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see . */ #ifndef STRINGPREP_H # define STRINGPREP_H # ifndef IDNAPI # if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY # define IDNAPI __attribute__((__visibility__("default"))) # elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC # define IDNAPI __declspec(dllexport) # elif defined _MSC_VER && ! defined LIBIDN_STATIC # define IDNAPI __declspec(dllimport) # else # define IDNAPI # endif # endif # include /* size_t */ # include /* ssize_t */ # include /* uint32_t */ # ifdef __cplusplus extern "C" { # endif # define STRINGPREP_VERSION "1.28" /* Error codes. */ typedef enum { STRINGPREP_OK = 0, /* Stringprep errors. */ STRINGPREP_CONTAINS_UNASSIGNED = 1, STRINGPREP_CONTAINS_PROHIBITED = 2, STRINGPREP_BIDI_BOTH_L_AND_RAL = 3, STRINGPREP_BIDI_LEADTRAIL_NOT_RAL = 4, STRINGPREP_BIDI_CONTAINS_PROHIBITED = 5, /* Error in calling application. */ STRINGPREP_TOO_SMALL_BUFFER = 100, STRINGPREP_PROFILE_ERROR = 101, STRINGPREP_FLAG_ERROR = 102, STRINGPREP_UNKNOWN_PROFILE = 103, /* Internal errors. */ STRINGPREP_NFKC_FAILED = 200, STRINGPREP_MALLOC_ERROR = 201 } Stringprep_rc; /* Flags used when calling stringprep(). */ typedef enum { STRINGPREP_NO_NFKC = 1, STRINGPREP_NO_BIDI = 2, STRINGPREP_NO_UNASSIGNED = 4 } Stringprep_profile_flags; /* Steps in a stringprep profile. */ typedef enum { STRINGPREP_NFKC = 1, STRINGPREP_BIDI = 2, STRINGPREP_MAP_TABLE = 3, STRINGPREP_UNASSIGNED_TABLE = 4, STRINGPREP_PROHIBIT_TABLE = 5, STRINGPREP_BIDI_PROHIBIT_TABLE = 6, STRINGPREP_BIDI_RAL_TABLE = 7, STRINGPREP_BIDI_L_TABLE = 8 } Stringprep_profile_steps; # define STRINGPREP_MAX_MAP_CHARS 4 struct Stringprep_table_element { uint32_t start; uint32_t end; /* 0 if only one character */ uint32_t map[STRINGPREP_MAX_MAP_CHARS]; /* NULL if end is not 0 */ }; typedef struct Stringprep_table_element Stringprep_table_element; struct Stringprep_table { Stringprep_profile_steps operation; Stringprep_profile_flags flags; const Stringprep_table_element *table; }; typedef struct Stringprep_table Stringprep_profile; struct Stringprep_profiles { const char *name; const Stringprep_profile *tables; }; typedef struct Stringprep_profiles Stringprep_profiles; extern IDNAPI const Stringprep_profiles stringprep_profiles[]; /* Profiles */ extern IDNAPI const Stringprep_table_element stringprep_rfc3454_A_1[]; extern IDNAPI const Stringprep_table_element stringprep_rfc3454_B_1[]; extern IDNAPI const Stringprep_table_element stringprep_rfc3454_B_2[]; extern IDNAPI const Stringprep_table_element stringprep_rfc3454_B_3[]; extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_1_1[]; extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_1_2[]; extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_2_1[]; extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_2_2[]; extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_3[]; extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_4[]; extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_5[]; extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_6[]; extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_7[]; extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_8[]; extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_9[]; extern IDNAPI const Stringprep_table_element stringprep_rfc3454_D_1[]; extern IDNAPI const Stringprep_table_element stringprep_rfc3454_D_2[]; /* Nameprep */ extern IDNAPI const Stringprep_profile stringprep_nameprep[]; # define stringprep_nameprep(in, maxlen) \ stringprep(in, maxlen, 0, stringprep_nameprep) # define stringprep_nameprep_no_unassigned(in, maxlen) \ stringprep(in, maxlen, STRINGPREP_NO_UNASSIGNED, stringprep_nameprep) /* SASL */ extern IDNAPI const Stringprep_profile stringprep_saslprep[]; extern IDNAPI const Stringprep_table_element stringprep_saslprep_space_map[]; extern IDNAPI const Stringprep_profile stringprep_plain[]; extern IDNAPI const Stringprep_profile stringprep_trace[]; # define stringprep_plain(in, maxlen) \ stringprep(in, maxlen, 0, stringprep_plain) /* Kerberos */ extern IDNAPI const Stringprep_profile stringprep_kerberos5[]; # define stringprep_kerberos5(in, maxlen) \ stringprep(in, maxlen, 0, stringprep_kerberos5) /* XMPP */ extern IDNAPI const Stringprep_profile stringprep_xmpp_nodeprep[]; extern IDNAPI const Stringprep_profile stringprep_xmpp_resourceprep[]; extern IDNAPI const Stringprep_table_element stringprep_xmpp_nodeprep_prohibit[]; # define stringprep_xmpp_nodeprep(in, maxlen) \ stringprep(in, maxlen, 0, stringprep_xmpp_nodeprep) # define stringprep_xmpp_resourceprep(in, maxlen) \ stringprep(in, maxlen, 0, stringprep_xmpp_resourceprep) /* iSCSI */ extern IDNAPI const Stringprep_profile stringprep_iscsi[]; extern IDNAPI const Stringprep_table_element stringprep_iscsi_prohibit[]; # define stringprep_iscsi(in, maxlen) \ stringprep(in, maxlen, 0, stringprep_iscsi) /* API */ extern IDNAPI int stringprep_4i (uint32_t * ucs4, size_t * len, size_t maxucs4len, Stringprep_profile_flags flags, const Stringprep_profile * profile); extern IDNAPI int stringprep_4zi (uint32_t * ucs4, size_t maxucs4len, Stringprep_profile_flags flags, const Stringprep_profile * profile); extern IDNAPI int stringprep (char *in, size_t maxlen, Stringprep_profile_flags flags, const Stringprep_profile * profile); extern IDNAPI int stringprep_profile (const char *in, char **out, const char *profile, Stringprep_profile_flags flags); extern IDNAPI const char *stringprep_strerror (Stringprep_rc rc); extern IDNAPI const char *stringprep_check_version (const char *req_version); /* Utility */ extern IDNAPI int stringprep_unichar_to_utf8 (uint32_t c, char *outbuf); extern IDNAPI uint32_t stringprep_utf8_to_unichar (const char *p); extern IDNAPI uint32_t *stringprep_utf8_to_ucs4 (const char *str, ssize_t len, size_t * items_written); extern IDNAPI char *stringprep_ucs4_to_utf8 (const uint32_t * str, ssize_t len, size_t * items_read, size_t * items_written); extern IDNAPI char *stringprep_utf8_nfkc_normalize (const char *str, ssize_t len); extern IDNAPI uint32_t *stringprep_ucs4_nfkc_normalize (const uint32_t * str, ssize_t len); extern IDNAPI const char *stringprep_locale_charset (void); extern IDNAPI char *stringprep_convert (const char *str, const char *to_codeset, const char *from_codeset); extern IDNAPI char *stringprep_locale_to_utf8 (const char *str); extern IDNAPI char *stringprep_utf8_to_locale (const char *str); # ifdef __cplusplus } # endif #endif /* STRINGPREP_H */ iconv.h000064400000003523147631660260006051 0ustar00/* Copyright (C) 1997-2000, 2003, 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _ICONV_H #define _ICONV_H 1 #include #define __need_size_t #include __BEGIN_DECLS /* Identifier for conversion method from one codeset to another. */ typedef void *iconv_t; /* Allocate descriptor for code conversion from codeset FROMCODE to codeset TOCODE. This function is a possible cancellation point and therefore not marked with __THROW. */ extern iconv_t iconv_open (const char *__tocode, const char *__fromcode); /* Convert at most *INBYTESLEFT bytes from *INBUF according to the code conversion algorithm specified by CD and place up to *OUTBYTESLEFT bytes in buffer at *OUTBUF. */ extern size_t iconv (iconv_t __cd, char **__restrict __inbuf, size_t *__restrict __inbytesleft, char **__restrict __outbuf, size_t *__restrict __outbytesleft); /* Free resources allocated for descriptor CD for code conversion. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int iconv_close (iconv_t __cd); __END_DECLS #endif /* iconv.h */ ext2fs/ext2fs.h000064400000161042147631660260007362 0ustar00/* * ext2fs.h --- ext2fs * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% * This file may be redistributed under the terms of the GNU Library * General Public License, version 2. * %End-Header% */ #ifndef _EXT2FS_EXT2FS_H #define _EXT2FS_EXT2FS_H #ifdef __GNUC__ #define EXT2FS_ATTR(x) __attribute__(x) #else #define EXT2FS_ATTR(x) #endif #ifdef __cplusplus extern "C" { #endif /* * Non-GNU C compilers won't necessarily understand inline */ #if (!defined(__GNUC__) && !defined(__WATCOMC__)) #define NO_INLINE_FUNCS #endif /* * Where the master copy of the superblock is located, and how big * superblocks are supposed to be. We define SUPERBLOCK_SIZE because * the size of the superblock structure is not necessarily trustworthy * (some versions have the padding set up so that the superblock is * 1032 bytes long). */ #define SUPERBLOCK_OFFSET 1024 #define SUPERBLOCK_SIZE 1024 /* * The last ext2fs revision level that this version of the library is * able to support. */ #define EXT2_LIB_CURRENT_REV EXT2_DYNAMIC_REV #ifdef HAVE_SYS_TYPES_H #include #endif #include #include #include #include #if EXT2_FLAT_INCLUDES #include "e2_types.h" #include "ext2_fs.h" #include "ext3_extents.h" #else #include #include #include #endif /* EXT2_FLAT_INCLUDES */ #ifdef __CHECK_ENDIAN__ #define __bitwise __attribute__((bitwise)) #else #define __bitwise #endif typedef __u32 __bitwise ext2_ino_t; typedef __u32 __bitwise blk_t; typedef __u64 __bitwise blk64_t; typedef __u32 __bitwise dgrp_t; typedef __u32 __bitwise ext2_off_t; typedef __u64 __bitwise ext2_off64_t; typedef __s64 __bitwise e2_blkcnt_t; typedef __u32 __bitwise ext2_dirhash_t; #if EXT2_FLAT_INCLUDES #include "com_err.h" #include "ext2_io.h" #include "ext2_err.h" #include "ext2_ext_attr.h" #else #include #include #include #include #endif /* * Portability help for Microsoft Visual C++ */ #ifdef _MSC_VER #define EXT2_QSORT_TYPE int __cdecl #else #define EXT2_QSORT_TYPE int #endif typedef struct struct_ext2_filsys *ext2_filsys; #define EXT2FS_MARK_ERROR 0 #define EXT2FS_UNMARK_ERROR 1 #define EXT2FS_TEST_ERROR 2 typedef struct ext2fs_struct_generic_bitmap *ext2fs_generic_bitmap; typedef struct ext2fs_struct_generic_bitmap *ext2fs_inode_bitmap; typedef struct ext2fs_struct_generic_bitmap *ext2fs_block_bitmap; #define EXT2_FIRST_INODE(s) EXT2_FIRST_INO(s) /* * Badblocks list definitions */ typedef struct ext2_struct_u32_list *ext2_badblocks_list; typedef struct ext2_struct_u32_iterate *ext2_badblocks_iterate; typedef struct ext2_struct_u32_list *ext2_u32_list; typedef struct ext2_struct_u32_iterate *ext2_u32_iterate; /* old */ typedef struct ext2_struct_u32_list *badblocks_list; typedef struct ext2_struct_u32_iterate *badblocks_iterate; #define BADBLOCKS_FLAG_DIRTY 1 /* * ext2_dblist structure and abstractions (see dblist.c) */ struct ext2_db_entry2 { ext2_ino_t ino; blk64_t blk; e2_blkcnt_t blockcnt; }; /* Ye Olde 32-bit version */ struct ext2_db_entry { ext2_ino_t ino; blk_t blk; int blockcnt; }; typedef struct ext2_struct_dblist *ext2_dblist; #define DBLIST_ABORT 1 /* * ext2_fileio definitions */ #define EXT2_FILE_WRITE 0x0001 #define EXT2_FILE_CREATE 0x0002 #define EXT2_FILE_MASK 0x00FF #define EXT2_FILE_BUF_DIRTY 0x4000 #define EXT2_FILE_BUF_VALID 0x2000 typedef struct ext2_file *ext2_file_t; #define EXT2_SEEK_SET 0 #define EXT2_SEEK_CUR 1 #define EXT2_SEEK_END 2 /* * Flags for the ext2_filsys structure and for ext2fs_open() */ #define EXT2_FLAG_RW 0x01 #define EXT2_FLAG_CHANGED 0x02 #define EXT2_FLAG_DIRTY 0x04 #define EXT2_FLAG_VALID 0x08 #define EXT2_FLAG_IB_DIRTY 0x10 #define EXT2_FLAG_BB_DIRTY 0x20 #define EXT2_FLAG_SWAP_BYTES 0x40 #define EXT2_FLAG_SWAP_BYTES_READ 0x80 #define EXT2_FLAG_SWAP_BYTES_WRITE 0x100 #define EXT2_FLAG_MASTER_SB_ONLY 0x200 #define EXT2_FLAG_FORCE 0x400 #define EXT2_FLAG_SUPER_ONLY 0x800 #define EXT2_FLAG_JOURNAL_DEV_OK 0x1000 #define EXT2_FLAG_IMAGE_FILE 0x2000 #define EXT2_FLAG_EXCLUSIVE 0x4000 #define EXT2_FLAG_SOFTSUPP_FEATURES 0x8000 #define EXT2_FLAG_NOFREE_ON_ERROR 0x10000 #define EXT2_FLAG_64BITS 0x20000 #define EXT2_FLAG_PRINT_PROGRESS 0x40000 #define EXT2_FLAG_DIRECT_IO 0x80000 #define EXT2_FLAG_SKIP_MMP 0x100000 /* * Special flag in the ext2 inode i_flag field that means that this is * a new inode. (So that ext2_write_inode() can clear extra fields.) */ #define EXT2_NEW_INODE_FL 0x80000000 /* * Flags for mkjournal */ #define EXT2_MKJOURNAL_V1_SUPER 0x0000001 /* create V1 superblock (deprecated) */ #define EXT2_MKJOURNAL_LAZYINIT 0x0000002 /* don't zero journal inode before use*/ #define EXT2_MKJOURNAL_NO_MNT_CHECK 0x0000004 /* don't check mount status */ struct opaque_ext2_group_desc; struct struct_ext2_filsys { errcode_t magic; io_channel io; int flags; char * device_name; struct ext2_super_block * super; unsigned int blocksize; int fragsize; dgrp_t group_desc_count; unsigned long desc_blocks; struct opaque_ext2_group_desc * group_desc; unsigned int inode_blocks_per_group; ext2fs_inode_bitmap inode_map; ext2fs_block_bitmap block_map; /* XXX FIXME-64: not 64-bit safe, but not used? */ errcode_t (*get_blocks)(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks); errcode_t (*check_directory)(ext2_filsys fs, ext2_ino_t ino); errcode_t (*write_bitmaps)(ext2_filsys fs); errcode_t (*read_inode)(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode); errcode_t (*write_inode)(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode); ext2_badblocks_list badblocks; ext2_dblist dblist; __u32 stride; /* for mke2fs */ struct ext2_super_block * orig_super; struct ext2_image_hdr * image_header; __u32 umask; time_t now; int cluster_ratio_bits; __u16 default_bitmap_type; __u16 pad; /* * Reserved for future expansion */ __u32 reserved[5]; /* * Reserved for the use of the calling application. */ void * priv_data; /* * Inode cache */ struct ext2_inode_cache *icache; io_channel image_io; /* * More callback functions */ errcode_t (*get_alloc_block)(ext2_filsys fs, blk64_t goal, blk64_t *ret); void (*block_alloc_stats)(ext2_filsys fs, blk64_t blk, int inuse); /* * Buffers for Multiple mount protection(MMP) block. */ void *mmp_buf; void *mmp_cmp; int mmp_fd; /* * Time at which e2fsck last updated the MMP block. */ long mmp_last_written; }; #if EXT2_FLAT_INCLUDES #include "e2_bitops.h" #else #include #endif /* * 64-bit bitmap backend types */ #define EXT2FS_BMAP64_BITARRAY 1 #define EXT2FS_BMAP64_RBTREE 2 #define EXT2FS_BMAP64_AUTODIR 3 /* * Return flags for the block iterator functions */ #define BLOCK_CHANGED 1 #define BLOCK_ABORT 2 #define BLOCK_ERROR 4 /* * Block interate flags * * BLOCK_FLAG_APPEND, or BLOCK_FLAG_HOLE, indicates that the interator * function should be called on blocks where the block number is zero. * This is used by ext2fs_expand_dir() to be able to add a new block * to an inode. It can also be used for programs that want to be able * to deal with files that contain "holes". * * BLOCK_FLAG_DEPTH_TRAVERSE indicates that the iterator function for * the indirect, doubly indirect, etc. blocks should be called after * all of the blocks containined in the indirect blocks are processed. * This is useful if you are going to be deallocating blocks from an * inode. * * BLOCK_FLAG_DATA_ONLY indicates that the iterator function should be * called for data blocks only. * * BLOCK_FLAG_READ_ONLY is a promise by the caller that it will not * modify returned block number. * * BLOCK_FLAG_NO_LARGE is for internal use only. It informs * ext2fs_block_iterate2 that large files won't be accepted. */ #define BLOCK_FLAG_APPEND 1 #define BLOCK_FLAG_HOLE 1 #define BLOCK_FLAG_DEPTH_TRAVERSE 2 #define BLOCK_FLAG_DATA_ONLY 4 #define BLOCK_FLAG_READ_ONLY 8 #define BLOCK_FLAG_NO_LARGE 0x1000 /* * Magic "block count" return values for the block iterator function. */ #define BLOCK_COUNT_IND (-1) #define BLOCK_COUNT_DIND (-2) #define BLOCK_COUNT_TIND (-3) #define BLOCK_COUNT_TRANSLATOR (-4) #if 0 /* * Flags for ext2fs_move_blocks */ #define EXT2_BMOVE_GET_DBLIST 0x0001 #define EXT2_BMOVE_DEBUG 0x0002 #endif /* * Generic (non-filesystem layout specific) extents structure */ #define EXT2_EXTENT_FLAGS_LEAF 0x0001 #define EXT2_EXTENT_FLAGS_UNINIT 0x0002 #define EXT2_EXTENT_FLAGS_SECOND_VISIT 0x0004 struct ext2fs_extent { blk64_t e_pblk; /* first physical block */ blk64_t e_lblk; /* first logical block extent covers */ __u32 e_len; /* number of blocks covered by extent */ __u32 e_flags; /* extent flags */ }; typedef struct ext2_extent_handle *ext2_extent_handle_t; typedef struct ext2_extent_path *ext2_extent_path_t; /* * Flags used by ext2fs_extent_get() */ #define EXT2_EXTENT_CURRENT 0x0000 #define EXT2_EXTENT_MOVE_MASK 0x000F #define EXT2_EXTENT_ROOT 0x0001 #define EXT2_EXTENT_LAST_LEAF 0x0002 #define EXT2_EXTENT_FIRST_SIB 0x0003 #define EXT2_EXTENT_LAST_SIB 0x0004 #define EXT2_EXTENT_NEXT_SIB 0x0005 #define EXT2_EXTENT_PREV_SIB 0x0006 #define EXT2_EXTENT_NEXT_LEAF 0x0007 #define EXT2_EXTENT_PREV_LEAF 0x0008 #define EXT2_EXTENT_NEXT 0x0009 #define EXT2_EXTENT_PREV 0x000A #define EXT2_EXTENT_UP 0x000B #define EXT2_EXTENT_DOWN 0x000C #define EXT2_EXTENT_DOWN_AND_LAST 0x000D /* * Flags used by ext2fs_extent_insert() */ #define EXT2_EXTENT_INSERT_AFTER 0x0001 /* insert after handle loc'n */ #define EXT2_EXTENT_INSERT_NOSPLIT 0x0002 /* insert may not cause split */ /* * Flags used by ext2fs_extent_delete() */ #define EXT2_EXTENT_DELETE_KEEP_EMPTY 0x001 /* keep node if last extnt gone */ /* * Flags used by ext2fs_extent_set_bmap() */ #define EXT2_EXTENT_SET_BMAP_UNINIT 0x0001 /* * Data structure returned by ext2fs_extent_get_info() */ struct ext2_extent_info { int curr_entry; int curr_level; int num_entries; int max_entries; int max_depth; int bytes_avail; blk64_t max_lblk; blk64_t max_pblk; __u32 max_len; __u32 max_uninit_len; }; /* * Flags for directory block reading and writing functions */ #define EXT2_DIRBLOCK_V2_STRUCT 0x0001 /* * Return flags for the directory iterator functions */ #define DIRENT_CHANGED 1 #define DIRENT_ABORT 2 #define DIRENT_ERROR 3 /* * Directory iterator flags */ #define DIRENT_FLAG_INCLUDE_EMPTY 1 #define DIRENT_FLAG_INCLUDE_REMOVED 2 #define DIRENT_DOT_FILE 1 #define DIRENT_DOT_DOT_FILE 2 #define DIRENT_OTHER_FILE 3 #define DIRENT_DELETED_FILE 4 /* * Inode scan definitions */ typedef struct ext2_struct_inode_scan *ext2_inode_scan; /* * ext2fs_scan flags */ #define EXT2_SF_CHK_BADBLOCKS 0x0001 #define EXT2_SF_BAD_INODE_BLK 0x0002 #define EXT2_SF_BAD_EXTRA_BYTES 0x0004 #define EXT2_SF_SKIP_MISSING_ITABLE 0x0008 #define EXT2_SF_DO_LAZY 0x0010 /* * ext2fs_check_if_mounted flags */ #define EXT2_MF_MOUNTED 1 #define EXT2_MF_ISROOT 2 #define EXT2_MF_READONLY 4 #define EXT2_MF_SWAP 8 #define EXT2_MF_BUSY 16 /* * Ext2/linux mode flags. We define them here so that we don't need * to depend on the OS's sys/stat.h, since we may be compiling on a * non-Linux system. */ #define LINUX_S_IFMT 00170000 #define LINUX_S_IFSOCK 0140000 #define LINUX_S_IFLNK 0120000 #define LINUX_S_IFREG 0100000 #define LINUX_S_IFBLK 0060000 #define LINUX_S_IFDIR 0040000 #define LINUX_S_IFCHR 0020000 #define LINUX_S_IFIFO 0010000 #define LINUX_S_ISUID 0004000 #define LINUX_S_ISGID 0002000 #define LINUX_S_ISVTX 0001000 #define LINUX_S_IRWXU 00700 #define LINUX_S_IRUSR 00400 #define LINUX_S_IWUSR 00200 #define LINUX_S_IXUSR 00100 #define LINUX_S_IRWXG 00070 #define LINUX_S_IRGRP 00040 #define LINUX_S_IWGRP 00020 #define LINUX_S_IXGRP 00010 #define LINUX_S_IRWXO 00007 #define LINUX_S_IROTH 00004 #define LINUX_S_IWOTH 00002 #define LINUX_S_IXOTH 00001 #define LINUX_S_ISLNK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFLNK) #define LINUX_S_ISREG(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFREG) #define LINUX_S_ISDIR(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFDIR) #define LINUX_S_ISCHR(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFCHR) #define LINUX_S_ISBLK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFBLK) #define LINUX_S_ISFIFO(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFIFO) #define LINUX_S_ISSOCK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFSOCK) /* * ext2 size of an inode */ #define EXT2_I_SIZE(i) ((i)->i_size | ((__u64) (i)->i_size_high << 32)) /* * ext2_icount_t abstraction */ #define EXT2_ICOUNT_OPT_INCREMENT 0x01 typedef struct ext2_icount *ext2_icount_t; /* * Flags for ext2fs_bmap */ #define BMAP_ALLOC 0x0001 #define BMAP_SET 0x0002 /* * Returned flags from ext2fs_bmap */ #define BMAP_RET_UNINIT 0x0001 /* * Flags for imager.c functions */ #define IMAGER_FLAG_INODEMAP 1 #define IMAGER_FLAG_SPARSEWRITE 2 /* * For checking structure magic numbers... */ #define EXT2_CHECK_MAGIC(struct, code) \ if ((struct)->magic != (code)) return (code) /* * For ext2 compression support */ #define EXT2FS_COMPRESSED_BLKADDR ((blk_t) -1) #define HOLE_BLKADDR(_b) ((_b) == 0 || (_b) == EXT2FS_COMPRESSED_BLKADDR) /* * Features supported by this version of the library */ #define EXT2_LIB_FEATURE_COMPAT_SUPP (EXT2_FEATURE_COMPAT_DIR_PREALLOC|\ EXT2_FEATURE_COMPAT_IMAGIC_INODES|\ EXT3_FEATURE_COMPAT_HAS_JOURNAL|\ EXT2_FEATURE_COMPAT_RESIZE_INODE|\ EXT2_FEATURE_COMPAT_DIR_INDEX|\ EXT2_FEATURE_COMPAT_EXT_ATTR) /* This #ifdef is temporary until compression is fully supported */ #ifdef ENABLE_COMPRESSION #ifndef I_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL /* If the below warning bugs you, then have `CPPFLAGS=-DI_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL' in your environment at configure time. */ #warning "Compression support is experimental" #endif #define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE|\ EXT2_FEATURE_INCOMPAT_COMPRESSION|\ EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\ EXT2_FEATURE_INCOMPAT_META_BG|\ EXT3_FEATURE_INCOMPAT_RECOVER|\ EXT3_FEATURE_INCOMPAT_EXTENTS|\ EXT4_FEATURE_INCOMPAT_FLEX_BG|\ EXT4_FEATURE_INCOMPAT_MMP|\ EXT4_FEATURE_INCOMPAT_64BIT) #else #define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE|\ EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\ EXT2_FEATURE_INCOMPAT_META_BG|\ EXT3_FEATURE_INCOMPAT_RECOVER|\ EXT3_FEATURE_INCOMPAT_EXTENTS|\ EXT4_FEATURE_INCOMPAT_FLEX_BG|\ EXT4_FEATURE_INCOMPAT_MMP|\ EXT4_FEATURE_INCOMPAT_64BIT) #endif #ifdef CONFIG_QUOTA #define EXT2_LIB_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER|\ EXT4_FEATURE_RO_COMPAT_HUGE_FILE|\ EXT2_FEATURE_RO_COMPAT_LARGE_FILE|\ EXT4_FEATURE_RO_COMPAT_DIR_NLINK|\ EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE|\ EXT4_FEATURE_RO_COMPAT_GDT_CSUM|\ EXT4_FEATURE_RO_COMPAT_BIGALLOC|\ EXT4_FEATURE_RO_COMPAT_QUOTA) #else #define EXT2_LIB_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER|\ EXT4_FEATURE_RO_COMPAT_HUGE_FILE|\ EXT2_FEATURE_RO_COMPAT_LARGE_FILE|\ EXT4_FEATURE_RO_COMPAT_DIR_NLINK|\ EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE|\ EXT4_FEATURE_RO_COMPAT_GDT_CSUM|\ EXT4_FEATURE_RO_COMPAT_BIGALLOC) #endif /* * These features are only allowed if EXT2_FLAG_SOFTSUPP_FEATURES is passed * to ext2fs_openfs() */ #define EXT2_LIB_SOFTSUPP_INCOMPAT (0) #define EXT2_LIB_SOFTSUPP_RO_COMPAT (EXT4_FEATURE_RO_COMPAT_REPLICA) /* Translate a block number to a cluster number */ #define EXT2FS_CLUSTER_RATIO(fs) (1 << (fs)->cluster_ratio_bits) #define EXT2FS_CLUSTER_MASK(fs) (EXT2FS_CLUSTER_RATIO(fs) - 1) #define EXT2FS_B2C(fs, blk) ((blk) >> (fs)->cluster_ratio_bits) /* Translate a cluster number to a block number */ #define EXT2FS_C2B(fs, cluster) ((cluster) << (fs)->cluster_ratio_bits) /* Translate # of blks to # of clusters */ #define EXT2FS_NUM_B2C(fs, blks) (((blks) + EXT2FS_CLUSTER_MASK(fs)) >> \ (fs)->cluster_ratio_bits) #if defined(HAVE_FSTAT64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED) typedef struct stat64 ext2fs_struct_stat; #else typedef struct stat ext2fs_struct_stat; #endif /* * For ext2fs_close2() and ext2fs_flush2(), this flag allows you to * avoid the fsync call. */ #define EXT2_FLAG_FLUSH_NO_SYNC 1 /* * function prototypes */ /* The LARGE_FILE feature should be set if we have stored files 2GB+ in size */ static inline int ext2fs_needs_large_file_feature(unsigned long long file_size) { return file_size >= 0x80000000ULL; } /* alloc.c */ extern void ext2fs_clear_block_uninit(ext2_filsys fs, dgrp_t group); extern errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, int mode, ext2fs_inode_bitmap map, ext2_ino_t *ret); extern errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal, ext2fs_block_bitmap map, blk_t *ret); extern errcode_t ext2fs_new_block2(ext2_filsys fs, blk64_t goal, ext2fs_block_bitmap map, blk64_t *ret); extern errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start, blk_t finish, int num, ext2fs_block_bitmap map, blk_t *ret); extern errcode_t ext2fs_get_free_blocks2(ext2_filsys fs, blk64_t start, blk64_t finish, int num, ext2fs_block_bitmap map, blk64_t *ret); extern errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal, char *block_buf, blk_t *ret); extern errcode_t ext2fs_alloc_block2(ext2_filsys fs, blk64_t goal, char *block_buf, blk64_t *ret); extern void ext2fs_set_alloc_block_callback(ext2_filsys fs, errcode_t (*func)(ext2_filsys fs, blk64_t goal, blk64_t *ret), errcode_t (**old)(ext2_filsys fs, blk64_t goal, blk64_t *ret)); /* alloc_sb.c */ extern int ext2fs_reserve_super_and_bgd(ext2_filsys fs, dgrp_t group, ext2fs_block_bitmap bmap); extern void ext2fs_set_block_alloc_stats_callback(ext2_filsys fs, void (*func)(ext2_filsys fs, blk64_t blk, int inuse), void (**old)(ext2_filsys fs, blk64_t blk, int inuse)); /* alloc_stats.c */ void ext2fs_inode_alloc_stats(ext2_filsys fs, ext2_ino_t ino, int inuse); void ext2fs_inode_alloc_stats2(ext2_filsys fs, ext2_ino_t ino, int inuse, int isdir); void ext2fs_block_alloc_stats(ext2_filsys fs, blk_t blk, int inuse); void ext2fs_block_alloc_stats2(ext2_filsys fs, blk64_t blk, int inuse); /* alloc_tables.c */ extern errcode_t ext2fs_allocate_tables(ext2_filsys fs); extern errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, ext2fs_block_bitmap bmap); /* badblocks.c */ extern errcode_t ext2fs_u32_list_create(ext2_u32_list *ret, int size); extern errcode_t ext2fs_u32_list_add(ext2_u32_list bb, __u32 blk); extern int ext2fs_u32_list_find(ext2_u32_list bb, __u32 blk); extern int ext2fs_u32_list_test(ext2_u32_list bb, blk_t blk); extern errcode_t ext2fs_u32_list_iterate_begin(ext2_u32_list bb, ext2_u32_iterate *ret); extern int ext2fs_u32_list_iterate(ext2_u32_iterate iter, blk_t *blk); extern void ext2fs_u32_list_iterate_end(ext2_u32_iterate iter); extern errcode_t ext2fs_u32_copy(ext2_u32_list src, ext2_u32_list *dest); extern int ext2fs_u32_list_equal(ext2_u32_list bb1, ext2_u32_list bb2); extern errcode_t ext2fs_badblocks_list_create(ext2_badblocks_list *ret, int size); extern errcode_t ext2fs_badblocks_list_add(ext2_badblocks_list bb, blk_t blk); extern int ext2fs_badblocks_list_test(ext2_badblocks_list bb, blk_t blk); extern int ext2fs_u32_list_del(ext2_u32_list bb, __u32 blk); extern void ext2fs_badblocks_list_del(ext2_u32_list bb, __u32 blk); extern errcode_t ext2fs_badblocks_list_iterate_begin(ext2_badblocks_list bb, ext2_badblocks_iterate *ret); extern int ext2fs_badblocks_list_iterate(ext2_badblocks_iterate iter, blk_t *blk); extern void ext2fs_badblocks_list_iterate_end(ext2_badblocks_iterate iter); extern errcode_t ext2fs_badblocks_copy(ext2_badblocks_list src, ext2_badblocks_list *dest); extern int ext2fs_badblocks_equal(ext2_badblocks_list bb1, ext2_badblocks_list bb2); extern int ext2fs_u32_list_count(ext2_u32_list bb); /* bb_compat */ extern errcode_t badblocks_list_create(badblocks_list *ret, int size); extern errcode_t badblocks_list_add(badblocks_list bb, blk_t blk); extern int badblocks_list_test(badblocks_list bb, blk_t blk); extern errcode_t badblocks_list_iterate_begin(badblocks_list bb, badblocks_iterate *ret); extern int badblocks_list_iterate(badblocks_iterate iter, blk_t *blk); extern void badblocks_list_iterate_end(badblocks_iterate iter); extern void badblocks_list_free(badblocks_list bb); /* bb_inode.c */ extern errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list); /* bitmaps.c */ extern void ext2fs_free_block_bitmap(ext2fs_block_bitmap bitmap); extern void ext2fs_free_inode_bitmap(ext2fs_inode_bitmap bitmap); extern errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src, ext2fs_generic_bitmap *dest); extern errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs); extern errcode_t ext2fs_write_block_bitmap (ext2_filsys fs); extern errcode_t ext2fs_read_inode_bitmap (ext2_filsys fs); extern errcode_t ext2fs_read_block_bitmap(ext2_filsys fs); extern errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs, const char *descr, ext2fs_block_bitmap *ret); extern errcode_t ext2fs_allocate_subcluster_bitmap(ext2_filsys fs, const char *descr, ext2fs_block_bitmap *ret); extern int ext2fs_get_bitmap_granularity(ext2fs_block_bitmap bitmap); extern errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs, const char *descr, ext2fs_inode_bitmap *ret); extern errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap, ext2_ino_t end, ext2_ino_t *oend); extern errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap, blk_t end, blk_t *oend); extern errcode_t ext2fs_fudge_block_bitmap_end2(ext2fs_block_bitmap bitmap, blk64_t end, blk64_t *oend); extern void ext2fs_clear_inode_bitmap(ext2fs_inode_bitmap bitmap); extern void ext2fs_clear_block_bitmap(ext2fs_block_bitmap bitmap); extern errcode_t ext2fs_read_bitmaps(ext2_filsys fs); extern errcode_t ext2fs_write_bitmaps(ext2_filsys fs); extern errcode_t ext2fs_resize_inode_bitmap(__u32 new_end, __u32 new_real_end, ext2fs_inode_bitmap bmap); extern errcode_t ext2fs_resize_inode_bitmap2(__u64 new_end, __u64 new_real_end, ext2fs_inode_bitmap bmap); extern errcode_t ext2fs_resize_block_bitmap(__u32 new_end, __u32 new_real_end, ext2fs_block_bitmap bmap); extern errcode_t ext2fs_resize_block_bitmap2(__u64 new_end, __u64 new_real_end, ext2fs_block_bitmap bmap); extern errcode_t ext2fs_compare_block_bitmap(ext2fs_block_bitmap bm1, ext2fs_block_bitmap bm2); extern errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1, ext2fs_inode_bitmap bm2); extern errcode_t ext2fs_set_inode_bitmap_range(ext2fs_inode_bitmap bmap, ext2_ino_t start, unsigned int num, void *in); extern errcode_t ext2fs_set_inode_bitmap_range2(ext2fs_inode_bitmap bmap, __u64 start, size_t num, void *in); extern errcode_t ext2fs_get_inode_bitmap_range(ext2fs_inode_bitmap bmap, ext2_ino_t start, unsigned int num, void *out); extern errcode_t ext2fs_get_inode_bitmap_range2(ext2fs_inode_bitmap bmap, __u64 start, size_t num, void *out); extern errcode_t ext2fs_set_block_bitmap_range(ext2fs_block_bitmap bmap, blk_t start, unsigned int num, void *in); extern errcode_t ext2fs_set_block_bitmap_range2(ext2fs_block_bitmap bmap, blk64_t start, size_t num, void *in); extern errcode_t ext2fs_get_block_bitmap_range(ext2fs_block_bitmap bmap, blk_t start, unsigned int num, void *out); extern errcode_t ext2fs_get_block_bitmap_range2(ext2fs_block_bitmap bmap, blk64_t start, size_t num, void *out); /* blknum.c */ extern dgrp_t ext2fs_group_of_blk2(ext2_filsys fs, blk64_t); extern blk64_t ext2fs_group_first_block2(ext2_filsys fs, dgrp_t group); extern blk64_t ext2fs_group_last_block2(ext2_filsys fs, dgrp_t group); extern int ext2fs_group_blocks_count(ext2_filsys fs, dgrp_t group); extern blk64_t ext2fs_inode_data_blocks2(ext2_filsys fs, struct ext2_inode *inode); extern blk64_t ext2fs_inode_i_blocks(ext2_filsys fs, struct ext2_inode *inode); extern blk64_t ext2fs_blocks_count(struct ext2_super_block *super); extern void ext2fs_blocks_count_set(struct ext2_super_block *super, blk64_t blk); extern void ext2fs_blocks_count_add(struct ext2_super_block *super, blk64_t blk); extern blk64_t ext2fs_r_blocks_count(struct ext2_super_block *super); extern void ext2fs_r_blocks_count_set(struct ext2_super_block *super, blk64_t blk); extern void ext2fs_r_blocks_count_add(struct ext2_super_block *super, blk64_t blk); extern blk64_t ext2fs_free_blocks_count(struct ext2_super_block *super); extern void ext2fs_free_blocks_count_set(struct ext2_super_block *super, blk64_t blk); extern void ext2fs_free_blocks_count_add(struct ext2_super_block *super, blk64_t blk); /* Block group descriptor accessor functions */ extern struct ext2_group_desc *ext2fs_group_desc(ext2_filsys fs, struct opaque_ext2_group_desc *gdp, dgrp_t group); extern blk64_t ext2fs_block_bitmap_loc(ext2_filsys fs, dgrp_t group); extern void ext2fs_block_bitmap_loc_set(ext2_filsys fs, dgrp_t group, blk64_t blk); extern blk64_t ext2fs_inode_bitmap_loc(ext2_filsys fs, dgrp_t group); extern void ext2fs_inode_bitmap_loc_set(ext2_filsys fs, dgrp_t group, blk64_t blk); extern blk64_t ext2fs_inode_table_loc(ext2_filsys fs, dgrp_t group); extern void ext2fs_inode_table_loc_set(ext2_filsys fs, dgrp_t group, blk64_t blk); extern __u32 ext2fs_bg_free_blocks_count(ext2_filsys fs, dgrp_t group); extern void ext2fs_bg_free_blocks_count_set(ext2_filsys fs, dgrp_t group, __u32 n); extern __u32 ext2fs_bg_free_inodes_count(ext2_filsys fs, dgrp_t group); extern void ext2fs_bg_free_inodes_count_set(ext2_filsys fs, dgrp_t group, __u32 n); extern __u32 ext2fs_bg_used_dirs_count(ext2_filsys fs, dgrp_t group); extern void ext2fs_bg_used_dirs_count_set(ext2_filsys fs, dgrp_t group, __u32 n); extern __u32 ext2fs_bg_itable_unused(ext2_filsys fs, dgrp_t group); extern void ext2fs_bg_itable_unused_set(ext2_filsys fs, dgrp_t group, __u32 n); extern __u16 ext2fs_bg_flags(ext2_filsys fs, dgrp_t group); extern void ext2fs_bg_flags_zap(ext2_filsys fs, dgrp_t group); extern int ext2fs_bg_flags_test(ext2_filsys fs, dgrp_t group, __u16 bg_flag); extern void ext2fs_bg_flags_set(ext2_filsys fs, dgrp_t group, __u16 bg_flags); extern void ext2fs_bg_flags_clear(ext2_filsys fs, dgrp_t group, __u16 bg_flags); extern __u16 ext2fs_bg_checksum(ext2_filsys fs, dgrp_t group); extern void ext2fs_bg_checksum_set(ext2_filsys fs, dgrp_t group, __u16 checksum); extern blk64_t ext2fs_file_acl_block(ext2_filsys fs, const struct ext2_inode *inode); extern void ext2fs_file_acl_block_set(ext2_filsys fs, struct ext2_inode *inode, blk64_t blk); /* block.c */ extern errcode_t ext2fs_block_iterate(ext2_filsys fs, ext2_ino_t ino, int flags, char *block_buf, int (*func)(ext2_filsys fs, blk_t *blocknr, int blockcnt, void *priv_data), void *priv_data); errcode_t ext2fs_block_iterate2(ext2_filsys fs, ext2_ino_t ino, int flags, char *block_buf, int (*func)(ext2_filsys fs, blk_t *blocknr, e2_blkcnt_t blockcnt, blk_t ref_blk, int ref_offset, void *priv_data), void *priv_data); errcode_t ext2fs_block_iterate3(ext2_filsys fs, ext2_ino_t ino, int flags, char *block_buf, int (*func)(ext2_filsys fs, blk64_t *blocknr, e2_blkcnt_t blockcnt, blk64_t ref_blk, int ref_offset, void *priv_data), void *priv_data); /* bmap.c */ extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, char *block_buf, int bmap_flags, blk_t block, blk_t *phys_blk); extern errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, char *block_buf, int bmap_flags, blk64_t block, int *ret_flags, blk64_t *phys_blk); errcode_t ext2fs_map_cluster_block(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, blk64_t lblk, blk64_t *pblk); #if 0 /* bmove.c */ extern errcode_t ext2fs_move_blocks(ext2_filsys fs, ext2fs_block_bitmap reserve, ext2fs_block_bitmap alloc_map, int flags); #endif /* check_desc.c */ extern errcode_t ext2fs_check_desc(ext2_filsys fs); /* closefs.c */ extern errcode_t ext2fs_close(ext2_filsys fs); extern errcode_t ext2fs_close2(ext2_filsys fs, int flags); extern errcode_t ext2fs_close_free(ext2_filsys *fs); extern errcode_t ext2fs_flush(ext2_filsys fs); extern errcode_t ext2fs_flush2(ext2_filsys fs, int flags); extern int ext2fs_bg_has_super(ext2_filsys fs, dgrp_t group_block); extern errcode_t ext2fs_super_and_bgd_loc2(ext2_filsys fs, dgrp_t group, blk64_t *ret_super_blk, blk64_t *ret_old_desc_blk, blk64_t *ret_new_desc_blk, blk_t *ret_used_blks); extern int ext2fs_super_and_bgd_loc(ext2_filsys fs, dgrp_t group, blk_t *ret_super_blk, blk_t *ret_old_desc_blk, blk_t *ret_new_desc_blk, int *ret_meta_bg); extern void ext2fs_update_dynamic_rev(ext2_filsys fs); /* crc32c.c */ extern __u32 ext2fs_crc32c_be(__u32 crc, unsigned char const *p, size_t len); extern __u32 ext2fs_crc32c_le(__u32 crc, unsigned char const *p, size_t len); /* csum.c */ extern void ext2fs_group_desc_csum_set(ext2_filsys fs, dgrp_t group); extern int ext2fs_group_desc_csum_verify(ext2_filsys fs, dgrp_t group); extern errcode_t ext2fs_set_gdt_csum(ext2_filsys fs); extern __u16 ext2fs_group_desc_csum(ext2_filsys fs, dgrp_t group); /* dblist.c */ extern errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ext2_ino_t *ret_num_dirs); extern errcode_t ext2fs_init_dblist(ext2_filsys fs, ext2_dblist *ret_dblist); extern errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk, int blockcnt); extern errcode_t ext2fs_add_dir_block2(ext2_dblist dblist, ext2_ino_t ino, blk64_t blk, e2_blkcnt_t blockcnt); extern void ext2fs_dblist_sort(ext2_dblist dblist, EXT2_QSORT_TYPE (*sortfunc)(const void *, const void *)); extern void ext2fs_dblist_sort2(ext2_dblist dblist, EXT2_QSORT_TYPE (*sortfunc)(const void *, const void *)); extern errcode_t ext2fs_dblist_iterate(ext2_dblist dblist, int (*func)(ext2_filsys fs, struct ext2_db_entry *db_info, void *priv_data), void *priv_data); extern errcode_t ext2fs_dblist_iterate2(ext2_dblist dblist, int (*func)(ext2_filsys fs, struct ext2_db_entry2 *db_info, void *priv_data), void *priv_data); extern errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk, int blockcnt); extern errcode_t ext2fs_set_dir_block2(ext2_dblist dblist, ext2_ino_t ino, blk64_t blk, e2_blkcnt_t blockcnt); extern errcode_t ext2fs_copy_dblist(ext2_dblist src, ext2_dblist *dest); extern int ext2fs_dblist_count(ext2_dblist dblist); extern blk64_t ext2fs_dblist_count2(ext2_dblist dblist); extern errcode_t ext2fs_dblist_get_last(ext2_dblist dblist, struct ext2_db_entry **entry); extern errcode_t ext2fs_dblist_get_last2(ext2_dblist dblist, struct ext2_db_entry2 **entry); extern errcode_t ext2fs_dblist_drop_last(ext2_dblist dblist); /* dblist_dir.c */ extern errcode_t ext2fs_dblist_dir_iterate(ext2_dblist dblist, int flags, char *block_buf, int (*func)(ext2_ino_t dir, int entry, struct ext2_dir_entry *dirent, int offset, int blocksize, char *buf, void *priv_data), void *priv_data); /* dirblock.c */ extern errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block, void *buf); extern errcode_t ext2fs_read_dir_block2(ext2_filsys fs, blk_t block, void *buf, int flags); extern errcode_t ext2fs_read_dir_block3(ext2_filsys fs, blk64_t block, void *buf, int flags); extern errcode_t ext2fs_write_dir_block(ext2_filsys fs, blk_t block, void *buf); extern errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block, void *buf, int flags); extern errcode_t ext2fs_write_dir_block3(ext2_filsys fs, blk64_t block, void *buf, int flags); /* dirhash.c */ extern errcode_t ext2fs_dirhash(int version, const char *name, int len, const __u32 *seed, ext2_dirhash_t *ret_hash, ext2_dirhash_t *ret_minor_hash); /* dir_iterate.c */ extern errcode_t ext2fs_get_rec_len(ext2_filsys fs, struct ext2_dir_entry *dirent, unsigned int *rec_len); extern errcode_t ext2fs_set_rec_len(ext2_filsys fs, unsigned int len, struct ext2_dir_entry *dirent); extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, ext2_ino_t dir, int flags, char *block_buf, int (*func)(struct ext2_dir_entry *dirent, int offset, int blocksize, char *buf, void *priv_data), void *priv_data); extern errcode_t ext2fs_dir_iterate2(ext2_filsys fs, ext2_ino_t dir, int flags, char *block_buf, int (*func)(ext2_ino_t dir, int entry, struct ext2_dir_entry *dirent, int offset, int blocksize, char *buf, void *priv_data), void *priv_data); /* dupfs.c */ extern errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest); /* expanddir.c */ extern errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir); /* ext_attr.c */ extern __u32 ext2fs_ext_attr_hash_entry(struct ext2_ext_attr_entry *entry, void *data); extern errcode_t ext2fs_read_ext_attr(ext2_filsys fs, blk_t block, void *buf); extern errcode_t ext2fs_read_ext_attr2(ext2_filsys fs, blk64_t block, void *buf); extern errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block, void *buf); extern errcode_t ext2fs_write_ext_attr2(ext2_filsys fs, blk64_t block, void *buf); extern errcode_t ext2fs_adjust_ea_refcount(ext2_filsys fs, blk_t blk, char *block_buf, int adjust, __u32 *newcount); extern errcode_t ext2fs_adjust_ea_refcount2(ext2_filsys fs, blk64_t blk, char *block_buf, int adjust, __u32 *newcount); /* extent.c */ extern errcode_t ext2fs_extent_header_verify(void *ptr, int size); extern errcode_t ext2fs_extent_open(ext2_filsys fs, ext2_ino_t ino, ext2_extent_handle_t *handle); extern errcode_t ext2fs_extent_open2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, ext2_extent_handle_t *ret_handle); extern void ext2fs_extent_free(ext2_extent_handle_t handle); extern errcode_t ext2fs_extent_get(ext2_extent_handle_t handle, int flags, struct ext2fs_extent *extent); extern errcode_t ext2fs_extent_node_split(ext2_extent_handle_t handle); extern errcode_t ext2fs_extent_replace(ext2_extent_handle_t handle, int flags, struct ext2fs_extent *extent); extern errcode_t ext2fs_extent_insert(ext2_extent_handle_t handle, int flags, struct ext2fs_extent *extent); extern errcode_t ext2fs_extent_set_bmap(ext2_extent_handle_t handle, blk64_t logical, blk64_t physical, int flags); extern errcode_t ext2fs_extent_delete(ext2_extent_handle_t handle, int flags); extern errcode_t ext2fs_extent_get_info(ext2_extent_handle_t handle, struct ext2_extent_info *info); extern errcode_t ext2fs_extent_goto(ext2_extent_handle_t handle, blk64_t blk); extern errcode_t ext2fs_extent_goto2(ext2_extent_handle_t handle, int leaf_level, blk64_t blk); extern errcode_t ext2fs_extent_fix_parents(ext2_extent_handle_t handle); /* fileio.c */ extern errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, int flags, ext2_file_t *ret); extern errcode_t ext2fs_file_open(ext2_filsys fs, ext2_ino_t ino, int flags, ext2_file_t *ret); extern ext2_filsys ext2fs_file_get_fs(ext2_file_t file); struct ext2_inode *ext2fs_file_get_inode(ext2_file_t file); extern ext2_ino_t ext2fs_file_get_inode_num(ext2_file_t file); extern errcode_t ext2fs_file_close(ext2_file_t file); extern errcode_t ext2fs_file_flush(ext2_file_t file); extern errcode_t ext2fs_file_read(ext2_file_t file, void *buf, unsigned int wanted, unsigned int *got); extern errcode_t ext2fs_file_write(ext2_file_t file, const void *buf, unsigned int nbytes, unsigned int *written); extern errcode_t ext2fs_file_llseek(ext2_file_t file, __u64 offset, int whence, __u64 *ret_pos); extern errcode_t ext2fs_file_lseek(ext2_file_t file, ext2_off_t offset, int whence, ext2_off_t *ret_pos); errcode_t ext2fs_file_get_lsize(ext2_file_t file, __u64 *ret_size); extern ext2_off_t ext2fs_file_get_size(ext2_file_t file); extern errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size); extern errcode_t ext2fs_file_set_size2(ext2_file_t file, ext2_off64_t size); /* finddev.c */ extern char *ext2fs_find_block_device(dev_t device); /* flushb.c */ extern errcode_t ext2fs_sync_device(int fd, int flushb); /* freefs.c */ extern void ext2fs_free(ext2_filsys fs); extern void ext2fs_free_dblist(ext2_dblist dblist); extern void ext2fs_badblocks_list_free(ext2_badblocks_list bb); extern void ext2fs_u32_list_free(ext2_u32_list bb); /* gen_bitmap.c */ extern void ext2fs_free_generic_bitmap(ext2fs_inode_bitmap bitmap); extern errcode_t ext2fs_make_generic_bitmap(errcode_t magic, ext2_filsys fs, __u32 start, __u32 end, __u32 real_end, const char *descr, char *init_map, ext2fs_generic_bitmap *ret); extern errcode_t ext2fs_allocate_generic_bitmap(__u32 start, __u32 end, __u32 real_end, const char *descr, ext2fs_generic_bitmap *ret); extern errcode_t ext2fs_copy_generic_bitmap(ext2fs_generic_bitmap src, ext2fs_generic_bitmap *dest); extern void ext2fs_clear_generic_bitmap(ext2fs_generic_bitmap bitmap); extern errcode_t ext2fs_fudge_generic_bitmap_end(ext2fs_inode_bitmap bitmap, errcode_t magic, errcode_t neq, ext2_ino_t end, ext2_ino_t *oend); extern void ext2fs_set_generic_bitmap_padding(ext2fs_generic_bitmap map); extern errcode_t ext2fs_resize_generic_bitmap(errcode_t magic, __u32 new_end, __u32 new_real_end, ext2fs_generic_bitmap bmap); extern errcode_t ext2fs_compare_generic_bitmap(errcode_t magic, errcode_t neq, ext2fs_generic_bitmap bm1, ext2fs_generic_bitmap bm2); extern errcode_t ext2fs_get_generic_bitmap_range(ext2fs_generic_bitmap bmap, errcode_t magic, __u32 start, __u32 num, void *out); extern errcode_t ext2fs_set_generic_bitmap_range(ext2fs_generic_bitmap bmap, errcode_t magic, __u32 start, __u32 num, void *in); extern errcode_t ext2fs_find_first_zero_generic_bitmap(ext2fs_generic_bitmap bitmap, __u32 start, __u32 end, __u32 *out); /* gen_bitmap64.c */ /* Generate and print bitmap usage statistics */ #define BMAP_STATS void ext2fs_free_generic_bmap(ext2fs_generic_bitmap bmap); errcode_t ext2fs_alloc_generic_bmap(ext2_filsys fs, errcode_t magic, int type, __u64 start, __u64 end, __u64 real_end, const char *descr, ext2fs_generic_bitmap *ret); errcode_t ext2fs_copy_generic_bmap(ext2fs_generic_bitmap src, ext2fs_generic_bitmap *dest); void ext2fs_clear_generic_bmap(ext2fs_generic_bitmap bitmap); errcode_t ext2fs_fudge_generic_bmap_end(ext2fs_generic_bitmap bitmap, errcode_t neq, __u64 end, __u64 *oend); void ext2fs_set_generic_bmap_padding(ext2fs_generic_bitmap bmap); errcode_t ext2fs_resize_generic_bmap(ext2fs_generic_bitmap bmap, __u64 new_end, __u64 new_real_end); errcode_t ext2fs_compare_generic_bmap(errcode_t neq, ext2fs_generic_bitmap bm1, ext2fs_generic_bitmap bm2); errcode_t ext2fs_get_generic_bmap_range(ext2fs_generic_bitmap bmap, __u64 start, unsigned int num, void *out); errcode_t ext2fs_set_generic_bmap_range(ext2fs_generic_bitmap bmap, __u64 start, unsigned int num, void *in); errcode_t ext2fs_convert_subcluster_bitmap(ext2_filsys fs, ext2fs_block_bitmap *bitmap); /* getsize.c */ extern errcode_t ext2fs_get_device_size(const char *file, int blocksize, blk_t *retblocks); extern errcode_t ext2fs_get_device_size2(const char *file, int blocksize, blk64_t *retblocks); /* getsectsize.c */ extern int ext2fs_get_dio_alignment(int fd); errcode_t ext2fs_get_device_sectsize(const char *file, int *sectsize); errcode_t ext2fs_get_device_phys_sectsize(const char *file, int *sectsize); /* i_block.c */ errcode_t ext2fs_iblk_add_blocks(ext2_filsys fs, struct ext2_inode *inode, blk64_t num_blocks); errcode_t ext2fs_iblk_sub_blocks(ext2_filsys fs, struct ext2_inode *inode, blk64_t num_blocks); errcode_t ext2fs_iblk_set(ext2_filsys fs, struct ext2_inode *inode, blk64_t b); /* imager.c */ extern errcode_t ext2fs_image_inode_write(ext2_filsys fs, int fd, int flags); extern errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, int flags); extern errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, int flags); extern errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, int flags); extern errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags); extern errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags); /* ind_block.c */ errcode_t ext2fs_read_ind_block(ext2_filsys fs, blk_t blk, void *buf); errcode_t ext2fs_write_ind_block(ext2_filsys fs, blk_t blk, void *buf); /* initialize.c */ extern errcode_t ext2fs_initialize(const char *name, int flags, struct ext2_super_block *param, io_manager manager, ext2_filsys *ret_fs); /* icount.c */ extern void ext2fs_free_icount(ext2_icount_t icount); extern errcode_t ext2fs_create_icount_tdb(ext2_filsys fs, char *tdb_dir, int flags, ext2_icount_t *ret); extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, unsigned int size, ext2_icount_t hint, ext2_icount_t *ret); extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, unsigned int size, ext2_icount_t *ret); extern errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino, __u16 *ret); extern errcode_t ext2fs_icount_increment(ext2_icount_t icount, ext2_ino_t ino, __u16 *ret); extern errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ext2_ino_t ino, __u16 *ret); extern errcode_t ext2fs_icount_store(ext2_icount_t icount, ext2_ino_t ino, __u16 count); extern ext2_ino_t ext2fs_get_icount_size(ext2_icount_t icount); errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *); /* inline.c */ extern errcode_t ext2fs_get_memalign(unsigned long size, unsigned long align, void *ptr); /* inode.c */ extern errcode_t ext2fs_flush_icache(ext2_filsys fs); extern errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, struct ext2_inode *inode, int bufsize); extern errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks, ext2_inode_scan *ret_scan); extern void ext2fs_close_inode_scan(ext2_inode_scan scan); extern errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ext2_ino_t *ino, struct ext2_inode *inode); extern errcode_t ext2fs_inode_scan_goto_blockgroup(ext2_inode_scan scan, int group); extern void ext2fs_set_inode_callback (ext2_inode_scan scan, errcode_t (*done_group)(ext2_filsys fs, ext2_inode_scan scan, dgrp_t group, void * priv_data), void *done_group_data); extern int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags, int clear_flags); extern errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode * inode, int bufsize); extern errcode_t ext2fs_read_inode (ext2_filsys fs, ext2_ino_t ino, struct ext2_inode * inode); extern errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode * inode, int bufsize); extern errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode * inode); extern errcode_t ext2fs_write_new_inode(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode * inode); extern errcode_t ext2fs_get_blocks(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks); extern errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino); /* inode_io.c */ extern io_manager inode_io_manager; extern errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino, char **name); extern errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, char **name); /* ismounted.c */ extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags); extern errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags, char *mtpt, int mtlen); /* punch.c */ /* * NOTE: This function removes from an inode the blocks "start", "end", and * every block in between. */ extern errcode_t ext2fs_punch(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, char *block_buf, blk64_t start, blk64_t end); /* namei.c */ extern errcode_t ext2fs_lookup(ext2_filsys fs, ext2_ino_t dir, const char *name, int namelen, char *buf, ext2_ino_t *inode); extern errcode_t ext2fs_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, const char *name, ext2_ino_t *inode); errcode_t ext2fs_namei_follow(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, const char *name, ext2_ino_t *inode); extern errcode_t ext2fs_follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, ext2_ino_t inode, ext2_ino_t *res_inode); /* native.c */ int ext2fs_native_flag(void); /* newdir.c */ extern errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino, ext2_ino_t parent_ino, char **block); /* mkdir.c */ extern errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum, const char *name); /* mkjournal.c */ extern errcode_t ext2fs_zero_blocks(ext2_filsys fs, blk_t blk, int num, blk_t *ret_blk, int *ret_count); extern errcode_t ext2fs_zero_blocks2(ext2_filsys fs, blk64_t blk, int num, blk64_t *ret_blk, int *ret_count); extern errcode_t ext2fs_create_journal_superblock(ext2_filsys fs, __u32 num_blocks, int flags, char **ret_jsb); extern errcode_t ext2fs_add_journal_device(ext2_filsys fs, ext2_filsys journal_dev); extern errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t num_blocks, int flags); extern int ext2fs_default_journal_size(__u64 num_blocks); /* openfs.c */ extern errcode_t ext2fs_open(const char *name, int flags, int superblock, unsigned int block_size, io_manager manager, ext2_filsys *ret_fs); extern errcode_t ext2fs_open2(const char *name, const char *io_options, int flags, int superblock, unsigned int block_size, io_manager manager, ext2_filsys *ret_fs); /* * The dgrp_t argument to these two functions is not actually a group number * but a block number offset within a group table! Convert with the formula * (group_number / groups_per_block). */ extern blk64_t ext2fs_descriptor_block_loc2(ext2_filsys fs, blk64_t group_block, dgrp_t i); extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, dgrp_t i); errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io); errcode_t ext2fs_set_data_io(ext2_filsys fs, io_channel new_io); errcode_t ext2fs_rewrite_to_io(ext2_filsys fs, io_channel new_io); /* get_pathname.c */ extern errcode_t ext2fs_get_pathname(ext2_filsys fs, ext2_ino_t dir, ext2_ino_t ino, char **name); /* link.c */ errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name, ext2_ino_t ino, int flags); errcode_t ext2fs_unlink(ext2_filsys fs, ext2_ino_t dir, const char *name, ext2_ino_t ino, int flags); /* symlink.c */ errcode_t ext2fs_symlink(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t ino, const char *name, char *target); /* mmp.c */ errcode_t ext2fs_mmp_read(ext2_filsys fs, blk64_t mmp_blk, void *buf); errcode_t ext2fs_mmp_write(ext2_filsys fs, blk64_t mmp_blk, void *buf); errcode_t ext2fs_mmp_clear(ext2_filsys fs); errcode_t ext2fs_mmp_init(ext2_filsys fs); errcode_t ext2fs_mmp_start(ext2_filsys fs); errcode_t ext2fs_mmp_update(ext2_filsys fs); errcode_t ext2fs_mmp_stop(ext2_filsys fs); unsigned ext2fs_mmp_new_seq(void); /* read_bb.c */ extern errcode_t ext2fs_read_bb_inode(ext2_filsys fs, ext2_badblocks_list *bb_list); /* read_bb_file.c */ extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, ext2_badblocks_list *bb_list, void *priv_data, void (*invalid)(ext2_filsys fs, blk_t blk, char *badstr, void *priv_data)); extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, ext2_badblocks_list *bb_list, void (*invalid)(ext2_filsys fs, blk_t blk)); /* res_gdt.c */ extern errcode_t ext2fs_create_resize_inode(ext2_filsys fs); /* swapfs.c */ extern void ext2fs_swap_ext_attr(char *to, char *from, int bufsize, int has_header); extern void ext2fs_swap_ext_attr_header(struct ext2_ext_attr_header *to_header, struct ext2_ext_attr_header *from_hdr); extern void ext2fs_swap_ext_attr_entry(struct ext2_ext_attr_entry *to_entry, struct ext2_ext_attr_entry *from_entry); extern void ext2fs_swap_super(struct ext2_super_block * super); extern void ext2fs_swap_group_desc(struct ext2_group_desc *gdp); extern void ext2fs_swap_group_desc2(ext2_filsys, struct ext2_group_desc *gdp); extern void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t, struct ext2_inode_large *f, int hostorder, int bufsize); extern void ext2fs_swap_inode(ext2_filsys fs,struct ext2_inode *t, struct ext2_inode *f, int hostorder); extern void ext2fs_swap_mmp(struct mmp_struct *mmp); /* unix_io.c */ extern int ext2fs_open_file(const char *pathname, int flags, mode_t mode); extern int ext2fs_stat(const char *path, ext2fs_struct_stat *buf); extern int ext2fs_fstat(int fd, ext2fs_struct_stat *buf); /* valid_blk.c */ extern int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode); extern int ext2fs_inode_has_valid_blocks2(ext2_filsys fs, struct ext2_inode *inode); /* version.c */ extern int ext2fs_parse_version_string(const char *ver_string); extern int ext2fs_get_library_version(const char **ver_string, const char **date_string); /* write_bb_file.c */ extern errcode_t ext2fs_write_bb_FILE(ext2_badblocks_list bb_list, unsigned int flags, FILE *f); /* inline functions */ #ifdef NO_INLINE_FUNCS extern errcode_t ext2fs_get_mem(unsigned long size, void *ptr); extern errcode_t ext2fs_get_memzero(unsigned long size, void *ptr); extern errcode_t ext2fs_get_array(unsigned long count, unsigned long size, void *ptr); extern errcode_t ext2fs_get_arrayzero(unsigned long count, unsigned long size, void *ptr); extern errcode_t ext2fs_free_mem(void *ptr); extern errcode_t ext2fs_resize_mem(unsigned long old_size, unsigned long size, void *ptr); extern void ext2fs_mark_super_dirty(ext2_filsys fs); extern void ext2fs_mark_changed(ext2_filsys fs); extern int ext2fs_test_changed(ext2_filsys fs); extern void ext2fs_mark_valid(ext2_filsys fs); extern void ext2fs_unmark_valid(ext2_filsys fs); extern int ext2fs_test_valid(ext2_filsys fs); extern void ext2fs_mark_ib_dirty(ext2_filsys fs); extern void ext2fs_mark_bb_dirty(ext2_filsys fs); extern int ext2fs_test_ib_dirty(ext2_filsys fs); extern int ext2fs_test_bb_dirty(ext2_filsys fs); extern dgrp_t ext2fs_group_of_blk(ext2_filsys fs, blk_t blk); extern dgrp_t ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino); extern blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group); extern blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group); extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs, struct ext2_inode *inode); extern unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b); extern __u64 ext2fs_div64_ceil(__u64 a, __u64 b); #endif /* * The actual inlined functions definitions themselves... * * If NO_INLINE_FUNCS is defined, then we won't try to do inline * functions at all! */ #if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) #ifdef INCLUDE_INLINE_FUNCS #define _INLINE_ extern #else #if (__STDC_VERSION__ >= 199901L) #define _INLINE_ inline #else #ifdef __GNUC__ #define _INLINE_ extern __inline__ #else /* For Watcom C */ #define _INLINE_ extern inline #endif /* __GNUC__ */ #endif /* __STDC_VERSION__ >= 199901L */ #endif #ifndef EXT2_CUSTOM_MEMORY_ROUTINES #include /* * Allocate memory. The 'ptr' arg must point to a pointer. */ _INLINE_ errcode_t ext2fs_get_mem(unsigned long size, void *ptr) { void *pp; pp = malloc(size); if (!pp) return EXT2_ET_NO_MEMORY; memcpy(ptr, &pp, sizeof (pp)); return 0; } _INLINE_ errcode_t ext2fs_get_memzero(unsigned long size, void *ptr) { void *pp; pp = malloc(size); if (!pp) return EXT2_ET_NO_MEMORY; memset(pp, 0, size); memcpy(ptr, &pp, sizeof(pp)); return 0; } _INLINE_ errcode_t ext2fs_get_array(unsigned long count, unsigned long size, void *ptr) { if (count && (-1UL)/countflags |= EXT2_FLAG_DIRTY | EXT2_FLAG_CHANGED; } /* * Mark a filesystem as changed */ _INLINE_ void ext2fs_mark_changed(ext2_filsys fs) { fs->flags |= EXT2_FLAG_CHANGED; } /* * Check to see if a filesystem has changed */ _INLINE_ int ext2fs_test_changed(ext2_filsys fs) { return (fs->flags & EXT2_FLAG_CHANGED); } /* * Mark a filesystem as valid */ _INLINE_ void ext2fs_mark_valid(ext2_filsys fs) { fs->flags |= EXT2_FLAG_VALID; } /* * Mark a filesystem as NOT valid */ _INLINE_ void ext2fs_unmark_valid(ext2_filsys fs) { fs->flags &= ~EXT2_FLAG_VALID; } /* * Check to see if a filesystem is valid */ _INLINE_ int ext2fs_test_valid(ext2_filsys fs) { return (fs->flags & EXT2_FLAG_VALID); } /* * Mark the inode bitmap as dirty */ _INLINE_ void ext2fs_mark_ib_dirty(ext2_filsys fs) { fs->flags |= EXT2_FLAG_IB_DIRTY | EXT2_FLAG_CHANGED; } /* * Mark the block bitmap as dirty */ _INLINE_ void ext2fs_mark_bb_dirty(ext2_filsys fs) { fs->flags |= EXT2_FLAG_BB_DIRTY | EXT2_FLAG_CHANGED; } /* * Check to see if a filesystem's inode bitmap is dirty */ _INLINE_ int ext2fs_test_ib_dirty(ext2_filsys fs) { return (fs->flags & EXT2_FLAG_IB_DIRTY); } /* * Check to see if a filesystem's block bitmap is dirty */ _INLINE_ int ext2fs_test_bb_dirty(ext2_filsys fs) { return (fs->flags & EXT2_FLAG_BB_DIRTY); } /* * Return the group # of a block */ _INLINE_ dgrp_t ext2fs_group_of_blk(ext2_filsys fs, blk_t blk) { return ext2fs_group_of_blk2(fs, blk); } /* * Return the group # of an inode number */ _INLINE_ dgrp_t ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino) { return (ino - 1) / fs->super->s_inodes_per_group; } /* * Return the first block (inclusive) in a group */ _INLINE_ blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group) { return (blk_t) ext2fs_group_first_block2(fs, group); } /* * Return the last block (inclusive) in a group */ _INLINE_ blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group) { return (blk_t) ext2fs_group_last_block2(fs, group); } _INLINE_ blk_t ext2fs_inode_data_blocks(ext2_filsys fs, struct ext2_inode *inode) { return (blk_t) ext2fs_inode_data_blocks2(fs, inode); } /* * This is an efficient, overflow safe way of calculating ceil((1.0 * a) / b) */ _INLINE_ unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b) { if (!a) return 0; return ((a - 1) / b) + 1; } _INLINE_ __u64 ext2fs_div64_ceil(__u64 a, __u64 b) { if (!a) return 0; return ((a - 1) / b) + 1; } #undef _INLINE_ #endif #ifdef __cplusplus } #endif #endif /* _EXT2FS_EXT2FS_H */ ext2fs/ext2_types.h000064400000001566147631660260010261 0ustar00/* This file is here to prevent a file conflict on multiarch systems. A * conflict will occur because ext2_types.h has arch-specific definitions. * * DO NOT INCLUDE THE NEW FILE DIRECTLY -- ALWAYS INCLUDE THIS ONE INSTEAD. */ #if defined(__i386__) #include "ext2_types-i386.h" #elif defined(__powerpc64__) #include "ext2_types-ppc64.h" #elif defined(__powerpc__) #include "ext2_types-ppc.h" #elif defined(__s390x__) #include "ext2_types-s390x.h" #elif defined(__s390__) #include "ext2_types-s390.h" #elif defined(__x86_64__) #include "ext2_types-x86_64.h" #elif defined(__alpha__) #include "ext2_types-alpha.h" #elif defined(__arm__) #include "ext2_types-arm.h" #elif defined(__sparc__) && defined(__arch64__) #include "ext2_types-sparc64.h" #elif defined(__sparc__) #include "ext2_types-sparc.h" #else #error "This e2fsprogs-devel package does not work your architecture?" #endif ext2fs/ext2_io.h000064400000011150147631660260007512 0ustar00/* * io.h --- the I/O manager abstraction * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% * This file may be redistributed under the terms of the GNU Library * General Public License, version 2. * %End-Header% */ #ifndef _EXT2FS_EXT2_IO_H #define _EXT2FS_EXT2_IO_H /* * ext2_loff_t is defined here since unix_io.c needs it. */ #if defined(__GNUC__) || defined(HAS_LONG_LONG) typedef long long ext2_loff_t; #else typedef long ext2_loff_t; #endif /* llseek.c */ ext2_loff_t ext2fs_llseek (int, ext2_loff_t, int); typedef struct struct_io_manager *io_manager; typedef struct struct_io_channel *io_channel; typedef struct struct_io_stats *io_stats; #define CHANNEL_FLAGS_WRITETHROUGH 0x01 #define CHANNEL_FLAGS_DISCARD_ZEROES 0x02 #define CHANNEL_FLAGS_BLOCK_DEVICE 0x04 #define io_channel_discard_zeroes_data(i) (i->flags & CHANNEL_FLAGS_DISCARD_ZEROES) struct struct_io_channel { errcode_t magic; io_manager manager; char *name; int block_size; errcode_t (*read_error)(io_channel channel, unsigned long block, int count, void *data, size_t size, int actual_bytes_read, errcode_t error); errcode_t (*write_error)(io_channel channel, unsigned long block, int count, const void *data, size_t size, int actual_bytes_written, errcode_t error); int refcount; int flags; long reserved[14]; void *private_data; void *app_data; int align; }; struct struct_io_stats { int num_fields; int reserved; unsigned long long bytes_read; unsigned long long bytes_written; }; struct struct_io_manager { errcode_t magic; const char *name; errcode_t (*open)(const char *name, int flags, io_channel *channel); errcode_t (*close)(io_channel channel); errcode_t (*set_blksize)(io_channel channel, int blksize); errcode_t (*read_blk)(io_channel channel, unsigned long block, int count, void *data); errcode_t (*write_blk)(io_channel channel, unsigned long block, int count, const void *data); errcode_t (*flush)(io_channel channel); errcode_t (*write_byte)(io_channel channel, unsigned long offset, int count, const void *data); errcode_t (*set_option)(io_channel channel, const char *option, const char *arg); errcode_t (*get_stats)(io_channel channel, io_stats *io_stats); errcode_t (*read_blk64)(io_channel channel, unsigned long long block, int count, void *data); errcode_t (*write_blk64)(io_channel channel, unsigned long long block, int count, const void *data); errcode_t (*discard)(io_channel channel, unsigned long long block, unsigned long long count); long reserved[16]; }; #define IO_FLAG_RW 0x0001 #define IO_FLAG_EXCLUSIVE 0x0002 #define IO_FLAG_DIRECT_IO 0x0004 /* * Convenience functions.... */ #define io_channel_close(c) ((c)->manager->close((c))) #define io_channel_set_blksize(c,s) ((c)->manager->set_blksize((c),s)) #define io_channel_read_blk(c,b,n,d) ((c)->manager->read_blk((c),b,n,d)) #define io_channel_write_blk(c,b,n,d) ((c)->manager->write_blk((c),b,n,d)) #define io_channel_flush(c) ((c)->manager->flush((c))) #define io_channel_bumpcount(c) ((c)->refcount++) /* io_manager.c */ extern errcode_t io_channel_set_options(io_channel channel, const char *options); extern errcode_t io_channel_write_byte(io_channel channel, unsigned long offset, int count, const void *data); extern errcode_t io_channel_read_blk64(io_channel channel, unsigned long long block, int count, void *data); extern errcode_t io_channel_write_blk64(io_channel channel, unsigned long long block, int count, const void *data); extern errcode_t io_channel_discard(io_channel channel, unsigned long long block, unsigned long long count); extern errcode_t io_channel_alloc_buf(io_channel channel, int count, void *ptr); /* unix_io.c */ extern io_manager unix_io_manager; /* undo_io.c */ extern io_manager undo_io_manager; extern errcode_t set_undo_io_backing_manager(io_manager manager); extern errcode_t set_undo_io_backup_file(char *file_name); /* test_io.c */ extern io_manager test_io_manager, test_io_backing_manager; extern void (*test_io_cb_read_blk) (unsigned long block, int count, errcode_t err); extern void (*test_io_cb_write_blk) (unsigned long block, int count, errcode_t err); extern void (*test_io_cb_read_blk64) (unsigned long long block, int count, errcode_t err); extern void (*test_io_cb_write_blk64) (unsigned long long block, int count, errcode_t err); extern void (*test_io_cb_set_blksize) (int blksize, errcode_t err); #endif /* _EXT2FS_EXT2_IO_H */ ext2fs/ext2_err.h000064400000024137147631660260007704 0ustar00/* * ext2_err.h: * This file is automatically generated; please do not edit it. */ #include #define EXT2_ET_BASE (2133571328L) #define EXT2_ET_MAGIC_EXT2FS_FILSYS (2133571329L) #define EXT2_ET_MAGIC_BADBLOCKS_LIST (2133571330L) #define EXT2_ET_MAGIC_BADBLOCKS_ITERATE (2133571331L) #define EXT2_ET_MAGIC_INODE_SCAN (2133571332L) #define EXT2_ET_MAGIC_IO_CHANNEL (2133571333L) #define EXT2_ET_MAGIC_UNIX_IO_CHANNEL (2133571334L) #define EXT2_ET_MAGIC_IO_MANAGER (2133571335L) #define EXT2_ET_MAGIC_BLOCK_BITMAP (2133571336L) #define EXT2_ET_MAGIC_INODE_BITMAP (2133571337L) #define EXT2_ET_MAGIC_GENERIC_BITMAP (2133571338L) #define EXT2_ET_MAGIC_TEST_IO_CHANNEL (2133571339L) #define EXT2_ET_MAGIC_DBLIST (2133571340L) #define EXT2_ET_MAGIC_ICOUNT (2133571341L) #define EXT2_ET_MAGIC_PQ_IO_CHANNEL (2133571342L) #define EXT2_ET_MAGIC_EXT2_FILE (2133571343L) #define EXT2_ET_MAGIC_E2IMAGE (2133571344L) #define EXT2_ET_MAGIC_INODE_IO_CHANNEL (2133571345L) #define EXT2_ET_MAGIC_EXTENT_HANDLE (2133571346L) #define EXT2_ET_BAD_MAGIC (2133571347L) #define EXT2_ET_REV_TOO_HIGH (2133571348L) #define EXT2_ET_RO_FILSYS (2133571349L) #define EXT2_ET_GDESC_READ (2133571350L) #define EXT2_ET_GDESC_WRITE (2133571351L) #define EXT2_ET_GDESC_BAD_BLOCK_MAP (2133571352L) #define EXT2_ET_GDESC_BAD_INODE_MAP (2133571353L) #define EXT2_ET_GDESC_BAD_INODE_TABLE (2133571354L) #define EXT2_ET_INODE_BITMAP_WRITE (2133571355L) #define EXT2_ET_INODE_BITMAP_READ (2133571356L) #define EXT2_ET_BLOCK_BITMAP_WRITE (2133571357L) #define EXT2_ET_BLOCK_BITMAP_READ (2133571358L) #define EXT2_ET_INODE_TABLE_WRITE (2133571359L) #define EXT2_ET_INODE_TABLE_READ (2133571360L) #define EXT2_ET_NEXT_INODE_READ (2133571361L) #define EXT2_ET_UNEXPECTED_BLOCK_SIZE (2133571362L) #define EXT2_ET_DIR_CORRUPTED (2133571363L) #define EXT2_ET_SHORT_READ (2133571364L) #define EXT2_ET_SHORT_WRITE (2133571365L) #define EXT2_ET_DIR_NO_SPACE (2133571366L) #define EXT2_ET_NO_INODE_BITMAP (2133571367L) #define EXT2_ET_NO_BLOCK_BITMAP (2133571368L) #define EXT2_ET_BAD_INODE_NUM (2133571369L) #define EXT2_ET_BAD_BLOCK_NUM (2133571370L) #define EXT2_ET_EXPAND_DIR_ERR (2133571371L) #define EXT2_ET_TOOSMALL (2133571372L) #define EXT2_ET_BAD_BLOCK_MARK (2133571373L) #define EXT2_ET_BAD_BLOCK_UNMARK (2133571374L) #define EXT2_ET_BAD_BLOCK_TEST (2133571375L) #define EXT2_ET_BAD_INODE_MARK (2133571376L) #define EXT2_ET_BAD_INODE_UNMARK (2133571377L) #define EXT2_ET_BAD_INODE_TEST (2133571378L) #define EXT2_ET_FUDGE_BLOCK_BITMAP_END (2133571379L) #define EXT2_ET_FUDGE_INODE_BITMAP_END (2133571380L) #define EXT2_ET_BAD_IND_BLOCK (2133571381L) #define EXT2_ET_BAD_DIND_BLOCK (2133571382L) #define EXT2_ET_BAD_TIND_BLOCK (2133571383L) #define EXT2_ET_NEQ_BLOCK_BITMAP (2133571384L) #define EXT2_ET_NEQ_INODE_BITMAP (2133571385L) #define EXT2_ET_BAD_DEVICE_NAME (2133571386L) #define EXT2_ET_MISSING_INODE_TABLE (2133571387L) #define EXT2_ET_CORRUPT_SUPERBLOCK (2133571388L) #define EXT2_ET_BAD_GENERIC_MARK (2133571389L) #define EXT2_ET_BAD_GENERIC_UNMARK (2133571390L) #define EXT2_ET_BAD_GENERIC_TEST (2133571391L) #define EXT2_ET_SYMLINK_LOOP (2133571392L) #define EXT2_ET_CALLBACK_NOTHANDLED (2133571393L) #define EXT2_ET_BAD_BLOCK_IN_INODE_TABLE (2133571394L) #define EXT2_ET_UNSUPP_FEATURE (2133571395L) #define EXT2_ET_RO_UNSUPP_FEATURE (2133571396L) #define EXT2_ET_LLSEEK_FAILED (2133571397L) #define EXT2_ET_NO_MEMORY (2133571398L) #define EXT2_ET_INVALID_ARGUMENT (2133571399L) #define EXT2_ET_BLOCK_ALLOC_FAIL (2133571400L) #define EXT2_ET_INODE_ALLOC_FAIL (2133571401L) #define EXT2_ET_NO_DIRECTORY (2133571402L) #define EXT2_ET_TOO_MANY_REFS (2133571403L) #define EXT2_ET_FILE_NOT_FOUND (2133571404L) #define EXT2_ET_FILE_RO (2133571405L) #define EXT2_ET_DB_NOT_FOUND (2133571406L) #define EXT2_ET_DIR_EXISTS (2133571407L) #define EXT2_ET_UNIMPLEMENTED (2133571408L) #define EXT2_ET_CANCEL_REQUESTED (2133571409L) #define EXT2_ET_FILE_TOO_BIG (2133571410L) #define EXT2_ET_JOURNAL_NOT_BLOCK (2133571411L) #define EXT2_ET_NO_JOURNAL_SB (2133571412L) #define EXT2_ET_JOURNAL_TOO_SMALL (2133571413L) #define EXT2_ET_JOURNAL_UNSUPP_VERSION (2133571414L) #define EXT2_ET_LOAD_EXT_JOURNAL (2133571415L) #define EXT2_ET_NO_JOURNAL (2133571416L) #define EXT2_ET_DIRHASH_UNSUPP (2133571417L) #define EXT2_ET_BAD_EA_BLOCK_NUM (2133571418L) #define EXT2_ET_TOO_MANY_INODES (2133571419L) #define EXT2_ET_NOT_IMAGE_FILE (2133571420L) #define EXT2_ET_RES_GDT_BLOCKS (2133571421L) #define EXT2_ET_RESIZE_INODE_CORRUPT (2133571422L) #define EXT2_ET_SET_BMAP_NO_IND (2133571423L) #define EXT2_ET_TDB_SUCCESS (2133571424L) #define EXT2_ET_TDB_ERR_CORRUPT (2133571425L) #define EXT2_ET_TDB_ERR_IO (2133571426L) #define EXT2_ET_TDB_ERR_LOCK (2133571427L) #define EXT2_ET_TDB_ERR_OOM (2133571428L) #define EXT2_ET_TDB_ERR_EXISTS (2133571429L) #define EXT2_ET_TDB_ERR_NOLOCK (2133571430L) #define EXT2_ET_TDB_ERR_EINVAL (2133571431L) #define EXT2_ET_TDB_ERR_NOEXIST (2133571432L) #define EXT2_ET_TDB_ERR_RDONLY (2133571433L) #define EXT2_ET_DBLIST_EMPTY (2133571434L) #define EXT2_ET_RO_BLOCK_ITERATE (2133571435L) #define EXT2_ET_MAGIC_EXTENT_PATH (2133571436L) #define EXT2_ET_MAGIC_GENERIC_BITMAP64 (2133571437L) #define EXT2_ET_MAGIC_BLOCK_BITMAP64 (2133571438L) #define EXT2_ET_MAGIC_INODE_BITMAP64 (2133571439L) #define EXT2_ET_MAGIC_RESERVED_13 (2133571440L) #define EXT2_ET_MAGIC_RESERVED_14 (2133571441L) #define EXT2_ET_MAGIC_RESERVED_15 (2133571442L) #define EXT2_ET_MAGIC_RESERVED_16 (2133571443L) #define EXT2_ET_MAGIC_RESERVED_17 (2133571444L) #define EXT2_ET_MAGIC_RESERVED_18 (2133571445L) #define EXT2_ET_MAGIC_RESERVED_19 (2133571446L) #define EXT2_ET_EXTENT_HEADER_BAD (2133571447L) #define EXT2_ET_EXTENT_INDEX_BAD (2133571448L) #define EXT2_ET_EXTENT_LEAF_BAD (2133571449L) #define EXT2_ET_EXTENT_NO_SPACE (2133571450L) #define EXT2_ET_INODE_NOT_EXTENT (2133571451L) #define EXT2_ET_EXTENT_NO_NEXT (2133571452L) #define EXT2_ET_EXTENT_NO_PREV (2133571453L) #define EXT2_ET_EXTENT_NO_UP (2133571454L) #define EXT2_ET_EXTENT_NO_DOWN (2133571455L) #define EXT2_ET_NO_CURRENT_NODE (2133571456L) #define EXT2_ET_OP_NOT_SUPPORTED (2133571457L) #define EXT2_ET_CANT_INSERT_EXTENT (2133571458L) #define EXT2_ET_CANT_SPLIT_EXTENT (2133571459L) #define EXT2_ET_EXTENT_NOT_FOUND (2133571460L) #define EXT2_ET_EXTENT_NOT_SUPPORTED (2133571461L) #define EXT2_ET_EXTENT_INVALID_LENGTH (2133571462L) #define EXT2_ET_IO_CHANNEL_NO_SUPPORT_64 (2133571463L) #define EXT2_ET_NO_MTAB_FILE (2133571464L) #define EXT2_ET_CANT_USE_LEGACY_BITMAPS (2133571465L) #define EXT2_ET_MMP_MAGIC_INVALID (2133571466L) #define EXT2_ET_MMP_FAILED (2133571467L) #define EXT2_ET_MMP_FSCK_ON (2133571468L) #define EXT2_ET_MMP_BAD_BLOCK (2133571469L) #define EXT2_ET_MMP_UNKNOWN_SEQ (2133571470L) #define EXT2_ET_MMP_CHANGE_ABORT (2133571471L) #define EXT2_ET_MMP_OPEN_DIRECT (2133571472L) #define EXT2_ET_BAD_DESC_SIZE (2133571473L) #define EXT2_ET_INODE_CSUM_INVALID (2133571474L) #define EXT2_ET_INODE_BITMAP_CSUM_INVALID (2133571475L) #define EXT2_ET_EXTENT_CSUM_INVALID (2133571476L) #define EXT2_ET_DIR_NO_SPACE_FOR_CSUM (2133571477L) #define EXT2_ET_DIR_CSUM_INVALID (2133571478L) #define EXT2_ET_EXT_ATTR_CSUM_INVALID (2133571479L) #define EXT2_ET_SB_CSUM_INVALID (2133571480L) #define EXT2_ET_UNKNOWN_CSUM (2133571481L) #define EXT2_ET_MMP_CSUM_INVALID (2133571482L) #define EXT2_ET_FILE_EXISTS (2133571483L) extern const struct error_table et_ext2_error_table; extern void initialize_ext2_error_table(void); /* For compatibility with Heimdal */ extern void initialize_ext2_error_table_r(struct et_list **list); #define ERROR_TABLE_BASE_ext2 (2133571328L) /* for compatibility with older versions... */ #define init_ext2_err_tbl initialize_ext2_error_table #define ext2_err_base ERROR_TABLE_BASE_ext2 ext2fs/ext2_fs.h000064400000076322147631660260007527 0ustar00/* * linux/include/linux/ext2_fs.h * * Copyright (C) 1992, 1993, 1994, 1995 * Remy Card (card@masi.ibp.fr) * Laboratoire MASI - Institut Blaise Pascal * Universite Pierre et Marie Curie (Paris VI) * * from * * linux/include/linux/minix_fs.h * * Copyright (C) 1991, 1992 Linus Torvalds */ #ifndef _LINUX_EXT2_FS_H #define _LINUX_EXT2_FS_H #include /* Changed from linux/types.h */ /* * The second extended filesystem constants/structures */ /* * Define EXT2FS_DEBUG to produce debug messages */ #undef EXT2FS_DEBUG /* * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files */ #define EXT2_PREALLOCATE #define EXT2_DEFAULT_PREALLOC_BLOCKS 8 /* * The second extended file system version */ #define EXT2FS_DATE "95/08/09" #define EXT2FS_VERSION "0.5b" /* * Special inode numbers */ #define EXT2_BAD_INO 1 /* Bad blocks inode */ #define EXT2_ROOT_INO 2 /* Root inode */ #define EXT4_USR_QUOTA_INO 3 /* User quota inode */ #define EXT4_GRP_QUOTA_INO 4 /* Group quota inode */ #define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */ #define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */ #define EXT2_RESIZE_INO 7 /* Reserved group descriptors inode */ #define EXT2_JOURNAL_INO 8 /* Journal inode */ #define EXT2_EXCLUDE_INO 9 /* The "exclude" inode, for snapshots */ #define EXT4_REPLICA_INO 10 /* Used by non-upstream feature */ /* First non-reserved inode for old ext2 filesystems */ #define EXT2_GOOD_OLD_FIRST_INO 11 /* * The second extended file system magic number */ #define EXT2_SUPER_MAGIC 0xEF53 #ifdef __KERNEL__ #define EXT2_SB(sb) (&((sb)->u.ext2_sb)) #else /* Assume that user mode programs are passing in an ext2fs superblock, not * a kernel struct super_block. This will allow us to call the feature-test * macros from user land. */ #define EXT2_SB(sb) (sb) #endif /* * Maximal count of links to a file */ #define EXT2_LINK_MAX 65000 /* * Macro-instructions used to manage several block sizes */ #define EXT2_MIN_BLOCK_LOG_SIZE 10 /* 1024 */ #define EXT2_MAX_BLOCK_LOG_SIZE 16 /* 65536 */ #define EXT2_MIN_BLOCK_SIZE (1 << EXT2_MIN_BLOCK_LOG_SIZE) #define EXT2_MAX_BLOCK_SIZE (1 << EXT2_MAX_BLOCK_LOG_SIZE) #ifdef __KERNEL__ #define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize) #define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits) #define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->addr_per_block_bits) #define EXT2_INODE_SIZE(s) (EXT2_SB(s)->s_inode_size) #define EXT2_FIRST_INO(s) (EXT2_SB(s)->s_first_ino) #else #define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size) #define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) #define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ EXT2_GOOD_OLD_INODE_SIZE : (s)->s_inode_size) #define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ EXT2_GOOD_OLD_FIRST_INO : (s)->s_first_ino) #endif #define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof(__u32)) /* * Macro-instructions used to manage allocation clusters */ #define EXT2_MIN_CLUSTER_LOG_SIZE EXT2_MIN_BLOCK_LOG_SIZE #define EXT2_MAX_CLUSTER_LOG_SIZE 29 /* 512MB */ #define EXT2_MIN_CLUSTER_SIZE EXT2_MIN_BLOCK_SIZE #define EXT2_MAX_CLUSTER_SIZE (1 << EXT2_MAX_CLUSTER_LOG_SIZE) #define EXT2_CLUSTER_SIZE(s) (EXT2_MIN_BLOCK_SIZE << \ (s)->s_log_cluster_size) #define EXT2_CLUSTER_SIZE_BITS(s) ((s)->s_log_cluster_size + 10) /* * Macro-instructions used to manage fragments * * Note: for backwards compatibility only, for the dump program. * Ext2/3/4 will never support fragments.... */ #define EXT2_MIN_FRAG_SIZE EXT2_MIN_BLOCK_SIZE #define EXT2_MAX_FRAG_SIZE EXT2_MAX_BLOCK_SIZE #define EXT2_MIN_FRAG_LOG_SIZE EXT2_MIN_BLOCK_LOG_SIZE #define EXT2_FRAG_SIZE(s) EXT2_BLOCK_SIZE(s) #define EXT2_FRAGS_PER_BLOCK(s) 1 /* * ACL structures */ struct ext2_acl_header /* Header of Access Control Lists */ { __u32 aclh_size; __u32 aclh_file_count; __u32 aclh_acle_count; __u32 aclh_first_acle; }; struct ext2_acl_entry /* Access Control List Entry */ { __u32 acle_size; __u16 acle_perms; /* Access permissions */ __u16 acle_type; /* Type of entry */ __u16 acle_tag; /* User or group identity */ __u16 acle_pad1; __u32 acle_next; /* Pointer on next entry for the */ /* same inode or on next free entry */ }; /* * Structure of a blocks group descriptor */ struct ext2_group_desc { __u32 bg_block_bitmap; /* Blocks bitmap block */ __u32 bg_inode_bitmap; /* Inodes bitmap block */ __u32 bg_inode_table; /* Inodes table block */ __u16 bg_free_blocks_count; /* Free blocks count */ __u16 bg_free_inodes_count; /* Free inodes count */ __u16 bg_used_dirs_count; /* Directories count */ __u16 bg_flags; __u32 bg_exclude_bitmap_lo; /* Exclude bitmap for snapshots */ __u16 bg_block_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */ __u16 bg_inode_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */ __u16 bg_itable_unused; /* Unused inodes count */ __u16 bg_checksum; /* crc16(s_uuid+group_num+group_desc)*/ }; /* * Structure of a blocks group descriptor */ struct ext4_group_desc { __u32 bg_block_bitmap; /* Blocks bitmap block */ __u32 bg_inode_bitmap; /* Inodes bitmap block */ __u32 bg_inode_table; /* Inodes table block */ __u16 bg_free_blocks_count; /* Free blocks count */ __u16 bg_free_inodes_count; /* Free inodes count */ __u16 bg_used_dirs_count; /* Directories count */ __u16 bg_flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */ __u32 bg_exclude_bitmap_lo; /* Exclude bitmap for snapshots */ __u16 bg_block_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */ __u16 bg_inode_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */ __u16 bg_itable_unused; /* Unused inodes count */ __u16 bg_checksum; /* crc16(sb_uuid+group+desc) */ __u32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */ __u32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */ __u32 bg_inode_table_hi; /* Inodes table block MSB */ __u16 bg_free_blocks_count_hi;/* Free blocks count MSB */ __u16 bg_free_inodes_count_hi;/* Free inodes count MSB */ __u16 bg_used_dirs_count_hi; /* Directories count MSB */ __u16 bg_itable_unused_hi; /* Unused inodes count MSB */ __u32 bg_exclude_bitmap_hi; /* Exclude bitmap block MSB */ __u16 bg_block_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+bitmap) MSB */ __u16 bg_inode_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+bitmap) MSB */ __u32 bg_reserved; }; #define EXT2_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not initialized */ #define EXT2_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not initialized */ #define EXT2_BG_INODE_ZEROED 0x0004 /* On-disk itable initialized to zero */ /* * Data structures used by the directory indexing feature * * Note: all of the multibyte integer fields are little endian. */ /* * Note: dx_root_info is laid out so that if it should somehow get * overlaid by a dirent the two low bits of the hash version will be * zero. Therefore, the hash version mod 4 should never be 0. * Sincerely, the paranoia department. */ struct ext2_dx_root_info { __u32 reserved_zero; __u8 hash_version; /* 0 now, 1 at release */ __u8 info_length; /* 8 */ __u8 indirect_levels; __u8 unused_flags; }; #define EXT2_HASH_LEGACY 0 #define EXT2_HASH_HALF_MD4 1 #define EXT2_HASH_TEA 2 #define EXT2_HASH_LEGACY_UNSIGNED 3 /* reserved for userspace lib */ #define EXT2_HASH_HALF_MD4_UNSIGNED 4 /* reserved for userspace lib */ #define EXT2_HASH_TEA_UNSIGNED 5 /* reserved for userspace lib */ #define EXT2_HASH_FLAG_INCOMPAT 0x1 struct ext2_dx_entry { __u32 hash; __u32 block; }; struct ext2_dx_countlimit { __u16 limit; __u16 count; }; /* * Macro-instructions used to manage group descriptors */ #define EXT2_MIN_DESC_SIZE 32 #define EXT2_MIN_DESC_SIZE_64BIT 64 #define EXT2_MAX_DESC_SIZE EXT2_MIN_BLOCK_SIZE #define EXT2_DESC_SIZE(s) \ ((EXT2_SB(s)->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) ? \ (s)->s_desc_size : EXT2_MIN_DESC_SIZE) #define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->s_blocks_per_group) #define EXT2_INODES_PER_GROUP(s) (EXT2_SB(s)->s_inodes_per_group) #define EXT2_CLUSTERS_PER_GROUP(s) (EXT2_SB(s)->s_clusters_per_group) #define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s)) /* limits imposed by 16-bit value gd_free_{blocks,inode}_count */ #define EXT2_MAX_BLOCKS_PER_GROUP(s) ((((unsigned) 1 << 16) - 8) * \ (EXT2_CLUSTER_SIZE(s) / \ EXT2_BLOCK_SIZE(s))) #define EXT2_MAX_CLUSTERS_PER_GROUP(s) (((unsigned) 1 << 16) - 8) #define EXT2_MAX_INODES_PER_GROUP(s) (((unsigned) 1 << 16) - \ EXT2_INODES_PER_BLOCK(s)) #ifdef __KERNEL__ #define EXT2_DESC_PER_BLOCK(s) (EXT2_SB(s)->s_desc_per_block) #define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits) #else #define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_DESC_SIZE(s)) #endif #define EXT2_GROUPS_TO_BLOCKS(s, g) ((blk64_t) EXT2_BLOCKS_PER_GROUP(s) * \ (g)) #define EXT2_GROUPS_TO_CLUSTERS(s, g) ((blk64_t) EXT2_CLUSTERS_PER_GROUP(s) * \ (g)) /* * Constants relative to the data blocks */ #define EXT2_NDIR_BLOCKS 12 #define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS #define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1) #define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1) #define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1) /* * Inode flags */ #define EXT2_SECRM_FL 0x00000001 /* Secure deletion */ #define EXT2_UNRM_FL 0x00000002 /* Undelete */ #define EXT2_COMPR_FL 0x00000004 /* Compress file */ #define EXT2_SYNC_FL 0x00000008 /* Synchronous updates */ #define EXT2_IMMUTABLE_FL 0x00000010 /* Immutable file */ #define EXT2_APPEND_FL 0x00000020 /* writes to file may only append */ #define EXT2_NODUMP_FL 0x00000040 /* do not dump file */ #define EXT2_NOATIME_FL 0x00000080 /* do not update atime */ /* Reserved for compression usage... */ #define EXT2_DIRTY_FL 0x00000100 #define EXT2_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */ #define EXT2_NOCOMPR_FL 0x00000400 /* Access raw compressed data */ #define EXT2_ECOMPR_FL 0x00000800 /* Compression error */ /* End compression flags --- maybe not all used */ #define EXT2_BTREE_FL 0x00001000 /* btree format dir */ #define EXT2_INDEX_FL 0x00001000 /* hash-indexed directory */ #define EXT2_IMAGIC_FL 0x00002000 #define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */ #define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */ #define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */ #define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ #define EXT4_HUGE_FILE_FL 0x00040000 /* Set to each huge file */ #define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */ #define EXT4_EA_INODE_FL 0x00200000 /* Inode used for large EA */ /* EXT4_EOFBLOCKS_FL 0x00400000 was here */ #define FS_NOCOW_FL 0x00800000 /* Do not cow file */ #define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */ #define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */ #define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */ #define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ #define EXT2_FL_USER_VISIBLE 0x004BDFFF /* User visible flags */ #define EXT2_FL_USER_MODIFIABLE 0x004B80FF /* User modifiable flags */ /* * ioctl commands */ /* Used for online resize */ struct ext2_new_group_input { __u32 group; /* Group number for this data */ __u32 block_bitmap; /* Absolute block number of block bitmap */ __u32 inode_bitmap; /* Absolute block number of inode bitmap */ __u32 inode_table; /* Absolute block number of inode table start */ __u32 blocks_count; /* Total number of blocks in this group */ __u16 reserved_blocks; /* Number of reserved blocks in this group */ __u16 unused; /* Number of reserved GDT blocks in group */ }; struct ext4_new_group_input { __u32 group; /* Group number for this data */ __u64 block_bitmap; /* Absolute block number of block bitmap */ __u64 inode_bitmap; /* Absolute block number of inode bitmap */ __u64 inode_table; /* Absolute block number of inode table start */ __u32 blocks_count; /* Total number of blocks in this group */ __u16 reserved_blocks; /* Number of reserved blocks in this group */ __u16 unused; }; #ifdef __GNU__ /* Needed for the Hurd */ #define _IOT_ext2_new_group_input _IOT (_IOTS(__u32), 5, _IOTS(__u16), 2, 0, 0) #endif #define EXT2_IOC_GETFLAGS _IOR('f', 1, long) #define EXT2_IOC_SETFLAGS _IOW('f', 2, long) #define EXT2_IOC_GETVERSION _IOR('v', 1, long) #define EXT2_IOC_SETVERSION _IOW('v', 2, long) #define EXT2_IOC_GETVERSION_NEW _IOR('f', 3, long) #define EXT2_IOC_SETVERSION_NEW _IOW('f', 4, long) #define EXT2_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long) #define EXT2_IOC_GROUP_ADD _IOW('f', 8,struct ext2_new_group_input) #define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input) #define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64) /* * Structure of an inode on the disk */ struct ext2_inode { __u16 i_mode; /* File mode */ __u16 i_uid; /* Low 16 bits of Owner Uid */ __u32 i_size; /* Size in bytes */ __u32 i_atime; /* Access time */ __u32 i_ctime; /* Inode change time */ __u32 i_mtime; /* Modification time */ __u32 i_dtime; /* Deletion Time */ __u16 i_gid; /* Low 16 bits of Group Id */ __u16 i_links_count; /* Links count */ __u32 i_blocks; /* Blocks count */ __u32 i_flags; /* File flags */ union { struct { __u32 l_i_version; /* was l_i_reserved1 */ } linux1; struct { __u32 h_i_translator; } hurd1; } osd1; /* OS dependent 1 */ __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */ __u32 i_generation; /* File version (for NFS) */ __u32 i_file_acl; /* File ACL */ __u32 i_size_high; /* Formerly i_dir_acl, directory ACL */ __u32 i_faddr; /* Fragment address */ union { struct { __u16 l_i_blocks_hi; __u16 l_i_file_acl_high; __u16 l_i_uid_high; /* these 2 fields */ __u16 l_i_gid_high; /* were reserved2[0] */ __u16 l_i_checksum_lo; /* crc32c(uuid+inum+inode) */ __u16 l_i_reserved; } linux2; struct { __u8 h_i_frag; /* Fragment number */ __u8 h_i_fsize; /* Fragment size */ __u16 h_i_mode_high; __u16 h_i_uid_high; __u16 h_i_gid_high; __u32 h_i_author; } hurd2; } osd2; /* OS dependent 2 */ }; /* * Permanent part of an large inode on the disk */ struct ext2_inode_large { __u16 i_mode; /* File mode */ __u16 i_uid; /* Low 16 bits of Owner Uid */ __u32 i_size; /* Size in bytes */ __u32 i_atime; /* Access time */ __u32 i_ctime; /* Inode Change time */ __u32 i_mtime; /* Modification time */ __u32 i_dtime; /* Deletion Time */ __u16 i_gid; /* Low 16 bits of Group Id */ __u16 i_links_count; /* Links count */ __u32 i_blocks; /* Blocks count */ __u32 i_flags; /* File flags */ union { struct { __u32 l_i_version; /* was l_i_reserved1 */ } linux1; struct { __u32 h_i_translator; } hurd1; } osd1; /* OS dependent 1 */ __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */ __u32 i_generation; /* File version (for NFS) */ __u32 i_file_acl; /* File ACL */ __u32 i_size_high; /* Formerly i_dir_acl, directory ACL */ __u32 i_faddr; /* Fragment address */ union { struct { __u16 l_i_blocks_hi; __u16 l_i_file_acl_high; __u16 l_i_uid_high; /* these 2 fields */ __u16 l_i_gid_high; /* were reserved2[0] */ __u16 l_i_checksum_lo; /* crc32c(uuid+inum+inode) */ __u16 l_i_reserved; } linux2; struct { __u8 h_i_frag; /* Fragment number */ __u8 h_i_fsize; /* Fragment size */ __u16 h_i_mode_high; __u16 h_i_uid_high; __u16 h_i_gid_high; __u32 h_i_author; } hurd2; } osd2; /* OS dependent 2 */ __u16 i_extra_isize; __u16 i_checksum_hi; /* crc32c(uuid+inum+inode) */ __u32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */ __u32 i_mtime_extra; /* extra Modification time (nsec << 2 | epoch) */ __u32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */ __u32 i_crtime; /* File creation time */ __u32 i_crtime_extra; /* extra File creation time (nsec << 2 | epoch)*/ __u32 i_version_hi; /* high 32 bits for 64-bit version */ }; #define i_dir_acl i_size_high #if defined(__KERNEL__) || defined(__linux__) #define i_reserved1 osd1.linux1.l_i_reserved1 #define i_frag osd2.linux2.l_i_frag #define i_fsize osd2.linux2.l_i_fsize #define i_uid_low i_uid #define i_gid_low i_gid #define i_uid_high osd2.linux2.l_i_uid_high #define i_gid_high osd2.linux2.l_i_gid_high #else #if defined(__GNU__) #define i_translator osd1.hurd1.h_i_translator #define i_frag osd2.hurd2.h_i_frag; #define i_fsize osd2.hurd2.h_i_fsize; #define i_uid_high osd2.hurd2.h_i_uid_high #define i_gid_high osd2.hurd2.h_i_gid_high #define i_author osd2.hurd2.h_i_author #endif /* __GNU__ */ #endif /* defined(__KERNEL__) || defined(__linux__) */ #define inode_uid(inode) ((inode).i_uid | (inode).osd2.linux2.l_i_uid_high << 16) #define inode_gid(inode) ((inode).i_gid | (inode).osd2.linux2.l_i_gid_high << 16) #define ext2fs_set_i_uid_high(inode,x) ((inode).osd2.linux2.l_i_uid_high = (x)) #define ext2fs_set_i_gid_high(inode,x) ((inode).osd2.linux2.l_i_gid_high = (x)) /* * File system states */ #define EXT2_VALID_FS 0x0001 /* Unmounted cleanly */ #define EXT2_ERROR_FS 0x0002 /* Errors detected */ #define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */ /* * Misc. filesystem flags */ #define EXT2_FLAGS_SIGNED_HASH 0x0001 /* Signed dirhash in use */ #define EXT2_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use */ #define EXT2_FLAGS_TEST_FILESYS 0x0004 /* OK for use on development code */ #define EXT2_FLAGS_IS_SNAPSHOT 0x0010 /* This is a snapshot image */ #define EXT2_FLAGS_FIX_SNAPSHOT 0x0020 /* Snapshot inodes corrupted */ #define EXT2_FLAGS_FIX_EXCLUDE 0x0040 /* Exclude bitmaps corrupted */ /* * Mount flags */ #define EXT2_MOUNT_CHECK 0x0001 /* Do mount-time checks */ #define EXT2_MOUNT_GRPID 0x0004 /* Create files with directory's group */ #define EXT2_MOUNT_DEBUG 0x0008 /* Some debugging messages */ #define EXT2_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */ #define EXT2_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */ #define EXT2_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */ #define EXT2_MOUNT_MINIX_DF 0x0080 /* Mimics the Minix statfs */ #define EXT2_MOUNT_NO_UID32 0x0200 /* Disable 32-bit UIDs */ #define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt #define set_opt(o, opt) o |= EXT2_MOUNT_##opt #define test_opt(sb, opt) (EXT2_SB(sb)->s_mount_opt & \ EXT2_MOUNT_##opt) /* * Maximal mount counts between two filesystem checks */ #define EXT2_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */ #define EXT2_DFL_CHECKINTERVAL 0 /* Don't use interval check */ /* * Behaviour when detecting errors */ #define EXT2_ERRORS_CONTINUE 1 /* Continue execution */ #define EXT2_ERRORS_RO 2 /* Remount fs read-only */ #define EXT2_ERRORS_PANIC 3 /* Panic */ #define EXT2_ERRORS_DEFAULT EXT2_ERRORS_CONTINUE #if (__GNUC__ >= 4) #define ext4_offsetof(TYPE,MEMBER) __builtin_offsetof(TYPE,MEMBER) #else #define ext4_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #endif /* * Structure of the super block */ struct ext2_super_block { __u32 s_inodes_count; /* Inodes count */ __u32 s_blocks_count; /* Blocks count */ __u32 s_r_blocks_count; /* Reserved blocks count */ __u32 s_free_blocks_count; /* Free blocks count */ __u32 s_free_inodes_count; /* Free inodes count */ __u32 s_first_data_block; /* First Data Block */ __u32 s_log_block_size; /* Block size */ __u32 s_log_cluster_size; /* Allocation cluster size */ __u32 s_blocks_per_group; /* # Blocks per group */ __u32 s_clusters_per_group; /* # Fragments per group */ __u32 s_inodes_per_group; /* # Inodes per group */ __u32 s_mtime; /* Mount time */ __u32 s_wtime; /* Write time */ __u16 s_mnt_count; /* Mount count */ __s16 s_max_mnt_count; /* Maximal mount count */ __u16 s_magic; /* Magic signature */ __u16 s_state; /* File system state */ __u16 s_errors; /* Behaviour when detecting errors */ __u16 s_minor_rev_level; /* minor revision level */ __u32 s_lastcheck; /* time of last check */ __u32 s_checkinterval; /* max. time between checks */ __u32 s_creator_os; /* OS */ __u32 s_rev_level; /* Revision level */ __u16 s_def_resuid; /* Default uid for reserved blocks */ __u16 s_def_resgid; /* Default gid for reserved blocks */ /* * These fields are for EXT2_DYNAMIC_REV superblocks only. * * Note: the difference between the compatible feature set and * the incompatible feature set is that if there is a bit set * in the incompatible feature set that the kernel doesn't * know about, it should refuse to mount the filesystem. * * e2fsck's requirements are more strict; if it doesn't know * about a feature in either the compatible or incompatible * feature set, it must abort and not try to meddle with * things it doesn't understand... */ __u32 s_first_ino; /* First non-reserved inode */ __u16 s_inode_size; /* size of inode structure */ __u16 s_block_group_nr; /* block group # of this superblock */ __u32 s_feature_compat; /* compatible feature set */ __u32 s_feature_incompat; /* incompatible feature set */ __u32 s_feature_ro_compat; /* readonly-compatible feature set */ __u8 s_uuid[16]; /* 128-bit uuid for volume */ char s_volume_name[16]; /* volume name */ char s_last_mounted[64]; /* directory where last mounted */ __u32 s_algorithm_usage_bitmap; /* For compression */ /* * Performance hints. Directory preallocation should only * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on. */ __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ __u16 s_reserved_gdt_blocks; /* Per group table for online growth */ /* * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set. */ __u8 s_journal_uuid[16]; /* uuid of journal superblock */ __u32 s_journal_inum; /* inode number of journal file */ __u32 s_journal_dev; /* device number of journal file */ __u32 s_last_orphan; /* start of list of inodes to delete */ __u32 s_hash_seed[4]; /* HTREE hash seed */ __u8 s_def_hash_version; /* Default hash version to use */ __u8 s_jnl_backup_type; /* Default type of journal backup */ __u16 s_desc_size; /* Group desc. size: INCOMPAT_64BIT */ __u32 s_default_mount_opts; __u32 s_first_meta_bg; /* First metablock group */ __u32 s_mkfs_time; /* When the filesystem was created */ __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ __u32 s_blocks_count_hi; /* Blocks count high 32bits */ __u32 s_r_blocks_count_hi; /* Reserved blocks count high 32 bits*/ __u32 s_free_blocks_hi; /* Free blocks count */ __u16 s_min_extra_isize; /* All inodes have at least # bytes */ __u16 s_want_extra_isize; /* New inodes should reserve # bytes */ __u32 s_flags; /* Miscellaneous flags */ __u16 s_raid_stride; /* RAID stride */ __u16 s_mmp_update_interval; /* # seconds to wait in MMP checking */ __u64 s_mmp_block; /* Block for multi-mount protection */ __u32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/ __u8 s_log_groups_per_flex; /* FLEX_BG group size */ __u8 s_reserved_char_pad; __u16 s_reserved_pad; /* Padding to next 32bits */ __u64 s_kbytes_written; /* nr of lifetime kilobytes written */ __u32 s_snapshot_inum; /* Inode number of active snapshot */ __u32 s_snapshot_id; /* sequential ID of active snapshot */ __u64 s_snapshot_r_blocks_count; /* reserved blocks for active snapshot's future use */ __u32 s_snapshot_list; /* inode number of the head of the on-disk snapshot list */ #define EXT4_S_ERR_START ext4_offsetof(struct ext2_super_block, s_error_count) __u32 s_error_count; /* number of fs errors */ __u32 s_first_error_time; /* first time an error happened */ __u32 s_first_error_ino; /* inode involved in first error */ __u64 s_first_error_block; /* block involved of first error */ __u8 s_first_error_func[32]; /* function where the error happened */ __u32 s_first_error_line; /* line number where error happened */ __u32 s_last_error_time; /* most recent time of an error */ __u32 s_last_error_ino; /* inode involved in last error */ __u32 s_last_error_line; /* line number where error happened */ __u64 s_last_error_block; /* block involved of last error */ __u8 s_last_error_func[32]; /* function where the error happened */ #define EXT4_S_ERR_END ext4_offsetof(struct ext2_super_block, s_mount_opts) __u8 s_mount_opts[64]; __u32 s_usr_quota_inum; /* inode number of user quota file */ __u32 s_grp_quota_inum; /* inode number of group quota file */ __u32 s_overhead_blocks; /* overhead blocks/clusters in fs */ __u32 s_reserved[108]; /* Padding to the end of the block */ __u32 s_checksum; /* crc32c(superblock) */ }; #define EXT4_S_ERR_LEN (EXT4_S_ERR_END - EXT4_S_ERR_START) /* * Codes for operating systems */ #define EXT2_OS_LINUX 0 #define EXT2_OS_HURD 1 #define EXT2_OBSO_OS_MASIX 2 #define EXT2_OS_FREEBSD 3 #define EXT2_OS_LITES 4 /* * Revision levels */ #define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */ #define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */ #define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV #define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV #define EXT2_GOOD_OLD_INODE_SIZE 128 /* * Journal inode backup types */ #define EXT3_JNL_BACKUP_BLOCKS 1 /* * Feature set definitions */ #define EXT2_HAS_COMPAT_FEATURE(sb,mask) \ ( EXT2_SB(sb)->s_feature_compat & (mask) ) #define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \ ( EXT2_SB(sb)->s_feature_ro_compat & (mask) ) #define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \ ( EXT2_SB(sb)->s_feature_incompat & (mask) ) #define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001 #define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002 #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 #define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008 #define EXT2_FEATURE_COMPAT_RESIZE_INODE 0x0010 #define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020 #define EXT2_FEATURE_COMPAT_LAZY_BG 0x0040 /* #define EXT2_FEATURE_COMPAT_EXCLUDE_INODE 0x0080 not used, legacy */ #define EXT2_FEATURE_COMPAT_EXCLUDE_BITMAP 0x0100 #define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 #define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 /* #define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 not used */ #define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008 #define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010 #define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020 #define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040 #define EXT4_FEATURE_RO_COMPAT_HAS_SNAPSHOT 0x0080 #define EXT4_FEATURE_RO_COMPAT_QUOTA 0x0100 #define EXT4_FEATURE_RO_COMPAT_BIGALLOC 0x0200 #define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400 #define EXT4_FEATURE_RO_COMPAT_REPLICA 0x0800 #define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001 #define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002 #define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */ #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */ #define EXT2_FEATURE_INCOMPAT_META_BG 0x0010 #define EXT3_FEATURE_INCOMPAT_EXTENTS 0x0040 #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 #define EXT4_FEATURE_INCOMPAT_MMP 0x0100 #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 #define EXT4_FEATURE_INCOMPAT_EA_INODE 0x0400 #define EXT4_FEATURE_INCOMPAT_DIRDATA 0x1000 /* 0x2000 was EXT4_FEATURE_INCOMPAT_BG_USE_META_CSUM but this was never used */ #define EXT4_FEATURE_INCOMPAT_LARGEDIR 0x4000 /* >2GB or 3-lvl htree */ #define EXT4_FEATURE_INCOMPAT_INLINEDATA 0x8000 /* data in inode */ #define EXT2_FEATURE_COMPAT_SUPP 0 #define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \ EXT4_FEATURE_INCOMPAT_MMP) #define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \ EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \ EXT4_FEATURE_RO_COMPAT_DIR_NLINK| \ EXT2_FEATURE_RO_COMPAT_BTREE_DIR) /* * Default values for user and/or group using reserved blocks */ #define EXT2_DEF_RESUID 0 #define EXT2_DEF_RESGID 0 /* * Default mount options */ #define EXT2_DEFM_DEBUG 0x0001 #define EXT2_DEFM_BSDGROUPS 0x0002 #define EXT2_DEFM_XATTR_USER 0x0004 #define EXT2_DEFM_ACL 0x0008 #define EXT2_DEFM_UID16 0x0010 #define EXT3_DEFM_JMODE 0x0060 #define EXT3_DEFM_JMODE_DATA 0x0020 #define EXT3_DEFM_JMODE_ORDERED 0x0040 #define EXT3_DEFM_JMODE_WBACK 0x0060 #define EXT4_DEFM_NOBARRIER 0x0100 #define EXT4_DEFM_BLOCK_VALIDITY 0x0200 #define EXT4_DEFM_DISCARD 0x0400 #define EXT4_DEFM_NODELALLOC 0x0800 /* * Structure of a directory entry */ #define EXT2_NAME_LEN 255 struct ext2_dir_entry { __u32 inode; /* Inode number */ __u16 rec_len; /* Directory entry length */ __u16 name_len; /* Name length */ char name[EXT2_NAME_LEN]; /* File name */ }; /* * The new version of the directory entry. Since EXT2 structures are * stored in intel byte order, and the name_len field could never be * bigger than 255 chars, it's safe to reclaim the extra byte for the * file_type field. */ struct ext2_dir_entry_2 { __u32 inode; /* Inode number */ __u16 rec_len; /* Directory entry length */ __u8 name_len; /* Name length */ __u8 file_type; char name[EXT2_NAME_LEN]; /* File name */ }; /* * Ext2 directory file types. Only the low 3 bits are used. The * other bits are reserved for now. */ #define EXT2_FT_UNKNOWN 0 #define EXT2_FT_REG_FILE 1 #define EXT2_FT_DIR 2 #define EXT2_FT_CHRDEV 3 #define EXT2_FT_BLKDEV 4 #define EXT2_FT_FIFO 5 #define EXT2_FT_SOCK 6 #define EXT2_FT_SYMLINK 7 #define EXT2_FT_MAX 8 /* * EXT2_DIR_PAD defines the directory entries boundaries * * NOTE: It must be a multiple of 4 */ #define EXT2_DIR_PAD 4 #define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1) #define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \ ~EXT2_DIR_ROUND) /* * This structure is used for multiple mount protection. It is written * into the block number saved in the s_mmp_block field in the superblock. * Programs that check MMP should assume that if SEQ_FSCK (or any unknown * code above SEQ_MAX) is present then it is NOT safe to use the filesystem, * regardless of how old the timestamp is. * * The timestamp in the MMP structure will be updated by e2fsck at some * arbitary intervals (start of passes, after every few groups of inodes * in pass1 and pass1b). There is no guarantee that e2fsck is updating * the MMP block in a timely manner, and the updates it does are purely * for the convenience of the sysadmin and not for automatic validation. * * Note: Only the mmp_seq value is used to determine whether the MMP block * is being updated. The mmp_time, mmp_nodename, and mmp_bdevname * fields are only for informational purposes for the administrator, * due to clock skew between nodes and hostname HA service takeover. */ #define EXT4_MMP_MAGIC 0x004D4D50U /* ASCII for MMP */ #define EXT4_MMP_SEQ_CLEAN 0xFF4D4D50U /* mmp_seq value for clean unmount */ #define EXT4_MMP_SEQ_FSCK 0xE24D4D50U /* mmp_seq value when being fscked */ #define EXT4_MMP_SEQ_MAX 0xE24D4D4FU /* maximum valid mmp_seq value */ struct mmp_struct { __u32 mmp_magic; /* Magic number for MMP */ __u32 mmp_seq; /* Sequence no. updated periodically */ __u64 mmp_time; /* Time last updated */ char mmp_nodename[64]; /* Node which last updated MMP block */ char mmp_bdevname[32]; /* Bdev which last updated MMP block */ __u16 mmp_check_interval; /* Changed mmp_check_interval */ __u16 mmp_pad1; __u32 mmp_pad2[227]; }; /* * Default interval for MMP update in seconds. */ #define EXT4_MMP_UPDATE_INTERVAL 5 /* * Maximum interval for MMP update in seconds. */ #define EXT4_MMP_MAX_UPDATE_INTERVAL 300 /* * Minimum interval for MMP checking in seconds. */ #define EXT4_MMP_MIN_CHECK_INTERVAL 5 #endif /* _LINUX_EXT2_FS_H */ ext2fs/ext2_ext_attr.h000064400000004771147631660260010750 0ustar00/* File: linux/ext2_ext_attr.h On-disk format of extended attributes for the ext2 filesystem. (C) 2000 Andreas Gruenbacher, */ #ifndef _EXT2_EXT_ATTR_H #define _EXT2_EXT_ATTR_H /* Magic value in attribute blocks */ #define EXT2_EXT_ATTR_MAGIC_v1 0xEA010000 #define EXT2_EXT_ATTR_MAGIC 0xEA020000 /* Maximum number of references to one attribute block */ #define EXT2_EXT_ATTR_REFCOUNT_MAX 1024 struct ext2_ext_attr_header { __u32 h_magic; /* magic number for identification */ __u32 h_refcount; /* reference count */ __u32 h_blocks; /* number of disk blocks used */ __u32 h_hash; /* hash value of all attributes */ __u32 h_reserved[4]; /* zero right now */ }; struct ext2_ext_attr_entry { __u8 e_name_len; /* length of name */ __u8 e_name_index; /* attribute name index */ __u16 e_value_offs; /* offset in disk block of value */ __u32 e_value_block; /* disk block attribute is stored on (n/i) */ __u32 e_value_size; /* size of attribute value */ __u32 e_hash; /* hash value of name and value */ #if 0 char e_name[0]; /* attribute name */ #endif }; #define EXT2_EXT_ATTR_PAD_BITS 2 #define EXT2_EXT_ATTR_PAD ((unsigned) 1<e_name_len)) ) #define EXT2_EXT_ATTR_SIZE(size) \ (((size) + EXT2_EXT_ATTR_ROUND) & ~EXT2_EXT_ATTR_ROUND) #define EXT2_EXT_IS_LAST_ENTRY(entry) (*((__u32 *)(entry)) == 0UL) #define EXT2_EXT_ATTR_NAME(entry) \ (((char *) (entry)) + sizeof(struct ext2_ext_attr_entry)) #define EXT2_XATTR_LEN(name_len) \ (((name_len) + EXT2_EXT_ATTR_ROUND + \ sizeof(struct ext2_xattr_entry)) & ~EXT2_EXT_ATTR_ROUND) #define EXT2_XATTR_SIZE(size) \ (((size) + EXT2_EXT_ATTR_ROUND) & ~EXT2_EXT_ATTR_ROUND) #ifdef __KERNEL__ # ifdef CONFIG_EXT2_FS_EXT_ATTR extern int ext2_get_ext_attr(struct inode *, const char *, char *, size_t, int); extern int ext2_set_ext_attr(struct inode *, const char *, char *, size_t, int); extern void ext2_ext_attr_free_inode(struct inode *inode); extern void ext2_ext_attr_put_super(struct super_block *sb); extern int ext2_ext_attr_init(void); extern void ext2_ext_attr_done(void); # else # define ext2_get_ext_attr NULL # define ext2_set_ext_attr NULL # endif #endif /* __KERNEL__ */ #endif /* _EXT2_EXT_ATTR_H */ ext2fs/bitops.h000064400000050054147631660260007447 0ustar00/* * bitops.h --- Bitmap frobbing code. The byte swapping routines are * also included here. * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% * This file may be redistributed under the terms of the GNU Library * General Public License, version 2. * %End-Header% */ #ifdef WORDS_BIGENDIAN #define ext2fs_cpu_to_le64(x) ext2fs_swab64((x)) #define ext2fs_le64_to_cpu(x) ext2fs_swab64((x)) #define ext2fs_cpu_to_le32(x) ext2fs_swab32((x)) #define ext2fs_le32_to_cpu(x) ext2fs_swab32((x)) #define ext2fs_cpu_to_le16(x) ext2fs_swab16((x)) #define ext2fs_le16_to_cpu(x) ext2fs_swab16((x)) #define ext2fs_cpu_to_be64(x) ((__u64)(x)) #define ext2fs_be64_to_cpu(x) ((__u64)(x)) #define ext2fs_cpu_to_be32(x) ((__u32)(x)) #define ext2fs_be32_to_cpu(x) ((__u32)(x)) #define ext2fs_cpu_to_be16(x) ((__u16)(x)) #define ext2fs_be16_to_cpu(x) ((__u16)(x)) #else #define ext2fs_cpu_to_le64(x) ((__u64)(x)) #define ext2fs_le64_to_cpu(x) ((__u64)(x)) #define ext2fs_cpu_to_le32(x) ((__u32)(x)) #define ext2fs_le32_to_cpu(x) ((__u32)(x)) #define ext2fs_cpu_to_le16(x) ((__u16)(x)) #define ext2fs_le16_to_cpu(x) ((__u16)(x)) #define ext2fs_cpu_to_be64(x) ext2fs_swab64((x)) #define ext2fs_be64_to_cpu(x) ext2fs_swab64((x)) #define ext2fs_cpu_to_be32(x) ext2fs_swab32((x)) #define ext2fs_be32_to_cpu(x) ext2fs_swab32((x)) #define ext2fs_cpu_to_be16(x) ext2fs_swab16((x)) #define ext2fs_be16_to_cpu(x) ext2fs_swab16((x)) #endif /* * EXT2FS bitmap manipulation routines. */ /* Support for sending warning messages from the inline subroutines */ extern const char *ext2fs_block_string; extern const char *ext2fs_inode_string; extern const char *ext2fs_mark_string; extern const char *ext2fs_unmark_string; extern const char *ext2fs_test_string; extern void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg, const char *description); extern void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap, int code, unsigned long arg); #ifdef NO_INLINE_FUNCS extern void ext2fs_fast_set_bit(unsigned int nr,void * addr); extern void ext2fs_fast_clear_bit(unsigned int nr, void * addr); extern void ext2fs_fast_set_bit64(__u64 nr,void * addr); extern void ext2fs_fast_clear_bit64(__u64 nr, void * addr); extern __u16 ext2fs_swab16(__u16 val); extern __u32 ext2fs_swab32(__u32 val); extern __u64 ext2fs_swab64(__u64 val); extern int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); extern int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); extern int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); extern int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); extern int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); extern int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); extern void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); extern void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); extern int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); extern void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); extern void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); extern int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); extern blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap); extern ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap); extern blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap); extern ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap); extern void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num); extern void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num); extern int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num); #endif /* These functions routines moved to gen_bitmap.c */ extern void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num); extern void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num); extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num); extern int ext2fs_test_inode_bitmap_range(ext2fs_inode_bitmap bitmap, ino_t inode, int num); extern int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap, __u32 bitno); extern int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap, blk_t bitno); extern int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap, blk_t bitno); extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num); extern void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map); extern __u32 ext2fs_get_generic_bitmap_start(ext2fs_generic_bitmap bitmap); extern __u32 ext2fs_get_generic_bitmap_end(ext2fs_generic_bitmap bitmap); /* 64-bit versions */ #ifdef NO_INLINE_FUNCS extern int ext2fs_mark_block_bitmap2(ext2fs_block_bitmap bitmap, blk64_t block); extern int ext2fs_unmark_block_bitmap2(ext2fs_block_bitmap bitmap, blk64_t block); extern int ext2fs_test_block_bitmap2(ext2fs_block_bitmap bitmap, blk64_t block); extern int ext2fs_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); extern int ext2fs_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); extern int ext2fs_test_inode_bitmap2(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); extern void ext2fs_fast_mark_block_bitmap2(ext2fs_block_bitmap bitmap, blk64_t block); extern void ext2fs_fast_unmark_block_bitmap2(ext2fs_block_bitmap bitmap, blk64_t block); extern int ext2fs_fast_test_block_bitmap2(ext2fs_block_bitmap bitmap, blk64_t block); extern void ext2fs_fast_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); extern void ext2fs_fast_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); extern int ext2fs_fast_test_inode_bitmap2(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); extern errcode_t ext2fs_find_first_zero_block_bitmap2(ext2fs_block_bitmap bitmap, blk64_t start, blk64_t end, blk64_t *out); extern errcode_t ext2fs_find_first_zero_inode_bitmap2(ext2fs_inode_bitmap bitmap, ext2_ino_t start, ext2_ino_t end, ext2_ino_t *out); extern blk64_t ext2fs_get_block_bitmap_start2(ext2fs_block_bitmap bitmap); extern ext2_ino_t ext2fs_get_inode_bitmap_start2(ext2fs_inode_bitmap bitmap); extern blk64_t ext2fs_get_block_bitmap_end2(ext2fs_block_bitmap bitmap); extern ext2_ino_t ext2fs_get_inode_bitmap_end2(ext2fs_inode_bitmap bitmap); extern int ext2fs_fast_test_block_bitmap_range2(ext2fs_block_bitmap bitmap, blk64_t block, unsigned int num); extern void ext2fs_fast_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap, blk64_t block, unsigned int num); extern void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap, blk64_t block, unsigned int num); #endif /* These routines moved to gen_bitmap64.c */ extern void ext2fs_clear_generic_bmap(ext2fs_generic_bitmap bitmap); extern errcode_t ext2fs_compare_generic_bmap(errcode_t neq, ext2fs_generic_bitmap bm1, ext2fs_generic_bitmap bm2); extern void ext2fs_set_generic_bmap_padding(ext2fs_generic_bitmap bmap); extern int ext2fs_mark_generic_bmap(ext2fs_generic_bitmap bitmap, blk64_t bitno); extern int ext2fs_unmark_generic_bmap(ext2fs_generic_bitmap bitmap, blk64_t bitno); extern int ext2fs_test_generic_bmap(ext2fs_generic_bitmap bitmap, blk64_t bitno); extern int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap bitmap, blk64_t block, unsigned int num); extern __u64 ext2fs_get_generic_bmap_start(ext2fs_generic_bitmap bitmap); extern __u64 ext2fs_get_generic_bmap_end(ext2fs_generic_bitmap bitmap); extern int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap bitmap, blk64_t block, unsigned int num); extern void ext2fs_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap, blk64_t block, unsigned int num); extern void ext2fs_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap, blk64_t block, unsigned int num); extern errcode_t ext2fs_find_first_zero_generic_bmap(ext2fs_generic_bitmap bitmap, __u64 start, __u64 end, __u64 *out); /* * The inline routines themselves... * * If NO_INLINE_FUNCS is defined, then we won't try to do inline * functions at all; they will be included as normal functions in * inline.c */ #ifdef NO_INLINE_FUNCS #if (defined(__GNUC__) && (defined(__i386__) || defined(__i486__) || \ defined(__i586__))) /* This prevents bitops.c from trying to include the C */ /* function version of these functions */ #define _EXT2_HAVE_ASM_BITOPS_ #endif #endif /* NO_INLINE_FUNCS */ #if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) #ifdef INCLUDE_INLINE_FUNCS #if (__STDC_VERSION__ >= 199901L) #define _INLINE_ extern inline #else #define _INLINE_ inline #endif #else /* !INCLUDE_INLINE FUNCS */ #if (__STDC_VERSION__ >= 199901L) #define _INLINE_ inline #else /* not C99 */ #ifdef __GNUC__ #define _INLINE_ extern __inline__ #else /* For Watcom C */ #define _INLINE_ extern inline #endif /* __GNUC__ */ #endif /* __STDC_VERSION__ >= 199901L */ #endif /* INCLUDE_INLINE_FUNCS */ /* * Fast bit set/clear functions that doesn't need to return the * previous bit value. */ _INLINE_ void ext2fs_fast_set_bit(unsigned int nr,void * addr) { unsigned char *ADDR = (unsigned char *) addr; ADDR += nr >> 3; *ADDR |= (unsigned char) (1 << (nr & 0x07)); } _INLINE_ void ext2fs_fast_clear_bit(unsigned int nr, void * addr) { unsigned char *ADDR = (unsigned char *) addr; ADDR += nr >> 3; *ADDR &= (unsigned char) ~(1 << (nr & 0x07)); } _INLINE_ void ext2fs_fast_set_bit64(__u64 nr, void * addr) { unsigned char *ADDR = (unsigned char *) addr; ADDR += nr >> 3; *ADDR |= (unsigned char) (1 << (nr & 0x07)); } _INLINE_ void ext2fs_fast_clear_bit64(__u64 nr, void * addr) { unsigned char *ADDR = (unsigned char *) addr; ADDR += nr >> 3; *ADDR &= (unsigned char) ~(1 << (nr & 0x07)); } #if ((defined __GNUC__) && !defined(_EXT2_USE_C_VERSIONS_) && \ (defined(__i386__) || defined(__i486__) || defined(__i586__))) #define _EXT2_HAVE_ASM_BITOPS_ #define _EXT2_HAVE_ASM_SWAB_ /* * These are done by inline assembly for speed reasons..... * * All bitoperations return 0 if the bit was cleared before the * operation and != 0 if it was not. Bit 0 is the LSB of addr; bit 32 * is the LSB of (addr+1). */ /* * Some hacks to defeat gcc over-optimizations.. */ struct __dummy_h { unsigned long a[100]; }; #define EXT2FS_ADDR (*(struct __dummy_h *) addr) #define EXT2FS_CONST_ADDR (*(const struct __dummy_h *) addr) _INLINE_ int ext2fs_set_bit(unsigned int nr, void * addr) { int oldbit; addr = (void *) (((unsigned char *) addr) + (nr >> 3)); __asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0" :"=r" (oldbit),"+m" (EXT2FS_ADDR) :"r" (nr & 7)); return oldbit; } _INLINE_ int ext2fs_clear_bit(unsigned int nr, void * addr) { int oldbit; addr = (void *) (((unsigned char *) addr) + (nr >> 3)); __asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0" :"=r" (oldbit),"+m" (EXT2FS_ADDR) :"r" (nr & 7)); return oldbit; } _INLINE_ int ext2fs_test_bit(unsigned int nr, const void * addr) { int oldbit; addr = (const void *) (((const unsigned char *) addr) + (nr >> 3)); __asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0" :"=r" (oldbit) :"m" (EXT2FS_CONST_ADDR),"r" (nr & 7)); return oldbit; } _INLINE_ __u32 ext2fs_swab32(__u32 val) { #ifdef EXT2FS_REQUIRE_486 __asm__("bswap %0" : "=r" (val) : "0" (val)); #else __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */ "rorl $16,%0\n\t" /* swap words */ "xchgb %b0,%h0" /* swap higher bytes */ :"=q" (val) : "0" (val)); #endif return val; } _INLINE_ __u16 ext2fs_swab16(__u16 val) { __asm__("xchgb %b0,%h0" /* swap bytes */ \ : "=q" (val) \ : "0" (val)); \ return val; } #undef EXT2FS_ADDR #endif /* i386 */ #if !defined(_EXT2_HAVE_ASM_SWAB_) _INLINE_ __u16 ext2fs_swab16(__u16 val) { return (val >> 8) | (__u16) (val << 8); } _INLINE_ __u32 ext2fs_swab32(__u32 val) { return ((val>>24) | ((val>>8)&0xFF00) | ((val<<8)&0xFF0000) | (val<<24)); } #endif /* !_EXT2_HAVE_ASM_SWAB */ _INLINE_ __u64 ext2fs_swab64(__u64 val) { return (ext2fs_swab32((__u32) (val >> 32)) | (((__u64)ext2fs_swab32(val & 0xFFFFFFFFUL)) << 32)); } _INLINE_ int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block) { return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block); } _INLINE_ int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block) { return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block); } _INLINE_ int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block) { return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, block); } _INLINE_ int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode) { return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); } _INLINE_ int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode) { return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); } _INLINE_ int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode) { return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); } _INLINE_ void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block) { ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block); } _INLINE_ void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block) { ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block); } _INLINE_ int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block) { return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, block); } _INLINE_ void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode) { ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); } _INLINE_ void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode) { ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); } _INLINE_ int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode) { return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); } _INLINE_ blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap) { return ext2fs_get_generic_bitmap_start((ext2fs_generic_bitmap) bitmap); } _INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap) { return ext2fs_get_generic_bitmap_start((ext2fs_generic_bitmap) bitmap); } _INLINE_ blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap) { return ext2fs_get_generic_bitmap_end((ext2fs_generic_bitmap) bitmap); } _INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap) { return ext2fs_get_generic_bitmap_end((ext2fs_generic_bitmap) bitmap); } _INLINE_ int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num) { return ext2fs_test_block_bitmap_range(bitmap, block, num); } _INLINE_ void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num) { ext2fs_mark_block_bitmap_range(bitmap, block, num); } _INLINE_ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num) { ext2fs_unmark_block_bitmap_range(bitmap, block, num); } /* 64-bit versions */ _INLINE_ int ext2fs_mark_block_bitmap2(ext2fs_block_bitmap bitmap, blk64_t block) { return ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, block); } _INLINE_ int ext2fs_unmark_block_bitmap2(ext2fs_block_bitmap bitmap, blk64_t block) { return ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, block); } _INLINE_ int ext2fs_test_block_bitmap2(ext2fs_block_bitmap bitmap, blk64_t block) { return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap, block); } _INLINE_ int ext2fs_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap, ext2_ino_t inode) { return ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, inode); } _INLINE_ int ext2fs_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap, ext2_ino_t inode) { return ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, inode); } _INLINE_ int ext2fs_test_inode_bitmap2(ext2fs_inode_bitmap bitmap, ext2_ino_t inode) { return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap, inode); } _INLINE_ void ext2fs_fast_mark_block_bitmap2(ext2fs_block_bitmap bitmap, blk64_t block) { ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, block); } _INLINE_ void ext2fs_fast_unmark_block_bitmap2(ext2fs_block_bitmap bitmap, blk64_t block) { ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, block); } _INLINE_ int ext2fs_fast_test_block_bitmap2(ext2fs_block_bitmap bitmap, blk64_t block) { return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap, block); } _INLINE_ void ext2fs_fast_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap, ext2_ino_t inode) { ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, inode); } _INLINE_ void ext2fs_fast_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap, ext2_ino_t inode) { ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, inode); } _INLINE_ int ext2fs_fast_test_inode_bitmap2(ext2fs_inode_bitmap bitmap, ext2_ino_t inode) { return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap, inode); } _INLINE_ errcode_t ext2fs_find_first_zero_block_bitmap2(ext2fs_block_bitmap bitmap, blk64_t start, blk64_t end, blk64_t *out) { __u64 o; errcode_t rv; rv = ext2fs_find_first_zero_generic_bmap((ext2fs_generic_bitmap) bitmap, start, end, &o); if (!rv) *out = o; return rv; } _INLINE_ errcode_t ext2fs_find_first_zero_inode_bitmap2(ext2fs_inode_bitmap bitmap, ext2_ino_t start, ext2_ino_t end, ext2_ino_t *out) { __u64 o; errcode_t rv; rv = ext2fs_find_first_zero_generic_bmap((ext2fs_generic_bitmap) bitmap, start, end, &o); if (!rv) *out = (ext2_ino_t) o; return rv; } _INLINE_ blk64_t ext2fs_get_block_bitmap_start2(ext2fs_block_bitmap bitmap) { return ext2fs_get_generic_bmap_start((ext2fs_generic_bitmap) bitmap); } _INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start2(ext2fs_inode_bitmap bitmap) { return (ext2_ino_t) ext2fs_get_generic_bmap_start((ext2fs_generic_bitmap) bitmap); } _INLINE_ blk64_t ext2fs_get_block_bitmap_end2(ext2fs_block_bitmap bitmap) { return ext2fs_get_generic_bmap_end((ext2fs_generic_bitmap) bitmap); } _INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end2(ext2fs_inode_bitmap bitmap) { return (ext2_ino_t) ext2fs_get_generic_bmap_end((ext2fs_generic_bitmap) bitmap); } _INLINE_ int ext2fs_fast_test_block_bitmap_range2(ext2fs_block_bitmap bitmap, blk64_t block, unsigned int num) { return ext2fs_test_block_bitmap_range2(bitmap, block, num); } _INLINE_ void ext2fs_fast_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap, blk64_t block, unsigned int num) { ext2fs_mark_block_bitmap_range2(bitmap, block, num); } _INLINE_ void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap, blk64_t block, unsigned int num) { ext2fs_unmark_block_bitmap_range2(bitmap, block, num); } #undef _INLINE_ #endif #ifndef _EXT2_HAVE_ASM_BITOPS_ extern int ext2fs_set_bit(unsigned int nr,void * addr); extern int ext2fs_clear_bit(unsigned int nr, void * addr); extern int ext2fs_test_bit(unsigned int nr, const void * addr); #endif extern int ext2fs_set_bit64(__u64 nr,void * addr); extern int ext2fs_clear_bit64(__u64 nr, void * addr); extern int ext2fs_test_bit64(__u64 nr, const void * addr); extern unsigned int ext2fs_bitcount(const void *addr, unsigned int nbytes); ext2fs/qcow2.h000064400000005000147631660260007171 0ustar00/* * qcow2.h --- structures and function prototypes for qcow2.c to generate * qcow2 formatted disk images. This format is used originally by QEMU * for virtual machines, and stores the filesystem data on disk in a * packed format to avoid creating sparse image files that need lots of * seeking to read and write. * * The qcow2 format supports zlib compression, but that is not yet * implemented. * * It is possible to directly mount a qcow2 image using qemu-nbd: * * [root]# modprobe nbd max_part=63 * [root]# qemu-nbd -c /dev/nbd0 image.img * [root]# mount /dev/nbd0p1 /mnt/qemu * * Format details at http://people.gnome.org/~markmc/qcow-image-format.html * * Copyright (C) 2010 Red Hat, Inc., Lukas Czerner * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. * %End-Header% */ /* Number of l2 tables in memory before writeback */ #define L2_CACHE_PREALLOC 512 #define QCOW_MAGIC (('Q' << 24) | ('F' << 16) | ('I' << 8) | 0xfb) #define QCOW_VERSION 2 #define QCOW_OFLAG_COPIED (1LL << 63) #define QCOW_OFLAG_COMPRESSED (1LL << 62) #define QCOW_COMPRESSED 1 #define QCOW_ENCRYPTED 2 struct ext2_qcow2_hdr { __u32 magic; __u32 version; __u64 backing_file_offset; __u32 backing_file_size; __u32 cluster_bits; __u64 size; __u32 crypt_method; __u32 l1_size; __u64 l1_table_offset; __u64 refcount_table_offset; __u32 refcount_table_clusters; __u32 nb_snapshots; __u64 snapshots_offset; }; typedef struct ext2_qcow2_l2_table L2_CACHE_HEAD; struct ext2_qcow2_l2_table { __u32 l1_index; __u64 offset; __u64 *data; L2_CACHE_HEAD *next; }; struct ext2_qcow2_l2_cache { L2_CACHE_HEAD *used_head; L2_CACHE_HEAD *used_tail; L2_CACHE_HEAD *free_head; __u32 free; __u32 count; __u64 next_offset; }; struct ext2_qcow2_refcount { __u64 *refcount_table; __u64 refcount_table_offset; __u64 refcount_block_offset; __u32 refcount_table_clusters; __u32 refcount_table_index; __u32 refcount_block_index; __u16 *refcount_block; }; struct ext2_qcow2_image { int fd; struct ext2_qcow2_hdr *hdr; struct ext2_qcow2_l2_cache *l2_cache; struct ext2_qcow2_refcount refcount; __u32 cluster_size; __u32 cluster_bits; __u32 l1_size; __u32 l2_size; __u64 *l1_table; __u64 l2_offset; __u64 l1_offset; __u64 image_size; }; /* Function prototypes */ /* qcow2.c */ /* Functions for converting qcow2 image into raw image */ struct ext2_qcow2_hdr *qcow2_read_header(int); int qcow2_write_raw_image(int, int, struct ext2_qcow2_hdr *); ext2fs/ext2_types-x86_64.h000064400000005701147631660260011210 0ustar00/* * If linux/types.h is already been included, assume it has defined * everything we need. (cross fingers) Other header files may have * also defined the types that we need. */ #if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && \ !defined(_EXT2_TYPES_H)) #define _EXT2_TYPES_H #define __S8_TYPEDEF __signed__ char #define __U8_TYPEDEF unsigned char #define __S16_TYPEDEF __signed__ short #define __U16_TYPEDEF unsigned short #define __S32_TYPEDEF __signed__ int #define __U32_TYPEDEF unsigned int #define __S64_TYPEDEF __signed__ long long #define __U64_TYPEDEF unsigned long long #ifdef __U8_TYPEDEF typedef __U8_TYPEDEF __u8; #else typedef unsigned char __u8; #endif #ifdef __S8_TYPEDEF typedef __S8_TYPEDEF __s8; #else typedef signed char __s8; #endif #ifdef __U16_TYPEDEF typedef __U16_TYPEDEF __u16; #else #if (4 == 2) typedef unsigned int __u16; #else #if (2 == 2) typedef unsigned short __u16; #else ?==error: undefined 16 bit type #endif /* SIZEOF_SHORT == 2 */ #endif /* SIZEOF_INT == 2 */ #endif /* __U16_TYPEDEF */ #ifdef __S16_TYPEDEF typedef __S16_TYPEDEF __s16; #else #if (4 == 2) typedef int __s16; #else #if (2 == 2) typedef short __s16; #else ?==error: undefined 16 bit type #endif /* SIZEOF_SHORT == 2 */ #endif /* SIZEOF_INT == 2 */ #endif /* __S16_TYPEDEF */ #ifdef __U32_TYPEDEF typedef __U32_TYPEDEF __u32; #else #if (4 == 4) typedef unsigned int __u32; #else #if (8 == 4) typedef unsigned long __u32; #else #if (2 == 4) typedef unsigned short __u32; #else ?== error: undefined 32 bit type #endif /* SIZEOF_SHORT == 4 */ #endif /* SIZEOF_LONG == 4 */ #endif /* SIZEOF_INT == 4 */ #endif /* __U32_TYPEDEF */ #ifdef __S32_TYPEDEF typedef __S32_TYPEDEF __s32; #else #if (4 == 4) typedef int __s32; #else #if (8 == 4) typedef long __s32; #else #if (2 == 4) typedef short __s32; #else ?== error: undefined 32 bit type #endif /* SIZEOF_SHORT == 4 */ #endif /* SIZEOF_LONG == 4 */ #endif /* SIZEOF_INT == 4 */ #endif /* __S32_TYPEDEF */ #ifdef __U64_TYPEDEF typedef __U64_TYPEDEF __u64; #else #if (4 == 8) typedef unsigned int __u64; #else #if (8 == 8) typedef unsigned long long __u64; #else #if (8 == 8) typedef unsigned long __u64; #endif /* SIZEOF_LONG_LONG == 8 */ #endif /* SIZEOF_LONG == 8 */ #endif /* SIZEOF_INT == 8 */ #endif /* __U64_TYPEDEF */ #ifdef __S64_TYPEDEF typedef __S64_TYPEDEF __s64; #else #if (4 == 8) typedef int __s64; #else #if (8 == 8) #if defined(__GNUC__) typedef __signed__ long long __s64; #else typedef signed long long __s64; #endif /* __GNUC__ */ #else #if (8 == 8) typedef long __s64; #endif /* SIZEOF_LONG_LONG == 8 */ #endif /* SIZEOF_LONG == 8 */ #endif /* SIZEOF_INT == 8 */ #endif /* __S64_TYPEDEF */ #undef __S8_TYPEDEF #undef __U8_TYPEDEF #undef __S16_TYPEDEF #undef __U16_TYPEDEF #undef __S32_TYPEDEF #undef __U32_TYPEDEF #undef __S64_TYPEDEF #undef __U64_TYPEDEF #endif /* _*_TYPES_H */ /* These defines are needed for the public ext2fs.h header file */ #define HAVE_SYS_TYPES_H 1 #undef WORDS_BIGENDIAN ext2fs/tdb.h000064400000021130147631660260006711 0ustar00#ifndef __TDB_H__ #define __TDB_H__ /* Unix SMB/CIFS implementation. trivial database library Copyright (C) Andrew Tridgell 1999-2004 ** NOTE! The following LGPL license applies to the tdb ** library. This does NOT imply that all of Samba is released ** under the LGPL This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef __cplusplus extern "C" { #endif /* flags to tdb_store() */ #define TDB_REPLACE 1 #define TDB_INSERT 2 #define TDB_MODIFY 3 /* flags for tdb_open() */ #define TDB_DEFAULT 0 /* just a readability place holder */ #define TDB_CLEAR_IF_FIRST 1 #define TDB_INTERNAL 2 /* don't store on disk */ #define TDB_NOLOCK 4 /* don't do any locking */ #define TDB_NOMMAP 8 /* don't use mmap */ #define TDB_CONVERT 16 /* convert endian (internal use) */ #define TDB_BIGENDIAN 32 /* header is big-endian (internal use) */ #define TDB_NOSYNC 64 /* don't use synchronous transactions */ #define TDB_SEQNUM 128 /* maintain a sequence number */ #define TDB_ERRCODE(code, ret) ((tdb->ecode = (code)), ret) /* error codes */ enum TDB_ERROR {TDB_SUCCESS=0, TDB_ERR_CORRUPT, TDB_ERR_IO, TDB_ERR_LOCK, TDB_ERR_OOM, TDB_ERR_EXISTS, TDB_ERR_NOLOCK, TDB_ERR_LOCK_TIMEOUT, TDB_ERR_NOEXIST, TDB_ERR_EINVAL, TDB_ERR_RDONLY}; /* debugging uses one of the following levels */ enum tdb_debug_level {TDB_DEBUG_FATAL = 0, TDB_DEBUG_ERROR, TDB_DEBUG_WARNING, TDB_DEBUG_TRACE}; typedef struct TDB_DATA { unsigned char *dptr; size_t dsize; } TDB_DATA; #ifndef PRINTF_ATTRIBUTE #if (__GNUC__ >= 3) /** Use gcc attribute to check printf fns. a1 is the 1-based index of * the parameter containing the format, and a2 the index of the first * argument. Note that some gcc 2.x versions don't handle this * properly **/ #define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2))) #else #define PRINTF_ATTRIBUTE(a1, a2) #endif #endif /* ext2fs tdb renames */ #define tdb_open ext2fs_tdb_open #define tdb_open_ex ext2fs_tdb_open_ex #define tdb_set_max_dead ext2fs_tdb_set_max_dead #define tdb_reopen ext2fs_tdb_reopen #define tdb_reopen_all ext2fs_tdb_reopen_all #define tdb_set_logging_function ext2fs_tdb_set_logging_function #define tdb_error ext2fs_tdb_error #define tdb_errorstr ext2fs_tdb_errorstr #define tdb_fetch ext2fs_tdb_fetch #define tdb_parse_record ext2fs_tdb_parse_record #define tdb_delete ext2fs_tdb_delete #define tdb_store ext2fs_tdb_store #define tdb_append ext2fs_tdb_append #define tdb_close ext2fs_tdb_close #define tdb_firstkey ext2fs_tdb_firstkey #define tdb_nextkey ext2fs_tdb_nextkey #define tdb_traverse ext2fs_tdb_traverse #define tdb_traverse_read ext2fs_tdb_traverse_read #define tdb_exists ext2fs_tdb_exists #define tdb_lockall ext2fs_tdb_lockall #define tdb_unlockall ext2fs_tdb_unlockall #define tdb_lockall_read ext2fs_tdb_lockall_read #define tdb_unlockall_read ext2fs_tdb_unlockall_read #define tdb_name ext2fs_tdb_name #define tdb_fd ext2fs_tdb_fd #define tdb_log_fn ext2fs_tdb_log_fn #define tdb_get_logging_private ext2fs_tdb_get_logging_private #define tdb_transaction_start ext2fs_tdb_transaction_start #define tdb_transaction_commit ext2fs_tdb_transaction_commit #define tdb_transaction_cancel ext2fs_tdb_transaction_cancel #define tdb_transaction_recover ext2fs_tdb_transaction_recover #define tdb_get_seqnum ext2fs_tdb_get_seqnum #define tdb_hash_size ext2fs_tdb_hash_size #define tdb_map_size ext2fs_tdb_map_size #define tdb_get_flags ext2fs_tdb_get_flags #define tdb_chainlock ext2fs_tdb_chainlock #define tdb_chainunlock ext2fs_tdb_chainunlock #define tdb_chainlock_read ext2fs_tdb_chainlock_read #define tdb_chainunlock_read ext2fs_tdb_chainunlock_read #define tdb_dump_all ext2fs_tdb_dump_all #define tdb_printfreelist ext2fs_tdb_printfreelist #define tdb_validate_freelist ext2fs_tdb_validate_freelist #define tdb_chainlock_mark ext2fs_tdb_chainlock_mark #define tdb_chainlock_nonblock ext2fs_tdb_chainlock_nonblock #define tdb_chainlock_unmark ext2fs_tdb_chainlock_unmark #define tdb_enable_seqnum ext2fs_tdb_enable_seqnum #define tdb_increment_seqnum_nonblock ext2fs_tdb_increment_seqnum_nonblock #define tdb_lock_nonblock ext2fs_tdb_lock_nonblock #define tdb_lockall_mark ext2fs_tdb_lockall_mark #define tdb_lockall_nonblock ext2fs_tdb_lockall_nonblock #define tdb_lockall_read_nonblock ext2fs_tdb_lockall_read_nonblock #define tdb_lockall_unmark ext2fs_tdb_lockall_unmark /* this is the context structure that is returned from a db open */ typedef struct tdb_context TDB_CONTEXT; typedef int (*tdb_traverse_func)(struct tdb_context *, TDB_DATA, TDB_DATA, void *); typedef void (*tdb_log_func)(struct tdb_context *, enum tdb_debug_level, const char *, ...) PRINTF_ATTRIBUTE(3, 4); typedef unsigned int (*tdb_hash_func)(TDB_DATA *key); struct tdb_logging_context { tdb_log_func log_fn; void *log_private; }; struct tdb_context *tdb_open(const char *name, int hash_size, int tdb_flags, int open_flags, mode_t mode); struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, int open_flags, mode_t mode, const struct tdb_logging_context *log_ctx, tdb_hash_func hash_fn); void tdb_set_max_dead(struct tdb_context *tdb, int max_dead); int tdb_reopen(struct tdb_context *tdb); int tdb_reopen_all(int parent_longlived); void tdb_set_logging_function(struct tdb_context *tdb, const struct tdb_logging_context *log_ctx); enum TDB_ERROR tdb_error(struct tdb_context *tdb); const char *tdb_errorstr(struct tdb_context *tdb); TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key); int tdb_parse_record(struct tdb_context *tdb, TDB_DATA key, int (*parser)(TDB_DATA key, TDB_DATA data, void *private_data), void *private_data); int tdb_delete(struct tdb_context *tdb, TDB_DATA key); int tdb_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag); int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf); int tdb_close(struct tdb_context *tdb); TDB_DATA tdb_firstkey(struct tdb_context *tdb); TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA key); int tdb_traverse(struct tdb_context *tdb, tdb_traverse_func fn, void *); int tdb_traverse_read(struct tdb_context *tdb, tdb_traverse_func fn, void *); int tdb_exists(struct tdb_context *tdb, TDB_DATA key); int tdb_lockall(struct tdb_context *tdb); int tdb_lockall_nonblock(struct tdb_context *tdb); int tdb_unlockall(struct tdb_context *tdb); int tdb_lockall_read(struct tdb_context *tdb); int tdb_lockall_read_nonblock(struct tdb_context *tdb); int tdb_unlockall_read(struct tdb_context *tdb); int tdb_lockall_mark(struct tdb_context *tdb); int tdb_lockall_unmark(struct tdb_context *tdb); const char *tdb_name(struct tdb_context *tdb); int tdb_fd(struct tdb_context *tdb); tdb_log_func tdb_log_fn(struct tdb_context *tdb); void *tdb_get_logging_private(struct tdb_context *tdb); int tdb_transaction_start(struct tdb_context *tdb); int tdb_transaction_commit(struct tdb_context *tdb); int tdb_transaction_cancel(struct tdb_context *tdb); int tdb_transaction_recover(struct tdb_context *tdb); int tdb_get_seqnum(struct tdb_context *tdb); int tdb_hash_size(struct tdb_context *tdb); size_t tdb_map_size(struct tdb_context *tdb); int tdb_get_flags(struct tdb_context *tdb); void tdb_enable_seqnum(struct tdb_context *tdb); void tdb_increment_seqnum_nonblock(struct tdb_context *tdb); /* Low level locking functions: use with care */ int tdb_chainlock(struct tdb_context *tdb, TDB_DATA key); int tdb_chainlock_nonblock(struct tdb_context *tdb, TDB_DATA key); int tdb_chainunlock(struct tdb_context *tdb, TDB_DATA key); int tdb_chainlock_read(struct tdb_context *tdb, TDB_DATA key); int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key); int tdb_chainlock_mark(struct tdb_context *tdb, TDB_DATA key); int tdb_chainlock_unmark(struct tdb_context *tdb, TDB_DATA key); /* Debug functions. Not used in production. */ void tdb_dump_all(struct tdb_context *tdb); int tdb_printfreelist(struct tdb_context *tdb); int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries); #ifdef __cplusplus } #endif #endif /* tdb.h */ ext2fs/ext3_extents.h000064400000007647147631660260010616 0ustar00/* * Copyright (c) 2003,2004 Cluster File Systems, Inc, info@clusterfs.com * Written by Alex Tomas * * %Begin-Header% * This file may be redistributed under the terms of the GNU Library * General Public License, version 2. * %End-Header% */ #ifndef _LINUX_EXT3_EXTENTS #define _LINUX_EXT3_EXTENTS /* * ext3_inode has i_block array (total 60 bytes) * first 4 bytes are used to store: * - tree depth (0 mean there is no tree yet. all extents in the inode) * - number of alive extents in the inode */ /* * this is extent on-disk structure * it's used at the bottom of the tree */ struct ext3_extent { __u32 ee_block; /* first logical block extent covers */ __u16 ee_len; /* number of blocks covered by extent */ __u16 ee_start_hi; /* high 16 bits of physical block */ __u32 ee_start; /* low 32 bigs of physical block */ }; /* * this is index on-disk structure * it's used at all the levels, but the bottom */ struct ext3_extent_idx { __u32 ei_block; /* index covers logical blocks from 'block' */ __u32 ei_leaf; /* pointer to the physical block of the next * * level. leaf or next index could bet here */ __u16 ei_leaf_hi; /* high 16 bits of physical block */ __u16 ei_unused; }; /* * each block (leaves and indexes), even inode-stored has header */ struct ext3_extent_header { __u16 eh_magic; /* probably will support different formats */ __u16 eh_entries; /* number of valid entries */ __u16 eh_max; /* capacity of store in entries */ __u16 eh_depth; /* has tree real underlaying blocks? */ __u32 eh_generation; /* generation of the tree */ }; #define EXT3_EXT_MAGIC 0xf30a /* * array of ext3_ext_path contains path to some extent * creation/lookup routines use it for traversal/splitting/etc * truncate uses it to simulate recursive walking */ struct ext3_ext_path { __u32 p_block; __u16 p_depth; struct ext3_extent *p_ext; struct ext3_extent_idx *p_idx; struct ext3_extent_header *p_hdr; struct buffer_head *p_bh; }; /* * EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an * initialized extent. This is 2^15 and not (2^16 - 1), since we use the * MSB of ee_len field in the extent datastructure to signify if this * particular extent is an initialized extent or an uninitialized (i.e. * preallocated). * EXT_UNINIT_MAX_LEN is the maximum number of blocks we can have in an * uninitialized extent. * If ee_len is <= 0x8000, it is an initialized extent. Otherwise, it is an * uninitialized one. In other words, if MSB of ee_len is set, it is an * uninitialized extent with only one special scenario when ee_len = 0x8000. * In this case we can not have an uninitialized extent of zero length and * thus we make it as a special case of initialized extent with 0x8000 length. * This way we get better extent-to-group alignment for initialized extents. * Hence, the maximum number of blocks we can have in an *initialized* * extent is 2^15 (32768) and in an *uninitialized* extent is 2^15-1 (32767). */ #define EXT_INIT_MAX_LEN (1UL << 15) #define EXT_UNINIT_MAX_LEN (EXT_INIT_MAX_LEN - 1) #define EXT_FIRST_EXTENT(__hdr__) \ ((struct ext3_extent *) (((char *) (__hdr__)) + \ sizeof(struct ext3_extent_header))) #define EXT_FIRST_INDEX(__hdr__) \ ((struct ext3_extent_idx *) (((char *) (__hdr__)) + \ sizeof(struct ext3_extent_header))) #define EXT_HAS_FREE_INDEX(__path__) \ (ext2fs_le16_to_cpu((__path__)->p_hdr->eh_entries) < \ ext2fs_le16_to_cpu((__path__)->p_hdr->eh_max)) #define EXT_LAST_EXTENT(__hdr__) \ (EXT_FIRST_EXTENT((__hdr__)) + \ ext2fs_le16_to_cpu((__hdr__)->eh_entries) - 1) #define EXT_LAST_INDEX(__hdr__) \ (EXT_FIRST_INDEX((__hdr__)) + \ ext2fs_le16_to_cpu((__hdr__)->eh_entries) - 1) #define EXT_MAX_EXTENT(__hdr__) \ (EXT_FIRST_EXTENT((__hdr__)) + \ ext2fs_le16_to_cpu((__hdr__)->eh_max) - 1) #define EXT_MAX_INDEX(__hdr__) \ (EXT_FIRST_INDEX((__hdr__)) + \ ext2fs_le16_to_cpu((__hdr__)->eh_max) - 1) #endif /* _LINUX_EXT3_EXTENTS */ et/com_err.h000064400000004106147631660260006767 0ustar00/* * Header file for common error description library. * * Copyright 1988, Student Information Processing Board of the * Massachusetts Institute of Technology. * * For copyright and distribution info, see the documentation supplied * with this package. */ #if !defined(__COM_ERR_H) && !defined(__COM_ERR_H__) #ifdef __GNUC__ #define COM_ERR_ATTR(x) __attribute__(x) #else #define COM_ERR_ATTR(x) #endif #include #include typedef long errcode_t; struct error_table { char const * const * msgs; long base; int n_msgs; }; struct et_list; extern void com_err (const char *, long, const char *, ...) COM_ERR_ATTR((format(printf, 3, 4))); extern void com_err_va (const char *whoami, errcode_t code, const char *fmt, va_list args) COM_ERR_ATTR((format(printf, 3, 0))); extern char const *error_message (long); extern void (*com_err_hook) (const char *, long, const char *, va_list); extern void (*set_com_err_hook (void (*) (const char *, long, const char *, va_list))) (const char *, long, const char *, va_list); extern void (*reset_com_err_hook (void)) (const char *, long, const char *, va_list); extern int init_error_table(const char * const *msgs, long base, int count); extern char *(*set_com_err_gettext (char *(*) (const char *))) (const char *); extern errcode_t add_error_table(const struct error_table * et); extern errcode_t remove_error_table(const struct error_table * et); extern void add_to_error_table(struct et_list *new_table); /* Provided for Heimdall compatibility */ extern const char *com_right(struct et_list *list, long code); extern const char *com_right_r(struct et_list *list, long code, char *str, size_t len); extern void initialize_error_table_r(struct et_list **list, const char **messages, int num_errors, long base); extern void free_error_table(struct et_list *et); /* Provided for compatibility with other com_err libraries */ extern int et_list_lock(void); extern int et_list_unlock(void); #define __COM_ERR_H #define __COM_ERR_H__ #endif /* !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)*/ libdb/db.h000044400000360325147631660260006400 0ustar00/* * See the file LICENSE for redistribution information. * * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. * * $Id$ * * db.h include file layout: * General. * Database Environment. * Locking subsystem. * Logging subsystem. * Shared buffer cache (mpool) subsystem. * Transaction subsystem. * Access methods. * Access method cursors. * Dbm/Ndbm, Hsearch historic interfaces. */ #ifndef _DB_H_ #define _DB_H_ #ifndef __NO_SYSTEM_INCLUDES #include #include #include #include #include #include #include #endif #if defined(__cplusplus) extern "C" { #endif #undef __P #define __P(protos) protos /* * Berkeley DB version information. */ #define DB_VERSION_FAMILY 11 #define DB_VERSION_RELEASE 2 #define DB_VERSION_MAJOR 5 #define DB_VERSION_MINOR 3 #define DB_VERSION_PATCH 21 #define DB_VERSION_STRING "Berkeley DB 5.3.21: (May 11, 2012)" #define DB_VERSION_FULL_STRING "Berkeley DB 11g Release 2, library version 11.2.5.3.21: (May 11, 2012)" /* * !!! * Berkeley DB uses specifically sized types. If they're not provided by * the system, typedef them here. * * We protect them against multiple inclusion using __BIT_TYPES_DEFINED__, * as does BIND and Kerberos, since we don't know for sure what #include * files the user is using. * * !!! * We also provide the standard u_int, u_long etc., if they're not provided * by the system. */ #ifndef __BIT_TYPES_DEFINED__ #define __BIT_TYPES_DEFINED__ #endif /* * Missing ANSI types. * * uintmax_t -- * Largest unsigned type, used to align structures in memory. We don't store * floating point types in structures, so integral types should be sufficient * (and we don't have to worry about systems that store floats in other than * power-of-2 numbers of bytes). Additionally this fixes compilers that rewrite * structure assignments and ANSI C memcpy calls to be in-line instructions * that happen to require alignment. * * uintptr_t -- * Unsigned type that's the same size as a pointer. There are places where * DB modifies pointers by discarding the bottom bits to guarantee alignment. * We can't use uintmax_t, it may be larger than the pointer, and compilers * get upset about that. So far we haven't run on any machine where there's * no unsigned type the same size as a pointer -- here's hoping. */ #ifdef HAVE_MIXED_SIZE_ADDRESSING typedef u_int32_t db_size_t; #else typedef size_t db_size_t; #endif #ifdef HAVE_MIXED_SIZE_ADDRESSING typedef int32_t db_ssize_t; #else typedef ssize_t db_ssize_t; #endif /* * Sequences are only available on machines with 64-bit integral types. */ typedef int64_t db_seq_t; /* Thread and process identification. */ typedef pthread_t db_threadid_t; /* Basic types that are exported or quasi-exported. */ typedef u_int32_t db_pgno_t; /* Page number type. */ typedef u_int16_t db_indx_t; /* Page offset type. */ #define DB_MAX_PAGES 0xffffffff /* >= # of pages in a file */ typedef u_int32_t db_recno_t; /* Record number type. */ #define DB_MAX_RECORDS 0xffffffff /* >= # of records in a tree */ typedef u_int32_t db_timeout_t; /* Type of a timeout. */ /* * Region offsets are the difference between a pointer in a region and the * region's base address. With private environments, both addresses are the * result of calling malloc, and we can't assume anything about what malloc * will return, so region offsets have to be able to hold differences between * arbitrary pointers. */ typedef db_size_t roff_t; /* * Forward structure declarations, so we can declare pointers and * applications can get type checking. */ struct __channel; typedef struct __channel CHANNEL; struct __db; typedef struct __db DB; struct __db_bt_stat; typedef struct __db_bt_stat DB_BTREE_STAT; struct __db_channel; typedef struct __db_channel DB_CHANNEL; struct __db_cipher; typedef struct __db_cipher DB_CIPHER; struct __db_compact; typedef struct __db_compact DB_COMPACT; struct __db_dbt; typedef struct __db_dbt DBT; struct __db_distab; typedef struct __db_distab DB_DISTAB; struct __db_env; typedef struct __db_env DB_ENV; struct __db_h_stat; typedef struct __db_h_stat DB_HASH_STAT; struct __db_heap_rid; typedef struct __db_heap_rid DB_HEAP_RID; struct __db_heap_stat; typedef struct __db_heap_stat DB_HEAP_STAT; struct __db_ilock; typedef struct __db_ilock DB_LOCK_ILOCK; struct __db_lock_hstat; typedef struct __db_lock_hstat DB_LOCK_HSTAT; struct __db_lock_pstat; typedef struct __db_lock_pstat DB_LOCK_PSTAT; struct __db_lock_stat; typedef struct __db_lock_stat DB_LOCK_STAT; struct __db_lock_u; typedef struct __db_lock_u DB_LOCK; struct __db_locker; typedef struct __db_locker DB_LOCKER; struct __db_lockreq; typedef struct __db_lockreq DB_LOCKREQ; struct __db_locktab; typedef struct __db_locktab DB_LOCKTAB; struct __db_log; typedef struct __db_log DB_LOG; struct __db_log_cursor; typedef struct __db_log_cursor DB_LOGC; struct __db_log_stat; typedef struct __db_log_stat DB_LOG_STAT; struct __db_lsn; typedef struct __db_lsn DB_LSN; struct __db_mpool; typedef struct __db_mpool DB_MPOOL; struct __db_mpool_fstat;typedef struct __db_mpool_fstat DB_MPOOL_FSTAT; struct __db_mpool_stat; typedef struct __db_mpool_stat DB_MPOOL_STAT; struct __db_mpoolfile; typedef struct __db_mpoolfile DB_MPOOLFILE; struct __db_mutex_stat; typedef struct __db_mutex_stat DB_MUTEX_STAT; struct __db_mutex_t; typedef struct __db_mutex_t DB_MUTEX; struct __db_mutexmgr; typedef struct __db_mutexmgr DB_MUTEXMGR; struct __db_preplist; typedef struct __db_preplist DB_PREPLIST; struct __db_qam_stat; typedef struct __db_qam_stat DB_QUEUE_STAT; struct __db_rep; typedef struct __db_rep DB_REP; struct __db_rep_stat; typedef struct __db_rep_stat DB_REP_STAT; struct __db_repmgr_conn_err; typedef struct __db_repmgr_conn_err DB_REPMGR_CONN_ERR; struct __db_repmgr_site;typedef struct __db_repmgr_site DB_REPMGR_SITE; struct __db_repmgr_stat;typedef struct __db_repmgr_stat DB_REPMGR_STAT; struct __db_seq_record; typedef struct __db_seq_record DB_SEQ_RECORD; struct __db_seq_stat; typedef struct __db_seq_stat DB_SEQUENCE_STAT; struct __db_site; typedef struct __db_site DB_SITE; struct __db_sequence; typedef struct __db_sequence DB_SEQUENCE; struct __db_thread_info;typedef struct __db_thread_info DB_THREAD_INFO; struct __db_txn; typedef struct __db_txn DB_TXN; struct __db_txn_active; typedef struct __db_txn_active DB_TXN_ACTIVE; struct __db_txn_stat; typedef struct __db_txn_stat DB_TXN_STAT; struct __db_txn_token; typedef struct __db_txn_token DB_TXN_TOKEN; struct __db_txnmgr; typedef struct __db_txnmgr DB_TXNMGR; struct __dbc; typedef struct __dbc DBC; struct __dbc_internal; typedef struct __dbc_internal DBC_INTERNAL; struct __env; typedef struct __env ENV; struct __fh_t; typedef struct __fh_t DB_FH; struct __fname; typedef struct __fname FNAME; struct __key_range; typedef struct __key_range DB_KEY_RANGE; struct __mpoolfile; typedef struct __mpoolfile MPOOLFILE; struct __db_logvrfy_config; typedef struct __db_logvrfy_config DB_LOG_VERIFY_CONFIG; /* * The Berkeley DB API flags are automatically-generated -- the following flag * names are no longer used, but remain for compatibility reasons. */ #define DB_DEGREE_2 DB_READ_COMMITTED #define DB_DIRTY_READ DB_READ_UNCOMMITTED #define DB_JOINENV 0x0 /* Key/data structure -- a Data-Base Thang. */ struct __db_dbt { void *data; /* Key/data */ u_int32_t size; /* key/data length */ u_int32_t ulen; /* RO: length of user buffer. */ u_int32_t dlen; /* RO: get/put record length. */ u_int32_t doff; /* RO: get/put record offset. */ void *app_data; #define DB_DBT_APPMALLOC 0x001 /* Callback allocated memory. */ #define DB_DBT_BULK 0x002 /* Internal: Insert if duplicate. */ #define DB_DBT_DUPOK 0x004 /* Internal: Insert if duplicate. */ #define DB_DBT_ISSET 0x008 /* Lower level calls set value. */ #define DB_DBT_MALLOC 0x010 /* Return in malloc'd memory. */ #define DB_DBT_MULTIPLE 0x020 /* References multiple records. */ #define DB_DBT_PARTIAL 0x040 /* Partial put/get. */ #define DB_DBT_REALLOC 0x080 /* Return in realloc'd memory. */ #define DB_DBT_READONLY 0x100 /* Readonly, don't update. */ #define DB_DBT_STREAMING 0x200 /* Internal: DBT is being streamed. */ #define DB_DBT_USERCOPY 0x400 /* Use the user-supplied callback. */ #define DB_DBT_USERMEM 0x800 /* Return in user's memory. */ u_int32_t flags; }; /******************************************************* * Mutexes. *******************************************************/ /* * When mixed size addressing is supported mutexes need to be the same size * independent of the process address size is. */ #ifdef HAVE_MIXED_SIZE_ADDRESSING typedef db_size_t db_mutex_t; #else typedef uintptr_t db_mutex_t; #endif struct __db_mutex_stat { /* SHARED */ /* The following fields are maintained in the region's copy. */ u_int32_t st_mutex_align; /* Mutex alignment */ u_int32_t st_mutex_tas_spins; /* Mutex test-and-set spins */ u_int32_t st_mutex_init; /* Initial mutex count */ u_int32_t st_mutex_cnt; /* Mutex count */ u_int32_t st_mutex_max; /* Mutex max */ u_int32_t st_mutex_free; /* Available mutexes */ u_int32_t st_mutex_inuse; /* Mutexes in use */ u_int32_t st_mutex_inuse_max; /* Maximum mutexes ever in use */ /* The following fields are filled-in from other places. */ #ifndef __TEST_DB_NO_STATISTICS uintmax_t st_region_wait; /* Region lock granted after wait. */ uintmax_t st_region_nowait; /* Region lock granted without wait. */ roff_t st_regsize; /* Region size. */ roff_t st_regmax; /* Region max. */ #endif }; /* This is the length of the buffer passed to DB_ENV->thread_id_string() */ #define DB_THREADID_STRLEN 128 /******************************************************* * Locking. *******************************************************/ #define DB_LOCKVERSION 1 #define DB_FILE_ID_LEN 20 /* Unique file ID length. */ /* * Deadlock detector modes; used in the DB_ENV structure to configure the * locking subsystem. */ #define DB_LOCK_NORUN 0 #define DB_LOCK_DEFAULT 1 /* Default policy. */ #define DB_LOCK_EXPIRE 2 /* Only expire locks, no detection. */ #define DB_LOCK_MAXLOCKS 3 /* Select locker with max locks. */ #define DB_LOCK_MAXWRITE 4 /* Select locker with max writelocks. */ #define DB_LOCK_MINLOCKS 5 /* Select locker with min locks. */ #define DB_LOCK_MINWRITE 6 /* Select locker with min writelocks. */ #define DB_LOCK_OLDEST 7 /* Select oldest locker. */ #define DB_LOCK_RANDOM 8 /* Select random locker. */ #define DB_LOCK_YOUNGEST 9 /* Select youngest locker. */ /* * Simple R/W lock modes and for multi-granularity intention locking. * * !!! * These values are NOT random, as they are used as an index into the lock * conflicts arrays, i.e., DB_LOCK_IWRITE must be == 3, and DB_LOCK_IREAD * must be == 4. */ typedef enum { DB_LOCK_NG=0, /* Not granted. */ DB_LOCK_READ=1, /* Shared/read. */ DB_LOCK_WRITE=2, /* Exclusive/write. */ DB_LOCK_WAIT=3, /* Wait for event */ DB_LOCK_IWRITE=4, /* Intent exclusive/write. */ DB_LOCK_IREAD=5, /* Intent to share/read. */ DB_LOCK_IWR=6, /* Intent to read and write. */ DB_LOCK_READ_UNCOMMITTED=7, /* Degree 1 isolation. */ DB_LOCK_WWRITE=8 /* Was Written. */ } db_lockmode_t; /* * Request types. */ typedef enum { DB_LOCK_DUMP=0, /* Display held locks. */ DB_LOCK_GET=1, /* Get the lock. */ DB_LOCK_GET_TIMEOUT=2, /* Get lock with a timeout. */ DB_LOCK_INHERIT=3, /* Pass locks to parent. */ DB_LOCK_PUT=4, /* Release the lock. */ DB_LOCK_PUT_ALL=5, /* Release locker's locks. */ DB_LOCK_PUT_OBJ=6, /* Release locker's locks on obj. */ DB_LOCK_PUT_READ=7, /* Release locker's read locks. */ DB_LOCK_TIMEOUT=8, /* Force a txn to timeout. */ DB_LOCK_TRADE=9, /* Trade locker ids on a lock. */ DB_LOCK_UPGRADE_WRITE=10 /* Upgrade writes for dirty reads. */ } db_lockop_t; /* * Status of a lock. */ typedef enum { DB_LSTAT_ABORTED=1, /* Lock belongs to an aborted txn. */ DB_LSTAT_EXPIRED=2, /* Lock has expired. */ DB_LSTAT_FREE=3, /* Lock is unallocated. */ DB_LSTAT_HELD=4, /* Lock is currently held. */ DB_LSTAT_PENDING=5, /* Lock was waiting and has been * promoted; waiting for the owner * to run and upgrade it to held. */ DB_LSTAT_WAITING=6 /* Lock is on the wait queue. */ }db_status_t; /* Lock statistics structure. */ struct __db_lock_stat { /* SHARED */ u_int32_t st_id; /* Last allocated locker ID. */ u_int32_t st_cur_maxid; /* Current maximum unused ID. */ u_int32_t st_initlocks; /* Initial number of locks in table. */ u_int32_t st_initlockers; /* Initial num of lockers in table. */ u_int32_t st_initobjects; /* Initial num of objects in table. */ u_int32_t st_locks; /* Current number of locks in table. */ u_int32_t st_lockers; /* Current num of lockers in table. */ u_int32_t st_objects; /* Current num of objects in table. */ u_int32_t st_maxlocks; /* Maximum number of locks in table. */ u_int32_t st_maxlockers; /* Maximum num of lockers in table. */ u_int32_t st_maxobjects; /* Maximum num of objects in table. */ u_int32_t st_partitions; /* number of partitions. */ u_int32_t st_tablesize; /* Size of object hash table. */ int32_t st_nmodes; /* Number of lock modes. */ u_int32_t st_nlockers; /* Current number of lockers. */ #ifndef __TEST_DB_NO_STATISTICS u_int32_t st_nlocks; /* Current number of locks. */ u_int32_t st_maxnlocks; /* Maximum number of locks so far. */ u_int32_t st_maxhlocks; /* Maximum number of locks in any bucket. */ uintmax_t st_locksteals; /* Number of lock steals so far. */ uintmax_t st_maxlsteals; /* Maximum number steals in any partition. */ u_int32_t st_maxnlockers; /* Maximum number of lockers so far. */ u_int32_t st_nobjects; /* Current number of objects. */ u_int32_t st_maxnobjects; /* Maximum number of objects so far. */ u_int32_t st_maxhobjects; /* Maximum number of objectsin any bucket. */ uintmax_t st_objectsteals; /* Number of objects steals so far. */ uintmax_t st_maxosteals; /* Maximum number of steals in any partition. */ uintmax_t st_nrequests; /* Number of lock gets. */ uintmax_t st_nreleases; /* Number of lock puts. */ uintmax_t st_nupgrade; /* Number of lock upgrades. */ uintmax_t st_ndowngrade; /* Number of lock downgrades. */ uintmax_t st_lock_wait; /* Lock conflicts w/ subsequent wait */ uintmax_t st_lock_nowait; /* Lock conflicts w/o subsequent wait */ uintmax_t st_ndeadlocks; /* Number of lock deadlocks. */ db_timeout_t st_locktimeout; /* Lock timeout. */ uintmax_t st_nlocktimeouts; /* Number of lock timeouts. */ db_timeout_t st_txntimeout; /* Transaction timeout. */ uintmax_t st_ntxntimeouts; /* Number of transaction timeouts. */ uintmax_t st_part_wait; /* Partition lock granted after wait. */ uintmax_t st_part_nowait; /* Partition lock granted without wait. */ uintmax_t st_part_max_wait; /* Max partition lock granted after wait. */ uintmax_t st_part_max_nowait; /* Max partition lock granted without wait. */ uintmax_t st_objs_wait; /* Object lock granted after wait. */ uintmax_t st_objs_nowait; /* Object lock granted without wait. */ uintmax_t st_lockers_wait; /* Locker lock granted after wait. */ uintmax_t st_lockers_nowait; /* Locker lock granted without wait. */ uintmax_t st_region_wait; /* Region lock granted after wait. */ uintmax_t st_region_nowait; /* Region lock granted without wait. */ u_int32_t st_hash_len; /* Max length of bucket. */ roff_t st_regsize; /* Region size. */ #endif }; struct __db_lock_hstat { /* SHARED */ uintmax_t st_nrequests; /* Number of lock gets. */ uintmax_t st_nreleases; /* Number of lock puts. */ uintmax_t st_nupgrade; /* Number of lock upgrades. */ uintmax_t st_ndowngrade; /* Number of lock downgrades. */ u_int32_t st_nlocks; /* Current number of locks. */ u_int32_t st_maxnlocks; /* Maximum number of locks so far. */ u_int32_t st_nobjects; /* Current number of objects. */ u_int32_t st_maxnobjects; /* Maximum number of objects so far. */ uintmax_t st_lock_wait; /* Lock conflicts w/ subsequent wait */ uintmax_t st_lock_nowait; /* Lock conflicts w/o subsequent wait */ uintmax_t st_nlocktimeouts; /* Number of lock timeouts. */ uintmax_t st_ntxntimeouts; /* Number of transaction timeouts. */ u_int32_t st_hash_len; /* Max length of bucket. */ }; struct __db_lock_pstat { /* SHARED */ u_int32_t st_nlocks; /* Current number of locks. */ u_int32_t st_maxnlocks; /* Maximum number of locks so far. */ u_int32_t st_nobjects; /* Current number of objects. */ u_int32_t st_maxnobjects; /* Maximum number of objects so far. */ uintmax_t st_locksteals; /* Number of lock steals so far. */ uintmax_t st_objectsteals; /* Number of objects steals so far. */ }; /* * DB_LOCK_ILOCK -- * Internal DB access method lock. */ struct __db_ilock { /* SHARED */ db_pgno_t pgno; /* Page being locked. */ u_int8_t fileid[DB_FILE_ID_LEN];/* File id. */ #define DB_HANDLE_LOCK 1 #define DB_RECORD_LOCK 2 #define DB_PAGE_LOCK 3 #define DB_DATABASE_LOCK 4 u_int32_t type; /* Type of lock. */ }; /* * DB_LOCK -- * The structure is allocated by the caller and filled in during a * lock_get request (or a lock_vec/DB_LOCK_GET). */ struct __db_lock_u { /* SHARED */ roff_t off; /* Offset of the lock in the region */ u_int32_t ndx; /* Index of the object referenced by * this lock; used for locking. */ u_int32_t gen; /* Generation number of this lock. */ db_lockmode_t mode; /* mode of this lock. */ }; /* Lock request structure. */ struct __db_lockreq { db_lockop_t op; /* Operation. */ db_lockmode_t mode; /* Requested mode. */ db_timeout_t timeout; /* Time to expire lock. */ DBT *obj; /* Object being locked. */ DB_LOCK lock; /* Lock returned. */ }; /******************************************************* * Logging. *******************************************************/ #define DB_LOGVERSION 19 /* Current log version. */ #define DB_LOGVERSION_LATCHING 15 /* Log version using latching: db-4.8 */ #define DB_LOGCHKSUM 12 /* Check sum headers: db-4.5 */ #define DB_LOGOLDVER 8 /* Oldest version supported: db-4.2 */ #define DB_LOGMAGIC 0x040988 /* * A DB_LSN has two parts, a fileid which identifies a specific file, and an * offset within that file. The fileid is an unsigned 4-byte quantity that * uniquely identifies a file within the log directory -- currently a simple * counter inside the log. The offset is also an unsigned 4-byte value. The * log manager guarantees the offset is never more than 4 bytes by switching * to a new log file before the maximum length imposed by an unsigned 4-byte * offset is reached. */ struct __db_lsn { /* SHARED */ u_int32_t file; /* File ID. */ u_int32_t offset; /* File offset. */ }; /* * Application-specified log record types start at DB_user_BEGIN, and must not * equal or exceed DB_debug_FLAG. * * DB_debug_FLAG is the high-bit of the u_int32_t that specifies a log record * type. If the flag is set, it's a log record that was logged for debugging * purposes only, even if it reflects a database change -- the change was part * of a non-durable transaction. */ #define DB_user_BEGIN 10000 #define DB_debug_FLAG 0x80000000 /* * DB_LOGC -- * Log cursor. */ struct __db_log_cursor { ENV *env; /* Environment */ DB_FH *fhp; /* File handle. */ DB_LSN lsn; /* Cursor: LSN */ u_int32_t len; /* Cursor: record length */ u_int32_t prev; /* Cursor: previous record's offset */ DBT dbt; /* Return DBT. */ DB_LSN p_lsn; /* Persist LSN. */ u_int32_t p_version; /* Persist version. */ u_int8_t *bp; /* Allocated read buffer. */ u_int32_t bp_size; /* Read buffer length in bytes. */ u_int32_t bp_rlen; /* Read buffer valid data length. */ DB_LSN bp_lsn; /* Read buffer first byte LSN. */ u_int32_t bp_maxrec; /* Max record length in the log file. */ /* DB_LOGC PUBLIC HANDLE LIST BEGIN */ int (*close) __P((DB_LOGC *, u_int32_t)); int (*get) __P((DB_LOGC *, DB_LSN *, DBT *, u_int32_t)); int (*version) __P((DB_LOGC *, u_int32_t *, u_int32_t)); /* DB_LOGC PUBLIC HANDLE LIST END */ #define DB_LOG_DISK 0x01 /* Log record came from disk. */ #define DB_LOG_LOCKED 0x02 /* Log region already locked */ #define DB_LOG_SILENT_ERR 0x04 /* Turn-off error messages. */ u_int32_t flags; }; /* Log statistics structure. */ struct __db_log_stat { /* SHARED */ u_int32_t st_magic; /* Log file magic number. */ u_int32_t st_version; /* Log file version number. */ int32_t st_mode; /* Log file permissions mode. */ u_int32_t st_lg_bsize; /* Log buffer size. */ u_int32_t st_lg_size; /* Log file size. */ u_int32_t st_wc_bytes; /* Bytes to log since checkpoint. */ u_int32_t st_wc_mbytes; /* Megabytes to log since checkpoint. */ u_int32_t st_fileid_init; /* Initial allocation for fileids. */ #ifndef __TEST_DB_NO_STATISTICS u_int32_t st_nfileid; /* Current number of fileids. */ u_int32_t st_maxnfileid; /* Maximum number of fileids used. */ uintmax_t st_record; /* Records entered into the log. */ u_int32_t st_w_bytes; /* Bytes to log. */ u_int32_t st_w_mbytes; /* Megabytes to log. */ uintmax_t st_wcount; /* Total I/O writes to the log. */ uintmax_t st_wcount_fill; /* Overflow writes to the log. */ uintmax_t st_rcount; /* Total I/O reads from the log. */ uintmax_t st_scount; /* Total syncs to the log. */ uintmax_t st_region_wait; /* Region lock granted after wait. */ uintmax_t st_region_nowait; /* Region lock granted without wait. */ u_int32_t st_cur_file; /* Current log file number. */ u_int32_t st_cur_offset; /* Current log file offset. */ u_int32_t st_disk_file; /* Known on disk log file number. */ u_int32_t st_disk_offset; /* Known on disk log file offset. */ u_int32_t st_maxcommitperflush; /* Max number of commits in a flush. */ u_int32_t st_mincommitperflush; /* Min number of commits in a flush. */ roff_t st_regsize; /* Region size. */ #endif }; /* * We need to record the first log record of a transaction. For user * defined logging this macro returns the place to put that information, * if it is need in rlsnp, otherwise it leaves it unchanged. We also * need to track the last record of the transaction, this returns the * place to put that info. */ #define DB_SET_TXN_LSNP(txn, blsnp, llsnp) \ ((txn)->set_txn_lsnp(txn, blsnp, llsnp)) /* * Definition of the structure which specifies marshalling of log records. */ typedef enum { LOGREC_Done, LOGREC_ARG, LOGREC_HDR, LOGREC_DATA, LOGREC_DB, LOGREC_DBOP, LOGREC_DBT, LOGREC_LOCKS, LOGREC_OP, LOGREC_PGDBT, LOGREC_PGDDBT, LOGREC_PGLIST, LOGREC_POINTER, LOGREC_TIME } log_rec_type_t; typedef const struct __log_rec_spec { log_rec_type_t type; u_int32_t offset; const char *name; const char fmt[4]; } DB_LOG_RECSPEC; /* * Size of a DBT in a log record. */ #define LOG_DBT_SIZE(dbt) \ (sizeof(u_int32_t) + ((dbt) == NULL ? 0 : (dbt)->size)) /******************************************************* * Shared buffer cache (mpool). *******************************************************/ /* Priority values for DB_MPOOLFILE->{put,set_priority}. */ typedef enum { DB_PRIORITY_UNCHANGED=0, DB_PRIORITY_VERY_LOW=1, DB_PRIORITY_LOW=2, DB_PRIORITY_DEFAULT=3, DB_PRIORITY_HIGH=4, DB_PRIORITY_VERY_HIGH=5 } DB_CACHE_PRIORITY; /* Per-process DB_MPOOLFILE information. */ struct __db_mpoolfile { DB_FH *fhp; /* Underlying file handle. */ /* * !!! * The ref, pinref and q fields are protected by the region lock. */ u_int32_t ref; /* Reference count. */ u_int32_t pinref; /* Pinned block reference count. */ /* * !!! * Explicit representations of structures from queue.h. * TAILQ_ENTRY(__db_mpoolfile) q; */ struct { struct __db_mpoolfile *tqe_next; struct __db_mpoolfile **tqe_prev; } q; /* Linked list of DB_MPOOLFILE's. */ /* * !!! * The rest of the fields (with the exception of the MP_FLUSH flag) * are not thread-protected, even when they may be modified at any * time by the application. The reason is the DB_MPOOLFILE handle * is single-threaded from the viewpoint of the application, and so * the only fields needing to be thread-protected are those accessed * by checkpoint or sync threads when using DB_MPOOLFILE structures * to flush buffers from the cache. */ ENV *env; /* Environment */ MPOOLFILE *mfp; /* Underlying MPOOLFILE. */ u_int32_t clear_len; /* Cleared length on created pages. */ u_int8_t /* Unique file ID. */ fileid[DB_FILE_ID_LEN]; int ftype; /* File type. */ int32_t lsn_offset; /* LSN offset in page. */ u_int32_t gbytes, bytes; /* Maximum file size. */ DBT *pgcookie; /* Byte-string passed to pgin/pgout. */ int32_t priority; /* Cache priority. */ void *addr; /* Address of mmap'd region. */ size_t len; /* Length of mmap'd region. */ u_int32_t config_flags; /* Flags to DB_MPOOLFILE->set_flags. */ /* DB_MPOOLFILE PUBLIC HANDLE LIST BEGIN */ int (*close) __P((DB_MPOOLFILE *, u_int32_t)); int (*get) __P((DB_MPOOLFILE *, db_pgno_t *, DB_TXN *, u_int32_t, void *)); int (*get_clear_len) __P((DB_MPOOLFILE *, u_int32_t *)); int (*get_fileid) __P((DB_MPOOLFILE *, u_int8_t *)); int (*get_flags) __P((DB_MPOOLFILE *, u_int32_t *)); int (*get_ftype) __P((DB_MPOOLFILE *, int *)); int (*get_last_pgno) __P((DB_MPOOLFILE *, db_pgno_t *)); int (*get_lsn_offset) __P((DB_MPOOLFILE *, int32_t *)); int (*get_maxsize) __P((DB_MPOOLFILE *, u_int32_t *, u_int32_t *)); int (*get_pgcookie) __P((DB_MPOOLFILE *, DBT *)); int (*get_priority) __P((DB_MPOOLFILE *, DB_CACHE_PRIORITY *)); int (*open) __P((DB_MPOOLFILE *, const char *, u_int32_t, int, size_t)); int (*put) __P((DB_MPOOLFILE *, void *, DB_CACHE_PRIORITY, u_int32_t)); int (*set_clear_len) __P((DB_MPOOLFILE *, u_int32_t)); int (*set_fileid) __P((DB_MPOOLFILE *, u_int8_t *)); int (*set_flags) __P((DB_MPOOLFILE *, u_int32_t, int)); int (*set_ftype) __P((DB_MPOOLFILE *, int)); int (*set_lsn_offset) __P((DB_MPOOLFILE *, int32_t)); int (*set_maxsize) __P((DB_MPOOLFILE *, u_int32_t, u_int32_t)); int (*set_pgcookie) __P((DB_MPOOLFILE *, DBT *)); int (*set_priority) __P((DB_MPOOLFILE *, DB_CACHE_PRIORITY)); int (*sync) __P((DB_MPOOLFILE *)); /* DB_MPOOLFILE PUBLIC HANDLE LIST END */ /* * MP_FILEID_SET, MP_OPEN_CALLED and MP_READONLY do not need to be * thread protected because they are initialized before the file is * linked onto the per-process lists, and never modified. * * MP_FLUSH is thread protected because it is potentially read/set by * multiple threads of control. */ #define MP_FILEID_SET 0x001 /* Application supplied a file ID. */ #define MP_FLUSH 0x002 /* Was used to flush a buffer. */ #define MP_FOR_FLUSH 0x004 /* Was opened to flush a buffer. */ #define MP_MULTIVERSION 0x008 /* Opened for multiversion access. */ #define MP_OPEN_CALLED 0x010 /* File opened. */ #define MP_READONLY 0x020 /* File is readonly. */ #define MP_DUMMY 0x040 /* File is dummy for __memp_fput. */ u_int32_t flags; }; /* Mpool statistics structure. */ struct __db_mpool_stat { /* SHARED */ u_int32_t st_gbytes; /* Total cache size: GB. */ u_int32_t st_bytes; /* Total cache size: B. */ u_int32_t st_ncache; /* Number of cache regions. */ u_int32_t st_max_ncache; /* Maximum number of regions. */ db_size_t st_mmapsize; /* Maximum file size for mmap. */ int32_t st_maxopenfd; /* Maximum number of open fd's. */ int32_t st_maxwrite; /* Maximum buffers to write. */ db_timeout_t st_maxwrite_sleep; /* Sleep after writing max buffers. */ u_int32_t st_pages; /* Total number of pages. */ #ifndef __TEST_DB_NO_STATISTICS u_int32_t st_map; /* Pages from mapped files. */ uintmax_t st_cache_hit; /* Pages found in the cache. */ uintmax_t st_cache_miss; /* Pages not found in the cache. */ uintmax_t st_page_create; /* Pages created in the cache. */ uintmax_t st_page_in; /* Pages read in. */ uintmax_t st_page_out; /* Pages written out. */ uintmax_t st_ro_evict; /* Clean pages forced from the cache. */ uintmax_t st_rw_evict; /* Dirty pages forced from the cache. */ uintmax_t st_page_trickle; /* Pages written by memp_trickle. */ u_int32_t st_page_clean; /* Clean pages. */ u_int32_t st_page_dirty; /* Dirty pages. */ u_int32_t st_hash_buckets; /* Number of hash buckets. */ u_int32_t st_hash_mutexes; /* Number of hash bucket mutexes. */ u_int32_t st_pagesize; /* Assumed page size. */ u_int32_t st_hash_searches; /* Total hash chain searches. */ u_int32_t st_hash_longest; /* Longest hash chain searched. */ uintmax_t st_hash_examined; /* Total hash entries searched. */ uintmax_t st_hash_nowait; /* Hash lock granted with nowait. */ uintmax_t st_hash_wait; /* Hash lock granted after wait. */ uintmax_t st_hash_max_nowait; /* Max hash lock granted with nowait. */ uintmax_t st_hash_max_wait; /* Max hash lock granted after wait. */ uintmax_t st_region_nowait; /* Region lock granted with nowait. */ uintmax_t st_region_wait; /* Region lock granted after wait. */ uintmax_t st_mvcc_frozen; /* Buffers frozen. */ uintmax_t st_mvcc_thawed; /* Buffers thawed. */ uintmax_t st_mvcc_freed; /* Frozen buffers freed. */ uintmax_t st_alloc; /* Number of page allocations. */ uintmax_t st_alloc_buckets; /* Buckets checked during allocation. */ uintmax_t st_alloc_max_buckets;/* Max checked during allocation. */ uintmax_t st_alloc_pages; /* Pages checked during allocation. */ uintmax_t st_alloc_max_pages; /* Max checked during allocation. */ uintmax_t st_io_wait; /* Thread waited on buffer I/O. */ uintmax_t st_sync_interrupted; /* Number of times sync interrupted. */ roff_t st_regsize; /* Region size. */ roff_t st_regmax; /* Region max. */ #endif }; /* * Mpool file statistics structure. * The first fields in this structure must mirror the __db_mpool_fstat_int * structure, since content is mem copied between the two. */ struct __db_mpool_fstat { u_int32_t st_pagesize; /* Page size. */ #ifndef __TEST_DB_NO_STATISTICS u_int32_t st_map; /* Pages from mapped files. */ uintmax_t st_cache_hit; /* Pages found in the cache. */ uintmax_t st_cache_miss; /* Pages not found in the cache. */ uintmax_t st_page_create; /* Pages created in the cache. */ uintmax_t st_page_in; /* Pages read in. */ uintmax_t st_page_out; /* Pages written out. */ uintmax_t st_backup_spins; /* Number of spins during a copy. */ #endif char *file_name; /* File name. */ }; /******************************************************* * Transactions and recovery. *******************************************************/ #define DB_TXNVERSION 1 typedef enum { DB_TXN_ABORT=0, /* Public. */ DB_TXN_APPLY=1, /* Public. */ DB_TXN_BACKWARD_ROLL=3, /* Public. */ DB_TXN_FORWARD_ROLL=4, /* Public. */ DB_TXN_OPENFILES=5, /* Internal. */ DB_TXN_POPENFILES=6, /* Internal. */ DB_TXN_PRINT=7, /* Public. */ DB_TXN_LOG_VERIFY=8 /* Internal. */ } db_recops; /* * BACKWARD_ALLOC is used during the forward pass to pick up any aborted * allocations for files that were created during the forward pass. * The main difference between _ALLOC and _ROLL is that the entry for * the file not exist during the rollforward pass. */ #define DB_UNDO(op) ((op) == DB_TXN_ABORT || (op) == DB_TXN_BACKWARD_ROLL) #define DB_REDO(op) ((op) == DB_TXN_FORWARD_ROLL || (op) == DB_TXN_APPLY) struct __db_txn { DB_TXNMGR *mgrp; /* Pointer to transaction manager. */ DB_TXN *parent; /* Pointer to transaction's parent. */ DB_THREAD_INFO *thread_info; /* Pointer to thread information. */ u_int32_t txnid; /* Unique transaction id. */ char *name; /* Transaction name. */ DB_LOCKER *locker; /* Locker for this txn. */ void *td; /* Detail structure within region. */ db_timeout_t lock_timeout; /* Timeout for locks for this txn. */ void *txn_list; /* Undo information for parent. */ /* * !!! * Explicit representations of structures from queue.h. * TAILQ_ENTRY(__db_txn) links; */ struct { struct __db_txn *tqe_next; struct __db_txn **tqe_prev; } links; /* Links transactions off manager. */ /* * !!! * Explicit representations of structures from shqueue.h. * SH_TAILQ_ENTRY xa_links; * These links link together transactions that are active in * the same thread of control. */ struct { db_ssize_t stqe_next; db_ssize_t stqe_prev; } xa_links; /* Links XA transactions. */ /* * !!! * Explicit representations of structures from queue.h. * TAILQ_HEAD(__kids, __db_txn) kids; */ struct __kids { struct __db_txn *tqh_first; struct __db_txn **tqh_last; } kids; /* * !!! * Explicit representations of structures from queue.h. * TAILQ_HEAD(__events, __txn_event) events; */ struct { struct __txn_event *tqh_first; struct __txn_event **tqh_last; } events; /* Links deferred events. */ /* * !!! * Explicit representations of structures from queue.h. * STAILQ_HEAD(__logrec, __txn_logrec) logs; */ struct { struct __txn_logrec *stqh_first; struct __txn_logrec **stqh_last; } logs; /* Links in memory log records. */ /* * !!! * Explicit representations of structures from queue.h. * TAILQ_ENTRY(__db_txn) klinks; */ struct { struct __db_txn *tqe_next; struct __db_txn **tqe_prev; } klinks; /* Links of children in parent. */ /* * !!! * Explicit representations of structures from queue.h. * TAILQ_HEAD(__my_cursors, __dbc) my_cursors; */ struct __my_cursors { struct __dbc *tqh_first; struct __dbc **tqh_last; } my_cursors; /* * !!! * Explicit representations of structures from queue.h. * TAILQ_HEAD(__femfs, MPOOLFILE) femfs; * * These are DBs involved in file extension in this transaction. */ struct __femfs { DB *tqh_first; DB **tqh_last; } femfs; DB_TXN_TOKEN *token_buffer; /* User's commit token buffer. */ void *api_internal; /* C++ API private. */ void *xml_internal; /* XML API private. */ u_int32_t cursors; /* Number of cursors open for txn */ /* DB_TXN PUBLIC HANDLE LIST BEGIN */ int (*abort) __P((DB_TXN *)); int (*commit) __P((DB_TXN *, u_int32_t)); int (*discard) __P((DB_TXN *, u_int32_t)); int (*get_name) __P((DB_TXN *, const char **)); int (*get_priority) __P((DB_TXN *, u_int32_t *)); u_int32_t (*id) __P((DB_TXN *)); int (*prepare) __P((DB_TXN *, u_int8_t *)); int (*set_commit_token) __P((DB_TXN *, DB_TXN_TOKEN *)); int (*set_name) __P((DB_TXN *, const char *)); int (*set_priority) __P((DB_TXN *, u_int32_t)); int (*set_timeout) __P((DB_TXN *, db_timeout_t, u_int32_t)); /* DB_TXN PUBLIC HANDLE LIST END */ /* DB_TXN PRIVATE HANDLE LIST BEGIN */ void (*set_txn_lsnp) __P((DB_TXN *txn, DB_LSN **, DB_LSN **)); /* DB_TXN PRIVATE HANDLE LIST END */ #define TXN_XA_THREAD_NOTA 0 #define TXN_XA_THREAD_ASSOCIATED 1 #define TXN_XA_THREAD_SUSPENDED 2 #define TXN_XA_THREAD_UNASSOCIATED 3 u_int32_t xa_thr_status; #define TXN_CHILDCOMMIT 0x00001 /* Txn has committed. */ #define TXN_COMPENSATE 0x00002 /* Compensating transaction. */ #define TXN_DEADLOCK 0x00004 /* Txn has deadlocked. */ #define TXN_FAMILY 0x00008 /* Cursors/children are independent. */ #define TXN_IGNORE_LEASE 0x00010 /* Skip lease check at commit time. */ #define TXN_INFAMILY 0x00020 /* Part of a transaction family. */ #define TXN_LOCKTIMEOUT 0x00040 /* Txn has a lock timeout. */ #define TXN_MALLOC 0x00080 /* Structure allocated by TXN system. */ #define TXN_NOSYNC 0x00100 /* Do not sync on prepare and commit. */ #define TXN_NOWAIT 0x00200 /* Do not wait on locks. */ #define TXN_PRIVATE 0x00400 /* Txn owned by cursor. */ #define TXN_READONLY 0x00800 /* CDS group handle. */ #define TXN_READ_COMMITTED 0x01000 /* Txn has degree 2 isolation. */ #define TXN_READ_UNCOMMITTED 0x02000 /* Txn has degree 1 isolation. */ #define TXN_RESTORED 0x04000 /* Txn has been restored. */ #define TXN_SNAPSHOT 0x08000 /* Snapshot Isolation. */ #define TXN_SYNC 0x10000 /* Write and sync on prepare/commit. */ #define TXN_WRITE_NOSYNC 0x20000 /* Write only on prepare/commit. */ #define TXN_BULK 0x40000 /* Enable bulk loading optimization. */ u_int32_t flags; }; #define TXN_SYNC_FLAGS (TXN_SYNC | TXN_NOSYNC | TXN_WRITE_NOSYNC) /* * Structure used for two phase commit interface. * We set the size of our global transaction id (gid) to be 128 in order * to match that defined by the XA X/Open standard. */ #define DB_GID_SIZE 128 struct __db_preplist { DB_TXN *txn; u_int8_t gid[DB_GID_SIZE]; }; /* Transaction statistics structure. */ struct __db_txn_active { u_int32_t txnid; /* Transaction ID */ u_int32_t parentid; /* Transaction ID of parent */ pid_t pid; /* Process owning txn ID */ db_threadid_t tid; /* Thread owning txn ID */ DB_LSN lsn; /* LSN when transaction began */ DB_LSN read_lsn; /* Read LSN for MVCC */ u_int32_t mvcc_ref; /* MVCC reference count */ u_int32_t priority; /* Deadlock resolution priority */ #define TXN_ABORTED 1 #define TXN_COMMITTED 2 #define TXN_NEED_ABORT 3 #define TXN_PREPARED 4 #define TXN_RUNNING 5 u_int32_t status; /* Status of the transaction */ #define TXN_XA_ACTIVE 1 #define TXN_XA_DEADLOCKED 2 #define TXN_XA_IDLE 3 #define TXN_XA_PREPARED 4 #define TXN_XA_ROLLEDBACK 5 u_int32_t xa_status; /* XA status */ u_int8_t gid[DB_GID_SIZE]; /* Global transaction ID */ char name[51]; /* 50 bytes of name, nul termination */ }; struct __db_txn_stat { u_int32_t st_nrestores; /* number of restored transactions after recovery. */ #ifndef __TEST_DB_NO_STATISTICS DB_LSN st_last_ckp; /* lsn of the last checkpoint */ time_t st_time_ckp; /* time of last checkpoint */ u_int32_t st_last_txnid; /* last transaction id given out */ u_int32_t st_inittxns; /* inital txns allocated */ u_int32_t st_maxtxns; /* maximum txns possible */ uintmax_t st_naborts; /* number of aborted transactions */ uintmax_t st_nbegins; /* number of begun transactions */ uintmax_t st_ncommits; /* number of committed transactions */ u_int32_t st_nactive; /* number of active transactions */ u_int32_t st_nsnapshot; /* number of snapshot transactions */ u_int32_t st_maxnactive; /* maximum active transactions */ u_int32_t st_maxnsnapshot; /* maximum snapshot transactions */ uintmax_t st_region_wait; /* Region lock granted after wait. */ uintmax_t st_region_nowait; /* Region lock granted without wait. */ roff_t st_regsize; /* Region size. */ DB_TXN_ACTIVE *st_txnarray; /* array of active transactions */ #endif }; #define DB_TXN_TOKEN_SIZE 20 struct __db_txn_token { u_int8_t buf[DB_TXN_TOKEN_SIZE]; }; /******************************************************* * Replication. *******************************************************/ /* Special, out-of-band environment IDs. */ #define DB_EID_BROADCAST -1 #define DB_EID_INVALID -2 #define DB_EID_MASTER -3 #define DB_REP_DEFAULT_PRIORITY 100 /* Acknowledgement policies; 0 reserved as OOB. */ #define DB_REPMGR_ACKS_ALL 1 #define DB_REPMGR_ACKS_ALL_AVAILABLE 2 #define DB_REPMGR_ACKS_ALL_PEERS 3 #define DB_REPMGR_ACKS_NONE 4 #define DB_REPMGR_ACKS_ONE 5 #define DB_REPMGR_ACKS_ONE_PEER 6 #define DB_REPMGR_ACKS_QUORUM 7 /* Replication timeout configuration values. */ #define DB_REP_ACK_TIMEOUT 1 /* RepMgr acknowledgements. */ #define DB_REP_CHECKPOINT_DELAY 2 /* Master checkpoint delay. */ #define DB_REP_CONNECTION_RETRY 3 /* RepMgr connections. */ #define DB_REP_ELECTION_RETRY 4 /* RepMgr elect retries. */ #define DB_REP_ELECTION_TIMEOUT 5 /* Rep normal elections. */ #define DB_REP_FULL_ELECTION_TIMEOUT 6 /* Rep full elections. */ #define DB_REP_HEARTBEAT_MONITOR 7 /* RepMgr client HB monitor. */ #define DB_REP_HEARTBEAT_SEND 8 /* RepMgr master send freq. */ #define DB_REP_LEASE_TIMEOUT 9 /* Master leases. */ /* * Event notification types. (Tcl testing interface currently assumes there are * no more than 32 of these.) */ #define DB_EVENT_PANIC 0 #define DB_EVENT_REG_ALIVE 1 #define DB_EVENT_REG_PANIC 2 #define DB_EVENT_REP_CLIENT 3 #define DB_EVENT_REP_CONNECT_BROKEN 4 #define DB_EVENT_REP_CONNECT_ESTD 5 #define DB_EVENT_REP_CONNECT_TRY_FAILED 6 #define DB_EVENT_REP_DUPMASTER 7 #define DB_EVENT_REP_ELECTED 8 #define DB_EVENT_REP_ELECTION_FAILED 9 #define DB_EVENT_REP_INIT_DONE 10 #define DB_EVENT_REP_JOIN_FAILURE 11 #define DB_EVENT_REP_LOCAL_SITE_REMOVED 12 #define DB_EVENT_REP_MASTER 13 #define DB_EVENT_REP_MASTER_FAILURE 14 #define DB_EVENT_REP_NEWMASTER 15 #define DB_EVENT_REP_PERM_FAILED 16 #define DB_EVENT_REP_SITE_ADDED 17 #define DB_EVENT_REP_SITE_REMOVED 18 #define DB_EVENT_REP_STARTUPDONE 19 #define DB_EVENT_REP_WOULD_ROLLBACK 20 /* Undocumented; C API only. */ #define DB_EVENT_WRITE_FAILED 21 #define DB_EVENT_NO_SUCH_EVENT 0xffffffff /* OOB sentinel value */ /* Replication Manager site status. */ struct __db_repmgr_site { int eid; char *host; u_int port; #define DB_REPMGR_CONNECTED 1 #define DB_REPMGR_DISCONNECTED 2 u_int32_t status; #define DB_REPMGR_ISPEER 0x01 u_int32_t flags; }; /* Replication statistics. */ struct __db_rep_stat { /* SHARED */ /* !!! * Many replication statistics fields cannot be protected by a mutex * without an unacceptable performance penalty, since most message * processing is done without the need to hold a region-wide lock. * Fields whose comments end with a '+' may be updated without holding * the replication or log mutexes (as appropriate), and thus may be * off somewhat (or, on unreasonable architectures under unlucky * circumstances, garbaged). */ u_int32_t st_startup_complete; /* Site completed client sync-up. */ #ifndef __TEST_DB_NO_STATISTICS uintmax_t st_log_queued; /* Log records currently queued.+ */ u_int32_t st_status; /* Current replication status. */ DB_LSN st_next_lsn; /* Next LSN to use or expect. */ DB_LSN st_waiting_lsn; /* LSN we're awaiting, if any. */ DB_LSN st_max_perm_lsn; /* Maximum permanent LSN. */ db_pgno_t st_next_pg; /* Next pg we expect. */ db_pgno_t st_waiting_pg; /* pg we're awaiting, if any. */ u_int32_t st_dupmasters; /* # of times a duplicate master condition was detected.+ */ db_ssize_t st_env_id; /* Current environment ID. */ u_int32_t st_env_priority; /* Current environment priority. */ uintmax_t st_bulk_fills; /* Bulk buffer fills. */ uintmax_t st_bulk_overflows; /* Bulk buffer overflows. */ uintmax_t st_bulk_records; /* Bulk records stored. */ uintmax_t st_bulk_transfers; /* Transfers of bulk buffers. */ uintmax_t st_client_rerequests;/* Number of forced rerequests. */ uintmax_t st_client_svc_req; /* Number of client service requests received by this client. */ uintmax_t st_client_svc_miss; /* Number of client service requests missing on this client. */ u_int32_t st_gen; /* Current generation number. */ u_int32_t st_egen; /* Current election gen number. */ uintmax_t st_lease_chk; /* Lease validity checks. */ uintmax_t st_lease_chk_misses; /* Lease checks invalid. */ uintmax_t st_lease_chk_refresh; /* Lease refresh attempts. */ uintmax_t st_lease_sends; /* Lease messages sent live. */ uintmax_t st_log_duplicated; /* Log records received multiply.+ */ uintmax_t st_log_queued_max; /* Max. log records queued at once.+ */ uintmax_t st_log_queued_total; /* Total # of log recs. ever queued.+ */ uintmax_t st_log_records; /* Log records received and put.+ */ uintmax_t st_log_requested; /* Log recs. missed and requested.+ */ db_ssize_t st_master; /* Env. ID of the current master. */ uintmax_t st_master_changes; /* # of times we've switched masters. */ uintmax_t st_msgs_badgen; /* Messages with a bad generation #.+ */ uintmax_t st_msgs_processed; /* Messages received and processed.+ */ uintmax_t st_msgs_recover; /* Messages ignored because this site was a client in recovery.+ */ uintmax_t st_msgs_send_failures;/* # of failed message sends.+ */ uintmax_t st_msgs_sent; /* # of successful message sends.+ */ uintmax_t st_newsites; /* # of NEWSITE msgs. received.+ */ u_int32_t st_nsites; /* Current number of sites we will assume during elections. */ uintmax_t st_nthrottles; /* # of times we were throttled. */ uintmax_t st_outdated; /* # of times we detected and returned an OUTDATED condition.+ */ uintmax_t st_pg_duplicated; /* Pages received multiply.+ */ uintmax_t st_pg_records; /* Pages received and stored.+ */ uintmax_t st_pg_requested; /* Pages missed and requested.+ */ uintmax_t st_txns_applied; /* # of transactions applied.+ */ uintmax_t st_startsync_delayed;/* # of STARTSYNC msgs delayed.+ */ /* Elections generally. */ uintmax_t st_elections; /* # of elections held.+ */ uintmax_t st_elections_won; /* # of elections won by this site.+ */ /* Statistics about an in-progress election. */ db_ssize_t st_election_cur_winner; /* Current front-runner. */ u_int32_t st_election_gen; /* Election generation number. */ u_int32_t st_election_datagen; /* Election data generation number. */ DB_LSN st_election_lsn; /* Max. LSN of current winner. */ u_int32_t st_election_nsites; /* # of "registered voters". */ u_int32_t st_election_nvotes; /* # of "registered voters" needed. */ u_int32_t st_election_priority; /* Current election priority. */ int32_t st_election_status; /* Current election status. */ u_int32_t st_election_tiebreaker;/* Election tiebreaker value. */ u_int32_t st_election_votes; /* Votes received in this round. */ u_int32_t st_election_sec; /* Last election time seconds. */ u_int32_t st_election_usec; /* Last election time useconds. */ u_int32_t st_max_lease_sec; /* Maximum lease timestamp seconds. */ u_int32_t st_max_lease_usec; /* Maximum lease timestamp useconds. */ /* Undocumented statistics only used by the test system. */ #ifdef CONFIG_TEST u_int32_t st_filefail_cleanups; /* # of FILE_FAIL cleanups done. */ #endif #endif }; /* Replication Manager statistics. */ struct __db_repmgr_stat { /* SHARED */ uintmax_t st_perm_failed; /* # of insufficiently ack'ed msgs. */ uintmax_t st_msgs_queued; /* # msgs queued for network delay. */ uintmax_t st_msgs_dropped; /* # msgs discarded due to excessive queue length. */ uintmax_t st_connection_drop; /* Existing connections dropped. */ uintmax_t st_connect_fail; /* Failed new connection attempts. */ uintmax_t st_elect_threads; /* # of active election threads. */ uintmax_t st_max_elect_threads; /* Max concurrent e-threads ever. */ }; /* Replication Manager connection error. */ struct __db_repmgr_conn_err { int eid; /* Replication Environment ID. */ int error; /* System networking error code. */ }; /******************************************************* * Sequences. *******************************************************/ /* * The storage record for a sequence. */ struct __db_seq_record { u_int32_t seq_version; /* Version size/number. */ u_int32_t flags; /* DB_SEQ_XXX Flags. */ db_seq_t seq_value; /* Current value. */ db_seq_t seq_max; /* Max permitted. */ db_seq_t seq_min; /* Min permitted. */ }; /* * Handle for a sequence object. */ struct __db_sequence { DB *seq_dbp; /* DB handle for this sequence. */ db_mutex_t mtx_seq; /* Mutex if sequence is threaded. */ DB_SEQ_RECORD *seq_rp; /* Pointer to current data. */ DB_SEQ_RECORD seq_record; /* Data from DB_SEQUENCE. */ int32_t seq_cache_size; /* Number of values cached. */ db_seq_t seq_last_value; /* Last value cached. */ db_seq_t seq_prev_value; /* Last value returned. */ DBT seq_key; /* DBT pointing to sequence key. */ DBT seq_data; /* DBT pointing to seq_record. */ /* API-private structure: used by C++ and Java. */ void *api_internal; /* DB_SEQUENCE PUBLIC HANDLE LIST BEGIN */ int (*close) __P((DB_SEQUENCE *, u_int32_t)); int (*get) __P((DB_SEQUENCE *, DB_TXN *, int32_t, db_seq_t *, u_int32_t)); int (*get_cachesize) __P((DB_SEQUENCE *, int32_t *)); int (*get_db) __P((DB_SEQUENCE *, DB **)); int (*get_flags) __P((DB_SEQUENCE *, u_int32_t *)); int (*get_key) __P((DB_SEQUENCE *, DBT *)); int (*get_range) __P((DB_SEQUENCE *, db_seq_t *, db_seq_t *)); int (*initial_value) __P((DB_SEQUENCE *, db_seq_t)); int (*open) __P((DB_SEQUENCE *, DB_TXN *, DBT *, u_int32_t)); int (*remove) __P((DB_SEQUENCE *, DB_TXN *, u_int32_t)); int (*set_cachesize) __P((DB_SEQUENCE *, int32_t)); int (*set_flags) __P((DB_SEQUENCE *, u_int32_t)); int (*set_range) __P((DB_SEQUENCE *, db_seq_t, db_seq_t)); int (*stat) __P((DB_SEQUENCE *, DB_SEQUENCE_STAT **, u_int32_t)); int (*stat_print) __P((DB_SEQUENCE *, u_int32_t)); /* DB_SEQUENCE PUBLIC HANDLE LIST END */ }; struct __db_seq_stat { /* SHARED */ uintmax_t st_wait; /* Sequence lock granted w/o wait. */ uintmax_t st_nowait; /* Sequence lock granted after wait. */ db_seq_t st_current; /* Current value in db. */ db_seq_t st_value; /* Current cached value. */ db_seq_t st_last_value; /* Last cached value. */ db_seq_t st_min; /* Minimum value. */ db_seq_t st_max; /* Maximum value. */ int32_t st_cache_size; /* Cache size. */ u_int32_t st_flags; /* Flag value. */ }; /******************************************************* * Access methods. *******************************************************/ /* * Any new methods need to retain the original numbering. The type * is written in a log record so must be maintained. */ typedef enum { DB_BTREE=1, DB_HASH=2, DB_HEAP=6, DB_RECNO=3, DB_QUEUE=4, DB_UNKNOWN=5 /* Figure it out on open. */ } DBTYPE; #define DB_RENAMEMAGIC 0x030800 /* File has been renamed. */ #define DB_BTREEVERSION 9 /* Current btree version. */ #define DB_BTREEOLDVER 8 /* Oldest btree version supported. */ #define DB_BTREEMAGIC 0x053162 #define DB_HASHVERSION 9 /* Current hash version. */ #define DB_HASHOLDVER 7 /* Oldest hash version supported. */ #define DB_HASHMAGIC 0x061561 #define DB_HEAPVERSION 1 /* Current heap version. */ #define DB_HEAPOLDVER 1 /* Oldest heap version supported. */ #define DB_HEAPMAGIC 0x074582 #define DB_QAMVERSION 4 /* Current queue version. */ #define DB_QAMOLDVER 3 /* Oldest queue version supported. */ #define DB_QAMMAGIC 0x042253 #define DB_SEQUENCE_VERSION 2 /* Current sequence version. */ #define DB_SEQUENCE_OLDVER 1 /* Oldest sequence version supported. */ /* * DB access method and cursor operation values. Each value is an operation * code to which additional bit flags are added. */ #define DB_AFTER 1 /* Dbc.put */ #define DB_APPEND 2 /* Db.put */ #define DB_BEFORE 3 /* Dbc.put */ #define DB_CONSUME 4 /* Db.get */ #define DB_CONSUME_WAIT 5 /* Db.get */ #define DB_CURRENT 6 /* Dbc.get, Dbc.put, DbLogc.get */ #define DB_FIRST 7 /* Dbc.get, DbLogc->get */ #define DB_GET_BOTH 8 /* Db.get, Dbc.get */ #define DB_GET_BOTHC 9 /* Dbc.get (internal) */ #define DB_GET_BOTH_RANGE 10 /* Db.get, Dbc.get */ #define DB_GET_RECNO 11 /* Dbc.get */ #define DB_JOIN_ITEM 12 /* Dbc.get; don't do primary lookup */ #define DB_KEYFIRST 13 /* Dbc.put */ #define DB_KEYLAST 14 /* Dbc.put */ #define DB_LAST 15 /* Dbc.get, DbLogc->get */ #define DB_NEXT 16 /* Dbc.get, DbLogc->get */ #define DB_NEXT_DUP 17 /* Dbc.get */ #define DB_NEXT_NODUP 18 /* Dbc.get */ #define DB_NODUPDATA 19 /* Db.put, Dbc.put */ #define DB_NOOVERWRITE 20 /* Db.put */ #define DB_OVERWRITE_DUP 21 /* Dbc.put, Db.put; no DB_KEYEXIST */ #define DB_POSITION 22 /* Dbc.dup */ #define DB_PREV 23 /* Dbc.get, DbLogc->get */ #define DB_PREV_DUP 24 /* Dbc.get */ #define DB_PREV_NODUP 25 /* Dbc.get */ #define DB_SET 26 /* Dbc.get, DbLogc->get */ #define DB_SET_RANGE 27 /* Dbc.get */ #define DB_SET_RECNO 28 /* Db.get, Dbc.get */ #define DB_UPDATE_SECONDARY 29 /* Dbc.get, Dbc.del (internal) */ #define DB_SET_LTE 30 /* Dbc.get (internal) */ #define DB_GET_BOTH_LTE 31 /* Dbc.get (internal) */ /* This has to change when the max opcode hits 255. */ #define DB_OPFLAGS_MASK 0x000000ff /* Mask for operations flags. */ /* * DB (user visible) error return codes. * * !!! * We don't want our error returns to conflict with other packages where * possible, so pick a base error value that's hopefully not common. We * document that we own the error name space from -30,800 to -30,999. */ /* DB (public) error return codes. */ #define DB_BUFFER_SMALL (-30999)/* User memory too small for return. */ #define DB_DONOTINDEX (-30998)/* "Null" return from 2ndary callbk. */ #define DB_FOREIGN_CONFLICT (-30997)/* A foreign db constraint triggered. */ #define DB_HEAP_FULL (-30996)/* No free space in a heap file. */ #define DB_KEYEMPTY (-30995)/* Key/data deleted or never created. */ #define DB_KEYEXIST (-30994)/* The key/data pair already exists. */ #define DB_LOCK_DEADLOCK (-30993)/* Deadlock. */ #define DB_LOCK_NOTGRANTED (-30992)/* Lock unavailable. */ #define DB_LOG_BUFFER_FULL (-30991)/* In-memory log buffer full. */ #define DB_LOG_VERIFY_BAD (-30990)/* Log verification failed. */ #define DB_NOSERVER (-30989)/* Server panic return. */ #define DB_NOTFOUND (-30988)/* Key/data pair not found (EOF). */ #define DB_OLD_VERSION (-30987)/* Out-of-date version. */ #define DB_PAGE_NOTFOUND (-30986)/* Requested page not found. */ #define DB_REP_DUPMASTER (-30985)/* There are two masters. */ #define DB_REP_HANDLE_DEAD (-30984)/* Rolled back a commit. */ #define DB_REP_HOLDELECTION (-30983)/* Time to hold an election. */ #define DB_REP_IGNORE (-30982)/* This msg should be ignored.*/ #define DB_REP_ISPERM (-30981)/* Cached not written perm written.*/ #define DB_REP_JOIN_FAILURE (-30980)/* Unable to join replication group. */ #define DB_REP_LEASE_EXPIRED (-30979)/* Master lease has expired. */ #define DB_REP_LOCKOUT (-30978)/* API/Replication lockout now. */ #define DB_REP_NEWSITE (-30977)/* New site entered system. */ #define DB_REP_NOTPERM (-30976)/* Permanent log record not written. */ #define DB_REP_UNAVAIL (-30975)/* Site cannot currently be reached. */ #define DB_REP_WOULDROLLBACK (-30974)/* UNDOC: rollback inhibited by app. */ #define DB_RUNRECOVERY (-30973)/* Panic return. */ #define DB_SECONDARY_BAD (-30972)/* Secondary index corrupt. */ #define DB_TIMEOUT (-30971)/* Timed out on read consistency. */ #define DB_VERIFY_BAD (-30970)/* Verify failed; bad format. */ #define DB_VERSION_MISMATCH (-30969)/* Environment version mismatch. */ /* DB (private) error return codes. */ #define DB_ALREADY_ABORTED (-30899) #define DB_CHKSUM_FAIL (-30898)/* Checksum failed. */ #define DB_DELETED (-30897)/* Recovery file marked deleted. */ #define DB_EVENT_NOT_HANDLED (-30896)/* Forward event to application. */ #define DB_NEEDSPLIT (-30895)/* Page needs to be split. */ #define DB_REP_BULKOVF (-30894)/* Rep bulk buffer overflow. */ #define DB_REP_LOGREADY (-30893)/* Rep log ready for recovery. */ #define DB_REP_NEWMASTER (-30892)/* We have learned of a new master. */ #define DB_REP_PAGEDONE (-30891)/* This page was already done. */ #define DB_SURPRISE_KID (-30890)/* Child commit where parent didn't know it was a parent. */ #define DB_SWAPBYTES (-30889)/* Database needs byte swapping. */ #define DB_TXN_CKP (-30888)/* Encountered ckp record in log. */ #define DB_VERIFY_FATAL (-30887)/* DB->verify cannot proceed. */ /* Database handle. */ struct __db { /******************************************************* * Public: owned by the application. *******************************************************/ u_int32_t pgsize; /* Database logical page size. */ DB_CACHE_PRIORITY priority; /* Database priority in cache. */ /* Callbacks. */ int (*db_append_recno) __P((DB *, DBT *, db_recno_t)); void (*db_feedback) __P((DB *, int, int)); int (*dup_compare) __P((DB *, const DBT *, const DBT *)); void *app_private; /* Application-private handle. */ /******************************************************* * Private: owned by DB. *******************************************************/ DB_ENV *dbenv; /* Backing public environment. */ ENV *env; /* Backing private environment. */ DBTYPE type; /* DB access method type. */ DB_MPOOLFILE *mpf; /* Backing buffer pool. */ db_mutex_t mutex; /* Synchronization for free threading */ char *fname, *dname; /* File/database passed to DB->open. */ const char *dirname; /* Directory of DB file. */ u_int32_t open_flags; /* Flags passed to DB->open. */ u_int8_t fileid[DB_FILE_ID_LEN];/* File's unique ID for locking. */ u_int32_t adj_fileid; /* File's unique ID for curs. adj. */ #define DB_LOGFILEID_INVALID -1 FNAME *log_filename; /* File's naming info for logging. */ db_pgno_t meta_pgno; /* Meta page number */ DB_LOCKER *locker; /* Locker for handle locking. */ DB_LOCKER *cur_locker; /* Current handle lock holder. */ DB_TXN *cur_txn; /* Opening transaction. */ DB_LOCKER *associate_locker; /* Locker for DB->associate call. */ DB_LOCK handle_lock; /* Lock held on this handle. */ time_t timestamp; /* Handle timestamp for replication. */ u_int32_t fid_gen; /* Rep generation number for fids. */ /* * Returned data memory for DB->get() and friends. */ DBT my_rskey; /* Secondary key. */ DBT my_rkey; /* [Primary] key. */ DBT my_rdata; /* Data. */ /* * !!! * Some applications use DB but implement their own locking outside of * DB. If they're using fcntl(2) locking on the underlying database * file, and we open and close a file descriptor for that file, we will * discard their locks. The DB_FCNTL_LOCKING flag to DB->open is an * undocumented interface to support this usage which leaves any file * descriptors we open until DB->close. This will only work with the * DB->open interface and simple caches, e.g., creating a transaction * thread may open/close file descriptors this flag doesn't protect. * Locking with fcntl(2) on a file that you don't own is a very, very * unsafe thing to do. 'Nuff said. */ DB_FH *saved_open_fhp; /* Saved file handle. */ /* * Linked list of DBP's, linked from the ENV, used to keep track * of all open db handles for cursor adjustment. * * !!! * Explicit representations of structures from queue.h. * TAILQ_ENTRY(__db) dblistlinks; */ struct { struct __db *tqe_next; struct __db **tqe_prev; } dblistlinks; /* * Cursor queues. * * !!! * Explicit representations of structures from queue.h. * TAILQ_HEAD(__cq_fq, __dbc) free_queue; * TAILQ_HEAD(__cq_aq, __dbc) active_queue; * TAILQ_HEAD(__cq_jq, __dbc) join_queue; */ struct __cq_fq { struct __dbc *tqh_first; struct __dbc **tqh_last; } free_queue; struct __cq_aq { struct __dbc *tqh_first; struct __dbc **tqh_last; } active_queue; struct __cq_jq { struct __dbc *tqh_first; struct __dbc **tqh_last; } join_queue; /* * Secondary index support. * * Linked list of secondary indices -- set in the primary. * * !!! * Explicit representations of structures from queue.h. * LIST_HEAD(s_secondaries, __db); */ struct { struct __db *lh_first; } s_secondaries; /* * List entries for secondaries, and reference count of how many * threads are updating this secondary (see Dbc.put). * * !!! * Note that these are synchronized by the primary's mutex, but * filled in in the secondaries. * * !!! * Explicit representations of structures from queue.h. * LIST_ENTRY(__db) s_links; */ struct { struct __db *le_next; struct __db **le_prev; } s_links; u_int32_t s_refcnt; /* Secondary callback and free functions -- set in the secondary. */ int (*s_callback) __P((DB *, const DBT *, const DBT *, DBT *)); /* Reference to primary -- set in the secondary. */ DB *s_primary; #define DB_ASSOC_IMMUTABLE_KEY 0x00000001 /* Secondary key is immutable. */ #define DB_ASSOC_CREATE 0x00000002 /* Secondary db populated on open. */ /* Flags passed to associate -- set in the secondary. */ u_int32_t s_assoc_flags; /* * Foreign key support. * * Linked list of primary dbs -- set in the foreign db * * !!! * Explicit representations of structures from queue.h. * LIST_HEAD(f_primaries, __db); */ struct { struct __db_foreign_info *lh_first; } f_primaries; /* * !!! * Explicit representations of structures from queue.h. * TAILQ_ENTRY(__db) felink; * * Links in a list of DBs involved in file extension * during a transaction. These are to be used only while the * metadata is locked. */ struct { struct __db *tqe_next; struct __db **tqe_prev; } felink; /* Reference to foreign -- set in the secondary. */ DB *s_foreign; /* API-private structure: used by DB 1.85, C++, Java, Perl and Tcl */ void *api_internal; /* Subsystem-private structure. */ void *bt_internal; /* Btree/Recno access method. */ void *h_internal; /* Hash access method. */ void *heap_internal; /* Heap access method. */ void *p_internal; /* Partition informaiton. */ void *q_internal; /* Queue access method. */ /* DB PUBLIC HANDLE LIST BEGIN */ int (*associate) __P((DB *, DB_TXN *, DB *, int (*)(DB *, const DBT *, const DBT *, DBT *), u_int32_t)); int (*associate_foreign) __P((DB *, DB *, int (*)(DB *, const DBT *, DBT *, const DBT *, int *), u_int32_t)); int (*close) __P((DB *, u_int32_t)); int (*compact) __P((DB *, DB_TXN *, DBT *, DBT *, DB_COMPACT *, u_int32_t, DBT *)); int (*cursor) __P((DB *, DB_TXN *, DBC **, u_int32_t)); int (*del) __P((DB *, DB_TXN *, DBT *, u_int32_t)); void (*err) __P((DB *, int, const char *, ...)); void (*errx) __P((DB *, const char *, ...)); int (*exists) __P((DB *, DB_TXN *, DBT *, u_int32_t)); int (*fd) __P((DB *, int *)); int (*get) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); int (*get_alloc) __P((DB *, void *(**)(size_t), void *(**)(void *, size_t), void (**)(void *))); int (*get_append_recno) __P((DB *, int (**)(DB *, DBT *, db_recno_t))); int (*get_assoc_flags) __P((DB *, u_int32_t *)); int (*get_bt_compare) __P((DB *, int (**)(DB *, const DBT *, const DBT *))); int (*get_bt_compress) __P((DB *, int (**)(DB *, const DBT *, const DBT *, const DBT *, const DBT *, DBT *), int (**)(DB *, const DBT *, const DBT *, DBT *, DBT *, DBT *))); int (*get_bt_minkey) __P((DB *, u_int32_t *)); int (*get_bt_prefix) __P((DB *, size_t (**)(DB *, const DBT *, const DBT *))); int (*get_byteswapped) __P((DB *, int *)); int (*get_cachesize) __P((DB *, u_int32_t *, u_int32_t *, int *)); int (*get_create_dir) __P((DB *, const char **)); int (*get_dbname) __P((DB *, const char **, const char **)); int (*get_dup_compare) __P((DB *, int (**)(DB *, const DBT *, const DBT *))); int (*get_encrypt_flags) __P((DB *, u_int32_t *)); DB_ENV *(*get_env) __P((DB *)); void (*get_errcall) __P((DB *, void (**)(const DB_ENV *, const char *, const char *))); void (*get_errfile) __P((DB *, FILE **)); void (*get_errpfx) __P((DB *, const char **)); int (*get_feedback) __P((DB *, void (**)(DB *, int, int))); int (*get_flags) __P((DB *, u_int32_t *)); int (*get_h_compare) __P((DB *, int (**)(DB *, const DBT *, const DBT *))); int (*get_h_ffactor) __P((DB *, u_int32_t *)); int (*get_h_hash) __P((DB *, u_int32_t (**)(DB *, const void *, u_int32_t))); int (*get_h_nelem) __P((DB *, u_int32_t *)); int (*get_heapsize) __P((DB *, u_int32_t *, u_int32_t *)); int (*get_heap_regionsize) __P((DB *, u_int32_t *)); int (*get_lk_exclusive) __P((DB *, int *, int *)); int (*get_lorder) __P((DB *, int *)); DB_MPOOLFILE *(*get_mpf) __P((DB *)); void (*get_msgcall) __P((DB *, void (**)(const DB_ENV *, const char *))); void (*get_msgfile) __P((DB *, FILE **)); int (*get_multiple) __P((DB *)); int (*get_open_flags) __P((DB *, u_int32_t *)); int (*get_pagesize) __P((DB *, u_int32_t *)); int (*get_partition_callback) __P((DB *, u_int32_t *, u_int32_t (**)(DB *, DBT *key))); int (*get_partition_dirs) __P((DB *, const char ***)); int (*get_partition_keys) __P((DB *, u_int32_t *, DBT **)); int (*get_priority) __P((DB *, DB_CACHE_PRIORITY *)); int (*get_q_extentsize) __P((DB *, u_int32_t *)); int (*get_re_delim) __P((DB *, int *)); int (*get_re_len) __P((DB *, u_int32_t *)); int (*get_re_pad) __P((DB *, int *)); int (*get_re_source) __P((DB *, const char **)); int (*get_transactional) __P((DB *)); int (*get_type) __P((DB *, DBTYPE *)); int (*join) __P((DB *, DBC **, DBC **, u_int32_t)); int (*key_range) __P((DB *, DB_TXN *, DBT *, DB_KEY_RANGE *, u_int32_t)); int (*open) __P((DB *, DB_TXN *, const char *, const char *, DBTYPE, u_int32_t, int)); int (*pget) __P((DB *, DB_TXN *, DBT *, DBT *, DBT *, u_int32_t)); int (*put) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); int (*remove) __P((DB *, const char *, const char *, u_int32_t)); int (*rename) __P((DB *, const char *, const char *, const char *, u_int32_t)); int (*set_alloc) __P((DB *, void *(*)(size_t), void *(*)(void *, size_t), void (*)(void *))); int (*set_append_recno) __P((DB *, int (*)(DB *, DBT *, db_recno_t))); int (*set_bt_compare) __P((DB *, int (*)(DB *, const DBT *, const DBT *))); int (*set_bt_compress) __P((DB *, int (*)(DB *, const DBT *, const DBT *, const DBT *, const DBT *, DBT *), int (*)(DB *, const DBT *, const DBT *, DBT *, DBT *, DBT *))); int (*set_bt_minkey) __P((DB *, u_int32_t)); int (*set_bt_prefix) __P((DB *, size_t (*)(DB *, const DBT *, const DBT *))); int (*set_cachesize) __P((DB *, u_int32_t, u_int32_t, int)); int (*set_create_dir) __P((DB *, const char *)); int (*set_dup_compare) __P((DB *, int (*)(DB *, const DBT *, const DBT *))); int (*set_encrypt) __P((DB *, const char *, u_int32_t)); void (*set_errcall) __P((DB *, void (*)(const DB_ENV *, const char *, const char *))); void (*set_errfile) __P((DB *, FILE *)); void (*set_errpfx) __P((DB *, const char *)); int (*set_feedback) __P((DB *, void (*)(DB *, int, int))); int (*set_flags) __P((DB *, u_int32_t)); int (*set_h_compare) __P((DB *, int (*)(DB *, const DBT *, const DBT *))); int (*set_h_ffactor) __P((DB *, u_int32_t)); int (*set_h_hash) __P((DB *, u_int32_t (*)(DB *, const void *, u_int32_t))); int (*set_h_nelem) __P((DB *, u_int32_t)); int (*set_heapsize) __P((DB *, u_int32_t, u_int32_t, u_int32_t)); int (*set_heap_regionsize) __P((DB *, u_int32_t)); int (*set_lk_exclusive) __P((DB *, int)); int (*set_lorder) __P((DB *, int)); void (*set_msgcall) __P((DB *, void (*)(const DB_ENV *, const char *))); void (*set_msgfile) __P((DB *, FILE *)); int (*set_pagesize) __P((DB *, u_int32_t)); int (*set_paniccall) __P((DB *, void (*)(DB_ENV *, int))); int (*set_partition) __P((DB *, u_int32_t, DBT *, u_int32_t (*)(DB *, DBT *key))); int (*set_partition_dirs) __P((DB *, const char **)); int (*set_priority) __P((DB *, DB_CACHE_PRIORITY)); int (*set_q_extentsize) __P((DB *, u_int32_t)); int (*set_re_delim) __P((DB *, int)); int (*set_re_len) __P((DB *, u_int32_t)); int (*set_re_pad) __P((DB *, int)); int (*set_re_source) __P((DB *, const char *)); int (*sort_multiple) __P((DB *, DBT *, DBT *, u_int32_t)); int (*stat) __P((DB *, DB_TXN *, void *, u_int32_t)); int (*stat_print) __P((DB *, u_int32_t)); int (*sync) __P((DB *, u_int32_t)); int (*truncate) __P((DB *, DB_TXN *, u_int32_t *, u_int32_t)); int (*upgrade) __P((DB *, const char *, u_int32_t)); int (*verify) __P((DB *, const char *, const char *, FILE *, u_int32_t)); /* DB PUBLIC HANDLE LIST END */ /* DB PRIVATE HANDLE LIST BEGIN */ int (*dump) __P((DB *, const char *, int (*)(void *, const void *), void *, int, int)); int (*db_am_remove) __P((DB *, DB_THREAD_INFO *, DB_TXN *, const char *, const char *, u_int32_t)); int (*db_am_rename) __P((DB *, DB_THREAD_INFO *, DB_TXN *, const char *, const char *, const char *)); /* DB PRIVATE HANDLE LIST END */ /* * Never called; these are a place to save function pointers * so that we can undo an associate. */ int (*stored_get) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); int (*stored_close) __P((DB *, u_int32_t)); /* Alternative handle close function, used by C++ API. */ int (*alt_close) __P((DB *, u_int32_t)); #define DB_OK_BTREE 0x01 #define DB_OK_HASH 0x02 #define DB_OK_HEAP 0x04 #define DB_OK_QUEUE 0x08 #define DB_OK_RECNO 0x10 u_int32_t am_ok; /* Legal AM choices. */ /* * This field really ought to be an AM_FLAG, but we have * have run out of bits. If/when we decide to split up * the flags, we can incorporate it. */ int preserve_fid; /* Do not free fileid on close. */ #define DB_AM_CHKSUM 0x00000001 /* Checksumming */ #define DB_AM_COMPENSATE 0x00000002 /* Created by compensating txn */ #define DB_AM_COMPRESS 0x00000004 /* Compressed BTree */ #define DB_AM_CREATED 0x00000008 /* Database was created upon open */ #define DB_AM_CREATED_MSTR 0x00000010 /* Encompassing file was created */ #define DB_AM_DBM_ERROR 0x00000020 /* Error in DBM/NDBM database */ #define DB_AM_DELIMITER 0x00000040 /* Variable length delimiter set */ #define DB_AM_DISCARD 0x00000080 /* Discard any cached pages */ #define DB_AM_DUP 0x00000100 /* DB_DUP */ #define DB_AM_DUPSORT 0x00000200 /* DB_DUPSORT */ #define DB_AM_ENCRYPT 0x00000400 /* Encryption */ #define DB_AM_FIXEDLEN 0x00000800 /* Fixed-length records */ #define DB_AM_INMEM 0x00001000 /* In-memory; no sync on close */ #define DB_AM_INORDER 0x00002000 /* DB_INORDER */ #define DB_AM_IN_RENAME 0x00004000 /* File is being renamed */ #define DB_AM_NOT_DURABLE 0x00008000 /* Do not log changes */ #define DB_AM_OPEN_CALLED 0x00010000 /* DB->open called */ #define DB_AM_PAD 0x00020000 /* Fixed-length record pad */ #define DB_AM_PARTDB 0x00040000 /* Handle for a database partition */ #define DB_AM_PGDEF 0x00080000 /* Page size was defaulted */ #define DB_AM_RDONLY 0x00100000 /* Database is readonly */ #define DB_AM_READ_UNCOMMITTED 0x00200000 /* Support degree 1 isolation */ #define DB_AM_RECNUM 0x00400000 /* DB_RECNUM */ #define DB_AM_RECOVER 0x00800000 /* DB opened by recovery routine */ #define DB_AM_RENUMBER 0x01000000 /* DB_RENUMBER */ #define DB_AM_REVSPLITOFF 0x02000000 /* DB_REVSPLITOFF */ #define DB_AM_SECONDARY 0x04000000 /* Database is a secondary index */ #define DB_AM_SNAPSHOT 0x08000000 /* DB_SNAPSHOT */ #define DB_AM_SUBDB 0x10000000 /* Subdatabases supported */ #define DB_AM_SWAP 0x20000000 /* Pages need to be byte-swapped */ #define DB_AM_TXN 0x40000000 /* Opened in a transaction */ #define DB_AM_VERIFYING 0x80000000 /* DB handle is in the verifier */ u_int32_t orig_flags; /* Flags at open, for refresh */ u_int32_t flags; #define DB2_AM_EXCL 0x00000001 /* Exclusively lock the handle */ #define DB2_AM_INTEXCL 0x00000002 /* Internal exclusive lock. */ #define DB2_AM_NOWAIT 0x00000004 /* Do not wait for handle lock */ u_int32_t orig_flags2; /* Second flags word; for refresh */ u_int32_t flags2; /* Second flags word */ }; /* * Macros for bulk operations. These are only intended for the C API. * For C++, use DbMultiple*Iterator or DbMultiple*Builder. * * Bulk operations store multiple entries into a single DBT structure. The * following macros assist with creating and reading these Multiple DBTs. * * The basic layout for single data items is: * * ------------------------------------------------------------------------- * | data1 | ... | dataN | ..... |-1 | dNLen | dNOff | ... | d1Len | d1Off | * ------------------------------------------------------------------------- * * For the DB_MULTIPLE_KEY* macros, the items are in key/data pairs, so data1 * would be a key, and data2 its corresponding value (N is always even). * * For the DB_MULTIPLE_RECNO* macros, the record number is stored along with * the len/off pair in the "header" section, and the list is zero terminated * (since -1 is a valid record number): * * -------------------------------------------------------------------------- * | d1 |..| dN |..| 0 | dNLen | dNOff | recnoN |..| d1Len | d1Off | recno1 | * -------------------------------------------------------------------------- */ #define DB_MULTIPLE_INIT(pointer, dbt) \ (pointer = (u_int8_t *)(dbt)->data + \ (dbt)->ulen - sizeof(u_int32_t)) #define DB_MULTIPLE_NEXT(pointer, dbt, retdata, retdlen) \ do { \ u_int32_t *__p = (u_int32_t *)(pointer); \ if (*__p == (u_int32_t)-1) { \ retdata = NULL; \ pointer = NULL; \ break; \ } \ retdata = (u_int8_t *)(dbt)->data + *__p--; \ retdlen = *__p--; \ pointer = __p; \ if (retdlen == 0 && retdata == (u_int8_t *)(dbt)->data) \ retdata = NULL; \ } while (0) #define DB_MULTIPLE_KEY_NEXT(pointer, dbt, retkey, retklen, retdata, retdlen) \ do { \ u_int32_t *__p = (u_int32_t *)(pointer); \ if (*__p == (u_int32_t)-1) { \ retdata = NULL; \ retkey = NULL; \ pointer = NULL; \ break; \ } \ retkey = (u_int8_t *)(dbt)->data + *__p--; \ retklen = *__p--; \ retdata = (u_int8_t *)(dbt)->data + *__p--; \ retdlen = *__p--; \ pointer = __p; \ } while (0) #define DB_MULTIPLE_RECNO_NEXT(pointer, dbt, recno, retdata, retdlen) \ do { \ u_int32_t *__p = (u_int32_t *)(pointer); \ if (*__p == (u_int32_t)0) { \ recno = 0; \ retdata = NULL; \ pointer = NULL; \ break; \ } \ recno = *__p--; \ retdata = (u_int8_t *)(dbt)->data + *__p--; \ retdlen = *__p--; \ pointer = __p; \ } while (0) #define DB_MULTIPLE_WRITE_INIT(pointer, dbt) \ do { \ (dbt)->flags |= DB_DBT_BULK; \ pointer = (u_int8_t *)(dbt)->data + \ (dbt)->ulen - sizeof(u_int32_t); \ *(u_int32_t *)(pointer) = (u_int32_t)-1; \ } while (0) #define DB_MULTIPLE_RESERVE_NEXT(pointer, dbt, writedata, writedlen) \ do { \ u_int32_t *__p = (u_int32_t *)(pointer); \ u_int32_t __off = ((pointer) == (u_int8_t *)(dbt)->data +\ (dbt)->ulen - sizeof(u_int32_t)) ? 0 : __p[1] + __p[2];\ if ((u_int8_t *)(dbt)->data + __off + (writedlen) > \ (u_int8_t *)(__p - 2)) \ writedata = NULL; \ else { \ writedata = (u_int8_t *)(dbt)->data + __off; \ __p[0] = __off; \ __p[-1] = (u_int32_t)(writedlen); \ __p[-2] = (u_int32_t)-1; \ pointer = __p - 2; \ } \ } while (0) #define DB_MULTIPLE_WRITE_NEXT(pointer, dbt, writedata, writedlen) \ do { \ void *__destd; \ DB_MULTIPLE_RESERVE_NEXT((pointer), (dbt), \ __destd, (writedlen)); \ if (__destd == NULL) \ pointer = NULL; \ else \ memcpy(__destd, (writedata), (writedlen)); \ } while (0) #define DB_MULTIPLE_KEY_RESERVE_NEXT(pointer, dbt, writekey, writeklen, writedata, writedlen) \ do { \ u_int32_t *__p = (u_int32_t *)(pointer); \ u_int32_t __off = ((pointer) == (u_int8_t *)(dbt)->data +\ (dbt)->ulen - sizeof(u_int32_t)) ? 0 : __p[1] + __p[2];\ if ((u_int8_t *)(dbt)->data + __off + (writeklen) + \ (writedlen) > (u_int8_t *)(__p - 4)) { \ writekey = NULL; \ writedata = NULL; \ } else { \ writekey = (u_int8_t *)(dbt)->data + __off; \ __p[0] = __off; \ __p[-1] = (u_int32_t)(writeklen); \ __p -= 2; \ __off += (u_int32_t)(writeklen); \ writedata = (u_int8_t *)(dbt)->data + __off; \ __p[0] = __off; \ __p[-1] = (u_int32_t)(writedlen); \ __p[-2] = (u_int32_t)-1; \ pointer = __p - 2; \ } \ } while (0) #define DB_MULTIPLE_KEY_WRITE_NEXT(pointer, dbt, writekey, writeklen, writedata, writedlen) \ do { \ void *__destk, *__destd; \ DB_MULTIPLE_KEY_RESERVE_NEXT((pointer), (dbt), \ __destk, (writeklen), __destd, (writedlen)); \ if (__destk == NULL) \ pointer = NULL; \ else { \ memcpy(__destk, (writekey), (writeklen)); \ if (__destd != NULL) \ memcpy(__destd, (writedata), (writedlen));\ } \ } while (0) #define DB_MULTIPLE_RECNO_WRITE_INIT(pointer, dbt) \ do { \ (dbt)->flags |= DB_DBT_BULK; \ pointer = (u_int8_t *)(dbt)->data + \ (dbt)->ulen - sizeof(u_int32_t); \ *(u_int32_t *)(pointer) = 0; \ } while (0) #define DB_MULTIPLE_RECNO_RESERVE_NEXT(pointer, dbt, recno, writedata, writedlen) \ do { \ u_int32_t *__p = (u_int32_t *)(pointer); \ u_int32_t __off = ((pointer) == (u_int8_t *)(dbt)->data +\ (dbt)->ulen - sizeof(u_int32_t)) ? 0 : __p[1] + __p[2]; \ if (((u_int8_t *)(dbt)->data + __off) + (writedlen) > \ (u_int8_t *)(__p - 3)) \ writedata = NULL; \ else { \ writedata = (u_int8_t *)(dbt)->data + __off; \ __p[0] = (u_int32_t)(recno); \ __p[-1] = __off; \ __p[-2] = (u_int32_t)(writedlen); \ __p[-3] = 0; \ pointer = __p - 3; \ } \ } while (0) #define DB_MULTIPLE_RECNO_WRITE_NEXT(pointer, dbt, recno, writedata, writedlen)\ do { \ void *__destd; \ DB_MULTIPLE_RECNO_RESERVE_NEXT((pointer), (dbt), \ (recno), __destd, (writedlen)); \ if (__destd == NULL) \ pointer = NULL; \ else if ((writedlen) != 0) \ memcpy(__destd, (writedata), (writedlen)); \ } while (0) struct __db_heap_rid { db_pgno_t pgno; /* Page number. */ db_indx_t indx; /* Index in the offset table. */ }; #define DB_HEAP_RID_SZ (sizeof(db_pgno_t) + sizeof(db_indx_t)) /******************************************************* * Access method cursors. *******************************************************/ struct __dbc { DB *dbp; /* Backing database */ DB_ENV *dbenv; /* Backing environment */ ENV *env; /* Backing environment */ DB_THREAD_INFO *thread_info; /* Thread that owns this cursor. */ DB_TXN *txn; /* Associated transaction. */ DB_CACHE_PRIORITY priority; /* Priority in cache. */ /* * Active/free cursor queues. * * !!! * Explicit representations of structures from queue.h. * TAILQ_ENTRY(__dbc) links; */ struct { DBC *tqe_next; DBC **tqe_prev; } links; /* * Cursor queue of the owning transaction. * * !!! * Explicit representations of structures from queue.h. * TAILQ_ENTRY(__dbc) txn_cursors; */ struct { DBC *tqe_next; /* next element */ DBC **tqe_prev; /* address of previous next element */ } txn_cursors; /* * The DBT *'s below are used by the cursor routines to return * data to the user when DBT flags indicate that DB should manage * the returned memory. They point at a DBT containing the buffer * and length that will be used, and "belonging" to the handle that * should "own" this memory. This may be a "my_*" field of this * cursor--the default--or it may be the corresponding field of * another cursor, a DB handle, a join cursor, etc. In general, it * will be whatever handle the user originally used for the current * DB interface call. */ DBT *rskey; /* Returned secondary key. */ DBT *rkey; /* Returned [primary] key. */ DBT *rdata; /* Returned data. */ DBT my_rskey; /* Space for returned secondary key. */ DBT my_rkey; /* Space for returned [primary] key. */ DBT my_rdata; /* Space for returned data. */ DB_LOCKER *lref; /* Reference to default locker. */ DB_LOCKER *locker; /* Locker for this operation. */ DBT lock_dbt; /* DBT referencing lock. */ DB_LOCK_ILOCK lock; /* Object to be locked. */ DB_LOCK mylock; /* CDB lock held on this cursor. */ DBTYPE dbtype; /* Cursor type. */ DBC_INTERNAL *internal; /* Access method private. */ /* DBC PUBLIC HANDLE LIST BEGIN */ int (*close) __P((DBC *)); int (*cmp) __P((DBC *, DBC *, int *, u_int32_t)); int (*count) __P((DBC *, db_recno_t *, u_int32_t)); int (*del) __P((DBC *, u_int32_t)); int (*dup) __P((DBC *, DBC **, u_int32_t)); int (*get) __P((DBC *, DBT *, DBT *, u_int32_t)); int (*get_priority) __P((DBC *, DB_CACHE_PRIORITY *)); int (*pget) __P((DBC *, DBT *, DBT *, DBT *, u_int32_t)); int (*put) __P((DBC *, DBT *, DBT *, u_int32_t)); int (*set_priority) __P((DBC *, DB_CACHE_PRIORITY)); /* DBC PUBLIC HANDLE LIST END */ /* The following are the method names deprecated in the 4.6 release. */ int (*c_close) __P((DBC *)); int (*c_count) __P((DBC *, db_recno_t *, u_int32_t)); int (*c_del) __P((DBC *, u_int32_t)); int (*c_dup) __P((DBC *, DBC **, u_int32_t)); int (*c_get) __P((DBC *, DBT *, DBT *, u_int32_t)); int (*c_pget) __P((DBC *, DBT *, DBT *, DBT *, u_int32_t)); int (*c_put) __P((DBC *, DBT *, DBT *, u_int32_t)); /* DBC PRIVATE HANDLE LIST BEGIN */ int (*am_bulk) __P((DBC *, DBT *, u_int32_t)); int (*am_close) __P((DBC *, db_pgno_t, int *)); int (*am_del) __P((DBC *, u_int32_t)); int (*am_destroy) __P((DBC *)); int (*am_get) __P((DBC *, DBT *, DBT *, u_int32_t, db_pgno_t *)); int (*am_put) __P((DBC *, DBT *, DBT *, u_int32_t, db_pgno_t *)); int (*am_writelock) __P((DBC *)); /* DBC PRIVATE HANDLE LIST END */ /* * DBC_DONTLOCK and DBC_RECOVER are used during recovery and transaction * abort. If a transaction is being aborted or recovered then DBC_RECOVER * will be set and locking and logging will be disabled on this cursor. If * we are performing a compensating transaction (e.g. free page processing) * then DB_DONTLOCK will be set to inhibit locking, but logging will still * be required. DB_DONTLOCK is also used if the whole database is locked. */ #define DBC_ACTIVE 0x00001 /* Cursor in use. */ #define DBC_BULK 0x00002 /* Bulk update cursor. */ #define DBC_DONTLOCK 0x00004 /* Don't lock on this cursor. */ #define DBC_DOWNREV 0x00008 /* Down rev replication master. */ #define DBC_DUPLICATE 0x00010 /* Create a duplicate cursor. */ #define DBC_ERROR 0x00020 /* Error in this request. */ #define DBC_FAMILY 0x00040 /* Part of a locker family. */ #define DBC_FROM_DB_GET 0x00080 /* Called from the DB->get() method. */ #define DBC_MULTIPLE 0x00100 /* Return Multiple data. */ #define DBC_MULTIPLE_KEY 0x00200 /* Return Multiple keys and data. */ #define DBC_OPD 0x00400 /* Cursor references off-page dups. */ #define DBC_OWN_LID 0x00800 /* Free lock id on destroy. */ #define DBC_PARTITIONED 0x01000 /* Cursor for a partitioned db. */ #define DBC_READ_COMMITTED 0x02000 /* Cursor has degree 2 isolation. */ #define DBC_READ_UNCOMMITTED 0x04000 /* Cursor has degree 1 isolation. */ #define DBC_RECOVER 0x08000 /* Recovery cursor; don't log/lock. */ #define DBC_RMW 0x10000 /* Acquire write flag in read op. */ #define DBC_TRANSIENT 0x20000 /* Cursor is transient. */ #define DBC_WAS_READ_COMMITTED 0x40000 /* Cursor holds a read commited lock. */ #define DBC_WRITECURSOR 0x80000 /* Cursor may be used to write (CDB). */ #define DBC_WRITER 0x100000 /* Cursor immediately writing (CDB). */ u_int32_t flags; }; /* Key range statistics structure */ struct __key_range { double less; double equal; double greater; }; /* Btree/Recno statistics structure. */ struct __db_bt_stat { /* SHARED */ u_int32_t bt_magic; /* Magic number. */ u_int32_t bt_version; /* Version number. */ u_int32_t bt_metaflags; /* Metadata flags. */ u_int32_t bt_nkeys; /* Number of unique keys. */ u_int32_t bt_ndata; /* Number of data items. */ u_int32_t bt_pagecnt; /* Page count. */ u_int32_t bt_pagesize; /* Page size. */ u_int32_t bt_minkey; /* Minkey value. */ u_int32_t bt_re_len; /* Fixed-length record length. */ u_int32_t bt_re_pad; /* Fixed-length record pad. */ u_int32_t bt_levels; /* Tree levels. */ u_int32_t bt_int_pg; /* Internal pages. */ u_int32_t bt_leaf_pg; /* Leaf pages. */ u_int32_t bt_dup_pg; /* Duplicate pages. */ u_int32_t bt_over_pg; /* Overflow pages. */ u_int32_t bt_empty_pg; /* Empty pages. */ u_int32_t bt_free; /* Pages on the free list. */ uintmax_t bt_int_pgfree; /* Bytes free in internal pages. */ uintmax_t bt_leaf_pgfree; /* Bytes free in leaf pages. */ uintmax_t bt_dup_pgfree; /* Bytes free in duplicate pages. */ uintmax_t bt_over_pgfree; /* Bytes free in overflow pages. */ }; struct __db_compact { /* Input Parameters. */ u_int32_t compact_fillpercent; /* Desired fillfactor: 1-100 */ db_timeout_t compact_timeout; /* Lock timeout. */ u_int32_t compact_pages; /* Max pages to process. */ /* Output Stats. */ u_int32_t compact_empty_buckets; /* Empty hash buckets found. */ u_int32_t compact_pages_free; /* Number of pages freed. */ u_int32_t compact_pages_examine; /* Number of pages examine. */ u_int32_t compact_levels; /* Number of levels removed. */ u_int32_t compact_deadlock; /* Number of deadlocks. */ db_pgno_t compact_pages_truncated; /* Pages truncated to OS. */ /* Internal. */ db_pgno_t compact_truncate; /* Page number for truncation */ }; /* Hash statistics structure. */ struct __db_h_stat { /* SHARED */ u_int32_t hash_magic; /* Magic number. */ u_int32_t hash_version; /* Version number. */ u_int32_t hash_metaflags; /* Metadata flags. */ u_int32_t hash_nkeys; /* Number of unique keys. */ u_int32_t hash_ndata; /* Number of data items. */ u_int32_t hash_pagecnt; /* Page count. */ u_int32_t hash_pagesize; /* Page size. */ u_int32_t hash_ffactor; /* Fill factor specified at create. */ u_int32_t hash_buckets; /* Number of hash buckets. */ u_int32_t hash_free; /* Pages on the free list. */ uintmax_t hash_bfree; /* Bytes free on bucket pages. */ u_int32_t hash_bigpages; /* Number of big key/data pages. */ uintmax_t hash_big_bfree; /* Bytes free on big item pages. */ u_int32_t hash_overflows; /* Number of overflow pages. */ uintmax_t hash_ovfl_free; /* Bytes free on ovfl pages. */ u_int32_t hash_dup; /* Number of dup pages. */ uintmax_t hash_dup_free; /* Bytes free on duplicate pages. */ }; /* Heap statistics structure. */ struct __db_heap_stat { /* SHARED */ u_int32_t heap_magic; /* Magic number. */ u_int32_t heap_version; /* Version number. */ u_int32_t heap_metaflags; /* Metadata flags. */ u_int32_t heap_nrecs; /* Number of records. */ u_int32_t heap_pagecnt; /* Page count. */ u_int32_t heap_pagesize; /* Page size. */ u_int32_t heap_nregions; /* Number of regions. */ u_int32_t heap_regionsize; /* Number of pages in a region. */ }; /* Queue statistics structure. */ struct __db_qam_stat { /* SHARED */ u_int32_t qs_magic; /* Magic number. */ u_int32_t qs_version; /* Version number. */ u_int32_t qs_metaflags; /* Metadata flags. */ u_int32_t qs_nkeys; /* Number of unique keys. */ u_int32_t qs_ndata; /* Number of data items. */ u_int32_t qs_pagesize; /* Page size. */ u_int32_t qs_extentsize; /* Pages per extent. */ u_int32_t qs_pages; /* Data pages. */ u_int32_t qs_re_len; /* Fixed-length record length. */ u_int32_t qs_re_pad; /* Fixed-length record pad. */ u_int32_t qs_pgfree; /* Bytes free in data pages. */ u_int32_t qs_first_recno; /* First not deleted record. */ u_int32_t qs_cur_recno; /* Next available record number. */ }; /******************************************************* * Environment. *******************************************************/ #define DB_REGION_MAGIC 0x120897 /* Environment magic number. */ /* * Database environment structure. * * This is the public database environment handle. The private environment * handle is the ENV structure. The user owns this structure, the library * owns the ENV structure. The reason there are two structures is because * the user's configuration outlives any particular DB_ENV->open call, and * separate structures allows us to easily discard internal information without * discarding the user's configuration. * * Fields in the DB_ENV structure should normally be set only by application * DB_ENV handle methods. */ /* * Memory configuration types. */ typedef enum { DB_MEM_LOCK=1, DB_MEM_LOCKOBJECT=2, DB_MEM_LOCKER=3, DB_MEM_LOGID=4, DB_MEM_TRANSACTION=5, DB_MEM_THREAD=6 } DB_MEM_CONFIG; /* * Backup configuration types. */ typedef enum { DB_BACKUP_READ_COUNT = 1, DB_BACKUP_READ_SLEEP = 2, DB_BACKUP_SIZE = 3, DB_BACKUP_WRITE_DIRECT = 4 } DB_BACKUP_CONFIG; struct __db_env { ENV *env; /* Linked ENV structure */ /* * The DB_ENV structure can be used concurrently, so field access is * protected. */ db_mutex_t mtx_db_env; /* DB_ENV structure mutex */ /* Error message callback */ void (*db_errcall) __P((const DB_ENV *, const char *, const char *)); FILE *db_errfile; /* Error message file stream */ const char *db_errpfx; /* Error message prefix */ /* Other message callback */ void (*db_msgcall) __P((const DB_ENV *, const char *)); FILE *db_msgfile; /* Other message file stream */ /* Other application callback functions */ int (*app_dispatch) __P((DB_ENV *, DBT *, DB_LSN *, db_recops)); void (*db_event_func) __P((DB_ENV *, u_int32_t, void *)); void (*db_feedback) __P((DB_ENV *, int, int)); void (*db_free) __P((void *)); void (*db_paniccall) __P((DB_ENV *, int)); void *(*db_malloc) __P((size_t)); void *(*db_realloc) __P((void *, size_t)); int (*is_alive) __P((DB_ENV *, pid_t, db_threadid_t, u_int32_t)); void (*thread_id) __P((DB_ENV *, pid_t *, db_threadid_t *)); char *(*thread_id_string) __P((DB_ENV *, pid_t, db_threadid_t, char *)); /* Application specified paths */ char *db_log_dir; /* Database log file directory */ char *db_md_dir; /* Persistent metadata directory */ char *db_tmp_dir; /* Database tmp file directory */ char *db_create_dir; /* Create directory for data files */ char **db_data_dir; /* Database data file directories */ int data_cnt; /* Database data file slots */ int data_next; /* Next database data file slot */ char *intermediate_dir_mode; /* Intermediate directory perms */ long shm_key; /* shmget key */ char *passwd; /* Cryptography support */ size_t passwd_len; /* Private handle references */ void *app_private; /* Application-private handle */ void *api1_internal; /* C++, Perl API private */ void *api2_internal; /* Java API private */ u_int32_t verbose; /* DB_VERB_XXX flags */ /* Mutex configuration */ u_int32_t mutex_align; /* Mutex alignment */ u_int32_t mutex_cnt; /* Number of mutexes to configure */ u_int32_t mutex_inc; /* Number of mutexes to add */ u_int32_t mutex_max; /* Max number of mutexes */ u_int32_t mutex_tas_spins;/* Test-and-set spin count */ /* Locking configuration */ u_int8_t *lk_conflicts; /* Two dimensional conflict matrix */ int lk_modes; /* Number of lock modes in table */ u_int32_t lk_detect; /* Deadlock detect on all conflicts */ u_int32_t lk_max; /* Maximum number of locks */ u_int32_t lk_max_lockers;/* Maximum number of lockers */ u_int32_t lk_max_objects;/* Maximum number of locked objects */ u_int32_t lk_init; /* Initial number of locks */ u_int32_t lk_init_lockers;/* Initial number of lockers */ u_int32_t lk_init_objects;/* Initial number of locked objects */ u_int32_t lk_partitions ;/* Number of object partitions */ db_timeout_t lk_timeout; /* Lock timeout period */ /* Used during initialization */ u_int32_t locker_t_size; /* Locker hash table size. */ u_int32_t object_t_size; /* Object hash table size. */ /* Logging configuration */ u_int32_t lg_bsize; /* Buffer size */ u_int32_t lg_fileid_init; /* Initial allocation for fname structs */ int lg_filemode; /* Log file permission mode */ u_int32_t lg_regionmax; /* Region size */ u_int32_t lg_size; /* Log file size */ u_int32_t lg_flags; /* Log configuration */ /* Memory pool configuration */ u_int32_t mp_gbytes; /* Cache size: GB */ u_int32_t mp_bytes; /* Cache size: bytes */ u_int32_t mp_max_gbytes; /* Maximum cache size: GB */ u_int32_t mp_max_bytes; /* Maximum cache size: bytes */ size_t mp_mmapsize; /* Maximum file size for mmap */ int mp_maxopenfd; /* Maximum open file descriptors */ int mp_maxwrite; /* Maximum buffers to write */ u_int mp_ncache; /* Initial number of cache regions */ u_int32_t mp_pagesize; /* Average page size */ u_int32_t mp_tablesize; /* Approximate hash table size */ u_int32_t mp_mtxcount; /* Number of mutexs */ /* Sleep after writing max buffers */ db_timeout_t mp_maxwrite_sleep; /* Transaction configuration */ u_int32_t tx_init; /* Initial number of transactions */ u_int32_t tx_max; /* Maximum number of transactions */ time_t tx_timestamp; /* Recover to specific timestamp */ db_timeout_t tx_timeout; /* Timeout for transactions */ /* Thread tracking configuration */ u_int32_t thr_init; /* Thread count */ u_int32_t thr_max; /* Thread max */ roff_t memory_max; /* Maximum region memory */ /* * The following fields are not strictly user-owned, but they outlive * the ENV structure, and so are stored here. */ DB_FH *registry; /* DB_REGISTER file handle */ u_int32_t registry_off; /* * Offset of our slot. We can't use * off_t because its size depends on * build settings. */ db_timeout_t envreg_timeout; /* DB_REGISTER wait timeout */ #define DB_ENV_AUTO_COMMIT 0x00000001 /* DB_AUTO_COMMIT */ #define DB_ENV_CDB_ALLDB 0x00000002 /* CDB environment wide locking */ #define DB_ENV_FAILCHK 0x00000004 /* Failchk is running */ #define DB_ENV_DIRECT_DB 0x00000008 /* DB_DIRECT_DB set */ #define DB_ENV_DSYNC_DB 0x00000010 /* DB_DSYNC_DB set */ #define DB_ENV_DATABASE_LOCKING 0x00000020 /* Try database-level locking */ #define DB_ENV_MULTIVERSION 0x00000040 /* DB_MULTIVERSION set */ #define DB_ENV_NOLOCKING 0x00000080 /* DB_NOLOCKING set */ #define DB_ENV_NOMMAP 0x00000100 /* DB_NOMMAP set */ #define DB_ENV_NOPANIC 0x00000200 /* Okay if panic set */ #define DB_ENV_OVERWRITE 0x00000400 /* DB_OVERWRITE set */ #define DB_ENV_REGION_INIT 0x00000800 /* DB_REGION_INIT set */ #define DB_ENV_TIME_NOTGRANTED 0x00001000 /* DB_TIME_NOTGRANTED set */ #define DB_ENV_TXN_NOSYNC 0x00002000 /* DB_TXN_NOSYNC set */ #define DB_ENV_TXN_NOWAIT 0x00004000 /* DB_TXN_NOWAIT set */ #define DB_ENV_TXN_SNAPSHOT 0x00008000 /* DB_TXN_SNAPSHOT set */ #define DB_ENV_TXN_WRITE_NOSYNC 0x00010000 /* DB_TXN_WRITE_NOSYNC set */ #define DB_ENV_YIELDCPU 0x00020000 /* DB_YIELDCPU set */ #define DB_ENV_HOTBACKUP 0x00040000 /* DB_HOTBACKUP_IN_PROGRESS set */ #define DB_ENV_NOFLUSH 0x00080000 /* DB_NOFLUSH set */ u_int32_t flags; /* DB_ENV PUBLIC HANDLE LIST BEGIN */ int (*add_data_dir) __P((DB_ENV *, const char *)); int (*backup) __P((DB_ENV *, const char *, u_int32_t)); int (*cdsgroup_begin) __P((DB_ENV *, DB_TXN **)); int (*close) __P((DB_ENV *, u_int32_t)); int (*dbbackup) __P((DB_ENV *, const char *, const char *, u_int32_t)); int (*dbremove) __P((DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)); int (*dbrename) __P((DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)); void (*err) __P((const DB_ENV *, int, const char *, ...)); void (*errx) __P((const DB_ENV *, const char *, ...)); int (*failchk) __P((DB_ENV *, u_int32_t)); int (*fileid_reset) __P((DB_ENV *, const char *, u_int32_t)); int (*get_alloc) __P((DB_ENV *, void *(**)(size_t), void *(**)(void *, size_t), void (**)(void *))); int (*get_app_dispatch) __P((DB_ENV *, int (**)(DB_ENV *, DBT *, DB_LSN *, db_recops))); int (*get_cache_max) __P((DB_ENV *, u_int32_t *, u_int32_t *)); int (*get_cachesize) __P((DB_ENV *, u_int32_t *, u_int32_t *, int *)); int (*get_create_dir) __P((DB_ENV *, const char **)); int (*get_data_dirs) __P((DB_ENV *, const char ***)); int (*get_data_len) __P((DB_ENV *, u_int32_t *)); int (*get_backup_callbacks) __P((DB_ENV *, int (**)(DB_ENV *, const char *, const char *, void **), int (**)(DB_ENV *, u_int32_t, u_int32_t, u_int32_t, u_int8_t *, void *), int (**)(DB_ENV *, const char *, void *))); int (*get_backup_config) __P((DB_ENV *, DB_BACKUP_CONFIG, u_int32_t *)); int (*get_encrypt_flags) __P((DB_ENV *, u_int32_t *)); void (*get_errcall) __P((DB_ENV *, void (**)(const DB_ENV *, const char *, const char *))); void (*get_errfile) __P((DB_ENV *, FILE **)); void (*get_errpfx) __P((DB_ENV *, const char **)); int (*get_flags) __P((DB_ENV *, u_int32_t *)); int (*get_feedback) __P((DB_ENV *, void (**)(DB_ENV *, int, int))); int (*get_home) __P((DB_ENV *, const char **)); int (*get_intermediate_dir_mode) __P((DB_ENV *, const char **)); int (*get_isalive) __P((DB_ENV *, int (**)(DB_ENV *, pid_t, db_threadid_t, u_int32_t))); int (*get_lg_bsize) __P((DB_ENV *, u_int32_t *)); int (*get_lg_dir) __P((DB_ENV *, const char **)); int (*get_lg_filemode) __P((DB_ENV *, int *)); int (*get_lg_max) __P((DB_ENV *, u_int32_t *)); int (*get_lg_regionmax) __P((DB_ENV *, u_int32_t *)); int (*get_lk_conflicts) __P((DB_ENV *, const u_int8_t **, int *)); int (*get_lk_detect) __P((DB_ENV *, u_int32_t *)); int (*get_lk_max_lockers) __P((DB_ENV *, u_int32_t *)); int (*get_lk_max_locks) __P((DB_ENV *, u_int32_t *)); int (*get_lk_max_objects) __P((DB_ENV *, u_int32_t *)); int (*get_lk_partitions) __P((DB_ENV *, u_int32_t *)); int (*get_lk_priority) __P((DB_ENV *, u_int32_t, u_int32_t *)); int (*get_lk_tablesize) __P((DB_ENV *, u_int32_t *)); int (*get_memory_init) __P((DB_ENV *, DB_MEM_CONFIG, u_int32_t *)); int (*get_memory_max) __P((DB_ENV *, u_int32_t *, u_int32_t *)); int (*get_metadata_dir) __P((DB_ENV *, const char **)); int (*get_mp_max_openfd) __P((DB_ENV *, int *)); int (*get_mp_max_write) __P((DB_ENV *, int *, db_timeout_t *)); int (*get_mp_mmapsize) __P((DB_ENV *, size_t *)); int (*get_mp_mtxcount) __P((DB_ENV *, u_int32_t *)); int (*get_mp_pagesize) __P((DB_ENV *, u_int32_t *)); int (*get_mp_tablesize) __P((DB_ENV *, u_int32_t *)); void (*get_msgcall) __P((DB_ENV *, void (**)(const DB_ENV *, const char *))); void (*get_msgfile) __P((DB_ENV *, FILE **)); int (*get_open_flags) __P((DB_ENV *, u_int32_t *)); int (*get_shm_key) __P((DB_ENV *, long *)); int (*get_thread_count) __P((DB_ENV *, u_int32_t *)); int (*get_thread_id_fn) __P((DB_ENV *, void (**)(DB_ENV *, pid_t *, db_threadid_t *))); int (*get_thread_id_string_fn) __P((DB_ENV *, char *(**)(DB_ENV *, pid_t, db_threadid_t, char *))); int (*get_timeout) __P((DB_ENV *, db_timeout_t *, u_int32_t)); int (*get_tmp_dir) __P((DB_ENV *, const char **)); int (*get_tx_max) __P((DB_ENV *, u_int32_t *)); int (*get_tx_timestamp) __P((DB_ENV *, time_t *)); int (*get_verbose) __P((DB_ENV *, u_int32_t, int *)); int (*is_bigendian) __P((void)); int (*lock_detect) __P((DB_ENV *, u_int32_t, u_int32_t, int *)); int (*lock_get) __P((DB_ENV *, u_int32_t, u_int32_t, DBT *, db_lockmode_t, DB_LOCK *)); int (*lock_id) __P((DB_ENV *, u_int32_t *)); int (*lock_id_free) __P((DB_ENV *, u_int32_t)); int (*lock_put) __P((DB_ENV *, DB_LOCK *)); int (*lock_stat) __P((DB_ENV *, DB_LOCK_STAT **, u_int32_t)); int (*lock_stat_print) __P((DB_ENV *, u_int32_t)); int (*lock_vec) __P((DB_ENV *, u_int32_t, u_int32_t, DB_LOCKREQ *, int, DB_LOCKREQ **)); int (*log_archive) __P((DB_ENV *, char **[], u_int32_t)); int (*log_cursor) __P((DB_ENV *, DB_LOGC **, u_int32_t)); int (*log_file) __P((DB_ENV *, const DB_LSN *, char *, size_t)); int (*log_flush) __P((DB_ENV *, const DB_LSN *)); int (*log_get_config) __P((DB_ENV *, u_int32_t, int *)); int (*log_printf) __P((DB_ENV *, DB_TXN *, const char *, ...)); int (*log_put) __P((DB_ENV *, DB_LSN *, const DBT *, u_int32_t)); int (*log_put_record) __P((DB_ENV *, DB *, DB_TXN *, DB_LSN *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, DB_LOG_RECSPEC *, ...)); int (*log_read_record) __P((DB_ENV *, DB **, void *, void *, DB_LOG_RECSPEC *, u_int32_t, void **)); int (*log_set_config) __P((DB_ENV *, u_int32_t, int)); int (*log_stat) __P((DB_ENV *, DB_LOG_STAT **, u_int32_t)); int (*log_stat_print) __P((DB_ENV *, u_int32_t)); int (*log_verify) __P((DB_ENV *, const DB_LOG_VERIFY_CONFIG *)); int (*lsn_reset) __P((DB_ENV *, const char *, u_int32_t)); int (*memp_fcreate) __P((DB_ENV *, DB_MPOOLFILE **, u_int32_t)); int (*memp_register) __P((DB_ENV *, int, int (*)(DB_ENV *, db_pgno_t, void *, DBT *), int (*)(DB_ENV *, db_pgno_t, void *, DBT *))); int (*memp_stat) __P((DB_ENV *, DB_MPOOL_STAT **, DB_MPOOL_FSTAT ***, u_int32_t)); int (*memp_stat_print) __P((DB_ENV *, u_int32_t)); int (*memp_sync) __P((DB_ENV *, DB_LSN *)); int (*memp_trickle) __P((DB_ENV *, int, int *)); int (*mutex_alloc) __P((DB_ENV *, u_int32_t, db_mutex_t *)); int (*mutex_free) __P((DB_ENV *, db_mutex_t)); int (*mutex_get_align) __P((DB_ENV *, u_int32_t *)); int (*mutex_get_increment) __P((DB_ENV *, u_int32_t *)); int (*mutex_get_init) __P((DB_ENV *, u_int32_t *)); int (*mutex_get_max) __P((DB_ENV *, u_int32_t *)); int (*mutex_get_tas_spins) __P((DB_ENV *, u_int32_t *)); int (*mutex_lock) __P((DB_ENV *, db_mutex_t)); int (*mutex_set_align) __P((DB_ENV *, u_int32_t)); int (*mutex_set_increment) __P((DB_ENV *, u_int32_t)); int (*mutex_set_init) __P((DB_ENV *, u_int32_t)); int (*mutex_set_max) __P((DB_ENV *, u_int32_t)); int (*mutex_set_tas_spins) __P((DB_ENV *, u_int32_t)); int (*mutex_stat) __P((DB_ENV *, DB_MUTEX_STAT **, u_int32_t)); int (*mutex_stat_print) __P((DB_ENV *, u_int32_t)); int (*mutex_unlock) __P((DB_ENV *, db_mutex_t)); int (*open) __P((DB_ENV *, const char *, u_int32_t, int)); int (*remove) __P((DB_ENV *, const char *, u_int32_t)); int (*rep_elect) __P((DB_ENV *, u_int32_t, u_int32_t, u_int32_t)); int (*rep_flush) __P((DB_ENV *)); int (*rep_get_clockskew) __P((DB_ENV *, u_int32_t *, u_int32_t *)); int (*rep_get_config) __P((DB_ENV *, u_int32_t, int *)); int (*rep_get_limit) __P((DB_ENV *, u_int32_t *, u_int32_t *)); int (*rep_get_nsites) __P((DB_ENV *, u_int32_t *)); int (*rep_get_priority) __P((DB_ENV *, u_int32_t *)); int (*rep_get_request) __P((DB_ENV *, u_int32_t *, u_int32_t *)); int (*rep_get_timeout) __P((DB_ENV *, int, u_int32_t *)); int (*rep_process_message) __P((DB_ENV *, DBT *, DBT *, int, DB_LSN *)); int (*rep_set_clockskew) __P((DB_ENV *, u_int32_t, u_int32_t)); int (*rep_set_config) __P((DB_ENV *, u_int32_t, int)); int (*rep_set_limit) __P((DB_ENV *, u_int32_t, u_int32_t)); int (*rep_set_nsites) __P((DB_ENV *, u_int32_t)); int (*rep_set_priority) __P((DB_ENV *, u_int32_t)); int (*rep_set_request) __P((DB_ENV *, u_int32_t, u_int32_t)); int (*rep_set_timeout) __P((DB_ENV *, int, db_timeout_t)); int (*rep_set_transport) __P((DB_ENV *, int, int (*)(DB_ENV *, const DBT *, const DBT *, const DB_LSN *, int, u_int32_t))); int (*rep_start) __P((DB_ENV *, DBT *, u_int32_t)); int (*rep_stat) __P((DB_ENV *, DB_REP_STAT **, u_int32_t)); int (*rep_stat_print) __P((DB_ENV *, u_int32_t)); int (*rep_sync) __P((DB_ENV *, u_int32_t)); int (*repmgr_channel) __P((DB_ENV *, int, DB_CHANNEL **, u_int32_t)); int (*repmgr_get_ack_policy) __P((DB_ENV *, int *)); int (*repmgr_local_site) __P((DB_ENV *, DB_SITE **)); int (*repmgr_msg_dispatch) __P((DB_ENV *, void (*)(DB_ENV *, DB_CHANNEL *, DBT *, u_int32_t, u_int32_t), u_int32_t)); int (*repmgr_set_ack_policy) __P((DB_ENV *, int)); int (*repmgr_site) __P((DB_ENV *, const char *, u_int, DB_SITE**, u_int32_t)); int (*repmgr_site_by_eid) __P((DB_ENV *, int, DB_SITE**)); int (*repmgr_site_list) __P((DB_ENV *, u_int *, DB_REPMGR_SITE **)); int (*repmgr_start) __P((DB_ENV *, int, u_int32_t)); int (*repmgr_stat) __P((DB_ENV *, DB_REPMGR_STAT **, u_int32_t)); int (*repmgr_stat_print) __P((DB_ENV *, u_int32_t)); int (*set_alloc) __P((DB_ENV *, void *(*)(size_t), void *(*)(void *, size_t), void (*)(void *))); int (*set_app_dispatch) __P((DB_ENV *, int (*)(DB_ENV *, DBT *, DB_LSN *, db_recops))); int (*set_cache_max) __P((DB_ENV *, u_int32_t, u_int32_t)); int (*set_cachesize) __P((DB_ENV *, u_int32_t, u_int32_t, int)); int (*set_create_dir) __P((DB_ENV *, const char *)); int (*set_data_dir) __P((DB_ENV *, const char *)); int (*set_data_len) __P((DB_ENV *, u_int32_t)); int (*set_backup_callbacks) __P((DB_ENV *, int (*)(DB_ENV *, const char *, const char *, void **), int (*)(DB_ENV *, u_int32_t, u_int32_t, u_int32_t, u_int8_t *, void *), int (*)(DB_ENV *, const char *, void *))); int (*set_backup_config) __P((DB_ENV *, DB_BACKUP_CONFIG, u_int32_t)); int (*set_encrypt) __P((DB_ENV *, const char *, u_int32_t)); void (*set_errcall) __P((DB_ENV *, void (*)(const DB_ENV *, const char *, const char *))); void (*set_errfile) __P((DB_ENV *, FILE *)); void (*set_errpfx) __P((DB_ENV *, const char *)); int (*set_event_notify) __P((DB_ENV *, void (*)(DB_ENV *, u_int32_t, void *))); int (*set_feedback) __P((DB_ENV *, void (*)(DB_ENV *, int, int))); int (*set_flags) __P((DB_ENV *, u_int32_t, int)); int (*set_intermediate_dir_mode) __P((DB_ENV *, const char *)); int (*set_isalive) __P((DB_ENV *, int (*)(DB_ENV *, pid_t, db_threadid_t, u_int32_t))); int (*set_lg_bsize) __P((DB_ENV *, u_int32_t)); int (*set_lg_dir) __P((DB_ENV *, const char *)); int (*set_lg_filemode) __P((DB_ENV *, int)); int (*set_lg_max) __P((DB_ENV *, u_int32_t)); int (*set_lg_regionmax) __P((DB_ENV *, u_int32_t)); int (*set_lk_conflicts) __P((DB_ENV *, u_int8_t *, int)); int (*set_lk_detect) __P((DB_ENV *, u_int32_t)); int (*set_lk_max_lockers) __P((DB_ENV *, u_int32_t)); int (*set_lk_max_locks) __P((DB_ENV *, u_int32_t)); int (*set_lk_max_objects) __P((DB_ENV *, u_int32_t)); int (*set_lk_partitions) __P((DB_ENV *, u_int32_t)); int (*set_lk_priority) __P((DB_ENV *, u_int32_t, u_int32_t)); int (*set_lk_tablesize) __P((DB_ENV *, u_int32_t)); int (*set_memory_init) __P((DB_ENV *, DB_MEM_CONFIG, u_int32_t)); int (*set_memory_max) __P((DB_ENV *, u_int32_t, u_int32_t)); int (*set_metadata_dir) __P((DB_ENV *, const char *)); int (*set_mp_max_openfd) __P((DB_ENV *, int)); int (*set_mp_max_write) __P((DB_ENV *, int, db_timeout_t)); int (*set_mp_mmapsize) __P((DB_ENV *, size_t)); int (*set_mp_mtxcount) __P((DB_ENV *, u_int32_t)); int (*set_mp_pagesize) __P((DB_ENV *, u_int32_t)); int (*set_mp_tablesize) __P((DB_ENV *, u_int32_t)); void (*set_msgcall) __P((DB_ENV *, void (*)(const DB_ENV *, const char *))); void (*set_msgfile) __P((DB_ENV *, FILE *)); int (*set_paniccall) __P((DB_ENV *, void (*)(DB_ENV *, int))); int (*set_shm_key) __P((DB_ENV *, long)); int (*set_thread_count) __P((DB_ENV *, u_int32_t)); int (*set_thread_id) __P((DB_ENV *, void (*)(DB_ENV *, pid_t *, db_threadid_t *))); int (*set_thread_id_string) __P((DB_ENV *, char *(*)(DB_ENV *, pid_t, db_threadid_t, char *))); int (*set_timeout) __P((DB_ENV *, db_timeout_t, u_int32_t)); int (*set_tmp_dir) __P((DB_ENV *, const char *)); int (*set_tx_max) __P((DB_ENV *, u_int32_t)); int (*set_tx_timestamp) __P((DB_ENV *, time_t *)); int (*set_verbose) __P((DB_ENV *, u_int32_t, int)); int (*txn_applied) __P((DB_ENV *, DB_TXN_TOKEN *, db_timeout_t, u_int32_t)); int (*stat_print) __P((DB_ENV *, u_int32_t)); int (*txn_begin) __P((DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)); int (*txn_checkpoint) __P((DB_ENV *, u_int32_t, u_int32_t, u_int32_t)); int (*txn_recover) __P((DB_ENV *, DB_PREPLIST *, long, long *, u_int32_t)); int (*txn_stat) __P((DB_ENV *, DB_TXN_STAT **, u_int32_t)); int (*txn_stat_print) __P((DB_ENV *, u_int32_t)); /* DB_ENV PUBLIC HANDLE LIST END */ /* DB_ENV PRIVATE HANDLE LIST BEGIN */ int (*prdbt) __P((DBT *, int, const char *, void *, int (*)(void *, const void *), int, int)); /* DB_ENV PRIVATE HANDLE LIST END */ }; /* * Dispatch structure for recovery, log verification and print routines. Since * internal and external routines take different arguments (ENV versus DB_ENV), * we need something more elaborate than a single pointer and size. */ struct __db_distab { int (**int_dispatch) __P((ENV *, DBT *, DB_LSN *, db_recops, void *)); size_t int_size; int (**ext_dispatch) __P((DB_ENV *, DBT *, DB_LSN *, db_recops)); size_t ext_size; }; /* * Log verification configuration structure. */ struct __db_logvrfy_config { int continue_after_fail, verbose; u_int32_t cachesize; const char *temp_envhome; const char *dbfile, *dbname; DB_LSN start_lsn, end_lsn; time_t start_time, end_time; }; struct __db_channel { CHANNEL *channel; /* Pointer to internal state details. */ int eid; /* Env. ID passed in constructor. */ db_timeout_t timeout; /* DB_CHANNEL PUBLIC HANDLE LIST BEGIN */ int (*close) __P((DB_CHANNEL *, u_int32_t)); int (*send_msg) __P((DB_CHANNEL *, DBT *, u_int32_t, u_int32_t)); int (*send_request) __P((DB_CHANNEL *, DBT *, u_int32_t, DBT *, db_timeout_t, u_int32_t)); int (*set_timeout) __P((DB_CHANNEL *, db_timeout_t)); /* DB_CHANNEL PUBLIC HANDLE LIST END */ }; struct __db_site { ENV *env; int eid; const char *host; u_int port; u_int32_t flags; /* DB_SITE PUBLIC HANDLE LIST BEGIN */ int (*get_address) __P((DB_SITE *, const char **, u_int *)); int (*get_config) __P((DB_SITE *, u_int32_t, u_int32_t *)); int (*get_eid) __P((DB_SITE *, int *)); int (*set_config) __P((DB_SITE *, u_int32_t, u_int32_t)); int (*remove) __P((DB_SITE *)); int (*close) __P((DB_SITE *)); /* DB_SITE PUBLIC HANDLE LIST END */ }; #if DB_DBM_HSEARCH != 0 /******************************************************* * Dbm/Ndbm historic interfaces. *******************************************************/ typedef struct __db DBM; #define DBM_INSERT 0 /* Flags to dbm_store(). */ #define DBM_REPLACE 1 /* * The DB support for ndbm(3) always appends this suffix to the * file name to avoid overwriting the user's original database. */ #define DBM_SUFFIX ".db" #if defined(_XPG4_2) typedef struct { char *dptr; size_t dsize; } datum; #else typedef struct { char *dptr; int dsize; } datum; #endif /* * Translate NDBM calls into DB calls so that DB doesn't step on the * application's name space. */ #define dbm_clearerr(a) __db_ndbm_clearerr(a) #define dbm_close(a) __db_ndbm_close(a) #define dbm_delete(a, b) __db_ndbm_delete(a, b) #define dbm_dirfno(a) __db_ndbm_dirfno(a) #define dbm_error(a) __db_ndbm_error(a) #define dbm_fetch(a, b) __db_ndbm_fetch(a, b) #define dbm_firstkey(a) __db_ndbm_firstkey(a) #define dbm_nextkey(a) __db_ndbm_nextkey(a) #define dbm_open(a, b, c) __db_ndbm_open(a, b, c) #define dbm_pagfno(a) __db_ndbm_pagfno(a) #define dbm_rdonly(a) __db_ndbm_rdonly(a) #define dbm_store(a, b, c, d) \ __db_ndbm_store(a, b, c, d) /* * Translate DBM calls into DB calls so that DB doesn't step on the * application's name space. * * The global variables dbrdonly, dirf and pagf were not retained when 4BSD * replaced the dbm interface with ndbm, and are not supported here. */ #define dbminit(a) __db_dbm_init(a) #define dbmclose __db_dbm_close #if !defined(__cplusplus) #define delete(a) __db_dbm_delete(a) #endif #define fetch(a) __db_dbm_fetch(a) #define firstkey __db_dbm_firstkey #define nextkey(a) __db_dbm_nextkey(a) #define store(a, b) __db_dbm_store(a, b) /******************************************************* * Hsearch historic interface. *******************************************************/ typedef enum { FIND, ENTER } ACTION; typedef struct entry { char *key; char *data; } ENTRY; #define hcreate(a) __db_hcreate(a) #define hdestroy __db_hdestroy #define hsearch(a, b) __db_hsearch(a, b) #endif /* DB_DBM_HSEARCH */ #if defined(__cplusplus) } #endif #endif /* !_DB_H_ */ /* DO NOT EDIT: automatically built by dist/s_apiflags. */ #define DB_AGGRESSIVE 0x00000001 #define DB_ARCH_ABS 0x00000001 #define DB_ARCH_DATA 0x00000002 #define DB_ARCH_LOG 0x00000004 #define DB_ARCH_REMOVE 0x00000008 #define DB_AUTO_COMMIT 0x00000100 #define DB_BACKUP_CLEAN 0x00000002 #define DB_BACKUP_FILES 0x00000008 #define DB_BACKUP_NO_LOGS 0x00000010 #define DB_BACKUP_SINGLE_DIR 0x00000020 #define DB_BACKUP_UPDATE 0x00000040 #define DB_BOOTSTRAP_HELPER 0x00000001 #define DB_CDB_ALLDB 0x00000040 #define DB_CHKSUM 0x00000008 #define DB_CKP_INTERNAL 0x00000002 #define DB_CREATE 0x00000001 #define DB_CURSOR_BULK 0x00000001 #define DB_CURSOR_TRANSIENT 0x00000008 #define DB_CXX_NO_EXCEPTIONS 0x00000002 #define DB_DATABASE_LOCKING 0x00000080 #define DB_DIRECT 0x00000020 #define DB_DIRECT_DB 0x00000200 #define DB_DSYNC_DB 0x00000400 #define DB_DUP 0x00000010 #define DB_DUPSORT 0x00000002 #define DB_DURABLE_UNKNOWN 0x00000040 #define DB_ENCRYPT 0x00000001 #define DB_ENCRYPT_AES 0x00000001 #define DB_EXCL 0x00000004 #define DB_EXTENT 0x00000100 #define DB_FAILCHK 0x00000010 #define DB_FAILCHK_ISALIVE 0x00000040 #define DB_FAST_STAT 0x00000001 #define DB_FCNTL_LOCKING 0x00000800 #define DB_FLUSH 0x00000002 #define DB_FORCE 0x00000001 #define DB_FORCESYNC 0x00000001 #define DB_FOREIGN_ABORT 0x00000001 #define DB_FOREIGN_CASCADE 0x00000002 #define DB_FOREIGN_NULLIFY 0x00000004 #define DB_FREELIST_ONLY 0x00000001 #define DB_FREE_SPACE 0x00000002 #define DB_GROUP_CREATOR 0x00000002 #define DB_HOTBACKUP_IN_PROGRESS 0x00000800 #define DB_IGNORE_LEASE 0x00001000 #define DB_IMMUTABLE_KEY 0x00000002 #define DB_INIT_CDB 0x00000080 #define DB_INIT_LOCK 0x00000100 #define DB_INIT_LOG 0x00000200 #define DB_INIT_MPOOL 0x00000400 #define DB_INIT_MUTEX 0x00000800 #define DB_INIT_REP 0x00001000 #define DB_INIT_TXN 0x00002000 #define DB_INORDER 0x00000020 #define DB_INTERNAL_PERSISTENT_DB 0x00001000 #define DB_INTERNAL_TEMPORARY_DB 0x00002000 #define DB_JOIN_NOSORT 0x00000001 #define DB_LEGACY 0x00000004 #define DB_LOCAL_SITE 0x00000008 #define DB_LOCKDOWN 0x00004000 #define DB_LOCK_CHECK 0x00000001 #define DB_LOCK_IGNORE_REC 0x00000002 #define DB_LOCK_NOWAIT 0x00000004 #define DB_LOCK_RECORD 0x00000008 #define DB_LOCK_SET_TIMEOUT 0x00000010 #define DB_LOCK_SWITCH 0x00000020 #define DB_LOCK_UPGRADE 0x00000040 #define DB_LOG_AUTO_REMOVE 0x00000001 #define DB_LOG_CHKPNT 0x00000001 #define DB_LOG_COMMIT 0x00000004 #define DB_LOG_DIRECT 0x00000002 #define DB_LOG_DSYNC 0x00000004 #define DB_LOG_IN_MEMORY 0x00000008 #define DB_LOG_NOCOPY 0x00000008 #define DB_LOG_NOT_DURABLE 0x00000010 #define DB_LOG_NO_DATA 0x00000002 #define DB_LOG_VERIFY_CAF 0x00000001 #define DB_LOG_VERIFY_DBFILE 0x00000002 #define DB_LOG_VERIFY_ERR 0x00000004 #define DB_LOG_VERIFY_FORWARD 0x00000008 #define DB_LOG_VERIFY_INTERR 0x00000010 #define DB_LOG_VERIFY_PARTIAL 0x00000020 #define DB_LOG_VERIFY_VERBOSE 0x00000040 #define DB_LOG_VERIFY_WARNING 0x00000080 #define DB_LOG_WRNOSYNC 0x00000020 #define DB_LOG_ZERO 0x00000010 #define DB_MPOOL_CREATE 0x00000001 #define DB_MPOOL_DIRTY 0x00000002 #define DB_MPOOL_DISCARD 0x00000001 #define DB_MPOOL_EDIT 0x00000004 #define DB_MPOOL_FREE 0x00000008 #define DB_MPOOL_LAST 0x00000010 #define DB_MPOOL_NEW 0x00000020 #define DB_MPOOL_NOFILE 0x00000001 #define DB_MPOOL_NOLOCK 0x00000004 #define DB_MPOOL_TRY 0x00000040 #define DB_MPOOL_UNLINK 0x00000002 #define DB_MULTIPLE 0x00000800 #define DB_MULTIPLE_KEY 0x00004000 #define DB_MULTIVERSION 0x00000008 #define DB_MUTEX_ALLOCATED 0x00000001 #define DB_MUTEX_LOCKED 0x00000002 #define DB_MUTEX_LOGICAL_LOCK 0x00000004 #define DB_MUTEX_PROCESS_ONLY 0x00000008 #define DB_MUTEX_SELF_BLOCK 0x00000010 #define DB_MUTEX_SHARED 0x00000020 #define DB_NOERROR 0x00004000 #define DB_NOFLUSH 0x00001000 #define DB_NOLOCKING 0x00002000 #define DB_NOMMAP 0x00000010 #define DB_NOORDERCHK 0x00000002 #define DB_NOPANIC 0x00004000 #define DB_NOSYNC 0x00000001 #define DB_NO_AUTO_COMMIT 0x00008000 #define DB_NO_CHECKPOINT 0x00008000 #define DB_ODDFILESIZE 0x00000080 #define DB_ORDERCHKONLY 0x00000004 #define DB_OVERWRITE 0x00008000 #define DB_PANIC_ENVIRONMENT 0x00010000 #define DB_PRINTABLE 0x00000008 #define DB_PRIVATE 0x00010000 #define DB_PR_PAGE 0x00000010 #define DB_PR_RECOVERYTEST 0x00000020 #define DB_RDONLY 0x00000400 #define DB_RDWRMASTER 0x00010000 #define DB_READ_COMMITTED 0x00000400 #define DB_READ_UNCOMMITTED 0x00000200 #define DB_RECNUM 0x00000040 #define DB_RECOVER 0x00000002 #define DB_RECOVER_FATAL 0x00020000 #define DB_REGION_INIT 0x00020000 #define DB_REGISTER 0x00040000 #define DB_RENUMBER 0x00000080 #define DB_REPMGR_CONF_2SITE_STRICT 0x00000001 #define DB_REPMGR_CONF_ELECTIONS 0x00000002 #define DB_REPMGR_NEED_RESPONSE 0x00000001 #define DB_REPMGR_PEER 0x00000010 #define DB_REP_ANYWHERE 0x00000001 #define DB_REP_CLIENT 0x00000001 #define DB_REP_CONF_AUTOINIT 0x00000004 #define DB_REP_CONF_AUTOROLLBACK 0x00000008 #define DB_REP_CONF_BULK 0x00000010 #define DB_REP_CONF_DELAYCLIENT 0x00000020 #define DB_REP_CONF_INMEM 0x00000040 #define DB_REP_CONF_LEASE 0x00000080 #define DB_REP_CONF_NOWAIT 0x00000100 #define DB_REP_ELECTION 0x00000004 #define DB_REP_MASTER 0x00000002 #define DB_REP_NOBUFFER 0x00000002 #define DB_REP_PERMANENT 0x00000004 #define DB_REP_REREQUEST 0x00000008 #define DB_REVSPLITOFF 0x00000100 #define DB_RMW 0x00002000 #define DB_SALVAGE 0x00000040 #define DB_SA_SKIPFIRSTKEY 0x00000080 #define DB_SA_UNKNOWNKEY 0x00000100 #define DB_SEQ_DEC 0x00000001 #define DB_SEQ_INC 0x00000002 #define DB_SEQ_RANGE_SET 0x00000004 #define DB_SEQ_WRAP 0x00000008 #define DB_SEQ_WRAPPED 0x00000010 #define DB_SET_LOCK_TIMEOUT 0x00000001 #define DB_SET_REG_TIMEOUT 0x00000004 #define DB_SET_TXN_NOW 0x00000008 #define DB_SET_TXN_TIMEOUT 0x00000002 #define DB_SHALLOW_DUP 0x00000100 #define DB_SNAPSHOT 0x00000200 #define DB_STAT_ALL 0x00000004 #define DB_STAT_ALLOC 0x00000008 #define DB_STAT_CLEAR 0x00000001 #define DB_STAT_LOCK_CONF 0x00000010 #define DB_STAT_LOCK_LOCKERS 0x00000020 #define DB_STAT_LOCK_OBJECTS 0x00000040 #define DB_STAT_LOCK_PARAMS 0x00000080 #define DB_STAT_MEMP_HASH 0x00000010 #define DB_STAT_MEMP_NOERROR 0x00000020 #define DB_STAT_SUBSYSTEM 0x00000002 #define DB_STAT_SUMMARY 0x00000010 #define DB_ST_DUPOK 0x00000200 #define DB_ST_DUPSET 0x00000400 #define DB_ST_DUPSORT 0x00000800 #define DB_ST_IS_RECNO 0x00001000 #define DB_ST_OVFL_LEAF 0x00002000 #define DB_ST_RECNUM 0x00004000 #define DB_ST_RELEN 0x00008000 #define DB_ST_TOPLEVEL 0x00010000 #define DB_SYSTEM_MEM 0x00080000 #define DB_THREAD 0x00000020 #define DB_TIME_NOTGRANTED 0x00040000 #define DB_TRUNCATE 0x00020000 #define DB_TXN_BULK 0x00000010 #define DB_TXN_FAMILY 0x00000040 #define DB_TXN_NOSYNC 0x00000001 #define DB_TXN_NOT_DURABLE 0x00000004 #define DB_TXN_NOWAIT 0x00000002 #define DB_TXN_SNAPSHOT 0x00000004 #define DB_TXN_SYNC 0x00000008 #define DB_TXN_WAIT 0x00000080 #define DB_TXN_WRITE_NOSYNC 0x00000020 #define DB_UNREF 0x00020000 #define DB_UPGRADE 0x00000001 #define DB_USE_ENVIRON 0x00000004 #define DB_USE_ENVIRON_ROOT 0x00000008 #define DB_VERB_BACKUP 0x00000001 #define DB_VERB_DEADLOCK 0x00000002 #define DB_VERB_FILEOPS 0x00000004 #define DB_VERB_FILEOPS_ALL 0x00000008 #define DB_VERB_RECOVERY 0x00000010 #define DB_VERB_REGISTER 0x00000020 #define DB_VERB_REPLICATION 0x00000040 #define DB_VERB_REPMGR_CONNFAIL 0x00000080 #define DB_VERB_REPMGR_MISC 0x00000100 #define DB_VERB_REP_ELECT 0x00000200 #define DB_VERB_REP_LEASE 0x00000400 #define DB_VERB_REP_MISC 0x00000800 #define DB_VERB_REP_MSGS 0x00001000 #define DB_VERB_REP_SYNC 0x00002000 #define DB_VERB_REP_SYSTEM 0x00004000 #define DB_VERB_REP_TEST 0x00008000 #define DB_VERB_WAITSFOR 0x00010000 #define DB_VERIFY 0x00000002 #define DB_VERIFY_PARTITION 0x00040000 #define DB_WRITECURSOR 0x00000010 #define DB_WRITELOCK 0x00000020 #define DB_WRITEOPEN 0x00040000 #define DB_XA_CREATE 0x00000001 #define DB_YIELDCPU 0x00080000 /* DO NOT EDIT: automatically built by dist/s_include. */ #ifndef _DB_EXT_PROT_IN_ #define _DB_EXT_PROT_IN_ #if defined(__cplusplus) extern "C" { #endif int db_copy __P((DB_ENV *, const char *, const char *, const char *)); int db_create __P((DB **, DB_ENV *, u_int32_t)); char *db_strerror __P((int)); int db_env_set_func_assert __P((void (*)(const char *, const char *, int))); int db_env_set_func_close __P((int (*)(int))); int db_env_set_func_dirfree __P((void (*)(char **, int))); int db_env_set_func_dirlist __P((int (*)(const char *, char ***, int *))); int db_env_set_func_exists __P((int (*)(const char *, int *))); int db_env_set_func_free __P((void (*)(void *))); int db_env_set_func_fsync __P((int (*)(int))); int db_env_set_func_ftruncate __P((int (*)(int, off_t))); int db_env_set_func_ioinfo __P((int (*)(const char *, int, u_int32_t *, u_int32_t *, u_int32_t *))); int db_env_set_func_malloc __P((void *(*)(size_t))); int db_env_set_func_file_map __P((int (*)(DB_ENV *, char *, size_t, int, void **), int (*)(DB_ENV *, void *))); int db_env_set_func_region_map __P((int (*)(DB_ENV *, char *, size_t, int *, void **), int (*)(DB_ENV *, void *))); int db_env_set_func_pread __P((ssize_t (*)(int, void *, size_t, off_t))); int db_env_set_func_pwrite __P((ssize_t (*)(int, const void *, size_t, off_t))); int db_env_set_func_open __P((int (*)(const char *, int, ...))); int db_env_set_func_read __P((ssize_t (*)(int, void *, size_t))); int db_env_set_func_realloc __P((void *(*)(void *, size_t))); int db_env_set_func_rename __P((int (*)(const char *, const char *))); int db_env_set_func_seek __P((int (*)(int, off_t, int))); int db_env_set_func_unlink __P((int (*)(const char *))); int db_env_set_func_write __P((ssize_t (*)(int, const void *, size_t))); int db_env_set_func_yield __P((int (*)(u_long, u_long))); int db_env_create __P((DB_ENV **, u_int32_t)); char *db_version __P((int *, int *, int *)); char *db_full_version __P((int *, int *, int *, int *, int *)); int log_compare __P((const DB_LSN *, const DB_LSN *)); #if defined(DB_WIN32) && !defined(DB_WINCE) int db_env_set_win_security __P((SECURITY_ATTRIBUTES *sa)); #endif int db_sequence_create __P((DB_SEQUENCE **, DB *, u_int32_t)); #if DB_DBM_HSEARCH != 0 int __db_ndbm_clearerr __P((DBM *)); void __db_ndbm_close __P((DBM *)); int __db_ndbm_delete __P((DBM *, datum)); int __db_ndbm_dirfno __P((DBM *)); int __db_ndbm_error __P((DBM *)); datum __db_ndbm_fetch __P((DBM *, datum)); datum __db_ndbm_firstkey __P((DBM *)); datum __db_ndbm_nextkey __P((DBM *)); DBM *__db_ndbm_open __P((const char *, int, int)); int __db_ndbm_pagfno __P((DBM *)); int __db_ndbm_rdonly __P((DBM *)); int __db_ndbm_store __P((DBM *, datum, datum, int)); int __db_dbm_close __P((void)); int __db_dbm_delete __P((datum)); datum __db_dbm_fetch __P((datum)); datum __db_dbm_firstkey __P((void)); int __db_dbm_init __P((char *)); datum __db_dbm_nextkey __P((datum)); int __db_dbm_store __P((datum, datum)); #endif #if DB_DBM_HSEARCH != 0 int __db_hcreate __P((size_t)); ENTRY *__db_hsearch __P((ENTRY, ACTION)); void __db_hdestroy __P((void)); #endif #if defined(__cplusplus) } #endif #endif /* !_DB_EXT_PROT_IN_ */ err.h000064400000004273147631660260005526 0ustar00/* 4.4BSD utility functions for error messages. Copyright (C) 1995,1996,1997,1998,1999,2003,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _ERR_H #define _ERR_H 1 #include #define __need___va_list #include #ifndef __GNUC_VA_LIST # define __gnuc_va_list __ptr_t #endif __BEGIN_DECLS /* Print "program: ", FORMAT, ": ", the standard error string for errno, and a newline, on stderr. */ extern void warn (const char *__format, ...) __attribute__ ((__format__ (__printf__, 1, 2))); extern void vwarn (const char *__format, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 1, 0))); /* Likewise, but without ": " and the standard error string. */ extern void warnx (const char *__format, ...) __attribute__ ((__format__ (__printf__, 1, 2))); extern void vwarnx (const char *__format, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 1, 0))); /* Likewise, and then exit with STATUS. */ extern void err (int __status, const char *__format, ...) __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3))); extern void verr (int __status, const char *__format, __gnuc_va_list) __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0))); extern void errx (int __status, const char *__format, ...) __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3))); extern void verrx (int __status, const char *, __gnuc_va_list) __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0))); __END_DECLS #endif /* err.h */ zlib.h000064400000251275147631660260005704 0ustar00/* zlib.h -- interface of the 'zlib' general purpose compression library version 1.2.7, May 2nd, 2012 Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Jean-loup Gailly Mark Adler jloup@gzip.org madler@alumni.caltech.edu The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). */ #ifndef ZLIB_H #define ZLIB_H #include "zconf.h" #ifdef __cplusplus extern "C" { #endif #define ZLIB_VERSION "1.2.7" #define ZLIB_VERNUM 0x1270 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 2 #define ZLIB_VER_REVISION 7 #define ZLIB_VER_SUBREVISION 0 /* The 'zlib' compression library provides in-memory compression and decompression functions, including integrity checks of the uncompressed data. This version of the library supports only one compression method (deflation) but other algorithms will be added later and will have the same stream interface. Compression can be done in a single step if the buffers are large enough, or can be done by repeated calls of the compression function. In the latter case, the application must provide more input and/or consume the output (providing more output space) before each call. The compressed data format used by default by the in-memory functions is the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped around a deflate stream, which is itself documented in RFC 1951. The library also supports reading and writing files in gzip (.gz) format with an interface similar to that of stdio using the functions that start with "gz". The gzip format is different from the zlib format. gzip is a gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. This library can optionally read and write gzip streams in memory as well. The zlib format was designed to be compact and fast for use in memory and on communications channels. The gzip format was designed for single- file compression on file systems, has a larger header than zlib to maintain directory information, and uses a different, slower check method than zlib. The library does not install any signal handler. The decoder checks the consistency of the compressed data, so the library should never crash even in case of corrupted input. */ typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); typedef void (*free_func) OF((voidpf opaque, voidpf address)); struct internal_state; typedef struct z_stream_s { z_const Bytef *next_in; /* next input byte */ uInt avail_in; /* number of bytes available at next_in */ uLong total_in; /* total number of input bytes read so far */ Bytef *next_out; /* next output byte should be put there */ uInt avail_out; /* remaining free space at next_out */ uLong total_out; /* total number of bytes output so far */ z_const char *msg; /* last error message, NULL if no error */ struct internal_state FAR *state; /* not visible by applications */ alloc_func zalloc; /* used to allocate the internal state */ free_func zfree; /* used to free the internal state */ voidpf opaque; /* private data object passed to zalloc and zfree */ int data_type; /* best guess about the data type: binary or text */ uLong adler; /* adler32 value of the uncompressed data */ uLong reserved; /* reserved for future use */ } z_stream; typedef z_stream FAR *z_streamp; /* gzip header information passed to and from zlib routines. See RFC 1952 for more details on the meanings of these fields. */ typedef struct gz_header_s { int text; /* true if compressed data believed to be text */ uLong time; /* modification time */ int xflags; /* extra flags (not used when writing a gzip file) */ int os; /* operating system */ Bytef *extra; /* pointer to extra field or Z_NULL if none */ uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ uInt extra_max; /* space at extra (only when reading header) */ Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ uInt name_max; /* space at name (only when reading header) */ Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ uInt comm_max; /* space at comment (only when reading header) */ int hcrc; /* true if there was or will be a header crc */ int done; /* true when done reading gzip header (not used when writing a gzip file) */ } gz_header; typedef gz_header FAR *gz_headerp; /* The application must update next_in and avail_in when avail_in has dropped to zero. It must update next_out and avail_out when avail_out has dropped to zero. The application must initialize zalloc, zfree and opaque before calling the init function. All other fields are set by the compression library and must not be updated by the application. The opaque value provided by the application will be passed as the first parameter for calls of zalloc and zfree. This can be useful for custom memory management. The compression library attaches no meaning to the opaque value. zalloc must return Z_NULL if there is not enough memory for the object. If zlib is used in a multi-threaded application, zalloc and zfree must be thread safe. On 16-bit systems, the functions zalloc and zfree must be able to allocate exactly 65536 bytes, but will not be required to allocate more than this if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers returned by zalloc for objects of exactly 65536 bytes *must* have their offset normalized to zero. The default allocation function provided by this library ensures this (see zutil.c). To reduce memory requirements and avoid any allocation of 64K objects, at the expense of compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). The fields total_in and total_out can be used for statistics or progress reports. After compression, total_in holds the total size of the uncompressed data and may be saved for use in the decompressor (particularly if the decompressor wants to decompress everything in a single step). */ /* constants */ #define Z_NO_FLUSH 0 #define Z_PARTIAL_FLUSH 1 #define Z_SYNC_FLUSH 2 #define Z_FULL_FLUSH 3 #define Z_FINISH 4 #define Z_BLOCK 5 #define Z_TREES 6 /* Allowed flush values; see deflate() and inflate() below for details */ #define Z_OK 0 #define Z_STREAM_END 1 #define Z_NEED_DICT 2 #define Z_ERRNO (-1) #define Z_STREAM_ERROR (-2) #define Z_DATA_ERROR (-3) #define Z_MEM_ERROR (-4) #define Z_BUF_ERROR (-5) #define Z_VERSION_ERROR (-6) /* Return codes for the compression/decompression functions. Negative values * are errors, positive values are used for special but normal events. */ #define Z_NO_COMPRESSION 0 #define Z_BEST_SPEED 1 #define Z_BEST_COMPRESSION 9 #define Z_DEFAULT_COMPRESSION (-1) /* compression levels */ #define Z_FILTERED 1 #define Z_HUFFMAN_ONLY 2 #define Z_RLE 3 #define Z_FIXED 4 #define Z_DEFAULT_STRATEGY 0 /* compression strategy; see deflateInit2() below for details */ #define Z_BINARY 0 #define Z_TEXT 1 #define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ #define Z_UNKNOWN 2 /* Possible values of the data_type field (though see inflate()) */ #define Z_DEFLATED 8 /* The deflate compression method (the only one supported in this version) */ #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ #define zlib_version zlibVersion() /* for compatibility with versions < 1.0.2 */ /* basic functions */ ZEXTERN const char * ZEXPORT zlibVersion OF((void)); /* The application can compare zlibVersion and ZLIB_VERSION for consistency. If the first character differs, the library code actually used is not compatible with the zlib.h header file used by the application. This check is automatically made by deflateInit and inflateInit. */ /* ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); Initializes the internal stream state for compression. The fields zalloc, zfree and opaque must be initialized before by the caller. If zalloc and zfree are set to Z_NULL, deflateInit updates them to use default allocation functions. The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION requests a default compromise between speed and compression (currently equivalent to level 6). deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if level is not a valid compression level, or Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible with the version assumed by the caller (ZLIB_VERSION). msg is set to null if there is no error message. deflateInit does not perform any compression: this will be done by deflate(). */ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); /* deflate compresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush. The detailed semantics are as follows. deflate performs one or both of the following actions: - Compress more input starting at next_in and update next_in and avail_in accordingly. If not all input can be processed (because there is not enough room in the output buffer), next_in and avail_in are updated and processing will resume at this point for the next call of deflate(). - Provide more output starting at next_out and update next_out and avail_out accordingly. This action is forced if the parameter flush is non zero. Forcing flush frequently degrades the compression ratio, so this parameter should be set only when necessary (in interactive applications). Some output may be provided even if flush is not set. Before the call of deflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming more output, and updating avail_in or avail_out accordingly; avail_out should never be zero before the call. The application can consume the compressed output when it wants, for example when the output buffer is full (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to decide how much data to accumulate before producing output, in order to maximize compression. If the parameter flush is set to Z_SYNC_FLUSH, all pending output is flushed to the output buffer and the output is aligned on a byte boundary, so that the decompressor can get all input data available so far. (In particular avail_in is zero after the call if enough output space has been provided before the call.) Flushing may degrade compression for some compression algorithms and so it should be used only when necessary. This completes the current deflate block and follows it with an empty stored block that is three bits plus filler bits to the next byte, followed by four bytes (00 00 ff ff). If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the output buffer, but the output is not aligned to a byte boundary. All of the input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. This completes the current deflate block and follows it with an empty fixed codes block that is 10 bits long. This assures that enough bytes are output in order for the decompressor to finish the block before the empty fixed code block. If flush is set to Z_BLOCK, a deflate block is completed and emitted, as for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to seven bits of the current block are held to be written as the next byte after the next deflate block is completed. In this case, the decompressor may not be provided enough bits at this point in order to complete decompression of the data provided so far to the compressor. It may need to wait for the next block to be emitted. This is for advanced applications that need to control the emission of deflate blocks. If flush is set to Z_FULL_FLUSH, all output is flushed as with Z_SYNC_FLUSH, and the compression state is reset so that decompression can restart from this point if previous compressed data has been damaged or if random access is desired. Using Z_FULL_FLUSH too often can seriously degrade compression. If deflate returns with avail_out == 0, this function must be called again with the same value of the flush parameter and more output space (updated avail_out), until the flush is complete (deflate returns with non-zero avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that avail_out is greater than six to avoid repeated flush markers due to avail_out == 0 on return. If the parameter flush is set to Z_FINISH, pending input is processed, pending output is flushed and deflate returns with Z_STREAM_END if there was enough output space; if deflate returns with Z_OK, this function must be called again with Z_FINISH and more output space (updated avail_out) but no more input data, until it returns with Z_STREAM_END or an error. After deflate has returned Z_STREAM_END, the only possible operations on the stream are deflateReset or deflateEnd. Z_FINISH can be used immediately after deflateInit if all the compression is to be done in a single step. In this case, avail_out must be at least the value returned by deflateBound (see below). Then deflate is guaranteed to return Z_STREAM_END. If not enough output space is provided, deflate will not return Z_STREAM_END, and it must be called again as described above. deflate() sets strm->adler to the adler32 checksum of all input read so far (that is, total_in bytes). deflate() may update strm->data_type if it can make a good guess about the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered binary. This field is only for information purposes and does not affect the compression algorithm in any manner. deflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if all input has been consumed and all output has been produced (only when flush is set to Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and deflate() can be called again with more input and more output space to continue compressing. */ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending output. deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state was inconsistent, Z_DATA_ERROR if the stream was freed prematurely (some input or output was discarded). In the error case, msg may be set but then points to a static string (which must not be deallocated). */ /* ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); Initializes the internal stream state for decompression. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by the caller. If next_in is not Z_NULL and avail_in is large enough (the exact value depends on the compression method), inflateInit determines the compression method from the zlib header and allocates all data structures accordingly; otherwise the allocation will be deferred to the first call of inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to use default allocation functions. inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the version assumed by the caller, or Z_STREAM_ERROR if the parameters are invalid, such as a null pointer to the structure. msg is set to null if there is no error message. inflateInit does not perform any decompression apart from possibly reading the zlib header if present: actual decompression will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unused and unchanged.) The current implementation of inflateInit() does not process any header information -- that is deferred until inflate() is called. */ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); /* inflate decompresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush. The detailed semantics are as follows. inflate performs one or both of the following actions: - Decompress more input starting at next_in and update next_in and avail_in accordingly. If not all input can be processed (because there is not enough room in the output buffer), next_in is updated and processing will resume at this point for the next call of inflate(). - Provide more output starting at next_out and update next_out and avail_out accordingly. inflate() provides as much output as possible, until there is no more input data or no more space in the output buffer (see below about the flush parameter). Before the call of inflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming more output, and updating the next_* and avail_* values accordingly. The application can consume the uncompressed output when it wants, for example when the output buffer is full (avail_out == 0), or after each call of inflate(). If inflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much output as possible to the output buffer. Z_BLOCK requests that inflate() stop if and when it gets to the next deflate block boundary. When decoding the zlib or gzip format, this will cause inflate() to return immediately after the header and before the first block. When doing a raw inflate, inflate() will go ahead and process the first block, and will return when it gets to the end of that block, or when it runs out of data. The Z_BLOCK option assists in appending to or combining deflate streams. Also to assist in this, on return inflate() will set strm->data_type to the number of unused bits in the last byte taken from strm->next_in, plus 64 if inflate() is currently decoding the last block in the deflate stream, plus 128 if inflate() returned immediately after decoding an end-of-block code or decoding the complete header up to just before the first byte of the deflate stream. The end-of-block will not be indicated until all of the uncompressed data from that block has been written to strm->next_out. The number of unused bits may in general be greater than seven, except when bit 7 of data_type is set, in which case the number of unused bits will be less than eight. data_type is set as noted here every time inflate() returns for all flush options, and so can be used to determine the amount of currently consumed input in bits. The Z_TREES option behaves as Z_BLOCK does, but it also returns when the end of each deflate block header is reached, before any actual data in that block is decoded. This allows the caller to determine the length of the deflate block header for later use in random access within a deflate block. 256 is added to the value of strm->data_type when inflate() returns immediately after reaching the end of the deflate block header. inflate() should normally be called until it returns Z_STREAM_END or an error. However if all decompression is to be performed in a single step (a single call of inflate), the parameter flush should be set to Z_FINISH. In this case all pending input is processed and all pending output is flushed; avail_out must be large enough to hold all of the uncompressed data for the operation to complete. (The size of the uncompressed data may have been saved by the compressor for this purpose.) The use of Z_FINISH is not required to perform an inflation in one step. However it may be used to inform inflate that a faster approach can be used for the single inflate() call. Z_FINISH also informs inflate to not maintain a sliding window if the stream completes, which reduces inflate's memory footprint. If the stream does not complete, either because not all of the stream is provided or not enough output space is provided, then a sliding window will be allocated and inflate() can be called again to continue the operation as if Z_NO_FLUSH had been used. In this implementation, inflate() always flushes as much output as possible to the output buffer, and always uses the faster approach on the first call. So the effects of the flush parameter in this implementation are on the return value of inflate() as noted below, when inflate() returns early when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of memory for a sliding window when Z_FINISH is used. If a preset dictionary is needed after this call (see inflateSetDictionary below), inflate sets strm->adler to the Adler-32 checksum of the dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise it sets strm->adler to the Adler-32 checksum of all output produced so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described below. At the end of the stream, inflate() checks that its computed adler32 checksum is equal to that saved by the compressor and returns Z_STREAM_END only if the checksum is correct. inflate() can decompress and check either zlib-wrapped or gzip-wrapped deflate data. The header type is detected automatically, if requested when initializing with inflateInit2(). Any information contained in the gzip header is not retained, so applications that need that information should instead use raw inflate, see inflateInit2() below, or inflateBack() and perform their own processing of the gzip header and trailer. When processing gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output producted so far. The CRC-32 is checked against the gzip trailer. inflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if the end of the compressed data has been reached and all uncompressed output has been produced, Z_NEED_DICT if a preset dictionary is needed at this point, Z_DATA_ERROR if the input data was corrupted (input stream not conforming to the zlib format or incorrect check value), Z_STREAM_ERROR if the stream structure was inconsistent (for example next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if no progress is possible or if there was not enough room in the output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and inflate() can be called again with more input and more output space to continue decompressing. If Z_DATA_ERROR is returned, the application may then call inflateSync() to look for a good compression block if a partial recovery of the data is desired. */ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending output. inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state was inconsistent. In the error case, msg may be set but then points to a static string (which must not be deallocated). */ /* Advanced functions */ /* The following functions are needed only in some special applications. */ /* ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy)); This is another version of deflateInit with more compression options. The fields next_in, zalloc, zfree and opaque must be initialized before by the caller. The method parameter is the compression method. It must be Z_DEFLATED in this version of the library. The windowBits parameter is the base two logarithm of the window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. Larger values of this parameter result in better compression at the expense of memory usage. The default value is 15 if deflateInit is used instead. windowBits can also be -8..-15 for raw deflate. In this case, -windowBits determines the window size. deflate() will then generate raw deflate data with no zlib header or trailer, and will not compute an adler32 check value. windowBits can also be greater than 15 for optional gzip encoding. Add 16 to windowBits to write a simple gzip header and trailer around the compressed data instead of a zlib wrapper. The gzip header will have no file name, no extra data, no comment, no modification time (set to zero), no header crc, and the operating system will be set to 255 (unknown). If a gzip stream is being written, strm->adler is a crc32 instead of an adler32. The memLevel parameter specifies how much memory should be allocated for the internal compression state. memLevel=1 uses minimum memory but is slow and reduces compression ratio; memLevel=9 uses maximum memory for optimal speed. The default value is 8. See zconf.h for total memory usage as a function of windowBits and memLevel. The strategy parameter is used to tune the compression algorithm. Use the value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no string match), or Z_RLE to limit match distances to one (run-length encoding). Filtered data consists mostly of small values with a somewhat random distribution. In this case, the compression algorithm is tuned to compress them better. The effect of Z_FILTERED is to force more Huffman coding and less string matching; it is somewhat intermediate between Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately. Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications. deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible with the version assumed by the caller (ZLIB_VERSION). msg is set to null if there is no error message. deflateInit2 does not perform any compression: this will be done by deflate(). */ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, const Bytef *dictionary, uInt dictLength)); /* Initializes the compression dictionary from the given byte sequence without producing any compressed output. When using the zlib format, this function must be called immediately after deflateInit, deflateInit2 or deflateReset, and before any call of deflate. When doing raw deflate, this function must be called either before any call of deflate, or immediately after the completion of a deflate block, i.e. after all input has been consumed and all output has been delivered when using any of the flush options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The compressor and decompressor must use exactly the same dictionary (see inflateSetDictionary). The dictionary should consist of strings (byte sequences) that are likely to be encountered later in the data to be compressed, with the most commonly used strings preferably put towards the end of the dictionary. Using a dictionary is most useful when the data to be compressed is short and can be predicted with good accuracy; the data can then be compressed better than with the default empty dictionary. Depending on the size of the compression data structures selected by deflateInit or deflateInit2, a part of the dictionary may in effect be discarded, for example if the dictionary is larger than the window size provided in deflateInit or deflateInit2. Thus the strings most likely to be useful should be put at the end of the dictionary, not at the front. In addition, the current implementation of deflate will use at most the window size minus 262 bytes of the provided dictionary. Upon return of this function, strm->adler is set to the adler32 value of the dictionary; the decompressor may later use this value to determine which dictionary has been used by the compressor. (The adler32 value applies to the whole dictionary even if only a subset of the dictionary is actually used by the compressor.) If a raw deflate was requested, then the adler32 value is not computed and strm->adler is not set. deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is inconsistent (for example if deflate has already been called for this stream or if not at a block boundary for raw deflate). deflateSetDictionary does not perform any compression: this will be done by deflate(). */ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, z_streamp source)); /* Sets the destination stream as a complete copy of the source stream. This function can be useful when several compression strategies will be tried, for example when there are several ways of pre-processing the input data with a filter. The streams that will be discarded should then be freed by calling deflateEnd. Note that deflateCopy duplicates the internal compression state which can be quite large, so this strategy is slow and can consume lots of memory. deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc being Z_NULL). msg is left unchanged in both source and destination. */ ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); /* This function is equivalent to deflateEnd followed by deflateInit, but does not free and reallocate all the internal compression state. The stream will keep the same compression level and any other attributes that may have been set by deflateInit2. deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being Z_NULL). */ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, int level, int strategy)); /* Dynamically update the compression level and compression strategy. The interpretation of level and strategy is as in deflateInit2. This can be used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different strategy. If the compression level is changed, the input available so far is compressed with the old level (and may be flushed); the new level will take effect only at the next call of deflate(). Before the call of deflateParams, the stream state must be set as for a call of deflate(), since the currently available input may have to be compressed and flushed. In particular, strm->avail_out must be non-zero. deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if strm->avail_out was zero. */ ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, int good_length, int max_lazy, int nice_length, int max_chain)); /* Fine tune deflate's internal compression parameters. This should only be used by someone who understands the algorithm used by zlib's deflate for searching for the best matching string, and even then only by the most fanatic optimizer trying to squeeze out the last compressed bit for their specific input data. Read the deflate.c source code for the meaning of the max_lazy, good_length, nice_length, and max_chain parameters. deflateTune() can be called after deflateInit() or deflateInit2(), and returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. */ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, uLong sourceLen)); /* deflateBound() returns an upper bound on the compressed size after deflation of sourceLen bytes. It must be called after deflateInit() or deflateInit2(), and after deflateSetHeader(), if used. This would be used to allocate an output buffer for deflation in a single pass, and so would be called before deflate(). If that first deflate() call is provided the sourceLen input bytes, an output buffer allocated to the size returned by deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed to return Z_STREAM_END. Note that it is possible for the compressed size to be larger than the value returned by deflateBound() if flush options other than Z_FINISH or Z_NO_FLUSH are used. */ ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, unsigned *pending, int *bits)); /* deflatePending() returns the number of bytes and bits of output that have been generated, but not yet provided in the available output. The bytes not provided would be due to the available output space having being consumed. The number of bits of output not provided are between 0 and 7, where they await more bits to join them in order to fill out a full byte. If pending or bits are Z_NULL, then those values are not set. deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, int bits, int value)); /* deflatePrime() inserts bits in the deflate output stream. The intent is that this function is used to start off the deflate output with the bits leftover from a previous deflate stream when appending to it. As such, this function can only be used for raw deflate, and must be used before the first deflate() call after a deflateInit2() or deflateReset(). bits must be less than or equal to 16, and that many of the least significant bits of value will be inserted in the output. deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the source stream state was inconsistent. */ ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, gz_headerp head)); /* deflateSetHeader() provides gzip header information for when a gzip stream is requested by deflateInit2(). deflateSetHeader() may be called after deflateInit2() or deflateReset() and before the first call of deflate(). The text, time, os, extra field, name, and comment information in the provided gz_header structure are written to the gzip header (xflag is ignored -- the extra flags are set according to the compression level). The caller must assure that, if not Z_NULL, name and comment are terminated with a zero byte, and that if extra is not Z_NULL, that extra_len bytes are available there. If hcrc is true, a gzip header crc is included. Note that the current versions of the command-line version of gzip (up through version 1.3.x) do not support header crc's, and will report that it is a "multi-part gzip file" and give up. If deflateSetHeader is not used, the default gzip header has text false, the time set to zero, and os set to 255, with no extra, name, or comment fields. The gzip header is returned to the default state by deflateReset(). deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ /* ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, int windowBits)); This is another version of inflateInit with an extra parameter. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by the caller. The windowBits parameter is the base two logarithm of the maximum window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. The default value is 15 if inflateInit is used instead. windowBits must be greater than or equal to the windowBits value provided to deflateInit2() while compressing, or it must be equal to 15 if deflateInit2() was not used. If a compressed stream with a larger window size is given as input, inflate() will return with the error code Z_DATA_ERROR instead of trying to allocate a larger window. windowBits can also be zero to request that inflate use the window size in the zlib header of the compressed stream. windowBits can also be -8..-15 for raw inflate. In this case, -windowBits determines the window size. inflate() will then process raw deflate data, not looking for a zlib or gzip header, not generating a check value, and not looking for any check values for comparison at the end of the stream. This is for use with other formats that use the deflate compressed data format such as zip. Those formats provide their own check values. If a custom format is developed using the raw deflate format for compressed data, it is recommended that a check value such as an adler32 or a crc32 be applied to the uncompressed data as is done in the zlib, gzip, and zip formats. For most applications, the zlib format should be used as is. Note that comments above on the use in deflateInit2() applies to the magnitude of windowBits. windowBits can also be greater than 15 for optional gzip decoding. Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection, or add 16 to decode only the gzip format (the zlib format will return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a crc32 instead of an adler32. inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the version assumed by the caller, or Z_STREAM_ERROR if the parameters are invalid, such as a null pointer to the structure. msg is set to null if there is no error message. inflateInit2 does not perform any decompression apart from possibly reading the zlib header if present: actual decompression will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unused and unchanged.) The current implementation of inflateInit2() does not process any header information -- that is deferred until inflate() is called. */ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, const Bytef *dictionary, uInt dictLength)); /* Initializes the decompression dictionary from the given uncompressed byte sequence. This function must be called immediately after a call of inflate, if that call returned Z_NEED_DICT. The dictionary chosen by the compressor can be determined from the adler32 value returned by that call of inflate. The compressor and decompressor must use exactly the same dictionary (see deflateSetDictionary). For raw inflate, this function can be called at any time to set the dictionary. If the provided dictionary is smaller than the window and there is already data in the window, then the provided dictionary will amend what's there. The application must insure that the dictionary that was used for compression is provided. inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the expected one (incorrect adler32 value). inflateSetDictionary does not perform any decompression: this will be done by subsequent calls of inflate(). */ ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); /* Skips invalid compressed data until a possible full flush point (see above for the description of deflate with Z_FULL_FLUSH) can be found, or until all available input is skipped. No output is provided. inflateSync searches for a 00 00 FF FF pattern in the compressed data. All full flush points have this pattern, but not all occurences of this pattern are full flush points. inflateSync returns Z_OK if a possible full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the success case, the application may save the current current value of total_in which indicates where valid compressed data was found. In the error case, the application may repeatedly call inflateSync, providing more input each time, until success or end of the input data. */ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, z_streamp source)); /* Sets the destination stream as a complete copy of the source stream. This function can be useful when randomly accessing a large stream. The first pass through the stream can periodically record the inflate state, allowing restarting inflate at those points when randomly accessing the stream. inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc being Z_NULL). msg is left unchanged in both source and destination. */ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); /* This function is equivalent to inflateEnd followed by inflateInit, but does not free and reallocate all the internal decompression state. The stream will keep attributes that may have been set by inflateInit2. inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being Z_NULL). */ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, int windowBits)); /* This function is the same as inflateReset, but it also permits changing the wrap and window size requests. The windowBits parameter is interpreted the same as it is for inflateInit2. inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being Z_NULL), or if the windowBits parameter is invalid. */ ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, int bits, int value)); /* This function inserts bits in the inflate input stream. The intent is that this function is used to start inflating at a bit position in the middle of a byte. The provided bits will be used before any bytes are used from next_in. This function should only be used with raw inflate, and should be used before the first inflate() call after inflateInit2() or inflateReset(). bits must be less than or equal to 16, and that many of the least significant bits of value will be inserted in the input. If bits is negative, then the input stream bit buffer is emptied. Then inflatePrime() can be called again to put bits in the buffer. This is used to clear out bits leftover after feeding inflate a block description prior to feeding inflate codes. inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); /* This function returns two values, one in the lower 16 bits of the return value, and the other in the remaining upper bits, obtained by shifting the return value down 16 bits. If the upper value is -1 and the lower value is zero, then inflate() is currently decoding information outside of a block. If the upper value is -1 and the lower value is non-zero, then inflate is in the middle of a stored block, with the lower value equaling the number of bytes from the input remaining to copy. If the upper value is not -1, then it is the number of bits back from the current bit position in the input of the code (literal or length/distance pair) currently being processed. In that case the lower value is the number of bytes already emitted for that code. A code is being processed if inflate is waiting for more input to complete decoding of the code, or if it has completed decoding but is waiting for more output space to write the literal or match data. inflateMark() is used to mark locations in the input data for random access, which may be at bit positions, and to note those cases where the output of a code may span boundaries of random access blocks. The current location in the input stream can be determined from avail_in and data_type as noted in the description for the Z_BLOCK flush parameter for inflate. inflateMark returns the value noted above or -1 << 16 if the provided source stream state was inconsistent. */ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, gz_headerp head)); /* inflateGetHeader() requests that gzip header information be stored in the provided gz_header structure. inflateGetHeader() may be called after inflateInit2() or inflateReset(), and before the first call of inflate(). As inflate() processes the gzip stream, head->done is zero until the header is completed, at which time head->done is set to one. If a zlib stream is being decoded, then head->done is set to -1 to indicate that there will be no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be used to force inflate() to return immediately after header processing is complete and before any actual data is decompressed. The text, time, xflags, and os fields are filled in with the gzip header contents. hcrc is set to true if there is a header CRC. (The header CRC was valid if done is set to one.) If extra is not Z_NULL, then extra_max contains the maximum number of bytes to write to extra. Once done is true, extra_len contains the actual extra field length, and extra contains the extra field, or that field truncated if extra_max is less than extra_len. If name is not Z_NULL, then up to name_max characters are written there, terminated with a zero unless the length is greater than name_max. If comment is not Z_NULL, then up to comm_max characters are written there, terminated with a zero unless the length is greater than comm_max. When any of extra, name, or comment are not Z_NULL and the respective field is not present in the header, then that field is set to Z_NULL to signal its absence. This allows the use of deflateSetHeader() with the returned structure to duplicate the header. However if those fields are set to allocated memory, then the application will need to save those pointers elsewhere so that they can be eventually freed. If inflateGetHeader is not used, then the header information is simply discarded. The header is always checked for validity, including the header CRC if present. inflateReset() will reset the process to discard the header information. The application would need to call inflateGetHeader() again to retrieve the header from the next gzip stream. inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ /* ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, unsigned char FAR *window)); Initialize the internal stream state for decompression using inflateBack() calls. The fields zalloc, zfree and opaque in strm must be initialized before the call. If zalloc and zfree are Z_NULL, then the default library- derived memory allocation routines are used. windowBits is the base two logarithm of the window size, in the range 8..15. window is a caller supplied buffer of that size. Except for special applications where it is assured that deflate was used with small window sizes, windowBits must be 15 and a 32K byte window must be supplied to be able to decompress general deflate streams. See inflateBack() for the usage of these routines. inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of the parameters are invalid, Z_MEM_ERROR if the internal state could not be allocated, or Z_VERSION_ERROR if the version of the library does not match the version of the header file. */ typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, in_func in, void FAR *in_desc, out_func out, void FAR *out_desc)); /* inflateBack() does a raw inflate with a single call using a call-back interface for input and output. This is more efficient than inflate() for file i/o applications in that it avoids copying between the output and the sliding window by simply making the window itself the output buffer. This function trusts the application to not change the output buffer passed by the output function, at least until inflateBack() returns. inflateBackInit() must be called first to allocate the internal state and to initialize the state with the user-provided window buffer. inflateBack() may then be used multiple times to inflate a complete, raw deflate stream with each call. inflateBackEnd() is then called to free the allocated state. A raw deflate stream is one with no zlib or gzip header or trailer. This routine would normally be used in a utility that reads zip or gzip files and writes out uncompressed files. The utility would decode the header and process the trailer on its own, hence this routine expects only the raw deflate stream to decompress. This is different from the normal behavior of inflate(), which expects either a zlib or gzip header and trailer around the deflate stream. inflateBack() uses two subroutines supplied by the caller that are then called by inflateBack() for input and output. inflateBack() calls those routines until it reads a complete deflate stream and writes out all of the uncompressed data, or until it encounters an error. The function's parameters and return types are defined above in the in_func and out_func typedefs. inflateBack() will call in(in_desc, &buf) which should return the number of bytes of provided input, and a pointer to that input in buf. If there is no input available, in() must return zero--buf is ignored in that case--and inflateBack() will return a buffer error. inflateBack() will call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() should return zero on success, or non-zero on failure. If out() returns non-zero, inflateBack() will return with an error. Neither in() nor out() are permitted to change the contents of the window provided to inflateBackInit(), which is also the buffer that out() uses to write from. The length written by out() will be at most the window size. Any non-zero amount of input may be provided by in(). For convenience, inflateBack() can be provided input on the first call by setting strm->next_in and strm->avail_in. If that input is exhausted, then in() will be called. Therefore strm->next_in must be initialized before calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in must also be initialized, and then if strm->avail_in is not zero, input will initially be taken from strm->next_in[0 .. strm->avail_in - 1]. The in_desc and out_desc parameters of inflateBack() is passed as the first parameter of in() and out() respectively when they are called. These descriptors can be optionally used to pass any information that the caller- supplied in() and out() functions need to do their job. On return, inflateBack() will set strm->next_in and strm->avail_in to pass back any unused input that was provided by the last in() call. The return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR if in() or out() returned an error, Z_DATA_ERROR if there was a format error in the deflate stream (in which case strm->msg is set to indicate the nature of the error), or Z_STREAM_ERROR if the stream was not properly initialized. In the case of Z_BUF_ERROR, an input or output error can be distinguished using strm->next_in which will be Z_NULL only if in() returned an error. If strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning non-zero. (in() will always be called before out(), so strm->next_in is assured to be defined if out() returns non-zero.) Note that inflateBack() cannot return Z_OK. */ ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); /* All memory allocated by inflateBackInit() is freed. inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream state was inconsistent. */ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); /* Return flags indicating compile-time options. Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: 1.0: size of uInt 3.2: size of uLong 5.4: size of voidpf (pointer) 7.6: size of z_off_t Compiler, assembler, and debug options: 8: DEBUG 9: ASMV or ASMINF -- use ASM code 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention 11: 0 (reserved) One-time table building (smaller code, but not thread-safe if true): 12: BUILDFIXED -- build static block decoding tables when needed 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed 14,15: 0 (reserved) Library content (indicates missing functionality): 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking deflate code when not needed) 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect and decode gzip streams (to avoid linking crc code) 18-19: 0 (reserved) Operation variations (changes in library functionality): 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate 21: FASTEST -- deflate algorithm with only one, lowest compression level 22,23: 0 (reserved) The sprintf variant used by gzprintf (zero is best): 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! 26: 0 = returns value, 1 = void -- 1 means inferred string length returned Remainder: 27-31: 0 (reserved) */ #ifndef Z_SOLO /* utility functions */ /* The following utility functions are implemented on top of the basic stream-oriented functions. To simplify the interface, some default options are assumed (compression level and memory usage, standard memory allocation functions). The source code of these utility functions can be modified if you need special options. */ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)); /* Compresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least the value returned by compressBound(sourceLen). Upon exit, destLen is the actual size of the compressed buffer. compress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer. */ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)); /* Compresses the source buffer into the destination buffer. The level parameter has the same meaning as in deflateInit. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least the value returned by compressBound(sourceLen). Upon exit, destLen is the actual size of the compressed buffer. compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); /* compressBound() returns an upper bound on the compressed size after compress() or compress2() on sourceLen bytes. It would be used before a compress() or compress2() call to allocate the destination buffer. */ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)); /* Decompresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be large enough to hold the entire uncompressed data. (The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some mechanism outside the scope of this compression library.) Upon exit, destLen is the actual size of the uncompressed buffer. uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In the case where there is not enough room, uncompress() will fill the output buffer with the uncompressed data up to that point. */ /* gzip file access functions */ /* This library supports reading and writing files in gzip (.gz) format with an interface similar to that of stdio, using the functions that start with "gz". The gzip format is different from the zlib format. gzip is a gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. */ typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ /* ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); Opens a gzip (.gz) file for reading or writing. The mode parameter is as in fopen ("rb" or "wb") but can also include a compression level ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression as in "wb9F". (See the description of deflateInit2 for more information about the strategy parameter.) 'T' will request transparent writing or appending with no compression and not using the gzip format. "a" can be used instead of "w" to request that the gzip stream that will be written be appended to the file. "+" will result in an error, since reading and writing to the same gzip file is not supported. The addition of "x" when writing will create the file exclusively, which fails if the file already exists. On systems that support it, the addition of "e" when reading or writing will set the flag to close the file on an execve() call. These functions, as well as gzip, will read and decode a sequence of gzip streams in a file. The append function of gzopen() can be used to create such a file. (Also see gzflush() for another way to do this.) When appending, gzopen does not test whether the file begins with a gzip stream, nor does it look for the end of the gzip streams to begin appending. gzopen will simply append a gzip stream to the existing file. gzopen can be used to read a file which is not in gzip format; in this case gzread will directly read from the file without decompression. When reading, this will be detected automatically by looking for the magic two- byte gzip header. gzopen returns NULL if the file could not be opened, if there was insufficient memory to allocate the gzFile state, or if an invalid mode was specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). errno can be checked to determine if the reason gzopen failed was that the file could not be opened. */ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); /* gzdopen associates a gzFile with the file descriptor fd. File descriptors are obtained from calls like open, dup, creat, pipe or fileno (if the file has been previously opened with fopen). The mode parameter is as in gzopen. The next call of gzclose on the returned gzFile will also close the file descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, mode);. The duplicated descriptor should be saved to avoid a leak, since gzdopen does not close fd if it fails. If you are using fileno() to get the file descriptor from a FILE *, then you will have to use dup() to avoid double-close()ing the file descriptor. Both gzclose() and fclose() will close the associated file descriptor, so they need to have different file descriptors. gzdopen returns NULL if there was insufficient memory to allocate the gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not provided, or '+' was provided), or if fd is -1. The file descriptor is not used until the next gz* read, write, seek, or close operation, so gzdopen will not detect if fd is invalid (unless fd is -1). */ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); /* Set the internal buffer size used by this library's functions. The default buffer size is 8192 bytes. This function must be called after gzopen() or gzdopen(), and before any other calls that read or write the file. The buffer memory allocation is always deferred to the first read or write. Two buffers are allocated, either both of the specified size when writing, or one of the specified size and the other twice that size when reading. A larger buffer size of, for example, 64K or 128K bytes will noticeably increase the speed of decompression (reading). The new buffer size also affects the maximum length for gzprintf(). gzbuffer() returns 0 on success, or -1 on failure, such as being called too late. */ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); /* Dynamically update the compression level or strategy. See the description of deflateInit2 for the meaning of these parameters. gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not opened for writing. */ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); /* Reads the given number of uncompressed bytes from the compressed file. If the input file is not in gzip format, gzread copies the given number of bytes into the buffer directly from the file. After reaching the end of a gzip stream in the input, gzread will continue to read, looking for another gzip stream. Any number of gzip streams may be concatenated in the input file, and will all be decompressed by gzread(). If something other than a gzip stream is encountered after a gzip stream, that remaining trailing garbage is ignored (and no error is returned). gzread can be used to read a gzip file that is being concurrently written. Upon reaching the end of the input, gzread will return with the available data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then gzclearerr can be used to clear the end of file indicator in order to permit gzread to be tried again. Z_OK indicates that a gzip stream was completed on the last gzread. Z_BUF_ERROR indicates that the input file ended in the middle of a gzip stream. Note that gzread does not return -1 in the event of an incomplete gzip stream. This error is deferred until gzclose(), which will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip stream. Alternatively, gzerror can be used before gzclose to detect this case. gzread returns the number of uncompressed bytes actually read, less than len for end of file, or -1 for error. */ ZEXTERN int ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len)); /* Writes the given number of uncompressed bytes into the compressed file. gzwrite returns the number of uncompressed bytes written or 0 in case of error. */ ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); /* Converts, formats, and writes the arguments to the compressed file under control of the format string, as in fprintf. gzprintf returns the number of uncompressed bytes actually written, or 0 in case of error. The number of uncompressed bytes written is limited to 8191, or one less than the buffer size given to gzbuffer(). The caller should assure that this limit is not exceeded. If it is exceeded, then gzprintf() will return an error (0) with nothing written. In this case, there may also be a buffer overflow with unpredictable consequences, which is possible only if zlib was compiled with the insecure functions sprintf() or vsprintf() because the secure snprintf() or vsnprintf() functions were not available. This can be determined using zlibCompileFlags(). */ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); /* Writes the given null-terminated string to the compressed file, excluding the terminating null character. gzputs returns the number of characters written, or -1 in case of error. */ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); /* Reads bytes from the compressed file until len-1 characters are read, or a newline character is read and transferred to buf, or an end-of-file condition is encountered. If any characters are read or if len == 1, the string is terminated with a null character. If no characters are read due to an end-of-file or len < 1, then the buffer is left untouched. gzgets returns buf which is a null-terminated string, or it returns NULL for end-of-file or in case of error. If there was an error, the contents at buf are indeterminate. */ ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); /* Writes c, converted to an unsigned char, into the compressed file. gzputc returns the value that was written, or -1 in case of error. */ ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); /* Reads one byte from the compressed file. gzgetc returns this byte or -1 in case of end of file or error. This is implemented as a macro for speed. As such, it does not do all of the checking the other functions do. I.e. it does not check to see if file is NULL, nor whether the structure file points to has been clobbered or not. */ ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); /* Push one character back onto the stream to be read as the first character on the next read. At least one character of push-back is allowed. gzungetc() returns the character pushed, or -1 on failure. gzungetc() will fail if c is -1, and may fail if a character has been pushed but not read yet. If gzungetc is used immediately after gzopen or gzdopen, at least the output buffer size of pushed characters is allowed. (See gzbuffer above.) The pushed character will be discarded if the stream is repositioned with gzseek() or gzrewind(). */ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); /* Flushes all pending output into the compressed file. The parameter flush is as in the deflate() function. The return value is the zlib error number (see function gzerror below). gzflush is only permitted when writing. If the flush parameter is Z_FINISH, the remaining data is written and the gzip stream is completed in the output. If gzwrite() is called again, a new gzip stream will be started in the output. gzread() is able to read such concatented gzip streams. gzflush should be called only when strictly necessary because it will degrade compression if called too often. */ /* ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, z_off_t offset, int whence)); Sets the starting position for the next gzread or gzwrite on the given compressed file. The offset represents a number of bytes in the uncompressed data stream. The whence parameter is defined as in lseek(2); the value SEEK_END is not supported. If the file is opened for reading, this function is emulated but can be extremely slow. If the file is opened for writing, only forward seeks are supported; gzseek then compresses a sequence of zeroes up to the new starting position. gzseek returns the resulting offset location as measured in bytes from the beginning of the uncompressed stream, or -1 in case of error, in particular if the file is opened for writing and the new starting position would be before the current position. */ ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); /* Rewinds the given file. This function is supported only for reading. gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) */ /* ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); Returns the starting position for the next gzread or gzwrite on the given compressed file. This position represents a number of bytes in the uncompressed data stream, and is zero when starting, even if appending or reading a gzip stream from the middle of a file using gzdopen(). gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) */ /* ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); Returns the current offset in the file being read or written. This offset includes the count of bytes that precede the gzip stream, for example when appending or when using gzdopen() for reading. When reading, the offset does not include as yet unused buffered input. This information can be used for a progress indicator. On error, gzoffset() returns -1. */ ZEXTERN int ZEXPORT gzeof OF((gzFile file)); /* Returns true (1) if the end-of-file indicator has been set while reading, false (0) otherwise. Note that the end-of-file indicator is set only if the read tried to go past the end of the input, but came up short. Therefore, just like feof(), gzeof() may return false even if there is no more data to read, in the event that the last read request was for the exact number of bytes remaining in the input file. This will happen if the input file size is an exact multiple of the buffer size. If gzeof() returns true, then the read functions will return no more data, unless the end-of-file indicator is reset by gzclearerr() and the input file has grown since the previous end of file was detected. */ ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); /* Returns true (1) if file is being copied directly while reading, or false (0) if file is a gzip stream being decompressed. If the input file is empty, gzdirect() will return true, since the input does not contain a gzip stream. If gzdirect() is used immediately after gzopen() or gzdopen() it will cause buffers to be allocated to allow reading the file to determine if it is a gzip file. Therefore if gzbuffer() is used, it should be called before gzdirect(). When writing, gzdirect() returns true (1) if transparent writing was requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: gzdirect() is not needed when writing. Transparent writing must be explicitly requested, so the application already knows the answer. When linking statically, using gzdirect() will include all of the zlib code for gzip file reading and decompression, which may not be desired.) */ ZEXTERN int ZEXPORT gzclose OF((gzFile file)); /* Flushes all pending output if necessary, closes the compressed file and deallocates the (de)compression state. Note that once file is closed, you cannot call gzerror with file, since its structures have been deallocated. gzclose must not be called more than once on the same file, just as free must not be called more than once on the same allocation. gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the last read ended in the middle of a gzip stream, or Z_OK on success. */ ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); /* Same as gzclose(), but gzclose_r() is only for use when reading, and gzclose_w() is only for use when writing or appending. The advantage to using these instead of gzclose() is that they avoid linking in zlib compression or decompression code that is not used when only reading or only writing respectively. If gzclose() is used, then both compression and decompression code will be included the application when linking to a static zlib library. */ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); /* Returns the error message for the last error which occurred on the given compressed file. errnum is set to zlib error number. If an error occurred in the file system and not in the compression library, errnum is set to Z_ERRNO and the application may consult errno to get the exact error code. The application must not modify the returned string. Future calls to this function may invalidate the previously returned string. If file is closed, then the string previously returned by gzerror will no longer be available. gzerror() should be used to distinguish errors from end-of-file for those functions above that do not distinguish those cases in their return values. */ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); /* Clears the error and end-of-file flags for file. This is analogous to the clearerr() function in stdio. This is useful for continuing to read a gzip file that is being written concurrently. */ #endif /* !Z_SOLO */ /* checksum functions */ /* These functions are not related to compression but are exported anyway because they might be useful in applications using the compression library. */ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); /* Update a running Adler-32 checksum with the bytes buf[0..len-1] and return the updated checksum. If buf is Z_NULL, this function returns the required initial value for the checksum. An Adler-32 checksum is almost as reliable as a CRC32 but can be computed much faster. Usage example: uLong adler = adler32(0L, Z_NULL, 0); while (read_buffer(buffer, length) != EOF) { adler = adler32(adler, buffer, length); } if (adler != original_adler) error(); */ /* ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, z_off_t len2)); Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note that the z_off_t type (like off_t) is a signed integer. If len2 is negative, the result has no meaning or utility. */ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); /* Update a running CRC-32 with the bytes buf[0..len-1] and return the updated CRC-32. If buf is Z_NULL, this function returns the required initial value for the crc. Pre- and post-conditioning (one's complement) is performed within this function so it shouldn't be done by the application. Usage example: uLong crc = crc32(0L, Z_NULL, 0); while (read_buffer(buffer, length) != EOF) { crc = crc32(crc, buffer, length); } if (crc != original_crc) error(); */ /* ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); Combine two CRC-32 check values into one. For two sequences of bytes, seq1 and seq2 with lengths len1 and len2, CRC-32 check values were calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and len2. */ /* various hacks, don't look :) */ /* deflateInit and inflateInit are macros to allow checking the zlib version * and the compiler's view of z_stream: */ ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, const char *version, int stream_size)); ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, const char *version, int stream_size)); ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, const char *version, int stream_size)); ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, const char *version, int stream_size)); ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, unsigned char FAR *window, const char *version, int stream_size)); #define deflateInit(strm, level) \ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) #define inflateInit(strm) \ inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) #define inflateInit2(strm, windowBits) \ inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ (int)sizeof(z_stream)) #define inflateBackInit(strm, windowBits, window) \ inflateBackInit_((strm), (windowBits), (window), \ ZLIB_VERSION, (int)sizeof(z_stream)) #ifndef Z_SOLO /* gzgetc() macro and its supporting function and exposed data structure. Note * that the real internal state is much larger than the exposed structure. * This abbreviated structure exposes just enough for the gzgetc() macro. The * user should not mess with these exposed elements, since their names or * behavior could change in the future, perhaps even capriciously. They can * only be used by the gzgetc() macro. You have been warned. */ struct gzFile_s { unsigned have; unsigned char *next; z_off64_t pos; }; ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ #ifdef Z_PREFIX_SET # undef z_gzgetc # define z_gzgetc(g) \ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) #else # define gzgetc(g) \ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) #endif /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if * both are true, the application gets the *64 functions, and the regular * functions are changed to 64 bits) -- in case these are set on systems * without large file support, _LFS64_LARGEFILE must also be true */ #ifdef Z_LARGE64 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); #endif #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) # ifdef Z_PREFIX_SET # define z_gzopen z_gzopen64 # define z_gzseek z_gzseek64 # define z_gztell z_gztell64 # define z_gzoffset z_gzoffset64 # define z_adler32_combine z_adler32_combine64 # define z_crc32_combine z_crc32_combine64 # else # define gzopen gzopen64 # define gzseek gzseek64 # define gztell gztell64 # define gzoffset gzoffset64 # define adler32_combine adler32_combine64 # define crc32_combine crc32_combine64 # endif # ifndef Z_LARGE64 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); # endif #else ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); #endif #else /* Z_SOLO */ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); #endif /* !Z_SOLO */ /* hack for buggy compilers */ #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) struct internal_state {int dummy;}; #endif /* undocumented functions */ ZEXTERN const char * ZEXPORT zError OF((int)); ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); #if defined(_WIN32) && !defined(Z_SOLO) ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, const char *mode)); #endif #ifdef __cplusplus } #endif #endif /* ZLIB_H */ glob.h000064400000015015147631660260005655 0ustar00/* Copyright (C) 1991,1992,1995-1998,2000,2001,2004,2010,2011,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _GLOB_H #define _GLOB_H 1 #include __BEGIN_DECLS /* We need `size_t' for the following definitions. */ #ifndef __size_t typedef __SIZE_TYPE__ __size_t; # if defined __USE_XOPEN || __USE_XOPEN2K8 typedef __SIZE_TYPE__ size_t; # endif #else /* The GNU CC stddef.h version defines __size_t as empty. We need a real definition. */ # undef __size_t # define __size_t size_t #endif /* Bits set in the FLAGS argument to `glob'. */ #define GLOB_ERR (1 << 0)/* Return on read errors. */ #define GLOB_MARK (1 << 1)/* Append a slash to each name. */ #define GLOB_NOSORT (1 << 2)/* Don't sort the names. */ #define GLOB_DOOFFS (1 << 3)/* Insert PGLOB->gl_offs NULLs. */ #define GLOB_NOCHECK (1 << 4)/* If nothing matches, return the pattern. */ #define GLOB_APPEND (1 << 5)/* Append to results of a previous call. */ #define GLOB_NOESCAPE (1 << 6)/* Backslashes don't quote metacharacters. */ #define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */ #if !defined __USE_POSIX2 || defined __USE_BSD || defined __USE_GNU # define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */ # define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */ # define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */ # define GLOB_NOMAGIC (1 << 11)/* If no magic chars, return the pattern. */ # define GLOB_TILDE (1 << 12)/* Expand ~user and ~ to home directories. */ # define GLOB_ONLYDIR (1 << 13)/* Match only directories. */ # define GLOB_TILDE_CHECK (1 << 14)/* Like GLOB_TILDE but return an error if the user name is not available. */ # define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ GLOB_PERIOD|GLOB_ALTDIRFUNC|GLOB_BRACE| \ GLOB_NOMAGIC|GLOB_TILDE|GLOB_ONLYDIR|GLOB_TILDE_CHECK) #else # define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ GLOB_PERIOD) #endif /* Error returns from `glob'. */ #define GLOB_NOSPACE 1 /* Ran out of memory. */ #define GLOB_ABORTED 2 /* Read error. */ #define GLOB_NOMATCH 3 /* No matches found. */ #define GLOB_NOSYS 4 /* Not implemented. */ #ifdef __USE_GNU /* Previous versions of this file defined GLOB_ABEND instead of GLOB_ABORTED. Provide a compatibility definition here. */ # define GLOB_ABEND GLOB_ABORTED #endif /* Structure describing a globbing run. */ #ifdef __USE_GNU struct stat; #endif typedef struct { __size_t gl_pathc; /* Count of paths matched by the pattern. */ char **gl_pathv; /* List of matched pathnames. */ __size_t gl_offs; /* Slots to reserve in `gl_pathv'. */ int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */ /* If the GLOB_ALTDIRFUNC flag is set, the following functions are used instead of the normal file access functions. */ void (*gl_closedir) (void *); #ifdef __USE_GNU struct dirent *(*gl_readdir) (void *); #else void *(*gl_readdir) (void *); #endif void *(*gl_opendir) (const char *); #ifdef __USE_GNU int (*gl_lstat) (const char *__restrict, struct stat *__restrict); int (*gl_stat) (const char *__restrict, struct stat *__restrict); #else int (*gl_lstat) (const char *__restrict, void *__restrict); int (*gl_stat) (const char *__restrict, void *__restrict); #endif } glob_t; #ifdef __USE_LARGEFILE64 # ifdef __USE_GNU struct stat64; # endif typedef struct { __size_t gl_pathc; char **gl_pathv; __size_t gl_offs; int gl_flags; /* If the GLOB_ALTDIRFUNC flag is set, the following functions are used instead of the normal file access functions. */ void (*gl_closedir) (void *); # ifdef __USE_GNU struct dirent64 *(*gl_readdir) (void *); # else void *(*gl_readdir) (void *); # endif void *(*gl_opendir) (const char *); # ifdef __USE_GNU int (*gl_lstat) (const char *__restrict, struct stat64 *__restrict); int (*gl_stat) (const char *__restrict, struct stat64 *__restrict); # else int (*gl_lstat) (const char *__restrict, void *__restrict); int (*gl_stat) (const char *__restrict, void *__restrict); # endif } glob64_t; #endif /* Do glob searching for PATTERN, placing results in PGLOB. The bits defined above may be set in FLAGS. If a directory cannot be opened or read and ERRFUNC is not nil, it is called with the pathname that caused the error, and the `errno' value from the failing call; if it returns non-zero `glob' returns GLOB_ABEND; if it returns zero, the error is ignored. If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned. Otherwise, `glob' returns zero. */ #if !defined __USE_FILE_OFFSET64 extern int glob (const char *__restrict __pattern, int __flags, int (*__errfunc) (const char *, int), glob_t *__restrict __pglob) __THROW; /* Free storage allocated in PGLOB by a previous `glob' call. */ extern void globfree (glob_t *__pglob) __THROW; #else extern int __REDIRECT_NTH (glob, (const char *__restrict __pattern, int __flags, int (*__errfunc) (const char *, int), glob_t *__restrict __pglob), glob64); extern void __REDIRECT_NTH (globfree, (glob_t *__pglob), globfree64); #endif #ifdef __USE_LARGEFILE64 extern int glob64 (const char *__restrict __pattern, int __flags, int (*__errfunc) (const char *, int), glob64_t *__restrict __pglob) __THROW; extern void globfree64 (glob64_t *__pglob) __THROW; #endif #ifdef __USE_GNU /* Return nonzero if PATTERN contains any metacharacters. Metacharacters can be quoted with backslashes if QUOTE is nonzero. This function is not part of the interface specified by POSIX.2 but several programs want to use it. */ extern int glob_pattern_p (const char *__pattern, int __quote) __THROW; #endif __END_DECLS #endif /* glob.h */ pcre.h000064400000073357147631660260005700 0ustar00/************************************************* * Perl-Compatible Regular Expressions * *************************************************/ /* This is the public header file for the PCRE library, to be #included by applications that call the PCRE functions. Copyright (c) 1997-2012 University of Cambridge ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the University of Cambridge nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #ifndef _PCRE_H #define _PCRE_H /* The current PCRE version information. */ #define PCRE_MAJOR 8 #define PCRE_MINOR 32 #define PCRE_PRERELEASE #define PCRE_DATE 2012-11-30 /* When an application links to a PCRE DLL in Windows, the symbols that are imported have to be identified as such. When building PCRE, the appropriate export setting is defined in pcre_internal.h, which includes this file. So we don't change existing definitions of PCRE_EXP_DECL and PCRECPP_EXP_DECL. */ #if defined(_WIN32) && !defined(PCRE_STATIC) # ifndef PCRE_EXP_DECL # define PCRE_EXP_DECL extern __declspec(dllimport) # endif # ifdef __cplusplus # ifndef PCRECPP_EXP_DECL # define PCRECPP_EXP_DECL extern __declspec(dllimport) # endif # ifndef PCRECPP_EXP_DEFN # define PCRECPP_EXP_DEFN __declspec(dllimport) # endif # endif #endif /* By default, we use the standard "extern" declarations. */ #ifndef PCRE_EXP_DECL # ifdef __cplusplus # define PCRE_EXP_DECL extern "C" # else # define PCRE_EXP_DECL extern # endif #endif #ifdef __cplusplus # ifndef PCRECPP_EXP_DECL # define PCRECPP_EXP_DECL extern # endif # ifndef PCRECPP_EXP_DEFN # define PCRECPP_EXP_DEFN # endif #endif /* Have to include stdlib.h in order to ensure that size_t is defined; it is needed here for malloc. */ #include /* Allow for C++ users */ #ifdef __cplusplus extern "C" { #endif /* Public options. Some are compile-time only, some are run-time only, and some are both, so we keep them all distinct. However, almost all the bits in the options word are now used. In the long run, we may have to re-use some of the compile-time only bits for runtime options, or vice versa. Any of the compile-time options may be inspected during studying (and therefore JIT compiling). Some options for pcre_compile() change its behaviour but do not affect the behaviour of the execution functions. Other options are passed through to the execution functions and affect their behaviour, with or without affecting the behaviour of pcre_compile(). Options that can be passed to pcre_compile() are tagged Cx below, with these variants: C1 Affects compile only C2 Does not affect compile; affects exec, dfa_exec C3 Affects compile, exec, dfa_exec C4 Affects compile, exec, dfa_exec, study C5 Affects compile, exec, study Options that can be set for pcre_exec() and/or pcre_dfa_exec() are flagged with E and D, respectively. They take precedence over C3, C4, and C5 settings passed from pcre_compile(). Those that are compatible with JIT execution are flagged with J. */ #define PCRE_CASELESS 0x00000001 /* C1 */ #define PCRE_MULTILINE 0x00000002 /* C1 */ #define PCRE_DOTALL 0x00000004 /* C1 */ #define PCRE_EXTENDED 0x00000008 /* C1 */ #define PCRE_ANCHORED 0x00000010 /* C4 E D */ #define PCRE_DOLLAR_ENDONLY 0x00000020 /* C2 */ #define PCRE_EXTRA 0x00000040 /* C1 */ #define PCRE_NOTBOL 0x00000080 /* E D J */ #define PCRE_NOTEOL 0x00000100 /* E D J */ #define PCRE_UNGREEDY 0x00000200 /* C1 */ #define PCRE_NOTEMPTY 0x00000400 /* E D J */ #define PCRE_UTF8 0x00000800 /* C4 ) */ #define PCRE_UTF16 0x00000800 /* C4 ) Synonyms */ #define PCRE_UTF32 0x00000800 /* C4 ) */ #define PCRE_NO_AUTO_CAPTURE 0x00001000 /* C1 */ #define PCRE_NO_UTF8_CHECK 0x00002000 /* C1 E D J ) */ #define PCRE_NO_UTF16_CHECK 0x00002000 /* C1 E D J ) Synonyms */ #define PCRE_NO_UTF32_CHECK 0x00002000 /* C1 E D J ) */ #define PCRE_AUTO_CALLOUT 0x00004000 /* C1 */ #define PCRE_PARTIAL_SOFT 0x00008000 /* E D J ) Synonyms */ #define PCRE_PARTIAL 0x00008000 /* E D J ) */ #define PCRE_DFA_SHORTEST 0x00010000 /* D */ #define PCRE_DFA_RESTART 0x00020000 /* D */ #define PCRE_FIRSTLINE 0x00040000 /* C3 */ #define PCRE_DUPNAMES 0x00080000 /* C1 */ #define PCRE_NEWLINE_CR 0x00100000 /* C3 E D */ #define PCRE_NEWLINE_LF 0x00200000 /* C3 E D */ #define PCRE_NEWLINE_CRLF 0x00300000 /* C3 E D */ #define PCRE_NEWLINE_ANY 0x00400000 /* C3 E D */ #define PCRE_NEWLINE_ANYCRLF 0x00500000 /* C3 E D */ #define PCRE_BSR_ANYCRLF 0x00800000 /* C3 E D */ #define PCRE_BSR_UNICODE 0x01000000 /* C3 E D */ #define PCRE_JAVASCRIPT_COMPAT 0x02000000 /* C5 */ #define PCRE_NO_START_OPTIMIZE 0x04000000 /* C2 E D ) Synonyms */ #define PCRE_NO_START_OPTIMISE 0x04000000 /* C2 E D ) */ #define PCRE_PARTIAL_HARD 0x08000000 /* E D J */ #define PCRE_NOTEMPTY_ATSTART 0x10000000 /* E D J */ #define PCRE_UCP 0x20000000 /* C3 */ /* Exec-time and get/set-time error codes */ #define PCRE_ERROR_NOMATCH (-1) #define PCRE_ERROR_NULL (-2) #define PCRE_ERROR_BADOPTION (-3) #define PCRE_ERROR_BADMAGIC (-4) #define PCRE_ERROR_UNKNOWN_OPCODE (-5) #define PCRE_ERROR_UNKNOWN_NODE (-5) /* For backward compatibility */ #define PCRE_ERROR_NOMEMORY (-6) #define PCRE_ERROR_NOSUBSTRING (-7) #define PCRE_ERROR_MATCHLIMIT (-8) #define PCRE_ERROR_CALLOUT (-9) /* Never used by PCRE itself */ #define PCRE_ERROR_BADUTF8 (-10) /* Same for 8/16/32 */ #define PCRE_ERROR_BADUTF16 (-10) /* Same for 8/16/32 */ #define PCRE_ERROR_BADUTF32 (-10) /* Same for 8/16/32 */ #define PCRE_ERROR_BADUTF8_OFFSET (-11) /* Same for 8/16 */ #define PCRE_ERROR_BADUTF16_OFFSET (-11) /* Same for 8/16 */ #define PCRE_ERROR_PARTIAL (-12) #define PCRE_ERROR_BADPARTIAL (-13) #define PCRE_ERROR_INTERNAL (-14) #define PCRE_ERROR_BADCOUNT (-15) #define PCRE_ERROR_DFA_UITEM (-16) #define PCRE_ERROR_DFA_UCOND (-17) #define PCRE_ERROR_DFA_UMLIMIT (-18) #define PCRE_ERROR_DFA_WSSIZE (-19) #define PCRE_ERROR_DFA_RECURSE (-20) #define PCRE_ERROR_RECURSIONLIMIT (-21) #define PCRE_ERROR_NULLWSLIMIT (-22) /* No longer actually used */ #define PCRE_ERROR_BADNEWLINE (-23) #define PCRE_ERROR_BADOFFSET (-24) #define PCRE_ERROR_SHORTUTF8 (-25) #define PCRE_ERROR_SHORTUTF16 (-25) /* Same for 8/16 */ #define PCRE_ERROR_RECURSELOOP (-26) #define PCRE_ERROR_JIT_STACKLIMIT (-27) #define PCRE_ERROR_BADMODE (-28) #define PCRE_ERROR_BADENDIANNESS (-29) #define PCRE_ERROR_DFA_BADRESTART (-30) #define PCRE_ERROR_JIT_BADOPTION (-31) #define PCRE_ERROR_BADLENGTH (-32) /* Specific error codes for UTF-8 validity checks */ #define PCRE_UTF8_ERR0 0 #define PCRE_UTF8_ERR1 1 #define PCRE_UTF8_ERR2 2 #define PCRE_UTF8_ERR3 3 #define PCRE_UTF8_ERR4 4 #define PCRE_UTF8_ERR5 5 #define PCRE_UTF8_ERR6 6 #define PCRE_UTF8_ERR7 7 #define PCRE_UTF8_ERR8 8 #define PCRE_UTF8_ERR9 9 #define PCRE_UTF8_ERR10 10 #define PCRE_UTF8_ERR11 11 #define PCRE_UTF8_ERR12 12 #define PCRE_UTF8_ERR13 13 #define PCRE_UTF8_ERR14 14 #define PCRE_UTF8_ERR15 15 #define PCRE_UTF8_ERR16 16 #define PCRE_UTF8_ERR17 17 #define PCRE_UTF8_ERR18 18 #define PCRE_UTF8_ERR19 19 #define PCRE_UTF8_ERR20 20 #define PCRE_UTF8_ERR21 21 #define PCRE_UTF8_ERR22 22 /* Specific error codes for UTF-16 validity checks */ #define PCRE_UTF16_ERR0 0 #define PCRE_UTF16_ERR1 1 #define PCRE_UTF16_ERR2 2 #define PCRE_UTF16_ERR3 3 #define PCRE_UTF16_ERR4 4 /* Specific error codes for UTF-32 validity checks */ #define PCRE_UTF32_ERR0 0 #define PCRE_UTF32_ERR1 1 #define PCRE_UTF32_ERR2 2 #define PCRE_UTF32_ERR3 3 /* Request types for pcre_fullinfo() */ #define PCRE_INFO_OPTIONS 0 #define PCRE_INFO_SIZE 1 #define PCRE_INFO_CAPTURECOUNT 2 #define PCRE_INFO_BACKREFMAX 3 #define PCRE_INFO_FIRSTBYTE 4 #define PCRE_INFO_FIRSTCHAR 4 /* For backwards compatibility */ #define PCRE_INFO_FIRSTTABLE 5 #define PCRE_INFO_LASTLITERAL 6 #define PCRE_INFO_NAMEENTRYSIZE 7 #define PCRE_INFO_NAMECOUNT 8 #define PCRE_INFO_NAMETABLE 9 #define PCRE_INFO_STUDYSIZE 10 #define PCRE_INFO_DEFAULT_TABLES 11 #define PCRE_INFO_OKPARTIAL 12 #define PCRE_INFO_JCHANGED 13 #define PCRE_INFO_HASCRORLF 14 #define PCRE_INFO_MINLENGTH 15 #define PCRE_INFO_JIT 16 #define PCRE_INFO_JITSIZE 17 #define PCRE_INFO_MAXLOOKBEHIND 18 #define PCRE_INFO_FIRSTCHARACTER 19 #define PCRE_INFO_FIRSTCHARACTERFLAGS 20 #define PCRE_INFO_REQUIREDCHAR 21 #define PCRE_INFO_REQUIREDCHARFLAGS 22 /* Request types for pcre_config(). Do not re-arrange, in order to remain compatible. */ #define PCRE_CONFIG_UTF8 0 #define PCRE_CONFIG_NEWLINE 1 #define PCRE_CONFIG_LINK_SIZE 2 #define PCRE_CONFIG_POSIX_MALLOC_THRESHOLD 3 #define PCRE_CONFIG_MATCH_LIMIT 4 #define PCRE_CONFIG_STACKRECURSE 5 #define PCRE_CONFIG_UNICODE_PROPERTIES 6 #define PCRE_CONFIG_MATCH_LIMIT_RECURSION 7 #define PCRE_CONFIG_BSR 8 #define PCRE_CONFIG_JIT 9 #define PCRE_CONFIG_UTF16 10 #define PCRE_CONFIG_JITTARGET 11 #define PCRE_CONFIG_UTF32 12 /* Request types for pcre_study(). Do not re-arrange, in order to remain compatible. */ #define PCRE_STUDY_JIT_COMPILE 0x0001 #define PCRE_STUDY_JIT_PARTIAL_SOFT_COMPILE 0x0002 #define PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE 0x0004 #define PCRE_STUDY_EXTRA_NEEDED 0x0008 /* Bit flags for the pcre[16|32]_extra structure. Do not re-arrange or redefine these bits, just add new ones on the end, in order to remain compatible. */ #define PCRE_EXTRA_STUDY_DATA 0x0001 #define PCRE_EXTRA_MATCH_LIMIT 0x0002 #define PCRE_EXTRA_CALLOUT_DATA 0x0004 #define PCRE_EXTRA_TABLES 0x0008 #define PCRE_EXTRA_MATCH_LIMIT_RECURSION 0x0010 #define PCRE_EXTRA_MARK 0x0020 #define PCRE_EXTRA_EXECUTABLE_JIT 0x0040 /* Types */ struct real_pcre; /* declaration; the definition is private */ typedef struct real_pcre pcre; struct real_pcre16; /* declaration; the definition is private */ typedef struct real_pcre16 pcre16; struct real_pcre32; /* declaration; the definition is private */ typedef struct real_pcre32 pcre32; struct real_pcre_jit_stack; /* declaration; the definition is private */ typedef struct real_pcre_jit_stack pcre_jit_stack; struct real_pcre16_jit_stack; /* declaration; the definition is private */ typedef struct real_pcre16_jit_stack pcre16_jit_stack; struct real_pcre32_jit_stack; /* declaration; the definition is private */ typedef struct real_pcre32_jit_stack pcre32_jit_stack; /* If PCRE is compiled with 16 bit character support, PCRE_UCHAR16 must contain a 16 bit wide signed data type. Otherwise it can be a dummy data type since pcre16 functions are not implemented. There is a check for this in pcre_internal.h. */ #ifndef PCRE_UCHAR16 #define PCRE_UCHAR16 unsigned short #endif #ifndef PCRE_SPTR16 #define PCRE_SPTR16 const PCRE_UCHAR16 * #endif /* If PCRE is compiled with 32 bit character support, PCRE_UCHAR32 must contain a 32 bit wide signed data type. Otherwise it can be a dummy data type since pcre32 functions are not implemented. There is a check for this in pcre_internal.h. */ #ifndef PCRE_UCHAR32 #define PCRE_UCHAR32 unsigned int #endif #ifndef PCRE_SPTR32 #define PCRE_SPTR32 const PCRE_UCHAR32 * #endif /* When PCRE is compiled as a C++ library, the subject pointer type can be replaced with a custom type. For conventional use, the public interface is a const char *. */ #ifndef PCRE_SPTR #define PCRE_SPTR const char * #endif /* The structure for passing additional data to pcre_exec(). This is defined in such as way as to be extensible. Always add new fields at the end, in order to remain compatible. */ typedef struct pcre_extra { unsigned long int flags; /* Bits for which fields are set */ void *study_data; /* Opaque data from pcre_study() */ unsigned long int match_limit; /* Maximum number of calls to match() */ void *callout_data; /* Data passed back in callouts */ const unsigned char *tables; /* Pointer to character tables */ unsigned long int match_limit_recursion; /* Max recursive calls to match() */ unsigned char **mark; /* For passing back a mark pointer */ void *executable_jit; /* Contains a pointer to a compiled jit code */ } pcre_extra; /* Same structure as above, but with 16 bit char pointers. */ typedef struct pcre16_extra { unsigned long int flags; /* Bits for which fields are set */ void *study_data; /* Opaque data from pcre_study() */ unsigned long int match_limit; /* Maximum number of calls to match() */ void *callout_data; /* Data passed back in callouts */ const unsigned char *tables; /* Pointer to character tables */ unsigned long int match_limit_recursion; /* Max recursive calls to match() */ PCRE_UCHAR16 **mark; /* For passing back a mark pointer */ void *executable_jit; /* Contains a pointer to a compiled jit code */ } pcre16_extra; /* Same structure as above, but with 32 bit char pointers. */ typedef struct pcre32_extra { unsigned long int flags; /* Bits for which fields are set */ void *study_data; /* Opaque data from pcre_study() */ unsigned long int match_limit; /* Maximum number of calls to match() */ void *callout_data; /* Data passed back in callouts */ const unsigned char *tables; /* Pointer to character tables */ unsigned long int match_limit_recursion; /* Max recursive calls to match() */ PCRE_UCHAR32 **mark; /* For passing back a mark pointer */ void *executable_jit; /* Contains a pointer to a compiled jit code */ } pcre32_extra; /* The structure for passing out data via the pcre_callout_function. We use a structure so that new fields can be added on the end in future versions, without changing the API of the function, thereby allowing old clients to work without modification. */ typedef struct pcre_callout_block { int version; /* Identifies version of block */ /* ------------------------ Version 0 ------------------------------- */ int callout_number; /* Number compiled into pattern */ int *offset_vector; /* The offset vector */ PCRE_SPTR subject; /* The subject being matched */ int subject_length; /* The length of the subject */ int start_match; /* Offset to start of this match attempt */ int current_position; /* Where we currently are in the subject */ int capture_top; /* Max current capture */ int capture_last; /* Most recently closed capture */ void *callout_data; /* Data passed in with the call */ /* ------------------- Added for Version 1 -------------------------- */ int pattern_position; /* Offset to next item in the pattern */ int next_item_length; /* Length of next item in the pattern */ /* ------------------- Added for Version 2 -------------------------- */ const unsigned char *mark; /* Pointer to current mark or NULL */ /* ------------------------------------------------------------------ */ } pcre_callout_block; /* Same structure as above, but with 16 bit char pointers. */ typedef struct pcre16_callout_block { int version; /* Identifies version of block */ /* ------------------------ Version 0 ------------------------------- */ int callout_number; /* Number compiled into pattern */ int *offset_vector; /* The offset vector */ PCRE_SPTR16 subject; /* The subject being matched */ int subject_length; /* The length of the subject */ int start_match; /* Offset to start of this match attempt */ int current_position; /* Where we currently are in the subject */ int capture_top; /* Max current capture */ int capture_last; /* Most recently closed capture */ void *callout_data; /* Data passed in with the call */ /* ------------------- Added for Version 1 -------------------------- */ int pattern_position; /* Offset to next item in the pattern */ int next_item_length; /* Length of next item in the pattern */ /* ------------------- Added for Version 2 -------------------------- */ const PCRE_UCHAR16 *mark; /* Pointer to current mark or NULL */ /* ------------------------------------------------------------------ */ } pcre16_callout_block; /* Same structure as above, but with 32 bit char pointers. */ typedef struct pcre32_callout_block { int version; /* Identifies version of block */ /* ------------------------ Version 0 ------------------------------- */ int callout_number; /* Number compiled into pattern */ int *offset_vector; /* The offset vector */ PCRE_SPTR32 subject; /* The subject being matched */ int subject_length; /* The length of the subject */ int start_match; /* Offset to start of this match attempt */ int current_position; /* Where we currently are in the subject */ int capture_top; /* Max current capture */ int capture_last; /* Most recently closed capture */ void *callout_data; /* Data passed in with the call */ /* ------------------- Added for Version 1 -------------------------- */ int pattern_position; /* Offset to next item in the pattern */ int next_item_length; /* Length of next item in the pattern */ /* ------------------- Added for Version 2 -------------------------- */ const PCRE_UCHAR32 *mark; /* Pointer to current mark or NULL */ /* ------------------------------------------------------------------ */ } pcre32_callout_block; /* Indirection for store get and free functions. These can be set to alternative malloc/free functions if required. Special ones are used in the non-recursive case for "frames". There is also an optional callout function that is triggered by the (?) regex item. For Virtual Pascal, these definitions have to take another form. */ #ifndef VPCOMPAT PCRE_EXP_DECL void *(*pcre_malloc)(size_t); PCRE_EXP_DECL void (*pcre_free)(void *); PCRE_EXP_DECL void *(*pcre_stack_malloc)(size_t); PCRE_EXP_DECL void (*pcre_stack_free)(void *); PCRE_EXP_DECL int (*pcre_callout)(pcre_callout_block *); PCRE_EXP_DECL void *(*pcre16_malloc)(size_t); PCRE_EXP_DECL void (*pcre16_free)(void *); PCRE_EXP_DECL void *(*pcre16_stack_malloc)(size_t); PCRE_EXP_DECL void (*pcre16_stack_free)(void *); PCRE_EXP_DECL int (*pcre16_callout)(pcre16_callout_block *); PCRE_EXP_DECL void *(*pcre32_malloc)(size_t); PCRE_EXP_DECL void (*pcre32_free)(void *); PCRE_EXP_DECL void *(*pcre32_stack_malloc)(size_t); PCRE_EXP_DECL void (*pcre32_stack_free)(void *); PCRE_EXP_DECL int (*pcre32_callout)(pcre32_callout_block *); #else /* VPCOMPAT */ PCRE_EXP_DECL void *pcre_malloc(size_t); PCRE_EXP_DECL void pcre_free(void *); PCRE_EXP_DECL void *pcre_stack_malloc(size_t); PCRE_EXP_DECL void pcre_stack_free(void *); PCRE_EXP_DECL int pcre_callout(pcre_callout_block *); PCRE_EXP_DECL void *pcre16_malloc(size_t); PCRE_EXP_DECL void pcre16_free(void *); PCRE_EXP_DECL void *pcre16_stack_malloc(size_t); PCRE_EXP_DECL void pcre16_stack_free(void *); PCRE_EXP_DECL int pcre16_callout(pcre16_callout_block *); PCRE_EXP_DECL void *pcre32_malloc(size_t); PCRE_EXP_DECL void pcre32_free(void *); PCRE_EXP_DECL void *pcre32_stack_malloc(size_t); PCRE_EXP_DECL void pcre32_stack_free(void *); PCRE_EXP_DECL int pcre32_callout(pcre32_callout_block *); #endif /* VPCOMPAT */ /* User defined callback which provides a stack just before the match starts. */ typedef pcre_jit_stack *(*pcre_jit_callback)(void *); typedef pcre16_jit_stack *(*pcre16_jit_callback)(void *); typedef pcre32_jit_stack *(*pcre32_jit_callback)(void *); /* Exported PCRE functions */ PCRE_EXP_DECL pcre *pcre_compile(const char *, int, const char **, int *, const unsigned char *); PCRE_EXP_DECL pcre16 *pcre16_compile(PCRE_SPTR16, int, const char **, int *, const unsigned char *); PCRE_EXP_DECL pcre32 *pcre32_compile(PCRE_SPTR32, int, const char **, int *, const unsigned char *); PCRE_EXP_DECL pcre *pcre_compile2(const char *, int, int *, const char **, int *, const unsigned char *); PCRE_EXP_DECL pcre16 *pcre16_compile2(PCRE_SPTR16, int, int *, const char **, int *, const unsigned char *); PCRE_EXP_DECL pcre32 *pcre32_compile2(PCRE_SPTR32, int, int *, const char **, int *, const unsigned char *); PCRE_EXP_DECL int pcre_config(int, void *); PCRE_EXP_DECL int pcre16_config(int, void *); PCRE_EXP_DECL int pcre32_config(int, void *); PCRE_EXP_DECL int pcre_copy_named_substring(const pcre *, const char *, int *, int, const char *, char *, int); PCRE_EXP_DECL int pcre16_copy_named_substring(const pcre16 *, PCRE_SPTR16, int *, int, PCRE_SPTR16, PCRE_UCHAR16 *, int); PCRE_EXP_DECL int pcre32_copy_named_substring(const pcre32 *, PCRE_SPTR32, int *, int, PCRE_SPTR32, PCRE_UCHAR32 *, int); PCRE_EXP_DECL int pcre_copy_substring(const char *, int *, int, int, char *, int); PCRE_EXP_DECL int pcre16_copy_substring(PCRE_SPTR16, int *, int, int, PCRE_UCHAR16 *, int); PCRE_EXP_DECL int pcre32_copy_substring(PCRE_SPTR32, int *, int, int, PCRE_UCHAR32 *, int); PCRE_EXP_DECL int pcre_dfa_exec(const pcre *, const pcre_extra *, const char *, int, int, int, int *, int , int *, int); PCRE_EXP_DECL int pcre16_dfa_exec(const pcre16 *, const pcre16_extra *, PCRE_SPTR16, int, int, int, int *, int , int *, int); PCRE_EXP_DECL int pcre32_dfa_exec(const pcre32 *, const pcre32_extra *, PCRE_SPTR32, int, int, int, int *, int , int *, int); PCRE_EXP_DECL int pcre_exec(const pcre *, const pcre_extra *, PCRE_SPTR, int, int, int, int *, int); PCRE_EXP_DECL int pcre16_exec(const pcre16 *, const pcre16_extra *, PCRE_SPTR16, int, int, int, int *, int); PCRE_EXP_DECL int pcre32_exec(const pcre32 *, const pcre32_extra *, PCRE_SPTR32, int, int, int, int *, int); PCRE_EXP_DECL int pcre_jit_exec(const pcre *, const pcre_extra *, PCRE_SPTR, int, int, int, int *, int, pcre_jit_stack *); PCRE_EXP_DECL int pcre16_jit_exec(const pcre16 *, const pcre16_extra *, PCRE_SPTR16, int, int, int, int *, int, pcre16_jit_stack *); PCRE_EXP_DECL int pcre32_jit_exec(const pcre32 *, const pcre32_extra *, PCRE_SPTR32, int, int, int, int *, int, pcre32_jit_stack *); PCRE_EXP_DECL void pcre_free_substring(const char *); PCRE_EXP_DECL void pcre16_free_substring(PCRE_SPTR16); PCRE_EXP_DECL void pcre32_free_substring(PCRE_SPTR32); PCRE_EXP_DECL void pcre_free_substring_list(const char **); PCRE_EXP_DECL void pcre16_free_substring_list(PCRE_SPTR16 *); PCRE_EXP_DECL void pcre32_free_substring_list(PCRE_SPTR32 *); PCRE_EXP_DECL int pcre_fullinfo(const pcre *, const pcre_extra *, int, void *); PCRE_EXP_DECL int pcre16_fullinfo(const pcre16 *, const pcre16_extra *, int, void *); PCRE_EXP_DECL int pcre32_fullinfo(const pcre32 *, const pcre32_extra *, int, void *); PCRE_EXP_DECL int pcre_get_named_substring(const pcre *, const char *, int *, int, const char *, const char **); PCRE_EXP_DECL int pcre16_get_named_substring(const pcre16 *, PCRE_SPTR16, int *, int, PCRE_SPTR16, PCRE_SPTR16 *); PCRE_EXP_DECL int pcre32_get_named_substring(const pcre32 *, PCRE_SPTR32, int *, int, PCRE_SPTR32, PCRE_SPTR32 *); PCRE_EXP_DECL int pcre_get_stringnumber(const pcre *, const char *); PCRE_EXP_DECL int pcre16_get_stringnumber(const pcre16 *, PCRE_SPTR16); PCRE_EXP_DECL int pcre32_get_stringnumber(const pcre32 *, PCRE_SPTR32); PCRE_EXP_DECL int pcre_get_stringtable_entries(const pcre *, const char *, char **, char **); PCRE_EXP_DECL int pcre16_get_stringtable_entries(const pcre16 *, PCRE_SPTR16, PCRE_UCHAR16 **, PCRE_UCHAR16 **); PCRE_EXP_DECL int pcre32_get_stringtable_entries(const pcre32 *, PCRE_SPTR32, PCRE_UCHAR32 **, PCRE_UCHAR32 **); PCRE_EXP_DECL int pcre_get_substring(const char *, int *, int, int, const char **); PCRE_EXP_DECL int pcre16_get_substring(PCRE_SPTR16, int *, int, int, PCRE_SPTR16 *); PCRE_EXP_DECL int pcre32_get_substring(PCRE_SPTR32, int *, int, int, PCRE_SPTR32 *); PCRE_EXP_DECL int pcre_get_substring_list(const char *, int *, int, const char ***); PCRE_EXP_DECL int pcre16_get_substring_list(PCRE_SPTR16, int *, int, PCRE_SPTR16 **); PCRE_EXP_DECL int pcre32_get_substring_list(PCRE_SPTR32, int *, int, PCRE_SPTR32 **); PCRE_EXP_DECL const unsigned char *pcre_maketables(void); PCRE_EXP_DECL const unsigned char *pcre16_maketables(void); PCRE_EXP_DECL const unsigned char *pcre32_maketables(void); PCRE_EXP_DECL int pcre_refcount(pcre *, int); PCRE_EXP_DECL int pcre16_refcount(pcre16 *, int); PCRE_EXP_DECL int pcre32_refcount(pcre32 *, int); PCRE_EXP_DECL pcre_extra *pcre_study(const pcre *, int, const char **); PCRE_EXP_DECL pcre16_extra *pcre16_study(const pcre16 *, int, const char **); PCRE_EXP_DECL pcre32_extra *pcre32_study(const pcre32 *, int, const char **); PCRE_EXP_DECL void pcre_free_study(pcre_extra *); PCRE_EXP_DECL void pcre16_free_study(pcre16_extra *); PCRE_EXP_DECL void pcre32_free_study(pcre32_extra *); PCRE_EXP_DECL const char *pcre_version(void); PCRE_EXP_DECL const char *pcre16_version(void); PCRE_EXP_DECL const char *pcre32_version(void); /* Utility functions for byte order swaps. */ PCRE_EXP_DECL int pcre_pattern_to_host_byte_order(pcre *, pcre_extra *, const unsigned char *); PCRE_EXP_DECL int pcre16_pattern_to_host_byte_order(pcre16 *, pcre16_extra *, const unsigned char *); PCRE_EXP_DECL int pcre32_pattern_to_host_byte_order(pcre32 *, pcre32_extra *, const unsigned char *); PCRE_EXP_DECL int pcre16_utf16_to_host_byte_order(PCRE_UCHAR16 *, PCRE_SPTR16, int, int *, int); PCRE_EXP_DECL int pcre32_utf32_to_host_byte_order(PCRE_UCHAR32 *, PCRE_SPTR32, int, int *, int); /* JIT compiler related functions. */ PCRE_EXP_DECL pcre_jit_stack *pcre_jit_stack_alloc(int, int); PCRE_EXP_DECL pcre16_jit_stack *pcre16_jit_stack_alloc(int, int); PCRE_EXP_DECL pcre32_jit_stack *pcre32_jit_stack_alloc(int, int); PCRE_EXP_DECL void pcre_jit_stack_free(pcre_jit_stack *); PCRE_EXP_DECL void pcre16_jit_stack_free(pcre16_jit_stack *); PCRE_EXP_DECL void pcre32_jit_stack_free(pcre32_jit_stack *); PCRE_EXP_DECL void pcre_assign_jit_stack(pcre_extra *, pcre_jit_callback, void *); PCRE_EXP_DECL void pcre16_assign_jit_stack(pcre16_extra *, pcre16_jit_callback, void *); PCRE_EXP_DECL void pcre32_assign_jit_stack(pcre32_extra *, pcre32_jit_callback, void *); #ifdef __cplusplus } /* extern "C" */ #endif #endif /* End of pcre.h */ time.h000064400000032634147631660260005676 0ustar00/* Copyright (C) 1991-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ /* * ISO C99 Standard: 7.23 Date and time */ #ifndef _TIME_H #if (! defined __need_time_t && !defined __need_clock_t && \ ! defined __need_timespec) # define _TIME_H 1 # include __BEGIN_DECLS #endif #ifdef _TIME_H /* Get size_t and NULL from . */ # define __need_size_t # define __need_NULL # include /* This defines CLOCKS_PER_SEC, which is the number of processor clock ticks per second. */ # include /* This is the obsolete POSIX.1-1988 name for the same constant. */ # if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K # ifndef CLK_TCK # define CLK_TCK CLOCKS_PER_SEC # endif # endif #endif /* included. */ #if !defined __clock_t_defined && (defined _TIME_H || defined __need_clock_t) # define __clock_t_defined 1 # include __BEGIN_NAMESPACE_STD /* Returned by `clock'. */ typedef __clock_t clock_t; __END_NAMESPACE_STD #if defined __USE_XOPEN || defined __USE_POSIX || defined __USE_MISC __USING_NAMESPACE_STD(clock_t) #endif #endif /* clock_t not defined and or need clock_t. */ #undef __need_clock_t #if !defined __time_t_defined && (defined _TIME_H || defined __need_time_t) # define __time_t_defined 1 # include __BEGIN_NAMESPACE_STD /* Returned by `time'. */ typedef __time_t time_t; __END_NAMESPACE_STD #if defined __USE_POSIX || defined __USE_MISC || defined __USE_SVID __USING_NAMESPACE_STD(time_t) #endif #endif /* time_t not defined and or need time_t. */ #undef __need_time_t #if !defined __clockid_t_defined && \ ((defined _TIME_H && defined __USE_POSIX199309) || defined __need_clockid_t) # define __clockid_t_defined 1 # include /* Clock ID used in clock and timer functions. */ typedef __clockid_t clockid_t; #endif /* clockid_t not defined and or need clockid_t. */ #undef __clockid_time_t #if !defined __timer_t_defined && \ ((defined _TIME_H && defined __USE_POSIX199309) || defined __need_timer_t) # define __timer_t_defined 1 # include /* Timer ID returned by `timer_create'. */ typedef __timer_t timer_t; #endif /* timer_t not defined and or need timer_t. */ #undef __need_timer_t #if (!defined __timespec_defined \ && ((defined _TIME_H \ && (defined __USE_POSIX199309 || defined __USE_MISC \ || defined __USE_ISOC11)) \ || defined __need_timespec)) # define __timespec_defined 1 # include /* This defines __time_t for us. */ /* POSIX.1b structure for a time value. This is like a `struct timeval' but has nanoseconds instead of microseconds. */ struct timespec { __time_t tv_sec; /* Seconds. */ __syscall_slong_t tv_nsec; /* Nanoseconds. */ }; #endif /* timespec not defined and or need timespec. */ #undef __need_timespec #ifdef _TIME_H __BEGIN_NAMESPACE_STD /* Used by other time functions. */ struct tm { int tm_sec; /* Seconds. [0-60] (1 leap second) */ int tm_min; /* Minutes. [0-59] */ int tm_hour; /* Hours. [0-23] */ int tm_mday; /* Day. [1-31] */ int tm_mon; /* Month. [0-11] */ int tm_year; /* Year - 1900. */ int tm_wday; /* Day of week. [0-6] */ int tm_yday; /* Days in year.[0-365] */ int tm_isdst; /* DST. [-1/0/1]*/ # ifdef __USE_BSD long int tm_gmtoff; /* Seconds east of UTC. */ const char *tm_zone; /* Timezone abbreviation. */ # else long int __tm_gmtoff; /* Seconds east of UTC. */ const char *__tm_zone; /* Timezone abbreviation. */ # endif }; __END_NAMESPACE_STD #if defined __USE_XOPEN || defined __USE_POSIX || defined __USE_MISC __USING_NAMESPACE_STD(tm) #endif # ifdef __USE_POSIX199309 /* POSIX.1b structure for timer start values and intervals. */ struct itimerspec { struct timespec it_interval; struct timespec it_value; }; /* We can use a simple forward declaration. */ struct sigevent; # endif /* POSIX.1b */ # ifdef __USE_XOPEN2K # ifndef __pid_t_defined typedef __pid_t pid_t; # define __pid_t_defined # endif # endif # ifdef __USE_ISOC11 /* Time base values for timespec_get. */ # define TIME_UTC 1 # endif __BEGIN_NAMESPACE_STD /* Time used by the program so far (user time + system time). The result / CLOCKS_PER_SECOND is program time in seconds. */ extern clock_t clock (void) __THROW; /* Return the current time and put it in *TIMER if TIMER is not NULL. */ extern time_t time (time_t *__timer) __THROW; /* Return the difference between TIME1 and TIME0. */ extern double difftime (time_t __time1, time_t __time0) __THROW __attribute__ ((__const__)); /* Return the `time_t' representation of TP and normalize TP. */ extern time_t mktime (struct tm *__tp) __THROW; /* Format TP into S according to FORMAT. Write no more than MAXSIZE characters and return the number of characters written, or 0 if it would exceed MAXSIZE. */ extern size_t strftime (char *__restrict __s, size_t __maxsize, const char *__restrict __format, const struct tm *__restrict __tp) __THROW; __END_NAMESPACE_STD # ifdef __USE_XOPEN /* Parse S according to FORMAT and store binary time information in TP. The return value is a pointer to the first unparsed character in S. */ extern char *strptime (const char *__restrict __s, const char *__restrict __fmt, struct tm *__tp) __THROW; # endif # ifdef __USE_XOPEN2K8 /* Similar to the two functions above but take the information from the provided locale and not the global locale. */ # include extern size_t strftime_l (char *__restrict __s, size_t __maxsize, const char *__restrict __format, const struct tm *__restrict __tp, __locale_t __loc) __THROW; # endif # ifdef __USE_GNU extern char *strptime_l (const char *__restrict __s, const char *__restrict __fmt, struct tm *__tp, __locale_t __loc) __THROW; # endif __BEGIN_NAMESPACE_STD /* Return the `struct tm' representation of *TIMER in Universal Coordinated Time (aka Greenwich Mean Time). */ extern struct tm *gmtime (const time_t *__timer) __THROW; /* Return the `struct tm' representation of *TIMER in the local timezone. */ extern struct tm *localtime (const time_t *__timer) __THROW; __END_NAMESPACE_STD # if defined __USE_POSIX || defined __USE_MISC /* Return the `struct tm' representation of *TIMER in UTC, using *TP to store the result. */ extern struct tm *gmtime_r (const time_t *__restrict __timer, struct tm *__restrict __tp) __THROW; /* Return the `struct tm' representation of *TIMER in local time, using *TP to store the result. */ extern struct tm *localtime_r (const time_t *__restrict __timer, struct tm *__restrict __tp) __THROW; # endif /* POSIX or misc */ __BEGIN_NAMESPACE_STD /* Return a string of the form "Day Mon dd hh:mm:ss yyyy\n" that is the representation of TP in this format. */ extern char *asctime (const struct tm *__tp) __THROW; /* Equivalent to `asctime (localtime (timer))'. */ extern char *ctime (const time_t *__timer) __THROW; __END_NAMESPACE_STD # if defined __USE_POSIX || defined __USE_MISC /* Reentrant versions of the above functions. */ /* Return in BUF a string of the form "Day Mon dd hh:mm:ss yyyy\n" that is the representation of TP in this format. */ extern char *asctime_r (const struct tm *__restrict __tp, char *__restrict __buf) __THROW; /* Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'. */ extern char *ctime_r (const time_t *__restrict __timer, char *__restrict __buf) __THROW; # endif /* POSIX or misc */ /* Defined in localtime.c. */ extern char *__tzname[2]; /* Current timezone names. */ extern int __daylight; /* If daylight-saving time is ever in use. */ extern long int __timezone; /* Seconds west of UTC. */ # ifdef __USE_POSIX /* Same as above. */ extern char *tzname[2]; /* Set time conversion information from the TZ environment variable. If TZ is not defined, a locale-dependent default is used. */ extern void tzset (void) __THROW; # endif # if defined __USE_SVID || defined __USE_XOPEN extern int daylight; extern long int timezone; # endif # ifdef __USE_SVID /* Set the system time to *WHEN. This call is restricted to the superuser. */ extern int stime (const time_t *__when) __THROW; # endif /* Nonzero if YEAR is a leap year (every 4 years, except every 100th isn't, and every 400th is). */ # define __isleap(year) \ ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0)) # ifdef __USE_MISC /* Miscellaneous functions many Unices inherited from the public domain localtime package. These are included only for compatibility. */ /* Like `mktime', but for TP represents Universal Time, not local time. */ extern time_t timegm (struct tm *__tp) __THROW; /* Another name for `mktime'. */ extern time_t timelocal (struct tm *__tp) __THROW; /* Return the number of days in YEAR. */ extern int dysize (int __year) __THROW __attribute__ ((__const__)); # endif # ifdef __USE_POSIX199309 /* Pause execution for a number of nanoseconds. This function is a cancellation point and therefore not marked with __THROW. */ extern int nanosleep (const struct timespec *__requested_time, struct timespec *__remaining); /* Get resolution of clock CLOCK_ID. */ extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __THROW; /* Get current value of clock CLOCK_ID and store it in TP. */ extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __THROW; /* Set clock CLOCK_ID to value TP. */ extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) __THROW; # ifdef __USE_XOPEN2K /* High-resolution sleep with the specified clock. This function is a cancellation point and therefore not marked with __THROW. */ extern int clock_nanosleep (clockid_t __clock_id, int __flags, const struct timespec *__req, struct timespec *__rem); /* Return clock ID for CPU-time clock. */ extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __THROW; # endif /* Create new per-process timer using CLOCK_ID. */ extern int timer_create (clockid_t __clock_id, struct sigevent *__restrict __evp, timer_t *__restrict __timerid) __THROW; /* Delete timer TIMERID. */ extern int timer_delete (timer_t __timerid) __THROW; /* Set timer TIMERID to VALUE, returning old value in OVALUE. */ extern int timer_settime (timer_t __timerid, int __flags, const struct itimerspec *__restrict __value, struct itimerspec *__restrict __ovalue) __THROW; /* Get current value of timer TIMERID and store it in VALUE. */ extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) __THROW; /* Get expiration overrun for timer TIMERID. */ extern int timer_getoverrun (timer_t __timerid) __THROW; # endif # ifdef __USE_ISOC11 /* Set TS to calendar time based in time base BASE. */ extern int timespec_get (struct timespec *__ts, int __base) __THROW __nonnull ((1)); # endif # ifdef __USE_XOPEN_EXTENDED /* Set to one of the following values to indicate an error. 1 the DATEMSK environment variable is null or undefined, 2 the template file cannot be opened for reading, 3 failed to get file status information, 4 the template file is not a regular file, 5 an error is encountered while reading the template file, 6 memory allication failed (not enough memory available), 7 there is no line in the template that matches the input, 8 invalid input specification Example: February 31 or a time is specified that can not be represented in a time_t (representing the time in seconds since 00:00:00 UTC, January 1, 1970) */ extern int getdate_err; /* Parse the given string as a date specification and return a value representing the value. The templates from the file identified by the environment variable DATEMSK are used. In case of an error `getdate_err' is set. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct tm *getdate (const char *__string); # endif # ifdef __USE_GNU /* Since `getdate' is not reentrant because of the use of `getdate_err' and the static buffer to return the result in, we provide a thread-safe variant. The functionality is the same. The result is returned in the buffer pointed to by RESBUFP and in case of an error the return value is != 0 with the same values as given above for `getdate_err'. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int getdate_r (const char *__restrict __string, struct tm *__restrict __resbufp); # endif __END_DECLS #endif /* included. */ #endif /* not already included. */ curl/curlbuild.h000064400000000244147631660260007662 0ustar00#include #if __WORDSIZE == 32 #include "curlbuild-32.h" #elif __WORDSIZE == 64 #include "curlbuild-64.h" #else #error "Unknown word size" #endif curl/typecheck-gcc.h000064400000110066147631660260010412 0ustar00#ifndef __CURL_TYPECHECK_GCC_H #define __CURL_TYPECHECK_GCC_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at http://curl.haxx.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ***************************************************************************/ /* wraps curl_easy_setopt() with typechecking */ /* To add a new kind of warning, add an * if(_curl_is_sometype_option(_curl_opt)) * if(!_curl_is_sometype(value)) * _curl_easy_setopt_err_sometype(); * block and define _curl_is_sometype_option, _curl_is_sometype and * _curl_easy_setopt_err_sometype below * * NOTE: We use two nested 'if' statements here instead of the && operator, in * order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x * when compiling with -Wlogical-op. * * To add an option that uses the same type as an existing option, you'll just * need to extend the appropriate _curl_*_option macro */ #define curl_easy_setopt(handle, option, value) \ __extension__ ({ \ __typeof__ (option) _curl_opt = option; \ if(__builtin_constant_p(_curl_opt)) { \ if(_curl_is_long_option(_curl_opt)) \ if(!_curl_is_long(value)) \ _curl_easy_setopt_err_long(); \ if(_curl_is_off_t_option(_curl_opt)) \ if(!_curl_is_off_t(value)) \ _curl_easy_setopt_err_curl_off_t(); \ if(_curl_is_string_option(_curl_opt)) \ if(!_curl_is_string(value)) \ _curl_easy_setopt_err_string(); \ if(_curl_is_write_cb_option(_curl_opt)) \ if(!_curl_is_write_cb(value)) \ _curl_easy_setopt_err_write_callback(); \ if((_curl_opt) == CURLOPT_READFUNCTION) \ if(!_curl_is_read_cb(value)) \ _curl_easy_setopt_err_read_cb(); \ if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \ if(!_curl_is_ioctl_cb(value)) \ _curl_easy_setopt_err_ioctl_cb(); \ if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \ if(!_curl_is_sockopt_cb(value)) \ _curl_easy_setopt_err_sockopt_cb(); \ if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \ if(!_curl_is_opensocket_cb(value)) \ _curl_easy_setopt_err_opensocket_cb(); \ if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \ if(!_curl_is_progress_cb(value)) \ _curl_easy_setopt_err_progress_cb(); \ if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \ if(!_curl_is_debug_cb(value)) \ _curl_easy_setopt_err_debug_cb(); \ if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \ if(!_curl_is_ssl_ctx_cb(value)) \ _curl_easy_setopt_err_ssl_ctx_cb(); \ if(_curl_is_conv_cb_option(_curl_opt)) \ if(!_curl_is_conv_cb(value)) \ _curl_easy_setopt_err_conv_cb(); \ if((_curl_opt) == CURLOPT_SEEKFUNCTION) \ if(!_curl_is_seek_cb(value)) \ _curl_easy_setopt_err_seek_cb(); \ if(_curl_is_cb_data_option(_curl_opt)) \ if(!_curl_is_cb_data(value)) \ _curl_easy_setopt_err_cb_data(); \ if((_curl_opt) == CURLOPT_ERRORBUFFER) \ if(!_curl_is_error_buffer(value)) \ _curl_easy_setopt_err_error_buffer(); \ if((_curl_opt) == CURLOPT_STDERR) \ if(!_curl_is_FILE(value)) \ _curl_easy_setopt_err_FILE(); \ if(_curl_is_postfields_option(_curl_opt)) \ if(!_curl_is_postfields(value)) \ _curl_easy_setopt_err_postfields(); \ if((_curl_opt) == CURLOPT_HTTPPOST) \ if(!_curl_is_arr((value), struct curl_httppost)) \ _curl_easy_setopt_err_curl_httpost(); \ if(_curl_is_slist_option(_curl_opt)) \ if(!_curl_is_arr((value), struct curl_slist)) \ _curl_easy_setopt_err_curl_slist(); \ if((_curl_opt) == CURLOPT_SHARE) \ if(!_curl_is_ptr((value), CURLSH)) \ _curl_easy_setopt_err_CURLSH(); \ } \ curl_easy_setopt(handle, _curl_opt, value); \ }) /* wraps curl_easy_getinfo() with typechecking */ /* FIXME: don't allow const pointers */ #define curl_easy_getinfo(handle, info, arg) \ __extension__ ({ \ __typeof__ (info) _curl_info = info; \ if(__builtin_constant_p(_curl_info)) { \ if(_curl_is_string_info(_curl_info)) \ if(!_curl_is_arr((arg), char *)) \ _curl_easy_getinfo_err_string(); \ if(_curl_is_long_info(_curl_info)) \ if(!_curl_is_arr((arg), long)) \ _curl_easy_getinfo_err_long(); \ if(_curl_is_double_info(_curl_info)) \ if(!_curl_is_arr((arg), double)) \ _curl_easy_getinfo_err_double(); \ if(_curl_is_slist_info(_curl_info)) \ if(!_curl_is_arr((arg), struct curl_slist *)) \ _curl_easy_getinfo_err_curl_slist(); \ } \ curl_easy_getinfo(handle, _curl_info, arg); \ }) /* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(), * for now just make sure that the functions are called with three * arguments */ #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param) #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param) /* the actual warnings, triggered by calling the _curl_easy_setopt_err* * functions */ /* To define a new warning, use _CURL_WARNING(identifier, "message") */ #define _CURL_WARNING(id, message) \ static void __attribute__((__warning__(message))) \ __attribute__((__unused__)) __attribute__((__noinline__)) \ id(void) { __asm__(""); } _CURL_WARNING(_curl_easy_setopt_err_long, "curl_easy_setopt expects a long argument for this option") _CURL_WARNING(_curl_easy_setopt_err_curl_off_t, "curl_easy_setopt expects a curl_off_t argument for this option") _CURL_WARNING(_curl_easy_setopt_err_string, "curl_easy_setopt expects a " "string (char* or char[]) argument for this option" ) _CURL_WARNING(_curl_easy_setopt_err_write_callback, "curl_easy_setopt expects a curl_write_callback argument for this option") _CURL_WARNING(_curl_easy_setopt_err_read_cb, "curl_easy_setopt expects a curl_read_callback argument for this option") _CURL_WARNING(_curl_easy_setopt_err_ioctl_cb, "curl_easy_setopt expects a curl_ioctl_callback argument for this option") _CURL_WARNING(_curl_easy_setopt_err_sockopt_cb, "curl_easy_setopt expects a curl_sockopt_callback argument for this option") _CURL_WARNING(_curl_easy_setopt_err_opensocket_cb, "curl_easy_setopt expects a " "curl_opensocket_callback argument for this option" ) _CURL_WARNING(_curl_easy_setopt_err_progress_cb, "curl_easy_setopt expects a curl_progress_callback argument for this option") _CURL_WARNING(_curl_easy_setopt_err_debug_cb, "curl_easy_setopt expects a curl_debug_callback argument for this option") _CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb, "curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option") _CURL_WARNING(_curl_easy_setopt_err_conv_cb, "curl_easy_setopt expects a curl_conv_callback argument for this option") _CURL_WARNING(_curl_easy_setopt_err_seek_cb, "curl_easy_setopt expects a curl_seek_callback argument for this option") _CURL_WARNING(_curl_easy_setopt_err_cb_data, "curl_easy_setopt expects a " "private data pointer as argument for this option") _CURL_WARNING(_curl_easy_setopt_err_error_buffer, "curl_easy_setopt expects a " "char buffer of CURL_ERROR_SIZE as argument for this option") _CURL_WARNING(_curl_easy_setopt_err_FILE, "curl_easy_setopt expects a FILE* argument for this option") _CURL_WARNING(_curl_easy_setopt_err_postfields, "curl_easy_setopt expects a void* or char* argument for this option") _CURL_WARNING(_curl_easy_setopt_err_curl_httpost, "curl_easy_setopt expects a struct curl_httppost* argument for this option") _CURL_WARNING(_curl_easy_setopt_err_curl_slist, "curl_easy_setopt expects a struct curl_slist* argument for this option") _CURL_WARNING(_curl_easy_setopt_err_CURLSH, "curl_easy_setopt expects a CURLSH* argument for this option") _CURL_WARNING(_curl_easy_getinfo_err_string, "curl_easy_getinfo expects a pointer to char * for this info") _CURL_WARNING(_curl_easy_getinfo_err_long, "curl_easy_getinfo expects a pointer to long for this info") _CURL_WARNING(_curl_easy_getinfo_err_double, "curl_easy_getinfo expects a pointer to double for this info") _CURL_WARNING(_curl_easy_getinfo_err_curl_slist, "curl_easy_getinfo expects a pointer to struct curl_slist * for this info") /* groups of curl_easy_setops options that take the same type of argument */ /* To add a new option to one of the groups, just add * (option) == CURLOPT_SOMETHING * to the or-expression. If the option takes a long or curl_off_t, you don't * have to do anything */ /* evaluates to true if option takes a long argument */ #define _curl_is_long_option(option) \ (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT) #define _curl_is_off_t_option(option) \ ((option) > CURLOPTTYPE_OFF_T) /* evaluates to true if option takes a char* argument */ #define _curl_is_string_option(option) \ ((option) == CURLOPT_URL || \ (option) == CURLOPT_PROXY || \ (option) == CURLOPT_INTERFACE || \ (option) == CURLOPT_NETRC_FILE || \ (option) == CURLOPT_USERPWD || \ (option) == CURLOPT_USERNAME || \ (option) == CURLOPT_PASSWORD || \ (option) == CURLOPT_PROXYUSERPWD || \ (option) == CURLOPT_PROXYUSERNAME || \ (option) == CURLOPT_PROXYPASSWORD || \ (option) == CURLOPT_NOPROXY || \ (option) == CURLOPT_ACCEPT_ENCODING || \ (option) == CURLOPT_REFERER || \ (option) == CURLOPT_USERAGENT || \ (option) == CURLOPT_COOKIE || \ (option) == CURLOPT_COOKIEFILE || \ (option) == CURLOPT_COOKIEJAR || \ (option) == CURLOPT_COOKIELIST || \ (option) == CURLOPT_FTPPORT || \ (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \ (option) == CURLOPT_FTP_ACCOUNT || \ (option) == CURLOPT_RANGE || \ (option) == CURLOPT_CUSTOMREQUEST || \ (option) == CURLOPT_SSLCERT || \ (option) == CURLOPT_SSLCERTTYPE || \ (option) == CURLOPT_SSLKEY || \ (option) == CURLOPT_SSLKEYTYPE || \ (option) == CURLOPT_KEYPASSWD || \ (option) == CURLOPT_SSLENGINE || \ (option) == CURLOPT_CAINFO || \ (option) == CURLOPT_CAPATH || \ (option) == CURLOPT_RANDOM_FILE || \ (option) == CURLOPT_EGDSOCKET || \ (option) == CURLOPT_SSL_CIPHER_LIST || \ (option) == CURLOPT_KRBLEVEL || \ (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \ (option) == CURLOPT_SSH_PUBLIC_KEYFILE || \ (option) == CURLOPT_SSH_PRIVATE_KEYFILE || \ (option) == CURLOPT_CRLFILE || \ (option) == CURLOPT_ISSUERCERT || \ (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \ (option) == CURLOPT_SSH_KNOWNHOSTS || \ (option) == CURLOPT_MAIL_FROM || \ (option) == CURLOPT_RTSP_SESSION_ID || \ (option) == CURLOPT_RTSP_STREAM_URI || \ (option) == CURLOPT_RTSP_TRANSPORT || \ 0) /* evaluates to true if option takes a curl_write_callback argument */ #define _curl_is_write_cb_option(option) \ ((option) == CURLOPT_HEADERFUNCTION || \ (option) == CURLOPT_WRITEFUNCTION) /* evaluates to true if option takes a curl_conv_callback argument */ #define _curl_is_conv_cb_option(option) \ ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \ (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \ (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION) /* evaluates to true if option takes a data argument to pass to a callback */ #define _curl_is_cb_data_option(option) \ ((option) == CURLOPT_WRITEDATA || \ (option) == CURLOPT_READDATA || \ (option) == CURLOPT_IOCTLDATA || \ (option) == CURLOPT_SOCKOPTDATA || \ (option) == CURLOPT_OPENSOCKETDATA || \ (option) == CURLOPT_PROGRESSDATA || \ (option) == CURLOPT_WRITEHEADER || \ (option) == CURLOPT_DEBUGDATA || \ (option) == CURLOPT_SSL_CTX_DATA || \ (option) == CURLOPT_SEEKDATA || \ (option) == CURLOPT_PRIVATE || \ (option) == CURLOPT_SSH_KEYDATA || \ (option) == CURLOPT_INTERLEAVEDATA || \ (option) == CURLOPT_CHUNK_DATA || \ (option) == CURLOPT_FNMATCH_DATA || \ 0) /* evaluates to true if option takes a POST data argument (void* or char*) */ #define _curl_is_postfields_option(option) \ ((option) == CURLOPT_POSTFIELDS || \ (option) == CURLOPT_COPYPOSTFIELDS || \ 0) /* evaluates to true if option takes a struct curl_slist * argument */ #define _curl_is_slist_option(option) \ ((option) == CURLOPT_HTTPHEADER || \ (option) == CURLOPT_HTTP200ALIASES || \ (option) == CURLOPT_QUOTE || \ (option) == CURLOPT_POSTQUOTE || \ (option) == CURLOPT_PREQUOTE || \ (option) == CURLOPT_TELNETOPTIONS || \ (option) == CURLOPT_MAIL_RCPT || \ 0) /* groups of curl_easy_getinfo infos that take the same type of argument */ /* evaluates to true if info expects a pointer to char * argument */ #define _curl_is_string_info(info) \ (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG) /* evaluates to true if info expects a pointer to long argument */ #define _curl_is_long_info(info) \ (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE) /* evaluates to true if info expects a pointer to double argument */ #define _curl_is_double_info(info) \ (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST) /* true if info expects a pointer to struct curl_slist * argument */ #define _curl_is_slist_info(info) \ (CURLINFO_SLIST < (info)) /* typecheck helpers -- check whether given expression has requested type*/ /* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros, * otherwise define a new macro. Search for __builtin_types_compatible_p * in the GCC manual. * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is * the actual expression passed to the curl_easy_setopt macro. This * means that you can only apply the sizeof and __typeof__ operators, no * == or whatsoever. */ /* XXX: should evaluate to true iff expr is a pointer */ #define _curl_is_any_ptr(expr) \ (sizeof(expr) == sizeof(void*)) /* evaluates to true if expr is NULL */ /* XXX: must not evaluate expr, so this check is not accurate */ #define _curl_is_NULL(expr) \ (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL))) /* evaluates to true if expr is type*, const type* or NULL */ #define _curl_is_ptr(expr, type) \ (_curl_is_NULL(expr) || \ __builtin_types_compatible_p(__typeof__(expr), type *) || \ __builtin_types_compatible_p(__typeof__(expr), const type *)) /* evaluates to true if expr is one of type[], type*, NULL or const type* */ #define _curl_is_arr(expr, type) \ (_curl_is_ptr((expr), type) || \ __builtin_types_compatible_p(__typeof__(expr), type [])) /* evaluates to true if expr is a string */ #define _curl_is_string(expr) \ (_curl_is_arr((expr), char) || \ _curl_is_arr((expr), signed char) || \ _curl_is_arr((expr), unsigned char)) /* evaluates to true if expr is a long (no matter the signedness) * XXX: for now, int is also accepted (and therefore short and char, which * are promoted to int when passed to a variadic function) */ #define _curl_is_long(expr) \ (__builtin_types_compatible_p(__typeof__(expr), long) || \ __builtin_types_compatible_p(__typeof__(expr), signed long) || \ __builtin_types_compatible_p(__typeof__(expr), unsigned long) || \ __builtin_types_compatible_p(__typeof__(expr), int) || \ __builtin_types_compatible_p(__typeof__(expr), signed int) || \ __builtin_types_compatible_p(__typeof__(expr), unsigned int) || \ __builtin_types_compatible_p(__typeof__(expr), short) || \ __builtin_types_compatible_p(__typeof__(expr), signed short) || \ __builtin_types_compatible_p(__typeof__(expr), unsigned short) || \ __builtin_types_compatible_p(__typeof__(expr), char) || \ __builtin_types_compatible_p(__typeof__(expr), signed char) || \ __builtin_types_compatible_p(__typeof__(expr), unsigned char)) /* evaluates to true if expr is of type curl_off_t */ #define _curl_is_off_t(expr) \ (__builtin_types_compatible_p(__typeof__(expr), curl_off_t)) /* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */ /* XXX: also check size of an char[] array? */ #define _curl_is_error_buffer(expr) \ (_curl_is_NULL(expr) || \ __builtin_types_compatible_p(__typeof__(expr), char *) || \ __builtin_types_compatible_p(__typeof__(expr), char[])) /* evaluates to true if expr is of type (const) void* or (const) FILE* */ #if 0 #define _curl_is_cb_data(expr) \ (_curl_is_ptr((expr), void) || \ _curl_is_ptr((expr), FILE)) #else /* be less strict */ #define _curl_is_cb_data(expr) \ _curl_is_any_ptr(expr) #endif /* evaluates to true if expr is of type FILE* */ #define _curl_is_FILE(expr) \ (__builtin_types_compatible_p(__typeof__(expr), FILE *)) /* evaluates to true if expr can be passed as POST data (void* or char*) */ #define _curl_is_postfields(expr) \ (_curl_is_ptr((expr), void) || \ _curl_is_arr((expr), char)) /* FIXME: the whole callback checking is messy... * The idea is to tolerate char vs. void and const vs. not const * pointers in arguments at least */ /* helper: __builtin_types_compatible_p distinguishes between functions and * function pointers, hide it */ #define _curl_callback_compatible(func, type) \ (__builtin_types_compatible_p(__typeof__(func), type) || \ __builtin_types_compatible_p(__typeof__(func), type*)) /* evaluates to true if expr is of type curl_read_callback or "similar" */ #define _curl_is_read_cb(expr) \ (_curl_is_NULL(expr) || \ __builtin_types_compatible_p(__typeof__(expr), __typeof__(fread)) || \ __builtin_types_compatible_p(__typeof__(expr), curl_read_callback) || \ _curl_callback_compatible((expr), _curl_read_callback1) || \ _curl_callback_compatible((expr), _curl_read_callback2) || \ _curl_callback_compatible((expr), _curl_read_callback3) || \ _curl_callback_compatible((expr), _curl_read_callback4) || \ _curl_callback_compatible((expr), _curl_read_callback5) || \ _curl_callback_compatible((expr), _curl_read_callback6)) typedef size_t (_curl_read_callback1)(char *, size_t, size_t, void*); typedef size_t (_curl_read_callback2)(char *, size_t, size_t, const void*); typedef size_t (_curl_read_callback3)(char *, size_t, size_t, FILE*); typedef size_t (_curl_read_callback4)(void *, size_t, size_t, void*); typedef size_t (_curl_read_callback5)(void *, size_t, size_t, const void*); typedef size_t (_curl_read_callback6)(void *, size_t, size_t, FILE*); /* evaluates to true if expr is of type curl_write_callback or "similar" */ #define _curl_is_write_cb(expr) \ (_curl_is_read_cb(expr) || \ __builtin_types_compatible_p(__typeof__(expr), __typeof__(fwrite)) || \ __builtin_types_compatible_p(__typeof__(expr), curl_write_callback) || \ _curl_callback_compatible((expr), _curl_write_callback1) || \ _curl_callback_compatible((expr), _curl_write_callback2) || \ _curl_callback_compatible((expr), _curl_write_callback3) || \ _curl_callback_compatible((expr), _curl_write_callback4) || \ _curl_callback_compatible((expr), _curl_write_callback5) || \ _curl_callback_compatible((expr), _curl_write_callback6)) typedef size_t (_curl_write_callback1)(const char *, size_t, size_t, void*); typedef size_t (_curl_write_callback2)(const char *, size_t, size_t, const void*); typedef size_t (_curl_write_callback3)(const char *, size_t, size_t, FILE*); typedef size_t (_curl_write_callback4)(const void *, size_t, size_t, void*); typedef size_t (_curl_write_callback5)(const void *, size_t, size_t, const void*); typedef size_t (_curl_write_callback6)(const void *, size_t, size_t, FILE*); /* evaluates to true if expr is of type curl_ioctl_callback or "similar" */ #define _curl_is_ioctl_cb(expr) \ (_curl_is_NULL(expr) || \ __builtin_types_compatible_p(__typeof__(expr), curl_ioctl_callback) || \ _curl_callback_compatible((expr), _curl_ioctl_callback1) || \ _curl_callback_compatible((expr), _curl_ioctl_callback2) || \ _curl_callback_compatible((expr), _curl_ioctl_callback3) || \ _curl_callback_compatible((expr), _curl_ioctl_callback4)) typedef curlioerr (_curl_ioctl_callback1)(CURL *, int, void*); typedef curlioerr (_curl_ioctl_callback2)(CURL *, int, const void*); typedef curlioerr (_curl_ioctl_callback3)(CURL *, curliocmd, void*); typedef curlioerr (_curl_ioctl_callback4)(CURL *, curliocmd, const void*); /* evaluates to true if expr is of type curl_sockopt_callback or "similar" */ #define _curl_is_sockopt_cb(expr) \ (_curl_is_NULL(expr) || \ __builtin_types_compatible_p(__typeof__(expr), curl_sockopt_callback) || \ _curl_callback_compatible((expr), _curl_sockopt_callback1) || \ _curl_callback_compatible((expr), _curl_sockopt_callback2)) typedef int (_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype); typedef int (_curl_sockopt_callback2)(const void *, curl_socket_t, curlsocktype); /* evaluates to true if expr is of type curl_opensocket_callback or "similar" */ #define _curl_is_opensocket_cb(expr) \ (_curl_is_NULL(expr) || \ __builtin_types_compatible_p(__typeof__(expr), curl_opensocket_callback) ||\ _curl_callback_compatible((expr), _curl_opensocket_callback1) || \ _curl_callback_compatible((expr), _curl_opensocket_callback2) || \ _curl_callback_compatible((expr), _curl_opensocket_callback3) || \ _curl_callback_compatible((expr), _curl_opensocket_callback4)) typedef curl_socket_t (_curl_opensocket_callback1) (void *, curlsocktype, struct curl_sockaddr *); typedef curl_socket_t (_curl_opensocket_callback2) (void *, curlsocktype, const struct curl_sockaddr *); typedef curl_socket_t (_curl_opensocket_callback3) (const void *, curlsocktype, struct curl_sockaddr *); typedef curl_socket_t (_curl_opensocket_callback4) (const void *, curlsocktype, const struct curl_sockaddr *); /* evaluates to true if expr is of type curl_progress_callback or "similar" */ #define _curl_is_progress_cb(expr) \ (_curl_is_NULL(expr) || \ __builtin_types_compatible_p(__typeof__(expr), curl_progress_callback) || \ _curl_callback_compatible((expr), _curl_progress_callback1) || \ _curl_callback_compatible((expr), _curl_progress_callback2)) typedef int (_curl_progress_callback1)(void *, double, double, double, double); typedef int (_curl_progress_callback2)(const void *, double, double, double, double); /* evaluates to true if expr is of type curl_debug_callback or "similar" */ #define _curl_is_debug_cb(expr) \ (_curl_is_NULL(expr) || \ __builtin_types_compatible_p(__typeof__(expr), curl_debug_callback) || \ _curl_callback_compatible((expr), _curl_debug_callback1) || \ _curl_callback_compatible((expr), _curl_debug_callback2) || \ _curl_callback_compatible((expr), _curl_debug_callback3) || \ _curl_callback_compatible((expr), _curl_debug_callback4) || \ _curl_callback_compatible((expr), _curl_debug_callback5) || \ _curl_callback_compatible((expr), _curl_debug_callback6) || \ _curl_callback_compatible((expr), _curl_debug_callback7) || \ _curl_callback_compatible((expr), _curl_debug_callback8)) typedef int (_curl_debug_callback1) (CURL *, curl_infotype, char *, size_t, void *); typedef int (_curl_debug_callback2) (CURL *, curl_infotype, char *, size_t, const void *); typedef int (_curl_debug_callback3) (CURL *, curl_infotype, const char *, size_t, void *); typedef int (_curl_debug_callback4) (CURL *, curl_infotype, const char *, size_t, const void *); typedef int (_curl_debug_callback5) (CURL *, curl_infotype, unsigned char *, size_t, void *); typedef int (_curl_debug_callback6) (CURL *, curl_infotype, unsigned char *, size_t, const void *); typedef int (_curl_debug_callback7) (CURL *, curl_infotype, const unsigned char *, size_t, void *); typedef int (_curl_debug_callback8) (CURL *, curl_infotype, const unsigned char *, size_t, const void *); /* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */ /* this is getting even messier... */ #define _curl_is_ssl_ctx_cb(expr) \ (_curl_is_NULL(expr) || \ __builtin_types_compatible_p(__typeof__(expr), curl_ssl_ctx_callback) || \ _curl_callback_compatible((expr), _curl_ssl_ctx_callback1) || \ _curl_callback_compatible((expr), _curl_ssl_ctx_callback2) || \ _curl_callback_compatible((expr), _curl_ssl_ctx_callback3) || \ _curl_callback_compatible((expr), _curl_ssl_ctx_callback4) || \ _curl_callback_compatible((expr), _curl_ssl_ctx_callback5) || \ _curl_callback_compatible((expr), _curl_ssl_ctx_callback6) || \ _curl_callback_compatible((expr), _curl_ssl_ctx_callback7) || \ _curl_callback_compatible((expr), _curl_ssl_ctx_callback8)) typedef CURLcode (_curl_ssl_ctx_callback1)(CURL *, void *, void *); typedef CURLcode (_curl_ssl_ctx_callback2)(CURL *, void *, const void *); typedef CURLcode (_curl_ssl_ctx_callback3)(CURL *, const void *, void *); typedef CURLcode (_curl_ssl_ctx_callback4)(CURL *, const void *, const void *); #ifdef HEADER_SSL_H /* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX * this will of course break if we're included before OpenSSL headers... */ typedef CURLcode (_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *); typedef CURLcode (_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *); typedef CURLcode (_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *); typedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX, const void *); #else typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5; typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6; typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7; typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8; #endif /* evaluates to true if expr is of type curl_conv_callback or "similar" */ #define _curl_is_conv_cb(expr) \ (_curl_is_NULL(expr) || \ __builtin_types_compatible_p(__typeof__(expr), curl_conv_callback) || \ _curl_callback_compatible((expr), _curl_conv_callback1) || \ _curl_callback_compatible((expr), _curl_conv_callback2) || \ _curl_callback_compatible((expr), _curl_conv_callback3) || \ _curl_callback_compatible((expr), _curl_conv_callback4)) typedef CURLcode (*_curl_conv_callback1)(char *, size_t length); typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length); typedef CURLcode (*_curl_conv_callback3)(void *, size_t length); typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length); /* evaluates to true if expr is of type curl_seek_callback or "similar" */ #define _curl_is_seek_cb(expr) \ (_curl_is_NULL(expr) || \ __builtin_types_compatible_p(__typeof__(expr), curl_seek_callback) || \ _curl_callback_compatible((expr), _curl_seek_callback1) || \ _curl_callback_compatible((expr), _curl_seek_callback2)) typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int); typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int); #endif /* __CURL_TYPECHECK_GCC_H */ curl/curlver.h000064400000005265147631660260007367 0ustar00#ifndef __CURL_CURLVER_H #define __CURL_CURLVER_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2013, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at http://curl.haxx.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ***************************************************************************/ /* This header file contains nothing but libcurl version info, generated by a script at release-time. This was made its own header file in 7.11.2 */ /* This is the global package copyright */ #define LIBCURL_COPYRIGHT "1996 - 2013 Daniel Stenberg, ." /* This is the version number of the libcurl package from which this header file origins: */ #define LIBCURL_VERSION "7.29.0" /* The numeric version number is also available "in parts" by using these defines: */ #define LIBCURL_VERSION_MAJOR 7 #define LIBCURL_VERSION_MINOR 29 #define LIBCURL_VERSION_PATCH 0 /* This is the numeric version of the libcurl version number, meant for easier parsing and comparions by programs. The LIBCURL_VERSION_NUM define will always follow this syntax: 0xXXYYZZ Where XX, YY and ZZ are the main version, release and patch numbers in hexadecimal (using 8 bits each). All three numbers are always represented using two digits. 1.2 would appear as "0x010200" while version 9.11.7 appears as "0x090b07". This 6-digit (24 bits) hexadecimal number does not show pre-release number, and it is always a greater number in a more recent release. It makes comparisons with greater than and less than work. */ #define LIBCURL_VERSION_NUM 0x071d00 /* * This is the date and time when the full source package was created. The * timestamp is not stored in git, as the timestamp is properly set in the * tarballs by the maketgz script. * * The format of the date should follow this template: * * "Mon Feb 12 11:35:33 UTC 2007" */ #define LIBCURL_TIMESTAMP "Wed Feb 6 10:13:08 UTC 2013" #endif /* __CURL_CURLVER_H */ curl/curlrules.h000064400000021346147631660260007723 0ustar00#ifndef __CURL_CURLRULES_H #define __CURL_CURLRULES_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at http://curl.haxx.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ***************************************************************************/ /* ================================================================ */ /* COMPILE TIME SANITY CHECKS */ /* ================================================================ */ /* * NOTE 1: * ------- * * All checks done in this file are intentionally placed in a public * header file which is pulled by curl/curl.h when an application is * being built using an already built libcurl library. Additionally * this file is also included and used when building the library. * * If compilation fails on this file it is certainly sure that the * problem is elsewhere. It could be a problem in the curlbuild.h * header file, or simply that you are using different compilation * settings than those used to build the library. * * Nothing in this file is intended to be modified or adjusted by the * curl library user nor by the curl library builder. * * Do not deactivate any check, these are done to make sure that the * library is properly built and used. * * You can find further help on the libcurl development mailing list: * http://cool.haxx.se/mailman/listinfo/curl-library/ * * NOTE 2 * ------ * * Some of the following compile time checks are based on the fact * that the dimension of a constant array can not be a negative one. * In this way if the compile time verification fails, the compilation * will fail issuing an error. The error description wording is compiler * dependent but it will be quite similar to one of the following: * * "negative subscript or subscript is too large" * "array must have at least one element" * "-1 is an illegal array size" * "size of array is negative" * * If you are building an application which tries to use an already * built libcurl library and you are getting this kind of errors on * this file, it is a clear indication that there is a mismatch between * how the library was built and how you are trying to use it for your * application. Your already compiled or binary library provider is the * only one who can give you the details you need to properly use it. */ /* * Verify that some macros are actually defined. */ #ifndef CURL_SIZEOF_LONG # error "CURL_SIZEOF_LONG definition is missing!" Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing #endif #ifndef CURL_TYPEOF_CURL_SOCKLEN_T # error "CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!" Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing #endif #ifndef CURL_SIZEOF_CURL_SOCKLEN_T # error "CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!" Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing #endif #ifndef CURL_TYPEOF_CURL_OFF_T # error "CURL_TYPEOF_CURL_OFF_T definition is missing!" Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing #endif #ifndef CURL_FORMAT_CURL_OFF_T # error "CURL_FORMAT_CURL_OFF_T definition is missing!" Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing #endif #ifndef CURL_FORMAT_CURL_OFF_TU # error "CURL_FORMAT_CURL_OFF_TU definition is missing!" Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing #endif #ifndef CURL_FORMAT_OFF_T # error "CURL_FORMAT_OFF_T definition is missing!" Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing #endif #ifndef CURL_SIZEOF_CURL_OFF_T # error "CURL_SIZEOF_CURL_OFF_T definition is missing!" Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing #endif #ifndef CURL_SUFFIX_CURL_OFF_T # error "CURL_SUFFIX_CURL_OFF_T definition is missing!" Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing #endif #ifndef CURL_SUFFIX_CURL_OFF_TU # error "CURL_SUFFIX_CURL_OFF_TU definition is missing!" Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing #endif /* * Macros private to this header file. */ #define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1 #define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1 /* * Verify that the size previously defined and expected for long * is the same as the one reported by sizeof() at compile time. */ typedef char __curl_rule_01__ [CurlchkszEQ(long, CURL_SIZEOF_LONG)]; /* * Verify that the size previously defined and expected for * curl_off_t is actually the the same as the one reported * by sizeof() at compile time. */ typedef char __curl_rule_02__ [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)]; /* * Verify at compile time that the size of curl_off_t as reported * by sizeof() is greater or equal than the one reported for long * for the current compilation. */ typedef char __curl_rule_03__ [CurlchkszGE(curl_off_t, long)]; /* * Verify that the size previously defined and expected for * curl_socklen_t is actually the the same as the one reported * by sizeof() at compile time. */ typedef char __curl_rule_04__ [CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)]; /* * Verify at compile time that the size of curl_socklen_t as reported * by sizeof() is greater or equal than the one reported for int for * the current compilation. */ typedef char __curl_rule_05__ [CurlchkszGE(curl_socklen_t, int)]; /* ================================================================ */ /* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */ /* ================================================================ */ /* * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow * these to be visible and exported by the external libcurl interface API, * while also making them visible to the library internals, simply including * curl_setup.h, without actually needing to include curl.h internally. * If some day this section would grow big enough, all this should be moved * to its own header file. */ /* * Figure out if we can use the ## preprocessor operator, which is supported * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__ * or __cplusplus so we need to carefully check for them too. */ #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \ defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \ defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \ defined(__ILEC400__) /* This compiler is believed to have an ISO compatible preprocessor */ #define CURL_ISOCPP #else /* This compiler is believed NOT to have an ISO compatible preprocessor */ #undef CURL_ISOCPP #endif /* * Macros for minimum-width signed and unsigned curl_off_t integer constants. */ #if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551) # define __CURL_OFF_T_C_HLPR2(x) x # define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x) # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \ __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T) # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \ __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU) #else # ifdef CURL_ISOCPP # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix # else # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix # endif # define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix) # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T) # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU) #endif /* * Get rid of macros private to this header file. */ #undef CurlchkszEQ #undef CurlchkszGE /* * Get rid of macros not intended to exist beyond this point. */ #undef CURL_PULL_WS2TCPIP_H #undef CURL_PULL_SYS_TYPES_H #undef CURL_PULL_SYS_SOCKET_H #undef CURL_PULL_SYS_POLL_H #undef CURL_PULL_STDINT_H #undef CURL_PULL_INTTYPES_H #undef CURL_TYPEOF_CURL_SOCKLEN_T #undef CURL_TYPEOF_CURL_OFF_T #ifdef CURL_NO_OLDIES #undef CURL_FORMAT_OFF_T /* not required since 7.19.0 - obsoleted in 7.20.0 */ #endif #endif /* __CURL_CURLRULES_H */ curl/easy.h000064400000006620147631660260006642 0ustar00#ifndef __CURL_EASY_H #define __CURL_EASY_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at http://curl.haxx.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ***************************************************************************/ #ifdef __cplusplus extern "C" { #endif CURL_EXTERN CURL *curl_easy_init(void); CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...); CURL_EXTERN CURLcode curl_easy_perform(CURL *curl); CURL_EXTERN void curl_easy_cleanup(CURL *curl); /* * NAME curl_easy_getinfo() * * DESCRIPTION * * Request internal information from the curl session with this function. The * third argument MUST be a pointer to a long, a pointer to a char * or a * pointer to a double (as the documentation describes elsewhere). The data * pointed to will be filled in accordingly and can be relied upon only if the * function returns CURLE_OK. This function is intended to get used *AFTER* a * performed transfer, all results from this function are undefined until the * transfer is completed. */ CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); /* * NAME curl_easy_duphandle() * * DESCRIPTION * * Creates a new curl session handle with the same options set for the handle * passed in. Duplicating a handle could only be a matter of cloning data and * options, internal state info and things like persistent connections cannot * be transferred. It is useful in multithreaded applications when you can run * curl_easy_duphandle() for each new thread to avoid a series of identical * curl_easy_setopt() invokes in every thread. */ CURL_EXTERN CURL* curl_easy_duphandle(CURL *curl); /* * NAME curl_easy_reset() * * DESCRIPTION * * Re-initializes a CURL handle to the default values. This puts back the * handle to the same state as it was in when it was just created. * * It does keep: live connections, the Session ID cache, the DNS cache and the * cookies. */ CURL_EXTERN void curl_easy_reset(CURL *curl); /* * NAME curl_easy_recv() * * DESCRIPTION * * Receives data from the connected socket. Use after successful * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. */ CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, size_t *n); /* * NAME curl_easy_send() * * DESCRIPTION * * Sends data over the connected socket. Use after successful * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. */ CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer, size_t buflen, size_t *n); #ifdef __cplusplus } #endif #endif curl/stdcheaders.h000064400000002462147631660260010172 0ustar00#ifndef __STDC_HEADERS_H #define __STDC_HEADERS_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at http://curl.haxx.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ***************************************************************************/ #include size_t fread (void *, size_t, size_t, FILE *); size_t fwrite (const void *, size_t, size_t, FILE *); int strcasecmp(const char *, const char *); int strncasecmp(const char *, const char *, size_t); #endif /* __STDC_HEADERS_H */ curl/curlbuild-64.h000064400000016207147631660260010117 0ustar00/* include/curl/curlbuild.h. Generated from curlbuild.h.in by configure. */ #ifndef __CURL_CURLBUILD_H #define __CURL_CURLBUILD_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at http://curl.haxx.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ***************************************************************************/ /* ================================================================ */ /* NOTES FOR CONFIGURE CAPABLE SYSTEMS */ /* ================================================================ */ /* * NOTE 1: * ------- * * Nothing in this file is intended to be modified or adjusted by the * curl library user nor by the curl library builder. * * If you think that something actually needs to be changed, adjusted * or fixed in this file, then, report it on the libcurl development * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/ * * This header file shall only export symbols which are 'curl' or 'CURL' * prefixed, otherwise public name space would be polluted. * * NOTE 2: * ------- * * Right now you might be staring at file include/curl/curlbuild.h.in or * at file include/curl/curlbuild.h, this is due to the following reason: * * On systems capable of running the configure script, the configure process * will overwrite the distributed include/curl/curlbuild.h file with one that * is suitable and specific to the library being configured and built, which * is generated from the include/curl/curlbuild.h.in template file. * */ /* ================================================================ */ /* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ /* ================================================================ */ #ifdef CURL_SIZEOF_LONG #error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined #endif #ifdef CURL_TYPEOF_CURL_SOCKLEN_T #error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined #endif #ifdef CURL_SIZEOF_CURL_SOCKLEN_T #error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined #endif #ifdef CURL_TYPEOF_CURL_OFF_T #error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined #endif #ifdef CURL_FORMAT_CURL_OFF_T #error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined #endif #ifdef CURL_FORMAT_CURL_OFF_TU #error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined #endif #ifdef CURL_FORMAT_OFF_T #error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined #endif #ifdef CURL_SIZEOF_CURL_OFF_T #error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined #endif #ifdef CURL_SUFFIX_CURL_OFF_T #error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined #endif #ifdef CURL_SUFFIX_CURL_OFF_TU #error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined #endif /* ================================================================ */ /* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */ /* ================================================================ */ /* Configure process defines this to 1 when it finds out that system */ /* header file ws2tcpip.h must be included by the external interface. */ /* #undef CURL_PULL_WS2TCPIP_H */ #ifdef CURL_PULL_WS2TCPIP_H # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN # endif # include # include # include #endif /* Configure process defines this to 1 when it finds out that system */ /* header file sys/types.h must be included by the external interface. */ #define CURL_PULL_SYS_TYPES_H 1 #ifdef CURL_PULL_SYS_TYPES_H # include #endif /* Configure process defines this to 1 when it finds out that system */ /* header file stdint.h must be included by the external interface. */ /* #undef CURL_PULL_STDINT_H */ #ifdef CURL_PULL_STDINT_H # include #endif /* Configure process defines this to 1 when it finds out that system */ /* header file inttypes.h must be included by the external interface. */ /* #undef CURL_PULL_INTTYPES_H */ #ifdef CURL_PULL_INTTYPES_H # include #endif /* Configure process defines this to 1 when it finds out that system */ /* header file sys/socket.h must be included by the external interface. */ #define CURL_PULL_SYS_SOCKET_H 1 #ifdef CURL_PULL_SYS_SOCKET_H # include #endif /* Configure process defines this to 1 when it finds out that system */ /* header file sys/poll.h must be included by the external interface. */ /* #undef CURL_PULL_SYS_POLL_H */ #ifdef CURL_PULL_SYS_POLL_H # include #endif /* The size of `long', as computed by sizeof. */ #define CURL_SIZEOF_LONG 8 /* Integral data type used for curl_socklen_t. */ #define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t /* The size of `curl_socklen_t', as computed by sizeof. */ #define CURL_SIZEOF_CURL_SOCKLEN_T 4 /* Data type definition of curl_socklen_t. */ typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; /* Signed integral data type used for curl_off_t. */ #define CURL_TYPEOF_CURL_OFF_T long /* Data type definition of curl_off_t. */ typedef CURL_TYPEOF_CURL_OFF_T curl_off_t; /* curl_off_t formatting string directive without "%" conversion specifier. */ #define CURL_FORMAT_CURL_OFF_T "ld" /* unsigned curl_off_t formatting string without "%" conversion specifier. */ #define CURL_FORMAT_CURL_OFF_TU "lu" /* curl_off_t formatting string directive with "%" conversion specifier. */ #define CURL_FORMAT_OFF_T "%ld" /* The size of `curl_off_t', as computed by sizeof. */ #define CURL_SIZEOF_CURL_OFF_T 8 /* curl_off_t constant suffix. */ #define CURL_SUFFIX_CURL_OFF_T L /* unsigned curl_off_t constant suffix. */ #define CURL_SUFFIX_CURL_OFF_TU UL #endif /* __CURL_CURLBUILD_H */ curl/multi.h000064400000033014147631660260007030 0ustar00#ifndef __CURL_MULTI_H #define __CURL_MULTI_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at http://curl.haxx.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ***************************************************************************/ /* This is an "external" header file. Don't give away any internals here! GOALS o Enable a "pull" interface. The application that uses libcurl decides where and when to ask libcurl to get/send data. o Enable multiple simultaneous transfers in the same thread without making it complicated for the application. o Enable the application to select() on its own file descriptors and curl's file descriptors simultaneous easily. */ /* * This header file should not really need to include "curl.h" since curl.h * itself includes this file and we expect user applications to do #include * without the need for especially including multi.h. * * For some reason we added this include here at one point, and rather than to * break existing (wrongly written) libcurl applications, we leave it as-is * but with this warning attached. */ #include "curl.h" #ifdef __cplusplus extern "C" { #endif typedef void CURLM; typedef enum { CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or curl_multi_socket*() soon */ CURLM_OK, CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */ CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */ CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */ CURLM_INTERNAL_ERROR, /* this is a libcurl bug */ CURLM_BAD_SOCKET, /* the passed in socket argument did not match */ CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */ CURLM_LAST } CURLMcode; /* just to make code nicer when using curl_multi_socket() you can now check for CURLM_CALL_MULTI_SOCKET too in the same style it works for curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */ #define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM typedef enum { CURLMSG_NONE, /* first, not used */ CURLMSG_DONE, /* This easy handle has completed. 'result' contains the CURLcode of the transfer */ CURLMSG_LAST /* last, not used */ } CURLMSG; struct CURLMsg { CURLMSG msg; /* what this message means */ CURL *easy_handle; /* the handle it concerns */ union { void *whatever; /* message-specific data */ CURLcode result; /* return code for transfer */ } data; }; typedef struct CURLMsg CURLMsg; /* Based on poll(2) structure and values. * We don't use pollfd and POLL* constants explicitly * to cover platforms without poll(). */ #define CURL_WAIT_POLLIN 0x0001 #define CURL_WAIT_POLLPRI 0x0002 #define CURL_WAIT_POLLOUT 0x0004 struct curl_waitfd { curl_socket_t fd; short events; short revents; /* not supported yet */ }; /* * Name: curl_multi_init() * * Desc: inititalize multi-style curl usage * * Returns: a new CURLM handle to use in all 'curl_multi' functions. */ CURL_EXTERN CURLM *curl_multi_init(void); /* * Name: curl_multi_add_handle() * * Desc: add a standard curl handle to the multi stack * * Returns: CURLMcode type, general multi error code. */ CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle, CURL *curl_handle); /* * Name: curl_multi_remove_handle() * * Desc: removes a curl handle from the multi stack again * * Returns: CURLMcode type, general multi error code. */ CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle, CURL *curl_handle); /* * Name: curl_multi_fdset() * * Desc: Ask curl for its fd_set sets. The app can use these to select() or * poll() on. We want curl_multi_perform() called as soon as one of * them are ready. * * Returns: CURLMcode type, general multi error code. */ CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle, fd_set *read_fd_set, fd_set *write_fd_set, fd_set *exc_fd_set, int *max_fd); /* * Name: curl_multi_wait() * * Desc: Poll on all fds within a CURLM set as well as any * additional fds passed to the function. * * Returns: CURLMcode type, general multi error code. */ CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle, struct curl_waitfd extra_fds[], unsigned int extra_nfds, int timeout_ms, int *ret); /* * Name: curl_multi_perform() * * Desc: When the app thinks there's data available for curl it calls this * function to read/write whatever there is right now. This returns * as soon as the reads and writes are done. This function does not * require that there actually is data available for reading or that * data can be written, it can be called just in case. It returns * the number of handles that still transfer data in the second * argument's integer-pointer. * * Returns: CURLMcode type, general multi error code. *NOTE* that this only * returns errors etc regarding the whole multi stack. There might * still have occurred problems on invidual transfers even when this * returns OK. */ CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles); /* * Name: curl_multi_cleanup() * * Desc: Cleans up and removes a whole multi stack. It does not free or * touch any individual easy handles in any way. We need to define * in what state those handles will be if this function is called * in the middle of a transfer. * * Returns: CURLMcode type, general multi error code. */ CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle); /* * Name: curl_multi_info_read() * * Desc: Ask the multi handle if there's any messages/informationals from * the individual transfers. Messages include informationals such as * error code from the transfer or just the fact that a transfer is * completed. More details on these should be written down as well. * * Repeated calls to this function will return a new struct each * time, until a special "end of msgs" struct is returned as a signal * that there is no more to get at this point. * * The data the returned pointer points to will not survive calling * curl_multi_cleanup(). * * The 'CURLMsg' struct is meant to be very simple and only contain * very basic informations. If more involved information is wanted, * we will provide the particular "transfer handle" in that struct * and that should/could/would be used in subsequent * curl_easy_getinfo() calls (or similar). The point being that we * must never expose complex structs to applications, as then we'll * undoubtably get backwards compatibility problems in the future. * * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out * of structs. It also writes the number of messages left in the * queue (after this read) in the integer the second argument points * to. */ CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle, int *msgs_in_queue); /* * Name: curl_multi_strerror() * * Desc: The curl_multi_strerror function may be used to turn a CURLMcode * value into the equivalent human readable error string. This is * useful for printing meaningful error messages. * * Returns: A pointer to a zero-terminated error message. */ CURL_EXTERN const char *curl_multi_strerror(CURLMcode); /* * Name: curl_multi_socket() and * curl_multi_socket_all() * * Desc: An alternative version of curl_multi_perform() that allows the * application to pass in one of the file descriptors that have been * detected to have "action" on them and let libcurl perform. * See man page for details. */ #define CURL_POLL_NONE 0 #define CURL_POLL_IN 1 #define CURL_POLL_OUT 2 #define CURL_POLL_INOUT 3 #define CURL_POLL_REMOVE 4 #define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD #define CURL_CSELECT_IN 0x01 #define CURL_CSELECT_OUT 0x02 #define CURL_CSELECT_ERR 0x04 typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */ curl_socket_t s, /* socket */ int what, /* see above */ void *userp, /* private callback pointer */ void *socketp); /* private socket pointer */ /* * Name: curl_multi_timer_callback * * Desc: Called by libcurl whenever the library detects a change in the * maximum number of milliseconds the app is allowed to wait before * curl_multi_socket() or curl_multi_perform() must be called * (to allow libcurl's timed events to take place). * * Returns: The callback should return zero. */ typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */ long timeout_ms, /* see above */ void *userp); /* private callback pointer */ CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s, int *running_handles); CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle, curl_socket_t s, int ev_bitmask, int *running_handles); CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle, int *running_handles); #ifndef CURL_ALLOW_OLD_MULTI_SOCKET /* This macro below was added in 7.16.3 to push users who recompile to use the new curl_multi_socket_action() instead of the old curl_multi_socket() */ #define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z) #endif /* * Name: curl_multi_timeout() * * Desc: Returns the maximum number of milliseconds the app is allowed to * wait before curl_multi_socket() or curl_multi_perform() must be * called (to allow libcurl's timed events to take place). * * Returns: CURLM error code. */ CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle, long *milliseconds); #undef CINIT /* re-using the same name as in curl.h */ #ifdef CURL_ISOCPP #define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num #else /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ #define LONG CURLOPTTYPE_LONG #define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT #define OFF_T CURLOPTTYPE_OFF_T #define CINIT(name,type,number) CURLMOPT_/**/name = type + number #endif typedef enum { /* This is the socket callback function pointer */ CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1), /* This is the argument passed to the socket callback */ CINIT(SOCKETDATA, OBJECTPOINT, 2), /* set to 1 to enable pipelining for this multi handle */ CINIT(PIPELINING, LONG, 3), /* This is the timer callback function pointer */ CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4), /* This is the argument passed to the timer callback */ CINIT(TIMERDATA, OBJECTPOINT, 5), /* maximum number of entries in the connection cache */ CINIT(MAXCONNECTS, LONG, 6), CURLMOPT_LASTENTRY /* the last unused */ } CURLMoption; /* * Name: curl_multi_setopt() * * Desc: Sets options for the multi handle. * * Returns: CURLM error code. */ CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle, CURLMoption option, ...); /* * Name: curl_multi_assign() * * Desc: This function sets an association in the multi handle between the * given socket and a private pointer of the application. This is * (only) useful for curl_multi_socket uses. * * Returns: CURLM error code. */ CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle, curl_socket_t sockfd, void *sockp); #ifdef __cplusplus } /* end of extern "C" */ #endif #endif curl/curl.h000064400000246135147631660260006655 0ustar00#ifndef __CURL_CURL_H #define __CURL_CURL_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at http://curl.haxx.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ***************************************************************************/ /* * If you have libcurl problems, all docs and details are found here: * http://curl.haxx.se/libcurl/ * * curl-library mailing list subscription and unsubscription web interface: * http://cool.haxx.se/mailman/listinfo/curl-library/ */ #include "curlver.h" /* libcurl version defines */ #include "curlbuild.h" /* libcurl build definitions */ #include "curlrules.h" /* libcurl rules enforcement */ /* * Define WIN32 when build target is Win32 API */ #if (defined(_WIN32) || defined(__WIN32__)) && \ !defined(WIN32) && !defined(__SYMBIAN32__) #define WIN32 #endif #include #include #if defined(__FreeBSD__) && (__FreeBSD__ >= 2) /* Needed for __FreeBSD_version symbol definition */ #include #endif /* The include stuff here below is mainly for time_t! */ #include #include #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__) #if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || defined(__LWIP_OPT_H__)) /* The check above prevents the winsock2 inclusion if winsock.h already was included, since they can't co-exist without problems */ #include #include #endif #endif /* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish libc5-based Linux systems. Only include it on systems that are known to require it! */ #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \ defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \ defined(ANDROID) || defined(__ANDROID__) || \ (defined(__FreeBSD_version) && (__FreeBSD_version < 800000)) #include #endif #if !defined(WIN32) && !defined(_WIN32_WCE) #include #endif #if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__) #include #endif #ifdef __BEOS__ #include #endif #ifdef __cplusplus extern "C" { #endif typedef void CURL; /* * Decorate exportable functions for Win32 and Symbian OS DLL linking. * This avoids using a .def file for building libcurl.dll. */ #if (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) && \ !defined(CURL_STATICLIB) #if defined(BUILDING_LIBCURL) #define CURL_EXTERN __declspec(dllexport) #else #define CURL_EXTERN __declspec(dllimport) #endif #else #ifdef CURL_HIDDEN_SYMBOLS /* * This definition is used to make external definitions visible in the * shared library when symbols are hidden by default. It makes no * difference when compiling applications whether this is set or not, * only when compiling the library. */ #define CURL_EXTERN CURL_EXTERN_SYMBOL #else #define CURL_EXTERN #endif #endif #ifndef curl_socket_typedef /* socket typedef */ #if defined(WIN32) && !defined(__LWIP_OPT_H__) typedef SOCKET curl_socket_t; #define CURL_SOCKET_BAD INVALID_SOCKET #else typedef int curl_socket_t; #define CURL_SOCKET_BAD -1 #endif #define curl_socket_typedef #endif /* curl_socket_typedef */ struct curl_httppost { struct curl_httppost *next; /* next entry in the list */ char *name; /* pointer to allocated name */ long namelength; /* length of name length */ char *contents; /* pointer to allocated data contents */ long contentslength; /* length of contents field */ char *buffer; /* pointer to allocated buffer contents */ long bufferlength; /* length of buffer field */ char *contenttype; /* Content-Type */ struct curl_slist* contentheader; /* list of extra headers for this form */ struct curl_httppost *more; /* if one field name has more than one file, this link should link to following files */ long flags; /* as defined below */ #define HTTPPOST_FILENAME (1<<0) /* specified content is a file name */ #define HTTPPOST_READFILE (1<<1) /* specified content is a file name */ #define HTTPPOST_PTRNAME (1<<2) /* name is only stored pointer do not free in formfree */ #define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer do not free in formfree */ #define HTTPPOST_BUFFER (1<<4) /* upload file from buffer */ #define HTTPPOST_PTRBUFFER (1<<5) /* upload file from pointer contents */ #define HTTPPOST_CALLBACK (1<<6) /* upload file contents by using the regular read callback to get the data and pass the given pointer as custom pointer */ char *showfilename; /* The file name to show. If not set, the actual file name will be used (if this is a file part) */ void *userp; /* custom pointer used for HTTPPOST_CALLBACK posts */ }; typedef int (*curl_progress_callback)(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow); #ifndef CURL_MAX_READ_SIZE /* The maximum receive buffer size configurable via CURLOPT_BUFFERSIZE. */ #define CURL_MAX_READ_SIZE 524288 #endif #ifndef CURL_MAX_WRITE_SIZE /* Tests have proven that 20K is a very bad buffer size for uploads on Windows, while 16K for some odd reason performed a lot better. We do the ifndef check to allow this value to easier be changed at build time for those who feel adventurous. The practical minimum is about 400 bytes since libcurl uses a buffer of this size as a scratch area (unrelated to network send operations). */ #define CURL_MAX_WRITE_SIZE 16384 #endif #ifndef CURL_MAX_HTTP_HEADER /* The only reason to have a max limit for this is to avoid the risk of a bad server feeding libcurl with a never-ending header that will cause reallocs infinitely */ #define CURL_MAX_HTTP_HEADER (100*1024) #endif /* This is a magic return code for the write callback that, when returned, will signal libcurl to pause receiving on the current transfer. */ #define CURL_WRITEFUNC_PAUSE 0x10000001 typedef size_t (*curl_write_callback)(char *buffer, size_t size, size_t nitems, void *outstream); /* enumeration of file types */ typedef enum { CURLFILETYPE_FILE = 0, CURLFILETYPE_DIRECTORY, CURLFILETYPE_SYMLINK, CURLFILETYPE_DEVICE_BLOCK, CURLFILETYPE_DEVICE_CHAR, CURLFILETYPE_NAMEDPIPE, CURLFILETYPE_SOCKET, CURLFILETYPE_DOOR, /* is possible only on Sun Solaris now */ CURLFILETYPE_UNKNOWN /* should never occur */ } curlfiletype; #define CURLFINFOFLAG_KNOWN_FILENAME (1<<0) #define CURLFINFOFLAG_KNOWN_FILETYPE (1<<1) #define CURLFINFOFLAG_KNOWN_TIME (1<<2) #define CURLFINFOFLAG_KNOWN_PERM (1<<3) #define CURLFINFOFLAG_KNOWN_UID (1<<4) #define CURLFINFOFLAG_KNOWN_GID (1<<5) #define CURLFINFOFLAG_KNOWN_SIZE (1<<6) #define CURLFINFOFLAG_KNOWN_HLINKCOUNT (1<<7) /* Content of this structure depends on information which is known and is achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man page for callbacks returning this structure -- some fields are mandatory, some others are optional. The FLAG field has special meaning. */ struct curl_fileinfo { char *filename; curlfiletype filetype; time_t time; unsigned int perm; int uid; int gid; curl_off_t size; long int hardlinks; struct { /* If some of these fields is not NULL, it is a pointer to b_data. */ char *time; char *perm; char *user; char *group; char *target; /* pointer to the target filename of a symlink */ } strings; unsigned int flags; /* used internally */ char * b_data; size_t b_size; size_t b_used; }; /* return codes for CURLOPT_CHUNK_BGN_FUNCTION */ #define CURL_CHUNK_BGN_FUNC_OK 0 #define CURL_CHUNK_BGN_FUNC_FAIL 1 /* tell the lib to end the task */ #define CURL_CHUNK_BGN_FUNC_SKIP 2 /* skip this chunk over */ /* if splitting of data transfer is enabled, this callback is called before download of an individual chunk started. Note that parameter "remains" works only for FTP wildcard downloading (for now), otherwise is not used */ typedef long (*curl_chunk_bgn_callback)(const void *transfer_info, void *ptr, int remains); /* return codes for CURLOPT_CHUNK_END_FUNCTION */ #define CURL_CHUNK_END_FUNC_OK 0 #define CURL_CHUNK_END_FUNC_FAIL 1 /* tell the lib to end the task */ /* If splitting of data transfer is enabled this callback is called after download of an individual chunk finished. Note! After this callback was set then it have to be called FOR ALL chunks. Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC. This is the reason why we don't need "transfer_info" parameter in this callback and we are not interested in "remains" parameter too. */ typedef long (*curl_chunk_end_callback)(void *ptr); /* return codes for FNMATCHFUNCTION */ #define CURL_FNMATCHFUNC_MATCH 0 /* string corresponds to the pattern */ #define CURL_FNMATCHFUNC_NOMATCH 1 /* pattern doesn't match the string */ #define CURL_FNMATCHFUNC_FAIL 2 /* an error occurred */ /* callback type for wildcard downloading pattern matching. If the string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */ typedef int (*curl_fnmatch_callback)(void *ptr, const char *pattern, const char *string); /* These are the return codes for the seek callbacks */ #define CURL_SEEKFUNC_OK 0 #define CURL_SEEKFUNC_FAIL 1 /* fail the entire transfer */ #define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so libcurl might try other means instead */ typedef int (*curl_seek_callback)(void *instream, curl_off_t offset, int origin); /* 'whence' */ /* This is a return code for the read callback that, when returned, will signal libcurl to immediately abort the current transfer. */ #define CURL_READFUNC_ABORT 0x10000000 /* This is a return code for the read callback that, when returned, will signal libcurl to pause sending data on the current transfer. */ #define CURL_READFUNC_PAUSE 0x10000001 typedef size_t (*curl_read_callback)(char *buffer, size_t size, size_t nitems, void *instream); typedef enum { CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */ CURLSOCKTYPE_ACCEPT, /* socket created by accept() call */ CURLSOCKTYPE_LAST /* never use */ } curlsocktype; /* The return code from the sockopt_callback can signal information back to libcurl: */ #define CURL_SOCKOPT_OK 0 #define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return CURLE_ABORTED_BY_CALLBACK */ #define CURL_SOCKOPT_ALREADY_CONNECTED 2 typedef int (*curl_sockopt_callback)(void *clientp, curl_socket_t curlfd, curlsocktype purpose); struct curl_sockaddr { int family; int socktype; int protocol; unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it turned really ugly and painful on the systems that lack this type */ struct sockaddr addr; }; typedef curl_socket_t (*curl_opensocket_callback)(void *clientp, curlsocktype purpose, struct curl_sockaddr *address); typedef int (*curl_closesocket_callback)(void *clientp, curl_socket_t item); typedef enum { CURLIOE_OK, /* I/O operation successful */ CURLIOE_UNKNOWNCMD, /* command was unknown to callback */ CURLIOE_FAILRESTART, /* failed to restart the read */ CURLIOE_LAST /* never use */ } curlioerr; typedef enum { CURLIOCMD_NOP, /* no operation */ CURLIOCMD_RESTARTREAD, /* restart the read stream from start */ CURLIOCMD_LAST /* never use */ } curliocmd; typedef curlioerr (*curl_ioctl_callback)(CURL *handle, int cmd, void *clientp); /* * The following typedef's are signatures of malloc, free, realloc, strdup and * calloc respectively. Function pointers of these types can be passed to the * curl_global_init_mem() function to set user defined memory management * callback routines. */ typedef void *(*curl_malloc_callback)(size_t size); typedef void (*curl_free_callback)(void *ptr); typedef void *(*curl_realloc_callback)(void *ptr, size_t size); typedef char *(*curl_strdup_callback)(const char *str); typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size); /* the kind of data that is passed to information_callback*/ typedef enum { CURLINFO_TEXT = 0, CURLINFO_HEADER_IN, /* 1 */ CURLINFO_HEADER_OUT, /* 2 */ CURLINFO_DATA_IN, /* 3 */ CURLINFO_DATA_OUT, /* 4 */ CURLINFO_SSL_DATA_IN, /* 5 */ CURLINFO_SSL_DATA_OUT, /* 6 */ CURLINFO_END } curl_infotype; typedef int (*curl_debug_callback) (CURL *handle, /* the handle/transfer this concerns */ curl_infotype type, /* what kind of data */ char *data, /* points to the data */ size_t size, /* size of the data pointed to */ void *userptr); /* whatever the user please */ /* All possible error codes from all sorts of curl functions. Future versions may return other values, stay prepared. Always add new return codes last. Never *EVER* remove any. The return codes must remain the same! */ typedef enum { CURLE_OK = 0, CURLE_UNSUPPORTED_PROTOCOL, /* 1 */ CURLE_FAILED_INIT, /* 2 */ CURLE_URL_MALFORMAT, /* 3 */ CURLE_NOT_BUILT_IN, /* 4 - [was obsoleted in August 2007 for 7.17.0, reused in April 2011 for 7.21.5] */ CURLE_COULDNT_RESOLVE_PROXY, /* 5 */ CURLE_COULDNT_RESOLVE_HOST, /* 6 */ CURLE_COULDNT_CONNECT, /* 7 */ CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */ CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server due to lack of access - when login fails this is not returned. */ CURLE_FTP_ACCEPT_FAILED, /* 10 - [was obsoleted in April 2006 for 7.15.4, reused in Dec 2011 for 7.24.0]*/ CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */ CURLE_FTP_ACCEPT_TIMEOUT, /* 12 - timeout occurred accepting server [was obsoleted in August 2007 for 7.17.0, reused in Dec 2011 for 7.24.0]*/ CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */ CURLE_FTP_WEIRD_227_FORMAT, /* 14 */ CURLE_FTP_CANT_GET_HOST, /* 15 */ CURLE_OBSOLETE16, /* 16 - NOT USED */ CURLE_FTP_COULDNT_SET_TYPE, /* 17 */ CURLE_PARTIAL_FILE, /* 18 */ CURLE_FTP_COULDNT_RETR_FILE, /* 19 */ CURLE_OBSOLETE20, /* 20 - NOT USED */ CURLE_QUOTE_ERROR, /* 21 - quote command failure */ CURLE_HTTP_RETURNED_ERROR, /* 22 */ CURLE_WRITE_ERROR, /* 23 */ CURLE_OBSOLETE24, /* 24 - NOT USED */ CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */ CURLE_READ_ERROR, /* 26 - couldn't open/read from file */ CURLE_OUT_OF_MEMORY, /* 27 */ /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error instead of a memory allocation error if CURL_DOES_CONVERSIONS is defined */ CURLE_OPERATION_TIMEDOUT, /* 28 - the timeout time was reached */ CURLE_OBSOLETE29, /* 29 - NOT USED */ CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */ CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */ CURLE_OBSOLETE32, /* 32 - NOT USED */ CURLE_RANGE_ERROR, /* 33 - RANGE "command" didn't work */ CURLE_HTTP_POST_ERROR, /* 34 */ CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */ CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */ CURLE_FILE_COULDNT_READ_FILE, /* 37 */ CURLE_LDAP_CANNOT_BIND, /* 38 */ CURLE_LDAP_SEARCH_FAILED, /* 39 */ CURLE_OBSOLETE40, /* 40 - NOT USED */ CURLE_FUNCTION_NOT_FOUND, /* 41 */ CURLE_ABORTED_BY_CALLBACK, /* 42 */ CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */ CURLE_OBSOLETE44, /* 44 - NOT USED */ CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */ CURLE_OBSOLETE46, /* 46 - NOT USED */ CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */ CURLE_UNKNOWN_OPTION, /* 48 - User specified an unknown option */ CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */ CURLE_OBSOLETE50, /* 50 - NOT USED */ CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint wasn't verified fine */ CURLE_GOT_NOTHING, /* 52 - when this is a specific error */ CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */ CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as default */ CURLE_SEND_ERROR, /* 55 - failed sending network data */ CURLE_RECV_ERROR, /* 56 - failure in receiving network data */ CURLE_OBSOLETE57, /* 57 - NOT IN USE */ CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */ CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */ CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */ CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized/bad encoding */ CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */ CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */ CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */ CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind that failed */ CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */ CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not accepted and we failed to login */ CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */ CURLE_TFTP_PERM, /* 69 - permission problem on server */ CURLE_REMOTE_DISK_FULL, /* 70 - out of disk space on server */ CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */ CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */ CURLE_REMOTE_FILE_EXISTS, /* 73 - File already exists */ CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */ CURLE_CONV_FAILED, /* 75 - conversion failed */ CURLE_CONV_REQD, /* 76 - caller must register conversion callbacks using curl_easy_setopt options CURLOPT_CONV_FROM_NETWORK_FUNCTION, CURLOPT_CONV_TO_NETWORK_FUNCTION, and CURLOPT_CONV_FROM_UTF8_FUNCTION */ CURLE_SSL_CACERT_BADFILE, /* 77 - could not load CACERT file, missing or wrong format */ CURLE_REMOTE_FILE_NOT_FOUND, /* 78 - remote file not found */ CURLE_SSH, /* 79 - error from the SSH layer, somewhat generic so the error message will be of interest when this has happened */ CURLE_SSL_SHUTDOWN_FAILED, /* 80 - Failed to shut down the SSL connection */ CURLE_AGAIN, /* 81 - socket is not ready for send/recv, wait till it's ready and try again (Added in 7.18.2) */ CURLE_SSL_CRL_BADFILE, /* 82 - could not load CRL file, missing or wrong format (Added in 7.19.0) */ CURLE_SSL_ISSUER_ERROR, /* 83 - Issuer check failed. (Added in 7.19.0) */ CURLE_FTP_PRET_FAILED, /* 84 - a PRET command failed */ CURLE_RTSP_CSEQ_ERROR, /* 85 - mismatch of RTSP CSeq numbers */ CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Ids */ CURLE_FTP_BAD_FILE_LIST, /* 87 - unable to parse FTP file list */ CURLE_CHUNK_FAILED, /* 88 - chunk callback reported error */ CURL_LAST /* never use! */ } CURLcode; #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all the obsolete stuff removed! */ /* Previously obsoletes error codes re-used in 7.24.0 */ #define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED #define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT /* compatibility with older names */ #define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING /* The following were added in 7.21.5, April 2011 */ #define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION /* The following were added in 7.17.1 */ /* These are scheduled to disappear by 2009 */ #define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION /* The following were added in 7.17.0 */ /* These are scheduled to disappear by 2009 */ #define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */ #define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46 #define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44 #define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10 #define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16 #define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32 #define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29 #define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12 #define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20 #define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40 #define CURLE_MALFORMAT_USER CURLE_OBSOLETE24 #define CURLE_SHARE_IN_USE CURLE_OBSOLETE57 #define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN #define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED #define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE #define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR #define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL #define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS #define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR #define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED /* The following were added earlier */ #define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT #define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR #define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED #define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED #define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE #define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME /* This was the error code 50 in 7.7.3 and a few earlier versions, this is no longer used by libcurl but is instead #defined here only to not make programs break */ #define CURLE_ALREADY_COMPLETE 99999 #endif /*!CURL_NO_OLDIES*/ /* This prototype applies to all conversion callbacks */ typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length); typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */ void *ssl_ctx, /* actually an OpenSSL SSL_CTX */ void *userptr); typedef enum { CURLPROXY_HTTP = 0, /* added in 7.10, new in 7.19.4 default is to use CONNECT HTTP/1.1 */ CURLPROXY_HTTP_1_0 = 1, /* added in 7.19.4, force to use CONNECT HTTP/1.0 */ CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already in 7.10 */ CURLPROXY_SOCKS5 = 5, /* added in 7.10 */ CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */ CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the host name rather than the IP address. added in 7.18.0 */ } curl_proxytype; /* this enum was added in 7.10 */ /* * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options: * * CURLAUTH_NONE - No HTTP authentication * CURLAUTH_BASIC - HTTP Basic authentication (default) * CURLAUTH_DIGEST - HTTP Digest authentication * CURLAUTH_GSSNEGOTIATE - HTTP GSS-Negotiate authentication * CURLAUTH_NTLM - HTTP NTLM authentication * CURLAUTH_DIGEST_IE - HTTP Digest authentication with IE flavour * CURLAUTH_NTLM_WB - HTTP NTLM authentication delegated to winbind helper * CURLAUTH_ONLY - Use together with a single other type to force no * authentication or just that single type * CURLAUTH_ANY - All fine types set * CURLAUTH_ANYSAFE - All fine types except Basic */ #define CURLAUTH_NONE ((unsigned long)0) #define CURLAUTH_BASIC (((unsigned long)1)<<0) #define CURLAUTH_DIGEST (((unsigned long)1)<<1) #define CURLAUTH_GSSNEGOTIATE (((unsigned long)1)<<2) #define CURLAUTH_NTLM (((unsigned long)1)<<3) #define CURLAUTH_DIGEST_IE (((unsigned long)1)<<4) #define CURLAUTH_NTLM_WB (((unsigned long)1)<<5) #define CURLAUTH_ONLY (((unsigned long)1)<<31) #define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE) #define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE)) /* Used for CURLOPT_SOCKS5_AUTH to stay terminologically correct */ #define CURLAUTH_GSSAPI CURLAUTH_GSSNEGOTIATE #define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */ #define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */ #define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */ #define CURLSSH_AUTH_PASSWORD (1<<1) /* password */ #define CURLSSH_AUTH_HOST (1<<2) /* host key files */ #define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */ #define CURLSSH_AUTH_AGENT (1<<4) /* agent (ssh-agent, pageant...) */ #define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY #define CURLGSSAPI_DELEGATION_NONE 0 /* no delegation (default) */ #define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */ #define CURLGSSAPI_DELEGATION_FLAG (1<<1) /* delegate always */ #define CURL_ERROR_SIZE 256 struct curl_khkey { const char *key; /* points to a zero-terminated string encoded with base64 if len is zero, otherwise to the "raw" data */ size_t len; enum type { CURLKHTYPE_UNKNOWN, CURLKHTYPE_RSA1, CURLKHTYPE_RSA, CURLKHTYPE_DSS } keytype; }; /* this is the set of return values expected from the curl_sshkeycallback callback */ enum curl_khstat { CURLKHSTAT_FINE_ADD_TO_FILE, CURLKHSTAT_FINE, CURLKHSTAT_REJECT, /* reject the connection, return an error */ CURLKHSTAT_DEFER, /* do not accept it, but we can't answer right now so this causes a CURLE_DEFER error but otherwise the connection will be left intact etc */ CURLKHSTAT_LAST /* not for use, only a marker for last-in-list */ }; /* this is the set of status codes pass in to the callback */ enum curl_khmatch { CURLKHMATCH_OK, /* match */ CURLKHMATCH_MISMATCH, /* host found, key mismatch! */ CURLKHMATCH_MISSING, /* no matching host/key found */ CURLKHMATCH_LAST /* not for use, only a marker for last-in-list */ }; typedef int (*curl_sshkeycallback) (CURL *easy, /* easy handle */ const struct curl_khkey *knownkey, /* known */ const struct curl_khkey *foundkey, /* found */ enum curl_khmatch, /* libcurl's view on the keys */ void *clientp); /* custom pointer passed from app */ /* parameter for the CURLOPT_USE_SSL option */ typedef enum { CURLUSESSL_NONE, /* do not attempt to use SSL */ CURLUSESSL_TRY, /* try using SSL, proceed anyway otherwise */ CURLUSESSL_CONTROL, /* SSL for the control connection or fail */ CURLUSESSL_ALL, /* SSL for all communication or fail */ CURLUSESSL_LAST /* not an option, never use */ } curl_usessl; /* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */ /* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the name of improving interoperability with older servers. Some SSL libraries have introduced work-arounds for this flaw but those work-arounds sometimes make the SSL communication fail. To regain functionality with those broken servers, a user can this way allow the vulnerability back. */ #define CURLSSLOPT_ALLOW_BEAST (1<<0) #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all the obsolete stuff removed! */ /* Backwards compatibility with older names */ /* These are scheduled to disappear by 2009 */ #define CURLFTPSSL_NONE CURLUSESSL_NONE #define CURLFTPSSL_TRY CURLUSESSL_TRY #define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL #define CURLFTPSSL_ALL CURLUSESSL_ALL #define CURLFTPSSL_LAST CURLUSESSL_LAST #define curl_ftpssl curl_usessl #endif /*!CURL_NO_OLDIES*/ /* parameter for the CURLOPT_FTP_SSL_CCC option */ typedef enum { CURLFTPSSL_CCC_NONE, /* do not send CCC */ CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */ CURLFTPSSL_CCC_ACTIVE, /* Initiate the shutdown */ CURLFTPSSL_CCC_LAST /* not an option, never use */ } curl_ftpccc; /* parameter for the CURLOPT_FTPSSLAUTH option */ typedef enum { CURLFTPAUTH_DEFAULT, /* let libcurl decide */ CURLFTPAUTH_SSL, /* use "AUTH SSL" */ CURLFTPAUTH_TLS, /* use "AUTH TLS" */ CURLFTPAUTH_LAST /* not an option, never use */ } curl_ftpauth; /* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */ typedef enum { CURLFTP_CREATE_DIR_NONE, /* do NOT create missing dirs! */ CURLFTP_CREATE_DIR, /* (FTP/SFTP) if CWD fails, try MKD and then CWD again if MKD succeeded, for SFTP this does similar magic */ CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD again even if MKD failed! */ CURLFTP_CREATE_DIR_LAST /* not an option, never use */ } curl_ftpcreatedir; /* parameter for the CURLOPT_FTP_FILEMETHOD option */ typedef enum { CURLFTPMETHOD_DEFAULT, /* let libcurl pick */ CURLFTPMETHOD_MULTICWD, /* single CWD operation for each path part */ CURLFTPMETHOD_NOCWD, /* no CWD at all */ CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */ CURLFTPMETHOD_LAST /* not an option, never use */ } curl_ftpmethod; /* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */ #define CURLPROTO_HTTP (1<<0) #define CURLPROTO_HTTPS (1<<1) #define CURLPROTO_FTP (1<<2) #define CURLPROTO_FTPS (1<<3) #define CURLPROTO_SCP (1<<4) #define CURLPROTO_SFTP (1<<5) #define CURLPROTO_TELNET (1<<6) #define CURLPROTO_LDAP (1<<7) #define CURLPROTO_LDAPS (1<<8) #define CURLPROTO_DICT (1<<9) #define CURLPROTO_FILE (1<<10) #define CURLPROTO_TFTP (1<<11) #define CURLPROTO_IMAP (1<<12) #define CURLPROTO_IMAPS (1<<13) #define CURLPROTO_POP3 (1<<14) #define CURLPROTO_POP3S (1<<15) #define CURLPROTO_SMTP (1<<16) #define CURLPROTO_SMTPS (1<<17) #define CURLPROTO_RTSP (1<<18) #define CURLPROTO_RTMP (1<<19) #define CURLPROTO_RTMPT (1<<20) #define CURLPROTO_RTMPE (1<<21) #define CURLPROTO_RTMPTE (1<<22) #define CURLPROTO_RTMPS (1<<23) #define CURLPROTO_RTMPTS (1<<24) #define CURLPROTO_GOPHER (1<<25) #define CURLPROTO_ALL (~0) /* enable everything */ /* long may be 32 or 64 bits, but we should never depend on anything else but 32 */ #define CURLOPTTYPE_LONG 0 #define CURLOPTTYPE_OBJECTPOINT 10000 #define CURLOPTTYPE_FUNCTIONPOINT 20000 #define CURLOPTTYPE_OFF_T 30000 /* name is uppercase CURLOPT_, type is one of the defined CURLOPTTYPE_ number is unique identifier */ #ifdef CINIT #undef CINIT #endif #ifdef CURL_ISOCPP #define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu #else /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ #define LONG CURLOPTTYPE_LONG #define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT #define OFF_T CURLOPTTYPE_OFF_T #define CINIT(name,type,number) CURLOPT_/**/name = type + number #endif /* * This macro-mania below setups the CURLOPT_[what] enum, to be used with * curl_easy_setopt(). The first argument in the CINIT() macro is the [what] * word. */ typedef enum { /* This is the FILE * or void * the regular output should be written to. */ CINIT(FILE, OBJECTPOINT, 1), /* The full URL to get/put */ CINIT(URL, OBJECTPOINT, 2), /* Port number to connect to, if other than default. */ CINIT(PORT, LONG, 3), /* Name of proxy to use. */ CINIT(PROXY, OBJECTPOINT, 4), /* "name:password" to use when fetching. */ CINIT(USERPWD, OBJECTPOINT, 5), /* "name:password" to use with proxy. */ CINIT(PROXYUSERPWD, OBJECTPOINT, 6), /* Range to get, specified as an ASCII string. */ CINIT(RANGE, OBJECTPOINT, 7), /* not used */ /* Specified file stream to upload from (use as input): */ CINIT(INFILE, OBJECTPOINT, 9), /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE * bytes big. If this is not used, error messages go to stderr instead: */ CINIT(ERRORBUFFER, OBJECTPOINT, 10), /* Function that will be called to store the output (instead of fwrite). The * parameters will use fwrite() syntax, make sure to follow them. */ CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11), /* Function that will be called to read the input (instead of fread). The * parameters will use fread() syntax, make sure to follow them. */ CINIT(READFUNCTION, FUNCTIONPOINT, 12), /* Time-out the read operation after this amount of seconds */ CINIT(TIMEOUT, LONG, 13), /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about * how large the file being sent really is. That allows better error * checking and better verifies that the upload was successful. -1 means * unknown size. * * For large file support, there is also a _LARGE version of the key * which takes an off_t type, allowing platforms with larger off_t * sizes to handle larger files. See below for INFILESIZE_LARGE. */ CINIT(INFILESIZE, LONG, 14), /* POST static input fields. */ CINIT(POSTFIELDS, OBJECTPOINT, 15), /* Set the referrer page (needed by some CGIs) */ CINIT(REFERER, OBJECTPOINT, 16), /* Set the FTP PORT string (interface name, named or numerical IP address) Use i.e '-' to use default address. */ CINIT(FTPPORT, OBJECTPOINT, 17), /* Set the User-Agent string (examined by some CGIs) */ CINIT(USERAGENT, OBJECTPOINT, 18), /* If the download receives less than "low speed limit" bytes/second * during "low speed time" seconds, the operations is aborted. * You could i.e if you have a pretty high speed connection, abort if * it is less than 2000 bytes/sec during 20 seconds. */ /* Set the "low speed limit" */ CINIT(LOW_SPEED_LIMIT, LONG, 19), /* Set the "low speed time" */ CINIT(LOW_SPEED_TIME, LONG, 20), /* Set the continuation offset. * * Note there is also a _LARGE version of this key which uses * off_t types, allowing for large file offsets on platforms which * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE. */ CINIT(RESUME_FROM, LONG, 21), /* Set cookie in request: */ CINIT(COOKIE, OBJECTPOINT, 22), /* This points to a linked list of headers, struct curl_slist kind */ CINIT(HTTPHEADER, OBJECTPOINT, 23), /* This points to a linked list of post entries, struct curl_httppost */ CINIT(HTTPPOST, OBJECTPOINT, 24), /* name of the file keeping your private SSL-certificate */ CINIT(SSLCERT, OBJECTPOINT, 25), /* password for the SSL or SSH private key */ CINIT(KEYPASSWD, OBJECTPOINT, 26), /* send TYPE parameter? */ CINIT(CRLF, LONG, 27), /* send linked-list of QUOTE commands */ CINIT(QUOTE, OBJECTPOINT, 28), /* send FILE * or void * to store headers to, if you use a callback it is simply passed to the callback unmodified */ CINIT(WRITEHEADER, OBJECTPOINT, 29), /* point to a file to read the initial cookies from, also enables "cookie awareness" */ CINIT(COOKIEFILE, OBJECTPOINT, 31), /* What version to specifically try to use. See CURL_SSLVERSION defines below. */ CINIT(SSLVERSION, LONG, 32), /* What kind of HTTP time condition to use, see defines */ CINIT(TIMECONDITION, LONG, 33), /* Time to use with the above condition. Specified in number of seconds since 1 Jan 1970 */ CINIT(TIMEVALUE, LONG, 34), /* 35 = OBSOLETE */ /* Custom request, for customizing the get command like HTTP: DELETE, TRACE and others FTP: to use a different list command */ CINIT(CUSTOMREQUEST, OBJECTPOINT, 36), /* HTTP request, for odd commands like DELETE, TRACE and others */ CINIT(STDERR, OBJECTPOINT, 37), /* 38 is not used */ /* send linked-list of post-transfer QUOTE commands */ CINIT(POSTQUOTE, OBJECTPOINT, 39), CINIT(WRITEINFO, OBJECTPOINT, 40), /* DEPRECATED, do not use! */ CINIT(VERBOSE, LONG, 41), /* talk a lot */ CINIT(HEADER, LONG, 42), /* throw the header out too */ CINIT(NOPROGRESS, LONG, 43), /* shut off the progress meter */ CINIT(NOBODY, LONG, 44), /* use HEAD to get http document */ CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 300 */ CINIT(UPLOAD, LONG, 46), /* this is an upload */ CINIT(POST, LONG, 47), /* HTTP POST method */ CINIT(DIRLISTONLY, LONG, 48), /* bare names when listing directories */ CINIT(APPEND, LONG, 50), /* Append instead of overwrite on upload! */ /* Specify whether to read the user+password from the .netrc or the URL. * This must be one of the CURL_NETRC_* enums below. */ CINIT(NETRC, LONG, 51), CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */ CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */ CINIT(PUT, LONG, 54), /* HTTP PUT */ /* 55 = OBSOLETE */ /* Function that will be called instead of the internal progress display * function. This function should be defined as the curl_progress_callback * prototype defines. */ CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56), /* Data passed to the progress callback */ CINIT(PROGRESSDATA, OBJECTPOINT, 57), /* We want the referrer field set automatically when following locations */ CINIT(AUTOREFERER, LONG, 58), /* Port of the proxy, can be set in the proxy string as well with: "[host]:[port]" */ CINIT(PROXYPORT, LONG, 59), /* size of the POST input data, if strlen() is not good to use */ CINIT(POSTFIELDSIZE, LONG, 60), /* tunnel non-http operations through a HTTP proxy */ CINIT(HTTPPROXYTUNNEL, LONG, 61), /* Set the interface string to use as outgoing network interface */ CINIT(INTERFACE, OBJECTPOINT, 62), /* Set the krb4/5 security level, this also enables krb4/5 awareness. This * is a string, 'clear', 'safe', 'confidential' or 'private'. If the string * is set but doesn't match one of these, 'private' will be used. */ CINIT(KRBLEVEL, OBJECTPOINT, 63), /* Set if we should verify the peer in ssl handshake, set 1 to verify. */ CINIT(SSL_VERIFYPEER, LONG, 64), /* The CApath or CAfile used to validate the peer certificate this option is used only if SSL_VERIFYPEER is true */ CINIT(CAINFO, OBJECTPOINT, 65), /* 66 = OBSOLETE */ /* 67 = OBSOLETE */ /* Maximum number of http redirects to follow */ CINIT(MAXREDIRS, LONG, 68), /* Pass a long set to 1 to get the date of the requested document (if possible)! Pass a zero to shut it off. */ CINIT(FILETIME, LONG, 69), /* This points to a linked list of telnet options */ CINIT(TELNETOPTIONS, OBJECTPOINT, 70), /* Max amount of cached alive connections */ CINIT(MAXCONNECTS, LONG, 71), CINIT(CLOSEPOLICY, LONG, 72), /* DEPRECATED, do not use! */ /* 73 = OBSOLETE */ /* Set to explicitly use a new connection for the upcoming transfer. Do not use this unless you're absolutely sure of this, as it makes the operation slower and is less friendly for the network. */ CINIT(FRESH_CONNECT, LONG, 74), /* Set to explicitly forbid the upcoming transfer's connection to be re-used when done. Do not use this unless you're absolutely sure of this, as it makes the operation slower and is less friendly for the network. */ CINIT(FORBID_REUSE, LONG, 75), /* Set to a file name that contains random data for libcurl to use to seed the random engine when doing SSL connects. */ CINIT(RANDOM_FILE, OBJECTPOINT, 76), /* Set to the Entropy Gathering Daemon socket pathname */ CINIT(EGDSOCKET, OBJECTPOINT, 77), /* Time-out connect operations after this amount of seconds, if connects are OK within this time, then fine... This only aborts the connect phase. */ CINIT(CONNECTTIMEOUT, LONG, 78), /* Function that will be called to store headers (instead of fwrite). The * parameters will use fwrite() syntax, make sure to follow them. */ CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79), /* Set this to force the HTTP request to get back to GET. Only really usable if POST, PUT or a custom request have been used first. */ CINIT(HTTPGET, LONG, 80), /* Set if we should verify the Common name from the peer certificate in ssl * handshake, set 1 to check existence, 2 to ensure that it matches the * provided hostname. */ CINIT(SSL_VERIFYHOST, LONG, 81), /* Specify which file name to write all known cookies in after completed operation. Set file name to "-" (dash) to make it go to stdout. */ CINIT(COOKIEJAR, OBJECTPOINT, 82), /* Specify which SSL ciphers to use */ CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83), /* Specify which HTTP version to use! This must be set to one of the CURL_HTTP_VERSION* enums set below. */ CINIT(HTTP_VERSION, LONG, 84), /* Specifically switch on or off the FTP engine's use of the EPSV command. By default, that one will always be attempted before the more traditional PASV command. */ CINIT(FTP_USE_EPSV, LONG, 85), /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */ CINIT(SSLCERTTYPE, OBJECTPOINT, 86), /* name of the file keeping your private SSL-key */ CINIT(SSLKEY, OBJECTPOINT, 87), /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */ CINIT(SSLKEYTYPE, OBJECTPOINT, 88), /* crypto engine for the SSL-sub system */ CINIT(SSLENGINE, OBJECTPOINT, 89), /* set the crypto engine for the SSL-sub system as default the param has no meaning... */ CINIT(SSLENGINE_DEFAULT, LONG, 90), /* Non-zero value means to use the global dns cache */ CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */ /* DNS cache timeout */ CINIT(DNS_CACHE_TIMEOUT, LONG, 92), /* send linked-list of pre-transfer QUOTE commands */ CINIT(PREQUOTE, OBJECTPOINT, 93), /* set the debug function */ CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94), /* set the data for the debug function */ CINIT(DEBUGDATA, OBJECTPOINT, 95), /* mark this as start of a cookie session */ CINIT(COOKIESESSION, LONG, 96), /* The CApath directory used to validate the peer certificate this option is used only if SSL_VERIFYPEER is true */ CINIT(CAPATH, OBJECTPOINT, 97), /* Instruct libcurl to use a smaller receive buffer */ CINIT(BUFFERSIZE, LONG, 98), /* Instruct libcurl to not use any signal/alarm handlers, even when using timeouts. This option is useful for multi-threaded applications. See libcurl-the-guide for more background information. */ CINIT(NOSIGNAL, LONG, 99), /* Provide a CURLShare for mutexing non-ts data */ CINIT(SHARE, OBJECTPOINT, 100), /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default), CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */ CINIT(PROXYTYPE, LONG, 101), /* Set the Accept-Encoding string. Use this to tell a server you would like the response to be compressed. Before 7.21.6, this was known as CURLOPT_ENCODING */ CINIT(ACCEPT_ENCODING, OBJECTPOINT, 102), /* Set pointer to private data */ CINIT(PRIVATE, OBJECTPOINT, 103), /* Set aliases for HTTP 200 in the HTTP Response header */ CINIT(HTTP200ALIASES, OBJECTPOINT, 104), /* Continue to send authentication (user+password) when following locations, even when hostname changed. This can potentially send off the name and password to whatever host the server decides. */ CINIT(UNRESTRICTED_AUTH, LONG, 105), /* Specifically switch on or off the FTP engine's use of the EPRT command ( it also disables the LPRT attempt). By default, those ones will always be attempted before the good old traditional PORT command. */ CINIT(FTP_USE_EPRT, LONG, 106), /* Set this to a bitmask value to enable the particular authentications methods you like. Use this in combination with CURLOPT_USERPWD. Note that setting multiple bits may cause extra network round-trips. */ CINIT(HTTPAUTH, LONG, 107), /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx in second argument. The function must be matching the curl_ssl_ctx_callback proto. */ CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108), /* Set the userdata for the ssl context callback function's third argument */ CINIT(SSL_CTX_DATA, OBJECTPOINT, 109), /* FTP Option that causes missing dirs to be created on the remote server. In 7.19.4 we introduced the convenience enums for this option using the CURLFTP_CREATE_DIR prefix. */ CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110), /* Set this to a bitmask value to enable the particular authentications methods you like. Use this in combination with CURLOPT_PROXYUSERPWD. Note that setting multiple bits may cause extra network round-trips. */ CINIT(PROXYAUTH, LONG, 111), /* FTP option that changes the timeout, in seconds, associated with getting a response. This is different from transfer timeout time and essentially places a demand on the FTP server to acknowledge commands in a timely manner. */ CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112), #define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to tell libcurl to resolve names to those IP versions only. This only has affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */ CINIT(IPRESOLVE, LONG, 113), /* Set this option to limit the size of a file that will be downloaded from an HTTP or FTP server. Note there is also _LARGE version which adds large file support for platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */ CINIT(MAXFILESIZE, LONG, 114), /* See the comment for INFILESIZE above, but in short, specifies * the size of the file being uploaded. -1 means unknown. */ CINIT(INFILESIZE_LARGE, OFF_T, 115), /* Sets the continuation offset. There is also a LONG version of this; * look above for RESUME_FROM. */ CINIT(RESUME_FROM_LARGE, OFF_T, 116), /* Sets the maximum size of data that will be downloaded from * an HTTP or FTP server. See MAXFILESIZE above for the LONG version. */ CINIT(MAXFILESIZE_LARGE, OFF_T, 117), /* Set this option to the file name of your .netrc file you want libcurl to parse (using the CURLOPT_NETRC option). If not set, libcurl will do a poor attempt to find the user's home directory and check for a .netrc file in there. */ CINIT(NETRC_FILE, OBJECTPOINT, 118), /* Enable SSL/TLS for FTP, pick one of: CURLUSESSL_TRY - try using SSL, proceed anyway otherwise CURLUSESSL_CONTROL - SSL for the control connection or fail CURLUSESSL_ALL - SSL for all communication or fail */ CINIT(USE_SSL, LONG, 119), /* The _LARGE version of the standard POSTFIELDSIZE option */ CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120), /* Enable/disable the TCP Nagle algorithm */ CINIT(TCP_NODELAY, LONG, 121), /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ /* 123 OBSOLETE. Gone in 7.16.0 */ /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ /* 127 OBSOLETE. Gone in 7.16.0 */ /* 128 OBSOLETE. Gone in 7.16.0 */ /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option can be used to change libcurl's default action which is to first try "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK response has been received. Available parameters are: CURLFTPAUTH_DEFAULT - let libcurl decide CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL */ CINIT(FTPSSLAUTH, LONG, 129), CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130), CINIT(IOCTLDATA, OBJECTPOINT, 131), /* 132 OBSOLETE. Gone in 7.16.0 */ /* 133 OBSOLETE. Gone in 7.16.0 */ /* zero terminated string for pass on to the FTP server when asked for "account" info */ CINIT(FTP_ACCOUNT, OBJECTPOINT, 134), /* feed cookies into cookie engine */ CINIT(COOKIELIST, OBJECTPOINT, 135), /* ignore Content-Length */ CINIT(IGNORE_CONTENT_LENGTH, LONG, 136), /* Set to non-zero to skip the IP address received in a 227 PASV FTP server response. Typically used for FTP-SSL purposes but is not restricted to that. libcurl will then instead use the same IP address it used for the control connection. */ CINIT(FTP_SKIP_PASV_IP, LONG, 137), /* Select "file method" to use when doing FTP, see the curl_ftpmethod above. */ CINIT(FTP_FILEMETHOD, LONG, 138), /* Local port number to bind the socket to */ CINIT(LOCALPORT, LONG, 139), /* Number of ports to try, including the first one set with LOCALPORT. Thus, setting it to 1 will make no additional attempts but the first. */ CINIT(LOCALPORTRANGE, LONG, 140), /* no transfer, set up connection and let application use the socket by extracting it with CURLINFO_LASTSOCKET */ CINIT(CONNECT_ONLY, LONG, 141), /* Function that will be called to convert from the network encoding (instead of using the iconv calls in libcurl) */ CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142), /* Function that will be called to convert to the network encoding (instead of using the iconv calls in libcurl) */ CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143), /* Function that will be called to convert from UTF8 (instead of using the iconv calls in libcurl) Note that this is used only for SSL certificate processing */ CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144), /* if the connection proceeds too quickly then need to slow it down */ /* limit-rate: maximum number of bytes per second to send or receive */ CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145), CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146), /* Pointer to command string to send if USER/PASS fails. */ CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147), /* callback function for setting socket options */ CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148), CINIT(SOCKOPTDATA, OBJECTPOINT, 149), /* set to 0 to disable session ID re-use for this transfer, default is enabled (== 1) */ CINIT(SSL_SESSIONID_CACHE, LONG, 150), /* allowed SSH authentication methods */ CINIT(SSH_AUTH_TYPES, LONG, 151), /* Used by scp/sftp to do public/private key authentication */ CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152), CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153), /* Send CCC (Clear Command Channel) after authentication */ CINIT(FTP_SSL_CCC, LONG, 154), /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */ CINIT(TIMEOUT_MS, LONG, 155), CINIT(CONNECTTIMEOUT_MS, LONG, 156), /* set to zero to disable the libcurl's decoding and thus pass the raw body data to the application even when it is encoded/compressed */ CINIT(HTTP_TRANSFER_DECODING, LONG, 157), CINIT(HTTP_CONTENT_DECODING, LONG, 158), /* Permission used when creating new files and directories on the remote server for protocols that support it, SFTP/SCP/FILE */ CINIT(NEW_FILE_PERMS, LONG, 159), CINIT(NEW_DIRECTORY_PERMS, LONG, 160), /* Set the behaviour of POST when redirecting. Values must be set to one of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */ CINIT(POSTREDIR, LONG, 161), /* used by scp/sftp to verify the host's public key */ CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162), /* Callback function for opening socket (instead of socket(2)). Optionally, callback is able change the address or refuse to connect returning CURL_SOCKET_BAD. The callback should have type curl_opensocket_callback */ CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163), CINIT(OPENSOCKETDATA, OBJECTPOINT, 164), /* POST volatile input fields. */ CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165), /* set transfer mode (;type=) when doing FTP via an HTTP proxy */ CINIT(PROXY_TRANSFER_MODE, LONG, 166), /* Callback function for seeking in the input stream */ CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167), CINIT(SEEKDATA, OBJECTPOINT, 168), /* CRL file */ CINIT(CRLFILE, OBJECTPOINT, 169), /* Issuer certificate */ CINIT(ISSUERCERT, OBJECTPOINT, 170), /* (IPv6) Address scope */ CINIT(ADDRESS_SCOPE, LONG, 171), /* Collect certificate chain info and allow it to get retrievable with CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only working with OpenSSL-powered builds. */ CINIT(CERTINFO, LONG, 172), /* "name" and "pwd" to use when fetching. */ CINIT(USERNAME, OBJECTPOINT, 173), CINIT(PASSWORD, OBJECTPOINT, 174), /* "name" and "pwd" to use with Proxy when fetching. */ CINIT(PROXYUSERNAME, OBJECTPOINT, 175), CINIT(PROXYPASSWORD, OBJECTPOINT, 176), /* Comma separated list of hostnames defining no-proxy zones. These should match both hostnames directly, and hostnames within a domain. For example, local.com will match local.com and www.local.com, but NOT notlocal.com or www.notlocal.com. For compatibility with other implementations of this, .local.com will be considered to be the same as local.com. A single * is the only valid wildcard, and effectively disables the use of proxy. */ CINIT(NOPROXY, OBJECTPOINT, 177), /* block size for TFTP transfers */ CINIT(TFTP_BLKSIZE, LONG, 178), /* Socks Service */ CINIT(SOCKS5_GSSAPI_SERVICE, OBJECTPOINT, 179), /* Socks Service */ CINIT(SOCKS5_GSSAPI_NEC, LONG, 180), /* set the bitmask for the protocols that are allowed to be used for the transfer, which thus helps the app which takes URLs from users or other external inputs and want to restrict what protocol(s) to deal with. Defaults to CURLPROTO_ALL. */ CINIT(PROTOCOLS, LONG, 181), /* set the bitmask for the protocols that libcurl is allowed to follow to, as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs to be set in both bitmasks to be allowed to get redirected to. Defaults to all protocols except FILE and SCP. */ CINIT(REDIR_PROTOCOLS, LONG, 182), /* set the SSH knownhost file name to use */ CINIT(SSH_KNOWNHOSTS, OBJECTPOINT, 183), /* set the SSH host key callback, must point to a curl_sshkeycallback function */ CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184), /* set the SSH host key callback custom pointer */ CINIT(SSH_KEYDATA, OBJECTPOINT, 185), /* set the SMTP mail originator */ CINIT(MAIL_FROM, OBJECTPOINT, 186), /* set the SMTP mail receiver(s) */ CINIT(MAIL_RCPT, OBJECTPOINT, 187), /* FTP: send PRET before PASV */ CINIT(FTP_USE_PRET, LONG, 188), /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */ CINIT(RTSP_REQUEST, LONG, 189), /* The RTSP session identifier */ CINIT(RTSP_SESSION_ID, OBJECTPOINT, 190), /* The RTSP stream URI */ CINIT(RTSP_STREAM_URI, OBJECTPOINT, 191), /* The Transport: header to use in RTSP requests */ CINIT(RTSP_TRANSPORT, OBJECTPOINT, 192), /* Manually initialize the client RTSP CSeq for this handle */ CINIT(RTSP_CLIENT_CSEQ, LONG, 193), /* Manually initialize the server RTSP CSeq for this handle */ CINIT(RTSP_SERVER_CSEQ, LONG, 194), /* The stream to pass to INTERLEAVEFUNCTION. */ CINIT(INTERLEAVEDATA, OBJECTPOINT, 195), /* Let the application define a custom write method for RTP data */ CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196), /* Turn on wildcard matching */ CINIT(WILDCARDMATCH, LONG, 197), /* Directory matching callback called before downloading of an individual file (chunk) started */ CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198), /* Directory matching callback called after the file (chunk) was downloaded, or skipped */ CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199), /* Change match (fnmatch-like) callback for wildcard matching */ CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200), /* Let the application define custom chunk data pointer */ CINIT(CHUNK_DATA, OBJECTPOINT, 201), /* FNMATCH_FUNCTION user pointer */ CINIT(FNMATCH_DATA, OBJECTPOINT, 202), /* send linked-list of name:port:address sets */ CINIT(RESOLVE, OBJECTPOINT, 203), /* Set a username for authenticated TLS */ CINIT(TLSAUTH_USERNAME, OBJECTPOINT, 204), /* Set a password for authenticated TLS */ CINIT(TLSAUTH_PASSWORD, OBJECTPOINT, 205), /* Set authentication type for authenticated TLS */ CINIT(TLSAUTH_TYPE, OBJECTPOINT, 206), /* Set to 1 to enable the "TE:" header in HTTP requests to ask for compressed transfer-encoded responses. Set to 0 to disable the use of TE: in outgoing requests. The current default is 0, but it might change in a future libcurl release. libcurl will ask for the compressed methods it knows of, and if that isn't any, it will not ask for transfer-encoding at all even if this option is set to 1. */ CINIT(TRANSFER_ENCODING, LONG, 207), /* Callback function for closing socket (instead of close(2)). The callback should have type curl_closesocket_callback */ CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208), CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209), /* allow GSSAPI credential delegation */ CINIT(GSSAPI_DELEGATION, LONG, 210), /* Set the name servers to use for DNS resolution */ CINIT(DNS_SERVERS, OBJECTPOINT, 211), /* Time-out accept operations (currently for FTP only) after this amount of miliseconds. */ CINIT(ACCEPTTIMEOUT_MS, LONG, 212), /* Set TCP keepalive */ CINIT(TCP_KEEPALIVE, LONG, 213), /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */ CINIT(TCP_KEEPIDLE, LONG, 214), CINIT(TCP_KEEPINTVL, LONG, 215), /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */ CINIT(SSL_OPTIONS, LONG, 216), /* set the SMTP auth originator */ CINIT(MAIL_AUTH, OBJECTPOINT, 217), /* Path to UNIX domain socket */ CINIT(UNIX_SOCKET_PATH, OBJECTPOINT, 231), /* bitmask of allowed auth methods for connections to SOCKS5 proxies */ CINIT(SOCKS5_AUTH, LONG, 267), CURLOPT_LASTENTRY /* the last unused */ } CURLoption; #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all the obsolete stuff removed! */ /* Backwards compatibility with older names */ /* These are scheduled to disappear by 2011 */ /* This was added in version 7.19.1 */ #define CURLOPT_POST301 CURLOPT_POSTREDIR /* These are scheduled to disappear by 2009 */ /* The following were added in 7.17.0 */ #define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD #define CURLOPT_FTPAPPEND CURLOPT_APPEND #define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY #define CURLOPT_FTP_SSL CURLOPT_USE_SSL /* The following were added earlier */ #define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD #define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL #else /* This is set if CURL_NO_OLDIES is defined at compile-time */ #undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */ #endif /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host name resolves addresses using more than one IP protocol version, this option might be handy to force libcurl to use a specific IP version. */ #define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP versions that your system allows */ #define CURL_IPRESOLVE_V4 1 /* resolve to ipv4 addresses */ #define CURL_IPRESOLVE_V6 2 /* resolve to ipv6 addresses */ /* three convenient "aliases" that follow the name scheme better */ #define CURLOPT_WRITEDATA CURLOPT_FILE #define CURLOPT_READDATA CURLOPT_INFILE #define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER #define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER /* These enums are for use with the CURLOPT_HTTP_VERSION option. */ enum { CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd like the library to choose the best possible for us! */ CURL_HTTP_VERSION_1_0, /* please use HTTP 1.0 in the request */ CURL_HTTP_VERSION_1_1, /* please use HTTP 1.1 in the request */ CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */ }; /* * Public API enums for RTSP requests */ enum { CURL_RTSPREQ_NONE, /* first in list */ CURL_RTSPREQ_OPTIONS, CURL_RTSPREQ_DESCRIBE, CURL_RTSPREQ_ANNOUNCE, CURL_RTSPREQ_SETUP, CURL_RTSPREQ_PLAY, CURL_RTSPREQ_PAUSE, CURL_RTSPREQ_TEARDOWN, CURL_RTSPREQ_GET_PARAMETER, CURL_RTSPREQ_SET_PARAMETER, CURL_RTSPREQ_RECORD, CURL_RTSPREQ_RECEIVE, CURL_RTSPREQ_LAST /* last in list */ }; /* These enums are for use with the CURLOPT_NETRC option. */ enum CURL_NETRC_OPTION { CURL_NETRC_IGNORED, /* The .netrc will never be read. * This is the default. */ CURL_NETRC_OPTIONAL, /* A user:password in the URL will be preferred * to one in the .netrc. */ CURL_NETRC_REQUIRED, /* A user:password in the URL will be ignored. * Unless one is set programmatically, the .netrc * will be queried. */ CURL_NETRC_LAST }; enum { CURL_SSLVERSION_DEFAULT, CURL_SSLVERSION_TLSv1, /* TLS 1.x */ CURL_SSLVERSION_SSLv2, CURL_SSLVERSION_SSLv3, CURL_SSLVERSION_TLSv1_0, CURL_SSLVERSION_TLSv1_1, CURL_SSLVERSION_TLSv1_2, CURL_SSLVERSION_TLSv1_3, CURL_SSLVERSION_LAST /* never use, keep last */ }; enum { CURL_SSLVERSION_MAX_NONE = 0, CURL_SSLVERSION_MAX_DEFAULT = (CURL_SSLVERSION_TLSv1 << 16), CURL_SSLVERSION_MAX_TLSv1_0 = (CURL_SSLVERSION_TLSv1_0 << 16), CURL_SSLVERSION_MAX_TLSv1_1 = (CURL_SSLVERSION_TLSv1_1 << 16), CURL_SSLVERSION_MAX_TLSv1_2 = (CURL_SSLVERSION_TLSv1_2 << 16), CURL_SSLVERSION_MAX_TLSv1_3 = (CURL_SSLVERSION_TLSv1_3 << 16), /* never use, keep last */ CURL_SSLVERSION_MAX_LAST = (CURL_SSLVERSION_LAST << 16) }; enum CURL_TLSAUTH { CURL_TLSAUTH_NONE, CURL_TLSAUTH_SRP, CURL_TLSAUTH_LAST /* never use, keep last */ }; /* symbols to use with CURLOPT_POSTREDIR. CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303 can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302 | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */ #define CURL_REDIR_GET_ALL 0 #define CURL_REDIR_POST_301 1 #define CURL_REDIR_POST_302 2 #define CURL_REDIR_POST_303 4 #define CURL_REDIR_POST_ALL \ (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303) typedef enum { CURL_TIMECOND_NONE, CURL_TIMECOND_IFMODSINCE, CURL_TIMECOND_IFUNMODSINCE, CURL_TIMECOND_LASTMOD, CURL_TIMECOND_LAST } curl_TimeCond; /* curl_strequal() and curl_strnequal() are subject for removal in a future libcurl, see lib/README.curlx for details */ CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2); CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n); /* name is uppercase CURLFORM_ */ #ifdef CFINIT #undef CFINIT #endif #ifdef CURL_ISOCPP #define CFINIT(name) CURLFORM_ ## name #else /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ #define CFINIT(name) CURLFORM_/**/name #endif typedef enum { CFINIT(NOTHING), /********* the first one is unused ************/ /* */ CFINIT(COPYNAME), CFINIT(PTRNAME), CFINIT(NAMELENGTH), CFINIT(COPYCONTENTS), CFINIT(PTRCONTENTS), CFINIT(CONTENTSLENGTH), CFINIT(FILECONTENT), CFINIT(ARRAY), CFINIT(OBSOLETE), CFINIT(FILE), CFINIT(BUFFER), CFINIT(BUFFERPTR), CFINIT(BUFFERLENGTH), CFINIT(CONTENTTYPE), CFINIT(CONTENTHEADER), CFINIT(FILENAME), CFINIT(END), CFINIT(OBSOLETE2), CFINIT(STREAM), CURLFORM_LASTENTRY /* the last unused */ } CURLformoption; #undef CFINIT /* done */ /* structure to be used as parameter for CURLFORM_ARRAY */ struct curl_forms { CURLformoption option; const char *value; }; /* use this for multipart formpost building */ /* Returns code for curl_formadd() * * Returns: * CURL_FORMADD_OK on success * CURL_FORMADD_MEMORY if the FormInfo allocation fails * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form * CURL_FORMADD_NULL if a null pointer was given for a char * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error) * CURL_FORMADD_MEMORY if a curl_httppost struct cannot be allocated * CURL_FORMADD_MEMORY if some allocation for string copying failed. * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array * ***************************************************************************/ typedef enum { CURL_FORMADD_OK, /* first, no error */ CURL_FORMADD_MEMORY, CURL_FORMADD_OPTION_TWICE, CURL_FORMADD_NULL, CURL_FORMADD_UNKNOWN_OPTION, CURL_FORMADD_INCOMPLETE, CURL_FORMADD_ILLEGAL_ARRAY, CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */ CURL_FORMADD_LAST /* last */ } CURLFORMcode; /* * NAME curl_formadd() * * DESCRIPTION * * Pretty advanced function for building multi-part formposts. Each invoke * adds one part that together construct a full post. Then use * CURLOPT_HTTPPOST to send it off to libcurl. */ CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost, struct curl_httppost **last_post, ...); /* * callback function for curl_formget() * The void *arg pointer will be the one passed as second argument to * curl_formget(). * The character buffer passed to it must not be freed. * Should return the buffer length passed to it as the argument "len" on * success. */ typedef size_t (*curl_formget_callback)(void *arg, const char *buf, size_t len); /* * NAME curl_formget() * * DESCRIPTION * * Serialize a curl_httppost struct built with curl_formadd(). * Accepts a void pointer as second argument which will be passed to * the curl_formget_callback function. * Returns 0 on success. */ CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg, curl_formget_callback append); /* * NAME curl_formfree() * * DESCRIPTION * * Free a multipart formpost previously built with curl_formadd(). */ CURL_EXTERN void curl_formfree(struct curl_httppost *form); /* * NAME curl_getenv() * * DESCRIPTION * * Returns a malloc()'ed string that MUST be curl_free()ed after usage is * complete. DEPRECATED - see lib/README.curlx */ CURL_EXTERN char *curl_getenv(const char *variable); /* * NAME curl_version() * * DESCRIPTION * * Returns a static ascii string of the libcurl version. */ CURL_EXTERN char *curl_version(void); /* * NAME curl_easy_escape() * * DESCRIPTION * * Escapes URL strings (converts all letters consider illegal in URLs to their * %XX versions). This function returns a new allocated string or NULL if an * error occurred. */ CURL_EXTERN char *curl_easy_escape(CURL *handle, const char *string, int length); /* the previous version: */ CURL_EXTERN char *curl_escape(const char *string, int length); /* * NAME curl_easy_unescape() * * DESCRIPTION * * Unescapes URL encoding in strings (converts all %XX codes to their 8bit * versions). This function returns a new allocated string or NULL if an error * occurred. * Conversion Note: On non-ASCII platforms the ASCII %XX codes are * converted into the host encoding. */ CURL_EXTERN char *curl_easy_unescape(CURL *handle, const char *string, int length, int *outlength); /* the previous version */ CURL_EXTERN char *curl_unescape(const char *string, int length); /* * NAME curl_free() * * DESCRIPTION * * Provided for de-allocation in the same translation unit that did the * allocation. Added in libcurl 7.10 */ CURL_EXTERN void curl_free(void *p); /* * NAME curl_global_init() * * DESCRIPTION * * curl_global_init() should be invoked exactly once for each application that * uses libcurl and before any call of other libcurl functions. * * This function is not thread-safe! */ CURL_EXTERN CURLcode curl_global_init(long flags); /* * NAME curl_global_init_mem() * * DESCRIPTION * * curl_global_init() or curl_global_init_mem() should be invoked exactly once * for each application that uses libcurl. This function can be used to * initialize libcurl and set user defined memory management callback * functions. Users can implement memory management routines to check for * memory leaks, check for mis-use of the curl library etc. User registered * callback routines with be invoked by this library instead of the system * memory management routines like malloc, free etc. */ CURL_EXTERN CURLcode curl_global_init_mem(long flags, curl_malloc_callback m, curl_free_callback f, curl_realloc_callback r, curl_strdup_callback s, curl_calloc_callback c); /* * NAME curl_global_cleanup() * * DESCRIPTION * * curl_global_cleanup() should be invoked exactly once for each application * that uses libcurl */ CURL_EXTERN void curl_global_cleanup(void); /* linked-list structure for the CURLOPT_QUOTE option (and other) */ struct curl_slist { char *data; struct curl_slist *next; }; /* * NAME curl_slist_append() * * DESCRIPTION * * Appends a string to a linked list. If no list exists, it will be created * first. Returns the new list, after appending. */ CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *, const char *); /* * NAME curl_slist_free_all() * * DESCRIPTION * * free a previously built curl_slist. */ CURL_EXTERN void curl_slist_free_all(struct curl_slist *); /* * NAME curl_getdate() * * DESCRIPTION * * Returns the time, in seconds since 1 Jan 1970 of the time string given in * the first argument. The time argument in the second parameter is unused * and should be set to NULL. */ CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused); /* info about the certificate chain, only for OpenSSL builds. Asked for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */ struct curl_certinfo { int num_of_certs; /* number of certificates with information */ struct curl_slist **certinfo; /* for each index in this array, there's a linked list with textual information in the format "name: value" */ }; #define CURLINFO_STRING 0x100000 #define CURLINFO_LONG 0x200000 #define CURLINFO_DOUBLE 0x300000 #define CURLINFO_SLIST 0x400000 #define CURLINFO_MASK 0x0fffff #define CURLINFO_TYPEMASK 0xf00000 typedef enum { CURLINFO_NONE, /* first, never use this */ CURLINFO_EFFECTIVE_URL = CURLINFO_STRING + 1, CURLINFO_RESPONSE_CODE = CURLINFO_LONG + 2, CURLINFO_TOTAL_TIME = CURLINFO_DOUBLE + 3, CURLINFO_NAMELOOKUP_TIME = CURLINFO_DOUBLE + 4, CURLINFO_CONNECT_TIME = CURLINFO_DOUBLE + 5, CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6, CURLINFO_SIZE_UPLOAD = CURLINFO_DOUBLE + 7, CURLINFO_SIZE_DOWNLOAD = CURLINFO_DOUBLE + 8, CURLINFO_SPEED_DOWNLOAD = CURLINFO_DOUBLE + 9, CURLINFO_SPEED_UPLOAD = CURLINFO_DOUBLE + 10, CURLINFO_HEADER_SIZE = CURLINFO_LONG + 11, CURLINFO_REQUEST_SIZE = CURLINFO_LONG + 12, CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG + 13, CURLINFO_FILETIME = CURLINFO_LONG + 14, CURLINFO_CONTENT_LENGTH_DOWNLOAD = CURLINFO_DOUBLE + 15, CURLINFO_CONTENT_LENGTH_UPLOAD = CURLINFO_DOUBLE + 16, CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17, CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18, CURLINFO_REDIRECT_TIME = CURLINFO_DOUBLE + 19, CURLINFO_REDIRECT_COUNT = CURLINFO_LONG + 20, CURLINFO_PRIVATE = CURLINFO_STRING + 21, CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG + 22, CURLINFO_HTTPAUTH_AVAIL = CURLINFO_LONG + 23, CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24, CURLINFO_OS_ERRNO = CURLINFO_LONG + 25, CURLINFO_NUM_CONNECTS = CURLINFO_LONG + 26, CURLINFO_SSL_ENGINES = CURLINFO_SLIST + 27, CURLINFO_COOKIELIST = CURLINFO_SLIST + 28, CURLINFO_LASTSOCKET = CURLINFO_LONG + 29, CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30, CURLINFO_REDIRECT_URL = CURLINFO_STRING + 31, CURLINFO_PRIMARY_IP = CURLINFO_STRING + 32, CURLINFO_APPCONNECT_TIME = CURLINFO_DOUBLE + 33, CURLINFO_CERTINFO = CURLINFO_SLIST + 34, CURLINFO_CONDITION_UNMET = CURLINFO_LONG + 35, CURLINFO_RTSP_SESSION_ID = CURLINFO_STRING + 36, CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG + 37, CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG + 38, CURLINFO_RTSP_CSEQ_RECV = CURLINFO_LONG + 39, CURLINFO_PRIMARY_PORT = CURLINFO_LONG + 40, CURLINFO_LOCAL_IP = CURLINFO_STRING + 41, CURLINFO_LOCAL_PORT = CURLINFO_LONG + 42, /* Fill in new entries below here! */ CURLINFO_LASTONE = 42 } CURLINFO; /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as CURLINFO_HTTP_CODE */ #define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE typedef enum { CURLCLOSEPOLICY_NONE, /* first, never use this */ CURLCLOSEPOLICY_OLDEST, CURLCLOSEPOLICY_LEAST_RECENTLY_USED, CURLCLOSEPOLICY_LEAST_TRAFFIC, CURLCLOSEPOLICY_SLOWEST, CURLCLOSEPOLICY_CALLBACK, CURLCLOSEPOLICY_LAST /* last, never use this */ } curl_closepolicy; #define CURL_GLOBAL_SSL (1<<0) #define CURL_GLOBAL_WIN32 (1<<1) #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32) #define CURL_GLOBAL_NOTHING 0 #define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL #define CURL_GLOBAL_ACK_EINTR (1<<2) /***************************************************************************** * Setup defines, protos etc for the sharing stuff. */ /* Different data locks for a single share */ typedef enum { CURL_LOCK_DATA_NONE = 0, /* CURL_LOCK_DATA_SHARE is used internally to say that * the locking is just made to change the internal state of the share * itself. */ CURL_LOCK_DATA_SHARE, CURL_LOCK_DATA_COOKIE, CURL_LOCK_DATA_DNS, CURL_LOCK_DATA_SSL_SESSION, CURL_LOCK_DATA_CONNECT, CURL_LOCK_DATA_LAST } curl_lock_data; /* Different lock access types */ typedef enum { CURL_LOCK_ACCESS_NONE = 0, /* unspecified action */ CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */ CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */ CURL_LOCK_ACCESS_LAST /* never use */ } curl_lock_access; typedef void (*curl_lock_function)(CURL *handle, curl_lock_data data, curl_lock_access locktype, void *userptr); typedef void (*curl_unlock_function)(CURL *handle, curl_lock_data data, void *userptr); typedef void CURLSH; typedef enum { CURLSHE_OK, /* all is fine */ CURLSHE_BAD_OPTION, /* 1 */ CURLSHE_IN_USE, /* 2 */ CURLSHE_INVALID, /* 3 */ CURLSHE_NOMEM, /* 4 out of memory */ CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */ CURLSHE_LAST /* never use */ } CURLSHcode; typedef enum { CURLSHOPT_NONE, /* don't use */ CURLSHOPT_SHARE, /* specify a data type to share */ CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */ CURLSHOPT_LOCKFUNC, /* pass in a 'curl_lock_function' pointer */ CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */ CURLSHOPT_USERDATA, /* pass in a user data pointer used in the lock/unlock callback functions */ CURLSHOPT_LAST /* never use */ } CURLSHoption; CURL_EXTERN CURLSH *curl_share_init(void); CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...); CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *); /**************************************************************************** * Structures for querying information about the curl library at runtime. */ typedef enum { CURLVERSION_FIRST, CURLVERSION_SECOND, CURLVERSION_THIRD, CURLVERSION_FOURTH, CURLVERSION_LAST /* never actually use this */ } CURLversion; /* The 'CURLVERSION_NOW' is the symbolic name meant to be used by basically all programs ever that want to get version information. It is meant to be a built-in version number for what kind of struct the caller expects. If the struct ever changes, we redefine the NOW to another enum from above. */ #define CURLVERSION_NOW CURLVERSION_FOURTH typedef struct { CURLversion age; /* age of the returned struct */ const char *version; /* LIBCURL_VERSION */ unsigned int version_num; /* LIBCURL_VERSION_NUM */ const char *host; /* OS/host/cpu/machine when configured */ int features; /* bitmask, see defines below */ const char *ssl_version; /* human readable string */ long ssl_version_num; /* not used anymore, always 0 */ const char *libz_version; /* human readable string */ /* protocols is terminated by an entry with a NULL protoname */ const char * const *protocols; /* The fields below this were added in CURLVERSION_SECOND */ const char *ares; int ares_num; /* This field was added in CURLVERSION_THIRD */ const char *libidn; /* These field were added in CURLVERSION_FOURTH */ /* Same as '_libiconv_version' if built with HAVE_ICONV */ int iconv_ver_num; const char *libssh_version; /* human readable string */ } curl_version_info_data; #define CURL_VERSION_IPV6 (1<<0) /* IPv6-enabled */ #define CURL_VERSION_KERBEROS4 (1<<1) /* kerberos auth is supported */ #define CURL_VERSION_SSL (1<<2) /* SSL options are present */ #define CURL_VERSION_LIBZ (1<<3) /* libz features are present */ #define CURL_VERSION_NTLM (1<<4) /* NTLM auth is supported */ #define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */ #define CURL_VERSION_DEBUG (1<<6) /* built with debug capabilities */ #define CURL_VERSION_ASYNCHDNS (1<<7) /* asynchronous dns resolves */ #define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth */ #define CURL_VERSION_LARGEFILE (1<<9) /* supports files bigger than 2GB */ #define CURL_VERSION_IDN (1<<10) /* International Domain Names support */ #define CURL_VERSION_SSPI (1<<11) /* SSPI is supported */ #define CURL_VERSION_CONV (1<<12) /* character conversions supported */ #define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */ #define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */ #define CURL_VERSION_NTLM_WB (1<<15) /* NTLM delegating to winbind helper */ #define CURL_VERSION_UNIX_SOCKETS (1<<19) /* UNIX domain sockets support */ /* * NAME curl_version_info() * * DESCRIPTION * * This function returns a pointer to a static copy of the version info * struct. See above. */ CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion); /* * NAME curl_easy_strerror() * * DESCRIPTION * * The curl_easy_strerror function may be used to turn a CURLcode value * into the equivalent human readable error string. This is useful * for printing meaningful error messages. */ CURL_EXTERN const char *curl_easy_strerror(CURLcode); /* * NAME curl_share_strerror() * * DESCRIPTION * * The curl_share_strerror function may be used to turn a CURLSHcode value * into the equivalent human readable error string. This is useful * for printing meaningful error messages. */ CURL_EXTERN const char *curl_share_strerror(CURLSHcode); /* * NAME curl_easy_pause() * * DESCRIPTION * * The curl_easy_pause function pauses or unpauses transfers. Select the new * state by setting the bitmask, use the convenience defines below. * */ CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask); #define CURLPAUSE_RECV (1<<0) #define CURLPAUSE_RECV_CONT (0) #define CURLPAUSE_SEND (1<<2) #define CURLPAUSE_SEND_CONT (0) #define CURLPAUSE_ALL (CURLPAUSE_RECV|CURLPAUSE_SEND) #define CURLPAUSE_CONT (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT) #ifdef __cplusplus } #endif /* unfortunately, the easy.h and multi.h include files need options and info stuff before they can be included! */ #include "easy.h" /* nothing in curl is fun without the easy stuff */ #include "multi.h" /* the typechecker doesn't work in C++ (yet) */ #if defined(__GNUC__) && defined(__GNUC_MINOR__) && \ ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \ !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK) #include "typecheck-gcc.h" #else #if defined(__STDC__) && (__STDC__ >= 1) /* This preprocessor magic that replaces a call with the exact same call is only done to make sure application authors pass exactly three arguments to these functions. */ #define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param) #define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg) #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param) #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param) #endif /* __STDC__ >= 1 */ #endif /* gcc >= 4.3 && !__cplusplus */ #endif /* __CURL_CURL_H */ curl/mprintf.h000064400000005346147631660260007364 0ustar00#ifndef __CURL_MPRINTF_H #define __CURL_MPRINTF_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2006, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at http://curl.haxx.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ***************************************************************************/ #include #include /* needed for FILE */ #include "curl.h" #ifdef __cplusplus extern "C" { #endif CURL_EXTERN int curl_mprintf(const char *format, ...); CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...); CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...); CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...); CURL_EXTERN int curl_mvprintf(const char *format, va_list args); CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args); CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args); CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list args); CURL_EXTERN char *curl_maprintf(const char *format, ...); CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args); #ifdef _MPRINTF_REPLACE # undef printf # undef fprintf # undef sprintf # undef vsprintf # undef snprintf # undef vprintf # undef vfprintf # undef vsnprintf # undef aprintf # undef vaprintf # define printf curl_mprintf # define fprintf curl_mfprintf #ifdef CURLDEBUG /* When built with CURLDEBUG we define away the sprintf() functions since we don't want internal code to be using them */ # define sprintf sprintf_was_used # define vsprintf vsprintf_was_used #else # define sprintf curl_msprintf # define vsprintf curl_mvsprintf #endif # define snprintf curl_msnprintf # define vprintf curl_mvprintf # define vfprintf curl_mvfprintf # define vsnprintf curl_mvsnprintf # define aprintf curl_maprintf # define vaprintf curl_mvaprintf #endif #ifdef __cplusplus } #endif #endif /* __CURL_MPRINTF_H */ mcheck.h000064400000004627147631660260006173 0ustar00/* Copyright (C) 1996,1997,1998,1999,2000,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _MCHECK_H #define _MCHECK_H 1 #include __BEGIN_DECLS /* Return values for `mprobe': these are the kinds of inconsistencies that `mcheck' enables detection of. */ enum mcheck_status { MCHECK_DISABLED = -1, /* Consistency checking is not turned on. */ MCHECK_OK, /* Block is fine. */ MCHECK_FREE, /* Block freed twice. */ MCHECK_HEAD, /* Memory before the block was clobbered. */ MCHECK_TAIL /* Memory after the block was clobbered. */ }; /* Activate a standard collection of debugging hooks. This must be called before `malloc' is ever called. ABORTFUNC is called with an error code (see enum above) when an inconsistency is detected. If ABORTFUNC is null, the standard function prints on stderr and then calls `abort'. */ extern int mcheck (void (*__abortfunc) (enum mcheck_status)) __THROW; /* Similar to `mcheck' but performs checks for all block whenever one of the memory handling functions is called. This can be very slow. */ extern int mcheck_pedantic (void (*__abortfunc) (enum mcheck_status)) __THROW; /* Force check of all blocks now. */ extern void mcheck_check_all (void); /* Check for aberrations in a particular malloc'd block. You must have called `mcheck' already. These are the same checks that `mcheck' does when you free or reallocate a block. */ extern enum mcheck_status mprobe (void *__ptr) __THROW; /* Activate a standard collection of tracing hooks. */ extern void mtrace (void) __THROW; extern void muntrace (void) __THROW; __END_DECLS #endif /* mcheck.h */ shadow.h000064400000012142147631660260006215 0ustar00/* Copyright (C) 1996-1999, 2003, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ /* Declaration of types and functions for shadow password suite. */ #ifndef _SHADOW_H #define _SHADOW_H 1 #include #include #define __need_FILE #include #define __need_size_t #include /* Paths to the user database files. */ #define SHADOW _PATH_SHADOW __BEGIN_DECLS /* Structure of the password file. */ struct spwd { char *sp_namp; /* Login name. */ char *sp_pwdp; /* Encrypted password. */ long int sp_lstchg; /* Date of last change. */ long int sp_min; /* Minimum number of days between changes. */ long int sp_max; /* Maximum number of days between changes. */ long int sp_warn; /* Number of days to warn user to change the password. */ long int sp_inact; /* Number of days the account may be inactive. */ long int sp_expire; /* Number of days since 1970-01-01 until account expires. */ unsigned long int sp_flag; /* Reserved. */ }; /* Open database for reading. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern void setspent (void); /* Close database. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern void endspent (void); /* Get next entry from database, perhaps after opening the file. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern struct spwd *getspent (void); /* Get shadow entry matching NAME. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern struct spwd *getspnam (const char *__name); /* Read shadow entry from STRING. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern struct spwd *sgetspent (const char *__string); /* Read next shadow entry from STREAM. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern struct spwd *fgetspent (FILE *__stream); /* Write line containing shadow password entry to stream. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int putspent (const struct spwd *__p, FILE *__stream); #ifdef __USE_MISC /* Reentrant versions of some of the functions above. These functions are not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation they are cancellation points and therefore not marked with __THROW. */ extern int getspent_r (struct spwd *__result_buf, char *__buffer, size_t __buflen, struct spwd **__result); extern int getspnam_r (const char *__name, struct spwd *__result_buf, char *__buffer, size_t __buflen, struct spwd **__result); extern int sgetspent_r (const char *__string, struct spwd *__result_buf, char *__buffer, size_t __buflen, struct spwd **__result); extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf, char *__buffer, size_t __buflen, struct spwd **__result); #endif /* misc */ /* The simple locking functionality provided here is not suitable for multi-threaded applications. */ /* Protect password file against multi writers. */ extern int lckpwdf (void) __THROW; /* Unlock password file. */ extern int ulckpwdf (void) __THROW; __END_DECLS #endif /* shadow.h */ xlocale.h000064400000003250147631660260006357 0ustar00/* Definition of locale datatype. Copyright (C) 1997,2000,2002,2009,2010 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _XLOCALE_H #define _XLOCALE_H 1 /* Structure for reentrant locale using functions. This is an (almost) opaque type for the user level programs. The file and this data structure is not standardized. Don't rely on it. It can go away without warning. */ typedef struct __locale_struct { /* Note: LC_ALL is not a valid index into this array. */ struct __locale_data *__locales[13]; /* 13 = __LC_LAST. */ /* To increase the speed of this solution we add some special members. */ const unsigned short int *__ctype_b; const int *__ctype_tolower; const int *__ctype_toupper; /* Note: LC_ALL is not a valid index into this array. */ const char *__names[13]; } *__locale_t; /* POSIX 2008 makes locale_t official. */ typedef __locale_t locale_t; #endif /* xlocale.h */ pcrecpp.h000064400000063641147631660260006376 0ustar00// Copyright (c) 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Author: Sanjay Ghemawat // Support for PCRE_XXX modifiers added by Giuseppe Maxia, July 2005 #ifndef _PCRECPP_H #define _PCRECPP_H // C++ interface to the pcre regular-expression library. RE supports // Perl-style regular expressions (with extensions like \d, \w, \s, // ...). // // ----------------------------------------------------------------------- // REGEXP SYNTAX: // // This module is part of the pcre library and hence supports its syntax // for regular expressions. // // The syntax is pretty similar to Perl's. For those not familiar // with Perl's regular expressions, here are some examples of the most // commonly used extensions: // // "hello (\\w+) world" -- \w matches a "word" character // "version (\\d+)" -- \d matches a digit // "hello\\s+world" -- \s matches any whitespace character // "\\b(\\w+)\\b" -- \b matches empty string at a word boundary // "(?i)hello" -- (?i) turns on case-insensitive matching // "/\\*(.*?)\\*/" -- .*? matches . minimum no. of times possible // // ----------------------------------------------------------------------- // MATCHING INTERFACE: // // The "FullMatch" operation checks that supplied text matches a // supplied pattern exactly. // // Example: successful match // pcrecpp::RE re("h.*o"); // re.FullMatch("hello"); // // Example: unsuccessful match (requires full match): // pcrecpp::RE re("e"); // !re.FullMatch("hello"); // // Example: creating a temporary RE object: // pcrecpp::RE("h.*o").FullMatch("hello"); // // You can pass in a "const char*" or a "string" for "text". The // examples below tend to use a const char*. // // You can, as in the different examples above, store the RE object // explicitly in a variable or use a temporary RE object. The // examples below use one mode or the other arbitrarily. Either // could correctly be used for any of these examples. // // ----------------------------------------------------------------------- // MATCHING WITH SUB-STRING EXTRACTION: // // You can supply extra pointer arguments to extract matched subpieces. // // Example: extracts "ruby" into "s" and 1234 into "i" // int i; // string s; // pcrecpp::RE re("(\\w+):(\\d+)"); // re.FullMatch("ruby:1234", &s, &i); // // Example: does not try to extract any extra sub-patterns // re.FullMatch("ruby:1234", &s); // // Example: does not try to extract into NULL // re.FullMatch("ruby:1234", NULL, &i); // // Example: integer overflow causes failure // !re.FullMatch("ruby:1234567891234", NULL, &i); // // Example: fails because there aren't enough sub-patterns: // !pcrecpp::RE("\\w+:\\d+").FullMatch("ruby:1234", &s); // // Example: fails because string cannot be stored in integer // !pcrecpp::RE("(.*)").FullMatch("ruby", &i); // // The provided pointer arguments can be pointers to any scalar numeric // type, or one of // string (matched piece is copied to string) // StringPiece (StringPiece is mutated to point to matched piece) // T (where "bool T::ParseFrom(const char*, int)" exists) // NULL (the corresponding matched sub-pattern is not copied) // // CAVEAT: An optional sub-pattern that does not exist in the matched // string is assigned the empty string. Therefore, the following will // return false (because the empty string is not a valid number): // int number; // pcrecpp::RE::FullMatch("abc", "[a-z]+(\\d+)?", &number); // // ----------------------------------------------------------------------- // DO_MATCH // // The matching interface supports at most 16 arguments per call. // If you need more, consider using the more general interface // pcrecpp::RE::DoMatch(). See pcrecpp.h for the signature for DoMatch. // // ----------------------------------------------------------------------- // PARTIAL MATCHES // // You can use the "PartialMatch" operation when you want the pattern // to match any substring of the text. // // Example: simple search for a string: // pcrecpp::RE("ell").PartialMatch("hello"); // // Example: find first number in a string: // int number; // pcrecpp::RE re("(\\d+)"); // re.PartialMatch("x*100 + 20", &number); // assert(number == 100); // // ----------------------------------------------------------------------- // UTF-8 AND THE MATCHING INTERFACE: // // By default, pattern and text are plain text, one byte per character. // The UTF8 flag, passed to the constructor, causes both pattern // and string to be treated as UTF-8 text, still a byte stream but // potentially multiple bytes per character. In practice, the text // is likelier to be UTF-8 than the pattern, but the match returned // may depend on the UTF8 flag, so always use it when matching // UTF8 text. E.g., "." will match one byte normally but with UTF8 // set may match up to three bytes of a multi-byte character. // // Example: // pcrecpp::RE_Options options; // options.set_utf8(); // pcrecpp::RE re(utf8_pattern, options); // re.FullMatch(utf8_string); // // Example: using the convenience function UTF8(): // pcrecpp::RE re(utf8_pattern, pcrecpp::UTF8()); // re.FullMatch(utf8_string); // // NOTE: The UTF8 option is ignored if pcre was not configured with the // --enable-utf8 flag. // // ----------------------------------------------------------------------- // PASSING MODIFIERS TO THE REGULAR EXPRESSION ENGINE // // PCRE defines some modifiers to change the behavior of the regular // expression engine. // The C++ wrapper defines an auxiliary class, RE_Options, as a vehicle // to pass such modifiers to a RE class. // // Currently, the following modifiers are supported // // modifier description Perl corresponding // // PCRE_CASELESS case insensitive match /i // PCRE_MULTILINE multiple lines match /m // PCRE_DOTALL dot matches newlines /s // PCRE_DOLLAR_ENDONLY $ matches only at end N/A // PCRE_EXTRA strict escape parsing N/A // PCRE_EXTENDED ignore whitespaces /x // PCRE_UTF8 handles UTF8 chars built-in // PCRE_UNGREEDY reverses * and *? N/A // PCRE_NO_AUTO_CAPTURE disables matching parens N/A (*) // // (For a full account on how each modifier works, please check the // PCRE API reference manual). // // (*) Both Perl and PCRE allow non matching parentheses by means of the // "?:" modifier within the pattern itself. e.g. (?:ab|cd) does not // capture, while (ab|cd) does. // // For each modifier, there are two member functions whose name is made // out of the modifier in lowercase, without the "PCRE_" prefix. For // instance, PCRE_CASELESS is handled by // bool caseless(), // which returns true if the modifier is set, and // RE_Options & set_caseless(bool), // which sets or unsets the modifier. // // Moreover, PCRE_EXTRA_MATCH_LIMIT can be accessed through the // set_match_limit() and match_limit() member functions. // Setting match_limit to a non-zero value will limit the executation of // pcre to keep it from doing bad things like blowing the stack or taking // an eternity to return a result. A value of 5000 is good enough to stop // stack blowup in a 2MB thread stack. Setting match_limit to zero will // disable match limiting. Alternately, you can set match_limit_recursion() // which uses PCRE_EXTRA_MATCH_LIMIT_RECURSION to limit how much pcre // recurses. match_limit() caps the number of matches pcre does; // match_limit_recrusion() caps the depth of recursion. // // Normally, to pass one or more modifiers to a RE class, you declare // a RE_Options object, set the appropriate options, and pass this // object to a RE constructor. Example: // // RE_options opt; // opt.set_caseless(true); // // if (RE("HELLO", opt).PartialMatch("hello world")) ... // // RE_options has two constructors. The default constructor takes no // arguments and creates a set of flags that are off by default. // // The optional parameter 'option_flags' is to facilitate transfer // of legacy code from C programs. This lets you do // RE(pattern, RE_Options(PCRE_CASELESS|PCRE_MULTILINE)).PartialMatch(str); // // But new code is better off doing // RE(pattern, // RE_Options().set_caseless(true).set_multiline(true)).PartialMatch(str); // (See below) // // If you are going to pass one of the most used modifiers, there are some // convenience functions that return a RE_Options class with the // appropriate modifier already set: // CASELESS(), UTF8(), MULTILINE(), DOTALL(), EXTENDED() // // If you need to set several options at once, and you don't want to go // through the pains of declaring a RE_Options object and setting several // options, there is a parallel method that give you such ability on the // fly. You can concatenate several set_xxxxx member functions, since each // of them returns a reference to its class object. e.g.: to pass // PCRE_CASELESS, PCRE_EXTENDED, and PCRE_MULTILINE to a RE with one // statement, you may write // // RE(" ^ xyz \\s+ .* blah$", RE_Options() // .set_caseless(true) // .set_extended(true) // .set_multiline(true)).PartialMatch(sometext); // // ----------------------------------------------------------------------- // SCANNING TEXT INCREMENTALLY // // The "Consume" operation may be useful if you want to repeatedly // match regular expressions at the front of a string and skip over // them as they match. This requires use of the "StringPiece" type, // which represents a sub-range of a real string. Like RE, StringPiece // is defined in the pcrecpp namespace. // // Example: read lines of the form "var = value" from a string. // string contents = ...; // Fill string somehow // pcrecpp::StringPiece input(contents); // Wrap in a StringPiece // // string var; // int value; // pcrecpp::RE re("(\\w+) = (\\d+)\n"); // while (re.Consume(&input, &var, &value)) { // ...; // } // // Each successful call to "Consume" will set "var/value", and also // advance "input" so it points past the matched text. // // The "FindAndConsume" operation is similar to "Consume" but does not // anchor your match at the beginning of the string. For example, you // could extract all words from a string by repeatedly calling // pcrecpp::RE("(\\w+)").FindAndConsume(&input, &word) // // ----------------------------------------------------------------------- // PARSING HEX/OCTAL/C-RADIX NUMBERS // // By default, if you pass a pointer to a numeric value, the // corresponding text is interpreted as a base-10 number. You can // instead wrap the pointer with a call to one of the operators Hex(), // Octal(), or CRadix() to interpret the text in another base. The // CRadix operator interprets C-style "0" (base-8) and "0x" (base-16) // prefixes, but defaults to base-10. // // Example: // int a, b, c, d; // pcrecpp::RE re("(.*) (.*) (.*) (.*)"); // re.FullMatch("100 40 0100 0x40", // pcrecpp::Octal(&a), pcrecpp::Hex(&b), // pcrecpp::CRadix(&c), pcrecpp::CRadix(&d)); // will leave 64 in a, b, c, and d. // // ----------------------------------------------------------------------- // REPLACING PARTS OF STRINGS // // You can replace the first match of "pattern" in "str" with // "rewrite". Within "rewrite", backslash-escaped digits (\1 to \9) // can be used to insert text matching corresponding parenthesized // group from the pattern. \0 in "rewrite" refers to the entire // matching text. E.g., // // string s = "yabba dabba doo"; // pcrecpp::RE("b+").Replace("d", &s); // // will leave "s" containing "yada dabba doo". The result is true if // the pattern matches and a replacement occurs, or false otherwise. // // GlobalReplace() is like Replace(), except that it replaces all // occurrences of the pattern in the string with the rewrite. // Replacements are not subject to re-matching. E.g., // // string s = "yabba dabba doo"; // pcrecpp::RE("b+").GlobalReplace("d", &s); // // will leave "s" containing "yada dada doo". It returns the number // of replacements made. // // Extract() is like Replace(), except that if the pattern matches, // "rewrite" is copied into "out" (an additional argument) with // substitutions. The non-matching portions of "text" are ignored. // Returns true iff a match occurred and the extraction happened // successfully. If no match occurs, the string is left unaffected. #include #include #include // defines the Arg class // This isn't technically needed here, but we include it // anyway so folks who include pcrecpp.h don't have to. #include namespace pcrecpp { #define PCRE_SET_OR_CLEAR(b, o) \ if (b) all_options_ |= (o); else all_options_ &= ~(o); \ return *this #define PCRE_IS_SET(o) \ (all_options_ & o) == o /***** Compiling regular expressions: the RE class *****/ // RE_Options allow you to set options to be passed along to pcre, // along with other options we put on top of pcre. // Only 9 modifiers, plus match_limit and match_limit_recursion, // are supported now. class PCRECPP_EXP_DEFN RE_Options { public: // constructor RE_Options() : match_limit_(0), match_limit_recursion_(0), all_options_(0) {} // alternative constructor. // To facilitate transfer of legacy code from C programs // // This lets you do // RE(pattern, RE_Options(PCRE_CASELESS|PCRE_MULTILINE)).PartialMatch(str); // But new code is better off doing // RE(pattern, // RE_Options().set_caseless(true).set_multiline(true)).PartialMatch(str); RE_Options(int option_flags) : match_limit_(0), match_limit_recursion_(0), all_options_(option_flags) {} // we're fine with the default destructor, copy constructor, etc. // accessors and mutators int match_limit() const { return match_limit_; }; RE_Options &set_match_limit(int limit) { match_limit_ = limit; return *this; } int match_limit_recursion() const { return match_limit_recursion_; }; RE_Options &set_match_limit_recursion(int limit) { match_limit_recursion_ = limit; return *this; } bool caseless() const { return PCRE_IS_SET(PCRE_CASELESS); } RE_Options &set_caseless(bool x) { PCRE_SET_OR_CLEAR(x, PCRE_CASELESS); } bool multiline() const { return PCRE_IS_SET(PCRE_MULTILINE); } RE_Options &set_multiline(bool x) { PCRE_SET_OR_CLEAR(x, PCRE_MULTILINE); } bool dotall() const { return PCRE_IS_SET(PCRE_DOTALL); } RE_Options &set_dotall(bool x) { PCRE_SET_OR_CLEAR(x, PCRE_DOTALL); } bool extended() const { return PCRE_IS_SET(PCRE_EXTENDED); } RE_Options &set_extended(bool x) { PCRE_SET_OR_CLEAR(x, PCRE_EXTENDED); } bool dollar_endonly() const { return PCRE_IS_SET(PCRE_DOLLAR_ENDONLY); } RE_Options &set_dollar_endonly(bool x) { PCRE_SET_OR_CLEAR(x, PCRE_DOLLAR_ENDONLY); } bool extra() const { return PCRE_IS_SET(PCRE_EXTRA); } RE_Options &set_extra(bool x) { PCRE_SET_OR_CLEAR(x, PCRE_EXTRA); } bool ungreedy() const { return PCRE_IS_SET(PCRE_UNGREEDY); } RE_Options &set_ungreedy(bool x) { PCRE_SET_OR_CLEAR(x, PCRE_UNGREEDY); } bool utf8() const { return PCRE_IS_SET(PCRE_UTF8); } RE_Options &set_utf8(bool x) { PCRE_SET_OR_CLEAR(x, PCRE_UTF8); } bool no_auto_capture() const { return PCRE_IS_SET(PCRE_NO_AUTO_CAPTURE); } RE_Options &set_no_auto_capture(bool x) { PCRE_SET_OR_CLEAR(x, PCRE_NO_AUTO_CAPTURE); } RE_Options &set_all_options(int opt) { all_options_ = opt; return *this; } int all_options() const { return all_options_ ; } // TODO: add other pcre flags private: int match_limit_; int match_limit_recursion_; int all_options_; }; // These functions return some common RE_Options static inline RE_Options UTF8() { return RE_Options().set_utf8(true); } static inline RE_Options CASELESS() { return RE_Options().set_caseless(true); } static inline RE_Options MULTILINE() { return RE_Options().set_multiline(true); } static inline RE_Options DOTALL() { return RE_Options().set_dotall(true); } static inline RE_Options EXTENDED() { return RE_Options().set_extended(true); } // Interface for regular expression matching. Also corresponds to a // pre-compiled regular expression. An "RE" object is safe for // concurrent use by multiple threads. class PCRECPP_EXP_DEFN RE { public: // We provide implicit conversions from strings so that users can // pass in a string or a "const char*" wherever an "RE" is expected. RE(const string& pat) { Init(pat, NULL); } RE(const string& pat, const RE_Options& option) { Init(pat, &option); } RE(const char* pat) { Init(pat, NULL); } RE(const char* pat, const RE_Options& option) { Init(pat, &option); } RE(const unsigned char* pat) { Init(reinterpret_cast(pat), NULL); } RE(const unsigned char* pat, const RE_Options& option) { Init(reinterpret_cast(pat), &option); } // Copy constructor & assignment - note that these are expensive // because they recompile the expression. RE(const RE& re) { Init(re.pattern_, &re.options_); } const RE& operator=(const RE& re) { if (this != &re) { Cleanup(); // This is the code that originally came from Google // Init(re.pattern_.c_str(), &re.options_); // This is the replacement from Ari Pollak Init(re.pattern_, &re.options_); } return *this; } ~RE(); // The string specification for this RE. E.g. // RE re("ab*c?d+"); // re.pattern(); // "ab*c?d+" const string& pattern() const { return pattern_; } // If RE could not be created properly, returns an error string. // Else returns the empty string. const string& error() const { return *error_; } /***** The useful part: the matching interface *****/ // This is provided so one can do pattern.ReplaceAll() just as // easily as ReplaceAll(pattern-text, ....) bool FullMatch(const StringPiece& text, const Arg& ptr1 = no_arg, const Arg& ptr2 = no_arg, const Arg& ptr3 = no_arg, const Arg& ptr4 = no_arg, const Arg& ptr5 = no_arg, const Arg& ptr6 = no_arg, const Arg& ptr7 = no_arg, const Arg& ptr8 = no_arg, const Arg& ptr9 = no_arg, const Arg& ptr10 = no_arg, const Arg& ptr11 = no_arg, const Arg& ptr12 = no_arg, const Arg& ptr13 = no_arg, const Arg& ptr14 = no_arg, const Arg& ptr15 = no_arg, const Arg& ptr16 = no_arg) const; bool PartialMatch(const StringPiece& text, const Arg& ptr1 = no_arg, const Arg& ptr2 = no_arg, const Arg& ptr3 = no_arg, const Arg& ptr4 = no_arg, const Arg& ptr5 = no_arg, const Arg& ptr6 = no_arg, const Arg& ptr7 = no_arg, const Arg& ptr8 = no_arg, const Arg& ptr9 = no_arg, const Arg& ptr10 = no_arg, const Arg& ptr11 = no_arg, const Arg& ptr12 = no_arg, const Arg& ptr13 = no_arg, const Arg& ptr14 = no_arg, const Arg& ptr15 = no_arg, const Arg& ptr16 = no_arg) const; bool Consume(StringPiece* input, const Arg& ptr1 = no_arg, const Arg& ptr2 = no_arg, const Arg& ptr3 = no_arg, const Arg& ptr4 = no_arg, const Arg& ptr5 = no_arg, const Arg& ptr6 = no_arg, const Arg& ptr7 = no_arg, const Arg& ptr8 = no_arg, const Arg& ptr9 = no_arg, const Arg& ptr10 = no_arg, const Arg& ptr11 = no_arg, const Arg& ptr12 = no_arg, const Arg& ptr13 = no_arg, const Arg& ptr14 = no_arg, const Arg& ptr15 = no_arg, const Arg& ptr16 = no_arg) const; bool FindAndConsume(StringPiece* input, const Arg& ptr1 = no_arg, const Arg& ptr2 = no_arg, const Arg& ptr3 = no_arg, const Arg& ptr4 = no_arg, const Arg& ptr5 = no_arg, const Arg& ptr6 = no_arg, const Arg& ptr7 = no_arg, const Arg& ptr8 = no_arg, const Arg& ptr9 = no_arg, const Arg& ptr10 = no_arg, const Arg& ptr11 = no_arg, const Arg& ptr12 = no_arg, const Arg& ptr13 = no_arg, const Arg& ptr14 = no_arg, const Arg& ptr15 = no_arg, const Arg& ptr16 = no_arg) const; bool Replace(const StringPiece& rewrite, string *str) const; int GlobalReplace(const StringPiece& rewrite, string *str) const; bool Extract(const StringPiece &rewrite, const StringPiece &text, string *out) const; // Escapes all potentially meaningful regexp characters in // 'unquoted'. The returned string, used as a regular expression, // will exactly match the original string. For example, // 1.5-2.0? // may become: // 1\.5\-2\.0\? // Note QuoteMeta behaves the same as perl's QuoteMeta function, // *except* that it escapes the NUL character (\0) as backslash + 0, // rather than backslash + NUL. static string QuoteMeta(const StringPiece& unquoted); /***** Generic matching interface *****/ // Type of match (TODO: Should be restructured as part of RE_Options) enum Anchor { UNANCHORED, // No anchoring ANCHOR_START, // Anchor at start only ANCHOR_BOTH // Anchor at start and end }; // General matching routine. Stores the length of the match in // "*consumed" if successful. bool DoMatch(const StringPiece& text, Anchor anchor, int* consumed, const Arg* const* args, int n) const; // Return the number of capturing subpatterns, or -1 if the // regexp wasn't valid on construction. int NumberOfCapturingGroups() const; // The default value for an argument, to indicate the end of the argument // list. This must be used only in optional argument defaults. It should NOT // be passed explicitly. Some people have tried to use it like this: // // FullMatch(x, y, &z, no_arg, &w); // // This is a mistake, and will not work. static Arg no_arg; private: void Init(const string& pattern, const RE_Options* options); void Cleanup(); // Match against "text", filling in "vec" (up to "vecsize" * 2/3) with // pairs of integers for the beginning and end positions of matched // text. The first pair corresponds to the entire matched text; // subsequent pairs correspond, in order, to parentheses-captured // matches. Returns the number of pairs (one more than the number of // the last subpattern with a match) if matching was successful // and zero if the match failed. // I.e. for RE("(foo)|(bar)|(baz)") it will return 2, 3, and 4 when matching // against "foo", "bar", and "baz" respectively. // When matching RE("(foo)|hello") against "hello", it will return 1. // But the values for all subpattern are filled in into "vec". int TryMatch(const StringPiece& text, int startpos, Anchor anchor, bool empty_ok, int *vec, int vecsize) const; // Append the "rewrite" string, with backslash subsitutions from "text" // and "vec", to string "out". bool Rewrite(string *out, const StringPiece& rewrite, const StringPiece& text, int *vec, int veclen) const; // internal implementation for DoMatch bool DoMatchImpl(const StringPiece& text, Anchor anchor, int* consumed, const Arg* const args[], int n, int* vec, int vecsize) const; // Compile the regexp for the specified anchoring mode pcre* Compile(Anchor anchor); string pattern_; RE_Options options_; pcre* re_full_; // For full matches pcre* re_partial_; // For partial matches const string* error_; // Error indicator (or points to empty string) }; } // namespace pcrecpp #endif /* _PCRECPP_H */ mqueue.h000064400000007317147631660260006241 0ustar00/* Copyright (C) 2004, 2005, 2007, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _MQUEUE_H #define _MQUEUE_H 1 #include #include #include #define __need_sigevent_t #include #define __need_timespec #include /* Get the definition of mqd_t and struct mq_attr. */ #include __BEGIN_DECLS /* Establish connection between a process and a message queue NAME and return message queue descriptor or (mqd_t) -1 on error. OFLAG determines the type of access used. If O_CREAT is on OFLAG, the third argument is taken as a `mode_t', the mode of the created message queue, and the fourth argument is taken as `struct mq_attr *', pointer to message queue attributes. If the fourth argument is NULL, default attributes are used. */ extern mqd_t mq_open (const char *__name, int __oflag, ...) __THROW __nonnull ((1)); /* Removes the association between message queue descriptor MQDES and its message queue. */ extern int mq_close (mqd_t __mqdes) __THROW; /* Query status and attributes of message queue MQDES. */ extern int mq_getattr (mqd_t __mqdes, struct mq_attr *__mqstat) __THROW __nonnull ((2)); /* Set attributes associated with message queue MQDES and if OMQSTAT is not NULL also query its old attributes. */ extern int mq_setattr (mqd_t __mqdes, const struct mq_attr *__restrict __mqstat, struct mq_attr *__restrict __omqstat) __THROW __nonnull ((2)); /* Remove message queue named NAME. */ extern int mq_unlink (const char *__name) __THROW __nonnull ((1)); /* Register notification issued upon message arrival to an empty message queue MQDES. */ extern int mq_notify (mqd_t __mqdes, const struct sigevent *__notification) __THROW; /* Receive the oldest from highest priority messages in message queue MQDES. */ extern ssize_t mq_receive (mqd_t __mqdes, char *__msg_ptr, size_t __msg_len, unsigned int *__msg_prio) __nonnull ((2)); /* Add message pointed by MSG_PTR to message queue MQDES. */ extern int mq_send (mqd_t __mqdes, const char *__msg_ptr, size_t __msg_len, unsigned int __msg_prio) __nonnull ((2)); #ifdef __USE_XOPEN2K /* Receive the oldest from highest priority messages in message queue MQDES, stop waiting if ABS_TIMEOUT expires. */ extern ssize_t mq_timedreceive (mqd_t __mqdes, char *__restrict __msg_ptr, size_t __msg_len, unsigned int *__restrict __msg_prio, const struct timespec *__restrict __abs_timeout) __nonnull ((2, 5)); /* Add message pointed by MSG_PTR to message queue MQDES, stop blocking on full message queue if ABS_TIMEOUT expires. */ extern int mq_timedsend (mqd_t __mqdes, const char *__msg_ptr, size_t __msg_len, unsigned int __msg_prio, const struct timespec *__abs_timeout) __nonnull ((2, 5)); #endif /* Define some inlines helping to catch common problems. */ #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \ && defined __va_arg_pack_len # include #endif __END_DECLS #endif /* mqueue.h */ pg_config_manual.h000064400000022555147631660260010231 0ustar00/*------------------------------------------------------------------------ * PostgreSQL manual configuration settings * * This file contains various configuration symbols and limits. In * all cases, changing them is only useful in very rare situations or * for developers. If you edit any of these, be sure to do a *full* * rebuild (and an initdb if noted). * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/pg_config_manual.h *------------------------------------------------------------------------ */ /* * Maximum length for identifiers (e.g. table names, column names, * function names). Names actually are limited to one less byte than this, * because the length must include a trailing zero byte. * * Changing this requires an initdb. */ #define NAMEDATALEN 64 /* * Maximum number of arguments to a function. * * The minimum value is 8 (GIN indexes use 8-argument support functions). * The maximum possible value is around 600 (limited by index tuple size in * pg_proc's index; BLCKSZ larger than 8K would allow more). Values larger * than needed will waste memory and processing time, but do not directly * cost disk space. * * Changing this does not require an initdb, but it does require a full * backend recompile (including any user-defined C functions). */ #define FUNC_MAX_ARGS 100 /* * Maximum number of columns in an index. There is little point in making * this anything but a multiple of 32, because the main cost is associated * with index tuple header size (see access/itup.h). * * Changing this requires an initdb. */ #define INDEX_MAX_KEYS 32 /* * Set the upper and lower bounds of sequence values. */ #define SEQ_MAXVALUE INT64CONST(0x7FFFFFFFFFFFFFFF) #define SEQ_MINVALUE (-SEQ_MAXVALUE) /* * Number of spare LWLocks to allocate for user-defined add-on code. */ #define NUM_USER_DEFINED_LWLOCKS 4 /* * When we don't have native spinlocks, we use semaphores to simulate them. * Decreasing this value reduces consumption of OS resources; increasing it * may improve performance, but supplying a real spinlock implementation is * probably far better. */ #define NUM_SPINLOCK_SEMAPHORES 128 /* * Define this if you want to allow the lo_import and lo_export SQL * functions to be executed by ordinary users. By default these * functions are only available to the Postgres superuser. CAUTION: * These functions are SECURITY HOLES since they can read and write * any file that the PostgreSQL server has permission to access. If * you turn this on, don't say we didn't warn you. */ /* #define ALLOW_DANGEROUS_LO_FUNCTIONS */ /* * MAXPGPATH: standard size of a pathname buffer in PostgreSQL (hence, * maximum usable pathname length is one less). * * We'd use a standard system header symbol for this, if there weren't * so many to choose from: MAXPATHLEN, MAX_PATH, PATH_MAX are all * defined by different "standards", and often have different values * on the same platform! So we just punt and use a reasonably * generous setting here. */ #define MAXPGPATH 1024 /* * PG_SOMAXCONN: maximum accept-queue length limit passed to * listen(2). You'd think we should use SOMAXCONN from * , but on many systems that symbol is much smaller * than the kernel's actual limit. In any case, this symbol need be * twiddled only if you have a kernel that refuses large limit values, * rather than silently reducing the value to what it can handle * (which is what most if not all Unixen do). */ #define PG_SOMAXCONN 10000 /* * You can try changing this if you have a machine with bytes of * another size, but no guarantee... */ #define BITS_PER_BYTE 8 /* * Preferred alignment for disk I/O buffers. On some CPUs, copies between * user space and kernel space are significantly faster if the user buffer * is aligned on a larger-than-MAXALIGN boundary. Ideally this should be * a platform-dependent value, but for now we just hard-wire it. */ #define ALIGNOF_BUFFER 32 /* * Disable UNIX sockets for certain operating systems. */ #if defined(WIN32) #undef HAVE_UNIX_SOCKETS #endif /* * Define this if your operating system supports link() */ #if !defined(WIN32) && !defined(__CYGWIN__) #define HAVE_WORKING_LINK 1 #endif /* * USE_POSIX_FADVISE controls whether Postgres will attempt to use the * posix_fadvise() kernel call. Usually the automatic configure tests are * sufficient, but some older Linux distributions had broken versions of * posix_fadvise(). If necessary you can remove the #define here. */ #if HAVE_DECL_POSIX_FADVISE && defined(HAVE_POSIX_FADVISE) #define USE_POSIX_FADVISE #endif /* * USE_PREFETCH code should be compiled only if we have a way to implement * prefetching. (This is decoupled from USE_POSIX_FADVISE because there * might in future be support for alternative low-level prefetch APIs.) */ #ifdef USE_POSIX_FADVISE #define USE_PREFETCH #endif /* * This is the default directory in which AF_UNIX socket files are * placed. Caution: changing this risks breaking your existing client * applications, which are likely to continue to look in the old * directory. But if you just hate the idea of sockets in /tmp, * here's where to twiddle it. You can also override this at runtime * with the postmaster's -k switch. */ #define DEFAULT_PGSOCKET_DIR "/var/run/postgresql" /* * The random() function is expected to yield values between 0 and * MAX_RANDOM_VALUE. Currently, all known implementations yield * 0..2^31-1, so we just hardwire this constant. We could do a * configure test if it proves to be necessary. CAUTION: Think not to * replace this with RAND_MAX. RAND_MAX defines the maximum value of * the older rand() function, which is often different from --- and * considerably inferior to --- random(). */ #define MAX_RANDOM_VALUE (0x7FFFFFFF) /* * Set the format style used by gcc to check printf type functions. We really * want the "gnu_printf" style set, which includes what glibc uses, such * as %m for error strings and %lld for 64 bit long longs. But not all gcc * compilers are known to support it, so we just use "printf" which all * gcc versions alive are known to support, except on Windows where * using "gnu_printf" style makes a dramatic difference. Maybe someday * we'll have a configure test for this, if we ever discover use of more * variants to be necessary. */ #ifdef WIN32 #define PG_PRINTF_ATTRIBUTE gnu_printf #else #define PG_PRINTF_ATTRIBUTE printf #endif /* * On PPC machines, decide whether to use the mutex hint bit in LWARX * instructions. Setting the hint bit will slightly improve spinlock * performance on POWER6 and later machines, but does nothing before that, * and will result in illegal-instruction failures on some pre-POWER4 * machines. By default we use the hint bit when building for 64-bit PPC, * which should be safe in nearly all cases. You might want to override * this if you are building 32-bit code for a known-recent PPC machine. */ #ifdef HAVE_PPC_LWARX_MUTEX_HINT /* must have assembler support in any case */ #if defined(__ppc64__) || defined(__powerpc64__) #define USE_PPC_LWARX_MUTEX_HINT #endif #endif /* * On PPC machines, decide whether to use LWSYNC instructions in place of * ISYNC and SYNC. This provides slightly better performance, but will * result in illegal-instruction failures on some pre-POWER4 machines. * By default we use LWSYNC when building for 64-bit PPC, which should be * safe in nearly all cases. */ #if defined(__ppc64__) || defined(__powerpc64__) #define USE_PPC_LWSYNC #endif /* *------------------------------------------------------------------------ * The following symbols are for enabling debugging code, not for * controlling user-visible features or resource limits. *------------------------------------------------------------------------ */ /* * Define this to cause pfree()'d memory to be cleared immediately, to * facilitate catching bugs that refer to already-freed values. * Right now, this gets defined automatically if --enable-cassert. */ #ifdef USE_ASSERT_CHECKING #define CLOBBER_FREED_MEMORY #endif /* * Define this to check memory allocation errors (scribbling on more * bytes than were allocated). Right now, this gets defined * automatically if --enable-cassert. */ #ifdef USE_ASSERT_CHECKING #define MEMORY_CONTEXT_CHECKING #endif /* * Define this to cause palloc()'d memory to be filled with random data, to * facilitate catching code that depends on the contents of uninitialized * memory. Caution: this is horrendously expensive. */ /* #define RANDOMIZE_ALLOCATED_MEMORY */ /* * Define this to force all parse and plan trees to be passed through * copyObject(), to facilitate catching errors and omissions in * copyObject(). */ /* #define COPY_PARSE_PLAN_TREES */ /* * Enable debugging print statements for lock-related operations. */ /* #define LOCK_DEBUG */ /* * Enable debugging print statements for WAL-related operations; see * also the wal_debug GUC var. */ /* #define WAL_DEBUG */ /* * Enable tracing of resource consumption during sort operations; * see also the trace_sort GUC var. For 8.1 this is enabled by default. */ #define TRACE_SORT 1 /* * Enable tracing of syncscan operations (see also the trace_syncscan GUC var). */ /* #define TRACE_SYNCSCAN */ /* * Other debug #defines (documentation, anyone?) */ /* #define HEAPDEBUGALL */ /* #define ACLDEBUG */ /* #define RTDEBUG */ nc_tparm.h000064400000010067147631660260006537 0ustar00/**************************************************************************** * Copyright (c) 2006-2010,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /**************************************************************************** * Author: Thomas E. Dickey 2006 * ****************************************************************************/ /* $Id: nc_tparm.h,v 1.6 2012/02/18 21:34:42 tom Exp $ */ #ifndef NC_TPARM_included #define NC_TPARM_included 1 /* * Cast parameters past the formatting-string for tparm() to match the * assumption of the varargs code. */ #ifndef TPARM_ARG #ifdef NCURSES_TPARM_ARG #define TPARM_ARG NCURSES_TPARM_ARG #else #define TPARM_ARG long #endif #endif /* TPARAM_ARG */ #define TPARM_N(n) (TPARM_ARG)(n) #define TPARM_9(a,b,c,d,e,f,g,h,i,j) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i),TPARM_N(j)) #if NCURSES_TPARM_VARARGS #define TPARM_8(a,b,c,d,e,f,g,h,i) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i)) #define TPARM_7(a,b,c,d,e,f,g,h) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h)) #define TPARM_6(a,b,c,d,e,f,g) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g)) #define TPARM_5(a,b,c,d,e,f) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f)) #define TPARM_4(a,b,c,d,e) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e)) #define TPARM_3(a,b,c,d) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d)) #define TPARM_2(a,b,c) tparm(a,TPARM_N(b),TPARM_N(c)) #define TPARM_1(a,b) tparm(a,TPARM_N(b)) #define TPARM_0(a) tparm(a) #else #define TPARM_8(a,b,c,d,e,f,g,h,i) TPARM_9(a,b,c,d,e,f,g,h,i,0) #define TPARM_7(a,b,c,d,e,f,g,h) TPARM_8(a,b,c,d,e,f,g,h,0) #define TPARM_6(a,b,c,d,e,f,g) TPARM_7(a,b,c,d,e,f,g,0) #define TPARM_5(a,b,c,d,e,f) TPARM_6(a,b,c,d,e,f,0) #define TPARM_4(a,b,c,d,e) TPARM_5(a,b,c,d,e,0) #define TPARM_3(a,b,c,d) TPARM_4(a,b,c,d,0) #define TPARM_2(a,b,c) TPARM_3(a,b,c,0) #define TPARM_1(a,b) TPARM_2(a,b,0) #define TPARM_1(a,b) TPARM_2(a,b,0) #define TPARM_0(a) TPARM_1(a,0) #endif #endif /* NC_TPARM_included */ selinux/context.h000064400000002271147631660260010105 0ustar00#ifndef _SELINUX_CONTEXT_H_ #define _SELINUX_CONTEXT_H_ #ifdef __cplusplus extern "C" { #endif /* * Functions to deal with security contexts in user space. */ typedef struct { void *ptr; } context_s_t; typedef context_s_t *context_t; /* Return a new context initialized to a context string */ extern context_t context_new(const char *); /* * Return a pointer to the string value of the context_t * Valid until the next call to context_str or context_free * for the same context_t* */ extern char *context_str(context_t); /* Free the storage used by a context */ extern void context_free(context_t); /* Get a pointer to the string value of a context component */ extern const char *context_type_get(context_t); extern const char *context_range_get(context_t); extern const char *context_role_get(context_t); extern const char *context_user_get(context_t); /* Set a context component. Returns nonzero if unsuccessful */ extern int context_type_set(context_t, const char *); extern int context_range_set(context_t, const char *); extern int context_role_set(context_t, const char *); extern int context_user_set(context_t, const char *); #ifdef __cplusplus } #endif #endif selinux/avc.h000064400000040076147631660260007177 0ustar00/* * Access vector cache interface for object managers. * * Author : Eamon Walsh */ #ifndef _SELINUX_AVC_H_ #define _SELINUX_AVC_H_ #include #include #include #include #ifdef __cplusplus extern "C" { #endif /* * SID format and operations */ struct security_id { char * ctx; unsigned int refcnt; }; typedef struct security_id *security_id_t; #define SECSID_WILD (security_id_t)NULL /* unspecified SID */ /** * avc_sid_to_context - get copy of context corresponding to SID. * @sid: input SID * @ctx: pointer to context reference * * Return a copy of the security context corresponding to the input * @sid in the memory referenced by @ctx. The caller is expected to * free the context with freecon(). Return %0 on success, -%1 on * failure, with @errno set to %ENOMEM if insufficient memory was * available to make the copy, or %EINVAL if the input SID is invalid. */ int avc_sid_to_context(security_id_t sid, char ** ctx); int avc_sid_to_context_raw(security_id_t sid, char ** ctx); /** * avc_context_to_sid - get SID for context. * @ctx: input security context * @sid: pointer to SID reference * * Look up security context @ctx in SID table, making * a new entry if @ctx is not found. Increment the * reference counter for the SID. Store a pointer * to the SID structure into the memory referenced by @sid, * returning %0 on success or -%1 on error with @errno set. */ int avc_context_to_sid(const char * ctx, security_id_t * sid); int avc_context_to_sid_raw(const char * ctx, security_id_t * sid); /** * sidget - increment SID reference counter. * @sid: SID reference * * Increment the reference counter for @sid, indicating that * @sid is in use by an (additional) object. Return the * new reference count, or zero if @sid is invalid (has zero * reference count). Note that avc_context_to_sid() also * increments reference counts. */ int sidget(security_id_t sid); /** * sidput - decrement SID reference counter. * @sid: SID reference * * Decrement the reference counter for @sid, indicating that * a reference to @sid is no longer in use. Return the * new reference count. When the reference count reaches * zero, the SID is invalid, and avc_context_to_sid() must * be called to obtain a new SID for the security context. */ int sidput(security_id_t sid); /** * avc_get_initial_sid - get SID for an initial kernel security identifier * @name: input name of initial kernel security identifier * @sid: pointer to a SID reference * * Get the context for an initial kernel security identifier specified by * @name using security_get_initial_context() and then call * avc_context_to_sid() to get the corresponding SID. */ int avc_get_initial_sid(const char *name, security_id_t * sid); /* * AVC entry */ struct avc_entry; struct avc_entry_ref { struct avc_entry *ae; }; /** * avc_entry_ref_init - initialize an AVC entry reference. * @aeref: pointer to avc entry reference structure * * Use this macro to initialize an avc entry reference structure * before first use. These structures are passed to avc_has_perm(), * which stores cache entry references in them. They can increase * performance on repeated queries. */ #define avc_entry_ref_init(aeref) ((aeref)->ae = NULL) /* * User-provided callbacks for memory, auditing, and locking */ /* These structures are passed by reference to avc_init(). Passing * a NULL reference will cause the AVC to use a default. The default * memory callbacks are malloc() and free(). The default logging method * is to print on stderr. If no thread callbacks are passed, a separate * listening thread won't be started for kernel policy change messages. * If no locking callbacks are passed, no locking will take place. */ struct avc_memory_callback { /* malloc() equivalent. */ void *(*func_malloc) (size_t size); /* free() equivalent. */ void (*func_free) (void *ptr); /* Note that these functions should set errno on failure. If not, some avc routines may return -1 without errno set. */ }; struct avc_log_callback { /* log the printf-style format and arguments. */ void #ifdef __GNUC__ __attribute__ ((format(printf, 1, 2))) #endif (*func_log) (const char *fmt, ...); /* store a string representation of auditdata (corresponding to the given security class) into msgbuf. */ void (*func_audit) (void *auditdata, security_class_t cls, char *msgbuf, size_t msgbufsize); }; struct avc_thread_callback { /* create and start a thread, returning an opaque pointer to it; the thread should run the given function. */ void *(*func_create_thread) (void (*run) (void)); /* cancel a given thread and free its resources. */ void (*func_stop_thread) (void *thread); }; struct avc_lock_callback { /* create a lock and return an opaque pointer to it. */ void *(*func_alloc_lock) (void); /* obtain a given lock, blocking if necessary. */ void (*func_get_lock) (void *lock); /* release a given lock. */ void (*func_release_lock) (void *lock); /* destroy a given lock (free memory, etc.) */ void (*func_free_lock) (void *lock); }; /* * Available options */ /* no-op option, useful for unused slots in an array of options */ #define AVC_OPT_UNUSED 0 /* override kernel enforcing mode (boolean value) */ #define AVC_OPT_SETENFORCE 1 /* * AVC operations */ /** * avc_init - Initialize the AVC. * @msgprefix: prefix for log messages * @mem_callbacks: user-supplied memory callbacks * @log_callbacks: user-supplied logging callbacks * @thread_callbacks: user-supplied threading callbacks * @lock_callbacks: user-supplied locking callbacks * * Initialize the access vector cache. Return %0 on * success or -%1 with @errno set on failure. * If @msgprefix is NULL, use "uavc". If any callback * structure references are NULL, use default methods * for those callbacks (see the definition of the callback * structures above). */ int avc_init(const char *msgprefix, const struct avc_memory_callback *mem_callbacks, const struct avc_log_callback *log_callbacks, const struct avc_thread_callback *thread_callbacks, const struct avc_lock_callback *lock_callbacks); /** * avc_open - Initialize the AVC. * @opts: array of selabel_opt structures specifying AVC options or NULL. * @nopts: number of elements in opts array or zero for no options. * * This function is identical to avc_init(), except the message prefix * is set to "avc" and any callbacks desired should be specified via * selinux_set_callback(). Available options are listed above. */ int avc_open(struct selinux_opt *opts, unsigned nopts); /** * avc_cleanup - Remove unused SIDs and AVC entries. * * Search the SID table for SID structures with zero * reference counts, and remove them along with all * AVC entries that reference them. This can be used * to return memory to the system. */ void avc_cleanup(void); /** * avc_reset - Flush the cache and reset statistics. * * Remove all entries from the cache and reset all access * statistics (as returned by avc_cache_stats()) to zero. * The SID mapping is not affected. Return %0 on success, * -%1 with @errno set on error. */ int avc_reset(void); /** * avc_destroy - Free all AVC structures. * * Destroy all AVC structures and free all allocated * memory. User-supplied locking, memory, and audit * callbacks will be retained, but security-event * callbacks will not. All SID's will be invalidated. * User must call avc_init() if further use of AVC is desired. */ void avc_destroy(void); /** * avc_has_perm_noaudit - Check permissions but perform no auditing. * @ssid: source security identifier * @tsid: target security identifier * @tclass: target security class * @requested: requested permissions, interpreted based on @tclass * @aeref: AVC entry reference * @avd: access vector decisions * * Check the AVC to determine whether the @requested permissions are granted * for the SID pair (@ssid, @tsid), interpreting the permissions * based on @tclass, and call the security server on a cache miss to obtain * a new decision and add it to the cache. Update @aeref to refer to an AVC * entry with the resulting decisions, and return a copy of the decisions * in @avd. Return %0 if all @requested permissions are granted, -%1 with * @errno set to %EACCES if any permissions are denied, or to another value * upon other errors. This function is typically called by avc_has_perm(), * but may also be called directly to separate permission checking from * auditing, e.g. in cases where a lock must be held for the check but * should be released for the auditing. */ int avc_has_perm_noaudit(security_id_t ssid, security_id_t tsid, security_class_t tclass, access_vector_t requested, struct avc_entry_ref *aeref, struct av_decision *avd); /** * avc_has_perm - Check permissions and perform any appropriate auditing. * @ssid: source security identifier * @tsid: target security identifier * @tclass: target security class * @requested: requested permissions, interpreted based on @tclass * @aeref: AVC entry reference * @auditdata: auxiliary audit data * * Check the AVC to determine whether the @requested permissions are granted * for the SID pair (@ssid, @tsid), interpreting the permissions * based on @tclass, and call the security server on a cache miss to obtain * a new decision and add it to the cache. Update @aeref to refer to an AVC * entry with the resulting decisions. Audit the granting or denial of * permissions in accordance with the policy. Return %0 if all @requested * permissions are granted, -%1 with @errno set to %EACCES if any permissions * are denied or to another value upon other errors. */ int avc_has_perm(security_id_t ssid, security_id_t tsid, security_class_t tclass, access_vector_t requested, struct avc_entry_ref *aeref, void *auditdata); /** * avc_audit - Audit the granting or denial of permissions. * @ssid: source security identifier * @tsid: target security identifier * @tclass: target security class * @requested: requested permissions * @avd: access vector decisions * @result: result from avc_has_perm_noaudit * @auditdata: auxiliary audit data * * Audit the granting or denial of permissions in accordance * with the policy. This function is typically called by * avc_has_perm() after a permission check, but can also be * called directly by callers who use avc_has_perm_noaudit() * in order to separate the permission check from the auditing. * For example, this separation is useful when the permission check must * be performed under a lock, to allow the lock to be released * before calling the auditing code. */ void avc_audit(security_id_t ssid, security_id_t tsid, security_class_t tclass, access_vector_t requested, struct av_decision *avd, int result, void *auditdata); /** * avc_compute_create - Compute SID for labeling a new object. * @ssid: source security identifier * @tsid: target security identifier * @tclass: target security class * @newsid: pointer to SID reference * * Call the security server to obtain a context for labeling a * new object. Look up the context in the SID table, making * a new entry if not found. Increment the reference counter * for the SID. Store a pointer to the SID structure into the * memory referenced by @newsid, returning %0 on success or -%1 on * error with @errno set. */ int avc_compute_create(security_id_t ssid, security_id_t tsid, security_class_t tclass, security_id_t * newsid); /** * avc_compute_member - Compute SID for polyinstantation. * @ssid: source security identifier * @tsid: target security identifier * @tclass: target security class * @newsid: pointer to SID reference * * Call the security server to obtain a context for labeling an * object instance. Look up the context in the SID table, making * a new entry if not found. Increment the reference counter * for the SID. Store a pointer to the SID structure into the * memory referenced by @newsid, returning %0 on success or -%1 on * error with @errno set. */ int avc_compute_member(security_id_t ssid, security_id_t tsid, security_class_t tclass, security_id_t * newsid); /* * security event callback facility */ /* security events */ #define AVC_CALLBACK_GRANT 1 #define AVC_CALLBACK_TRY_REVOKE 2 #define AVC_CALLBACK_REVOKE 4 #define AVC_CALLBACK_RESET 8 #define AVC_CALLBACK_AUDITALLOW_ENABLE 16 #define AVC_CALLBACK_AUDITALLOW_DISABLE 32 #define AVC_CALLBACK_AUDITDENY_ENABLE 64 #define AVC_CALLBACK_AUDITDENY_DISABLE 128 /** * avc_add_callback - Register a callback for security events. * @callback: callback function * @events: bitwise OR of desired security events * @ssid: source security identifier or %SECSID_WILD * @tsid: target security identifier or %SECSID_WILD * @tclass: target security class * @perms: permissions * * Register a callback function for events in the set @events * related to the SID pair (@ssid, @tsid) and * and the permissions @perms, interpreting * @perms based on @tclass. Returns %0 on success or * -%1 if insufficient memory exists to add the callback. */ int avc_add_callback(int (*callback) (uint32_t event, security_id_t ssid, security_id_t tsid, security_class_t tclass, access_vector_t perms, access_vector_t * out_retained), uint32_t events, security_id_t ssid, security_id_t tsid, security_class_t tclass, access_vector_t perms); /* * AVC statistics */ /* If set, cache statistics are tracked. This may * become a compile-time option in the future. */ #define AVC_CACHE_STATS 1 struct avc_cache_stats { unsigned entry_lookups; unsigned entry_hits; unsigned entry_misses; unsigned entry_discards; unsigned cav_lookups; unsigned cav_hits; unsigned cav_probes; unsigned cav_misses; }; /** * avc_cache_stats - get cache access statistics. * @stats: reference to statistics structure * * Fill the supplied structure with information about AVC * activity since the last call to avc_init() or * avc_reset(). See the structure definition for * details. */ void avc_cache_stats(struct avc_cache_stats *stats); /** * avc_av_stats - log av table statistics. * * Log a message with information about the size and * distribution of the access vector table. The audit * callback is used to print the message. */ void avc_av_stats(void); /** * avc_sid_stats - log SID table statistics. * * Log a message with information about the size and * distribution of the SID table. The audit callback * is used to print the message. */ void avc_sid_stats(void); /** * avc_netlink_open - Create a netlink socket and connect to the kernel. */ int avc_netlink_open(int blocking); /** * avc_netlink_loop - Wait for netlink messages from the kernel */ void avc_netlink_loop(void); /** * avc_netlink_close - Close the netlink socket */ void avc_netlink_close(void); /** * avc_netlink_acquire_fd - Acquire netlink socket fd. * * Allows the application to manage messages from the netlink socket in * its own main loop. */ int avc_netlink_acquire_fd(void); /** * avc_netlink_release_fd - Release netlink socket fd. * * Returns ownership of the netlink socket to the library. */ void avc_netlink_release_fd(void); /** * avc_netlink_check_nb - Check netlink socket for new messages. * * Called by the application when using avc_netlink_acquire_fd() to * process kernel netlink events. */ int avc_netlink_check_nb(void); /** * selinux_status_open - Open and map SELinux kernel status page * */ int selinux_status_open(int fallback); /** * selinux_status_close - Unmap and close SELinux kernel status page * */ void selinux_status_close(void); /** * selinux_status_updated - Inform us whether the kernel status has been updated * */ int selinux_status_updated(void); /** * selinux_status_getenforce - Get the enforce flag value * */ int selinux_status_getenforce(void); /** * selinux_status_policyload - Get the number of policy reloaded * */ int selinux_status_policyload(void); /** * selinux_status_deny_unknown - Get the behavior for undefined classes/permissions * */ int selinux_status_deny_unknown(void); #ifdef __cplusplus } #endif #endif /* _SELINUX_AVC_H_ */ selinux/get_default_type.h000064400000001165147631660260011746 0ustar00/* get_default_type.h - contains header information and function prototypes * for functions to get the default type for a role */ #ifndef _SELINUX_GET_DEFAULT_TYPE_H_ #define _SELINUX_GET_DEFAULT_TYPE_H_ #ifdef __cplusplus extern "C" { #endif /* Return path to default type file. */ const char *selinux_default_type_path(void); /* Get the default type (domain) for 'role' and set 'type' to refer to it. Caller must free via free(). Return 0 on success or -1 otherwise. */ int get_default_type(const char *role, char **type); #ifdef __cplusplus } #endif #endif /* ifndef _GET_DEFAULT_TYPE_H_ */ selinux/av_permissions.h000064400000177420147631660260011473 0ustar00#warning "Please remove any #include of this header in your source code." #warning "Instead, use string_to_av_perm() to map the permission name to a value." /* This file is automatically generated. Do not edit. */ #define COMMON_FILE__IOCTL 0x00000001UL #define COMMON_FILE__READ 0x00000002UL #define COMMON_FILE__WRITE 0x00000004UL #define COMMON_FILE__CREATE 0x00000008UL #define COMMON_FILE__GETATTR 0x00000010UL #define COMMON_FILE__SETATTR 0x00000020UL #define COMMON_FILE__LOCK 0x00000040UL #define COMMON_FILE__RELABELFROM 0x00000080UL #define COMMON_FILE__RELABELTO 0x00000100UL #define COMMON_FILE__APPEND 0x00000200UL #define COMMON_FILE__UNLINK 0x00000400UL #define COMMON_FILE__LINK 0x00000800UL #define COMMON_FILE__RENAME 0x00001000UL #define COMMON_FILE__EXECUTE 0x00002000UL #define COMMON_FILE__SWAPON 0x00004000UL #define COMMON_FILE__QUOTAON 0x00008000UL #define COMMON_FILE__MOUNTON 0x00010000UL #define COMMON_SOCKET__IOCTL 0x00000001UL #define COMMON_SOCKET__READ 0x00000002UL #define COMMON_SOCKET__WRITE 0x00000004UL #define COMMON_SOCKET__CREATE 0x00000008UL #define COMMON_SOCKET__GETATTR 0x00000010UL #define COMMON_SOCKET__SETATTR 0x00000020UL #define COMMON_SOCKET__LOCK 0x00000040UL #define COMMON_SOCKET__RELABELFROM 0x00000080UL #define COMMON_SOCKET__RELABELTO 0x00000100UL #define COMMON_SOCKET__APPEND 0x00000200UL #define COMMON_SOCKET__BIND 0x00000400UL #define COMMON_SOCKET__CONNECT 0x00000800UL #define COMMON_SOCKET__LISTEN 0x00001000UL #define COMMON_SOCKET__ACCEPT 0x00002000UL #define COMMON_SOCKET__GETOPT 0x00004000UL #define COMMON_SOCKET__SETOPT 0x00008000UL #define COMMON_SOCKET__SHUTDOWN 0x00010000UL #define COMMON_SOCKET__RECVFROM 0x00020000UL #define COMMON_SOCKET__SENDTO 0x00040000UL #define COMMON_SOCKET__RECV_MSG 0x00080000UL #define COMMON_SOCKET__SEND_MSG 0x00100000UL #define COMMON_SOCKET__NAME_BIND 0x00200000UL #define COMMON_IPC__CREATE 0x00000001UL #define COMMON_IPC__DESTROY 0x00000002UL #define COMMON_IPC__GETATTR 0x00000004UL #define COMMON_IPC__SETATTR 0x00000008UL #define COMMON_IPC__READ 0x00000010UL #define COMMON_IPC__WRITE 0x00000020UL #define COMMON_IPC__ASSOCIATE 0x00000040UL #define COMMON_IPC__UNIX_READ 0x00000080UL #define COMMON_IPC__UNIX_WRITE 0x00000100UL #define COMMON_DATABASE__CREATE 0x00000001UL #define COMMON_DATABASE__DROP 0x00000002UL #define COMMON_DATABASE__GETATTR 0x00000004UL #define COMMON_DATABASE__SETATTR 0x00000008UL #define COMMON_DATABASE__RELABELFROM 0x00000010UL #define COMMON_DATABASE__RELABELTO 0x00000020UL #define FILESYSTEM__MOUNT 0x00000001UL #define FILESYSTEM__REMOUNT 0x00000002UL #define FILESYSTEM__UNMOUNT 0x00000004UL #define FILESYSTEM__GETATTR 0x00000008UL #define FILESYSTEM__RELABELFROM 0x00000010UL #define FILESYSTEM__RELABELTO 0x00000020UL #define FILESYSTEM__TRANSITION 0x00000040UL #define FILESYSTEM__ASSOCIATE 0x00000080UL #define FILESYSTEM__QUOTAMOD 0x00000100UL #define FILESYSTEM__QUOTAGET 0x00000200UL #define DIR__IOCTL 0x00000001UL #define DIR__READ 0x00000002UL #define DIR__WRITE 0x00000004UL #define DIR__CREATE 0x00000008UL #define DIR__GETATTR 0x00000010UL #define DIR__SETATTR 0x00000020UL #define DIR__LOCK 0x00000040UL #define DIR__RELABELFROM 0x00000080UL #define DIR__RELABELTO 0x00000100UL #define DIR__APPEND 0x00000200UL #define DIR__UNLINK 0x00000400UL #define DIR__LINK 0x00000800UL #define DIR__RENAME 0x00001000UL #define DIR__EXECUTE 0x00002000UL #define DIR__SWAPON 0x00004000UL #define DIR__QUOTAON 0x00008000UL #define DIR__MOUNTON 0x00010000UL #define DIR__ADD_NAME 0x00020000UL #define DIR__REMOVE_NAME 0x00040000UL #define DIR__REPARENT 0x00080000UL #define DIR__SEARCH 0x00100000UL #define DIR__RMDIR 0x00200000UL #define DIR__OPEN 0x00400000UL #define FILE__IOCTL 0x00000001UL #define FILE__READ 0x00000002UL #define FILE__WRITE 0x00000004UL #define FILE__CREATE 0x00000008UL #define FILE__GETATTR 0x00000010UL #define FILE__SETATTR 0x00000020UL #define FILE__LOCK 0x00000040UL #define FILE__RELABELFROM 0x00000080UL #define FILE__RELABELTO 0x00000100UL #define FILE__APPEND 0x00000200UL #define FILE__UNLINK 0x00000400UL #define FILE__LINK 0x00000800UL #define FILE__RENAME 0x00001000UL #define FILE__EXECUTE 0x00002000UL #define FILE__SWAPON 0x00004000UL #define FILE__QUOTAON 0x00008000UL #define FILE__MOUNTON 0x00010000UL #define FILE__EXECUTE_NO_TRANS 0x00020000UL #define FILE__ENTRYPOINT 0x00040000UL #define FILE__EXECMOD 0x00080000UL #define FILE__OPEN 0x00100000UL #define LNK_FILE__IOCTL 0x00000001UL #define LNK_FILE__READ 0x00000002UL #define LNK_FILE__WRITE 0x00000004UL #define LNK_FILE__CREATE 0x00000008UL #define LNK_FILE__GETATTR 0x00000010UL #define LNK_FILE__SETATTR 0x00000020UL #define LNK_FILE__LOCK 0x00000040UL #define LNK_FILE__RELABELFROM 0x00000080UL #define LNK_FILE__RELABELTO 0x00000100UL #define LNK_FILE__APPEND 0x00000200UL #define LNK_FILE__UNLINK 0x00000400UL #define LNK_FILE__LINK 0x00000800UL #define LNK_FILE__RENAME 0x00001000UL #define LNK_FILE__EXECUTE 0x00002000UL #define LNK_FILE__SWAPON 0x00004000UL #define LNK_FILE__QUOTAON 0x00008000UL #define LNK_FILE__MOUNTON 0x00010000UL #define CHR_FILE__IOCTL 0x00000001UL #define CHR_FILE__READ 0x00000002UL #define CHR_FILE__WRITE 0x00000004UL #define CHR_FILE__CREATE 0x00000008UL #define CHR_FILE__GETATTR 0x00000010UL #define CHR_FILE__SETATTR 0x00000020UL #define CHR_FILE__LOCK 0x00000040UL #define CHR_FILE__RELABELFROM 0x00000080UL #define CHR_FILE__RELABELTO 0x00000100UL #define CHR_FILE__APPEND 0x00000200UL #define CHR_FILE__UNLINK 0x00000400UL #define CHR_FILE__LINK 0x00000800UL #define CHR_FILE__RENAME 0x00001000UL #define CHR_FILE__EXECUTE 0x00002000UL #define CHR_FILE__SWAPON 0x00004000UL #define CHR_FILE__QUOTAON 0x00008000UL #define CHR_FILE__MOUNTON 0x00010000UL #define CHR_FILE__EXECUTE_NO_TRANS 0x00020000UL #define CHR_FILE__ENTRYPOINT 0x00040000UL #define CHR_FILE__EXECMOD 0x00080000UL #define CHR_FILE__OPEN 0x00100000UL #define BLK_FILE__IOCTL 0x00000001UL #define BLK_FILE__READ 0x00000002UL #define BLK_FILE__WRITE 0x00000004UL #define BLK_FILE__CREATE 0x00000008UL #define BLK_FILE__GETATTR 0x00000010UL #define BLK_FILE__SETATTR 0x00000020UL #define BLK_FILE__LOCK 0x00000040UL #define BLK_FILE__RELABELFROM 0x00000080UL #define BLK_FILE__RELABELTO 0x00000100UL #define BLK_FILE__APPEND 0x00000200UL #define BLK_FILE__UNLINK 0x00000400UL #define BLK_FILE__LINK 0x00000800UL #define BLK_FILE__RENAME 0x00001000UL #define BLK_FILE__EXECUTE 0x00002000UL #define BLK_FILE__SWAPON 0x00004000UL #define BLK_FILE__QUOTAON 0x00008000UL #define BLK_FILE__MOUNTON 0x00010000UL #define BLK_FILE__OPEN 0x00020000UL #define SOCK_FILE__IOCTL 0x00000001UL #define SOCK_FILE__READ 0x00000002UL #define SOCK_FILE__WRITE 0x00000004UL #define SOCK_FILE__CREATE 0x00000008UL #define SOCK_FILE__GETATTR 0x00000010UL #define SOCK_FILE__SETATTR 0x00000020UL #define SOCK_FILE__LOCK 0x00000040UL #define SOCK_FILE__RELABELFROM 0x00000080UL #define SOCK_FILE__RELABELTO 0x00000100UL #define SOCK_FILE__APPEND 0x00000200UL #define SOCK_FILE__UNLINK 0x00000400UL #define SOCK_FILE__LINK 0x00000800UL #define SOCK_FILE__RENAME 0x00001000UL #define SOCK_FILE__EXECUTE 0x00002000UL #define SOCK_FILE__SWAPON 0x00004000UL #define SOCK_FILE__QUOTAON 0x00008000UL #define SOCK_FILE__MOUNTON 0x00010000UL #define FIFO_FILE__IOCTL 0x00000001UL #define FIFO_FILE__READ 0x00000002UL #define FIFO_FILE__WRITE 0x00000004UL #define FIFO_FILE__CREATE 0x00000008UL #define FIFO_FILE__GETATTR 0x00000010UL #define FIFO_FILE__SETATTR 0x00000020UL #define FIFO_FILE__LOCK 0x00000040UL #define FIFO_FILE__RELABELFROM 0x00000080UL #define FIFO_FILE__RELABELTO 0x00000100UL #define FIFO_FILE__APPEND 0x00000200UL #define FIFO_FILE__UNLINK 0x00000400UL #define FIFO_FILE__LINK 0x00000800UL #define FIFO_FILE__RENAME 0x00001000UL #define FIFO_FILE__EXECUTE 0x00002000UL #define FIFO_FILE__SWAPON 0x00004000UL #define FIFO_FILE__QUOTAON 0x00008000UL #define FIFO_FILE__MOUNTON 0x00010000UL #define FIFO_FILE__OPEN 0x00020000UL #define FD__USE 0x00000001UL #define SOCKET__IOCTL 0x00000001UL #define SOCKET__READ 0x00000002UL #define SOCKET__WRITE 0x00000004UL #define SOCKET__CREATE 0x00000008UL #define SOCKET__GETATTR 0x00000010UL #define SOCKET__SETATTR 0x00000020UL #define SOCKET__LOCK 0x00000040UL #define SOCKET__RELABELFROM 0x00000080UL #define SOCKET__RELABELTO 0x00000100UL #define SOCKET__APPEND 0x00000200UL #define SOCKET__BIND 0x00000400UL #define SOCKET__CONNECT 0x00000800UL #define SOCKET__LISTEN 0x00001000UL #define SOCKET__ACCEPT 0x00002000UL #define SOCKET__GETOPT 0x00004000UL #define SOCKET__SETOPT 0x00008000UL #define SOCKET__SHUTDOWN 0x00010000UL #define SOCKET__RECVFROM 0x00020000UL #define SOCKET__SENDTO 0x00040000UL #define SOCKET__RECV_MSG 0x00080000UL #define SOCKET__SEND_MSG 0x00100000UL #define SOCKET__NAME_BIND 0x00200000UL #define TCP_SOCKET__IOCTL 0x00000001UL #define TCP_SOCKET__READ 0x00000002UL #define TCP_SOCKET__WRITE 0x00000004UL #define TCP_SOCKET__CREATE 0x00000008UL #define TCP_SOCKET__GETATTR 0x00000010UL #define TCP_SOCKET__SETATTR 0x00000020UL #define TCP_SOCKET__LOCK 0x00000040UL #define TCP_SOCKET__RELABELFROM 0x00000080UL #define TCP_SOCKET__RELABELTO 0x00000100UL #define TCP_SOCKET__APPEND 0x00000200UL #define TCP_SOCKET__BIND 0x00000400UL #define TCP_SOCKET__CONNECT 0x00000800UL #define TCP_SOCKET__LISTEN 0x00001000UL #define TCP_SOCKET__ACCEPT 0x00002000UL #define TCP_SOCKET__GETOPT 0x00004000UL #define TCP_SOCKET__SETOPT 0x00008000UL #define TCP_SOCKET__SHUTDOWN 0x00010000UL #define TCP_SOCKET__RECVFROM 0x00020000UL #define TCP_SOCKET__SENDTO 0x00040000UL #define TCP_SOCKET__RECV_MSG 0x00080000UL #define TCP_SOCKET__SEND_MSG 0x00100000UL #define TCP_SOCKET__NAME_BIND 0x00200000UL #define TCP_SOCKET__CONNECTTO 0x00400000UL #define TCP_SOCKET__NEWCONN 0x00800000UL #define TCP_SOCKET__ACCEPTFROM 0x01000000UL #define TCP_SOCKET__NODE_BIND 0x02000000UL #define TCP_SOCKET__NAME_CONNECT 0x04000000UL #define UDP_SOCKET__IOCTL 0x00000001UL #define UDP_SOCKET__READ 0x00000002UL #define UDP_SOCKET__WRITE 0x00000004UL #define UDP_SOCKET__CREATE 0x00000008UL #define UDP_SOCKET__GETATTR 0x00000010UL #define UDP_SOCKET__SETATTR 0x00000020UL #define UDP_SOCKET__LOCK 0x00000040UL #define UDP_SOCKET__RELABELFROM 0x00000080UL #define UDP_SOCKET__RELABELTO 0x00000100UL #define UDP_SOCKET__APPEND 0x00000200UL #define UDP_SOCKET__BIND 0x00000400UL #define UDP_SOCKET__CONNECT 0x00000800UL #define UDP_SOCKET__LISTEN 0x00001000UL #define UDP_SOCKET__ACCEPT 0x00002000UL #define UDP_SOCKET__GETOPT 0x00004000UL #define UDP_SOCKET__SETOPT 0x00008000UL #define UDP_SOCKET__SHUTDOWN 0x00010000UL #define UDP_SOCKET__RECVFROM 0x00020000UL #define UDP_SOCKET__SENDTO 0x00040000UL #define UDP_SOCKET__RECV_MSG 0x00080000UL #define UDP_SOCKET__SEND_MSG 0x00100000UL #define UDP_SOCKET__NAME_BIND 0x00200000UL #define UDP_SOCKET__NODE_BIND 0x00400000UL #define RAWIP_SOCKET__IOCTL 0x00000001UL #define RAWIP_SOCKET__READ 0x00000002UL #define RAWIP_SOCKET__WRITE 0x00000004UL #define RAWIP_SOCKET__CREATE 0x00000008UL #define RAWIP_SOCKET__GETATTR 0x00000010UL #define RAWIP_SOCKET__SETATTR 0x00000020UL #define RAWIP_SOCKET__LOCK 0x00000040UL #define RAWIP_SOCKET__RELABELFROM 0x00000080UL #define RAWIP_SOCKET__RELABELTO 0x00000100UL #define RAWIP_SOCKET__APPEND 0x00000200UL #define RAWIP_SOCKET__BIND 0x00000400UL #define RAWIP_SOCKET__CONNECT 0x00000800UL #define RAWIP_SOCKET__LISTEN 0x00001000UL #define RAWIP_SOCKET__ACCEPT 0x00002000UL #define RAWIP_SOCKET__GETOPT 0x00004000UL #define RAWIP_SOCKET__SETOPT 0x00008000UL #define RAWIP_SOCKET__SHUTDOWN 0x00010000UL #define RAWIP_SOCKET__RECVFROM 0x00020000UL #define RAWIP_SOCKET__SENDTO 0x00040000UL #define RAWIP_SOCKET__RECV_MSG 0x00080000UL #define RAWIP_SOCKET__SEND_MSG 0x00100000UL #define RAWIP_SOCKET__NAME_BIND 0x00200000UL #define RAWIP_SOCKET__NODE_BIND 0x00400000UL #define NODE__TCP_RECV 0x00000001UL #define NODE__TCP_SEND 0x00000002UL #define NODE__UDP_RECV 0x00000004UL #define NODE__UDP_SEND 0x00000008UL #define NODE__RAWIP_RECV 0x00000010UL #define NODE__RAWIP_SEND 0x00000020UL #define NODE__ENFORCE_DEST 0x00000040UL #define NODE__DCCP_RECV 0x00000080UL #define NODE__DCCP_SEND 0x00000100UL #define NODE__RECVFROM 0x00000200UL #define NODE__SENDTO 0x00000400UL #define NETIF__TCP_RECV 0x00000001UL #define NETIF__TCP_SEND 0x00000002UL #define NETIF__UDP_RECV 0x00000004UL #define NETIF__UDP_SEND 0x00000008UL #define NETIF__RAWIP_RECV 0x00000010UL #define NETIF__RAWIP_SEND 0x00000020UL #define NETIF__DCCP_RECV 0x00000040UL #define NETIF__DCCP_SEND 0x00000080UL #define NETIF__INGRESS 0x00000100UL #define NETIF__EGRESS 0x00000200UL #define NETLINK_SOCKET__IOCTL 0x00000001UL #define NETLINK_SOCKET__READ 0x00000002UL #define NETLINK_SOCKET__WRITE 0x00000004UL #define NETLINK_SOCKET__CREATE 0x00000008UL #define NETLINK_SOCKET__GETATTR 0x00000010UL #define NETLINK_SOCKET__SETATTR 0x00000020UL #define NETLINK_SOCKET__LOCK 0x00000040UL #define NETLINK_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_SOCKET__RELABELTO 0x00000100UL #define NETLINK_SOCKET__APPEND 0x00000200UL #define NETLINK_SOCKET__BIND 0x00000400UL #define NETLINK_SOCKET__CONNECT 0x00000800UL #define NETLINK_SOCKET__LISTEN 0x00001000UL #define NETLINK_SOCKET__ACCEPT 0x00002000UL #define NETLINK_SOCKET__GETOPT 0x00004000UL #define NETLINK_SOCKET__SETOPT 0x00008000UL #define NETLINK_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_SOCKET__RECVFROM 0x00020000UL #define NETLINK_SOCKET__SENDTO 0x00040000UL #define NETLINK_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_SOCKET__NAME_BIND 0x00200000UL #define PACKET_SOCKET__IOCTL 0x00000001UL #define PACKET_SOCKET__READ 0x00000002UL #define PACKET_SOCKET__WRITE 0x00000004UL #define PACKET_SOCKET__CREATE 0x00000008UL #define PACKET_SOCKET__GETATTR 0x00000010UL #define PACKET_SOCKET__SETATTR 0x00000020UL #define PACKET_SOCKET__LOCK 0x00000040UL #define PACKET_SOCKET__RELABELFROM 0x00000080UL #define PACKET_SOCKET__RELABELTO 0x00000100UL #define PACKET_SOCKET__APPEND 0x00000200UL #define PACKET_SOCKET__BIND 0x00000400UL #define PACKET_SOCKET__CONNECT 0x00000800UL #define PACKET_SOCKET__LISTEN 0x00001000UL #define PACKET_SOCKET__ACCEPT 0x00002000UL #define PACKET_SOCKET__GETOPT 0x00004000UL #define PACKET_SOCKET__SETOPT 0x00008000UL #define PACKET_SOCKET__SHUTDOWN 0x00010000UL #define PACKET_SOCKET__RECVFROM 0x00020000UL #define PACKET_SOCKET__SENDTO 0x00040000UL #define PACKET_SOCKET__RECV_MSG 0x00080000UL #define PACKET_SOCKET__SEND_MSG 0x00100000UL #define PACKET_SOCKET__NAME_BIND 0x00200000UL #define KEY_SOCKET__IOCTL 0x00000001UL #define KEY_SOCKET__READ 0x00000002UL #define KEY_SOCKET__WRITE 0x00000004UL #define KEY_SOCKET__CREATE 0x00000008UL #define KEY_SOCKET__GETATTR 0x00000010UL #define KEY_SOCKET__SETATTR 0x00000020UL #define KEY_SOCKET__LOCK 0x00000040UL #define KEY_SOCKET__RELABELFROM 0x00000080UL #define KEY_SOCKET__RELABELTO 0x00000100UL #define KEY_SOCKET__APPEND 0x00000200UL #define KEY_SOCKET__BIND 0x00000400UL #define KEY_SOCKET__CONNECT 0x00000800UL #define KEY_SOCKET__LISTEN 0x00001000UL #define KEY_SOCKET__ACCEPT 0x00002000UL #define KEY_SOCKET__GETOPT 0x00004000UL #define KEY_SOCKET__SETOPT 0x00008000UL #define KEY_SOCKET__SHUTDOWN 0x00010000UL #define KEY_SOCKET__RECVFROM 0x00020000UL #define KEY_SOCKET__SENDTO 0x00040000UL #define KEY_SOCKET__RECV_MSG 0x00080000UL #define KEY_SOCKET__SEND_MSG 0x00100000UL #define KEY_SOCKET__NAME_BIND 0x00200000UL #define UNIX_STREAM_SOCKET__IOCTL 0x00000001UL #define UNIX_STREAM_SOCKET__READ 0x00000002UL #define UNIX_STREAM_SOCKET__WRITE 0x00000004UL #define UNIX_STREAM_SOCKET__CREATE 0x00000008UL #define UNIX_STREAM_SOCKET__GETATTR 0x00000010UL #define UNIX_STREAM_SOCKET__SETATTR 0x00000020UL #define UNIX_STREAM_SOCKET__LOCK 0x00000040UL #define UNIX_STREAM_SOCKET__RELABELFROM 0x00000080UL #define UNIX_STREAM_SOCKET__RELABELTO 0x00000100UL #define UNIX_STREAM_SOCKET__APPEND 0x00000200UL #define UNIX_STREAM_SOCKET__BIND 0x00000400UL #define UNIX_STREAM_SOCKET__CONNECT 0x00000800UL #define UNIX_STREAM_SOCKET__LISTEN 0x00001000UL #define UNIX_STREAM_SOCKET__ACCEPT 0x00002000UL #define UNIX_STREAM_SOCKET__GETOPT 0x00004000UL #define UNIX_STREAM_SOCKET__SETOPT 0x00008000UL #define UNIX_STREAM_SOCKET__SHUTDOWN 0x00010000UL #define UNIX_STREAM_SOCKET__RECVFROM 0x00020000UL #define UNIX_STREAM_SOCKET__SENDTO 0x00040000UL #define UNIX_STREAM_SOCKET__RECV_MSG 0x00080000UL #define UNIX_STREAM_SOCKET__SEND_MSG 0x00100000UL #define UNIX_STREAM_SOCKET__NAME_BIND 0x00200000UL #define UNIX_STREAM_SOCKET__CONNECTTO 0x00400000UL #define UNIX_STREAM_SOCKET__NEWCONN 0x00800000UL #define UNIX_STREAM_SOCKET__ACCEPTFROM 0x01000000UL #define UNIX_DGRAM_SOCKET__IOCTL 0x00000001UL #define UNIX_DGRAM_SOCKET__READ 0x00000002UL #define UNIX_DGRAM_SOCKET__WRITE 0x00000004UL #define UNIX_DGRAM_SOCKET__CREATE 0x00000008UL #define UNIX_DGRAM_SOCKET__GETATTR 0x00000010UL #define UNIX_DGRAM_SOCKET__SETATTR 0x00000020UL #define UNIX_DGRAM_SOCKET__LOCK 0x00000040UL #define UNIX_DGRAM_SOCKET__RELABELFROM 0x00000080UL #define UNIX_DGRAM_SOCKET__RELABELTO 0x00000100UL #define UNIX_DGRAM_SOCKET__APPEND 0x00000200UL #define UNIX_DGRAM_SOCKET__BIND 0x00000400UL #define UNIX_DGRAM_SOCKET__CONNECT 0x00000800UL #define UNIX_DGRAM_SOCKET__LISTEN 0x00001000UL #define UNIX_DGRAM_SOCKET__ACCEPT 0x00002000UL #define UNIX_DGRAM_SOCKET__GETOPT 0x00004000UL #define UNIX_DGRAM_SOCKET__SETOPT 0x00008000UL #define UNIX_DGRAM_SOCKET__SHUTDOWN 0x00010000UL #define UNIX_DGRAM_SOCKET__RECVFROM 0x00020000UL #define UNIX_DGRAM_SOCKET__SENDTO 0x00040000UL #define UNIX_DGRAM_SOCKET__RECV_MSG 0x00080000UL #define UNIX_DGRAM_SOCKET__SEND_MSG 0x00100000UL #define UNIX_DGRAM_SOCKET__NAME_BIND 0x00200000UL #define PROCESS__FORK 0x00000001UL #define PROCESS__TRANSITION 0x00000002UL #define PROCESS__SIGCHLD 0x00000004UL #define PROCESS__SIGKILL 0x00000008UL #define PROCESS__SIGSTOP 0x00000010UL #define PROCESS__SIGNULL 0x00000020UL #define PROCESS__SIGNAL 0x00000040UL #define PROCESS__PTRACE 0x00000080UL #define PROCESS__GETSCHED 0x00000100UL #define PROCESS__SETSCHED 0x00000200UL #define PROCESS__GETSESSION 0x00000400UL #define PROCESS__GETPGID 0x00000800UL #define PROCESS__SETPGID 0x00001000UL #define PROCESS__GETCAP 0x00002000UL #define PROCESS__SETCAP 0x00004000UL #define PROCESS__SHARE 0x00008000UL #define PROCESS__GETATTR 0x00010000UL #define PROCESS__SETEXEC 0x00020000UL #define PROCESS__SETFSCREATE 0x00040000UL #define PROCESS__NOATSECURE 0x00080000UL #define PROCESS__SIGINH 0x00100000UL #define PROCESS__SETRLIMIT 0x00200000UL #define PROCESS__RLIMITINH 0x00400000UL #define PROCESS__DYNTRANSITION 0x00800000UL #define PROCESS__SETCURRENT 0x01000000UL #define PROCESS__EXECMEM 0x02000000UL #define PROCESS__EXECSTACK 0x04000000UL #define PROCESS__EXECHEAP 0x08000000UL #define PROCESS__SETKEYCREATE 0x10000000UL #define PROCESS__SETSOCKCREATE 0x20000000UL #define IPC__CREATE 0x00000001UL #define IPC__DESTROY 0x00000002UL #define IPC__GETATTR 0x00000004UL #define IPC__SETATTR 0x00000008UL #define IPC__READ 0x00000010UL #define IPC__WRITE 0x00000020UL #define IPC__ASSOCIATE 0x00000040UL #define IPC__UNIX_READ 0x00000080UL #define IPC__UNIX_WRITE 0x00000100UL #define SEM__CREATE 0x00000001UL #define SEM__DESTROY 0x00000002UL #define SEM__GETATTR 0x00000004UL #define SEM__SETATTR 0x00000008UL #define SEM__READ 0x00000010UL #define SEM__WRITE 0x00000020UL #define SEM__ASSOCIATE 0x00000040UL #define SEM__UNIX_READ 0x00000080UL #define SEM__UNIX_WRITE 0x00000100UL #define MSGQ__CREATE 0x00000001UL #define MSGQ__DESTROY 0x00000002UL #define MSGQ__GETATTR 0x00000004UL #define MSGQ__SETATTR 0x00000008UL #define MSGQ__READ 0x00000010UL #define MSGQ__WRITE 0x00000020UL #define MSGQ__ASSOCIATE 0x00000040UL #define MSGQ__UNIX_READ 0x00000080UL #define MSGQ__UNIX_WRITE 0x00000100UL #define MSGQ__ENQUEUE 0x00000200UL #define MSG__SEND 0x00000001UL #define MSG__RECEIVE 0x00000002UL #define SHM__CREATE 0x00000001UL #define SHM__DESTROY 0x00000002UL #define SHM__GETATTR 0x00000004UL #define SHM__SETATTR 0x00000008UL #define SHM__READ 0x00000010UL #define SHM__WRITE 0x00000020UL #define SHM__ASSOCIATE 0x00000040UL #define SHM__UNIX_READ 0x00000080UL #define SHM__UNIX_WRITE 0x00000100UL #define SHM__LOCK 0x00000200UL #define SECURITY__COMPUTE_AV 0x00000001UL #define SECURITY__COMPUTE_CREATE 0x00000002UL #define SECURITY__COMPUTE_MEMBER 0x00000004UL #define SECURITY__CHECK_CONTEXT 0x00000008UL #define SECURITY__LOAD_POLICY 0x00000010UL #define SECURITY__COMPUTE_RELABEL 0x00000020UL #define SECURITY__COMPUTE_USER 0x00000040UL #define SECURITY__SETENFORCE 0x00000080UL #define SECURITY__SETBOOL 0x00000100UL #define SECURITY__SETSECPARAM 0x00000200UL #define SECURITY__SETCHECKREQPROT 0x00000400UL #define SYSTEM__IPC_INFO 0x00000001UL #define SYSTEM__SYSLOG_READ 0x00000002UL #define SYSTEM__SYSLOG_MOD 0x00000004UL #define SYSTEM__SYSLOG_CONSOLE 0x00000008UL #define CAPABILITY__CHOWN 0x00000001UL #define CAPABILITY__DAC_OVERRIDE 0x00000002UL #define CAPABILITY__DAC_READ_SEARCH 0x00000004UL #define CAPABILITY__FOWNER 0x00000008UL #define CAPABILITY__FSETID 0x00000010UL #define CAPABILITY__KILL 0x00000020UL #define CAPABILITY__SETGID 0x00000040UL #define CAPABILITY__SETUID 0x00000080UL #define CAPABILITY__SETPCAP 0x00000100UL #define CAPABILITY__LINUX_IMMUTABLE 0x00000200UL #define CAPABILITY__NET_BIND_SERVICE 0x00000400UL #define CAPABILITY__NET_BROADCAST 0x00000800UL #define CAPABILITY__NET_ADMIN 0x00001000UL #define CAPABILITY__NET_RAW 0x00002000UL #define CAPABILITY__IPC_LOCK 0x00004000UL #define CAPABILITY__IPC_OWNER 0x00008000UL #define CAPABILITY__SYS_MODULE 0x00010000UL #define CAPABILITY__SYS_RAWIO 0x00020000UL #define CAPABILITY__SYS_CHROOT 0x00040000UL #define CAPABILITY__SYS_PTRACE 0x00080000UL #define CAPABILITY__SYS_PACCT 0x00100000UL #define CAPABILITY__SYS_ADMIN 0x00200000UL #define CAPABILITY__SYS_BOOT 0x00400000UL #define CAPABILITY__SYS_NICE 0x00800000UL #define CAPABILITY__SYS_RESOURCE 0x01000000UL #define CAPABILITY__SYS_TIME 0x02000000UL #define CAPABILITY__SYS_TTY_CONFIG 0x04000000UL #define CAPABILITY__MKNOD 0x08000000UL #define CAPABILITY__LEASE 0x10000000UL #define CAPABILITY__AUDIT_WRITE 0x20000000UL #define CAPABILITY__AUDIT_CONTROL 0x40000000UL #define CAPABILITY__SETFCAP 0x80000000UL #define CAPABILITY2__MAC_OVERRIDE 0x00000001UL #define CAPABILITY2__MAC_ADMIN 0x00000002UL #define PASSWD__PASSWD 0x00000001UL #define PASSWD__CHFN 0x00000002UL #define PASSWD__CHSH 0x00000004UL #define PASSWD__ROOTOK 0x00000008UL #define PASSWD__CRONTAB 0x00000010UL #define X_DRAWABLE__CREATE 0x00000001UL #define X_DRAWABLE__DESTROY 0x00000002UL #define X_DRAWABLE__READ 0x00000004UL #define X_DRAWABLE__WRITE 0x00000008UL #define X_DRAWABLE__BLEND 0x00000010UL #define X_DRAWABLE__GETATTR 0x00000020UL #define X_DRAWABLE__SETATTR 0x00000040UL #define X_DRAWABLE__LIST_CHILD 0x00000080UL #define X_DRAWABLE__ADD_CHILD 0x00000100UL #define X_DRAWABLE__REMOVE_CHILD 0x00000200UL #define X_DRAWABLE__LIST_PROPERTY 0x00000400UL #define X_DRAWABLE__GET_PROPERTY 0x00000800UL #define X_DRAWABLE__SET_PROPERTY 0x00001000UL #define X_DRAWABLE__MANAGE 0x00002000UL #define X_DRAWABLE__OVERRIDE 0x00004000UL #define X_DRAWABLE__SHOW 0x00008000UL #define X_DRAWABLE__HIDE 0x00010000UL #define X_DRAWABLE__SEND 0x00020000UL #define X_DRAWABLE__RECEIVE 0x00040000UL #define X_SCREEN__GETATTR 0x00000001UL #define X_SCREEN__SETATTR 0x00000002UL #define X_SCREEN__HIDE_CURSOR 0x00000004UL #define X_SCREEN__SHOW_CURSOR 0x00000008UL #define X_SCREEN__SAVER_GETATTR 0x00000010UL #define X_SCREEN__SAVER_SETATTR 0x00000020UL #define X_SCREEN__SAVER_HIDE 0x00000040UL #define X_SCREEN__SAVER_SHOW 0x00000080UL #define X_GC__CREATE 0x00000001UL #define X_GC__DESTROY 0x00000002UL #define X_GC__GETATTR 0x00000004UL #define X_GC__SETATTR 0x00000008UL #define X_GC__USE 0x00000010UL #define X_FONT__CREATE 0x00000001UL #define X_FONT__DESTROY 0x00000002UL #define X_FONT__GETATTR 0x00000004UL #define X_FONT__ADD_GLYPH 0x00000008UL #define X_FONT__REMOVE_GLYPH 0x00000010UL #define X_FONT__USE 0x00000020UL #define X_COLORMAP__CREATE 0x00000001UL #define X_COLORMAP__DESTROY 0x00000002UL #define X_COLORMAP__READ 0x00000004UL #define X_COLORMAP__WRITE 0x00000008UL #define X_COLORMAP__GETATTR 0x00000010UL #define X_COLORMAP__ADD_COLOR 0x00000020UL #define X_COLORMAP__REMOVE_COLOR 0x00000040UL #define X_COLORMAP__INSTALL 0x00000080UL #define X_COLORMAP__UNINSTALL 0x00000100UL #define X_COLORMAP__USE 0x00000200UL #define X_PROPERTY__CREATE 0x00000001UL #define X_PROPERTY__DESTROY 0x00000002UL #define X_PROPERTY__READ 0x00000004UL #define X_PROPERTY__WRITE 0x00000008UL #define X_PROPERTY__APPEND 0x00000010UL #define X_PROPERTY__GETATTR 0x00000020UL #define X_PROPERTY__SETATTR 0x00000040UL #define X_SELECTION__READ 0x00000001UL #define X_SELECTION__WRITE 0x00000002UL #define X_SELECTION__GETATTR 0x00000004UL #define X_SELECTION__SETATTR 0x00000008UL #define X_CURSOR__CREATE 0x00000001UL #define X_CURSOR__DESTROY 0x00000002UL #define X_CURSOR__READ 0x00000004UL #define X_CURSOR__WRITE 0x00000008UL #define X_CURSOR__GETATTR 0x00000010UL #define X_CURSOR__SETATTR 0x00000020UL #define X_CURSOR__USE 0x00000040UL #define X_CLIENT__DESTROY 0x00000001UL #define X_CLIENT__GETATTR 0x00000002UL #define X_CLIENT__SETATTR 0x00000004UL #define X_CLIENT__MANAGE 0x00000008UL #define X_DEVICE__GETATTR 0x00000001UL #define X_DEVICE__SETATTR 0x00000002UL #define X_DEVICE__USE 0x00000004UL #define X_DEVICE__READ 0x00000008UL #define X_DEVICE__WRITE 0x00000010UL #define X_DEVICE__GETFOCUS 0x00000020UL #define X_DEVICE__SETFOCUS 0x00000040UL #define X_DEVICE__BELL 0x00000080UL #define X_DEVICE__FORCE_CURSOR 0x00000100UL #define X_DEVICE__FREEZE 0x00000200UL #define X_DEVICE__GRAB 0x00000400UL #define X_DEVICE__MANAGE 0x00000800UL #define X_SERVER__GETATTR 0x00000001UL #define X_SERVER__SETATTR 0x00000002UL #define X_SERVER__RECORD 0x00000004UL #define X_SERVER__DEBUG 0x00000008UL #define X_SERVER__GRAB 0x00000010UL #define X_SERVER__MANAGE 0x00000020UL #define X_EXTENSION__QUERY 0x00000001UL #define X_EXTENSION__USE 0x00000002UL #define X_RESOURCE__READ 0x00000001UL #define X_RESOURCE__WRITE 0x00000002UL #define X_EVENT__SEND 0x00000001UL #define X_EVENT__RECEIVE 0x00000002UL #define X_SYNTHETIC_EVENT__SEND 0x00000001UL #define X_SYNTHETIC_EVENT__RECEIVE 0x00000002UL #define NETLINK_ROUTE_SOCKET__IOCTL 0x00000001UL #define NETLINK_ROUTE_SOCKET__READ 0x00000002UL #define NETLINK_ROUTE_SOCKET__WRITE 0x00000004UL #define NETLINK_ROUTE_SOCKET__CREATE 0x00000008UL #define NETLINK_ROUTE_SOCKET__GETATTR 0x00000010UL #define NETLINK_ROUTE_SOCKET__SETATTR 0x00000020UL #define NETLINK_ROUTE_SOCKET__LOCK 0x00000040UL #define NETLINK_ROUTE_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_ROUTE_SOCKET__RELABELTO 0x00000100UL #define NETLINK_ROUTE_SOCKET__APPEND 0x00000200UL #define NETLINK_ROUTE_SOCKET__BIND 0x00000400UL #define NETLINK_ROUTE_SOCKET__CONNECT 0x00000800UL #define NETLINK_ROUTE_SOCKET__LISTEN 0x00001000UL #define NETLINK_ROUTE_SOCKET__ACCEPT 0x00002000UL #define NETLINK_ROUTE_SOCKET__GETOPT 0x00004000UL #define NETLINK_ROUTE_SOCKET__SETOPT 0x00008000UL #define NETLINK_ROUTE_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_ROUTE_SOCKET__RECVFROM 0x00020000UL #define NETLINK_ROUTE_SOCKET__SENDTO 0x00040000UL #define NETLINK_ROUTE_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_ROUTE_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_ROUTE_SOCKET__NAME_BIND 0x00200000UL #define NETLINK_ROUTE_SOCKET__NLMSG_READ 0x00400000UL #define NETLINK_ROUTE_SOCKET__NLMSG_WRITE 0x00800000UL #define NETLINK_FIREWALL_SOCKET__IOCTL 0x00000001UL #define NETLINK_FIREWALL_SOCKET__READ 0x00000002UL #define NETLINK_FIREWALL_SOCKET__WRITE 0x00000004UL #define NETLINK_FIREWALL_SOCKET__CREATE 0x00000008UL #define NETLINK_FIREWALL_SOCKET__GETATTR 0x00000010UL #define NETLINK_FIREWALL_SOCKET__SETATTR 0x00000020UL #define NETLINK_FIREWALL_SOCKET__LOCK 0x00000040UL #define NETLINK_FIREWALL_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_FIREWALL_SOCKET__RELABELTO 0x00000100UL #define NETLINK_FIREWALL_SOCKET__APPEND 0x00000200UL #define NETLINK_FIREWALL_SOCKET__BIND 0x00000400UL #define NETLINK_FIREWALL_SOCKET__CONNECT 0x00000800UL #define NETLINK_FIREWALL_SOCKET__LISTEN 0x00001000UL #define NETLINK_FIREWALL_SOCKET__ACCEPT 0x00002000UL #define NETLINK_FIREWALL_SOCKET__GETOPT 0x00004000UL #define NETLINK_FIREWALL_SOCKET__SETOPT 0x00008000UL #define NETLINK_FIREWALL_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_FIREWALL_SOCKET__RECVFROM 0x00020000UL #define NETLINK_FIREWALL_SOCKET__SENDTO 0x00040000UL #define NETLINK_FIREWALL_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_FIREWALL_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_FIREWALL_SOCKET__NAME_BIND 0x00200000UL #define NETLINK_FIREWALL_SOCKET__NLMSG_READ 0x00400000UL #define NETLINK_FIREWALL_SOCKET__NLMSG_WRITE 0x00800000UL #define NETLINK_TCPDIAG_SOCKET__IOCTL 0x00000001UL #define NETLINK_TCPDIAG_SOCKET__READ 0x00000002UL #define NETLINK_TCPDIAG_SOCKET__WRITE 0x00000004UL #define NETLINK_TCPDIAG_SOCKET__CREATE 0x00000008UL #define NETLINK_TCPDIAG_SOCKET__GETATTR 0x00000010UL #define NETLINK_TCPDIAG_SOCKET__SETATTR 0x00000020UL #define NETLINK_TCPDIAG_SOCKET__LOCK 0x00000040UL #define NETLINK_TCPDIAG_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_TCPDIAG_SOCKET__RELABELTO 0x00000100UL #define NETLINK_TCPDIAG_SOCKET__APPEND 0x00000200UL #define NETLINK_TCPDIAG_SOCKET__BIND 0x00000400UL #define NETLINK_TCPDIAG_SOCKET__CONNECT 0x00000800UL #define NETLINK_TCPDIAG_SOCKET__LISTEN 0x00001000UL #define NETLINK_TCPDIAG_SOCKET__ACCEPT 0x00002000UL #define NETLINK_TCPDIAG_SOCKET__GETOPT 0x00004000UL #define NETLINK_TCPDIAG_SOCKET__SETOPT 0x00008000UL #define NETLINK_TCPDIAG_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_TCPDIAG_SOCKET__RECVFROM 0x00020000UL #define NETLINK_TCPDIAG_SOCKET__SENDTO 0x00040000UL #define NETLINK_TCPDIAG_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_TCPDIAG_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_TCPDIAG_SOCKET__NAME_BIND 0x00200000UL #define NETLINK_TCPDIAG_SOCKET__NLMSG_READ 0x00400000UL #define NETLINK_TCPDIAG_SOCKET__NLMSG_WRITE 0x00800000UL #define NETLINK_NFLOG_SOCKET__IOCTL 0x00000001UL #define NETLINK_NFLOG_SOCKET__READ 0x00000002UL #define NETLINK_NFLOG_SOCKET__WRITE 0x00000004UL #define NETLINK_NFLOG_SOCKET__CREATE 0x00000008UL #define NETLINK_NFLOG_SOCKET__GETATTR 0x00000010UL #define NETLINK_NFLOG_SOCKET__SETATTR 0x00000020UL #define NETLINK_NFLOG_SOCKET__LOCK 0x00000040UL #define NETLINK_NFLOG_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_NFLOG_SOCKET__RELABELTO 0x00000100UL #define NETLINK_NFLOG_SOCKET__APPEND 0x00000200UL #define NETLINK_NFLOG_SOCKET__BIND 0x00000400UL #define NETLINK_NFLOG_SOCKET__CONNECT 0x00000800UL #define NETLINK_NFLOG_SOCKET__LISTEN 0x00001000UL #define NETLINK_NFLOG_SOCKET__ACCEPT 0x00002000UL #define NETLINK_NFLOG_SOCKET__GETOPT 0x00004000UL #define NETLINK_NFLOG_SOCKET__SETOPT 0x00008000UL #define NETLINK_NFLOG_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_NFLOG_SOCKET__RECVFROM 0x00020000UL #define NETLINK_NFLOG_SOCKET__SENDTO 0x00040000UL #define NETLINK_NFLOG_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_NFLOG_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_NFLOG_SOCKET__NAME_BIND 0x00200000UL #define NETLINK_XFRM_SOCKET__IOCTL 0x00000001UL #define NETLINK_XFRM_SOCKET__READ 0x00000002UL #define NETLINK_XFRM_SOCKET__WRITE 0x00000004UL #define NETLINK_XFRM_SOCKET__CREATE 0x00000008UL #define NETLINK_XFRM_SOCKET__GETATTR 0x00000010UL #define NETLINK_XFRM_SOCKET__SETATTR 0x00000020UL #define NETLINK_XFRM_SOCKET__LOCK 0x00000040UL #define NETLINK_XFRM_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_XFRM_SOCKET__RELABELTO 0x00000100UL #define NETLINK_XFRM_SOCKET__APPEND 0x00000200UL #define NETLINK_XFRM_SOCKET__BIND 0x00000400UL #define NETLINK_XFRM_SOCKET__CONNECT 0x00000800UL #define NETLINK_XFRM_SOCKET__LISTEN 0x00001000UL #define NETLINK_XFRM_SOCKET__ACCEPT 0x00002000UL #define NETLINK_XFRM_SOCKET__GETOPT 0x00004000UL #define NETLINK_XFRM_SOCKET__SETOPT 0x00008000UL #define NETLINK_XFRM_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_XFRM_SOCKET__RECVFROM 0x00020000UL #define NETLINK_XFRM_SOCKET__SENDTO 0x00040000UL #define NETLINK_XFRM_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_XFRM_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_XFRM_SOCKET__NAME_BIND 0x00200000UL #define NETLINK_XFRM_SOCKET__NLMSG_READ 0x00400000UL #define NETLINK_XFRM_SOCKET__NLMSG_WRITE 0x00800000UL #define NETLINK_SELINUX_SOCKET__IOCTL 0x00000001UL #define NETLINK_SELINUX_SOCKET__READ 0x00000002UL #define NETLINK_SELINUX_SOCKET__WRITE 0x00000004UL #define NETLINK_SELINUX_SOCKET__CREATE 0x00000008UL #define NETLINK_SELINUX_SOCKET__GETATTR 0x00000010UL #define NETLINK_SELINUX_SOCKET__SETATTR 0x00000020UL #define NETLINK_SELINUX_SOCKET__LOCK 0x00000040UL #define NETLINK_SELINUX_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_SELINUX_SOCKET__RELABELTO 0x00000100UL #define NETLINK_SELINUX_SOCKET__APPEND 0x00000200UL #define NETLINK_SELINUX_SOCKET__BIND 0x00000400UL #define NETLINK_SELINUX_SOCKET__CONNECT 0x00000800UL #define NETLINK_SELINUX_SOCKET__LISTEN 0x00001000UL #define NETLINK_SELINUX_SOCKET__ACCEPT 0x00002000UL #define NETLINK_SELINUX_SOCKET__GETOPT 0x00004000UL #define NETLINK_SELINUX_SOCKET__SETOPT 0x00008000UL #define NETLINK_SELINUX_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_SELINUX_SOCKET__RECVFROM 0x00020000UL #define NETLINK_SELINUX_SOCKET__SENDTO 0x00040000UL #define NETLINK_SELINUX_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_SELINUX_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_SELINUX_SOCKET__NAME_BIND 0x00200000UL #define NETLINK_AUDIT_SOCKET__IOCTL 0x00000001UL #define NETLINK_AUDIT_SOCKET__READ 0x00000002UL #define NETLINK_AUDIT_SOCKET__WRITE 0x00000004UL #define NETLINK_AUDIT_SOCKET__CREATE 0x00000008UL #define NETLINK_AUDIT_SOCKET__GETATTR 0x00000010UL #define NETLINK_AUDIT_SOCKET__SETATTR 0x00000020UL #define NETLINK_AUDIT_SOCKET__LOCK 0x00000040UL #define NETLINK_AUDIT_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_AUDIT_SOCKET__RELABELTO 0x00000100UL #define NETLINK_AUDIT_SOCKET__APPEND 0x00000200UL #define NETLINK_AUDIT_SOCKET__BIND 0x00000400UL #define NETLINK_AUDIT_SOCKET__CONNECT 0x00000800UL #define NETLINK_AUDIT_SOCKET__LISTEN 0x00001000UL #define NETLINK_AUDIT_SOCKET__ACCEPT 0x00002000UL #define NETLINK_AUDIT_SOCKET__GETOPT 0x00004000UL #define NETLINK_AUDIT_SOCKET__SETOPT 0x00008000UL #define NETLINK_AUDIT_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_AUDIT_SOCKET__RECVFROM 0x00020000UL #define NETLINK_AUDIT_SOCKET__SENDTO 0x00040000UL #define NETLINK_AUDIT_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_AUDIT_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_AUDIT_SOCKET__NAME_BIND 0x00200000UL #define NETLINK_AUDIT_SOCKET__NLMSG_READ 0x00400000UL #define NETLINK_AUDIT_SOCKET__NLMSG_WRITE 0x00800000UL #define NETLINK_AUDIT_SOCKET__NLMSG_RELAY 0x01000000UL #define NETLINK_AUDIT_SOCKET__NLMSG_READPRIV 0x02000000UL #define NETLINK_AUDIT_SOCKET__NLMSG_TTY_AUDIT 0x04000000UL #define NETLINK_IP6FW_SOCKET__IOCTL 0x00000001UL #define NETLINK_IP6FW_SOCKET__READ 0x00000002UL #define NETLINK_IP6FW_SOCKET__WRITE 0x00000004UL #define NETLINK_IP6FW_SOCKET__CREATE 0x00000008UL #define NETLINK_IP6FW_SOCKET__GETATTR 0x00000010UL #define NETLINK_IP6FW_SOCKET__SETATTR 0x00000020UL #define NETLINK_IP6FW_SOCKET__LOCK 0x00000040UL #define NETLINK_IP6FW_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_IP6FW_SOCKET__RELABELTO 0x00000100UL #define NETLINK_IP6FW_SOCKET__APPEND 0x00000200UL #define NETLINK_IP6FW_SOCKET__BIND 0x00000400UL #define NETLINK_IP6FW_SOCKET__CONNECT 0x00000800UL #define NETLINK_IP6FW_SOCKET__LISTEN 0x00001000UL #define NETLINK_IP6FW_SOCKET__ACCEPT 0x00002000UL #define NETLINK_IP6FW_SOCKET__GETOPT 0x00004000UL #define NETLINK_IP6FW_SOCKET__SETOPT 0x00008000UL #define NETLINK_IP6FW_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_IP6FW_SOCKET__RECVFROM 0x00020000UL #define NETLINK_IP6FW_SOCKET__SENDTO 0x00040000UL #define NETLINK_IP6FW_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_IP6FW_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_IP6FW_SOCKET__NAME_BIND 0x00200000UL #define NETLINK_IP6FW_SOCKET__NLMSG_READ 0x00400000UL #define NETLINK_IP6FW_SOCKET__NLMSG_WRITE 0x00800000UL #define NETLINK_DNRT_SOCKET__IOCTL 0x00000001UL #define NETLINK_DNRT_SOCKET__READ 0x00000002UL #define NETLINK_DNRT_SOCKET__WRITE 0x00000004UL #define NETLINK_DNRT_SOCKET__CREATE 0x00000008UL #define NETLINK_DNRT_SOCKET__GETATTR 0x00000010UL #define NETLINK_DNRT_SOCKET__SETATTR 0x00000020UL #define NETLINK_DNRT_SOCKET__LOCK 0x00000040UL #define NETLINK_DNRT_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_DNRT_SOCKET__RELABELTO 0x00000100UL #define NETLINK_DNRT_SOCKET__APPEND 0x00000200UL #define NETLINK_DNRT_SOCKET__BIND 0x00000400UL #define NETLINK_DNRT_SOCKET__CONNECT 0x00000800UL #define NETLINK_DNRT_SOCKET__LISTEN 0x00001000UL #define NETLINK_DNRT_SOCKET__ACCEPT 0x00002000UL #define NETLINK_DNRT_SOCKET__GETOPT 0x00004000UL #define NETLINK_DNRT_SOCKET__SETOPT 0x00008000UL #define NETLINK_DNRT_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_DNRT_SOCKET__RECVFROM 0x00020000UL #define NETLINK_DNRT_SOCKET__SENDTO 0x00040000UL #define NETLINK_DNRT_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_DNRT_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_DNRT_SOCKET__NAME_BIND 0x00200000UL #define DBUS__ACQUIRE_SVC 0x00000001UL #define DBUS__SEND_MSG 0x00000002UL #define NSCD__GETPWD 0x00000001UL #define NSCD__GETGRP 0x00000002UL #define NSCD__GETHOST 0x00000004UL #define NSCD__GETSTAT 0x00000008UL #define NSCD__ADMIN 0x00000010UL #define NSCD__SHMEMPWD 0x00000020UL #define NSCD__SHMEMGRP 0x00000040UL #define NSCD__SHMEMHOST 0x00000080UL #define NSCD__GETSERV 0x00000100UL #define NSCD__SHMEMSERV 0x00000200UL #define NSCD__GETNETGRP 0x00000400UL #define NSCD__SHMEMNETGRP 0x00000800UL #define ASSOCIATION__SENDTO 0x00000001UL #define ASSOCIATION__RECVFROM 0x00000002UL #define ASSOCIATION__SETCONTEXT 0x00000004UL #define ASSOCIATION__POLMATCH 0x00000008UL #define NETLINK_KOBJECT_UEVENT_SOCKET__IOCTL 0x00000001UL #define NETLINK_KOBJECT_UEVENT_SOCKET__READ 0x00000002UL #define NETLINK_KOBJECT_UEVENT_SOCKET__WRITE 0x00000004UL #define NETLINK_KOBJECT_UEVENT_SOCKET__CREATE 0x00000008UL #define NETLINK_KOBJECT_UEVENT_SOCKET__GETATTR 0x00000010UL #define NETLINK_KOBJECT_UEVENT_SOCKET__SETATTR 0x00000020UL #define NETLINK_KOBJECT_UEVENT_SOCKET__LOCK 0x00000040UL #define NETLINK_KOBJECT_UEVENT_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_KOBJECT_UEVENT_SOCKET__RELABELTO 0x00000100UL #define NETLINK_KOBJECT_UEVENT_SOCKET__APPEND 0x00000200UL #define NETLINK_KOBJECT_UEVENT_SOCKET__BIND 0x00000400UL #define NETLINK_KOBJECT_UEVENT_SOCKET__CONNECT 0x00000800UL #define NETLINK_KOBJECT_UEVENT_SOCKET__LISTEN 0x00001000UL #define NETLINK_KOBJECT_UEVENT_SOCKET__ACCEPT 0x00002000UL #define NETLINK_KOBJECT_UEVENT_SOCKET__GETOPT 0x00004000UL #define NETLINK_KOBJECT_UEVENT_SOCKET__SETOPT 0x00008000UL #define NETLINK_KOBJECT_UEVENT_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_KOBJECT_UEVENT_SOCKET__RECVFROM 0x00020000UL #define NETLINK_KOBJECT_UEVENT_SOCKET__SENDTO 0x00040000UL #define NETLINK_KOBJECT_UEVENT_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_KOBJECT_UEVENT_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_KOBJECT_UEVENT_SOCKET__NAME_BIND 0x00200000UL #define APPLETALK_SOCKET__IOCTL 0x00000001UL #define APPLETALK_SOCKET__READ 0x00000002UL #define APPLETALK_SOCKET__WRITE 0x00000004UL #define APPLETALK_SOCKET__CREATE 0x00000008UL #define APPLETALK_SOCKET__GETATTR 0x00000010UL #define APPLETALK_SOCKET__SETATTR 0x00000020UL #define APPLETALK_SOCKET__LOCK 0x00000040UL #define APPLETALK_SOCKET__RELABELFROM 0x00000080UL #define APPLETALK_SOCKET__RELABELTO 0x00000100UL #define APPLETALK_SOCKET__APPEND 0x00000200UL #define APPLETALK_SOCKET__BIND 0x00000400UL #define APPLETALK_SOCKET__CONNECT 0x00000800UL #define APPLETALK_SOCKET__LISTEN 0x00001000UL #define APPLETALK_SOCKET__ACCEPT 0x00002000UL #define APPLETALK_SOCKET__GETOPT 0x00004000UL #define APPLETALK_SOCKET__SETOPT 0x00008000UL #define APPLETALK_SOCKET__SHUTDOWN 0x00010000UL #define APPLETALK_SOCKET__RECVFROM 0x00020000UL #define APPLETALK_SOCKET__SENDTO 0x00040000UL #define APPLETALK_SOCKET__RECV_MSG 0x00080000UL #define APPLETALK_SOCKET__SEND_MSG 0x00100000UL #define APPLETALK_SOCKET__NAME_BIND 0x00200000UL #define PACKET__SEND 0x00000001UL #define PACKET__RECV 0x00000002UL #define PACKET__RELABELTO 0x00000004UL #define PACKET__FLOW_IN 0x00000008UL #define PACKET__FLOW_OUT 0x00000010UL #define PACKET__FORWARD_IN 0x00000020UL #define PACKET__FORWARD_OUT 0x00000040UL #define KEY__VIEW 0x00000001UL #define KEY__READ 0x00000002UL #define KEY__WRITE 0x00000004UL #define KEY__SEARCH 0x00000008UL #define KEY__LINK 0x00000010UL #define KEY__SETATTR 0x00000020UL #define KEY__CREATE 0x00000040UL #define CONTEXT__TRANSLATE 0x00000001UL #define CONTEXT__CONTAINS 0x00000002UL #define DCCP_SOCKET__IOCTL 0x00000001UL #define DCCP_SOCKET__READ 0x00000002UL #define DCCP_SOCKET__WRITE 0x00000004UL #define DCCP_SOCKET__CREATE 0x00000008UL #define DCCP_SOCKET__GETATTR 0x00000010UL #define DCCP_SOCKET__SETATTR 0x00000020UL #define DCCP_SOCKET__LOCK 0x00000040UL #define DCCP_SOCKET__RELABELFROM 0x00000080UL #define DCCP_SOCKET__RELABELTO 0x00000100UL #define DCCP_SOCKET__APPEND 0x00000200UL #define DCCP_SOCKET__BIND 0x00000400UL #define DCCP_SOCKET__CONNECT 0x00000800UL #define DCCP_SOCKET__LISTEN 0x00001000UL #define DCCP_SOCKET__ACCEPT 0x00002000UL #define DCCP_SOCKET__GETOPT 0x00004000UL #define DCCP_SOCKET__SETOPT 0x00008000UL #define DCCP_SOCKET__SHUTDOWN 0x00010000UL #define DCCP_SOCKET__RECVFROM 0x00020000UL #define DCCP_SOCKET__SENDTO 0x00040000UL #define DCCP_SOCKET__RECV_MSG 0x00080000UL #define DCCP_SOCKET__SEND_MSG 0x00100000UL #define DCCP_SOCKET__NAME_BIND 0x00200000UL #define DCCP_SOCKET__NODE_BIND 0x00400000UL #define DCCP_SOCKET__NAME_CONNECT 0x00800000UL #define MEMPROTECT__MMAP_ZERO 0x00000001UL #define DB_DATABASE__CREATE 0x00000001UL #define DB_DATABASE__DROP 0x00000002UL #define DB_DATABASE__GETATTR 0x00000004UL #define DB_DATABASE__SETATTR 0x00000008UL #define DB_DATABASE__RELABELFROM 0x00000010UL #define DB_DATABASE__RELABELTO 0x00000020UL #define DB_DATABASE__ACCESS 0x00000040UL #define DB_DATABASE__INSTALL_MODULE 0x00000080UL #define DB_DATABASE__LOAD_MODULE 0x00000100UL #define DB_DATABASE__GET_PARAM 0x00000200UL #define DB_DATABASE__SET_PARAM 0x00000400UL #define DB_TABLE__CREATE 0x00000001UL #define DB_TABLE__DROP 0x00000002UL #define DB_TABLE__GETATTR 0x00000004UL #define DB_TABLE__SETATTR 0x00000008UL #define DB_TABLE__RELABELFROM 0x00000010UL #define DB_TABLE__RELABELTO 0x00000020UL #define DB_TABLE__USE 0x00000040UL #define DB_TABLE__SELECT 0x00000080UL #define DB_TABLE__UPDATE 0x00000100UL #define DB_TABLE__INSERT 0x00000200UL #define DB_TABLE__DELETE 0x00000400UL #define DB_TABLE__LOCK 0x00000800UL #define DB_PROCEDURE__CREATE 0x00000001UL #define DB_PROCEDURE__DROP 0x00000002UL #define DB_PROCEDURE__GETATTR 0x00000004UL #define DB_PROCEDURE__SETATTR 0x00000008UL #define DB_PROCEDURE__RELABELFROM 0x00000010UL #define DB_PROCEDURE__RELABELTO 0x00000020UL #define DB_PROCEDURE__EXECUTE 0x00000040UL #define DB_PROCEDURE__ENTRYPOINT 0x00000080UL #define DB_COLUMN__CREATE 0x00000001UL #define DB_COLUMN__DROP 0x00000002UL #define DB_COLUMN__GETATTR 0x00000004UL #define DB_COLUMN__SETATTR 0x00000008UL #define DB_COLUMN__RELABELFROM 0x00000010UL #define DB_COLUMN__RELABELTO 0x00000020UL #define DB_COLUMN__USE 0x00000040UL #define DB_COLUMN__SELECT 0x00000080UL #define DB_COLUMN__UPDATE 0x00000100UL #define DB_COLUMN__INSERT 0x00000200UL #define DB_TUPLE__RELABELFROM 0x00000001UL #define DB_TUPLE__RELABELTO 0x00000002UL #define DB_TUPLE__USE 0x00000004UL #define DB_TUPLE__SELECT 0x00000008UL #define DB_TUPLE__UPDATE 0x00000010UL #define DB_TUPLE__INSERT 0x00000020UL #define DB_TUPLE__DELETE 0x00000040UL #define DB_BLOB__CREATE 0x00000001UL #define DB_BLOB__DROP 0x00000002UL #define DB_BLOB__GETATTR 0x00000004UL #define DB_BLOB__SETATTR 0x00000008UL #define DB_BLOB__RELABELFROM 0x00000010UL #define DB_BLOB__RELABELTO 0x00000020UL #define DB_BLOB__READ 0x00000040UL #define DB_BLOB__WRITE 0x00000080UL #define DB_BLOB__IMPORT 0x00000100UL #define DB_BLOB__EXPORT 0x00000200UL #define PEER__RECV 0x00000001UL #define X_APPLICATION_DATA__PASTE 0x00000001UL #define X_APPLICATION_DATA__PASTE_AFTER_CONFIRM 0x00000002UL #define X_APPLICATION_DATA__COPY 0x00000004UL selinux/restorecon.h000064400000005433147631660260010607 0ustar00#ifndef _RESTORECON_H_ #define _RESTORECON_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** * selinux_restorecon - Relabel files. * @pathname: specifies file/directory to relabel. * @restorecon_flags: specifies the actions to be performed when relabeling. * * selinux_restorecon(3) will automatically call * selinux_restorecon_default_handle(3) and selinux_restorecon_set_sehandle(3) * first time through to set the selabel_open(3) parameters to use the * currently loaded policy file_contexts and request their computed digest. * * Should other selabel_open(3) parameters be required see * selinux_restorecon_set_sehandle(3). */ extern int selinux_restorecon(const char *pathname, unsigned int restorecon_flags); /* * restorecon_flags options */ /* Force the checking of labels even if the stored SHA1 * digest matches the specfiles SHA1 digest. */ #define SELINUX_RESTORECON_IGNORE_DIGEST 1 /* Do not change file labels */ #define SELINUX_RESTORECON_NOCHANGE 2 /* If set set change file label to that in spec file. * If not only change type component to that in spec file. */ #define SELINUX_RESTORECON_SET_SPECFILE_CTX 4 /* Recursively descend directories */ #define SELINUX_RESTORECON_RECURSE 8 /* Log changes to selinux log. Note that if VERBOSE and * PROGRESS are set, then PROGRESS will take precedence. */ #define SELINUX_RESTORECON_VERBOSE 16 /* Show progress by printing * to stdout every 1000 files */ #define SELINUX_RESTORECON_PROGRESS 32 /* Convert passed-in pathname to canonical pathname */ #define SELINUX_RESTORECON_REALPATH 64 /* Prevent descending into directories that have a different * device number than the pathname from which the descent began */ #define SELINUX_RESTORECON_XDEV 128 /** * selinux_restorecon_set_sehandle - Set the global fc handle. * @handle: specifies handle to set as the global fc handle. * * Called by a process that has already called selabel_open(3) with it's * required parameters, or if selinux_restorecon_default_handle(3) has been * called to set the default selabel_open(3) parameters. */ extern void selinux_restorecon_set_sehandle(struct selabel_handle *hndl); /** * selinux_restorecon_default_handle - Sets default selabel_open(3) parameters * to use the currently loaded policy and * file_contexts, also requests the digest. */ extern struct selabel_handle *selinux_restorecon_default_handle(void); /** * selinux_restorecon_set_exclude_list - Add a list of files or * directories that are to be excluded * from relabeling. * @exclude_list: containing a NULL terminated list of one or more * directories or files not to be relabeled. */ extern void selinux_restorecon_set_exclude_list(const char **exclude_list); #ifdef __cplusplus } #endif #endif selinux/flask.h000064400000014400147631660260007516 0ustar00/* This file is automatically generated. Do not edit. */ #ifndef _SELINUX_FLASK_H_ #define _SELINUX_FLASK_H_ #warning "Please remove any #include's of this header in your source code." #warning "Instead, use string_to_security_class() to map the class name to a value." /* * Security object class definitions */ #define SECCLASS_SECURITY 1 #define SECCLASS_PROCESS 2 #define SECCLASS_SYSTEM 3 #define SECCLASS_CAPABILITY 4 #define SECCLASS_FILESYSTEM 5 #define SECCLASS_FILE 6 #define SECCLASS_DIR 7 #define SECCLASS_FD 8 #define SECCLASS_LNK_FILE 9 #define SECCLASS_CHR_FILE 10 #define SECCLASS_BLK_FILE 11 #define SECCLASS_SOCK_FILE 12 #define SECCLASS_FIFO_FILE 13 #define SECCLASS_SOCKET 14 #define SECCLASS_TCP_SOCKET 15 #define SECCLASS_UDP_SOCKET 16 #define SECCLASS_RAWIP_SOCKET 17 #define SECCLASS_NODE 18 #define SECCLASS_NETIF 19 #define SECCLASS_NETLINK_SOCKET 20 #define SECCLASS_PACKET_SOCKET 21 #define SECCLASS_KEY_SOCKET 22 #define SECCLASS_UNIX_STREAM_SOCKET 23 #define SECCLASS_UNIX_DGRAM_SOCKET 24 #define SECCLASS_SEM 25 #define SECCLASS_MSG 26 #define SECCLASS_MSGQ 27 #define SECCLASS_SHM 28 #define SECCLASS_IPC 29 #define SECCLASS_PASSWD 30 #define SECCLASS_X_DRAWABLE 31 #define SECCLASS_X_SCREEN 32 #define SECCLASS_X_GC 33 #define SECCLASS_X_FONT 34 #define SECCLASS_X_COLORMAP 35 #define SECCLASS_X_PROPERTY 36 #define SECCLASS_X_SELECTION 37 #define SECCLASS_X_CURSOR 38 #define SECCLASS_X_CLIENT 39 #define SECCLASS_X_DEVICE 40 #define SECCLASS_X_SERVER 41 #define SECCLASS_X_EXTENSION 42 #define SECCLASS_NETLINK_ROUTE_SOCKET 43 #define SECCLASS_NETLINK_FIREWALL_SOCKET 44 #define SECCLASS_NETLINK_TCPDIAG_SOCKET 45 #define SECCLASS_NETLINK_NFLOG_SOCKET 46 #define SECCLASS_NETLINK_XFRM_SOCKET 47 #define SECCLASS_NETLINK_SELINUX_SOCKET 48 #define SECCLASS_NETLINK_AUDIT_SOCKET 49 #define SECCLASS_NETLINK_IP6FW_SOCKET 50 #define SECCLASS_NETLINK_DNRT_SOCKET 51 #define SECCLASS_DBUS 52 #define SECCLASS_NSCD 53 #define SECCLASS_ASSOCIATION 54 #define SECCLASS_NETLINK_KOBJECT_UEVENT_SOCKET 55 #define SECCLASS_APPLETALK_SOCKET 56 #define SECCLASS_PACKET 57 #define SECCLASS_KEY 58 #define SECCLASS_CONTEXT 59 #define SECCLASS_DCCP_SOCKET 60 #define SECCLASS_MEMPROTECT 61 #define SECCLASS_DB_DATABASE 62 #define SECCLASS_DB_TABLE 63 #define SECCLASS_DB_PROCEDURE 64 #define SECCLASS_DB_COLUMN 65 #define SECCLASS_DB_TUPLE 66 #define SECCLASS_DB_BLOB 67 #define SECCLASS_PEER 68 #define SECCLASS_CAPABILITY2 69 #define SECCLASS_X_RESOURCE 70 #define SECCLASS_X_EVENT 71 #define SECCLASS_X_SYNTHETIC_EVENT 72 #define SECCLASS_X_APPLICATION_DATA 73 /* * Security identifier indices for initial entities */ #define SECINITSID_KERNEL 1 #define SECINITSID_SECURITY 2 #define SECINITSID_UNLABELED 3 #define SECINITSID_FS 4 #define SECINITSID_FILE 5 #define SECINITSID_FILE_LABELS 6 #define SECINITSID_INIT 7 #define SECINITSID_ANY_SOCKET 8 #define SECINITSID_PORT 9 #define SECINITSID_NETIF 10 #define SECINITSID_NETMSG 11 #define SECINITSID_NODE 12 #define SECINITSID_IGMP_PACKET 13 #define SECINITSID_ICMP_SOCKET 14 #define SECINITSID_TCP_SOCKET 15 #define SECINITSID_SYSCTL_MODPROBE 16 #define SECINITSID_SYSCTL 17 #define SECINITSID_SYSCTL_FS 18 #define SECINITSID_SYSCTL_KERNEL 19 #define SECINITSID_SYSCTL_NET 20 #define SECINITSID_SYSCTL_NET_UNIX 21 #define SECINITSID_SYSCTL_VM 22 #define SECINITSID_SYSCTL_DEV 23 #define SECINITSID_KMOD 24 #define SECINITSID_POLICY 25 #define SECINITSID_SCMP_PACKET 26 #define SECINITSID_DEVNULL 27 #define SECINITSID_NUM 27 #endif selinux/selinux.h000064400000065044147631660260010117 0ustar00#ifndef _SELINUX_H_ #define _SELINUX_H_ #include #include #ifdef __cplusplus extern "C" { #endif /* Return 1 if we are running on a SELinux kernel, or 0 if not or -1 if we get an error. */ extern int is_selinux_enabled(void); /* Return 1 if we are running on a SELinux MLS kernel, or 0 otherwise. */ extern int is_selinux_mls_enabled(void); /* No longer used; here for compatibility with legacy callers. */ typedef char *security_context_t; /* Free the memory allocated for a context by any of the below get* calls. */ extern void freecon(char * con); /* Free the memory allocated for a context array by security_compute_user. */ extern void freeconary(char ** con); /* Wrappers for the /proc/pid/attr API. */ /* Get current context, and set *con to refer to it. Caller must free via freecon. */ extern int getcon(char ** con); extern int getcon_raw(char ** con); /* Set the current security context to con. Note that use of this function requires that the entire application be trusted to maintain any desired separation between the old and new security contexts, unlike exec-based transitions performed via setexeccon. When possible, decompose your application and use setexeccon()+execve() instead. Note that the application may lose access to its open descriptors as a result of a setcon() unless policy allows it to use descriptors opened by the old context. */ extern int setcon(const char * con); extern int setcon_raw(const char * con); /* Get context of process identified by pid, and set *con to refer to it. Caller must free via freecon. */ extern int getpidcon(pid_t pid, char ** con); extern int getpidcon_raw(pid_t pid, char ** con); /* Get previous context (prior to last exec), and set *con to refer to it. Caller must free via freecon. */ extern int getprevcon(char ** con); extern int getprevcon_raw(char ** con); /* Get exec context, and set *con to refer to it. Sets *con to NULL if no exec context has been set, i.e. using default. If non-NULL, caller must free via freecon. */ extern int getexeccon(char ** con); extern int getexeccon_raw(char ** con); /* Set exec security context for the next execve. Call with NULL if you want to reset to the default. */ extern int setexeccon(const char * con); extern int setexeccon_raw(const char * con); /* Get fscreate context, and set *con to refer to it. Sets *con to NULL if no fs create context has been set, i.e. using default. If non-NULL, caller must free via freecon. */ extern int getfscreatecon(char ** con); extern int getfscreatecon_raw(char ** con); /* Set the fscreate security context for subsequent file creations. Call with NULL if you want to reset to the default. */ extern int setfscreatecon(const char * context); extern int setfscreatecon_raw(const char * context); /* Get keycreate context, and set *con to refer to it. Sets *con to NULL if no key create context has been set, i.e. using default. If non-NULL, caller must free via freecon. */ extern int getkeycreatecon(char ** con); extern int getkeycreatecon_raw(char ** con); /* Set the keycreate security context for subsequent key creations. Call with NULL if you want to reset to the default. */ extern int setkeycreatecon(const char * context); extern int setkeycreatecon_raw(const char * context); /* Get sockcreate context, and set *con to refer to it. Sets *con to NULL if no socket create context has been set, i.e. using default. If non-NULL, caller must free via freecon. */ extern int getsockcreatecon(char ** con); extern int getsockcreatecon_raw(char ** con); /* Set the sockcreate security context for subsequent socket creations. Call with NULL if you want to reset to the default. */ extern int setsockcreatecon(const char * context); extern int setsockcreatecon_raw(const char * context); /* Wrappers for the xattr API. */ /* Get file context, and set *con to refer to it. Caller must free via freecon. */ extern int getfilecon(const char *path, char ** con); extern int getfilecon_raw(const char *path, char ** con); extern int lgetfilecon(const char *path, char ** con); extern int lgetfilecon_raw(const char *path, char ** con); extern int fgetfilecon(int fd, char ** con); extern int fgetfilecon_raw(int fd, char ** con); /* Set file context */ extern int setfilecon(const char *path, const char * con); extern int setfilecon_raw(const char *path, const char * con); extern int lsetfilecon(const char *path, const char * con); extern int lsetfilecon_raw(const char *path, const char * con); extern int fsetfilecon(int fd, const char * con); extern int fsetfilecon_raw(int fd, const char * con); /* Wrappers for the socket API */ /* Get context of peer socket, and set *con to refer to it. Caller must free via freecon. */ extern int getpeercon(int fd, char ** con); extern int getpeercon_raw(int fd, char ** con); /* Wrappers for the selinuxfs (policy) API. */ typedef unsigned int access_vector_t; typedef unsigned short security_class_t; struct av_decision { access_vector_t allowed; access_vector_t decided; access_vector_t auditallow; access_vector_t auditdeny; unsigned int seqno; unsigned int flags; }; /* Definitions of av_decision.flags */ #define SELINUX_AVD_FLAGS_PERMISSIVE 0x0001 /* Structure for passing options, used by AVC and label subsystems */ struct selinux_opt { int type; const char *value; }; /* Callback facilities */ union selinux_callback { /* log the printf-style format and arguments, with the type code indicating the type of message */ int #ifdef __GNUC__ __attribute__ ((format(printf, 2, 3))) #endif (*func_log) (int type, const char *fmt, ...); /* store a string representation of auditdata (corresponding to the given security class) into msgbuf. */ int (*func_audit) (void *auditdata, security_class_t cls, char *msgbuf, size_t msgbufsize); /* validate the supplied context, modifying if necessary */ int (*func_validate) (char **ctx); /* netlink callback for setenforce message */ int (*func_setenforce) (int enforcing); /* netlink callback for policyload message */ int (*func_policyload) (int seqno); }; #define SELINUX_CB_LOG 0 #define SELINUX_CB_AUDIT 1 #define SELINUX_CB_VALIDATE 2 #define SELINUX_CB_SETENFORCE 3 #define SELINUX_CB_POLICYLOAD 4 extern union selinux_callback selinux_get_callback(int type); extern void selinux_set_callback(int type, union selinux_callback cb); /* Logging type codes, passed to the logging callback */ #define SELINUX_ERROR 0 #define SELINUX_WARNING 1 #define SELINUX_INFO 2 #define SELINUX_AVC 3 #define SELINUX_TRANS_DIR "/var/run/setrans" /* Compute an access decision. */ extern int security_compute_av(const char * scon, const char * tcon, security_class_t tclass, access_vector_t requested, struct av_decision *avd); extern int security_compute_av_raw(const char * scon, const char * tcon, security_class_t tclass, access_vector_t requested, struct av_decision *avd); extern int security_compute_av_flags(const char * scon, const char * tcon, security_class_t tclass, access_vector_t requested, struct av_decision *avd); extern int security_compute_av_flags_raw(const char * scon, const char * tcon, security_class_t tclass, access_vector_t requested, struct av_decision *avd); /* Compute a labeling decision and set *newcon to refer to it. Caller must free via freecon. */ extern int security_compute_create(const char * scon, const char * tcon, security_class_t tclass, char ** newcon); extern int security_compute_create_raw(const char * scon, const char * tcon, security_class_t tclass, char ** newcon); extern int security_compute_create_name(const char * scon, const char * tcon, security_class_t tclass, const char *objname, char ** newcon); extern int security_compute_create_name_raw(const char * scon, const char * tcon, security_class_t tclass, const char *objname, char ** newcon); /* Compute a relabeling decision and set *newcon to refer to it. Caller must free via freecon. */ extern int security_compute_relabel(const char * scon, const char * tcon, security_class_t tclass, char ** newcon); extern int security_compute_relabel_raw(const char * scon, const char * tcon, security_class_t tclass, char ** newcon); /* Compute a polyinstantiation member decision and set *newcon to refer to it. Caller must free via freecon. */ extern int security_compute_member(const char * scon, const char * tcon, security_class_t tclass, char ** newcon); extern int security_compute_member_raw(const char * scon, const char * tcon, security_class_t tclass, char ** newcon); /* Compute the set of reachable user contexts and set *con to refer to the NULL-terminated array of contexts. Caller must free via freeconary. */ extern int security_compute_user(const char * scon, const char *username, char *** con); extern int security_compute_user_raw(const char * scon, const char *username, char *** con); /* Load a policy configuration. */ extern int security_load_policy(void *data, size_t len); /* Get the context of an initial kernel security identifier by name. Caller must free via freecon */ extern int security_get_initial_context(const char *name, char ** con); extern int security_get_initial_context_raw(const char *name, char ** con); /* * Make a policy image and load it. * This function provides a higher level interface for loading policy * than security_load_policy, internally determining the right policy * version, locating and opening the policy file, mapping it into memory, * manipulating it as needed for current boolean settings and/or local * definitions, and then calling security_load_policy to load it. * * 'preservebools' is a boolean flag indicating whether current * policy boolean values should be preserved into the new policy (if 1) * or reset to the saved policy settings (if 0). The former case is the * default for policy reloads, while the latter case is an option for policy * reloads but is primarily for the initial policy load. */ extern int selinux_mkload_policy(int preservebools); /* * Perform the initial policy load. * This function determines the desired enforcing mode, sets the * the *enforce argument accordingly for the caller to use, sets the * SELinux kernel enforcing status to match it, and loads the policy. * It also internally handles the initial selinuxfs mount required to * perform these actions. * * The function returns 0 if everything including the policy load succeeds. * In this case, init is expected to re-exec itself in order to transition * to the proper security context. * Otherwise, the function returns -1, and init must check *enforce to * determine how to proceed. If enforcing (*enforce > 0), then init should * halt the system. Otherwise, init may proceed normally without a re-exec. */ extern int selinux_init_load_policy(int *enforce); /* Translate boolean strict to name value pair. */ typedef struct { char *name; int value; } SELboolean; /* save a list of booleans in a single transaction. */ extern int security_set_boolean_list(size_t boolcnt, SELboolean * boollist, int permanent); /* Load policy boolean settings. Path may be NULL, in which case the booleans are loaded from the active policy boolean configuration file. */ extern int security_load_booleans(char *path); /* Check the validity of a security context. */ extern int security_check_context(const char * con); extern int security_check_context_raw(const char * con); /* Canonicalize a security context. */ extern int security_canonicalize_context(const char * con, char ** canoncon); extern int security_canonicalize_context_raw(const char * con, char ** canoncon); /* Get the enforce flag value. */ extern int security_getenforce(void); /* Set the enforce flag value. */ extern int security_setenforce(int value); /* Get the behavior for undefined classes/permissions */ extern int security_deny_unknown(void); /* Disable SELinux at runtime (must be done prior to initial policy load). */ extern int security_disable(void); /* Get the policy version number. */ extern int security_policyvers(void); /* Get the boolean names */ extern int security_get_boolean_names(char ***names, int *len); /* Get the pending value for the boolean */ extern int security_get_boolean_pending(const char *name); /* Get the active value for the boolean */ extern int security_get_boolean_active(const char *name); /* Set the pending value for the boolean */ extern int security_set_boolean(const char *name, int value); /* Commit the pending values for the booleans */ extern int security_commit_booleans(void); /* Userspace class mapping support */ struct security_class_mapping { const char *name; const char *perms[sizeof(access_vector_t) * 8 + 1]; }; /** * selinux_set_mapping - Enable dynamic mapping between integer offsets and security class names * @map: array of security_class_mapping structures * * The core avc_has_perm() API uses integers to represent security * classes; previous to the introduction of this function, it was * common for userspace object managers to be compiled using generated * offsets for a particular policy. However, that strongly ties the build of the userspace components to a particular policy. * * By using this function to map between integer offsets and security * class names, it's possible to replace a system policies that have * at least the same set of security class names as used by the * userspace object managers. * * To correctly use this function, you should override the generated * security class defines from the system policy in a local header, * starting at 1, and have one security_class_mapping structure entry * per define. */ extern int selinux_set_mapping(struct security_class_mapping *map); /* Common helpers */ /* Convert between mode and security class values */ extern security_class_t mode_to_security_class(mode_t mode); /* Convert between security class values and string names */ extern security_class_t string_to_security_class(const char *name); extern const char *security_class_to_string(security_class_t cls); /* Convert between individual access vector permissions and string names */ extern const char *security_av_perm_to_string(security_class_t tclass, access_vector_t perm); extern access_vector_t string_to_av_perm(security_class_t tclass, const char *name); /* Returns an access vector in a string representation. User must free the * returned string via free(). */ extern int security_av_string(security_class_t tclass, access_vector_t av, char **result); /* Display an access vector in a string representation. */ extern void print_access_vector(security_class_t tclass, access_vector_t av); /* Set the function used by matchpathcon_init when displaying errors about the file_contexts configuration. If not set, then this defaults to fprintf(stderr, fmt, ...). */ extern void set_matchpathcon_printf(void (*f) (const char *fmt, ...)); /* Set the function used by matchpathcon_init when checking the validity of a context in the file contexts configuration. If not set, then this defaults to a test based on security_check_context(). The function is also responsible for reporting any such error, and may include the 'path' and 'lineno' in such error messages. */ extern void set_matchpathcon_invalidcon(int (*f) (const char *path, unsigned lineno, char *context)); /* Same as above, but also allows canonicalization of the context, by changing *context to refer to the canonical form. If not set, and invalidcon is also not set, then this defaults to calling security_canonicalize_context(). */ extern void set_matchpathcon_canoncon(int (*f) (const char *path, unsigned lineno, char **context)); /* Set flags controlling operation of matchpathcon_init or matchpathcon. */ #define MATCHPATHCON_BASEONLY 1 /* Only process the base file_contexts file. */ #define MATCHPATHCON_NOTRANS 2 /* Do not perform any context translation. */ #define MATCHPATHCON_VALIDATE 4 /* Validate/canonicalize contexts at init time. */ extern void set_matchpathcon_flags(unsigned int flags); /* Load the file contexts configuration specified by 'path' into memory for use by subsequent matchpathcon calls. If 'path' is NULL, then load the active file contexts configuration, i.e. the path returned by selinux_file_context_path(). Unless the MATCHPATHCON_BASEONLY flag has been set, this function also checks for a 'path'.homedirs file and a 'path'.local file and loads additional specifications from them if present. */ extern int matchpathcon_init(const char *path); /* Same as matchpathcon_init, but only load entries with regexes that have stems that are prefixes of 'prefix'. */ extern int matchpathcon_init_prefix(const char *path, const char *prefix); /* Free the memory allocated by matchpathcon_init. */ extern void matchpathcon_fini(void); /* Resolve all of the symlinks and relative portions of a pathname, but NOT * the final component (same a realpath() unless the final component is a * symlink. Resolved path must be a path of size PATH_MAX + 1 */ extern int realpath_not_final(const char *name, char *resolved_path); /* Match the specified pathname and mode against the file contexts configuration and set *con to refer to the resulting context. 'mode' can be 0 to disable mode matching. Caller must free via freecon. If matchpathcon_init has not already been called, then this function will call it upon its first invocation with a NULL path. */ extern int matchpathcon(const char *path, mode_t mode, char ** con); /* Same as above, but return a specification index for later use in a matchpathcon_filespec_add() call - see below. */ extern int matchpathcon_index(const char *path, mode_t mode, char ** con); /* Maintain an association between an inode and a specification index, and check whether a conflicting specification is already associated with the same inode (e.g. due to multiple hard links). If so, then use the latter of the two specifications based on their order in the file contexts configuration. Return the used specification index. */ extern int matchpathcon_filespec_add(ino_t ino, int specind, const char *file); /* Destroy any inode associations that have been added, e.g. to restart for a new filesystem. */ extern void matchpathcon_filespec_destroy(void); /* Display statistics on the hash table usage for the associations. */ extern void matchpathcon_filespec_eval(void); /* Check to see whether any specifications had no matches and report them. The 'str' is used as a prefix for any warning messages. */ extern void matchpathcon_checkmatches(char *str); /* Match the specified media and against the media contexts configuration and set *con to refer to the resulting context. Caller must free con via freecon. */ extern int matchmediacon(const char *media, char ** con); /* selinux_getenforcemode reads the /etc/selinux/config file and determines whether the machine should be started in enforcing (1), permissive (0) or disabled (-1) mode. */ extern int selinux_getenforcemode(int *enforce); /* selinux_boolean_sub reads the /etc/selinux/TYPE/booleans.subs_dist file looking for a record with boolean_name. If a record exists selinux_boolean_sub returns the translated name otherwise it returns the original name. The returned value needs to be freed. On failure NULL will be returned. */ extern char *selinux_boolean_sub(const char *boolean_name); /* selinux_getpolicytype reads the /etc/selinux/config file and determines what the default policy for the machine is. Calling application must free policytype. */ extern int selinux_getpolicytype(char **policytype); /* selinux_policy_root reads the /etc/selinux/config file and returns the directory path under which the compiled policy file and context configuration files exist. */ extern const char *selinux_policy_root(void); /* selinux_set_policy_root sets an alternate policy root directory path under which the compiled policy file and context configuration files exist. */ extern int selinux_set_policy_root(const char *rootpath); /* These functions return the paths to specific files under the policy root directory. */ extern const char *selinux_current_policy_path(void); extern const char *selinux_binary_policy_path(void); extern const char *selinux_failsafe_context_path(void); extern const char *selinux_removable_context_path(void); extern const char *selinux_default_context_path(void); extern const char *selinux_user_contexts_path(void); extern const char *selinux_file_context_path(void); extern const char *selinux_file_context_homedir_path(void); extern const char *selinux_file_context_local_path(void); extern const char *selinux_file_context_subs_path(void); extern const char *selinux_file_context_subs_dist_path(void); extern const char *selinux_homedir_context_path(void); extern const char *selinux_media_context_path(void); extern const char *selinux_virtual_domain_context_path(void); extern const char *selinux_virtual_image_context_path(void); extern const char *selinux_lxc_contexts_path(void); extern const char *selinux_x_context_path(void); extern const char *selinux_sepgsql_context_path(void); extern const char *selinux_openssh_contexts_path(void); extern const char *selinux_snapperd_contexts_path(void); extern const char *selinux_systemd_contexts_path(void); extern const char *selinux_contexts_path(void); extern const char *selinux_securetty_types_path(void); extern const char *selinux_booleans_subs_path(void); extern const char *selinux_booleans_path(void); extern const char *selinux_customizable_types_path(void); extern const char *selinux_users_path(void); extern const char *selinux_usersconf_path(void); extern const char *selinux_translations_path(void); extern const char *selinux_colors_path(void); extern const char *selinux_netfilter_context_path(void); extern const char *selinux_path(void); /** * selinux_check_access - Check permissions and perform appropriate auditing. * @scon: source security context * @tcon: target security context * @tclass: target security class string * @perm: requested permissions string, interpreted based on @tclass * @auditdata: auxiliary audit data * * Check the AVC to determine whether the @perm permissions are granted * for the SID pair (@scon, @tcon), interpreting the permissions * based on @tclass. * Return %0 if all @perm permissions are granted, -%1 with * @errno set to %EACCES if any permissions are denied or to another * value upon other errors. * If auditing or logging is configured the appropriate callbacks will be called * and passed the auditdata field */ extern int selinux_check_access(const char * scon, const char * tcon, const char *tclass, const char *perm, void *auditdata); /* Check a permission in the passwd class. Return 0 if granted or -1 otherwise. */ extern int selinux_check_passwd_access(access_vector_t requested); extern int checkPasswdAccess(access_vector_t requested); /* Check if the tty_context is defined as a securetty Return 0 if secure, < 0 otherwise. */ extern int selinux_check_securetty_context(const char * tty_context); /* Set the path to the selinuxfs mount point explicitly. Normally, this is determined automatically during libselinux initialization, but this is not always possible, e.g. for /sbin/init which performs the initial mount of selinuxfs. */ void set_selinuxmnt(const char *mnt); /* Check if selinuxfs exists as a kernel filesystem */ int selinuxfs_exists(void); /* clear selinuxmnt variable and free allocated memory */ void fini_selinuxmnt(void); /* Set an appropriate security context based on the filename of a helper * program, falling back to a new context with the specified type. */ extern int setexecfilecon(const char *filename, const char *fallback_type); #ifndef DISABLE_RPM /* Execute a helper for rpm in an appropriate security context. */ extern int rpm_execcon(unsigned int verified, const char *filename, char *const argv[], char *const envp[]); #endif /* Returns whether a file context is customizable, and should not be relabeled . */ extern int is_context_customizable(const char * scontext); /* Perform context translation between the human-readable format ("translated") and the internal system format ("raw"). Caller must free the resulting context via freecon. Returns -1 upon an error or 0 otherwise. If passed NULL, sets the returned context to NULL and returns 0. */ extern int selinux_trans_to_raw_context(const char * trans, char ** rawp); extern int selinux_raw_to_trans_context(const char * raw, char ** transp); /* Perform context translation between security contexts and display colors. Returns a space-separated list of ten ten hex RGB triples prefixed by hash marks, e.g. "#ff0000". Caller must free the resulting string via free. Returns -1 upon an error or 0 otherwise. */ extern int selinux_raw_context_to_color(const char * raw, char **color_str); /* Get the SELinux username and level to use for a given Linux username. These values may then be passed into the get_ordered_context_list* and get_default_context* functions to obtain a context for the user. Returns 0 on success or -1 otherwise. Caller must free the returned strings via free. */ extern int getseuserbyname(const char *linuxuser, char **seuser, char **level); /* Get the SELinux username and level to use for a given Linux username and service. These values may then be passed into the get_ordered_context_list* and get_default_context* functions to obtain a context for the user. Returns 0 on success or -1 otherwise. Caller must free the returned strings via free. */ extern int getseuser(const char *username, const char *service, char **r_seuser, char **r_level); /* Compare two file contexts, return 0 if equivalent. */ extern int selinux_file_context_cmp(const char * a, const char * b); /* * Verify the context of the file 'path' against policy. * Return 1 if match, 0 if not and -1 on error. */ extern int selinux_file_context_verify(const char *path, mode_t mode); /* This function sets the file context on to the system defaults returns 0 on success */ extern int selinux_lsetfilecon_default(const char *path); /* * Force a reset of the loaded configuration * WARNING: This is not thread safe. Be very sure that no other threads * are calling into libselinux when this is called. */ extern void selinux_reset_config(void); #ifdef __cplusplus } #endif #endif selinux/label.h000064400000013425147631660260007503 0ustar00/* * Labeling interface for userspace object managers and others. * * Author : Eamon Walsh */ #ifndef _SELABEL_H_ #define _SELABEL_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /* * Opaque type used for all label handles. */ struct selabel_handle; /* * Available backends. */ /* file contexts */ #define SELABEL_CTX_FILE 0 /* media contexts */ #define SELABEL_CTX_MEDIA 1 /* x contexts */ #define SELABEL_CTX_X 2 /* db objects */ #define SELABEL_CTX_DB 3 /* Android property service contexts */ #define SELABEL_CTX_ANDROID_PROP 4 /* * Available options */ /* no-op option, useful for unused slots in an array of options */ #define SELABEL_OPT_UNUSED 0 /* validate contexts before returning them (boolean value) */ #define SELABEL_OPT_VALIDATE 1 /* don't use local customizations to backend data (boolean value) */ #define SELABEL_OPT_BASEONLY 2 /* specify an alternate path to use when loading backend data */ #define SELABEL_OPT_PATH 3 /* select a subset of the search space as an optimization (file backend) */ #define SELABEL_OPT_SUBSET 4 /* require a hash calculation on spec files */ #define SELABEL_OPT_DIGEST 5 /* total number of options */ #define SELABEL_NOPT 6 /* * Label operations */ /** * selabel_open - Create a labeling handle. * @backend: one of the constants specifying a supported labeling backend. * @opts: array of selabel_opt structures specifying label options or NULL. * @nopts: number of elements in opts array or zero for no options. * * Open a labeling backend for use. The available backend identifiers are * listed above. Options may be provided via the opts parameter; available * options are listed above. Not all options may be supported by every * backend. Return value is the created handle on success or NULL with * @errno set on failure. */ struct selabel_handle *selabel_open(unsigned int backend, const struct selinux_opt *opts, unsigned nopts); /** * selabel_close - Close a labeling handle. * @handle: specifies handle to close * * Destroy the specified handle, closing files, freeing allocated memory, * etc. The handle may not be further used after it has been closed. */ void selabel_close(struct selabel_handle *handle); /** * selabel_lookup - Perform labeling lookup operation. * @handle: specifies backend instance to query * @con: returns the appropriate context with which to label the object * @key: string input to lookup operation * @type: numeric input to the lookup operation * * Perform a labeling lookup operation. Return %0 on success, -%1 with * @errno set on failure. The key and type arguments are the inputs to the * lookup operation; appropriate values are dictated by the backend in use. * The result is returned in the memory pointed to by @con and must be freed * by the user with freecon(). */ int selabel_lookup(struct selabel_handle *handle, char **con, const char *key, int type); int selabel_lookup_raw(struct selabel_handle *handle, char **con, const char *key, int type); bool selabel_partial_match(struct selabel_handle *handle, const char *key); int selabel_lookup_best_match(struct selabel_handle *rec, char **con, const char *key, const char **aliases, int type); int selabel_lookup_best_match_raw(struct selabel_handle *rec, char **con, const char *key, const char **aliases, int type); /** * selabel_digest - Retrieve the SHA1 digest and the list of specfiles used to * generate the digest. The SELABEL_OPT_DIGEST option must * be set in selabel_open() to initiate the digest generation. * @handle: specifies backend instance to query * @digest: returns a pointer to the SHA1 digest. * @digest_len: returns length of digest in bytes. * @specfiles: a list of specfiles used in the SHA1 digest generation. * The list is NULL terminated and will hold @num_specfiles entries. * @num_specfiles: number of specfiles in the list. * * Return %0 on success, -%1 with @errno set on failure. */ int selabel_digest(struct selabel_handle *rec, unsigned char **digest, size_t *digest_len, char ***specfiles, size_t *num_specfiles); enum selabel_cmp_result { SELABEL_SUBSET, SELABEL_EQUAL, SELABEL_SUPERSET, SELABEL_INCOMPARABLE }; /** * selabel_cmp - Compare two label configurations. * @h1: handle for the first label configuration * @h2: handle for the first label configuration * * Compare two label configurations. * Return %SELABEL_SUBSET if @h1 is a subset of @h2, %SELABEL_EQUAL * if @h1 is identical to @h2, %SELABEL_SUPERSET if @h1 is a superset * of @h2, and %SELABEL_INCOMPARABLE if @h1 and @h2 are incomparable. */ enum selabel_cmp_result selabel_cmp(struct selabel_handle *h1, struct selabel_handle *h2); /** * selabel_stats - log labeling operation statistics. * @handle: specifies backend instance to query * * Log a message with information about the number of queries performed, * number of unused matching entries, or other operational statistics. * Message is backend-specific, some backends may not output a message. */ void selabel_stats(struct selabel_handle *handle); /* * Type codes used by specific backends */ /* X backend */ #define SELABEL_X_PROP 1 #define SELABEL_X_EXT 2 #define SELABEL_X_CLIENT 3 #define SELABEL_X_EVENT 4 #define SELABEL_X_SELN 5 #define SELABEL_X_POLYPROP 6 #define SELABEL_X_POLYSELN 7 /* DB backend */ #define SELABEL_DB_DATABASE 1 #define SELABEL_DB_SCHEMA 2 #define SELABEL_DB_TABLE 3 #define SELABEL_DB_COLUMN 4 #define SELABEL_DB_SEQUENCE 5 #define SELABEL_DB_VIEW 6 #define SELABEL_DB_PROCEDURE 7 #define SELABEL_DB_BLOB 8 #define SELABEL_DB_TUPLE 9 #define SELABEL_DB_LANGUAGE 10 #define SELABEL_DB_EXCEPTION 11 #define SELABEL_DB_DATATYPE 12 #ifdef __cplusplus } #endif #endif /* _SELABEL_H_ */ selinux/get_context_list.h000064400000005550147631660260012002 0ustar00#ifndef _SELINUX_GET_SID_LIST_H_ #define _SELINUX_GET_SID_LIST_H_ #include #ifdef __cplusplus extern "C" { #endif #define SELINUX_DEFAULTUSER "user_u" /* Get an ordered list of authorized security contexts for a user session for 'user' spawned by 'fromcon' and set *conary to refer to the NULL-terminated array of contexts. Every entry in the list will be authorized by the policy, but the ordering is subject to user customizable preferences. Returns number of entries in *conary. If 'fromcon' is NULL, defaults to current context. Caller must free via freeconary. */ extern int get_ordered_context_list(const char *user, char * fromcon, char *** list); /* As above, but use the provided MLS level rather than the default level for the user. */ int get_ordered_context_list_with_level(const char *user, const char *level, char * fromcon, char *** list); /* Get the default security context for a user session for 'user' spawned by 'fromcon' and set *newcon to refer to it. The context will be one of those authorized by the policy, but the selection of a default is subject to user customizable preferences. If 'fromcon' is NULL, defaults to current context. Returns 0 on success or -1 otherwise. Caller must free via freecon. */ extern int get_default_context(const char *user, char * fromcon, char ** newcon); /* As above, but use the provided MLS level rather than the default level for the user. */ int get_default_context_with_level(const char *user, const char *level, char * fromcon, char ** newcon); /* Same as get_default_context, but only return a context that has the specified role. If no reachable context exists for the user with that role, then return -1. */ int get_default_context_with_role(const char *user, const char *role, char * fromcon, char ** newcon); /* Same as get_default_context, but only return a context that has the specified role and level. If no reachable context exists for the user with that role, then return -1. */ int get_default_context_with_rolelevel(const char *user, const char *level, const char *role, char * fromcon, char ** newcon); /* Given a list of authorized security contexts for the user, query the user to select one and set *newcon to refer to it. Caller must free via freecon. Returns 0 on sucess or -1 otherwise. */ extern int query_user_context(char ** list, char ** newcon); /* Allow the user to manually enter a context as a fallback if a list of authorized contexts could not be obtained. Caller must free via freecon. Returns 0 on success or -1 otherwise. */ extern int manual_user_enter_context(const char *user, char ** newcon); #ifdef __cplusplus } #endif #endif libtasn1.h000064400000030727147631660260006456 0ustar00/* * Copyright (C) 2002-2014 Free Software Foundation, Inc. * * This file is part of LIBTASN1. * * LIBTASN1 is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * LIBTASN1 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with LIBTASN1; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA * */ #ifndef LIBTASN1_H #define LIBTASN1_H #ifndef ASN1_API #if defined ASN1_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY #define ASN1_API __attribute__((__visibility__("default"))) #elif defined ASN1_BUILDING && defined _MSC_VER && ! defined ASN1_STATIC #define ASN1_API __declspec(dllexport) #elif defined _MSC_VER && ! defined ASN1_STATIC #define ASN1_API __declspec(dllimport) #else #define ASN1_API #endif #endif #include #include #include /* for FILE* */ #ifdef __cplusplus extern "C" { #endif #define ASN1_VERSION "4.10" #if defined(__GNUC__) && !defined(ASN1_INTERNAL_BUILD) # define _ASN1_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) # if _ASN1_GCC_VERSION >= 30100 # define _ASN1_GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__)) # endif #endif #ifndef _ASN1_GCC_ATTR_DEPRECATED #define _ASN1_GCC_ATTR_DEPRECATED #endif /*****************************************/ /* Errors returned by libtasn1 functions */ /*****************************************/ #define ASN1_SUCCESS 0 #define ASN1_FILE_NOT_FOUND 1 #define ASN1_ELEMENT_NOT_FOUND 2 #define ASN1_IDENTIFIER_NOT_FOUND 3 #define ASN1_DER_ERROR 4 #define ASN1_VALUE_NOT_FOUND 5 #define ASN1_GENERIC_ERROR 6 #define ASN1_VALUE_NOT_VALID 7 #define ASN1_TAG_ERROR 8 #define ASN1_TAG_IMPLICIT 9 #define ASN1_ERROR_TYPE_ANY 10 #define ASN1_SYNTAX_ERROR 11 #define ASN1_MEM_ERROR 12 #define ASN1_MEM_ALLOC_ERROR 13 #define ASN1_DER_OVERFLOW 14 #define ASN1_NAME_TOO_LONG 15 #define ASN1_ARRAY_ERROR 16 #define ASN1_ELEMENT_NOT_EMPTY 17 /*************************************/ /* Constants used in asn1_visit_tree */ /*************************************/ #define ASN1_PRINT_NAME 1 #define ASN1_PRINT_NAME_TYPE 2 #define ASN1_PRINT_NAME_TYPE_VALUE 3 #define ASN1_PRINT_ALL 4 /*****************************************/ /* Constants returned by asn1_read_tag */ /*****************************************/ #define ASN1_CLASS_UNIVERSAL 0x00 /* old: 1 */ #define ASN1_CLASS_APPLICATION 0x40 /* old: 2 */ #define ASN1_CLASS_CONTEXT_SPECIFIC 0x80 /* old: 3 */ #define ASN1_CLASS_PRIVATE 0xC0 /* old: 4 */ #define ASN1_CLASS_STRUCTURED 0x20 /*****************************************/ /* Constants returned by asn1_read_tag */ /*****************************************/ #define ASN1_TAG_BOOLEAN 0x01 #define ASN1_TAG_INTEGER 0x02 #define ASN1_TAG_SEQUENCE 0x10 #define ASN1_TAG_SET 0x11 #define ASN1_TAG_OCTET_STRING 0x04 #define ASN1_TAG_BIT_STRING 0x03 #define ASN1_TAG_UTCTime 0x17 #define ASN1_TAG_GENERALIZEDTime 0x18 #define ASN1_TAG_OBJECT_ID 0x06 #define ASN1_TAG_ENUMERATED 0x0A #define ASN1_TAG_NULL 0x05 #define ASN1_TAG_GENERALSTRING 0x1B #define ASN1_TAG_NUMERIC_STRING 0x12 #define ASN1_TAG_IA5_STRING 0x16 #define ASN1_TAG_TELETEX_STRING 0x14 #define ASN1_TAG_PRINTABLE_STRING 0x13 #define ASN1_TAG_UNIVERSAL_STRING 0x1C #define ASN1_TAG_BMP_STRING 0x1E #define ASN1_TAG_UTF8_STRING 0x0C #define ASN1_TAG_VISIBLE_STRING 0x1A /******************************************************/ /* Structure definition used for the node of the tree */ /* that represent an ASN.1 DEFINITION. */ /******************************************************/ typedef struct asn1_node_st asn1_node_st; typedef asn1_node_st *asn1_node; /* maximum number of characters of a name */ /* inside a file with ASN1 definitons */ #define ASN1_MAX_NAME_SIZE 64 /*****************************************/ /* For the on-disk format of ASN.1 trees */ /*****************************************/ struct asn1_static_node_st { const char *name; /* Node name */ unsigned int type; /* Node type */ const void *value; /* Node value */ }; typedef struct asn1_static_node_st asn1_static_node; /* List of constants for field type of node_asn */ #define ASN1_ETYPE_INVALID 0 #define ASN1_ETYPE_CONSTANT 1 #define ASN1_ETYPE_IDENTIFIER 2 #define ASN1_ETYPE_INTEGER 3 #define ASN1_ETYPE_BOOLEAN 4 #define ASN1_ETYPE_SEQUENCE 5 #define ASN1_ETYPE_BIT_STRING 6 #define ASN1_ETYPE_OCTET_STRING 7 #define ASN1_ETYPE_TAG 8 #define ASN1_ETYPE_DEFAULT 9 #define ASN1_ETYPE_SIZE 10 #define ASN1_ETYPE_SEQUENCE_OF 11 #define ASN1_ETYPE_OBJECT_ID 12 #define ASN1_ETYPE_ANY 13 #define ASN1_ETYPE_SET 14 #define ASN1_ETYPE_SET_OF 15 #define ASN1_ETYPE_DEFINITIONS 16 #define ASN1_ETYPE_CHOICE 18 #define ASN1_ETYPE_IMPORTS 19 #define ASN1_ETYPE_NULL 20 #define ASN1_ETYPE_ENUMERATED 21 #define ASN1_ETYPE_GENERALSTRING 27 #define ASN1_ETYPE_NUMERIC_STRING 28 #define ASN1_ETYPE_IA5_STRING 29 #define ASN1_ETYPE_TELETEX_STRING 30 #define ASN1_ETYPE_PRINTABLE_STRING 31 #define ASN1_ETYPE_UNIVERSAL_STRING 32 #define ASN1_ETYPE_BMP_STRING 33 #define ASN1_ETYPE_UTF8_STRING 34 #define ASN1_ETYPE_VISIBLE_STRING 35 #define ASN1_ETYPE_UTC_TIME 36 #define ASN1_ETYPE_GENERALIZED_TIME 37 /* Flags used by asn1_delete_structure2() */ /* makes sure the values are zeroized prior to deinitialization */ #define ASN1_DELETE_FLAG_ZEROIZE 1 /* Flags used by asn1_der_decoding2(). */ /* This flag would allow arbitrary data past the DER data */ #define ASN1_DECODE_FLAG_ALLOW_PADDING 1 /* This flag would ensure that no BER decoding takes place */ #define ASN1_DECODE_FLAG_STRICT_DER (1<<1) struct asn1_data_node_st { const char *name; /* Node name */ const void *value; /* Node value */ unsigned int value_len; /* Node value size */ unsigned int type; /* Node value type (ASN1_ETYPE_*) */ }; typedef struct asn1_data_node_st asn1_data_node_st; /***********************************/ /* Fixed constants */ /***********************************/ /* maximum number of characters */ /* of a description message */ /* (null character included) */ #define ASN1_MAX_ERROR_DESCRIPTION_SIZE 128 /***********************************/ /* Functions definitions */ /***********************************/ extern ASN1_API int asn1_parser2tree (const char *file, asn1_node * definitions, char *error_desc); extern ASN1_API int asn1_parser2array (const char *inputFileName, const char *outputFileName, const char *vectorName, char *error_desc); extern ASN1_API int asn1_array2tree (const asn1_static_node * array, asn1_node * definitions, char *errorDescription); extern ASN1_API void asn1_print_structure (FILE * out, asn1_node structure, const char *name, int mode); extern ASN1_API int asn1_create_element (asn1_node definitions, const char *source_name, asn1_node * element); extern ASN1_API int asn1_delete_structure (asn1_node * structure); extern ASN1_API int asn1_delete_structure2 (asn1_node * structure, unsigned int flags); extern ASN1_API int asn1_delete_element (asn1_node structure, const char *element_name); extern ASN1_API int asn1_write_value (asn1_node node_root, const char *name, const void *ivalue, int len); extern ASN1_API int asn1_read_value (asn1_node root, const char *name, void *ivalue, int *len); extern ASN1_API int asn1_read_value_type (asn1_node root, const char *name, void *ivalue, int *len, unsigned int *etype); extern ASN1_API int asn1_read_node_value (asn1_node node, asn1_data_node_st * data); extern ASN1_API int asn1_number_of_elements (asn1_node element, const char *name, int *num); extern ASN1_API int asn1_der_coding (asn1_node element, const char *name, void *ider, int *len, char *ErrorDescription); extern ASN1_API int asn1_der_decoding2 (asn1_node *element, const void *ider, int *max_ider_len, unsigned int flags, char *errorDescription); extern ASN1_API int asn1_der_decoding (asn1_node * element, const void *ider, int len, char *errorDescription); /* Do not use. Use asn1_der_decoding() instead. */ extern ASN1_API int asn1_der_decoding_element (asn1_node * structure, const char *elementName, const void *ider, int len, char *errorDescription) _ASN1_GCC_ATTR_DEPRECATED; extern ASN1_API int asn1_der_decoding_startEnd (asn1_node element, const void *ider, int len, const char *name_element, int *start, int *end); extern ASN1_API int asn1_expand_any_defined_by (asn1_node definitions, asn1_node * element); extern ASN1_API int asn1_expand_octet_string (asn1_node definitions, asn1_node * element, const char *octetName, const char *objectName); extern ASN1_API int asn1_read_tag (asn1_node root, const char *name, int *tagValue, int *classValue); extern ASN1_API const char *asn1_find_structure_from_oid (asn1_node definitions, const char *oidValue); extern ASN1_API const char *asn1_check_version (const char *req_version); extern ASN1_API const char *asn1_strerror (int error); extern ASN1_API void asn1_perror (int error); #define ASN1_MAX_TAG_SIZE 4 #define ASN1_MAX_LENGTH_SIZE 9 #define ASN1_MAX_TL_SIZE (ASN1_MAX_TAG_SIZE+ASN1_MAX_LENGTH_SIZE) extern ASN1_API long asn1_get_length_der (const unsigned char *der, int der_len, int *len); extern ASN1_API long asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len); extern ASN1_API void asn1_length_der (unsigned long int len, unsigned char *der, int *der_len); /* Other utility functions. */ extern ASN1_API int asn1_decode_simple_der (unsigned int etype, const unsigned char *der, unsigned int der_len, const unsigned char **str, unsigned int *str_len); extern ASN1_API int asn1_decode_simple_ber (unsigned int etype, const unsigned char *der, unsigned int der_len, unsigned char **str, unsigned int *str_len, unsigned int *ber_len); extern ASN1_API int asn1_encode_simple_der (unsigned int etype, const unsigned char *str, unsigned int str_len, unsigned char *tl, unsigned int *tl_len); extern ASN1_API asn1_node asn1_find_node (asn1_node pointer, const char *name); extern ASN1_API int asn1_copy_node (asn1_node dst, const char *dst_name, asn1_node src, const char *src_name); extern ASN1_API asn1_node asn1_dup_node (asn1_node src, const char *src_name); /* Internal and low-level DER utility functions. */ extern ASN1_API int asn1_get_tag_der (const unsigned char *der, int der_len, unsigned char *cls, int *len, unsigned long *tag); extern ASN1_API void asn1_octet_der (const unsigned char *str, int str_len, unsigned char *der, int *der_len); extern ASN1_API int asn1_get_octet_der (const unsigned char *der, int der_len, int *ret_len, unsigned char *str, int str_size, int *str_len); extern ASN1_API void asn1_bit_der (const unsigned char *str, int bit_len, unsigned char *der, int *der_len); extern ASN1_API int asn1_get_bit_der (const unsigned char *der, int der_len, int *ret_len, unsigned char *str, int str_size, int *bit_len); extern ASN1_API int asn1_get_object_id_der (const unsigned char *der, int der_len, int *ret_len, char *str, int str_size); /* Compatibility types */ typedef int asn1_retCode; /* type returned by libtasn1 functions */ #define node_asn_struct asn1_node_st #define node_asn asn1_node_st #define ASN1_TYPE asn1_node #define ASN1_TYPE_EMPTY NULL #define static_struct_asn asn1_static_node_st #define ASN1_ARRAY_TYPE asn1_static_node #define asn1_static_node_t asn1_static_node #define node_data_struct asn1_data_node_st #define ASN1_DATA_NODE asn1_data_node_st #ifdef __cplusplus } #endif #endif /* LIBTASN1_H */ pwd.h000064400000013576147631660260005536 0ustar00/* Copyright (C) 1991,1992,1995-2001,2003,2004,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ /* * POSIX Standard: 9.2.2 User Database Access */ #ifndef _PWD_H #define _PWD_H 1 #include __BEGIN_DECLS #include #define __need_size_t #include #if defined __USE_XOPEN || defined __USE_XOPEN2K /* The Single Unix specification says that some more types are available here. */ # ifndef __gid_t_defined typedef __gid_t gid_t; # define __gid_t_defined # endif # ifndef __uid_t_defined typedef __uid_t uid_t; # define __uid_t_defined # endif #endif /* The passwd structure. */ struct passwd { char *pw_name; /* Username. */ char *pw_passwd; /* Password. */ __uid_t pw_uid; /* User ID. */ __gid_t pw_gid; /* Group ID. */ char *pw_gecos; /* Real name. */ char *pw_dir; /* Home directory. */ char *pw_shell; /* Shell program. */ }; #if defined __USE_SVID || defined __USE_GNU # define __need_FILE # include #endif #if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN_EXTENDED /* Rewind the password-file stream. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void setpwent (void); /* Close the password-file stream. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void endpwent (void); /* Read an entry from the password-file stream, opening it if necessary. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct passwd *getpwent (void); #endif #ifdef __USE_SVID /* Read an entry from STREAM. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern struct passwd *fgetpwent (FILE *__stream); /* Write the given entry onto the given stream. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int putpwent (const struct passwd *__restrict __p, FILE *__restrict __f); #endif /* Search for an entry with a matching user ID. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct passwd *getpwuid (__uid_t __uid); /* Search for an entry with a matching username. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct passwd *getpwnam (const char *__name); #if defined __USE_POSIX || defined __USE_MISC # ifdef __USE_MISC /* Reasonable value for the buffer sized used in the reentrant functions below. But better use `sysconf'. */ # define NSS_BUFLEN_PASSWD 1024 # endif /* Reentrant versions of some of the functions above. PLEASE NOTE: the `getpwent_r' function is not (yet) standardized. The interface may change in later versions of this library. But the interface is designed following the principals used for the other reentrant functions so the chances are good this is what the POSIX people would choose. */ # if defined __USE_SVID || defined __USE_MISC /* This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int getpwent_r (struct passwd *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct passwd **__restrict __result); # endif extern int getpwuid_r (__uid_t __uid, struct passwd *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct passwd **__restrict __result); extern int getpwnam_r (const char *__restrict __name, struct passwd *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct passwd **__restrict __result); # ifdef __USE_SVID /* Read an entry from STREAM. This function is not standardized and probably never will. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int fgetpwent_r (FILE *__restrict __stream, struct passwd *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct passwd **__restrict __result); # endif #endif /* POSIX or reentrant */ #ifdef __USE_GNU /* Re-construct the password-file line for the given uid in the given buffer. This knows the format that the caller will expect, but this need not be the format of the password file. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int getpw (__uid_t __uid, char *__buffer); #endif __END_DECLS #endif /* pwd.h */ libintl.h000064400000010765147631660260006376 0ustar00/* Message catalogs for internationalization. Copyright (C) 1995-2002, 2004, 2005, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. This file is derived from the file libgettext.h in the GNU gettext package. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ #ifndef _LIBINTL_H #define _LIBINTL_H 1 #include /* We define an additional symbol to signal that we use the GNU implementation of gettext. */ #define __USE_GNU_GETTEXT 1 /* Provide information about the supported file formats. Returns the maximum minor revision number supported for a given major revision. */ #define __GNU_GETTEXT_SUPPORTED_REVISION(major) \ ((major) == 0 ? 1 : -1) __BEGIN_DECLS /* Look up MSGID in the current default message catalog for the current LC_MESSAGES locale. If not found, returns MSGID itself (the default text). */ extern char *gettext (const char *__msgid) __THROW __attribute_format_arg__ (1); /* Look up MSGID in the DOMAINNAME message catalog for the current LC_MESSAGES locale. */ extern char *dgettext (const char *__domainname, const char *__msgid) __THROW __attribute_format_arg__ (2); extern char *__dgettext (const char *__domainname, const char *__msgid) __THROW __attribute_format_arg__ (2); /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY locale. */ extern char *dcgettext (const char *__domainname, const char *__msgid, int __category) __THROW __attribute_format_arg__ (2); extern char *__dcgettext (const char *__domainname, const char *__msgid, int __category) __THROW __attribute_format_arg__ (2); /* Similar to `gettext' but select the plural form corresponding to the number N. */ extern char *ngettext (const char *__msgid1, const char *__msgid2, unsigned long int __n) __THROW __attribute_format_arg__ (1) __attribute_format_arg__ (2); /* Similar to `dgettext' but select the plural form corresponding to the number N. */ extern char *dngettext (const char *__domainname, const char *__msgid1, const char *__msgid2, unsigned long int __n) __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3); /* Similar to `dcgettext' but select the plural form corresponding to the number N. */ extern char *dcngettext (const char *__domainname, const char *__msgid1, const char *__msgid2, unsigned long int __n, int __category) __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3); /* Set the current default message catalog to DOMAINNAME. If DOMAINNAME is null, return the current default. If DOMAINNAME is "", reset to the default of "messages". */ extern char *textdomain (const char *__domainname) __THROW; /* Specify that the DOMAINNAME message catalog will be found in DIRNAME rather than in the system locale data base. */ extern char *bindtextdomain (const char *__domainname, const char *__dirname) __THROW; /* Specify the character encoding in which the messages from the DOMAINNAME message catalog will be returned. */ extern char *bind_textdomain_codeset (const char *__domainname, const char *__codeset) __THROW; /* Optimized version of the function above. */ #if defined __OPTIMIZE__ && !defined __cplusplus /* We need NULL for `gettext'. */ # define __need_NULL # include /* We need LC_MESSAGES for `dgettext'. */ # include /* These must be macros. Inlined functions are useless because the `__builtin_constant_p' predicate in dcgettext would always return false. */ # define gettext(msgid) dgettext (NULL, msgid) # define dgettext(domainname, msgid) \ dcgettext (domainname, msgid, LC_MESSAGES) # define ngettext(msgid1, msgid2, n) dngettext (NULL, msgid1, msgid2, n) # define dngettext(domainname, msgid1, msgid2, n) \ dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES) #endif /* Optimizing. */ __END_DECLS #endif /* libintl.h */ freetype2/ft2build.h000064400000004517147631660260010357 0ustar00/***************************************************************************/ /* */ /* ft2build.h */ /* */ /* FreeType 2 build and setup macros. */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ /*************************************************************************/ /* */ /* This is the `entry point' for FreeType header file inclusions. It is */ /* the only header file which should be included directly; all other */ /* FreeType header files should be accessed with macro names (after */ /* including `ft2build.h'). */ /* */ /* A typical example is */ /* */ /* #include */ /* #include FT_FREETYPE_H */ /* */ /*************************************************************************/ #ifndef FT2BUILD_H_ #define FT2BUILD_H_ #include #endif /* FT2BUILD_H_ */ /* END */ freetype2/freetype/ftgasp.h000064400000011265147631660260011751 0ustar00/***************************************************************************/ /* */ /* ftgasp.h */ /* */ /* Access of TrueType's `gasp' table (specification). */ /* */ /* Copyright 2007-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTGASP_H_ #define FTGASP_H_ #include #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif /*************************************************************************** * * @section: * gasp_table * * @title: * Gasp Table * * @abstract: * Retrieving TrueType `gasp' table entries. * * @description: * The function @FT_Get_Gasp can be used to query a TrueType or OpenType * font for specific entries in its `gasp' table, if any. This is * mainly useful when implementing native TrueType hinting with the * bytecode interpreter to duplicate the Windows text rendering results. */ /************************************************************************* * * @enum: * FT_GASP_XXX * * @description: * A list of values and/or bit-flags returned by the @FT_Get_Gasp * function. * * @values: * FT_GASP_NO_TABLE :: * This special value means that there is no GASP table in this face. * It is up to the client to decide what to do. * * FT_GASP_DO_GRIDFIT :: * Grid-fitting and hinting should be performed at the specified ppem. * This *really* means TrueType bytecode interpretation. If this bit * is not set, no hinting gets applied. * * FT_GASP_DO_GRAY :: * Anti-aliased rendering should be performed at the specified ppem. * If not set, do monochrome rendering. * * FT_GASP_SYMMETRIC_SMOOTHING :: * If set, smoothing along multiple axes must be used with ClearType. * * FT_GASP_SYMMETRIC_GRIDFIT :: * Grid-fitting must be used with ClearType's symmetric smoothing. * * @note: * The bit-flags `FT_GASP_DO_GRIDFIT' and `FT_GASP_DO_GRAY' are to be * used for standard font rasterization only. Independently of that, * `FT_GASP_SYMMETRIC_SMOOTHING' and `FT_GASP_SYMMETRIC_GRIDFIT' are to * be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT' and * `FT_GASP_DO_GRAY' are consequently ignored). * * `ClearType' is Microsoft's implementation of LCD rendering, partly * protected by patents. * * @since: * 2.3.0 */ #define FT_GASP_NO_TABLE -1 #define FT_GASP_DO_GRIDFIT 0x01 #define FT_GASP_DO_GRAY 0x02 #define FT_GASP_SYMMETRIC_GRIDFIT 0x04 #define FT_GASP_SYMMETRIC_SMOOTHING 0x08 /************************************************************************* * * @func: * FT_Get_Gasp * * @description: * For a TrueType or OpenType font file, return the rasterizer behaviour * flags from the font's `gasp' table corresponding to a given * character pixel size. * * @input: * face :: The source face handle. * * ppem :: The vertical character pixel size. * * @return: * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no * `gasp' table in the face. * * @note: * If you want to use the MM functionality of OpenType variation fonts * (i.e., using @FT_Set_Var_Design_Coordinates and friends), call this * function *after* setting an instance since the return values can * change. * * @since: * 2.3.0 */ FT_EXPORT( FT_Int ) FT_Get_Gasp( FT_Face face, FT_UInt ppem ); /* */ #endif /* FTGASP_H_ */ /* END */ freetype2/freetype/ftrender.h000064400000026070147631660260012276 0ustar00/***************************************************************************/ /* */ /* ftrender.h */ /* */ /* FreeType renderer modules public interface (specification). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTRENDER_H_ #define FTRENDER_H_ #include #include FT_MODULE_H #include FT_GLYPH_H FT_BEGIN_HEADER /*************************************************************************/ /* */ /*
*/ /* module_management */ /* */ /*************************************************************************/ /* create a new glyph object */ typedef FT_Error (*FT_Glyph_InitFunc)( FT_Glyph glyph, FT_GlyphSlot slot ); /* destroys a given glyph object */ typedef void (*FT_Glyph_DoneFunc)( FT_Glyph glyph ); typedef void (*FT_Glyph_TransformFunc)( FT_Glyph glyph, const FT_Matrix* matrix, const FT_Vector* delta ); typedef void (*FT_Glyph_GetBBoxFunc)( FT_Glyph glyph, FT_BBox* abbox ); typedef FT_Error (*FT_Glyph_CopyFunc)( FT_Glyph source, FT_Glyph target ); typedef FT_Error (*FT_Glyph_PrepareFunc)( FT_Glyph glyph, FT_GlyphSlot slot ); /* deprecated */ #define FT_Glyph_Init_Func FT_Glyph_InitFunc #define FT_Glyph_Done_Func FT_Glyph_DoneFunc #define FT_Glyph_Transform_Func FT_Glyph_TransformFunc #define FT_Glyph_BBox_Func FT_Glyph_GetBBoxFunc #define FT_Glyph_Copy_Func FT_Glyph_CopyFunc #define FT_Glyph_Prepare_Func FT_Glyph_PrepareFunc struct FT_Glyph_Class_ { FT_Long glyph_size; FT_Glyph_Format glyph_format; FT_Glyph_InitFunc glyph_init; FT_Glyph_DoneFunc glyph_done; FT_Glyph_CopyFunc glyph_copy; FT_Glyph_TransformFunc glyph_transform; FT_Glyph_GetBBoxFunc glyph_bbox; FT_Glyph_PrepareFunc glyph_prepare; }; typedef FT_Error (*FT_Renderer_RenderFunc)( FT_Renderer renderer, FT_GlyphSlot slot, FT_UInt mode, const FT_Vector* origin ); typedef FT_Error (*FT_Renderer_TransformFunc)( FT_Renderer renderer, FT_GlyphSlot slot, const FT_Matrix* matrix, const FT_Vector* delta ); typedef void (*FT_Renderer_GetCBoxFunc)( FT_Renderer renderer, FT_GlyphSlot slot, FT_BBox* cbox ); typedef FT_Error (*FT_Renderer_SetModeFunc)( FT_Renderer renderer, FT_ULong mode_tag, FT_Pointer mode_ptr ); /* deprecated identifiers */ #define FTRenderer_render FT_Renderer_RenderFunc #define FTRenderer_transform FT_Renderer_TransformFunc #define FTRenderer_getCBox FT_Renderer_GetCBoxFunc #define FTRenderer_setMode FT_Renderer_SetModeFunc /*************************************************************************/ /* */ /* */ /* FT_Renderer_Class */ /* */ /* */ /* The renderer module class descriptor. */ /* */ /* */ /* root :: The root @FT_Module_Class fields. */ /* */ /* glyph_format :: The glyph image format this renderer handles. */ /* */ /* render_glyph :: A method used to render the image that is in a */ /* given glyph slot into a bitmap. */ /* */ /* transform_glyph :: A method used to transform the image that is in */ /* a given glyph slot. */ /* */ /* get_glyph_cbox :: A method used to access the glyph's cbox. */ /* */ /* set_mode :: A method used to pass additional parameters. */ /* */ /* raster_class :: For @FT_GLYPH_FORMAT_OUTLINE renderers only. */ /* This is a pointer to its raster's class. */ /* */ typedef struct FT_Renderer_Class_ { FT_Module_Class root; FT_Glyph_Format glyph_format; FT_Renderer_RenderFunc render_glyph; FT_Renderer_TransformFunc transform_glyph; FT_Renderer_GetCBoxFunc get_glyph_cbox; FT_Renderer_SetModeFunc set_mode; FT_Raster_Funcs* raster_class; } FT_Renderer_Class; /*************************************************************************/ /* */ /* */ /* FT_Get_Renderer */ /* */ /* */ /* Retrieve the current renderer for a given glyph format. */ /* */ /* */ /* library :: A handle to the library object. */ /* */ /* format :: The glyph format. */ /* */ /* */ /* A renderer handle. 0~if none found. */ /* */ /* */ /* An error will be returned if a module already exists by that name, */ /* or if the module requires a version of FreeType that is too great. */ /* */ /* To add a new renderer, simply use @FT_Add_Module. To retrieve a */ /* renderer by its name, use @FT_Get_Module. */ /* */ FT_EXPORT( FT_Renderer ) FT_Get_Renderer( FT_Library library, FT_Glyph_Format format ); /*************************************************************************/ /* */ /* */ /* FT_Set_Renderer */ /* */ /* */ /* Set the current renderer to use, and set additional mode. */ /* */ /* */ /* library :: A handle to the library object. */ /* */ /* */ /* renderer :: A handle to the renderer object. */ /* */ /* num_params :: The number of additional parameters. */ /* */ /* parameters :: Additional parameters. */ /* */ /* */ /* FreeType error code. 0~means success. */ /* */ /* */ /* In case of success, the renderer will be used to convert glyph */ /* images in the renderer's known format into bitmaps. */ /* */ /* This doesn't change the current renderer for other formats. */ /* */ /* Currently, no FreeType renderer module uses `parameters'; you */ /* should thus always pass NULL as the value. */ /* */ FT_EXPORT( FT_Error ) FT_Set_Renderer( FT_Library library, FT_Renderer renderer, FT_UInt num_params, FT_Parameter* parameters ); /* */ FT_END_HEADER #endif /* FTRENDER_H_ */ /* END */ freetype2/freetype/ftadvanc.h000064400000024614147631660260012255 0ustar00/***************************************************************************/ /* */ /* ftadvanc.h */ /* */ /* Quick computation of advance widths (specification only). */ /* */ /* Copyright 2008-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTADVANC_H_ #define FTADVANC_H_ #include #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /************************************************************************** * * @section: * quick_advance * * @title: * Quick retrieval of advance values * * @abstract: * Retrieve horizontal and vertical advance values without processing * glyph outlines, if possible. * * @description: * This section contains functions to quickly extract advance values * without handling glyph outlines, if possible. * * @order: * FT_Get_Advance * FT_Get_Advances * */ /*************************************************************************/ /* */ /* */ /* FT_ADVANCE_FLAG_FAST_ONLY */ /* */ /* */ /* A bit-flag to be OR-ed with the `flags' parameter of the */ /* @FT_Get_Advance and @FT_Get_Advances functions. */ /* */ /* If set, it indicates that you want these functions to fail if the */ /* corresponding hinting mode or font driver doesn't allow for very */ /* quick advance computation. */ /* */ /* Typically, glyphs that are either unscaled, unhinted, bitmapped, */ /* or light-hinted can have their advance width computed very */ /* quickly. */ /* */ /* Normal and bytecode hinted modes that require loading, scaling, */ /* and hinting of the glyph outline, are extremely slow by */ /* comparison. */ /* */ #define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000L /*************************************************************************/ /* */ /* */ /* FT_Get_Advance */ /* */ /* */ /* Retrieve the advance value of a given glyph outline in an */ /* @FT_Face. */ /* */ /* */ /* face :: The source @FT_Face handle. */ /* */ /* gindex :: The glyph index. */ /* */ /* load_flags :: A set of bit flags similar to those used when */ /* calling @FT_Load_Glyph, used to determine what kind */ /* of advances you need. */ /* */ /* padvance :: The advance value. If scaling is performed (based on */ /* the value of `load_flags'), the advance value is in */ /* 16.16 format. Otherwise, it is in font units. */ /* */ /* If @FT_LOAD_VERTICAL_LAYOUT is set, this is the */ /* vertical advance corresponding to a vertical layout. */ /* Otherwise, it is the horizontal advance in a */ /* horizontal layout. */ /* */ /* */ /* FreeType error code. 0 means success. */ /* */ /* */ /* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */ /* if the corresponding font backend doesn't have a quick way to */ /* retrieve the advances. */ /* */ /* A scaled advance is returned in 16.16 format but isn't transformed */ /* by the affine transformation specified by @FT_Set_Transform. */ /* */ FT_EXPORT( FT_Error ) FT_Get_Advance( FT_Face face, FT_UInt gindex, FT_Int32 load_flags, FT_Fixed *padvance ); /*************************************************************************/ /* */ /* */ /* FT_Get_Advances */ /* */ /* */ /* Retrieve the advance values of several glyph outlines in an */ /* @FT_Face. */ /* */ /* */ /* face :: The source @FT_Face handle. */ /* */ /* start :: The first glyph index. */ /* */ /* count :: The number of advance values you want to retrieve. */ /* */ /* load_flags :: A set of bit flags similar to those used when */ /* calling @FT_Load_Glyph. */ /* */ /* */ /* padvance :: The advance values. This array, to be provided by the */ /* caller, must contain at least `count' elements. */ /* */ /* If scaling is performed (based on the value of */ /* `load_flags'), the advance values are in 16.16 format. */ /* Otherwise, they are in font units. */ /* */ /* If @FT_LOAD_VERTICAL_LAYOUT is set, these are the */ /* vertical advances corresponding to a vertical layout. */ /* Otherwise, they are the horizontal advances in a */ /* horizontal layout. */ /* */ /* */ /* FreeType error code. 0 means success. */ /* */ /* */ /* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */ /* if the corresponding font backend doesn't have a quick way to */ /* retrieve the advances. */ /* */ /* Scaled advances are returned in 16.16 format but aren't */ /* transformed by the affine transformation specified by */ /* @FT_Set_Transform. */ /* */ FT_EXPORT( FT_Error ) FT_Get_Advances( FT_Face face, FT_UInt start, FT_UInt count, FT_Int32 load_flags, FT_Fixed *padvances ); /* */ FT_END_HEADER #endif /* FTADVANC_H_ */ /* END */ freetype2/freetype/ftincrem.h000064400000026206147631660260012275 0ustar00/***************************************************************************/ /* */ /* ftincrem.h */ /* */ /* FreeType incremental loading (specification). */ /* */ /* Copyright 2002-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTINCREM_H_ #define FTINCREM_H_ #include #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************** * * @section: * incremental * * @title: * Incremental Loading * * @abstract: * Custom Glyph Loading. * * @description: * This section contains various functions used to perform so-called * `incremental' glyph loading. This is a mode where all glyphs loaded * from a given @FT_Face are provided by the client application. * * Apart from that, all other tables are loaded normally from the font * file. This mode is useful when FreeType is used within another * engine, e.g., a PostScript Imaging Processor. * * To enable this mode, you must use @FT_Open_Face, passing an * @FT_Parameter with the @FT_PARAM_TAG_INCREMENTAL tag and an * @FT_Incremental_Interface value. See the comments for * @FT_Incremental_InterfaceRec for an example. * */ /*************************************************************************** * * @type: * FT_Incremental * * @description: * An opaque type describing a user-provided object used to implement * `incremental' glyph loading within FreeType. This is used to support * embedded fonts in certain environments (e.g., PostScript interpreters), * where the glyph data isn't in the font file, or must be overridden by * different values. * * @note: * It is up to client applications to create and implement @FT_Incremental * objects, as long as they provide implementations for the methods * @FT_Incremental_GetGlyphDataFunc, @FT_Incremental_FreeGlyphDataFunc * and @FT_Incremental_GetGlyphMetricsFunc. * * See the description of @FT_Incremental_InterfaceRec to understand how * to use incremental objects with FreeType. * */ typedef struct FT_IncrementalRec_* FT_Incremental; /*************************************************************************** * * @struct: * FT_Incremental_MetricsRec * * @description: * A small structure used to contain the basic glyph metrics returned * by the @FT_Incremental_GetGlyphMetricsFunc method. * * @fields: * bearing_x :: * Left bearing, in font units. * * bearing_y :: * Top bearing, in font units. * * advance :: * Horizontal component of glyph advance, in font units. * * advance_v :: * Vertical component of glyph advance, in font units. * * @note: * These correspond to horizontal or vertical metrics depending on the * value of the `vertical' argument to the function * @FT_Incremental_GetGlyphMetricsFunc. * */ typedef struct FT_Incremental_MetricsRec_ { FT_Long bearing_x; FT_Long bearing_y; FT_Long advance; FT_Long advance_v; /* since 2.3.12 */ } FT_Incremental_MetricsRec; /*************************************************************************** * * @struct: * FT_Incremental_Metrics * * @description: * A handle to an @FT_Incremental_MetricsRec structure. * */ typedef struct FT_Incremental_MetricsRec_* FT_Incremental_Metrics; /*************************************************************************** * * @type: * FT_Incremental_GetGlyphDataFunc * * @description: * A function called by FreeType to access a given glyph's data bytes * during @FT_Load_Glyph or @FT_Load_Char if incremental loading is * enabled. * * Note that the format of the glyph's data bytes depends on the font * file format. For TrueType, it must correspond to the raw bytes within * the `glyf' table. For PostScript formats, it must correspond to the * *unencrypted* charstring bytes, without any `lenIV' header. It is * undefined for any other format. * * @input: * incremental :: * Handle to an opaque @FT_Incremental handle provided by the client * application. * * glyph_index :: * Index of relevant glyph. * * @output: * adata :: * A structure describing the returned glyph data bytes (which will be * accessed as a read-only byte block). * * @return: * FreeType error code. 0~means success. * * @note: * If this function returns successfully the method * @FT_Incremental_FreeGlyphDataFunc will be called later to release * the data bytes. * * Nested calls to @FT_Incremental_GetGlyphDataFunc can happen for * compound glyphs. * */ typedef FT_Error (*FT_Incremental_GetGlyphDataFunc)( FT_Incremental incremental, FT_UInt glyph_index, FT_Data* adata ); /*************************************************************************** * * @type: * FT_Incremental_FreeGlyphDataFunc * * @description: * A function used to release the glyph data bytes returned by a * successful call to @FT_Incremental_GetGlyphDataFunc. * * @input: * incremental :: * A handle to an opaque @FT_Incremental handle provided by the client * application. * * data :: * A structure describing the glyph data bytes (which will be accessed * as a read-only byte block). * */ typedef void (*FT_Incremental_FreeGlyphDataFunc)( FT_Incremental incremental, FT_Data* data ); /*************************************************************************** * * @type: * FT_Incremental_GetGlyphMetricsFunc * * @description: * A function used to retrieve the basic metrics of a given glyph index * before accessing its data. This is necessary because, in certain * formats like TrueType, the metrics are stored in a different place from * the glyph images proper. * * @input: * incremental :: * A handle to an opaque @FT_Incremental handle provided by the client * application. * * glyph_index :: * Index of relevant glyph. * * vertical :: * If true, return vertical metrics. * * ametrics :: * This parameter is used for both input and output. * The original glyph metrics, if any, in font units. If metrics are * not available all the values must be set to zero. * * @output: * ametrics :: * The replacement glyph metrics in font units. * */ typedef FT_Error (*FT_Incremental_GetGlyphMetricsFunc) ( FT_Incremental incremental, FT_UInt glyph_index, FT_Bool vertical, FT_Incremental_MetricsRec *ametrics ); /************************************************************************** * * @struct: * FT_Incremental_FuncsRec * * @description: * A table of functions for accessing fonts that load data * incrementally. Used in @FT_Incremental_InterfaceRec. * * @fields: * get_glyph_data :: * The function to get glyph data. Must not be null. * * free_glyph_data :: * The function to release glyph data. Must not be null. * * get_glyph_metrics :: * The function to get glyph metrics. May be null if the font does * not provide overriding glyph metrics. * */ typedef struct FT_Incremental_FuncsRec_ { FT_Incremental_GetGlyphDataFunc get_glyph_data; FT_Incremental_FreeGlyphDataFunc free_glyph_data; FT_Incremental_GetGlyphMetricsFunc get_glyph_metrics; } FT_Incremental_FuncsRec; /*************************************************************************** * * @struct: * FT_Incremental_InterfaceRec * * @description: * A structure to be used with @FT_Open_Face to indicate that the user * wants to support incremental glyph loading. You should use it with * @FT_PARAM_TAG_INCREMENTAL as in the following example: * * { * FT_Incremental_InterfaceRec inc_int; * FT_Parameter parameter; * FT_Open_Args open_args; * * * // set up incremental descriptor * inc_int.funcs = my_funcs; * inc_int.object = my_object; * * // set up optional parameter * parameter.tag = FT_PARAM_TAG_INCREMENTAL; * parameter.data = &inc_int; * * // set up FT_Open_Args structure * open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; * open_args.pathname = my_font_pathname; * open_args.num_params = 1; * open_args.params = ¶meter; // we use one optional argument * * // open the font * error = FT_Open_Face( library, &open_args, index, &face ); * ... * } * */ typedef struct FT_Incremental_InterfaceRec_ { const FT_Incremental_FuncsRec* funcs; FT_Incremental object; } FT_Incremental_InterfaceRec; /*************************************************************************** * * @type: * FT_Incremental_Interface * * @description: * A pointer to an @FT_Incremental_InterfaceRec structure. * */ typedef FT_Incremental_InterfaceRec* FT_Incremental_Interface; /*************************************************************************** * * @constant: * FT_PARAM_TAG_INCREMENTAL * * @description: * A constant used as the tag of @FT_Parameter structures to indicate * an incremental loading object to be used by FreeType. * */ #define FT_PARAM_TAG_INCREMENTAL FT_MAKE_TAG( 'i', 'n', 'c', 'r' ) /* */ FT_END_HEADER #endif /* FTINCREM_H_ */ /* END */ freetype2/freetype/ftstroke.h000064400000053432147631660260012330 0ustar00/***************************************************************************/ /* */ /* ftstroke.h */ /* */ /* FreeType path stroker (specification). */ /* */ /* Copyright 2002-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTSTROKE_H_ #define FTSTROKE_H_ #include #include FT_OUTLINE_H #include FT_GLYPH_H FT_BEGIN_HEADER /************************************************************************ * * @section: * glyph_stroker * * @title: * Glyph Stroker * * @abstract: * Generating bordered and stroked glyphs. * * @description: * This component generates stroked outlines of a given vectorial * glyph. It also allows you to retrieve the `outside' and/or the * `inside' borders of the stroke. * * This can be useful to generate `bordered' glyph, i.e., glyphs * displayed with a coloured (and anti-aliased) border around their * shape. * * @order: * FT_Stroker * * FT_Stroker_LineJoin * FT_Stroker_LineCap * FT_StrokerBorder * * FT_Outline_GetInsideBorder * FT_Outline_GetOutsideBorder * * FT_Glyph_Stroke * FT_Glyph_StrokeBorder * * FT_Stroker_New * FT_Stroker_Set * FT_Stroker_Rewind * FT_Stroker_ParseOutline * FT_Stroker_Done * * FT_Stroker_BeginSubPath * FT_Stroker_EndSubPath * * FT_Stroker_LineTo * FT_Stroker_ConicTo * FT_Stroker_CubicTo * * FT_Stroker_GetBorderCounts * FT_Stroker_ExportBorder * FT_Stroker_GetCounts * FT_Stroker_Export * */ /************************************************************** * * @type: * FT_Stroker * * @description: * Opaque handle to a path stroker object. */ typedef struct FT_StrokerRec_* FT_Stroker; /************************************************************** * * @enum: * FT_Stroker_LineJoin * * @description: * These values determine how two joining lines are rendered * in a stroker. * * @values: * FT_STROKER_LINEJOIN_ROUND :: * Used to render rounded line joins. Circular arcs are used * to join two lines smoothly. * * FT_STROKER_LINEJOIN_BEVEL :: * Used to render beveled line joins. The outer corner of * the joined lines is filled by enclosing the triangular * region of the corner with a straight line between the * outer corners of each stroke. * * FT_STROKER_LINEJOIN_MITER_FIXED :: * Used to render mitered line joins, with fixed bevels if the * miter limit is exceeded. The outer edges of the strokes * for the two segments are extended until they meet at an * angle. If the segments meet at too sharp an angle (such * that the miter would extend from the intersection of the * segments a distance greater than the product of the miter * limit value and the border radius), then a bevel join (see * above) is used instead. This prevents long spikes being * created. FT_STROKER_LINEJOIN_MITER_FIXED generates a miter * line join as used in PostScript and PDF. * * FT_STROKER_LINEJOIN_MITER_VARIABLE :: * FT_STROKER_LINEJOIN_MITER :: * Used to render mitered line joins, with variable bevels if * the miter limit is exceeded. The intersection of the * strokes is clipped at a line perpendicular to the bisector * of the angle between the strokes, at the distance from the * intersection of the segments equal to the product of the * miter limit value and the border radius. This prevents * long spikes being created. * FT_STROKER_LINEJOIN_MITER_VARIABLE generates a mitered line * join as used in XPS. FT_STROKER_LINEJOIN_MITER is an alias * for FT_STROKER_LINEJOIN_MITER_VARIABLE, retained for * backward compatibility. */ typedef enum FT_Stroker_LineJoin_ { FT_STROKER_LINEJOIN_ROUND = 0, FT_STROKER_LINEJOIN_BEVEL = 1, FT_STROKER_LINEJOIN_MITER_VARIABLE = 2, FT_STROKER_LINEJOIN_MITER = FT_STROKER_LINEJOIN_MITER_VARIABLE, FT_STROKER_LINEJOIN_MITER_FIXED = 3 } FT_Stroker_LineJoin; /************************************************************** * * @enum: * FT_Stroker_LineCap * * @description: * These values determine how the end of opened sub-paths are * rendered in a stroke. * * @values: * FT_STROKER_LINECAP_BUTT :: * The end of lines is rendered as a full stop on the last * point itself. * * FT_STROKER_LINECAP_ROUND :: * The end of lines is rendered as a half-circle around the * last point. * * FT_STROKER_LINECAP_SQUARE :: * The end of lines is rendered as a square around the * last point. */ typedef enum FT_Stroker_LineCap_ { FT_STROKER_LINECAP_BUTT = 0, FT_STROKER_LINECAP_ROUND, FT_STROKER_LINECAP_SQUARE } FT_Stroker_LineCap; /************************************************************** * * @enum: * FT_StrokerBorder * * @description: * These values are used to select a given stroke border * in @FT_Stroker_GetBorderCounts and @FT_Stroker_ExportBorder. * * @values: * FT_STROKER_BORDER_LEFT :: * Select the left border, relative to the drawing direction. * * FT_STROKER_BORDER_RIGHT :: * Select the right border, relative to the drawing direction. * * @note: * Applications are generally interested in the `inside' and `outside' * borders. However, there is no direct mapping between these and the * `left' and `right' ones, since this really depends on the glyph's * drawing orientation, which varies between font formats. * * You can however use @FT_Outline_GetInsideBorder and * @FT_Outline_GetOutsideBorder to get these. */ typedef enum FT_StrokerBorder_ { FT_STROKER_BORDER_LEFT = 0, FT_STROKER_BORDER_RIGHT } FT_StrokerBorder; /************************************************************** * * @function: * FT_Outline_GetInsideBorder * * @description: * Retrieve the @FT_StrokerBorder value corresponding to the * `inside' borders of a given outline. * * @input: * outline :: * The source outline handle. * * @return: * The border index. @FT_STROKER_BORDER_RIGHT for empty or invalid * outlines. */ FT_EXPORT( FT_StrokerBorder ) FT_Outline_GetInsideBorder( FT_Outline* outline ); /************************************************************** * * @function: * FT_Outline_GetOutsideBorder * * @description: * Retrieve the @FT_StrokerBorder value corresponding to the * `outside' borders of a given outline. * * @input: * outline :: * The source outline handle. * * @return: * The border index. @FT_STROKER_BORDER_LEFT for empty or invalid * outlines. */ FT_EXPORT( FT_StrokerBorder ) FT_Outline_GetOutsideBorder( FT_Outline* outline ); /************************************************************** * * @function: * FT_Stroker_New * * @description: * Create a new stroker object. * * @input: * library :: * FreeType library handle. * * @output: * astroker :: * A new stroker object handle. NULL in case of error. * * @return: * FreeType error code. 0~means success. */ FT_EXPORT( FT_Error ) FT_Stroker_New( FT_Library library, FT_Stroker *astroker ); /************************************************************** * * @function: * FT_Stroker_Set * * @description: * Reset a stroker object's attributes. * * @input: * stroker :: * The target stroker handle. * * radius :: * The border radius. * * line_cap :: * The line cap style. * * line_join :: * The line join style. * * miter_limit :: * The miter limit for the FT_STROKER_LINEJOIN_MITER_FIXED and * FT_STROKER_LINEJOIN_MITER_VARIABLE line join styles, * expressed as 16.16 fixed-point value. * * @note: * The radius is expressed in the same units as the outline * coordinates. * * This function calls @FT_Stroker_Rewind automatically. */ FT_EXPORT( void ) FT_Stroker_Set( FT_Stroker stroker, FT_Fixed radius, FT_Stroker_LineCap line_cap, FT_Stroker_LineJoin line_join, FT_Fixed miter_limit ); /************************************************************** * * @function: * FT_Stroker_Rewind * * @description: * Reset a stroker object without changing its attributes. * You should call this function before beginning a new * series of calls to @FT_Stroker_BeginSubPath or * @FT_Stroker_EndSubPath. * * @input: * stroker :: * The target stroker handle. */ FT_EXPORT( void ) FT_Stroker_Rewind( FT_Stroker stroker ); /************************************************************** * * @function: * FT_Stroker_ParseOutline * * @description: * A convenience function used to parse a whole outline with * the stroker. The resulting outline(s) can be retrieved * later by functions like @FT_Stroker_GetCounts and @FT_Stroker_Export. * * @input: * stroker :: * The target stroker handle. * * outline :: * The source outline. * * opened :: * A boolean. If~1, the outline is treated as an open path instead * of a closed one. * * @return: * FreeType error code. 0~means success. * * @note: * If `opened' is~0 (the default), the outline is treated as a closed * path, and the stroker generates two distinct `border' outlines. * * If `opened' is~1, the outline is processed as an open path, and the * stroker generates a single `stroke' outline. * * This function calls @FT_Stroker_Rewind automatically. */ FT_EXPORT( FT_Error ) FT_Stroker_ParseOutline( FT_Stroker stroker, FT_Outline* outline, FT_Bool opened ); /************************************************************** * * @function: * FT_Stroker_BeginSubPath * * @description: * Start a new sub-path in the stroker. * * @input: * stroker :: * The target stroker handle. * * to :: * A pointer to the start vector. * * open :: * A boolean. If~1, the sub-path is treated as an open one. * * @return: * FreeType error code. 0~means success. * * @note: * This function is useful when you need to stroke a path that is * not stored as an @FT_Outline object. */ FT_EXPORT( FT_Error ) FT_Stroker_BeginSubPath( FT_Stroker stroker, FT_Vector* to, FT_Bool open ); /************************************************************** * * @function: * FT_Stroker_EndSubPath * * @description: * Close the current sub-path in the stroker. * * @input: * stroker :: * The target stroker handle. * * @return: * FreeType error code. 0~means success. * * @note: * You should call this function after @FT_Stroker_BeginSubPath. * If the subpath was not `opened', this function `draws' a * single line segment to the start position when needed. */ FT_EXPORT( FT_Error ) FT_Stroker_EndSubPath( FT_Stroker stroker ); /************************************************************** * * @function: * FT_Stroker_LineTo * * @description: * `Draw' a single line segment in the stroker's current sub-path, * from the last position. * * @input: * stroker :: * The target stroker handle. * * to :: * A pointer to the destination point. * * @return: * FreeType error code. 0~means success. * * @note: * You should call this function between @FT_Stroker_BeginSubPath and * @FT_Stroker_EndSubPath. */ FT_EXPORT( FT_Error ) FT_Stroker_LineTo( FT_Stroker stroker, FT_Vector* to ); /************************************************************** * * @function: * FT_Stroker_ConicTo * * @description: * `Draw' a single quadratic Bézier in the stroker's current sub-path, * from the last position. * * @input: * stroker :: * The target stroker handle. * * control :: * A pointer to a Bézier control point. * * to :: * A pointer to the destination point. * * @return: * FreeType error code. 0~means success. * * @note: * You should call this function between @FT_Stroker_BeginSubPath and * @FT_Stroker_EndSubPath. */ FT_EXPORT( FT_Error ) FT_Stroker_ConicTo( FT_Stroker stroker, FT_Vector* control, FT_Vector* to ); /************************************************************** * * @function: * FT_Stroker_CubicTo * * @description: * `Draw' a single cubic Bézier in the stroker's current sub-path, * from the last position. * * @input: * stroker :: * The target stroker handle. * * control1 :: * A pointer to the first Bézier control point. * * control2 :: * A pointer to second Bézier control point. * * to :: * A pointer to the destination point. * * @return: * FreeType error code. 0~means success. * * @note: * You should call this function between @FT_Stroker_BeginSubPath and * @FT_Stroker_EndSubPath. */ FT_EXPORT( FT_Error ) FT_Stroker_CubicTo( FT_Stroker stroker, FT_Vector* control1, FT_Vector* control2, FT_Vector* to ); /************************************************************** * * @function: * FT_Stroker_GetBorderCounts * * @description: * Call this function once you have finished parsing your paths * with the stroker. It returns the number of points and * contours necessary to export one of the `border' or `stroke' * outlines generated by the stroker. * * @input: * stroker :: * The target stroker handle. * * border :: * The border index. * * @output: * anum_points :: * The number of points. * * anum_contours :: * The number of contours. * * @return: * FreeType error code. 0~means success. * * @note: * When an outline, or a sub-path, is `closed', the stroker generates * two independent `border' outlines, named `left' and `right'. * * When the outline, or a sub-path, is `opened', the stroker merges * the `border' outlines with caps. The `left' border receives all * points, while the `right' border becomes empty. * * Use the function @FT_Stroker_GetCounts instead if you want to * retrieve the counts associated to both borders. */ FT_EXPORT( FT_Error ) FT_Stroker_GetBorderCounts( FT_Stroker stroker, FT_StrokerBorder border, FT_UInt *anum_points, FT_UInt *anum_contours ); /************************************************************** * * @function: * FT_Stroker_ExportBorder * * @description: * Call this function after @FT_Stroker_GetBorderCounts to * export the corresponding border to your own @FT_Outline * structure. * * Note that this function appends the border points and * contours to your outline, but does not try to resize its * arrays. * * @input: * stroker :: * The target stroker handle. * * border :: * The border index. * * outline :: * The target outline handle. * * @note: * Always call this function after @FT_Stroker_GetBorderCounts to * get sure that there is enough room in your @FT_Outline object to * receive all new data. * * When an outline, or a sub-path, is `closed', the stroker generates * two independent `border' outlines, named `left' and `right'. * * When the outline, or a sub-path, is `opened', the stroker merges * the `border' outlines with caps. The `left' border receives all * points, while the `right' border becomes empty. * * Use the function @FT_Stroker_Export instead if you want to * retrieve all borders at once. */ FT_EXPORT( void ) FT_Stroker_ExportBorder( FT_Stroker stroker, FT_StrokerBorder border, FT_Outline* outline ); /************************************************************** * * @function: * FT_Stroker_GetCounts * * @description: * Call this function once you have finished parsing your paths * with the stroker. It returns the number of points and * contours necessary to export all points/borders from the stroked * outline/path. * * @input: * stroker :: * The target stroker handle. * * @output: * anum_points :: * The number of points. * * anum_contours :: * The number of contours. * * @return: * FreeType error code. 0~means success. */ FT_EXPORT( FT_Error ) FT_Stroker_GetCounts( FT_Stroker stroker, FT_UInt *anum_points, FT_UInt *anum_contours ); /************************************************************** * * @function: * FT_Stroker_Export * * @description: * Call this function after @FT_Stroker_GetBorderCounts to * export all borders to your own @FT_Outline structure. * * Note that this function appends the border points and * contours to your outline, but does not try to resize its * arrays. * * @input: * stroker :: * The target stroker handle. * * outline :: * The target outline handle. */ FT_EXPORT( void ) FT_Stroker_Export( FT_Stroker stroker, FT_Outline* outline ); /************************************************************** * * @function: * FT_Stroker_Done * * @description: * Destroy a stroker object. * * @input: * stroker :: * A stroker handle. Can be NULL. */ FT_EXPORT( void ) FT_Stroker_Done( FT_Stroker stroker ); /************************************************************** * * @function: * FT_Glyph_Stroke * * @description: * Stroke a given outline glyph object with a given stroker. * * @inout: * pglyph :: * Source glyph handle on input, new glyph handle on output. * * @input: * stroker :: * A stroker handle. * * destroy :: * A Boolean. If~1, the source glyph object is destroyed * on success. * * @return: * FreeType error code. 0~means success. * * @note: * The source glyph is untouched in case of error. * * Adding stroke may yield a significantly wider and taller glyph * depending on how large of a radius was used to stroke the glyph. You * may need to manually adjust horizontal and vertical advance amounts * to account for this added size. */ FT_EXPORT( FT_Error ) FT_Glyph_Stroke( FT_Glyph *pglyph, FT_Stroker stroker, FT_Bool destroy ); /************************************************************** * * @function: * FT_Glyph_StrokeBorder * * @description: * Stroke a given outline glyph object with a given stroker, but * only return either its inside or outside border. * * @inout: * pglyph :: * Source glyph handle on input, new glyph handle on output. * * @input: * stroker :: * A stroker handle. * * inside :: * A Boolean. If~1, return the inside border, otherwise * the outside border. * * destroy :: * A Boolean. If~1, the source glyph object is destroyed * on success. * * @return: * FreeType error code. 0~means success. * * @note: * The source glyph is untouched in case of error. * * Adding stroke may yield a significantly wider and taller glyph * depending on how large of a radius was used to stroke the glyph. You * may need to manually adjust horizontal and vertical advance amounts * to account for this added size. */ FT_EXPORT( FT_Error ) FT_Glyph_StrokeBorder( FT_Glyph *pglyph, FT_Stroker stroker, FT_Bool inside, FT_Bool destroy ); /* */ FT_END_HEADER #endif /* FTSTROKE_H_ */ /* END */ /* Local Variables: */ /* coding: utf-8 */ /* End: */ freetype2/freetype/ftbitmap.h000064400000034547147631660260012303 0ustar00/***************************************************************************/ /* */ /* ftbitmap.h */ /* */ /* FreeType utility functions for bitmaps (specification). */ /* */ /* Copyright 2004-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTBITMAP_H_ #define FTBITMAP_H_ #include #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /*
*/ /* bitmap_handling */ /* */ /* */ /* Bitmap Handling */ /* */ /* <Abstract> */ /* Handling FT_Bitmap objects. */ /* */ /* <Description> */ /* This section contains functions for handling @FT_Bitmap objects. */ /* Note that none of the functions changes the bitmap's `flow' (as */ /* indicated by the sign of the `pitch' field in `FT_Bitmap'). */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Function> */ /* FT_Bitmap_Init */ /* */ /* <Description> */ /* Initialize a pointer to an @FT_Bitmap structure. */ /* */ /* <InOut> */ /* abitmap :: A pointer to the bitmap structure. */ /* */ /* <Note> */ /* A deprecated name for the same function is `FT_Bitmap_New'. */ /* */ FT_EXPORT( void ) FT_Bitmap_Init( FT_Bitmap *abitmap ); /* deprecated */ FT_EXPORT( void ) FT_Bitmap_New( FT_Bitmap *abitmap ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Bitmap_Copy */ /* */ /* <Description> */ /* Copy a bitmap into another one. */ /* */ /* <Input> */ /* library :: A handle to a library object. */ /* */ /* source :: A handle to the source bitmap. */ /* */ /* <Output> */ /* target :: A handle to the target bitmap. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Bitmap_Copy( FT_Library library, const FT_Bitmap *source, FT_Bitmap *target); /*************************************************************************/ /* */ /* <Function> */ /* FT_Bitmap_Embolden */ /* */ /* <Description> */ /* Embolden a bitmap. The new bitmap will be about `xStrength' */ /* pixels wider and `yStrength' pixels higher. The left and bottom */ /* borders are kept unchanged. */ /* */ /* <Input> */ /* library :: A handle to a library object. */ /* */ /* xStrength :: How strong the glyph is emboldened horizontally. */ /* Expressed in 26.6 pixel format. */ /* */ /* yStrength :: How strong the glyph is emboldened vertically. */ /* Expressed in 26.6 pixel format. */ /* */ /* <InOut> */ /* bitmap :: A handle to the target bitmap. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* The current implementation restricts `xStrength' to be less than */ /* or equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO. */ /* */ /* If you want to embolden the bitmap owned by a @FT_GlyphSlotRec, */ /* you should call @FT_GlyphSlot_Own_Bitmap on the slot first. */ /* */ /* Bitmaps in @FT_PIXEL_MODE_GRAY2 and @FT_PIXEL_MODE_GRAY@ format */ /* are converted to @FT_PIXEL_MODE_GRAY format (i.e., 8bpp). */ /* */ FT_EXPORT( FT_Error ) FT_Bitmap_Embolden( FT_Library library, FT_Bitmap* bitmap, FT_Pos xStrength, FT_Pos yStrength ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Bitmap_Convert */ /* */ /* <Description> */ /* Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, 8bpp or 32bpp */ /* to a bitmap object with depth 8bpp, making the number of used */ /* bytes line (a.k.a. the `pitch') a multiple of `alignment'. */ /* */ /* <Input> */ /* library :: A handle to a library object. */ /* */ /* source :: The source bitmap. */ /* */ /* alignment :: The pitch of the bitmap is a multiple of this */ /* parameter. Common values are 1, 2, or 4. */ /* */ /* <Output> */ /* target :: The target bitmap. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* It is possible to call @FT_Bitmap_Convert multiple times without */ /* calling @FT_Bitmap_Done (the memory is simply reallocated). */ /* */ /* Use @FT_Bitmap_Done to finally remove the bitmap object. */ /* */ /* The `library' argument is taken to have access to FreeType's */ /* memory handling functions. */ /* */ FT_EXPORT( FT_Error ) FT_Bitmap_Convert( FT_Library library, const FT_Bitmap *source, FT_Bitmap *target, FT_Int alignment ); /*************************************************************************/ /* */ /* <Function> */ /* FT_GlyphSlot_Own_Bitmap */ /* */ /* <Description> */ /* Make sure that a glyph slot owns `slot->bitmap'. */ /* */ /* <Input> */ /* slot :: The glyph slot. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* This function is to be used in combination with */ /* @FT_Bitmap_Embolden. */ /* */ FT_EXPORT( FT_Error ) FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Bitmap_Done */ /* */ /* <Description> */ /* Destroy a bitmap object initialized with @FT_Bitmap_Init. */ /* */ /* <Input> */ /* library :: A handle to a library object. */ /* */ /* bitmap :: The bitmap object to be freed. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* The `library' argument is taken to have access to FreeType's */ /* memory handling functions. */ /* */ FT_EXPORT( FT_Error ) FT_Bitmap_Done( FT_Library library, FT_Bitmap *bitmap ); /* */ FT_END_HEADER #endif /* FTBITMAP_H_ */ /* END */ ���������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/t1tables.h�����������������������������������������������������������������������0000644�����������������00000104324�14763166026�0012203 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* t1tables.h */ /* */ /* Basic Type 1/Type 2 tables definitions and interface (specification */ /* only). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef T1TABLES_H_ #define T1TABLES_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* type1_tables */ /* */ /* <Title> */ /* Type 1 Tables */ /* */ /* <Abstract> */ /* Type~1 (PostScript) specific font tables. */ /* */ /* <Description> */ /* This section contains the definition of Type 1-specific tables, */ /* including structures related to other PostScript font formats. */ /* */ /* <Order> */ /* PS_FontInfoRec */ /* PS_FontInfo */ /* PS_PrivateRec */ /* PS_Private */ /* */ /* CID_FaceDictRec */ /* CID_FaceDict */ /* CID_FaceInfoRec */ /* CID_FaceInfo */ /* */ /* FT_Has_PS_Glyph_Names */ /* FT_Get_PS_Font_Info */ /* FT_Get_PS_Font_Private */ /* FT_Get_PS_Font_Value */ /* */ /* T1_Blend_Flags */ /* T1_EncodingType */ /* PS_Dict_Keys */ /* */ /*************************************************************************/ /* Note that we separate font data in PS_FontInfoRec and PS_PrivateRec */ /* structures in order to support Multiple Master fonts. */ /*************************************************************************/ /* */ /* <Struct> */ /* PS_FontInfoRec */ /* */ /* <Description> */ /* A structure used to model a Type~1 or Type~2 FontInfo dictionary. */ /* Note that for Multiple Master fonts, each instance has its own */ /* FontInfo dictionary. */ /* */ typedef struct PS_FontInfoRec_ { FT_String* version; FT_String* notice; FT_String* full_name; FT_String* family_name; FT_String* weight; FT_Long italic_angle; FT_Bool is_fixed_pitch; FT_Short underline_position; FT_UShort underline_thickness; } PS_FontInfoRec; /*************************************************************************/ /* */ /* <Struct> */ /* PS_FontInfo */ /* */ /* <Description> */ /* A handle to a @PS_FontInfoRec structure. */ /* */ typedef struct PS_FontInfoRec_* PS_FontInfo; /*************************************************************************/ /* */ /* <Struct> */ /* T1_FontInfo */ /* */ /* <Description> */ /* This type is equivalent to @PS_FontInfoRec. It is deprecated but */ /* kept to maintain source compatibility between various versions of */ /* FreeType. */ /* */ typedef PS_FontInfoRec T1_FontInfo; /*************************************************************************/ /* */ /* <Struct> */ /* PS_PrivateRec */ /* */ /* <Description> */ /* A structure used to model a Type~1 or Type~2 private dictionary. */ /* Note that for Multiple Master fonts, each instance has its own */ /* Private dictionary. */ /* */ typedef struct PS_PrivateRec_ { FT_Int unique_id; FT_Int lenIV; FT_Byte num_blue_values; FT_Byte num_other_blues; FT_Byte num_family_blues; FT_Byte num_family_other_blues; FT_Short blue_values[14]; FT_Short other_blues[10]; FT_Short family_blues [14]; FT_Short family_other_blues[10]; FT_Fixed blue_scale; FT_Int blue_shift; FT_Int blue_fuzz; FT_UShort standard_width[1]; FT_UShort standard_height[1]; FT_Byte num_snap_widths; FT_Byte num_snap_heights; FT_Bool force_bold; FT_Bool round_stem_up; FT_Short snap_widths [13]; /* including std width */ FT_Short snap_heights[13]; /* including std height */ FT_Fixed expansion_factor; FT_Long language_group; FT_Long password; FT_Short min_feature[2]; } PS_PrivateRec; /*************************************************************************/ /* */ /* <Struct> */ /* PS_Private */ /* */ /* <Description> */ /* A handle to a @PS_PrivateRec structure. */ /* */ typedef struct PS_PrivateRec_* PS_Private; /*************************************************************************/ /* */ /* <Struct> */ /* T1_Private */ /* */ /* <Description> */ /* This type is equivalent to @PS_PrivateRec. It is deprecated but */ /* kept to maintain source compatibility between various versions of */ /* FreeType. */ /* */ typedef PS_PrivateRec T1_Private; /*************************************************************************/ /* */ /* <Enum> */ /* T1_Blend_Flags */ /* */ /* <Description> */ /* A set of flags used to indicate which fields are present in a */ /* given blend dictionary (font info or private). Used to support */ /* Multiple Masters fonts. */ /* */ /* <Values> */ /* T1_BLEND_UNDERLINE_POSITION :: */ /* T1_BLEND_UNDERLINE_THICKNESS :: */ /* T1_BLEND_ITALIC_ANGLE :: */ /* T1_BLEND_BLUE_VALUES :: */ /* T1_BLEND_OTHER_BLUES :: */ /* T1_BLEND_STANDARD_WIDTH :: */ /* T1_BLEND_STANDARD_HEIGHT :: */ /* T1_BLEND_STEM_SNAP_WIDTHS :: */ /* T1_BLEND_STEM_SNAP_HEIGHTS :: */ /* T1_BLEND_BLUE_SCALE :: */ /* T1_BLEND_BLUE_SHIFT :: */ /* T1_BLEND_FAMILY_BLUES :: */ /* T1_BLEND_FAMILY_OTHER_BLUES :: */ /* T1_BLEND_FORCE_BOLD :: */ /* */ typedef enum T1_Blend_Flags_ { /* required fields in a FontInfo blend dictionary */ T1_BLEND_UNDERLINE_POSITION = 0, T1_BLEND_UNDERLINE_THICKNESS, T1_BLEND_ITALIC_ANGLE, /* required fields in a Private blend dictionary */ T1_BLEND_BLUE_VALUES, T1_BLEND_OTHER_BLUES, T1_BLEND_STANDARD_WIDTH, T1_BLEND_STANDARD_HEIGHT, T1_BLEND_STEM_SNAP_WIDTHS, T1_BLEND_STEM_SNAP_HEIGHTS, T1_BLEND_BLUE_SCALE, T1_BLEND_BLUE_SHIFT, T1_BLEND_FAMILY_BLUES, T1_BLEND_FAMILY_OTHER_BLUES, T1_BLEND_FORCE_BOLD, T1_BLEND_MAX /* do not remove */ } T1_Blend_Flags; /* these constants are deprecated; use the corresponding */ /* `T1_Blend_Flags' values instead */ #define t1_blend_underline_position T1_BLEND_UNDERLINE_POSITION #define t1_blend_underline_thickness T1_BLEND_UNDERLINE_THICKNESS #define t1_blend_italic_angle T1_BLEND_ITALIC_ANGLE #define t1_blend_blue_values T1_BLEND_BLUE_VALUES #define t1_blend_other_blues T1_BLEND_OTHER_BLUES #define t1_blend_standard_widths T1_BLEND_STANDARD_WIDTH #define t1_blend_standard_height T1_BLEND_STANDARD_HEIGHT #define t1_blend_stem_snap_widths T1_BLEND_STEM_SNAP_WIDTHS #define t1_blend_stem_snap_heights T1_BLEND_STEM_SNAP_HEIGHTS #define t1_blend_blue_scale T1_BLEND_BLUE_SCALE #define t1_blend_blue_shift T1_BLEND_BLUE_SHIFT #define t1_blend_family_blues T1_BLEND_FAMILY_BLUES #define t1_blend_family_other_blues T1_BLEND_FAMILY_OTHER_BLUES #define t1_blend_force_bold T1_BLEND_FORCE_BOLD #define t1_blend_max T1_BLEND_MAX /* */ /* maximum number of Multiple Masters designs, as defined in the spec */ #define T1_MAX_MM_DESIGNS 16 /* maximum number of Multiple Masters axes, as defined in the spec */ #define T1_MAX_MM_AXIS 4 /* maximum number of elements in a design map */ #define T1_MAX_MM_MAP_POINTS 20 /* this structure is used to store the BlendDesignMap entry for an axis */ typedef struct PS_DesignMap_ { FT_Byte num_points; FT_Long* design_points; FT_Fixed* blend_points; } PS_DesignMapRec, *PS_DesignMap; /* backward compatible definition */ typedef PS_DesignMapRec T1_DesignMap; typedef struct PS_BlendRec_ { FT_UInt num_designs; FT_UInt num_axis; FT_String* axis_names[T1_MAX_MM_AXIS]; FT_Fixed* design_pos[T1_MAX_MM_DESIGNS]; PS_DesignMapRec design_map[T1_MAX_MM_AXIS]; FT_Fixed* weight_vector; FT_Fixed* default_weight_vector; PS_FontInfo font_infos[T1_MAX_MM_DESIGNS + 1]; PS_Private privates [T1_MAX_MM_DESIGNS + 1]; FT_ULong blend_bitflags; FT_BBox* bboxes [T1_MAX_MM_DESIGNS + 1]; /* since 2.3.0 */ /* undocumented, optional: the default design instance; */ /* corresponds to default_weight_vector -- */ /* num_default_design_vector == 0 means it is not present */ /* in the font and associated metrics files */ FT_UInt default_design_vector[T1_MAX_MM_DESIGNS]; FT_UInt num_default_design_vector; } PS_BlendRec, *PS_Blend; /* backward compatible definition */ typedef PS_BlendRec T1_Blend; /*************************************************************************/ /* */ /* <Struct> */ /* CID_FaceDictRec */ /* */ /* <Description> */ /* A structure used to represent data in a CID top-level dictionary. */ /* */ typedef struct CID_FaceDictRec_ { PS_PrivateRec private_dict; FT_UInt len_buildchar; FT_Fixed forcebold_threshold; FT_Pos stroke_width; FT_Fixed expansion_factor; FT_Byte paint_type; FT_Byte font_type; FT_Matrix font_matrix; FT_Vector font_offset; FT_UInt num_subrs; FT_ULong subrmap_offset; FT_Int sd_bytes; } CID_FaceDictRec; /*************************************************************************/ /* */ /* <Struct> */ /* CID_FaceDict */ /* */ /* <Description> */ /* A handle to a @CID_FaceDictRec structure. */ /* */ typedef struct CID_FaceDictRec_* CID_FaceDict; /*************************************************************************/ /* */ /* <Struct> */ /* CID_FontDict */ /* */ /* <Description> */ /* This type is equivalent to @CID_FaceDictRec. It is deprecated but */ /* kept to maintain source compatibility between various versions of */ /* FreeType. */ /* */ typedef CID_FaceDictRec CID_FontDict; /*************************************************************************/ /* */ /* <Struct> */ /* CID_FaceInfoRec */ /* */ /* <Description> */ /* A structure used to represent CID Face information. */ /* */ typedef struct CID_FaceInfoRec_ { FT_String* cid_font_name; FT_Fixed cid_version; FT_Int cid_font_type; FT_String* registry; FT_String* ordering; FT_Int supplement; PS_FontInfoRec font_info; FT_BBox font_bbox; FT_ULong uid_base; FT_Int num_xuid; FT_ULong xuid[16]; FT_ULong cidmap_offset; FT_Int fd_bytes; FT_Int gd_bytes; FT_ULong cid_count; FT_Int num_dicts; CID_FaceDict font_dicts; FT_ULong data_offset; } CID_FaceInfoRec; /*************************************************************************/ /* */ /* <Struct> */ /* CID_FaceInfo */ /* */ /* <Description> */ /* A handle to a @CID_FaceInfoRec structure. */ /* */ typedef struct CID_FaceInfoRec_* CID_FaceInfo; /*************************************************************************/ /* */ /* <Struct> */ /* CID_Info */ /* */ /* <Description> */ /* This type is equivalent to @CID_FaceInfoRec. It is deprecated but */ /* kept to maintain source compatibility between various versions of */ /* FreeType. */ /* */ typedef CID_FaceInfoRec CID_Info; /************************************************************************ * * @function: * FT_Has_PS_Glyph_Names * * @description: * Return true if a given face provides reliable PostScript glyph * names. This is similar to using the @FT_HAS_GLYPH_NAMES macro, * except that certain fonts (mostly TrueType) contain incorrect * glyph name tables. * * When this function returns true, the caller is sure that the glyph * names returned by @FT_Get_Glyph_Name are reliable. * * @input: * face :: * face handle * * @return: * Boolean. True if glyph names are reliable. * */ FT_EXPORT( FT_Int ) FT_Has_PS_Glyph_Names( FT_Face face ); /************************************************************************ * * @function: * FT_Get_PS_Font_Info * * @description: * Retrieve the @PS_FontInfoRec structure corresponding to a given * PostScript font. * * @input: * face :: * PostScript face handle. * * @output: * afont_info :: * Output font info structure pointer. * * @return: * FreeType error code. 0~means success. * * @note: * String pointers within the @PS_FontInfoRec structure are owned by * the face and don't need to be freed by the caller. Missing entries * in the font's FontInfo dictionary are represented by NULL pointers. * * If the font's format is not PostScript-based, this function will * return the `FT_Err_Invalid_Argument' error code. * */ FT_EXPORT( FT_Error ) FT_Get_PS_Font_Info( FT_Face face, PS_FontInfo afont_info ); /************************************************************************ * * @function: * FT_Get_PS_Font_Private * * @description: * Retrieve the @PS_PrivateRec structure corresponding to a given * PostScript font. * * @input: * face :: * PostScript face handle. * * @output: * afont_private :: * Output private dictionary structure pointer. * * @return: * FreeType error code. 0~means success. * * @note: * The string pointers within the @PS_PrivateRec structure are owned by * the face and don't need to be freed by the caller. * * If the font's format is not PostScript-based, this function returns * the `FT_Err_Invalid_Argument' error code. * */ FT_EXPORT( FT_Error ) FT_Get_PS_Font_Private( FT_Face face, PS_Private afont_private ); /*************************************************************************/ /* */ /* <Enum> */ /* T1_EncodingType */ /* */ /* <Description> */ /* An enumeration describing the `Encoding' entry in a Type 1 */ /* dictionary. */ /* */ /* <Values> */ /* T1_ENCODING_TYPE_NONE :: */ /* T1_ENCODING_TYPE_ARRAY :: */ /* T1_ENCODING_TYPE_STANDARD :: */ /* T1_ENCODING_TYPE_ISOLATIN1 :: */ /* T1_ENCODING_TYPE_EXPERT :: */ /* */ typedef enum T1_EncodingType_ { T1_ENCODING_TYPE_NONE = 0, T1_ENCODING_TYPE_ARRAY, T1_ENCODING_TYPE_STANDARD, T1_ENCODING_TYPE_ISOLATIN1, T1_ENCODING_TYPE_EXPERT } T1_EncodingType; /*************************************************************************/ /* */ /* <Enum> */ /* PS_Dict_Keys */ /* */ /* <Description> */ /* An enumeration used in calls to @FT_Get_PS_Font_Value to identify */ /* the Type~1 dictionary entry to retrieve. */ /* */ /* <Values> */ /* PS_DICT_FONT_TYPE :: */ /* PS_DICT_FONT_MATRIX :: */ /* PS_DICT_FONT_BBOX :: */ /* PS_DICT_PAINT_TYPE :: */ /* PS_DICT_FONT_NAME :: */ /* PS_DICT_UNIQUE_ID :: */ /* PS_DICT_NUM_CHAR_STRINGS :: */ /* PS_DICT_CHAR_STRING_KEY :: */ /* PS_DICT_CHAR_STRING :: */ /* PS_DICT_ENCODING_TYPE :: */ /* PS_DICT_ENCODING_ENTRY :: */ /* PS_DICT_NUM_SUBRS :: */ /* PS_DICT_SUBR :: */ /* PS_DICT_STD_HW :: */ /* PS_DICT_STD_VW :: */ /* PS_DICT_NUM_BLUE_VALUES :: */ /* PS_DICT_BLUE_VALUE :: */ /* PS_DICT_BLUE_FUZZ :: */ /* PS_DICT_NUM_OTHER_BLUES :: */ /* PS_DICT_OTHER_BLUE :: */ /* PS_DICT_NUM_FAMILY_BLUES :: */ /* PS_DICT_FAMILY_BLUE :: */ /* PS_DICT_NUM_FAMILY_OTHER_BLUES :: */ /* PS_DICT_FAMILY_OTHER_BLUE :: */ /* PS_DICT_BLUE_SCALE :: */ /* PS_DICT_BLUE_SHIFT :: */ /* PS_DICT_NUM_STEM_SNAP_H :: */ /* PS_DICT_STEM_SNAP_H :: */ /* PS_DICT_NUM_STEM_SNAP_V :: */ /* PS_DICT_STEM_SNAP_V :: */ /* PS_DICT_FORCE_BOLD :: */ /* PS_DICT_RND_STEM_UP :: */ /* PS_DICT_MIN_FEATURE :: */ /* PS_DICT_LEN_IV :: */ /* PS_DICT_PASSWORD :: */ /* PS_DICT_LANGUAGE_GROUP :: */ /* PS_DICT_VERSION :: */ /* PS_DICT_NOTICE :: */ /* PS_DICT_FULL_NAME :: */ /* PS_DICT_FAMILY_NAME :: */ /* PS_DICT_WEIGHT :: */ /* PS_DICT_IS_FIXED_PITCH :: */ /* PS_DICT_UNDERLINE_POSITION :: */ /* PS_DICT_UNDERLINE_THICKNESS :: */ /* PS_DICT_FS_TYPE :: */ /* PS_DICT_ITALIC_ANGLE :: */ /* */ typedef enum PS_Dict_Keys_ { /* conventionally in the font dictionary */ PS_DICT_FONT_TYPE, /* FT_Byte */ PS_DICT_FONT_MATRIX, /* FT_Fixed */ PS_DICT_FONT_BBOX, /* FT_Fixed */ PS_DICT_PAINT_TYPE, /* FT_Byte */ PS_DICT_FONT_NAME, /* FT_String* */ PS_DICT_UNIQUE_ID, /* FT_Int */ PS_DICT_NUM_CHAR_STRINGS, /* FT_Int */ PS_DICT_CHAR_STRING_KEY, /* FT_String* */ PS_DICT_CHAR_STRING, /* FT_String* */ PS_DICT_ENCODING_TYPE, /* T1_EncodingType */ PS_DICT_ENCODING_ENTRY, /* FT_String* */ /* conventionally in the font Private dictionary */ PS_DICT_NUM_SUBRS, /* FT_Int */ PS_DICT_SUBR, /* FT_String* */ PS_DICT_STD_HW, /* FT_UShort */ PS_DICT_STD_VW, /* FT_UShort */ PS_DICT_NUM_BLUE_VALUES, /* FT_Byte */ PS_DICT_BLUE_VALUE, /* FT_Short */ PS_DICT_BLUE_FUZZ, /* FT_Int */ PS_DICT_NUM_OTHER_BLUES, /* FT_Byte */ PS_DICT_OTHER_BLUE, /* FT_Short */ PS_DICT_NUM_FAMILY_BLUES, /* FT_Byte */ PS_DICT_FAMILY_BLUE, /* FT_Short */ PS_DICT_NUM_FAMILY_OTHER_BLUES, /* FT_Byte */ PS_DICT_FAMILY_OTHER_BLUE, /* FT_Short */ PS_DICT_BLUE_SCALE, /* FT_Fixed */ PS_DICT_BLUE_SHIFT, /* FT_Int */ PS_DICT_NUM_STEM_SNAP_H, /* FT_Byte */ PS_DICT_STEM_SNAP_H, /* FT_Short */ PS_DICT_NUM_STEM_SNAP_V, /* FT_Byte */ PS_DICT_STEM_SNAP_V, /* FT_Short */ PS_DICT_FORCE_BOLD, /* FT_Bool */ PS_DICT_RND_STEM_UP, /* FT_Bool */ PS_DICT_MIN_FEATURE, /* FT_Short */ PS_DICT_LEN_IV, /* FT_Int */ PS_DICT_PASSWORD, /* FT_Long */ PS_DICT_LANGUAGE_GROUP, /* FT_Long */ /* conventionally in the font FontInfo dictionary */ PS_DICT_VERSION, /* FT_String* */ PS_DICT_NOTICE, /* FT_String* */ PS_DICT_FULL_NAME, /* FT_String* */ PS_DICT_FAMILY_NAME, /* FT_String* */ PS_DICT_WEIGHT, /* FT_String* */ PS_DICT_IS_FIXED_PITCH, /* FT_Bool */ PS_DICT_UNDERLINE_POSITION, /* FT_Short */ PS_DICT_UNDERLINE_THICKNESS, /* FT_UShort */ PS_DICT_FS_TYPE, /* FT_UShort */ PS_DICT_ITALIC_ANGLE, /* FT_Long */ PS_DICT_MAX = PS_DICT_ITALIC_ANGLE } PS_Dict_Keys; /************************************************************************ * * @function: * FT_Get_PS_Font_Value * * @description: * Retrieve the value for the supplied key from a PostScript font. * * @input: * face :: * PostScript face handle. * * key :: * An enumeration value representing the dictionary key to retrieve. * * idx :: * For array values, this specifies the index to be returned. * * value :: * A pointer to memory into which to write the value. * * valen_len :: * The size, in bytes, of the memory supplied for the value. * * @output: * value :: * The value matching the above key, if it exists. * * @return: * The amount of memory (in bytes) required to hold the requested * value (if it exists, -1 otherwise). * * @note: * The values returned are not pointers into the internal structures of * the face, but are `fresh' copies, so that the memory containing them * belongs to the calling application. This also enforces the * `read-only' nature of these values, i.e., this function cannot be * used to manipulate the face. * * `value' is a void pointer because the values returned can be of * various types. * * If either `value' is NULL or `value_len' is too small, just the * required memory size for the requested entry is returned. * * The `idx' parameter is used, not only to retrieve elements of, for * example, the FontMatrix or FontBBox, but also to retrieve name keys * from the CharStrings dictionary, and the charstrings themselves. It * is ignored for atomic values. * * PS_DICT_BLUE_SCALE returns a value that is scaled up by 1000. To * get the value as in the font stream, you need to divide by * 65536000.0 (to remove the FT_Fixed scale, and the x1000 scale). * * IMPORTANT: Only key/value pairs read by the FreeType interpreter can * be retrieved. So, for example, PostScript procedures such as NP, * ND, and RD are not available. Arbitrary keys are, obviously, not be * available either. * * If the font's format is not PostScript-based, this function returns * the `FT_Err_Invalid_Argument' error code. * */ FT_EXPORT( FT_Long ) FT_Get_PS_Font_Value( FT_Face face, PS_Dict_Keys key, FT_UInt idx, void *value, FT_Long value_len ); /* */ FT_END_HEADER #endif /* T1TABLES_H_ */ /* END */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftcid.h��������������������������������������������������������������������������0000644�����������������00000013021�14763166026�0011546 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftcid.h */ /* */ /* FreeType API for accessing CID font information (specification). */ /* */ /* Copyright 2007-2017 by */ /* Dereg Clegg and Michael Toftdal. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTCID_H_ #define FTCID_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* cid_fonts */ /* */ /* <Title> */ /* CID Fonts */ /* */ /* <Abstract> */ /* CID-keyed font specific API. */ /* */ /* <Description> */ /* This section contains the declaration of CID-keyed font specific */ /* functions. */ /* */ /*************************************************************************/ /********************************************************************** * * @function: * FT_Get_CID_Registry_Ordering_Supplement * * @description: * Retrieve the Registry/Ordering/Supplement triple (also known as the * "R/O/S") from a CID-keyed font. * * @input: * face :: * A handle to the input face. * * @output: * registry :: * The registry, as a C~string, owned by the face. * * ordering :: * The ordering, as a C~string, owned by the face. * * supplement :: * The supplement. * * @return: * FreeType error code. 0~means success. * * @note: * This function only works with CID faces, returning an error * otherwise. * * @since: * 2.3.6 */ FT_EXPORT( FT_Error ) FT_Get_CID_Registry_Ordering_Supplement( FT_Face face, const char* *registry, const char* *ordering, FT_Int *supplement); /********************************************************************** * * @function: * FT_Get_CID_Is_Internally_CID_Keyed * * @description: * Retrieve the type of the input face, CID keyed or not. In * contrast to the @FT_IS_CID_KEYED macro this function returns * successfully also for CID-keyed fonts in an SFNT wrapper. * * @input: * face :: * A handle to the input face. * * @output: * is_cid :: * The type of the face as an @FT_Bool. * * @return: * FreeType error code. 0~means success. * * @note: * This function only works with CID faces and OpenType fonts, * returning an error otherwise. * * @since: * 2.3.9 */ FT_EXPORT( FT_Error ) FT_Get_CID_Is_Internally_CID_Keyed( FT_Face face, FT_Bool *is_cid ); /********************************************************************** * * @function: * FT_Get_CID_From_Glyph_Index * * @description: * Retrieve the CID of the input glyph index. * * @input: * face :: * A handle to the input face. * * glyph_index :: * The input glyph index. * * @output: * cid :: * The CID as an @FT_UInt. * * @return: * FreeType error code. 0~means success. * * @note: * This function only works with CID faces and OpenType fonts, * returning an error otherwise. * * @since: * 2.3.9 */ FT_EXPORT( FT_Error ) FT_Get_CID_From_Glyph_Index( FT_Face face, FT_UInt glyph_index, FT_UInt *cid ); /* */ FT_END_HEADER #endif /* FTCID_H_ */ /* END */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftmodapi.h�����������������������������������������������������������������������0000644�����������������00000112065�14763166026�0012270 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftmodapi.h */ /* */ /* FreeType modules public interface (specification). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTMODAPI_H_ #define FTMODAPI_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* module_management */ /* */ /* <Title> */ /* Module Management */ /* */ /* <Abstract> */ /* How to add, upgrade, remove, and control modules from FreeType. */ /* */ /* <Description> */ /* The definitions below are used to manage modules within FreeType. */ /* Modules can be added, upgraded, and removed at runtime. */ /* Additionally, some module properties can be controlled also. */ /* */ /* Here is a list of possible values of the `module_name' field in */ /* the @FT_Module_Class structure. */ /* */ /* { */ /* autofitter */ /* bdf */ /* cff */ /* gxvalid */ /* otvalid */ /* pcf */ /* pfr */ /* psaux */ /* pshinter */ /* psnames */ /* raster1 */ /* sfnt */ /* smooth, smooth-lcd, smooth-lcdv */ /* truetype */ /* type1 */ /* type42 */ /* t1cid */ /* winfonts */ /* } */ /* */ /* Note that the FreeType Cache sub-system is not a FreeType module. */ /* */ /* <Order> */ /* FT_Module */ /* FT_Module_Constructor */ /* FT_Module_Destructor */ /* FT_Module_Requester */ /* FT_Module_Class */ /* */ /* FT_Add_Module */ /* FT_Get_Module */ /* FT_Remove_Module */ /* FT_Add_Default_Modules */ /* */ /* FT_Property_Set */ /* FT_Property_Get */ /* FT_Set_Default_Properties */ /* */ /* FT_New_Library */ /* FT_Done_Library */ /* FT_Reference_Library */ /* */ /* FT_Renderer */ /* FT_Renderer_Class */ /* */ /* FT_Get_Renderer */ /* FT_Set_Renderer */ /* */ /* FT_Set_Debug_Hook */ /* */ /*************************************************************************/ /* module bit flags */ #define FT_MODULE_FONT_DRIVER 1 /* this module is a font driver */ #define FT_MODULE_RENDERER 2 /* this module is a renderer */ #define FT_MODULE_HINTER 4 /* this module is a glyph hinter */ #define FT_MODULE_STYLER 8 /* this module is a styler */ #define FT_MODULE_DRIVER_SCALABLE 0x100 /* the driver supports */ /* scalable fonts */ #define FT_MODULE_DRIVER_NO_OUTLINES 0x200 /* the driver does not */ /* support vector outlines */ #define FT_MODULE_DRIVER_HAS_HINTER 0x400 /* the driver provides its */ /* own hinter */ #define FT_MODULE_DRIVER_HINTS_LIGHTLY 0x800 /* the driver's hinter */ /* produces LIGHT hints */ /* deprecated values */ #define ft_module_font_driver FT_MODULE_FONT_DRIVER #define ft_module_renderer FT_MODULE_RENDERER #define ft_module_hinter FT_MODULE_HINTER #define ft_module_styler FT_MODULE_STYLER #define ft_module_driver_scalable FT_MODULE_DRIVER_SCALABLE #define ft_module_driver_no_outlines FT_MODULE_DRIVER_NO_OUTLINES #define ft_module_driver_has_hinter FT_MODULE_DRIVER_HAS_HINTER #define ft_module_driver_hints_lightly FT_MODULE_DRIVER_HINTS_LIGHTLY typedef FT_Pointer FT_Module_Interface; /*************************************************************************/ /* */ /* <FuncType> */ /* FT_Module_Constructor */ /* */ /* <Description> */ /* A function used to initialize (not create) a new module object. */ /* */ /* <Input> */ /* module :: The module to initialize. */ /* */ typedef FT_Error (*FT_Module_Constructor)( FT_Module module ); /*************************************************************************/ /* */ /* <FuncType> */ /* FT_Module_Destructor */ /* */ /* <Description> */ /* A function used to finalize (not destroy) a given module object. */ /* */ /* <Input> */ /* module :: The module to finalize. */ /* */ typedef void (*FT_Module_Destructor)( FT_Module module ); /*************************************************************************/ /* */ /* <FuncType> */ /* FT_Module_Requester */ /* */ /* <Description> */ /* A function used to query a given module for a specific interface. */ /* */ /* <Input> */ /* module :: The module to be searched. */ /* */ /* name :: The name of the interface in the module. */ /* */ typedef FT_Module_Interface (*FT_Module_Requester)( FT_Module module, const char* name ); /*************************************************************************/ /* */ /* <Struct> */ /* FT_Module_Class */ /* */ /* <Description> */ /* The module class descriptor. */ /* */ /* <Fields> */ /* module_flags :: Bit flags describing the module. */ /* */ /* module_size :: The size of one module object/instance in */ /* bytes. */ /* */ /* module_name :: The name of the module. */ /* */ /* module_version :: The version, as a 16.16 fixed number */ /* (major.minor). */ /* */ /* module_requires :: The version of FreeType this module requires, */ /* as a 16.16 fixed number (major.minor). Starts */ /* at version 2.0, i.e., 0x20000. */ /* */ /* module_init :: The initializing function. */ /* */ /* module_done :: The finalizing function. */ /* */ /* get_interface :: The interface requesting function. */ /* */ typedef struct FT_Module_Class_ { FT_ULong module_flags; FT_Long module_size; const FT_String* module_name; FT_Fixed module_version; FT_Fixed module_requires; const void* module_interface; FT_Module_Constructor module_init; FT_Module_Destructor module_done; FT_Module_Requester get_interface; } FT_Module_Class; /*************************************************************************/ /* */ /* <Function> */ /* FT_Add_Module */ /* */ /* <Description> */ /* Add a new module to a given library instance. */ /* */ /* <InOut> */ /* library :: A handle to the library object. */ /* */ /* <Input> */ /* clazz :: A pointer to class descriptor for the module. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* An error will be returned if a module already exists by that name, */ /* or if the module requires a version of FreeType that is too great. */ /* */ FT_EXPORT( FT_Error ) FT_Add_Module( FT_Library library, const FT_Module_Class* clazz ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_Module */ /* */ /* <Description> */ /* Find a module by its name. */ /* */ /* <Input> */ /* library :: A handle to the library object. */ /* */ /* module_name :: The module's name (as an ASCII string). */ /* */ /* <Return> */ /* A module handle. 0~if none was found. */ /* */ /* <Note> */ /* FreeType's internal modules aren't documented very well, and you */ /* should look up the source code for details. */ /* */ FT_EXPORT( FT_Module ) FT_Get_Module( FT_Library library, const char* module_name ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Remove_Module */ /* */ /* <Description> */ /* Remove a given module from a library instance. */ /* */ /* <InOut> */ /* library :: A handle to a library object. */ /* */ /* <Input> */ /* module :: A handle to a module object. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* The module object is destroyed by the function in case of success. */ /* */ FT_EXPORT( FT_Error ) FT_Remove_Module( FT_Library library, FT_Module module ); /********************************************************************** * * @function: * FT_Property_Set * * @description: * Set a property for a given module. * * @input: * library :: * A handle to the library the module is part of. * * module_name :: * The module name. * * property_name :: * The property name. Properties are described in the `Synopsis' * subsection of the module's documentation. * * Note that only a few modules have properties. * * value :: * A generic pointer to a variable or structure that gives the new * value of the property. The exact definition of `value' is * dependent on the property; see the `Synopsis' subsection of the * module's documentation. * * @return: * FreeType error code. 0~means success. * * @note: * If `module_name' isn't a valid module name, or `property_name' * doesn't specify a valid property, or if `value' doesn't represent a * valid value for the given property, an error is returned. * * The following example sets property `bar' (a simple integer) in * module `foo' to value~1. * * { * FT_UInt bar; * * * bar = 1; * FT_Property_Set( library, "foo", "bar", &bar ); * } * * Note that the FreeType Cache sub-system doesn't recognize module * property changes. To avoid glyph lookup confusion within the cache * you should call @FTC_Manager_Reset to completely flush the cache if * a module property gets changed after @FTC_Manager_New has been * called. * * It is not possible to set properties of the FreeType Cache * sub-system itself with FT_Property_Set; use @FTC_Property_Set * instead. * * @since: * 2.4.11 * */ FT_EXPORT( FT_Error ) FT_Property_Set( FT_Library library, const FT_String* module_name, const FT_String* property_name, const void* value ); /********************************************************************** * * @function: * FT_Property_Get * * @description: * Get a module's property value. * * @input: * library :: * A handle to the library the module is part of. * * module_name :: * The module name. * * property_name :: * The property name. Properties are described in the `Synopsis' * subsection of the module's documentation. * * @inout: * value :: * A generic pointer to a variable or structure that gives the * value of the property. The exact definition of `value' is * dependent on the property; see the `Synopsis' subsection of the * module's documentation. * * @return: * FreeType error code. 0~means success. * * @note: * If `module_name' isn't a valid module name, or `property_name' * doesn't specify a valid property, or if `value' doesn't represent a * valid value for the given property, an error is returned. * * The following example gets property `baz' (a range) in module `foo'. * * { * typedef range_ * { * FT_Int32 min; * FT_Int32 max; * * } range; * * range baz; * * * FT_Property_Get( library, "foo", "baz", &baz ); * } * * It is not possible to retrieve properties of the FreeType Cache * sub-system with FT_Property_Get; use @FTC_Property_Get instead. * * @since: * 2.4.11 * */ FT_EXPORT( FT_Error ) FT_Property_Get( FT_Library library, const FT_String* module_name, const FT_String* property_name, void* value ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Set_Default_Properties */ /* */ /* <Description> */ /* If compilation option FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES is */ /* set, this function reads the `FREETYPE_PROPERTIES' environment */ /* variable to control driver properties. See sections @auto_hinter, */ /* @cff_driver, @pcf_driver, and @tt_driver for more. */ /* */ /* If the compilation option is not set, this function does nothing. */ /* */ /* `FREETYPE_PROPERTIES' has the following syntax form (broken here */ /* into multiple lines for better readability). */ /* */ /* { */ /* <optional whitespace> */ /* <module-name1> ':' */ /* <property-name1> '=' <property-value1> */ /* <whitespace> */ /* <module-name2> ':' */ /* <property-name2> '=' <property-value2> */ /* ... */ /* } */ /* */ /* Example: */ /* */ /* { */ /* FREETYPE_PROPERTIES=truetype:interpreter-version=35 \ */ /* cff:no-stem-darkening=1 \ */ /* autofitter:warping=1 */ /* } */ /* */ /* <InOut> */ /* library :: A handle to a new library object. */ /* */ FT_EXPORT( void ) FT_Set_Default_Properties( FT_Library library ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Reference_Library */ /* */ /* <Description> */ /* A counter gets initialized to~1 at the time an @FT_Library */ /* structure is created. This function increments the counter. */ /* @FT_Done_Library then only destroys a library if the counter is~1, */ /* otherwise it simply decrements the counter. */ /* */ /* This function helps in managing life-cycles of structures that */ /* reference @FT_Library objects. */ /* */ /* <Input> */ /* library :: A handle to a target library object. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Since> */ /* 2.4.2 */ /* */ FT_EXPORT( FT_Error ) FT_Reference_Library( FT_Library library ); /*************************************************************************/ /* */ /* <Function> */ /* FT_New_Library */ /* */ /* <Description> */ /* This function is used to create a new FreeType library instance */ /* from a given memory object. It is thus possible to use libraries */ /* with distinct memory allocators within the same program. Note, */ /* however, that the used @FT_Memory structure is expected to remain */ /* valid for the life of the @FT_Library object. */ /* */ /* Normally, you would call this function (followed by a call to */ /* @FT_Add_Default_Modules or a series of calls to @FT_Add_Module, */ /* and a call to @FT_Set_Default_Properties) instead of */ /* @FT_Init_FreeType to initialize the FreeType library. */ /* */ /* Don't use @FT_Done_FreeType but @FT_Done_Library to destroy a */ /* library instance. */ /* */ /* <Input> */ /* memory :: A handle to the original memory object. */ /* */ /* <Output> */ /* alibrary :: A pointer to handle of a new library object. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* See the discussion of reference counters in the description of */ /* @FT_Reference_Library. */ /* */ FT_EXPORT( FT_Error ) FT_New_Library( FT_Memory memory, FT_Library *alibrary ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Done_Library */ /* */ /* <Description> */ /* Discard a given library object. This closes all drivers and */ /* discards all resource objects. */ /* */ /* <Input> */ /* library :: A handle to the target library. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* See the discussion of reference counters in the description of */ /* @FT_Reference_Library. */ /* */ FT_EXPORT( FT_Error ) FT_Done_Library( FT_Library library ); /* */ typedef void (*FT_DebugHook_Func)( void* arg ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Set_Debug_Hook */ /* */ /* <Description> */ /* Set a debug hook function for debugging the interpreter of a font */ /* format. */ /* */ /* <InOut> */ /* library :: A handle to the library object. */ /* */ /* <Input> */ /* hook_index :: The index of the debug hook. You should use the */ /* values defined in `ftobjs.h', e.g., */ /* `FT_DEBUG_HOOK_TRUETYPE'. */ /* */ /* debug_hook :: The function used to debug the interpreter. */ /* */ /* <Note> */ /* Currently, four debug hook slots are available, but only two (for */ /* the TrueType and the Type~1 interpreter) are defined. */ /* */ /* Since the internal headers of FreeType are no longer installed, */ /* the symbol `FT_DEBUG_HOOK_TRUETYPE' isn't available publicly. */ /* This is a bug and will be fixed in a forthcoming release. */ /* */ FT_EXPORT( void ) FT_Set_Debug_Hook( FT_Library library, FT_UInt hook_index, FT_DebugHook_Func debug_hook ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Add_Default_Modules */ /* */ /* <Description> */ /* Add the set of default drivers to a given library object. */ /* This is only useful when you create a library object with */ /* @FT_New_Library (usually to plug a custom memory manager). */ /* */ /* <InOut> */ /* library :: A handle to a new library object. */ /* */ FT_EXPORT( void ) FT_Add_Default_Modules( FT_Library library ); /************************************************************************** * * @section: * truetype_engine * * @title: * The TrueType Engine * * @abstract: * TrueType bytecode support. * * @description: * This section contains a function used to query the level of TrueType * bytecode support compiled in this version of the library. * */ /************************************************************************** * * @enum: * FT_TrueTypeEngineType * * @description: * A list of values describing which kind of TrueType bytecode * engine is implemented in a given FT_Library instance. It is used * by the @FT_Get_TrueType_Engine_Type function. * * @values: * FT_TRUETYPE_ENGINE_TYPE_NONE :: * The library doesn't implement any kind of bytecode interpreter. * * FT_TRUETYPE_ENGINE_TYPE_UNPATENTED :: * Deprecated and removed. * * FT_TRUETYPE_ENGINE_TYPE_PATENTED :: * The library implements a bytecode interpreter that covers * the full instruction set of the TrueType virtual machine (this * was governed by patents until May 2010, hence the name). * * @since: * 2.2 * */ typedef enum FT_TrueTypeEngineType_ { FT_TRUETYPE_ENGINE_TYPE_NONE = 0, FT_TRUETYPE_ENGINE_TYPE_UNPATENTED, FT_TRUETYPE_ENGINE_TYPE_PATENTED } FT_TrueTypeEngineType; /************************************************************************** * * @func: * FT_Get_TrueType_Engine_Type * * @description: * Return an @FT_TrueTypeEngineType value to indicate which level of * the TrueType virtual machine a given library instance supports. * * @input: * library :: * A library instance. * * @return: * A value indicating which level is supported. * * @since: * 2.2 * */ FT_EXPORT( FT_TrueTypeEngineType ) FT_Get_TrueType_Engine_Type( FT_Library library ); /* */ FT_END_HEADER #endif /* FTMODAPI_H_ */ /* END */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ttnameid.h�����������������������������������������������������������������������0000644�����������������00000165057�14763166026�0012303 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ttnameid.h */ /* */ /* TrueType name ID definitions (specification only). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef TTNAMEID_H_ #define TTNAMEID_H_ #include <ft2build.h> FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* truetype_tables */ /* */ /*************************************************************************/ /* */ /* Possible values for the `platform' identifier code in the name */ /* records of an SFNT `name' table. */ /* */ /*************************************************************************/ /*********************************************************************** * * @enum: * TT_PLATFORM_XXX * * @description: * A list of valid values for the `platform_id' identifier code in * @FT_CharMapRec and @FT_SfntName structures. * * @values: * TT_PLATFORM_APPLE_UNICODE :: * Used by Apple to indicate a Unicode character map and/or name entry. * See @TT_APPLE_ID_XXX for corresponding `encoding_id' values. Note * that name entries in this format are coded as big-endian UCS-2 * character codes _only_. * * TT_PLATFORM_MACINTOSH :: * Used by Apple to indicate a MacOS-specific charmap and/or name entry. * See @TT_MAC_ID_XXX for corresponding `encoding_id' values. Note that * most TrueType fonts contain an Apple roman charmap to be usable on * MacOS systems (even if they contain a Microsoft charmap as well). * * TT_PLATFORM_ISO :: * This value was used to specify ISO/IEC 10646 charmaps. It is however * now deprecated. See @TT_ISO_ID_XXX for a list of corresponding * `encoding_id' values. * * TT_PLATFORM_MICROSOFT :: * Used by Microsoft to indicate Windows-specific charmaps. See * @TT_MS_ID_XXX for a list of corresponding `encoding_id' values. * Note that most fonts contain a Unicode charmap using * (TT_PLATFORM_MICROSOFT, @TT_MS_ID_UNICODE_CS). * * TT_PLATFORM_CUSTOM :: * Used to indicate application-specific charmaps. * * TT_PLATFORM_ADOBE :: * This value isn't part of any font format specification, but is used * by FreeType to report Adobe-specific charmaps in an @FT_CharMapRec * structure. See @TT_ADOBE_ID_XXX. */ #define TT_PLATFORM_APPLE_UNICODE 0 #define TT_PLATFORM_MACINTOSH 1 #define TT_PLATFORM_ISO 2 /* deprecated */ #define TT_PLATFORM_MICROSOFT 3 #define TT_PLATFORM_CUSTOM 4 #define TT_PLATFORM_ADOBE 7 /* artificial */ /*********************************************************************** * * @enum: * TT_APPLE_ID_XXX * * @description: * A list of valid values for the `encoding_id' for * @TT_PLATFORM_APPLE_UNICODE charmaps and name entries. * * @values: * TT_APPLE_ID_DEFAULT :: * Unicode version 1.0. * * TT_APPLE_ID_UNICODE_1_1 :: * Unicode 1.1; specifies Hangul characters starting at U+34xx. * * TT_APPLE_ID_ISO_10646 :: * Deprecated (identical to preceding). * * TT_APPLE_ID_UNICODE_2_0 :: * Unicode 2.0 and beyond (UTF-16 BMP only). * * TT_APPLE_ID_UNICODE_32 :: * Unicode 3.1 and beyond, using UTF-32. * * TT_APPLE_ID_VARIANT_SELECTOR :: * From Adobe, not Apple. Not a normal cmap. Specifies variations * on a real cmap. * * TT_APPLE_ID_FULL_UNICODE :: * Used for fallback fonts that provide complete Unicode coverage with * a type~13 cmap. */ #define TT_APPLE_ID_DEFAULT 0 /* Unicode 1.0 */ #define TT_APPLE_ID_UNICODE_1_1 1 /* specify Hangul at U+34xx */ #define TT_APPLE_ID_ISO_10646 2 /* deprecated */ #define TT_APPLE_ID_UNICODE_2_0 3 /* or later */ #define TT_APPLE_ID_UNICODE_32 4 /* 2.0 or later, full repertoire */ #define TT_APPLE_ID_VARIANT_SELECTOR 5 /* variation selector data */ #define TT_APPLE_ID_FULL_UNICODE 6 /* used with type 13 cmaps */ /*********************************************************************** * * @enum: * TT_MAC_ID_XXX * * @description: * A list of valid values for the `encoding_id' for * @TT_PLATFORM_MACINTOSH charmaps and name entries. */ #define TT_MAC_ID_ROMAN 0 #define TT_MAC_ID_JAPANESE 1 #define TT_MAC_ID_TRADITIONAL_CHINESE 2 #define TT_MAC_ID_KOREAN 3 #define TT_MAC_ID_ARABIC 4 #define TT_MAC_ID_HEBREW 5 #define TT_MAC_ID_GREEK 6 #define TT_MAC_ID_RUSSIAN 7 #define TT_MAC_ID_RSYMBOL 8 #define TT_MAC_ID_DEVANAGARI 9 #define TT_MAC_ID_GURMUKHI 10 #define TT_MAC_ID_GUJARATI 11 #define TT_MAC_ID_ORIYA 12 #define TT_MAC_ID_BENGALI 13 #define TT_MAC_ID_TAMIL 14 #define TT_MAC_ID_TELUGU 15 #define TT_MAC_ID_KANNADA 16 #define TT_MAC_ID_MALAYALAM 17 #define TT_MAC_ID_SINHALESE 18 #define TT_MAC_ID_BURMESE 19 #define TT_MAC_ID_KHMER 20 #define TT_MAC_ID_THAI 21 #define TT_MAC_ID_LAOTIAN 22 #define TT_MAC_ID_GEORGIAN 23 #define TT_MAC_ID_ARMENIAN 24 #define TT_MAC_ID_MALDIVIAN 25 #define TT_MAC_ID_SIMPLIFIED_CHINESE 25 #define TT_MAC_ID_TIBETAN 26 #define TT_MAC_ID_MONGOLIAN 27 #define TT_MAC_ID_GEEZ 28 #define TT_MAC_ID_SLAVIC 29 #define TT_MAC_ID_VIETNAMESE 30 #define TT_MAC_ID_SINDHI 31 #define TT_MAC_ID_UNINTERP 32 /*********************************************************************** * * @enum: * TT_ISO_ID_XXX * * @description: * A list of valid values for the `encoding_id' for * @TT_PLATFORM_ISO charmaps and name entries. * * Their use is now deprecated. * * @values: * TT_ISO_ID_7BIT_ASCII :: * ASCII. * TT_ISO_ID_10646 :: * ISO/10646. * TT_ISO_ID_8859_1 :: * Also known as Latin-1. */ #define TT_ISO_ID_7BIT_ASCII 0 #define TT_ISO_ID_10646 1 #define TT_ISO_ID_8859_1 2 /*********************************************************************** * * @enum: * TT_MS_ID_XXX * * @description: * A list of valid values for the `encoding_id' for * @TT_PLATFORM_MICROSOFT charmaps and name entries. * * @values: * TT_MS_ID_SYMBOL_CS :: * Microsoft symbol encoding. See @FT_ENCODING_MS_SYMBOL. * * TT_MS_ID_UNICODE_CS :: * Microsoft WGL4 charmap, matching Unicode. See * @FT_ENCODING_UNICODE. * * TT_MS_ID_SJIS :: * Shift JIS Japanese encoding. See @FT_ENCODING_SJIS. * * TT_MS_ID_PRC :: * Chinese encodings as used in the People's Republic of China (PRC). * This means the encodings GB~2312 and its supersets GBK and * GB~18030. See @FT_ENCODING_PRC. * * TT_MS_ID_BIG_5 :: * Traditional Chinese as used in Taiwan and Hong Kong. See * @FT_ENCODING_BIG5. * * TT_MS_ID_WANSUNG :: * Korean Extended Wansung encoding. See @FT_ENCODING_WANSUNG. * * TT_MS_ID_JOHAB :: * Korean Johab encoding. See @FT_ENCODING_JOHAB. * * TT_MS_ID_UCS_4 :: * UCS-4 or UTF-32 charmaps. This has been added to the OpenType * specification version 1.4 (mid-2001). */ #define TT_MS_ID_SYMBOL_CS 0 #define TT_MS_ID_UNICODE_CS 1 #define TT_MS_ID_SJIS 2 #define TT_MS_ID_PRC 3 #define TT_MS_ID_BIG_5 4 #define TT_MS_ID_WANSUNG 5 #define TT_MS_ID_JOHAB 6 #define TT_MS_ID_UCS_4 10 /* this value is deprecated */ #define TT_MS_ID_GB2312 TT_MS_ID_PRC /*********************************************************************** * * @enum: * TT_ADOBE_ID_XXX * * @description: * A list of valid values for the `encoding_id' for * @TT_PLATFORM_ADOBE charmaps. This is a FreeType-specific extension! * * @values: * TT_ADOBE_ID_STANDARD :: * Adobe standard encoding. * TT_ADOBE_ID_EXPERT :: * Adobe expert encoding. * TT_ADOBE_ID_CUSTOM :: * Adobe custom encoding. * TT_ADOBE_ID_LATIN_1 :: * Adobe Latin~1 encoding. */ #define TT_ADOBE_ID_STANDARD 0 #define TT_ADOBE_ID_EXPERT 1 #define TT_ADOBE_ID_CUSTOM 2 #define TT_ADOBE_ID_LATIN_1 3 /*********************************************************************** * * @enum: * TT_MAC_LANGID_XXX * * @description: * Possible values of the language identifier field in the name records * of the SFNT `name' table if the `platform' identifier code is * @TT_PLATFORM_MACINTOSH. These values are also used as return values * for function @FT_Get_CMap_Language_ID. * * The canonical source for Apple's IDs is * * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6name.html */ #define TT_MAC_LANGID_ENGLISH 0 #define TT_MAC_LANGID_FRENCH 1 #define TT_MAC_LANGID_GERMAN 2 #define TT_MAC_LANGID_ITALIAN 3 #define TT_MAC_LANGID_DUTCH 4 #define TT_MAC_LANGID_SWEDISH 5 #define TT_MAC_LANGID_SPANISH 6 #define TT_MAC_LANGID_DANISH 7 #define TT_MAC_LANGID_PORTUGUESE 8 #define TT_MAC_LANGID_NORWEGIAN 9 #define TT_MAC_LANGID_HEBREW 10 #define TT_MAC_LANGID_JAPANESE 11 #define TT_MAC_LANGID_ARABIC 12 #define TT_MAC_LANGID_FINNISH 13 #define TT_MAC_LANGID_GREEK 14 #define TT_MAC_LANGID_ICELANDIC 15 #define TT_MAC_LANGID_MALTESE 16 #define TT_MAC_LANGID_TURKISH 17 #define TT_MAC_LANGID_CROATIAN 18 #define TT_MAC_LANGID_CHINESE_TRADITIONAL 19 #define TT_MAC_LANGID_URDU 20 #define TT_MAC_LANGID_HINDI 21 #define TT_MAC_LANGID_THAI 22 #define TT_MAC_LANGID_KOREAN 23 #define TT_MAC_LANGID_LITHUANIAN 24 #define TT_MAC_LANGID_POLISH 25 #define TT_MAC_LANGID_HUNGARIAN 26 #define TT_MAC_LANGID_ESTONIAN 27 #define TT_MAC_LANGID_LETTISH 28 #define TT_MAC_LANGID_SAAMISK 29 #define TT_MAC_LANGID_FAEROESE 30 #define TT_MAC_LANGID_FARSI 31 #define TT_MAC_LANGID_RUSSIAN 32 #define TT_MAC_LANGID_CHINESE_SIMPLIFIED 33 #define TT_MAC_LANGID_FLEMISH 34 #define TT_MAC_LANGID_IRISH 35 #define TT_MAC_LANGID_ALBANIAN 36 #define TT_MAC_LANGID_ROMANIAN 37 #define TT_MAC_LANGID_CZECH 38 #define TT_MAC_LANGID_SLOVAK 39 #define TT_MAC_LANGID_SLOVENIAN 40 #define TT_MAC_LANGID_YIDDISH 41 #define TT_MAC_LANGID_SERBIAN 42 #define TT_MAC_LANGID_MACEDONIAN 43 #define TT_MAC_LANGID_BULGARIAN 44 #define TT_MAC_LANGID_UKRAINIAN 45 #define TT_MAC_LANGID_BYELORUSSIAN 46 #define TT_MAC_LANGID_UZBEK 47 #define TT_MAC_LANGID_KAZAKH 48 #define TT_MAC_LANGID_AZERBAIJANI 49 #define TT_MAC_LANGID_AZERBAIJANI_CYRILLIC_SCRIPT 49 #define TT_MAC_LANGID_AZERBAIJANI_ARABIC_SCRIPT 50 #define TT_MAC_LANGID_ARMENIAN 51 #define TT_MAC_LANGID_GEORGIAN 52 #define TT_MAC_LANGID_MOLDAVIAN 53 #define TT_MAC_LANGID_KIRGHIZ 54 #define TT_MAC_LANGID_TAJIKI 55 #define TT_MAC_LANGID_TURKMEN 56 #define TT_MAC_LANGID_MONGOLIAN 57 #define TT_MAC_LANGID_MONGOLIAN_MONGOLIAN_SCRIPT 57 #define TT_MAC_LANGID_MONGOLIAN_CYRILLIC_SCRIPT 58 #define TT_MAC_LANGID_PASHTO 59 #define TT_MAC_LANGID_KURDISH 60 #define TT_MAC_LANGID_KASHMIRI 61 #define TT_MAC_LANGID_SINDHI 62 #define TT_MAC_LANGID_TIBETAN 63 #define TT_MAC_LANGID_NEPALI 64 #define TT_MAC_LANGID_SANSKRIT 65 #define TT_MAC_LANGID_MARATHI 66 #define TT_MAC_LANGID_BENGALI 67 #define TT_MAC_LANGID_ASSAMESE 68 #define TT_MAC_LANGID_GUJARATI 69 #define TT_MAC_LANGID_PUNJABI 70 #define TT_MAC_LANGID_ORIYA 71 #define TT_MAC_LANGID_MALAYALAM 72 #define TT_MAC_LANGID_KANNADA 73 #define TT_MAC_LANGID_TAMIL 74 #define TT_MAC_LANGID_TELUGU 75 #define TT_MAC_LANGID_SINHALESE 76 #define TT_MAC_LANGID_BURMESE 77 #define TT_MAC_LANGID_KHMER 78 #define TT_MAC_LANGID_LAO 79 #define TT_MAC_LANGID_VIETNAMESE 80 #define TT_MAC_LANGID_INDONESIAN 81 #define TT_MAC_LANGID_TAGALOG 82 #define TT_MAC_LANGID_MALAY_ROMAN_SCRIPT 83 #define TT_MAC_LANGID_MALAY_ARABIC_SCRIPT 84 #define TT_MAC_LANGID_AMHARIC 85 #define TT_MAC_LANGID_TIGRINYA 86 #define TT_MAC_LANGID_GALLA 87 #define TT_MAC_LANGID_SOMALI 88 #define TT_MAC_LANGID_SWAHILI 89 #define TT_MAC_LANGID_RUANDA 90 #define TT_MAC_LANGID_RUNDI 91 #define TT_MAC_LANGID_CHEWA 92 #define TT_MAC_LANGID_MALAGASY 93 #define TT_MAC_LANGID_ESPERANTO 94 #define TT_MAC_LANGID_WELSH 128 #define TT_MAC_LANGID_BASQUE 129 #define TT_MAC_LANGID_CATALAN 130 #define TT_MAC_LANGID_LATIN 131 #define TT_MAC_LANGID_QUECHUA 132 #define TT_MAC_LANGID_GUARANI 133 #define TT_MAC_LANGID_AYMARA 134 #define TT_MAC_LANGID_TATAR 135 #define TT_MAC_LANGID_UIGHUR 136 #define TT_MAC_LANGID_DZONGKHA 137 #define TT_MAC_LANGID_JAVANESE 138 #define TT_MAC_LANGID_SUNDANESE 139 /* The following codes are new as of 2000-03-10 */ #define TT_MAC_LANGID_GALICIAN 140 #define TT_MAC_LANGID_AFRIKAANS 141 #define TT_MAC_LANGID_BRETON 142 #define TT_MAC_LANGID_INUKTITUT 143 #define TT_MAC_LANGID_SCOTTISH_GAELIC 144 #define TT_MAC_LANGID_MANX_GAELIC 145 #define TT_MAC_LANGID_IRISH_GAELIC 146 #define TT_MAC_LANGID_TONGAN 147 #define TT_MAC_LANGID_GREEK_POLYTONIC 148 #define TT_MAC_LANGID_GREELANDIC 149 #define TT_MAC_LANGID_AZERBAIJANI_ROMAN_SCRIPT 150 /*********************************************************************** * * @enum: * TT_MS_LANGID_XXX * * @description: * Possible values of the language identifier field in the name records * of the SFNT `name' table if the `platform' identifier code is * @TT_PLATFORM_MICROSOFT. These values are also used as return values * for function @FT_Get_CMap_Language_ID. * * The canonical source for Microsoft's IDs is * * http://www.microsoft.com/globaldev/reference/lcid-all.mspx , * * however, we only provide macros for language identifiers present in * the OpenType specification: Microsoft has abandoned the concept of * LCIDs (language code identifiers), and format~1 of the `name' table * provides a better mechanism for languages not covered here. * * More legacy values not listed in the reference can be found in the * @FT_TRUETYPE_IDS_H header file. */ #define TT_MS_LANGID_ARABIC_SAUDI_ARABIA 0x0401 #define TT_MS_LANGID_ARABIC_IRAQ 0x0801 #define TT_MS_LANGID_ARABIC_EGYPT 0x0C01 #define TT_MS_LANGID_ARABIC_LIBYA 0x1001 #define TT_MS_LANGID_ARABIC_ALGERIA 0x1401 #define TT_MS_LANGID_ARABIC_MOROCCO 0x1801 #define TT_MS_LANGID_ARABIC_TUNISIA 0x1C01 #define TT_MS_LANGID_ARABIC_OMAN 0x2001 #define TT_MS_LANGID_ARABIC_YEMEN 0x2401 #define TT_MS_LANGID_ARABIC_SYRIA 0x2801 #define TT_MS_LANGID_ARABIC_JORDAN 0x2C01 #define TT_MS_LANGID_ARABIC_LEBANON 0x3001 #define TT_MS_LANGID_ARABIC_KUWAIT 0x3401 #define TT_MS_LANGID_ARABIC_UAE 0x3801 #define TT_MS_LANGID_ARABIC_BAHRAIN 0x3C01 #define TT_MS_LANGID_ARABIC_QATAR 0x4001 #define TT_MS_LANGID_BULGARIAN_BULGARIA 0x0402 #define TT_MS_LANGID_CATALAN_CATALAN 0x0403 #define TT_MS_LANGID_CHINESE_TAIWAN 0x0404 #define TT_MS_LANGID_CHINESE_PRC 0x0804 #define TT_MS_LANGID_CHINESE_HONG_KONG 0x0C04 #define TT_MS_LANGID_CHINESE_SINGAPORE 0x1004 #define TT_MS_LANGID_CHINESE_MACAO 0x1404 #define TT_MS_LANGID_CZECH_CZECH_REPUBLIC 0x0405 #define TT_MS_LANGID_DANISH_DENMARK 0x0406 #define TT_MS_LANGID_GERMAN_GERMANY 0x0407 #define TT_MS_LANGID_GERMAN_SWITZERLAND 0x0807 #define TT_MS_LANGID_GERMAN_AUSTRIA 0x0C07 #define TT_MS_LANGID_GERMAN_LUXEMBOURG 0x1007 #define TT_MS_LANGID_GERMAN_LIECHTENSTEIN 0x1407 #define TT_MS_LANGID_GREEK_GREECE 0x0408 #define TT_MS_LANGID_ENGLISH_UNITED_STATES 0x0409 #define TT_MS_LANGID_ENGLISH_UNITED_KINGDOM 0x0809 #define TT_MS_LANGID_ENGLISH_AUSTRALIA 0x0C09 #define TT_MS_LANGID_ENGLISH_CANADA 0x1009 #define TT_MS_LANGID_ENGLISH_NEW_ZEALAND 0x1409 #define TT_MS_LANGID_ENGLISH_IRELAND 0x1809 #define TT_MS_LANGID_ENGLISH_SOUTH_AFRICA 0x1C09 #define TT_MS_LANGID_ENGLISH_JAMAICA 0x2009 #define TT_MS_LANGID_ENGLISH_CARIBBEAN 0x2409 #define TT_MS_LANGID_ENGLISH_BELIZE 0x2809 #define TT_MS_LANGID_ENGLISH_TRINIDAD 0x2C09 #define TT_MS_LANGID_ENGLISH_ZIMBABWE 0x3009 #define TT_MS_LANGID_ENGLISH_PHILIPPINES 0x3409 #define TT_MS_LANGID_ENGLISH_INDIA 0x4009 #define TT_MS_LANGID_ENGLISH_MALAYSIA 0x4409 #define TT_MS_LANGID_ENGLISH_SINGAPORE 0x4809 #define TT_MS_LANGID_SPANISH_SPAIN_TRADITIONAL_SORT 0x040A #define TT_MS_LANGID_SPANISH_MEXICO 0x080A #define TT_MS_LANGID_SPANISH_SPAIN_MODERN_SORT 0x0C0A #define TT_MS_LANGID_SPANISH_GUATEMALA 0x100A #define TT_MS_LANGID_SPANISH_COSTA_RICA 0x140A #define TT_MS_LANGID_SPANISH_PANAMA 0x180A #define TT_MS_LANGID_SPANISH_DOMINICAN_REPUBLIC 0x1C0A #define TT_MS_LANGID_SPANISH_VENEZUELA 0x200A #define TT_MS_LANGID_SPANISH_COLOMBIA 0x240A #define TT_MS_LANGID_SPANISH_PERU 0x280A #define TT_MS_LANGID_SPANISH_ARGENTINA 0x2C0A #define TT_MS_LANGID_SPANISH_ECUADOR 0x300A #define TT_MS_LANGID_SPANISH_CHILE 0x340A #define TT_MS_LANGID_SPANISH_URUGUAY 0x380A #define TT_MS_LANGID_SPANISH_PARAGUAY 0x3C0A #define TT_MS_LANGID_SPANISH_BOLIVIA 0x400A #define TT_MS_LANGID_SPANISH_EL_SALVADOR 0x440A #define TT_MS_LANGID_SPANISH_HONDURAS 0x480A #define TT_MS_LANGID_SPANISH_NICARAGUA 0x4C0A #define TT_MS_LANGID_SPANISH_PUERTO_RICO 0x500A #define TT_MS_LANGID_SPANISH_UNITED_STATES 0x540A #define TT_MS_LANGID_FINNISH_FINLAND 0x040B #define TT_MS_LANGID_FRENCH_FRANCE 0x040C #define TT_MS_LANGID_FRENCH_BELGIUM 0x080C #define TT_MS_LANGID_FRENCH_CANADA 0x0C0C #define TT_MS_LANGID_FRENCH_SWITZERLAND 0x100C #define TT_MS_LANGID_FRENCH_LUXEMBOURG 0x140C #define TT_MS_LANGID_FRENCH_MONACO 0x180C #define TT_MS_LANGID_HEBREW_ISRAEL 0x040D #define TT_MS_LANGID_HUNGARIAN_HUNGARY 0x040E #define TT_MS_LANGID_ICELANDIC_ICELAND 0x040F #define TT_MS_LANGID_ITALIAN_ITALY 0x0410 #define TT_MS_LANGID_ITALIAN_SWITZERLAND 0x0810 #define TT_MS_LANGID_JAPANESE_JAPAN 0x0411 #define TT_MS_LANGID_KOREAN_KOREA 0x0412 #define TT_MS_LANGID_DUTCH_NETHERLANDS 0x0413 #define TT_MS_LANGID_DUTCH_BELGIUM 0x0813 #define TT_MS_LANGID_NORWEGIAN_NORWAY_BOKMAL 0x0414 #define TT_MS_LANGID_NORWEGIAN_NORWAY_NYNORSK 0x0814 #define TT_MS_LANGID_POLISH_POLAND 0x0415 #define TT_MS_LANGID_PORTUGUESE_BRAZIL 0x0416 #define TT_MS_LANGID_PORTUGUESE_PORTUGAL 0x0816 #define TT_MS_LANGID_ROMANSH_SWITZERLAND 0x0417 #define TT_MS_LANGID_ROMANIAN_ROMANIA 0x0418 #define TT_MS_LANGID_RUSSIAN_RUSSIA 0x0419 #define TT_MS_LANGID_CROATIAN_CROATIA 0x041A #define TT_MS_LANGID_SERBIAN_SERBIA_LATIN 0x081A #define TT_MS_LANGID_SERBIAN_SERBIA_CYRILLIC 0x0C1A #define TT_MS_LANGID_CROATIAN_BOSNIA_HERZEGOVINA 0x101A #define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA 0x141A #define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_LATIN 0x181A #define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_CYRILLIC 0x1C1A #define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZ_CYRILLIC 0x201A #define TT_MS_LANGID_SLOVAK_SLOVAKIA 0x041B #define TT_MS_LANGID_ALBANIAN_ALBANIA 0x041C #define TT_MS_LANGID_SWEDISH_SWEDEN 0x041D #define TT_MS_LANGID_SWEDISH_FINLAND 0x081D #define TT_MS_LANGID_THAI_THAILAND 0x041E #define TT_MS_LANGID_TURKISH_TURKEY 0x041F #define TT_MS_LANGID_URDU_PAKISTAN 0x0420 #define TT_MS_LANGID_INDONESIAN_INDONESIA 0x0421 #define TT_MS_LANGID_UKRAINIAN_UKRAINE 0x0422 #define TT_MS_LANGID_BELARUSIAN_BELARUS 0x0423 #define TT_MS_LANGID_SLOVENIAN_SLOVENIA 0x0424 #define TT_MS_LANGID_ESTONIAN_ESTONIA 0x0425 #define TT_MS_LANGID_LATVIAN_LATVIA 0x0426 #define TT_MS_LANGID_LITHUANIAN_LITHUANIA 0x0427 #define TT_MS_LANGID_TAJIK_TAJIKISTAN 0x0428 #define TT_MS_LANGID_VIETNAMESE_VIET_NAM 0x042A #define TT_MS_LANGID_ARMENIAN_ARMENIA 0x042B #define TT_MS_LANGID_AZERI_AZERBAIJAN_LATIN 0x042C #define TT_MS_LANGID_AZERI_AZERBAIJAN_CYRILLIC 0x082C #define TT_MS_LANGID_BASQUE_BASQUE 0x042D #define TT_MS_LANGID_UPPER_SORBIAN_GERMANY 0x042E #define TT_MS_LANGID_LOWER_SORBIAN_GERMANY 0x082E #define TT_MS_LANGID_MACEDONIAN_MACEDONIA 0x042F #define TT_MS_LANGID_SETSWANA_SOUTH_AFRICA 0x0432 #define TT_MS_LANGID_ISIXHOSA_SOUTH_AFRICA 0x0434 #define TT_MS_LANGID_ISIZULU_SOUTH_AFRICA 0x0435 #define TT_MS_LANGID_AFRIKAANS_SOUTH_AFRICA 0x0436 #define TT_MS_LANGID_GEORGIAN_GEORGIA 0x0437 #define TT_MS_LANGID_FAEROESE_FAEROE_ISLANDS 0x0438 #define TT_MS_LANGID_HINDI_INDIA 0x0439 #define TT_MS_LANGID_MALTESE_MALTA 0x043A #define TT_MS_LANGID_SAMI_NORTHERN_NORWAY 0x043B #define TT_MS_LANGID_SAMI_NORTHERN_SWEDEN 0x083B #define TT_MS_LANGID_SAMI_NORTHERN_FINLAND 0x0C3B #define TT_MS_LANGID_SAMI_LULE_NORWAY 0x103B #define TT_MS_LANGID_SAMI_LULE_SWEDEN 0x143B #define TT_MS_LANGID_SAMI_SOUTHERN_NORWAY 0x183B #define TT_MS_LANGID_SAMI_SOUTHERN_SWEDEN 0x1C3B #define TT_MS_LANGID_SAMI_SKOLT_FINLAND 0x203B #define TT_MS_LANGID_SAMI_INARI_FINLAND 0x243B #define TT_MS_LANGID_IRISH_IRELAND 0x083C #define TT_MS_LANGID_MALAY_MALAYSIA 0x043E #define TT_MS_LANGID_MALAY_BRUNEI_DARUSSALAM 0x083E #define TT_MS_LANGID_KAZAKH_KAZAKHSTAN 0x043F #define TT_MS_LANGID_KYRGYZ_KYRGYZSTAN /* Cyrillic*/ 0x0440 #define TT_MS_LANGID_KISWAHILI_KENYA 0x0441 #define TT_MS_LANGID_TURKMEN_TURKMENISTAN 0x0442 #define TT_MS_LANGID_UZBEK_UZBEKISTAN_LATIN 0x0443 #define TT_MS_LANGID_UZBEK_UZBEKISTAN_CYRILLIC 0x0843 #define TT_MS_LANGID_TATAR_RUSSIA 0x0444 #define TT_MS_LANGID_BENGALI_INDIA 0x0445 #define TT_MS_LANGID_BENGALI_BANGLADESH 0x0845 #define TT_MS_LANGID_PUNJABI_INDIA 0x0446 #define TT_MS_LANGID_GUJARATI_INDIA 0x0447 #define TT_MS_LANGID_ODIA_INDIA 0x0448 #define TT_MS_LANGID_TAMIL_INDIA 0x0449 #define TT_MS_LANGID_TELUGU_INDIA 0x044A #define TT_MS_LANGID_KANNADA_INDIA 0x044B #define TT_MS_LANGID_MALAYALAM_INDIA 0x044C #define TT_MS_LANGID_ASSAMESE_INDIA 0x044D #define TT_MS_LANGID_MARATHI_INDIA 0x044E #define TT_MS_LANGID_SANSKRIT_INDIA 0x044F #define TT_MS_LANGID_MONGOLIAN_MONGOLIA /* Cyrillic */ 0x0450 #define TT_MS_LANGID_MONGOLIAN_PRC 0x0850 #define TT_MS_LANGID_TIBETAN_PRC 0x0451 #define TT_MS_LANGID_WELSH_UNITED_KINGDOM 0x0452 #define TT_MS_LANGID_KHMER_CAMBODIA 0x0453 #define TT_MS_LANGID_LAO_LAOS 0x0454 #define TT_MS_LANGID_GALICIAN_GALICIAN 0x0456 #define TT_MS_LANGID_KONKANI_INDIA 0x0457 #define TT_MS_LANGID_SYRIAC_SYRIA 0x045A #define TT_MS_LANGID_SINHALA_SRI_LANKA 0x045B #define TT_MS_LANGID_INUKTITUT_CANADA 0x045D #define TT_MS_LANGID_INUKTITUT_CANADA_LATIN 0x085D #define TT_MS_LANGID_AMHARIC_ETHIOPIA 0x045E #define TT_MS_LANGID_TAMAZIGHT_ALGERIA 0x085F #define TT_MS_LANGID_NEPALI_NEPAL 0x0461 #define TT_MS_LANGID_FRISIAN_NETHERLANDS 0x0462 #define TT_MS_LANGID_PASHTO_AFGHANISTAN 0x0463 #define TT_MS_LANGID_FILIPINO_PHILIPPINES 0x0464 #define TT_MS_LANGID_DHIVEHI_MALDIVES 0x0465 #define TT_MS_LANGID_HAUSA_NIGERIA 0x0468 #define TT_MS_LANGID_YORUBA_NIGERIA 0x046A #define TT_MS_LANGID_QUECHUA_BOLIVIA 0x046B #define TT_MS_LANGID_QUECHUA_ECUADOR 0x086B #define TT_MS_LANGID_QUECHUA_PERU 0x0C6B #define TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA 0x046C #define TT_MS_LANGID_BASHKIR_RUSSIA 0x046D #define TT_MS_LANGID_LUXEMBOURGISH_LUXEMBOURG 0x046E #define TT_MS_LANGID_GREENLANDIC_GREENLAND 0x046F #define TT_MS_LANGID_IGBO_NIGERIA 0x0470 #define TT_MS_LANGID_YI_PRC 0x0478 #define TT_MS_LANGID_MAPUDUNGUN_CHILE 0x047A #define TT_MS_LANGID_MOHAWK_MOHAWK 0x047C #define TT_MS_LANGID_BRETON_FRANCE 0x047E #define TT_MS_LANGID_UIGHUR_PRC 0x0480 #define TT_MS_LANGID_MAORI_NEW_ZEALAND 0x0481 #define TT_MS_LANGID_OCCITAN_FRANCE 0x0482 #define TT_MS_LANGID_CORSICAN_FRANCE 0x0483 #define TT_MS_LANGID_ALSATIAN_FRANCE 0x0484 #define TT_MS_LANGID_YAKUT_RUSSIA 0x0485 #define TT_MS_LANGID_KICHE_GUATEMALA 0x0486 #define TT_MS_LANGID_KINYARWANDA_RWANDA 0x0487 #define TT_MS_LANGID_WOLOF_SENEGAL 0x0488 #define TT_MS_LANGID_DARI_AFGHANISTAN 0x048C /* */ /* legacy macro definitions not present in OpenType 1.8.1 */ #define TT_MS_LANGID_ARABIC_GENERAL 0x0001 #define TT_MS_LANGID_CATALAN_SPAIN \ TT_MS_LANGID_CATALAN_CATALAN #define TT_MS_LANGID_CHINESE_GENERAL 0x0004 #define TT_MS_LANGID_CHINESE_MACAU \ TT_MS_LANGID_CHINESE_MACAO #define TT_MS_LANGID_GERMAN_LIECHTENSTEI \ TT_MS_LANGID_GERMAN_LIECHTENSTEIN #define TT_MS_LANGID_ENGLISH_GENERAL 0x0009 #define TT_MS_LANGID_ENGLISH_INDONESIA 0x3809 #define TT_MS_LANGID_ENGLISH_HONG_KONG 0x3C09 #define TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT \ TT_MS_LANGID_SPANISH_SPAIN_MODERN_SORT #define TT_MS_LANGID_SPANISH_LATIN_AMERICA 0xE40AU #define TT_MS_LANGID_FRENCH_WEST_INDIES 0x1C0C #define TT_MS_LANGID_FRENCH_REUNION 0x200C #define TT_MS_LANGID_FRENCH_CONGO 0x240C /* which was formerly: */ #define TT_MS_LANGID_FRENCH_ZAIRE \ TT_MS_LANGID_FRENCH_CONGO #define TT_MS_LANGID_FRENCH_SENEGAL 0x280C #define TT_MS_LANGID_FRENCH_CAMEROON 0x2C0C #define TT_MS_LANGID_FRENCH_COTE_D_IVOIRE 0x300C #define TT_MS_LANGID_FRENCH_MALI 0x340C #define TT_MS_LANGID_FRENCH_MOROCCO 0x380C #define TT_MS_LANGID_FRENCH_HAITI 0x3C0C #define TT_MS_LANGID_FRENCH_NORTH_AFRICA 0xE40CU #define TT_MS_LANGID_KOREAN_EXTENDED_WANSUNG_KOREA \ TT_MS_LANGID_KOREAN_KOREA #define TT_MS_LANGID_KOREAN_JOHAB_KOREA 0x0812 #define TT_MS_LANGID_RHAETO_ROMANIC_SWITZERLAND \ TT_MS_LANGID_ROMANSH_SWITZERLAND #define TT_MS_LANGID_MOLDAVIAN_MOLDAVIA 0x0818 #define TT_MS_LANGID_RUSSIAN_MOLDAVIA 0x0819 #define TT_MS_LANGID_URDU_INDIA 0x0820 #define TT_MS_LANGID_CLASSIC_LITHUANIAN_LITHUANIA 0x0827 #define TT_MS_LANGID_SLOVENE_SLOVENIA \ TT_MS_LANGID_SLOVENIAN_SLOVENIA #define TT_MS_LANGID_FARSI_IRAN 0x0429 #define TT_MS_LANGID_BASQUE_SPAIN \ TT_MS_LANGID_BASQUE_BASQUE #define TT_MS_LANGID_SORBIAN_GERMANY \ TT_MS_LANGID_UPPER_SORBIAN_GERMANY #define TT_MS_LANGID_SUTU_SOUTH_AFRICA 0x0430 #define TT_MS_LANGID_TSONGA_SOUTH_AFRICA 0x0431 #define TT_MS_LANGID_TSWANA_SOUTH_AFRICA \ TT_MS_LANGID_SETSWANA_SOUTH_AFRICA #define TT_MS_LANGID_VENDA_SOUTH_AFRICA 0x0433 #define TT_MS_LANGID_XHOSA_SOUTH_AFRICA \ TT_MS_LANGID_ISIXHOSA_SOUTH_AFRICA #define TT_MS_LANGID_ZULU_SOUTH_AFRICA \ TT_MS_LANGID_ISIZULU_SOUTH_AFRICA #define TT_MS_LANGID_SAAMI_LAPONIA 0x043B /* the next two values are incorrectly inverted */ #define TT_MS_LANGID_IRISH_GAELIC_IRELAND 0x043C #define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM 0x083C #define TT_MS_LANGID_YIDDISH_GERMANY 0x043D #define TT_MS_LANGID_KAZAK_KAZAKSTAN \ TT_MS_LANGID_KAZAKH_KAZAKHSTAN #define TT_MS_LANGID_KIRGHIZ_KIRGHIZ_REPUBLIC \ TT_MS_LANGID_KYRGYZ_KYRGYZSTAN #define TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN \ TT_MS_LANGID_KYRGYZ_KYRGYZSTAN #define TT_MS_LANGID_SWAHILI_KENYA \ TT_MS_LANGID_KISWAHILI_KENYA #define TT_MS_LANGID_TATAR_TATARSTAN \ TT_MS_LANGID_TATAR_RUSSIA #define TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN 0x0846 #define TT_MS_LANGID_ORIYA_INDIA \ TT_MS_LANGID_ODIA_INDIA #define TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN \ TT_MS_LANGID_MONGOLIAN_PRC #define TT_MS_LANGID_TIBETAN_CHINA \ TT_MS_LANGID_TIBETAN_PRC #define TT_MS_LANGID_DZONGHKA_BHUTAN 0x0851 #define TT_MS_LANGID_TIBETAN_BHUTAN \ TT_MS_LANGID_DZONGHKA_BHUTAN #define TT_MS_LANGID_WELSH_WALES \ TT_MS_LANGID_WELSH_UNITED_KINGDOM #define TT_MS_LANGID_BURMESE_MYANMAR 0x0455 #define TT_MS_LANGID_GALICIAN_SPAIN \ TT_MS_LANGID_GALICIAN_GALICIAN #define TT_MS_LANGID_MANIPURI_INDIA /* Bengali */ 0x0458 #define TT_MS_LANGID_SINDHI_INDIA /* Arabic */ 0x0459 #define TT_MS_LANGID_SINDHI_PAKISTAN 0x0859 #define TT_MS_LANGID_SINHALESE_SRI_LANKA \ TT_MS_LANGID_SINHALA_SRI_LANKA #define TT_MS_LANGID_CHEROKEE_UNITED_STATES 0x045C #define TT_MS_LANGID_TAMAZIGHT_MOROCCO /* Arabic */ 0x045F #define TT_MS_LANGID_TAMAZIGHT_MOROCCO_LATIN \ TT_MS_LANGID_TAMAZIGHT_ALGERIA #define TT_MS_LANGID_KASHMIRI_PAKISTAN /* Arabic */ 0x0460 #define TT_MS_LANGID_KASHMIRI_SASIA 0x0860 #define TT_MS_LANGID_KASHMIRI_INDIA \ TT_MS_LANGID_KASHMIRI_SASIA #define TT_MS_LANGID_NEPALI_INDIA 0x0861 #define TT_MS_LANGID_DIVEHI_MALDIVES \ TT_MS_LANGID_DHIVEHI_MALDIVES #define TT_MS_LANGID_EDO_NIGERIA 0x0466 #define TT_MS_LANGID_FULFULDE_NIGERIA 0x0467 #define TT_MS_LANGID_IBIBIO_NIGERIA 0x0469 #define TT_MS_LANGID_SEPEDI_SOUTH_AFRICA \ TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA #define TT_MS_LANGID_SOTHO_SOUTHERN_SOUTH_AFRICA \ TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA #define TT_MS_LANGID_KANURI_NIGERIA 0x0471 #define TT_MS_LANGID_OROMO_ETHIOPIA 0x0472 #define TT_MS_LANGID_TIGRIGNA_ETHIOPIA 0x0473 #define TT_MS_LANGID_TIGRIGNA_ERYTHREA 0x0873 #define TT_MS_LANGID_TIGRIGNA_ERYTREA \ TT_MS_LANGID_TIGRIGNA_ERYTHREA #define TT_MS_LANGID_GUARANI_PARAGUAY 0x0474 #define TT_MS_LANGID_HAWAIIAN_UNITED_STATES 0x0475 #define TT_MS_LANGID_LATIN 0x0476 #define TT_MS_LANGID_SOMALI_SOMALIA 0x0477 #define TT_MS_LANGID_YI_CHINA \ TT_MS_LANGID_YI_PRC #define TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES 0x0479 #define TT_MS_LANGID_UIGHUR_CHINA \ TT_MS_LANGID_UIGHUR_PRC /*********************************************************************** * * @enum: * TT_NAME_ID_XXX * * @description: * Possible values of the `name' identifier field in the name records of * an SFNT `name' table. These values are platform independent. */ #define TT_NAME_ID_COPYRIGHT 0 #define TT_NAME_ID_FONT_FAMILY 1 #define TT_NAME_ID_FONT_SUBFAMILY 2 #define TT_NAME_ID_UNIQUE_ID 3 #define TT_NAME_ID_FULL_NAME 4 #define TT_NAME_ID_VERSION_STRING 5 #define TT_NAME_ID_PS_NAME 6 #define TT_NAME_ID_TRADEMARK 7 /* the following values are from the OpenType spec */ #define TT_NAME_ID_MANUFACTURER 8 #define TT_NAME_ID_DESIGNER 9 #define TT_NAME_ID_DESCRIPTION 10 #define TT_NAME_ID_VENDOR_URL 11 #define TT_NAME_ID_DESIGNER_URL 12 #define TT_NAME_ID_LICENSE 13 #define TT_NAME_ID_LICENSE_URL 14 /* number 15 is reserved */ #define TT_NAME_ID_TYPOGRAPHIC_FAMILY 16 #define TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY 17 #define TT_NAME_ID_MAC_FULL_NAME 18 /* The following code is new as of 2000-01-21 */ #define TT_NAME_ID_SAMPLE_TEXT 19 /* This is new in OpenType 1.3 */ #define TT_NAME_ID_CID_FINDFONT_NAME 20 /* This is new in OpenType 1.5 */ #define TT_NAME_ID_WWS_FAMILY 21 #define TT_NAME_ID_WWS_SUBFAMILY 22 /* This is new in OpenType 1.7 */ #define TT_NAME_ID_LIGHT_BACKGROUND 23 #define TT_NAME_ID_DARK_BACKGROUND 24 /* This is new in OpenType 1.8 */ #define TT_NAME_ID_VARIATIONS_PREFIX 25 /* these two values are deprecated */ #define TT_NAME_ID_PREFERRED_FAMILY TT_NAME_ID_TYPOGRAPHIC_FAMILY #define TT_NAME_ID_PREFERRED_SUBFAMILY TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY /*********************************************************************** * * @enum: * TT_UCR_XXX * * @description: * Possible bit mask values for the `ulUnicodeRangeX' fields in an SFNT * `OS/2' table. */ /* ulUnicodeRange1 */ /* --------------- */ /* Bit 0 Basic Latin */ #define TT_UCR_BASIC_LATIN (1L << 0) /* U+0020-U+007E */ /* Bit 1 C1 Controls and Latin-1 Supplement */ #define TT_UCR_LATIN1_SUPPLEMENT (1L << 1) /* U+0080-U+00FF */ /* Bit 2 Latin Extended-A */ #define TT_UCR_LATIN_EXTENDED_A (1L << 2) /* U+0100-U+017F */ /* Bit 3 Latin Extended-B */ #define TT_UCR_LATIN_EXTENDED_B (1L << 3) /* U+0180-U+024F */ /* Bit 4 IPA Extensions */ /* Phonetic Extensions */ /* Phonetic Extensions Supplement */ #define TT_UCR_IPA_EXTENSIONS (1L << 4) /* U+0250-U+02AF */ /* U+1D00-U+1D7F */ /* U+1D80-U+1DBF */ /* Bit 5 Spacing Modifier Letters */ /* Modifier Tone Letters */ #define TT_UCR_SPACING_MODIFIER (1L << 5) /* U+02B0-U+02FF */ /* U+A700-U+A71F */ /* Bit 6 Combining Diacritical Marks */ /* Combining Diacritical Marks Supplement */ #define TT_UCR_COMBINING_DIACRITICAL_MARKS (1L << 6) /* U+0300-U+036F */ /* U+1DC0-U+1DFF */ /* Bit 7 Greek and Coptic */ #define TT_UCR_GREEK (1L << 7) /* U+0370-U+03FF */ /* Bit 8 Coptic */ #define TT_UCR_COPTIC (1L << 8) /* U+2C80-U+2CFF */ /* Bit 9 Cyrillic */ /* Cyrillic Supplement */ /* Cyrillic Extended-A */ /* Cyrillic Extended-B */ #define TT_UCR_CYRILLIC (1L << 9) /* U+0400-U+04FF */ /* U+0500-U+052F */ /* U+2DE0-U+2DFF */ /* U+A640-U+A69F */ /* Bit 10 Armenian */ #define TT_UCR_ARMENIAN (1L << 10) /* U+0530-U+058F */ /* Bit 11 Hebrew */ #define TT_UCR_HEBREW (1L << 11) /* U+0590-U+05FF */ /* Bit 12 Vai */ #define TT_UCR_VAI (1L << 12) /* U+A500-U+A63F */ /* Bit 13 Arabic */ /* Arabic Supplement */ #define TT_UCR_ARABIC (1L << 13) /* U+0600-U+06FF */ /* U+0750-U+077F */ /* Bit 14 NKo */ #define TT_UCR_NKO (1L << 14) /* U+07C0-U+07FF */ /* Bit 15 Devanagari */ #define TT_UCR_DEVANAGARI (1L << 15) /* U+0900-U+097F */ /* Bit 16 Bengali */ #define TT_UCR_BENGALI (1L << 16) /* U+0980-U+09FF */ /* Bit 17 Gurmukhi */ #define TT_UCR_GURMUKHI (1L << 17) /* U+0A00-U+0A7F */ /* Bit 18 Gujarati */ #define TT_UCR_GUJARATI (1L << 18) /* U+0A80-U+0AFF */ /* Bit 19 Oriya */ #define TT_UCR_ORIYA (1L << 19) /* U+0B00-U+0B7F */ /* Bit 20 Tamil */ #define TT_UCR_TAMIL (1L << 20) /* U+0B80-U+0BFF */ /* Bit 21 Telugu */ #define TT_UCR_TELUGU (1L << 21) /* U+0C00-U+0C7F */ /* Bit 22 Kannada */ #define TT_UCR_KANNADA (1L << 22) /* U+0C80-U+0CFF */ /* Bit 23 Malayalam */ #define TT_UCR_MALAYALAM (1L << 23) /* U+0D00-U+0D7F */ /* Bit 24 Thai */ #define TT_UCR_THAI (1L << 24) /* U+0E00-U+0E7F */ /* Bit 25 Lao */ #define TT_UCR_LAO (1L << 25) /* U+0E80-U+0EFF */ /* Bit 26 Georgian */ /* Georgian Supplement */ #define TT_UCR_GEORGIAN (1L << 26) /* U+10A0-U+10FF */ /* U+2D00-U+2D2F */ /* Bit 27 Balinese */ #define TT_UCR_BALINESE (1L << 27) /* U+1B00-U+1B7F */ /* Bit 28 Hangul Jamo */ #define TT_UCR_HANGUL_JAMO (1L << 28) /* U+1100-U+11FF */ /* Bit 29 Latin Extended Additional */ /* Latin Extended-C */ /* Latin Extended-D */ #define TT_UCR_LATIN_EXTENDED_ADDITIONAL (1L << 29) /* U+1E00-U+1EFF */ /* U+2C60-U+2C7F */ /* U+A720-U+A7FF */ /* Bit 30 Greek Extended */ #define TT_UCR_GREEK_EXTENDED (1L << 30) /* U+1F00-U+1FFF */ /* Bit 31 General Punctuation */ /* Supplemental Punctuation */ #define TT_UCR_GENERAL_PUNCTUATION (1L << 31) /* U+2000-U+206F */ /* U+2E00-U+2E7F */ /* ulUnicodeRange2 */ /* --------------- */ /* Bit 32 Superscripts And Subscripts */ #define TT_UCR_SUPERSCRIPTS_SUBSCRIPTS (1L << 0) /* U+2070-U+209F */ /* Bit 33 Currency Symbols */ #define TT_UCR_CURRENCY_SYMBOLS (1L << 1) /* U+20A0-U+20CF */ /* Bit 34 Combining Diacritical Marks For Symbols */ #define TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB \ (1L << 2) /* U+20D0-U+20FF */ /* Bit 35 Letterlike Symbols */ #define TT_UCR_LETTERLIKE_SYMBOLS (1L << 3) /* U+2100-U+214F */ /* Bit 36 Number Forms */ #define TT_UCR_NUMBER_FORMS (1L << 4) /* U+2150-U+218F */ /* Bit 37 Arrows */ /* Supplemental Arrows-A */ /* Supplemental Arrows-B */ /* Miscellaneous Symbols and Arrows */ #define TT_UCR_ARROWS (1L << 5) /* U+2190-U+21FF */ /* U+27F0-U+27FF */ /* U+2900-U+297F */ /* U+2B00-U+2BFF */ /* Bit 38 Mathematical Operators */ /* Supplemental Mathematical Operators */ /* Miscellaneous Mathematical Symbols-A */ /* Miscellaneous Mathematical Symbols-B */ #define TT_UCR_MATHEMATICAL_OPERATORS (1L << 6) /* U+2200-U+22FF */ /* U+2A00-U+2AFF */ /* U+27C0-U+27EF */ /* U+2980-U+29FF */ /* Bit 39 Miscellaneous Technical */ #define TT_UCR_MISCELLANEOUS_TECHNICAL (1L << 7) /* U+2300-U+23FF */ /* Bit 40 Control Pictures */ #define TT_UCR_CONTROL_PICTURES (1L << 8) /* U+2400-U+243F */ /* Bit 41 Optical Character Recognition */ #define TT_UCR_OCR (1L << 9) /* U+2440-U+245F */ /* Bit 42 Enclosed Alphanumerics */ #define TT_UCR_ENCLOSED_ALPHANUMERICS (1L << 10) /* U+2460-U+24FF */ /* Bit 43 Box Drawing */ #define TT_UCR_BOX_DRAWING (1L << 11) /* U+2500-U+257F */ /* Bit 44 Block Elements */ #define TT_UCR_BLOCK_ELEMENTS (1L << 12) /* U+2580-U+259F */ /* Bit 45 Geometric Shapes */ #define TT_UCR_GEOMETRIC_SHAPES (1L << 13) /* U+25A0-U+25FF */ /* Bit 46 Miscellaneous Symbols */ #define TT_UCR_MISCELLANEOUS_SYMBOLS (1L << 14) /* U+2600-U+26FF */ /* Bit 47 Dingbats */ #define TT_UCR_DINGBATS (1L << 15) /* U+2700-U+27BF */ /* Bit 48 CJK Symbols and Punctuation */ #define TT_UCR_CJK_SYMBOLS (1L << 16) /* U+3000-U+303F */ /* Bit 49 Hiragana */ #define TT_UCR_HIRAGANA (1L << 17) /* U+3040-U+309F */ /* Bit 50 Katakana */ /* Katakana Phonetic Extensions */ #define TT_UCR_KATAKANA (1L << 18) /* U+30A0-U+30FF */ /* U+31F0-U+31FF */ /* Bit 51 Bopomofo */ /* Bopomofo Extended */ #define TT_UCR_BOPOMOFO (1L << 19) /* U+3100-U+312F */ /* U+31A0-U+31BF */ /* Bit 52 Hangul Compatibility Jamo */ #define TT_UCR_HANGUL_COMPATIBILITY_JAMO (1L << 20) /* U+3130-U+318F */ /* Bit 53 Phags-Pa */ #define TT_UCR_CJK_MISC (1L << 21) /* U+A840-U+A87F */ #define TT_UCR_KANBUN TT_UCR_CJK_MISC /* deprecated */ #define TT_UCR_PHAGSPA /* Bit 54 Enclosed CJK Letters and Months */ #define TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS (1L << 22) /* U+3200-U+32FF */ /* Bit 55 CJK Compatibility */ #define TT_UCR_CJK_COMPATIBILITY (1L << 23) /* U+3300-U+33FF */ /* Bit 56 Hangul Syllables */ #define TT_UCR_HANGUL (1L << 24) /* U+AC00-U+D7A3 */ /* Bit 57 High Surrogates */ /* High Private Use Surrogates */ /* Low Surrogates */ /* According to OpenType specs v.1.3+, */ /* setting bit 57 implies that there is */ /* at least one codepoint beyond the */ /* Basic Multilingual Plane that is */ /* supported by this font. So it really */ /* means >= U+10000. */ #define TT_UCR_SURROGATES (1L << 25) /* U+D800-U+DB7F */ /* U+DB80-U+DBFF */ /* U+DC00-U+DFFF */ #define TT_UCR_NON_PLANE_0 TT_UCR_SURROGATES /* Bit 58 Phoenician */ #define TT_UCR_PHOENICIAN (1L << 26) /*U+10900-U+1091F*/ /* Bit 59 CJK Unified Ideographs */ /* CJK Radicals Supplement */ /* Kangxi Radicals */ /* Ideographic Description Characters */ /* CJK Unified Ideographs Extension A */ /* CJK Unified Ideographs Extension B */ /* Kanbun */ #define TT_UCR_CJK_UNIFIED_IDEOGRAPHS (1L << 27) /* U+4E00-U+9FFF */ /* U+2E80-U+2EFF */ /* U+2F00-U+2FDF */ /* U+2FF0-U+2FFF */ /* U+3400-U+4DB5 */ /*U+20000-U+2A6DF*/ /* U+3190-U+319F */ /* Bit 60 Private Use */ #define TT_UCR_PRIVATE_USE (1L << 28) /* U+E000-U+F8FF */ /* Bit 61 CJK Strokes */ /* CJK Compatibility Ideographs */ /* CJK Compatibility Ideographs Supplement */ #define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS (1L << 29) /* U+31C0-U+31EF */ /* U+F900-U+FAFF */ /*U+2F800-U+2FA1F*/ /* Bit 62 Alphabetic Presentation Forms */ #define TT_UCR_ALPHABETIC_PRESENTATION_FORMS (1L << 30) /* U+FB00-U+FB4F */ /* Bit 63 Arabic Presentation Forms-A */ #define TT_UCR_ARABIC_PRESENTATION_FORMS_A (1L << 31) /* U+FB50-U+FDFF */ /* ulUnicodeRange3 */ /* --------------- */ /* Bit 64 Combining Half Marks */ #define TT_UCR_COMBINING_HALF_MARKS (1L << 0) /* U+FE20-U+FE2F */ /* Bit 65 Vertical forms */ /* CJK Compatibility Forms */ #define TT_UCR_CJK_COMPATIBILITY_FORMS (1L << 1) /* U+FE10-U+FE1F */ /* U+FE30-U+FE4F */ /* Bit 66 Small Form Variants */ #define TT_UCR_SMALL_FORM_VARIANTS (1L << 2) /* U+FE50-U+FE6F */ /* Bit 67 Arabic Presentation Forms-B */ #define TT_UCR_ARABIC_PRESENTATION_FORMS_B (1L << 3) /* U+FE70-U+FEFE */ /* Bit 68 Halfwidth and Fullwidth Forms */ #define TT_UCR_HALFWIDTH_FULLWIDTH_FORMS (1L << 4) /* U+FF00-U+FFEF */ /* Bit 69 Specials */ #define TT_UCR_SPECIALS (1L << 5) /* U+FFF0-U+FFFD */ /* Bit 70 Tibetan */ #define TT_UCR_TIBETAN (1L << 6) /* U+0F00-U+0FFF */ /* Bit 71 Syriac */ #define TT_UCR_SYRIAC (1L << 7) /* U+0700-U+074F */ /* Bit 72 Thaana */ #define TT_UCR_THAANA (1L << 8) /* U+0780-U+07BF */ /* Bit 73 Sinhala */ #define TT_UCR_SINHALA (1L << 9) /* U+0D80-U+0DFF */ /* Bit 74 Myanmar */ #define TT_UCR_MYANMAR (1L << 10) /* U+1000-U+109F */ /* Bit 75 Ethiopic */ /* Ethiopic Supplement */ /* Ethiopic Extended */ #define TT_UCR_ETHIOPIC (1L << 11) /* U+1200-U+137F */ /* U+1380-U+139F */ /* U+2D80-U+2DDF */ /* Bit 76 Cherokee */ #define TT_UCR_CHEROKEE (1L << 12) /* U+13A0-U+13FF */ /* Bit 77 Unified Canadian Aboriginal Syllabics */ #define TT_UCR_CANADIAN_ABORIGINAL_SYLLABICS (1L << 13) /* U+1400-U+167F */ /* Bit 78 Ogham */ #define TT_UCR_OGHAM (1L << 14) /* U+1680-U+169F */ /* Bit 79 Runic */ #define TT_UCR_RUNIC (1L << 15) /* U+16A0-U+16FF */ /* Bit 80 Khmer */ /* Khmer Symbols */ #define TT_UCR_KHMER (1L << 16) /* U+1780-U+17FF */ /* U+19E0-U+19FF */ /* Bit 81 Mongolian */ #define TT_UCR_MONGOLIAN (1L << 17) /* U+1800-U+18AF */ /* Bit 82 Braille Patterns */ #define TT_UCR_BRAILLE (1L << 18) /* U+2800-U+28FF */ /* Bit 83 Yi Syllables */ /* Yi Radicals */ #define TT_UCR_YI (1L << 19) /* U+A000-U+A48F */ /* U+A490-U+A4CF */ /* Bit 84 Tagalog */ /* Hanunoo */ /* Buhid */ /* Tagbanwa */ #define TT_UCR_PHILIPPINE (1L << 20) /* U+1700-U+171F */ /* U+1720-U+173F */ /* U+1740-U+175F */ /* U+1760-U+177F */ /* Bit 85 Old Italic */ #define TT_UCR_OLD_ITALIC (1L << 21) /*U+10300-U+1032F*/ /* Bit 86 Gothic */ #define TT_UCR_GOTHIC (1L << 22) /*U+10330-U+1034F*/ /* Bit 87 Deseret */ #define TT_UCR_DESERET (1L << 23) /*U+10400-U+1044F*/ /* Bit 88 Byzantine Musical Symbols */ /* Musical Symbols */ /* Ancient Greek Musical Notation */ #define TT_UCR_MUSICAL_SYMBOLS (1L << 24) /*U+1D000-U+1D0FF*/ /*U+1D100-U+1D1FF*/ /*U+1D200-U+1D24F*/ /* Bit 89 Mathematical Alphanumeric Symbols */ #define TT_UCR_MATH_ALPHANUMERIC_SYMBOLS (1L << 25) /*U+1D400-U+1D7FF*/ /* Bit 90 Private Use (plane 15) */ /* Private Use (plane 16) */ #define TT_UCR_PRIVATE_USE_SUPPLEMENTARY (1L << 26) /*U+F0000-U+FFFFD*/ /*U+100000-U+10FFFD*/ /* Bit 91 Variation Selectors */ /* Variation Selectors Supplement */ #define TT_UCR_VARIATION_SELECTORS (1L << 27) /* U+FE00-U+FE0F */ /*U+E0100-U+E01EF*/ /* Bit 92 Tags */ #define TT_UCR_TAGS (1L << 28) /*U+E0000-U+E007F*/ /* Bit 93 Limbu */ #define TT_UCR_LIMBU (1L << 29) /* U+1900-U+194F */ /* Bit 94 Tai Le */ #define TT_UCR_TAI_LE (1L << 30) /* U+1950-U+197F */ /* Bit 95 New Tai Lue */ #define TT_UCR_NEW_TAI_LUE (1L << 31) /* U+1980-U+19DF */ /* ulUnicodeRange4 */ /* --------------- */ /* Bit 96 Buginese */ #define TT_UCR_BUGINESE (1L << 0) /* U+1A00-U+1A1F */ /* Bit 97 Glagolitic */ #define TT_UCR_GLAGOLITIC (1L << 1) /* U+2C00-U+2C5F */ /* Bit 98 Tifinagh */ #define TT_UCR_TIFINAGH (1L << 2) /* U+2D30-U+2D7F */ /* Bit 99 Yijing Hexagram Symbols */ #define TT_UCR_YIJING (1L << 3) /* U+4DC0-U+4DFF */ /* Bit 100 Syloti Nagri */ #define TT_UCR_SYLOTI_NAGRI (1L << 4) /* U+A800-U+A82F */ /* Bit 101 Linear B Syllabary */ /* Linear B Ideograms */ /* Aegean Numbers */ #define TT_UCR_LINEAR_B (1L << 5) /*U+10000-U+1007F*/ /*U+10080-U+100FF*/ /*U+10100-U+1013F*/ /* Bit 102 Ancient Greek Numbers */ #define TT_UCR_ANCIENT_GREEK_NUMBERS (1L << 6) /*U+10140-U+1018F*/ /* Bit 103 Ugaritic */ #define TT_UCR_UGARITIC (1L << 7) /*U+10380-U+1039F*/ /* Bit 104 Old Persian */ #define TT_UCR_OLD_PERSIAN (1L << 8) /*U+103A0-U+103DF*/ /* Bit 105 Shavian */ #define TT_UCR_SHAVIAN (1L << 9) /*U+10450-U+1047F*/ /* Bit 106 Osmanya */ #define TT_UCR_OSMANYA (1L << 10) /*U+10480-U+104AF*/ /* Bit 107 Cypriot Syllabary */ #define TT_UCR_CYPRIOT_SYLLABARY (1L << 11) /*U+10800-U+1083F*/ /* Bit 108 Kharoshthi */ #define TT_UCR_KHAROSHTHI (1L << 12) /*U+10A00-U+10A5F*/ /* Bit 109 Tai Xuan Jing Symbols */ #define TT_UCR_TAI_XUAN_JING (1L << 13) /*U+1D300-U+1D35F*/ /* Bit 110 Cuneiform */ /* Cuneiform Numbers and Punctuation */ #define TT_UCR_CUNEIFORM (1L << 14) /*U+12000-U+123FF*/ /*U+12400-U+1247F*/ /* Bit 111 Counting Rod Numerals */ #define TT_UCR_COUNTING_ROD_NUMERALS (1L << 15) /*U+1D360-U+1D37F*/ /* Bit 112 Sundanese */ #define TT_UCR_SUNDANESE (1L << 16) /* U+1B80-U+1BBF */ /* Bit 113 Lepcha */ #define TT_UCR_LEPCHA (1L << 17) /* U+1C00-U+1C4F */ /* Bit 114 Ol Chiki */ #define TT_UCR_OL_CHIKI (1L << 18) /* U+1C50-U+1C7F */ /* Bit 115 Saurashtra */ #define TT_UCR_SAURASHTRA (1L << 19) /* U+A880-U+A8DF */ /* Bit 116 Kayah Li */ #define TT_UCR_KAYAH_LI (1L << 20) /* U+A900-U+A92F */ /* Bit 117 Rejang */ #define TT_UCR_REJANG (1L << 21) /* U+A930-U+A95F */ /* Bit 118 Cham */ #define TT_UCR_CHAM (1L << 22) /* U+AA00-U+AA5F */ /* Bit 119 Ancient Symbols */ #define TT_UCR_ANCIENT_SYMBOLS (1L << 23) /*U+10190-U+101CF*/ /* Bit 120 Phaistos Disc */ #define TT_UCR_PHAISTOS_DISC (1L << 24) /*U+101D0-U+101FF*/ /* Bit 121 Carian */ /* Lycian */ /* Lydian */ #define TT_UCR_OLD_ANATOLIAN (1L << 25) /*U+102A0-U+102DF*/ /*U+10280-U+1029F*/ /*U+10920-U+1093F*/ /* Bit 122 Domino Tiles */ /* Mahjong Tiles */ #define TT_UCR_GAME_TILES (1L << 26) /*U+1F030-U+1F09F*/ /*U+1F000-U+1F02F*/ /* Bit 123-127 Reserved for process-internal usage */ /* */ /* for backward compatibility with older FreeType versions */ #define TT_UCR_ARABIC_PRESENTATIONS_A \ TT_UCR_ARABIC_PRESENTATION_FORMS_A #define TT_UCR_ARABIC_PRESENTATIONS_B \ TT_UCR_ARABIC_PRESENTATION_FORMS_B #define TT_UCR_COMBINING_DIACRITICS \ TT_UCR_COMBINING_DIACRITICAL_MARKS #define TT_UCR_COMBINING_DIACRITICS_SYMB \ TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB FT_END_HEADER #endif /* TTNAMEID_H_ */ /* END */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/fttypes.h������������������������������������������������������������������������0000644�����������������00000105541�14763166026�0012164 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* fttypes.h */ /* */ /* FreeType simple types definitions (specification only). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTTYPES_H_ #define FTTYPES_H_ #include <ft2build.h> #include FT_CONFIG_CONFIG_H #include FT_SYSTEM_H #include FT_IMAGE_H #include <stddef.h> FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* basic_types */ /* */ /* <Title> */ /* Basic Data Types */ /* */ /* <Abstract> */ /* The basic data types defined by the library. */ /* */ /* <Description> */ /* This section contains the basic data types defined by FreeType~2, */ /* ranging from simple scalar types to bitmap descriptors. More */ /* font-specific structures are defined in a different section. */ /* */ /* <Order> */ /* FT_Byte */ /* FT_Bytes */ /* FT_Char */ /* FT_Int */ /* FT_UInt */ /* FT_Int16 */ /* FT_UInt16 */ /* FT_Int32 */ /* FT_UInt32 */ /* FT_Int64 */ /* FT_UInt64 */ /* FT_Short */ /* FT_UShort */ /* FT_Long */ /* FT_ULong */ /* FT_Bool */ /* FT_Offset */ /* FT_PtrDist */ /* FT_String */ /* FT_Tag */ /* FT_Error */ /* FT_Fixed */ /* FT_Pointer */ /* FT_Pos */ /* FT_Vector */ /* FT_BBox */ /* FT_Matrix */ /* FT_FWord */ /* FT_UFWord */ /* FT_F2Dot14 */ /* FT_UnitVector */ /* FT_F26Dot6 */ /* FT_Data */ /* */ /* FT_MAKE_TAG */ /* */ /* FT_Generic */ /* FT_Generic_Finalizer */ /* */ /* FT_Bitmap */ /* FT_Pixel_Mode */ /* FT_Palette_Mode */ /* FT_Glyph_Format */ /* FT_IMAGE_TAG */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Type> */ /* FT_Bool */ /* */ /* <Description> */ /* A typedef of unsigned char, used for simple booleans. As usual, */ /* values 1 and~0 represent true and false, respectively. */ /* */ typedef unsigned char FT_Bool; /*************************************************************************/ /* */ /* <Type> */ /* FT_FWord */ /* */ /* <Description> */ /* A signed 16-bit integer used to store a distance in original font */ /* units. */ /* */ typedef signed short FT_FWord; /* distance in FUnits */ /*************************************************************************/ /* */ /* <Type> */ /* FT_UFWord */ /* */ /* <Description> */ /* An unsigned 16-bit integer used to store a distance in original */ /* font units. */ /* */ typedef unsigned short FT_UFWord; /* unsigned distance */ /*************************************************************************/ /* */ /* <Type> */ /* FT_Char */ /* */ /* <Description> */ /* A simple typedef for the _signed_ char type. */ /* */ typedef signed char FT_Char; /*************************************************************************/ /* */ /* <Type> */ /* FT_Byte */ /* */ /* <Description> */ /* A simple typedef for the _unsigned_ char type. */ /* */ typedef unsigned char FT_Byte; /*************************************************************************/ /* */ /* <Type> */ /* FT_Bytes */ /* */ /* <Description> */ /* A typedef for constant memory areas. */ /* */ typedef const FT_Byte* FT_Bytes; /*************************************************************************/ /* */ /* <Type> */ /* FT_Tag */ /* */ /* <Description> */ /* A typedef for 32-bit tags (as used in the SFNT format). */ /* */ typedef FT_UInt32 FT_Tag; /*************************************************************************/ /* */ /* <Type> */ /* FT_String */ /* */ /* <Description> */ /* A simple typedef for the char type, usually used for strings. */ /* */ typedef char FT_String; /*************************************************************************/ /* */ /* <Type> */ /* FT_Short */ /* */ /* <Description> */ /* A typedef for signed short. */ /* */ typedef signed short FT_Short; /*************************************************************************/ /* */ /* <Type> */ /* FT_UShort */ /* */ /* <Description> */ /* A typedef for unsigned short. */ /* */ typedef unsigned short FT_UShort; /*************************************************************************/ /* */ /* <Type> */ /* FT_Int */ /* */ /* <Description> */ /* A typedef for the int type. */ /* */ typedef signed int FT_Int; /*************************************************************************/ /* */ /* <Type> */ /* FT_UInt */ /* */ /* <Description> */ /* A typedef for the unsigned int type. */ /* */ typedef unsigned int FT_UInt; /*************************************************************************/ /* */ /* <Type> */ /* FT_Long */ /* */ /* <Description> */ /* A typedef for signed long. */ /* */ typedef signed long FT_Long; /*************************************************************************/ /* */ /* <Type> */ /* FT_ULong */ /* */ /* <Description> */ /* A typedef for unsigned long. */ /* */ typedef unsigned long FT_ULong; /*************************************************************************/ /* */ /* <Type> */ /* FT_F2Dot14 */ /* */ /* <Description> */ /* A signed 2.14 fixed-point type used for unit vectors. */ /* */ typedef signed short FT_F2Dot14; /*************************************************************************/ /* */ /* <Type> */ /* FT_F26Dot6 */ /* */ /* <Description> */ /* A signed 26.6 fixed-point type used for vectorial pixel */ /* coordinates. */ /* */ typedef signed long FT_F26Dot6; /*************************************************************************/ /* */ /* <Type> */ /* FT_Fixed */ /* */ /* <Description> */ /* This type is used to store 16.16 fixed-point values, like scaling */ /* values or matrix coefficients. */ /* */ typedef signed long FT_Fixed; /*************************************************************************/ /* */ /* <Type> */ /* FT_Error */ /* */ /* <Description> */ /* The FreeType error code type. A value of~0 is always interpreted */ /* as a successful operation. */ /* */ typedef int FT_Error; /*************************************************************************/ /* */ /* <Type> */ /* FT_Pointer */ /* */ /* <Description> */ /* A simple typedef for a typeless pointer. */ /* */ typedef void* FT_Pointer; /*************************************************************************/ /* */ /* <Type> */ /* FT_Offset */ /* */ /* <Description> */ /* This is equivalent to the ANSI~C `size_t' type, i.e., the largest */ /* _unsigned_ integer type used to express a file size or position, */ /* or a memory block size. */ /* */ typedef size_t FT_Offset; /*************************************************************************/ /* */ /* <Type> */ /* FT_PtrDist */ /* */ /* <Description> */ /* This is equivalent to the ANSI~C `ptrdiff_t' type, i.e., the */ /* largest _signed_ integer type used to express the distance */ /* between two pointers. */ /* */ typedef ft_ptrdiff_t FT_PtrDist; /*************************************************************************/ /* */ /* <Struct> */ /* FT_UnitVector */ /* */ /* <Description> */ /* A simple structure used to store a 2D vector unit vector. Uses */ /* FT_F2Dot14 types. */ /* */ /* <Fields> */ /* x :: Horizontal coordinate. */ /* */ /* y :: Vertical coordinate. */ /* */ typedef struct FT_UnitVector_ { FT_F2Dot14 x; FT_F2Dot14 y; } FT_UnitVector; /*************************************************************************/ /* */ /* <Struct> */ /* FT_Matrix */ /* */ /* <Description> */ /* A simple structure used to store a 2x2 matrix. Coefficients are */ /* in 16.16 fixed-point format. The computation performed is: */ /* */ /* { */ /* x' = x*xx + y*xy */ /* y' = x*yx + y*yy */ /* } */ /* */ /* <Fields> */ /* xx :: Matrix coefficient. */ /* */ /* xy :: Matrix coefficient. */ /* */ /* yx :: Matrix coefficient. */ /* */ /* yy :: Matrix coefficient. */ /* */ typedef struct FT_Matrix_ { FT_Fixed xx, xy; FT_Fixed yx, yy; } FT_Matrix; /*************************************************************************/ /* */ /* <Struct> */ /* FT_Data */ /* */ /* <Description> */ /* Read-only binary data represented as a pointer and a length. */ /* */ /* <Fields> */ /* pointer :: The data. */ /* */ /* length :: The length of the data in bytes. */ /* */ typedef struct FT_Data_ { const FT_Byte* pointer; FT_Int length; } FT_Data; /*************************************************************************/ /* */ /* <FuncType> */ /* FT_Generic_Finalizer */ /* */ /* <Description> */ /* Describe a function used to destroy the `client' data of any */ /* FreeType object. See the description of the @FT_Generic type for */ /* details of usage. */ /* */ /* <Input> */ /* The address of the FreeType object that is under finalization. */ /* Its client data is accessed through its `generic' field. */ /* */ typedef void (*FT_Generic_Finalizer)(void* object); /*************************************************************************/ /* */ /* <Struct> */ /* FT_Generic */ /* */ /* <Description> */ /* Client applications often need to associate their own data to a */ /* variety of FreeType core objects. For example, a text layout API */ /* might want to associate a glyph cache to a given size object. */ /* */ /* Some FreeType object contains a `generic' field, of type */ /* FT_Generic, which usage is left to client applications and font */ /* servers. */ /* */ /* It can be used to store a pointer to client-specific data, as well */ /* as the address of a `finalizer' function, which will be called by */ /* FreeType when the object is destroyed (for example, the previous */ /* client example would put the address of the glyph cache destructor */ /* in the `finalizer' field). */ /* */ /* <Fields> */ /* data :: A typeless pointer to any client-specified data. This */ /* field is completely ignored by the FreeType library. */ /* */ /* finalizer :: A pointer to a `generic finalizer' function, which */ /* will be called when the object is destroyed. If this */ /* field is set to NULL, no code will be called. */ /* */ typedef struct FT_Generic_ { void* data; FT_Generic_Finalizer finalizer; } FT_Generic; /*************************************************************************/ /* */ /* <Macro> */ /* FT_MAKE_TAG */ /* */ /* <Description> */ /* This macro converts four-letter tags that are used to label */ /* TrueType tables into an unsigned long, to be used within FreeType. */ /* */ /* <Note> */ /* The produced values *must* be 32-bit integers. Don't redefine */ /* this macro. */ /* */ #define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \ (FT_Tag) \ ( ( (FT_ULong)_x1 << 24 ) | \ ( (FT_ULong)_x2 << 16 ) | \ ( (FT_ULong)_x3 << 8 ) | \ (FT_ULong)_x4 ) /*************************************************************************/ /*************************************************************************/ /* */ /* L I S T M A N A G E M E N T */ /* */ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* <Section> */ /* list_processing */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Type> */ /* FT_ListNode */ /* */ /* <Description> */ /* Many elements and objects in FreeType are listed through an */ /* @FT_List record (see @FT_ListRec). As its name suggests, an */ /* FT_ListNode is a handle to a single list element. */ /* */ typedef struct FT_ListNodeRec_* FT_ListNode; /*************************************************************************/ /* */ /* <Type> */ /* FT_List */ /* */ /* <Description> */ /* A handle to a list record (see @FT_ListRec). */ /* */ typedef struct FT_ListRec_* FT_List; /*************************************************************************/ /* */ /* <Struct> */ /* FT_ListNodeRec */ /* */ /* <Description> */ /* A structure used to hold a single list element. */ /* */ /* <Fields> */ /* prev :: The previous element in the list. NULL if first. */ /* */ /* next :: The next element in the list. NULL if last. */ /* */ /* data :: A typeless pointer to the listed object. */ /* */ typedef struct FT_ListNodeRec_ { FT_ListNode prev; FT_ListNode next; void* data; } FT_ListNodeRec; /*************************************************************************/ /* */ /* <Struct> */ /* FT_ListRec */ /* */ /* <Description> */ /* A structure used to hold a simple doubly-linked list. These are */ /* used in many parts of FreeType. */ /* */ /* <Fields> */ /* head :: The head (first element) of doubly-linked list. */ /* */ /* tail :: The tail (last element) of doubly-linked list. */ /* */ typedef struct FT_ListRec_ { FT_ListNode head; FT_ListNode tail; } FT_ListRec; /* */ #define FT_IS_EMPTY( list ) ( (list).head == 0 ) #define FT_BOOL( x ) ( (FT_Bool)( x ) ) /* concatenate C tokens */ #define FT_ERR_XCAT( x, y ) x ## y #define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y ) /* see `ftmoderr.h' for descriptions of the following macros */ #define FT_ERR( e ) FT_ERR_CAT( FT_ERR_PREFIX, e ) #define FT_ERROR_BASE( x ) ( (x) & 0xFF ) #define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U ) #define FT_ERR_EQ( x, e ) \ ( FT_ERROR_BASE( x ) == FT_ERROR_BASE( FT_ERR( e ) ) ) #define FT_ERR_NEQ( x, e ) \ ( FT_ERROR_BASE( x ) != FT_ERROR_BASE( FT_ERR( e ) ) ) FT_END_HEADER #endif /* FTTYPES_H_ */ /* END */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftcache.h������������������������������������������������������������������������0000644�����������������00000164152�14763166026�0012066 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftcache.h */ /* */ /* FreeType Cache subsystem (specification). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTCACHE_H_ #define FTCACHE_H_ #include <ft2build.h> #include FT_GLYPH_H FT_BEGIN_HEADER /************************************************************************* * * <Section> * cache_subsystem * * <Title> * Cache Sub-System * * <Abstract> * How to cache face, size, and glyph data with FreeType~2. * * <Description> * This section describes the FreeType~2 cache sub-system, which is used * to limit the number of concurrently opened @FT_Face and @FT_Size * objects, as well as caching information like character maps and glyph * images while limiting their maximum memory usage. * * Note that all types and functions begin with the `FTC_' prefix. * * The cache is highly portable and thus doesn't know anything about the * fonts installed on your system, or how to access them. This implies * the following scheme: * * First, available or installed font faces are uniquely identified by * @FTC_FaceID values, provided to the cache by the client. Note that * the cache only stores and compares these values, and doesn't try to * interpret them in any way. * * Second, the cache calls, only when needed, a client-provided function * to convert an @FTC_FaceID into a new @FT_Face object. The latter is * then completely managed by the cache, including its termination * through @FT_Done_Face. To monitor termination of face objects, the * finalizer callback in the `generic' field of the @FT_Face object can * be used, which might also be used to store the @FTC_FaceID of the * face. * * Clients are free to map face IDs to anything else. The most simple * usage is to associate them to a (pathname,face_index) pair that is * used to call @FT_New_Face. However, more complex schemes are also * possible. * * Note that for the cache to work correctly, the face ID values must be * *persistent*, which means that the contents they point to should not * change at runtime, or that their value should not become invalid. * * If this is unavoidable (e.g., when a font is uninstalled at runtime), * you should call @FTC_Manager_RemoveFaceID as soon as possible, to let * the cache get rid of any references to the old @FTC_FaceID it may * keep internally. Failure to do so will lead to incorrect behaviour * or even crashes. * * To use the cache, start with calling @FTC_Manager_New to create a new * @FTC_Manager object, which models a single cache instance. You can * then look up @FT_Face and @FT_Size objects with * @FTC_Manager_LookupFace and @FTC_Manager_LookupSize, respectively. * * If you want to use the charmap caching, call @FTC_CMapCache_New, then * later use @FTC_CMapCache_Lookup to perform the equivalent of * @FT_Get_Char_Index, only much faster. * * If you want to use the @FT_Glyph caching, call @FTC_ImageCache, then * later use @FTC_ImageCache_Lookup to retrieve the corresponding * @FT_Glyph objects from the cache. * * If you need lots of small bitmaps, it is much more memory efficient * to call @FTC_SBitCache_New followed by @FTC_SBitCache_Lookup. This * returns @FTC_SBitRec structures, which are used to store small * bitmaps directly. (A small bitmap is one whose metrics and * dimensions all fit into 8-bit integers). * * We hope to also provide a kerning cache in the near future. * * * <Order> * FTC_Manager * FTC_FaceID * FTC_Face_Requester * * FTC_Manager_New * FTC_Manager_Reset * FTC_Manager_Done * FTC_Manager_LookupFace * FTC_Manager_LookupSize * FTC_Manager_RemoveFaceID * * FTC_Node * FTC_Node_Unref * * FTC_ImageCache * FTC_ImageCache_New * FTC_ImageCache_Lookup * * FTC_SBit * FTC_SBitCache * FTC_SBitCache_New * FTC_SBitCache_Lookup * * FTC_CMapCache * FTC_CMapCache_New * FTC_CMapCache_Lookup * *************************************************************************/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** BASIC TYPE DEFINITIONS *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /************************************************************************* * * @type: FTC_FaceID * * @description: * An opaque pointer type that is used to identity face objects. The * contents of such objects is application-dependent. * * These pointers are typically used to point to a user-defined * structure containing a font file path, and face index. * * @note: * Never use NULL as a valid @FTC_FaceID. * * Face IDs are passed by the client to the cache manager that calls, * when needed, the @FTC_Face_Requester to translate them into new * @FT_Face objects. * * If the content of a given face ID changes at runtime, or if the value * becomes invalid (e.g., when uninstalling a font), you should * immediately call @FTC_Manager_RemoveFaceID before any other cache * function. * * Failure to do so will result in incorrect behaviour or even * memory leaks and crashes. */ typedef FT_Pointer FTC_FaceID; /************************************************************************ * * @functype: * FTC_Face_Requester * * @description: * A callback function provided by client applications. It is used by * the cache manager to translate a given @FTC_FaceID into a new valid * @FT_Face object, on demand. * * <Input> * face_id :: * The face ID to resolve. * * library :: * A handle to a FreeType library object. * * req_data :: * Application-provided request data (see note below). * * <Output> * aface :: * A new @FT_Face handle. * * <Return> * FreeType error code. 0~means success. * * <Note> * The third parameter `req_data' is the same as the one passed by the * client when @FTC_Manager_New is called. * * The face requester should not perform funny things on the returned * face object, like creating a new @FT_Size for it, or setting a * transformation through @FT_Set_Transform! */ typedef FT_Error (*FTC_Face_Requester)( FTC_FaceID face_id, FT_Library library, FT_Pointer req_data, FT_Face* aface ); /* */ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** CACHE MANAGER OBJECT *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* <Type> */ /* FTC_Manager */ /* */ /* <Description> */ /* This object corresponds to one instance of the cache-subsystem. */ /* It is used to cache one or more @FT_Face objects, along with */ /* corresponding @FT_Size objects. */ /* */ /* The manager intentionally limits the total number of opened */ /* @FT_Face and @FT_Size objects to control memory usage. See the */ /* `max_faces' and `max_sizes' parameters of @FTC_Manager_New. */ /* */ /* The manager is also used to cache `nodes' of various types while */ /* limiting their total memory usage. */ /* */ /* All limitations are enforced by keeping lists of managed objects */ /* in most-recently-used order, and flushing old nodes to make room */ /* for new ones. */ /* */ typedef struct FTC_ManagerRec_* FTC_Manager; /*************************************************************************/ /* */ /* <Type> */ /* FTC_Node */ /* */ /* <Description> */ /* An opaque handle to a cache node object. Each cache node is */ /* reference-counted. A node with a count of~0 might be flushed */ /* out of a full cache whenever a lookup request is performed. */ /* */ /* If you look up nodes, you have the ability to `acquire' them, */ /* i.e., to increment their reference count. This will prevent the */ /* node from being flushed out of the cache until you explicitly */ /* `release' it (see @FTC_Node_Unref). */ /* */ /* See also @FTC_SBitCache_Lookup and @FTC_ImageCache_Lookup. */ /* */ typedef struct FTC_NodeRec_* FTC_Node; /*************************************************************************/ /* */ /* <Function> */ /* FTC_Manager_New */ /* */ /* <Description> */ /* Create a new cache manager. */ /* */ /* <Input> */ /* library :: The parent FreeType library handle to use. */ /* */ /* max_faces :: Maximum number of opened @FT_Face objects managed by */ /* this cache instance. Use~0 for defaults. */ /* */ /* max_sizes :: Maximum number of opened @FT_Size objects managed by */ /* this cache instance. Use~0 for defaults. */ /* */ /* max_bytes :: Maximum number of bytes to use for cached data nodes. */ /* Use~0 for defaults. Note that this value does not */ /* account for managed @FT_Face and @FT_Size objects. */ /* */ /* requester :: An application-provided callback used to translate */ /* face IDs into real @FT_Face objects. */ /* */ /* req_data :: A generic pointer that is passed to the requester */ /* each time it is called (see @FTC_Face_Requester). */ /* */ /* <Output> */ /* amanager :: A handle to a new manager object. 0~in case of */ /* failure. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FTC_Manager_New( FT_Library library, FT_UInt max_faces, FT_UInt max_sizes, FT_ULong max_bytes, FTC_Face_Requester requester, FT_Pointer req_data, FTC_Manager *amanager ); /*************************************************************************/ /* */ /* <Function> */ /* FTC_Manager_Reset */ /* */ /* <Description> */ /* Empty a given cache manager. This simply gets rid of all the */ /* currently cached @FT_Face and @FT_Size objects within the manager. */ /* */ /* <InOut> */ /* manager :: A handle to the manager. */ /* */ FT_EXPORT( void ) FTC_Manager_Reset( FTC_Manager manager ); /*************************************************************************/ /* */ /* <Function> */ /* FTC_Manager_Done */ /* */ /* <Description> */ /* Destroy a given manager after emptying it. */ /* */ /* <Input> */ /* manager :: A handle to the target cache manager object. */ /* */ FT_EXPORT( void ) FTC_Manager_Done( FTC_Manager manager ); /*************************************************************************/ /* */ /* <Function> */ /* FTC_Manager_LookupFace */ /* */ /* <Description> */ /* Retrieve the @FT_Face object that corresponds to a given face ID */ /* through a cache manager. */ /* */ /* <Input> */ /* manager :: A handle to the cache manager. */ /* */ /* face_id :: The ID of the face object. */ /* */ /* <Output> */ /* aface :: A handle to the face object. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* The returned @FT_Face object is always owned by the manager. You */ /* should never try to discard it yourself. */ /* */ /* The @FT_Face object doesn't necessarily have a current size object */ /* (i.e., face->size can be~0). If you need a specific `font size', */ /* use @FTC_Manager_LookupSize instead. */ /* */ /* Never change the face's transformation matrix (i.e., never call */ /* the @FT_Set_Transform function) on a returned face! If you need */ /* to transform glyphs, do it yourself after glyph loading. */ /* */ /* When you perform a lookup, out-of-memory errors are detected */ /* _within_ the lookup and force incremental flushes of the cache */ /* until enough memory is released for the lookup to succeed. */ /* */ /* If a lookup fails with `FT_Err_Out_Of_Memory' the cache has */ /* already been completely flushed, and still no memory was available */ /* for the operation. */ /* */ FT_EXPORT( FT_Error ) FTC_Manager_LookupFace( FTC_Manager manager, FTC_FaceID face_id, FT_Face *aface ); /*************************************************************************/ /* */ /* <Struct> */ /* FTC_ScalerRec */ /* */ /* <Description> */ /* A structure used to describe a given character size in either */ /* pixels or points to the cache manager. See */ /* @FTC_Manager_LookupSize. */ /* */ /* <Fields> */ /* face_id :: The source face ID. */ /* */ /* width :: The character width. */ /* */ /* height :: The character height. */ /* */ /* pixel :: A Boolean. If 1, the `width' and `height' fields are */ /* interpreted as integer pixel character sizes. */ /* Otherwise, they are expressed as 1/64th of points. */ /* */ /* x_res :: Only used when `pixel' is value~0 to indicate the */ /* horizontal resolution in dpi. */ /* */ /* y_res :: Only used when `pixel' is value~0 to indicate the */ /* vertical resolution in dpi. */ /* */ /* <Note> */ /* This type is mainly used to retrieve @FT_Size objects through the */ /* cache manager. */ /* */ typedef struct FTC_ScalerRec_ { FTC_FaceID face_id; FT_UInt width; FT_UInt height; FT_Int pixel; FT_UInt x_res; FT_UInt y_res; } FTC_ScalerRec; /*************************************************************************/ /* */ /* <Struct> */ /* FTC_Scaler */ /* */ /* <Description> */ /* A handle to an @FTC_ScalerRec structure. */ /* */ typedef struct FTC_ScalerRec_* FTC_Scaler; /*************************************************************************/ /* */ /* <Function> */ /* FTC_Manager_LookupSize */ /* */ /* <Description> */ /* Retrieve the @FT_Size object that corresponds to a given */ /* @FTC_ScalerRec pointer through a cache manager. */ /* */ /* <Input> */ /* manager :: A handle to the cache manager. */ /* */ /* scaler :: A scaler handle. */ /* */ /* <Output> */ /* asize :: A handle to the size object. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* The returned @FT_Size object is always owned by the manager. You */ /* should never try to discard it by yourself. */ /* */ /* You can access the parent @FT_Face object simply as `size->face' */ /* if you need it. Note that this object is also owned by the */ /* manager. */ /* */ /* <Note> */ /* When you perform a lookup, out-of-memory errors are detected */ /* _within_ the lookup and force incremental flushes of the cache */ /* until enough memory is released for the lookup to succeed. */ /* */ /* If a lookup fails with `FT_Err_Out_Of_Memory' the cache has */ /* already been completely flushed, and still no memory is available */ /* for the operation. */ /* */ FT_EXPORT( FT_Error ) FTC_Manager_LookupSize( FTC_Manager manager, FTC_Scaler scaler, FT_Size *asize ); /*************************************************************************/ /* */ /* <Function> */ /* FTC_Node_Unref */ /* */ /* <Description> */ /* Decrement a cache node's internal reference count. When the count */ /* reaches 0, it is not destroyed but becomes eligible for subsequent */ /* cache flushes. */ /* */ /* <Input> */ /* node :: The cache node handle. */ /* */ /* manager :: The cache manager handle. */ /* */ FT_EXPORT( void ) FTC_Node_Unref( FTC_Node node, FTC_Manager manager ); /************************************************************************* * * @function: * FTC_Manager_RemoveFaceID * * @description: * A special function used to indicate to the cache manager that * a given @FTC_FaceID is no longer valid, either because its * content changed, or because it was deallocated or uninstalled. * * @input: * manager :: * The cache manager handle. * * face_id :: * The @FTC_FaceID to be removed. * * @note: * This function flushes all nodes from the cache corresponding to this * `face_id', with the exception of nodes with a non-null reference * count. * * Such nodes are however modified internally so as to never appear * in later lookups with the same `face_id' value, and to be immediately * destroyed when released by all their users. * */ FT_EXPORT( void ) FTC_Manager_RemoveFaceID( FTC_Manager manager, FTC_FaceID face_id ); /*************************************************************************/ /* */ /* <Section> */ /* cache_subsystem */ /* */ /*************************************************************************/ /************************************************************************* * * @type: * FTC_CMapCache * * @description: * An opaque handle used to model a charmap cache. This cache is to * hold character codes -> glyph indices mappings. * */ typedef struct FTC_CMapCacheRec_* FTC_CMapCache; /************************************************************************* * * @function: * FTC_CMapCache_New * * @description: * Create a new charmap cache. * * @input: * manager :: * A handle to the cache manager. * * @output: * acache :: * A new cache handle. NULL in case of error. * * @return: * FreeType error code. 0~means success. * * @note: * Like all other caches, this one will be destroyed with the cache * manager. * */ FT_EXPORT( FT_Error ) FTC_CMapCache_New( FTC_Manager manager, FTC_CMapCache *acache ); /************************************************************************ * * @function: * FTC_CMapCache_Lookup * * @description: * Translate a character code into a glyph index, using the charmap * cache. * * @input: * cache :: * A charmap cache handle. * * face_id :: * The source face ID. * * cmap_index :: * The index of the charmap in the source face. Any negative value * means to use the cache @FT_Face's default charmap. * * char_code :: * The character code (in the corresponding charmap). * * @return: * Glyph index. 0~means `no glyph'. * */ FT_EXPORT( FT_UInt ) FTC_CMapCache_Lookup( FTC_CMapCache cache, FTC_FaceID face_id, FT_Int cmap_index, FT_UInt32 char_code ); /*************************************************************************/ /* */ /* <Section> */ /* cache_subsystem */ /* */ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** IMAGE CACHE OBJECT *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /************************************************************************* * * @struct: * FTC_ImageTypeRec * * @description: * A structure used to model the type of images in a glyph cache. * * @fields: * face_id :: * The face ID. * * width :: * The width in pixels. * * height :: * The height in pixels. * * flags :: * The load flags, as in @FT_Load_Glyph. * */ typedef struct FTC_ImageTypeRec_ { FTC_FaceID face_id; FT_Int width; FT_Int height; FT_Int32 flags; } FTC_ImageTypeRec; /************************************************************************* * * @type: * FTC_ImageType * * @description: * A handle to an @FTC_ImageTypeRec structure. * */ typedef struct FTC_ImageTypeRec_* FTC_ImageType; /* */ #define FTC_IMAGE_TYPE_COMPARE( d1, d2 ) \ ( (d1)->face_id == (d2)->face_id && \ (d1)->width == (d2)->width && \ (d1)->flags == (d2)->flags ) /*************************************************************************/ /* */ /* <Type> */ /* FTC_ImageCache */ /* */ /* <Description> */ /* A handle to a glyph image cache object. They are designed to */ /* hold many distinct glyph images while not exceeding a certain */ /* memory threshold. */ /* */ typedef struct FTC_ImageCacheRec_* FTC_ImageCache; /*************************************************************************/ /* */ /* <Function> */ /* FTC_ImageCache_New */ /* */ /* <Description> */ /* Create a new glyph image cache. */ /* */ /* <Input> */ /* manager :: The parent manager for the image cache. */ /* */ /* <Output> */ /* acache :: A handle to the new glyph image cache object. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FTC_ImageCache_New( FTC_Manager manager, FTC_ImageCache *acache ); /*************************************************************************/ /* */ /* <Function> */ /* FTC_ImageCache_Lookup */ /* */ /* <Description> */ /* Retrieve a given glyph image from a glyph image cache. */ /* */ /* <Input> */ /* cache :: A handle to the source glyph image cache. */ /* */ /* type :: A pointer to a glyph image type descriptor. */ /* */ /* gindex :: The glyph index to retrieve. */ /* */ /* <Output> */ /* aglyph :: The corresponding @FT_Glyph object. 0~in case of */ /* failure. */ /* */ /* anode :: Used to return the address of the corresponding cache */ /* node after incrementing its reference count (see note */ /* below). */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* The returned glyph is owned and managed by the glyph image cache. */ /* Never try to transform or discard it manually! You can however */ /* create a copy with @FT_Glyph_Copy and modify the new one. */ /* */ /* If `anode' is _not_ NULL, it receives the address of the cache */ /* node containing the glyph image, after increasing its reference */ /* count. This ensures that the node (as well as the @FT_Glyph) will */ /* always be kept in the cache until you call @FTC_Node_Unref to */ /* `release' it. */ /* */ /* If `anode' is NULL, the cache node is left unchanged, which means */ /* that the @FT_Glyph could be flushed out of the cache on the next */ /* call to one of the caching sub-system APIs. Don't assume that it */ /* is persistent! */ /* */ FT_EXPORT( FT_Error ) FTC_ImageCache_Lookup( FTC_ImageCache cache, FTC_ImageType type, FT_UInt gindex, FT_Glyph *aglyph, FTC_Node *anode ); /*************************************************************************/ /* */ /* <Function> */ /* FTC_ImageCache_LookupScaler */ /* */ /* <Description> */ /* A variant of @FTC_ImageCache_Lookup that uses an @FTC_ScalerRec */ /* to specify the face ID and its size. */ /* */ /* <Input> */ /* cache :: A handle to the source glyph image cache. */ /* */ /* scaler :: A pointer to a scaler descriptor. */ /* */ /* load_flags :: The corresponding load flags. */ /* */ /* gindex :: The glyph index to retrieve. */ /* */ /* <Output> */ /* aglyph :: The corresponding @FT_Glyph object. 0~in case of */ /* failure. */ /* */ /* anode :: Used to return the address of the corresponding */ /* cache node after incrementing its reference count */ /* (see note below). */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* The returned glyph is owned and managed by the glyph image cache. */ /* Never try to transform or discard it manually! You can however */ /* create a copy with @FT_Glyph_Copy and modify the new one. */ /* */ /* If `anode' is _not_ NULL, it receives the address of the cache */ /* node containing the glyph image, after increasing its reference */ /* count. This ensures that the node (as well as the @FT_Glyph) will */ /* always be kept in the cache until you call @FTC_Node_Unref to */ /* `release' it. */ /* */ /* If `anode' is NULL, the cache node is left unchanged, which means */ /* that the @FT_Glyph could be flushed out of the cache on the next */ /* call to one of the caching sub-system APIs. Don't assume that it */ /* is persistent! */ /* */ /* Calls to @FT_Set_Char_Size and friends have no effect on cached */ /* glyphs; you should always use the FreeType cache API instead. */ /* */ FT_EXPORT( FT_Error ) FTC_ImageCache_LookupScaler( FTC_ImageCache cache, FTC_Scaler scaler, FT_ULong load_flags, FT_UInt gindex, FT_Glyph *aglyph, FTC_Node *anode ); /*************************************************************************/ /* */ /* <Type> */ /* FTC_SBit */ /* */ /* <Description> */ /* A handle to a small bitmap descriptor. See the @FTC_SBitRec */ /* structure for details. */ /* */ typedef struct FTC_SBitRec_* FTC_SBit; /*************************************************************************/ /* */ /* <Struct> */ /* FTC_SBitRec */ /* */ /* <Description> */ /* A very compact structure used to describe a small glyph bitmap. */ /* */ /* <Fields> */ /* width :: The bitmap width in pixels. */ /* */ /* height :: The bitmap height in pixels. */ /* */ /* left :: The horizontal distance from the pen position to the */ /* left bitmap border (a.k.a. `left side bearing', or */ /* `lsb'). */ /* */ /* top :: The vertical distance from the pen position (on the */ /* baseline) to the upper bitmap border (a.k.a. `top */ /* side bearing'). The distance is positive for upwards */ /* y~coordinates. */ /* */ /* format :: The format of the glyph bitmap (monochrome or gray). */ /* */ /* max_grays :: Maximum gray level value (in the range 1 to~255). */ /* */ /* pitch :: The number of bytes per bitmap line. May be positive */ /* or negative. */ /* */ /* xadvance :: The horizontal advance width in pixels. */ /* */ /* yadvance :: The vertical advance height in pixels. */ /* */ /* buffer :: A pointer to the bitmap pixels. */ /* */ typedef struct FTC_SBitRec_ { FT_Byte width; FT_Byte height; FT_Char left; FT_Char top; FT_Byte format; FT_Byte max_grays; FT_Short pitch; FT_Char xadvance; FT_Char yadvance; FT_Byte* buffer; } FTC_SBitRec; /*************************************************************************/ /* */ /* <Type> */ /* FTC_SBitCache */ /* */ /* <Description> */ /* A handle to a small bitmap cache. These are special cache objects */ /* used to store small glyph bitmaps (and anti-aliased pixmaps) in a */ /* much more efficient way than the traditional glyph image cache */ /* implemented by @FTC_ImageCache. */ /* */ typedef struct FTC_SBitCacheRec_* FTC_SBitCache; /*************************************************************************/ /* */ /* <Function> */ /* FTC_SBitCache_New */ /* */ /* <Description> */ /* Create a new cache to store small glyph bitmaps. */ /* */ /* <Input> */ /* manager :: A handle to the source cache manager. */ /* */ /* <Output> */ /* acache :: A handle to the new sbit cache. NULL in case of error. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FTC_SBitCache_New( FTC_Manager manager, FTC_SBitCache *acache ); /*************************************************************************/ /* */ /* <Function> */ /* FTC_SBitCache_Lookup */ /* */ /* <Description> */ /* Look up a given small glyph bitmap in a given sbit cache and */ /* `lock' it to prevent its flushing from the cache until needed. */ /* */ /* <Input> */ /* cache :: A handle to the source sbit cache. */ /* */ /* type :: A pointer to the glyph image type descriptor. */ /* */ /* gindex :: The glyph index. */ /* */ /* <Output> */ /* sbit :: A handle to a small bitmap descriptor. */ /* */ /* anode :: Used to return the address of the corresponding cache */ /* node after incrementing its reference count (see note */ /* below). */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* The small bitmap descriptor and its bit buffer are owned by the */ /* cache and should never be freed by the application. They might */ /* as well disappear from memory on the next cache lookup, so don't */ /* treat them as persistent data. */ /* */ /* The descriptor's `buffer' field is set to~0 to indicate a missing */ /* glyph bitmap. */ /* */ /* If `anode' is _not_ NULL, it receives the address of the cache */ /* node containing the bitmap, after increasing its reference count. */ /* This ensures that the node (as well as the image) will always be */ /* kept in the cache until you call @FTC_Node_Unref to `release' it. */ /* */ /* If `anode' is NULL, the cache node is left unchanged, which means */ /* that the bitmap could be flushed out of the cache on the next */ /* call to one of the caching sub-system APIs. Don't assume that it */ /* is persistent! */ /* */ FT_EXPORT( FT_Error ) FTC_SBitCache_Lookup( FTC_SBitCache cache, FTC_ImageType type, FT_UInt gindex, FTC_SBit *sbit, FTC_Node *anode ); /*************************************************************************/ /* */ /* <Function> */ /* FTC_SBitCache_LookupScaler */ /* */ /* <Description> */ /* A variant of @FTC_SBitCache_Lookup that uses an @FTC_ScalerRec */ /* to specify the face ID and its size. */ /* */ /* <Input> */ /* cache :: A handle to the source sbit cache. */ /* */ /* scaler :: A pointer to the scaler descriptor. */ /* */ /* load_flags :: The corresponding load flags. */ /* */ /* gindex :: The glyph index. */ /* */ /* <Output> */ /* sbit :: A handle to a small bitmap descriptor. */ /* */ /* anode :: Used to return the address of the corresponding */ /* cache node after incrementing its reference count */ /* (see note below). */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* The small bitmap descriptor and its bit buffer are owned by the */ /* cache and should never be freed by the application. They might */ /* as well disappear from memory on the next cache lookup, so don't */ /* treat them as persistent data. */ /* */ /* The descriptor's `buffer' field is set to~0 to indicate a missing */ /* glyph bitmap. */ /* */ /* If `anode' is _not_ NULL, it receives the address of the cache */ /* node containing the bitmap, after increasing its reference count. */ /* This ensures that the node (as well as the image) will always be */ /* kept in the cache until you call @FTC_Node_Unref to `release' it. */ /* */ /* If `anode' is NULL, the cache node is left unchanged, which means */ /* that the bitmap could be flushed out of the cache on the next */ /* call to one of the caching sub-system APIs. Don't assume that it */ /* is persistent! */ /* */ FT_EXPORT( FT_Error ) FTC_SBitCache_LookupScaler( FTC_SBitCache cache, FTC_Scaler scaler, FT_ULong load_flags, FT_UInt gindex, FTC_SBit *sbit, FTC_Node *anode ); /* */ #ifdef FT_CONFIG_OPTION_OLD_INTERNALS /*@***********************************************************************/ /* */ /* <Struct> */ /* FTC_FontRec */ /* */ /* <Description> */ /* A simple structure used to describe a given `font' to the cache */ /* manager. Note that a `font' is the combination of a given face */ /* with a given character size. */ /* */ /* <Fields> */ /* face_id :: The ID of the face to use. */ /* */ /* pix_width :: The character width in integer pixels. */ /* */ /* pix_height :: The character height in integer pixels. */ /* */ typedef struct FTC_FontRec_ { FTC_FaceID face_id; FT_UShort pix_width; FT_UShort pix_height; } FTC_FontRec; /* */ typedef FTC_FontRec* FTC_Font; FT_EXPORT( FT_Error ) FTC_Manager_Lookup_Face( FTC_Manager manager, FTC_FaceID face_id, FT_Face *aface ); FT_EXPORT( FT_Error ) FTC_Manager_Lookup_Size( FTC_Manager manager, FTC_Font font, FT_Face *aface, FT_Size *asize ); #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ FT_END_HEADER #endif /* FTCACHE_H_ */ /* END */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftglyph.h������������������������������������������������������������������������0000644�����������������00000113435�14763166026�0012144 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftglyph.h */ /* */ /* FreeType convenience functions to handle glyphs (specification). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ /*************************************************************************/ /* */ /* This file contains the definition of several convenience functions */ /* that can be used by client applications to easily retrieve glyph */ /* bitmaps and outlines from a given face. */ /* */ /* These functions should be optional if you are writing a font server */ /* or text layout engine on top of FreeType. However, they are pretty */ /* handy for many other simple uses of the library. */ /* */ /*************************************************************************/ #ifndef FTGLYPH_H_ #define FTGLYPH_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* glyph_management */ /* */ /* <Title> */ /* Glyph Management */ /* */ /* <Abstract> */ /* Generic interface to manage individual glyph data. */ /* */ /* <Description> */ /* This section contains definitions used to manage glyph data */ /* through generic FT_Glyph objects. Each of them can contain a */ /* bitmap, a vector outline, or even images in other formats. */ /* */ /*************************************************************************/ /* forward declaration to a private type */ typedef struct FT_Glyph_Class_ FT_Glyph_Class; /*************************************************************************/ /* */ /* <Type> */ /* FT_Glyph */ /* */ /* <Description> */ /* Handle to an object used to model generic glyph images. It is a */ /* pointer to the @FT_GlyphRec structure and can contain a glyph */ /* bitmap or pointer. */ /* */ /* <Note> */ /* Glyph objects are not owned by the library. You must thus release */ /* them manually (through @FT_Done_Glyph) _before_ calling */ /* @FT_Done_FreeType. */ /* */ typedef struct FT_GlyphRec_* FT_Glyph; /*************************************************************************/ /* */ /* <Struct> */ /* FT_GlyphRec */ /* */ /* <Description> */ /* The root glyph structure contains a given glyph image plus its */ /* advance width in 16.16 fixed-point format. */ /* */ /* <Fields> */ /* library :: A handle to the FreeType library object. */ /* */ /* clazz :: A pointer to the glyph's class. Private. */ /* */ /* format :: The format of the glyph's image. */ /* */ /* advance :: A 16.16 vector that gives the glyph's advance width. */ /* */ typedef struct FT_GlyphRec_ { FT_Library library; const FT_Glyph_Class* clazz; FT_Glyph_Format format; FT_Vector advance; } FT_GlyphRec; /*************************************************************************/ /* */ /* <Type> */ /* FT_BitmapGlyph */ /* */ /* <Description> */ /* A handle to an object used to model a bitmap glyph image. This is */ /* a sub-class of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec. */ /* */ typedef struct FT_BitmapGlyphRec_* FT_BitmapGlyph; /*************************************************************************/ /* */ /* <Struct> */ /* FT_BitmapGlyphRec */ /* */ /* <Description> */ /* A structure used for bitmap glyph images. This really is a */ /* `sub-class' of @FT_GlyphRec. */ /* */ /* <Fields> */ /* root :: The root @FT_Glyph fields. */ /* */ /* left :: The left-side bearing, i.e., the horizontal distance */ /* from the current pen position to the left border of the */ /* glyph bitmap. */ /* */ /* top :: The top-side bearing, i.e., the vertical distance from */ /* the current pen position to the top border of the glyph */ /* bitmap. This distance is positive for upwards~y! */ /* */ /* bitmap :: A descriptor for the bitmap. */ /* */ /* <Note> */ /* You can typecast an @FT_Glyph to @FT_BitmapGlyph if you have */ /* `glyph->format == FT_GLYPH_FORMAT_BITMAP'. This lets you access */ /* the bitmap's contents easily. */ /* */ /* The corresponding pixel buffer is always owned by @FT_BitmapGlyph */ /* and is thus created and destroyed with it. */ /* */ typedef struct FT_BitmapGlyphRec_ { FT_GlyphRec root; FT_Int left; FT_Int top; FT_Bitmap bitmap; } FT_BitmapGlyphRec; /*************************************************************************/ /* */ /* <Type> */ /* FT_OutlineGlyph */ /* */ /* <Description> */ /* A handle to an object used to model an outline glyph image. This */ /* is a sub-class of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec. */ /* */ typedef struct FT_OutlineGlyphRec_* FT_OutlineGlyph; /*************************************************************************/ /* */ /* <Struct> */ /* FT_OutlineGlyphRec */ /* */ /* <Description> */ /* A structure used for outline (vectorial) glyph images. This */ /* really is a `sub-class' of @FT_GlyphRec. */ /* */ /* <Fields> */ /* root :: The root @FT_Glyph fields. */ /* */ /* outline :: A descriptor for the outline. */ /* */ /* <Note> */ /* You can typecast an @FT_Glyph to @FT_OutlineGlyph if you have */ /* `glyph->format == FT_GLYPH_FORMAT_OUTLINE'. This lets you access */ /* the outline's content easily. */ /* */ /* As the outline is extracted from a glyph slot, its coordinates are */ /* expressed normally in 26.6 pixels, unless the flag */ /* @FT_LOAD_NO_SCALE was used in @FT_Load_Glyph() or @FT_Load_Char(). */ /* */ /* The outline's tables are always owned by the object and are */ /* destroyed with it. */ /* */ typedef struct FT_OutlineGlyphRec_ { FT_GlyphRec root; FT_Outline outline; } FT_OutlineGlyphRec; /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_Glyph */ /* */ /* <Description> */ /* A function used to extract a glyph image from a slot. Note that */ /* the created @FT_Glyph object must be released with @FT_Done_Glyph. */ /* */ /* <Input> */ /* slot :: A handle to the source glyph slot. */ /* */ /* <Output> */ /* aglyph :: A handle to the glyph object. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Get_Glyph( FT_GlyphSlot slot, FT_Glyph *aglyph ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Glyph_Copy */ /* */ /* <Description> */ /* A function used to copy a glyph image. Note that the created */ /* @FT_Glyph object must be released with @FT_Done_Glyph. */ /* */ /* <Input> */ /* source :: A handle to the source glyph object. */ /* */ /* <Output> */ /* target :: A handle to the target glyph object. 0~in case of */ /* error. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Glyph_Copy( FT_Glyph source, FT_Glyph *target ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Glyph_Transform */ /* */ /* <Description> */ /* Transform a glyph image if its format is scalable. */ /* */ /* <InOut> */ /* glyph :: A handle to the target glyph object. */ /* */ /* <Input> */ /* matrix :: A pointer to a 2x2 matrix to apply. */ /* */ /* delta :: A pointer to a 2d vector to apply. Coordinates are */ /* expressed in 1/64th of a pixel. */ /* */ /* <Return> */ /* FreeType error code (if not 0, the glyph format is not scalable). */ /* */ /* <Note> */ /* The 2x2 transformation matrix is also applied to the glyph's */ /* advance vector. */ /* */ FT_EXPORT( FT_Error ) FT_Glyph_Transform( FT_Glyph glyph, FT_Matrix* matrix, FT_Vector* delta ); /*************************************************************************/ /* */ /* <Enum> */ /* FT_Glyph_BBox_Mode */ /* */ /* <Description> */ /* The mode how the values of @FT_Glyph_Get_CBox are returned. */ /* */ /* <Values> */ /* FT_GLYPH_BBOX_UNSCALED :: */ /* Return unscaled font units. */ /* */ /* FT_GLYPH_BBOX_SUBPIXELS :: */ /* Return unfitted 26.6 coordinates. */ /* */ /* FT_GLYPH_BBOX_GRIDFIT :: */ /* Return grid-fitted 26.6 coordinates. */ /* */ /* FT_GLYPH_BBOX_TRUNCATE :: */ /* Return coordinates in integer pixels. */ /* */ /* FT_GLYPH_BBOX_PIXELS :: */ /* Return grid-fitted pixel coordinates. */ /* */ typedef enum FT_Glyph_BBox_Mode_ { FT_GLYPH_BBOX_UNSCALED = 0, FT_GLYPH_BBOX_SUBPIXELS = 0, FT_GLYPH_BBOX_GRIDFIT = 1, FT_GLYPH_BBOX_TRUNCATE = 2, FT_GLYPH_BBOX_PIXELS = 3 } FT_Glyph_BBox_Mode; /* these constants are deprecated; use the corresponding */ /* `FT_Glyph_BBox_Mode' values instead */ #define ft_glyph_bbox_unscaled FT_GLYPH_BBOX_UNSCALED #define ft_glyph_bbox_subpixels FT_GLYPH_BBOX_SUBPIXELS #define ft_glyph_bbox_gridfit FT_GLYPH_BBOX_GRIDFIT #define ft_glyph_bbox_truncate FT_GLYPH_BBOX_TRUNCATE #define ft_glyph_bbox_pixels FT_GLYPH_BBOX_PIXELS /*************************************************************************/ /* */ /* <Function> */ /* FT_Glyph_Get_CBox */ /* */ /* <Description> */ /* Return a glyph's `control box'. The control box encloses all the */ /* outline's points, including Bézier control points. Though it */ /* coincides with the exact bounding box for most glyphs, it can be */ /* slightly larger in some situations (like when rotating an outline */ /* that contains Bézier outside arcs). */ /* */ /* Computing the control box is very fast, while getting the bounding */ /* box can take much more time as it needs to walk over all segments */ /* and arcs in the outline. To get the latter, you can use the */ /* `ftbbox' component, which is dedicated to this single task. */ /* */ /* <Input> */ /* glyph :: A handle to the source glyph object. */ /* */ /* mode :: The mode that indicates how to interpret the returned */ /* bounding box values. */ /* */ /* <Output> */ /* acbox :: The glyph coordinate bounding box. Coordinates are */ /* expressed in 1/64th of pixels if it is grid-fitted. */ /* */ /* <Note> */ /* Coordinates are relative to the glyph origin, using the y~upwards */ /* convention. */ /* */ /* If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode' */ /* must be set to @FT_GLYPH_BBOX_UNSCALED to get unscaled font */ /* units in 26.6 pixel format. The value @FT_GLYPH_BBOX_SUBPIXELS */ /* is another name for this constant. */ /* */ /* If the font is tricky and the glyph has been loaded with */ /* @FT_LOAD_NO_SCALE, the resulting CBox is meaningless. To get */ /* reasonable values for the CBox it is necessary to load the glyph */ /* at a large ppem value (so that the hinting instructions can */ /* properly shift and scale the subglyphs), then extracting the CBox, */ /* which can be eventually converted back to font units. */ /* */ /* Note that the maximum coordinates are exclusive, which means that */ /* one can compute the width and height of the glyph image (be it in */ /* integer or 26.6 pixels) as: */ /* */ /* { */ /* width = bbox.xMax - bbox.xMin; */ /* height = bbox.yMax - bbox.yMin; */ /* } */ /* */ /* Note also that for 26.6 coordinates, if `bbox_mode' is set to */ /* @FT_GLYPH_BBOX_GRIDFIT, the coordinates will also be grid-fitted, */ /* which corresponds to: */ /* */ /* { */ /* bbox.xMin = FLOOR(bbox.xMin); */ /* bbox.yMin = FLOOR(bbox.yMin); */ /* bbox.xMax = CEILING(bbox.xMax); */ /* bbox.yMax = CEILING(bbox.yMax); */ /* } */ /* */ /* To get the bbox in pixel coordinates, set `bbox_mode' to */ /* @FT_GLYPH_BBOX_TRUNCATE. */ /* */ /* To get the bbox in grid-fitted pixel coordinates, set `bbox_mode' */ /* to @FT_GLYPH_BBOX_PIXELS. */ /* */ FT_EXPORT( void ) FT_Glyph_Get_CBox( FT_Glyph glyph, FT_UInt bbox_mode, FT_BBox *acbox ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Glyph_To_Bitmap */ /* */ /* <Description> */ /* Convert a given glyph object to a bitmap glyph object. */ /* */ /* <InOut> */ /* the_glyph :: A pointer to a handle to the target glyph. */ /* */ /* <Input> */ /* render_mode :: An enumeration that describes how the data is */ /* rendered. */ /* */ /* origin :: A pointer to a vector used to translate the glyph */ /* image before rendering. Can be~0 (if no */ /* translation). The origin is expressed in */ /* 26.6 pixels. */ /* */ /* destroy :: A boolean that indicates that the original glyph */ /* image should be destroyed by this function. It is */ /* never destroyed in case of error. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* This function does nothing if the glyph format isn't scalable. */ /* */ /* The glyph image is translated with the `origin' vector before */ /* rendering. */ /* */ /* The first parameter is a pointer to an @FT_Glyph handle, that will */ /* be _replaced_ by this function (with newly allocated data). */ /* Typically, you would use (omitting error handling): */ /* */ /* */ /* { */ /* FT_Glyph glyph; */ /* FT_BitmapGlyph glyph_bitmap; */ /* */ /* */ /* // load glyph */ /* error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAULT ); */ /* */ /* // extract glyph image */ /* error = FT_Get_Glyph( face->glyph, &glyph ); */ /* */ /* // convert to a bitmap (default render mode + destroying old) */ /* if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) */ /* { */ /* error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL, */ /* 0, 1 ); */ /* if ( error ) // `glyph' unchanged */ /* ... */ /* } */ /* */ /* // access bitmap content by typecasting */ /* glyph_bitmap = (FT_BitmapGlyph)glyph; */ /* */ /* // do funny stuff with it, like blitting/drawing */ /* ... */ /* */ /* // discard glyph image (bitmap or not) */ /* FT_Done_Glyph( glyph ); */ /* } */ /* */ /* */ /* Here another example, again without error handling: */ /* */ /* */ /* { */ /* FT_Glyph glyphs[MAX_GLYPHS] */ /* */ /* */ /* ... */ /* */ /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */ /* error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) || */ /* FT_Get_Glyph ( face->glyph, &glyph[idx] ); */ /* */ /* ... */ /* */ /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */ /* { */ /* FT_Glyph bitmap = glyphs[idx]; */ /* */ /* */ /* ... */ /* */ /* // after this call, `bitmap' no longer points into */ /* // the `glyphs' array (and the old value isn't destroyed) */ /* FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 ); */ /* */ /* ... */ /* */ /* FT_Done_Glyph( bitmap ); */ /* } */ /* */ /* ... */ /* */ /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */ /* FT_Done_Glyph( glyphs[idx] ); */ /* } */ /* */ FT_EXPORT( FT_Error ) FT_Glyph_To_Bitmap( FT_Glyph* the_glyph, FT_Render_Mode render_mode, FT_Vector* origin, FT_Bool destroy ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Done_Glyph */ /* */ /* <Description> */ /* Destroy a given glyph. */ /* */ /* <Input> */ /* glyph :: A handle to the target glyph object. */ /* */ FT_EXPORT( void ) FT_Done_Glyph( FT_Glyph glyph ); /* */ /* other helpful functions */ /*************************************************************************/ /* */ /* <Section> */ /* computations */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Function> */ /* FT_Matrix_Multiply */ /* */ /* <Description> */ /* Perform the matrix operation `b = a*b'. */ /* */ /* <Input> */ /* a :: A pointer to matrix `a'. */ /* */ /* <InOut> */ /* b :: A pointer to matrix `b'. */ /* */ /* <Note> */ /* The result is undefined if either `a' or `b' is zero. */ /* */ FT_EXPORT( void ) FT_Matrix_Multiply( const FT_Matrix* a, FT_Matrix* b ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Matrix_Invert */ /* */ /* <Description> */ /* Invert a 2x2 matrix. Return an error if it can't be inverted. */ /* */ /* <InOut> */ /* matrix :: A pointer to the target matrix. Remains untouched in */ /* case of error. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Matrix_Invert( FT_Matrix* matrix ); /* */ FT_END_HEADER #endif /* FTGLYPH_H_ */ /* END */ /* Local Variables: */ /* coding: utf-8 */ /* End: */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftsizes.h������������������������������������������������������������������������0000644�����������������00000022520�14763166026�0012150 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftsizes.h */ /* */ /* FreeType size objects management (specification). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ /*************************************************************************/ /* */ /* Typical application would normally not need to use these functions. */ /* However, they have been placed in a public API for the rare cases */ /* where they are needed. */ /* */ /*************************************************************************/ #ifndef FTSIZES_H_ #define FTSIZES_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* sizes_management */ /* */ /* <Title> */ /* Size Management */ /* */ /* <Abstract> */ /* Managing multiple sizes per face. */ /* */ /* <Description> */ /* When creating a new face object (e.g., with @FT_New_Face), an */ /* @FT_Size object is automatically created and used to store all */ /* pixel-size dependent information, available in the `face->size' */ /* field. */ /* */ /* It is however possible to create more sizes for a given face, */ /* mostly in order to manage several character pixel sizes of the */ /* same font family and style. See @FT_New_Size and @FT_Done_Size. */ /* */ /* Note that @FT_Set_Pixel_Sizes and @FT_Set_Char_Size only */ /* modify the contents of the current `active' size; you thus need */ /* to use @FT_Activate_Size to change it. */ /* */ /* 99% of applications won't need the functions provided here, */ /* especially if they use the caching sub-system, so be cautious */ /* when using these. */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Function> */ /* FT_New_Size */ /* */ /* <Description> */ /* Create a new size object from a given face object. */ /* */ /* <Input> */ /* face :: A handle to a parent face object. */ /* */ /* <Output> */ /* asize :: A handle to a new size object. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* You need to call @FT_Activate_Size in order to select the new size */ /* for upcoming calls to @FT_Set_Pixel_Sizes, @FT_Set_Char_Size, */ /* @FT_Load_Glyph, @FT_Load_Char, etc. */ /* */ FT_EXPORT( FT_Error ) FT_New_Size( FT_Face face, FT_Size* size ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Done_Size */ /* */ /* <Description> */ /* Discard a given size object. Note that @FT_Done_Face */ /* automatically discards all size objects allocated with */ /* @FT_New_Size. */ /* */ /* <Input> */ /* size :: A handle to a target size object. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Done_Size( FT_Size size ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Activate_Size */ /* */ /* <Description> */ /* Even though it is possible to create several size objects for a */ /* given face (see @FT_New_Size for details), functions like */ /* @FT_Load_Glyph or @FT_Load_Char only use the one that has been */ /* activated last to determine the `current character pixel size'. */ /* */ /* This function can be used to `activate' a previously created size */ /* object. */ /* */ /* <Input> */ /* size :: A handle to a target size object. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* If `face' is the size's parent face object, this function changes */ /* the value of `face->size' to the input size handle. */ /* */ FT_EXPORT( FT_Error ) FT_Activate_Size( FT_Size size ); /* */ FT_END_HEADER #endif /* FTSIZES_H_ */ /* END */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftwinfnt.h�����������������������������������������������������������������������0000644�����������������00000024242�14763166026�0012323 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftwinfnt.h */ /* */ /* FreeType API for accessing Windows fnt-specific data. */ /* */ /* Copyright 2003-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTWINFNT_H_ #define FTWINFNT_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* winfnt_fonts */ /* */ /* <Title> */ /* Window FNT Files */ /* */ /* <Abstract> */ /* Windows FNT specific API. */ /* */ /* <Description> */ /* This section contains the declaration of Windows FNT specific */ /* functions. */ /* */ /*************************************************************************/ /************************************************************************* * * @enum: * FT_WinFNT_ID_XXX * * @description: * A list of valid values for the `charset' byte in * @FT_WinFNT_HeaderRec. Exact mapping tables for the various cpXXXX * encodings (except for cp1361) can be found at * ftp://ftp.unicode.org/Public in the MAPPINGS/VENDORS/MICSFT/WINDOWS * subdirectory. cp1361 is roughly a superset of * MAPPINGS/OBSOLETE/EASTASIA/KSC/JOHAB.TXT. * * @values: * FT_WinFNT_ID_DEFAULT :: * This is used for font enumeration and font creation as a * `don't care' value. Valid font files don't contain this value. * When querying for information about the character set of the font * that is currently selected into a specified device context, this * return value (of the related Windows API) simply denotes failure. * * FT_WinFNT_ID_SYMBOL :: * There is no known mapping table available. * * FT_WinFNT_ID_MAC :: * Mac Roman encoding. * * FT_WinFNT_ID_OEM :: * From Michael Pöttgen <michael@poettgen.de>: * * The `Windows Font Mapping' article says that FT_WinFNT_ID_OEM * is used for the charset of vector fonts, like `modern.fon', * `roman.fon', and `script.fon' on Windows. * * The `CreateFont' documentation says: The FT_WinFNT_ID_OEM value * specifies a character set that is operating-system dependent. * * The `IFIMETRICS' documentation from the `Windows Driver * Development Kit' says: This font supports an OEM-specific * character set. The OEM character set is system dependent. * * In general OEM, as opposed to ANSI (i.e., cp1252), denotes the * second default codepage that most international versions of * Windows have. It is one of the OEM codepages from * * https://msdn.microsoft.com/en-us/goglobal/bb964655, * * and is used for the `DOS boxes', to support legacy applications. * A German Windows version for example usually uses ANSI codepage * 1252 and OEM codepage 850. * * FT_WinFNT_ID_CP874 :: * A superset of Thai TIS 620 and ISO 8859-11. * * FT_WinFNT_ID_CP932 :: * A superset of Japanese Shift-JIS (with minor deviations). * * FT_WinFNT_ID_CP936 :: * A superset of simplified Chinese GB 2312-1980 (with different * ordering and minor deviations). * * FT_WinFNT_ID_CP949 :: * A superset of Korean Hangul KS~C 5601-1987 (with different * ordering and minor deviations). * * FT_WinFNT_ID_CP950 :: * A superset of traditional Chinese Big~5 ETen (with different * ordering and minor deviations). * * FT_WinFNT_ID_CP1250 :: * A superset of East European ISO 8859-2 (with slightly different * ordering). * * FT_WinFNT_ID_CP1251 :: * A superset of Russian ISO 8859-5 (with different ordering). * * FT_WinFNT_ID_CP1252 :: * ANSI encoding. A superset of ISO 8859-1. * * FT_WinFNT_ID_CP1253 :: * A superset of Greek ISO 8859-7 (with minor modifications). * * FT_WinFNT_ID_CP1254 :: * A superset of Turkish ISO 8859-9. * * FT_WinFNT_ID_CP1255 :: * A superset of Hebrew ISO 8859-8 (with some modifications). * * FT_WinFNT_ID_CP1256 :: * A superset of Arabic ISO 8859-6 (with different ordering). * * FT_WinFNT_ID_CP1257 :: * A superset of Baltic ISO 8859-13 (with some deviations). * * FT_WinFNT_ID_CP1258 :: * For Vietnamese. This encoding doesn't cover all necessary * characters. * * FT_WinFNT_ID_CP1361 :: * Korean (Johab). */ #define FT_WinFNT_ID_CP1252 0 #define FT_WinFNT_ID_DEFAULT 1 #define FT_WinFNT_ID_SYMBOL 2 #define FT_WinFNT_ID_MAC 77 #define FT_WinFNT_ID_CP932 128 #define FT_WinFNT_ID_CP949 129 #define FT_WinFNT_ID_CP1361 130 #define FT_WinFNT_ID_CP936 134 #define FT_WinFNT_ID_CP950 136 #define FT_WinFNT_ID_CP1253 161 #define FT_WinFNT_ID_CP1254 162 #define FT_WinFNT_ID_CP1258 163 #define FT_WinFNT_ID_CP1255 177 #define FT_WinFNT_ID_CP1256 178 #define FT_WinFNT_ID_CP1257 186 #define FT_WinFNT_ID_CP1251 204 #define FT_WinFNT_ID_CP874 222 #define FT_WinFNT_ID_CP1250 238 #define FT_WinFNT_ID_OEM 255 /*************************************************************************/ /* */ /* <Struct> */ /* FT_WinFNT_HeaderRec */ /* */ /* <Description> */ /* Windows FNT Header info. */ /* */ typedef struct FT_WinFNT_HeaderRec_ { FT_UShort version; FT_ULong file_size; FT_Byte copyright[60]; FT_UShort file_type; FT_UShort nominal_point_size; FT_UShort vertical_resolution; FT_UShort horizontal_resolution; FT_UShort ascent; FT_UShort internal_leading; FT_UShort external_leading; FT_Byte italic; FT_Byte underline; FT_Byte strike_out; FT_UShort weight; FT_Byte charset; FT_UShort pixel_width; FT_UShort pixel_height; FT_Byte pitch_and_family; FT_UShort avg_width; FT_UShort max_width; FT_Byte first_char; FT_Byte last_char; FT_Byte default_char; FT_Byte break_char; FT_UShort bytes_per_row; FT_ULong device_offset; FT_ULong face_name_offset; FT_ULong bits_pointer; FT_ULong bits_offset; FT_Byte reserved; FT_ULong flags; FT_UShort A_space; FT_UShort B_space; FT_UShort C_space; FT_UShort color_table_offset; FT_ULong reserved1[4]; } FT_WinFNT_HeaderRec; /*************************************************************************/ /* */ /* <Struct> */ /* FT_WinFNT_Header */ /* */ /* <Description> */ /* A handle to an @FT_WinFNT_HeaderRec structure. */ /* */ typedef struct FT_WinFNT_HeaderRec_* FT_WinFNT_Header; /********************************************************************** * * @function: * FT_Get_WinFNT_Header * * @description: * Retrieve a Windows FNT font info header. * * @input: * face :: A handle to the input face. * * @output: * aheader :: The WinFNT header. * * @return: * FreeType error code. 0~means success. * * @note: * This function only works with Windows FNT faces, returning an error * otherwise. */ FT_EXPORT( FT_Error ) FT_Get_WinFNT_Header( FT_Face face, FT_WinFNT_HeaderRec *aheader ); /* */ FT_END_HEADER #endif /* FTWINFNT_H_ */ /* END */ /* Local Variables: */ /* coding: utf-8 */ /* End: */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftmoderr.h�����������������������������������������������������������������������0000644�����������������00000024261�14763166026�0012307 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftmoderr.h */ /* */ /* FreeType module error offsets (specification). */ /* */ /* Copyright 2001-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ /*************************************************************************/ /* */ /* This file is used to define the FreeType module error codes. */ /* */ /* If the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in `ftoption.h' is */ /* set, the lower byte of an error value identifies the error code as */ /* usual. In addition, the higher byte identifies the module. For */ /* example, the error `FT_Err_Invalid_File_Format' has value 0x0003, the */ /* error `TT_Err_Invalid_File_Format' has value 0x1303, the error */ /* `T1_Err_Invalid_File_Format' has value 0x1403, etc. */ /* */ /* Note that `FT_Err_Ok', `TT_Err_Ok', etc. are always equal to zero, */ /* including the high byte. */ /* */ /* If FT_CONFIG_OPTION_USE_MODULE_ERRORS isn't set, the higher byte of */ /* an error value is set to zero. */ /* */ /* To hide the various `XXX_Err_' prefixes in the source code, FreeType */ /* provides some macros in `fttypes.h'. */ /* */ /* FT_ERR( err ) */ /* Add current error module prefix (as defined with the */ /* `FT_ERR_PREFIX' macro) to `err'. For example, in the BDF module */ /* the line */ /* */ /* error = FT_ERR( Invalid_Outline ); */ /* */ /* expands to */ /* */ /* error = BDF_Err_Invalid_Outline; */ /* */ /* For simplicity, you can always use `FT_Err_Ok' directly instead */ /* of `FT_ERR( Ok )'. */ /* */ /* FT_ERR_EQ( errcode, err ) */ /* FT_ERR_NEQ( errcode, err ) */ /* Compare error code `errcode' with the error `err' for equality */ /* and inequality, respectively. Example: */ /* */ /* if ( FT_ERR_EQ( error, Invalid_Outline ) ) */ /* ... */ /* */ /* Using this macro you don't have to think about error prefixes. */ /* Of course, if module errors are not active, the above example is */ /* the same as */ /* */ /* if ( error == FT_Err_Invalid_Outline ) */ /* ... */ /* */ /* FT_ERROR_BASE( errcode ) */ /* FT_ERROR_MODULE( errcode ) */ /* Get base error and module error code, respectively. */ /* */ /* */ /* It can also be used to create a module error message table easily */ /* with something like */ /* */ /* { */ /* #undef FTMODERR_H_ */ /* #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s }, */ /* #define FT_MODERR_START_LIST { */ /* #define FT_MODERR_END_LIST { 0, 0 } }; */ /* */ /* const struct */ /* { */ /* int mod_err_offset; */ /* const char* mod_err_msg */ /* } ft_mod_errors[] = */ /* */ /* #include FT_MODULE_ERRORS_H */ /* } */ /* */ /*************************************************************************/ #ifndef FTMODERR_H_ #define FTMODERR_H_ /*******************************************************************/ /*******************************************************************/ /***** *****/ /***** SETUP MACROS *****/ /***** *****/ /*******************************************************************/ /*******************************************************************/ #undef FT_NEED_EXTERN_C #ifndef FT_MODERRDEF #ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS #define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v, #else #define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = 0, #endif #define FT_MODERR_START_LIST enum { #define FT_MODERR_END_LIST FT_Mod_Err_Max }; #ifdef __cplusplus #define FT_NEED_EXTERN_C extern "C" { #endif #endif /* !FT_MODERRDEF */ /*******************************************************************/ /*******************************************************************/ /***** *****/ /***** LIST MODULE ERROR BASES *****/ /***** *****/ /*******************************************************************/ /*******************************************************************/ #ifdef FT_MODERR_START_LIST FT_MODERR_START_LIST #endif FT_MODERRDEF( Base, 0x000, "base module" ) FT_MODERRDEF( Autofit, 0x100, "autofitter module" ) FT_MODERRDEF( BDF, 0x200, "BDF module" ) FT_MODERRDEF( Bzip2, 0x300, "Bzip2 module" ) FT_MODERRDEF( Cache, 0x400, "cache module" ) FT_MODERRDEF( CFF, 0x500, "CFF module" ) FT_MODERRDEF( CID, 0x600, "CID module" ) FT_MODERRDEF( Gzip, 0x700, "Gzip module" ) FT_MODERRDEF( LZW, 0x800, "LZW module" ) FT_MODERRDEF( OTvalid, 0x900, "OpenType validation module" ) FT_MODERRDEF( PCF, 0xA00, "PCF module" ) FT_MODERRDEF( PFR, 0xB00, "PFR module" ) FT_MODERRDEF( PSaux, 0xC00, "PS auxiliary module" ) FT_MODERRDEF( PShinter, 0xD00, "PS hinter module" ) FT_MODERRDEF( PSnames, 0xE00, "PS names module" ) FT_MODERRDEF( Raster, 0xF00, "raster module" ) FT_MODERRDEF( SFNT, 0x1000, "SFNT module" ) FT_MODERRDEF( Smooth, 0x1100, "smooth raster module" ) FT_MODERRDEF( TrueType, 0x1200, "TrueType module" ) FT_MODERRDEF( Type1, 0x1300, "Type 1 module" ) FT_MODERRDEF( Type42, 0x1400, "Type 42 module" ) FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" ) FT_MODERRDEF( GXvalid, 0x1600, "GX validation module" ) #ifdef FT_MODERR_END_LIST FT_MODERR_END_LIST #endif /*******************************************************************/ /*******************************************************************/ /***** *****/ /***** CLEANUP *****/ /***** *****/ /*******************************************************************/ /*******************************************************************/ #ifdef FT_NEED_EXTERN_C } #endif #undef FT_MODERR_START_LIST #undef FT_MODERR_END_LIST #undef FT_MODERRDEF #undef FT_NEED_EXTERN_C #endif /* FTMODERR_H_ */ /* END */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/fterrors.h�����������������������������������������������������������������������0000644�����������������00000026151�14763166026�0012333 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* fterrors.h */ /* */ /* FreeType error code handling (specification). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ /*************************************************************************/ /* */ /* <Section> */ /* error_enumerations */ /* */ /* <Title> */ /* Error Enumerations */ /* */ /* <Abstract> */ /* How to handle errors and error strings. */ /* */ /* <Description> */ /* The header file `fterrors.h' (which is automatically included by */ /* `freetype.h' defines the handling of FreeType's enumeration */ /* constants. It can also be used to generate error message strings */ /* with a small macro trick explained below. */ /* */ /* *Error* *Formats* */ /* */ /* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */ /* defined in `ftoption.h' in order to make the higher byte indicate */ /* the module where the error has happened (this is not compatible */ /* with standard builds of FreeType 2, however). See the file */ /* `ftmoderr.h' for more details. */ /* */ /* *Error* *Message* *Strings* */ /* */ /* Error definitions are set up with special macros that allow client */ /* applications to build a table of error message strings. The */ /* strings are not included in a normal build of FreeType 2 to */ /* save space (most client applications do not use them). */ /* */ /* To do so, you have to define the following macros before including */ /* this file. */ /* */ /* { */ /* FT_ERROR_START_LIST */ /* } */ /* */ /* This macro is called before anything else to define the start of */ /* the error list. It is followed by several FT_ERROR_DEF calls. */ /* */ /* { */ /* FT_ERROR_DEF( e, v, s ) */ /* } */ /* */ /* This macro is called to define one single error. `e' is the error */ /* code identifier (e.g., `Invalid_Argument'), `v' is the error's */ /* numerical value, and `s' is the corresponding error string. */ /* */ /* { */ /* FT_ERROR_END_LIST */ /* } */ /* */ /* This macro ends the list. */ /* */ /* Additionally, you have to undefine `FTERRORS_H_' before #including */ /* this file. */ /* */ /* Here is a simple example. */ /* */ /* { */ /* #undef FTERRORS_H_ */ /* #define FT_ERRORDEF( e, v, s ) { e, s }, */ /* #define FT_ERROR_START_LIST { */ /* #define FT_ERROR_END_LIST { 0, NULL } }; */ /* */ /* const struct */ /* { */ /* int err_code; */ /* const char* err_msg; */ /* } ft_errors[] = */ /* */ /* #include FT_ERRORS_H */ /* } */ /* */ /* Note that `FT_Err_Ok' is _not_ defined with `FT_ERRORDEF' but with */ /* `FT_NOERRORDEF'; it is always zero. */ /* */ /*************************************************************************/ /* */ /* In previous FreeType versions we used `__FTERRORS_H__'. However, */ /* using two successive underscores in a non-system symbol name */ /* violates the C (and C++) standard, so it was changed to the */ /* current form. In spite of this, we have to make */ /* */ /* #undefine __FTERRORS_H__ */ /* */ /* work for backward compatibility. */ /* */ #if !( defined( FTERRORS_H_ ) && defined ( __FTERRORS_H__ ) ) #define FTERRORS_H_ #define __FTERRORS_H__ /* include module base error codes */ #include FT_MODULE_ERRORS_H /*******************************************************************/ /*******************************************************************/ /***** *****/ /***** SETUP MACROS *****/ /***** *****/ /*******************************************************************/ /*******************************************************************/ #undef FT_NEED_EXTERN_C /* FT_ERR_PREFIX is used as a prefix for error identifiers. */ /* By default, we use `FT_Err_'. */ /* */ #ifndef FT_ERR_PREFIX #define FT_ERR_PREFIX FT_Err_ #endif /* FT_ERR_BASE is used as the base for module-specific errors. */ /* */ #ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS #ifndef FT_ERR_BASE #define FT_ERR_BASE FT_Mod_Err_Base #endif #else #undef FT_ERR_BASE #define FT_ERR_BASE 0 #endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */ /* If FT_ERRORDEF is not defined, we need to define a simple */ /* enumeration type. */ /* */ #ifndef FT_ERRORDEF #define FT_ERRORDEF( e, v, s ) e = v, #define FT_ERROR_START_LIST enum { #define FT_ERROR_END_LIST FT_ERR_CAT( FT_ERR_PREFIX, Max ) }; #ifdef __cplusplus #define FT_NEED_EXTERN_C extern "C" { #endif #endif /* !FT_ERRORDEF */ /* this macro is used to define an error */ #define FT_ERRORDEF_( e, v, s ) \ FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s ) /* this is only used for <module>_Err_Ok, which must be 0! */ #define FT_NOERRORDEF_( e, v, s ) \ FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s ) #ifdef FT_ERROR_START_LIST FT_ERROR_START_LIST #endif /* now include the error codes */ #include FT_ERROR_DEFINITIONS_H #ifdef FT_ERROR_END_LIST FT_ERROR_END_LIST #endif /*******************************************************************/ /*******************************************************************/ /***** *****/ /***** SIMPLE CLEANUP *****/ /***** *****/ /*******************************************************************/ /*******************************************************************/ #ifdef FT_NEED_EXTERN_C } #endif #undef FT_ERROR_START_LIST #undef FT_ERROR_END_LIST #undef FT_ERRORDEF #undef FT_ERRORDEF_ #undef FT_NOERRORDEF_ #undef FT_NEED_EXTERN_C #undef FT_ERR_BASE /* FT_ERR_PREFIX is needed internally */ #ifndef FT2_BUILD_LIBRARY #undef FT_ERR_PREFIX #endif #endif /* !(FTERRORS_H_ && __FTERRORS_H__) */ /* END */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftlzw.h��������������������������������������������������������������������������0000644�����������������00000010230�14763166026�0011622 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftlzw.h */ /* */ /* LZW-compressed stream support. */ /* */ /* Copyright 2004-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTLZW_H_ #define FTLZW_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* lzw */ /* */ /* <Title> */ /* LZW Streams */ /* */ /* <Abstract> */ /* Using LZW-compressed font files. */ /* */ /* <Description> */ /* This section contains the declaration of LZW-specific functions. */ /* */ /*************************************************************************/ /************************************************************************ * * @function: * FT_Stream_OpenLZW * * @description: * Open a new stream to parse LZW-compressed font files. This is * mainly used to support the compressed `*.pcf.Z' fonts that come * with XFree86. * * @input: * stream :: The target embedding stream. * * source :: The source stream. * * @return: * FreeType error code. 0~means success. * * @note: * The source stream must be opened _before_ calling this function. * * Calling the internal function `FT_Stream_Close' on the new stream will * *not* call `FT_Stream_Close' on the source stream. None of the stream * objects will be released to the heap. * * The stream implementation is very basic and resets the decompression * process each time seeking backwards is needed within the stream * * In certain builds of the library, LZW compression recognition is * automatically handled when calling @FT_New_Face or @FT_Open_Face. * This means that if no font driver is capable of handling the raw * compressed file, the library will try to open a LZW stream from it * and re-open the face with it. * * This function may return `FT_Err_Unimplemented_Feature' if your build * of FreeType was not compiled with LZW support. */ FT_EXPORT( FT_Error ) FT_Stream_OpenLZW( FT_Stream stream, FT_Stream source ); /* */ FT_END_HEADER #endif /* FTLZW_H_ */ /* END */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/tttables.h�����������������������������������������������������������������������0000644�����������������00000130517�14763166026�0012311 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* tttables.h */ /* */ /* Basic SFNT/TrueType tables definitions and interface */ /* (specification only). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef TTTABLES_H_ #define TTTABLES_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* truetype_tables */ /* */ /* <Title> */ /* TrueType Tables */ /* */ /* <Abstract> */ /* TrueType specific table types and functions. */ /* */ /* <Description> */ /* This section contains definitions of some basic tables specific to */ /* TrueType and OpenType as well as some routines used to access and */ /* process them. */ /* */ /* <Order> */ /* TT_Header */ /* TT_HoriHeader */ /* TT_VertHeader */ /* TT_OS2 */ /* TT_Postscript */ /* TT_PCLT */ /* TT_MaxProfile */ /* */ /* FT_Sfnt_Tag */ /* FT_Get_Sfnt_Table */ /* FT_Load_Sfnt_Table */ /* FT_Sfnt_Table_Info */ /* */ /* FT_Get_CMap_Language_ID */ /* FT_Get_CMap_Format */ /* */ /* FT_PARAM_TAG_UNPATENTED_HINTING */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Struct> */ /* TT_Header */ /* */ /* <Description> */ /* A structure to model a TrueType font header table. All fields */ /* follow the OpenType specification. */ /* */ typedef struct TT_Header_ { FT_Fixed Table_Version; FT_Fixed Font_Revision; FT_Long CheckSum_Adjust; FT_Long Magic_Number; FT_UShort Flags; FT_UShort Units_Per_EM; FT_Long Created [2]; FT_Long Modified[2]; FT_Short xMin; FT_Short yMin; FT_Short xMax; FT_Short yMax; FT_UShort Mac_Style; FT_UShort Lowest_Rec_PPEM; FT_Short Font_Direction; FT_Short Index_To_Loc_Format; FT_Short Glyph_Data_Format; } TT_Header; /*************************************************************************/ /* */ /* <Struct> */ /* TT_HoriHeader */ /* */ /* <Description> */ /* A structure to model a TrueType horizontal header, the `hhea' */ /* table, as well as the corresponding horizontal metrics table, */ /* `hmtx'. */ /* */ /* <Fields> */ /* Version :: The table version. */ /* */ /* Ascender :: The font's ascender, i.e., the distance */ /* from the baseline to the top-most of all */ /* glyph points found in the font. */ /* */ /* This value is invalid in many fonts, as */ /* it is usually set by the font designer, */ /* and often reflects only a portion of the */ /* glyphs found in the font (maybe ASCII). */ /* */ /* You should use the `sTypoAscender' field */ /* of the `OS/2' table instead if you want */ /* the correct one. */ /* */ /* Descender :: The font's descender, i.e., the distance */ /* from the baseline to the bottom-most of */ /* all glyph points found in the font. It */ /* is negative. */ /* */ /* This value is invalid in many fonts, as */ /* it is usually set by the font designer, */ /* and often reflects only a portion of the */ /* glyphs found in the font (maybe ASCII). */ /* */ /* You should use the `sTypoDescender' */ /* field of the `OS/2' table instead if you */ /* want the correct one. */ /* */ /* Line_Gap :: The font's line gap, i.e., the distance */ /* to add to the ascender and descender to */ /* get the BTB, i.e., the */ /* baseline-to-baseline distance for the */ /* font. */ /* */ /* advance_Width_Max :: This field is the maximum of all advance */ /* widths found in the font. It can be */ /* used to compute the maximum width of an */ /* arbitrary string of text. */ /* */ /* min_Left_Side_Bearing :: The minimum left side bearing of all */ /* glyphs within the font. */ /* */ /* min_Right_Side_Bearing :: The minimum right side bearing of all */ /* glyphs within the font. */ /* */ /* xMax_Extent :: The maximum horizontal extent (i.e., the */ /* `width' of a glyph's bounding box) for */ /* all glyphs in the font. */ /* */ /* caret_Slope_Rise :: The rise coefficient of the cursor's */ /* slope of the cursor (slope=rise/run). */ /* */ /* caret_Slope_Run :: The run coefficient of the cursor's */ /* slope. */ /* */ /* caret_Offset :: The cursor's offset for slanted fonts. */ /* */ /* Reserved :: 8~reserved bytes. */ /* */ /* metric_Data_Format :: Always~0. */ /* */ /* number_Of_HMetrics :: Number of HMetrics entries in the `hmtx' */ /* table -- this value can be smaller than */ /* the total number of glyphs in the font. */ /* */ /* long_metrics :: A pointer into the `hmtx' table. */ /* */ /* short_metrics :: A pointer into the `hmtx' table. */ /* */ /* <Note> */ /* For an OpenType variation font, the values of the following fields */ /* can change after a call to @FT_Set_Var_Design_Coordinates (and */ /* friends) if the font contains an `MVAR' table: `caret_Slope_Rise', */ /* `caret_Slope_Run', and `caret_Offset'. */ /* */ typedef struct TT_HoriHeader_ { FT_Fixed Version; FT_Short Ascender; FT_Short Descender; FT_Short Line_Gap; FT_UShort advance_Width_Max; /* advance width maximum */ FT_Short min_Left_Side_Bearing; /* minimum left-sb */ FT_Short min_Right_Side_Bearing; /* minimum right-sb */ FT_Short xMax_Extent; /* xmax extents */ FT_Short caret_Slope_Rise; FT_Short caret_Slope_Run; FT_Short caret_Offset; FT_Short Reserved[4]; FT_Short metric_Data_Format; FT_UShort number_Of_HMetrics; /* The following fields are not defined by the OpenType specification */ /* but they are used to connect the metrics header to the relevant */ /* `hmtx' table. */ void* long_metrics; void* short_metrics; } TT_HoriHeader; /*************************************************************************/ /* */ /* <Struct> */ /* TT_VertHeader */ /* */ /* <Description> */ /* A structure used to model a TrueType vertical header, the `vhea' */ /* table, as well as the corresponding vertical metrics table, */ /* `vmtx'. */ /* */ /* <Fields> */ /* Version :: The table version. */ /* */ /* Ascender :: The font's ascender, i.e., the distance */ /* from the baseline to the top-most of */ /* all glyph points found in the font. */ /* */ /* This value is invalid in many fonts, as */ /* it is usually set by the font designer, */ /* and often reflects only a portion of */ /* the glyphs found in the font (maybe */ /* ASCII). */ /* */ /* You should use the `sTypoAscender' */ /* field of the `OS/2' table instead if */ /* you want the correct one. */ /* */ /* Descender :: The font's descender, i.e., the */ /* distance from the baseline to the */ /* bottom-most of all glyph points found */ /* in the font. It is negative. */ /* */ /* This value is invalid in many fonts, as */ /* it is usually set by the font designer, */ /* and often reflects only a portion of */ /* the glyphs found in the font (maybe */ /* ASCII). */ /* */ /* You should use the `sTypoDescender' */ /* field of the `OS/2' table instead if */ /* you want the correct one. */ /* */ /* Line_Gap :: The font's line gap, i.e., the distance */ /* to add to the ascender and descender to */ /* get the BTB, i.e., the */ /* baseline-to-baseline distance for the */ /* font. */ /* */ /* advance_Height_Max :: This field is the maximum of all */ /* advance heights found in the font. It */ /* can be used to compute the maximum */ /* height of an arbitrary string of text. */ /* */ /* min_Top_Side_Bearing :: The minimum top side bearing of all */ /* glyphs within the font. */ /* */ /* min_Bottom_Side_Bearing :: The minimum bottom side bearing of all */ /* glyphs within the font. */ /* */ /* yMax_Extent :: The maximum vertical extent (i.e., the */ /* `height' of a glyph's bounding box) for */ /* all glyphs in the font. */ /* */ /* caret_Slope_Rise :: The rise coefficient of the cursor's */ /* slope of the cursor (slope=rise/run). */ /* */ /* caret_Slope_Run :: The run coefficient of the cursor's */ /* slope. */ /* */ /* caret_Offset :: The cursor's offset for slanted fonts. */ /* */ /* Reserved :: 8~reserved bytes. */ /* */ /* metric_Data_Format :: Always~0. */ /* */ /* number_Of_VMetrics :: Number of VMetrics entries in the */ /* `vmtx' table -- this value can be */ /* smaller than the total number of glyphs */ /* in the font. */ /* */ /* long_metrics :: A pointer into the `vmtx' table. */ /* */ /* short_metrics :: A pointer into the `vmtx' table. */ /* */ /* <Note> */ /* For an OpenType variation font, the values of the following fields */ /* can change after a call to @FT_Set_Var_Design_Coordinates (and */ /* friends) if the font contains an `MVAR' table: `Ascender', */ /* `Descender', `Line_Gap', `caret_Slope_Rise', `caret_Slope_Run', */ /* and `caret_Offset'. */ /* */ typedef struct TT_VertHeader_ { FT_Fixed Version; FT_Short Ascender; FT_Short Descender; FT_Short Line_Gap; FT_UShort advance_Height_Max; /* advance height maximum */ FT_Short min_Top_Side_Bearing; /* minimum top-sb */ FT_Short min_Bottom_Side_Bearing; /* minimum bottom-sb */ FT_Short yMax_Extent; /* ymax extents */ FT_Short caret_Slope_Rise; FT_Short caret_Slope_Run; FT_Short caret_Offset; FT_Short Reserved[4]; FT_Short metric_Data_Format; FT_UShort number_Of_VMetrics; /* The following fields are not defined by the OpenType specification */ /* but they are used to connect the metrics header to the relevant */ /* `vmtx' table. */ void* long_metrics; void* short_metrics; } TT_VertHeader; /*************************************************************************/ /* */ /* <Struct> */ /* TT_OS2 */ /* */ /* <Description> */ /* A structure to model a TrueType `OS/2' table. All fields comply */ /* to the OpenType specification. */ /* */ /* Note that we now support old Mac fonts that do not include an */ /* `OS/2' table. In this case, the `version' field is always set to */ /* 0xFFFF. */ /* */ /* <Note> */ /* For an OpenType variation font, the values of the following fields */ /* can change after a call to @FT_Set_Var_Design_Coordinates (and */ /* friends) if the font contains an `MVAR' table: `sCapHeight', */ /* `sTypoAscender', `sTypoDescender', `sTypoLineGap', `sxHeight', */ /* `usWinAscent', `usWinDescent', `yStrikeoutPosition', */ /* `yStrikeoutSize', `ySubscriptXOffset', `ySubScriptXSize', */ /* `ySubscriptYOffset', `ySubscriptYSize', `ySuperscriptXOffset', */ /* `ySuperscriptXSize', `ySuperscriptYOffset', and */ /* `ySuperscriptYSize'. */ /* */ /* Possible values for bits in the `ulUnicodeRangeX' fields are given */ /* by the @TT_UCR_XXX macros. */ /* */ typedef struct TT_OS2_ { FT_UShort version; /* 0x0001 - more or 0xFFFF */ FT_Short xAvgCharWidth; FT_UShort usWeightClass; FT_UShort usWidthClass; FT_Short fsType; FT_Short ySubscriptXSize; FT_Short ySubscriptYSize; FT_Short ySubscriptXOffset; FT_Short ySubscriptYOffset; FT_Short ySuperscriptXSize; FT_Short ySuperscriptYSize; FT_Short ySuperscriptXOffset; FT_Short ySuperscriptYOffset; FT_Short yStrikeoutSize; FT_Short yStrikeoutPosition; FT_Short sFamilyClass; FT_Byte panose[10]; FT_ULong ulUnicodeRange1; /* Bits 0-31 */ FT_ULong ulUnicodeRange2; /* Bits 32-63 */ FT_ULong ulUnicodeRange3; /* Bits 64-95 */ FT_ULong ulUnicodeRange4; /* Bits 96-127 */ FT_Char achVendID[4]; FT_UShort fsSelection; FT_UShort usFirstCharIndex; FT_UShort usLastCharIndex; FT_Short sTypoAscender; FT_Short sTypoDescender; FT_Short sTypoLineGap; FT_UShort usWinAscent; FT_UShort usWinDescent; /* only version 1 and higher: */ FT_ULong ulCodePageRange1; /* Bits 0-31 */ FT_ULong ulCodePageRange2; /* Bits 32-63 */ /* only version 2 and higher: */ FT_Short sxHeight; FT_Short sCapHeight; FT_UShort usDefaultChar; FT_UShort usBreakChar; FT_UShort usMaxContext; } TT_OS2; /*************************************************************************/ /* */ /* <Struct> */ /* TT_Postscript */ /* */ /* <Description> */ /* A structure to model a TrueType `post' table. All fields comply */ /* to the OpenType specification. This structure does not reference */ /* a font's PostScript glyph names; use @FT_Get_Glyph_Name to */ /* retrieve them. */ /* */ /* <Note> */ /* For an OpenType variation font, the values of the following fields */ /* can change after a call to @FT_Set_Var_Design_Coordinates (and */ /* friends) if the font contains an `MVAR' table: `underlinePosition' */ /* and `underlineThickness'. */ /* */ typedef struct TT_Postscript_ { FT_Fixed FormatType; FT_Fixed italicAngle; FT_Short underlinePosition; FT_Short underlineThickness; FT_ULong isFixedPitch; FT_ULong minMemType42; FT_ULong maxMemType42; FT_ULong minMemType1; FT_ULong maxMemType1; /* Glyph names follow in the `post' table, but we don't */ /* load them by default. */ } TT_Postscript; /*************************************************************************/ /* */ /* <Struct> */ /* TT_PCLT */ /* */ /* <Description> */ /* A structure to model a TrueType `PCLT' table. All fields comply */ /* to the OpenType specification. */ /* */ typedef struct TT_PCLT_ { FT_Fixed Version; FT_ULong FontNumber; FT_UShort Pitch; FT_UShort xHeight; FT_UShort Style; FT_UShort TypeFamily; FT_UShort CapHeight; FT_UShort SymbolSet; FT_Char TypeFace[16]; FT_Char CharacterComplement[8]; FT_Char FileName[6]; FT_Char StrokeWeight; FT_Char WidthType; FT_Byte SerifStyle; FT_Byte Reserved; } TT_PCLT; /*************************************************************************/ /* */ /* <Struct> */ /* TT_MaxProfile */ /* */ /* <Description> */ /* The maximum profile (`maxp') table contains many max values, which */ /* can be used to pre-allocate arrays for speeding up glyph loading */ /* and hinting. */ /* */ /* <Fields> */ /* version :: The version number. */ /* */ /* numGlyphs :: The number of glyphs in this TrueType */ /* font. */ /* */ /* maxPoints :: The maximum number of points in a */ /* non-composite TrueType glyph. See also */ /* `maxCompositePoints'. */ /* */ /* maxContours :: The maximum number of contours in a */ /* non-composite TrueType glyph. See also */ /* `maxCompositeContours'. */ /* */ /* maxCompositePoints :: The maximum number of points in a */ /* composite TrueType glyph. See also */ /* `maxPoints'. */ /* */ /* maxCompositeContours :: The maximum number of contours in a */ /* composite TrueType glyph. See also */ /* `maxContours'. */ /* */ /* maxZones :: The maximum number of zones used for */ /* glyph hinting. */ /* */ /* maxTwilightPoints :: The maximum number of points in the */ /* twilight zone used for glyph hinting. */ /* */ /* maxStorage :: The maximum number of elements in the */ /* storage area used for glyph hinting. */ /* */ /* maxFunctionDefs :: The maximum number of function */ /* definitions in the TrueType bytecode for */ /* this font. */ /* */ /* maxInstructionDefs :: The maximum number of instruction */ /* definitions in the TrueType bytecode for */ /* this font. */ /* */ /* maxStackElements :: The maximum number of stack elements used */ /* during bytecode interpretation. */ /* */ /* maxSizeOfInstructions :: The maximum number of TrueType opcodes */ /* used for glyph hinting. */ /* */ /* maxComponentElements :: The maximum number of simple (i.e., non- */ /* composite) glyphs in a composite glyph. */ /* */ /* maxComponentDepth :: The maximum nesting depth of composite */ /* glyphs. */ /* */ /* <Note> */ /* This structure is only used during font loading. */ /* */ typedef struct TT_MaxProfile_ { FT_Fixed version; FT_UShort numGlyphs; FT_UShort maxPoints; FT_UShort maxContours; FT_UShort maxCompositePoints; FT_UShort maxCompositeContours; FT_UShort maxZones; FT_UShort maxTwilightPoints; FT_UShort maxStorage; FT_UShort maxFunctionDefs; FT_UShort maxInstructionDefs; FT_UShort maxStackElements; FT_UShort maxSizeOfInstructions; FT_UShort maxComponentElements; FT_UShort maxComponentDepth; } TT_MaxProfile; /*************************************************************************/ /* */ /* <Enum> */ /* FT_Sfnt_Tag */ /* */ /* <Description> */ /* An enumeration to specify indices of SFNT tables loaded and parsed */ /* by FreeType during initialization of an SFNT font. Used in the */ /* @FT_Get_Sfnt_Table API function. */ /* */ /* <Values> */ /* ft_sfnt_head :: To access the font's @TT_Header structure. */ /* */ /* ft_sfnt_maxp :: To access the font's @TT_MaxProfile structure. */ /* */ /* ft_sfnt_os2 :: To access the font's @TT_OS2 structure. */ /* */ /* ft_sfnt_hhea :: To access the font's @TT_HoriHeader structure. */ /* */ /* ft_sfnt_vhea :: To access the font's @TT_VertHeader structure. */ /* */ /* ft_sfnt_post :: To access the font's @TT_Postscript structure. */ /* */ /* ft_sfnt_pclt :: To access the font's @TT_PCLT structure. */ /* */ typedef enum FT_Sfnt_Tag_ { ft_sfnt_head = 0, ft_sfnt_maxp = 1, ft_sfnt_os2 = 2, ft_sfnt_hhea = 3, ft_sfnt_vhea = 4, ft_sfnt_post = 5, ft_sfnt_pclt = 6, sfnt_max } FT_Sfnt_Tag; #define FT_SFNT_HEAD ft_sfnt_head #define FT_SFNT_MAXP ft_sfnt_maxp #define FT_SFNT_OS2 ft_sfnt_os2 #define FT_SFNT_HHEA ft_sfnt_hhea #define FT_SFNT_VHEA ft_sfnt_vhea #define FT_SFNT_POST ft_sfnt_post #define FT_SFNT_PCLT ft_sfnt_pclt /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_Sfnt_Table */ /* */ /* <Description> */ /* Return a pointer to a given SFNT table stored within a face. */ /* */ /* <Input> */ /* face :: A handle to the source. */ /* */ /* tag :: The index of the SFNT table. */ /* */ /* <Return> */ /* A type-less pointer to the table. This will be NULL in case of */ /* error, or if the corresponding table was not found *OR* loaded */ /* from the file. */ /* */ /* Use a typecast according to `tag' to access the structure */ /* elements. */ /* */ /* <Note> */ /* The table is owned by the face object and disappears with it. */ /* */ /* This function is only useful to access SFNT tables that are loaded */ /* by the sfnt, truetype, and opentype drivers. See @FT_Sfnt_Tag for */ /* a list. */ /* */ /* Here an example how to access the `vhea' table: */ /* */ /* { */ /* TT_VertHeader* vert_header; */ /* */ /* */ /* vert_header = */ /* (TT_VertHeader*)FT_Get_Sfnt_Table( face, FT_SFNT_VHEA ); */ /* } */ /* */ FT_EXPORT( void* ) FT_Get_Sfnt_Table( FT_Face face, FT_Sfnt_Tag tag ); /************************************************************************** * * @function: * FT_Load_Sfnt_Table * * @description: * Load any SFNT font table into client memory. * * @input: * face :: * A handle to the source face. * * tag :: * The four-byte tag of the table to load. Use value~0 if you want * to access the whole font file. Otherwise, you can use one of the * definitions found in the @FT_TRUETYPE_TAGS_H file, or forge a new * one with @FT_MAKE_TAG. * * offset :: * The starting offset in the table (or file if tag~==~0). * * @output: * buffer :: * The target buffer address. The client must ensure that the memory * array is big enough to hold the data. * * @inout: * length :: * If the `length' parameter is NULL, try to load the whole table. * Return an error code if it fails. * * Else, if `*length' is~0, exit immediately while returning the * table's (or file) full size in it. * * Else the number of bytes to read from the table or file, from the * starting offset. * * @return: * FreeType error code. 0~means success. * * @note: * If you need to determine the table's length you should first call this * function with `*length' set to~0, as in the following example: * * { * FT_ULong length = 0; * * * error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length ); * if ( error ) { ... table does not exist ... } * * buffer = malloc( length ); * if ( buffer == NULL ) { ... not enough memory ... } * * error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length ); * if ( error ) { ... could not load table ... } * } * * Note that structures like @TT_Header or @TT_OS2 can't be used with * this function; they are limited to @FT_Get_Sfnt_Table. Reason is that * those structures depend on the processor architecture, with varying * size (e.g. 32bit vs. 64bit) or order (big endian vs. little endian). * */ FT_EXPORT( FT_Error ) FT_Load_Sfnt_Table( FT_Face face, FT_ULong tag, FT_Long offset, FT_Byte* buffer, FT_ULong* length ); /************************************************************************** * * @function: * FT_Sfnt_Table_Info * * @description: * Return information on an SFNT table. * * @input: * face :: * A handle to the source face. * * table_index :: * The index of an SFNT table. The function returns * FT_Err_Table_Missing for an invalid value. * * @inout: * tag :: * The name tag of the SFNT table. If the value is NULL, `table_index' * is ignored, and `length' returns the number of SFNT tables in the * font. * * @output: * length :: * The length of the SFNT table (or the number of SFNT tables, depending * on `tag'). * * @return: * FreeType error code. 0~means success. * * @note: * While parsing fonts, FreeType handles SFNT tables with length zero as * missing. * */ FT_EXPORT( FT_Error ) FT_Sfnt_Table_Info( FT_Face face, FT_UInt table_index, FT_ULong *tag, FT_ULong *length ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_CMap_Language_ID */ /* */ /* <Description> */ /* Return cmap language ID as specified in the OpenType standard. */ /* Definitions of language ID values are in file @FT_TRUETYPE_IDS_H. */ /* */ /* <Input> */ /* charmap :: */ /* The target charmap. */ /* */ /* <Return> */ /* The language ID of `charmap'. If `charmap' doesn't belong to an */ /* SFNT face, just return~0 as the default value. */ /* */ /* For a format~14 cmap (to access Unicode IVS), the return value is */ /* 0xFFFFFFFF. */ /* */ FT_EXPORT( FT_ULong ) FT_Get_CMap_Language_ID( FT_CharMap charmap ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_CMap_Format */ /* */ /* <Description> */ /* Return the format of an SFNT `cmap' table. */ /* */ /* <Input> */ /* charmap :: */ /* The target charmap. */ /* */ /* <Return> */ /* The format of `charmap'. If `charmap' doesn't belong to an SFNT */ /* face, return -1. */ /* */ FT_EXPORT( FT_Long ) FT_Get_CMap_Format( FT_CharMap charmap ); /* */ FT_END_HEADER #endif /* TTTABLES_H_ */ /* END */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftmm.h���������������������������������������������������������������������������0000644�����������������00000073555�14763166026�0011442 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftmm.h */ /* */ /* FreeType Multiple Master font interface (specification). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTMM_H_ #define FTMM_H_ #include <ft2build.h> #include FT_TYPE1_TABLES_H FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* multiple_masters */ /* */ /* <Title> */ /* Multiple Masters */ /* */ /* <Abstract> */ /* How to manage Multiple Masters fonts. */ /* */ /* <Description> */ /* The following types and functions are used to manage Multiple */ /* Master fonts, i.e., the selection of specific design instances by */ /* setting design axis coordinates. */ /* */ /* Besides Adobe MM fonts, the interface supports Apple's TrueType GX */ /* and OpenType variation fonts. Some of the routines only work with */ /* Adobe MM fonts, others will work with all three types. They are */ /* similar enough that a consistent interface makes sense. */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Struct> */ /* FT_MM_Axis */ /* */ /* <Description> */ /* A structure to model a given axis in design space for Multiple */ /* Masters fonts. */ /* */ /* This structure can't be used for TrueType GX or OpenType variation */ /* fonts. */ /* */ /* <Fields> */ /* name :: The axis's name. */ /* */ /* minimum :: The axis's minimum design coordinate. */ /* */ /* maximum :: The axis's maximum design coordinate. */ /* */ typedef struct FT_MM_Axis_ { FT_String* name; FT_Long minimum; FT_Long maximum; } FT_MM_Axis; /*************************************************************************/ /* */ /* <Struct> */ /* FT_Multi_Master */ /* */ /* <Description> */ /* A structure to model the axes and space of a Multiple Masters */ /* font. */ /* */ /* This structure can't be used for TrueType GX or OpenType variation */ /* fonts. */ /* */ /* <Fields> */ /* num_axis :: Number of axes. Cannot exceed~4. */ /* */ /* num_designs :: Number of designs; should be normally 2^num_axis */ /* even though the Type~1 specification strangely */ /* allows for intermediate designs to be present. */ /* This number cannot exceed~16. */ /* */ /* axis :: A table of axis descriptors. */ /* */ typedef struct FT_Multi_Master_ { FT_UInt num_axis; FT_UInt num_designs; FT_MM_Axis axis[T1_MAX_MM_AXIS]; } FT_Multi_Master; /*************************************************************************/ /* */ /* <Struct> */ /* FT_Var_Axis */ /* */ /* <Description> */ /* A structure to model a given axis in design space for Multiple */ /* Masters, TrueType GX, and OpenType variation fonts. */ /* */ /* <Fields> */ /* name :: The axis's name. */ /* Not always meaningful for TrueType GX or OpenType */ /* variation fonts. */ /* */ /* minimum :: The axis's minimum design coordinate. */ /* */ /* def :: The axis's default design coordinate. */ /* FreeType computes meaningful default values for Adobe */ /* MM fonts. */ /* */ /* maximum :: The axis's maximum design coordinate. */ /* */ /* tag :: The axis's tag (the equivalent to `name' for TrueType */ /* GX and OpenType variation fonts). FreeType provides */ /* default values for Adobe MM fonts if possible. */ /* */ /* strid :: The axis name entry in the font's `name' table. This */ /* is another (and often better) version of the `name' */ /* field for TrueType GX or OpenType variation fonts. Not */ /* meaningful for Adobe MM fonts. */ /* */ /* <Note> */ /* The fields `minimum', `def', and `maximum' are 16.16 fractional */ /* values for TrueType GX and OpenType variation fonts. For Adobe MM */ /* fonts, the values are integers. */ /* */ typedef struct FT_Var_Axis_ { FT_String* name; FT_Fixed minimum; FT_Fixed def; FT_Fixed maximum; FT_ULong tag; FT_UInt strid; } FT_Var_Axis; /*************************************************************************/ /* */ /* <Struct> */ /* FT_Var_Named_Style */ /* */ /* <Description> */ /* A structure to model a named instance in a TrueType GX or OpenType */ /* variation font. */ /* */ /* This structure can't be used for Adobe MM fonts. */ /* */ /* <Fields> */ /* coords :: The design coordinates for this instance. */ /* This is an array with one entry for each axis. */ /* */ /* strid :: The entry in `name' table identifying this instance. */ /* */ typedef struct FT_Var_Named_Style_ { FT_Fixed* coords; FT_UInt strid; } FT_Var_Named_Style; /*************************************************************************/ /* */ /* <Struct> */ /* FT_MM_Var */ /* */ /* <Description> */ /* A structure to model the axes and space of a Adobe MM, TrueType */ /* GX, or OpenType variation font. */ /* */ /* Some fields are specific to one format and not to the others. */ /* */ /* <Fields> */ /* num_axis :: The number of axes. The maximum value is~4 for */ /* Adobe MM fonts; no limit in TrueType GX or */ /* OpenType variation fonts. */ /* */ /* num_designs :: The number of designs; should be normally */ /* 2^num_axis for Adobe MM fonts. Not meaningful */ /* for TrueType GX or OpenType variation fonts */ /* (where every glyph could have a different */ /* number of designs). */ /* */ /* num_namedstyles :: The number of named styles; a `named style' is */ /* a tuple of design coordinates that has a string */ /* ID (in the `name' table) associated with it. */ /* The font can tell the user that, for example, */ /* [Weight=1.5,Width=1.1] is `Bold'. Another name */ /* for `named style' is `named instance'. */ /* */ /* For Adobe Multiple Masters fonts, this value is */ /* always zero because the format does not support */ /* named styles. */ /* */ /* axis :: An axis descriptor table. */ /* TrueType GX and OpenType variation fonts */ /* contain slightly more data than Adobe MM fonts. */ /* Memory management of this pointer is done */ /* internally by FreeType. */ /* */ /* namedstyle :: A named style (instance) table. */ /* Only meaningful for TrueType GX and OpenType */ /* variation fonts. Memory management of this */ /* pointer is done internally by FreeType. */ /* */ typedef struct FT_MM_Var_ { FT_UInt num_axis; FT_UInt num_designs; FT_UInt num_namedstyles; FT_Var_Axis* axis; FT_Var_Named_Style* namedstyle; } FT_MM_Var; /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_Multi_Master */ /* */ /* <Description> */ /* Retrieve a variation descriptor of a given Adobe MM font. */ /* */ /* This function can't be used with TrueType GX or OpenType variation */ /* fonts. */ /* */ /* <Input> */ /* face :: A handle to the source face. */ /* */ /* <Output> */ /* amaster :: The Multiple Masters descriptor. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Get_Multi_Master( FT_Face face, FT_Multi_Master *amaster ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_MM_Var */ /* */ /* <Description> */ /* Retrieve a variation descriptor for a given font. */ /* */ /* This function works with all supported variation formats. */ /* */ /* <Input> */ /* face :: A handle to the source face. */ /* */ /* <Output> */ /* amaster :: The variation descriptor. */ /* Allocates a data structure, which the user must */ /* deallocate with `free' after use. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Get_MM_Var( FT_Face face, FT_MM_Var* *amaster ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Set_MM_Design_Coordinates */ /* */ /* <Description> */ /* For Adobe MM fonts, choose an interpolated font design through */ /* design coordinates. */ /* */ /* This function can't be used with TrueType GX or OpenType variation */ /* fonts. */ /* */ /* <InOut> */ /* face :: A handle to the source face. */ /* */ /* <Input> */ /* num_coords :: The number of available design coordinates. If it */ /* is larger than the number of axes, ignore the excess */ /* values. If it is smaller than the number of axes, */ /* use default values for the remaining axes. */ /* */ /* coords :: An array of design coordinates. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Set_MM_Design_Coordinates( FT_Face face, FT_UInt num_coords, FT_Long* coords ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Set_Var_Design_Coordinates */ /* */ /* <Description> */ /* Choose an interpolated font design through design coordinates. */ /* */ /* This function works with all supported variation formats. */ /* */ /* <InOut> */ /* face :: A handle to the source face. */ /* */ /* <Input> */ /* num_coords :: The number of available design coordinates. If it */ /* is larger than the number of axes, ignore the excess */ /* values. If it is smaller than the number of axes, */ /* use default values for the remaining axes. */ /* */ /* coords :: An array of design coordinates. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Set_Var_Design_Coordinates( FT_Face face, FT_UInt num_coords, FT_Fixed* coords ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_Var_Design_Coordinates */ /* */ /* <Description> */ /* Get the design coordinates of the currently selected interpolated */ /* font. */ /* */ /* This function works with all supported variation formats. */ /* */ /* <Input> */ /* face :: A handle to the source face. */ /* */ /* num_coords :: The number of design coordinates to retrieve. If it */ /* is larger than the number of axes, set the excess */ /* values to~0. */ /* */ /* <Output> */ /* coords :: The design coordinates array. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Get_Var_Design_Coordinates( FT_Face face, FT_UInt num_coords, FT_Fixed* coords ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Set_MM_Blend_Coordinates */ /* */ /* <Description> */ /* Choose an interpolated font design through normalized blend */ /* coordinates. */ /* */ /* This function works with all supported variation formats. */ /* */ /* <InOut> */ /* face :: A handle to the source face. */ /* */ /* <Input> */ /* num_coords :: The number of available design coordinates. If it */ /* is larger than the number of axes, ignore the excess */ /* values. If it is smaller than the number of axes, */ /* use default values for the remaining axes. */ /* */ /* coords :: The design coordinates array (each element must be */ /* between 0 and 1.0 for Adobe MM fonts, and between */ /* -1.0 and 1.0 for TrueType GX and OpenType variation */ /* fonts). */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Set_MM_Blend_Coordinates( FT_Face face, FT_UInt num_coords, FT_Fixed* coords ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_MM_Blend_Coordinates */ /* */ /* <Description> */ /* Get the normalized blend coordinates of the currently selected */ /* interpolated font. */ /* */ /* This function works with all supported variation formats. */ /* */ /* <Input> */ /* face :: A handle to the source face. */ /* */ /* num_coords :: The number of normalized blend coordinates to */ /* retrieve. If it is larger than the number of axes, */ /* set the excess values to~0.5 for Adobe MM fonts, and */ /* to~0 for TrueType GX and OpenType variation fonts. */ /* */ /* <Output> */ /* coords :: The normalized blend coordinates array. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Get_MM_Blend_Coordinates( FT_Face face, FT_UInt num_coords, FT_Fixed* coords ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Set_Var_Blend_Coordinates */ /* */ /* <Description> */ /* This is another name of @FT_Set_MM_Blend_Coordinates. */ /* */ FT_EXPORT( FT_Error ) FT_Set_Var_Blend_Coordinates( FT_Face face, FT_UInt num_coords, FT_Fixed* coords ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_Var_Blend_Coordinates */ /* */ /* <Description> */ /* This is another name of @FT_Get_MM_Blend_Coordinates. */ /* */ FT_EXPORT( FT_Error ) FT_Get_Var_Blend_Coordinates( FT_Face face, FT_UInt num_coords, FT_Fixed* coords ); /* */ FT_END_HEADER #endif /* FTMM_H_ */ /* END */ ���������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/freetype.h�����������������������������������������������������������������������0000644�����������������00001057677�14763166026�0012332 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* freetype.h */ /* */ /* FreeType high-level API and common types (specification only). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FREETYPE_H_ #define FREETYPE_H_ #ifndef FT_FREETYPE_H #error "`ft2build.h' hasn't been included yet!" #error "Please always use macros to include FreeType header files." #error "Example:" #error " #include <ft2build.h>" #error " #include FT_FREETYPE_H" #endif #include <ft2build.h> #include FT_CONFIG_CONFIG_H #include FT_TYPES_H #include FT_ERRORS_H FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* header_inclusion */ /* */ /* <Title> */ /* FreeType's header inclusion scheme */ /* */ /* <Abstract> */ /* How client applications should include FreeType header files. */ /* */ /* <Description> */ /* To be as flexible as possible (and for historical reasons), */ /* FreeType uses a very special inclusion scheme to load header */ /* files, for example */ /* */ /* { */ /* #include <ft2build.h> */ /* */ /* #include FT_FREETYPE_H */ /* #include FT_OUTLINE_H */ /* } */ /* */ /* A compiler and its preprocessor only needs an include path to find */ /* the file `ft2build.h'; the exact locations and names of the other */ /* FreeType header files are hidden by preprocessor macro names, */ /* loaded by `ft2build.h'. The API documentation always gives the */ /* header macro name needed for a particular function. */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Section> */ /* user_allocation */ /* */ /* <Title> */ /* User allocation */ /* */ /* <Abstract> */ /* How client applications should allocate FreeType data structures. */ /* */ /* <Description> */ /* FreeType assumes that structures allocated by the user and passed */ /* as arguments are zeroed out except for the actual data. In other */ /* words, it is recommended to use `calloc' (or variants of it) */ /* instead of `malloc' for allocation. */ /* */ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* B A S I C T Y P E S */ /* */ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* <Section> */ /* base_interface */ /* */ /* <Title> */ /* Base Interface */ /* */ /* <Abstract> */ /* The FreeType~2 base font interface. */ /* */ /* <Description> */ /* This section describes the most important public high-level API */ /* functions of FreeType~2. */ /* */ /* <Order> */ /* FT_Library */ /* FT_Face */ /* FT_Size */ /* FT_GlyphSlot */ /* FT_CharMap */ /* FT_Encoding */ /* FT_ENC_TAG */ /* */ /* FT_FaceRec */ /* */ /* FT_FACE_FLAG_SCALABLE */ /* FT_FACE_FLAG_FIXED_SIZES */ /* FT_FACE_FLAG_FIXED_WIDTH */ /* FT_FACE_FLAG_HORIZONTAL */ /* FT_FACE_FLAG_VERTICAL */ /* FT_FACE_FLAG_COLOR */ /* FT_FACE_FLAG_SFNT */ /* FT_FACE_FLAG_CID_KEYED */ /* FT_FACE_FLAG_TRICKY */ /* FT_FACE_FLAG_KERNING */ /* FT_FACE_FLAG_MULTIPLE_MASTERS */ /* FT_FACE_FLAG_GLYPH_NAMES */ /* FT_FACE_FLAG_EXTERNAL_STREAM */ /* FT_FACE_FLAG_HINTER */ /* */ /* FT_HAS_HORIZONTAL */ /* FT_HAS_VERTICAL */ /* FT_HAS_KERNING */ /* FT_HAS_FIXED_SIZES */ /* FT_HAS_GLYPH_NAMES */ /* FT_HAS_MULTIPLE_MASTERS */ /* FT_HAS_COLOR */ /* */ /* FT_IS_SFNT */ /* FT_IS_SCALABLE */ /* FT_IS_FIXED_WIDTH */ /* FT_IS_CID_KEYED */ /* FT_IS_TRICKY */ /* */ /* FT_STYLE_FLAG_BOLD */ /* FT_STYLE_FLAG_ITALIC */ /* */ /* FT_SizeRec */ /* FT_Size_Metrics */ /* */ /* FT_GlyphSlotRec */ /* FT_Glyph_Metrics */ /* FT_SubGlyph */ /* */ /* FT_Bitmap_Size */ /* */ /* FT_Init_FreeType */ /* FT_Done_FreeType */ /* */ /* FT_New_Face */ /* FT_Done_Face */ /* FT_Reference_Face */ /* FT_New_Memory_Face */ /* FT_Face_Properties */ /* FT_Open_Face */ /* FT_Open_Args */ /* FT_Parameter */ /* FT_Attach_File */ /* FT_Attach_Stream */ /* */ /* FT_Set_Char_Size */ /* FT_Set_Pixel_Sizes */ /* FT_Request_Size */ /* FT_Select_Size */ /* FT_Size_Request_Type */ /* FT_Size_RequestRec */ /* FT_Size_Request */ /* FT_Set_Transform */ /* FT_Load_Glyph */ /* FT_Get_Char_Index */ /* FT_Get_First_Char */ /* FT_Get_Next_Char */ /* FT_Get_Name_Index */ /* FT_Load_Char */ /* */ /* FT_OPEN_MEMORY */ /* FT_OPEN_STREAM */ /* FT_OPEN_PATHNAME */ /* FT_OPEN_DRIVER */ /* FT_OPEN_PARAMS */ /* */ /* FT_LOAD_DEFAULT */ /* FT_LOAD_RENDER */ /* FT_LOAD_MONOCHROME */ /* FT_LOAD_LINEAR_DESIGN */ /* FT_LOAD_NO_SCALE */ /* FT_LOAD_NO_HINTING */ /* FT_LOAD_NO_BITMAP */ /* FT_LOAD_NO_AUTOHINT */ /* FT_LOAD_COLOR */ /* */ /* FT_LOAD_VERTICAL_LAYOUT */ /* FT_LOAD_IGNORE_TRANSFORM */ /* FT_LOAD_FORCE_AUTOHINT */ /* FT_LOAD_NO_RECURSE */ /* FT_LOAD_PEDANTIC */ /* */ /* FT_LOAD_TARGET_NORMAL */ /* FT_LOAD_TARGET_LIGHT */ /* FT_LOAD_TARGET_MONO */ /* FT_LOAD_TARGET_LCD */ /* FT_LOAD_TARGET_LCD_V */ /* */ /* FT_LOAD_TARGET_MODE */ /* */ /* FT_Render_Glyph */ /* FT_Render_Mode */ /* FT_Get_Kerning */ /* FT_Kerning_Mode */ /* FT_Get_Track_Kerning */ /* FT_Get_Glyph_Name */ /* FT_Get_Postscript_Name */ /* */ /* FT_CharMapRec */ /* FT_Select_Charmap */ /* FT_Set_Charmap */ /* FT_Get_Charmap_Index */ /* */ /* FT_Get_FSType_Flags */ /* FT_Get_SubGlyph_Info */ /* */ /* FT_Face_Internal */ /* FT_Size_Internal */ /* FT_Slot_Internal */ /* */ /* FT_FACE_FLAG_XXX */ /* FT_STYLE_FLAG_XXX */ /* FT_OPEN_XXX */ /* FT_LOAD_XXX */ /* FT_LOAD_TARGET_XXX */ /* FT_SUBGLYPH_FLAG_XXX */ /* FT_FSTYPE_XXX */ /* */ /* FT_HAS_FAST_GLYPHS */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Struct> */ /* FT_Glyph_Metrics */ /* */ /* <Description> */ /* A structure to model the metrics of a single glyph. The values */ /* are expressed in 26.6 fractional pixel format; if the flag */ /* @FT_LOAD_NO_SCALE has been used while loading the glyph, values */ /* are expressed in font units instead. */ /* */ /* <Fields> */ /* width :: */ /* The glyph's width. */ /* */ /* height :: */ /* The glyph's height. */ /* */ /* horiBearingX :: */ /* Left side bearing for horizontal layout. */ /* */ /* horiBearingY :: */ /* Top side bearing for horizontal layout. */ /* */ /* horiAdvance :: */ /* Advance width for horizontal layout. */ /* */ /* vertBearingX :: */ /* Left side bearing for vertical layout. */ /* */ /* vertBearingY :: */ /* Top side bearing for vertical layout. Larger positive values */ /* mean further below the vertical glyph origin. */ /* */ /* vertAdvance :: */ /* Advance height for vertical layout. Positive values mean the */ /* glyph has a positive advance downward. */ /* */ /* <Note> */ /* If not disabled with @FT_LOAD_NO_HINTING, the values represent */ /* dimensions of the hinted glyph (in case hinting is applicable). */ /* */ /* Stroking a glyph with an outside border does not increase */ /* `horiAdvance' or `vertAdvance'; you have to manually adjust these */ /* values to account for the added width and height. */ /* */ /* FreeType doesn't use the `VORG' table data for CFF fonts because */ /* it doesn't have an interface to quickly retrieve the glyph height. */ /* The y~coordinate of the vertical origin can be simply computed as */ /* `vertBearingY + height' after loading a glyph. */ /* */ typedef struct FT_Glyph_Metrics_ { FT_Pos width; FT_Pos height; FT_Pos horiBearingX; FT_Pos horiBearingY; FT_Pos horiAdvance; FT_Pos vertBearingX; FT_Pos vertBearingY; FT_Pos vertAdvance; } FT_Glyph_Metrics; /*************************************************************************/ /* */ /* <Struct> */ /* FT_Bitmap_Size */ /* */ /* <Description> */ /* This structure models the metrics of a bitmap strike (i.e., a set */ /* of glyphs for a given point size and resolution) in a bitmap font. */ /* It is used for the `available_sizes' field of @FT_Face. */ /* */ /* <Fields> */ /* height :: The vertical distance, in pixels, between two */ /* consecutive baselines. It is always positive. */ /* */ /* width :: The average width, in pixels, of all glyphs in the */ /* strike. */ /* */ /* size :: The nominal size of the strike in 26.6 fractional */ /* points. This field is not very useful. */ /* */ /* x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional */ /* pixels. */ /* */ /* y_ppem :: The vertical ppem (nominal height) in 26.6 fractional */ /* pixels. */ /* */ /* <Note> */ /* Windows FNT: */ /* The nominal size given in a FNT font is not reliable. If the */ /* driver finds it incorrect, it sets `size' to some calculated */ /* values, and `x_ppem' and `y_ppem' to the pixel width and height */ /* given in the font, respectively. */ /* */ /* TrueType embedded bitmaps: */ /* `size', `width', and `height' values are not contained in the */ /* bitmap strike itself. They are computed from the global font */ /* parameters. */ /* */ typedef struct FT_Bitmap_Size_ { FT_Short height; FT_Short width; FT_Pos size; FT_Pos x_ppem; FT_Pos y_ppem; } FT_Bitmap_Size; /*************************************************************************/ /*************************************************************************/ /* */ /* O B J E C T C L A S S E S */ /* */ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* <Type> */ /* FT_Library */ /* */ /* <Description> */ /* A handle to a FreeType library instance. Each `library' is */ /* completely independent from the others; it is the `root' of a set */ /* of objects like fonts, faces, sizes, etc. */ /* */ /* It also embeds a memory manager (see @FT_Memory), as well as a */ /* scan-line converter object (see @FT_Raster). */ /* */ /* In multi-threaded applications it is easiest to use one */ /* `FT_Library' object per thread. In case this is too cumbersome, */ /* a single `FT_Library' object across threads is possible also */ /* (since FreeType version 2.5.6), as long as a mutex lock is used */ /* around @FT_New_Face and @FT_Done_Face. */ /* */ /* <Note> */ /* Library objects are normally created by @FT_Init_FreeType, and */ /* destroyed with @FT_Done_FreeType. If you need reference-counting */ /* (cf. @FT_Reference_Library), use @FT_New_Library and */ /* @FT_Done_Library. */ /* */ typedef struct FT_LibraryRec_ *FT_Library; /*************************************************************************/ /* */ /* <Section> */ /* module_management */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Type> */ /* FT_Module */ /* */ /* <Description> */ /* A handle to a given FreeType module object. A module can be a */ /* font driver, a renderer, or anything else that provides services */ /* to the former. */ /* */ typedef struct FT_ModuleRec_* FT_Module; /*************************************************************************/ /* */ /* <Type> */ /* FT_Driver */ /* */ /* <Description> */ /* A handle to a given FreeType font driver object. A font driver */ /* is a module capable of creating faces from font files. */ /* */ typedef struct FT_DriverRec_* FT_Driver; /*************************************************************************/ /* */ /* <Type> */ /* FT_Renderer */ /* */ /* <Description> */ /* A handle to a given FreeType renderer. A renderer is a module in */ /* charge of converting a glyph's outline image to a bitmap. It */ /* supports a single glyph image format, and one or more target */ /* surface depths. */ /* */ typedef struct FT_RendererRec_* FT_Renderer; /*************************************************************************/ /* */ /* <Section> */ /* base_interface */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Type> */ /* FT_Face */ /* */ /* <Description> */ /* A handle to a typographic face object. A face object models a */ /* given typeface, in a given style. */ /* */ /* <Note> */ /* A face object also owns a single @FT_GlyphSlot object, as well */ /* as one or more @FT_Size objects. */ /* */ /* Use @FT_New_Face or @FT_Open_Face to create a new face object from */ /* a given filepath or a custom input stream. */ /* */ /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */ /* */ /* An `FT_Face' object can only be safely used from one thread at a */ /* time. Similarly, creation and destruction of `FT_Face' with the */ /* same @FT_Library object can only be done from one thread at a */ /* time. On the other hand, functions like @FT_Load_Glyph and its */ /* siblings are thread-safe and do not need the lock to be held as */ /* long as the same `FT_Face' object is not used from multiple */ /* threads at the same time. */ /* */ /* <Also> */ /* See @FT_FaceRec for the publicly accessible fields of a given face */ /* object. */ /* */ typedef struct FT_FaceRec_* FT_Face; /*************************************************************************/ /* */ /* <Type> */ /* FT_Size */ /* */ /* <Description> */ /* A handle to an object that models a face scaled to a given */ /* character size. */ /* */ /* <Note> */ /* An @FT_Face has one _active_ @FT_Size object that is used by */ /* functions like @FT_Load_Glyph to determine the scaling */ /* transformation that in turn is used to load and hint glyphs and */ /* metrics. */ /* */ /* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, */ /* @FT_Request_Size or even @FT_Select_Size to change the content */ /* (i.e., the scaling values) of the active @FT_Size. */ /* */ /* You can use @FT_New_Size to create additional size objects for a */ /* given @FT_Face, but they won't be used by other functions until */ /* you activate it through @FT_Activate_Size. Only one size can be */ /* activated at any given time per face. */ /* */ /* <Also> */ /* See @FT_SizeRec for the publicly accessible fields of a given size */ /* object. */ /* */ typedef struct FT_SizeRec_* FT_Size; /*************************************************************************/ /* */ /* <Type> */ /* FT_GlyphSlot */ /* */ /* <Description> */ /* A handle to a given `glyph slot'. A slot is a container that can */ /* hold any of the glyphs contained in its parent face. */ /* */ /* In other words, each time you call @FT_Load_Glyph or */ /* @FT_Load_Char, the slot's content is erased by the new glyph data, */ /* i.e., the glyph's metrics, its image (bitmap or outline), and */ /* other control information. */ /* */ /* <Also> */ /* See @FT_GlyphSlotRec for the publicly accessible glyph fields. */ /* */ typedef struct FT_GlyphSlotRec_* FT_GlyphSlot; /*************************************************************************/ /* */ /* <Type> */ /* FT_CharMap */ /* */ /* <Description> */ /* A handle to a character map (usually abbreviated to `charmap'). A */ /* charmap is used to translate character codes in a given encoding */ /* into glyph indexes for its parent's face. Some font formats may */ /* provide several charmaps per font. */ /* */ /* Each face object owns zero or more charmaps, but only one of them */ /* can be `active', providing the data used by @FT_Get_Char_Index or */ /* @FT_Load_Char. */ /* */ /* The list of available charmaps in a face is available through the */ /* `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec. */ /* */ /* The currently active charmap is available as `face->charmap'. */ /* You should call @FT_Set_Charmap to change it. */ /* */ /* <Note> */ /* When a new face is created (either through @FT_New_Face or */ /* @FT_Open_Face), the library looks for a Unicode charmap within */ /* the list and automatically activates it. */ /* */ /* <Also> */ /* See @FT_CharMapRec for the publicly accessible fields of a given */ /* character map. */ /* */ typedef struct FT_CharMapRec_* FT_CharMap; /*************************************************************************/ /* */ /* <Macro> */ /* FT_ENC_TAG */ /* */ /* <Description> */ /* This macro converts four-letter tags into an unsigned long. It is */ /* used to define `encoding' identifiers (see @FT_Encoding). */ /* */ /* <Note> */ /* Since many 16-bit compilers don't like 32-bit enumerations, you */ /* should redefine this macro in case of problems to something like */ /* this: */ /* */ /* { */ /* #define FT_ENC_TAG( value, a, b, c, d ) value */ /* } */ /* */ /* to get a simple enumeration without assigning special numbers. */ /* */ #ifndef FT_ENC_TAG #define FT_ENC_TAG( value, a, b, c, d ) \ value = ( ( (FT_UInt32)(a) << 24 ) | \ ( (FT_UInt32)(b) << 16 ) | \ ( (FT_UInt32)(c) << 8 ) | \ (FT_UInt32)(d) ) #endif /* FT_ENC_TAG */ /*************************************************************************/ /* */ /* <Enum> */ /* FT_Encoding */ /* */ /* <Description> */ /* An enumeration to specify character sets supported by charmaps. */ /* Used in the @FT_Select_Charmap API function. */ /* */ /* <Note> */ /* Despite the name, this enumeration lists specific character */ /* repertories (i.e., charsets), and not text encoding methods (e.g., */ /* UTF-8, UTF-16, etc.). */ /* */ /* Other encodings might be defined in the future. */ /* */ /* <Values> */ /* FT_ENCODING_NONE :: */ /* The encoding value~0 is reserved. */ /* */ /* FT_ENCODING_UNICODE :: */ /* The Unicode character set. This value covers all versions of */ /* the Unicode repertoire, including ASCII and Latin-1. Most fonts */ /* include a Unicode charmap, but not all of them. */ /* */ /* For example, if you want to access Unicode value U+1F028 (and */ /* the font contains it), use value 0x1F028 as the input value for */ /* @FT_Get_Char_Index. */ /* */ /* FT_ENCODING_MS_SYMBOL :: */ /* Microsoft Symbol encoding, used to encode mathematical symbols */ /* and wingdings. For more information, see */ /* `http://www.microsoft.com/typography/otspec/recom.htm', */ /* `http://www.kostis.net/charsets/symbol.htm', and */ /* `http://www.kostis.net/charsets/wingding.htm'. */ /* */ /* This encoding uses character codes from the PUA (Private Unicode */ /* Area) in the range U+F020-U+F0FF. */ /* */ /* FT_ENCODING_SJIS :: */ /* Shift JIS encoding for Japanese. More info at */ /* `http://en.wikipedia.org/wiki/Shift_JIS'. See note on */ /* multi-byte encodings below. */ /* */ /* FT_ENCODING_PRC :: */ /* Corresponds to encoding systems mainly for Simplified Chinese as */ /* used in People's Republic of China (PRC). The encoding layout */ /* is based on GB~2312 and its supersets GBK and GB~18030. */ /* */ /* FT_ENCODING_BIG5 :: */ /* Corresponds to an encoding system for Traditional Chinese as */ /* used in Taiwan and Hong Kong. */ /* */ /* FT_ENCODING_WANSUNG :: */ /* Corresponds to the Korean encoding system known as Extended */ /* Wansung (MS Windows code page 949). */ /* For more information see */ /* `http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit949.txt'. */ /* */ /* FT_ENCODING_JOHAB :: */ /* The Korean standard character set (KS~C 5601-1992), which */ /* corresponds to MS Windows code page 1361. This character set */ /* includes all possible Hangul character combinations. */ /* */ /* FT_ENCODING_ADOBE_LATIN_1 :: */ /* Corresponds to a Latin-1 encoding as defined in a Type~1 */ /* PostScript font. It is limited to 256 character codes. */ /* */ /* FT_ENCODING_ADOBE_STANDARD :: */ /* Adobe Standard encoding, as found in Type~1, CFF, and */ /* OpenType/CFF fonts. It is limited to 256 character codes. */ /* */ /* FT_ENCODING_ADOBE_EXPERT :: */ /* Adobe Expert encoding, as found in Type~1, CFF, and OpenType/CFF */ /* fonts. It is limited to 256 character codes. */ /* */ /* FT_ENCODING_ADOBE_CUSTOM :: */ /* Corresponds to a custom encoding, as found in Type~1, CFF, and */ /* OpenType/CFF fonts. It is limited to 256 character codes. */ /* */ /* FT_ENCODING_APPLE_ROMAN :: */ /* Apple roman encoding. Many TrueType and OpenType fonts contain */ /* a charmap for this 8-bit encoding, since older versions of Mac */ /* OS are able to use it. */ /* */ /* FT_ENCODING_OLD_LATIN_2 :: */ /* This value is deprecated and was neither used nor reported by */ /* FreeType. Don't use or test for it. */ /* */ /* FT_ENCODING_MS_SJIS :: */ /* Same as FT_ENCODING_SJIS. Deprecated. */ /* */ /* FT_ENCODING_MS_GB2312 :: */ /* Same as FT_ENCODING_PRC. Deprecated. */ /* */ /* FT_ENCODING_MS_BIG5 :: */ /* Same as FT_ENCODING_BIG5. Deprecated. */ /* */ /* FT_ENCODING_MS_WANSUNG :: */ /* Same as FT_ENCODING_WANSUNG. Deprecated. */ /* */ /* FT_ENCODING_MS_JOHAB :: */ /* Same as FT_ENCODING_JOHAB. Deprecated. */ /* */ /* <Note> */ /* By default, FreeType automatically synthesizes a Unicode charmap */ /* for PostScript fonts, using their glyph name dictionaries. */ /* However, it also reports the encodings defined explicitly in the */ /* font file, for the cases when they are needed, with the Adobe */ /* values as well. */ /* */ /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */ /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */ /* FT_ENCODING_UNICODE). Use @FT_Get_BDF_Charset_ID to find out */ /* which encoding is really present. If, for example, the */ /* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */ /* the font is encoded in KOI8-R. */ /* */ /* FT_ENCODING_NONE is always set (with a single exception) by the */ /* winfonts driver. Use @FT_Get_WinFNT_Header and examine the */ /* `charset' field of the @FT_WinFNT_HeaderRec structure to find out */ /* which encoding is really present. For example, */ /* @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for */ /* Russian). */ /* */ /* FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */ /* and `encoding_id' is not `TT_MAC_ID_ROMAN' (otherwise it is set to */ /* FT_ENCODING_APPLE_ROMAN). */ /* */ /* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function */ /* @FT_Get_CMap_Language_ID to query the Mac language ID that may */ /* be needed to be able to distinguish Apple encoding variants. See */ /* */ /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt */ /* */ /* to get an idea how to do that. Basically, if the language ID */ /* is~0, don't use it, otherwise subtract 1 from the language ID. */ /* Then examine `encoding_id'. If, for example, `encoding_id' is */ /* `TT_MAC_ID_ROMAN' and the language ID (minus~1) is */ /* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */ /* `TT_MAC_ID_ARABIC' with `TT_MAC_LANGID_FARSI' means the Farsi */ /* variant the Arabic encoding. */ /* */ typedef enum FT_Encoding_ { FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ), FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ), FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ), FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ), FT_ENC_TAG( FT_ENCODING_GB2312, 'g', 'b', ' ', ' ' ), FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ), FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ), FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ), /* for backward compatibility */ FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS, FT_ENCODING_MS_GB2312 = FT_ENCODING_GB2312, FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5, FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG, FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB, FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ), FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ), FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ), FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ), FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ), FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' ) } FT_Encoding; /* these constants are deprecated; use the corresponding `FT_Encoding' */ /* values instead */ #define ft_encoding_none FT_ENCODING_NONE #define ft_encoding_unicode FT_ENCODING_UNICODE #define ft_encoding_symbol FT_ENCODING_MS_SYMBOL #define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1 #define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2 #define ft_encoding_sjis FT_ENCODING_SJIS #define ft_encoding_gb2312 FT_ENCODING_GB2312 #define ft_encoding_big5 FT_ENCODING_BIG5 #define ft_encoding_wansung FT_ENCODING_WANSUNG #define ft_encoding_johab FT_ENCODING_JOHAB #define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD #define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT #define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM #define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN /*************************************************************************/ /* */ /* <Struct> */ /* FT_CharMapRec */ /* */ /* <Description> */ /* The base charmap structure. */ /* */ /* <Fields> */ /* face :: A handle to the parent face object. */ /* */ /* encoding :: An @FT_Encoding tag identifying the charmap. Use */ /* this with @FT_Select_Charmap. */ /* */ /* platform_id :: An ID number describing the platform for the */ /* following encoding ID. This comes directly from */ /* the TrueType specification and gets emulated for */ /* other formats. */ /* */ /* encoding_id :: A platform specific encoding number. This also */ /* comes from the TrueType specification and gets */ /* emulated similarly. */ /* */ typedef struct FT_CharMapRec_ { FT_Face face; FT_Encoding encoding; FT_UShort platform_id; FT_UShort encoding_id; } FT_CharMapRec; /*************************************************************************/ /*************************************************************************/ /* */ /* B A S E O B J E C T C L A S S E S */ /* */ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* <Type> */ /* FT_Face_Internal */ /* */ /* <Description> */ /* An opaque handle to an `FT_Face_InternalRec' structure that models */ /* the private data of a given @FT_Face object. */ /* */ /* This structure might change between releases of FreeType~2 and is */ /* not generally available to client applications. */ /* */ typedef struct FT_Face_InternalRec_* FT_Face_Internal; /*************************************************************************/ /* */ /* <Struct> */ /* FT_FaceRec */ /* */ /* <Description> */ /* FreeType root face class structure. A face object models a */ /* typeface in a font file. */ /* */ /* <Fields> */ /* num_faces :: The number of faces in the font file. Some */ /* font formats can have multiple faces in */ /* a single font file. */ /* */ /* face_index :: This field holds two different values. */ /* Bits 0-15 are the index of the face in the */ /* font file (starting with value~0). They */ /* are set to~0 if there is only one face in */ /* the font file. */ /* */ /* Bits 16-30 are relevant to GX and OpenType */ /* variation fonts only, holding the named */ /* instance index for the current face index */ /* (starting with value~1; value~0 indicates */ /* font access without a named instance). For */ /* non-variation fonts, bits 16-30 are */ /* ignored. If we have the third named */ /* instance of face~4, say, `face_index' is */ /* set to 0x00030004. */ /* */ /* Bit 31 is always zero (this is, */ /* `face_index' is always a positive value). */ /* */ /* face_flags :: A set of bit flags that give important */ /* information about the face; see */ /* @FT_FACE_FLAG_XXX for the details. */ /* */ /* style_flags :: The lower 16~bits contain a set of bit */ /* flags indicating the style of the face; see */ /* @FT_STYLE_FLAG_XXX for the details. Bits */ /* 16-30 hold the number of named instances */ /* available for the current face if we have a */ /* GX or OpenType variation (sub)font. Bit 31 */ /* is always zero (this is, `style_flags' is */ /* always a positive value). Note that a */ /* variation font has always at least one */ /* named instance, namely the default */ /* instance. */ /* */ /* num_glyphs :: The number of glyphs in the face. If the */ /* face is scalable and has sbits (see */ /* `num_fixed_sizes'), it is set to the number */ /* of outline glyphs. */ /* */ /* For CID-keyed fonts (not in an SFNT */ /* wrapper) this value gives the highest CID */ /* used in the font. */ /* */ /* family_name :: The face's family name. This is an ASCII */ /* string, usually in English, that describes */ /* the typeface's family (like `Times New */ /* Roman', `Bodoni', `Garamond', etc). This */ /* is a least common denominator used to list */ /* fonts. Some formats (TrueType & OpenType) */ /* provide localized and Unicode versions of */ /* this string. Applications should use the */ /* format specific interface to access them. */ /* Can be NULL (e.g., in fonts embedded in a */ /* PDF file). */ /* */ /* In case the font doesn't provide a specific */ /* family name entry, FreeType tries to */ /* synthesize one, deriving it from other name */ /* entries. */ /* */ /* style_name :: The face's style name. This is an ASCII */ /* string, usually in English, that describes */ /* the typeface's style (like `Italic', */ /* `Bold', `Condensed', etc). Not all font */ /* formats provide a style name, so this field */ /* is optional, and can be set to NULL. As */ /* for `family_name', some formats provide */ /* localized and Unicode versions of this */ /* string. Applications should use the format */ /* specific interface to access them. */ /* */ /* num_fixed_sizes :: The number of bitmap strikes in the face. */ /* Even if the face is scalable, there might */ /* still be bitmap strikes, which are called */ /* `sbits' in that case. */ /* */ /* available_sizes :: An array of @FT_Bitmap_Size for all bitmap */ /* strikes in the face. It is set to NULL if */ /* there is no bitmap strike. */ /* */ /* Note that FreeType tries to sanitize the */ /* strike data since they are sometimes sloppy */ /* or incorrect, but this can easily fail. */ /* */ /* num_charmaps :: The number of charmaps in the face. */ /* */ /* charmaps :: An array of the charmaps of the face. */ /* */ /* generic :: A field reserved for client uses. See the */ /* @FT_Generic type description. */ /* */ /* bbox :: The font bounding box. Coordinates are */ /* expressed in font units (see */ /* `units_per_EM'). The box is large enough */ /* to contain any glyph from the font. Thus, */ /* `bbox.yMax' can be seen as the `maximum */ /* ascender', and `bbox.yMin' as the `minimum */ /* descender'. Only relevant for scalable */ /* formats. */ /* */ /* Note that the bounding box might be off by */ /* (at least) one pixel for hinted fonts. See */ /* @FT_Size_Metrics for further discussion. */ /* */ /* units_per_EM :: The number of font units per EM square for */ /* this face. This is typically 2048 for */ /* TrueType fonts, and 1000 for Type~1 fonts. */ /* Only relevant for scalable formats. */ /* */ /* ascender :: The typographic ascender of the face, */ /* expressed in font units. For font formats */ /* not having this information, it is set to */ /* `bbox.yMax'. Only relevant for scalable */ /* formats. */ /* */ /* descender :: The typographic descender of the face, */ /* expressed in font units. For font formats */ /* not having this information, it is set to */ /* `bbox.yMin'. Note that this field is */ /* negative for values below the baseline. */ /* Only relevant for scalable formats. */ /* */ /* height :: This value is the vertical distance */ /* between two consecutive baselines, */ /* expressed in font units. It is always */ /* positive. Only relevant for scalable */ /* formats. */ /* */ /* If you want the global glyph height, use */ /* `ascender - descender'. */ /* */ /* max_advance_width :: The maximum advance width, in font units, */ /* for all glyphs in this face. This can be */ /* used to make word wrapping computations */ /* faster. Only relevant for scalable */ /* formats. */ /* */ /* max_advance_height :: The maximum advance height, in font units, */ /* for all glyphs in this face. This is only */ /* relevant for vertical layouts, and is set */ /* to `height' for fonts that do not provide */ /* vertical metrics. Only relevant for */ /* scalable formats. */ /* */ /* underline_position :: The position, in font units, of the */ /* underline line for this face. It is the */ /* center of the underlining stem. Only */ /* relevant for scalable formats. */ /* */ /* underline_thickness :: The thickness, in font units, of the */ /* underline for this face. Only relevant for */ /* scalable formats. */ /* */ /* glyph :: The face's associated glyph slot(s). */ /* */ /* size :: The current active size for this face. */ /* */ /* charmap :: The current active charmap for this face. */ /* */ /* <Note> */ /* Fields may be changed after a call to @FT_Attach_File or */ /* @FT_Attach_Stream. */ /* */ /* For an OpenType variation font, the values of the following fields */ /* can change after a call to @FT_Set_Var_Design_Coordinates (and */ /* friends) if the font contains an `MVAR' table: `ascender', */ /* `descender', `height', `underline_position', and */ /* `underline_thickness'. */ /* */ typedef struct FT_FaceRec_ { FT_Long num_faces; FT_Long face_index; FT_Long face_flags; FT_Long style_flags; FT_Long num_glyphs; FT_String* family_name; FT_String* style_name; FT_Int num_fixed_sizes; FT_Bitmap_Size* available_sizes; FT_Int num_charmaps; FT_CharMap* charmaps; FT_Generic generic; /*# The following member variables (down to `underline_thickness') */ /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */ /*# for bitmap fonts. */ FT_BBox bbox; FT_UShort units_per_EM; FT_Short ascender; FT_Short descender; FT_Short height; FT_Short max_advance_width; FT_Short max_advance_height; FT_Short underline_position; FT_Short underline_thickness; FT_GlyphSlot glyph; FT_Size size; FT_CharMap charmap; /*@private begin */ FT_Driver driver; FT_Memory memory; FT_Stream stream; FT_ListRec sizes_list; FT_Generic autohint; /* face-specific auto-hinter data */ void* extensions; /* unused */ FT_Face_Internal internal; /*@private end */ } FT_FaceRec; /*************************************************************************/ /* */ /* <Enum> */ /* FT_FACE_FLAG_XXX */ /* */ /* <Description> */ /* A list of bit flags used in the `face_flags' field of the */ /* @FT_FaceRec structure. They inform client applications of */ /* properties of the corresponding face. */ /* */ /* <Values> */ /* FT_FACE_FLAG_SCALABLE :: */ /* The face contains outline glyphs. Note that a face can contain */ /* bitmap strikes also, i.e., a face can have both this flag and */ /* @FT_FACE_FLAG_FIXED_SIZES set. */ /* */ /* FT_FACE_FLAG_FIXED_SIZES :: */ /* The face contains bitmap strikes. See also the */ /* `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec. */ /* */ /* FT_FACE_FLAG_FIXED_WIDTH :: */ /* The face contains fixed-width characters (like Courier, Lucida, */ /* MonoType, etc.). */ /* */ /* FT_FACE_FLAG_SFNT :: */ /* The face uses the SFNT storage scheme. For now, this means */ /* TrueType and OpenType. */ /* */ /* FT_FACE_FLAG_HORIZONTAL :: */ /* The face contains horizontal glyph metrics. This should be set */ /* for all common formats. */ /* */ /* FT_FACE_FLAG_VERTICAL :: */ /* The face contains vertical glyph metrics. This is only */ /* available in some formats, not all of them. */ /* */ /* FT_FACE_FLAG_KERNING :: */ /* The face contains kerning information. If set, the kerning */ /* distance can be retrieved using the function @FT_Get_Kerning. */ /* Otherwise the function always return the vector (0,0). Note */ /* that FreeType doesn't handle kerning data from the SFNT `GPOS' */ /* table (as present in many OpenType fonts). */ /* */ /* FT_FACE_FLAG_FAST_GLYPHS :: */ /* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */ /* */ /* FT_FACE_FLAG_MULTIPLE_MASTERS :: */ /* The face contains multiple masters and is capable of */ /* interpolating between them. Supported formats are Adobe MM, */ /* TrueType GX, and OpenType variation fonts. */ /* */ /* See the multiple-masters specific API for details. */ /* */ /* FT_FACE_FLAG_GLYPH_NAMES :: */ /* The face contains glyph names, which can be retrieved using */ /* @FT_Get_Glyph_Name. Note that some TrueType fonts contain */ /* broken glyph name tables. Use the function */ /* @FT_Has_PS_Glyph_Names when needed. */ /* */ /* FT_FACE_FLAG_EXTERNAL_STREAM :: */ /* Used internally by FreeType to indicate that a face's stream was */ /* provided by the client application and should not be destroyed */ /* when @FT_Done_Face is called. Don't read or test this flag. */ /* */ /* FT_FACE_FLAG_HINTER :: */ /* The font driver has a hinting machine of its own. For example, */ /* with TrueType fonts, it makes sense to use data from the SFNT */ /* `gasp' table only if the native TrueType hinting engine (with */ /* the bytecode interpreter) is available and active. */ /* */ /* FT_FACE_FLAG_CID_KEYED :: */ /* The face is CID-keyed. In that case, the face is not accessed */ /* by glyph indices but by CID values. For subsetted CID-keyed */ /* fonts this has the consequence that not all index values are a */ /* valid argument to @FT_Load_Glyph. Only the CID values for which */ /* corresponding glyphs in the subsetted font exist make */ /* `FT_Load_Glyph' return successfully; in all other cases you get */ /* an `FT_Err_Invalid_Argument' error. */ /* */ /* Note that CID-keyed fonts that are in an SFNT wrapper (this is, */ /* all OpenType/CFF fonts) don't have this flag set since the */ /* glyphs are accessed in the normal way (using contiguous */ /* indices); the `CID-ness' isn't visible to the application. */ /* */ /* FT_FACE_FLAG_TRICKY :: */ /* The face is `tricky', this is, it always needs the font format's */ /* native hinting engine to get a reasonable result. A typical */ /* example is the old Chinese font `mingli.ttf' (but not */ /* `mingliu.ttc') that uses TrueType bytecode instructions to move */ /* and scale all of its subglyphs. */ /* */ /* It is not possible to auto-hint such fonts using */ /* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */ /* @FT_LOAD_NO_HINTING. You have to set both @FT_LOAD_NO_HINTING */ /* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */ /* probably never want this except for demonstration purposes. */ /* */ /* Currently, there are about a dozen TrueType fonts in the list of */ /* tricky fonts; they are hard-coded in file `ttobjs.c'. */ /* */ /* FT_FACE_FLAG_COLOR :: */ /* The face has color glyph tables. To access color glyphs use */ /* @FT_LOAD_COLOR. */ /* */ #define FT_FACE_FLAG_SCALABLE ( 1L << 0 ) #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 ) #define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 ) #define FT_FACE_FLAG_SFNT ( 1L << 3 ) #define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 ) #define FT_FACE_FLAG_VERTICAL ( 1L << 5 ) #define FT_FACE_FLAG_KERNING ( 1L << 6 ) #define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 ) #define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 ) #define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 ) #define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 ) #define FT_FACE_FLAG_HINTER ( 1L << 11 ) #define FT_FACE_FLAG_CID_KEYED ( 1L << 12 ) #define FT_FACE_FLAG_TRICKY ( 1L << 13 ) #define FT_FACE_FLAG_COLOR ( 1L << 14 ) /************************************************************************* * * @macro: * FT_HAS_HORIZONTAL( face ) * * @description: * A macro that returns true whenever a face object contains * horizontal metrics (this is true for all font formats though). * * @also: * @FT_HAS_VERTICAL can be used to check for vertical metrics. * */ #define FT_HAS_HORIZONTAL( face ) \ ( (face)->face_flags & FT_FACE_FLAG_HORIZONTAL ) /************************************************************************* * * @macro: * FT_HAS_VERTICAL( face ) * * @description: * A macro that returns true whenever a face object contains real * vertical metrics (and not only synthesized ones). * */ #define FT_HAS_VERTICAL( face ) \ ( (face)->face_flags & FT_FACE_FLAG_VERTICAL ) /************************************************************************* * * @macro: * FT_HAS_KERNING( face ) * * @description: * A macro that returns true whenever a face object contains kerning * data that can be accessed with @FT_Get_Kerning. * */ #define FT_HAS_KERNING( face ) \ ( (face)->face_flags & FT_FACE_FLAG_KERNING ) /************************************************************************* * * @macro: * FT_IS_SCALABLE( face ) * * @description: * A macro that returns true whenever a face object contains a scalable * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF, * and PFR font formats). * */ #define FT_IS_SCALABLE( face ) \ ( (face)->face_flags & FT_FACE_FLAG_SCALABLE ) /************************************************************************* * * @macro: * FT_IS_SFNT( face ) * * @description: * A macro that returns true whenever a face object contains a font * whose format is based on the SFNT storage scheme. This usually * means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded * bitmap fonts. * * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and * @FT_TRUETYPE_TABLES_H are available. * */ #define FT_IS_SFNT( face ) \ ( (face)->face_flags & FT_FACE_FLAG_SFNT ) /************************************************************************* * * @macro: * FT_IS_FIXED_WIDTH( face ) * * @description: * A macro that returns true whenever a face object contains a font face * that contains fixed-width (or `monospace', `fixed-pitch', etc.) * glyphs. * */ #define FT_IS_FIXED_WIDTH( face ) \ ( (face)->face_flags & FT_FACE_FLAG_FIXED_WIDTH ) /************************************************************************* * * @macro: * FT_HAS_FIXED_SIZES( face ) * * @description: * A macro that returns true whenever a face object contains some * embedded bitmaps. See the `available_sizes' field of the * @FT_FaceRec structure. * */ #define FT_HAS_FIXED_SIZES( face ) \ ( (face)->face_flags & FT_FACE_FLAG_FIXED_SIZES ) /************************************************************************* * * @macro: * FT_HAS_FAST_GLYPHS( face ) * * @description: * Deprecated. * */ #define FT_HAS_FAST_GLYPHS( face ) 0 /************************************************************************* * * @macro: * FT_HAS_GLYPH_NAMES( face ) * * @description: * A macro that returns true whenever a face object contains some glyph * names that can be accessed through @FT_Get_Glyph_Name. * */ #define FT_HAS_GLYPH_NAMES( face ) \ ( (face)->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) /************************************************************************* * * @macro: * FT_HAS_MULTIPLE_MASTERS( face ) * * @description: * A macro that returns true whenever a face object contains some * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H * are then available to choose the exact design you want. * */ #define FT_HAS_MULTIPLE_MASTERS( face ) \ ( (face)->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS ) /************************************************************************* * * @macro: * FT_IS_NAMED_INSTANCE( face ) * * @description: * A macro that returns true whenever a face object is a named instance * of a GX or OpenType variation font. * */ #define FT_IS_NAMED_INSTANCE( face ) \ ( (face)->face_index & 0x7FFF0000L ) /************************************************************************* * * @macro: * FT_IS_CID_KEYED( face ) * * @description: * A macro that returns true whenever a face object contains a CID-keyed * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more * details. * * If this macro is true, all functions defined in @FT_CID_H are * available. * */ #define FT_IS_CID_KEYED( face ) \ ( (face)->face_flags & FT_FACE_FLAG_CID_KEYED ) /************************************************************************* * * @macro: * FT_IS_TRICKY( face ) * * @description: * A macro that returns true whenever a face represents a `tricky' font. * See the discussion of @FT_FACE_FLAG_TRICKY for more details. * */ #define FT_IS_TRICKY( face ) \ ( (face)->face_flags & FT_FACE_FLAG_TRICKY ) /************************************************************************* * * @macro: * FT_HAS_COLOR( face ) * * @description: * A macro that returns true whenever a face object contains * tables for color glyphs. * */ #define FT_HAS_COLOR( face ) \ ( (face)->face_flags & FT_FACE_FLAG_COLOR ) /*************************************************************************/ /* */ /* <Const> */ /* FT_STYLE_FLAG_XXX */ /* */ /* <Description> */ /* A list of bit flags to indicate the style of a given face. These */ /* are used in the `style_flags' field of @FT_FaceRec. */ /* */ /* <Values> */ /* FT_STYLE_FLAG_ITALIC :: */ /* The face style is italic or oblique. */ /* */ /* FT_STYLE_FLAG_BOLD :: */ /* The face is bold. */ /* */ /* <Note> */ /* The style information as provided by FreeType is very basic. More */ /* details are beyond the scope and should be done on a higher level */ /* (for example, by analyzing various fields of the `OS/2' table in */ /* SFNT based fonts). */ /* */ #define FT_STYLE_FLAG_ITALIC ( 1 << 0 ) #define FT_STYLE_FLAG_BOLD ( 1 << 1 ) /*************************************************************************/ /* */ /* <Type> */ /* FT_Size_Internal */ /* */ /* <Description> */ /* An opaque handle to an `FT_Size_InternalRec' structure, used to */ /* model private data of a given @FT_Size object. */ /* */ typedef struct FT_Size_InternalRec_* FT_Size_Internal; /*************************************************************************/ /* */ /* <Struct> */ /* FT_Size_Metrics */ /* */ /* <Description> */ /* The size metrics structure gives the metrics of a size object. */ /* */ /* <Fields> */ /* x_ppem :: The width of the scaled EM square in pixels, hence */ /* the term `ppem' (pixels per EM). It is also */ /* referred to as `nominal width'. */ /* */ /* y_ppem :: The height of the scaled EM square in pixels, */ /* hence the term `ppem' (pixels per EM). It is also */ /* referred to as `nominal height'. */ /* */ /* x_scale :: A 16.16 fractional scaling value to convert */ /* horizontal metrics from font units to 26.6 */ /* fractional pixels. Only relevant for scalable */ /* font formats. */ /* */ /* y_scale :: A 16.16 fractional scaling value to convert */ /* vertical metrics from font units to 26.6 */ /* fractional pixels. Only relevant for scalable */ /* font formats. */ /* */ /* ascender :: The ascender in 26.6 fractional pixels, rounded up */ /* to an integer value. See @FT_FaceRec for the */ /* details. */ /* */ /* descender :: The descender in 26.6 fractional pixels, rounded */ /* down to an integer value. See @FT_FaceRec for the */ /* details. */ /* */ /* height :: The height in 26.6 fractional pixels, rounded to */ /* an integer value. See @FT_FaceRec for the */ /* details. */ /* */ /* max_advance :: The maximum advance width in 26.6 fractional */ /* pixels, rounded to an integer value. See */ /* @FT_FaceRec for the details. */ /* */ /* <Note> */ /* The scaling values, if relevant, are determined first during a */ /* size changing operation. The remaining fields are then set by the */ /* driver. For scalable formats, they are usually set to scaled */ /* values of the corresponding fields in @FT_FaceRec. Some values */ /* like ascender or descender are rounded for historical reasons; */ /* more precise values (for outline fonts) can be derived by scaling */ /* the corresponding @FT_FaceRec values manually. */ /* */ /* Note that due to glyph hinting and the selected rendering mode */ /* these values are usually not exact; consequently, they must be */ /* treated as unreliable with an error margin of at least one pixel! */ /* */ /* Indeed, the only way to get the exact metrics is to render _all_ */ /* glyphs. As this would be a definite performance hit, it is up to */ /* client applications to perform such computations. */ /* */ /* The `FT_Size_Metrics' structure is valid for bitmap fonts also. */ /* */ typedef struct FT_Size_Metrics_ { FT_UShort x_ppem; /* horizontal pixels per EM */ FT_UShort y_ppem; /* vertical pixels per EM */ FT_Fixed x_scale; /* scaling values used to convert font */ FT_Fixed y_scale; /* units to 26.6 fractional pixels */ FT_Pos ascender; /* ascender in 26.6 frac. pixels */ FT_Pos descender; /* descender in 26.6 frac. pixels */ FT_Pos height; /* text height in 26.6 frac. pixels */ FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */ } FT_Size_Metrics; /*************************************************************************/ /* */ /* <Struct> */ /* FT_SizeRec */ /* */ /* <Description> */ /* FreeType root size class structure. A size object models a face */ /* object at a given size. */ /* */ /* <Fields> */ /* face :: Handle to the parent face object. */ /* */ /* generic :: A typeless pointer, unused by the FreeType library or */ /* any of its drivers. It can be used by client */ /* applications to link their own data to each size */ /* object. */ /* */ /* metrics :: Metrics for this size object. This field is read-only. */ /* */ typedef struct FT_SizeRec_ { FT_Face face; /* parent face object */ FT_Generic generic; /* generic pointer for client uses */ FT_Size_Metrics metrics; /* size metrics */ FT_Size_Internal internal; } FT_SizeRec; /*************************************************************************/ /* */ /* <Struct> */ /* FT_SubGlyph */ /* */ /* <Description> */ /* The subglyph structure is an internal object used to describe */ /* subglyphs (for example, in the case of composites). */ /* */ /* <Note> */ /* The subglyph implementation is not part of the high-level API, */ /* hence the forward structure declaration. */ /* */ /* You can however retrieve subglyph information with */ /* @FT_Get_SubGlyph_Info. */ /* */ typedef struct FT_SubGlyphRec_* FT_SubGlyph; /*************************************************************************/ /* */ /* <Type> */ /* FT_Slot_Internal */ /* */ /* <Description> */ /* An opaque handle to an `FT_Slot_InternalRec' structure, used to */ /* model private data of a given @FT_GlyphSlot object. */ /* */ typedef struct FT_Slot_InternalRec_* FT_Slot_Internal; /*************************************************************************/ /* */ /* <Struct> */ /* FT_GlyphSlotRec */ /* */ /* <Description> */ /* FreeType root glyph slot class structure. A glyph slot is a */ /* container where individual glyphs can be loaded, be they in */ /* outline or bitmap format. */ /* */ /* <Fields> */ /* library :: A handle to the FreeType library instance */ /* this slot belongs to. */ /* */ /* face :: A handle to the parent face object. */ /* */ /* next :: In some cases (like some font tools), several */ /* glyph slots per face object can be a good */ /* thing. As this is rare, the glyph slots are */ /* listed through a direct, single-linked list */ /* using its `next' field. */ /* */ /* generic :: A typeless pointer unused by the FreeType */ /* library or any of its drivers. It can be */ /* used by client applications to link their own */ /* data to each glyph slot object. */ /* */ /* metrics :: The metrics of the last loaded glyph in the */ /* slot. The returned values depend on the last */ /* load flags (see the @FT_Load_Glyph API */ /* function) and can be expressed either in 26.6 */ /* fractional pixels or font units. */ /* */ /* Note that even when the glyph image is */ /* transformed, the metrics are not. */ /* */ /* linearHoriAdvance :: The advance width of the unhinted glyph. */ /* Its value is expressed in 16.16 fractional */ /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */ /* when loading the glyph. This field can be */ /* important to perform correct WYSIWYG layout. */ /* Only relevant for outline glyphs. */ /* */ /* linearVertAdvance :: The advance height of the unhinted glyph. */ /* Its value is expressed in 16.16 fractional */ /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */ /* when loading the glyph. This field can be */ /* important to perform correct WYSIWYG layout. */ /* Only relevant for outline glyphs. */ /* */ /* advance :: This shorthand is, depending on */ /* @FT_LOAD_IGNORE_TRANSFORM, the transformed */ /* (hinted) advance width for the glyph, in 26.6 */ /* fractional pixel format. As specified with */ /* @FT_LOAD_VERTICAL_LAYOUT, it uses either the */ /* `horiAdvance' or the `vertAdvance' value of */ /* `metrics' field. */ /* */ /* format :: This field indicates the format of the image */ /* contained in the glyph slot. Typically */ /* @FT_GLYPH_FORMAT_BITMAP, */ /* @FT_GLYPH_FORMAT_OUTLINE, or */ /* @FT_GLYPH_FORMAT_COMPOSITE, but other values */ /* are possible. */ /* */ /* bitmap :: This field is used as a bitmap descriptor */ /* when the slot format is */ /* @FT_GLYPH_FORMAT_BITMAP. Note that the */ /* address and content of the bitmap buffer can */ /* change between calls of @FT_Load_Glyph and a */ /* few other functions. */ /* */ /* bitmap_left :: The bitmap's left bearing expressed in */ /* integer pixels. Only valid if the format is */ /* @FT_GLYPH_FORMAT_BITMAP, this is, if the */ /* glyph slot contains a bitmap. */ /* */ /* bitmap_top :: The bitmap's top bearing expressed in integer */ /* pixels. This is the distance from the */ /* baseline to the top-most glyph scanline, */ /* upwards y~coordinates being *positive*. */ /* */ /* outline :: The outline descriptor for the current glyph */ /* image if its format is */ /* @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is */ /* loaded, `outline' can be transformed, */ /* distorted, emboldened, etc. However, it must */ /* not be freed. */ /* */ /* num_subglyphs :: The number of subglyphs in a composite glyph. */ /* This field is only valid for the composite */ /* glyph format that should normally only be */ /* loaded with the @FT_LOAD_NO_RECURSE flag. */ /* */ /* subglyphs :: An array of subglyph descriptors for */ /* composite glyphs. There are `num_subglyphs' */ /* elements in there. Currently internal to */ /* FreeType. */ /* */ /* control_data :: Certain font drivers can also return the */ /* control data for a given glyph image (e.g. */ /* TrueType bytecode, Type~1 charstrings, etc.). */ /* This field is a pointer to such data; it is */ /* currently internal to FreeType. */ /* */ /* control_len :: This is the length in bytes of the control */ /* data. Currently internal to FreeType. */ /* */ /* other :: Reserved. */ /* */ /* lsb_delta :: The difference between hinted and unhinted */ /* left side bearing while auto-hinting is */ /* active. Zero otherwise. */ /* */ /* rsb_delta :: The difference between hinted and unhinted */ /* right side bearing while auto-hinting is */ /* active. Zero otherwise. */ /* */ /* <Note> */ /* If @FT_Load_Glyph is called with default flags (see */ /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */ /* its native format (e.g., an outline glyph for TrueType and Type~1 */ /* formats). */ /* */ /* This image can later be converted into a bitmap by calling */ /* @FT_Render_Glyph. This function searches the current renderer for */ /* the native image's format, then invokes it. */ /* */ /* The renderer is in charge of transforming the native image through */ /* the slot's face transformation fields, then converting it into a */ /* bitmap that is returned in `slot->bitmap'. */ /* */ /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */ /* to specify the position of the bitmap relative to the current pen */ /* position (e.g., coordinates (0,0) on the baseline). Of course, */ /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */ /* */ /* Here is a small pseudo code fragment that shows how to use */ /* `lsb_delta' and `rsb_delta' to do fractional positioning of */ /* glyphs: */ /* */ /* { */ /* FT_GlyphSlot slot = face->glyph; */ /* FT_Pos origin_x = 0; */ /* */ /* */ /* for all glyphs do */ /* <load glyph with `FT_Load_Glyph'> */ /* */ /* FT_Outline_Translate( slot->outline, origin_x & 63, 0 ); */ /* */ /* <save glyph image, or render glyph, or ...> */ /* */ /* <compute kern between current and next glyph */ /* and add it to `origin_x'> */ /* */ /* origin_x += slot->advance.x; */ /* origin_x += slot->rsb_delta - slot->lsb_relta; */ /* endfor */ /* } */ /* */ /* Here is another small pseudo code fragment that shows how to use */ /* `lsb_delta' and `rsb_delta' to improve integer positioning of */ /* glyphs: */ /* */ /* { */ /* FT_GlyphSlot slot = face->glyph; */ /* FT_Pos origin_x = 0; */ /* FT_Pos prev_rsb_delta = 0; */ /* */ /* */ /* for all glyphs do */ /* <compute kern between current and previous glyph */ /* and add it to `origin_x'> */ /* */ /* <load glyph with `FT_Load_Glyph'> */ /* */ /* if ( prev_rsb_delta - slot->lsb_delta >= 32 ) */ /* origin_x -= 64; */ /* else if ( prev_rsb_delta - slot->lsb_delta < -32 ) */ /* origin_x += 64; */ /* */ /* prev_rsb_delta = slot->rsb_delta; */ /* */ /* <save glyph image, or render glyph, or ...> */ /* */ /* origin_x += slot->advance.x; */ /* endfor */ /* } */ /* */ /* If you use strong auto-hinting, you *must* apply these delta */ /* values! Otherwise you will experience far too large inter-glyph */ /* spacing at small rendering sizes in most cases. Note that it */ /* doesn't harm to use the above code for other hinting modes also, */ /* since the delta values are zero then. */ /* */ typedef struct FT_GlyphSlotRec_ { FT_Library library; FT_Face face; FT_GlyphSlot next; FT_UInt reserved; /* retained for binary compatibility */ FT_Generic generic; FT_Glyph_Metrics metrics; FT_Fixed linearHoriAdvance; FT_Fixed linearVertAdvance; FT_Vector advance; FT_Glyph_Format format; FT_Bitmap bitmap; FT_Int bitmap_left; FT_Int bitmap_top; FT_Outline outline; FT_UInt num_subglyphs; FT_SubGlyph subglyphs; void* control_data; long control_len; FT_Pos lsb_delta; FT_Pos rsb_delta; void* other; FT_Slot_Internal internal; } FT_GlyphSlotRec; /*************************************************************************/ /*************************************************************************/ /* */ /* F U N C T I O N S */ /* */ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* <Function> */ /* FT_Init_FreeType */ /* */ /* <Description> */ /* Initialize a new FreeType library object. The set of modules */ /* that are registered by this function is determined at build time. */ /* */ /* <Output> */ /* alibrary :: A handle to a new library object. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* In case you want to provide your own memory allocating routines, */ /* use @FT_New_Library instead, followed by a call to */ /* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module) */ /* and @FT_Set_Default_Properties. */ /* */ /* See the documentation of @FT_Library and @FT_Face for */ /* multi-threading issues. */ /* */ /* If you need reference-counting (cf. @FT_Reference_Library), use */ /* @FT_New_Library and @FT_Done_Library. */ /* */ /* If compilation option FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES is */ /* set, this function reads the `FREETYPE_PROPERTIES' environment */ /* variable to control driver properties. See sections @auto_hinter, */ /* @cff_driver, @pcf_driver, and @tt_driver for more. */ /* */ FT_EXPORT( FT_Error ) FT_Init_FreeType( FT_Library *alibrary ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Done_FreeType */ /* */ /* <Description> */ /* Destroy a given FreeType library object and all of its children, */ /* including resources, drivers, faces, sizes, etc. */ /* */ /* <Input> */ /* library :: A handle to the target library object. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Done_FreeType( FT_Library library ); /*************************************************************************/ /* */ /* <Enum> */ /* FT_OPEN_XXX */ /* */ /* <Description> */ /* A list of bit field constants used within the `flags' field of the */ /* @FT_Open_Args structure. */ /* */ /* <Values> */ /* FT_OPEN_MEMORY :: This is a memory-based stream. */ /* */ /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */ /* */ /* FT_OPEN_PATHNAME :: Create a new input stream from a C~path */ /* name. */ /* */ /* FT_OPEN_DRIVER :: Use the `driver' field. */ /* */ /* FT_OPEN_PARAMS :: Use the `num_params' and `params' fields. */ /* */ /* <Note> */ /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */ /* flags are mutually exclusive. */ /* */ #define FT_OPEN_MEMORY 0x1 #define FT_OPEN_STREAM 0x2 #define FT_OPEN_PATHNAME 0x4 #define FT_OPEN_DRIVER 0x8 #define FT_OPEN_PARAMS 0x10 /* these constants are deprecated; use the corresponding `FT_OPEN_XXX' */ /* values instead */ #define ft_open_memory FT_OPEN_MEMORY #define ft_open_stream FT_OPEN_STREAM #define ft_open_pathname FT_OPEN_PATHNAME #define ft_open_driver FT_OPEN_DRIVER #define ft_open_params FT_OPEN_PARAMS /*************************************************************************/ /* */ /* <Struct> */ /* FT_Parameter */ /* */ /* <Description> */ /* A simple structure to pass more or less generic parameters to */ /* @FT_Open_Face and @FT_Face_Properties. */ /* */ /* <Fields> */ /* tag :: A four-byte identification tag. */ /* */ /* data :: A pointer to the parameter data. */ /* */ /* <Note> */ /* The ID and function of parameters are driver-specific. See the */ /* various FT_PARAM_TAG_XXX flags for more information. */ /* */ typedef struct FT_Parameter_ { FT_ULong tag; FT_Pointer data; } FT_Parameter; /*************************************************************************/ /* */ /* <Struct> */ /* FT_Open_Args */ /* */ /* <Description> */ /* A structure to indicate how to open a new font file or stream. A */ /* pointer to such a structure can be used as a parameter for the */ /* functions @FT_Open_Face and @FT_Attach_Stream. */ /* */ /* <Fields> */ /* flags :: A set of bit flags indicating how to use the */ /* structure. */ /* */ /* memory_base :: The first byte of the file in memory. */ /* */ /* memory_size :: The size in bytes of the file in memory. */ /* */ /* pathname :: A pointer to an 8-bit file pathname. */ /* */ /* stream :: A handle to a source stream object. */ /* */ /* driver :: This field is exclusively used by @FT_Open_Face; */ /* it simply specifies the font driver to use for */ /* opening the face. If set to NULL, FreeType tries */ /* to load the face with each one of the drivers in */ /* its list. */ /* */ /* num_params :: The number of extra parameters. */ /* */ /* params :: Extra parameters passed to the font driver when */ /* opening a new face. */ /* */ /* <Note> */ /* The stream type is determined by the contents of `flags' that */ /* are tested in the following order by @FT_Open_Face: */ /* */ /* If the @FT_OPEN_MEMORY bit is set, assume that this is a */ /* memory file of `memory_size' bytes, located at `memory_address'. */ /* The data are not copied, and the client is responsible for */ /* releasing and destroying them _after_ the corresponding call to */ /* @FT_Done_Face. */ /* */ /* Otherwise, if the @FT_OPEN_STREAM bit is set, assume that a */ /* custom input stream `stream' is used. */ /* */ /* Otherwise, if the @FT_OPEN_PATHNAME bit is set, assume that this */ /* is a normal file and use `pathname' to open it. */ /* */ /* If the @FT_OPEN_DRIVER bit is set, @FT_Open_Face only tries to */ /* open the file with the driver whose handler is in `driver'. */ /* */ /* If the @FT_OPEN_PARAMS bit is set, the parameters given by */ /* `num_params' and `params' is used. They are ignored otherwise. */ /* */ /* Ideally, both the `pathname' and `params' fields should be tagged */ /* as `const'; this is missing for API backward compatibility. In */ /* other words, applications should treat them as read-only. */ /* */ typedef struct FT_Open_Args_ { FT_UInt flags; const FT_Byte* memory_base; FT_Long memory_size; FT_String* pathname; FT_Stream stream; FT_Module driver; FT_Int num_params; FT_Parameter* params; } FT_Open_Args; /*************************************************************************/ /* */ /* <Function> */ /* FT_New_Face */ /* */ /* <Description> */ /* Call @FT_Open_Face to open a font by its pathname. */ /* */ /* <InOut> */ /* library :: A handle to the library resource. */ /* */ /* <Input> */ /* pathname :: A path to the font file. */ /* */ /* face_index :: See @FT_Open_Face for a detailed description of this */ /* parameter. */ /* */ /* <Output> */ /* aface :: A handle to a new face object. If `face_index' is */ /* greater than or equal to zero, it must be non-NULL. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* Use @FT_Done_Face to destroy the created @FT_Face object (along */ /* with its slot and sizes). */ /* */ FT_EXPORT( FT_Error ) FT_New_Face( FT_Library library, const char* filepathname, FT_Long face_index, FT_Face *aface ); /*************************************************************************/ /* */ /* <Function> */ /* FT_New_Memory_Face */ /* */ /* <Description> */ /* Call @FT_Open_Face to open a font that has been loaded into */ /* memory. */ /* */ /* <InOut> */ /* library :: A handle to the library resource. */ /* */ /* <Input> */ /* file_base :: A pointer to the beginning of the font data. */ /* */ /* file_size :: The size of the memory chunk used by the font data. */ /* */ /* face_index :: See @FT_Open_Face for a detailed description of this */ /* parameter. */ /* */ /* <Output> */ /* aface :: A handle to a new face object. If `face_index' is */ /* greater than or equal to zero, it must be non-NULL. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* You must not deallocate the memory before calling @FT_Done_Face. */ /* */ FT_EXPORT( FT_Error ) FT_New_Memory_Face( FT_Library library, const FT_Byte* file_base, FT_Long file_size, FT_Long face_index, FT_Face *aface ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Open_Face */ /* */ /* <Description> */ /* Create a face object from a given resource described by */ /* @FT_Open_Args. */ /* */ /* <InOut> */ /* library :: A handle to the library resource. */ /* */ /* <Input> */ /* args :: A pointer to an `FT_Open_Args' structure that must */ /* be filled by the caller. */ /* */ /* face_index :: This field holds two different values. Bits 0-15 */ /* are the index of the face in the font file (starting */ /* with value~0). Set it to~0 if there is only one */ /* face in the font file. */ /* */ /* Bits 16-30 are relevant to GX and OpenType variation */ /* fonts only, specifying the named instance index for */ /* the current face index (starting with value~1; */ /* value~0 makes FreeType ignore named instances). For */ /* non-variation fonts, bits 16-30 are ignored. */ /* Assuming that you want to access the third named */ /* instance in face~4, `face_index' should be set to */ /* 0x00030004. If you want to access face~4 without */ /* variation handling, simply set `face_index' to */ /* value~4. */ /* */ /* `FT_Open_Face' and its siblings can be used to */ /* quickly check whether the font format of a given */ /* font resource is supported by FreeType. In general, */ /* if the `face_index' argument is negative, the */ /* function's return value is~0 if the font format is */ /* recognized, or non-zero otherwise. The function */ /* allocates a more or less empty face handle in */ /* `*aface' (if `aface' isn't NULL); the only two */ /* useful fields in this special case are */ /* `face->num_faces' and `face->style_flags'. For any */ /* negative value of `face_index', `face->num_faces' */ /* gives the number of faces within the font file. For */ /* the negative value `-(N+1)' (with `N' a non-negative */ /* 16-bit value), bits 16-30 in `face->style_flags' */ /* give the number of named instances in face `N' if we */ /* have a variation font (or zero otherwise). After */ /* examination, the returned @FT_Face structure should */ /* be deallocated with a call to @FT_Done_Face. */ /* */ /* <Output> */ /* aface :: A handle to a new face object. If `face_index' is */ /* greater than or equal to zero, it must be non-NULL. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* Unlike FreeType 1.x, this function automatically creates a glyph */ /* slot for the face object that can be accessed directly through */ /* `face->glyph'. */ /* */ /* Each new face object created with this function also owns a */ /* default @FT_Size object, accessible as `face->size'. */ /* */ /* One @FT_Library instance can have multiple face objects, this is, */ /* @FT_Open_Face and its siblings can be called multiple times using */ /* the same `library' argument. */ /* */ /* See the discussion of reference counters in the description of */ /* @FT_Reference_Face. */ /* */ /* To loop over all faces, use code similar to the following snippet */ /* (omitting the error handling). */ /* */ /* { */ /* ... */ /* FT_Face face; */ /* FT_Long i, num_faces; */ /* */ /* */ /* error = FT_Open_Face( library, args, -1, &face ); */ /* if ( error ) { ... } */ /* */ /* num_faces = face->num_faces; */ /* FT_Done_Face( face ); */ /* */ /* for ( i = 0; i < num_faces; i++ ) */ /* { */ /* ... */ /* error = FT_Open_Face( library, args, i, &face ); */ /* ... */ /* FT_Done_Face( face ); */ /* ... */ /* } */ /* } */ /* */ /* To loop over all valid values for `face_index', use something */ /* similar to the following snippet, again without error handling. */ /* The code accesses all faces immediately (thus only a single call */ /* of `FT_Open_Face' within the do-loop), with and without named */ /* instances. */ /* */ /* { */ /* ... */ /* FT_Face face; */ /* */ /* FT_Long num_faces = 0; */ /* FT_Long num_instances = 0; */ /* */ /* FT_Long face_idx = 0; */ /* FT_Long instance_idx = 0; */ /* */ /* */ /* do */ /* { */ /* FT_Long id = ( instance_idx << 16 ) + face_idx; */ /* */ /* */ /* error = FT_Open_Face( library, args, id, &face ); */ /* if ( error ) { ... } */ /* */ /* num_faces = face->num_faces; */ /* num_instances = face->style_flags >> 16; */ /* */ /* ... */ /* */ /* FT_Done_Face( face ); */ /* */ /* if ( instance_idx < num_instances ) */ /* instance_idx++; */ /* else */ /* { */ /* face_idx++; */ /* instance_idx = 0; */ /* } */ /* */ /* } while ( face_idx < num_faces ) */ /* } */ /* */ FT_EXPORT( FT_Error ) FT_Open_Face( FT_Library library, const FT_Open_Args* args, FT_Long face_index, FT_Face *aface ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Attach_File */ /* */ /* <Description> */ /* Call @FT_Attach_Stream to attach a file. */ /* */ /* <InOut> */ /* face :: The target face object. */ /* */ /* <Input> */ /* filepathname :: The pathname. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Attach_File( FT_Face face, const char* filepathname ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Attach_Stream */ /* */ /* <Description> */ /* `Attach' data to a face object. Normally, this is used to read */ /* additional information for the face object. For example, you can */ /* attach an AFM file that comes with a Type~1 font to get the */ /* kerning values and other metrics. */ /* */ /* <InOut> */ /* face :: The target face object. */ /* */ /* <Input> */ /* parameters :: A pointer to @FT_Open_Args that must be filled by */ /* the caller. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* The meaning of the `attach' (i.e., what really happens when the */ /* new file is read) is not fixed by FreeType itself. It really */ /* depends on the font format (and thus the font driver). */ /* */ /* Client applications are expected to know what they are doing */ /* when invoking this function. Most drivers simply do not implement */ /* file or stream attachments. */ /* */ FT_EXPORT( FT_Error ) FT_Attach_Stream( FT_Face face, FT_Open_Args* parameters ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Reference_Face */ /* */ /* <Description> */ /* A counter gets initialized to~1 at the time an @FT_Face structure */ /* is created. This function increments the counter. @FT_Done_Face */ /* then only destroys a face if the counter is~1, otherwise it simply */ /* decrements the counter. */ /* */ /* This function helps in managing life-cycles of structures that */ /* reference @FT_Face objects. */ /* */ /* <Input> */ /* face :: A handle to a target face object. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Since> */ /* 2.4.2 */ /* */ FT_EXPORT( FT_Error ) FT_Reference_Face( FT_Face face ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Done_Face */ /* */ /* <Description> */ /* Discard a given face object, as well as all of its child slots and */ /* sizes. */ /* */ /* <Input> */ /* face :: A handle to a target face object. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* See the discussion of reference counters in the description of */ /* @FT_Reference_Face. */ /* */ FT_EXPORT( FT_Error ) FT_Done_Face( FT_Face face ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Select_Size */ /* */ /* <Description> */ /* Select a bitmap strike. To be more precise, this function sets */ /* the scaling factors of the active @FT_Size object in a face so */ /* that bitmaps from this particular strike are taken by */ /* @FT_Load_Glyph and friends. */ /* */ /* <InOut> */ /* face :: A handle to a target face object. */ /* */ /* <Input> */ /* strike_index :: The index of the bitmap strike in the */ /* `available_sizes' field of @FT_FaceRec structure. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* For bitmaps embedded in outline fonts it is common that only a */ /* subset of the available glyphs at a given ppem value is available. */ /* FreeType silently uses outlines if there is no bitmap for a given */ /* glyph index. */ /* */ /* For GX and OpenType variation fonts, a bitmap strike makes sense */ /* only if the default instance is active (this is, no glyph */ /* variation takes place); otherwise, FreeType simply ignores bitmap */ /* strikes. The same is true for all named instances that are */ /* different from the default instance. */ /* */ /* Don't use this function if you are using the FreeType cache API. */ /* */ FT_EXPORT( FT_Error ) FT_Select_Size( FT_Face face, FT_Int strike_index ); /*************************************************************************/ /* */ /* <Enum> */ /* FT_Size_Request_Type */ /* */ /* <Description> */ /* An enumeration type that lists the supported size request types, */ /* i.e., what input size (in font units) maps to the requested output */ /* size (in pixels, as computed from the arguments of */ /* @FT_Size_Request). */ /* */ /* <Values> */ /* FT_SIZE_REQUEST_TYPE_NOMINAL :: */ /* The nominal size. The `units_per_EM' field of @FT_FaceRec is */ /* used to determine both scaling values. */ /* */ /* This is the standard scaling found in most applications. In */ /* particular, use this size request type for TrueType fonts if */ /* they provide optical scaling or something similar. Note, */ /* however, that `units_per_EM' is a rather abstract value which */ /* bears no relation to the actual size of the glyphs in a font. */ /* */ /* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */ /* The real dimension. The sum of the `ascender' and (minus of) */ /* the `descender' fields of @FT_FaceRec is used to determine both */ /* scaling values. */ /* */ /* FT_SIZE_REQUEST_TYPE_BBOX :: */ /* The font bounding box. The width and height of the `bbox' field */ /* of @FT_FaceRec are used to determine the horizontal and vertical */ /* scaling value, respectively. */ /* */ /* FT_SIZE_REQUEST_TYPE_CELL :: */ /* The `max_advance_width' field of @FT_FaceRec is used to */ /* determine the horizontal scaling value; the vertical scaling */ /* value is determined the same way as */ /* @FT_SIZE_REQUEST_TYPE_REAL_DIM does. Finally, both scaling */ /* values are set to the smaller one. This type is useful if you */ /* want to specify the font size for, say, a window of a given */ /* dimension and 80x24 cells. */ /* */ /* FT_SIZE_REQUEST_TYPE_SCALES :: */ /* Specify the scaling values directly. */ /* */ /* <Note> */ /* The above descriptions only apply to scalable formats. For bitmap */ /* formats, the behaviour is up to the driver. */ /* */ /* See the note section of @FT_Size_Metrics if you wonder how size */ /* requesting relates to scaling values. */ /* */ typedef enum FT_Size_Request_Type_ { FT_SIZE_REQUEST_TYPE_NOMINAL, FT_SIZE_REQUEST_TYPE_REAL_DIM, FT_SIZE_REQUEST_TYPE_BBOX, FT_SIZE_REQUEST_TYPE_CELL, FT_SIZE_REQUEST_TYPE_SCALES, FT_SIZE_REQUEST_TYPE_MAX } FT_Size_Request_Type; /*************************************************************************/ /* */ /* <Struct> */ /* FT_Size_RequestRec */ /* */ /* <Description> */ /* A structure to model a size request. */ /* */ /* <Fields> */ /* type :: See @FT_Size_Request_Type. */ /* */ /* width :: The desired width, given as a 26.6 fractional */ /* point value (with 72pt = 1in). */ /* */ /* height :: The desired height, given as a 26.6 fractional */ /* point value (with 72pt = 1in). */ /* */ /* horiResolution :: The horizontal resolution (dpi, i.e., pixels per */ /* inch). If set to zero, `width' is treated as a */ /* 26.6 fractional *pixel* value, which gets */ /* internally rounded to an integer. */ /* */ /* vertResolution :: The vertical resolution (dpi, i.e., pixels per */ /* inch). If set to zero, `height' is treated as a */ /* 26.6 fractional *pixel* value, which gets */ /* internally rounded to an integer. */ /* */ /* <Note> */ /* If `width' is zero, the horizontal scaling value is set equal */ /* to the vertical scaling value, and vice versa. */ /* */ /* If `type' is FT_SIZE_REQUEST_TYPE_SCALES, `width' and `height' are */ /* interpreted directly as 16.16 fractional scaling values, without */ /* any further modification, and both `horiResolution' and */ /* `vertResolution' are ignored. */ /* */ typedef struct FT_Size_RequestRec_ { FT_Size_Request_Type type; FT_Long width; FT_Long height; FT_UInt horiResolution; FT_UInt vertResolution; } FT_Size_RequestRec; /*************************************************************************/ /* */ /* <Struct> */ /* FT_Size_Request */ /* */ /* <Description> */ /* A handle to a size request structure. */ /* */ typedef struct FT_Size_RequestRec_ *FT_Size_Request; /*************************************************************************/ /* */ /* <Function> */ /* FT_Request_Size */ /* */ /* <Description> */ /* Resize the scale of the active @FT_Size object in a face. */ /* */ /* <InOut> */ /* face :: A handle to a target face object. */ /* */ /* <Input> */ /* req :: A pointer to a @FT_Size_RequestRec. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* Although drivers may select the bitmap strike matching the */ /* request, you should not rely on this if you intend to select a */ /* particular bitmap strike. Use @FT_Select_Size instead in that */ /* case. */ /* */ /* The relation between the requested size and the resulting glyph */ /* size is dependent entirely on how the size is defined in the */ /* source face. The font designer chooses the final size of each */ /* glyph relative to this size. For more information refer to */ /* `https://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html'. */ /* */ /* Contrary to @FT_Set_Char_Size, this function doesn't have special */ /* code to normalize zero-valued widths, heights, or resolutions */ /* (which lead to errors in most cases). */ /* */ /* Don't use this function if you are using the FreeType cache API. */ /* */ FT_EXPORT( FT_Error ) FT_Request_Size( FT_Face face, FT_Size_Request req ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Set_Char_Size */ /* */ /* <Description> */ /* Call @FT_Request_Size to request the nominal size (in points). */ /* */ /* <InOut> */ /* face :: A handle to a target face object. */ /* */ /* <Input> */ /* char_width :: The nominal width, in 26.6 fractional points. */ /* */ /* char_height :: The nominal height, in 26.6 fractional points. */ /* */ /* horz_resolution :: The horizontal resolution in dpi. */ /* */ /* vert_resolution :: The vertical resolution in dpi. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* While this function allows fractional points as input values, the */ /* resulting ppem value for the given resolution is always rounded to */ /* the nearest integer. */ /* */ /* If either the character width or height is zero, it is set equal */ /* to the other value. */ /* */ /* If either the horizontal or vertical resolution is zero, it is set */ /* equal to the other value. */ /* */ /* A character width or height smaller than 1pt is set to 1pt; if */ /* both resolution values are zero, they are set to 72dpi. */ /* */ /* Don't use this function if you are using the FreeType cache API. */ /* */ FT_EXPORT( FT_Error ) FT_Set_Char_Size( FT_Face face, FT_F26Dot6 char_width, FT_F26Dot6 char_height, FT_UInt horz_resolution, FT_UInt vert_resolution ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Set_Pixel_Sizes */ /* */ /* <Description> */ /* Call @FT_Request_Size to request the nominal size (in pixels). */ /* */ /* <InOut> */ /* face :: A handle to the target face object. */ /* */ /* <Input> */ /* pixel_width :: The nominal width, in pixels. */ /* */ /* pixel_height :: The nominal height, in pixels. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* You should not rely on the resulting glyphs matching or being */ /* constrained to this pixel size. Refer to @FT_Request_Size to */ /* understand how requested sizes relate to actual sizes. */ /* */ /* Don't use this function if you are using the FreeType cache API. */ /* */ FT_EXPORT( FT_Error ) FT_Set_Pixel_Sizes( FT_Face face, FT_UInt pixel_width, FT_UInt pixel_height ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Load_Glyph */ /* */ /* <Description> */ /* Load a glyph into the glyph slot of a face object. */ /* */ /* <InOut> */ /* face :: A handle to the target face object where the glyph */ /* is loaded. */ /* */ /* <Input> */ /* glyph_index :: The index of the glyph in the font file. For */ /* CID-keyed fonts (either in PS or in CFF format) */ /* this argument specifies the CID value. */ /* */ /* load_flags :: A flag indicating what to load for this glyph. The */ /* @FT_LOAD_XXX constants can be used to control the */ /* glyph loading process (e.g., whether the outline */ /* should be scaled, whether to load bitmaps or not, */ /* whether to hint the outline, etc). */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* The loaded glyph may be transformed. See @FT_Set_Transform for */ /* the details. */ /* */ /* For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is */ /* returned for invalid CID values (this is, for CID values that */ /* don't have a corresponding glyph in the font). See the discussion */ /* of the @FT_FACE_FLAG_CID_KEYED flag for more details. */ /* */ /* If you receive `FT_Err_Glyph_Too_Big', try getting the glyph */ /* outline at EM size, then scale it manually and fill it as a */ /* graphics operation. */ /* */ FT_EXPORT( FT_Error ) FT_Load_Glyph( FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Load_Char */ /* */ /* <Description> */ /* Load a glyph into the glyph slot of a face object, accessed by its */ /* character code. */ /* */ /* <InOut> */ /* face :: A handle to a target face object where the glyph */ /* is loaded. */ /* */ /* <Input> */ /* char_code :: The glyph's character code, according to the */ /* current charmap used in the face. */ /* */ /* load_flags :: A flag indicating what to load for this glyph. The */ /* @FT_LOAD_XXX constants can be used to control the */ /* glyph loading process (e.g., whether the outline */ /* should be scaled, whether to load bitmaps or not, */ /* whether to hint the outline, etc). */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. */ /* */ /* Many fonts contain glyphs that can't be loaded by this function */ /* since its glyph indices are not listed in any of the font's */ /* charmaps. */ /* */ FT_EXPORT( FT_Error ) FT_Load_Char( FT_Face face, FT_ULong char_code, FT_Int32 load_flags ); /************************************************************************* * * @enum: * FT_LOAD_XXX * * @description: * A list of bit field constants for @FT_Load_Glyph to indicate what * kind of operations to perform during glyph loading. * * @values: * FT_LOAD_DEFAULT :: * Corresponding to~0, this value is used as the default glyph load * operation. In this case, the following happens: * * 1. FreeType looks for a bitmap for the glyph corresponding to the * face's current size. If one is found, the function returns. * The bitmap data can be accessed from the glyph slot (see note * below). * * 2. If no embedded bitmap is searched for or found, FreeType looks * for a scalable outline. If one is found, it is loaded from * the font file, scaled to device pixels, then `hinted' to the * pixel grid in order to optimize it. The outline data can be * accessed from the glyph slot (see note below). * * Note that by default the glyph loader doesn't render outlines into * bitmaps. The following flags are used to modify this default * behaviour to more specific and useful cases. * * FT_LOAD_NO_SCALE :: * Don't scale the loaded outline glyph but keep it in font units. * * This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and * unsets @FT_LOAD_RENDER. * * If the font is `tricky' (see @FT_FACE_FLAG_TRICKY for more), using * FT_LOAD_NO_SCALE usually yields meaningless outlines because the * subglyphs must be scaled and positioned with hinting instructions. * This can be solved by loading the font without FT_LOAD_NO_SCALE and * setting the character size to `font->units_per_EM'. * * FT_LOAD_NO_HINTING :: * Disable hinting. This generally generates `blurrier' bitmap glyphs * when the glyph are rendered in any of the anti-aliased modes. See * also the note below. * * This flag is implied by @FT_LOAD_NO_SCALE. * * FT_LOAD_RENDER :: * Call @FT_Render_Glyph after the glyph is loaded. By default, the * glyph is rendered in @FT_RENDER_MODE_NORMAL mode. This can be * overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME. * * This flag is unset by @FT_LOAD_NO_SCALE. * * FT_LOAD_NO_BITMAP :: * Ignore bitmap strikes when loading. Bitmap-only fonts ignore this * flag. * * @FT_LOAD_NO_SCALE always sets this flag. * * FT_LOAD_VERTICAL_LAYOUT :: * Load the glyph for vertical text layout. In particular, the * `advance' value in the @FT_GlyphSlotRec structure is set to the * `vertAdvance' value of the `metrics' field. * * In case @FT_HAS_VERTICAL doesn't return true, you shouldn't use * this flag currently. Reason is that in this case vertical metrics * get synthesized, and those values are not always consistent across * various font formats. * * FT_LOAD_FORCE_AUTOHINT :: * Prefer the auto-hinter over the font's native hinter. See also * the note below. * * FT_LOAD_PEDANTIC :: * Make the font driver perform pedantic verifications during glyph * loading. This is mostly used to detect broken glyphs in fonts. * By default, FreeType tries to handle broken fonts also. * * In particular, errors from the TrueType bytecode engine are not * passed to the application if this flag is not set; this might * result in partially hinted or distorted glyphs in case a glyph's * bytecode is buggy. * * FT_LOAD_NO_RECURSE :: * Don't load composite glyphs recursively. Instead, the font * driver should set the `num_subglyph' and `subglyphs' values of * the glyph slot accordingly, and set `glyph->format' to * @FT_GLYPH_FORMAT_COMPOSITE. The description of subglyphs can * then be accessed with @FT_Get_SubGlyph_Info. * * This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM. * * FT_LOAD_IGNORE_TRANSFORM :: * Ignore the transform matrix set by @FT_Set_Transform. * * FT_LOAD_MONOCHROME :: * This flag is used with @FT_LOAD_RENDER to indicate that you want to * render an outline glyph to a 1-bit monochrome bitmap glyph, with * 8~pixels packed into each byte of the bitmap data. * * Note that this has no effect on the hinting algorithm used. You * should rather use @FT_LOAD_TARGET_MONO so that the * monochrome-optimized hinting algorithm is used. * * FT_LOAD_LINEAR_DESIGN :: * Keep `linearHoriAdvance' and `linearVertAdvance' fields of * @FT_GlyphSlotRec in font units. See @FT_GlyphSlotRec for * details. * * FT_LOAD_NO_AUTOHINT :: * Disable the auto-hinter. See also the note below. * * FT_LOAD_COLOR :: * Load embedded color bitmap images. The resulting color bitmaps, * if available, will have the @FT_PIXEL_MODE_BGRA format. If the * flag is not set and color bitmaps are found, they are converted * to 256-level gray bitmaps transparently, using the * @FT_PIXEL_MODE_GRAY format. * * FT_LOAD_COMPUTE_METRICS :: * Compute glyph metrics from the glyph data, without the use of * bundled metrics tables (for example, the `hdmx' table in TrueType * fonts). This flag is mainly used by font validating or font * editing applications, which need to ignore, verify, or edit those * tables. * * Currently, this flag is only implemented for TrueType fonts. * * FT_LOAD_BITMAP_METRICS_ONLY :: * Request loading of the metrics and bitmap image information of a * (possibly embedded) bitmap glyph without allocating or copying * the bitmap image data itself. No effect if the target glyph is * not a bitmap image. * * This flag unsets @FT_LOAD_RENDER. * * FT_LOAD_CROP_BITMAP :: * Ignored. Deprecated. * * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH :: * Ignored. Deprecated. * * @note: * By default, hinting is enabled and the font's native hinter (see * @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can * disable hinting by setting @FT_LOAD_NO_HINTING or change the * precedence by setting @FT_LOAD_FORCE_AUTOHINT. You can also set * @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be * used at all. * * See the description of @FT_FACE_FLAG_TRICKY for a special exception * (affecting only a handful of Asian fonts). * * Besides deciding which hinter to use, you can also decide which * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details. * * Note that the auto-hinter needs a valid Unicode cmap (either a native * one or synthesized by FreeType) for producing correct results. If a * font provides an incorrect mapping (for example, assigning the * character code U+005A, LATIN CAPITAL LETTER Z, to a glyph depicting a * mathematical integral sign), the auto-hinter might produce useless * results. * */ #define FT_LOAD_DEFAULT 0x0 #define FT_LOAD_NO_SCALE ( 1L << 0 ) #define FT_LOAD_NO_HINTING ( 1L << 1 ) #define FT_LOAD_RENDER ( 1L << 2 ) #define FT_LOAD_NO_BITMAP ( 1L << 3 ) #define FT_LOAD_VERTICAL_LAYOUT ( 1L << 4 ) #define FT_LOAD_FORCE_AUTOHINT ( 1L << 5 ) #define FT_LOAD_CROP_BITMAP ( 1L << 6 ) #define FT_LOAD_PEDANTIC ( 1L << 7 ) #define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ( 1L << 9 ) #define FT_LOAD_NO_RECURSE ( 1L << 10 ) #define FT_LOAD_IGNORE_TRANSFORM ( 1L << 11 ) #define FT_LOAD_MONOCHROME ( 1L << 12 ) #define FT_LOAD_LINEAR_DESIGN ( 1L << 13 ) #define FT_LOAD_NO_AUTOHINT ( 1L << 15 ) /* Bits 16-19 are used by `FT_LOAD_TARGET_' */ #define FT_LOAD_COLOR ( 1L << 20 ) #define FT_LOAD_COMPUTE_METRICS ( 1L << 21 ) #define FT_LOAD_BITMAP_METRICS_ONLY ( 1L << 22 ) /* */ /* used internally only by certain font drivers */ #define FT_LOAD_ADVANCE_ONLY ( 1L << 8 ) #define FT_LOAD_SBITS_ONLY ( 1L << 14 ) /************************************************************************** * * @enum: * FT_LOAD_TARGET_XXX * * @description: * A list of values to select a specific hinting algorithm for the * hinter. You should OR one of these values to your `load_flags' * when calling @FT_Load_Glyph. * * Note that a font's native hinters may ignore the hinting algorithm * you have specified (e.g., the TrueType bytecode interpreter). You * can set @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is * used. * * @values: * FT_LOAD_TARGET_NORMAL :: * The default hinting algorithm, optimized for standard gray-level * rendering. For monochrome output, use @FT_LOAD_TARGET_MONO * instead. * * FT_LOAD_TARGET_LIGHT :: * A lighter hinting algorithm for gray-level modes. Many generated * glyphs are fuzzier but better resemble their original shape. This * is achieved by snapping glyphs to the pixel grid only vertically * (Y-axis), as is done by FreeType's new CFF engine or Microsoft's * ClearType font renderer. This preserves inter-glyph spacing in * horizontal text. The snapping is done either by the native font * driver, if the driver itself and the font support it, or by the * auto-hinter. * * Advance widths are rounded to integer values; however, using the * `lsb_delta' and `rsb_delta' fields of @FT_GlyphSlotRec, it is * possible to get fractional advance widths for sub-pixel positioning * (which is recommended to use). * * If configuration option AF_CONFIG_OPTION_TT_SIZE_METRICS is active, * TrueType-like metrics are used to make this mode behave similarly * as in unpatched FreeType versions between 2.4.6 and 2.7.1 * (inclusive). * * FT_LOAD_TARGET_MONO :: * Strong hinting algorithm that should only be used for monochrome * output. The result is probably unpleasant if the glyph is rendered * in non-monochrome modes. * * FT_LOAD_TARGET_LCD :: * A variant of @FT_LOAD_TARGET_LIGHT optimized for horizontally * decimated LCD displays. * * FT_LOAD_TARGET_LCD_V :: * A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically * decimated LCD displays. * * @note: * You should use only _one_ of the FT_LOAD_TARGET_XXX values in your * `load_flags'. They can't be ORed. * * If @FT_LOAD_RENDER is also set, the glyph is rendered in the * corresponding mode (i.e., the mode that matches the used algorithm * best). An exception is FT_LOAD_TARGET_MONO since it implies * @FT_LOAD_MONOCHROME. * * You can use a hinting algorithm that doesn't correspond to the same * rendering mode. As an example, it is possible to use the `light' * hinting algorithm and have the results rendered in horizontal LCD * pixel mode, with code like * * { * FT_Load_Glyph( face, glyph_index, * load_flags | FT_LOAD_TARGET_LIGHT ); * * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD ); * } * * In general, you should stick with one rendering mode. For example, * switching between @FT_LOAD_TARGET_NORMAL and @FT_LOAD_TARGET_MONO * enforces a lot of recomputation for TrueType fonts, which is slow. * Another reason is caching: Selecting a different mode usually causes * changes in both the outlines and the rasterized bitmaps; it is thus * necessary to empty the cache after a mode switch to avoid false hits. * */ #define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 ) #define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL ) #define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT ) #define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO ) #define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD ) #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V ) /************************************************************************** * * @macro: * FT_LOAD_TARGET_MODE * * @description: * Return the @FT_Render_Mode corresponding to a given * @FT_LOAD_TARGET_XXX value. * */ #define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) ) /*************************************************************************/ /* */ /* <Function> */ /* FT_Set_Transform */ /* */ /* <Description> */ /* Set the transformation that is applied to glyph images when they */ /* are loaded into a glyph slot through @FT_Load_Glyph. */ /* */ /* <InOut> */ /* face :: A handle to the source face object. */ /* */ /* <Input> */ /* matrix :: A pointer to the transformation's 2x2 matrix. Use NULL */ /* for the identity matrix. */ /* delta :: A pointer to the translation vector. Use NULL for the */ /* null vector. */ /* */ /* <Note> */ /* The transformation is only applied to scalable image formats after */ /* the glyph has been loaded. It means that hinting is unaltered by */ /* the transformation and is performed on the character size given in */ /* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */ /* */ /* Note that this also transforms the `face.glyph.advance' field, but */ /* *not* the values in `face.glyph.metrics'. */ /* */ FT_EXPORT( void ) FT_Set_Transform( FT_Face face, FT_Matrix* matrix, FT_Vector* delta ); /*************************************************************************/ /* */ /* <Enum> */ /* FT_Render_Mode */ /* */ /* <Description> */ /* Render modes supported by FreeType~2. Each mode corresponds to a */ /* specific type of scanline conversion performed on the outline. */ /* */ /* For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode' */ /* field in the @FT_GlyphSlotRec structure gives the format of the */ /* returned bitmap. */ /* */ /* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity, */ /* indicating pixel coverage. Use linear alpha blending and gamma */ /* correction to correctly render non-monochrome glyph bitmaps onto a */ /* surface; see @FT_Render_Glyph. */ /* */ /* <Values> */ /* FT_RENDER_MODE_NORMAL :: */ /* Default render mode; it corresponds to 8-bit anti-aliased */ /* bitmaps. */ /* */ /* FT_RENDER_MODE_LIGHT :: */ /* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */ /* defined as a separate value because render modes are also used */ /* indirectly to define hinting algorithm selectors. See */ /* @FT_LOAD_TARGET_XXX for details. */ /* */ /* FT_RENDER_MODE_MONO :: */ /* This mode corresponds to 1-bit bitmaps (with 2~levels of */ /* opacity). */ /* */ /* FT_RENDER_MODE_LCD :: */ /* This mode corresponds to horizontal RGB and BGR sub-pixel */ /* displays like LCD screens. It produces 8-bit bitmaps that are */ /* 3~times the width of the original glyph outline in pixels, and */ /* which use the @FT_PIXEL_MODE_LCD mode. */ /* */ /* FT_RENDER_MODE_LCD_V :: */ /* This mode corresponds to vertical RGB and BGR sub-pixel displays */ /* (like PDA screens, rotated LCD displays, etc.). It produces */ /* 8-bit bitmaps that are 3~times the height of the original */ /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */ /* */ /* <Note> */ /* The LCD-optimized glyph bitmaps produced by `FT_Render_Glyph' can */ /* be filtered to reduce color-fringes by using */ /* @FT_Library_SetLcdFilter (not active in the default builds). It */ /* is up to the caller to either call `FT_Library_SetLcdFilter' (if */ /* available) or do the filtering itself. */ /* */ /* The selected render mode only affects vector glyphs of a font. */ /* Embedded bitmaps often have a different pixel mode like */ /* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform */ /* them into 8-bit pixmaps. */ /* */ typedef enum FT_Render_Mode_ { FT_RENDER_MODE_NORMAL = 0, FT_RENDER_MODE_LIGHT, FT_RENDER_MODE_MONO, FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V, FT_RENDER_MODE_MAX } FT_Render_Mode; /* these constants are deprecated; use the corresponding */ /* `FT_Render_Mode' values instead */ #define ft_render_mode_normal FT_RENDER_MODE_NORMAL #define ft_render_mode_mono FT_RENDER_MODE_MONO /*************************************************************************/ /* */ /* <Function> */ /* FT_Render_Glyph */ /* */ /* <Description> */ /* Convert a given glyph image to a bitmap. It does so by inspecting */ /* the glyph image format, finding the relevant renderer, and */ /* invoking it. */ /* */ /* <InOut> */ /* slot :: A handle to the glyph slot containing the image to */ /* convert. */ /* */ /* <Input> */ /* render_mode :: The render mode used to render the glyph image into */ /* a bitmap. See @FT_Render_Mode for a list of */ /* possible values. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* To get meaningful results, font scaling values must be set with */ /* functions like @FT_Set_Char_Size before calling `FT_Render_Glyph'. */ /* */ /* When FreeType outputs a bitmap of a glyph, it really outputs an */ /* alpha coverage map. If a pixel is completely covered by a */ /* filled-in outline, the bitmap contains 0xFF at that pixel, meaning */ /* that 0xFF/0xFF fraction of that pixel is covered, meaning the */ /* pixel is 100% black (or 0% bright). If a pixel is only 50% */ /* covered (value 0x80), the pixel is made 50% black (50% bright or a */ /* middle shade of grey). 0% covered means 0% black (100% bright or */ /* white). */ /* */ /* On high-DPI screens like on smartphones and tablets, the pixels */ /* are so small that their chance of being completely covered and */ /* therefore completely black are fairly good. On the low-DPI */ /* screens, however, the situation is different. The pixels are too */ /* large for most of the details of a glyph and shades of gray are */ /* the norm rather than the exception. */ /* */ /* This is relevant because all our screens have a second problem: */ /* they are not linear. 1~+~1 is not~2. Twice the value does not */ /* result in twice the brightness. When a pixel is only 50% covered, */ /* the coverage map says 50% black, and this translates to a pixel */ /* value of 128 when you use 8~bits per channel (0-255). However, */ /* this does not translate to 50% brightness for that pixel on our */ /* sRGB and gamma~2.2 screens. Due to their non-linearity, they */ /* dwell longer in the darks and only a pixel value of about 186 */ /* results in 50% brightness -- 128 ends up too dark on both bright */ /* and dark backgrounds. The net result is that dark text looks */ /* burnt-out, pixely and blotchy on bright background, bright text */ /* too frail on dark backgrounds, and colored text on colored */ /* background (for example, red on green) seems to have dark halos or */ /* `dirt' around it. The situation is especially ugly for diagonal */ /* stems like in `w' glyph shapes where the quality of FreeType's */ /* anti-aliasing depends on the correct display of grays. On */ /* high-DPI screens where smaller, fully black pixels reign supreme, */ /* this doesn't matter, but on our low-DPI screens with all the gray */ /* shades, it does. 0% and 100% brightness are the same things in */ /* linear and non-linear space, just all the shades in-between */ /* aren't. */ /* */ /* The blending function for placing text over a background is */ /* */ /* { */ /* dst = alpha * src + (1 - alpha) * dst , */ /* } */ /* */ /* which is known as the OVER operator. */ /* */ /* To correctly composite an antialiased pixel of a glyph onto a */ /* surface, */ /* */ /* 1. take the foreground and background colors (e.g., in sRGB space) */ /* and apply gamma to get them in a linear space, */ /* */ /* 2. use OVER to blend the two linear colors using the glyph pixel */ /* as the alpha value (remember, the glyph bitmap is an alpha */ /* coverage bitmap), and */ /* */ /* 3. apply inverse gamma to the blended pixel and write it back to */ /* the image. */ /* */ /* Internal testing at Adobe found that a target inverse gamma of~1.8 */ /* for step~3 gives good results across a wide range of displays with */ /* an sRGB gamma curve or a similar one. */ /* */ /* This process can cost performance. There is an approximation that */ /* does not need to know about the background color; see */ /* https://bel.fi/alankila/lcd/ and */ /* https://bel.fi/alankila/lcd/alpcor.html for details. */ /* */ /* *ATTENTION*: Linear blending is even more important when dealing */ /* with subpixel-rendered glyphs to prevent color-fringing! A */ /* subpixel-rendered glyph must first be filtered with a filter that */ /* gives equal weight to the three color primaries and does not */ /* exceed a sum of 0x100, see section @lcd_filtering. Then the */ /* only difference to gray linear blending is that subpixel-rendered */ /* linear blending is done 3~times per pixel: red foreground subpixel */ /* to red background subpixel and so on for green and blue. */ /* */ FT_EXPORT( FT_Error ) FT_Render_Glyph( FT_GlyphSlot slot, FT_Render_Mode render_mode ); /*************************************************************************/ /* */ /* <Enum> */ /* FT_Kerning_Mode */ /* */ /* <Description> */ /* An enumeration to specify the format of kerning values returned by */ /* @FT_Get_Kerning. */ /* */ /* <Values> */ /* FT_KERNING_DEFAULT :: Return grid-fitted kerning distances in */ /* 26.6 fractional pixels. */ /* */ /* FT_KERNING_UNFITTED :: Return un-grid-fitted kerning distances in */ /* 26.6 fractional pixels. */ /* */ /* FT_KERNING_UNSCALED :: Return the kerning vector in original font */ /* units. */ /* */ /* <Note> */ /* FT_KERNING_DEFAULT returns full pixel values; it also makes */ /* FreeType heuristically scale down kerning distances at small ppem */ /* values so that they don't become too big. */ /* */ /* Both FT_KERNING_DEFAULT and FT_KERNING_UNFITTED use the current */ /* horizontal scaling factor (as set e.g. with @FT_Set_Char_Size) to */ /* convert font units to pixels. */ /* */ typedef enum FT_Kerning_Mode_ { FT_KERNING_DEFAULT = 0, FT_KERNING_UNFITTED, FT_KERNING_UNSCALED } FT_Kerning_Mode; /* these constants are deprecated; use the corresponding */ /* `FT_Kerning_Mode' values instead */ #define ft_kerning_default FT_KERNING_DEFAULT #define ft_kerning_unfitted FT_KERNING_UNFITTED #define ft_kerning_unscaled FT_KERNING_UNSCALED /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_Kerning */ /* */ /* <Description> */ /* Return the kerning vector between two glyphs of the same face. */ /* */ /* <Input> */ /* face :: A handle to a source face object. */ /* */ /* left_glyph :: The index of the left glyph in the kern pair. */ /* */ /* right_glyph :: The index of the right glyph in the kern pair. */ /* */ /* kern_mode :: See @FT_Kerning_Mode for more information. */ /* Determines the scale and dimension of the returned */ /* kerning vector. */ /* */ /* <Output> */ /* akerning :: The kerning vector. This is either in font units, */ /* fractional pixels (26.6 format), or pixels for */ /* scalable formats, and in pixels for fixed-sizes */ /* formats. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* Only horizontal layouts (left-to-right & right-to-left) are */ /* supported by this method. Other layouts, or more sophisticated */ /* kernings, are out of the scope of this API function -- they can be */ /* implemented through format-specific interfaces. */ /* */ /* Kerning for OpenType fonts implemented in a `GPOS' table is not */ /* supported; use @FT_HAS_KERNING to find out whether a font has data */ /* that can be extracted with `FT_Get_Kerning'. */ /* */ FT_EXPORT( FT_Error ) FT_Get_Kerning( FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector *akerning ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_Track_Kerning */ /* */ /* <Description> */ /* Return the track kerning for a given face object at a given size. */ /* */ /* <Input> */ /* face :: A handle to a source face object. */ /* */ /* point_size :: The point size in 16.16 fractional points. */ /* */ /* degree :: The degree of tightness. Increasingly negative */ /* values represent tighter track kerning, while */ /* increasingly positive values represent looser track */ /* kerning. Value zero means no track kerning. */ /* */ /* <Output> */ /* akerning :: The kerning in 16.16 fractional points, to be */ /* uniformly applied between all glyphs. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* Currently, only the Type~1 font driver supports track kerning, */ /* using data from AFM files (if attached with @FT_Attach_File or */ /* @FT_Attach_Stream). */ /* */ /* Only very few AFM files come with track kerning data; please refer */ /* to Adobe's AFM specification for more details. */ /* */ FT_EXPORT( FT_Error ) FT_Get_Track_Kerning( FT_Face face, FT_Fixed point_size, FT_Int degree, FT_Fixed* akerning ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_Glyph_Name */ /* */ /* <Description> */ /* Retrieve the ASCII name of a given glyph in a face. This only */ /* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1. */ /* */ /* <Input> */ /* face :: A handle to a source face object. */ /* */ /* glyph_index :: The glyph index. */ /* */ /* buffer_max :: The maximum number of bytes available in the */ /* buffer. */ /* */ /* <Output> */ /* buffer :: A pointer to a target buffer where the name is */ /* copied to. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* An error is returned if the face doesn't provide glyph names or if */ /* the glyph index is invalid. In all cases of failure, the first */ /* byte of `buffer' is set to~0 to indicate an empty name. */ /* */ /* The glyph name is truncated to fit within the buffer if it is too */ /* long. The returned string is always zero-terminated. */ /* */ /* Be aware that FreeType reorders glyph indices internally so that */ /* glyph index~0 always corresponds to the `missing glyph' (called */ /* `.notdef'). */ /* */ /* This function always returns an error if the config macro */ /* `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is not defined in `ftoption.h'. */ /* */ FT_EXPORT( FT_Error ) FT_Get_Glyph_Name( FT_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_Postscript_Name */ /* */ /* <Description> */ /* Retrieve the ASCII PostScript name of a given face, if available. */ /* This only works with PostScript, TrueType, and OpenType fonts. */ /* */ /* <Input> */ /* face :: A handle to the source face object. */ /* */ /* <Return> */ /* A pointer to the face's PostScript name. NULL if unavailable. */ /* */ /* <Note> */ /* The returned pointer is owned by the face and is destroyed with */ /* it. */ /* */ /* For variation fonts, this string changes if you select a different */ /* instance, and you have to call `FT_Get_PostScript_Name' again to */ /* retrieve it. FreeType follows Adobe TechNote #5902, `Generating */ /* PostScript Names for Fonts Using OpenType Font Variations'. */ /* */ /* http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5902.AdobePSNameGeneration.html */ /* */ FT_EXPORT( const char* ) FT_Get_Postscript_Name( FT_Face face ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Select_Charmap */ /* */ /* <Description> */ /* Select a given charmap by its encoding tag (as listed in */ /* `freetype.h'). */ /* */ /* <InOut> */ /* face :: A handle to the source face object. */ /* */ /* <Input> */ /* encoding :: A handle to the selected encoding. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* This function returns an error if no charmap in the face */ /* corresponds to the encoding queried here. */ /* */ /* Because many fonts contain more than a single cmap for Unicode */ /* encoding, this function has some special code to select the one */ /* that covers Unicode best (`best' in the sense that a UCS-4 cmap is */ /* preferred to a UCS-2 cmap). It is thus preferable to */ /* @FT_Set_Charmap in this case. */ /* */ FT_EXPORT( FT_Error ) FT_Select_Charmap( FT_Face face, FT_Encoding encoding ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Set_Charmap */ /* */ /* <Description> */ /* Select a given charmap for character code to glyph index mapping. */ /* */ /* <InOut> */ /* face :: A handle to the source face object. */ /* */ /* <Input> */ /* charmap :: A handle to the selected charmap. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* This function returns an error if the charmap is not part of */ /* the face (i.e., if it is not listed in the `face->charmaps' */ /* table). */ /* */ /* It also fails if an OpenType type~14 charmap is selected (which */ /* doesn't map character codes to glyph indices at all). */ /* */ FT_EXPORT( FT_Error ) FT_Set_Charmap( FT_Face face, FT_CharMap charmap ); /************************************************************************* * * @function: * FT_Get_Charmap_Index * * @description: * Retrieve index of a given charmap. * * @input: * charmap :: * A handle to a charmap. * * @return: * The index into the array of character maps within the face to which * `charmap' belongs. If an error occurs, -1 is returned. * */ FT_EXPORT( FT_Int ) FT_Get_Charmap_Index( FT_CharMap charmap ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_Char_Index */ /* */ /* <Description> */ /* Return the glyph index of a given character code. This function */ /* uses the currently selected charmap to do the mapping. */ /* */ /* <Input> */ /* face :: A handle to the source face object. */ /* */ /* charcode :: The character code. */ /* */ /* <Return> */ /* The glyph index. 0~means `undefined character code'. */ /* */ /* <Note> */ /* If you use FreeType to manipulate the contents of font files */ /* directly, be aware that the glyph index returned by this function */ /* doesn't always correspond to the internal indices used within the */ /* file. This is done to ensure that value~0 always corresponds to */ /* the `missing glyph'. If the first glyph is not named `.notdef', */ /* then for Type~1 and Type~42 fonts, `.notdef' will be moved into */ /* the glyph ID~0 position, and whatever was there will be moved to */ /* the position `.notdef' had. For Type~1 fonts, if there is no */ /* `.notdef' glyph at all, then one will be created at index~0 and */ /* whatever was there will be moved to the last index -- Type~42 */ /* fonts are considered invalid under this condition. */ /* */ FT_EXPORT( FT_UInt ) FT_Get_Char_Index( FT_Face face, FT_ULong charcode ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_First_Char */ /* */ /* <Description> */ /* Return the first character code in the current charmap of a given */ /* face, together with its corresponding glyph index. */ /* */ /* <Input> */ /* face :: A handle to the source face object. */ /* */ /* <Output> */ /* agindex :: Glyph index of first character code. 0~if charmap is */ /* empty. */ /* */ /* <Return> */ /* The charmap's first character code. */ /* */ /* <Note> */ /* You should use this function together with @FT_Get_Next_Char to */ /* parse all character codes available in a given charmap. The code */ /* should look like this: */ /* */ /* { */ /* FT_ULong charcode; */ /* FT_UInt gindex; */ /* */ /* */ /* charcode = FT_Get_First_Char( face, &gindex ); */ /* while ( gindex != 0 ) */ /* { */ /* ... do something with (charcode,gindex) pair ... */ /* */ /* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */ /* } */ /* } */ /* */ /* Be aware that character codes can have values up to 0xFFFFFFFF; */ /* this might happen for non-Unicode or malformed cmaps. However, */ /* even with regular Unicode encoding, so-called `last resort fonts' */ /* (using SFNT cmap format 13, see function @FT_Get_CMap_Format) */ /* normally have entries for all Unicode characters up to 0x1FFFFF, */ /* which can cause *a lot* of iterations. */ /* */ /* Note that `*agindex' is set to~0 if the charmap is empty. The */ /* result itself can be~0 in two cases: if the charmap is empty or */ /* if the value~0 is the first valid character code. */ /* */ FT_EXPORT( FT_ULong ) FT_Get_First_Char( FT_Face face, FT_UInt *agindex ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_Next_Char */ /* */ /* <Description> */ /* Return the next character code in the current charmap of a given */ /* face following the value `char_code', as well as the corresponding */ /* glyph index. */ /* */ /* <Input> */ /* face :: A handle to the source face object. */ /* */ /* char_code :: The starting character code. */ /* */ /* <Output> */ /* agindex :: Glyph index of next character code. 0~if charmap */ /* is empty. */ /* */ /* <Return> */ /* The charmap's next character code. */ /* */ /* <Note> */ /* You should use this function with @FT_Get_First_Char to walk */ /* over all character codes available in a given charmap. See the */ /* note for that function for a simple code example. */ /* */ /* Note that `*agindex' is set to~0 when there are no more codes in */ /* the charmap. */ /* */ FT_EXPORT( FT_ULong ) FT_Get_Next_Char( FT_Face face, FT_ULong char_code, FT_UInt *agindex ); /************************************************************************* * * @function: * FT_Face_Properties * * @description: * Set or override certain (library or module-wide) properties on a * face-by-face basis. Useful for finer-grained control and avoiding * locks on shared structures (threads can modify their own faces as * they see fit). * * Contrary to @FT_Property_Set, this function uses @FT_Parameter so * that you can pass multiple properties to the target face in one call. * Note that only a subset of the available properties can be * controlled. * * * Stem darkening (@FT_PARAM_TAG_STEM_DARKENING, corresponding to the * property `no-stem-darkening' provided by the `autofit' and `cff' * modules; see @no-stem-darkening[autofit] and * @no-stem-darkening[cff]). * * * LCD filter weights (@FT_PARAM_TAG_LCD_FILTER_WEIGHTS, corresponding * to function @FT_Library_SetLcdFilterWeights). * * * Seed value for the CFF `random' operator * (@FT_PARAM_TAG_RANDOM_SEED, corresponding to the `random-seed' * property provided by the `cff' module; see @random-seed). * * Pass NULL as `data' in @FT_Parameter for a given tag to reset the * option and use the library or module default again. * * @input: * face :: * A handle to the source face object. * * num_properties :: * The number of properties that follow. * * properties :: * A handle to an @FT_Parameter array with `num_properties' elements. * * @return: * FreeType error code. 0~means success. * * @note: * Here an example that sets three properties. You must define * FT_CONFIG_OPTION_SUBPIXEL_RENDERING to make the LCD filter examples * work. * * { * FT_Parameter property1; * FT_Bool darken_stems = 1; * * FT_Parameter property2; * FT_LcdFiveTapFilter custom_weight = * { 0x11, 0x44, 0x56, 0x44, 0x11 }; * * FT_Parameter property3; * FT_Int32 random_seed = 314159265; * * FT_Parameter properties[3] = { property1, * property2, * property3 }; * * * property1.tag = FT_PARAM_TAG_STEM_DARKENING; * property1.data = &darken_stems; * * property2.tag = FT_PARAM_TAG_LCD_FILTER_WEIGHTS; * property2.data = custom_weight; * * property3.tag = FT_PARAM_TAG_RANDOM_SEED; * property3.data = &random_seed; * * FT_Face_Properties( face, 3, properties ); * } * * The next example resets a single property to its default value. * * { * FT_Parameter property; * * * property.tag = FT_PARAM_TAG_LCD_FILTER_WEIGHTS; * property.data = NULL; * * FT_Face_Properties( face, 1, &property ); * } * */ FT_EXPORT( FT_Error ) FT_Face_Properties( FT_Face face, FT_UInt num_properties, FT_Parameter* properties ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_Name_Index */ /* */ /* <Description> */ /* Return the glyph index of a given glyph name. */ /* */ /* <Input> */ /* face :: A handle to the source face object. */ /* */ /* glyph_name :: The glyph name. */ /* */ /* <Return> */ /* The glyph index. 0~means `undefined character code'. */ /* */ FT_EXPORT( FT_UInt ) FT_Get_Name_Index( FT_Face face, FT_String* glyph_name ); /************************************************************************* * * @macro: * FT_SUBGLYPH_FLAG_XXX * * @description: * A list of constants describing subglyphs. Please refer to the * `glyf' table description in the OpenType specification for the * meaning of the various flags (which get synthesized for * non-OpenType subglyphs). * * @values: * FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS :: * FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES :: * FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID :: * FT_SUBGLYPH_FLAG_SCALE :: * FT_SUBGLYPH_FLAG_XY_SCALE :: * FT_SUBGLYPH_FLAG_2X2 :: * FT_SUBGLYPH_FLAG_USE_MY_METRICS :: * */ #define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1 #define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2 #define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4 #define FT_SUBGLYPH_FLAG_SCALE 8 #define FT_SUBGLYPH_FLAG_XY_SCALE 0x40 #define FT_SUBGLYPH_FLAG_2X2 0x80 #define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200 /************************************************************************* * * @func: * FT_Get_SubGlyph_Info * * @description: * Retrieve a description of a given subglyph. Only use it if * `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is * returned otherwise. * * @input: * glyph :: * The source glyph slot. * * sub_index :: * The index of the subglyph. Must be less than * `glyph->num_subglyphs'. * * @output: * p_index :: * The glyph index of the subglyph. * * p_flags :: * The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX. * * p_arg1 :: * The subglyph's first argument (if any). * * p_arg2 :: * The subglyph's second argument (if any). * * p_transform :: * The subglyph transformation (if any). * * @return: * FreeType error code. 0~means success. * * @note: * The values of `*p_arg1', `*p_arg2', and `*p_transform' must be * interpreted depending on the flags returned in `*p_flags'. See the * OpenType specification for details. * */ FT_EXPORT( FT_Error ) FT_Get_SubGlyph_Info( FT_GlyphSlot glyph, FT_UInt sub_index, FT_Int *p_index, FT_UInt *p_flags, FT_Int *p_arg1, FT_Int *p_arg2, FT_Matrix *p_transform ); /*************************************************************************/ /* */ /* <Enum> */ /* FT_FSTYPE_XXX */ /* */ /* <Description> */ /* A list of bit flags used in the `fsType' field of the OS/2 table */ /* in a TrueType or OpenType font and the `FSType' entry in a */ /* PostScript font. These bit flags are returned by */ /* @FT_Get_FSType_Flags; they inform client applications of embedding */ /* and subsetting restrictions associated with a font. */ /* */ /* See */ /* http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/FontPolicies.pdf */ /* for more details. */ /* */ /* <Values> */ /* FT_FSTYPE_INSTALLABLE_EMBEDDING :: */ /* Fonts with no fsType bit set may be embedded and permanently */ /* installed on the remote system by an application. */ /* */ /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING :: */ /* Fonts that have only this bit set must not be modified, embedded */ /* or exchanged in any manner without first obtaining permission of */ /* the font software copyright owner. */ /* */ /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING :: */ /* The font may be embedded and temporarily loaded on the remote */ /* system. Documents containing Preview & Print fonts must be */ /* opened `read-only'; no edits can be applied to the document. */ /* */ /* FT_FSTYPE_EDITABLE_EMBEDDING :: */ /* The font may be embedded but must only be installed temporarily */ /* on other systems. In contrast to Preview & Print fonts, */ /* documents containing editable fonts may be opened for reading, */ /* editing is permitted, and changes may be saved. */ /* */ /* FT_FSTYPE_NO_SUBSETTING :: */ /* The font may not be subsetted prior to embedding. */ /* */ /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY :: */ /* Only bitmaps contained in the font may be embedded; no outline */ /* data may be embedded. If there are no bitmaps available in the */ /* font, then the font is unembeddable. */ /* */ /* <Note> */ /* The flags are ORed together, thus more than a single value can be */ /* returned. */ /* */ /* While the `fsType' flags can indicate that a font may be embedded, */ /* a license with the font vendor may be separately required to use */ /* the font in this way. */ /* */ #define FT_FSTYPE_INSTALLABLE_EMBEDDING 0x0000 #define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING 0x0002 #define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING 0x0004 #define FT_FSTYPE_EDITABLE_EMBEDDING 0x0008 #define FT_FSTYPE_NO_SUBSETTING 0x0100 #define FT_FSTYPE_BITMAP_EMBEDDING_ONLY 0x0200 /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_FSType_Flags */ /* */ /* <Description> */ /* Return the `fsType' flags for a font. */ /* */ /* <Input> */ /* face :: A handle to the source face object. */ /* */ /* <Return> */ /* The `fsType' flags, see @FT_FSTYPE_XXX. */ /* */ /* <Note> */ /* Use this function rather than directly reading the `fs_type' field */ /* in the @PS_FontInfoRec structure, which is only guaranteed to */ /* return the correct results for Type~1 fonts. */ /* */ /* <Since> */ /* 2.3.8 */ /* */ FT_EXPORT( FT_UShort ) FT_Get_FSType_Flags( FT_Face face ); /*************************************************************************/ /* */ /* <Section> */ /* glyph_variants */ /* */ /* <Title> */ /* Unicode Variation Sequences */ /* */ /* <Abstract> */ /* The FreeType~2 interface to Unicode Variation Sequences (UVS), */ /* using the SFNT cmap format~14. */ /* */ /* <Description> */ /* Many characters, especially for CJK scripts, have variant forms. */ /* They are a sort of grey area somewhere between being totally */ /* irrelevant and semantically distinct; for this reason, the Unicode */ /* consortium decided to introduce Variation Sequences (VS), */ /* consisting of a Unicode base character and a variation selector */ /* instead of further extending the already huge number of */ /* characters. */ /* */ /* Unicode maintains two different sets, namely `Standardized */ /* Variation Sequences' and registered `Ideographic Variation */ /* Sequences' (IVS), collected in the `Ideographic Variation */ /* Database' (IVD). */ /* */ /* http://unicode.org/Public/UCD/latest/ucd/StandardizedVariants.txt */ /* http://unicode.org/reports/tr37/ */ /* http://unicode.org/ivd/ */ /* */ /* To date (January 2017), the character with the most ideographic */ /* variations is U+9089, having 32 such IVS. */ /* */ /* Three Mongolian Variation Selectors have the values U+180B-U+180D; */ /* 256 generic Variation Selectors are encoded in the ranges */ /* U+FE00-U+FE0F and U+E0100-U+E01EF. IVS currently use Variation */ /* Selectors from the range U+E0100-U+E01EF only. */ /* */ /* A VS consists of the base character value followed by a single */ /* Variation Selector. For example, to get the first variation of */ /* U+9089, you have to write the character sequence `U+9089 U+E0100'. */ /* */ /* Adobe and MS decided to support both standardized and ideographic */ /* VS with a new cmap subtable (format~14). It is an odd subtable */ /* because it is not a mapping of input code points to glyphs, but */ /* contains lists of all variations supported by the font. */ /* */ /* A variation may be either `default' or `non-default' for a given */ /* font. A default variation is the one you will get for that code */ /* point if you look it up in the standard Unicode cmap. A */ /* non-default variation is a different glyph. */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Function> */ /* FT_Face_GetCharVariantIndex */ /* */ /* <Description> */ /* Return the glyph index of a given character code as modified by */ /* the variation selector. */ /* */ /* <Input> */ /* face :: */ /* A handle to the source face object. */ /* */ /* charcode :: */ /* The character code point in Unicode. */ /* */ /* variantSelector :: */ /* The Unicode code point of the variation selector. */ /* */ /* <Return> */ /* The glyph index. 0~means either `undefined character code', or */ /* `undefined selector code', or `no variation selector cmap */ /* subtable', or `current CharMap is not Unicode'. */ /* */ /* <Note> */ /* If you use FreeType to manipulate the contents of font files */ /* directly, be aware that the glyph index returned by this function */ /* doesn't always correspond to the internal indices used within */ /* the file. This is done to ensure that value~0 always corresponds */ /* to the `missing glyph'. */ /* */ /* This function is only meaningful if */ /* a) the font has a variation selector cmap sub table, */ /* and */ /* b) the current charmap has a Unicode encoding. */ /* */ /* <Since> */ /* 2.3.6 */ /* */ FT_EXPORT( FT_UInt ) FT_Face_GetCharVariantIndex( FT_Face face, FT_ULong charcode, FT_ULong variantSelector ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Face_GetCharVariantIsDefault */ /* */ /* <Description> */ /* Check whether this variation of this Unicode character is the one */ /* to be found in the `cmap'. */ /* */ /* <Input> */ /* face :: */ /* A handle to the source face object. */ /* */ /* charcode :: */ /* The character codepoint in Unicode. */ /* */ /* variantSelector :: */ /* The Unicode codepoint of the variation selector. */ /* */ /* <Return> */ /* 1~if found in the standard (Unicode) cmap, 0~if found in the */ /* variation selector cmap, or -1 if it is not a variation. */ /* */ /* <Note> */ /* This function is only meaningful if the font has a variation */ /* selector cmap subtable. */ /* */ /* <Since> */ /* 2.3.6 */ /* */ FT_EXPORT( FT_Int ) FT_Face_GetCharVariantIsDefault( FT_Face face, FT_ULong charcode, FT_ULong variantSelector ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Face_GetVariantSelectors */ /* */ /* <Description> */ /* Return a zero-terminated list of Unicode variation selectors found */ /* in the font. */ /* */ /* <Input> */ /* face :: */ /* A handle to the source face object. */ /* */ /* <Return> */ /* A pointer to an array of selector code points, or NULL if there is */ /* no valid variation selector cmap subtable. */ /* */ /* <Note> */ /* The last item in the array is~0; the array is owned by the */ /* @FT_Face object but can be overwritten or released on the next */ /* call to a FreeType function. */ /* */ /* <Since> */ /* 2.3.6 */ /* */ FT_EXPORT( FT_UInt32* ) FT_Face_GetVariantSelectors( FT_Face face ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Face_GetVariantsOfChar */ /* */ /* <Description> */ /* Return a zero-terminated list of Unicode variation selectors found */ /* for the specified character code. */ /* */ /* <Input> */ /* face :: */ /* A handle to the source face object. */ /* */ /* charcode :: */ /* The character codepoint in Unicode. */ /* */ /* <Return> */ /* A pointer to an array of variation selector code points that are */ /* active for the given character, or NULL if the corresponding list */ /* is empty. */ /* */ /* <Note> */ /* The last item in the array is~0; the array is owned by the */ /* @FT_Face object but can be overwritten or released on the next */ /* call to a FreeType function. */ /* */ /* <Since> */ /* 2.3.6 */ /* */ FT_EXPORT( FT_UInt32* ) FT_Face_GetVariantsOfChar( FT_Face face, FT_ULong charcode ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Face_GetCharsOfVariant */ /* */ /* <Description> */ /* Return a zero-terminated list of Unicode character codes found for */ /* the specified variation selector. */ /* */ /* <Input> */ /* face :: */ /* A handle to the source face object. */ /* */ /* variantSelector :: */ /* The variation selector code point in Unicode. */ /* */ /* <Return> */ /* A list of all the code points that are specified by this selector */ /* (both default and non-default codes are returned) or NULL if there */ /* is no valid cmap or the variation selector is invalid. */ /* */ /* <Note> */ /* The last item in the array is~0; the array is owned by the */ /* @FT_Face object but can be overwritten or released on the next */ /* call to a FreeType function. */ /* */ /* <Since> */ /* 2.3.6 */ /* */ FT_EXPORT( FT_UInt32* ) FT_Face_GetCharsOfVariant( FT_Face face, FT_ULong variantSelector ); /*************************************************************************/ /* */ /* <Section> */ /* computations */ /* */ /* <Title> */ /* Computations */ /* */ /* <Abstract> */ /* Crunching fixed numbers and vectors. */ /* */ /* <Description> */ /* This section contains various functions used to perform */ /* computations on 16.16 fixed-float numbers or 2d vectors. */ /* */ /* <Order> */ /* FT_MulDiv */ /* FT_MulFix */ /* FT_DivFix */ /* FT_RoundFix */ /* FT_CeilFix */ /* FT_FloorFix */ /* FT_Vector_Transform */ /* FT_Matrix_Multiply */ /* FT_Matrix_Invert */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Function> */ /* FT_MulDiv */ /* */ /* <Description> */ /* Compute `(a*b)/c' with maximum accuracy, using a 64-bit */ /* intermediate integer whenever necessary. */ /* */ /* This function isn't necessarily as fast as some processor specific */ /* operations, but is at least completely portable. */ /* */ /* <Input> */ /* a :: The first multiplier. */ /* */ /* b :: The second multiplier. */ /* */ /* c :: The divisor. */ /* */ /* <Return> */ /* The result of `(a*b)/c'. This function never traps when trying to */ /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */ /* on the signs of `a' and `b'. */ /* */ FT_EXPORT( FT_Long ) FT_MulDiv( FT_Long a, FT_Long b, FT_Long c ); /*************************************************************************/ /* */ /* <Function> */ /* FT_MulFix */ /* */ /* <Description> */ /* Compute `(a*b)/0x10000' with maximum accuracy. Its main use is to */ /* multiply a given value by a 16.16 fixed-point factor. */ /* */ /* <Input> */ /* a :: The first multiplier. */ /* */ /* b :: The second multiplier. Use a 16.16 factor here whenever */ /* possible (see note below). */ /* */ /* <Return> */ /* The result of `(a*b)/0x10000'. */ /* */ /* <Note> */ /* This function has been optimized for the case where the absolute */ /* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */ /* As this happens mainly when scaling from notional units to */ /* fractional pixels in FreeType, it resulted in noticeable speed */ /* improvements between versions 2.x and 1.x. */ /* */ /* As a conclusion, always try to place a 16.16 factor as the */ /* _second_ argument of this function; this can make a great */ /* difference. */ /* */ FT_EXPORT( FT_Long ) FT_MulFix( FT_Long a, FT_Long b ); /*************************************************************************/ /* */ /* <Function> */ /* FT_DivFix */ /* */ /* <Description> */ /* Compute `(a*0x10000)/b' with maximum accuracy. Its main use is to */ /* divide a given value by a 16.16 fixed-point factor. */ /* */ /* <Input> */ /* a :: The numerator. */ /* */ /* b :: The denominator. Use a 16.16 factor here. */ /* */ /* <Return> */ /* The result of `(a*0x10000)/b'. */ /* */ FT_EXPORT( FT_Long ) FT_DivFix( FT_Long a, FT_Long b ); /*************************************************************************/ /* */ /* <Function> */ /* FT_RoundFix */ /* */ /* <Description> */ /* Round a 16.16 fixed number. */ /* */ /* <Input> */ /* a :: The number to be rounded. */ /* */ /* <Return> */ /* `a' rounded to the nearest 16.16 fixed integer, halfway cases away */ /* from zero. */ /* */ FT_EXPORT( FT_Fixed ) FT_RoundFix( FT_Fixed a ); /*************************************************************************/ /* */ /* <Function> */ /* FT_CeilFix */ /* */ /* <Description> */ /* Compute the smallest following integer of a 16.16 fixed number. */ /* */ /* <Input> */ /* a :: The number for which the ceiling function is to be computed. */ /* */ /* <Return> */ /* `a' rounded towards plus infinity. */ /* */ FT_EXPORT( FT_Fixed ) FT_CeilFix( FT_Fixed a ); /*************************************************************************/ /* */ /* <Function> */ /* FT_FloorFix */ /* */ /* <Description> */ /* Compute the largest previous integer of a 16.16 fixed number. */ /* */ /* <Input> */ /* a :: The number for which the floor function is to be computed. */ /* */ /* <Return> */ /* `a' rounded towards minus infinity. */ /* */ FT_EXPORT( FT_Fixed ) FT_FloorFix( FT_Fixed a ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Vector_Transform */ /* */ /* <Description> */ /* Transform a single vector through a 2x2 matrix. */ /* */ /* <InOut> */ /* vector :: The target vector to transform. */ /* */ /* <Input> */ /* matrix :: A pointer to the source 2x2 matrix. */ /* */ /* <Note> */ /* The result is undefined if either `vector' or `matrix' is invalid. */ /* */ FT_EXPORT( void ) FT_Vector_Transform( FT_Vector* vec, const FT_Matrix* matrix ); /*************************************************************************/ /* */ /* <Section> */ /* version */ /* */ /* <Title> */ /* FreeType Version */ /* */ /* <Abstract> */ /* Functions and macros related to FreeType versions. */ /* */ /* <Description> */ /* Note that those functions and macros are of limited use because */ /* even a new release of FreeType with only documentation changes */ /* increases the version number. */ /* */ /* <Order> */ /* FT_Library_Version */ /* */ /* FREETYPE_MAJOR */ /* FREETYPE_MINOR */ /* FREETYPE_PATCH */ /* */ /* FT_Face_CheckTrueTypePatents */ /* FT_Face_SetUnpatentedHinting */ /* */ /* FREETYPE_XXX */ /* */ /*************************************************************************/ /************************************************************************* * * @enum: * FREETYPE_XXX * * @description: * These three macros identify the FreeType source code version. * Use @FT_Library_Version to access them at runtime. * * @values: * FREETYPE_MAJOR :: The major version number. * FREETYPE_MINOR :: The minor version number. * FREETYPE_PATCH :: The patch level. * * @note: * The version number of FreeType if built as a dynamic link library * with the `libtool' package is _not_ controlled by these three * macros. * */ #define FREETYPE_MAJOR 2 #define FREETYPE_MINOR 8 #define FREETYPE_PATCH 0 /*************************************************************************/ /* */ /* <Function> */ /* FT_Library_Version */ /* */ /* <Description> */ /* Return the version of the FreeType library being used. This is */ /* useful when dynamically linking to the library, since one cannot */ /* use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and */ /* @FREETYPE_PATCH. */ /* */ /* <Input> */ /* library :: A source library handle. */ /* */ /* <Output> */ /* amajor :: The major version number. */ /* */ /* aminor :: The minor version number. */ /* */ /* apatch :: The patch version number. */ /* */ /* <Note> */ /* The reason why this function takes a `library' argument is because */ /* certain programs implement library initialization in a custom way */ /* that doesn't use @FT_Init_FreeType. */ /* */ /* In such cases, the library version might not be available before */ /* the library object has been created. */ /* */ FT_EXPORT( void ) FT_Library_Version( FT_Library library, FT_Int *amajor, FT_Int *aminor, FT_Int *apatch ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Face_CheckTrueTypePatents */ /* */ /* <Description> */ /* Deprecated, does nothing. */ /* */ /* <Input> */ /* face :: A face handle. */ /* */ /* <Return> */ /* Always returns false. */ /* */ /* <Note> */ /* Since May 2010, TrueType hinting is no longer patented. */ /* */ /* <Since> */ /* 2.3.5 */ /* */ FT_EXPORT( FT_Bool ) FT_Face_CheckTrueTypePatents( FT_Face face ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Face_SetUnpatentedHinting */ /* */ /* <Description> */ /* Deprecated, does nothing. */ /* */ /* <Input> */ /* face :: A face handle. */ /* */ /* value :: New boolean setting. */ /* */ /* <Return> */ /* Always returns false. */ /* */ /* <Note> */ /* Since May 2010, TrueType hinting is no longer patented. */ /* */ /* <Since> */ /* 2.3.5 */ /* */ FT_EXPORT( FT_Bool ) FT_Face_SetUnpatentedHinting( FT_Face face, FT_Bool value ); /* */ FT_END_HEADER #endif /* FREETYPE_H_ */ /* END */ �����������������������������������������������������������������freetype2/freetype/ftsystem.h�����������������������������������������������������������������������0000644�����������������00000024472�14763166026�0012347 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftsystem.h */ /* */ /* FreeType low-level system interface definition (specification). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTSYSTEM_H_ #define FTSYSTEM_H_ #include <ft2build.h> FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* system_interface */ /* */ /* <Title> */ /* System Interface */ /* */ /* <Abstract> */ /* How FreeType manages memory and i/o. */ /* */ /* <Description> */ /* This section contains various definitions related to memory */ /* management and i/o access. You need to understand this */ /* information if you want to use a custom memory manager or you own */ /* i/o streams. */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* M E M O R Y M A N A G E M E N T */ /* */ /*************************************************************************/ /************************************************************************* * * @type: * FT_Memory * * @description: * A handle to a given memory manager object, defined with an * @FT_MemoryRec structure. * */ typedef struct FT_MemoryRec_* FT_Memory; /************************************************************************* * * @functype: * FT_Alloc_Func * * @description: * A function used to allocate `size' bytes from `memory'. * * @input: * memory :: * A handle to the source memory manager. * * size :: * The size in bytes to allocate. * * @return: * Address of new memory block. 0~in case of failure. * */ typedef void* (*FT_Alloc_Func)( FT_Memory memory, long size ); /************************************************************************* * * @functype: * FT_Free_Func * * @description: * A function used to release a given block of memory. * * @input: * memory :: * A handle to the source memory manager. * * block :: * The address of the target memory block. * */ typedef void (*FT_Free_Func)( FT_Memory memory, void* block ); /************************************************************************* * * @functype: * FT_Realloc_Func * * @description: * A function used to re-allocate a given block of memory. * * @input: * memory :: * A handle to the source memory manager. * * cur_size :: * The block's current size in bytes. * * new_size :: * The block's requested new size. * * block :: * The block's current address. * * @return: * New block address. 0~in case of memory shortage. * * @note: * In case of error, the old block must still be available. * */ typedef void* (*FT_Realloc_Func)( FT_Memory memory, long cur_size, long new_size, void* block ); /************************************************************************* * * @struct: * FT_MemoryRec * * @description: * A structure used to describe a given memory manager to FreeType~2. * * @fields: * user :: * A generic typeless pointer for user data. * * alloc :: * A pointer type to an allocation function. * * free :: * A pointer type to an memory freeing function. * * realloc :: * A pointer type to a reallocation function. * */ struct FT_MemoryRec_ { void* user; FT_Alloc_Func alloc; FT_Free_Func free; FT_Realloc_Func realloc; }; /*************************************************************************/ /* */ /* I / O M A N A G E M E N T */ /* */ /*************************************************************************/ /************************************************************************* * * @type: * FT_Stream * * @description: * A handle to an input stream. * * @also: * See @FT_StreamRec for the publicly accessible fields of a given * stream object. * */ typedef struct FT_StreamRec_* FT_Stream; /************************************************************************* * * @struct: * FT_StreamDesc * * @description: * A union type used to store either a long or a pointer. This is used * to store a file descriptor or a `FILE*' in an input stream. * */ typedef union FT_StreamDesc_ { long value; void* pointer; } FT_StreamDesc; /************************************************************************* * * @functype: * FT_Stream_IoFunc * * @description: * A function used to seek and read data from a given input stream. * * @input: * stream :: * A handle to the source stream. * * offset :: * The offset of read in stream (always from start). * * buffer :: * The address of the read buffer. * * count :: * The number of bytes to read from the stream. * * @return: * The number of bytes effectively read by the stream. * * @note: * This function might be called to perform a seek or skip operation * with a `count' of~0. A non-zero return value then indicates an * error. * */ typedef unsigned long (*FT_Stream_IoFunc)( FT_Stream stream, unsigned long offset, unsigned char* buffer, unsigned long count ); /************************************************************************* * * @functype: * FT_Stream_CloseFunc * * @description: * A function used to close a given input stream. * * @input: * stream :: * A handle to the target stream. * */ typedef void (*FT_Stream_CloseFunc)( FT_Stream stream ); /************************************************************************* * * @struct: * FT_StreamRec * * @description: * A structure used to describe an input stream. * * @input: * base :: * For memory-based streams, this is the address of the first stream * byte in memory. This field should always be set to NULL for * disk-based streams. * * size :: * The stream size in bytes. * * In case of compressed streams where the size is unknown before * actually doing the decompression, the value is set to 0x7FFFFFFF. * (Note that this size value can occur for normal streams also; it is * thus just a hint.) * * pos :: * The current position within the stream. * * descriptor :: * This field is a union that can hold an integer or a pointer. It is * used by stream implementations to store file descriptors or `FILE*' * pointers. * * pathname :: * This field is completely ignored by FreeType. However, it is often * useful during debugging to use it to store the stream's filename * (where available). * * read :: * The stream's input function. * * close :: * The stream's close function. * * memory :: * The memory manager to use to preload frames. This is set * internally by FreeType and shouldn't be touched by stream * implementations. * * cursor :: * This field is set and used internally by FreeType when parsing * frames. * * limit :: * This field is set and used internally by FreeType when parsing * frames. * */ typedef struct FT_StreamRec_ { unsigned char* base; unsigned long size; unsigned long pos; FT_StreamDesc descriptor; FT_StreamDesc pathname; FT_Stream_IoFunc read; FT_Stream_CloseFunc close; FT_Memory memory; unsigned char* cursor; unsigned char* limit; } FT_StreamRec; /* */ FT_END_HEADER #endif /* FTSYSTEM_H_ */ /* END */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftoutln.h������������������������������������������������������������������������0000644�����������������00000105633�14763166026�0012163 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftoutln.h */ /* */ /* Support for the FT_Outline type used to store glyph shapes of */ /* most scalable font formats (specification). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTOUTLN_H_ #define FTOUTLN_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* outline_processing */ /* */ /* <Title> */ /* Outline Processing */ /* */ /* <Abstract> */ /* Functions to create, transform, and render vectorial glyph images. */ /* */ /* <Description> */ /* This section contains routines used to create and destroy scalable */ /* glyph images known as `outlines'. These can also be measured, */ /* transformed, and converted into bitmaps and pixmaps. */ /* */ /* <Order> */ /* FT_Outline */ /* FT_Outline_New */ /* FT_Outline_Done */ /* FT_Outline_Copy */ /* FT_Outline_Translate */ /* FT_Outline_Transform */ /* FT_Outline_Embolden */ /* FT_Outline_EmboldenXY */ /* FT_Outline_Reverse */ /* FT_Outline_Check */ /* */ /* FT_Outline_Get_CBox */ /* FT_Outline_Get_BBox */ /* */ /* FT_Outline_Get_Bitmap */ /* FT_Outline_Render */ /* FT_Outline_Decompose */ /* FT_Outline_Funcs */ /* FT_Outline_MoveToFunc */ /* FT_Outline_LineToFunc */ /* FT_Outline_ConicToFunc */ /* FT_Outline_CubicToFunc */ /* */ /* FT_Orientation */ /* FT_Outline_Get_Orientation */ /* */ /* FT_OUTLINE_XXX */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Function> */ /* FT_Outline_Decompose */ /* */ /* <Description> */ /* Walk over an outline's structure to decompose it into individual */ /* segments and Bézier arcs. This function also emits `move to' */ /* operations to indicate the start of new contours in the outline. */ /* */ /* <Input> */ /* outline :: A pointer to the source target. */ /* */ /* func_interface :: A table of `emitters', i.e., function pointers */ /* called during decomposition to indicate path */ /* operations. */ /* */ /* <InOut> */ /* user :: A typeless pointer that is passed to each */ /* emitter during the decomposition. It can be */ /* used to store the state during the */ /* decomposition. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* A contour that contains a single point only is represented by a */ /* `move to' operation followed by `line to' to the same point. In */ /* most cases, it is best to filter this out before using the */ /* outline for stroking purposes (otherwise it would result in a */ /* visible dot when round caps are used). */ /* */ /* Similarly, the function returns success for an empty outline also */ /* (doing nothing, this is, not calling any emitter); if necessary, */ /* you should filter this out, too. */ /* */ FT_EXPORT( FT_Error ) FT_Outline_Decompose( FT_Outline* outline, const FT_Outline_Funcs* func_interface, void* user ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Outline_New */ /* */ /* <Description> */ /* Create a new outline of a given size. */ /* */ /* <Input> */ /* library :: A handle to the library object from where the */ /* outline is allocated. Note however that the new */ /* outline will *not* necessarily be *freed*, when */ /* destroying the library, by @FT_Done_FreeType. */ /* */ /* numPoints :: The maximum number of points within the outline. */ /* Must be smaller than or equal to 0xFFFF (65535). */ /* */ /* numContours :: The maximum number of contours within the outline. */ /* This value must be in the range 0 to `numPoints'. */ /* */ /* <Output> */ /* anoutline :: A handle to the new outline. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* The reason why this function takes a `library' parameter is simply */ /* to use the library's memory allocator. */ /* */ FT_EXPORT( FT_Error ) FT_Outline_New( FT_Library library, FT_UInt numPoints, FT_Int numContours, FT_Outline *anoutline ); FT_EXPORT( FT_Error ) FT_Outline_New_Internal( FT_Memory memory, FT_UInt numPoints, FT_Int numContours, FT_Outline *anoutline ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Outline_Done */ /* */ /* <Description> */ /* Destroy an outline created with @FT_Outline_New. */ /* */ /* <Input> */ /* library :: A handle of the library object used to allocate the */ /* outline. */ /* */ /* outline :: A pointer to the outline object to be discarded. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* If the outline's `owner' field is not set, only the outline */ /* descriptor will be released. */ /* */ /* The reason why this function takes an `library' parameter is */ /* simply to use ft_mem_free(). */ /* */ FT_EXPORT( FT_Error ) FT_Outline_Done( FT_Library library, FT_Outline* outline ); FT_EXPORT( FT_Error ) FT_Outline_Done_Internal( FT_Memory memory, FT_Outline* outline ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Outline_Check */ /* */ /* <Description> */ /* Check the contents of an outline descriptor. */ /* */ /* <Input> */ /* outline :: A handle to a source outline. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* An empty outline, or an outline with a single point only is also */ /* valid. */ /* */ FT_EXPORT( FT_Error ) FT_Outline_Check( FT_Outline* outline ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Outline_Get_CBox */ /* */ /* <Description> */ /* Return an outline's `control box'. The control box encloses all */ /* the outline's points, including Bézier control points. Though it */ /* coincides with the exact bounding box for most glyphs, it can be */ /* slightly larger in some situations (like when rotating an outline */ /* that contains Bézier outside arcs). */ /* */ /* Computing the control box is very fast, while getting the bounding */ /* box can take much more time as it needs to walk over all segments */ /* and arcs in the outline. To get the latter, you can use the */ /* `ftbbox' component, which is dedicated to this single task. */ /* */ /* <Input> */ /* outline :: A pointer to the source outline descriptor. */ /* */ /* <Output> */ /* acbox :: The outline's control box. */ /* */ /* <Note> */ /* See @FT_Glyph_Get_CBox for a discussion of tricky fonts. */ /* */ FT_EXPORT( void ) FT_Outline_Get_CBox( const FT_Outline* outline, FT_BBox *acbox ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Outline_Translate */ /* */ /* <Description> */ /* Apply a simple translation to the points of an outline. */ /* */ /* <InOut> */ /* outline :: A pointer to the target outline descriptor. */ /* */ /* <Input> */ /* xOffset :: The horizontal offset. */ /* */ /* yOffset :: The vertical offset. */ /* */ FT_EXPORT( void ) FT_Outline_Translate( const FT_Outline* outline, FT_Pos xOffset, FT_Pos yOffset ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Outline_Copy */ /* */ /* <Description> */ /* Copy an outline into another one. Both objects must have the */ /* same sizes (number of points & number of contours) when this */ /* function is called. */ /* */ /* <Input> */ /* source :: A handle to the source outline. */ /* */ /* <Output> */ /* target :: A handle to the target outline. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_Outline_Copy( const FT_Outline* source, FT_Outline *target ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Outline_Transform */ /* */ /* <Description> */ /* Apply a simple 2x2 matrix to all of an outline's points. Useful */ /* for applying rotations, slanting, flipping, etc. */ /* */ /* <InOut> */ /* outline :: A pointer to the target outline descriptor. */ /* */ /* <Input> */ /* matrix :: A pointer to the transformation matrix. */ /* */ /* <Note> */ /* You can use @FT_Outline_Translate if you need to translate the */ /* outline's points. */ /* */ FT_EXPORT( void ) FT_Outline_Transform( const FT_Outline* outline, const FT_Matrix* matrix ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Outline_Embolden */ /* */ /* <Description> */ /* Embolden an outline. The new outline will be at most 4~times */ /* `strength' pixels wider and higher. You may think of the left and */ /* bottom borders as unchanged. */ /* */ /* Negative `strength' values to reduce the outline thickness are */ /* possible also. */ /* */ /* <InOut> */ /* outline :: A handle to the target outline. */ /* */ /* <Input> */ /* strength :: How strong the glyph is emboldened. Expressed in */ /* 26.6 pixel format. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* The used algorithm to increase or decrease the thickness of the */ /* glyph doesn't change the number of points; this means that certain */ /* situations like acute angles or intersections are sometimes */ /* handled incorrectly. */ /* */ /* If you need `better' metrics values you should call */ /* @FT_Outline_Get_CBox or @FT_Outline_Get_BBox. */ /* */ /* Example call: */ /* */ /* { */ /* FT_Load_Glyph( face, index, FT_LOAD_DEFAULT ); */ /* if ( face->glyph->format == FT_GLYPH_FORMAT_OUTLINE ) */ /* FT_Outline_Embolden( &face->glyph->outline, strength ); */ /* } */ /* */ /* To get meaningful results, font scaling values must be set with */ /* functions like @FT_Set_Char_Size before calling FT_Render_Glyph. */ /* */ FT_EXPORT( FT_Error ) FT_Outline_Embolden( FT_Outline* outline, FT_Pos strength ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Outline_EmboldenXY */ /* */ /* <Description> */ /* Embolden an outline. The new outline will be `xstrength' pixels */ /* wider and `ystrength' pixels higher. Otherwise, it is similar to */ /* @FT_Outline_Embolden, which uses the same strength in both */ /* directions. */ /* */ FT_EXPORT( FT_Error ) FT_Outline_EmboldenXY( FT_Outline* outline, FT_Pos xstrength, FT_Pos ystrength ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Outline_Reverse */ /* */ /* <Description> */ /* Reverse the drawing direction of an outline. This is used to */ /* ensure consistent fill conventions for mirrored glyphs. */ /* */ /* <InOut> */ /* outline :: A pointer to the target outline descriptor. */ /* */ /* <Note> */ /* This function toggles the bit flag @FT_OUTLINE_REVERSE_FILL in */ /* the outline's `flags' field. */ /* */ /* It shouldn't be used by a normal client application, unless it */ /* knows what it is doing. */ /* */ FT_EXPORT( void ) FT_Outline_Reverse( FT_Outline* outline ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Outline_Get_Bitmap */ /* */ /* <Description> */ /* Render an outline within a bitmap. The outline's image is simply */ /* OR-ed to the target bitmap. */ /* */ /* <Input> */ /* library :: A handle to a FreeType library object. */ /* */ /* outline :: A pointer to the source outline descriptor. */ /* */ /* <InOut> */ /* abitmap :: A pointer to the target bitmap descriptor. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* This function does NOT CREATE the bitmap, it only renders an */ /* outline image within the one you pass to it! Consequently, the */ /* various fields in `abitmap' should be set accordingly. */ /* */ /* It will use the raster corresponding to the default glyph format. */ /* */ /* The value of the `num_grays' field in `abitmap' is ignored. If */ /* you select the gray-level rasterizer, and you want less than 256 */ /* gray levels, you have to use @FT_Outline_Render directly. */ /* */ FT_EXPORT( FT_Error ) FT_Outline_Get_Bitmap( FT_Library library, FT_Outline* outline, const FT_Bitmap *abitmap ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Outline_Render */ /* */ /* <Description> */ /* Render an outline within a bitmap using the current scan-convert. */ /* This function uses an @FT_Raster_Params structure as an argument, */ /* allowing advanced features like direct composition, translucency, */ /* etc. */ /* */ /* <Input> */ /* library :: A handle to a FreeType library object. */ /* */ /* outline :: A pointer to the source outline descriptor. */ /* */ /* <InOut> */ /* params :: A pointer to an @FT_Raster_Params structure used to */ /* describe the rendering operation. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* You should know what you are doing and how @FT_Raster_Params works */ /* to use this function. */ /* */ /* The field `params.source' will be set to `outline' before the scan */ /* converter is called, which means that the value you give to it is */ /* actually ignored. */ /* */ /* The gray-level rasterizer always uses 256 gray levels. If you */ /* want less gray levels, you have to provide your own span callback. */ /* See the @FT_RASTER_FLAG_DIRECT value of the `flags' field in the */ /* @FT_Raster_Params structure for more details. */ /* */ FT_EXPORT( FT_Error ) FT_Outline_Render( FT_Library library, FT_Outline* outline, FT_Raster_Params* params ); /************************************************************************** * * @enum: * FT_Orientation * * @description: * A list of values used to describe an outline's contour orientation. * * The TrueType and PostScript specifications use different conventions * to determine whether outline contours should be filled or unfilled. * * @values: * FT_ORIENTATION_TRUETYPE :: * According to the TrueType specification, clockwise contours must * be filled, and counter-clockwise ones must be unfilled. * * FT_ORIENTATION_POSTSCRIPT :: * According to the PostScript specification, counter-clockwise contours * must be filled, and clockwise ones must be unfilled. * * FT_ORIENTATION_FILL_RIGHT :: * This is identical to @FT_ORIENTATION_TRUETYPE, but is used to * remember that in TrueType, everything that is to the right of * the drawing direction of a contour must be filled. * * FT_ORIENTATION_FILL_LEFT :: * This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to * remember that in PostScript, everything that is to the left of * the drawing direction of a contour must be filled. * * FT_ORIENTATION_NONE :: * The orientation cannot be determined. That is, different parts of * the glyph have different orientation. * */ typedef enum FT_Orientation_ { FT_ORIENTATION_TRUETYPE = 0, FT_ORIENTATION_POSTSCRIPT = 1, FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE, FT_ORIENTATION_FILL_LEFT = FT_ORIENTATION_POSTSCRIPT, FT_ORIENTATION_NONE } FT_Orientation; /************************************************************************** * * @function: * FT_Outline_Get_Orientation * * @description: * This function analyzes a glyph outline and tries to compute its * fill orientation (see @FT_Orientation). This is done by integrating * the total area covered by the outline. The positive integral * corresponds to the clockwise orientation and @FT_ORIENTATION_POSTSCRIPT * is returned. The negative integral corresponds to the counter-clockwise * orientation and @FT_ORIENTATION_TRUETYPE is returned. * * Note that this will return @FT_ORIENTATION_TRUETYPE for empty * outlines. * * @input: * outline :: * A handle to the source outline. * * @return: * The orientation. * */ FT_EXPORT( FT_Orientation ) FT_Outline_Get_Orientation( FT_Outline* outline ); /* */ FT_END_HEADER #endif /* FTOUTLN_H_ */ /* END */ /* Local Variables: */ /* coding: utf-8 */ /* End: */ �����������������������������������������������������������������������������������������������������freetype2/freetype/ftautoh.h������������������������������������������������������������������������0000644�����������������00000046662�14763166026�0012150 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftautoh.h */ /* */ /* FreeType API for controlling the auto-hinter (specification only). */ /* */ /* Copyright 2012-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTAUTOH_H_ #define FTAUTOH_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /************************************************************************** * * @section: * auto_hinter * * @title: * The auto-hinter * * @abstract: * Controlling the auto-hinting module. * * @description: * While FreeType's auto-hinter doesn't expose API functions by itself, * it is possible to control its behaviour with @FT_Property_Set and * @FT_Property_Get. The following lists the available properties * together with the necessary macros and structures. * * Note that the auto-hinter's module name is `autofitter' for * historical reasons. * */ /************************************************************************** * * @property: * glyph-to-script-map * * @description: * *Experimental* *only* * * The auto-hinter provides various script modules to hint glyphs. * Examples of supported scripts are Latin or CJK. Before a glyph is * auto-hinted, the Unicode character map of the font gets examined, and * the script is then determined based on Unicode character ranges, see * below. * * OpenType fonts, however, often provide much more glyphs than * character codes (small caps, superscripts, ligatures, swashes, etc.), * to be controlled by so-called `features'. Handling OpenType features * can be quite complicated and thus needs a separate library on top of * FreeType. * * The mapping between glyph indices and scripts (in the auto-hinter * sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an * array with `num_glyphs' elements, as found in the font's @FT_Face * structure. The `glyph-to-script-map' property returns a pointer to * this array, which can be modified as needed. Note that the * modification should happen before the first glyph gets processed by * the auto-hinter so that the global analysis of the font shapes * actually uses the modified mapping. * * The following example code demonstrates how to access it (omitting * the error handling). * * { * FT_Library library; * FT_Face face; * FT_Prop_GlyphToScriptMap prop; * * * FT_Init_FreeType( &library ); * FT_New_Face( library, "foo.ttf", 0, &face ); * * prop.face = face; * * FT_Property_Get( library, "autofitter", * "glyph-to-script-map", &prop ); * * // adjust `prop.map' as needed right here * * FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT ); * } * */ /************************************************************************** * * @enum: * FT_AUTOHINTER_SCRIPT_XXX * * @description: * *Experimental* *only* * * A list of constants used for the @glyph-to-script-map property to * specify the script submodule the auto-hinter should use for hinting a * particular glyph. * * @values: * FT_AUTOHINTER_SCRIPT_NONE :: * Don't auto-hint this glyph. * * FT_AUTOHINTER_SCRIPT_LATIN :: * Apply the latin auto-hinter. For the auto-hinter, `latin' is a * very broad term, including Cyrillic and Greek also since characters * from those scripts share the same design constraints. * * By default, characters from the following Unicode ranges are * assigned to this submodule. * * { * U+0020 - U+007F // Basic Latin (no control characters) * U+00A0 - U+00FF // Latin-1 Supplement (no control characters) * U+0100 - U+017F // Latin Extended-A * U+0180 - U+024F // Latin Extended-B * U+0250 - U+02AF // IPA Extensions * U+02B0 - U+02FF // Spacing Modifier Letters * U+0300 - U+036F // Combining Diacritical Marks * U+0370 - U+03FF // Greek and Coptic * U+0400 - U+04FF // Cyrillic * U+0500 - U+052F // Cyrillic Supplement * U+1D00 - U+1D7F // Phonetic Extensions * U+1D80 - U+1DBF // Phonetic Extensions Supplement * U+1DC0 - U+1DFF // Combining Diacritical Marks Supplement * U+1E00 - U+1EFF // Latin Extended Additional * U+1F00 - U+1FFF // Greek Extended * U+2000 - U+206F // General Punctuation * U+2070 - U+209F // Superscripts and Subscripts * U+20A0 - U+20CF // Currency Symbols * U+2150 - U+218F // Number Forms * U+2460 - U+24FF // Enclosed Alphanumerics * U+2C60 - U+2C7F // Latin Extended-C * U+2DE0 - U+2DFF // Cyrillic Extended-A * U+2E00 - U+2E7F // Supplemental Punctuation * U+A640 - U+A69F // Cyrillic Extended-B * U+A720 - U+A7FF // Latin Extended-D * U+FB00 - U+FB06 // Alphab. Present. Forms (Latin Ligatures) * U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols * U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement * } * * FT_AUTOHINTER_SCRIPT_CJK :: * Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old * Vietnamese, and some other scripts. * * By default, characters from the following Unicode ranges are * assigned to this submodule. * * { * U+1100 - U+11FF // Hangul Jamo * U+2E80 - U+2EFF // CJK Radicals Supplement * U+2F00 - U+2FDF // Kangxi Radicals * U+2FF0 - U+2FFF // Ideographic Description Characters * U+3000 - U+303F // CJK Symbols and Punctuation * U+3040 - U+309F // Hiragana * U+30A0 - U+30FF // Katakana * U+3100 - U+312F // Bopomofo * U+3130 - U+318F // Hangul Compatibility Jamo * U+3190 - U+319F // Kanbun * U+31A0 - U+31BF // Bopomofo Extended * U+31C0 - U+31EF // CJK Strokes * U+31F0 - U+31FF // Katakana Phonetic Extensions * U+3200 - U+32FF // Enclosed CJK Letters and Months * U+3300 - U+33FF // CJK Compatibility * U+3400 - U+4DBF // CJK Unified Ideographs Extension A * U+4DC0 - U+4DFF // Yijing Hexagram Symbols * U+4E00 - U+9FFF // CJK Unified Ideographs * U+A960 - U+A97F // Hangul Jamo Extended-A * U+AC00 - U+D7AF // Hangul Syllables * U+D7B0 - U+D7FF // Hangul Jamo Extended-B * U+F900 - U+FAFF // CJK Compatibility Ideographs * U+FE10 - U+FE1F // Vertical forms * U+FE30 - U+FE4F // CJK Compatibility Forms * U+FF00 - U+FFEF // Halfwidth and Fullwidth Forms * U+1B000 - U+1B0FF // Kana Supplement * U+1D300 - U+1D35F // Tai Xuan Hing Symbols * U+1F200 - U+1F2FF // Enclosed Ideographic Supplement * U+20000 - U+2A6DF // CJK Unified Ideographs Extension B * U+2A700 - U+2B73F // CJK Unified Ideographs Extension C * U+2B740 - U+2B81F // CJK Unified Ideographs Extension D * U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement * } * * FT_AUTOHINTER_SCRIPT_INDIC :: * Apply the indic auto-hinter, covering all major scripts from the * Indian sub-continent and some other related scripts like Thai, Lao, * or Tibetan. * * By default, characters from the following Unicode ranges are * assigned to this submodule. * * { * U+0900 - U+0DFF // Indic Range * U+0F00 - U+0FFF // Tibetan * U+1900 - U+194F // Limbu * U+1B80 - U+1BBF // Sundanese * U+A800 - U+A82F // Syloti Nagri * U+ABC0 - U+ABFF // Meetei Mayek * U+11800 - U+118DF // Sharada * } * * Note that currently Indic support is rudimentary only, missing blue * zone support. * */ #define FT_AUTOHINTER_SCRIPT_NONE 0 #define FT_AUTOHINTER_SCRIPT_LATIN 1 #define FT_AUTOHINTER_SCRIPT_CJK 2 #define FT_AUTOHINTER_SCRIPT_INDIC 3 /************************************************************************** * * @struct: * FT_Prop_GlyphToScriptMap * * @description: * *Experimental* *only* * * The data exchange structure for the @glyph-to-script-map property. * */ typedef struct FT_Prop_GlyphToScriptMap_ { FT_Face face; FT_UShort* map; } FT_Prop_GlyphToScriptMap; /************************************************************************** * * @property: * fallback-script * * @description: * *Experimental* *only* * * If no auto-hinter script module can be assigned to a glyph, a * fallback script gets assigned to it (see also the * @glyph-to-script-map property). By default, this is * @FT_AUTOHINTER_SCRIPT_CJK. Using the `fallback-script' property, * this fallback value can be changed. * * { * FT_Library library; * FT_UInt fallback_script = FT_AUTOHINTER_SCRIPT_NONE; * * * FT_Init_FreeType( &library ); * * FT_Property_Set( library, "autofitter", * "fallback-script", &fallback_script ); * } * * @note: * This property can be used with @FT_Property_Get also. * * It's important to use the right timing for changing this value: The * creation of the glyph-to-script map that eventually uses the * fallback script value gets triggered either by setting or reading a * face-specific property like @glyph-to-script-map, or by auto-hinting * any glyph from that face. In particular, if you have already created * an @FT_Face structure but not loaded any glyph (using the * auto-hinter), a change of the fallback script will affect this face. * */ /************************************************************************** * * @property: * default-script * * @description: * *Experimental* *only* * * If FreeType gets compiled with FT_CONFIG_OPTION_USE_HARFBUZZ to make * the HarfBuzz library access OpenType features for getting better * glyph coverages, this property sets the (auto-fitter) script to be * used for the default (OpenType) script data of a font's GSUB table. * Features for the default script are intended for all scripts not * explicitly handled in GSUB; an example is a `dlig' feature, * containing the combination of the characters `T', `E', and `L' to * form a `TEL' ligature. * * By default, this is @FT_AUTOHINTER_SCRIPT_LATIN. Using the * `default-script' property, this default value can be changed. * * { * FT_Library library; * FT_UInt default_script = FT_AUTOHINTER_SCRIPT_NONE; * * * FT_Init_FreeType( &library ); * * FT_Property_Set( library, "autofitter", * "default-script", &default_script ); * } * * @note: * This property can be used with @FT_Property_Get also. * * It's important to use the right timing for changing this value: The * creation of the glyph-to-script map that eventually uses the * default script value gets triggered either by setting or reading a * face-specific property like @glyph-to-script-map, or by auto-hinting * any glyph from that face. In particular, if you have already created * an @FT_Face structure but not loaded any glyph (using the * auto-hinter), a change of the default script will affect this face. * */ /************************************************************************** * * @property: * increase-x-height * * @description: * For ppem values in the range 6~<= ppem <= `increase-x-height', round * up the font's x~height much more often than normally. If the value * is set to~0, which is the default, this feature is switched off. Use * this property to improve the legibility of small font sizes if * necessary. * * { * FT_Library library; * FT_Face face; * FT_Prop_IncreaseXHeight prop; * * * FT_Init_FreeType( &library ); * FT_New_Face( library, "foo.ttf", 0, &face ); * FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 ); * * prop.face = face; * prop.limit = 14; * * FT_Property_Set( library, "autofitter", * "increase-x-height", &prop ); * } * * @note: * This property can be used with @FT_Property_Get also. * * Set this value right after calling @FT_Set_Char_Size, but before * loading any glyph (using the auto-hinter). * */ /************************************************************************** * * @struct: * FT_Prop_IncreaseXHeight * * @description: * The data exchange structure for the @increase-x-height property. * */ typedef struct FT_Prop_IncreaseXHeight_ { FT_Face face; FT_UInt limit; } FT_Prop_IncreaseXHeight; /************************************************************************** * * @property: * warping * * @description: * *Experimental* *only* * * If FreeType gets compiled with option AF_CONFIG_OPTION_USE_WARPER to * activate the warp hinting code in the auto-hinter, this property * switches warping on and off. * * Warping only works in `light' auto-hinting mode. The idea of the * code is to slightly scale and shift a glyph along the non-hinted * dimension (which is usually the horizontal axis) so that as much of * its segments are aligned (more or less) to the grid. To find out a * glyph's optimal scaling and shifting value, various parameter * combinations are tried and scored. * * By default, warping is off. The example below shows how to switch on * warping (omitting the error handling). * * { * FT_Library library; * FT_Bool warping = 1; * * * FT_Init_FreeType( &library ); * * FT_Property_Set( library, "autofitter", * "warping", &warping ); * } * * @note: * This property can be used with @FT_Property_Get also. * * This property can be set via the `FREETYPE_PROPERTIES' environment * variable (using values 1 and 0 for `on' and `off', respectively). * * The warping code can also change advance widths. Have a look at the * `lsb_delta' and `rsb_delta' fields in the @FT_GlyphSlotRec structure * for details on improving inter-glyph distances while rendering. * * Since warping is a global property of the auto-hinter it is best to * change its value before rendering any face. Otherwise, you should * reload all faces that get auto-hinted in `light' hinting mode. * */ /************************************************************************** * * @property: * no-stem-darkening[autofit] * * @description: * *Experimental* *only*, *requires* *linear* *alpha* *blending* *and* * *gamma* *correction* * * Stem darkening emboldens glyphs at smaller sizes to make them more * readable on common low-DPI screens when using linear alpha blending * and gamma correction, see @FT_Render_Glyph. When not using linear * alpha blending and gamma correction, glyphs will appear heavy and * fuzzy! * * Gamma correction essentially lightens fonts since shades of grey are * shifted to higher pixel values (=~higher brightness) to match the * original intention to the reality of our screens. The side-effect is * that glyphs `thin out'. Mac OS~X and Adobe's proprietary font * rendering library implement a counter-measure: stem darkening at * smaller sizes where shades of gray dominate. By emboldening a glyph * slightly in relation to its pixel size, individual pixels get higher * coverage of filled-in outlines and are therefore `blacker'. This * counteracts the `thinning out' of glyphs, making text remain readable * at smaller sizes. All glyphs that pass through the auto-hinter will * be emboldened unless this property is set to TRUE. * * See the description of the CFF driver for algorithmic details. Total * consistency with the CFF driver is currently not achieved because the * emboldening method differs and glyphs must be scaled down on the * Y-axis to keep outline points inside their precomputed blue zones. * The smaller the size (especially 9ppem and down), the higher the loss * of emboldening versus the CFF driver. * * This property can be set via the `FREETYPE_PROPERTIES' environment * variable similar to the CFF driver. It can also be set per face * using @FT_Face_Properties with @FT_PARAM_TAG_STEM_DARKENING. * */ /************************************************************************** * * @constant: * FT_PARAM_TAG_STEM_DARKENING * * @description: * An @FT_Parameter tag to be used with @FT_Face_Properties. The * corresponding Boolean argument specifies whether to apply stem * darkening, overriding the global default values or the values set up * with @FT_Property_Set (see @no-stem-darkening[autofit] and * @no-stem-darkening[cff]). * * This is a passive setting that only takes effect if the font driver * or autohinter honors it, which the CFF driver always does, but the * autohinter only in `light' hinting mode (as of version 2.7.0). * */ #define FT_PARAM_TAG_STEM_DARKENING \ FT_MAKE_TAG( 'd', 'a', 'r', 'k' ) /************************************************************************** * * @property: * darkening-parameters[autofit] * * @description: * *Experimental* *only* * * See the description of the CFF driver for details. This * implementation appropriates the * CFF_CONFIG_OPTION_DARKENING_PARAMETER_* #defines for consistency. * Note the differences described in @no-stem-darkening[autofit]. * * This property can be set via the `FREETYPE_PROPERTIES' environment * variable similar to the CFF driver. */ /* */ FT_END_HEADER #endif /* FTAUTOH_H_ */ /* END */ ������������������������������������������������������������������������������freetype2/freetype/ftotval.h������������������������������������������������������������������������0000644�����������������00000016645�14763166026�0012153 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftotval.h */ /* */ /* FreeType API for validating OpenType tables (specification). */ /* */ /* Copyright 2004-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ /***************************************************************************/ /* */ /* */ /* Warning: This module might be moved to a different library in the */ /* future to avoid a tight dependency between FreeType and the */ /* OpenType specification. */ /* */ /* */ /***************************************************************************/ #ifndef FTOTVAL_H_ #define FTOTVAL_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* ot_validation */ /* */ /* <Title> */ /* OpenType Validation */ /* */ /* <Abstract> */ /* An API to validate OpenType tables. */ /* */ /* <Description> */ /* This section contains the declaration of functions to validate */ /* some OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH). */ /* */ /* <Order> */ /* FT_OpenType_Validate */ /* FT_OpenType_Free */ /* */ /* FT_VALIDATE_OTXXX */ /* */ /*************************************************************************/ /********************************************************************** * * @enum: * FT_VALIDATE_OTXXX * * @description: * A list of bit-field constants used with @FT_OpenType_Validate to * indicate which OpenType tables should be validated. * * @values: * FT_VALIDATE_BASE :: * Validate BASE table. * * FT_VALIDATE_GDEF :: * Validate GDEF table. * * FT_VALIDATE_GPOS :: * Validate GPOS table. * * FT_VALIDATE_GSUB :: * Validate GSUB table. * * FT_VALIDATE_JSTF :: * Validate JSTF table. * * FT_VALIDATE_MATH :: * Validate MATH table. * * FT_VALIDATE_OT :: * Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH). * */ #define FT_VALIDATE_BASE 0x0100 #define FT_VALIDATE_GDEF 0x0200 #define FT_VALIDATE_GPOS 0x0400 #define FT_VALIDATE_GSUB 0x0800 #define FT_VALIDATE_JSTF 0x1000 #define FT_VALIDATE_MATH 0x2000 #define FT_VALIDATE_OT ( FT_VALIDATE_BASE | \ FT_VALIDATE_GDEF | \ FT_VALIDATE_GPOS | \ FT_VALIDATE_GSUB | \ FT_VALIDATE_JSTF | \ FT_VALIDATE_MATH ) /********************************************************************** * * @function: * FT_OpenType_Validate * * @description: * Validate various OpenType tables to assure that all offsets and * indices are valid. The idea is that a higher-level library that * actually does the text layout can access those tables without * error checking (which can be quite time consuming). * * @input: * face :: * A handle to the input face. * * validation_flags :: * A bit field that specifies the tables to be validated. See * @FT_VALIDATE_OTXXX for possible values. * * @output: * BASE_table :: * A pointer to the BASE table. * * GDEF_table :: * A pointer to the GDEF table. * * GPOS_table :: * A pointer to the GPOS table. * * GSUB_table :: * A pointer to the GSUB table. * * JSTF_table :: * A pointer to the JSTF table. * * @return: * FreeType error code. 0~means success. * * @note: * This function only works with OpenType fonts, returning an error * otherwise. * * After use, the application should deallocate the five tables with * @FT_OpenType_Free. A NULL value indicates that the table either * doesn't exist in the font, or the application hasn't asked for * validation. */ FT_EXPORT( FT_Error ) FT_OpenType_Validate( FT_Face face, FT_UInt validation_flags, FT_Bytes *BASE_table, FT_Bytes *GDEF_table, FT_Bytes *GPOS_table, FT_Bytes *GSUB_table, FT_Bytes *JSTF_table ); /********************************************************************** * * @function: * FT_OpenType_Free * * @description: * Free the buffer allocated by OpenType validator. * * @input: * face :: * A handle to the input face. * * table :: * The pointer to the buffer that is allocated by * @FT_OpenType_Validate. * * @note: * This function must be used to free the buffer allocated by * @FT_OpenType_Validate only. */ FT_EXPORT( void ) FT_OpenType_Free( FT_Face face, FT_Bytes table ); /* */ FT_END_HEADER #endif /* FTOTVAL_H_ */ /* END */ �������������������������������������������������������������������������������������������freetype2/freetype/ftpfr.h��������������������������������������������������������������������������0000644�����������������00000014211�14763166026�0011600 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftpfr.h */ /* */ /* FreeType API for accessing PFR-specific data (specification only). */ /* */ /* Copyright 2002-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTPFR_H_ #define FTPFR_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* pfr_fonts */ /* */ /* <Title> */ /* PFR Fonts */ /* */ /* <Abstract> */ /* PFR/TrueDoc specific API. */ /* */ /* <Description> */ /* This section contains the declaration of PFR-specific functions. */ /* */ /*************************************************************************/ /********************************************************************** * * @function: * FT_Get_PFR_Metrics * * @description: * Return the outline and metrics resolutions of a given PFR face. * * @input: * face :: Handle to the input face. It can be a non-PFR face. * * @output: * aoutline_resolution :: * Outline resolution. This is equivalent to `face->units_per_EM' * for non-PFR fonts. Optional (parameter can be NULL). * * ametrics_resolution :: * Metrics resolution. This is equivalent to `outline_resolution' * for non-PFR fonts. Optional (parameter can be NULL). * * ametrics_x_scale :: * A 16.16 fixed-point number used to scale distance expressed * in metrics units to device sub-pixels. This is equivalent to * `face->size->x_scale', but for metrics only. Optional (parameter * can be NULL). * * ametrics_y_scale :: * Same as `ametrics_x_scale' but for the vertical direction. * optional (parameter can be NULL). * * @return: * FreeType error code. 0~means success. * * @note: * If the input face is not a PFR, this function will return an error. * However, in all cases, it will return valid values. */ FT_EXPORT( FT_Error ) FT_Get_PFR_Metrics( FT_Face face, FT_UInt *aoutline_resolution, FT_UInt *ametrics_resolution, FT_Fixed *ametrics_x_scale, FT_Fixed *ametrics_y_scale ); /********************************************************************** * * @function: * FT_Get_PFR_Kerning * * @description: * Return the kerning pair corresponding to two glyphs in a PFR face. * The distance is expressed in metrics units, unlike the result of * @FT_Get_Kerning. * * @input: * face :: A handle to the input face. * * left :: Index of the left glyph. * * right :: Index of the right glyph. * * @output: * avector :: A kerning vector. * * @return: * FreeType error code. 0~means success. * * @note: * This function always return distances in original PFR metrics * units. This is unlike @FT_Get_Kerning with the @FT_KERNING_UNSCALED * mode, which always returns distances converted to outline units. * * You can use the value of the `x_scale' and `y_scale' parameters * returned by @FT_Get_PFR_Metrics to scale these to device sub-pixels. */ FT_EXPORT( FT_Error ) FT_Get_PFR_Kerning( FT_Face face, FT_UInt left, FT_UInt right, FT_Vector *avector ); /********************************************************************** * * @function: * FT_Get_PFR_Advance * * @description: * Return a given glyph advance, expressed in original metrics units, * from a PFR font. * * @input: * face :: A handle to the input face. * * gindex :: The glyph index. * * @output: * aadvance :: The glyph advance in metrics units. * * @return: * FreeType error code. 0~means success. * * @note: * You can use the `x_scale' or `y_scale' results of @FT_Get_PFR_Metrics * to convert the advance to device sub-pixels (i.e., 1/64th of pixels). */ FT_EXPORT( FT_Error ) FT_Get_PFR_Advance( FT_Face face, FT_UInt gindex, FT_Pos *aadvance ); /* */ FT_END_HEADER #endif /* FTPFR_H_ */ /* END */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftgzip.h�������������������������������������������������������������������������0000644�����������������00000012767�14763166026�0012000 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftgzip.h */ /* */ /* Gzip-compressed stream support. */ /* */ /* Copyright 2002-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTGZIP_H_ #define FTGZIP_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* gzip */ /* */ /* <Title> */ /* GZIP Streams */ /* */ /* <Abstract> */ /* Using gzip-compressed font files. */ /* */ /* <Description> */ /* This section contains the declaration of Gzip-specific functions. */ /* */ /*************************************************************************/ /************************************************************************ * * @function: * FT_Stream_OpenGzip * * @description: * Open a new stream to parse gzip-compressed font files. This is * mainly used to support the compressed `*.pcf.gz' fonts that come * with XFree86. * * @input: * stream :: * The target embedding stream. * * source :: * The source stream. * * @return: * FreeType error code. 0~means success. * * @note: * The source stream must be opened _before_ calling this function. * * Calling the internal function `FT_Stream_Close' on the new stream will * *not* call `FT_Stream_Close' on the source stream. None of the stream * objects will be released to the heap. * * The stream implementation is very basic and resets the decompression * process each time seeking backwards is needed within the stream. * * In certain builds of the library, gzip compression recognition is * automatically handled when calling @FT_New_Face or @FT_Open_Face. * This means that if no font driver is capable of handling the raw * compressed file, the library will try to open a gzipped stream from * it and re-open the face with it. * * This function may return `FT_Err_Unimplemented_Feature' if your build * of FreeType was not compiled with zlib support. */ FT_EXPORT( FT_Error ) FT_Stream_OpenGzip( FT_Stream stream, FT_Stream source ); /************************************************************************ * * @function: * FT_Gzip_Uncompress * * @description: * Decompress a zipped input buffer into an output buffer. This function * is modeled after zlib's `uncompress' function. * * @input: * memory :: * A FreeType memory handle. * * input :: * The input buffer. * * input_len :: * The length of the input buffer. * * @output: * output:: * The output buffer. * * @inout: * output_len :: * Before calling the function, this is the total size of the output * buffer, which must be large enough to hold the entire uncompressed * data (so the size of the uncompressed data must be known in * advance). After calling the function, `output_len' is the size of * the used data in `output'. * * @return: * FreeType error code. 0~means success. * * @note: * This function may return `FT_Err_Unimplemented_Feature' if your build * of FreeType was not compiled with zlib support. */ FT_EXPORT( FT_Error ) FT_Gzip_Uncompress( FT_Memory memory, FT_Byte* output, FT_ULong* output_len, const FT_Byte* input, FT_ULong input_len ); /* */ FT_END_HEADER #endif /* FTGZIP_H_ */ /* END */ ���������freetype2/freetype/ftmac.h��������������������������������������������������������������������������0000644�����������������00000041301�14763166026�0011551 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftmac.h */ /* */ /* Additional Mac-specific API. */ /* */ /* Copyright 1996-2017 by */ /* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ /***************************************************************************/ /* */ /* NOTE: Include this file after FT_FREETYPE_H and after any */ /* Mac-specific headers (because this header uses Mac types such as */ /* Handle, FSSpec, FSRef, etc.) */ /* */ /***************************************************************************/ #ifndef FTMAC_H_ #define FTMAC_H_ #include <ft2build.h> FT_BEGIN_HEADER /* gcc-3.4.1 and later can warn about functions tagged as deprecated */ #ifndef FT_DEPRECATED_ATTRIBUTE #if defined(__GNUC__) && \ ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) #define FT_DEPRECATED_ATTRIBUTE __attribute__((deprecated)) #else #define FT_DEPRECATED_ATTRIBUTE #endif #endif /*************************************************************************/ /* */ /* <Section> */ /* mac_specific */ /* */ /* <Title> */ /* Mac Specific Interface */ /* */ /* <Abstract> */ /* Only available on the Macintosh. */ /* */ /* <Description> */ /* The following definitions are only available if FreeType is */ /* compiled on a Macintosh. */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Function> */ /* FT_New_Face_From_FOND */ /* */ /* <Description> */ /* Create a new face object from a FOND resource. */ /* */ /* <InOut> */ /* library :: A handle to the library resource. */ /* */ /* <Input> */ /* fond :: A FOND resource. */ /* */ /* face_index :: Only supported for the -1 `sanity check' special */ /* case. */ /* */ /* <Output> */ /* aface :: A handle to a new face object. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Notes> */ /* This function can be used to create @FT_Face objects from fonts */ /* that are installed in the system as follows. */ /* */ /* { */ /* fond = GetResource( 'FOND', fontName ); */ /* error = FT_New_Face_From_FOND( library, fond, 0, &face ); */ /* } */ /* */ FT_EXPORT( FT_Error ) FT_New_Face_From_FOND( FT_Library library, Handle fond, FT_Long face_index, FT_Face *aface ) FT_DEPRECATED_ATTRIBUTE; /*************************************************************************/ /* */ /* <Function> */ /* FT_GetFile_From_Mac_Name */ /* */ /* <Description> */ /* Return an FSSpec for the disk file containing the named font. */ /* */ /* <Input> */ /* fontName :: Mac OS name of the font (e.g., Times New Roman */ /* Bold). */ /* */ /* <Output> */ /* pathSpec :: FSSpec to the file. For passing to */ /* @FT_New_Face_From_FSSpec. */ /* */ /* face_index :: Index of the face. For passing to */ /* @FT_New_Face_From_FSSpec. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_GetFile_From_Mac_Name( const char* fontName, FSSpec* pathSpec, FT_Long* face_index ) FT_DEPRECATED_ATTRIBUTE; /*************************************************************************/ /* */ /* <Function> */ /* FT_GetFile_From_Mac_ATS_Name */ /* */ /* <Description> */ /* Return an FSSpec for the disk file containing the named font. */ /* */ /* <Input> */ /* fontName :: Mac OS name of the font in ATS framework. */ /* */ /* <Output> */ /* pathSpec :: FSSpec to the file. For passing to */ /* @FT_New_Face_From_FSSpec. */ /* */ /* face_index :: Index of the face. For passing to */ /* @FT_New_Face_From_FSSpec. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_GetFile_From_Mac_ATS_Name( const char* fontName, FSSpec* pathSpec, FT_Long* face_index ) FT_DEPRECATED_ATTRIBUTE; /*************************************************************************/ /* */ /* <Function> */ /* FT_GetFilePath_From_Mac_ATS_Name */ /* */ /* <Description> */ /* Return a pathname of the disk file and face index for given font */ /* name that is handled by ATS framework. */ /* */ /* <Input> */ /* fontName :: Mac OS name of the font in ATS framework. */ /* */ /* <Output> */ /* path :: Buffer to store pathname of the file. For passing */ /* to @FT_New_Face. The client must allocate this */ /* buffer before calling this function. */ /* */ /* maxPathSize :: Lengths of the buffer `path' that client allocated. */ /* */ /* face_index :: Index of the face. For passing to @FT_New_Face. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ FT_EXPORT( FT_Error ) FT_GetFilePath_From_Mac_ATS_Name( const char* fontName, UInt8* path, UInt32 maxPathSize, FT_Long* face_index ) FT_DEPRECATED_ATTRIBUTE; /*************************************************************************/ /* */ /* <Function> */ /* FT_New_Face_From_FSSpec */ /* */ /* <Description> */ /* Create a new face object from a given resource and typeface index */ /* using an FSSpec to the font file. */ /* */ /* <InOut> */ /* library :: A handle to the library resource. */ /* */ /* <Input> */ /* spec :: FSSpec to the font file. */ /* */ /* face_index :: The index of the face within the resource. The */ /* first face has index~0. */ /* <Output> */ /* aface :: A handle to a new face object. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* @FT_New_Face_From_FSSpec is identical to @FT_New_Face except */ /* it accepts an FSSpec instead of a path. */ /* */ FT_EXPORT( FT_Error ) FT_New_Face_From_FSSpec( FT_Library library, const FSSpec *spec, FT_Long face_index, FT_Face *aface ) FT_DEPRECATED_ATTRIBUTE; /*************************************************************************/ /* */ /* <Function> */ /* FT_New_Face_From_FSRef */ /* */ /* <Description> */ /* Create a new face object from a given resource and typeface index */ /* using an FSRef to the font file. */ /* */ /* <InOut> */ /* library :: A handle to the library resource. */ /* */ /* <Input> */ /* spec :: FSRef to the font file. */ /* */ /* face_index :: The index of the face within the resource. The */ /* first face has index~0. */ /* <Output> */ /* aface :: A handle to a new face object. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* @FT_New_Face_From_FSRef is identical to @FT_New_Face except */ /* it accepts an FSRef instead of a path. */ /* */ FT_EXPORT( FT_Error ) FT_New_Face_From_FSRef( FT_Library library, const FSRef *ref, FT_Long face_index, FT_Face *aface ) FT_DEPRECATED_ATTRIBUTE; /* */ FT_END_HEADER #endif /* FTMAC_H_ */ /* END */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/fterrdef.h�����������������������������������������������������������������������0000644�����������������00000034150�14763166026�0012264 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* fterrdef.h */ /* */ /* FreeType error codes (specification). */ /* */ /* Copyright 2002-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ /*************************************************************************/ /* */ /* <Section> */ /* error_code_values */ /* */ /* <Title> */ /* Error Code Values */ /* */ /* <Abstract> */ /* All possible error codes returned by FreeType functions. */ /* */ /* <Description> */ /* The list below is taken verbatim from the file `fterrdef.h' */ /* (loaded automatically by including `FT_FREETYPE_H'). The first */ /* argument of the `FT_ERROR_DEF_' macro is the error label; by */ /* default, the prefix `FT_Err_' gets added so that you get error */ /* names like `FT_Err_Cannot_Open_Resource'. The second argument is */ /* the error code, and the last argument an error string, which is not */ /* used by FreeType. */ /* */ /* Within your application you should *only* use error names and */ /* *never* its numeric values! The latter might (and actually do) */ /* change in forthcoming FreeType versions. */ /* */ /* Macro `FT_NOERRORDEF_' defines `FT_Err_Ok', which is always zero. */ /* See the `Error Enumerations' subsection how to automatically */ /* generate a list of error strings. */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Enum> */ /* FT_Err_XXX */ /* */ /*************************************************************************/ /* generic errors */ FT_NOERRORDEF_( Ok, 0x00, "no error" ) FT_ERRORDEF_( Cannot_Open_Resource, 0x01, "cannot open resource" ) FT_ERRORDEF_( Unknown_File_Format, 0x02, "unknown file format" ) FT_ERRORDEF_( Invalid_File_Format, 0x03, "broken file" ) FT_ERRORDEF_( Invalid_Version, 0x04, "invalid FreeType version" ) FT_ERRORDEF_( Lower_Module_Version, 0x05, "module version is too low" ) FT_ERRORDEF_( Invalid_Argument, 0x06, "invalid argument" ) FT_ERRORDEF_( Unimplemented_Feature, 0x07, "unimplemented feature" ) FT_ERRORDEF_( Invalid_Table, 0x08, "broken table" ) FT_ERRORDEF_( Invalid_Offset, 0x09, "broken offset within table" ) FT_ERRORDEF_( Array_Too_Large, 0x0A, "array allocation size too large" ) FT_ERRORDEF_( Missing_Module, 0x0B, "missing module" ) FT_ERRORDEF_( Missing_Property, 0x0C, "missing property" ) /* glyph/character errors */ FT_ERRORDEF_( Invalid_Glyph_Index, 0x10, "invalid glyph index" ) FT_ERRORDEF_( Invalid_Character_Code, 0x11, "invalid character code" ) FT_ERRORDEF_( Invalid_Glyph_Format, 0x12, "unsupported glyph image format" ) FT_ERRORDEF_( Cannot_Render_Glyph, 0x13, "cannot render this glyph format" ) FT_ERRORDEF_( Invalid_Outline, 0x14, "invalid outline" ) FT_ERRORDEF_( Invalid_Composite, 0x15, "invalid composite glyph" ) FT_ERRORDEF_( Too_Many_Hints, 0x16, "too many hints" ) FT_ERRORDEF_( Invalid_Pixel_Size, 0x17, "invalid pixel size" ) /* handle errors */ FT_ERRORDEF_( Invalid_Handle, 0x20, "invalid object handle" ) FT_ERRORDEF_( Invalid_Library_Handle, 0x21, "invalid library handle" ) FT_ERRORDEF_( Invalid_Driver_Handle, 0x22, "invalid module handle" ) FT_ERRORDEF_( Invalid_Face_Handle, 0x23, "invalid face handle" ) FT_ERRORDEF_( Invalid_Size_Handle, 0x24, "invalid size handle" ) FT_ERRORDEF_( Invalid_Slot_Handle, 0x25, "invalid glyph slot handle" ) FT_ERRORDEF_( Invalid_CharMap_Handle, 0x26, "invalid charmap handle" ) FT_ERRORDEF_( Invalid_Cache_Handle, 0x27, "invalid cache manager handle" ) FT_ERRORDEF_( Invalid_Stream_Handle, 0x28, "invalid stream handle" ) /* driver errors */ FT_ERRORDEF_( Too_Many_Drivers, 0x30, "too many modules" ) FT_ERRORDEF_( Too_Many_Extensions, 0x31, "too many extensions" ) /* memory errors */ FT_ERRORDEF_( Out_Of_Memory, 0x40, "out of memory" ) FT_ERRORDEF_( Unlisted_Object, 0x41, "unlisted object" ) /* stream errors */ FT_ERRORDEF_( Cannot_Open_Stream, 0x51, "cannot open stream" ) FT_ERRORDEF_( Invalid_Stream_Seek, 0x52, "invalid stream seek" ) FT_ERRORDEF_( Invalid_Stream_Skip, 0x53, "invalid stream skip" ) FT_ERRORDEF_( Invalid_Stream_Read, 0x54, "invalid stream read" ) FT_ERRORDEF_( Invalid_Stream_Operation, 0x55, "invalid stream operation" ) FT_ERRORDEF_( Invalid_Frame_Operation, 0x56, "invalid frame operation" ) FT_ERRORDEF_( Nested_Frame_Access, 0x57, "nested frame access" ) FT_ERRORDEF_( Invalid_Frame_Read, 0x58, "invalid frame read" ) /* raster errors */ FT_ERRORDEF_( Raster_Uninitialized, 0x60, "raster uninitialized" ) FT_ERRORDEF_( Raster_Corrupted, 0x61, "raster corrupted" ) FT_ERRORDEF_( Raster_Overflow, 0x62, "raster overflow" ) FT_ERRORDEF_( Raster_Negative_Height, 0x63, "negative height while rastering" ) /* cache errors */ FT_ERRORDEF_( Too_Many_Caches, 0x70, "too many registered caches" ) /* TrueType and SFNT errors */ FT_ERRORDEF_( Invalid_Opcode, 0x80, "invalid opcode" ) FT_ERRORDEF_( Too_Few_Arguments, 0x81, "too few arguments" ) FT_ERRORDEF_( Stack_Overflow, 0x82, "stack overflow" ) FT_ERRORDEF_( Code_Overflow, 0x83, "code overflow" ) FT_ERRORDEF_( Bad_Argument, 0x84, "bad argument" ) FT_ERRORDEF_( Divide_By_Zero, 0x85, "division by zero" ) FT_ERRORDEF_( Invalid_Reference, 0x86, "invalid reference" ) FT_ERRORDEF_( Debug_OpCode, 0x87, "found debug opcode" ) FT_ERRORDEF_( ENDF_In_Exec_Stream, 0x88, "found ENDF opcode in execution stream" ) FT_ERRORDEF_( Nested_DEFS, 0x89, "nested DEFS" ) FT_ERRORDEF_( Invalid_CodeRange, 0x8A, "invalid code range" ) FT_ERRORDEF_( Execution_Too_Long, 0x8B, "execution context too long" ) FT_ERRORDEF_( Too_Many_Function_Defs, 0x8C, "too many function definitions" ) FT_ERRORDEF_( Too_Many_Instruction_Defs, 0x8D, "too many instruction definitions" ) FT_ERRORDEF_( Table_Missing, 0x8E, "SFNT font table missing" ) FT_ERRORDEF_( Horiz_Header_Missing, 0x8F, "horizontal header (hhea) table missing" ) FT_ERRORDEF_( Locations_Missing, 0x90, "locations (loca) table missing" ) FT_ERRORDEF_( Name_Table_Missing, 0x91, "name table missing" ) FT_ERRORDEF_( CMap_Table_Missing, 0x92, "character map (cmap) table missing" ) FT_ERRORDEF_( Hmtx_Table_Missing, 0x93, "horizontal metrics (hmtx) table missing" ) FT_ERRORDEF_( Post_Table_Missing, 0x94, "PostScript (post) table missing" ) FT_ERRORDEF_( Invalid_Horiz_Metrics, 0x95, "invalid horizontal metrics" ) FT_ERRORDEF_( Invalid_CharMap_Format, 0x96, "invalid character map (cmap) format" ) FT_ERRORDEF_( Invalid_PPem, 0x97, "invalid ppem value" ) FT_ERRORDEF_( Invalid_Vert_Metrics, 0x98, "invalid vertical metrics" ) FT_ERRORDEF_( Could_Not_Find_Context, 0x99, "could not find context" ) FT_ERRORDEF_( Invalid_Post_Table_Format, 0x9A, "invalid PostScript (post) table format" ) FT_ERRORDEF_( Invalid_Post_Table, 0x9B, "invalid PostScript (post) table" ) FT_ERRORDEF_( DEF_In_Glyf_Bytecode, 0x9C, "found FDEF or IDEF opcode in glyf bytecode" ) /* CFF, CID, and Type 1 errors */ FT_ERRORDEF_( Syntax_Error, 0xA0, "opcode syntax error" ) FT_ERRORDEF_( Stack_Underflow, 0xA1, "argument stack underflow" ) FT_ERRORDEF_( Ignore, 0xA2, "ignore" ) FT_ERRORDEF_( No_Unicode_Glyph_Name, 0xA3, "no Unicode glyph name found" ) FT_ERRORDEF_( Glyph_Too_Big, 0xA4, "glyph too big for hinting" ) /* BDF errors */ FT_ERRORDEF_( Missing_Startfont_Field, 0xB0, "`STARTFONT' field missing" ) FT_ERRORDEF_( Missing_Font_Field, 0xB1, "`FONT' field missing" ) FT_ERRORDEF_( Missing_Size_Field, 0xB2, "`SIZE' field missing" ) FT_ERRORDEF_( Missing_Fontboundingbox_Field, 0xB3, "`FONTBOUNDINGBOX' field missing" ) FT_ERRORDEF_( Missing_Chars_Field, 0xB4, "`CHARS' field missing" ) FT_ERRORDEF_( Missing_Startchar_Field, 0xB5, "`STARTCHAR' field missing" ) FT_ERRORDEF_( Missing_Encoding_Field, 0xB6, "`ENCODING' field missing" ) FT_ERRORDEF_( Missing_Bbx_Field, 0xB7, "`BBX' field missing" ) FT_ERRORDEF_( Bbx_Too_Big, 0xB8, "`BBX' too big" ) FT_ERRORDEF_( Corrupted_Font_Header, 0xB9, "Font header corrupted or missing fields" ) FT_ERRORDEF_( Corrupted_Font_Glyphs, 0xBA, "Font glyphs corrupted or missing fields" ) /* */ /* END */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftimage.h������������������������������������������������������������������������0000644�����������������00000223642�14763166026�0012105 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftimage.h */ /* */ /* FreeType glyph image formats and default raster interface */ /* (specification). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ /*************************************************************************/ /* */ /* Note: A `raster' is simply a scan-line converter, used to render */ /* FT_Outlines into FT_Bitmaps. */ /* */ /*************************************************************************/ #ifndef FTIMAGE_H_ #define FTIMAGE_H_ /* STANDALONE_ is from ftgrays.c */ #ifndef STANDALONE_ #include <ft2build.h> #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* basic_types */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Type> */ /* FT_Pos */ /* */ /* <Description> */ /* The type FT_Pos is used to store vectorial coordinates. Depending */ /* on the context, these can represent distances in integer font */ /* units, or 16.16, or 26.6 fixed-point pixel coordinates. */ /* */ typedef signed long FT_Pos; /*************************************************************************/ /* */ /* <Struct> */ /* FT_Vector */ /* */ /* <Description> */ /* A simple structure used to store a 2D vector; coordinates are of */ /* the FT_Pos type. */ /* */ /* <Fields> */ /* x :: The horizontal coordinate. */ /* y :: The vertical coordinate. */ /* */ typedef struct FT_Vector_ { FT_Pos x; FT_Pos y; } FT_Vector; /*************************************************************************/ /* */ /* <Struct> */ /* FT_BBox */ /* */ /* <Description> */ /* A structure used to hold an outline's bounding box, i.e., the */ /* coordinates of its extrema in the horizontal and vertical */ /* directions. */ /* */ /* <Fields> */ /* xMin :: The horizontal minimum (left-most). */ /* */ /* yMin :: The vertical minimum (bottom-most). */ /* */ /* xMax :: The horizontal maximum (right-most). */ /* */ /* yMax :: The vertical maximum (top-most). */ /* */ /* <Note> */ /* The bounding box is specified with the coordinates of the lower */ /* left and the upper right corner. In PostScript, those values are */ /* often called (llx,lly) and (urx,ury), respectively. */ /* */ /* If `yMin' is negative, this value gives the glyph's descender. */ /* Otherwise, the glyph doesn't descend below the baseline. */ /* Similarly, if `ymax' is positive, this value gives the glyph's */ /* ascender. */ /* */ /* `xMin' gives the horizontal distance from the glyph's origin to */ /* the left edge of the glyph's bounding box. If `xMin' is negative, */ /* the glyph extends to the left of the origin. */ /* */ typedef struct FT_BBox_ { FT_Pos xMin, yMin; FT_Pos xMax, yMax; } FT_BBox; /*************************************************************************/ /* */ /* <Enum> */ /* FT_Pixel_Mode */ /* */ /* <Description> */ /* An enumeration type used to describe the format of pixels in a */ /* given bitmap. Note that additional formats may be added in the */ /* future. */ /* */ /* <Values> */ /* FT_PIXEL_MODE_NONE :: */ /* Value~0 is reserved. */ /* */ /* FT_PIXEL_MODE_MONO :: */ /* A monochrome bitmap, using 1~bit per pixel. Note that pixels */ /* are stored in most-significant order (MSB), which means that */ /* the left-most pixel in a byte has value 128. */ /* */ /* FT_PIXEL_MODE_GRAY :: */ /* An 8-bit bitmap, generally used to represent anti-aliased glyph */ /* images. Each pixel is stored in one byte. Note that the number */ /* of `gray' levels is stored in the `num_grays' field of the */ /* @FT_Bitmap structure (it generally is 256). */ /* */ /* FT_PIXEL_MODE_GRAY2 :: */ /* A 2-bit per pixel bitmap, used to represent embedded */ /* anti-aliased bitmaps in font files according to the OpenType */ /* specification. We haven't found a single font using this */ /* format, however. */ /* */ /* FT_PIXEL_MODE_GRAY4 :: */ /* A 4-bit per pixel bitmap, representing embedded anti-aliased */ /* bitmaps in font files according to the OpenType specification. */ /* We haven't found a single font using this format, however. */ /* */ /* FT_PIXEL_MODE_LCD :: */ /* An 8-bit bitmap, representing RGB or BGR decimated glyph images */ /* used for display on LCD displays; the bitmap is three times */ /* wider than the original glyph image. See also */ /* @FT_RENDER_MODE_LCD. */ /* */ /* FT_PIXEL_MODE_LCD_V :: */ /* An 8-bit bitmap, representing RGB or BGR decimated glyph images */ /* used for display on rotated LCD displays; the bitmap is three */ /* times taller than the original glyph image. See also */ /* @FT_RENDER_MODE_LCD_V. */ /* */ /* FT_PIXEL_MODE_BGRA :: */ /* An image with four 8-bit channels per pixel, representing a */ /* color image (such as emoticons) with alpha channel. For each */ /* pixel, the format is BGRA, which means, the blue channel comes */ /* first in memory. The color channels are pre-multiplied and in */ /* the sRGB colorspace. For example, full red at half-translucent */ /* opacity will be represented as `00,00,80,80', not `00,00,FF,80'. */ /* See also @FT_LOAD_COLOR. */ /* */ typedef enum FT_Pixel_Mode_ { FT_PIXEL_MODE_NONE = 0, FT_PIXEL_MODE_MONO, FT_PIXEL_MODE_GRAY, FT_PIXEL_MODE_GRAY2, FT_PIXEL_MODE_GRAY4, FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V, FT_PIXEL_MODE_BGRA, FT_PIXEL_MODE_MAX /* do not remove */ } FT_Pixel_Mode; /* these constants are deprecated; use the corresponding `FT_Pixel_Mode' */ /* values instead. */ #define ft_pixel_mode_none FT_PIXEL_MODE_NONE #define ft_pixel_mode_mono FT_PIXEL_MODE_MONO #define ft_pixel_mode_grays FT_PIXEL_MODE_GRAY #define ft_pixel_mode_pal2 FT_PIXEL_MODE_GRAY2 #define ft_pixel_mode_pal4 FT_PIXEL_MODE_GRAY4 /*************************************************************************/ /* */ /* <Struct> */ /* FT_Bitmap */ /* */ /* <Description> */ /* A structure used to describe a bitmap or pixmap to the raster. */ /* Note that we now manage pixmaps of various depths through the */ /* `pixel_mode' field. */ /* */ /* <Fields> */ /* rows :: The number of bitmap rows. */ /* */ /* width :: The number of pixels in bitmap row. */ /* */ /* pitch :: The pitch's absolute value is the number of bytes */ /* taken by one bitmap row, including padding. */ /* However, the pitch is positive when the bitmap has */ /* a `down' flow, and negative when it has an `up' */ /* flow. In all cases, the pitch is an offset to add */ /* to a bitmap pointer in order to go down one row. */ /* */ /* Note that `padding' means the alignment of a */ /* bitmap to a byte border, and FreeType functions */ /* normally align to the smallest possible integer */ /* value. */ /* */ /* For the B/W rasterizer, `pitch' is always an even */ /* number. */ /* */ /* To change the pitch of a bitmap (say, to make it a */ /* multiple of 4), use @FT_Bitmap_Convert. */ /* Alternatively, you might use callback functions to */ /* directly render to the application's surface; see */ /* the file `example2.cpp' in the tutorial for a */ /* demonstration. */ /* */ /* buffer :: A typeless pointer to the bitmap buffer. This */ /* value should be aligned on 32-bit boundaries in */ /* most cases. */ /* */ /* num_grays :: This field is only used with */ /* @FT_PIXEL_MODE_GRAY; it gives the number of gray */ /* levels used in the bitmap. */ /* */ /* pixel_mode :: The pixel mode, i.e., how pixel bits are stored. */ /* See @FT_Pixel_Mode for possible values. */ /* */ /* palette_mode :: This field is intended for paletted pixel modes; */ /* it indicates how the palette is stored. Not */ /* used currently. */ /* */ /* palette :: A typeless pointer to the bitmap palette; this */ /* field is intended for paletted pixel modes. Not */ /* used currently. */ /* */ typedef struct FT_Bitmap_ { int rows; int width; int pitch; unsigned char* buffer; short num_grays; char pixel_mode; char palette_mode; void* palette; } FT_Bitmap; /*************************************************************************/ /* */ /* <Section> */ /* outline_processing */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Struct> */ /* FT_Outline */ /* */ /* <Description> */ /* This structure is used to describe an outline to the scan-line */ /* converter. */ /* */ /* <Fields> */ /* n_contours :: The number of contours in the outline. */ /* */ /* n_points :: The number of points in the outline. */ /* */ /* points :: A pointer to an array of `n_points' @FT_Vector */ /* elements, giving the outline's point coordinates. */ /* */ /* tags :: A pointer to an array of `n_points' chars, giving */ /* each outline point's type. */ /* */ /* If bit~0 is unset, the point is `off' the curve, */ /* i.e., a Bézier control point, while it is `on' if */ /* set. */ /* */ /* Bit~1 is meaningful for `off' points only. If set, */ /* it indicates a third-order Bézier arc control point; */ /* and a second-order control point if unset. */ /* */ /* If bit~2 is set, bits 5-7 contain the drop-out mode */ /* (as defined in the OpenType specification; the value */ /* is the same as the argument to the SCANMODE */ /* instruction). */ /* */ /* Bits 3 and~4 are reserved for internal purposes. */ /* */ /* contours :: An array of `n_contours' shorts, giving the end */ /* point of each contour within the outline. For */ /* example, the first contour is defined by the points */ /* `0' to `contours[0]', the second one is defined by */ /* the points `contours[0]+1' to `contours[1]', etc. */ /* */ /* flags :: A set of bit flags used to characterize the outline */ /* and give hints to the scan-converter and hinter on */ /* how to convert/grid-fit it. See @FT_OUTLINE_XXX. */ /* */ /* <Note> */ /* The B/W rasterizer only checks bit~2 in the `tags' array for the */ /* first point of each contour. The drop-out mode as given with */ /* @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and */ /* @FT_OUTLINE_INCLUDE_STUBS in `flags' is then overridden. */ /* */ typedef struct FT_Outline_ { short n_contours; /* number of contours in glyph */ short n_points; /* number of points in the glyph */ FT_Vector* points; /* the outline's points */ char* tags; /* the points flags */ short* contours; /* the contour end points */ int flags; /* outline masks */ } FT_Outline; /* */ /* Following limits must be consistent with */ /* FT_Outline.{n_contours,n_points} */ #define FT_OUTLINE_CONTOURS_MAX SHRT_MAX #define FT_OUTLINE_POINTS_MAX SHRT_MAX /*************************************************************************/ /* */ /* <Enum> */ /* FT_OUTLINE_XXX */ /* */ /* <Description> */ /* A list of bit-field constants use for the flags in an outline's */ /* `flags' field. */ /* */ /* <Values> */ /* FT_OUTLINE_NONE :: */ /* Value~0 is reserved. */ /* */ /* FT_OUTLINE_OWNER :: */ /* If set, this flag indicates that the outline's field arrays */ /* (i.e., `points', `flags', and `contours') are `owned' by the */ /* outline object, and should thus be freed when it is destroyed. */ /* */ /* FT_OUTLINE_EVEN_ODD_FILL :: */ /* By default, outlines are filled using the non-zero winding rule. */ /* If set to 1, the outline will be filled using the even-odd fill */ /* rule (only works with the smooth rasterizer). */ /* */ /* FT_OUTLINE_REVERSE_FILL :: */ /* By default, outside contours of an outline are oriented in */ /* clock-wise direction, as defined in the TrueType specification. */ /* This flag is set if the outline uses the opposite direction */ /* (typically for Type~1 fonts). This flag is ignored by the scan */ /* converter. */ /* */ /* FT_OUTLINE_IGNORE_DROPOUTS :: */ /* By default, the scan converter will try to detect drop-outs in */ /* an outline and correct the glyph bitmap to ensure consistent */ /* shape continuity. If set, this flag hints the scan-line */ /* converter to ignore such cases. See below for more information. */ /* */ /* FT_OUTLINE_SMART_DROPOUTS :: */ /* Select smart dropout control. If unset, use simple dropout */ /* control. Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See */ /* below for more information. */ /* */ /* FT_OUTLINE_INCLUDE_STUBS :: */ /* If set, turn pixels on for `stubs', otherwise exclude them. */ /* Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See below for */ /* more information. */ /* */ /* FT_OUTLINE_HIGH_PRECISION :: */ /* This flag indicates that the scan-line converter should try to */ /* convert this outline to bitmaps with the highest possible */ /* quality. It is typically set for small character sizes. Note */ /* that this is only a hint that might be completely ignored by a */ /* given scan-converter. */ /* */ /* FT_OUTLINE_SINGLE_PASS :: */ /* This flag is set to force a given scan-converter to only use a */ /* single pass over the outline to render a bitmap glyph image. */ /* Normally, it is set for very large character sizes. It is only */ /* a hint that might be completely ignored by a given */ /* scan-converter. */ /* */ /* <Note> */ /* The flags @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, */ /* and @FT_OUTLINE_INCLUDE_STUBS are ignored by the smooth */ /* rasterizer. */ /* */ /* There exists a second mechanism to pass the drop-out mode to the */ /* B/W rasterizer; see the `tags' field in @FT_Outline. */ /* */ /* Please refer to the description of the `SCANTYPE' instruction in */ /* the OpenType specification (in file `ttinst1.doc') how simple */ /* drop-outs, smart drop-outs, and stubs are defined. */ /* */ #define FT_OUTLINE_NONE 0x0 #define FT_OUTLINE_OWNER 0x1 #define FT_OUTLINE_EVEN_ODD_FILL 0x2 #define FT_OUTLINE_REVERSE_FILL 0x4 #define FT_OUTLINE_IGNORE_DROPOUTS 0x8 #define FT_OUTLINE_SMART_DROPOUTS 0x10 #define FT_OUTLINE_INCLUDE_STUBS 0x20 #define FT_OUTLINE_HIGH_PRECISION 0x100 #define FT_OUTLINE_SINGLE_PASS 0x200 /* these constants are deprecated; use the corresponding */ /* `FT_OUTLINE_XXX' values instead */ #define ft_outline_none FT_OUTLINE_NONE #define ft_outline_owner FT_OUTLINE_OWNER #define ft_outline_even_odd_fill FT_OUTLINE_EVEN_ODD_FILL #define ft_outline_reverse_fill FT_OUTLINE_REVERSE_FILL #define ft_outline_ignore_dropouts FT_OUTLINE_IGNORE_DROPOUTS #define ft_outline_high_precision FT_OUTLINE_HIGH_PRECISION #define ft_outline_single_pass FT_OUTLINE_SINGLE_PASS /* */ #define FT_CURVE_TAG( flag ) ( flag & 3 ) #define FT_CURVE_TAG_ON 1 #define FT_CURVE_TAG_CONIC 0 #define FT_CURVE_TAG_CUBIC 2 #define FT_CURVE_TAG_HAS_SCANMODE 4 #define FT_CURVE_TAG_TOUCH_X 8 /* reserved for the TrueType hinter */ #define FT_CURVE_TAG_TOUCH_Y 16 /* reserved for the TrueType hinter */ #define FT_CURVE_TAG_TOUCH_BOTH ( FT_CURVE_TAG_TOUCH_X | \ FT_CURVE_TAG_TOUCH_Y ) #define FT_Curve_Tag_On FT_CURVE_TAG_ON #define FT_Curve_Tag_Conic FT_CURVE_TAG_CONIC #define FT_Curve_Tag_Cubic FT_CURVE_TAG_CUBIC #define FT_Curve_Tag_Touch_X FT_CURVE_TAG_TOUCH_X #define FT_Curve_Tag_Touch_Y FT_CURVE_TAG_TOUCH_Y /*************************************************************************/ /* */ /* <FuncType> */ /* FT_Outline_MoveToFunc */ /* */ /* <Description> */ /* A function pointer type used to describe the signature of a `move */ /* to' function during outline walking/decomposition. */ /* */ /* A `move to' is emitted to start a new contour in an outline. */ /* */ /* <Input> */ /* to :: A pointer to the target point of the `move to'. */ /* */ /* user :: A typeless pointer, which is passed from the caller of the */ /* decomposition function. */ /* */ /* <Return> */ /* Error code. 0~means success. */ /* */ typedef int (*FT_Outline_MoveToFunc)( const FT_Vector* to, void* user ); #define FT_Outline_MoveTo_Func FT_Outline_MoveToFunc /*************************************************************************/ /* */ /* <FuncType> */ /* FT_Outline_LineToFunc */ /* */ /* <Description> */ /* A function pointer type used to describe the signature of a `line */ /* to' function during outline walking/decomposition. */ /* */ /* A `line to' is emitted to indicate a segment in the outline. */ /* */ /* <Input> */ /* to :: A pointer to the target point of the `line to'. */ /* */ /* user :: A typeless pointer, which is passed from the caller of the */ /* decomposition function. */ /* */ /* <Return> */ /* Error code. 0~means success. */ /* */ typedef int (*FT_Outline_LineToFunc)( const FT_Vector* to, void* user ); #define FT_Outline_LineTo_Func FT_Outline_LineToFunc /*************************************************************************/ /* */ /* <FuncType> */ /* FT_Outline_ConicToFunc */ /* */ /* <Description> */ /* A function pointer type used to describe the signature of a `conic */ /* to' function during outline walking or decomposition. */ /* */ /* A `conic to' is emitted to indicate a second-order Bézier arc in */ /* the outline. */ /* */ /* <Input> */ /* control :: An intermediate control point between the last position */ /* and the new target in `to'. */ /* */ /* to :: A pointer to the target end point of the conic arc. */ /* */ /* user :: A typeless pointer, which is passed from the caller of */ /* the decomposition function. */ /* */ /* <Return> */ /* Error code. 0~means success. */ /* */ typedef int (*FT_Outline_ConicToFunc)( const FT_Vector* control, const FT_Vector* to, void* user ); #define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc /*************************************************************************/ /* */ /* <FuncType> */ /* FT_Outline_CubicToFunc */ /* */ /* <Description> */ /* A function pointer type used to describe the signature of a `cubic */ /* to' function during outline walking or decomposition. */ /* */ /* A `cubic to' is emitted to indicate a third-order Bézier arc. */ /* */ /* <Input> */ /* control1 :: A pointer to the first Bézier control point. */ /* */ /* control2 :: A pointer to the second Bézier control point. */ /* */ /* to :: A pointer to the target end point. */ /* */ /* user :: A typeless pointer, which is passed from the caller of */ /* the decomposition function. */ /* */ /* <Return> */ /* Error code. 0~means success. */ /* */ typedef int (*FT_Outline_CubicToFunc)( const FT_Vector* control1, const FT_Vector* control2, const FT_Vector* to, void* user ); #define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc /*************************************************************************/ /* */ /* <Struct> */ /* FT_Outline_Funcs */ /* */ /* <Description> */ /* A structure to hold various function pointers used during outline */ /* decomposition in order to emit segments, conic, and cubic Béziers. */ /* */ /* <Fields> */ /* move_to :: The `move to' emitter. */ /* */ /* line_to :: The segment emitter. */ /* */ /* conic_to :: The second-order Bézier arc emitter. */ /* */ /* cubic_to :: The third-order Bézier arc emitter. */ /* */ /* shift :: The shift that is applied to coordinates before they */ /* are sent to the emitter. */ /* */ /* delta :: The delta that is applied to coordinates before they */ /* are sent to the emitter, but after the shift. */ /* */ /* <Note> */ /* The point coordinates sent to the emitters are the transformed */ /* version of the original coordinates (this is important for high */ /* accuracy during scan-conversion). The transformation is simple: */ /* */ /* { */ /* x' = (x << shift) - delta */ /* y' = (y << shift) - delta */ /* } */ /* */ /* Set the values of `shift' and `delta' to~0 to get the original */ /* point coordinates. */ /* */ typedef struct FT_Outline_Funcs_ { FT_Outline_MoveToFunc move_to; FT_Outline_LineToFunc line_to; FT_Outline_ConicToFunc conic_to; FT_Outline_CubicToFunc cubic_to; int shift; FT_Pos delta; } FT_Outline_Funcs; /*************************************************************************/ /* */ /* <Section> */ /* basic_types */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Macro> */ /* FT_IMAGE_TAG */ /* */ /* <Description> */ /* This macro converts four-letter tags to an unsigned long type. */ /* */ /* <Note> */ /* Since many 16-bit compilers don't like 32-bit enumerations, you */ /* should redefine this macro in case of problems to something like */ /* this: */ /* */ /* { */ /* #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value */ /* } */ /* */ /* to get a simple enumeration without assigning special numbers. */ /* */ #ifndef FT_IMAGE_TAG #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) \ value = ( ( (unsigned long)_x1 << 24 ) | \ ( (unsigned long)_x2 << 16 ) | \ ( (unsigned long)_x3 << 8 ) | \ (unsigned long)_x4 ) #endif /* FT_IMAGE_TAG */ /*************************************************************************/ /* */ /* <Enum> */ /* FT_Glyph_Format */ /* */ /* <Description> */ /* An enumeration type used to describe the format of a given glyph */ /* image. Note that this version of FreeType only supports two image */ /* formats, even though future font drivers will be able to register */ /* their own format. */ /* */ /* <Values> */ /* FT_GLYPH_FORMAT_NONE :: */ /* The value~0 is reserved. */ /* */ /* FT_GLYPH_FORMAT_COMPOSITE :: */ /* The glyph image is a composite of several other images. This */ /* format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to */ /* report compound glyphs (like accented characters). */ /* */ /* FT_GLYPH_FORMAT_BITMAP :: */ /* The glyph image is a bitmap, and can be described as an */ /* @FT_Bitmap. You generally need to access the `bitmap' field of */ /* the @FT_GlyphSlotRec structure to read it. */ /* */ /* FT_GLYPH_FORMAT_OUTLINE :: */ /* The glyph image is a vectorial outline made of line segments */ /* and Bézier arcs; it can be described as an @FT_Outline; you */ /* generally want to access the `outline' field of the */ /* @FT_GlyphSlotRec structure to read it. */ /* */ /* FT_GLYPH_FORMAT_PLOTTER :: */ /* The glyph image is a vectorial path with no inside and outside */ /* contours. Some Type~1 fonts, like those in the Hershey family, */ /* contain glyphs in this format. These are described as */ /* @FT_Outline, but FreeType isn't currently capable of rendering */ /* them correctly. */ /* */ typedef enum FT_Glyph_Format_ { FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ), FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ), FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP, 'b', 'i', 't', 's' ), FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE, 'o', 'u', 't', 'l' ), FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER, 'p', 'l', 'o', 't' ) } FT_Glyph_Format; /* these constants are deprecated; use the corresponding */ /* `FT_Glyph_Format' values instead. */ #define ft_glyph_format_none FT_GLYPH_FORMAT_NONE #define ft_glyph_format_composite FT_GLYPH_FORMAT_COMPOSITE #define ft_glyph_format_bitmap FT_GLYPH_FORMAT_BITMAP #define ft_glyph_format_outline FT_GLYPH_FORMAT_OUTLINE #define ft_glyph_format_plotter FT_GLYPH_FORMAT_PLOTTER /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** R A S T E R D E F I N I T I O N S *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* A raster is a scan converter, in charge of rendering an outline into */ /* a bitmap. This section contains the public API for rasters. */ /* */ /* Note that in FreeType 2, all rasters are now encapsulated within */ /* specific modules called `renderers'. See `ftrender.h' for more */ /* details on renderers. */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Section> */ /* raster */ /* */ /* <Title> */ /* Scanline Converter */ /* */ /* <Abstract> */ /* How vectorial outlines are converted into bitmaps and pixmaps. */ /* */ /* <Description> */ /* This section contains technical definitions. */ /* */ /* <Order> */ /* FT_Raster */ /* FT_Span */ /* FT_SpanFunc */ /* */ /* FT_Raster_Params */ /* FT_RASTER_FLAG_XXX */ /* */ /* FT_Raster_NewFunc */ /* FT_Raster_DoneFunc */ /* FT_Raster_ResetFunc */ /* FT_Raster_SetModeFunc */ /* FT_Raster_RenderFunc */ /* FT_Raster_Funcs */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Type> */ /* FT_Raster */ /* */ /* <Description> */ /* An opaque handle (pointer) to a raster object. Each object can be */ /* used independently to convert an outline into a bitmap or pixmap. */ /* */ typedef struct FT_RasterRec_* FT_Raster; /*************************************************************************/ /* */ /* <Struct> */ /* FT_Span */ /* */ /* <Description> */ /* A structure used to model a single span of gray pixels when */ /* rendering an anti-aliased bitmap. */ /* */ /* <Fields> */ /* x :: The span's horizontal start position. */ /* */ /* len :: The span's length in pixels. */ /* */ /* coverage :: The span color/coverage, ranging from 0 (background) */ /* to 255 (foreground). */ /* */ /* <Note> */ /* This structure is used by the span drawing callback type named */ /* @FT_SpanFunc that takes the y~coordinate of the span as a */ /* parameter. */ /* */ /* The coverage value is always between 0 and 255. If you want less */ /* gray values, the callback function has to reduce them. */ /* */ typedef struct FT_Span_ { short x; unsigned short len; unsigned char coverage; } FT_Span; /*************************************************************************/ /* */ /* <FuncType> */ /* FT_SpanFunc */ /* */ /* <Description> */ /* A function used as a call-back by the anti-aliased renderer in */ /* order to let client applications draw themselves the gray pixel */ /* spans on each scan line. */ /* */ /* <Input> */ /* y :: The scanline's y~coordinate. */ /* */ /* count :: The number of spans to draw on this scanline. */ /* */ /* spans :: A table of `count' spans to draw on the scanline. */ /* */ /* user :: User-supplied data that is passed to the callback. */ /* */ /* <Note> */ /* This callback allows client applications to directly render the */ /* gray spans of the anti-aliased bitmap to any kind of surfaces. */ /* */ /* This can be used to write anti-aliased outlines directly to a */ /* given background bitmap, and even perform translucency. */ /* */ typedef void (*FT_SpanFunc)( int y, int count, const FT_Span* spans, void* user ); #define FT_Raster_Span_Func FT_SpanFunc /*************************************************************************/ /* */ /* <FuncType> */ /* FT_Raster_BitTest_Func */ /* */ /* <Description> */ /* Deprecated, unimplemented. */ /* */ typedef int (*FT_Raster_BitTest_Func)( int y, int x, void* user ); /*************************************************************************/ /* */ /* <FuncType> */ /* FT_Raster_BitSet_Func */ /* */ /* <Description> */ /* Deprecated, unimplemented. */ /* */ typedef void (*FT_Raster_BitSet_Func)( int y, int x, void* user ); /*************************************************************************/ /* */ /* <Enum> */ /* FT_RASTER_FLAG_XXX */ /* */ /* <Description> */ /* A list of bit flag constants as used in the `flags' field of a */ /* @FT_Raster_Params structure. */ /* */ /* <Values> */ /* FT_RASTER_FLAG_DEFAULT :: This value is 0. */ /* */ /* FT_RASTER_FLAG_AA :: This flag is set to indicate that an */ /* anti-aliased glyph image should be */ /* generated. Otherwise, it will be */ /* monochrome (1-bit). */ /* */ /* FT_RASTER_FLAG_DIRECT :: This flag is set to indicate direct */ /* rendering. In this mode, client */ /* applications must provide their own span */ /* callback. This lets them directly */ /* draw or compose over an existing bitmap. */ /* If this bit is not set, the target */ /* pixmap's buffer _must_ be zeroed before */ /* rendering. */ /* */ /* Direct rendering is only possible with */ /* anti-aliased glyphs. */ /* */ /* FT_RASTER_FLAG_CLIP :: This flag is only used in direct */ /* rendering mode. If set, the output will */ /* be clipped to a box specified in the */ /* `clip_box' field of the */ /* @FT_Raster_Params structure. */ /* */ /* Note that by default, the glyph bitmap */ /* is clipped to the target pixmap, except */ /* in direct rendering mode where all spans */ /* are generated if no clipping box is set. */ /* */ #define FT_RASTER_FLAG_DEFAULT 0x0 #define FT_RASTER_FLAG_AA 0x1 #define FT_RASTER_FLAG_DIRECT 0x2 #define FT_RASTER_FLAG_CLIP 0x4 /* these constants are deprecated; use the corresponding */ /* `FT_RASTER_FLAG_XXX' values instead */ #define ft_raster_flag_default FT_RASTER_FLAG_DEFAULT #define ft_raster_flag_aa FT_RASTER_FLAG_AA #define ft_raster_flag_direct FT_RASTER_FLAG_DIRECT #define ft_raster_flag_clip FT_RASTER_FLAG_CLIP /*************************************************************************/ /* */ /* <Struct> */ /* FT_Raster_Params */ /* */ /* <Description> */ /* A structure to hold the arguments used by a raster's render */ /* function. */ /* */ /* <Fields> */ /* target :: The target bitmap. */ /* */ /* source :: A pointer to the source glyph image (e.g., an */ /* @FT_Outline). */ /* */ /* flags :: The rendering flags. */ /* */ /* gray_spans :: The gray span drawing callback. */ /* */ /* black_spans :: Unused. */ /* */ /* bit_test :: Unused. */ /* */ /* bit_set :: Unused. */ /* */ /* user :: User-supplied data that is passed to each drawing */ /* callback. */ /* */ /* clip_box :: An optional clipping box. It is only used in */ /* direct rendering mode. Note that coordinates here */ /* should be expressed in _integer_ pixels (and not in */ /* 26.6 fixed-point units). */ /* */ /* <Note> */ /* An anti-aliased glyph bitmap is drawn if the @FT_RASTER_FLAG_AA */ /* bit flag is set in the `flags' field, otherwise a monochrome */ /* bitmap is generated. */ /* */ /* If the @FT_RASTER_FLAG_DIRECT bit flag is set in `flags', the */ /* raster will call the `gray_spans' callback to draw gray pixel */ /* spans. This allows direct composition over a pre-existing bitmap */ /* through user-provided callbacks to perform the span drawing and */ /* composition. Not supported by the monochrome rasterizer. */ /* */ typedef struct FT_Raster_Params_ { const FT_Bitmap* target; const void* source; int flags; FT_SpanFunc gray_spans; FT_SpanFunc black_spans; /* unused */ FT_Raster_BitTest_Func bit_test; /* unused */ FT_Raster_BitSet_Func bit_set; /* unused */ void* user; FT_BBox clip_box; } FT_Raster_Params; /*************************************************************************/ /* */ /* <FuncType> */ /* FT_Raster_NewFunc */ /* */ /* <Description> */ /* A function used to create a new raster object. */ /* */ /* <Input> */ /* memory :: A handle to the memory allocator. */ /* */ /* <Output> */ /* raster :: A handle to the new raster object. */ /* */ /* <Return> */ /* Error code. 0~means success. */ /* */ /* <Note> */ /* The `memory' parameter is a typeless pointer in order to avoid */ /* un-wanted dependencies on the rest of the FreeType code. In */ /* practice, it is an @FT_Memory object, i.e., a handle to the */ /* standard FreeType memory allocator. However, this field can be */ /* completely ignored by a given raster implementation. */ /* */ typedef int (*FT_Raster_NewFunc)( void* memory, FT_Raster* raster ); #define FT_Raster_New_Func FT_Raster_NewFunc /*************************************************************************/ /* */ /* <FuncType> */ /* FT_Raster_DoneFunc */ /* */ /* <Description> */ /* A function used to destroy a given raster object. */ /* */ /* <Input> */ /* raster :: A handle to the raster object. */ /* */ typedef void (*FT_Raster_DoneFunc)( FT_Raster raster ); #define FT_Raster_Done_Func FT_Raster_DoneFunc /*************************************************************************/ /* */ /* <FuncType> */ /* FT_Raster_ResetFunc */ /* */ /* <Description> */ /* FreeType used to provide an area of memory called the `render */ /* pool' available to all registered rasters. This was not thread */ /* safe however and now FreeType never allocates this pool. NULL */ /* is always passed in as pool_base. */ /* */ /* This function is called each time the render pool changes, or just */ /* after a new raster object is created. */ /* */ /* <Input> */ /* raster :: A handle to the new raster object. */ /* */ /* pool_base :: The address in memory of the render pool. */ /* */ /* pool_size :: The size in bytes of the render pool. */ /* */ /* <Note> */ /* Rasters should ignore the render pool and rely on dynamic or stack */ /* allocation if they want to (a handle to the memory allocator is */ /* passed to the raster constructor). */ /* */ typedef void (*FT_Raster_ResetFunc)( FT_Raster raster, unsigned char* pool_base, unsigned long pool_size ); #define FT_Raster_Reset_Func FT_Raster_ResetFunc /*************************************************************************/ /* */ /* <FuncType> */ /* FT_Raster_SetModeFunc */ /* */ /* <Description> */ /* This function is a generic facility to change modes or attributes */ /* in a given raster. This can be used for debugging purposes, or */ /* simply to allow implementation-specific `features' in a given */ /* raster module. */ /* */ /* <Input> */ /* raster :: A handle to the new raster object. */ /* */ /* mode :: A 4-byte tag used to name the mode or property. */ /* */ /* args :: A pointer to the new mode/property to use. */ /* */ typedef int (*FT_Raster_SetModeFunc)( FT_Raster raster, unsigned long mode, void* args ); #define FT_Raster_Set_Mode_Func FT_Raster_SetModeFunc /*************************************************************************/ /* */ /* <FuncType> */ /* FT_Raster_RenderFunc */ /* */ /* <Description> */ /* Invoke a given raster to scan-convert a given glyph image into a */ /* target bitmap. */ /* */ /* <Input> */ /* raster :: A handle to the raster object. */ /* */ /* params :: A pointer to an @FT_Raster_Params structure used to */ /* store the rendering parameters. */ /* */ /* <Return> */ /* Error code. 0~means success. */ /* */ /* <Note> */ /* The exact format of the source image depends on the raster's glyph */ /* format defined in its @FT_Raster_Funcs structure. It can be an */ /* @FT_Outline or anything else in order to support a large array of */ /* glyph formats. */ /* */ /* Note also that the render function can fail and return a */ /* `FT_Err_Unimplemented_Feature' error code if the raster used does */ /* not support direct composition. */ /* */ /* XXX: For now, the standard raster doesn't support direct */ /* composition but this should change for the final release (see */ /* the files `demos/src/ftgrays.c' and `demos/src/ftgrays2.c' */ /* for examples of distinct implementations that support direct */ /* composition). */ /* */ typedef int (*FT_Raster_RenderFunc)( FT_Raster raster, const FT_Raster_Params* params ); #define FT_Raster_Render_Func FT_Raster_RenderFunc /*************************************************************************/ /* */ /* <Struct> */ /* FT_Raster_Funcs */ /* */ /* <Description> */ /* A structure used to describe a given raster class to the library. */ /* */ /* <Fields> */ /* glyph_format :: The supported glyph format for this raster. */ /* */ /* raster_new :: The raster constructor. */ /* */ /* raster_reset :: Used to reset the render pool within the raster. */ /* */ /* raster_render :: A function to render a glyph into a given bitmap. */ /* */ /* raster_done :: The raster destructor. */ /* */ typedef struct FT_Raster_Funcs_ { FT_Glyph_Format glyph_format; FT_Raster_NewFunc raster_new; FT_Raster_ResetFunc raster_reset; FT_Raster_SetModeFunc raster_set_mode; FT_Raster_RenderFunc raster_render; FT_Raster_DoneFunc raster_done; } FT_Raster_Funcs; /* */ FT_END_HEADER #endif /* FTIMAGE_H_ */ /* END */ /* Local Variables: */ /* coding: utf-8 */ /* End: */ ����������������������������������������������������������������������������������������������freetype2/freetype/ftbzip2.h������������������������������������������������������������������������0000644�����������������00000010313�14763166026�0012036 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftbzip2.h */ /* */ /* Bzip2-compressed stream support. */ /* */ /* Copyright 2010-2017 by */ /* Joel Klinghed. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTBZIP2_H_ #define FTBZIP2_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* bzip2 */ /* */ /* <Title> */ /* BZIP2 Streams */ /* */ /* <Abstract> */ /* Using bzip2-compressed font files. */ /* */ /* <Description> */ /* This section contains the declaration of Bzip2-specific functions. */ /* */ /*************************************************************************/ /************************************************************************ * * @function: * FT_Stream_OpenBzip2 * * @description: * Open a new stream to parse bzip2-compressed font files. This is * mainly used to support the compressed `*.pcf.bz2' fonts that come * with XFree86. * * @input: * stream :: * The target embedding stream. * * source :: * The source stream. * * @return: * FreeType error code. 0~means success. * * @note: * The source stream must be opened _before_ calling this function. * * Calling the internal function `FT_Stream_Close' on the new stream will * *not* call `FT_Stream_Close' on the source stream. None of the stream * objects will be released to the heap. * * The stream implementation is very basic and resets the decompression * process each time seeking backwards is needed within the stream. * * In certain builds of the library, bzip2 compression recognition is * automatically handled when calling @FT_New_Face or @FT_Open_Face. * This means that if no font driver is capable of handling the raw * compressed file, the library will try to open a bzip2 compressed stream * from it and re-open the face with it. * * This function may return `FT_Err_Unimplemented_Feature' if your build * of FreeType was not compiled with bzip2 support. */ FT_EXPORT( FT_Error ) FT_Stream_OpenBzip2( FT_Stream stream, FT_Stream source ); /* */ FT_END_HEADER #endif /* FTBZIP2_H_ */ /* END */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftcffdrv.h�����������������������������������������������������������������������0000644�����������������00000030164�14763166026�0012270 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftcffdrv.h */ /* */ /* FreeType API for controlling the CFF driver (specification only). */ /* */ /* Copyright 2013-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTCFFDRV_H_ #define FTCFFDRV_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /************************************************************************** * * @section: * cff_driver * * @title: * The CFF driver * * @abstract: * Controlling the CFF driver module. * * @description: * While FreeType's CFF driver doesn't expose API functions by itself, * it is possible to control its behaviour with @FT_Property_Set and * @FT_Property_Get. The list below gives the available properties * together with the necessary macros and structures. * * The CFF driver's module name is `cff'. * * *Hinting* *and* *antialiasing* *principles* *of* *the* *new* *engine* * * The rasterizer is positioning horizontal features (e.g., ascender * height & x-height, or crossbars) on the pixel grid and minimizing the * amount of antialiasing applied to them, while placing vertical * features (vertical stems) on the pixel grid without hinting, thus * representing the stem position and weight accurately. Sometimes the * vertical stems may be only partially black. In this context, * `antialiasing' means that stems are not positioned exactly on pixel * borders, causing a fuzzy appearance. * * There are two principles behind this approach. * * 1) No hinting in the horizontal direction: Unlike `superhinted' * TrueType, which changes glyph widths to accommodate regular * inter-glyph spacing, Adobe's approach is `faithful to the design' in * representing both the glyph width and the inter-glyph spacing * designed for the font. This makes the screen display as close as it * can be to the result one would get with infinite resolution, while * preserving what is considered the key characteristics of each glyph. * Note that the distances between unhinted and grid-fitted positions at * small sizes are comparable to kerning values and thus would be * noticeable (and distracting) while reading if hinting were applied. * * One of the reasons to not hint horizontally is antialiasing for LCD * screens: The pixel geometry of modern displays supplies three * vertical sub-pixels as the eye moves horizontally across each visible * pixel. On devices where we can be certain this characteristic is * present a rasterizer can take advantage of the sub-pixels to add * increments of weight. In Western writing systems this turns out to * be the more critical direction anyway; the weights and spacing of * vertical stems (see above) are central to Armenian, Cyrillic, Greek, * and Latin type designs. Even when the rasterizer uses greyscale * antialiasing instead of color (a necessary compromise when one * doesn't know the screen characteristics), the unhinted vertical * features preserve the design's weight and spacing much better than * aliased type would. * * 2) Alignment in the vertical direction: Weights and spacing along the * y~axis are less critical; what is much more important is the visual * alignment of related features (like cap-height and x-height). The * sense of alignment for these is enhanced by the sharpness of grid-fit * edges, while the cruder vertical resolution (full pixels instead of * 1/3 pixels) is less of a problem. * * On the technical side, horizontal alignment zones for ascender, * x-height, and other important height values (traditionally called * `blue zones') as defined in the font are positioned independently, * each being rounded to the nearest pixel edge, taking care of * overshoot suppression at small sizes, stem darkening, and scaling. * * Hstems (this is, hint values defined in the font to help align * horizontal features) that fall within a blue zone are said to be * `captured' and are aligned to that zone. Uncaptured stems are moved * in one of four ways, top edge up or down, bottom edge up or down. * Unless there are conflicting hstems, the smallest movement is taken * to minimize distortion. * * @order: * hinting-engine[cff] * no-stem-darkening[cff] * darkening-parameters[cff] * random-seed * */ /************************************************************************** * * @property: * hinting-engine[cff] * * @description: * Thanks to Adobe, which contributed a new hinting (and parsing) * engine, an application can select between `freetype' and `adobe' if * compiled with CFF_CONFIG_OPTION_OLD_ENGINE. If this configuration * macro isn't defined, `hinting-engine' does nothing. * * The default engine is `freetype' if CFF_CONFIG_OPTION_OLD_ENGINE is * defined, and `adobe' otherwise. * * The following example code demonstrates how to select Adobe's hinting * engine (omitting the error handling). * * { * FT_Library library; * FT_UInt hinting_engine = FT_CFF_HINTING_ADOBE; * * * FT_Init_FreeType( &library ); * * FT_Property_Set( library, "cff", * "hinting-engine", &hinting_engine ); * } * * @note: * This property can be used with @FT_Property_Get also. * * This property can be set via the `FREETYPE_PROPERTIES' environment * variable (using values `adobe' or `freetype'). */ /************************************************************************** * * @enum: * FT_CFF_HINTING_XXX * * @description: * A list of constants used for the @hinting-engine[cff] property to * select the hinting engine for CFF fonts. * * @values: * FT_CFF_HINTING_FREETYPE :: * Use the old FreeType hinting engine. * * FT_CFF_HINTING_ADOBE :: * Use the hinting engine contributed by Adobe. * */ #define FT_CFF_HINTING_FREETYPE 0 #define FT_CFF_HINTING_ADOBE 1 /************************************************************************** * * @property: * no-stem-darkening[cff] * * @description: * By default, the Adobe CFF engine darkens stems at smaller sizes, * regardless of hinting, to enhance contrast. This feature requires * a rendering system with proper gamma correction. Setting this * property, stem darkening gets switched off. * * Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is set. * * { * FT_Library library; * FT_Bool no_stem_darkening = TRUE; * * * FT_Init_FreeType( &library ); * * FT_Property_Set( library, "cff", * "no-stem-darkening", &no_stem_darkening ); * } * * @note: * This property can be used with @FT_Property_Get also. * * This property can be set via the `FREETYPE_PROPERTIES' environment * variable (using values 1 and 0 for `on' and `off', respectively). * It can also be set per face using @FT_Face_Properties with * @FT_PARAM_TAG_STEM_DARKENING. * */ /************************************************************************** * * @property: * darkening-parameters[cff] * * @description: * By default, the Adobe CFF engine darkens stems as follows (if the * `no-stem-darkening' property isn't set): * * { * stem width <= 0.5px: darkening amount = 0.4px * stem width = 1px: darkening amount = 0.275px * stem width = 1.667px: darkening amount = 0.275px * stem width >= 2.333px: darkening amount = 0px * } * * and piecewise linear in-between. At configuration time, these four * control points can be set with the macro * `CFF_CONFIG_OPTION_DARKENING_PARAMETERS'. At runtime, the control * points can be changed using the `darkening-parameters' property, as * the following example demonstrates. * * { * FT_Library library; * FT_Int darken_params[8] = { 500, 300, // x1, y1 * 1000, 200, // x2, y2 * 1500, 100, // x3, y3 * 2000, 0 }; // x4, y4 * * * FT_Init_FreeType( &library ); * * FT_Property_Set( library, "cff", * "darkening-parameters", darken_params ); * } * * The x~values give the stem width, and the y~values the darkening * amount. The unit is 1000th of pixels. All coordinate values must be * positive; the x~values must be monotonically increasing; the * y~values must be monotonically decreasing and smaller than or * equal to 500 (corresponding to half a pixel); the slope of each * linear piece must be shallower than -1 (e.g., -.4). * * @note: * This property can be used with @FT_Property_Get also. * * This property can be set via the `FREETYPE_PROPERTIES' environment * variable, using eight comma-separated integers without spaces. Here * the above example, using `\' to break the line for readability. * * { * FREETYPE_PROPERTIES=\ * cff:darkening-parameters=500,300,1000,200,1500,100,2000,0 * } */ /************************************************************************** * * @property: * random-seed * * @description: * By default, the seed value for the CFF `random' operator is set to a * random value. However, mainly for debugging purposes, it is often * necessary to use a known value as a seed so that the pseudo-random * number sequences generated by `random' are repeatable. * * The `random-seed' property does that. Its argument is a signed 32bit * integer; if the value is zero or negative, the seed given by the * `intitialRandomSeed' private DICT operator in a CFF file gets used * (or a default value if there is no such operator). If the value is * positive, use it instead of `initialRandomSeed', which is * consequently ignored. * * @note: * This property can be set via the `FREETYPE_PROPERTIES' environment * variable. It can also be set per face using @FT_Face_Properties with * @FT_PARAM_TAG_RANDOM_SEED. * */ /************************************************************************** * * @constant: * FT_PARAM_TAG_RANDOM_SEED * * @description: * An @FT_Parameter tag to be used with @FT_Face_Properties. The * corresponding 32bit signed integer argument overrides the CFF * module's random seed value with a face-specific one; see * @random-seed. * */ #define FT_PARAM_TAG_RANDOM_SEED \ FT_MAKE_TAG( 's', 'e', 'e', 'd' ) /* */ FT_END_HEADER #endif /* FTCFFDRV_H_ */ /* END */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/fttrigon.h�����������������������������������������������������������������������0000644�����������������00000020350�14763166026�0012314 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* fttrigon.h */ /* */ /* FreeType trigonometric functions (specification). */ /* */ /* Copyright 2001-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTTRIGON_H_ #define FTTRIGON_H_ #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* computations */ /* */ /*************************************************************************/ /************************************************************************* * * @type: * FT_Angle * * @description: * This type is used to model angle values in FreeType. Note that the * angle is a 16.16 fixed-point value expressed in degrees. * */ typedef FT_Fixed FT_Angle; /************************************************************************* * * @macro: * FT_ANGLE_PI * * @description: * The angle pi expressed in @FT_Angle units. * */ #define FT_ANGLE_PI ( 180L << 16 ) /************************************************************************* * * @macro: * FT_ANGLE_2PI * * @description: * The angle 2*pi expressed in @FT_Angle units. * */ #define FT_ANGLE_2PI ( FT_ANGLE_PI * 2 ) /************************************************************************* * * @macro: * FT_ANGLE_PI2 * * @description: * The angle pi/2 expressed in @FT_Angle units. * */ #define FT_ANGLE_PI2 ( FT_ANGLE_PI / 2 ) /************************************************************************* * * @macro: * FT_ANGLE_PI4 * * @description: * The angle pi/4 expressed in @FT_Angle units. * */ #define FT_ANGLE_PI4 ( FT_ANGLE_PI / 4 ) /************************************************************************* * * @function: * FT_Sin * * @description: * Return the sinus of a given angle in fixed-point format. * * @input: * angle :: * The input angle. * * @return: * The sinus value. * * @note: * If you need both the sinus and cosinus for a given angle, use the * function @FT_Vector_Unit. * */ FT_EXPORT( FT_Fixed ) FT_Sin( FT_Angle angle ); /************************************************************************* * * @function: * FT_Cos * * @description: * Return the cosinus of a given angle in fixed-point format. * * @input: * angle :: * The input angle. * * @return: * The cosinus value. * * @note: * If you need both the sinus and cosinus for a given angle, use the * function @FT_Vector_Unit. * */ FT_EXPORT( FT_Fixed ) FT_Cos( FT_Angle angle ); /************************************************************************* * * @function: * FT_Tan * * @description: * Return the tangent of a given angle in fixed-point format. * * @input: * angle :: * The input angle. * * @return: * The tangent value. * */ FT_EXPORT( FT_Fixed ) FT_Tan( FT_Angle angle ); /************************************************************************* * * @function: * FT_Atan2 * * @description: * Return the arc-tangent corresponding to a given vector (x,y) in * the 2d plane. * * @input: * x :: * The horizontal vector coordinate. * * y :: * The vertical vector coordinate. * * @return: * The arc-tangent value (i.e. angle). * */ FT_EXPORT( FT_Angle ) FT_Atan2( FT_Fixed x, FT_Fixed y ); /************************************************************************* * * @function: * FT_Angle_Diff * * @description: * Return the difference between two angles. The result is always * constrained to the ]-PI..PI] interval. * * @input: * angle1 :: * First angle. * * angle2 :: * Second angle. * * @return: * Constrained value of `value2-value1'. * */ FT_EXPORT( FT_Angle ) FT_Angle_Diff( FT_Angle angle1, FT_Angle angle2 ); /************************************************************************* * * @function: * FT_Vector_Unit * * @description: * Return the unit vector corresponding to a given angle. After the * call, the value of `vec.x' will be `cos(angle)', and the value of * `vec.y' will be `sin(angle)'. * * This function is useful to retrieve both the sinus and cosinus of a * given angle quickly. * * @output: * vec :: * The address of target vector. * * @input: * angle :: * The input angle. * */ FT_EXPORT( void ) FT_Vector_Unit( FT_Vector* vec, FT_Angle angle ); /************************************************************************* * * @function: * FT_Vector_Rotate * * @description: * Rotate a vector by a given angle. * * @inout: * vec :: * The address of target vector. * * @input: * angle :: * The input angle. * */ FT_EXPORT( void ) FT_Vector_Rotate( FT_Vector* vec, FT_Angle angle ); /************************************************************************* * * @function: * FT_Vector_Length * * @description: * Return the length of a given vector. * * @input: * vec :: * The address of target vector. * * @return: * The vector length, expressed in the same units that the original * vector coordinates. * */ FT_EXPORT( FT_Fixed ) FT_Vector_Length( FT_Vector* vec ); /************************************************************************* * * @function: * FT_Vector_Polarize * * @description: * Compute both the length and angle of a given vector. * * @input: * vec :: * The address of source vector. * * @output: * length :: * The vector length. * * angle :: * The vector angle. * */ FT_EXPORT( void ) FT_Vector_Polarize( FT_Vector* vec, FT_Fixed *length, FT_Angle *angle ); /************************************************************************* * * @function: * FT_Vector_From_Polar * * @description: * Compute vector coordinates from a length and angle. * * @output: * vec :: * The address of source vector. * * @input: * length :: * The vector length. * * angle :: * The vector angle. * */ FT_EXPORT( void ) FT_Vector_From_Polar( FT_Vector* vec, FT_Fixed length, FT_Angle angle ); /* */ FT_END_HEADER #endif /* FTTRIGON_H_ */ /* END */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftsynth.h������������������������������������������������������������������������0000644�����������������00000010033�14763166026�0012154 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftsynth.h */ /* */ /* FreeType synthesizing code for emboldening and slanting */ /* (specification). */ /* */ /* Copyright 2000-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /********* *********/ /********* WARNING, THIS IS ALPHA CODE! THIS API *********/ /********* IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE *********/ /********* FREETYPE DEVELOPMENT TEAM *********/ /********* *********/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* Main reason for not lifting the functions in this module to a */ /* `standard' API is that the used parameters for emboldening and */ /* slanting are not configurable. Consider the functions as a */ /* code resource that should be copied into the application and */ /* adapted to the particular needs. */ #ifndef FTSYNTH_H_ #define FTSYNTH_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /* Embolden a glyph by a `reasonable' value (which is highly a matter of */ /* taste). This function is actually a convenience function, providing */ /* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden. */ /* */ /* For emboldened outlines the height, width, and advance metrics are */ /* increased by the strength of the emboldening -- this even affects */ /* mono-width fonts! */ /* */ /* You can also call @FT_Outline_Get_CBox to get precise values. */ FT_EXPORT( void ) FT_GlyphSlot_Embolden( FT_GlyphSlot slot ); /* Slant an outline glyph to the right by about 12 degrees. */ FT_EXPORT( void ) FT_GlyphSlot_Oblique( FT_GlyphSlot slot ); /* */ FT_END_HEADER #endif /* FTSYNTH_H_ */ /* END */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ttunpat.h������������������������������������������������������������������������0000644�����������������00000004436�14763166026�0012166 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ttunpat.h */ /* */ /* Definitions for the unpatented TrueType hinting system. */ /* Obsolete, retained for backward compatibility. */ /* */ /* Copyright 2003-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* Written by Graham Asher <graham.asher@btinternet.com> */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef TTUNPAT_H_ #define TTUNPAT_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************** * * @constant: * FT_PARAM_TAG_UNPATENTED_HINTING * * @description: * Deprecated. * * Previously: A constant used as the tag of an @FT_Parameter structure to * indicate that unpatented methods only should be used by the TrueType * bytecode interpreter for a typeface opened by @FT_Open_Face. * */ #define FT_PARAM_TAG_UNPATENTED_HINTING FT_MAKE_TAG( 'u', 'n', 'p', 'a' ) /* */ FT_END_HEADER #endif /* TTUNPAT_H_ */ /* END */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftbbox.h�������������������������������������������������������������������������0000644�����������������00000012163�14763166026�0011747 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftbbox.h */ /* */ /* FreeType exact bbox computation (specification). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ /*************************************************************************/ /* */ /* This component has a _single_ role: to compute exact outline bounding */ /* boxes. */ /* */ /* It is separated from the rest of the engine for various technical */ /* reasons. It may well be integrated in `ftoutln' later. */ /* */ /*************************************************************************/ #ifndef FTBBOX_H_ #define FTBBOX_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* outline_processing */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Function> */ /* FT_Outline_Get_BBox */ /* */ /* <Description> */ /* Compute the exact bounding box of an outline. This is slower */ /* than computing the control box. However, it uses an advanced */ /* algorithm that returns _very_ quickly when the two boxes */ /* coincide. Otherwise, the outline Bézier arcs are traversed to */ /* extract their extrema. */ /* */ /* <Input> */ /* outline :: A pointer to the source outline. */ /* */ /* <Output> */ /* abbox :: The outline's exact bounding box. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* If the font is tricky and the glyph has been loaded with */ /* @FT_LOAD_NO_SCALE, the resulting BBox is meaningless. To get */ /* reasonable values for the BBox it is necessary to load the glyph */ /* at a large ppem value (so that the hinting instructions can */ /* properly shift and scale the subglyphs), then extracting the BBox, */ /* which can be eventually converted back to font units. */ /* */ FT_EXPORT( FT_Error ) FT_Outline_Get_BBox( FT_Outline* outline, FT_BBox *abbox ); /* */ FT_END_HEADER #endif /* FTBBOX_H_ */ /* END */ /* Local Variables: */ /* coding: utf-8 */ /* End: */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftfntfmt.h�����������������������������������������������������������������������0000644�����������������00000011560�14763166026�0012313 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftfntfmt.h */ /* */ /* Support functions for font formats. */ /* */ /* Copyright 2002-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTFNTFMT_H_ #define FTFNTFMT_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* font_formats */ /* */ /* <Title> */ /* Font Formats */ /* */ /* <Abstract> */ /* Getting the font format. */ /* */ /* <Description> */ /* The single function in this section can be used to get the font */ /* format. Note that this information is not needed normally; */ /* however, there are special cases (like in PDF devices) where it is */ /* important to differentiate, in spite of FreeType's uniform API. */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_Font_Format */ /* */ /* <Description> */ /* Return a string describing the format of a given face. Possible */ /* values are `TrueType', `Type~1', `BDF', `PCF', `Type~42', */ /* `CID~Type~1', `CFF', `PFR', and `Windows~FNT'. */ /* */ /* The return value is suitable to be used as an X11 FONT_PROPERTY. */ /* */ /* <Input> */ /* face :: */ /* Input face handle. */ /* */ /* <Return> */ /* Font format string. NULL in case of error. */ /* */ /* <Note> */ /* A deprecated name for the same function is */ /* `FT_Get_X11_Font_Format'. */ /* */ FT_EXPORT( const char* ) FT_Get_Font_Format( FT_Face face ); /* deprecated */ FT_EXPORT( const char* ) FT_Get_X11_Font_Format( FT_Face face ); /* */ FT_END_HEADER #endif /* FTFNTFMT_H_ */ /* END */ ������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/tttags.h�������������������������������������������������������������������������0000644�����������������00000012451�14763166026�0011771 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* tttags.h */ /* */ /* Tags for TrueType and OpenType tables (specification only). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef TTAGS_H_ #define TTAGS_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER #define TTAG_avar FT_MAKE_TAG( 'a', 'v', 'a', 'r' ) #define TTAG_BASE FT_MAKE_TAG( 'B', 'A', 'S', 'E' ) #define TTAG_bdat FT_MAKE_TAG( 'b', 'd', 'a', 't' ) #define TTAG_BDF FT_MAKE_TAG( 'B', 'D', 'F', ' ' ) #define TTAG_bhed FT_MAKE_TAG( 'b', 'h', 'e', 'd' ) #define TTAG_bloc FT_MAKE_TAG( 'b', 'l', 'o', 'c' ) #define TTAG_bsln FT_MAKE_TAG( 'b', 's', 'l', 'n' ) #define TTAG_CBDT FT_MAKE_TAG( 'C', 'B', 'D', 'T' ) #define TTAG_CBLC FT_MAKE_TAG( 'C', 'B', 'L', 'C' ) #define TTAG_CFF FT_MAKE_TAG( 'C', 'F', 'F', ' ' ) #define TTAG_CFF2 FT_MAKE_TAG( 'C', 'F', 'F', '2' ) #define TTAG_CID FT_MAKE_TAG( 'C', 'I', 'D', ' ' ) #define TTAG_cmap FT_MAKE_TAG( 'c', 'm', 'a', 'p' ) #define TTAG_cvar FT_MAKE_TAG( 'c', 'v', 'a', 'r' ) #define TTAG_cvt FT_MAKE_TAG( 'c', 'v', 't', ' ' ) #define TTAG_DSIG FT_MAKE_TAG( 'D', 'S', 'I', 'G' ) #define TTAG_EBDT FT_MAKE_TAG( 'E', 'B', 'D', 'T' ) #define TTAG_EBLC FT_MAKE_TAG( 'E', 'B', 'L', 'C' ) #define TTAG_EBSC FT_MAKE_TAG( 'E', 'B', 'S', 'C' ) #define TTAG_feat FT_MAKE_TAG( 'f', 'e', 'a', 't' ) #define TTAG_FOND FT_MAKE_TAG( 'F', 'O', 'N', 'D' ) #define TTAG_fpgm FT_MAKE_TAG( 'f', 'p', 'g', 'm' ) #define TTAG_fvar FT_MAKE_TAG( 'f', 'v', 'a', 'r' ) #define TTAG_gasp FT_MAKE_TAG( 'g', 'a', 's', 'p' ) #define TTAG_GDEF FT_MAKE_TAG( 'G', 'D', 'E', 'F' ) #define TTAG_glyf FT_MAKE_TAG( 'g', 'l', 'y', 'f' ) #define TTAG_GPOS FT_MAKE_TAG( 'G', 'P', 'O', 'S' ) #define TTAG_GSUB FT_MAKE_TAG( 'G', 'S', 'U', 'B' ) #define TTAG_gvar FT_MAKE_TAG( 'g', 'v', 'a', 'r' ) #define TTAG_HVAR FT_MAKE_TAG( 'H', 'V', 'A', 'R' ) #define TTAG_hdmx FT_MAKE_TAG( 'h', 'd', 'm', 'x' ) #define TTAG_head FT_MAKE_TAG( 'h', 'e', 'a', 'd' ) #define TTAG_hhea FT_MAKE_TAG( 'h', 'h', 'e', 'a' ) #define TTAG_hmtx FT_MAKE_TAG( 'h', 'm', 't', 'x' ) #define TTAG_JSTF FT_MAKE_TAG( 'J', 'S', 'T', 'F' ) #define TTAG_just FT_MAKE_TAG( 'j', 'u', 's', 't' ) #define TTAG_kern FT_MAKE_TAG( 'k', 'e', 'r', 'n' ) #define TTAG_lcar FT_MAKE_TAG( 'l', 'c', 'a', 'r' ) #define TTAG_loca FT_MAKE_TAG( 'l', 'o', 'c', 'a' ) #define TTAG_LTSH FT_MAKE_TAG( 'L', 'T', 'S', 'H' ) #define TTAG_LWFN FT_MAKE_TAG( 'L', 'W', 'F', 'N' ) #define TTAG_MATH FT_MAKE_TAG( 'M', 'A', 'T', 'H' ) #define TTAG_maxp FT_MAKE_TAG( 'm', 'a', 'x', 'p' ) #define TTAG_META FT_MAKE_TAG( 'M', 'E', 'T', 'A' ) #define TTAG_MMFX FT_MAKE_TAG( 'M', 'M', 'F', 'X' ) #define TTAG_MMSD FT_MAKE_TAG( 'M', 'M', 'S', 'D' ) #define TTAG_mort FT_MAKE_TAG( 'm', 'o', 'r', 't' ) #define TTAG_morx FT_MAKE_TAG( 'm', 'o', 'r', 'x' ) #define TTAG_MVAR FT_MAKE_TAG( 'M', 'V', 'A', 'R' ) #define TTAG_name FT_MAKE_TAG( 'n', 'a', 'm', 'e' ) #define TTAG_opbd FT_MAKE_TAG( 'o', 'p', 'b', 'd' ) #define TTAG_OS2 FT_MAKE_TAG( 'O', 'S', '/', '2' ) #define TTAG_OTTO FT_MAKE_TAG( 'O', 'T', 'T', 'O' ) #define TTAG_PCLT FT_MAKE_TAG( 'P', 'C', 'L', 'T' ) #define TTAG_POST FT_MAKE_TAG( 'P', 'O', 'S', 'T' ) #define TTAG_post FT_MAKE_TAG( 'p', 'o', 's', 't' ) #define TTAG_prep FT_MAKE_TAG( 'p', 'r', 'e', 'p' ) #define TTAG_prop FT_MAKE_TAG( 'p', 'r', 'o', 'p' ) #define TTAG_sbix FT_MAKE_TAG( 's', 'b', 'i', 'x' ) #define TTAG_sfnt FT_MAKE_TAG( 's', 'f', 'n', 't' ) #define TTAG_SING FT_MAKE_TAG( 'S', 'I', 'N', 'G' ) #define TTAG_trak FT_MAKE_TAG( 't', 'r', 'a', 'k' ) #define TTAG_true FT_MAKE_TAG( 't', 'r', 'u', 'e' ) #define TTAG_ttc FT_MAKE_TAG( 't', 't', 'c', ' ' ) #define TTAG_ttcf FT_MAKE_TAG( 't', 't', 'c', 'f' ) #define TTAG_TYP1 FT_MAKE_TAG( 'T', 'Y', 'P', '1' ) #define TTAG_typ1 FT_MAKE_TAG( 't', 'y', 'p', '1' ) #define TTAG_VDMX FT_MAKE_TAG( 'V', 'D', 'M', 'X' ) #define TTAG_vhea FT_MAKE_TAG( 'v', 'h', 'e', 'a' ) #define TTAG_vmtx FT_MAKE_TAG( 'v', 'm', 't', 'x' ) #define TTAG_VVAR FT_MAKE_TAG( 'V', 'V', 'A', 'R' ) #define TTAG_wOFF FT_MAKE_TAG( 'w', 'O', 'F', 'F' ) FT_END_HEADER #endif /* TTAGS_H_ */ /* END */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftchapters.h���������������������������������������������������������������������0000644�����������������00000022607�14763166026�0012632 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* This file defines the structure of the FreeType reference. */ /* It is used by the python script that generates the HTML files. */ /* */ /***************************************************************************/ /***************************************************************************/ /* */ /* <Chapter> */ /* general_remarks */ /* */ /* <Title> */ /* General Remarks */ /* */ /* <Sections> */ /* header_inclusion */ /* user_allocation */ /* */ /***************************************************************************/ /***************************************************************************/ /* */ /* <Chapter> */ /* core_api */ /* */ /* <Title> */ /* Core API */ /* */ /* <Sections> */ /* version */ /* basic_types */ /* base_interface */ /* glyph_variants */ /* glyph_management */ /* mac_specific */ /* sizes_management */ /* header_file_macros */ /* */ /***************************************************************************/ /***************************************************************************/ /* */ /* <Chapter> */ /* format_specific */ /* */ /* <Title> */ /* Format-Specific API */ /* */ /* <Sections> */ /* multiple_masters */ /* truetype_tables */ /* type1_tables */ /* sfnt_names */ /* bdf_fonts */ /* cid_fonts */ /* pfr_fonts */ /* winfnt_fonts */ /* font_formats */ /* gasp_table */ /* */ /***************************************************************************/ /***************************************************************************/ /* */ /* <Chapter> */ /* module_specific */ /* */ /* <Title> */ /* Controlling FreeType Modules */ /* */ /* <Sections> */ /* auto_hinter */ /* cff_driver */ /* tt_driver */ /* pcf_driver */ /* */ /***************************************************************************/ /***************************************************************************/ /* */ /* <Chapter> */ /* cache_subsystem */ /* */ /* <Title> */ /* Cache Sub-System */ /* */ /* <Sections> */ /* cache_subsystem */ /* */ /***************************************************************************/ /***************************************************************************/ /* */ /* <Chapter> */ /* support_api */ /* */ /* <Title> */ /* Support API */ /* */ /* <Sections> */ /* computations */ /* list_processing */ /* outline_processing */ /* quick_advance */ /* bitmap_handling */ /* raster */ /* glyph_stroker */ /* system_interface */ /* module_management */ /* gzip */ /* lzw */ /* bzip2 */ /* lcd_filtering */ /* */ /***************************************************************************/ /***************************************************************************/ /* */ /* <Chapter> */ /* error_codes */ /* */ /* <Title> */ /* Error Codes */ /* */ /* <Sections> */ /* error_enumerations */ /* error_code_values */ /* */ /***************************************************************************/ �������������������������������������������������������������������������������������������������������������������������freetype2/freetype/config/ftoption.h����������������������������������������������������������������0000644�����������������00000172373�14763166026�0013604 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftoption.h */ /* */ /* User-selectable configuration macros (specification only). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTOPTION_H_ #define FTOPTION_H_ #include <ft2build.h> FT_BEGIN_HEADER /*************************************************************************/ /* */ /* USER-SELECTABLE CONFIGURATION MACROS */ /* */ /* This file contains the default configuration macro definitions for */ /* a standard build of the FreeType library. There are three ways to */ /* use this file to build project-specific versions of the library: */ /* */ /* - You can modify this file by hand, but this is not recommended in */ /* cases where you would like to build several versions of the */ /* library from a single source directory. */ /* */ /* - You can put a copy of this file in your build directory, more */ /* precisely in `$BUILD/freetype/config/ftoption.h', where `$BUILD' */ /* is the name of a directory that is included _before_ the FreeType */ /* include path during compilation. */ /* */ /* The default FreeType Makefiles and Jamfiles use the build */ /* directory `builds/<system>' by default, but you can easily change */ /* that for your own projects. */ /* */ /* - Copy the file <ft2build.h> to `$BUILD/ft2build.h' and modify it */ /* slightly to pre-define the macro FT_CONFIG_OPTIONS_H used to */ /* locate this file during the build. For example, */ /* */ /* #define FT_CONFIG_OPTIONS_H <myftoptions.h> */ /* #include <freetype/config/ftheader.h> */ /* */ /* will use `$BUILD/myftoptions.h' instead of this file for macro */ /* definitions. */ /* */ /* Note also that you can similarly pre-define the macro */ /* FT_CONFIG_MODULES_H used to locate the file listing of the modules */ /* that are statically linked to the library at compile time. By */ /* default, this file is <freetype/config/ftmodule.h>. */ /* */ /* We highly recommend using the third method whenever possible. */ /* */ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* If you enable this configuration option, FreeType recognizes an */ /* environment variable called `FREETYPE_PROPERTIES', which can be used */ /* to control the various font drivers and modules. The controllable */ /* properties are listed in the section `Controlling FreeType Modules' */ /* in the reference's table of contents; currently there are properties */ /* for the auto-hinter (file `ftautoh.h'), CFF (file `ftcffdrv.h'), */ /* TrueType (file `ftttdrv.h'), and PCF (file `ftpcfdrv.h'). */ /* */ /* `FREETYPE_PROPERTIES' has the following syntax form (broken here into */ /* multiple lines for better readability). */ /* */ /* <optional whitespace> */ /* <module-name1> ':' */ /* <property-name1> '=' <property-value1> */ /* <whitespace> */ /* <module-name2> ':' */ /* <property-name2> '=' <property-value2> */ /* ... */ /* */ /* Example: */ /* */ /* FREETYPE_PROPERTIES=truetype:interpreter-version=35 \ */ /* cff:no-stem-darkening=1 \ */ /* autofitter:warping=1 */ /* */ #define FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES /*************************************************************************/ /* */ /* Uncomment the line below if you want to activate sub-pixel rendering */ /* (a.k.a. LCD rendering, or ClearType) in this build of the library. */ /* */ /* Note that this feature is covered by several Microsoft patents */ /* and should not be activated in any default build of the library. */ /* */ /* This macro has no impact on the FreeType API, only on its */ /* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */ /* FT_Render_Glyph still generates a bitmap that is 3 times wider than */ /* the original size in case this macro isn't defined; however, each */ /* triplet of subpixels has R=G=B. */ /* */ /* This is done to allow FreeType clients to run unmodified, forcing */ /* them to display normal gray-level anti-aliased glyphs. */ /* */ /* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ /*************************************************************************/ /* */ /* Many compilers provide a non-ANSI 64-bit data type that can be used */ /* by FreeType to speed up some computations. However, this will create */ /* some problems when compiling the library in strict ANSI mode. */ /* */ /* For this reason, the use of 64-bit integers is normally disabled when */ /* the __STDC__ macro is defined. You can however disable this by */ /* defining the macro FT_CONFIG_OPTION_FORCE_INT64 here. */ /* */ /* For most compilers, this will only create compilation warnings when */ /* building the library. */ /* */ /* ObNote: The compiler-specific 64-bit integers are detected in the */ /* file `ftconfig.h' either statically or through the */ /* `configure' script on supported platforms. */ /* */ #undef FT_CONFIG_OPTION_FORCE_INT64 /*************************************************************************/ /* */ /* If this macro is defined, do not try to use an assembler version of */ /* performance-critical functions (e.g. FT_MulFix). You should only do */ /* that to verify that the assembler function works properly, or to */ /* execute benchmark tests of the various implementations. */ /* #define FT_CONFIG_OPTION_NO_ASSEMBLER */ /*************************************************************************/ /* */ /* If this macro is defined, try to use an inlined assembler version of */ /* the `FT_MulFix' function, which is a `hotspot' when loading and */ /* hinting glyphs, and which should be executed as fast as possible. */ /* */ /* Note that if your compiler or CPU is not supported, this will default */ /* to the standard and portable implementation found in `ftcalc.c'. */ /* */ #define FT_CONFIG_OPTION_INLINE_MULFIX /*************************************************************************/ /* */ /* LZW-compressed file support. */ /* */ /* FreeType now handles font files that have been compressed with the */ /* `compress' program. This is mostly used to parse many of the PCF */ /* files that come with various X11 distributions. The implementation */ /* uses NetBSD's `zopen' to partially uncompress the file on the fly */ /* (see src/lzw/ftgzip.c). */ /* */ /* Define this macro if you want to enable this `feature'. */ /* */ #define FT_CONFIG_OPTION_USE_LZW /*************************************************************************/ /* */ /* Gzip-compressed file support. */ /* */ /* FreeType now handles font files that have been compressed with the */ /* `gzip' program. This is mostly used to parse many of the PCF files */ /* that come with XFree86. The implementation uses `zlib' to */ /* partially uncompress the file on the fly (see src/gzip/ftgzip.c). */ /* */ /* Define this macro if you want to enable this `feature'. See also */ /* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */ /* */ #define FT_CONFIG_OPTION_USE_ZLIB /*************************************************************************/ /* */ /* ZLib library selection */ /* */ /* This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined. */ /* It allows FreeType's `ftgzip' component to link to the system's */ /* installation of the ZLib library. This is useful on systems like */ /* Unix or VMS where it generally is already available. */ /* */ /* If you let it undefined, the component will use its own copy */ /* of the zlib sources instead. These have been modified to be */ /* included directly within the component and *not* export external */ /* function names. This allows you to link any program with FreeType */ /* _and_ ZLib without linking conflicts. */ /* */ /* Do not #undef this macro here since the build system might define */ /* it for certain configurations only. */ /* */ /* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */ /*************************************************************************/ /* */ /* Bzip2-compressed file support. */ /* */ /* FreeType now handles font files that have been compressed with the */ /* `bzip2' program. This is mostly used to parse many of the PCF */ /* files that come with XFree86. The implementation uses `libbz2' to */ /* partially uncompress the file on the fly (see src/bzip2/ftbzip2.c). */ /* Contrary to gzip, bzip2 currently is not included and need to use */ /* the system available bzip2 implementation. */ /* */ /* Define this macro if you want to enable this `feature'. */ /* */ /* #define FT_CONFIG_OPTION_USE_BZIP2 */ /*************************************************************************/ /* */ /* Define to disable the use of file stream functions and types, FILE, */ /* fopen() etc. Enables the use of smaller system libraries on embedded */ /* systems that have multiple system libraries, some with or without */ /* file stream support, in the cases where file stream support is not */ /* necessary such as memory loading of font files. */ /* */ /* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */ /*************************************************************************/ /* */ /* PNG bitmap support. */ /* */ /* FreeType now handles loading color bitmap glyphs in the PNG format. */ /* This requires help from the external libpng library. Uncompressed */ /* color bitmaps do not need any external libraries and will be */ /* supported regardless of this configuration. */ /* */ /* Define this macro if you want to enable this `feature'. */ /* */ /* #define FT_CONFIG_OPTION_USE_PNG */ /*************************************************************************/ /* */ /* HarfBuzz support. */ /* */ /* FreeType uses the HarfBuzz library to improve auto-hinting of */ /* OpenType fonts. If available, many glyphs not directly addressable */ /* by a font's character map will be hinted also. */ /* */ /* Define this macro if you want to enable this `feature'. */ /* */ /* #define FT_CONFIG_OPTION_USE_HARFBUZZ */ /*************************************************************************/ /* */ /* DLL export compilation */ /* */ /* When compiling FreeType as a DLL, some systems/compilers need a */ /* special keyword in front OR after the return type of function */ /* declarations. */ /* */ /* Two macros are used within the FreeType source code to define */ /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ /* */ /* FT_EXPORT( return_type ) */ /* */ /* is used in a function declaration, as in */ /* */ /* FT_EXPORT( FT_Error ) */ /* FT_Init_FreeType( FT_Library* alibrary ); */ /* */ /* */ /* FT_EXPORT_DEF( return_type ) */ /* */ /* is used in a function definition, as in */ /* */ /* FT_EXPORT_DEF( FT_Error ) */ /* FT_Init_FreeType( FT_Library* alibrary ) */ /* { */ /* ... some code ... */ /* return FT_Err_Ok; */ /* } */ /* */ /* You can provide your own implementation of FT_EXPORT and */ /* FT_EXPORT_DEF here if you want. If you leave them undefined, they */ /* will be later automatically defined as `extern return_type' to */ /* allow normal compilation. */ /* */ /* Do not #undef these macros here since the build system might define */ /* them for certain configurations only. */ /* */ /* #define FT_EXPORT(x) extern x */ /* #define FT_EXPORT_DEF(x) x */ /*************************************************************************/ /* */ /* Glyph Postscript Names handling */ /* */ /* By default, FreeType 2 is compiled with the `psnames' module. This */ /* module is in charge of converting a glyph name string into a */ /* Unicode value, or return a Macintosh standard glyph name for the */ /* use with the TrueType `post' table. */ /* */ /* Undefine this macro if you do not want `psnames' compiled in your */ /* build of FreeType. This has the following effects: */ /* */ /* - The TrueType driver will provide its own set of glyph names, */ /* if you build it to support postscript names in the TrueType */ /* `post' table. */ /* */ /* - The Type 1 driver will not be able to synthesize a Unicode */ /* charmap out of the glyphs found in the fonts. */ /* */ /* You would normally undefine this configuration macro when building */ /* a version of FreeType that doesn't contain a Type 1 or CFF driver. */ /* */ #define FT_CONFIG_OPTION_POSTSCRIPT_NAMES /*************************************************************************/ /* */ /* Postscript Names to Unicode Values support */ /* */ /* By default, FreeType 2 is built with the `PSNames' module compiled */ /* in. Among other things, the module is used to convert a glyph name */ /* into a Unicode value. This is especially useful in order to */ /* synthesize on the fly a Unicode charmap from the CFF/Type 1 driver */ /* through a big table named the `Adobe Glyph List' (AGL). */ /* */ /* Undefine this macro if you do not want the Adobe Glyph List */ /* compiled in your `PSNames' module. The Type 1 driver will not be */ /* able to synthesize a Unicode charmap out of the glyphs found in the */ /* fonts. */ /* */ #define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST /*************************************************************************/ /* */ /* Support for Mac fonts */ /* */ /* Define this macro if you want support for outline fonts in Mac */ /* format (mac dfont, mac resource, macbinary containing a mac */ /* resource) on non-Mac platforms. */ /* */ /* Note that the `FOND' resource isn't checked. */ /* */ #define FT_CONFIG_OPTION_MAC_FONTS /*************************************************************************/ /* */ /* Guessing methods to access embedded resource forks */ /* */ /* Enable extra Mac fonts support on non-Mac platforms (e.g. */ /* GNU/Linux). */ /* */ /* Resource forks which include fonts data are stored sometimes in */ /* locations which users or developers don't expected. In some cases, */ /* resource forks start with some offset from the head of a file. In */ /* other cases, the actual resource fork is stored in file different */ /* from what the user specifies. If this option is activated, */ /* FreeType tries to guess whether such offsets or different file */ /* names must be used. */ /* */ /* Note that normal, direct access of resource forks is controlled via */ /* the FT_CONFIG_OPTION_MAC_FONTS option. */ /* */ #ifdef FT_CONFIG_OPTION_MAC_FONTS #define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK #endif /*************************************************************************/ /* */ /* Allow the use of FT_Incremental_Interface to load typefaces that */ /* contain no glyph data, but supply it via a callback function. */ /* This is required by clients supporting document formats which */ /* supply font data incrementally as the document is parsed, such */ /* as the Ghostscript interpreter for the PostScript language. */ /* */ #define FT_CONFIG_OPTION_INCREMENTAL /*************************************************************************/ /* */ /* The size in bytes of the render pool used by the scan-line converter */ /* to do all of its work. */ /* */ #define FT_RENDER_POOL_SIZE 16384L /*************************************************************************/ /* */ /* FT_MAX_MODULES */ /* */ /* The maximum number of modules that can be registered in a single */ /* FreeType library object. 32 is the default. */ /* */ #define FT_MAX_MODULES 32 /*************************************************************************/ /* */ /* Debug level */ /* */ /* FreeType can be compiled in debug or trace mode. In debug mode, */ /* errors are reported through the `ftdebug' component. In trace */ /* mode, additional messages are sent to the standard output during */ /* execution. */ /* */ /* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */ /* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */ /* */ /* Don't define any of these macros to compile in `release' mode! */ /* */ /* Do not #undef these macros here since the build system might define */ /* them for certain configurations only. */ /* */ /* #define FT_DEBUG_LEVEL_ERROR */ /* #define FT_DEBUG_LEVEL_TRACE */ /*************************************************************************/ /* */ /* Autofitter debugging */ /* */ /* If FT_DEBUG_AUTOFIT is defined, FreeType provides some means to */ /* control the autofitter behaviour for debugging purposes with global */ /* boolean variables (consequently, you should *never* enable this */ /* while compiling in `release' mode): */ /* */ /* _af_debug_disable_horz_hints */ /* _af_debug_disable_vert_hints */ /* _af_debug_disable_blue_hints */ /* */ /* Additionally, the following functions provide dumps of various */ /* internal autofit structures to stdout (using `printf'): */ /* */ /* af_glyph_hints_dump_points */ /* af_glyph_hints_dump_segments */ /* af_glyph_hints_dump_edges */ /* af_glyph_hints_get_num_segments */ /* af_glyph_hints_get_segment_offset */ /* */ /* As an argument, they use another global variable: */ /* */ /* _af_debug_hints */ /* */ /* Please have a look at the `ftgrid' demo program to see how those */ /* variables and macros should be used. */ /* */ /* Do not #undef these macros here since the build system might define */ /* them for certain configurations only. */ /* */ /* #define FT_DEBUG_AUTOFIT */ /*************************************************************************/ /* */ /* Memory Debugging */ /* */ /* FreeType now comes with an integrated memory debugger that is */ /* capable of detecting simple errors like memory leaks or double */ /* deletes. To compile it within your build of the library, you */ /* should define FT_DEBUG_MEMORY here. */ /* */ /* Note that the memory debugger is only activated at runtime when */ /* when the _environment_ variable `FT2_DEBUG_MEMORY' is defined also! */ /* */ /* Do not #undef this macro here since the build system might define */ /* it for certain configurations only. */ /* */ /* #define FT_DEBUG_MEMORY */ /*************************************************************************/ /* */ /* Module errors */ /* */ /* If this macro is set (which is _not_ the default), the higher byte */ /* of an error code gives the module in which the error has occurred, */ /* while the lower byte is the real error code. */ /* */ /* Setting this macro makes sense for debugging purposes only, since */ /* it would break source compatibility of certain programs that use */ /* FreeType 2. */ /* */ /* More details can be found in the files ftmoderr.h and fterrors.h. */ /* */ #undef FT_CONFIG_OPTION_USE_MODULE_ERRORS /*************************************************************************/ /* */ /* Position Independent Code */ /* */ /* If this macro is set (which is _not_ the default), FreeType2 will */ /* avoid creating constants that require address fixups. Instead the */ /* constants will be moved into a struct and additional intialization */ /* code will be used. */ /* */ /* Setting this macro is needed for systems that prohibit address */ /* fixups, such as BREW. [Note that standard compilers like gcc or */ /* clang handle PIC generation automatically; you don't have to set */ /* FT_CONFIG_OPTION_PIC, which is only necessary for very special */ /* compilers.] */ /* */ /* Note that FT_CONFIG_OPTION_PIC support is not available for all */ /* modules (see `modules.cfg' for a complete list). For building with */ /* FT_CONFIG_OPTION_PIC support, do the following. */ /* */ /* 0. Clone the repository. */ /* 1. Define FT_CONFIG_OPTION_PIC. */ /* 2. Remove all subdirectories in `src' that don't have */ /* FT_CONFIG_OPTION_PIC support. */ /* 3. Comment out the corresponding modules in `modules.cfg'. */ /* 4. Compile. */ /* */ /* #define FT_CONFIG_OPTION_PIC */ /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** S F N T D R I V E R C O N F I G U R A T I O N ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* Define TT_CONFIG_OPTION_EMBEDDED_BITMAPS if you want to support */ /* embedded bitmaps in all formats using the SFNT module (namely */ /* TrueType & OpenType). */ /* */ #define TT_CONFIG_OPTION_EMBEDDED_BITMAPS /*************************************************************************/ /* */ /* Define TT_CONFIG_OPTION_POSTSCRIPT_NAMES if you want to be able to */ /* load and enumerate the glyph Postscript names in a TrueType or */ /* OpenType file. */ /* */ /* Note that when you do not compile the `PSNames' module by undefining */ /* the above FT_CONFIG_OPTION_POSTSCRIPT_NAMES, the `sfnt' module will */ /* contain additional code used to read the PS Names table from a font. */ /* */ /* (By default, the module uses `PSNames' to extract glyph names.) */ /* */ #define TT_CONFIG_OPTION_POSTSCRIPT_NAMES /*************************************************************************/ /* */ /* Define TT_CONFIG_OPTION_SFNT_NAMES if your applications need to */ /* access the internal name table in a SFNT-based format like TrueType */ /* or OpenType. The name table contains various strings used to */ /* describe the font, like family name, copyright, version, etc. It */ /* does not contain any glyph name though. */ /* */ /* Accessing SFNT names is done through the functions declared in */ /* `ftsnames.h'. */ /* */ #define TT_CONFIG_OPTION_SFNT_NAMES /*************************************************************************/ /* */ /* TrueType CMap support */ /* */ /* Here you can fine-tune which TrueType CMap table format shall be */ /* supported. */ #define TT_CONFIG_CMAP_FORMAT_0 #define TT_CONFIG_CMAP_FORMAT_2 #define TT_CONFIG_CMAP_FORMAT_4 #define TT_CONFIG_CMAP_FORMAT_6 #define TT_CONFIG_CMAP_FORMAT_8 #define TT_CONFIG_CMAP_FORMAT_10 #define TT_CONFIG_CMAP_FORMAT_12 #define TT_CONFIG_CMAP_FORMAT_13 #define TT_CONFIG_CMAP_FORMAT_14 /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile */ /* a bytecode interpreter in the TrueType driver. */ /* */ /* By undefining this, you will only compile the code necessary to load */ /* TrueType glyphs without hinting. */ /* */ /* Do not #undef this macro here, since the build system might */ /* define it for certain configurations only. */ /* */ #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER /*************************************************************************/ /* */ /* Define TT_CONFIG_OPTION_SUBPIXEL_HINTING if you want to compile */ /* subpixel hinting support into the TrueType driver. This modifies the */ /* TrueType hinting mechanism when anything but FT_RENDER_MODE_MONO is */ /* requested. */ /* */ /* In particular, it modifies the bytecode interpreter to interpret (or */ /* not) instructions in a certain way so that all TrueType fonts look */ /* like they do in a Windows ClearType (DirectWrite) environment. See */ /* [1] for a technical overview on what this means. See `ttinterp.h' */ /* for more details on the LEAN option. */ /* */ /* There are three possible values. */ /* */ /* Value 1: */ /* This value is associated with the `Infinality' moniker, */ /* contributed by an individual nicknamed Infinality with the goal of */ /* making TrueType fonts render better than on Windows. A high */ /* amount of configurability and flexibility, down to rules for */ /* single glyphs in fonts, but also very slow. Its experimental and */ /* slow nature and the original developer losing interest meant that */ /* this option was never enabled in default builds. */ /* */ /* The corresponding interpreter version is v38. */ /* */ /* Value 2: */ /* The new default mode for the TrueType driver. The Infinality code */ /* base was stripped to the bare minimum and all configurability */ /* removed in the name of speed and simplicity. The configurability */ /* was mainly aimed at legacy fonts like Arial, Times New Roman, or */ /* Courier. Legacy fonts are fonts that modify vertical stems to */ /* achieve clean black-and-white bitmaps. The new mode focuses on */ /* applying a minimal set of rules to all fonts indiscriminately so */ /* that modern and web fonts render well while legacy fonts render */ /* okay. */ /* */ /* The corresponding interpreter version is v40. */ /* */ /* Value 3: */ /* Compile both, making both v38 and v40 available (the latter is the */ /* default). */ /* */ /* By undefining these, you get rendering behavior like on Windows */ /* without ClearType, i.e., Windows XP without ClearType enabled and */ /* Win9x (interpreter version v35). Or not, depending on how much */ /* hinting blood and testing tears the font designer put into a given */ /* font. If you define one or both subpixel hinting options, you can */ /* switch between between v35 and the ones you define (using */ /* `FT_Property_Set'). */ /* */ /* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */ /* defined. */ /* */ /* [1] http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ /* */ /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */ #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2 /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) */ /*************************************************************************/ /* */ /* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the */ /* TrueType glyph loader to use Apple's definition of how to handle */ /* component offsets in composite glyphs. */ /* */ /* Apple and MS disagree on the default behavior of component offsets */ /* in composites. Apple says that they should be scaled by the scaling */ /* factors in the transformation matrix (roughly, it's more complex) */ /* while MS says they should not. OpenType defines two bits in the */ /* composite flags array which can be used to disambiguate, but old */ /* fonts will not have them. */ /* */ /* http://www.microsoft.com/typography/otspec/glyf.htm */ /* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html */ /* */ #undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED /*************************************************************************/ /* */ /* Define TT_CONFIG_OPTION_GX_VAR_SUPPORT if you want to include */ /* support for Apple's distortable font technology (fvar, gvar, cvar, */ /* and avar tables). This has many similarities to Type 1 Multiple */ /* Masters support. */ /* */ #define TT_CONFIG_OPTION_GX_VAR_SUPPORT /*************************************************************************/ /* */ /* Define TT_CONFIG_OPTION_BDF if you want to include support for */ /* an embedded `BDF ' table within SFNT-based bitmap formats. */ /* */ #define TT_CONFIG_OPTION_BDF /*************************************************************************/ /* */ /* Option TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES controls the maximum */ /* number of bytecode instructions executed for a single run of the */ /* bytecode interpreter, needed to prevent infinite loops. You don't */ /* want to change this except for very special situations (e.g., making */ /* a library fuzzer spend less time to handle broken fonts). */ /* */ /* It is not expected that this value is ever modified by a configuring */ /* script; instead, it gets surrounded with #ifndef ... #endif so that */ /* the value can be set as a preprocessor option on the compiler's */ /* command line. */ /* */ #ifndef TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES #define TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES 1000000L #endif /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* T1_MAX_DICT_DEPTH is the maximum depth of nest dictionaries and */ /* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */ /* required. */ /* */ #define T1_MAX_DICT_DEPTH 5 /*************************************************************************/ /* */ /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */ /* calls during glyph loading. */ /* */ #define T1_MAX_SUBRS_CALLS 16 /*************************************************************************/ /* */ /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */ /* minimum of 16 is required. */ /* */ /* The Chinese font MingTiEG-Medium (CNS 11643 character set) needs 256. */ /* */ #define T1_MAX_CHARSTRINGS_OPERANDS 256 /*************************************************************************/ /* */ /* Define this configuration macro if you want to prevent the */ /* compilation of `t1afm', which is in charge of reading Type 1 AFM */ /* files into an existing face. Note that if set, the T1 driver will be */ /* unable to produce kerning distances. */ /* */ #undef T1_CONFIG_OPTION_NO_AFM /*************************************************************************/ /* */ /* Define this configuration macro if you want to prevent the */ /* compilation of the Multiple Masters font support in the Type 1 */ /* driver. */ /* */ #undef T1_CONFIG_OPTION_NO_MM_SUPPORT /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** C F F D R I V E R C O N F I G U R A T I O N ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* Using CFF_CONFIG_OPTION_DARKENING_PARAMETER_{X,Y}{1,2,3,4} it is */ /* possible to set up the default values of the four control points that */ /* define the stem darkening behaviour of the (new) CFF engine. For */ /* more details please read the documentation of the */ /* `darkening-parameters' property of the cff driver module (file */ /* `ftcffdrv.h'), which allows the control at run-time. */ /* */ /* Do *not* undefine these macros! */ /* */ #define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 500 #define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 400 #define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 1000 #define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 275 #define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 1667 #define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 275 #define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 2333 #define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 0 /*************************************************************************/ /* */ /* CFF_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe CFF */ /* engine gets compiled into FreeType. If defined, it is possible to */ /* switch between the two engines using the `hinting-engine' property of */ /* the cff driver module. */ /* */ /* #define CFF_CONFIG_OPTION_OLD_ENGINE */ /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** P C F D R I V E R C O N F I G U R A T I O N ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* There are many PCF fonts just called `Fixed' which look completely */ /* different, and which have nothing to do with each other. When */ /* selecting `Fixed' in KDE or Gnome one gets results that appear rather */ /* random, the style changes often if one changes the size and one */ /* cannot select some fonts at all. This option makes the PCF module */ /* prepend the foundry name (plus a space) to the family name. */ /* */ /* We also check whether we have `wide' characters; all put together, we */ /* get family names like `Sony Fixed' or `Misc Fixed Wide'. */ /* */ /* If this option is activated, it can be controlled with the */ /* `no-long-family-names' property of the pcf driver module. */ /* */ /* #define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */ /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* Compile autofit module with CJK (Chinese, Japanese, Korean) script */ /* support. */ /* */ #define AF_CONFIG_OPTION_CJK /*************************************************************************/ /* */ /* Compile autofit module with fallback Indic script support, covering */ /* some scripts that the `latin' submodule of the autofit module doesn't */ /* (yet) handle. */ /* */ #define AF_CONFIG_OPTION_INDIC /*************************************************************************/ /* */ /* Compile autofit module with warp hinting. The idea of the warping */ /* code is to slightly scale and shift a glyph within a single dimension */ /* so that as much of its segments are aligned (more or less) on the */ /* grid. To find out the optimal scaling and shifting value, various */ /* parameter combinations are tried and scored. */ /* */ /* This experimental option is active only if the rendering mode is */ /* FT_RENDER_MODE_LIGHT; you can switch warping on and off with the */ /* `warping' property of the auto-hinter (see file `ftautoh.h' for more */ /* information; by default it is switched off). */ /* */ #define AF_CONFIG_OPTION_USE_WARPER /*************************************************************************/ /* */ /* Use TrueType-like size metrics for `light' auto-hinting. */ /* */ /* It is strongly recommended to avoid this option, which exists only to */ /* help some legacy applications retain its appearance and behaviour */ /* with respect to auto-hinted TrueType fonts. */ /* */ /* The very reason this option exists at all are GNU/Linux distributions */ /* like Fedora that did not un-patch the following change (which was */ /* present in FreeType between versions 2.4.6 and 2.7.1, inclusive). */ /* */ /* 2011-07-16 Steven Chu <steven.f.chu@gmail.com> */ /* */ /* [truetype] Fix metrics on size request for scalable fonts. */ /* */ /* This problematic commit is now reverted (more or less). */ /* */ /* #define AF_CONFIG_OPTION_TT_SIZE_METRICS */ /* */ /* * This macro is obsolete. Support has been removed in FreeType * version 2.5. */ #define FT_CONFIG_OPTION_OLD_INTERNALS /* * This macro is defined if native TrueType hinting is requested by the * definitions above. */ #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #define TT_USE_BYTECODE_INTERPRETER #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING #if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 1 #define TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY #endif #if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 2 #define TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL #endif #endif #endif /* * Check CFF darkening parameters. The checks are the same as in function * `cff_property_set' in file `cffdrivr.c'. */ #if CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 < 0 || \ CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 < 0 || \ CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 < 0 || \ CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 < 0 || \ \ CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 < 0 || \ CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 < 0 || \ CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 < 0 || \ CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 < 0 || \ \ CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 > \ CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 || \ CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 > \ CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 || \ CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 > \ CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 || \ \ CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 > 500 || \ CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 > 500 || \ CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 > 500 || \ CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 > 500 #error "Invalid CFF darkening parameters!" #endif FT_END_HEADER #endif /* FTOPTION_H_ */ /* END */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/config/ftheader.h����������������������������������������������������������������0000644�����������������00000063333�14763166026�0013517 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftheader.h */ /* */ /* Build macros of the FreeType 2 library. */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTHEADER_H_ #define FTHEADER_H_ /*@***********************************************************************/ /* */ /* <Macro> */ /* FT_BEGIN_HEADER */ /* */ /* <Description> */ /* This macro is used in association with @FT_END_HEADER in header */ /* files to ensure that the declarations within are properly */ /* encapsulated in an `extern "C" { .. }' block when included from a */ /* C++ compiler. */ /* */ #ifdef __cplusplus #define FT_BEGIN_HEADER extern "C" { #else #define FT_BEGIN_HEADER /* nothing */ #endif /*@***********************************************************************/ /* */ /* <Macro> */ /* FT_END_HEADER */ /* */ /* <Description> */ /* This macro is used in association with @FT_BEGIN_HEADER in header */ /* files to ensure that the declarations within are properly */ /* encapsulated in an `extern "C" { .. }' block when included from a */ /* C++ compiler. */ /* */ #ifdef __cplusplus #define FT_END_HEADER } #else #define FT_END_HEADER /* nothing */ #endif /*************************************************************************/ /* */ /* Aliases for the FreeType 2 public and configuration files. */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Section> */ /* header_file_macros */ /* */ /* <Title> */ /* Header File Macros */ /* */ /* <Abstract> */ /* Macro definitions used to #include specific header files. */ /* */ /* <Description> */ /* The following macros are defined to the name of specific */ /* FreeType~2 header files. They can be used directly in #include */ /* statements as in: */ /* */ /* { */ /* #include FT_FREETYPE_H */ /* #include FT_MULTIPLE_MASTERS_H */ /* #include FT_GLYPH_H */ /* } */ /* */ /* There are several reasons why we are now using macros to name */ /* public header files. The first one is that such macros are not */ /* limited to the infamous 8.3~naming rule required by DOS (and */ /* `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h'). */ /* */ /* The second reason is that it allows for more flexibility in the */ /* way FreeType~2 is installed on a given system. */ /* */ /*************************************************************************/ /* configuration files */ /************************************************************************* * * @macro: * FT_CONFIG_CONFIG_H * * @description: * A macro used in #include statements to name the file containing * FreeType~2 configuration data. * */ #ifndef FT_CONFIG_CONFIG_H #define FT_CONFIG_CONFIG_H <freetype/config/ftconfig.h> #endif /************************************************************************* * * @macro: * FT_CONFIG_STANDARD_LIBRARY_H * * @description: * A macro used in #include statements to name the file containing * FreeType~2 interface to the standard C library functions. * */ #ifndef FT_CONFIG_STANDARD_LIBRARY_H #define FT_CONFIG_STANDARD_LIBRARY_H <freetype/config/ftstdlib.h> #endif /************************************************************************* * * @macro: * FT_CONFIG_OPTIONS_H * * @description: * A macro used in #include statements to name the file containing * FreeType~2 project-specific configuration options. * */ #ifndef FT_CONFIG_OPTIONS_H #define FT_CONFIG_OPTIONS_H <freetype/config/ftoption.h> #endif /************************************************************************* * * @macro: * FT_CONFIG_MODULES_H * * @description: * A macro used in #include statements to name the file containing the * list of FreeType~2 modules that are statically linked to new library * instances in @FT_Init_FreeType. * */ #ifndef FT_CONFIG_MODULES_H #define FT_CONFIG_MODULES_H <freetype/config/ftmodule.h> #endif /* */ /* public headers */ /************************************************************************* * * @macro: * FT_FREETYPE_H * * @description: * A macro used in #include statements to name the file containing the * base FreeType~2 API. * */ #define FT_FREETYPE_H <freetype/freetype.h> /************************************************************************* * * @macro: * FT_ERRORS_H * * @description: * A macro used in #include statements to name the file containing the * list of FreeType~2 error codes (and messages). * * It is included by @FT_FREETYPE_H. * */ #define FT_ERRORS_H <freetype/fterrors.h> /************************************************************************* * * @macro: * FT_MODULE_ERRORS_H * * @description: * A macro used in #include statements to name the file containing the * list of FreeType~2 module error offsets (and messages). * */ #define FT_MODULE_ERRORS_H <freetype/ftmoderr.h> /************************************************************************* * * @macro: * FT_SYSTEM_H * * @description: * A macro used in #include statements to name the file containing the * FreeType~2 interface to low-level operations (i.e., memory management * and stream i/o). * * It is included by @FT_FREETYPE_H. * */ #define FT_SYSTEM_H <freetype/ftsystem.h> /************************************************************************* * * @macro: * FT_IMAGE_H * * @description: * A macro used in #include statements to name the file containing type * definitions related to glyph images (i.e., bitmaps, outlines, * scan-converter parameters). * * It is included by @FT_FREETYPE_H. * */ #define FT_IMAGE_H <freetype/ftimage.h> /************************************************************************* * * @macro: * FT_TYPES_H * * @description: * A macro used in #include statements to name the file containing the * basic data types defined by FreeType~2. * * It is included by @FT_FREETYPE_H. * */ #define FT_TYPES_H <freetype/fttypes.h> /************************************************************************* * * @macro: * FT_LIST_H * * @description: * A macro used in #include statements to name the file containing the * list management API of FreeType~2. * * (Most applications will never need to include this file.) * */ #define FT_LIST_H <freetype/ftlist.h> /************************************************************************* * * @macro: * FT_OUTLINE_H * * @description: * A macro used in #include statements to name the file containing the * scalable outline management API of FreeType~2. * */ #define FT_OUTLINE_H <freetype/ftoutln.h> /************************************************************************* * * @macro: * FT_SIZES_H * * @description: * A macro used in #include statements to name the file containing the * API which manages multiple @FT_Size objects per face. * */ #define FT_SIZES_H <freetype/ftsizes.h> /************************************************************************* * * @macro: * FT_MODULE_H * * @description: * A macro used in #include statements to name the file containing the * module management API of FreeType~2. * */ #define FT_MODULE_H <freetype/ftmodapi.h> /************************************************************************* * * @macro: * FT_RENDER_H * * @description: * A macro used in #include statements to name the file containing the * renderer module management API of FreeType~2. * */ #define FT_RENDER_H <freetype/ftrender.h> /************************************************************************* * * @macro: * FT_AUTOHINTER_H * * @description: * A macro used in #include statements to name the file containing * structures and macros related to the auto-hinting module. * */ #define FT_AUTOHINTER_H <freetype/ftautoh.h> /************************************************************************* * * @macro: * FT_CFF_DRIVER_H * * @description: * A macro used in #include statements to name the file containing * structures and macros related to the CFF driver module. * */ #define FT_CFF_DRIVER_H <freetype/ftcffdrv.h> /************************************************************************* * * @macro: * FT_TRUETYPE_DRIVER_H * * @description: * A macro used in #include statements to name the file containing * structures and macros related to the TrueType driver module. * */ #define FT_TRUETYPE_DRIVER_H <freetype/ftttdrv.h> /************************************************************************* * * @macro: * FT_PCF_DRIVER_H * * @description: * A macro used in #include statements to name the file containing * structures and macros related to the PCF driver module. * */ #define FT_PCF_DRIVER_H <freetype/ftpcfdrv.h> /************************************************************************* * * @macro: * FT_TYPE1_TABLES_H * * @description: * A macro used in #include statements to name the file containing the * types and API specific to the Type~1 format. * */ #define FT_TYPE1_TABLES_H <freetype/t1tables.h> /************************************************************************* * * @macro: * FT_TRUETYPE_IDS_H * * @description: * A macro used in #include statements to name the file containing the * enumeration values which identify name strings, languages, encodings, * etc. This file really contains a _large_ set of constant macro * definitions, taken from the TrueType and OpenType specifications. * */ #define FT_TRUETYPE_IDS_H <freetype/ttnameid.h> /************************************************************************* * * @macro: * FT_TRUETYPE_TABLES_H * * @description: * A macro used in #include statements to name the file containing the * types and API specific to the TrueType (as well as OpenType) format. * */ #define FT_TRUETYPE_TABLES_H <freetype/tttables.h> /************************************************************************* * * @macro: * FT_TRUETYPE_TAGS_H * * @description: * A macro used in #include statements to name the file containing the * definitions of TrueType four-byte `tags' which identify blocks in * SFNT-based font formats (i.e., TrueType and OpenType). * */ #define FT_TRUETYPE_TAGS_H <freetype/tttags.h> /************************************************************************* * * @macro: * FT_BDF_H * * @description: * A macro used in #include statements to name the file containing the * definitions of an API which accesses BDF-specific strings from a * face. * */ #define FT_BDF_H <freetype/ftbdf.h> /************************************************************************* * * @macro: * FT_CID_H * * @description: * A macro used in #include statements to name the file containing the * definitions of an API which access CID font information from a * face. * */ #define FT_CID_H <freetype/ftcid.h> /************************************************************************* * * @macro: * FT_GZIP_H * * @description: * A macro used in #include statements to name the file containing the * definitions of an API which supports gzip-compressed files. * */ #define FT_GZIP_H <freetype/ftgzip.h> /************************************************************************* * * @macro: * FT_LZW_H * * @description: * A macro used in #include statements to name the file containing the * definitions of an API which supports LZW-compressed files. * */ #define FT_LZW_H <freetype/ftlzw.h> /************************************************************************* * * @macro: * FT_BZIP2_H * * @description: * A macro used in #include statements to name the file containing the * definitions of an API which supports bzip2-compressed files. * */ #define FT_BZIP2_H <freetype/ftbzip2.h> /************************************************************************* * * @macro: * FT_WINFONTS_H * * @description: * A macro used in #include statements to name the file containing the * definitions of an API which supports Windows FNT files. * */ #define FT_WINFONTS_H <freetype/ftwinfnt.h> /************************************************************************* * * @macro: * FT_GLYPH_H * * @description: * A macro used in #include statements to name the file containing the * API of the optional glyph management component. * */ #define FT_GLYPH_H <freetype/ftglyph.h> /************************************************************************* * * @macro: * FT_BITMAP_H * * @description: * A macro used in #include statements to name the file containing the * API of the optional bitmap conversion component. * */ #define FT_BITMAP_H <freetype/ftbitmap.h> /************************************************************************* * * @macro: * FT_BBOX_H * * @description: * A macro used in #include statements to name the file containing the * API of the optional exact bounding box computation routines. * */ #define FT_BBOX_H <freetype/ftbbox.h> /************************************************************************* * * @macro: * FT_CACHE_H * * @description: * A macro used in #include statements to name the file containing the * API of the optional FreeType~2 cache sub-system. * */ #define FT_CACHE_H <freetype/ftcache.h> /************************************************************************* * * @macro: * FT_CACHE_IMAGE_H * * @description: * A macro used in #include statements to name the file containing the * `glyph image' API of the FreeType~2 cache sub-system. * * It is used to define a cache for @FT_Glyph elements. You can also * use the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to * store small glyph bitmaps, as it will use less memory. * * This macro is deprecated. Simply include @FT_CACHE_H to have all * glyph image-related cache declarations. * */ #define FT_CACHE_IMAGE_H FT_CACHE_H /************************************************************************* * * @macro: * FT_CACHE_SMALL_BITMAPS_H * * @description: * A macro used in #include statements to name the file containing the * `small bitmaps' API of the FreeType~2 cache sub-system. * * It is used to define a cache for small glyph bitmaps in a relatively * memory-efficient way. You can also use the API defined in * @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images, * including scalable outlines. * * This macro is deprecated. Simply include @FT_CACHE_H to have all * small bitmaps-related cache declarations. * */ #define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H /************************************************************************* * * @macro: * FT_CACHE_CHARMAP_H * * @description: * A macro used in #include statements to name the file containing the * `charmap' API of the FreeType~2 cache sub-system. * * This macro is deprecated. Simply include @FT_CACHE_H to have all * charmap-based cache declarations. * */ #define FT_CACHE_CHARMAP_H FT_CACHE_H /************************************************************************* * * @macro: * FT_MAC_H * * @description: * A macro used in #include statements to name the file containing the * Macintosh-specific FreeType~2 API. The latter is used to access * fonts embedded in resource forks. * * This header file must be explicitly included by client applications * compiled on the Mac (note that the base API still works though). * */ #define FT_MAC_H <freetype/ftmac.h> /************************************************************************* * * @macro: * FT_MULTIPLE_MASTERS_H * * @description: * A macro used in #include statements to name the file containing the * optional multiple-masters management API of FreeType~2. * */ #define FT_MULTIPLE_MASTERS_H <freetype/ftmm.h> /************************************************************************* * * @macro: * FT_SFNT_NAMES_H * * @description: * A macro used in #include statements to name the file containing the * optional FreeType~2 API which accesses embedded `name' strings in * SFNT-based font formats (i.e., TrueType and OpenType). * */ #define FT_SFNT_NAMES_H <freetype/ftsnames.h> /************************************************************************* * * @macro: * FT_OPENTYPE_VALIDATE_H * * @description: * A macro used in #include statements to name the file containing the * optional FreeType~2 API which validates OpenType tables (BASE, GDEF, * GPOS, GSUB, JSTF). * */ #define FT_OPENTYPE_VALIDATE_H <freetype/ftotval.h> /************************************************************************* * * @macro: * FT_GX_VALIDATE_H * * @description: * A macro used in #include statements to name the file containing the * optional FreeType~2 API which validates TrueTypeGX/AAT tables (feat, * mort, morx, bsln, just, kern, opbd, trak, prop). * */ #define FT_GX_VALIDATE_H <freetype/ftgxval.h> /************************************************************************* * * @macro: * FT_PFR_H * * @description: * A macro used in #include statements to name the file containing the * FreeType~2 API which accesses PFR-specific data. * */ #define FT_PFR_H <freetype/ftpfr.h> /************************************************************************* * * @macro: * FT_STROKER_H * * @description: * A macro used in #include statements to name the file containing the * FreeType~2 API which provides functions to stroke outline paths. */ #define FT_STROKER_H <freetype/ftstroke.h> /************************************************************************* * * @macro: * FT_SYNTHESIS_H * * @description: * A macro used in #include statements to name the file containing the * FreeType~2 API which performs artificial obliquing and emboldening. */ #define FT_SYNTHESIS_H <freetype/ftsynth.h> /************************************************************************* * * @macro: * FT_FONT_FORMATS_H * * @description: * A macro used in #include statements to name the file containing the * FreeType~2 API which provides functions specific to font formats. */ #define FT_FONT_FORMATS_H <freetype/ftfntfmt.h> /* deprecated */ #define FT_XFREE86_H FT_FONT_FORMATS_H /************************************************************************* * * @macro: * FT_TRIGONOMETRY_H * * @description: * A macro used in #include statements to name the file containing the * FreeType~2 API which performs trigonometric computations (e.g., * cosines and arc tangents). */ #define FT_TRIGONOMETRY_H <freetype/fttrigon.h> /************************************************************************* * * @macro: * FT_LCD_FILTER_H * * @description: * A macro used in #include statements to name the file containing the * FreeType~2 API which performs color filtering for subpixel rendering. */ #define FT_LCD_FILTER_H <freetype/ftlcdfil.h> /************************************************************************* * * @macro: * FT_UNPATENTED_HINTING_H * * @description: * Deprecated. */ #define FT_UNPATENTED_HINTING_H <freetype/ttunpat.h> /************************************************************************* * * @macro: * FT_INCREMENTAL_H * * @description: * A macro used in #include statements to name the file containing the * FreeType~2 API which performs incremental glyph loading. */ #define FT_INCREMENTAL_H <freetype/ftincrem.h> /************************************************************************* * * @macro: * FT_GASP_H * * @description: * A macro used in #include statements to name the file containing the * FreeType~2 API which returns entries from the TrueType GASP table. */ #define FT_GASP_H <freetype/ftgasp.h> /************************************************************************* * * @macro: * FT_ADVANCES_H * * @description: * A macro used in #include statements to name the file containing the * FreeType~2 API which returns individual and ranged glyph advances. */ #define FT_ADVANCES_H <freetype/ftadvanc.h> /* */ #define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h> /* The internals of the cache sub-system are no longer exposed. We */ /* default to FT_CACHE_H at the moment just in case, but we know of */ /* no rogue client that uses them. */ /* */ #define FT_CACHE_MANAGER_H <freetype/ftcache.h> #define FT_CACHE_INTERNAL_MRU_H <freetype/ftcache.h> #define FT_CACHE_INTERNAL_MANAGER_H <freetype/ftcache.h> #define FT_CACHE_INTERNAL_CACHE_H <freetype/ftcache.h> #define FT_CACHE_INTERNAL_GLYPH_H <freetype/ftcache.h> #define FT_CACHE_INTERNAL_IMAGE_H <freetype/ftcache.h> #define FT_CACHE_INTERNAL_SBITS_H <freetype/ftcache.h> #define FT_INCREMENTAL_H <freetype/ftincrem.h> #define FT_TRUETYPE_UNPATENTED_H <freetype/ttunpat.h> /* * Include internal headers definitions from <internal/...> * only when building the library. */ #ifdef FT2_BUILD_LIBRARY #define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h> #include FT_INTERNAL_INTERNAL_H #endif /* FT2_BUILD_LIBRARY */ #endif /* FTHEADER_H_ */ /* END */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/config/ftconfig.h����������������������������������������������������������������0000644�����������������00000000401�14763166026�0013517 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef __FTCONFIG_H__MULTILIB #define __FTCONFIG_H__MULTILIB #include <bits/wordsize.h> #if __WORDSIZE == 32 # include "ftconfig-32.h" #elif __WORDSIZE == 64 # include "ftconfig-64.h" #else # error "unexpected value for __WORDSIZE macro" #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/config/ftmodule.h����������������������������������������������������������������0000644�����������������00000002206�14763166026�0013544 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* This is a generated file. */ FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class ) FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class ) FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class ) FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class ) FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class ) FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class ) FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class ) FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class ) FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class ) FT_USE_MODULE( FT_Module_Class, sfnt_module_class ) FT_USE_MODULE( FT_Module_Class, autofit_module_class ) FT_USE_MODULE( FT_Module_Class, pshinter_module_class ) FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class ) FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class ) FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class ) FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class ) FT_USE_MODULE( FT_Module_Class, gxv_module_class ) FT_USE_MODULE( FT_Module_Class, otv_module_class ) FT_USE_MODULE( FT_Module_Class, psaux_module_class ) FT_USE_MODULE( FT_Module_Class, psnames_module_class ) /* EOF */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/config/ftconfig-64.h�������������������������������������������������������������0000644�����������������00000047703�14763166026�0013766 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ftconfig.h. Generated from ftconfig.in by configure. */ /***************************************************************************/ /* */ /* ftconfig.in */ /* */ /* UNIX-specific configuration file (specification only). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ /*************************************************************************/ /* */ /* This header file contains a number of macro definitions that are used */ /* by the rest of the engine. Most of the macros here are automatically */ /* determined at compile time, and you should not need to change it to */ /* port FreeType, except to compile the library with a non-ANSI */ /* compiler. */ /* */ /* Note however that if some specific modifications are needed, we */ /* advise you to place a modified copy in your build directory. */ /* */ /* The build directory is usually `builds/<system>', and contains */ /* system-specific files that are always included first when building */ /* the library. */ /* */ /*************************************************************************/ #ifndef FTCONFIG_H_ #define FTCONFIG_H_ #include <ft2build.h> #include FT_CONFIG_OPTIONS_H #include FT_CONFIG_STANDARD_LIBRARY_H FT_BEGIN_HEADER /*************************************************************************/ /* */ /* PLATFORM-SPECIFIC CONFIGURATION MACROS */ /* */ /* These macros can be toggled to suit a specific system. The current */ /* ones are defaults used to compile FreeType in an ANSI C environment */ /* (16bit compilers are also supported). Copy this file to your own */ /* `builds/<system>' directory, and edit it to port the engine. */ /* */ /*************************************************************************/ #define HAVE_UNISTD_H 1 #define HAVE_FCNTL_H 1 #define HAVE_STDINT_H 1 /* There are systems (like the Texas Instruments 'C54x) where a `char' */ /* has 16 bits. ANSI C says that sizeof(char) is always 1. Since an */ /* `int' has 16 bits also for this system, sizeof(int) gives 1 which */ /* is probably unexpected. */ /* */ /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */ /* `char' type. */ #ifndef FT_CHAR_BIT #define FT_CHAR_BIT CHAR_BIT #endif /* #undef FT_USE_AUTOCONF_SIZEOF_TYPES */ #ifdef FT_USE_AUTOCONF_SIZEOF_TYPES #define SIZEOF_INT 4 #define SIZEOF_LONG 8 #define FT_SIZEOF_INT SIZEOF_INT #define FT_SIZEOF_LONG SIZEOF_LONG #else /* !FT_USE_AUTOCONF_SIZEOF_TYPES */ /* Following cpp computation of the bit length of int and long */ /* is copied from default include/freetype/config/ftconfig.h. */ /* If any improvement is required for this file, it should be */ /* applied to the original header file for the builders that */ /* do not use configure script. */ /* The size of an `int' type. */ #if FT_UINT_MAX == 0xFFFFUL #define FT_SIZEOF_INT (16 / FT_CHAR_BIT) #elif FT_UINT_MAX == 0xFFFFFFFFUL #define FT_SIZEOF_INT (32 / FT_CHAR_BIT) #elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL #define FT_SIZEOF_INT (64 / FT_CHAR_BIT) #else #error "Unsupported size of `int' type!" #endif /* The size of a `long' type. A five-byte `long' (as used e.g. on the */ /* DM642) is recognized but avoided. */ #if FT_ULONG_MAX == 0xFFFFFFFFUL #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL #define FT_SIZEOF_LONG (64 / FT_CHAR_BIT) #else #error "Unsupported size of `long' type!" #endif #endif /* !FT_USE_AUTOCONF_SIZEOF_TYPES */ /* FT_UNUSED is a macro used to indicate that a given parameter is not */ /* used -- this is only used to get rid of unpleasant compiler warnings */ #ifndef FT_UNUSED #define FT_UNUSED( arg ) ( (arg) = (arg) ) #endif /*************************************************************************/ /* */ /* AUTOMATIC CONFIGURATION MACROS */ /* */ /* These macros are computed from the ones defined above. Don't touch */ /* their definition, unless you know precisely what you are doing. No */ /* porter should need to mess with them. */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* Mac support */ /* */ /* This is the only necessary change, so it is defined here instead */ /* providing a new configuration file. */ /* */ #if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) ) /* no Carbon frameworks for 64bit 10.4.x */ /* AvailabilityMacros.h is available since Mac OS X 10.2, */ /* so guess the system version by maximum errno before inclusion */ #include <errno.h> #ifdef ECANCELED /* defined since 10.2 */ #include "AvailabilityMacros.h" #endif #if defined( __LP64__ ) && \ ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 ) #undef FT_MACINTOSH #endif #elif defined( __SC__ ) || defined( __MRC__ ) /* Classic MacOS compilers */ #include "ConditionalMacros.h" #if TARGET_OS_MAC #define FT_MACINTOSH 1 #endif #endif /* Fix compiler warning with sgi compiler */ #if defined( __sgi ) && !defined( __GNUC__ ) #if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 ) #pragma set woff 3505 #endif #endif /*************************************************************************/ /* */ /* <Section> */ /* basic_types */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Type> */ /* FT_Int16 */ /* */ /* <Description> */ /* A typedef for a 16bit signed integer type. */ /* */ typedef signed short FT_Int16; /*************************************************************************/ /* */ /* <Type> */ /* FT_UInt16 */ /* */ /* <Description> */ /* A typedef for a 16bit unsigned integer type. */ /* */ typedef unsigned short FT_UInt16; /* */ /* this #if 0 ... #endif clause is for documentation purposes */ #if 0 /*************************************************************************/ /* */ /* <Type> */ /* FT_Int32 */ /* */ /* <Description> */ /* A typedef for a 32bit signed integer type. The size depends on */ /* the configuration. */ /* */ typedef signed XXX FT_Int32; /*************************************************************************/ /* */ /* <Type> */ /* FT_UInt32 */ /* */ /* A typedef for a 32bit unsigned integer type. The size depends on */ /* the configuration. */ /* */ typedef unsigned XXX FT_UInt32; /*************************************************************************/ /* */ /* <Type> */ /* FT_Int64 */ /* */ /* A typedef for a 64bit signed integer type. The size depends on */ /* the configuration. Only defined if there is real 64bit support; */ /* otherwise, it gets emulated with a structure (if necessary). */ /* */ typedef signed XXX FT_Int64; /*************************************************************************/ /* */ /* <Type> */ /* FT_UInt64 */ /* */ /* A typedef for a 64bit unsigned integer type. The size depends on */ /* the configuration. Only defined if there is real 64bit support; */ /* otherwise, it gets emulated with a structure (if necessary). */ /* */ typedef unsigned XXX FT_UInt64; /* */ #endif #if FT_SIZEOF_INT == 4 typedef signed int FT_Int32; typedef unsigned int FT_UInt32; #elif FT_SIZEOF_LONG == 4 typedef signed long FT_Int32; typedef unsigned long FT_UInt32; #else #error "no 32bit type found -- please check your configuration files" #endif /* look up an integer type that is at least 32 bits */ #if FT_SIZEOF_INT >= 4 typedef int FT_Fast; typedef unsigned int FT_UFast; #elif FT_SIZEOF_LONG >= 4 typedef long FT_Fast; typedef unsigned long FT_UFast; #endif /* determine whether we have a 64-bit int type */ /* (mostly for environments without `autoconf') */ #if FT_SIZEOF_LONG == 8 /* FT_LONG64 must be defined if a 64-bit type is available */ #define FT_LONG64 #define FT_INT64 long #define FT_UINT64 unsigned long /* we handle the LLP64 scheme separately for GCC and clang, */ /* suppressing the `long long' warning */ #elif ( FT_SIZEOF_LONG == 4 ) && \ defined( HAVE_LONG_LONG_INT ) && \ defined( __GNUC__ ) #pragma GCC diagnostic ignored "-Wlong-long" #define FT_LONG64 #define FT_INT64 long long int #define FT_UINT64 unsigned long long int /*************************************************************************/ /* */ /* A 64-bit data type may create compilation problems if you compile */ /* in strict ANSI mode. To avoid them, we disable other 64-bit data */ /* types if __STDC__ is defined. You can however ignore this rule */ /* by defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */ /* */ #elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 ) #if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L #define FT_LONG64 #define FT_INT64 long long int #define FT_UINT64 unsigned long long int #elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */ /* this compiler provides the __int64 type */ #define FT_LONG64 #define FT_INT64 __int64 #define FT_UINT64 unsigned __int64 #elif defined( __BORLANDC__ ) /* Borland C++ */ /* XXXX: We should probably check the value of __BORLANDC__ in order */ /* to test the compiler version. */ /* this compiler provides the __int64 type */ #define FT_LONG64 #define FT_INT64 __int64 #define FT_UINT64 unsigned __int64 #elif defined( __WATCOMC__ ) /* Watcom C++ */ /* Watcom doesn't provide 64-bit data types */ #elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */ #define FT_LONG64 #define FT_INT64 long long int #define FT_UINT64 unsigned long long int #elif defined( __GNUC__ ) /* GCC provides the `long long' type */ #define FT_LONG64 #define FT_INT64 long long int #define FT_UINT64 unsigned long long int #endif /* __STDC_VERSION__ >= 199901L */ #endif /* FT_SIZEOF_LONG == 8 */ #ifdef FT_LONG64 typedef FT_INT64 FT_Int64; typedef FT_UINT64 FT_UInt64; #endif #ifdef _WIN64 /* only 64bit Windows uses the LLP64 data model, i.e., */ /* 32bit integers, 64bit pointers */ #define FT_UINT_TO_POINTER( x ) (void*)(unsigned __int64)(x) #else #define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x) #endif /*************************************************************************/ /* */ /* miscellaneous */ /* */ /*************************************************************************/ #define FT_BEGIN_STMNT do { #define FT_END_STMNT } while ( 0 ) #define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT /* typeof condition taken from gnulib's `intprops.h' header file */ #if ( ( defined( __GNUC__ ) && __GNUC__ >= 2 ) || \ ( defined( __IBMC__ ) && __IBMC__ >= 1210 && \ defined( __IBM__TYPEOF__ ) ) || \ ( defined( __SUNPRO_C ) && __SUNPRO_C >= 0x5110 && !__STDC__ ) ) #define FT_TYPEOF( type ) ( __typeof__ ( type ) ) #else #define FT_TYPEOF( type ) /* empty */ #endif #ifdef FT_MAKE_OPTION_SINGLE_OBJECT #define FT_LOCAL( x ) static x #define FT_LOCAL_DEF( x ) static x #else #ifdef __cplusplus #define FT_LOCAL( x ) extern "C" x #define FT_LOCAL_DEF( x ) extern "C" x #else #define FT_LOCAL( x ) extern x #define FT_LOCAL_DEF( x ) x #endif #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */ #define FT_LOCAL_ARRAY( x ) extern const x #define FT_LOCAL_ARRAY_DEF( x ) const x #ifndef FT_BASE #ifdef __cplusplus #define FT_BASE( x ) extern "C" x #else #define FT_BASE( x ) extern x #endif #endif /* !FT_BASE */ #ifndef FT_BASE_DEF #ifdef __cplusplus #define FT_BASE_DEF( x ) x #else #define FT_BASE_DEF( x ) x #endif #endif /* !FT_BASE_DEF */ #ifndef FT_EXPORT #ifdef __cplusplus #define FT_EXPORT( x ) extern "C" x #else #define FT_EXPORT( x ) extern x #endif #endif /* !FT_EXPORT */ #ifndef FT_EXPORT_DEF #ifdef __cplusplus #define FT_EXPORT_DEF( x ) extern "C" x #else #define FT_EXPORT_DEF( x ) extern x #endif #endif /* !FT_EXPORT_DEF */ #ifndef FT_EXPORT_VAR #ifdef __cplusplus #define FT_EXPORT_VAR( x ) extern "C" x #else #define FT_EXPORT_VAR( x ) extern x #endif #endif /* !FT_EXPORT_VAR */ /* The following macros are needed to compile the library with a */ /* C++ compiler and with 16bit compilers. */ /* */ /* This is special. Within C++, you must specify `extern "C"' for */ /* functions which are used via function pointers, and you also */ /* must do that for structures which contain function pointers to */ /* assure C linkage -- it's not possible to have (local) anonymous */ /* functions which are accessed by (global) function pointers. */ /* */ /* */ /* FT_CALLBACK_DEF is used to _define_ a callback function. */ /* */ /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */ /* contains pointers to callback functions. */ /* */ /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */ /* that contains pointers to callback functions. */ /* */ /* */ /* Some 16bit compilers have to redefine these macros to insert */ /* the infamous `_cdecl' or `__fastcall' declarations. */ /* */ #ifndef FT_CALLBACK_DEF #ifdef __cplusplus #define FT_CALLBACK_DEF( x ) extern "C" x #else #define FT_CALLBACK_DEF( x ) static x #endif #endif /* FT_CALLBACK_DEF */ #ifndef FT_CALLBACK_TABLE #ifdef __cplusplus #define FT_CALLBACK_TABLE extern "C" #define FT_CALLBACK_TABLE_DEF extern "C" #else #define FT_CALLBACK_TABLE extern #define FT_CALLBACK_TABLE_DEF /* nothing */ #endif #endif /* FT_CALLBACK_TABLE */ FT_END_HEADER #endif /* FTCONFIG_H_ */ /* END */ �������������������������������������������������������������freetype2/freetype/config/ftstdlib.h����������������������������������������������������������������0000644�����������������00000016200�14763166026�0013537 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftstdlib.h */ /* */ /* ANSI-specific library and header configuration file (specification */ /* only). */ /* */ /* Copyright 2002-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ /*************************************************************************/ /* */ /* This file is used to group all #includes to the ANSI C library that */ /* FreeType normally requires. It also defines macros to rename the */ /* standard functions within the FreeType source code. */ /* */ /* Load a file which defines FTSTDLIB_H_ before this one to override it. */ /* */ /*************************************************************************/ #ifndef FTSTDLIB_H_ #define FTSTDLIB_H_ #include <stddef.h> #define ft_ptrdiff_t ptrdiff_t /**********************************************************************/ /* */ /* integer limits */ /* */ /* UINT_MAX and ULONG_MAX are used to automatically compute the size */ /* of `int' and `long' in bytes at compile-time. So far, this works */ /* for all platforms the library has been tested on. */ /* */ /* Note that on the extremely rare platforms that do not provide */ /* integer types that are _exactly_ 16 and 32 bits wide (e.g. some */ /* old Crays where `int' is 36 bits), we do not make any guarantee */ /* about the correct behaviour of FT2 with all fonts. */ /* */ /* In these case, `ftconfig.h' will refuse to compile anyway with a */ /* message like `couldn't find 32-bit type' or something similar. */ /* */ /**********************************************************************/ #include <limits.h> #define FT_CHAR_BIT CHAR_BIT #define FT_USHORT_MAX USHRT_MAX #define FT_INT_MAX INT_MAX #define FT_INT_MIN INT_MIN #define FT_UINT_MAX UINT_MAX #define FT_LONG_MIN LONG_MIN #define FT_LONG_MAX LONG_MAX #define FT_ULONG_MAX ULONG_MAX /**********************************************************************/ /* */ /* character and string processing */ /* */ /**********************************************************************/ #include <string.h> #define ft_memchr memchr #define ft_memcmp memcmp #define ft_memcpy memcpy #define ft_memmove memmove #define ft_memset memset #define ft_strcat strcat #define ft_strcmp strcmp #define ft_strcpy strcpy #define ft_strlen strlen #define ft_strncmp strncmp #define ft_strncpy strncpy #define ft_strrchr strrchr #define ft_strstr strstr /**********************************************************************/ /* */ /* file handling */ /* */ /**********************************************************************/ #include <stdio.h> #define FT_FILE FILE #define ft_fclose fclose #define ft_fopen fopen #define ft_fread fread #define ft_fseek fseek #define ft_ftell ftell #define ft_sprintf sprintf /**********************************************************************/ /* */ /* sorting */ /* */ /**********************************************************************/ #include <stdlib.h> #define ft_qsort qsort /**********************************************************************/ /* */ /* memory allocation */ /* */ /**********************************************************************/ #define ft_scalloc calloc #define ft_sfree free #define ft_smalloc malloc #define ft_srealloc realloc /**********************************************************************/ /* */ /* miscellaneous */ /* */ /**********************************************************************/ #define ft_strtol strtol #define ft_getenv getenv /**********************************************************************/ /* */ /* execution control */ /* */ /**********************************************************************/ #include <setjmp.h> #define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */ /* jmp_buf is defined as a macro */ /* on certain platforms */ #define ft_longjmp longjmp #define ft_setjmp( b ) setjmp( *(ft_jmp_buf*) &(b) ) /* same thing here */ /* the following is only used for debugging purposes, i.e., if */ /* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined */ #include <stdarg.h> #endif /* FTSTDLIB_H_ */ /* END */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftlcdfil.h�����������������������������������������������������������������������0000644�����������������00000030432�14763166026�0012251 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftlcdfil.h */ /* */ /* FreeType API for color filtering of subpixel bitmap glyphs */ /* (specification). */ /* */ /* Copyright 2006-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTLCDFIL_H_ #define FTLCDFIL_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************** * * @section: * lcd_filtering * * @title: * LCD Filtering * * @abstract: * Reduce color fringes of subpixel-rendered bitmaps. * * @description: * Subpixel rendering exploits the color-striped structure of LCD * pixels, increasing the available resolution in the direction of the * stripe (usually horizontal RGB) by a factor of~3. Since these * subpixels are color pixels, using them unfiltered creates severe * color fringes. Use the @FT_Library_SetLcdFilter API to specify a * low-pass filter, which is then applied to subpixel-rendered bitmaps * generated through @FT_Render_Glyph. The filter sacrifices some of * the higher resolution to reduce color fringes, making the glyph image * slightly blurrier. Positional improvements will remain. * * Note that no filter is active by default, and that this function is * *not* implemented in default builds of the library. You need to * #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your `ftoption.h' file * in order to activate it and explicitly call @FT_Library_SetLcdFilter * to enable it. * * A filter should have two properties: * * 1) It should be normalized, meaning the sum of the 5~components * should be 256 (0x100). It is possible to go above or under this * target sum, however: going under means tossing out contrast, going * over means invoking clamping and thereby non-linearities that * increase contrast somewhat at the expense of greater distortion * and color-fringing. Contrast is better enhanced through stem * darkening. * * 2) It should be color-balanced, meaning a filter `{~a, b, c, b, a~}' * where a~+ b~=~c. It distributes the computed coverage for one * subpixel to all subpixels equally, sacrificing some won resolution * but drastically reducing color-fringing. Positioning improvements * remain! Note that color-fringing can only really be minimized * when using a color-balanced filter and alpha-blending the glyph * onto a surface in linear space; see @FT_Render_Glyph. * * Regarding the form, a filter can be a `boxy' filter or a `beveled' * filter. Boxy filters are sharper but are less forgiving of non-ideal * gamma curves of a screen (viewing angles!), beveled filters are * fuzzier but more tolerant. * * Examples: * * - [0x10 0x40 0x70 0x40 0x10] is beveled and neither balanced nor * normalized. * * - [0x1A 0x33 0x4D 0x33 0x1A] is beveled and balanced but not * normalized. * * - [0x19 0x33 0x66 0x4c 0x19] is beveled and normalized but not * balanced. * * - [0x00 0x4c 0x66 0x4c 0x00] is boxily beveled and normalized but not * balanced. * * - [0x00 0x55 0x56 0x55 0x00] is boxy, normalized, and almost * balanced. * * - [0x08 0x4D 0x56 0x4D 0x08] is beveled, normalized and, almost * balanced. * * The filter affects glyph bitmaps rendered through @FT_Render_Glyph, * @FT_Load_Glyph, and @FT_Load_Char. It does _not_ affect the output * of @FT_Outline_Render and @FT_Outline_Get_Bitmap. * * If this feature is activated, the dimensions of LCD glyph bitmaps are * either wider or taller than the dimensions of the corresponding * outline with regard to the pixel grid. For example, for * @FT_RENDER_MODE_LCD, the filter adds 3~subpixels to the left, and * 3~subpixels to the right. The bitmap offset values are adjusted * accordingly, so clients shouldn't need to modify their layout and * glyph positioning code when enabling the filter. * * It is important to understand that linear alpha blending and gamma * correction is critical for correctly rendering glyphs onto surfaces * without artifacts and even more critical when subpixel rendering is * involved. * * Each of the 3~alpha values (subpixels) is independently used to blend * one color channel. That is, red alpha blends the red channel of the * text color with the red channel of the background pixel. The * distribution of density values by the color-balanced filter assumes * alpha blending is done in linear space; only then color artifacts * cancel out. */ /**************************************************************************** * * @enum: * FT_LcdFilter * * @description: * A list of values to identify various types of LCD filters. * * @values: * FT_LCD_FILTER_NONE :: * Do not perform filtering. When used with subpixel rendering, this * results in sometimes severe color fringes. * * FT_LCD_FILTER_DEFAULT :: * The default filter reduces color fringes considerably, at the cost * of a slight blurriness in the output. * * It is a beveled, normalized, and color-balanced five-tap filter * that is more forgiving to screens with non-ideal gamma curves and * viewing angles. Note that while color-fringing is reduced, it can * only be minimized by using linear alpha blending and gamma * correction to render glyphs onto surfaces. The default filter * weights are [0x08 0x4D 0x56 0x4D 0x08]. * * FT_LCD_FILTER_LIGHT :: * The light filter is a variant that is sharper at the cost of * slightly more color fringes than the default one. * * It is a boxy, normalized, and color-balanced three-tap filter that * is less forgiving to screens with non-ideal gamma curves and * viewing angles. This filter works best when the rendering system * uses linear alpha blending and gamma correction to render glyphs * onto surfaces. The light filter weights are * [0x00 0x55 0x56 0x55 0x00]. * * FT_LCD_FILTER_LEGACY :: * This filter corresponds to the original libXft color filter. It * provides high contrast output but can exhibit really bad color * fringes if glyphs are not extremely well hinted to the pixel grid. * In other words, it only works well if the TrueType bytecode * interpreter is enabled *and* high-quality hinted fonts are used. * * This filter is only provided for comparison purposes, and might be * disabled or stay unsupported in the future. * * FT_LCD_FILTER_LEGACY1 :: * For historical reasons, the FontConfig library returns a different * enumeration value for legacy LCD filtering. To make code work that * (incorrectly) forwards FontConfig's enumeration value to * @FT_Library_SetLcdFilter without proper mapping, it is thus easiest * to have another enumeration value, which is completely equal to * `FT_LCD_FILTER_LEGACY'. * * @since: * 2.3.0 (`FT_LCD_FILTER_LEGACY1' since 2.6.2) */ typedef enum FT_LcdFilter_ { FT_LCD_FILTER_NONE = 0, FT_LCD_FILTER_DEFAULT = 1, FT_LCD_FILTER_LIGHT = 2, FT_LCD_FILTER_LEGACY1 = 3, FT_LCD_FILTER_LEGACY = 16, FT_LCD_FILTER_MAX /* do not remove */ } FT_LcdFilter; /************************************************************************** * * @func: * FT_Library_SetLcdFilter * * @description: * This function is used to apply color filtering to LCD decimated * bitmaps, like the ones used when calling @FT_Render_Glyph with * @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V. * * @input: * library :: * A handle to the target library instance. * * filter :: * The filter type. * * You can use @FT_LCD_FILTER_NONE here to disable this feature, or * @FT_LCD_FILTER_DEFAULT to use a default filter that should work * well on most LCD screens. * * @return: * FreeType error code. 0~means success. * * @note: * This feature is always disabled by default. Clients must make an * explicit call to this function with a `filter' value other than * @FT_LCD_FILTER_NONE in order to enable it. * * Due to *PATENTS* covering subpixel rendering, this function doesn't * do anything except returning `FT_Err_Unimplemented_Feature' if the * configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not * defined in your build of the library, which should correspond to all * default builds of FreeType. * * @since: * 2.3.0 */ FT_EXPORT( FT_Error ) FT_Library_SetLcdFilter( FT_Library library, FT_LcdFilter filter ); /************************************************************************** * * @func: * FT_Library_SetLcdFilterWeights * * @description: * This function can be used to enable LCD filter with custom weights, * instead of using presets in @FT_Library_SetLcdFilter. * * @input: * library :: * A handle to the target library instance. * * weights :: * A pointer to an array; the function copies the first five bytes and * uses them to specify the filter weights. * * @return: * FreeType error code. 0~means success. * * @note: * Due to *PATENTS* covering subpixel rendering, this function doesn't * do anything except returning `FT_Err_Unimplemented_Feature' if the * configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not * defined in your build of the library, which should correspond to all * default builds of FreeType. * * LCD filter weights can also be set per face using @FT_Face_Properties * with @FT_PARAM_TAG_LCD_FILTER_WEIGHTS. * * @since: * 2.4.0 */ FT_EXPORT( FT_Error ) FT_Library_SetLcdFilterWeights( FT_Library library, unsigned char *weights ); /************************************************************************** * * @constant: * FT_PARAM_TAG_LCD_FILTER_WEIGHTS * * @description: * An @FT_Parameter tag to be used with @FT_Face_Properties. The * corresponding argument specifies the five LCD filter weights for a * given face (if using @FT_LOAD_TARGET_LCD, for example), overriding * the global default values or the values set up with * @FT_Library_SetLcdFilterWeights. * */ #define FT_PARAM_TAG_LCD_FILTER_WEIGHTS \ FT_MAKE_TAG( 'l', 'c', 'd', 'f' ) /* * @type: * FT_LcdFiveTapFilter * * @description: * A typedef for passing the five LCD filter weights to * @FT_Face_Properties within an @FT_Parameter structure. * */ #define FT_LCD_FILTER_FIVE_TAPS 5 typedef FT_Byte FT_LcdFiveTapFilter[FT_LCD_FILTER_FIVE_TAPS]; /* */ FT_END_HEADER #endif /* FTLCDFIL_H_ */ /* END */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftpcfdrv.h�����������������������������������������������������������������������0000644�����������������00000007267�14763166026�0012312 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftpcfdrv.h */ /* */ /* FreeType API for controlling the PCF driver (specification only). */ /* */ /* Copyright 2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTPCFDRV_H_ #define FTPCFDRV_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /************************************************************************** * * @section: * pcf_driver * * @title: * The PCF driver * * @abstract: * Controlling the PCF driver module. * * @description: * While FreeType's PCF driver doesn't expose API functions by itself, * it is possible to control its behaviour with @FT_Property_Set and * @FT_Property_Get. Right now, there is a single property * `no-long-family-names' available if FreeType is compiled with * PCF_CONFIG_OPTION_LONG_FAMILY_NAMES. * * The PCF driver's module name is `pcf'. * */ /************************************************************************** * * @property: * no-long-family-names * * @description: * If PCF_CONFIG_OPTION_LONG_FAMILY_NAMES is active while compiling * FreeType, the PCF driver constructs long family names. * * There are many PCF fonts just called `Fixed' which look completely * different, and which have nothing to do with each other. When * selecting `Fixed' in KDE or Gnome one gets results that appear rather * random, the style changes often if one changes the size and one * cannot select some fonts at all. The improve this situation, the PCF * module prepends the foundry name (plus a space) to the family name. * It also checks whether there are `wide' characters; all put together, * family names like `Sony Fixed' or `Misc Fixed Wide' are constructed. * * If `no-long-family-names' is set, this feature gets switched off. * * { * FT_Library library; * FT_Bool no_long_family_names = TRUE; * * * FT_Init_FreeType( &library ); * * FT_Property_Set( library, "pcf", * "no-long-family-names", * &no_long_family_names ); * } * * @note: * This property can be used with @FT_Property_Get also. * * This property can be set via the `FREETYPE_PROPERTIES' environment * variable (using values 1 and 0 for `on' and `off', respectively). * */ FT_END_HEADER #endif /* FTPCFDRV_H_ */ /* END */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftlist.h�������������������������������������������������������������������������0000644�����������������00000040562�14763166026�0011774 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftlist.h */ /* */ /* Generic list support for FreeType (specification). */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ /*************************************************************************/ /* */ /* This file implements functions relative to list processing. Its */ /* data structures are defined in `freetype.h'. */ /* */ /*************************************************************************/ #ifndef FTLIST_H_ #define FTLIST_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* list_processing */ /* */ /* <Title> */ /* List Processing */ /* */ /* <Abstract> */ /* Simple management of lists. */ /* */ /* <Description> */ /* This section contains various definitions related to list */ /* processing using doubly-linked nodes. */ /* */ /* <Order> */ /* FT_List */ /* FT_ListNode */ /* FT_ListRec */ /* FT_ListNodeRec */ /* */ /* FT_List_Add */ /* FT_List_Insert */ /* FT_List_Find */ /* FT_List_Remove */ /* FT_List_Up */ /* FT_List_Iterate */ /* FT_List_Iterator */ /* FT_List_Finalize */ /* FT_List_Destructor */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Function> */ /* FT_List_Find */ /* */ /* <Description> */ /* Find the list node for a given listed object. */ /* */ /* <Input> */ /* list :: A pointer to the parent list. */ /* data :: The address of the listed object. */ /* */ /* <Return> */ /* List node. NULL if it wasn't found. */ /* */ FT_EXPORT( FT_ListNode ) FT_List_Find( FT_List list, void* data ); /*************************************************************************/ /* */ /* <Function> */ /* FT_List_Add */ /* */ /* <Description> */ /* Append an element to the end of a list. */ /* */ /* <InOut> */ /* list :: A pointer to the parent list. */ /* node :: The node to append. */ /* */ FT_EXPORT( void ) FT_List_Add( FT_List list, FT_ListNode node ); /*************************************************************************/ /* */ /* <Function> */ /* FT_List_Insert */ /* */ /* <Description> */ /* Insert an element at the head of a list. */ /* */ /* <InOut> */ /* list :: A pointer to parent list. */ /* node :: The node to insert. */ /* */ FT_EXPORT( void ) FT_List_Insert( FT_List list, FT_ListNode node ); /*************************************************************************/ /* */ /* <Function> */ /* FT_List_Remove */ /* */ /* <Description> */ /* Remove a node from a list. This function doesn't check whether */ /* the node is in the list! */ /* */ /* <Input> */ /* node :: The node to remove. */ /* */ /* <InOut> */ /* list :: A pointer to the parent list. */ /* */ FT_EXPORT( void ) FT_List_Remove( FT_List list, FT_ListNode node ); /*************************************************************************/ /* */ /* <Function> */ /* FT_List_Up */ /* */ /* <Description> */ /* Move a node to the head/top of a list. Used to maintain LRU */ /* lists. */ /* */ /* <InOut> */ /* list :: A pointer to the parent list. */ /* node :: The node to move. */ /* */ FT_EXPORT( void ) FT_List_Up( FT_List list, FT_ListNode node ); /*************************************************************************/ /* */ /* <FuncType> */ /* FT_List_Iterator */ /* */ /* <Description> */ /* An FT_List iterator function that is called during a list parse */ /* by @FT_List_Iterate. */ /* */ /* <Input> */ /* node :: The current iteration list node. */ /* */ /* user :: A typeless pointer passed to @FT_List_Iterate. */ /* Can be used to point to the iteration's state. */ /* */ typedef FT_Error (*FT_List_Iterator)( FT_ListNode node, void* user ); /*************************************************************************/ /* */ /* <Function> */ /* FT_List_Iterate */ /* */ /* <Description> */ /* Parse a list and calls a given iterator function on each element. */ /* Note that parsing is stopped as soon as one of the iterator calls */ /* returns a non-zero value. */ /* */ /* <Input> */ /* list :: A handle to the list. */ /* iterator :: An iterator function, called on each node of the list. */ /* user :: A user-supplied field that is passed as the second */ /* argument to the iterator. */ /* */ /* <Return> */ /* The result (a FreeType error code) of the last iterator call. */ /* */ FT_EXPORT( FT_Error ) FT_List_Iterate( FT_List list, FT_List_Iterator iterator, void* user ); /*************************************************************************/ /* */ /* <FuncType> */ /* FT_List_Destructor */ /* */ /* <Description> */ /* An @FT_List iterator function that is called during a list */ /* finalization by @FT_List_Finalize to destroy all elements in a */ /* given list. */ /* */ /* <Input> */ /* system :: The current system object. */ /* */ /* data :: The current object to destroy. */ /* */ /* user :: A typeless pointer passed to @FT_List_Iterate. It can */ /* be used to point to the iteration's state. */ /* */ typedef void (*FT_List_Destructor)( FT_Memory memory, void* data, void* user ); /*************************************************************************/ /* */ /* <Function> */ /* FT_List_Finalize */ /* */ /* <Description> */ /* Destroy all elements in the list as well as the list itself. */ /* */ /* <Input> */ /* list :: A handle to the list. */ /* */ /* destroy :: A list destructor that will be applied to each element */ /* of the list. Set this to NULL if not needed. */ /* */ /* memory :: The current memory object that handles deallocation. */ /* */ /* user :: A user-supplied field that is passed as the last */ /* argument to the destructor. */ /* */ /* <Note> */ /* This function expects that all nodes added by @FT_List_Add or */ /* @FT_List_Insert have been dynamically allocated. */ /* */ FT_EXPORT( void ) FT_List_Finalize( FT_List list, FT_List_Destructor destroy, FT_Memory memory, void* user ); /* */ FT_END_HEADER #endif /* FTLIST_H_ */ /* END */ ����������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftgxval.h������������������������������������������������������������������������0000644�����������������00000032127�14763166026�0012140 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftgxval.h */ /* */ /* FreeType API for validating TrueTypeGX/AAT tables (specification). */ /* */ /* Copyright 2004-2017 by */ /* Masatake YAMATO, Redhat K.K, */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ /***************************************************************************/ /* */ /* gxvalid is derived from both gxlayout module and otvalid module. */ /* Development of gxlayout is supported by the Information-technology */ /* Promotion Agency(IPA), Japan. */ /* */ /***************************************************************************/ #ifndef FTGXVAL_H_ #define FTGXVAL_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* gx_validation */ /* */ /* <Title> */ /* TrueTypeGX/AAT Validation */ /* */ /* <Abstract> */ /* An API to validate TrueTypeGX/AAT tables. */ /* */ /* <Description> */ /* This section contains the declaration of functions to validate */ /* some TrueTypeGX tables (feat, mort, morx, bsln, just, kern, opbd, */ /* trak, prop, lcar). */ /* */ /* <Order> */ /* FT_TrueTypeGX_Validate */ /* FT_TrueTypeGX_Free */ /* */ /* FT_ClassicKern_Validate */ /* FT_ClassicKern_Free */ /* */ /* FT_VALIDATE_GX_LENGTH */ /* FT_VALIDATE_GXXXX */ /* FT_VALIDATE_CKERNXXX */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* */ /* Warning: Use FT_VALIDATE_XXX to validate a table. */ /* Following definitions are for gxvalid developers. */ /* */ /* */ /*************************************************************************/ #define FT_VALIDATE_feat_INDEX 0 #define FT_VALIDATE_mort_INDEX 1 #define FT_VALIDATE_morx_INDEX 2 #define FT_VALIDATE_bsln_INDEX 3 #define FT_VALIDATE_just_INDEX 4 #define FT_VALIDATE_kern_INDEX 5 #define FT_VALIDATE_opbd_INDEX 6 #define FT_VALIDATE_trak_INDEX 7 #define FT_VALIDATE_prop_INDEX 8 #define FT_VALIDATE_lcar_INDEX 9 #define FT_VALIDATE_GX_LAST_INDEX FT_VALIDATE_lcar_INDEX /************************************************************************* * * @macro: * FT_VALIDATE_GX_LENGTH * * @description: * The number of tables checked in this module. Use it as a parameter * for the `table-length' argument of function @FT_TrueTypeGX_Validate. */ #define FT_VALIDATE_GX_LENGTH (FT_VALIDATE_GX_LAST_INDEX + 1) /* */ /* Up to 0x1000 is used by otvalid. Ox2xxx is reserved for feature OT extension. */ #define FT_VALIDATE_GX_START 0x4000 #define FT_VALIDATE_GX_BITFIELD( tag ) \ ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX ) /********************************************************************** * * @enum: * FT_VALIDATE_GXXXX * * @description: * A list of bit-field constants used with @FT_TrueTypeGX_Validate to * indicate which TrueTypeGX/AAT Type tables should be validated. * * @values: * FT_VALIDATE_feat :: * Validate `feat' table. * * FT_VALIDATE_mort :: * Validate `mort' table. * * FT_VALIDATE_morx :: * Validate `morx' table. * * FT_VALIDATE_bsln :: * Validate `bsln' table. * * FT_VALIDATE_just :: * Validate `just' table. * * FT_VALIDATE_kern :: * Validate `kern' table. * * FT_VALIDATE_opbd :: * Validate `opbd' table. * * FT_VALIDATE_trak :: * Validate `trak' table. * * FT_VALIDATE_prop :: * Validate `prop' table. * * FT_VALIDATE_lcar :: * Validate `lcar' table. * * FT_VALIDATE_GX :: * Validate all TrueTypeGX tables (feat, mort, morx, bsln, just, kern, * opbd, trak, prop and lcar). * */ #define FT_VALIDATE_feat FT_VALIDATE_GX_BITFIELD( feat ) #define FT_VALIDATE_mort FT_VALIDATE_GX_BITFIELD( mort ) #define FT_VALIDATE_morx FT_VALIDATE_GX_BITFIELD( morx ) #define FT_VALIDATE_bsln FT_VALIDATE_GX_BITFIELD( bsln ) #define FT_VALIDATE_just FT_VALIDATE_GX_BITFIELD( just ) #define FT_VALIDATE_kern FT_VALIDATE_GX_BITFIELD( kern ) #define FT_VALIDATE_opbd FT_VALIDATE_GX_BITFIELD( opbd ) #define FT_VALIDATE_trak FT_VALIDATE_GX_BITFIELD( trak ) #define FT_VALIDATE_prop FT_VALIDATE_GX_BITFIELD( prop ) #define FT_VALIDATE_lcar FT_VALIDATE_GX_BITFIELD( lcar ) #define FT_VALIDATE_GX ( FT_VALIDATE_feat | \ FT_VALIDATE_mort | \ FT_VALIDATE_morx | \ FT_VALIDATE_bsln | \ FT_VALIDATE_just | \ FT_VALIDATE_kern | \ FT_VALIDATE_opbd | \ FT_VALIDATE_trak | \ FT_VALIDATE_prop | \ FT_VALIDATE_lcar ) /********************************************************************** * * @function: * FT_TrueTypeGX_Validate * * @description: * Validate various TrueTypeGX tables to assure that all offsets and * indices are valid. The idea is that a higher-level library that * actually does the text layout can access those tables without * error checking (which can be quite time consuming). * * @input: * face :: * A handle to the input face. * * validation_flags :: * A bit field that specifies the tables to be validated. See * @FT_VALIDATE_GXXXX for possible values. * * table_length :: * The size of the `tables' array. Normally, @FT_VALIDATE_GX_LENGTH * should be passed. * * @output: * tables :: * The array where all validated sfnt tables are stored. * The array itself must be allocated by a client. * * @return: * FreeType error code. 0~means success. * * @note: * This function only works with TrueTypeGX fonts, returning an error * otherwise. * * After use, the application should deallocate the buffers pointed to by * each `tables' element, by calling @FT_TrueTypeGX_Free. A NULL value * indicates that the table either doesn't exist in the font, the * application hasn't asked for validation, or the validator doesn't have * the ability to validate the sfnt table. */ FT_EXPORT( FT_Error ) FT_TrueTypeGX_Validate( FT_Face face, FT_UInt validation_flags, FT_Bytes tables[FT_VALIDATE_GX_LENGTH], FT_UInt table_length ); /********************************************************************** * * @function: * FT_TrueTypeGX_Free * * @description: * Free the buffer allocated by TrueTypeGX validator. * * @input: * face :: * A handle to the input face. * * table :: * The pointer to the buffer allocated by * @FT_TrueTypeGX_Validate. * * @note: * This function must be used to free the buffer allocated by * @FT_TrueTypeGX_Validate only. */ FT_EXPORT( void ) FT_TrueTypeGX_Free( FT_Face face, FT_Bytes table ); /********************************************************************** * * @enum: * FT_VALIDATE_CKERNXXX * * @description: * A list of bit-field constants used with @FT_ClassicKern_Validate * to indicate the classic kern dialect or dialects. If the selected * type doesn't fit, @FT_ClassicKern_Validate regards the table as * invalid. * * @values: * FT_VALIDATE_MS :: * Handle the `kern' table as a classic Microsoft kern table. * * FT_VALIDATE_APPLE :: * Handle the `kern' table as a classic Apple kern table. * * FT_VALIDATE_CKERN :: * Handle the `kern' as either classic Apple or Microsoft kern table. */ #define FT_VALIDATE_MS ( FT_VALIDATE_GX_START << 0 ) #define FT_VALIDATE_APPLE ( FT_VALIDATE_GX_START << 1 ) #define FT_VALIDATE_CKERN ( FT_VALIDATE_MS | FT_VALIDATE_APPLE ) /********************************************************************** * * @function: * FT_ClassicKern_Validate * * @description: * Validate classic (16-bit format) kern table to assure that the offsets * and indices are valid. The idea is that a higher-level library that * actually does the text layout can access those tables without error * checking (which can be quite time consuming). * * The `kern' table validator in @FT_TrueTypeGX_Validate deals with both * the new 32-bit format and the classic 16-bit format, while * FT_ClassicKern_Validate only supports the classic 16-bit format. * * @input: * face :: * A handle to the input face. * * validation_flags :: * A bit field that specifies the dialect to be validated. See * @FT_VALIDATE_CKERNXXX for possible values. * * @output: * ckern_table :: * A pointer to the kern table. * * @return: * FreeType error code. 0~means success. * * @note: * After use, the application should deallocate the buffers pointed to by * `ckern_table', by calling @FT_ClassicKern_Free. A NULL value * indicates that the table doesn't exist in the font. */ FT_EXPORT( FT_Error ) FT_ClassicKern_Validate( FT_Face face, FT_UInt validation_flags, FT_Bytes *ckern_table ); /********************************************************************** * * @function: * FT_ClassicKern_Free * * @description: * Free the buffer allocated by classic Kern validator. * * @input: * face :: * A handle to the input face. * * table :: * The pointer to the buffer that is allocated by * @FT_ClassicKern_Validate. * * @note: * This function must be used to free the buffer allocated by * @FT_ClassicKern_Validate only. */ FT_EXPORT( void ) FT_ClassicKern_Free( FT_Face face, FT_Bytes table ); /* */ FT_END_HEADER #endif /* FTGXVAL_H_ */ /* END */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftbdf.h��������������������������������������������������������������������������0000644�����������������00000015211�14763166026�0011545 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftbdf.h */ /* */ /* FreeType API for accessing BDF-specific strings (specification). */ /* */ /* Copyright 2002-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTBDF_H_ #define FTBDF_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* bdf_fonts */ /* */ /* <Title> */ /* BDF and PCF Files */ /* */ /* <Abstract> */ /* BDF and PCF specific API. */ /* */ /* <Description> */ /* This section contains the declaration of functions specific to BDF */ /* and PCF fonts. */ /* */ /*************************************************************************/ /********************************************************************** * * @enum: * BDF_PropertyType * * @description: * A list of BDF property types. * * @values: * BDF_PROPERTY_TYPE_NONE :: * Value~0 is used to indicate a missing property. * * BDF_PROPERTY_TYPE_ATOM :: * Property is a string atom. * * BDF_PROPERTY_TYPE_INTEGER :: * Property is a 32-bit signed integer. * * BDF_PROPERTY_TYPE_CARDINAL :: * Property is a 32-bit unsigned integer. */ typedef enum BDF_PropertyType_ { BDF_PROPERTY_TYPE_NONE = 0, BDF_PROPERTY_TYPE_ATOM = 1, BDF_PROPERTY_TYPE_INTEGER = 2, BDF_PROPERTY_TYPE_CARDINAL = 3 } BDF_PropertyType; /********************************************************************** * * @type: * BDF_Property * * @description: * A handle to a @BDF_PropertyRec structure to model a given * BDF/PCF property. */ typedef struct BDF_PropertyRec_* BDF_Property; /********************************************************************** * * @struct: * BDF_PropertyRec * * @description: * This structure models a given BDF/PCF property. * * @fields: * type :: * The property type. * * u.atom :: * The atom string, if type is @BDF_PROPERTY_TYPE_ATOM. May be * NULL, indicating an empty string. * * u.integer :: * A signed integer, if type is @BDF_PROPERTY_TYPE_INTEGER. * * u.cardinal :: * An unsigned integer, if type is @BDF_PROPERTY_TYPE_CARDINAL. */ typedef struct BDF_PropertyRec_ { BDF_PropertyType type; union { const char* atom; FT_Int32 integer; FT_UInt32 cardinal; } u; } BDF_PropertyRec; /********************************************************************** * * @function: * FT_Get_BDF_Charset_ID * * @description: * Retrieve a BDF font character set identity, according to * the BDF specification. * * @input: * face :: * A handle to the input face. * * @output: * acharset_encoding :: * Charset encoding, as a C~string, owned by the face. * * acharset_registry :: * Charset registry, as a C~string, owned by the face. * * @return: * FreeType error code. 0~means success. * * @note: * This function only works with BDF faces, returning an error otherwise. */ FT_EXPORT( FT_Error ) FT_Get_BDF_Charset_ID( FT_Face face, const char* *acharset_encoding, const char* *acharset_registry ); /********************************************************************** * * @function: * FT_Get_BDF_Property * * @description: * Retrieve a BDF property from a BDF or PCF font file. * * @input: * face :: A handle to the input face. * * name :: The property name. * * @output: * aproperty :: The property. * * @return: * FreeType error code. 0~means success. * * @note: * This function works with BDF _and_ PCF fonts. It returns an error * otherwise. It also returns an error if the property is not in the * font. * * A `property' is a either key-value pair within the STARTPROPERTIES * ... ENDPROPERTIES block of a BDF font or a key-value pair from the * `info->props' array within a `FontRec' structure of a PCF font. * * Integer properties are always stored as `signed' within PCF fonts; * consequently, @BDF_PROPERTY_TYPE_CARDINAL is a possible return value * for BDF fonts only. * * In case of error, `aproperty->type' is always set to * @BDF_PROPERTY_TYPE_NONE. */ FT_EXPORT( FT_Error ) FT_Get_BDF_Property( FT_Face face, const char* prop_name, BDF_PropertyRec *aproperty ); /* */ FT_END_HEADER #endif /* FTBDF_H_ */ /* END */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftsnames.h�����������������������������������������������������������������������0000644�����������������00000040333�14763166026�0012303 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftsnames.h */ /* */ /* Simple interface to access SFNT `name' tables (which are used */ /* to hold font names, copyright info, notices, etc.) (specification). */ /* */ /* This is _not_ used to retrieve glyph names! */ /* */ /* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTSNAMES_H_ #define FTSNAMES_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* sfnt_names */ /* */ /* <Title> */ /* SFNT Names */ /* */ /* <Abstract> */ /* Access the names embedded in TrueType and OpenType files. */ /* */ /* <Description> */ /* The TrueType and OpenType specifications allow the inclusion of */ /* a special names table (`name') in font files. This table contains */ /* textual (and internationalized) information regarding the font, */ /* like family name, copyright, version, etc. */ /* */ /* The definitions below are used to access them if available. */ /* */ /* Note that this has nothing to do with glyph names! */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Struct> */ /* FT_SfntName */ /* */ /* <Description> */ /* A structure used to model an SFNT `name' table entry. */ /* */ /* <Fields> */ /* platform_id :: The platform ID for `string'. */ /* See @TT_PLATFORM_XXX for possible values. */ /* */ /* encoding_id :: The encoding ID for `string'. */ /* See @TT_APPLE_ID_XXX, @TT_MAC_ID_XXX, */ /* @TT_ISO_ID_XXX, @TT_MS_ID_XXX, and @TT_ADOBE_ID_XXX */ /* for possible values. */ /* */ /* language_id :: The language ID for `string'. */ /* See @TT_MAC_LANGID_XXX and @TT_MS_LANGID_XXX for */ /* possible values. */ /* */ /* Registered OpenType values for `language_id' are */ /* always smaller than 0x8000; values equal or larger */ /* than 0x8000 usually indicate a language tag string */ /* (introduced in OpenType version 1.6). Use function */ /* @FT_Get_Sfnt_LangTag with `language_id' as its */ /* argument to retrieve the associated language tag. */ /* */ /* name_id :: An identifier for `string'. */ /* See @TT_NAME_ID_XXX for possible values. */ /* */ /* string :: The `name' string. Note that its format differs */ /* depending on the (platform,encoding) pair, being */ /* either a string of bytes (without a terminating */ /* NULL byte) or containing UTF-16BE entities. */ /* */ /* string_len :: The length of `string' in bytes. */ /* */ /* <Note> */ /* Please refer to the TrueType or OpenType specification for more */ /* details. */ /* */ typedef struct FT_SfntName_ { FT_UShort platform_id; FT_UShort encoding_id; FT_UShort language_id; FT_UShort name_id; FT_Byte* string; /* this string is *not* null-terminated! */ FT_UInt string_len; /* in bytes */ } FT_SfntName; /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_Sfnt_Name_Count */ /* */ /* <Description> */ /* Retrieve the number of name strings in the SFNT `name' table. */ /* */ /* <Input> */ /* face :: A handle to the source face. */ /* */ /* <Return> */ /* The number of strings in the `name' table. */ /* */ FT_EXPORT( FT_UInt ) FT_Get_Sfnt_Name_Count( FT_Face face ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_Sfnt_Name */ /* */ /* <Description> */ /* Retrieve a string of the SFNT `name' table for a given index. */ /* */ /* <Input> */ /* face :: A handle to the source face. */ /* */ /* idx :: The index of the `name' string. */ /* */ /* <Output> */ /* aname :: The indexed @FT_SfntName structure. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* The `string' array returned in the `aname' structure is not */ /* null-terminated. Note that you don't have to deallocate `string' */ /* by yourself; FreeType takes care of it if you call @FT_Done_Face. */ /* */ /* Use @FT_Get_Sfnt_Name_Count to get the total number of available */ /* `name' table entries, then do a loop until you get the right */ /* platform, encoding, and name ID. */ /* */ /* `name' table format~1 entries can use language tags also, see */ /* @FT_Get_Sfnt_LangTag. */ /* */ FT_EXPORT( FT_Error ) FT_Get_Sfnt_Name( FT_Face face, FT_UInt idx, FT_SfntName *aname ); /*************************************************************************/ /* */ /* <Struct> */ /* FT_SfntLangTag */ /* */ /* <Description> */ /* A structure to model a language tag entry from an SFNT `name' */ /* table. */ /* */ /* <Fields> */ /* string :: The language tag string, encoded in UTF-16BE */ /* (without trailing NULL bytes). */ /* */ /* string_len :: The length of `string' in *bytes*. */ /* */ /* <Note> */ /* Please refer to the TrueType or OpenType specification for more */ /* details. */ /* */ typedef struct FT_SfntLangTag_ { FT_Byte* string; /* this string is *not* null-terminated! */ FT_UInt string_len; /* in bytes */ } FT_SfntLangTag; /*************************************************************************/ /* */ /* <Function> */ /* FT_Get_Sfnt_LangTag */ /* */ /* <Description> */ /* Retrieve the language tag associated with a language ID of an SFNT */ /* `name' table entry. */ /* */ /* <Input> */ /* face :: A handle to the source face. */ /* */ /* langID :: The language ID, as returned by @FT_Get_Sfnt_Name. */ /* This is always a value larger than 0x8000. */ /* */ /* <Output> */ /* alangTag :: The language tag associated with the `name' table */ /* entry's language ID. */ /* */ /* <Return> */ /* FreeType error code. 0~means success. */ /* */ /* <Note> */ /* The `string' array returned in the `alangTag' structure is not */ /* null-terminated. Note that you don't have to deallocate `string' */ /* by yourself; FreeType takes care of it if you call @FT_Done_Face. */ /* */ /* Only `name' table format~1 supports language tags. For format~0 */ /* tables, this function always returns FT_Err_Invalid_Table. For */ /* invalid format~1 language ID values, FT_Err_Invalid_Argument is */ /* returned. */ /* */ FT_EXPORT( FT_Error ) FT_Get_Sfnt_LangTag( FT_Face face, FT_UInt langID, FT_SfntLangTag *alangTag ); /*************************************************************************** * * @constant: * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY * * @description: * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic * family names in the `name' table (introduced in OpenType version * 1.4). Use this for backward compatibility with legacy systems that * have a four-faces-per-family restriction. * */ #define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY \ FT_MAKE_TAG( 'i', 'g', 'p', 'f' ) /* this constant is deprecated */ #define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY \ FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY /*************************************************************************** * * @constant: * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY * * @description: * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic * subfamily names in the `name' table (introduced in OpenType version * 1.4). Use this for backward compatibility with legacy systems that * have a four-faces-per-family restriction. * */ #define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY \ FT_MAKE_TAG( 'i', 'g', 'p', 's' ) /* this constant is deprecated */ #define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY \ FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY /* */ FT_END_HEADER #endif /* FTSNAMES_H_ */ /* END */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������freetype2/freetype/ftttdrv.h������������������������������������������������������������������������0000644�����������������00000036210�14763166026�0012157 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* */ /* ftttdrv.h */ /* */ /* FreeType API for controlling the TrueType driver */ /* (specification only). */ /* */ /* Copyright 2013-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTTTDRV_H_ #define FTTTDRV_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" #error "Please fix the directory search order for header files" #error "so that freetype.h of FreeType 2 is found first." #endif FT_BEGIN_HEADER /************************************************************************** * * @section: * tt_driver * * @title: * The TrueType driver * * @abstract: * Controlling the TrueType driver module. * * @description: * While FreeType's TrueType driver doesn't expose API functions by * itself, it is possible to control its behaviour with @FT_Property_Set * and @FT_Property_Get. The following lists the available properties * together with the necessary macros and structures. * * The TrueType driver's module name is `truetype'. * * We start with a list of definitions, kindly provided by Greg * Hitchcock. * * _Bi-Level_ _Rendering_ * * Monochromatic rendering, exclusively used in the early days of * TrueType by both Apple and Microsoft. Microsoft's GDI interface * supported hinting of the right-side bearing point, such that the * advance width could be non-linear. Most often this was done to * achieve some level of glyph symmetry. To enable reasonable * performance (e.g., not having to run hinting on all glyphs just to * get the widths) there was a bit in the head table indicating if the * side bearing was hinted, and additional tables, `hdmx' and `LTSH', to * cache hinting widths across multiple sizes and device aspect ratios. * * _Font_ _Smoothing_ * * Microsoft's GDI implementation of anti-aliasing. Not traditional * anti-aliasing as the outlines were hinted before the sampling. The * widths matched the bi-level rendering. * * _ClearType_ _Rendering_ * * Technique that uses physical subpixels to improve rendering on LCD * (and other) displays. Because of the higher resolution, many methods * of improving symmetry in glyphs through hinting the right-side * bearing were no longer necessary. This lead to what GDI calls * `natural widths' ClearType, see * http://www.beatstamm.com/typography/RTRCh4.htm#Sec21. Since hinting * has extra resolution, most non-linearity went away, but it is still * possible for hints to change the advance widths in this mode. * * _ClearType_ _Compatible_ _Widths_ * * One of the earliest challenges with ClearType was allowing the * implementation in GDI to be selected without requiring all UI and * documents to reflow. To address this, a compatible method of * rendering ClearType was added where the font hints are executed once * to determine the width in bi-level rendering, and then re-run in * ClearType, with the difference in widths being absorbed in the font * hints for ClearType (mostly in the white space of hints); see * http://www.beatstamm.com/typography/RTRCh4.htm#Sec20. Somewhat by * definition, compatible width ClearType allows for non-linear widths, * but only when the bi-level version has non-linear widths. * * _ClearType_ _Subpixel_ _Positioning_ * * One of the nice benefits of ClearType is the ability to more crisply * display fractional widths; unfortunately, the GDI model of integer * bitmaps did not support this. However, the WPF and Direct Write * frameworks do support fractional widths. DWrite calls this `natural * mode', not to be confused with GDI's `natural widths'. Subpixel * positioning, in the current implementation of Direct Write, * unfortunately does not support hinted advance widths, see * http://www.beatstamm.com/typography/RTRCh4.htm#Sec22. Note that the * TrueType interpreter fully allows the advance width to be adjusted in * this mode, just the DWrite client will ignore those changes. * * _ClearType_ _Backward_ _Compatibility_ * * This is a set of exceptions made in the TrueType interpreter to * minimize hinting techniques that were problematic with the extra * resolution of ClearType; see * http://www.beatstamm.com/typography/RTRCh4.htm#Sec1 and * http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx. * This technique is not to be confused with ClearType compatible * widths. ClearType backward compatibility has no direct impact on * changing advance widths, but there might be an indirect impact on * disabling some deltas. This could be worked around in backward * compatibility mode. * * _Native_ _ClearType_ _Mode_ * * (Not to be confused with `natural widths'.) This mode removes all * the exceptions in the TrueType interpreter when running with * ClearType. Any issues on widths would still apply, though. * */ /************************************************************************** * * @property: * interpreter-version * * @description: * Currently, three versions are available, two representing the * bytecode interpreter with subpixel hinting support (old `Infinality' * code and new stripped-down and higher performance `minimal' code) and * one without, respectively. The default is subpixel support if * TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined, and no subpixel support * otherwise (since it isn't available then). * * If subpixel hinting is on, many TrueType bytecode instructions behave * differently compared to B/W or grayscale rendering (except if `native * ClearType' is selected by the font). Microsoft's main idea is to * render at a much increased horizontal resolution, then sampling down * the created output to subpixel precision. However, many older fonts * are not suited to this and must be specially taken care of by * applying (hardcoded) tweaks in Microsoft's interpreter. * * Details on subpixel hinting and some of the necessary tweaks can be * found in Greg Hitchcock's whitepaper at * `http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'. * Note that FreeType currently doesn't really `subpixel hint' (6x1, 6x2, * or 6x5 supersampling) like discussed in the paper. Depending on the * chosen interpreter, it simply ignores instructions on vertical stems * to arrive at very similar results. * * The following example code demonstrates how to deactivate subpixel * hinting (omitting the error handling). * * { * FT_Library library; * FT_Face face; * FT_UInt interpreter_version = TT_INTERPRETER_VERSION_35; * * * FT_Init_FreeType( &library ); * * FT_Property_Set( library, "truetype", * "interpreter-version", * &interpreter_version ); * } * * @note: * This property can be used with @FT_Property_Get also. * * This property can be set via the `FREETYPE_PROPERTIES' environment * variable (using values `35', `38', or `40'). */ /************************************************************************** * * @enum: * TT_INTERPRETER_VERSION_XXX * * @description: * A list of constants used for the @interpreter-version property to * select the hinting engine for Truetype fonts. * * The numeric value in the constant names represents the version * number as returned by the `GETINFO' bytecode instruction. * * @values: * TT_INTERPRETER_VERSION_35 :: * Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in * Windows~98; only grayscale and B/W rasterizing is supported. * * TT_INTERPRETER_VERSION_38 :: * Version~38 corresponds to MS rasterizer v.1.9; it is roughly * equivalent to the hinting provided by DirectWrite ClearType (as can * be found, for example, in the Internet Explorer~9 running on * Windows~7). It is used in FreeType to select the `Infinality' * subpixel hinting code. The code may be removed in a future * version. * * TT_INTERPRETER_VERSION_40 :: * Version~40 corresponds to MS rasterizer v.2.1; it is roughly * equivalent to the hinting provided by DirectWrite ClearType (as can * be found, for example, in Microsoft's Edge Browser on Windows~10). * It is used in FreeType to select the `minimal' subpixel hinting * code, a stripped-down and higher performance version of the * `Infinality' code. * * @note: * This property controls the behaviour of the bytecode interpreter * and thus how outlines get hinted. It does *not* control how glyph * get rasterized! In particular, it does not control subpixel color * filtering. * * If FreeType has not been compiled with the configuration option * TT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version~38 or~40 causes * an `FT_Err_Unimplemented_Feature' error. * * Depending on the graphics framework, Microsoft uses different * bytecode and rendering engines. As a consequence, the version * numbers returned by a call to the `GETINFO' bytecode instruction are * more convoluted than desired. * * Here are two tables that try to shed some light on the possible * values for the MS rasterizer engine, together with the additional * features introduced by it. * * { * GETINFO framework version feature * ------------------------------------------------------------------- * 3 GDI (Win 3.1), v1.0 16-bit, first version * TrueImage * 33 GDI (Win NT 3.1), v1.5 32-bit * HP Laserjet * 34 GDI (Win 95) v1.6 font smoothing, * new SCANTYPE opcode * 35 GDI (Win 98/2000) v1.7 (UN)SCALED_COMPONENT_OFFSET * bits in composite glyphs * 36 MGDI (Win CE 2) v1.6+ classic ClearType * 37 GDI (XP and later), v1.8 ClearType * GDI+ old (before Vista) * 38 GDI+ old (Vista, Win 7), v1.9 subpixel ClearType, * WPF Y-direction ClearType, * additional error checking * 39 DWrite (before Win 8) v2.0 subpixel ClearType flags * in GETINFO opcode, * bug fixes * 40 GDI+ (after Win 7), v2.1 Y-direction ClearType flag * DWrite (Win 8) in GETINFO opcode, * Gray ClearType * } * * The `version' field gives a rough orientation only, since some * applications provided certain features much earlier (as an example, * Microsoft Reader used subpixel and Y-direction ClearType already in * Windows 2000). Similarly, updates to a given framework might include * improved hinting support. * * { * version sampling rendering comment * x y x y * -------------------------------------------------------------- * v1.0 normal normal B/W B/W bi-level * v1.6 high high gray gray grayscale * v1.8 high normal color-filter B/W (GDI) ClearType * v1.9 high high color-filter gray Color ClearType * v2.1 high normal gray B/W Gray ClearType * v2.1 high high gray gray Gray ClearType * } * * Color and Gray ClearType are the two available variants of * `Y-direction ClearType', meaning grayscale rasterization along the * Y-direction; the name used in the TrueType specification for this * feature is `symmetric smoothing'. `Classic ClearType' is the * original algorithm used before introducing a modified version in * Win~XP. Another name for v1.6's grayscale rendering is `font * smoothing', and `Color ClearType' is sometimes also called `DWrite * ClearType'. To differentiate between today's Color ClearType and the * earlier ClearType variant with B/W rendering along the vertical axis, * the latter is sometimes called `GDI ClearType'. * * `Normal' and `high' sampling describe the (virtual) resolution to * access the rasterized outline after the hinting process. `Normal' * means 1 sample per grid line (i.e., B/W). In the current Microsoft * implementation, `high' means an extra virtual resolution of 16x16 (or * 16x1) grid lines per pixel for bytecode instructions like `MIRP'. * After hinting, these 16 grid lines are mapped to 6x5 (or 6x1) grid * lines for color filtering if Color ClearType is activated. * * Note that `Gray ClearType' is essentially the same as v1.6's * grayscale rendering. However, the GETINFO instruction handles it * differently: v1.6 returns bit~12 (hinting for grayscale), while v2.1 * returns bits~13 (hinting for ClearType), 18 (symmetrical smoothing), * and~19 (Gray ClearType). Also, this mode respects bits 2 and~3 for * the version~1 gasp table exclusively (like Color ClearType), while * v1.6 only respects the values of version~0 (bits 0 and~1). * * Keep in mind that the features of the above interpreter versions * might not map exactly to FreeType features or behavior because it is * a fundamentally different library with different internals. * */ #define TT_INTERPRETER_VERSION_35 35 #define TT_INTERPRETER_VERSION_38 38 #define TT_INTERPRETER_VERSION_40 40 /* */ FT_END_HEADER #endif /* FTTTDRV_H_ */ /* END */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������menu.h����������������������������������������������������������������������������������������������0000644�����������������00000027256�14763166026�0005710 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/**************************************************************************** * Copyright (c) 1998-2007,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /**************************************************************************** * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ /* $Id: menu.h,v 1.20 2009/04/05 00:28:07 tom Exp $ */ #ifndef ETI_MENU #define ETI_MENU #ifdef AMIGA #define TEXT TEXT_ncurses #endif #include <curses.h> #include <eti.h> #ifdef __cplusplus extern "C" { #endif typedef int Menu_Options; typedef int Item_Options; /* Menu options: */ #define O_ONEVALUE (0x01) #define O_SHOWDESC (0x02) #define O_ROWMAJOR (0x04) #define O_IGNORECASE (0x08) #define O_SHOWMATCH (0x10) #define O_NONCYCLIC (0x20) /* Item options: */ #define O_SELECTABLE (0x01) typedef struct { const char* str; unsigned short length; } TEXT; typedef struct tagITEM { TEXT name; /* name of menu item */ TEXT description; /* description of item, optional in display */ struct tagMENU *imenu; /* Pointer to parent menu */ void *userptr; /* Pointer to user defined per item data */ Item_Options opt; /* Item options */ short index; /* Item number if connected to a menu */ short y; /* y and x location of item in menu */ short x; bool value; /* Selection value */ struct tagITEM *left; /* neighbor items */ struct tagITEM *right; struct tagITEM *up; struct tagITEM *down; } ITEM; typedef void (*Menu_Hook)(struct tagMENU *); typedef struct tagMENU { short height; /* Nr. of chars high */ short width; /* Nr. of chars wide */ short rows; /* Nr. of items high */ short cols; /* Nr. of items wide */ short frows; /* Nr. of formatted items high */ short fcols; /* Nr. of formatted items wide */ short arows; /* Nr. of items high (actual) */ short namelen; /* Max. name length */ short desclen; /* Max. description length */ short marklen; /* Length of mark, if any */ short itemlen; /* Length of one item */ short spc_desc; /* Spacing for descriptor */ short spc_cols; /* Spacing for columns */ short spc_rows; /* Spacing for rows */ char *pattern; /* Buffer to store match chars */ short pindex; /* Index into pattern buffer */ WINDOW *win; /* Window containing menu */ WINDOW *sub; /* Subwindow for menu display */ WINDOW *userwin; /* User's window */ WINDOW *usersub; /* User's subwindow */ ITEM **items; /* array of items */ short nitems; /* Nr. of items in menu */ ITEM *curitem; /* Current item */ short toprow; /* Top row of menu */ chtype fore; /* Selection attribute */ chtype back; /* Nonselection attribute */ chtype grey; /* Inactive attribute */ unsigned char pad; /* Pad character */ Menu_Hook menuinit; /* User hooks */ Menu_Hook menuterm; Menu_Hook iteminit; Menu_Hook itemterm; void *userptr; /* Pointer to menus user data */ char *mark; /* Pointer to marker string */ Menu_Options opt; /* Menu options */ unsigned short status; /* Internal state of menu */ } MENU; /* Define keys */ #define REQ_LEFT_ITEM (KEY_MAX + 1) #define REQ_RIGHT_ITEM (KEY_MAX + 2) #define REQ_UP_ITEM (KEY_MAX + 3) #define REQ_DOWN_ITEM (KEY_MAX + 4) #define REQ_SCR_ULINE (KEY_MAX + 5) #define REQ_SCR_DLINE (KEY_MAX + 6) #define REQ_SCR_DPAGE (KEY_MAX + 7) #define REQ_SCR_UPAGE (KEY_MAX + 8) #define REQ_FIRST_ITEM (KEY_MAX + 9) #define REQ_LAST_ITEM (KEY_MAX + 10) #define REQ_NEXT_ITEM (KEY_MAX + 11) #define REQ_PREV_ITEM (KEY_MAX + 12) #define REQ_TOGGLE_ITEM (KEY_MAX + 13) #define REQ_CLEAR_PATTERN (KEY_MAX + 14) #define REQ_BACK_PATTERN (KEY_MAX + 15) #define REQ_NEXT_MATCH (KEY_MAX + 16) #define REQ_PREV_MATCH (KEY_MAX + 17) #define MIN_MENU_COMMAND (KEY_MAX + 1) #define MAX_MENU_COMMAND (KEY_MAX + 17) /* * Some AT&T code expects MAX_COMMAND to be out-of-band not * just for menu commands but for forms ones as well. */ #if defined(MAX_COMMAND) # if (MAX_MENU_COMMAND > MAX_COMMAND) # error Something is wrong -- MAX_MENU_COMMAND is greater than MAX_COMMAND # elif (MAX_COMMAND != (KEY_MAX + 128)) # error Something is wrong -- MAX_COMMAND is already inconsistently defined. # endif #else # define MAX_COMMAND (KEY_MAX + 128) #endif /* --------- prototypes for libmenu functions ----------------------------- */ extern NCURSES_EXPORT(ITEM **) menu_items (const MENU *); extern NCURSES_EXPORT(ITEM *) current_item (const MENU *); extern NCURSES_EXPORT(ITEM *) new_item (const char *,const char *); extern NCURSES_EXPORT(MENU *) new_menu (ITEM **); extern NCURSES_EXPORT(Item_Options) item_opts (const ITEM *); extern NCURSES_EXPORT(Menu_Options) menu_opts (const MENU *); extern NCURSES_EXPORT(Menu_Hook) item_init (const MENU *); extern NCURSES_EXPORT(Menu_Hook) item_term (const MENU *); extern NCURSES_EXPORT(Menu_Hook) menu_init (const MENU *); extern NCURSES_EXPORT(Menu_Hook) menu_term (const MENU *); extern NCURSES_EXPORT(WINDOW *) menu_sub (const MENU *); extern NCURSES_EXPORT(WINDOW *) menu_win (const MENU *); extern NCURSES_EXPORT(const char *) item_description (const ITEM *); extern NCURSES_EXPORT(const char *) item_name (const ITEM *); extern NCURSES_EXPORT(const char *) menu_mark (const MENU *); extern NCURSES_EXPORT(const char *) menu_request_name (int); extern NCURSES_EXPORT(char *) menu_pattern (const MENU *); extern NCURSES_EXPORT(void *) menu_userptr (const MENU *); extern NCURSES_EXPORT(void *) item_userptr (const ITEM *); extern NCURSES_EXPORT(chtype) menu_back (const MENU *); extern NCURSES_EXPORT(chtype) menu_fore (const MENU *); extern NCURSES_EXPORT(chtype) menu_grey (const MENU *); extern NCURSES_EXPORT(int) free_item (ITEM *); extern NCURSES_EXPORT(int) free_menu (MENU *); extern NCURSES_EXPORT(int) item_count (const MENU *); extern NCURSES_EXPORT(int) item_index (const ITEM *); extern NCURSES_EXPORT(int) item_opts_off (ITEM *,Item_Options); extern NCURSES_EXPORT(int) item_opts_on (ITEM *,Item_Options); extern NCURSES_EXPORT(int) menu_driver (MENU *,int); extern NCURSES_EXPORT(int) menu_opts_off (MENU *,Menu_Options); extern NCURSES_EXPORT(int) menu_opts_on (MENU *,Menu_Options); extern NCURSES_EXPORT(int) menu_pad (const MENU *); extern NCURSES_EXPORT(int) pos_menu_cursor (const MENU *); extern NCURSES_EXPORT(int) post_menu (MENU *); extern NCURSES_EXPORT(int) scale_menu (const MENU *,int *,int *); extern NCURSES_EXPORT(int) set_current_item (MENU *menu,ITEM *item); extern NCURSES_EXPORT(int) set_item_init (MENU *, Menu_Hook); extern NCURSES_EXPORT(int) set_item_opts (ITEM *,Item_Options); extern NCURSES_EXPORT(int) set_item_term (MENU *, Menu_Hook); extern NCURSES_EXPORT(int) set_item_userptr (ITEM *, void *); extern NCURSES_EXPORT(int) set_item_value (ITEM *,bool); extern NCURSES_EXPORT(int) set_menu_back (MENU *,chtype); extern NCURSES_EXPORT(int) set_menu_fore (MENU *,chtype); extern NCURSES_EXPORT(int) set_menu_format (MENU *,int,int); extern NCURSES_EXPORT(int) set_menu_grey (MENU *,chtype); extern NCURSES_EXPORT(int) set_menu_init (MENU *, Menu_Hook); extern NCURSES_EXPORT(int) set_menu_items (MENU *,ITEM **); extern NCURSES_EXPORT(int) set_menu_mark (MENU *, const char *); extern NCURSES_EXPORT(int) set_menu_opts (MENU *,Menu_Options); extern NCURSES_EXPORT(int) set_menu_pad (MENU *,int); extern NCURSES_EXPORT(int) set_menu_pattern (MENU *,const char *); extern NCURSES_EXPORT(int) set_menu_sub (MENU *,WINDOW *); extern NCURSES_EXPORT(int) set_menu_term (MENU *, Menu_Hook); extern NCURSES_EXPORT(int) set_menu_userptr (MENU *,void *); extern NCURSES_EXPORT(int) set_menu_win (MENU *,WINDOW *); extern NCURSES_EXPORT(int) set_top_row (MENU *,int); extern NCURSES_EXPORT(int) top_row (const MENU *); extern NCURSES_EXPORT(int) unpost_menu (MENU *); extern NCURSES_EXPORT(int) menu_request_by_name (const char *); extern NCURSES_EXPORT(int) set_menu_spacing (MENU *,int,int,int); extern NCURSES_EXPORT(int) menu_spacing (const MENU *,int *,int *,int *); extern NCURSES_EXPORT(bool) item_value (const ITEM *); extern NCURSES_EXPORT(bool) item_visible (const ITEM *); extern NCURSES_EXPORT(void) menu_format (const MENU *,int *,int *); #if NCURSES_SP_FUNCS extern NCURSES_EXPORT(MENU *) NCURSES_SP_NAME(new_menu) (SCREEN*, ITEM **); #endif #ifdef __cplusplus } #endif #endif /* ETI_MENU */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������stdio.h���������������������������������������������������������������������������������������������0000644�����������������00000075631�14763166026�0006066 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Define ISO C stdio on top of C++ iostreams. Copyright (C) 1991, 1994-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 Standard: 7.19 Input/output <stdio.h> */ #ifndef _STDIO_H #if !defined __need_FILE && !defined __need___FILE # define _STDIO_H 1 # include <features.h> __BEGIN_DECLS # define __need_size_t # define __need_NULL # include <stddef.h> # include <bits/types.h> # define __need_FILE # define __need___FILE #endif /* Don't need FILE. */ #if !defined __FILE_defined && defined __need_FILE /* Define outside of namespace so the C++ is happy. */ struct _IO_FILE; __BEGIN_NAMESPACE_STD /* The opaque type of streams. This is the definition used elsewhere. */ typedef struct _IO_FILE FILE; __END_NAMESPACE_STD #if defined __USE_LARGEFILE64 || defined __USE_SVID || defined __USE_POSIX \ || defined __USE_BSD || defined __USE_ISOC99 || defined __USE_XOPEN \ || defined __USE_POSIX2 __USING_NAMESPACE_STD(FILE) #endif # define __FILE_defined 1 #endif /* FILE not defined. */ #undef __need_FILE #if !defined ____FILE_defined && defined __need___FILE /* The opaque type of streams. This is the definition used elsewhere. */ typedef struct _IO_FILE __FILE; # define ____FILE_defined 1 #endif /* __FILE not defined. */ #undef __need___FILE #ifdef _STDIO_H #define _STDIO_USES_IOSTREAM #include <libio.h> #if defined __USE_XOPEN || defined __USE_XOPEN2K8 # ifdef __GNUC__ # ifndef _VA_LIST_DEFINED typedef _G_va_list va_list; # define _VA_LIST_DEFINED # endif # else # include <stdarg.h> # endif #endif #ifdef __USE_XOPEN2K8 # ifndef __off_t_defined # ifndef __USE_FILE_OFFSET64 typedef __off_t off_t; # else typedef __off64_t off_t; # endif # define __off_t_defined # endif # if defined __USE_LARGEFILE64 && !defined __off64_t_defined typedef __off64_t off64_t; # define __off64_t_defined # endif # ifndef __ssize_t_defined typedef __ssize_t ssize_t; # define __ssize_t_defined # endif #endif /* The type of the second argument to `fgetpos' and `fsetpos'. */ __BEGIN_NAMESPACE_STD #ifndef __USE_FILE_OFFSET64 typedef _G_fpos_t fpos_t; #else typedef _G_fpos64_t fpos_t; #endif __END_NAMESPACE_STD #ifdef __USE_LARGEFILE64 typedef _G_fpos64_t fpos64_t; #endif /* The possibilities for the third argument to `setvbuf'. */ #define _IOFBF 0 /* Fully buffered. */ #define _IOLBF 1 /* Line buffered. */ #define _IONBF 2 /* No buffering. */ /* Default buffer size. */ #ifndef BUFSIZ # define BUFSIZ _IO_BUFSIZ #endif /* End of file character. Some things throughout the library rely on this being -1. */ #ifndef EOF # define EOF (-1) #endif /* The possibilities for the third argument to `fseek'. These values should not be changed. */ #define SEEK_SET 0 /* Seek from beginning of file. */ #define SEEK_CUR 1 /* Seek from current position. */ #define SEEK_END 2 /* Seek from end of file. */ #ifdef __USE_GNU # define SEEK_DATA 3 /* Seek to next data. */ # define SEEK_HOLE 4 /* Seek to next hole. */ #endif #if defined __USE_SVID || defined __USE_XOPEN /* Default path prefix for `tempnam' and `tmpnam'. */ # define P_tmpdir "/tmp" #endif /* Get the values: L_tmpnam How long an array of chars must be to be passed to `tmpnam'. TMP_MAX The minimum number of unique filenames generated by tmpnam (and tempnam when it uses tmpnam's name space), or tempnam (the two are separate). L_ctermid How long an array to pass to `ctermid'. L_cuserid How long an array to pass to `cuserid'. FOPEN_MAX Minimum number of files that can be open at once. FILENAME_MAX Maximum length of a filename. */ #include <bits/stdio_lim.h> /* Standard streams. */ extern struct _IO_FILE *stdin; /* Standard input stream. */ extern struct _IO_FILE *stdout; /* Standard output stream. */ extern struct _IO_FILE *stderr; /* Standard error output stream. */ /* C89/C99 say they're macros. Make them happy. */ #define stdin stdin #define stdout stdout #define stderr stderr __BEGIN_NAMESPACE_STD /* Remove file FILENAME. */ extern int remove (const char *__filename) __THROW; /* Rename file OLD to NEW. */ extern int rename (const char *__old, const char *__new) __THROW; __END_NAMESPACE_STD #ifdef __USE_ATFILE /* Rename file OLD relative to OLDFD to NEW relative to NEWFD. */ extern int renameat (int __oldfd, const char *__old, int __newfd, const char *__new) __THROW; #endif __BEGIN_NAMESPACE_STD /* Create a temporary file and open it read/write. This function is a possible cancellation point and therefore not marked with __THROW. */ #ifndef __USE_FILE_OFFSET64 extern FILE *tmpfile (void) __wur; #else # ifdef __REDIRECT extern FILE *__REDIRECT (tmpfile, (void), tmpfile64) __wur; # else # define tmpfile tmpfile64 # endif #endif #ifdef __USE_LARGEFILE64 extern FILE *tmpfile64 (void) __wur; #endif /* Generate a temporary filename. */ extern char *tmpnam (char *__s) __THROW __wur; __END_NAMESPACE_STD #ifdef __USE_MISC /* This is the reentrant variant of `tmpnam'. The only difference is that it does not allow S to be NULL. */ extern char *tmpnam_r (char *__s) __THROW __wur; #endif #if defined __USE_SVID || defined __USE_XOPEN /* Generate a unique temporary filename using up to five characters of PFX if it is not NULL. The directory to put this file in is searched for as follows: First the environment variable "TMPDIR" is checked. If it contains the name of a writable directory, that directory is used. If not and if DIR is not NULL, that value is checked. If that fails, P_tmpdir is tried and finally "/tmp". The storage for the filename is allocated by `malloc'. */ extern char *tempnam (const char *__dir, const char *__pfx) __THROW __attribute_malloc__ __wur; #endif __BEGIN_NAMESPACE_STD /* Close STREAM. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int fclose (FILE *__stream); /* Flush STREAM, or all streams if STREAM is NULL. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int fflush (FILE *__stream); __END_NAMESPACE_STD #ifdef __USE_MISC /* Faster versions when locking is not required. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int fflush_unlocked (FILE *__stream); #endif #ifdef __USE_GNU /* Close all streams. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int fcloseall (void); #endif __BEGIN_NAMESPACE_STD #ifndef __USE_FILE_OFFSET64 /* Open a file and create a new stream for it. This function is a possible cancellation point and therefore not marked with __THROW. */ extern FILE *fopen (const char *__restrict __filename, const char *__restrict __modes) __wur; /* Open a file, replacing an existing stream with it. This function is a possible cancellation point and therefore not marked with __THROW. */ extern FILE *freopen (const char *__restrict __filename, const char *__restrict __modes, FILE *__restrict __stream) __wur; #else # ifdef __REDIRECT extern FILE *__REDIRECT (fopen, (const char *__restrict __filename, const char *__restrict __modes), fopen64) __wur; extern FILE *__REDIRECT (freopen, (const char *__restrict __filename, const char *__restrict __modes, FILE *__restrict __stream), freopen64) __wur; # else # define fopen fopen64 # define freopen freopen64 # endif #endif __END_NAMESPACE_STD #ifdef __USE_LARGEFILE64 extern FILE *fopen64 (const char *__restrict __filename, const char *__restrict __modes) __wur; extern FILE *freopen64 (const char *__restrict __filename, const char *__restrict __modes, FILE *__restrict __stream) __wur; #endif #ifdef __USE_POSIX /* Create a new stream that refers to an existing system file descriptor. */ extern FILE *fdopen (int __fd, const char *__modes) __THROW __wur; #endif #ifdef __USE_GNU /* Create a new stream that refers to the given magic cookie, and uses the given functions for input and output. */ extern FILE *fopencookie (void *__restrict __magic_cookie, const char *__restrict __modes, _IO_cookie_io_functions_t __io_funcs) __THROW __wur; #endif #ifdef __USE_XOPEN2K8 /* Create a new stream that refers to a memory buffer. */ extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) __THROW __wur; /* Open a stream that writes into a malloc'd buffer that is expanded as necessary. *BUFLOC and *SIZELOC are updated with the buffer's location and the number of characters written on fflush or fclose. */ extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW __wur; #endif __BEGIN_NAMESPACE_STD /* If BUF is NULL, make STREAM unbuffered. Else make it use buffer BUF, of size BUFSIZ. */ extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW; /* Make STREAM use buffering mode MODE. If BUF is not NULL, use N bytes of it for buffering; else allocate an internal buffer N bytes long. */ extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, int __modes, size_t __n) __THROW; __END_NAMESPACE_STD #ifdef __USE_BSD /* If BUF is NULL, make STREAM unbuffered. Else make it use SIZE bytes of BUF for buffering. */ extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, size_t __size) __THROW; /* Make STREAM line-buffered. */ extern void setlinebuf (FILE *__stream) __THROW; #endif __BEGIN_NAMESPACE_STD /* Write formatted output to STREAM. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int fprintf (FILE *__restrict __stream, const char *__restrict __format, ...); /* Write formatted output to stdout. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int printf (const char *__restrict __format, ...); /* Write formatted output to S. */ extern int sprintf (char *__restrict __s, const char *__restrict __format, ...) __THROWNL; /* Write formatted output to S from argument list ARG. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, _G_va_list __arg); /* Write formatted output to stdout from argument list ARG. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int vprintf (const char *__restrict __format, _G_va_list __arg); /* Write formatted output to S from argument list ARG. */ extern int vsprintf (char *__restrict __s, const char *__restrict __format, _G_va_list __arg) __THROWNL; __END_NAMESPACE_STD #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98 __BEGIN_NAMESPACE_C99 /* Maximum chars of output to write in MAXLEN. */ extern int snprintf (char *__restrict __s, size_t __maxlen, const char *__restrict __format, ...) __THROWNL __attribute__ ((__format__ (__printf__, 3, 4))); extern int vsnprintf (char *__restrict __s, size_t __maxlen, const char *__restrict __format, _G_va_list __arg) __THROWNL __attribute__ ((__format__ (__printf__, 3, 0))); __END_NAMESPACE_C99 #endif #ifdef __USE_GNU /* Write formatted output to a string dynamically allocated with `malloc'. Store the address of the string in *PTR. */ extern int vasprintf (char **__restrict __ptr, const char *__restrict __f, _G_va_list __arg) __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur; extern int __asprintf (char **__restrict __ptr, const char *__restrict __fmt, ...) __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur; extern int asprintf (char **__restrict __ptr, const char *__restrict __fmt, ...) __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur; #endif #ifdef __USE_XOPEN2K8 /* Write formatted output to a file descriptor. */ extern int vdprintf (int __fd, const char *__restrict __fmt, _G_va_list __arg) __attribute__ ((__format__ (__printf__, 2, 0))); extern int dprintf (int __fd, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); #endif __BEGIN_NAMESPACE_STD /* Read formatted input from STREAM. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __wur; /* Read formatted input from stdin. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int scanf (const char *__restrict __format, ...) __wur; /* Read formatted input from S. */ extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __THROW; #if defined __USE_ISOC99 && !defined __USE_GNU \ && (!defined __LDBL_COMPAT || !defined __REDIRECT) \ && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) # ifdef __REDIRECT /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[ GNU extension which conflicts with valid %a followed by letter s, S or [. */ extern int __REDIRECT (fscanf, (FILE *__restrict __stream, const char *__restrict __format, ...), __isoc99_fscanf) __wur; extern int __REDIRECT (scanf, (const char *__restrict __format, ...), __isoc99_scanf) __wur; extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s, const char *__restrict __format, ...), __isoc99_sscanf); # else extern int __isoc99_fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __wur; extern int __isoc99_scanf (const char *__restrict __format, ...) __wur; extern int __isoc99_sscanf (const char *__restrict __s, const char *__restrict __format, ...) __THROW; # define fscanf __isoc99_fscanf # define scanf __isoc99_scanf # define sscanf __isoc99_sscanf # endif #endif __END_NAMESPACE_STD #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Read formatted input from S into argument list ARG. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, _G_va_list __arg) __attribute__ ((__format__ (__scanf__, 2, 0))) __wur; /* Read formatted input from stdin into argument list ARG. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int vscanf (const char *__restrict __format, _G_va_list __arg) __attribute__ ((__format__ (__scanf__, 1, 0))) __wur; /* Read formatted input from S into argument list ARG. */ extern int vsscanf (const char *__restrict __s, const char *__restrict __format, _G_va_list __arg) __THROW __attribute__ ((__format__ (__scanf__, 2, 0))); # if !defined __USE_GNU \ && (!defined __LDBL_COMPAT || !defined __REDIRECT) \ && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) # ifdef __REDIRECT /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[ GNU extension which conflicts with valid %a followed by letter s, S or [. */ extern int __REDIRECT (vfscanf, (FILE *__restrict __s, const char *__restrict __format, _G_va_list __arg), __isoc99_vfscanf) __attribute__ ((__format__ (__scanf__, 2, 0))) __wur; extern int __REDIRECT (vscanf, (const char *__restrict __format, _G_va_list __arg), __isoc99_vscanf) __attribute__ ((__format__ (__scanf__, 1, 0))) __wur; extern int __REDIRECT_NTH (vsscanf, (const char *__restrict __s, const char *__restrict __format, _G_va_list __arg), __isoc99_vsscanf) __attribute__ ((__format__ (__scanf__, 2, 0))); # else extern int __isoc99_vfscanf (FILE *__restrict __s, const char *__restrict __format, _G_va_list __arg) __wur; extern int __isoc99_vscanf (const char *__restrict __format, _G_va_list __arg) __wur; extern int __isoc99_vsscanf (const char *__restrict __s, const char *__restrict __format, _G_va_list __arg) __THROW; # define vfscanf __isoc99_vfscanf # define vscanf __isoc99_vscanf # define vsscanf __isoc99_vsscanf # endif # endif __END_NAMESPACE_C99 #endif /* Use ISO C9x. */ __BEGIN_NAMESPACE_STD /* Read a character from STREAM. These functions are possible cancellation points and therefore not marked with __THROW. */ extern int fgetc (FILE *__stream); extern int getc (FILE *__stream); /* Read a character from stdin. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int getchar (void); __END_NAMESPACE_STD /* The C standard explicitly says this is a macro, so we always do the optimization for it. */ #define getc(_fp) _IO_getc (_fp) #if defined __USE_POSIX || defined __USE_MISC /* These are defined in POSIX.1:1996. These functions are possible cancellation points and therefore not marked with __THROW. */ extern int getc_unlocked (FILE *__stream); extern int getchar_unlocked (void); #endif /* Use POSIX or MISC. */ #ifdef __USE_MISC /* Faster version when locking is not necessary. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int fgetc_unlocked (FILE *__stream); #endif /* Use MISC. */ __BEGIN_NAMESPACE_STD /* Write a character to STREAM. These functions are possible cancellation points and therefore not marked with __THROW. These functions is a possible cancellation point and therefore not marked with __THROW. */ extern int fputc (int __c, FILE *__stream); extern int putc (int __c, FILE *__stream); /* Write a character to stdout. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int putchar (int __c); __END_NAMESPACE_STD /* The C standard explicitly says this can be a macro, so we always do the optimization for it. */ #define putc(_ch, _fp) _IO_putc (_ch, _fp) #ifdef __USE_MISC /* Faster version when locking is not necessary. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int fputc_unlocked (int __c, FILE *__stream); #endif /* Use MISC. */ #if defined __USE_POSIX || defined __USE_MISC /* These are defined in POSIX.1:1996. These functions are possible cancellation points and therefore not marked with __THROW. */ extern int putc_unlocked (int __c, FILE *__stream); extern int putchar_unlocked (int __c); #endif /* Use POSIX or MISC. */ #if defined __USE_SVID || defined __USE_MISC \ || (defined __USE_XOPEN && !defined __USE_XOPEN2K) /* Get a word (int) from STREAM. */ extern int getw (FILE *__stream); /* Write a word (int) to STREAM. */ extern int putw (int __w, FILE *__stream); #endif __BEGIN_NAMESPACE_STD /* Get a newline-terminated string of finite length from STREAM. This function is a possible cancellation point and therefore not marked with __THROW. */ extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) __wur; #if !defined __USE_ISOC11 \ || (defined __cplusplus && __cplusplus <= 201103L) /* Get a newline-terminated string from stdin, removing the newline. DO NOT USE THIS FUNCTION!! There is no limit on how much it will read. The function has been officially removed in ISO C11. This opportunity is used to also remove it from the GNU feature list. It is now only available when explicitly using an old ISO C, Unix, or POSIX standard. GCC defines _GNU_SOURCE when building C++ code and the function is still in C++11, so it is also available for C++. This function is a possible cancellation point and therefore not marked with __THROW. */ extern char *gets (char *__s) __wur __attribute_deprecated__; #endif __END_NAMESPACE_STD #ifdef __USE_GNU /* This function does the same as `fgets' but does not lock the stream. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern char *fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream) __wur; #endif #ifdef __USE_XOPEN2K8 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR (and null-terminate it). *LINEPTR is a pointer returned from malloc (or NULL), pointing to *N characters of space. It is realloc'd as necessary. Returns the number of characters read (not including the null terminator), or -1 on error or EOF. These functions are not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation they are cancellation points and therefore not marked with __THROW. */ extern _IO_ssize_t __getdelim (char **__restrict __lineptr, size_t *__restrict __n, int __delimiter, FILE *__restrict __stream) __wur; extern _IO_ssize_t getdelim (char **__restrict __lineptr, size_t *__restrict __n, int __delimiter, FILE *__restrict __stream) __wur; /* Like `getdelim', but reads up to a newline. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern _IO_ssize_t getline (char **__restrict __lineptr, size_t *__restrict __n, FILE *__restrict __stream) __wur; #endif __BEGIN_NAMESPACE_STD /* Write a string to STREAM. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int fputs (const char *__restrict __s, FILE *__restrict __stream); /* Write a string, followed by a newline, to stdout. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int puts (const char *__s); /* Push a character back onto the input buffer of STREAM. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int ungetc (int __c, FILE *__stream); /* Read chunks of generic data from STREAM. This function is a possible cancellation point and therefore not marked with __THROW. */ extern size_t fread (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) __wur; /* Write chunks of generic data to STREAM. This function is a possible cancellation point and therefore not marked with __THROW. */ extern size_t fwrite (const void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __s); __END_NAMESPACE_STD #ifdef __USE_GNU /* This function does the same as `fputs' but does not lock the stream. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int fputs_unlocked (const char *__restrict __s, FILE *__restrict __stream); #endif #ifdef __USE_MISC /* Faster versions when locking is not necessary. These functions are not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation they are cancellation points and therefore not marked with __THROW. */ extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) __wur; extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream); #endif __BEGIN_NAMESPACE_STD /* Seek to a certain position on STREAM. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int fseek (FILE *__stream, long int __off, int __whence); /* Return the current position of STREAM. This function is a possible cancellation point and therefore not marked with __THROW. */ extern long int ftell (FILE *__stream) __wur; /* Rewind to the beginning of STREAM. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void rewind (FILE *__stream); __END_NAMESPACE_STD /* The Single Unix Specification, Version 2, specifies an alternative, more adequate interface for the two functions above which deal with file offset. `long int' is not the right type. These definitions are originally defined in the Large File Support API. */ #if defined __USE_LARGEFILE || defined __USE_XOPEN2K # ifndef __USE_FILE_OFFSET64 /* Seek to a certain position on STREAM. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int fseeko (FILE *__stream, __off_t __off, int __whence); /* Return the current position of STREAM. This function is a possible cancellation point and therefore not marked with __THROW. */ extern __off_t ftello (FILE *__stream) __wur; # else # ifdef __REDIRECT extern int __REDIRECT (fseeko, (FILE *__stream, __off64_t __off, int __whence), fseeko64); extern __off64_t __REDIRECT (ftello, (FILE *__stream), ftello64); # else # define fseeko fseeko64 # define ftello ftello64 # endif # endif #endif __BEGIN_NAMESPACE_STD #ifndef __USE_FILE_OFFSET64 /* Get STREAM's position. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); /* Set STREAM's position. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int fsetpos (FILE *__stream, const fpos_t *__pos); #else # ifdef __REDIRECT extern int __REDIRECT (fgetpos, (FILE *__restrict __stream, fpos_t *__restrict __pos), fgetpos64); extern int __REDIRECT (fsetpos, (FILE *__stream, const fpos_t *__pos), fsetpos64); # else # define fgetpos fgetpos64 # define fsetpos fsetpos64 # endif #endif __END_NAMESPACE_STD #ifdef __USE_LARGEFILE64 extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence); extern __off64_t ftello64 (FILE *__stream) __wur; extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos); extern int fsetpos64 (FILE *__stream, const fpos64_t *__pos); #endif __BEGIN_NAMESPACE_STD /* Clear the error and EOF indicators for STREAM. */ extern void clearerr (FILE *__stream) __THROW; /* Return the EOF indicator for STREAM. */ extern int feof (FILE *__stream) __THROW __wur; /* Return the error indicator for STREAM. */ extern int ferror (FILE *__stream) __THROW __wur; __END_NAMESPACE_STD #ifdef __USE_MISC /* Faster versions when locking is not required. */ extern void clearerr_unlocked (FILE *__stream) __THROW; extern int feof_unlocked (FILE *__stream) __THROW __wur; extern int ferror_unlocked (FILE *__stream) __THROW __wur; #endif __BEGIN_NAMESPACE_STD /* Print a message describing the meaning of the value of errno. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void perror (const char *__s); __END_NAMESPACE_STD /* Provide the declarations for `sys_errlist' and `sys_nerr' if they are available on this system. Even if available, these variables should not be used directly. The `strerror' function provides all the necessary functionality. */ #include <bits/sys_errlist.h> #ifdef __USE_POSIX /* Return the system file descriptor for STREAM. */ extern int fileno (FILE *__stream) __THROW __wur; #endif /* Use POSIX. */ #ifdef __USE_MISC /* Faster version when locking is not required. */ extern int fileno_unlocked (FILE *__stream) __THROW __wur; #endif #if (defined __USE_POSIX2 || defined __USE_SVID || defined __USE_BSD || \ defined __USE_MISC) /* Create a new stream connected to a pipe running the given command. This function is a possible cancellation point and therefore not marked with __THROW. */ extern FILE *popen (const char *__command, const char *__modes) __wur; /* Close a stream opened by popen and return the status of its child. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int pclose (FILE *__stream); #endif #ifdef __USE_POSIX /* Return the name of the controlling terminal. */ extern char *ctermid (char *__s) __THROW; #endif /* Use POSIX. */ #ifdef __USE_XOPEN /* Return the name of the current user. */ extern char *cuserid (char *__s); #endif /* Use X/Open, but not issue 6. */ #ifdef __USE_GNU struct obstack; /* See <obstack.h>. */ /* Write formatted output to an obstack. */ extern int obstack_printf (struct obstack *__restrict __obstack, const char *__restrict __format, ...) __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))); extern int obstack_vprintf (struct obstack *__restrict __obstack, const char *__restrict __format, _G_va_list __args) __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))); #endif /* Use GNU. */ #if defined __USE_POSIX || defined __USE_MISC /* These are defined in POSIX.1:1996. */ /* Acquire ownership of STREAM. */ extern void flockfile (FILE *__stream) __THROW; /* Try to acquire ownership of STREAM but do not block if it is not possible. */ extern int ftrylockfile (FILE *__stream) __THROW __wur; /* Relinquish the ownership granted for STREAM. */ extern void funlockfile (FILE *__stream) __THROW; #endif /* POSIX || misc */ #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU /* The X/Open standard requires some functions and variables to be declared here which do not belong into this header. But we have to follow. In GNU mode we don't do this nonsense. */ # define __need_getopt # include <getopt.h> #endif /* X/Open, but not issue 6 and not for GNU. */ /* If we are compiling with optimizing read this file. It contains several optimizing inline functions and macros. */ #ifdef __USE_EXTERN_INLINES # include <bits/stdio.h> #endif #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function # include <bits/stdio2.h> #endif #ifdef __LDBL_COMPAT # include <bits/stdio-ldbl.h> #endif __END_DECLS #endif /* <stdio.h> included. */ #endif /* !_STDIO_H */ �������������������������������������������������������������������������������������������������������cursesapp.h�����������������������������������������������������������������������������������������0000644�����������������00000015167�14763166026�0006747 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** * Copyright (c) 1998-2005,2011 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /**************************************************************************** * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ // $Id: cursesapp.h,v 1.12 2011/09/17 22:12:10 tom Exp $ #ifndef NCURSES_CURSESAPP_H_incl #define NCURSES_CURSESAPP_H_incl #include <cursslk.h> class NCURSES_IMPEXP NCursesApplication { public: typedef struct _slk_link { // This structure is used to maintain struct _slk_link* prev; // a stack of SLKs Soft_Label_Key_Set* SLKs; } SLK_Link; private: static int rinit(NCursesWindow& w); // Internal Init function for title static NCursesApplication* theApp; // Global ref. to the application static SLK_Link* slk_stack; protected: static NCursesWindow* titleWindow; // The Title Window (if any) bool b_Colors; // Is this a color application? NCursesWindow* Root_Window; // This is the stdscr equiv. // Initialization of attributes; // Rewrite this in your derived class if you prefer other settings virtual void init(bool bColors); // The number of lines for the title window. Default is no title window // You may rewrite this in your derived class virtual int titlesize() const { return 0; } // This method is called to put something into the title window initially // You may rewrite this in your derived class virtual void title() { } // The layout used for the Soft Label Keys. Default is to have no SLKs. // You may rewrite this in your derived class virtual Soft_Label_Key_Set::Label_Layout useSLKs() const { return Soft_Label_Key_Set::None; } // This method is called to initialize the SLKs. Default is nothing. // You may rewrite this in your derived class virtual void init_labels(Soft_Label_Key_Set& S) const { (void) S; } // Your derived class must implement this method. The return value must // be the exit value of your application. virtual int run() = 0; // The constructor is protected, so you may use it in your derived // class constructor. The argument tells whether or not you want colors. NCursesApplication(bool wantColors = FALSE); NCursesApplication& operator=(const NCursesApplication& rhs) { if (this != &rhs) { *this = rhs; } return *this; } NCursesApplication(const NCursesApplication& rhs) : b_Colors(rhs.b_Colors), Root_Window(rhs.Root_Window) { } public: virtual ~NCursesApplication(); // Get a pointer to the current application object static NCursesApplication* getApplication() { return theApp; } // This method runs the application and returns its exit value int operator()(void); // Process the commandline arguments. The default implementation simply // ignores them. Your derived class may rewrite this. virtual void handleArgs(int argc, char* argv[]) { (void) argc; (void) argv; } // Does this application use colors? inline bool useColors() const { return b_Colors; } // Push the Key Set S onto the SLK Stack. S then becomes the current set // of Soft Labelled Keys. void push(Soft_Label_Key_Set& S); // Throw away the current set of SLKs and make the previous one the // new current set. bool pop(); // Retrieve the current set of Soft Labelled Keys. Soft_Label_Key_Set* top() const; // Attributes to use for menu and forms foregrounds virtual chtype foregrounds() const { return b_Colors ? static_cast<chtype>(COLOR_PAIR(1)) : A_BOLD; } // Attributes to use for menu and forms backgrounds virtual chtype backgrounds() const { return b_Colors ? static_cast<chtype>(COLOR_PAIR(2)) : A_NORMAL; } // Attributes to use for inactive (menu) elements virtual chtype inactives() const { return b_Colors ? static_cast<chtype>(COLOR_PAIR(3)|A_DIM) : A_DIM; } // Attributes to use for (form) labels and SLKs virtual chtype labels() const { return b_Colors ? static_cast<chtype>(COLOR_PAIR(4)) : A_NORMAL; } // Attributes to use for form backgrounds virtual chtype dialog_backgrounds() const { return b_Colors ? static_cast<chtype>(COLOR_PAIR(4)) : A_NORMAL; } // Attributes to use as default for (form) window backgrounds virtual chtype window_backgrounds() const { return b_Colors ? static_cast<chtype>(COLOR_PAIR(5)) : A_NORMAL; } // Attributes to use for the title window virtual chtype screen_titles() const { return b_Colors ? static_cast<chtype>(COLOR_PAIR(6)) : A_BOLD; } }; #endif /* NCURSES_CURSESAPP_H_incl */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������eti.h�����������������������������������������������������������������������������������������������0000644�����������������00000005513�14763166026�0005515 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/**************************************************************************** * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /**************************************************************************** * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ /* $Id: eti.h,v 1.8 2003/10/25 15:24:29 tom Exp $ */ #ifndef NCURSES_ETI_H_incl #define NCURSES_ETI_H_incl 1 #define E_OK (0) #define E_SYSTEM_ERROR (-1) #define E_BAD_ARGUMENT (-2) #define E_POSTED (-3) #define E_CONNECTED (-4) #define E_BAD_STATE (-5) #define E_NO_ROOM (-6) #define E_NOT_POSTED (-7) #define E_UNKNOWN_COMMAND (-8) #define E_NO_MATCH (-9) #define E_NOT_SELECTABLE (-10) #define E_NOT_CONNECTED (-11) #define E_REQUEST_DENIED (-12) #define E_INVALID_FIELD (-13) #define E_CURRENT (-14) #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������scsi/scsi_ioctl.h�����������������������������������������������������������������������������������0000644�����������������00000002437�14763166026�0010032 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SCSI_IOCTL_H #define _SCSI_IOCTL_H /* IOCTLs for SCSI. */ #define SCSI_IOCTL_SEND_COMMAND 1 /* Send a command to the SCSI host. */ #define SCSI_IOCTL_TEST_UNIT_READY 2 /* Test if unit is ready. */ #define SCSI_IOCTL_BENCHMARK_COMMAND 3 #define SCSI_IOCTL_SYNC 4 /* Request synchronous parameters. */ #define SCSI_IOCTL_START_UNIT 5 #define SCSI_IOCTL_STOP_UNIT 6 #define SCSI_IOCTL_DOORLOCK 0x5380 /* Lock the eject mechanism. */ #define SCSI_IOCTL_DOORUNLOCK 0x5381 /* Unlock the mechanism. */ #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������scsi/sg.h�������������������������������������������������������������������������������������������0000644�����������������00000026561�14763166026�0006314 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* History: Started: Aug 9 by Lawrence Foard (entropy@world.std.com), to allow user process control of SCSI devices. Development Sponsored by Killy Corp. NY NY */ #ifndef _SCSI_SG_H #define _SCSI_SG_H 1 #include <features.h> /* New interface introduced in the 3.x SG drivers follows */ /* Same structure as used by readv() Linux system call. It defines one scatter-gather element. */ typedef struct sg_iovec { void * iov_base; /* Starting address */ size_t iov_len; /* Length in bytes */ } sg_iovec_t; typedef struct sg_io_hdr { int interface_id; /* [i] 'S' for SCSI generic (required) */ int dxfer_direction; /* [i] data transfer direction */ unsigned char cmd_len; /* [i] SCSI command length ( <= 16 bytes) */ unsigned char mx_sb_len; /* [i] max length to write to sbp */ unsigned short int iovec_count; /* [i] 0 implies no scatter gather */ unsigned int dxfer_len; /* [i] byte count of data transfer */ void * dxferp; /* [i], [*io] points to data transfer memory or scatter gather list */ unsigned char * cmdp; /* [i], [*i] points to command to perform */ unsigned char * sbp; /* [i], [*o] points to sense_buffer memory */ unsigned int timeout; /* [i] MAX_UINT->no timeout (unit: millisec) */ unsigned int flags; /* [i] 0 -> default, see SG_FLAG... */ int pack_id; /* [i->o] unused internally (normally) */ void * usr_ptr; /* [i->o] unused internally */ unsigned char status; /* [o] scsi status */ unsigned char masked_status;/* [o] shifted, masked scsi status */ unsigned char msg_status; /* [o] messaging level data (optional) */ unsigned char sb_len_wr; /* [o] byte count actually written to sbp */ unsigned short int host_status; /* [o] errors from host adapter */ unsigned short int driver_status;/* [o] errors from software driver */ int resid; /* [o] dxfer_len - actual_transferred */ unsigned int duration; /* [o] time taken by cmd (unit: millisec) */ unsigned int info; /* [o] auxiliary information */ } sg_io_hdr_t; /* Use negative values to flag difference from original sg_header structure. */ #define SG_DXFER_NONE -1 /* e.g. a SCSI Test Unit Ready command */ #define SG_DXFER_TO_DEV -2 /* e.g. a SCSI WRITE command */ #define SG_DXFER_FROM_DEV -3 /* e.g. a SCSI READ command */ #define SG_DXFER_TO_FROM_DEV -4 /* treated like SG_DXFER_FROM_DEV with the additional property than during indirect IO the user buffer is copied into the kernel buffers before the transfer */ /* following flag values can be "or"-ed together */ #define SG_FLAG_DIRECT_IO 1 /* default is indirect IO */ #define SG_FLAG_LUN_INHIBIT 2 /* default is to put device's lun into */ /* the 2nd byte of SCSI command */ #define SG_FLAG_NO_DXFER 0x10000 /* no transfer of kernel buffers to/from */ /* user space (debug indirect IO) */ /* The following 'info' values are "or"-ed together. */ #define SG_INFO_OK_MASK 0x1 #define SG_INFO_OK 0x0 /* no sense, host nor driver "noise" */ #define SG_INFO_CHECK 0x1 /* something abnormal happened */ #define SG_INFO_DIRECT_IO_MASK 0x6 #define SG_INFO_INDIRECT_IO 0x0 /* data xfer via kernel buffers (or no xfer) */ #define SG_INFO_DIRECT_IO 0x2 /* direct IO requested and performed */ #define SG_INFO_MIXED_IO 0x4 /* part direct, part indirect IO */ /* Request information about a specific SG device, used by SG_GET_SCSI_ID ioctl (). */ struct sg_scsi_id { /* Host number as in "scsi<n>" where 'n' is one of 0, 1, 2 etc. */ int host_no; int channel; /* SCSI id of target device. */ int scsi_id; int lun; /* TYPE_... defined in <scsi/scsi.h>. */ int scsi_type; /* Host (adapter) maximum commands per lun. */ short int h_cmd_per_lun; /* Device (or adapter) maximum queue length. */ short int d_queue_depth; /* Unused, set to 0 for now. */ int unused[2]; }; /* Used by SG_GET_REQUEST_TABLE ioctl(). */ typedef struct sg_req_info { char req_state; /* 0 -> not used, 1 -> written, 2 -> ready to read */ char orphan; /* 0 -> normal request, 1 -> from interruped SG_IO */ char sg_io_owned; /* 0 -> complete with read(), 1 -> owned by SG_IO */ char problem; /* 0 -> no problem detected, 1 -> error to report */ int pack_id; /* pack_id associated with request */ void * usr_ptr; /* user provided pointer (in new interface) */ unsigned int duration; /* millisecs elapsed since written (req_state==1) or request duration (req_state==2) */ int unused; } sg_req_info_t; /* IOCTLs: Those ioctls that are relevant to the SG 3.x drivers follow. [Those that only apply to the SG 2.x drivers are at the end of the file.] (_GET_s yield result via 'int *' 3rd argument unless otherwise indicated) */ #define SG_EMULATED_HOST 0x2203 /* true for emulated host adapter (ATAPI) */ /* Used to configure SCSI command transformation layer for ATAPI devices */ /* Only supported by the ide-scsi driver */ #define SG_SET_TRANSFORM 0x2204 /* N.B. 3rd arg is not pointer but value: */ /* 3rd arg = 0 to disable transform, 1 to enable it */ #define SG_GET_TRANSFORM 0x2205 #define SG_SET_RESERVED_SIZE 0x2275 /* request a new reserved buffer size */ #define SG_GET_RESERVED_SIZE 0x2272 /* actual size of reserved buffer */ /* The following ioctl has a 'sg_scsi_id_t *' object as its 3rd argument. */ #define SG_GET_SCSI_ID 0x2276 /* Yields fd's bus, chan, dev, lun + type */ /* SCSI id information can also be obtained from SCSI_IOCTL_GET_IDLUN */ /* Override host setting and always DMA using low memory ( <16MB on i386) */ #define SG_SET_FORCE_LOW_DMA 0x2279 /* 0-> use adapter setting, 1-> force */ #define SG_GET_LOW_DMA 0x227a /* 0-> use all ram for dma; 1-> low dma ram */ /* When SG_SET_FORCE_PACK_ID set to 1, pack_id is input to read() which tries to fetch a packet with a matching pack_id, waits, or returns EAGAIN. If pack_id is -1 then read oldest waiting. When ...FORCE_PACK_ID set to 0 then pack_id ignored by read() and oldest readable fetched. */ #define SG_SET_FORCE_PACK_ID 0x227b #define SG_GET_PACK_ID 0x227c /* Yields oldest readable pack_id (or -1) */ #define SG_GET_NUM_WAITING 0x227d /* Number of commands awaiting read() */ /* Yields max scatter gather tablesize allowed by current host adapter */ #define SG_GET_SG_TABLESIZE 0x227F /* 0 implies can't do scatter gather */ #define SG_GET_VERSION_NUM 0x2282 /* Example: version 2.1.34 yields 20134 */ /* Returns -EBUSY if occupied. 3rd argument pointer to int (see next) */ #define SG_SCSI_RESET 0x2284 /* Associated values that can be given to SG_SCSI_RESET follow */ #define SG_SCSI_RESET_NOTHING 0 #define SG_SCSI_RESET_DEVICE 1 #define SG_SCSI_RESET_BUS 2 #define SG_SCSI_RESET_HOST 3 /* synchronous SCSI command ioctl, (only in version 3 interface) */ #define SG_IO 0x2285 /* similar effect as write() followed by read() */ #define SG_GET_REQUEST_TABLE 0x2286 /* yields table of active requests */ /* How to treat EINTR during SG_IO ioctl(), only in SG 3.x series */ #define SG_SET_KEEP_ORPHAN 0x2287 /* 1 -> hold for read(), 0 -> drop (def) */ #define SG_GET_KEEP_ORPHAN 0x2288 #define SG_SCATTER_SZ (8 * 4096) /* PAGE_SIZE not available to user */ /* Largest size (in bytes) a single scatter-gather list element can have. The value must be a power of 2 and <= (PAGE_SIZE * 32) [131072 bytes on i386]. The minimum value is PAGE_SIZE. If scatter-gather not supported by adapter then this value is the largest data block that can be read/written by a single scsi command. The user can find the value of PAGE_SIZE by calling getpagesize() defined in unistd.h . */ #define SG_DEFAULT_RETRIES 1 /* Defaults, commented if they differ from original sg driver */ #define SG_DEF_FORCE_LOW_DMA 0 /* was 1 -> memory below 16MB on i386 */ #define SG_DEF_FORCE_PACK_ID 0 #define SG_DEF_KEEP_ORPHAN 0 #define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ /* load time option */ /* maximum outstanding requests, write() yields EDOM if exceeded */ #define SG_MAX_QUEUE 16 #define SG_BIG_BUFF SG_DEF_RESERVED_SIZE /* for backward compatibility */ /* Alternate style type names, "..._t" variants preferred */ typedef struct sg_io_hdr Sg_io_hdr; typedef struct sg_io_vec Sg_io_vec; typedef struct sg_scsi_id Sg_scsi_id; typedef struct sg_req_info Sg_req_info; /* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */ /* The older SG interface based on the 'sg_header' structure follows. */ /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */ #define SG_MAX_SENSE 16 /* this only applies to the sg_header interface */ struct sg_header { /* Length of incoming packet (including header). */ int pack_len; /* Maximal length of expected reply. */ int reply_len; /* Id number of packet. */ int pack_id; /* 0==ok, otherwise error number. */ int result; /* Force 12 byte command length for group 6 & 7 commands. */ unsigned int twelve_byte:1; /* SCSI status from target. */ unsigned int target_status:5; /* Host status (see "DID" codes). */ unsigned int host_status:8; /* Driver status+suggestion. */ unsigned int driver_status:8; /* Unused. */ unsigned int other_flags:10; /* Output in 3 cases: when target_status is CHECK_CONDITION or when target_status is COMMAND_TERMINATED or when (driver_status & DRIVER_SENSE) is true. */ unsigned char sense_buffer[SG_MAX_SENSE]; }; /* IOCTLs: The following are not required (or ignored) when the sg_io_hdr_t interface is used. They are kept for backward compatibility with the original and version 2 drivers. */ #define SG_SET_TIMEOUT 0x2201 /* Set timeout; *(int *)arg==timeout. */ #define SG_GET_TIMEOUT 0x2202 /* Get timeout; return timeout. */ /* Get/set command queuing state per fd (default is SG_DEF_COMMAND_Q). */ #define SG_GET_COMMAND_Q 0x2270 /* Yields 0 (queuing off) or 1 (on). */ #define SG_SET_COMMAND_Q 0x2271 /* Change queuing state with 0 or 1. */ /* Turn on error sense trace (1..8), dump this device to log/console (9) or dump all sg device states ( >9 ) to log/console. */ #define SG_SET_DEBUG 0x227e /* 0 -> turn off debug */ #define SG_NEXT_CMD_LEN 0x2283 /* Override SCSI command length with given number on the next write() on this file descriptor. */ /* Defaults, commented if they differ from original sg driver */ #define SG_DEFAULT_TIMEOUT (60*HZ) /* HZ == 'jiffies in 1 second' */ #define SG_DEF_COMMAND_Q 0 /* command queuing is always on when the new interface is used */ #define SG_DEF_UNDERRUN_FLAG 0 #endif /* scsi/sg.h */ �����������������������������������������������������������������������������������������������������������������������������������������������scsi/scsi.h�����������������������������������������������������������������������������������������0000644�����������������00000015472�14763166026�0006643 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * This header file contains public constants and structures used by * the scsi code for linux. */ #ifndef _SCSI_SCSI_H #define _SCSI_SCSI_H 1 #include <features.h> /* * SCSI opcodes */ #define TEST_UNIT_READY 0x00 #define REZERO_UNIT 0x01 #define REQUEST_SENSE 0x03 #define FORMAT_UNIT 0x04 #define READ_BLOCK_LIMITS 0x05 #define REASSIGN_BLOCKS 0x07 #define READ_6 0x08 #define WRITE_6 0x0a #define SEEK_6 0x0b #define READ_REVERSE 0x0f #define WRITE_FILEMARKS 0x10 #define SPACE 0x11 #define INQUIRY 0x12 #define RECOVER_BUFFERED_DATA 0x14 #define MODE_SELECT 0x15 #define RESERVE 0x16 #define RELEASE 0x17 #define COPY 0x18 #define ERASE 0x19 #define MODE_SENSE 0x1a #define START_STOP 0x1b #define RECEIVE_DIAGNOSTIC 0x1c #define SEND_DIAGNOSTIC 0x1d #define ALLOW_MEDIUM_REMOVAL 0x1e #define SET_WINDOW 0x24 #define READ_CAPACITY 0x25 #define READ_10 0x28 #define WRITE_10 0x2a #define SEEK_10 0x2b #define WRITE_VERIFY 0x2e #define VERIFY 0x2f #define SEARCH_HIGH 0x30 #define SEARCH_EQUAL 0x31 #define SEARCH_LOW 0x32 #define SET_LIMITS 0x33 #define PRE_FETCH 0x34 #define READ_POSITION 0x34 #define SYNCHRONIZE_CACHE 0x35 #define LOCK_UNLOCK_CACHE 0x36 #define READ_DEFECT_DATA 0x37 #define MEDIUM_SCAN 0x38 #define COMPARE 0x39 #define COPY_VERIFY 0x3a #define WRITE_BUFFER 0x3b #define READ_BUFFER 0x3c #define UPDATE_BLOCK 0x3d #define READ_LONG 0x3e #define WRITE_LONG 0x3f #define CHANGE_DEFINITION 0x40 #define WRITE_SAME 0x41 #define READ_TOC 0x43 #define LOG_SELECT 0x4c #define LOG_SENSE 0x4d #define MODE_SELECT_10 0x55 #define RESERVE_10 0x56 #define RELEASE_10 0x57 #define MODE_SENSE_10 0x5a #define PERSISTENT_RESERVE_IN 0x5e #define PERSISTENT_RESERVE_OUT 0x5f #define MOVE_MEDIUM 0xa5 #define READ_12 0xa8 #define WRITE_12 0xaa #define WRITE_VERIFY_12 0xae #define SEARCH_HIGH_12 0xb0 #define SEARCH_EQUAL_12 0xb1 #define SEARCH_LOW_12 0xb2 #define READ_ELEMENT_STATUS 0xb8 #define SEND_VOLUME_TAG 0xb6 #define WRITE_LONG_2 0xea /* * Status codes */ #define GOOD 0x00 #define CHECK_CONDITION 0x01 #define CONDITION_GOOD 0x02 #define BUSY 0x04 #define INTERMEDIATE_GOOD 0x08 #define INTERMEDIATE_C_GOOD 0x0a #define RESERVATION_CONFLICT 0x0c #define COMMAND_TERMINATED 0x11 #define QUEUE_FULL 0x14 #define STATUS_MASK 0x3e /* * SENSE KEYS */ #define NO_SENSE 0x00 #define RECOVERED_ERROR 0x01 #define NOT_READY 0x02 #define MEDIUM_ERROR 0x03 #define HARDWARE_ERROR 0x04 #define ILLEGAL_REQUEST 0x05 #define UNIT_ATTENTION 0x06 #define DATA_PROTECT 0x07 #define BLANK_CHECK 0x08 #define COPY_ABORTED 0x0a #define ABORTED_COMMAND 0x0b #define VOLUME_OVERFLOW 0x0d #define MISCOMPARE 0x0e /* * DEVICE TYPES */ #define TYPE_DISK 0x00 #define TYPE_TAPE 0x01 #define TYPE_PROCESSOR 0x03 /* HP scanners use this */ #define TYPE_WORM 0x04 /* Treated as ROM by our system */ #define TYPE_ROM 0x05 #define TYPE_SCANNER 0x06 #define TYPE_MOD 0x07 /* Magneto-optical disk - * - treated as TYPE_DISK */ #define TYPE_MEDIUM_CHANGER 0x08 #define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ #define TYPE_NO_LUN 0x7f /* * standard mode-select header prepended to all mode-select commands * * moved here from cdrom.h -- kraxel */ struct ccs_modesel_head { unsigned char _r1; /* reserved. */ unsigned char medium; /* device-specific medium type. */ unsigned char _r2; /* reserved. */ unsigned char block_desc_length; /* block descriptor length. */ unsigned char density; /* device-specific density code. */ unsigned char number_blocks_hi; /* number of blocks in this block desc. */ unsigned char number_blocks_med; unsigned char number_blocks_lo; unsigned char _r3; unsigned char block_length_hi; /* block length for blocks in this desc. */ unsigned char block_length_med; unsigned char block_length_lo; }; /* * MESSAGE CODES */ #define COMMAND_COMPLETE 0x00 #define EXTENDED_MESSAGE 0x01 #define EXTENDED_MODIFY_DATA_POINTER 0x00 #define EXTENDED_SDTR 0x01 #define EXTENDED_EXTENDED_IDENTIFY 0x02 /* SCSI-I only */ #define EXTENDED_WDTR 0x03 #define SAVE_POINTERS 0x02 #define RESTORE_POINTERS 0x03 #define DISCONNECT 0x04 #define INITIATOR_ERROR 0x05 #define ABORT 0x06 #define MESSAGE_REJECT 0x07 #define NOP 0x08 #define MSG_PARITY_ERROR 0x09 #define LINKED_CMD_COMPLETE 0x0a #define LINKED_FLG_CMD_COMPLETE 0x0b #define BUS_DEVICE_RESET 0x0c #define INITIATE_RECOVERY 0x0f /* SCSI-II only */ #define RELEASE_RECOVERY 0x10 /* SCSI-II only */ #define SIMPLE_QUEUE_TAG 0x20 #define HEAD_OF_QUEUE_TAG 0x21 #define ORDERED_QUEUE_TAG 0x22 /* * Here are some scsi specific ioctl commands which are sometimes useful. */ /* These are a few other constants only used by scsi devices. */ #define SCSI_IOCTL_GET_IDLUN 0x5382 /* Used to turn on and off tagged queuing for scsi devices. */ #define SCSI_IOCTL_TAGGED_ENABLE 0x5383 #define SCSI_IOCTL_TAGGED_DISABLE 0x5384 /* Used to obtain the host number of a device. */ #define SCSI_IOCTL_PROBE_HOST 0x5385 /* Used to get the bus number for a device. */ #define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 #endif /* scsi/scsi.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������scsi/scsi_netlink.h���������������������������������������������������������������������������������0000644�����������������00000007122�14763166026�0010360 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * SCSI Transport Netlink Interface * Used for the posting of outbound SCSI transport events * * Copyright (C) 2006 James Smart, Emulex Corporation * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef SCSI_NETLINK_H #define SCSI_NETLINK_H #include <linux/netlink.h> #include <linux/types.h> /* * This file intended to be included by both kernel and user space */ /* Single Netlink Message type to send all SCSI Transport messages */ #define SCSI_TRANSPORT_MSG NLMSG_MIN_TYPE + 1 /* SCSI Transport Broadcast Groups */ /* leaving groups 0 and 1 unassigned */ #define SCSI_NL_GRP_FC_EVENTS (1<<2) /* Group 2 */ #define SCSI_NL_GRP_CNT 3 /* SCSI_TRANSPORT_MSG event message header */ struct scsi_nl_hdr { uint8_t version; uint8_t transport; uint16_t magic; uint16_t msgtype; uint16_t msglen; } __attribute__((aligned(sizeof(uint64_t)))); /* scsi_nl_hdr->version value */ #define SCSI_NL_VERSION 1 /* scsi_nl_hdr->magic value */ #define SCSI_NL_MAGIC 0xA1B2 /* scsi_nl_hdr->transport value */ #define SCSI_NL_TRANSPORT 0 #define SCSI_NL_TRANSPORT_FC 1 #define SCSI_NL_MAX_TRANSPORTS 2 /* Transport-based scsi_nl_hdr->msgtype values are defined in each transport */ /* * GENERIC SCSI scsi_nl_hdr->msgtype Values */ /* kernel -> user */ #define SCSI_NL_SHOST_VENDOR 0x0001 /* user -> kernel */ /* SCSI_NL_SHOST_VENDOR msgtype is kernel->user and user->kernel */ /* * Message Structures : */ /* macro to round up message lengths to 8byte boundary */ #define SCSI_NL_MSGALIGN(len) (((len) + 7) & ~7) /* * SCSI HOST Vendor Unique messages : * SCSI_NL_SHOST_VENDOR * * Note: The Vendor Unique message payload will begin directly after * this structure, with the length of the payload per vmsg_datalen. * * Note: When specifying vendor_id, be sure to read the Vendor Type and ID * formatting requirements specified below */ struct scsi_nl_host_vendor_msg { struct scsi_nl_hdr snlh; /* must be 1st element ! */ uint64_t vendor_id; uint16_t host_no; uint16_t vmsg_datalen; } __attribute__((aligned(sizeof(uint64_t)))); /* * Vendor ID: * If transports post vendor-unique events, they must pass a well-known * 32-bit vendor identifier. This identifier consists of 8 bits indicating * the "type" of identifier contained, and 24 bits of id data. * * Identifiers for each type: * PCI : ID data is the 16 bit PCI Registered Vendor ID */ #define SCSI_NL_VID_TYPE_SHIFT 56 #define SCSI_NL_VID_TYPE_MASK ((__u64)0xFF << SCSI_NL_VID_TYPE_SHIFT) #define SCSI_NL_VID_TYPE_PCI ((__u64)0x01 << SCSI_NL_VID_TYPE_SHIFT) #define SCSI_NL_VID_ID_MASK (~ SCSI_NL_VID_TYPE_MASK) #define INIT_SCSI_NL_HDR(hdr, t, mtype, mlen) \ { \ (hdr)->version = SCSI_NL_VERSION; \ (hdr)->transport = t; \ (hdr)->magic = SCSI_NL_MAGIC; \ (hdr)->msgtype = mtype; \ (hdr)->msglen = mlen; \ } #endif /* SCSI_NETLINK_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������scsi/fc/fc_ns.h�������������������������������������������������������������������������������������0000644�����������������00000011565�14763166026�0007361 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright(c) 2007 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope 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., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. * * Maintained at www.Open-FCoE.org */ #ifndef _FC_NS_H_ #define _FC_NS_H_ #include <linux/types.h> /* * Fibre Channel Services - Name Service (dNS) * From T11.org FC-GS-2 Rev 5.3 November 1998. */ /* * Common-transport sub-type for Name Server. */ #define FC_NS_SUBTYPE 2 /* fs_ct_hdr.ct_fs_subtype */ /* * Name server Requests. * Note: this is an incomplete list, some unused requests are omitted. */ enum fc_ns_req { FC_NS_GA_NXT = 0x0100, /* get all next */ FC_NS_GI_A = 0x0101, /* get identifiers - scope */ FC_NS_GPN_ID = 0x0112, /* get port name by ID */ FC_NS_GNN_ID = 0x0113, /* get node name by ID */ FC_NS_GSPN_ID = 0x0118, /* get symbolic port name */ FC_NS_GID_PN = 0x0121, /* get ID for port name */ FC_NS_GID_NN = 0x0131, /* get IDs for node name */ FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */ FC_NS_GPN_FT = 0x0172, /* get port names by FC4 type */ FC_NS_GID_PT = 0x01a1, /* get IDs by port type */ FC_NS_RPN_ID = 0x0212, /* reg port name for ID */ FC_NS_RNN_ID = 0x0213, /* reg node name for ID */ FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */ FC_NS_RSPN_ID = 0x0218, /* reg symbolic port name */ FC_NS_RFF_ID = 0x021f, /* reg FC4 Features for ID */ FC_NS_RSNN_NN = 0x0239, /* reg symbolic node name */ }; /* * Port type values. */ enum fc_ns_pt { FC_NS_UNID_PORT = 0x00, /* unidentified */ FC_NS_N_PORT = 0x01, /* N port */ FC_NS_NL_PORT = 0x02, /* NL port */ FC_NS_FNL_PORT = 0x03, /* F/NL port */ FC_NS_NX_PORT = 0x7f, /* Nx port */ FC_NS_F_PORT = 0x81, /* F port */ FC_NS_FL_PORT = 0x82, /* FL port */ FC_NS_E_PORT = 0x84, /* E port */ FC_NS_B_PORT = 0x85, /* B port */ }; /* * Port type object. */ struct fc_ns_pt_obj { __u8 pt_type; }; /* * Port ID object */ struct fc_ns_fid { __u8 fp_flags; /* flags for responses only */ __u8 fp_fid[3]; }; /* * fp_flags in port ID object, for responses only. */ #define FC_NS_FID_LAST 0x80 /* last object */ /* * FC4-types object. */ #define FC_NS_TYPES 256 /* number of possible FC-4 types */ #define FC_NS_BPW 32 /* bits per word in bitmap */ struct fc_ns_fts { __be32 ff_type_map[FC_NS_TYPES / FC_NS_BPW]; /* bitmap of FC-4 types */ }; /* * FC4-features object. */ struct fc_ns_ff { __be32 fd_feat[FC_NS_TYPES * 4 / FC_NS_BPW]; /* 4-bits per FC-type */ }; /* * GID_PT request. */ struct fc_ns_gid_pt { __u8 fn_pt_type; __u8 fn_domain_id_scope; __u8 fn_area_id_scope; __u8 fn_resvd; }; /* * GID_FT or GPN_FT request. */ struct fc_ns_gid_ft { __u8 fn_resvd; __u8 fn_domain_id_scope; __u8 fn_area_id_scope; __u8 fn_fc4_type; }; /* * GPN_FT response. */ struct fc_gpn_ft_resp { __u8 fp_flags; /* see fp_flags definitions above */ __u8 fp_fid[3]; /* port ID */ __be32 fp_resvd; __be64 fp_wwpn; /* port name */ }; /* * GID_PN request */ struct fc_ns_gid_pn { __be64 fn_wwpn; /* port name */ }; /* * GID_PN response or GSPN_ID request */ struct fc_gid_pn_resp { __u8 fp_resvd; __u8 fp_fid[3]; /* port ID */ }; /* * GSPN_ID response */ struct fc_gspn_resp { __u8 fp_name_len; char fp_name[]; }; /* * RFT_ID request - register FC-4 types for ID. */ struct fc_ns_rft_id { struct fc_ns_fid fr_fid; /* port ID object */ struct fc_ns_fts fr_fts; /* FC-4 types object */ }; /* * RPN_ID request - register port name for ID. * RNN_ID request - register node name for ID. */ struct fc_ns_rn_id { struct fc_ns_fid fr_fid; /* port ID object */ __be64 fr_wwn; /* node name or port name */ } __attribute__((__packed__)); /* * RSNN_NN request - register symbolic node name */ struct fc_ns_rsnn { __be64 fr_wwn; /* node name */ __u8 fr_name_len; char fr_name[]; } __attribute__((__packed__)); /* * RSPN_ID request - register symbolic port name */ struct fc_ns_rspn { struct fc_ns_fid fr_fid; /* port ID object */ __u8 fr_name_len; char fr_name[]; } __attribute__((__packed__)); /* * RFF_ID request - register FC-4 Features for ID. */ struct fc_ns_rff_id { struct fc_ns_fid fr_fid; /* port ID object */ __u8 fr_resvd[2]; __u8 fr_feat; /* FC-4 Feature bits */ __u8 fr_type; /* FC-4 type */ } __attribute__((__packed__)); #endif /* _FC_NS_H_ */ �������������������������������������������������������������������������������������������������������������������������������������������scsi/fc/fc_els.h������������������������������������������������������������������������������������0000644�����������������00000064053�14763166026�0007524 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright(c) 2007 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope 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., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. * * Maintained at www.Open-FCoE.org */ #ifndef _FC_ELS_H_ #define _FC_ELS_H_ #include <linux/types.h> /* * Fibre Channel Switch - Enhanced Link Services definitions. * From T11 FC-LS Rev 1.2 June 7, 2005. */ /* * ELS Command codes - byte 0 of the frame payload */ enum fc_els_cmd { ELS_LS_RJT = 0x01, /* ESL reject */ ELS_LS_ACC = 0x02, /* ESL Accept */ ELS_PLOGI = 0x03, /* N_Port login */ ELS_FLOGI = 0x04, /* F_Port login */ ELS_LOGO = 0x05, /* Logout */ ELS_ABTX = 0x06, /* Abort exchange - obsolete */ ELS_RCS = 0x07, /* read connection status */ ELS_RES = 0x08, /* read exchange status block */ ELS_RSS = 0x09, /* read sequence status block */ ELS_RSI = 0x0a, /* read sequence initiative */ ELS_ESTS = 0x0b, /* establish streaming */ ELS_ESTC = 0x0c, /* estimate credit */ ELS_ADVC = 0x0d, /* advise credit */ ELS_RTV = 0x0e, /* read timeout value */ ELS_RLS = 0x0f, /* read link error status block */ ELS_ECHO = 0x10, /* echo */ ELS_TEST = 0x11, /* test */ ELS_RRQ = 0x12, /* reinstate recovery qualifier */ ELS_REC = 0x13, /* read exchange concise */ ELS_SRR = 0x14, /* sequence retransmission request */ ELS_PRLI = 0x20, /* process login */ ELS_PRLO = 0x21, /* process logout */ ELS_SCN = 0x22, /* state change notification */ ELS_TPLS = 0x23, /* test process login state */ ELS_TPRLO = 0x24, /* third party process logout */ ELS_LCLM = 0x25, /* login control list mgmt (obs) */ ELS_GAID = 0x30, /* get alias_ID */ ELS_FACT = 0x31, /* fabric activate alias_id */ ELS_FDACDT = 0x32, /* fabric deactivate alias_id */ ELS_NACT = 0x33, /* N-port activate alias_id */ ELS_NDACT = 0x34, /* N-port deactivate alias_id */ ELS_QOSR = 0x40, /* quality of service request */ ELS_RVCS = 0x41, /* read virtual circuit status */ ELS_PDISC = 0x50, /* discover N_port service params */ ELS_FDISC = 0x51, /* discover F_port service params */ ELS_ADISC = 0x52, /* discover address */ ELS_RNC = 0x53, /* report node cap (obs) */ ELS_FARP_REQ = 0x54, /* FC ARP request */ ELS_FARP_REPL = 0x55, /* FC ARP reply */ ELS_RPS = 0x56, /* read port status block */ ELS_RPL = 0x57, /* read port list */ ELS_RPBC = 0x58, /* read port buffer condition */ ELS_FAN = 0x60, /* fabric address notification */ ELS_RSCN = 0x61, /* registered state change notification */ ELS_SCR = 0x62, /* state change registration */ ELS_RNFT = 0x63, /* report node FC-4 types */ ELS_CSR = 0x68, /* clock synch. request */ ELS_CSU = 0x69, /* clock synch. update */ ELS_LINIT = 0x70, /* loop initialize */ ELS_LSTS = 0x72, /* loop status */ ELS_RNID = 0x78, /* request node ID data */ ELS_RLIR = 0x79, /* registered link incident report */ ELS_LIRR = 0x7a, /* link incident record registration */ ELS_SRL = 0x7b, /* scan remote loop */ ELS_SBRP = 0x7c, /* set bit-error reporting params */ ELS_RPSC = 0x7d, /* report speed capabilities */ ELS_QSA = 0x7e, /* query security attributes */ ELS_EVFP = 0x7f, /* exchange virt. fabrics params */ ELS_LKA = 0x80, /* link keep-alive */ ELS_AUTH_ELS = 0x90, /* authentication ELS */ }; /* * Initializer useful for decoding table. * Please keep this in sync with the above definitions. */ #define FC_ELS_CMDS_INIT { \ [ELS_LS_RJT] = "LS_RJT", \ [ELS_LS_ACC] = "LS_ACC", \ [ELS_PLOGI] = "PLOGI", \ [ELS_FLOGI] = "FLOGI", \ [ELS_LOGO] = "LOGO", \ [ELS_ABTX] = "ABTX", \ [ELS_RCS] = "RCS", \ [ELS_RES] = "RES", \ [ELS_RSS] = "RSS", \ [ELS_RSI] = "RSI", \ [ELS_ESTS] = "ESTS", \ [ELS_ESTC] = "ESTC", \ [ELS_ADVC] = "ADVC", \ [ELS_RTV] = "RTV", \ [ELS_RLS] = "RLS", \ [ELS_ECHO] = "ECHO", \ [ELS_TEST] = "TEST", \ [ELS_RRQ] = "RRQ", \ [ELS_REC] = "REC", \ [ELS_SRR] = "SRR", \ [ELS_PRLI] = "PRLI", \ [ELS_PRLO] = "PRLO", \ [ELS_SCN] = "SCN", \ [ELS_TPLS] = "TPLS", \ [ELS_TPRLO] = "TPRLO", \ [ELS_LCLM] = "LCLM", \ [ELS_GAID] = "GAID", \ [ELS_FACT] = "FACT", \ [ELS_FDACDT] = "FDACDT", \ [ELS_NACT] = "NACT", \ [ELS_NDACT] = "NDACT", \ [ELS_QOSR] = "QOSR", \ [ELS_RVCS] = "RVCS", \ [ELS_PDISC] = "PDISC", \ [ELS_FDISC] = "FDISC", \ [ELS_ADISC] = "ADISC", \ [ELS_RNC] = "RNC", \ [ELS_FARP_REQ] = "FARP_REQ", \ [ELS_FARP_REPL] = "FARP_REPL", \ [ELS_RPS] = "RPS", \ [ELS_RPL] = "RPL", \ [ELS_RPBC] = "RPBC", \ [ELS_FAN] = "FAN", \ [ELS_RSCN] = "RSCN", \ [ELS_SCR] = "SCR", \ [ELS_RNFT] = "RNFT", \ [ELS_CSR] = "CSR", \ [ELS_CSU] = "CSU", \ [ELS_LINIT] = "LINIT", \ [ELS_LSTS] = "LSTS", \ [ELS_RNID] = "RNID", \ [ELS_RLIR] = "RLIR", \ [ELS_LIRR] = "LIRR", \ [ELS_SRL] = "SRL", \ [ELS_SBRP] = "SBRP", \ [ELS_RPSC] = "RPSC", \ [ELS_QSA] = "QSA", \ [ELS_EVFP] = "EVFP", \ [ELS_LKA] = "LKA", \ [ELS_AUTH_ELS] = "AUTH_ELS", \ } /* * LS_ACC payload. */ struct fc_els_ls_acc { __u8 la_cmd; /* command code ELS_LS_ACC */ __u8 la_resv[3]; /* reserved */ }; /* * ELS reject payload. */ struct fc_els_ls_rjt { __u8 er_cmd; /* command code ELS_LS_RJT */ __u8 er_resv[4]; /* reserved must be zero */ __u8 er_reason; /* reason (enum fc_els_rjt_reason below) */ __u8 er_explan; /* explanation (enum fc_els_rjt_explan below) */ __u8 er_vendor; /* vendor specific code */ }; /* * ELS reject reason codes (er_reason). */ enum fc_els_rjt_reason { ELS_RJT_NONE = 0, /* no reject - not to be sent */ ELS_RJT_INVAL = 0x01, /* invalid ELS command code */ ELS_RJT_LOGIC = 0x03, /* logical error */ ELS_RJT_BUSY = 0x05, /* logical busy */ ELS_RJT_PROT = 0x07, /* protocol error */ ELS_RJT_UNAB = 0x09, /* unable to perform command request */ ELS_RJT_UNSUP = 0x0b, /* command not supported */ ELS_RJT_INPROG = 0x0e, /* command already in progress */ ELS_RJT_FIP = 0x20, /* FIP error */ ELS_RJT_VENDOR = 0xff, /* vendor specific error */ }; /* * reason code explanation (er_explan). */ enum fc_els_rjt_explan { ELS_EXPL_NONE = 0x00, /* No additional explanation */ ELS_EXPL_SPP_OPT_ERR = 0x01, /* service parameter error - options */ ELS_EXPL_SPP_ICTL_ERR = 0x03, /* service parm error - initiator ctl */ ELS_EXPL_AH = 0x11, /* invalid association header */ ELS_EXPL_AH_REQ = 0x13, /* association_header required */ ELS_EXPL_SID = 0x15, /* invalid originator S_ID */ ELS_EXPL_OXID_RXID = 0x17, /* invalid OX_ID-RX_ID combination */ ELS_EXPL_INPROG = 0x19, /* Request already in progress */ ELS_EXPL_PLOGI_REQD = 0x1e, /* N_Port login required */ ELS_EXPL_INSUF_RES = 0x29, /* insufficient resources */ ELS_EXPL_UNAB_DATA = 0x2a, /* unable to supply requested data */ ELS_EXPL_UNSUPR = 0x2c, /* Request not supported */ ELS_EXPL_INV_LEN = 0x2d, /* Invalid payload length */ ELS_EXPL_NOT_NEIGHBOR = 0x62, /* VN2VN_Port not in neighbor set */ /* TBD - above definitions incomplete */ }; /* * Common service parameters (N ports). */ struct fc_els_csp { __u8 sp_hi_ver; /* highest version supported (obs.) */ __u8 sp_lo_ver; /* highest version supported (obs.) */ __be16 sp_bb_cred; /* buffer-to-buffer credits */ __be16 sp_features; /* common feature flags */ __be16 sp_bb_data; /* b-b state number and data field sz */ union { struct { __be16 _sp_tot_seq; /* total concurrent sequences */ __be16 _sp_rel_off; /* rel. offset by info cat */ } sp_plogi; struct { __be32 _sp_r_a_tov; /* resource alloc. timeout msec */ } sp_flogi_acc; } sp_u; __be32 sp_e_d_tov; /* error detect timeout value */ }; #define sp_tot_seq sp_u.sp_plogi._sp_tot_seq #define sp_rel_off sp_u.sp_plogi._sp_rel_off #define sp_r_a_tov sp_u.sp_flogi_acc._sp_r_a_tov #define FC_SP_BB_DATA_MASK 0xfff /* mask for data field size in sp_bb_data */ /* * Minimum and maximum values for max data field size in service parameters. */ #define FC_SP_MIN_MAX_PAYLOAD FC_MIN_MAX_PAYLOAD #define FC_SP_MAX_MAX_PAYLOAD FC_MAX_PAYLOAD /* * sp_features */ #define FC_SP_FT_NPIV 0x8000 /* multiple N_Port_ID support (FLOGI) */ #define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel off (PLOGI) */ #define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */ #define FC_SP_FT_RAND 0x4000 /* random relative offset */ #define FC_SP_FT_VAL 0x2000 /* valid vendor version level */ #define FC_SP_FT_NPIV_ACC 0x2000 /* NPIV assignment (FLOGI LS_ACC) */ #define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */ #define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */ #define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */ #define FC_SP_FT_MCAST 0x0200 /* multicast */ #define FC_SP_FT_BCAST 0x0100 /* broadcast */ #define FC_SP_FT_HUNT 0x0080 /* hunt group */ #define FC_SP_FT_SIMP 0x0040 /* dedicated simplex */ #define FC_SP_FT_SEC 0x0020 /* reserved for security */ #define FC_SP_FT_CSYN 0x0010 /* clock synch. supported */ #define FC_SP_FT_RTTOV 0x0008 /* R_T_TOV value 100 uS, else 100 mS */ #define FC_SP_FT_HALF 0x0004 /* dynamic half duplex */ #define FC_SP_FT_SEQC 0x0002 /* SEQ_CNT */ #define FC_SP_FT_PAYL 0x0001 /* FLOGI payload length 256, else 116 */ /* * Class-specific service parameters. */ struct fc_els_cssp { __be16 cp_class; /* class flags */ __be16 cp_init; /* initiator flags */ __be16 cp_recip; /* recipient flags */ __be16 cp_rdfs; /* receive data field size */ __be16 cp_con_seq; /* concurrent sequences */ __be16 cp_ee_cred; /* N-port end-to-end credit */ __u8 cp_resv1; /* reserved */ __u8 cp_open_seq; /* open sequences per exchange */ __u8 _cp_resv2[2]; /* reserved */ }; /* * cp_class flags. */ #define FC_CPC_VALID 0x8000 /* class valid */ #define FC_CPC_IMIX 0x4000 /* intermix mode */ #define FC_CPC_SEQ 0x0800 /* sequential delivery */ #define FC_CPC_CAMP 0x0200 /* camp-on */ #define FC_CPC_PRI 0x0080 /* priority */ /* * cp_init flags. * (TBD: not all flags defined here). */ #define FC_CPI_CSYN 0x0010 /* clock synch. capable */ /* * cp_recip flags. */ #define FC_CPR_CSYN 0x0008 /* clock synch. capable */ /* * NFC_ELS_FLOGI: Fabric login request. * NFC_ELS_PLOGI: Port login request (same format). */ struct fc_els_flogi { __u8 fl_cmd; /* command */ __u8 _fl_resvd[3]; /* must be zero */ struct fc_els_csp fl_csp; /* common service parameters */ __be64 fl_wwpn; /* port name */ __be64 fl_wwnn; /* node name */ struct fc_els_cssp fl_cssp[4]; /* class 1-4 service parameters */ __u8 fl_vend[16]; /* vendor version level */ } __attribute__((__packed__)); /* * Process login service parameter page. */ struct fc_els_spp { __u8 spp_type; /* type code or common service params */ __u8 spp_type_ext; /* type code extension */ __u8 spp_flags; __u8 _spp_resvd; __be32 spp_orig_pa; /* originator process associator */ __be32 spp_resp_pa; /* responder process associator */ __be32 spp_params; /* service parameters */ }; /* * spp_flags. */ #define FC_SPP_OPA_VAL 0x80 /* originator proc. assoc. valid */ #define FC_SPP_RPA_VAL 0x40 /* responder proc. assoc. valid */ #define FC_SPP_EST_IMG_PAIR 0x20 /* establish image pair */ #define FC_SPP_RESP_MASK 0x0f /* mask for response code (below) */ /* * SPP response code in spp_flags - lower 4 bits. */ enum fc_els_spp_resp { FC_SPP_RESP_ACK = 1, /* request executed */ FC_SPP_RESP_RES = 2, /* unable due to lack of resources */ FC_SPP_RESP_INIT = 3, /* initialization not complete */ FC_SPP_RESP_NO_PA = 4, /* unknown process associator */ FC_SPP_RESP_CONF = 5, /* configuration precludes image pair */ FC_SPP_RESP_COND = 6, /* request completed conditionally */ FC_SPP_RESP_MULT = 7, /* unable to handle multiple SPPs */ FC_SPP_RESP_INVL = 8, /* SPP is invalid */ }; /* * ELS_RRQ - Reinstate Recovery Qualifier */ struct fc_els_rrq { __u8 rrq_cmd; /* command (0x12) */ __u8 rrq_zero[3]; /* specified as zero - part of cmd */ __u8 rrq_resvd; /* reserved */ __u8 rrq_s_id[3]; /* originator FID */ __be16 rrq_ox_id; /* originator exchange ID */ __be16 rrq_rx_id; /* responders exchange ID */ }; /* * ELS_REC - Read exchange concise. */ struct fc_els_rec { __u8 rec_cmd; /* command (0x13) */ __u8 rec_zero[3]; /* specified as zero - part of cmd */ __u8 rec_resvd; /* reserved */ __u8 rec_s_id[3]; /* originator FID */ __be16 rec_ox_id; /* originator exchange ID */ __be16 rec_rx_id; /* responders exchange ID */ }; /* * ELS_REC LS_ACC payload. */ struct fc_els_rec_acc { __u8 reca_cmd; /* accept (0x02) */ __u8 reca_zero[3]; /* specified as zero - part of cmd */ __be16 reca_ox_id; /* originator exchange ID */ __be16 reca_rx_id; /* responders exchange ID */ __u8 reca_resvd1; /* reserved */ __u8 reca_ofid[3]; /* originator FID */ __u8 reca_resvd2; /* reserved */ __u8 reca_rfid[3]; /* responder FID */ __be32 reca_fc4value; /* FC4 value */ __be32 reca_e_stat; /* ESB (exchange status block) status */ }; /* * ELS_PRLI - Process login request and response. */ struct fc_els_prli { __u8 prli_cmd; /* command */ __u8 prli_spp_len; /* length of each serv. parm. page */ __be16 prli_len; /* length of entire payload */ /* service parameter pages follow */ }; /* * ELS_PRLO - Process logout request and response. */ struct fc_els_prlo { __u8 prlo_cmd; /* command */ __u8 prlo_obs; /* obsolete, but shall be set to 10h */ __be16 prlo_len; /* payload length */ }; /* * ELS_ADISC payload */ struct fc_els_adisc { __u8 adisc_cmd; __u8 adisc_resv[3]; __u8 adisc_resv1; __u8 adisc_hard_addr[3]; __be64 adisc_wwpn; __be64 adisc_wwnn; __u8 adisc_resv2; __u8 adisc_port_id[3]; } __attribute__((__packed__)); /* * ELS_LOGO - process or fabric logout. */ struct fc_els_logo { __u8 fl_cmd; /* command code */ __u8 fl_zero[3]; /* specified as zero - part of cmd */ __u8 fl_resvd; /* reserved */ __u8 fl_n_port_id[3];/* N port ID */ __be64 fl_n_port_wwn; /* port name */ }; /* * ELS_RTV - read timeout value. */ struct fc_els_rtv { __u8 rtv_cmd; /* command code 0x0e */ __u8 rtv_zero[3]; /* specified as zero - part of cmd */ }; /* * LS_ACC for ELS_RTV - read timeout value. */ struct fc_els_rtv_acc { __u8 rtv_cmd; /* command code 0x02 */ __u8 rtv_zero[3]; /* specified as zero - part of cmd */ __be32 rtv_r_a_tov; /* resource allocation timeout value */ __be32 rtv_e_d_tov; /* error detection timeout value */ __be32 rtv_toq; /* timeout qualifier (see below) */ }; /* * rtv_toq bits. */ #define FC_ELS_RTV_EDRES (1 << 26) /* E_D_TOV resolution is nS else mS */ #define FC_ELS_RTV_RTTOV (1 << 19) /* R_T_TOV is 100 uS else 100 mS */ /* * ELS_SCR - state change registration payload. */ struct fc_els_scr { __u8 scr_cmd; /* command code */ __u8 scr_resv[6]; /* reserved */ __u8 scr_reg_func; /* registration function (see below) */ }; enum fc_els_scr_func { ELS_SCRF_FAB = 1, /* fabric-detected registration */ ELS_SCRF_NPORT = 2, /* Nx_Port-detected registration */ ELS_SCRF_FULL = 3, /* full registration */ ELS_SCRF_CLEAR = 255, /* remove any current registrations */ }; /* * ELS_RSCN - registered state change notification payload. */ struct fc_els_rscn { __u8 rscn_cmd; /* RSCN opcode (0x61) */ __u8 rscn_page_len; /* page length (4) */ __be16 rscn_plen; /* payload length including this word */ /* followed by 4-byte generic affected Port_ID pages */ }; struct fc_els_rscn_page { __u8 rscn_page_flags; /* event and address format */ __u8 rscn_fid[3]; /* fabric ID */ }; #define ELS_RSCN_EV_QUAL_BIT 2 /* shift count for event qualifier */ #define ELS_RSCN_EV_QUAL_MASK 0xf /* mask for event qualifier */ #define ELS_RSCN_ADDR_FMT_BIT 0 /* shift count for address format */ #define ELS_RSCN_ADDR_FMT_MASK 0x3 /* mask for address format */ enum fc_els_rscn_ev_qual { ELS_EV_QUAL_NONE = 0, /* unspecified */ ELS_EV_QUAL_NS_OBJ = 1, /* changed name server object */ ELS_EV_QUAL_PORT_ATTR = 2, /* changed port attribute */ ELS_EV_QUAL_SERV_OBJ = 3, /* changed service object */ ELS_EV_QUAL_SW_CONFIG = 4, /* changed switch configuration */ ELS_EV_QUAL_REM_OBJ = 5, /* removed object */ }; enum fc_els_rscn_addr_fmt { ELS_ADDR_FMT_PORT = 0, /* rscn_fid is a port address */ ELS_ADDR_FMT_AREA = 1, /* rscn_fid is a area address */ ELS_ADDR_FMT_DOM = 2, /* rscn_fid is a domain address */ ELS_ADDR_FMT_FAB = 3, /* anything on fabric may have changed */ }; /* * ELS_RNID - request Node ID. */ struct fc_els_rnid { __u8 rnid_cmd; /* RNID opcode (0x78) */ __u8 rnid_resv[3]; /* reserved */ __u8 rnid_fmt; /* data format */ __u8 rnid_resv2[3]; /* reserved */ }; /* * Node Identification Data formats (rnid_fmt) */ enum fc_els_rnid_fmt { ELS_RNIDF_NONE = 0, /* no specific identification data */ ELS_RNIDF_GEN = 0xdf, /* general topology discovery format */ }; /* * ELS_RNID response. */ struct fc_els_rnid_resp { __u8 rnid_cmd; /* response code (LS_ACC) */ __u8 rnid_resv[3]; /* reserved */ __u8 rnid_fmt; /* data format */ __u8 rnid_cid_len; /* common ID data length */ __u8 rnid_resv2; /* reserved */ __u8 rnid_sid_len; /* specific ID data length */ }; struct fc_els_rnid_cid { __be64 rnid_wwpn; /* N port name */ __be64 rnid_wwnn; /* node name */ }; struct fc_els_rnid_gen { __u8 rnid_vend_id[16]; /* vendor-unique ID */ __be32 rnid_atype; /* associated type (see below) */ __be32 rnid_phys_port; /* physical port number */ __be32 rnid_att_nodes; /* number of attached nodes */ __u8 rnid_node_mgmt; /* node management (see below) */ __u8 rnid_ip_ver; /* IP version (see below) */ __be16 rnid_prot_port; /* UDP / TCP port number */ __be32 rnid_ip_addr[4]; /* IP address */ __u8 rnid_resvd[2]; /* reserved */ __be16 rnid_vend_spec; /* vendor-specific field */ }; enum fc_els_rnid_atype { ELS_RNIDA_UNK = 0x01, /* unknown */ ELS_RNIDA_OTHER = 0x02, /* none of the following */ ELS_RNIDA_HUB = 0x03, ELS_RNIDA_SWITCH = 0x04, ELS_RNIDA_GATEWAY = 0x05, ELS_RNIDA_CONV = 0x06, /* Obsolete, do not use this value */ ELS_RNIDA_HBA = 0x07, /* Obsolete, do not use this value */ ELS_RNIDA_PROXY = 0x08, /* Obsolete, do not use this value */ ELS_RNIDA_STORAGE = 0x09, ELS_RNIDA_HOST = 0x0a, ELS_RNIDA_SUBSYS = 0x0b, /* storage subsystem (e.g., RAID) */ ELS_RNIDA_ACCESS = 0x0e, /* access device (e.g. media changer) */ ELS_RNIDA_NAS = 0x11, /* NAS server */ ELS_RNIDA_BRIDGE = 0x12, /* bridge */ ELS_RNIDA_VIRT = 0x13, /* virtualization device */ ELS_RNIDA_MF = 0xff, /* multifunction device (bits below) */ ELS_RNIDA_MF_HUB = 1UL << 31, /* hub */ ELS_RNIDA_MF_SW = 1UL << 30, /* switch */ ELS_RNIDA_MF_GW = 1UL << 29, /* gateway */ ELS_RNIDA_MF_ST = 1UL << 28, /* storage */ ELS_RNIDA_MF_HOST = 1UL << 27, /* host */ ELS_RNIDA_MF_SUB = 1UL << 26, /* storage subsystem */ ELS_RNIDA_MF_ACC = 1UL << 25, /* storage access dev */ ELS_RNIDA_MF_WDM = 1UL << 24, /* wavelength division mux */ ELS_RNIDA_MF_NAS = 1UL << 23, /* NAS server */ ELS_RNIDA_MF_BR = 1UL << 22, /* bridge */ ELS_RNIDA_MF_VIRT = 1UL << 21, /* virtualization device */ }; enum fc_els_rnid_mgmt { ELS_RNIDM_SNMP = 0, ELS_RNIDM_TELNET = 1, ELS_RNIDM_HTTP = 2, ELS_RNIDM_HTTPS = 3, ELS_RNIDM_XML = 4, /* HTTP + XML */ }; enum fc_els_rnid_ipver { ELS_RNIDIP_NONE = 0, /* no IP support or node mgmt. */ ELS_RNIDIP_V4 = 1, /* IPv4 */ ELS_RNIDIP_V6 = 2, /* IPv6 */ }; /* * ELS RPL - Read Port List. */ struct fc_els_rpl { __u8 rpl_cmd; /* command */ __u8 rpl_resv[5]; /* reserved - must be zero */ __be16 rpl_max_size; /* maximum response size or zero */ __u8 rpl_resv1; /* reserved - must be zero */ __u8 rpl_index[3]; /* starting index */ }; /* * Port number block in RPL response. */ struct fc_els_pnb { __be32 pnb_phys_pn; /* physical port number */ __u8 pnb_resv; /* reserved */ __u8 pnb_port_id[3]; /* port ID */ __be64 pnb_wwpn; /* port name */ }; /* * RPL LS_ACC response. */ struct fc_els_rpl_resp { __u8 rpl_cmd; /* ELS_LS_ACC */ __u8 rpl_resv1; /* reserved - must be zero */ __be16 rpl_plen; /* payload length */ __u8 rpl_resv2; /* reserved - must be zero */ __u8 rpl_llen[3]; /* list length */ __u8 rpl_resv3; /* reserved - must be zero */ __u8 rpl_index[3]; /* starting index */ struct fc_els_pnb rpl_pnb[1]; /* variable number of PNBs */ }; /* * Link Error Status Block. */ struct fc_els_lesb { __be32 lesb_link_fail; /* link failure count */ __be32 lesb_sync_loss; /* loss of synchronization count */ __be32 lesb_sig_loss; /* loss of signal count */ __be32 lesb_prim_err; /* primitive sequence error count */ __be32 lesb_inv_word; /* invalid transmission word count */ __be32 lesb_inv_crc; /* invalid CRC count */ }; /* * ELS RPS - Read Port Status Block request. */ struct fc_els_rps { __u8 rps_cmd; /* command */ __u8 rps_resv[2]; /* reserved - must be zero */ __u8 rps_flag; /* flag - see below */ __be64 rps_port_spec; /* port selection */ }; enum fc_els_rps_flag { FC_ELS_RPS_DID = 0x00, /* port identified by D_ID of req. */ FC_ELS_RPS_PPN = 0x01, /* port_spec is physical port number */ FC_ELS_RPS_WWPN = 0x02, /* port_spec is port WWN */ }; /* * ELS RPS LS_ACC response. */ struct fc_els_rps_resp { __u8 rps_cmd; /* command - LS_ACC */ __u8 rps_resv[2]; /* reserved - must be zero */ __u8 rps_flag; /* flag - see below */ __u8 rps_resv2[2]; /* reserved */ __be16 rps_status; /* port status - see below */ struct fc_els_lesb rps_lesb; /* link error status block */ }; enum fc_els_rps_resp_flag { FC_ELS_RPS_LPEV = 0x01, /* L_port extension valid */ }; enum fc_els_rps_resp_status { FC_ELS_RPS_PTP = 1 << 5, /* point-to-point connection */ FC_ELS_RPS_LOOP = 1 << 4, /* loop mode */ FC_ELS_RPS_FAB = 1 << 3, /* fabric present */ FC_ELS_RPS_NO_SIG = 1 << 2, /* loss of signal */ FC_ELS_RPS_NO_SYNC = 1 << 1, /* loss of synchronization */ FC_ELS_RPS_RESET = 1 << 0, /* in link reset protocol */ }; /* * ELS LIRR - Link Incident Record Registration request. */ struct fc_els_lirr { __u8 lirr_cmd; /* command */ __u8 lirr_resv[3]; /* reserved - must be zero */ __u8 lirr_func; /* registration function */ __u8 lirr_fmt; /* FC-4 type of RLIR requested */ __u8 lirr_resv2[2]; /* reserved - must be zero */ }; enum fc_els_lirr_func { ELS_LIRR_SET_COND = 0x01, /* set - conditionally receive */ ELS_LIRR_SET_UNCOND = 0x02, /* set - unconditionally receive */ ELS_LIRR_CLEAR = 0xff /* clear registration */ }; /* * ELS SRL - Scan Remote Loop request. */ struct fc_els_srl { __u8 srl_cmd; /* command */ __u8 srl_resv[3]; /* reserved - must be zero */ __u8 srl_flag; /* flag - see below */ __u8 srl_flag_param[3]; /* flag parameter */ }; enum fc_els_srl_flag { FC_ELS_SRL_ALL = 0x00, /* scan all FL ports */ FC_ELS_SRL_ONE = 0x01, /* scan specified loop */ FC_ELS_SRL_EN_PER = 0x02, /* enable periodic scanning (param) */ FC_ELS_SRL_DIS_PER = 0x03, /* disable periodic scanning */ }; /* * ELS RLS - Read Link Error Status Block request. */ struct fc_els_rls { __u8 rls_cmd; /* command */ __u8 rls_resv[4]; /* reserved - must be zero */ __u8 rls_port_id[3]; /* port ID */ }; /* * ELS RLS LS_ACC Response. */ struct fc_els_rls_resp { __u8 rls_cmd; /* ELS_LS_ACC */ __u8 rls_resv[3]; /* reserved - must be zero */ struct fc_els_lesb rls_lesb; /* link error status block */ }; /* * ELS RLIR - Registered Link Incident Report. * This is followed by the CLIR and the CLID, described below. */ struct fc_els_rlir { __u8 rlir_cmd; /* command */ __u8 rlir_resv[3]; /* reserved - must be zero */ __u8 rlir_fmt; /* format (FC4-type if type specific) */ __u8 rlir_clr_len; /* common link incident record length */ __u8 rlir_cld_len; /* common link incident desc. length */ __u8 rlir_slr_len; /* spec. link incident record length */ }; /* * CLIR - Common Link Incident Record Data. - Sent via RLIR. */ struct fc_els_clir { __be64 clir_wwpn; /* incident port name */ __be64 clir_wwnn; /* incident port node name */ __u8 clir_port_type; /* incident port type */ __u8 clir_port_id[3]; /* incident port ID */ __be64 clir_conn_wwpn; /* connected port name */ __be64 clir_conn_wwnn; /* connected node name */ __be64 clir_fab_name; /* fabric name */ __be32 clir_phys_port; /* physical port number */ __be32 clir_trans_id; /* transaction ID */ __u8 clir_resv[3]; /* reserved */ __u8 clir_ts_fmt; /* time stamp format */ __be64 clir_timestamp; /* time stamp */ }; /* * CLIR clir_ts_fmt - time stamp format values. */ enum fc_els_clir_ts_fmt { ELS_CLIR_TS_UNKNOWN = 0, /* time stamp field unknown */ ELS_CLIR_TS_SEC_FRAC = 1, /* time in seconds and fractions */ ELS_CLIR_TS_CSU = 2, /* time in clock synch update format */ }; /* * Common Link Incident Descriptor - sent via RLIR. */ struct fc_els_clid { __u8 clid_iq; /* incident qualifier flags */ __u8 clid_ic; /* incident code */ __be16 clid_epai; /* domain/area of ISL */ }; /* * CLID incident qualifier flags. */ enum fc_els_clid_iq { ELS_CLID_SWITCH = 0x20, /* incident port is a switch node */ ELS_CLID_E_PORT = 0x10, /* incident is an ISL (E) port */ ELS_CLID_SEV_MASK = 0x0c, /* severity 2-bit field mask */ ELS_CLID_SEV_INFO = 0x00, /* report is informational */ ELS_CLID_SEV_INOP = 0x08, /* link not operational */ ELS_CLID_SEV_DEG = 0x04, /* link degraded but operational */ ELS_CLID_LASER = 0x02, /* subassembly is a laser */ ELS_CLID_FRU = 0x01, /* format can identify a FRU */ }; /* * CLID incident code. */ enum fc_els_clid_ic { ELS_CLID_IC_IMPL = 1, /* implicit incident */ ELS_CLID_IC_BER = 2, /* bit-error-rate threshold exceeded */ ELS_CLID_IC_LOS = 3, /* loss of synch or signal */ ELS_CLID_IC_NOS = 4, /* non-operational primitive sequence */ ELS_CLID_IC_PST = 5, /* primitive sequence timeout */ ELS_CLID_IC_INVAL = 6, /* invalid primitive sequence */ ELS_CLID_IC_LOOP_TO = 7, /* loop initialization time out */ ELS_CLID_IC_LIP = 8, /* receiving LIP */ }; #endif /* _FC_ELS_H_ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������scsi/fc/fc_fs.h�������������������������������������������������������������������������������������0000644�����������������00000030117�14763166026�0007343 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright(c) 2007 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope 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., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. * * Maintained at www.Open-FCoE.org */ #ifndef _FC_FS_H_ #define _FC_FS_H_ #include <linux/types.h> /* * Fibre Channel Framing and Signalling definitions. * From T11 FC-FS-2 Rev 0.90 - 9 August 2005. */ /* * Frame header */ struct fc_frame_header { __u8 fh_r_ctl; /* routing control */ __u8 fh_d_id[3]; /* Destination ID */ __u8 fh_cs_ctl; /* class of service control / pri */ __u8 fh_s_id[3]; /* Source ID */ __u8 fh_type; /* see enum fc_fh_type below */ __u8 fh_f_ctl[3]; /* frame control */ __u8 fh_seq_id; /* sequence ID */ __u8 fh_df_ctl; /* data field control */ __be16 fh_seq_cnt; /* sequence count */ __be16 fh_ox_id; /* originator exchange ID */ __be16 fh_rx_id; /* responder exchange ID */ __be32 fh_parm_offset; /* parameter or relative offset */ }; #define FC_FRAME_HEADER_LEN 24 /* expected length of structure */ #define FC_MAX_PAYLOAD 2112U /* max payload length in bytes */ #define FC_MIN_MAX_PAYLOAD 256U /* lower limit on max payload */ #define FC_MAX_FRAME (FC_MAX_PAYLOAD + FC_FRAME_HEADER_LEN) #define FC_MIN_MAX_FRAME (FC_MIN_MAX_PAYLOAD + FC_FRAME_HEADER_LEN) /* * fh_r_ctl - Routing control definitions. */ /* * FC-4 device_data. */ enum fc_rctl { FC_RCTL_DD_UNCAT = 0x00, /* uncategorized information */ FC_RCTL_DD_SOL_DATA = 0x01, /* solicited data */ FC_RCTL_DD_UNSOL_CTL = 0x02, /* unsolicited control */ FC_RCTL_DD_SOL_CTL = 0x03, /* solicited control or reply */ FC_RCTL_DD_UNSOL_DATA = 0x04, /* unsolicited data */ FC_RCTL_DD_DATA_DESC = 0x05, /* data descriptor */ FC_RCTL_DD_UNSOL_CMD = 0x06, /* unsolicited command */ FC_RCTL_DD_CMD_STATUS = 0x07, /* command status */ #define FC_RCTL_ILS_REQ FC_RCTL_DD_UNSOL_CTL /* ILS request */ #define FC_RCTL_ILS_REP FC_RCTL_DD_SOL_CTL /* ILS reply */ /* * Extended Link_Data */ FC_RCTL_ELS_REQ = 0x22, /* extended link services request */ FC_RCTL_ELS_REP = 0x23, /* extended link services reply */ FC_RCTL_ELS4_REQ = 0x32, /* FC-4 ELS request */ FC_RCTL_ELS4_REP = 0x33, /* FC-4 ELS reply */ /* * Optional Extended Headers */ FC_RCTL_VFTH = 0x50, /* virtual fabric tagging header */ FC_RCTL_IFRH = 0x51, /* inter-fabric routing header */ FC_RCTL_ENCH = 0x52, /* encapsulation header */ /* * Basic Link Services fh_r_ctl values. */ FC_RCTL_BA_NOP = 0x80, /* basic link service NOP */ FC_RCTL_BA_ABTS = 0x81, /* basic link service abort */ FC_RCTL_BA_RMC = 0x82, /* remove connection */ FC_RCTL_BA_ACC = 0x84, /* basic accept */ FC_RCTL_BA_RJT = 0x85, /* basic reject */ FC_RCTL_BA_PRMT = 0x86, /* dedicated connection preempted */ /* * Link Control Information. */ FC_RCTL_ACK_1 = 0xc0, /* acknowledge_1 */ FC_RCTL_ACK_0 = 0xc1, /* acknowledge_0 */ FC_RCTL_P_RJT = 0xc2, /* port reject */ FC_RCTL_F_RJT = 0xc3, /* fabric reject */ FC_RCTL_P_BSY = 0xc4, /* port busy */ FC_RCTL_F_BSY = 0xc5, /* fabric busy to data frame */ FC_RCTL_F_BSYL = 0xc6, /* fabric busy to link control frame */ FC_RCTL_LCR = 0xc7, /* link credit reset */ FC_RCTL_END = 0xc9, /* end */ }; /* incomplete list of definitions */ /* * R_CTL names initializer. * Please keep this matching the above definitions. */ #define FC_RCTL_NAMES_INIT { \ [FC_RCTL_DD_UNCAT] = "uncat", \ [FC_RCTL_DD_SOL_DATA] = "sol data", \ [FC_RCTL_DD_UNSOL_CTL] = "unsol ctl", \ [FC_RCTL_DD_SOL_CTL] = "sol ctl/reply", \ [FC_RCTL_DD_UNSOL_DATA] = "unsol data", \ [FC_RCTL_DD_DATA_DESC] = "data desc", \ [FC_RCTL_DD_UNSOL_CMD] = "unsol cmd", \ [FC_RCTL_DD_CMD_STATUS] = "cmd status", \ [FC_RCTL_ELS_REQ] = "ELS req", \ [FC_RCTL_ELS_REP] = "ELS rep", \ [FC_RCTL_ELS4_REQ] = "FC-4 ELS req", \ [FC_RCTL_ELS4_REP] = "FC-4 ELS rep", \ [FC_RCTL_BA_NOP] = "BLS NOP", \ [FC_RCTL_BA_ABTS] = "BLS abort", \ [FC_RCTL_BA_RMC] = "BLS remove connection", \ [FC_RCTL_BA_ACC] = "BLS accept", \ [FC_RCTL_BA_RJT] = "BLS reject", \ [FC_RCTL_BA_PRMT] = "BLS dedicated connection preempted", \ [FC_RCTL_ACK_1] = "LC ACK_1", \ [FC_RCTL_ACK_0] = "LC ACK_0", \ [FC_RCTL_P_RJT] = "LC port reject", \ [FC_RCTL_F_RJT] = "LC fabric reject", \ [FC_RCTL_P_BSY] = "LC port busy", \ [FC_RCTL_F_BSY] = "LC fabric busy to data frame", \ [FC_RCTL_F_BSYL] = "LC fabric busy to link control frame",\ [FC_RCTL_LCR] = "LC link credit reset", \ [FC_RCTL_END] = "LC end", \ } /* * Well-known fabric addresses. */ enum fc_well_known_fid { FC_FID_NONE = 0x000000, /* No destination */ FC_FID_BCAST = 0xffffff, /* broadcast */ FC_FID_FLOGI = 0xfffffe, /* fabric login */ FC_FID_FCTRL = 0xfffffd, /* fabric controller */ FC_FID_DIR_SERV = 0xfffffc, /* directory server */ FC_FID_TIME_SERV = 0xfffffb, /* time server */ FC_FID_MGMT_SERV = 0xfffffa, /* management server */ FC_FID_QOS = 0xfffff9, /* QoS Facilitator */ FC_FID_ALIASES = 0xfffff8, /* alias server (FC-PH2) */ FC_FID_SEC_KEY = 0xfffff7, /* Security key dist. server */ FC_FID_CLOCK = 0xfffff6, /* clock synch server */ FC_FID_MCAST_SERV = 0xfffff5, /* multicast server */ }; #define FC_FID_WELL_KNOWN_MAX 0xffffff /* highest well-known fabric ID */ #define FC_FID_WELL_KNOWN_BASE 0xfffff5 /* start of well-known fabric ID */ /* * Other well-known addresses, outside the above contiguous range. */ #define FC_FID_DOM_MGR 0xfffc00 /* domain manager base */ /* * Fabric ID bytes. */ #define FC_FID_DOMAIN 0 #define FC_FID_PORT 1 #define FC_FID_LINK 2 /* * fh_type codes */ enum fc_fh_type { FC_TYPE_BLS = 0x00, /* basic link service */ FC_TYPE_ELS = 0x01, /* extended link service */ FC_TYPE_IP = 0x05, /* IP over FC, RFC 4338 */ FC_TYPE_FCP = 0x08, /* SCSI FCP */ FC_TYPE_CT = 0x20, /* Fibre Channel Services (FC-CT) */ FC_TYPE_ILS = 0x22, /* internal link service */ FC_TYPE_NVME = 0x28, /* FC-NVME */ }; /* * FC_TYPE names initializer. * Please keep this matching the above definitions. */ #define FC_TYPE_NAMES_INIT { \ [FC_TYPE_BLS] = "BLS", \ [FC_TYPE_ELS] = "ELS", \ [FC_TYPE_IP] = "IP", \ [FC_TYPE_FCP] = "FCP", \ [FC_TYPE_CT] = "CT", \ [FC_TYPE_ILS] = "ILS", \ [FC_TYPE_NVME] = "NVME", \ } /* * Exchange IDs. */ #define FC_XID_UNKNOWN 0xffff /* unknown exchange ID */ #define FC_XID_MIN 0x0 /* supported min exchange ID */ #define FC_XID_MAX 0xfffe /* supported max exchange ID */ /* * fh_f_ctl - Frame control flags. */ #define FC_FC_EX_CTX (1 << 23) /* sent by responder to exchange */ #define FC_FC_SEQ_CTX (1 << 22) /* sent by responder to sequence */ #define FC_FC_FIRST_SEQ (1 << 21) /* first sequence of this exchange */ #define FC_FC_LAST_SEQ (1 << 20) /* last sequence of this exchange */ #define FC_FC_END_SEQ (1 << 19) /* last frame of sequence */ #define FC_FC_END_CONN (1 << 18) /* end of class 1 connection pending */ #define FC_FC_RES_B17 (1 << 17) /* reserved */ #define FC_FC_SEQ_INIT (1 << 16) /* transfer of sequence initiative */ #define FC_FC_X_ID_REASS (1 << 15) /* exchange ID has been changed */ #define FC_FC_X_ID_INVAL (1 << 14) /* exchange ID invalidated */ #define FC_FC_ACK_1 (1 << 12) /* 13:12 = 1: ACK_1 expected */ #define FC_FC_ACK_N (2 << 12) /* 13:12 = 2: ACK_N expected */ #define FC_FC_ACK_0 (3 << 12) /* 13:12 = 3: ACK_0 expected */ #define FC_FC_RES_B11 (1 << 11) /* reserved */ #define FC_FC_RES_B10 (1 << 10) /* reserved */ #define FC_FC_RETX_SEQ (1 << 9) /* retransmitted sequence */ #define FC_FC_UNI_TX (1 << 8) /* unidirectional transmit (class 1) */ #define FC_FC_CONT_SEQ(i) ((i) << 6) #define FC_FC_ABT_SEQ(i) ((i) << 4) #define FC_FC_REL_OFF (1 << 3) /* parameter is relative offset */ #define FC_FC_RES2 (1 << 2) /* reserved */ #define FC_FC_FILL(i) ((i) & 3) /* 1:0: bytes of trailing fill */ /* * BA_ACC payload. */ struct fc_ba_acc { __u8 ba_seq_id_val; /* SEQ_ID validity */ #define FC_BA_SEQ_ID_VAL 0x80 __u8 ba_seq_id; /* SEQ_ID of seq last deliverable */ __u8 ba_resvd[2]; /* reserved */ __be16 ba_ox_id; /* OX_ID for aborted seq or exch */ __be16 ba_rx_id; /* RX_ID for aborted seq or exch */ __be16 ba_low_seq_cnt; /* low SEQ_CNT of aborted seq */ __be16 ba_high_seq_cnt; /* high SEQ_CNT of aborted seq */ }; /* * BA_RJT: Basic Reject payload. */ struct fc_ba_rjt { __u8 br_resvd; /* reserved */ __u8 br_reason; /* reason code */ __u8 br_explan; /* reason explanation */ __u8 br_vendor; /* vendor unique code */ }; /* * BA_RJT reason codes. * From FS-2. */ enum fc_ba_rjt_reason { FC_BA_RJT_NONE = 0, /* in software this means no reject */ FC_BA_RJT_INVL_CMD = 0x01, /* invalid command code */ FC_BA_RJT_LOG_ERR = 0x03, /* logical error */ FC_BA_RJT_LOG_BUSY = 0x05, /* logical busy */ FC_BA_RJT_PROTO_ERR = 0x07, /* protocol error */ FC_BA_RJT_UNABLE = 0x09, /* unable to perform request */ FC_BA_RJT_VENDOR = 0xff, /* vendor-specific (see br_vendor) */ }; /* * BA_RJT reason code explanations. */ enum fc_ba_rjt_explan { FC_BA_RJT_EXP_NONE = 0x00, /* no additional expanation */ FC_BA_RJT_INV_XID = 0x03, /* invalid OX_ID-RX_ID combination */ FC_BA_RJT_ABT = 0x05, /* sequence aborted, no seq info */ }; /* * P_RJT or F_RJT: Port Reject or Fabric Reject parameter field. */ struct fc_pf_rjt { __u8 rj_action; /* reserved */ __u8 rj_reason; /* reason code */ __u8 rj_resvd; /* reserved */ __u8 rj_vendor; /* vendor unique code */ }; /* * P_RJT and F_RJT reject reason codes. */ enum fc_pf_rjt_reason { FC_RJT_NONE = 0, /* non-reject (reserved by standard) */ FC_RJT_INVL_DID = 0x01, /* invalid destination ID */ FC_RJT_INVL_SID = 0x02, /* invalid source ID */ FC_RJT_P_UNAV_T = 0x03, /* port unavailable, temporary */ FC_RJT_P_UNAV = 0x04, /* port unavailable, permanent */ FC_RJT_CLS_UNSUP = 0x05, /* class not supported */ FC_RJT_DEL_USAGE = 0x06, /* delimiter usage error */ FC_RJT_TYPE_UNSUP = 0x07, /* type not supported */ FC_RJT_LINK_CTL = 0x08, /* invalid link control */ FC_RJT_R_CTL = 0x09, /* invalid R_CTL field */ FC_RJT_F_CTL = 0x0a, /* invalid F_CTL field */ FC_RJT_OX_ID = 0x0b, /* invalid originator exchange ID */ FC_RJT_RX_ID = 0x0c, /* invalid responder exchange ID */ FC_RJT_SEQ_ID = 0x0d, /* invalid sequence ID */ FC_RJT_DF_CTL = 0x0e, /* invalid DF_CTL field */ FC_RJT_SEQ_CNT = 0x0f, /* invalid SEQ_CNT field */ FC_RJT_PARAM = 0x10, /* invalid parameter field */ FC_RJT_EXCH_ERR = 0x11, /* exchange error */ FC_RJT_PROTO = 0x12, /* protocol error */ FC_RJT_LEN = 0x13, /* incorrect length */ FC_RJT_UNEXP_ACK = 0x14, /* unexpected ACK */ FC_RJT_FAB_CLASS = 0x15, /* class unsupported by fabric entity */ FC_RJT_LOGI_REQ = 0x16, /* login required */ FC_RJT_SEQ_XS = 0x17, /* excessive sequences attempted */ FC_RJT_EXCH_EST = 0x18, /* unable to establish exchange */ FC_RJT_FAB_UNAV = 0x1a, /* fabric unavailable */ FC_RJT_VC_ID = 0x1b, /* invalid VC_ID (class 4) */ FC_RJT_CS_CTL = 0x1c, /* invalid CS_CTL field */ FC_RJT_INSUF_RES = 0x1d, /* insuff. resources for VC (Class 4) */ FC_RJT_INVL_CLS = 0x1f, /* invalid class of service */ FC_RJT_PREEMT_RJT = 0x20, /* preemption request rejected */ FC_RJT_PREEMT_DIS = 0x21, /* preemption not enabled */ FC_RJT_MCAST_ERR = 0x22, /* multicast error */ FC_RJT_MCAST_ET = 0x23, /* multicast error terminate */ FC_RJT_PRLI_REQ = 0x24, /* process login required */ FC_RJT_INVL_ATT = 0x25, /* invalid attachment */ FC_RJT_VENDOR = 0xff, /* vendor specific reject */ }; /* default timeout values */ #define FC_DEF_E_D_TOV 2000UL #define FC_DEF_R_A_TOV 10000UL #endif /* _FC_FS_H_ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������scsi/fc/fc_gs.h�������������������������������������������������������������������������������������0000644�����������������00000005517�14763166026�0007352 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright(c) 2007 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope 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., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. * * Maintained at www.Open-FCoE.org */ #ifndef _FC_GS_H_ #define _FC_GS_H_ #include <linux/types.h> /* * Fibre Channel Services - Common Transport. * From T11.org FC-GS-2 Rev 5.3 November 1998. */ struct fc_ct_hdr { __u8 ct_rev; /* revision */ __u8 ct_in_id[3]; /* N_Port ID of original requestor */ __u8 ct_fs_type; /* type of fibre channel service */ __u8 ct_fs_subtype; /* subtype */ __u8 ct_options; __u8 _ct_resvd1; __be16 ct_cmd; /* command / response code */ __be16 ct_mr_size; /* maximum / residual size */ __u8 _ct_resvd2; __u8 ct_reason; /* reject reason */ __u8 ct_explan; /* reason code explanation */ __u8 ct_vendor; /* vendor unique data */ }; #define FC_CT_HDR_LEN 16 /* expected sizeof (struct fc_ct_hdr) */ enum fc_ct_rev { FC_CT_REV = 1 /* common transport revision */ }; /* * ct_fs_type values. */ enum fc_ct_fs_type { FC_FST_ALIAS = 0xf8, /* alias service */ FC_FST_MGMT = 0xfa, /* management service */ FC_FST_TIME = 0xfb, /* time service */ FC_FST_DIR = 0xfc, /* directory service */ }; /* * ct_cmd: Command / response codes */ enum fc_ct_cmd { FC_FS_RJT = 0x8001, /* reject */ FC_FS_ACC = 0x8002, /* accept */ }; /* * FS_RJT reason codes. */ enum fc_ct_reason { FC_FS_RJT_CMD = 0x01, /* invalid command code */ FC_FS_RJT_VER = 0x02, /* invalid version level */ FC_FS_RJT_LOG = 0x03, /* logical error */ FC_FS_RJT_IUSIZ = 0x04, /* invalid IU size */ FC_FS_RJT_BSY = 0x05, /* logical busy */ FC_FS_RJT_PROTO = 0x07, /* protocol error */ FC_FS_RJT_UNABL = 0x09, /* unable to perform command request */ FC_FS_RJT_UNSUP = 0x0b, /* command not supported */ }; /* * FS_RJT reason code explanations. */ enum fc_ct_explan { FC_FS_EXP_NONE = 0x00, /* no additional explanation */ FC_FS_EXP_PID = 0x01, /* port ID not registered */ FC_FS_EXP_PNAM = 0x02, /* port name not registered */ FC_FS_EXP_NNAM = 0x03, /* node name not registered */ FC_FS_EXP_COS = 0x04, /* class of service not registered */ FC_FS_EXP_FTNR = 0x07, /* FC-4 types not registered */ /* definitions not complete */ }; #endif /* _FC_GS_H_ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������scsi/cxlflash_ioctl.h�������������������������������������������������������������������������������0000644�����������������00000023670�14763166026�0010677 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * CXL Flash Device Driver * * Written by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>, IBM Corporation * Matthew R. Ochs <mrochs@linux.vnet.ibm.com>, IBM Corporation * * Copyright (C) 2015 IBM Corporation * * 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. */ #ifndef _CXLFLASH_IOCTL_H #define _CXLFLASH_IOCTL_H #include <linux/types.h> /* * Structure and definitions for all CXL Flash ioctls */ #define CXLFLASH_WWID_LEN 16 /* * Structure and flag definitions CXL Flash superpipe ioctls */ #define DK_CXLFLASH_VERSION_0 0 struct dk_cxlflash_hdr { __u16 version; /* Version data */ __u16 rsvd[3]; /* Reserved for future use */ __u64 flags; /* Input flags */ __u64 return_flags; /* Returned flags */ }; /* * Return flag definitions available to all superpipe ioctls * * Similar to the input flags, these are grown from the bottom-up with the * intention that ioctl-specific return flag definitions would grow from the * top-down, allowing the two sets to co-exist. While not required/enforced * at this time, this provides future flexibility. */ #define DK_CXLFLASH_ALL_PORTS_ACTIVE 0x0000000000000001ULL #define DK_CXLFLASH_APP_CLOSE_ADAP_FD 0x0000000000000002ULL #define DK_CXLFLASH_CONTEXT_SQ_CMD_MODE 0x0000000000000004ULL /* * General Notes: * ------------- * The 'context_id' field of all ioctl structures contains the context * identifier for a context in the lower 32-bits (upper 32-bits are not * to be used when identifying a context to the AFU). That said, the value * in its entirety (all 64-bits) is to be treated as an opaque cookie and * should be presented as such when issuing ioctls. */ /* * DK_CXLFLASH_ATTACH Notes: * ------------------------ * Read/write access permissions are specified via the O_RDONLY, O_WRONLY, * and O_RDWR flags defined in the fcntl.h header file. * * A valid adapter file descriptor (fd >= 0) is only returned on the initial * attach (successful) of a context. When a context is shared(reused), the user * is expected to already 'know' the adapter file descriptor associated with the * context. */ #define DK_CXLFLASH_ATTACH_REUSE_CONTEXT 0x8000000000000000ULL struct dk_cxlflash_attach { struct dk_cxlflash_hdr hdr; /* Common fields */ __u64 num_interrupts; /* Requested number of interrupts */ __u64 context_id; /* Returned context */ __u64 mmio_size; /* Returned size of MMIO area */ __u64 block_size; /* Returned block size, in bytes */ __u64 adap_fd; /* Returned adapter file descriptor */ __u64 last_lba; /* Returned last LBA on the device */ __u64 max_xfer; /* Returned max transfer size, blocks */ __u64 reserved[8]; /* Reserved for future use */ }; struct dk_cxlflash_detach { struct dk_cxlflash_hdr hdr; /* Common fields */ __u64 context_id; /* Context to detach */ __u64 reserved[8]; /* Reserved for future use */ }; struct dk_cxlflash_udirect { struct dk_cxlflash_hdr hdr; /* Common fields */ __u64 context_id; /* Context to own physical resources */ __u64 rsrc_handle; /* Returned resource handle */ __u64 last_lba; /* Returned last LBA on the device */ __u64 reserved[8]; /* Reserved for future use */ }; #define DK_CXLFLASH_UVIRTUAL_NEED_WRITE_SAME 0x8000000000000000ULL struct dk_cxlflash_uvirtual { struct dk_cxlflash_hdr hdr; /* Common fields */ __u64 context_id; /* Context to own virtual resources */ __u64 lun_size; /* Requested size, in 4K blocks */ __u64 rsrc_handle; /* Returned resource handle */ __u64 last_lba; /* Returned last LBA of LUN */ __u64 reserved[8]; /* Reserved for future use */ }; struct dk_cxlflash_release { struct dk_cxlflash_hdr hdr; /* Common fields */ __u64 context_id; /* Context owning resources */ __u64 rsrc_handle; /* Resource handle to release */ __u64 reserved[8]; /* Reserved for future use */ }; struct dk_cxlflash_resize { struct dk_cxlflash_hdr hdr; /* Common fields */ __u64 context_id; /* Context owning resources */ __u64 rsrc_handle; /* Resource handle of LUN to resize */ __u64 req_size; /* New requested size, in 4K blocks */ __u64 last_lba; /* Returned last LBA of LUN */ __u64 reserved[8]; /* Reserved for future use */ }; struct dk_cxlflash_clone { struct dk_cxlflash_hdr hdr; /* Common fields */ __u64 context_id_src; /* Context to clone from */ __u64 context_id_dst; /* Context to clone to */ __u64 adap_fd_src; /* Source context adapter fd */ __u64 reserved[8]; /* Reserved for future use */ }; #define DK_CXLFLASH_VERIFY_SENSE_LEN 18 #define DK_CXLFLASH_VERIFY_HINT_SENSE 0x8000000000000000ULL struct dk_cxlflash_verify { struct dk_cxlflash_hdr hdr; /* Common fields */ __u64 context_id; /* Context owning resources to verify */ __u64 rsrc_handle; /* Resource handle of LUN */ __u64 hint; /* Reasons for verify */ __u64 last_lba; /* Returned last LBA of device */ __u8 sense_data[DK_CXLFLASH_VERIFY_SENSE_LEN]; /* SCSI sense data */ __u8 pad[6]; /* Pad to next 8-byte boundary */ __u64 reserved[8]; /* Reserved for future use */ }; #define DK_CXLFLASH_RECOVER_AFU_CONTEXT_RESET 0x8000000000000000ULL struct dk_cxlflash_recover_afu { struct dk_cxlflash_hdr hdr; /* Common fields */ __u64 reason; /* Reason for recovery request */ __u64 context_id; /* Context to recover / updated ID */ __u64 mmio_size; /* Returned size of MMIO area */ __u64 adap_fd; /* Returned adapter file descriptor */ __u64 reserved[8]; /* Reserved for future use */ }; #define DK_CXLFLASH_MANAGE_LUN_WWID_LEN CXLFLASH_WWID_LEN #define DK_CXLFLASH_MANAGE_LUN_ENABLE_SUPERPIPE 0x8000000000000000ULL #define DK_CXLFLASH_MANAGE_LUN_DISABLE_SUPERPIPE 0x4000000000000000ULL #define DK_CXLFLASH_MANAGE_LUN_ALL_PORTS_ACCESSIBLE 0x2000000000000000ULL struct dk_cxlflash_manage_lun { struct dk_cxlflash_hdr hdr; /* Common fields */ __u8 wwid[DK_CXLFLASH_MANAGE_LUN_WWID_LEN]; /* Page83 WWID, NAA-6 */ __u64 reserved[8]; /* Rsvd, future use */ }; union cxlflash_ioctls { struct dk_cxlflash_attach attach; struct dk_cxlflash_detach detach; struct dk_cxlflash_udirect udirect; struct dk_cxlflash_uvirtual uvirtual; struct dk_cxlflash_release release; struct dk_cxlflash_resize resize; struct dk_cxlflash_clone clone; struct dk_cxlflash_verify verify; struct dk_cxlflash_recover_afu recover_afu; struct dk_cxlflash_manage_lun manage_lun; }; #define MAX_CXLFLASH_IOCTL_SZ (sizeof(union cxlflash_ioctls)) #define CXL_MAGIC 0xCA #define CXL_IOWR(_n, _s) _IOWR(CXL_MAGIC, _n, struct _s) /* * CXL Flash superpipe ioctls start at base of the reserved CXL_MAGIC * region (0x80) and grow upwards. */ #define DK_CXLFLASH_ATTACH CXL_IOWR(0x80, dk_cxlflash_attach) #define DK_CXLFLASH_USER_DIRECT CXL_IOWR(0x81, dk_cxlflash_udirect) #define DK_CXLFLASH_RELEASE CXL_IOWR(0x82, dk_cxlflash_release) #define DK_CXLFLASH_DETACH CXL_IOWR(0x83, dk_cxlflash_detach) #define DK_CXLFLASH_VERIFY CXL_IOWR(0x84, dk_cxlflash_verify) #define DK_CXLFLASH_RECOVER_AFU CXL_IOWR(0x85, dk_cxlflash_recover_afu) #define DK_CXLFLASH_MANAGE_LUN CXL_IOWR(0x86, dk_cxlflash_manage_lun) #define DK_CXLFLASH_USER_VIRTUAL CXL_IOWR(0x87, dk_cxlflash_uvirtual) #define DK_CXLFLASH_VLUN_RESIZE CXL_IOWR(0x88, dk_cxlflash_resize) #define DK_CXLFLASH_VLUN_CLONE CXL_IOWR(0x89, dk_cxlflash_clone) /* * Structure and flag definitions CXL Flash host ioctls */ #define HT_CXLFLASH_VERSION_0 0 struct ht_cxlflash_hdr { __u16 version; /* Version data */ __u16 subcmd; /* Sub-command */ __u16 rsvd[2]; /* Reserved for future use */ __u64 flags; /* Input flags */ __u64 return_flags; /* Returned flags */ }; /* * Input flag definitions available to all host ioctls * * These are grown from the bottom-up with the intention that ioctl-specific * input flag definitions would grow from the top-down, allowing the two sets * to co-exist. While not required/enforced at this time, this provides future * flexibility. */ #define HT_CXLFLASH_HOST_READ 0x0000000000000000ULL #define HT_CXLFLASH_HOST_WRITE 0x0000000000000001ULL #define HT_CXLFLASH_LUN_PROVISION_SUBCMD_CREATE_LUN 0x0001 #define HT_CXLFLASH_LUN_PROVISION_SUBCMD_DELETE_LUN 0x0002 #define HT_CXLFLASH_LUN_PROVISION_SUBCMD_QUERY_PORT 0x0003 struct ht_cxlflash_lun_provision { struct ht_cxlflash_hdr hdr; /* Common fields */ __u16 port; /* Target port for provision request */ __u16 reserved16[3]; /* Reserved for future use */ __u64 size; /* Size of LUN (4K blocks) */ __u64 lun_id; /* SCSI LUN ID */ __u8 wwid[CXLFLASH_WWID_LEN];/* Page83 WWID, NAA-6 */ __u64 max_num_luns; /* Maximum number of LUNs provisioned */ __u64 cur_num_luns; /* Current number of LUNs provisioned */ __u64 max_cap_port; /* Total capacity for port (4K blocks) */ __u64 cur_cap_port; /* Current capacity for port (4K blocks) */ __u64 reserved[8]; /* Reserved for future use */ }; #define HT_CXLFLASH_AFU_DEBUG_MAX_DATA_LEN 262144 /* 256K */ #define HT_CXLFLASH_AFU_DEBUG_SUBCMD_LEN 12 struct ht_cxlflash_afu_debug { struct ht_cxlflash_hdr hdr; /* Common fields */ __u8 reserved8[4]; /* Reserved for future use */ __u8 afu_subcmd[HT_CXLFLASH_AFU_DEBUG_SUBCMD_LEN]; /* AFU subcommand, * (pass through) */ __u64 data_ea; /* Data buffer effective address */ __u32 data_len; /* Data buffer length */ __u32 reserved32; /* Reserved for future use */ __u64 reserved[8]; /* Reserved for future use */ }; union cxlflash_ht_ioctls { struct ht_cxlflash_lun_provision lun_provision; struct ht_cxlflash_afu_debug afu_debug; }; #define MAX_HT_CXLFLASH_IOCTL_SZ (sizeof(union cxlflash_ht_ioctls)) /* * CXL Flash host ioctls start at the top of the reserved CXL_MAGIC * region (0xBF) and grow downwards. */ #define HT_CXLFLASH_LUN_PROVISION CXL_IOWR(0xBF, ht_cxlflash_lun_provision) #define HT_CXLFLASH_AFU_DEBUG CXL_IOWR(0xBE, ht_cxlflash_afu_debug) #endif /* ifndef _CXLFLASH_IOCTL_H */ ������������������������������������������������������������������������scsi/scsi_bsg_fc.h����������������������������������������������������������������������������������0000644�����������������00000021161�14763166026�0010136 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * FC Transport BSG Interface * * Copyright (C) 2008 James Smart, Emulex Corporation * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef SCSI_BSG_FC_H #define SCSI_BSG_FC_H /* * This file intended to be included by both kernel and user space */ /* * FC Transport SGIO v4 BSG Message Support */ /* Default BSG request timeout (in seconds) */ #define FC_DEFAULT_BSG_TIMEOUT (10 * HZ) /* * Request Message Codes supported by the FC Transport */ /* define the class masks for the message codes */ #define FC_BSG_CLS_MASK 0xF0000000 /* find object class */ #define FC_BSG_HST_MASK 0x80000000 /* fc host class */ #define FC_BSG_RPT_MASK 0x40000000 /* fc rport class */ /* fc_host Message Codes */ #define FC_BSG_HST_ADD_RPORT (FC_BSG_HST_MASK | 0x00000001) #define FC_BSG_HST_DEL_RPORT (FC_BSG_HST_MASK | 0x00000002) #define FC_BSG_HST_ELS_NOLOGIN (FC_BSG_HST_MASK | 0x00000003) #define FC_BSG_HST_CT (FC_BSG_HST_MASK | 0x00000004) #define FC_BSG_HST_VENDOR (FC_BSG_HST_MASK | 0x000000FF) /* fc_rport Message Codes */ #define FC_BSG_RPT_ELS (FC_BSG_RPT_MASK | 0x00000001) #define FC_BSG_RPT_CT (FC_BSG_RPT_MASK | 0x00000002) /* * FC Address Identifiers in Message Structures : * * Whenever a command payload contains a FC Address Identifier * (aka port_id), the value is effectively in big-endian * order, thus the array elements are decoded as follows: * element [0] is bits 23:16 of the FC Address Identifier * element [1] is bits 15:8 of the FC Address Identifier * element [2] is bits 7:0 of the FC Address Identifier */ /* * FC Host Messages */ /* FC_BSG_HST_ADDR_PORT : */ /* Request: * This message requests the FC host to login to the remote port * at the specified N_Port_Id. The remote port is to be enumerated * with the transport upon completion of the login. */ struct fc_bsg_host_add_rport { uint8_t reserved; /* FC Address Identier of the remote port to login to */ uint8_t port_id[3]; }; /* Response: * There is no additional response data - fc_bsg_reply->result is sufficient */ /* FC_BSG_HST_DEL_RPORT : */ /* Request: * This message requests the FC host to remove an enumerated * remote port and to terminate the login to it. * * Note: The driver is free to reject this request if it desires to * remain logged in with the remote port. */ struct fc_bsg_host_del_rport { uint8_t reserved; /* FC Address Identier of the remote port to logout of */ uint8_t port_id[3]; }; /* Response: * There is no additional response data - fc_bsg_reply->result is sufficient */ /* FC_BSG_HST_ELS_NOLOGIN : */ /* Request: * This message requests the FC_Host to send an ELS to a specific * N_Port_ID. The host does not need to log into the remote port, * nor does it need to enumerate the rport for further traffic * (although, the FC host is free to do so if it desires). */ struct fc_bsg_host_els { /* * ELS Command Code being sent (must be the same as byte 0 * of the payload) */ uint8_t command_code; /* FC Address Identier of the remote port to send the ELS to */ uint8_t port_id[3]; }; /* Response: */ /* fc_bsg_ctels_reply->status values */ #define FC_CTELS_STATUS_OK 0x00000000 #define FC_CTELS_STATUS_REJECT 0x00000001 #define FC_CTELS_STATUS_P_RJT 0x00000002 #define FC_CTELS_STATUS_F_RJT 0x00000003 #define FC_CTELS_STATUS_P_BSY 0x00000004 #define FC_CTELS_STATUS_F_BSY 0x00000006 struct fc_bsg_ctels_reply { /* * Note: An ELS LS_RJT may be reported in 2 ways: * a) A status of FC_CTELS_STATUS_OK is returned. The caller * is to look into the ELS receive payload to determine * LS_ACC or LS_RJT (by contents of word 0). The reject * data will be in word 1. * b) A status of FC_CTELS_STATUS_REJECT is returned, The * rjt_data field will contain valid data. * * Note: ELS LS_ACC is determined by an FC_CTELS_STATUS_OK, and * the receive payload word 0 indicates LS_ACC * (e.g. value is 0x02xxxxxx). * * Note: Similarly, a CT Reject may be reported in 2 ways: * a) A status of FC_CTELS_STATUS_OK is returned. The caller * is to look into the CT receive payload to determine * Accept or Reject (by contents of word 2). The reject * data will be in word 3. * b) A status of FC_CTELS_STATUS_REJECT is returned, The * rjt_data field will contain valid data. * * Note: x_RJT/BSY status will indicae that the rjt_data field * is valid and contains the reason/explanation values. */ uint32_t status; /* See FC_CTELS_STATUS_xxx */ /* valid if status is not FC_CTELS_STATUS_OK */ struct { uint8_t action; /* fragment_id for CT REJECT */ uint8_t reason_code; uint8_t reason_explanation; uint8_t vendor_unique; } rjt_data; }; /* FC_BSG_HST_CT : */ /* Request: * This message requests that a CT Request be performed with the * indicated N_Port_ID. The driver is responsible for logging in with * the fabric and/or N_Port_ID, etc as per FC rules. This request does * not mandate that the driver must enumerate the destination in the * transport. The driver is allowed to decide whether to enumerate it, * and whether to tear it down after the request. */ struct fc_bsg_host_ct { uint8_t reserved; /* FC Address Identier of the remote port to send the ELS to */ uint8_t port_id[3]; /* * We need words 0-2 of the generic preamble for the LLD's */ uint32_t preamble_word0; /* revision & IN_ID */ uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */ uint32_t preamble_word2; /* Cmd Code, Max Size */ }; /* Response: * * The reply structure is an fc_bsg_ctels_reply structure */ /* FC_BSG_HST_VENDOR : */ /* Request: * Note: When specifying vendor_id, be sure to read the Vendor Type and ID * formatting requirements specified in scsi_netlink.h */ struct fc_bsg_host_vendor { /* * Identifies the vendor that the message is formatted for. This * should be the recipient of the message. */ uint64_t vendor_id; /* start of vendor command area */ uint32_t vendor_cmd[0]; }; /* Response: */ struct fc_bsg_host_vendor_reply { /* start of vendor response area */ uint32_t vendor_rsp[0]; }; /* * FC Remote Port Messages */ /* FC_BSG_RPT_ELS : */ /* Request: * This message requests that an ELS be performed with the rport. */ struct fc_bsg_rport_els { /* * ELS Command Code being sent (must be the same as * byte 0 of the payload) */ uint8_t els_code; }; /* Response: * * The reply structure is an fc_bsg_ctels_reply structure */ /* FC_BSG_RPT_CT : */ /* Request: * This message requests that a CT Request be performed with the rport. */ struct fc_bsg_rport_ct { /* * We need words 0-2 of the generic preamble for the LLD's */ uint32_t preamble_word0; /* revision & IN_ID */ uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */ uint32_t preamble_word2; /* Cmd Code, Max Size */ }; /* Response: * * The reply structure is an fc_bsg_ctels_reply structure */ /* request (CDB) structure of the sg_io_v4 */ struct fc_bsg_request { uint32_t msgcode; union { struct fc_bsg_host_add_rport h_addrport; struct fc_bsg_host_del_rport h_delrport; struct fc_bsg_host_els h_els; struct fc_bsg_host_ct h_ct; struct fc_bsg_host_vendor h_vendor; struct fc_bsg_rport_els r_els; struct fc_bsg_rport_ct r_ct; } rqst_data; } __attribute__((packed)); /* response (request sense data) structure of the sg_io_v4 */ struct fc_bsg_reply { /* * The completion result. Result exists in two forms: * if negative, it is an -Exxx system errno value. There will * be no further reply information supplied. * else, it's the 4-byte scsi error result, with driver, host, * msg and status fields. The per-msgcode reply structure * will contain valid data. */ uint32_t result; /* If there was reply_payload, how much was recevied ? */ uint32_t reply_payload_rcv_len; union { struct fc_bsg_host_vendor_reply vendor_reply; struct fc_bsg_ctels_reply ctels_reply; } reply_data; }; #endif /* SCSI_BSG_FC_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������scsi/scsi_netlink_fc.h������������������������������������������������������������������������������0000644�����������������00000003711�14763166026�0011030 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * FC Transport Netlink Interface * * Copyright (C) 2006 James Smart, Emulex Corporation * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef SCSI_NETLINK_FC_H #define SCSI_NETLINK_FC_H #include <scsi/scsi_netlink.h> /* * This file intended to be included by both kernel and user space */ /* * FC Transport Message Types */ /* kernel -> user */ #define FC_NL_ASYNC_EVENT 0x0100 /* user -> kernel */ /* none */ /* * Message Structures : */ /* macro to round up message lengths to 8byte boundary */ #define FC_NL_MSGALIGN(len) (((len) + 7) & ~7) /* * FC Transport Broadcast Event Message : * FC_NL_ASYNC_EVENT * * Note: if Vendor Unique message, &event_data will be start of * vendor unique payload, and the length of the payload is * per event_datalen * * Note: When specifying vendor_id, be sure to read the Vendor Type and ID * formatting requirements specified in scsi_netlink.h */ struct fc_nl_event { struct scsi_nl_hdr snlh; /* must be 1st element ! */ uint64_t seconds; uint64_t vendor_id; uint16_t host_no; uint16_t event_datalen; uint32_t event_num; uint32_t event_code; uint32_t event_data; } __attribute__((aligned(sizeof(uint64_t)))); #endif /* SCSI_NETLINK_FC_H */ �������������������������������������������������������pcre_stringpiece.h����������������������������������������������������������������������������������0000644�����������������00000014155�14763166026�0010263 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Copyright (c) 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Author: Sanjay Ghemawat // // A string like object that points into another piece of memory. // Useful for providing an interface that allows clients to easily // pass in either a "const char*" or a "string". // // Arghh! I wish C++ literals were automatically of type "string". #ifndef _PCRE_STRINGPIECE_H #define _PCRE_STRINGPIECE_H #include <cstring> #include <string> #include <iosfwd> // for ostream forward-declaration #if 0 #define HAVE_TYPE_TRAITS #include <type_traits.h> #elif 0 #define HAVE_TYPE_TRAITS #include <bits/type_traits.h> #endif #include <pcre.h> using std::memcmp; using std::strlen; using std::string; namespace pcrecpp { class PCRECPP_EXP_DEFN StringPiece { private: const char* ptr_; int length_; public: // We provide non-explicit singleton constructors so users can pass // in a "const char*" or a "string" wherever a "StringPiece" is // expected. StringPiece() : ptr_(NULL), length_(0) { } StringPiece(const char* str) : ptr_(str), length_(static_cast<int>(strlen(ptr_))) { } StringPiece(const unsigned char* str) : ptr_(reinterpret_cast<const char*>(str)), length_(static_cast<int>(strlen(ptr_))) { } StringPiece(const string& str) : ptr_(str.data()), length_(static_cast<int>(str.size())) { } StringPiece(const char* offset, int len) : ptr_(offset), length_(len) { } // data() may return a pointer to a buffer with embedded NULs, and the // returned buffer may or may not be null terminated. Therefore it is // typically a mistake to pass data() to a routine that expects a NUL // terminated string. Use "as_string().c_str()" if you really need to do // this. Or better yet, change your routine so it does not rely on NUL // termination. const char* data() const { return ptr_; } int size() const { return length_; } bool empty() const { return length_ == 0; } void clear() { ptr_ = NULL; length_ = 0; } void set(const char* buffer, int len) { ptr_ = buffer; length_ = len; } void set(const char* str) { ptr_ = str; length_ = static_cast<int>(strlen(str)); } void set(const void* buffer, int len) { ptr_ = reinterpret_cast<const char*>(buffer); length_ = len; } char operator[](int i) const { return ptr_[i]; } void remove_prefix(int n) { ptr_ += n; length_ -= n; } void remove_suffix(int n) { length_ -= n; } bool operator==(const StringPiece& x) const { return ((length_ == x.length_) && (memcmp(ptr_, x.ptr_, length_) == 0)); } bool operator!=(const StringPiece& x) const { return !(*this == x); } #define STRINGPIECE_BINARY_PREDICATE(cmp,auxcmp) \ bool operator cmp (const StringPiece& x) const { \ int r = memcmp(ptr_, x.ptr_, length_ < x.length_ ? length_ : x.length_); \ return ((r auxcmp 0) || ((r == 0) && (length_ cmp x.length_))); \ } STRINGPIECE_BINARY_PREDICATE(<, <); STRINGPIECE_BINARY_PREDICATE(<=, <); STRINGPIECE_BINARY_PREDICATE(>=, >); STRINGPIECE_BINARY_PREDICATE(>, >); #undef STRINGPIECE_BINARY_PREDICATE int compare(const StringPiece& x) const { int r = memcmp(ptr_, x.ptr_, length_ < x.length_ ? length_ : x.length_); if (r == 0) { if (length_ < x.length_) r = -1; else if (length_ > x.length_) r = +1; } return r; } string as_string() const { return string(data(), size()); } void CopyToString(string* target) const { target->assign(ptr_, length_); } // Does "this" start with "x" bool starts_with(const StringPiece& x) const { return ((length_ >= x.length_) && (memcmp(ptr_, x.ptr_, x.length_) == 0)); } }; } // namespace pcrecpp // ------------------------------------------------------------------ // Functions used to create STL containers that use StringPiece // Remember that a StringPiece's lifetime had better be less than // that of the underlying string or char*. If it is not, then you // cannot safely store a StringPiece into an STL container // ------------------------------------------------------------------ #ifdef HAVE_TYPE_TRAITS // This makes vector<StringPiece> really fast for some STL implementations template<> struct __type_traits<pcrecpp::StringPiece> { typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_destructor; typedef __true_type is_POD_type; }; #endif // allow StringPiece to be logged std::ostream& operator<<(std::ostream& o, const pcrecpp::StringPiece& piece); #endif /* _PCRE_STRINGPIECE_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������profile.h�������������������������������������������������������������������������������������������0000644�����������������00000027572�14763166026�0006405 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * profile.h */ #ifndef _KRB5_PROFILE_H #define _KRB5_PROFILE_H #if defined(_WIN32) #include <win-mac.h> #endif #if defined(__MACH__) && defined(__APPLE__) # include <TargetConditionals.h> # if TARGET_RT_MAC_CFM # error "Use KfM 4.0 SDK headers for CFM compilation." # endif #endif #ifndef KRB5_CALLCONV #define KRB5_CALLCONV #define KRB5_CALLCONV_C #endif typedef struct _profile_t *profile_t; /* Used by profile_init_flags(). */ #define PROFILE_INIT_ALLOW_MODULE 0x0001 /* Allow module declaration */ /* * Used by the profile iterator in prof_get.c */ #define PROFILE_ITER_LIST_SECTION 0x0001 #define PROFILE_ITER_SECTIONS_ONLY 0x0002 #define PROFILE_ITER_RELATIONS_ONLY 0x0004 #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ typedef char* profile_filespec_t; /* path as C string */ typedef char* profile_filespec_list_t; /* list of : separated paths, C string */ typedef const char * const_profile_filespec_t; /* path as C string */ typedef const char * const_profile_filespec_list_t; /* list of : separated paths, C string */ long KRB5_CALLCONV profile_init (const_profile_filespec_t *files, profile_t *ret_profile); long KRB5_CALLCONV profile_init_flags (const_profile_filespec_t *files, int flags, profile_t *ret_profile); long KRB5_CALLCONV profile_init_path (const_profile_filespec_list_t filelist, profile_t *ret_profile); long KRB5_CALLCONV profile_flush (profile_t profile); long KRB5_CALLCONV profile_flush_to_file (profile_t profile, const_profile_filespec_t outfile); long KRB5_CALLCONV profile_flush_to_buffer (profile_t profile, char **bufp); void KRB5_CALLCONV profile_free_buffer (profile_t profile, char *buf); long KRB5_CALLCONV profile_is_writable (profile_t profile, int *writable); long KRB5_CALLCONV profile_is_modified (profile_t profile, int *modified); void KRB5_CALLCONV profile_abandon (profile_t profile); void KRB5_CALLCONV profile_release (profile_t profile); long KRB5_CALLCONV profile_get_values (profile_t profile, const char *const *names, char ***ret_values); void KRB5_CALLCONV profile_free_list (char **list); long KRB5_CALLCONV profile_get_string (profile_t profile, const char *name, const char *subname, const char *subsubname, const char *def_val, char **ret_string); long KRB5_CALLCONV profile_get_integer (profile_t profile, const char *name, const char *subname, const char *subsubname, int def_val, int *ret_default); long KRB5_CALLCONV profile_get_boolean (profile_t profile, const char *name, const char *subname, const char *subsubname, int def_val, int *ret_default); long KRB5_CALLCONV profile_get_relation_names (profile_t profile, const char **names, char ***ret_names); long KRB5_CALLCONV profile_get_subsection_names (profile_t profile, const char **names, char ***ret_names); long KRB5_CALLCONV profile_iterator_create (profile_t profile, const char *const *names, int flags, void **ret_iter); void KRB5_CALLCONV profile_iterator_free (void **iter_p); long KRB5_CALLCONV profile_iterator (void **iter_p, char **ret_name, char **ret_value); void KRB5_CALLCONV profile_release_string (char *str); long KRB5_CALLCONV profile_update_relation (profile_t profile, const char **names, const char *old_value, const char *new_value); long KRB5_CALLCONV profile_clear_relation (profile_t profile, const char **names); long KRB5_CALLCONV profile_rename_section (profile_t profile, const char **names, const char *new_name); long KRB5_CALLCONV profile_add_relation (profile_t profile, const char **names, const char *new_value); /* * profile_init_vtable allows a caller to create a profile-compatible object * with a different back end. */ /* * Mandatory: Look up all of the relations for names, placing the resulting * values in *ret_values. If no relations exist, return PROF_NO_RELATION, or * PROF_NO_SECTION to indicate that one of the intermediate names does not * exist as a section. The list will be freed with free_values. */ typedef long (*profile_get_values_fn)(void *cbdata, const char *const *names, char ***ret_values); /* Mandatory: Free a list of strings returned by get_values. */ typedef void (*profile_free_values_fn)(void *cbdata, char **values); /* Optional: Release any data associated with the profile. */ typedef void (*profile_cleanup_fn)(void *cbdata); /* * Optional (mandatory if cleanup is defined): Generate a new cbdata pointer * for a copy of the profile. If not implemented, the new profile will receive * the same cbdata pointer as the old one. */ typedef long (*profile_copy_fn)(void *cbdata, void **ret_cbdata); /* * Optional: Create an iterator handle. * * If flags contains PROFILE_ITER_LIST_SECTION, iterate over all of the * relations and sections within names. Otherwise, iterate over the relation * values for names, or produce a single section result if names is a section. * * If flags contains PROFILE_ITER_SECTIONS_ONLY, produce only sections. * * If flags contains PROFILE_ITER_RELATIONS_ONLY, produce only relations. */ typedef long (*profile_iterator_create_fn)(void *cbdata, const char *const *names, int flags, void **ret_iter); /* * Optional (mandatory if iterator_create is defined): Produce the next * relation or section in an iteration. If producing a section result, set * *ret_value to NULL. The returned strings will be freed with free_string. */ typedef long (*profile_iterator_fn)(void *cbdata, void *iter, char **ret_name, char **ret_value); /* * Optional (mandatory if iterator_create is defined): Free the memory for an * iterator. */ typedef void (*profile_iterator_free_fn)(void *cbdata, void *iter); /* Optional (mandatory if iterator is defined): Free a string value. */ typedef void (*profile_free_string_fn)(void *cbdata, char *string); /* * Optional: Determine if a profile is writable. If not implemented, the * profile is never writable. */ typedef long (*profile_writable_fn)(void *cbdata, int *writable); /* * Optional: Determine if a profile is modified in memory relative to the * persistent store. If not implemented, the profile is assumed to never be * modified. */ typedef long (*profile_modified_fn)(void *cbdata, int *modified); /* * Optional: Change the value of a relation, or remove it if new_value is NULL. * If old_value is set and the relation does not have that value, return * PROF_NO_RELATION. */ typedef long (*profile_update_relation_fn)(void *cbdata, const char **names, const char *old_value, const char *new_value); /* * Optional: Rename a section to new_name, or remove the section if new_name is * NULL. */ typedef long (*profile_rename_section_fn)(void *cbdata, const char **names, const char *new_name); /* * Optional: Add a new relation, or a new section if new_value is NULL. Add * any intermediate sections as necessary. */ typedef long (*profile_add_relation_fn)(void *cbdata, const char **names, const char *new_value); /* * Optional: Flush any pending memory updates to the persistent store. If * implemented, this function will be called by profile_release as well as * profile_flush, so make sure it's not inefficient to flush an unmodified * profile. */ typedef long (*profile_flush_fn)(void *cbdata); struct profile_vtable { int minor_ver; /* Set to structure minor version (currently 1) * if calling profile_init_vtable. */ /* Methods needed for a basic read-only non-iterable profile (cleanup is * optional). */ profile_get_values_fn get_values; profile_free_values_fn free_values; profile_cleanup_fn cleanup; profile_copy_fn copy; /* Methods for iterable profiles. */ profile_iterator_create_fn iterator_create; profile_iterator_fn iterator; profile_iterator_free_fn iterator_free; profile_free_string_fn free_string; /* Methods for writable profiles. */ profile_writable_fn writable; profile_modified_fn modified; profile_update_relation_fn update_relation; profile_rename_section_fn rename_section; profile_add_relation_fn add_relation; profile_flush_fn flush; /* End of minor version 1. */ }; /* * Create a profile object whose operations will be performed using the * function pointers in vtable. cbdata will be supplied to each vtable * function as the first argument. */ long KRB5_CALLCONV profile_init_vtable (struct profile_vtable *vtable, void *cbdata, profile_t *ret_profile); /* * Dynamically loadable profile modules should define a function named * "profile_module_init" matching the following signature. The function should * initialize the methods of the provided vtable structure, stopping at the * field corresponding to vtable->minor_ver. Do not change the value of * vtable->minor_ver. Unimplemented methods can be left uninitialized. The * function should supply a callback data pointer in *cb_ret; this pointer can * be cleaned up via the vtable cleanup method. */ typedef long (*profile_module_init_fn)(const char *residual, struct profile_vtable *vtable, void **cb_ret); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _KRB5_PROFILE_H */ /* * et-h-prof_err.h: * This file is automatically generated; please do not edit it. */ #include <et/com_err.h> #define PROF_VERSION (-1429577728L) #define PROF_MAGIC_NODE (-1429577727L) #define PROF_NO_SECTION (-1429577726L) #define PROF_NO_RELATION (-1429577725L) #define PROF_ADD_NOT_SECTION (-1429577724L) #define PROF_SECTION_WITH_VALUE (-1429577723L) #define PROF_BAD_LINK_LIST (-1429577722L) #define PROF_BAD_GROUP_LVL (-1429577721L) #define PROF_BAD_PARENT_PTR (-1429577720L) #define PROF_MAGIC_ITERATOR (-1429577719L) #define PROF_SET_SECTION_VALUE (-1429577718L) #define PROF_EINVAL (-1429577717L) #define PROF_READ_ONLY (-1429577716L) #define PROF_SECTION_NOTOP (-1429577715L) #define PROF_SECTION_SYNTAX (-1429577714L) #define PROF_RELATION_SYNTAX (-1429577713L) #define PROF_EXTRA_CBRACE (-1429577712L) #define PROF_MISSING_OBRACE (-1429577711L) #define PROF_MAGIC_PROFILE (-1429577710L) #define PROF_MAGIC_SECTION (-1429577709L) #define PROF_TOPSECTION_ITER_NOSUPP (-1429577708L) #define PROF_INVALID_SECTION (-1429577707L) #define PROF_END_OF_SECTIONS (-1429577706L) #define PROF_BAD_NAMESET (-1429577705L) #define PROF_NO_PROFILE (-1429577704L) #define PROF_MAGIC_FILE (-1429577703L) #define PROF_FAIL_OPEN (-1429577702L) #define PROF_EXISTS (-1429577701L) #define PROF_BAD_BOOLEAN (-1429577700L) #define PROF_BAD_INTEGER (-1429577699L) #define PROF_MAGIC_FILE_DATA (-1429577698L) #define PROF_FAIL_INCLUDE_FILE (-1429577697L) #define PROF_FAIL_INCLUDE_DIR (-1429577696L) #define PROF_UNSUPPORTED (-1429577695L) #define PROF_MAGIC_NODE_ITERATOR (-1429577694L) #define PROF_MODULE (-1429577693L) #define PROF_MODULE_SYNTAX (-1429577692L) #define PROF_MODULE_INVALID (-1429577691L) extern const struct error_table et_prof_error_table; extern void initialize_prof_error_table(void); /* For compatibility with Heimdal */ extern void initialize_prof_error_table_r(struct et_list **list); #define ERROR_TABLE_BASE_prof (-1429577728L) /* for compatibility with older versions... */ #define init_prof_err_tbl initialize_prof_error_table #define prof_err_base ERROR_TABLE_BASE_prof ��������������������������������������������������������������������������������������������������������������������������������������dbm.h�����������������������������������������������������������������������������������������������0000644�����������������00000002574�14763166026�0005502 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* dbm.h - The include file for dbm users. */ /* This file is part of GDBM, the GNU data base manager, by Philip A. Nelson. Copyright (C) 1990-2011 Free Software Foundation, Inc. GDBM 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, or (at your option) any later version. GDBM 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 GDBM. If not, see <http://www.gnu.org/licenses/>. You may contact the author by: e-mail: phil@cs.wwu.edu us-mail: Philip A. Nelson Computer Science Department Western Washington University Bellingham, WA 98226 *************************************************************************/ #include <gdbm.h> /* These are the routines in dbm. */ extern int dbminit (char *file); extern datum fetch (datum key); extern int store (datum key, datum content); extern int delete (datum key); extern datum firstkey (void); extern datum nextkey (datum key); extern int dbmclose (void); ������������������������������������������������������������������������������������������������������������������������������������pg_config.h�����������������������������������������������������������������������������������������0000644�����������������00000002006�14763166026�0006661 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Kluge to support multilib installation of both 32- and 64-bit RPMS: * we need to arrange that header files that appear in both RPMs are * identical. Hence, this file is architecture-independent and calls * in an arch-dependent file that will appear in just one RPM. * * To avoid breaking arches not explicitly supported by Red Hat, we * use this indirection file *only* on known multilib arches. * * Note: this may well fail if user tries to use gcc's -I- option. * But that option is deprecated anyway. */ #if defined(__x86_64__) #include "pg_config_x86_64.h" #elif defined(__i386__) #include "pg_config_i386.h" #elif defined(__ppc64__) || defined(__powerpc64__) #include "pg_config_ppc64.h" #elif defined(__ppc__) || defined(__powerpc__) #include "pg_config_ppc.h" #elif defined(__s390x__) #include "pg_config_s390x.h" #elif defined(__s390__) #include "pg_config_s390.h" #elif defined(__sparc__) && defined(__arch64__) #include "pg_config_sparc64.h" #elif defined(__sparc__) #include "pg_config_sparc.h" #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������printf.h��������������������������������������������������������������������������������������������0000644�����������������00000015101�14763166026�0006230 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-1993,1995-2001,2006,2009,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _PRINTF_H #define _PRINTF_H 1 #include <features.h> __BEGIN_DECLS #define __need_FILE #include <stdio.h> #define __need_size_t #define __need_wchar_t #include <stddef.h> #include <stdarg.h> struct printf_info { int prec; /* Precision. */ int width; /* Width. */ wchar_t spec; /* Format letter. */ unsigned int is_long_double:1;/* L flag. */ unsigned int is_short:1; /* h flag. */ unsigned int is_long:1; /* l flag. */ unsigned int alt:1; /* # flag. */ unsigned int space:1; /* Space flag. */ unsigned int left:1; /* - flag. */ unsigned int showsign:1; /* + flag. */ unsigned int group:1; /* ' flag. */ unsigned int extra:1; /* For special use. */ unsigned int is_char:1; /* hh flag. */ unsigned int wide:1; /* Nonzero for wide character streams. */ unsigned int i18n:1; /* I flag. */ unsigned int __pad:4; /* Unused so far. */ unsigned short int user; /* Bits for user-installed modifiers. */ wchar_t pad; /* Padding character. */ }; /* Type of a printf specifier-handler function. STREAM is the FILE on which to write output. INFO gives information about the format specification. ARGS is a vector of pointers to the argument data; the number of pointers will be the number returned by the associated arginfo function for the same INFO. The function should return the number of characters written, or -1 for errors. */ typedef int printf_function (FILE *__stream, const struct printf_info *__info, const void *const *__args); /* Type of a printf specifier-arginfo function. INFO gives information about the format specification. N, ARGTYPES, *SIZE has to contain the size of the parameter for user-defined types, and return value are as for parse_printf_format except that -1 should be returned if the handler cannot handle this case. This allows to partially overwrite the functionality of existing format specifiers. */ typedef int printf_arginfo_size_function (const struct printf_info *__info, size_t __n, int *__argtypes, int *__size); /* Old version of 'printf_arginfo_function' without a SIZE parameter. */ typedef int printf_arginfo_function (const struct printf_info *__info, size_t __n, int *__argtypes); /* Type of a function to get a value of a user-defined from the variable argument list. */ typedef void printf_va_arg_function (void *__mem, va_list *__ap); /* Register FUNC to be called to format SPEC specifiers; ARGINFO must be specified to determine how many arguments a SPEC conversion requires and what their types are. */ extern int register_printf_specifier (int __spec, printf_function __func, printf_arginfo_size_function __arginfo) __THROW; /* Obsolete interface similar to register_printf_specifier. It can only handle basic data types because the ARGINFO callback does not return information on the size of the user-defined type. */ extern int register_printf_function (int __spec, printf_function __func, printf_arginfo_function __arginfo) __THROW __attribute_deprecated__; /* Register a new modifier character sequence. If the call succeeds it returns a positive value representing the bit set in the USER field in 'struct printf_info'. */ extern int register_printf_modifier (const wchar_t *__str) __wur __THROW; /* Register variable argument handler for user type. The return value is to be used in ARGINFO functions to signal the use of the type. */ extern int register_printf_type (printf_va_arg_function __fct) __wur __THROW; /* Parse FMT, and fill in N elements of ARGTYPES with the types needed for the conversions FMT specifies. Returns the number of arguments required by FMT. The ARGINFO function registered with a user-defined format is passed a `struct printf_info' describing the format spec being parsed. A width or precision of INT_MIN means a `*' was used to indicate that the width/precision will come from an arg. The function should fill in the array it is passed with the types of the arguments it wants, and return the number of arguments it wants. */ extern size_t parse_printf_format (const char *__restrict __fmt, size_t __n, int *__restrict __argtypes) __THROW; /* Codes returned by `parse_printf_format' for basic types. These values cover all the standard format specifications. Users can reserve new values after PA_LAST for their own types using 'register_printf_type'. */ enum { /* C type: */ PA_INT, /* int */ PA_CHAR, /* int, cast to char */ PA_WCHAR, /* wide char */ PA_STRING, /* const char *, a '\0'-terminated string */ PA_WSTRING, /* const wchar_t *, wide character string */ PA_POINTER, /* void * */ PA_FLOAT, /* float */ PA_DOUBLE, /* double */ PA_LAST }; /* Flag bits that can be set in a type returned by `parse_printf_format'. */ #define PA_FLAG_MASK 0xff00 #define PA_FLAG_LONG_LONG (1 << 8) #define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG #define PA_FLAG_LONG (1 << 9) #define PA_FLAG_SHORT (1 << 10) #define PA_FLAG_PTR (1 << 11) /* Function which can be registered as `printf'-handlers. */ /* Print floating point value using using abbreviations for the orders of magnitude used for numbers ('k' for kilo, 'm' for mega etc). If the format specifier is a uppercase character powers of 1000 are used. Otherwise powers of 1024. */ extern int printf_size (FILE *__restrict __fp, const struct printf_info *__info, const void *const *__restrict __args) __THROW; /* This is the appropriate argument information function for `printf_size'. */ extern int printf_size_info (const struct printf_info *__restrict __info, size_t __n, int *__restrict __argtypes) __THROW; #ifdef __LDBL_COMPAT # include <bits/printf-ldbl.h> #endif __END_DECLS #endif /* printf.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������grp.h�����������������������������������������������������������������������������������������������0000644�����������������00000015405�14763166026�0005525 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991,1992,1995-2001,2003,2004,2010,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 9.2.1 Group Database Access <grp.h> */ #ifndef _GRP_H #define _GRP_H 1 #include <features.h> __BEGIN_DECLS #include <bits/types.h> #define __need_size_t #include <stddef.h> /* For the Single Unix specification we must define this type here. */ #if (defined __USE_XOPEN || defined __USE_XOPEN2K) && !defined __gid_t_defined typedef __gid_t gid_t; # define __gid_t_defined #endif /* The group structure. */ struct group { char *gr_name; /* Group name. */ char *gr_passwd; /* Password. */ __gid_t gr_gid; /* Group ID. */ char **gr_mem; /* Member list. */ }; #if defined __USE_SVID || defined __USE_GNU # define __need_FILE # include <stdio.h> #endif #if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Rewind the group-file stream. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void setgrent (void); #endif #if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED \ || defined __USE_XOPEN2K8 /* Close the group-file stream. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void endgrent (void); /* Read an entry from the group-file stream, opening it if necessary. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct group *getgrent (void); #endif #ifdef __USE_SVID /* Read a group entry from STREAM. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern struct group *fgetgrent (FILE *__stream); #endif #ifdef __USE_GNU /* Write the given entry onto the given stream. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int putgrent (const struct group *__restrict __p, FILE *__restrict __f); #endif /* Search for an entry with a matching group ID. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct group *getgrgid (__gid_t __gid); /* Search for an entry with a matching group name. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct group *getgrnam (const char *__name); #if defined __USE_POSIX || defined __USE_MISC # ifdef __USE_MISC /* Reasonable value for the buffer sized used in the reentrant functions below. But better use `sysconf'. */ # define NSS_BUFLEN_GROUP 1024 # endif /* Reentrant versions of some of the functions above. PLEASE NOTE: the `getgrent_r' function is not (yet) standardized. The interface may change in later versions of this library. But the interface is designed following the principals used for the other reentrant functions so the chances are good this is what the POSIX people would choose. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ # ifdef __USE_GNU extern int getgrent_r (struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result); # endif /* Search for an entry with a matching group ID. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int getgrgid_r (__gid_t __gid, struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result); /* Search for an entry with a matching group name. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int getgrnam_r (const char *__restrict __name, struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result); # ifdef __USE_SVID /* Read a group entry from STREAM. This function is not standardized an probably never will. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int fgetgrent_r (FILE *__restrict __stream, struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result); # endif #endif /* POSIX or reentrant */ #ifdef __USE_BSD # define __need_size_t # include <stddef.h> /* Set the group set for the current user to GROUPS (N of them). */ extern int setgroups (size_t __n, const __gid_t *__groups) __THROW; /* Store at most *NGROUPS members of the group set for USER into *GROUPS. Also include GROUP. The actual number of groups found is returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int getgrouplist (const char *__user, __gid_t __group, __gid_t *__groups, int *__ngroups); /* Initialize the group set for the current user by reading the group database and using all groups of which USER is a member. Also include GROUP. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int initgroups (const char *__user, __gid_t __group); #endif /* Use BSD. */ __END_DECLS #endif /* grp.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netax25/ax25.h��������������������������������������������������������������������������������������0000644�����������������00000011312�14763166026�0006773 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _NETAX25_AX25_H #define _NETAX25_AX25_H 1 #include <features.h> #include <bits/sockaddr.h> /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx. */ #define SOL_AX25 257 /* AX.25 flags: */ #define AX25_WINDOW 1 #define AX25_T1 2 #define AX25_T2 5 #define AX25_T3 4 #define AX25_N2 3 #define AX25_BACKOFF 6 #define AX25_EXTSEQ 7 #define AX25_PIDINCL 8 #define AX25_IDLE 9 #define AX25_PACLEN 10 #define AX25_IPMAXQUEUE 11 #define AX25_IAMDIGI 12 #define AX25_KILL 99 /* AX.25 socket ioctls: */ #define SIOCAX25GETUID (SIOCPROTOPRIVATE) #define SIOCAX25ADDUID (SIOCPROTOPRIVATE+1) #define SIOCAX25DELUID (SIOCPROTOPRIVATE+2) #define SIOCAX25NOUID (SIOCPROTOPRIVATE+3) #define SIOCAX25BPQADDR (SIOCPROTOPRIVATE+4) #define SIOCAX25GETPARMS (SIOCPROTOPRIVATE+5) #define SIOCAX25SETPARMS (SIOCPROTOPRIVATE+6) #define SIOCAX25OPTRT (SIOCPROTOPRIVATE+7) #define SIOCAX25CTLCON (SIOCPROTOPRIVATE+8) #define SIOCAX25GETINFO (SIOCPROTOPRIVATE+9) #define SIOCAX25ADDFWD (SIOCPROTOPRIVATE+10) #define SIOCAX25DELFWD (SIOCPROTOPRIVATE+11) /* unknown: */ #define AX25_NOUID_DEFAULT 0 #define AX25_NOUID_BLOCK 1 #define AX25_SET_RT_IPMODE 2 /* Digipeating flags: */ #define AX25_DIGI_INBAND 0x01 /* Allow digipeating within port */ #define AX25_DIGI_XBAND 0x02 /* Allow digipeating across ports */ /* Maximim number of digipeaters: */ #define AX25_MAX_DIGIS 8 typedef struct { char ax25_call[7]; /* 6 call + SSID (shifted ascii) */ } ax25_address; struct sockaddr_ax25 { sa_family_t sax25_family; ax25_address sax25_call; int sax25_ndigis; }; /* * The sockaddr struct with the digipeater adresses: */ struct full_sockaddr_ax25 { struct sockaddr_ax25 fsa_ax25; ax25_address fsa_digipeater[AX25_MAX_DIGIS]; }; #define sax25_uid sax25_ndigis struct ax25_routes_struct { ax25_address port_addr; ax25_address dest_addr; unsigned char digi_count; ax25_address digi_addr[AX25_MAX_DIGIS]; }; /* The AX.25 ioctl structure: */ struct ax25_ctl_struct { ax25_address port_addr; ax25_address source_addr; ax25_address dest_addr; unsigned int cmd; unsigned long arg; unsigned char digi_count; ax25_address digi_addr[AX25_MAX_DIGIS]; }; struct ax25_info_struct { unsigned int n2, n2count; unsigned int t1, t1timer; unsigned int t2, t2timer; unsigned int t3, t3timer; unsigned int idle, idletimer; unsigned int state; unsigned int rcv_q, snd_q; }; struct ax25_fwd_struct { ax25_address port_from; ax25_address port_to; }; /* AX.25 route structure: */ struct ax25_route_opt_struct { ax25_address port_addr; ax25_address dest_addr; int cmd; int arg; }; /* AX.25 BPQ stuff: */ struct ax25_bpqaddr_struct { char dev[16]; ax25_address addr; }; /* Definitions for the AX.25 `values' fields: */ #define AX25_VALUES_IPDEFMODE 0 /* 'D'=DG 'V'=VC */ #define AX25_VALUES_AXDEFMODE 1 /* 8=Normal 128=Extended Seq Nos */ #define AX25_VALUES_NETROM 2 /* Allow NET/ROM - 0=No 1=Yes */ #define AX25_VALUES_TEXT 3 /* Allow PID=Text - 0=No 1=Yes */ #define AX25_VALUES_BACKOFF 4 /* 'E'=Exponential 'L'=Linear */ #define AX25_VALUES_CONMODE 5 /* Allow connected modes - 0=No 1=Yes */ #define AX25_VALUES_WINDOW 6 /* Default window size for standard AX.25 */ #define AX25_VALUES_EWINDOW 7 /* Default window size for extended AX.25 */ #define AX25_VALUES_T1 8 /* Default T1 timeout value */ #define AX25_VALUES_T2 9 /* Default T2 timeout value */ #define AX25_VALUES_T3 10 /* Default T3 timeout value */ #define AX25_VALUES_N2 11 /* Default N2 value */ #define AX25_VALUES_DIGI 12 /* Digipeat mode */ #define AX25_VALUES_IDLE 13 /* mode vc idle timer */ #define AX25_VALUES_PACLEN 14 /* AX.25 MTU */ #define AX25_VALUES_IPMAXQUEUE 15 /* Maximum number of buffers enqueued */ #define AX25_MAX_VALUES 20 struct ax25_parms_struct { ax25_address port_addr; unsigned short values[AX25_MAX_VALUES]; }; #endif /* netax25/ax25.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tcpd.h����������������������������������������������������������������������������������������������0000644�����������������00000026760�14763166026�0005675 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* * @(#) tcpd.h 1.5 96/03/19 16:22:24 * * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands. */ #ifndef _TCPWRAPPERS_TCPD_H #define _TCPWRAPPERS_TCPD_H /* someone else may have defined this */ #undef __P /* use prototypes if we have an ANSI C compiler or are using C++ */ #if defined(__STDC__) || defined(__cplusplus) #define __P(args) args #else #define __P(args) () #endif /* Need definitions of struct sockaddr_in and FILE. */ #include <netinet/in.h> #include <stdio.h> __BEGIN_DECLS /* Structure to describe one communications endpoint. */ #define STRING_LENGTH 128 /* hosts, users, processes */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> typedef struct sockaddr_gen { union { struct sockaddr _sg_sa; struct sockaddr_in _sg_sin; #ifdef HAVE_IPV6 struct sockaddr_in6 _sg_sin6; #endif } sg_addr; } sockaddr_gen; typedef union gen_addr { struct in_addr ga_in; #ifdef HAVE_IPV6 struct in6_addr ga_in6; #endif } gen_addr; extern void sockgen_simplify(); #define sg_sa sg_addr._sg_sa #define sg_sin sg_addr._sg_sin #define sg_sin6 sg_addr._sg_sin6 #define sg_family sg_sa.sa_family #ifdef HAVE_IPV6 #define SGADDRSZ(sag) ((sag)->sg_family == AF_INET6 ? \ sizeof (struct in6_addr) : \ sizeof (struct in_addr)) #define SGSOCKADDRSZ(sag) ((sag)->sg_family == AF_INET6 ? \ sizeof (struct sockaddr_in6) : \ sizeof (struct sockaddr_in)) #define SGPORT(sag) (*((sag)->sg_family == AF_INET6 ? \ &(sag)->sg_sin6.sin6_port : \ &(sag)->sg_sin.sin_port)) #define SGADDRP(sag) (((sag)->sg_family == AF_INET6 ? \ (char *) &(sag)->sg_sin6.sin6_addr : \ (char *) &(sag)->sg_sin.sin_addr)) #define SGFAM(sag) ((sag)->sg_family == AF_INET6 ? \ AF_INET6 : AF_INET) #define SG_IS_UNSPECIFIED(sag) \ ((sag)->sg_family == AF_INET6 ? \ IN6_IS_ADDR_UNSPECIFIED(&(sag)->sg_sin6.sin6_addr) : \ (sag)->sg_sin.sin_addr.s_addr == 0) #define VALID_ADDRTYPE(t) ((t) == AF_INET || (t) == AF_INET6) #ifndef IPV6_ABITS #define IPV6_ABITS 128 /* Size of IPV6 address in bits */ #endif #else /* HAVE_IPV6 */ #define SGADDRSZ(sag) sizeof(struct in_addr) #define SGSOCKADDRSZ(sag) sizeof(struct sockaddr_in) #define SGPORT(sag) ((sag)->sg_sin.sin_port) #define SGADDRP(sag) ((char*) &(sag)->sg_sin.sin_addr) #define SGFAM(sag) AF_INET #define SG_IS_UNSPECIFIED(sag) ((sag)->sg_sin.sin_addr.s_addr == 0) #define VALID_ADDRTYPE(t) ((t) == AF_INET) #endif /* HAVE_IPV6 */ struct host_info { char name[STRING_LENGTH]; /* access via eval_hostname(host) */ char addr[STRING_LENGTH]; /* access via eval_hostaddr(host) */ struct sockaddr_gen *sin; /* socket address or 0 */ struct t_unitdata *unit; /* TLI transport address or 0 */ struct request_info *request; /* for shared information */ }; /* Structure to describe what we know about a service request. */ struct request_info { int fd; /* socket handle */ char user[STRING_LENGTH]; /* access via eval_user(request) */ char daemon[STRING_LENGTH]; /* access via eval_daemon(request) */ char pid[10]; /* access via eval_pid(request) */ struct host_info client[1]; /* client endpoint info */ struct host_info server[1]; /* server endpoint info */ void (*sink) __P((int)); /* datagram sink function or 0 */ void (*hostname) __P((struct host_info *)); /* address to printable hostname */ void (*hostaddr) __P((struct host_info *)); /* address to printable address */ void (*cleanup) __P((struct request_info *)); /* cleanup function or 0 */ struct netconfig *config; /* netdir handle */ }; /* Common string operations. Less clutter should be more readable. */ #define STRN_CPY(d,s,l) { strncpy((d),(s),(l)); (d)[(l)-1] = 0; } #define STRN_EQ(x,y,l) (strncasecmp((x),(y),(l)) == 0) #define STRN_NE(x,y,l) (strncasecmp((x),(y),(l)) != 0) #define STR_EQ(x,y) (strcasecmp((x),(y)) == 0) #define STR_NE(x,y) (strcasecmp((x),(y)) != 0) /* * Initially, all above strings have the empty value. Information that * cannot be determined at runtime is set to "unknown", so that we can * distinguish between `unavailable' and `not yet looked up'. A hostname * that we do not believe in is set to "paranoid". */ #define STRING_UNKNOWN "unknown" /* lookup failed */ #define STRING_PARANOID "paranoid" /* hostname conflict */ extern char unknown[]; extern char paranoid[]; #define HOSTNAME_KNOWN(s) (STR_NE((s),unknown) && STR_NE((s),paranoid)) #ifdef HAVE_IPV6 #define NOT_INADDR(s) (strchr(s,':') == 0 && s[strspn(s,"0123456789./")] != 0) #else #define NOT_INADDR(s) (s[strspn(s,"0123456789./")] != 0) #endif /* Global functions. */ #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT) extern void fromhost __P((struct request_info *)); /* get/validate client host info */ #else #define fromhost sock_host /* no TLI support needed */ #endif extern void shell_cmd __P((char *)); /* execute shell command */ extern char *percent_x __P((char *, int, char *, struct request_info *)); /* do %<char> expansion */ extern void rfc931 __P((struct sockaddr_gen *, struct sockaddr_gen *, char *)); /* client name from RFC 931 daemon */ extern void clean_exit __P((struct request_info *)); /* clean up and exit */ extern void refuse __P((struct request_info *)); /* clean up and exit */ extern char *xgets __P((char *, int, FILE *)); /* fgets() on steroids */ extern char *split_at __P((char *, int)); /* strchr() and split */ extern unsigned long dot_quad_addr __P((char *)); /* restricted inet_addr() */ extern unsigned long prefix_to_netmask __P((char *)); /* 0-32 prefix length */ extern int numeric_addr __P((char *, union gen_addr *, int *, int *)); /* IP4/IP6 inet_addr (restricted) */ extern struct hostent *tcpd_gethostbyname __P((char *, int)); /* IP4/IP6 gethostbyname */ #ifdef HAVE_IPV6 extern char *skip_ipv6_addrs __P((char *)); /* skip over colons in IPv6 addrs */ #else #define skip_ipv6_addrs(x) x #endif /* Global variables. */ #ifdef HAVE_WEAKSYMS extern int allow_severity __attribute__ ((weak)); /* for connection logging */ extern int deny_severity __attribute__ ((weak)); /* for connection logging */ #else extern int allow_severity; /* for connection logging */ extern int deny_severity; /* for connection logging */ #endif extern char *hosts_allow_table; /* for verification mode redirection */ extern char *hosts_deny_table; /* for verification mode redirection */ extern int hosts_access_verbose; /* for verbose matching mode */ extern int rfc931_timeout; /* user lookup timeout */ extern int resident; /* > 0 if resident process */ /* * Routines for controlled initialization and update of request structure * attributes. Each attribute has its own key. */ #ifdef __STDC__ extern int hosts_access(struct request_info *request); extern int hosts_ctl(char *daemon, char *client_name, char *client_addr, char *client_user); extern struct request_info *request_init(struct request_info *,...); extern struct request_info *request_set(struct request_info *,...); #else extern int hosts_access(); extern int hosts_ctl(); extern struct request_info *request_init(); /* initialize request */ extern struct request_info *request_set(); /* update request structure */ #endif #define RQ_FILE 1 /* file descriptor */ #define RQ_DAEMON 2 /* server process (argv[0]) */ #define RQ_USER 3 /* client user name */ #define RQ_CLIENT_NAME 4 /* client host name */ #define RQ_CLIENT_ADDR 5 /* client host address */ #define RQ_CLIENT_SIN 6 /* client endpoint (internal) */ #define RQ_SERVER_NAME 7 /* server host name */ #define RQ_SERVER_ADDR 8 /* server host address */ #define RQ_SERVER_SIN 9 /* server endpoint (internal) */ /* * Routines for delayed evaluation of request attributes. Each attribute * type has its own access method. The trivial ones are implemented by * macros. The other ones are wrappers around the transport-specific host * name, address, and client user lookup methods. The request_info and * host_info structures serve as caches for the lookup results. */ extern char *eval_user __P((struct request_info *)); /* client user */ extern char *eval_hostname __P((struct host_info *)); /* printable hostname */ extern char *eval_hostaddr __P((struct host_info *)); /* printable host address */ extern char *eval_hostinfo __P((struct host_info *)); /* host name or address */ extern char *eval_client __P((struct request_info *)); /* whatever is available */ extern char *eval_server __P((struct request_info *)); /* whatever is available */ #define eval_daemon(r) ((r)->daemon) /* daemon process name */ #define eval_pid(r) ((r)->pid) /* process id */ /* Socket-specific methods, including DNS hostname lookups. */ /* look up endpoint addresses */ extern void sock_host __P((struct request_info *)); extern void sock_hostnofd __P((struct request_info *)); /* translate address to hostname */ extern void sock_hostname __P((struct host_info *)); /* address to printable address */ extern void sock_hostaddr __P((struct host_info *)); #define sock_methods(r) \ { (r)->hostname = sock_hostname; (r)->hostaddr = sock_hostaddr; } /* The System V Transport-Level Interface (TLI) interface. */ #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT) extern void tli_host __P((struct request_info *)); /* look up endpoint addresses etc. */ #endif /* * Problem reporting interface. Additional file/line context is reported * when available. The jump buffer (tcpd_buf) is not declared here, or * everyone would have to include <setjmp.h>. */ #ifdef __STDC__ extern void tcpd_warn(char *, ...); /* report problem and proceed */ extern void tcpd_jump(char *, ...); /* report problem and jump */ #else extern void tcpd_warn(); extern void tcpd_jump(); #endif struct tcpd_context { char *file; /* current file */ int line; /* current line */ }; extern struct tcpd_context tcpd_context; /* * While processing access control rules, error conditions are handled by * jumping back into the hosts_access() routine. This is cleaner than * checking the return value of each and every silly little function. The * (-1) returns are here because zero is already taken by longjmp(). */ #define AC_PERMIT 1 /* permit access */ #define AC_DENY (-1) /* deny_access */ #define AC_ERROR AC_DENY /* XXX */ /* * In verification mode an option function should just say what it would do, * instead of really doing it. An option function that would not return * should clear the dry_run flag to inform the caller of this unusual * behavior. */ extern void process_options __P((char *, struct request_info *)); /* execute options */ extern int dry_run; /* verification flag */ /* Bug workarounds. */ #ifdef INET_ADDR_BUG /* inet_addr() returns struct */ #define inet_addr fix_inet_addr extern long fix_inet_addr(); #endif #ifdef BROKEN_FGETS /* partial reads from sockets */ #define fgets fix_fgets extern char *fix_fgets(); #endif #ifdef RECVFROM_BUG /* no address family info */ #define recvfrom fix_recvfrom extern int fix_recvfrom(); #endif #ifdef GETPEERNAME_BUG /* claims success with UDP */ #define getpeername fix_getpeername extern int fix_getpeername(); #endif #ifdef SOLARIS_24_GETHOSTBYNAME_BUG /* lists addresses as aliases */ #define gethostbyname fix_gethostbyname extern struct hostent *fix_gethostbyname(); #endif #ifdef USE_STRSEP /* libc calls strtok() */ #define strtok fix_strtok extern char *fix_strtok(); #endif #ifdef LIBC_CALLS_STRTOK /* libc calls strtok() */ #define strtok my_strtok extern char *my_strtok(); #endif __END_DECLS #endif /* tcpd.h */ ����������������sgtty.h���������������������������������������������������������������������������������������������0000644�����������������00000002523�14763166026�0006104 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991,1992,1996,1998,1999,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SGTTY_H #define _SGTTY_H 1 #include <features.h> #include <sys/ioctl.h> /* On some systems this type is not defined by <bits/ioctl-types.h>; in that case, the functions are just stubs that return ENOSYS. */ struct sgttyb; __BEGIN_DECLS /* Fill in *PARAMS with terminal parameters associated with FD. */ extern int gtty (int __fd, struct sgttyb *__params) __THROW; /* Set the terminal parameters associated with FD to *PARAMS. */ extern int stty (int __fd, const struct sgttyb *__params) __THROW; __END_DECLS #endif /* sgtty.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������sched.h���������������������������������������������������������������������������������������������0000644�����������������00000011066�14763166026�0006022 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Definitions for POSIX 1003.1b-1993 (aka POSIX.4) scheduling interface. Copyright (C) 1996,1997,1999,2001-2004,2007,2010,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SCHED_H #define _SCHED_H 1 #include <features.h> /* Get type definitions. */ #include <bits/types.h> #define __need_size_t #include <stddef.h> #define __need_time_t #define __need_timespec #include <time.h> #ifndef __pid_t_defined typedef __pid_t pid_t; # define __pid_t_defined #endif /* Get system specific constant and data structure definitions. */ #include <bits/sched.h> /* Define the real names for the elements of `struct sched_param'. */ #define sched_priority __sched_priority __BEGIN_DECLS /* Set scheduling parameters for a process. */ extern int sched_setparam (__pid_t __pid, const struct sched_param *__param) __THROW; /* Retrieve scheduling parameters for a particular process. */ extern int sched_getparam (__pid_t __pid, struct sched_param *__param) __THROW; /* Set scheduling algorithm and/or parameters for a process. */ extern int sched_setscheduler (__pid_t __pid, int __policy, const struct sched_param *__param) __THROW; /* Retrieve scheduling algorithm for a particular purpose. */ extern int sched_getscheduler (__pid_t __pid) __THROW; /* Yield the processor. */ extern int sched_yield (void) __THROW; /* Get maximum priority value for a scheduler. */ extern int sched_get_priority_max (int __algorithm) __THROW; /* Get minimum priority value for a scheduler. */ extern int sched_get_priority_min (int __algorithm) __THROW; /* Get the SCHED_RR interval for the named process. */ extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW; #ifdef __USE_GNU /* Access macros for `cpu_set'. */ # define CPU_SETSIZE __CPU_SETSIZE # define CPU_SET(cpu, cpusetp) __CPU_SET_S (cpu, sizeof (cpu_set_t), cpusetp) # define CPU_CLR(cpu, cpusetp) __CPU_CLR_S (cpu, sizeof (cpu_set_t), cpusetp) # define CPU_ISSET(cpu, cpusetp) __CPU_ISSET_S (cpu, sizeof (cpu_set_t), \ cpusetp) # define CPU_ZERO(cpusetp) __CPU_ZERO_S (sizeof (cpu_set_t), cpusetp) # define CPU_COUNT(cpusetp) __CPU_COUNT_S (sizeof (cpu_set_t), cpusetp) # define CPU_SET_S(cpu, setsize, cpusetp) __CPU_SET_S (cpu, setsize, cpusetp) # define CPU_CLR_S(cpu, setsize, cpusetp) __CPU_CLR_S (cpu, setsize, cpusetp) # define CPU_ISSET_S(cpu, setsize, cpusetp) __CPU_ISSET_S (cpu, setsize, \ cpusetp) # define CPU_ZERO_S(setsize, cpusetp) __CPU_ZERO_S (setsize, cpusetp) # define CPU_COUNT_S(setsize, cpusetp) __CPU_COUNT_S (setsize, cpusetp) # define CPU_EQUAL(cpusetp1, cpusetp2) \ __CPU_EQUAL_S (sizeof (cpu_set_t), cpusetp1, cpusetp2) # define CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ __CPU_EQUAL_S (setsize, cpusetp1, cpusetp2) # define CPU_AND(destset, srcset1, srcset2) \ __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, &) # define CPU_OR(destset, srcset1, srcset2) \ __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, |) # define CPU_XOR(destset, srcset1, srcset2) \ __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, ^) # define CPU_AND_S(setsize, destset, srcset1, srcset2) \ __CPU_OP_S (setsize, destset, srcset1, srcset2, &) # define CPU_OR_S(setsize, destset, srcset1, srcset2) \ __CPU_OP_S (setsize, destset, srcset1, srcset2, |) # define CPU_XOR_S(setsize, destset, srcset1, srcset2) \ __CPU_OP_S (setsize, destset, srcset1, srcset2, ^) # define CPU_ALLOC_SIZE(count) __CPU_ALLOC_SIZE (count) # define CPU_ALLOC(count) __CPU_ALLOC (count) # define CPU_FREE(cpuset) __CPU_FREE (cpuset) /* Set the CPU affinity for a task */ extern int sched_setaffinity (__pid_t __pid, size_t __cpusetsize, const cpu_set_t *__cpuset) __THROW; /* Get the CPU affinity for a task */ extern int sched_getaffinity (__pid_t __pid, size_t __cpusetsize, cpu_set_t *__cpuset) __THROW; #endif __END_DECLS #endif /* sched.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libpq-events.h��������������������������������������������������������������������������������������0000644�����������������00000004243�14763166026�0007344 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * libpq-events.h * This file contains definitions that are useful to applications * that invoke the libpq "events" API, but are not interesting to * ordinary users of libpq. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/interfaces/libpq/libpq-events.h * *------------------------------------------------------------------------- */ #ifndef LIBPQ_EVENTS_H #define LIBPQ_EVENTS_H #include "libpq-fe.h" #ifdef __cplusplus extern "C" { #endif /* Callback Event Ids */ typedef enum { PGEVT_REGISTER, PGEVT_CONNRESET, PGEVT_CONNDESTROY, PGEVT_RESULTCREATE, PGEVT_RESULTCOPY, PGEVT_RESULTDESTROY } PGEventId; typedef struct { PGconn *conn; } PGEventRegister; typedef struct { PGconn *conn; } PGEventConnReset; typedef struct { PGconn *conn; } PGEventConnDestroy; typedef struct { PGconn *conn; PGresult *result; } PGEventResultCreate; typedef struct { const PGresult *src; PGresult *dest; } PGEventResultCopy; typedef struct { PGresult *result; } PGEventResultDestroy; typedef int (*PGEventProc) (PGEventId evtId, void *evtInfo, void *passThrough); /* Registers an event proc with the given PGconn. */ extern int PQregisterEventProc(PGconn *conn, PGEventProc proc, const char *name, void *passThrough); /* Sets the PGconn instance data for the provided proc to data. */ extern int PQsetInstanceData(PGconn *conn, PGEventProc proc, void *data); /* Gets the PGconn instance data for the provided proc. */ extern void *PQinstanceData(const PGconn *conn, PGEventProc proc); /* Sets the PGresult instance data for the provided proc to data. */ extern int PQresultSetInstanceData(PGresult *result, PGEventProc proc, void *data); /* Gets the PGresult instance data for the provided proc. */ extern void *PQresultInstanceData(const PGresult *result, PGEventProc proc); /* Fires RESULTCREATE events for an application-created PGresult. */ extern int PQfireResultCreateEvents(PGconn *conn, PGresult *res); #ifdef __cplusplus } #endif #endif /* LIBPQ_EVENTS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gdfontt.h�������������������������������������������������������������������������������������������0000644�����������������00000001151�14763166026�0006373 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifdef __cplusplus extern "C" { #endif #ifndef _GDFONTT_H_ #define _GDFONTT_H_ 1 #ifdef __cplusplus extern "C" { #endif /* This is a header file for gd font, generated using bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz from bdf font -Misc-Fixed-Medium-R-Normal--8-80-75-75-C-50-ISO8859-2 at Thu Jan 8 13:49:54 1998. The original bdf was holding following copyright: "Libor Skarvada, libor@informatics.muni.cz" */ #include "gd.h" BGD_EXPORT_DATA_PROT gdFontPtr gdFontTiny; BGD_DECLARE(gdFontPtr) gdFontGetTiny(void); #ifdef __cplusplus } #endif #endif #ifdef __cplusplus } #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libpng15/png.h��������������������������������������������������������������������������������������0000644�����������������00000342555�14763166026�0007153 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* png.h - header file for PNG reference library * * libpng version 1.5.13 - September 27, 2012 * Copyright (c) 1998-2012 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * * This code is released under the libpng license (See LICENSE, below) * * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger * libpng versions 0.97, January 1998, through 1.5.13 - September 27, 2012: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: * * Due to various miscommunications, unforeseen code incompatibilities * and occasional factors outside the authors' control, version numbering * on the library has not always been consistent and straightforward. * The following table summarizes matters since version 0.89c, which was * the first widely used release: * * source png.h png.h shared-lib * version string int version * ------- ------ ----- ---------- * 0.89c "1.0 beta 3" 0.89 89 1.0.89 * 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90] * 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95] * 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96] * 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97] * 0.97c 0.97 97 2.0.97 * 0.98 0.98 98 2.0.98 * 0.99 0.99 98 2.0.99 * 0.99a-m 0.99 99 2.0.99 * 1.00 1.00 100 2.1.0 [100 should be 10000] * 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000] * 1.0.1 png.h string is 10001 2.1.0 * 1.0.1a-e identical to the 10002 from here on, the shared library * 1.0.2 source version) 10002 is 2.V where V is the source code * 1.0.2a-b 10003 version, except as noted. * 1.0.3 10003 * 1.0.3a-d 10004 * 1.0.4 10004 * 1.0.4a-f 10005 * 1.0.5 (+ 2 patches) 10005 * 1.0.5a-d 10006 * 1.0.5e-r 10100 (not source compatible) * 1.0.5s-v 10006 (not binary compatible) * 1.0.6 (+ 3 patches) 10006 (still binary incompatible) * 1.0.6d-f 10007 (still binary incompatible) * 1.0.6g 10007 * 1.0.6h 10007 10.6h (testing xy.z so-numbering) * 1.0.6i 10007 10.6i * 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0) * 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible) * 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible) * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible) * 1.0.7 1 10007 (still compatible) * 1.0.8beta1-4 1 10008 2.1.0.8beta1-4 * 1.0.8rc1 1 10008 2.1.0.8rc1 * 1.0.8 1 10008 2.1.0.8 * 1.0.9beta1-6 1 10009 2.1.0.9beta1-6 * 1.0.9rc1 1 10009 2.1.0.9rc1 * 1.0.9beta7-10 1 10009 2.1.0.9beta7-10 * 1.0.9rc2 1 10009 2.1.0.9rc2 * 1.0.9 1 10009 2.1.0.9 * 1.0.10beta1 1 10010 2.1.0.10beta1 * 1.0.10rc1 1 10010 2.1.0.10rc1 * 1.0.10 1 10010 2.1.0.10 * 1.0.11beta1-3 1 10011 2.1.0.11beta1-3 * 1.0.11rc1 1 10011 2.1.0.11rc1 * 1.0.11 1 10011 2.1.0.11 * 1.0.12beta1-2 2 10012 2.1.0.12beta1-2 * 1.0.12rc1 2 10012 2.1.0.12rc1 * 1.0.12 2 10012 2.1.0.12 * 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned) * 1.2.0beta1-2 2 10200 2.1.2.0beta1-2 * 1.2.0beta3-5 3 10200 3.1.2.0beta3-5 * 1.2.0rc1 3 10200 3.1.2.0rc1 * 1.2.0 3 10200 3.1.2.0 * 1.2.1beta1-4 3 10201 3.1.2.1beta1-4 * 1.2.1rc1-2 3 10201 3.1.2.1rc1-2 * 1.2.1 3 10201 3.1.2.1 * 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6 * 1.0.13beta1 10 10013 10.so.0.1.0.13beta1 * 1.0.13rc1 10 10013 10.so.0.1.0.13rc1 * 1.2.2rc1 12 10202 12.so.0.1.2.2rc1 * 1.0.13 10 10013 10.so.0.1.0.13 * 1.2.2 12 10202 12.so.0.1.2.2 * 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6 * 1.2.3 12 10203 12.so.0.1.2.3 * 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3 * 1.0.14rc1 13 10014 10.so.0.1.0.14rc1 * 1.2.4rc1 13 10204 12.so.0.1.2.4rc1 * 1.0.14 10 10014 10.so.0.1.0.14 * 1.2.4 13 10204 12.so.0.1.2.4 * 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2 * 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3 * 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3 * 1.0.15 10 10015 10.so.0.1.0.15 * 1.2.5 13 10205 12.so.0.1.2.5 * 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4 * 1.0.16 10 10016 10.so.0.1.0.16 * 1.2.6 13 10206 12.so.0.1.2.6 * 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2 * 1.0.17rc1 10 10017 12.so.0.1.0.17rc1 * 1.2.7rc1 13 10207 12.so.0.1.2.7rc1 * 1.0.17 10 10017 12.so.0.1.0.17 * 1.2.7 13 10207 12.so.0.1.2.7 * 1.2.8beta1-5 13 10208 12.so.0.1.2.8beta1-5 * 1.0.18rc1-5 10 10018 12.so.0.1.0.18rc1-5 * 1.2.8rc1-5 13 10208 12.so.0.1.2.8rc1-5 * 1.0.18 10 10018 12.so.0.1.0.18 * 1.2.8 13 10208 12.so.0.1.2.8 * 1.2.9beta1-3 13 10209 12.so.0.1.2.9beta1-3 * 1.2.9beta4-11 13 10209 12.so.0.9[.0] * 1.2.9rc1 13 10209 12.so.0.9[.0] * 1.2.9 13 10209 12.so.0.9[.0] * 1.2.10beta1-7 13 10210 12.so.0.10[.0] * 1.2.10rc1-2 13 10210 12.so.0.10[.0] * 1.2.10 13 10210 12.so.0.10[.0] * 1.4.0beta1-5 14 10400 14.so.0.0[.0] * 1.2.11beta1-4 13 10211 12.so.0.11[.0] * 1.4.0beta7-8 14 10400 14.so.0.0[.0] * 1.2.11 13 10211 12.so.0.11[.0] * 1.2.12 13 10212 12.so.0.12[.0] * 1.4.0beta9-14 14 10400 14.so.0.0[.0] * 1.2.13 13 10213 12.so.0.13[.0] * 1.4.0beta15-36 14 10400 14.so.0.0[.0] * 1.4.0beta37-87 14 10400 14.so.14.0[.0] * 1.4.0rc01 14 10400 14.so.14.0[.0] * 1.4.0beta88-109 14 10400 14.so.14.0[.0] * 1.4.0rc02-08 14 10400 14.so.14.0[.0] * 1.4.0 14 10400 14.so.14.0[.0] * 1.4.1beta01-03 14 10401 14.so.14.1[.0] * 1.4.1rc01 14 10401 14.so.14.1[.0] * 1.4.1beta04-12 14 10401 14.so.14.1[.0] * 1.4.1 14 10401 14.so.14.1[.0] * 1.4.2 14 10402 14.so.14.2[.0] * 1.4.3 14 10403 14.so.14.3[.0] * 1.4.4 14 10404 14.so.14.4[.0] * 1.5.0beta01-58 15 10500 15.so.15.0[.0] * 1.5.0rc01-07 15 10500 15.so.15.0[.0] * 1.5.0 15 10500 15.so.15.0[.0] * 1.5.1beta01-11 15 10501 15.so.15.1[.0] * 1.5.1rc01-02 15 10501 15.so.15.1[.0] * 1.5.1 15 10501 15.so.15.1[.0] * 1.5.2beta01-03 15 10502 15.so.15.2[.0] * 1.5.2rc01-03 15 10502 15.so.15.2[.0] * 1.5.2 15 10502 15.so.15.2[.0] * 1.5.3beta01-10 15 10503 15.so.15.3[.0] * 1.5.3rc01-02 15 10503 15.so.15.3[.0] * 1.5.3beta11 15 10503 15.so.15.3[.0] * 1.5.3 [omitted] * 1.5.4beta01-08 15 10504 15.so.15.4[.0] * 1.5.4rc01 15 10504 15.so.15.4[.0] * 1.5.4 15 10504 15.so.15.4[.0] * 1.5.5beta01-08 15 10505 15.so.15.5[.0] * 1.5.5rc01 15 10505 15.so.15.5[.0] * 1.5.5 15 10505 15.so.15.5[.0] * 1.5.6beta01-07 15 10506 15.so.15.6[.0] * 1.5.6rc01-03 15 10506 15.so.15.6[.0] * 1.5.6 15 10506 15.so.15.6[.0] * 1.5.7beta01-05 15 10507 15.so.15.7[.0] * 1.5.7rc01-03 15 10507 15.so.15.7[.0] * 1.5.7 15 10507 15.so.15.7[.0] * 1.5.8beta01 15 10508 15.so.15.8[.0] * 1.5.8rc01 15 10508 15.so.15.8[.0] * 1.5.8 15 10508 15.so.15.8[.0] * 1.5.9beta01-02 15 10509 15.so.15.9[.0] * 1.5.9rc01 15 10509 15.so.15.9[.0] * 1.5.9 15 10509 15.so.15.9[.0] * 1.5.10beta01-05 15 10510 15.so.15.10[.0] * 1.5.10 15 10510 15.so.15.10[.0] * 1.5.11beta01 15 10511 15.so.15.11[.0] * 1.5.11rc01-05 15 10511 15.so.15.11[.0] * 1.5.11 15 10511 15.so.15.11[.0] * 1.5.12 15 10512 15.so.15.12[.0] * 1.5.13beta01-02 15 10513 15.so.15.13[.0] * 1.5.13rc01 15 10513 15.so.15.13[.0] * 1.5.13 15 10513 15.so.15.13[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be * used for changes in backward compatibility, as it is intended. The * PNG_LIBPNG_VER macro, which is not used within libpng but is available * for applications, is an unsigned integer of the form xyyzz corresponding * to the source version x.y.z (leading zeros in y and z). Beta versions * were given the previous public release number plus a letter, until * version 1.0.6j; from then on they were given the upcoming public * release number plus "betaNN" or "rcNN". * * Binary incompatibility exists only when applications make direct access * to the info_ptr or png_ptr members through png.h, and the compiled * application is loaded with a different version of the library. * * DLLNUM will change each time there are forward or backward changes * in binary compatibility (e.g., when a new feature is added). * * See libpng-manual.txt or libpng.3 for more information. The PNG * specification is available as a W3C Recommendation and as an ISO * Specification, <http://www.w3.org/TR/2003/REC-PNG-20031110/ */ /* * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: * * If you modify libpng you may insert additional notices immediately following * this sentence. * * This code is released under the libpng license. * * libpng versions 1.2.6, August 15, 2004, through 1.5.13, September 27, 2012, are * Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-1.2.5 * with the following individual added to the list of Contributing Authors: * * Cosmin Truta * * libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are * Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-1.0.6 * with the following individuals added to the list of Contributing Authors: * * Simon-Pierre Cadieux * Eric S. Raymond * Gilles Vollant * * and with the following additions to the disclaimer: * * There is no warranty against interference with your enjoyment of the * library or against infringement. There is no warranty that our * efforts or the library will fulfill any of your particular purposes * or needs. This library is provided with all faults, and the entire * risk of satisfactory quality, performance, accuracy, and effort is with * the user. * * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-0.96, * with the following individuals added to the list of Contributing Authors: * * Tom Lane * Glenn Randers-Pehrson * Willem van Schaik * * libpng versions 0.89, June 1996, through 0.96, May 1997, are * Copyright (c) 1996, 1997 Andreas Dilger * Distributed according to the same disclaimer and license as libpng-0.88, * with the following individuals added to the list of Contributing Authors: * * John Bowler * Kevin Bracey * Sam Bushell * Magnus Holmgren * Greg Roelofs * Tom Tanner * * libpng versions 0.5, May 1995, through 0.88, January 1996, are * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * * For the purposes of this copyright and license, "Contributing Authors" * is defined as the following set of individuals: * * Andreas Dilger * Dave Martindale * Guy Eric Schalnat * Paul Schmidt * Tim Wegner * * The PNG Reference Library is supplied "AS IS". The Contributing Authors * and Group 42, Inc. disclaim all warranties, expressed or implied, * including, without limitation, the warranties of merchantability and of * fitness for any purpose. The Contributing Authors and Group 42, Inc. * assume no liability for direct, indirect, incidental, special, exemplary, * or consequential damages, which may result from the use of the PNG * Reference Library, even if advised of the possibility of such damage. * * Permission is hereby granted to use, copy, modify, and distribute this * source code, or portions hereof, for any purpose, without fee, subject * to the following restrictions: * * 1. The origin of this source code must not be misrepresented. * * 2. Altered versions must be plainly marked as such and must not * be misrepresented as being the original source. * * 3. This Copyright notice may not be removed or altered from * any source or altered source distribution. * * The Contributing Authors and Group 42, Inc. specifically permit, without * fee, and encourage the use of this source code as a component to * supporting the PNG file format in commercial products. If you use this * source code in a product, acknowledgment is not required but would be * appreciated. */ /* * A "png_get_copyright" function is available, for convenient use in "about" * boxes and the like: * * printf("%s", png_get_copyright(NULL)); * * Also, the PNG logo (in PNG format, of course) is supplied in the * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31). */ /* * Libpng is OSI Certified Open Source Software. OSI Certified is a * certification mark of the Open Source Initiative. */ /* * The contributing authors would like to thank all those who helped * with testing, bug fixes, and patience. This wouldn't have been * possible without all of you. * * Thanks to Frank J. T. Wojcik for helping with the documentation. */ /* * Y2K compliance in libpng: * ========================= * * September 27, 2012 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and * upward through 1.5.13 are Y2K compliant. It is my belief that * earlier versions were also Y2K compliant. * * Libpng only has two year fields. One is a 2-byte unsigned integer * that will hold years up to 65535. The other holds the date in text * format, and will hold years up to 9999. * * The integer is * "png_uint_16 year" in png_time_struct. * * The string is * "char time_buffer[29]" in png_struct. This will be no * longer used in libpng-1.6.0 and will be removed from libpng-1.7.0. * * There are seven time-related functions: * png.c: png_convert_to_rfc_1123() in png.c * (formerly png_convert_to_rfc_1152() in error) * png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c * png_convert_from_time_t() in pngwrite.c * png_get_tIME() in pngget.c * png_handle_tIME() in pngrutil.c, called in pngread.c * png_set_tIME() in pngset.c * png_write_tIME() in pngwutil.c, called in pngwrite.c * * All handle dates properly in a Y2K environment. The * png_convert_from_time_t() function calls gmtime() to convert from system * clock time, which returns (year - 1900), which we properly convert to * the full 4-digit year. There is a possibility that applications using * libpng are not passing 4-digit years into the png_convert_to_rfc_1123() * function, or that they are incorrectly passing only a 2-digit year * instead of "year - 1900" into the png_convert_from_struct_tm() function, * but this is not under our control. The libpng documentation has always * stated that it works with 4-digit years, and the APIs have been * documented as such. * * The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned * integer to hold the year, and can hold years as large as 65535. * * zlib, upon which libpng depends, is also Y2K compliant. It contains * no date-related code. * * Glenn Randers-Pehrson * libpng maintainer * PNG Development Group */ #ifndef PNG_H #define PNG_H /* This is not the place to learn how to use libpng. The file libpng-manual.txt * describes how to use libpng, and the file example.c summarizes it * with some code on which to build. This file is useful for looking * at the actual function definitions and structure components. * * If you just need to read a PNG file and don't want to read the documentation * skip to the end of this file and read the section entitled 'simplified API'. */ /* Version information for png.h - this should match the version in png.c */ #define PNG_LIBPNG_VER_STRING "1.5.13" #define PNG_HEADER_VERSION_STRING \ " libpng version 1.5.13 - September 27, 2012\n" #define PNG_LIBPNG_VER_SONUM 15 #define PNG_LIBPNG_VER_DLLNUM 15 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 5 #define PNG_LIBPNG_VER_RELEASE 13 /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: */ #define PNG_LIBPNG_VER_BUILD 0 /* Release Status */ #define PNG_LIBPNG_BUILD_ALPHA 1 #define PNG_LIBPNG_BUILD_BETA 2 #define PNG_LIBPNG_BUILD_RC 3 #define PNG_LIBPNG_BUILD_STABLE 4 #define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7 /* Release-Specific Flags */ #define PNG_LIBPNG_BUILD_PATCH 8 /* Can be OR'ed with PNG_LIBPNG_BUILD_STABLE only */ #define PNG_LIBPNG_BUILD_PRIVATE 16 /* Cannot be OR'ed with PNG_LIBPNG_BUILD_SPECIAL */ #define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with PNG_LIBPNG_BUILD_PRIVATE */ #define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE /* Careful here. At one time, Guy wanted to use 082, but that would be octal. * We must not include leading zeros. * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only * version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ #define PNG_LIBPNG_VER 10513 /* 1.5.13 */ /* Library configuration: these options cannot be changed after * the library has been built. */ #ifndef PNGLCONF_H /* If pnglibconf.h is missing, you can * copy scripts/pnglibconf.h.prebuilt to pnglibconf.h */ # include "pnglibconf.h" #endif #ifndef PNG_VERSION_INFO_ONLY # ifndef PNG_BUILDING_SYMBOL_TABLE /* * Standard header files (not needed for the version info or while * building symbol table -- see scripts/pnglibconf.dfa) */ # ifdef PNG_SETJMP_SUPPORTED # include <setjmp.h> # endif /* Need the time information for converting tIME chunks, it * defines struct tm: */ # ifdef PNG_CONVERT_tIME_SUPPORTED /* "time.h" functions are not supported on all operating systems */ # include <time.h> # endif # endif /* Machine specific configuration. */ # include "pngconf.h" #endif /* * Added at libpng-1.2.8 * * Ref MSDN: Private as priority over Special * VS_FF_PRIVATEBUILD File *was not* built using standard release * procedures. If this value is given, the StringFileInfo block must * contain a PrivateBuild string. * * VS_FF_SPECIALBUILD File *was* built by the original company using * standard release procedures but is a variation of the standard * file of the same version number. If this value is given, the * StringFileInfo block must contain a SpecialBuild string. */ #ifdef PNG_USER_PRIVATEBUILD /* From pnglibconf.h */ # define PNG_LIBPNG_BUILD_TYPE \ (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_PRIVATE) #else # ifdef PNG_LIBPNG_SPECIALBUILD # define PNG_LIBPNG_BUILD_TYPE \ (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_SPECIAL) # else # define PNG_LIBPNG_BUILD_TYPE (PNG_LIBPNG_BUILD_BASE_TYPE) # endif #endif #ifndef PNG_VERSION_INFO_ONLY /* Inhibit C++ name-mangling for libpng functions but not for system calls. */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* Version information for C files, stored in png.c. This had better match * the version above. */ #define png_libpng_ver png_get_header_ver(NULL) /* This file is arranged in several sections: * * 1. Any configuration options that can be specified by for the application * code when it is built. (Build time configuration is in pnglibconf.h) * 2. Type definitions (base types are defined in pngconf.h), structure * definitions. * 3. Exported library functions. * * The library source code has additional files (principally pngpriv.h) that * allow configuration of the library. */ /* Section 1: run time configuration * See pnglibconf.h for build time configuration * * Run time configuration allows the application to choose between * implementations of certain arithmetic APIs. The default is set * at build time and recorded in pnglibconf.h, but it is safe to * override these (and only these) settings. Note that this won't * change what the library does, only application code, and the * settings can (and probably should) be made on a per-file basis * by setting the #defines before including png.h * * Use macros to read integers from PNG data or use the exported * functions? * PNG_USE_READ_MACROS: use the macros (see below) Note that * the macros evaluate their argument multiple times. * PNG_NO_USE_READ_MACROS: call the relevant library function. * * Use the alternative algorithm for compositing alpha samples that * does not use division? * PNG_READ_COMPOSITE_NODIV_SUPPORTED: use the 'no division' * algorithm. * PNG_NO_READ_COMPOSITE_NODIV: use the 'division' algorithm. * * How to handle benign errors if PNG_ALLOW_BENIGN_ERRORS is * false? * PNG_ALLOW_BENIGN_ERRORS: map calls to the benign error * APIs to png_warning. * Otherwise the calls are mapped to png_error. */ /* Section 2: type definitions, including structures and compile time * constants. * See pngconf.h for base types that vary by machine/system */ /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ typedef char* png_libpng_version_1_5_13; /* Three color definitions. The order of the red, green, and blue, (and the * exact size) is not important, although the size of the fields need to * be png_byte or png_uint_16 (as defined below). */ typedef struct png_color_struct { png_byte red; png_byte green; png_byte blue; } png_color; typedef png_color FAR * png_colorp; typedef PNG_CONST png_color FAR * png_const_colorp; typedef png_color FAR * FAR * png_colorpp; typedef struct png_color_16_struct { png_byte index; /* used for palette files */ png_uint_16 red; /* for use in red green blue files */ png_uint_16 green; png_uint_16 blue; png_uint_16 gray; /* for use in grayscale files */ } png_color_16; typedef png_color_16 FAR * png_color_16p; typedef PNG_CONST png_color_16 FAR * png_const_color_16p; typedef png_color_16 FAR * FAR * png_color_16pp; typedef struct png_color_8_struct { png_byte red; /* for use in red green blue files */ png_byte green; png_byte blue; png_byte gray; /* for use in grayscale files */ png_byte alpha; /* for alpha channel files */ } png_color_8; typedef png_color_8 FAR * png_color_8p; typedef PNG_CONST png_color_8 FAR * png_const_color_8p; typedef png_color_8 FAR * FAR * png_color_8pp; /* * The following two structures are used for the in-core representation * of sPLT chunks. */ typedef struct png_sPLT_entry_struct { png_uint_16 red; png_uint_16 green; png_uint_16 blue; png_uint_16 alpha; png_uint_16 frequency; } png_sPLT_entry; typedef png_sPLT_entry FAR * png_sPLT_entryp; typedef PNG_CONST png_sPLT_entry FAR * png_const_sPLT_entryp; typedef png_sPLT_entry FAR * FAR * png_sPLT_entrypp; /* When the depth of the sPLT palette is 8 bits, the color and alpha samples * occupy the LSB of their respective members, and the MSB of each member * is zero-filled. The frequency member always occupies the full 16 bits. */ typedef struct png_sPLT_struct { png_charp name; /* palette name */ png_byte depth; /* depth of palette samples */ png_sPLT_entryp entries; /* palette entries */ png_int_32 nentries; /* number of palette entries */ } png_sPLT_t; typedef png_sPLT_t FAR * png_sPLT_tp; typedef PNG_CONST png_sPLT_t FAR * png_const_sPLT_tp; typedef png_sPLT_t FAR * FAR * png_sPLT_tpp; #ifdef PNG_TEXT_SUPPORTED /* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file, * and whether that contents is compressed or not. The "key" field * points to a regular zero-terminated C string. The "text" fields can be a * regular C string, an empty string, or a NULL pointer. * However, the structure returned by png_get_text() will always contain * the "text" field as a regular zero-terminated C string (possibly * empty), never a NULL pointer, so it can be safely used in printf() and * other string-handling functions. Note that the "itxt_length", "lang", and * "lang_key" members of the structure only exist when the library is built * with iTXt chunk support. Prior to libpng-1.4.0 the library was built by * default without iTXt support. Also note that when iTXt *is* supported, * the "lang" and "lang_key" fields contain NULL pointers when the * "compression" field contains * PNG_TEXT_COMPRESSION_NONE or * PNG_TEXT_COMPRESSION_zTXt. Note that the "compression value" is not the * same as what appears in the PNG tEXt/zTXt/iTXt chunk's "compression flag" * which is always 0 or 1, or its "compression method" which is always 0. */ typedef struct png_text_struct { int compression; /* compression value: -1: tEXt, none 0: zTXt, deflate 1: iTXt, none 2: iTXt, deflate */ png_charp key; /* keyword, 1-79 character description of "text" */ png_charp text; /* comment, may be an empty string (ie "") or a NULL pointer */ png_size_t text_length; /* length of the text string */ png_size_t itxt_length; /* length of the itxt string */ png_charp lang; /* language code, 0-79 characters or a NULL pointer */ png_charp lang_key; /* keyword translated UTF-8 string, 0 or more chars or a NULL pointer */ } png_text; typedef png_text FAR * png_textp; typedef PNG_CONST png_text FAR * png_const_textp; typedef png_text FAR * FAR * png_textpp; #endif /* Supported compression types for text in PNG files (tEXt, and zTXt). * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */ #define PNG_TEXT_COMPRESSION_NONE_WR -3 #define PNG_TEXT_COMPRESSION_zTXt_WR -2 #define PNG_TEXT_COMPRESSION_NONE -1 #define PNG_TEXT_COMPRESSION_zTXt 0 #define PNG_ITXT_COMPRESSION_NONE 1 #define PNG_ITXT_COMPRESSION_zTXt 2 #define PNG_TEXT_COMPRESSION_LAST 3 /* Not a valid value */ /* png_time is a way to hold the time in an machine independent way. * Two conversions are provided, both from time_t and struct tm. There * is no portable way to convert to either of these structures, as far * as I know. If you know of a portable way, send it to me. As a side * note - PNG has always been Year 2000 compliant! */ typedef struct png_time_struct { png_uint_16 year; /* full year, as in, 1995 */ png_byte month; /* month of year, 1 - 12 */ png_byte day; /* day of month, 1 - 31 */ png_byte hour; /* hour of day, 0 - 23 */ png_byte minute; /* minute of hour, 0 - 59 */ png_byte second; /* second of minute, 0 - 60 (for leap seconds) */ } png_time; typedef png_time FAR * png_timep; typedef PNG_CONST png_time FAR * png_const_timep; typedef png_time FAR * FAR * png_timepp; #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \ defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED) /* png_unknown_chunk is a structure to hold queued chunks for which there is * no specific support. The idea is that we can use this to queue * up private chunks for output even though the library doesn't actually * know about their semantics. */ typedef struct png_unknown_chunk_t { png_byte name[5]; png_byte *data; png_size_t size; /* libpng-using applications should NOT directly modify this byte. */ png_byte location; /* mode of operation at read time */ } png_unknown_chunk; typedef png_unknown_chunk FAR * png_unknown_chunkp; typedef PNG_CONST png_unknown_chunk FAR * png_const_unknown_chunkp; typedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp; #endif /* Values for the unknown chunk location byte */ #define PNG_HAVE_IHDR 0x01 #define PNG_HAVE_PLTE 0x02 #define PNG_AFTER_IDAT 0x08 /* The complete definition of png_info has, as of libpng-1.5.0, * been moved into a separate header file that is not accessible to * applications. Read libpng-manual.txt or libpng.3 for more info. */ typedef struct png_info_def png_info; typedef png_info FAR * png_infop; typedef PNG_CONST png_info FAR * png_const_infop; typedef png_info FAR * FAR * png_infopp; /* Maximum positive integer used in PNG is (2^31)-1 */ #define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL) #define PNG_UINT_32_MAX ((png_uint_32)(-1)) #define PNG_SIZE_MAX ((png_size_t)(-1)) /* These are constants for fixed point values encoded in the * PNG specification manner (x100000) */ #define PNG_FP_1 100000 #define PNG_FP_HALF 50000 #define PNG_FP_MAX ((png_fixed_point)0x7fffffffL) #define PNG_FP_MIN (-PNG_FP_MAX) /* These describe the color_type field in png_info. */ /* color type masks */ #define PNG_COLOR_MASK_PALETTE 1 #define PNG_COLOR_MASK_COLOR 2 #define PNG_COLOR_MASK_ALPHA 4 /* color types. Note that not all combinations are legal */ #define PNG_COLOR_TYPE_GRAY 0 #define PNG_COLOR_TYPE_PALETTE (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE) #define PNG_COLOR_TYPE_RGB (PNG_COLOR_MASK_COLOR) #define PNG_COLOR_TYPE_RGB_ALPHA (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA) #define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA) /* aliases */ #define PNG_COLOR_TYPE_RGBA PNG_COLOR_TYPE_RGB_ALPHA #define PNG_COLOR_TYPE_GA PNG_COLOR_TYPE_GRAY_ALPHA /* This is for compression type. PNG 1.0-1.2 only define the single type. */ #define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */ #define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE /* This is for filter type. PNG 1.0-1.2 only define the single type. */ #define PNG_FILTER_TYPE_BASE 0 /* Single row per-byte filtering */ #define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */ #define PNG_FILTER_TYPE_DEFAULT PNG_FILTER_TYPE_BASE /* These are for the interlacing type. These values should NOT be changed. */ #define PNG_INTERLACE_NONE 0 /* Non-interlaced image */ #define PNG_INTERLACE_ADAM7 1 /* Adam7 interlacing */ #define PNG_INTERLACE_LAST 2 /* Not a valid value */ /* These are for the oFFs chunk. These values should NOT be changed. */ #define PNG_OFFSET_PIXEL 0 /* Offset in pixels */ #define PNG_OFFSET_MICROMETER 1 /* Offset in micrometers (1/10^6 meter) */ #define PNG_OFFSET_LAST 2 /* Not a valid value */ /* These are for the pCAL chunk. These values should NOT be changed. */ #define PNG_EQUATION_LINEAR 0 /* Linear transformation */ #define PNG_EQUATION_BASE_E 1 /* Exponential base e transform */ #define PNG_EQUATION_ARBITRARY 2 /* Arbitrary base exponential transform */ #define PNG_EQUATION_HYPERBOLIC 3 /* Hyperbolic sine transformation */ #define PNG_EQUATION_LAST 4 /* Not a valid value */ /* These are for the sCAL chunk. These values should NOT be changed. */ #define PNG_SCALE_UNKNOWN 0 /* unknown unit (image scale) */ #define PNG_SCALE_METER 1 /* meters per pixel */ #define PNG_SCALE_RADIAN 2 /* radians per pixel */ #define PNG_SCALE_LAST 3 /* Not a valid value */ /* These are for the pHYs chunk. These values should NOT be changed. */ #define PNG_RESOLUTION_UNKNOWN 0 /* pixels/unknown unit (aspect ratio) */ #define PNG_RESOLUTION_METER 1 /* pixels/meter */ #define PNG_RESOLUTION_LAST 2 /* Not a valid value */ /* These are for the sRGB chunk. These values should NOT be changed. */ #define PNG_sRGB_INTENT_PERCEPTUAL 0 #define PNG_sRGB_INTENT_RELATIVE 1 #define PNG_sRGB_INTENT_SATURATION 2 #define PNG_sRGB_INTENT_ABSOLUTE 3 #define PNG_sRGB_INTENT_LAST 4 /* Not a valid value */ /* This is for text chunks */ #define PNG_KEYWORD_MAX_LENGTH 79 /* Maximum number of entries in PLTE/sPLT/tRNS arrays */ #define PNG_MAX_PALETTE_LENGTH 256 /* These determine if an ancillary chunk's data has been successfully read * from the PNG header, or if the application has filled in the corresponding * data in the info_struct to be written into the output file. The values * of the PNG_INFO_<chunk> defines should NOT be changed. */ #define PNG_INFO_gAMA 0x0001 #define PNG_INFO_sBIT 0x0002 #define PNG_INFO_cHRM 0x0004 #define PNG_INFO_PLTE 0x0008 #define PNG_INFO_tRNS 0x0010 #define PNG_INFO_bKGD 0x0020 #define PNG_INFO_hIST 0x0040 #define PNG_INFO_pHYs 0x0080 #define PNG_INFO_oFFs 0x0100 #define PNG_INFO_tIME 0x0200 #define PNG_INFO_pCAL 0x0400 #define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */ #define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */ #define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */ #define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */ #define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */ /* This is used for the transformation routines, as some of them * change these values for the row. It also should enable using * the routines for other purposes. */ typedef struct png_row_info_struct { png_uint_32 width; /* width of row */ png_size_t rowbytes; /* number of bytes in row */ png_byte color_type; /* color type of row */ png_byte bit_depth; /* bit depth of row */ png_byte channels; /* number of channels (1, 2, 3, or 4) */ png_byte pixel_depth; /* bits per pixel (depth * channels) */ } png_row_info; typedef png_row_info FAR * png_row_infop; typedef png_row_info FAR * FAR * png_row_infopp; /* The complete definition of png_struct has, as of libpng-1.5.0, * been moved into a separate header file that is not accessible to * applications. Read libpng-manual.txt or libpng.3 for more info. */ typedef struct png_struct_def png_struct; typedef PNG_CONST png_struct FAR * png_const_structp; typedef png_struct FAR * png_structp; /* These are the function types for the I/O functions and for the functions * that allow the user to override the default I/O functions with his or her * own. The png_error_ptr type should match that of user-supplied warning * and error functions, while the png_rw_ptr type should match that of the * user read/write data functions. Note that the 'write' function must not * modify the buffer it is passed. The 'read' function, on the other hand, is * expected to return the read data in the buffer. */ typedef PNG_CALLBACK(void, *png_error_ptr, (png_structp, png_const_charp)); typedef PNG_CALLBACK(void, *png_rw_ptr, (png_structp, png_bytep, png_size_t)); typedef PNG_CALLBACK(void, *png_flush_ptr, (png_structp)); typedef PNG_CALLBACK(void, *png_read_status_ptr, (png_structp, png_uint_32, int)); typedef PNG_CALLBACK(void, *png_write_status_ptr, (png_structp, png_uint_32, int)); #ifdef PNG_PROGRESSIVE_READ_SUPPORTED typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop)); typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop)); /* The following callback receives png_uint_32 row_number, int pass for the * png_bytep data of the row. When transforming an interlaced image the * row number is the row number within the sub-image of the interlace pass, so * the value will increase to the height of the sub-image (not the full image) * then reset to 0 for the next pass. * * Use PNG_ROW_FROM_PASS_ROW(row, pass) and PNG_COL_FROM_PASS_COL(col, pass) to * find the output pixel (x,y) given an interlaced sub-image pixel * (row,col,pass). (See below for these macros.) */ typedef PNG_CALLBACK(void, *png_progressive_row_ptr, (png_structp, png_bytep, png_uint_32, int)); #endif #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) typedef PNG_CALLBACK(void, *png_user_transform_ptr, (png_structp, png_row_infop, png_bytep)); #endif #ifdef PNG_USER_CHUNKS_SUPPORTED typedef PNG_CALLBACK(int, *png_user_chunk_ptr, (png_structp, png_unknown_chunkp)); #endif #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED typedef PNG_CALLBACK(void, *png_unknown_chunk_ptr, (png_structp)); #endif #ifdef PNG_SETJMP_SUPPORTED /* This must match the function definition in <setjmp.h>, and the application * must include this before png.h to obtain the definition of jmp_buf. The * function is required to be PNG_NORETURN, but this is not checked. If the * function does return the application will crash via an abort() or similar * system level call. * * If you get a warning here while building the library you may need to make * changes to ensure that pnglibconf.h records the calling convention used by * your compiler. This may be very difficult - try using a different compiler * to build the library! */ PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef); #endif /* Transform masks for the high-level interface */ #define PNG_TRANSFORM_IDENTITY 0x0000 /* read and write */ #define PNG_TRANSFORM_STRIP_16 0x0001 /* read only */ #define PNG_TRANSFORM_STRIP_ALPHA 0x0002 /* read only */ #define PNG_TRANSFORM_PACKING 0x0004 /* read and write */ #define PNG_TRANSFORM_PACKSWAP 0x0008 /* read and write */ #define PNG_TRANSFORM_EXPAND 0x0010 /* read only */ #define PNG_TRANSFORM_INVERT_MONO 0x0020 /* read and write */ #define PNG_TRANSFORM_SHIFT 0x0040 /* read and write */ #define PNG_TRANSFORM_BGR 0x0080 /* read and write */ #define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */ #define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */ #define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */ #define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* write only */ /* Added to libpng-1.2.34 */ #define PNG_TRANSFORM_STRIP_FILLER_BEFORE PNG_TRANSFORM_STRIP_FILLER #define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* write only */ /* Added to libpng-1.4.0 */ #define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */ /* Added to libpng-1.5.4 */ #define PNG_TRANSFORM_EXPAND_16 0x4000 /* read only */ #define PNG_TRANSFORM_SCALE_16 0x8000 /* read only */ /* Flags for MNG supported features */ #define PNG_FLAG_MNG_EMPTY_PLTE 0x01 #define PNG_FLAG_MNG_FILTER_64 0x04 #define PNG_ALL_MNG_FEATURES 0x05 /* NOTE: prior to 1.5 these functions had no 'API' style declaration, * this allowed the zlib default functions to be used on Windows * platforms. In 1.5 the zlib default malloc (which just calls malloc and * ignores the first argument) should be completely compatible with the * following. */ typedef PNG_CALLBACK(png_voidp, *png_malloc_ptr, (png_structp, png_alloc_size_t)); typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp)); typedef png_struct FAR * FAR * png_structpp; /* Section 3: exported functions * Here are the function definitions most commonly used. This is not * the place to find out how to use libpng. See libpng-manual.txt for the * full explanation, see example.c for the summary. This just provides * a simple one line description of the use of each function. * * The PNG_EXPORT() and PNG_EXPORTA() macros used below are defined in * pngconf.h and in the *.dfn files in the scripts directory. * * PNG_EXPORT(ordinal, type, name, (args)); * * ordinal: ordinal that is used while building * *.def files. The ordinal value is only * relevant when preprocessing png.h with * the *.dfn files for building symbol table * entries, and are removed by pngconf.h. * type: return type of the function * name: function name * args: function arguments, with types * * When we wish to append attributes to a function prototype we use * the PNG_EXPORTA() macro instead. * * PNG_EXPORTA(ordinal, type, name, (args), attributes); * * ordinal, type, name, and args: same as in PNG_EXPORT(). * attributes: function attributes */ /* Returns the version number of the library */ PNG_EXPORT(1, png_uint_32, png_access_version_number, (void)); /* Tell lib we have already handled the first <num_bytes> magic bytes. * Handling more than 8 bytes from the beginning of the file is an error. */ PNG_EXPORT(2, void, png_set_sig_bytes, (png_structp png_ptr, int num_bytes)); /* Check sig[start] through sig[start + num_to_check - 1] to see if it's a * PNG file. Returns zero if the supplied bytes match the 8-byte PNG * signature, and non-zero otherwise. Having num_to_check == 0 or * start > 7 will always fail (ie return non-zero). */ PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, png_size_t start, png_size_t num_to_check)); /* Simple signature checking function. This is the same as calling * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n). */ #define png_check_sig(sig, n) !png_sig_cmp((sig), 0, (n)) /* Allocate and initialize png_ptr struct for reading, and any other memory. */ PNG_EXPORTA(4, png_structp, png_create_read_struct, (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn), PNG_ALLOCATED); /* Allocate and initialize png_ptr struct for writing, and any other memory */ PNG_EXPORTA(5, png_structp, png_create_write_struct, (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn), PNG_ALLOCATED); PNG_EXPORT(6, png_size_t, png_get_compression_buffer_size, (png_const_structp png_ptr)); PNG_EXPORT(7, void, png_set_compression_buffer_size, (png_structp png_ptr, png_size_t size)); /* Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp * match up. */ #ifdef PNG_SETJMP_SUPPORTED /* This function returns the jmp_buf built in to *png_ptr. It must be * supplied with an appropriate 'longjmp' function to use on that jmp_buf * unless the default error function is overridden in which case NULL is * acceptable. The size of the jmp_buf is checked against the actual size * allocated by the library - the call will return NULL on a mismatch * indicating an ABI mismatch. */ PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structp png_ptr, png_longjmp_ptr longjmp_fn, size_t jmp_buf_size)); # define png_jmpbuf(png_ptr) \ (*png_set_longjmp_fn((png_ptr), longjmp, sizeof (jmp_buf))) #else # define png_jmpbuf(png_ptr) \ (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP) #endif /* This function should be used by libpng applications in place of * longjmp(png_ptr->jmpbuf, val). If longjmp_fn() has been set, it * will use it; otherwise it will call PNG_ABORT(). This function was * added in libpng-1.5.0. */ PNG_EXPORTA(9, void, png_longjmp, (png_structp png_ptr, int val), PNG_NORETURN); #ifdef PNG_READ_SUPPORTED /* Reset the compression stream */ PNG_EXPORT(10, int, png_reset_zstream, (png_structp png_ptr)); #endif /* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */ #ifdef PNG_USER_MEM_SUPPORTED PNG_EXPORTA(11, png_structp, png_create_read_struct_2, (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn), PNG_ALLOCATED); PNG_EXPORTA(12, png_structp, png_create_write_struct_2, (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn), PNG_ALLOCATED); #endif /* Write the PNG file signature. */ PNG_EXPORT(13, void, png_write_sig, (png_structp png_ptr)); /* Write a PNG chunk - size, type, (optional) data, CRC. */ PNG_EXPORT(14, void, png_write_chunk, (png_structp png_ptr, png_const_bytep chunk_name, png_const_bytep data, png_size_t length)); /* Write the start of a PNG chunk - length and chunk name. */ PNG_EXPORT(15, void, png_write_chunk_start, (png_structp png_ptr, png_const_bytep chunk_name, png_uint_32 length)); /* Write the data of a PNG chunk started with png_write_chunk_start(). */ PNG_EXPORT(16, void, png_write_chunk_data, (png_structp png_ptr, png_const_bytep data, png_size_t length)); /* Finish a chunk started with png_write_chunk_start() (includes CRC). */ PNG_EXPORT(17, void, png_write_chunk_end, (png_structp png_ptr)); /* Allocate and initialize the info structure */ PNG_EXPORTA(18, png_infop, png_create_info_struct, (png_structp png_ptr), PNG_ALLOCATED); PNG_EXPORT(19, void, png_info_init_3, (png_infopp info_ptr, png_size_t png_info_struct_size)); /* Writes all the PNG information before the image. */ PNG_EXPORT(20, void, png_write_info_before_PLTE, (png_structp png_ptr, png_infop info_ptr)); PNG_EXPORT(21, void, png_write_info, (png_structp png_ptr, png_infop info_ptr)); #ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Read the information before the actual image data. */ PNG_EXPORT(22, void, png_read_info, (png_structp png_ptr, png_infop info_ptr)); #endif #ifdef PNG_TIME_RFC1123_SUPPORTED PNG_EXPORT(23, png_const_charp, png_convert_to_rfc1123, (png_structp png_ptr, png_const_timep ptime)); #endif #ifdef PNG_CONVERT_tIME_SUPPORTED /* Convert from a struct tm to png_time */ PNG_EXPORT(24, void, png_convert_from_struct_tm, (png_timep ptime, PNG_CONST struct tm FAR * ttime)); /* Convert from time_t to png_time. Uses gmtime() */ PNG_EXPORT(25, void, png_convert_from_time_t, (png_timep ptime, time_t ttime)); #endif /* PNG_CONVERT_tIME_SUPPORTED */ #ifdef PNG_READ_EXPAND_SUPPORTED /* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */ PNG_EXPORT(26, void, png_set_expand, (png_structp png_ptr)); PNG_EXPORT(27, void, png_set_expand_gray_1_2_4_to_8, (png_structp png_ptr)); PNG_EXPORT(28, void, png_set_palette_to_rgb, (png_structp png_ptr)); PNG_EXPORT(29, void, png_set_tRNS_to_alpha, (png_structp png_ptr)); #endif #ifdef PNG_READ_EXPAND_16_SUPPORTED /* Expand to 16-bit channels, forces conversion of palette to RGB and expansion * of a tRNS chunk if present. */ PNG_EXPORT(221, void, png_set_expand_16, (png_structp png_ptr)); #endif #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) /* Use blue, green, red order for pixels. */ PNG_EXPORT(30, void, png_set_bgr, (png_structp png_ptr)); #endif #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED /* Expand the grayscale to 24-bit RGB if necessary. */ PNG_EXPORT(31, void, png_set_gray_to_rgb, (png_structp png_ptr)); #endif #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED /* Reduce RGB to grayscale. */ #define PNG_ERROR_ACTION_NONE 1 #define PNG_ERROR_ACTION_WARN 2 #define PNG_ERROR_ACTION_ERROR 3 #define PNG_RGB_TO_GRAY_DEFAULT (-1)/*for red/green coefficients*/ PNG_FP_EXPORT(32, void, png_set_rgb_to_gray, (png_structp png_ptr, int error_action, double red, double green)) PNG_FIXED_EXPORT(33, void, png_set_rgb_to_gray_fixed, (png_structp png_ptr, int error_action, png_fixed_point red, png_fixed_point green)) PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_const_structp png_ptr)); #endif #ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth, png_colorp palette)); #endif #ifdef PNG_READ_ALPHA_MODE_SUPPORTED /* How the alpha channel is interpreted - this affects how the color channels of * a PNG file are returned when an alpha channel, or tRNS chunk in a palette * file, is present. * * This has no effect on the way pixels are written into a PNG output * datastream. The color samples in a PNG datastream are never premultiplied * with the alpha samples. * * The default is to return data according to the PNG specification: the alpha * channel is a linear measure of the contribution of the pixel to the * corresponding composited pixel. The gamma encoded color channels must be * scaled according to the contribution and to do this it is necessary to undo * the encoding, scale the color values, perform the composition and reencode * the values. This is the 'PNG' mode. * * The alternative is to 'associate' the alpha with the color information by * storing color channel values that have been scaled by the alpha. The * advantage is that the color channels can be resampled (the image can be * scaled) in this form. The disadvantage is that normal practice is to store * linear, not (gamma) encoded, values and this requires 16-bit channels for * still images rather than the 8-bit channels that are just about sufficient if * gamma encoding is used. In addition all non-transparent pixel values, * including completely opaque ones, must be gamma encoded to produce the final * image. This is the 'STANDARD', 'ASSOCIATED' or 'PREMULTIPLIED' mode (the * latter being the two common names for associated alpha color channels.) * * Since it is not necessary to perform arithmetic on opaque color values so * long as they are not to be resampled and are in the final color space it is * possible to optimize the handling of alpha by storing the opaque pixels in * the PNG format (adjusted for the output color space) while storing partially * opaque pixels in the standard, linear, format. The accuracy required for * standard alpha composition is relatively low, because the pixels are * isolated, therefore typically the accuracy loss in storing 8-bit linear * values is acceptable. (This is not true if the alpha channel is used to * simulate transparency over large areas - use 16 bits or the PNG mode in * this case!) This is the 'OPTIMIZED' mode. For this mode a pixel is * treated as opaque only if the alpha value is equal to the maximum value. * * The final choice is to gamma encode the alpha channel as well. This is * broken because, in practice, no implementation that uses this choice * correctly undoes the encoding before handling alpha composition. Use this * choice only if other serious errors in the software or hardware you use * mandate it; the typical serious error is for dark halos to appear around * opaque areas of the composited PNG image because of arithmetic overflow. * * The API function png_set_alpha_mode specifies which of these choices to use * with an enumerated 'mode' value and the gamma of the required output: */ #define PNG_ALPHA_PNG 0 /* according to the PNG standard */ #define PNG_ALPHA_STANDARD 1 /* according to Porter/Duff */ #define PNG_ALPHA_ASSOCIATED 1 /* as above; this is the normal practice */ #define PNG_ALPHA_PREMULTIPLIED 1 /* as above */ #define PNG_ALPHA_OPTIMIZED 2 /* 'PNG' for opaque pixels, else 'STANDARD' */ #define PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */ PNG_FP_EXPORT(227, void, png_set_alpha_mode, (png_structp png_ptr, int mode, double output_gamma)) PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structp png_ptr, int mode, png_fixed_point output_gamma)) #endif #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED) /* The output_gamma value is a screen gamma in libpng terminology: it expresses * how to decode the output values, not how they are encoded. The values used * correspond to the normal numbers used to describe the overall gamma of a * computer display system; for example 2.2 for an sRGB conformant system. The * values are scaled by 100000 in the _fixed version of the API (so 220000 for * sRGB.) * * The inverse of the value is always used to provide a default for the PNG file * encoding if it has no gAMA chunk and if png_set_gamma() has not been called * to override the PNG gamma information. * * When the ALPHA_OPTIMIZED mode is selected the output gamma is used to encode * opaque pixels however pixels with lower alpha values are not encoded, * regardless of the output gamma setting. * * When the standard Porter Duff handling is requested with mode 1 the output * encoding is set to be linear and the output_gamma value is only relevant * as a default for input data that has no gamma information. The linear output * encoding will be overridden if png_set_gamma() is called - the results may be * highly unexpected! * * The following numbers are derived from the sRGB standard and the research * behind it. sRGB is defined to be approximated by a PNG gAMA chunk value of * 0.45455 (1/2.2) for PNG. The value implicitly includes any viewing * correction required to take account of any differences in the color * environment of the original scene and the intended display environment; the * value expresses how to *decode* the image for display, not how the original * data was *encoded*. * * sRGB provides a peg for the PNG standard by defining a viewing environment. * sRGB itself, and earlier TV standards, actually use a more complex transform * (a linear portion then a gamma 2.4 power law) than PNG can express. (PNG is * limited to simple power laws.) By saying that an image for direct display on * an sRGB conformant system should be stored with a gAMA chunk value of 45455 * (11.3.3.2 and 11.3.3.5 of the ISO PNG specification) the PNG specification * makes it possible to derive values for other display systems and * environments. * * The Mac value is deduced from the sRGB based on an assumption that the actual * extra viewing correction used in early Mac display systems was implemented as * a power 1.45 lookup table. * * Any system where a programmable lookup table is used or where the behavior of * the final display device characteristics can be changed requires system * specific code to obtain the current characteristic. However this can be * difficult and most PNG gamma correction only requires an approximate value. * * By default, if png_set_alpha_mode() is not called, libpng assumes that all * values are unencoded, linear, values and that the output device also has a * linear characteristic. This is only very rarely correct - it is invariably * better to call png_set_alpha_mode() with PNG_DEFAULT_sRGB than rely on the * default if you don't know what the right answer is! * * The special value PNG_GAMMA_MAC_18 indicates an older Mac system (pre Mac OS * 10.6) which used a correction table to implement a somewhat lower gamma on an * otherwise sRGB system. * * Both these values are reserved (not simple gamma values) in order to allow * more precise correction internally in the future. * * NOTE: the following values can be passed to either the fixed or floating * point APIs, but the floating point API will also accept floating point * values. */ #define PNG_DEFAULT_sRGB -1 /* sRGB gamma and color space */ #define PNG_GAMMA_MAC_18 -2 /* Old Mac '1.8' gamma and color space */ #define PNG_GAMMA_sRGB 220000 /* Television standards--matches sRGB gamma */ #define PNG_GAMMA_LINEAR PNG_FP_1 /* Linear */ #endif /* The following are examples of calls to png_set_alpha_mode to achieve the * required overall gamma correction and, where necessary, alpha * premultiplication. * * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB); * This is the default libpng handling of the alpha channel - it is not * pre-multiplied into the color components. In addition the call states * that the output is for a sRGB system and causes all PNG files without gAMA * chunks to be assumed to be encoded using sRGB. * * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC); * In this case the output is assumed to be something like an sRGB conformant * display preceeded by a power-law lookup table of power 1.45. This is how * early Mac systems behaved. * * png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_GAMMA_LINEAR); * This is the classic Jim Blinn approach and will work in academic * environments where everything is done by the book. It has the shortcoming * of assuming that input PNG data with no gamma information is linear - this * is unlikely to be correct unless the PNG files where generated locally. * Most of the time the output precision will be so low as to show * significant banding in dark areas of the image. * * png_set_expand_16(pp); * png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_DEFAULT_sRGB); * This is a somewhat more realistic Jim Blinn inspired approach. PNG files * are assumed to have the sRGB encoding if not marked with a gamma value and * the output is always 16 bits per component. This permits accurate scaling * and processing of the data. If you know that your input PNG files were * generated locally you might need to replace PNG_DEFAULT_sRGB with the * correct value for your system. * * png_set_alpha_mode(pp, PNG_ALPHA_OPTIMIZED, PNG_DEFAULT_sRGB); * If you just need to composite the PNG image onto an existing background * and if you control the code that does this you can use the optimization * setting. In this case you just copy completely opaque pixels to the * output. For pixels that are not completely transparent (you just skip * those) you do the composition math using png_composite or png_composite_16 * below then encode the resultant 8-bit or 16-bit values to match the output * encoding. * * Other cases * If neither the PNG nor the standard linear encoding work for you because * of the software or hardware you use then you have a big problem. The PNG * case will probably result in halos around the image. The linear encoding * will probably result in a washed out, too bright, image (it's actually too * contrasty.) Try the ALPHA_OPTIMIZED mode above - this will probably * substantially reduce the halos. Alternatively try: * * png_set_alpha_mode(pp, PNG_ALPHA_BROKEN, PNG_DEFAULT_sRGB); * This option will also reduce the halos, but there will be slight dark * halos round the opaque parts of the image where the background is light. * In the OPTIMIZED mode the halos will be light halos where the background * is dark. Take your pick - the halos are unavoidable unless you can get * your hardware/software fixed! (The OPTIMIZED approach is slightly * faster.) * * When the default gamma of PNG files doesn't match the output gamma. * If you have PNG files with no gamma information png_set_alpha_mode allows * you to provide a default gamma, but it also sets the ouput gamma to the * matching value. If you know your PNG files have a gamma that doesn't * match the output you can take advantage of the fact that * png_set_alpha_mode always sets the output gamma but only sets the PNG * default if it is not already set: * * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB); * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC); * The first call sets both the default and the output gamma values, the * second call overrides the output gamma without changing the default. This * is easier than achieving the same effect with png_set_gamma. You must use * PNG_ALPHA_PNG for the first call - internal checking in png_set_alpha will * fire if more than one call to png_set_alpha_mode and png_set_background is * made in the same read operation, however multiple calls with PNG_ALPHA_PNG * are ignored. */ #ifdef PNG_READ_STRIP_ALPHA_SUPPORTED PNG_EXPORT(36, void, png_set_strip_alpha, (png_structp png_ptr)); #endif #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \ defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) PNG_EXPORT(37, void, png_set_swap_alpha, (png_structp png_ptr)); #endif #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \ defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) PNG_EXPORT(38, void, png_set_invert_alpha, (png_structp png_ptr)); #endif #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) /* Add a filler byte to 8-bit Gray or 24-bit RGB images. */ PNG_EXPORT(39, void, png_set_filler, (png_structp png_ptr, png_uint_32 filler, int flags)); /* The values of the PNG_FILLER_ defines should NOT be changed */ # define PNG_FILLER_BEFORE 0 # define PNG_FILLER_AFTER 1 /* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */ PNG_EXPORT(40, void, png_set_add_alpha, (png_structp png_ptr, png_uint_32 filler, int flags)); #endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */ #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) /* Swap bytes in 16-bit depth files. */ PNG_EXPORT(41, void, png_set_swap, (png_structp png_ptr)); #endif #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) /* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */ PNG_EXPORT(42, void, png_set_packing, (png_structp png_ptr)); #endif #if defined(PNG_READ_PACKSWAP_SUPPORTED) || \ defined(PNG_WRITE_PACKSWAP_SUPPORTED) /* Swap packing order of pixels in bytes. */ PNG_EXPORT(43, void, png_set_packswap, (png_structp png_ptr)); #endif #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) /* Converts files to legal bit depths. */ PNG_EXPORT(44, void, png_set_shift, (png_structp png_ptr, png_const_color_8p true_bits)); #endif #if defined(PNG_READ_INTERLACING_SUPPORTED) || \ defined(PNG_WRITE_INTERLACING_SUPPORTED) /* Have the code handle the interlacing. Returns the number of passes. * MUST be called before png_read_update_info or png_start_read_image, * otherwise it will not have the desired effect. Note that it is still * necessary to call png_read_row or png_read_rows png_get_image_height * times for each pass. */ PNG_EXPORT(45, int, png_set_interlace_handling, (png_structp png_ptr)); #endif #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) /* Invert monochrome files */ PNG_EXPORT(46, void, png_set_invert_mono, (png_structp png_ptr)); #endif #ifdef PNG_READ_BACKGROUND_SUPPORTED /* Handle alpha and tRNS by replacing with a background color. Prior to * libpng-1.5.4 this API must not be called before the PNG file header has been * read. Doing so will result in unexpected behavior and possible warnings or * errors if the PNG file contains a bKGD chunk. */ PNG_FP_EXPORT(47, void, png_set_background, (png_structp png_ptr, png_const_color_16p background_color, int background_gamma_code, int need_expand, double background_gamma)) PNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structp png_ptr, png_const_color_16p background_color, int background_gamma_code, int need_expand, png_fixed_point background_gamma)) #endif #ifdef PNG_READ_BACKGROUND_SUPPORTED # define PNG_BACKGROUND_GAMMA_UNKNOWN 0 # define PNG_BACKGROUND_GAMMA_SCREEN 1 # define PNG_BACKGROUND_GAMMA_FILE 2 # define PNG_BACKGROUND_GAMMA_UNIQUE 3 #endif #ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED /* Scale a 16-bit depth file down to 8-bit, accurately. */ PNG_EXPORT(229, void, png_set_scale_16, (png_structp png_ptr)); #endif #ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED #define PNG_READ_16_TO_8 SUPPORTED /* Name prior to 1.5.4 */ /* Strip the second byte of information from a 16-bit depth file. */ PNG_EXPORT(48, void, png_set_strip_16, (png_structp png_ptr)); #endif #ifdef PNG_READ_QUANTIZE_SUPPORTED /* Turn on quantizing, and reduce the palette to the number of colors * available. */ PNG_EXPORT(49, void, png_set_quantize, (png_structp png_ptr, png_colorp palette, int num_palette, int maximum_colors, png_const_uint_16p histogram, int full_quantize)); #endif #ifdef PNG_READ_GAMMA_SUPPORTED /* The threshold on gamma processing is configurable but hard-wired into the * library. The following is the floating point variant. */ #define PNG_GAMMA_THRESHOLD (PNG_GAMMA_THRESHOLD_FIXED*.00001) /* Handle gamma correction. Screen_gamma=(display_exponent). * NOTE: this API simply sets the screen and file gamma values. It will * therefore override the value for gamma in a PNG file if it is called after * the file header has been read - use with care - call before reading the PNG * file for best results! * * These routines accept the same gamma values as png_set_alpha_mode (described * above). The PNG_GAMMA_ defines and PNG_DEFAULT_sRGB can be passed to either * API (floating point or fixed.) Notice, however, that the 'file_gamma' value * is the inverse of a 'screen gamma' value. */ PNG_FP_EXPORT(50, void, png_set_gamma, (png_structp png_ptr, double screen_gamma, double override_file_gamma)) PNG_FIXED_EXPORT(208, void, png_set_gamma_fixed, (png_structp png_ptr, png_fixed_point screen_gamma, png_fixed_point override_file_gamma)) #endif #ifdef PNG_WRITE_FLUSH_SUPPORTED /* Set how many lines between output flushes - 0 for no flushing */ PNG_EXPORT(51, void, png_set_flush, (png_structp png_ptr, int nrows)); /* Flush the current PNG output buffer */ PNG_EXPORT(52, void, png_write_flush, (png_structp png_ptr)); #endif /* Optional update palette with requested transformations */ PNG_EXPORT(53, void, png_start_read_image, (png_structp png_ptr)); /* Optional call to update the users info structure */ PNG_EXPORT(54, void, png_read_update_info, (png_structp png_ptr, png_infop info_ptr)); #ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Read one or more rows of image data. */ PNG_EXPORT(55, void, png_read_rows, (png_structp png_ptr, png_bytepp row, png_bytepp display_row, png_uint_32 num_rows)); #endif #ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Read a row of data. */ PNG_EXPORT(56, void, png_read_row, (png_structp png_ptr, png_bytep row, png_bytep display_row)); #endif #ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Read the whole image into memory at once. */ PNG_EXPORT(57, void, png_read_image, (png_structp png_ptr, png_bytepp image)); #endif /* Write a row of image data */ PNG_EXPORT(58, void, png_write_row, (png_structp png_ptr, png_const_bytep row)); /* Write a few rows of image data: (*row) is not written; however, the type * is declared as writeable to maintain compatibility with previous versions * of libpng and to allow the 'display_row' array from read_rows to be passed * unchanged to write_rows. */ PNG_EXPORT(59, void, png_write_rows, (png_structp png_ptr, png_bytepp row, png_uint_32 num_rows)); /* Write the image data */ PNG_EXPORT(60, void, png_write_image, (png_structp png_ptr, png_bytepp image)); /* Write the end of the PNG file. */ PNG_EXPORT(61, void, png_write_end, (png_structp png_ptr, png_infop info_ptr)); #ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Read the end of the PNG file. */ PNG_EXPORT(62, void, png_read_end, (png_structp png_ptr, png_infop info_ptr)); #endif /* Free any memory associated with the png_info_struct */ PNG_EXPORT(63, void, png_destroy_info_struct, (png_structp png_ptr, png_infopp info_ptr_ptr)); /* Free any memory associated with the png_struct and the png_info_structs */ PNG_EXPORT(64, void, png_destroy_read_struct, (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)); /* Free any memory associated with the png_struct and the png_info_structs */ PNG_EXPORT(65, void, png_destroy_write_struct, (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)); /* Set the libpng method of handling chunk CRC errors */ PNG_EXPORT(66, void, png_set_crc_action, (png_structp png_ptr, int crit_action, int ancil_action)); /* Values for png_set_crc_action() say how to handle CRC errors in * ancillary and critical chunks, and whether to use the data contained * therein. Note that it is impossible to "discard" data in a critical * chunk. For versions prior to 0.90, the action was always error/quit, * whereas in version 0.90 and later, the action for CRC errors in ancillary * chunks is warn/discard. These values should NOT be changed. * * value action:critical action:ancillary */ #define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */ #define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */ #define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */ #define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */ #define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */ #define PNG_CRC_NO_CHANGE 5 /* use current value use current value */ /* These functions give the user control over the scan-line filtering in * libpng and the compression methods used by zlib. These functions are * mainly useful for testing, as the defaults should work with most users. * Those users who are tight on memory or want faster performance at the * expense of compression can modify them. See the compression library * header file (zlib.h) for an explination of the compression functions. */ /* Set the filtering method(s) used by libpng. Currently, the only valid * value for "method" is 0. */ PNG_EXPORT(67, void, png_set_filter, (png_structp png_ptr, int method, int filters)); /* Flags for png_set_filter() to say which filters to use. The flags * are chosen so that they don't conflict with real filter types * below, in case they are supplied instead of the #defined constants. * These values should NOT be changed. */ #define PNG_NO_FILTERS 0x00 #define PNG_FILTER_NONE 0x08 #define PNG_FILTER_SUB 0x10 #define PNG_FILTER_UP 0x20 #define PNG_FILTER_AVG 0x40 #define PNG_FILTER_PAETH 0x80 #define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \ PNG_FILTER_AVG | PNG_FILTER_PAETH) /* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now. * These defines should NOT be changed. */ #define PNG_FILTER_VALUE_NONE 0 #define PNG_FILTER_VALUE_SUB 1 #define PNG_FILTER_VALUE_UP 2 #define PNG_FILTER_VALUE_AVG 3 #define PNG_FILTER_VALUE_PAETH 4 #define PNG_FILTER_VALUE_LAST 5 #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* EXPERIMENTAL */ /* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_ * defines, either the default (minimum-sum-of-absolute-differences), or * the experimental method (weighted-minimum-sum-of-absolute-differences). * * Weights are factors >= 1.0, indicating how important it is to keep the * filter type consistent between rows. Larger numbers mean the current * filter is that many times as likely to be the same as the "num_weights" * previous filters. This is cumulative for each previous row with a weight. * There needs to be "num_weights" values in "filter_weights", or it can be * NULL if the weights aren't being specified. Weights have no influence on * the selection of the first row filter. Well chosen weights can (in theory) * improve the compression for a given image. * * Costs are factors >= 1.0 indicating the relative decoding costs of a * filter type. Higher costs indicate more decoding expense, and are * therefore less likely to be selected over a filter with lower computational * costs. There needs to be a value in "filter_costs" for each valid filter * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't * setting the costs. Costs try to improve the speed of decompression without * unduly increasing the compressed image size. * * A negative weight or cost indicates the default value is to be used, and * values in the range [0.0, 1.0) indicate the value is to remain unchanged. * The default values for both weights and costs are currently 1.0, but may * change if good general weighting/cost heuristics can be found. If both * the weights and costs are set to 1.0, this degenerates the WEIGHTED method * to the UNWEIGHTED method, but with added encoding time/computation. */ PNG_FP_EXPORT(68, void, png_set_filter_heuristics, (png_structp png_ptr, int heuristic_method, int num_weights, png_const_doublep filter_weights, png_const_doublep filter_costs)) PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed, (png_structp png_ptr, int heuristic_method, int num_weights, png_const_fixed_point_p filter_weights, png_const_fixed_point_p filter_costs)) #endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ /* Heuristic used for row filter selection. These defines should NOT be * changed. */ #define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */ #define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */ #define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */ #define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */ #ifdef PNG_WRITE_SUPPORTED /* Set the library compression level. Currently, valid values range from * 0 - 9, corresponding directly to the zlib compression levels 0 - 9 * (0 - no compression, 9 - "maximal" compression). Note that tests have * shown that zlib compression levels 3-6 usually perform as well as level 9 * for PNG images, and do considerably fewer caclulations. In the future, * these values may not correspond directly to the zlib compression levels. */ PNG_EXPORT(69, void, png_set_compression_level, (png_structp png_ptr, int level)); PNG_EXPORT(70, void, png_set_compression_mem_level, (png_structp png_ptr, int mem_level)); PNG_EXPORT(71, void, png_set_compression_strategy, (png_structp png_ptr, int strategy)); /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a * smaller value of window_bits if it can do so safely. */ PNG_EXPORT(72, void, png_set_compression_window_bits, (png_structp png_ptr, int window_bits)); PNG_EXPORT(73, void, png_set_compression_method, (png_structp png_ptr, int method)); #endif #ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED /* Also set zlib parameters for compressing non-IDAT chunks */ PNG_EXPORT(222, void, png_set_text_compression_level, (png_structp png_ptr, int level)); PNG_EXPORT(223, void, png_set_text_compression_mem_level, (png_structp png_ptr, int mem_level)); PNG_EXPORT(224, void, png_set_text_compression_strategy, (png_structp png_ptr, int strategy)); /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a * smaller value of window_bits if it can do so safely. */ PNG_EXPORT(225, void, png_set_text_compression_window_bits, (png_structp png_ptr, int window_bits)); PNG_EXPORT(226, void, png_set_text_compression_method, (png_structp png_ptr, int method)); #endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED */ /* These next functions are called for input/output, memory, and error * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c, * and call standard C I/O routines such as fread(), fwrite(), and * fprintf(). These functions can be made to use other I/O routines * at run time for those applications that need to handle I/O in a * different manner by calling png_set_???_fn(). See libpng-manual.txt for * more information. */ #ifdef PNG_STDIO_SUPPORTED /* Initialize the input/output for the PNG file to the default functions. */ PNG_EXPORT(74, void, png_init_io, (png_structp png_ptr, png_FILE_p fp)); #endif /* Replace the (error and abort), and warning functions with user * supplied functions. If no messages are to be printed you must still * write and use replacement functions. The replacement error_fn should * still do a longjmp to the last setjmp location if you are using this * method of error handling. If error_fn or warning_fn is NULL, the * default function will be used. */ PNG_EXPORT(75, void, png_set_error_fn, (png_structp png_ptr, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn)); /* Return the user pointer associated with the error functions */ PNG_EXPORT(76, png_voidp, png_get_error_ptr, (png_const_structp png_ptr)); /* Replace the default data output functions with a user supplied one(s). * If buffered output is not used, then output_flush_fn can be set to NULL. * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time * output_flush_fn will be ignored (and thus can be NULL). * It is probably a mistake to use NULL for output_flush_fn if * write_data_fn is not also NULL unless you have built libpng with * PNG_WRITE_FLUSH_SUPPORTED undefined, because in this case libpng's * default flush function, which uses the standard *FILE structure, will * be used. */ PNG_EXPORT(77, void, png_set_write_fn, (png_structp png_ptr, png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)); /* Replace the default data input function with a user supplied one. */ PNG_EXPORT(78, void, png_set_read_fn, (png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn)); /* Return the user pointer associated with the I/O functions */ PNG_EXPORT(79, png_voidp, png_get_io_ptr, (png_structp png_ptr)); PNG_EXPORT(80, void, png_set_read_status_fn, (png_structp png_ptr, png_read_status_ptr read_row_fn)); PNG_EXPORT(81, void, png_set_write_status_fn, (png_structp png_ptr, png_write_status_ptr write_row_fn)); #ifdef PNG_USER_MEM_SUPPORTED /* Replace the default memory allocation functions with user supplied one(s). */ PNG_EXPORT(82, void, png_set_mem_fn, (png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn)); /* Return the user pointer associated with the memory functions */ PNG_EXPORT(83, png_voidp, png_get_mem_ptr, (png_const_structp png_ptr)); #endif #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED PNG_EXPORT(84, void, png_set_read_user_transform_fn, (png_structp png_ptr, png_user_transform_ptr read_user_transform_fn)); #endif #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED PNG_EXPORT(85, void, png_set_write_user_transform_fn, (png_structp png_ptr, png_user_transform_ptr write_user_transform_fn)); #endif #ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED PNG_EXPORT(86, void, png_set_user_transform_info, (png_structp png_ptr, png_voidp user_transform_ptr, int user_transform_depth, int user_transform_channels)); /* Return the user pointer associated with the user transform functions */ PNG_EXPORT(87, png_voidp, png_get_user_transform_ptr, (png_const_structp png_ptr)); #endif #ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED /* Return information about the row currently being processed. Note that these * APIs do not fail but will return unexpected results if called outside a user * transform callback. Also note that when transforming an interlaced image the * row number is the row number within the sub-image of the interlace pass, so * the value will increase to the height of the sub-image (not the full image) * then reset to 0 for the next pass. * * Use PNG_ROW_FROM_PASS_ROW(row, pass) and PNG_COL_FROM_PASS_COL(col, pass) to * find the output pixel (x,y) given an interlaced sub-image pixel * (row,col,pass). (See below for these macros.) */ PNG_EXPORT(217, png_uint_32, png_get_current_row_number, (png_const_structp)); PNG_EXPORT(218, png_byte, png_get_current_pass_number, (png_const_structp)); #endif #ifdef PNG_USER_CHUNKS_SUPPORTED PNG_EXPORT(88, void, png_set_read_user_chunk_fn, (png_structp png_ptr, png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn)); PNG_EXPORT(89, png_voidp, png_get_user_chunk_ptr, (png_const_structp png_ptr)); #endif #ifdef PNG_PROGRESSIVE_READ_SUPPORTED /* Sets the function callbacks for the push reader, and a pointer to a * user-defined structure available to the callback functions. */ PNG_EXPORT(90, void, png_set_progressive_read_fn, (png_structp png_ptr, png_voidp progressive_ptr, png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn)); /* Returns the user pointer associated with the push read functions */ PNG_EXPORT(91, png_voidp, png_get_progressive_ptr, (png_const_structp png_ptr)); /* Function to be called when data becomes available */ PNG_EXPORT(92, void, png_process_data, (png_structp png_ptr, png_infop info_ptr, png_bytep buffer, png_size_t buffer_size)); /* A function which may be called *only* within png_process_data to stop the * processing of any more data. The function returns the number of bytes * remaining, excluding any that libpng has cached internally. A subsequent * call to png_process_data must supply these bytes again. If the argument * 'save' is set to true the routine will first save all the pending data and * will always return 0. */ PNG_EXPORT(219, png_size_t, png_process_data_pause, (png_structp, int save)); /* A function which may be called *only* outside (after) a call to * png_process_data. It returns the number of bytes of data to skip in the * input. Normally it will return 0, but if it returns a non-zero value the * application must skip than number of bytes of input data and pass the * following data to the next call to png_process_data. */ PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structp)); #ifdef PNG_READ_INTERLACING_SUPPORTED /* Function that combines rows. 'new_row' is a flag that should come from * the callback and be non-NULL if anything needs to be done; the library * stores its own version of the new data internally and ignores the passed * in value. */ PNG_EXPORT(93, void, png_progressive_combine_row, (png_structp png_ptr, png_bytep old_row, png_const_bytep new_row)); #endif /* PNG_READ_INTERLACING_SUPPORTED */ #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ PNG_EXPORTA(94, png_voidp, png_malloc, (png_structp png_ptr, png_alloc_size_t size), PNG_ALLOCATED); /* Added at libpng version 1.4.0 */ PNG_EXPORTA(95, png_voidp, png_calloc, (png_structp png_ptr, png_alloc_size_t size), PNG_ALLOCATED); /* Added at libpng version 1.2.4 */ PNG_EXPORTA(96, png_voidp, png_malloc_warn, (png_structp png_ptr, png_alloc_size_t size), PNG_ALLOCATED); /* Frees a pointer allocated by png_malloc() */ PNG_EXPORT(97, void, png_free, (png_structp png_ptr, png_voidp ptr)); /* Free data that was allocated internally */ PNG_EXPORT(98, void, png_free_data, (png_structp png_ptr, png_infop info_ptr, png_uint_32 free_me, int num)); /* Reassign responsibility for freeing existing data, whether allocated * by libpng or by the application */ PNG_EXPORT(99, void, png_data_freer, (png_structp png_ptr, png_infop info_ptr, int freer, png_uint_32 mask)); /* Assignments for png_data_freer */ #define PNG_DESTROY_WILL_FREE_DATA 1 #define PNG_SET_WILL_FREE_DATA 1 #define PNG_USER_WILL_FREE_DATA 2 /* Flags for png_ptr->free_me and info_ptr->free_me */ #define PNG_FREE_HIST 0x0008 #define PNG_FREE_ICCP 0x0010 #define PNG_FREE_SPLT 0x0020 #define PNG_FREE_ROWS 0x0040 #define PNG_FREE_PCAL 0x0080 #define PNG_FREE_SCAL 0x0100 #define PNG_FREE_UNKN 0x0200 #define PNG_FREE_LIST 0x0400 #define PNG_FREE_PLTE 0x1000 #define PNG_FREE_TRNS 0x2000 #define PNG_FREE_TEXT 0x4000 #define PNG_FREE_ALL 0x7fff #define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */ #ifdef PNG_USER_MEM_SUPPORTED PNG_EXPORTA(100, png_voidp, png_malloc_default, (png_structp png_ptr, png_alloc_size_t size), PNG_ALLOCATED); PNG_EXPORT(101, void, png_free_default, (png_structp png_ptr, png_voidp ptr)); #endif #ifdef PNG_ERROR_TEXT_SUPPORTED /* Fatal error in PNG image of libpng - can't continue */ PNG_EXPORTA(102, void, png_error, (png_structp png_ptr, png_const_charp error_message), PNG_NORETURN); /* The same, but the chunk name is prepended to the error string. */ PNG_EXPORTA(103, void, png_chunk_error, (png_structp png_ptr, png_const_charp error_message), PNG_NORETURN); #else /* Fatal error in PNG image of libpng - can't continue */ PNG_EXPORTA(104, void, png_err, (png_structp png_ptr), PNG_NORETURN); #endif #ifdef PNG_WARNINGS_SUPPORTED /* Non-fatal error in libpng. Can continue, but may have a problem. */ PNG_EXPORT(105, void, png_warning, (png_structp png_ptr, png_const_charp warning_message)); /* Non-fatal error in libpng, chunk name is prepended to message. */ PNG_EXPORT(106, void, png_chunk_warning, (png_structp png_ptr, png_const_charp warning_message)); #endif #ifdef PNG_BENIGN_ERRORS_SUPPORTED /* Benign error in libpng. Can continue, but may have a problem. * User can choose whether to handle as a fatal error or as a warning. */ # undef png_benign_error PNG_EXPORT(107, void, png_benign_error, (png_structp png_ptr, png_const_charp warning_message)); /* Same, chunk name is prepended to message. */ # undef png_chunk_benign_error PNG_EXPORT(108, void, png_chunk_benign_error, (png_structp png_ptr, png_const_charp warning_message)); PNG_EXPORT(109, void, png_set_benign_errors, (png_structp png_ptr, int allowed)); #else # ifdef PNG_ALLOW_BENIGN_ERRORS # define png_benign_error png_warning # define png_chunk_benign_error png_chunk_warning # else # define png_benign_error png_error # define png_chunk_benign_error png_chunk_error # endif #endif /* The png_set_<chunk> functions are for storing values in the png_info_struct. * Similarly, the png_get_<chunk> calls are used to read values from the * png_info_struct, either storing the parameters in the passed variables, or * setting pointers into the png_info_struct where the data is stored. The * png_get_<chunk> functions return a non-zero value if the data was available * in info_ptr, or return zero and do not change any of the parameters if the * data was not available. * * These functions should be used instead of directly accessing png_info * to avoid problems with future changes in the size and internal layout of * png_info_struct. */ /* Returns "flag" if chunk data is valid in info_ptr. */ PNG_EXPORT(110, png_uint_32, png_get_valid, (png_const_structp png_ptr, png_const_infop info_ptr, png_uint_32 flag)); /* Returns number of bytes needed to hold a transformed row. */ PNG_EXPORT(111, png_size_t, png_get_rowbytes, (png_const_structp png_ptr, png_const_infop info_ptr)); #ifdef PNG_INFO_IMAGE_SUPPORTED /* Returns row_pointers, which is an array of pointers to scanlines that was * returned from png_read_png(). */ PNG_EXPORT(112, png_bytepp, png_get_rows, (png_const_structp png_ptr, png_const_infop info_ptr)); /* Set row_pointers, which is an array of pointers to scanlines for use * by png_write_png(). */ PNG_EXPORT(113, void, png_set_rows, (png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)); #endif /* Returns number of color channels in image. */ PNG_EXPORT(114, png_byte, png_get_channels, (png_const_structp png_ptr, png_const_infop info_ptr)); #ifdef PNG_EASY_ACCESS_SUPPORTED /* Returns image width in pixels. */ PNG_EXPORT(115, png_uint_32, png_get_image_width, (png_const_structp png_ptr, png_const_infop info_ptr)); /* Returns image height in pixels. */ PNG_EXPORT(116, png_uint_32, png_get_image_height, (png_const_structp png_ptr, png_const_infop info_ptr)); /* Returns image bit_depth. */ PNG_EXPORT(117, png_byte, png_get_bit_depth, (png_const_structp png_ptr, png_const_infop info_ptr)); /* Returns image color_type. */ PNG_EXPORT(118, png_byte, png_get_color_type, (png_const_structp png_ptr, png_const_infop info_ptr)); /* Returns image filter_type. */ PNG_EXPORT(119, png_byte, png_get_filter_type, (png_const_structp png_ptr, png_const_infop info_ptr)); /* Returns image interlace_type. */ PNG_EXPORT(120, png_byte, png_get_interlace_type, (png_const_structp png_ptr, png_const_infop info_ptr)); /* Returns image compression_type. */ PNG_EXPORT(121, png_byte, png_get_compression_type, (png_const_structp png_ptr, png_const_infop info_ptr)); /* Returns image resolution in pixels per meter, from pHYs chunk data. */ PNG_EXPORT(122, png_uint_32, png_get_pixels_per_meter, (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_EXPORT(123, png_uint_32, png_get_x_pixels_per_meter, (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_EXPORT(124, png_uint_32, png_get_y_pixels_per_meter, (png_const_structp png_ptr, png_const_infop info_ptr)); /* Returns pixel aspect ratio, computed from pHYs chunk data. */ PNG_FP_EXPORT(125, float, png_get_pixel_aspect_ratio, (png_const_structp png_ptr, png_const_infop info_ptr)) PNG_FIXED_EXPORT(210, png_fixed_point, png_get_pixel_aspect_ratio_fixed, (png_const_structp png_ptr, png_const_infop info_ptr)) /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ PNG_EXPORT(126, png_int_32, png_get_x_offset_pixels, (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_EXPORT(127, png_int_32, png_get_y_offset_pixels, (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_EXPORT(128, png_int_32, png_get_x_offset_microns, (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_EXPORT(129, png_int_32, png_get_y_offset_microns, (png_const_structp png_ptr, png_const_infop info_ptr)); #endif /* PNG_EASY_ACCESS_SUPPORTED */ /* Returns pointer to signature string read from PNG header */ PNG_EXPORT(130, png_const_bytep, png_get_signature, (png_const_structp png_ptr, png_infop info_ptr)); #ifdef PNG_bKGD_SUPPORTED PNG_EXPORT(131, png_uint_32, png_get_bKGD, (png_const_structp png_ptr, png_infop info_ptr, png_color_16p *background)); #endif #ifdef PNG_bKGD_SUPPORTED PNG_EXPORT(132, void, png_set_bKGD, (png_structp png_ptr, png_infop info_ptr, png_const_color_16p background)); #endif #ifdef PNG_cHRM_SUPPORTED PNG_FP_EXPORT(133, png_uint_32, png_get_cHRM, (png_const_structp png_ptr, png_const_infop info_ptr, double *white_x, double *white_y, double *red_x, double *red_y, double *green_x, double *green_y, double *blue_x, double *blue_y)) PNG_FP_EXPORT(230, png_uint_32, png_get_cHRM_XYZ, (png_structp png_ptr, png_const_infop info_ptr, double *red_X, double *red_Y, double *red_Z, double *green_X, double *green_Y, double *green_Z, double *blue_X, double *blue_Y, double *blue_Z)) #ifdef PNG_FIXED_POINT_SUPPORTED /* Otherwise not implemented */ PNG_FIXED_EXPORT(134, png_uint_32, png_get_cHRM_fixed, (png_const_structp png_ptr, png_const_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point *int_blue_x, png_fixed_point *int_blue_y)) #endif PNG_FIXED_EXPORT(231, png_uint_32, png_get_cHRM_XYZ_fixed, (png_structp png_ptr, png_const_infop info_ptr, png_fixed_point *int_red_X, png_fixed_point *int_red_Y, png_fixed_point *int_red_Z, png_fixed_point *int_green_X, png_fixed_point *int_green_Y, png_fixed_point *int_green_Z, png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y, png_fixed_point *int_blue_Z)) #endif #ifdef PNG_cHRM_SUPPORTED PNG_FP_EXPORT(135, void, png_set_cHRM, (png_structp png_ptr, png_infop info_ptr, double white_x, double white_y, double red_x, double red_y, double green_x, double green_y, double blue_x, double blue_y)) PNG_FP_EXPORT(232, void, png_set_cHRM_XYZ, (png_structp png_ptr, png_infop info_ptr, double red_X, double red_Y, double red_Z, double green_X, double green_Y, double green_Z, double blue_X, double blue_Y, double blue_Z)) PNG_FIXED_EXPORT(136, void, png_set_cHRM_fixed, (png_structp png_ptr, png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y, png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, png_fixed_point int_blue_y)) PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_structp png_ptr, png_infop info_ptr, png_fixed_point int_red_X, png_fixed_point int_red_Y, png_fixed_point int_red_Z, png_fixed_point int_green_X, png_fixed_point int_green_Y, png_fixed_point int_green_Z, png_fixed_point int_blue_X, png_fixed_point int_blue_Y, png_fixed_point int_blue_Z)) #endif #ifdef PNG_gAMA_SUPPORTED PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structp png_ptr, png_const_infop info_ptr, double *file_gamma)) PNG_FIXED_EXPORT(138, png_uint_32, png_get_gAMA_fixed, (png_const_structp png_ptr, png_const_infop info_ptr, png_fixed_point *int_file_gamma)) #endif #ifdef PNG_gAMA_SUPPORTED PNG_FP_EXPORT(139, void, png_set_gAMA, (png_structp png_ptr, png_infop info_ptr, double file_gamma)) PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_structp png_ptr, png_infop info_ptr, png_fixed_point int_file_gamma)) #endif #ifdef PNG_hIST_SUPPORTED PNG_EXPORT(141, png_uint_32, png_get_hIST, (png_const_structp png_ptr, png_const_infop info_ptr, png_uint_16p *hist)); #endif #ifdef PNG_hIST_SUPPORTED PNG_EXPORT(142, void, png_set_hIST, (png_structp png_ptr, png_infop info_ptr, png_const_uint_16p hist)); #endif PNG_EXPORT(143, png_uint_32, png_get_IHDR, (png_structp png_ptr, png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type, int *interlace_method, int *compression_method, int *filter_method)); PNG_EXPORT(144, void, png_set_IHDR, (png_structp png_ptr, png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, int color_type, int interlace_method, int compression_method, int filter_method)); #ifdef PNG_oFFs_SUPPORTED PNG_EXPORT(145, png_uint_32, png_get_oFFs, (png_const_structp png_ptr, png_const_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)); #endif #ifdef PNG_oFFs_SUPPORTED PNG_EXPORT(146, void, png_set_oFFs, (png_structp png_ptr, png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y, int unit_type)); #endif #ifdef PNG_pCAL_SUPPORTED PNG_EXPORT(147, png_uint_32, png_get_pCAL, (png_const_structp png_ptr, png_const_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams, png_charp *units, png_charpp *params)); #endif #ifdef PNG_pCAL_SUPPORTED PNG_EXPORT(148, void, png_set_pCAL, (png_structp png_ptr, png_infop info_ptr, png_const_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams, png_const_charp units, png_charpp params)); #endif #ifdef PNG_pHYs_SUPPORTED PNG_EXPORT(149, png_uint_32, png_get_pHYs, (png_const_structp png_ptr, png_const_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); #endif #ifdef PNG_pHYs_SUPPORTED PNG_EXPORT(150, void, png_set_pHYs, (png_structp png_ptr, png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type)); #endif PNG_EXPORT(151, png_uint_32, png_get_PLTE, (png_const_structp png_ptr, png_const_infop info_ptr, png_colorp *palette, int *num_palette)); PNG_EXPORT(152, void, png_set_PLTE, (png_structp png_ptr, png_infop info_ptr, png_const_colorp palette, int num_palette)); #ifdef PNG_sBIT_SUPPORTED PNG_EXPORT(153, png_uint_32, png_get_sBIT, (png_const_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)); #endif #ifdef PNG_sBIT_SUPPORTED PNG_EXPORT(154, void, png_set_sBIT, (png_structp png_ptr, png_infop info_ptr, png_const_color_8p sig_bit)); #endif #ifdef PNG_sRGB_SUPPORTED PNG_EXPORT(155, png_uint_32, png_get_sRGB, (png_const_structp png_ptr, png_const_infop info_ptr, int *file_srgb_intent)); #endif #ifdef PNG_sRGB_SUPPORTED PNG_EXPORT(156, void, png_set_sRGB, (png_structp png_ptr, png_infop info_ptr, int srgb_intent)); PNG_EXPORT(157, void, png_set_sRGB_gAMA_and_cHRM, (png_structp png_ptr, png_infop info_ptr, int srgb_intent)); #endif #ifdef PNG_iCCP_SUPPORTED PNG_EXPORT(158, png_uint_32, png_get_iCCP, (png_const_structp png_ptr, png_const_infop info_ptr, png_charpp name, int *compression_type, png_bytepp profile, png_uint_32 *proflen)); #endif #ifdef PNG_iCCP_SUPPORTED PNG_EXPORT(159, void, png_set_iCCP, (png_structp png_ptr, png_infop info_ptr, png_const_charp name, int compression_type, png_const_bytep profile, png_uint_32 proflen)); #endif #ifdef PNG_sPLT_SUPPORTED PNG_EXPORT(160, png_uint_32, png_get_sPLT, (png_const_structp png_ptr, png_const_infop info_ptr, png_sPLT_tpp entries)); #endif #ifdef PNG_sPLT_SUPPORTED PNG_EXPORT(161, void, png_set_sPLT, (png_structp png_ptr, png_infop info_ptr, png_const_sPLT_tp entries, int nentries)); #endif #ifdef PNG_TEXT_SUPPORTED /* png_get_text also returns the number of text chunks in *num_text */ PNG_EXPORT(162, png_uint_32, png_get_text, (png_const_structp png_ptr, png_const_infop info_ptr, png_textp *text_ptr, int *num_text)); #endif /* Note while png_set_text() will accept a structure whose text, * language, and translated keywords are NULL pointers, the structure * returned by png_get_text will always contain regular * zero-terminated C strings. They might be empty strings but * they will never be NULL pointers. */ #ifdef PNG_TEXT_SUPPORTED PNG_EXPORT(163, void, png_set_text, (png_structp png_ptr, png_infop info_ptr, png_const_textp text_ptr, int num_text)); #endif #ifdef PNG_tIME_SUPPORTED PNG_EXPORT(164, png_uint_32, png_get_tIME, (png_const_structp png_ptr, png_infop info_ptr, png_timep *mod_time)); #endif #ifdef PNG_tIME_SUPPORTED PNG_EXPORT(165, void, png_set_tIME, (png_structp png_ptr, png_infop info_ptr, png_const_timep mod_time)); #endif #ifdef PNG_tRNS_SUPPORTED PNG_EXPORT(166, png_uint_32, png_get_tRNS, (png_const_structp png_ptr, png_infop info_ptr, png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)); #endif #ifdef PNG_tRNS_SUPPORTED PNG_EXPORT(167, void, png_set_tRNS, (png_structp png_ptr, png_infop info_ptr, png_const_bytep trans_alpha, int num_trans, png_const_color_16p trans_color)); #endif #ifdef PNG_sCAL_SUPPORTED PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, (png_const_structp png_ptr, png_const_infop info_ptr, int *unit, double *width, double *height)) #ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED /* NOTE: this API is currently implemented using floating point arithmetic, * consequently it can only be used on systems with floating point support. * In any case the range of values supported by png_fixed_point is small and it * is highly recommended that png_get_sCAL_s be used instead. */ PNG_FIXED_EXPORT(214, png_uint_32, png_get_sCAL_fixed, (png_structp png_ptr, png_const_infop info_ptr, int *unit, png_fixed_point *width, png_fixed_point *height)) #endif PNG_EXPORT(169, png_uint_32, png_get_sCAL_s, (png_const_structp png_ptr, png_const_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight)); PNG_FP_EXPORT(170, void, png_set_sCAL, (png_structp png_ptr, png_infop info_ptr, int unit, double width, double height)) PNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed, (png_structp png_ptr, png_infop info_ptr, int unit, png_fixed_point width, png_fixed_point height)) PNG_EXPORT(171, void, png_set_sCAL_s, (png_structp png_ptr, png_infop info_ptr, int unit, png_const_charp swidth, png_const_charp sheight)); #endif /* PNG_sCAL_SUPPORTED */ #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED /* Provide a list of chunks and how they are to be handled, if the built-in handling or default unknown chunk handling is not desired. Any chunks not listed will be handled in the default manner. The IHDR and IEND chunks must not be listed. Because this turns off the default handling for chunks that would otherwise be recognized the behavior of libpng transformations may well become incorrect! keep = 0: PNG_HANDLE_CHUNK_AS_DEFAULT: follow default behavior = 1: PNG_HANDLE_CHUNK_NEVER: do not keep = 2: PNG_HANDLE_CHUNK_IF_SAFE: keep only if safe-to-copy = 3: PNG_HANDLE_CHUNK_ALWAYS: keep even if unsafe-to-copy */ PNG_EXPORT(172, void, png_set_keep_unknown_chunks, (png_structp png_ptr, int keep, png_const_bytep chunk_list, int num_chunks)); /* The handling code is returned; the result is therefore true (non-zero) if * special handling is required, false for the default handling. */ PNG_EXPORT(173, int, png_handle_as_unknown, (png_structp png_ptr, png_const_bytep chunk_name)); #endif #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED PNG_EXPORT(174, void, png_set_unknown_chunks, (png_structp png_ptr, png_infop info_ptr, png_const_unknown_chunkp unknowns, int num_unknowns)); PNG_EXPORT(175, void, png_set_unknown_chunk_location, (png_structp png_ptr, png_infop info_ptr, int chunk, int location)); PNG_EXPORT(176, int, png_get_unknown_chunks, (png_const_structp png_ptr, png_const_infop info_ptr, png_unknown_chunkpp entries)); #endif /* Png_free_data() will turn off the "valid" flag for anything it frees. * If you need to turn it off for a chunk that your application has freed, * you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); */ PNG_EXPORT(177, void, png_set_invalid, (png_structp png_ptr, png_infop info_ptr, int mask)); #ifdef PNG_INFO_IMAGE_SUPPORTED /* The "params" pointer is currently not used and is for future expansion. */ PNG_EXPORT(178, void, png_read_png, (png_structp png_ptr, png_infop info_ptr, int transforms, png_voidp params)); PNG_EXPORT(179, void, png_write_png, (png_structp png_ptr, png_infop info_ptr, int transforms, png_voidp params)); #endif PNG_EXPORT(180, png_const_charp, png_get_copyright, (png_const_structp png_ptr)); PNG_EXPORT(181, png_const_charp, png_get_header_ver, (png_const_structp png_ptr)); PNG_EXPORT(182, png_const_charp, png_get_header_version, (png_const_structp png_ptr)); PNG_EXPORT(183, png_const_charp, png_get_libpng_ver, (png_const_structp png_ptr)); #ifdef PNG_MNG_FEATURES_SUPPORTED PNG_EXPORT(184, png_uint_32, png_permit_mng_features, (png_structp png_ptr, png_uint_32 mng_features_permitted)); #endif /* For use in png_set_keep_unknown, added to version 1.2.6 */ #define PNG_HANDLE_CHUNK_AS_DEFAULT 0 #define PNG_HANDLE_CHUNK_NEVER 1 #define PNG_HANDLE_CHUNK_IF_SAFE 2 #define PNG_HANDLE_CHUNK_ALWAYS 3 /* Strip the prepended error numbers ("#nnn ") from error and warning * messages before passing them to the error or warning handler. */ #ifdef PNG_ERROR_NUMBERS_SUPPORTED PNG_EXPORT(185, void, png_set_strip_error_numbers, (png_structp png_ptr, png_uint_32 strip_mode)); #endif /* Added in libpng-1.2.6 */ #ifdef PNG_SET_USER_LIMITS_SUPPORTED PNG_EXPORT(186, void, png_set_user_limits, (png_structp png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max)); PNG_EXPORT(187, png_uint_32, png_get_user_width_max, (png_const_structp png_ptr)); PNG_EXPORT(188, png_uint_32, png_get_user_height_max, (png_const_structp png_ptr)); /* Added in libpng-1.4.0 */ PNG_EXPORT(189, void, png_set_chunk_cache_max, (png_structp png_ptr, png_uint_32 user_chunk_cache_max)); PNG_EXPORT(190, png_uint_32, png_get_chunk_cache_max, (png_const_structp png_ptr)); /* Added in libpng-1.4.1 */ PNG_EXPORT(191, void, png_set_chunk_malloc_max, (png_structp png_ptr, png_alloc_size_t user_chunk_cache_max)); PNG_EXPORT(192, png_alloc_size_t, png_get_chunk_malloc_max, (png_const_structp png_ptr)); #endif #if defined(PNG_INCH_CONVERSIONS_SUPPORTED) PNG_EXPORT(193, png_uint_32, png_get_pixels_per_inch, (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_EXPORT(194, png_uint_32, png_get_x_pixels_per_inch, (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_EXPORT(195, png_uint_32, png_get_y_pixels_per_inch, (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_FP_EXPORT(196, float, png_get_x_offset_inches, (png_const_structp png_ptr, png_const_infop info_ptr)) #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ PNG_FIXED_EXPORT(211, png_fixed_point, png_get_x_offset_inches_fixed, (png_structp png_ptr, png_const_infop info_ptr)) #endif PNG_FP_EXPORT(197, float, png_get_y_offset_inches, (png_const_structp png_ptr, png_const_infop info_ptr)) #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ PNG_FIXED_EXPORT(212, png_fixed_point, png_get_y_offset_inches_fixed, (png_structp png_ptr, png_const_infop info_ptr)) #endif # ifdef PNG_pHYs_SUPPORTED PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (png_const_structp png_ptr, png_const_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); # endif /* PNG_pHYs_SUPPORTED */ #endif /* PNG_INCH_CONVERSIONS_SUPPORTED */ /* Added in libpng-1.4.0 */ #ifdef PNG_IO_STATE_SUPPORTED PNG_EXPORT(199, png_uint_32, png_get_io_state, (png_structp png_ptr)); PNG_EXPORTA(200, png_const_bytep, png_get_io_chunk_name, (png_structp png_ptr), PNG_DEPRECATED); PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type, (png_const_structp png_ptr)); /* The flags returned by png_get_io_state() are the following: */ # define PNG_IO_NONE 0x0000 /* no I/O at this moment */ # define PNG_IO_READING 0x0001 /* currently reading */ # define PNG_IO_WRITING 0x0002 /* currently writing */ # define PNG_IO_SIGNATURE 0x0010 /* currently at the file signature */ # define PNG_IO_CHUNK_HDR 0x0020 /* currently at the chunk header */ # define PNG_IO_CHUNK_DATA 0x0040 /* currently at the chunk data */ # define PNG_IO_CHUNK_CRC 0x0080 /* currently at the chunk crc */ # define PNG_IO_MASK_OP 0x000f /* current operation: reading/writing */ # define PNG_IO_MASK_LOC 0x00f0 /* current location: sig/hdr/data/crc */ #endif /* ?PNG_IO_STATE_SUPPORTED */ /* Interlace support. The following macros are always defined so that if * libpng interlace handling is turned off the macros may be used to handle * interlaced images within the application. */ #define PNG_INTERLACE_ADAM7_PASSES 7 /* Two macros to return the first row and first column of the original, * full, image which appears in a given pass. 'pass' is in the range 0 * to 6 and the result is in the range 0 to 7. */ #define PNG_PASS_START_ROW(pass) (((1&~(pass))<<(3-((pass)>>1)))&7) #define PNG_PASS_START_COL(pass) (((1& (pass))<<(3-(((pass)+1)>>1)))&7) /* A macro to return the offset between pixels in the output row for a pair of * pixels in the input - effectively the inverse of the 'COL_SHIFT' macro that * follows. Note that ROW_OFFSET is the offset from one row to the next whereas * COL_OFFSET is from one column to the next, within a row. */ #define PNG_PASS_ROW_OFFSET(pass) ((pass)>2?(8>>(((pass)-1)>>1)):8) #define PNG_PASS_COL_OFFSET(pass) (1<<((7-(pass))>>1)) /* Two macros to help evaluate the number of rows or columns in each * pass. This is expressed as a shift - effectively log2 of the number or * rows or columns in each 8x8 tile of the original image. */ #define PNG_PASS_ROW_SHIFT(pass) ((pass)>2?(8-(pass))>>1:3) #define PNG_PASS_COL_SHIFT(pass) ((pass)>1?(7-(pass))>>1:3) /* Hence two macros to determine the number of rows or columns in a given * pass of an image given its height or width. In fact these macros may * return non-zero even though the sub-image is empty, because the other * dimension may be empty for a small image. */ #define PNG_PASS_ROWS(height, pass) (((height)+(((1<<PNG_PASS_ROW_SHIFT(pass))\ -1)-PNG_PASS_START_ROW(pass)))>>PNG_PASS_ROW_SHIFT(pass)) #define PNG_PASS_COLS(width, pass) (((width)+(((1<<PNG_PASS_COL_SHIFT(pass))\ -1)-PNG_PASS_START_COL(pass)))>>PNG_PASS_COL_SHIFT(pass)) /* For the reader row callbacks (both progressive and sequential) it is * necessary to find the row in the output image given a row in an interlaced * image, so two more macros: */ #define PNG_ROW_FROM_PASS_ROW(yIn, pass) \ (((yIn)<<PNG_PASS_ROW_SHIFT(pass))+PNG_PASS_START_ROW(pass)) #define PNG_COL_FROM_PASS_COL(xIn, pass) \ (((xIn)<<PNG_PASS_COL_SHIFT(pass))+PNG_PASS_START_COL(pass)) /* Two macros which return a boolean (0 or 1) saying whether the given row * or column is in a particular pass. These use a common utility macro that * returns a mask for a given pass - the offset 'off' selects the row or * column version. The mask has the appropriate bit set for each column in * the tile. */ #define PNG_PASS_MASK(pass,off) ( \ ((0x110145AF>>(((7-(off))-(pass))<<2)) & 0xF) | \ ((0x01145AF0>>(((7-(off))-(pass))<<2)) & 0xF0)) #define PNG_ROW_IN_INTERLACE_PASS(y, pass) \ ((PNG_PASS_MASK(pass,0) >> ((y)&7)) & 1) #define PNG_COL_IN_INTERLACE_PASS(x, pass) \ ((PNG_PASS_MASK(pass,1) >> ((x)&7)) & 1) #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED /* With these routines we avoid an integer divide, which will be slower on * most machines. However, it does take more operations than the corresponding * divide method, so it may be slower on a few RISC systems. There are two * shifts (by 8 or 16 bits) and an addition, versus a single integer divide. * * Note that the rounding factors are NOT supposed to be the same! 128 and * 32768 are correct for the NODIV code; 127 and 32767 are correct for the * standard method. * * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ] */ /* fg and bg should be in `gamma 1.0' space; alpha is the opacity */ # define png_composite(composite, fg, alpha, bg) \ { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \ * (png_uint_16)(alpha) \ + (png_uint_16)(bg)*(png_uint_16)(255 \ - (png_uint_16)(alpha)) + 128); \ (composite) = (png_byte)((temp + (temp >> 8)) >> 8); } # define png_composite_16(composite, fg, alpha, bg) \ { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) \ * (png_uint_32)(alpha) \ + (png_uint_32)(bg)*(65535 \ - (png_uint_32)(alpha)) + 32768); \ (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); } #else /* Standard method using integer division */ # define png_composite(composite, fg, alpha, bg) \ (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \ (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \ 127) / 255) # define png_composite_16(composite, fg, alpha, bg) \ (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \ (png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) + \ 32767) / 65535) #endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */ #ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED PNG_EXPORT(201, png_uint_32, png_get_uint_32, (png_const_bytep buf)); PNG_EXPORT(202, png_uint_16, png_get_uint_16, (png_const_bytep buf)); PNG_EXPORT(203, png_int_32, png_get_int_32, (png_const_bytep buf)); #endif PNG_EXPORT(204, png_uint_32, png_get_uint_31, (png_structp png_ptr, png_const_bytep buf)); /* No png_get_int_16 -- may be added if there's a real need for it. */ /* Place a 32-bit number into a buffer in PNG byte order (big-endian). */ #ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED PNG_EXPORT(205, void, png_save_uint_32, (png_bytep buf, png_uint_32 i)); #endif #ifdef PNG_SAVE_INT_32_SUPPORTED PNG_EXPORT(206, void, png_save_int_32, (png_bytep buf, png_int_32 i)); #endif /* Place a 16-bit number into a buffer in PNG byte order. * The parameter is declared unsigned int, not png_uint_16, * just to avoid potential problems on pre-ANSI C compilers. */ #ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i)); /* No png_save_int_16 -- may be added if there's a real need for it. */ #endif #ifdef PNG_USE_READ_MACROS /* Inline macros to do direct reads of bytes from the input buffer. * The png_get_int_32() routine assumes we are using two's complement * format for negative values, which is almost certainly true. */ # define png_get_uint_32(buf) \ (((png_uint_32)(*(buf)) << 24) + \ ((png_uint_32)(*((buf) + 1)) << 16) + \ ((png_uint_32)(*((buf) + 2)) << 8) + \ ((png_uint_32)(*((buf) + 3)))) /* From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the * function) incorrectly returned a value of type png_uint_32. */ # define png_get_uint_16(buf) \ ((png_uint_16) \ (((unsigned int)(*(buf)) << 8) + \ ((unsigned int)(*((buf) + 1))))) # define png_get_int_32(buf) \ ((png_int_32)((*(buf) & 0x80) \ ? -((png_int_32)((png_get_uint_32(buf) ^ 0xffffffffL) + 1)) \ : (png_int_32)png_get_uint_32(buf))) #endif #if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \ defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED) PNG_EXPORT(234, void, png_set_check_for_invalid_index, (png_structp png_ptr, int allowed)); #endif /* Maintainer: Put new public prototypes here ^, in libpng.3, and project * defs */ /* The last ordinal number (this is the *last* one already used; the next * one to use is one more than this.) Maintainer, remember to add an entry to * scripts/symbols.def as well. */ #ifdef PNG_EXPORT_LAST_ORDINAL PNG_EXPORT_LAST_ORDINAL(234); #endif #ifdef __cplusplus } #endif #endif /* PNG_VERSION_INFO_ONLY */ /* Do not put anything past this line */ #endif /* PNG_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������libpng15/pngconf.h����������������������������������������������������������������������������������0000644�����������������00000051705�14763166026�0010013 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* pngconf.h - machine configurable file for libpng * * libpng version 1.5.13 - September 27, 2012 * * Copyright (c) 1998-2012 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h * */ /* Any machine specific code is near the front of this file, so if you * are configuring libpng for a machine, you may want to read the section * starting here down to where it starts to typedef png_color, png_text, * and png_info. */ #ifndef PNGCONF_H #define PNGCONF_H #ifndef PNG_BUILDING_SYMBOL_TABLE /* PNG_NO_LIMITS_H may be used to turn off the use of the standard C * definition file for machine specific limits, this may impact the * correctness of the definitions below (see uses of INT_MAX). */ # ifndef PNG_NO_LIMITS_H # include <limits.h> # endif /* For the memory copy APIs (i.e. the standard definitions of these), * because this file defines png_memcpy and so on the base APIs must * be defined here. */ # ifdef BSD # include <strings.h> # else # include <string.h> # endif /* For png_FILE_p - this provides the standard definition of a * FILE */ # ifdef PNG_STDIO_SUPPORTED # include <stdio.h> # endif #endif /* This controls optimization of the reading of 16 and 32 bit values * from PNG files. It can be set on a per-app-file basis - it * just changes whether a macro is used when the function is called. * The library builder sets the default; if read functions are not * built into the library the macro implementation is forced on. */ #ifndef PNG_READ_INT_FUNCTIONS_SUPPORTED # define PNG_USE_READ_MACROS #endif #if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS) # if PNG_DEFAULT_READ_MACROS # define PNG_USE_READ_MACROS # endif #endif /* COMPILER SPECIFIC OPTIONS. * * These options are provided so that a variety of difficult compilers * can be used. Some are fixed at build time (e.g. PNG_API_RULE * below) but still have compiler specific implementations, others * may be changed on a per-file basis when compiling against libpng. */ /* The PNGARG macro protects us against machines that don't have function * prototypes (ie K&R style headers). If your compiler does not handle * function prototypes, define this macro and use the included ansi2knr. * I've always been able to use _NO_PROTO as the indicator, but you may * need to drag the empty declaration out in front of here, or change the * ifdef to suit your own needs. */ #ifndef PNGARG # ifdef OF /* zlib prototype munger */ # define PNGARG(arglist) OF(arglist) # else # ifdef _NO_PROTO # define PNGARG(arglist) () # else # define PNGARG(arglist) arglist # endif /* _NO_PROTO */ # endif /* OF */ #endif /* PNGARG */ /* Function calling conventions. * ============================= * Normally it is not necessary to specify to the compiler how to call * a function - it just does it - however on x86 systems derived from * Microsoft and Borland C compilers ('IBM PC', 'DOS', 'Windows' systems * and some others) there are multiple ways to call a function and the * default can be changed on the compiler command line. For this reason * libpng specifies the calling convention of every exported function and * every function called via a user supplied function pointer. This is * done in this file by defining the following macros: * * PNGAPI Calling convention for exported functions. * PNGCBAPI Calling convention for user provided (callback) functions. * PNGCAPI Calling convention used by the ANSI-C library (required * for longjmp callbacks and sometimes used internally to * specify the calling convention for zlib). * * These macros should never be overridden. If it is necessary to * change calling convention in a private build this can be done * by setting PNG_API_RULE (which defaults to 0) to one of the values * below to select the correct 'API' variants. * * PNG_API_RULE=0 Use PNGCAPI - the 'C' calling convention - throughout. * This is correct in every known environment. * PNG_API_RULE=1 Use the operating system convention for PNGAPI and * the 'C' calling convention (from PNGCAPI) for * callbacks (PNGCBAPI). This is no longer required * in any known environment - if it has to be used * please post an explanation of the problem to the * libpng mailing list. * * These cases only differ if the operating system does not use the C * calling convention, at present this just means the above cases * (x86 DOS/Windows sytems) and, even then, this does not apply to * Cygwin running on those systems. * * Note that the value must be defined in pnglibconf.h so that what * the application uses to call the library matches the conventions * set when building the library. */ /* Symbol export * ============= * When building a shared library it is almost always necessary to tell * the compiler which symbols to export. The png.h macro 'PNG_EXPORT' * is used to mark the symbols. On some systems these symbols can be * extracted at link time and need no special processing by the compiler, * on other systems the symbols are flagged by the compiler and just * the declaration requires a special tag applied (unfortunately) in a * compiler dependent way. Some systems can do either. * * A small number of older systems also require a symbol from a DLL to * be flagged to the program that calls it. This is a problem because * we do not know in the header file included by application code that * the symbol will come from a shared library, as opposed to a statically * linked one. For this reason the application must tell us by setting * the magic flag PNG_USE_DLL to turn on the special processing before * it includes png.h. * * Four additional macros are used to make this happen: * * PNG_IMPEXP The magic (if any) to cause a symbol to be exported from * the build or imported if PNG_USE_DLL is set - compiler * and system specific. * * PNG_EXPORT_TYPE(type) A macro that pre or appends PNG_IMPEXP to * 'type', compiler specific. * * PNG_DLL_EXPORT Set to the magic to use during a libpng build to * make a symbol exported from the DLL. Not used in the * public header files; see pngpriv.h for how it is used * in the libpng build. * * PNG_DLL_IMPORT Set to the magic to force the libpng symbols to come * from a DLL - used to define PNG_IMPEXP when * PNG_USE_DLL is set. */ /* System specific discovery. * ========================== * This code is used at build time to find PNG_IMPEXP, the API settings * and PNG_EXPORT_TYPE(), it may also set a macro to indicate the DLL * import processing is possible. On Windows/x86 systems it also sets * compiler-specific macros to the values required to change the calling * conventions of the various functions. */ #if ( defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\ defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) ) &&\ ( defined(_X86_) || defined(_X64_) || defined(_M_IX86) ||\ defined(_M_X64) || defined(_M_IA64) ) /* Windows system (DOS doesn't support DLLs) running on x86/x64. Includes * builds under Cygwin or MinGW. Also includes Watcom builds but these need * special treatment because they are not compatible with GCC or Visual C * because of different calling conventions. */ # if PNG_API_RULE == 2 /* If this line results in an error, either because __watcall is not * understood or because of a redefine just below you cannot use *this* * build of the library with the compiler you are using. *This* build was * build using Watcom and applications must also be built using Watcom! */ # define PNGCAPI __watcall # endif # if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800)) # define PNGCAPI __cdecl # if PNG_API_RULE == 1 # define PNGAPI __stdcall # endif # else /* An older compiler, or one not detected (erroneously) above, * if necessary override on the command line to get the correct * variants for the compiler. */ # ifndef PNGCAPI # define PNGCAPI _cdecl # endif # if PNG_API_RULE == 1 && !defined(PNGAPI) # define PNGAPI _stdcall # endif # endif /* compiler/api */ /* NOTE: PNGCBAPI always defaults to PNGCAPI. */ # if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD) ERROR: PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed # endif # if (defined(_MSC_VER) && _MSC_VER < 800) ||\ (defined(__BORLANDC__) && __BORLANDC__ < 0x500) /* older Borland and MSC * compilers used '__export' and required this to be after * the type. */ # ifndef PNG_EXPORT_TYPE # define PNG_EXPORT_TYPE(type) type PNG_IMPEXP # endif # define PNG_DLL_EXPORT __export # else /* newer compiler */ # define PNG_DLL_EXPORT __declspec(dllexport) # ifndef PNG_DLL_IMPORT # define PNG_DLL_IMPORT __declspec(dllimport) # endif # endif /* compiler */ #else /* !Windows/x86 */ # if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__) # define PNGAPI _System # else /* !Windows/x86 && !OS/2 */ /* Use the defaults, or define PNG*API on the command line (but * this will have to be done for every compile!) */ # endif /* other system, !OS/2 */ #endif /* !Windows/x86 */ /* Now do all the defaulting . */ #ifndef PNGCAPI # define PNGCAPI #endif #ifndef PNGCBAPI # define PNGCBAPI PNGCAPI #endif #ifndef PNGAPI # define PNGAPI PNGCAPI #endif /* PNG_IMPEXP may be set on the compilation system command line or (if not set) * then in an internal header file when building the library, otherwise (when * using the library) it is set here. */ #ifndef PNG_IMPEXP # if defined(PNG_USE_DLL) && defined(PNG_DLL_IMPORT) /* This forces use of a DLL, disallowing static linking */ # define PNG_IMPEXP PNG_DLL_IMPORT # endif # ifndef PNG_IMPEXP # define PNG_IMPEXP # endif #endif /* In 1.5.2 the definition of PNG_FUNCTION has been changed to always treat * 'attributes' as a storage class - the attributes go at the start of the * function definition, and attributes are always appended regardless of the * compiler. This considerably simplifies these macros but may cause problems * if any compilers both need function attributes and fail to handle them as * a storage class (this is unlikely.) */ #ifndef PNG_FUNCTION # define PNG_FUNCTION(type, name, args, attributes) attributes type name args #endif #ifndef PNG_EXPORT_TYPE # define PNG_EXPORT_TYPE(type) PNG_IMPEXP type #endif /* The ordinal value is only relevant when preprocessing png.h for symbol * table entries, so we discard it here. See the .dfn files in the * scripts directory. */ #ifndef PNG_EXPORTA # define PNG_EXPORTA(ordinal, type, name, args, attributes)\ PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args), \ extern attributes) #endif /* ANSI-C (C90) does not permit a macro to be invoked with an empty argument, * so make something non-empty to satisfy the requirement: */ #define PNG_EMPTY /*empty list*/ #define PNG_EXPORT(ordinal, type, name, args)\ PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY) /* Use PNG_REMOVED to comment out a removed interface. */ #ifndef PNG_REMOVED # define PNG_REMOVED(ordinal, type, name, args, attributes) #endif #ifndef PNG_CALLBACK # define PNG_CALLBACK(type, name, args) type (PNGCBAPI name) PNGARG(args) #endif /* Support for compiler specific function attributes. These are used * so that where compiler support is available incorrect use of API * functions in png.h will generate compiler warnings. * * Added at libpng-1.2.41. */ #ifndef PNG_NO_PEDANTIC_WARNINGS # ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED # define PNG_PEDANTIC_WARNINGS_SUPPORTED # endif #endif #ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED /* Support for compiler specific function attributes. These are used * so that where compiler support is available incorrect use of API * functions in png.h will generate compiler warnings. Added at libpng * version 1.2.41. */ # if defined(__GNUC__) # ifndef PNG_USE_RESULT # define PNG_USE_RESULT __attribute__((__warn_unused_result__)) # endif # ifndef PNG_NORETURN # define PNG_NORETURN __attribute__((__noreturn__)) # endif # if __GNUC__ >= 3 # ifndef PNG_ALLOCATED # define PNG_ALLOCATED __attribute__((__malloc__)) # endif # ifndef PNG_DEPRECATED # define PNG_DEPRECATED __attribute__((__deprecated__)) # endif # ifndef PNG_PRIVATE # if 0 /* Doesn't work so we use deprecated instead*/ # define PNG_PRIVATE \ __attribute__((warning("This function is not exported by libpng."))) # else # define PNG_PRIVATE \ __attribute__((__deprecated__)) # endif # endif # endif /* __GNUC__ >= 3 */ # endif /* __GNUC__ */ # if defined(_MSC_VER) && (_MSC_VER >= 1300) # ifndef PNG_USE_RESULT # define PNG_USE_RESULT /* not supported */ # endif # ifndef PNG_NORETURN # define PNG_NORETURN __declspec(noreturn) # endif # ifndef PNG_ALLOCATED # if (_MSC_VER >= 1400) # define PNG_ALLOCATED __declspec(restrict) # endif # endif # ifndef PNG_DEPRECATED # define PNG_DEPRECATED __declspec(deprecated) # endif # ifndef PNG_PRIVATE # define PNG_PRIVATE __declspec(deprecated) # endif # endif /* _MSC_VER */ #endif /* PNG_PEDANTIC_WARNINGS */ #ifndef PNG_DEPRECATED # define PNG_DEPRECATED /* Use of this function is deprecated */ #endif #ifndef PNG_USE_RESULT # define PNG_USE_RESULT /* The result of this function must be checked */ #endif #ifndef PNG_NORETURN # define PNG_NORETURN /* This function does not return */ #endif #ifndef PNG_ALLOCATED # define PNG_ALLOCATED /* The result of the function is new memory */ #endif #ifndef PNG_PRIVATE # define PNG_PRIVATE /* This is a private libpng function */ #endif #ifndef PNG_FP_EXPORT /* A floating point API. */ # ifdef PNG_FLOATING_POINT_SUPPORTED # define PNG_FP_EXPORT(ordinal, type, name, args)\ PNG_EXPORT(ordinal, type, name, args); # else /* No floating point APIs */ # define PNG_FP_EXPORT(ordinal, type, name, args) # endif #endif #ifndef PNG_FIXED_EXPORT /* A fixed point API. */ # ifdef PNG_FIXED_POINT_SUPPORTED # define PNG_FIXED_EXPORT(ordinal, type, name, args)\ PNG_EXPORT(ordinal, type, name, args); # else /* No fixed point APIs */ # define PNG_FIXED_EXPORT(ordinal, type, name, args) # endif #endif /* The following uses const char * instead of char * for error * and warning message functions, so some compilers won't complain. * If you do not want to use const, define PNG_NO_CONST here. * * This should not change how the APIs are called, so it can be done * on a per-file basis in the application. */ #ifndef PNG_CONST # ifndef PNG_NO_CONST # define PNG_CONST const # else # define PNG_CONST # endif #endif /* Some typedefs to get us started. These should be safe on most of the * common platforms. The typedefs should be at least as large as the * numbers suggest (a png_uint_32 must be at least 32 bits long), but they * don't have to be exactly that size. Some compilers dislike passing * unsigned shorts as function parameters, so you may be better off using * unsigned int for png_uint_16. */ #if defined(INT_MAX) && (INT_MAX > 0x7ffffffeL) typedef unsigned int png_uint_32; typedef int png_int_32; #else typedef unsigned long png_uint_32; typedef long png_int_32; #endif typedef unsigned short png_uint_16; typedef short png_int_16; typedef unsigned char png_byte; #ifdef PNG_NO_SIZE_T typedef unsigned int png_size_t; #else typedef size_t png_size_t; #endif #define png_sizeof(x) (sizeof (x)) /* The following is needed for medium model support. It cannot be in the * pngpriv.h header. Needs modification for other compilers besides * MSC. Model independent support declares all arrays and pointers to be * large using the far keyword. The zlib version used must also support * model independent data. As of version zlib 1.0.4, the necessary changes * have been made in zlib. The USE_FAR_KEYWORD define triggers other * changes that are needed. (Tim Wegner) */ /* Separate compiler dependencies (problem here is that zlib.h always * defines FAR. (SJT) */ #ifdef __BORLANDC__ # if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__) # define LDATA 1 # else # define LDATA 0 # endif /* GRR: why is Cygwin in here? Cygwin is not Borland C... */ # if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__) # define PNG_MAX_MALLOC_64K /* only used in build */ # if (LDATA != 1) # ifndef FAR # define FAR __far # endif # define USE_FAR_KEYWORD # endif /* LDATA != 1 */ /* Possibly useful for moving data out of default segment. * Uncomment it if you want. Could also define FARDATA as * const if your compiler supports it. (SJT) # define FARDATA FAR */ # endif /* __WIN32__, __FLAT__, __CYGWIN__ */ #endif /* __BORLANDC__ */ /* Suggest testing for specific compiler first before testing for * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM, * making reliance oncertain keywords suspect. (SJT) */ /* MSC Medium model */ #ifdef FAR # ifdef M_I86MM # define USE_FAR_KEYWORD # define FARDATA FAR # include <dos.h> # endif #endif /* SJT: default case */ #ifndef FAR # define FAR #endif /* At this point FAR is always defined */ #ifndef FARDATA # define FARDATA #endif /* Typedef for floating-point numbers that are converted * to fixed-point with a multiple of 100,000, e.g., gamma */ typedef png_int_32 png_fixed_point; /* Add typedefs for pointers */ typedef void FAR * png_voidp; typedef PNG_CONST void FAR * png_const_voidp; typedef png_byte FAR * png_bytep; typedef PNG_CONST png_byte FAR * png_const_bytep; typedef png_uint_32 FAR * png_uint_32p; typedef PNG_CONST png_uint_32 FAR * png_const_uint_32p; typedef png_int_32 FAR * png_int_32p; typedef PNG_CONST png_int_32 FAR * png_const_int_32p; typedef png_uint_16 FAR * png_uint_16p; typedef PNG_CONST png_uint_16 FAR * png_const_uint_16p; typedef png_int_16 FAR * png_int_16p; typedef PNG_CONST png_int_16 FAR * png_const_int_16p; typedef char FAR * png_charp; typedef PNG_CONST char FAR * png_const_charp; typedef png_fixed_point FAR * png_fixed_point_p; typedef PNG_CONST png_fixed_point FAR * png_const_fixed_point_p; typedef png_size_t FAR * png_size_tp; typedef PNG_CONST png_size_t FAR * png_const_size_tp; #ifdef PNG_STDIO_SUPPORTED typedef FILE * png_FILE_p; #endif #ifdef PNG_FLOATING_POINT_SUPPORTED typedef double FAR * png_doublep; typedef PNG_CONST double FAR * png_const_doublep; #endif /* Pointers to pointers; i.e. arrays */ typedef png_byte FAR * FAR * png_bytepp; typedef png_uint_32 FAR * FAR * png_uint_32pp; typedef png_int_32 FAR * FAR * png_int_32pp; typedef png_uint_16 FAR * FAR * png_uint_16pp; typedef png_int_16 FAR * FAR * png_int_16pp; typedef PNG_CONST char FAR * FAR * png_const_charpp; typedef char FAR * FAR * png_charpp; typedef png_fixed_point FAR * FAR * png_fixed_point_pp; #ifdef PNG_FLOATING_POINT_SUPPORTED typedef double FAR * FAR * png_doublepp; #endif /* Pointers to pointers to pointers; i.e., pointer to array */ typedef char FAR * FAR * FAR * png_charppp; /* png_alloc_size_t is guaranteed to be no smaller than png_size_t, * and no smaller than png_uint_32. Casts from png_size_t or png_uint_32 * to png_alloc_size_t are not necessary; in fact, it is recommended * not to use them at all so that the compiler can complain when something * turns out to be problematic. * Casts in the other direction (from png_alloc_size_t to png_size_t or * png_uint_32) should be explicitly applied; however, we do not expect * to encounter practical situations that require such conversions. */ #if defined(__TURBOC__) && !defined(__FLAT__) typedef unsigned long png_alloc_size_t; #else # if defined(_MSC_VER) && defined(MAXSEG_64K) typedef unsigned long png_alloc_size_t; # else /* This is an attempt to detect an old Windows system where (int) is * actually 16 bits, in that case png_malloc must have an argument with a * bigger size to accomodate the requirements of the library. */ # if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_)) && \ (!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL) typedef DWORD png_alloc_size_t; # else typedef png_size_t png_alloc_size_t; # endif # endif #endif #endif /* PNGCONF_H */ �����������������������������������������������������������stdlib.h��������������������������������������������������������������������������������������������0000644�����������������00000102356�14763166026�0006220 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-2007, 2009-2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 Standard: 7.20 General utilities <stdlib.h> */ #ifndef _STDLIB_H #include <features.h> /* Get size_t, wchar_t and NULL from <stddef.h>. */ #define __need_size_t #ifndef __need_malloc_and_calloc # define __need_wchar_t # define __need_NULL #endif #include <stddef.h> __BEGIN_DECLS #ifndef __need_malloc_and_calloc #define _STDLIB_H 1 #if (defined __USE_XOPEN || defined __USE_XOPEN2K8) && !defined _SYS_WAIT_H /* XPG requires a few symbols from <sys/wait.h> being defined. */ # include <bits/waitflags.h> # include <bits/waitstatus.h> # ifdef __USE_BSD /* Lots of hair to allow traditional BSD use of `union wait' as well as POSIX.1 use of `int' for the status word. */ # if defined __GNUC__ && !defined __cplusplus # define __WAIT_INT(status) \ (__extension__ (((union { __typeof(status) __in; int __i; }) \ { .__in = (status) }).__i)) # else # define __WAIT_INT(status) (*(int *) &(status)) # endif /* This is the type of the argument to `wait'. The funky union causes redeclarations with either `int *' or `union wait *' to be allowed without complaint. __WAIT_STATUS_DEFN is the type used in the actual function definitions. */ # if !defined __GNUC__ || __GNUC__ < 2 || defined __cplusplus # define __WAIT_STATUS void * # define __WAIT_STATUS_DEFN void * # else /* This works in GCC 2.6.1 and later. */ typedef union { union wait *__uptr; int *__iptr; } __WAIT_STATUS __attribute__ ((__transparent_union__)); # define __WAIT_STATUS_DEFN int * # endif # else /* Don't use BSD. */ # define __WAIT_INT(status) (status) # define __WAIT_STATUS int * # define __WAIT_STATUS_DEFN int * # endif /* Use BSD. */ /* Define the macros <sys/wait.h> also would define this way. */ # define WEXITSTATUS(status) __WEXITSTATUS (__WAIT_INT (status)) # define WTERMSIG(status) __WTERMSIG (__WAIT_INT (status)) # define WSTOPSIG(status) __WSTOPSIG (__WAIT_INT (status)) # define WIFEXITED(status) __WIFEXITED (__WAIT_INT (status)) # define WIFSIGNALED(status) __WIFSIGNALED (__WAIT_INT (status)) # define WIFSTOPPED(status) __WIFSTOPPED (__WAIT_INT (status)) # ifdef __WIFCONTINUED # define WIFCONTINUED(status) __WIFCONTINUED (__WAIT_INT (status)) # endif #endif /* X/Open or XPG7 and <sys/wait.h> not included. */ __BEGIN_NAMESPACE_STD /* Returned by `div'. */ typedef struct { int quot; /* Quotient. */ int rem; /* Remainder. */ } div_t; /* Returned by `ldiv'. */ #ifndef __ldiv_t_defined typedef struct { long int quot; /* Quotient. */ long int rem; /* Remainder. */ } ldiv_t; # define __ldiv_t_defined 1 #endif __END_NAMESPACE_STD #if defined __USE_ISOC99 && !defined __lldiv_t_defined __BEGIN_NAMESPACE_C99 /* Returned by `lldiv'. */ __extension__ typedef struct { long long int quot; /* Quotient. */ long long int rem; /* Remainder. */ } lldiv_t; # define __lldiv_t_defined 1 __END_NAMESPACE_C99 #endif /* The largest number rand will return (same as INT_MAX). */ #define RAND_MAX 2147483647 /* We define these the same for all machines. Changes from this to the outside world should be done in `_exit'. */ #define EXIT_FAILURE 1 /* Failing exit status. */ #define EXIT_SUCCESS 0 /* Successful exit status. */ /* Maximum length of a multibyte character in the current locale. */ #define MB_CUR_MAX (__ctype_get_mb_cur_max ()) extern size_t __ctype_get_mb_cur_max (void) __THROW __wur; __BEGIN_NAMESPACE_STD /* Convert a string to a floating-point number. */ extern double atof (const char *__nptr) __THROW __attribute_pure__ __nonnull ((1)) __wur; /* Convert a string to an integer. */ extern int atoi (const char *__nptr) __THROW __attribute_pure__ __nonnull ((1)) __wur; /* Convert a string to a long integer. */ extern long int atol (const char *__nptr) __THROW __attribute_pure__ __nonnull ((1)) __wur; __END_NAMESPACE_STD #if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined __USE_MISC) __BEGIN_NAMESPACE_C99 /* Convert a string to a long long integer. */ __extension__ extern long long int atoll (const char *__nptr) __THROW __attribute_pure__ __nonnull ((1)) __wur; __END_NAMESPACE_C99 #endif __BEGIN_NAMESPACE_STD /* Convert a string to a floating-point number. */ extern double strtod (const char *__restrict __nptr, char **__restrict __endptr) __THROW __nonnull ((1)); __END_NAMESPACE_STD #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Likewise for `float' and `long double' sizes of floating-point numbers. */ extern float strtof (const char *__restrict __nptr, char **__restrict __endptr) __THROW __nonnull ((1)); extern long double strtold (const char *__restrict __nptr, char **__restrict __endptr) __THROW __nonnull ((1)); __END_NAMESPACE_C99 #endif __BEGIN_NAMESPACE_STD /* Convert a string to a long integer. */ extern long int strtol (const char *__restrict __nptr, char **__restrict __endptr, int __base) __THROW __nonnull ((1)); /* Convert a string to an unsigned long integer. */ extern unsigned long int strtoul (const char *__restrict __nptr, char **__restrict __endptr, int __base) __THROW __nonnull ((1)); __END_NAMESPACE_STD #if defined __GLIBC_HAVE_LONG_LONG && defined __USE_BSD /* Convert a string to a quadword integer. */ __extension__ extern long long int strtoq (const char *__restrict __nptr, char **__restrict __endptr, int __base) __THROW __nonnull ((1)); /* Convert a string to an unsigned quadword integer. */ __extension__ extern unsigned long long int strtouq (const char *__restrict __nptr, char **__restrict __endptr, int __base) __THROW __nonnull ((1)); #endif /* GCC and use BSD. */ #if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined __USE_MISC) __BEGIN_NAMESPACE_C99 /* Convert a string to a quadword integer. */ __extension__ extern long long int strtoll (const char *__restrict __nptr, char **__restrict __endptr, int __base) __THROW __nonnull ((1)); /* Convert a string to an unsigned quadword integer. */ __extension__ extern unsigned long long int strtoull (const char *__restrict __nptr, char **__restrict __endptr, int __base) __THROW __nonnull ((1)); __END_NAMESPACE_C99 #endif /* ISO C99 or GCC and use MISC. */ #ifdef __USE_GNU /* The concept of one static locale per category is not very well thought out. Many applications will need to process its data using information from several different locales. Another problem is the implementation of the internationalization handling in the ISO C++ standard library. To support this another set of the functions using locale data exist which take an additional argument. Attention: even though several *_l interfaces are part of POSIX:2008, these are not. */ /* Structure for reentrant locale using functions. This is an (almost) opaque type for the user level programs. */ # include <xlocale.h> /* Special versions of the functions above which take the locale to use as an additional parameter. */ extern long int strtol_l (const char *__restrict __nptr, char **__restrict __endptr, int __base, __locale_t __loc) __THROW __nonnull ((1, 4)); extern unsigned long int strtoul_l (const char *__restrict __nptr, char **__restrict __endptr, int __base, __locale_t __loc) __THROW __nonnull ((1, 4)); __extension__ extern long long int strtoll_l (const char *__restrict __nptr, char **__restrict __endptr, int __base, __locale_t __loc) __THROW __nonnull ((1, 4)); __extension__ extern unsigned long long int strtoull_l (const char *__restrict __nptr, char **__restrict __endptr, int __base, __locale_t __loc) __THROW __nonnull ((1, 4)); extern double strtod_l (const char *__restrict __nptr, char **__restrict __endptr, __locale_t __loc) __THROW __nonnull ((1, 3)); extern float strtof_l (const char *__restrict __nptr, char **__restrict __endptr, __locale_t __loc) __THROW __nonnull ((1, 3)); extern long double strtold_l (const char *__restrict __nptr, char **__restrict __endptr, __locale_t __loc) __THROW __nonnull ((1, 3)); #endif /* GNU */ #ifdef __USE_EXTERN_INLINES __BEGIN_NAMESPACE_STD __extern_inline int __NTH (atoi (const char *__nptr)) { return (int) strtol (__nptr, (char **) NULL, 10); } __extern_inline long int __NTH (atol (const char *__nptr)) { return strtol (__nptr, (char **) NULL, 10); } __END_NAMESPACE_STD # if defined __USE_MISC || defined __USE_ISOC99 __BEGIN_NAMESPACE_C99 __extension__ __extern_inline long long int __NTH (atoll (const char *__nptr)) { return strtoll (__nptr, (char **) NULL, 10); } __END_NAMESPACE_C99 # endif #endif /* Optimizing and Inlining. */ #if defined __USE_SVID || defined __USE_XOPEN_EXTENDED /* Convert N to base 64 using the digits "./0-9A-Za-z", least-significant digit first. Returns a pointer to static storage overwritten by the next call. */ extern char *l64a (long int __n) __THROW __wur; /* Read a number from a string S in base 64 as above. */ extern long int a64l (const char *__s) __THROW __attribute_pure__ __nonnull ((1)) __wur; #endif /* Use SVID || extended X/Open. */ #if defined __USE_SVID || defined __USE_XOPEN_EXTENDED || defined __USE_BSD # include <sys/types.h> /* we need int32_t... */ /* These are the functions that actually do things. The `random', `srandom', `initstate' and `setstate' functions are those from BSD Unices. The `rand' and `srand' functions are required by the ANSI standard. We provide both interfaces to the same random number generator. */ /* Return a random long integer between 0 and RAND_MAX inclusive. */ extern long int random (void) __THROW; /* Seed the random number generator with the given number. */ extern void srandom (unsigned int __seed) __THROW; /* Initialize the random number generator to use state buffer STATEBUF, of length STATELEN, and seed it with SEED. Optimal lengths are 8, 16, 32, 64, 128 and 256, the bigger the better; values less than 8 will cause an error and values greater than 256 will be rounded down. */ extern char *initstate (unsigned int __seed, char *__statebuf, size_t __statelen) __THROW __nonnull ((2)); /* Switch the random number generator to state buffer STATEBUF, which should have been previously initialized by `initstate'. */ extern char *setstate (char *__statebuf) __THROW __nonnull ((1)); # ifdef __USE_MISC /* Reentrant versions of the `random' family of functions. These functions all use the following data structure to contain state, rather than global state variables. */ struct random_data { int32_t *fptr; /* Front pointer. */ int32_t *rptr; /* Rear pointer. */ int32_t *state; /* Array of state values. */ int rand_type; /* Type of random number generator. */ int rand_deg; /* Degree of random number generator. */ int rand_sep; /* Distance between front and rear. */ int32_t *end_ptr; /* Pointer behind state table. */ }; extern int random_r (struct random_data *__restrict __buf, int32_t *__restrict __result) __THROW __nonnull ((1, 2)); extern int srandom_r (unsigned int __seed, struct random_data *__buf) __THROW __nonnull ((2)); extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, size_t __statelen, struct random_data *__restrict __buf) __THROW __nonnull ((2, 4)); extern int setstate_r (char *__restrict __statebuf, struct random_data *__restrict __buf) __THROW __nonnull ((1, 2)); # endif /* Use misc. */ #endif /* Use SVID || extended X/Open || BSD. */ __BEGIN_NAMESPACE_STD /* Return a random integer between 0 and RAND_MAX inclusive. */ extern int rand (void) __THROW; /* Seed the random number generator with the given number. */ extern void srand (unsigned int __seed) __THROW; __END_NAMESPACE_STD #ifdef __USE_POSIX /* Reentrant interface according to POSIX.1. */ extern int rand_r (unsigned int *__seed) __THROW; #endif #if defined __USE_SVID || defined __USE_XOPEN /* System V style 48-bit random number generator functions. */ /* Return non-negative, double-precision floating-point value in [0.0,1.0). */ extern double drand48 (void) __THROW; extern double erand48 (unsigned short int __xsubi[3]) __THROW __nonnull ((1)); /* Return non-negative, long integer in [0,2^31). */ extern long int lrand48 (void) __THROW; extern long int nrand48 (unsigned short int __xsubi[3]) __THROW __nonnull ((1)); /* Return signed, long integers in [-2^31,2^31). */ extern long int mrand48 (void) __THROW; extern long int jrand48 (unsigned short int __xsubi[3]) __THROW __nonnull ((1)); /* Seed random number generator. */ extern void srand48 (long int __seedval) __THROW; extern unsigned short int *seed48 (unsigned short int __seed16v[3]) __THROW __nonnull ((1)); extern void lcong48 (unsigned short int __param[7]) __THROW __nonnull ((1)); # ifdef __USE_MISC /* Data structure for communication with thread safe versions. This type is to be regarded as opaque. It's only exported because users have to allocate objects of this type. */ struct drand48_data { unsigned short int __x[3]; /* Current state. */ unsigned short int __old_x[3]; /* Old state. */ unsigned short int __c; /* Additive const. in congruential formula. */ unsigned short int __init; /* Flag for initializing. */ unsigned long long int __a; /* Factor in congruential formula. */ }; /* Return non-negative, double-precision floating-point value in [0.0,1.0). */ extern int drand48_r (struct drand48_data *__restrict __buffer, double *__restrict __result) __THROW __nonnull ((1, 2)); extern int erand48_r (unsigned short int __xsubi[3], struct drand48_data *__restrict __buffer, double *__restrict __result) __THROW __nonnull ((1, 2)); /* Return non-negative, long integer in [0,2^31). */ extern int lrand48_r (struct drand48_data *__restrict __buffer, long int *__restrict __result) __THROW __nonnull ((1, 2)); extern int nrand48_r (unsigned short int __xsubi[3], struct drand48_data *__restrict __buffer, long int *__restrict __result) __THROW __nonnull ((1, 2)); /* Return signed, long integers in [-2^31,2^31). */ extern int mrand48_r (struct drand48_data *__restrict __buffer, long int *__restrict __result) __THROW __nonnull ((1, 2)); extern int jrand48_r (unsigned short int __xsubi[3], struct drand48_data *__restrict __buffer, long int *__restrict __result) __THROW __nonnull ((1, 2)); /* Seed random number generator. */ extern int srand48_r (long int __seedval, struct drand48_data *__buffer) __THROW __nonnull ((2)); extern int seed48_r (unsigned short int __seed16v[3], struct drand48_data *__buffer) __THROW __nonnull ((1, 2)); extern int lcong48_r (unsigned short int __param[7], struct drand48_data *__buffer) __THROW __nonnull ((1, 2)); # endif /* Use misc. */ #endif /* Use SVID or X/Open. */ #endif /* don't just need malloc and calloc */ #ifndef __malloc_and_calloc_defined # define __malloc_and_calloc_defined __BEGIN_NAMESPACE_STD /* Allocate SIZE bytes of memory. */ extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur; /* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */ extern void *calloc (size_t __nmemb, size_t __size) __THROW __attribute_malloc__ __wur; __END_NAMESPACE_STD #endif #ifndef __need_malloc_and_calloc __BEGIN_NAMESPACE_STD /* Re-allocate the previously allocated block in PTR, making the new block SIZE bytes long. */ /* __attribute_malloc__ is not used, because if realloc returns the same pointer that was passed to it, aliasing needs to be allowed between objects pointed by the old and new pointers. */ extern void *realloc (void *__ptr, size_t __size) __THROW __attribute_warn_unused_result__; /* Free a block allocated by `malloc', `realloc' or `calloc'. */ extern void free (void *__ptr) __THROW; __END_NAMESPACE_STD #ifdef __USE_MISC /* Free a block. An alias for `free'. (Sun Unices). */ extern void cfree (void *__ptr) __THROW; #endif /* Use misc. */ #if defined __USE_GNU || defined __USE_BSD || defined __USE_MISC # include <alloca.h> #endif /* Use GNU, BSD, or misc. */ #if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \ || defined __USE_BSD /* Allocate SIZE bytes on a page boundary. The storage cannot be freed. */ extern void *valloc (size_t __size) __THROW __attribute_malloc__ __wur; #endif #ifdef __USE_XOPEN2K /* Allocate memory of SIZE bytes with an alignment of ALIGNMENT. */ extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) __THROW __nonnull ((1)) __wur; #endif #ifdef __USE_ISOC11 /* ISO C variant of aligned allocation. */ extern void *aligned_alloc (size_t __alignment, size_t __size) __THROW __wur __attribute__ ((__malloc__, __alloc_size__ (2))); #endif __BEGIN_NAMESPACE_STD /* Abort execution and generate a core-dump. */ extern void abort (void) __THROW __attribute__ ((__noreturn__)); /* Register a function to be called when `exit' is called. */ extern int atexit (void (*__func) (void)) __THROW __nonnull ((1)); #if defined __USE_ISOC11 || defined __USE_ISOCXX11 /* Register a function to be called when `quick_exit' is called. */ # ifdef __cplusplus extern "C++" int at_quick_exit (void (*__func) (void)) __THROW __asm ("at_quick_exit") __nonnull ((1)); # else extern int at_quick_exit (void (*__func) (void)) __THROW __nonnull ((1)); # endif #endif __END_NAMESPACE_STD #ifdef __USE_MISC /* Register a function to be called with the status given to `exit' and the given argument. */ extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) __THROW __nonnull ((1)); #endif __BEGIN_NAMESPACE_STD /* Call all functions registered with `atexit' and `on_exit', in the reverse of the order in which they were registered, perform stdio cleanup, and terminate program execution with STATUS. */ extern void exit (int __status) __THROW __attribute__ ((__noreturn__)); #if defined __USE_ISOC11 || defined __USE_ISOCXX11 /* Call all functions registered with `at_quick_exit' in the reverse of the order in which they were registered and terminate program execution with STATUS. */ extern void quick_exit (int __status) __THROW __attribute__ ((__noreturn__)); #endif __END_NAMESPACE_STD #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Terminate the program with STATUS without calling any of the functions registered with `atexit' or `on_exit'. */ extern void _Exit (int __status) __THROW __attribute__ ((__noreturn__)); __END_NAMESPACE_C99 #endif __BEGIN_NAMESPACE_STD /* Return the value of envariable NAME, or NULL if it doesn't exist. */ extern char *getenv (const char *__name) __THROW __nonnull ((1)) __wur; __END_NAMESPACE_STD #ifdef __USE_GNU /* This function is similar to the above but returns NULL if the programs is running with SUID or SGID enabled. */ extern char *secure_getenv (const char *__name) __THROW __nonnull ((1)) __wur; #endif #if defined __USE_SVID || defined __USE_XOPEN /* The SVID says this is in <stdio.h>, but this seems a better place. */ /* Put STRING, which is of the form "NAME=VALUE", in the environment. If there is no `=', remove NAME from the environment. */ extern int putenv (char *__string) __THROW __nonnull ((1)); #endif #if defined __USE_BSD || defined __USE_XOPEN2K /* Set NAME to VALUE in the environment. If REPLACE is nonzero, overwrite an existing value. */ extern int setenv (const char *__name, const char *__value, int __replace) __THROW __nonnull ((2)); /* Remove the variable NAME from the environment. */ extern int unsetenv (const char *__name) __THROW __nonnull ((1)); #endif #ifdef __USE_MISC /* The `clearenv' was planned to be added to POSIX.1 but probably never made it. Nevertheless the POSIX.9 standard (POSIX bindings for Fortran 77) requires this function. */ extern int clearenv (void) __THROW; #endif #if defined __USE_MISC \ || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) /* Generate a unique temporary file name from TEMPLATE. The last six characters of TEMPLATE must be "XXXXXX"; they are replaced with a string that makes the file name unique. Always returns TEMPLATE, it's either a temporary file name or a null string if it cannot get a unique file name. */ extern char *mktemp (char *__template) __THROW __nonnull ((1)); #endif #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED \ || defined __USE_XOPEN2K8 /* Generate a unique temporary file name from TEMPLATE. The last six characters of TEMPLATE must be "XXXXXX"; they are replaced with a string that makes the filename unique. Returns a file descriptor open on the file for reading and writing, or -1 if it cannot create a uniquely-named file. This function is a possible cancellation point and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int mkstemp (char *__template) __nonnull ((1)) __wur; # else # ifdef __REDIRECT extern int __REDIRECT (mkstemp, (char *__template), mkstemp64) __nonnull ((1)) __wur; # else # define mkstemp mkstemp64 # endif # endif # ifdef __USE_LARGEFILE64 extern int mkstemp64 (char *__template) __nonnull ((1)) __wur; # endif #endif #ifdef __USE_MISC /* Similar to mkstemp, but the template can have a suffix after the XXXXXX. The length of the suffix is specified in the second parameter. This function is a possible cancellation point and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int mkstemps (char *__template, int __suffixlen) __nonnull ((1)) __wur; # else # ifdef __REDIRECT extern int __REDIRECT (mkstemps, (char *__template, int __suffixlen), mkstemps64) __nonnull ((1)) __wur; # else # define mkstemps mkstemps64 # endif # endif # ifdef __USE_LARGEFILE64 extern int mkstemps64 (char *__template, int __suffixlen) __nonnull ((1)) __wur; # endif #endif #if defined __USE_BSD || defined __USE_XOPEN2K8 /* Create a unique temporary directory from TEMPLATE. The last six characters of TEMPLATE must be "XXXXXX"; they are replaced with a string that makes the directory name unique. Returns TEMPLATE, or a null pointer if it cannot get a unique name. The directory is created mode 700. */ extern char *mkdtemp (char *__template) __THROW __nonnull ((1)) __wur; #endif #ifdef __USE_GNU /* Generate a unique temporary file name from TEMPLATE similar to mkstemp. But allow the caller to pass additional flags which are used in the open call to create the file.. This function is a possible cancellation point and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int mkostemp (char *__template, int __flags) __nonnull ((1)) __wur; # else # ifdef __REDIRECT extern int __REDIRECT (mkostemp, (char *__template, int __flags), mkostemp64) __nonnull ((1)) __wur; # else # define mkostemp mkostemp64 # endif # endif # ifdef __USE_LARGEFILE64 extern int mkostemp64 (char *__template, int __flags) __nonnull ((1)) __wur; # endif /* Similar to mkostemp, but the template can have a suffix after the XXXXXX. The length of the suffix is specified in the second parameter. This function is a possible cancellation point and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int mkostemps (char *__template, int __suffixlen, int __flags) __nonnull ((1)) __wur; # else # ifdef __REDIRECT extern int __REDIRECT (mkostemps, (char *__template, int __suffixlen, int __flags), mkostemps64) __nonnull ((1)) __wur; # else # define mkostemps mkostemps64 # endif # endif # ifdef __USE_LARGEFILE64 extern int mkostemps64 (char *__template, int __suffixlen, int __flags) __nonnull ((1)) __wur; # endif #endif __BEGIN_NAMESPACE_STD /* Execute the given line as a shell command. This function is a cancellation point and therefore not marked with __THROW. */ extern int system (const char *__command) __wur; __END_NAMESPACE_STD #ifdef __USE_GNU /* Return a malloc'd string containing the canonical absolute name of the existing named file. */ extern char *canonicalize_file_name (const char *__name) __THROW __nonnull ((1)) __wur; #endif #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Return the canonical absolute name of file NAME. If RESOLVED is null, the result is malloc'd; otherwise, if the canonical name is PATH_MAX chars or more, returns null with `errno' set to ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars, returns the name in RESOLVED. */ extern char *realpath (const char *__restrict __name, char *__restrict __resolved) __THROW __wur; #endif /* Shorthand for type of comparison functions. */ #ifndef __COMPAR_FN_T # define __COMPAR_FN_T typedef int (*__compar_fn_t) (const void *, const void *); # ifdef __USE_GNU typedef __compar_fn_t comparison_fn_t; # endif #endif #ifdef __USE_GNU typedef int (*__compar_d_fn_t) (const void *, const void *, void *); #endif __BEGIN_NAMESPACE_STD /* Do a binary search for KEY in BASE, which consists of NMEMB elements of SIZE bytes each, using COMPAR to perform the comparisons. */ extern void *bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size, __compar_fn_t __compar) __nonnull ((1, 2, 5)) __wur; /* Sort NMEMB elements of BASE, of SIZE bytes each, using COMPAR to perform the comparisons. */ extern void qsort (void *__base, size_t __nmemb, size_t __size, __compar_fn_t __compar) __nonnull ((1, 4)); #ifdef __USE_GNU extern void qsort_r (void *__base, size_t __nmemb, size_t __size, __compar_d_fn_t __compar, void *__arg) __nonnull ((1, 4)); #endif /* Return the absolute value of X. */ extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; extern long int labs (long int __x) __THROW __attribute__ ((__const__)) __wur; __END_NAMESPACE_STD #ifdef __USE_ISOC99 __extension__ extern long long int llabs (long long int __x) __THROW __attribute__ ((__const__)) __wur; #endif __BEGIN_NAMESPACE_STD /* Return the `div_t', `ldiv_t' or `lldiv_t' representation of the value of NUMER over DENOM. */ /* GCC may have built-ins for these someday. */ extern div_t div (int __numer, int __denom) __THROW __attribute__ ((__const__)) __wur; extern ldiv_t ldiv (long int __numer, long int __denom) __THROW __attribute__ ((__const__)) __wur; __END_NAMESPACE_STD #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 __extension__ extern lldiv_t lldiv (long long int __numer, long long int __denom) __THROW __attribute__ ((__const__)) __wur; __END_NAMESPACE_C99 #endif #if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \ || defined __USE_SVID /* Convert floating point numbers to strings. The returned values are valid only until another call to the same function. */ /* Convert VALUE to a string with NDIGIT digits and return a pointer to this. Set *DECPT with the position of the decimal character and *SIGN with the sign of the number. */ extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign) __THROW __nonnull ((3, 4)) __wur; /* Convert VALUE to a string rounded to NDIGIT decimal digits. Set *DECPT with the position of the decimal character and *SIGN with the sign of the number. */ extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign) __THROW __nonnull ((3, 4)) __wur; /* If possible convert VALUE to a string with NDIGIT significant digits. Otherwise use exponential representation. The resulting string will be written to BUF. */ extern char *gcvt (double __value, int __ndigit, char *__buf) __THROW __nonnull ((3)) __wur; # ifdef __USE_MISC /* Long double versions of above functions. */ extern char *qecvt (long double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign) __THROW __nonnull ((3, 4)) __wur; extern char *qfcvt (long double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign) __THROW __nonnull ((3, 4)) __wur; extern char *qgcvt (long double __value, int __ndigit, char *__buf) __THROW __nonnull ((3)) __wur; /* Reentrant version of the functions above which provide their own buffers. */ extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign, char *__restrict __buf, size_t __len) __THROW __nonnull ((3, 4, 5)); extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign, char *__restrict __buf, size_t __len) __THROW __nonnull ((3, 4, 5)); extern int qecvt_r (long double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign, char *__restrict __buf, size_t __len) __THROW __nonnull ((3, 4, 5)); extern int qfcvt_r (long double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign, char *__restrict __buf, size_t __len) __THROW __nonnull ((3, 4, 5)); # endif /* misc */ #endif /* use MISC || use X/Open Unix */ __BEGIN_NAMESPACE_STD /* Return the length of the multibyte character in S, which is no longer than N. */ extern int mblen (const char *__s, size_t __n) __THROW __wur; /* Return the length of the given multibyte character, putting its `wchar_t' representation in *PWC. */ extern int mbtowc (wchar_t *__restrict __pwc, const char *__restrict __s, size_t __n) __THROW __wur; /* Put the multibyte character represented by WCHAR in S, returning its length. */ extern int wctomb (char *__s, wchar_t __wchar) __THROW __wur; /* Convert a multibyte string to a wide char string. */ extern size_t mbstowcs (wchar_t *__restrict __pwcs, const char *__restrict __s, size_t __n) __THROW; /* Convert a wide char string to multibyte string. */ extern size_t wcstombs (char *__restrict __s, const wchar_t *__restrict __pwcs, size_t __n) __THROW; __END_NAMESPACE_STD #ifdef __USE_SVID /* Determine whether the string value of RESPONSE matches the affirmation or negative response expression as specified by the LC_MESSAGES category in the program's current locale. Returns 1 if affirmative, 0 if negative, and -1 if not matching. */ extern int rpmatch (const char *__response) __THROW __nonnull ((1)) __wur; #endif #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 /* Parse comma separated suboption from *OPTIONP and match against strings in TOKENS. If found return index and set *VALUEP to optional value introduced by an equal sign. If the suboption is not part of TOKENS return in *VALUEP beginning of unknown suboption. On exit *OPTIONP is set to the beginning of the next token or at the terminating NUL character. */ extern int getsubopt (char **__restrict __optionp, char *const *__restrict __tokens, char **__restrict __valuep) __THROW __nonnull ((1, 2, 3)) __wur; #endif #ifdef __USE_XOPEN /* Setup DES tables according KEY. */ extern void setkey (const char *__key) __THROW __nonnull ((1)); #endif /* X/Open pseudo terminal handling. */ #ifdef __USE_XOPEN2KXSI /* Return a master pseudo-terminal handle. */ extern int posix_openpt (int __oflag) __wur; #endif #ifdef __USE_XOPEN /* The next four functions all take a master pseudo-tty fd and perform an operation on the associated slave: */ /* Chown the slave to the calling user. */ extern int grantpt (int __fd) __THROW; /* Release an internal lock so the slave can be opened. Call after grantpt(). */ extern int unlockpt (int __fd) __THROW; /* Return the pathname of the pseudo terminal slave assoicated with the master FD is open on, or NULL on errors. The returned storage is good until the next call to this function. */ extern char *ptsname (int __fd) __THROW __wur; #endif #ifdef __USE_GNU /* Store at most BUFLEN characters of the pathname of the slave pseudo terminal associated with the master FD is open on in BUF. Return 0 on success, otherwise an error number. */ extern int ptsname_r (int __fd, char *__buf, size_t __buflen) __THROW __nonnull ((2)); /* Open a master pseudo terminal and return its file descriptor. */ extern int getpt (void); #endif #ifdef __USE_BSD /* Put the 1 minute, 5 minute and 15 minute load averages into the first NELEM elements of LOADAVG. Return the number written (never more than three, but may be less than NELEM), or -1 if an error occurred. */ extern int getloadavg (double __loadavg[], int __nelem) __THROW __nonnull ((1)); #endif #include <bits/stdlib-float.h> /* Define some macros helping to catch buffer overflows. */ #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function # include <bits/stdlib.h> #endif #ifdef __LDBL_COMPAT # include <bits/stdlib-ldbl.h> #endif #endif /* don't just need malloc and calloc */ #undef __need_malloc_and_calloc __END_DECLS #endif /* stdlib.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������krb5.h����������������������������������������������������������������������������������������������0000644�����������������00000000622�14763166026�0005573 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* The MIT Kerberos header file krb5.h used to live here. As of the 1.5 release, we're installing multiple Kerberos headers, so they're all moving to a krb5/ subdirectory. This file is present just to keep old software still compiling. Please update your code to use the new path for the header. */ #include <krb5/krb5.h> ��������������������������������������������������������������������������������������������������������������bind9/dst/result.h����������������������������������������������������������������������������������0000644�����������������00000004134�14763166026�0010047 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DST_RESULT_H #define DST_RESULT_H 1 /*! \file dst/result.h */ #include <isc/lang.h> #include <isc/resultclass.h> /* * Nothing in this file truly depends on <isc/result.h>, but the * DST result codes are considered to be publicly derived from * the ISC result codes, so including this file buys you the ISC_R_ * namespace too. */ #include <isc/result.h> /* Contractual promise. */ #define DST_R_UNSUPPORTEDALG (ISC_RESULTCLASS_DST + 0) #define DST_R_CRYPTOFAILURE (ISC_RESULTCLASS_DST + 1) /* compat */ #define DST_R_OPENSSLFAILURE DST_R_CRYPTOFAILURE #define DST_R_NOCRYPTO (ISC_RESULTCLASS_DST + 2) #define DST_R_NULLKEY (ISC_RESULTCLASS_DST + 3) #define DST_R_INVALIDPUBLICKEY (ISC_RESULTCLASS_DST + 4) #define DST_R_INVALIDPRIVATEKEY (ISC_RESULTCLASS_DST + 5) /* 6 is unused */ #define DST_R_WRITEERROR (ISC_RESULTCLASS_DST + 7) #define DST_R_INVALIDPARAM (ISC_RESULTCLASS_DST + 8) /* 9 is unused */ /* 10 is unused */ #define DST_R_SIGNFAILURE (ISC_RESULTCLASS_DST + 11) /* 12 is unused */ /* 13 is unused */ #define DST_R_VERIFYFAILURE (ISC_RESULTCLASS_DST + 14) #define DST_R_NOTPUBLICKEY (ISC_RESULTCLASS_DST + 15) #define DST_R_NOTPRIVATEKEY (ISC_RESULTCLASS_DST + 16) #define DST_R_KEYCANNOTCOMPUTESECRET (ISC_RESULTCLASS_DST + 17) #define DST_R_COMPUTESECRETFAILURE (ISC_RESULTCLASS_DST + 18) #define DST_R_NORANDOMNESS (ISC_RESULTCLASS_DST + 19) #define DST_R_BADKEYTYPE (ISC_RESULTCLASS_DST + 20) #define DST_R_NOENGINE (ISC_RESULTCLASS_DST + 21) #define DST_R_EXTERNALKEY (ISC_RESULTCLASS_DST + 22) #define DST_R_NRESULTS 23 /* Number of results */ ISC_LANG_BEGINDECLS const char * dst_result_totext(isc_result_t); void dst_result_register(void); ISC_LANG_ENDDECLS #endif /* DST_RESULT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dst/lib.h�������������������������������������������������������������������������������������0000644�����������������00000001370�14763166026�0007276 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DST_LIB_H #define DST_LIB_H 1 /*! \file dst/lib.h */ #include <isc/types.h> #include <isc/lang.h> ISC_LANG_BEGINDECLS LIBDNS_EXTERNAL_DATA extern isc_msgcat_t *dst_msgcat; void dst_lib_initmsgcat(void); /* * Initialize the DST library's message catalog, dst_msgcat, if it * has not already been initialized. */ ISC_LANG_ENDDECLS #endif /* DST_LIB_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dst/dst.h�������������������������������������������������������������������������������������0000644�����������������00000061356�14763166026�0007334 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DST_DST_H #define DST_DST_H 1 /*! \file dst/dst.h */ #include <isc/lang.h> #include <isc/stdtime.h> #include <dns/types.h> #include <dns/log.h> #include <dns/name.h> #include <dns/secalg.h> #include <dns/ds.h> #include <dns/dsdigest.h> #include <dst/gssapi.h> ISC_LANG_BEGINDECLS /*** *** Types ***/ /*% * The dst_key structure is opaque. Applications should use the accessor * functions provided to retrieve key attributes. If an application needs * to set attributes, new accessor functions will be written. */ typedef struct dst_key dst_key_t; typedef struct dst_context dst_context_t; /* DST algorithm codes */ #define DST_ALG_UNKNOWN 0 #define DST_ALG_RSAMD5 1 #define DST_ALG_RSA DST_ALG_RSAMD5 /*%< backwards compatibility */ #define DST_ALG_DH 2 #define DST_ALG_DSA 3 #define DST_ALG_ECC 4 #define DST_ALG_RSASHA1 5 #define DST_ALG_NSEC3DSA 6 #define DST_ALG_NSEC3RSASHA1 7 #define DST_ALG_RSASHA256 8 #define DST_ALG_RSASHA512 10 #define DST_ALG_ECCGOST 12 #define DST_ALG_ECDSA256 13 #define DST_ALG_ECDSA384 14 #define DST_ALG_ED25519 15 #define DST_ALG_ED448 16 #define DST_ALG_HMACMD5 157 #define DST_ALG_GSSAPI 160 #define DST_ALG_HMACSHA1 161 /* XXXMPA */ #define DST_ALG_HMACSHA224 162 /* XXXMPA */ #define DST_ALG_HMACSHA256 163 /* XXXMPA */ #define DST_ALG_HMACSHA384 164 /* XXXMPA */ #define DST_ALG_HMACSHA512 165 /* XXXMPA */ #define DST_ALG_INDIRECT 252 #define DST_ALG_PRIVATE 254 #define DST_MAX_ALGS 256 /*% A buffer of this size is large enough to hold any key */ #define DST_KEY_MAXSIZE 1280 /*% * A buffer of this size is large enough to hold the textual representation * of any key */ #define DST_KEY_MAXTEXTSIZE 2048 /*% 'Type' for dst_read_key() */ #define DST_TYPE_KEY 0x1000000 /* KEY key */ #define DST_TYPE_PRIVATE 0x2000000 #define DST_TYPE_PUBLIC 0x4000000 /* Key timing metadata definitions */ #define DST_TIME_CREATED 0 #define DST_TIME_PUBLISH 1 #define DST_TIME_ACTIVATE 2 #define DST_TIME_REVOKE 3 #define DST_TIME_INACTIVE 4 #define DST_TIME_DELETE 5 #define DST_TIME_DSPUBLISH 6 #define DST_TIME_SYNCPUBLISH 7 #define DST_TIME_SYNCDELETE 8 #define DST_MAX_TIMES 8 /* Numeric metadata definitions */ #define DST_NUM_PREDECESSOR 0 #define DST_NUM_SUCCESSOR 1 #define DST_NUM_MAXTTL 2 #define DST_NUM_ROLLPERIOD 3 #define DST_MAX_NUMERIC 3 /* * Current format version number of the private key parser. * * When parsing a key file with the same major number but a higher minor * number, the key parser will ignore any fields it does not recognize. * Thus, DST_MINOR_VERSION should be incremented whenever new * fields are added to the private key file (such as new metadata). * * When rewriting these keys, those fields will be dropped, and the * format version set back to the current one.. * * When a key is seen with a higher major number, the key parser will * reject it as invalid. Thus, DST_MAJOR_VERSION should be incremented * and DST_MINOR_VERSION set to zero whenever there is a format change * which is not backward compatible to previous versions of the dst_key * parser, such as change in the syntax of an existing field, the removal * of a currently mandatory field, or a new field added which would * alter the functioning of the key if it were absent. */ #define DST_MAJOR_VERSION 1 #define DST_MINOR_VERSION 3 /*** *** Functions ***/ isc_result_t dst_lib_init(isc_mem_t *mctx, isc_entropy_t *ectx, unsigned int eflags); isc_result_t dst_lib_init2(isc_mem_t *mctx, isc_entropy_t *ectx, const char *engine, unsigned int eflags); /*%< * Initializes the DST subsystem. * * Requires: * \li "mctx" is a valid memory context * \li "ectx" is a valid entropy context * * Returns: * \li ISC_R_SUCCESS * \li ISC_R_NOMEMORY * \li DST_R_NOENGINE * * Ensures: * \li DST is properly initialized. */ void dst_lib_destroy(void); /*%< * Releases all resources allocated by DST. */ isc_boolean_t dst_algorithm_supported(unsigned int alg); /*%< * Checks that a given algorithm is supported by DST. * * Returns: * \li ISC_TRUE * \li ISC_FALSE */ isc_boolean_t dst_ds_digest_supported(unsigned int digest_type); /*%< * Checks that a given digest algorithm is supported by DST. * * Returns: * \li ISC_TRUE * \li ISC_FALSE */ isc_result_t dst_context_create(dst_key_t *key, isc_mem_t *mctx, dst_context_t **dctxp); isc_result_t dst_context_create2(dst_key_t *key, isc_mem_t *mctx, isc_logcategory_t *category, dst_context_t **dctxp); isc_result_t dst_context_create3(dst_key_t *key, isc_mem_t *mctx, isc_logcategory_t *category, isc_boolean_t useforsigning, dst_context_t **dctxp); isc_result_t dst_context_create4(dst_key_t *key, isc_mem_t *mctx, isc_logcategory_t *category, isc_boolean_t useforsigning, int maxbits, dst_context_t **dctxp); /*%< * Creates a context to be used for a sign or verify operation. * * Requires: * \li "key" is a valid key. * \li "mctx" is a valid memory context. * \li dctxp != NULL && *dctxp == NULL * * Returns: * \li ISC_R_SUCCESS * \li ISC_R_NOMEMORY * * Ensures: * \li *dctxp will contain a usable context. */ void dst_context_destroy(dst_context_t **dctxp); /*%< * Destroys all memory associated with a context. * * Requires: * \li *dctxp != NULL && *dctxp == NULL * * Ensures: * \li *dctxp == NULL */ isc_result_t dst_context_adddata(dst_context_t *dctx, const isc_region_t *data); /*%< * Incrementally adds data to the context to be used in a sign or verify * operation. * * Requires: * \li "dctx" is a valid context * \li "data" is a valid region * * Returns: * \li ISC_R_SUCCESS * \li DST_R_SIGNFAILURE * \li all other errors indicate failure */ isc_result_t dst_context_sign(dst_context_t *dctx, isc_buffer_t *sig); /*%< * Computes a signature using the data and key stored in the context. * * Requires: * \li "dctx" is a valid context. * \li "sig" is a valid buffer. * * Returns: * \li ISC_R_SUCCESS * \li DST_R_VERIFYFAILURE * \li all other errors indicate failure * * Ensures: * \li "sig" will contain the signature */ isc_result_t dst_context_verify(dst_context_t *dctx, isc_region_t *sig); isc_result_t dst_context_verify2(dst_context_t *dctx, unsigned int maxbits, isc_region_t *sig); /*%< * Verifies the signature using the data and key stored in the context. * * 'maxbits' specifies the maximum number of bits permitted in the RSA * exponent. * * Requires: * \li "dctx" is a valid context. * \li "sig" is a valid region. * * Returns: * \li ISC_R_SUCCESS * \li all other errors indicate failure * * Ensures: * \li "sig" will contain the signature */ isc_result_t dst_key_computesecret(const dst_key_t *pub, const dst_key_t *priv, isc_buffer_t *secret); /*%< * Computes a shared secret from two (Diffie-Hellman) keys. * * Requires: * \li "pub" is a valid key that can be used to derive a shared secret * \li "priv" is a valid private key that can be used to derive a shared secret * \li "secret" is a valid buffer * * Returns: * \li ISC_R_SUCCESS * \li any other result indicates failure * * Ensures: * \li If successful, secret will contain the derived shared secret. */ isc_result_t dst_key_getfilename(dns_name_t *name, dns_keytag_t id, unsigned int alg, int type, const char *directory, isc_mem_t *mctx, isc_buffer_t *buf); /*%< * Generates a key filename for the name, algorithm, and * id, and places it in the buffer 'buf'. If directory is NULL, the * current directory is assumed. * * Requires: * \li "name" is a valid absolute dns name. * \li "id" is a valid key tag identifier. * \li "alg" is a supported key algorithm. * \li "type" is DST_TYPE_PUBLIC, DST_TYPE_PRIVATE, or the bitwise union. * DST_TYPE_KEY look for a KEY record otherwise DNSKEY * \li "mctx" is a valid memory context. * \li "buf" is not NULL. * * Returns: * \li ISC_R_SUCCESS * \li any other result indicates failure */ isc_result_t dst_key_fromfile(dns_name_t *name, dns_keytag_t id, unsigned int alg, int type, const char *directory, isc_mem_t *mctx, dst_key_t **keyp); /*%< * Reads a key from permanent storage. The key can either be a public or * private key, and is specified by name, algorithm, and id. If a private key * is specified, the public key must also be present. If directory is NULL, * the current directory is assumed. * * Requires: * \li "name" is a valid absolute dns name. * \li "id" is a valid key tag identifier. * \li "alg" is a supported key algorithm. * \li "type" is DST_TYPE_PUBLIC, DST_TYPE_PRIVATE, or the bitwise union. * DST_TYPE_KEY look for a KEY record otherwise DNSKEY * \li "mctx" is a valid memory context. * \li "keyp" is not NULL and "*keyp" is NULL. * * Returns: * \li ISC_R_SUCCESS * \li any other result indicates failure * * Ensures: * \li If successful, *keyp will contain a valid key. */ isc_result_t dst_key_fromnamedfile(const char *filename, const char *dirname, int type, isc_mem_t *mctx, dst_key_t **keyp); /*%< * Reads a key from permanent storage. The key can either be a public or * key, and is specified by filename. If a private key is specified, the * public key must also be present. * * If 'dirname' is not NULL, and 'filename' is a relative path, * then the file is looked up relative to the given directory. * If 'filename' is an absolute path, 'dirname' is ignored. * * Requires: * \li "filename" is not NULL * \li "type" is DST_TYPE_PUBLIC, DST_TYPE_PRIVATE, or the bitwise union * DST_TYPE_KEY look for a KEY record otherwise DNSKEY * \li "mctx" is a valid memory context * \li "keyp" is not NULL and "*keyp" is NULL. * * Returns: * \li ISC_R_SUCCESS * \li any other result indicates failure * * Ensures: * \li If successful, *keyp will contain a valid key. */ isc_result_t dst_key_read_public(const char *filename, int type, isc_mem_t *mctx, dst_key_t **keyp); /*%< * Reads a public key from permanent storage. The key must be a public key. * * Requires: * \li "filename" is not NULL * \li "type" is DST_TYPE_KEY look for a KEY record otherwise DNSKEY * \li "mctx" is a valid memory context * \li "keyp" is not NULL and "*keyp" is NULL. * * Returns: * \li ISC_R_SUCCESS * \li DST_R_BADKEYTYPE if the key type is not the expected one * \li ISC_R_UNEXPECTEDTOKEN if the file can not be parsed as a public key * \li any other result indicates failure * * Ensures: * \li If successful, *keyp will contain a valid key. */ isc_result_t dst_key_tofile(const dst_key_t *key, int type, const char *directory); /*%< * Writes a key to permanent storage. The key can either be a public or * private key. Public keys are written in DNS format and private keys * are written as a set of base64 encoded values. If directory is NULL, * the current directory is assumed. * * Requires: * \li "key" is a valid key. * \li "type" is DST_TYPE_PUBLIC, DST_TYPE_PRIVATE, or the bitwise union * * Returns: * \li ISC_R_SUCCESS * \li any other result indicates failure */ isc_result_t dst_key_fromdns(dns_name_t *name, dns_rdataclass_t rdclass, isc_buffer_t *source, isc_mem_t *mctx, dst_key_t **keyp); /*%< * Converts a DNS KEY record into a DST key. * * Requires: * \li "name" is a valid absolute dns name. * \li "source" is a valid buffer. There must be at least 4 bytes available. * \li "mctx" is a valid memory context. * \li "keyp" is not NULL and "*keyp" is NULL. * * Returns: * \li ISC_R_SUCCESS * \li any other result indicates failure * * Ensures: * \li If successful, *keyp will contain a valid key, and the consumed * pointer in data will be advanced. */ isc_result_t dst_key_todns(const dst_key_t *key, isc_buffer_t *target); /*%< * Converts a DST key into a DNS KEY record. * * Requires: * \li "key" is a valid key. * \li "target" is a valid buffer. There must be at least 4 bytes unused. * * Returns: * \li ISC_R_SUCCESS * \li any other result indicates failure * * Ensures: * \li If successful, the used pointer in 'target' is advanced by at least 4. */ isc_result_t dst_key_frombuffer(dns_name_t *name, unsigned int alg, unsigned int flags, unsigned int protocol, dns_rdataclass_t rdclass, isc_buffer_t *source, isc_mem_t *mctx, dst_key_t **keyp); /*%< * Converts a buffer containing DNS KEY RDATA into a DST key. * * Requires: *\li "name" is a valid absolute dns name. *\li "alg" is a supported key algorithm. *\li "source" is a valid buffer. *\li "mctx" is a valid memory context. *\li "keyp" is not NULL and "*keyp" is NULL. * * Returns: *\li ISC_R_SUCCESS * \li any other result indicates failure * * Ensures: *\li If successful, *keyp will contain a valid key, and the consumed * pointer in source will be advanced. */ isc_result_t dst_key_tobuffer(const dst_key_t *key, isc_buffer_t *target); /*%< * Converts a DST key into DNS KEY RDATA format. * * Requires: *\li "key" is a valid key. *\li "target" is a valid buffer. * * Returns: *\li ISC_R_SUCCESS * \li any other result indicates failure * * Ensures: *\li If successful, the used pointer in 'target' is advanced. */ isc_result_t dst_key_privatefrombuffer(dst_key_t *key, isc_buffer_t *buffer); /*%< * Converts a public key into a private key, reading the private key * information from the buffer. The buffer should contain the same data * as the .private key file would. * * Requires: *\li "key" is a valid public key. *\li "buffer" is not NULL. * * Returns: *\li ISC_R_SUCCESS * \li any other result indicates failure * * Ensures: *\li If successful, key will contain a valid private key. */ gss_ctx_id_t dst_key_getgssctx(const dst_key_t *key); /*%< * Returns the opaque key data. * Be cautions when using this value unless you know what you are doing. * * Requires: *\li "key" is not NULL. * * Returns: *\li gssctx key data, possibly NULL. */ isc_result_t dst_key_fromgssapi(dns_name_t *name, gss_ctx_id_t gssctx, isc_mem_t *mctx, dst_key_t **keyp, isc_region_t *intoken); /*%< * Converts a GSSAPI opaque context id into a DST key. * * Requires: *\li "name" is a valid absolute dns name. *\li "gssctx" is a GSSAPI context id. *\li "mctx" is a valid memory context. *\li "keyp" is not NULL and "*keyp" is NULL. * * Returns: *\li ISC_R_SUCCESS * \li any other result indicates failure * * Ensures: *\li If successful, *keyp will contain a valid key and be responsible for * the context id. */ #ifdef DST_KEY_INTERNAL isc_result_t dst_key_buildinternal(dns_name_t *name, unsigned int alg, unsigned int bits, unsigned int flags, unsigned int protocol, dns_rdataclass_t rdclass, void *data, isc_mem_t *mctx, dst_key_t **keyp); #endif isc_result_t dst_key_fromlabel(dns_name_t *name, int alg, unsigned int flags, unsigned int protocol, dns_rdataclass_t rdclass, const char *engine, const char *label, const char *pin, isc_mem_t *mctx, dst_key_t **keyp); isc_result_t dst_key_generate(dns_name_t *name, unsigned int alg, unsigned int bits, unsigned int param, unsigned int flags, unsigned int protocol, dns_rdataclass_t rdclass, isc_mem_t *mctx, dst_key_t **keyp); isc_result_t dst_key_generate2(dns_name_t *name, unsigned int alg, unsigned int bits, unsigned int param, unsigned int flags, unsigned int protocol, dns_rdataclass_t rdclass, isc_mem_t *mctx, dst_key_t **keyp, void (*callback)(int)); /*%< * Generate a DST key (or keypair) with the supplied parameters. The * interpretation of the "param" field depends on the algorithm: * \code * RSA: exponent * 0 use exponent 3 * !0 use Fermat4 (2^16 + 1) * DH: generator * 0 default - use well known prime if bits == 768 or 1024, * otherwise use 2 as the generator. * !0 use this value as the generator. * DSA: unused * HMACMD5: entropy * 0 default - require good entropy * !0 lack of good entropy is ok *\endcode * * Requires: *\li "name" is a valid absolute dns name. *\li "keyp" is not NULL and "*keyp" is NULL. * * Returns: *\li ISC_R_SUCCESS * \li any other result indicates failure * * Ensures: *\li If successful, *keyp will contain a valid key. */ isc_boolean_t dst_key_compare(const dst_key_t *key1, const dst_key_t *key2); /*%< * Compares two DST keys. Returns true if they match, false otherwise. * * Keys ARE NOT considered to match if one of them is the revoked version * of the other. * * Requires: *\li "key1" is a valid key. *\li "key2" is a valid key. * * Returns: *\li ISC_TRUE * \li ISC_FALSE */ isc_boolean_t dst_key_pubcompare(const dst_key_t *key1, const dst_key_t *key2, isc_boolean_t match_revoked_key); /*%< * Compares only the public portions of two DST keys. Returns true * if they match, false otherwise. This allows us, for example, to * determine whether a public key found in a zone matches up with a * key pair found on disk. * * If match_revoked_key is TRUE, then keys ARE considered to match if one * of them is the revoked version of the other. Otherwise, they are not. * * Requires: *\li "key1" is a valid key. *\li "key2" is a valid key. * * Returns: *\li ISC_TRUE * \li ISC_FALSE */ isc_boolean_t dst_key_paramcompare(const dst_key_t *key1, const dst_key_t *key2); /*%< * Compares the parameters of two DST keys. This is used to determine if * two (Diffie-Hellman) keys can be used to derive a shared secret. * * Requires: *\li "key1" is a valid key. *\li "key2" is a valid key. * * Returns: *\li ISC_TRUE * \li ISC_FALSE */ void dst_key_attach(dst_key_t *source, dst_key_t **target); /* * Attach to a existing key increasing the reference count. * * Requires: *\li 'source' to be a valid key. *\li 'target' to be non-NULL and '*target' to be NULL. */ void dst_key_free(dst_key_t **keyp); /*%< * Decrement the key's reference counter and, when it reaches zero, * release all memory associated with the key. * * Requires: *\li "keyp" is not NULL and "*keyp" is a valid key. *\li reference counter greater than zero. * * Ensures: *\li All memory associated with "*keyp" will be freed. *\li *keyp == NULL */ /*%< * Accessor functions to obtain key fields. * * Require: *\li "key" is a valid key. */ dns_name_t * dst_key_name(const dst_key_t *key); unsigned int dst_key_size(const dst_key_t *key); unsigned int dst_key_proto(const dst_key_t *key); unsigned int dst_key_alg(const dst_key_t *key); isc_uint32_t dst_key_flags(const dst_key_t *key); dns_keytag_t dst_key_id(const dst_key_t *key); dns_keytag_t dst_key_rid(const dst_key_t *key); dns_rdataclass_t dst_key_class(const dst_key_t *key); isc_boolean_t dst_key_isprivate(const dst_key_t *key); isc_boolean_t dst_key_iszonekey(const dst_key_t *key); isc_boolean_t dst_key_isnullkey(const dst_key_t *key); isc_result_t dst_key_buildfilename(const dst_key_t *key, int type, const char *directory, isc_buffer_t *out); /*%< * Generates the filename used by dst to store the specified key. * If directory is NULL, the current directory is assumed. * * Requires: *\li "key" is a valid key *\li "type" is either DST_TYPE_PUBLIC, DST_TYPE_PRIVATE, or 0 for no suffix. *\li "out" is a valid buffer * * Ensures: *\li the file name will be written to "out", and the used pointer will * be advanced. */ isc_result_t dst_key_sigsize(const dst_key_t *key, unsigned int *n); /*%< * Computes the size of a signature generated by the given key. * * Requires: *\li "key" is a valid key. *\li "n" is not NULL * * Returns: *\li #ISC_R_SUCCESS *\li DST_R_UNSUPPORTEDALG * * Ensures: *\li "n" stores the size of a generated signature */ isc_result_t dst_key_secretsize(const dst_key_t *key, unsigned int *n); /*%< * Computes the size of a shared secret generated by the given key. * * Requires: *\li "key" is a valid key. *\li "n" is not NULL * * Returns: *\li #ISC_R_SUCCESS *\li DST_R_UNSUPPORTEDALG * * Ensures: *\li "n" stores the size of a generated shared secret */ isc_uint16_t dst_region_computeid(const isc_region_t *source, unsigned int alg); isc_uint16_t dst_region_computerid(const isc_region_t *source, unsigned int alg); /*%< * Computes the (revoked) key id of the key stored in the provided * region with the given algorithm. * * Requires: *\li "source" contains a valid, non-NULL region. * * Returns: *\li the key id */ isc_uint16_t dst_key_getbits(const dst_key_t *key); /*%< * Get the number of digest bits required (0 == MAX). * * Requires: * "key" is a valid key. */ void dst_key_setbits(dst_key_t *key, isc_uint16_t bits); /*%< * Set the number of digest bits required (0 == MAX). * * Requires: * "key" is a valid key. */ void dst_key_setttl(dst_key_t *key, dns_ttl_t ttl); /*%< * Set the default TTL to use when converting the key * to a KEY or DNSKEY RR. * * Requires: * "key" is a valid key. */ dns_ttl_t dst_key_getttl(const dst_key_t *key); /*%< * Get the default TTL to use when converting the key * to a KEY or DNSKEY RR. * * Requires: * "key" is a valid key. */ isc_result_t dst_key_setflags(dst_key_t *key, isc_uint32_t flags); /* * Set the key flags, and recompute the key ID. * * Requires: * "key" is a valid key. */ isc_result_t dst_key_getnum(const dst_key_t *key, int type, isc_uint32_t *valuep); /*%< * Get a member of the numeric metadata array and place it in '*valuep'. * * Requires: * "key" is a valid key. * "type" is no larger than DST_MAX_NUMERIC * "timep" is not null. */ void dst_key_setnum(dst_key_t *key, int type, isc_uint32_t value); /*%< * Set a member of the numeric metadata array. * * Requires: * "key" is a valid key. * "type" is no larger than DST_MAX_NUMERIC */ void dst_key_unsetnum(dst_key_t *key, int type); /*%< * Flag a member of the numeric metadata array as "not set". * * Requires: * "key" is a valid key. * "type" is no larger than DST_MAX_NUMERIC */ isc_result_t dst_key_gettime(const dst_key_t *key, int type, isc_stdtime_t *timep); /*%< * Get a member of the timing metadata array and place it in '*timep'. * * Requires: * "key" is a valid key. * "type" is no larger than DST_MAX_TIMES * "timep" is not null. */ void dst_key_settime(dst_key_t *key, int type, isc_stdtime_t when); /*%< * Set a member of the timing metadata array. * * Requires: * "key" is a valid key. * "type" is no larger than DST_MAX_TIMES */ void dst_key_unsettime(dst_key_t *key, int type); /*%< * Flag a member of the timing metadata array as "not set". * * Requires: * "key" is a valid key. * "type" is no larger than DST_MAX_TIMES */ isc_result_t dst_key_getprivateformat(const dst_key_t *key, int *majorp, int *minorp); /*%< * Get the private key format version number. (If the key does not have * a private key associated with it, the version will be 0.0.) The major * version number is placed in '*majorp', and the minor version number in * '*minorp'. * * Requires: * "key" is a valid key. * "majorp" is not NULL. * "minorp" is not NULL. */ void dst_key_setprivateformat(dst_key_t *key, int major, int minor); /*%< * Set the private key format version number. * * Requires: * "key" is a valid key. */ #define DST_KEY_FORMATSIZE (DNS_NAME_FORMATSIZE + DNS_SECALG_FORMATSIZE + 7) void dst_key_format(const dst_key_t *key, char *cp, unsigned int size); /*%< * Write the uniquely identifying information about the key (name, * algorithm, key ID) into a string 'cp' of size 'size'. */ isc_buffer_t * dst_key_tkeytoken(const dst_key_t *key); /*%< * Return the token from the TKEY request, if any. If this key was * not negotiated via TKEY, return NULL. * * Requires: * "key" is a valid key. */ isc_result_t dst_key_dump(dst_key_t *key, isc_mem_t *mctx, char **buffer, int *length); /*%< * Allocate 'buffer' and dump the key into it in base64 format. The buffer * is not NUL terminated. The length of the buffer is returned in *length. * * 'buffer' needs to be freed using isc_mem_put(mctx, buffer, length); * * Requires: * 'buffer' to be non NULL and *buffer to be NULL. * 'length' to be non NULL and *length to be zero. * * Returns: * ISC_R_SUCCESS * ISC_R_NOMEMORY * ISC_R_NOTIMPLEMENTED * others. */ isc_result_t dst_key_restore(dns_name_t *name, unsigned int alg, unsigned int flags, unsigned int protocol, dns_rdataclass_t rdclass, isc_mem_t *mctx, const char *keystr, dst_key_t **keyp); isc_boolean_t dst_key_inactive(const dst_key_t *key); /*%< * Determines if the private key is missing due the key being deemed inactive. * * Requires: * 'key' to be valid. */ void dst_key_setinactive(dst_key_t *key, isc_boolean_t inactive); /*%< * Set key inactive state. * * Requires: * 'key' to be valid. */ void dst_key_setexternal(dst_key_t *key, isc_boolean_t value); isc_boolean_t dst_key_isexternal(dst_key_t *key); ISC_LANG_ENDDECLS #endif /* DST_DST_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dst/gssapi.h����������������������������������������������������������������������������������0000644�����������������00000013316�14763166026�0010021 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DST_GSSAPI_H #define DST_GSSAPI_H 1 /*! \file dst/gssapi.h */ #include <isc/formatcheck.h> #include <isc/lang.h> #include <isc/platform.h> #include <isc/types.h> #include <dns/types.h> #ifdef GSSAPI #ifdef WIN32 /* * MSVC does not like macros in #include lines. */ #include <gssapi/gssapi.h> #include <gssapi/gssapi_krb5.h> #else #include ISC_PLATFORM_GSSAPIHEADER #ifdef ISC_PLATFORM_GSSAPI_KRB5_HEADER #include ISC_PLATFORM_GSSAPI_KRB5_HEADER #endif #endif #ifndef GSS_SPNEGO_MECHANISM #define GSS_SPNEGO_MECHANISM ((void*)0) #endif #endif ISC_LANG_BEGINDECLS /*** *** Types ***/ /*** *** Functions ***/ isc_result_t dst_gssapi_acquirecred(dns_name_t *name, isc_boolean_t initiate, gss_cred_id_t *cred); /* * Acquires GSS credentials. * * Requires: * 'name' is a valid name, preferably one known by the GSS provider * 'initiate' indicates whether the credentials are for initiating or * accepting contexts * 'cred' is a pointer to NULL, which will be allocated with the * credential handle. Call dst_gssapi_releasecred to free * the memory. * * Returns: * ISC_R_SUCCESS msg was successfully updated to include the * query to be sent * other an error occurred while building the message */ isc_result_t dst_gssapi_releasecred(gss_cred_id_t *cred); /* * Releases GSS credentials. Calling this function does release the * memory allocated for the credential in dst_gssapi_acquirecred() * * Requires: * 'mctx' is a valid memory context * 'cred' is a pointer to the credential to be released * * Returns: * ISC_R_SUCCESS credential was released successfully * other an error occurred while releaseing * the credential */ isc_result_t dst_gssapi_initctx(dns_name_t *name, isc_buffer_t *intoken, isc_buffer_t *outtoken, gss_ctx_id_t *gssctx, isc_mem_t *mctx, char **err_message); /* * Initiates a GSS context. * * Requires: * 'name' is a valid name, preferably one known by the GSS * provider * 'intoken' is a token received from the acceptor, or NULL if * there isn't one * 'outtoken' is a buffer to receive the token generated by * gss_init_sec_context() to be sent to the acceptor * 'context' is a pointer to a valid gss_ctx_id_t * (which may have the value GSS_C_NO_CONTEXT) * * Returns: * ISC_R_SUCCESS msg was successfully updated to include the * query to be sent * other an error occurred while building the message * *err_message optional error message */ isc_result_t dst_gssapi_acceptctx(gss_cred_id_t cred, const char *gssapi_keytab, isc_region_t *intoken, isc_buffer_t **outtoken, gss_ctx_id_t *context, dns_name_t *principal, isc_mem_t *mctx); /* * Accepts a GSS context. * * Requires: * 'mctx' is a valid memory context * 'cred' is the acceptor's valid GSS credential handle * 'intoken' is a token received from the initiator * 'outtoken' is a pointer a buffer pointer used to return the token * generated by gss_accept_sec_context() to be sent to the * initiator * 'context' is a valid pointer to receive the generated context handle. * On the initial call, it should be a pointer to NULL, which * will be allocated as a gss_ctx_id_t. Subsequent calls * should pass in the handle generated on the first call. * Call dst_gssapi_releasecred to delete the context and free * the memory. * * Requires: * 'outtoken' to != NULL && *outtoken == NULL. * * Returns: * ISC_R_SUCCESS msg was successfully updated to include the * query to be sent * DNS_R_CONTINUE transaction still in progress * other an error occurred while building the message */ isc_result_t dst_gssapi_deletectx(isc_mem_t *mctx, gss_ctx_id_t *gssctx); /* * Destroys a GSS context. This function deletes the context from the GSS * provider and then frees the memory used by the context pointer. * * Requires: * 'mctx' is a valid memory context * 'context' is a valid GSS context * * Returns: * ISC_R_SUCCESS */ void gss_log(int level, const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3); /* * Logging function for GSS. * * Requires * 'level' is the log level to be used, as an integer * 'fmt' is a printf format specifier */ char * gss_error_tostring(isc_uint32_t major, isc_uint32_t minor, char *buf, size_t buflen); /* * Render a GSS major status/minor status pair into a string * * Requires: * 'major' is a GSS major status code * 'minor' is a GSS minor status code * * Returns: * A string containing the text representation of the error codes. * Users should copy the string if they wish to keep it. */ isc_boolean_t dst_gssapi_identitymatchesrealmkrb5(dns_name_t *signer, dns_name_t *name, dns_name_t *realm); /* * Compare a "signer" (in the format of a Kerberos-format Kerberos5 * principal: host/example.com@EXAMPLE.COM) to the realm name stored * in "name" (which represents the realm name). * */ isc_boolean_t dst_gssapi_identitymatchesrealmms(dns_name_t *signer, dns_name_t *name, dns_name_t *realm); /* * Compare a "signer" (in the format of a Kerberos-format Kerberos5 * principal: host/example.com@EXAMPLE.COM) to the realm name stored * in "name" (which represents the realm name). * */ ISC_LANG_ENDDECLS #endif /* DST_GSSAPI_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isccc/version.h�������������������������������������������������������������������������������0000644�����������������00000001302�14763166026�0010502 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! \file isccc/version.h */ #include <isc/platform.h> LIBISCCC_EXTERNAL_DATA extern const char isccc_version[]; LIBISCCC_EXTERNAL_DATA extern const unsigned int isccc_libinterface; LIBISCCC_EXTERNAL_DATA extern const unsigned int isccc_librevision; LIBISCCC_EXTERNAL_DATA extern const unsigned int isccc_libage; ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isccc/types.h���������������������������������������������������������������������������������0000644�����������������00000003357�14763166026�0010175 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Portions Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. * * Portions Copyright (C) 2001 Nominum, Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef ISCCC_TYPES_H #define ISCCC_TYPES_H 1 /*! \file isccc/types.h */ #include <isc/boolean.h> #include <isc/int.h> #include <isc/result.h> /*% isccc_time_t typedef */ typedef isc_uint32_t isccc_time_t; /*% isccc_sexpr_t typedef */ typedef struct isccc_sexpr isccc_sexpr_t; /*% isccc_dottedpair_t typedef */ typedef struct isccc_dottedpair isccc_dottedpair_t; /*% isccc_symtab_t typedef */ typedef struct isccc_symtab isccc_symtab_t; /*% iscc region structure */ typedef struct isccc_region { unsigned char * rstart; unsigned char * rend; } isccc_region_t; #endif /* ISCCC_TYPES_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isccc/alist.h���������������������������������������������������������������������������������0000644�����������������00000004533�14763166026�0010142 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Portions Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. * * Portions Copyright (C) 2001 Nominum, Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef ISCCC_ALIST_H #define ISCCC_ALIST_H 1 /*! \file isccc/alist.h */ #include <stdio.h> #include <isc/lang.h> #include <isccc/types.h> ISC_LANG_BEGINDECLS isccc_sexpr_t * isccc_alist_create(void); isc_boolean_t isccc_alist_alistp(isccc_sexpr_t *alist); isc_boolean_t isccc_alist_emptyp(isccc_sexpr_t *alist); isccc_sexpr_t * isccc_alist_first(isccc_sexpr_t *alist); isccc_sexpr_t * isccc_alist_assq(isccc_sexpr_t *alist, const char *key); void isccc_alist_delete(isccc_sexpr_t *alist, const char *key); isccc_sexpr_t * isccc_alist_define(isccc_sexpr_t *alist, const char *key, isccc_sexpr_t *value); isccc_sexpr_t * isccc_alist_definestring(isccc_sexpr_t *alist, const char *key, const char *str); isccc_sexpr_t * isccc_alist_definebinary(isccc_sexpr_t *alist, const char *key, isccc_region_t *r); isccc_sexpr_t * isccc_alist_lookup(isccc_sexpr_t *alist, const char *key); isc_result_t isccc_alist_lookupstring(isccc_sexpr_t *alist, const char *key, char **strp); isc_result_t isccc_alist_lookupbinary(isccc_sexpr_t *alist, const char *key, isccc_region_t **r); void isccc_alist_prettyprint(isccc_sexpr_t *sexpr, unsigned int indent, FILE *stream); ISC_LANG_ENDDECLS #endif /* ISCCC_ALIST_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isccc/ccmsg.h���������������������������������������������������������������������������������0000644�����������������00000007054�14763166026�0010123 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Portions Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. * * Portions Copyright (C) 2001 Nominum, Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef ISCCC_CCMSG_H #define ISCCC_CCMSG_H 1 /*! \file isccc/ccmsg.h */ #include <isc/buffer.h> #include <isc/lang.h> #include <isc/socket.h> /*% ISCCC Message Structure */ typedef struct isccc_ccmsg { /* private (don't touch!) */ unsigned int magic; isc_uint32_t size; isc_buffer_t buffer; unsigned int maxsize; isc_mem_t *mctx; isc_socket_t *sock; isc_task_t *task; isc_taskaction_t action; void *arg; isc_event_t event; /* public (read-only) */ isc_result_t result; isc_sockaddr_t address; } isccc_ccmsg_t; ISC_LANG_BEGINDECLS void isccc_ccmsg_init(isc_mem_t *mctx, isc_socket_t *sock, isccc_ccmsg_t *ccmsg); /*% * Associate a cc message state with a given memory context and * TCP socket. * * Requires: * *\li "mctx" and "sock" be non-NULL and valid types. * *\li "sock" be a read/write TCP socket. * *\li "ccmsg" be non-NULL and an uninitialized or invalidated structure. * * Ensures: * *\li "ccmsg" is a valid structure. */ void isccc_ccmsg_setmaxsize(isccc_ccmsg_t *ccmsg, unsigned int maxsize); /*% * Set the maximum packet size to "maxsize" * * Requires: * *\li "ccmsg" be valid. * *\li 512 <= "maxsize" <= 4294967296 */ isc_result_t isccc_ccmsg_readmessage(isccc_ccmsg_t *ccmsg, isc_task_t *task, isc_taskaction_t action, void *arg); /*% * Schedule an event to be delivered when a command channel message is * readable, or when an error occurs on the socket. * * Requires: * *\li "ccmsg" be valid. * *\li "task", "taskaction", and "arg" be valid. * * Returns: * *\li #ISC_R_SUCCESS -- no error *\li Anything that the isc_socket_recv() call can return. XXXMLG * * Notes: * *\li The event delivered is a fully generic event. It will contain no * actual data. The sender will be a pointer to the isccc_ccmsg_t. * The result code inside that structure should be checked to see * what the final result was. */ void isccc_ccmsg_cancelread(isccc_ccmsg_t *ccmsg); /*% * Cancel a readmessage() call. The event will still be posted with a * CANCELED result code. * * Requires: * *\li "ccmsg" be valid. */ void isccc_ccmsg_invalidate(isccc_ccmsg_t *ccmsg); /*% * Clean up all allocated state, and invalidate the structure. * * Requires: * *\li "ccmsg" be valid. * * Ensures: * *\li "ccmsg" is invalidated and disassociated with all memory contexts, * sockets, etc. */ ISC_LANG_ENDDECLS #endif /* ISCCC_CCMSG_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isccc/result.h��������������������������������������������������������������������������������0000644�����������������00000004070�14763166026�0010340 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Portions Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. * * Portions Copyright (C) 2001 Nominum, Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef ISCCC_RESULT_H #define ISCCC_RESULT_H 1 /*! \file isccc/result.h */ #include <isc/lang.h> #include <isc/resultclass.h> #include <isc/result.h> #include <isccc/types.h> /*% Unknown Version */ #define ISCCC_R_UNKNOWNVERSION (ISC_RESULTCLASS_ISCCC + 0) /*% Syntax Error */ #define ISCCC_R_SYNTAX (ISC_RESULTCLASS_ISCCC + 1) /*% Bad Authorization */ #define ISCCC_R_BADAUTH (ISC_RESULTCLASS_ISCCC + 2) /*% Expired */ #define ISCCC_R_EXPIRED (ISC_RESULTCLASS_ISCCC + 3) /*% Clock Skew */ #define ISCCC_R_CLOCKSKEW (ISC_RESULTCLASS_ISCCC + 4) /*% Duplicate */ #define ISCCC_R_DUPLICATE (ISC_RESULTCLASS_ISCCC + 5) #define ISCCC_R_NRESULTS 6 /*%< Number of results */ ISC_LANG_BEGINDECLS const char * isccc_result_totext(isc_result_t result); /*% * Convert a isccc_result_t into a string message describing the result. */ void isccc_result_register(void); ISC_LANG_ENDDECLS #endif /* ISCCC_RESULT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isccc/lib.h�����������������������������������������������������������������������������������0000644�����������������00000003037�14763166026�0007572 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Portions Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. * * Portions Copyright (C) 2001 Nominum, Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef ISCCC_LIB_H #define ISCCC_LIB_H 1 /*! \file isccc/lib.h */ #include <isc/types.h> #include <isc/lang.h> ISC_LANG_BEGINDECLS LIBISCCC_EXTERNAL_DATA extern isc_msgcat_t *isccc_msgcat; void isccc_lib_initmsgcat(void); /*% * Initialize the ISCCC library's message catalog, isccc_msgcat, if it * has not already been initialized. */ ISC_LANG_ENDDECLS #endif /* ISCCC_LIB_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isccc/base64.h��������������������������������������������������������������������������������0000644�����������������00000004605�14763166026�0010112 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Portions Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. * * Portions Copyright (C) 2001 Nominum, Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef ISCCC_BASE64_H #define ISCCC_BASE64_H 1 /*! \file isccc/base64.h */ #include <isc/lang.h> #include <isccc/types.h> ISC_LANG_BEGINDECLS /*** *** Functions ***/ isc_result_t isccc_base64_encode(isccc_region_t *source, int wordlength, const char *wordbreak, isccc_region_t *target); /*%< * Convert data into base64 encoded text. * * Notes: *\li The base64 encoded text in 'target' will be divided into * words of at most 'wordlength' characters, separated by * the 'wordbreak' string. No parentheses will surround * the text. * * Requires: *\li 'source' is a region containing binary data. *\li 'target' is a text region containing available space. *\li 'wordbreak' points to a null-terminated string of * zero or more whitespace characters. */ isc_result_t isccc_base64_decode(const char *cstr, isccc_region_t *target); /*%< * Decode a null-terminated base64 string. * * Requires: *\li 'cstr' is non-null. *\li 'target' is a valid region. * * Returns: *\li #ISC_R_SUCCESS -- the entire decoded representation of 'cstring' * fit in 'target'. *\li #ISC_R_BADBASE64 -- 'cstr' is not a valid base64 encoding. *\li #ISC_R_NOSPACE -- 'target' is not big enough. */ ISC_LANG_ENDDECLS #endif /* ISCCC_BASE64_H */ ���������������������������������������������������������������������������������������������������������������������������bind9/isccc/util.h����������������������������������������������������������������������������������0000644�����������������00000011624�14763166026�0010002 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Portions Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. * * Portions Copyright (C) 2001 Nominum, Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef ISCCC_UTIL_H #define ISCCC_UTIL_H 1 #include <isc/util.h> /*! \file isccc/util.h * \brief * Macros for dealing with unaligned numbers. * * \note no side effects are allowed when invoking these macros! */ #define GET8(v, w) \ do { \ v = *w; \ w++; \ } while (0) #define GET16(v, w) \ do { \ v = (unsigned int)w[0] << 8; \ v |= (unsigned int)w[1]; \ w += 2; \ } while (0) #define GET24(v, w) \ do { \ v = (unsigned int)w[0] << 16; \ v |= (unsigned int)w[1] << 8; \ v |= (unsigned int)w[2]; \ w += 3; \ } while (0) #define GET32(v, w) \ do { \ v = (unsigned int)w[0] << 24; \ v |= (unsigned int)w[1] << 16; \ v |= (unsigned int)w[2] << 8; \ v |= (unsigned int)w[3]; \ w += 4; \ } while (0) #define GET64(v, w) \ do { \ v = (isc_uint64_t)w[0] << 56; \ v |= (isc_uint64_t)w[1] << 48; \ v |= (isc_uint64_t)w[2] << 40; \ v |= (isc_uint64_t)w[3] << 32; \ v |= (isc_uint64_t)w[4] << 24; \ v |= (isc_uint64_t)w[5] << 16; \ v |= (isc_uint64_t)w[6] << 8; \ v |= (isc_uint64_t)w[7]; \ w += 8; \ } while (0) #define GETC16(v, w, d) \ do { \ GET8(v, w); \ if (v == 0) \ d = ISCCC_TRUE; \ else { \ d = ISCCC_FALSE; \ if (v == 255) \ GET16(v, w); \ } \ } while (0) #define GETC32(v, w) \ do { \ GET24(v, w); \ if (v == 0xffffffu) \ GET32(v, w); \ } while (0) #define GET_OFFSET(v, w) GET32(v, w) #define GET_MEM(v, c, w) \ do { \ memmove(v, w, c); \ w += c; \ } while (0) #define GET_TYPE(v, w) \ do { \ GET8(v, w); \ if (v > 127) { \ if (v < 255) \ v = ((v & 0x7f) << 16) | ISCCC_RDATATYPE_SIG; \ else \ GET32(v, w); \ } \ } while (0) #define PUT8(v, w) \ do { \ *w = (v & 0x000000ffU); \ w++; \ } while (0) #define PUT16(v, w) \ do { \ w[0] = (v & 0x0000ff00U) >> 8; \ w[1] = (v & 0x000000ffU); \ w += 2; \ } while (0) #define PUT24(v, w) \ do { \ w[0] = (v & 0x00ff0000U) >> 16; \ w[1] = (v & 0x0000ff00U) >> 8; \ w[2] = (v & 0x000000ffU); \ w += 3; \ } while (0) #define PUT32(v, w) \ do { \ w[0] = (v & 0xff000000U) >> 24; \ w[1] = (v & 0x00ff0000U) >> 16; \ w[2] = (v & 0x0000ff00U) >> 8; \ w[3] = (v & 0x000000ffU); \ w += 4; \ } while (0) #define PUT64(v, w) \ do { \ w[0] = (v & 0xff00000000000000ULL) >> 56; \ w[1] = (v & 0x00ff000000000000ULL) >> 48; \ w[2] = (v & 0x0000ff0000000000ULL) >> 40; \ w[3] = (v & 0x000000ff00000000ULL) >> 32; \ w[4] = (v & 0x00000000ff000000ULL) >> 24; \ w[5] = (v & 0x0000000000ff0000ULL) >> 16; \ w[6] = (v & 0x000000000000ff00ULL) >> 8; \ w[7] = (v & 0x00000000000000ffULL); \ w += 8; \ } while (0) #define PUTC16(v, w) \ do { \ if (v > 0 && v < 255) \ PUT8(v, w); \ else { \ PUT8(255, w); \ PUT16(v, w); \ } \ } while (0) #define PUTC32(v, w) \ do { \ if (v < 0xffffffU) \ PUT24(v, w); \ else { \ PUT24(0xffffffU, w); \ PUT32(v, w); \ } \ } while (0) #define PUT_OFFSET(v, w) PUT32(v, w) #include <string.h> #define PUT_MEM(s, c, w) \ do { \ memmove(w, s, c); \ w += c; \ } while (0) /* * Regions. */ #define REGION_SIZE(r) ((unsigned int)((r).rend - (r).rstart)) #define REGION_EMPTY(r) ((r).rstart == (r).rend) #define REGION_FROMSTRING(r, s) do { \ (r).rstart = (unsigned char *)s; \ (r).rend = (r).rstart + strlen(s); \ } while (0) /*% * Use this to remove the const qualifier of a variable to assign it to * a non-const variable or pass it as a non-const function argument ... * but only when you are sure it won't then be changed! * This is necessary to sometimes shut up some compilers * (as with gcc -Wcast-qual) when there is just no other good way to avoid the * situation. */ #define DE_CONST(konst, var) \ do { \ union { const void *k; void *v; } _u; \ _u.k = konst; \ var = _u.v; \ } while (0) #endif /* ISCCC_UTIL_H */ ������������������������������������������������������������������������������������������������������������bind9/isccc/symtab.h��������������������������������������������������������������������������������0000644�����������������00000010200�14763166026�0010311 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Portions Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. * * Portions Copyright (C) 2001 Nominum, Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef ISCCC_SYMTAB_H #define ISCCC_SYMTAB_H 1 /***** ***** Module Info *****/ /*! \file isccc/symtab.h * \brief * Provides a simple memory-based symbol table. * * Keys are C strings. A type may be specified when looking up, * defining, or undefining. A type value of 0 means "match any type"; * any other value will only match the given type. * * It's possible that a client will attempt to define a <key, type, * value> tuple when a tuple with the given key and type already * exists in the table. What to do in this case is specified by the * client. Possible policies are: * *\li isccc_symexists_reject Disallow the define, returning #ISC_R_EXISTS *\li isccc_symexists_replace Replace the old value with the new. The * undefine action (if provided) will be called * with the old <key, type, value> tuple. *\li isccc_symexists_add Add the new tuple, leaving the old tuple in * the table. Subsequent lookups will retrieve * the most-recently-defined tuple. * * A lookup of a key using type 0 will return the most-recently * defined symbol with that key. An undefine of a key using type 0 * will undefine the most-recently defined symbol with that key. * Trying to define a key with type 0 is illegal. * * The symbol table library does not make a copy the key field, so the * caller must ensure that any key it passes to isccc_symtab_define() * will not change until it calls isccc_symtab_undefine() or * isccc_symtab_destroy(). * * A user-specified action will be called (if provided) when a symbol * is undefined. It can be used to free memory associated with keys * and/or values. */ /*** *** Imports. ***/ #include <isc/lang.h> #include <isccc/types.h> /*** *** Symbol Tables. ***/ typedef union isccc_symvalue { void * as_pointer; int as_integer; unsigned int as_uinteger; } isccc_symvalue_t; typedef void (*isccc_symtabundefaction_t)(char *key, unsigned int type, isccc_symvalue_t value, void *userarg); typedef isc_boolean_t (*isccc_symtabforeachaction_t)(char *key, unsigned int type, isccc_symvalue_t value, void *userarg); typedef enum { isccc_symexists_reject = 0, isccc_symexists_replace = 1, isccc_symexists_add = 2 } isccc_symexists_t; ISC_LANG_BEGINDECLS isc_result_t isccc_symtab_create(unsigned int size, isccc_symtabundefaction_t undefine_action, void *undefine_arg, isc_boolean_t case_sensitive, isccc_symtab_t **symtabp); void isccc_symtab_destroy(isccc_symtab_t **symtabp); isc_result_t isccc_symtab_lookup(isccc_symtab_t *symtab, const char *key, unsigned int type, isccc_symvalue_t *value); isc_result_t isccc_symtab_define(isccc_symtab_t *symtab, char *key, unsigned int type, isccc_symvalue_t value, isccc_symexists_t exists_policy); isc_result_t isccc_symtab_undefine(isccc_symtab_t *symtab, const char *key, unsigned int type); void isccc_symtab_foreach(isccc_symtab_t *symtab, isccc_symtabforeachaction_t action, void *arg); ISC_LANG_ENDDECLS #endif /* ISCCC_SYMTAB_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isccc/sexpr.h���������������������������������������������������������������������������������0000644�����������������00000005703�14763166026�0010167 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Portions Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. * * Portions Copyright (C) 2001 Nominum, Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef ISCCC_SEXPR_H #define ISCCC_SEXPR_H 1 /*! \file isccc/sexpr.h */ #include <stdio.h> #include <isc/lang.h> #include <isccc/types.h> ISC_LANG_BEGINDECLS /*% dotted pair structure */ struct isccc_dottedpair { isccc_sexpr_t *car; isccc_sexpr_t *cdr; }; /*% iscc_sexpr structure */ struct isccc_sexpr { unsigned int type; union { char * as_string; isccc_dottedpair_t as_dottedpair; isccc_region_t as_region; } value; }; #define ISCCC_SEXPRTYPE_NONE 0x00 /*%< Illegal. */ #define ISCCC_SEXPRTYPE_T 0x01 #define ISCCC_SEXPRTYPE_STRING 0x02 #define ISCCC_SEXPRTYPE_DOTTEDPAIR 0x03 #define ISCCC_SEXPRTYPE_BINARY 0x04 #define ISCCC_SEXPR_CAR(s) (s)->value.as_dottedpair.car #define ISCCC_SEXPR_CDR(s) (s)->value.as_dottedpair.cdr isccc_sexpr_t * isccc_sexpr_cons(isccc_sexpr_t *car, isccc_sexpr_t *cdr); isccc_sexpr_t * isccc_sexpr_tconst(void); isccc_sexpr_t * isccc_sexpr_fromstring(const char *str); isccc_sexpr_t * isccc_sexpr_frombinary(const isccc_region_t *region); void isccc_sexpr_free(isccc_sexpr_t **sexprp); void isccc_sexpr_print(isccc_sexpr_t *sexpr, FILE *stream); isccc_sexpr_t * isccc_sexpr_car(isccc_sexpr_t *list); isccc_sexpr_t * isccc_sexpr_cdr(isccc_sexpr_t *list); void isccc_sexpr_setcar(isccc_sexpr_t *pair, isccc_sexpr_t *car); void isccc_sexpr_setcdr(isccc_sexpr_t *pair, isccc_sexpr_t *cdr); isccc_sexpr_t * isccc_sexpr_addtolist(isccc_sexpr_t **l1p, isccc_sexpr_t *l2); isc_boolean_t isccc_sexpr_listp(isccc_sexpr_t *sexpr); isc_boolean_t isccc_sexpr_emptyp(isccc_sexpr_t *sexpr); isc_boolean_t isccc_sexpr_stringp(isccc_sexpr_t *sexpr); isc_boolean_t isccc_sexpr_binaryp(isccc_sexpr_t *sexpr); char * isccc_sexpr_tostring(isccc_sexpr_t *sexpr); isccc_region_t * isccc_sexpr_tobinary(isccc_sexpr_t *sexpr); ISC_LANG_ENDDECLS #endif /* ISCCC_SEXPR_H */ �������������������������������������������������������������bind9/isccc/events.h��������������������������������������������������������������������������������0000644�����������������00000003002�14763166026�0010320 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Portions Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. * * Portions Copyright (C) 2001 Nominum, Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef ISCCC_EVENTS_H #define ISCCC_EVENTS_H 1 /*! \file isccc/events.h */ #include <isc/eventclass.h> /*% * Registry of ISCCC event numbers. */ #define ISCCC_EVENT_CCMSG (ISC_EVENTCLASS_ISCCC + 0) #define ISCCC_EVENT_FIRSTEVENT (ISC_EVENTCLASS_ISCCC + 0) #define ISCCC_EVENT_LASTEVENT (ISC_EVENTCLASS_ISCCC + 65535) #endif /* ISCCC_EVENTS_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isccc/symtype.h�������������������������������������������������������������������������������0000644�����������������00000002655�14763166026�0010543 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Portions Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. * * Portions Copyright (C) 2001 Nominum, Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef ISCCC_SYMTYPE_H #define ISCCC_SYMTYPE_H 1 /*! \file isccc/symtype.h */ #define ISCCC_SYMTYPE_ZONESTATS 0x0001 #define ISCCC_SYMTYPE_CCDUP 0x0002 #define ISCCC_SYMTYPE_TELLSERVICE 0x0003 #define ISCCC_SYMTYPE_TELLRESPONSE 0x0004 #endif /* ISCCC_SYMTYPE_H */ �����������������������������������������������������������������������������������bind9/isccc/cc.h������������������������������������������������������������������������������������0000644�����������������00000007176�14763166026�0007421 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Portions Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. * * Portions Copyright (C) 2001 Nominum, Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef ISCCC_CC_H #define ISCCC_CC_H 1 /*! \file isccc/cc.h */ #include <isc/lang.h> #include <isc/buffer.h> #include <isccc/types.h> ISC_LANG_BEGINDECLS /*% from lib/dns/include/dst/dst.h */ #define ISCCC_ALG_UNKNOWN 0 #define ISCCC_ALG_HMACMD5 157 #define ISCCC_ALG_HMACSHA1 161 #define ISCCC_ALG_HMACSHA224 162 #define ISCCC_ALG_HMACSHA256 163 #define ISCCC_ALG_HMACSHA384 164 #define ISCCC_ALG_HMACSHA512 165 /*% Maximum Datagram Package */ #define ISCCC_CC_MAXDGRAMPACKET 4096 /*% Message Type String */ #define ISCCC_CCMSGTYPE_STRING 0x00 /*% Message Type Binary Data */ #define ISCCC_CCMSGTYPE_BINARYDATA 0x01 /*% Message Type Table */ #define ISCCC_CCMSGTYPE_TABLE 0x02 /*% Message Type List */ #define ISCCC_CCMSGTYPE_LIST 0x03 /*% Send to Wire */ isc_result_t isccc_cc_towire(isccc_sexpr_t *alist, isc_buffer_t **buffer, isc_uint32_t algorithm, isccc_region_t *secret); /*% Get From Wire */ isc_result_t isccc_cc_fromwire(isccc_region_t *source, isccc_sexpr_t **alistp, isc_uint32_t algorithm, isccc_region_t *secret); /*% Create Message */ isc_result_t isccc_cc_createmessage(isc_uint32_t version, const char *from, const char *to, isc_uint32_t serial, isccc_time_t now, isccc_time_t expires, isccc_sexpr_t **alistp); /*% Create Acknowledgment */ isc_result_t isccc_cc_createack(isccc_sexpr_t *message, isc_boolean_t ok, isccc_sexpr_t **ackp); /*% Is Ack? */ isc_boolean_t isccc_cc_isack(isccc_sexpr_t *message); /*% Is Reply? */ isc_boolean_t isccc_cc_isreply(isccc_sexpr_t *message); /*% Create Response */ isc_result_t isccc_cc_createresponse(isccc_sexpr_t *message, isccc_time_t now, isccc_time_t expires, isccc_sexpr_t **alistp); /*% Define String */ isccc_sexpr_t * isccc_cc_definestring(isccc_sexpr_t *alist, const char *key, const char *str); /*% Define uint 32 */ isccc_sexpr_t * isccc_cc_defineuint32(isccc_sexpr_t *alist, const char *key, isc_uint32_t i); /*% Lookup String */ isc_result_t isccc_cc_lookupstring(isccc_sexpr_t *alist, const char *key, char **strp); /*% Lookup uint 32 */ isc_result_t isccc_cc_lookupuint32(isccc_sexpr_t *alist, const char *key, isc_uint32_t *uintp); /*% Create Symbol Table */ isc_result_t isccc_cc_createsymtab(isccc_symtab_t **symtabp); /*% Clean up Symbol Table */ void isccc_cc_cleansymtab(isccc_symtab_t *symtab, isccc_time_t now); /*% Check for Duplicates */ isc_result_t isccc_cc_checkdup(isccc_symtab_t *symtab, isccc_sexpr_t *message, isccc_time_t now); ISC_LANG_ENDDECLS #endif /* ISCCC_CC_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/buffer.h����������������������������������������������������������������������������������0000644�����������������00000063276�14763166026�0010002 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_BUFFER_H #define ISC_BUFFER_H 1 /***** ***** Module Info *****/ /*! \file isc/buffer.h * * \brief A buffer is a region of memory, together with a set of related subregions. * Buffers are used for parsing and I/O operations. * * The 'used region' and the 'available' region are disjoint, and their * union is the buffer's region. The used region extends from the beginning * of the buffer region to the last used byte. The available region * extends from one byte greater than the last used byte to the end of the * buffer's region. The size of the used region can be changed using various * buffer commands. Initially, the used region is empty. * * The used region is further subdivided into two disjoint regions: the * 'consumed region' and the 'remaining region'. The union of these two * regions is the used region. The consumed region extends from the beginning * of the used region to the byte before the 'current' offset (if any). The * 'remaining' region the current pointer to the end of the used * region. The size of the consumed region can be changed using various * buffer commands. Initially, the consumed region is empty. * * The 'active region' is an (optional) subregion of the remaining region. * It extends from the current offset to an offset in the remaining region * that is selected with isc_buffer_setactive(). Initially, the active region * is empty. If the current offset advances beyond the chosen offset, the * active region will also be empty. * * \verbatim * /------------entire length---------------\ * /----- used region -----\/-- available --\ * +----------------------------------------+ * | consumed | remaining | | * +----------------------------------------+ * a b c d e * * a == base of buffer. * b == current pointer. Can be anywhere between a and d. * c == active pointer. Meaningful between b and d. * d == used pointer. * e == length of buffer. * * a-e == entire length of buffer. * a-d == used region. * a-b == consumed region. * b-d == remaining region. * b-c == optional active region. *\endverbatim * * The following invariants are maintained by all routines: * *\code * length > 0 * * base is a valid pointer to length bytes of memory * * 0 <= used <= length * * 0 <= current <= used * * 0 <= active <= used * (although active < current implies empty active region) *\endcode * * \li MP: * Buffers have no synchronization. Clients must ensure exclusive * access. * * \li Reliability: * No anticipated impact. * * \li Resources: * Memory: 1 pointer + 6 unsigned integers per buffer. * * \li Security: * No anticipated impact. * * \li Standards: * None. */ /*** *** Imports ***/ #include <isc/assertions.h> #include <isc/formatcheck.h> #include <isc/lang.h> #include <isc/likely.h> #include <isc/magic.h> #include <isc/types.h> /*! * To make many functions be inline macros (via \#define) define this. * If it is undefined, a function will be used. */ /* #define ISC_BUFFER_USEINLINE */ ISC_LANG_BEGINDECLS /*@{*/ /*! *** Magic numbers ***/ #define ISC_BUFFER_MAGIC 0x42756621U /* Buf!. */ #define ISC_BUFFER_VALID(b) ISC_MAGIC_VALID(b, ISC_BUFFER_MAGIC) /*@}*/ /*! * Size granularity for dynamically resizeable buffers; when reserving * space in a buffer, we round the allocated buffer length up to the * nearest * multiple of this value. */ #define ISC_BUFFER_INCR 2048 /* * The following macros MUST be used only on valid buffers. It is the * caller's responsibility to ensure this by using the ISC_BUFFER_VALID * check above, or by calling another isc_buffer_*() function (rather than * another macro.) */ /*@{*/ /*! * Fundamental buffer elements. (A through E in the introductory comment.) */ #define isc_buffer_base(b) ((void *)(b)->base) /*a*/ #define isc_buffer_current(b) \ ((void *)((unsigned char *)(b)->base + (b)->current)) /*b*/ #define isc_buffer_active(b) \ ((void *)((unsigned char *)(b)->base + (b)->active)) /*c*/ #define isc_buffer_used(b) \ ((void *)((unsigned char *)(b)->base + (b)->used)) /*d*/ #define isc_buffer_length(b) ((b)->length) /*e*/ /*@}*/ /*@{*/ /*! * Derived lengths. (Described in the introductory comment.) */ #define isc_buffer_usedlength(b) ((b)->used) /* d-a */ #define isc_buffer_consumedlength(b) ((b)->current) /* b-a */ #define isc_buffer_remaininglength(b) ((b)->used - (b)->current) /* d-b */ #define isc_buffer_activelength(b) ((b)->active - (b)->current) /* c-b */ #define isc_buffer_availablelength(b) ((b)->length - (b)->used) /* e-d */ /*@}*/ /*! * Note that the buffer structure is public. This is principally so buffer * operations can be implemented using macros. Applications are strongly * discouraged from directly manipulating the structure. */ struct isc_buffer { unsigned int magic; void *base; /*@{*/ /*! The following integers are byte offsets from 'base'. */ unsigned int length; unsigned int used; unsigned int current; unsigned int active; /*@}*/ /*! linkable */ ISC_LINK(isc_buffer_t) link; /*! private internal elements */ isc_mem_t *mctx; /* automatically realloc buffer at put* */ isc_boolean_t autore; }; /*** *** Functions ***/ isc_result_t isc_buffer_allocate(isc_mem_t *mctx, isc_buffer_t **dynbuffer, unsigned int length); /*!< * \brief Allocate a dynamic linkable buffer which has "length" bytes in the * data region. * * Requires: *\li "mctx" is valid. * *\li "dynbuffer" is non-NULL, and "*dynbuffer" is NULL. * * Returns: *\li ISC_R_SUCCESS - success *\li ISC_R_NOMEMORY - no memory available * * Note: *\li Changing the buffer's length field is not permitted. */ isc_result_t isc_buffer_reallocate(isc_buffer_t **dynbuffer, unsigned int length); /*!< * \brief Reallocate the buffer to be "length" bytes long. The buffer * pointer may move when you call this function. * * Requires: *\li "dynbuffer" is not NULL. * *\li "*dynbuffer" is a valid dynamic buffer. * *\li 'length' > current length of buffer. * * Returns: *\li ISC_R_SUCCESS - success *\li ISC_R_NOMEMORY - no memory available * * Ensures: *\li "*dynbuffer" will be valid on return and will contain all the * original data. However, the buffer pointer may be moved during * reallocation. */ isc_result_t isc_buffer_reserve(isc_buffer_t **dynbuffer, unsigned int size); /*!< * \brief Make "size" bytes of space available in the buffer. The buffer * pointer may move when you call this function. * * Requires: *\li "dynbuffer" is not NULL. * *\li "*dynbuffer" is a valid dynamic buffer. * * Returns: *\li ISC_R_SUCCESS - success *\li ISC_R_NOMEMORY - no memory available * * Ensures: *\li "*dynbuffer" will be valid on return and will contain all the * original data. However, the buffer pointer may be moved during * reallocation. */ void isc_buffer_free(isc_buffer_t **dynbuffer); /*!< * \brief Release resources allocated for a dynamic buffer. * * Requires: *\li "dynbuffer" is not NULL. * *\li "*dynbuffer" is a valid dynamic buffer. * * Ensures: *\li "*dynbuffer" will be NULL on return, and all memory associated with * the dynamic buffer is returned to the memory context used in * isc_buffer_allocate(). */ void isc__buffer_init(isc_buffer_t *b, void *base, unsigned int length); /*!< * \brief Make 'b' refer to the 'length'-byte region starting at base. * * Requires: * *\li 'length' > 0 * *\li 'base' is a pointer to a sequence of 'length' bytes. * */ void isc__buffer_initnull(isc_buffer_t *b); /*!< *\brief Initialize a buffer 'b' with a null data and zero length/ */ void isc_buffer_reinit(isc_buffer_t *b, void *base, unsigned int length); /*!< * \brief Make 'b' refer to the 'length'-byte region starting at base. * Any existing data will be copied. * * Requires: * *\li 'length' > 0 AND length >= previous length * *\li 'base' is a pointer to a sequence of 'length' bytes. * */ void isc__buffer_invalidate(isc_buffer_t *b); /*!< * \brief Make 'b' an invalid buffer. * * Requires: *\li 'b' is a valid buffer. * * Ensures: *\li If assertion checking is enabled, future attempts to use 'b' without * calling isc_buffer_init() on it will cause an assertion failure. */ void isc_buffer_setautorealloc(isc_buffer_t *b, isc_boolean_t enable); /*!< * \brief Enable or disable autoreallocation on 'b'. * * Requires: *\li 'b' is a valid dynamic buffer (b->mctx != NULL). * */ void isc__buffer_region(isc_buffer_t *b, isc_region_t *r); /*!< * \brief Make 'r' refer to the region of 'b'. * * Requires: * *\li 'b' is a valid buffer. * *\li 'r' points to a region structure. */ void isc__buffer_usedregion(const isc_buffer_t *b, isc_region_t *r); /*!< * \brief Make 'r' refer to the used region of 'b'. * * Requires: * *\li 'b' is a valid buffer. * *\li 'r' points to a region structure. */ void isc__buffer_availableregion(isc_buffer_t *b, isc_region_t *r); /*!< * \brief Make 'r' refer to the available region of 'b'. * * Requires: * *\li 'b' is a valid buffer. * *\li 'r' points to a region structure. */ void isc__buffer_add(isc_buffer_t *b, unsigned int n); /*!< * \brief Increase the 'used' region of 'b' by 'n' bytes. * * Requires: * *\li 'b' is a valid buffer * *\li used + n <= length * */ void isc__buffer_subtract(isc_buffer_t *b, unsigned int n); /*!< * \brief Decrease the 'used' region of 'b' by 'n' bytes. * * Requires: * *\li 'b' is a valid buffer * *\li used >= n * */ void isc__buffer_clear(isc_buffer_t *b); /*!< * \brief Make the used region empty. * * Requires: * *\li 'b' is a valid buffer * * Ensures: * *\li used = 0 * */ void isc__buffer_consumedregion(isc_buffer_t *b, isc_region_t *r); /*!< * \brief Make 'r' refer to the consumed region of 'b'. * * Requires: * *\li 'b' is a valid buffer. * *\li 'r' points to a region structure. */ void isc__buffer_remainingregion(isc_buffer_t *b, isc_region_t *r); /*!< * \brief Make 'r' refer to the remaining region of 'b'. * * Requires: * *\li 'b' is a valid buffer. * *\li 'r' points to a region structure. */ void isc__buffer_activeregion(isc_buffer_t *b, isc_region_t *r); /*!< * \brief Make 'r' refer to the active region of 'b'. * * Requires: * *\li 'b' is a valid buffer. * *\li 'r' points to a region structure. */ void isc__buffer_setactive(isc_buffer_t *b, unsigned int n); /*!< * \brief Sets the end of the active region 'n' bytes after current. * * Requires: * *\li 'b' is a valid buffer. * *\li current + n <= used */ void isc__buffer_first(isc_buffer_t *b); /*!< * \brief Make the consumed region empty. * * Requires: * *\li 'b' is a valid buffer * * Ensures: * *\li current == 0 * */ void isc__buffer_forward(isc_buffer_t *b, unsigned int n); /*!< * \brief Increase the 'consumed' region of 'b' by 'n' bytes. * * Requires: * *\li 'b' is a valid buffer * *\li current + n <= used * */ void isc__buffer_back(isc_buffer_t *b, unsigned int n); /*!< * \brief Decrease the 'consumed' region of 'b' by 'n' bytes. * * Requires: * *\li 'b' is a valid buffer * *\li n <= current * */ void isc_buffer_compact(isc_buffer_t *b); /*!< * \brief Compact the used region by moving the remaining region so it occurs * at the start of the buffer. The used region is shrunk by the size of * the consumed region, and the consumed region is then made empty. * * Requires: * *\li 'b' is a valid buffer * * Ensures: * *\li current == 0 * *\li The size of the used region is now equal to the size of the remaining * region (as it was before the call). The contents of the used region * are those of the remaining region (as it was before the call). */ isc_uint8_t isc_buffer_getuint8(isc_buffer_t *b); /*!< * \brief Read an unsigned 8-bit integer from 'b' and return it. * * Requires: * *\li 'b' is a valid buffer. * *\li The length of the available region of 'b' is at least 1. * * Ensures: * *\li The current pointer in 'b' is advanced by 1. * * Returns: * *\li A 8-bit unsigned integer. */ void isc__buffer_putuint8(isc_buffer_t *b, isc_uint8_t val); /*!< * \brief Store an unsigned 8-bit integer from 'val' into 'b'. * * Requires: *\li 'b' is a valid buffer. * *\li The length of the unused region of 'b' is at least 1 * or the buffer has autoreallocation enabled. * * Ensures: *\li The used pointer in 'b' is advanced by 1. */ isc_uint16_t isc_buffer_getuint16(isc_buffer_t *b); /*!< * \brief Read an unsigned 16-bit integer in network byte order from 'b', convert * it to host byte order, and return it. * * Requires: * *\li 'b' is a valid buffer. * *\li The length of the available region of 'b' is at least 2 * or the buffer has autoreallocation enabled. * * Ensures: * *\li The current pointer in 'b' is advanced by 2. * * Returns: * *\li A 16-bit unsigned integer. */ void isc__buffer_putuint16(isc_buffer_t *b, isc_uint16_t val); /*!< * \brief Store an unsigned 16-bit integer in host byte order from 'val' * into 'b' in network byte order. * * Requires: *\li 'b' is a valid buffer. * *\li The length of the unused region of 'b' is at least 2 * or the buffer has autoreallocation enabled. * * Ensures: *\li The used pointer in 'b' is advanced by 2. */ isc_uint32_t isc_buffer_getuint32(isc_buffer_t *b); /*!< * \brief Read an unsigned 32-bit integer in network byte order from 'b', convert * it to host byte order, and return it. * * Requires: * *\li 'b' is a valid buffer. * *\li The length of the available region of 'b' is at least 4. * * Ensures: * *\li The current pointer in 'b' is advanced by 4. * * Returns: * *\li A 32-bit unsigned integer. */ void isc__buffer_putuint32(isc_buffer_t *b, isc_uint32_t val); /*!< * \brief Store an unsigned 32-bit integer in host byte order from 'val' * into 'b' in network byte order. * * Requires: *\li 'b' is a valid buffer. * *\li The length of the unused region of 'b' is at least 4 * or the buffer has autoreallocation enabled. * * Ensures: *\li The used pointer in 'b' is advanced by 4. */ isc_uint64_t isc_buffer_getuint48(isc_buffer_t *b); /*!< * \brief Read an unsigned 48-bit integer in network byte order from 'b', * convert it to host byte order, and return it. * * Requires: * *\li 'b' is a valid buffer. * *\li The length of the available region of 'b' is at least 6. * * Ensures: * *\li The current pointer in 'b' is advanced by 6. * * Returns: * *\li A 48-bit unsigned integer (stored in a 64-bit integer). */ void isc__buffer_putuint48(isc_buffer_t *b, isc_uint64_t val); /*!< * \brief Store an unsigned 48-bit integer in host byte order from 'val' * into 'b' in network byte order. * * Requires: *\li 'b' is a valid buffer. * *\li The length of the unused region of 'b' is at least 6 * or the buffer has autoreallocation enabled. * * Ensures: *\li The used pointer in 'b' is advanced by 6. */ void isc__buffer_putuint24(isc_buffer_t *b, isc_uint32_t val); /*!< * Store an unsigned 24-bit integer in host byte order from 'val' * into 'b' in network byte order. * * Requires: *\li 'b' is a valid buffer. * * The length of the unused region of 'b' is at least 3 * or the buffer has autoreallocation enabled. * * Ensures: *\li The used pointer in 'b' is advanced by 3. */ void isc__buffer_putmem(isc_buffer_t *b, const unsigned char *base, unsigned int length); /*!< * \brief Copy 'length' bytes of memory at 'base' into 'b'. * * Requires: *\li 'b' is a valid buffer, and it has at least 'length' * or the buffer has autoreallocation enabled. * *\li 'base' points to 'length' bytes of valid memory. * */ void isc__buffer_putstr(isc_buffer_t *b, const char *source); /*!< * \brief Copy 'source' into 'b', not including terminating NUL. * * Requires: *\li 'b' is a valid buffer. * *\li 'source' to be a valid NULL terminated string. * *\li strlen(source) <= isc_buffer_available(b) || b->mctx != NULL */ void isc_buffer_putdecint(isc_buffer_t *b, isc_int64_t v); /*!< * \brief Put decimal representation of 'v' in b * * Requires: *\li 'b' is a valid buffer. * *\li strlen(dec(v)) <= isc_buffer_available(b) || b->mctx != NULL */ isc_result_t isc_buffer_copyregion(isc_buffer_t *b, const isc_region_t *r); /*!< * \brief Copy the contents of 'r' into 'b'. * * Requires: *\li 'b' is a valid buffer. * *\li 'r' is a valid region. * * Returns: * *\li ISC_R_SUCCESS *\li ISC_R_NOSPACE The available region of 'b' is not * big enough. */ isc_result_t isc_buffer_dup(isc_mem_t *mctx, isc_buffer_t **dstp, const isc_buffer_t *src); /*!< * \brief Allocate 'dst' and copy used contents of 'src' into it * * Requires: *\li 'dstp' is not NULL and *dst is NULL *\li 'src' is a valid buffer. * * Returns: * *\li ISC_R_SUCCESS *\li ISC_R_NOSPACE The available region of 'b' is not * big enough. */ ISC_LANG_ENDDECLS /* * Inline macro versions of the functions. These should never be called * directly by an application, but will be used by the functions within * buffer.c. The callers should always use "isc_buffer_*()" names, never * ones beginning with "isc__" */ /*! \note * XXXDCL Something more could be done with initializing buffers that * point to const data. For example, isc_buffer_constinit() could * set a new boolean flag in the buffer structure indicating whether * the buffer was initialized with that function. * Then if the * boolean were true, the isc_buffer_put* functions could assert a * contractual requirement for a non-const buffer. * * One drawback is that the isc_buffer_* functions (macros) that return * pointers would still need to return non-const pointers to avoid compiler * warnings, so it would be up to code that uses them to have to deal * with the possibility that the buffer was initialized as const -- * a problem that they *already* have to deal with but have absolutely * no ability to. With a new isc_buffer_isconst() function returning * true/false, they could at least assert a contractual requirement for * non-const buffers when needed. */ #define ISC__BUFFER_INIT(_b, _base, _length) \ do { \ (_b)->base = _base; \ (_b)->length = (_length); \ (_b)->used = 0; \ (_b)->current = 0; \ (_b)->active = 0; \ (_b)->mctx = NULL; \ ISC_LINK_INIT(_b, link); \ (_b)->magic = ISC_BUFFER_MAGIC; \ (_b)->autore = ISC_FALSE; \ } while (0) #define ISC__BUFFER_INITNULL(_b) ISC__BUFFER_INIT(_b, NULL, 0) #define ISC__BUFFER_INVALIDATE(_b) \ do { \ (_b)->magic = 0; \ (_b)->base = NULL; \ (_b)->length = 0; \ (_b)->used = 0; \ (_b)->current = 0; \ (_b)->active = 0; \ } while (0) #define ISC__BUFFER_REGION(_b, _r) \ do { \ (_r)->base = (_b)->base; \ (_r)->length = (_b)->length; \ } while (0) #define ISC__BUFFER_USEDREGION(_b, _r) \ do { \ (_r)->base = (_b)->base; \ (_r)->length = (_b)->used; \ } while (0) #define ISC__BUFFER_AVAILABLEREGION(_b, _r) \ do { \ (_r)->base = isc_buffer_used(_b); \ (_r)->length = isc_buffer_availablelength(_b); \ } while (0) #define ISC__BUFFER_ADD(_b, _n) \ do { \ (_b)->used += (_n); \ } while (0) #define ISC__BUFFER_SUBTRACT(_b, _n) \ do { \ (_b)->used -= (_n); \ if ((_b)->current > (_b)->used) \ (_b)->current = (_b)->used; \ if ((_b)->active > (_b)->used) \ (_b)->active = (_b)->used; \ } while (0) #define ISC__BUFFER_CLEAR(_b) \ do { \ (_b)->used = 0; \ (_b)->current = 0; \ (_b)->active = 0; \ } while (0) #define ISC__BUFFER_CONSUMEDREGION(_b, _r) \ do { \ (_r)->base = (_b)->base; \ (_r)->length = (_b)->current; \ } while (0) #define ISC__BUFFER_REMAININGREGION(_b, _r) \ do { \ (_r)->base = isc_buffer_current(_b); \ (_r)->length = isc_buffer_remaininglength(_b); \ } while (0) #define ISC__BUFFER_ACTIVEREGION(_b, _r) \ do { \ if ((_b)->current < (_b)->active) { \ (_r)->base = isc_buffer_current(_b); \ (_r)->length = isc_buffer_activelength(_b); \ } else { \ (_r)->base = NULL; \ (_r)->length = 0; \ } \ } while (0) #define ISC__BUFFER_SETACTIVE(_b, _n) \ do { \ (_b)->active = (_b)->current + (_n); \ } while (0) #define ISC__BUFFER_FIRST(_b) \ do { \ (_b)->current = 0; \ } while (0) #define ISC__BUFFER_FORWARD(_b, _n) \ do { \ (_b)->current += (_n); \ } while (0) #define ISC__BUFFER_BACK(_b, _n) \ do { \ (_b)->current -= (_n); \ } while (0) #define ISC__BUFFER_PUTMEM(_b, _base, _length) \ do { \ if (ISC_UNLIKELY((_b)->autore)) { \ isc_buffer_t *_tmp = _b; \ ISC_REQUIRE(isc_buffer_reserve(&_tmp, _length) \ == ISC_R_SUCCESS); \ } \ ISC_REQUIRE(isc_buffer_availablelength(_b) >= (unsigned int) _length); \ if (_length > 0U) { \ memmove(isc_buffer_used(_b), (_base), (_length)); \ (_b)->used += (_length); \ } \ } while (0) #define ISC__BUFFER_PUTSTR(_b, _source) \ do { \ unsigned int _length; \ unsigned char *_cp; \ _length = (unsigned int)strlen(_source); \ if (ISC_UNLIKELY((_b)->autore)) { \ isc_buffer_t *_tmp = _b; \ ISC_REQUIRE(isc_buffer_reserve(&_tmp, _length) \ == ISC_R_SUCCESS); \ } \ ISC_REQUIRE(isc_buffer_availablelength(_b) >= _length); \ _cp = isc_buffer_used(_b); \ memmove(_cp, (_source), _length); \ (_b)->used += (_length); \ } while (0) #define ISC__BUFFER_PUTUINT8(_b, _val) \ do { \ unsigned char *_cp; \ /* evaluate (_val) only once */ \ isc_uint8_t _val2 = (_val); \ if (ISC_UNLIKELY((_b)->autore)) { \ isc_buffer_t *_tmp = _b; \ ISC_REQUIRE(isc_buffer_reserve(&_tmp, 1) \ == ISC_R_SUCCESS); \ } \ ISC_REQUIRE(isc_buffer_availablelength(_b) >= 1U); \ _cp = isc_buffer_used(_b); \ (_b)->used++; \ _cp[0] = _val2; \ } while (0) #define ISC__BUFFER_PUTUINT16(_b, _val) \ do { \ unsigned char *_cp; \ /* evaluate (_val) only once */ \ isc_uint16_t _val2 = (_val); \ if (ISC_UNLIKELY((_b)->autore)) { \ isc_buffer_t *_tmp = _b; \ ISC_REQUIRE(isc_buffer_reserve(&_tmp, 2) \ == ISC_R_SUCCESS); \ } \ ISC_REQUIRE(isc_buffer_availablelength(_b) >= 2U); \ _cp = isc_buffer_used(_b); \ (_b)->used += 2; \ _cp[0] = _val2 >> 8; \ _cp[1] = _val2; \ } while (0) #define ISC__BUFFER_PUTUINT24(_b, _val) \ do { \ unsigned char *_cp; \ /* evaluate (_val) only once */ \ isc_uint32_t _val2 = (_val); \ if (ISC_UNLIKELY((_b)->autore)) { \ isc_buffer_t *_tmp = _b; \ ISC_REQUIRE(isc_buffer_reserve(&_tmp, 3) \ == ISC_R_SUCCESS); \ } \ ISC_REQUIRE(isc_buffer_availablelength(_b) >= 3U); \ _cp = isc_buffer_used(_b); \ (_b)->used += 3; \ _cp[0] = _val2 >> 16; \ _cp[1] = _val2 >> 8; \ _cp[2] = _val2; \ } while (0) #define ISC__BUFFER_PUTUINT32(_b, _val) \ do { \ unsigned char *_cp; \ /* evaluate (_val) only once */ \ isc_uint32_t _val2 = (_val); \ if (ISC_UNLIKELY((_b)->autore)) { \ isc_buffer_t *_tmp = _b; \ ISC_REQUIRE(isc_buffer_reserve(&_tmp, 4) \ == ISC_R_SUCCESS); \ } \ ISC_REQUIRE(isc_buffer_availablelength(_b) >= 4U); \ _cp = isc_buffer_used(_b); \ (_b)->used += 4; \ _cp[0] = _val2 >> 24; \ _cp[1] = _val2 >> 16; \ _cp[2] = _val2 >> 8; \ _cp[3] = _val2; \ } while (0) #if defined(ISC_BUFFER_USEINLINE) #define isc_buffer_init ISC__BUFFER_INIT #define isc_buffer_initnull ISC__BUFFER_INITNULL #define isc_buffer_invalidate ISC__BUFFER_INVALIDATE #define isc_buffer_region ISC__BUFFER_REGION #define isc_buffer_usedregion ISC__BUFFER_USEDREGION #define isc_buffer_availableregion ISC__BUFFER_AVAILABLEREGION #define isc_buffer_add ISC__BUFFER_ADD #define isc_buffer_subtract ISC__BUFFER_SUBTRACT #define isc_buffer_clear ISC__BUFFER_CLEAR #define isc_buffer_consumedregion ISC__BUFFER_CONSUMEDREGION #define isc_buffer_remainingregion ISC__BUFFER_REMAININGREGION #define isc_buffer_activeregion ISC__BUFFER_ACTIVEREGION #define isc_buffer_setactive ISC__BUFFER_SETACTIVE #define isc_buffer_first ISC__BUFFER_FIRST #define isc_buffer_forward ISC__BUFFER_FORWARD #define isc_buffer_back ISC__BUFFER_BACK #define isc_buffer_putmem ISC__BUFFER_PUTMEM #define isc_buffer_putstr ISC__BUFFER_PUTSTR #define isc_buffer_putuint8 ISC__BUFFER_PUTUINT8 #define isc_buffer_putuint16 ISC__BUFFER_PUTUINT16 #define isc_buffer_putuint24 ISC__BUFFER_PUTUINT24 #define isc_buffer_putuint32 ISC__BUFFER_PUTUINT32 #else #define isc_buffer_init isc__buffer_init #define isc_buffer_initnull isc__buffer_initnull #define isc_buffer_invalidate isc__buffer_invalidate #define isc_buffer_region isc__buffer_region #define isc_buffer_usedregion isc__buffer_usedregion #define isc_buffer_availableregion isc__buffer_availableregion #define isc_buffer_add isc__buffer_add #define isc_buffer_subtract isc__buffer_subtract #define isc_buffer_clear isc__buffer_clear #define isc_buffer_consumedregion isc__buffer_consumedregion #define isc_buffer_remainingregion isc__buffer_remainingregion #define isc_buffer_activeregion isc__buffer_activeregion #define isc_buffer_setactive isc__buffer_setactive #define isc_buffer_first isc__buffer_first #define isc_buffer_forward isc__buffer_forward #define isc_buffer_back isc__buffer_back #define isc_buffer_putmem isc__buffer_putmem #define isc_buffer_putstr isc__buffer_putstr #define isc_buffer_putuint8 isc__buffer_putuint8 #define isc_buffer_putuint16 isc__buffer_putuint16 #define isc_buffer_putuint24 isc__buffer_putuint24 #define isc_buffer_putuint32 isc__buffer_putuint32 #endif #define isc_buffer_constinit(_b, _d, _l) \ do { \ union { void *_var; const void *_const; } _deconst; \ _deconst._const = (_d); \ isc_buffer_init((_b), _deconst._var, (_l)); \ } while (0) /* * No inline method for this one (yet). */ #define isc_buffer_putuint48 isc__buffer_putuint48 #endif /* ISC_BUFFER_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/version.h���������������������������������������������������������������������������������0000644�����������������00000001260�14763166026�0010177 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! \file isc/version.h */ #include <isc/platform.h> LIBISC_EXTERNAL_DATA extern const char isc_version[]; LIBISC_EXTERNAL_DATA extern const unsigned int isc_libinterface; LIBISC_EXTERNAL_DATA extern const unsigned int isc_librevision; LIBISC_EXTERNAL_DATA extern const unsigned int isc_libage; ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/types.h�����������������������������������������������������������������������������������0000644�����������������00000013053�14763166026�0007661 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id$ */ #ifndef ISC_TYPES_H #define ISC_TYPES_H 1 #include <isc/bind9.h> /*! \file isc/types.h * \brief * OS-specific types, from the OS-specific include directories. */ #include <isc/int.h> #include <isc/offset.h> /* * XXXDCL should isc_boolean_t be moved here, requiring an explicit include * of <isc/boolean.h> when ISC_TRUE/ISC_FALSE/ISC_TF() are desired? */ #include <isc/boolean.h> /* * XXXDCL This is just for ISC_LIST and ISC_LINK, but gets all of the other * list macros too. */ #include <isc/list.h> /* Core Types. Alphabetized by defined type. */ typedef struct isc_appctx isc_appctx_t; /*%< Application context */ typedef struct isc_backtrace_symmap isc_backtrace_symmap_t; /*%< Symbol Table Entry */ typedef struct isc_buffer isc_buffer_t; /*%< Buffer */ typedef ISC_LIST(isc_buffer_t) isc_bufferlist_t; /*%< Buffer List */ typedef struct isc_constregion isc_constregion_t; /*%< Const region */ typedef struct isc_consttextregion isc_consttextregion_t; /*%< Const Text Region */ typedef struct isc_counter isc_counter_t; /*%< Counter */ typedef isc_int16_t isc_dscp_t; /*%< Diffserv code point */ typedef struct isc_entropy isc_entropy_t; /*%< Entropy */ typedef struct isc_entropysource isc_entropysource_t; /*%< Entropy Source */ typedef struct isc_event isc_event_t; /*%< Event */ typedef ISC_LIST(isc_event_t) isc_eventlist_t; /*%< Event List */ typedef unsigned int isc_eventtype_t; /*%< Event Type */ typedef isc_uint32_t isc_fsaccess_t; /*%< FS Access */ typedef struct isc_hash isc_hash_t; /*%< Hash */ typedef struct isc_httpd isc_httpd_t; /*%< HTTP client */ typedef void (isc_httpdfree_t)(isc_buffer_t *, void *); /*%< HTTP free function */ typedef struct isc_httpdmgr isc_httpdmgr_t; /*%< HTTP manager */ typedef struct isc_httpdurl isc_httpdurl_t; /*%< HTTP URL */ typedef void (isc_httpdondestroy_t)(void *); /*%< Callback on destroying httpd */ typedef struct isc_interface isc_interface_t; /*%< Interface */ typedef struct isc_interfaceiter isc_interfaceiter_t; /*%< Interface Iterator */ typedef struct isc_interval isc_interval_t; /*%< Interval */ typedef struct isc_lex isc_lex_t; /*%< Lex */ typedef struct isc_log isc_log_t; /*%< Log */ typedef struct isc_logcategory isc_logcategory_t; /*%< Log Category */ typedef struct isc_logconfig isc_logconfig_t; /*%< Log Configuration */ typedef struct isc_logmodule isc_logmodule_t; /*%< Log Module */ typedef struct isc_mem isc_mem_t; /*%< Memory */ typedef struct isc_mempool isc_mempool_t; /*%< Memory Pool */ typedef struct isc_msgcat isc_msgcat_t; /*%< Message Catalog */ typedef struct isc_ondestroy isc_ondestroy_t; /*%< On Destroy */ typedef struct isc_netaddr isc_netaddr_t; /*%< Net Address */ typedef struct isc_portset isc_portset_t; /*%< Port Set */ typedef struct isc_quota isc_quota_t; /*%< Quota */ typedef struct isc_random isc_random_t; /*%< Random */ typedef struct isc_ratelimiter isc_ratelimiter_t; /*%< Rate Limiter */ typedef struct isc_region isc_region_t; /*%< Region */ typedef isc_uint64_t isc_resourcevalue_t; /*%< Resource Value */ typedef unsigned int isc_result_t; /*%< Result */ typedef struct isc_rwlock isc_rwlock_t; /*%< Read Write Lock */ typedef struct isc_sockaddr isc_sockaddr_t; /*%< Socket Address */ typedef ISC_LIST(isc_sockaddr_t) isc_sockaddrlist_t; /*%< Socket Address List */ typedef struct isc_socket isc_socket_t; /*%< Socket */ typedef struct isc_socketevent isc_socketevent_t; /*%< Socket Event */ typedef struct isc_socketmgr isc_socketmgr_t; /*%< Socket Manager */ typedef struct isc_stats isc_stats_t; /*%< Statistics */ typedef int isc_statscounter_t; /*%< Statistics Counter */ typedef struct isc_symtab isc_symtab_t; /*%< Symbol Table */ typedef struct isc_task isc_task_t; /*%< Task */ typedef ISC_LIST(isc_task_t) isc_tasklist_t; /*%< Task List */ typedef struct isc_taskmgr isc_taskmgr_t; /*%< Task Manager */ typedef struct isc_textregion isc_textregion_t; /*%< Text Region */ typedef struct isc_time isc_time_t; /*%< Time */ typedef struct isc_timer isc_timer_t; /*%< Timer */ typedef struct isc_timermgr isc_timermgr_t; /*%< Timer Manager */ typedef void (*isc_taskaction_t)(isc_task_t *, isc_event_t *); typedef int (*isc_sockfdwatch_t)(isc_task_t *, isc_socket_t *, void *, int); /* The following cannot be listed alphabetically due to forward reference */ typedef isc_result_t (isc_httpdaction_t)(const char *url, isc_httpdurl_t *urlinfo, const char *querystring, const char *headers, void *arg, unsigned int *retcode, const char **retmsg, const char **mimetype, isc_buffer_t *body, isc_httpdfree_t **freecb, void **freecb_args); typedef isc_boolean_t (isc_httpdclientok_t)(const isc_sockaddr_t *, void *); /*% Resource */ typedef enum { isc_resource_coresize = 1, isc_resource_cputime, isc_resource_datasize, isc_resource_filesize, isc_resource_lockedmemory, isc_resource_openfiles, isc_resource_processes, isc_resource_residentsize, isc_resource_stacksize } isc_resource_t; /*% Statistics formats (text file or XML) */ typedef enum { isc_statsformat_file, isc_statsformat_xml, isc_statsformat_json } isc_statsformat_t; #endif /* ISC_TYPES_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/lex.h�������������������������������������������������������������������������������������0000644�����������������00000022655�14763166026�0007315 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_LEX_H #define ISC_LEX_H 1 /***** ***** Module Info *****/ /*! \file isc/lex.h * \brief The "lex" module provides a lightweight tokenizer. It can operate * on files or buffers, and can handle "include". It is designed for * parsing of DNS master files and the BIND configuration file, but * should be general enough to tokenize other things, e.g. HTTP. * * \li MP: * No synchronization is provided. Clients must ensure exclusive * access. * * \li Reliability: * No anticipated impact. * * \li Resources: * TBS * * \li Security: * No anticipated impact. * * \li Standards: * None. */ /*** *** Imports ***/ #include <stdio.h> #include <isc/lang.h> #include <isc/region.h> #include <isc/types.h> ISC_LANG_BEGINDECLS /*** *** Options ***/ /*@{*/ /*! * Various options for isc_lex_gettoken(). */ #define ISC_LEXOPT_EOL 0x01 /*%< Want end-of-line token. */ #define ISC_LEXOPT_EOF 0x02 /*%< Want end-of-file token. */ #define ISC_LEXOPT_INITIALWS 0x04 /*%< Want initial whitespace. */ #define ISC_LEXOPT_NUMBER 0x08 /*%< Recognize numbers. */ #define ISC_LEXOPT_QSTRING 0x10 /*%< Recognize qstrings. */ /*@}*/ /*@{*/ /*! * The ISC_LEXOPT_DNSMULTILINE option handles the processing of '(' and ')' in * the DNS master file format. If this option is set, then the * ISC_LEXOPT_INITIALWS and ISC_LEXOPT_EOL options will be ignored when * the paren count is > 0. To use this option, '(' and ')' must be special * characters. */ #define ISC_LEXOPT_DNSMULTILINE 0x20 /*%< Handle '(' and ')'. */ #define ISC_LEXOPT_NOMORE 0x40 /*%< Want "no more" token. */ #define ISC_LEXOPT_CNUMBER 0x80 /*%< Recognize octal and hex. */ #define ISC_LEXOPT_ESCAPE 0x100 /*%< Recognize escapes. */ #define ISC_LEXOPT_QSTRINGMULTILINE 0x200 /*%< Allow multiline "" strings */ #define ISC_LEXOPT_OCTAL 0x400 /*%< Expect a octal number. */ #define ISC_LEXOPT_BTEXT 0x800 /*%< Bracketed text. */ /*@}*/ /*@{*/ /*! * Various commenting styles, which may be changed at any time with * isc_lex_setcomments(). */ #define ISC_LEXCOMMENT_C 0x01 #define ISC_LEXCOMMENT_CPLUSPLUS 0x02 #define ISC_LEXCOMMENT_SHELL 0x04 #define ISC_LEXCOMMENT_DNSMASTERFILE 0x08 /*@}*/ /*** *** Types ***/ /*! Lex */ typedef char isc_lexspecials_t[256]; /* Tokens */ typedef enum { isc_tokentype_unknown = 0, isc_tokentype_string = 1, isc_tokentype_number = 2, isc_tokentype_qstring = 3, isc_tokentype_eol = 4, isc_tokentype_eof = 5, isc_tokentype_initialws = 6, isc_tokentype_special = 7, isc_tokentype_nomore = 8, isc_tokentype_btext = 8 } isc_tokentype_t; typedef union { char as_char; unsigned long as_ulong; isc_region_t as_region; isc_textregion_t as_textregion; void * as_pointer; } isc_tokenvalue_t; typedef struct isc_token { isc_tokentype_t type; isc_tokenvalue_t value; } isc_token_t; /*** *** Functions ***/ isc_result_t isc_lex_create(isc_mem_t *mctx, size_t max_token, isc_lex_t **lexp); /*%< * Create a lexer. * * 'max_token' is a hint of the number of bytes in the largest token. * * Requires: *\li '*lexp' is a valid lexer. * * Ensures: *\li On success, *lexp is attached to the newly created lexer. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY */ void isc_lex_destroy(isc_lex_t **lexp); /*%< * Destroy the lexer. * * Requires: *\li '*lexp' is a valid lexer. * * Ensures: *\li *lexp == NULL */ unsigned int isc_lex_getcomments(isc_lex_t *lex); /*%< * Return the current lexer commenting styles. * * Requires: *\li 'lex' is a valid lexer. * * Returns: *\li The commenting sytles which are currently allowed. */ void isc_lex_setcomments(isc_lex_t *lex, unsigned int comments); /*%< * Set allowed lexer commenting styles. * * Requires: *\li 'lex' is a valid lexer. * *\li 'comments' has meaningful values. */ void isc_lex_getspecials(isc_lex_t *lex, isc_lexspecials_t specials); /*%< * Put the current list of specials into 'specials'. * * Requires: *\li 'lex' is a valid lexer. */ void isc_lex_setspecials(isc_lex_t *lex, isc_lexspecials_t specials); /*!< * The characters in 'specials' are returned as tokens. Along with * whitespace, they delimit strings and numbers. * * Note: *\li Comment processing takes precedence over special character * recognition. * * Requires: *\li 'lex' is a valid lexer. */ isc_result_t isc_lex_openfile(isc_lex_t *lex, const char *filename); /*%< * Open 'filename' and make it the current input source for 'lex'. * * Requires: *\li 'lex' is a valid lexer. * *\li filename is a valid C string. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY Out of memory *\li #ISC_R_NOTFOUND File not found *\li #ISC_R_NOPERM No permission to open file *\li #ISC_R_FAILURE Couldn't open file, not sure why *\li #ISC_R_UNEXPECTED */ isc_result_t isc_lex_openstream(isc_lex_t *lex, FILE *stream); /*%< * Make 'stream' the current input source for 'lex'. * * Requires: *\li 'lex' is a valid lexer. * *\li 'stream' is a valid C stream. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY Out of memory */ isc_result_t isc_lex_openbuffer(isc_lex_t *lex, isc_buffer_t *buffer); /*%< * Make 'buffer' the current input source for 'lex'. * * Requires: *\li 'lex' is a valid lexer. * *\li 'buffer' is a valid buffer. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY Out of memory */ isc_result_t isc_lex_close(isc_lex_t *lex); /*%< * Close the most recently opened object (i.e. file or buffer). * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMORE No more input sources */ isc_result_t isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp); /*%< * Get the next token. * * Requires: *\li 'lex' is a valid lexer. * *\li 'lex' has an input source. * *\li 'options' contains valid options. * *\li '*tokenp' is a valid pointer. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_UNEXPECTEDEND *\li #ISC_R_NOMEMORY * * These two results are returned only if their corresponding lexer * options are not set. * *\li #ISC_R_EOF End of input source *\li #ISC_R_NOMORE No more input sources */ isc_result_t isc_lex_getmastertoken(isc_lex_t *lex, isc_token_t *token, isc_tokentype_t expect, isc_boolean_t eol); /*%< * Get the next token from a DNS master file type stream. This is a * convenience function that sets appropriate options and handles quoted * strings and end of line correctly for master files. It also ungets * unexpected tokens. * * Requires: *\li 'lex' is a valid lexer. * *\li 'token' is a valid pointer * * Returns: * * \li any return code from isc_lex_gettoken(). */ isc_result_t isc_lex_getoctaltoken(isc_lex_t *lex, isc_token_t *token, isc_boolean_t eol); /*%< * Get the next token from a DNS master file type stream. This is a * convenience function that sets appropriate options and handles end * of line correctly for master files. It also ungets unexpected tokens. * * Requires: *\li 'lex' is a valid lexer. * *\li 'token' is a valid pointer * * Returns: * * \li any return code from isc_lex_gettoken(). */ void isc_lex_ungettoken(isc_lex_t *lex, isc_token_t *tokenp); /*%< * Unget the current token. * * Requires: *\li 'lex' is a valid lexer. * *\li 'lex' has an input source. * *\li 'tokenp' points to a valid token. * *\li There is no ungotten token already. */ void isc_lex_getlasttokentext(isc_lex_t *lex, isc_token_t *tokenp, isc_region_t *r); /*%< * Returns a region containing the text of the last token returned. * * Requires: *\li 'lex' is a valid lexer. * *\li 'lex' has an input source. * *\li 'tokenp' points to a valid token. * *\li A token has been gotten and not ungotten. */ char * isc_lex_getsourcename(isc_lex_t *lex); /*%< * Return the input source name. * * Requires: *\li 'lex' is a valid lexer. * * Returns: * \li source name or NULL if no current source. *\li result valid while current input source exists. */ unsigned long isc_lex_getsourceline(isc_lex_t *lex); /*%< * Return the input source line number. * * Requires: *\li 'lex' is a valid lexer. * * Returns: *\li Current line number or 0 if no current source. */ isc_result_t isc_lex_setsourcename(isc_lex_t *lex, const char *name); /*%< * Assigns a new name to the input source. * * Requires: * * \li 'lex' is a valid lexer. * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_NOMEMORY * \li #ISC_R_NOTFOUND - there are no sources. */ isc_result_t isc_lex_setsourceline(isc_lex_t *lex, unsigned long line); /*%< * Assigns a new line number to the input source. This can be used * when parsing a buffer that's been excerpted from the middle a file, * allowing logged messages to display the correct line number, * rather than the line number within the buffer. * * Requires: * * \li 'lex' is a valid lexer. * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_NOTFOUND - there are no sources. */ isc_boolean_t isc_lex_isfile(isc_lex_t *lex); /*%< * Return whether the current input source is a file. * * Requires: *\li 'lex' is a valid lexer. * * Returns: * \li #ISC_TRUE if the current input is a file, *\li #ISC_FALSE otherwise. */ ISC_LANG_ENDDECLS #endif /* ISC_LEX_H */ �����������������������������������������������������������������������������������bind9/isc/boolean.h���������������������������������������������������������������������������������0000644�����������������00000001352�14763166026�0010133 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: boolean.h,v 1.19 2007/06/19 23:47:18 tbox Exp $ */ #ifndef ISC_BOOLEAN_H #define ISC_BOOLEAN_H 1 /*! \file isc/boolean.h */ typedef enum { isc_boolean_false = 0, isc_boolean_true = 1 } isc_boolean_t; #define ISC_FALSE isc_boolean_false #define ISC_TRUE isc_boolean_true #define ISC_TF(x) ((x) ? ISC_TRUE : ISC_FALSE) #endif /* ISC_BOOLEAN_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/meminfo.h���������������������������������������������������������������������������������0000644�����������������00000001262�14763166026�0010146 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_MEMINFO_H #define ISC_MEMINFO_H 1 #include <isc/types.h> #include <isc/lang.h> ISC_LANG_BEGINDECLS isc_uint64_t isc_meminfo_totalphys(void); /*%< * Return total available physical memory in bytes, or 0 if this cannot * be determined */ ISC_LANG_ENDDECLS #endif /* ISC_MEMINFO_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/result.h����������������������������������������������������������������������������������0000644�����������������00000011172�14763166026�0010033 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_RESULT_H #define ISC_RESULT_H 1 /*! \file isc/result.h */ #include <isc/lang.h> #include <isc/types.h> #define ISC_R_SUCCESS 0 /*%< success */ #define ISC_R_NOMEMORY 1 /*%< out of memory */ #define ISC_R_TIMEDOUT 2 /*%< timed out */ #define ISC_R_NOTHREADS 3 /*%< no available threads */ #define ISC_R_ADDRNOTAVAIL 4 /*%< address not available */ #define ISC_R_ADDRINUSE 5 /*%< address in use */ #define ISC_R_NOPERM 6 /*%< permission denied */ #define ISC_R_NOCONN 7 /*%< no pending connections */ #define ISC_R_NETUNREACH 8 /*%< network unreachable */ #define ISC_R_HOSTUNREACH 9 /*%< host unreachable */ #define ISC_R_NETDOWN 10 /*%< network down */ #define ISC_R_HOSTDOWN 11 /*%< host down */ #define ISC_R_CONNREFUSED 12 /*%< connection refused */ #define ISC_R_NORESOURCES 13 /*%< not enough free resources */ #define ISC_R_EOF 14 /*%< end of file */ #define ISC_R_BOUND 15 /*%< socket already bound */ #define ISC_R_RELOAD 16 /*%< reload */ #define ISC_R_SUSPEND ISC_R_RELOAD /*%< alias of 'reload' */ #define ISC_R_LOCKBUSY 17 /*%< lock busy */ #define ISC_R_EXISTS 18 /*%< already exists */ #define ISC_R_NOSPACE 19 /*%< ran out of space */ #define ISC_R_CANCELED 20 /*%< operation canceled */ #define ISC_R_NOTBOUND 21 /*%< socket is not bound */ #define ISC_R_SHUTTINGDOWN 22 /*%< shutting down */ #define ISC_R_NOTFOUND 23 /*%< not found */ #define ISC_R_UNEXPECTEDEND 24 /*%< unexpected end of input */ #define ISC_R_FAILURE 25 /*%< generic failure */ #define ISC_R_IOERROR 26 /*%< I/O error */ #define ISC_R_NOTIMPLEMENTED 27 /*%< not implemented */ #define ISC_R_UNBALANCED 28 /*%< unbalanced parentheses */ #define ISC_R_NOMORE 29 /*%< no more */ #define ISC_R_INVALIDFILE 30 /*%< invalid file */ #define ISC_R_BADBASE64 31 /*%< bad base64 encoding */ #define ISC_R_UNEXPECTEDTOKEN 32 /*%< unexpected token */ #define ISC_R_QUOTA 33 /*%< quota reached */ #define ISC_R_UNEXPECTED 34 /*%< unexpected error */ #define ISC_R_ALREADYRUNNING 35 /*%< already running */ #define ISC_R_IGNORE 36 /*%< ignore */ #define ISC_R_MASKNONCONTIG 37 /*%< addr mask not contiguous */ #define ISC_R_FILENOTFOUND 38 /*%< file not found */ #define ISC_R_FILEEXISTS 39 /*%< file already exists */ #define ISC_R_NOTCONNECTED 40 /*%< socket is not connected */ #define ISC_R_RANGE 41 /*%< out of range */ #define ISC_R_NOENTROPY 42 /*%< out of entropy */ #define ISC_R_MULTICAST 43 /*%< invalid use of multicast */ #define ISC_R_NOTFILE 44 /*%< not a file */ #define ISC_R_NOTDIRECTORY 45 /*%< not a directory */ #define ISC_R_QUEUEFULL 46 /*%< queue is full */ #define ISC_R_FAMILYMISMATCH 47 /*%< address family mismatch */ #define ISC_R_FAMILYNOSUPPORT 48 /*%< AF not supported */ #define ISC_R_BADHEX 49 /*%< bad hex encoding */ #define ISC_R_TOOMANYOPENFILES 50 /*%< too many open files */ #define ISC_R_NOTBLOCKING 51 /*%< not blocking */ #define ISC_R_UNBALANCEDQUOTES 52 /*%< unbalanced quotes */ #define ISC_R_INPROGRESS 53 /*%< operation in progress */ #define ISC_R_CONNECTIONRESET 54 /*%< connection reset */ #define ISC_R_SOFTQUOTA 55 /*%< soft quota reached */ #define ISC_R_BADNUMBER 56 /*%< not a valid number */ #define ISC_R_DISABLED 57 /*%< disabled */ #define ISC_R_MAXSIZE 58 /*%< max size */ #define ISC_R_BADADDRESSFORM 59 /*%< invalid address format */ #define ISC_R_BADBASE32 60 /*%< bad base32 encoding */ #define ISC_R_UNSET 61 /*%< unset */ #define ISC_R_MULTIPLE 62 /*%< multiple */ #define ISC_R_WOULDBLOCK 63 /*%< would block */ #define ISC_R_TIMESHIFTED 64 /*%< system time changed */ /*% Not a result code: the number of results. */ #define ISC_R_NRESULTS 66 ISC_LANG_BEGINDECLS const char * isc_result_totext(isc_result_t); /*%< * Convert an isc_result_t into a string message describing the result. */ const char * isc_result_toid(isc_result_t); /*%< * Convert an isc_result_t into a string identifier such as * "ISC_R_SUCCESS". */ isc_result_t isc_result_register(unsigned int base, unsigned int nresults, const char **text, isc_msgcat_t *msgcat, int set); isc_result_t isc_result_registerids(unsigned int base, unsigned int nresults, const char **ids, isc_msgcat_t *msgcat, int set); ISC_LANG_ENDDECLS #endif /* ISC_RESULT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/task.h������������������������������������������������������������������������������������0000644�����������������00000051736�14763166026�0007471 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_TASK_H #define ISC_TASK_H 1 /***** ***** Module Info *****/ /*! \file isc/task.h * \brief The task system provides a lightweight execution context, which is * basically an event queue. * When a task's event queue is non-empty, the * task is runnable. A small work crew of threads, typically one per CPU, * execute runnable tasks by dispatching the events on the tasks' event * queues. Context switching between tasks is fast. * * \li MP: * The module ensures appropriate synchronization of data structures it * creates and manipulates. * The caller must ensure that isc_taskmgr_destroy() is called only * once for a given manager. * * \li Reliability: * No anticipated impact. * * \li Resources: * TBS * * \li Security: * No anticipated impact. * * \li Standards: * None. * * \section purge Purging and Unsending * * Events which have been queued for a task but not delivered may be removed * from the task's event queue by purging or unsending. * * With both types, the caller specifies a matching pattern that selects * events based upon their sender, type, and tag. * * Purging calls isc_event_free() on the matching events. * * Unsending returns a list of events that matched the pattern. * The caller is then responsible for them. * * Consumers of events should purge, not unsend. * * Producers of events often want to remove events when the caller indicates * it is no longer interested in the object, e.g. by canceling a timer. * Sometimes this can be done by purging, but for some event types, the * calls to isc_event_free() cause deadlock because the event free routine * wants to acquire a lock the caller is already holding. Unsending instead * of purging solves this problem. As a general rule, producers should only * unsend events which they have sent. */ /*** *** Imports. ***/ #include <isc/eventclass.h> #include <isc/json.h> #include <isc/lang.h> #include <isc/stdtime.h> #include <isc/types.h> #include <isc/xml.h> #define ISC_TASKEVENT_FIRSTEVENT (ISC_EVENTCLASS_TASK + 0) #define ISC_TASKEVENT_SHUTDOWN (ISC_EVENTCLASS_TASK + 1) #define ISC_TASKEVENT_TEST (ISC_EVENTCLASS_TASK + 1) #define ISC_TASKEVENT_LASTEVENT (ISC_EVENTCLASS_TASK + 65535) /***** ***** Tasks. *****/ ISC_LANG_BEGINDECLS /*** *** Types ***/ typedef enum { isc_taskmgrmode_normal = 0, isc_taskmgrmode_privileged } isc_taskmgrmode_t; /*% Task and task manager methods */ typedef struct isc_taskmgrmethods { void (*destroy)(isc_taskmgr_t **managerp); void (*setmode)(isc_taskmgr_t *manager, isc_taskmgrmode_t mode); isc_taskmgrmode_t (*mode)(isc_taskmgr_t *manager); isc_result_t (*taskcreate)(isc_taskmgr_t *manager, unsigned int quantum, isc_task_t **taskp); void (*setexcltask)(isc_taskmgr_t *mgr, isc_task_t *task); isc_result_t (*excltask)(isc_taskmgr_t *mgr, isc_task_t **taskp); } isc_taskmgrmethods_t; typedef struct isc_taskmethods { void (*attach)(isc_task_t *source, isc_task_t **targetp); void (*detach)(isc_task_t **taskp); void (*destroy)(isc_task_t **taskp); void (*send)(isc_task_t *task, isc_event_t **eventp); void (*sendanddetach)(isc_task_t **taskp, isc_event_t **eventp); unsigned int (*unsend)(isc_task_t *task, void *sender, isc_eventtype_t type, void *tag, isc_eventlist_t *events); isc_result_t (*onshutdown)(isc_task_t *task, isc_taskaction_t action, void *arg); void (*shutdown)(isc_task_t *task); void (*setname)(isc_task_t *task, const char *name, void *tag); unsigned int (*purgeevents)(isc_task_t *task, void *sender, isc_eventtype_t type, void *tag); unsigned int (*purgerange)(isc_task_t *task, void *sender, isc_eventtype_t first, isc_eventtype_t last, void *tag); isc_result_t (*beginexclusive)(isc_task_t *task); void (*endexclusive)(isc_task_t *task); void (*setprivilege)(isc_task_t *task, isc_boolean_t priv); isc_boolean_t (*privilege)(isc_task_t *task); } isc_taskmethods_t; /*% * This structure is actually just the common prefix of a task manager * object implementation's version of an isc_taskmgr_t. * \brief * Direct use of this structure by clients is forbidden. task implementations * may change the structure. 'magic' must be ISCAPI_TASKMGR_MAGIC for any * of the isc_task_ routines to work. task implementations must maintain * all task invariants. */ struct isc_taskmgr { unsigned int impmagic; unsigned int magic; isc_taskmgrmethods_t *methods; }; #define ISCAPI_TASKMGR_MAGIC ISC_MAGIC('A','t','m','g') #define ISCAPI_TASKMGR_VALID(m) ((m) != NULL && \ (m)->magic == ISCAPI_TASKMGR_MAGIC) /*% * This is the common prefix of a task object. The same note as * that for the taskmgr structure applies. */ struct isc_task { unsigned int impmagic; unsigned int magic; isc_taskmethods_t *methods; }; #define ISCAPI_TASK_MAGIC ISC_MAGIC('A','t','s','t') #define ISCAPI_TASK_VALID(s) ((s) != NULL && \ (s)->magic == ISCAPI_TASK_MAGIC) isc_result_t isc_task_create(isc_taskmgr_t *manager, unsigned int quantum, isc_task_t **taskp); /*%< * Create a task. * * Notes: * *\li If 'quantum' is non-zero, then only that many events can be dispatched * before the task must yield to other tasks waiting to execute. If * quantum is zero, then the default quantum of the task manager will * be used. * *\li The 'quantum' option may be removed from isc_task_create() in the * future. If this happens, isc_task_getquantum() and * isc_task_setquantum() will be provided. * * Requires: * *\li 'manager' is a valid task manager. * *\li taskp != NULL && *taskp == NULL * * Ensures: * *\li On success, '*taskp' is bound to the new task. * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li #ISC_R_UNEXPECTED *\li #ISC_R_SHUTTINGDOWN */ void isc_task_attach(isc_task_t *source, isc_task_t **targetp); /*%< * Attach *targetp to source. * * Requires: * *\li 'source' is a valid task. * *\li 'targetp' points to a NULL isc_task_t *. * * Ensures: * *\li *targetp is attached to source. */ void isc_task_detach(isc_task_t **taskp); /*%< * Detach *taskp from its task. * * Requires: * *\li '*taskp' is a valid task. * * Ensures: * *\li *taskp is NULL. * *\li If '*taskp' is the last reference to the task, the task is idle (has * an empty event queue), and has not been shutdown, the task will be * shutdown. * *\li If '*taskp' is the last reference to the task and * the task has been shutdown, * all resources used by the task will be freed. */ void isc_task_send(isc_task_t *task, isc_event_t **eventp); /*%< * Send '*event' to 'task'. * * Requires: * *\li 'task' is a valid task. *\li eventp != NULL && *eventp != NULL. * * Ensures: * *\li *eventp == NULL. */ void isc_task_sendanddetach(isc_task_t **taskp, isc_event_t **eventp); /*%< * Send '*event' to '*taskp' and then detach '*taskp' from its * task. * * Requires: * *\li '*taskp' is a valid task. *\li eventp != NULL && *eventp != NULL. * * Ensures: * *\li *eventp == NULL. * *\li *taskp == NULL. * *\li If '*taskp' is the last reference to the task, the task is * idle (has an empty event queue), and has not been shutdown, * the task will be shutdown. * *\li If '*taskp' is the last reference to the task and * the task has been shutdown, * all resources used by the task will be freed. */ unsigned int isc_task_purgerange(isc_task_t *task, void *sender, isc_eventtype_t first, isc_eventtype_t last, void *tag); /*%< * Purge events from a task's event queue. * * Requires: * *\li 'task' is a valid task. * *\li last >= first * * Ensures: * *\li Events in the event queue of 'task' whose sender is 'sender', whose * type is >= first and <= last, and whose tag is 'tag' will be purged, * unless they are marked as unpurgable. * *\li A sender of NULL will match any sender. A NULL tag matches any * tag. * * Returns: * *\li The number of events purged. */ unsigned int isc_task_purge(isc_task_t *task, void *sender, isc_eventtype_t type, void *tag); /*%< * Purge events from a task's event queue. * * Notes: * *\li This function is equivalent to * *\code * isc_task_purgerange(task, sender, type, type, tag); *\endcode * * Requires: * *\li 'task' is a valid task. * * Ensures: * *\li Events in the event queue of 'task' whose sender is 'sender', whose * type is 'type', and whose tag is 'tag' will be purged, unless they * are marked as unpurgable. * *\li A sender of NULL will match any sender. A NULL tag matches any * tag. * * Returns: * *\li The number of events purged. */ isc_boolean_t isc_task_purgeevent(isc_task_t *task, isc_event_t *event); /*%< * Purge 'event' from a task's event queue. * * XXXRTH: WARNING: This method may be removed before beta. * * Notes: * *\li If 'event' is on the task's event queue, it will be purged, * unless it is marked as unpurgeable. 'event' does not have to be * on the task's event queue; in fact, it can even be an invalid * pointer. Purging only occurs if the event is actually on the task's * event queue. * * \li Purging never changes the state of the task. * * Requires: * *\li 'task' is a valid task. * * Ensures: * *\li 'event' is not in the event queue for 'task'. * * Returns: * *\li #ISC_TRUE The event was purged. *\li #ISC_FALSE The event was not in the event queue, * or was marked unpurgeable. */ unsigned int isc_task_unsendrange(isc_task_t *task, void *sender, isc_eventtype_t first, isc_eventtype_t last, void *tag, isc_eventlist_t *events); /*%< * Remove events from a task's event queue. * * Requires: * *\li 'task' is a valid task. * *\li last >= first. * *\li *events is a valid list. * * Ensures: * *\li Events in the event queue of 'task' whose sender is 'sender', whose * type is >= first and <= last, and whose tag is 'tag' will be dequeued * and appended to *events. * *\li A sender of NULL will match any sender. A NULL tag matches any * tag. * * Returns: * *\li The number of events unsent. */ unsigned int isc_task_unsend(isc_task_t *task, void *sender, isc_eventtype_t type, void *tag, isc_eventlist_t *events); /*%< * Remove events from a task's event queue. * * Notes: * *\li This function is equivalent to * *\code * isc_task_unsendrange(task, sender, type, type, tag, events); *\endcode * * Requires: * *\li 'task' is a valid task. * *\li *events is a valid list. * * Ensures: * *\li Events in the event queue of 'task' whose sender is 'sender', whose * type is 'type', and whose tag is 'tag' will be dequeued and appended * to *events. * * Returns: * *\li The number of events unsent. */ isc_result_t isc_task_onshutdown(isc_task_t *task, isc_taskaction_t action, void *arg); /*%< * Send a shutdown event with action 'action' and argument 'arg' when * 'task' is shutdown. * * Notes: * *\li Shutdown events are posted in LIFO order. * * Requires: * *\li 'task' is a valid task. * *\li 'action' is a valid task action. * * Ensures: * *\li When the task is shutdown, shutdown events requested with * isc_task_onshutdown() will be appended to the task's event queue. * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li #ISC_R_SHUTTINGDOWN Task is shutting down. */ void isc_task_shutdown(isc_task_t *task); /*%< * Shutdown 'task'. * * Notes: * *\li Shutting down a task causes any shutdown events requested with * isc_task_onshutdown() to be posted (in LIFO order). The task * moves into a "shutting down" mode which prevents further calls * to isc_task_onshutdown(). * *\li Trying to shutdown a task that has already been shutdown has no * effect. * * Requires: * *\li 'task' is a valid task. * * Ensures: * *\li Any shutdown events requested with isc_task_onshutdown() have been * posted (in LIFO order). */ void isc_task_destroy(isc_task_t **taskp); /*%< * Destroy '*taskp'. * * Notes: * *\li This call is equivalent to: * *\code * isc_task_shutdown(*taskp); * isc_task_detach(taskp); *\endcode * * Requires: * * '*taskp' is a valid task. * * Ensures: * *\li Any shutdown events requested with isc_task_onshutdown() have been * posted (in LIFO order). * *\li *taskp == NULL * *\li If '*taskp' is the last reference to the task, * all resources used by the task will be freed. */ void isc_task_setname(isc_task_t *task, const char *name, void *tag); /*%< * Name 'task'. * * Notes: * *\li Only the first 15 characters of 'name' will be copied. * *\li Naming a task is currently only useful for debugging purposes. * * Requires: * *\li 'task' is a valid task. */ const char * isc_task_getname(isc_task_t *task); /*%< * Get the name of 'task', as previously set using isc_task_setname(). * * Notes: *\li This function is for debugging purposes only. * * Requires: *\li 'task' is a valid task. * * Returns: *\li A non-NULL pointer to a null-terminated string. * If the task has not been named, the string is * empty. * */ void * isc_task_gettag(isc_task_t *task); /*%< * Get the tag value for 'task', as previously set using isc_task_settag(). * * Notes: *\li This function is for debugging purposes only. * * Requires: *\li 'task' is a valid task. */ isc_result_t isc_task_beginexclusive(isc_task_t *task); /*%< * Request exclusive access for 'task', which must be the calling * task. Waits for any other concurrently executing tasks to finish their * current event, and prevents any new events from executing in any of the * tasks sharing a task manager with 'task'. * * The exclusive access must be relinquished by calling * isc_task_endexclusive() before returning from the current event handler. * * Requires: *\li 'task' is the calling task. * * Returns: *\li #ISC_R_SUCCESS The current task now has exclusive access. *\li #ISC_R_LOCKBUSY Another task has already requested exclusive * access. */ void isc_task_endexclusive(isc_task_t *task); /*%< * Relinquish the exclusive access obtained by isc_task_beginexclusive(), * allowing other tasks to execute. * * Requires: *\li 'task' is the calling task, and has obtained * exclusive access by calling isc_task_spl(). */ void isc_task_getcurrenttime(isc_task_t *task, isc_stdtime_t *t); void isc_task_getcurrenttimex(isc_task_t *task, isc_time_t *t); /*%< * Provide the most recent timestamp on the task. The timestamp is considered * as the "current time". * * isc_task_getcurrentime() returns the time in one-second granularity; * isc_task_getcurrentimex() returns it in nanosecond granularity. * * Requires: *\li 'task' is a valid task. *\li 't' is a valid non NULL pointer. * * Ensures: *\li '*t' has the "current time". */ isc_boolean_t isc_task_exiting(isc_task_t *t); /*%< * Returns ISC_TRUE if the task is in the process of shutting down, * ISC_FALSE otherwise. * * Requires: *\li 'task' is a valid task. */ void isc_task_setprivilege(isc_task_t *task, isc_boolean_t priv); /*%< * Set or unset the task's "privileged" flag depending on the value of * 'priv'. * * Under normal circumstances this flag has no effect on the task behavior, * but when the task manager has been set to privileged execution mode via * isc_taskmgr_setmode(), only tasks with the flag set will be executed, * and all other tasks will wait until they're done. Once all privileged * tasks have finished executing, the task manager will automatically * return to normal execution mode and nonprivileged task can resume. * * Requires: *\li 'task' is a valid task. */ isc_boolean_t isc_task_privilege(isc_task_t *task); /*%< * Returns the current value of the task's privilege flag. * * Requires: *\li 'task' is a valid task. */ /***** ***** Task Manager. *****/ isc_result_t isc_taskmgr_createinctx(isc_mem_t *mctx, isc_appctx_t *actx, unsigned int workers, unsigned int default_quantum, isc_taskmgr_t **managerp); isc_result_t isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers, unsigned int default_quantum, isc_taskmgr_t **managerp); /*%< * Create a new task manager. isc_taskmgr_createinctx() also associates * the new manager with the specified application context. * * Notes: * *\li 'workers' in the number of worker threads to create. In general, * the value should be close to the number of processors in the system. * The 'workers' value is advisory only. An attempt will be made to * create 'workers' threads, but if at least one thread creation * succeeds, isc_taskmgr_create() may return ISC_R_SUCCESS. * *\li If 'default_quantum' is non-zero, then it will be used as the default * quantum value when tasks are created. If zero, then an implementation * defined default quantum will be used. * * Requires: * *\li 'mctx' is a valid memory context. * *\li workers > 0 * *\li managerp != NULL && *managerp == NULL * *\li 'actx' is a valid application context (for createinctx()). * * Ensures: * *\li On success, '*managerp' will be attached to the newly created task * manager. * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li #ISC_R_NOTHREADS No threads could be created. *\li #ISC_R_UNEXPECTED An unexpected error occurred. *\li #ISC_R_SHUTTINGDOWN The non-threaded, shared, task * manager shutting down. */ void isc_taskmgr_setmode(isc_taskmgr_t *manager, isc_taskmgrmode_t mode); isc_taskmgrmode_t isc_taskmgr_mode(isc_taskmgr_t *manager); /*%< * Set/get the current operating mode of the task manager. Valid modes are: * *\li isc_taskmgrmode_normal *\li isc_taskmgrmode_privileged * * In privileged execution mode, only tasks that have had the "privilege" * flag set via isc_task_setprivilege() can be executed. When all such * tasks are complete, the manager automatically returns to normal mode * and proceeds with running non-privileged ready tasks. This means it is * necessary to have at least one privileged task waiting on the ready * queue *before* setting the manager into privileged execution mode, * which in turn means the task which calls this function should be in * task-exclusive mode when it does so. * * Requires: * *\li 'manager' is a valid task manager. */ void isc_taskmgr_destroy(isc_taskmgr_t **managerp); /*%< * Destroy '*managerp'. * * Notes: * *\li Calling isc_taskmgr_destroy() will shutdown all tasks managed by * *managerp that haven't already been shutdown. The call will block * until all tasks have entered the done state. * *\li isc_taskmgr_destroy() must not be called by a task event action, * because it would block forever waiting for the event action to * complete. An event action that wants to cause task manager shutdown * should request some non-event action thread of execution to do the * shutdown, e.g. by signaling a condition variable or using * isc_app_shutdown(). * *\li Task manager references are not reference counted, so the caller * must ensure that no attempt will be made to use the manager after * isc_taskmgr_destroy() returns. * * Requires: * *\li '*managerp' is a valid task manager. * *\li isc_taskmgr_destroy() has not be called previously on '*managerp'. * * Ensures: * *\li All resources used by the task manager, and any tasks it managed, * have been freed. */ void isc_taskmgr_setexcltask(isc_taskmgr_t *mgr, isc_task_t *task); /*%< * Set a task which will be used for all task-exclusive operations. * * Requires: *\li 'manager' is a valid task manager. * *\li 'task' is a valid task. */ isc_result_t isc_taskmgr_excltask(isc_taskmgr_t *mgr, isc_task_t **taskp); /*%< * Attach '*taskp' to the task set by isc_taskmgr_getexcltask(). * This task should be used whenever running in task-exclusive mode, * so as to prevent deadlock between two exclusive tasks. * * Requires: *\li 'manager' is a valid task manager. *\li taskp != NULL && *taskp == NULL */ #ifdef HAVE_LIBXML2 int isc_taskmgr_renderxml(isc_taskmgr_t *mgr, xmlTextWriterPtr writer); #endif #ifdef HAVE_JSON isc_result_t isc_taskmgr_renderjson(isc_taskmgr_t *mgr, json_object *tasksobj); #endif /*%< * See isc_taskmgr_create() above. */ typedef isc_result_t (*isc_taskmgrcreatefunc_t)(isc_mem_t *mctx, unsigned int workers, unsigned int default_quantum, isc_taskmgr_t **managerp); isc_result_t isc_task_register(isc_taskmgrcreatefunc_t createfunc); /*%< * Register a new task management implementation and add it to the list of * supported implementations. This function must be called when a different * event library is used than the one contained in the ISC library. */ isc_result_t isc__task_register(void); /*%< * A short cut function that specifies the task management module in the ISC * library for isc_task_register(). An application that uses the ISC library * usually do not have to care about this function: it would call * isc_lib_register(), which internally calls this function. */ ISC_LANG_ENDDECLS #endif /* ISC_TASK_H */ ����������������������������������bind9/isc/time.h������������������������������������������������������������������������������������0000644�����������������00000021245�14763166026�0007455 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_TIME_H #define ISC_TIME_H 1 /*! \file */ #include <isc/lang.h> #include <isc/types.h> /*** *** Intervals ***/ /*! * \brief * The contents of this structure are private, and MUST NOT be accessed * directly by callers. * * The contents are exposed only to allow callers to avoid dynamic allocation. */ struct isc_interval { unsigned int seconds; unsigned int nanoseconds; }; extern const isc_interval_t * const isc_interval_zero; /* * ISC_FORMATHTTPTIMESTAMP_SIZE needs to be 30 in C locale and potentially * more for other locales to handle longer national abbreviations when * expanding strftime's %a and %b. */ #define ISC_FORMATHTTPTIMESTAMP_SIZE 50 ISC_LANG_BEGINDECLS void isc_interval_set(isc_interval_t *i, unsigned int seconds, unsigned int nanoseconds); /*%< * Set 'i' to a value representing an interval of 'seconds' seconds and * 'nanoseconds' nanoseconds, suitable for use in isc_time_add() and * isc_time_subtract(). * * Requires: * *\li 't' is a valid pointer. *\li nanoseconds < 1000000000. */ isc_boolean_t isc_interval_iszero(const isc_interval_t *i); /*%< * Returns ISC_TRUE iff. 'i' is the zero interval. * * Requires: * *\li 'i' is a valid pointer. */ /*** *** Absolute Times ***/ /*% * The contents of this structure are private, and MUST NOT be accessed * directly by callers. * * The contents are exposed only to allow callers to avoid dynamic allocation. */ struct isc_time { unsigned int seconds; unsigned int nanoseconds; }; extern const isc_time_t * const isc_time_epoch; void isc_time_set(isc_time_t *t, unsigned int seconds, unsigned int nanoseconds); /*%< * Set 't' to a value which represents the given number of seconds and * nanoseconds since 00:00:00 January 1, 1970, UTC. * * Notes: *\li The Unix version of this call is equivalent to: *\code * isc_time_settoepoch(t); * isc_interval_set(i, seconds, nanoseconds); * isc_time_add(t, i, t); *\endcode * * Requires: *\li 't' is a valid pointer. *\li nanoseconds < 1000000000. */ void isc_time_settoepoch(isc_time_t *t); /*%< * Set 't' to the time of the epoch. * * Notes: *\li The date of the epoch is platform-dependent. * * Requires: * *\li 't' is a valid pointer. */ isc_boolean_t isc_time_isepoch(const isc_time_t *t); /*%< * Returns ISC_TRUE iff. 't' is the epoch ("time zero"). * * Requires: * *\li 't' is a valid pointer. */ #ifdef CLOCK_BOOTTIME isc_result_t isc_time_boottime(isc_time_t *t); /*%< * Set 't' to monotonic time from previous boot * it's not affected by system time change. It also * includes the time system was suspended * * Requires: *\li 't' is a valid pointer. * * Returns: * *\li Success *\li Unexpected error * Getting the time from the system failed. */ #endif /* CLOCK_BOOTTIME */ isc_result_t isc_time_now(isc_time_t *t); /*%< * Set 't' to the current absolute time. * * Requires: * *\li 't' is a valid pointer. * * Returns: * *\li Success *\li Unexpected error * Getting the time from the system failed. *\li Out of range * The time from the system is too large to be represented * in the current definition of isc_time_t. */ isc_result_t isc_time_nowplusinterval(isc_time_t *t, const isc_interval_t *i); /*%< * Set *t to the current absolute time + i. * * Note: *\li This call is equivalent to: * *\code * isc_time_now(t); * isc_time_add(t, i, t); *\endcode * * Requires: * *\li 't' and 'i' are valid pointers. * * Returns: * *\li Success *\li Unexpected error * Getting the time from the system failed. *\li Out of range * The interval added to the time from the system is too large to * be represented in the current definition of isc_time_t. */ int isc_time_compare(const isc_time_t *t1, const isc_time_t *t2); /*%< * Compare the times referenced by 't1' and 't2' * * Requires: * *\li 't1' and 't2' are valid pointers. * * Returns: * *\li -1 t1 < t2 (comparing times, not pointers) *\li 0 t1 = t2 *\li 1 t1 > t2 */ isc_result_t isc_time_add(const isc_time_t *t, const isc_interval_t *i, isc_time_t *result); /*%< * Add 'i' to 't', storing the result in 'result'. * * Requires: * *\li 't', 'i', and 'result' are valid pointers. * * Returns: *\li Success *\li Out of range * The interval added to the time is too large to * be represented in the current definition of isc_time_t. */ isc_result_t isc_time_subtract(const isc_time_t *t, const isc_interval_t *i, isc_time_t *result); /*%< * Subtract 'i' from 't', storing the result in 'result'. * * Requires: * *\li 't', 'i', and 'result' are valid pointers. * * Returns: *\li Success *\li Out of range * The interval is larger than the time since the epoch. */ isc_uint64_t isc_time_microdiff(const isc_time_t *t1, const isc_time_t *t2); /*%< * Find the difference in microseconds between time t1 and time t2. * t2 is the subtrahend of t1; ie, difference = t1 - t2. * * Requires: * *\li 't1' and 't2' are valid pointers. * * Returns: *\li The difference of t1 - t2, or 0 if t1 <= t2. */ isc_uint32_t isc_time_seconds(const isc_time_t *t); /*%< * Return the number of seconds since the epoch stored in a time structure. * * Requires: * *\li 't' is a valid pointer. */ isc_result_t isc_time_secondsastimet(const isc_time_t *t, time_t *secondsp); /*%< * Ensure the number of seconds in an isc_time_t is representable by a time_t. * * Notes: *\li The number of seconds stored in an isc_time_t might be larger * than the number of seconds a time_t is able to handle. Since * time_t is mostly opaque according to the ANSI/ISO standard * (essentially, all you can be sure of is that it is an arithmetic type, * not even necessarily integral), it can be tricky to ensure that * the isc_time_t is in the range a time_t can handle. Use this * function in place of isc_time_seconds() any time you need to set a * time_t from an isc_time_t. * * Requires: *\li 't' is a valid pointer. * * Returns: *\li Success *\li Out of range */ isc_uint32_t isc_time_nanoseconds(const isc_time_t *t); /*%< * Return the number of nanoseconds stored in a time structure. * * Notes: *\li This is the number of nanoseconds in excess of the number * of seconds since the epoch; it will always be less than one * full second. * * Requires: *\li 't' is a valid pointer. * * Ensures: *\li The returned value is less than 1*10^9. */ void isc_time_formattimestamp(const isc_time_t *t, char *buf, unsigned int len); /*%< * Format the time 't' into the buffer 'buf' of length 'len', * using a format like "30-Aug-2000 04:06:47.997" and the local time zone. * If the text does not fit in the buffer, the result is indeterminate, * but is always guaranteed to be null terminated. * * Requires: *\li 'len' > 0 *\li 'buf' points to an array of at least len chars * */ void isc_time_formathttptimestamp(const isc_time_t *t, char *buf, unsigned int len); /*%< * Format the time 't' into the buffer 'buf' of length 'len', * using a format like "Mon, 30 Aug 2000 04:06:47 GMT" * If the text does not fit in the buffer, the result is indeterminate, * but is always guaranteed to be null terminated. * * Requires: *\li 'len' > 0 *\li 'buf' points to an array of at least len chars * */ isc_result_t isc_time_parsehttptimestamp(char *input, isc_time_t *t); /*%< * Parse the time in 'input' into the isc_time_t pointed to by 't', * expecting a format like "Mon, 30 Aug 2000 04:06:47 GMT" * * Requires: *\li 'buf' and 't' are not NULL. */ void isc_time_formatISO8601(const isc_time_t *t, char *buf, unsigned int len); /*%< * Format the time 't' into the buffer 'buf' of length 'len', * using the ISO8601 format: "yyyy-mm-ddThh:mm:ssZ" * If the text does not fit in the buffer, the result is indeterminate, * but is always guaranteed to be null terminated. * * Requires: *\li 'len' > 0 *\li 'buf' points to an array of at least len chars * */ void isc_time_formatISO8601ms(const isc_time_t *t, char *buf, unsigned int len); /*%< * Format the time 't' into the buffer 'buf' of length 'len', * using the ISO8601 format: "yyyy-mm-ddThh:mm:ss.sssZ" * If the text does not fit in the buffer, the result is indeterminate, * but is always guaranteed to be null terminated. * * Requires: *\li 'len' > 0 *\li 'buf' points to an array of at least len chars * */ ISC_LANG_ENDDECLS #endif /* ISC_TIME_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/queue.h�����������������������������������������������������������������������������������0000644�����������������00000011240�14763166026�0007635 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* * This is a generic implementation of a two-lock concurrent queue. * There are built-in mutex locks for the head and tail of the queue, * allowing elements to be safely added and removed at the same time. * * NULL is "end of list" * -1 is "not linked" */ #ifndef ISC_QUEUE_H #define ISC_QUEUE_H 1 #include <isc/assertions.h> #include <isc/boolean.h> #include <isc/mutex.h> #ifdef ISC_QUEUE_CHECKINIT #define ISC_QLINK_INSIST(x) ISC_INSIST(x) #else #define ISC_QLINK_INSIST(x) (void)0 #endif #define ISC_QLINK(type) struct { type *prev, *next; } #define ISC_QLINK_INIT(elt, link) \ do { \ (elt)->link.next = (elt)->link.prev = (void *)(-1); \ } while(0) #define ISC_QLINK_LINKED(elt, link) ((void*)(elt)->link.next != (void*)(-1)) #define ISC_QUEUE(type) struct { \ type *head, *tail; \ isc_mutex_t headlock, taillock; \ } #define ISC_QUEUE_INIT(queue, link) \ do { \ (void) isc_mutex_init(&(queue).taillock); \ (void) isc_mutex_init(&(queue).headlock); \ (queue).tail = (queue).head = NULL; \ } while (0) #define ISC_QUEUE_EMPTY(queue) ISC_TF((queue).head == NULL) #define ISC_QUEUE_DESTROY(queue) \ do { \ ISC_QLINK_INSIST(ISC_QUEUE_EMPTY(queue)); \ (void) isc_mutex_destroy(&(queue).taillock); \ (void) isc_mutex_destroy(&(queue).headlock); \ } while (0) /* * queues are meant to separate the locks at either end. For best effect, that * means keeping the ends separate - i.e. non-empty queues work best. * * a push to an empty queue has to take the pop lock to update * the pop side of the queue. * Popping the last entry has to take the push lock to update * the push side of the queue. * * The order is (pop, push), because a pop is presumably in the * latency path and a push is when we're done. * * We do an MT hot test in push to see if we need both locks, so we can * acquire them in order. Hopefully that makes the case where we get * the push lock and find we need the pop lock (and have to release it) rare. * * > 1 entry - no collision, push works on one end, pop on the other * 0 entry - headlock race * pop wins - return(NULL), push adds new as both head/tail * push wins - updates head/tail, becomes 1 entry case. * 1 entry - taillock race * pop wins - return(pop) sets head/tail NULL, becomes 0 entry case * push wins - updates {head,tail}->link.next, pop updates head * with new ->link.next and doesn't update tail * */ #define ISC_QUEUE_PUSH(queue, elt, link) \ do { \ isc_boolean_t headlocked = ISC_FALSE; \ ISC_QLINK_INSIST(!ISC_QLINK_LINKED(elt, link)); \ if ((queue).head == NULL) { \ LOCK(&(queue).headlock); \ headlocked = ISC_TRUE; \ } \ LOCK(&(queue).taillock); \ if ((queue).tail == NULL && !headlocked) { \ UNLOCK(&(queue).taillock); \ LOCK(&(queue).headlock); \ LOCK(&(queue).taillock); \ headlocked = ISC_TRUE; \ } \ (elt)->link.prev = (queue).tail; \ (elt)->link.next = NULL; \ if ((queue).tail != NULL) \ (queue).tail->link.next = (elt); \ (queue).tail = (elt); \ UNLOCK(&(queue).taillock); \ if (headlocked) { \ if ((queue).head == NULL) \ (queue).head = (elt); \ UNLOCK(&(queue).headlock); \ } \ } while (0) #define ISC_QUEUE_POP(queue, link, ret) \ do { \ LOCK(&(queue).headlock); \ ret = (queue).head; \ while (ret != NULL) { \ if (ret->link.next == NULL) { \ LOCK(&(queue).taillock); \ if (ret->link.next == NULL) { \ (queue).head = (queue).tail = NULL; \ UNLOCK(&(queue).taillock); \ break; \ }\ UNLOCK(&(queue).taillock); \ } \ (queue).head = ret->link.next; \ (queue).head->link.prev = NULL; \ break; \ } \ UNLOCK(&(queue).headlock); \ if (ret != NULL) \ (ret)->link.next = (ret)->link.prev = (void *)(-1); \ } while(0) #define ISC_QUEUE_UNLINK(queue, elt, link) \ do { \ ISC_QLINK_INSIST(ISC_QLINK_LINKED(elt, link)); \ LOCK(&(queue).headlock); \ LOCK(&(queue).taillock); \ if ((elt)->link.prev == NULL) \ (queue).head = (elt)->link.next; \ else \ (elt)->link.prev->link.next = (elt)->link.next; \ if ((elt)->link.next == NULL) \ (queue).tail = (elt)->link.prev; \ else \ (elt)->link.next->link.prev = (elt)->link.prev; \ UNLOCK(&(queue).taillock); \ UNLOCK(&(queue).headlock); \ (elt)->link.next = (elt)->link.prev = (void *)(-1); \ } while(0) #endif /* ISC_QUEUE_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/quota.h�����������������������������������������������������������������������������������0000644�����������������00000004446�14763166026�0007654 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_QUOTA_H #define ISC_QUOTA_H 1 /***** ***** Module Info *****/ /*! \file isc/quota.h * * \brief The isc_quota_t object is a simple helper object for implementing * quotas on things like the number of simultaneous connections to * a server. It keeps track of the amount of quota in use, and * encapsulates the locking necessary to allow multiple tasks to * share a quota. */ /*** *** Imports. ***/ #include <isc/lang.h> #include <isc/mutex.h> #include <isc/types.h> /***** ***** Types. *****/ ISC_LANG_BEGINDECLS /*% isc_quota structure */ struct isc_quota { isc_mutex_t lock; /*%< Locked by lock. */ int max; int used; int soft; }; isc_result_t isc_quota_init(isc_quota_t *quota, int max); /*%< * Initialize a quota object. * * Returns: * ISC_R_SUCCESS * Other error Lock creation failed. */ void isc_quota_destroy(isc_quota_t *quota); /*%< * Destroy a quota object. */ void isc_quota_soft(isc_quota_t *quota, int soft); /*%< * Set a soft quota. */ void isc_quota_max(isc_quota_t *quota, int max); /*%< * Re-set a maximum quota. */ isc_result_t isc_quota_reserve(isc_quota_t *quota); /*%< * Attempt to reserve one unit of 'quota'. * * Returns: * \li #ISC_R_SUCCESS Success * \li #ISC_R_SOFTQUOTA Success soft quota reached * \li #ISC_R_QUOTA Quota is full */ void isc_quota_release(isc_quota_t *quota); /*%< * Release one unit of quota. */ isc_result_t isc_quota_attach(isc_quota_t *quota, isc_quota_t **p); /*%< * Like isc_quota_reserve, and also attaches '*p' to the * quota if successful (ISC_R_SUCCESS or ISC_R_SOFTQUOTA). */ isc_result_t isc_quota_force(isc_quota_t *quota, isc_quota_t **p); /*%< * Like isc_quota_attach, but will attach '*p' to the quota * even if the hard quota has been exceeded. */ void isc_quota_detach(isc_quota_t **p); /*%< * Like isc_quota_release, and also detaches '*p' from the * quota. */ ISC_LANG_ENDDECLS #endif /* ISC_QUOTA_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/keyboard.h��������������������������������������������������������������������������������0000644�����������������00000001720�14763166026�0010313 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_KEYBOARD_H #define ISC_KEYBOARD_H 1 /*! \file */ #include <termios.h> #include <isc/lang.h> #include <isc/result.h> ISC_LANG_BEGINDECLS typedef struct { int fd; struct termios saved_mode; isc_result_t result; } isc_keyboard_t; isc_result_t isc_keyboard_open(isc_keyboard_t *keyboard); isc_result_t isc_keyboard_close(isc_keyboard_t *keyboard, unsigned int sleepseconds); isc_result_t isc_keyboard_getchar(isc_keyboard_t *keyboard, unsigned char *cp); isc_boolean_t isc_keyboard_canceled(isc_keyboard_t *keyboard); ISC_LANG_ENDDECLS #endif /* ISC_KEYBOARD_H */ ������������������������������������������������bind9/isc/mem.h�������������������������������������������������������������������������������������0000644�����������������00000051210�14763166026�0007270 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_MEM_H #define ISC_MEM_H 1 /*! \file isc/mem.h */ #include <stdio.h> #include <isc/json.h> #include <isc/lang.h> #include <isc/mutex.h> #include <isc/platform.h> #include <isc/types.h> #include <isc/xml.h> ISC_LANG_BEGINDECLS #define ISC_MEM_LOWATER 0 #define ISC_MEM_HIWATER 1 typedef void (*isc_mem_water_t)(void *, int); typedef void * (*isc_memalloc_t)(void *, size_t); typedef void (*isc_memfree_t)(void *, void *); /*% * Define ISC_MEM_TRACKLINES=1 to turn on detailed tracing of memory * allocation and freeing by file and line number. */ #ifndef ISC_MEM_TRACKLINES #define ISC_MEM_TRACKLINES 1 #endif /*% * Define ISC_MEM_CHECKOVERRUN=1 to turn on checks for using memory outside * the requested space. This will increase the size of each allocation. * * If we are performing a Coverity static analysis then ISC_MEM_CHECKOVERRUN * can hide bugs that would otherwise discovered so force to zero. */ #ifdef __COVERITY__ #undef ISC_MEM_CHECKOVERRUN #define ISC_MEM_CHECKOVERRUN 0 #endif #ifndef ISC_MEM_CHECKOVERRUN #define ISC_MEM_CHECKOVERRUN 1 #endif /*% * Define ISC_MEM_FILL=1 to fill each block of memory returned to the system * with the byte string '0xbe'. This helps track down uninitialized pointers * and the like. On freeing memory, the space is filled with '0xde' for * the same reasons. * * If we are performing a Coverity static analysis then ISC_MEM_FILL * can hide bugs that would otherwise discovered so force to zero. */ #ifdef __COVERITY__ #undef ISC_MEM_FILL #define ISC_MEM_FILL 0 #endif #ifndef ISC_MEM_FILL #define ISC_MEM_FILL 1 #endif /*% * Define ISC_MEMPOOL_NAMES=1 to make memory pools store a symbolic * name so that the leaking pool can be more readily identified in * case of a memory leak. */ #ifndef ISC_MEMPOOL_NAMES #define ISC_MEMPOOL_NAMES 1 #endif LIBISC_EXTERNAL_DATA extern unsigned int isc_mem_debugging; LIBISC_EXTERNAL_DATA extern unsigned int isc_mem_defaultflags; /*@{*/ #define ISC_MEM_DEBUGTRACE 0x00000001U #define ISC_MEM_DEBUGRECORD 0x00000002U #define ISC_MEM_DEBUGUSAGE 0x00000004U #define ISC_MEM_DEBUGSIZE 0x00000008U #define ISC_MEM_DEBUGCTX 0x00000010U #define ISC_MEM_DEBUGALL 0x0000001FU /*!< * The variable isc_mem_debugging holds a set of flags for * turning certain memory debugging options on or off at * runtime. It is initialized to the value ISC_MEM_DEGBUGGING, * which is 0 by default but may be overridden at compile time. * The following flags can be specified: * * \li #ISC_MEM_DEBUGTRACE * Log each allocation and free to isc_lctx. * * \li #ISC_MEM_DEBUGRECORD * Remember each allocation, and match them up on free. * Crash if a free doesn't match an allocation. * * \li #ISC_MEM_DEBUGUSAGE * If a hi_water mark is set, print the maximum inuse memory * every time it is raised once it exceeds the hi_water mark. * * \li #ISC_MEM_DEBUGSIZE * Check the size argument being passed to isc_mem_put() matches * that passed to isc_mem_get(). * * \li #ISC_MEM_DEBUGCTX * Check the mctx argument being passed to isc_mem_put() matches * that passed to isc_mem_get(). */ /*@}*/ #if ISC_MEM_TRACKLINES #define _ISC_MEM_FILELINE , __FILE__, __LINE__ #define _ISC_MEM_FLARG , const char *, unsigned int #else #define _ISC_MEM_FILELINE #define _ISC_MEM_FLARG #endif /*! * Define ISC_MEM_USE_INTERNAL_MALLOC=1 to use the internal malloc() * implementation in preference to the system one. The internal malloc() * is very space-efficient, and quite fast on uniprocessor systems. It * performs poorly on multiprocessor machines. * JT: we can overcome the performance issue on multiprocessor machines * by carefully separating memory contexts. */ #ifndef ISC_MEM_USE_INTERNAL_MALLOC #define ISC_MEM_USE_INTERNAL_MALLOC 1 #endif /* * Flags for isc_mem_create2()calls. */ #define ISC_MEMFLAG_NOLOCK 0x00000001 /* no lock is necessary */ #define ISC_MEMFLAG_INTERNAL 0x00000002 /* use internal malloc */ #if ISC_MEM_USE_INTERNAL_MALLOC #define ISC_MEMFLAG_DEFAULT ISC_MEMFLAG_INTERNAL #else #define ISC_MEMFLAG_DEFAULT 0 #endif /*%< * We use either isc___mem (three underscores) or isc__mem (two) depending on * whether it's for BIND9's internal purpose (with -DBIND9) or generic export * library. */ #define ISCMEMFUNC(sfx) isc__mem_ ## sfx #define ISCMEMPOOLFUNC(sfx) isc__mempool_ ## sfx #define isc_mem_get(c, s) ISCMEMFUNC(get)((c), (s) _ISC_MEM_FILELINE) #define isc_mem_allocate(c, s) ISCMEMFUNC(allocate)((c), (s) _ISC_MEM_FILELINE) #define isc_mem_reallocate(c, p, s) ISCMEMFUNC(reallocate)((c), (p), (s) _ISC_MEM_FILELINE) #define isc_mem_strdup(c, p) ISCMEMFUNC(strdup)((c), (p) _ISC_MEM_FILELINE) #define isc_mempool_get(c) ISCMEMPOOLFUNC(get)((c) _ISC_MEM_FILELINE) /*% * isc_mem_putanddetach() is a convenience function for use where you * have a structure with an attached memory context. * * Given: * * \code * struct { * ... * isc_mem_t *mctx; * ... * } *ptr; * * isc_mem_t *mctx; * * isc_mem_putanddetach(&ptr->mctx, ptr, sizeof(*ptr)); * \endcode * * is the equivalent of: * * \code * mctx = NULL; * isc_mem_attach(ptr->mctx, &mctx); * isc_mem_detach(&ptr->mctx); * isc_mem_put(mctx, ptr, sizeof(*ptr)); * isc_mem_detach(&mctx); * \endcode */ /*% memory and memory pool methods */ typedef struct isc_memmethods { void (*attach)(isc_mem_t *source, isc_mem_t **targetp); void (*detach)(isc_mem_t **mctxp); void (*destroy)(isc_mem_t **mctxp); void *(*memget)(isc_mem_t *mctx, size_t size _ISC_MEM_FLARG); void (*memput)(isc_mem_t *mctx, void *ptr, size_t size _ISC_MEM_FLARG); void (*memputanddetach)(isc_mem_t **mctxp, void *ptr, size_t size _ISC_MEM_FLARG); void *(*memallocate)(isc_mem_t *mctx, size_t size _ISC_MEM_FLARG); void *(*memreallocate)(isc_mem_t *mctx, void *ptr, size_t size _ISC_MEM_FLARG); char *(*memstrdup)(isc_mem_t *mctx, const char *s _ISC_MEM_FLARG); void (*memfree)(isc_mem_t *mctx, void *ptr _ISC_MEM_FLARG); void (*setdestroycheck)(isc_mem_t *mctx, isc_boolean_t flag); void (*setwater)(isc_mem_t *ctx, isc_mem_water_t water, void *water_arg, size_t hiwater, size_t lowater); void (*waterack)(isc_mem_t *ctx, int flag); size_t (*inuse)(isc_mem_t *mctx); size_t (*maxinuse)(isc_mem_t *mctx); size_t (*total)(isc_mem_t *mctx); isc_boolean_t (*isovermem)(isc_mem_t *mctx); isc_result_t (*mpcreate)(isc_mem_t *mctx, size_t size, isc_mempool_t **mpctxp); } isc_memmethods_t; typedef struct isc_mempoolmethods { void (*destroy)(isc_mempool_t **mpctxp); void *(*get)(isc_mempool_t *mpctx _ISC_MEM_FLARG); void (*put)(isc_mempool_t *mpctx, void *mem _ISC_MEM_FLARG); unsigned int (*getallocated)(isc_mempool_t *mpctx); void (*setmaxalloc)(isc_mempool_t *mpctx, unsigned int limit); void (*setfreemax)(isc_mempool_t *mpctx, unsigned int limit); void (*setname)(isc_mempool_t *mpctx, const char *name); void (*associatelock)(isc_mempool_t *mpctx, isc_mutex_t *lock); void (*setfillcount)(isc_mempool_t *mpctx, unsigned int limit); } isc_mempoolmethods_t; /*% * This structure is actually just the common prefix of a memory context * implementation's version of an isc_mem_t. * \brief * Direct use of this structure by clients is forbidden. mctx implementations * may change the structure. 'magic' must be ISCAPI_MCTX_MAGIC for any of the * isc_mem_ routines to work. mctx implementations must maintain all mctx * invariants. */ struct isc_mem { unsigned int impmagic; unsigned int magic; isc_memmethods_t *methods; }; #define ISCAPI_MCTX_MAGIC ISC_MAGIC('A','m','c','x') #define ISCAPI_MCTX_VALID(m) ((m) != NULL && \ (m)->magic == ISCAPI_MCTX_MAGIC) /*% * This is the common prefix of a memory pool context. The same note as * that for the mem structure applies. */ struct isc_mempool { unsigned int impmagic; unsigned int magic; isc_mempoolmethods_t *methods; }; #define ISCAPI_MPOOL_MAGIC ISC_MAGIC('A','m','p','l') #define ISCAPI_MPOOL_VALID(mp) ((mp) != NULL && \ (mp)->magic == ISCAPI_MPOOL_MAGIC) #define isc_mem_put(c, p, s) \ do { \ ISCMEMFUNC(put)((c), (p), (s) _ISC_MEM_FILELINE); \ (p) = NULL; \ } while (0) #define isc_mem_putanddetach(c, p, s) \ do { \ ISCMEMFUNC(putanddetach)((c), (p), (s) _ISC_MEM_FILELINE); \ (p) = NULL; \ } while (0) #define isc_mem_free(c, p) \ do { \ ISCMEMFUNC(free)((c), (p) _ISC_MEM_FILELINE); \ (p) = NULL; \ } while (0) #define isc_mempool_put(c, p) \ do { \ ISCMEMPOOLFUNC(put)((c), (p) _ISC_MEM_FILELINE); \ (p) = NULL; \ } while (0) /*@{*/ isc_result_t isc_mem_create(size_t max_size, size_t target_size, isc_mem_t **mctxp); isc_result_t isc_mem_create2(size_t max_size, size_t target_size, isc_mem_t **mctxp, unsigned int flags); isc_result_t isc_mem_createx(size_t max_size, size_t target_size, isc_memalloc_t memalloc, isc_memfree_t memfree, void *arg, isc_mem_t **mctxp); isc_result_t isc_mem_createx2(size_t max_size, size_t target_size, isc_memalloc_t memalloc, isc_memfree_t memfree, void *arg, isc_mem_t **mctxp, unsigned int flags); /*!< * \brief Create a memory context. * * 'max_size' and 'target_size' are tuning parameters. When * ISC_MEMFLAG_INTERNAL is set, allocations smaller than 'max_size' * will be satisfied by getting blocks of size 'target_size' from the * system allocator and breaking them up into pieces; larger allocations * will use the system allocator directly. If 'max_size' and/or * 'target_size' are zero, default values will be * used. When * ISC_MEMFLAG_INTERNAL is not set, 'target_size' is ignored. * * 'max_size' is also used to size the statistics arrays and the array * used to record active memory when ISC_MEM_DEBUGRECORD is set. Setting * 'max_size' too low can have detrimental effects on performance. * * A memory context created using isc_mem_createx() will obtain * memory from the system by calling 'memalloc' and 'memfree', * passing them the argument 'arg'. A memory context created * using isc_mem_create() will use the standard library malloc() * and free(). * * If ISC_MEMFLAG_NOLOCK is set in 'flags', the corresponding memory context * will be accessed without locking. The user who creates the context must * ensure there be no race. Since this can be a source of bug, it is generally * inadvisable to use this flag unless the user is very sure about the race * condition and the access to the object is highly performance sensitive. * * Requires: * mctxp != NULL && *mctxp == NULL */ /*@}*/ /*@{*/ void isc_mem_attach(isc_mem_t *, isc_mem_t **); void isc_mem_detach(isc_mem_t **); /*!< * \brief Attach to / detach from a memory context. * * This is intended for applications that use multiple memory contexts * in such a way that it is not obvious when the last allocations from * a given context has been freed and destroying the context is safe. * * Most applications do not need to call these functions as they can * simply create a single memory context at the beginning of main() * and destroy it at the end of main(), thereby guaranteeing that it * is not destroyed while there are outstanding allocations. */ /*@}*/ void isc_mem_destroy(isc_mem_t **); /*%< * Destroy a memory context. */ isc_result_t isc_mem_ondestroy(isc_mem_t *ctx, isc_task_t *task, isc_event_t **event); /*%< * Request to be notified with an event when a memory context has * been successfully destroyed. */ void isc_mem_stats(isc_mem_t *mctx, FILE *out); /*%< * Print memory usage statistics for 'mctx' on the stream 'out'. */ void isc_mem_setdestroycheck(isc_mem_t *mctx, isc_boolean_t on); /*%< * If 'on' is ISC_TRUE, 'mctx' will check for memory leaks when * destroyed and abort the program if any are present. */ /*@{*/ void isc_mem_setquota(isc_mem_t *, size_t); size_t isc_mem_getquota(isc_mem_t *); /*%< * Set/get the memory quota of 'mctx'. This is a hard limit * on the amount of memory that may be allocated from mctx; * if it is exceeded, allocations will fail. */ /*@}*/ size_t isc_mem_inuse(isc_mem_t *mctx); /*%< * Get an estimate of the amount of memory in use in 'mctx', in bytes. * This includes quantization overhead, but does not include memory * allocated from the system but not yet used. */ size_t isc_mem_maxinuse(isc_mem_t *mctx); /*%< * Get an estimate of the largest amount of memory that has been in * use in 'mctx' at any time. */ size_t isc_mem_total(isc_mem_t *mctx); /*%< * Get the total amount of memory in 'mctx', in bytes, including memory * not yet used. */ isc_boolean_t isc_mem_isovermem(isc_mem_t *mctx); /*%< * Return true iff the memory context is in "over memory" state, i.e., * a hiwater mark has been set and the used amount of memory has exceeds * the mark. */ void isc_mem_setwater(isc_mem_t *mctx, isc_mem_water_t water, void *water_arg, size_t hiwater, size_t lowater); /*%< * Set high and low water marks for this memory context. * * When the memory usage of 'mctx' exceeds 'hiwater', * '(water)(water_arg, #ISC_MEM_HIWATER)' will be called. 'water' needs to * call isc_mem_waterack() with #ISC_MEM_HIWATER to acknowledge the state * change. 'water' may be called multiple times. * * When the usage drops below 'lowater', 'water' will again be called, this * time with #ISC_MEM_LOWATER. 'water' need to calls isc_mem_waterack() with * #ISC_MEM_LOWATER to acknowledge the change. * * static void * water(void *arg, int mark) { * struct foo *foo = arg; * * LOCK(&foo->marklock); * if (foo->mark != mark) { * foo->mark = mark; * .... * isc_mem_waterack(foo->mctx, mark); * } * UNLOCK(&foo->marklock); * } * * If 'water' is NULL then 'water_arg', 'hi_water' and 'lo_water' are * ignored and the state is reset. * * Requires: * * 'water' is not NULL. * hi_water >= lo_water */ void isc_mem_waterack(isc_mem_t *ctx, int mark); /*%< * Called to acknowledge changes in signaled by calls to 'water'. */ void isc_mem_printactive(isc_mem_t *mctx, FILE *file); /*%< * Print to 'file' all active memory in 'mctx'. * * Requires ISC_MEM_DEBUGRECORD to have been set. */ void isc_mem_printallactive(FILE *file); /*%< * Print to 'file' all active memory in all contexts. * * Requires ISC_MEM_DEBUGRECORD to have been set. */ void isc_mem_checkdestroyed(FILE *file); /*%< * Check that all memory contexts have been destroyed. * Prints out those that have not been. * Fatally fails if there are still active contexts. */ unsigned int isc_mem_references(isc_mem_t *ctx); /*%< * Return the current reference count. */ void isc_mem_setname(isc_mem_t *ctx, const char *name, void *tag); /*%< * Name 'ctx'. * * Notes: * *\li Only the first 15 characters of 'name' will be copied. * *\li 'tag' is for debugging purposes only. * * Requires: * *\li 'ctx' is a valid ctx. */ const char * isc_mem_getname(isc_mem_t *ctx); /*%< * Get the name of 'ctx', as previously set using isc_mem_setname(). * * Requires: *\li 'ctx' is a valid ctx. * * Returns: *\li A non-NULL pointer to a null-terminated string. * If the ctx has not been named, the string is * empty. */ void * isc_mem_gettag(isc_mem_t *ctx); /*%< * Get the tag value for 'task', as previously set using isc_mem_setname(). * * Requires: *\li 'ctx' is a valid ctx. * * Notes: *\li This function is for debugging purposes only. * * Requires: *\li 'ctx' is a valid task. */ #ifdef HAVE_LIBXML2 int isc_mem_renderxml(xmlTextWriterPtr writer); /*%< * Render all contexts' statistics and status in XML for writer. */ #endif /* HAVE_LIBXML2 */ #ifdef HAVE_JSON isc_result_t isc_mem_renderjson(json_object *memobj); /*%< * Render all contexts' statistics and status in JSON. */ #endif /* HAVE_JSON */ /* * Memory pools */ isc_result_t isc_mempool_create(isc_mem_t *mctx, size_t size, isc_mempool_t **mpctxp); /*%< * Create a memory pool. * * Requires: *\li mctx is a valid memory context. *\li size > 0 *\li mpctxp != NULL and *mpctxp == NULL * * Defaults: *\li maxalloc = UINT_MAX *\li freemax = 1 *\li fillcount = 1 * * Returns: *\li #ISC_R_NOMEMORY -- not enough memory to create pool *\li #ISC_R_SUCCESS -- all is well. */ void isc_mempool_destroy(isc_mempool_t **mpctxp); /*%< * Destroy a memory pool. * * Requires: *\li mpctxp != NULL && *mpctxp is a valid pool. *\li The pool has no un"put" allocations outstanding */ void isc_mempool_setname(isc_mempool_t *mpctx, const char *name); /*%< * Associate a name with a memory pool. At most 15 characters may be used. * * Requires: *\li mpctx is a valid pool. *\li name != NULL; */ void isc_mempool_associatelock(isc_mempool_t *mpctx, isc_mutex_t *lock); /*%< * Associate a lock with this memory pool. * * This lock is used when getting or putting items using this memory pool, * and it is also used to set or get internal state via the isc_mempool_get*() * and isc_mempool_set*() set of functions. * * Multiple pools can each share a single lock. For instance, if "manager" * type object contained pools for various sizes of events, and each of * these pools used a common lock. Note that this lock must NEVER be used * by other than mempool routines once it is given to a pool, since that can * easily cause double locking. * * Requires: * *\li mpctpx is a valid pool. * *\li lock != NULL. * *\li No previous lock is assigned to this pool. * *\li The lock is initialized before calling this function via the normal * means of doing that. */ /* * The following functions get/set various parameters. Note that due to * the unlocked nature of pools these are potentially random values unless * the imposed externally provided locking protocols are followed. * * Also note that the quota limits will not always take immediate effect. * For instance, setting "maxalloc" to a number smaller than the currently * allocated count is permitted. New allocations will be refused until * the count drops below this threshold. * * All functions require (in addition to other requirements): * mpctx is a valid memory pool */ unsigned int isc_mempool_getfreemax(isc_mempool_t *mpctx); /*%< * Returns the maximum allowed size of the free list. */ void isc_mempool_setfreemax(isc_mempool_t *mpctx, unsigned int limit); /*%< * Sets the maximum allowed size of the free list. */ unsigned int isc_mempool_getfreecount(isc_mempool_t *mpctx); /*%< * Returns current size of the free list. */ unsigned int isc_mempool_getmaxalloc(isc_mempool_t *mpctx); /*!< * Returns the maximum allowed number of allocations. */ void isc_mempool_setmaxalloc(isc_mempool_t *mpctx, unsigned int limit); /*%< * Sets the maximum allowed number of allocations. * * Additional requirements: *\li limit > 0 */ unsigned int isc_mempool_getallocated(isc_mempool_t *mpctx); /*%< * Returns the number of items allocated from this pool. */ unsigned int isc_mempool_getfillcount(isc_mempool_t *mpctx); /*%< * Returns the number of items allocated as a block from the parent memory * context when the free list is empty. */ void isc_mempool_setfillcount(isc_mempool_t *mpctx, unsigned int limit); /*%< * Sets the fillcount. * * Additional requirements: *\li limit > 0 */ /* * Pseudo-private functions for use via macros. Do not call directly. */ void * ISCMEMFUNC(get)(isc_mem_t *, size_t _ISC_MEM_FLARG); void ISCMEMFUNC(putanddetach)(isc_mem_t **, void *, size_t _ISC_MEM_FLARG); void ISCMEMFUNC(put)(isc_mem_t *, void *, size_t _ISC_MEM_FLARG); void * ISCMEMFUNC(allocate)(isc_mem_t *, size_t _ISC_MEM_FLARG); void * ISCMEMFUNC(reallocate)(isc_mem_t *, void *, size_t _ISC_MEM_FLARG); void ISCMEMFUNC(free)(isc_mem_t *, void * _ISC_MEM_FLARG); char * ISCMEMFUNC(strdup)(isc_mem_t *, const char *_ISC_MEM_FLARG); void * ISCMEMPOOLFUNC(get)(isc_mempool_t * _ISC_MEM_FLARG); void ISCMEMPOOLFUNC(put)(isc_mempool_t *, void * _ISC_MEM_FLARG); /*%< * See isc_mem_create2() above. */ typedef isc_result_t (*isc_memcreatefunc_t)(size_t init_max_size, size_t target_size, isc_mem_t **ctxp, unsigned int flags); isc_result_t isc_mem_register(isc_memcreatefunc_t createfunc); /*%< * Register a new memory management implementation and add it to the list of * supported implementations. This function must be called when a different * memory management library is used than the one contained in the ISC library. */ isc_result_t isc__mem_register(void); /*%< * A short cut function that specifies the memory management module in the ISC * library for isc_mem_register(). An application that uses the ISC library * usually do not have to care about this function: it would call * isc_lib_register(), which internally calls this function. */ ISC_LANG_ENDDECLS #endif /* ISC_MEM_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/condition.h�������������������������������������������������������������������������������0000644�����������������00000002705�14763166026�0010505 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_CONDITION_H #define ISC_CONDITION_H 1 /*! \file */ #include <isc/lang.h> #include <isc/mutex.h> #include <isc/result.h> #include <isc/types.h> typedef pthread_cond_t isc_condition_t; #define isc_condition_init(cp) \ ((pthread_cond_init((cp), NULL) == 0) ? \ ISC_R_SUCCESS : ISC_R_UNEXPECTED) #if ISC_MUTEX_PROFILE #define isc_condition_wait(cp, mp) \ ((pthread_cond_wait((cp), &((mp)->mutex)) == 0) ? \ ISC_R_SUCCESS : ISC_R_UNEXPECTED) #else #define isc_condition_wait(cp, mp) \ ((pthread_cond_wait((cp), (mp)) == 0) ? \ ISC_R_SUCCESS : ISC_R_UNEXPECTED) #endif #define isc_condition_signal(cp) \ ((pthread_cond_signal((cp)) == 0) ? \ ISC_R_SUCCESS : ISC_R_UNEXPECTED) #define isc_condition_broadcast(cp) \ ((pthread_cond_broadcast((cp)) == 0) ? \ ISC_R_SUCCESS : ISC_R_UNEXPECTED) #define isc_condition_destroy(cp) \ ((pthread_cond_destroy((cp)) == 0) ? \ ISC_R_SUCCESS : ISC_R_UNEXPECTED) ISC_LANG_BEGINDECLS isc_result_t isc_condition_waituntil(isc_condition_t *, isc_mutex_t *, isc_time_t *); ISC_LANG_ENDDECLS #endif /* ISC_CONDITION_H */ �����������������������������������������������������������bind9/isc/taskpool.h��������������������������������������������������������������������������������0000644�����������������00000007157�14763166026�0010361 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_TASKPOOL_H #define ISC_TASKPOOL_H 1 /***** ***** Module Info *****/ /*! \file isc/taskpool.h * \brief A task pool is a mechanism for sharing a small number of tasks * among a large number of objects such that each object is * assigned a unique task, but each task may be shared by several * objects. * * Task pools are used to let objects that can exist in large * numbers (e.g., zones) use tasks for synchronization without * the memory overhead and unfair scheduling competition that * could result from creating a separate task for each object. */ /*** *** Imports. ***/ #include <isc/lang.h> #include <isc/task.h> ISC_LANG_BEGINDECLS /***** ***** Types. *****/ typedef struct isc_taskpool isc_taskpool_t; /***** ***** Functions. *****/ isc_result_t isc_taskpool_create(isc_taskmgr_t *tmgr, isc_mem_t *mctx, unsigned int ntasks, unsigned int quantum, isc_taskpool_t **poolp); /*%< * Create a task pool of "ntasks" tasks, each with quantum * "quantum". * * Requires: * *\li 'tmgr' is a valid task manager. * *\li 'mctx' is a valid memory context. * *\li poolp != NULL && *poolp == NULL * * Ensures: * *\li On success, '*taskp' points to the new task pool. * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li #ISC_R_UNEXPECTED */ void isc_taskpool_gettask(isc_taskpool_t *pool, isc_task_t **targetp); /*%< * Attach to a task from the pool. Currently the next task is chosen * from the pool at random. (This may be changed in the future to * something that guaratees balance.) */ int isc_taskpool_size(isc_taskpool_t *pool); /*%< * Returns the number of tasks in the task pool 'pool'. */ isc_result_t isc_taskpool_expand(isc_taskpool_t **sourcep, unsigned int size, isc_taskpool_t **targetp); /*%< * If 'size' is larger than the number of tasks in the pool pointed to by * 'sourcep', then a new taskpool of size 'size' is allocated, the existing * tasks from are moved into it, additional tasks are created to bring the * total number up to 'size', and the resulting pool is attached to * 'targetp'. * * If 'size' is less than or equal to the tasks in pool 'source', then * 'sourcep' is attached to 'targetp' without any other action being taken. * * In either case, 'sourcep' is detached. * * Requires: * * \li 'sourcep' is not NULL and '*source' is not NULL * \li 'targetp' is not NULL and '*source' is NULL * * Ensures: * * \li On success, '*targetp' points to a valid task pool. * \li On success, '*sourcep' points to NULL. * * Returns: * * \li #ISC_R_SUCCESS * \li #ISC_R_NOMEMORY */ void isc_taskpool_destroy(isc_taskpool_t **poolp); /*%< * Destroy a task pool. The tasks in the pool are detached but not * shut down. * * Requires: * \li '*poolp' is a valid task pool. */ void isc_taskpool_setprivilege(isc_taskpool_t *pool, isc_boolean_t priv); /*%< * Set the privilege flag on all tasks in 'pool' to 'priv'. If 'priv' is * true, then when the task manager is set into privileged mode, only * tasks wihin this pool will be able to execute. (Note: It is important * to turn the pool tasks' privilege back off before the last task finishes * executing.) * * Requires: * \li 'pool' is a valid task pool. */ ISC_LANG_ENDDECLS #endif /* ISC_TASKPOOL_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/stdio.h�����������������������������������������������������������������������������������0000644�����������������00000003372�14763166026�0007642 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_STDIO_H #define ISC_STDIO_H 1 /*! \file isc/stdio.h */ /*% * These functions are wrappers around the corresponding stdio functions. * * They return a detailed error code in the form of an an isc_result_t. ANSI C * does not guarantee that stdio functions set errno, hence these functions * must use platform dependent methods (e.g., the POSIX errno) to construct the * error code. */ #include <stdio.h> #include <isc/lang.h> #include <isc/result.h> ISC_LANG_BEGINDECLS /*% Open */ isc_result_t isc_stdio_open(const char *filename, const char *mode, FILE **fp); /*% Close */ isc_result_t isc_stdio_close(FILE *f); /*% Seek */ isc_result_t isc_stdio_seek(FILE *f, off_t offset, int whence); /*% Tell */ isc_result_t isc_stdio_tell(FILE *f, off_t *offsetp); /*% Read */ isc_result_t isc_stdio_read(void *ptr, size_t size, size_t nmemb, FILE *f, size_t *nret); /*% Write */ isc_result_t isc_stdio_write(const void *ptr, size_t size, size_t nmemb, FILE *f, size_t *nret); /*% Flush */ isc_result_t isc_stdio_flush(FILE *f); isc_result_t isc_stdio_sync(FILE *f); /*%< * Invoke fsync() on the file descriptor underlying an stdio stream, or an * equivalent system-dependent operation. Note that this function has no * direct counterpart in the stdio library. */ isc_result_t isc_stdio_fgetc(FILE *f, int *ret); ISC_LANG_ENDDECLS #endif /* ISC_STDIO_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/stdtime.h���������������������������������������������������������������������������������0000644�����������������00000002470�14763166026�0010167 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_STDTIME_H #define ISC_STDTIME_H 1 /*! \file */ #include <isc/lang.h> #include <isc/int.h> /*% * It's public information that 'isc_stdtime_t' is an unsigned integral type. * Applications that want maximum portability should not assume anything * about its size. */ typedef isc_uint32_t isc_stdtime_t; /* but this flag helps... */ #define STDTIME_ON_32BITS 1 /* * isc_stdtime32_t is a 32-bit version of isc_stdtime_t. A variable of this * type should only be used as an opaque integer (e.g.,) to compare two * time values. */ typedef isc_uint32_t isc_stdtime32_t; ISC_LANG_BEGINDECLS /* */ void isc_stdtime_get(isc_stdtime_t *t); /*%< * Set 't' to the number of seconds since 00:00:00 UTC, January 1, 1970. * * Requires: * *\li 't' is a valid pointer. */ #define isc_stdtime_convert32(t, t32p) (*(t32p) = t) /* * Convert the standard time to its 32-bit version. */ ISC_LANG_ENDDECLS #endif /* ISC_STDTIME_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/formatcheck.h�����������������������������������������������������������������������������0000644�����������������00000001574�14763166026�0011010 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_FORMATCHECK_H #define ISC_FORMATCHECK_H 1 /*! \file isc/formatcheck.h */ /*% * ISC_FORMAT_PRINTF(). * * \li fmt is the location of the format string parameter. * \li args is the location of the first argument (or 0 for no argument checking). * * Note: * \li The first parameter is 1, not 0. */ #ifdef __GNUC__ #define ISC_FORMAT_PRINTF(fmt, args) __attribute__((__format__(__printf__, fmt, args))) #else #define ISC_FORMAT_PRINTF(fmt, args) #endif #endif /* ISC_FORMATCHECK_H */ ������������������������������������������������������������������������������������������������������������������������������������bind9/isc/sha2.h������������������������������������������������������������������������������������0000644�����������������00000013225�14763166026�0007353 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $FreeBSD: src/sys/crypto/sha2/sha2.h,v 1.1.2.1 2001/07/03 11:01:36 ume Exp $ */ /* $KAME: sha2.h,v 1.3 2001/03/12 08:27:48 itojun Exp $ */ /* * sha2.h * * Version 1.0.0beta1 * * Written by Aaron D. Gifford <me@aarongifford.com> * * Copyright 2000 Aaron D. Gifford. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTOR(S) ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTOR(S) BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #ifndef ISC_SHA2_H #define ISC_SHA2_H #include <isc/lang.h> #include <isc/platform.h> #include <isc/types.h> /*** SHA-224/256/384/512 Various Length Definitions ***********************/ #define ISC_SHA224_BLOCK_LENGTH 64U #define ISC_SHA224_DIGESTLENGTH 28U #define ISC_SHA224_DIGESTSTRINGLENGTH (ISC_SHA224_DIGESTLENGTH * 2 + 1) #define ISC_SHA256_BLOCK_LENGTH 64U #define ISC_SHA256_DIGESTLENGTH 32U #define ISC_SHA256_DIGESTSTRINGLENGTH (ISC_SHA256_DIGESTLENGTH * 2 + 1) #define ISC_SHA384_BLOCK_LENGTH 128 #define ISC_SHA384_DIGESTLENGTH 48U #define ISC_SHA384_DIGESTSTRINGLENGTH (ISC_SHA384_DIGESTLENGTH * 2 + 1) #define ISC_SHA512_BLOCK_LENGTH 128U #define ISC_SHA512_DIGESTLENGTH 64U #define ISC_SHA512_DIGESTSTRINGLENGTH (ISC_SHA512_DIGESTLENGTH * 2 + 1) /*** SHA-256/384/512 Context Structures *******************************/ #if defined(ISC_PLATFORM_OPENSSLHASH) #include <openssl/opensslv.h> #include <openssl/evp.h> #endif #if defined(ISC_PLATFORM_OPENSSLHASH) && !defined(LIBRESSL_VERSION_NUMBER) typedef struct { EVP_MD_CTX *ctx; #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) EVP_MD_CTX _ctx; #endif } isc_sha2_t; typedef isc_sha2_t isc_sha256_t; typedef isc_sha2_t isc_sha512_t; #elif PKCS11CRYPTO #include <pk11/pk11.h> typedef pk11_context_t isc_sha256_t; typedef pk11_context_t isc_sha512_t; #else /* * Keep buffer immediately after bitcount to preserve alignment. */ typedef struct { isc_uint32_t state[8]; isc_uint64_t bitcount; isc_uint8_t buffer[ISC_SHA256_BLOCK_LENGTH]; } isc_sha256_t; /* * Keep buffer immediately after bitcount to preserve alignment. */ typedef struct { isc_uint64_t state[8]; isc_uint64_t bitcount[2]; isc_uint8_t buffer[ISC_SHA512_BLOCK_LENGTH]; } isc_sha512_t; #endif typedef isc_sha256_t isc_sha224_t; typedef isc_sha512_t isc_sha384_t; ISC_LANG_BEGINDECLS /*** SHA-224/256/384/512 Function Prototypes ******************************/ void isc_sha224_init (isc_sha224_t *); void isc_sha224_invalidate (isc_sha224_t *); void isc_sha224_update (isc_sha224_t *, const isc_uint8_t *, size_t); void isc_sha224_final (isc_uint8_t[ISC_SHA224_DIGESTLENGTH], isc_sha224_t *); char *isc_sha224_end (isc_sha224_t *, char[ISC_SHA224_DIGESTSTRINGLENGTH]); char *isc_sha224_data (const isc_uint8_t *, size_t, char[ISC_SHA224_DIGESTSTRINGLENGTH]); void isc_sha256_init (isc_sha256_t *); void isc_sha256_invalidate (isc_sha256_t *); void isc_sha256_update (isc_sha256_t *, const isc_uint8_t *, size_t); void isc_sha256_final (isc_uint8_t[ISC_SHA256_DIGESTLENGTH], isc_sha256_t *); char *isc_sha256_end (isc_sha256_t *, char[ISC_SHA256_DIGESTSTRINGLENGTH]); char *isc_sha256_data (const isc_uint8_t *, size_t, char[ISC_SHA256_DIGESTSTRINGLENGTH]); void isc_sha384_init (isc_sha384_t *); void isc_sha384_invalidate (isc_sha384_t *); void isc_sha384_update (isc_sha384_t *, const isc_uint8_t *, size_t); void isc_sha384_final (isc_uint8_t[ISC_SHA384_DIGESTLENGTH], isc_sha384_t *); char *isc_sha384_end (isc_sha384_t *, char[ISC_SHA384_DIGESTSTRINGLENGTH]); char *isc_sha384_data (const isc_uint8_t *, size_t, char[ISC_SHA384_DIGESTSTRINGLENGTH]); void isc_sha512_init (isc_sha512_t *); void isc_sha512_invalidate (isc_sha512_t *); void isc_sha512_update (isc_sha512_t *, const isc_uint8_t *, size_t); void isc_sha512_final (isc_uint8_t[ISC_SHA512_DIGESTLENGTH], isc_sha512_t *); char *isc_sha512_end (isc_sha512_t *, char[ISC_SHA512_DIGESTSTRINGLENGTH]); char *isc_sha512_data (const isc_uint8_t *, size_t, char[ISC_SHA512_DIGESTSTRINGLENGTH]); ISC_LANG_ENDDECLS #endif /* ISC_SHA2_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/lib.h�������������������������������������������������������������������������������������0000644�����������������00000002053�14763166026�0007261 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_LIB_H #define ISC_LIB_H 1 /*! \file isc/lib.h */ #include <isc/types.h> #include <isc/lang.h> ISC_LANG_BEGINDECLS LIBISC_EXTERNAL_DATA extern isc_msgcat_t *isc_msgcat; void isc_lib_initmsgcat(void); /*!< * \brief Initialize the ISC library's message catalog, isc_msgcat, if it * has not already been initialized. */ void isc_lib_register(void); /*!< * \brief Register the ISC library implementations for some base services * such as memory or event management and handling socket or timer events. * An external application that wants to use the ISC library must call this * function very early in main(). */ ISC_LANG_ENDDECLS #endif /* ISC_LIB_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/ondestroy.h�������������������������������������������������������������������������������0000644�����������������00000005454�14763166026�0010551 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: ondestroy.h,v 1.14 2007/06/19 23:47:18 tbox Exp $ */ #ifndef ISC_ONDESTROY_H #define ISC_ONDESTROY_H 1 #include <isc/lang.h> #include <isc/types.h> ISC_LANG_BEGINDECLS /*! \file isc/ondestroy.h * ondestroy handling. * * Any class ``X'' of objects that wants to send out notifications * on its destruction should declare a field of type isc_ondestroy_t * (call it 'ondest'). * * \code * typedef struct { * ... * isc_ondestroy_t ondest; * ... * } X; * \endcode * * When an object ``A'' of type X is created * it must initialize the field ondest with a call to * * \code * isc_ondestroy_init(&A->ondest). * \endcode * * X should also provide a registration function for third-party * objects to call to register their interest in being told about * the destruction of a particular instance of X. * * \code * isc_result_t * X_ondestroy(X *instance, isc_task_t *task, * isc_event_t **eventp) { * return(isc_ondestroy_register(&instance->ondest, task,eventp)); * } * \endcode * * Note: locking of the ondestory structure embedded inside of X, is * X's responsibility. * * When an instance of X is destroyed, a call to isc_ondestroy_notify() * sends the notifications: * * \code * X *instance; * isc_ondestroy_t ondest = instance->ondest; * * ... completely cleanup 'instance' here... * * isc_ondestroy_notify(&ondest, instance); * \endcode * * * see lib/dns/zone.c for an ifdef'd-out example. */ struct isc_ondestroy { unsigned int magic; isc_eventlist_t events; }; void isc_ondestroy_init(isc_ondestroy_t *ondest); /*%< * Initialize the on ondest structure. *must* be called before first call * to isc_ondestroy_register(). */ isc_result_t isc_ondestroy_register(isc_ondestroy_t *ondest, isc_task_t *task, isc_event_t **eventp); /*%< * Stores task and *eventp away inside *ondest. Ownership of **event is * taken from the caller (and *eventp is set to NULL). The task is attached * to. */ void isc_ondestroy_notify(isc_ondestroy_t *ondest, void *sender); /*%< * Dispatches the event(s) to the task(s) that were given in * isc_ondestroy_register call(s) (done via calls to * isc_task_sendanddetach()). Before dispatch, the sender value of each * event structure is set to the value of the sender paramater. The * internal structures of the ondest parameter are cleaned out, so no other * cleanup is needed. */ ISC_LANG_ENDDECLS #endif /* ISC_ONDESTROY_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/resultclass.h�����������������������������������������������������������������������������0000644�����������������00000003076�14763166026�0011065 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_RESULTCLASS_H #define ISC_RESULTCLASS_H 1 /*! \file isc/resultclass.h * \brief Registry of Predefined Result Type Classes * * A result class number is an unsigned 16 bit number. Each class may * contain up to 65536 results. A result code is formed by adding the * result number within the class to the class number multiplied by 65536. * * Classes < 1024 are reserved for ISC use. * Result classes >= 1024 and <= 65535 are reserved for application use. */ #define ISC_RESULTCLASS_FROMNUM(num) ((num) << 16) #define ISC_RESULTCLASS_TONUM(rclass) ((rclass) >> 16) #define ISC_RESULTCLASS_SIZE 65536 #define ISC_RESULTCLASS_INCLASS(rclass, result) \ ((rclass) == ((result) & 0xFFFF0000)) #define ISC_RESULTCLASS_ISC ISC_RESULTCLASS_FROMNUM(0) #define ISC_RESULTCLASS_DNS ISC_RESULTCLASS_FROMNUM(1) #define ISC_RESULTCLASS_DST ISC_RESULTCLASS_FROMNUM(2) #define ISC_RESULTCLASS_DNSRCODE ISC_RESULTCLASS_FROMNUM(3) #define ISC_RESULTCLASS_OMAPI ISC_RESULTCLASS_FROMNUM(4) #define ISC_RESULTCLASS_ISCCC ISC_RESULTCLASS_FROMNUM(5) #define ISC_RESULTCLASS_DHCP ISC_RESULTCLASS_FROMNUM(6) #define ISC_RESULTCLASS_PK11 ISC_RESULTCLASS_FROMNUM(7) #endif /* ISC_RESULTCLASS_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/serial.h����������������������������������������������������������������������������������0000644�����������������00000002625�14763166026�0007777 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_SERIAL_H #define ISC_SERIAL_H 1 #include <isc/lang.h> #include <isc/types.h> /*! \file isc/serial.h * \brief Implement 32 bit serial space arithmetic comparison functions. * Note: Undefined results are returned as ISC_FALSE. */ /*** *** Functions ***/ ISC_LANG_BEGINDECLS isc_boolean_t isc_serial_lt(isc_uint32_t a, isc_uint32_t b); /*%< * Return true if 'a' < 'b' otherwise false. */ isc_boolean_t isc_serial_gt(isc_uint32_t a, isc_uint32_t b); /*%< * Return true if 'a' > 'b' otherwise false. */ isc_boolean_t isc_serial_le(isc_uint32_t a, isc_uint32_t b); /*%< * Return true if 'a' <= 'b' otherwise false. */ isc_boolean_t isc_serial_ge(isc_uint32_t a, isc_uint32_t b); /*%< * Return true if 'a' >= 'b' otherwise false. */ isc_boolean_t isc_serial_eq(isc_uint32_t a, isc_uint32_t b); /*%< * Return true if 'a' == 'b' otherwise false. */ isc_boolean_t isc_serial_ne(isc_uint32_t a, isc_uint32_t b); /*%< * Return true if 'a' != 'b' otherwise false. */ ISC_LANG_ENDDECLS #endif /* ISC_SERIAL_H */ �����������������������������������������������������������������������������������������������������������bind9/isc/stdlib.h����������������������������������������������������������������������������������0000644�����������������00000001277�14763166026�0010003 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_STDLIB_H #define ISC_STDLIB_H 1 /*! \file isc/stdlib.h */ #include <stdlib.h> #include <isc/lang.h> #include <isc/platform.h> #ifdef ISC_PLATFORM_NEEDSTRTOUL #define strtoul isc_strtoul #endif ISC_LANG_BEGINDECLS unsigned long isc_strtoul(const char *, char **, int); ISC_LANG_ENDDECLS #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/eventclass.h������������������������������������������������������������������������������0000644�����������������00000002544�14763166026�0010667 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_EVENTCLASS_H #define ISC_EVENTCLASS_H 1 /*! \file isc/eventclass.h ***** Registry of Predefined Event Type Classes *****/ /*% * An event class is an unsigned 16 bit number. Each class may contain up * to 65536 events. An event type is formed by adding the event number * within the class to the class number. * */ #define ISC_EVENTCLASS(eclass) ((eclass) << 16) /*@{*/ /*! * Classes < 1024 are reserved for ISC use. * Event classes >= 1024 and <= 65535 are reserved for application use. */ #define ISC_EVENTCLASS_TASK ISC_EVENTCLASS(0) #define ISC_EVENTCLASS_TIMER ISC_EVENTCLASS(1) #define ISC_EVENTCLASS_SOCKET ISC_EVENTCLASS(2) #define ISC_EVENTCLASS_FILE ISC_EVENTCLASS(3) #define ISC_EVENTCLASS_DNS ISC_EVENTCLASS(4) #define ISC_EVENTCLASS_APP ISC_EVENTCLASS(5) #define ISC_EVENTCLASS_OMAPI ISC_EVENTCLASS(6) #define ISC_EVENTCLASS_RATELIMITER ISC_EVENTCLASS(7) #define ISC_EVENTCLASS_ISCCC ISC_EVENTCLASS(8) /*@}*/ #endif /* ISC_EVENTCLASS_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/stats.h�����������������������������������������������������������������������������������0000644�����������������00000006020�14763166026�0007647 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_STATS_H #define ISC_STATS_H 1 /*! \file isc/stats.h */ #include <isc/types.h> ISC_LANG_BEGINDECLS /*%< * Flag(s) for isc_stats_dump(). */ #define ISC_STATSDUMP_VERBOSE 0x00000001 /*%< dump 0-value counters */ /*%< * Dump callback type. */ typedef void (*isc_stats_dumper_t)(isc_statscounter_t, isc_uint64_t, void *); isc_result_t isc_stats_create(isc_mem_t *mctx, isc_stats_t **statsp, int ncounters); /*%< * Create a statistics counter structure of general type. It counts a general * set of counters indexed by an ID between 0 and ncounters -1. * * Requires: *\li 'mctx' must be a valid memory context. * *\li 'statsp' != NULL && '*statsp' == NULL. * * Returns: *\li ISC_R_SUCCESS -- all ok * *\li anything else -- failure */ void isc_stats_attach(isc_stats_t *stats, isc_stats_t **statsp); /*%< * Attach to a statistics set. * * Requires: *\li 'stats' is a valid isc_stats_t. * *\li 'statsp' != NULL && '*statsp' == NULL */ void isc_stats_detach(isc_stats_t **statsp); /*%< * Detaches from the statistics set. * * Requires: *\li 'statsp' != NULL and '*statsp' is a valid isc_stats_t. */ int isc_stats_ncounters(isc_stats_t *stats); /*%< * Returns the number of counters contained in stats. * * Requires: *\li 'stats' is a valid isc_stats_t. * */ void isc_stats_increment(isc_stats_t *stats, isc_statscounter_t counter); /*%< * Increment the counter-th counter of stats. * * Requires: *\li 'stats' is a valid isc_stats_t. * *\li counter is less than the maximum available ID for the stats specified * on creation. */ void isc_stats_decrement(isc_stats_t *stats, isc_statscounter_t counter); /*%< * Decrement the counter-th counter of stats. * * Requires: *\li 'stats' is a valid isc_stats_t. */ void isc_stats_dump(isc_stats_t *stats, isc_stats_dumper_t dump_fn, void *arg, unsigned int options); /*%< * Dump the current statistics counters in a specified way. For each counter * in stats, dump_fn is called with its current value and the given argument * arg. By default counters that have a value of 0 is skipped; if options has * the ISC_STATSDUMP_VERBOSE flag, even such counters are dumped. * * Requires: *\li 'stats' is a valid isc_stats_t. */ void isc_stats_set(isc_stats_t *stats, isc_uint64_t val, isc_statscounter_t counter); /*%< * Set the given counter to the specfied value. * * Requires: *\li 'stats' is a valid isc_stats_t. */ void isc_stats_set(isc_stats_t *stats, isc_uint64_t val, isc_statscounter_t counter); /*%< * Set the given counter to the specfied value. * * Requires: *\li 'stats' is a valid isc_stats_t. */ ISC_LANG_ENDDECLS #endif /* ISC_STATS_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/region.h����������������������������������������������������������������������������������0000644�����������������00000003761�14763166026�0010005 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_REGION_H #define ISC_REGION_H 1 /*! \file isc/region.h */ #include <isc/types.h> #include <isc/lang.h> struct isc_region { unsigned char * base; unsigned int length; }; struct isc_textregion { char * base; unsigned int length; }; /* XXXDCL questionable ... bears discussion. we have been putting off * discussing the region api. */ struct isc_constregion { const void * base; unsigned int length; }; struct isc_consttextregion { const char * base; unsigned int length; }; /*@{*/ /*! * The region structure is not opaque, and is usually directly manipulated. * Some macros are defined below for convenience. */ #define isc_region_consume(r,l) \ do { \ isc_region_t *_r = (r); \ unsigned int _l = (l); \ INSIST(_r->length >= _l); \ _r->base += _l; \ _r->length -= _l; \ } while (0) #define isc_textregion_consume(r,l) \ do { \ isc_textregion_t *_r = (r); \ unsigned int _l = (l); \ INSIST(_r->length >= _l); \ _r->base += _l; \ _r->length -= _l; \ } while (0) #define isc_constregion_consume(r,l) \ do { \ isc_constregion_t *_r = (r); \ unsigned int _l = (l); \ INSIST(_r->length >= _l); \ _r->base += _l; \ _r->length -= _l; \ } while (0) /*@}*/ ISC_LANG_BEGINDECLS int isc_region_compare(isc_region_t *r1, isc_region_t *r2); /*%< * Compares the contents of two regions * * Requires: *\li 'r1' is a valid region *\li 'r2' is a valid region * * Returns: *\li < 0 if r1 is lexicographically less than r2 *\li = 0 if r1 is lexicographically identical to r2 *\li > 0 if r1 is lexicographically greater than r2 */ ISC_LANG_ENDDECLS #endif /* ISC_REGION_H */ ���������������bind9/isc/assertions.h������������������������������������������������������������������������������0000644�����������������00000005436�14763166026�0010715 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! \file isc/assertions.h */ #ifndef ISC_ASSERTIONS_H #define ISC_ASSERTIONS_H 1 #include <isc/lang.h> #include <isc/likely.h> #include <isc/platform.h> ISC_LANG_BEGINDECLS /*% isc assertion type */ typedef enum { isc_assertiontype_require, isc_assertiontype_ensure, isc_assertiontype_insist, isc_assertiontype_invariant } isc_assertiontype_t; typedef void (*isc_assertioncallback_t)(const char *, int, isc_assertiontype_t, const char *); /* coverity[+kill] */ ISC_PLATFORM_NORETURN_PRE void isc_assertion_failed(const char *, int, isc_assertiontype_t, const char *) ISC_PLATFORM_NORETURN_POST; void isc_assertion_setcallback(isc_assertioncallback_t); const char * isc_assertion_typetotext(isc_assertiontype_t type); #if defined(ISC_CHECK_ALL) || defined(__COVERITY__) #define ISC_CHECK_REQUIRE 1 #define ISC_CHECK_ENSURE 1 #define ISC_CHECK_INSIST 1 #define ISC_CHECK_INVARIANT 1 #endif #if defined(ISC_CHECK_NONE) && !defined(__COVERITY__) #define ISC_CHECK_REQUIRE 0 #define ISC_CHECK_ENSURE 0 #define ISC_CHECK_INSIST 0 #define ISC_CHECK_INVARIANT 0 #endif #ifndef ISC_CHECK_REQUIRE #define ISC_CHECK_REQUIRE 1 #endif #ifndef ISC_CHECK_ENSURE #define ISC_CHECK_ENSURE 1 #endif #ifndef ISC_CHECK_INSIST #define ISC_CHECK_INSIST 1 #endif #ifndef ISC_CHECK_INVARIANT #define ISC_CHECK_INVARIANT 1 #endif #if ISC_CHECK_REQUIRE != 0 #define ISC_REQUIRE(cond) \ ((void) (ISC_LIKELY(cond) || \ ((isc_assertion_failed)(__FILE__, __LINE__, \ isc_assertiontype_require, \ #cond), 0))) #else #define ISC_REQUIRE(cond) ((void) 0) #endif /* ISC_CHECK_REQUIRE */ #if ISC_CHECK_ENSURE != 0 #define ISC_ENSURE(cond) \ ((void) (ISC_LIKELY(cond) || \ ((isc_assertion_failed)(__FILE__, __LINE__, \ isc_assertiontype_ensure, \ #cond), 0))) #else #define ISC_ENSURE(cond) ((void) 0) #endif /* ISC_CHECK_ENSURE */ #if ISC_CHECK_INSIST != 0 #define ISC_INSIST(cond) \ ((void) (ISC_LIKELY(cond) || \ ((isc_assertion_failed)(__FILE__, __LINE__, \ isc_assertiontype_insist, \ #cond), 0))) #else #define ISC_INSIST(cond) ((void) 0) #endif /* ISC_CHECK_INSIST */ #if ISC_CHECK_INVARIANT != 0 #define ISC_INVARIANT(cond) \ ((void) (ISC_LIKELY(cond) || \ ((isc_assertion_failed)(__FILE__, __LINE__, \ isc_assertiontype_invariant, \ #cond), 0))) #else #define ISC_INVARIANT(cond) ((void) 0) #endif /* ISC_CHECK_INVARIANT */ ISC_LANG_ENDDECLS #endif /* ISC_ASSERTIONS_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/msgs.h������������������������������������������������������������������������������������0000644�����������������00000020345�14763166026�0007470 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_MSGS_H #define ISC_MSGS_H 1 /*! \file isc/msgs.h */ #include <isc/lib.h> /* Provide isc_msgcat global variable. */ #include <isc/msgcat.h> /* Provide isc_msgcat_*() functions. */ /*@{*/ /*! * \brief Message sets, named per source file, excepting "GENERAL". * * IMPORTANT: The original list is alphabetical, but any new sets must * be added to the end. */ #define ISC_MSGSET_GENERAL 1 /* ISC_RESULT_RESULTSET 2 */ /* XXX */ /* ISC_RESULT_UNAVAILABLESET 3 */ /* XXX */ #define ISC_MSGSET_APP 4 #define ISC_MSGSET_COMMANDLINE 5 #define ISC_MSGSET_ENTROPY 6 #define ISC_MSGSET_IFITERIOCTL 7 #define ISC_MSGSET_IFITERSYSCTL 8 #define ISC_MSGSET_LEX 9 #define ISC_MSGSET_LOG 10 #define ISC_MSGSET_MEM 11 #define ISC_MSGSET_NETADDR 12 #define ISC_MSGSET_PRINT 13 #define ISC_MSGSET_RESULT 14 #define ISC_MSGSET_RWLOCK 15 #define ISC_MSGSET_SOCKADDR 16 #define ISC_MSGSET_SOCKET 17 #define ISC_MSGSET_TASK 18 #define ISC_MSGSET_TIMER 19 #define ISC_MSGSET_UTIL 20 #define ISC_MSGSET_IFITERGETIFADDRS 21 /*@}*/ /*@{*/ /*! * Message numbers * are only required to be unique per message set, * but are unique throughout the entire catalog to not be as confusing when * debugging. * * The initial numbering was done by multiply by 100 the set number the * message appears in then adding the incremental message number. */ #define ISC_MSG_FAILED 101 /*%< "failed" */ #define ISC_MSG_SUCCEEDED 102 /*%< Compatible with "failed" */ #define ISC_MSG_SUCCESS 103 /*%< More usual way to say "success" */ #define ISC_MSG_STARTING 104 /*%< As in "daemon: starting" */ #define ISC_MSG_STOPING 105 /*%< As in "daemon: stopping" */ #define ISC_MSG_ENTERING 106 /*%< As in "some_subr: entering" */ #define ISC_MSG_EXITING 107 /*%< As in "some_subr: exiting" */ #define ISC_MSG_CALLING 108 /*%< As in "calling some_subr()" */ #define ISC_MSG_RETURNED 109 /*%< As in "some_subr: returned <foo>" */ #define ISC_MSG_FATALERROR 110 /*%< "fatal error" */ #define ISC_MSG_SHUTTINGDOWN 111 /*%< "shutting down" */ #define ISC_MSG_RUNNING 112 /*%< "running" */ #define ISC_MSG_WAIT 113 /*%< "wait" */ #define ISC_MSG_WAITUNTIL 114 /*%< "waituntil" */ #define ISC_MSG_SIGNALSETUP 201 /*%< "handle_signal() %d setup: %s" */ #define ISC_MSG_ILLEGALOPT 301 /*%< "illegal option" */ #define ISC_MSG_OPTNEEDARG 302 /*%< "option requires an argument" */ #define ISC_MSG_ENTROPYSTATS 401 /*%< "Entropy pool %p: refcnt %u ..." */ #define ISC_MSG_MAKESCANSOCKET 501 /*%< "making interface scan socket: %s" */ #define ISC_MSG_GETIFCONFIG 502 /*%< "get interface configuration: %s" */ #define ISC_MSG_BUFFERMAX 503 /*%< "... maximum buffer size exceeded" */ #define ISC_MSG_GETDESTADDR 504 /*%< "%s: getting destination address: %s" */ #define ISC_MSG_GETNETMASK 505 /*%< "%s: getting netmask: %s" */ #define ISC_MSG_GETIFLISTSIZE 601 /*%< "getting interface list size: ..." */ #define ISC_MSG_GETIFLIST 602 /*%< "getting interface list: ..." */ #define ISC_MSG_UNEXPECTEDTYPE 603 /*%< "... unexpected ... message type" */ #define ISC_MSG_UNEXPECTEDSTATE 701 /*%< "Unexpected state %d" */ #define ISC_MSG_BADTIME 801 /*%< "Bad 00 99:99:99.999 " */ #define ISC_MSG_LEVEL 802 /*%< "level %d: " */ #define ISC_MSG_ADDTRACE 901 /*%< "add %p size %u " */ #define ISC_MSG_DELTRACE 902 /*%< "del %p size %u " */ #define ISC_MSG_POOLSTATS 903 /*%< "[Pool statistics]\n" */ #define ISC_MSG_POOLNAME 904 /*%< "name" */ #define ISC_MSG_POOLSIZE 905 /*%< "size" */ #define ISC_MSG_POOLMAXALLOC 906 /*%< "maxalloc" */ #define ISC_MSG_POOLALLOCATED 907 /*%< "allocated" */ #define ISC_MSG_POOLFREECOUNT 908 /*%< "freecount" */ #define ISC_MSG_POOLFREEMAX 909 /*%< "freemax" */ #define ISC_MSG_POOLFILLCOUNT 910 /*%< "fillcount" */ #define ISC_MSG_POOLGETS 911 /*%< "gets" */ #define ISC_MSG_DUMPALLOC 912 /*%< "DUMP OF ALL OUTSTANDING MEMORY ..." */ #define ISC_MSG_NONE 913 /*%< "\tNone.\n" */ #define ISC_MSG_PTRFILELINE 914 /*%< "\tptr %p file %s line %u\n" */ #define ISC_MSG_UNKNOWNADDR 1001 /*%< "<unknown address, family %u>" */ #define ISC_MSG_NOLONGDBL 1104 /*%< "long doubles are not supported" */ #define ISC_MSG_PRINTLOCK 1201 /*%< "rwlock %p thread %lu ..." */ #define ISC_MSG_READ 1202 /*%< "read" */ #define ISC_MSG_WRITE 1203 /*%< "write" */ #define ISC_MSG_READING 1204 /*%< "reading" */ #define ISC_MSG_WRITING 1205 /*%< "writing" */ #define ISC_MSG_PRELOCK 1206 /*%< "prelock" */ #define ISC_MSG_POSTLOCK 1207 /*%< "postlock" */ #define ISC_MSG_PREUNLOCK 1208 /*%< "preunlock" */ #define ISC_MSG_POSTUNLOCK 1209 /*%< "postunlock" */ #define ISC_MSG_PRINTLOCK2 1210 /*%< "rwlock %p thread %lu ..." w/ atomic */ #define ISC_MSG_UNKNOWNFAMILY 1301 /*%< "unknown address family: %d" */ #define ISC_MSG_WRITEFAILED 1401 /*%< "write() failed during watcher ..." */ #define ISC_MSG_READFAILED 1402 /*%< "read() failed during watcher ... " */ #define ISC_MSG_PROCESSCMSG 1403 /*%< "processing cmsg %p" */ #define ISC_MSG_IFRECEIVED 1404 /*%< "interface received on ifindex %u" */ #define ISC_MSG_SENDTODATA 1405 /*%< "sendto pktinfo data, ifindex %u" */ #define ISC_MSG_DOIORECV 1406 /*%< "doio_recv: recvmsg(%d) %d bytes ..." */ #define ISC_MSG_PKTRECV 1407 /*%< "packet received correctly" */ #define ISC_MSG_DESTROYING 1408 /*%< "destroying" */ #define ISC_MSG_CREATED 1409 /*%< "created" */ #define ISC_MSG_ACCEPTLOCK 1410 /*%< "internal_accept called, locked ..." */ #define ISC_MSG_ACCEPTEDCXN 1411 /*%< "accepted connection, new socket %p" */ #define ISC_MSG_INTERNALRECV 1412 /*%< "internal_recv: task %p got event %p" */ #define ISC_MSG_INTERNALSEND 1413 /*%< "internal_send: task %p got event %p" */ #define ISC_MSG_WATCHERMSG 1414 /*%< "watcher got message %d" */ #define ISC_MSG_SOCKETSREMAIN 1415 /*%< "sockets exist" */ #define ISC_MSG_PKTINFOPROVIDED 1416 /*%< "pktinfo structure provided, ..." */ #define ISC_MSG_BOUND 1417 /*%< "bound" */ #define ISC_MSG_ACCEPTRETURNED 1418 /*%< accept() returned %d/%s */ #define ISC_MSG_TOOMANYFDS 1419 /*%< %s: too many open file descriptors */ #define ISC_MSG_ZEROPORT 1420 /*%< dropping source port zero packet */ #define ISC_MSG_FILTER 1421 /*%< setsockopt(SO_ACCEPTFILTER): %s */ #define ISC_MSG_TOOMANYHANDLES 1422 /*%< %s: too many open WSA event handles: %s */ #define ISC_MSG_POKED 1423 /*%< "poked flags: %d" */ #define ISC_MSG_AWAKE 1502 /*%< "awake" */ #define ISC_MSG_WORKING 1503 /*%< "working" */ #define ISC_MSG_EXECUTE 1504 /*%< "execute action" */ #define ISC_MSG_EMPTY 1505 /*%< "empty" */ #define ISC_MSG_DONE 1506 /*%< "done" */ #define ISC_MSG_QUANTUM 1507 /*%< "quantum" */ #define ISC_MSG_SCHEDULE 1601 /*%< "schedule" */ #define ISC_MSG_SIGNALSCHED 1602 /*%< "signal (schedule)" */ #define ISC_MSG_SIGNALDESCHED 1603 /*%< "signal (deschedule)" */ #define ISC_MSG_SIGNALDESTROY 1604 /*%< "signal (destroy)" */ #define ISC_MSG_IDLERESCHED 1605 /*%< "idle reschedule" */ #define ISC_MSG_EVENTNOTALLOC 1606 /*%< "couldn't allocate event" */ #define ISC_MSG_SCHEDFAIL 1607 /*%< "couldn't schedule timer: %u" */ #define ISC_MSG_POSTING 1608 /*%< "posting" */ #define ISC_MSG_WAKEUP 1609 /*%< "wakeup" */ #define ISC_MSG_LOCK 1701 /*%< "LOCK" */ #define ISC_MSG_LOCKING 1702 /*%< "LOCKING" */ #define ISC_MSG_LOCKED 1703 /*%< "LOCKED" */ #define ISC_MSG_UNLOCKED 1704 /*%< "UNLOCKED" */ #define ISC_MSG_RWLOCK 1705 /*%< "RWLOCK" */ #define ISC_MSG_RWLOCKED 1706 /*%< "RWLOCKED" */ #define ISC_MSG_RWUNLOCK 1707 /*%< "RWUNLOCK" */ #define ISC_MSG_BROADCAST 1708 /*%< "BROADCAST" */ #define ISC_MSG_SIGNAL 1709 /*%< "SIGNAL" */ #define ISC_MSG_UTILWAIT 1710 /*%< "WAIT" */ #define ISC_MSG_WAITED 1711 /*%< "WAITED" */ #define ISC_MSG_GETIFADDRS 1801 /*%< "getting interface addresses: ..." */ /*@}*/ #endif /* ISC_MSGS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/errno2result.h����������������������������������������������������������������������������0000644�����������������00000001575�14763166026�0011171 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef UNIX_ERRNO2RESULT_H #define UNIX_ERRNO2RESULT_H 1 /*! \file */ /* XXXDCL this should be moved to lib/isc/include/isc/errno2result.h. */ #include <errno.h> /* Provides errno. */ #include <isc/lang.h> #include <isc/types.h> ISC_LANG_BEGINDECLS #define isc__errno2result(x) isc___errno2result(x, ISC_TRUE, __FILE__, __LINE__) isc_result_t isc___errno2result(int posixerrno, isc_boolean_t dolog, const char *file, unsigned int line); ISC_LANG_ENDDECLS #endif /* UNIX_ERRNO2RESULT_H */ �����������������������������������������������������������������������������������������������������������������������������������bind9/isc/likely.h����������������������������������������������������������������������������������0000644�����������������00000001316�14763166026�0010005 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_LIKELY_H #define ISC_LIKELY_H 1 /*% * Performance */ #ifdef HAVE_BUILTIN_EXPECT #define ISC_LIKELY(x) __builtin_expect(!!(x), 1) #define ISC_UNLIKELY(x) __builtin_expect(!!(x), 0) #else #define ISC_LIKELY(x) (x) #define ISC_UNLIKELY(x) (x) #endif #endif /* ISC_LIKELY_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/parseint.h��������������������������������������������������������������������������������0000644�����������������00000002772�14763166026�0010350 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_PARSEINT_H #define ISC_PARSEINT_H 1 #include <isc/lang.h> #include <isc/types.h> /*! \file isc/parseint.h * \brief Parse integers, in a saner way than atoi() or strtoul() do. */ /*** *** Functions ***/ ISC_LANG_BEGINDECLS isc_result_t isc_parse_uint32(isc_uint32_t *uip, const char *string, int base); isc_result_t isc_parse_uint16(isc_uint16_t *uip, const char *string, int base); isc_result_t isc_parse_uint8(isc_uint8_t *uip, const char *string, int base); /*%< * Parse the null-terminated string 'string' containing a base 'base' * integer, storing the result in '*uip'. * The base is interpreted * as in strtoul(). Unlike strtoul(), leading whitespace, minus or * plus signs are not accepted, and all errors (including overflow) * are reported uniformly through the return value. * * Requires: *\li 'string' points to a null-terminated string *\li 0 <= 'base' <= 36 * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_BADNUMBER The string is not numeric (in the given base) *\li #ISC_R_RANGE The number is not representable as the requested type. */ ISC_LANG_ENDDECLS #endif /* ISC_PARSEINT_H */ ������bind9/isc/httpd.h�����������������������������������������������������������������������������������0000644�����������������00000004410�14763166026�0007635 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_HTTPD_H #define ISC_HTTPD_H 1 /*! \file */ #include <isc/event.h> #include <isc/eventclass.h> #include <isc/types.h> #include <isc/mutex.h> #include <isc/task.h> #include <isc/time.h> /*% * HTTP urls. These are the URLs we manage, and the function to call to * provide the data for it. We pass in the base url (so the same function * can handle multiple requests), and a structure to fill in to return a * result to the client. We also pass in a pointer to be filled in for * the data cleanup function. */ struct isc_httpdurl { char *url; isc_httpdaction_t *action; void *action_arg; isc_boolean_t isstatic; isc_time_t loadtime; ISC_LINK(isc_httpdurl_t) link; }; #define HTTPD_EVENTCLASS ISC_EVENTCLASS(4300) #define HTTPD_SHUTDOWN (HTTPD_EVENTCLASS + 0x0001) #define ISC_HTTPDMGR_FLAGSHUTTINGDOWN 0x00000001 /* * Create a new http daemon which will send, once every time period, * a http-like header followed by HTTP data. */ isc_result_t isc_httpdmgr_create(isc_mem_t *mctx, isc_socket_t *sock, isc_task_t *task, isc_httpdclientok_t *client_ok, isc_httpdondestroy_t *ondestory, void *cb_arg, isc_timermgr_t *tmgr, isc_httpdmgr_t **httpdp); void isc_httpdmgr_shutdown(isc_httpdmgr_t **httpdp); isc_result_t isc_httpdmgr_addurl(isc_httpdmgr_t *httpdmgr, const char *url, isc_httpdaction_t *func, void *arg); isc_result_t isc_httpdmgr_addurl2(isc_httpdmgr_t *httpdmgr, const char *url, isc_boolean_t isstatic, isc_httpdaction_t *func, void *arg); isc_result_t isc_httpd_response(isc_httpd_t *httpd); isc_result_t isc_httpd_addheader(isc_httpd_t *httpd, const char *name, const char *val); isc_result_t isc_httpd_addheaderuint(isc_httpd_t *httpd, const char *name, int val); isc_result_t isc_httpd_endheaders(isc_httpd_t *httpd); void isc_httpd_setfinishhook(void (*fn)(void)); #endif /* ISC_HTTPD_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/app.h�������������������������������������������������������������������������������������0000644�����������������00000024350�14763166026�0007277 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_APP_H #define ISC_APP_H 1 /***** ***** Module Info *****/ /*! \file isc/app.h * \brief ISC Application Support * * Dealing with program termination can be difficult, especially in a * multithreaded program. The routines in this module help coordinate * the shutdown process. They are used as follows by the initial (main) * thread of the application: * *\li isc_app_start(); Call very early in main(), before * any other threads have been created. * *\li isc_app_run(); This will post any on-run events, * and then block until application * shutdown is requested. A shutdown * request is made by calling * isc_app_shutdown(), or by sending * SIGINT or SIGTERM to the process. * After isc_app_run() returns, the * application should shutdown itself. * *\li isc_app_finish(); Call very late in main(). * * Applications that want to use SIGHUP/isc_app_reload() to trigger reloading * should check the result of isc_app_run() and call the reload routine if * the result is ISC_R_RELOAD. They should then call isc_app_run() again * to resume waiting for reload or termination. * * Use of this module is not required. In particular, isc_app_start() is * NOT an ISC library initialization routine. * * This module also supports per-thread 'application contexts'. With this * mode, a thread-based application will have a separate context, in which * it uses other ISC library services such as tasks or timers. Signals are * not caught in this mode, so that the application can handle the signals * in its preferred way. * * \li MP: * Clients must ensure that isc_app_start(), isc_app_run(), and * isc_app_finish() are called at most once. isc_app_shutdown() * is safe to use by any thread (provided isc_app_start() has been * called previously). * * The same note applies to isc_app_ctxXXX() functions, but in this case * it's a per-thread restriction. For example, a thread with an * application context must ensure that isc_app_ctxstart() with the * context is called at most once. * * \li Reliability: * No anticipated impact. * * \li Resources: * None. * * \li Security: * No anticipated impact. * * \li Standards: * None. */ #include <isc/eventclass.h> #include <isc/lang.h> #include <isc/magic.h> #include <isc/result.h> /*** *** Types ***/ typedef isc_event_t isc_appevent_t; #define ISC_APPEVENT_FIRSTEVENT (ISC_EVENTCLASS_APP + 0) #define ISC_APPEVENT_SHUTDOWN (ISC_EVENTCLASS_APP + 1) #define ISC_APPEVENT_LASTEVENT (ISC_EVENTCLASS_APP + 65535) /*% * app module methods. Only app driver implementations use this structure. * Other clients should use the top-level interfaces (i.e., isc_app_xxx * functions). magic must be ISCAPI_APPMETHODS_MAGIC. */ typedef struct isc_appmethods { void (*ctxdestroy)(isc_appctx_t **ctxp); isc_result_t (*ctxstart)(isc_appctx_t *ctx); isc_result_t (*ctxrun)(isc_appctx_t *ctx); isc_result_t (*ctxsuspend)(isc_appctx_t *ctx); isc_result_t (*ctxshutdown)(isc_appctx_t *ctx); void (*ctxfinish)(isc_appctx_t *ctx); void (*settaskmgr)(isc_appctx_t *ctx, isc_taskmgr_t *timermgr); void (*setsocketmgr)(isc_appctx_t *ctx, isc_socketmgr_t *timermgr); void (*settimermgr)(isc_appctx_t *ctx, isc_timermgr_t *timermgr); isc_result_t (*ctxonrun)(isc_appctx_t *ctx, isc_mem_t *mctx, isc_task_t *task, isc_taskaction_t action, void *arg); } isc_appmethods_t; /*% * This structure is actually just the common prefix of an application context * implementation's version of an isc_appctx_t. * \brief * Direct use of this structure by clients is forbidden. app implementations * may change the structure. 'magic' must be ISCAPI_APPCTX_MAGIC for any * of the isc_app_ routines to work. app implementations must maintain * all app context invariants. */ struct isc_appctx { unsigned int impmagic; unsigned int magic; isc_appmethods_t *methods; }; #define ISCAPI_APPCTX_MAGIC ISC_MAGIC('A','a','p','c') #define ISCAPI_APPCTX_VALID(c) ((c) != NULL && \ (c)->magic == ISCAPI_APPCTX_MAGIC) ISC_LANG_BEGINDECLS isc_result_t isc_app_ctxstart(isc_appctx_t *ctx); isc_result_t isc_app_start(void); /*!< * \brief Start an ISC library application. * * Notes: * This call should be made before any other ISC library call, and as * close to the beginning of the application as possible. * * Requires: *\li 'ctx' is a valid application context (for app_ctxstart()). */ isc_result_t isc_app_ctxonrun(isc_appctx_t *ctx, isc_mem_t *mctx, isc_task_t *task, isc_taskaction_t action, void *arg); isc_result_t isc_app_onrun(isc_mem_t *mctx, isc_task_t *task, isc_taskaction_t action, void *arg); /*!< * \brief Request delivery of an event when the application is run. * * Requires: *\li isc_app_start() has been called. *\li 'ctx' is a valid application context (for app_ctxonrun()). * * Returns: * ISC_R_SUCCESS * ISC_R_NOMEMORY */ isc_result_t isc_app_ctxrun(isc_appctx_t *ctx); isc_result_t isc_app_run(void); /*!< * \brief Run an ISC library application. * * Notes: *\li The caller (typically the initial thread of an application) will * block until shutdown is requested. When the call returns, the * caller should start shutting down the application. * * Requires: *\li isc_app_[ctx]start() has been called. * * Ensures: *\li Any events requested via isc_app_onrun() will have been posted (in * FIFO order) before isc_app_run() blocks. *\li 'ctx' is a valid application context (for app_ctxrun()). * * Returns: *\li ISC_R_SUCCESS Shutdown has been requested. *\li ISC_R_RELOAD Reload has been requested. */ isc_boolean_t isc_app_isrunning(void); /*!< * \brief Return if the ISC library application is running. * * Returns: *\li ISC_TRUE App is running. *\li ISC_FALSE App is not running. */ isc_result_t isc_app_ctxshutdown(isc_appctx_t *ctx); isc_result_t isc_app_shutdown(void); /*!< * \brief Request application shutdown. * * Notes: *\li It is safe to call isc_app_shutdown() multiple times. Shutdown will * only be triggered once. * * Requires: *\li isc_app_[ctx]run() has been called. *\li 'ctx' is a valid application context (for app_ctxshutdown()). * * Returns: *\li ISC_R_SUCCESS *\li ISC_R_UNEXPECTED */ isc_result_t isc_app_ctxsuspend(isc_appctx_t *ctx); /*!< * \brief This has the same behavior as isc_app_ctxsuspend(). */ isc_result_t isc_app_reload(void); /*!< * \brief Request application reload. * * Requires: *\li isc_app_run() has been called. * * Returns: *\li ISC_R_SUCCESS *\li ISC_R_UNEXPECTED */ void isc_app_ctxfinish(isc_appctx_t *ctx); void isc_app_finish(void); /*!< * \brief Finish an ISC library application. * * Notes: *\li This call should be made at or near the end of main(). * * Requires: *\li isc_app_start() has been called. *\li 'ctx' is a valid application context (for app_ctxfinish()). * * Ensures: *\li Any resources allocated by isc_app_start() have been released. */ void isc_app_block(void); /*!< * \brief Indicate that a blocking operation will be performed. * * Notes: *\li If a blocking operation is in process, a call to isc_app_shutdown() * or an external signal will abort the program, rather than allowing * clean shutdown. This is primarily useful for reading user input. * * Requires: * \li isc_app_start() has been called. * \li No other blocking operations are in progress. */ void isc_app_unblock(void); /*!< * \brief Indicate that a blocking operation is complete. * * Notes: * \li When a blocking operation has completed, return the program to a * state where a call to isc_app_shutdown() or an external signal will * shutdown normally. * * Requires: * \li isc_app_start() has been called. * \li isc_app_block() has been called by the same thread. */ isc_result_t isc_appctx_create(isc_mem_t *mctx, isc_appctx_t **ctxp); /*!< * \brief Create an application context. * * Requires: *\li 'mctx' is a valid memory context. *\li 'ctxp' != NULL && *ctxp == NULL. */ void isc_appctx_destroy(isc_appctx_t **ctxp); /*!< * \brief Destroy an application context. * * Requires: *\li '*ctxp' is a valid application context. * * Ensures: *\li *ctxp == NULL. */ void isc_appctx_settaskmgr(isc_appctx_t *ctx, isc_taskmgr_t *taskmgr); /*!< * \brief Associate a task manager with an application context. * * This must be done before running tasks within the application context. * * Requires: *\li 'ctx' is a valid application context. *\li 'taskmgr' is a valid task manager. */ void isc_appctx_setsocketmgr(isc_appctx_t *ctx, isc_socketmgr_t *socketmgr); /*!< * \brief Associate a socket manager with an application context. * * This must be done before handling socket events within the application * context. * * Requires: *\li 'ctx' is a valid application context. *\li 'socketmgr' is a valid socket manager. */ void isc_appctx_settimermgr(isc_appctx_t *ctx, isc_timermgr_t *timermgr); /*!< * \brief Associate a socket timer with an application context. * * This must be done before handling timer events within the application * context. * * Requires: *\li 'ctx' is a valid application context. *\li 'timermgr' is a valid timer manager. */ /*%< * See isc_appctx_create() above. */ typedef isc_result_t (*isc_appctxcreatefunc_t)(isc_mem_t *mctx, isc_appctx_t **ctxp); isc_result_t isc_app_register(isc_appctxcreatefunc_t createfunc); /*%< * Register a new application implementation and add it to the list of * supported implementations. This function must be called when a different * event library is used than the one contained in the ISC library. */ isc_result_t isc__app_register(void); /*%< * A short cut function that specifies the application module in the ISC * library for isc_app_register(). An application that uses the ISC library * usually do not have to care about this function: it would call * isc_lib_register(), which internally calls this function. */ ISC_LANG_ENDDECLS #endif /* ISC_APP_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/sockaddr.h��������������������������������������������������������������������������������0000644�����������������00000013776�14763166026�0010323 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_SOCKADDR_H #define ISC_SOCKADDR_H 1 /*! \file isc/sockaddr.h */ #include <isc/lang.h> #include <isc/net.h> #include <isc/types.h> #ifdef ISC_PLATFORM_HAVESYSUNH #include <sys/un.h> #endif struct isc_sockaddr { union { struct sockaddr sa; struct sockaddr_in sin; struct sockaddr_in6 sin6; struct sockaddr_storage ss; #ifdef ISC_PLATFORM_HAVESYSUNH struct sockaddr_un sunix; #endif } type; unsigned int length; /* XXXRTH beginning? */ ISC_LINK(struct isc_sockaddr) link; }; #define ISC_SOCKADDR_CMPADDR 0x0001 /*%< compare the address * sin_addr/sin6_addr */ #define ISC_SOCKADDR_CMPPORT 0x0002 /*%< compare the port * sin_port/sin6_port */ #define ISC_SOCKADDR_CMPSCOPE 0x0004 /*%< compare the scope * sin6_scope */ #define ISC_SOCKADDR_CMPSCOPEZERO 0x0008 /*%< when comparing scopes * zero scopes always match */ ISC_LANG_BEGINDECLS isc_boolean_t isc_sockaddr_compare(const isc_sockaddr_t *a, const isc_sockaddr_t *b, unsigned int flags); /*%< * Compare the elements of the two address ('a' and 'b') as specified * by 'flags' and report if they are equal or not. * * 'flags' is set from ISC_SOCKADDR_CMP*. */ isc_boolean_t isc_sockaddr_equal(const isc_sockaddr_t *a, const isc_sockaddr_t *b); /*%< * Return ISC_TRUE iff the socket addresses 'a' and 'b' are equal. */ isc_boolean_t isc_sockaddr_eqaddr(const isc_sockaddr_t *a, const isc_sockaddr_t *b); /*%< * Return ISC_TRUE iff the address parts of the socket addresses * 'a' and 'b' are equal, ignoring the ports. */ isc_boolean_t isc_sockaddr_eqaddrprefix(const isc_sockaddr_t *a, const isc_sockaddr_t *b, unsigned int prefixlen); /*%< * Return ISC_TRUE iff the most significant 'prefixlen' bits of the * socket addresses 'a' and 'b' are equal, ignoring the ports. * If 'b''s scope is zero then 'a''s scope will be ignored. */ unsigned int isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only); /*%< * Return a hash value for the socket address 'sockaddr'. If 'address_only' * is ISC_TRUE, the hash value will not depend on the port. * * IPv6 addresses containing mapped IPv4 addresses generate the same hash * value as the equivalent IPv4 address. */ void isc_sockaddr_any(isc_sockaddr_t *sockaddr); /*%< * Return the IPv4 wildcard address. */ void isc_sockaddr_any6(isc_sockaddr_t *sockaddr); /*%< * Return the IPv6 wildcard address. */ void isc_sockaddr_anyofpf(isc_sockaddr_t *sockaddr, int family); /*%< * Set '*sockaddr' to the wildcard address of protocol family * 'family'. * * Requires: * \li 'family' is AF_INET or AF_INET6. */ void isc_sockaddr_fromin(isc_sockaddr_t *sockaddr, const struct in_addr *ina, in_port_t port); /*%< * Construct an isc_sockaddr_t from an IPv4 address and port. */ void isc_sockaddr_fromin6(isc_sockaddr_t *sockaddr, const struct in6_addr *ina6, in_port_t port); /*%< * Construct an isc_sockaddr_t from an IPv6 address and port. */ void isc_sockaddr_v6fromin(isc_sockaddr_t *sockaddr, const struct in_addr *ina, in_port_t port); /*%< * Construct an IPv6 isc_sockaddr_t representing a mapped IPv4 address. */ void isc_sockaddr_fromnetaddr(isc_sockaddr_t *sockaddr, const isc_netaddr_t *na, in_port_t port); /*%< * Construct an isc_sockaddr_t from an isc_netaddr_t and port. */ int isc_sockaddr_pf(const isc_sockaddr_t *sockaddr); /*%< * Get the protocol family of 'sockaddr'. * * Requires: * *\li 'sockaddr' is a valid sockaddr with an address family of AF_INET * or AF_INET6. * * Returns: * *\li The protocol family of 'sockaddr', e.g. PF_INET or PF_INET6. */ void isc_sockaddr_setport(isc_sockaddr_t *sockaddr, in_port_t port); /*%< * Set the port of 'sockaddr' to 'port'. */ in_port_t isc_sockaddr_getport(const isc_sockaddr_t *sockaddr); /*%< * Get the port stored in 'sockaddr'. */ isc_result_t isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target); /*%< * Append a text representation of 'sockaddr' to the buffer 'target'. * The text will include both the IP address (v4 or v6) and the port. * The text is null terminated, but the terminating null is not * part of the buffer's used region. * * Returns: * \li ISC_R_SUCCESS * \li ISC_R_NOSPACE The text or the null termination did not fit. */ void isc_sockaddr_format(const isc_sockaddr_t *sa, char *array, unsigned int size); /*%< * Format a human-readable representation of the socket address '*sa' * into the character array 'array', which is of size 'size'. * The resulting string is guaranteed to be null-terminated. */ isc_boolean_t isc_sockaddr_ismulticast(const isc_sockaddr_t *sa); /*%< * Returns #ISC_TRUE if the address is a multicast address. */ isc_boolean_t isc_sockaddr_isexperimental(const isc_sockaddr_t *sa); /* * Returns ISC_TRUE if the address is a experimental (CLASS E) address. */ isc_boolean_t isc_sockaddr_islinklocal(const isc_sockaddr_t *sa); /*%< * Returns ISC_TRUE if the address is a link local address. */ isc_boolean_t isc_sockaddr_issitelocal(const isc_sockaddr_t *sa); /*%< * Returns ISC_TRUE if the address is a sitelocal address. */ isc_boolean_t isc_sockaddr_isnetzero(const isc_sockaddr_t *sa); /*%< * Returns ISC_TRUE if the address is in net zero. */ isc_result_t isc_sockaddr_frompath(isc_sockaddr_t *sockaddr, const char *path); /* * Create a UNIX domain sockaddr that refers to path. * * Returns: * \li ISC_R_NOSPACE * \li ISC_R_NOTIMPLEMENTED * \li ISC_R_SUCCESS */ #define ISC_SOCKADDR_FORMATSIZE \ sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:XXX.XXX.XXX.XXX%SSSSSSSSSS#YYYYY") /*%< * Minimum size of array to pass to isc_sockaddr_format(). */ ISC_LANG_ENDDECLS #endif /* ISC_SOCKADDR_H */ ��bind9/isc/int.h�������������������������������������������������������������������������������������0000644�����������������00000002576�14763166026�0007317 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: int.h,v 1.16 2007/06/19 23:47:19 tbox Exp $ */ #ifndef ISC_INT_H #define ISC_INT_H 1 /*! \file */ typedef signed char isc_int8_t; typedef unsigned char isc_uint8_t; typedef short isc_int16_t; typedef unsigned short isc_uint16_t; typedef int isc_int32_t; typedef unsigned int isc_uint32_t; typedef long long isc_int64_t; typedef unsigned long long isc_uint64_t; #define ISC_INT8_MIN -128 #define ISC_INT8_MAX 127 #define ISC_UINT8_MAX 255 #define ISC_INT16_MIN -32768 #define ISC_INT16_MAX 32767 #define ISC_UINT16_MAX 65535 /*% * Note that "int" is 32 bits on all currently supported Unix-like operating * systems, but "long" can be either 32 bits or 64 bits, thus the 32 bit * constants are not qualified with "L". */ #define ISC_INT32_MIN -2147483648 #define ISC_INT32_MAX 2147483647 #define ISC_UINT32_MAX 4294967295U #define ISC_INT64_MIN -9223372036854775808LL #define ISC_INT64_MAX 9223372036854775807LL #define ISC_UINT64_MAX 18446744073709551615ULL #endif /* ISC_INT_H */ ����������������������������������������������������������������������������������������������������������������������������������bind9/isc/atomic.h����������������������������������������������������������������������������������0000644�����������������00000010225�14763166026�0007767 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_ATOMIC_H #define ISC_ATOMIC_H 1 #include <isc/platform.h> #include <isc/types.h> #ifdef ISC_PLATFORM_USEGCCASM /* * This routine atomically increments the value stored in 'p' by 'val', and * returns the previous value. */ static __inline__ isc_int32_t isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) { isc_int32_t prev = val; __asm__ volatile( #ifdef ISC_PLATFORM_USETHREADS "lock;" #endif "xadd %0, %1" :"=q"(prev) :"m"(*p), "0"(prev) :"memory", "cc"); return (prev); } #ifdef ISC_PLATFORM_HAVEXADDQ static __inline__ isc_int64_t isc_atomic_xaddq(isc_int64_t *p, isc_int64_t val) { isc_int64_t prev = val; __asm__ volatile( #ifdef ISC_PLATFORM_USETHREADS "lock;" #endif "xaddq %0, %1" :"=q"(prev) :"m"(*p), "0"(prev) :"memory", "cc"); return (prev); } #endif /* ISC_PLATFORM_HAVEXADDQ */ /* * This routine atomically stores the value 'val' in 'p' (32-bit version). */ static __inline__ void isc_atomic_store(isc_int32_t *p, isc_int32_t val) { __asm__ volatile( #ifdef ISC_PLATFORM_USETHREADS /* * xchg should automatically lock memory, but we add it * explicitly just in case (it at least doesn't harm) */ "lock;" #endif "xchgl %1, %0" : : "r"(val), "m"(*p) : "memory"); } #ifdef ISC_PLATFORM_HAVEATOMICSTOREQ /* * This routine atomically stores the value 'val' in 'p' (64-bit version). */ static __inline__ void isc_atomic_storeq(isc_int64_t *p, isc_int64_t val) { __asm__ volatile( #ifdef ISC_PLATFORM_USETHREADS /* * xchg should automatically lock memory, but we add it * explicitly just in case (it at least doesn't harm) */ "lock;" #endif "xchgq %1, %0" : : "r"(val), "m"(*p) : "memory"); } #endif /* ISC_PLATFORM_HAVEATOMICSTOREQ */ /* * This routine atomically replaces the value in 'p' with 'val', if the * original value is equal to 'cmpval'. The original value is returned in any * case. */ static __inline__ isc_int32_t isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) { __asm__ volatile( #ifdef ISC_PLATFORM_USETHREADS "lock;" #endif "cmpxchgl %1, %2" : "=a"(cmpval) : "r"(val), "m"(*p), "a"(cmpval) : "memory"); return (cmpval); } #elif defined(ISC_PLATFORM_USESTDASM) /* * The followings are "generic" assembly code which implements the same * functionality in case the gcc extension cannot be used. It should be * better to avoid inlining below, since we directly refer to specific * positions of the stack frame, which would not actually point to the * intended address in the embedded mnemonic. */ static isc_int32_t isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) { (void)(p); (void)(val); __asm ( "movl 8(%ebp), %ecx\n" "movl 12(%ebp), %edx\n" #ifdef ISC_PLATFORM_USETHREADS "lock;" #endif "xadd %edx, (%ecx)\n" /* * set the return value directly in the register so that we * can avoid guessing the correct position in the stack for a * local variable. */ "movl %edx, %eax" ); } static void isc_atomic_store(isc_int32_t *p, isc_int32_t val) { (void)(p); (void)(val); __asm ( "movl 8(%ebp), %ecx\n" "movl 12(%ebp), %edx\n" #ifdef ISC_PLATFORM_USETHREADS "lock;" #endif "xchgl (%ecx), %edx\n" ); } static isc_int32_t isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) { (void)(p); (void)(cmpval); (void)(val); __asm ( "movl 8(%ebp), %ecx\n" "movl 12(%ebp), %eax\n" /* must be %eax for cmpxchgl */ "movl 16(%ebp), %edx\n" #ifdef ISC_PLATFORM_USETHREADS "lock;" #endif /* * If (%ecx) == %eax then (%ecx) := %edx. % %eax is set to old (%ecx), which will be the return value. */ "cmpxchgl %edx, (%ecx)" ); } #else /* !ISC_PLATFORM_USEGCCASM && !ISC_PLATFORM_USESTDASM */ #error "unsupported compiler. disable atomic ops by --disable-atomic" #endif #endif /* ISC_ATOMIC_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/entropy.h���������������������������������������������������������������������������������0000644�����������������00000021413�14763166026�0010214 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: entropy.h,v 1.35 2009/10/19 02:37:08 marka Exp $ */ #ifndef ISC_ENTROPY_H #define ISC_ENTROPY_H 1 /***** ***** Module Info *****/ /*! \file isc/entropy.h * \brief The entropy API * * \li MP: * The entropy object is locked internally. All callbacks into * application-provided functions (for setup, gathering, and * shutdown of sources) are guaranteed to be called with the * entropy API lock held. This means these functions are * not permitted to call back into the entropy API. * * \li Reliability: * No anticipated impact. * * \li Resources: * A buffer, used as an entropy pool. * * \li Security: * While this code is believed to implement good entropy gathering * and distribution, it has not been reviewed by a cryptographic * expert. * Since the added entropy is only as good as the sources used, * this module could hand out bad data and never know it. * * \li Standards: * None. */ /*** *** Imports ***/ #include <stdio.h> #include <isc/lang.h> #include <isc/types.h> /*@{*/ /*% Entropy callback function. */ typedef isc_result_t (*isc_entropystart_t)(isc_entropysource_t *source, void *arg, isc_boolean_t blocking); typedef isc_result_t (*isc_entropyget_t)(isc_entropysource_t *source, void *arg, isc_boolean_t blocking); typedef void (*isc_entropystop_t)(isc_entropysource_t *source, void *arg); /*@}*/ /*** *** Flags. ***/ /*! * \brief * Extract only "good" data; return failure if there is not enough * data available and there are no sources which we can poll to get * data, or those sources are empty. * * */ #define ISC_ENTROPY_GOODONLY 0x00000001U /*! * \brief * Extract as much good data as possible, but if there isn't enough * at hand, return what is available. This flag only makes sense * when used with _GOODONLY. */ #define ISC_ENTROPY_PARTIAL 0x00000002U /*! * \brief * Block the task until data is available. This is contrary to the * ISC task system, where tasks should never block. However, if * this is a special purpose application where blocking a task is * acceptable (say, an offline zone signer) this flag may be set. * This flag only makes sense when used with _GOODONLY, and will * block regardless of the setting for _PARTIAL. */ #define ISC_ENTROPY_BLOCKING 0x00000004U /*! * \brief * Estimate the amount of entropy contained in the sample pool. * If this is not set, the source will be gathered and periodically * mixed into the entropy pool, but no increment in contained entropy * will be assumed. This flag only makes sense on sample sources. */ #define ISC_ENTROPYSOURCE_ESTIMATE 0x00000001U /* * For use with isc_entropy_usebestsource(). */ /*! * \brief * Use the keyboard as the only entropy source. */ #define ISC_ENTROPY_KEYBOARDYES 1 /*! * \brief * Never use the keyboard as an entropy source. */ #define ISC_ENTROPY_KEYBOARDNO 2 /*! * \brief * Use the keyboard as an entropy source only if opening the * random device fails. */ #define ISC_ENTROPY_KEYBOARDMAYBE 3 ISC_LANG_BEGINDECLS /*** *** Functions ***/ isc_result_t isc_entropy_create(isc_mem_t *mctx, isc_entropy_t **entp); /*!< * \brief Create a new entropy object. */ void isc_entropy_attach(isc_entropy_t *ent, isc_entropy_t **entp); /*!< * Attaches to an entropy object. */ void isc_entropy_detach(isc_entropy_t **entp); /*!< * \brief Detaches from an entropy object. */ isc_result_t isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname); /*!< * \brief Create a new entropy source from a file. * * The file is assumed to contain good randomness, and will be mixed directly * into the pool with every byte adding 8 bits of entropy. * * The file will be put into non-blocking mode, so it may be a device file, * such as /dev/random. /dev/urandom should not be used here if it can * be avoided, since it will always provide data even if it isn't good. * We will make as much pseudorandom data as we need internally if our * caller asks for it. * * If we hit end-of-file, we will stop reading from this source. Callers * who require strong random data will get failure when our pool drains. * The file will never be opened/read again once EOF is reached. */ void isc_entropy_destroysource(isc_entropysource_t **sourcep); /*!< * \brief Removes an entropy source from the entropy system. */ isc_result_t isc_entropy_createsamplesource(isc_entropy_t *ent, isc_entropysource_t **sourcep); /*!< * \brief Create an entropy source that consists of samples. Each sample is * added to the source via isc_entropy_addsamples(), below. */ isc_result_t isc_entropy_createcallbacksource(isc_entropy_t *ent, isc_entropystart_t start, isc_entropyget_t get, isc_entropystop_t stop, void *arg, isc_entropysource_t **sourcep); /*!< * \brief Create an entropy source that is polled via a callback. * * This would * be used when keyboard input is used, or a GUI input method. It can * also be used to hook in any external entropy source. * * Samples are added via isc_entropy_addcallbacksample(), below. * _addcallbacksample() is the only function which may be called from * within an entropy API callback function. */ void isc_entropy_stopcallbacksources(isc_entropy_t *ent); /*!< * \brief Call the stop functions for callback sources that have had their * start functions called. */ /*@{*/ isc_result_t isc_entropy_addcallbacksample(isc_entropysource_t *source, isc_uint32_t sample, isc_uint32_t extra); isc_result_t isc_entropy_addsample(isc_entropysource_t *source, isc_uint32_t sample, isc_uint32_t extra); /*!< * \brief Add a sample to the sample source. * * The sample MUST be a timestamp * that increases over time, with the exception of wrap-around for * extremely high resolution timers which will quickly wrap-around * a 32-bit integer. * * The "extra" parameter is used only to add a bit more unpredictable * data. It is not used other than included in the hash of samples. * * When in an entropy API callback function, _addcallbacksource() must be * used. At all other times, _addsample() must be used. */ /*@}*/ isc_result_t isc_entropy_getdata(isc_entropy_t *ent, void *data, unsigned int length, unsigned int *returned, unsigned int flags); /*!< * \brief Extract data from the entropy pool. This may load the pool from various * sources. * * Do this by stiring the pool and returning a part of hash as randomness. * Note that no secrets are given away here since parts of the hash are * xored together before returned. * * Honor the request from the caller to only return good data, any data, * etc. */ void isc_entropy_putdata(isc_entropy_t *ent, void *data, unsigned int length, isc_uint32_t entropy); /*!< * \brief Add "length" bytes in "data" to the entropy pool, incrementing the * pool's entropy count by "entropy." * * These bytes will prime the pseudorandom portion even if no entropy is * actually added. */ void isc_entropy_stats(isc_entropy_t *ent, FILE *out); /*!< * \brief Dump some (trivial) stats to the stdio stream "out". */ unsigned int isc_entropy_status(isc_entropy_t *end); /* * Returns the number of bits the pool currently contains. This is just * an estimate. */ isc_result_t isc_entropy_usebestsource(isc_entropy_t *ectx, isc_entropysource_t **source, const char *randomfile, int use_keyboard); /*!< * \brief Use whatever source of entropy is best. * * Notes: *\li If "randomfile" is not NULL, open it with * isc_entropy_createfilesource(). * *\li If "randomfile" is NULL and the system's random device was detected * when the program was configured and built, open that device with * isc_entropy_createfilesource(). * *\li If "use_keyboard" is #ISC_ENTROPY_KEYBOARDYES, then always open * the keyboard as an entropy source (possibly in addition to * "randomfile" or the random device). * *\li If "use_keyboard" is #ISC_ENTROPY_KEYBOARDMAYBE, open the keyboard only * if opening the random file/device fails. A message will be * printed describing the need for keyboard input. * *\li If "use_keyboard" is #ISC_ENTROPY_KEYBOARDNO, the keyboard will * never be opened. * * Returns: *\li #ISC_R_SUCCESS if at least one source of entropy could be started. * *\li #ISC_R_NOENTROPY if use_keyboard is #ISC_ENTROPY_KEYBOARDNO and * there is no random device pathname compiled into the program. * *\li A return code from isc_entropy_createfilesource() or * isc_entropy_createcallbacksource(). */ ISC_LANG_ENDDECLS #endif /* ISC_ENTROPY_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/base64.h����������������������������������������������������������������������������������0000644�����������������00000004613�14763166026�0007603 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_BASE64_H #define ISC_BASE64_H 1 /*! \file isc/base64.h */ #include <isc/lang.h> #include <isc/types.h> ISC_LANG_BEGINDECLS /*** *** Functions ***/ isc_result_t isc_base64_totext(isc_region_t *source, int wordlength, const char *wordbreak, isc_buffer_t *target); /*!< * \brief Convert data into base64 encoded text. * * Notes: *\li The base64 encoded text in 'target' will be divided into * words of at most 'wordlength' characters, separated by * the 'wordbreak' string. No parentheses will surround * the text. * * Requires: *\li 'source' is a region containing binary data *\li 'target' is a text buffer containing available space *\li 'wordbreak' points to a null-terminated string of * zero or more whitespace characters * * Ensures: *\li target will contain the base64 encoded version of the data * in source. The 'used' pointer in target will be advanced as * necessary. */ isc_result_t isc_base64_decodestring(const char *cstr, isc_buffer_t *target); /*!< * \brief Decode a null-terminated base64 string. * * Requires: *\li 'cstr' is non-null. *\li 'target' is a valid buffer. * * Returns: *\li #ISC_R_SUCCESS -- the entire decoded representation of 'cstring' * fit in 'target'. *\li #ISC_R_BADBASE64 -- 'cstr' is not a valid base64 encoding. * * Other error returns are any possible error code from: *\li isc_lex_create(), *\li isc_lex_openbuffer(), *\li isc_base64_tobuffer(). */ isc_result_t isc_base64_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length); /*!< * \brief Convert base64 encoded text from a lexer context into data. * * Requires: *\li 'lex' is a valid lexer context *\li 'target' is a buffer containing binary data *\li 'length' is an integer * * Ensures: *\li target will contain the data represented by the base64 encoded * string parsed by the lexer. No more than length bytes will be read, * if length is positive. The 'used' pointer in target will be * advanced as necessary. */ ISC_LANG_ENDDECLS #endif /* ISC_BASE64_H */ ���������������������������������������������������������������������������������������������������������������������bind9/isc/once.h������������������������������������������������������������������������������������0000644�����������������00000001725�14763166026�0007444 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_ONCE_H #define ISC_ONCE_H 1 /*! \file */ #include <pthread.h> #include <isc/platform.h> #include <isc/result.h> typedef pthread_once_t isc_once_t; #ifdef ISC_PLATFORM_BRACEPTHREADONCEINIT /*! * This accomodates systems that define PTHRAD_ONCE_INIT improperly. */ #define ISC_ONCE_INIT { PTHREAD_ONCE_INIT } #else /*! * This is the usual case. */ #define ISC_ONCE_INIT PTHREAD_ONCE_INIT #endif /* XXX We could do fancier error handling... */ #define isc_once_do(op, f) \ ((pthread_once((op), (f)) == 0) ? \ ISC_R_SUCCESS : ISC_R_UNEXPECTED) #endif /* ISC_ONCE_H */ �������������������������������������������bind9/isc/xml.h�������������������������������������������������������������������������������������0000644�����������������00000002105�14763166026�0007311 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_XML_H #define ISC_XML_H 1 /* * This file is here mostly to make it easy to add additional libxml header * files as needed across all the users of this file. Rather than place * these libxml includes in each file, one include makes it easy to handle * the ifdef as well as adding the ability to add additional functions * which may be useful. */ #ifdef HAVE_LIBXML2 #include <libxml/encoding.h> #include <libxml/xmlwriter.h> #endif #define ISC_XMLCHAR (const xmlChar *) #define ISC_XML_RENDERCONFIG 0x00000001 /* render config data */ #define ISC_XML_RENDERSTATS 0x00000002 /* render stats */ #define ISC_XML_RENDERALL 0x000000ff /* render everything */ #endif /* ISC_XML_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/interfaceiter.h���������������������������������������������������������������������������0000644�����������������00000006034�14763166026�0011342 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_INTERFACEITER_H #define ISC_INTERFACEITER_H 1 /***** ***** Module Info *****/ /*! \file isc/interfaceiter.h * \brief Iterates over the list of network interfaces. * * Interfaces whose address family is not supported are ignored and never * returned by the iterator. Interfaces whose netmask, interface flags, * or similar cannot be obtained are also ignored, and the failure is logged. * * Standards: * The API for scanning varies greatly among operating systems. * This module attempts to hide the differences. */ /*** *** Imports ***/ #include <isc/lang.h> #include <isc/netaddr.h> #include <isc/types.h> /*! * \brief Public structure describing a network interface. */ struct isc_interface { char name[32]; /*%< Interface name, null-terminated. */ unsigned int af; /*%< Address family. */ isc_netaddr_t address; /*%< Local address. */ isc_netaddr_t netmask; /*%< Network mask. */ isc_netaddr_t dstaddress; /*%< Destination address (point-to-point only). */ isc_uint32_t flags; /*%< Flags; see INTERFACE flags. */ }; /*@{*/ /*! Interface flags. */ #define INTERFACE_F_UP 0x00000001U #define INTERFACE_F_POINTTOPOINT 0x00000002U #define INTERFACE_F_LOOPBACK 0x00000004U /*@}*/ /*** *** Functions ***/ ISC_LANG_BEGINDECLS isc_result_t isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp); /*!< * \brief Create an iterator for traversing the operating system's list * of network interfaces. * * Returns: *\li #ISC_R_SUCCESS * \li #ISC_R_NOMEMORY *\li Various network-related errors */ isc_result_t isc_interfaceiter_first(isc_interfaceiter_t *iter); /*!< * \brief Position the iterator on the first interface. * * Returns: *\li #ISC_R_SUCCESS Success. *\li #ISC_R_NOMORE There are no interfaces. */ isc_result_t isc_interfaceiter_current(isc_interfaceiter_t *iter, isc_interface_t *ifdata); /*!< * \brief Get information about the interface the iterator is currently * positioned at and store it at *ifdata. * * Requires: *\li The iterator has been successfully positioned using * isc_interface_iter_first() / isc_interface_iter_next(). * * Returns: *\li #ISC_R_SUCCESS Success. */ isc_result_t isc_interfaceiter_next(isc_interfaceiter_t *iter); /*!< * \brief Position the iterator on the next interface. * * Requires: * \li The iterator has been successfully positioned using * isc_interface_iter_first() / isc_interface_iter_next(). * * Returns: *\li #ISC_R_SUCCESS Success. *\li #ISC_R_NOMORE There are no more interfaces. */ void isc_interfaceiter_destroy(isc_interfaceiter_t **iterp); /*!< * \brief Destroy the iterator. */ ISC_LANG_ENDDECLS #endif /* ISC_INTERFACEITER_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/log.h�������������������������������������������������������������������������������������0000644�����������������00000070076�14763166026�0007306 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_LOG_H #define ISC_LOG_H 1 /*! \file isc/log.h */ #include <stdio.h> #include <stdarg.h> #include <syslog.h> /* XXXDCL NT */ #include <isc/formatcheck.h> #include <isc/lang.h> #include <isc/platform.h> #include <isc/types.h> /*@{*/ /*! * \brief Severity levels, patterned after Unix's syslog levels. * */ #define ISC_LOG_DEBUG(level) (level) /*! * #ISC_LOG_DYNAMIC can only be used for defining channels with * isc_log_createchannel(), not to specify a level in isc_log_write(). */ #define ISC_LOG_DYNAMIC 0 #define ISC_LOG_INFO (-1) #define ISC_LOG_NOTICE (-2) #define ISC_LOG_WARNING (-3) #define ISC_LOG_ERROR (-4) #define ISC_LOG_CRITICAL (-5) /*@}*/ /*@{*/ /*! * \brief Destinations. */ #define ISC_LOG_TONULL 1 #define ISC_LOG_TOSYSLOG 2 #define ISC_LOG_TOFILE 3 #define ISC_LOG_TOFILEDESC 4 /*@}*/ /*@{*/ /*% * Channel flags. */ #define ISC_LOG_PRINTTIME 0x0001 #define ISC_LOG_PRINTLEVEL 0x0002 #define ISC_LOG_PRINTCATEGORY 0x0004 #define ISC_LOG_PRINTMODULE 0x0008 #define ISC_LOG_PRINTTAG 0x0010 /* tag and ":" */ #define ISC_LOG_PRINTPREFIX 0x0020 /* tag only, no colon */ #define ISC_LOG_PRINTALL 0x003F #define ISC_LOG_BUFFERED 0x0040 #define ISC_LOG_DEBUGONLY 0x1000 #define ISC_LOG_OPENERR 0x8000 /* internal */ /*@}*/ /*@{*/ /*! * \brief Other options. * * XXXDCL INFINITE doesn't yet work. Arguably it isn't needed, but * since I am intend to make large number of versions work efficiently, * INFINITE is going to be trivial to add to that. */ #define ISC_LOG_ROLLINFINITE (-1) #define ISC_LOG_ROLLNEVER (-2) /*@}*/ /*! * \brief Used to name the categories used by a library. * * An array of isc_logcategory * structures names each category, and the id value is initialized by calling * isc_log_registercategories. */ struct isc_logcategory { const char *name; unsigned int id; }; /*% * Similar to isc_logcategory, but for all the modules a library defines. */ struct isc_logmodule { const char *name; unsigned int id; }; /*% * The isc_logfile structure is initialized as part of an isc_logdestination * before calling isc_log_createchannel(). * * When defining an #ISC_LOG_TOFILE * channel the name, versions and maximum_size should be set before calling * isc_log_createchannel(). To define an #ISC_LOG_TOFILEDESC channel set only * the stream before the call. * * Setting maximum_size to zero implies no maximum. */ typedef struct isc_logfile { FILE *stream; /*%< Initialized to NULL for #ISC_LOG_TOFILE. */ const char *name; /*%< NULL for #ISC_LOG_TOFILEDESC. */ int versions; /* >= 0, #ISC_LOG_ROLLNEVER, #ISC_LOG_ROLLINFINITE. */ /*% * stdio's ftell is standardized to return a long, which may well not * be big enough for the largest file supportable by the operating * system (though it is _probably_ big enough for the largest log * anyone would want). st_size returned by fstat should be typedef'd * to a size large enough for the largest possible file on a system. */ isc_offset_t maximum_size; isc_boolean_t maximum_reached; /*%< Private. */ } isc_logfile_t; /*% * Passed to isc_log_createchannel to define the attributes of either * a stdio or a syslog log. */ typedef union isc_logdestination { isc_logfile_t file; int facility; /* XXXDCL NT */ } isc_logdestination_t; /*@{*/ /*% * The built-in categories of libisc. * * Each library registering categories should provide library_LOGCATEGORY_name * definitions with indexes into its isc_logcategory structure corresponding to * the order of the names. */ LIBISC_EXTERNAL_DATA extern isc_logcategory_t isc_categories[]; LIBISC_EXTERNAL_DATA extern isc_log_t *isc_lctx; LIBISC_EXTERNAL_DATA extern isc_logmodule_t isc_modules[]; /*@}*/ /*@{*/ /*% * Do not log directly to DEFAULT. Use another category. When in doubt, * use GENERAL. */ #define ISC_LOGCATEGORY_DEFAULT (&isc_categories[0]) #define ISC_LOGCATEGORY_GENERAL (&isc_categories[1]) /*@}*/ #define ISC_LOGMODULE_SOCKET (&isc_modules[0]) #define ISC_LOGMODULE_TIME (&isc_modules[1]) #define ISC_LOGMODULE_INTERFACE (&isc_modules[2]) #define ISC_LOGMODULE_TIMER (&isc_modules[3]) #define ISC_LOGMODULE_FILE (&isc_modules[4]) #define ISC_LOGMODULE_OTHER (&isc_modules[5]) ISC_LANG_BEGINDECLS isc_result_t isc_log_create(isc_mem_t *mctx, isc_log_t **lctxp, isc_logconfig_t **lcfgp); /*%< * Establish a new logging context, with default channels. * * Notes: *\li isc_log_create() calls isc_logconfig_create(), so see its comment * below for more information. * * Requires: *\li mctx is a valid memory context. *\li lctxp is not null and *lctxp is null. *\li lcfgp is null or lcfgp is not null and *lcfgp is null. * * Ensures: *\li *lctxp will point to a valid logging context if all of the necessary * memory was allocated, or NULL otherwise. *\li *lcfgp will point to a valid logging configuration if all of the * necessary memory was allocated, or NULL otherwise. *\li On failure, no additional memory is allocated. * * Returns: *\li #ISC_R_SUCCESS Success *\li #ISC_R_NOMEMORY Resource limit: Out of memory */ isc_result_t isc_logconfig_create(isc_log_t *lctx, isc_logconfig_t **lcfgp); /*%< * Create the data structure that holds all of the configurable information * about where messages are actually supposed to be sent -- the information * that could changed based on some configuration file, as opposed to the * the category/module specification of isc_log_[v]write[1] that is compiled * into a program, or the debug_level which is dynamic state information. * * Notes: *\li It is necessary to specify the logging context the configuration * will be used with because the number of categories and modules * needs to be known in order to set the configuration. However, * the configuration is not used by the logging context until the * isc_logconfig_use function is called. * *\li The memory context used for operations that allocate memory for * the configuration is that of the logging context, as specified * in the isc_log_create call. * *\li Four default channels are established: *\verbatim * default_syslog * - log to syslog's daemon facility #ISC_LOG_INFO or higher * default_stderr * - log to stderr #ISC_LOG_INFO or higher * default_debug * - log to stderr #ISC_LOG_DEBUG dynamically * null * - log nothing *\endverbatim * * Requires: *\li lctx is a valid logging context. *\li lcftp is not null and *lcfgp is null. * * Ensures: *\li *lcfgp will point to a valid logging context if all of the necessary * memory was allocated, or NULL otherwise. *\li On failure, no additional memory is allocated. * * Returns: *\li #ISC_R_SUCCESS Success *\li #ISC_R_NOMEMORY Resource limit: Out of memory */ isc_logconfig_t * isc_logconfig_get(isc_log_t *lctx); /*%< * Returns a pointer to the configuration currently in use by the log context. * * Requires: *\li lctx is a valid context. * * Ensures: *\li The configuration pointer is non-null. * * Returns: *\li The configuration pointer. */ isc_result_t isc_logconfig_use(isc_log_t *lctx, isc_logconfig_t *lcfg); /*%< * Associate a new configuration with a logging context. * * Notes: *\li This is thread safe. The logging context will lock a mutex * before attempting to swap in the new configuration, and isc_log_doit * (the internal function used by all of isc_log_[v]write[1]) locks * the same lock for the duration of its use of the configuration. * * Requires: *\li lctx is a valid logging context. *\li lcfg is a valid logging configuration. *\li lctx is the same configuration given to isc_logconfig_create * when the configuration was created. * * Ensures: *\li Future calls to isc_log_write will use the new configuration. * * Returns: *\li #ISC_R_SUCCESS Success *\li #ISC_R_NOMEMORY Resource limit: Out of memory */ void isc_log_destroy(isc_log_t **lctxp); /*%< * Deallocate the memory associated with a logging context. * * Requires: *\li *lctx is a valid logging context. * * Ensures: *\li All of the memory associated with the logging context is returned * to the free memory pool. * *\li Any open files are closed. * *\li The logging context is marked as invalid. */ void isc_logconfig_destroy(isc_logconfig_t **lcfgp); /*%< * Destroy a logging configuration. * * Notes: *\li This function cannot be used directly with the return value of * isc_logconfig_get, because a logging context must always have * a valid configuration associated with it. * * Requires: *\li lcfgp is not null and *lcfgp is a valid logging configuration. *\li The logging configuration is not in use by an existing logging context. * * Ensures: *\li All memory allocated for the configuration is freed. * *\li The configuration is marked as invalid. */ void isc_log_registercategories(isc_log_t *lctx, isc_logcategory_t categories[]); /*%< * Identify logging categories a library will use. * * Notes: *\li A category should only be registered once, but no mechanism enforces * this rule. * *\li The end of the categories array is identified by a NULL name. * *\li Because the name is used by #ISC_LOG_PRINTCATEGORY, it should not * be altered or destroyed after isc_log_registercategories(). * *\li Because each element of the categories array is used by * isc_log_categorybyname, it should not be altered or destroyed * after registration. * *\li The value of the id integer in each structure is overwritten * by this function, and so id need not be initialized to any particular * value prior to the function call. * *\li A subsequent call to isc_log_registercategories with the same * logging context (but new categories) will cause the last * element of the categories array from the prior call to have * its "name" member changed from NULL to point to the new * categories array, and its "id" member set to UINT_MAX. * * Requires: *\li lctx is a valid logging context. *\li categories != NULL. *\li categories[0].name != NULL. * * Ensures: * \li There are references to each category in the logging context, * so they can be used with isc_log_usechannel() and isc_log_write(). */ void isc_log_registermodules(isc_log_t *lctx, isc_logmodule_t modules[]); /*%< * Identify logging categories a library will use. * * Notes: *\li A module should only be registered once, but no mechanism enforces * this rule. * *\li The end of the modules array is identified by a NULL name. * *\li Because the name is used by #ISC_LOG_PRINTMODULE, it should not * be altered or destroyed after isc_log_registermodules(). * *\li Because each element of the modules array is used by * isc_log_modulebyname, it should not be altered or destroyed * after registration. * *\li The value of the id integer in each structure is overwritten * by this function, and so id need not be initialized to any particular * value prior to the function call. * *\li A subsequent call to isc_log_registermodules with the same * logging context (but new modules) will cause the last * element of the modules array from the prior call to have * its "name" member changed from NULL to point to the new * modules array, and its "id" member set to UINT_MAX. * * Requires: *\li lctx is a valid logging context. *\li modules != NULL. *\li modules[0].name != NULL; * * Ensures: *\li Each module has a reference in the logging context, so they can be * used with isc_log_usechannel() and isc_log_write(). */ isc_result_t isc_log_createchannel(isc_logconfig_t *lcfg, const char *name, unsigned int type, int level, const isc_logdestination_t *destination, unsigned int flags); /*%< * Specify the parameters of a logging channel. * * Notes: *\li The name argument is copied to memory in the logging context, so * it can be altered or destroyed after isc_log_createchannel(). * *\li Defining a very large number of channels will have a performance * impact on isc_log_usechannel(), since the names are searched * linearly until a match is made. This same issue does not affect * isc_log_write, however. * *\li Channel names can be redefined; this is primarily useful for programs * that want their own definition of default_syslog, default_debug * and default_stderr. * *\li Any channel that is redefined will not affect logging that was * already directed to its original definition, _except_ for the * default_stderr channel. This case is handled specially so that * the default logging category can be changed by redefining * default_stderr. (XXXDCL Though now that I think of it, the default * logging category can be changed with only one additional function * call by defining a new channel and then calling isc_log_usechannel() * for #ISC_LOGCATEGORY_DEFAULT.) * *\li Specifying #ISC_LOG_PRINTTIME or #ISC_LOG_PRINTTAG for syslog is * allowed, but probably not what you wanted to do. * * #ISC_LOG_DEBUGONLY will mark the channel as usable only when the * debug level of the logging context (see isc_log_setdebuglevel) * is non-zero. * * Requires: *\li lcfg is a valid logging configuration. * *\li name is not NULL. * *\li type is #ISC_LOG_TOSYSLOG, #ISC_LOG_TOFILE, #ISC_LOG_TOFILEDESC or * #ISC_LOG_TONULL. * *\li destination is not NULL unless type is #ISC_LOG_TONULL. * *\li level is >= #ISC_LOG_CRITICAL (the most negative logging level). * *\li flags does not include any bits aside from the ISC_LOG_PRINT* bits, * #ISC_LOG_DEBUGONLY or #ISC_LOG_BUFFERED. * * Ensures: *\li #ISC_R_SUCCESS * A channel with the given name is usable with * isc_log_usechannel(). * *\li #ISC_R_NOMEMORY or #ISC_R_UNEXPECTED * No additional memory is being used by the logging context. * Any channel that previously existed with the given name * is not redefined. * * Returns: *\li #ISC_R_SUCCESS Success *\li #ISC_R_NOMEMORY Resource limit: Out of memory *\li #ISC_R_UNEXPECTED type was out of range and REQUIRE() * was disabled. */ isc_result_t isc_log_usechannel(isc_logconfig_t *lcfg, const char *name, const isc_logcategory_t *category, const isc_logmodule_t *module); /*%< * Associate a named logging channel with a category and module that * will use it. * * Notes: *\li The name is searched for linearly in the set of known channel names * until a match is found. (Note the performance impact of a very large * number of named channels.) When multiple channels of the same * name are defined, the most recent definition is found. * *\li Specifying a very large number of channels for a category will have * a moderate impact on performance in isc_log_write(), as each * call looks up the category for the start of a linked list, which * it follows all the way to the end to find matching modules. The * test for matching modules is integral, though. * *\li If category is NULL, then the channel is associated with the indicated * module for all known categories (including the "default" category). * *\li If module is NULL, then the channel is associated with every module * that uses that category. * *\li Passing both category and module as NULL would make every log message * use the indicated channel. * * \li Specifying a channel that is #ISC_LOG_TONULL for a category/module pair * has no effect on any other channels associated with that pair, * regardless of ordering. Thus you cannot use it to "mask out" one * category/module pair when you have specified some other channel that * is also used by that category/module pair. * * Requires: *\li lcfg is a valid logging configuration. * *\li category is NULL or has an id that is in the range of known ids. * * module is NULL or has an id that is in the range of known ids. * * Ensures: *\li #ISC_R_SUCCESS * The channel will be used by the indicated category/module * arguments. * *\li #ISC_R_NOMEMORY * If assignment for a specific category has been requested, * the channel has not been associated with the indicated * category/module arguments and no additional memory is * used by the logging context. * If assignment for all categories has been requested * then _some_ may have succeeded (starting with category * "default" and progressing through the order of categories * passed to isc_log_registercategories()) and additional memory * is being used by whatever assignments succeeded. * * Returns: *\li #ISC_R_SUCCESS Success *\li #ISC_R_NOMEMORY Resource limit: Out of memory */ /* Attention: next four comments PRECEED code */ /*! * \brief * Write a message to the log channels. * * Notes: *\li Log messages containing natural language text should be logged with * isc_log_iwrite() to allow for localization. * *\li lctx can be NULL; this is allowed so that programs which use * libraries that use the ISC logging system are not required to * also use it. * *\li The format argument is a printf(3) string, with additional arguments * as necessary. * * Requires: *\li lctx is a valid logging context. * *\li The category and module arguments must have ids that are in the * range of known ids, as established by isc_log_registercategories() * and isc_log_registermodules(). * *\li level != #ISC_LOG_DYNAMIC. ISC_LOG_DYNAMIC is used only to define * channels, and explicit debugging level must be identified for * isc_log_write() via ISC_LOG_DEBUG(level). * *\li format != NULL. * * Ensures: *\li The log message is written to every channel associated with the * indicated category/module pair. * * Returns: *\li Nothing. Failure to log a message is not construed as a * meaningful error. */ void isc_log_write(isc_log_t *lctx, isc_logcategory_t *category, isc_logmodule_t *module, int level, const char *format, ...) ISC_FORMAT_PRINTF(5, 6); /*% * Write a message to the log channels. * * Notes: *\li lctx can be NULL; this is allowed so that programs which use * libraries that use the ISC logging system are not required to * also use it. * *\li The format argument is a printf(3) string, with additional arguments * as necessary. * * Requires: *\li lctx is a valid logging context. * *\li The category and module arguments must have ids that are in the * range of known ids, as established by isc_log_registercategories() * and isc_log_registermodules(). * *\li level != #ISC_LOG_DYNAMIC. ISC_LOG_DYNAMIC is used only to define * channels, and explicit debugging level must be identified for * isc_log_write() via ISC_LOG_DEBUG(level). * *\li format != NULL. * * Ensures: *\li The log message is written to every channel associated with the * indicated category/module pair. * * Returns: *\li Nothing. Failure to log a message is not construed as a * meaningful error. */ void isc_log_vwrite(isc_log_t *lctx, isc_logcategory_t *category, isc_logmodule_t *module, int level, const char *format, va_list args) ISC_FORMAT_PRINTF(5, 0); /*% * Write a message to the log channels, pruning duplicates that occur within * a configurable amount of seconds (see isc_log_[sg]etduplicateinterval). * This function is otherwise identical to isc_log_write(). */ void isc_log_write1(isc_log_t *lctx, isc_logcategory_t *category, isc_logmodule_t *module, int level, const char *format, ...) ISC_FORMAT_PRINTF(5, 6); /*% * Write a message to the log channels, pruning duplicates that occur within * a configurable amount of seconds (see isc_log_[sg]etduplicateinterval). * This function is otherwise identical to isc_log_vwrite(). */ void isc_log_vwrite1(isc_log_t *lctx, isc_logcategory_t *category, isc_logmodule_t *module, int level, const char *format, va_list args) ISC_FORMAT_PRINTF(5, 0); /*% * These are four internationalized versions of the isc_log_[v]write[1] * functions. * * The only difference is that they take arguments for a message * catalog, message set, and message number, all immediately preceding the * format argument. The format argument becomes the default text, a la * isc_msgcat_get. If the message catalog is NULL, no lookup is attempted * for a message -- which makes the message set and message number irrelevant, * and the non-internationalized call should have probably been used instead. * * Yes, that means there are now *eight* interfaces to logging a message. * Sheesh. Make the madness stop! */ /*@{*/ void isc_log_iwrite(isc_log_t *lctx, isc_logcategory_t *category, isc_logmodule_t *module, int level, isc_msgcat_t *msgcat, int msgset, int message, const char *format, ...) ISC_FORMAT_PRINTF(8, 9); void isc_log_ivwrite(isc_log_t *lctx, isc_logcategory_t *category, isc_logmodule_t *module, int level, isc_msgcat_t *msgcat, int msgset, int message, const char *format, va_list args) ISC_FORMAT_PRINTF(8, 0); void isc_log_iwrite1(isc_log_t *lctx, isc_logcategory_t *category, isc_logmodule_t *module, int level, isc_msgcat_t *msgcat, int msgset, int message, const char *format, ...) ISC_FORMAT_PRINTF(8, 9); void isc_log_ivwrite1(isc_log_t *lctx, isc_logcategory_t *category, isc_logmodule_t *module, int level, isc_msgcat_t *msgcat, int msgset, int message, const char *format, va_list args) ISC_FORMAT_PRINTF(8, 0); /*@}*/ void isc_log_setdebuglevel(isc_log_t *lctx, unsigned int level); /*%< * Set the debugging level used for logging. * * Notes: *\li Setting the debugging level to 0 disables debugging log messages. * * Requires: *\li lctx is a valid logging context. * * Ensures: *\li The debugging level is set to the requested value. */ unsigned int isc_log_getdebuglevel(isc_log_t *lctx); /*%< * Get the current debugging level. * * Notes: *\li This is provided so that a program can have a notion of * "increment debugging level" or "decrement debugging level" * without needing to keep track of what the current level is. * *\li A return value of 0 indicates that debugging messages are disabled. * * Requires: *\li lctx is a valid logging context. * * Ensures: *\li The current logging debugging level is returned. */ isc_boolean_t isc_log_wouldlog(isc_log_t *lctx, int level); /*%< * Determine whether logging something to 'lctx' at 'level' would * actually cause something to be logged somewhere. * * If #ISC_FALSE is returned, it is guaranteed that nothing would * be logged, allowing the caller to omit unnecessary * isc_log_write() calls and possible message preformatting. */ void isc_log_setduplicateinterval(isc_logconfig_t *lcfg, unsigned int interval); /*%< * Set the interval over which duplicate log messages will be ignored * by isc_log_[v]write1(), in seconds. * * Notes: *\li Increasing the duplicate interval from X to Y will not necessarily * filter out duplicates of messages logged in Y - X seconds since the * increase. (Example: Message1 is logged at midnight. Message2 * is logged at 00:01:00, when the interval is only 30 seconds, causing * Message1 to be expired from the log message history. Then the interval * is increased to 3000 (five minutes) and at 00:04:00 Message1 is logged * again. It will appear the second time even though less than five * passed since the first occurrence. * * Requires: *\li lctx is a valid logging context. */ unsigned int isc_log_getduplicateinterval(isc_logconfig_t *lcfg); /*%< * Get the current duplicate filtering interval. * * Requires: *\li lctx is a valid logging context. * * Returns: *\li The current duplicate filtering interval. */ isc_result_t isc_log_settag(isc_logconfig_t *lcfg, const char *tag); /*%< * Set the program name or other identifier for #ISC_LOG_PRINTTAG. * * Requires: *\li lcfg is a valid logging configuration. * * Notes: *\li If this function has not set the tag to a non-NULL, non-empty value, * then the #ISC_LOG_PRINTTAG channel flag will not print anything. * Unlike some implementations of syslog on Unix systems, you *must* set * the tag in order to get it logged. It is not implicitly derived from * the program name (which is pretty impossible to infer portably). * *\li Setting the tag to NULL or the empty string will also cause the * #ISC_LOG_PRINTTAG channel flag to not print anything. If tag equals the * empty string, calls to isc_log_gettag will return NULL. * * Returns: *\li #ISC_R_SUCCESS Success *\li #ISC_R_NOMEMORY Resource Limit: Out of memory * * XXXDCL when creating a new isc_logconfig_t, it might be nice if the tag * of the currently active isc_logconfig_t was inherited. this does not * currently happen. */ char * isc_log_gettag(isc_logconfig_t *lcfg); /*%< * Get the current identifier printed with #ISC_LOG_PRINTTAG. * * Requires: *\li lcfg is a valid logging configuration. * * Notes: *\li Since isc_log_settag() will not associate a zero-length string * with the logging configuration, attempts to do so will cause * this function to return NULL. However, a determined programmer * will observe that (currently) a tag of length greater than zero * could be set, and then modified to be zero length. * * Returns: *\li A pointer to the current identifier, or NULL if none has been set. */ void isc_log_opensyslog(const char *tag, int options, int facility); /*%< * Initialize syslog logging. * * Notes: *\li XXXDCL NT * This is currently equivalent to openlog(), but is not going to remain * that way. In the meantime, the arguments are all identical to * those used by openlog(3), as follows: * * \code * tag: The string to use in the position of the program * name in syslog messages. Most (all?) syslogs * will use basename(argv[0]) if tag is NULL. * * options: LOG_CONS, LOG_PID, LOG_NDELAY ... whatever your * syslog supports. * * facility: The default syslog facility. This is irrelevant * since isc_log_write will ALWAYS use the channel's * declared facility. * \endcode * *\li Zero effort has been made (yet) to accommodate systems with openlog() * that only takes two arguments, or to identify valid syslog * facilities or options for any given architecture. * *\li It is necessary to call isc_log_opensyslog() to initialize * syslogging on machines which do not support network connections to * syslogd because they require a Unix domain socket to be used. Since * this is a chore to determine at run-time, it is suggested that it * always be called by programs using the ISC logging system. * * Requires: *\li Nothing. * * Ensures: *\li openlog() is called to initialize the syslog system. */ void isc_log_closefilelogs(isc_log_t *lctx); /*%< * Close all open files used by #ISC_LOG_TOFILE channels. * * Notes: *\li This function is provided for programs that want to use their own * log rolling mechanism rather than the one provided internally. * For example, a program that wanted to keep daily logs would define * a channel which used #ISC_LOG_ROLLNEVER, then once a day would * rename the log file and call isc_log_closefilelogs(). * *\li #ISC_LOG_TOFILEDESC channels are unaffected. * * Requires: *\li lctx is a valid context. * * Ensures: *\li The open files are closed and will be reopened when they are * next needed. */ isc_logcategory_t * isc_log_categorybyname(isc_log_t *lctx, const char *name); /*%< * Find a category by its name. * * Notes: *\li The string name of a category is not required to be unique. * * Requires: *\li lctx is a valid context. *\li name is not NULL. * * Returns: *\li A pointer to the _first_ isc_logcategory_t structure used by "name". * *\li NULL if no category exists by that name. */ isc_logmodule_t * isc_log_modulebyname(isc_log_t *lctx, const char *name); /*%< * Find a module by its name. * * Notes: *\li The string name of a module is not required to be unique. * * Requires: *\li lctx is a valid context. *\li name is not NULL. * * Returns: *\li A pointer to the _first_ isc_logmodule_t structure used by "name". * *\li NULL if no module exists by that name. */ void isc_log_setcontext(isc_log_t *lctx); /*%< * Sets the context used by the libisc for logging. * * Requires: *\li lctx be a valid context. */ isc_result_t isc_logfile_roll(isc_logfile_t *file); /*%< * Roll a logfile. * * Requires: *\li file is not NULL. */ ISC_LANG_ENDDECLS #endif /* ISC_LOG_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/counter.h���������������������������������������������������������������������������������0000644�����������������00000003605�14763166026�0010176 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_COUNTER_H #define ISC_COUNTER_H 1 /***** ***** Module Info *****/ /*! \file isc/counter.h * * \brief The isc_counter_t object is a simplified version of the * isc_quota_t object; it tracks the consumption of limited * resources, returning an error condition when the quota is * exceeded. However, unlike isc_quota_t, attaching and detaching * from a counter object does not increment or decrement the counter. */ /*** *** Imports. ***/ #include <isc/lang.h> #include <isc/mutex.h> #include <isc/types.h> /***** ***** Types. *****/ ISC_LANG_BEGINDECLS isc_result_t isc_counter_create(isc_mem_t *mctx, int limit, isc_counter_t **counterp); /*%< * Allocate and initialize a counter object. */ isc_result_t isc_counter_increment(isc_counter_t *counter); /*%< * Increment the counter. * * If the counter limit is nonzero and has been reached, then * return ISC_R_QUOTA, otherwise ISC_R_SUCCESS. (The counter is * incremented regardless of return value.) */ unsigned int isc_counter_used(isc_counter_t *counter); /*%< * Return the current counter value. */ void isc_counter_setlimit(isc_counter_t *counter, int limit); /*%< * Set the counter limit. */ void isc_counter_attach(isc_counter_t *source, isc_counter_t **targetp); /*%< * Attach to a counter object, increasing its reference counter. */ void isc_counter_detach(isc_counter_t **counterp); /*%< * Detach (and destroy if reference counter has dropped to zero) * a counter object. */ ISC_LANG_ENDDECLS #endif /* ISC_COUNTER_H */ ���������������������������������������������������������������������������������������������������������������������������bind9/isc/file.h������������������������������������������������������������������������������������0000644�����������������00000026672�14763166026�0007447 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_FILE_H #define ISC_FILE_H 1 /*! \file isc/file.h */ #include <stdio.h> #include <isc/lang.h> #include <isc/stat.h> #include <isc/types.h> ISC_LANG_BEGINDECLS isc_result_t isc_file_settime(const char *file, isc_time_t *time); isc_result_t isc_file_mode(const char *file, mode_t *modep); isc_result_t isc_file_getmodtime(const char *file, isc_time_t *time); /*!< * \brief Get the time of last modification of a file. * * Notes: *\li The time that is set is relative to the (OS-specific) epoch, as are * all isc_time_t structures. * * Requires: *\li file != NULL. *\li time != NULL. * * Ensures: *\li If the file could not be accessed, 'time' is unchanged. * * Returns: *\li #ISC_R_SUCCESS * Success. *\li #ISC_R_NOTFOUND * No such file exists. *\li #ISC_R_INVALIDFILE * The path specified was not usable by the operating system. *\li #ISC_R_NOPERM * The file's metainformation could not be retrieved because * permission was denied to some part of the file's path. *\li #ISC_R_IOERROR * Hardware error interacting with the filesystem. *\li #ISC_R_UNEXPECTED * Something totally unexpected happened. * */ isc_result_t isc_file_mktemplate(const char *path, char *buf, size_t buflen); /*!< * \brief Generate a template string suitable for use with isc_file_openunique(). * * Notes: *\li This function is intended to make creating temporary files * portable between different operating systems. * *\li The path is prepended to an implementation-defined string and * placed into buf. The string has no path characters in it, * and its maximum length is 14 characters plus a NUL. Thus * buflen should be at least strlen(path) + 15 characters or * an error will be returned. * * Requires: *\li buf != NULL. * * Ensures: *\li If result == #ISC_R_SUCCESS: * buf contains a string suitable for use as the template argument * to isc_file_openunique(). * *\li If result != #ISC_R_SUCCESS: * buf is unchanged. * * Returns: *\li #ISC_R_SUCCESS Success. *\li #ISC_R_NOSPACE buflen indicates buf is too small for the catenation * of the path with the internal template string. */ isc_result_t isc_file_openunique(char *templet, FILE **fp); isc_result_t isc_file_openuniqueprivate(char *templet, FILE **fp); isc_result_t isc_file_openuniquemode(char *templet, int mode, FILE **fp); isc_result_t isc_file_bopenunique(char *templet, FILE **fp); isc_result_t isc_file_bopenuniqueprivate(char *templet, FILE **fp); isc_result_t isc_file_bopenuniquemode(char *templet, int mode, FILE **fp); /*!< * \brief Create and open a file with a unique name based on 'templet'. * isc_file_bopen*() open the file in binary mode in Windows. * isc_file_open*() open the file in text mode in Windows. * * Notes: *\li 'template' is a reserved work in C++. If you want to complain * about the spelling of 'templet', first look it up in the * Merriam-Webster English dictionary. (http://www.m-w.com/) * *\li This function works by using the template to generate file names. * The template must be a writable string, as it is modified in place. * Trailing X characters in the file name (full file name on Unix, * basename on Win32 -- eg, tmp-XXXXXX vs XXXXXX.tmp, respectively) * are replaced with ASCII characters until a non-existent filename * is found. If the template does not include pathname information, * the files in the working directory of the program are searched. * *\li isc_file_mktemplate is a good, portable way to get a template. * * Requires: *\li 'fp' is non-NULL and '*fp' is NULL. * *\li 'template' is non-NULL, and of a form suitable for use by * the system as described above. * * Ensures: *\li If result is #ISC_R_SUCCESS: * *fp points to an stream opening in stdio's "w+" mode. * *\li If result is not #ISC_R_SUCCESS: * *fp is NULL. * * No file is open. Even if one was created (but unable * to be reopened as a stdio FILE pointer) then it has been * removed. * *\li This function does *not* ensure that the template string has not been * modified, even if the operation was unsuccessful. * * Returns: *\li #ISC_R_SUCCESS * Success. *\li #ISC_R_EXISTS * No file with a unique name could be created based on the * template. *\li #ISC_R_INVALIDFILE * The path specified was not usable by the operating system. *\li #ISC_R_NOPERM * The file could not be created because permission was denied * to some part of the file's path. *\li #ISC_R_IOERROR * Hardware error interacting with the filesystem. *\li #ISC_R_UNEXPECTED * Something totally unexpected happened. */ isc_result_t isc_file_remove(const char *filename); /*!< * \brief Remove the file named by 'filename'. */ isc_result_t isc_file_rename(const char *oldname, const char *newname); /*!< * \brief Rename the file 'oldname' to 'newname'. */ isc_boolean_t isc_file_exists(const char *pathname); /*!< * \brief Return #ISC_TRUE if the calling process can tell that the given file exists. * Will not return true if the calling process has insufficient privileges * to search the entire path. */ isc_boolean_t isc_file_isabsolute(const char *filename); /*!< * \brief Return #ISC_TRUE if the given file name is absolute. */ isc_result_t isc_file_isplainfile(const char *name); isc_result_t isc_file_isplainfilefd(int fd); /*!< * \brief Check that the file is a plain file * * Returns: *\li #ISC_R_SUCCESS * Success. The file is a plain file. *\li #ISC_R_INVALIDFILE * The path specified was not usable by the operating system. *\li #ISC_R_FILENOTFOUND * The file does not exist. This return code comes from * errno=ENOENT when stat returns -1. This code is mentioned * here, because in logconf.c, it is the one rcode that is * permitted in addition to ISC_R_SUCCESS. This is done since * the next call in logconf.c is to isc_stdio_open(), which * will create the file if it can. *\li other ISC_R_* errors translated from errno * These occur when stat returns -1 and an errno. */ isc_result_t isc_file_isdirectory(const char *name); /*!< * \brief Check that 'name' exists and is a directory. * * Returns: *\li #ISC_R_SUCCESS * Success, file is a directory. *\li #ISC_R_INVALIDFILE * File is not a directory. *\li #ISC_R_FILENOTFOUND * File does not exist. *\li other ISC_R_* errors translated from errno * These occur when stat returns -1 and an errno. */ isc_boolean_t isc_file_iscurrentdir(const char *filename); /*!< * \brief Return #ISC_TRUE if the given file name is the current directory ("."). */ isc_boolean_t isc_file_ischdiridempotent(const char *filename); /*%< * Return #ISC_TRUE if calling chdir(filename) multiple times will give * the same result as calling it once. */ const char * isc_file_basename(const char *filename); /*%< * Return the final component of the path in the file name. */ isc_result_t isc_file_progname(const char *filename, char *buf, size_t buflen); /*!< * \brief Given an operating system specific file name "filename" * referring to a program, return the canonical program name. * * Any directory prefix or executable file name extension (if * used on the OS in case) is stripped. On systems where program * names are case insensitive, the name is canonicalized to all * lower case. The name is written to 'buf', an array of 'buflen' * chars, and null terminated. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOSPACE The name did not fit in 'buf'. */ isc_result_t isc_file_template(const char *path, const char *templet, char *buf, size_t buflen); /*%< * Create an OS specific template using 'path' to define the directory * 'templet' to describe the filename and store the result in 'buf' * such that path can be renamed to buf atomically. */ isc_result_t isc_file_renameunique(const char *file, char *templet); /*%< * Rename 'file' using 'templet' as a template for the new file name. */ isc_result_t isc_file_absolutepath(const char *filename, char *path, size_t pathlen); /*%< * Given a file name, return the fully qualified path to the file. */ /* * XXX We should also have a isc_file_writeeopen() function * for safely open a file in a publicly writable directory * (see write_open() in BIND 8's ns_config.c). */ isc_result_t isc_file_truncate(const char *filename, isc_offset_t size); /*%< * Truncate/extend the file specified to 'size' bytes. */ isc_result_t isc_file_safecreate(const char *filename, FILE **fp); /*%< * Open 'filename' for writing, truncating if necessary. Ensure that * if it existed it was a normal file. If creating the file, ensure * that only the owner can read/write it. */ isc_result_t isc_file_splitpath(isc_mem_t *mctx, const char *path, char **dirname, char const **basename); /*%< * Split a path into dirname and basename. If 'path' contains no slash * (or, on windows, backslash), then '*dirname' is set to ".". * * Allocates memory for '*dirname', which can be freed with isc_mem_free(). * * Returns: * - ISC_R_SUCCESS on success * - ISC_R_INVALIDFILE if 'path' is empty or ends with '/' * - ISC_R_NOMEMORY if unable to allocate memory */ isc_result_t isc_file_getsize(const char *file, off_t *size); /*%< * Return the size of the file (stored in the parameter pointed * to by 'size') in bytes. * * Returns: * - ISC_R_SUCCESS on success */ isc_result_t isc_file_getsizefd(int fd, off_t *size); /*%< * Return the size of the file (stored in the parameter pointed * to by 'size') in bytes. * * Returns: * - ISC_R_SUCCESS on success */ void * isc_file_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset); /*%< * Portable front-end to mmap(). If mmap() is not defined on this * platform, then we simulate it by calling malloc() and read(). * (In this event, the addr, prot, and flags parameters are ignored). */ int isc_file_munmap(void *addr, size_t len); /*%< * Portable front-end to munmap(). If munmap() is not defined on * this platform, then we simply free the memory. */ isc_result_t isc_file_sanitize(const char *dir, const char *base, const char *ext, char *path, size_t length); /*%< * Generate a sanitized filename, such as for MKEYS or NZF files. * * Historically, MKEYS and NZF files used SHA256 hashes of the view * name for the filename; this was to deal with the possibility of * forbidden characters such as "/" being in a view name, and to * avoid problems with case-insensitive file systems. * * Given a basename 'base' and an extension 'ext', this function checks * for the existence of file using the old-style name format in directory * 'dir'. If found, it returns the path to that file. If there is no * file already in place, a new pathname is generated; if the basename * contains any excluded characters, then a truncated SHA256 hash is * used, otherwise the basename is used. The path name is copied * into 'path', which must point to a buffer of at least 'length' * bytes. * * Requires: * - base != NULL * - path != NULL * * Returns: * - ISC_R_SUCCESS on success * - ISC_R_NOSPACE if the resulting path would be longer than 'length' */ isc_boolean_t isc_file_isdirwritable(const char *path); /*%< * Return true if the path is a directory and is writable */ ISC_LANG_ENDDECLS #endif /* ISC_FILE_H */ ����������������������������������������������������������������������bind9/isc/bufferlist.h������������������������������������������������������������������������������0000644�����������������00000002653�14763166026�0010666 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_BUFFERLIST_H #define ISC_BUFFERLIST_H 1 /***** ***** Module Info *****/ /*! \file isc/bufferlist.h * * *\brief Buffer lists have no synchronization. Clients must ensure exclusive * access. * * \li Reliability: * No anticipated impact. * \li Security: * No anticipated impact. * * \li Standards: * None. */ /*** *** Imports ***/ #include <isc/lang.h> #include <isc/types.h> ISC_LANG_BEGINDECLS /*** *** Functions ***/ unsigned int isc_bufferlist_usedcount(isc_bufferlist_t *bl); /*!< * \brief Return the length of the sum of all used regions of all buffers in * the buffer list 'bl' * * Requires: * *\li 'bl' is not NULL. * * Returns: *\li sum of all used regions' lengths. */ unsigned int isc_bufferlist_availablecount(isc_bufferlist_t *bl); /*!< * \brief Return the length of the sum of all available regions of all buffers in * the buffer list 'bl' * * Requires: * *\li 'bl' is not NULL. * * Returns: *\li sum of all available regions' lengths. */ ISC_LANG_ENDDECLS #endif /* ISC_BUFFERLIST_H */ �������������������������������������������������������������������������������������bind9/isc/msgcat.h����������������������������������������������������������������������������������0000644�����������������00000005245�14763166026�0007777 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_MSGCAT_H #define ISC_MSGCAT_H 1 /***** ***** Module Info *****/ /*! \file isc/msgcat.h * \brief The ISC Message Catalog * aids internationalization of applications by allowing * messages to be retrieved from locale-specific files instead of * hardwiring them into the application. This allows translations of * messages appropriate to the locale to be supplied without recompiling * the application. * * Notes: *\li It's very important that message catalogs work, even if only the * default_text can be used. * * MP: *\li The caller must ensure appropriate synchronization of * isc_msgcat_open() and isc_msgcat_close(). isc_msgcat_get() * ensures appropriate synchronization. * * Reliability: *\li No anticipated impact. * * Resources: *\li TBS * * \li Security: * No anticipated impact. * * \li Standards: * None. */ /***** ***** Imports *****/ #include <isc/lang.h> #include <isc/types.h> ISC_LANG_BEGINDECLS /***** ***** Methods *****/ void isc_msgcat_open(const char *name, isc_msgcat_t **msgcatp); /*%< * Open a message catalog. * * Notes: * *\li If memory cannot be allocated or other failures occur, *msgcatp * will be set to NULL. If a NULL msgcat is given to isc_msgcat_get(), * the default_text will be returned, ensuring that some message text * will be available, no matter what's going wrong. * * Requires: * *\li 'name' is a valid string. * *\li msgcatp != NULL && *msgcatp == NULL */ void isc_msgcat_close(isc_msgcat_t **msgcatp); /*%< * Close a message catalog. * * Notes: * *\li Any string pointers returned by prior calls to isc_msgcat_get() are * invalid after isc_msgcat_close() has been called and must not be * used. * * Requires: * *\li *msgcatp is a valid message catalog or is NULL. * * Ensures: * *\li All resources associated with the message catalog are released. * *\li *msgcatp == NULL */ const char * isc_msgcat_get(isc_msgcat_t *msgcat, int set, int message, const char *default_text); /*%< * Get message 'message' from message set 'set' in 'msgcat'. If it * is not available, use 'default_text'. * * Requires: * *\li 'msgcat' is a valid message catalog or is NULL. * *\li set > 0 * *\li message > 0 * *\li 'default_text' is a valid string. */ ISC_LANG_ENDDECLS #endif /* ISC_MSGCAT_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/md5.h�������������������������������������������������������������������������������������0000644�����������������00000004534�14763166026�0007206 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! \file isc/md5.h * \brief This is the header file for the MD5 message-digest algorithm. * * The algorithm is due to Ron Rivest. This code was * written by Colin Plumb in 1993, no copyright is claimed. * This code is in the public domain; do with it what you wish. * * Equivalent code is available from RSA Data Security, Inc. * This code has been tested against that, and is equivalent, * except that you don't need to include two pages of legalese * with every copy. * * To compute the message digest of a chunk of bytes, declare an * MD5Context structure, pass it to MD5Init, call MD5Update as * needed on buffers full of bytes, and then call MD5Final, which * will fill a supplied 16-byte array with the digest. * * Changed so as no longer to depend on Colin Plumb's `usual.h' * header definitions; now uses stuff from dpkg's config.h * - Ian Jackson <ijackson@nyx.cs.du.edu>. * Still in the public domain. */ #ifndef ISC_MD5_H #define ISC_MD5_H 1 #include <pk11/site.h> #ifndef PK11_MD5_DISABLE #include <isc/lang.h> #include <isc/platform.h> #include <isc/types.h> #define ISC_MD5_DIGESTLENGTH 16U #define ISC_MD5_BLOCK_LENGTH 64U #ifdef ISC_PLATFORM_OPENSSLHASH #include <openssl/opensslv.h> #include <openssl/evp.h> typedef struct { EVP_MD_CTX *ctx; #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) EVP_MD_CTX _ctx; #endif } isc_md5_t; #elif PKCS11CRYPTO #include <pk11/pk11.h> typedef pk11_context_t isc_md5_t; #else typedef struct { isc_uint32_t buf[4]; isc_uint32_t bytes[2]; isc_uint32_t in[16]; } isc_md5_t; #endif ISC_LANG_BEGINDECLS void isc_md5_init(isc_md5_t *ctx); void isc_md5_invalidate(isc_md5_t *ctx); void isc_md5_update(isc_md5_t *ctx, const unsigned char *buf, unsigned int len); void isc_md5_final(isc_md5_t *ctx, unsigned char *digest); isc_boolean_t isc_md5_check(isc_boolean_t testing); isc_boolean_t isc_md5_available(void); ISC_LANG_ENDDECLS #endif /* !PK11_MD5_DISABLE */ #endif /* ISC_MD5_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/platform.h��������������������������������������������������������������������������������0000644�����������������00000022472�14763166026�0010346 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_PLATFORM_H #define ISC_PLATFORM_H 1 /*! \file */ /***** ***** Platform-dependent defines. *****/ /*** *** Network. ***/ /*! \brief * Define if this system needs the <netinet/in6.h> header file included * for full IPv6 support (pretty much only UnixWare). */ #undef ISC_PLATFORM_NEEDNETINETIN6H /*! \brief * Define if this system needs the <netinet6/in6.h> header file included * to support in6_pkinfo (pretty much only BSD/OS). */ #undef ISC_PLATFORM_NEEDNETINET6IN6H /*! \brief * If sockaddrs on this system have an sa_len field, ISC_PLATFORM_HAVESALEN * will be defined. */ #undef ISC_PLATFORM_HAVESALEN /*! \brief * If this system has the IPv6 structure definitions, ISC_PLATFORM_HAVEIPV6 * will be defined. */ #define ISC_PLATFORM_HAVEIPV6 1 /*! \brief * If this system is missing in6addr_any, ISC_PLATFORM_NEEDIN6ADDRANY will * be defined. */ #undef ISC_PLATFORM_NEEDIN6ADDRANY /*! \brief * If this system is missing in6addr_loopback, ISC_PLATFORM_NEEDIN6ADDRLOOPBACK * will be defined. */ #undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK /*! \brief * If this system has in6_pktinfo, ISC_PLATFORM_HAVEIN6PKTINFO will be * defined. */ #define ISC_PLATFORM_HAVEIN6PKTINFO 1 /*! \brief * If this system has in_addr6, rather than in6_addr, ISC_PLATFORM_HAVEINADDR6 * will be defined. */ #undef ISC_PLATFORM_HAVEINADDR6 /*! \brief * If this system has sin6_scope_id, ISC_PLATFORM_HAVESCOPEID will be defined. */ #define ISC_PLATFORM_HAVESCOPEID 1 /*! \brief * If this system needs inet_ntop(), ISC_PLATFORM_NEEDNTOP will be defined. */ #undef ISC_PLATFORM_NEEDNTOP /*! \brief * If this system needs inet_pton(), ISC_PLATFORM_NEEDPTON will be defined. */ #undef ISC_PLATFORM_NEEDPTON /*! \brief * If this system needs in_port_t, ISC_PLATFORM_NEEDPORTT will be defined. */ #undef ISC_PLATFORM_NEEDPORTT /*! \brief * Define if the system has struct lifconf which is a extended struct ifconf * for IPv6. */ #undef ISC_PLATFORM_HAVELIFCONF /*! \brief * Define if the system has struct if_laddrconf which is a extended struct * ifconf for IPv6. */ #undef ISC_PLATFORM_HAVEIF_LADDRCONF /*! \brief * Define if the system has struct if_laddrreq. */ #undef ISC_PLATFORM_HAVEIF_LADDRREQ /*! \brief * Define either ISC_PLATFORM_BSD44MSGHDR or ISC_PLATFORM_BSD43MSGHDR. */ #define ISC_NET_BSD44MSGHDR 1 /*! \brief * Define if the system supports if_nametoindex. */ #define ISC_PLATFORM_HAVEIFNAMETOINDEX 1 /*! \brief * Define on some UnixWare systems to fix erroneous definitions of various * IN6_IS_ADDR_* macros. */ #undef ISC_PLATFORM_FIXIN6ISADDR /*! \brief * Define if the system has struct sockaddr_storage. */ #define ISC_PLATFORM_HAVESOCKADDRSTORAGE 1 /*! \brief * Define if the system has TCP_FASTOPEN socket option. */ #define ISC_PLATFORM_HAVETFO 1 /*! \brief * Define if the system supports kqueue multiplexing */ #undef ISC_PLATFORM_HAVEKQUEUE /*! \brief * Define if the system supports epoll multiplexing */ #define ISC_PLATFORM_HAVEEPOLL 1 /*! \brief * Define if the system supports /dev/poll multiplexing */ #undef ISC_PLATFORM_HAVEDEVPOLL /*! \brief * Define if we want to log backtrace */ #define ISC_PLATFORM_USEBACKTRACE 1 /* *** Printing. ***/ /*! \brief * If this system needs vsnprintf() and snprintf(), ISC_PLATFORM_NEEDVSNPRINTF * will be defined. */ #undef ISC_PLATFORM_NEEDVSNPRINTF /*! \brief * If this system need a modern sprintf() that returns (int) not (char*). */ #undef ISC_PLATFORM_NEEDSPRINTF /*! \brief * If this system need a modern printf() that format size %z (size_t). */ #undef ISC_PLATFORM_NEEDPRINTF /*! \brief * If this system need a modern fprintf() that format size %z (size_t). */ #undef ISC_PLATFORM_NEEDFPRINTF /*! \brief * The printf format string modifier to use with isc_uint64_t values. */ #define ISC_PLATFORM_QUADFORMAT "ll" /*** *** String functions. ***/ /* * If the system needs strsep(), ISC_PLATFORM_NEEDSTRSEP will be defined. */ #undef ISC_PLATFORM_NEEDSTRSEP /* * If the system needs strlcpy(), ISC_PLATFORM_NEEDSTRLCPY will be defined. */ #define ISC_PLATFORM_NEEDSTRLCPY 1 /* * If the system needs strlcat(), ISC_PLATFORM_NEEDSTRLCAT will be defined. */ #define ISC_PLATFORM_NEEDSTRLCAT 1 /* * Define if this system needs strtoul. */ #undef ISC_PLATFORM_NEEDSTRTOUL /* * Define if this system needs memmove. */ #undef ISC_PLATFORM_NEEDMEMMOVE /* * Define if this system needs strcasestr. */ #undef ISC_PLATFORM_NEEDSTRCASESTR /*** *** Miscellaneous. ***/ /* * Defined if we are using threads. */ #define ISC_PLATFORM_USETHREADS 1 /* * Defined if unistd.h does not cause fd_set to be delared. */ #undef ISC_PLATFORM_NEEDSYSSELECTH /* * Defined to <gssapi.h> or <gssapi/gssapi.h> for how to include * the GSSAPI header. */ #define ISC_PLATFORM_GSSAPIHEADER <gssapi/gssapi.h> /* * Defined to <gssapi_krb5.h> or <gssapi/gssapi_krb5.h> for how to * include the GSSAPI KRB5 header. */ #define ISC_PLATFORM_GSSAPI_KRB5_HEADER <gssapi/gssapi_krb5.h> /* * Defined to <krb5.h> or <krb5/krb5.h> for how to include * the KRB5 header. */ #define ISC_PLATFORM_KRB5HEADER <krb5/krb5.h> /* * Define if the system has nanosecond-level accuracy in file stats. */ #define ISC_PLATFORM_HAVESTATNSEC 1 /* * Type used for resource limits. */ #define ISC_PLATFORM_RLIMITTYPE rlim_t /* * Define if your compiler supports "long long int". */ #define ISC_PLATFORM_HAVELONGLONG 1 /* * Define if PTHREAD_ONCE_INIT should be surrounded by braces to * prevent compiler warnings (such as with gcc on Solaris 2.8). */ #undef ISC_PLATFORM_BRACEPTHREADONCEINIT /* * Used to control how extern data is linked; needed for Win32 platforms. */ #undef ISC_PLATFORM_USEDECLSPEC /* * Define if the platform has <sys/un.h>. */ #define ISC_PLATFORM_HAVESYSUNH 1 /* * If the "xadd" operation is available on this architecture, * ISC_PLATFORM_HAVEXADD will be defined. */ #define ISC_PLATFORM_HAVEXADD 1 /* * If the "xaddq" operation (64bit xadd) is available on this architecture, * ISC_PLATFORM_HAVEXADDQ will be defined. */ /* * If the 64-bit "atomic swap" operation is available on this * architecture, ISC_PLATFORM_HAVEATOMICSTOREQ" will be defined. */ #ifdef __x86_64__ #define ISC_PLATFORM_HAVEXADDQ 1 #define ISC_PLATFORM_HAVEATOMICSTOREQ 1 #else #undef ISC_PLATFORM_HAVEXADDQ #undef ISC_PLATFORM_HAVEATOMICSTOREQ #endif /* * If the 32-bit "atomic swap" operation is available on this * architecture, ISC_PLATFORM_HAVEATOMICSTORE" will be defined. */ #define ISC_PLATFORM_HAVEATOMICSTORE 1 /* * If the "compare-and-exchange" operation is available on this architecture, * ISC_PLATFORM_HAVECMPXCHG will be defined. */ #define ISC_PLATFORM_HAVECMPXCHG 1 /* * If <stdatomic.h> is available on this architecture, * ISC_PLATFORM_HAVESTDATOMIC will be defined. */ #undef ISC_PLATFORM_HAVESTDATOMIC /* * Define if gcc ASM extension is available */ #define ISC_PLATFORM_USEGCCASM 1 /* * Define if Tru64 style ASM syntax must be used. */ #undef ISC_PLATFORM_USEOSFASM /* * Define if the standard __asm function must be used. */ #undef ISC_PLATFORM_USESTDASM /* * Define with the busy wait nop asm or function call. */ #define ISC_PLATFORM_BUSYWAITNOP asm("rep; nop") /* * Define if the platform has <strings.h>. */ #define ISC_PLATFORM_HAVESTRINGSH 1 /* * Define if the hash functions must be provided by OpenSSL. */ #define ISC_PLATFORM_OPENSSLHASH 1 /* * Define if AES support is wanted */ #define ISC_PLATFORM_WANTAES 1 /* * Defines for the noreturn attribute. */ #define ISC_PLATFORM_NORETURN_PRE #define ISC_PLATFORM_NORETURN_POST __attribute__((noreturn)) /*** *** Windows dll support. ***/ /* * Define if MacOS style of PPC assembly must be used. * e.g. "r6", not "6", for register six. */ #undef ISC_PLATFORM_USEMACASM #ifndef ISC_PLATFORM_USEDECLSPEC #define LIBISC_EXTERNAL_DATA #define LIBDNS_EXTERNAL_DATA #define LIBISCCC_EXTERNAL_DATA #define LIBISCCFG_EXTERNAL_DATA #define LIBBIND9_EXTERNAL_DATA #define LIBTESTS_EXTERNAL_DATA #else /*! \brief ISC_PLATFORM_USEDECLSPEC */ #ifdef LIBISC_EXPORTS #define LIBISC_EXTERNAL_DATA __declspec(dllexport) #else #define LIBISC_EXTERNAL_DATA __declspec(dllimport) #endif #ifdef LIBDNS_EXPORTS #define LIBDNS_EXTERNAL_DATA __declspec(dllexport) #else #define LIBDNS_EXTERNAL_DATA __declspec(dllimport) #endif #ifdef LIBISCCC_EXPORTS #define LIBISCCC_EXTERNAL_DATA __declspec(dllexport) #else #define LIBISCCC_EXTERNAL_DATA __declspec(dllimport) #endif #ifdef LIBISCCFG_EXPORTS #define LIBISCCFG_EXTERNAL_DATA __declspec(dllexport) #else #define LIBISCCFG_EXTERNAL_DATA __declspec(dllimport) #endif #ifdef LIBBIND9_EXPORTS #define LIBBIND9_EXTERNAL_DATA __declspec(dllexport) #else #define LIBBIND9_EXTERNAL_DATA __declspec(dllimport) #endif #ifdef LIBTESTS_EXPORTS #define LIBTESTS_EXTERNAL_DATA __declspec(dllexport) #else #define LIBTESTS_EXTERNAL_DATA __declspec(dllimport) #endif #endif /*! \brief ISC_PLATFORM_USEDECLSPEC */ /* * Tell emacs to use C mode for this file. * * Local Variables: * mode: c * End: */ #endif /* ISC_PLATFORM_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/timer.h�����������������������������������������������������������������������������������0000644�����������������00000025046�14763166026�0007642 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_TIMER_H #define ISC_TIMER_H 1 /***** ***** Module Info *****/ /*! \file isc/timer.h * \brief Provides timers which are event sources in the task system. * * Three types of timers are supported: * *\li 'ticker' timers generate a periodic tick event. * *\li 'once' timers generate an idle timeout event if they are idle for too * long, and generate a life timeout event if their lifetime expires. * They are used to implement both (possibly expiring) idle timers and * 'one-shot' timers. * *\li 'limited' timers generate a periodic tick event until they reach * their lifetime when they generate a life timeout event. * *\li 'inactive' timers generate no events. * * Timers can change type. It is typical to create a timer as * an 'inactive' timer and then change it into a 'ticker' or * 'once' timer. * *\li MP: * The module ensures appropriate synchronization of data structures it * creates and manipulates. * Clients of this module must not be holding a timer's task's lock when * making a call that affects that timer. Failure to follow this rule * can result in deadlock. * The caller must ensure that isc_timermgr_destroy() is called only * once for a given manager. * * \li Reliability: * No anticipated impact. * * \li Resources: * TBS * * \li Security: * No anticipated impact. * * \li Standards: * None. */ /*** *** Imports ***/ #include <isc/types.h> #include <isc/event.h> #include <isc/eventclass.h> #include <isc/lang.h> #include <isc/time.h> ISC_LANG_BEGINDECLS /*** *** Types ***/ /*% Timer Type */ typedef enum { isc_timertype_undefined = -1, /*%< Undefined */ isc_timertype_ticker = 0, /*%< Ticker */ isc_timertype_once = 1, /*%< Once */ isc_timertype_limited = 2, /*%< Limited */ isc_timertype_inactive = 3 /*%< Inactive */ } isc_timertype_t; typedef struct isc_timerevent { struct isc_event common; isc_time_t due; } isc_timerevent_t; #define ISC_TIMEREVENT_FIRSTEVENT (ISC_EVENTCLASS_TIMER + 0) #define ISC_TIMEREVENT_TICK (ISC_EVENTCLASS_TIMER + 1) #define ISC_TIMEREVENT_IDLE (ISC_EVENTCLASS_TIMER + 2) #define ISC_TIMEREVENT_LIFE (ISC_EVENTCLASS_TIMER + 3) #define ISC_TIMEREVENT_LASTEVENT (ISC_EVENTCLASS_TIMER + 65535) /*% Timer and timer manager methods */ typedef struct { void (*destroy)(isc_timermgr_t **managerp); isc_result_t (*timercreate)(isc_timermgr_t *manager, isc_timertype_t type, const isc_time_t *expires, const isc_interval_t *interval, isc_task_t *task, isc_taskaction_t action, void *arg, isc_timer_t **timerp); } isc_timermgrmethods_t; typedef struct { void (*attach)(isc_timer_t *timer, isc_timer_t **timerp); void (*detach)(isc_timer_t **timerp); isc_result_t (*reset)(isc_timer_t *timer, isc_timertype_t type, const isc_time_t *expires, const isc_interval_t *interval, isc_boolean_t purge); isc_result_t (*touch)(isc_timer_t *timer); } isc_timermethods_t; /*% * This structure is actually just the common prefix of a timer manager * object implementation's version of an isc_timermgr_t. * \brief * Direct use of this structure by clients is forbidden. timer implementations * may change the structure. 'magic' must be ISCAPI_TIMERMGR_MAGIC for any * of the isc_timer_ routines to work. timer implementations must maintain * all timer invariants. */ struct isc_timermgr { unsigned int impmagic; unsigned int magic; isc_timermgrmethods_t *methods; }; #define ISCAPI_TIMERMGR_MAGIC ISC_MAGIC('A','t','m','g') #define ISCAPI_TIMERMGR_VALID(m) ((m) != NULL && \ (m)->magic == ISCAPI_TIMERMGR_MAGIC) /*% * This is the common prefix of a timer object. The same note as * that for the timermgr structure applies. */ struct isc_timer { unsigned int impmagic; unsigned int magic; isc_timermethods_t *methods; }; #define ISCAPI_TIMER_MAGIC ISC_MAGIC('A','t','m','r') #define ISCAPI_TIMER_VALID(s) ((s) != NULL && \ (s)->magic == ISCAPI_TIMER_MAGIC) /*** *** Timer and Timer Manager Functions *** *** Note: all Ensures conditions apply only if the result is success for *** those functions which return an isc_result_t. ***/ isc_result_t isc_timer_create(isc_timermgr_t *manager, isc_timertype_t type, const isc_time_t *expires, const isc_interval_t *interval, isc_task_t *task, isc_taskaction_t action, void *arg, isc_timer_t **timerp); /*%< * Create a new 'type' timer managed by 'manager'. The timers parameters * are specified by 'expires' and 'interval'. Events will be posted to * 'task' and when dispatched 'action' will be called with 'arg' as the * arg value. The new timer is returned in 'timerp'. * * Notes: * *\li For ticker timers, the timer will generate a 'tick' event every * 'interval' seconds. The value of 'expires' is ignored. * *\li For once timers, 'expires' specifies the time when a life timeout * event should be generated. If 'expires' is 0 (the epoch), then no life * timeout will be generated. 'interval' specifies how long the timer * can be idle before it generates an idle timeout. If 0, then no * idle timeout will be generated. * *\li If 'expires' is NULL, the epoch will be used. * * If 'interval' is NULL, the zero interval will be used. * * Requires: * *\li 'manager' is a valid manager * *\li 'task' is a valid task * *\li 'action' is a valid action * *\li 'expires' points to a valid time, or is NULL. * *\li 'interval' points to a valid interval, or is NULL. * *\li type == isc_timertype_inactive || * ('expires' and 'interval' are not both 0) * *\li 'timerp' is a valid pointer, and *timerp == NULL * * Ensures: * *\li '*timerp' is attached to the newly created timer * *\li The timer is attached to the task * *\li An idle timeout will not be generated until at least Now + the * timer's interval if 'timer' is a once timer with a non-zero * interval. * * Returns: * *\li Success *\li No memory *\li Unexpected error */ isc_result_t isc_timer_reset(isc_timer_t *timer, isc_timertype_t type, const isc_time_t *expires, const isc_interval_t *interval, isc_boolean_t purge); /*%< * Change the timer's type, expires, and interval values to the given * values. If 'purge' is TRUE, any pending events from this timer * are purged from its task's event queue. * * Notes: * *\li If 'expires' is NULL, the epoch will be used. * *\li If 'interval' is NULL, the zero interval will be used. * * Requires: * *\li 'timer' is a valid timer * *\li The same requirements that isc_timer_create() imposes on 'type', * 'expires' and 'interval' apply. * * Ensures: * *\li An idle timeout will not be generated until at least Now + the * timer's interval if 'timer' is a once timer with a non-zero * interval. * * Returns: * *\li Success *\li No memory *\li Unexpected error */ isc_result_t isc_timer_touch(isc_timer_t *timer); /*%< * Set the last-touched time of 'timer' to the current time. * * Requires: * *\li 'timer' is a valid once timer. * * Ensures: * *\li An idle timeout will not be generated until at least Now + the * timer's interval if 'timer' is a once timer with a non-zero * interval. * * Returns: * *\li Success *\li Unexpected error */ void isc_timer_attach(isc_timer_t *timer, isc_timer_t **timerp); /*%< * Attach *timerp to timer. * * Requires: * *\li 'timer' is a valid timer. * *\li 'timerp' points to a NULL timer. * * Ensures: * *\li *timerp is attached to timer. */ void isc_timer_detach(isc_timer_t **timerp); /*%< * Detach *timerp from its timer. * * Requires: * *\li 'timerp' points to a valid timer. * * Ensures: * *\li *timerp is NULL. * *\li If '*timerp' is the last reference to the timer, * then: * *\code * The timer will be shutdown * * The timer will detach from its task * * All resources used by the timer have been freed * * Any events already posted by the timer will be purged. * Therefore, if isc_timer_detach() is called in the context * of the timer's task, it is guaranteed that no more * timer event callbacks will run after the call. *\endcode */ isc_timertype_t isc_timer_gettype(isc_timer_t *timer); /*%< * Return the timer type. * * Requires: * *\li 'timer' to be a valid timer. */ isc_result_t isc_timermgr_createinctx(isc_mem_t *mctx, isc_appctx_t *actx, isc_timermgr_t **managerp); isc_result_t isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp); /*%< * Create a timer manager. isc_timermgr_createinctx() also associates * the new manager with the specified application context. * * Notes: * *\li All memory will be allocated in memory context 'mctx'. * * Requires: * *\li 'mctx' is a valid memory context. * *\li 'managerp' points to a NULL isc_timermgr_t. * *\li 'actx' is a valid application context (for createinctx()). * * Ensures: * *\li '*managerp' is a valid isc_timermgr_t. * * Returns: * *\li Success *\li No memory *\li Unexpected error */ void isc_timermgr_destroy(isc_timermgr_t **managerp); /*%< * Destroy a timer manager. * * Notes: * *\li This routine blocks until there are no timers left in the manager, * so if the caller holds any timer references using the manager, it * must detach them before calling isc_timermgr_destroy() or it will * block forever. * * Requires: * *\li '*managerp' is a valid isc_timermgr_t. * * Ensures: * *\li *managerp == NULL * *\li All resources used by the manager have been freed. */ void isc_timermgr_poke(isc_timermgr_t *m); /*%< * See isc_timermgr_create() above. */ typedef isc_result_t (*isc_timermgrcreatefunc_t)(isc_mem_t *mctx, isc_timermgr_t **managerp); isc_result_t isc__timer_register(void); /*%< * Register a new timer management implementation and add it to the list of * supported implementations. This function must be called when a different * event library is used than the one contained in the ISC library. */ isc_result_t isc_timer_register(isc_timermgrcreatefunc_t createfunc); /*%< * A short cut function that specifies the timer management module in the ISC * library for isc_timer_register(). An application that uses the ISC library * usually do not have to care about this function: it would call * isc_lib_register(), which internally calls this function. */ ISC_LANG_ENDDECLS #endif /* ISC_TIMER_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/portset.h���������������������������������������������������������������������������������0000644�����������������00000006331�14763166026�0010216 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! \file isc/portset.h * \brief Transport Protocol Port Manipulation Module * * This module provides simple utilities to handle a set of transport protocol * (UDP or TCP) port numbers, e.g., for creating an ACL list. An isc_portset_t * object is an opaque instance of a port set, for which the user can add or * remove a specific port or a range of consecutive ports. This object is * expected to be used as a temporary work space only, and does not protect * simultaneous access from multiple threads. Therefore it must not be stored * in a place that can be accessed from multiple threads. */ #ifndef ISC_PORTSET_H #define ISC_PORTSET_H 1 /*** *** Imports ***/ #include <isc/net.h> /*** *** Functions ***/ ISC_LANG_BEGINDECLS isc_result_t isc_portset_create(isc_mem_t *mctx, isc_portset_t **portsetp); /*%< * Create a port set and initialize it as an empty set. * * Requires: *\li 'mctx' to be valid. *\li 'portsetp' to be non NULL and '*portsetp' to be NULL; * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY */ void isc_portset_destroy(isc_mem_t *mctx, isc_portset_t **portsetp); /*%< * Destroy a port set. * * Requires: *\li 'mctx' to be valid and must be the same context given when the port set * was created. *\li '*portsetp' to be a valid set. */ isc_boolean_t isc_portset_isset(isc_portset_t *portset, in_port_t port); /*%< * Test whether the given port is stored in the portset. * * Requires: *\li 'portset' to be a valid set. * * Returns * \li #ISC_TRUE if the port is found, ISC_FALSE otherwise. */ unsigned int isc_portset_nports(isc_portset_t *portset); /*%< * Provides the number of ports stored in the given portset. * * Requires: *\li 'portset' to be a valid set. * * Returns * \li the number of ports stored in portset. */ void isc_portset_add(isc_portset_t *portset, in_port_t port); /*%< * Add the given port to the portset. The port may or may not be stored in * the portset. * * Requires: *\li 'portlist' to be valid. */ void isc_portset_remove(isc_portset_t *portset, in_port_t port); /*%< * Remove the given port to the portset. The port may or may not be stored in * the portset. * * Requires: *\li 'portlist' to be valid. */ void isc_portset_addrange(isc_portset_t *portset, in_port_t port_lo, in_port_t port_hi); /*%< * Add a subset of [port_lo, port_hi] (inclusive) to the portset. Ports in the * subset may or may not be stored in portset. * * Requires: *\li 'portlist' to be valid. *\li port_lo <= port_hi */ void isc_portset_removerange(isc_portset_t *portset, in_port_t port_lo, in_port_t port_hi); /*%< * Subtract a subset of [port_lo, port_hi] (inclusive) from the portset. Ports * in the subset may or may not be stored in portset. * * Requires: *\li 'portlist' to be valid. *\li port_lo <= port_hi */ ISC_LANG_ENDDECLS #endif /* ISC_PORTSET_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/offset.h����������������������������������������������������������������������������������0000644�����������������00000001273�14763166026�0010004 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_OFFSET_H #define ISC_OFFSET_H 1 /*! \file * \brief * File offsets are operating-system dependent. */ #include <limits.h> /* Required for CHAR_BIT. */ #include <sys/types.h> #include <stddef.h> /* For Linux Standard Base. */ typedef off_t isc_offset_t; #endif /* ISC_OFFSET_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/dir.h�������������������������������������������������������������������������������������0000644�����������������00000003732�14763166026�0007276 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_DIR_H #define ISC_DIR_H 1 /*! \file */ #include <sys/types.h> /* Required on some systems. */ #include <dirent.h> #include <isc/lang.h> #include <isc/result.h> #define ISC_DIR_NAMEMAX 256 #define ISC_DIR_PATHMAX 1024 /*% Directory Entry */ typedef struct isc_direntry { /*! * Ideally, this should be NAME_MAX, but AIX does not define it by * default and dynamically allocating the space based on pathconf() * complicates things undesirably, as does adding special conditionals * just for AIX. So a comfortably sized buffer is chosen instead. */ char name[ISC_DIR_NAMEMAX]; unsigned int length; } isc_direntry_t; /*% Directory */ typedef struct isc_dir { unsigned int magic; /*! * As with isc_direntry_t->name, making this "right" for all systems * is slightly problematic because AIX does not define PATH_MAX. */ char dirname[ISC_DIR_PATHMAX]; isc_direntry_t entry; DIR * handle; } isc_dir_t; ISC_LANG_BEGINDECLS void isc_dir_init(isc_dir_t *dir); isc_result_t isc_dir_open(isc_dir_t *dir, const char *dirname); isc_result_t isc_dir_read(isc_dir_t *dir); isc_result_t isc_dir_reset(isc_dir_t *dir); void isc_dir_close(isc_dir_t *dir); isc_result_t isc_dir_chdir(const char *dirname); isc_result_t isc_dir_chroot(const char *dirname); isc_result_t isc_dir_createunique(char *templet); /*!< * Use a templet (such as from isc_file_mktemplate()) to create a uniquely * named, empty directory. The templet string is modified in place. * If result == ISC_R_SUCCESS, it is the name of the directory that was * created. */ ISC_LANG_ENDDECLS #endif /* ISC_DIR_H */ ��������������������������������������bind9/isc/hmacmd5.h���������������������������������������������������������������������������������0000644�����������������00000003377�14763166026�0010043 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! \file isc/hmacmd5.h * \brief This is the header file for the HMAC-MD5 keyed hash algorithm * described in RFC2104. */ #ifndef ISC_HMACMD5_H #define ISC_HMACMD5_H 1 #include <pk11/site.h> #ifndef PK11_MD5_DISABLE #include <isc/lang.h> #include <isc/md5.h> #include <isc/platform.h> #include <isc/types.h> #define ISC_HMACMD5_KEYLENGTH 64 #ifdef ISC_PLATFORM_OPENSSLHASH #include <openssl/opensslv.h> #include <openssl/hmac.h> typedef struct { HMAC_CTX *ctx; #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) HMAC_CTX _ctx; #endif } isc_hmacmd5_t; #elif PKCS11CRYPTO #include <pk11/pk11.h> typedef pk11_context_t isc_hmacmd5_t; #else typedef struct { isc_md5_t md5ctx; unsigned char key[ISC_HMACMD5_KEYLENGTH]; } isc_hmacmd5_t; #endif ISC_LANG_BEGINDECLS void isc_hmacmd5_init(isc_hmacmd5_t *ctx, const unsigned char *key, unsigned int len); void isc_hmacmd5_invalidate(isc_hmacmd5_t *ctx); void isc_hmacmd5_update(isc_hmacmd5_t *ctx, const unsigned char *buf, unsigned int len); void isc_hmacmd5_sign(isc_hmacmd5_t *ctx, unsigned char *digest); isc_boolean_t isc_hmacmd5_verify(isc_hmacmd5_t *ctx, unsigned char *digest); isc_boolean_t isc_hmacmd5_verify2(isc_hmacmd5_t *ctx, unsigned char *digest, size_t len); isc_boolean_t isc_hmacmd5_check(int testing); ISC_LANG_ENDDECLS #endif /* !PK11_MD5_DISABLE */ #endif /* ISC_HMACMD5_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/string.h����������������������������������������������������������������������������������0000644�����������������00000013703�14763166026�0010025 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: string.h,v 1.23 2007/09/13 04:48:16 each Exp $ */ #ifndef ISC_STRING_H #define ISC_STRING_H 1 /*! \file isc/string.h */ #include <isc/formatcheck.h> #include <isc/int.h> #include <isc/lang.h> #include <isc/platform.h> #include <isc/types.h> #include <string.h> #ifdef ISC_PLATFORM_HAVESTRINGSH #include <strings.h> #endif #define ISC_STRING_MAGIC 0x5e ISC_LANG_BEGINDECLS isc_uint64_t isc_string_touint64(char *source, char **endp, int base); /*%< * Convert the string pointed to by 'source' to isc_uint64_t. * * On successful conversion 'endp' points to the first character * after conversion is complete. * * 'base': 0 or 2..36 * * If base is 0 the base is computed from the string type. * * On error 'endp' points to 'source'. */ isc_result_t isc_string_copy(char *target, size_t size, const char *source); /* * Copy the string pointed to by 'source' to 'target' which is a * pointer to a string of at least 'size' bytes. * * Requires: * 'target' is a pointer to a char[] of at least 'size' bytes. * 'size' an integer > 0. * 'source' == NULL or points to a NUL terminated string. * * Ensures: * If result == ISC_R_SUCCESS * 'target' will be a NUL terminated string of no more * than 'size' bytes (including NUL). * * If result == ISC_R_NOSPACE * 'target' is undefined. * * Returns: * ISC_R_SUCCESS -- 'source' was successfully copied to 'target'. * ISC_R_NOSPACE -- 'source' could not be copied since 'target' * is too small. */ void isc_string_copy_truncate(char *target, size_t size, const char *source); /* * Copy the string pointed to by 'source' to 'target' which is a * pointer to a string of at least 'size' bytes. * * Requires: * 'target' is a pointer to a char[] of at least 'size' bytes. * 'size' an integer > 0. * 'source' == NULL or points to a NUL terminated string. * * Ensures: * 'target' will be a NUL terminated string of no more * than 'size' bytes (including NUL). */ isc_result_t isc_string_append(char *target, size_t size, const char *source); /* * Append the string pointed to by 'source' to 'target' which is a * pointer to a NUL terminated string of at least 'size' bytes. * * Requires: * 'target' is a pointer to a NUL terminated char[] of at * least 'size' bytes. * 'size' an integer > 0. * 'source' == NULL or points to a NUL terminated string. * * Ensures: * If result == ISC_R_SUCCESS * 'target' will be a NUL terminated string of no more * than 'size' bytes (including NUL). * * If result == ISC_R_NOSPACE * 'target' is undefined. * * Returns: * ISC_R_SUCCESS -- 'source' was successfully appended to 'target'. * ISC_R_NOSPACE -- 'source' could not be appended since 'target' * is too small. */ void isc_string_append_truncate(char *target, size_t size, const char *source); /* * Append the string pointed to by 'source' to 'target' which is a * pointer to a NUL terminated string of at least 'size' bytes. * * Requires: * 'target' is a pointer to a NUL terminated char[] of at * least 'size' bytes. * 'size' an integer > 0. * 'source' == NULL or points to a NUL terminated string. * * Ensures: * 'target' will be a NUL terminated string of no more * than 'size' bytes (including NUL). */ isc_result_t isc_string_printf(char *target, size_t size, const char *format, ...) ISC_FORMAT_PRINTF(3, 4); /* * Print 'format' to 'target' which is a pointer to a string of at least * 'size' bytes. * * Requires: * 'target' is a pointer to a char[] of at least 'size' bytes. * 'size' an integer > 0. * 'format' == NULL or points to a NUL terminated string. * * Ensures: * If result == ISC_R_SUCCESS * 'target' will be a NUL terminated string of no more * than 'size' bytes (including NUL). * * If result == ISC_R_NOSPACE * 'target' is undefined. * * Returns: * ISC_R_SUCCESS -- 'format' was successfully printed to 'target'. * ISC_R_NOSPACE -- 'format' could not be printed to 'target' since it * is too small. */ void isc_string_printf_truncate(char *target, size_t size, const char *format, ...) ISC_FORMAT_PRINTF(3, 4); /* * Print 'format' to 'target' which is a pointer to a string of at least * 'size' bytes. * * Requires: * 'target' is a pointer to a char[] of at least 'size' bytes. * 'size' an integer > 0. * 'format' == NULL or points to a NUL terminated string. * * Ensures: * 'target' will be a NUL terminated string of no more * than 'size' bytes (including NUL). */ char * isc_string_regiondup(isc_mem_t *mctx, const isc_region_t *source); /* * Copy the region pointed to by r to a NUL terminated string * allocated from the memory context pointed to by mctx. * * The result should be deallocated using isc_mem_free() * * Requires: * 'mctx' is a point to a valid memory context. * 'source' is a pointer to a valid region. * * Returns: * a pointer to a NUL terminated string or * NULL if memory for the copy could not be allocated * */ char * isc_string_separate(char **stringp, const char *delim); #ifdef ISC_PLATFORM_NEEDSTRSEP #define strsep isc_string_separate #endif #ifdef ISC_PLATFORM_NEEDMEMMOVE #define memmove(a,b,c) bcopy(b,a,c) #endif size_t isc_string_strlcpy(char *dst, const char *src, size_t size); #ifdef ISC_PLATFORM_NEEDSTRLCPY #define strlcpy isc_string_strlcpy #endif size_t isc_string_strlcat(char *dst, const char *src, size_t size); #ifdef ISC_PLATFORM_NEEDSTRLCAT #define strlcat isc_string_strlcat #endif char * isc_string_strcasestr(const char *big, const char *little); #ifdef ISC_PLATFORM_NEEDSTRCASESTR #define strcasestr isc_string_strcasestr #endif ISC_LANG_ENDDECLS #endif /* ISC_STRING_H */ �������������������������������������������������������������bind9/isc/magic.h�����������������������������������������������������������������������������������0000644�����������������00000001741�14763166026�0007576 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_MAGIC_H #define ISC_MAGIC_H 1 #include <isc/likely.h> /*! \file isc/magic.h */ typedef struct { unsigned int magic; } isc__magic_t; /*% * To use this macro the magic number MUST be the first thing in the * structure, and MUST be of type "unsigned int". * The intent of this is to allow magic numbers to be checked even though * the object is otherwise opaque. */ #define ISC_MAGIC_VALID(a,b) (ISC_LIKELY((a) != NULL) && \ ISC_LIKELY(((const isc__magic_t *)(a))->magic == (b))) #define ISC_MAGIC(a, b, c, d) ((a) << 24 | (b) << 16 | (c) << 8 | (d)) #endif /* ISC_MAGIC_H */ �������������������������������bind9/isc/commandline.h�����������������������������������������������������������������������������0000644�����������������00000003305�14763166026�0011002 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_COMMANDLINE_H #define ISC_COMMANDLINE_H 1 /*! \file isc/commandline.h */ #include <isc/boolean.h> #include <isc/lang.h> #include <isc/platform.h> #include <isc/result.h> /*% Index into parent argv vector. */ LIBISC_EXTERNAL_DATA extern int isc_commandline_index; /*% Character checked for validity. */ LIBISC_EXTERNAL_DATA extern int isc_commandline_option; /*% Argument associated with option. */ LIBISC_EXTERNAL_DATA extern char *isc_commandline_argument; /*% For printing error messages. */ LIBISC_EXTERNAL_DATA extern char *isc_commandline_progname; /*% Print error message. */ LIBISC_EXTERNAL_DATA extern isc_boolean_t isc_commandline_errprint; /*% Reset getopt. */ LIBISC_EXTERNAL_DATA extern isc_boolean_t isc_commandline_reset; ISC_LANG_BEGINDECLS int isc_commandline_parse(int argc, char * const *argv, const char *options); /*%< * Parse a command line (similar to getopt()) */ isc_result_t isc_commandline_strtoargv(isc_mem_t *mctx, char *s, unsigned int *argcp, char ***argvp, unsigned int n); /*%< * Tokenize the string "s" into whitespace-separated words, * returning the number of words in '*argcp' and an array * of pointers to the words in '*argvp'. The caller * must free the array using isc_mem_free(). The string * is modified in-place. */ ISC_LANG_ENDDECLS #endif /* ISC_COMMANDLINE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/safe.h������������������������������������������������������������������������������������0000644�����������������00000002327�14763166026�0007435 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_SAFE_H #define ISC_SAFE_H 1 /*! \file isc/safe.h */ #include <isc/boolean.h> #include <isc/lang.h> #include <openssl/crypto.h> ISC_LANG_BEGINDECLS #define isc_safe_memequal(s1, s2, n) ISC_TF(!CRYPTO_memcmp(s1, s2, n)) /*%< * Returns ISC_TRUE iff. two blocks of memory are equal, otherwise * ISC_FALSE. * */ #define isc_safe_memwipe(ptr, len) OPENSSL_cleanse(ptr, len) /*%< * Clear the memory of length `len` pointed to by `ptr`. * * Some crypto code calls memset() on stack allocated buffers just * before return so that they are wiped. Such memset() calls can be * optimized away by the compiler. We provide this external non-inline C * function to perform the memset operation so that the compiler cannot * infer about what the function does and optimize the call away. */ ISC_LANG_ENDDECLS #endif /* ISC_SAFE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/sha1.h������������������������������������������������������������������������������������0000644�����������������00000003030�14763166026�0007343 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_SHA1_H #define ISC_SHA1_H 1 /* $NetBSD: sha1.h,v 1.2 1998/05/29 22:55:44 thorpej Exp $ */ /*! \file isc/sha1.h * \brief SHA-1 in C * \author By Steve Reid <steve@edmweb.com> * \note 100% Public Domain */ #include <isc/lang.h> #include <isc/platform.h> #include <isc/types.h> #define ISC_SHA1_DIGESTLENGTH 20U #define ISC_SHA1_BLOCK_LENGTH 64U #ifdef ISC_PLATFORM_OPENSSLHASH #include <openssl/opensslv.h> #include <openssl/evp.h> typedef struct { EVP_MD_CTX *ctx; #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) EVP_MD_CTX _ctx; #endif } isc_sha1_t; #elif PKCS11CRYPTO #include <pk11/pk11.h> typedef pk11_context_t isc_sha1_t; #else typedef struct { isc_uint32_t state[5]; isc_uint32_t count[2]; unsigned char buffer[ISC_SHA1_BLOCK_LENGTH]; } isc_sha1_t; #endif ISC_LANG_BEGINDECLS void isc_sha1_init(isc_sha1_t *ctx); void isc_sha1_invalidate(isc_sha1_t *ctx); void isc_sha1_update(isc_sha1_t *ctx, const unsigned char *data, unsigned int len); void isc_sha1_final(isc_sha1_t *ctx, unsigned char *digest); isc_boolean_t isc_sha1_check(isc_boolean_t testing); ISC_LANG_ENDDECLS #endif /* ISC_SHA1_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/netaddr.h���������������������������������������������������������������������������������0000644�����������������00000011071�14763166026�0010134 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_NETADDR_H #define ISC_NETADDR_H 1 /*! \file isc/netaddr.h */ #include <isc/lang.h> #include <isc/net.h> #include <isc/types.h> #ifdef ISC_PLATFORM_HAVESYSUNH #include <sys/types.h> #include <sys/un.h> #endif ISC_LANG_BEGINDECLS struct isc_netaddr { unsigned int family; union { struct in_addr in; struct in6_addr in6; #ifdef ISC_PLATFORM_HAVESYSUNH char un[sizeof(((struct sockaddr_un *)0)->sun_path)]; #endif } type; isc_uint32_t zone; }; isc_boolean_t isc_netaddr_equal(const isc_netaddr_t *a, const isc_netaddr_t *b); /*%< * Compare network addresses 'a' and 'b'. Return #ISC_TRUE if * they are equal, #ISC_FALSE if not. */ isc_boolean_t isc_netaddr_eqprefix(const isc_netaddr_t *a, const isc_netaddr_t *b, unsigned int prefixlen); /*%< * Compare the 'prefixlen' most significant bits of the network * addresses 'a' and 'b'. If 'b''s scope is zero then 'a''s scope is * ignored. Return #ISC_TRUE if they are equal, #ISC_FALSE if not. */ isc_result_t isc_netaddr_masktoprefixlen(const isc_netaddr_t *s, unsigned int *lenp); /*%< * Convert a netmask in 's' into a prefix length in '*lenp'. * The mask should consist of zero or more '1' bits in the * most significant part of the address, followed by '0' bits. * If this is not the case, #ISC_R_MASKNONCONTIG is returned. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_MASKNONCONTIG */ isc_result_t isc_netaddr_totext(const isc_netaddr_t *netaddr, isc_buffer_t *target); /*%< * Append a text representation of 'sockaddr' to the buffer 'target'. * The text is NOT null terminated. Handles IPv4 and IPv6 addresses. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOSPACE The text or the null termination did not fit. *\li #ISC_R_FAILURE Unspecified failure */ void isc_netaddr_format(const isc_netaddr_t *na, char *array, unsigned int size); /*%< * Format a human-readable representation of the network address '*na' * into the character array 'array', which is of size 'size'. * The resulting string is guaranteed to be null-terminated. */ #define ISC_NETADDR_FORMATSIZE \ sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:XXX.XXX.XXX.XXX%SSSSSSSSSS") /*%< * Minimum size of array to pass to isc_netaddr_format(). */ void isc_netaddr_fromsockaddr(isc_netaddr_t *netaddr, const isc_sockaddr_t *source); void isc_netaddr_fromin(isc_netaddr_t *netaddr, const struct in_addr *ina); void isc_netaddr_fromin6(isc_netaddr_t *netaddr, const struct in6_addr *ina6); isc_result_t isc_netaddr_frompath(isc_netaddr_t *netaddr, const char *path); void isc_netaddr_setzone(isc_netaddr_t *netaddr, isc_uint32_t zone); isc_uint32_t isc_netaddr_getzone(const isc_netaddr_t *netaddr); void isc_netaddr_any(isc_netaddr_t *netaddr); /*%< * Return the IPv4 wildcard address. */ void isc_netaddr_any6(isc_netaddr_t *netaddr); /*%< * Return the IPv6 wildcard address. */ isc_boolean_t isc_netaddr_ismulticast(isc_netaddr_t *na); /*%< * Returns ISC_TRUE if the address is a multicast address. */ isc_boolean_t isc_netaddr_isexperimental(isc_netaddr_t *na); /*%< * Returns ISC_TRUE if the address is a experimental (CLASS E) address. */ isc_boolean_t isc_netaddr_islinklocal(isc_netaddr_t *na); /*%< * Returns #ISC_TRUE if the address is a link local address. */ isc_boolean_t isc_netaddr_issitelocal(isc_netaddr_t *na); /*%< * Returns #ISC_TRUE if the address is a site local address. */ isc_boolean_t isc_netaddr_isnetzero(isc_netaddr_t *na); /*%< * Returns #ISC_TRUE if the address is in net zero. */ void isc_netaddr_fromv4mapped(isc_netaddr_t *t, const isc_netaddr_t *s); /*%< * Convert an IPv6 v4mapped address into an IPv4 address. */ isc_result_t isc_netaddr_prefixok(const isc_netaddr_t *na, unsigned int prefixlen); /* * Test whether the netaddr 'na' and 'prefixlen' are consistant. * e.g. prefixlen within range. * na does not have bits set which are not covered by the prefixlen. * * Returns: * ISC_R_SUCCESS * ISC_R_RANGE prefixlen out of range * ISC_R_NOTIMPLEMENTED unsupported family * ISC_R_FAILURE extra bits. */ isc_boolean_t isc_netaddr_isloopback(const isc_netaddr_t *na); /* * Test whether the netaddr 'na' is a loopback IPv4 or IPv6 address (in * 127.0.0.0/8 or ::1). */ ISC_LANG_ENDDECLS #endif /* ISC_NETADDR_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/aes.h�������������������������������������������������������������������������������������0000644�����������������00000002067�14763166026�0007270 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! \file isc/aes.h */ #ifndef ISC_AES_H #define ISC_AES_H 1 #include <isc/lang.h> #include <isc/platform.h> #include <isc/types.h> #define ISC_AES128_KEYLENGTH 16U #define ISC_AES192_KEYLENGTH 24U #define ISC_AES256_KEYLENGTH 32U #define ISC_AES_BLOCK_LENGTH 16U #ifdef ISC_PLATFORM_WANTAES ISC_LANG_BEGINDECLS void isc_aes128_crypt(const unsigned char *key, const unsigned char *in, unsigned char *out); void isc_aes192_crypt(const unsigned char *key, const unsigned char *in, unsigned char *out); void isc_aes256_crypt(const unsigned char *key, const unsigned char *in, unsigned char *out); ISC_LANG_ENDDECLS #endif /* ISC_PLATFORM_WANTAES */ #endif /* ISC_AES_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/hash.h������������������������������������������������������������������������������������0000644�����������������00000017027�14763166026�0007445 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_HASH_H #define ISC_HASH_H 1 #include <isc/deprecated.h> #include <isc/types.h> /***** ***** Module Info *****/ /*! \file isc/hash.h * * \brief The hash API * provides an unpredictable hash value for variable length data. * A hash object contains a random vector (which is hidden from clients * of this API) to make the actual hash value unpredictable. * * The algorithm used in the API guarantees the probability of hash * collision; in the current implementation, as long as the values stored * in the random vector are unpredictable, the probability of hash * collision between arbitrary two different values is at most 1/2^16. * * Although the API is generic about the hash keys, it mainly expects * DNS names (and sometimes IPv4/v6 addresses) as inputs. It has an * upper limit of the input length, and may run slow to calculate the * hash values for large inputs. * * This API is designed to be general so that it can provide multiple * different hash contexts that have different random vectors. However, * it should be typical to have a single context for an entire system. * To support such cases, the API also provides a single-context mode. * * \li MP: * The hash object is almost read-only. Once the internal random vector * is initialized, no write operation will occur, and there will be no * need to lock the object to calculate actual hash values. * * \li Reliability: * In some cases this module uses low-level data copy to initialize the * random vector. Errors in this part are likely to crash the server or * corrupt memory. * * \li Resources: * A buffer, used as a random vector for calculating hash values. * * \li Security: * This module intends to provide unpredictable hash values in * adversarial environments in order to avoid denial of service attacks * to hash buckets. * Its unpredictability relies on the quality of entropy to build the * random vector. * * \li Standards: * None. */ /*** *** Imports ***/ #include <isc/types.h> /*** *** Functions ***/ ISC_LANG_BEGINDECLS LIBISC_EXTERNAL_DATA extern isc_hash_t *isc_hashctx; isc_result_t isc_hash_ctxcreate(isc_mem_t *mctx, isc_entropy_t *entropy, size_t limit, isc_hash_t **hctx); isc_result_t isc_hash_create(isc_mem_t *mctx, isc_entropy_t *entropy, size_t limit); /*!< * \brief Create a new hash object. * * isc_hash_ctxcreate() creates a different object. * * isc_hash_create() creates a module-internal object to support the * single-context mode. It should be called only once. * * 'entropy' must be NULL or a valid entropy object. If 'entropy' is NULL, * pseudo random values will be used to build the random vector, which may * weaken security. * * 'limit' specifies the maximum number of hash keys. If it is too large, * these functions may fail. */ void isc_hash_ctxattach(isc_hash_t *hctx, isc_hash_t **hctxp) ISC_DEPRECATED; /*!< * \brief Attach to a hash object. * * This function is only necessary for the multiple-context mode. */ void isc_hash_ctxdetach(isc_hash_t **hctxp) ISC_DEPRECATED; /*!< * \brief Detach from a hash object. * * This function is for the multiple-context mode, and takes a valid * hash object as an argument. */ void isc_hash_destroy(void); /*!< * \brief This function is for the single-context mode, and is expected to be used * as a counterpart of isc_hash_create(). * * A valid module-internal hash object must have been created, and this * function should be called only once. */ /*@{*/ void isc_hash_ctxinit(isc_hash_t *hctx); void isc_hash_init(void); /*!< * \brief Initialize a hash object. * * It fills in the random vector with a proper * source of entropy, which is typically from the entropy object specified * at the creation. Thus, it is desirable to call these functions after * initializing the entropy object with some good entropy sources. * * These functions should be called before the first hash calculation. * * isc_hash_ctxinit() is for the multiple-context mode, and takes a valid hash * object as an argument. * * isc_hash_init() is for the single-context mode. A valid module-internal * hash object must have been created, and this function should be called only * once. */ /*@}*/ /*@{*/ unsigned int isc_hash_ctxcalc(isc_hash_t *hctx, const unsigned char *key, unsigned int keylen, isc_boolean_t case_sensitive) ISC_DEPRECATED; unsigned int isc_hash_calc(const unsigned char *key, unsigned int keylen, isc_boolean_t case_sensitive) ISC_DEPRECATED; /*!< * \brief Calculate a hash value. * * isc_hash_ctxinit() is for the multiple-context mode, and takes a valid hash * object as an argument. * * isc_hash_init() is for the single-context mode. A valid module-internal * hash object must have been created. * * 'key' is the hash key, which is a variable length buffer. * * 'keylen' specifies the key length, which must not be larger than the limit * specified for the corresponding hash object. * * 'case_sensitive' specifies whether the hash key should be treated as * case_sensitive values. It should typically be ISC_FALSE if the hash key * is a DNS name. */ /*@}*/ void isc__hash_setvec(const isc_uint16_t *vec) ISC_DEPRECATED; /*!< * \brief Set the contents of the random vector used in hashing. * * WARNING: This function is meant to be used only in testing code. It * must not be used anywhere in normally running code. * * The hash context must have been created beforehand, otherwise this * function is a nop. * * 'vec' is not documented here on purpose. You should know what you are * doing before using this function. */ const void * isc_hash_get_initializer(void); void isc_hash_set_initializer(const void *initializer); isc_uint32_t isc_hash_function(const void *data, size_t length, isc_boolean_t case_sensitive, const isc_uint32_t *previous_hashp); isc_uint32_t isc_hash_function_reverse(const void *data, size_t length, isc_boolean_t case_sensitive, const isc_uint32_t *previous_hashp); /*!< * \brief Calculate a hash over data. * * This hash function is useful for hashtables. The hash function is * opaque and not important to the caller. The returned hash values are * non-deterministic and will have different mapping every time a * process using this library is run, but will have uniform * distribution. * * isc_hash_function() calculates the hash from start to end over the * input data. isc_hash_function_reverse() calculates the hash from the * end to the start over the input data. The difference in order is * useful in incremental hashing; for example, a previously hashed * value for 'com' can be used as input when hashing 'example.com'. * * This is a new variant of isc_hash_calc() and will supercede * isc_hash_calc() eventually. * * 'data' is the data to be hashed. * * 'length' is the size of the data to be hashed. * * 'case_sensitive' specifies whether the hash key should be treated as * case_sensitive values. It should typically be ISC_FALSE if the hash key * is a DNS name. * * 'previous_hashp' is a pointer to a previous hash value returned by * this function. It can be used to perform incremental hashing. NULL * must be passed during first calls. */ ISC_LANG_ENDDECLS #endif /* ISC_HASH_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/tm.h��������������������������������������������������������������������������������������0000644�����������������00000001576�14763166026�0007144 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_TM_H #define ISC_TM_H 1 /*! \file isc/tm.h * Provides portable conversion routines for struct tm. */ #include <time.h> #include <isc/lang.h> #include <isc/types.h> ISC_LANG_BEGINDECLS time_t isc_tm_timegm(struct tm *tm); /* * Convert a tm structure to time_t, using UTC rather than the local * time zone. */ char * isc_tm_strptime(const char *buf, const char *fmt, struct tm *tm); /* * Parse a formatted date string into struct tm. */ ISC_LANG_ENDDECLS #endif /* ISC_TIMER_H */ ����������������������������������������������������������������������������������������������������������������������������������bind9/isc/list.h������������������������������������������������������������������������������������0000644�����������������00000013225�14763166026�0007471 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_LIST_H #define ISC_LIST_H 1 #include <isc/boolean.h> #include <isc/assertions.h> #ifdef ISC_LIST_CHECKINIT #define ISC_LINK_INSIST(x) ISC_INSIST(x) #else #define ISC_LINK_INSIST(x) #endif #define ISC_LIST(type) struct { type *head, *tail; } #define ISC_LIST_INIT(list) \ do { (list).head = NULL; (list).tail = NULL; } while (0) #define ISC_LINK(type) struct { type *prev, *next; } #define ISC_LINK_INIT_TYPE(elt, link, type) \ do { \ (elt)->link.prev = (type *)(-1); \ (elt)->link.next = (type *)(-1); \ } while (0) #define ISC_LINK_INIT(elt, link) \ ISC_LINK_INIT_TYPE(elt, link, void) #define ISC_LINK_LINKED(elt, link) ((void *)((elt)->link.prev) != (void *)(-1)) #define ISC_LIST_HEAD(list) ((list).head) #define ISC_LIST_TAIL(list) ((list).tail) #define ISC_LIST_EMPTY(list) ISC_TF((list).head == NULL) #define __ISC_LIST_PREPENDUNSAFE(list, elt, link) \ do { \ if ((list).head != NULL) \ (list).head->link.prev = (elt); \ else \ (list).tail = (elt); \ (elt)->link.prev = NULL; \ (elt)->link.next = (list).head; \ (list).head = (elt); \ } while (0) #define ISC_LIST_PREPEND(list, elt, link) \ do { \ ISC_LINK_INSIST(!ISC_LINK_LINKED(elt, link)); \ __ISC_LIST_PREPENDUNSAFE(list, elt, link); \ } while (0) #define ISC_LIST_INITANDPREPEND(list, elt, link) \ __ISC_LIST_PREPENDUNSAFE(list, elt, link) #define __ISC_LIST_APPENDUNSAFE(list, elt, link) \ do { \ if ((list).tail != NULL) \ (list).tail->link.next = (elt); \ else \ (list).head = (elt); \ (elt)->link.prev = (list).tail; \ (elt)->link.next = NULL; \ (list).tail = (elt); \ } while (0) #define ISC_LIST_APPEND(list, elt, link) \ do { \ ISC_LINK_INSIST(!ISC_LINK_LINKED(elt, link)); \ __ISC_LIST_APPENDUNSAFE(list, elt, link); \ } while (0) #define ISC_LIST_INITANDAPPEND(list, elt, link) \ __ISC_LIST_APPENDUNSAFE(list, elt, link) #define __ISC_LIST_UNLINKUNSAFE_TYPE(list, elt, link, type) \ do { \ if ((elt)->link.next != NULL) \ (elt)->link.next->link.prev = (elt)->link.prev; \ else { \ ISC_INSIST((list).tail == (elt)); \ (list).tail = (elt)->link.prev; \ } \ if ((elt)->link.prev != NULL) \ (elt)->link.prev->link.next = (elt)->link.next; \ else { \ ISC_INSIST((list).head == (elt)); \ (list).head = (elt)->link.next; \ } \ (elt)->link.prev = (type *)(-1); \ (elt)->link.next = (type *)(-1); \ ISC_INSIST((list).head != (elt)); \ ISC_INSIST((list).tail != (elt)); \ } while (0) #define __ISC_LIST_UNLINKUNSAFE(list, elt, link) \ __ISC_LIST_UNLINKUNSAFE_TYPE(list, elt, link, void) #define ISC_LIST_UNLINK_TYPE(list, elt, link, type) \ do { \ ISC_LINK_INSIST(ISC_LINK_LINKED(elt, link)); \ __ISC_LIST_UNLINKUNSAFE_TYPE(list, elt, link, type); \ } while (0) #define ISC_LIST_UNLINK(list, elt, link) \ ISC_LIST_UNLINK_TYPE(list, elt, link, void) #define ISC_LIST_PREV(elt, link) ((elt)->link.prev) #define ISC_LIST_NEXT(elt, link) ((elt)->link.next) #define __ISC_LIST_INSERTBEFOREUNSAFE(list, before, elt, link) \ do { \ if ((before)->link.prev == NULL) \ ISC_LIST_PREPEND(list, elt, link); \ else { \ (elt)->link.prev = (before)->link.prev; \ (before)->link.prev = (elt); \ (elt)->link.prev->link.next = (elt); \ (elt)->link.next = (before); \ } \ } while (0) #define ISC_LIST_INSERTBEFORE(list, before, elt, link) \ do { \ ISC_LINK_INSIST(ISC_LINK_LINKED(before, link)); \ ISC_LINK_INSIST(!ISC_LINK_LINKED(elt, link)); \ __ISC_LIST_INSERTBEFOREUNSAFE(list, before, elt, link); \ } while (0) #define __ISC_LIST_INSERTAFTERUNSAFE(list, after, elt, link) \ do { \ if ((after)->link.next == NULL) \ ISC_LIST_APPEND(list, elt, link); \ else { \ (elt)->link.next = (after)->link.next; \ (after)->link.next = (elt); \ (elt)->link.next->link.prev = (elt); \ (elt)->link.prev = (after); \ } \ } while (0) #define ISC_LIST_INSERTAFTER(list, after, elt, link) \ do { \ ISC_LINK_INSIST(ISC_LINK_LINKED(after, link)); \ ISC_LINK_INSIST(!ISC_LINK_LINKED(elt, link)); \ __ISC_LIST_INSERTAFTERUNSAFE(list, after, elt, link); \ } while (0) #define ISC_LIST_APPENDLIST(list1, list2, link) \ do { \ if (ISC_LIST_EMPTY(list1)) \ (list1) = (list2); \ else if (!ISC_LIST_EMPTY(list2)) { \ (list1).tail->link.next = (list2).head; \ (list2).head->link.prev = (list1).tail; \ (list1).tail = (list2).tail; \ } \ (list2).head = NULL; \ (list2).tail = NULL; \ } while (0) #define ISC_LIST_PREPENDLIST(list1, list2, link) \ do { \ if (ISC_LIST_EMPTY(list1)) \ (list1) = (list2); \ else if (!ISC_LIST_EMPTY(list2)) { \ (list2).tail->link.next = (list1).head; \ (list1).head->link.prev = (list2).tail; \ (list1).head = (list2).head; \ } \ (list2).head = NULL; \ (list2).tail = NULL; \ } while (0) #define ISC_LIST_ENQUEUE(list, elt, link) ISC_LIST_APPEND(list, elt, link) #define __ISC_LIST_ENQUEUEUNSAFE(list, elt, link) \ __ISC_LIST_APPENDUNSAFE(list, elt, link) #define ISC_LIST_DEQUEUE(list, elt, link) \ ISC_LIST_UNLINK_TYPE(list, elt, link, void) #define ISC_LIST_DEQUEUE_TYPE(list, elt, link, type) \ ISC_LIST_UNLINK_TYPE(list, elt, link, type) #define __ISC_LIST_DEQUEUEUNSAFE(list, elt, link) \ __ISC_LIST_UNLINKUNSAFE_TYPE(list, elt, link, void) #define __ISC_LIST_DEQUEUEUNSAFE_TYPE(list, elt, link, type) \ __ISC_LIST_UNLINKUNSAFE_TYPE(list, elt, link, type) #endif /* ISC_LIST_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/stat.h������������������������������������������������������������������������������������0000644�����������������00000001445�14763166026�0007472 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_STAT_H #define ISC_STAT_H 1 /***** ***** Module Info *****/ /* * Portable <sys/stat.h> support. * * This module is responsible for defining S_IS??? macros. * * MP: * No impact. * * Reliability: * No anticipated impact. * * Resources: * N/A. * * Security: * No anticipated impact. * */ /*** *** Imports. ***/ #include <sys/types.h> #include <sys/stat.h> #endif /* ISC_STAT_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/netscope.h��������������������������������������������������������������������������������0000644�����������������00000001663�14763166026�0010341 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_NETSCOPE_H #define ISC_NETSCOPE_H 1 /*! \file isc/netscope.h */ ISC_LANG_BEGINDECLS /*% * Convert a string of an IPv6 scope zone to zone index. If the conversion * succeeds, 'zoneid' will store the index value. * * XXXJT: when a standard interface for this purpose is defined, * we should use it. * * Returns: * \li ISC_R_SUCCESS: conversion succeeds * \li ISC_R_FAILURE: conversion fails */ isc_result_t isc_netscope_pton(int af, char *scopename, void *addr, isc_uint32_t *zoneid); ISC_LANG_ENDDECLS #endif /* ISC_NETSCOPE_H */ �����������������������������������������������������������������������������bind9/isc/syslog.h����������������������������������������������������������������������������������0000644�����������������00000001513�14763166026�0010033 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_SYSLOG_H #define ISC_SYSLOG_H 1 /*! \file */ #include <isc/lang.h> #include <isc/types.h> ISC_LANG_BEGINDECLS isc_result_t isc_syslog_facilityfromstring(const char *str, int *facilityp); /*%< * Convert 'str' to the appropriate syslog facility constant. * * Requires: * *\li 'str' is not NULL *\li 'facilityp' is not NULL * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_NOTFOUND */ ISC_LANG_ENDDECLS #endif /* ISC_SYSLOG_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/hmacsha.h���������������������������������������������������������������������������������0000644�����������������00000010676�14763166026�0010131 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! \file isc/hmacsha.h * This is the header file for the HMAC-SHA1, HMAC-SHA224, HMAC-SHA256, * HMAC-SHA334 and HMAC-SHA512 hash algorithm described in RFC 2104. */ #ifndef ISC_HMACSHA_H #define ISC_HMACSHA_H 1 #include <isc/lang.h> #include <isc/platform.h> #include <isc/sha1.h> #include <isc/sha2.h> #include <isc/types.h> #define ISC_HMACSHA1_KEYLENGTH ISC_SHA1_BLOCK_LENGTH #define ISC_HMACSHA224_KEYLENGTH ISC_SHA224_BLOCK_LENGTH #define ISC_HMACSHA256_KEYLENGTH ISC_SHA256_BLOCK_LENGTH #define ISC_HMACSHA384_KEYLENGTH ISC_SHA384_BLOCK_LENGTH #define ISC_HMACSHA512_KEYLENGTH ISC_SHA512_BLOCK_LENGTH #ifdef ISC_PLATFORM_OPENSSLHASH #include <openssl/opensslv.h> #include <openssl/hmac.h> typedef struct { HMAC_CTX *ctx; #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) HMAC_CTX _ctx; #endif } isc_hmacsha_t; typedef isc_hmacsha_t isc_hmacsha1_t; typedef isc_hmacsha_t isc_hmacsha224_t; typedef isc_hmacsha_t isc_hmacsha256_t; typedef isc_hmacsha_t isc_hmacsha384_t; typedef isc_hmacsha_t isc_hmacsha512_t; #elif PKCS11CRYPTO #include <pk11/pk11.h> typedef pk11_context_t isc_hmacsha1_t; typedef pk11_context_t isc_hmacsha224_t; typedef pk11_context_t isc_hmacsha256_t; typedef pk11_context_t isc_hmacsha384_t; typedef pk11_context_t isc_hmacsha512_t; #else typedef struct { isc_sha1_t sha1ctx; unsigned char key[ISC_HMACSHA1_KEYLENGTH]; } isc_hmacsha1_t; typedef struct { isc_sha224_t sha224ctx; unsigned char key[ISC_HMACSHA224_KEYLENGTH]; } isc_hmacsha224_t; typedef struct { isc_sha256_t sha256ctx; unsigned char key[ISC_HMACSHA256_KEYLENGTH]; } isc_hmacsha256_t; typedef struct { isc_sha384_t sha384ctx; unsigned char key[ISC_HMACSHA384_KEYLENGTH]; } isc_hmacsha384_t; typedef struct { isc_sha512_t sha512ctx; unsigned char key[ISC_HMACSHA512_KEYLENGTH]; } isc_hmacsha512_t; #endif ISC_LANG_BEGINDECLS void isc_hmacsha1_init(isc_hmacsha1_t *ctx, const unsigned char *key, unsigned int len); void isc_hmacsha1_invalidate(isc_hmacsha1_t *ctx); void isc_hmacsha1_update(isc_hmacsha1_t *ctx, const unsigned char *buf, unsigned int len); void isc_hmacsha1_sign(isc_hmacsha1_t *ctx, unsigned char *digest, size_t len); isc_boolean_t isc_hmacsha1_verify(isc_hmacsha1_t *ctx, unsigned char *digest, size_t len); isc_boolean_t isc_hmacsha1_check(int testing); void isc_hmacsha224_init(isc_hmacsha224_t *ctx, const unsigned char *key, unsigned int len); void isc_hmacsha224_invalidate(isc_hmacsha224_t *ctx); void isc_hmacsha224_update(isc_hmacsha224_t *ctx, const unsigned char *buf, unsigned int len); void isc_hmacsha224_sign(isc_hmacsha224_t *ctx, unsigned char *digest, size_t len); isc_boolean_t isc_hmacsha224_verify(isc_hmacsha224_t *ctx, unsigned char *digest, size_t len); void isc_hmacsha256_init(isc_hmacsha256_t *ctx, const unsigned char *key, unsigned int len); void isc_hmacsha256_invalidate(isc_hmacsha256_t *ctx); void isc_hmacsha256_update(isc_hmacsha256_t *ctx, const unsigned char *buf, unsigned int len); void isc_hmacsha256_sign(isc_hmacsha256_t *ctx, unsigned char *digest, size_t len); isc_boolean_t isc_hmacsha256_verify(isc_hmacsha256_t *ctx, unsigned char *digest, size_t len); void isc_hmacsha384_init(isc_hmacsha384_t *ctx, const unsigned char *key, unsigned int len); void isc_hmacsha384_invalidate(isc_hmacsha384_t *ctx); void isc_hmacsha384_update(isc_hmacsha384_t *ctx, const unsigned char *buf, unsigned int len); void isc_hmacsha384_sign(isc_hmacsha384_t *ctx, unsigned char *digest, size_t len); isc_boolean_t isc_hmacsha384_verify(isc_hmacsha384_t *ctx, unsigned char *digest, size_t len); void isc_hmacsha512_init(isc_hmacsha512_t *ctx, const unsigned char *key, unsigned int len); void isc_hmacsha512_invalidate(isc_hmacsha512_t *ctx); void isc_hmacsha512_update(isc_hmacsha512_t *ctx, const unsigned char *buf, unsigned int len); void isc_hmacsha512_sign(isc_hmacsha512_t *ctx, unsigned char *digest, size_t len); isc_boolean_t isc_hmacsha512_verify(isc_hmacsha512_t *ctx, unsigned char *digest, size_t len); ISC_LANG_ENDDECLS #endif /* ISC_HMACSHA_H */ ������������������������������������������������������������������bind9/isc/hex.h�������������������������������������������������������������������������������������0000644�����������������00000004525�14763166026�0007305 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_HEX_H #define ISC_HEX_H 1 /*! \file isc/hex.h */ #include <isc/lang.h> #include <isc/types.h> ISC_LANG_BEGINDECLS /*** *** Functions ***/ isc_result_t isc_hex_totext(isc_region_t *source, int wordlength, const char *wordbreak, isc_buffer_t *target); /*!< * \brief Convert data into hex encoded text. * * Notes: *\li The hex encoded text in 'target' will be divided into * words of at most 'wordlength' characters, separated by * the 'wordbreak' string. No parentheses will surround * the text. * * Requires: *\li 'source' is a region containing binary data *\li 'target' is a text buffer containing available space *\li 'wordbreak' points to a null-terminated string of * zero or more whitespace characters * * Ensures: *\li target will contain the hex encoded version of the data * in source. The 'used' pointer in target will be advanced as * necessary. */ isc_result_t isc_hex_decodestring(const char *cstr, isc_buffer_t *target); /*!< * \brief Decode a null-terminated hex string. * * Requires: *\li 'cstr' is non-null. *\li 'target' is a valid buffer. * * Returns: *\li #ISC_R_SUCCESS -- the entire decoded representation of 'cstring' * fit in 'target'. *\li #ISC_R_BADHEX -- 'cstr' is not a valid hex encoding. * * Other error returns are any possible error code from: * isc_lex_create(), * isc_lex_openbuffer(), * isc_hex_tobuffer(). */ isc_result_t isc_hex_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length); /*!< * \brief Convert hex encoded text from a lexer context into data. * * Requires: *\li 'lex' is a valid lexer context *\li 'target' is a buffer containing binary data *\li 'length' is an integer * * Ensures: *\li target will contain the data represented by the hex encoded * string parsed by the lexer. No more than length bytes will be read, * if length is positive. The 'used' pointer in target will be * advanced as necessary. */ ISC_LANG_ENDDECLS #endif /* ISC_HEX_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/util.h������������������������������������������������������������������������������������0000644�����������������00000016770�14763166026�0007503 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_UTIL_H #define ISC_UTIL_H 1 /*! \file isc/util.h * NOTE: * * This file is not to be included from any <isc/???.h> (or other) library * files. * * \brief * Including this file puts several macros in your name space that are * not protected (as all the other ISC functions/macros do) by prepending * ISC_ or isc_ to the name. */ /*** *** General Macros. ***/ /*% * Use this to hide unused function arguments. * \code * int * foo(char *bar) * { * UNUSED(bar); * } * \endcode */ #define UNUSED(x) (void)(x) /*% * The opposite: silent warnings about stored values which are never read. */ #define POST(x) (void)(x) #define ISC_MAX(a, b) ((a) > (b) ? (a) : (b)) #define ISC_MIN(a, b) ((a) < (b) ? (a) : (b)) #define ISC_CLAMP(v, x, y) ((v) < (x) ? (x) : ((v) > (y) ? (y) : (v))) /*% * Use this to remove the const qualifier of a variable to assign it to * a non-const variable or pass it as a non-const function argument ... * but only when you are sure it won't then be changed! * This is necessary to sometimes shut up some compilers * (as with gcc -Wcast-qual) when there is just no other good way to avoid the * situation. */ #define DE_CONST(konst, var) \ do { \ union { const void *k; void *v; } _u; \ _u.k = konst; \ var = _u.v; \ } while (0) /*% * Use this in translation units that would otherwise be empty, to * suppress compiler warnings. */ #define EMPTY_TRANSLATION_UNIT static void isc__empty(void) { isc__empty(); } /*% * We use macros instead of calling the routines directly because * the capital letters make the locking stand out. * We RUNTIME_CHECK for success since in general there's no way * for us to continue if they fail. */ #ifdef ISC_UTIL_TRACEON #define ISC_UTIL_TRACE(a) a #include <stdio.h> /* Required for fprintf/stderr when tracing. */ #include <isc/msgs.h> /* Required for isc_msgcat when tracing. */ #else #define ISC_UTIL_TRACE(a) #endif #include <isc/result.h> /* Contractual promise. */ #define LOCK(lp) do { \ ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ ISC_MSG_LOCKING, "LOCKING"), \ (lp), __FILE__, __LINE__)); \ RUNTIME_CHECK(isc_mutex_lock((lp)) == ISC_R_SUCCESS); \ ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ ISC_MSG_LOCKED, "LOCKED"), \ (lp), __FILE__, __LINE__)); \ } while (0) #define UNLOCK(lp) do { \ RUNTIME_CHECK(isc_mutex_unlock((lp)) == ISC_R_SUCCESS); \ ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ ISC_MSG_UNLOCKED, "UNLOCKED"), \ (lp), __FILE__, __LINE__)); \ } while (0) #define ISLOCKED(lp) (1) #define DESTROYLOCK(lp) \ RUNTIME_CHECK(isc_mutex_destroy((lp)) == ISC_R_SUCCESS) #define BROADCAST(cvp) do { \ ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ ISC_MSG_BROADCAST, "BROADCAST"),\ (cvp), __FILE__, __LINE__)); \ RUNTIME_CHECK(isc_condition_broadcast((cvp)) == ISC_R_SUCCESS); \ } while (0) #define SIGNAL(cvp) do { \ ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ ISC_MSG_SIGNAL, "SIGNAL"), \ (cvp), __FILE__, __LINE__)); \ RUNTIME_CHECK(isc_condition_signal((cvp)) == ISC_R_SUCCESS); \ } while (0) #define WAIT(cvp, lp) do { \ ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %p %s %d\n", \ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ ISC_MSG_UTILWAIT, "WAIT"), \ (cvp), \ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ ISC_MSG_LOCK, "LOCK"), \ (lp), __FILE__, __LINE__)); \ RUNTIME_CHECK(isc_condition_wait((cvp), (lp)) == ISC_R_SUCCESS); \ ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %p %s %d\n", \ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ ISC_MSG_WAITED, "WAITED"), \ (cvp), \ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ ISC_MSG_LOCKED, "LOCKED"), \ (lp), __FILE__, __LINE__)); \ } while (0) /* * isc_condition_waituntil can return ISC_R_TIMEDOUT, so we * don't RUNTIME_CHECK the result. * * XXX Also, can't really debug this then... */ #define WAITUNTIL(cvp, lp, tp) \ isc_condition_waituntil((cvp), (lp), (tp)) #define RWLOCK(lp, t) do { \ ISC_UTIL_TRACE(fprintf(stderr, "%s %p, %d %s %d\n", \ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ ISC_MSG_RWLOCK, "RWLOCK"), \ (lp), (t), __FILE__, __LINE__)); \ RUNTIME_CHECK(isc_rwlock_lock((lp), (t)) == ISC_R_SUCCESS); \ ISC_UTIL_TRACE(fprintf(stderr, "%s %p, %d %s %d\n", \ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ ISC_MSG_RWLOCKED, "RWLOCKED"), \ (lp), (t), __FILE__, __LINE__)); \ } while (0) #define RWUNLOCK(lp, t) do { \ ISC_UTIL_TRACE(fprintf(stderr, "%s %p, %d %s %d\n", \ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ ISC_MSG_RWUNLOCK, "RWUNLOCK"), \ (lp), (t), __FILE__, __LINE__)); \ RUNTIME_CHECK(isc_rwlock_unlock((lp), (t)) == ISC_R_SUCCESS); \ } while (0) #define DESTROYMUTEXBLOCK(bp, n) \ RUNTIME_CHECK(isc_mutexblock_destroy((bp), (n)) == ISC_R_SUCCESS) /* * List Macros. */ #include <isc/list.h> /* Contractual promise. */ #define LIST(type) ISC_LIST(type) #define INIT_LIST(type) ISC_LIST_INIT(type) #define LINK(type) ISC_LINK(type) #define INIT_LINK(elt, link) ISC_LINK_INIT(elt, link) #define HEAD(list) ISC_LIST_HEAD(list) #define TAIL(list) ISC_LIST_TAIL(list) #define EMPTY(list) ISC_LIST_EMPTY(list) #define PREV(elt, link) ISC_LIST_PREV(elt, link) #define NEXT(elt, link) ISC_LIST_NEXT(elt, link) #define APPEND(list, elt, link) ISC_LIST_APPEND(list, elt, link) #define PREPEND(list, elt, link) ISC_LIST_PREPEND(list, elt, link) #define UNLINK(list, elt, link) ISC_LIST_UNLINK(list, elt, link) #define ENQUEUE(list, elt, link) ISC_LIST_APPEND(list, elt, link) #define DEQUEUE(list, elt, link) ISC_LIST_UNLINK(list, elt, link) #define INSERTBEFORE(li, b, e, ln) ISC_LIST_INSERTBEFORE(li, b, e, ln) #define INSERTAFTER(li, a, e, ln) ISC_LIST_INSERTAFTER(li, a, e, ln) #define APPENDLIST(list1, list2, link) ISC_LIST_APPENDLIST(list1, list2, link) /*% * Performance */ #include <isc/likely.h> /* * Assertions */ #include <isc/assertions.h> /* Contractual promise. */ /*% Require Assertion */ #define REQUIRE(e) ISC_REQUIRE(e) /*% Ensure Assertion */ #define ENSURE(e) ISC_ENSURE(e) /*% Insist Assertion */ #define INSIST(e) ISC_INSIST(e) /*% Invariant Assertion */ #define INVARIANT(e) ISC_INVARIANT(e) /* * Errors */ #include <isc/error.h> /* Contractual promise. */ /*% Unexpected Error */ #define UNEXPECTED_ERROR isc_error_unexpected /*% Fatal Error */ #define FATAL_ERROR isc_error_fatal /*% Runtime Check */ #define RUNTIME_CHECK(cond) ISC_ERROR_RUNTIMECHECK(cond) /*% * Time */ #define TIME_NOW(tp) RUNTIME_CHECK(isc_time_now((tp)) == ISC_R_SUCCESS) #ifdef CLOCK_BOOTTIME #define TIME_MONOTONIC(tp) RUNTIME_CHECK(isc_time_boottime((tp)) == ISC_R_SUCCESS) #endif /*% * Misc */ #include <isc/deprecated.h> #endif /* ISC_UTIL_H */ ��������bind9/isc/mutexblock.h������������������������������������������������������������������������������0000644�����������������00000002536�14763166026�0010676 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_MUTEXBLOCK_H #define ISC_MUTEXBLOCK_H 1 /*! \file isc/mutexblock.h */ #include <isc/lang.h> #include <isc/mutex.h> #include <isc/types.h> ISC_LANG_BEGINDECLS isc_result_t isc_mutexblock_init(isc_mutex_t *block, unsigned int count); /*%< * Initialize a block of locks. If an error occurs all initialized locks * will be destroyed, if possible. * * Requires: * *\li block != NULL * *\li count > 0 * * Returns: * *\li Any code isc_mutex_init() can return is a valid return for this * function. */ isc_result_t isc_mutexblock_destroy(isc_mutex_t *block, unsigned int count); /*%< * Destroy a block of locks. * * Requires: * *\li block != NULL * *\li count > 0 * *\li Each lock in the block be initialized via isc_mutex_init() or * the whole block was initialized via isc_mutex_initblock(). * * Returns: * *\li Any code isc_mutex_init() can return is a valid return for this * function. */ ISC_LANG_ENDDECLS #endif /* ISC_MUTEXBLOCK_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/base32.h����������������������������������������������������������������������������������0000644�����������������00000007677�14763166026�0007613 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_BASE32_H #define ISC_BASE32_H 1 /*! \file */ /* * Routines for manipulating base 32 and base 32 hex encoded data. * Based on RFC 4648. * * Base 32 hex preserves the sort order of data when it is encoded / * decoded. * * Base 32 hex "np" is base 32 hex but no padding is produced or accepted. */ #include <isc/lang.h> #include <isc/types.h> ISC_LANG_BEGINDECLS /*** *** Functions ***/ isc_result_t isc_base32_totext(isc_region_t *source, int wordlength, const char *wordbreak, isc_buffer_t *target); isc_result_t isc_base32hex_totext(isc_region_t *source, int wordlength, const char *wordbreak, isc_buffer_t *target); isc_result_t isc_base32hexnp_totext(isc_region_t *source, int wordlength, const char *wordbreak, isc_buffer_t *target); /*!< * \brief Convert data into base32 encoded text. * * Notes: *\li The base32 encoded text in 'target' will be divided into * words of at most 'wordlength' characters, separated by * the 'wordbreak' string. No parentheses will surround * the text. * * Requires: *\li 'source' is a region containing binary data *\li 'target' is a text buffer containing available space *\li 'wordbreak' points to a null-terminated string of * zero or more whitespace characters * * Ensures: *\li target will contain the base32 encoded version of the data * in source. The 'used' pointer in target will be advanced as * necessary. */ isc_result_t isc_base32_decodestring(const char *cstr, isc_buffer_t *target); isc_result_t isc_base32hex_decodestring(const char *cstr, isc_buffer_t *target); isc_result_t isc_base32hexnp_decodestring(const char *cstr, isc_buffer_t *target); /*!< * \brief Decode a null-terminated string in base32, base32hex, or * base32hex non-padded. * * Requires: *\li 'cstr' is non-null. *\li 'target' is a valid buffer. * * Returns: *\li #ISC_R_SUCCESS -- the entire decoded representation of 'cstring' * fit in 'target'. *\li #ISC_R_BADBASE32 -- 'cstr' is not a valid base32 encoding. * * Other error returns are any possible error code from: *\li isc_lex_create(), *\li isc_lex_openbuffer(), *\li isc_base32_tobuffer(). */ isc_result_t isc_base32_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length); isc_result_t isc_base32hex_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length); isc_result_t isc_base32hexnp_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length); /*!< * \brief Convert text encoded in base32, base32hex, or base32hex * non-padded from a lexer context into data. * * Requires: *\li 'lex' is a valid lexer context *\li 'target' is a buffer containing binary data *\li 'length' is an integer * * Ensures: *\li target will contain the data represented by the base32 encoded * string parsed by the lexer. No more than length bytes will be read, * if length is positive. The 'used' pointer in target will be * advanced as necessary. */ isc_result_t isc_base32_decoderegion(isc_region_t *source, isc_buffer_t *target); isc_result_t isc_base32hex_decoderegion(isc_region_t *source, isc_buffer_t *target); isc_result_t isc_base32hexnp_decoderegion(isc_region_t *source, isc_buffer_t *target); /*!< * \brief Decode a packed (no white space permitted) region in * base32, base32hex or base32hex non-padded. * * Requires: *\li 'source' is a valid region. *\li 'target' is a valid buffer. * * Returns: *\li #ISC_R_SUCCESS -- the entire decoded representation of 'cstring' * fit in 'target'. *\li #ISC_R_BADBASE32 -- 'source' is not a valid base32 encoding. */ ISC_LANG_ENDDECLS #endif /* ISC_BASE32_H */ �����������������������������������������������������������������bind9/isc/symtab.h����������������������������������������������������������������������������������0000644�����������������00000010330�14763166026�0010007 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_SYMTAB_H #define ISC_SYMTAB_H 1 /***** ***** Module Info *****/ /*! \file isc/symtab.h * \brief Provides a simple memory-based symbol table. * * Keys are C strings, and key comparisons are case-insensitive. A type may * be specified when looking up, defining, or undefining. A type value of * 0 means "match any type"; any other value will only match the given * type. * * It's possible that a client will attempt to define a <key, type, value> * tuple when a tuple with the given key and type already exists in the table. * What to do in this case is specified by the client. Possible policies are: * *\li #isc_symexists_reject Disallow the define, returning #ISC_R_EXISTS *\li #isc_symexists_replace Replace the old value with the new. The * undefine action (if provided) will be called * with the old <key, type, value> tuple. *\li #isc_symexists_add Add the new tuple, leaving the old tuple in * the table. Subsequent lookups will retrieve * the most-recently-defined tuple. * * A lookup of a key using type 0 will return the most-recently defined * symbol with that key. An undefine of a key using type 0 will undefine the * most-recently defined symbol with that key. Trying to define a key with * type 0 is illegal. * * The symbol table library does not make a copy the key field, so the * caller must ensure that any key it passes to isc_symtab_define() will not * change until it calls isc_symtab_undefine() or isc_symtab_destroy(). * * A user-specified action will be called (if provided) when a symbol is * undefined. It can be used to free memory associated with keys and/or * values. * * A symbol table is implemented as a hash table of lists; the size of the * hash table is set by the 'size' parameter to isc_symtbl_create(). When * the number of entries in the symbol table reaches three quarters of this * value, the hash table is reallocated with size doubled, in order to * optimize lookup performance. This has a negative effect on insertion * performance, which can be mitigated by sizing the table appropriately * when creating it. * * \li MP: * The callers of this module must ensure any required synchronization. * * \li Reliability: * No anticipated impact. * * \li Resources: * TBS * * \li Security: * No anticipated impact. * * \li Standards: * None. */ /*** *** Imports. ***/ #include <isc/lang.h> #include <isc/types.h> /* *** Symbol Tables. ***/ /*% Symbol table value. */ typedef union isc_symvalue { void * as_pointer; const void * as_cpointer; int as_integer; unsigned int as_uinteger; } isc_symvalue_t; typedef void (*isc_symtabaction_t)(char *key, unsigned int type, isc_symvalue_t value, void *userarg); /*% Symbol table exists. */ typedef enum { isc_symexists_reject = 0, /*%< Disallow the define */ isc_symexists_replace = 1, /*%< Replace the old value with the new */ isc_symexists_add = 2 /*%< Add the new tuple */ } isc_symexists_t; ISC_LANG_BEGINDECLS /*% Create a symbol table. */ isc_result_t isc_symtab_create(isc_mem_t *mctx, unsigned int size, isc_symtabaction_t undefine_action, void *undefine_arg, isc_boolean_t case_sensitive, isc_symtab_t **symtabp); /*% Destroy a symbol table. */ void isc_symtab_destroy(isc_symtab_t **symtabp); /*% Lookup a symbol table. */ isc_result_t isc_symtab_lookup(isc_symtab_t *symtab, const char *key, unsigned int type, isc_symvalue_t *value); /*% Define a symbol table. */ isc_result_t isc_symtab_define(isc_symtab_t *symtab, const char *key, unsigned int type, isc_symvalue_t value, isc_symexists_t exists_policy); /*% Undefine a symbol table. */ isc_result_t isc_symtab_undefine(isc_symtab_t *symtab, const char *key, unsigned int type); /*% Return the number of items in a symbol table. */ unsigned int isc_symtab_count(isc_symtab_t *symtab); ISC_LANG_ENDDECLS #endif /* ISC_SYMTAB_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/error.h�����������������������������������������������������������������������������������0000644�����������������00000002625�14763166026�0007651 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_ERROR_H #define ISC_ERROR_H 1 /*! \file isc/error.h */ #include <stdarg.h> #include <isc/formatcheck.h> #include <isc/lang.h> #include <isc/likely.h> #include <isc/platform.h> ISC_LANG_BEGINDECLS typedef void (*isc_errorcallback_t)(const char *, int, const char *, va_list); /*% set unexpected error */ void isc_error_setunexpected(isc_errorcallback_t); /*% set fatal error */ void isc_error_setfatal(isc_errorcallback_t); /*% unexpected error */ void isc_error_unexpected(const char *, int, const char *, ...) ISC_FORMAT_PRINTF(3, 4); /*% fatal error */ ISC_PLATFORM_NORETURN_PRE void isc_error_fatal(const char *, int, const char *, ...) ISC_FORMAT_PRINTF(3, 4) ISC_PLATFORM_NORETURN_POST; /*% runtimecheck error */ ISC_PLATFORM_NORETURN_PRE void isc_error_runtimecheck(const char *, int, const char *) ISC_PLATFORM_NORETURN_POST; #define ISC_ERROR_RUNTIMECHECK(cond) \ ((void) (ISC_LIKELY(cond) || \ ((isc_error_runtimecheck)(__FILE__, __LINE__, #cond), 0))) ISC_LANG_ENDDECLS #endif /* ISC_ERROR_H */ �����������������������������������������������������������������������������������������������������������bind9/isc/print.h�����������������������������������������������������������������������������������0000644�����������������00000004767�14763166026�0007665 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_PRINT_H #define ISC_PRINT_H 1 /*! \file isc/print.h */ /*** *** Imports ***/ #include <isc/formatcheck.h> /* Required for ISC_FORMAT_PRINTF() macro. */ #include <isc/lang.h> #include <isc/platform.h> /*! * This block allows lib/isc/print.c to be cleanly compiled even if * the platform does not need it. The standard Makefile will still * not compile print.c or archive print.o, so this is just to make test * compilation ("make print.o") easier. */ #if !defined(ISC_PLATFORM_NEEDVSNPRINTF) && defined(ISC__PRINT_SOURCE) #define ISC_PLATFORM_NEEDVSNPRINTF #undef snprintf #undef vsnprintf #endif #if !defined(ISC_PLATFORM_NEEDSPRINTF) && defined(ISC__PRINT_SOURCE) #define ISC_PLATFORM_NEEDSPRINTF #undef sprintf #endif #if !defined(ISC_PLATFORM_NEEDFPRINTF) && defined(ISC__PRINT_SOURCE) #define ISC_PLATFORM_NEEDFPRINTF #undef fprintf #endif #if !defined(ISC_PLATFORM_NEEDPRINTF) && defined(ISC__PRINT_SOURCE) #define ISC_PLATFORM_NEEDPRINTF #undef printf #endif /*** *** Macros ***/ #define ISC_PRINT_QUADFORMAT ISC_PLATFORM_QUADFORMAT /*** *** Functions ***/ #ifdef ISC_PLATFORM_NEEDVSNPRINTF #include <stdarg.h> #include <stddef.h> #endif #include <stdio.h> ISC_LANG_BEGINDECLS #ifdef ISC_PLATFORM_NEEDVSNPRINTF int isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) ISC_FORMAT_PRINTF(3, 0); #undef vsnprintf #define vsnprintf isc_print_vsnprintf int isc_print_snprintf(char *str, size_t size, const char *format, ...) ISC_FORMAT_PRINTF(3, 4); #undef snprintf #define snprintf isc_print_snprintf #endif /* ISC_PLATFORM_NEEDVSNPRINTF */ #ifdef ISC_PLATFORM_NEEDSPRINTF int isc_print_sprintf(char *str, const char *format, ...) ISC_FORMAT_PRINTF(2, 3); #undef sprintf #define sprintf isc_print_sprintf #endif #ifdef ISC_PLATFORM_NEEDPRINTF int isc_print_printf(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); #undef printf #define printf isc_print_printf #endif #ifdef ISC_PLATFORM_NEEDFPRINTF int isc_print_fprintf(FILE * fp, const char *format, ...) ISC_FORMAT_PRINTF(2, 3); #undef fprintf #define fprintf isc_print_fprintf #endif ISC_LANG_ENDDECLS #endif /* ISC_PRINT_H */ ���������bind9/isc/ht.h��������������������������������������������������������������������������������������0000644�����������������00000006656�14763166026�0007143 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* ! \file */ #ifndef ISC_HT_H #define ISC_HT_H 1 #include <string.h> #include <isc/types.h> #include <isc/result.h> typedef struct isc_ht isc_ht_t; typedef struct isc_ht_iter isc_ht_iter_t; /*% * Initialize hashtable at *htp, using memory context and size of (1<<bits) * * Requires: *\li htp is not NULL *\li *htp is NULL *\li mctx is a valid memory context *\li bits >=1 && bits <=32 * * Returns: *\li #ISC_R_NOMEMORY -- not enough memory to create pool *\li #ISC_R_SUCCESS -- all is well. */ isc_result_t isc_ht_init(isc_ht_t **htp, isc_mem_t *mctx, isc_uint8_t bits); /*% * Destroy hashtable, freeing everything * * Requires: * \li *htp is valid hashtable */ void isc_ht_destroy(isc_ht_t **htp); /*% * Add a node to hashtable, pointed by binary key 'key' of size 'keysize'; * set its value to 'value' * * Requires: *\li ht is a valid hashtable * * Returns: *\li #ISC_R_NOMEMORY -- not enough memory to create pool *\li #ISC_R_EXISTS -- node of the same key already exists *\li #ISC_R_SUCCESS -- all is well. */ isc_result_t isc_ht_add(isc_ht_t *ht, const unsigned char *key, isc_uint32_t keysize, void *value); /*% * Find a node matching 'key'/'keysize' in hashtable 'ht'; * if found, set 'value' to its value * * Requires: * \li 'ht' is a valid hashtable * * Returns: * \li #ISC_R_SUCCESS -- success * \li #ISC_R_NOTFOUND -- key not found */ isc_result_t isc_ht_find(const isc_ht_t *ht, const unsigned char *key, isc_uint32_t keysize, void **valuep); /*% * Delete node from hashtable * Requires: *\li ht is a valid hashtable * * Returns: *\li #ISC_R_NOTFOUND -- key not found *\li #ISC_R_SUCCESS -- all is well */ isc_result_t isc_ht_delete(isc_ht_t *ht, const unsigned char *key, isc_uint32_t keysize); /*% * Create an iterator for the hashtable; point '*itp' to it. */ isc_result_t isc_ht_iter_create(isc_ht_t *ht, isc_ht_iter_t **itp); /*% * Destroy the iterator '*itp', set it to NULL */ void isc_ht_iter_destroy(isc_ht_iter_t **itp); /*% * Set an iterator to the first entry. * * Returns: * \li #ISC_R_SUCCESS -- success * \li #ISC_R_NOMORE -- no data in the hashtable */ isc_result_t isc_ht_iter_first(isc_ht_iter_t *it); /*% * Set an iterator to the next entry. * * Returns: * \li #ISC_R_SUCCESS -- success * \li #ISC_R_NOMORE -- end of hashtable reached */ isc_result_t isc_ht_iter_next(isc_ht_iter_t *it); /*% * Delete current entry and set an iterator to the next entry. * * Returns: * \li #ISC_R_SUCCESS -- success * \li #ISC_R_NOMORE -- end of hashtable reached */ isc_result_t isc_ht_iter_delcurrent_next(isc_ht_iter_t *it); /*% * Set 'value' to the current value under the iterator */ void isc_ht_iter_current(isc_ht_iter_t *it, void **valuep); /*% * Set 'key' and 'keysize to the current key and keysize for the value * under the iterator */ void isc_ht_iter_currentkey(isc_ht_iter_t *it, unsigned char **key, size_t *keysize); /*% * Returns the number of items in the hashtable. * * Requires: *\li 'ht' is a valid hashtable */ unsigned int isc_ht_count(isc_ht_t *ht); #endif ����������������������������������������������������������������������������������bind9/isc/strerror.h��������������������������������������������������������������������������������0000644�����������������00000001410�14763166026�0010371 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_STRERROR_H #define ISC_STRERROR_H /*! \file */ #include <sys/types.h> #include <isc/lang.h> ISC_LANG_BEGINDECLS /*% String Error Size */ #define ISC_STRERRORSIZE 128 /*% * Provide a thread safe wrapper to strerror(). * * Requires: * 'buf' to be non NULL. */ void isc__strerror(int num, char *buf, size_t bufsize); ISC_LANG_ENDDECLS #endif /* ISC_STRERROR_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/deprecated.h������������������������������������������������������������������������������0000644�����������������00000001156�14763166026�0010616 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_DEPRECATED_H #define ISC_DEPRECATED_H #if (__GNUC__ + 0) > 3 #define ISC_DEPRECATED __attribute__((deprecated)) #else #define ISC_DEPRECATED /* none */ #endif /* __GNUC__ > 3*/ #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/net.h�������������������������������������������������������������������������������������0000644�����������������00000024506�14763166026�0007310 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_NET_H #define ISC_NET_H 1 /***** ***** Module Info *****/ /*! \file * \brief * Basic Networking Types * * This module is responsible for defining the following basic networking * types: * *\li struct in_addr *\li struct in6_addr *\li struct in6_pktinfo *\li struct sockaddr *\li struct sockaddr_in *\li struct sockaddr_in6 *\li struct sockaddr_storage *\li in_port_t * * It ensures that the AF_ and PF_ macros are defined. * * It declares ntoh[sl]() and hton[sl](). * * It declares inet_aton(), inet_ntop(), and inet_pton(). * * It ensures that #INADDR_LOOPBACK, #INADDR_ANY, #IN6ADDR_ANY_INIT, * IN6ADDR_V4MAPPED_INIT, in6addr_any, and in6addr_loopback are available. * * It ensures that IN_MULTICAST() is available to check for multicast * addresses. * * MP: *\li No impact. * * Reliability: *\li No anticipated impact. * * Resources: *\li N/A. * * Security: *\li No anticipated impact. * * Standards: *\li BSD Socket API *\li RFC2553 */ /*** *** Imports. ***/ #include <isc/platform.h> #include <sys/types.h> #include <sys/socket.h> /* Contractual promise. */ #include <net/if.h> #include <netinet/in.h> /* Contractual promise. */ #include <arpa/inet.h> /* Contractual promise. */ #ifdef ISC_PLATFORM_NEEDNETINETIN6H #include <netinet/in6.h> /* Required on UnixWare. */ #endif #ifdef ISC_PLATFORM_NEEDNETINET6IN6H #include <netinet6/in6.h> /* Required on BSD/OS for in6_pktinfo. */ #endif #ifndef ISC_PLATFORM_HAVEIPV6 #include <isc/ipv6.h> /* Contractual promise. */ #endif #include <isc/lang.h> #include <isc/types.h> #ifdef ISC_PLATFORM_HAVEINADDR6 #define in6_addr in_addr6 /*%< Required for pre RFC2133 implementations. */ #endif #ifdef ISC_PLATFORM_HAVEIPV6 #ifndef IN6ADDR_ANY_INIT #ifdef s6_addr /*% * Required for some pre RFC2133 implementations. * IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT were added in * draft-ietf-ipngwg-bsd-api-04.txt or draft-ietf-ipngwg-bsd-api-05.txt. * If 's6_addr' is defined then assume that there is a union and three * levels otherwise assume two levels required. */ #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } #else #define IN6ADDR_ANY_INIT { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } #endif #endif #ifndef IN6ADDR_LOOPBACK_INIT #ifdef s6_addr /*% IPv6 address loopback init */ #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } #else #define IN6ADDR_LOOPBACK_INIT { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } #endif #endif #ifndef IN6ADDR_V4MAPPED_INIT #ifdef s6_addr /*% IPv6 v4mapped prefix init */ #define IN6ADDR_V4MAPPED_INIT { { { 0,0,0,0,0,0,0,0,0,0,0xff,0xff,0,0,0,0 } } } #else #define IN6ADDR_V4MAPPED_INIT { { 0,0,0,0,0,0,0,0,0,0,0xff,0xff,0,0,0,0 } } #endif #endif #ifndef IN6_IS_ADDR_V4MAPPED /*% Is IPv6 address V4 mapped? */ #define IN6_IS_ADDR_V4MAPPED(x) \ (memcmp((x)->s6_addr, in6addr_any.s6_addr, 10) == 0 && \ (x)->s6_addr[10] == 0xff && (x)->s6_addr[11] == 0xff) #endif #ifndef IN6_IS_ADDR_V4COMPAT /*% Is IPv6 address V4 compatible? */ #define IN6_IS_ADDR_V4COMPAT(x) \ (memcmp((x)->s6_addr, in6addr_any.s6_addr, 12) == 0 && \ ((x)->s6_addr[12] != 0 || (x)->s6_addr[13] != 0 || \ (x)->s6_addr[14] != 0 || \ ((x)->s6_addr[15] != 0 && (x)->s6_addr[15] != 1))) #endif #ifndef IN6_IS_ADDR_MULTICAST /*% Is IPv6 address multicast? */ #define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff) #endif #ifndef IN6_IS_ADDR_LINKLOCAL /*% Is IPv6 address linklocal? */ #define IN6_IS_ADDR_LINKLOCAL(a) \ (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80)) #endif #ifndef IN6_IS_ADDR_SITELOCAL /*% is IPv6 address sitelocal? */ #define IN6_IS_ADDR_SITELOCAL(a) \ (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0)) #endif #ifndef IN6_IS_ADDR_LOOPBACK /*% is IPv6 address loopback? */ #define IN6_IS_ADDR_LOOPBACK(x) \ (memcmp((x)->s6_addr, in6addr_loopback.s6_addr, 16) == 0) #endif #endif #ifndef AF_INET6 /*% IPv6 */ #define AF_INET6 99 #endif #ifndef PF_INET6 /*% IPv6 */ #define PF_INET6 AF_INET6 #endif #ifndef INADDR_ANY /*% inaddr any */ #define INADDR_ANY 0x00000000UL #endif #ifndef INADDR_LOOPBACK /*% inaddr loopback */ #define INADDR_LOOPBACK 0x7f000001UL #endif #ifndef ISC_PLATFORM_HAVEIN6PKTINFO /*% IPv6 packet info */ struct in6_pktinfo { struct in6_addr ipi6_addr; /*%< src/dst IPv6 address */ unsigned int ipi6_ifindex; /*%< send/recv interface index */ }; #endif #ifndef ISC_PLATFORM_HAVESOCKADDRSTORAGE #define _SS_MAXSIZE 128 #define _SS_ALIGNSIZE (sizeof (isc_uint64_t)) #ifdef ISC_PLATFORM_HAVESALEN #define _SS_PAD1SIZE (_SS_ALIGNSIZE - (2 * sizeof(isc_uint8_t))) #define _SS_PAD2SIZE (_SS_MAXSIZE - (_SS_ALIGNSIZE + _SS_PAD1SIZE \ + 2 * sizeof(isc_uint8_t))) #else #define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(isc_uint16_t)) #define _SS_PAD2SIZE (_SS_MAXSIZE - (_SS_ALIGNSIZE + _SS_PAD1SIZE \ + sizeof(isc_uint16_t))) #endif struct sockaddr_storage { #ifdef ISC_PLATFORM_HAVESALEN isc_uint8_t ss_len; isc_uint8_t ss_family; #else isc_uint16_t ss_family; #endif char __ss_pad1[_SS_PAD1SIZE]; isc_uint64_t __ss_align; /* field to force desired structure */ char __ss_pad2[_SS_PAD2SIZE]; }; #endif #if defined(ISC_PLATFORM_HAVEIPV6) && defined(ISC_PLATFORM_NEEDIN6ADDRANY) extern const struct in6_addr isc_net_in6addrany; /*% * Cope with a missing in6addr_any and in6addr_loopback. */ #define in6addr_any isc_net_in6addrany #endif #if defined(ISC_PLATFORM_HAVEIPV6) && defined(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK) extern const struct in6_addr isc_net_in6addrloop; #define in6addr_loopback isc_net_in6addrloop #endif #ifdef ISC_PLATFORM_FIXIN6ISADDR #undef IN6_IS_ADDR_GEOGRAPHIC /*! * \brief * Fix UnixWare 7.1.1's broken IN6_IS_ADDR_* definitions. */ #define IN6_IS_ADDR_GEOGRAPHIC(a) (((a)->S6_un.S6_l[0] & 0xE0) == 0x80) #undef IN6_IS_ADDR_IPX #define IN6_IS_ADDR_IPX(a) (((a)->S6_un.S6_l[0] & 0xFE) == 0x04) #undef IN6_IS_ADDR_LINKLOCAL #define IN6_IS_ADDR_LINKLOCAL(a) (((a)->S6_un.S6_l[0] & 0xC0FF) == 0x80FE) #undef IN6_IS_ADDR_MULTICAST #define IN6_IS_ADDR_MULTICAST(a) (((a)->S6_un.S6_l[0] & 0xFF) == 0xFF) #undef IN6_IS_ADDR_NSAP #define IN6_IS_ADDR_NSAP(a) (((a)->S6_un.S6_l[0] & 0xFE) == 0x02) #undef IN6_IS_ADDR_PROVIDER #define IN6_IS_ADDR_PROVIDER(a) (((a)->S6_un.S6_l[0] & 0xE0) == 0x40) #undef IN6_IS_ADDR_SITELOCAL #define IN6_IS_ADDR_SITELOCAL(a) (((a)->S6_un.S6_l[0] & 0xC0FF) == 0xC0FE) #endif /* ISC_PLATFORM_FIXIN6ISADDR */ #ifdef ISC_PLATFORM_NEEDPORTT /*% * Ensure type in_port_t is defined. */ typedef isc_uint16_t in_port_t; #endif #ifndef MSG_TRUNC /*% * If this system does not have MSG_TRUNC (as returned from recvmsg()) * ISC_PLATFORM_RECVOVERFLOW will be defined. This will enable the MSG_TRUNC * faking code in socket.c. */ #define ISC_PLATFORM_RECVOVERFLOW #endif /*% IP address. */ #define ISC__IPADDR(x) ((isc_uint32_t)htonl((isc_uint32_t)(x))) /*% Is IP address multicast? */ #define ISC_IPADDR_ISMULTICAST(i) \ (((isc_uint32_t)(i) & ISC__IPADDR(0xf0000000)) \ == ISC__IPADDR(0xe0000000)) #define ISC_IPADDR_ISEXPERIMENTAL(i) \ (((isc_uint32_t)(i) & ISC__IPADDR(0xf0000000)) \ == ISC__IPADDR(0xf0000000)) /*** *** Functions. ***/ ISC_LANG_BEGINDECLS isc_result_t isc_net_probeipv4(void); /*%< * Check if the system's kernel supports IPv4. * * Returns: * *\li #ISC_R_SUCCESS IPv4 is supported. *\li #ISC_R_NOTFOUND IPv4 is not supported. *\li #ISC_R_DISABLED IPv4 is disabled. *\li #ISC_R_UNEXPECTED */ isc_result_t isc_net_probeipv6(void); /*%< * Check if the system's kernel supports IPv6. * * Returns: * *\li #ISC_R_SUCCESS IPv6 is supported. *\li #ISC_R_NOTFOUND IPv6 is not supported. *\li #ISC_R_DISABLED IPv6 is disabled. *\li #ISC_R_UNEXPECTED */ isc_result_t isc_net_probe_ipv6only(void); /*%< * Check if the system's kernel supports the IPV6_V6ONLY socket option. * * Returns: * *\li #ISC_R_SUCCESS the option is supported for both TCP and UDP. *\li #ISC_R_NOTFOUND IPv6 itself or the option is not supported. *\li #ISC_R_UNEXPECTED */ isc_result_t isc_net_probe_ipv6pktinfo(void); /* * Check if the system's kernel supports the IPV6_(RECV)PKTINFO socket option * for UDP sockets. * * Returns: * * \li #ISC_R_SUCCESS the option is supported. * \li #ISC_R_NOTFOUND IPv6 itself or the option is not supported. * \li #ISC_R_UNEXPECTED */ void isc_net_disableipv4(void); void isc_net_disableipv6(void); void isc_net_enableipv4(void); void isc_net_enableipv6(void); isc_result_t isc_net_probeunix(void); /* * Returns whether UNIX domain sockets are supported. */ #define ISC_NET_DSCPRECVV4 0x01 /* Can receive sent DSCP value IPv4 */ #define ISC_NET_DSCPRECVV6 0x02 /* Can receive sent DSCP value IPv6 */ #define ISC_NET_DSCPSETV4 0x04 /* Can set DSCP on socket IPv4 */ #define ISC_NET_DSCPSETV6 0x08 /* Can set DSCP on socket IPv6 */ #define ISC_NET_DSCPPKTV4 0x10 /* Can set DSCP on per packet IPv4 */ #define ISC_NET_DSCPPKTV6 0x20 /* Can set DSCP on per packet IPv6 */ #define ISC_NET_DSCPALL 0x3f /* All valid flags */ unsigned int isc_net_probedscp(void); /*%< * Probe the level of DSCP support. */ isc_result_t isc_net_getudpportrange(int af, in_port_t *low, in_port_t *high); /*%< * Returns system's default range of ephemeral UDP ports, if defined. * If the range is not available or unknown, ISC_NET_PORTRANGELOW and * ISC_NET_PORTRANGEHIGH will be returned. * * Requires: * *\li 'low' and 'high' must be non NULL. * * Returns: * *\li *low and *high will be the ports specifying the low and high ends of * the range. */ #ifdef ISC_PLATFORM_NEEDNTOP const char * isc_net_ntop(int af, const void *src, char *dst, size_t size); #undef inet_ntop #define inet_ntop isc_net_ntop #endif #ifdef ISC_PLATFORM_NEEDPTON int isc_net_pton(int af, const char *src, void *dst); #undef inet_pton #define inet_pton isc_net_pton #endif int isc_net_aton(const char *cp, struct in_addr *addr); #undef inet_aton #define inet_aton isc_net_aton ISC_LANG_ENDDECLS #endif /* ISC_NET_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/backtrace.h�������������������������������������������������������������������������������0000644�����������������00000007462�14763166026�0010443 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! \file isc/backtrace.h * \brief provide a back trace of the running process to help debug problems. * * This module tries to get a back trace of the process using some platform * dependent way when available. It also manages an internal symbol table * that maps function addresses used in the process to their textual symbols. * This module is expected to be used to help debug when some fatal error * happens. * * IMPORTANT NOTE: since the (major) intended use case of this module is * dumping a back trace on a fatal error, normally followed by self termination, * functions defined in this module generally doesn't employ assertion checks * (if it did, a program bug could cause infinite recursive calls to a * backtrace function). These functions still perform minimal checks and return * ISC_R_FAILURE if they detect an error, but the caller should therefore be * very careful about the use of these functions, and generally discouraged to * use them except in an exit path. The exception is * isc_backtrace_getsymbolfromindex(), which is expected to be used in a * non-error-handling context and validates arguments with assertion checks. */ #ifndef ISC_BACKTRACE_H #define ISC_BACKTRACE_H 1 /*** *** Imports ***/ #include <isc/types.h> /*** *** Types ***/ struct isc_backtrace_symmap { void *addr; const char *symbol; }; LIBISC_EXTERNAL_DATA extern const int isc__backtrace_nsymbols; LIBISC_EXTERNAL_DATA extern const isc_backtrace_symmap_t isc__backtrace_symtable[]; /*** *** Functions ***/ ISC_LANG_BEGINDECLS isc_result_t isc_backtrace_gettrace(void **addrs, int maxaddrs, int *nframes); /*%< * Get a back trace of the running process above this function itself. On * success, addrs[i] will store the address of the call point of the i-th * stack frame (addrs[0] is the caller of this function). *nframes will store * the total number of frames. * * Requires (note that these are not ensured by assertion checks, see above): * *\li 'addrs' is a valid array containing at least 'maxaddrs' void * entries. * *\li 'nframes' must be non NULL. * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_FAILURE *\li #ISC_R_NOTFOUND *\li #ISC_R_NOTIMPLEMENTED */ isc_result_t isc_backtrace_getsymbolfromindex(int index, const void **addrp, const char **symbolp); /*%< * Returns the content of the internal symbol table of the given index. * On success, *addrsp and *symbolp point to the address and the symbol of * the 'index'th entry of the table, respectively. If 'index' is not in the * range of the symbol table, ISC_R_RANGE will be returned. * * Requires * *\li 'addrp' must be non NULL && '*addrp' == NULL. * *\li 'symbolp' must be non NULL && '*symbolp' == NULL. * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_RANGE */ isc_result_t isc_backtrace_getsymbol(const void *addr, const char **symbolp, unsigned long *offsetp); /*%< * Searches the internal symbol table for the symbol that most matches the * given 'addr'. On success, '*symbolp' will point to the name of function * to which the address 'addr' belong, and '*offsetp' will store the offset * from the function's entry address to 'addr'. * * Requires (note that these are not ensured by assertion checks, see above): * *\li 'symbolp' must be non NULL && '*symbolp' == NULL. * *\li 'offsetp' must be non NULL. * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_FAILURE *\li #ISC_R_NOTFOUND */ ISC_LANG_ENDDECLS #endif /* ISC_BACKTRACE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/crc64.h�����������������������������������������������������������������������������������0000644�����������������00000001732�14763166026�0007437 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_CRC64_H #define ISC_CRC64_H 1 /*! \file isc/crc64.h * \brief CRC64 in C */ #include <isc/lang.h> #include <isc/types.h> ISC_LANG_BEGINDECLS void isc_crc64_init(isc_uint64_t *crc); /*% * Initialize a new CRC. * * Requires: * * 'crc' is not NULL. */ void isc_crc64_update(isc_uint64_t *crc, const void *data, size_t len); /*% * Add data to the CRC. * * Requires: * * 'crc' is not NULL. * * 'data' is not NULL. */ void isc_crc64_final(isc_uint64_t *crc); /*% * Finalize the CRC. * * Requires: * * 'crc' is not NULL. */ ISC_LANG_ENDDECLS #endif /* ISC_CRC64_H */ ��������������������������������������bind9/isc/regex.h�����������������������������������������������������������������������������������0000644�����������������00000001376�14763166026�0007634 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_REGEX_H #define ISC_REGEX_H 1 /*! \file isc/regex.h */ #include <isc/types.h> #include <isc/lang.h> ISC_LANG_BEGINDECLS int isc_regex_validate(const char *expression); /*%< * Check a regular expression for syntactic correctness. * * Returns: *\li -1 on error. *\li the number of groups in the expression. */ ISC_LANG_ENDDECLS #endif /* ISC_REGEX_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/random.h����������������������������������������������������������������������������������0000644�����������������00000005772�14763166026�0010006 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: random.h,v 1.20 2009/01/17 23:47:43 tbox Exp $ */ #ifndef ISC_RANDOM_H #define ISC_RANDOM_H 1 #include <isc/lang.h> #include <isc/types.h> #include <isc/entropy.h> #include <isc/mem.h> #include <isc/mutex.h> /*! \file isc/random.h * \brief Implements a random state pool which will let the caller return a * series of possibly non-reproducible random values. * * Note that the * strength of these numbers is not all that high, and should not be * used in cryptography functions. It is useful for jittering values * a bit here and there, such as timeouts, etc. */ ISC_LANG_BEGINDECLS typedef struct isc_rng isc_rng_t; /*%< * Opaque type */ void isc_random_seed(isc_uint32_t seed); /*%< * Set the initial seed of the random state. */ void isc_random_get(isc_uint32_t *val); /*%< * Get a random value. * * Requires: * val != NULL. */ isc_uint32_t isc_random_jitter(isc_uint32_t max, isc_uint32_t jitter); /*%< * Get a random value between (max - jitter) and (max). * This is useful for jittering timer values. */ isc_result_t isc_rng_create(isc_mem_t *mctx, isc_entropy_t *entropy, isc_rng_t **rngp); /*%< * Creates and initializes a pseudo random number generator. The * returned RNG can be used to generate pseudo random numbers. * * The reference count of the returned RNG is set to 1. * * Requires: * \li mctx is a pointer to a valid memory context. * \li entropy is an optional entopy source (can be NULL) * \li rngp != NULL && *rngp == NULL is where a pointer to the RNG is * returned. * * Ensures: *\li If result is ISC_R_SUCCESS: * *rngp points to a valid RNG. * *\li If result is failure: * *rngp does not point to a valid RNG. * * Returns: *\li #ISC_R_SUCCESS Success *\li #ISC_R_NOMEMORY Resource limit: Out of Memory */ void isc_rng_attach(isc_rng_t *source, isc_rng_t **targetp); /*%< * Increments a reference count on the passed RNG. * * Requires: * \li source the RNG struct to attach to (is refcount is incremented) * \li targetp != NULL && *targetp == NULL where a pointer to the * reference incremented RNG is returned. */ void isc_rng_detach(isc_rng_t **rngp); /*%< * Decrements a reference count on the passed RNG. If the reference * count reaches 0, the RNG is destroyed. * * Requires: * \li rngp != NULL the RNG struct to decrement reference for */ isc_uint16_t isc_rng_random(isc_rng_t *rngctx); /*%< * Returns a pseudo random 16-bit unsigned integer. */ isc_uint16_t isc_rng_uniformrandom(isc_rng_t *rngctx, isc_uint16_t upper_bound); /*%< * Returns a uniformly distributed pseudo random 16-bit unsigned * integer. */ ISC_LANG_ENDDECLS #endif /* ISC_RANDOM_H */ ������bind9/isc/pool.h������������������������������������������������������������������������������������0000644�����������������00000006655�14763166026�0007500 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_OBJPOOL_H #define ISC_OBJPOOL_H 1 /***** ***** Module Info *****/ /*! \file isc/pool.h * \brief An object pool is a mechanism for sharing a small pool of * fungible objects among a large number of objects that depend on them. * * This is useful, for example, when it causes performance problems for * large number of zones to share a single memory context or task object, * but it would create a different set of problems for them each to have an * independent task or memory context. */ /*** *** Imports. ***/ #include <isc/lang.h> #include <isc/mem.h> #include <isc/types.h> ISC_LANG_BEGINDECLS /***** ***** Types. *****/ typedef void (*isc_pooldeallocator_t)(void **object); typedef isc_result_t (*isc_poolinitializer_t)(void **target, void *arg); typedef struct isc_pool isc_pool_t; /***** ***** Functions. *****/ isc_result_t isc_pool_create(isc_mem_t *mctx, unsigned int count, isc_pooldeallocator_t free, isc_poolinitializer_t init, void *initarg, isc_pool_t **poolp); /*%< * Create a pool of "count" object pointers. If 'free' is not NULL, * it points to a function that will detach the objects. 'init' * points to a function that will initialize the arguments, and * 'arg' to an argument to be passed into that function (for example, * a relevant manager or context object). * * Requires: * *\li 'mctx' is a valid memory context. * *\li init != NULL * *\li poolp != NULL && *poolp == NULL * * Ensures: * *\li On success, '*poolp' points to the new object pool. * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li #ISC_R_UNEXPECTED */ void * isc_pool_get(isc_pool_t *pool); /*%< * Returns a pointer to an object from the pool. Currently the object * is chosen from the pool at random. (This may be changed in the future * to something that guaratees balance.) */ int isc_pool_count(isc_pool_t *pool); /*%< * Returns the number of objcts in the pool 'pool'. */ isc_result_t isc_pool_expand(isc_pool_t **sourcep, unsigned int count, isc_pool_t **targetp); /*%< * If 'size' is larger than the number of objects in the pool pointed to by * 'sourcep', then a new pool of size 'count' is allocated, the existing * objects are copied into it, additional ones created to bring the * total number up to 'count', and the resulting pool is attached to * 'targetp'. * * If 'count' is less than or equal to the number of objects in 'source', then * 'sourcep' is attached to 'targetp' without any other action being taken. * * In either case, 'sourcep' is detached. * * Requires: * * \li 'sourcep' is not NULL and '*source' is not NULL * \li 'targetp' is not NULL and '*source' is NULL * * Ensures: * * \li On success, '*targetp' points to a valid task pool. * \li On success, '*sourcep' points to NULL. * * Returns: * * \li #ISC_R_SUCCESS * \li #ISC_R_NOMEMORY */ void isc_pool_destroy(isc_pool_t **poolp); /*%< * Destroy a task pool. The tasks in the pool are detached but not * shut down. * * Requires: * \li '*poolp' is a valid task pool. */ ISC_LANG_ENDDECLS #endif /* ISC_OBJPOOL_H */ �����������������������������������������������������������������������������������bind9/isc/resource.h��������������������������������������������������������������������������������0000644�����������������00000005465�14763166026�0010354 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_RESOURCE_H #define ISC_RESOURCE_H 1 /*! \file isc/resource.h */ #include <isc/lang.h> #include <isc/types.h> #define ISC_RESOURCE_UNLIMITED ((isc_resourcevalue_t)ISC_UINT64_MAX) ISC_LANG_BEGINDECLS isc_result_t isc_resource_setlimit(isc_resource_t resource, isc_resourcevalue_t value); /*%< * Set the maximum limit for a system resource. * * Notes: *\li If 'value' exceeds the maximum possible on the operating system, * it is silently limited to that maximum -- or to "infinity", if * the operating system has that concept. #ISC_RESOURCE_UNLIMITED * can be used to explicitly ask for the maximum. * * Requires: *\li 'resource' is a valid member of the isc_resource_t enumeration. * * Returns: *\li #ISC_R_SUCCESS Success. *\li #ISC_R_NOTIMPLEMENTED 'resource' is not a type known by the OS. *\li #ISC_R_NOPERM The calling process did not have adequate permission * to change the resource limit. */ isc_result_t isc_resource_getlimit(isc_resource_t resource, isc_resourcevalue_t *value); /*%< * Get the maximum limit for a system resource. * * Notes: *\li 'value' is set to the maximum limit. * *\li #ISC_RESOURCE_UNLIMITED is the maximum value of isc_resourcevalue_t. * *\li On many (all?) Unix systems, RLIM_INFINITY is a valid value that is * significantly less than #ISC_RESOURCE_UNLIMITED, but which in practice * behaves the same. * *\li The current ISC libdns configuration file parser assigns a value * of ISC_UINT32_MAX for a size_spec of "unlimited" and ISC_UNIT32_MAX - 1 * for "default", the latter of which is supposed to represent "the * limit that was in force when the server started". Since these are * valid values in the middle of the range of isc_resourcevalue_t, * there is the possibility for confusion over what exactly those * particular values are supposed to represent in a particular context -- * discrete integral values or generalized concepts. * * Requires: *\li 'resource' is a valid member of the isc_resource_t enumeration. * * Returns: *\li #ISC_R_SUCCESS Success. *\li #ISC_R_NOTIMPLEMENTED 'resource' is not a type known by the OS. */ isc_result_t isc_resource_getcurlimit(isc_resource_t resource, isc_resourcevalue_t *value); /*%< * Same as isc_resource_getlimit(), but returns the current (soft) limit. * * Returns: *\li #ISC_R_SUCCESS Success. *\li #ISC_R_NOTIMPLEMENTED 'resource' is not a type known by the OS. */ ISC_LANG_ENDDECLS #endif /* ISC_RESOURCE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/netdb.h�����������������������������������������������������������������������������������0000644�����������������00000001536�14763166026�0007614 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_NETDB_H #define ISC_NETDB_H 1 /***** ***** Module Info *****/ /*! \file * \brief * Portable netdb.h support. * * This module is responsible for defining the get<x>by<y> APIs. * * MP: *\li No impact. * * Reliability: *\li No anticipated impact. * * Resources: *\li N/A. * * Security: *\li No anticipated impact. * * Standards: *\li BSD API */ /*** *** Imports. ***/ #include <isc/net.h> #include <netdb.h> #endif /* ISC_NETDB_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/fsaccess.h��������������������������������������������������������������������������������0000644�����������������00000016375�14763166026�0010321 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_FSACCESS_H #define ISC_FSACCESS_H 1 /*! \file isc/fsaccess.h * \brief The ISC filesystem access module encapsulates the setting of file * and directory access permissions into one API that is meant to be * portable to multiple operating systems. * * The two primary operating system flavors that are initially accommodated * are POSIX and Windows NT 4.0 and later. The Windows NT access model is * considerable more flexible than POSIX's model (as much as I am loathe to * admit it), and so the ISC API has a higher degree of complexity than would * be needed to simply address POSIX's needs. * * The full breadth of NT's flexibility is not available either, for the * present time. Much of it is to provide compatibility with what Unix * programmers are expecting. This is also due to not yet really needing all * of the functionality of an NT system (or, for that matter, a POSIX system) * in BIND9, and so resolving how to handle the various incompatibilities has * been a purely theoretical exercise with no operational experience to * indicate how flawed the thinking may be. * * Some of the more notable dumbing down of NT for this API includes: * *\li Each of FILE_READ_DATA and FILE_READ_EA are set with #ISC_FSACCESS_READ. * * \li All of FILE_WRITE_DATA, FILE_WRITE_EA and FILE_APPEND_DATA are * set with #ISC_FSACCESS_WRITE. FILE_WRITE_ATTRIBUTES is not set * so as to be consistent with Unix, where only the owner of the file * or the superuser can change the attributes/mode of a file. * * \li Both of FILE_ADD_FILE and FILE_ADD_SUBDIRECTORY are set with * #ISC_FSACCESS_CREATECHILD. This is similar to setting the WRITE * permission on a Unix directory. * * \li SYNCHRONIZE is always set for files and directories, unless someone * can give me a reason why this is a bad idea. * * \li READ_CONTROL and FILE_READ_ATTRIBUTES are always set; this is * consistent with Unix, where any file or directory can be stat()'d * unless the directory path disallows complete access somewhere along * the way. * * \li WRITE_DAC is only set for the owner. This too is consistent with * Unix, and is tighter security than allowing anyone else to be * able to set permissions. * * \li DELETE is only set for the owner. On Unix the ability to delete * a file is controlled by the directory permissions, but it isn't * currently clear to me what happens on NT if the directory has * FILE_DELETE_CHILD set but a file within it does not have DELETE * set. Always setting DELETE on the file/directory for the owner * gives maximum flexibility to the owner without exposing the * file to deletion by others. * * \li WRITE_OWNER is never set. This too is consistent with Unix, * and is also tighter security than allowing anyone to change the * ownership of the file apart from the superu..ahem, Administrator. * * \li Inheritance is set to NO_INHERITANCE. * * Unix's dumbing down includes: * * \li The sticky bit cannot be set. * * \li setuid and setgid cannot be set. * * \li Only regular files and directories can be set. * * The rest of this comment discusses a few of the incompatibilities * between the two systems that need more thought if this API is to * be extended to accommodate them. * * The Windows standard access right "DELETE" doesn't have a direct * equivalent in the Unix world, so it isn't clear what should be done * with it. * * The Unix sticky bit is not supported. While NT does have a concept * of allowing users to create files in a directory but not delete or * rename them, it does not have a concept of allowing them to be deleted * if they are owned by the user trying to delete/rename. While it is * probable that something could be cobbled together in NT 5 with inheritance, * it can't really be done in NT 4 as a single property that you could * set on a directory. You'd need to coordinate something with file creation * so that every file created had DELETE set for the owner but noone else. * * On Unix systems, setting #ISC_FSACCESS_LISTDIRECTORY sets READ. * ... setting either #ISC_FSACCESS_CREATECHILD or #ISC_FSACCESS_DELETECHILD * sets WRITE. * ... setting #ISC_FSACCESS_ACCESSCHILD sets EXECUTE. * * On NT systems, setting #ISC_FSACCESS_LISTDIRECTORY sets FILE_LIST_DIRECTORY. * ... setting #ISC_FSACCESS_CREATECHILD sets FILE_CREATE_CHILD independently. * ... setting #ISC_FSACCESS_DELETECHILD sets FILE_DELETE_CHILD independently. * ... setting #ISC_FSACCESS_ACCESSCHILD sets FILE_TRAVERSE. * * Unresolved: XXXDCL * \li What NT access right controls the ability to rename a file? * \li How does DELETE work? If a directory has FILE_DELETE_CHILD but a * file or directory within it does not have DELETE, is that file * or directory deletable? * \li To implement isc_fsaccess_get(), mapping an existing Unix permission * mode_t back to an isc_fsaccess_t is pretty trivial; however, mapping * an NT DACL could be impossible to do in a responsible way. * \li Similarly, trying to implement the functionality of being able to * say "add group writability to whatever permissions already exist" * could be tricky on NT because of the order-of-entry issue combined * with possibly having one or more matching ACEs already explicitly * granting or denying access. Because this functionality is * not yet needed by the ISC, no code has been written to try to * solve this problem. */ #include <isc/lang.h> #include <isc/types.h> /* * Trustees. */ #define ISC_FSACCESS_OWNER 0x1 /*%< User account. */ #define ISC_FSACCESS_GROUP 0x2 /*%< Primary group owner. */ #define ISC_FSACCESS_OTHER 0x4 /*%< Not the owner or the group owner. */ #define ISC_FSACCESS_WORLD 0x7 /*%< User, Group, Other. */ /* * Types of permission. */ #define ISC_FSACCESS_READ 0x00000001 /*%< File only. */ #define ISC_FSACCESS_WRITE 0x00000002 /*%< File only. */ #define ISC_FSACCESS_EXECUTE 0x00000004 /*%< File only. */ #define ISC_FSACCESS_CREATECHILD 0x00000008 /*%< Dir only. */ #define ISC_FSACCESS_DELETECHILD 0x00000010 /*%< Dir only. */ #define ISC_FSACCESS_LISTDIRECTORY 0x00000020 /*%< Dir only. */ #define ISC_FSACCESS_ACCESSCHILD 0x00000040 /*%< Dir only. */ /*% * Adding any permission bits beyond 0x200 would mean typedef'ing * isc_fsaccess_t as isc_uint64_t, and redefining this value to * reflect the new range of permission types, Probably to 21 for * maximum flexibility. The number of bits has to accommodate all of * the permission types, and three full sets of them have to fit * within an isc_fsaccess_t. */ #define ISC__FSACCESS_PERMISSIONBITS 10 ISC_LANG_BEGINDECLS void isc_fsaccess_add(int trustee, int permission, isc_fsaccess_t *access); void isc_fsaccess_remove(int trustee, int permission, isc_fsaccess_t *access); isc_result_t isc_fsaccess_set(const char *path, isc_fsaccess_t access); ISC_LANG_ENDDECLS #endif /* ISC_FSACCESS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/bind9.h�����������������������������������������������������������������������������������0000644�����������������00000001521�14763166026�0007517 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_BIND9_H #define ISC_BIND9_H 1 #include <isc/boolean.h> #include <isc/platform.h> /* * This determines whether we are using the libisc/libdns libraries * in BIND9 or in some other application. For BIND9 (named and related * tools) it must be set to ISC_TRUE at runtime. Export library clients * will call isc_lib_register(), which will set it to ISC_FALSE. */ LIBISC_EXTERNAL_DATA extern isc_boolean_t isc_bind9; #endif /* ISC_BIND9_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/event.h�����������������������������������������������������������������������������������0000644�����������������00000005754�14763166026�0007647 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_EVENT_H #define ISC_EVENT_H 1 /*! \file isc/event.h */ #include <isc/lang.h> #include <isc/types.h> /***** ***** Events. *****/ typedef void (*isc_eventdestructor_t)(isc_event_t *); #define ISC_EVENT_COMMON(ltype) \ size_t ev_size; \ unsigned int ev_attributes; \ void * ev_tag; \ isc_eventtype_t ev_type; \ isc_taskaction_t ev_action; \ void * ev_arg; \ void * ev_sender; \ isc_eventdestructor_t ev_destroy; \ void * ev_destroy_arg; \ ISC_LINK(ltype) ev_link; \ ISC_LINK(ltype) ev_ratelink /*% * Attributes matching a mask of 0x000000ff are reserved for the task library's * definition. Attributes of 0xffffff00 may be used by the application * or non-ISC libraries. */ #define ISC_EVENTATTR_NOPURGE 0x00000001 /*% * The ISC_EVENTATTR_CANCELED attribute is intended to indicate * that an event is delivered as a result of a canceled operation * rather than successful completion, by mutual agreement * between the sender and receiver. It is not set or used by * the task system. */ #define ISC_EVENTATTR_CANCELED 0x00000002 #define ISC_EVENT_INIT(event, sz, at, ta, ty, ac, ar, sn, df, da) \ do { \ (event)->ev_size = (sz); \ (event)->ev_attributes = (at); \ (event)->ev_tag = (ta); \ (event)->ev_type = (ty); \ (event)->ev_action = (ac); \ (event)->ev_arg = (ar); \ (event)->ev_sender = (sn); \ (event)->ev_destroy = (df); \ (event)->ev_destroy_arg = (da); \ ISC_LINK_INIT((event), ev_link); \ ISC_LINK_INIT((event), ev_ratelink); \ } while (0) /*% * This structure is public because "subclassing" it may be useful when * defining new event types. */ struct isc_event { ISC_EVENT_COMMON(struct isc_event); }; #define ISC_EVENTTYPE_FIRSTEVENT 0x00000000 #define ISC_EVENTTYPE_LASTEVENT 0xffffffff #define ISC_EVENT_PTR(p) ((isc_event_t **)(void *)(p)) ISC_LANG_BEGINDECLS isc_event_t * isc_event_allocate(isc_mem_t *mctx, void *sender, isc_eventtype_t type, isc_taskaction_t action, void *arg, size_t size); isc_event_t * isc_event_constallocate(isc_mem_t *mctx, void *sender, isc_eventtype_t type, isc_taskaction_t action, const void *arg, size_t size); /*%< * Allocate an event structure. * * Allocate and initialize in a structure with initial elements * defined by: * * \code * struct { * ISC_EVENT_COMMON(struct isc_event); * ... * }; * \endcode * * Requires: *\li 'size' >= sizeof(struct isc_event) *\li 'action' to be non NULL * * Returns: *\li a pointer to a initialized structure of the requested size. *\li NULL if unable to allocate memory. */ void isc_event_free(isc_event_t **); ISC_LANG_ENDDECLS #endif /* ISC_EVENT_H */ ��������������������bind9/isc/json.h������������������������������������������������������������������������������������0000644�����������������00000002662�14763166026�0007472 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_JSON_H #define ISC_JSON_H 1 #ifdef HAVE_JSON /* * This file is here mostly to make it easy to add additional libjson header * files as needed across all the users of this file. Rather than place * these libjson includes in each file, one include makes it easy to handle * the ifdef as well as adding the ability to add additional functions * which may be useful. */ #ifdef HAVE_JSON_C /* * We don't include <json-c/json.h> as the subsequent includes do not * prefix the header file names with "json-c/" and using * -I <prefix>/include/json-c results in too many filename collisions. */ #include <json-c/linkhash.h> #include <json-c/json_util.h> #include <json-c/json_object.h> #include <json-c/json_tokener.h> #include <json-c/json_object_iterator.h> #include <json-c/json_c_version.h> #else #include <json/json.h> #endif #endif #define ISC_JSON_RENDERCONFIG 0x00000001 /* render config data */ #define ISC_JSON_RENDERSTATS 0x00000002 /* render stats */ #define ISC_JSON_RENDERALL 0x000000ff /* render everything */ #endif /* ISC_JSON_H */ ������������������������������������������������������������������������������bind9/isc/socket.h����������������������������������������������������������������������������������0000644�����������������00000107474�14763166026�0010020 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id$ */ #ifndef ISC_SOCKET_H #define ISC_SOCKET_H 1 /***** ***** Module Info *****/ /*! \file isc/socket.h * \brief Provides TCP and UDP sockets for network I/O. The sockets are event * sources in the task system. * * When I/O completes, a completion event for the socket is posted to the * event queue of the task which requested the I/O. * * \li MP: * The module ensures appropriate synchronization of data structures it * creates and manipulates. * Clients of this module must not be holding a socket's task's lock when * making a call that affects that socket. Failure to follow this rule * can result in deadlock. * The caller must ensure that isc_socketmgr_destroy() is called only * once for a given manager. * * \li Reliability: * No anticipated impact. * * \li Resources: * TBS * * \li Security: * No anticipated impact. * * \li Standards: * None. */ /*** *** Imports ***/ #include <isc/event.h> #include <isc/eventclass.h> #include <isc/lang.h> #include <isc/json.h> #include <isc/region.h> #include <isc/sockaddr.h> #include <isc/time.h> #include <isc/types.h> #include <isc/xml.h> #ifdef WIN32 /* from the old namespace.h */ #define isc_socket_create isc__socket_create #define isc_socket_dup isc__socket_dup #define isc_socket_attach isc__socket_attach #define isc_socket_detach isc__socket_detach #define isc_socketmgr_create isc__socketmgr_create #define isc_socketmgr_create2 isc__socketmgr_create2 #define isc_socketmgr_destroy isc__socketmgr_destroy #define isc_socket_open isc__socket_open #define isc_socket_close isc__socket_close #define isc_socket_recvv isc__socket_recvv #define isc_socket_recv isc__socket_recv #define isc_socket_recv2 isc__socket_recv2 #define isc_socket_send isc__socket_send #define isc_socket_sendto isc__socket_sendto #define isc_socket_sendv isc__socket_sendv #define isc_socket_sendtov isc__socket_sendtov #define isc_socket_sendtov2 isc__socket_sendtov2 #define isc_socket_sendto2 isc__socket_sendto2 #define isc_socket_cleanunix isc__socket_cleanunix #define isc_socket_permunix isc__socket_permunix #define isc_socket_bind isc__socket_bind #define isc_socket_filter isc__socket_filter #define isc_socket_listen isc__socket_listen #define isc_socket_accept isc__socket_accept #define isc_socket_connect isc__socket_connect #define isc_socket_getfd isc__socket_getfd #define isc_socket_getname isc__socket_getname #define isc_socket_gettag isc__socket_gettag #define isc_socket_getpeername isc__socket_getpeername #define isc_socket_getsockname isc__socket_getsockname #define isc_socket_cancel isc__socket_cancel #define isc_socket_gettype isc__socket_gettype #define isc_socket_isbound isc__socket_isbound #define isc_socket_ipv6only isc__socket_ipv6only #define isc_socket_setname isc__socket_setname #define isc_socketmgr_getmaxsockets isc__socketmgr_getmaxsockets #define isc_socketmgr_setstats isc__socketmgr_setstats #define isc_socketmgr_setreserved isc__socketmgr_setreserved #define isc__socketmgr_maxudp isc___socketmgr_maxudp #define isc_socket_fdwatchcreate isc__socket_fdwatchcreate #define isc_socket_fdwatchpoke isc__socket_fdwatchpoke #define isc_socket_dscp isc__socket_dscp #endif ISC_LANG_BEGINDECLS /*** *** Constants ***/ /*% * Maximum number of buffers in a scatter/gather read/write. The operating * system in use must support at least this number (plus one on some.) */ #define ISC_SOCKET_MAXSCATTERGATHER 8 /*% * In isc_socket_bind() set socket option SO_REUSEADDR prior to calling * bind() if a non zero port is specified (AF_INET and AF_INET6). */ #define ISC_SOCKET_REUSEADDRESS 0x01U /*% * Statistics counters. Used as isc_statscounter_t values. */ enum { isc_sockstatscounter_udp4open = 0, isc_sockstatscounter_udp6open = 1, isc_sockstatscounter_tcp4open = 2, isc_sockstatscounter_tcp6open = 3, isc_sockstatscounter_unixopen = 4, isc_sockstatscounter_udp4openfail = 5, isc_sockstatscounter_udp6openfail = 6, isc_sockstatscounter_tcp4openfail = 7, isc_sockstatscounter_tcp6openfail = 8, isc_sockstatscounter_unixopenfail = 9, isc_sockstatscounter_udp4close = 10, isc_sockstatscounter_udp6close = 11, isc_sockstatscounter_tcp4close = 12, isc_sockstatscounter_tcp6close = 13, isc_sockstatscounter_unixclose = 14, isc_sockstatscounter_fdwatchclose = 15, isc_sockstatscounter_udp4bindfail = 16, isc_sockstatscounter_udp6bindfail = 17, isc_sockstatscounter_tcp4bindfail = 18, isc_sockstatscounter_tcp6bindfail = 19, isc_sockstatscounter_unixbindfail = 20, isc_sockstatscounter_fdwatchbindfail = 21, isc_sockstatscounter_udp4connect = 22, isc_sockstatscounter_udp6connect = 23, isc_sockstatscounter_tcp4connect = 24, isc_sockstatscounter_tcp6connect = 25, isc_sockstatscounter_unixconnect = 26, isc_sockstatscounter_fdwatchconnect = 27, isc_sockstatscounter_udp4connectfail = 28, isc_sockstatscounter_udp6connectfail = 29, isc_sockstatscounter_tcp4connectfail = 30, isc_sockstatscounter_tcp6connectfail = 31, isc_sockstatscounter_unixconnectfail = 32, isc_sockstatscounter_fdwatchconnectfail = 33, isc_sockstatscounter_tcp4accept = 34, isc_sockstatscounter_tcp6accept = 35, isc_sockstatscounter_unixaccept = 36, isc_sockstatscounter_tcp4acceptfail = 37, isc_sockstatscounter_tcp6acceptfail = 38, isc_sockstatscounter_unixacceptfail = 39, isc_sockstatscounter_udp4sendfail = 40, isc_sockstatscounter_udp6sendfail = 41, isc_sockstatscounter_tcp4sendfail = 42, isc_sockstatscounter_tcp6sendfail = 43, isc_sockstatscounter_unixsendfail = 44, isc_sockstatscounter_fdwatchsendfail = 45, isc_sockstatscounter_udp4recvfail = 46, isc_sockstatscounter_udp6recvfail = 47, isc_sockstatscounter_tcp4recvfail = 48, isc_sockstatscounter_tcp6recvfail = 49, isc_sockstatscounter_unixrecvfail = 50, isc_sockstatscounter_fdwatchrecvfail = 51, isc_sockstatscounter_udp4active = 52, isc_sockstatscounter_udp6active = 53, isc_sockstatscounter_tcp4active = 54, isc_sockstatscounter_tcp6active = 55, isc_sockstatscounter_unixactive = 56, isc_sockstatscounter_rawopen = 57, isc_sockstatscounter_rawopenfail = 58, isc_sockstatscounter_rawclose = 59, isc_sockstatscounter_rawrecvfail = 60, isc_sockstatscounter_rawactive = 61, isc_sockstatscounter_max = 62 }; /*** *** Types ***/ struct isc_socketevent { ISC_EVENT_COMMON(isc_socketevent_t); isc_result_t result; /*%< OK, EOF, whatever else */ unsigned int minimum; /*%< minimum i/o for event */ unsigned int n; /*%< bytes read or written */ unsigned int offset; /*%< offset into buffer list */ isc_region_t region; /*%< for single-buffer i/o */ isc_bufferlist_t bufferlist; /*%< list of buffers */ isc_sockaddr_t address; /*%< source address */ isc_time_t timestamp; /*%< timestamp of packet recv */ struct in6_pktinfo pktinfo; /*%< ipv6 pktinfo */ isc_uint32_t attributes; /*%< see below */ isc_eventdestructor_t destroy; /*%< original destructor */ unsigned int dscp; /*%< UDP dscp value */ }; typedef struct isc_socket_newconnev isc_socket_newconnev_t; struct isc_socket_newconnev { ISC_EVENT_COMMON(isc_socket_newconnev_t); isc_socket_t * newsocket; isc_result_t result; /*%< OK, EOF, whatever else */ isc_sockaddr_t address; /*%< source address */ }; typedef struct isc_socket_connev isc_socket_connev_t; struct isc_socket_connev { ISC_EVENT_COMMON(isc_socket_connev_t); isc_result_t result; /*%< OK, EOF, whatever else */ }; /*@{*/ /*! * _ATTACHED: Internal use only. * _TRUNC: Packet was truncated on receive. * _CTRUNC: Packet control information was truncated. This can * indicate that the packet is not complete, even though * all the data is valid. * _TIMESTAMP: The timestamp member is valid. * _PKTINFO: The pktinfo member is valid. * _MULTICAST: The UDP packet was received via a multicast transmission. * _DSCP: The UDP DSCP value is valid. * _USEMINMTU: Set the per packet IPV6_USE_MIN_MTU flag. */ #define ISC_SOCKEVENTATTR_ATTACHED 0x80000000U /* internal */ #define ISC_SOCKEVENTATTR_TRUNC 0x00800000U /* public */ #define ISC_SOCKEVENTATTR_CTRUNC 0x00400000U /* public */ #define ISC_SOCKEVENTATTR_TIMESTAMP 0x00200000U /* public */ #define ISC_SOCKEVENTATTR_PKTINFO 0x00100000U /* public */ #define ISC_SOCKEVENTATTR_MULTICAST 0x00080000U /* public */ #define ISC_SOCKEVENTATTR_DSCP 0x00040000U /* public */ #define ISC_SOCKEVENTATTR_USEMINMTU 0x00020000U /* public */ /*@}*/ #define ISC_SOCKEVENT_ANYEVENT (0) #define ISC_SOCKEVENT_RECVDONE (ISC_EVENTCLASS_SOCKET + 1) #define ISC_SOCKEVENT_SENDDONE (ISC_EVENTCLASS_SOCKET + 2) #define ISC_SOCKEVENT_NEWCONN (ISC_EVENTCLASS_SOCKET + 3) #define ISC_SOCKEVENT_CONNECT (ISC_EVENTCLASS_SOCKET + 4) /* * Internal events. */ #define ISC_SOCKEVENT_INTR (ISC_EVENTCLASS_SOCKET + 256) #define ISC_SOCKEVENT_INTW (ISC_EVENTCLASS_SOCKET + 257) typedef enum { isc_sockettype_udp = 1, isc_sockettype_tcp = 2, isc_sockettype_unix = 3, isc_sockettype_fdwatch = 4, isc_sockettype_raw = 5 } isc_sockettype_t; /*@{*/ /*! * How a socket should be shutdown in isc_socket_shutdown() calls. */ #define ISC_SOCKSHUT_RECV 0x00000001 /*%< close read side */ #define ISC_SOCKSHUT_SEND 0x00000002 /*%< close write side */ #define ISC_SOCKSHUT_ALL 0x00000003 /*%< close them all */ /*@}*/ /*@{*/ /*! * What I/O events to cancel in isc_socket_cancel() calls. */ #define ISC_SOCKCANCEL_RECV 0x00000001 /*%< cancel recv */ #define ISC_SOCKCANCEL_SEND 0x00000002 /*%< cancel send */ #define ISC_SOCKCANCEL_ACCEPT 0x00000004 /*%< cancel accept */ #define ISC_SOCKCANCEL_CONNECT 0x00000008 /*%< cancel connect */ #define ISC_SOCKCANCEL_ALL 0x0000000f /*%< cancel everything */ /*@}*/ /*@{*/ /*! * Flags for isc_socket_send() and isc_socket_recv() calls. */ #define ISC_SOCKFLAG_IMMEDIATE 0x00000001 /*%< send event only if needed */ #define ISC_SOCKFLAG_NORETRY 0x00000002 /*%< drop failed UDP sends */ /*@}*/ /*@{*/ /*! * Flags for fdwatchcreate. */ #define ISC_SOCKFDWATCH_READ 0x00000001 /*%< watch for readable */ #define ISC_SOCKFDWATCH_WRITE 0x00000002 /*%< watch for writable */ /*@}*/ /*% Socket and socket manager methods */ typedef struct isc_socketmgrmethods { void (*destroy)(isc_socketmgr_t **managerp); isc_result_t (*socketcreate)(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, isc_socket_t **socketp); isc_result_t (*fdwatchcreate)(isc_socketmgr_t *manager, int fd, int flags, isc_sockfdwatch_t callback, void *cbarg, isc_task_t *task, isc_socket_t **socketp); } isc_socketmgrmethods_t; typedef struct isc_socketmethods { void (*attach)(isc_socket_t *socket, isc_socket_t **socketp); void (*detach)(isc_socket_t **socketp); isc_result_t (*bind)(isc_socket_t *sock, isc_sockaddr_t *sockaddr, unsigned int options); isc_result_t (*sendto)(isc_socket_t *sock, isc_region_t *region, isc_task_t *task, isc_taskaction_t action, void *arg, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo); isc_result_t (*sendto2)(isc_socket_t *sock, isc_region_t *region, isc_task_t *task, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo, isc_socketevent_t *event, unsigned int flags); isc_result_t (*connect)(isc_socket_t *sock, isc_sockaddr_t *addr, isc_task_t *task, isc_taskaction_t action, void *arg); isc_result_t (*recv)(isc_socket_t *sock, isc_region_t *region, unsigned int minimum, isc_task_t *task, isc_taskaction_t action, void *arg); isc_result_t (*recv2)(isc_socket_t *sock, isc_region_t *region, unsigned int minimum, isc_task_t *task, isc_socketevent_t *event, unsigned int flags); void (*cancel)(isc_socket_t *sock, isc_task_t *task, unsigned int how); isc_result_t (*getsockname)(isc_socket_t *sock, isc_sockaddr_t *addressp); isc_sockettype_t (*gettype)(isc_socket_t *sock); void (*ipv6only)(isc_socket_t *sock, isc_boolean_t yes); isc_result_t (*fdwatchpoke)(isc_socket_t *sock, int flags); isc_result_t (*dup)(isc_socket_t *socket, isc_socket_t **socketp); int (*getfd)(isc_socket_t *socket); void (*dscp)(isc_socket_t *socket, isc_dscp_t dscp); } isc_socketmethods_t; /*% * This structure is actually just the common prefix of a socket manager * object implementation's version of an isc_socketmgr_t. * \brief * Direct use of this structure by clients is forbidden. socket implementations * may change the structure. 'magic' must be ISCAPI_SOCKETMGR_MAGIC for any * of the isc_socket_ routines to work. socket implementations must maintain * all socket invariants. * In effect, this definition is used only for non-BIND9 version ("export") * of the library, and the export version does not work for win32. So, to avoid * the definition conflict with win32/socket.c, we enable this definition only * for non-Win32 (i.e. Unix) platforms. */ #ifndef WIN32 struct isc_socketmgr { unsigned int impmagic; unsigned int magic; isc_socketmgrmethods_t *methods; }; #endif #define ISCAPI_SOCKETMGR_MAGIC ISC_MAGIC('A','s','m','g') #define ISCAPI_SOCKETMGR_VALID(m) ((m) != NULL && \ (m)->magic == ISCAPI_SOCKETMGR_MAGIC) /*% * This is the common prefix of a socket object. The same note as * that for the socketmgr structure applies. */ #ifndef WIN32 struct isc_socket { unsigned int impmagic; unsigned int magic; isc_socketmethods_t *methods; }; #endif #define ISCAPI_SOCKET_MAGIC ISC_MAGIC('A','s','c','t') #define ISCAPI_SOCKET_VALID(s) ((s) != NULL && \ (s)->magic == ISCAPI_SOCKET_MAGIC) /*** *** Socket and Socket Manager Functions *** *** Note: all Ensures conditions apply only if the result is success for *** those functions which return an isc_result. ***/ isc_result_t isc_socket_fdwatchcreate(isc_socketmgr_t *manager, int fd, int flags, isc_sockfdwatch_t callback, void *cbarg, isc_task_t *task, isc_socket_t **socketp); /*%< * Create a new file descriptor watch socket managed by 'manager'. * * Note: * *\li 'fd' is the already-opened file descriptor (must be less * than maxsockets). *\li This function is not available on Windows. *\li The callback function is called "in-line" - this means the function * needs to return as fast as possible, as all other I/O will be suspended * until the callback completes. * * Requires: * *\li 'manager' is a valid manager * *\li 'socketp' is a valid pointer, and *socketp == NULL * *\li 'fd' be opened. * * Ensures: * * '*socketp' is attached to the newly created fdwatch socket * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li #ISC_R_NORESOURCES *\li #ISC_R_UNEXPECTED *\li #ISC_R_RANGE */ isc_result_t isc_socket_fdwatchpoke(isc_socket_t *sock, int flags); /*%< * Poke a file descriptor watch socket informing the manager that it * should restart watching the socket * * Note: * *\li 'sock' is the socket returned by isc_socket_fdwatchcreate * *\li 'flags' indicates what the manager should watch for on the socket * in addition to what it may already be watching. It can be one or * both of ISC_SOCKFDWATCH_READ and ISC_SOCKFDWATCH_WRITE. To * temporarily disable watching on a socket the value indicating * no more data should be returned from the call back routine. * *\li This function is not available on Windows. * * Requires: * *\li 'sock' is a valid isc socket * * * Returns: * *\li #ISC_R_SUCCESS */ isc_result_t isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, isc_socket_t **socketp); /*%< * Create a new 'type' socket managed by 'manager'. * * For isc_sockettype_fdwatch sockets you should use isc_socket_fdwatchcreate() * rather than isc_socket_create(). * * Note: * *\li 'pf' is the desired protocol family, e.g. PF_INET or PF_INET6. * * Requires: * *\li 'manager' is a valid manager * *\li 'socketp' is a valid pointer, and *socketp == NULL * *\li 'type' is not isc_sockettype_fdwatch * * Ensures: * * '*socketp' is attached to the newly created socket * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li #ISC_R_NORESOURCES *\li #ISC_R_UNEXPECTED */ isc_result_t isc_socket_dup(isc_socket_t *sock0, isc_socket_t **socketp); /*%< * Duplicate an existing socket, reusing its file descriptor. */ void isc_socket_cancel(isc_socket_t *sock, isc_task_t *task, unsigned int how); /*%< * Cancel pending I/O of the type specified by "how". * * Note: if "task" is NULL, then the cancel applies to all tasks using the * socket. * * Requires: * * \li "socket" is a valid socket * * \li "task" is NULL or a valid task * * "how" is a bitmask describing the type of cancelation to perform. * The type ISC_SOCKCANCEL_ALL will cancel all pending I/O on this * socket. * * \li ISC_SOCKCANCEL_RECV: * Cancel pending isc_socket_recv() calls. * * \li ISC_SOCKCANCEL_SEND: * Cancel pending isc_socket_send() and isc_socket_sendto() calls. * * \li ISC_SOCKCANCEL_ACCEPT: * Cancel pending isc_socket_accept() calls. * * \li ISC_SOCKCANCEL_CONNECT: * Cancel pending isc_socket_connect() call. */ void isc_socket_shutdown(isc_socket_t *sock, unsigned int how); /*%< * Shutdown 'socket' according to 'how'. * * Requires: * * \li 'socket' is a valid socket. * * \li 'task' is NULL or is a valid task. * * \li If 'how' is 'ISC_SOCKSHUT_RECV' or 'ISC_SOCKSHUT_ALL' then * * The read queue must be empty. * * No further read requests may be made. * * \li If 'how' is 'ISC_SOCKSHUT_SEND' or 'ISC_SOCKSHUT_ALL' then * * The write queue must be empty. * * No further write requests may be made. */ void isc_socket_attach(isc_socket_t *sock, isc_socket_t **socketp); /*%< * Attach *socketp to socket. * * Requires: * * \li 'socket' is a valid socket. * * \li 'socketp' points to a NULL socket. * * Ensures: * * \li *socketp is attached to socket. */ void isc_socket_detach(isc_socket_t **socketp); /*%< * Detach *socketp from its socket. * * Requires: * * \li 'socketp' points to a valid socket. * * \li If '*socketp' is the last reference to the socket, * then: * * There must be no pending I/O requests. * * Ensures: * * \li *socketp is NULL. * * \li If '*socketp' is the last reference to the socket, * then: * * The socket will be shutdown (both reading and writing) * for all tasks. * * All resources used by the socket have been freed */ isc_result_t isc_socket_open(isc_socket_t *sock); /*%< * Open a new socket file descriptor of the given socket structure. It simply * opens a new descriptor; all of the other parameters including the socket * type are inherited from the existing socket. This function is provided to * avoid overhead of destroying and creating sockets when many short-lived * sockets are frequently opened and closed. When the efficiency is not an * issue, it should be safer to detach the unused socket and re-create a new * one. This optimization may not be available for some systems, in which * case this function will return ISC_R_NOTIMPLEMENTED and must not be used. * * isc_socket_open() should not be called on sockets created by * isc_socket_fdwatchcreate(). * * Requires: * * \li there must be no other reference to this socket. * * \li 'socket' is a valid and previously closed by isc_socket_close() * * \li 'sock->type' is not isc_sockettype_fdwatch * * Returns: * Same as isc_socket_create(). * \li ISC_R_NOTIMPLEMENTED */ isc_result_t isc_socket_close(isc_socket_t *sock); /*%< * Close a socket file descriptor of the given socket structure. This function * is provided as an alternative to destroying an unused socket when overhead * destroying/re-creating sockets can be significant, and is expected to be * used with isc_socket_open(). This optimization may not be available for some * systems, in which case this function will return ISC_R_NOTIMPLEMENTED and * must not be used. * * isc_socket_close() should not be called on sockets created by * isc_socket_fdwatchcreate(). * * Requires: * * \li The socket must have a valid descriptor. * * \li There must be no other reference to this socket. * * \li There must be no pending I/O requests. * * \li 'sock->type' is not isc_sockettype_fdwatch * * Returns: * \li #ISC_R_NOTIMPLEMENTED */ isc_result_t isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *addressp, unsigned int options); /*%< * Bind 'socket' to '*addressp'. * * Requires: * * \li 'socket' is a valid socket * * \li 'addressp' points to a valid isc_sockaddr. * * Returns: * * \li ISC_R_SUCCESS * \li ISC_R_NOPERM * \li ISC_R_ADDRNOTAVAIL * \li ISC_R_ADDRINUSE * \li ISC_R_BOUND * \li ISC_R_UNEXPECTED */ isc_result_t isc_socket_filter(isc_socket_t *sock, const char *filter); /*%< * Inform the kernel that it should perform accept filtering. * If filter is NULL the current filter will be removed.:w */ isc_result_t isc_socket_listen(isc_socket_t *sock, unsigned int backlog); /*%< * Set listen mode on the socket. After this call, the only function that * can be used (other than attach and detach) is isc_socket_accept(). * * Notes: * * \li 'backlog' is as in the UNIX system call listen() and may be * ignored by non-UNIX implementations. * * \li If 'backlog' is zero, a reasonable system default is used, usually * SOMAXCONN. * * Requires: * * \li 'socket' is a valid, bound TCP socket or a valid, bound UNIX socket. * * Returns: * * \li ISC_R_SUCCESS * \li ISC_R_UNEXPECTED */ isc_result_t isc_socket_accept(isc_socket_t *sock, isc_task_t *task, isc_taskaction_t action, void *arg); /*%< * Queue accept event. When a new connection is received, the task will * get an ISC_SOCKEVENT_NEWCONN event with the sender set to the listen * socket. The new socket structure is sent inside the isc_socket_newconnev_t * event type, and is attached to the task 'task'. * * REQUIRES: * \li 'socket' is a valid TCP socket that isc_socket_listen() was called * on. * * \li 'task' is a valid task * * \li 'action' is a valid action * * RETURNS: * \li ISC_R_SUCCESS * \li ISC_R_NOMEMORY * \li ISC_R_UNEXPECTED */ isc_result_t isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addressp, isc_task_t *task, isc_taskaction_t action, void *arg); /*%< * Connect 'socket' to peer with address *saddr. When the connection * succeeds, or when an error occurs, a CONNECT event with action 'action' * and arg 'arg' will be posted to the event queue for 'task'. * * Requires: * * \li 'socket' is a valid TCP socket * * \li 'addressp' points to a valid isc_sockaddr * * \li 'task' is a valid task * * \li 'action' is a valid action * * Returns: * * \li ISC_R_SUCCESS * \li ISC_R_NOMEMORY * \li ISC_R_UNEXPECTED * * Posted event's result code: * * \li ISC_R_SUCCESS * \li ISC_R_TIMEDOUT * \li ISC_R_CONNREFUSED * \li ISC_R_NETUNREACH * \li ISC_R_UNEXPECTED */ isc_result_t isc_socket_getpeername(isc_socket_t *sock, isc_sockaddr_t *addressp); /*%< * Get the name of the peer connected to 'socket'. * * Requires: * * \li 'socket' is a valid TCP socket. * * Returns: * * \li ISC_R_SUCCESS * \li ISC_R_TOOSMALL * \li ISC_R_UNEXPECTED */ isc_result_t isc_socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp); /*%< * Get the name of 'socket'. * * Requires: * * \li 'socket' is a valid socket. * * Returns: * * \li ISC_R_SUCCESS * \li ISC_R_TOOSMALL * \li ISC_R_UNEXPECTED */ /*@{*/ isc_result_t isc_socket_recv(isc_socket_t *sock, isc_region_t *region, unsigned int minimum, isc_task_t *task, isc_taskaction_t action, void *arg); isc_result_t isc_socket_recvv(isc_socket_t *sock, isc_bufferlist_t *buflist, unsigned int minimum, isc_task_t *task, isc_taskaction_t action, void *arg); isc_result_t isc_socket_recv2(isc_socket_t *sock, isc_region_t *region, unsigned int minimum, isc_task_t *task, isc_socketevent_t *event, unsigned int flags); /*! * Receive from 'socket', storing the results in region. * * Notes: * *\li Let 'length' refer to the length of 'region' or to the sum of all * available regions in the list of buffers '*buflist'. * *\li If 'minimum' is non-zero and at least that many bytes are read, * the completion event will be posted to the task 'task.' If minimum * is zero, the exact number of bytes requested in the region must * be read for an event to be posted. This only makes sense for TCP * connections, and is always set to 1 byte for UDP. * *\li The read will complete when the desired number of bytes have been * read, if end-of-input occurs, or if an error occurs. A read done * event with the given 'action' and 'arg' will be posted to the * event queue of 'task'. * *\li The caller may not modify 'region', the buffers which are passed * into this function, or any data they refer to until the completion * event is received. * *\li For isc_socket_recvv(): * On successful completion, '*buflist' will be empty, and the list of * all buffers will be returned in the done event's 'bufferlist' * member. On error return, '*buflist' will be unchanged. * *\li For isc_socket_recv2(): * 'event' is not NULL, and the non-socket specific fields are * expected to be initialized. * *\li For isc_socket_recv2(): * The only defined value for 'flags' is ISC_SOCKFLAG_IMMEDIATE. If * set and the operation completes, the return value will be * ISC_R_SUCCESS and the event will be filled in and not sent. If the * operation does not complete, the return value will be * ISC_R_INPROGRESS and the event will be sent when the operation * completes. * * Requires: * *\li 'socket' is a valid, bound socket. * *\li For isc_socket_recv(): * 'region' is a valid region * *\li For isc_socket_recvv(): * 'buflist' is non-NULL, and '*buflist' contain at least one buffer. * *\li 'task' is a valid task * *\li For isc_socket_recv() and isc_socket_recvv(): * action != NULL and is a valid action * *\li For isc_socket_recv2(): * event != NULL * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_INPROGRESS *\li #ISC_R_NOMEMORY *\li #ISC_R_UNEXPECTED * * Event results: * *\li #ISC_R_SUCCESS *\li #ISC_R_UNEXPECTED *\li XXX needs other net-type errors */ /*@}*/ /*@{*/ isc_result_t isc_socket_send(isc_socket_t *sock, isc_region_t *region, isc_task_t *task, isc_taskaction_t action, void *arg); isc_result_t isc_socket_sendto(isc_socket_t *sock, isc_region_t *region, isc_task_t *task, isc_taskaction_t action, void *arg, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo); isc_result_t isc_socket_sendv(isc_socket_t *sock, isc_bufferlist_t *buflist, isc_task_t *task, isc_taskaction_t action, void *arg); isc_result_t isc_socket_sendtov(isc_socket_t *sock, isc_bufferlist_t *buflist, isc_task_t *task, isc_taskaction_t action, void *arg, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo); isc_result_t isc_socket_sendtov2(isc_socket_t *sock, isc_bufferlist_t *buflist, isc_task_t *task, isc_taskaction_t action, void *arg, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo, unsigned int flags); isc_result_t isc_socket_sendto2(isc_socket_t *sock, isc_region_t *region, isc_task_t *task, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo, isc_socketevent_t *event, unsigned int flags); /*! * Send the contents of 'region' to the socket's peer. * * Notes: * *\li Shutting down the requestor's task *may* result in any * still pending writes being dropped or completed, depending on the * underlying OS implementation. * *\li If 'action' is NULL, then no completion event will be posted. * *\li The caller may not modify 'region', the buffers which are passed * into this function, or any data they refer to until the completion * event is received. * *\li For isc_socket_sendv() and isc_socket_sendtov(): * On successful completion, '*buflist' will be empty, and the list of * all buffers will be returned in the done event's 'bufferlist' * member. On error return, '*buflist' will be unchanged. * *\li For isc_socket_sendto2(): * 'event' is not NULL, and the non-socket specific fields are * expected to be initialized. * *\li For isc_socket_sendto2(): * The only defined values for 'flags' are ISC_SOCKFLAG_IMMEDIATE * and ISC_SOCKFLAG_NORETRY. * *\li If ISC_SOCKFLAG_IMMEDIATE is set and the operation completes, the * return value will be ISC_R_SUCCESS and the event will be filled * in and not sent. If the operation does not complete, the return * value will be ISC_R_INPROGRESS and the event will be sent when * the operation completes. * *\li ISC_SOCKFLAG_NORETRY can only be set for UDP sockets. If set * and the send operation fails due to a transient error, the send * will not be retried and the error will be indicated in the event. * Using this option along with ISC_SOCKFLAG_IMMEDIATE allows the caller * to specify a region that is allocated on the stack. * * Requires: * *\li 'socket' is a valid, bound socket. * *\li For isc_socket_send(): * 'region' is a valid region * *\li For isc_socket_sendv() and isc_socket_sendtov(): * 'buflist' is non-NULL, and '*buflist' contain at least one buffer. * *\li 'task' is a valid task * *\li For isc_socket_sendv(), isc_socket_sendtov(), isc_socket_send(), and * isc_socket_sendto(): * action == NULL or is a valid action * *\li For isc_socket_sendto2(): * event != NULL * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_INPROGRESS *\li #ISC_R_NOMEMORY *\li #ISC_R_UNEXPECTED * * Event results: * *\li #ISC_R_SUCCESS *\li #ISC_R_UNEXPECTED *\li XXX needs other net-type errors */ /*@}*/ isc_result_t isc_socketmgr_createinctx(isc_mem_t *mctx, isc_appctx_t *actx, isc_socketmgr_t **managerp); isc_result_t isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp); isc_result_t isc_socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp, unsigned int maxsocks); /*%< * Create a socket manager. If "maxsocks" is non-zero, it specifies the * maximum number of sockets that the created manager should handle. * isc_socketmgr_create() is equivalent of isc_socketmgr_create2() with * "maxsocks" being zero. * isc_socketmgr_createinctx() also associates the new manager with the * specified application context. * * Notes: * *\li All memory will be allocated in memory context 'mctx'. * * Requires: * *\li 'mctx' is a valid memory context. * *\li 'managerp' points to a NULL isc_socketmgr_t. * *\li 'actx' is a valid application context (for createinctx()). * * Ensures: * *\li '*managerp' is a valid isc_socketmgr_t. * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li #ISC_R_UNEXPECTED *\li #ISC_R_NOTIMPLEMENTED */ isc_result_t isc_socketmgr_getmaxsockets(isc_socketmgr_t *manager, unsigned int *nsockp); /*%< * Returns in "*nsockp" the maximum number of sockets this manager may open. * * Requires: * *\li '*manager' is a valid isc_socketmgr_t. *\li 'nsockp' is not NULL. * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_NOTIMPLEMENTED */ void isc_socketmgr_setstats(isc_socketmgr_t *manager, isc_stats_t *stats); /*%< * Set a general socket statistics counter set 'stats' for 'manager'. * * Requires: * \li 'manager' is valid, hasn't opened any socket, and doesn't have * stats already set. * *\li stats is a valid statistics supporting socket statistics counters * (see above). */ void isc_socketmgr_destroy(isc_socketmgr_t **managerp); /*%< * Destroy a socket manager. * * Notes: * *\li This routine blocks until there are no sockets left in the manager, * so if the caller holds any socket references using the manager, it * must detach them before calling isc_socketmgr_destroy() or it will * block forever. * * Requires: * *\li '*managerp' is a valid isc_socketmgr_t. * *\li All sockets managed by this manager are fully detached. * * Ensures: * *\li *managerp == NULL * *\li All resources used by the manager have been freed. */ isc_sockettype_t isc_socket_gettype(isc_socket_t *sock); /*%< * Returns the socket type for "sock." * * Requires: * *\li "sock" is a valid socket. */ /*@{*/ isc_boolean_t isc__socket_isbound(isc_socket_t *sock); /*% * Intended for internal use in BIND9 only */ void isc_socket_ipv6only(isc_socket_t *sock, isc_boolean_t yes); /*%< * If the socket is an IPv6 socket set/clear the IPV6_IPV6ONLY socket * option if the host OS supports this option. * * Requires: *\li 'sock' is a valid socket. */ /*@}*/ void isc_socket_dscp(isc_socket_t *sock, isc_dscp_t dscp); /*%< * Sets the Differentiated Services Code Point (DSCP) field for packets * transmitted on this socket. If 'dscp' is -1, return immediately. * * Requires: *\li 'sock' is a valid socket. */ isc_socketevent_t * isc_socket_socketevent(isc_mem_t *mctx, void *sender, isc_eventtype_t eventtype, isc_taskaction_t action, void *arg); /*%< * Get a isc_socketevent_t to be used with isc_socket_sendto2(), etc. */ void isc_socket_cleanunix(isc_sockaddr_t *addr, isc_boolean_t active); /*%< * Cleanup UNIX domain sockets in the file-system. If 'active' is true * then just unlink the socket. If 'active' is false try to determine * if there is a listener of the socket or not. If no listener is found * then unlink socket. * * Prior to unlinking the path is tested to see if it a socket. * * Note: there are a number of race conditions which cannot be avoided * both in the filesystem and any application using UNIX domain * sockets (e.g. socket is tested between bind() and listen(), * the socket is deleted and replaced in the file-system between * stat() and unlink()). */ isc_result_t isc_socket_permunix(isc_sockaddr_t *sockaddr, isc_uint32_t perm, isc_uint32_t owner, isc_uint32_t group); /*%< * Set ownership and file permissions on the UNIX domain socket. * * Note: On Solaris and SunOS this secures the directory containing * the socket as Solaris and SunOS do not honour the filesystem * permissions on the socket. * * Requires: * \li 'sockaddr' to be a valid UNIX domain sockaddr. * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_FAILURE */ void isc_socket_setname(isc_socket_t *socket, const char *name, void *tag); /*%< * Set the name and optional tag for a socket. This allows tracking of the * owner or purpose for this socket, and is useful for tracing and statistics * reporting. */ const char *isc_socket_getname(isc_socket_t *socket); /*%< * Get the name associated with a socket, if any. */ void *isc_socket_gettag(isc_socket_t *socket); /*%< * Get the tag associated with a socket, if any. */ int isc_socket_getfd(isc_socket_t *socket); /*%< * Get the file descriptor associated with a socket */ void isc__socketmgr_setreserved(isc_socketmgr_t *mgr, isc_uint32_t); /*%< * Temporary. For use by named only. */ void isc__socketmgr_maxudp(isc_socketmgr_t *mgr, int maxudp); /*%< * Test interface. Drop UDP packet > 'maxudp'. */ #ifdef HAVE_LIBXML2 int isc_socketmgr_renderxml(isc_socketmgr_t *mgr, xmlTextWriterPtr writer); /*%< * Render internal statistics and other state into the XML document. */ #endif /* HAVE_LIBXML2 */ #ifdef HAVE_JSON isc_result_t isc_socketmgr_renderjson(isc_socketmgr_t *mgr, json_object *stats); /*%< * Render internal statistics and other state into JSON format. */ #endif /* HAVE_JSON */ /*%< * See isc_socketmgr_create() above. */ typedef isc_result_t (*isc_socketmgrcreatefunc_t)(isc_mem_t *mctx, isc_socketmgr_t **managerp); isc_result_t isc_socket_register(isc_socketmgrcreatefunc_t createfunc); /*%< * Register a new socket I/O implementation and add it to the list of * supported implementations. This function must be called when a different * event library is used than the one contained in the ISC library. */ isc_result_t isc__socket_register(void); /*%< * A short cut function that specifies the socket I/O module in the ISC * library for isc_socket_register(). An application that uses the ISC library * usually do not have to care about this function: it would call * isc_lib_register(), which internally calls this function. */ ISC_LANG_ENDDECLS #endif /* ISC_SOCKET_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/refcount.h��������������������������������������������������������������������������������0000644�����������������00000017624�14763166026�0010352 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_REFCOUNT_H #define ISC_REFCOUNT_H 1 #include <isc/assertions.h> #include <isc/atomic.h> #include <isc/error.h> #include <isc/lang.h> #include <isc/mutex.h> #include <isc/platform.h> #include <isc/types.h> #if defined(ISC_PLATFORM_HAVESTDATOMIC) #include <stdatomic.h> #endif /*! \file isc/refcount.h * \brief Implements a locked reference counter. * * These functions may actually be * implemented using macros, and implementations of these macros are below. * The isc_refcount_t type should not be accessed directly, as its contents * depend on the implementation. */ ISC_LANG_BEGINDECLS /* * Function prototypes */ /* * isc_result_t * isc_refcount_init(isc_refcount_t *ref, unsigned int n); * * Initialize the reference counter. There will be 'n' initial references. * * Requires: * ref != NULL */ /* * void * isc_refcount_destroy(isc_refcount_t *ref); * * Destroys a reference counter. * * Requires: * ref != NULL * The number of references is 0. */ /* * void * isc_refcount_increment(isc_refcount_t *ref, unsigned int *targetp); * isc_refcount_increment0(isc_refcount_t *ref, unsigned int *targetp); * * Increments the reference count, returning the new value in targetp if it's * not NULL. The reference counter typically begins with the initial counter * of 1, and will be destroyed once the counter reaches 0. Thus, * isc_refcount_increment() additionally requires the previous counter be * larger than 0 so that an error which violates the usage can be easily * caught. isc_refcount_increment0() does not have this restriction. * * Requires: * ref != NULL. */ /* * void * isc_refcount_decrement(isc_refcount_t *ref, unsigned int *targetp); * * Decrements the reference count, returning the new value in targetp if it's * not NULL. * * Requires: * ref != NULL. */ /* * Sample implementations */ #ifdef ISC_PLATFORM_USETHREADS #if (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE)) || defined(ISC_PLATFORM_HAVEXADD) #define ISC_REFCOUNT_HAVEATOMIC 1 #if (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE)) #define ISC_REFCOUNT_HAVESTDATOMIC 1 #endif typedef struct isc_refcount { #if defined(ISC_REFCOUNT_HAVESTDATOMIC) atomic_int_fast32_t refs; #else isc_int32_t refs; #endif } isc_refcount_t; #if defined(ISC_REFCOUNT_HAVESTDATOMIC) #define isc_refcount_current(rp) \ ((unsigned int)(atomic_load_explicit(&(rp)->refs, \ memory_order_relaxed))) #define isc_refcount_destroy(rp) ISC_REQUIRE(isc_refcount_current(rp) == 0) #define isc_refcount_increment0(rp, tp) \ do { \ unsigned int *_tmp = (unsigned int *)(tp); \ isc_int32_t prev; \ prev = atomic_fetch_add_explicit \ (&(rp)->refs, 1, memory_order_relaxed); \ if (_tmp != NULL) \ *_tmp = prev + 1; \ } while (0) #define isc_refcount_increment(rp, tp) \ do { \ unsigned int *_tmp = (unsigned int *)(tp); \ isc_int32_t prev; \ prev = atomic_fetch_add_explicit \ (&(rp)->refs, 1, memory_order_relaxed); \ ISC_REQUIRE(prev > 0); \ if (_tmp != NULL) \ *_tmp = prev + 1; \ } while (0) #define isc_refcount_decrement(rp, tp) \ do { \ unsigned int *_tmp = (unsigned int *)(tp); \ isc_int32_t prev; \ prev = atomic_fetch_sub_explicit \ (&(rp)->refs, 1, memory_order_relaxed); \ ISC_REQUIRE(prev > 0); \ if (_tmp != NULL) \ *_tmp = prev - 1; \ } while (0) #else /* ISC_REFCOUNT_HAVESTDATOMIC */ #define isc_refcount_current(rp) \ ((unsigned int)(isc_atomic_xadd(&(rp)->refs, 0))) #define isc_refcount_destroy(rp) ISC_REQUIRE(isc_refcount_current(rp) == 0) #define isc_refcount_increment0(rp, tp) \ do { \ unsigned int *_tmp = (unsigned int *)(tp); \ isc_int32_t prev; \ prev = isc_atomic_xadd(&(rp)->refs, 1); \ if (_tmp != NULL) \ *_tmp = prev + 1; \ } while (0) #define isc_refcount_increment(rp, tp) \ do { \ unsigned int *_tmp = (unsigned int *)(tp); \ isc_int32_t prev; \ prev = isc_atomic_xadd(&(rp)->refs, 1); \ ISC_REQUIRE(prev > 0); \ if (_tmp != NULL) \ *_tmp = prev + 1; \ } while (0) #define isc_refcount_decrement(rp, tp) \ do { \ unsigned int *_tmp = (unsigned int *)(tp); \ isc_int32_t prev; \ prev = isc_atomic_xadd(&(rp)->refs, -1); \ ISC_REQUIRE(prev > 0); \ if (_tmp != NULL) \ *_tmp = prev - 1; \ } while (0) #endif /* ISC_REFCOUNT_HAVESTDATOMIC */ #else /* ISC_PLATFORM_HAVEXADD */ typedef struct isc_refcount { int refs; isc_mutex_t lock; } isc_refcount_t; /*% Destroys a reference counter. */ #define isc_refcount_destroy(rp) \ do { \ isc_result_t _result; \ ISC_REQUIRE((rp)->refs == 0); \ _result = isc_mutex_destroy(&(rp)->lock); \ ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ } while (0) #define isc_refcount_current(rp) ((unsigned int)((rp)->refs)) /*% * Increments the reference count, returning the new value in * 'tp' if it's not NULL. */ #define isc_refcount_increment0(rp, tp) \ do { \ isc_result_t _result; \ unsigned int *_tmp = (unsigned int *)(tp); \ _result = isc_mutex_lock(&(rp)->lock); \ ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ ++((rp)->refs); \ if (_tmp != NULL) \ *_tmp = ((rp)->refs); \ _result = isc_mutex_unlock(&(rp)->lock); \ ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ } while (0) #define isc_refcount_increment(rp, tp) \ do { \ isc_result_t _result; \ unsigned int *_tmp = (unsigned int *)(tp); \ _result = isc_mutex_lock(&(rp)->lock); \ ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ ISC_REQUIRE((rp)->refs > 0); \ ++((rp)->refs); \ if (_tmp != NULL) \ *_tmp = ((rp)->refs); \ _result = isc_mutex_unlock(&(rp)->lock); \ ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ } while (0) /*% * Decrements the reference count, returning the new value in 'tp' * if it's not NULL. */ #define isc_refcount_decrement(rp, tp) \ do { \ isc_result_t _result; \ unsigned int *_tmp = (unsigned int *)(tp); \ _result = isc_mutex_lock(&(rp)->lock); \ ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ ISC_REQUIRE((rp)->refs > 0); \ --((rp)->refs); \ if (_tmp != NULL) \ *_tmp = ((rp)->refs); \ _result = isc_mutex_unlock(&(rp)->lock); \ ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ } while (0) #endif /* (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE)) || defined(ISC_PLATFORM_HAVEXADD) */ #else /* ISC_PLATFORM_USETHREADS */ typedef struct isc_refcount { int refs; } isc_refcount_t; #define isc_refcount_destroy(rp) ISC_REQUIRE((rp)->refs == 0) #define isc_refcount_current(rp) ((unsigned int)((rp)->refs)) #define isc_refcount_increment0(rp, tp) \ do { \ unsigned int *_tmp = (unsigned int *)(tp); \ int _n = ++(rp)->refs; \ if (_tmp != NULL) \ *_tmp = _n; \ } while (0) #define isc_refcount_increment(rp, tp) \ do { \ unsigned int *_tmp = (unsigned int *)(tp); \ int _n; \ ISC_REQUIRE((rp)->refs > 0); \ _n = ++(rp)->refs; \ if (_tmp != NULL) \ *_tmp = _n; \ } while (0) #define isc_refcount_decrement(rp, tp) \ do { \ unsigned int *_tmp = (unsigned int *)(tp); \ int _n; \ ISC_REQUIRE((rp)->refs > 0); \ _n = --(rp)->refs; \ if (_tmp != NULL) \ *_tmp = _n; \ } while (0) #endif /* ISC_PLATFORM_USETHREADS */ isc_result_t isc_refcount_init(isc_refcount_t *ref, unsigned int n); ISC_LANG_ENDDECLS #endif /* ISC_REFCOUNT_H */ ������������������������������������������������������������������������������������������������������������bind9/isc/thread.h����������������������������������������������������������������������������������0000644�����������������00000002741�14763166026�0007766 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_THREAD_H #define ISC_THREAD_H 1 /*! \file */ #include <pthread.h> #if defined(HAVE_PTHREAD_NP_H) #include <pthread_np.h> #endif #include <isc/lang.h> #include <isc/result.h> ISC_LANG_BEGINDECLS typedef pthread_t isc_thread_t; typedef void * isc_threadresult_t; typedef void * isc_threadarg_t; typedef isc_threadresult_t (*isc_threadfunc_t)(isc_threadarg_t); typedef pthread_key_t isc_thread_key_t; isc_result_t isc_thread_create(isc_threadfunc_t, isc_threadarg_t, isc_thread_t *); void isc_thread_setconcurrency(unsigned int level); void isc_thread_yield(void); void isc_thread_setname(isc_thread_t thread, const char *name); /* XXX We could do fancier error handling... */ #define isc_thread_join(t, rp) \ ((pthread_join((t), (rp)) == 0) ? \ ISC_R_SUCCESS : ISC_R_UNEXPECTED) #define isc_thread_self \ (unsigned long)pthread_self #define isc_thread_key_create pthread_key_create #define isc_thread_key_getspecific pthread_getspecific #define isc_thread_key_setspecific pthread_setspecific #define isc_thread_key_delete pthread_key_delete ISC_LANG_ENDDECLS #endif /* ISC_THREAD_H */ �������������������������������bind9/isc/heap.h������������������������������������������������������������������������������������0000644�����������������00000012222�14763166026�0007427 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_HEAP_H #define ISC_HEAP_H 1 /*! \file isc/heap.h */ #include <isc/lang.h> #include <isc/types.h> ISC_LANG_BEGINDECLS /*% * The comparison function returns ISC_TRUE if the first argument has * higher priority than the second argument, and ISC_FALSE otherwise. */ typedef isc_boolean_t (*isc_heapcompare_t)(void *, void *); /*% * The index function allows the client of the heap to receive a callback * when an item's index number changes. This allows it to maintain * sync with its external state, but still delete itself, since deletions * from the heap require the index be provided. */ typedef void (*isc_heapindex_t)(void *, unsigned int); /*% * The heapaction function is used when iterating over the heap. * * NOTE: The heap structure CANNOT BE MODIFIED during the call to * isc_heap_foreach(). */ typedef void (*isc_heapaction_t)(void *, void *); typedef struct isc_heap isc_heap_t; isc_result_t isc_heap_create(isc_mem_t *mctx, isc_heapcompare_t compare, isc_heapindex_t index, unsigned int size_increment, isc_heap_t **heapp); /*!< * \brief Create a new heap. The heap is implemented using a space-efficient * storage method. When the heap elements are deleted space is not freed * but will be reused when new elements are inserted. * * Heap elements are indexed from 1. * * Requires: *\li "mctx" is valid. *\li "compare" is a function which takes two void * arguments and * returns ISC_TRUE if the first argument has a higher priority than * the second, and ISC_FALSE otherwise. *\li "index" is a function which takes a void *, and an unsigned int * argument. This function will be called whenever an element's * index value changes, so it may continue to delete itself from the * heap. This option may be NULL if this functionality is unneeded. *\li "size_increment" is a hint about how large the heap should grow * when resizing is needed. If this is 0, a default size will be * used, which is currently 1024, allowing space for an additional 1024 * heap elements to be inserted before adding more space. *\li "heapp" is not NULL, and "*heap" is NULL. * * Returns: *\li ISC_R_SUCCESS - success *\li ISC_R_NOMEMORY - insufficient memory */ void isc_heap_destroy(isc_heap_t **heapp); /*!< * \brief Destroys a heap. * * Requires: *\li "heapp" is not NULL and "*heap" points to a valid isc_heap_t. */ isc_result_t isc_heap_insert(isc_heap_t *heap, void *elt); /*!< * \brief Inserts a new element into a heap. * * Requires: *\li "heapp" is not NULL and "*heap" points to a valid isc_heap_t. */ void isc_heap_delete(isc_heap_t *heap, unsigned int index); /*!< * \brief Deletes an element from a heap, by element index. * * Requires: *\li "heapp" is not NULL and "*heap" points to a valid isc_heap_t. *\li "index" is a valid element index, as provided by the "index" callback * provided during heap creation. */ void isc_heap_increased(isc_heap_t *heap, unsigned int index); /*!< * \brief Indicates to the heap that an element's priority has increased. * This function MUST be called whenever an element has increased in priority. * * Requires: *\li "heapp" is not NULL and "*heap" points to a valid isc_heap_t. *\li "index" is a valid element index, as provided by the "index" callback * provided during heap creation. */ void isc_heap_decreased(isc_heap_t *heap, unsigned int index); /*!< * \brief Indicates to the heap that an element's priority has decreased. * This function MUST be called whenever an element has decreased in priority. * * Requires: *\li "heapp" is not NULL and "*heap" points to a valid isc_heap_t. *\li "index" is a valid element index, as provided by the "index" callback * provided during heap creation. */ void * isc_heap_element(isc_heap_t *heap, unsigned int index); /*!< * \brief Returns the element for a specific element index. * * Requires: *\li "heapp" is not NULL and "*heap" points to a valid isc_heap_t. *\li "index" is a valid element index, as provided by the "index" callback * provided during heap creation. * * Returns: *\li A pointer to the element for the element index. */ void isc_heap_foreach(isc_heap_t *heap, isc_heapaction_t action, void *uap); /*!< * \brief Iterate over the heap, calling an action for each element. The * order of iteration is not sorted. * * Requires: *\li "heapp" is not NULL and "*heap" points to a valid isc_heap_t. *\li "action" is not NULL, and is a function which takes two arguments. * The first is a void *, representing the element, and the second is * "uap" as provided to isc_heap_foreach. *\li "uap" is a caller-provided argument, and may be NULL. * * Note: *\li The heap structure CANNOT be modified during this iteration. The only * safe function to call while iterating the heap is isc_heap_element(). */ ISC_LANG_ENDDECLS #endif /* ISC_HEAP_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/lfsr.h������������������������������������������������������������������������������������0000644�����������������00000005612�14763166026�0007465 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_LFSR_H #define ISC_LFSR_H 1 /*! \file isc/lfsr.h */ #include <isc/lang.h> #include <isc/types.h> typedef struct isc_lfsr isc_lfsr_t; /*% * This function is called when reseeding is needed. It is allowed to * modify any state in the LFSR in any way it sees fit OTHER THAN "bits". * * It MUST set "count" to a new value or the lfsr will never reseed again. * * Also, a reseed will never occur in the middle of an extraction. This * is purely an optimization, and is probably what one would want. */ typedef void (*isc_lfsrreseed_t)(isc_lfsr_t *, void *); /*% * The members of this structure can be used by the application, but care * needs to be taken to not change state once the lfsr is in operation. */ struct isc_lfsr { isc_uint32_t state; /*%< previous state */ unsigned int bits; /*%< length */ isc_uint32_t tap; /*%< bit taps */ unsigned int count; /*%< reseed count (in BITS!) */ isc_lfsrreseed_t reseed; /*%< reseed function */ void *arg; /*%< reseed function argument */ }; ISC_LANG_BEGINDECLS void isc_lfsr_init(isc_lfsr_t *lfsr, isc_uint32_t state, unsigned int bits, isc_uint32_t tap, unsigned int count, isc_lfsrreseed_t reseed, void *arg); /*%< * Initialize an LFSR. * * Note: * *\li Putting untrusted values into this function will cause the LFSR to * generate (perhaps) non-maximal length sequences. * * Requires: * *\li lfsr != NULL * *\li 8 <= bits <= 32 * *\li tap != 0 */ void isc_lfsr_generate(isc_lfsr_t *lfsr, void *data, unsigned int count); /*%< * Returns "count" bytes of data from the LFSR. * * Requires: * *\li lfsr be valid. * *\li data != NULL. * *\li count > 0. */ void isc_lfsr_skip(isc_lfsr_t *lfsr, unsigned int skip); /*%< * Skip "skip" states. * * Requires: * *\li lfsr be valid. */ isc_uint32_t isc_lfsr_generate32(isc_lfsr_t *lfsr1, isc_lfsr_t *lfsr2); /*%< * Given two LFSRs, use the current state from each to skip entries in the * other. The next states are then xor'd together and returned. * * WARNING: * *\li This function is used only for very, very low security data, such * as DNS message IDs where it is desired to have an unpredictable * stream of bytes that are harder to predict than a simple flooding * attack. * * Notes: * *\li Since the current state from each of the LFSRs is used to skip * state in the other, it is important that no state be leaked * from either LFSR. * * Requires: * *\li lfsr1 and lfsr2 be valid. * *\li 1 <= skipbits <= 31 */ ISC_LANG_ENDDECLS #endif /* ISC_LFSR_H */ ����������������������������������������������������������������������������������������������������������������������bind9/isc/iterated_hash.h���������������������������������������������������������������������������0000644�����������������00000002025�14763166026�0011316 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_ITERATED_HASH_H #define ISC_ITERATED_HASH_H 1 #include <isc/lang.h> #include <isc/sha1.h> /* * The maximal hash length that can be encoded in a name * using base32hex. floor(255/8)*5 */ #define NSEC3_MAX_HASH_LENGTH 155 /* * The maximum has that can be encoded in a single label using * base32hex. floor(63/8)*5 */ #define NSEC3_MAX_LABEL_HASH 35 ISC_LANG_BEGINDECLS int isc_iterated_hash(unsigned char out[NSEC3_MAX_HASH_LENGTH], unsigned int hashalg, int iterations, const unsigned char *salt, int saltlength, const unsigned char *in, int inlength); ISC_LANG_ENDDECLS #endif /* ISC_ITERATED_HASH_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/os.h��������������������������������������������������������������������������������������0000644�����������������00000001236�14763166026�0007136 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_OS_H #define ISC_OS_H 1 /*! \file isc/os.h */ #include <isc/lang.h> ISC_LANG_BEGINDECLS unsigned int isc_os_ncpus(void); /*%< * Return the number of CPUs available on the system, or 1 if this cannot * be determined. */ ISC_LANG_ENDDECLS #endif /* ISC_OS_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/rwlock.h����������������������������������������������������������������������������������0000644�����������������00000007142�14763166026�0010020 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_RWLOCK_H #define ISC_RWLOCK_H 1 /*! \file isc/rwlock.h */ #include <isc/condition.h> #include <isc/lang.h> #include <isc/platform.h> #include <isc/types.h> #if defined(ISC_PLATFORM_HAVESTDATOMIC) #include <stdint.h> #include <stdatomic.h> #endif ISC_LANG_BEGINDECLS typedef enum { isc_rwlocktype_none = 0, isc_rwlocktype_read, isc_rwlocktype_write } isc_rwlocktype_t; #ifdef ISC_PLATFORM_USETHREADS #if (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE)) || (defined(ISC_PLATFORM_HAVEXADD) && defined(ISC_PLATFORM_HAVECMPXCHG)) #define ISC_RWLOCK_USEATOMIC 1 #if (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE)) #define ISC_RWLOCK_USESTDATOMIC 1 #endif #endif struct isc_rwlock { /* Unlocked. */ unsigned int magic; isc_mutex_t lock; isc_int32_t spins; #if defined(ISC_RWLOCK_USEATOMIC) /* * When some atomic instructions with hardware assistance are * available, rwlock will use those so that concurrent readers do not * interfere with each other through mutex as long as no writers * appear, massively reducing the lock overhead in the typical case. * * The basic algorithm of this approach is the "simple * writer-preference lock" shown in the following URL: * http://www.cs.rochester.edu/u/scott/synchronization/pseudocode/rw.html * but our implementation does not rely on the spin lock unlike the * original algorithm to be more portable as a user space application. */ /* Read or modified atomically. */ #if defined(ISC_RWLOCK_USESTDATOMIC) atomic_int_fast32_t write_requests; atomic_int_fast32_t write_completions; atomic_int_fast32_t cnt_and_flag; #else isc_int32_t write_requests; isc_int32_t write_completions; isc_int32_t cnt_and_flag; #endif /* Locked by lock. */ isc_condition_t readable; isc_condition_t writeable; unsigned int readers_waiting; /* Locked by rwlock itself. */ unsigned int write_granted; /* Unlocked. */ unsigned int write_quota; #else /* ISC_RWLOCK_USEATOMIC */ /*%< Locked by lock. */ isc_condition_t readable; isc_condition_t writeable; isc_rwlocktype_t type; /*% The number of threads that have the lock. */ unsigned int active; /*% * The number of lock grants made since the lock was last switched * from reading to writing or vice versa; used in determining * when the quota is reached and it is time to switch. */ unsigned int granted; unsigned int readers_waiting; unsigned int writers_waiting; unsigned int read_quota; unsigned int write_quota; isc_rwlocktype_t original; #endif /* ISC_RWLOCK_USEATOMIC */ }; #else /* ISC_PLATFORM_USETHREADS */ struct isc_rwlock { unsigned int magic; isc_rwlocktype_t type; unsigned int active; }; #endif /* ISC_PLATFORM_USETHREADS */ isc_result_t isc_rwlock_init(isc_rwlock_t *rwl, unsigned int read_quota, unsigned int write_quota); isc_result_t isc_rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type); isc_result_t isc_rwlock_trylock(isc_rwlock_t *rwl, isc_rwlocktype_t type); isc_result_t isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type); isc_result_t isc_rwlock_tryupgrade(isc_rwlock_t *rwl); void isc_rwlock_downgrade(isc_rwlock_t *rwl); void isc_rwlock_destroy(isc_rwlock_t *rwl); ISC_LANG_ENDDECLS #endif /* ISC_RWLOCK_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/errno.h�����������������������������������������������������������������������������������0000644�����������������00000001222�14763166026�0007635 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_ERRNO_H #define ISC_ERRNO_H 1 /*! \file isc/file.h */ #include <isc/types.h> ISC_LANG_BEGINDECLS isc_result_t isc_errno_toresult(int err); /*!< * \brief Convert a POSIX errno value to an ISC result code. */ ISC_LANG_ENDDECLS #endif /* ISC_ERRNO_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/lang.h������������������������������������������������������������������������������������0000644�����������������00000001174�14763166026�0007437 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_LANG_H #define ISC_LANG_H 1 /*! \file isc/lang.h */ #ifdef __cplusplus #define ISC_LANG_BEGINDECLS extern "C" { #define ISC_LANG_ENDDECLS } #else #define ISC_LANG_BEGINDECLS #define ISC_LANG_ENDDECLS #endif #endif /* ISC_LANG_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isc/ratelimiter.h�����������������������������������������������������������������������������0000644�����������������00000006611�14763166026�0011040 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_RATELIMITER_H #define ISC_RATELIMITER_H 1 /***** ***** Module Info *****/ /*! \file isc/ratelimiter.h * \brief A rate limiter is a mechanism for dispatching events at a limited * rate. This is intended to be used when sending zone maintenance * SOA queries, NOTIFY messages, etc. */ /*** *** Imports. ***/ #include <isc/lang.h> #include <isc/types.h> ISC_LANG_BEGINDECLS /***** ***** Functions. *****/ isc_result_t isc_ratelimiter_create(isc_mem_t *mctx, isc_timermgr_t *timermgr, isc_task_t *task, isc_ratelimiter_t **ratelimiterp); /*%< * Create a rate limiter. The execution interval is initially undefined. */ isc_result_t isc_ratelimiter_setinterval(isc_ratelimiter_t *rl, isc_interval_t *interval); /*!< * Set the minimum interval between event executions. * The interval value is copied, so the caller need not preserve it. * * Requires: * '*interval' is a nonzero interval. */ void isc_ratelimiter_setpertic(isc_ratelimiter_t *rl, isc_uint32_t perint); /*%< * Set the number of events processed per interval timer tick. * If 'perint' is zero it is treated as 1. */ void isc_ratelimiter_setpushpop(isc_ratelimiter_t *rl, isc_boolean_t pushpop); /*%< * Set / clear the ratelimiter to from push pop mode rather * first in - first out mode (default). */ isc_result_t isc_ratelimiter_enqueue(isc_ratelimiter_t *rl, isc_task_t *task, isc_event_t **eventp); /*%< * Queue an event for rate-limited execution. * * This is similar * to doing an isc_task_send() to the 'task', except that the * execution may be delayed to achieve the desired rate of * execution. * * '(*eventp)->ev_sender' is used to hold the task. The caller * must ensure that the task exists until the event is delivered. * * Requires: *\li An interval has been set by calling * isc_ratelimiter_setinterval(). * *\li 'task' to be non NULL. *\li '(*eventp)->ev_sender' to be NULL. */ isc_result_t isc_ratelimiter_dequeue(isc_ratelimiter_t *rl, isc_event_t *event); /* * Dequeue a event off the ratelimiter queue. * * Returns: * \li ISC_R_NOTFOUND if the event is no longer linked to the rate limiter. * \li ISC_R_SUCCESS */ void isc_ratelimiter_shutdown(isc_ratelimiter_t *ratelimiter); /*%< * Shut down a rate limiter. * * Ensures: *\li All events that have not yet been * dispatched to the task are dispatched immediately with * the #ISC_EVENTATTR_CANCELED bit set in ev_attributes. * *\li Further attempts to enqueue events will fail with * #ISC_R_SHUTTINGDOWN. * *\li The rate limiter is no longer attached to its task. */ void isc_ratelimiter_attach(isc_ratelimiter_t *source, isc_ratelimiter_t **target); /*%< * Attach to a rate limiter. */ void isc_ratelimiter_detach(isc_ratelimiter_t **ratelimiterp); /*%< * Detach from a rate limiter. */ isc_result_t isc_ratelimiter_stall(isc_ratelimiter_t *rl); /*%< * Stall event processing. */ isc_result_t isc_ratelimiter_release(isc_ratelimiter_t *rl); /*%< * Release a stalled rate limiter. */ ISC_LANG_ENDDECLS #endif /* ISC_RATELIMITER_H */ �����������������������������������������������������������������������������������������������������������������������bind9/isc/radix.h�����������������������������������������������������������������������������������0000644�����������������00000014576�14763166026�0007637 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #include <isc/magic.h> #include <isc/types.h> #include <isc/mutex.h> #include <isc/net.h> #include <isc/refcount.h> #include <string.h> #ifndef _RADIX_H #define _RADIX_H #define NETADDR_TO_PREFIX_T(na,pt,bits,is_ecs) \ do { \ const void *p = na; \ memset(&(pt), 0, sizeof(pt)); \ if (p != NULL) { \ (pt).family = (na)->family; \ (pt).bitlen = (bits); \ if ((pt).family == AF_INET6) { \ memmove(&(pt).add.sin6, &(na)->type.in6, \ ((bits)+7)/8); \ } else \ memmove(&(pt).add.sin, &(na)->type.in, \ ((bits)+7)/8); \ } else { \ (pt).family = AF_UNSPEC; \ (pt).bitlen = 0; \ } \ (pt).ecs = is_ecs; \ isc_refcount_init(&(pt).refcount, 0); \ } while(0) typedef struct isc_prefix { isc_mem_t *mctx; unsigned int family; /* AF_INET | AF_INET6, or AF_UNSPEC for "any" */ unsigned int bitlen; /* 0 for "any" */ isc_boolean_t ecs; /* ISC_TRUE for an EDNS client subnet address */ isc_refcount_t refcount; union { struct in_addr sin; struct in6_addr sin6; } add; } isc_prefix_t; typedef void (*isc_radix_destroyfunc_t)(void *); typedef void (*isc_radix_processfunc_t)(isc_prefix_t *, void **); #define isc_prefix_tochar(prefix) ((char *)&(prefix)->add.sin) #define isc_prefix_touchar(prefix) ((u_char *)&(prefix)->add.sin) #define BIT_TEST(f, b) ((f) & (b)) /* * We need "first match" when we search the radix tree to preserve * compatibility with the existing ACL implementation. Radix trees * naturally lend themselves to "best match". In order to get "first match" * behavior, we keep track of the order in which entries are added to the * tree--and when a search is made, we find all matching entries, and * return the one that was added first. * * An IPv4 prefix and an IPv6 prefix may share a radix tree node if they * have the same length and bit pattern (e.g., 127/8 and 7f::/8). Also, * a node that matches a client address may also match an EDNS client * subnet address. To disambiguate between these, node_num and data * are four-element arrays; * * - node_num[0] and data[0] are used for IPv4 client addresses * - node_num[1] and data[1] for IPv4 client subnet addresses * - node_num[2] and data[2] are used for IPv6 client addresses * - node_num[3] and data[3] for IPv6 client subnet addresses * * A prefix of 0/0 (aka "any" or "none"), is always stored as IPv4, * but matches IPv6 addresses too, as well as all client subnet * addresses. */ #define RADIX_NOECS 0 #define RADIX_ECS 2 #define RADIX_V4 0 #define RADIX_V6 1 #define RADIX_V4_ECS 2 #define RADIX_V6_ECS 3 #define RADIX_FAMILIES 4 #define ISC_RADIX_FAMILY(p) \ ((((p)->family == AF_INET6) ? RADIX_V6 : RADIX_V4) + \ ((p)->ecs ? RADIX_ECS : RADIX_NOECS)) typedef struct isc_radix_node { isc_mem_t *mctx; isc_uint32_t bit; /* bit length of the prefix */ isc_prefix_t *prefix; /* who we are in radix tree */ struct isc_radix_node *l, *r; /* left and right children */ struct isc_radix_node *parent; /* may be used */ void *data[RADIX_FAMILIES]; /* pointers to IPv4 and IPV6 data */ int node_num[RADIX_FAMILIES]; /* which node this was in the tree, or -1 for glue nodes */ } isc_radix_node_t; #define RADIX_TREE_MAGIC ISC_MAGIC('R','d','x','T'); #define RADIX_TREE_VALID(a) ISC_MAGIC_VALID(a, RADIX_TREE_MAGIC); typedef struct isc_radix_tree { unsigned int magic; isc_mem_t *mctx; isc_radix_node_t *head; isc_uint32_t maxbits; /* for IP, 32 bit addresses */ int num_active_node; /* for debugging purposes */ int num_added_node; /* total number of nodes */ } isc_radix_tree_t; isc_result_t isc_radix_search(isc_radix_tree_t *radix, isc_radix_node_t **target, isc_prefix_t *prefix); /*%< * Search 'radix' for the best match to 'prefix'. * Return the node found in '*target'. * * Requires: * \li 'radix' to be valid. * \li 'target' is not NULL and "*target" is NULL. * \li 'prefix' to be valid. * * Returns: * \li ISC_R_NOTFOUND * \li ISC_R_SUCCESS */ isc_result_t isc_radix_insert(isc_radix_tree_t *radix, isc_radix_node_t **target, isc_radix_node_t *source, isc_prefix_t *prefix); /*%< * Insert 'source' or 'prefix' into the radix tree 'radix'. * Return the node added in 'target'. * * Requires: * \li 'radix' to be valid. * \li 'target' is not NULL and "*target" is NULL. * \li 'prefix' to be valid or 'source' to be non NULL and contain * a valid prefix. * * Returns: * \li ISC_R_NOMEMORY * \li ISC_R_SUCCESS */ void isc_radix_remove(isc_radix_tree_t *radix, isc_radix_node_t *node); /*%< * Remove the node 'node' from the radix tree 'radix'. * * Requires: * \li 'radix' to be valid. * \li 'node' to be valid. */ isc_result_t isc_radix_create(isc_mem_t *mctx, isc_radix_tree_t **target, int maxbits); /*%< * Create a radix tree with a maximum depth of 'maxbits'; * * Requires: * \li 'mctx' to be valid. * \li 'target' to be non NULL and '*target' to be NULL. * \li 'maxbits' to be less than or equal to RADIX_MAXBITS. * * Returns: * \li ISC_R_NOMEMORY * \li ISC_R_SUCCESS */ void isc_radix_destroy(isc_radix_tree_t *radix, isc_radix_destroyfunc_t func); /*%< * Destroy a radix tree optionally calling 'func' to clean up node data. * * Requires: * \li 'radix' to be valid. */ void isc_radix_process(isc_radix_tree_t *radix, isc_radix_processfunc_t func); /*%< * Walk a radix tree calling 'func' to process node data. * * Requires: * \li 'radix' to be valid. * \li 'func' to point to a function. */ #define RADIX_MAXBITS 128 #define RADIX_NBIT(x) (0x80 >> ((x) & 0x7f)) #define RADIX_NBYTE(x) ((x) >> 3) #define RADIX_WALK(Xhead, Xnode) \ do { \ isc_radix_node_t *Xstack[RADIX_MAXBITS+1]; \ isc_radix_node_t **Xsp = Xstack; \ isc_radix_node_t *Xrn = (Xhead); \ while ((Xnode = Xrn)) { \ if (Xnode->prefix) #define RADIX_WALK_END \ if (Xrn->l) { \ if (Xrn->r) { \ *Xsp++ = Xrn->r; \ } \ Xrn = Xrn->l; \ } else if (Xrn->r) { \ Xrn = Xrn->r; \ } else if (Xsp != Xstack) { \ Xrn = *(--Xsp); \ } else { \ Xrn = (isc_radix_node_t *) 0; \ } \ } \ } while (0) #endif /* _RADIX_H */ ����������������������������������������������������������������������������������������������������������������������������������bind9/isc/mutex.h�����������������������������������������������������������������������������������0000644�����������������00000006704�14763166026�0007664 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISC_MUTEX_H #define ISC_MUTEX_H 1 /*! \file */ #include <pthread.h> #include <stdio.h> #include <isc/lang.h> #include <isc/result.h> /* for ISC_R_ codes */ ISC_LANG_BEGINDECLS /*! * Supply mutex attributes that enable deadlock detection * (helpful when debugging). This is system dependent and * currently only supported on NetBSD. */ #if ISC_MUTEX_DEBUG && defined(__NetBSD__) && defined(PTHREAD_MUTEX_ERRORCHECK) extern pthread_mutexattr_t isc__mutex_attrs; #define ISC__MUTEX_ATTRS &isc__mutex_attrs #else #define ISC__MUTEX_ATTRS NULL #endif /* XXX We could do fancier error handling... */ /*! * Define ISC_MUTEX_PROFILE to turn on profiling of mutexes by line. When * enabled, isc_mutex_stats() can be used to print a table showing the * number of times each type of mutex was locked and the amount of time * waiting to obtain the lock. */ #ifndef ISC_MUTEX_PROFILE #define ISC_MUTEX_PROFILE 0 #endif #if ISC_MUTEX_PROFILE typedef struct isc_mutexstats isc_mutexstats_t; typedef struct { pthread_mutex_t mutex; /*%< The actual mutex. */ isc_mutexstats_t * stats; /*%< Mutex statistics. */ } isc_mutex_t; #else typedef pthread_mutex_t isc_mutex_t; #endif #if ISC_MUTEX_PROFILE #define isc_mutex_init(mp) \ isc_mutex_init_profile((mp), __FILE__, __LINE__) #else #if ISC_MUTEX_DEBUG && defined(PTHREAD_MUTEX_ERRORCHECK) #define isc_mutex_init(mp) \ isc_mutex_init_errcheck((mp)) #else #define isc_mutex_init(mp) \ isc__mutex_init((mp), __FILE__, __LINE__) isc_result_t isc__mutex_init(isc_mutex_t *mp, const char *file, unsigned int line); #endif #endif #if ISC_MUTEX_PROFILE #define isc_mutex_lock(mp) \ isc_mutex_lock_profile((mp), __FILE__, __LINE__) #else #define isc_mutex_lock(mp) \ ((pthread_mutex_lock((mp)) == 0) ? \ ISC_R_SUCCESS : ISC_R_UNEXPECTED) #endif #if ISC_MUTEX_PROFILE #define isc_mutex_unlock(mp) \ isc_mutex_unlock_profile((mp), __FILE__, __LINE__) #else #define isc_mutex_unlock(mp) \ ((pthread_mutex_unlock((mp)) == 0) ? \ ISC_R_SUCCESS : ISC_R_UNEXPECTED) #endif #if ISC_MUTEX_PROFILE #define isc_mutex_trylock(mp) \ ((pthread_mutex_trylock((&(mp)->mutex)) == 0) ? \ ISC_R_SUCCESS : ISC_R_LOCKBUSY) #else #define isc_mutex_trylock(mp) \ ((pthread_mutex_trylock((mp)) == 0) ? \ ISC_R_SUCCESS : ISC_R_LOCKBUSY) #endif #if ISC_MUTEX_PROFILE #define isc_mutex_destroy(mp) \ ((pthread_mutex_destroy((&(mp)->mutex)) == 0) ? \ ISC_R_SUCCESS : ISC_R_UNEXPECTED) #else #define isc_mutex_destroy(mp) \ ((pthread_mutex_destroy((mp)) == 0) ? \ ISC_R_SUCCESS : ISC_R_UNEXPECTED) #endif #if ISC_MUTEX_PROFILE #define isc_mutex_stats(fp) isc_mutex_statsprofile(fp); #else #define isc_mutex_stats(fp) #endif #if ISC_MUTEX_PROFILE isc_result_t isc_mutex_init_profile(isc_mutex_t *mp, const char * _file, int _line); isc_result_t isc_mutex_lock_profile(isc_mutex_t *mp, const char * _file, int _line); isc_result_t isc_mutex_unlock_profile(isc_mutex_t *mp, const char * _file, int _line); void isc_mutex_statsprofile(FILE *fp); isc_result_t isc_mutex_init_errcheck(isc_mutex_t *mp); #endif /* ISC_MUTEX_PROFILE */ ISC_LANG_ENDDECLS #endif /* ISC_MUTEX_H */ ������������������������������������������������������������bind9/bind9/check.h���������������������������������������������������������������������������������0000644�����������������00000002145�14763166026�0010021 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef BIND9_CHECK_H #define BIND9_CHECK_H 1 /*! \file bind9/check.h */ #include <isc/lang.h> #include <isc/types.h> #include <isccfg/cfg.h> ISC_LANG_BEGINDECLS isc_result_t bind9_check_namedconf(const cfg_obj_t *config, isc_log_t *logctx, isc_mem_t *mctx); /*%< * Check the syntactic validity of a configuration parse tree generated from * a named.conf file. * * Requires: *\li config is a valid parse tree * *\li logctx is a valid logging context. * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_FAILURE */ isc_result_t bind9_check_key(const cfg_obj_t *config, isc_log_t *logctx); /*%< * Same as bind9_check_namedconf(), but for a single 'key' statement. */ ISC_LANG_ENDDECLS #endif /* BIND9_CHECK_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/bind9/version.h�������������������������������������������������������������������������������0000644�����������������00000001302�14763166026�0010423 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! \file bind9/version.h */ #include <isc/platform.h> LIBBIND9_EXTERNAL_DATA extern const char bind9_version[]; LIBBIND9_EXTERNAL_DATA extern const unsigned int bind9_libinterface; LIBBIND9_EXTERNAL_DATA extern const unsigned int bind9_librevision; LIBBIND9_EXTERNAL_DATA extern const unsigned int bind9_libage; ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/bind9/getaddresses.h��������������������������������������������������������������������������0000644�����������������00000003036�14763166026�0011421 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef BIND9_GETADDRESSES_H #define BIND9_GETADDRESSES_H 1 /*! \file bind9/getaddresses.h */ #include <isc/lang.h> #include <isc/types.h> #include <isc/net.h> ISC_LANG_BEGINDECLS isc_result_t bind9_getaddresses(const char *hostname, in_port_t port, isc_sockaddr_t *addrs, int addrsize, int *addrcount); /*%< * Use the system resolver to get the addresses associated with a hostname. * If successful, the number of addresses found is returned in 'addrcount'. * If a hostname lookup is performed and addresses of an unknown family is * seen, it is ignored. If more than 'addrsize' addresses are seen, the * first 'addrsize' are returned and the remainder silently truncated. * * This routine may block. If called by a program using the isc_app * framework, it should be surrounded by isc_app_block()/isc_app_unblock(). * * Requires: *\li 'hostname' is not NULL. *\li 'addrs' is not NULL. *\li 'addrsize' > 0 *\li 'addrcount' is not NULL. * * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOTFOUND *\li #ISC_R_FAMILYNOSUPPORT - 'hostname' is an IPv6 address, and IPv6 is * not supported. */ ISC_LANG_ENDDECLS #endif /* BIND9_GETADDRESSES_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/irs/dnsconf.h���������������������������������������������������������������������������������0000644�����������������00000004327�14763166026�0010172 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef IRS_DNSCONF_H #define IRS_DNSCONF_H 1 /*! \file * * \brief * The IRS dnsconf module parses an "advanced" configuration file related to * the DNS library, such as trusted keys for DNSSEC validation, and creates * the corresponding configuration objects for the DNS library modules. * * Notes: * This module is very experimental and the configuration syntax or library * interfaces may change in future versions. Currently, only the * 'trusted-keys' statement is supported, whose syntax is the same as the * same name of statement for named.conf. */ #include <irs/types.h> /*% * A compound structure storing DNS key information mainly for DNSSEC * validation. A dns_key_t object will be created using the 'keyname' and * 'keydatabuf' members with the dst_key_fromdns() function. */ typedef struct irs_dnsconf_dnskey { dns_name_t *keyname; isc_buffer_t *keydatabuf; ISC_LINK(struct irs_dnsconf_dnskey) link; } irs_dnsconf_dnskey_t; typedef ISC_LIST(irs_dnsconf_dnskey_t) irs_dnsconf_dnskeylist_t; ISC_LANG_BEGINDECLS isc_result_t irs_dnsconf_load(isc_mem_t *mctx, const char *filename, irs_dnsconf_t **confp); /*%< * Load the "advanced" DNS configuration file 'filename' in the "dns.conf" * format, and create a new irs_dnsconf_t object from the configuration. * * Requires: * *\li 'mctx' is a valid memory context. * *\li 'filename' != NULL * *\li 'confp' != NULL && '*confp' == NULL */ void irs_dnsconf_destroy(irs_dnsconf_t **confp); /*%< * Destroy the dnsconf object. * * Requires: * *\li '*confp' is a valid dnsconf object. * * Ensures: * *\li *confp == NULL */ irs_dnsconf_dnskeylist_t * irs_dnsconf_gettrustedkeys(irs_dnsconf_t *conf); /*%< * Return a list of key information stored in 'conf'. * * Requires: * *\li 'conf' is a valid dnsconf object. */ ISC_LANG_ENDDECLS #endif /* IRS_DNSCONF_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/irs/version.h���������������������������������������������������������������������������������0000644�����������������00000001242�14763166026�0010216 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! \file */ #include <irs/platform.h> LIBIRS_EXTERNAL_DATA extern const char irs_version[]; LIBIRS_EXTERNAL_DATA extern const unsigned int irs_libinterface; LIBIRS_EXTERNAL_DATA extern const unsigned int irs_librevision; LIBIRS_EXTERNAL_DATA extern const unsigned int irs_libage; ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/irs/types.h�����������������������������������������������������������������������������������0000644�����������������00000001402�14763166026�0007673 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef IRS_TYPES_H #define IRS_TYPES_H 1 /* Core Types. Alphabetized by defined type. */ /*%< per-thread IRS context */ typedef struct irs_context irs_context_t; /*%< resolv.conf configuration information */ typedef struct irs_resconf irs_resconf_t; /*%< advanced DNS-related configuration information */ typedef struct irs_dnsconf irs_dnsconf_t; #endif /* IRS_TYPES_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/irs/context.h���������������������������������������������������������������������������������0000644�����������������00000006651�14763166026�0010226 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef IRS_CONTEXT_H #define IRS_CONTEXT_H 1 /*! \file * * \brief * The IRS context module provides an abstract interface to the DNS library * with an application. An IRS context object initializes and holds various * resources used in the DNS library. */ #include <dns/types.h> #include <irs/types.h> ISC_LANG_BEGINDECLS isc_result_t irs_context_create(irs_context_t **contextp); /*%< * Create an IRS context. It internally initializes the ISC and DNS libraries * (if not yet), creates a DNS client object and initializes the client using * the configuration files parsed via the 'resconf' and 'dnsconf' IRS modules. * Some of the internally initialized objects can be used by the application * via irs_context_getxxx() functions (see below). * * Requires: * *\li contextp != NULL && *contextp == NULL. */ isc_result_t irs_context_get(irs_context_t **contextp); /*%< * Return an IRS context for the calling thread. If no IRS context is * associated to the thread, this function creates a new one by calling * irs_context_create(), and associates it with the thread as a thread specific * data value. This function is provided for standard libraries that are * expected to be thread-safe but do not accept an appropriate IRS context * as a library parameter, e.g., getaddrinfo(). * * Requires: * *\li contextp != NULL && *contextp == NULL. */ void irs_context_destroy(irs_context_t **contextp); /*%< * Destroy an IRS context. * * Requires: * *\li '*contextp' is a valid IRS context. * * Ensures: *\li '*contextp' == NULL. */ isc_mem_t * irs_context_getmctx(irs_context_t *context); /*%< * Return the memory context held in the context. * * Requires: * *\li 'context' is a valid IRS context. */ isc_appctx_t * irs_context_getappctx(irs_context_t *context); /*%< * Return the application context held in the context. * * Requires: * *\li 'context' is a valid IRS context. */ isc_taskmgr_t * irs_context_gettaskmgr(irs_context_t *context); /*%< * Return the task manager held in the context. * * Requires: * *\li 'context' is a valid IRS context. */ isc_timermgr_t * irs_context_gettimermgr(irs_context_t *context); /*%< * Return the timer manager held in the context. * * Requires: * *\li 'context' is a valid IRS context. */ isc_task_t * irs_context_gettask(irs_context_t *context); /*%< * Return the task object held in the context. * * Requires: * *\li 'context' is a valid IRS context. */ dns_client_t * irs_context_getdnsclient(irs_context_t *context); /*%< * Return the DNS client object held in the context. * * Requires: * *\li 'context' is a valid IRS context. */ irs_resconf_t * irs_context_getresconf(irs_context_t *context); /*%< * Return the resolver configuration object held in the context. * * Requires: * *\li 'context' is a valid IRS context. */ irs_dnsconf_t * irs_context_getdnsconf(irs_context_t *context); /*%< * Return the advanced DNS configuration object held in the context. * * Requires: * *\li 'context' is a valid IRS context. */ ISC_LANG_ENDDECLS #endif /* IRS_CONTEXT_H */ ���������������������������������������������������������������������������������������bind9/irs/platform.h��������������������������������������������������������������������������������0000644�����������������00000001501�14763166026�0010353 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! \file */ #ifndef IRS_PLATFORM_H #define IRS_PLATFORM_H 1 /***** ***** Platform-dependent defines. *****/ #ifndef IRS_PLATFORM_USEDECLSPEC #define LIBIRS_EXTERNAL_DATA #else #ifdef LIBIRS_EXPORTS #define LIBIRS_EXTERNAL_DATA __declspec(dllexport) #else #define LIBIRS_EXTERNAL_DATA __declspec(dllimport) #endif #endif /* * Tell Emacs to use C mode on this file. * Local Variables: * mode: c * End: */ #endif /* IRS_PLATFORM_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/irs/netdb.h�����������������������������������������������������������������������������������0000644�����������������00000013616�14763166026�0007635 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! \file */ #ifndef IRS_NETDB_H #define IRS_NETDB_H 1 #include <stddef.h> /* Required on FreeBSD (and others?) for size_t. */ #include <netdb.h> /* Contractual provision. */ /* * Define if <netdb.h> does not declare struct addrinfo. */ #undef ISC_IRS_NEEDADDRINFO #ifdef ISC_IRS_NEEDADDRINFO struct addrinfo { int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ int ai_family; /* PF_xxx */ int ai_socktype; /* SOCK_xxx */ int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ size_t ai_addrlen; /* Length of ai_addr */ char *ai_canonname; /* Canonical name for hostname */ struct sockaddr *ai_addr; /* Binary address */ struct addrinfo *ai_next; /* Next structure in linked list */ }; #endif /* * Undefine all #defines we are interested in as <netdb.h> may or may not have * defined them. */ /* * Error return codes from gethostbyname() and gethostbyaddr() * (left in extern int h_errno). */ #undef NETDB_INTERNAL #undef NETDB_SUCCESS #undef HOST_NOT_FOUND #undef TRY_AGAIN #undef NO_RECOVERY #undef NO_DATA #undef NO_ADDRESS #define NETDB_INTERNAL -1 /* see errno */ #define NETDB_SUCCESS 0 /* no problem */ #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ #define NO_DATA 4 /* Valid name, no data record of requested type */ #define NO_ADDRESS NO_DATA /* no address, look for MX record */ /* * Error return codes from getaddrinfo(). EAI_INSECUREDATA is our own extension * and it's very unlikely to be already defined, but undef it just in case; it * at least doesn't do any harm. */ #undef EAI_ADDRFAMILY #undef EAI_AGAIN #undef EAI_BADFLAGS #undef EAI_FAIL #undef EAI_FAMILY #undef EAI_MEMORY #undef EAI_NODATA #undef EAI_NONAME #undef EAI_SERVICE #undef EAI_SOCKTYPE #undef EAI_SYSTEM #undef EAI_BADHINTS #undef EAI_PROTOCOL #undef EAI_OVERFLOW #undef EAI_INSECUREDATA #undef EAI_MAX #define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ #define EAI_AGAIN 2 /* temporary failure in name resolution */ #define EAI_BADFLAGS 3 /* invalid value for ai_flags */ #define EAI_FAIL 4 /* non-recoverable failure in name resolution */ #define EAI_FAMILY 5 /* ai_family not supported */ #define EAI_MEMORY 6 /* memory allocation failure */ #define EAI_NODATA 7 /* no address associated with hostname */ #define EAI_NONAME 8 /* hostname nor servname provided, or not known */ #define EAI_SERVICE 9 /* servname not supported for ai_socktype */ #define EAI_SOCKTYPE 10 /* ai_socktype not supported */ #define EAI_SYSTEM 11 /* system error returned in errno */ #define EAI_BADHINTS 12 #define EAI_PROTOCOL 13 #define EAI_OVERFLOW 14 #define EAI_INSECUREDATA 15 #define EAI_MAX 16 /* * Flag values for getaddrinfo() */ #undef AI_PASSIVE #undef AI_CANONNAME #undef AI_NUMERICHOST #define AI_PASSIVE 0x00000001 #define AI_CANONNAME 0x00000002 #define AI_NUMERICHOST 0x00000004 /* * Flag values for getipnodebyname() */ #undef AI_V4MAPPED #undef AI_ALL #undef AI_ADDRCONFIG #undef AI_DEFAULT #define AI_V4MAPPED 0x00000008 #define AI_ALL 0x00000010 #define AI_ADDRCONFIG 0x00000020 #define AI_DEFAULT (AI_V4MAPPED|AI_ADDRCONFIG) /* * Constants for lwres_getnameinfo() */ #undef NI_MAXHOST #undef NI_MAXSERV #define NI_MAXHOST 1025 #define NI_MAXSERV 32 /* * Flag values for lwres_getnameinfo() */ #undef NI_NOFQDN #undef NI_NUMERICHOST #undef NI_NAMEREQD #undef NI_NUMERICSERV #undef NI_DGRAM #undef NI_NUMERICSCOPE #define NI_NOFQDN 0x00000001 #define NI_NUMERICHOST 0x00000002 #define NI_NAMEREQD 0x00000004 #define NI_NUMERICSERV 0x00000008 #define NI_DGRAM 0x00000010 /* * Define to map into irs_ namespace. */ #define IRS_NAMESPACE #ifdef IRS_NAMESPACE /* * Use our versions not the ones from the C library. */ #ifdef getnameinfo #undef getnameinfo #endif #define getnameinfo irs_getnameinfo #ifdef getaddrinfo #undef getaddrinfo #endif #define getaddrinfo irs_getaddrinfo #ifdef freeaddrinfo #undef freeaddrinfo #endif #define freeaddrinfo irs_freeaddrinfo #ifdef gai_strerror #undef gai_strerror #endif #define gai_strerror irs_gai_strerror #endif extern int getaddrinfo (const char *name, const char *service, const struct addrinfo *req, struct addrinfo **pai); extern int getnameinfo (const struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, int flags); extern void freeaddrinfo (struct addrinfo *ai); extern const char *gai_strerror (int ecode); /* * Define to map into irs_ namespace. */ #define IRS_NAMESPACE #ifdef IRS_NAMESPACE /* * Use our versions not the ones from the C library. */ #ifdef getnameinfo #undef getnameinfo #endif #define getnameinfo irs_getnameinfo #ifdef getaddrinfo #undef getaddrinfo #endif #define getaddrinfo irs_getaddrinfo #ifdef freeaddrinfo #undef freeaddrinfo #endif #define freeaddrinfo irs_freeaddrinfo #ifdef gai_strerror #undef gai_strerror #endif #define gai_strerror irs_gai_strerror int getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *hints, struct addrinfo **res); int getnameinfo(const struct sockaddr *sa, IRS_GETNAMEINFO_SOCKLEN_T salen, char *host, IRS_GETNAMEINFO_BUFLEN_T hostlen, char *serv, IRS_GETNAMEINFO_BUFLEN_T servlen, IRS_GETNAMEINFO_FLAGS_T flags); void freeaddrinfo (struct addrinfo *ai); IRS_GAISTRERROR_RETURN_T gai_strerror(int ecode); #endif /* * Tell Emacs to use C mode on this file. * Local variables: * mode: c * End: */ #endif /* IRS_NETDB_H */ ������������������������������������������������������������������������������������������������������������������bind9/irs/resconf.h���������������������������������������������������������������������������������0000644�����������������00000005221�14763166026�0010171 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef IRS_RESCONF_H #define IRS_RESCONF_H 1 /*! \file * * \brief * The IRS resconf module parses the legacy "/etc/resolv.conf" file and * creates the corresponding configuration objects for the DNS library * modules. */ #include <irs/types.h> /*% * A DNS search list specified in the 'domain' or 'search' statements * in the "resolv.conf" file. */ typedef struct irs_resconf_search { char *domain; ISC_LINK(struct irs_resconf_search) link; } irs_resconf_search_t; typedef ISC_LIST(irs_resconf_search_t) irs_resconf_searchlist_t; ISC_LANG_BEGINDECLS isc_result_t irs_resconf_load(isc_mem_t *mctx, const char *filename, irs_resconf_t **confp); /*%< * Load the resolver configuration file 'filename' in the "resolv.conf" format, * and create a new irs_resconf_t object from the configuration. If the file * is not found ISC_R_FILENOTFOUND is returned with the structure initialized * as if file contained only: * * nameserver ::1 * nameserver 127.0.0.1 * * Notes: * *\li Currently, only the following options are supported: * nameserver, domain, search, sortlist, ndots, and options. * In addition, 'sortlist' is not actually effective; it's parsed, but * the application cannot use the configuration. * * Returns: * \li ISC_R_SUCCESS on success * \li ISC_R_FILENOTFOUND if the file was not found. *confp will be valid. * \li other on error. * * Requires: * *\li 'mctx' is a valid memory context. * *\li 'filename' != NULL * *\li 'confp' != NULL && '*confp' == NULL */ void irs_resconf_destroy(irs_resconf_t **confp); /*%< * Destroy the resconf object. * * Requires: * *\li '*confp' is a valid resconf object. * * Ensures: * *\li *confp == NULL */ isc_sockaddrlist_t * irs_resconf_getnameservers(irs_resconf_t *conf); /*%< * Return a list of name server addresses stored in 'conf'. * * Requires: * *\li 'conf' is a valid resconf object. */ irs_resconf_searchlist_t * irs_resconf_getsearchlist(irs_resconf_t *conf); /*%< * Return the search list stored in 'conf'. * * Requires: * *\li 'conf' is a valid resconf object. */ unsigned int irs_resconf_getndots(irs_resconf_t *conf); /*%< * Return the 'ndots' value stored in 'conf'. * * Requires: * *\li 'conf' is a valid resconf object. */ ISC_LANG_ENDDECLS #endif /* IRS_RESCONF_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/lwres/version.h�������������������������������������������������������������������������������0000644�����������������00000001376�14763166026�0010565 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: version.h,v 1.9 2007/06/19 23:47:23 tbox Exp $ */ /*! \file lwres/version.h */ #include <lwres/platform.h> LIBLWRES_EXTERNAL_DATA extern const char lwres_version[]; LIBLWRES_EXTERNAL_DATA extern const unsigned int lwres_libinterface; LIBLWRES_EXTERNAL_DATA extern const unsigned int lwres_librevision; LIBLWRES_EXTERNAL_DATA extern const unsigned int lwres_libage; ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/lwres/result.h��������������������������������������������������������������������������������0000644�����������������00000002046�14763166026�0010411 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: result.h,v 1.21 2007/06/19 23:47:23 tbox Exp $ */ #ifndef LWRES_RESULT_H #define LWRES_RESULT_H 1 /*! \file lwres/result.h */ typedef unsigned int lwres_result_t; #define LWRES_R_SUCCESS 0 #define LWRES_R_NOMEMORY 1 #define LWRES_R_TIMEOUT 2 #define LWRES_R_NOTFOUND 3 #define LWRES_R_UNEXPECTEDEND 4 /* unexpected end of input */ #define LWRES_R_FAILURE 5 /* generic failure */ #define LWRES_R_IOERROR 6 #define LWRES_R_NOTIMPLEMENTED 7 #define LWRES_R_UNEXPECTED 8 #define LWRES_R_TRAILINGDATA 9 #define LWRES_R_INCOMPLETE 10 #define LWRES_R_RETRY 11 #define LWRES_R_TYPENOTFOUND 12 #define LWRES_R_TOOLARGE 13 #endif /* LWRES_RESULT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/lwres/context.h�������������������������������������������������������������������������������0000644�����������������00000006365�14763166026�0010567 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: context.h,v 1.23 2008/12/17 23:47:58 tbox Exp $ */ #ifndef LWRES_CONTEXT_H #define LWRES_CONTEXT_H 1 /*! \file lwres/context.h */ #include <stddef.h> #include <lwres/lang.h> #include <lwres/int.h> #include <lwres/result.h> /*! * Used to set various options such as timeout, authentication, etc */ typedef struct lwres_context lwres_context_t; LWRES_LANG_BEGINDECLS typedef void *(*lwres_malloc_t)(void *arg, size_t length); typedef void (*lwres_free_t)(void *arg, void *mem, size_t length); /* * XXXMLG * * Make the server reload /etc/resolv.conf periodically. * * Make the server do sortlist/searchlist. * * Client side can disable the search/sortlist processing. * * Use an array of addresses/masks and searchlist for client-side, and * if added to the client disable the processing on the server. * * Share /etc/resolv.conf data between contexts. */ /*! * _SERVERMODE * Don't allocate and connect a socket to the server, since the * caller _is_ a server. * * _USEIPV4, _USEIPV6 * Use IPv4 and IPv6 transactions with remote servers, respectively. * For backward compatibility, regard both flags as being set when both * are cleared. */ #define LWRES_CONTEXT_SERVERMODE 0x00000001U #define LWRES_CONTEXT_USEIPV4 0x00000002U #define LWRES_CONTEXT_USEIPV6 0x00000004U lwres_result_t lwres_context_create(lwres_context_t **contextp, void *arg, lwres_malloc_t malloc_function, lwres_free_t free_function, unsigned int flags); /**< * Allocate a lwres context. This is used in all lwres calls. * * Memory management can be replaced here by passing in two functions. * If one is non-NULL, they must both be non-NULL. "arg" is passed to * these functions. * * Contexts are not thread safe. Document at the top of the file. * XXXMLG * * If they are NULL, the standard malloc() and free() will be used. * *\pre contextp != NULL && contextp == NULL. * *\return Returns 0 on success, non-zero on failure. */ void lwres_context_destroy(lwres_context_t **contextp); /**< * Frees all memory associated with a lwres context. * *\pre contextp != NULL && contextp == NULL. */ lwres_uint32_t lwres_context_nextserial(lwres_context_t *ctx); /**< * XXXMLG Document */ void lwres_context_initserial(lwres_context_t *ctx, lwres_uint32_t serial); void lwres_context_freemem(lwres_context_t *ctx, void *mem, size_t len); void * lwres_context_allocmem(lwres_context_t *ctx, size_t len); int lwres_context_getsocket(lwres_context_t *ctx); lwres_result_t lwres_context_send(lwres_context_t *ctx, void *sendbase, int sendlen); lwres_result_t lwres_context_recv(lwres_context_t *ctx, void *recvbase, int recvlen, int *recvd_len); lwres_result_t lwres_context_sendrecv(lwres_context_t *ctx, void *sendbase, int sendlen, void *recvbase, int recvlen, int *recvd_len); LWRES_LANG_ENDDECLS #endif /* LWRES_CONTEXT_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/lwres/stdlib.h��������������������������������������������������������������������������������0000644�����������������00000001322�14763166026�0010350 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef LWRES_STDLIB_H #define LWRES_STDLIB_H 1 /*! \file lwres/stdlib.h */ #include <stdlib.h> #include <lwres/lang.h> #include <lwres/platform.h> #ifdef LWRES_PLATFORM_NEEDSTRTOUL #define strtoul lwres_strtoul #endif LWRES_LANG_BEGINDECLS unsigned long lwres_strtoul(const char *, char **, int); LWRES_LANG_ENDDECLS #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/lwres/lwbuffer.h������������������������������������������������������������������������������0000644�����������������00000021324�14763166026�0010707 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: lwbuffer.h,v 1.22 2007/06/19 23:47:23 tbox Exp $ */ /*! \file lwres/lwbuffer.h * * A buffer is a region of memory, together with a set of related subregions. * Buffers are used for parsing and I/O operations. * * The 'used region' and the 'available' region are disjoint, and their * union is the buffer's region. The used region extends from the beginning * of the buffer region to the last used byte. The available region * extends from one byte greater than the last used byte to the end of the * buffer's region. The size of the used region can be changed using various * buffer commands. Initially, the used region is empty. * * The used region is further subdivided into two disjoint regions: the * 'consumed region' and the 'remaining region'. The union of these two * regions is the used region. The consumed region extends from the beginning * of the used region to the byte before the 'current' offset (if any). The * 'remaining' region the current pointer to the end of the used * region. The size of the consumed region can be changed using various * buffer commands. Initially, the consumed region is empty. * * The 'active region' is an (optional) subregion of the remaining region. * It extends from the current offset to an offset in the remaining region * that is selected with lwres_buffer_setactive(). Initially, the active * region is empty. If the current offset advances beyond the chosen offset, * the active region will also be empty. * * \verbatim * /----- used region -----\/-- available --\ * +----------------------------------------+ * | consumed | remaining | | * +----------------------------------------+ * a b c d e * * a == base of buffer. * b == current pointer. Can be anywhere between a and d. * c == active pointer. Meaningful between b and d. * d == used pointer. * e == length of buffer. * * a-e == entire (length) of buffer. * a-d == used region. * a-b == consumed region. * b-d == remaining region. * b-c == optional active region. * \endverbatim * * The following invariants are maintained by all routines: * *\verbatim * length > 0 * * base is a valid pointer to length bytes of memory * * 0 <= used <= length * * 0 <= current <= used * * 0 <= active <= used * (although active < current implies empty active region) *\endverbatim * * \li MP: * Buffers have no synchronization. Clients must ensure exclusive * access. * * \li Reliability: * No anticipated impact. * * \li Resources: * Memory: 1 pointer + 6 unsigned integers per buffer. * * \li Security: * No anticipated impact. * * \li Standards: * None. */ #ifndef LWRES_LWBUFFER_H #define LWRES_LWBUFFER_H 1 /*** *** Imports ***/ #include <lwres/lang.h> #include <lwres/int.h> LWRES_LANG_BEGINDECLS /*** *** Magic numbers ***/ #define LWRES_BUFFER_MAGIC 0x4275663fU /* Buf?. */ #define LWRES_BUFFER_VALID(b) ((b) != NULL && \ (b)->magic == LWRES_BUFFER_MAGIC) /*! * The following macros MUST be used only on valid buffers. It is the * caller's responsibility to ensure this by using the LWRES_BUFFER_VALID * check above, or by calling another lwres_buffer_*() function (rather than * another macro.) */ /*! * Get the length of the used region of buffer "b" */ #define LWRES_BUFFER_USEDCOUNT(b) ((b)->used) /*! * Get the length of the available region of buffer "b" */ #define LWRES_BUFFER_AVAILABLECOUNT(b) ((b)->length - (b)->used) #define LWRES_BUFFER_REMAINING(b) ((b)->used - (b)->current) /*! * Note that the buffer structure is public. This is principally so buffer * operations can be implemented using macros. Applications are strongly * discouraged from directly manipulating the structure. */ typedef struct lwres_buffer lwres_buffer_t; /*! * Buffer data structure */ struct lwres_buffer { unsigned int magic; unsigned char *base; /* The following integers are byte offsets from 'base'. */ unsigned int length; unsigned int used; unsigned int current; unsigned int active; }; /*** *** Functions ***/ void lwres_buffer_init(lwres_buffer_t *b, void *base, unsigned int length); /**< * Make 'b' refer to the 'length'-byte region starting at base. * * Requires: * * 'length' > 0 * * 'base' is a pointer to a sequence of 'length' bytes. * */ void lwres_buffer_invalidate(lwres_buffer_t *b); /**< * Make 'b' an invalid buffer. * * Requires: * 'b' is a valid buffer. * * Ensures: * If assertion checking is enabled, future attempts to use 'b' without * calling lwres_buffer_init() on it will cause an assertion failure. */ void lwres_buffer_add(lwres_buffer_t *b, unsigned int n); /**< * Increase the 'used' region of 'b' by 'n' bytes. * * Requires: * * 'b' is a valid buffer * * used + n <= length * */ void lwres_buffer_subtract(lwres_buffer_t *b, unsigned int n); /**< * Decrease the 'used' region of 'b' by 'n' bytes. * * Requires: * * 'b' is a valid buffer * * used >= n * */ void lwres_buffer_clear(lwres_buffer_t *b); /**< * Make the used region empty. * * Requires: * * 'b' is a valid buffer * * Ensures: * * used = 0 * */ void lwres_buffer_first(lwres_buffer_t *b); /**< * Make the consumed region empty. * * Requires: * * 'b' is a valid buffer * * Ensures: * * current == 0 * */ void lwres_buffer_forward(lwres_buffer_t *b, unsigned int n); /**< * Increase the 'consumed' region of 'b' by 'n' bytes. * * Requires: * * 'b' is a valid buffer * * current + n <= used * */ void lwres_buffer_back(lwres_buffer_t *b, unsigned int n); /**< * Decrease the 'consumed' region of 'b' by 'n' bytes. * * Requires: * * 'b' is a valid buffer * * n <= current * */ lwres_uint8_t lwres_buffer_getuint8(lwres_buffer_t *b); /**< * Read an unsigned 8-bit integer from 'b' and return it. * * Requires: * * 'b' is a valid buffer. * * The length of the available region of 'b' is at least 1. * * Ensures: * * The current pointer in 'b' is advanced by 1. * * Returns: * * A 8-bit unsigned integer. */ void lwres_buffer_putuint8(lwres_buffer_t *b, lwres_uint8_t val); /**< * Store an unsigned 8-bit integer from 'val' into 'b'. * * Requires: * 'b' is a valid buffer. * * The length of the unused region of 'b' is at least 1. * * Ensures: * The used pointer in 'b' is advanced by 1. */ lwres_uint16_t lwres_buffer_getuint16(lwres_buffer_t *b); /**< * Read an unsigned 16-bit integer in network byte order from 'b', convert * it to host byte order, and return it. * * Requires: * * 'b' is a valid buffer. * * The length of the available region of 'b' is at least 2. * * Ensures: * * The current pointer in 'b' is advanced by 2. * * Returns: * * A 16-bit unsigned integer. */ void lwres_buffer_putuint16(lwres_buffer_t *b, lwres_uint16_t val); /**< * Store an unsigned 16-bit integer in host byte order from 'val' * into 'b' in network byte order. * * Requires: * 'b' is a valid buffer. * * The length of the unused region of 'b' is at least 2. * * Ensures: * The used pointer in 'b' is advanced by 2. */ lwres_uint32_t lwres_buffer_getuint32(lwres_buffer_t *b); /**< * Read an unsigned 32-bit integer in network byte order from 'b', convert * it to host byte order, and return it. * * Requires: * * 'b' is a valid buffer. * * The length of the available region of 'b' is at least 2. * * Ensures: * * The current pointer in 'b' is advanced by 2. * * Returns: * * A 32-bit unsigned integer. */ void lwres_buffer_putuint32(lwres_buffer_t *b, lwres_uint32_t val); /**< * Store an unsigned 32-bit integer in host byte order from 'val' * into 'b' in network byte order. * * Requires: * 'b' is a valid buffer. * * The length of the unused region of 'b' is at least 4. * * Ensures: * The used pointer in 'b' is advanced by 4. */ void lwres_buffer_putmem(lwres_buffer_t *b, const unsigned char *base, unsigned int length); /**< * Copy 'length' bytes of memory at 'base' into 'b'. * * Requires: * 'b' is a valid buffer. * * 'base' points to 'length' bytes of valid memory. * */ void lwres_buffer_getmem(lwres_buffer_t *b, unsigned char *base, unsigned int length); /**< * Copy 'length' bytes of memory from 'b' into 'base'. * * Requires: * 'b' is a valid buffer. * * 'base' points to at least 'length' bytes of valid memory. * * 'b' have at least 'length' bytes remaining. */ LWRES_LANG_ENDDECLS #endif /* LWRES_LWBUFFER_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/lwres/int.h�����������������������������������������������������������������������������������0000644�����������������00000001476�14763166026�0007673 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: int.h,v 1.14 2007/06/19 23:47:23 tbox Exp $ */ #ifndef LWRES_INT_H #define LWRES_INT_H 1 /*! \file lwres/int.h */ typedef char lwres_int8_t; typedef unsigned char lwres_uint8_t; typedef short lwres_int16_t; typedef unsigned short lwres_uint16_t; typedef int lwres_int32_t; typedef unsigned int lwres_uint32_t; typedef long long lwres_int64_t; typedef unsigned long long lwres_uint64_t; #endif /* LWRES_INT_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/lwres/platform.h������������������������������������������������������������������������������0000644�����������������00000005044�14763166026�0010720 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: platform.h.in,v 1.21 2007/06/19 23:47:23 tbox Exp $ */ /*! \file */ #ifndef LWRES_PLATFORM_H #define LWRES_PLATFORM_H 1 /***** ***** Platform-dependent defines. *****/ /*** *** Network. ***/ /* * Define if this system needs the <netinet/in6.h> header file for IPv6. */ #undef LWRES_PLATFORM_NEEDNETINETIN6H /* * Define if this system needs the <netinet6/in6.h> header file for IPv6. */ #undef LWRES_PLATFORM_NEEDNETINET6IN6H /* * If sockaddrs on this system have an sa_len field, LWRES_PLATFORM_HAVESALEN * will be defined. */ #undef LWRES_PLATFORM_HAVESALEN /* * If this system has the IPv6 structure definitions, LWRES_PLATFORM_HAVEIPV6 * will be defined. */ #define LWRES_PLATFORM_HAVEIPV6 1 /* * If this system is missing in6addr_any, LWRES_PLATFORM_NEEDIN6ADDRANY will * be defined. */ #undef LWRES_PLATFORM_NEEDIN6ADDRANY /* * If this system is missing in6addr_loopback, * LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK will be defined. */ #undef LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK /* * If this system has in_addr6, rather than in6_addr, * LWRES_PLATFORM_HAVEINADDR6 will be defined. */ #undef LWRES_PLATFORM_HAVEINADDR6 /* * Defined if unistd.h does not cause fd_set to be delared. */ #undef LWRES_PLATFORM_NEEDSYSSELECTH /* * Used to control how extern data is linked; needed for Win32 platforms. */ #undef LWRES_PLATFORM_USEDECLSPEC /* * Defined this system needs vsnprintf() and snprintf(). */ #undef LWRES_PLATFORM_NEEDVSNPRINTF /* * If this system need a modern sprintf() that returns (int) not (char*). */ /* * The printf format string modifier to use with lwres_uint64_t values. */ #define LWRES_PLATFORM_QUADFORMAT "ll" /*! \brief * Define if this system needs strtoul. */ #undef LWRES_PLATFORM_NEEDSTRTOUL /*! \brief * Define if this system needs strlcpy. */ #define LWRES_PLATFORM_NEEDSTRLCPY 1 #ifndef LWRES_PLATFORM_USEDECLSPEC #define LIBLWRES_EXTERNAL_DATA #else #ifdef LIBLWRES_EXPORTS #define LIBLWRES_EXTERNAL_DATA __declspec(dllexport) #else #define LIBLWRES_EXTERNAL_DATA __declspec(dllimport) #endif #endif /* * Tell Emacs to use C mode on this file. * Local Variables: * mode: c * End: */ #endif /* LWRES_PLATFORM_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/lwres/ipv6.h����������������������������������������������������������������������������������0000644�����������������00000005266�14763166026�0007766 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: ipv6.h,v 1.16 2007/06/19 23:47:23 tbox Exp $ */ #ifndef LWRES_IPV6_H #define LWRES_IPV6_H 1 /***** ***** Module Info *****/ /*! \file lwres/ipv6.h * IPv6 definitions for systems which do not support IPv6. */ /*** *** Imports. ***/ #include <lwres/int.h> #include <lwres/platform.h> /*** *** Types. ***/ /*% in6_addr structure */ struct in6_addr { union { lwres_uint8_t _S6_u8[16]; lwres_uint16_t _S6_u16[8]; lwres_uint32_t _S6_u32[4]; } _S6_un; }; /*@{*/ /*% IP v6 types */ #define s6_addr _S6_un._S6_u8 #define s6_addr8 _S6_un._S6_u8 #define s6_addr16 _S6_un._S6_u16 #define s6_addr32 _S6_un._S6_u32 /*@}*/ #define IN6ADDR_ANY_INIT {{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }}} #define IN6ADDR_LOOPBACK_INIT {{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }}} LIBLWRES_EXTERNAL_DATA extern const struct in6_addr in6addr_any; LIBLWRES_EXTERNAL_DATA extern const struct in6_addr in6addr_loopback; /*% used in getaddrinfo.c and getnameinfo.c */ struct sockaddr_in6 { #ifdef LWRES_PLATFORM_HAVESALEN lwres_uint8_t sin6_len; lwres_uint8_t sin6_family; #else lwres_uint16_t sin6_family; #endif lwres_uint16_t sin6_port; lwres_uint32_t sin6_flowinfo; struct in6_addr sin6_addr; lwres_uint32_t sin6_scope_id; }; #ifdef LWRES_PLATFORM_HAVESALEN #define SIN6_LEN 1 #endif /*% in6_pktinfo structure */ struct in6_pktinfo { struct in6_addr ipi6_addr; /*%< src/dst IPv6 address */ unsigned int ipi6_ifindex; /*%< send/recv interface index */ }; /*! * Unspecified IPv6 address */ #define IN6_IS_ADDR_UNSPECIFIED(a) \ (((a)->s6_addr32[0] == 0) && \ ((a)->s6_addr32[1] == 0) && \ ((a)->s6_addr32[2] == 0) && \ ((a)->s6_addr32[3] == 0)) /* * Loopback */ #define IN6_IS_ADDR_LOOPBACK(a) \ (((a)->s6_addr32[0] == 0) && \ ((a)->s6_addr32[1] == 0) && \ ((a)->s6_addr32[2] == 0) && \ ((a)->s6_addr32[3] == htonl(1))) /* * IPv4 compatible */ #define IN6_IS_ADDR_V4COMPAT(a) \ (((a)->s6_addr32[0] == 0) && \ ((a)->s6_addr32[1] == 0) && \ ((a)->s6_addr32[2] == 0) && \ ((a)->s6_addr32[3] != 0) && \ ((a)->s6_addr32[3] != htonl(1))) /* * Mapped */ #define IN6_IS_ADDR_V4MAPPED(a) \ (((a)->s6_addr32[0] == 0) && \ ((a)->s6_addr32[1] == 0) && \ ((a)->s6_addr32[2] == htonl(0x0000ffff))) #endif /* LWRES_IPV6_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/lwres/string.h��������������������������������������������������������������������������������0000644�����������������00000001330�14763166026�0010374 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef LWRES_STRING_H #define LWRES_STRING_H 1 /*! \file lwres/string.h */ #include <stdlib.h> #include <lwres/lang.h> #include <lwres/platform.h> #ifdef LWRES_PLATFORM_NEEDSTRLCPY #define strlcpy lwres_strlcpy #endif LWRES_LANG_BEGINDECLS size_t lwres_strlcpy(char *dst, const char *src, size_t size); LWRES_LANG_ENDDECLS #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/lwres/list.h����������������������������������������������������������������������������������0000644�����������������00000006362�14763166026�0010053 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: list.h,v 1.14 2007/06/19 23:47:23 tbox Exp $ */ #ifndef LWRES_LIST_H #define LWRES_LIST_H 1 /*! \file lwres/list.h */ #define LWRES_LIST(type) struct { type *head, *tail; } #define LWRES_LIST_INIT(list) \ do { (list).head = NULL; (list).tail = NULL; } while (0) #define LWRES_LINK(type) struct { type *prev, *next; } #define LWRES_LINK_INIT(elt, link) \ do { \ (elt)->link.prev = (void *)(-1); \ (elt)->link.next = (void *)(-1); \ } while (0) #define LWRES_LINK_LINKED(elt, link) \ ((void *)((elt)->link.prev) != (void *)(-1)) #define LWRES_LIST_HEAD(list) ((list).head) #define LWRES_LIST_TAIL(list) ((list).tail) #define LWRES_LIST_EMPTY(list) LWRES_TF((list).head == NULL) #define LWRES_LIST_PREPEND(list, elt, link) \ do { \ if ((list).head != NULL) \ (list).head->link.prev = (elt); \ else \ (list).tail = (elt); \ (elt)->link.prev = NULL; \ (elt)->link.next = (list).head; \ (list).head = (elt); \ } while (0) #define LWRES_LIST_APPEND(list, elt, link) \ do { \ if ((list).tail != NULL) \ (list).tail->link.next = (elt); \ else \ (list).head = (elt); \ (elt)->link.prev = (list).tail; \ (elt)->link.next = NULL; \ (list).tail = (elt); \ } while (0) #define LWRES_LIST_UNLINK(list, elt, link) \ do { \ if ((elt)->link.next != NULL) \ (elt)->link.next->link.prev = (elt)->link.prev; \ else \ (list).tail = (elt)->link.prev; \ if ((elt)->link.prev != NULL) \ (elt)->link.prev->link.next = (elt)->link.next; \ else \ (list).head = (elt)->link.next; \ (elt)->link.prev = (void *)(-1); \ (elt)->link.next = (void *)(-1); \ } while (0) #define LWRES_LIST_PREV(elt, link) ((elt)->link.prev) #define LWRES_LIST_NEXT(elt, link) ((elt)->link.next) #define LWRES_LIST_INSERTBEFORE(list, before, elt, link) \ do { \ if ((before)->link.prev == NULL) \ LWRES_LIST_PREPEND(list, elt, link); \ else { \ (elt)->link.prev = (before)->link.prev; \ (before)->link.prev = (elt); \ (elt)->link.prev->link.next = (elt); \ (elt)->link.next = (before); \ } \ } while (0) #define LWRES_LIST_INSERTAFTER(list, after, elt, link) \ do { \ if ((after)->link.next == NULL) \ LWRES_LIST_APPEND(list, elt, link); \ else { \ (elt)->link.next = (after)->link.next; \ (after)->link.next = (elt); \ (elt)->link.next->link.prev = (elt); \ (elt)->link.prev = (after); \ } \ } while (0) #define LWRES_LIST_APPENDLIST(list1, list2, link) \ do { \ if (LWRES_LIST_EMPTY(list1)) \ (list1) = (list2); \ else if (!LWRES_LIST_EMPTY(list2)) { \ (list1).tail->link.next = (list2).head; \ (list2).head->link.prev = (list1).tail; \ (list1).tail = (list2).tail; \ } \ (list2).head = NULL; \ (list2).tail = NULL; \ } while (0) #define LWRES_LIST_ENQUEUE(list, elt, link) LWRES_LIST_APPEND(list, elt, link) #define LWRES_LIST_DEQUEUE(list, elt, link) LWRES_LIST_UNLINK(list, elt, link) #endif /* LWRES_LIST_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/lwres/net.h�����������������������������������������������������������������������������������0000644�����������������00000006100�14763166026�0007654 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: net.h,v 1.9 2007/06/19 23:47:23 tbox Exp $ */ #ifndef LWRES_NET_H #define LWRES_NET_H 1 /***** ***** Module Info *****/ /*! \file net.h * This module is responsible for defining the following basic networking * types: * *\li struct in_addr *\li struct in6_addr *\li struct sockaddr *\li struct sockaddr_in *\li struct sockaddr_in6 * * It ensures that the AF_ and PF_ macros are defined. * * It declares ntoh[sl]() and hton[sl](). * * It declares lwres_net_aton(), lwres_net_ntop(), and lwres_net_pton(). * * It ensures that #INADDR_LOOPBACK, #INADDR_ANY and #IN6ADDR_ANY_INIT * are defined. */ /*** *** Imports. ***/ #include <lwres/platform.h> /* Required for LWRES_PLATFORM_*. */ #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> /* Contractual promise. */ #include <sys/ioctl.h> #include <sys/time.h> #include <sys/un.h> #include <netinet/in.h> /* Contractual promise. */ #include <arpa/inet.h> /* Contractual promise. */ #ifdef LWRES_PLATFORM_NEEDNETINETIN6H #include <netinet/in6.h> /* Required on UnixWare. */ #endif #ifdef LWRES_PLATFORM_NEEDNETINET6IN6H #include <netinet6/in6.h> /* Required on BSD/OS for in6_pktinfo. */ #endif #include <net/if.h> #include <lwres/lang.h> #ifndef LWRES_PLATFORM_HAVEIPV6 #include <lwres/ipv6.h> /* Contractual promise. */ #endif #ifdef LWRES_PLATFORM_HAVEINADDR6 #define in6_addr in_addr6 /* Required for pre RFC2133 implementations. */ #endif /*! * Required for some pre RFC2133 implementations. * IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT were added in * draft-ietf-ipngwg-bsd-api-04.txt or draft-ietf-ipngwg-bsd-api-05.txt. * If 's6_addr' is defined then assume that there is a union and three * levels otherwise assume two levels required. */ #ifndef IN6ADDR_ANY_INIT #ifdef s6_addr #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } #else #define IN6ADDR_ANY_INIT { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } #endif #endif /*! * Initialize address loopback. See IN6ADDR_ANY_INIT */ #ifndef IN6ADDR_LOOPBACK_INIT #ifdef s6_addr #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } #else #define IN6ADDR_LOOPBACK_INIT { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } #endif #endif /*% Used by AI_ALL */ #ifndef AF_INET6 #define AF_INET6 99 #endif /*% Used to return IPV6 address types. */ #ifndef PF_INET6 #define PF_INET6 AF_INET6 #endif /*% inaddr Loopback */ #ifndef INADDR_LOOPBACK #define INADDR_LOOPBACK 0x7f000001UL #endif LWRES_LANG_BEGINDECLS const char * lwres_net_ntop(int af, const void *src, char *dst, size_t size); int lwres_net_pton(int af, const char *src, void *dst); int lwres_net_aton(const char *cp, struct in_addr *addr); LWRES_LANG_ENDDECLS #endif /* LWRES_NET_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/lwres/lwres.h���������������������������������������������������������������������������������0000644�����������������00000036472�14763166026�0010241 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: lwres.h,v 1.57 2007/06/19 23:47:23 tbox Exp $ */ #ifndef LWRES_LWRES_H #define LWRES_LWRES_H 1 #include <stdio.h> #include <lwres/context.h> #include <lwres/lang.h> #include <lwres/list.h> #include <lwres/lwpacket.h> #include <lwres/platform.h> /*! \file lwres/lwres.h */ /*! * Design notes: * * Each opcode has two structures and three functions which operate on each * structure. For example, using the "no operation/ping" opcode as an * example: * * <ul><li>lwres_nooprequest_t: * * lwres_nooprequest_render() takes a lwres_nooprequest_t and * and renders it into wire format, storing the allocated * buffer information in a passed-in buffer. When this buffer * is no longer needed, it must be freed by * lwres_context_freemem(). All other memory used by the * caller must be freed manually, including the * lwres_nooprequest_t passed in.<br /><br /> * * lwres_nooprequest_parse() takes a wire format message and * breaks it out into a lwres_nooprequest_t. The structure * must be freed via lwres_nooprequest_free() when it is no longer * needed.<br /><br /> * * lwres_nooprequest_free() releases into the lwres_context_t * any space allocated during parsing.</li> * * <li>lwres_noopresponse_t: * * The functions used are similar to the three used for * requests, just with different names.</li></ul> * * Typically, the client will use request_render, response_parse, and * response_free, while the daemon will use request_parse, response_render, * and request_free. * * The basic flow of a typical client is: * * \li fill in a request_t, and call the render function. * * \li Transmit the buffer returned to the daemon. * * \li Wait for a response. * * \li When a response is received, parse it into a response_t. * * \li free the request buffer using lwres_context_freemem(). * * \li free the response structure and its associated buffer using * response_free(). */ #define LWRES_UDP_PORT 921 /*%< UDP Port Number */ #define LWRES_RECVLENGTH 16384 /*%< Maximum Packet Length */ #define LWRES_ADDR_MAXLEN 16 /*%< changing this breaks ABI */ #define LWRES_RESOLV_CONF "/etc/resolv.conf" /*%< Location of resolv.conf */ /*% DNSSEC is not required (input). Only relevant to rrset queries. */ #define LWRES_FLAG_TRUSTNOTREQUIRED 0x00000001U /*% The data was crypto-verified with DNSSEC (output). */ #define LWRES_FLAG_SECUREDATA 0x00000002U /*% no-op */ #define LWRES_OPCODE_NOOP 0x00000000U /*% lwres_nooprequest_t */ typedef struct { /* public */ lwres_uint16_t datalength; unsigned char *data; } lwres_nooprequest_t; /*% lwres_noopresponse_t */ typedef struct { /* public */ lwres_uint16_t datalength; unsigned char *data; } lwres_noopresponse_t; /*% get addresses by name */ #define LWRES_OPCODE_GETADDRSBYNAME 0x00010001U /*% lwres_addr_t */ typedef struct lwres_addr lwres_addr_t; /*% LWRES_LIST */ typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t; /*% lwres_addr */ struct lwres_addr { lwres_uint32_t family; lwres_uint16_t length; unsigned char address[LWRES_ADDR_MAXLEN]; lwres_uint32_t zone; LWRES_LINK(lwres_addr_t) link; }; /*% lwres_gabnrequest_t */ typedef struct { /* public */ lwres_uint32_t flags; lwres_uint32_t addrtypes; lwres_uint16_t namelen; char *name; } lwres_gabnrequest_t; /*% lwres_gabnresponse_t */ typedef struct { /* public */ lwres_uint32_t flags; lwres_uint16_t naliases; lwres_uint16_t naddrs; char *realname; char **aliases; lwres_uint16_t realnamelen; lwres_uint16_t *aliaslen; lwres_addrlist_t addrs; /*! if base != NULL, it will be freed when this structure is freed. */ void *base; size_t baselen; } lwres_gabnresponse_t; /*% get name by address */ #define LWRES_OPCODE_GETNAMEBYADDR 0x00010002U /*% lwres_gnbarequest_t */ typedef struct { /* public */ lwres_uint32_t flags; lwres_addr_t addr; } lwres_gnbarequest_t; /*% lwres_gnbaresponse_t */ typedef struct { /* public */ lwres_uint32_t flags; lwres_uint16_t naliases; char *realname; char **aliases; lwres_uint16_t realnamelen; lwres_uint16_t *aliaslen; /*! if base != NULL, it will be freed when this structure is freed. */ void *base; size_t baselen; } lwres_gnbaresponse_t; /*% get rdata by name */ #define LWRES_OPCODE_GETRDATABYNAME 0x00010003U /*% lwres_grbnrequest_t */ typedef struct { /* public */ lwres_uint32_t flags; lwres_uint16_t rdclass; lwres_uint16_t rdtype; lwres_uint16_t namelen; char *name; } lwres_grbnrequest_t; /*% lwres_grbnresponse_t */ typedef struct { /* public */ lwres_uint32_t flags; lwres_uint16_t rdclass; lwres_uint16_t rdtype; lwres_uint32_t ttl; lwres_uint16_t nrdatas; lwres_uint16_t nsigs; char *realname; lwres_uint16_t realnamelen; unsigned char **rdatas; lwres_uint16_t *rdatalen; unsigned char **sigs; lwres_uint16_t *siglen; /*% if base != NULL, it will be freed when this structure is freed. */ void *base; size_t baselen; } lwres_grbnresponse_t; /*% Used by lwres_getrrsetbyname() */ #define LWRDATA_VALIDATED 0x00000001 /*! * resolv.conf data */ #define LWRES_CONFMAXNAMESERVERS 3 /*%< max 3 "nameserver" entries */ #define LWRES_CONFMAXLWSERVERS 1 /*%< max 1 "lwserver" entry */ #define LWRES_CONFMAXSEARCH 8 /*%< max 8 domains in "search" entry */ #define LWRES_CONFMAXLINELEN 256 /*%< max size of a line */ #define LWRES_CONFMAXSORTLIST 10 /*%< max 10 */ /*% lwres_conf_t */ typedef struct { lwres_context_t *lwctx; lwres_addr_t nameservers[LWRES_CONFMAXNAMESERVERS]; lwres_uint8_t nsnext; /*%< index for next free slot */ lwres_addr_t lwservers[LWRES_CONFMAXLWSERVERS]; lwres_uint8_t lwnext; /*%< index for next free slot */ char *domainname; char *search[LWRES_CONFMAXSEARCH]; lwres_uint8_t searchnxt; /*%< index for next free slot */ struct { lwres_addr_t addr; /*% mask has a non-zero 'family' and 'length' if set */ lwres_addr_t mask; } sortlist[LWRES_CONFMAXSORTLIST]; lwres_uint8_t sortlistnxt; lwres_uint8_t resdebug; /*%< non-zero if 'options debug' set */ lwres_uint8_t ndots; /*%< set to n in 'options ndots:n' */ lwres_uint8_t no_tld_query; /*%< non-zero if 'options no_tld_query' */ lwres_int32_t attempts; /*%< set to n in 'options attempts:n' */ lwres_int32_t timeout; /*%< set to n in 'options timeout:n' */ } lwres_conf_t; #define LWRES_ADDRTYPE_V4 0x00000001U /*%< ipv4 */ #define LWRES_ADDRTYPE_V6 0x00000002U /*%< ipv6 */ #define LWRES_MAX_ALIASES 16 /*%< max # of aliases */ #define LWRES_MAX_ADDRS 64 /*%< max # of addrs */ LWRES_LANG_BEGINDECLS /*% This is in host byte order. */ LIBLWRES_EXTERNAL_DATA extern lwres_uint16_t lwres_udp_port; LIBLWRES_EXTERNAL_DATA extern const char *lwres_resolv_conf; lwres_result_t lwres_gabnrequest_render(lwres_context_t *ctx, lwres_gabnrequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b); lwres_result_t lwres_gabnresponse_render(lwres_context_t *ctx, lwres_gabnresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b); lwres_result_t lwres_gabnrequest_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gabnrequest_t **structp); lwres_result_t lwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gabnresponse_t **structp); void lwres_gabnrequest_free(lwres_context_t *ctx, lwres_gabnrequest_t **structp); /**< * Frees any dynamically allocated memory for this structure. * * Requires: * * ctx != NULL, and be a context returned via lwres_context_create(). * * structp != NULL && *structp != NULL. * * Ensures: * * *structp == NULL. * * All memory allocated by this structure will be returned to the * system via the context's free function. */ void lwres_gabnresponse_free(lwres_context_t *ctx, lwres_gabnresponse_t **structp); /**< * Frees any dynamically allocated memory for this structure. * * Requires: * * ctx != NULL, and be a context returned via lwres_context_create(). * * structp != NULL && *structp != NULL. * * Ensures: * * *structp == NULL. * * All memory allocated by this structure will be returned to the * system via the context's free function. */ lwres_result_t lwres_gnbarequest_render(lwres_context_t *ctx, lwres_gnbarequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b); lwres_result_t lwres_gnbaresponse_render(lwres_context_t *ctx, lwres_gnbaresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b); lwres_result_t lwres_gnbarequest_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gnbarequest_t **structp); lwres_result_t lwres_gnbaresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gnbaresponse_t **structp); void lwres_gnbarequest_free(lwres_context_t *ctx, lwres_gnbarequest_t **structp); /**< * Frees any dynamically allocated memory for this structure. * * Requires: * * ctx != NULL, and be a context returned via lwres_context_create(). * * structp != NULL && *structp != NULL. * * Ensures: * * *structp == NULL. * * All memory allocated by this structure will be returned to the * system via the context's free function. */ void lwres_gnbaresponse_free(lwres_context_t *ctx, lwres_gnbaresponse_t **structp); /**< * Frees any dynamically allocated memory for this structure. * * Requires: * * ctx != NULL, and be a context returned via lwres_context_create(). * * structp != NULL && *structp != NULL. * * Ensures: * * *structp == NULL. * * All memory allocated by this structure will be returned to the * system via the context's free function. */ lwres_result_t lwres_grbnrequest_render(lwres_context_t *ctx, lwres_grbnrequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b); lwres_result_t lwres_grbnresponse_render(lwres_context_t *ctx, lwres_grbnresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b); lwres_result_t lwres_grbnrequest_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_grbnrequest_t **structp); lwres_result_t lwres_grbnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_grbnresponse_t **structp); void lwres_grbnrequest_free(lwres_context_t *ctx, lwres_grbnrequest_t **structp); /**< * Frees any dynamically allocated memory for this structure. * * Requires: * * ctx != NULL, and be a context returned via lwres_context_create(). * * structp != NULL && *structp != NULL. * * Ensures: * * *structp == NULL. * * All memory allocated by this structure will be returned to the * system via the context's free function. */ void lwres_grbnresponse_free(lwres_context_t *ctx, lwres_grbnresponse_t **structp); /**< * Frees any dynamically allocated memory for this structure. * * Requires: * * ctx != NULL, and be a context returned via lwres_context_create(). * * structp != NULL && *structp != NULL. * * Ensures: * * *structp == NULL. * * All memory allocated by this structure will be returned to the * system via the context's free function. */ lwres_result_t lwres_nooprequest_render(lwres_context_t *ctx, lwres_nooprequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b); /**< * Allocate space and render into wire format a noop request packet. * * Requires: * * ctx != NULL, and be a context returned via lwres_context_create(). * * b != NULL, and points to a lwres_buffer_t. The contents of the * buffer structure will be initialized to contain the wire-format * noop request packet. * * Caller needs to fill in parts of "pkt" before calling: * serial, maxrecv, result. * * Returns: * * Returns 0 on success, non-zero on failure. * * On successful return, *b will contain data about the wire-format * packet. It can be transmitted in any way, including lwres_sendblock(). */ lwres_result_t lwres_noopresponse_render(lwres_context_t *ctx, lwres_noopresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b); lwres_result_t lwres_nooprequest_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_nooprequest_t **structp); /**< * Parse a noop request. Note that to get here, the lwpacket must have * already been parsed and removed by the caller, otherwise it would be * pretty hard for it to know this is the right function to call. * * The function verifies bits of the header, but does not modify it. */ lwres_result_t lwres_noopresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_noopresponse_t **structp); void lwres_nooprequest_free(lwres_context_t *ctx, lwres_nooprequest_t **structp); void lwres_noopresponse_free(lwres_context_t *ctx, lwres_noopresponse_t **structp); /**< * Frees any dynamically allocated memory for this structure. * * Requires: * * ctx != NULL, and be a context returned via lwres_context_create(). * * structp != NULL && *structp != NULL. * * Ensures: * * *structp == NULL. * * All memory allocated by this structure will be returned to the * system via the context's free function. */ lwres_result_t lwres_conf_parse(lwres_context_t *ctx, const char *filename); /**< * parses a resolv.conf-format file and stores the results in the structure * pointed to by *ctx. * * Requires: * ctx != NULL * filename != NULL && strlen(filename) > 0 * * Returns: * LWRES_R_SUCCESS on a successful parse. * Anything else on error, although the structure may be partially filled * in. */ lwres_result_t lwres_conf_print(lwres_context_t *ctx, FILE *fp); /**< * Prints a resolv.conf-format of confdata output to fp. * * Requires: * ctx != NULL */ void lwres_conf_init(lwres_context_t *ctx); /**< * sets all internal fields to a default state. Used to initialize a new * lwres_conf_t structure (not reset a used on). * * Requires: * ctx != NULL */ void lwres_conf_clear(lwres_context_t *ctx); /**< * frees all internally allocated memory in confdata. Uses the memory * routines supplied by ctx. * * Requires: * ctx != NULL */ lwres_conf_t * lwres_conf_get(lwres_context_t *ctx); /**< * Be extremely cautions in modifying the contents of this structure; it * needs an API to return the various bits of data, walk lists, etc. * * Requires: * ctx != NULL */ /* * Helper functions */ lwres_result_t lwres_data_parse(lwres_buffer_t *b, unsigned char **p, lwres_uint16_t *len); lwres_result_t lwres_string_parse(lwres_buffer_t *b, char **c, lwres_uint16_t *len); lwres_result_t lwres_addr_parse(lwres_buffer_t *b, lwres_addr_t *addr); lwres_result_t lwres_getaddrsbyname(lwres_context_t *ctx, const char *name, lwres_uint32_t addrtypes, lwres_gabnresponse_t **structp); lwres_result_t lwres_getnamebyaddr(lwres_context_t *ctx, lwres_uint32_t addrtype, lwres_uint16_t addrlen, const unsigned char *addr, lwres_gnbaresponse_t **structp); lwres_result_t lwres_getrdatabyname(lwres_context_t *ctx, const char *name, lwres_uint16_t rdclass, lwres_uint16_t rdtype, lwres_uint32_t flags, lwres_grbnresponse_t **structp); LWRES_LANG_ENDDECLS #endif /* LWRES_LWRES_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/lwres/netdb.h���������������������������������������������������������������������������������0000644�����������������00000030343�14763166026�0010170 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: netdb.h.in,v 1.41 2009/01/18 23:48:14 tbox Exp $ */ /*! \file */ #ifndef LWRES_NETDB_H #define LWRES_NETDB_H 1 #include <stddef.h> /* Required on FreeBSD (and others?) for size_t. */ #include <netdb.h> /* Contractual provision. */ #include <lwres/lang.h> /* * Define if <netdb.h> does not declare struct addrinfo. */ #undef ISC_LWRES_NEEDADDRINFO #ifdef ISC_LWRES_NEEDADDRINFO struct addrinfo { int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ int ai_family; /* PF_xxx */ int ai_socktype; /* SOCK_xxx */ int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ size_t ai_addrlen; /* Length of ai_addr */ char *ai_canonname; /* Canonical name for hostname */ struct sockaddr *ai_addr; /* Binary address */ struct addrinfo *ai_next; /* Next structure in linked list */ }; #endif /* * Undefine all #defines we are interested in as <netdb.h> may or may not have * defined them. */ /* * Error return codes from gethostbyname() and gethostbyaddr() * (left in extern int h_errno). */ #undef NETDB_INTERNAL #undef NETDB_SUCCESS #undef HOST_NOT_FOUND #undef TRY_AGAIN #undef NO_RECOVERY #undef NO_DATA #undef NO_ADDRESS #define NETDB_INTERNAL -1 /* see errno */ #define NETDB_SUCCESS 0 /* no problem */ #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ #define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL */ #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ #define NO_DATA 4 /* Valid name, no data record of requested type */ #define NO_ADDRESS NO_DATA /* no address, look for MX record */ /* * Error return codes from getaddrinfo() */ #undef EAI_ADDRFAMILY #undef EAI_AGAIN #undef EAI_BADFLAGS #undef EAI_FAIL #undef EAI_FAMILY #undef EAI_MEMORY #undef EAI_NODATA #undef EAI_NONAME #undef EAI_SERVICE #undef EAI_SOCKTYPE #undef EAI_SYSTEM #undef EAI_BADHINTS #undef EAI_PROTOCOL #undef EAI_OVERFLOW #undef EAI_MAX #define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ #define EAI_AGAIN 2 /* temporary failure in name resolution */ #define EAI_BADFLAGS 3 /* invalid value for ai_flags */ #define EAI_FAIL 4 /* non-recoverable failure in name resolution */ #define EAI_FAMILY 5 /* ai_family not supported */ #define EAI_MEMORY 6 /* memory allocation failure */ #define EAI_NODATA 7 /* no address associated with hostname */ #define EAI_NONAME 8 /* hostname nor servname provided, or not known */ #define EAI_SERVICE 9 /* servname not supported for ai_socktype */ #define EAI_SOCKTYPE 10 /* ai_socktype not supported */ #define EAI_SYSTEM 11 /* system error returned in errno */ #define EAI_BADHINTS 12 #define EAI_PROTOCOL 13 #define EAI_OVERFLOW 14 #define EAI_MAX 15 /* * Flag values for getaddrinfo() */ #undef AI_PASSIVE #undef AI_CANONNAME #undef AI_NUMERICHOST #define AI_PASSIVE 0x00000001 #define AI_CANONNAME 0x00000002 #define AI_NUMERICHOST 0x00000004 /* * Flag values for getipnodebyname() */ #undef AI_V4MAPPED #undef AI_ALL #undef AI_ADDRCONFIG #undef AI_DEFAULT #define AI_V4MAPPED 0x00000008 #define AI_ALL 0x00000010 #define AI_ADDRCONFIG 0x00000020 #define AI_DEFAULT (AI_V4MAPPED|AI_ADDRCONFIG) /* * Constants for lwres_getnameinfo() */ #undef NI_MAXHOST #undef NI_MAXSERV #define NI_MAXHOST 1025 #define NI_MAXSERV 32 /* * Flag values for lwres_getnameinfo() */ #undef NI_NOFQDN #undef NI_NUMERICHOST #undef NI_NAMEREQD #undef NI_NUMERICSERV #undef NI_DGRAM #undef NI_NUMERICSCOPE #define NI_NOFQDN 0x00000001 #define NI_NUMERICHOST 0x00000002 #define NI_NAMEREQD 0x00000004 #define NI_NUMERICSERV 0x00000008 #define NI_DGRAM 0x00000010 #define NI_NUMERICSCOPE 0x00000020 /*2553bis-00*/ /* * Define if <netdb.h> does not declare struct rrsetinfo. */ #define ISC_LWRES_NEEDRRSETINFO 1 #ifdef ISC_LWRES_NEEDRRSETINFO /* * Structures for getrrsetbyname() */ struct rdatainfo { unsigned int rdi_length; unsigned char *rdi_data; }; struct rrsetinfo { unsigned int rri_flags; int rri_rdclass; int rri_rdtype; unsigned int rri_ttl; unsigned int rri_nrdatas; unsigned int rri_nsigs; char *rri_name; struct rdatainfo *rri_rdatas; struct rdatainfo *rri_sigs; }; /* * Flags for getrrsetbyname() */ #define RRSET_VALIDATED 0x00000001 /* Set was dnssec validated */ /* * Return codes for getrrsetbyname() */ #define ERRSET_SUCCESS 0 #define ERRSET_NOMEMORY 1 #define ERRSET_FAIL 2 #define ERRSET_INVAL 3 #define ERRSET_NONAME 4 #define ERRSET_NODATA 5 #endif /* * Define to map into lwres_ namespace. */ #define LWRES_NAMESPACE #ifdef LWRES_NAMESPACE /* * Use our versions not the ones from the C library. */ #ifdef getnameinfo #undef getnameinfo #endif #define getnameinfo lwres_getnameinfo #ifdef getaddrinfo #undef getaddrinfo #endif #define getaddrinfo lwres_getaddrinfo #ifdef freeaddrinfo #undef freeaddrinfo #endif #define freeaddrinfo lwres_freeaddrinfo #ifdef gai_strerror #undef gai_strerror #endif #define gai_strerror lwres_gai_strerror #ifdef herror #undef herror #endif #define herror lwres_herror #ifdef hstrerror #undef hstrerror #endif #define hstrerror lwres_hstrerror #ifdef getipnodebyname #undef getipnodebyname #endif #define getipnodebyname lwres_getipnodebyname #ifdef getipnodebyaddr #undef getipnodebyaddr #endif #define getipnodebyaddr lwres_getipnodebyaddr #ifdef freehostent #undef freehostent #endif #define freehostent lwres_freehostent #ifdef gethostbyname #undef gethostbyname #endif #define gethostbyname lwres_gethostbyname #ifdef gethostbyname2 #undef gethostbyname2 #endif #define gethostbyname2 lwres_gethostbyname2 #ifdef gethostbyaddr #undef gethostbyaddr #endif #define gethostbyaddr lwres_gethostbyaddr #ifdef gethostent #undef gethostent #endif #define gethostent lwres_gethostent #ifdef sethostent #undef sethostent #endif #define sethostent lwres_sethostent #ifdef endhostent #undef endhostent #endif #define endhostent lwres_endhostent /* #define sethostfile lwres_sethostfile */ #ifdef gethostbyname_r #undef gethostbyname_r #endif #define gethostbyname_r lwres_gethostbyname_r #ifdef gethostbyaddr_r #undef gethostbyaddr_r #endif #define gethostbyaddr_r lwres_gethostbyaddr_r #ifdef gethostent_r #undef gethostent_r #endif #define gethostent_r lwres_gethostent_r #ifdef sethostent_r #undef sethostent_r #endif #define sethostent_r lwres_sethostent_r #ifdef endhostent_r #undef endhostent_r #endif #define endhostent_r lwres_endhostent_r #ifdef getrrsetbyname #undef getrrsetbyname #endif #define getrrsetbyname lwres_getrrsetbyname #ifdef freerrset #undef freerrset #endif #define freerrset lwres_freerrset #ifdef notyet #define getservbyname lwres_getservbyname #define getservbyport lwres_getservbyport #define getservent lwres_getservent #define setservent lwres_setservent #define endservent lwres_endservent #define getservbyname_r lwres_getservbyname_r #define getservbyport_r lwres_getservbyport_r #define getservent_r lwres_getservent_r #define setservent_r lwres_setservent_r #define endservent_r lwres_endservent_r #define getprotobyname lwres_getprotobyname #define getprotobynumber lwres_getprotobynumber #define getprotoent lwres_getprotoent #define setprotoent lwres_setprotoent #define endprotoent lwres_endprotoent #define getprotobyname_r lwres_getprotobyname_r #define getprotobynumber_r lwres_getprotobynumber_r #define getprotoent_r lwres_getprotoent_r #define setprotoent_r lwres_setprotoent_r #define endprotoent_r lwres_endprotoent_r #ifdef getnetbyname #undef getnetbyname #endif #define getnetbyname lwres_getnetbyname #ifdef getnetbyaddr #undef getnetbyaddr #endif #define getnetbyaddr lwres_getnetbyaddr #ifdef getnetent #undef getnetent #endif #define getnetent lwres_getnetent #ifdef setnetent #undef setnetent #endif #define setnetent lwres_setnetent #ifdef endnetent #undef endnetent #endif #define endnetent lwres_endnetent #ifdef getnetbyname_r #undef getnetbyname_r #endif #define getnetbyname_r lwres_getnetbyname_r #ifdef getnetbyaddr_r #undef getnetbyaddr_r #endif #define getnetbyaddr_r lwres_getnetbyaddr_r #ifdef getnetent_r #undef getnetent_r #endif #define getnetent_r lwres_getnetent_r #ifdef setnetent_r #undef setnetent_r #endif #define setnetent_r lwres_setnetent_r #ifdef endnetent_r #undef endnetent_r #endif #define endnetent_r lwres_endnetent_r #endif /* notyet */ #ifdef h_errno #undef h_errno #endif #define h_errno lwres_h_errno #endif /* LWRES_NAMESPACE */ LWRES_LANG_BEGINDECLS extern int lwres_h_errno; int lwres_getaddrinfo(const char *, const char *, const struct addrinfo *, struct addrinfo **); int lwres_getnameinfo(const struct sockaddr *, size_t, char *, size_t, char *, size_t, int); void lwres_freeaddrinfo(struct addrinfo *); char *lwres_gai_strerror(int); struct hostent *lwres_gethostbyaddr(const char *, int, int); struct hostent *lwres_gethostbyname(const char *); struct hostent *lwres_gethostbyname2(const char *, int); struct hostent *lwres_gethostent(void); struct hostent *lwres_getipnodebyname(const char *, int, int, int *); struct hostent *lwres_getipnodebyaddr(const void *, size_t, int, int *); void lwres_endhostent(void); void lwres_sethostent(int); /* void lwres_sethostfile(const char *); */ void lwres_freehostent(struct hostent *); int lwres_getrrsetbyname(const char *, unsigned int, unsigned int, unsigned int, struct rrsetinfo **); void lwres_freerrset(struct rrsetinfo *); #ifdef notyet struct netent *lwres_getnetbyaddr(unsigned long, int); struct netent *lwres_getnetbyname(const char *); struct netent *lwres_getnetent(void); void lwres_endnetent(void); void lwres_setnetent(int); struct protoent *lwres_getprotobyname(const char *); struct protoent *lwres_getprotobynumber(int); struct protoent *lwres_getprotoent(void); void lwres_endprotoent(void); void lwres_setprotoent(int); struct servent *lwres_getservbyname(const char *, const char *); struct servent *lwres_getservbyport(int, const char *); struct servent *lwres_getservent(void); void lwres_endservent(void); void lwres_setservent(int); #endif /* notyet */ void lwres_herror(const char *); const char *lwres_hstrerror(int); struct hostent *lwres_gethostbyaddr_r(const char *, int, int, struct hostent *, char *, int, int *); struct hostent *lwres_gethostbyname_r(const char *, struct hostent *, char *, int, int *); struct hostent *lwres_gethostent_r(struct hostent *, char *, int, int *); void lwres_sethostent_r(int); void lwres_endhostent_r(void); #ifdef notyet struct netent *lwres_getnetbyname_r(const char *, struct netent *, char *, int); struct netent *lwres_getnetbyaddr_r(long, int, struct netent *, char *, int); struct netent *lwres_getnetent_r(struct netent *, char *, int); void lwres_setnetent_r(int); void lwres_endnetent_r(void); struct protoent *lwres_getprotobyname_r(const char *, struct protoent *, char *, int); struct protoent *lwres_getprotobynumber_r(int, struct protoent *, char *, int); struct protoent *lwres_getprotoent_r(struct protoent *, char *, int); void lwres_setprotoent_r(int); void lwres_endprotoent_r(void); struct servent *lwres_getservbyname_r(const char *name, const char *, struct servent *, char *, int); struct servent *lwres_getservbyport_r(int port, const char *, struct servent *, char *, int); struct servent *lwres_getservent_r(struct servent *, char *, int); void lwres_setservent_r(int); void lwres_endservent_r(void); #endif /* notyet */ LWRES_LANG_ENDDECLS #ifdef notyet /* This is nec'y to make this include file properly replace the sun version. */ #ifdef sun #ifdef __GNU_LIBRARY__ #include <rpc/netdb.h> /* Required. */ #else /* !__GNU_LIBRARY__ */ struct rpcent { char *r_name; /* name of server for this rpc program */ char **r_aliases; /* alias list */ int r_number; /* rpc program number */ }; struct rpcent *lwres_getrpcbyname(); struct rpcent *lwres_getrpcbynumber(), struct rpcent *lwres_getrpcent(); #endif /* __GNU_LIBRARY__ */ #endif /* sun */ #endif /* notyet */ /* * Tell Emacs to use C mode on this file. * Local variables: * mode: c * End: */ #endif /* LWRES_NETDB_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/lwres/lwpacket.h������������������������������������������������������������������������������0000644�����������������00000011750�14763166026�0010707 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: lwpacket.h,v 1.24 2007/06/19 23:47:23 tbox Exp $ */ #ifndef LWRES_LWPACKET_H #define LWRES_LWPACKET_H 1 #include <lwres/lang.h> #include <lwres/lwbuffer.h> #include <lwres/result.h> /*% lwres_lwpacket_t */ typedef struct lwres_lwpacket lwres_lwpacket_t; /*% lwres_lwpacket structure */ struct lwres_lwpacket { /*! The overall packet length, including the * entire packet header. * This field is filled in by the * \link lwres_gabn.c lwres_gabn_*()\endlink * and \link lwres_gnba.c lwres_gnba_*()\endlink calls. */ lwres_uint32_t length; /*! Specifies the header format. Currently, * there is only one format, #LWRES_LWPACKETVERSION_0. * This field is filled in by the * \link lwres_gabn.c lwres_gabn_*()\endlink * and \link lwres_gnba.c lwres_gnba_*()\endlink calls. */ lwres_uint16_t version; /*! Specifies library-defined flags for this packet, such as * whether the packet is a request or a reply. None of * these are definable by the caller, but library-defined values * can be set by the caller. For example, one bit in this field * indicates if the packet is a request or a response. * This field is filled in by * the application wits the exception of the * #LWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library * in the * \link lwres_gabn.c lwres_gabn_*()\endlink * and \link lwres_gnba.c lwres_gnba_*()\endlink calls. */ lwres_uint16_t pktflags; /*! Set by the requestor and is returned in all replies. * If two packets from the same source have the same serial * number and are from the same source, they are assumed to * be duplicates and the latter ones may be dropped. * (The library does not do this by default on replies, but * does so on requests.) */ lwres_uint32_t serial; /*! Opcodes between 0x04000000 and 0xffffffff * are application defined. Opcodes between * 0x00000000 and 0x03ffffff are * reserved for library use. * This field is filled in by the * \link lwres_gabn.c lwres_gabn_*()\endlink * and \link lwres_gnba.c lwres_gnba_*()\endlink calls. */ lwres_uint32_t opcode; /*! Only valid for results. * Results between 0x04000000 and 0xffffffff are application * defined. * Results between 0x00000000 and 0x03ffffff are reserved for * library use. * (This is the same reserved range defined in <isc/resultclass.h>, * so it * would be trivial to map ISC_R_* result codes into packet result * codes when appropriate.) * This field is filled in by the * \link lwres_gabn.c lwres_gabn_*()\endlink * and \link lwres_gnba.c lwres_gnba_*()\endlink calls. */ lwres_uint32_t result; /*! Set to the maximum buffer size that the receiver can * handle on requests, and the size of the buffer needed to * satisfy a request * when the buffer is too large for replies. * This field is supplied by the application. */ lwres_uint32_t recvlength; /*! The packet level auth type used. * Authtypes between 0x1000 and 0xffff are application defined. * Authtypes * between 0x0000 and 0x0fff are reserved for library use. * This is currently * unused and MUST be set to zero. */ lwres_uint16_t authtype; /*! The length of the authentication data. * See the specific * authtypes for more information on what is contained * in this field. This is currently unused, and * MUST be set to zero. */ lwres_uint16_t authlength; }; #define LWRES_LWPACKET_LENGTH (4 * 5 + 2 * 4) /*%< Overall length. */ #define LWRES_LWPACKETFLAG_RESPONSE 0x0001U /*%< If set, pkt is a response. */ #define LWRES_LWPACKETVERSION_0 0 /*%< Header format. */ /*! \file lwres/lwpacket.h * * * The remainder of the packet consists of two regions, one described by * "authlen" and one of "length - authlen - sizeof(lwres_lwpacket_t)". * * That is: * * \code * pkt header * authlen bytes of auth information * data bytes * \endcode * * Currently defined opcodes: * *\li #LWRES_OPCODE_NOOP. Success is always returned, with the packet contents echoed. * *\li #LWRES_OPCODE_GETADDRSBYNAME. Return all known addresses for a given name. * This may return NIS or /etc/hosts info as well as DNS * information. Flags will be provided to indicate ip4/ip6 * addresses are desired. * *\li #LWRES_OPCODE_GETNAMEBYADDR. Return the hostname for the given address. Once * again, it will return data from multiple sources. */ LWRES_LANG_BEGINDECLS /* XXXMLG document */ lwres_result_t lwres_lwpacket_renderheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt); lwres_result_t lwres_lwpacket_parseheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt); LWRES_LANG_ENDDECLS #endif /* LWRES_LWPACKET_H */ ������������������������bind9/lwres/lang.h����������������������������������������������������������������������������������0000644�����������������00000001304�14763166026�0010010 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: lang.h,v 1.13 2007/06/19 23:47:23 tbox Exp $ */ #ifndef LWRES_LANG_H #define LWRES_LANG_H 1 /*! \file lwres/lang.h */ #ifdef __cplusplus #define LWRES_LANG_BEGINDECLS extern "C" { #define LWRES_LANG_ENDDECLS } #else #define LWRES_LANG_BEGINDECLS #define LWRES_LANG_ENDDECLS #endif #endif /* LWRES_LANG_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/clientinfo.h������������������������������������������������������������������������������0000644�����������������00000003712�14763166026�0010656 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_CLIENTINFO_H #define DNS_CLIENTINFO_H 1 /***** ***** Module Info *****/ /*! \file dns/clientinfo.h * \brief * The DNS clientinfo interface allows libdns to retrieve information * about the client from the caller. * * The clientinfo interface is used by the DNS DB and DLZ interfaces; * it allows databases to modify their answers on the basis of information * about the client, such as source IP address. * * dns_clientinfo_t contains a pointer to an opaque structure containing * client information in some form. dns_clientinfomethods_t contains a * list of methods which operate on that opaque structure to return * potentially useful data. Both structures also contain versioning * information. */ /***** ***** Imports *****/ #include <isc/sockaddr.h> #include <isc/types.h> ISC_LANG_BEGINDECLS /***** ***** Types *****/ #define DNS_CLIENTINFO_VERSION 2 typedef struct dns_clientinfo { isc_uint16_t version; void *data; void *dbversion; } dns_clientinfo_t; typedef isc_result_t (*dns_clientinfo_sourceip_t)(dns_clientinfo_t *client, isc_sockaddr_t **addrp); #define DNS_CLIENTINFOMETHODS_VERSION 1 #define DNS_CLIENTINFOMETHODS_AGE 0 typedef struct dns_clientinfomethods { isc_uint16_t version; isc_uint16_t age; dns_clientinfo_sourceip_t sourceip; } dns_clientinfomethods_t; /***** ***** Methods *****/ void dns_clientinfomethods_init(dns_clientinfomethods_t *methods, dns_clientinfo_sourceip_t sourceip); void dns_clientinfo_init(dns_clientinfo_t *ci, void *data, void *versionp); ISC_LANG_ENDDECLS #endif /* DNS_CLIENTINFO_H */ ������������������������������������������������������bind9/dns/version.h���������������������������������������������������������������������������������0000644�����������������00000001543�14763166026�0010211 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! \file dns/version.h */ #ifndef DNS_VERSION_H #define DNS_VERSION_H 1 #include <isc/platform.h> LIBDNS_EXTERNAL_DATA extern const char dns_version[]; LIBDNS_EXTERNAL_DATA extern const char dns_major[]; LIBDNS_EXTERNAL_DATA extern const char dns_mapapi[]; LIBDNS_EXTERNAL_DATA extern const unsigned int dns_libinterface; LIBDNS_EXTERNAL_DATA extern const unsigned int dns_librevision; LIBDNS_EXTERNAL_DATA extern const unsigned int dns_libage; #endif /* DNS_VERSION_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/nsec.h������������������������������������������������������������������������������������0000644�����������������00000005612�14763166026�0007455 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_NSEC_H #define DNS_NSEC_H 1 /*! \file dns/nsec.h */ #include <isc/lang.h> #include <dns/types.h> #include <dns/name.h> #define DNS_NSEC_BUFFERSIZE (DNS_NAME_MAXWIRE + 8192 + 512) ISC_LANG_BEGINDECLS isc_result_t dns_nsec_buildrdata(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, dns_name_t *target, unsigned char *buffer, dns_rdata_t *rdata); /*%< * Build the rdata of a NSEC record. * * Requires: *\li buffer Points to a temporary buffer of at least * DNS_NSEC_BUFFERSIZE bytes. *\li rdata Points to an initialized dns_rdata_t. * * Ensures: * \li *rdata Contains a valid NSEC rdata. The 'data' member refers * to 'buffer'. */ isc_result_t dns_nsec_build(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, dns_name_t *target, dns_ttl_t ttl); /*%< * Build a NSEC record and add it to a database. */ isc_boolean_t dns_nsec_typepresent(dns_rdata_t *nsec, dns_rdatatype_t type); /*%< * Determine if a type is marked as present in an NSEC record. * * Requires: *\li 'nsec' points to a valid rdataset of type NSEC */ isc_result_t dns_nsec_nseconly(dns_db_t *db, dns_dbversion_t *version, isc_boolean_t *answer); /* * Report whether the DNSKEY RRset has a NSEC only algorithm. Unknown * algorithms are assumed to support NSEC3. If DNSKEY is not found, * *answer is set to ISC_FALSE, and ISC_R_NOTFOUND is returned. * * Requires: * 'answer' to be non NULL. */ unsigned int dns_nsec_compressbitmap(unsigned char *map, const unsigned char *raw, unsigned int max_type); /*%< * Convert a raw bitmap into a compressed windowed bit map. 'map' and 'raw' * may overlap. * * Returns the length of the compressed windowed bit map. */ void dns_nsec_setbit(unsigned char *array, unsigned int type, unsigned int bit); /*%< * Set type bit in raw 'array' to 'bit'. */ isc_boolean_t dns_nsec_isset(const unsigned char *array, unsigned int type); /*%< * Test if the corresponding 'type' bit is set in 'array'. */ isc_result_t dns_nsec_noexistnodata(dns_rdatatype_t type, dns_name_t *name, dns_name_t *nsecname, dns_rdataset_t *nsecset, isc_boolean_t *exists, isc_boolean_t *data, dns_name_t *wild, dns_nseclog_t log, void *arg); /*% * Return ISC_R_SUCCESS if we can determine that the name doesn't exist * or we can determine whether there is data or not at the name. * If the name does not exist return the wildcard name. * * Return ISC_R_IGNORE when the NSEC is not the appropriate one. */ ISC_LANG_ENDDECLS #endif /* DNS_NSEC_H */ ����������������������������������������������������������������������������������������������������������������������bind9/dns/types.h�����������������������������������������������������������������������������������0000644�����������������00000033227�14763166026�0007674 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_TYPES_H #define DNS_TYPES_H 1 /*! \file dns/types.h * \brief * Including this file gives you type declarations suitable for use in * .h files, which lets us avoid circular type reference problems. * \brief * To actually use a type or get declarations of its methods, you must * include the appropriate .h file too. */ #include <stdio.h> #include <isc/types.h> typedef struct dns_acache dns_acache_t; typedef struct dns_acacheentry dns_acacheentry_t; typedef struct dns_acachestats dns_acachestats_t; typedef struct dns_acl dns_acl_t; typedef struct dns_aclelement dns_aclelement_t; typedef struct dns_aclenv dns_aclenv_t; typedef struct dns_adb dns_adb_t; typedef struct dns_adbaddrinfo dns_adbaddrinfo_t; typedef ISC_LIST(dns_adbaddrinfo_t) dns_adbaddrinfolist_t; typedef struct dns_adbentry dns_adbentry_t; typedef struct dns_adbfind dns_adbfind_t; typedef ISC_LIST(dns_adbfind_t) dns_adbfindlist_t; typedef struct dns_badcache dns_badcache_t; typedef struct dns_byaddr dns_byaddr_t; typedef struct dns_catz_zonemodmethods dns_catz_zonemodmethods_t; typedef struct dns_catz_entry_options dns_catz_options_t; typedef struct dns_catz_entry dns_catz_entry_t; typedef struct dns_catz_zone dns_catz_zone_t; typedef struct dns_catz_changed dns_catz_changed_t; typedef struct dns_catz_zones dns_catz_zones_t; typedef struct dns_client dns_client_t; typedef void dns_clientrestrans_t; typedef void dns_clientreqtrans_t; typedef void dns_clientupdatetrans_t; typedef struct dns_cache dns_cache_t; typedef isc_uint16_t dns_cert_t; typedef struct dns_compress dns_compress_t; typedef struct dns_db dns_db_t; typedef struct dns_dbimplementation dns_dbimplementation_t; typedef struct dns_dbiterator dns_dbiterator_t; typedef void dns_dbload_t; typedef void dns_dbnode_t; typedef struct dns_dbonupdatelistener dns_dbonupdatelistener_t; typedef struct dns_dbtable dns_dbtable_t; typedef void dns_dbversion_t; typedef struct dns_dlzimplementation dns_dlzimplementation_t; typedef struct dns_dlzdb dns_dlzdb_t; typedef ISC_LIST(dns_dlzdb_t) dns_dlzdblist_t; typedef struct dns_dyndbctx dns_dyndbctx_t; typedef struct dns_sdlzimplementation dns_sdlzimplementation_t; typedef struct dns_decompress dns_decompress_t; typedef struct dns_dispatch dns_dispatch_t; typedef struct dns_dispatchevent dns_dispatchevent_t; typedef struct dns_dispatchlist dns_dispatchlist_t; typedef struct dns_dispatchset dns_dispatchset_t; typedef struct dns_dispatchmgr dns_dispatchmgr_t; typedef struct dns_dispentry dns_dispentry_t; typedef struct dns_dns64 dns_dns64_t; typedef ISC_LIST(dns_dns64_t) dns_dns64list_t; typedef struct dns_dnsseckey dns_dnsseckey_t; typedef ISC_LIST(dns_dnsseckey_t) dns_dnsseckeylist_t; typedef isc_uint8_t dns_dsdigest_t; typedef struct dns_dtdata dns_dtdata_t; typedef struct dns_dtenv dns_dtenv_t; typedef struct dns_dtmsg dns_dtmsg_t; typedef isc_uint16_t dns_dtmsgtype_t; typedef struct dns_dumpctx dns_dumpctx_t; typedef struct dns_ednsopt dns_ednsopt_t; typedef struct dns_fetch dns_fetch_t; typedef struct dns_fixedname dns_fixedname_t; typedef struct dns_forwarders dns_forwarders_t; typedef struct dns_forwarder dns_forwarder_t; typedef struct dns_fwdtable dns_fwdtable_t; typedef struct dns_iptable dns_iptable_t; typedef isc_uint32_t dns_iterations_t; typedef isc_uint16_t dns_keyflags_t; typedef struct dns_keynode dns_keynode_t; typedef ISC_LIST(dns_keynode_t) dns_keynodelist_t; typedef struct dns_keytable dns_keytable_t; typedef isc_uint16_t dns_keytag_t; typedef struct dns_loadctx dns_loadctx_t; typedef struct dns_loadmgr dns_loadmgr_t; typedef struct dns_masterrawheader dns_masterrawheader_t; typedef isc_uint64_t dns_masterstyle_flags_t; typedef struct dns_message dns_message_t; typedef isc_uint16_t dns_messageid_t; typedef isc_region_t dns_label_t; typedef struct dns_lookup dns_lookup_t; typedef struct dns_name dns_name_t; typedef ISC_LIST(dns_name_t) dns_namelist_t; typedef struct dns_nta dns_nta_t; typedef struct dns_ntatable dns_ntatable_t; typedef isc_uint16_t dns_opcode_t; typedef unsigned char dns_offsets_t[128]; typedef struct dns_order dns_order_t; typedef struct dns_peer dns_peer_t; typedef struct dns_peerlist dns_peerlist_t; typedef struct dns_portlist dns_portlist_t; typedef struct dns_rbt dns_rbt_t; typedef isc_uint16_t dns_rcode_t; typedef struct dns_rdata dns_rdata_t; typedef struct dns_rdatacallbacks dns_rdatacallbacks_t; typedef isc_uint16_t dns_rdataclass_t; typedef struct dns_rdatalist dns_rdatalist_t; typedef struct dns_rdataset dns_rdataset_t; typedef ISC_LIST(dns_rdataset_t) dns_rdatasetlist_t; typedef struct dns_rdatasetiter dns_rdatasetiter_t; typedef isc_uint16_t dns_rdatatype_t; typedef struct dns_request dns_request_t; typedef struct dns_requestmgr dns_requestmgr_t; typedef struct dns_resolver dns_resolver_t; typedef struct dns_sdbimplementation dns_sdbimplementation_t; typedef isc_uint8_t dns_secalg_t; typedef isc_uint8_t dns_secproto_t; typedef struct dns_signature dns_signature_t; typedef struct dns_ssurule dns_ssurule_t; typedef struct dns_ssutable dns_ssutable_t; typedef struct dns_stats dns_stats_t; typedef isc_uint32_t dns_rdatastatstype_t; typedef struct dns_tkeyctx dns_tkeyctx_t; typedef isc_uint16_t dns_trust_t; typedef struct dns_tsec dns_tsec_t; typedef struct dns_tsig_keyring dns_tsig_keyring_t; typedef struct dns_tsigkey dns_tsigkey_t; typedef isc_uint32_t dns_ttl_t; typedef struct dns_update_state dns_update_state_t; typedef struct dns_validator dns_validator_t; typedef struct dns_view dns_view_t; typedef ISC_LIST(dns_view_t) dns_viewlist_t; typedef struct dns_zone dns_zone_t; typedef ISC_LIST(dns_zone_t) dns_zonelist_t; typedef struct dns_zonemgr dns_zonemgr_t; typedef struct dns_zt dns_zt_t; typedef struct dns_ipkeylist dns_ipkeylist_t; /* * If we are not using GSSAPI, define the types we use as opaque types here. */ #ifndef GSSAPI typedef struct not_defined_gss_cred_id *gss_cred_id_t; typedef struct not_defined_gss_ctx *gss_ctx_id_t; #endif typedef struct dst_gssapi_signverifyctx dst_gssapi_signverifyctx_t; typedef enum { dns_hash_sha1 = 1 } dns_hash_t; typedef enum { dns_fwdpolicy_none = 0, dns_fwdpolicy_first = 1, dns_fwdpolicy_only = 2 } dns_fwdpolicy_t; typedef enum { dns_namereln_none = 0, dns_namereln_contains = 1, dns_namereln_subdomain = 2, dns_namereln_equal = 3, dns_namereln_commonancestor = 4 } dns_namereln_t; typedef enum { dns_one_answer, dns_many_answers } dns_transfer_format_t; typedef enum { dns_dbtype_zone = 0, dns_dbtype_cache = 1, dns_dbtype_stub = 3 } dns_dbtype_t; typedef enum { dns_notifytype_no = 0, dns_notifytype_yes = 1, dns_notifytype_explicit = 2, dns_notifytype_masteronly = 3 } dns_notifytype_t; typedef enum { dns_minimal_no = 0, dns_minimal_yes = 1, dns_minimal_noauth = 2, dns_minimal_noauthrec = 3 } dns_minimaltype_t; typedef enum { dns_dialuptype_no = 0, dns_dialuptype_yes = 1, dns_dialuptype_notify = 2, dns_dialuptype_notifypassive = 3, dns_dialuptype_refresh = 4, dns_dialuptype_passive = 5 } dns_dialuptype_t; typedef enum { dns_masterformat_none = 0, dns_masterformat_text = 1, dns_masterformat_raw = 2, dns_masterformat_map = 3 } dns_masterformat_t; typedef enum { dns_aaaa_ok = 0, dns_aaaa_filter = 1, dns_aaaa_break_dnssec = 2 } dns_aaaa_t; /* * These are generated by gen.c. */ #include <dns/enumtype.h> /* Provides dns_rdatatype_t. */ #include <dns/enumclass.h> /* Provides dns_rdataclass_t. */ /*% * rcodes. */ enum { /* * Standard rcodes. */ dns_rcode_noerror = 0, #define dns_rcode_noerror ((dns_rcode_t)dns_rcode_noerror) dns_rcode_formerr = 1, #define dns_rcode_formerr ((dns_rcode_t)dns_rcode_formerr) dns_rcode_servfail = 2, #define dns_rcode_servfail ((dns_rcode_t)dns_rcode_servfail) dns_rcode_nxdomain = 3, #define dns_rcode_nxdomain ((dns_rcode_t)dns_rcode_nxdomain) dns_rcode_notimp = 4, #define dns_rcode_notimp ((dns_rcode_t)dns_rcode_notimp) dns_rcode_refused = 5, #define dns_rcode_refused ((dns_rcode_t)dns_rcode_refused) dns_rcode_yxdomain = 6, #define dns_rcode_yxdomain ((dns_rcode_t)dns_rcode_yxdomain) dns_rcode_yxrrset = 7, #define dns_rcode_yxrrset ((dns_rcode_t)dns_rcode_yxrrset) dns_rcode_nxrrset = 8, #define dns_rcode_nxrrset ((dns_rcode_t)dns_rcode_nxrrset) dns_rcode_notauth = 9, #define dns_rcode_notauth ((dns_rcode_t)dns_rcode_notauth) dns_rcode_notzone = 10, #define dns_rcode_notzone ((dns_rcode_t)dns_rcode_notzone) /* * Extended rcodes. */ dns_rcode_badvers = 16, #define dns_rcode_badvers ((dns_rcode_t)dns_rcode_badvers) dns_rcode_badcookie = 23 #define dns_rcode_badcookie ((dns_rcode_t)dns_rcode_badcookie) /* * Update dns_rcodestats_create() and dns_rcodestats_increment() * and this comment if a rcode > dns_rcode_badcookie is assigned. */ /* Private space [3841..4095] */ }; /*% * TSIG errors. */ enum { dns_tsigerror_badsig = 16, dns_tsigerror_badkey = 17, dns_tsigerror_badtime = 18, dns_tsigerror_badmode = 19, dns_tsigerror_badname = 20, dns_tsigerror_badalg = 21, dns_tsigerror_badtrunc = 22 }; /*% * Opcodes. */ enum { dns_opcode_query = 0, #define dns_opcode_query ((dns_opcode_t)dns_opcode_query) dns_opcode_iquery = 1, #define dns_opcode_iquery ((dns_opcode_t)dns_opcode_iquery) dns_opcode_status = 2, #define dns_opcode_status ((dns_opcode_t)dns_opcode_status) dns_opcode_notify = 4, #define dns_opcode_notify ((dns_opcode_t)dns_opcode_notify) dns_opcode_update = 5 /* dynamic update */ #define dns_opcode_update ((dns_opcode_t)dns_opcode_update) }; /*% * Trust levels. Must be kept in sync with trustnames[] in masterdump.c. */ enum { /* Sentinel value; no data should have this trust level. */ dns_trust_none = 0, #define dns_trust_none ((dns_trust_t)dns_trust_none) /*% * Subject to DNSSEC validation but has not yet been validated * dns_trust_pending_additional (from the additional section). */ dns_trust_pending_additional = 1, #define dns_trust_pending_additional \ ((dns_trust_t)dns_trust_pending_additional) dns_trust_pending_answer = 2, #define dns_trust_pending_answer ((dns_trust_t)dns_trust_pending_answer) /*% Received in the additional section of a response. */ dns_trust_additional = 3, #define dns_trust_additional ((dns_trust_t)dns_trust_additional) /* Received in a referral response. */ dns_trust_glue = 4, #define dns_trust_glue ((dns_trust_t)dns_trust_glue) /* Answer from a non-authoritative server */ dns_trust_answer = 5, #define dns_trust_answer ((dns_trust_t)dns_trust_answer) /* Received in the authority section as part of an authoritative response */ dns_trust_authauthority = 6, #define dns_trust_authauthority ((dns_trust_t)dns_trust_authauthority) /* Answer from an authoritative server */ dns_trust_authanswer = 7, #define dns_trust_authanswer ((dns_trust_t)dns_trust_authanswer) /* Successfully DNSSEC validated */ dns_trust_secure = 8, #define dns_trust_secure ((dns_trust_t)dns_trust_secure) /* This server is authoritative */ dns_trust_ultimate = 9 #define dns_trust_ultimate ((dns_trust_t)dns_trust_ultimate) }; #define DNS_TRUST_PENDING(x) ((x) == dns_trust_pending_answer || \ (x) == dns_trust_pending_additional) #define DNS_TRUST_ADDITIONAL(x) ((x) == dns_trust_additional || \ (x) == dns_trust_pending_additional) #define DNS_TRUST_GLUE(x) ((x) == dns_trust_glue) #define DNS_TRUST_ANSWER(x) ((x) == dns_trust_answer) /*% * Name checking severities. */ typedef enum { dns_severity_ignore, dns_severity_warn, dns_severity_fail } dns_severity_t; /*% * DNS Serial Number Update Method. * * \li _none: Keep the current serial. * \li _increment: Add one to the current serial, skipping 0. * \li _unixtime: Set to the seconds since 00:00 Jan 1, 1970, * if possible. * \li _date: Set to today's date in YYYYMMDDVV format: * (Year, Month, Day, Version) */ typedef enum { dns_updatemethod_none = 0, dns_updatemethod_increment, dns_updatemethod_unixtime, dns_updatemethod_date } dns_updatemethod_t; /* * Functions. */ typedef void (*dns_dumpdonefunc_t)(void *, isc_result_t); typedef void (*dns_loaddonefunc_t)(void *, isc_result_t); typedef void (*dns_rawdatafunc_t)(dns_zone_t *, dns_masterrawheader_t *); typedef isc_result_t (*dns_addrdatasetfunc_t)(void *, dns_name_t *, dns_rdataset_t *); typedef isc_result_t (*dns_additionaldatafunc_t)(void *, dns_name_t *, dns_rdatatype_t); typedef isc_result_t (*dns_digestfunc_t)(void *, isc_region_t *); typedef void (*dns_xfrindone_t)(dns_zone_t *, isc_result_t); typedef void (*dns_updatecallback_t)(void *, isc_result_t, dns_message_t *); typedef int (*dns_rdatasetorderfunc_t)(const dns_rdata_t *, const void *); typedef isc_boolean_t (*dns_checkmxfunc_t)(dns_zone_t *, dns_name_t *, dns_name_t *); typedef isc_boolean_t (*dns_checksrvfunc_t)(dns_zone_t *, dns_name_t *, dns_name_t *); typedef isc_boolean_t (*dns_checknsfunc_t)(dns_zone_t *, dns_name_t *, dns_name_t *, dns_rdataset_t *, dns_rdataset_t *); typedef isc_boolean_t (*dns_isselffunc_t)(dns_view_t *, dns_tsigkey_t *, isc_sockaddr_t *, isc_sockaddr_t *, dns_rdataclass_t, void *); typedef isc_result_t (*dns_deserializefunc_t)(void *, FILE *, off_t); typedef void (*dns_nseclog_t)(void *val, int , const char *, ...); #endif /* DNS_TYPES_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/update.h����������������������������������������������������������������������������������0000644�����������������00000003155�14763166026�0010007 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_UPDATE_H #define DNS_UPDATE_H 1 /*! \file dns/update.h */ /*** *** Imports ***/ #include <isc/lang.h> #include <dns/types.h> #include <dns/diff.h> typedef struct { void (*func)(void *arg, dns_zone_t *zone, int level, const char *message); void *arg; } dns_update_log_t; ISC_LANG_BEGINDECLS /*** *** Functions ***/ isc_uint32_t dns_update_soaserial(isc_uint32_t serial, dns_updatemethod_t method); /*%< * Return the next serial number after 'serial', depending on the * update method 'method': * *\li * dns_updatemethod_increment increments the serial number by one *\li * dns_updatemethod_unixtime sets the serial number to the current * time (seconds since UNIX epoch) if possible, or increments by one * if not. */ isc_result_t dns_update_signatures(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *oldver, dns_dbversion_t *newver, dns_diff_t *diff, isc_uint32_t sigvalidityinterval); isc_result_t dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *oldver, dns_dbversion_t *newver, dns_diff_t *diff, isc_uint32_t sigvalidityinterval, dns_update_state_t **state); ISC_LANG_ENDDECLS #endif /* DNS_UPDATE_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/enumclass.h�������������������������������������������������������������������������������0000644�����������������00000002304�14763166026�0010512 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 1998-2022 Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /*************** *************** *************** THIS FILE IS AUTOMATICALLY GENERATED BY gen.c. *************** DO NOT EDIT! *************** ***************/ /*! \file */ #ifndef DNS_ENUMCLASS_H #define DNS_ENUMCLASS_H 1 enum { dns_rdataclass_reserved0 = 0, #define dns_rdataclass_reserved0 \ ((dns_rdataclass_t)dns_rdataclass_reserved0) dns_rdataclass_in = 1, #define dns_rdataclass_in ((dns_rdataclass_t)dns_rdataclass_in) dns_rdataclass_chaos = 3, #define dns_rdataclass_chaos ((dns_rdataclass_t)dns_rdataclass_chaos) dns_rdataclass_ch = 3, #define dns_rdataclass_ch ((dns_rdataclass_t)dns_rdataclass_ch) dns_rdataclass_hs = 4, #define dns_rdataclass_hs ((dns_rdataclass_t)dns_rdataclass_hs) dns_rdataclass_none = 254, #define dns_rdataclass_none ((dns_rdataclass_t)dns_rdataclass_none) dns_rdataclass_any = 255 #define dns_rdataclass_any ((dns_rdataclass_t)dns_rdataclass_any) }; #endif /* DNS_ENUMCLASS_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/dsdigest.h��������������������������������������������������������������������������������0000644�����������������00000003271�14763166026�0010332 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_DSDIGEST_H #define DNS_DSDIGEST_H 1 /*! \file dns/dsdigest.h */ #include <isc/lang.h> #include <dns/types.h> ISC_LANG_BEGINDECLS isc_result_t dns_dsdigest_fromtext(dns_dsdigest_t *dsdigestp, isc_textregion_t *source); /*%< * Convert the text 'source' refers to into a DS/DLV digest type value. * The text may contain either a mnemonic digest name or a decimal * digest number. * * Requires: *\li 'dsdigestp' is a valid pointer. * *\li 'source' is a valid text region. * * Returns: *\li ISC_R_SUCCESS on success *\li ISC_R_RANGE numeric type is out of range *\li DNS_R_UNKNOWN mnemonic type is unknown */ isc_result_t dns_dsdigest_totext(dns_dsdigest_t dsdigest, isc_buffer_t *target); /*%< * Put a textual representation of the DS/DLV digest type 'dsdigest' * into 'target'. * * Requires: *\li 'dsdigest' is a valid dsdigest. * *\li 'target' is a valid text buffer. * * Ensures, * if the result is success: *\li The used space in 'target' is updated. * * Returns: *\li ISC_R_SUCCESS on success *\li ISC_R_NOSPACE target buffer is too small */ #define DNS_DSDIGEST_FORMATSIZE 20 void dns_dsdigest_format(dns_dsdigest_t typ, char *cp, unsigned int size); /*%< * Wrapper for dns_dsdigest_totext(), writing text into 'cp' */ ISC_LANG_ENDDECLS #endif /* DNS_DSDIGEST_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/compress.h��������������������������������������������������������������������������������0000644�����������������00000015017�14763166026�0010360 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_COMPRESS_H #define DNS_COMPRESS_H 1 #include <isc/lang.h> #include <isc/region.h> #include <dns/types.h> ISC_LANG_BEGINDECLS /*! \file dns/compress.h * Direct manipulation of the structures is strongly discouraged. * * A name compression context handles compression of multiple DNS names * in relation to a single DNS message. The context can be used to * selectively turn on/off compression for specific names (depending on * the RR type) by using \c dns_compress_setmethods(). Alternately, * compression can be disabled completely using \c * dns_compress_disable(). * * \c dns_compress_setmethods() is intended for use by RDATA towire() * implementations, whereas \c dns_compress_disable() is intended to be * used by a nameserver's configuration manager. */ #define DNS_COMPRESS_NONE 0x00 /*%< no compression */ #define DNS_COMPRESS_GLOBAL14 0x01 /*%< "normal" compression. */ #define DNS_COMPRESS_ALL 0x01 /*%< all compression. */ #define DNS_COMPRESS_CASESENSITIVE 0x02 /*%< case sensitive compression. */ #define DNS_COMPRESS_ENABLED 0x04 #define DNS_COMPRESS_READY 0x80000000 #define DNS_COMPRESS_TABLESIZE 64 #define DNS_COMPRESS_INITIALNODES 16 typedef struct dns_compressnode dns_compressnode_t; struct dns_compressnode { isc_region_t r; isc_uint16_t offset; isc_uint16_t count; isc_uint8_t labels; dns_compressnode_t *next; }; struct dns_compress { unsigned int magic; /*%< Magic number. */ unsigned int allowed; /*%< Allowed methods. */ int edns; /*%< Edns version or -1. */ /*% Global compression table. */ dns_compressnode_t *table[DNS_COMPRESS_TABLESIZE]; /*% Preallocated nodes for the table. */ dns_compressnode_t initialnodes[DNS_COMPRESS_INITIALNODES]; isc_uint16_t count; /*%< Number of nodes. */ isc_mem_t *mctx; /*%< Memory context. */ }; typedef enum { DNS_DECOMPRESS_ANY, /*%< Any compression */ DNS_DECOMPRESS_STRICT, /*%< Allowed compression */ DNS_DECOMPRESS_NONE /*%< No compression */ } dns_decompresstype_t; struct dns_decompress { unsigned int magic; /*%< Magic number. */ unsigned int allowed; /*%< Allowed methods. */ int edns; /*%< Edns version or -1. */ dns_decompresstype_t type; /*%< Strict checking */ }; isc_result_t dns_compress_init(dns_compress_t *cctx, int edns, isc_mem_t *mctx); /*%< * Initialise the compression context structure pointed to by * 'cctx'. A freshly initialized context has name compression * enabled, but no methods are set. Please use \c * dns_compress_setmethods() to set a compression method. * * Requires: * \li 'cctx' is a valid dns_compress_t structure. * \li 'mctx' is an initialized memory context. * Ensures: * \li cctx->global is initialized. * * Returns: * \li #ISC_R_SUCCESS */ void dns_compress_invalidate(dns_compress_t *cctx); /*%< * Invalidate the compression structure pointed to by cctx. * * Requires: *\li 'cctx' to be initialized. */ void dns_compress_setmethods(dns_compress_t *cctx, unsigned int allowed); /*%< * Sets allowed compression methods. * * Requires: *\li 'cctx' to be initialized. */ unsigned int dns_compress_getmethods(dns_compress_t *cctx); /*%< * Gets allowed compression methods. * * Requires: *\li 'cctx' to be initialized. * * Returns: *\li allowed compression bitmap. */ void dns_compress_disable(dns_compress_t *cctx); /*%< * Disables all name compression in the context. Once disabled, * name compression cannot currently be re-enabled. * * Requires: *\li 'cctx' to be initialized. * */ void dns_compress_setsensitive(dns_compress_t *cctx, isc_boolean_t sensitive); /* * Preserve the case of compressed domain names. * * Requires: * 'cctx' to be initialized. */ isc_boolean_t dns_compress_getsensitive(dns_compress_t *cctx); /* * Return whether case is to be preserved when compressing * domain names. * * Requires: * 'cctx' to be initialized. */ int dns_compress_getedns(dns_compress_t *cctx); /*%< * Gets edns value. * * Requires: *\li 'cctx' to be initialized. * * Returns: *\li -1 .. 255 */ isc_boolean_t dns_compress_findglobal(dns_compress_t *cctx, const dns_name_t *name, dns_name_t *prefix, isc_uint16_t *offset); /*%< * Finds longest possible match of 'name' in the global compression table. * * Requires: *\li 'cctx' to be initialized. *\li 'name' to be a absolute name. *\li 'prefix' to be initialized. *\li 'offset' to point to an isc_uint16_t. * * Ensures: *\li 'prefix' and 'offset' are valid if ISC_TRUE is returned. * * Returns: *\li #ISC_TRUE / #ISC_FALSE */ void dns_compress_add(dns_compress_t *cctx, const dns_name_t *name, const dns_name_t *prefix, isc_uint16_t offset); /*%< * Add compression pointers for 'name' to the compression table, * not replacing existing pointers. * * Requires: *\li 'cctx' initialized * *\li 'name' must be initialized and absolute, and must remain * valid until the message compression is complete. * *\li 'prefix' must be a prefix returned by * dns_compress_findglobal(), or the same as 'name'. */ void dns_compress_rollback(dns_compress_t *cctx, isc_uint16_t offset); /*%< * Remove any compression pointers from global table >= offset. * * Requires: *\li 'cctx' is initialized. */ void dns_decompress_init(dns_decompress_t *dctx, int edns, dns_decompresstype_t type); /*%< * Initializes 'dctx'. * Records 'edns' and 'type' into the structure. * * Requires: *\li 'dctx' to be a valid pointer. */ void dns_decompress_invalidate(dns_decompress_t *dctx); /*%< * Invalidates 'dctx'. * * Requires: *\li 'dctx' to be initialized */ void dns_decompress_setmethods(dns_decompress_t *dctx, unsigned int allowed); /*%< * Sets 'dctx->allowed' to 'allowed'. * * Requires: *\li 'dctx' to be initialized */ unsigned int dns_decompress_getmethods(dns_decompress_t *dctx); /*%< * Returns 'dctx->allowed' * * Requires: *\li 'dctx' to be initialized */ int dns_decompress_edns(dns_decompress_t *dctx); /*%< * Returns 'dctx->edns' * * Requires: *\li 'dctx' to be initialized */ dns_decompresstype_t dns_decompress_type(dns_decompress_t *dctx); /*%< * Returns 'dctx->type' * * Requires: *\li 'dctx' to be initialized */ ISC_LANG_ENDDECLS #endif /* DNS_COMPRESS_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/ds.h��������������������������������������������������������������������������������������0000644�����������������00000002306�14763166026�0007130 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_DS_H #define DNS_DS_H 1 #include <isc/lang.h> #include <dns/types.h> #define DNS_DSDIGEST_SHA1 (1) #define DNS_DSDIGEST_SHA256 (2) #define DNS_DSDIGEST_GOST (3) #define DNS_DSDIGEST_SHA384 (4) /* * Assuming SHA-384 digest type. */ #define DNS_DS_BUFFERSIZE (52) ISC_LANG_BEGINDECLS isc_result_t dns_ds_buildrdata(dns_name_t *owner, dns_rdata_t *key, unsigned int digest_type, unsigned char *buffer, dns_rdata_t *rdata); /*%< * Build the rdata of a DS record. * * Requires: *\li key Points to a valid DNS KEY record. *\li buffer Points to a temporary buffer of at least * #DNS_DS_BUFFERSIZE bytes. *\li rdata Points to an initialized dns_rdata_t. * * Ensures: * \li *rdata Contains a valid DS rdata. The 'data' member refers * to 'buffer'. */ ISC_LANG_ENDDECLS #endif /* DNS_DS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/dnssec.h����������������������������������������������������������������������������������0000644�����������������00000030004�14763166026�0007775 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_DNSSEC_H #define DNS_DNSSEC_H 1 /*! \file dns/dnssec.h */ #include <isc/lang.h> #include <isc/stdtime.h> #include <isc/stats.h> #include <dns/diff.h> #include <dns/types.h> #include <dst/dst.h> ISC_LANG_BEGINDECLS LIBDNS_EXTERNAL_DATA extern isc_stats_t *dns_dnssec_stats; /*%< Maximum number of keys supported in a zone. */ #define DNS_MAXZONEKEYS 32 /* * Indicates how the signer found this key: in the key repository, at the * zone apex, or specified by the user. */ typedef enum { dns_keysource_unknown, dns_keysource_repository, dns_keysource_zoneapex, dns_keysource_user } dns_keysource_t; /* * A DNSSEC key and hints about its intended use gleaned from metadata */ struct dns_dnsseckey { dst_key_t *key; isc_boolean_t hint_publish; /*% metadata says to publish */ isc_boolean_t force_publish; /*% publish regardless of metadata */ isc_boolean_t hint_sign; /*% metadata says to sign with this key */ isc_boolean_t force_sign; /*% sign with key regardless of metadata */ isc_boolean_t hint_remove; /*% metadata says *don't* publish */ isc_boolean_t is_active; /*% key is already active */ isc_boolean_t first_sign; /*% key is newly becoming active */ unsigned int prepublish; /*% how long until active? */ dns_keysource_t source; /*% how the key was found */ isc_boolean_t ksk; /*% this is a key-signing key */ isc_boolean_t legacy; /*% this is old-style key with no metadata (possibly generated by an older version of BIND9) and should be ignored when searching for keys to import into the zone */ unsigned int index; /*% position in list */ ISC_LINK(dns_dnsseckey_t) link; }; isc_result_t dns_dnssec_keyfromrdata(dns_name_t *name, dns_rdata_t *rdata, isc_mem_t *mctx, dst_key_t **key); /*%< * Creates a DST key from a DNS record. Basically a wrapper around * dst_key_fromdns(). * * Requires: *\li 'name' is not NULL *\li 'rdata' is not NULL *\li 'mctx' is not NULL *\li 'key' is not NULL *\li '*key' is NULL * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li DST_R_INVALIDPUBLICKEY *\li various errors from dns_name_totext */ isc_result_t dns_dnssec_sign(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, isc_stdtime_t *inception, isc_stdtime_t *expire, isc_mem_t *mctx, isc_buffer_t *buffer, dns_rdata_t *sigrdata); /*%< * Generates a RRSIG record covering this rdataset. This has no effect * on existing RRSIG records. * * Requires: *\li 'name' (the owner name of the record) is a valid name *\li 'set' is a valid rdataset *\li 'key' is a valid key *\li 'inception' is not NULL *\li 'expire' is not NULL *\li 'mctx' is not NULL *\li 'buffer' is not NULL *\li 'sigrdata' is not NULL * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li #ISC_R_NOSPACE *\li #DNS_R_INVALIDTIME - the expiration is before the inception *\li #DNS_R_KEYUNAUTHORIZED - the key cannot sign this data (either * it is not a zone key or its flags prevent * authentication) *\li DST_R_* */ isc_result_t dns_dnssec_verify(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, isc_boolean_t ignoretime, isc_mem_t *mctx, dns_rdata_t *sigrdata); isc_result_t dns_dnssec_verify2(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, isc_boolean_t ignoretime, isc_mem_t *mctx, dns_rdata_t *sigrdata, dns_name_t *wild); isc_result_t dns_dnssec_verify3(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, isc_boolean_t ignoretime, unsigned int maxbits, isc_mem_t *mctx, dns_rdata_t *sigrdata, dns_name_t *wild); /*%< * Verifies the RRSIG record covering this rdataset signed by a specific * key. This does not determine if the key's owner is authorized to sign * this record, as this requires a resolver or database. * If 'ignoretime' is ISC_TRUE, temporal validity will not be checked. * * 'maxbits' specifies the maximum number of rsa exponent bits accepted. * * Requires: *\li 'name' (the owner name of the record) is a valid name *\li 'set' is a valid rdataset *\li 'key' is a valid key *\li 'mctx' is not NULL *\li 'sigrdata' is a valid rdata containing a SIG record *\li 'wild' if non-NULL then is a valid and has a buffer. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li #DNS_R_FROMWILDCARD - the signature is valid and is from * a wildcard expansion. dns_dnssec_verify2() only. * 'wild' contains the name of the wildcard if non-NULL. *\li #DNS_R_SIGINVALID - the signature fails to verify *\li #DNS_R_SIGEXPIRED - the signature has expired *\li #DNS_R_SIGFUTURE - the signature's validity period has not begun *\li #DNS_R_KEYUNAUTHORIZED - the key cannot sign this data (either * it is not a zone key or its flags prevent * authentication) *\li DST_R_* */ /*@{*/ isc_result_t dns_dnssec_findzonekeys(dns_db_t *db, dns_dbversion_t *ver, dns_dbnode_t *node, dns_name_t *name, isc_mem_t *mctx, unsigned int maxkeys, dst_key_t **keys, unsigned int *nkeys); isc_result_t dns_dnssec_findzonekeys2(dns_db_t *db, dns_dbversion_t *ver, dns_dbnode_t *node, dns_name_t *name, const char *directory, isc_mem_t *mctx, unsigned int maxkeys, dst_key_t **keys, unsigned int *nkeys); isc_result_t dns_dnssec_findzonekeys3(dns_db_t *db, dns_dbversion_t *ver, dns_dbnode_t *node, dns_name_t *name, const char *directory, isc_stdtime_t now, isc_mem_t *mctx, unsigned int maxkeys, dst_key_t **keys, unsigned int *nkeys); /*%< * Finds a set of zone keys. * XXX temporary - this should be handled in dns_zone_t. */ /*@}*/ isc_boolean_t dns_dnssec_keyactive(dst_key_t *key, isc_stdtime_t now); /*%< * * Returns ISC_TRUE if 'key' is active as of the time specified * in 'now' (i.e., if the activation date has passed, inactivation or * deletion date has not yet been reached, and the key is not revoked * -- or if it is a legacy key without metadata). Otherwise returns * ISC_FALSE. * * Requires: *\li 'key' is a valid key */ isc_result_t dns_dnssec_signmessage(dns_message_t *msg, dst_key_t *key); /*%< * Signs a message with a SIG(0) record. This is implicitly called by * dns_message_renderend() if msg->sig0key is not NULL. * * Requires: *\li 'msg' is a valid message *\li 'key' is a valid key that can be used for signing * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li DST_R_* */ isc_result_t dns_dnssec_verifymessage(isc_buffer_t *source, dns_message_t *msg, dst_key_t *key); /*%< * Verifies a message signed by a SIG(0) record. This is not * called implicitly by dns_message_parse(). If dns_message_signer() * is called before dns_dnssec_verifymessage(), it will return * #DNS_R_NOTVERIFIEDYET. dns_dnssec_verifymessage() will set * the verified_sig0 flag in msg if the verify succeeds, and * the sig0status field otherwise. * * Requires: *\li 'source' is a valid buffer containing the unparsed message *\li 'msg' is a valid message *\li 'key' is a valid key * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li #ISC_R_NOTFOUND - no SIG(0) was found *\li #DNS_R_SIGINVALID - the SIG record is not well-formed or * was not generated by the key. *\li DST_R_* */ isc_boolean_t dns_dnssec_selfsigns(dns_rdata_t *rdata, dns_name_t *name, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, isc_boolean_t ignoretime, isc_mem_t *mctx); isc_boolean_t dns_dnssec_signs(dns_rdata_t *rdata, dns_name_t *name, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, isc_boolean_t ignoretime, isc_mem_t *mctx); /*%< * Verify that 'rdataset' is validly signed in 'sigrdataset' by * the key in 'rdata'. * * dns_dnssec_selfsigns() requires that rdataset be a DNSKEY or KEY * rrset. dns_dnssec_signs() works on any rrset. */ isc_result_t dns_dnsseckey_create(isc_mem_t *mctx, dst_key_t **dstkey, dns_dnsseckey_t **dkp); /*%< * Create and initialize a dns_dnsseckey_t structure. * * Requires: *\li 'dkp' is not NULL and '*dkp' is NULL. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY */ void dns_dnsseckey_destroy(isc_mem_t *mctx, dns_dnsseckey_t **dkp); /*%< * Reclaim a dns_dnsseckey_t structure. * * Requires: *\li 'dkp' is not NULL and '*dkp' is not NULL. * * Ensures: *\li '*dkp' is NULL. */ isc_result_t dns_dnssec_findmatchingkeys(dns_name_t *origin, const char *directory, isc_mem_t *mctx, dns_dnsseckeylist_t *keylist); isc_result_t dns_dnssec_findmatchingkeys2(dns_name_t *origin, const char *directory, isc_stdtime_t now, isc_mem_t *mctx, dns_dnsseckeylist_t *keylist); /*%< * Search 'directory' for K* key files matching the name in 'origin'. * Append all such keys, along with use hints gleaned from their * metadata, onto 'keylist'. Skip any unsupported algorithms. * * Requires: *\li 'keylist' is not NULL * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOTFOUND *\li #ISC_R_NOMEMORY *\li any error returned by dns_name_totext(), isc_dir_open(), or * dst_key_fromnamedfile() * * Ensures: *\li On error, keylist is unchanged */ isc_result_t dns_dnssec_keylistfromrdataset(dns_name_t *origin, const char *directory, isc_mem_t *mctx, dns_rdataset_t *keyset, dns_rdataset_t *keysigs, dns_rdataset_t *soasigs, isc_boolean_t savekeys, isc_boolean_t publickey, dns_dnsseckeylist_t *keylist); /*%< * Append the contents of a DNSKEY rdataset 'keyset' to 'keylist'. * Omit duplicates. If 'publickey' is ISC_FALSE, search 'directory' for * matching key files, and load the private keys that go with * the public ones. If 'savekeys' is ISC_TRUE, mark the keys so * they will not be deleted or inactivated regardless of metadata. * * 'keysigs' and 'soasigs', if not NULL and associated, contain the * RRSIGS for the DNSKEY and SOA records respectively and are used to mark * whether a key is already active in the zone. */ isc_result_t dns_dnssec_updatekeys(dns_dnsseckeylist_t *keys, dns_dnsseckeylist_t *newkeys, dns_dnsseckeylist_t *removed, dns_name_t *origin, dns_ttl_t hint_ttl, dns_diff_t *diff, isc_boolean_t allzsk, isc_mem_t *mctx, void (*report)(const char *, ...)); /*%< * Update the list of keys in 'keys' with new key information in 'newkeys'. * * For each key in 'newkeys', see if it has a match in 'keys'. * - If not, and if the metadata says the key should be published: * add it to 'keys', and place a dns_difftuple into 'diff' so * the key can be added to the DNSKEY set. If the metadata says it * should be active, set the first_sign flag. * - If so, and if the metadata says it should be removed: * remove it from 'keys', and place a dns_difftuple into 'diff' so * the key can be removed from the DNSKEY set. if 'removed' is non-NULL, * copy the key into that list; otherwise destroy it. * - Otherwise, make sure keys has current metadata. * * If 'allzsk' is true, we are allowing KSK-flagged keys to be used as * ZSKs. * * 'hint_ttl' is the TTL to use for the DNSKEY RRset if there is no * existing RRset, and if none of the keys to be added has a default TTL * (in which case we would use the shortest one). If the TTL is longer * than the time until a new key will be activated, then we have to delay * the key's activation. * * 'report' points to a function for reporting status. * * On completion, any remaining keys in 'newkeys' are freed. */ isc_result_t dns_dnssec_syncupdate(dns_dnsseckeylist_t *keys, dns_dnsseckeylist_t *rmkeys, dns_rdataset_t *cds, dns_rdataset_t *cdnskey, isc_stdtime_t now, dns_ttl_t hint_ttl, dns_diff_t *diff, isc_mem_t *mctx); /*%< * Update the CDS and CDNSKEY RRsets, adding and removing keys as needed. */ ISC_LANG_ENDDECLS #endif /* DNS_DNSSEC_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/db.h��������������������������������������������������������������������������������������0000644�����������������00000131271�14763166026�0007113 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id$ */ #ifndef DNS_DB_H #define DNS_DB_H 1 /***** ***** Module Info *****/ /*! \file dns/db.h * \brief * The DNS DB interface allows named rdatasets to be stored and retrieved. * * The dns_db_t type is like a "virtual class". To actually use * DBs, an implementation of the class is required. * * XXX more XXX * * MP: * \li The module ensures appropriate synchronization of data structures it * creates and manipulates. * * Reliability: * \li No anticipated impact. * * Resources: * \li TBS * * Security: * \li No anticipated impact. * * Standards: * \li None. */ /***** ***** Imports *****/ #include <isc/deprecated.h> #include <isc/lang.h> #include <isc/magic.h> #include <isc/ondestroy.h> #include <isc/stats.h> #include <isc/stdtime.h> #include <dns/clientinfo.h> #include <dns/fixedname.h> #include <dns/name.h> #include <dns/rdata.h> #include <dns/rdataset.h> #include <dns/rpz.h> #include <dns/types.h> ISC_LANG_BEGINDECLS /***** ***** Types *****/ typedef struct dns_dbmethods { void (*attach)(dns_db_t *source, dns_db_t **targetp); void (*detach)(dns_db_t **dbp); isc_result_t (*beginload)(dns_db_t *db, dns_rdatacallbacks_t *callbacks); isc_result_t (*endload)(dns_db_t *db, dns_rdatacallbacks_t *callbacks); isc_result_t (*serialize)(dns_db_t *db, dns_dbversion_t *version, FILE *file); isc_result_t (*dump)(dns_db_t *db, dns_dbversion_t *version, const char *filename, dns_masterformat_t masterformat); void (*currentversion)(dns_db_t *db, dns_dbversion_t **versionp); isc_result_t (*newversion)(dns_db_t *db, dns_dbversion_t **versionp); void (*attachversion)(dns_db_t *db, dns_dbversion_t *source, dns_dbversion_t **targetp); void (*closeversion)(dns_db_t *db, dns_dbversion_t **versionp, isc_boolean_t commit); isc_result_t (*findnode)(dns_db_t *db, dns_name_t *name, isc_boolean_t create, dns_dbnode_t **nodep); isc_result_t (*find)(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version, dns_rdatatype_t type, unsigned int options, isc_stdtime_t now, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset); isc_result_t (*findzonecut)(dns_db_t *db, dns_name_t *name, unsigned int options, isc_stdtime_t now, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset); void (*attachnode)(dns_db_t *db, dns_dbnode_t *source, dns_dbnode_t **targetp); void (*detachnode)(dns_db_t *db, dns_dbnode_t **targetp); isc_result_t (*expirenode)(dns_db_t *db, dns_dbnode_t *node, isc_stdtime_t now); void (*printnode)(dns_db_t *db, dns_dbnode_t *node, FILE *out); isc_result_t (*createiterator)(dns_db_t *db, unsigned int options, dns_dbiterator_t **iteratorp); isc_result_t (*findrdataset)(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdatatype_t type, dns_rdatatype_t covers, isc_stdtime_t now, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset); isc_result_t (*allrdatasets)(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, isc_stdtime_t now, dns_rdatasetiter_t **iteratorp); isc_result_t (*addrdataset)(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, isc_stdtime_t now, dns_rdataset_t *rdataset, unsigned int options, dns_rdataset_t *addedrdataset); isc_result_t (*subtractrdataset)(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdataset_t *rdataset, unsigned int options, dns_rdataset_t *newrdataset); isc_result_t (*deleterdataset)(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdatatype_t type, dns_rdatatype_t covers); isc_boolean_t (*issecure)(dns_db_t *db); unsigned int (*nodecount)(dns_db_t *db); isc_boolean_t (*ispersistent)(dns_db_t *db); void (*overmem)(dns_db_t *db, isc_boolean_t overmem); void (*settask)(dns_db_t *db, isc_task_t *); isc_result_t (*getoriginnode)(dns_db_t *db, dns_dbnode_t **nodep); void (*transfernode)(dns_db_t *db, dns_dbnode_t **sourcep, dns_dbnode_t **targetp); isc_result_t (*getnsec3parameters)(dns_db_t *db, dns_dbversion_t *version, dns_hash_t *hash, isc_uint8_t *flags, isc_uint16_t *iterations, unsigned char *salt, size_t *salt_len); isc_result_t (*findnsec3node)(dns_db_t *db, dns_name_t *name, isc_boolean_t create, dns_dbnode_t **nodep); isc_result_t (*setsigningtime)(dns_db_t *db, dns_rdataset_t *rdataset, isc_stdtime_t resign); isc_result_t (*getsigningtime)(dns_db_t *db, dns_rdataset_t *rdataset, dns_name_t *name); void (*resigned)(dns_db_t *db, dns_rdataset_t *rdataset, dns_dbversion_t *version); isc_boolean_t (*isdnssec)(dns_db_t *db); dns_stats_t *(*getrrsetstats)(dns_db_t *db); void (*rpz_attach)(dns_db_t *db, dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num); isc_result_t (*rpz_ready)(dns_db_t *db); isc_result_t (*findnodeext)(dns_db_t *db, dns_name_t *name, isc_boolean_t create, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo, dns_dbnode_t **nodep); isc_result_t (*findext)(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version, dns_rdatatype_t type, unsigned int options, isc_stdtime_t now, dns_dbnode_t **nodep, dns_name_t *foundname, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset); isc_result_t (*setcachestats)(dns_db_t *db, isc_stats_t *stats); size_t (*hashsize)(dns_db_t *db); isc_result_t (*nodefullname)(dns_db_t *db, dns_dbnode_t *node, dns_name_t *name); isc_result_t (*getsize)(dns_db_t *db, dns_dbversion_t *version, isc_uint64_t *records, isc_uint64_t *bytes); } dns_dbmethods_t; typedef isc_result_t (*dns_dbcreatefunc_t)(isc_mem_t *mctx, dns_name_t *name, dns_dbtype_t type, dns_rdataclass_t rdclass, unsigned int argc, char *argv[], void *driverarg, dns_db_t **dbp); typedef isc_result_t (*dns_dbupdate_callback_t)(dns_db_t *db, void *fn_arg); #define DNS_DB_MAGIC ISC_MAGIC('D','N','S','D') #define DNS_DB_VALID(db) ISC_MAGIC_VALID(db, DNS_DB_MAGIC) /*% * This structure is actually just the common prefix of a DNS db * implementation's version of a dns_db_t. * \brief * Direct use of this structure by clients is forbidden. DB implementations * may change the structure. 'magic' must be DNS_DB_MAGIC for any of the * dns_db_ routines to work. DB implementations must maintain all DB * invariants. */ struct dns_db { unsigned int magic; unsigned int impmagic; dns_dbmethods_t * methods; isc_uint16_t attributes; dns_rdataclass_t rdclass; dns_name_t origin; isc_ondestroy_t ondest; isc_mem_t * mctx; ISC_LIST(dns_dbonupdatelistener_t) update_listeners; }; #define DNS_DBATTR_CACHE 0x01 #define DNS_DBATTR_STUB 0x02 struct dns_dbonupdatelistener { dns_dbupdate_callback_t onupdate; void * onupdate_arg; ISC_LINK(dns_dbonupdatelistener_t) link; }; /*@{*/ /*% * Options that can be specified for dns_db_find(). */ #define DNS_DBFIND_GLUEOK 0x0001 #define DNS_DBFIND_VALIDATEGLUE 0x0002 #define DNS_DBFIND_NOWILD 0x0004 #define DNS_DBFIND_PENDINGOK 0x0008 #define DNS_DBFIND_NOEXACT 0x0010 #define DNS_DBFIND_FORCENSEC 0x0020 #define DNS_DBFIND_COVERINGNSEC 0x0040 #define DNS_DBFIND_FORCENSEC3 0x0080 #define DNS_DBFIND_ADDITIONALOK 0x0100 #define DNS_DBFIND_NOZONECUT 0x0200 /*@}*/ /*@{*/ /*% * Options that can be specified for dns_db_addrdataset(). */ #define DNS_DBADD_MERGE 0x01 #define DNS_DBADD_FORCE 0x02 #define DNS_DBADD_EXACT 0x04 #define DNS_DBADD_EXACTTTL 0x08 #define DNS_DBADD_PREFETCH 0x10 /*@}*/ /*% * Options that can be specified for dns_db_subtractrdataset(). */ #define DNS_DBSUB_EXACT 0x01 #define DNS_DBSUB_WANTOLD 0x02 /*@{*/ /*% * Iterator options */ #define DNS_DB_RELATIVENAMES 0x1 #define DNS_DB_NSEC3ONLY 0x2 #define DNS_DB_NONSEC3 0x4 /*@}*/ /***** ***** Methods *****/ /*** *** Basic DB Methods ***/ isc_result_t dns_db_create(isc_mem_t *mctx, const char *db_type, dns_name_t *origin, dns_dbtype_t type, dns_rdataclass_t rdclass, unsigned int argc, char *argv[], dns_db_t **dbp); /*%< * Create a new database using implementation 'db_type'. * * Notes: * \li All names in the database must be subdomains of 'origin' and in class * 'rdclass'. The database makes its own copy of the origin, so the * caller may do whatever they like with 'origin' and its storage once the * call returns. * * \li DB implementation-specific parameters are passed using argc and argv. * * Requires: * * \li dbp != NULL and *dbp == NULL * * \li 'origin' is a valid absolute domain name. * * \li mctx is a valid memory context * * Ensures: * * \li A copy of 'origin' has been made for the databases use, and the * caller is free to do whatever they want with the name and storage * associated with 'origin'. * * Returns: * * \li #ISC_R_SUCCESS * \li #ISC_R_NOMEMORY * \li #ISC_R_NOTFOUND db_type not found * * \li Many other errors are possible, depending on what db_type was * specified. */ void dns_db_attach(dns_db_t *source, dns_db_t **targetp); /*%< * Attach *targetp to source. * * Requires: * * \li 'source' is a valid database. * * \li 'targetp' points to a NULL dns_db_t *. * * Ensures: * * \li *targetp is attached to source. */ void dns_db_detach(dns_db_t **dbp); /*%< * Detach *dbp from its database. * * Requires: * * \li 'dbp' points to a valid database. * * Ensures: * * \li *dbp is NULL. * * \li If '*dbp' is the last reference to the database, * all resources used by the database will be freed */ isc_result_t dns_db_ondestroy(dns_db_t *db, isc_task_t *task, isc_event_t **eventp); /*%< * Causes 'eventp' to be sent to be sent to 'task' when the database is * destroyed. * * Note; ownership of the eventp is taken from the caller (and *eventp is * set to NULL). The sender field of the event is set to 'db' before it is * sent to the task. */ isc_boolean_t dns_db_iscache(dns_db_t *db); /*%< * Does 'db' have cache semantics? * * Requires: * * \li 'db' is a valid database. * * Returns: * \li #ISC_TRUE 'db' has cache semantics * \li #ISC_FALSE otherwise */ isc_boolean_t dns_db_iszone(dns_db_t *db); /*%< * Does 'db' have zone semantics? * * Requires: * * \li 'db' is a valid database. * * Returns: * \li #ISC_TRUE 'db' has zone semantics * \li #ISC_FALSE otherwise */ isc_boolean_t dns_db_isstub(dns_db_t *db); /*%< * Does 'db' have stub semantics? * * Requires: * * \li 'db' is a valid database. * * Returns: * \li #ISC_TRUE 'db' has zone semantics * \li #ISC_FALSE otherwise */ isc_boolean_t dns_db_issecure(dns_db_t *db); /*%< * Is 'db' secure? * * Requires: * * \li 'db' is a valid database with zone semantics. * * Returns: * \li #ISC_TRUE 'db' is secure. * \li #ISC_FALSE 'db' is not secure. */ isc_boolean_t dns_db_isdnssec(dns_db_t *db); /*%< * Is 'db' secure or partially secure? * * Requires: * * \li 'db' is a valid database with zone semantics. * * Returns: * \li #ISC_TRUE 'db' is secure or is partially. * \li #ISC_FALSE 'db' is not secure. */ dns_name_t * dns_db_origin(dns_db_t *db); /*%< * The origin of the database. * * Note: caller must not try to change this name. * * Requires: * * \li 'db' is a valid database. * * Returns: * * \li The origin of the database. */ dns_rdataclass_t dns_db_class(dns_db_t *db); /*%< * The class of the database. * * Requires: * * \li 'db' is a valid database. * * Returns: * * \li The class of the database. */ isc_result_t dns_db_beginload(dns_db_t *db, dns_rdatacallbacks_t *callbacks); /*%< * Begin loading 'db'. * * Requires: * * \li 'db' is a valid database. * * \li This is the first attempt to load 'db'. * * \li 'callbacks' is a pointer to an initialized dns_rdatacallbacks_t * structure. * * Ensures: * * \li On success, callbacks->add will be a valid dns_addrdatasetfunc_t * suitable for loading records into 'db' from a raw or text zone * file. callbacks->add_private will be a valid DB load context * which should be used as 'arg' when callbacks->add is called. * callbacks->deserialize will be a valid dns_deserialize_func_t * suitable for loading 'db' from a map format zone file. * * Returns: * * \li #ISC_R_SUCCESS * \li #ISC_R_NOMEMORY * * \li Other results are possible, depending upon the database * implementation used, syntax errors in the master file, etc. */ isc_result_t dns_db_endload(dns_db_t *db, dns_rdatacallbacks_t *callbacks); /*%< * Finish loading 'db'. * * Requires: * * \li 'db' is a valid database that is being loaded. * * \li 'callbacks' is a valid dns_rdatacallbacks_t structure. * * \li callbacks->add_private is not NULL and is a valid database load context. * * Ensures: * * \li 'callbacks' is returned to its state prior to calling dns_db_beginload() * * Returns: * * \li #ISC_R_SUCCESS * \li #ISC_R_NOMEMORY * * \li Other results are possible, depending upon the database * implementation used, syntax errors in the master file, etc. */ isc_result_t dns_db_load(dns_db_t *db, const char *filename); isc_result_t dns_db_load2(dns_db_t *db, const char *filename, dns_masterformat_t format); isc_result_t dns_db_load3(dns_db_t *db, const char *filename, dns_masterformat_t format, unsigned int options); /*%< * Load master file 'filename' into 'db'. * * Notes: * \li This routine is equivalent to calling * *\code * dns_db_beginload(); * dns_master_loadfile(); * dns_db_endload(); *\endcode * * Requires: * * \li 'db' is a valid database. * * \li This is the first attempt to load 'db'. * * Returns: * * \li #ISC_R_SUCCESS * \li #ISC_R_NOMEMORY * * \li Other results are possible, depending upon the database * implementation used, syntax errors in the master file, etc. */ isc_result_t dns_db_serialize(dns_db_t *db, dns_dbversion_t *version, FILE *rbtfile); /*%< * Dump version 'version' of 'db' to map-format file 'filename'. * * Requires: * * \li 'db' is a valid database. * * \li 'version' is a valid version. * * Returns: * * \li #ISC_R_SUCCESS * \li #ISC_R_NOMEMORY * * \li Other results are possible, depending upon the database * implementation used, OS file errors, etc. */ isc_result_t dns_db_dump(dns_db_t *db, dns_dbversion_t *version, const char *filename); isc_result_t dns_db_dump2(dns_db_t *db, dns_dbversion_t *version, const char *filename, dns_masterformat_t masterformat); /*%< * Dump version 'version' of 'db' to master file 'filename'. * * Requires: * * \li 'db' is a valid database. * * \li 'version' is a valid version. * * Returns: * * \li #ISC_R_SUCCESS * \li #ISC_R_NOMEMORY * * \li Other results are possible, depending upon the database * implementation used, OS file errors, etc. */ /*** *** Version Methods ***/ void dns_db_currentversion(dns_db_t *db, dns_dbversion_t **versionp); /*%< * Open the current version for reading. * * Requires: * * \li 'db' is a valid database with zone semantics. * * \li versionp != NULL && *verisonp == NULL * * Ensures: * * \li On success, '*versionp' is attached to the current version. * */ isc_result_t dns_db_newversion(dns_db_t *db, dns_dbversion_t **versionp); /*%< * Open a new version for reading and writing. * * Requires: * * \li 'db' is a valid database with zone semantics. * * \li versionp != NULL && *verisonp == NULL * * Ensures: * * \li On success, '*versionp' is attached to the current version. * * Returns: * * \li #ISC_R_SUCCESS * \li #ISC_R_NOMEMORY * * \li Other results are possible, depending upon the database * implementation used. */ void dns_db_attachversion(dns_db_t *db, dns_dbversion_t *source, dns_dbversion_t **targetp); /*%< * Attach '*targetp' to 'source'. * * Requires: * * \li 'db' is a valid database with zone semantics. * * \li source is a valid open version * * \li targetp != NULL && *targetp == NULL * * Ensures: * * \li '*targetp' is attached to source. */ void dns_db_closeversion(dns_db_t *db, dns_dbversion_t **versionp, isc_boolean_t commit); /*%< * Close version '*versionp'. * * Note: if '*versionp' is a read-write version and 'commit' is ISC_TRUE, * then all changes made in the version will take effect, otherwise they * will be rolled back. The value of 'commit' is ignored for read-only * versions. * * Requires: * * \li 'db' is a valid database with zone semantics. * * \li '*versionp' refers to a valid version. * * \li If committing a writable version, then there must be no other * outstanding references to the version (e.g. an active rdataset * iterator). * * Ensures: * * \li *versionp == NULL * * \li If *versionp is a read-write version, and commit is ISC_TRUE, then * the version will become the current version. If !commit, then all * changes made in the version will be undone, and the version will * not become the current version. */ /*** *** Node Methods ***/ isc_result_t dns_db_findnode(dns_db_t *db, dns_name_t *name, isc_boolean_t create, dns_dbnode_t **nodep); isc_result_t dns_db_findnodeext(dns_db_t *db, dns_name_t *name, isc_boolean_t create, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo, dns_dbnode_t **nodep); /*%< * Find the node with name 'name'. * * dns_db_findnodeext() (findnode extended) also accepts parameters * 'methods' and 'clientinfo', which, when provided, enable the database to * retreive information about the client from the caller, and modify its * response on the basis of that information. * * Notes: * \li If 'create' is ISC_TRUE and no node with name 'name' exists, then * such a node will be created. * * \li This routine is for finding or creating a node with the specified * name. There are no partial matches. It is not suitable for use * in building responses to ordinary DNS queries; clients which wish * to do that should use dns_db_find() instead. * * Requires: * * \li 'db' is a valid database. * * \li 'name' is a valid, non-empty, absolute name. * * \li nodep != NULL && *nodep == NULL * * Ensures: * * \li On success, *nodep is attached to the node with name 'name'. * * Returns: * * \li #ISC_R_SUCCESS * \li #ISC_R_NOTFOUND If !create and name not found. * \li #ISC_R_NOMEMORY Can only happen if create is ISC_TRUE. * * \li Other results are possible, depending upon the database * implementation used. */ isc_result_t dns_db_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version, dns_rdatatype_t type, unsigned int options, isc_stdtime_t now, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset); isc_result_t dns_db_findext(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version, dns_rdatatype_t type, unsigned int options, isc_stdtime_t now, dns_dbnode_t **nodep, dns_name_t *foundname, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset); /*%< * Find the best match for 'name' and 'type' in version 'version' of 'db'. * * dns_db_findext() (find extended) also accepts parameters 'methods' * and 'clientinfo', which when provided enable the database to retreive * information about the client from the caller, and modify its response * on the basis of this information. * * Notes: * * \li If type == dns_rdataset_any, then rdataset will not be bound. * * \li If 'options' does not have #DNS_DBFIND_GLUEOK set, then no glue will * be returned. For zone databases, glue is as defined in RFC2181. * For cache databases, glue is any rdataset with a trust of * dns_trust_glue. * * \li If 'options' does not have #DNS_DBFIND_ADDITIONALOK set, then no * additional records will be returned. Only caches can have * rdataset with trust dns_trust_additional. * * \li If 'options' does not have #DNS_DBFIND_PENDINGOK set, then no * pending data will be returned. This option is only meaningful for * cache databases. * * \li If the #DNS_DBFIND_NOWILD option is set, then wildcard matching will * be disabled. This option is only meaningful for zone databases. * * \li If the #DNS_DBFIND_NOZONECUT option is set, the database is * assumed to contain no zone cuts above 'name'. An implementation * may therefore choose to search for a match beginning at 'name' * rather than walking down the tree to check check for delegations. * If #DNS_DBFIND_NOWILD is not set, wildcard matching will be * attempted at each node starting at the direct ancestor of 'name' * and working up to the zone origin. This option is only meaningful * when querying redirect zones. * * \li If the #DNS_DBFIND_FORCENSEC option is set, the database is assumed to * have NSEC records, and these will be returned when appropriate. This * is only necessary when querying a database that was not secure * when created. * * \li If the DNS_DBFIND_COVERINGNSEC option is set, then look for a * NSEC record that potentially covers 'name' if a answer cannot * be found. Note the returned NSEC needs to be checked to ensure * that it is correct. This only affects answers returned from the * cache. * * \li If the #DNS_DBFIND_FORCENSEC3 option is set, then we are looking * in the NSEC3 tree and not the main tree. Without this option being * set NSEC3 records will not be found. * * \li To respond to a query for SIG records, the caller should create a * rdataset iterator and extract the signatures from each rdataset. * * \li Making queries of type ANY with #DNS_DBFIND_GLUEOK is not recommended, * because the burden of determining whether a given rdataset is valid * glue or not falls upon the caller. * * \li The 'now' field is ignored if 'db' is a zone database. If 'db' is a * cache database, an rdataset will not be found unless it expires after * 'now'. Any ANY query will not match unless at least one rdataset at * the node expires after 'now'. If 'now' is zero, then the current time * will be used. * * Requires: * * \li 'db' is a valid database. * * \li 'type' is not SIG, or a meta-RR type other than 'ANY' (e.g. 'OPT'). * * \li 'nodep' is NULL, or nodep is a valid pointer and *nodep == NULL. * * \li 'foundname' is a valid name with a dedicated buffer. * * \li 'rdataset' is NULL, or is a valid unassociated rdataset. * * Ensures, * on a non-error completion: * * \li If nodep != NULL, then it is bound to the found node. * * \li If foundname != NULL, then it contains the full name of the * found node. * * \li If rdataset != NULL and type != dns_rdatatype_any, then * rdataset is bound to the found rdataset. * * Non-error results are: * * \li #ISC_R_SUCCESS The desired node and type were * found. * * \li #DNS_R_GLUE The desired node and type were * found, but are glue. This * result can only occur if * the DNS_DBFIND_GLUEOK option * is set. This result can only * occur if 'db' is a zone * database. If type == * dns_rdatatype_any, then the * node returned may contain, or * consist entirely of invalid * glue (i.e. data occluded by a * zone cut). The caller must * take care not to return invalid * glue to a client. * * \li #DNS_R_DELEGATION The data requested is beneath * a zone cut. node, foundname, * and rdataset reference the * NS RRset of the zone cut. * If 'db' is a cache database, * then this is the deepest known * delegation. * * \li #DNS_R_ZONECUT type == dns_rdatatype_any, and * the desired node is a zonecut. * The caller must take care not * to return inappropriate glue * to a client. This result can * only occur if 'db' is a zone * database and DNS_DBFIND_GLUEOK * is set. * * \li #DNS_R_DNAME The data requested is beneath * a DNAME. node, foundname, * and rdataset reference the * DNAME RRset. * * \li #DNS_R_CNAME The rdataset requested was not * found, but there is a CNAME * at the desired name. node, * foundname, and rdataset * reference the CNAME RRset. * * \li #DNS_R_NXDOMAIN The desired name does not * exist. * * \li #DNS_R_NXRRSET The desired name exists, but * the desired type does not. * * \li #ISC_R_NOTFOUND The desired name does not * exist, and no delegation could * be found. This result can only * occur if 'db' is a cache * database. The caller should * use its nameserver(s) of last * resort (e.g. root hints). * * \li #DNS_R_NCACHENXDOMAIN The desired name does not * exist. 'node' is bound to the * cache node with the desired * name, and 'rdataset' contains * the negative caching proof. * * \li #DNS_R_NCACHENXRRSET The desired type does not * exist. 'node' is bound to the * cache node with the desired * name, and 'rdataset' contains * the negative caching proof. * * \li #DNS_R_EMPTYNAME The name exists but there is * no data at the name. * * \li #DNS_R_COVERINGNSEC The returned data is a NSEC * that potentially covers 'name'. * * \li #DNS_R_EMPTYWILD The name is a wildcard without * resource records. * * Error results: * * \li #ISC_R_NOMEMORY * * \li #DNS_R_BADDB Data that is required to be * present in the DB, e.g. an NSEC * record in a secure zone, is not * present. * * \li Other results are possible, and should all be treated as * errors. */ isc_result_t dns_db_findzonecut(dns_db_t *db, dns_name_t *name, unsigned int options, isc_stdtime_t now, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset); /*%< * Find the deepest known zonecut which encloses 'name' in 'db'. * * Notes: * * \li If the #DNS_DBFIND_NOEXACT option is set, then the zonecut returned * (if any) will be the deepest known ancestor of 'name'. * * \li If 'now' is zero, then the current time will be used. * * Requires: * * \li 'db' is a valid database with cache semantics. * * \li 'nodep' is NULL, or nodep is a valid pointer and *nodep == NULL. * * \li 'foundname' is a valid name with a dedicated buffer. * * \li 'rdataset' is NULL, or is a valid unassociated rdataset. * * Ensures, on a non-error completion: * * \li If nodep != NULL, then it is bound to the found node. * * \li If foundname != NULL, then it contains the full name of the * found node. * * \li If rdataset != NULL and type != dns_rdatatype_any, then * rdataset is bound to the found rdataset. * * Non-error results are: * * \li #ISC_R_SUCCESS * * \li #ISC_R_NOTFOUND * * \li Other results are possible, and should all be treated as * errors. */ void dns_db_attachnode(dns_db_t *db, dns_dbnode_t *source, dns_dbnode_t **targetp); /*%< * Attach *targetp to source. * * Requires: * * \li 'db' is a valid database. * * \li 'source' is a valid node. * * \li 'targetp' points to a NULL dns_dbnode_t *. * * Ensures: * * \li *targetp is attached to source. */ void dns_db_detachnode(dns_db_t *db, dns_dbnode_t **nodep); /*%< * Detach *nodep from its node. * * Requires: * * \li 'db' is a valid database. * * \li 'nodep' points to a valid node. * * Ensures: * * \li *nodep is NULL. */ void dns_db_transfernode(dns_db_t *db, dns_dbnode_t **sourcep, dns_dbnode_t **targetp); /*%< * Transfer a node between pointer. * * This is equivalent to calling dns_db_attachnode() then dns_db_detachnode(). * * Requires: * * \li 'db' is a valid database. * * \li '*sourcep' is a valid node. * * \li 'targetp' points to a NULL dns_dbnode_t *. * * Ensures: * * \li '*sourcep' is NULL. */ isc_result_t dns_db_expirenode(dns_db_t *db, dns_dbnode_t *node, isc_stdtime_t now); /*%< * Mark as stale all records at 'node' which expire at or before 'now'. * * Note: if 'now' is zero, then the current time will be used. * * Requires: * * \li 'db' is a valid cache database. * * \li 'node' is a valid node. */ void dns_db_printnode(dns_db_t *db, dns_dbnode_t *node, FILE *out); /*%< * Print a textual representation of the contents of the node to * 'out'. * * Note: this function is intended for debugging, not general use. * * Requires: * * \li 'db' is a valid database. * * \li 'node' is a valid node. */ /*** *** DB Iterator Creation ***/ isc_result_t dns_db_createiterator(dns_db_t *db, unsigned int options, dns_dbiterator_t **iteratorp); /*%< * Create an iterator for version 'version' of 'db'. * * Notes: * * \li One or more of the following options can be set. * #DNS_DB_RELATIVENAMES * #DNS_DB_NSEC3ONLY * #DNS_DB_NONSEC3 * * Requires: * * \li 'db' is a valid database. * * \li iteratorp != NULL && *iteratorp == NULL * * Ensures: * * \li On success, *iteratorp will be a valid database iterator. * * Returns: * * \li #ISC_R_SUCCESS * \li #ISC_R_NOMEMORY */ /*** *** Rdataset Methods ***/ /* * XXXRTH Should we check for glue and pending data in dns_db_findrdataset()? */ isc_result_t dns_db_findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdatatype_t type, dns_rdatatype_t covers, isc_stdtime_t now, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset); /*%< * Search for an rdataset of type 'type' at 'node' that are in version * 'version' of 'db'. If found, make 'rdataset' refer to it. * * Notes: * * \li If 'version' is NULL, then the current version will be used. * * \li Care must be used when using this routine to build a DNS response: * 'node' should have been found with dns_db_find(), not * dns_db_findnode(). No glue checking is done. No checking for * pending data is done. * * \li The 'now' field is ignored if 'db' is a zone database. If 'db' is a * cache database, an rdataset will not be found unless it expires after * 'now'. If 'now' is zero, then the current time will be used. * * Requires: * * \li 'db' is a valid database. * * \li 'node' is a valid node. * * \li 'rdataset' is a valid, disassociated rdataset. * * \li 'sigrdataset' is a valid, disassociated rdataset, or it is NULL. * * \li If 'covers' != 0, 'type' must be SIG. * * \li 'type' is not a meta-RR type such as 'ANY' or 'OPT'. * * Ensures: * * \li On success, 'rdataset' is associated with the found rdataset. * * Returns: * * \li #ISC_R_SUCCESS * \li #ISC_R_NOTFOUND * * \li Other results are possible, depending upon the database * implementation used. */ isc_result_t dns_db_allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, isc_stdtime_t now, dns_rdatasetiter_t **iteratorp); /*%< * Make '*iteratorp' an rdataset iterator for all rdatasets at 'node' in * version 'version' of 'db'. * * Notes: * * \li If 'version' is NULL, then the current version will be used. * * \li The 'now' field is ignored if 'db' is a zone database. If 'db' is a * cache database, an rdataset will not be found unless it expires after * 'now'. Any ANY query will not match unless at least one rdataset at * the node expires after 'now'. If 'now' is zero, then the current time * will be used. * * Requires: * * \li 'db' is a valid database. * * \li 'node' is a valid node. * * \li iteratorp != NULL && *iteratorp == NULL * * Ensures: * * \li On success, '*iteratorp' is a valid rdataset iterator. * * Returns: * * \li #ISC_R_SUCCESS * \li #ISC_R_NOTFOUND * * \li Other results are possible, depending upon the database * implementation used. */ isc_result_t dns_db_addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, isc_stdtime_t now, dns_rdataset_t *rdataset, unsigned int options, dns_rdataset_t *addedrdataset); /*%< * Add 'rdataset' to 'node' in version 'version' of 'db'. * * Notes: * * \li If the database has zone semantics, the #DNS_DBADD_MERGE option is set, * and an rdataset of the same type as 'rdataset' already exists at * 'node' then the contents of 'rdataset' will be merged with the existing * rdataset. If the option is not set, then rdataset will replace any * existing rdataset of the same type. If not merging and the * #DNS_DBADD_FORCE option is set, then the data will update the database * without regard to trust levels. If not forcing the data, then the * rdataset will only be added if its trust level is >= the trust level of * any existing rdataset. Forcing is only meaningful for cache databases. * If #DNS_DBADD_EXACT is set then there must be no rdata in common between * the old and new rdata sets. If #DNS_DBADD_EXACTTTL is set then both * the old and new rdata sets must have the same ttl. * * \li The 'now' field is ignored if 'db' is a zone database. If 'db' is * a cache database, then the added rdataset will expire no later than * now + rdataset->ttl. * * \li If 'addedrdataset' is not NULL, then it will be attached to the * resulting new rdataset in the database, or to the existing data if * the existing data was better. * * Requires: * * \li 'db' is a valid database. * * \li 'node' is a valid node. * * \li 'rdataset' is a valid, associated rdataset with the same class * as 'db'. * * \li 'addedrdataset' is NULL, or a valid, unassociated rdataset. * * \li The database has zone semantics and 'version' is a valid * read-write version, or the database has cache semantics * and version is NULL. * * \li If the database has cache semantics, the #DNS_DBADD_MERGE option must * not be set. * * Returns: * * \li #ISC_R_SUCCESS * \li #DNS_R_UNCHANGED The operation did not change anything. * \li #ISC_R_NOMEMORY * \li #DNS_R_NOTEXACT * * \li Other results are possible, depending upon the database * implementation used. */ isc_result_t dns_db_subtractrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdataset_t *rdataset, unsigned int options, dns_rdataset_t *newrdataset); /*%< * Remove any rdata in 'rdataset' from 'node' in version 'version' of * 'db'. * * Notes: * * \li If 'newrdataset' is not NULL, then it will be attached to the * resulting new rdataset in the database, unless the rdataset has * become nonexistent. If DNS_DBSUB_EXACT is set then all elements * of 'rdataset' must exist at 'node'. * *\li If DNS_DBSUB_WANTOLD is set and the entire rdataset was deleted * then return the original rdatatset in newrdataset if that existed. * * Requires: * * \li 'db' is a valid database. * * \li 'node' is a valid node. * * \li 'rdataset' is a valid, associated rdataset with the same class * as 'db'. * * \li 'newrdataset' is NULL, or a valid, unassociated rdataset. * * \li The database has zone semantics and 'version' is a valid * read-write version. * * Returns: * * \li #ISC_R_SUCCESS * \li #DNS_R_UNCHANGED The operation did not change anything. * \li #DNS_R_NXRRSET All rdata of the same type as those * in 'rdataset' have been deleted. * \li #DNS_R_NOTEXACT Some part of 'rdataset' did not * exist and DNS_DBSUB_EXACT was set. * * \li Other results are possible, depending upon the database * implementation used. */ isc_result_t dns_db_deleterdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdatatype_t type, dns_rdatatype_t covers); /*%< * Make it so that no rdataset of type 'type' exists at 'node' in version * version 'version' of 'db'. * * Notes: * * \li If 'type' is dns_rdatatype_any, then no rdatasets will exist in * 'version' (provided that the dns_db_deleterdataset() isn't followed * by one or more dns_db_addrdataset() calls). * * Requires: * * \li 'db' is a valid database. * * \li 'node' is a valid node. * * \li The database has zone semantics and 'version' is a valid * read-write version, or the database has cache semantics * and version is NULL. * * \li 'type' is not a meta-RR type, except for dns_rdatatype_any, which is * allowed. * * \li If 'covers' != 0, 'type' must be SIG. * * Returns: * * \li #ISC_R_SUCCESS * \li #DNS_R_UNCHANGED No rdatasets of 'type' existed before * the operation was attempted. * * \li Other results are possible, depending upon the database * implementation used. */ isc_result_t dns_db_getsoaserial(dns_db_t *db, dns_dbversion_t *ver, isc_uint32_t *serialp); /*%< * Get the current SOA serial number from a zone database. * * Requires: * \li 'db' is a valid database with zone semantics. * \li 'ver' is a valid version. */ void dns_db_overmem(dns_db_t *db, isc_boolean_t overmem); /*%< * Enable / disable aggressive cache cleaning. */ unsigned int dns_db_nodecount(dns_db_t *db); /*%< * Count the number of nodes in 'db'. * * Requires: * * \li 'db' is a valid database. * * Returns: * \li The number of nodes in the database */ size_t dns_db_hashsize(dns_db_t *db); /*%< * For database implementations using a hash table, report the * current number of buckets. * * Requires: * * \li 'db' is a valid database. * * Returns: * \li The number of buckets in the database's hash table, or * 0 if not implemented. */ void dns_db_settask(dns_db_t *db, isc_task_t *task); /*%< * If task is set then the final detach maybe performed asynchronously. * * Requires: * \li 'db' is a valid database. * \li 'task' to be valid or NULL. */ isc_boolean_t dns_db_ispersistent(dns_db_t *db); /*%< * Is 'db' persistent? A persistent database does not need to be loaded * from disk or written to disk. * * Requires: * * \li 'db' is a valid database. * * Returns: * \li #ISC_TRUE 'db' is persistent. * \li #ISC_FALSE 'db' is not persistent. */ isc_result_t dns_db_register(const char *name, dns_dbcreatefunc_t create, void *driverarg, isc_mem_t *mctx, dns_dbimplementation_t **dbimp); /*%< * Register a new database implementation and add it to the list of * supported implementations. * * Requires: * * \li 'name' is not NULL * \li 'order' is a valid function pointer * \li 'mctx' is a valid memory context * \li dbimp != NULL && *dbimp == NULL * * Returns: * \li #ISC_R_SUCCESS The registration succeeded * \li #ISC_R_NOMEMORY Out of memory * \li #ISC_R_EXISTS A database implementation with the same name exists * * Ensures: * * \li *dbimp points to an opaque structure which must be passed to * dns_db_unregister(). */ void dns_db_unregister(dns_dbimplementation_t **dbimp); /*%< * Remove a database implementation from the list of supported * implementations. No databases of this type can be active when this * is called. * * Requires: * \li dbimp != NULL && *dbimp == NULL * * Ensures: * * \li Any memory allocated in *dbimp will be freed. */ isc_result_t dns_db_getoriginnode(dns_db_t *db, dns_dbnode_t **nodep); /*%< * Get the origin DB node corresponding to the DB's zone. This function * should typically succeed unless the underlying DB implementation doesn't * support the feature. * * Requires: * * \li 'db' is a valid zone database. * \li 'nodep' != NULL && '*nodep' == NULL * * Ensures: * \li On success, '*nodep' will point to the DB node of the zone's origin. * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_NOTFOUND - the DB implementation does not support this feature. */ isc_result_t dns_db_getnsec3parameters(dns_db_t *db, dns_dbversion_t *version, dns_hash_t *hash, isc_uint8_t *flags, isc_uint16_t *interations, unsigned char *salt, size_t *salt_length); /*%< * Get the NSEC3 parameters that are associated with this zone. * * Requires: * \li 'db' is a valid zone database. * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_NOTFOUND - the DB implementation does not support this feature * or this zone does not have NSEC3 records. */ isc_result_t dns_db_getsize(dns_db_t *db, dns_dbversion_t *version, isc_uint64_t *records, isc_uint64_t *bytes); /*%< * Get the number of records in the given version of the database as well * as the number bytes used to store those records. * * Requires: * \li 'db' is a valid zone database. * \li 'version' is NULL or a valid version. * \li 'records' is NULL or a pointer to return the record count in. * \li 'bytes' is NULL or a pointer to return the byte count in. * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_NOTIMPLEMENTED */ isc_result_t dns_db_findnsec3node(dns_db_t *db, dns_name_t *name, isc_boolean_t create, dns_dbnode_t **nodep); /*%< * Find the NSEC3 node with name 'name'. * * Notes: * \li If 'create' is ISC_TRUE and no node with name 'name' exists, then * such a node will be created. * * Requires: * * \li 'db' is a valid database. * * \li 'name' is a valid, non-empty, absolute name. * * \li nodep != NULL && *nodep == NULL * * Ensures: * * \li On success, *nodep is attached to the node with name 'name'. * * Returns: * * \li #ISC_R_SUCCESS * \li #ISC_R_NOTFOUND If !create and name not found. * \li #ISC_R_NOMEMORY Can only happen if create is ISC_TRUE. * * \li Other results are possible, depending upon the database * implementation used. */ isc_result_t dns_db_setsigningtime(dns_db_t *db, dns_rdataset_t *rdataset, isc_stdtime_t resign); /*%< * Sets the re-signing time associated with 'rdataset' to 'resign'. * * Requires: * \li 'db' is a valid zone database. * \li 'rdataset' is or is to be associated with 'db'. * \li 'rdataset' is not pending removed from the heap via an * uncommitted call to dns_db_resigned(). * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_NOMEMORY * \li #ISC_R_NOTIMPLEMENTED - Not supported by this DB implementation. */ isc_result_t dns_db_getsigningtime(dns_db_t *db, dns_rdataset_t *rdataset, dns_name_t *name); /*%< * Return the rdataset with the earliest signing time in the zone. * Note: the rdataset is version agnostic. * * Requires: * \li 'db' is a valid zone database. * \li 'rdataset' to be initialized but not associated. * \li 'name' to be NULL or have a buffer associated with it. * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_NOTFOUND - No dataset exists. */ void dns_db_resigned(dns_db_t *db, dns_rdataset_t *rdataset, dns_dbversion_t *version); /*%< * Mark 'rdataset' as not being available to be returned by * dns_db_getsigningtime(). If the changes associated with 'version' * are committed this will be permanent. If the version is not committed * this change will be rolled back when the version is closed. Until * 'version' is either committed or rolled back, 'rdataset' can no longer * be acted upon by dns_db_setsigningtime(). * * Requires: * \li 'db' is a valid zone database. * \li 'rdataset' to be associated with 'db'. * \li 'version' to be open for writing. */ dns_stats_t * dns_db_getrrsetstats(dns_db_t *db); /*%< * Get statistics information counting RRsets stored in the DB, when available. * The statistics may not be available depending on the DB implementation. * * Requires: * * \li 'db' is a valid database (cache only). * * Returns: * \li when available, a pointer to a statistics object created by * dns_rdatasetstats_create(); otherwise NULL. */ isc_result_t dns_db_setcachestats(dns_db_t *db, isc_stats_t *stats); /*%< * Set the location in which to collect cache statistics. * This option may not exist depending on the DB implementation. * * Requires: * * \li 'db' is a valid database (cache only). * * Returns: * \li when available, a pointer to a statistics object created by * dns_rdatasetstats_create(); otherwise NULL. */ void dns_db_rpz_attach(dns_db_t *db, dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num); /*%< * Attach the response policy information for a view to a database for a * zone for the view. */ isc_result_t dns_db_rpz_ready(dns_db_t *db); /*%< * Finish loading a response policy zone. */ isc_result_t dns_db_updatenotify_register(dns_db_t *db, dns_dbupdate_callback_t fn, void *fn_arg); /*%< * Register a notify-on-update callback function to a database. * * Requires: * * \li 'db' is a valid database * \li 'db' does not have an update callback registered * \li 'fn' is not NULL * */ isc_result_t dns_db_updatenotify_unregister(dns_db_t *db, dns_dbupdate_callback_t fn, void *fn_arg); /*%< * Unregister a notify-on-update callback. * * Requires: * * \li 'db' is a valid database * \li 'db' has update callback registered * */ isc_result_t dns_db_nodefullname(dns_db_t *db, dns_dbnode_t *node, dns_name_t *name); /*%< * Get the name associated with a database node. * * Requires: * * \li 'db' is a valid database * \li 'node' and 'name' are not NULL */ ISC_LANG_ENDDECLS #endif /* DNS_DB_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/result.h����������������������������������������������������������������������������������0000644�����������������00000021114�14763166026�0010036 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_RESULT_H #define DNS_RESULT_H 1 /*! \file dns/result.h */ #include <isc/lang.h> #include <isc/resultclass.h> #include <dns/types.h> /* * Nothing in this file truly depends on <isc/result.h>, but the * DNS result codes are considered to be publicly derived from * the ISC result codes, so including this file buys you the ISC_R_ * namespace too. */ #include <isc/result.h> /* Contractual promise. */ /* * DNS library result codes */ #define DNS_R_LABELTOOLONG (ISC_RESULTCLASS_DNS + 0) #define DNS_R_BADESCAPE (ISC_RESULTCLASS_DNS + 1) /* * Since we dropped the support of bitstring labels, deprecate the related * result codes too. #define DNS_R_BADBITSTRING (ISC_RESULTCLASS_DNS + 2) #define DNS_R_BITSTRINGTOOLONG (ISC_RESULTCLASS_DNS + 3) */ #define DNS_R_EMPTYLABEL (ISC_RESULTCLASS_DNS + 4) #define DNS_R_BADDOTTEDQUAD (ISC_RESULTCLASS_DNS + 5) #define DNS_R_INVALIDNS (ISC_RESULTCLASS_DNS + 6) #define DNS_R_UNKNOWN (ISC_RESULTCLASS_DNS + 7) #define DNS_R_BADLABELTYPE (ISC_RESULTCLASS_DNS + 8) #define DNS_R_BADPOINTER (ISC_RESULTCLASS_DNS + 9) #define DNS_R_TOOMANYHOPS (ISC_RESULTCLASS_DNS + 10) #define DNS_R_DISALLOWED (ISC_RESULTCLASS_DNS + 11) #define DNS_R_EXTRATOKEN (ISC_RESULTCLASS_DNS + 12) #define DNS_R_EXTRADATA (ISC_RESULTCLASS_DNS + 13) #define DNS_R_TEXTTOOLONG (ISC_RESULTCLASS_DNS + 14) #define DNS_R_NOTZONETOP (ISC_RESULTCLASS_DNS + 15) #define DNS_R_SYNTAX (ISC_RESULTCLASS_DNS + 16) #define DNS_R_BADCKSUM (ISC_RESULTCLASS_DNS + 17) #define DNS_R_BADAAAA (ISC_RESULTCLASS_DNS + 18) #define DNS_R_NOOWNER (ISC_RESULTCLASS_DNS + 19) #define DNS_R_NOTTL (ISC_RESULTCLASS_DNS + 20) #define DNS_R_BADCLASS (ISC_RESULTCLASS_DNS + 21) #define DNS_R_NAMETOOLONG (ISC_RESULTCLASS_DNS + 22) #define DNS_R_PARTIALMATCH (ISC_RESULTCLASS_DNS + 23) #define DNS_R_NEWORIGIN (ISC_RESULTCLASS_DNS + 24) #define DNS_R_UNCHANGED (ISC_RESULTCLASS_DNS + 25) #define DNS_R_BADTTL (ISC_RESULTCLASS_DNS + 26) #define DNS_R_NOREDATA (ISC_RESULTCLASS_DNS + 27) #define DNS_R_CONTINUE (ISC_RESULTCLASS_DNS + 28) #define DNS_R_DELEGATION (ISC_RESULTCLASS_DNS + 29) #define DNS_R_GLUE (ISC_RESULTCLASS_DNS + 30) #define DNS_R_DNAME (ISC_RESULTCLASS_DNS + 31) #define DNS_R_CNAME (ISC_RESULTCLASS_DNS + 32) #define DNS_R_BADDB (ISC_RESULTCLASS_DNS + 33) #define DNS_R_ZONECUT (ISC_RESULTCLASS_DNS + 34) #define DNS_R_BADZONE (ISC_RESULTCLASS_DNS + 35) #define DNS_R_MOREDATA (ISC_RESULTCLASS_DNS + 36) #define DNS_R_UPTODATE (ISC_RESULTCLASS_DNS + 37) #define DNS_R_TSIGVERIFYFAILURE (ISC_RESULTCLASS_DNS + 38) #define DNS_R_TSIGERRORSET (ISC_RESULTCLASS_DNS + 39) #define DNS_R_SIGINVALID (ISC_RESULTCLASS_DNS + 40) #define DNS_R_SIGEXPIRED (ISC_RESULTCLASS_DNS + 41) #define DNS_R_SIGFUTURE (ISC_RESULTCLASS_DNS + 42) #define DNS_R_KEYUNAUTHORIZED (ISC_RESULTCLASS_DNS + 43) #define DNS_R_INVALIDTIME (ISC_RESULTCLASS_DNS + 44) #define DNS_R_EXPECTEDTSIG (ISC_RESULTCLASS_DNS + 45) #define DNS_R_UNEXPECTEDTSIG (ISC_RESULTCLASS_DNS + 46) #define DNS_R_INVALIDTKEY (ISC_RESULTCLASS_DNS + 47) #define DNS_R_HINT (ISC_RESULTCLASS_DNS + 48) #define DNS_R_DROP (ISC_RESULTCLASS_DNS + 49) #define DNS_R_NOTLOADED (ISC_RESULTCLASS_DNS + 50) #define DNS_R_NCACHENXDOMAIN (ISC_RESULTCLASS_DNS + 51) #define DNS_R_NCACHENXRRSET (ISC_RESULTCLASS_DNS + 52) #define DNS_R_WAIT (ISC_RESULTCLASS_DNS + 53) #define DNS_R_NOTVERIFIEDYET (ISC_RESULTCLASS_DNS + 54) #define DNS_R_NOIDENTITY (ISC_RESULTCLASS_DNS + 55) #define DNS_R_NOJOURNAL (ISC_RESULTCLASS_DNS + 56) #define DNS_R_ALIAS (ISC_RESULTCLASS_DNS + 57) #define DNS_R_USETCP (ISC_RESULTCLASS_DNS + 58) #define DNS_R_NOVALIDSIG (ISC_RESULTCLASS_DNS + 59) #define DNS_R_NOVALIDNSEC (ISC_RESULTCLASS_DNS + 60) #define DNS_R_NOTINSECURE (ISC_RESULTCLASS_DNS + 61) #define DNS_R_UNKNOWNSERVICE (ISC_RESULTCLASS_DNS + 62) #define DNS_R_RECOVERABLE (ISC_RESULTCLASS_DNS + 63) #define DNS_R_UNKNOWNOPT (ISC_RESULTCLASS_DNS + 64) #define DNS_R_UNEXPECTEDID (ISC_RESULTCLASS_DNS + 65) #define DNS_R_SEENINCLUDE (ISC_RESULTCLASS_DNS + 66) #define DNS_R_NOTEXACT (ISC_RESULTCLASS_DNS + 67) #define DNS_R_BLACKHOLED (ISC_RESULTCLASS_DNS + 68) #define DNS_R_BADALG (ISC_RESULTCLASS_DNS + 69) #define DNS_R_METATYPE (ISC_RESULTCLASS_DNS + 70) #define DNS_R_CNAMEANDOTHER (ISC_RESULTCLASS_DNS + 71) #define DNS_R_SINGLETON (ISC_RESULTCLASS_DNS + 72) #define DNS_R_HINTNXRRSET (ISC_RESULTCLASS_DNS + 73) #define DNS_R_NOMASTERFILE (ISC_RESULTCLASS_DNS + 74) #define DNS_R_UNKNOWNPROTO (ISC_RESULTCLASS_DNS + 75) #define DNS_R_CLOCKSKEW (ISC_RESULTCLASS_DNS + 76) #define DNS_R_BADIXFR (ISC_RESULTCLASS_DNS + 77) #define DNS_R_NOTAUTHORITATIVE (ISC_RESULTCLASS_DNS + 78) #define DNS_R_NOVALIDKEY (ISC_RESULTCLASS_DNS + 79) #define DNS_R_OBSOLETE (ISC_RESULTCLASS_DNS + 80) #define DNS_R_FROZEN (ISC_RESULTCLASS_DNS + 81) #define DNS_R_UNKNOWNFLAG (ISC_RESULTCLASS_DNS + 82) #define DNS_R_EXPECTEDRESPONSE (ISC_RESULTCLASS_DNS + 83) #define DNS_R_NOVALIDDS (ISC_RESULTCLASS_DNS + 84) #define DNS_R_NSISADDRESS (ISC_RESULTCLASS_DNS + 85) #define DNS_R_REMOTEFORMERR (ISC_RESULTCLASS_DNS + 86) #define DNS_R_TRUNCATEDTCP (ISC_RESULTCLASS_DNS + 87) #define DNS_R_LAME (ISC_RESULTCLASS_DNS + 88) #define DNS_R_UNEXPECTEDRCODE (ISC_RESULTCLASS_DNS + 89) #define DNS_R_UNEXPECTEDOPCODE (ISC_RESULTCLASS_DNS + 90) #define DNS_R_CHASEDSSERVERS (ISC_RESULTCLASS_DNS + 91) #define DNS_R_EMPTYNAME (ISC_RESULTCLASS_DNS + 92) #define DNS_R_EMPTYWILD (ISC_RESULTCLASS_DNS + 93) #define DNS_R_BADBITMAP (ISC_RESULTCLASS_DNS + 94) #define DNS_R_FROMWILDCARD (ISC_RESULTCLASS_DNS + 95) #define DNS_R_BADOWNERNAME (ISC_RESULTCLASS_DNS + 96) #define DNS_R_BADNAME (ISC_RESULTCLASS_DNS + 97) #define DNS_R_DYNAMIC (ISC_RESULTCLASS_DNS + 98) #define DNS_R_UNKNOWNCOMMAND (ISC_RESULTCLASS_DNS + 99) #define DNS_R_MUSTBESECURE (ISC_RESULTCLASS_DNS + 100) #define DNS_R_COVERINGNSEC (ISC_RESULTCLASS_DNS + 101) #define DNS_R_MXISADDRESS (ISC_RESULTCLASS_DNS + 102) #define DNS_R_DUPLICATE (ISC_RESULTCLASS_DNS + 103) #define DNS_R_INVALIDNSEC3 (ISC_RESULTCLASS_DNS + 104) #define DNS_R_NOTMASTER (ISC_RESULTCLASS_DNS + 105) #define DNS_R_BROKENCHAIN (ISC_RESULTCLASS_DNS + 106) #define DNS_R_EXPIRED (ISC_RESULTCLASS_DNS + 107) #define DNS_R_NOTDYNAMIC (ISC_RESULTCLASS_DNS + 108) #define DNS_R_BADEUI (ISC_RESULTCLASS_DNS + 109) #define DNS_R_NTACOVERED (ISC_RESULTCLASS_DNS + 110) #define DNS_R_BADCDS (ISC_RESULTCLASS_DNS + 111) #define DNS_R_BADCDNSKEY (ISC_RESULTCLASS_DNS + 112) #define DNS_R_OPTERR (ISC_RESULTCLASS_DNS + 113) #define DNS_R_BADDNSTAP (ISC_RESULTCLASS_DNS + 114) #define DNS_R_BADTSIG (ISC_RESULTCLASS_DNS + 115) #define DNS_R_BADSIG0 (ISC_RESULTCLASS_DNS + 116) #define DNS_R_TOOMANYRECORDS (ISC_RESULTCLASS_DNS + 117) #define DNS_R_NRESULTS 118 /*%< Number of results */ /* * DNS wire format rcodes. * * By making these their own class we can easily convert them into the * wire-format rcode value simply by masking off the resultclass. */ #define DNS_R_NOERROR (ISC_RESULTCLASS_DNSRCODE + 0) #define DNS_R_FORMERR (ISC_RESULTCLASS_DNSRCODE + 1) #define DNS_R_SERVFAIL (ISC_RESULTCLASS_DNSRCODE + 2) #define DNS_R_NXDOMAIN (ISC_RESULTCLASS_DNSRCODE + 3) #define DNS_R_NOTIMP (ISC_RESULTCLASS_DNSRCODE + 4) #define DNS_R_REFUSED (ISC_RESULTCLASS_DNSRCODE + 5) #define DNS_R_YXDOMAIN (ISC_RESULTCLASS_DNSRCODE + 6) #define DNS_R_YXRRSET (ISC_RESULTCLASS_DNSRCODE + 7) #define DNS_R_NXRRSET (ISC_RESULTCLASS_DNSRCODE + 8) #define DNS_R_NOTAUTH (ISC_RESULTCLASS_DNSRCODE + 9) #define DNS_R_NOTZONE (ISC_RESULTCLASS_DNSRCODE + 10) #define DNS_R_RCODE11 (ISC_RESULTCLASS_DNSRCODE + 11) #define DNS_R_RCODE12 (ISC_RESULTCLASS_DNSRCODE + 12) #define DNS_R_RCODE13 (ISC_RESULTCLASS_DNSRCODE + 13) #define DNS_R_RCODE14 (ISC_RESULTCLASS_DNSRCODE + 14) #define DNS_R_RCODE15 (ISC_RESULTCLASS_DNSRCODE + 15) #define DNS_R_BADVERS (ISC_RESULTCLASS_DNSRCODE + 16) #define DNS_R_NRCODERESULTS 17 /*%< Number of rcode results */ #define DNS_RESULT_ISRCODE(result) \ (ISC_RESULTCLASS_INCLASS(ISC_RESULTCLASS_DNSRCODE, (result))) ISC_LANG_BEGINDECLS const char * dns_result_totext(isc_result_t); void dns_result_register(void); dns_rcode_t dns_result_torcode(isc_result_t result); ISC_LANG_ENDDECLS #endif /* DNS_RESULT_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/time.h������������������������������������������������������������������������������������0000644�����������������00000003237�14763166026�0007464 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_TIME_H #define DNS_TIME_H 1 /*! \file dns/time.h */ /*** *** Imports ***/ #include <isc/buffer.h> #include <isc/lang.h> ISC_LANG_BEGINDECLS /*** *** Functions ***/ isc_result_t dns_time64_fromtext(const char *source, isc_int64_t *target); /*%< * Convert a date and time in YYYYMMDDHHMMSS text format at 'source' * into to a 64-bit count of seconds since Jan 1 1970 0:00 GMT. * Store the count at 'target'. */ isc_result_t dns_time32_fromtext(const char *source, isc_uint32_t *target); /*%< * Like dns_time64_fromtext, but returns the second count modulo 2^32 * as per RFC2535. */ isc_result_t dns_time64_totext(isc_int64_t value, isc_buffer_t *target); /*%< * Convert a 64-bit count of seconds since Jan 1 1970 0:00 GMT into * a YYYYMMDDHHMMSS text representation and append it to 'target'. */ isc_result_t dns_time32_totext(isc_uint32_t value, isc_buffer_t *target); /*%< * Like dns_time64_totext, but for a 32-bit cyclic time value. * Of those dates whose counts of seconds since Jan 1 1970 0:00 GMT * are congruent with 'value' modulo 2^32, the one closest to the * current date is chosen. */ isc_int64_t dns_time64_from32(isc_uint32_t value); /*%< * Covert a 32-bit cyclic time value into a 64 bit time stamp. */ ISC_LANG_ENDDECLS #endif /* DNS_TIME_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/masterdump.h������������������������������������������������������������������������������0000644�����������������00000030546�14763166026�0010712 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_MASTERDUMP_H #define DNS_MASTERDUMP_H 1 /*! \file dns/masterdump.h */ /*** *** Imports ***/ #include <stdio.h> #include <isc/lang.h> #include <dns/types.h> /*** *** Types ***/ typedef struct dns_master_style dns_master_style_t; /*** *** Definitions ***/ /* * Flags affecting master file formatting. Flags 0x0000FFFF * define the formatting of the rdata part and are defined in * rdata.h. */ /*% Omit the owner name when possible. */ #define DNS_STYLEFLAG_OMIT_OWNER 0x000010000ULL /*% * Omit the TTL when possible. If DNS_STYLEFLAG_TTL is * also set, this means no TTLs are ever printed * because $TTL directives are generated before every * change in the TTL. In this case, no columns need to * be reserved for the TTL. Master files generated with * these options will be rejected by BIND 4.x because it * does not recognize the $TTL directive. * * If DNS_STYLEFLAG_TTL is not also set, the TTL will be * omitted when it is equal to the previous TTL. * This is correct according to RFC1035, but the * TTLs may be silently misinterpreted by older * versions of BIND which use the SOA MINTTL as a * default TTL value. */ #define DNS_STYLEFLAG_OMIT_TTL 0x000020000ULL /*% Omit the class when possible. */ #define DNS_STYLEFLAG_OMIT_CLASS 0x000040000ULL /*% Output $TTL directives. */ #define DNS_STYLEFLAG_TTL 0x000080000ULL /*% * Output $ORIGIN directives and print owner names relative to * the origin when possible. */ #define DNS_STYLEFLAG_REL_OWNER 0x000100000ULL /*% Print domain names in RR data in relative form when possible. For this to take effect, DNS_STYLEFLAG_REL_OWNER must also be set. */ #define DNS_STYLEFLAG_REL_DATA 0x000200000ULL /*% Print the trust level of each rdataset. */ #define DNS_STYLEFLAG_TRUST 0x000400000ULL /*% Print negative caching entries. */ #define DNS_STYLEFLAG_NCACHE 0x000800000ULL /*% Never print the TTL. */ #define DNS_STYLEFLAG_NO_TTL 0x001000000ULL /*% Never print the CLASS. */ #define DNS_STYLEFLAG_NO_CLASS 0x002000000ULL /*% Report re-signing time. */ #define DNS_STYLEFLAG_RESIGN 0x004000000ULL /*% Don't printout the cryptographic parts of DNSSEC records. */ #define DNS_STYLEFLAG_NOCRYPTO 0x008000000ULL /*% Comment out data by prepending with ";" */ #define DNS_STYLEFLAG_COMMENTDATA 0x010000000ULL /*% Print TTL with human-readable units. */ #define DNS_STYLEFLAG_TTL_UNITS 0x020000000ULL /*% Indent output. */ #define DNS_STYLEFLAG_INDENT 0x040000000ULL /*% Output in YAML style. */ #define DNS_STYLEFLAG_YAML 0x080000000ULL /*% Print ECS cache entries as comments (reserved for future use). */ #define DNS_STYLEFLAG_ECSCACHE 0x100000000ULL ISC_LANG_BEGINDECLS /*** *** Constants ***/ /*% * The default master file style. * * This uses $TTL directives to avoid the need to dedicate a * tab stop for the TTL. The class is only printed for the first * rrset in the file and shares a tab stop with the RR type. */ LIBDNS_EXTERNAL_DATA extern const dns_master_style_t dns_master_style_default; /*% * A master file style that dumps zones to a very generic format easily * imported/checked with external tools. */ LIBDNS_EXTERNAL_DATA extern const dns_master_style_t dns_master_style_full; /*% * A master file style that prints explicit TTL values on each * record line, never using $TTL statements. The TTL has a tab * stop of its own, but the class and type share one. */ LIBDNS_EXTERNAL_DATA extern const dns_master_style_t dns_master_style_explicitttl; /*% * A master style format designed for cache files. It prints explicit TTL * values on each record line and never uses $ORIGIN or relative names. */ LIBDNS_EXTERNAL_DATA extern const dns_master_style_t dns_master_style_cache; /*% * A master style that prints name, ttl, class, type, and value on * every line. Similar to explicitttl above, but more verbose. * Intended for generating master files which can be easily parsed * by perl scripts and similar applications. */ LIBDNS_EXTERNAL_DATA extern const dns_master_style_t dns_master_style_simple; /*% * The style used for debugging, "dig" output, etc. */ LIBDNS_EXTERNAL_DATA extern const dns_master_style_t dns_master_style_debug; /*% * Similar to dns_master_style_debug but data is prepended with ";" */ LIBDNS_EXTERNAL_DATA extern const dns_master_style_t dns_master_style_comment; /*% * Similar to dns_master_style_debug but data is indented with * dns_master_indentstr (defaults to tab). */ LIBDNS_EXTERNAL_DATA extern const dns_master_style_t dns_master_style_indent; /*% * The style used for dumping "key" zones. */ LIBDNS_EXTERNAL_DATA extern const dns_master_style_t dns_master_style_keyzone; /*% * YAML-compatible output */ LIBDNS_EXTERNAL_DATA extern const dns_master_style_t dns_master_style_yaml; /*% * The default indent string to prepend lines with when using * styleflag DNS_STYLEFLAG_INDENT or DNS_STYLEFLAG_YAML. * This is set to "\t" by default. The indent is repeated * 'dns_master_indent' times. This precedes everything else * on the line, including comment characters (;). * * XXX: Changing this value at runtime is not thread-safe. */ LIBDNS_EXTERNAL_DATA extern const char *dns_master_indentstr; /*% * The number of copies of the indent string to put at the beginning * of the line when using DNS_STYLEFLAG_INDENT or DNS_STYLEFLAG_YAML. * This is set to 1 by default. It is increased and decreased * to adjust indentation levels when producing YAML output. * * XXX: This is not thread-safe. */ LIBDNS_EXTERNAL_DATA extern unsigned int dns_master_indent; /*** *** Functions ***/ void dns_dumpctx_attach(dns_dumpctx_t *source, dns_dumpctx_t **target); /*%< * Attach to a dump context. * * Require: *\li 'source' to be valid. *\li 'target' to be non NULL and '*target' to be NULL. */ void dns_dumpctx_detach(dns_dumpctx_t **dctxp); /*%< * Detach from a dump context. * * Require: *\li 'dctxp' to point to a valid dump context. * * Ensures: *\li '*dctxp' is NULL. */ void dns_dumpctx_cancel(dns_dumpctx_t *dctx); /*%< * Cancel a in progress dump. * * Require: *\li 'dctx' to be valid. */ dns_dbversion_t * dns_dumpctx_version(dns_dumpctx_t *dctx); /*%< * Return the version handle (if any) of the database being dumped. * * Require: *\li 'dctx' to be valid. */ dns_db_t * dns_dumpctx_db(dns_dumpctx_t *dctx); /*%< * Return the database being dumped. * * Require: *\li 'dctx' to be valid. */ /*@{*/ isc_result_t dns_master_dumptostreaminc(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, const dns_master_style_t *style, FILE *f, isc_task_t *task, dns_dumpdonefunc_t done, void *done_arg, dns_dumpctx_t **dctxp); isc_result_t dns_master_dumptostream(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, const dns_master_style_t *style, FILE *f); isc_result_t dns_master_dumptostream2(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, const dns_master_style_t *style, dns_masterformat_t format, FILE *f); isc_result_t dns_master_dumptostream3(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, const dns_master_style_t *style, dns_masterformat_t format, dns_masterrawheader_t *header, FILE *f); /*%< * Dump the database 'db' to the steam 'f' in the specified format by * 'format'. If the format is dns_masterformat_text (the RFC1035 format), * 'style' specifies the file style (e.g., &dns_master_style_default). * * dns_master_dumptostream() is an old form of dns_master_dumptostream3(), * which always specifies the dns_masterformat_text format. * dns_master_dumptostream2() is an old form which always specifies * a NULL header. * * If 'format' is dns_masterformat_raw, then 'header' can contain * information to be written to the file header. * * Temporary dynamic memory may be allocated from 'mctx'. * * Require: *\li 'task' to be valid. *\li 'done' to be non NULL. *\li 'dctxp' to be non NULL && '*dctxp' to be NULL. * * Returns: *\li ISC_R_SUCCESS *\li ISC_R_CONTINUE dns_master_dumptostreaminc() only. *\li ISC_R_NOMEMORY *\li Any database or rrset iterator error. *\li Any dns_rdata_totext() error code. */ /*@}*/ /*@{*/ isc_result_t dns_master_dumpinc(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, const dns_master_style_t *style, const char *filename, isc_task_t *task, dns_dumpdonefunc_t done, void *done_arg, dns_dumpctx_t **dctxp); isc_result_t dns_master_dumpinc2(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, const dns_master_style_t *style, const char *filename, isc_task_t *task, dns_dumpdonefunc_t done, void *done_arg, dns_dumpctx_t **dctxp, dns_masterformat_t format); isc_result_t dns_master_dumpinc3(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, const dns_master_style_t *style, const char *filename, isc_task_t *task, dns_dumpdonefunc_t done, void *done_arg, dns_dumpctx_t **dctxp, dns_masterformat_t format, dns_masterrawheader_t *header); isc_result_t dns_master_dump(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, const dns_master_style_t *style, const char *filename); isc_result_t dns_master_dump2(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, const dns_master_style_t *style, const char *filename, dns_masterformat_t format); isc_result_t dns_master_dump3(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, const dns_master_style_t *style, const char *filename, dns_masterformat_t format, dns_masterrawheader_t *header); /*%< * Dump the database 'db' to the file 'filename' in the specified format by * 'format'. If the format is dns_masterformat_text (the RFC1035 format), * 'style' specifies the file style (e.g., &dns_master_style_default). * * dns_master_dumpinc() and dns_master_dump() are old forms of _dumpinc3() * and _dump3(), respectively, which always specify the dns_masterformat_text * format. dns_master_dumpinc2() and dns_master_dump2() are old forms which * always specify a NULL header. * * If 'format' is dns_masterformat_raw, then 'header' can contain * information to be written to the file header. * * Temporary dynamic memory may be allocated from 'mctx'. * * Returns: *\li ISC_R_SUCCESS *\li ISC_R_CONTINUE dns_master_dumpinc() only. *\li ISC_R_NOMEMORY *\li Any database or rrset iterator error. *\li Any dns_rdata_totext() error code. */ /*@}*/ isc_result_t dns_master_rdatasettotext(dns_name_t *owner_name, dns_rdataset_t *rdataset, const dns_master_style_t *style, isc_buffer_t *target); /*%< * Convert 'rdataset' to text format, storing the result in 'target'. * * Notes: *\li The rdata cursor position will be changed. * * Requires: *\li 'rdataset' is a valid non-question rdataset. * *\li 'rdataset' is not empty. */ isc_result_t dns_master_questiontotext(dns_name_t *owner_name, dns_rdataset_t *rdataset, const dns_master_style_t *style, isc_buffer_t *target); isc_result_t dns_master_dumpnodetostream(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, dns_name_t *name, const dns_master_style_t *style, FILE *f); isc_result_t dns_master_dumpnode(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, dns_name_t *name, const dns_master_style_t *style, const char *filename); dns_masterstyle_flags_t dns_master_styleflags(const dns_master_style_t *style); isc_result_t dns_master_stylecreate(dns_master_style_t **style, unsigned int flags, unsigned int ttl_column, unsigned int class_column, unsigned int type_column, unsigned int rdata_column, unsigned int line_length, unsigned int tab_width, isc_mem_t *mctx); isc_result_t dns_master_stylecreate2(dns_master_style_t **style, unsigned int flags, unsigned int ttl_column, unsigned int class_column, unsigned int type_column, unsigned int rdata_column, unsigned int line_length, unsigned int tab_width, unsigned int split_width, isc_mem_t *mctx); void dns_master_styledestroy(dns_master_style_t **style, isc_mem_t *mctx); ISC_LANG_ENDDECLS #endif /* DNS_MASTERDUMP_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/dnstap.h����������������������������������������������������������������������������������0000644�����������������00000022317�14763166026�0010017 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef _DNSTAP_H #define _DNSTAP_H /***** ***** Module Info *****/ /*! \file * \brief * The dt (dnstap) module provides fast passive logging of DNS messages. * Protocol Buffers. The protobuf schema for Dnstap messages is in the * file dnstap.proto, which is compiled to dnstap.pb-c.c and dnstap.pb-c.h. */ #ifdef HAVE_DNSTAP #include <fstrm.h> #include <protobuf-c/protobuf-c.h> #include <dns/dnstap.pb-c.h> #else struct fstrm_iothr_options; #endif /* HAVE_DNSTAP */ #include <isc/refcount.h> #include <isc/region.h> #include <isc/sockaddr.h> #include <isc/time.h> #include <isc/types.h> #include <dns/name.h> #include <dns/rdataclass.h> #include <dns/rdatatype.h> #include <dns/types.h> /*% * Dnstap message types: * * STUB QUERY: SQ * STUB RESPONSE: SR * CLIENT QUERY: CQ * CLIENT RESPONSE: CR * AUTH QUERY: AQ * AUTH RESPONSE: AR * RESOLVER QUERY: RQ * RESOLVER RESPONSE: RR * FORWARDER QUERY: FQ * FORWARDER RESPONSE: FR */ #define DNS_DTTYPE_SQ 0x0001 #define DNS_DTTYPE_SR 0x0002 #define DNS_DTTYPE_CQ 0x0004 #define DNS_DTTYPE_CR 0x0008 #define DNS_DTTYPE_AQ 0x0010 #define DNS_DTTYPE_AR 0x0020 #define DNS_DTTYPE_RQ 0x0040 #define DNS_DTTYPE_RR 0x0080 #define DNS_DTTYPE_FQ 0x0100 #define DNS_DTTYPE_FR 0x0200 #define DNS_DTTYPE_TQ 0x0400 #define DNS_DTTYPE_TR 0x0800 #define DNS_DTTYPE_QUERY \ (DNS_DTTYPE_SQ|DNS_DTTYPE_CQ|DNS_DTTYPE_AQ|\ DNS_DTTYPE_RQ|DNS_DTTYPE_FQ|DNS_DTTYPE_TQ) #define DNS_DTTYPE_RESPONSE \ (DNS_DTTYPE_SR|DNS_DTTYPE_CR|DNS_DTTYPE_AR|\ DNS_DTTYPE_RR|DNS_DTTYPE_FR|DNS_DTTYPE_TR) #define DNS_DTTYPE_ALL \ (DNS_DTTYPE_QUERY|DNS_DTTYPE_RESPONSE) typedef enum { dns_dtmode_none = 0, dns_dtmode_file, dns_dtmode_unix } dns_dtmode_t; typedef struct dns_dthandle dns_dthandle_t; #ifdef HAVE_DNSTAP struct dns_dtdata { isc_mem_t *mctx; Dnstap__Dnstap *frame; isc_boolean_t query; isc_boolean_t tcp; dns_dtmsgtype_t type; isc_time_t qtime; isc_time_t rtime; isc_region_t qaddr; isc_region_t raddr; isc_uint32_t qport; isc_uint32_t rport; isc_region_t msgdata; dns_message_t *msg; char namebuf[DNS_NAME_FORMATSIZE]; char typebuf[DNS_RDATATYPE_FORMATSIZE]; char classbuf[DNS_RDATACLASS_FORMATSIZE]; }; #endif /* HAVE_DNSTAP */ isc_result_t dns_dt_create(isc_mem_t *mctx, dns_dtmode_t mode, const char *path, struct fstrm_iothr_options **foptp, dns_dtenv_t **envp); /*%< * Create and initialize the dnstap environment. * * There should be a single global dnstap environment for the server; * copies of it will be attached to each view. * * Notes: * *\li 'path' refers to a UNIX domain socket by default. It may * optionally be prepended with "socket:" or "file:". If prepended * with "file:", then dnstap logs are sent to a file instead of a * socket. * *\li '*foptp' set the options for fstrm_iothr_init(). '*foptp' must have * have had the number of input queues set and this should be set * to the number of worker threads. Additionally the queue model * should also be set. Other options may be set if desired. * If dns_dt_create succeeds the *foptp is set to NULL. * * Requires: * *\li 'mctx' is a valid memory context. * *\li 'path' is a valid C string. * *\li 'fopt' is non NULL. * *\li envp != NULL && *envp == NULL * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY * *\li Other errors are possible. */ isc_result_t dns_dt_reopen(dns_dtenv_t *env, int roll); /*%< * Reopens files established by dns_dt_create(). * * If 'roll' is non-negative and 'env->mode' is dns_dtmode_file, * then the file is automatically rolled over before reopening. * The value of 'roll' indicates the number of backup log files to * keep. If 'roll' is negative, or if 'env->mode' is dns_dtmode_unix, * then the channel is simply reopened. * * Note: dns_dt_reopen() must be called in task exclusive mode. * * Requires: *\li 'env' is a valid dnstap environment. */ isc_result_t dns_dt_setidentity(dns_dtenv_t *env, const char *identity); isc_result_t dns_dt_setversion(dns_dtenv_t *env, const char *version); /*%< * Set the "identity" and "version" strings to be sent in dnstap messages. * * Requires: * *\li 'env' is a valid dnstap environment. */ void dns_dt_attach(dns_dtenv_t *source, dns_dtenv_t **destp); /*%< * Attach '*destp' to 'source', incrementing the reference counter. * * Requires: * *\li 'source' is a valid dnstap environment. * *\li 'destp' is not NULL and '*destp' is NULL. * *\li *destp is attached to source. */ void dns_dt_detach(dns_dtenv_t **envp); /*%< * Detach '*envp', decrementing the reference counter. * * Requires: * *\li '*envp' is a valid dnstap environment. * * Ensures: * *\li '*envp' will be destroyed when the number of references reaches zero. * *\li '*envp' is NULL. */ isc_result_t dns_dt_getstats(dns_dtenv_t *env, isc_stats_t **statsp); /*%< * Attach to the stats struct if it exists. * * Requires: * *\li 'env' is a valid dnstap environment. * *\li 'statsp' is non NULL and '*statsp' is NULL. * * Returns: * *\li ISC_R_SUCCESS * *\li ISC_R_NOTFOUND */ void dns_dt_shutdown(void); /*%< * Shuts down dnstap and frees global resources. This function must only * be called immediately before server shutdown. */ void dns_dt_send(dns_view_t *view, dns_dtmsgtype_t msgtype, isc_sockaddr_t *qaddr, isc_sockaddr_t *dstaddr, isc_boolean_t tcp, isc_region_t *zone, isc_time_t *qtime, isc_time_t *rtime, isc_buffer_t *buf); /*%< * Sends a dnstap message to the log, if 'msgtype' is one of the message * types represented in 'view->dttypes'. * * Parameters are: 'qaddr' (query address, i.e, the address of the * query initiator); 'raddr' (response address, i.e., the address of * the query responder); 'tcp' (boolean indicating whether the transaction * was over TCP); 'zone' (the authoritative zone or bailiwick, in * uncompressed wire format), 'qtime' and 'rtime' (query and response * times; if NULL, they are set to the current time); and 'buf' (the * DNS message being logged, in wire format). * * Requires: * *\li 'view' is a valid view, and 'view->dtenv' is NULL or is a * valid dnstap environment. */ isc_result_t dns_dt_parse(isc_mem_t *mctx, isc_region_t *src, dns_dtdata_t **destp); /*%< * Converts a raw dnstap frame in 'src' to a parsed dnstap data structure * in '*destp'. * * Requires: *\li 'src' is not NULL * *\li 'destp' is not NULL and '*destp' points to a valid buffer. * * Returns: *\li #ISC_R_SUCCESS on success * *\li Other errors are possible. */ isc_result_t dns_dt_datatotext(dns_dtdata_t *d, isc_buffer_t **dest); /*%< * Converts a parsed dnstap data structure 'd' to text, storing * the result in the buffer 'dest'. If 'dest' points to a dynamically * allocated buffer, then it may be reallocated as needed. * * (XXX: add a 'long_form' option to generate a detailed listing of * dnstap data instead * of a one-line summary.) * * Requires: *\li 'd' is not NULL * *\li 'dest' is not NULL and '*dest' points to a valid buffer. * * Returns: *\li #ISC_R_SUCCESS on success *\li #ISC_R_NOSPACE if buffer is not dynamic and runs out of space *\li #ISC_R_NOMEMORY if buffer is dynamic but memory could not be allocated * *\li Other errors are possible. */ void dns_dtdata_free(dns_dtdata_t **dp); /*%< * Frees the specified dns_dtdata structure and all its members, * and sets *dp to NULL. */ isc_result_t dns_dt_open(const char *filename, dns_dtmode_t mode, isc_mem_t *mctx, dns_dthandle_t **handlep); /*%< * Opens a dnstap framestream at 'filename' and stores a pointer to the * reader object in a dns_dthandle_t structure. * * The caller is responsible for allocating the handle structure. * * (XXX: Currently only file readers are supported, not unix-domain socket * readers.) * * Requires: * *\li 'filename' is not NULL. * *\li 'handlep' is not NULL and '*handlep' is NULL. * *\li '*mctx' is not a valid memory context. * * Returns: * *\li #ISC_R_SUCCESS on success *\li #ISC_R_NOTIMPLEMENTED if 'mode' is not dns_dtmode_file. (XXX) *\li #ISC_R_NOMEMORY if the fstrm library was unable to allocate a * reader or options structure *\li #ISC_R_FAILURE if 'filename' could not be opened. *\li #DNS_R_BADDNSTAP if 'filename' does not contain a dnstap * framestream. */ isc_result_t dns_dt_getframe(dns_dthandle_t *handle, isc_uint8_t **bufp, size_t *sizep); /*%< * Read a dnstap frame from the framstream reader in 'handle', storing * a pointer to it in '*bufp' and its size in '*sizep'. * * Requires: * *\li 'handle' is not NULL *\li 'bufp' is not NULL *\li 'sizep' is not NULL * * Ensures: * \li if returning ISC_R_SUCCESS then '*bufp' is not NULL * * Returns: * *\li #ISC_R_SUCCESS on success *\li #ISC_R_NOMORE at the end of the frame stream *\li #ISC_R_FAILURE for any other failure */ void dns_dt_close(dns_dthandle_t **handlep); /*%< * Closes the dnstap file referenced by 'handle'. * * Requires: * *\li '*handlep' is not NULL */ #endif /* _DNSTAP_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/ecdb.h������������������������������������������������������������������������������������0000644�����������������00000001450�14763166026�0007416 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_ECDB_H #define DNS_ECDB_H 1 /***** ***** Module Info *****/ /* TBD */ /*** *** Imports ***/ #include <dns/types.h> /*** *** Types ***/ /*** *** Functions ***/ ISC_LANG_BEGINDECLS /* TBD: describe those */ isc_result_t dns_ecdb_register(isc_mem_t *mctx, dns_dbimplementation_t **dbimp); void dns_ecdb_unregister(dns_dbimplementation_t **dbimp); ISC_LANG_ENDDECLS #endif /* DNS_ECDB_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/rcode.h�����������������������������������������������������������������������������������0000644�����������������00000004660�14763166026�0007623 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_RCODE_H #define DNS_RCODE_H 1 /*! \file dns/rcode.h */ #include <isc/lang.h> #include <dns/types.h> ISC_LANG_BEGINDECLS isc_result_t dns_rcode_fromtext(dns_rcode_t *rcodep, isc_textregion_t *source); /*%< * Convert the text 'source' refers to into a DNS error value. * * Requires: *\li 'rcodep' is a valid pointer. * *\li 'source' is a valid text region. * * Returns: *\li #ISC_R_SUCCESS on success *\li #DNS_R_UNKNOWN type is unknown */ isc_result_t dns_rcode_totext(dns_rcode_t rcode, isc_buffer_t *target); /*%< * Put a textual representation of error 'rcode' into 'target'. * * Requires: *\li 'rcode' is a valid rcode. * *\li 'target' is a valid text buffer. * * Ensures: *\li If the result is success: * The used space in 'target' is updated. * * Returns: *\li #ISC_R_SUCCESS on success *\li #ISC_R_NOSPACE target buffer is too small */ isc_result_t dns_tsigrcode_fromtext(dns_rcode_t *rcodep, isc_textregion_t *source); /*%< * Convert the text 'source' refers to into a TSIG/TKEY error value. * * Requires: *\li 'rcodep' is a valid pointer. * *\li 'source' is a valid text region. * * Returns: *\li #ISC_R_SUCCESS on success *\li #DNS_R_UNKNOWN type is unknown */ isc_result_t dns_tsigrcode_totext(dns_rcode_t rcode, isc_buffer_t *target); /*%< * Put a textual representation of TSIG/TKEY error 'rcode' into 'target'. * * Requires: *\li 'rcode' is a valid TSIG/TKEY error code. * *\li 'target' is a valid text buffer. * * Ensures: *\li If the result is success: * The used space in 'target' is updated. * * Returns: *\li #ISC_R_SUCCESS on success *\li #ISC_R_NOSPACE target buffer is too small */ isc_result_t dns_hashalg_fromtext(unsigned char *hashalg, isc_textregion_t *source); /*%< * Convert the text 'source' refers to into a has algorithm value. * * Requires: *\li 'hashalg' is a valid pointer. * *\li 'source' is a valid text region. * * Returns: *\li #ISC_R_SUCCESS on success *\li #DNS_R_UNKNOWN type is unknown */ ISC_LANG_ENDDECLS #endif /* DNS_RCODE_H */ ��������������������������������������������������������������������������������bind9/dns/diff.h������������������������������������������������������������������������������������0000644�����������������00000015503�14763166026�0007435 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_DIFF_H #define DNS_DIFF_H 1 /***** ***** Module Info *****/ /*! \file dns/diff.h * \brief * A diff is a convenience type representing a list of changes to be * made to a database. */ /*** *** Imports ***/ #include <isc/lang.h> #include <isc/magic.h> #include <dns/name.h> #include <dns/rdata.h> #include <dns/types.h> /*** *** Types ***/ /*% * A dns_difftuple_t represents a single RR being added or deleted. * The RR type and class are in the 'rdata' member; the class is always * the real one, not a DynDNS meta-class, so that the rdatas can be * compared using dns_rdata_compare(). The TTL is significant * even for deletions, because a deletion/addition pair cannot * be canceled out if the TTL differs (it might be an explicit * TTL update). * * Tuples are also used to represent complete RRs with owner * names for a couple of other purposes, such as the * individual RRs of a "RRset exists (value dependent)" * prerequisite set. In this case, op==DNS_DIFFOP_EXISTS, * and the TTL is ignored. * * DNS_DIFFOP_*RESIGN will cause the 'resign' attribute of the resulting * RRset to be recomputed to be 'resign' seconds before the earliest RRSIG * timeexpire. */ typedef enum { DNS_DIFFOP_ADD = 0, /*%< Add an RR. */ DNS_DIFFOP_DEL = 1, /*%< Delete an RR. */ DNS_DIFFOP_EXISTS = 2, /*%< Assert RR existence. */ DNS_DIFFOP_ADDRESIGN = 4, /*%< ADD + RESIGN. */ DNS_DIFFOP_DELRESIGN = 5 /*%< DEL + RESIGN. */ } dns_diffop_t; typedef struct dns_difftuple dns_difftuple_t; #define DNS_DIFFTUPLE_MAGIC ISC_MAGIC('D','I','F','T') #define DNS_DIFFTUPLE_VALID(t) ISC_MAGIC_VALID(t, DNS_DIFFTUPLE_MAGIC) struct dns_difftuple { unsigned int magic; isc_mem_t *mctx; dns_diffop_t op; dns_name_t name; dns_ttl_t ttl; dns_rdata_t rdata; ISC_LINK(dns_difftuple_t) link; /* Variable-size name data and rdata follows. */ }; /*% * A dns_diff_t represents a set of changes being applied to * a zone. Diffs are also used to represent "RRset exists * (value dependent)" prerequisites. */ typedef struct dns_diff dns_diff_t; #define DNS_DIFF_MAGIC ISC_MAGIC('D','I','F','F') #define DNS_DIFF_VALID(t) ISC_MAGIC_VALID(t, DNS_DIFF_MAGIC) struct dns_diff { unsigned int magic; isc_mem_t * mctx; ISC_LIST(dns_difftuple_t) tuples; }; /* Type of comparison function for sorting diffs. */ typedef int dns_diff_compare_func(const void *, const void *); /*** *** Functions ***/ ISC_LANG_BEGINDECLS /**************************************************************************/ /* * Manipulation of diffs and tuples. */ isc_result_t dns_difftuple_create(isc_mem_t *mctx, dns_diffop_t op, dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata, dns_difftuple_t **tp); /*%< * Create a tuple. Deep copies are made of the name and rdata, so * they need not remain valid after the call. * * Requires: *\li *tp != NULL && *tp == NULL. * * Returns: *\li ISC_R_SUCCESS * \li ISC_R_NOMEMORY */ void dns_difftuple_free(dns_difftuple_t **tp); /*%< * Free a tuple. * * Requires: * \li **tp is a valid tuple. * * Ensures: * \li *tp == NULL * \li All memory used by the tuple is freed. */ isc_result_t dns_difftuple_copy(dns_difftuple_t *orig, dns_difftuple_t **copyp); /*%< * Copy a tuple. * * Requires: * \li 'orig' points to a valid tuple *\li copyp != NULL && *copyp == NULL */ void dns_diff_init(isc_mem_t *mctx, dns_diff_t *diff); /*%< * Initialize a diff. * * Requires: * \li 'diff' points to an uninitialized dns_diff_t * \li allocated by the caller. * * Ensures: * \li '*diff' is a valid, empty diff. */ void dns_diff_clear(dns_diff_t *diff); /*%< * Clear a diff, destroying all its tuples. * * Requires: * \li 'diff' points to a valid dns_diff_t. * * Ensures: * \li Any tuples in the diff are destroyed. * The diff now empty, but it is still valid * and may be reused without calling dns_diff_init * again. The only memory used is that of the * dns_diff_t structure itself. * * Notes: * \li Managing the memory of the dns_diff_t structure itself * is the caller's responsibility. */ void dns_diff_append(dns_diff_t *diff, dns_difftuple_t **tuple); /*%< * Append a single tuple to a diff. * *\li 'diff' is a valid diff. * \li '*tuple' is a valid tuple. * * Ensures: *\li *tuple is NULL. *\li The tuple has been freed, or will be freed when the diff is cleared. */ void dns_diff_appendminimal(dns_diff_t *diff, dns_difftuple_t **tuple); /*%< * Append 'tuple' to 'diff', removing any duplicate * or conflicting updates as needed to create a minimal diff. * * Requires: *\li 'diff' is a minimal diff. * * Ensures: *\li 'diff' is still a minimal diff. * \li *tuple is NULL. * \li The tuple has been freed, or will be freed when the diff is cleared. * */ isc_result_t dns_diff_sort(dns_diff_t *diff, dns_diff_compare_func *compare); /*%< * Sort 'diff' in-place according to the comparison function 'compare'. */ isc_result_t dns_diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver); isc_result_t dns_diff_applysilently(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver); /*%< * Apply 'diff' to the database 'db'. * * dns_diff_apply() logs warnings about updates with no effect or * with inconsistent TTLs; dns_diff_applysilently() does not. * * For efficiency, the diff should be sorted by owner name. * If it is not sorted, operation will still be correct, * but less efficient. * * Requires: *\li *diff is a valid diff (possibly empty), containing * tuples of type #DNS_DIFFOP_ADD and/or * For #DNS_DIFFOP_DEL tuples, the TTL is ignored. * */ isc_result_t dns_diff_load(dns_diff_t *diff, dns_addrdatasetfunc_t addfunc, void *add_private); /*%< * Like dns_diff_apply, but for use when loading a new database * instead of modifying an existing one. This bypasses the * database transaction mechanisms. * * Requires: *\li 'addfunc' is a valid dns_addradatasetfunc_t obtained from * dns_db_beginload() * *\li 'add_private' points to a corresponding dns_dbload_t * * (XXX why is it a void pointer, then?) */ isc_result_t dns_diff_print(dns_diff_t *diff, FILE *file); /*%< * Print the differences to 'file' or if 'file' is NULL via the * logging system. * * Require: *\li 'diff' to be valid. *\li 'file' to refer to a open file or NULL. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li #ISC_R_UNEXPECTED *\li any error from dns_rdataset_totext() */ ISC_LANG_ENDDECLS #endif /* DNS_DIFF_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/secalg.h����������������������������������������������������������������������������������0000644�����������������00000003251�14763166026�0007760 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_SECALG_H #define DNS_SECALG_H 1 /*! \file dns/secalg.h */ #include <isc/lang.h> #include <dns/types.h> ISC_LANG_BEGINDECLS isc_result_t dns_secalg_fromtext(dns_secalg_t *secalgp, isc_textregion_t *source); /*%< * Convert the text 'source' refers to into a DNSSEC security algorithm value. * The text may contain either a mnemonic algorithm name or a decimal algorithm * number. * * Requires: *\li 'secalgp' is a valid pointer. * *\li 'source' is a valid text region. * * Returns: *\li ISC_R_SUCCESS on success *\li ISC_R_RANGE numeric type is out of range *\li DNS_R_UNKNOWN mnemonic type is unknown */ isc_result_t dns_secalg_totext(dns_secalg_t secalg, isc_buffer_t *target); /*%< * Put a textual representation of the DNSSEC security algorithm 'secalg' * into 'target'. * * Requires: *\li 'secalg' is a valid secalg. * *\li 'target' is a valid text buffer. * * Ensures, * if the result is success: *\li The used space in 'target' is updated. * * Returns: *\li ISC_R_SUCCESS on success *\li ISC_R_NOSPACE target buffer is too small */ #define DNS_SECALG_FORMATSIZE 20 void dns_secalg_format(dns_secalg_t alg, char *cp, unsigned int size); /*%< * Wrapper for dns_secalg_totext(), writing text into 'cp' */ ISC_LANG_ENDDECLS #endif /* DNS_SECALG_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/tkey.h������������������������������������������������������������������������������������0000644�����������������00000016674�14763166026�0007513 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_TKEY_H #define DNS_TKEY_H 1 /*! \file dns/tkey.h */ #include <isc/lang.h> #include <dns/types.h> #include <dst/dst.h> #include <dst/gssapi.h> ISC_LANG_BEGINDECLS /* Key agreement modes */ #define DNS_TKEYMODE_SERVERASSIGNED 1 #define DNS_TKEYMODE_DIFFIEHELLMAN 2 #define DNS_TKEYMODE_GSSAPI 3 #define DNS_TKEYMODE_RESOLVERASSIGNED 4 #define DNS_TKEYMODE_DELETE 5 struct dns_tkeyctx { dst_key_t *dhkey; dns_name_t *domain; gss_cred_id_t gsscred; isc_mem_t *mctx; isc_entropy_t *ectx; char *gssapi_keytab; }; isc_result_t dns_tkeyctx_create(isc_mem_t *mctx, isc_entropy_t *ectx, dns_tkeyctx_t **tctxp); /*%< * Create an empty TKEY context. * * Requires: *\li 'mctx' is not NULL *\li 'tctx' is not NULL *\li '*tctx' is NULL * * Returns *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li return codes from dns_name_fromtext() */ void dns_tkeyctx_destroy(dns_tkeyctx_t **tctxp); /*%< * Frees all data associated with the TKEY context * * Requires: *\li 'tctx' is not NULL *\li '*tctx' is not NULL */ isc_result_t dns_tkey_processquery(dns_message_t *msg, dns_tkeyctx_t *tctx, dns_tsig_keyring_t *ring); /*%< * Processes a query containing a TKEY record, adding or deleting TSIG * keys if necessary, and modifies the message to contain the response. * * Requires: *\li 'msg' is a valid message *\li 'tctx' is a valid TKEY context *\li 'ring' is a valid TSIG keyring * * Returns *\li #ISC_R_SUCCESS msg was updated (the TKEY operation succeeded, * or msg now includes a TKEY with an error set) * DNS_R_FORMERR the packet was malformed (missing a TKEY * or KEY). *\li other An error occurred while processing the message */ isc_result_t dns_tkey_builddhquery(dns_message_t *msg, dst_key_t *key, dns_name_t *name, dns_name_t *algorithm, isc_buffer_t *nonce, isc_uint32_t lifetime); /*%< * Builds a query containing a TKEY that will generate a shared * secret using a Diffie-Hellman key exchange. The shared key * will be of the specified algorithm (only DNS_TSIG_HMACMD5_NAME * is supported), and will be named either 'name', * 'name' + server chosen domain, or random data + server chosen domain * if 'name' == dns_rootname. If nonce is not NULL, it supplies * random data used in the shared secret computation. The key is * requested to have the specified lifetime (in seconds) * * * Requires: *\li 'msg' is a valid message *\li 'key' is a valid Diffie Hellman dst key *\li 'name' is a valid name *\li 'algorithm' is a valid name * * Returns: *\li #ISC_R_SUCCESS msg was successfully updated to include the * query to be sent *\li other an error occurred while building the message */ isc_result_t dns_tkey_buildgssquery(dns_message_t *msg, dns_name_t *name, dns_name_t *gname, isc_buffer_t *intoken, isc_uint32_t lifetime, gss_ctx_id_t *context, isc_boolean_t win2k, isc_mem_t *mctx, char **err_message); /*%< * Builds a query containing a TKEY that will generate a GSSAPI context. * The key is requested to have the specified lifetime (in seconds). * * Requires: *\li 'msg' is a valid message *\li 'name' is a valid name *\li 'gname' is a valid name *\li 'context' is a pointer to a valid gss_ctx_id_t * (which may have the value GSS_C_NO_CONTEXT) *\li 'win2k' when true says to turn on some hacks to work * with the non-standard GSS-TSIG of Windows 2000 * * Returns: *\li ISC_R_SUCCESS msg was successfully updated to include the * query to be sent *\li other an error occurred while building the message *\li *err_message optional error message */ isc_result_t dns_tkey_builddeletequery(dns_message_t *msg, dns_tsigkey_t *key); /*%< * Builds a query containing a TKEY record that will delete the * specified shared secret from the server. * * Requires: *\li 'msg' is a valid message *\li 'key' is a valid TSIG key * * Returns: *\li #ISC_R_SUCCESS msg was successfully updated to include the * query to be sent *\li other an error occurred while building the message */ isc_result_t dns_tkey_processdhresponse(dns_message_t *qmsg, dns_message_t *rmsg, dst_key_t *key, isc_buffer_t *nonce, dns_tsigkey_t **outkey, dns_tsig_keyring_t *ring); /*%< * Processes a response to a query containing a TKEY that was * designed to generate a shared secret using a Diffie-Hellman key * exchange. If the query was successful, a new shared key * is created and added to the list of shared keys. * * Requires: *\li 'qmsg' is a valid message (the query) *\li 'rmsg' is a valid message (the response) *\li 'key' is a valid Diffie Hellman dst key *\li 'outkey' is either NULL or a pointer to NULL *\li 'ring' is a valid keyring or NULL * * Returns: *\li #ISC_R_SUCCESS the shared key was successfully added *\li #ISC_R_NOTFOUND an error occurred while looking for a * component of the query or response */ isc_result_t dns_tkey_processgssresponse(dns_message_t *qmsg, dns_message_t *rmsg, dns_name_t *gname, gss_ctx_id_t *context, isc_buffer_t *outtoken, dns_tsigkey_t **outkey, dns_tsig_keyring_t *ring, char **err_message); /*%< * XXX */ isc_result_t dns_tkey_processdeleteresponse(dns_message_t *qmsg, dns_message_t *rmsg, dns_tsig_keyring_t *ring); /*%< * Processes a response to a query containing a TKEY that was * designed to delete a shared secret. If the query was successful, * the shared key is deleted from the list of shared keys. * * Requires: *\li 'qmsg' is a valid message (the query) *\li 'rmsg' is a valid message (the response) *\li 'ring' is not NULL * * Returns: *\li #ISC_R_SUCCESS the shared key was successfully deleted *\li #ISC_R_NOTFOUND an error occurred while looking for a * component of the query or response */ isc_result_t dns_tkey_gssnegotiate(dns_message_t *qmsg, dns_message_t *rmsg, dns_name_t *server, gss_ctx_id_t *context, dns_tsigkey_t **outkey, dns_tsig_keyring_t *ring, isc_boolean_t win2k, char **err_message); /* * Client side negotiation of GSS-TSIG. Process the response * to a TKEY, and establish a TSIG key if negotiation was successful. * Build a response to the input TKEY message. Can take multiple * calls to successfully establish the context. * * Requires: * 'qmsg' is a valid message, the original TKEY request; * it will be filled with the new message to send * 'rmsg' is a valid message, the incoming TKEY message * 'server' is the server name * 'context' is the input context handle * 'outkey' receives the established key, if non-NULL; * if non-NULL must point to NULL * 'ring' is the keyring in which to establish the key, * or NULL * 'win2k' when true says to turn on some hacks to work * with the non-standard GSS-TSIG of Windows 2000 * * Returns: * ISC_R_SUCCESS context was successfully established * ISC_R_NOTFOUND couldn't find a needed part of the query * or response * DNS_R_CONTINUE additional context negotiation is required; * send the new qmsg to the server */ ISC_LANG_ENDDECLS #endif /* DNS_TKEY_H */ ��������������������������������������������������������������������bind9/dns/lib.h�������������������������������������������������������������������������������������0000644�����������������00000002247�14763166026�0007274 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_LIB_H #define DNS_LIB_H 1 /*! \file dns/lib.h */ #include <isc/types.h> #include <isc/lang.h> ISC_LANG_BEGINDECLS /*% * Tuning: external query load in packets per seconds. */ LIBDNS_EXTERNAL_DATA extern unsigned int dns_pps; LIBDNS_EXTERNAL_DATA extern isc_msgcat_t *dns_msgcat; void dns_lib_initmsgcat(void); /*%< * Initialize the DNS library's message catalog, dns_msgcat, if it * has not already been initialized. */ isc_result_t dns_lib_init(void); /*%< * A set of initialization procedure used in the DNS library. This function * is provided for an application that is not aware of the underlying ISC or * DNS libraries much. */ void dns_lib_shutdown(void); /*%< * Free temporary resources allocated in dns_lib_init(). */ ISC_LANG_ENDDECLS #endif /* DNS_LIB_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/dyndb.h�����������������������������������������������������������������������������������0000644�����������������00000011335�14763166026�0007624 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_DYNDB_H #define DNS_DYNDB_H #include <isc/types.h> #include <dns/types.h> ISC_LANG_BEGINDECLS /*! * \brief * Context for intializing a dyndb module. * * This structure passes global server data to which a dyndb * module will need access -- the server memory context, hash * initializer, log context, etc. The structure doesn't persist * beyond configuring the dyndb module. The module's register function * should attach to all reference-counted variables and its destroy * function should detach from them. */ struct dns_dyndbctx { unsigned int magic; const void *hashinit; isc_mem_t *mctx; isc_log_t *lctx; dns_view_t *view; dns_zonemgr_t *zmgr; isc_task_t *task; isc_timermgr_t *timermgr; isc_boolean_t *refvar; }; #define DNS_DYNDBCTX_MAGIC ISC_MAGIC('D', 'd', 'b', 'c') #define DNS_DYNDBCTX_VALID(d) ISC_MAGIC_VALID(d, DNS_DYNDBCTX_MAGIC) /* * API version * * When the API changes, increment DNS_DYNDB_VERSION. If the * change is backward-compatible (e.g., adding a new function call * but not changing or removing an old one), increment DNS_DYNDB_AGE; * if not, set DNS_DYNDB_AGE to 0. */ #ifndef DNS_DYNDB_VERSION #define DNS_DYNDB_VERSION 1 #define DNS_DYNDB_AGE 0 #endif typedef isc_result_t dns_dyndb_register_t(isc_mem_t *mctx, const char *name, const char *parameters, const char *file, unsigned long line, const dns_dyndbctx_t *dctx, void **instp); /*% * Called when registering a new driver instance. 'name' must be unique. * 'parameters' contains the driver configuration text. 'dctx' is the * initialization context set up in dns_dyndb_createctx(). * * '*instp' must be set to the driver instance handle if the functino * is successful. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li Other errors are possible */ typedef void dns_dyndb_destroy_t(void **instp); /*% * Destroy a driver instance. Dereference any reference-counted * variables passed in 'dctx' and 'inst' in the register function. * * \c *instp must be set to \c NULL by the function before it returns. */ typedef int dns_dyndb_version_t(unsigned int *flags); /*% * Return the API version number a dyndb module was compiled with. * * If the returned version number is no greater than than * DNS_DYNDB_VERSION, and no less than DNS_DYNDB_VERSION - DNS_DYNDB_AGE, * then the module is API-compatible with named. * * 'flags' is currently unused and may be NULL, but could be used in * the future to pass back driver capabilities or other information. */ isc_result_t dns_dyndb_load(const char *libname, const char *name, const char *parameters, const char *file, unsigned long line, isc_mem_t *mctx, const dns_dyndbctx_t *dctx); /*% * Load a dyndb module. * * This loads a dyndb module using dlopen() or equivalent, calls its register * function (see dns_dyndb_register_t above), and if successful, adds * the instance handle to a list of dyndb instances so it can be cleaned * up later. * * 'file' and 'line' can be used to indicate the name of the file and * the line number from which the parameters were taken, so that logged * error messages, if any, will display the correct locations. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li Other errors are possible */ void dns_dyndb_cleanup(isc_boolean_t exiting); /*% * Shut down and destroy all running dyndb modules. * * 'exiting' indicates whether the server is shutting down, * as opposed to merely being reconfigured. */ isc_result_t dns_dyndb_createctx(isc_mem_t *mctx, const void *hashinit, isc_log_t *lctx, dns_view_t *view, dns_zonemgr_t *zmgr, isc_task_t *task, isc_timermgr_t *tmgr, dns_dyndbctx_t **dctxp); /*% * Create a dyndb initialization context structure, with * pointers to structures in the server that the dyndb module will * need to access (view, zone manager, memory context, hash initializer, * etc). This structure is expected to last only until all dyndb * modules have been loaded and initialized; after that it will be * destroyed with dns_dyndb_destroyctx(). * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li Other errors are possible */ void dns_dyndb_destroyctx(dns_dyndbctx_t **dctxp); /*% * Destroys a dyndb initialization context structure; all * reference-counted members are detached and the structure is freed. */ ISC_LANG_ENDDECLS #endif /* DNS_DYNDB_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/rrl.h�������������������������������������������������������������������������������������0000644�����������������00000014772�14763166026�0007333 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_RRL_H #define DNS_RRL_H 1 /* * Rate limit DNS responses. */ #include <isc/lang.h> #include <dns/fixedname.h> #include <dns/rdata.h> #include <dns/types.h> ISC_LANG_BEGINDECLS /* * Memory allocation or other failures. */ #define DNS_RRL_LOG_FAIL ISC_LOG_WARNING /* * dropped or slipped responses. */ #define DNS_RRL_LOG_DROP ISC_LOG_INFO /* * Major events in dropping or slipping. */ #define DNS_RRL_LOG_DEBUG1 ISC_LOG_DEBUG(3) /* * Limit computations. */ #define DNS_RRL_LOG_DEBUG2 ISC_LOG_DEBUG(4) /* * Even less interesting. */ #define DNS_RRL_LOG_DEBUG3 ISC_LOG_DEBUG(9) #define DNS_RRL_LOG_ERR_LEN 64 #define DNS_RRL_LOG_BUF_LEN (sizeof("would continue limiting") + \ DNS_RRL_LOG_ERR_LEN + \ sizeof(" responses to ") + \ ISC_NETADDR_FORMATSIZE + \ sizeof("/128 for IN ") + \ DNS_RDATATYPE_FORMATSIZE + \ DNS_NAME_FORMATSIZE) typedef struct dns_rrl_hash dns_rrl_hash_t; /* * Response types. */ typedef enum { DNS_RRL_RTYPE_FREE = 0, DNS_RRL_RTYPE_QUERY, DNS_RRL_RTYPE_REFERRAL, DNS_RRL_RTYPE_NODATA, DNS_RRL_RTYPE_NXDOMAIN, DNS_RRL_RTYPE_ERROR, DNS_RRL_RTYPE_ALL, DNS_RRL_RTYPE_TCP, } dns_rrl_rtype_t; /* * A rate limit bucket key. * This should be small to limit the total size of the database. * The hash of the qname should be wide enough to make the probability * of collisions among requests from a single IP address block less than 50%. * We need a 32-bit hash value for 10000 qps (e.g. random qnames forged * by attacker) to collide with legitimate qnames from the target with * probability at most 1%. */ #define DNS_RRL_MAX_PREFIX 64 typedef union dns_rrl_key dns_rrl_key_t; struct dns__rrl_key { isc_uint32_t ip[DNS_RRL_MAX_PREFIX/32]; isc_uint32_t qname_hash; dns_rdatatype_t qtype; isc_uint8_t qclass; unsigned int rtype :4; /* dns_rrl_rtype_t */ unsigned int ipv6 :1; }; union dns_rrl_key { struct dns__rrl_key s; isc_uint16_t w[sizeof(struct dns__rrl_key)/sizeof(isc_uint16_t)]; }; /* * A rate-limit entry. * This should be small to limit the total size of the table of entries. */ typedef struct dns_rrl_entry dns_rrl_entry_t; typedef ISC_LIST(dns_rrl_entry_t) dns_rrl_bin_t; struct dns_rrl_entry { ISC_LINK(dns_rrl_entry_t) lru; ISC_LINK(dns_rrl_entry_t) hlink; dns_rrl_key_t key; # define DNS_RRL_RESPONSE_BITS 24 signed int responses :DNS_RRL_RESPONSE_BITS; # define DNS_RRL_QNAMES_BITS 8 unsigned int log_qname :DNS_RRL_QNAMES_BITS; # define DNS_RRL_TS_GEN_BITS 2 unsigned int ts_gen :DNS_RRL_TS_GEN_BITS; unsigned int ts_valid :1; # define DNS_RRL_HASH_GEN_BITS 1 unsigned int hash_gen :DNS_RRL_HASH_GEN_BITS; unsigned int logged :1; # define DNS_RRL_LOG_BITS 11 unsigned int log_secs :DNS_RRL_LOG_BITS; # define DNS_RRL_TS_BITS 12 unsigned int ts :DNS_RRL_TS_BITS; # define DNS_RRL_MAX_SLIP 10 unsigned int slip_cnt :4; }; #define DNS_RRL_MAX_TIME_TRAVEL 5 #define DNS_RRL_FOREVER (1<<DNS_RRL_TS_BITS) #define DNS_RRL_MAX_TS (DNS_RRL_FOREVER - 1) #define DNS_RRL_MAX_RESPONSES ((1<<(DNS_RRL_RESPONSE_BITS-1))-1) #define DNS_RRL_MAX_WINDOW 3600 #if DNS_RRL_MAX_WINDOW >= DNS_RRL_MAX_TS #error "DNS_RRL_MAX_WINDOW is too large" #endif #define DNS_RRL_MAX_RATE 1000 #if DNS_RRL_MAX_RATE >= (DNS_RRL_MAX_RESPONSES / DNS_RRL_MAX_WINDOW) #error "DNS_RRL_MAX_rate is too large" #endif #if (1<<DNS_RRL_LOG_BITS) >= DNS_RRL_FOREVER #error DNS_RRL_LOG_BITS is too big #endif #define DNS_RRL_MAX_LOG_SECS 1800 #if DNS_RRL_MAX_LOG_SECS >= (1<<DNS_RRL_LOG_BITS) #error "DNS_RRL_MAX_LOG_SECS is too large" #endif #define DNS_RRL_STOP_LOG_SECS 60 #if DNS_RRL_STOP_LOG_SECS >= (1<<DNS_RRL_LOG_BITS) #error "DNS_RRL_STOP_LOG_SECS is too large" #endif /* * A hash table of rate-limit entries. */ struct dns_rrl_hash { isc_stdtime_t check_time; unsigned int gen :DNS_RRL_HASH_GEN_BITS; int length; dns_rrl_bin_t bins[1]; }; /* * A block of rate-limit entries. */ typedef struct dns_rrl_block dns_rrl_block_t; struct dns_rrl_block { ISC_LINK(dns_rrl_block_t) link; int size; dns_rrl_entry_t entries[1]; }; /* * A rate limited qname buffer. */ typedef struct dns_rrl_qname_buf dns_rrl_qname_buf_t; struct dns_rrl_qname_buf { ISC_LINK(dns_rrl_qname_buf_t) link; const dns_rrl_entry_t *e; unsigned int index; dns_fixedname_t qname; }; typedef struct dns_rrl_rate dns_rrl_rate_t; struct dns_rrl_rate { int r; int scaled; const char *str; }; /* * Per-view query rate limit parameters and a pointer to database. */ typedef struct dns_rrl dns_rrl_t; struct dns_rrl { isc_mutex_t lock; isc_mem_t *mctx; isc_boolean_t log_only; dns_rrl_rate_t responses_per_second; dns_rrl_rate_t referrals_per_second; dns_rrl_rate_t nodata_per_second; dns_rrl_rate_t nxdomains_per_second; dns_rrl_rate_t errors_per_second; dns_rrl_rate_t all_per_second; dns_rrl_rate_t slip; int window; double qps_scale; int max_entries; dns_acl_t *exempt; int num_entries; int qps_responses; isc_stdtime_t qps_time; double qps; unsigned int probes; unsigned int searches; ISC_LIST(dns_rrl_block_t) blocks; ISC_LIST(dns_rrl_entry_t) lru; dns_rrl_hash_t *hash; dns_rrl_hash_t *old_hash; unsigned int hash_gen; unsigned int ts_gen; # define DNS_RRL_TS_BASES (1<<DNS_RRL_TS_GEN_BITS) isc_stdtime_t ts_bases[DNS_RRL_TS_BASES]; int ipv4_prefixlen; isc_uint32_t ipv4_mask; int ipv6_prefixlen; isc_uint32_t ipv6_mask[4]; isc_stdtime_t log_stops_time; dns_rrl_entry_t *last_logged; int num_logged; int num_qnames; ISC_LIST(dns_rrl_qname_buf_t) qname_free; # define DNS_RRL_QNAMES (1<<DNS_RRL_QNAMES_BITS) dns_rrl_qname_buf_t *qnames[DNS_RRL_QNAMES]; }; typedef enum { DNS_RRL_RESULT_OK, DNS_RRL_RESULT_DROP, DNS_RRL_RESULT_SLIP, } dns_rrl_result_t; dns_rrl_result_t dns_rrl(dns_view_t *view, const isc_sockaddr_t *client_addr, isc_boolean_t is_tcp, dns_rdataclass_t rdclass, dns_rdatatype_t qtype, dns_name_t *qname, isc_result_t resp_result, isc_stdtime_t now, isc_boolean_t wouldlog, char *log_buf, unsigned int log_buf_len); void dns_rrl_view_destroy(dns_view_t *view); isc_result_t dns_rrl_init(dns_rrl_t **rrlp, dns_view_t *view, int min_entries); ISC_LANG_ENDDECLS #endif /* DNS_RRL_H */ ������bind9/dns/rdatalist.h�������������������������������������������������������������������������������0000644�����������������00000005010�14763166026�0010504 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_RDATALIST_H #define DNS_RDATALIST_H 1 /***** ***** Module Info *****/ /*! \file dns/rdatalist.h * \brief * A DNS rdatalist is a list of rdata of a common type and class. * * MP: *\li Clients of this module must impose any required synchronization. * * Reliability: *\li No anticipated impact. * * Resources: *\li TBS * * Security: *\li No anticipated impact. * * Standards: *\li None. */ #include <isc/lang.h> #include <dns/types.h> /*% * Clients may use this type directly. */ struct dns_rdatalist { dns_rdataclass_t rdclass; dns_rdatatype_t type; dns_rdatatype_t covers; dns_ttl_t ttl; ISC_LIST(dns_rdata_t) rdata; ISC_LINK(dns_rdatalist_t) link; /*%< * Case vector. If the bit is set then the corresponding * character in the owner name needs to be AND'd with 0x20, * rendering that character upper case. */ unsigned char upper[32]; }; ISC_LANG_BEGINDECLS void dns_rdatalist_init(dns_rdatalist_t *rdatalist); /*%< * Initialize rdatalist. * * Ensures: *\li All fields of rdatalist have been initialized to their default * values. */ isc_result_t dns_rdatalist_tordataset(dns_rdatalist_t *rdatalist, dns_rdataset_t *rdataset); /*%< * Make 'rdataset' refer to the rdata in 'rdatalist'. * * Note: *\li The caller must ensure that 'rdatalist' remains valid and unchanged * while 'rdataset' is associated with it. * * Requires: * *\li 'rdatalist' is a valid rdatalist. * *\li 'rdataset' is a valid rdataset that is not currently associated with * any rdata. * * Ensures, * on success, * *\li 'rdataset' is associated with the rdata in rdatalist. * * Returns: *\li #ISC_R_SUCCESS */ isc_result_t dns_rdatalist_fromrdataset(dns_rdataset_t *rdataset, dns_rdatalist_t **rdatalist); /*%< * Point 'rdatalist' to the rdatalist in 'rdataset'. * * Requires: * *\li 'rdatalist' is a pointer to a NULL dns_rdatalist_t pointer. * *\li 'rdataset' is a valid rdataset associated with an rdatalist. * * Ensures, * on success, * *\li 'rdatalist' is pointed to the rdatalist in rdataset. * * Returns: *\li #ISC_R_SUCCESS */ ISC_LANG_ENDDECLS #endif /* DNS_RDATALIST_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/bit.h�������������������������������������������������������������������������������������0000644�����������������00000001530�14763166026�0007276 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_BIT_H #define DNS_BIT_H 1 /*! \file dns/bit.h */ #include <isc/int.h> #include <isc/boolean.h> typedef isc_uint64_t dns_bitset_t; #define DNS_BIT_SET(bit, bitset) \ (*(bitset) |= ((dns_bitset_t)1 << (bit))) #define DNS_BIT_CLEAR(bit, bitset) \ (*(bitset) &= ~((dns_bitset_t)1 << (bit))) #define DNS_BIT_CHECK(bit, bitset) \ ISC_TF((*(bitset) & ((dns_bitset_t)1 << (bit))) \ == ((dns_bitset_t)1 << (bit))) #endif /* DNS_BIT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/secproto.h��������������������������������������������������������������������������������0000644�����������������00000003024�14763166026�0010356 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_SECPROTO_H #define DNS_SECPROTO_H 1 /*! \file dns/secproto.h */ #include <isc/lang.h> #include <dns/types.h> ISC_LANG_BEGINDECLS isc_result_t dns_secproto_fromtext(dns_secproto_t *secprotop, isc_textregion_t *source); /*%< * Convert the text 'source' refers to into a DNSSEC security protocol value. * The text may contain either a mnemonic protocol name or a decimal protocol * number. * * Requires: *\li 'secprotop' is a valid pointer. * *\li 'source' is a valid text region. * * Returns: *\li ISC_R_SUCCESS on success *\li ISC_R_RANGE numeric type is out of range *\li DNS_R_UNKNOWN mnemonic type is unknown */ isc_result_t dns_secproto_totext(dns_secproto_t secproto, isc_buffer_t *target); /*%< * Put a textual representation of the DNSSEC security protocol 'secproto' * into 'target'. * * Requires: *\li 'secproto' is a valid secproto. * *\li 'target' is a valid text buffer. * * Ensures, * if the result is success: * \li The used space in 'target' is updated. * * Returns: *\li ISC_R_SUCCESS on success *\li ISC_R_NOSPACE target buffer is too small */ ISC_LANG_ENDDECLS #endif /* DNS_SECPROTO_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/edns.h������������������������������������������������������������������������������������0000644�����������������00000001321�14763166026�0007447 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_EDNS_H #define DNS_EDNS_H 1 /*% * The maximum version on EDNS supported by this build. */ #define DNS_EDNS_VERSION 0 #ifdef DRAFT_ANDREWS_EDNS1 #undef DNS_EDNS_VERSION /* * Warning: this currently disables sending COOKIE requests in resolver.c */ #define DNS_EDNS_VERSION 1 /* draft-andrews-edns1 */ #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/stats.h�����������������������������������������������������������������������������������0000644�����������������00000032227�14763166026�0007665 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id$ */ #ifndef DNS_STATS_H #define DNS_STATS_H 1 /*! \file dns/stats.h */ #include <dns/types.h> /*% * Statistics counters. Used as isc_statscounter_t values. */ enum { /*% * Resolver statistics counters. */ dns_resstatscounter_queryv4 = 0, dns_resstatscounter_queryv6 = 1, dns_resstatscounter_responsev4 = 2, dns_resstatscounter_responsev6 = 3, dns_resstatscounter_nxdomain = 4, dns_resstatscounter_servfail = 5, dns_resstatscounter_formerr = 6, dns_resstatscounter_othererror = 7, dns_resstatscounter_edns0fail = 8, dns_resstatscounter_mismatch = 9, dns_resstatscounter_truncated = 10, dns_resstatscounter_lame = 11, dns_resstatscounter_retry = 12, dns_resstatscounter_gluefetchv4 = 13, dns_resstatscounter_gluefetchv6 = 14, dns_resstatscounter_gluefetchv4fail = 15, dns_resstatscounter_gluefetchv6fail = 16, dns_resstatscounter_val = 17, dns_resstatscounter_valsuccess = 18, dns_resstatscounter_valnegsuccess = 19, dns_resstatscounter_valfail = 20, dns_resstatscounter_dispabort = 21, dns_resstatscounter_dispsockfail = 22, dns_resstatscounter_querytimeout = 23, dns_resstatscounter_queryrtt0 = 24, dns_resstatscounter_queryrtt1 = 25, dns_resstatscounter_queryrtt2 = 26, dns_resstatscounter_queryrtt3 = 27, dns_resstatscounter_queryrtt4 = 28, dns_resstatscounter_queryrtt5 = 29, dns_resstatscounter_nfetch = 30, dns_resstatscounter_disprequdp = 31, dns_resstatscounter_dispreqtcp = 32, dns_resstatscounter_buckets = 33, dns_resstatscounter_refused = 34, dns_resstatscounter_cookienew = 35, dns_resstatscounter_cookieout = 36, dns_resstatscounter_cookiein = 37, dns_resstatscounter_cookieok = 38, dns_resstatscounter_badvers = 39, dns_resstatscounter_badcookie = 40, dns_resstatscounter_zonequota = 41, dns_resstatscounter_serverquota = 42, dns_resstatscounter_nextitem = 43, dns_resstatscounter_max = 44, /* * DNSSEC stats. */ dns_dnssecstats_asis = 0, dns_dnssecstats_downcase = 1, dns_dnssecstats_wildcard = 2, dns_dnssecstats_fail = 3, dns_dnssecstats_max = 4, /*% * Zone statistics counters. */ dns_zonestatscounter_notifyoutv4 = 0, dns_zonestatscounter_notifyoutv6 = 1, dns_zonestatscounter_notifyinv4 = 2, dns_zonestatscounter_notifyinv6 = 3, dns_zonestatscounter_notifyrej = 4, dns_zonestatscounter_soaoutv4 = 5, dns_zonestatscounter_soaoutv6 = 6, dns_zonestatscounter_axfrreqv4 = 7, dns_zonestatscounter_axfrreqv6 = 8, dns_zonestatscounter_ixfrreqv4 = 9, dns_zonestatscounter_ixfrreqv6 = 10, dns_zonestatscounter_xfrsuccess = 11, dns_zonestatscounter_xfrfail = 12, dns_zonestatscounter_max = 13, /* * Adb statistics values. */ dns_adbstats_nentries = 0, dns_adbstats_entriescnt = 1, dns_adbstats_nnames = 2, dns_adbstats_namescnt = 3, dns_adbstats_max = 4, /* * Cache statistics values. */ dns_cachestatscounter_hits = 1, dns_cachestatscounter_misses = 2, dns_cachestatscounter_queryhits = 3, dns_cachestatscounter_querymisses = 4, dns_cachestatscounter_deletelru = 5, dns_cachestatscounter_deletettl = 6, dns_cachestatscounter_max = 7, /*% * Query statistics counters (obsolete). */ dns_statscounter_success = 0, /*%< Successful lookup */ dns_statscounter_referral = 1, /*%< Referral result */ dns_statscounter_nxrrset = 2, /*%< NXRRSET result */ dns_statscounter_nxdomain = 3, /*%< NXDOMAIN result */ dns_statscounter_recursion = 4, /*%< Recursion was used */ dns_statscounter_failure = 5, /*%< Some other failure */ dns_statscounter_duplicate = 6, /*%< Duplicate query */ dns_statscounter_dropped = 7, /*%< Duplicate query (dropped) */ /*% * DNSTAP statistics counters. */ dns_dnstapcounter_success = 0, dns_dnstapcounter_drop = 1, dns_dnstapcounter_max = 2 }; #define DNS_STATS_NCOUNTERS 8 #if 0 /*%< * Flag(s) for dns_xxxstats_dump(). DNS_STATSDUMP_VERBOSE is obsolete. * ISC_STATSDUMP_VERBOSE should be used instead. These two values are * intentionally defined to be the same value to ensure binary compatibility. */ #define DNS_STATSDUMP_VERBOSE 0x00000001 /*%< dump 0-value counters */ #endif /*%< * (Obsoleted) */ LIBDNS_EXTERNAL_DATA extern const char *dns_statscounter_names[]; /*% * Attributes for statistics counters of RRset and Rdatatype types. * * _OTHERTYPE * The rdata type is not explicitly supported and the corresponding counter * is counted for other such types, too. When this attribute is set, * the base type is of no use. * * _NXRRSET * RRset type counters only. Indicates the RRset is non existent. * * _NXDOMAIN * RRset type counters only. Indicates a non existent name. When this * attribute is set, the base type is of no use. * * _STALE * RRset type counters only. This indicates a record that marked for * removal. * * Note: incrementing _STALE will decrement the corresponding non-stale * counter. */ #define DNS_RDATASTATSTYPE_ATTR_OTHERTYPE 0x0001 #define DNS_RDATASTATSTYPE_ATTR_NXRRSET 0x0002 #define DNS_RDATASTATSTYPE_ATTR_NXDOMAIN 0x0004 #define DNS_RDATASTATSTYPE_ATTR_STALE 0x0008 /*%< * Conversion macros among dns_rdatatype_t, attributes and isc_statscounter_t. */ #define DNS_RDATASTATSTYPE_BASE(type) ((dns_rdatatype_t)((type) & 0xFFFF)) #define DNS_RDATASTATSTYPE_ATTR(type) ((type) >> 16) #define DNS_RDATASTATSTYPE_VALUE(b, a) (((a) << 16) | (b)) /*%< * Types of dump callbacks. */ typedef void (*dns_generalstats_dumper_t)(isc_statscounter_t, isc_uint64_t, void *); typedef void (*dns_rdatatypestats_dumper_t)(dns_rdatastatstype_t, isc_uint64_t, void *); typedef void (*dns_opcodestats_dumper_t)(dns_opcode_t, isc_uint64_t, void *); typedef void (*dns_rcodestats_dumper_t)(dns_rcode_t, isc_uint64_t, void *); ISC_LANG_BEGINDECLS isc_result_t dns_generalstats_create(isc_mem_t *mctx, dns_stats_t **statsp, int ncounters); /*%< * Create a statistics counter structure of general type. It counts a general * set of counters indexed by an ID between 0 and ncounters -1. * This function is obsolete. A more general function, isc_stats_create(), * should be used. * * Requires: *\li 'mctx' must be a valid memory context. * *\li 'statsp' != NULL && '*statsp' == NULL. * * Returns: *\li ISC_R_SUCCESS -- all ok * *\li anything else -- failure */ isc_result_t dns_rdatatypestats_create(isc_mem_t *mctx, dns_stats_t **statsp); /*%< * Create a statistics counter structure per rdatatype. * * Requires: *\li 'mctx' must be a valid memory context. * *\li 'statsp' != NULL && '*statsp' == NULL. * * Returns: *\li ISC_R_SUCCESS -- all ok * *\li anything else -- failure */ isc_result_t dns_rdatasetstats_create(isc_mem_t *mctx, dns_stats_t **statsp); /*%< * Create a statistics counter structure per RRset. * * Requires: *\li 'mctx' must be a valid memory context. * *\li 'statsp' != NULL && '*statsp' == NULL. * * Returns: *\li ISC_R_SUCCESS -- all ok * *\li anything else -- failure */ isc_result_t dns_opcodestats_create(isc_mem_t *mctx, dns_stats_t **statsp); /*%< * Create a statistics counter structure per opcode. * * Requires: *\li 'mctx' must be a valid memory context. * *\li 'statsp' != NULL && '*statsp' == NULL. * * Returns: *\li ISC_R_SUCCESS -- all ok * *\li anything else -- failure */ isc_result_t dns_rcodestats_create(isc_mem_t *mctx, dns_stats_t **statsp); /*%< * Create a statistics counter structure per assigned rcode. * * Requires: *\li 'mctx' must be a valid memory context. * *\li 'statsp' != NULL && '*statsp' == NULL. * * Returns: *\li ISC_R_SUCCESS -- all ok * *\li anything else -- failure */ void dns_stats_attach(dns_stats_t *stats, dns_stats_t **statsp); /*%< * Attach to a statistics set. * * Requires: *\li 'stats' is a valid dns_stats_t. * *\li 'statsp' != NULL && '*statsp' == NULL */ void dns_stats_detach(dns_stats_t **statsp); /*%< * Detaches from the statistics set. * * Requires: *\li 'statsp' != NULL and '*statsp' is a valid dns_stats_t. */ void dns_generalstats_increment(dns_stats_t *stats, isc_statscounter_t counter); /*%< * Increment the counter-th counter of stats. This function is obsolete. * A more general function, isc_stats_increment(), should be used. * * Requires: *\li 'stats' is a valid dns_stats_t created by dns_generalstats_create(). * *\li counter is less than the maximum available ID for the stats specified * on creation. */ void dns_rdatatypestats_increment(dns_stats_t *stats, dns_rdatatype_t type); /*%< * Increment the statistics counter for 'type'. * * Requires: *\li 'stats' is a valid dns_stats_t created by dns_rdatatypestats_create(). */ void dns_rdatasetstats_increment(dns_stats_t *stats, dns_rdatastatstype_t rrsettype); /*%< * Increment the statistics counter for 'rrsettype'. * * Note: if 'rrsettype' has the _STALE attribute set the corresponding * non-stale counter will be decremented. * * Requires: *\li 'stats' is a valid dns_stats_t created by dns_rdatasetstats_create(). */ void dns_rdatasetstats_decrement(dns_stats_t *stats, dns_rdatastatstype_t rrsettype); /*%< * Decrement the statistics counter for 'rrsettype'. * * Requires: *\li 'stats' is a valid dns_stats_t created by dns_rdatasetstats_create(). */ void dns_opcodestats_increment(dns_stats_t *stats, dns_opcode_t code); /*%< * Increment the statistics counter for 'code'. * * Requires: *\li 'stats' is a valid dns_stats_t created by dns_opcodestats_create(). */ void dns_rcodestats_increment(dns_stats_t *stats, dns_opcode_t code); /*%< * Increment the statistics counter for 'code'. * * Requires: *\li 'stats' is a valid dns_stats_t created by dns_rcodestats_create(). */ void dns_generalstats_dump(dns_stats_t *stats, dns_generalstats_dumper_t dump_fn, void *arg, unsigned int options); /*%< * Dump the current statistics counters in a specified way. For each counter * in stats, dump_fn is called with its current value and the given argument * arg. By default counters that have a value of 0 is skipped; if options has * the ISC_STATSDUMP_VERBOSE flag, even such counters are dumped. * * This function is obsolete. A more general function, isc_stats_dump(), * should be used. * * Requires: *\li 'stats' is a valid dns_stats_t created by dns_generalstats_create(). */ void dns_rdatatypestats_dump(dns_stats_t *stats, dns_rdatatypestats_dumper_t dump_fn, void *arg, unsigned int options); /*%< * Dump the current statistics counters in a specified way. For each counter * in stats, dump_fn is called with the corresponding type in the form of * dns_rdatastatstype_t, the current counter value and the given argument * arg. By default counters that have a value of 0 is skipped; if options has * the ISC_STATSDUMP_VERBOSE flag, even such counters are dumped. * * Requires: *\li 'stats' is a valid dns_stats_t created by dns_generalstats_create(). */ void dns_rdatasetstats_dump(dns_stats_t *stats, dns_rdatatypestats_dumper_t dump_fn, void *arg, unsigned int options); /*%< * Dump the current statistics counters in a specified way. For each counter * in stats, dump_fn is called with the corresponding type in the form of * dns_rdatastatstype_t, the current counter value and the given argument * arg. By default counters that have a value of 0 is skipped; if options has * the ISC_STATSDUMP_VERBOSE flag, even such counters are dumped. * * Requires: *\li 'stats' is a valid dns_stats_t created by dns_generalstats_create(). */ void dns_opcodestats_dump(dns_stats_t *stats, dns_opcodestats_dumper_t dump_fn, void *arg, unsigned int options); /*%< * Dump the current statistics counters in a specified way. For each counter * in stats, dump_fn is called with the corresponding opcode, the current * counter value and the given argument arg. By default counters that have a * value of 0 is skipped; if options has the ISC_STATSDUMP_VERBOSE flag, even * such counters are dumped. * * Requires: *\li 'stats' is a valid dns_stats_t created by dns_generalstats_create(). */ void dns_rcodestats_dump(dns_stats_t *stats, dns_rcodestats_dumper_t dump_fn, void *arg, unsigned int options); /*%< * Dump the current statistics counters in a specified way. For each counter * in stats, dump_fn is called with the corresponding rcode, the current * counter value and the given argument arg. By default counters that have a * value of 0 is skipped; if options has the ISC_STATSDUMP_VERBOSE flag, even * such counters are dumped. * * Requires: *\li 'stats' is a valid dns_stats_t created by dns_generalstats_create(). */ isc_result_t dns_stats_alloccounters(isc_mem_t *mctx, isc_uint64_t **ctrp); /*%< * Allocate an array of query statistics counters from the memory * context 'mctx'. * * This function is obsoleted. Use dns_xxxstats_create() instead. */ void dns_stats_freecounters(isc_mem_t *mctx, isc_uint64_t **ctrp); /*%< * Free an array of query statistics counters allocated from the memory * context 'mctx'. * * This function is obsoleted. Use dns_stats_destroy() instead. */ ISC_LANG_ENDDECLS #endif /* DNS_STATS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/rdatasetiter.h����������������������������������������������������������������������������0000644�����������������00000007525�14763166026�0011225 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_RDATASETITER_H #define DNS_RDATASETITER_H 1 /***** ***** Module Info *****/ /*! \file dns/rdatasetiter.h * \brief * The DNS Rdataset Iterator interface allows iteration of all of the * rdatasets at a node. * * The dns_rdatasetiter_t type is like a "virtual class". To actually use * it, an implementation of the class is required. This implementation is * supplied by the database. * * It is the client's responsibility to call dns_rdataset_disassociate() * on all rdatasets returned. * * XXX more XXX * * MP: *\li The iterator itself is not locked. The caller must ensure * synchronization. * *\li The iterator methods ensure appropriate database locking. * * Reliability: *\li No anticipated impact. * * Resources: *\li TBS * * Security: *\li No anticipated impact. * * Standards: *\li None. */ /***** ***** Imports *****/ #include <isc/lang.h> #include <isc/magic.h> #include <isc/stdtime.h> #include <dns/types.h> ISC_LANG_BEGINDECLS /***** ***** Types *****/ typedef struct dns_rdatasetitermethods { void (*destroy)(dns_rdatasetiter_t **iteratorp); isc_result_t (*first)(dns_rdatasetiter_t *iterator); isc_result_t (*next)(dns_rdatasetiter_t *iterator); void (*current)(dns_rdatasetiter_t *iterator, dns_rdataset_t *rdataset); } dns_rdatasetitermethods_t; #define DNS_RDATASETITER_MAGIC ISC_MAGIC('D','N','S','i') #define DNS_RDATASETITER_VALID(i) ISC_MAGIC_VALID(i, DNS_RDATASETITER_MAGIC) /*% * This structure is actually just the common prefix of a DNS db * implementation's version of a dns_rdatasetiter_t. * \brief * Direct use of this structure by clients is forbidden. DB implementations * may change the structure. 'magic' must be #DNS_RDATASETITER_MAGIC for * any of the dns_rdatasetiter routines to work. DB implementations must * maintain all DB rdataset iterator invariants. */ struct dns_rdatasetiter { /* Unlocked. */ unsigned int magic; dns_rdatasetitermethods_t * methods; dns_db_t * db; dns_dbnode_t * node; dns_dbversion_t * version; isc_stdtime_t now; }; void dns_rdatasetiter_destroy(dns_rdatasetiter_t **iteratorp); /*%< * Destroy '*iteratorp'. * * Requires: * *\li '*iteratorp' is a valid iterator. * * Ensures: * *\li All resources used by the iterator are freed. * *\li *iteratorp == NULL. */ isc_result_t dns_rdatasetiter_first(dns_rdatasetiter_t *iterator); /*%< * Move the rdataset cursor to the first rdataset at the node (if any). * * Requires: *\li 'iterator' is a valid iterator. * * Returns: *\li ISC_R_SUCCESS *\li ISC_R_NOMORE There are no rdatasets at the node. * *\li Other results are possible, depending on the DB implementation. */ isc_result_t dns_rdatasetiter_next(dns_rdatasetiter_t *iterator); /*%< * Move the rdataset cursor to the next rdataset at the node (if any). * * Requires: *\li 'iterator' is a valid iterator. * * Returns: *\li ISC_R_SUCCESS *\li ISC_R_NOMORE There are no more rdatasets at the * node. * *\li Other results are possible, depending on the DB implementation. */ void dns_rdatasetiter_current(dns_rdatasetiter_t *iterator, dns_rdataset_t *rdataset); /*%< * Return the current rdataset. * * Requires: *\li 'iterator' is a valid iterator. * *\li 'rdataset' is a valid, disassociated rdataset. * *\li The rdataset cursor of 'iterator' is at a valid location (i.e. the * result of last call to a cursor movement command was #ISC_R_SUCCESS). */ ISC_LANG_ENDDECLS #endif /* DNS_RDATASETITER_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/rriterator.h������������������������������������������������������������������������������0000644�����������������00000010260�14763166026�0010715 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: rriterator.h,v 1.4 2011/11/01 23:47:00 tbox Exp $ */ #ifndef DNS_RRITERATOR_H #define DNS_RRITERATOR_H 1 /***** ***** Module Info *****/ /*! \file dns/rriterator.h * \brief * Functions for "walking" a zone database, visiting each RR or RRset in turn. */ /***** ***** Imports *****/ #include <isc/lang.h> #include <isc/magic.h> #include <isc/ondestroy.h> #include <isc/stdtime.h> #include <dns/db.h> #include <dns/dbiterator.h> #include <dns/fixedname.h> #include <dns/name.h> #include <dns/rdata.h> #include <dns/rdataset.h> #include <dns/rdatasetiter.h> #include <dns/types.h> ISC_LANG_BEGINDECLS /***** ***** Types *****/ /*% * A dns_rriterator_t is an iterator that iterates over an entire database, * returning one RR at a time, in some arbitrary order. */ typedef struct dns_rriterator { unsigned int magic; isc_result_t result; dns_db_t *db; dns_dbiterator_t *dbit; dns_dbversion_t *ver; isc_stdtime_t now; dns_dbnode_t *node; dns_fixedname_t fixedname; dns_rdatasetiter_t *rdatasetit; dns_rdataset_t rdataset; dns_rdata_t rdata; } dns_rriterator_t; #define RRITERATOR_MAGIC ISC_MAGIC('R', 'R', 'I', 't') #define VALID_RRITERATOR(m) ISC_MAGIC_VALID(m, RRITERATOR_MAGIC) isc_result_t dns_rriterator_init(dns_rriterator_t *it, dns_db_t *db, dns_dbversion_t *ver, isc_stdtime_t now); /*% * Initialize an rriterator; sets the cursor to the origin node * of the database. * * Requires: * * \li 'db' is a valid database. * * Returns: * * \li #ISC_R_SUCCESS * \li #ISC_R_NOMEMORY */ isc_result_t dns_rriterator_first(dns_rriterator_t *it); /*%< * Move the rriterator cursor to the first rdata in the database. * * Requires: *\li 'it' is a valid, initialized rriterator * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMORE There are no rdata in the set. */ isc_result_t dns_rriterator_nextrrset(dns_rriterator_t *it); /*%< * Move the rriterator cursor to the next rrset in the database, * skipping over any remaining records that have the same rdatatype * as the current one. * * Requires: *\li 'it' is a valid, initialized rriterator * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMORE No more rrsets in the database */ isc_result_t dns_rriterator_next(dns_rriterator_t *it); /*%< * Move the rriterator cursor to the next rrset in the database, * skipping over any remaining records that have the same rdatatype * as the current one. * * Requires: *\li 'it' is a valid, initialized rriterator * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMORE No more records in the database */ void dns_rriterator_current(dns_rriterator_t *it, dns_name_t **name, isc_uint32_t *ttl, dns_rdataset_t **rdataset, dns_rdata_t **rdata); /*%< * Make '*name' refer to the current name. If 'rdataset' is not NULL, * make '*rdataset' refer to the current * rdataset. If '*rdata' is not * NULL, make '*rdata' refer to the current record. * * Requires: *\li '*name' is a valid name object *\li 'rdataset' is NULL or '*rdataset' is NULL *\li 'rdata' is NULL or '*rdata' is NULL * * Ensures: *\li 'rdata' refers to the rdata at the rdata cursor location of *\li 'rdataset'. */ void dns_rriterator_pause(dns_rriterator_t *it); /*%< * Pause rriterator. Frees any locks held by the database iterator. * Callers should use this routine any time they are not going to * execute another rriterator method in the immediate future. * * Requires: *\li 'it' is a valid iterator. * * Ensures: *\li Any database locks being held for efficiency of iterator access are * released. */ void dns_rriterator_destroy(dns_rriterator_t *it); /*%< * Shut down and free resources in rriterator 'it'. * * Requires: * *\li 'it' is a valid iterator. * * Ensures: * *\li All resources used by the rriterator are freed. */ ISC_LANG_ENDDECLS #endif /* DNS_RRITERATOR_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/badcache.h��������������������������������������������������������������������������������0000644�����������������00000006442�14763166026�0010241 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_BADCACHE_H #define DNS_BADCACHE_H 1 /***** ***** Module Info *****/ /*! \file dns/badcache.h * \brief * Defines dns_badcache_t, the "bad cache" object. * * Notes: *\li A bad cache object is a hash table of name/type tuples, * indicating whether a given tuple known to be "bad" in some * sense (e.g., queries for that name and type have been * returning SERVFAIL). This is used for both the "bad server * cache" in the resolver and for the "servfail cache" in * the view. * * Reliability: * * Resources: * * Security: * * Standards: */ /*** *** Imports ***/ #include <dns/types.h> ISC_LANG_BEGINDECLS /*** *** Functions ***/ isc_result_t dns_badcache_init(isc_mem_t *mctx, unsigned int size, dns_badcache_t **bcp); /*% * Allocate and initialize a badcache and store it in '*bcp'. * * Requires: * \li mctx != NULL * \li bcp != NULL * \li *bcp == NULL */ void dns_badcache_destroy(dns_badcache_t **bcp); /*% * Flush and then free badcache in 'bcp'. '*bcp' is set to NULL on return. * * Requires: * \li '*bcp' to be a valid badcache */ void dns_badcache_add(dns_badcache_t *bc, dns_name_t *name, dns_rdatatype_t type, isc_boolean_t update, isc_uint32_t flags, isc_time_t *expire); /*% * Adds a badcache entry to the badcache 'bc' for name 'name' and * type 'type'. If an entry already exists, then it will be updated if * 'update' is ISC_TRUE. The entry will be stored with flags 'flags' * and expiration date 'expire'. * * Requires: * \li bc to be a valid badcache. * \li name != NULL * \li expire != NULL */ isc_boolean_t dns_badcache_find(dns_badcache_t *bc, dns_name_t *name, dns_rdatatype_t type, isc_uint32_t *flagp, isc_time_t *now); /*% * Returns ISC_TRUE if a record is found in the badcache 'bc' matching * 'name' and 'type', with an expiration date later than 'now'. * If 'flagp' is not NULL, then '*flagp' is updated to the flags * that were stored in the badcache entry. Returns ISC_FALSE if * no matching record is found. * * Requires: * \li bc to be a valid badcache. * \li name != NULL * \li now != NULL */ void dns_badcache_flush(dns_badcache_t *bc); /*% * Flush the entire bad cache. * * Requires: * \li bc to be a valid badcache */ void dns_badcache_flushname(dns_badcache_t *bc, dns_name_t *name); /*% * Flush the bad cache of all entries at 'name'. * * Requires: * \li bc to be a valid badcache * \li name != NULL */ void dns_badcache_flushtree(dns_badcache_t *bc, dns_name_t *name); /*% * Flush the bad cache of all entries at or below 'name'. * * Requires: * \li bc to be a valid badcache * \li name != NULL */ void dns_badcache_print(dns_badcache_t *bc, const char *cachename, FILE *fp); /*% * Print the contents of badcache 'bc' (headed by the title 'cachename') * to file pointer 'fp'. * * Requires: * \li bc to be a valid badcache * \li cachename != NULL * \li fp != NULL */ ISC_LANG_ENDDECLS #endif /* DNS_BADCACHE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/rdataset.h��������������������������������������������������������������������������������0000644�����������������00000050742�14763166026�0010340 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_RDATASET_H #define DNS_RDATASET_H 1 /***** ***** Module Info *****/ /*! \file dns/rdataset.h * \brief * A DNS rdataset is a handle that can be associated with a collection of * rdata all having a common owner name, class, and type. * * The dns_rdataset_t type is like a "virtual class". To actually use * rdatasets, an implementation of the method suite (e.g. "slabbed rdata") is * required. * * XXX <more> XXX * * MP: *\li Clients of this module must impose any required synchronization. * * Reliability: *\li No anticipated impact. * * Resources: *\li TBS * * Security: *\li No anticipated impact. * * Standards: *\li None. */ #include <isc/lang.h> #include <isc/magic.h> #include <isc/stdtime.h> #include <dns/types.h> #include <dns/rdatastruct.h> ISC_LANG_BEGINDECLS typedef enum { dns_rdatasetadditional_fromauth, dns_rdatasetadditional_fromcache, dns_rdatasetadditional_fromglue } dns_rdatasetadditional_t; typedef struct dns_rdatasetmethods { void (*disassociate)(dns_rdataset_t *rdataset); isc_result_t (*first)(dns_rdataset_t *rdataset); isc_result_t (*next)(dns_rdataset_t *rdataset); void (*current)(dns_rdataset_t *rdataset, dns_rdata_t *rdata); void (*clone)(dns_rdataset_t *source, dns_rdataset_t *target); unsigned int (*count)(dns_rdataset_t *rdataset); isc_result_t (*addnoqname)(dns_rdataset_t *rdataset, dns_name_t *name); isc_result_t (*getnoqname)(dns_rdataset_t *rdataset, dns_name_t *name, dns_rdataset_t *neg, dns_rdataset_t *negsig); isc_result_t (*addclosest)(dns_rdataset_t *rdataset, dns_name_t *name); isc_result_t (*getclosest)(dns_rdataset_t *rdataset, dns_name_t *name, dns_rdataset_t *neg, dns_rdataset_t *negsig); isc_result_t (*getadditional)(dns_rdataset_t *rdataset, dns_rdatasetadditional_t type, dns_rdatatype_t qtype, dns_acache_t *acache, dns_zone_t **zonep, dns_db_t **dbp, dns_dbversion_t **versionp, dns_dbnode_t **nodep, dns_name_t *fname, dns_message_t *msg, isc_stdtime_t now); isc_result_t (*setadditional)(dns_rdataset_t *rdataset, dns_rdatasetadditional_t type, dns_rdatatype_t qtype, dns_acache_t *acache, dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, dns_name_t *fname); isc_result_t (*putadditional)(dns_acache_t *acache, dns_rdataset_t *rdataset, dns_rdatasetadditional_t type, dns_rdatatype_t qtype); void (*settrust)(dns_rdataset_t *rdataset, dns_trust_t trust); void (*expire)(dns_rdataset_t *rdataset); void (*clearprefetch)(dns_rdataset_t *rdataset); void (*setownercase)(dns_rdataset_t *rdataset, const dns_name_t *name); void (*getownercase)(const dns_rdataset_t *rdataset, dns_name_t *name); } dns_rdatasetmethods_t; #define DNS_RDATASET_MAGIC ISC_MAGIC('D','N','S','R') #define DNS_RDATASET_VALID(set) ISC_MAGIC_VALID(set, DNS_RDATASET_MAGIC) /*% * Direct use of this structure by clients is strongly discouraged, except * for the 'link' field which may be used however the client wishes. The * 'private', 'current', and 'index' fields MUST NOT be changed by clients. * rdataset implementations may change any of the fields. */ struct dns_rdataset { unsigned int magic; /* XXX ? */ dns_rdatasetmethods_t * methods; ISC_LINK(dns_rdataset_t) link; /* * XXX do we need these, or should they be retrieved by methods? * Leaning towards the latter, since they are not frequently required * once you have the rdataset. */ dns_rdataclass_t rdclass; dns_rdatatype_t type; dns_ttl_t ttl; dns_trust_t trust; dns_rdatatype_t covers; /* * attributes */ unsigned int attributes; /*% * the counter provides the starting point in the "cyclic" order. * The value ISC_UINT32_MAX has a special meaning of "picking up a * random value." in order to take care of databases that do not * increment the counter. */ isc_uint32_t count; /* * This RRSIG RRset should be re-generated around this time. * Only valid if DNS_RDATASETATTR_RESIGN is set in attributes. */ isc_stdtime_t resign; /*@{*/ /*% * These are for use by the rdataset implementation, and MUST NOT * be changed by clients. */ void * private1; void * private2; void * private3; unsigned int privateuint4; void * private5; void * private6; void * private7; /*@}*/ }; /*! * \def DNS_RDATASETATTR_RENDERED * Used by message.c to indicate that the rdataset was rendered. * * \def DNS_RDATASETATTR_TTLADJUSTED * Used by message.c to indicate that the rdataset's rdata had differing * TTL values, and the rdataset->ttl holds the smallest. * * \def DNS_RDATASETATTR_LOADORDER * Output the RRset in load order. */ #define DNS_RDATASETATTR_QUESTION 0x00000001 #define DNS_RDATASETATTR_RENDERED 0x00000002 /*%< Used by message.c */ #define DNS_RDATASETATTR_ANSWERED 0x00000004 /*%< Used by server. */ #define DNS_RDATASETATTR_CACHE 0x00000008 /*%< Used by resolver. */ #define DNS_RDATASETATTR_ANSWER 0x00000010 /*%< Used by resolver. */ #define DNS_RDATASETATTR_ANSWERSIG 0x00000020 /*%< Used by resolver. */ #define DNS_RDATASETATTR_EXTERNAL 0x00000040 /*%< Used by resolver. */ #define DNS_RDATASETATTR_NCACHE 0x00000080 /*%< Used by resolver. */ #define DNS_RDATASETATTR_CHAINING 0x00000100 /*%< Used by resolver. */ #define DNS_RDATASETATTR_TTLADJUSTED 0x00000200 /*%< Used by message.c */ #define DNS_RDATASETATTR_FIXEDORDER 0x00000400 #define DNS_RDATASETATTR_RANDOMIZE 0x00000800 #define DNS_RDATASETATTR_CHASE 0x00001000 /*%< Used by resolver. */ #define DNS_RDATASETATTR_NXDOMAIN 0x00002000 #define DNS_RDATASETATTR_NOQNAME 0x00004000 #define DNS_RDATASETATTR_CHECKNAMES 0x00008000 /*%< Used by resolver. */ #define DNS_RDATASETATTR_REQUIRED 0x00010000 #define DNS_RDATASETATTR_REQUIREDGLUE DNS_RDATASETATTR_REQUIRED #define DNS_RDATASETATTR_LOADORDER 0x00020000 #define DNS_RDATASETATTR_RESIGN 0x00040000 #define DNS_RDATASETATTR_CLOSEST 0x00080000 #define DNS_RDATASETATTR_OPTOUT 0x00100000 /*%< OPTOUT proof */ #define DNS_RDATASETATTR_NEGATIVE 0x00200000 #define DNS_RDATASETATTR_PREFETCH 0x00400000 /*% * _OMITDNSSEC: * Omit DNSSEC records when rendering ncache records. */ #define DNS_RDATASETTOWIRE_OMITDNSSEC 0x0001 void dns_rdataset_init(dns_rdataset_t *rdataset); /*%< * Make 'rdataset' a valid, disassociated rdataset. * * Requires: *\li 'rdataset' is not NULL. * * Ensures: *\li 'rdataset' is a valid, disassociated rdataset. */ void dns_rdataset_invalidate(dns_rdataset_t *rdataset); /*%< * Invalidate 'rdataset'. * * Requires: *\li 'rdataset' is a valid, disassociated rdataset. * * Ensures: *\li If assertion checking is enabled, future attempts to use 'rdataset' * without initializing it will cause an assertion failure. */ void dns_rdataset_disassociate(dns_rdataset_t *rdataset); /*%< * Disassociate 'rdataset' from its rdata, allowing it to be reused. * * Notes: *\li The client must ensure it has no references to rdata in the rdataset * before disassociating. * * Requires: *\li 'rdataset' is a valid, associated rdataset. * * Ensures: *\li 'rdataset' is a valid, disassociated rdataset. */ isc_boolean_t dns_rdataset_isassociated(dns_rdataset_t *rdataset); /*%< * Is 'rdataset' associated? * * Requires: *\li 'rdataset' is a valid rdataset. * * Returns: *\li #ISC_TRUE 'rdataset' is associated. *\li #ISC_FALSE 'rdataset' is not associated. */ void dns_rdataset_makequestion(dns_rdataset_t *rdataset, dns_rdataclass_t rdclass, dns_rdatatype_t type); /*%< * Make 'rdataset' a valid, associated, question rdataset, with a * question class of 'rdclass' and type 'type'. * * Notes: *\li Question rdatasets have a class and type, but no rdata. * * Requires: *\li 'rdataset' is a valid, disassociated rdataset. * * Ensures: *\li 'rdataset' is a valid, associated, question rdataset. */ void dns_rdataset_clone(dns_rdataset_t *source, dns_rdataset_t *target); /*%< * Make 'target' refer to the same rdataset as 'source'. * * Requires: *\li 'source' is a valid, associated rdataset. * *\li 'target' is a valid, dissociated rdataset. * * Ensures: *\li 'target' references the same rdataset as 'source'. */ unsigned int dns_rdataset_count(dns_rdataset_t *rdataset); /*%< * Return the number of records in 'rdataset'. * * Requires: *\li 'rdataset' is a valid, associated rdataset. * * Returns: *\li The number of records in 'rdataset'. */ isc_result_t dns_rdataset_first(dns_rdataset_t *rdataset); /*%< * Move the rdata cursor to the first rdata in the rdataset (if any). * * Requires: *\li 'rdataset' is a valid, associated rdataset. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMORE There are no rdata in the set. */ isc_result_t dns_rdataset_next(dns_rdataset_t *rdataset); /*%< * Move the rdata cursor to the next rdata in the rdataset (if any). * * Requires: *\li 'rdataset' is a valid, associated rdataset. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMORE There are no more rdata in the set. */ void dns_rdataset_current(dns_rdataset_t *rdataset, dns_rdata_t *rdata); /*%< * Make 'rdata' refer to the current rdata. * * Notes: * *\li The data returned in 'rdata' is valid for the life of the * rdataset; in particular, subsequent changes in the cursor position * do not invalidate 'rdata'. * * Requires: *\li 'rdataset' is a valid, associated rdataset. * *\li The rdata cursor of 'rdataset' is at a valid location (i.e. the * result of last call to a cursor movement command was ISC_R_SUCCESS). * * Ensures: *\li 'rdata' refers to the rdata at the rdata cursor location of *\li 'rdataset'. */ isc_result_t dns_rdataset_totext(dns_rdataset_t *rdataset, dns_name_t *owner_name, isc_boolean_t omit_final_dot, isc_boolean_t question, isc_buffer_t *target); /*%< * Convert 'rdataset' to text format, storing the result in 'target'. * * Notes: *\li The rdata cursor position will be changed. * *\li The 'question' flag should normally be #ISC_FALSE. If it is * #ISC_TRUE, the TTL and rdata fields are not printed. This is * for use when printing an rdata representing a question section. * *\li This interface is deprecated; use dns_master_rdatasettottext() * and/or dns_master_questiontotext() instead. * * Requires: *\li 'rdataset' is a valid rdataset. * *\li 'rdataset' is not empty. */ isc_result_t dns_rdataset_towire(dns_rdataset_t *rdataset, dns_name_t *owner_name, dns_compress_t *cctx, isc_buffer_t *target, unsigned int options, unsigned int *countp); /*%< * Convert 'rdataset' to wire format, compressing names as specified * in 'cctx', and storing the result in 'target'. * * Notes: *\li The rdata cursor position will be changed. * *\li The number of RRs added to target will be added to *countp. * * Requires: *\li 'rdataset' is a valid rdataset. * *\li 'rdataset' is not empty. * *\li 'countp' is a valid pointer. * * Ensures: *\li On a return of ISC_R_SUCCESS, 'target' contains a wire format * for the data contained in 'rdataset'. Any error return leaves * the buffer unchanged. * *\li *countp has been incremented by the number of RRs added to * target. * * Returns: *\li #ISC_R_SUCCESS - all ok *\li #ISC_R_NOSPACE - 'target' doesn't have enough room * *\li Any error returned by dns_rdata_towire(), dns_rdataset_next(), * dns_name_towire(). */ isc_result_t dns_rdataset_towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name, dns_compress_t *cctx, isc_buffer_t *target, dns_rdatasetorderfunc_t order, const void *order_arg, unsigned int options, unsigned int *countp); /*%< * Like dns_rdataset_towire(), but sorting the rdatasets according to * the integer value returned by 'order' when called with the rdataset * and 'order_arg' as arguments. * * Requires: *\li All the requirements of dns_rdataset_towire(), and * that order_arg is NULL if and only if order is NULL. */ isc_result_t dns_rdataset_towirepartial(dns_rdataset_t *rdataset, const dns_name_t *owner_name, dns_compress_t *cctx, isc_buffer_t *target, dns_rdatasetorderfunc_t order, const void *order_arg, unsigned int options, unsigned int *countp, void **state); /*%< * Like dns_rdataset_towiresorted() except that a partial rdataset * may be written. * * Requires: *\li All the requirements of dns_rdataset_towiresorted(). * If 'state' is non NULL then the current position in the * rdataset will be remembered if the rdataset in not * completely written and should be passed on on subsequent * calls (NOT CURRENTLY IMPLEMENTED). * * Returns: *\li #ISC_R_SUCCESS if all of the records were written. *\li #ISC_R_NOSPACE if unable to fit in all of the records. *countp * will be updated to reflect the number of records * written. */ isc_result_t dns_rdataset_additionaldata(dns_rdataset_t *rdataset, dns_additionaldatafunc_t add, void *arg); /*%< * For each rdata in rdataset, call 'add' for each name and type in the * rdata which is subject to additional section processing. * * Requires: * *\li 'rdataset' is a valid, non-question rdataset. * *\li 'add' is a valid dns_additionaldatafunc_t * * Ensures: * *\li If successful, dns_rdata_additionaldata() will have been called for * each rdata in 'rdataset'. * *\li If a call to dns_rdata_additionaldata() is not successful, the * result returned will be the result of dns_rdataset_additionaldata(). * * Returns: * *\li #ISC_R_SUCCESS * *\li Any error that dns_rdata_additionaldata() can return. */ isc_result_t dns_rdataset_getnoqname(dns_rdataset_t *rdataset, dns_name_t *name, dns_rdataset_t *neg, dns_rdataset_t *negsig); /*%< * Return the noqname proof for this record. * * Requires: *\li 'rdataset' to be valid and #DNS_RDATASETATTR_NOQNAME to be set. *\li 'name' to be valid. *\li 'neg' and 'negsig' to be valid and not associated. */ isc_result_t dns_rdataset_addnoqname(dns_rdataset_t *rdataset, dns_name_t *name); /*%< * Associate a noqname proof with this record. * Sets #DNS_RDATASETATTR_NOQNAME if successful. * Adjusts the 'rdataset->ttl' to minimum of the 'rdataset->ttl' and * the 'nsec'/'nsec3' and 'rrsig(nsec)'/'rrsig(nsec3)' ttl. * * Requires: *\li 'rdataset' to be valid and #DNS_RDATASETATTR_NOQNAME to be set. *\li 'name' to be valid and have NSEC or NSEC3 and associated RRSIG * rdatasets. */ isc_result_t dns_rdataset_getclosest(dns_rdataset_t *rdataset, dns_name_t *name, dns_rdataset_t *nsec, dns_rdataset_t *nsecsig); /*%< * Return the closest encloser for this record. * * Requires: *\li 'rdataset' to be valid and #DNS_RDATASETATTR_CLOSEST to be set. *\li 'name' to be valid. *\li 'nsec' and 'nsecsig' to be valid and not associated. */ isc_result_t dns_rdataset_addclosest(dns_rdataset_t *rdataset, dns_name_t *name); /*%< * Associate a closest encloset proof with this record. * Sets #DNS_RDATASETATTR_CLOSEST if successful. * Adjusts the 'rdataset->ttl' to minimum of the 'rdataset->ttl' and * the 'nsec' and 'rrsig(nsec)' ttl. * * Requires: *\li 'rdataset' to be valid and #DNS_RDATASETATTR_CLOSEST to be set. *\li 'name' to be valid and have NSEC3 and RRSIG(NSEC3) rdatasets. */ isc_result_t dns_rdataset_getadditional(dns_rdataset_t *rdataset, dns_rdatasetadditional_t type, dns_rdatatype_t qtype, dns_acache_t *acache, dns_zone_t **zonep, dns_db_t **dbp, dns_dbversion_t **versionp, dns_dbnode_t **nodep, dns_name_t *fname, dns_message_t *msg, isc_stdtime_t now); /*%< * Get cached additional information from the DB node for a particular * 'rdataset.' 'type' is one of dns_rdatasetadditional_fromauth, * dns_rdatasetadditional_fromcache, and dns_rdatasetadditional_fromglue, * which specifies the origin of the information. 'qtype' is intended to * be used for specifying a particular rdata type in the cached information. * * Requires: * \li 'rdataset' is a valid rdataset. * \li 'acache' can be NULL, in which case this function will simply return * ISC_R_FAILURE. * \li For the other pointers, see dns_acache_getentry(). * * Ensures: * \li See dns_acache_getentry(). * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_FAILURE - additional information caching is not supported. * \li #ISC_R_NOTFOUND - the corresponding DB node has not cached additional * information for 'rdataset.' * \li Any error that dns_acache_getentry() can return. */ isc_result_t dns_rdataset_setadditional(dns_rdataset_t *rdataset, dns_rdatasetadditional_t type, dns_rdatatype_t qtype, dns_acache_t *acache, dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, dns_name_t *fname); /*%< * Set cached additional information to the DB node for a particular * 'rdataset.' See dns_rdataset_getadditional for the semantics of 'type' * and 'qtype'. * * Requires: * \li 'rdataset' is a valid rdataset. * \li 'acache' can be NULL, in which case this function will simply return * ISC_R_FAILURE. * \li For the other pointers, see dns_acache_setentry(). * * Ensures: * \li See dns_acache_setentry(). * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_FAILURE - additional information caching is not supported. * \li #ISC_R_NOMEMORY * \li Any error that dns_acache_setentry() can return. */ isc_result_t dns_rdataset_putadditional(dns_acache_t *acache, dns_rdataset_t *rdataset, dns_rdatasetadditional_t type, dns_rdatatype_t qtype); /*%< * Discard cached additional information stored in the DB node for a particular * 'rdataset.' See dns_rdataset_getadditional for the semantics of 'type' * and 'qtype'. * * Requires: * \li 'rdataset' is a valid rdataset. * \li 'acache' can be NULL, in which case this function will simply return * ISC_R_FAILURE. * * Ensures: * \li See dns_acache_cancelentry(). * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_FAILURE - additional information caching is not supported. * \li #ISC_R_NOTFOUND - the corresponding DB node has not cached additional * information for 'rdataset.' */ void dns_rdataset_settrust(dns_rdataset_t *rdataset, dns_trust_t trust); /*%< * Set the trust of the 'rdataset' to trust in any in the backing database. * The local trust level of 'rdataset' is also set. */ void dns_rdataset_expire(dns_rdataset_t *rdataset); /*%< * Mark the rdataset to be expired in the backing database. */ void dns_rdataset_clearprefetch(dns_rdataset_t *rdataset); /*%< * Clear the PREFETCH attribute for the given rdataset in the * underlying database. * * In the cache database, this signals that the rdataset is not * eligible to be prefetched when the TTL is close to expiring. * It has no function in other databases. */ void dns_rdataset_setownercase(dns_rdataset_t *rdataset, const dns_name_t *name); /*%< * Store the casing of 'name', the owner name of 'rdataset', into * a bitfield so that the name can be capitalized the same when when * the rdataset is used later. This sets the CASESET attribute. */ void dns_rdataset_getownercase(const dns_rdataset_t *rdataset, dns_name_t *name); /*%< * If the CASESET attribute is set, retrieve the case bitfield that was * previously stored by dns_rdataset_getownername(), and capitalize 'name' * according to it. If CASESET is not set, do nothing. */ void dns_rdataset_trimttl(dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, dns_rdata_rrsig_t *rrsig, isc_stdtime_t now, isc_boolean_t acceptexpired); /*%< * Trim the ttl of 'rdataset' and 'sigrdataset' so that they will expire * at or before 'rrsig->expiretime'. If 'acceptexpired' is true and the * signature has expired or will expire in the next 120 seconds, limit * the ttl to be no more than 120 seconds. * * The ttl is further limited by the original ttl as stored in 'rrsig' * and the original ttl values of 'rdataset' and 'sigrdataset'. * * Requires: * \li 'rdataset' is a valid rdataset. * \li 'sigrdataset' is a valid rdataset. * \li 'rrsig' is non NULL. */ const char * dns_trust_totext(dns_trust_t trust); /*%< * Display trust in textual form. */ ISC_LANG_ENDDECLS #endif /* DNS_RDATASET_H */ ������������������������������bind9/dns/sdlz.h������������������������������������������������������������������������������������0000644�����������������00000033577�14763166026�0007514 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Portions Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the * above copyright notice and this permission notice appear in all * copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE * USE OR PERFORMANCE OF THIS SOFTWARE. * * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was * conceived and contributed by Rob Butler. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the * above copyright notice and this permission notice appear in all * copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE * USE OR PERFORMANCE OF THIS SOFTWARE. */ /*! \file dns/sdlz.h */ #ifndef SDLZ_H #define SDLZ_H 1 #include <dns/clientinfo.h> #include <dns/dlz.h> ISC_LANG_BEGINDECLS #define DNS_SDLZFLAG_THREADSAFE 0x00000001U #define DNS_SDLZFLAG_RELATIVEOWNER 0x00000002U #define DNS_SDLZFLAG_RELATIVERDATA 0x00000004U /* A simple DLZ database. */ typedef struct dns_sdlz_db dns_sdlz_db_t; /* A simple DLZ database lookup in progress. */ typedef struct dns_sdlzlookup dns_sdlzlookup_t; /* A simple DLZ database traversal in progress. */ typedef struct dns_sdlzallnodes dns_sdlzallnodes_t; typedef isc_result_t (*dns_sdlzallnodesfunc_t)(const char *zone, void *driverarg, void *dbdata, dns_sdlzallnodes_t *allnodes); /*%< * Method prototype. Drivers implementing the SDLZ interface may * supply an all nodes method. This method is called when the DNS * server is performing a zone transfer query, after the allow zone * transfer method has been called. This method is only called if the * allow zone transfer method returned ISC_R_SUCCESS. This method and * the allow zone transfer method are both required for zone transfers * to be supported. If the driver generates data dynamically (instead * of searching in a database for it) it should not implement this * function as a zone transfer would be meaningless. A SDLZ driver * does not have to implement an all nodes method. */ typedef isc_result_t (*dns_sdlzallowzonexfr_t)(void *driverarg, void *dbdata, const char *name, const char *client); /*%< * Method prototype. Drivers implementing the SDLZ interface may * supply an allow zone transfer method. This method is called when * the DNS server is performing a zone transfer query, before the all * nodes method can be called. This method and the all node method * are both required for zone transfers to be supported. If the * driver generates data dynamically (instead of searching in a * database for it) it should not implement this function as a zone * transfer would be meaningless. A SDLZ driver does not have to * implement an allow zone transfer method. * * This method should return ISC_R_SUCCESS if the zone is supported by * the database and a zone transfer is allowed for the specified * client. If the zone is supported by the database, but zone * transfers are not allowed for the specified client this method * should return ISC_R_NOPERM.. Lastly the method should return * ISC_R_NOTFOUND if the zone is not supported by the database. If an * error occurs it should return a result code indicating the type of * error. */ typedef isc_result_t (*dns_sdlzauthorityfunc_t)(const char *zone, void *driverarg, void *dbdata, dns_sdlzlookup_t *lookup); /*%< * Method prototype. Drivers implementing the SDLZ interface may * supply an authority method. This method is called when the DNS * server is performing a query, after both the find zone and lookup * methods have been called. This method is required if the lookup * function does not supply authority information for the dns * record. A SDLZ driver does not have to implement an authority * method. */ typedef isc_result_t (*dns_sdlzcreate_t)(const char *dlzname, unsigned int argc, char *argv[], void *driverarg, void **dbdata); /*%< * Method prototype. Drivers implementing the SDLZ interface may * supply a create method. This method is called when the DNS server * is starting up and creating drivers for use later. A SDLZ driver * does not have to implement a create method. */ typedef void (*dns_sdlzdestroy_t)(void *driverarg, void *dbdata); /*%< * Method prototype. Drivers implementing the SDLZ interface may * supply a destroy method. This method is called when the DNS server * is shutting down and no longer needs the driver. A SDLZ driver does * not have to implement a destroy method. */ typedef isc_result_t (*dns_sdlzfindzone_t)(void *driverarg, void *dbdata, const char *name, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo); /*%< * Method prototype. Drivers implementing the SDLZ interface MUST * supply a find zone method. This method is called when the DNS * server is performing a query to to determine if 'name' is a * supported dns zone. The find zone method will be called with the * longest possible name first, and continue to be called with * successively shorter domain names, until any of the following * occur: * * \li 1) the function returns (ISC_R_SUCCESS) indicating a zone name * match. * * \li 2) a problem occurs, and the functions returns anything other than * (ISC_R_NOTFOUND) * * \li 3) we run out of domain name labels. I.E. we have tried the * shortest domain name * * \li 4) the number of labels in the domain name is less than min_labels * for dns_dlzfindzone * * The driver's find zone method should return ISC_R_SUCCESS if the * zone is supported by the database. Otherwise it should return * ISC_R_NOTFOUND, if the zone is not supported. If an error occurs * it should return a result code indicating the type of error. */ typedef isc_result_t (*dns_sdlzlookupfunc_t)(const char *zone, const char *name, void *driverarg, void *dbdata, dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo); /*%< * Method prototype. Drivers implementing the SDLZ interface MUST * supply a lookup method. This method is called when the * DNS server is performing a query, after the find zone and before any * other methods have been called. This function returns DNS record * information using the dns_sdlz_putrr and dns_sdlz_putsoa functions. * If this function supplies authority information for the DNS record * the authority method is not required. If it does not, the * authority function is required. * * The 'methods' and 'clientinfo' args allow an SDLZ driver to retrieve * information about the querying client (such as source IP address) * from the caller. */ typedef isc_result_t (*dns_sdlznewversion_t)(const char *zone, void *driverarg, void *dbdata, void **versionp); /*%< * Method prototype. Drivers implementing the SDLZ interface may * supply a newversion method. This method is called to start a * write transaction on a zone and should only be implemented by * writeable backends. * When implemented, the driver should create a new transaction, and * fill *versionp with a pointer to the transaction state. The * closeversion function will be called to close the transaction. */ typedef void (*dns_sdlzcloseversion_t)(const char *zone, isc_boolean_t commit, void *driverarg, void *dbdata, void **versionp); /*%< * Method prototype. Drivers implementing the SDLZ interface must * supply a closeversion method if they supply a newversion method. * When implemented, the driver should close the given transaction, * committing changes if 'commit' is ISC_TRUE. If 'commit' is not true * then all changes should be discarded and the database rolled back. * If the call is successful then *versionp should be set to NULL */ typedef isc_result_t (*dns_sdlzconfigure_t)(dns_view_t *view, dns_dlzdb_t *dlzdb, void *driverarg, void *dbdata); /*%< * Method prototype. Drivers implementing the SDLZ interface may * supply a configure method. When supplied, it will be called * immediately after the create method to give the driver a chance * to configure writeable zones */ typedef isc_boolean_t (*dns_sdlzssumatch_t)(const char *signer, const char *name, const char *tcpaddr, const char *type, const char *key, isc_uint32_t keydatalen, unsigned char *keydata, void *driverarg, void *dbdata); /*%< * Method prototype. Drivers implementing the SDLZ interface may * supply a ssumatch method. If supplied, then ssumatch will be * called to authorize any zone updates. The driver should return * ISC_TRUE to allow the update, and ISC_FALSE to deny it. For a DLZ * controlled zone, this is the only access control on updates. */ typedef isc_result_t (*dns_sdlzmodrdataset_t)(const char *name, const char *rdatastr, void *driverarg, void *dbdata, void *version); /*%< * Method prototype. Drivers implementing the SDLZ interface may * supply addrdataset and subtractrdataset methods. If supplied, then these * will be called when rdatasets are added/subtracted during * updates. The version parameter comes from a call to the sdlz * newversion() method from the driver. The rdataset parameter is a * linearise string representation of the rdataset change. The format * is the same as used by dig when displaying records. The fields are * tab delimited. */ typedef isc_result_t (*dns_sdlzdelrdataset_t)(const char *name, const char *type, void *driverarg, void *dbdata, void *version); /*%< * Method prototype. Drivers implementing the SDLZ interface may * supply a delrdataset method. If supplied, then this * function will be called when rdatasets are deleted during * updates. The call should remove all rdatasets of the given type for * the specified name. */ typedef struct dns_sdlzmethods { dns_sdlzcreate_t create; dns_sdlzdestroy_t destroy; dns_sdlzfindzone_t findzone; dns_sdlzlookupfunc_t lookup; dns_sdlzauthorityfunc_t authority; dns_sdlzallnodesfunc_t allnodes; dns_sdlzallowzonexfr_t allowzonexfr; dns_sdlznewversion_t newversion; dns_sdlzcloseversion_t closeversion; dns_sdlzconfigure_t configure; dns_sdlzssumatch_t ssumatch; dns_sdlzmodrdataset_t addrdataset; dns_sdlzmodrdataset_t subtractrdataset; dns_sdlzdelrdataset_t delrdataset; } dns_sdlzmethods_t; isc_result_t dns_sdlzregister(const char *drivername, const dns_sdlzmethods_t *methods, void *driverarg, unsigned int flags, isc_mem_t *mctx, dns_sdlzimplementation_t **sdlzimp); /*%< * Register a dynamically loadable zones (dlz) driver for the database * type 'drivername', implemented by the functions in '*methods'. * * sdlzimp must point to a NULL dns_sdlzimplementation_t pointer. * That is, sdlzimp != NULL && *sdlzimp == NULL. It will be assigned * a value that will later be used to identify the driver when * deregistering it. */ void dns_sdlzunregister(dns_sdlzimplementation_t **sdlzimp); /*%< * Removes the sdlz driver from the list of registered sdlz drivers. * There must be no active sdlz drivers of this type when this * function is called. */ typedef isc_result_t dns_sdlz_putnamedrr_t(dns_sdlzallnodes_t *allnodes, const char *name, const char *type, dns_ttl_t ttl, const char *data); dns_sdlz_putnamedrr_t dns_sdlz_putnamedrr; /*%< * Add a single resource record to the allnodes structure to be later * parsed into a zone transfer response. */ typedef isc_result_t dns_sdlz_putrr_t(dns_sdlzlookup_t *lookup, const char *type, dns_ttl_t ttl, const char *data); dns_sdlz_putrr_t dns_sdlz_putrr; /*%< * Add a single resource record to the lookup structure to be later * parsed into a query response. */ typedef isc_result_t dns_sdlz_putsoa_t(dns_sdlzlookup_t *lookup, const char *mname, const char *rname, isc_uint32_t serial); dns_sdlz_putsoa_t dns_sdlz_putsoa; /*%< * This function may optionally be called from the 'authority' * callback to simplify construction of the SOA record for 'zone'. It * will provide a SOA listing 'mname' as as the master server and * 'rname' as the responsible person mailbox. It is the * responsibility of the driver to increment the serial number between * responses if necessary. All other SOA fields will have reasonable * default values. */ typedef isc_result_t dns_sdlz_setdb_t(dns_dlzdb_t *dlzdatabase, dns_rdataclass_t rdclass, dns_name_t *name, dns_db_t **dbp); dns_sdlz_setdb_t dns_sdlz_setdb; /*%< * Create the database pointers for a writeable SDLZ zone */ ISC_LANG_ENDDECLS #endif /* SDLZ_H */ ���������������������������������������������������������������������������������������������������������������������������������bind9/dns/keyvalues.h�������������������������������������������������������������������������������0000644�����������������00000010076�14763166026�0010535 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_KEYVALUES_H #define DNS_KEYVALUES_H 1 /*! \file dns/keyvalues.h */ /* * Flags field of the KEY RR rdata */ #define DNS_KEYFLAG_TYPEMASK 0xC000 /*%< Mask for "type" bits */ #define DNS_KEYTYPE_AUTHCONF 0x0000 /*%< Key usable for both */ #define DNS_KEYTYPE_CONFONLY 0x8000 /*%< Key usable for confidentiality */ #define DNS_KEYTYPE_AUTHONLY 0x4000 /*%< Key usable for authentication */ #define DNS_KEYTYPE_NOKEY 0xC000 /*%< No key usable for either; no key */ #define DNS_KEYTYPE_NOAUTH DNS_KEYTYPE_CONFONLY #define DNS_KEYTYPE_NOCONF DNS_KEYTYPE_AUTHONLY #define DNS_KEYFLAG_RESERVED2 0x2000 /*%< reserved - must be zero */ #define DNS_KEYFLAG_EXTENDED 0x1000 /*%< key has extended flags */ #define DNS_KEYFLAG_RESERVED4 0x0800 /*%< reserved - must be zero */ #define DNS_KEYFLAG_RESERVED5 0x0400 /*%< reserved - must be zero */ #define DNS_KEYFLAG_OWNERMASK 0x0300 /*%< these bits determine the type */ #define DNS_KEYOWNER_USER 0x0000 /*%< key is assoc. with user */ #define DNS_KEYOWNER_ENTITY 0x0200 /*%< key is assoc. with entity eg host */ #define DNS_KEYOWNER_ZONE 0x0100 /*%< key is zone key */ #define DNS_KEYOWNER_RESERVED 0x0300 /*%< reserved meaning */ #define DNS_KEYFLAG_REVOKE 0x0080 /*%< key revoked (per rfc5011) */ #define DNS_KEYFLAG_RESERVED9 0x0040 /*%< reserved - must be zero */ #define DNS_KEYFLAG_RESERVED10 0x0020 /*%< reserved - must be zero */ #define DNS_KEYFLAG_RESERVED11 0x0010 /*%< reserved - must be zero */ #define DNS_KEYFLAG_SIGNATORYMASK 0x000F /*%< key can sign RR's of same name */ #define DNS_KEYFLAG_RESERVEDMASK (DNS_KEYFLAG_RESERVED2 | \ DNS_KEYFLAG_RESERVED4 | \ DNS_KEYFLAG_RESERVED5 | \ DNS_KEYFLAG_RESERVED9 | \ DNS_KEYFLAG_RESERVED10 | \ DNS_KEYFLAG_RESERVED11 ) #define DNS_KEYFLAG_KSK 0x0001 /*%< key signing key */ #define DNS_KEYFLAG_RESERVEDMASK2 0xFFFF /*%< no bits defined here */ /* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */ #define DNS_KEYALG_RSAMD5 1 /*%< RSA with MD5 */ #define DNS_KEYALG_RSA DNS_KEYALG_RSAMD5 #define DNS_KEYALG_DH 2 /*%< Diffie Hellman KEY */ #define DNS_KEYALG_DSA 3 /*%< DSA KEY */ #define DNS_KEYALG_NSEC3DSA 6 #define DNS_KEYALG_DSS DNS_ALG_DSA #define DNS_KEYALG_ECC 4 #define DNS_KEYALG_RSASHA1 5 #define DNS_KEYALG_NSEC3RSASHA1 7 #define DNS_KEYALG_RSASHA256 8 #define DNS_KEYALG_RSASHA512 10 #define DNS_KEYALG_ECCGOST 12 #define DNS_KEYALG_ECDSA256 13 #define DNS_KEYALG_ECDSA384 14 #define DNS_KEYALG_ED25519 15 #define DNS_KEYALG_ED448 16 #define DNS_KEYALG_INDIRECT 252 #define DNS_KEYALG_PRIVATEDNS 253 #define DNS_KEYALG_PRIVATEOID 254 /*%< Key begins with OID giving alg */ /* Protocol values */ #define DNS_KEYPROTO_RESERVED 0 #define DNS_KEYPROTO_TLS 1 #define DNS_KEYPROTO_EMAIL 2 #define DNS_KEYPROTO_DNSSEC 3 #define DNS_KEYPROTO_IPSEC 4 #define DNS_KEYPROTO_ANY 255 /* Signatures */ #define DNS_SIG_RSAMINBITS 512 /*%< Size of a mod or exp in bits */ #define DNS_SIG_RSAMAXBITS 2552 /* Total of binary mod and exp */ #define DNS_SIG_RSAMAXBYTES ((DNS_SIG_RSAMAXBITS+7/8)*2+3) /*%< Max length of text sig block */ #define DNS_SIG_RSAMAXBASE64 (((DNS_SIG_RSAMAXBYTES+2)/3)*4) #define DNS_SIG_RSAMINSIZE ((DNS_SIG_RSAMINBITS+7)/8) #define DNS_SIG_RSAMAXSIZE ((DNS_SIG_RSAMAXBITS+7)/8) #define DNS_SIG_DSASIGSIZE 41 #define DNS_SIG_DSAMINBITS 512 #define DNS_SIG_DSAMAXBITS 1024 #define DNS_SIG_DSAMINBYTES 213 #define DNS_SIG_DSAMAXBYTES 405 #define DNS_SIG_GOSTSIGSIZE 64 #define DNS_SIG_ECDSA256SIZE 64 #define DNS_SIG_ECDSA384SIZE 96 #define DNS_KEY_ECDSA256SIZE 64 #define DNS_KEY_ECDSA384SIZE 96 #define DNS_SIG_ED25519SIZE 64 #define DNS_SIG_ED448SIZE 114 #define DNS_KEY_ED25519SIZE 32 #define DNS_KEY_ED448SIZE 57 #endif /* DNS_KEYVALUES_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/byaddr.h����������������������������������������������������������������������������������0000644�����������������00000007624�14763166026�0007777 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_BYADDR_H #define DNS_BYADDR_H 1 /***** ***** Module Info *****/ /*! \file dns/byaddr.h * \brief * The byaddr module provides reverse lookup services for IPv4 and IPv6 * addresses. * * MP: *\li The module ensures appropriate synchronization of data structures it * creates and manipulates. * * Reliability: *\li No anticipated impact. * * Resources: *\li TBS * * Security: *\li No anticipated impact. * * Standards: *\li RFCs: 1034, 1035, 2181, TBS *\li Drafts: TBS */ #include <isc/lang.h> #include <isc/event.h> #include <dns/types.h> ISC_LANG_BEGINDECLS /*% * A 'dns_byaddrevent_t' is returned when a byaddr completes. * The sender field will be set to the byaddr that completed. If 'result' * is ISC_R_SUCCESS, then 'names' will contain a list of names associated * with the address. The recipient of the event must not change the list * and must not refer to any of the name data after the event is freed. */ typedef struct dns_byaddrevent { ISC_EVENT_COMMON(struct dns_byaddrevent); isc_result_t result; dns_namelist_t names; } dns_byaddrevent_t; /* * This option is deprecated since we now only consider nibbles. #define DNS_BYADDROPT_IPV6NIBBLE 0x0001 */ /*% Note DNS_BYADDROPT_IPV6NIBBLE is now deprecated. */ #define DNS_BYADDROPT_IPV6INT 0x0002 isc_result_t dns_byaddr_create(isc_mem_t *mctx, isc_netaddr_t *address, dns_view_t *view, unsigned int options, isc_task_t *task, isc_taskaction_t action, void *arg, dns_byaddr_t **byaddrp); /*%< * Find the domain name of 'address'. * * Notes: * *\li There is a reverse lookup format for IPv6 addresses, 'nibble' * *\li The 'nibble' format for that address is * * \code * 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa. * \endcode * *\li #DNS_BYADDROPT_IPV6INT can be used to get nibble lookups under ip6.int. * * Requires: * *\li 'mctx' is a valid mctx. * *\li 'address' is a valid IPv4 or IPv6 address. * *\li 'view' is a valid view which has a resolver. * *\li 'task' is a valid task. * *\li byaddrp != NULL && *byaddrp == NULL * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY * *\li Any resolver-related error (e.g. #ISC_R_SHUTTINGDOWN) may also be * returned. */ void dns_byaddr_cancel(dns_byaddr_t *byaddr); /*%< * Cancel 'byaddr'. * * Notes: * *\li If 'byaddr' has not completed, post its #DNS_EVENT_BYADDRDONE * event with a result code of #ISC_R_CANCELED. * * Requires: * *\li 'byaddr' is a valid byaddr. */ void dns_byaddr_destroy(dns_byaddr_t **byaddrp); /*%< * Destroy 'byaddr'. * * Requires: * *\li '*byaddrp' is a valid byaddr. * *\li The caller has received the #DNS_EVENT_BYADDRDONE event (either because * the byaddr completed or because dns_byaddr_cancel() was called). * * Ensures: * *\li *byaddrp == NULL. */ isc_result_t dns_byaddr_createptrname(isc_netaddr_t *address, isc_boolean_t nibble, dns_name_t *name); isc_result_t dns_byaddr_createptrname2(isc_netaddr_t *address, unsigned int options, dns_name_t *name); /*%< * Creates a name that would be used in a PTR query for this address. The * nibble flag indicates that the 'nibble' format is to be used if an IPv6 * address is provided, instead of the 'bitstring' format. Since we dropped * the support of the bitstring labels, it is expected that the flag is always * set. 'options' are the same as for dns_byaddr_create(). * * Requires: * * \li 'address' is a valid address. * \li 'name' is a valid name with a dedicated buffer. */ ISC_LANG_ENDDECLS #endif /* DNS_BYADDR_H */ ������������������������������������������������������������������������������������������������������������bind9/dns/geoip.h�����������������������������������������������������������������������������������0000644�����������������00000004533�14763166026�0007631 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_GEOIP_H #define DNS_GEOIP_H 1 /***** ***** Module Info *****/ /*! \file dns/acl.h * \brief * Address match list handling. */ /*** *** Imports ***/ #include <isc/lang.h> #include <isc/magic.h> #include <isc/netaddr.h> #include <isc/refcount.h> #include <dns/name.h> #include <dns/types.h> #include <dns/iptable.h> #ifdef HAVE_GEOIP #include <GeoIP.h> #else typedef void GeoIP; #endif /*** *** Types ***/ typedef enum { dns_geoip_countrycode, dns_geoip_countrycode3, dns_geoip_countryname, dns_geoip_region, dns_geoip_regionname, dns_geoip_country_code, dns_geoip_country_code3, dns_geoip_country_name, dns_geoip_region_countrycode, dns_geoip_region_code, dns_geoip_region_name, dns_geoip_city_countrycode, dns_geoip_city_countrycode3, dns_geoip_city_countryname, dns_geoip_city_region, dns_geoip_city_regionname, dns_geoip_city_name, dns_geoip_city_postalcode, dns_geoip_city_metrocode, dns_geoip_city_areacode, dns_geoip_city_continentcode, dns_geoip_city_timezonecode, dns_geoip_isp_name, dns_geoip_org_name, dns_geoip_as_asnum, dns_geoip_domain_name, dns_geoip_netspeed_id } dns_geoip_subtype_t; typedef struct dns_geoip_elem { dns_geoip_subtype_t subtype; GeoIP *db; union { char as_string[256]; int as_int; }; } dns_geoip_elem_t; typedef struct dns_geoip_databases { GeoIP *country_v4; /* DB 1 */ GeoIP *city_v4; /* DB 2 or 6 */ GeoIP *region; /* DB 3 or 7 */ GeoIP *isp; /* DB 4 */ GeoIP *org; /* DB 5 */ GeoIP *as; /* DB 9 */ GeoIP *netspeed; /* DB 10 */ GeoIP *domain; /* DB 11 */ GeoIP *country_v6; /* DB 12 */ GeoIP *city_v6; /* DB 30 or 31 */ } dns_geoip_databases_t; /*** *** Functions ***/ ISC_LANG_BEGINDECLS isc_boolean_t dns_geoip_match(const isc_netaddr_t *reqaddr, isc_uint8_t *scope, const dns_geoip_databases_t *geoip, const dns_geoip_elem_t *elt); void dns_geoip_shutdown(void); ISC_LANG_ENDDECLS #endif /* DNS_GEOIP_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/ttl.h�������������������������������������������������������������������������������������0000644�����������������00000003675�14763166026�0007337 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_TTL_H #define DNS_TTL_H 1 /*! \file dns/ttl.h */ /*** *** Imports ***/ #include <isc/lang.h> #include <isc/types.h> ISC_LANG_BEGINDECLS /*** *** Functions ***/ isc_result_t dns_ttl_totext(isc_uint32_t src, isc_boolean_t verbose, isc_buffer_t *target); isc_result_t dns_ttl_totext2(isc_uint32_t src, isc_boolean_t verbose, isc_boolean_t upcase, isc_buffer_t *target); /*%< * Output a TTL or other time interval in a human-readable form. * The time interval is given as a count of seconds in 'src'. * The text representation is appended to 'target'. * * If 'verbose' is ISC_FALSE, use the terse BIND 8 style, like "1w2d3h4m5s". * * If 'verbose' is ISC_TRUE, use a verbose style like the SOA comments * in "dig", like "1 week 2 days 3 hours 4 minutes 5 seconds". * * If 'upcase' is ISC_TRUE, we conform to the BIND 8 style in which * the unit letter is capitalized if there is only a single unit * letter to print (for example, "1m30s", but "2M") * * If 'upcase' is ISC_FALSE, unit letters are always in lower case. * * Returns: * \li ISC_R_SUCCESS * \li ISC_R_NOSPACE */ isc_result_t dns_counter_fromtext(isc_textregion_t *source, isc_uint32_t *ttl); /*%< * Converts a counter from either a plain number or a BIND 8 style value. * * Returns: *\li ISC_R_SUCCESS *\li DNS_R_SYNTAX */ isc_result_t dns_ttl_fromtext(isc_textregion_t *source, isc_uint32_t *ttl); /*%< * Converts a ttl from either a plain number or a BIND 8 style value. * * Returns: *\li ISC_R_SUCCESS *\li DNS_R_BADTTL */ ISC_LANG_ENDDECLS #endif /* DNS_TTL_H */ �������������������������������������������������������������������bind9/dns/validator.h�������������������������������������������������������������������������������0000644�����������������00000015776�14763166026�0010526 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_VALIDATOR_H #define DNS_VALIDATOR_H 1 /***** ***** Module Info *****/ /*! \file dns/validator.h * * \brief * DNS Validator * This is the BIND 9 validator, the module responsible for validating the * rdatasets and negative responses (messages). It makes use of zones in * the view and may fetch RRset to complete trust chains. It implements * DNSSEC as specified in RFC 4033, 4034 and 4035. * * It can also optionally implement ISC's DNSSEC look-aside validation. * * Correct operation is critical to preventing spoofed answers from secure * zones being accepted. * * MP: *\li The module ensures appropriate synchronization of data structures it * creates and manipulates. * * Reliability: *\li No anticipated impact. * * Resources: *\li TBS * * Security: *\li No anticipated impact. * * Standards: *\li RFCs: 1034, 1035, 2181, 4033, 4034, 4035. */ #include <isc/lang.h> #include <isc/event.h> #include <isc/mutex.h> #include <dns/fixedname.h> #include <dns/types.h> #include <dns/rdataset.h> #include <dns/rdatastruct.h> /* for dns_rdata_rrsig_t */ #include <dst/dst.h> /*% * A dns_validatorevent_t is sent when a 'validation' completes. * \brief * 'name', 'rdataset', 'sigrdataset', and 'message' are the values that were * supplied when dns_validator_create() was called. They are returned to the * caller so that they may be freed. * * If the RESULT is ISC_R_SUCCESS and the answer is secure then * proofs[] will contain the names of the NSEC records that hold the * various proofs. Note the same name may appear multiple times. */ typedef struct dns_validatorevent { ISC_EVENT_COMMON(struct dns_validatorevent); dns_validator_t * validator; isc_result_t result; /* * Name and type of the response to be validated. */ dns_name_t * name; dns_rdatatype_t type; /* * Rdata and RRSIG (if any) for positive responses. */ dns_rdataset_t * rdataset; dns_rdataset_t * sigrdataset; /* * The full response. Required for negative responses. * Also required for positive wildcard responses. */ dns_message_t * message; /* * Proofs to be cached. */ dns_name_t * proofs[4]; /* * Optout proof seen. */ isc_boolean_t optout; /* * Answer is secure. */ isc_boolean_t secure; } dns_validatorevent_t; #define DNS_VALIDATOR_NOQNAMEPROOF 0 #define DNS_VALIDATOR_NODATAPROOF 1 #define DNS_VALIDATOR_NOWILDCARDPROOF 2 #define DNS_VALIDATOR_CLOSESTENCLOSER 3 /*% * A validator object represents a validation in progress. * \brief * Clients are strongly discouraged from using this type directly, with * the exception of the 'link' field, which may be used directly for * whatever purpose the client desires. */ struct dns_validator { /* Unlocked. */ unsigned int magic; isc_mutex_t lock; dns_view_t * view; /* Locked by lock. */ unsigned int options; unsigned int attributes; dns_validatorevent_t * event; dns_fetch_t * fetch; dns_validator_t * subvalidator; dns_validator_t * parent; dns_keytable_t * keytable; dns_keynode_t * keynode; dst_key_t * key; dns_rdata_rrsig_t * siginfo; isc_task_t * task; isc_taskaction_t action; void * arg; unsigned int labels; dns_rdataset_t * currentset; isc_boolean_t seensig; dns_rdataset_t * keyset; dns_rdataset_t * dsset; dns_rdataset_t * soaset; dns_rdataset_t * nsecset; dns_rdataset_t * nsec3set; dns_name_t * soaname; dns_rdataset_t frdataset; dns_rdataset_t fsigrdataset; dns_fixedname_t fname; dns_fixedname_t wild; dns_fixedname_t nearest; dns_fixedname_t closest; ISC_LINK(dns_validator_t) link; dns_rdataset_t dlv; dns_fixedname_t dlvsep; isc_boolean_t havedlvsep; isc_boolean_t mustbesecure; unsigned int dlvlabels; unsigned int depth; unsigned int authcount; unsigned int authfail; isc_stdtime_t start; }; /*% * dns_validator_create() options. */ #define DNS_VALIDATOR_DLV 0x0001U #define DNS_VALIDATOR_DEFER 0x0002U #define DNS_VALIDATOR_NOCDFLAG 0x0004U #define DNS_VALIDATOR_NONTA 0x0008U /*% Ignore NTA table */ ISC_LANG_BEGINDECLS isc_result_t dns_validator_create(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, dns_message_t *message, unsigned int options, isc_task_t *task, isc_taskaction_t action, void *arg, dns_validator_t **validatorp); /*%< * Start a DNSSEC validation. * * This validates a response to the question given by * 'name' and 'type'. * * To validate a positive response, the response data is * given by 'rdataset' and 'sigrdataset'. If 'sigrdataset' * is NULL, the data is presumed insecure and an attempt * is made to prove its insecurity by finding the appropriate * null key. * * The complete response message may be given in 'message', * to make available any authority section NSECs that may be * needed for validation of a response resulting from a * wildcard expansion (though no such wildcard validation * is implemented yet). If the complete response message * is not available, 'message' is NULL. * * To validate a negative response, the complete negative response * message is given in 'message'. The 'rdataset', and * 'sigrdataset' arguments must be NULL, but the 'name' and 'type' * arguments must be provided. * * The validation is performed in the context of 'view'. * * When the validation finishes, a dns_validatorevent_t with * the given 'action' and 'arg' are sent to 'task'. * Its 'result' field will be ISC_R_SUCCESS iff the * response was successfully proven to be either secure or * part of a known insecure domain. * * options: * If DNS_VALIDATOR_DLV is set the caller knows there is not a * trusted key and the validator should immediately attempt to validate * the answer by looking for an appropriate DLV RRset. */ void dns_validator_send(dns_validator_t *validator); /*%< * Send a deferred validation request * * Requires: * 'validator' to points to a valid DNSSEC validator. */ void dns_validator_cancel(dns_validator_t *validator); /*%< * Cancel a DNSSEC validation in progress. * * Requires: *\li 'validator' points to a valid DNSSEC validator, which * may or may not already have completed. * * Ensures: *\li It the validator has not already sent its completion * event, it will send it with result code ISC_R_CANCELED. */ void dns_validator_destroy(dns_validator_t **validatorp); /*%< * Destroy a DNSSEC validator. * * Requires: *\li '*validatorp' points to a valid DNSSEC validator. * \li The validator must have completed and sent its completion * event. * * Ensures: *\li All resources used by the validator are freed. */ ISC_LANG_ENDDECLS #endif /* DNS_VALIDATOR_H */ ��bind9/dns/keytable.h��������������������������������������������������������������������������������0000644�����������������00000022440�14763166026�0010323 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_KEYTABLE_H #define DNS_KEYTABLE_H 1 /***** ***** Module Info *****/ /*! \file * \brief * The keytable module provides services for storing and retrieving DNSSEC * trusted keys, as well as the ability to find the deepest matching key * for a given domain name. * * MP: *\li The module ensures appropriate synchronization of data structures it * creates and manipulates. * * Resources: *\li TBS * * Security: *\li No anticipated impact. */ #include <isc/lang.h> #include <isc/magic.h> #include <isc/refcount.h> #include <isc/rwlock.h> #include <isc/stdtime.h> #include <dns/types.h> #include <dst/dst.h> ISC_LANG_BEGINDECLS isc_result_t dns_keytable_create(isc_mem_t *mctx, dns_keytable_t **keytablep); /*%< * Create a keytable. * * Requires: * *\li 'mctx' is a valid memory context. * *\li keytablep != NULL && *keytablep == NULL * * Ensures: * *\li On success, *keytablep is a valid, empty key table. * * Returns: * *\li ISC_R_SUCCESS * *\li Any other result indicates failure. */ void dns_keytable_attach(dns_keytable_t *source, dns_keytable_t **targetp); /*%< * Attach *targetp to source. * * Requires: * *\li 'source' is a valid keytable. * *\li 'targetp' points to a NULL dns_keytable_t *. * * Ensures: * *\li *targetp is attached to source. */ void dns_keytable_detach(dns_keytable_t **keytablep); /*%< * Detach *keytablep from its keytable. * * Requires: * *\li 'keytablep' points to a valid keytable. * * Ensures: * *\li *keytablep is NULL. * *\li If '*keytablep' is the last reference to the keytable, * all resources used by the keytable will be freed */ isc_result_t dns_keytable_add(dns_keytable_t *keytable, isc_boolean_t managed, dst_key_t **keyp); /*%< * Add '*keyp' to 'keytable' (using the name in '*keyp'). * The value of keynode->managed is set to 'managed' * * Notes: * *\li Ownership of *keyp is transferred to the keytable. *\li If the key already exists in the table, ISC_R_EXISTS is * returned and the new key is freed. * * Requires: * *\li 'keytable' points to a valid keytable. * *\li keyp != NULL && *keyp is a valid dst_key_t *. * * Ensures: * *\li On success, *keyp == NULL * * Returns: * *\li ISC_R_SUCCESS *\li ISC_R_EXISTS * *\li Any other result indicates failure. */ isc_result_t dns_keytable_marksecure(dns_keytable_t *keytable, dns_name_t *name); /*%< * Add a null key to 'keytable' for name 'name'. This marks the * name as a secure domain, but doesn't supply any key data to allow the * domain to be validated. (Used when automated trust anchor management * has gotten broken by a zone misconfiguration; for example, when the * active key has been revoked but the stand-by key was still in its 30-day * waiting period for validity.) * * Notes: * *\li If a key already exists in the table, ISC_R_EXISTS is * returned and nothing is done. * * Requires: * *\li 'keytable' points to a valid keytable. * *\li keyp != NULL && *keyp is a valid dst_key_t *. * * Returns: * *\li ISC_R_SUCCESS *\li ISC_R_EXISTS * *\li Any other result indicates failure. */ isc_result_t dns_keytable_delete(dns_keytable_t *keytable, dns_name_t *keyname); /*%< * Delete node(s) from 'keytable' matching name 'keyname' * * Requires: * *\li 'keytable' points to a valid keytable. * *\li 'name' is not NULL * * Returns: * *\li ISC_R_SUCCESS * *\li Any other result indicates failure. */ isc_result_t dns_keytable_deletekeynode(dns_keytable_t *keytable, dst_key_t *dstkey); /*%< * Delete node(s) from 'keytable' containing copies of the key pointed * to by 'dstkey' * * Requires: * *\li 'keytable' points to a valid keytable. *\li 'dstkey' is not NULL * * Returns: * *\li ISC_R_SUCCESS * *\li Any other result indicates failure. */ isc_result_t dns_keytable_find(dns_keytable_t *keytable, dns_name_t *keyname, dns_keynode_t **keynodep); /*%< * Search for the first instance of a key named 'name' in 'keytable', * without regard to keyid and algorithm. Use dns_keytable_nextkeynode() * to find subsequent instances. * * Requires: * *\li 'keytable' is a valid keytable. * *\li 'name' is a valid absolute name. * *\li keynodep != NULL && *keynodep == NULL * * Returns: * *\li ISC_R_SUCCESS *\li ISC_R_NOTFOUND * *\li Any other result indicates an error. */ isc_result_t dns_keytable_nextkeynode(dns_keytable_t *keytable, dns_keynode_t *keynode, dns_keynode_t **nextnodep); /*%< * Return for the next key after 'keynode' in 'keytable', without regard to * keyid and algorithm. * * Requires: * *\li 'keytable' is a valid keytable. * *\li 'keynode' is a valid keynode. * *\li nextnodep != NULL && *nextnodep == NULL * * Returns: * *\li ISC_R_SUCCESS *\li ISC_R_NOTFOUND * *\li Any other result indicates an error. */ isc_result_t dns_keytable_findkeynode(dns_keytable_t *keytable, dns_name_t *name, dns_secalg_t algorithm, dns_keytag_t tag, dns_keynode_t **keynodep); /*%< * Search for a key named 'name', matching 'algorithm' and 'tag' in * 'keytable'. This finds the first instance which matches. Use * dns_keytable_findnextkeynode() to find other instances. * * Requires: * *\li 'keytable' is a valid keytable. * *\li 'name' is a valid absolute name. * *\li keynodep != NULL && *keynodep == NULL * * Returns: * *\li ISC_R_SUCCESS *\li DNS_R_PARTIALMATCH the name existed in the keytable. *\li ISC_R_NOTFOUND * *\li Any other result indicates an error. */ isc_result_t dns_keytable_findnextkeynode(dns_keytable_t *keytable, dns_keynode_t *keynode, dns_keynode_t **nextnodep); /*%< * Search for the next key with the same properties as 'keynode' in * 'keytable' as found by dns_keytable_findkeynode(). * * Requires: * *\li 'keytable' is a valid keytable. * *\li 'keynode' is a valid keynode. * *\li nextnodep != NULL && *nextnodep == NULL * * Returns: * *\li ISC_R_SUCCESS *\li ISC_R_NOTFOUND * *\li Any other result indicates an error. */ isc_result_t dns_keytable_finddeepestmatch(dns_keytable_t *keytable, dns_name_t *name, dns_name_t *foundname); /*%< * Search for the deepest match of 'name' in 'keytable'. * * Requires: * *\li 'keytable' is a valid keytable. * *\li 'name' is a valid absolute name. * *\li 'foundname' is a name with a dedicated buffer. * * Returns: * *\li ISC_R_SUCCESS *\li ISC_R_NOTFOUND * *\li Any other result indicates an error. */ void dns_keytable_attachkeynode(dns_keytable_t *keytable, dns_keynode_t *source, dns_keynode_t **target); /*%< * Attach a keynode and and increment the active_nodes counter in a * corresponding keytable. * * Requires: * *\li 'keytable' is a valid keytable. * *\li 'source' is a valid keynode. * *\li 'target' is not null and '*target' is null. */ void dns_keytable_detachkeynode(dns_keytable_t *keytable, dns_keynode_t **keynodep); /*%< * Give back a keynode found via dns_keytable_findkeynode(). * * Requires: * *\li 'keytable' is a valid keytable. * *\li *keynodep is a valid keynode returned by a call to * dns_keytable_findkeynode(). * * Ensures: * *\li *keynodep == NULL */ isc_result_t dns_keytable_issecuredomain(dns_keytable_t *keytable, dns_name_t *name, dns_name_t *foundname, isc_boolean_t *wantdnssecp); /*%< * Is 'name' at or beneath a trusted key? * * Requires: * *\li 'keytable' is a valid keytable. * *\li 'name' is a valid absolute name. * *\li 'foundanme' is NULL or is a pointer to an initialized dns_name_t * *\li '*wantsdnssecp' is a valid isc_boolean_t. * Ensures: * *\li On success, *wantsdnssecp will be ISC_TRUE if and only if 'name' * is at or beneath a trusted key. If 'foundname' is not NULL, then * it will be updated to contain the name of the closest enclosing * trust anchor. * * Returns: * *\li ISC_R_SUCCESS * *\li Any other result is an error. */ isc_result_t dns_keytable_dump(dns_keytable_t *keytable, FILE *fp); /*%< * Dump the keytable on fp. */ isc_result_t dns_keytable_totext(dns_keytable_t *keytable, isc_buffer_t **buf); /*%< * Dump the keytable to buffer at 'buf' */ dst_key_t * dns_keynode_key(dns_keynode_t *keynode); /*%< * Get the DST key associated with keynode. */ isc_boolean_t dns_keynode_managed(dns_keynode_t *keynode); /*%< * Is this flagged as a managed key? */ isc_result_t dns_keynode_create(isc_mem_t *mctx, dns_keynode_t **target); /*%< * Allocate space for a keynode */ void dns_keynode_attach(dns_keynode_t *source, dns_keynode_t **target); /*%< * Attach keynode 'source' to '*target' */ void dns_keynode_detach(isc_mem_t *mctx, dns_keynode_t **target); /*%< * Detach a single keynode, without touching any keynodes that * may be pointed to by its 'next' pointer */ void dns_keynode_detachall(isc_mem_t *mctx, dns_keynode_t **target); /*%< * Detach a keynode and all its succesors. */ isc_result_t dns_keytable_forall(dns_keytable_t *keytable, void (*func)(dns_keytable_t *, dns_keynode_t *, void *), void *arg); ISC_LANG_ENDDECLS #endif /* DNS_KEYTABLE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/adb.h�������������������������������������������������������������������������������������0000644�����������������00000054040�14763166026�0007252 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_ADB_H #define DNS_ADB_H 1 /***** ***** Module Info *****/ /*! \file dns/adb.h *\brief * DNS Address Database * * This module implements an address database (ADB) for mapping a name * to an isc_sockaddr_t. It also provides statistical information on * how good that address might be. * * A client will pass in a dns_name_t, and the ADB will walk through * the rdataset looking up addresses associated with the name. If it * is found on the internal lists, a structure is filled in with the * address information and stats for found addresses. * * If the name cannot be found on the internal lists, a new entry will * be created for a name if all the information needed can be found * in the zone table or cache. This new address will then be returned. * * If a request must be made to remote servers to satisfy a name lookup, * this module will start fetches to try to complete these addresses. When * at least one more completes, an event is sent to the caller. If none of * them resolve before the fetch times out, an event indicating this is * sent instead. * * Records are stored internally until a timer expires. The timer is the * smaller of the TTL or signature validity period. * * Lameness is stored per <qname,qtype> tuple, and this data hangs off each * address field. When an address is marked lame for a given tuple the address * will not be returned to a caller. * * * MP: * *\li The ADB takes care of all necessary locking. * *\li Only the task which initiated the name lookup can cancel the lookup. * * * Security: * *\li None, since all data stored is required to be pre-filtered. * (Cache needs to be sane, fetches return bounds-checked and sanity- * checked data, caller passes a good dns_name_t for the zone, etc) */ /*** *** Imports ***/ #include <isc/lang.h> #include <isc/magic.h> #include <isc/mem.h> #include <isc/sockaddr.h> #include <dns/types.h> #include <dns/view.h> ISC_LANG_BEGINDECLS /*** *** Magic number checks ***/ #define DNS_ADBFIND_MAGIC ISC_MAGIC('a','d','b','H') #define DNS_ADBFIND_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBFIND_MAGIC) #define DNS_ADBADDRINFO_MAGIC ISC_MAGIC('a','d','A','I') #define DNS_ADBADDRINFO_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBADDRINFO_MAGIC) /*** *** TYPES ***/ typedef struct dns_adbname dns_adbname_t; /*! *\brief * Represents a lookup for a single name. * * On return, the client can safely use "list", and can reorder the list. * Items may not be _deleted_ from this list, however, or added to it * other than by using the dns_adb_*() API. */ struct dns_adbfind { /* Public */ unsigned int magic; /*%< RO: magic */ dns_adbaddrinfolist_t list; /*%< RO: list of addrs */ unsigned int query_pending; /*%< RO: partial list */ unsigned int partial_result; /*%< RO: addrs missing */ unsigned int options; /*%< RO: options */ isc_result_t result_v4; /*%< RO: v4 result */ isc_result_t result_v6; /*%< RO: v6 result */ ISC_LINK(dns_adbfind_t) publink; /*%< RW: client use */ /* Private */ isc_mutex_t lock; /* locks all below */ in_port_t port; int name_bucket; unsigned int flags; dns_adbname_t *adbname; dns_adb_t *adb; isc_event_t event; ISC_LINK(dns_adbfind_t) plink; }; /* * _INET: * _INET6: * return addresses of that type. * * _EMPTYEVENT: * Only schedule an event if no addresses are known. * Must set _WANTEVENT for this to be meaningful. * * _WANTEVENT: * An event is desired. Check this bit in the returned find to see * if one will actually be generated. * * _AVOIDFETCHES: * If set, fetches will not be generated unless no addresses are * available in any of the address families requested. * * _STARTATZONE: * Fetches will start using the closest zone data or use the root servers. * This is useful for reestablishing glue that has expired. * * _GLUEOK: * _HINTOK: * Glue or hints are ok. These are used when matching names already * in the adb, and when dns databases are searched. * * _RETURNLAME: * Return lame servers in a find, so that all addresses are returned. * * _LAMEPRUNED: * At least one address was omitted from the list because it was lame. * This bit will NEVER be set if _RETURNLAME is set in the createfind(). */ /*% Return addresses of type INET. */ #define DNS_ADBFIND_INET 0x00000001 /*% Return addresses of type INET6. */ #define DNS_ADBFIND_INET6 0x00000002 #define DNS_ADBFIND_ADDRESSMASK 0x00000003 /*% * Only schedule an event if no addresses are known. * Must set _WANTEVENT for this to be meaningful. */ #define DNS_ADBFIND_EMPTYEVENT 0x00000004 /*% * An event is desired. Check this bit in the returned find to see * if one will actually be generated. */ #define DNS_ADBFIND_WANTEVENT 0x00000008 /*% * If set, fetches will not be generated unless no addresses are * available in any of the address families requested. */ #define DNS_ADBFIND_AVOIDFETCHES 0x00000010 /*% * Fetches will start using the closest zone data or use the root servers. * This is useful for reestablishing glue that has expired. */ #define DNS_ADBFIND_STARTATZONE 0x00000020 /*% * Glue or hints are ok. These are used when matching names already * in the adb, and when dns databases are searched. */ #define DNS_ADBFIND_GLUEOK 0x00000040 /*% * Glue or hints are ok. These are used when matching names already * in the adb, and when dns databases are searched. */ #define DNS_ADBFIND_HINTOK 0x00000080 /*% * Return lame servers in a find, so that all addresses are returned. */ #define DNS_ADBFIND_RETURNLAME 0x00000100 /*% * Only schedule an event if no addresses are known. * Must set _WANTEVENT for this to be meaningful. */ #define DNS_ADBFIND_LAMEPRUNED 0x00000200 /*% * The server's fetch quota is exceeded; it will be treated as * lame for this query. */ #define DNS_ADBFIND_OVERQUOTA 0x00000400 /*% * Don't perform a fetch even if there are no address records available. */ #define DNS_ADBFIND_NOFETCH 0x00000800 /*% * The answers to queries come back as a list of these. */ struct dns_adbaddrinfo { unsigned int magic; /*%< private */ isc_sockaddr_t sockaddr; /*%< [rw] */ unsigned int srtt; /*%< [rw] microsecs */ isc_dscp_t dscp; unsigned int flags; /*%< [rw] */ dns_adbentry_t *entry; /*%< private */ ISC_LINK(dns_adbaddrinfo_t) publink; }; /*!< * The event sent to the caller task is just a plain old isc_event_t. It * contains no data other than a simple status, passed in the "type" field * to indicate that another address resolved, or all partially resolved * addresses have failed to resolve. * * "sender" is the dns_adbfind_t used to issue this query. * * This is simply a standard event, with the "type" set to: * *\li #DNS_EVENT_ADBMOREADDRESSES -- another address resolved. *\li #DNS_EVENT_ADBNOMOREADDRESSES -- all pending addresses failed, * were canceled, or otherwise will * not be usable. *\li #DNS_EVENT_ADBCANCELED -- The request was canceled by a * 3rd party. *\li #DNS_EVENT_ADBNAMEDELETED -- The name was deleted, so this request * was canceled. * * In each of these cases, the addresses returned by the initial call * to dns_adb_createfind() can still be used until they are no longer needed. */ /**** **** FUNCTIONS ****/ isc_result_t dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *tmgr, isc_taskmgr_t *taskmgr, dns_adb_t **newadb); /*%< * Create a new ADB. * * Notes: * *\li Generally, applications should not create an ADB directly, but * should instead call dns_view_createresolver(). * * Requires: * *\li 'mem' must be a valid memory context. * *\li 'view' be a pointer to a valid view. * *\li 'tmgr' be a pointer to a valid timer manager. * *\li 'taskmgr' be a pointer to a valid task manager. * *\li 'newadb' != NULL && '*newadb' == NULL. * * Returns: * *\li #ISC_R_SUCCESS after happiness. *\li #ISC_R_NOMEMORY after resource allocation failure. */ void dns_adb_attach(dns_adb_t *adb, dns_adb_t **adbp); /*% * Attach to an 'adb' to 'adbp'. * * Requires: *\li 'adb' to be a valid dns_adb_t, created via dns_adb_create(). *\li 'adbp' to be a valid pointer to a *dns_adb_t which is initialized * to NULL. */ void dns_adb_detach(dns_adb_t **adb); /*% * Delete the ADB. Sets *ADB to NULL. Cancels any outstanding requests. * * Requires: * *\li 'adb' be non-NULL and '*adb' be a valid dns_adb_t, created via * dns_adb_create(). */ void dns_adb_whenshutdown(dns_adb_t *adb, isc_task_t *task, isc_event_t **eventp); /*% * Send '*eventp' to 'task' when 'adb' has shutdown. * * Requires: * *\li '*adb' is a valid dns_adb_t. * *\li eventp != NULL && *eventp is a valid event. * * Ensures: * *\li *eventp == NULL * *\li The event's sender field is set to the value of adb when the event * is sent. */ void dns_adb_shutdown(dns_adb_t *adb); /*%< * Shutdown 'adb'. * * Requires: * * \li '*adb' is a valid dns_adb_t. */ isc_result_t dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, void *arg, dns_name_t *name, dns_name_t *qname, dns_rdatatype_t qtype, unsigned int options, isc_stdtime_t now, dns_name_t *target, in_port_t port, dns_adbfind_t **find); isc_result_t dns_adb_createfind2(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, void *arg, dns_name_t *name, dns_name_t *qname, dns_rdatatype_t qtype, unsigned int options, isc_stdtime_t now, dns_name_t *target, in_port_t port, unsigned int depth, isc_counter_t *qc, dns_adbfind_t **find); /*%< * Main interface for clients. The adb will look up the name given in * "name" and will build up a list of found addresses, and perhaps start * internal fetches to resolve names that are unknown currently. * * If other addresses resolve after this call completes, an event will * be sent to the <task, taskaction, arg> with the sender of that event * set to a pointer to the dns_adbfind_t returned by this function. * * If no events will be generated, the *find->result_v4 and/or result_v6 * members may be examined for address lookup status. The usual #ISC_R_SUCCESS, * #ISC_R_FAILURE, #DNS_R_NXDOMAIN, and #DNS_R_NXRRSET are returned, along with * #ISC_R_NOTFOUND meaning the ADB has not _yet_ found the values. In this * latter case, retrying may produce more addresses. * * If events will be returned, the result_v[46] members are only valid * when that event is actually returned. * * The list of addresses returned is unordered. The caller must impose * any ordering required. The list will not contain "known bad" addresses, * however. For instance, it will not return hosts that are known to be * lame for the zone in question. * * The caller cannot (directly) modify the contents of the address list's * fields other than the "link" field. All values can be read at any * time, however. * * The "now" parameter is used only for determining which entries that * have a specific time to live or expire time should be removed from * the running database. If specified as zero, the current time will * be retrieved and used. * * If 'target' is not NULL and 'name' is an alias (i.e. the name is * CNAME'd or DNAME'd to another name), then 'target' will be updated with * the domain name that 'name' is aliased to. * * All addresses returned will have the sockaddr's port set to 'port.' * The caller may change them directly in the dns_adbaddrinfo_t since * they are copies of the internal address only. * * XXXMLG Document options, especially the flags which control how * events are sent. * * Requires: * *\li *adb be a valid isc_adb_t object. * *\li If events are to be sent, *task be a valid task, * and isc_taskaction_t != NULL. * *\li *name is a valid dns_name_t. * *\li qname != NULL and *qname be a valid dns_name_t. * *\li target == NULL or target is a valid name with a buffer. * *\li find != NULL && *find == NULL. * * Returns: * *\li #ISC_R_SUCCESS Addresses might have been returned, and events will be * delivered for unresolved addresses. *\li #ISC_R_NOMORE Addresses might have been returned, but no events * will ever be posted for this context. This is only * returned if task != NULL. *\li #ISC_R_NOMEMORY insufficient resources *\li #DNS_R_ALIAS 'name' is an alias for another name. * * Calls, and returns error codes from: * *\li isc_stdtime_get() * * Notes: * *\li No internal reference to "name" exists after this function * returns. */ void dns_adb_cancelfind(dns_adbfind_t *find); /*%< * Cancels the find, and sends the event off to the caller. * * It is an error to call dns_adb_cancelfind() on a find where * no event is wanted, or will ever be sent. * * Note: * *\li It is possible that the real completion event was posted just * before the dns_adb_cancelfind() call was made. In this case, * dns_adb_cancelfind() will do nothing. The event callback needs * to be prepared to find this situation (i.e. result is valid but * the caller expects it to be canceled). * * Requires: * *\li 'find' be a valid dns_adbfind_t pointer. * *\li events would have been posted to the task. This can be checked * with (find->options & DNS_ADBFIND_WANTEVENT). * * Ensures: * *\li The event was posted to the task. */ void dns_adb_destroyfind(dns_adbfind_t **find); /*%< * Destroys the find reference. * * Note: * *\li This can only be called after the event was delivered for a * find. Additionally, the event MUST have been freed via * isc_event_free() BEFORE this function is called. * * Requires: * *\li 'find' != NULL and *find be valid dns_adbfind_t pointer. * * Ensures: * *\li No "address found" events will be posted to the originating task * after this function returns. */ void dns_adb_dump(dns_adb_t *adb, FILE *f); /*%< * This function is only used for debugging. It will dump as much of the * state of the running system as possible. * * Requires: * *\li adb be valid. * *\li f != NULL, and is a file open for writing. */ void dns_adb_dumpfind(dns_adbfind_t *find, FILE *f); /*%< * This function is only used for debugging. Dump the data associated * with a find. * * Requires: * *\li find is valid. * * \li f != NULL, and is a file open for writing. */ isc_result_t dns_adb_marklame(dns_adb_t *adb, dns_adbaddrinfo_t *addr, dns_name_t *qname, dns_rdatatype_t type, isc_stdtime_t expire_time); /*%< * Mark the given address as lame for the <qname,qtype>. expire_time should * be set to the time when the entry should expire. That is, if it is to * expire 10 minutes in the future, it should set it to (now + 10 * 60). * * Requires: * *\li adb be valid. * *\li addr be valid. * *\li qname be the qname used in the dns_adb_createfind() call. * * Returns: * *\li #ISC_R_SUCCESS -- all is well. *\li #ISC_R_NOMEMORY -- could not mark address as lame. */ /* * Reasonable defaults for RTT adjustments * * (Note: these values function both as scaling factors and as * indicators of the type of RTT adjustment operation taking place. * Adjusting the scaling factors is fine, as long as they all remain * unique values.) */ #define DNS_ADB_RTTADJDEFAULT 7 /*%< default scale */ #define DNS_ADB_RTTADJREPLACE 0 /*%< replace with our rtt */ #define DNS_ADB_RTTADJAGE 10 /*%< age this rtt */ void dns_adb_adjustsrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int rtt, unsigned int factor); /*%< * Mix the round trip time into the existing smoothed rtt. * * Requires: * *\li adb be valid. * *\li addr be valid. * *\li 0 <= factor <= 10 * * Note: * *\li The srtt in addr will be updated to reflect the new global * srtt value. This may include changes made by others. */ void dns_adb_agesrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr, isc_stdtime_t now); /* * dns_adb_agesrtt is equivalent to dns_adb_adjustsrtt with factor * equal to DNS_ADB_RTTADJAGE and the current time passed in. * * Requires: * *\li adb be valid. * *\li addr be valid. * * Note: * *\li The srtt in addr will be updated to reflect the new global * srtt value. This may include changes made by others. */ void dns_adb_changeflags(dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int bits, unsigned int mask); /*% * Change Flags. * * Set the flags as given by: * *\li newflags = (oldflags & ~mask) | (bits & mask); * * Requires: * *\li adb be valid. * *\li addr be valid. */ void dns_adb_setudpsize(dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int size); /*% * Update seen UDP response size. The largest seen will be returned by * dns_adb_getudpsize(). * * Requires: * *\li adb be valid. * *\li addr be valid. */ unsigned int dns_adb_getudpsize(dns_adb_t *adb, dns_adbaddrinfo_t *addr); /*% * Return the largest seen UDP response size. * * Requires: * *\li adb be valid. * *\li addr be valid. */ unsigned int dns_adb_probesize(dns_adb_t *adb, dns_adbaddrinfo_t *addr); unsigned int dns_adb_probesize2(dns_adb_t *adb, dns_adbaddrinfo_t *addr, int lookups); /*% * Return suggested EDNS UDP size based on observed responses / failures. * 'lookups' is the number of times the current lookup has been attempted. * * Requires: * *\li adb be valid. * *\li addr be valid. */ void dns_adb_plainresponse(dns_adb_t *adb, dns_adbaddrinfo_t *addr); /*% * Record a successful plain DNS response. * * Requires: * *\li adb be valid. * *\li addr be valid. */ void dns_adb_timeout(dns_adb_t *adb, dns_adbaddrinfo_t *addr); /*% * Record a plain DNS UDP query failed. * * Requires: * *\li adb be valid. * *\li addr be valid. */ void dns_adb_ednsto(dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int size); /*% * Record a failed EDNS UDP response and the advertised EDNS UDP buffer size * used. * * Requires: * *\li adb be valid. * *\li addr be valid. */ isc_boolean_t dns_adb_noedns(dns_adb_t *adb, dns_adbaddrinfo_t *addr); /*% * Return whether EDNS should be disabled for this server. * * Requires: * *\li adb be valid. * *\li addr be valid. */ isc_result_t dns_adb_findaddrinfo(dns_adb_t *adb, isc_sockaddr_t *sa, dns_adbaddrinfo_t **addrp, isc_stdtime_t now); /*%< * Return a dns_adbaddrinfo_t that is associated with address 'sa'. * * Requires: * *\li adb is valid. * *\li sa is valid. * *\li addrp != NULL && *addrp == NULL * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li #ISC_R_SHUTTINGDOWN */ void dns_adb_freeaddrinfo(dns_adb_t *adb, dns_adbaddrinfo_t **addrp); /*%< * Free a dns_adbaddrinfo_t allocated by dns_adb_findaddrinfo(). * * Requires: * *\li adb is valid. * *\li *addrp is a valid dns_adbaddrinfo_t *. */ void dns_adb_flush(dns_adb_t *adb); /*%< * Flushes all cached data from the adb. * * Requires: *\li adb is valid. */ void dns_adb_setadbsize(dns_adb_t *adb, size_t size); /*%< * Set a target memory size. If memory usage exceeds the target * size entries will be removed before they would have expired on * a random basis. * * If 'size' is 0 then memory usage is unlimited. * * Requires: *\li 'adb' is valid. */ void dns_adb_flushname(dns_adb_t *adb, dns_name_t *name); /*%< * Flush 'name' from the adb cache. * * Requires: *\li 'adb' is valid. *\li 'name' is valid. */ void dns_adb_flushnames(dns_adb_t *adb, dns_name_t *name); /*%< * Flush 'name' and all subdomains from the adb cache. * * Requires: *\li 'adb' is valid. *\li 'name' is valid. */ void dns_adb_setcookie(dns_adb_t *adb, dns_adbaddrinfo_t *addr, const unsigned char *cookie, size_t len); /*%< * Record the COOKIE associated with this addresss. If * cookie is NULL or len is zero the recorded COOKIE is cleared. * * Requires: *\li 'adb' is valid. *\li 'addr' is valid. */ size_t dns_adb_getcookie(dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned char *cookie, size_t len); /* * Retieve the saved COOKIE value and store it in 'cookie' which has * size 'len'. * * Requires: *\li 'adb' is valid. *\li 'addr' is valid. * * Returns: * The size of the cookie or zero if it doesn't fit in the buffer * or it doesn't exist. */ void dns_adb_setquota(dns_adb_t *adb, isc_uint32_t quota, isc_uint32_t freq, double low, double high, double discount); /*%< * Set the baseline ADB quota, and configure parameters for the * quota adjustment algorithm. * * If the number of fetches currently waiting for responses from this * address exceeds the current quota, then additional fetches are spilled. * * 'quota' is the highest permissible quota; it will adjust itself * downward in response to detected congestion. * * After every 'freq' fetches have either completed or timed out, an * exponentially weighted moving average of the ratio of timeouts * to responses is calculated. If the EWMA goes above a 'high' * threshold, then the quota is adjusted down one step; if it drops * below a 'low' threshold, then the quota is adjusted back up one * step. * * The quota adjustment is based on the function (1 / 1 + (n/10)^(3/2)), * for values of n from 0 to 99. It starts at 100% of the baseline * quota, and descends after 100 steps to 2%. * * 'discount' represents the discount rate of the moving average. Higher * values cause older values to be discounted sooner, providing a faster * response to changes in the timeout ratio. * * Requires: *\li 'adb' is valid. */ isc_boolean_t dns_adbentry_overquota(dns_adbentry_t *entry); /*%< * Returns true if the specified ADB has too many active fetches. * * Requires: *\li 'entry' is valid. */ void dns_adb_beginudpfetch(dns_adb_t *adb, dns_adbaddrinfo_t *addr); void dns_adb_endudpfetch(dns_adb_t *adb, dns_adbaddrinfo_t *addr); /*% * Begin/end a UDP fetch on a particular address. * * These functions increment or decrement the fetch counter for * the ADB entry so that the fetch quota can be enforced. * * Requires: * *\li adb be valid. * *\li addr be valid. */ ISC_LANG_ENDDECLS #endif /* DNS_ADB_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/lookup.h����������������������������������������������������������������������������������0000644�����������������00000005553�14763166026�0010042 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_LOOKUP_H #define DNS_LOOKUP_H 1 /***** ***** Module Info *****/ /*! \file dns/lookup.h * \brief * The lookup module performs simple DNS lookups. It implements * the full resolver algorithm, both looking for local data and * resolving external names as necessary. * * MP: *\li The module ensures appropriate synchronization of data structures it * creates and manipulates. * * Reliability: *\li No anticipated impact. * * Resources: *\li TBS * * Security: *\li No anticipated impact. * * Standards: *\li RFCs: 1034, 1035, 2181, TBS *\li Drafts: TBS */ #include <isc/lang.h> #include <isc/event.h> #include <dns/types.h> ISC_LANG_BEGINDECLS /*% * A 'dns_lookupevent_t' is returned when a lookup completes. * The sender field will be set to the lookup that completed. If 'result' * is ISC_R_SUCCESS, then 'names' will contain a list of names associated * with the address. The recipient of the event must not change the list * and must not refer to any of the name data after the event is freed. */ typedef struct dns_lookupevent { ISC_EVENT_COMMON(struct dns_lookupevent); isc_result_t result; dns_name_t *name; dns_rdataset_t *rdataset; dns_rdataset_t *sigrdataset; dns_db_t *db; dns_dbnode_t *node; } dns_lookupevent_t; isc_result_t dns_lookup_create(isc_mem_t *mctx, dns_name_t *name, dns_rdatatype_t type, dns_view_t *view, unsigned int options, isc_task_t *task, isc_taskaction_t action, void *arg, dns_lookup_t **lookupp); /*%< * Finds the rrsets matching 'name' and 'type'. * * Requires: * *\li 'mctx' is a valid mctx. * *\li 'name' is a valid name. * *\li 'view' is a valid view which has a resolver. * *\li 'task' is a valid task. * *\li lookupp != NULL && *lookupp == NULL * * Returns: * *\li ISC_R_SUCCESS *\li ISC_R_NOMEMORY * *\li Any resolver-related error (e.g. ISC_R_SHUTTINGDOWN) may also be * returned. */ void dns_lookup_cancel(dns_lookup_t *lookup); /*%< * Cancel 'lookup'. * * Notes: * *\li If 'lookup' has not completed, post its LOOKUPDONE event with a * result code of ISC_R_CANCELED. * * Requires: * *\li 'lookup' is a valid lookup. */ void dns_lookup_destroy(dns_lookup_t **lookupp); /*%< * Destroy 'lookup'. * * Requires: * *\li '*lookupp' is a valid lookup. * *\li The caller has received the LOOKUPDONE event (either because the * lookup completed or because dns_lookup_cancel() was called). * * Ensures: * *\li *lookupp == NULL. */ ISC_LANG_ENDDECLS #endif /* DNS_LOOKUP_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/log.h�������������������������������������������������������������������������������������0000644�����������������00000007573�14763166026�0007316 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! \file dns/log.h */ #ifndef DNS_LOG_H #define DNS_LOG_H 1 #include <isc/lang.h> #include <isc/log.h> LIBDNS_EXTERNAL_DATA extern isc_log_t *dns_lctx; LIBDNS_EXTERNAL_DATA extern isc_logcategory_t dns_categories[]; LIBDNS_EXTERNAL_DATA extern isc_logmodule_t dns_modules[]; #define DNS_LOGCATEGORY_NOTIFY (&dns_categories[0]) #define DNS_LOGCATEGORY_DATABASE (&dns_categories[1]) #define DNS_LOGCATEGORY_SECURITY (&dns_categories[2]) /* DNS_LOGCATEGORY_CONFIG superseded by CFG_LOGCATEGORY_CONFIG */ #define DNS_LOGCATEGORY_DNSSEC (&dns_categories[4]) #define DNS_LOGCATEGORY_RESOLVER (&dns_categories[5]) #define DNS_LOGCATEGORY_XFER_IN (&dns_categories[6]) #define DNS_LOGCATEGORY_XFER_OUT (&dns_categories[7]) #define DNS_LOGCATEGORY_DISPATCH (&dns_categories[8]) #define DNS_LOGCATEGORY_LAME_SERVERS (&dns_categories[9]) #define DNS_LOGCATEGORY_DELEGATION_ONLY (&dns_categories[10]) #define DNS_LOGCATEGORY_EDNS_DISABLED (&dns_categories[11]) #define DNS_LOGCATEGORY_RPZ (&dns_categories[12]) #define DNS_LOGCATEGORY_RRL (&dns_categories[13]) #define DNS_LOGCATEGORY_CNAME (&dns_categories[14]) #define DNS_LOGCATEGORY_SPILL (&dns_categories[15]) #define DNS_LOGCATEGORY_DNSTAP (&dns_categories[16]) /* Backwards compatibility. */ #define DNS_LOGCATEGORY_GENERAL ISC_LOGCATEGORY_GENERAL #define DNS_LOGMODULE_DB (&dns_modules[0]) #define DNS_LOGMODULE_RBTDB (&dns_modules[1]) #define DNS_LOGMODULE_RBTDB64 (&dns_modules[2]) #define DNS_LOGMODULE_RBT (&dns_modules[3]) #define DNS_LOGMODULE_RDATA (&dns_modules[4]) #define DNS_LOGMODULE_MASTER (&dns_modules[5]) #define DNS_LOGMODULE_MESSAGE (&dns_modules[6]) #define DNS_LOGMODULE_CACHE (&dns_modules[7]) #define DNS_LOGMODULE_CONFIG (&dns_modules[8]) #define DNS_LOGMODULE_RESOLVER (&dns_modules[9]) #define DNS_LOGMODULE_ZONE (&dns_modules[10]) #define DNS_LOGMODULE_JOURNAL (&dns_modules[11]) #define DNS_LOGMODULE_ADB (&dns_modules[12]) #define DNS_LOGMODULE_XFER_IN (&dns_modules[13]) #define DNS_LOGMODULE_XFER_OUT (&dns_modules[14]) #define DNS_LOGMODULE_ACL (&dns_modules[15]) #define DNS_LOGMODULE_VALIDATOR (&dns_modules[16]) #define DNS_LOGMODULE_DISPATCH (&dns_modules[17]) #define DNS_LOGMODULE_REQUEST (&dns_modules[18]) #define DNS_LOGMODULE_MASTERDUMP (&dns_modules[19]) #define DNS_LOGMODULE_TSIG (&dns_modules[20]) #define DNS_LOGMODULE_TKEY (&dns_modules[21]) #define DNS_LOGMODULE_SDB (&dns_modules[22]) #define DNS_LOGMODULE_DIFF (&dns_modules[23]) #define DNS_LOGMODULE_HINTS (&dns_modules[24]) #define DNS_LOGMODULE_ACACHE (&dns_modules[25]) #define DNS_LOGMODULE_DLZ (&dns_modules[26]) #define DNS_LOGMODULE_DNSSEC (&dns_modules[27]) #define DNS_LOGMODULE_CRYPTO (&dns_modules[28]) #define DNS_LOGMODULE_PACKETS (&dns_modules[29]) #define DNS_LOGMODULE_NTA (&dns_modules[30]) #define DNS_LOGMODULE_DYNDB (&dns_modules[31]) #define DNS_LOGMODULE_DNSTAP (&dns_modules[32]) #define DNS_LOGMODULE_SSU (&dns_modules[33]) ISC_LANG_BEGINDECLS void dns_log_init(isc_log_t *lctx); /*% * Make the libdns categories and modules available for use with the * ISC logging library. * * Requires: *\li lctx is a valid logging context. * *\li dns_log_init() is called only once. * * Ensures: * \li The categories and modules defined above are available for * use by isc_log_usechannnel() and isc_log_write(). */ void dns_log_setcontext(isc_log_t *lctx); /*% * Make the libdns library use the provided context for logging internal * messages. * * Requires: *\li lctx is a valid logging context. */ ISC_LANG_ENDDECLS #endif /* DNS_LOG_H */ �������������������������������������������������������������������������������������������������������������������������������������bind9/dns/ssu.h�������������������������������������������������������������������������������������0000644�����������������00000020130�14763166026�0007327 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_SSU_H #define DNS_SSU_H 1 /*! \file dns/ssu.h */ #include <isc/lang.h> #include <dns/acl.h> #include <dns/types.h> #include <dst/dst.h> ISC_LANG_BEGINDECLS typedef enum { dns_ssumatchtype_name = 0, dns_ssumatchtype_subdomain = 1, dns_ssumatchtype_wildcard = 2, dns_ssumatchtype_self = 3, dns_ssumatchtype_selfsub = 4, dns_ssumatchtype_selfwild = 5, dns_ssumatchtype_selfkrb5 = 6, dns_ssumatchtype_selfms = 7, dns_ssumatchtype_subdomainms = 8, dns_ssumatchtype_subdomainkrb5 = 9, dns_ssumatchtype_tcpself = 10, dns_ssumatchtype_6to4self = 11, dns_ssumatchtype_external = 12, dns_ssumatchtype_local = 13, dns_ssumatchtype_max = 13, /* max value */ dns_ssumatchtype_dlz = 14 /* intentionally higher than _max */ } dns_ssumatchtype_t; #define DNS_SSUMATCHTYPE_NAME dns_ssumatchtype_name #define DNS_SSUMATCHTYPE_SUBDOMAIN dns_ssumatchtype_subdomain #define DNS_SSUMATCHTYPE_WILDCARD dns_ssumatchtype_wildcard #define DNS_SSUMATCHTYPE_SELF dns_ssumatchtype_self #define DNS_SSUMATCHTYPE_SELFSUB dns_ssumatchtype_selfsub #define DNS_SSUMATCHTYPE_SELFWILD dns_ssumatchtype_selfwild #define DNS_SSUMATCHTYPE_SELFKRB5 dns_ssumatchtype_selfkrb5 #define DNS_SSUMATCHTYPE_SELFMS dns_ssumatchtype_selfms #define DNS_SSUMATCHTYPE_SUBDOMAINMS dns_ssumatchtype_subdomainms #define DNS_SSUMATCHTYPE_SUBDOMAINKRB5 dns_ssumatchtype_subdomainkrb5 #define DNS_SSUMATCHTYPE_TCPSELF dns_ssumatchtype_tcpself #define DNS_SSUMATCHTYPE_6TO4SELF dns_ssumatchtype_6to4self #define DNS_SSUMATCHTYPE_EXTERNAL dns_ssumatchtype_external #define DNS_SSUMATCHTYPE_LOCAL dns_ssumatchtype_local #define DNS_SSUMATCHTYPE_MAX dns_ssumatchtype_max /* max value */ #define DNS_SSUMATCHTYPE_DLZ dns_ssumatchtype_dlz /* intentionally higher than _MAX */ isc_result_t dns_ssutable_create(isc_mem_t *mctx, dns_ssutable_t **table); /*%< * Creates a table that will be used to store simple-secure-update rules. * Note: all locking must be provided by the client. * * Requires: *\li 'mctx' is a valid memory context *\li 'table' is not NULL, and '*table' is NULL * * Returns: *\li ISC_R_SUCCESS *\li ISC_R_NOMEMORY */ isc_result_t dns_ssutable_createdlz(isc_mem_t *mctx, dns_ssutable_t **tablep, dns_dlzdb_t *dlzdatabase); /*%< * Create an SSU table that contains a dlzdatabase pointer, and a * single rule with matchtype DNS_SSUMATCHTYPE_DLZ. This type of SSU * table is used by writeable DLZ drivers to offload authorization for * updates to the driver. */ void dns_ssutable_attach(dns_ssutable_t *source, dns_ssutable_t **targetp); /*%< * Attach '*targetp' to 'source'. * * Requires: *\li 'source' is a valid SSU table *\li 'targetp' points to a NULL dns_ssutable_t *. * * Ensures: *\li *targetp is attached to source. */ void dns_ssutable_detach(dns_ssutable_t **tablep); /*%< * Detach '*tablep' from its simple-secure-update rule table. * * Requires: *\li 'tablep' points to a valid dns_ssutable_t * * Ensures: *\li *tablep is NULL *\li If '*tablep' is the last reference to the SSU table, all * resources used by the table will be freed. */ isc_result_t dns_ssutable_addrule(dns_ssutable_t *table, isc_boolean_t grant, dns_name_t *identity, unsigned int matchtype, dns_name_t *name, unsigned int ntypes, dns_rdatatype_t *types); /*%< * Adds a new rule to a simple-secure-update rule table. The rule * either grants or denies update privileges of an identity (or set of * identities) to modify a name (or set of names) or certain types present * at that name. * * Notes: *\li If 'matchtype' is of SELF type, this rule only matches if the * name to be updated matches the signing identity. * *\li If 'ntypes' is 0, this rule applies to all types except * NS, SOA, RRSIG, and NSEC. * *\li If 'types' includes ANY, this rule applies to all types * except NSEC. * * Requires: *\li 'table' is a valid SSU table *\li 'identity' is a valid absolute name *\li 'matchtype' must be one of the defined constants. *\li 'name' is a valid absolute name *\li If 'ntypes' > 0, 'types' must not be NULL * * Returns: *\li ISC_R_SUCCESS *\li ISC_R_NOMEMORY */ isc_boolean_t dns_ssutable_checkrules(dns_ssutable_t *table, dns_name_t *signer, dns_name_t *name, isc_netaddr_t *addr, dns_rdatatype_t type, const dst_key_t *key); isc_boolean_t dns_ssutable_checkrules2(dns_ssutable_t *table, dns_name_t *signer, dns_name_t *name, isc_netaddr_t *addr, isc_boolean_t tcp, const dns_aclenv_t *env, dns_rdatatype_t type, const dst_key_t *key); /*%< * Checks that the attempted update of (name, type) is allowed according * to the rules specified in the simple-secure-update rule table. If * no rules are matched, access is denied. * * Notes: * In dns_ssutable_checkrules(), 'addr' should only be * set if the request received via TCP. This provides a * weak assurance that the request was not spoofed. * 'addr' is to to validate DNS_SSUMATCHTYPE_TCPSELF * and DNS_SSUMATCHTYPE_6TO4SELF rules. * * In dns_ssutable_checkrules2(), 'addr' can also be passed for * UDP requests and TCP is specified via the 'tcp' parameter. * In addition to DNS_SSUMATCHTYPE_TCPSELF and * tcp_ssumatchtype_6to4self rules, the address * also be used to check DNS_SSUMATCHTYPE_LOCAL rules. * If 'addr' is set then 'env' must also be set so that * requests from non-localhost addresses can be rejected. * * For DNS_SSUMATCHTYPE_TCPSELF the addresses are mapped to * the standard reverse names under IN-ADDR.ARPA and IP6.ARPA. * RFC 1035, Section 3.5, "IN-ADDR.ARPA domain" and RFC 3596, * Section 2.5, "IP6.ARPA Domain". * * For DNS_SSUMATCHTYPE_6TO4SELF, IPv4 address are converted * to a 6to4 prefix (48 bits) per the rules in RFC 3056. Only * the top 48 bits of the IPv6 address are mapped to the reverse * name. This is independent of whether the most significant 16 * bits match 2002::/16, assigned for 6to4 prefixes, or not. * * Requires: *\li 'table' is a valid SSU table *\li 'signer' is NULL or a valid absolute name *\li 'addr' is NULL or a valid network address. *\li 'aclenv' is NULL or a valid ACL environment. *\li 'name' is a valid absolute name *\li if 'addr' is not NULL, 'env' is not NULL. */ /*% Accessor functions to extract rule components */ isc_boolean_t dns_ssurule_isgrant(const dns_ssurule_t *rule); /*% Accessor functions to extract rule components */ dns_name_t * dns_ssurule_identity(const dns_ssurule_t *rule); /*% Accessor functions to extract rule components */ unsigned int dns_ssurule_matchtype(const dns_ssurule_t *rule); /*% Accessor functions to extract rule components */ dns_name_t * dns_ssurule_name(const dns_ssurule_t *rule); /*% Accessor functions to extract rule components */ unsigned int dns_ssurule_types(const dns_ssurule_t *rule, dns_rdatatype_t **types); isc_result_t dns_ssutable_firstrule(const dns_ssutable_t *table, dns_ssurule_t **rule); /*%< * Initiates a rule iterator. There is no need to maintain any state. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMORE */ isc_result_t dns_ssutable_nextrule(dns_ssurule_t *rule, dns_ssurule_t **nextrule); /*%< * Returns the next rule in the table. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMORE */ isc_boolean_t dns_ssu_external_match(dns_name_t *identity, dns_name_t *signer, dns_name_t *name, isc_netaddr_t *tcpaddr, dns_rdatatype_t type, const dst_key_t *key, isc_mem_t *mctx); /*%< * Check a policy rule via an external application */ isc_result_t dns_ssu_mtypefromstring(const char *str, dns_ssumatchtype_t *mtype); /*%< * Set 'mtype' from 'str' * * Requires: *\li 'str' is not NULL. *\li 'mtype' is not NULL, * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOTFOUND */ ISC_LANG_ENDDECLS #endif /* DNS_SSU_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/message.h���������������������������������������������������������������������������������0000644�����������������00000114433�14763166026�0010153 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_MESSAGE_H #define DNS_MESSAGE_H 1 /*** *** Imports ***/ #include <isc/lang.h> #include <isc/magic.h> #include <dns/compress.h> #include <dns/masterdump.h> #include <dns/types.h> #include <dst/dst.h> /*! \file dns/message.h * \brief Message Handling Module * * How this beast works: * * When a dns message is received in a buffer, dns_message_parse() is called * on the memory region. Various items are checked including the format * of the message (if counts are right, if counts consume the entire sections, * and if sections consume the entire message) and known pseudo-RRs in the * additional data section are analyzed and removed. * * TSIG checking is also done at this layer, and any DNSSEC transaction * signatures should also be checked here. * * Notes on using the gettemp*() and puttemp*() functions: * * These functions return items (names, rdatasets, etc) allocated from some * internal state of the dns_message_t. * * Names and rdatasets must be put back into the dns_message_t in * one of two ways. Assume a name was allocated via * dns_message_gettempname(): * *\li (1) insert it into a section, using dns_message_addname(). * *\li (2) return it to the message using dns_message_puttempname(). * * The same applies to rdatasets. * * On the other hand, offsets, rdatalists and rdatas allocated using * dns_message_gettemp*() will always be freed automatically * when the message is reset or destroyed; calling dns_message_puttemp*() * on rdatalists and rdatas is optional and serves only to enable the item * to be reused multiple times during the lifetime of the message; offsets * cannot be reused. * * Buffers allocated using isc_buffer_allocate() can be automatically freed * as well by giving the buffer to the message using dns_message_takebuffer(). * Doing this will cause the buffer to be freed using isc_buffer_free() * when the section lists are cleared, such as in a reset or in a destroy. * Since the buffer itself exists until the message is destroyed, this sort * of code can be written: * * \code * buffer = isc_buffer_allocate(mctx, 512); * name = NULL; * name = dns_message_gettempname(message, &name); * dns_name_init(name, NULL); * result = dns_name_fromtext(name, &source, dns_rootname, 0, buffer); * dns_message_takebuffer(message, &buffer); * \endcode * * * TODO: * * XXX Needed: ways to set and retrieve EDNS information, add rdata to a * section, move rdata from one section to another, remove rdata, etc. */ #define DNS_MESSAGEFLAG_QR 0x8000U #define DNS_MESSAGEFLAG_AA 0x0400U #define DNS_MESSAGEFLAG_TC 0x0200U #define DNS_MESSAGEFLAG_RD 0x0100U #define DNS_MESSAGEFLAG_RA 0x0080U #define DNS_MESSAGEFLAG_AD 0x0020U #define DNS_MESSAGEFLAG_CD 0x0010U /*%< EDNS0 extended message flags */ #define DNS_MESSAGEEXTFLAG_DO 0x8000U /*%< EDNS0 extended OPT codes */ #define DNS_OPT_NSID 3 /*%< NSID opt code */ #define DNS_OPT_CLIENT_SUBNET 8 /*%< client subnet opt code */ #define DNS_OPT_EXPIRE 9 /*%< EXPIRE opt code */ #define DNS_OPT_COOKIE 10 /*%< COOKIE opt code */ #define DNS_OPT_PAD 12 /*%< PAD opt code */ #define DNS_OPT_KEY_TAG 14 /*%< Key tag opt code */ /*%< Experimental options [65001...65534] as per RFC6891 */ /*%< The number of EDNS options we know about. */ #define DNS_EDNSOPTIONS 5 #define DNS_MESSAGE_REPLYPRESERVE (DNS_MESSAGEFLAG_RD|DNS_MESSAGEFLAG_CD) #define DNS_MESSAGEEXTFLAG_REPLYPRESERVE (DNS_MESSAGEEXTFLAG_DO) #define DNS_MESSAGE_HEADERLEN 12 /*%< 6 isc_uint16_t's */ #define DNS_MESSAGE_MAGIC ISC_MAGIC('M','S','G','@') #define DNS_MESSAGE_VALID(msg) ISC_MAGIC_VALID(msg, DNS_MESSAGE_MAGIC) /* * Ordering here matters. DNS_SECTION_ANY must be the lowest and negative, * and DNS_SECTION_MAX must be one greater than the last used section. */ typedef int dns_section_t; #define DNS_SECTION_ANY (-1) #define DNS_SECTION_QUESTION 0 #define DNS_SECTION_ANSWER 1 #define DNS_SECTION_AUTHORITY 2 #define DNS_SECTION_ADDITIONAL 3 #define DNS_SECTION_MAX 4 typedef int dns_pseudosection_t; #define DNS_PSEUDOSECTION_ANY (-1) #define DNS_PSEUDOSECTION_OPT 0 #define DNS_PSEUDOSECTION_TSIG 1 #define DNS_PSEUDOSECTION_SIG0 2 #define DNS_PSEUDOSECTION_MAX 3 typedef int dns_messagetextflag_t; #define DNS_MESSAGETEXTFLAG_NOCOMMENTS 0x0001 #define DNS_MESSAGETEXTFLAG_NOHEADERS 0x0002 #define DNS_MESSAGETEXTFLAG_ONESOA 0x0004 #define DNS_MESSAGETEXTFLAG_OMITSOA 0x0008 /* * Dynamic update names for these sections. */ #define DNS_SECTION_ZONE DNS_SECTION_QUESTION #define DNS_SECTION_PREREQUISITE DNS_SECTION_ANSWER #define DNS_SECTION_UPDATE DNS_SECTION_AUTHORITY /* * These tell the message library how the created dns_message_t will be used. */ #define DNS_MESSAGE_INTENTUNKNOWN 0 /*%< internal use only */ #define DNS_MESSAGE_INTENTPARSE 1 /*%< parsing messages */ #define DNS_MESSAGE_INTENTRENDER 2 /*%< rendering */ /* * Control behavior of parsing */ #define DNS_MESSAGEPARSE_PRESERVEORDER 0x0001 /*%< preserve rdata order */ #define DNS_MESSAGEPARSE_BESTEFFORT 0x0002 /*%< return a message if a recoverable parse error occurs */ #define DNS_MESSAGEPARSE_CLONEBUFFER 0x0004 /*%< save a copy of the source buffer */ #define DNS_MESSAGEPARSE_IGNORETRUNCATION 0x0008 /*%< truncation errors are * not fatal. */ /* * Control behavior of rendering */ #define DNS_MESSAGERENDER_ORDERED 0x0001 /*%< don't change order */ #define DNS_MESSAGERENDER_PARTIAL 0x0002 /*%< allow a partial rdataset */ #define DNS_MESSAGERENDER_OMITDNSSEC 0x0004 /*%< omit DNSSEC records */ #define DNS_MESSAGERENDER_PREFER_A 0x0008 /*%< prefer A records in additional section. */ #define DNS_MESSAGERENDER_PREFER_AAAA 0x0010 /*%< prefer AAAA records in additional section. */ #ifdef ALLOW_FILTER_AAAA #define DNS_MESSAGERENDER_FILTER_AAAA 0x0020 /*%< filter AAAA records */ #endif typedef struct dns_msgblock dns_msgblock_t; struct dns_message { /* public from here down */ unsigned int magic; dns_messageid_t id; unsigned int flags; dns_rcode_t rcode; dns_opcode_t opcode; dns_rdataclass_t rdclass; /* 4 real, 1 pseudo */ unsigned int counts[DNS_SECTION_MAX]; /* private from here down */ dns_namelist_t sections[DNS_SECTION_MAX]; dns_name_t *cursors[DNS_SECTION_MAX]; dns_rdataset_t *opt; dns_rdataset_t *sig0; dns_rdataset_t *tsig; int state; unsigned int from_to_wire : 2; unsigned int header_ok : 1; unsigned int question_ok : 1; unsigned int tcp_continuation : 1; unsigned int verified_sig : 1; unsigned int verify_attempted : 1; unsigned int free_query : 1; unsigned int free_saved : 1; unsigned int cc_ok : 1; unsigned int cc_bad : 1; unsigned int tkey : 1; unsigned int rdclass_set : 1; unsigned int opt_reserved; unsigned int sig_reserved; unsigned int reserved; /* reserved space (render) */ isc_buffer_t *buffer; dns_compress_t *cctx; isc_mem_t *mctx; isc_mempool_t *namepool; isc_mempool_t *rdspool; isc_bufferlist_t scratchpad; isc_bufferlist_t cleanup; ISC_LIST(dns_msgblock_t) rdatas; ISC_LIST(dns_msgblock_t) rdatalists; ISC_LIST(dns_msgblock_t) offsets; ISC_LIST(dns_rdata_t) freerdata; ISC_LIST(dns_rdatalist_t) freerdatalist; dns_rcode_t tsigstatus; dns_rcode_t querytsigstatus; dns_name_t *tsigname; /* Owner name of TSIG, if any */ dns_rdataset_t *querytsig; dns_tsigkey_t *tsigkey; dst_context_t *tsigctx; int sigstart; int timeadjust; dns_name_t *sig0name; /* Owner name of SIG0, if any */ dst_key_t *sig0key; dns_rcode_t sig0status; isc_region_t query; isc_region_t saved; dns_rdatasetorderfunc_t order; const void * order_arg; }; struct dns_ednsopt { isc_uint16_t code; isc_uint16_t length; unsigned char *value; }; /*** *** Functions ***/ ISC_LANG_BEGINDECLS isc_result_t dns_message_create(isc_mem_t *mctx, unsigned int intent, dns_message_t **msgp); /*%< * Create msg structure. * * This function will allocate some internal blocks of memory that are * expected to be needed for parsing or rendering nearly any type of message. * * Requires: *\li 'mctx' be a valid memory context. * *\li 'msgp' be non-null and '*msg' be NULL. * *\li 'intent' must be one of DNS_MESSAGE_INTENTPARSE or * #DNS_MESSAGE_INTENTRENDER. * * Ensures: *\li The data in "*msg" is set to indicate an unused and empty msg * structure. * * Returns: *\li #ISC_R_NOMEMORY -- out of memory *\li #ISC_R_SUCCESS -- success */ void dns_message_reset(dns_message_t *msg, unsigned int intent); /*%< * Reset a message structure to default state. All internal lists are freed * or reset to a default state as well. This is simply a more efficient * way to call dns_message_destroy() followed by dns_message_allocate(), * since it avoid many memory allocations. * * If any data loanouts (buffers, names, rdatas, etc) were requested, * the caller must no longer use them after this call. * * The intended next use of the message will be 'intent'. * * Requires: * *\li 'msg' be valid. * *\li 'intent' is DNS_MESSAGE_INTENTPARSE or DNS_MESSAGE_INTENTRENDER */ void dns_message_destroy(dns_message_t **msgp); /*%< * Destroy all state in the message. * * Requires: * *\li 'msgp' be valid. * * Ensures: *\li '*msgp' == NULL */ isc_result_t dns_message_sectiontotext(dns_message_t *msg, dns_section_t section, const dns_master_style_t *style, dns_messagetextflag_t flags, isc_buffer_t *target); isc_result_t dns_message_pseudosectiontotext(dns_message_t *msg, dns_pseudosection_t section, const dns_master_style_t *style, dns_messagetextflag_t flags, isc_buffer_t *target); /*%< * Convert section 'section' or 'pseudosection' of message 'msg' to * a cleartext representation * * Notes: * \li See dns_message_totext for meanings of flags. * * Requires: * *\li 'msg' is a valid message. * *\li 'style' is a valid master dump style. * *\li 'target' is a valid buffer. * *\li 'section' is a valid section label. * * Ensures: * *\li If the result is success: * The used space in 'target' is updated. * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_NOSPACE *\li #ISC_R_NOMORE * *\li Note: On error return, *target may be partially filled with data. */ isc_result_t dns_message_totext(dns_message_t *msg, const dns_master_style_t *style, dns_messagetextflag_t flags, isc_buffer_t *target); /*%< * Convert all sections of message 'msg' to a cleartext representation * * Notes on flags: *\li If #DNS_MESSAGETEXTFLAG_NOCOMMENTS is cleared, lines beginning with * ";;" will be emitted indicating section name. *\li If #DNS_MESSAGETEXTFLAG_NOHEADERS is cleared, header lines will be * emitted. *\li If #DNS_MESSAGETEXTFLAG_ONESOA is set then only print the first * SOA record in the answer section. *\li If *#DNS_MESSAGETEXTFLAG_OMITSOA is set don't print any SOA records * in the answer section. * * The SOA flags are useful for suppressing the display of the second * SOA record in an AXFR by setting #DNS_MESSAGETEXTFLAG_ONESOA on the * first message in an AXFR stream and #DNS_MESSAGETEXTFLAG_OMITSOA on * subsequent messages. * * Requires: * *\li 'msg' is a valid message. * *\li 'style' is a valid master dump style. * *\li 'target' is a valid buffer. * * Ensures: * *\li If the result is success: * The used space in 'target' is updated. * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_NOSPACE *\li #ISC_R_NOMORE * *\li Note: On error return, *target may be partially filled with data. */ isc_result_t dns_message_parse(dns_message_t *msg, isc_buffer_t *source, unsigned int options); /*%< * Parse raw wire data in 'source' as a DNS message. * * OPT records are detected and stored in the pseudo-section "opt". * TSIGs are detected and stored in the pseudo-section "tsig". * * If #DNS_MESSAGEPARSE_PRESERVEORDER is set, or if the opcode of the message * is UPDATE, a separate dns_name_t object will be created for each RR in the * message. Each such dns_name_t will have a single rdataset containing the * single RR, and the order of the RRs in the message is preserved. * Otherwise, only one dns_name_t object will be created for each unique * owner name in the section, and each such dns_name_t will have a list * of rdatasets. To access the names and their data, use * dns_message_firstname() and dns_message_nextname(). * * If #DNS_MESSAGEPARSE_BESTEFFORT is set, errors in message content will * not be considered FORMERRs. If the entire message can be parsed, it * will be returned and DNS_R_RECOVERABLE will be returned. * * If #DNS_MESSAGEPARSE_IGNORETRUNCATION is set then return as many complete * RR's as possible, DNS_R_RECOVERABLE will be returned. * * OPT and TSIG records are always handled specially, regardless of the * 'preserve_order' setting. * * Requires: *\li "msg" be valid. * *\li "buffer" be a wire format buffer. * * Ensures: *\li The buffer's data format is correct. * *\li The buffer's contents verify as correct regarding header bits, buffer * and rdata sizes, etc. * * Returns: *\li #ISC_R_SUCCESS -- all is well *\li #ISC_R_NOMEMORY -- no memory *\li #DNS_R_RECOVERABLE -- the message parsed properly, but contained * errors. *\li Many other errors possible XXXMLG */ isc_result_t dns_message_renderbegin(dns_message_t *msg, dns_compress_t *cctx, isc_buffer_t *buffer); /*%< * Begin rendering on a message. Only one call can be made to this function * per message. * * The compression context is "owned" by the message library until * dns_message_renderend() is called. It must be invalidated by the caller. * * The buffer is "owned" by the message library until dns_message_renderend() * is called. * * Requires: * *\li 'msg' be valid. * *\li 'cctx' be valid. * *\li 'buffer' is a valid buffer. * * Side Effects: * *\li The buffer is cleared before it is used. * * Returns: *\li #ISC_R_SUCCESS -- all is well *\li #ISC_R_NOSPACE -- output buffer is too small */ isc_result_t dns_message_renderchangebuffer(dns_message_t *msg, isc_buffer_t *buffer); /*%< * Reset the buffer. This can be used after growing the old buffer * on a ISC_R_NOSPACE return from most of the render functions. * * On successful completion, the old buffer is no longer used by the * library. The new buffer is owned by the library until * dns_message_renderend() is called. * * Requires: * *\li 'msg' be valid. * *\li dns_message_renderbegin() was called. * *\li buffer != NULL. * * Returns: *\li #ISC_R_NOSPACE -- new buffer is too small *\li #ISC_R_SUCCESS -- all is well. */ isc_result_t dns_message_renderreserve(dns_message_t *msg, unsigned int space); /*%< * XXXMLG should use size_t rather than unsigned int once the buffer * API is cleaned up * * Reserve "space" bytes in the given buffer. * * Requires: * *\li 'msg' be valid. * *\li dns_message_renderbegin() was called. * * Returns: *\li #ISC_R_SUCCESS -- all is well. *\li #ISC_R_NOSPACE -- not enough free space in the buffer. */ void dns_message_renderrelease(dns_message_t *msg, unsigned int space); /*%< * XXXMLG should use size_t rather than unsigned int once the buffer * API is cleaned up * * Release "space" bytes in the given buffer that was previously reserved. * * Requires: * *\li 'msg' be valid. * *\li 'space' is less than or equal to the total amount of space reserved * via prior calls to dns_message_renderreserve(). * *\li dns_message_renderbegin() was called. */ isc_result_t dns_message_rendersection(dns_message_t *msg, dns_section_t section, unsigned int options); /*%< * Render all names, rdatalists, etc from the given section at the * specified priority or higher. * * Requires: *\li 'msg' be valid. * *\li 'section' be a valid section. * *\li dns_message_renderbegin() was called. * * Returns: *\li #ISC_R_SUCCESS -- all records were written, and there are * no more records for this section. *\li #ISC_R_NOSPACE -- Not enough room in the buffer to write * all records requested. *\li #DNS_R_MOREDATA -- All requested records written, and there * are records remaining for this section. */ void dns_message_renderheader(dns_message_t *msg, isc_buffer_t *target); /*%< * Render the message header. This is implicitly called by * dns_message_renderend(). * * Requires: * *\li 'msg' be a valid message. * *\li dns_message_renderbegin() was called. * *\li 'target' is a valid buffer with enough space to hold a message header */ isc_result_t dns_message_renderend(dns_message_t *msg); /*%< * Finish rendering to the buffer. Note that more data can be in the * 'msg' structure. Destroying the structure will free this, or in a multi- * part EDNS1 message this data can be rendered to another buffer later. * * Requires: * *\li 'msg' be a valid message. * *\li dns_message_renderbegin() was called. * * Returns: *\li #ISC_R_SUCCESS -- all is well. */ void dns_message_renderreset(dns_message_t *msg); /*%< * Reset the message so that it may be rendered again. * * Notes: * *\li If dns_message_renderbegin() has been called, dns_message_renderend() * must be called before calling this function. * * Requires: * *\li 'msg' be a valid message with rendering intent. */ isc_result_t dns_message_firstname(dns_message_t *msg, dns_section_t section); /*%< * Set internal per-section name pointer to the beginning of the section. * * The functions dns_message_firstname() and dns_message_nextname() may * be used for iterating over the owner names in a section. * * Requires: * *\li 'msg' be valid. * *\li 'section' be a valid section. * * Returns: *\li #ISC_R_SUCCESS -- All is well. *\li #ISC_R_NOMORE -- No names on given section. */ isc_result_t dns_message_nextname(dns_message_t *msg, dns_section_t section); /*%< * Sets the internal per-section name pointer to point to the next name * in that section. * * Requires: * * \li 'msg' be valid. * *\li 'section' be a valid section. * *\li dns_message_firstname() must have been called on this section, * and the result was ISC_R_SUCCESS. * * Returns: *\li #ISC_R_SUCCESS -- All is well. *\li #ISC_R_NOMORE -- No more names in given section. */ void dns_message_currentname(dns_message_t *msg, dns_section_t section, dns_name_t **name); /*%< * Sets 'name' to point to the name where the per-section internal name * pointer is currently set. * * This function returns the name in the database, so any data associated * with it (via the name's "list" member) contains the actual rdatasets. * * Requires: * *\li 'msg' be valid. * *\li 'name' be non-NULL, and *name be NULL. * *\li 'section' be a valid section. * *\li dns_message_firstname() must have been called on this section, * and the result of it and any dns_message_nextname() calls was * #ISC_R_SUCCESS. */ isc_result_t dns_message_findname(dns_message_t *msg, dns_section_t section, dns_name_t *target, dns_rdatatype_t type, dns_rdatatype_t covers, dns_name_t **foundname, dns_rdataset_t **rdataset); /*%< * Search for a name in the specified section. If it is found, *name is * set to point to the name, and *rdataset is set to point to the found * rdataset (if type is specified as other than dns_rdatatype_any). * * Requires: *\li 'msg' be valid. * *\li 'section' be a valid section. * *\li If a pointer to the name is desired, 'foundname' should be non-NULL. * If it is non-NULL, '*foundname' MUST be NULL. * *\li If a type other than dns_datatype_any is searched for, 'rdataset' * may be non-NULL, '*rdataset' be NULL, and will point at the found * rdataset. If the type is dns_datatype_any, 'rdataset' must be NULL. * *\li 'target' be a valid name. * *\li 'type' be a valid type. * *\li If 'type' is dns_rdatatype_rrsig, 'covers' must be a valid type. * Otherwise it should be 0. * * Returns: *\li #ISC_R_SUCCESS -- all is well. *\li #DNS_R_NXDOMAIN -- name does not exist in that section. *\li #DNS_R_NXRRSET -- The name does exist, but the desired * type does not. */ isc_result_t dns_message_findtype(dns_name_t *name, dns_rdatatype_t type, dns_rdatatype_t covers, dns_rdataset_t **rdataset); /*%< * Search the name for the specified type. If it is found, *rdataset is * filled in with a pointer to that rdataset. * * Requires: *\li if '**rdataset' is non-NULL, *rdataset needs to be NULL. * *\li 'type' be a valid type, and NOT dns_rdatatype_any. * *\li If 'type' is dns_rdatatype_rrsig, 'covers' must be a valid type. * Otherwise it should be 0. * * Returns: *\li #ISC_R_SUCCESS -- all is well. *\li #ISC_R_NOTFOUND -- the desired type does not exist. */ isc_result_t dns_message_find(dns_name_t *name, dns_rdataclass_t rdclass, dns_rdatatype_t type, dns_rdatatype_t covers, dns_rdataset_t **rdataset); /*%< * Search the name for the specified rdclass and type. If it is found, * *rdataset is filled in with a pointer to that rdataset. * * Requires: *\li if '**rdataset' is non-NULL, *rdataset needs to be NULL. * *\li 'type' be a valid type, and NOT dns_rdatatype_any. * *\li If 'type' is dns_rdatatype_rrsig, 'covers' must be a valid type. * Otherwise it should be 0. * * Returns: *\li #ISC_R_SUCCESS -- all is well. *\li #ISC_R_NOTFOUND -- the desired type does not exist. */ void dns_message_movename(dns_message_t *msg, dns_name_t *name, dns_section_t fromsection, dns_section_t tosection); /*%< * Move a name from one section to another. * * Requires: * *\li 'msg' be valid. * *\li 'name' must be a name already in 'fromsection'. * *\li 'fromsection' must be a valid section. * *\li 'tosection' must be a valid section. */ void dns_message_addname(dns_message_t *msg, dns_name_t *name, dns_section_t section); /*%< * Adds the name to the given section. * * It is the caller's responsibility to enforce any unique name requirements * in a section. * * Requires: * *\li 'msg' be valid, and be a renderable message. * *\li 'name' be a valid absolute name. * *\li 'section' be a named section. */ void dns_message_removename(dns_message_t *msg, dns_name_t *name, dns_section_t section); /*%< * Remove a existing name from a given section. * * It is the caller's responsibility to ensure the name is part of the * given section. * * Requires: * *\li 'msg' be valid, and be a renderable message. * *\li 'name' be a valid absolute name. * *\li 'section' be a named section. */ /* * LOANOUT FUNCTIONS * * Each of these functions loan a particular type of data to the caller. * The storage for these will vanish when the message is destroyed or * reset, and must NOT be used after these operations. */ isc_result_t dns_message_gettempname(dns_message_t *msg, dns_name_t **item); /*%< * Return a name that can be used for any temporary purpose, including * inserting into the message's linked lists. The name must be returned * to the message code using dns_message_puttempname() or inserted into * one of the message's sections before the message is destroyed. * * It is the caller's responsibility to initialize this name. * * Requires: *\li msg be a valid message * *\li item != NULL && *item == NULL * * Returns: *\li #ISC_R_SUCCESS -- All is well. *\li #ISC_R_NOMEMORY -- No item can be allocated. */ isc_result_t dns_message_gettempoffsets(dns_message_t *msg, dns_offsets_t **item); /*%< * Return an offsets array that can be used for any temporary purpose, * such as attaching to a temporary name. The offsets will be freed * when the message is destroyed or reset. * * Requires: *\li msg be a valid message * *\li item != NULL && *item == NULL * * Returns: *\li #ISC_R_SUCCESS -- All is well. *\li #ISC_R_NOMEMORY -- No item can be allocated. */ isc_result_t dns_message_gettemprdata(dns_message_t *msg, dns_rdata_t **item); /*%< * Return a rdata that can be used for any temporary purpose, including * inserting into the message's linked lists. The rdata will be freed * when the message is destroyed or reset. * * Requires: *\li msg be a valid message * *\li item != NULL && *item == NULL * * Returns: *\li #ISC_R_SUCCESS -- All is well. *\li #ISC_R_NOMEMORY -- No item can be allocated. */ isc_result_t dns_message_gettemprdataset(dns_message_t *msg, dns_rdataset_t **item); /*%< * Return a rdataset that can be used for any temporary purpose, including * inserting into the message's linked lists. The name must be returned * to the message code using dns_message_puttempname() or inserted into * one of the message's sections before the message is destroyed. * * Requires: *\li msg be a valid message * *\li item != NULL && *item == NULL * * Returns: *\li #ISC_R_SUCCESS -- All is well. *\li #ISC_R_NOMEMORY -- No item can be allocated. */ isc_result_t dns_message_gettemprdatalist(dns_message_t *msg, dns_rdatalist_t **item); /*%< * Return a rdatalist that can be used for any temporary purpose, including * inserting into the message's linked lists. The rdatalist will be * destroyed when the message is destroyed or reset. * * Requires: *\li msg be a valid message * *\li item != NULL && *item == NULL * * Returns: *\li #ISC_R_SUCCESS -- All is well. *\li #ISC_R_NOMEMORY -- No item can be allocated. */ void dns_message_puttempname(dns_message_t *msg, dns_name_t **item); /*%< * Return a borrowed name to the message's name free list. * * Requires: *\li msg be a valid message * *\li item != NULL && *item point to a name returned by * dns_message_gettempname() * * Ensures: *\li *item == NULL */ void dns_message_puttemprdata(dns_message_t *msg, dns_rdata_t **item); /*%< * Return a borrowed rdata to the message's rdata free list. * * Requires: *\li msg be a valid message * *\li item != NULL && *item point to a rdata returned by * dns_message_gettemprdata() * * Ensures: *\li *item == NULL */ void dns_message_puttemprdataset(dns_message_t *msg, dns_rdataset_t **item); /*%< * Return a borrowed rdataset to the message's rdataset free list. * * Requires: *\li msg be a valid message * *\li item != NULL && *item point to a rdataset returned by * dns_message_gettemprdataset() * * Ensures: *\li *item == NULL */ void dns_message_puttemprdatalist(dns_message_t *msg, dns_rdatalist_t **item); /*%< * Return a borrowed rdatalist to the message's rdatalist free list. * * Requires: *\li msg be a valid message * *\li item != NULL && *item point to a rdatalist returned by * dns_message_gettemprdatalist() * * Ensures: *\li *item == NULL */ isc_result_t dns_message_peekheader(isc_buffer_t *source, dns_messageid_t *idp, unsigned int *flagsp); /*%< * Assume the remaining region of "source" is a DNS message. Peek into * it and fill in "*idp" with the message id, and "*flagsp" with the flags. * * Requires: * *\li source != NULL * * Ensures: * *\li if (idp != NULL) *idp == message id. * *\li if (flagsp != NULL) *flagsp == message flags. * * Returns: * *\li #ISC_R_SUCCESS -- all is well. * *\li #ISC_R_UNEXPECTEDEND -- buffer doesn't contain enough for a header. */ isc_result_t dns_message_reply(dns_message_t *msg, isc_boolean_t want_question_section); /*%< * Start formatting a reply to the query in 'msg'. * * Requires: * *\li 'msg' is a valid message with parsing intent, and contains a query. * * Ensures: * *\li The message will have a rendering intent. If 'want_question_section' * is true, the message opcode is query or notify, and the question * section is present and properly formatted, then the question section * will be included in the reply. All other sections will be cleared. * The QR flag will be set, the RD flag will be preserved, and all other * flags will be cleared. * * Returns: * *\li #ISC_R_SUCCESS -- all is well. * *\li #DNS_R_FORMERR -- the header or question section of the * message is invalid, replying is impossible. * If DNS_R_FORMERR is returned when * want_question_section is ISC_FALSE, then * it's the header section that's bad; * otherwise either of the header or question * sections may be bad. */ dns_rdataset_t * dns_message_getopt(dns_message_t *msg); /*%< * Get the OPT record for 'msg'. * * Requires: * *\li 'msg' is a valid message. * * Returns: * *\li The OPT rdataset of 'msg', or NULL if there isn't one. */ isc_result_t dns_message_setopt(dns_message_t *msg, dns_rdataset_t *opt); /*%< * Set the OPT record for 'msg'. * * Requires: * *\li 'msg' is a valid message with rendering intent * and no sections have been rendered. * *\li 'opt' is a valid OPT record. * * Ensures: * *\li The OPT record has either been freed or ownership of it has * been transferred to the message. * *\li If ISC_R_SUCCESS was returned, the OPT record will be rendered * when dns_message_renderend() is called. * * Returns: * *\li #ISC_R_SUCCESS -- all is well. * *\li #ISC_R_NOSPACE -- there is no space for the OPT record. */ dns_rdataset_t * dns_message_gettsig(dns_message_t *msg, dns_name_t **owner); /*%< * Get the TSIG record and owner for 'msg'. * * Requires: * *\li 'msg' is a valid message. *\li 'owner' is NULL or *owner is NULL. * * Returns: * *\li The TSIG rdataset of 'msg', or NULL if there isn't one. * * Ensures: * * \li If 'owner' is not NULL, it will point to the owner name. */ isc_result_t dns_message_settsigkey(dns_message_t *msg, dns_tsigkey_t *key); /*%< * Set the tsig key for 'msg'. This is only necessary for when rendering a * query or parsing a response. The key (if non-NULL) is attached to, and * will be detached when the message is destroyed. * * Requires: * *\li 'msg' is a valid message with rendering intent, * dns_message_renderbegin() has been called, and no sections have been * rendered. *\li 'key' is a valid tsig key or NULL. * * Returns: * *\li #ISC_R_SUCCESS -- all is well. * *\li #ISC_R_NOSPACE -- there is no space for the TSIG record. */ dns_tsigkey_t * dns_message_gettsigkey(dns_message_t *msg); /*%< * Gets the tsig key for 'msg'. * * Requires: * *\li 'msg' is a valid message */ isc_result_t dns_message_setquerytsig(dns_message_t *msg, isc_buffer_t *querytsig); /*%< * Indicates that 'querytsig' is the TSIG from the signed query for which * 'msg' is the response. This is also used for chained TSIGs in TCP * responses. * * Requires: * *\li 'querytsig' is a valid buffer as returned by dns_message_getquerytsig() * or NULL * *\li 'msg' is a valid message * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY */ isc_result_t dns_message_getquerytsig(dns_message_t *msg, isc_mem_t *mctx, isc_buffer_t **querytsig); /*%< * Gets the tsig from the TSIG from the signed query 'msg'. This is also used * for chained TSIGs in TCP responses. Unlike dns_message_gettsig, this makes * a copy of the data, so can be used if the message is destroyed. * * Requires: * *\li 'msg' is a valid signed message *\li 'mctx' is a valid memory context *\li querytsig != NULL && *querytsig == NULL * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY * * Ensures: *\li 'tsig' points to NULL or an allocated buffer which must be freed * by the caller. */ dns_rdataset_t * dns_message_getsig0(dns_message_t *msg, dns_name_t **owner); /*%< * Get the SIG(0) record and owner for 'msg'. * * Requires: * *\li 'msg' is a valid message. *\li 'owner' is NULL or *owner is NULL. * * Returns: * *\li The SIG(0) rdataset of 'msg', or NULL if there isn't one. * * Ensures: * * \li If 'owner' is not NULL, it will point to the owner name. */ isc_result_t dns_message_setsig0key(dns_message_t *msg, dst_key_t *key); /*%< * Set the SIG(0) key for 'msg'. * * Requires: * *\li 'msg' is a valid message with rendering intent, * dns_message_renderbegin() has been called, and no sections have been * rendered. *\li 'key' is a valid sig key or NULL. * * Returns: * *\li #ISC_R_SUCCESS -- all is well. * *\li #ISC_R_NOSPACE -- there is no space for the SIG(0) record. */ dst_key_t * dns_message_getsig0key(dns_message_t *msg); /*%< * Gets the SIG(0) key for 'msg'. * * Requires: * *\li 'msg' is a valid message */ void dns_message_takebuffer(dns_message_t *msg, isc_buffer_t **buffer); /*%< * Give the *buffer to the message code to clean up when it is no * longer needed. This is usually when the message is reset or * destroyed. * * Requires: * *\li msg be a valid message. * *\li buffer != NULL && *buffer is a valid isc_buffer_t, which was * dynamically allocated via isc_buffer_allocate(). */ isc_result_t dns_message_signer(dns_message_t *msg, dns_name_t *signer); /*%< * If this message was signed, return the identity of the signer. * Unless ISC_R_NOTFOUND is returned, signer will reflect the name of the * key that signed the message. * * Requires: * *\li msg is a valid parsed message. *\li signer is a valid name * * Returns: * *\li #ISC_R_SUCCESS - the message was signed, and *signer * contains the signing identity * *\li #ISC_R_NOTFOUND - no TSIG or SIG(0) record is present in the * message * *\li #DNS_R_TSIGVERIFYFAILURE - the message was signed by a TSIG, but the * signature failed to verify * *\li #DNS_R_TSIGERRORSET - the message was signed by a TSIG and * verified, but the query was rejected by * the server * *\li #DNS_R_NOIDENTITY - the message was signed by a TSIG and * verified, but the key has no identity since * it was generated by an unsigned TKEY process * *\li #DNS_R_SIGINVALID - the message was signed by a SIG(0), but * the signature failed to verify * *\li #DNS_R_NOTVERIFIEDYET - the message was signed by a TSIG or SIG(0), * but the signature has not been verified yet */ isc_result_t dns_message_checksig(dns_message_t *msg, dns_view_t *view); /*%< * If this message was signed, verify the signature. * * Requires: * *\li msg is a valid parsed message. *\li view is a valid view or NULL * * Returns: * *\li #ISC_R_SUCCESS - the message was unsigned, or the message * was signed correctly. * *\li #DNS_R_EXPECTEDTSIG - A TSIG was expected, but not seen *\li #DNS_R_UNEXPECTEDTSIG - A TSIG was seen but not expected *\li #DNS_R_TSIGVERIFYFAILURE - The TSIG failed to verify */ isc_result_t dns_message_rechecksig(dns_message_t *msg, dns_view_t *view); /*%< * Reset the signature state and then if the message was signed, * verify the message. * * Requires: * *\li msg is a valid parsed message. *\li view is a valid view or NULL * * Returns: * *\li #ISC_R_SUCCESS - the message was unsigned, or the message * was signed correctly. * *\li #DNS_R_EXPECTEDTSIG - A TSIG was expected, but not seen *\li #DNS_R_UNEXPECTEDTSIG - A TSIG was seen but not expected *\li #DNS_R_TSIGVERIFYFAILURE - The TSIG failed to verify */ void dns_message_resetsig(dns_message_t *msg); /*%< * Reset the signature state. * * Requires: *\li 'msg' is a valid parsed message. */ isc_region_t * dns_message_getrawmessage(dns_message_t *msg); /*%< * Retrieve the raw message in compressed wire format. The message must * have been successfully parsed for it to have been saved. * * Requires: *\li msg is a valid parsed message. * * Returns: *\li NULL if there is no saved message. * a pointer to a region which refers the dns message. */ void dns_message_setsortorder(dns_message_t *msg, dns_rdatasetorderfunc_t order, const void *order_arg); /*%< * Define the order in which RR sets get rendered by * dns_message_rendersection() to be the ascending order * defined by the integer value returned by 'order' when * given each RR and 'arg' as arguments. If 'order' and * 'order_arg' are NULL, a default order is used. * * Requires: *\li msg be a valid message. *\li order_arg is NULL if and only if order is NULL. */ void dns_message_settimeadjust(dns_message_t *msg, int timeadjust); /*%< * Adjust the time used to sign/verify a message by timeadjust. * Currently only TSIG. * * Requires: *\li msg be a valid message. */ int dns_message_gettimeadjust(dns_message_t *msg); /*%< * Return the current time adjustment. * * Requires: *\li msg be a valid message. */ void dns_message_logpacket(dns_message_t *message, const char *description, isc_logcategory_t *category, isc_logmodule_t *module, int level, isc_mem_t *mctx); void dns_message_logpacket2(dns_message_t *message, const char *description, isc_sockaddr_t *address, isc_logcategory_t *category, isc_logmodule_t *module, int level, isc_mem_t *mctx); void dns_message_logfmtpacket(dns_message_t *message, const char *description, isc_logcategory_t *category, isc_logmodule_t *module, const dns_master_style_t *style, int level, isc_mem_t *mctx); void dns_message_logfmtpacket2(dns_message_t *message, const char *description, isc_sockaddr_t *address, isc_logcategory_t *category, isc_logmodule_t *module, const dns_master_style_t *style, int level, isc_mem_t *mctx); /*%< * Log 'message' at the specified logging parameters. * * For dns_message_logpacket and dns_message_logfmtpacket expect the * 'description' to end in a newline. * * For dns_message_logpacket2 and dns_message_logfmtpacket2 * 'description' will be emitted at the start of the message followed * by the formatted address and a newline. * * Requires: * \li message be a valid. * \li description to be non NULL. * \li address to be non NULL. * \li category to be valid. * \li module to be valid. * \li style to be valid. * \li mctx to be a valid. */ isc_result_t dns_message_buildopt(dns_message_t *msg, dns_rdataset_t **opt, unsigned int version, isc_uint16_t udpsize, unsigned int flags, dns_ednsopt_t *ednsopts, size_t count); /*%< * Built a opt record. * * Requires: * \li msg be a valid message. * \li opt to be a non NULL and *opt to be NULL. * * Returns: * \li ISC_R_SUCCESS on success. * \li ISC_R_NOMEMORY * \li ISC_R_NOSPACE * \li other. */ void dns_message_setclass(dns_message_t *msg, dns_rdataclass_t rdclass); /*%< * Set the expected class of records in the response. * * Requires: * \li msg be a valid message with parsing intent. */ ISC_LANG_ENDDECLS #endif /* DNS_MESSAGE_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/timer.h�����������������������������������������������������������������������������������0000644�����������������00000002021�14763166026�0007634 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_TIMER_H #define DNS_TIMER_H 1 /*! \file dns/timer.h */ /*** *** Imports ***/ #include <isc/buffer.h> #include <isc/lang.h> ISC_LANG_BEGINDECLS /*** *** Functions ***/ isc_result_t dns_timer_setidle(isc_timer_t *timer, unsigned int maxtime, unsigned int idletime, isc_boolean_t purge); /*%< * Convenience function for setting up simple, one-second-granularity * idle timers as used by zone transfers. * \brief * Set the timer 'timer' to go off after 'idletime' seconds of inactivity, * or after 'maxtime' at the very latest. Events are purged iff * 'purge' is ISC_TRUE. */ ISC_LANG_ENDDECLS #endif /* DNS_TIMER_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/peer.h������������������������������������������������������������������������������������0000644�����������������00000014075�14763166026�0007463 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_PEER_H #define DNS_PEER_H 1 /***** ***** Module Info *****/ /*! \file dns/peer.h * \brief * Data structures for peers (e.g. a 'server' config file statement) */ /*** *** Imports ***/ #include <isc/lang.h> #include <isc/magic.h> #include <isc/netaddr.h> #include <dns/types.h> #define DNS_PEERLIST_MAGIC ISC_MAGIC('s','e','R','L') #define DNS_PEER_MAGIC ISC_MAGIC('S','E','r','v') #define DNS_PEERLIST_VALID(ptr) ISC_MAGIC_VALID(ptr, DNS_PEERLIST_MAGIC) #define DNS_PEER_VALID(ptr) ISC_MAGIC_VALID(ptr, DNS_PEER_MAGIC) /*** *** Types ***/ struct dns_peerlist { unsigned int magic; isc_uint32_t refs; isc_mem_t *mem; ISC_LIST(dns_peer_t) elements; }; struct dns_peer { unsigned int magic; isc_uint32_t refs; isc_mem_t *mem; isc_netaddr_t address; unsigned int prefixlen; isc_boolean_t bogus; dns_transfer_format_t transfer_format; isc_uint32_t transfers; isc_boolean_t support_ixfr; isc_boolean_t provide_ixfr; isc_boolean_t request_ixfr; isc_boolean_t support_edns; isc_boolean_t request_nsid; isc_boolean_t send_cookie; isc_boolean_t request_expire; isc_boolean_t force_tcp; dns_name_t *key; isc_sockaddr_t *transfer_source; isc_dscp_t transfer_dscp; isc_sockaddr_t *notify_source; isc_dscp_t notify_dscp; isc_sockaddr_t *query_source; isc_dscp_t query_dscp; isc_uint16_t udpsize; /* receive size */ isc_uint16_t maxudp; /* transmit size */ isc_uint8_t ednsversion; /* edns version */ isc_uint32_t bitflags; ISC_LINK(dns_peer_t) next; }; /*** *** Functions ***/ ISC_LANG_BEGINDECLS isc_result_t dns_peerlist_new(isc_mem_t *mem, dns_peerlist_t **list); void dns_peerlist_attach(dns_peerlist_t *source, dns_peerlist_t **target); void dns_peerlist_detach(dns_peerlist_t **list); /* * After return caller still holds a reference to peer. */ void dns_peerlist_addpeer(dns_peerlist_t *peers, dns_peer_t *peer); /* * Ditto. */ isc_result_t dns_peerlist_peerbyaddr(dns_peerlist_t *peers, isc_netaddr_t *addr, dns_peer_t **retval); /* * What he said. */ isc_result_t dns_peerlist_currpeer(dns_peerlist_t *peers, dns_peer_t **retval); isc_result_t dns_peer_new(isc_mem_t *mem, isc_netaddr_t *ipaddr, dns_peer_t **peer); isc_result_t dns_peer_newprefix(isc_mem_t *mem, isc_netaddr_t *ipaddr, unsigned int prefixlen, dns_peer_t **peer); void dns_peer_attach(dns_peer_t *source, dns_peer_t **target); void dns_peer_detach(dns_peer_t **list); isc_result_t dns_peer_setbogus(dns_peer_t *peer, isc_boolean_t newval); isc_result_t dns_peer_getbogus(dns_peer_t *peer, isc_boolean_t *retval); isc_result_t dns_peer_setrequestixfr(dns_peer_t *peer, isc_boolean_t newval); isc_result_t dns_peer_getrequestixfr(dns_peer_t *peer, isc_boolean_t *retval); isc_result_t dns_peer_setprovideixfr(dns_peer_t *peer, isc_boolean_t newval); isc_result_t dns_peer_getprovideixfr(dns_peer_t *peer, isc_boolean_t *retval); isc_result_t dns_peer_setrequestnsid(dns_peer_t *peer, isc_boolean_t newval); isc_result_t dns_peer_getrequestnsid(dns_peer_t *peer, isc_boolean_t *retval); isc_result_t dns_peer_setsendcookie(dns_peer_t *peer, isc_boolean_t newval); isc_result_t dns_peer_getsendcookie(dns_peer_t *peer, isc_boolean_t *retval); isc_result_t dns_peer_setrequestexpire(dns_peer_t *peer, isc_boolean_t newval); isc_result_t dns_peer_getrequestexpire(dns_peer_t *peer, isc_boolean_t *retval); isc_result_t dns_peer_setsupportedns(dns_peer_t *peer, isc_boolean_t newval); isc_result_t dns_peer_getforcetcp(dns_peer_t *peer, isc_boolean_t *retval); isc_result_t dns_peer_setforcetcp(dns_peer_t *peer, isc_boolean_t newval); isc_result_t dns_peer_getsupportedns(dns_peer_t *peer, isc_boolean_t *retval); isc_result_t dns_peer_settransfers(dns_peer_t *peer, isc_uint32_t newval); isc_result_t dns_peer_gettransfers(dns_peer_t *peer, isc_uint32_t *retval); isc_result_t dns_peer_settransferformat(dns_peer_t *peer, dns_transfer_format_t newval); isc_result_t dns_peer_gettransferformat(dns_peer_t *peer, dns_transfer_format_t *retval); isc_result_t dns_peer_setkeybycharp(dns_peer_t *peer, const char *keyval); isc_result_t dns_peer_getkey(dns_peer_t *peer, dns_name_t **retval); isc_result_t dns_peer_setkey(dns_peer_t *peer, dns_name_t **keyval); isc_result_t dns_peer_settransfersource(dns_peer_t *peer, const isc_sockaddr_t *transfer_source); isc_result_t dns_peer_gettransfersource(dns_peer_t *peer, isc_sockaddr_t *transfer_source); isc_result_t dns_peer_setudpsize(dns_peer_t *peer, isc_uint16_t udpsize); isc_result_t dns_peer_getudpsize(dns_peer_t *peer, isc_uint16_t *udpsize); isc_result_t dns_peer_setmaxudp(dns_peer_t *peer, isc_uint16_t maxudp); isc_result_t dns_peer_getmaxudp(dns_peer_t *peer, isc_uint16_t *maxudp); isc_result_t dns_peer_setnotifysource(dns_peer_t *peer, const isc_sockaddr_t *notify_source); isc_result_t dns_peer_getnotifysource(dns_peer_t *peer, isc_sockaddr_t *notify_source); isc_result_t dns_peer_setquerysource(dns_peer_t *peer, const isc_sockaddr_t *query_source); isc_result_t dns_peer_getquerysource(dns_peer_t *peer, isc_sockaddr_t *query_source); isc_result_t dns_peer_setnotifydscp(dns_peer_t *peer, isc_dscp_t dscp); isc_result_t dns_peer_getnotifydscp(dns_peer_t *peer, isc_dscp_t *dscpp); isc_result_t dns_peer_settransferdscp(dns_peer_t *peer, isc_dscp_t dscp); isc_result_t dns_peer_gettransferdscp(dns_peer_t *peer, isc_dscp_t *dscpp); isc_result_t dns_peer_setquerydscp(dns_peer_t *peer, isc_dscp_t dscp); isc_result_t dns_peer_getquerydscp(dns_peer_t *peer, isc_dscp_t *dscpp); isc_result_t dns_peer_setednsversion(dns_peer_t *peer, isc_uint8_t ednsversion); isc_result_t dns_peer_getednsversion(dns_peer_t *peer, isc_uint8_t *ednsversion); ISC_LANG_ENDDECLS #endif /* DNS_PEER_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/cert.h������������������������������������������������������������������������������������0000644�����������������00000002671�14763166026�0007464 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_CERT_H #define DNS_CERT_H 1 /*! \file dns/cert.h */ #include <isc/lang.h> #include <dns/types.h> ISC_LANG_BEGINDECLS isc_result_t dns_cert_fromtext(dns_cert_t *certp, isc_textregion_t *source); /*%< * Convert the text 'source' refers to into a certificate type. * The text may contain either a mnemonic type name or a decimal type number. * * Requires: *\li 'certp' is a valid pointer. * *\li 'source' is a valid text region. * * Returns: *\li #ISC_R_SUCCESS on success *\li #ISC_R_RANGE numeric type is out of range *\li #DNS_R_UNKNOWN mnemonic type is unknown */ isc_result_t dns_cert_totext(dns_cert_t cert, isc_buffer_t *target); /*%< * Put a textual representation of certificate type 'cert' into 'target'. * * Requires: *\li 'cert' is a valid cert. * *\li 'target' is a valid text buffer. * * Ensures: *\li If the result is success: * The used space in 'target' is updated. * * Returns: *\li #ISC_R_SUCCESS on success *\li #ISC_R_NOSPACE target buffer is too small */ ISC_LANG_ENDDECLS #endif /* DNS_CERT_H */ �����������������������������������������������������������������������bind9/dns/fixedname.h�������������������������������������������������������������������������������0000644�����������������00000003100�14763166026�0010453 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_FIXEDNAME_H #define DNS_FIXEDNAME_H 1 /***** ***** Module Info *****/ /*! \file dns/fixedname.h * \brief * Fixed-size Names * * dns_fixedname_t is a convenience type containing a name, an offsets * table, and a dedicated buffer big enough for the longest possible * name. This is typically used for stack-allocated names. * * MP: *\li The caller must ensure any required synchronization. * * Reliability: *\li No anticipated impact. * * Resources: *\li Per dns_fixedname_t: *\code * sizeof(dns_name_t) + sizeof(dns_offsets_t) + * sizeof(isc_buffer_t) + 255 bytes + structure padding *\endcode * * Security: *\li No anticipated impact. * * Standards: *\li None. */ /***** ***** Imports *****/ #include <isc/buffer.h> #include <dns/name.h> /***** ***** Types *****/ struct dns_fixedname { dns_name_t name; dns_offsets_t offsets; isc_buffer_t buffer; unsigned char data[DNS_NAME_MAXWIRE]; }; void dns_fixedname_init(dns_fixedname_t *fixed); void dns_fixedname_invalidate(dns_fixedname_t *fixed); dns_name_t * dns_fixedname_name(dns_fixedname_t *fixed); dns_name_t * dns_fixedname_initname(dns_fixedname_t *fixed); #endif /* DNS_FIXEDNAME_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/tcpmsg.h����������������������������������������������������������������������������������0000644�����������������00000006065�14763166026�0010025 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_TCPMSG_H #define DNS_TCPMSG_H 1 /*! \file dns/tcpmsg.h */ #include <isc/buffer.h> #include <isc/lang.h> #include <isc/socket.h> typedef struct dns_tcpmsg { /* private (don't touch!) */ unsigned int magic; isc_uint16_t size; isc_buffer_t buffer; unsigned int maxsize; isc_mem_t *mctx; isc_socket_t *sock; isc_task_t *task; isc_taskaction_t action; void *arg; isc_event_t event; /* public (read-only) */ isc_result_t result; isc_sockaddr_t address; } dns_tcpmsg_t; ISC_LANG_BEGINDECLS void dns_tcpmsg_init(isc_mem_t *mctx, isc_socket_t *sock, dns_tcpmsg_t *tcpmsg); /*%< * Associate a tcp message state with a given memory context and * TCP socket. * * Requires: * *\li "mctx" and "sock" be non-NULL and valid types. * *\li "sock" be a read/write TCP socket. * *\li "tcpmsg" be non-NULL and an uninitialized or invalidated structure. * * Ensures: * *\li "tcpmsg" is a valid structure. */ void dns_tcpmsg_setmaxsize(dns_tcpmsg_t *tcpmsg, unsigned int maxsize); /*%< * Set the maximum packet size to "maxsize" * * Requires: * *\li "tcpmsg" be valid. * *\li 512 <= "maxsize" <= 65536 */ isc_result_t dns_tcpmsg_readmessage(dns_tcpmsg_t *tcpmsg, isc_task_t *task, isc_taskaction_t action, void *arg); /*%< * Schedule an event to be delivered when a DNS message is readable, or * when an error occurs on the socket. * * Requires: * *\li "tcpmsg" be valid. * *\li "task", "taskaction", and "arg" be valid. * * Returns: * *\li ISC_R_SUCCESS -- no error *\li Anything that the isc_socket_recv() call can return. XXXMLG * * Notes: * *\li The event delivered is a fully generic event. It will contain no * actual data. The sender will be a pointer to the dns_tcpmsg_t. * The result code inside that structure should be checked to see * what the final result was. */ void dns_tcpmsg_cancelread(dns_tcpmsg_t *tcpmsg); /*%< * Cancel a readmessage() call. The event will still be posted with a * CANCELED result code. * * Requires: * *\li "tcpmsg" be valid. */ void dns_tcpmsg_keepbuffer(dns_tcpmsg_t *tcpmsg, isc_buffer_t *buffer); /*%< * If a dns buffer is to be kept between calls, this function marks the * internal state-machine buffer as invalid, and copies all the contents * of the state into "buffer". * * Requires: * *\li "tcpmsg" be valid. * *\li "buffer" be non-NULL. */ void dns_tcpmsg_invalidate(dns_tcpmsg_t *tcpmsg); /*%< * Clean up all allocated state, and invalidate the structure. * * Requires: * *\li "tcpmsg" be valid. * * Ensures: * *\li "tcpmsg" is invalidated and disassociated with all memory contexts, * sockets, etc. */ ISC_LANG_ENDDECLS #endif /* DNS_TCPMSG_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/order.h�����������������������������������������������������������������������������������0000644�����������������00000003716�14763166026�0007643 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_ORDER_H #define DNS_ORDER_H 1 /*! \file dns/order.h */ #include <isc/lang.h> #include <isc/types.h> #include <dns/types.h> ISC_LANG_BEGINDECLS isc_result_t dns_order_create(isc_mem_t *mctx, dns_order_t **orderp); /*%< * Create a order object. * * Requires: * \li 'orderp' to be non NULL and '*orderp == NULL'. *\li 'mctx' to be valid. * * Returns: *\li ISC_R_SUCCESS *\li ISC_R_NOMEMORY */ isc_result_t dns_order_add(dns_order_t *order, dns_name_t *name, dns_rdatatype_t rdtype, dns_rdataclass_t rdclass, unsigned int mode); /*%< * Add a entry to the end of the order list. * * Requires: * \li 'order' to be valid. *\li 'name' to be valid. *\li 'mode' to be one of #DNS_RDATASETATTR_RANDOMIZE, * #DNS_RDATASETATTR_FIXEDORDER or zero (#DNS_RDATASETATTR_CYCLIC). * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY */ unsigned int dns_order_find(dns_order_t *order, dns_name_t *name, dns_rdatatype_t rdtype, dns_rdataclass_t rdclass); /*%< * Find the first matching entry on the list. * * Requires: *\li 'order' to be valid. *\li 'name' to be valid. * * Returns the mode set by dns_order_add() or zero. */ void dns_order_attach(dns_order_t *source, dns_order_t **target); /*%< * Attach to the 'source' object. * * Requires: * \li 'source' to be valid. *\li 'target' to be non NULL and '*target == NULL'. */ void dns_order_detach(dns_order_t **orderp); /*%< * Detach from the object. Clean up if last this was the last * reference. * * Requires: *\li '*orderp' to be valid. */ ISC_LANG_ENDDECLS #endif /* DNS_ORDER_H */ ��������������������������������������������������bind9/dns/request.h���������������������������������������������������������������������������������0000644�����������������00000025623�14763166026�0010221 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_REQUEST_H #define DNS_REQUEST_H 1 /***** ***** Module Info *****/ /*! \file dns/request.h * * \brief * The request module provides simple request/response services useful for * sending SOA queries, DNS Notify messages, and dynamic update requests. * * MP: *\li The module ensures appropriate synchronization of data structures it * creates and manipulates. * * Resources: *\li TBS * * Security: *\li No anticipated impact. */ #include <isc/lang.h> #include <isc/event.h> #include <dns/types.h> #define DNS_REQUESTOPT_TCP 0x00000001U #define DNS_REQUESTOPT_CASE 0x00000002U #define DNS_REQUESTOPT_FIXEDID 0x00000004U #define DNS_REQUESTOPT_SHARE 0x00000008U typedef struct dns_requestevent { ISC_EVENT_COMMON(struct dns_requestevent); isc_result_t result; dns_request_t *request; } dns_requestevent_t; ISC_LANG_BEGINDECLS isc_result_t dns_requestmgr_create(isc_mem_t *mctx, isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr, isc_taskmgr_t *taskmgr, dns_dispatchmgr_t *dispatchmgr, dns_dispatch_t *dispatchv4, dns_dispatch_t *dispatchv6, dns_requestmgr_t **requestmgrp); /*%< * Create a request manager. * * Requires: * *\li 'mctx' is a valid memory context. * *\li 'timermgr' is a valid timer manager. * *\li 'socketmgr' is a valid socket manager. * *\li 'taskmgr' is a valid task manager. * *\li 'dispatchv4' is a valid dispatcher with an IPv4 UDP socket, or is NULL. * *\li 'dispatchv6' is a valid dispatcher with an IPv6 UDP socket, or is NULL. * *\li requestmgrp != NULL && *requestmgrp == NULL * * Ensures: * *\li On success, *requestmgrp is a valid request manager. * * Returns: * *\li ISC_R_SUCCESS * *\li Any other result indicates failure. */ void dns_requestmgr_whenshutdown(dns_requestmgr_t *requestmgr, isc_task_t *task, isc_event_t **eventp); /*%< * Send '*eventp' to 'task' when 'requestmgr' has completed shutdown. * * Notes: * *\li It is not safe to detach the last reference to 'requestmgr' until * shutdown is complete. * * Requires: * *\li 'requestmgr' is a valid request manager. * *\li 'task' is a valid task. * *\li *eventp is a valid event. * * Ensures: * *\li *eventp == NULL. */ void dns_requestmgr_shutdown(dns_requestmgr_t *requestmgr); /*%< * Start the shutdown process for 'requestmgr'. * * Notes: * *\li This call has no effect if the request manager is already shutting * down. * * Requires: * *\li 'requestmgr' is a valid requestmgr. */ void dns_requestmgr_attach(dns_requestmgr_t *source, dns_requestmgr_t **targetp); /*%< * Attach to the request manager. dns_requestmgr_shutdown() must not * have been called on 'source' prior to calling dns_requestmgr_attach(). * * Requires: * *\li 'source' is a valid requestmgr. * *\li 'targetp' to be non NULL and '*targetp' to be NULL. */ void dns_requestmgr_detach(dns_requestmgr_t **requestmgrp); /*%< * Detach from the given requestmgr. If this is the final detach * requestmgr will be destroyed. dns_requestmgr_shutdown() must * be called before the final detach. * * Requires: * *\li '*requestmgrp' is a valid requestmgr. * * Ensures: *\li '*requestmgrp' is NULL. */ isc_result_t dns_request_create(dns_requestmgr_t *requestmgr, dns_message_t *message, isc_sockaddr_t *address, unsigned int options, dns_tsigkey_t *key, unsigned int timeout, isc_task_t *task, isc_taskaction_t action, void *arg, dns_request_t **requestp); /*%< * Create and send a request. * * Notes: * *\li 'message' will be rendered and sent to 'address'. If the * #DNS_REQUESTOPT_TCP option is set, TCP will be used, * #DNS_REQUESTOPT_SHARE option is set too, connecting TCP * (vs. connected) will be shared too. The request * will timeout after 'timeout' seconds. * *\li If the #DNS_REQUESTOPT_CASE option is set, use case sensitive * compression. * *\li When the request completes, successfully, due to a timeout, or * because it was canceled, a completion event will be sent to 'task'. * * Requires: * *\li 'message' is a valid DNS message. * *\li 'address' is a valid sockaddr. * *\li 'timeout' > 0 * *\li 'task' is a valid task. * *\li requestp != NULL && *requestp == NULL */ /*% See dns_request_createvia4() */ isc_result_t dns_request_createvia(dns_requestmgr_t *requestmgr, dns_message_t *message, isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, unsigned int options, dns_tsigkey_t *key, unsigned int timeout, isc_task_t *task, isc_taskaction_t action, void *arg, dns_request_t **requestp); /*% See dns_request_createvia4() */ isc_result_t dns_request_createvia2(dns_requestmgr_t *requestmgr, dns_message_t *message, isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, unsigned int options, dns_tsigkey_t *key, unsigned int timeout, unsigned int udptimeout, isc_task_t *task, isc_taskaction_t action, void *arg, dns_request_t **requestp); /*% See dns_request_createvia4() */ isc_result_t dns_request_createvia3(dns_requestmgr_t *requestmgr, dns_message_t *message, isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, unsigned int options, dns_tsigkey_t *key, unsigned int timeout, unsigned int udptimeout, unsigned int udpretries, isc_task_t *task, isc_taskaction_t action, void *arg, dns_request_t **requestp); isc_result_t dns_request_createvia4(dns_requestmgr_t *requestmgr, dns_message_t *message, isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, isc_dscp_t dscp, unsigned int options, dns_tsigkey_t *key, unsigned int timeout, unsigned int udptimeout, unsigned int udpretries, isc_task_t *task, isc_taskaction_t action, void *arg, dns_request_t **requestp); /*%< * Create and send a request. * * Notes: * *\li 'message' will be rendered and sent to 'address'. If the * #DNS_REQUESTOPT_TCP option is set, TCP will be used, * #DNS_REQUESTOPT_SHARE option is set too, connecting TCP * (vs. connected) will be shared too. The request * will timeout after 'timeout' seconds. UDP requests will be resent * at 'udptimeout' intervals if non-zero or 'udpretries' is non-zero. * *\li If the #DNS_REQUESTOPT_CASE option is set, use case sensitive * compression. * *\li When the request completes, successfully, due to a timeout, or * because it was canceled, a completion event will be sent to 'task'. * * Requires: * *\li 'message' is a valid DNS message. * *\li 'dstaddr' is a valid sockaddr. * *\li 'srcaddr' is a valid sockaddr or NULL. * *\li 'srcaddr' and 'dstaddr' are the same protocol family. * *\li 'timeout' > 0 * *\li 'task' is a valid task. * *\li requestp != NULL && *requestp == NULL */ /*% See dns_request_createraw4() */ isc_result_t dns_request_createraw(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf, isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, unsigned int options, unsigned int timeout, isc_task_t *task, isc_taskaction_t action, void *arg, dns_request_t **requestp); /*% See dns_request_createraw4() */ isc_result_t dns_request_createraw2(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf, isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, unsigned int options, unsigned int timeout, unsigned int udptimeout, isc_task_t *task, isc_taskaction_t action, void *arg, dns_request_t **requestp); /*% See dns_request_createraw4() */ isc_result_t dns_request_createraw3(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf, isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, unsigned int options, unsigned int timeout, unsigned int udptimeout, unsigned int udpretries, isc_task_t *task, isc_taskaction_t action, void *arg, dns_request_t **requestp); isc_result_t dns_request_createraw4(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf, isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr, isc_dscp_t dscp, unsigned int options, unsigned int timeout, unsigned int udptimeout, unsigned int udpretries, isc_task_t *task, isc_taskaction_t action, void *arg, dns_request_t **requestp); /*!< * \brief Create and send a request. * * Notes: * *\li 'msgbuf' will be sent to 'destaddr' after setting the id. If the * #DNS_REQUESTOPT_TCP option is set, TCP will be used, * #DNS_REQUESTOPT_SHARE option is set too, connecting TCP * (vs. connected) will be shared too. The request * will timeout after 'timeout' seconds. UDP requests will be resent * at 'udptimeout' intervals if non-zero or if 'udpretries' is not zero. * *\li When the request completes, successfully, due to a timeout, or * because it was canceled, a completion event will be sent to 'task'. * * Requires: * *\li 'msgbuf' is a valid DNS message in compressed wire format. * *\li 'destaddr' is a valid sockaddr. * *\li 'srcaddr' is a valid sockaddr or NULL. * *\li 'srcaddr' and 'dstaddr' are the same protocol family. * *\li 'timeout' > 0 * *\li 'task' is a valid task. * *\li requestp != NULL && *requestp == NULL */ void dns_request_cancel(dns_request_t *request); /*%< * Cancel 'request'. * * Requires: * *\li 'request' is a valid request. * * Ensures: * *\li If the completion event for 'request' has not yet been sent, it * will be sent, and the result code will be ISC_R_CANCELED. */ isc_result_t dns_request_getresponse(dns_request_t *request, dns_message_t *message, unsigned int options); /*%< * Get the response to 'request' by filling in 'message'. * * 'options' is passed to dns_message_parse(). See dns_message_parse() * for more details. * * Requires: * *\li 'request' is a valid request for which the caller has received the * completion event. * *\li The result code of the completion event was #ISC_R_SUCCESS. * * Returns: * *\li ISC_R_SUCCESS * *\li Any result that dns_message_parse() can return. */ isc_boolean_t dns_request_usedtcp(dns_request_t *request); /*%< * Return whether this query used TCP or not. Setting #DNS_REQUESTOPT_TCP * in the call to dns_request_create() will cause the function to return * #ISC_TRUE, otherwise the result is based on the query message size. * * Requires: *\li 'request' is a valid request. * * Returns: *\li ISC_TRUE if TCP was used. *\li ISC_FALSE if UDP was used. */ void dns_request_destroy(dns_request_t **requestp); /*%< * Destroy 'request'. * * Requires: * *\li 'request' is a valid request for which the caller has received the * completion event. * * Ensures: * *\li *requestp == NULL */ ISC_LANG_ENDDECLS #endif /* DNS_REQUEST_H */ �������������������������������������������������������������������������������������������������������������bind9/dns/nsec3.h�����������������������������������������������������������������������������������0000644�����������������00000020262�14763166026�0007536 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_NSEC3_H #define DNS_NSEC3_H 1 #include <isc/lang.h> #include <isc/iterated_hash.h> #include <dns/db.h> #include <dns/diff.h> #include <dns/name.h> #include <dns/rdatastruct.h> #include <dns/types.h> #define DNS_NSEC3_SALTSIZE 255 /* * hash = 1, flags =1, iterations = 2, salt length = 1, salt = 255 (max) * hash length = 1, hash = 255 (max), bitmap = 8192 + 512 (max) */ #define DNS_NSEC3_BUFFERSIZE (6 + 255 + 255 + 8192 + 512) /* * hash = 1, flags = 1, iterations = 2, salt length = 1, salt = 255 (max) */ #define DNS_NSEC3PARAM_BUFFERSIZE (5 + 255) /* * Test "unknown" algorithm. Is mapped to dns_hash_sha1. */ #define DNS_NSEC3_UNKNOWNALG ((dns_hash_t)245U) ISC_LANG_BEGINDECLS isc_result_t dns_nsec3_buildrdata(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, unsigned int hashalg, unsigned int optin, unsigned int iterations, const unsigned char *salt, size_t salt_length, const unsigned char *nexthash, size_t hash_length, unsigned char *buffer, dns_rdata_t *rdata); /*%< * Build the rdata of a NSEC3 record for the data at 'node'. * Note: 'node' is not the node where the NSEC3 record will be stored. * * Requires: * buffer Points to a temporary buffer of at least * DNS_NSEC_BUFFERSIZE bytes. * rdata Points to an initialized dns_rdata_t. * * Ensures: * *rdata Contains a valid NSEC3 rdata. The 'data' member refers * to 'buffer'. */ isc_boolean_t dns_nsec3_typepresent(dns_rdata_t *nsec, dns_rdatatype_t type); /*%< * Determine if a type is marked as present in an NSEC3 record. * * Requires: * 'nsec' points to a valid rdataset of type NSEC3 */ isc_result_t dns_nsec3_hashname(dns_fixedname_t *result, unsigned char rethash[NSEC3_MAX_HASH_LENGTH], size_t *hash_length, dns_name_t *name, dns_name_t *origin, dns_hash_t hashalg, unsigned int iterations, const unsigned char *salt, size_t saltlength); /*%< * Make a hashed domain name from an unhashed one. If rethash is not NULL * the raw hash is stored there. */ unsigned int dns_nsec3_hashlength(dns_hash_t hash); /*%< * Return the length of the hash produced by the specified algorithm * or zero when unknown. */ isc_boolean_t dns_nsec3_supportedhash(dns_hash_t hash); /*%< * Return whether we support this hash algorithm or not. */ isc_result_t dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name, const dns_rdata_nsec3param_t *nsec3param, dns_ttl_t nsecttl, isc_boolean_t unsecure, dns_diff_t *diff); isc_result_t dns_nsec3_addnsec3s(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name, dns_ttl_t nsecttl, isc_boolean_t unsecure, dns_diff_t *diff); isc_result_t dns_nsec3_addnsec3sx(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name, dns_ttl_t nsecttl, isc_boolean_t unsecure, dns_rdatatype_t private, dns_diff_t *diff); /*%< * Add NSEC3 records for 'name', recording the change in 'diff'. * Adjust previous NSEC3 records, if any, to reflect the addition. * The existing NSEC3 records are removed. * * dns_nsec3_addnsec3() will only add records to the chain identified by * 'nsec3param'. * * 'unsecure' should be set to reflect if this is a potentially * unsecure delegation (no DS record). * * dns_nsec3_addnsec3s() will examine the NSEC3PARAM RRset to determine which * chains to be updated. NSEC3PARAM records with the DNS_NSEC3FLAG_CREATE * will be preferentially chosen over NSEC3PARAM records without * DNS_NSEC3FLAG_CREATE set. NSEC3PARAM records with DNS_NSEC3FLAG_REMOVE * set will be ignored by dns_nsec3_addnsec3s(). If DNS_NSEC3FLAG_CREATE * is set then the new NSEC3 will have OPTOUT set to match the that in the * NSEC3PARAM record otherwise OPTOUT will be inherited from the previous * record in the chain. * * dns_nsec3_addnsec3sx() is similar to dns_nsec3_addnsec3s() but 'private' * specifies the type of the private rdataset to be checked in addition to * the nsec3param rdataset at the zone apex. * * Requires: * 'db' to be valid. * 'version' to be valid or NULL. * 'name' to be valid. * 'nsec3param' to be valid. * 'diff' to be valid. */ isc_result_t dns_nsec3_delnsec3(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name, const dns_rdata_nsec3param_t *nsec3param, dns_diff_t *diff); isc_result_t dns_nsec3_delnsec3s(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name, dns_diff_t *diff); isc_result_t dns_nsec3_delnsec3sx(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name, dns_rdatatype_t private, dns_diff_t *diff); /*%< * Remove NSEC3 records for 'name', recording the change in 'diff'. * Adjust previous NSEC3 records, if any, to reflect the removal. * * dns_nsec3_delnsec3() performs the above for the chain identified by * 'nsec3param'. * * dns_nsec3_delnsec3s() examines the NSEC3PARAM RRset in a similar manner * to dns_nsec3_addnsec3s(). Unlike dns_nsec3_addnsec3s() updated NSEC3 * records have the OPTOUT flag preserved. * * dns_nsec3_delnsec3sx() is similar to dns_nsec3_delnsec3s() but 'private' * specifies the type of the private rdataset to be checked in addition to * the nsec3param rdataset at the zone apex. * * Requires: * 'db' to be valid. * 'version' to be valid or NULL. * 'name' to be valid. * 'nsec3param' to be valid. * 'diff' to be valid. */ isc_result_t dns_nsec3_active(dns_db_t *db, dns_dbversion_t *version, isc_boolean_t complete, isc_boolean_t *answer); isc_result_t dns_nsec3_activex(dns_db_t *db, dns_dbversion_t *version, isc_boolean_t complete, dns_rdatatype_t private, isc_boolean_t *answer); /*%< * Check if there are any complete/to be built NSEC3 chains. * If 'complete' is ISC_TRUE only complete chains will be recognized. * * dns_nsec3_activex() is similar to dns_nsec3_active() but 'private' * specifies the type of the private rdataset to be checked in addition to * the nsec3param rdataset at the zone apex. * * Requires: * 'db' to be valid. * 'version' to be valid or NULL. * 'answer' to be non NULL. */ isc_result_t dns_nsec3_maxiterations(dns_db_t *db, dns_dbversion_t *version, isc_mem_t *mctx, unsigned int *iterationsp); /*%< * Find the maximum permissible number of iterations allowed based on * the key strength. * * Requires: * 'db' to be valid. * 'version' to be valid or NULL. * 'mctx' to be valid. * 'iterationsp' to be non NULL. */ isc_boolean_t dns_nsec3param_fromprivate(dns_rdata_t *src, dns_rdata_t *target, unsigned char *buf, size_t buflen); /*%< * Convert a private rdata to a nsec3param rdata. * * Return ISC_TRUE if 'src' could be successfully converted. * * 'buf' should be at least DNS_NSEC3PARAM_BUFFERSIZE in size. */ void dns_nsec3param_toprivate(dns_rdata_t *src, dns_rdata_t *target, dns_rdatatype_t privatetype, unsigned char *buf, size_t buflen); /*%< * Convert a nsec3param rdata to a private rdata. * * 'buf' should be at least src->length + 1 in size. */ isc_result_t dns_nsec3param_salttotext(dns_rdata_nsec3param_t *nsec3param, char *dst, size_t dstlen); /*%< * Convert the salt of given NSEC3PARAM RDATA into hex-encoded, NULL-terminated * text stored at "dst". * * Requires: * *\li "dst" to have enough space (as indicated by "dstlen") to hold the * resulting text and its NULL-terminating byte. */ isc_result_t dns_nsec3param_deletechains(dns_db_t *db, dns_dbversion_t *ver, dns_zone_t *zone, isc_boolean_t nonsec, dns_diff_t *diff); /*%< * Mark NSEC3PARAM for deletion. */ isc_result_t dns_nsec3_noexistnodata(dns_rdatatype_t type, dns_name_t* name, dns_name_t *nsec3name, dns_rdataset_t *nsec3set, dns_name_t *zonename, isc_boolean_t *exists, isc_boolean_t *data, isc_boolean_t *optout, isc_boolean_t *unknown, isc_boolean_t *setclosest, isc_boolean_t *setnearest, dns_name_t *closest, dns_name_t *nearest, dns_nseclog_t logit, void *arg); ISC_LANG_ENDDECLS #endif /* DNS_NSEC3_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/rdata.h�����������������������������������������������������������������������������������0000644�����������������00000051661�14763166026�0007625 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_RDATA_H #define DNS_RDATA_H 1 /***** ***** Module Info *****/ /*! \file dns/rdata.h * \brief * Provides facilities for manipulating DNS rdata, including conversions to * and from wire format and text format. * * Given the large amount of rdata possible in a nameserver, it was important * to come up with a very efficient way of storing rdata, but at the same * time allow it to be manipulated. * * The decision was to store rdata in uncompressed wire format, * and not to make it a fully abstracted object; i.e. certain parts of the * server know rdata is stored that way. This saves a lot of memory, and * makes adding rdata to messages easy. Having much of the server know * the representation would be perilous, and we certainly don't want each * user of rdata to be manipulating such a low-level structure. This is * where the rdata module comes in. The module allows rdata handles to be * created and attached to uncompressed wire format regions. All rdata * operations and conversions are done through these handles. * * Implementation Notes: * *\li The routines in this module are expected to be synthesized by the * build process from a set of source files, one per rdata type. For * portability, it's probably best that the building be done by a C * program. Adding a new rdata type will be a simple matter of adding * a file to a directory and rebuilding the server. *All* knowledge of * the format of a particular rdata type is in this file. * * MP: *\li Clients of this module must impose any required synchronization. * * Reliability: *\li This module deals with low-level byte streams. Errors in any of * the functions are likely to crash the server or corrupt memory. * *\li Rdata is typed, and the caller must know what type of rdata it has. * A caller that gets this wrong could crash the server. * *\li The fromstruct() and tostruct() routines use a void * pointer to * represent the structure. The caller must ensure that it passes a * pointer to the appropriate type, or the server could crash or memory * could be corrupted. * * Resources: *\li None. * * Security: * *\li *** WARNING *** * dns_rdata_fromwire() deals with raw network data. An error in * this routine could result in the failure or hijacking of the server. * * Standards: *\li RFC1035 *\li Draft EDNS0 (0) *\li Draft EDNS1 (0) *\li Draft Binary Labels (2) *\li Draft Local Compression (1) *\li Various RFCs for particular types; these will be documented in the * sources files of the types. * */ /*** *** Imports ***/ #include <isc/lang.h> #include <dns/types.h> #include <dns/name.h> #include <dns/message.h> ISC_LANG_BEGINDECLS /*** *** Types ***/ /*% ***** An 'rdata' is a handle to a binary region. The handle has an RR ***** class and type, and the data in the binary region is in the format ***** of the given class and type. *****/ /*% * Clients are strongly discouraged from using this type directly, with * the exception of the 'link' field which may be used directly for whatever * purpose the client desires. */ struct dns_rdata { unsigned char * data; unsigned int length; dns_rdataclass_t rdclass; dns_rdatatype_t type; unsigned int flags; ISC_LINK(dns_rdata_t) link; }; #define DNS_RDATA_INIT { NULL, 0, 0, 0, 0, {(void*)(-1), (void *)(-1)}} #define DNS_RDATA_CHECKINITIALIZED #ifdef DNS_RDATA_CHECKINITIALIZED #define DNS_RDATA_INITIALIZED(rdata) \ ((rdata)->data == NULL && (rdata)->length == 0 && \ (rdata)->rdclass == 0 && (rdata)->type == 0 && (rdata)->flags == 0 && \ !ISC_LINK_LINKED((rdata), link)) #else #ifdef ISC_LIST_CHECKINIT #define DNS_RDATA_INITIALIZED(rdata) \ (!ISC_LINK_LINKED((rdata), link)) #else #define DNS_RDATA_INITIALIZED(rdata) ISC_TRUE #endif #endif #define DNS_RDATA_UPDATE 0x0001 /*%< update pseudo record. */ #define DNS_RDATA_OFFLINE 0x0002 /*%< RRSIG has a offline key. */ #define DNS_RDATA_VALIDFLAGS(rdata) \ (((rdata)->flags & ~(DNS_RDATA_UPDATE|DNS_RDATA_OFFLINE)) == 0) /* * The maximum length of a RDATA that can be sent on the wire. * Max packet size (65535) less header (12), less name (1), type (2), * class (2), ttl(4), length (2). * * None of the defined types that support name compression can exceed * this and all new types are to be sent uncompressed. */ #define DNS_RDATA_MAXLENGTH 65512U /* * Flags affecting rdata formatting style. Flags 0xFFFF0000 * are used by masterfile-level formatting and defined elsewhere. * See additional comments at dns_rdata_tofmttext(). */ /*% Split the rdata into multiple lines to try to keep it within the "width". */ #define DNS_STYLEFLAG_MULTILINE 0x00000001ULL /*% Output explanatory comments. */ #define DNS_STYLEFLAG_COMMENT 0x00000002ULL #define DNS_STYLEFLAG_RRCOMMENT 0x00000004ULL /*% Output KEYDATA in human readable format. */ #define DNS_STYLEFLAG_KEYDATA 0x00000008ULL /*% Output textual RR type and RDATA in RFC 3597 unknown format */ #define DNS_STYLEFLAG_UNKNOWNFORMAT 0x00000010ULL #define DNS_RDATA_DOWNCASE DNS_NAME_DOWNCASE #define DNS_RDATA_CHECKNAMES DNS_NAME_CHECKNAMES #define DNS_RDATA_CHECKNAMESFAIL DNS_NAME_CHECKNAMESFAIL #define DNS_RDATA_CHECKREVERSE DNS_NAME_CHECKREVERSE #define DNS_RDATA_CHECKMX DNS_NAME_CHECKMX #define DNS_RDATA_CHECKMXFAIL DNS_NAME_CHECKMXFAIL #define DNS_RDATA_UNKNOWNESCAPE 0x80000000 /*** *** Initialization ***/ void dns_rdata_init(dns_rdata_t *rdata); /*%< * Make 'rdata' empty. * * Requires: * 'rdata' is a valid rdata (i.e. not NULL, points to a struct dns_rdata) */ void dns_rdata_reset(dns_rdata_t *rdata); /*%< * Make 'rdata' empty. * * Requires: *\li 'rdata' is a previously initialized rdata and is not linked. */ void dns_rdata_clone(const dns_rdata_t *src, dns_rdata_t *target); /*%< * Clone 'target' from 'src'. * * Requires: *\li 'src' to be initialized. *\li 'target' to be initialized. */ /*** *** Comparisons ***/ int dns_rdata_compare(const dns_rdata_t *rdata1, const dns_rdata_t *rdata2); /*%< * Determine the relative ordering under the DNSSEC order relation of * 'rdata1' and 'rdata2'. * * Requires: * *\li 'rdata1' is a valid, non-empty rdata * *\li 'rdata2' is a valid, non-empty rdata * * Returns: *\li < 0 'rdata1' is less than 'rdata2' *\li 0 'rdata1' is equal to 'rdata2' *\li > 0 'rdata1' is greater than 'rdata2' */ int dns_rdata_casecompare(const dns_rdata_t *rdata1, const dns_rdata_t *rdata2); /*%< * dns_rdata_casecompare() is similar to dns_rdata_compare() but also * compares domain names case insensitively in known rdata types that * are treated as opaque data by dns_rdata_compare(). * * Requires: * *\li 'rdata1' is a valid, non-empty rdata * *\li 'rdata2' is a valid, non-empty rdata * * Returns: *\li < 0 'rdata1' is less than 'rdata2' *\li 0 'rdata1' is equal to 'rdata2' *\li > 0 'rdata1' is greater than 'rdata2' */ /*** *** Conversions ***/ void dns_rdata_fromregion(dns_rdata_t *rdata, dns_rdataclass_t rdclass, dns_rdatatype_t type, isc_region_t *r); /*%< * Make 'rdata' refer to region 'r'. * * Requires: * *\li The data in 'r' is properly formatted for whatever type it is. */ void dns_rdata_toregion(const dns_rdata_t *rdata, isc_region_t *r); /*%< * Make 'r' refer to 'rdata'. */ isc_result_t dns_rdata_fromwire(dns_rdata_t *rdata, dns_rdataclass_t rdclass, dns_rdatatype_t type, isc_buffer_t *source, dns_decompress_t *dctx, unsigned int options, isc_buffer_t *target); /*%< * Copy the possibly-compressed rdata at source into the target region. * * Notes: *\li Name decompression policy is controlled by 'dctx'. * * 'options' *\li DNS_RDATA_DOWNCASE downcase domain names when they are copied * into target. * * Requires: * *\li 'rdclass' and 'type' are valid. * *\li 'source' is a valid buffer, and the active region of 'source' * references the rdata to be processed. * *\li 'target' is a valid buffer. * *\li 'dctx' is a valid decompression context. * * Ensures, * if result is success: * \li If 'rdata' is not NULL, it is attached to the target. * \li The conditions dns_name_fromwire() ensures for names hold * for all names in the rdata. * \li The current location in source is advanced, and the used space * in target is updated. * * Result: *\li Success *\li Any non-success status from dns_name_fromwire() *\li Various 'Bad Form' class failures depending on class and type *\li Bad Form: Input too short *\li Resource Limit: Not enough space */ isc_result_t dns_rdata_towire(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target); /*%< * Convert 'rdata' into wire format, compressing it as specified by the * compression context 'cctx', and storing the result in 'target'. * * Notes: *\li If the compression context allows global compression, then the * global compression table may be updated. * * Requires: *\li 'rdata' is a valid, non-empty rdata * *\li target is a valid buffer * *\li Any offsets specified in a global compression table are valid * for target. * * Ensures, * if the result is success: * \li The used space in target is updated. * * Returns: *\li Success *\li Any non-success status from dns_name_towire() *\li Resource Limit: Not enough space */ isc_result_t dns_rdata_fromtext(dns_rdata_t *rdata, dns_rdataclass_t rdclass, dns_rdatatype_t type, isc_lex_t *lexer, dns_name_t *origin, unsigned int options, isc_mem_t *mctx, isc_buffer_t *target, dns_rdatacallbacks_t *callbacks); /*%< * Convert the textual representation of a DNS rdata into uncompressed wire * form stored in the target region. Tokens constituting the text of the rdata * are taken from 'lexer'. * * Notes: *\li Relative domain names in the rdata will have 'origin' appended to them. * A NULL origin implies "origin == dns_rootname". * * * 'options' *\li DNS_RDATA_DOWNCASE downcase domain names when they are copied * into target. *\li DNS_RDATA_CHECKNAMES perform checknames checks. *\li DNS_RDATA_CHECKNAMESFAIL fail if the checknames check fail. If * not set a warning will be issued. *\li DNS_RDATA_CHECKREVERSE this should set if the owner name ends * in IP6.ARPA, IP6.INT or IN-ADDR.ARPA. * * Requires: * *\li 'rdclass' and 'type' are valid. * *\li 'lexer' is a valid isc_lex_t. * *\li 'mctx' is a valid isc_mem_t. * *\li 'target' is a valid region. * *\li 'origin' if non NULL it must be absolute. * *\li 'callbacks' to be NULL or callbacks->warn and callbacks->error be * initialized. * * Ensures, * if result is success: *\li If 'rdata' is not NULL, it is attached to the target. *\li The conditions dns_name_fromtext() ensures for names hold * for all names in the rdata. *\li The used space in target is updated. * * Result: *\li Success *\li Translated result codes from isc_lex_gettoken *\li Various 'Bad Form' class failures depending on class and type *\li Bad Form: Input too short *\li Resource Limit: Not enough space *\li Resource Limit: Not enough memory */ isc_result_t dns_rdata_totext(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target); /*%< * Convert 'rdata' into text format, storing the result in 'target'. * The text will consist of a single line, with fields separated by * single spaces. * * Notes: *\li If 'origin' is not NULL, then any names in the rdata that are * subdomains of 'origin' will be made relative it. * *\li XXX Do we *really* want to support 'origin'? I'm inclined towards "no" * at the moment. * * Requires: * *\li 'rdata' is a valid, non-empty rdata * *\li 'origin' is NULL, or is a valid name * *\li 'target' is a valid text buffer * * Ensures, * if the result is success: * * \li The used space in target is updated. * * Returns: *\li Success *\li Any non-success status from dns_name_totext() *\li Resource Limit: Not enough space */ isc_result_t dns_rdata_tofmttext(dns_rdata_t *rdata, dns_name_t *origin, unsigned int flags, unsigned int width, unsigned int split_width, const char *linebreak, isc_buffer_t *target); /*%< * Like dns_rdata_totext, but do formatted output suitable for * database dumps. This is intended for use by dns_db_dump(); * library users are discouraged from calling it directly. * * If (flags & #DNS_STYLEFLAG_MULTILINE) != 0, attempt to stay * within 'width' by breaking the text into multiple lines. * The string 'linebreak' is inserted between lines, and parentheses * are added when necessary. Because RRs contain unbreakable elements * such as domain names whose length is variable, unpredictable, and * potentially large, there is no guarantee that the lines will * not exceed 'width' anyway. * * If (flags & #DNS_STYLEFLAG_MULTILINE) == 0, the rdata is always * printed as a single line, and no parentheses are used. * The 'width' and 'linebreak' arguments are ignored. * * If (flags & #DNS_STYLEFLAG_COMMENT) != 0, output explanatory * comments next to things like the SOA timer fields. Some * comments (e.g., the SOA ones) are only printed when multiline * output is selected. * * base64 rdata text (e.g., DNSKEY records) will be split into chunks * of 'split_width' characters. If split_width == 0, the text will * not be split at all. If split_width == UINT_MAX (0xffffffff), then * it is undefined and falls back to the default value of 'width' */ isc_result_t dns_rdata_fromstruct(dns_rdata_t *rdata, dns_rdataclass_t rdclass, dns_rdatatype_t type, void *source, isc_buffer_t *target); /*%< * Convert the C structure representation of an rdata into uncompressed wire * format in 'target'. * * XXX Should we have a 'size' parameter as a sanity check on target? * * Requires: * *\li 'rdclass' and 'type' are valid. * *\li 'source' points to a valid C struct for the class and type. * *\li 'target' is a valid buffer. * *\li All structure pointers to memory blocks should be NULL if their * corresponding length values are zero. * * Ensures, * if result is success: * \li If 'rdata' is not NULL, it is attached to the target. * * \li The used space in 'target' is updated. * * Result: *\li Success *\li Various 'Bad Form' class failures depending on class and type *\li Resource Limit: Not enough space */ isc_result_t dns_rdata_tostruct(const dns_rdata_t *rdata, void *target, isc_mem_t *mctx); /*%< * Convert an rdata into its C structure representation. * * If 'mctx' is NULL then 'rdata' must persist while 'target' is being used. * * If 'mctx' is non NULL then memory will be allocated if required. * * Requires: * *\li 'rdata' is a valid, non-empty rdata. * *\li 'target' to point to a valid pointer for the type and class. * * Result: *\li Success *\li Resource Limit: Not enough memory */ void dns_rdata_freestruct(void *source); /*%< * Free dynamic memory attached to 'source' (if any). * * Requires: * *\li 'source' to point to the structure previously filled in by * dns_rdata_tostruct(). */ isc_boolean_t dns_rdatatype_ismeta(dns_rdatatype_t type); /*%< * Return true iff the rdata type 'type' is a meta-type * like ANY or AXFR. */ isc_boolean_t dns_rdatatype_issingleton(dns_rdatatype_t type); /*%< * Return true iff the rdata type 'type' is a singleton type, * like CNAME or SOA. * * Requires: * \li 'type' is a valid rdata type. * */ isc_boolean_t dns_rdataclass_ismeta(dns_rdataclass_t rdclass); /*%< * Return true iff the rdata class 'rdclass' is a meta-class * like ANY or NONE. */ isc_boolean_t dns_rdatatype_isdnssec(dns_rdatatype_t type); /*%< * Return true iff 'type' is one of the DNSSEC * rdata types that may exist alongside a CNAME record. * * Requires: * \li 'type' is a valid rdata type. */ isc_boolean_t dns_rdatatype_iszonecutauth(dns_rdatatype_t type); /*%< * Return true iff rdata of type 'type' is considered authoritative * data (not glue) in the NSEC chain when it occurs in the parent zone * at a zone cut. * * Requires: * \li 'type' is a valid rdata type. * */ isc_boolean_t dns_rdatatype_isknown(dns_rdatatype_t type); /*%< * Return true iff the rdata type 'type' is known. * * Requires: * \li 'type' is a valid rdata type. * */ isc_result_t dns_rdata_additionaldata(dns_rdata_t *rdata, dns_additionaldatafunc_t add, void *arg); /*%< * Call 'add' for each name and type from 'rdata' which is subject to * additional section processing. * * Requires: * *\li 'rdata' is a valid, non-empty rdata. * *\li 'add' is a valid dns_additionalfunc_t. * * Ensures: * *\li If successful, then add() will have been called for each name * and type subject to additional section processing. * *\li If add() returns something other than #ISC_R_SUCCESS, that result * will be returned as the result of dns_rdata_additionaldata(). * * Returns: * *\li ISC_R_SUCCESS * *\li Many other results are possible if not successful. */ isc_result_t dns_rdata_digest(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg); /*%< * Send 'rdata' in DNSSEC canonical form to 'digest'. * * Note: *\li 'digest' may be called more than once by dns_rdata_digest(). The * concatenation of all the regions, in the order they were given * to 'digest', will be the DNSSEC canonical form of 'rdata'. * * Requires: * *\li 'rdata' is a valid, non-empty rdata. * *\li 'digest' is a valid dns_digestfunc_t. * * Ensures: * *\li If successful, then all of the rdata's data has been sent, in * DNSSEC canonical form, to 'digest'. * *\li If digest() returns something other than ISC_R_SUCCESS, that result * will be returned as the result of dns_rdata_digest(). * * Returns: * *\li ISC_R_SUCCESS * *\li Many other results are possible if not successful. */ isc_boolean_t dns_rdatatype_questiononly(dns_rdatatype_t type); /*%< * Return true iff rdata of type 'type' can only appear in the question * section of a properly formatted message. * * Requires: * \li 'type' is a valid rdata type. * */ isc_boolean_t dns_rdatatype_notquestion(dns_rdatatype_t type); /*%< * Return true iff rdata of type 'type' can not appear in the question * section of a properly formatted message. * * Requires: * \li 'type' is a valid rdata type. * */ isc_boolean_t dns_rdatatype_atparent(dns_rdatatype_t type); /*%< * Return true iff rdata of type 'type' should appear at the parent of * a zone cut. * * Requires: * \li 'type' is a valid rdata type. * */ unsigned int dns_rdatatype_attributes(dns_rdatatype_t rdtype); /*%< * Return attributes for the given type. * * Requires: *\li 'rdtype' are known. * * Returns: *\li a bitmask consisting of the following flags. */ /*% only one may exist for a name */ #define DNS_RDATATYPEATTR_SINGLETON 0x00000001U /*% requires no other data be present */ #define DNS_RDATATYPEATTR_EXCLUSIVE 0x00000002U /*% Is a meta type */ #define DNS_RDATATYPEATTR_META 0x00000004U /*% Is a DNSSEC type, like RRSIG or NSEC */ #define DNS_RDATATYPEATTR_DNSSEC 0x00000008U /*% Is a zone cut authority type */ #define DNS_RDATATYPEATTR_ZONECUTAUTH 0x00000010U /*% Is reserved (unusable) */ #define DNS_RDATATYPEATTR_RESERVED 0x00000020U /*% Is an unknown type */ #define DNS_RDATATYPEATTR_UNKNOWN 0x00000040U /*% Is META, and can only be in a question section */ #define DNS_RDATATYPEATTR_QUESTIONONLY 0x00000080U /*% is META, and can NOT be in a question section */ #define DNS_RDATATYPEATTR_NOTQUESTION 0x00000100U /*% Is present at zone cuts in the parent, not the child */ #define DNS_RDATATYPEATTR_ATPARENT 0x00000200U dns_rdatatype_t dns_rdata_covers(dns_rdata_t *rdata); /*%< * Return the rdatatype that this type covers. * * Requires: *\li 'rdata' is a valid, non-empty rdata. * *\li 'rdata' is a type that covers other rdata types. * * Returns: *\li The type covered. */ isc_boolean_t dns_rdata_checkowner(dns_name_t* name, dns_rdataclass_t rdclass, dns_rdatatype_t type, isc_boolean_t wildcard); /* * Returns whether this is a valid ownername for this <type,class>. * If wildcard is true allow the first label to be a wildcard if * appropriate. * * Requires: * 'name' is a valid name. */ isc_boolean_t dns_rdata_checknames(dns_rdata_t *rdata, dns_name_t *owner, dns_name_t *bad); /* * Returns whether 'rdata' contains valid domain names. The checks are * sensitive to the owner name. * * If 'bad' is non-NULL and a domain name fails the check the * the offending name will be return in 'bad' by cloning from * the 'rdata' contents. * * Requires: * 'rdata' to be valid. * 'owner' to be valid. * 'bad' to be NULL or valid. */ void dns_rdata_exists(dns_rdata_t *rdata, dns_rdatatype_t type); void dns_rdata_notexist(dns_rdata_t *rdata, dns_rdatatype_t type); void dns_rdata_deleterrset(dns_rdata_t *rdata, dns_rdatatype_t type); void dns_rdata_makedelete(dns_rdata_t *rdata); const char * dns_rdata_updateop(dns_rdata_t *rdata, dns_section_t section); ISC_LANG_ENDDECLS #endif /* DNS_RDATA_H */ �������������������������������������������������������������������������������bind9/dns/rdataslab.h�������������������������������������������������������������������������������0000644�����������������00000010453�14763166026�0010461 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_RDATASLAB_H #define DNS_RDATASLAB_H 1 /*! \file dns/rdataslab.h * \brief * Implements storage of rdatasets into slabs of memory. * * MP: *\li Clients of this module must impose any required synchronization. * * Reliability: *\li This module deals with low-level byte streams. Errors in any of * the functions are likely to crash the server or corrupt memory. * *\li If the caller passes invalid memory references, these functions are * likely to crash the server or corrupt memory. * * Resources: *\li None. * * Security: *\li None. * * Standards: *\li None. */ /*** *** Imports ***/ #include <isc/lang.h> #include <dns/types.h> ISC_LANG_BEGINDECLS #define DNS_RDATASLAB_FORCE 0x1 #define DNS_RDATASLAB_EXACT 0x2 #define DNS_RDATASLAB_OFFLINE 0x01 /* RRSIG is for offline DNSKEY */ #define DNS_RDATASLAB_WARNMASK 0x0E /*%< RRSIG(DNSKEY) expired * warnings number mask. */ #define DNS_RDATASLAB_WARNSHIFT 1 /*%< How many bits to shift to find * remaining expired warning number. */ /*** *** Functions ***/ isc_result_t dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, isc_region_t *region, unsigned int reservelen); /*%< * Slabify a rdataset. The slab area will be allocated and returned * in 'region'. * * Requires: *\li 'rdataset' is valid. * * Ensures: *\li 'region' will have base pointing to the start of allocated memory, * with the slabified region beginning at region->base + reservelen. * region->length contains the total length allocated. * * Returns: *\li ISC_R_SUCCESS - successful completion *\li ISC_R_NOMEMORY - no memory. *\li XXX others */ void dns_rdataslab_tordataset(unsigned char *slab, unsigned int reservelen, dns_rdataclass_t rdclass, dns_rdatatype_t rdtype, dns_rdatatype_t covers, dns_ttl_t ttl, dns_rdataset_t *rdataset); /*%< * Construct an rdataset from a slab. * * Requires: *\li 'slab' points to a slab. *\li 'rdataset' is disassociated. * * Ensures: *\li 'rdataset' is associated and points to a valid rdataest. */ unsigned int dns_rdataslab_size(unsigned char *slab, unsigned int reservelen); /*%< * Return the total size of an rdataslab. * * Requires: *\li 'slab' points to a slab. * * Returns: *\li The number of bytes in the slab, including the reservelen. */ unsigned int dns_rdataslab_count(unsigned char *slab, unsigned int reservelen); /*%< * Return the number of records in the rdataslab * * Requires: *\li 'slab' points to a slab. * * Returns: *\li The number of records in the slab. */ isc_result_t dns_rdataslab_merge(unsigned char *oslab, unsigned char *nslab, unsigned int reservelen, isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_rdatatype_t type, unsigned int flags, unsigned char **tslabp); /*%< * Merge 'oslab' and 'nslab'. */ isc_result_t dns_rdataslab_subtract(unsigned char *mslab, unsigned char *sslab, unsigned int reservelen, isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_rdatatype_t type, unsigned int flags, unsigned char **tslabp); /*%< * Subtract 'sslab' from 'mslab'. If 'exact' is true then all elements * of 'sslab' must exist in 'mslab'. * * XXX * valid flags are DNS_RDATASLAB_EXACT */ isc_boolean_t dns_rdataslab_equal(unsigned char *slab1, unsigned char *slab2, unsigned int reservelen); /*%< * Compare two rdataslabs for equality. This does _not_ do a full * DNSSEC comparison. * * Requires: *\li 'slab1' and 'slab2' point to slabs. * * Returns: *\li ISC_TRUE if the slabs are equal, ISC_FALSE otherwise. */ isc_boolean_t dns_rdataslab_equalx(unsigned char *slab1, unsigned char *slab2, unsigned int reservelen, dns_rdataclass_t rdclass, dns_rdatatype_t type); /*%< * Compare two rdataslabs for DNSSEC equality. * * Requires: *\li 'slab1' and 'slab2' point to slabs. * * Returns: *\li ISC_TRUE if the slabs are equal, #ISC_FALSE otherwise. */ ISC_LANG_ENDDECLS #endif /* DNS_RDATASLAB_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/portlist.h��������������������������������������������������������������������������������0000644�����������������00000004057�14763166026�0010407 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! \file dns/portlist.h */ #include <isc/lang.h> #include <isc/net.h> #include <isc/types.h> #include <dns/types.h> #ifndef DNS_PORTLIST_H #define DNS_PORTLIST_H 1 ISC_LANG_BEGINDECLS isc_result_t dns_portlist_create(isc_mem_t *mctx, dns_portlist_t **portlistp); /*%< * Create a port list. * * Requires: *\li 'mctx' to be valid. *\li 'portlistp' to be non NULL and '*portlistp' to be NULL; * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li #ISC_R_UNEXPECTED */ isc_result_t dns_portlist_add(dns_portlist_t *portlist, int af, in_port_t port); /*%< * Add the given <port,af> tuple to the portlist. * * Requires: *\li 'portlist' to be valid. *\li 'af' to be AF_INET or AF_INET6 * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY */ void dns_portlist_remove(dns_portlist_t *portlist, int af, in_port_t port); /*%< * Remove the given <port,af> tuple to the portlist. * * Requires: *\li 'portlist' to be valid. *\li 'af' to be AF_INET or AF_INET6 */ isc_boolean_t dns_portlist_match(dns_portlist_t *portlist, int af, in_port_t port); /*%< * Find the given <port,af> tuple to the portlist. * * Requires: *\li 'portlist' to be valid. *\li 'af' to be AF_INET or AF_INET6 * * Returns * \li #ISC_TRUE if the tuple is found, ISC_FALSE otherwise. */ void dns_portlist_attach(dns_portlist_t *portlist, dns_portlist_t **portlistp); /*%< * Attach to a port list. * * Requires: *\li 'portlist' to be valid. *\li 'portlistp' to be non NULL and '*portlistp' to be NULL; */ void dns_portlist_detach(dns_portlist_t **portlistp); /*%< * Detach from a port list. * * Requires: *\li '*portlistp' to be valid. */ ISC_LANG_ENDDECLS #endif /* DNS_PORTLIST_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/ipkeylist.h�������������������������������������������������������������������������������0000644�����������������00000004172�14763166026�0010542 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_IPKEYLIST_H #define DNS_IPKEYLIST_H 1 #include <isc/types.h> #include <dns/types.h> /*% * A structure holding a list of addresses, dscps and keys. Used to * store masters for a slave zone, created by parsing config options. */ struct dns_ipkeylist { isc_sockaddr_t *addrs; isc_dscp_t *dscps; dns_name_t **keys; dns_name_t **labels; isc_uint32_t count; isc_uint32_t allocated; }; void dns_ipkeylist_init(dns_ipkeylist_t *ipkl); /*%< * Reset ipkl to empty state * * Requires: *\li 'ipkl' to be non NULL. */ void dns_ipkeylist_clear(isc_mem_t *mctx, dns_ipkeylist_t *ipkl); /*%< * Free `ipkl` contents using `mctx`. * * After this call, `ipkl` is a freshly cleared structure with all * pointers set to `NULL` and count set to 0. * * Requires: *\li 'mctx' to be a valid memory context. *\li 'ipkl' to be non NULL. */ isc_result_t dns_ipkeylist_copy(isc_mem_t *mctx, const dns_ipkeylist_t *src, dns_ipkeylist_t *dst); /*%< * Deep copy `src` into empty `dst`, allocating `dst`'s contents. * * Requires: *\li 'mctx' to be a valid memory context. *\li 'src' to be non NULL *\li 'dst' to be non NULL and point to an empty \ref dns_ipkeylist_t * with all pointers set to `NULL` and count set to 0. * * Returns: *\li #ISC_R_SUCCESS -- success *\li any other value -- failure */ isc_result_t dns_ipkeylist_resize(isc_mem_t *mctx, dns_ipkeylist_t *ipkl, unsigned int n); /*%< * Resize ipkl to contain n elements. Size (count) is not changed, and the * added space is zeroed. * * Requires: * \li 'mctx' to be a valid memory context. * \li 'ipk' to be non NULL * \li 'n' >= ipkl->count * * Returns: * \li #ISC_R_SUCCESS if successs * \li #ISC_R_NOMEMORY if there's no memory, ipkeylist is left untoched */ #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/ncache.h����������������������������������������������������������������������������������0000644�����������������00000011463�14763166026�0007747 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_NCACHE_H #define DNS_NCACHE_H 1 /***** ***** Module Info *****/ /*! \file dns/ncache.h *\brief * DNS Ncache * * XXX TBS XXX * * MP: *\li The caller must ensure any required synchronization. * * Reliability: *\li No anticipated impact. * * Resources: *\li TBS * * Security: *\li No anticipated impact. * * Standards: *\li RFC2308 */ #include <isc/lang.h> #include <isc/stdtime.h> #include <dns/types.h> ISC_LANG_BEGINDECLS /*% * _OMITDNSSEC: * Omit DNSSEC records when rendering. */ #define DNS_NCACHETOWIRE_OMITDNSSEC 0x0001 isc_result_t dns_ncache_add(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node, dns_rdatatype_t covers, isc_stdtime_t now, dns_ttl_t maxttl, dns_rdataset_t *addedrdataset); isc_result_t dns_ncache_addoptout(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node, dns_rdatatype_t covers, isc_stdtime_t now, dns_ttl_t maxttl, isc_boolean_t optout, dns_rdataset_t *addedrdataset); /*%< * Convert the authority data from 'message' into a negative cache * rdataset, and store it in 'cache' at 'node' with a TTL limited to * 'maxttl'. * * \li dns_ncache_add produces a negative cache entry with a trust of no * more than answer * \li dns_ncache_addoptout produces a negative cache entry which will have * a trust of secure if all the records that make up the entry are secure. * * The 'covers' argument is the RR type whose nonexistence we are caching, * or dns_rdatatype_any when caching a NXDOMAIN response. * * 'optout' indicates a DNS_RDATASETATTR_OPTOUT should be set. * * Note: *\li If 'addedrdataset' is not NULL, then it will be attached to the added * rdataset. See dns_db_addrdataset() for more details. * * Requires: *\li 'message' is a valid message with a properly formatting negative cache * authority section. * *\li The requirements of dns_db_addrdataset() apply to 'cache', 'node', * 'now', and 'addedrdataset'. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOSPACE * *\li Any result code of dns_db_addrdataset() is a possible result code * of dns_ncache_add(). */ isc_result_t dns_ncache_towire(dns_rdataset_t *rdataset, dns_compress_t *cctx, isc_buffer_t *target, unsigned int options, unsigned int *countp); /*%< * Convert the negative caching rdataset 'rdataset' to wire format, * compressing names as specified in 'cctx', and storing the result in * 'target'. If 'omit_dnssec' is set, DNSSEC records will not * be added to 'target'. * * Notes: *\li The number of RRs added to target will be added to *countp. * * Requires: *\li 'rdataset' is a valid negative caching rdataset. * *\li 'rdataset' is not empty. * *\li 'countp' is a valid pointer. * * Ensures: *\li On a return of ISC_R_SUCCESS, 'target' contains a wire format * for the data contained in 'rdataset'. Any error return leaves * the buffer unchanged. * *\li *countp has been incremented by the number of RRs added to * target. * * Returns: *\li #ISC_R_SUCCESS - all ok *\li #ISC_R_NOSPACE - 'target' doesn't have enough room * *\li Any error returned by dns_rdata_towire(), dns_rdataset_next(), * dns_name_towire(). */ isc_result_t dns_ncache_getrdataset(dns_rdataset_t *ncacherdataset, dns_name_t *name, dns_rdatatype_t type, dns_rdataset_t *rdataset); /*%< * Search the negative caching rdataset for an rdataset with the * specified name and type. * * Requires: *\li 'ncacherdataset' is a valid negative caching rdataset. * *\li 'ncacherdataset' is not empty. * *\li 'name' is a valid name. * *\li 'type' is not SIG, or a meta-RR type. * *\li 'rdataset' is a valid disassociated rdataset. * * Ensures: *\li On a return of ISC_R_SUCCESS, 'rdataset' is bound to the found * rdataset. * * Returns: *\li #ISC_R_SUCCESS - the rdataset was found. *\li #ISC_R_NOTFOUND - the rdataset was not found. * */ isc_result_t dns_ncache_getsigrdataset(dns_rdataset_t *ncacherdataset, dns_name_t *name, dns_rdatatype_t covers, dns_rdataset_t *rdataset); /*%< * Similar to dns_ncache_getrdataset() but get the rrsig that matches. */ void dns_ncache_current(dns_rdataset_t *ncacherdataset, dns_name_t *found, dns_rdataset_t *rdataset); /*%< * Extract the current rdataset and name from a ncache entry. * * Requires: * \li 'ncacherdataset' to be valid and to be a negative cache entry * \li 'found' to be valid. * \li 'rdataset' to be unassociated. */ ISC_LANG_ENDDECLS #endif /* DNS_NCACHE_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/zonekey.h���������������������������������������������������������������������������������0000644�����������������00000001373�14763166026�0010211 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_ZONEKEY_H #define DNS_ZONEKEY_H 1 /*! \file dns/zonekey.h */ #include <isc/lang.h> #include <dns/types.h> ISC_LANG_BEGINDECLS isc_boolean_t dns_zonekey_iszonekey(dns_rdata_t *keyrdata); /*%< * Determines if the key record contained in the rdata is a zone key. * * Requires: * 'keyrdata' is not NULL. */ ISC_LANG_ENDDECLS #endif /* DNS_ZONEKEY_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/rbt.h�������������������������������������������������������������������������������������0000644�����������������00000117310�14763166026�0007313 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_RBT_H #define DNS_RBT_H 1 /*! \file dns/rbt.h */ #include <isc/assertions.h> #include <isc/crc64.h> #include <isc/lang.h> #include <isc/magic.h> #include <isc/refcount.h> #include <dns/types.h> ISC_LANG_BEGINDECLS #define DNS_RBT_USEHASH 1 /*@{*/ /*% * Option values for dns_rbt_findnode() and dns_rbt_findname(). * These are used to form a bitmask. */ #define DNS_RBTFIND_NOOPTIONS 0x00 #define DNS_RBTFIND_EMPTYDATA 0x01 #define DNS_RBTFIND_NOEXACT 0x02 #define DNS_RBTFIND_NOPREDECESSOR 0x04 /*@}*/ #ifndef DNS_RBT_USEISCREFCOUNT #ifdef ISC_REFCOUNT_HAVEATOMIC #define DNS_RBT_USEISCREFCOUNT 1 #endif #endif #define DNS_RBT_USEMAGIC 1 /* * These should add up to 30. */ #define DNS_RBT_LOCKLENGTH 10 #define DNS_RBT_REFLENGTH 20 #define DNS_RBTNODE_MAGIC ISC_MAGIC('R','B','N','O') #if DNS_RBT_USEMAGIC #define DNS_RBTNODE_VALID(n) ISC_MAGIC_VALID(n, DNS_RBTNODE_MAGIC) #else #define DNS_RBTNODE_VALID(n) ISC_TRUE #endif /*% * This is the structure that is used for each node in the red/black * tree of trees. NOTE WELL: the implementation manages this as a variable * length structure, with the actual wire-format name and other data * appended to this structure. Allocating a contiguous block of memory for * multiple dns_rbtnode structures will not work. */ typedef struct dns_rbtnode dns_rbtnode_t; enum { DNS_RBT_NSEC_NORMAL=0, /* in main tree */ DNS_RBT_NSEC_HAS_NSEC=1, /* also has node in nsec tree */ DNS_RBT_NSEC_NSEC=2, /* in nsec tree */ DNS_RBT_NSEC_NSEC3=3 /* in nsec3 tree */ }; struct dns_rbtnode { #if DNS_RBT_USEMAGIC unsigned int magic; #endif /*@{*/ /*! * The following bitfields add up to a total bitwidth of 32. * The range of values necessary for each item is indicated, * but in the case of "attributes" the field is wider to accommodate * possible future expansion. * * In each case below the "range" indicated is what's _necessary_ for * the bitfield to hold, not what it actually _can_ hold. * * Note: Tree lock must be held before modifying these * bit-fields. * * Note: The two "unsigned int :0;" unnamed bitfields on either * side of the bitfields below are scaffolding that border the * set of bitfields which are accessed after acquiring the tree * lock. Please don't insert any other bitfield members between * the unnamed bitfields unless they should also be accessed * after acquiring the tree lock. */ unsigned int :0; /* start of bitfields c/o tree lock */ unsigned int is_root : 1; /*%< range is 0..1 */ unsigned int color : 1; /*%< range is 0..1 */ unsigned int find_callback : 1; /*%< range is 0..1 */ unsigned int attributes : 3; /*%< range is 0..2 */ unsigned int nsec : 2; /*%< range is 0..3 */ unsigned int namelen : 8; /*%< range is 1..255 */ unsigned int offsetlen : 8; /*%< range is 1..128 */ unsigned int oldnamelen : 8; /*%< range is 1..255 */ /*@}*/ /* flags needed for serialization to file*/ unsigned int is_mmapped : 1; unsigned int parent_is_relative : 1; unsigned int left_is_relative : 1; unsigned int right_is_relative : 1; unsigned int down_is_relative : 1; unsigned int data_is_relative : 1; /* node needs to be cleaned from rpz */ unsigned int rpz : 1; unsigned int :0; /* end of bitfields c/o tree lock */ #ifdef DNS_RBT_USEHASH unsigned int hashval; dns_rbtnode_t *uppernode; dns_rbtnode_t *hashnext; #endif dns_rbtnode_t *parent; dns_rbtnode_t *left; dns_rbtnode_t *right; dns_rbtnode_t *down; /*% * Used for LRU cache. This linked list is used to mark nodes which * have no data any longer, but we cannot unlink at that exact moment * because we did not or could not obtain a write lock on the tree. */ ISC_LINK(dns_rbtnode_t) deadlink; /*@{*/ /*! * These values are used in the RBT DB implementation. The appropriate * node lock must be held before accessing them. * * Note: The two "unsigned int :0;" unnamed bitfields on either * side of the bitfields below are scaffolding that border the * set of bitfields which are accessed after acquiring the node * lock. Please don't insert any other bitfield members between * the unnamed bitfields unless they should also be accessed * after acquiring the node lock. * * NOTE: Do not merge these fields into bitfields above, as * they'll all be put in the same qword that could be accessed * without the node lock as it shares the qword with other * members. Leave these members here so that they occupy a * separate region of memory. */ void *data; unsigned int :0; /* start of bitfields c/o node lock */ unsigned int dirty:1; unsigned int wild:1; unsigned int locknum:DNS_RBT_LOCKLENGTH; #ifndef DNS_RBT_USEISCREFCOUNT unsigned int references:DNS_RBT_REFLENGTH; #endif unsigned int :0; /* end of bitfields c/o node lock */ #ifdef DNS_RBT_USEISCREFCOUNT isc_refcount_t references; /* note that this is not in the bitfield */ #endif /*@}*/ }; typedef isc_result_t (*dns_rbtfindcallback_t)(dns_rbtnode_t *node, dns_name_t *name, void *callback_arg); typedef isc_result_t (*dns_rbtdatawriter_t)(FILE *file, unsigned char *data, void *arg, isc_uint64_t *crc); typedef isc_result_t (*dns_rbtdatafixer_t)(dns_rbtnode_t *rbtnode, void *base, size_t offset, void *arg, isc_uint64_t *crc); typedef void (*dns_rbtdeleter_t)(void *, void *); /***** ***** Chain Info *****/ /*! * A chain is used to keep track of the sequence of nodes to reach any given * node from the root of the tree. Originally nodes did not have parent * pointers in them (for memory usage reasons) so there was no way to find * the path back to the root from any given node. Now that nodes have parent * pointers, chains might be going away in a future release, though the * movement functionality would remain. * * Chains may be used to iterate over a tree of trees. After setting up the * chain's structure using dns_rbtnodechain_init(), it needs to be initialized * to point to the lexically first or lexically last node in the tree of trees * using dns_rbtnodechain_first() or dns_rbtnodechain_last(), respectively. * Calling dns_rbtnodechain_next() or dns_rbtnodechain_prev() then moves the * chain over to the next or previous node, respectively. * * In any event, parent information, whether via parent pointers or chains, is * necessary information for iterating through the tree or for basic internal * tree maintenance issues (ie, the rotations that are done to rebalance the * tree when a node is added). The obvious implication of this is that for a * chain to remain valid, the tree has to be locked down against writes for the * duration of the useful life of the chain, because additions or removals can * change the path from the root to the node the chain has targeted. * * The dns_rbtnodechain_ functions _first, _last, _prev and _next all take * dns_name_t parameters for the name and the origin, which can be NULL. If * non-NULL, 'name' will end up pointing to the name data and offsets that are * stored at the node (and thus it will be read-only), so it should be a * regular dns_name_t that has been initialized with dns_name_init. When * 'origin' is non-NULL, it will get the name of the origin stored in it, so it * needs to have its own buffer space and offsets, which is most easily * accomplished with a dns_fixedname_t. It is _not_ necessary to reinitialize * either 'name' or 'origin' between calls to the chain functions. * * NOTE WELL: even though the name data at the root of the tree of trees will * be absolute (typically just "."), it will will be made into a relative name * with an origin of "." -- an empty name when the node is ".". This is * because a common on operation on 'name' and 'origin' is to use * dns_name_concatenate() on them to generate the complete name. An empty name * can be detected when dns_name_countlabels == 0, and is printed by * dns_name_totext()/dns_name_format() as "@", consistent with RFC1035's * definition of "@" as the current origin. * * dns_rbtnodechain_current is similar to the _first, _last, _prev and _next * functions but additionally can provide the node to which the chain points. */ /*% * The number of level blocks to allocate at a time. Currently the maximum * number of levels is allocated directly in the structure, but future * revisions of this code might have a static initial block with dynamic * growth. Allocating space for 256 levels when the tree is almost never that * deep is wasteful, but it's not clear that it matters, since the waste is * only 2MB for 1000 concurrently active chains on a system with 64-bit * pointers. */ #define DNS_RBT_LEVELBLOCK 254 typedef struct dns_rbtnodechain { unsigned int magic; isc_mem_t * mctx; /*% * The terminal node of the chain. It is not in levels[]. * This is ostensibly private ... but in a pinch it could be * used tell that the chain points nowhere without needing to * call dns_rbtnodechain_current(). */ dns_rbtnode_t * end; /*% * The maximum number of labels in a name is 128; bitstrings mean * a conceptually very large number (which I have not bothered to * compute) of logical levels because splitting can potentially occur * at each bit. However, DNSSEC restricts the number of "logical" * labels in a name to 255, meaning only 254 pointers are needed * in the worst case. */ dns_rbtnode_t * levels[DNS_RBT_LEVELBLOCK]; /*% * level_count indicates how deep the chain points into the * tree of trees, and is the index into the levels[] array. * Thus, levels[level_count - 1] is the last level node stored. * A chain that points to the top level of the tree of trees has * a level_count of 0, the first level has a level_count of 1, and * so on. */ unsigned int level_count; /*% * level_matches tells how many levels matched above the node * returned by dns_rbt_findnode(). A match (partial or exact) found * in the first level thus results in level_matches being set to 1. * This is used by the rbtdb to set the start point for a recursive * search of superdomains until the RR it is looking for is found. */ unsigned int level_matches; } dns_rbtnodechain_t; /***** ***** Public interfaces. *****/ isc_result_t dns_rbt_create(isc_mem_t *mctx, dns_rbtdeleter_t deleter, void *deleter_arg, dns_rbt_t **rbtp); /*%< * Initialize a red-black tree of trees. * * Notes: *\li The deleter argument, if non-null, points to a function that is * responsible for cleaning up any memory associated with the data * pointer of a node when the node is deleted. It is passed the * deleted node's data pointer as its first argument and deleter_arg * as its second argument. * * Requires: * \li mctx is a pointer to a valid memory context. *\li rbtp != NULL && *rbtp == NULL *\li arg == NULL iff deleter == NULL * * Ensures: *\li If result is ISC_R_SUCCESS: * *rbtp points to a valid red-black tree manager * *\li If result is failure: * *rbtp does not point to a valid red-black tree manager. * * Returns: *\li #ISC_R_SUCCESS Success *\li #ISC_R_NOMEMORY Resource limit: Out of Memory */ isc_result_t dns_rbt_addname(dns_rbt_t *rbt, dns_name_t *name, void *data); /*%< * Add 'name' to the tree of trees, associated with 'data'. * * Notes: *\li 'data' is never required to be non-NULL, but specifying it * when the name is added is faster than searching for 'name' * again and then setting the data pointer. The lack of a data pointer * for a node also has other ramifications regarding whether * dns_rbt_findname considers a node to exist, or dns_rbt_deletename * joins nodes. * * Requires: *\li rbt is a valid rbt manager. *\li dns_name_isabsolute(name) == TRUE * * Ensures: *\li 'name' is not altered in any way. * *\li Any external references to nodes in the tree are unaffected by * node splits that are necessary to insert the new name. * *\li If result is #ISC_R_SUCCESS: * 'name' is findable in the red/black tree of trees in O(log N). * The data pointer of the node for 'name' is set to 'data'. * *\li If result is #ISC_R_EXISTS or #ISC_R_NOSPACE: * The tree of trees is unaltered. * *\li If result is #ISC_R_NOMEMORY: * No guarantees. * * Returns: *\li #ISC_R_SUCCESS Success *\li #ISC_R_EXISTS The name already exists with associated data. *\li #ISC_R_NOSPACE The name had more logical labels than are allowed. *\li #ISC_R_NOMEMORY Resource Limit: Out of Memory */ isc_result_t dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep); /*%< * Just like dns_rbt_addname, but returns the address of the node. * * Requires: *\li rbt is a valid rbt structure. *\li dns_name_isabsolute(name) == TRUE *\li nodep != NULL && *nodep == NULL * * Ensures: *\li 'name' is not altered in any way. * *\li Any external references to nodes in the tree are unaffected by * node splits that are necessary to insert the new name. * *\li If result is ISC_R_SUCCESS: * 'name' is findable in the red/black tree of trees in O(log N). * *nodep is the node that was added for 'name'. * *\li If result is ISC_R_EXISTS: * The tree of trees is unaltered. * *nodep is the existing node for 'name'. * *\li If result is ISC_R_NOMEMORY: * No guarantees. * * Returns: *\li #ISC_R_SUCCESS Success *\li #ISC_R_EXISTS The name already exists, possibly without data. *\li #ISC_R_NOMEMORY Resource Limit: Out of Memory */ isc_result_t dns_rbt_findname(dns_rbt_t *rbt, const dns_name_t *name, unsigned int options, dns_name_t *foundname, void **data); /*%< * Get the data pointer associated with 'name'. * * Notes: *\li When #DNS_RBTFIND_NOEXACT is set, the closest matching superdomain is * returned (also subject to #DNS_RBTFIND_EMPTYDATA), even when there is * an exact match in the tree. * *\li A node that has no data is considered not to exist for this function, * unless the #DNS_RBTFIND_EMPTYDATA option is set. * * Requires: *\li rbt is a valid rbt manager. *\li dns_name_isabsolute(name) == TRUE *\li data != NULL && *data == NULL * * Ensures: *\li 'name' and the tree are not altered in any way. * *\li If result is ISC_R_SUCCESS: * *data is the data associated with 'name'. * *\li If result is DNS_R_PARTIALMATCH: * *data is the data associated with the deepest superdomain * of 'name' which has data. * *\li If result is ISC_R_NOTFOUND: * Neither the name nor a superdomain was found with data. * * Returns: *\li #ISC_R_SUCCESS Success *\li #DNS_R_PARTIALMATCH Superdomain found with data *\li #ISC_R_NOTFOUND No match *\li #ISC_R_NOSPACE Concatenating nodes to form foundname failed */ isc_result_t dns_rbt_findnode(dns_rbt_t *rbt, const dns_name_t *name, dns_name_t *foundname, dns_rbtnode_t **node, dns_rbtnodechain_t *chain, unsigned int options, dns_rbtfindcallback_t callback, void *callback_arg); /*%< * Find the node for 'name'. * * Notes: *\li A node that has no data is considered not to exist for this function, * unless the DNS_RBTFIND_EMPTYDATA option is set. This applies to both * exact matches and partial matches. * *\li If the chain parameter is non-NULL, then the path through the tree * to the DNSSEC predecessor of the searched for name is maintained, * unless the DNS_RBTFIND_NOPREDECESSOR or DNS_RBTFIND_NOEXACT option * is used. (For more details on those options, see below.) * *\li If there is no predecessor, then the chain will point to nowhere, as * indicated by chain->end being NULL or dns_rbtnodechain_current * returning ISC_R_NOTFOUND. Note that in a normal Internet DNS RBT * there will always be a predecessor for all names except the root * name, because '.' will exist and '.' is the predecessor of * everything. But you can certainly construct a trivial tree and a * search for it that has no predecessor. * *\li Within the chain structure, the 'levels' member of the structure holds * the root node of each level except the first. * *\li The 'level_count' of the chain indicates how deep the chain to the * predecessor name is, as an index into the 'levels[]' array. It does * not count name elements, per se, but only levels of the tree of trees, * the distinction arising because multiple labels from a name can be * stored on only one level. It is also does not include the level * that has the node, since that level is not stored in levels[]. * *\li The chain's 'level_matches' is not directly related to the predecessor. * It is the number of levels above the level of the found 'node', * regardless of whether it was a partial match or exact match. When * the node is found in the top level tree, or no node is found at all, * level_matches is 0. * *\li When DNS_RBTFIND_NOEXACT is set, the closest matching superdomain is * returned (also subject to DNS_RBTFIND_EMPTYDATA), even when * there is an exact match in the tree. In this case, the chain * will not point to the DNSSEC predecessor, but will instead point * to the exact match, if there was any. Thus the preceding paragraphs * should have "exact match" substituted for "predecessor" to describe * how the various elements of the chain are set. This was done to * ensure that the chain's state was sane, and to prevent problems that * occurred when running the predecessor location code under conditions * it was not designed for. It is not clear *where* the chain should * point when DNS_RBTFIND_NOEXACT is set, so if you end up using a chain * with this option because you want a particular node, let us know * where you want the chain pointed, so this can be made more firm. * * Requires: *\li rbt is a valid rbt manager. *\li dns_name_isabsolute(name) == TRUE. *\li node != NULL && *node == NULL. *\li #DNS_RBTFIND_NOEXACT and DNS_RBTFIND_NOPREDECESSOR are mutually * exclusive. * * Ensures: *\li 'name' and the tree are not altered in any way. * *\li If result is ISC_R_SUCCESS: *\verbatim * *node is the terminal node for 'name'. * 'foundname' and 'name' represent the same name (though not * the same memory). * 'chain' points to the DNSSEC predecessor, if any, of 'name'. * * chain->level_matches and chain->level_count are equal. *\endverbatim * * If result is DNS_R_PARTIALMATCH: *\verbatim * *node is the data associated with the deepest superdomain * of 'name' which has data. * * 'foundname' is the name of deepest superdomain (which has * data, unless the DNS_RBTFIND_EMPTYDATA option is set). * * 'chain' points to the DNSSEC predecessor, if any, of 'name'. *\endverbatim * *\li If result is ISC_R_NOTFOUND: *\verbatim * Neither the name nor a superdomain was found. *node is NULL. * * 'chain' points to the DNSSEC predecessor, if any, of 'name'. * * chain->level_matches is 0. *\endverbatim * * Returns: *\li #ISC_R_SUCCESS Success *\li #DNS_R_PARTIALMATCH Superdomain found with data *\li #ISC_R_NOTFOUND No match, or superdomain with no data *\li #ISC_R_NOSPACE Concatenating nodes to form foundname failed */ isc_result_t dns_rbt_deletename(dns_rbt_t *rbt, dns_name_t *name, isc_boolean_t recurse); /*%< * Delete 'name' from the tree of trees. * * Notes: *\li When 'name' is removed, if recurse is ISC_TRUE then all of its * subnames are removed too. * * Requires: *\li rbt is a valid rbt manager. *\li dns_name_isabsolute(name) == TRUE * * Ensures: *\li 'name' is not altered in any way. * *\li Does NOT ensure that any external references to nodes in the tree * are unaffected by node joins. * *\li If result is ISC_R_SUCCESS: * 'name' does not appear in the tree with data; however, * the node for the name might still exist which can be * found with dns_rbt_findnode (but not dns_rbt_findname). * *\li If result is ISC_R_NOTFOUND: * 'name' does not appear in the tree with data, because * it did not appear in the tree before the function was called. * *\li If result is something else: * See result codes for dns_rbt_findnode (if it fails, the * node is not deleted) or dns_rbt_deletenode (if it fails, * the node is deleted, but the tree is not optimized when * it could have been). * * Returns: *\li #ISC_R_SUCCESS Success *\li #ISC_R_NOTFOUND No match *\li something_else Any return code from dns_rbt_findnode except * DNS_R_PARTIALMATCH (which causes ISC_R_NOTFOUND * to be returned instead), and any code from * dns_rbt_deletenode. */ isc_result_t dns_rbt_deletenode(dns_rbt_t *rbt, dns_rbtnode_t *node, isc_boolean_t recurse); /*%< * Delete 'node' from the tree of trees. * * Notes: *\li When 'node' is removed, if recurse is ISC_TRUE then all nodes * in levels down from it are removed too. * * Requires: *\li rbt is a valid rbt manager. *\li node != NULL. * * Ensures: *\li Does NOT ensure that any external references to nodes in the tree * are unaffected by node joins. * *\li If result is ISC_R_SUCCESS: * 'node' does not appear in the tree with data; however, * the node might still exist if it serves as a pointer to * a lower tree level as long as 'recurse' was false, hence * the node could can be found with dns_rbt_findnode when * that function's empty_data_ok parameter is true. * *\li If result is ISC_R_NOMEMORY or ISC_R_NOSPACE: * The node was deleted, but the tree structure was not * optimized. * * Returns: *\li #ISC_R_SUCCESS Success *\li #ISC_R_NOMEMORY Resource Limit: Out of Memory when joining nodes. *\li #ISC_R_NOSPACE dns_name_concatenate failed when joining nodes. */ void dns_rbt_namefromnode(dns_rbtnode_t *node, dns_name_t *name); /*%< * Convert the sequence of labels stored at 'node' into a 'name'. * * Notes: *\li This function does not return the full name, from the root, but * just the labels at the indicated node. * *\li The name data pointed to by 'name' is the information stored * in the node, not a copy. Altering the data at this pointer * will likely cause grief. * * Requires: * \li name->offsets == NULL * * Ensures: * \li 'name' is DNS_NAMEATTR_READONLY. * * \li 'name' will point directly to the labels stored after the * dns_rbtnode_t struct. * * \li 'name' will have offsets that also point to the information stored * as part of the node. */ isc_result_t dns_rbt_fullnamefromnode(dns_rbtnode_t *node, dns_name_t *name); /*%< * Like dns_rbt_namefromnode, but returns the full name from the root. * * Notes: * \li Unlike dns_rbt_namefromnode, the name will not point directly * to node data. Rather, dns_name_concatenate will be used to copy * the name data from each node into the 'name' argument. * * Requires: * \li name != NULL * \li name has a dedicated buffer. * * Returns: * \li ISC_R_SUCCESS * \li ISC_R_NOSPACE (possible via dns_name_concatenate) * \li DNS_R_NAMETOOLONG (possible via dns_name_concatenate) */ char * dns_rbt_formatnodename(dns_rbtnode_t *node, char *printname, unsigned int size); /*%< * Format the full name of a node for printing, using dns_name_format(). * * Notes: * \li 'size' is the length of the printname buffer. This should be * DNS_NAME_FORMATSIZE or larger. * * Requires: * \li node and printname are not NULL. * * Returns: * \li The 'printname' pointer. */ unsigned int dns_rbt_nodecount(dns_rbt_t *rbt); /*%< * Obtain the number of nodes in the tree of trees. * * Requires: * \li rbt is a valid rbt manager. */ size_t dns_rbt_hashsize(dns_rbt_t *rbt); /*%< * Obtain the current number of buckets in the 'rbt' hash table. * * Requires: * \li rbt is a valid rbt manager. */ void dns_rbt_destroy(dns_rbt_t **rbtp); isc_result_t dns_rbt_destroy2(dns_rbt_t **rbtp, unsigned int quantum); /*%< * Stop working with a red-black tree of trees. * If 'quantum' is zero then the entire tree will be destroyed. * If 'quantum' is non zero then up to 'quantum' nodes will be destroyed * allowing the rbt to be incrementally destroyed by repeated calls to * dns_rbt_destroy2(). Once dns_rbt_destroy2() has been called no other * operations than dns_rbt_destroy()/dns_rbt_destroy2() should be * performed on the tree of trees. * * Requires: * \li *rbt is a valid rbt manager. * * Ensures on ISC_R_SUCCESS: * \li All space allocated by the RBT library has been returned. * * \li *rbt is invalidated as an rbt manager. * * Returns: * \li ISC_R_SUCCESS * \li ISC_R_QUOTA if 'quantum' nodes have been destroyed. */ off_t dns_rbt_serialize_align(off_t target); /*%< * Align the provided integer to a pointer-size boundary. * This should be used if, during serialization of data to a will-be * mmap()ed file, a pointer alignment is needed for some data. */ isc_result_t dns_rbt_serialize_tree(FILE *file, dns_rbt_t *rbt, dns_rbtdatawriter_t datawriter, void *writer_arg, off_t *offset); /*%< * Write out the RBT structure and its data to a file. * * Notes: * \li The file must be an actual file which allows seek() calls, so it cannot * be a stream. Returns ISC_R_INVALIDFILE if not. */ isc_result_t dns_rbt_deserialize_tree(void *base_address, size_t filesize, off_t header_offset, isc_mem_t *mctx, dns_rbtdeleter_t deleter, void *deleter_arg, dns_rbtdatafixer_t datafixer, void *fixer_arg, dns_rbtnode_t **originp, dns_rbt_t **rbtp); /*%< * Read a RBT structure and its data from a file. * * If 'originp' is not NULL, then it is pointed to the root node of the RBT. * * Notes: * \li The file must be an actual file which allows seek() calls, so it cannot * be a stream. This condition is not checked in the code. */ void dns_rbt_printtext(dns_rbt_t *rbt, void (*data_printer)(FILE *, void *), FILE *f); /*%< * Print an ASCII representation of the internal structure of the red-black * tree of trees to the passed stream. * * data_printer is a callback function that is called to print the data * in a node. It should print it to the passed FILE stream. * * Notes: * \li The name stored at each node, along with the node's color, is printed. * Then the down pointer, left and right pointers are displayed * recursively in turn. NULL down pointers are silently omitted; * NULL left and right pointers are printed. */ void dns_rbt_printdot(dns_rbt_t *rbt, isc_boolean_t show_pointers, FILE *f); /*%< * Print a GraphViz dot representation of the internal structure of the * red-black tree of trees to the passed stream. * * If show_pointers is TRUE, pointers are also included in the generated * graph. * * Notes: * \li The name stored at each node, along with the node's color is displayed. * Then the down pointer, left and right pointers are displayed * recursively in turn. NULL left, right and down pointers are * silently omitted. */ void dns_rbt_printnodeinfo(dns_rbtnode_t *n, FILE *f); /*%< * Print out various information about a node * * Requires: *\li 'n' is a valid pointer. * *\li 'f' points to a valid open FILE structure that allows writing. */ size_t dns__rbt_getheight(dns_rbt_t *rbt); /*%< * Return the maximum height of sub-root nodes found in the red-black * forest. * * The height of a node is defined as the number of nodes in the longest * path from the node to a leaf. For each subtree in the forest, this * function determines the height of its root node. Then it returns the * maximum such height in the forest. * * Note: This function exists for testing purposes. Non-test code must * not use it. * * Requires: * \li rbt is a valid rbt manager. */ isc_boolean_t dns__rbt_checkproperties(dns_rbt_t *rbt); /*%< * Check red-black properties of the forest. * * Note: This function exists for testing purposes. Non-test code must * not use it. * * Requires: * \li rbt is a valid rbt manager. */ size_t dns__rbtnode_getdistance(dns_rbtnode_t *node); /*%< * Return the distance (in nodes) from the node to its upper node of its * subtree. The root node has a distance of 1. A child of the root node * has a distance of 2. */ /***** ***** Chain Functions *****/ void dns_rbtnodechain_init(dns_rbtnodechain_t *chain, isc_mem_t *mctx); /*%< * Initialize 'chain'. * * Requires: *\li 'chain' is a valid pointer. * *\li 'mctx' is a valid memory context. * * Ensures: *\li 'chain' is suitable for use. */ void dns_rbtnodechain_reset(dns_rbtnodechain_t *chain); /*%< * Free any dynamic storage associated with 'chain', and then reinitialize * 'chain'. * * Requires: *\li 'chain' is a valid pointer. * * Ensures: *\li 'chain' is suitable for use, and uses no dynamic storage. */ void dns_rbtnodechain_invalidate(dns_rbtnodechain_t *chain); /*%< * Free any dynamic storage associated with 'chain', and then invalidates it. * * Notes: *\li Future calls to any dns_rbtnodechain_ function will need to call * dns_rbtnodechain_init on the chain first (except, of course, * dns_rbtnodechain_init itself). * * Requires: *\li 'chain' is a valid chain. * * Ensures: *\li 'chain' is no longer suitable for use, and uses no dynamic storage. */ isc_result_t dns_rbtnodechain_current(dns_rbtnodechain_t *chain, dns_name_t *name, dns_name_t *origin, dns_rbtnode_t **node); /*%< * Provide the name, origin and node to which the chain is currently pointed. * * Notes: *\li The tree need not have be locked against additions for the chain * to remain valid, however there are no guarantees if any deletion * has been made since the chain was established. * * Requires: *\li 'chain' is a valid chain. * * Ensures: *\li 'node', if non-NULL, is the node to which the chain was pointed * by dns_rbt_findnode, dns_rbtnodechain_first or dns_rbtnodechain_last. * If none were called for the chain since it was initialized or reset, * or if the was no predecessor to the name searched for with * dns_rbt_findnode, then '*node' is NULL and ISC_R_NOTFOUND is returned. * *\li 'name', if non-NULL, is the name stored at the terminal level of * the chain. This is typically a single label, like the "www" of * "www.isc.org", but need not be so. At the root of the tree of trees, * if the node is "." then 'name' is ".", otherwise it is relative to ".". * (Minimalist and atypical case: if the tree has just the name * "isc.org." then the root node's stored name is "isc.org." but 'name' * will be "isc.org".) * *\li 'origin', if non-NULL, is the sequence of labels in the levels * above the terminal level, such as "isc.org." in the above example. * 'origin' is always "." for the root node. * * * Returns: *\li #ISC_R_SUCCESS name, origin & node were successfully set. *\li #ISC_R_NOTFOUND The chain does not point to any node. *\li <something_else> Any error return from dns_name_concatenate. */ isc_result_t dns_rbtnodechain_first(dns_rbtnodechain_t *chain, dns_rbt_t *rbt, dns_name_t *name, dns_name_t *origin); /*%< * Set the chain to the lexically first node in the tree of trees. * * Notes: *\li By the definition of ordering for DNS names, the root of the tree of * trees is the very first node, since everything else in the megatree * uses it as a common suffix. * * Requires: *\li 'chain' is a valid chain. *\li 'rbt' is a valid rbt manager. * * Ensures: *\li The chain points to the very first node of the tree. * *\li 'name' and 'origin', if non-NULL, are set as described for * dns_rbtnodechain_current. Thus 'origin' will always be ".". * * Returns: *\li #DNS_R_NEWORIGIN The name & origin were successfully set. *\li <something_else> Any error result from dns_rbtnodechain_current. */ isc_result_t dns_rbtnodechain_last(dns_rbtnodechain_t *chain, dns_rbt_t *rbt, dns_name_t *name, dns_name_t *origin); /*%< * Set the chain to the lexically last node in the tree of trees. * * Requires: *\li 'chain' is a valid chain. *\li 'rbt' is a valid rbt manager. * * Ensures: *\li The chain points to the very last node of the tree. * *\li 'name' and 'origin', if non-NULL, are set as described for * dns_rbtnodechain_current. * * Returns: *\li #DNS_R_NEWORIGIN The name & origin were successfully set. *\li #ISC_R_NOMEMORY Resource Limit: Out of Memory building chain. *\li <something_else> Any error result from dns_name_concatenate. */ isc_result_t dns_rbtnodechain_prev(dns_rbtnodechain_t *chain, dns_name_t *name, dns_name_t *origin); /*%< * Adjusts chain to point the DNSSEC predecessor of the name to which it * is currently pointed. * * Requires: *\li 'chain' is a valid chain. *\li 'chain' has been pointed somewhere in the tree with dns_rbt_findnode, * dns_rbtnodechain_first or dns_rbtnodechain_last -- and remember that * dns_rbt_findnode is not guaranteed to point the chain somewhere, * since there may have been no predecessor to the searched for name. * * Ensures: *\li The chain is pointed to the predecessor of its current target. * *\li 'name' and 'origin', if non-NULL, are set as described for * dns_rbtnodechain_current. * *\li 'origin' is only if a new origin was found. * * Returns: *\li #ISC_R_SUCCESS The predecessor was found and 'name' was set. *\li #DNS_R_NEWORIGIN The predecessor was found with a different * origin and 'name' and 'origin' were set. *\li #ISC_R_NOMORE There was no predecessor. *\li <something_else> Any error result from dns_rbtnodechain_current. */ isc_result_t dns_rbtnodechain_next(dns_rbtnodechain_t *chain, dns_name_t *name, dns_name_t *origin); /*%< * Adjusts chain to point the DNSSEC successor of the name to which it * is currently pointed. * * Requires: *\li 'chain' is a valid chain. *\li 'chain' has been pointed somewhere in the tree with dns_rbt_findnode, * dns_rbtnodechain_first or dns_rbtnodechain_last -- and remember that * dns_rbt_findnode is not guaranteed to point the chain somewhere, * since there may have been no predecessor to the searched for name. * * Ensures: *\li The chain is pointed to the successor of its current target. * *\li 'name' and 'origin', if non-NULL, are set as described for * dns_rbtnodechain_current. * *\li 'origin' is only if a new origin was found. * * Returns: *\li #ISC_R_SUCCESS The successor was found and 'name' was set. *\li #DNS_R_NEWORIGIN The successor was found with a different * origin and 'name' and 'origin' were set. *\li #ISC_R_NOMORE There was no successor. *\li <something_else> Any error result from dns_name_concatenate. */ isc_result_t dns_rbtnodechain_down(dns_rbtnodechain_t *chain, dns_name_t *name, dns_name_t *origin); /*%< * Descend down if possible. */ isc_result_t dns_rbtnodechain_nextflat(dns_rbtnodechain_t *chain, dns_name_t *name); /*%< * Find the next node at the current depth in DNSSEC order. */ /* * Wrapper macros for manipulating the rbtnode reference counter: * Since we selectively use isc_refcount_t for the reference counter of * a rbtnode, operations on the counter depend on the actual type of it. * The following macros provide a common interface to these operations, * hiding the back-end. The usage is the same as that of isc_refcount_xxx(). */ #ifdef DNS_RBT_USEISCREFCOUNT #define dns_rbtnode_refinit(node, n) \ do { \ isc_refcount_init(&(node)->references, (n)); \ } while (0) #define dns_rbtnode_refdestroy(node) \ do { \ isc_refcount_destroy(&(node)->references); \ } while (0) #define dns_rbtnode_refcurrent(node) \ isc_refcount_current(&(node)->references) #define dns_rbtnode_refincrement0(node, refs) \ do { \ isc_refcount_increment0(&(node)->references, (refs)); \ } while (0) #define dns_rbtnode_refincrement(node, refs) \ do { \ isc_refcount_increment(&(node)->references, (refs)); \ } while (0) #define dns_rbtnode_refdecrement(node, refs) \ do { \ isc_refcount_decrement(&(node)->references, (refs)); \ } while (0) #else /* DNS_RBT_USEISCREFCOUNT */ #define dns_rbtnode_refinit(node, n) ((node)->references = (n)) #define dns_rbtnode_refdestroy(node) ISC_REQUIRE((node)->references == 0) #define dns_rbtnode_refcurrent(node) ((node)->references) #if (__STDC_VERSION__ + 0) >= 199901L || defined __GNUC__ static inline void dns_rbtnode_refincrement0(dns_rbtnode_t *node, unsigned int *refs) { node->references++; if (refs != NULL) *refs = node->references; } static inline void dns_rbtnode_refincrement(dns_rbtnode_t *node, unsigned int *refs) { ISC_REQUIRE(node->references > 0); node->references++; if (refs != NULL) *refs = node->references; } static inline void dns_rbtnode_refdecrement(dns_rbtnode_t *node, unsigned int *refs) { ISC_REQUIRE(node->references > 0); node->references--; if (refs != NULL) *refs = node->references; } #else #define dns_rbtnode_refincrement0(node, refs) \ do { \ unsigned int *_tmp = (unsigned int *)(refs); \ (node)->references++; \ if ((_tmp) != NULL) \ (*_tmp) = (node)->references; \ } while (0) #define dns_rbtnode_refincrement(node, refs) \ do { \ ISC_REQUIRE((node)->references > 0); \ (node)->references++; \ if ((refs) != NULL) \ (*refs) = (node)->references; \ } while (0) #define dns_rbtnode_refdecrement(node, refs) \ do { \ ISC_REQUIRE((node)->references > 0); \ (node)->references--; \ if ((refs) != NULL) \ (*refs) = (node)->references; \ } while (0) #endif #endif /* DNS_RBT_USEISCREFCOUNT */ void dns_rbtnode_nodename(dns_rbtnode_t *node, dns_name_t *name); dns_rbtnode_t * dns_rbt_root(dns_rbt_t *rbt); ISC_LANG_ENDDECLS #endif /* DNS_RBT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/keyflags.h��������������������������������������������������������������������������������0000644�����������������00000002375�14763166026�0010335 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_KEYFLAGS_H #define DNS_KEYFLAGS_H 1 /*! \file dns/keyflags.h */ #include <isc/lang.h> #include <dns/types.h> ISC_LANG_BEGINDECLS isc_result_t dns_keyflags_fromtext(dns_keyflags_t *flagsp, isc_textregion_t *source); /*%< * Convert the text 'source' refers to into a DNSSEC KEY flags value. * The text may contain either a set of flag mnemonics separated by * vertical bars or a decimal flags value. For compatibility with * older versions of BIND and the DNSSEC signer, octal values * prefixed with a zero and hexadecimal values prefixed with "0x" * are also accepted. * * Requires: *\li 'flagsp' is a valid pointer. * *\li 'source' is a valid text region. * * Returns: *\li ISC_R_SUCCESS on success *\li ISC_R_RANGE numeric flag value is out of range *\li DNS_R_UNKNOWN mnemonic flag is unknown */ ISC_LANG_ENDDECLS #endif /* DNS_KEYFLAGS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/master.h����������������������������������������������������������������������������������0000644�����������������00000026124�14763166026�0010021 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_MASTER_H #define DNS_MASTER_H 1 /*! \file dns/master.h */ /*** *** Imports ***/ #include <stdio.h> #include <isc/lang.h> #include <dns/types.h> /* * Flags to be passed in the 'options' argument in the functions below. */ #define DNS_MASTER_AGETTL 0x00000001 /*%< Age the ttl based on $DATE. */ #define DNS_MASTER_MANYERRORS 0x00000002 /*%< Continue processing on errors. */ #define DNS_MASTER_NOINCLUDE 0x00000004 /*%< Disallow $INCLUDE directives. */ #define DNS_MASTER_ZONE 0x00000008 /*%< Loading a zone master file. */ #define DNS_MASTER_HINT 0x00000010 /*%< Loading a hint master file. */ #define DNS_MASTER_SLAVE 0x00000020 /*%< Loading a slave master file. */ #define DNS_MASTER_CHECKNS 0x00000040 /*%< * Check NS records to see * if they are an address */ #define DNS_MASTER_FATALNS 0x00000080 /*%< * Treat DNS_MASTER_CHECKNS * matches as fatal */ #define DNS_MASTER_CHECKNAMES 0x00000100 #define DNS_MASTER_CHECKNAMESFAIL 0x00000200 #define DNS_MASTER_CHECKWILDCARD 0x00000400 /* Check for internal wildcards. */ #define DNS_MASTER_CHECKMX 0x00000800 #define DNS_MASTER_CHECKMXFAIL 0x00001000 #define DNS_MASTER_RESIGN 0x00002000 #define DNS_MASTER_KEY 0x00004000 /*%< Loading a key zone master file. */ #define DNS_MASTER_NOTTL 0x00008000 /*%< Don't require ttl. */ #define DNS_MASTER_CHECKTTL 0x00010000 /*%< Check max-zone-ttl */ ISC_LANG_BEGINDECLS /* * Structures that implement the "raw" format for master dump. * These are provided for a reference purpose only; in the actual * encoding, we directly read/write each field so that the encoded data * is always "packed", regardless of the hardware architecture. */ #define DNS_RAWFORMAT_VERSION 1 /* * Flags to indicate the status of the data in the raw file header */ #define DNS_MASTERRAW_COMPAT 0x01 #define DNS_MASTERRAW_SOURCESERIALSET 0x02 #define DNS_MASTERRAW_LASTXFRINSET 0x04 /* Common header */ struct dns_masterrawheader { isc_uint32_t format; /* must be * dns_masterformat_raw * or * dns_masterformat_map */ isc_uint32_t version; /* compatibility for future * extensions */ isc_uint32_t dumptime; /* timestamp on creation * (currently unused) */ isc_uint32_t flags; /* Flags */ isc_uint32_t sourceserial; /* Source serial number (used * by inline-signing zones) */ isc_uint32_t lastxfrin; /* timestamp of last transfer * (used by slave zones) */ }; /* The structure for each RRset */ typedef struct { isc_uint32_t totallen; /* length of the data for this * RRset, including the * "header" part */ dns_rdataclass_t rdclass; /* 16-bit class */ dns_rdatatype_t type; /* 16-bit type */ dns_rdatatype_t covers; /* same as type */ dns_ttl_t ttl; /* 32-bit TTL */ isc_uint32_t nrdata; /* number of RRs in this set */ /* followed by encoded owner name, and then rdata */ } dns_masterrawrdataset_t; /* * Method prototype: a callback to register each include file as * it is encountered. */ typedef void (*dns_masterincludecb_t)(const char *file, void *arg); /*** *** Function ***/ isc_result_t dns_master_loadfile(const char *master_file, dns_name_t *top, dns_name_t *origin, dns_rdataclass_t zclass, unsigned int options, dns_rdatacallbacks_t *callbacks, isc_mem_t *mctx); isc_result_t dns_master_loadfile2(const char *master_file, dns_name_t *top, dns_name_t *origin, dns_rdataclass_t zclass, unsigned int options, dns_rdatacallbacks_t *callbacks, isc_mem_t *mctx, dns_masterformat_t format); isc_result_t dns_master_loadfile3(const char *master_file, dns_name_t *top, dns_name_t *origin, dns_rdataclass_t zclass, unsigned int options, isc_uint32_t resign, dns_rdatacallbacks_t *callbacks, isc_mem_t *mctx, dns_masterformat_t format); isc_result_t dns_master_loadfile4(const char *master_file, dns_name_t *top, dns_name_t *origin, dns_rdataclass_t zclass, unsigned int options, isc_uint32_t resign, dns_rdatacallbacks_t *callbacks, dns_masterincludecb_t include_cb, void *include_arg, isc_mem_t *mctx, dns_masterformat_t format); isc_result_t dns_master_loadfile5(const char *master_file, dns_name_t *top, dns_name_t *origin, dns_rdataclass_t zclass, unsigned int options, isc_uint32_t resign, dns_rdatacallbacks_t *callbacks, dns_masterincludecb_t include_cb, void *include_arg, isc_mem_t *mctx, dns_masterformat_t format, dns_ttl_t maxttl); isc_result_t dns_master_loadstream(FILE *stream, dns_name_t *top, dns_name_t *origin, dns_rdataclass_t zclass, unsigned int options, dns_rdatacallbacks_t *callbacks, isc_mem_t *mctx); isc_result_t dns_master_loadbuffer(isc_buffer_t *buffer, dns_name_t *top, dns_name_t *origin, dns_rdataclass_t zclass, unsigned int options, dns_rdatacallbacks_t *callbacks, isc_mem_t *mctx); isc_result_t dns_master_loadlexer(isc_lex_t *lex, dns_name_t *top, dns_name_t *origin, dns_rdataclass_t zclass, unsigned int options, dns_rdatacallbacks_t *callbacks, isc_mem_t *mctx); isc_result_t dns_master_loadfileinc(const char *master_file, dns_name_t *top, dns_name_t *origin, dns_rdataclass_t zclass, unsigned int options, dns_rdatacallbacks_t *callbacks, isc_task_t *task, dns_loaddonefunc_t done, void *done_arg, dns_loadctx_t **ctxp, isc_mem_t *mctx); isc_result_t dns_master_loadfileinc2(const char *master_file, dns_name_t *top, dns_name_t *origin, dns_rdataclass_t zclass, unsigned int options, dns_rdatacallbacks_t *callbacks, isc_task_t *task, dns_loaddonefunc_t done, void *done_arg, dns_loadctx_t **ctxp, isc_mem_t *mctx, dns_masterformat_t format); isc_result_t dns_master_loadfileinc3(const char *master_file, dns_name_t *top, dns_name_t *origin, dns_rdataclass_t zclass, unsigned int options, isc_uint32_t resign, dns_rdatacallbacks_t *callbacks, isc_task_t *task, dns_loaddonefunc_t done, void *done_arg, dns_loadctx_t **ctxp, isc_mem_t *mctx, dns_masterformat_t format); isc_result_t dns_master_loadfileinc4(const char *master_file, dns_name_t *top, dns_name_t *origin, dns_rdataclass_t zclass, unsigned int options, isc_uint32_t resign, dns_rdatacallbacks_t *callbacks, isc_task_t *task, dns_loaddonefunc_t done, void *done_arg, dns_loadctx_t **ctxp, dns_masterincludecb_t include_cb, void *include_arg, isc_mem_t *mctx, dns_masterformat_t format); isc_result_t dns_master_loadfileinc5(const char *master_file, dns_name_t *top, dns_name_t *origin, dns_rdataclass_t zclass, unsigned int options, isc_uint32_t resign, dns_rdatacallbacks_t *callbacks, isc_task_t *task, dns_loaddonefunc_t done, void *done_arg, dns_loadctx_t **ctxp, dns_masterincludecb_t include_cb, void *include_arg, isc_mem_t *mctx, dns_masterformat_t format, isc_uint32_t maxttl); isc_result_t dns_master_loadstreaminc(FILE *stream, dns_name_t *top, dns_name_t *origin, dns_rdataclass_t zclass, unsigned int options, dns_rdatacallbacks_t *callbacks, isc_task_t *task, dns_loaddonefunc_t done, void *done_arg, dns_loadctx_t **ctxp, isc_mem_t *mctx); isc_result_t dns_master_loadbufferinc(isc_buffer_t *buffer, dns_name_t *top, dns_name_t *origin, dns_rdataclass_t zclass, unsigned int options, dns_rdatacallbacks_t *callbacks, isc_task_t *task, dns_loaddonefunc_t done, void *done_arg, dns_loadctx_t **ctxp, isc_mem_t *mctx); isc_result_t dns_master_loadlexerinc(isc_lex_t *lex, dns_name_t *top, dns_name_t *origin, dns_rdataclass_t zclass, unsigned int options, dns_rdatacallbacks_t *callbacks, isc_task_t *task, dns_loaddonefunc_t done, void *done_arg, dns_loadctx_t **ctxp, isc_mem_t *mctx); /*%< * Loads a RFC1305 master file from a file, stream, buffer, or existing * lexer into rdatasets and then calls 'callbacks->commit' to commit the * rdatasets. Rdata memory belongs to dns_master_load and will be * reused / released when the callback completes. dns_load_master will * abort if callbacks->commit returns any value other than ISC_R_SUCCESS. * * If 'DNS_MASTER_AGETTL' is set and the master file contains one or more * $DATE directives, the TTLs of the data will be aged accordingly. * * 'callbacks->commit' is assumed to call 'callbacks->error' or * 'callbacks->warn' to generate any error messages required. * * 'done' is called with 'done_arg' and a result code when the loading * is completed or has failed. If the initial setup fails 'done' is * not called. * * 'resign' the number of seconds before a RRSIG expires that it should * be re-signed. 0 is used if not provided. * * Requires: *\li 'master_file' points to a valid string. *\li 'lexer' points to a valid lexer. *\li 'top' points to a valid name. *\li 'origin' points to a valid name. *\li 'callbacks->commit' points to a valid function. *\li 'callbacks->error' points to a valid function. *\li 'callbacks->warn' points to a valid function. *\li 'mctx' points to a valid memory context. *\li 'task' and 'done' to be valid. *\li 'lmgr' to be valid. *\li 'ctxp != NULL && ctxp == NULL'. * * Returns: *\li ISC_R_SUCCESS upon successfully loading the master file. *\li ISC_R_SEENINCLUDE upon successfully loading the master file with * a $INCLUDE statement. *\li ISC_R_NOMEMORY out of memory. *\li ISC_R_UNEXPECTEDEND expected to be able to read a input token and * there was not one. *\li ISC_R_UNEXPECTED *\li DNS_R_NOOWNER failed to specify a ownername. *\li DNS_R_NOTTL failed to specify a ttl. *\li DNS_R_BADCLASS record class did not match zone class. *\li DNS_R_CONTINUE load still in progress (dns_master_load*inc() only). *\li Any dns_rdata_fromtext() error code. *\li Any error code from callbacks->commit(). */ void dns_loadctx_detach(dns_loadctx_t **ctxp); /*%< * Detach from the load context. * * Requires: *\li '*ctxp' to be valid. * * Ensures: *\li '*ctxp == NULL' */ void dns_loadctx_attach(dns_loadctx_t *source, dns_loadctx_t **target); /*%< * Attach to the load context. * * Requires: *\li 'source' to be valid. *\li 'target != NULL && *target == NULL'. */ void dns_loadctx_cancel(dns_loadctx_t *ctx); /*%< * Cancel loading the zone file associated with this load context. * * Requires: *\li 'ctx' to be valid */ void dns_master_initrawheader(dns_masterrawheader_t *header); /*%< * Initializes the header for a raw master file, setting all * values to zero. */ ISC_LANG_ENDDECLS #endif /* DNS_MASTER_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/view.h������������������������������������������������������������������������������������0000644�����������������00000105277�14763166026�0007507 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_VIEW_H #define DNS_VIEW_H 1 /***** ***** Module Info *****/ /*! \file dns/view.h * \brief * DNS View * * A "view" is a DNS namespace, together with an optional resolver and a * forwarding policy. A "DNS namespace" is a (possibly empty) set of * authoritative zones together with an optional cache and optional * "hints" information. * * Views start out "unfrozen". In this state, core attributes like * the cache, set of zones, and forwarding policy may be set. While * "unfrozen", the caller (e.g. nameserver configuration loading * code), must ensure exclusive access to the view. When the view is * "frozen", the core attributes become immutable, and the view module * will ensure synchronization. Freezing allows the view's core attributes * to be accessed without locking. * * MP: *\li Before the view is frozen, the caller must ensure synchronization. * *\li After the view is frozen, the module guarantees appropriate * synchronization of any data structures it creates and manipulates. * * Reliability: *\li No anticipated impact. * * Resources: *\li TBS * * Security: *\li No anticipated impact. * * Standards: *\li None. */ #include <stdio.h> #include <isc/lang.h> #include <isc/magic.h> #include <isc/event.h> #include <isc/mutex.h> #include <isc/net.h> #include <isc/refcount.h> #include <isc/rwlock.h> #include <isc/stdtime.h> #include <dns/acl.h> #include <dns/catz.h> #include <dns/clientinfo.h> #include <dns/dnstap.h> #include <dns/fixedname.h> #include <dns/rrl.h> #include <dns/rdatastruct.h> #include <dns/rpz.h> #include <dns/types.h> #include <dns/zt.h> ISC_LANG_BEGINDECLS struct dns_view { /* Unlocked. */ unsigned int magic; isc_mem_t * mctx; dns_rdataclass_t rdclass; char * name; dns_zt_t * zonetable; dns_resolver_t * resolver; dns_adb_t * adb; dns_requestmgr_t * requestmgr; dns_acache_t * acache; dns_cache_t * cache; dns_db_t * cachedb; dns_db_t * hints; /* * security roots and negative trust anchors. * internal use only; access via * dns_view_getsecroots() */ dns_keytable_t * secroots_priv; dns_ntatable_t * ntatable_priv; isc_mutex_t lock; isc_boolean_t frozen; isc_task_t * task; isc_event_t resevent; isc_event_t adbevent; isc_event_t reqevent; isc_stats_t * adbstats; isc_stats_t * resstats; dns_stats_t * resquerystats; isc_boolean_t cacheshared; /* Configurable data. */ dns_tsig_keyring_t * statickeys; dns_tsig_keyring_t * dynamickeys; dns_peerlist_t * peers; dns_order_t * order; dns_fwdtable_t * fwdtable; isc_boolean_t recursion; isc_boolean_t auth_nxdomain; isc_boolean_t additionalfromcache; isc_boolean_t additionalfromauth; isc_boolean_t minimal_any; dns_minimaltype_t minimalresponses; isc_boolean_t enablednssec; isc_boolean_t enablevalidation; isc_boolean_t acceptexpired; isc_boolean_t requireservercookie; isc_boolean_t trust_anchor_telemetry; isc_boolean_t root_key_sentinel; dns_transfer_format_t transfer_format; dns_acl_t * cacheacl; dns_acl_t * cacheonacl; dns_acl_t * queryacl; dns_acl_t * queryonacl; dns_acl_t * recursionacl; dns_acl_t * recursiononacl; dns_acl_t * sortlist; dns_acl_t * notifyacl; dns_acl_t * transferacl; dns_acl_t * updateacl; dns_acl_t * upfwdacl; dns_acl_t * denyansweracl; dns_acl_t * nocasecompress; isc_boolean_t msgcompression; dns_rbt_t * answeracl_exclude; dns_rbt_t * denyanswernames; dns_rbt_t * answernames_exclude; dns_rrl_t * rrl; isc_boolean_t provideixfr; isc_boolean_t requestnsid; isc_boolean_t sendcookie; dns_ttl_t maxcachettl; dns_ttl_t maxncachettl; isc_uint32_t nta_lifetime; isc_uint32_t nta_recheck; char *nta_file; dns_ttl_t prefetch_trigger; dns_ttl_t prefetch_eligible; in_port_t dstport; dns_aclenv_t aclenv; dns_rdatatype_t preferred_glue; isc_boolean_t flush; dns_namelist_t * delonly; isc_boolean_t rootdelonly; dns_namelist_t * rootexclude; isc_boolean_t checknames; dns_name_t * dlv; dns_fixedname_t dlv_fixed; isc_uint16_t maxudp; isc_uint16_t nocookieudp; unsigned int maxbits; dns_aaaa_t v4_aaaa; dns_aaaa_t v6_aaaa; dns_acl_t * aaaa_acl; dns_dns64list_t dns64; unsigned int dns64cnt; dns_rpz_zones_t *rpzs; dns_catz_zones_t *catzs; dns_dlzdblist_t dlz_searched; dns_dlzdblist_t dlz_unsearched; isc_uint32_t fail_ttl; dns_badcache_t *failcache; /* * Configurable data for server use only, * locked by server configuration lock. */ dns_acl_t * matchclients; dns_acl_t * matchdestinations; isc_boolean_t matchrecursiveonly; /* Locked by themselves. */ isc_refcount_t references; isc_refcount_t weakrefs; /* Locked by lock. */ unsigned int attributes; /* Under owner's locking control. */ ISC_LINK(struct dns_view) link; dns_viewlist_t * viewlist; dns_zone_t * managed_keys; dns_zone_t * redirect; dns_name_t * redirectzone; /* points to * redirectfixed * when valid */ dns_fixedname_t redirectfixed; /* * File and configuration data for zones added at runtime * (only used in BIND9). * * XXX: This should be a pointer to an opaque type that * named implements. */ char * new_zone_file; char * new_zone_db; void * new_zone_dbenv; isc_uint64_t new_zone_mapsize; void * new_zone_config; void (*cfg_destroy)(void **); isc_mutex_t new_zone_lock; unsigned char secret[32]; /* Client secret */ unsigned int v6bias; dns_dtenv_t *dtenv; /* Dnstap environment */ dns_dtmsgtype_t dttypes; /* Dnstap message types to log */ }; #define DNS_VIEW_MAGIC ISC_MAGIC('V','i','e','w') #define DNS_VIEW_VALID(view) ISC_MAGIC_VALID(view, DNS_VIEW_MAGIC) #define DNS_VIEWATTR_RESSHUTDOWN 0x01 #define DNS_VIEWATTR_ADBSHUTDOWN 0x02 #define DNS_VIEWATTR_REQSHUTDOWN 0x04 #ifdef HAVE_LMDB #include <lmdb.h> /* * MDB_NOTLS is used to prevent problems after configuration is reloaded, due * to the way LMDB's use of thread-local storage (TLS) interacts with the BIND9 * thread model. */ #define DNS_LMDB_COMMON_FLAGS (MDB_CREATE | MDB_NOSUBDIR | MDB_NOTLS) #ifndef __OpenBSD__ #define DNS_LMDB_FLAGS (DNS_LMDB_COMMON_FLAGS) #else /* __OpenBSD__ */ /* * OpenBSD does not have a unified buffer cache, which requires both reads and * writes to be performed using mmap(). */ #define DNS_LMDB_FLAGS (DNS_LMDB_COMMON_FLAGS | MDB_WRITEMAP) #endif /* __OpenBSD__ */ #endif /* HAVE_LMDB */ isc_result_t dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, const char *name, dns_view_t **viewp); /*%< * Create a view. * * Notes: * *\li The newly created view has no cache, no resolver, and an empty * zone table. The view is not frozen. * * Requires: * *\li 'mctx' is a valid memory context. * *\li 'rdclass' is a valid class. * *\li 'name' is a valid C string. * *\li viewp != NULL && *viewp == NULL * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY * *\li Other errors are possible. */ void dns_view_attach(dns_view_t *source, dns_view_t **targetp); /*%< * Attach '*targetp' to 'source'. * * Requires: * *\li 'source' is a valid, frozen view. * *\li 'targetp' points to a NULL dns_view_t *. * * Ensures: * *\li *targetp is attached to source. * *\li While *targetp is attached, the view will not shut down. */ void dns_view_detach(dns_view_t **viewp); /*%< * Detach '*viewp' from its view. * * Requires: * *\li 'viewp' points to a valid dns_view_t * * * Ensures: * *\li *viewp is NULL. */ void dns_view_flushanddetach(dns_view_t **viewp); /*%< * Detach '*viewp' from its view. If this was the last reference * uncommitted changed in zones will be flushed to disk. * * Requires: * *\li 'viewp' points to a valid dns_view_t * * * Ensures: * *\li *viewp is NULL. */ void dns_view_weakattach(dns_view_t *source, dns_view_t **targetp); /*%< * Weakly attach '*targetp' to 'source'. * * Requires: * *\li 'source' is a valid, frozen view. * *\li 'targetp' points to a NULL dns_view_t *. * * Ensures: * *\li *targetp is attached to source. * * \li While *targetp is attached, the view will not be freed. */ void dns_view_weakdetach(dns_view_t **targetp); /*%< * Detach '*viewp' from its view. * * Requires: * *\li 'viewp' points to a valid dns_view_t *. * * Ensures: * *\li *viewp is NULL. */ isc_result_t dns_view_createzonetable(dns_view_t *view); /*%< * Create a zonetable for the view. * * Requires: * *\li 'view' is a valid, unfrozen view. * *\li 'view' does not have a zonetable already. * * Returns: * *\li #ISC_R_SUCCESS * *\li Any error that dns_zt_create() can return. */ isc_result_t dns_view_createresolver(dns_view_t *view, isc_taskmgr_t *taskmgr, unsigned int ntasks, unsigned int ndisp, isc_socketmgr_t *socketmgr, isc_timermgr_t *timermgr, unsigned int options, dns_dispatchmgr_t *dispatchmgr, dns_dispatch_t *dispatchv4, dns_dispatch_t *dispatchv6); /*%< * Create a resolver and address database for the view. * * Requires: * *\li 'view' is a valid, unfrozen view. * *\li 'view' does not have a resolver already. * *\li The requirements of dns_resolver_create() apply to 'taskmgr', * 'ntasks', 'socketmgr', 'timermgr', 'options', 'dispatchv4', and * 'dispatchv6'. * * Returns: * *\li #ISC_R_SUCCESS * *\li Any error that dns_resolver_create() can return. */ void dns_view_setcache(dns_view_t *view, dns_cache_t *cache); void dns_view_setcache2(dns_view_t *view, dns_cache_t *cache, isc_boolean_t shared); /*%< * Set the view's cache database. If 'shared' is true, this means the cache * is created by another view and is shared with that view. dns_view_setcache() * is a backward compatible version equivalent to setcache2(..., ISC_FALSE). * * Requires: * *\li 'view' is a valid, unfrozen view. * *\li 'cache' is a valid cache. * * Ensures: * * \li The cache of 'view' is 'cached. * *\li If this is not the first call to dns_view_setcache() for this * view, then previously set cache is detached. */ void dns_view_sethints(dns_view_t *view, dns_db_t *hints); /*%< * Set the view's hints database. * * Requires: * *\li 'view' is a valid, unfrozen view, whose hints database has not been * set. * *\li 'hints' is a valid zone database. * * Ensures: * * \li The hints database of 'view' is 'hints'. */ void dns_view_setkeyring(dns_view_t *view, dns_tsig_keyring_t *ring); void dns_view_setdynamickeyring(dns_view_t *view, dns_tsig_keyring_t *ring); /*%< * Set the view's static TSIG keys * * Requires: * * \li 'view' is a valid, unfrozen view, whose static TSIG keyring has not * been set. * *\li 'ring' is a valid TSIG keyring * * Ensures: * *\li The static TSIG keyring of 'view' is 'ring'. */ void dns_view_getdynamickeyring(dns_view_t *view, dns_tsig_keyring_t **ringp); /*%< * Return the views dynamic keys. * * \li 'view' is a valid, unfrozen view. * \li 'ringp' != NULL && ringp == NULL. */ void dns_view_setdstport(dns_view_t *view, in_port_t dstport); /*%< * Set the view's destination port. This is the port to * which outgoing queries are sent. The default is 53, * the standard DNS port. * * Requires: * *\li 'view' is a valid view. * *\li 'dstport' is a valid TCP/UDP port number. * * Ensures: *\li External name servers will be assumed to be listening * on 'dstport'. For servers whose address has already * obtained obtained at the time of the call, the view may * continue to use the previously set port until the address * times out from the view's address database. */ isc_result_t dns_view_addzone(dns_view_t *view, dns_zone_t *zone); /*%< * Add zone 'zone' to 'view'. * * Requires: * *\li 'view' is a valid, unfrozen view. * *\li 'zone' is a valid zone. */ void dns_view_freeze(dns_view_t *view); /*%< * Freeze view. No changes can be made to view configuration while frozen. * * Requires: * *\li 'view' is a valid, unfrozen view. * * Ensures: * *\li 'view' is frozen. */ void dns_view_thaw(dns_view_t *view); /*%< * Thaw view. This allows zones to be added or removed at runtime. This is * NOT thread-safe; the caller MUST have run isc_task_exclusive() prior to * thawing the view. * * Requires: * *\li 'view' is a valid, frozen view. * * Ensures: * *\li 'view' is no longer frozen. */ isc_result_t dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type, isc_stdtime_t now, unsigned int options, isc_boolean_t use_hints, dns_db_t **dbp, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset); isc_result_t dns_view_find2(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type, isc_stdtime_t now, unsigned int options, isc_boolean_t use_hints, isc_boolean_t use_static_stub, dns_db_t **dbp, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset); /*%< * Find an rdataset whose owner name is 'name', and whose type is * 'type'. * In general, this function first searches view's zone and cache DBs for the * best match data against 'name'. If nothing found there, and if 'use_hints' * is ISC_TRUE, the view's hint DB (if configured) is searched. * If the view is configured with a static-stub zone which gives the longest * match for 'name' among the zones, however, the cache DB is not consulted * unless 'use_static_stub' is ISC_FALSE (see below about this argument). * * dns_view_find() is a backward compatible version equivalent to * dns_view_find2() with use_static_stub argument being ISC_FALSE. * * Notes: * *\li See the description of dns_db_find() for information about 'options'. * If the caller sets #DNS_DBFIND_GLUEOK, it must ensure that 'name' * and 'type' are appropriate for glue retrieval. * *\li If 'now' is zero, then the current time will be used. * *\li If 'use_hints' is ISC_TRUE, and the view has a hints database, then * it will be searched last. If the answer is found in the hints * database, the result code will be DNS_R_HINT. If the name is found * in the hints database but not the type, the result code will be * #DNS_R_HINTNXRRSET. * *\li If 'use_static_stub' is ISC_FALSE and the longest match zone for 'name' * is a static-stub zone, it's ignored and the cache and/or hints will be * searched. In the majority of the cases this argument should be * ISC_FALSE. The only known usage of this argument being ISC_TRUE is * if this search is for a "bailiwick" glue A or AAAA RRset that may * best match a static-stub zone. Consider the following example: * this view is configured with a static-stub zone "example.com", * and an attempt of recursive resolution needs to send a query for the * zone. In this case it's quite likely that the resolver is trying to * find A/AAAA RRs for the apex name "example.com". And, to honor the * static-stub configuration it needs to return the glue RRs in the * static-stub zone even if that exact RRs coming from the authoritative * zone has been cached. * In other general cases, the requested data is better to be * authoritative, either locally configured or retrieved from an external * server, and the data in the static-stub zone should better be ignored. * *\li 'foundname' must meet the requirements of dns_db_find(). * *\li If 'sigrdataset' is not NULL, and there is a SIG rdataset which * covers 'type', then 'sigrdataset' will be bound to it. * * Requires: * *\li 'view' is a valid, frozen view. * *\li 'name' is valid name. * *\li 'type' is a valid dns_rdatatype_t, and is not a meta query type * except dns_rdatatype_any. * *\li dbp == NULL || *dbp == NULL * *\li nodep == NULL || *nodep == NULL. If nodep != NULL, dbp != NULL. * *\li 'foundname' is a valid name with a dedicated buffer or NULL. * *\li 'rdataset' is a valid, disassociated rdataset. * *\li 'sigrdataset' is NULL, or is a valid, disassociated rdataset. * * Ensures: * *\li In successful cases, 'rdataset', and possibly 'sigrdataset', are * bound to the found data. * *\li If dbp != NULL, it points to the database containing the data. * *\li If nodep != NULL, it points to the database node containing the data. * *\li If foundname != NULL, it contains the full name of the found data. * * Returns: * *\li Any result that dns_db_find() can return, with the exception of * #DNS_R_DELEGATION. */ isc_result_t dns_view_simplefind(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type, isc_stdtime_t now, unsigned int options, isc_boolean_t use_hints, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset); /*%< * Find an rdataset whose owner name is 'name', and whose type is * 'type'. * * Notes: * *\li This routine is appropriate for simple, exact-match queries of the * view. 'name' must be a canonical name; there is no DNAME or CNAME * processing. * *\li See the description of dns_db_find() for information about 'options'. * If the caller sets DNS_DBFIND_GLUEOK, it must ensure that 'name' * and 'type' are appropriate for glue retrieval. * *\li If 'now' is zero, then the current time will be used. * *\li If 'use_hints' is ISC_TRUE, and the view has a hints database, then * it will be searched last. If the answer is found in the hints * database, the result code will be DNS_R_HINT. If the name is found * in the hints database but not the type, the result code will be * DNS_R_HINTNXRRSET. * *\li If 'sigrdataset' is not NULL, and there is a SIG rdataset which * covers 'type', then 'sigrdataset' will be bound to it. * * Requires: * *\li 'view' is a valid, frozen view. * *\li 'name' is valid name. * *\li 'type' is a valid dns_rdatatype_t, and is not a meta query type * (e.g. dns_rdatatype_any), or dns_rdatatype_rrsig. * *\li 'rdataset' is a valid, disassociated rdataset. * *\li 'sigrdataset' is NULL, or is a valid, disassociated rdataset. * * Ensures: * *\li In successful cases, 'rdataset', and possibly 'sigrdataset', are * bound to the found data. * * Returns: * *\li #ISC_R_SUCCESS Success; result is desired type. *\li DNS_R_GLUE Success; result is glue. *\li DNS_R_HINT Success; result is a hint. *\li DNS_R_NCACHENXDOMAIN Success; result is a ncache entry. *\li DNS_R_NCACHENXRRSET Success; result is a ncache entry. *\li DNS_R_NXDOMAIN The name does not exist. *\li DNS_R_NXRRSET The rrset does not exist. *\li #ISC_R_NOTFOUND No matching data found, * or an error occurred. */ /*% See dns_view_findzonecut2() */ isc_result_t dns_view_findzonecut(dns_view_t *view, dns_name_t *name, dns_name_t *fname, isc_stdtime_t now, unsigned int options, isc_boolean_t use_hints, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset); isc_result_t dns_view_findzonecut2(dns_view_t *view, dns_name_t *name, dns_name_t *fname, isc_stdtime_t now, unsigned int options, isc_boolean_t use_hints, isc_boolean_t use_cache, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset); /*%< * Find the best known zonecut containing 'name'. * * This uses local authority, cache, and optionally hints data. * No external queries are performed. * * Notes: * *\li If 'now' is zero, then the current time will be used. * *\li If 'use_hints' is ISC_TRUE, and the view has a hints database, then * it will be searched last. * *\li If 'use_cache' is ISC_TRUE, and the view has a cache, then it will be * searched. * *\li If 'sigrdataset' is not NULL, and there is a SIG rdataset which * covers 'type', then 'sigrdataset' will be bound to it. * *\li If the DNS_DBFIND_NOEXACT option is set, then the zonecut returned * (if any) will be the deepest known ancestor of 'name'. * * Requires: * *\li 'view' is a valid, frozen view. * *\li 'name' is valid name. * *\li 'rdataset' is a valid, disassociated rdataset. * *\li 'sigrdataset' is NULL, or is a valid, disassociated rdataset. * * Returns: * *\li #ISC_R_SUCCESS Success. * *\li Many other results are possible. */ isc_result_t dns_viewlist_find(dns_viewlist_t *list, const char *name, dns_rdataclass_t rdclass, dns_view_t **viewp); /*%< * Search for a view with name 'name' and class 'rdclass' in 'list'. * If found, '*viewp' is (strongly) attached to it. * * Requires: * *\li 'viewp' points to a NULL dns_view_t *. * * Returns: * *\li #ISC_R_SUCCESS A matching view was found. *\li #ISC_R_NOTFOUND No matching view was found. */ isc_result_t dns_viewlist_findzone(dns_viewlist_t *list, dns_name_t *name, isc_boolean_t allclasses, dns_rdataclass_t rdclass, dns_zone_t **zonep); /*%< * Search zone with 'name' in view with 'rdclass' in viewlist 'list' * If found, zone is returned in *zonep. If allclasses is set rdclass is ignored * * Returns: *\li #ISC_R_SUCCESS A matching zone was found. *\li #ISC_R_NOTFOUND No matching zone was found. *\li #ISC_R_MULTIPLE Multiple zones with the same name were found. */ isc_result_t dns_view_findzone(dns_view_t *view, dns_name_t *name, dns_zone_t **zonep); /*%< * Search for the zone 'name' in the zone table of 'view'. * If found, 'zonep' is (strongly) attached to it. There * are no partial matches. * * Requires: * *\li 'zonep' points to a NULL dns_zone_t *. * * Returns: *\li #ISC_R_SUCCESS A matching zone was found. *\li #ISC_R_NOTFOUND No matching zone was found. *\li others An error occurred. */ isc_result_t dns_view_load(dns_view_t *view, isc_boolean_t stop); isc_result_t dns_view_loadnew(dns_view_t *view, isc_boolean_t stop); isc_result_t dns_view_asyncload(dns_view_t *view, dns_zt_allloaded_t callback, void *arg); /*%< * Load zones attached to this view. dns_view_load() loads * all zones whose master file has changed since the last * load; dns_view_loadnew() loads only zones that have never * been loaded. * * dns_view_asyncload() loads zones asynchronously. When all zones * in the view have finished loading, 'callback' is called with argument * 'arg' to inform the caller. * * If 'stop' is ISC_TRUE, stop on the first error and return it. * If 'stop' is ISC_FALSE (or we are loading asynchronously), ignore errors. * * Requires: * *\li 'view' is valid. */ isc_result_t dns_view_gettsig(dns_view_t *view, dns_name_t *keyname, dns_tsigkey_t **keyp); /*%< * Find the TSIG key configured in 'view' with name 'keyname', * if any. * * Requires: *\li keyp points to a NULL dns_tsigkey_t *. * * Returns: *\li #ISC_R_SUCCESS A key was found and '*keyp' now points to it. *\li #ISC_R_NOTFOUND No key was found. *\li others An error occurred. */ isc_result_t dns_view_getpeertsig(dns_view_t *view, isc_netaddr_t *peeraddr, dns_tsigkey_t **keyp); /*%< * Find the TSIG key configured in 'view' for the server whose * address is 'peeraddr', if any. * * Requires: * keyp points to a NULL dns_tsigkey_t *. * * Returns: *\li #ISC_R_SUCCESS A key was found and '*keyp' now points to it. *\li #ISC_R_NOTFOUND No key was found. *\li others An error occurred. */ isc_result_t dns_view_checksig(dns_view_t *view, isc_buffer_t *source, dns_message_t *msg); /*%< * Verifies the signature of a message. * * Requires: * *\li 'view' is a valid view. *\li 'source' is a valid buffer containing the message *\li 'msg' is a valid message * * Returns: *\li see dns_tsig_verify() */ void dns_view_dialup(dns_view_t *view); /*%< * Perform dialup-time maintenance on the zones of 'view'. */ isc_result_t dns_view_dumpdbtostream(dns_view_t *view, FILE *fp); /*%< * Dump the current state of the view 'view' to the stream 'fp' * for purposes of analysis or debugging. * * Currently the dumped state includes the view's cache; in the future * it may also include other state such as the address database. * It will not not include authoritative data since it is voluminous and * easily obtainable by other means. * * Requires: * *\li 'view' is valid. * *\li 'fp' refers to a file open for writing. * * Returns: * \li ISC_R_SUCCESS The cache was successfully dumped. * \li others An error occurred (see dns_master_dump) */ isc_result_t dns_view_flushcache(dns_view_t *view); isc_result_t dns_view_flushcache2(dns_view_t *view, isc_boolean_t fixuponly); /*%< * Flush the view's cache (and ADB). If 'fixuponly' is true, it only updates * the internal reference to the cache DB with omitting actual flush operation. * 'fixuponly' is intended to be used for a view that shares a cache with * a different view. dns_view_flushcache() is a backward compatible version * that always sets fixuponly to false. * * Requires: * 'view' is valid. * * No other tasks are executing. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY */ isc_result_t dns_view_flushnode(dns_view_t *view, dns_name_t *name, isc_boolean_t tree); /*%< * Flush the given name from the view's cache (and optionally ADB/badcache). * * Flush the given name from the cache, ADB, and bad cache. If 'tree' * is true, also flush all subdomains of 'name'. * * Requires: *\li 'view' is valid. *\li 'name' is valid. * * Returns: *\li #ISC_R_SUCCESS * other returns are failures. */ isc_result_t dns_view_flushname(dns_view_t *view, dns_name_t *name); /*%< * Flush the given name from the view's cache, ADB and badcache. * Equivalent to dns_view_flushnode(view, name, ISC_FALSE). * * * Requires: *\li 'view' is valid. *\li 'name' is valid. * * Returns: *\li #ISC_R_SUCCESS * other returns are failures. */ isc_result_t dns_view_adddelegationonly(dns_view_t *view, dns_name_t *name); /*%< * Add the given name to the delegation only table. * * Requires: *\li 'view' is valid. *\li 'name' is valid. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY */ isc_result_t dns_view_excludedelegationonly(dns_view_t *view, dns_name_t *name); /*%< * Add the given name to be excluded from the root-delegation-only. * * * Requires: *\li 'view' is valid. *\li 'name' is valid. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY */ isc_boolean_t dns_view_isdelegationonly(dns_view_t *view, dns_name_t *name); /*%< * Check if 'name' is in the delegation only table or if * rootdelonly is set that name is not being excluded. * * Requires: *\li 'view' is valid. *\li 'name' is valid. * * Returns: *\li #ISC_TRUE if the name is the table. *\li #ISC_FALSE otherwise. */ void dns_view_setrootdelonly(dns_view_t *view, isc_boolean_t value); /*%< * Set the root delegation only flag. * * Requires: *\li 'view' is valid. */ isc_boolean_t dns_view_getrootdelonly(dns_view_t *view); /*%< * Get the root delegation only flag. * * Requires: *\li 'view' is valid. */ isc_result_t dns_view_freezezones(dns_view_t *view, isc_boolean_t freeze); /*%< * Freeze/thaw updates to master zones. * * Requires: * \li 'view' is valid. */ void dns_view_setadbstats(dns_view_t *view, isc_stats_t *stats); /*%< * Set a adb statistics set 'stats' for 'view'. * * Requires: * \li 'view' is valid and is not frozen. * *\li stats is a valid statistics supporting adb statistics * (see dns/stats.h). */ void dns_view_getadbstats(dns_view_t *view, isc_stats_t **statsp); /*%< * Get the adb statistics counter set for 'view'. If a statistics set is * set '*statsp' will be attached to the set; otherwise, '*statsp' will be * untouched. * * Requires: * \li 'view' is valid and is not frozen. * *\li 'statsp' != NULL && '*statsp' != NULL */ void dns_view_setresstats(dns_view_t *view, isc_stats_t *stats); /*%< * Set a general resolver statistics counter set 'stats' for 'view'. * * Requires: * \li 'view' is valid and is not frozen. * *\li stats is a valid statistics supporting resolver statistics counters * (see dns/stats.h). */ void dns_view_getresstats(dns_view_t *view, isc_stats_t **statsp); /*%< * Get the general statistics counter set for 'view'. If a statistics set is * set '*statsp' will be attached to the set; otherwise, '*statsp' will be * untouched. * * Requires: * \li 'view' is valid and is not frozen. * *\li 'statsp' != NULL && '*statsp' != NULL */ void dns_view_setresquerystats(dns_view_t *view, dns_stats_t *stats); /*%< * Set a statistics counter set of rdata type, 'stats', for 'view'. Once the * statistic set is installed, view's resolver will count outgoing queries * per rdata type. * * Requires: * \li 'view' is valid and is not frozen. * *\li stats is a valid statistics created by dns_rdatatypestats_create(). */ void dns_view_getresquerystats(dns_view_t *view, dns_stats_t **statsp); /*%< * Get the rdatatype statistics counter set for 'view'. If a statistics set is * set '*statsp' will be attached to the set; otherwise, '*statsp' will be * untouched. * * Requires: * \li 'view' is valid and is not frozen. * *\li 'statsp' != NULL && '*statsp' != NULL */ isc_boolean_t dns_view_iscacheshared(dns_view_t *view); /*%< * Check if the view shares the cache created by another view. * * Requires: * \li 'view' is valid. * * Returns: *\li #ISC_TRUE if the cache is shared. *\li #ISC_FALSE otherwise. */ isc_result_t dns_view_initntatable(dns_view_t *view, isc_taskmgr_t *taskmgr, isc_timermgr_t *timermgr); /*%< * Initialize the negative trust anchor table for the view. * * Requires: * \li 'view' is valid. * * Returns: *\li ISC_R_SUCCESS *\li Any other result indicates failure */ isc_result_t dns_view_getntatable(dns_view_t *view, dns_ntatable_t **ntp); /*%< * Get the negative trust anchor table for this view. Returns * ISC_R_NOTFOUND if the table not been initialized for the view. * * '*ntp' is attached on success; the caller is responsible for * detaching it with dns_ntatable_detach(). * * Requires: * \li 'view' is valid. * \li 'nta' is not NULL and '*nta' is NULL. * * Returns: *\li ISC_R_SUCCESS *\li ISC_R_NOTFOUND */ isc_result_t dns_view_initsecroots(dns_view_t *view, isc_mem_t *mctx); /*%< * Initialize security roots for the view, detaching any previously * existing security roots first. (Note that secroots_priv is * NULL until this function is called, so any function using * security roots must check that they have been initialized first. * One way to do this is use dns_view_getsecroots() and check its * return value.) * * Requires: * \li 'view' is valid. * * Returns: *\li ISC_R_SUCCESS *\li Any other result indicates failure */ isc_result_t dns_view_getsecroots(dns_view_t *view, dns_keytable_t **ktp); /*%< * Get the security roots for this view. Returns ISC_R_NOTFOUND if * the security roots keytable has not been initialized for the view. * * '*ktp' is attached on success; the caller is responsible for * detaching it with dns_keytable_detach(). * * Requires: * \li 'view' is valid. * \li 'ktp' is not NULL and '*ktp' is NULL. * * Returns: *\li ISC_R_SUCCESS *\li ISC_R_NOTFOUND */ isc_result_t dns_view_issecuredomain(dns_view_t *view, dns_name_t *name, isc_stdtime_t now, isc_boolean_t checknta, isc_boolean_t *secure_domain); /*%< * Is 'name' at or beneath a trusted key, and not covered by a valid * negative trust anchor? Put answer in '*secure_domain'. * * If 'checknta' is ISC_FALSE, ignore the NTA table in determining * whether this is a secure domain. * * Requires: * \li 'view' is valid. * * Returns: *\li ISC_R_SUCCESS *\li Any other value indicates failure */ isc_boolean_t dns_view_ntacovers(dns_view_t *view, isc_stdtime_t now, dns_name_t *name, dns_name_t *anchor); /*%< * Is there a current negative trust anchor above 'name' and below 'anchor'? * * Requires: * \li 'view' is valid. * * Returns: *\li ISC_R_TRUE *\li ISC_R_FALSE */ void dns_view_untrust(dns_view_t *view, dns_name_t *keyname, dns_rdata_dnskey_t *dnskey, isc_mem_t *mctx); /*%< * Remove keys that match 'keyname' and 'dnskey' from the views trust * anchors. * * (NOTE: If the configuration specifies that there should be a * trust anchor at 'keyname', but no keys are left after this * operation, that is an error. We fail closed, inserting a NULL * key so as to prevent validation until a legimitate key has been * provided.) * * Requires: * \li 'view' is valid. * \li 'keyname' is valid. * \li 'mctx' is valid. * \li 'dnskey' is valid. */ isc_result_t dns_view_setnewzones(dns_view_t *view, isc_boolean_t allow, void *cfgctx, void (*cfg_destroy)(void **), isc_uint64_t mapsize); /*%< * Set whether or not to allow zones to be created or deleted at runtime. * * If 'allow' is ISC_TRUE, determines the filename into which new zone * configuration will be written. Preserves the configuration context * (a pointer to which is passed in 'cfgctx') for use when parsing new * zone configuration. 'cfg_destroy' points to a callback routine to * destroy the configuration context when the view is destroyed. (This * roundabout method is used in order to avoid libdns having a dependency * on libisccfg and libbind9.) * * If 'allow' is ISC_FALSE, removes any existing references to * configuration context and frees any memory. * * Requires: * \li 'view' is valid. * * Returns: * \li ISC_R_SUCCESS * \li ISC_R_NOSPACE */ void dns_view_restorekeyring(dns_view_t *view); isc_result_t dns_view_searchdlz(dns_view_t *view, dns_name_t *name, unsigned int minlabels, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo, dns_db_t **dbp); /*%< * Search through the DLZ database(s) in view->dlz_searched to find * one that can answer a query for 'name', using the DLZ driver's * findzone method. If successful, '*dbp' is set to point to the * DLZ database. * * Returns: * \li ISC_R_SUCCESS * \li ISC_R_NOTFOUND * * Requires: * \li 'view' is valid. * \li 'name' is not NULL. * \li 'dbp' is not NULL and *dbp is NULL. */ isc_uint32_t dns_view_getfailttl(dns_view_t *view); /*%< * Get the view's servfail-ttl. zero => no servfail caching. * * Requires: *\li 'view' to be valid. */ void dns_view_setfailttl(dns_view_t *view, isc_uint32_t failttl); /*%< * Set the view's servfail-ttl. zero => no servfail caching. * * Requires: *\li 'view' to be valid. */ isc_result_t dns_view_saventa(dns_view_t *view); /*%< * Save NTA for names in this view to a file. * * Requires: *\li 'view' to be valid. */ isc_result_t dns_view_loadnta(dns_view_t *view); /*%< * Loads NTA for names in this view from a file. * * Requires: *\li 'view' to be valid. */ void dns_view_setviewcommit(dns_view_t *view); /*%< * Commit dns_zone_setview() calls previously made for all zones in this * view. * * Requires: *\li 'view' to be valid. */ void dns_view_setviewrevert(dns_view_t *view); /*%< * Revert dns_zone_setview() calls previously made for all zones in this * view. * * Requires: *\li 'view' to be valid. */ ISC_LANG_ENDDECLS #endif /* DNS_VIEW_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/acache.h����������������������������������������������������������������������������������0000644�����������������00000033770�14763166026�0007737 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: acache.h,v 1.8 2007/06/19 23:47:16 tbox Exp $ */ #ifndef DNS_ACACHE_H #define DNS_ACACHE_H 1 /***** ***** Module Info *****/ /* * Acache * * The Additional Cache Object * * This module manages internal caching entries that correspond to * the additional section data of a DNS DB node (an RRset header, more * accurately). An additional cache entry is expected to be (somehow) * attached to a particular RR in a particular DB node, and contains a set * of information of an additional data for the DB node. * * An additional cache object is intended to be created as a per-view * object, and manages all cache entries within the view. * * The intended usage of the additional caching is to provide a short cut * to additional glue RRs of an NS RR. For each NS RR, it is often * necessary to look for glue RRs to make a proper response. Once the * glue RRs are known, the additional caching allows the client to * associate the information to the original NS RR so that further * expensive lookups can be avoided for the NS RR. * * Each additional cache entry contains information to identify a * particular DB node and (optionally) an associated RRset. The * information consists of its zone, database, the version of the * database, database node, and RRset. * * A "negative" information can also be cached. For example, if a glue * RR does not exist as an authoritative data in the same zone as that * of the NS RR, this fact can be cached by specifying a NULL pointer * for the database, version, and node. (See the description for * dns_acache_getentry() below for more details.) * * Since each member stored in an additional cache entry holds a reference * to a corresponding object, a stale cache entry may cause unnecessary * memory consumption. For instance, when a zone is reloaded, additional * cache entries that have a reference to the zone (and its DB and/or * DB nodes) can delay the cleanup of the referred objects. In order to * minimize such a bad effect, this module provides several cleanup * mechanisms. * * The first one is a shutdown procedure called when the associated view * is shut down. In this case, dns_acache_shutdown() will be called and * all cache entries will be purged. This mechanism will help the * situation when the configuration is reloaded or the main server is * stopped. * * Per-DB cleanup mechanism is also provided. Each additional cache entry * is associated with related DB, which is expected to have been * registered when the DB was created by dns_acache_setdb(). If a * particular DB is going to be destroyed, the primary holder of the DB, * a typical example of which is a zone, will call dns_acache_putdb(). * Then this module will clean-up all cache entries associated with the * DB. This mechanism is effective when a secondary zone DB is going to * be stale after a zone transfer. * * Finally, this module supports for periodic clean-up of stale entries. * Each cache entry has a timestamp field, which is updated every time * the entry is referred. A periodically invoked cleaner checks the * timestamp of each entry, and purge entries that have not been referred * for a certain period. The cleaner interval can be specified by * dns_acache_setcleaninginterval(). If the periodic clean-up is not * enough, it is also possible to specify the upper limit of entries * in terms of the memory consumption. If the maximum value is * specified, the cleaner is invoked when the memory consumption reaches * the high watermark inferred from the maximum value. In this case, * the cleaner will use more aggressive algorithm to decide the "victim" * entries. The maximum value can be specified by * dns_acache_setcachesize(). * * When a cache entry is going to be purged within this module, the * callback function specified at the creation time will be called. * The callback function is expected to release all internal resources * related to the entry, which will typically be specific to DB * implementation, and to call dns_acache_detachentry(). The callback * mechanism is very important, since the holder of an additional cache * entry may not be able to initiate the clean-up of the entry, due to * the reference ordering. For example, as long as an additional cache * entry has a reference to a DB object, the DB cannot be freed, in which * a DB node may have a reference to the cache entry. * * Credits: * The basic idea of this kind of short-cut for frequently used * information is similar to the "pre-compiled answer" approach adopted * in nsd by NLnet LABS with RIPE NCC. Our work here is an independent * effort, but the success of nsd encouraged us to pursue this path. * * The design and implementation of the periodic memory management and * the upper limitation of memory consumption was derived from the cache * DB implementation of BIND9. * * MP: * There are two main locks in this module. One is for each entry, and * the other is for the additional cache object. * * Reliability: * The callback function for a cache entry is called with holding the * entry lock. Thus, it implicitly assumes the callback function does not * call a function that can require the lock. Typically, the only * function that can be called from the callback function safely is * dns_acache_detachentry(). The breakage of this implicit assumption * may cause a deadlock. * * Resources: * In a 32-bit architecture (such as i386), the following additional * memory is required comparing to the case that disables this module. * - 76 bytes for each additional cache entry * - if the entry has a DNS name and associated RRset, * * 44 bytes + size of the name (1-255 bytes) * * 52 bytes x number_of_RRs * - 28 bytes for each DB related to this module * * Using the additional cache also requires extra memory consumption in * the DB implementation. In the current implementation for rbtdb, we * need: * - two additional pointers for each DB node (8 bytes for a 32-bit * architecture * - for each RR associated to an RR in a DB node, we also need * a pointer and management objects to support the additional cache * function. These are allocated on-demand. The total size is * 32 bytes for a 32-bit architecture. * * Security: * Since this module does not handle any low-level data directly, * no security issue specific to this module is anticipated. * * Standards: * None. */ /*** *** Imports ***/ #include <isc/mutex.h> #include <isc/lang.h> #include <isc/refcount.h> #include <isc/stdtime.h> #include <dns/types.h> /*** *** Functions ***/ ISC_LANG_BEGINDECLS isc_result_t dns_acache_create(dns_acache_t **acachep, isc_mem_t *mctx, isc_taskmgr_t *taskmgr, isc_timermgr_t *timermgr); /* * Create a new DNS additional cache object. * * Requires: * * 'mctx' is a valid memory context * * 'taskmgr' is a valid task manager * * 'timermgr' is a valid timer or NULL. If NULL, no periodic cleaning of * the cache will take place. * * 'acachep' is a valid pointer, and *acachep == NULL * * Ensures: * * '*acachep' is attached to the newly created cache * * Returns: * * ISC_R_SUCCESS * ISC_R_NOMEMORY * ISC_R_UNEXPECTED */ void dns_acache_attach(dns_acache_t *source, dns_acache_t **targetp); /* * Attach *targetp to cache. * * Requires: * * 'acache' is a valid additional cache. * * 'targetp' points to a NULL dns_acache_t *. * * Ensures: * * *targetp is attached to the 'source' additional cache. */ void dns_acache_detach(dns_acache_t **acachep); /* * Detach *acachep from its cache. * * Requires: * * '*acachep' points to a valid additional cache. * * Ensures: * * *acachep is NULL. * * If '*acachep' is the last reference to the cache and the additional * cache does not have an outstanding task, all resources used by the * cache will be freed. */ void dns_acache_setcleaninginterval(dns_acache_t *acache, unsigned int t); /* * Set the periodic cleaning interval of an additional cache to 'interval' * seconds. */ void dns_acache_setcachesize(dns_acache_t *acache, size_t size); /* * Set the maximum additional cache size. 0 means unlimited. */ isc_result_t dns_acache_setdb(dns_acache_t *acache, dns_db_t *db); /* * Set 'db' in 'acache' when the db can be referred from acache, in order * to provide a hint for resolving the back reference. * * Requires: * 'acache' is a valid acache pointer. * 'db' is a valid DNS DB pointer. * * Ensures: * 'acache' will have a reference to 'db'. * * Returns: * ISC_R_SUCCESS * ISC_R_EXISTS (which means the specified 'db' is already set) * ISC_R_NOMEMORY */ isc_result_t dns_acache_putdb(dns_acache_t *acache, dns_db_t *db); /* * Release 'db' from 'acache' if it has been set by dns_acache_setdb(). * * Requires: * 'acache' is a valid acache pointer. * 'db' is a valid DNS DB pointer. * * Ensures: * 'acache' will release the reference to 'db'. Additionally, the content * of each cache entry that is related to the 'db' will be released via * the callback function. * * Returns: * ISC_R_SUCCESS * ISC_R_NOTFOUND (which means the specified 'db' is not set in 'acache') * ISC_R_NOMEMORY */ void dns_acache_shutdown(dns_acache_t *acache); /* * Shutdown 'acache'. * * Requires: * * '*acache' is a valid additional cache. */ isc_result_t dns_acache_createentry(dns_acache_t *acache, dns_db_t *origdb, void (*callback)(dns_acacheentry_t *, void **), void *cbarg, dns_acacheentry_t **entryp); /* * Create an additional cache entry. A new entry is created and attached to * the given additional cache object. A callback function is also associated * with the created entry, which will be called when the cache entry is purged * for some reason. * * Requires: * * 'acache' is a valid additional cache. * 'entryp' is a valid pointer, and *entryp == NULL * 'origdb' is a valid DNS DB pointer. * 'callback' and 'cbarg' can be NULL. In this case, however, the entry * is meaningless (and will be cleaned-up in the next periodical * cleaning). * * Ensures: * '*entryp' will point to a new additional cache entry. * * Returns: * ISC_R_SUCCESS * ISC_R_NOMEMORY */ isc_result_t dns_acache_getentry(dns_acacheentry_t *entry, dns_zone_t **zonep, dns_db_t **dbp, dns_dbversion_t **versionp, dns_dbnode_t **nodep, dns_name_t *fname, dns_message_t *msg, isc_stdtime_t now); /* * Get content from a particular additional cache entry. * * Requires: * * 'entry' is a valid additional cache entry. * 'zonep' is a NULL pointer or '*zonep' == NULL (this is the only * optional parameter.) * 'dbp' is a valid pointer, and '*dbp' == NULL * 'versionp' is a valid pointer, and '*versionp' == NULL * 'nodep' is a valid pointer, and '*nodep' == NULL * 'fname' is a valid DNS name. * 'msg' is a valid DNS message. * * Ensures: * Several possible cases can happen according to the content. * 1. For a positive cache entry, * '*zonep' will point to the corresponding zone (if zonep is a valid * pointer), * '*dbp' will point to a DB for the zone, * '*versionp' will point to its version, and * '*nodep' will point to the corresponding DB node. * 'fname' will have the DNS name of the DB node and contain a list of * rdataset for the node (which can be an empty list). * * 2. For a negative cache entry that means no corresponding zone exists, * '*zonep' == NULL (if zonep is a valid pointer) * '*dbp', '*versionp', and '*nodep' will be NULL. * * 3. For a negative cache entry that means no corresponding DB node * exists, '*zonep' will point to the corresponding zone (if zonep is a * valid pointer), * '*dbp' will point to a corresponding DB for zone, * '*versionp' will point to its version. * '*nodep' will be kept as NULL. * 'fname' will not change. * * On failure, no new references will be created. * * Returns: * ISC_R_SUCCESS * ISC_R_NOMEMORY */ isc_result_t dns_acache_setentry(dns_acache_t *acache, dns_acacheentry_t *entry, dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, dns_name_t *fname); /* * Set content to a particular additional cache entry. * * Requires: * 'acache' is a valid additional cache. * 'entry' is a valid additional cache entry. * All the others pointers are NULL or a valid pointer of the * corresponding type. * * Returns: * ISC_R_SUCCESS * ISC_R_NOMEMORY * ISC_R_NOTFOUND */ isc_boolean_t dns_acache_cancelentry(dns_acacheentry_t *entry); /* * Cancel the use of the cache entry 'entry'. This function is supposed to * be called when the node that holds the entry finds the content is not * correct any more. This function will try to release as much dependency as * possible, and will be ready to be cleaned-up. The registered callback * function will be canceled and will never called. * * Requires: * 'entry' is a valid additional cache entry. * * Returns: * ISC_TRUE if the entry was active when canceled */ void dns_acache_attachentry(dns_acacheentry_t *source, dns_acacheentry_t **targetp); /* * Attach *targetp to the cache entry 'source'. * * Requires: * * 'source' is a valid additional cache entry. * * 'targetp' points to a NULL dns_acacheentry_t *. * * Ensures: * * *targetp is attached to 'source'. */ void dns_acache_detachentry(dns_acacheentry_t **entryp); /* * Detach *entryp from its cache. * * Requires: * * '*entryp' points to a valid additional cache entry. * * Ensures: * * *entryp is NULL. * * If '*entryp' is the last reference to the entry, * cache does not have an outstanding task, all resources used by the * entry (including the entry object itself) will be freed. */ void dns_acache_countquerymiss(dns_acache_t *acache); /* * Count up a missed acache query. XXXMLG need more docs. */ ISC_LANG_ENDDECLS #endif /* DNS_ACACHE_H */ ��������bind9/dns/enumtype.h��������������������������������������������������������������������������������0000644�����������������00000017361�14763166026�0010377 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 1998-2022 Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /*************** *************** *************** THIS FILE IS AUTOMATICALLY GENERATED BY gen.c. *************** DO NOT EDIT! *************** ***************/ /*! \file */ #ifndef DNS_ENUMTYPE_H #define DNS_ENUMTYPE_H 1 enum { dns_rdatatype_none = 0, dns_rdatatype_a = 1, dns_rdatatype_ns = 2, dns_rdatatype_md = 3, dns_rdatatype_mf = 4, dns_rdatatype_cname = 5, dns_rdatatype_soa = 6, dns_rdatatype_mb = 7, dns_rdatatype_mg = 8, dns_rdatatype_mr = 9, dns_rdatatype_null = 10, dns_rdatatype_wks = 11, dns_rdatatype_ptr = 12, dns_rdatatype_hinfo = 13, dns_rdatatype_minfo = 14, dns_rdatatype_mx = 15, dns_rdatatype_txt = 16, dns_rdatatype_rp = 17, dns_rdatatype_afsdb = 18, dns_rdatatype_x25 = 19, dns_rdatatype_isdn = 20, dns_rdatatype_rt = 21, dns_rdatatype_nsap = 22, dns_rdatatype_nsap_ptr = 23, dns_rdatatype_sig = 24, dns_rdatatype_key = 25, dns_rdatatype_px = 26, dns_rdatatype_gpos = 27, dns_rdatatype_aaaa = 28, dns_rdatatype_loc = 29, dns_rdatatype_nxt = 30, dns_rdatatype_srv = 33, dns_rdatatype_naptr = 35, dns_rdatatype_kx = 36, dns_rdatatype_cert = 37, dns_rdatatype_a6 = 38, dns_rdatatype_dname = 39, dns_rdatatype_sink = 40, dns_rdatatype_opt = 41, dns_rdatatype_apl = 42, dns_rdatatype_ds = 43, dns_rdatatype_sshfp = 44, dns_rdatatype_ipseckey = 45, dns_rdatatype_rrsig = 46, dns_rdatatype_nsec = 47, dns_rdatatype_dnskey = 48, dns_rdatatype_dhcid = 49, dns_rdatatype_nsec3 = 50, dns_rdatatype_nsec3param = 51, dns_rdatatype_tlsa = 52, dns_rdatatype_smimea = 53, dns_rdatatype_hip = 55, dns_rdatatype_ninfo = 56, dns_rdatatype_rkey = 57, dns_rdatatype_talink = 58, dns_rdatatype_cds = 59, dns_rdatatype_cdnskey = 60, dns_rdatatype_openpgpkey = 61, dns_rdatatype_csync = 62, dns_rdatatype_spf = 99, dns_rdatatype_unspec = 103, dns_rdatatype_nid = 104, dns_rdatatype_l32 = 105, dns_rdatatype_l64 = 106, dns_rdatatype_lp = 107, dns_rdatatype_eui48 = 108, dns_rdatatype_eui64 = 109, dns_rdatatype_tkey = 249, dns_rdatatype_tsig = 250, dns_rdatatype_uri = 256, dns_rdatatype_caa = 257, dns_rdatatype_avc = 258, dns_rdatatype_doa = 259, dns_rdatatype_ta = 32768, dns_rdatatype_dlv = 32769, dns_rdatatype_keydata = 65533, dns_rdatatype_ixfr = 251, dns_rdatatype_axfr = 252, dns_rdatatype_mailb = 253, dns_rdatatype_maila = 254, dns_rdatatype_any = 255 }; #define dns_rdatatype_none ((dns_rdatatype_t)dns_rdatatype_none) #define dns_rdatatype_a ((dns_rdatatype_t)dns_rdatatype_a) #define dns_rdatatype_ns ((dns_rdatatype_t)dns_rdatatype_ns) #define dns_rdatatype_md ((dns_rdatatype_t)dns_rdatatype_md) #define dns_rdatatype_mf ((dns_rdatatype_t)dns_rdatatype_mf) #define dns_rdatatype_cname ((dns_rdatatype_t)dns_rdatatype_cname) #define dns_rdatatype_soa ((dns_rdatatype_t)dns_rdatatype_soa) #define dns_rdatatype_mb ((dns_rdatatype_t)dns_rdatatype_mb) #define dns_rdatatype_mg ((dns_rdatatype_t)dns_rdatatype_mg) #define dns_rdatatype_mr ((dns_rdatatype_t)dns_rdatatype_mr) #define dns_rdatatype_null ((dns_rdatatype_t)dns_rdatatype_null) #define dns_rdatatype_wks ((dns_rdatatype_t)dns_rdatatype_wks) #define dns_rdatatype_ptr ((dns_rdatatype_t)dns_rdatatype_ptr) #define dns_rdatatype_hinfo ((dns_rdatatype_t)dns_rdatatype_hinfo) #define dns_rdatatype_minfo ((dns_rdatatype_t)dns_rdatatype_minfo) #define dns_rdatatype_mx ((dns_rdatatype_t)dns_rdatatype_mx) #define dns_rdatatype_txt ((dns_rdatatype_t)dns_rdatatype_txt) #define dns_rdatatype_rp ((dns_rdatatype_t)dns_rdatatype_rp) #define dns_rdatatype_afsdb ((dns_rdatatype_t)dns_rdatatype_afsdb) #define dns_rdatatype_x25 ((dns_rdatatype_t)dns_rdatatype_x25) #define dns_rdatatype_isdn ((dns_rdatatype_t)dns_rdatatype_isdn) #define dns_rdatatype_rt ((dns_rdatatype_t)dns_rdatatype_rt) #define dns_rdatatype_nsap ((dns_rdatatype_t)dns_rdatatype_nsap) #define dns_rdatatype_nsap_ptr ((dns_rdatatype_t)dns_rdatatype_nsap_ptr) #define dns_rdatatype_sig ((dns_rdatatype_t)dns_rdatatype_sig) #define dns_rdatatype_key ((dns_rdatatype_t)dns_rdatatype_key) #define dns_rdatatype_px ((dns_rdatatype_t)dns_rdatatype_px) #define dns_rdatatype_gpos ((dns_rdatatype_t)dns_rdatatype_gpos) #define dns_rdatatype_aaaa ((dns_rdatatype_t)dns_rdatatype_aaaa) #define dns_rdatatype_loc ((dns_rdatatype_t)dns_rdatatype_loc) #define dns_rdatatype_nxt ((dns_rdatatype_t)dns_rdatatype_nxt) #define dns_rdatatype_srv ((dns_rdatatype_t)dns_rdatatype_srv) #define dns_rdatatype_naptr ((dns_rdatatype_t)dns_rdatatype_naptr) #define dns_rdatatype_kx ((dns_rdatatype_t)dns_rdatatype_kx) #define dns_rdatatype_cert ((dns_rdatatype_t)dns_rdatatype_cert) #define dns_rdatatype_a6 ((dns_rdatatype_t)dns_rdatatype_a6) #define dns_rdatatype_dname ((dns_rdatatype_t)dns_rdatatype_dname) #define dns_rdatatype_sink ((dns_rdatatype_t)dns_rdatatype_sink) #define dns_rdatatype_opt ((dns_rdatatype_t)dns_rdatatype_opt) #define dns_rdatatype_apl ((dns_rdatatype_t)dns_rdatatype_apl) #define dns_rdatatype_ds ((dns_rdatatype_t)dns_rdatatype_ds) #define dns_rdatatype_sshfp ((dns_rdatatype_t)dns_rdatatype_sshfp) #define dns_rdatatype_ipseckey ((dns_rdatatype_t)dns_rdatatype_ipseckey) #define dns_rdatatype_rrsig ((dns_rdatatype_t)dns_rdatatype_rrsig) #define dns_rdatatype_nsec ((dns_rdatatype_t)dns_rdatatype_nsec) #define dns_rdatatype_dnskey ((dns_rdatatype_t)dns_rdatatype_dnskey) #define dns_rdatatype_dhcid ((dns_rdatatype_t)dns_rdatatype_dhcid) #define dns_rdatatype_nsec3 ((dns_rdatatype_t)dns_rdatatype_nsec3) #define dns_rdatatype_nsec3param ((dns_rdatatype_t)dns_rdatatype_nsec3param) #define dns_rdatatype_tlsa ((dns_rdatatype_t)dns_rdatatype_tlsa) #define dns_rdatatype_smimea ((dns_rdatatype_t)dns_rdatatype_smimea) #define dns_rdatatype_hip ((dns_rdatatype_t)dns_rdatatype_hip) #define dns_rdatatype_ninfo ((dns_rdatatype_t)dns_rdatatype_ninfo) #define dns_rdatatype_rkey ((dns_rdatatype_t)dns_rdatatype_rkey) #define dns_rdatatype_talink ((dns_rdatatype_t)dns_rdatatype_talink) #define dns_rdatatype_cds ((dns_rdatatype_t)dns_rdatatype_cds) #define dns_rdatatype_cdnskey ((dns_rdatatype_t)dns_rdatatype_cdnskey) #define dns_rdatatype_openpgpkey ((dns_rdatatype_t)dns_rdatatype_openpgpkey) #define dns_rdatatype_csync ((dns_rdatatype_t)dns_rdatatype_csync) #define dns_rdatatype_spf ((dns_rdatatype_t)dns_rdatatype_spf) #define dns_rdatatype_unspec ((dns_rdatatype_t)dns_rdatatype_unspec) #define dns_rdatatype_nid ((dns_rdatatype_t)dns_rdatatype_nid) #define dns_rdatatype_l32 ((dns_rdatatype_t)dns_rdatatype_l32) #define dns_rdatatype_l64 ((dns_rdatatype_t)dns_rdatatype_l64) #define dns_rdatatype_lp ((dns_rdatatype_t)dns_rdatatype_lp) #define dns_rdatatype_eui48 ((dns_rdatatype_t)dns_rdatatype_eui48) #define dns_rdatatype_eui64 ((dns_rdatatype_t)dns_rdatatype_eui64) #define dns_rdatatype_tkey ((dns_rdatatype_t)dns_rdatatype_tkey) #define dns_rdatatype_tsig ((dns_rdatatype_t)dns_rdatatype_tsig) #define dns_rdatatype_uri ((dns_rdatatype_t)dns_rdatatype_uri) #define dns_rdatatype_caa ((dns_rdatatype_t)dns_rdatatype_caa) #define dns_rdatatype_avc ((dns_rdatatype_t)dns_rdatatype_avc) #define dns_rdatatype_doa ((dns_rdatatype_t)dns_rdatatype_doa) #define dns_rdatatype_ta ((dns_rdatatype_t)dns_rdatatype_ta) #define dns_rdatatype_dlv ((dns_rdatatype_t)dns_rdatatype_dlv) #define dns_rdatatype_keydata ((dns_rdatatype_t)dns_rdatatype_keydata) #define dns_rdatatype_ixfr ((dns_rdatatype_t)dns_rdatatype_ixfr) #define dns_rdatatype_axfr ((dns_rdatatype_t)dns_rdatatype_axfr) #define dns_rdatatype_mailb ((dns_rdatatype_t)dns_rdatatype_mailb) #define dns_rdatatype_maila ((dns_rdatatype_t)dns_rdatatype_maila) #define dns_rdatatype_any ((dns_rdatatype_t)dns_rdatatype_any) #endif /* DNS_ENUMTYPE_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/opcode.h����������������������������������������������������������������������������������0000644�����������������00000001756�14763166026�0010003 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_OPCODE_H #define DNS_OPCODE_H 1 /*! \file dns/opcode.h */ #include <isc/lang.h> #include <dns/types.h> ISC_LANG_BEGINDECLS isc_result_t dns_opcode_totext(dns_opcode_t opcode, isc_buffer_t *target); /*%< * Put a textual representation of error 'opcode' into 'target'. * * Requires: *\li 'opcode' is a valid opcode. * *\li 'target' is a valid text buffer. * * Ensures: *\li If the result is success: * The used space in 'target' is updated. * * Returns: *\li #ISC_R_SUCCESS on success *\li #ISC_R_NOSPACE target buffer is too small */ ISC_LANG_ENDDECLS #endif /* DNS_OPCODE_H */ ������������������bind9/dns/rdatatype.h�������������������������������������������������������������������������������0000644�����������������00000004371�14763166026�0010523 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_RDATATYPE_H #define DNS_RDATATYPE_H 1 /*! \file dns/rdatatype.h */ #include <isc/lang.h> #include <dns/types.h> ISC_LANG_BEGINDECLS isc_result_t dns_rdatatype_fromtext(dns_rdatatype_t *typep, isc_textregion_t *source); /*%< * Convert the text 'source' refers to into a DNS rdata type. * * Requires: *\li 'typep' is a valid pointer. * *\li 'source' is a valid text region. * * Returns: *\li ISC_R_SUCCESS on success *\li DNS_R_UNKNOWN type is unknown */ isc_result_t dns_rdatatype_totext(dns_rdatatype_t type, isc_buffer_t *target); /*%< * Put a textual representation of type 'type' into 'target'. * * Requires: *\li 'type' is a valid type. * *\li 'target' is a valid text buffer. * * Ensures, * if the result is success: *\li The used space in 'target' is updated. * * Returns: *\li #ISC_R_SUCCESS on success *\li #ISC_R_NOSPACE target buffer is too small */ isc_result_t dns_rdatatype_tounknowntext(dns_rdatatype_t type, isc_buffer_t *target); /*%< * Put textual RFC3597 TYPEXXXX representation of type 'type' into * 'target'. * * Requires: *\li 'type' is a valid type. * *\li 'target' is a valid text buffer. * * Ensures, * if the result is success: *\li The used space in 'target' is updated. * * Returns: *\li #ISC_R_SUCCESS on success *\li #ISC_R_NOSPACE target buffer is too small */ void dns_rdatatype_format(dns_rdatatype_t rdtype, char *array, unsigned int size); /*%< * Format a human-readable representation of the type 'rdtype' * into the character array 'array', which is of size 'size'. * The resulting string is guaranteed to be null-terminated. */ #define DNS_RDATATYPE_FORMATSIZE sizeof("NSEC3PARAM") /*%< * Minimum size of array to pass to dns_rdatatype_format(). * May need to be adjusted if a new RR type with a very long * name is defined. */ ISC_LANG_ENDDECLS #endif /* DNS_RDATATYPE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/cache.h�����������������������������������������������������������������������������������0000644�����������������00000017715�14763166026�0007577 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_CACHE_H #define DNS_CACHE_H 1 /***** ***** Module Info *****/ /*! \file dns/cache.h * \brief * Defines dns_cache_t, the cache object. * * Notes: *\li A cache object contains DNS data of a single class. * Multiple classes will be handled by creating multiple * views, each with a different class and its own cache. * * MP: *\li See notes at the individual functions. * * Reliability: * * Resources: * * Security: * * Standards: */ /*** *** Imports ***/ #include <isc/json.h> #include <isc/lang.h> #include <isc/stats.h> #include <isc/stdtime.h> #include <dns/types.h> ISC_LANG_BEGINDECLS /*** *** Functions ***/ isc_result_t dns_cache_create(isc_mem_t *cmctx, isc_taskmgr_t *taskmgr, isc_timermgr_t *timermgr, dns_rdataclass_t rdclass, const char *db_type, unsigned int db_argc, char **db_argv, dns_cache_t **cachep); isc_result_t dns_cache_create2(isc_mem_t *cmctx, isc_taskmgr_t *taskmgr, isc_timermgr_t *timermgr, dns_rdataclass_t rdclass, const char *cachename, const char *db_type, unsigned int db_argc, char **db_argv, dns_cache_t **cachep); isc_result_t dns_cache_create3(isc_mem_t *cmctx, isc_mem_t *hmctx, isc_taskmgr_t *taskmgr, isc_timermgr_t *timermgr, dns_rdataclass_t rdclass, const char *cachename, const char *db_type, unsigned int db_argc, char **db_argv, dns_cache_t **cachep); /*%< * Create a new DNS cache. * * dns_cache_create2() will create a named cache. * * dns_cache_create3() will create a named cache using two separate memory * contexts, one for cache data which can be cleaned and a separate one for * memory allocated for the heap (which can grow without an upper limit and * has no mechanism for shrinking). * * dns_cache_create() is a backward compatible version that internally * specifies an empty cache name and a single memory context. * * Requires: * *\li 'cmctx' (and 'hmctx' if applicable) is a valid memory context. * *\li 'taskmgr' is a valid task manager and 'timermgr' is a valid timer * manager, or both are NULL. If NULL, no periodic cleaning of the * cache will take place. * *\li 'cachename' is a valid string. This must not be NULL. * *\li 'cachep' is a valid pointer, and *cachep == NULL * * Ensures: * *\li '*cachep' is attached to the newly created cache * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY */ void dns_cache_attach(dns_cache_t *cache, dns_cache_t **targetp); /*%< * Attach *targetp to cache. * * Requires: * *\li 'cache' is a valid cache. * *\li 'targetp' points to a NULL dns_cache_t *. * * Ensures: * *\li *targetp is attached to cache. */ void dns_cache_detach(dns_cache_t **cachep); /*%< * Detach *cachep from its cache. * * Requires: * *\li 'cachep' points to a valid cache. * * Ensures: * *\li *cachep is NULL. * *\li If '*cachep' is the last reference to the cache, * all resources used by the cache will be freed */ void dns_cache_attachdb(dns_cache_t *cache, dns_db_t **dbp); /*%< * Attach *dbp to the cache's database. * * Notes: * *\li This may be used to get a reference to the database for * the purpose of cache lookups (XXX currently it is also * the way to add data to the cache, but having a * separate dns_cache_add() interface instead would allow * more control over memory usage). * The caller should call dns_db_detach() on the reference * when it is no longer needed. * * Requires: * *\li 'cache' is a valid cache. * *\li 'dbp' points to a NULL dns_db *. * * Ensures: * *\li *dbp is attached to the database. */ isc_result_t dns_cache_setfilename(dns_cache_t *cache, const char *filename); /*%< * If 'filename' is non-NULL, make the cache persistent. * The cache's data will be stored in the given file. * If 'filename' is NULL, make the cache non-persistent. * Files that are no longer used are not unlinked automatically. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li Various file-related failures */ isc_result_t dns_cache_load(dns_cache_t *cache); /*%< * If the cache has a file name, load the cache contents from the file. * Previous cache contents are not discarded. * If no file name has been set, do nothing and return success. * * MT: *\li Multiple simultaneous attempts to load or dump the cache * will be serialized with respect to one another, but * the cache may be read and updated while the dump is * in progress. Updates performed during loading * may or may not be preserved, and reads may return * either the old or the newly loaded data. * * Returns: * *\li #ISC_R_SUCCESS * \li Various failures depending on the database implementation type */ isc_result_t dns_cache_dump(dns_cache_t *cache); /*%< * If the cache has a file name, write the cache contents to disk, * overwriting any preexisting file. If no file name has been set, * do nothing and return success. * * MT: *\li Multiple simultaneous attempts to load or dump the cache * will be serialized with respect to one another, but * the cache may be read and updated while the dump is * in progress. Updates performed during the dump may * or may not be reflected in the dumped file. * * Returns: * *\li #ISC_R_SUCCESS * \li Various failures depending on the database implementation type */ isc_result_t dns_cache_clean(dns_cache_t *cache, isc_stdtime_t now); /*%< * Force immediate cleaning of the cache, freeing all rdatasets * whose TTL has expired as of 'now' and that have no pending * references. */ void dns_cache_setcleaninginterval(dns_cache_t *cache, unsigned int interval); /*%< * Set the periodic cache cleaning interval to 'interval' seconds. */ unsigned int dns_cache_getcleaninginterval(dns_cache_t *cache); /*%< * Get the periodic cache cleaning interval to 'interval' seconds. */ const char * dns_cache_getname(dns_cache_t *cache); /*%< * Get the cache name. */ void dns_cache_setcachesize(dns_cache_t *cache, size_t size); /*%< * Set the maximum cache size. 0 means unlimited. */ size_t dns_cache_getcachesize(dns_cache_t *cache); /*%< * Get the maximum cache size. */ isc_result_t dns_cache_flush(dns_cache_t *cache); /*%< * Flushes all data from the cache. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY */ isc_result_t dns_cache_flushnode(dns_cache_t *cache, dns_name_t *name, isc_boolean_t tree); /* * Flush a given name from the cache. If 'tree' is true, then * also flush all names under 'name'. * * Requires: *\li 'cache' to be valid. *\li 'name' to be valid. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li other error returns. */ isc_result_t dns_cache_flushname(dns_cache_t *cache, dns_name_t *name); /* * Flush a given name from the cache. Equivalent to * dns_cache_flushpartial(cache, name, ISC_FALSE). * * Requires: *\li 'cache' to be valid. *\li 'name' to be valid. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li other error returns. */ isc_stats_t * dns_cache_getstats(dns_cache_t *cache); /* * Return a pointer to the stats collection object for 'cache' */ void dns_cache_dumpstats(dns_cache_t *cache, FILE *fp); /* * Dump cache statistics and status in text to 'fp' */ void dns_cache_updatestats(dns_cache_t *cache, isc_result_t result); /* * Update cache statistics based on result code in 'result' */ #ifdef HAVE_LIBXML2 int dns_cache_renderxml(dns_cache_t *cache, xmlTextWriterPtr writer); /* * Render cache statistics and status in XML for 'writer'. */ #endif /* HAVE_LIBXML2 */ #ifdef HAVE_JSON isc_result_t dns_cache_renderjson(dns_cache_t *cache, json_object *cstats); /* * Render cache statistics and status in JSON */ #endif /* HAVE_JSON */ ISC_LANG_ENDDECLS #endif /* DNS_CACHE_H */ ���������������������������������������������������bind9/dns/rpz.h�������������������������������������������������������������������������������������0000644�����������������00000024131�14763166026�0007335 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id$ */ #ifndef DNS_RPZ_H #define DNS_RPZ_H 1 #include <isc/deprecated.h> #include <isc/event.h> #include <isc/ht.h> #include <isc/lang.h> #include <isc/refcount.h> #include <isc/rwlock.h> #include <dns/fixedname.h> #include <dns/rdata.h> #include <dns/types.h> ISC_LANG_BEGINDECLS #define DNS_RPZ_PREFIX "rpz-" /* * Sub-zones of various trigger types. */ #define DNS_RPZ_CLIENT_IP_ZONE DNS_RPZ_PREFIX"client-ip" #define DNS_RPZ_IP_ZONE DNS_RPZ_PREFIX"ip" #define DNS_RPZ_NSIP_ZONE DNS_RPZ_PREFIX"nsip" #define DNS_RPZ_NSDNAME_ZONE DNS_RPZ_PREFIX"nsdname" /* * Special policies. */ #define DNS_RPZ_PASSTHRU_NAME DNS_RPZ_PREFIX"passthru" #define DNS_RPZ_DROP_NAME DNS_RPZ_PREFIX"drop" #define DNS_RPZ_TCP_ONLY_NAME DNS_RPZ_PREFIX"tcp-only" typedef isc_uint8_t dns_rpz_prefix_t; typedef enum { DNS_RPZ_TYPE_BAD, DNS_RPZ_TYPE_CLIENT_IP, DNS_RPZ_TYPE_QNAME, DNS_RPZ_TYPE_IP, DNS_RPZ_TYPE_NSDNAME, DNS_RPZ_TYPE_NSIP } dns_rpz_type_t; /* * Require DNS_RPZ_POLICY_PASSTHRU < DNS_RPZ_POLICY_DROP * < DNS_RPZ_POLICY_TCP_ONLY DNS_RPZ_POLICY_NXDOMAIN < DNS_RPZ_POLICY_NODATA * < DNS_RPZ_POLICY_CNAME to choose among competing policies. */ typedef enum { DNS_RPZ_POLICY_GIVEN = 0, /* 'given': what policy record says */ DNS_RPZ_POLICY_DISABLED = 1, /* log what would have happened */ DNS_RPZ_POLICY_PASSTHRU = 2, /* 'passthru': do not rewrite */ DNS_RPZ_POLICY_DROP = 3, /* 'drop': do not respond */ DNS_RPZ_POLICY_TCP_ONLY = 4, /* 'tcp-only': answer UDP with TC=1 */ DNS_RPZ_POLICY_NXDOMAIN = 5, /* 'nxdomain': answer with NXDOMAIN */ DNS_RPZ_POLICY_NODATA = 6, /* 'nodata': answer with ANCOUNT=0 */ DNS_RPZ_POLICY_CNAME = 7, /* 'cname x': answer with x's rrsets */ DNS_RPZ_POLICY_RECORD, DNS_RPZ_POLICY_WILDCNAME, DNS_RPZ_POLICY_MISS, DNS_RPZ_POLICY_ERROR } dns_rpz_policy_t; typedef isc_uint8_t dns_rpz_num_t; #define DNS_RPZ_MAX_ZONES 32 #if DNS_RPZ_MAX_ZONES > 32 # if DNS_RPZ_MAX_ZONES > 64 # error "rpz zone bit masks must fit in a word" # endif typedef isc_uint64_t dns_rpz_zbits_t; #else typedef isc_uint32_t dns_rpz_zbits_t; #endif #define DNS_RPZ_ALL_ZBITS ((dns_rpz_zbits_t)-1) #define DNS_RPZ_INVALID_NUM DNS_RPZ_MAX_ZONES #define DNS_RPZ_ZBIT(n) (((dns_rpz_zbits_t)1) << (dns_rpz_num_t)(n)) /* * Mask of the specified and higher numbered policy zones * Avoid hassles with (1<<33) or (1<<65) */ #define DNS_RPZ_ZMASK(n) ((dns_rpz_zbits_t)((((n) >= DNS_RPZ_MAX_ZONES-1) ? \ 0 : (1<<((n)+1))) -1)) /* * The trigger counter type. */ typedef size_t dns_rpz_trigger_counter_t; /* * The number of triggers of each type in a response policy zone. */ typedef struct dns_rpz_triggers dns_rpz_triggers_t; struct dns_rpz_triggers { dns_rpz_trigger_counter_t client_ipv4; dns_rpz_trigger_counter_t client_ipv6; dns_rpz_trigger_counter_t qname; dns_rpz_trigger_counter_t ipv4; dns_rpz_trigger_counter_t ipv6; dns_rpz_trigger_counter_t nsdname; dns_rpz_trigger_counter_t nsipv4; dns_rpz_trigger_counter_t nsipv6; }; /* * A single response policy zone. */ typedef struct dns_rpz_zone dns_rpz_zone_t; struct dns_rpz_zone { isc_refcount_t refs; dns_rpz_num_t num; /* ordinal in list of policy zones */ dns_name_t origin; /* Policy zone name */ dns_name_t client_ip; /* DNS_RPZ_CLIENT_IP_ZONE.origin. */ dns_name_t ip; /* DNS_RPZ_IP_ZONE.origin. */ dns_name_t nsdname; /* DNS_RPZ_NSDNAME_ZONE.origin */ dns_name_t nsip; /* DNS_RPZ_NSIP_ZONE.origin. */ dns_name_t passthru; /* DNS_RPZ_PASSTHRU_NAME. */ dns_name_t drop; /* DNS_RPZ_DROP_NAME. */ dns_name_t tcp_only; /* DNS_RPZ_TCP_ONLY_NAME. */ dns_name_t cname; /* override value for ..._CNAME */ dns_ttl_t max_policy_ttl; dns_rpz_policy_t policy; /* DNS_RPZ_POLICY_GIVEN or override */ }; /* * Radix tree node for response policy IP addresses */ typedef struct dns_rpz_cidr_node dns_rpz_cidr_node_t; /* * Bitfields indicating which policy zones have policies of * which type. */ typedef struct dns_rpz_have dns_rpz_have_t; struct dns_rpz_have { dns_rpz_zbits_t client_ipv4; dns_rpz_zbits_t client_ipv6; dns_rpz_zbits_t client_ip; dns_rpz_zbits_t qname; dns_rpz_zbits_t ipv4; dns_rpz_zbits_t ipv6; dns_rpz_zbits_t ip; dns_rpz_zbits_t nsdname; dns_rpz_zbits_t nsipv4; dns_rpz_zbits_t nsipv6; dns_rpz_zbits_t nsip; dns_rpz_zbits_t qname_skip_recurse; }; /* * Policy options */ typedef struct dns_rpz_popt dns_rpz_popt_t; struct dns_rpz_popt { dns_rpz_zbits_t no_rd_ok; dns_rpz_zbits_t no_log; isc_boolean_t break_dnssec; isc_boolean_t qname_wait_recurse; isc_boolean_t nsip_wait_recurse; unsigned int min_ns_labels; dns_rpz_num_t num_zones; }; /* * Response policy zones known to a view. */ typedef struct dns_rpz_zones dns_rpz_zones_t; struct dns_rpz_zones { dns_rpz_popt_t p; dns_rpz_zone_t *zones[DNS_RPZ_MAX_ZONES]; dns_rpz_triggers_t triggers[DNS_RPZ_MAX_ZONES]; /* * RPZ policy version number (initially 0, increases whenever * the server is reconfigured with new zones or policy) */ int rpz_ver; dns_rpz_zbits_t defined; /* * The set of records for a policy zone are in one of these states: * never loaded load_begun=0 have=0 * during initial loading load_begun=1 have=0 * and rbtdb->rpzsp == rbtdb->load_rpzsp * after good load load_begun=1 have!=0 * after failed initial load load_begun=1 have=0 * and rbtdb->load_rpzsp == NULL * reloading after failure load_begun=1 have=0 * reloading after success * main rpzs load_begun=1 have!=0 * load rpzs load_begun=1 have=0 */ dns_rpz_zbits_t load_begun; dns_rpz_have_t have; /* * total_triggers maintains the total number of triggers in all * policy zones in the view. It is only used to print summary * statistics after a zone load of how the trigger counts * changed. */ dns_rpz_triggers_t total_triggers; isc_mem_t *mctx; isc_refcount_t refs; /* * One lock for short term read-only search that guarantees the * consistency of the pointers. * A second lock for maintenance that guarantees no other thread * is adding or deleting nodes. */ isc_rwlock_t search_lock; isc_mutex_t maint_lock; dns_rpz_cidr_node_t *cidr; dns_rbt_t *rbt; }; /* * context for finding the best policy */ typedef struct { unsigned int state; # define DNS_RPZ_REWRITTEN 0x0001 # define DNS_RPZ_DONE_CLIENT_IP 0x0002 /* client IP address checked */ # define DNS_RPZ_DONE_QNAME 0x0004 /* qname checked */ # define DNS_RPZ_DONE_QNAME_IP 0x0008 /* IP addresses of qname checked */ # define DNS_RPZ_DONE_NSDNAME 0x0010 /* NS name missed; checking addresses */ # define DNS_RPZ_DONE_IPv4 0x0020 # define DNS_RPZ_RECURSING 0x0040 # define DNS_RPZ_ACTIVE 0x0080 /* * Best match so far. */ struct { dns_rpz_type_t type; dns_rpz_zone_t *rpz; dns_rpz_prefix_t prefix; dns_rpz_policy_t policy; dns_ttl_t ttl; isc_result_t result; dns_zone_t *zone; dns_db_t *db; dns_dbversion_t *version; dns_dbnode_t *node; dns_rdataset_t *rdataset; } m; /* * State for chasing IP addresses and NS names including recursion. */ struct { unsigned int label; dns_db_t *db; dns_rdataset_t *ns_rdataset; dns_rdatatype_t r_type; isc_result_t r_result; dns_rdataset_t *r_rdataset; } r; /* * State of real query while recursing for NSIP or NSDNAME. */ struct { isc_result_t result; isc_boolean_t is_zone; isc_boolean_t authoritative; dns_zone_t *zone; dns_db_t *db; dns_dbnode_t *node; dns_rdataset_t *rdataset; dns_rdataset_t *sigrdataset; dns_rdatatype_t qtype; } q; /* * A copy of the 'have' and 'p' structures and the RPZ * policy version as of the beginning of RPZ processing, * used to avoid problems when policy is updated while * RPZ recursion is ongoing. */ dns_rpz_have_t have; dns_rpz_popt_t popt; int rpz_ver; /* * p_name: current policy owner name * r_name: recursing for this name to possible policy triggers * f_name: saved found name from before recursion */ dns_name_t *p_name; dns_name_t *r_name; dns_name_t *fname; dns_fixedname_t _p_namef; dns_fixedname_t _r_namef; dns_fixedname_t _fnamef; } dns_rpz_st_t; #define DNS_RPZ_TTL_DEFAULT 5 #define DNS_RPZ_MAX_TTL_DEFAULT DNS_RPZ_TTL_DEFAULT /* * So various response policy zone messages can be turned up or down. */ #define DNS_RPZ_ERROR_LEVEL ISC_LOG_WARNING #define DNS_RPZ_INFO_LEVEL ISC_LOG_INFO #define DNS_RPZ_DEBUG_LEVEL1 ISC_LOG_DEBUG(1) #define DNS_RPZ_DEBUG_LEVEL2 ISC_LOG_DEBUG(2) #define DNS_RPZ_DEBUG_LEVEL3 ISC_LOG_DEBUG(3) #define DNS_RPZ_DEBUG_QUIET (DNS_RPZ_DEBUG_LEVEL3+1) const char * dns_rpz_type2str(dns_rpz_type_t type); dns_rpz_policy_t dns_rpz_str2policy(const char *str); const char * dns_rpz_policy2str(dns_rpz_policy_t policy); dns_rpz_policy_t dns_rpz_decode_cname(dns_rpz_zone_t *rpz, dns_rdataset_t *rdataset, dns_name_t *selfname); isc_result_t dns_rpz_new_zones(dns_rpz_zones_t **rpzsp, isc_mem_t *mctx); void dns_rpz_attach_rpzs(dns_rpz_zones_t *source, dns_rpz_zones_t **target); void dns_rpz_detach_rpzs(dns_rpz_zones_t **rpzsp); isc_result_t dns_rpz_beginload(dns_rpz_zones_t **load_rpzsp, dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num); isc_result_t dns_rpz_ready(dns_rpz_zones_t *rpzs, dns_rpz_zones_t **load_rpzsp, dns_rpz_num_t rpz_num); isc_result_t dns_rpz_add(dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num, dns_name_t *name); void dns_rpz_delete(dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num, dns_name_t *name); dns_rpz_num_t dns_rpz_find_ip(dns_rpz_zones_t *rpzs, dns_rpz_type_t rpz_type, dns_rpz_zbits_t zbits, const isc_netaddr_t *netaddr, dns_name_t *ip_name, dns_rpz_prefix_t *prefixp); dns_rpz_zbits_t dns_rpz_find_name(dns_rpz_zones_t *rpzs, dns_rpz_type_t rpz_type, dns_rpz_zbits_t zbits, dns_name_t *trig_name); ISC_LANG_ENDDECLS #endif /* DNS_RPZ_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/rootns.h����������������������������������������������������������������������������������0000644�����������������00000001573�14763166026�0010053 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_ROOTNS_H #define DNS_ROOTNS_H 1 /*! \file dns/rootns.h */ #include <isc/lang.h> #include <dns/types.h> ISC_LANG_BEGINDECLS isc_result_t dns_rootns_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, const char *filename, dns_db_t **target); void dns_root_checkhints(dns_view_t *view, dns_db_t *hints, dns_db_t *db); /* * Reports differences between hints and the real roots. * * Requires view, hints and (cache) db to be valid. */ ISC_LANG_ENDDECLS #endif /* DNS_ROOTNS_H */ �������������������������������������������������������������������������������������������������������������������������������������bind9/dns/acl.h�������������������������������������������������������������������������������������0000644�����������������00000016152�14763166026�0007265 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* $Id: acl.h,v 1.35 2011/06/17 23:47:49 tbox Exp $ */ #ifndef DNS_ACL_H #define DNS_ACL_H 1 /***** ***** Module Info *****/ /*! \file dns/acl.h * \brief * Address match list handling. */ /*** *** Imports ***/ #include <isc/lang.h> #include <isc/magic.h> #include <isc/netaddr.h> #include <isc/refcount.h> #ifdef HAVE_GEOIP #include <dns/geoip.h> #endif #include <dns/name.h> #include <dns/types.h> #include <dns/iptable.h> #ifdef HAVE_GEOIP #include <GeoIP.h> #endif /*** *** Types ***/ typedef enum { dns_aclelementtype_ipprefix, dns_aclelementtype_keyname, dns_aclelementtype_nestedacl, dns_aclelementtype_localhost, dns_aclelementtype_localnets, #ifdef HAVE_GEOIP dns_aclelementtype_geoip, #endif /* HAVE_GEOIP */ dns_aclelementtype_any } dns_aclelementtype_t; typedef struct dns_aclipprefix dns_aclipprefix_t; struct dns_aclipprefix { isc_netaddr_t address; /* IP4/IP6 */ unsigned int prefixlen; }; struct dns_aclelement { dns_aclelementtype_t type; isc_boolean_t negative; dns_name_t keyname; #ifdef HAVE_GEOIP dns_geoip_elem_t geoip_elem; #endif /* HAVE_GEOIP */ dns_acl_t *nestedacl; int node_num; }; struct dns_acl { unsigned int magic; isc_mem_t *mctx; isc_refcount_t refcount; dns_iptable_t *iptable; #define node_count iptable->radix->num_added_node dns_aclelement_t *elements; isc_boolean_t has_negatives; unsigned int alloc; /*%< Elements allocated */ unsigned int length; /*%< Elements initialized */ char *name; /*%< Temporary use only */ ISC_LINK(dns_acl_t) nextincache; /*%< Ditto */ }; struct dns_aclenv { dns_acl_t *localhost; dns_acl_t *localnets; isc_boolean_t match_mapped; #ifdef HAVE_GEOIP dns_geoip_databases_t *geoip; isc_boolean_t geoip_use_ecs; #endif }; #define DNS_ACL_MAGIC ISC_MAGIC('D','a','c','l') #define DNS_ACL_VALID(a) ISC_MAGIC_VALID(a, DNS_ACL_MAGIC) /*** *** Functions ***/ ISC_LANG_BEGINDECLS isc_result_t dns_acl_create(isc_mem_t *mctx, int n, dns_acl_t **target); /*%< * Create a new ACL, including an IP table and an array with room * for 'n' ACL elements. The elements are uninitialized and the * length is 0. */ isc_result_t dns_acl_any(isc_mem_t *mctx, dns_acl_t **target); /*%< * Create a new ACL that matches everything. */ isc_result_t dns_acl_none(isc_mem_t *mctx, dns_acl_t **target); /*%< * Create a new ACL that matches nothing. */ isc_boolean_t dns_acl_isany(dns_acl_t *acl); /*%< * Test whether ACL is set to "{ any; }" */ isc_boolean_t dns_acl_isnone(dns_acl_t *acl); /*%< * Test whether ACL is set to "{ none; }" */ isc_result_t dns_acl_merge(dns_acl_t *dest, dns_acl_t *source, isc_boolean_t pos); /*%< * Merge the contents of one ACL into another. Call dns_iptable_merge() * for the IP tables, then concatenate the element arrays. * * If pos is set to false, then the nested ACL is to be negated. This * means reverse the sense of each *positive* element or IP table node, * but leave negatives alone, so as to prevent a double-negative causing * an unexpected positive match in the parent ACL. */ void dns_acl_attach(dns_acl_t *source, dns_acl_t **target); /*%< * Attach to acl 'source'. * * Requires: *\li 'source' to be a valid acl. *\li 'target' to be non NULL and '*target' to be NULL. */ void dns_acl_detach(dns_acl_t **aclp); /*%< * Detach the acl. On final detach the acl must not be linked on any * list. * * Requires: *\li '*aclp' to be a valid acl. * * Insists: *\li '*aclp' is not linked on final detach. */ isc_boolean_t dns_acl_isinsecure(const dns_acl_t *a); /*%< * Return #ISC_TRUE iff the acl 'a' is considered insecure, that is, * if it contains IP addresses other than those of the local host. * This is intended for applications such as printing warning * messages for suspect ACLs; it is not intended for making access * control decisions. We make no guarantee that an ACL for which * this function returns #ISC_FALSE is safe. */ isc_result_t dns_aclenv_init(isc_mem_t *mctx, dns_aclenv_t *env); /*%< * Initialize ACL environment, setting up localhost and localnets ACLs */ void dns_aclenv_copy(dns_aclenv_t *t, dns_aclenv_t *s); void dns_aclenv_destroy(dns_aclenv_t *env); isc_result_t dns_acl_match(const isc_netaddr_t *reqaddr, const dns_name_t *reqsigner, const dns_acl_t *acl, const dns_aclenv_t *env, int *match, const dns_aclelement_t **matchelt); isc_result_t dns_acl_match2(const isc_netaddr_t *reqaddr, const dns_name_t *reqsigner, const isc_netaddr_t *ecs, isc_uint8_t ecslen, isc_uint8_t *scope, const dns_acl_t *acl, const dns_aclenv_t *env, int *match, const dns_aclelement_t **matchelt); /*%< * General, low-level ACL matching. This is expected to * be useful even for weird stuff like the topology and sortlist statements. * * Match the address 'reqaddr', and optionally the key name 'reqsigner', * and optionally the client prefix 'ecs' of length 'ecslen' * (reported via EDNS client subnet option) against 'acl'. * * 'reqsigner' and 'ecs' may be NULL. If an ACL matches against 'ecs' * and 'ecslen', then 'scope' will be set to indicate the netmask that * matched. * * If there is a match, '*match' will be set to an integer whose absolute * value corresponds to the order in which the matching value was inserted * into the ACL. For a positive match, this value will be positive; for a * negative match, it will be negative. * * If there is no match, *match will be set to zero. * * If there is a match in the element list (either positive or negative) * and 'matchelt' is non-NULL, *matchelt will be pointed to the matching * element. * * 'env' points to the current ACL environment, including the * current values of localhost and localnets and (if applicable) * the GeoIP context. * * Returns: *\li #ISC_R_SUCCESS Always succeeds. */ isc_boolean_t dns_aclelement_match(const isc_netaddr_t *reqaddr, const dns_name_t *reqsigner, const dns_aclelement_t *e, const dns_aclenv_t *env, const dns_aclelement_t **matchelt); isc_boolean_t dns_aclelement_match2(const isc_netaddr_t *reqaddr, const dns_name_t *reqsigner, const isc_netaddr_t *ecs, isc_uint8_t ecslen, isc_uint8_t *scope, const dns_aclelement_t *e, const dns_aclenv_t *env, const dns_aclelement_t **matchelt); /*%< * Like dns_acl_match, but matches against the single ACL element 'e' * rather than a complete ACL, and returns ISC_TRUE iff it matched. * * To determine whether the match was positive or negative, the * caller should examine e->negative. Since the element 'e' may be * a reference to a named ACL or a nested ACL, a matching element * returned through 'matchelt' is not necessarily 'e' itself. */ ISC_LANG_ENDDECLS #endif /* DNS_ACL_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/zone.h������������������������������������������������������������������������������������0000644�����������������00000167457�14763166026�0007520 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_ZONE_H #define DNS_ZONE_H 1 /*! \file dns/zone.h */ /*** *** Imports ***/ #include <stdio.h> #include <isc/formatcheck.h> #include <isc/lang.h> #include <isc/rwlock.h> #include <dns/catz.h> #include <dns/master.h> #include <dns/masterdump.h> #include <dns/rdatastruct.h> #include <dns/rpz.h> #include <dns/types.h> #include <dns/zt.h> typedef enum { dns_zone_none, dns_zone_master, dns_zone_slave, dns_zone_stub, dns_zone_staticstub, dns_zone_key, dns_zone_dlz, dns_zone_redirect } dns_zonetype_t; typedef enum { dns_zonestat_none = 0, dns_zonestat_terse, dns_zonestat_full } dns_zonestat_level_t; #define DNS_ZONEOPT_SERVERS 0x00000001U /*%< perform server checks */ #define DNS_ZONEOPT_PARENTS 0x00000002U /*%< perform parent checks */ #define DNS_ZONEOPT_CHILDREN 0x00000004U /*%< perform child checks */ #define DNS_ZONEOPT_NOTIFY 0x00000008U /*%< perform NOTIFY */ #define DNS_ZONEOPT_MANYERRORS 0x00000010U /*%< return many errors on load */ #define DNS_ZONEOPT_IXFRFROMDIFFS 0x00000020U /*%< calculate differences */ #define DNS_ZONEOPT_NOMERGE 0x00000040U /*%< don't merge journal */ #define DNS_ZONEOPT_CHECKNS 0x00000080U /*%< check if NS's are addresses */ #define DNS_ZONEOPT_FATALNS 0x00000100U /*%< DNS_ZONEOPT_CHECKNS is fatal */ #define DNS_ZONEOPT_MULTIMASTER 0x00000200U /*%< this zone has multiple masters */ #define DNS_ZONEOPT_USEALTXFRSRC 0x00000400U /*%< use alternate transfer sources */ #define DNS_ZONEOPT_CHECKNAMES 0x00000800U /*%< check-names */ #define DNS_ZONEOPT_CHECKNAMESFAIL 0x00001000U /*%< fatal check-name failures */ #define DNS_ZONEOPT_CHECKWILDCARD 0x00002000U /*%< check for internal wildcards */ #define DNS_ZONEOPT_CHECKMX 0x00004000U /*%< check-mx */ #define DNS_ZONEOPT_CHECKMXFAIL 0x00008000U /*%< fatal check-mx failures */ #define DNS_ZONEOPT_CHECKINTEGRITY 0x00010000U /*%< perform integrity checks */ #define DNS_ZONEOPT_CHECKSIBLING 0x00020000U /*%< perform sibling glue checks */ #define DNS_ZONEOPT_NOCHECKNS 0x00040000U /*%< disable IN NS address checks */ #define DNS_ZONEOPT_WARNMXCNAME 0x00080000U /*%< warn on MX CNAME check */ #define DNS_ZONEOPT_IGNOREMXCNAME 0x00100000U /*%< ignore MX CNAME check */ #define DNS_ZONEOPT_WARNSRVCNAME 0x00200000U /*%< warn on SRV CNAME check */ #define DNS_ZONEOPT_IGNORESRVCNAME 0x00400000U /*%< ignore SRV CNAME check */ #define DNS_ZONEOPT_UPDATECHECKKSK 0x00800000U /*%< check dnskey KSK flag */ #define DNS_ZONEOPT_TRYTCPREFRESH 0x01000000U /*%< try tcp refresh on udp failure */ #define DNS_ZONEOPT_NOTIFYTOSOA 0x02000000U /*%< Notify the SOA MNAME */ #define DNS_ZONEOPT_NSEC3TESTZONE 0x04000000U /*%< nsec3-test-zone */ #define DNS_ZONEOPT_SECURETOINSECURE 0x08000000U /*%< dnssec-secure-to-insecure */ #define DNS_ZONEOPT_DNSKEYKSKONLY 0x10000000U /*%< dnssec-dnskey-kskonly */ #define DNS_ZONEOPT_CHECKDUPRR 0x20000000U /*%< check-dup-records */ #define DNS_ZONEOPT_CHECKDUPRRFAIL 0x40000000U /*%< fatal check-dup-records failures */ #define DNS_ZONEOPT_CHECKSPF 0x80000000U /*%< check SPF records */ /* * The following zone options are shifted left into the * higher-order 32 bits of the options. */ #define DNS_ZONEOPT2_CHECKTTL 0x00000001U /*%< check max-zone-ttl */ #define DNS_ZONEOPT2_AUTOEMPTY 0x00000002U /*%< automatic empty zone */ #ifndef NOMINUM_PUBLIC /* * Nominum specific options build down. */ #define DNS_ZONEOPT_NOTIFYFORWARD 0x80000000U /* forward notify to master */ #endif /* NOMINUM_PUBLIC */ /* * Zone key maintenance options */ #define DNS_ZONEKEY_ALLOW 0x00000001U /*%< fetch keys on command */ #define DNS_ZONEKEY_MAINTAIN 0x00000002U /*%< publish/sign on schedule */ #define DNS_ZONEKEY_CREATE 0x00000004U /*%< make keys when needed */ #define DNS_ZONEKEY_FULLSIGN 0x00000008U /*%< roll to new keys immediately */ #define DNS_ZONEKEY_NORESIGN 0x00000010U /*%< no automatic resigning */ #ifndef DNS_ZONE_MINREFRESH #define DNS_ZONE_MINREFRESH 300 /*%< 5 minutes */ #endif #ifndef DNS_ZONE_MAXREFRESH #define DNS_ZONE_MAXREFRESH 2419200 /*%< 4 weeks */ #endif #ifndef DNS_ZONE_DEFAULTREFRESH #define DNS_ZONE_DEFAULTREFRESH 3600 /*%< 1 hour */ #endif #ifndef DNS_ZONE_MINRETRY #define DNS_ZONE_MINRETRY 300 /*%< 5 minutes */ #endif #ifndef DNS_ZONE_MAXRETRY #define DNS_ZONE_MAXRETRY 1209600 /*%< 2 weeks */ #endif #ifndef DNS_ZONE_DEFAULTRETRY #define DNS_ZONE_DEFAULTRETRY 60 /*%< 1 minute, subject to exponential backoff */ #endif #define DNS_ZONESTATE_XFERRUNNING 1 #define DNS_ZONESTATE_XFERDEFERRED 2 #define DNS_ZONESTATE_SOAQUERY 3 #define DNS_ZONESTATE_ANY 4 #define DNS_ZONESTATE_AUTOMATIC 5 ISC_LANG_BEGINDECLS /*** *** Functions ***/ isc_result_t dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx); /*%< * Creates a new empty zone and attach '*zonep' to it. * * Requires: *\li 'zonep' to point to a NULL pointer. *\li 'mctx' to be a valid memory context. * * Ensures: *\li '*zonep' refers to a valid zone. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li #ISC_R_UNEXPECTED */ void dns_zone_setclass(dns_zone_t *zone, dns_rdataclass_t rdclass); /*%< * Sets the class of a zone. This operation can only be performed * once on a zone. * * Require: *\li 'zone' to be a valid zone. *\li dns_zone_setclass() not to have been called since the zone was * created. *\li 'rdclass' != dns_rdataclass_none. */ dns_rdataclass_t dns_zone_getclass(dns_zone_t *zone); /*%< * Returns the current zone class. * * Requires: *\li 'zone' to be a valid zone. */ isc_result_t dns_zone_getserial2(dns_zone_t *zone, isc_uint32_t *serialp); isc_uint32_t dns_zone_getserial(dns_zone_t *zone); /*%< * Returns the current serial number of the zone. On success, the SOA * serial of the zone will be copied into '*serialp'. * dns_zone_getserial() cannot catch failure cases and is deprecated by * dns_zone_getserial2(). * * Requires: *\li 'zone' to be a valid zone. *\li 'serialp' to be non NULL * * Returns: *\li #ISC_R_SUCCESS *\li #DNS_R_NOTLOADED zone DB is not loaded */ void dns_zone_settype(dns_zone_t *zone, dns_zonetype_t type); /*%< * Sets the zone type. This operation can only be performed once on * a zone. * * Requires: *\li 'zone' to be a valid zone. *\li dns_zone_settype() not to have been called since the zone was * created. *\li 'type' != dns_zone_none */ void dns_zone_setview(dns_zone_t *zone, dns_view_t *view); /*%< * Associate the zone with a view. * * Require: *\li 'zone' to be a valid zone. */ dns_view_t * dns_zone_getview(dns_zone_t *zone); /*%< * Returns the zone's associated view. * * Requires: *\li 'zone' to be a valid zone. */ void dns_zone_setviewcommit(dns_zone_t *zone); /*%< * Commit the previous view saved internally via dns_zone_setview(). * * Require: *\li 'zone' to be a valid zone. */ void dns_zone_setviewrevert(dns_zone_t *zone); /*%< * Revert the most recent dns_zone_setview() on this zone, * restoring the previous view. * * Require: *\li 'zone' to be a valid zone. */ isc_result_t dns_zone_setorigin(dns_zone_t *zone, const dns_name_t *origin); /*%< * Sets the zones origin to 'origin'. * * Require: *\li 'zone' to be a valid zone. *\li 'origin' to be non NULL. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY */ dns_name_t * dns_zone_getorigin(dns_zone_t *zone); /*%< * Returns the value of the origin. * * Require: *\li 'zone' to be a valid zone. */ isc_result_t dns_zone_setfile(dns_zone_t *zone, const char *file); isc_result_t dns_zone_setfile2(dns_zone_t *zone, const char *file, dns_masterformat_t format); isc_result_t dns_zone_setfile3(dns_zone_t *zone, const char *file, dns_masterformat_t format, const dns_master_style_t *style); /*%< * Sets the name of the master file in the format of 'format' from which * the zone loads its database to 'file'. * * For zones that have no associated master file, 'file' will be NULL. * * For zones with persistent databases, the file name * setting is ignored. * * dns_zone_setfile() is a backward-compatible form of * dns_zone_setfile2(), which always specifies the * dns_masterformat_text (RFC1035) format. * * dns_zone_setfile2() is a backward-compatible form of * dns_zone_setfile3(), which also specifies the style * that should be used if a zone using the 'text' * masterformat is ever dumped. * * Require: *\li 'zone' to be a valid zone. * * Returns: *\li #ISC_R_NOMEMORY *\li #ISC_R_SUCCESS */ const char * dns_zone_getfile(dns_zone_t *zone); /*%< * Gets the name of the zone's master file, if any. * * Requires: *\li 'zone' to be valid initialised zone. * * Returns: *\li Pointer to null-terminated file name, or NULL. */ void dns_zone_setmaxrecords(dns_zone_t *zone, isc_uint32_t records); /*%< * Sets the maximim number of records permitted in a zone. * 0 implies unlimited. * * Requires: *\li 'zone' to be valid initialised zone. * * Returns: *\li void */ isc_uint32_t dns_zone_getmaxrecords(dns_zone_t *zone); /*%< * Gets the maximim number of records permitted in a zone. * 0 implies unlimited. * * Requires: *\li 'zone' to be valid initialised zone. * * Returns: *\li isc_uint32_t maxrecords. */ void dns_zone_setmaxttl(dns_zone_t *zone, isc_uint32_t maxttl); /*%< * Sets the max ttl of the zone. * * Requires: *\li 'zone' to be valid initialised zone. * * Returns: *\li void */ dns_ttl_t dns_zone_getmaxttl(dns_zone_t *zone); /*%< * Gets the max ttl of the zone. * * Requires: *\li 'zone' to be valid initialised zone. * * Returns: *\li dns_ttl_t maxttl. */ isc_result_t dns_zone_load(dns_zone_t *zone); isc_result_t dns_zone_loadnew(dns_zone_t *zone); isc_result_t dns_zone_loadandthaw(dns_zone_t *zone); /*%< * Cause the database to be loaded from its backing store. * Confirm that the minimum requirements for the zone type are * met, otherwise DNS_R_BADZONE is returned. * * dns_zone_loadnew() only loads zones that are not yet loaded. * dns_zone_load() also loads zones that are already loaded and * and whose master file has changed since the last load. * dns_zone_loadandthaw() is similar to dns_zone_load() but will * also re-enable DNS UPDATEs when the load completes. * * Require: *\li 'zone' to be a valid zone. * * Returns: *\li #ISC_R_UNEXPECTED *\li #ISC_R_SUCCESS *\li DNS_R_CONTINUE Incremental load has been queued. *\li DNS_R_UPTODATE The zone has already been loaded based on * file system timestamps. *\li DNS_R_BADZONE *\li Any result value from dns_db_load(). */ isc_result_t dns_zone_asyncload(dns_zone_t *zone, dns_zt_zoneloaded_t done, void *arg); /*%< * Cause the database to be loaded from its backing store asynchronously. * Other zone maintenance functions are suspended until this is complete. * When finished, 'done' is called to inform the caller, with 'arg' as * its first argument and 'zone' as its second. (Normally, 'arg' is * expected to point to the zone table but is left undefined for testing * purposes.) * * Require: *\li 'zone' to be a valid zone. * * Returns: *\li #ISC_R_ALREADYRUNNING *\li #ISC_R_SUCCESS *\li #ISC_R_FAILURE *\li #ISC_R_NOMEMORY */ isc_boolean_t dns__zone_loadpending(dns_zone_t *zone); /*%< * Indicates whether the zone is waiting to be loaded asynchronously. * (Not currently intended for use outside of this module and associated * tests.) */ void dns_zone_attach(dns_zone_t *source, dns_zone_t **target); /*%< * Attach '*target' to 'source' incrementing its external * reference count. * * Require: *\li 'zone' to be a valid zone. *\li 'target' to be non NULL and '*target' to be NULL. */ void dns_zone_detach(dns_zone_t **zonep); /*%< * Detach from a zone decrementing its external reference count. * If this was the last external reference to the zone it will be * shut down and eventually freed. * * Require: *\li 'zonep' to point to a valid zone. */ void dns_zone_iattach(dns_zone_t *source, dns_zone_t **target); /*%< * Attach '*target' to 'source' incrementing its internal * reference count. This is intended for use by operations * such as zone transfers that need to prevent the zone * object from being freed but not from shutting down. * * Require: *\li The caller is running in the context of the zone's task. *\li 'zone' to be a valid zone. *\li 'target' to be non NULL and '*target' to be NULL. */ void dns_zone_idetach(dns_zone_t **zonep); /*%< * Detach from a zone decrementing its internal reference count. * If there are no more internal or external references to the * zone, it will be freed. * * Require: *\li The caller is running in the context of the zone's task. *\li 'zonep' to point to a valid zone. */ void dns_zone_setflag(dns_zone_t *zone, unsigned int flags, isc_boolean_t value); /*%< * Sets ('value' == 'ISC_TRUE') / clears ('value' == 'IS_FALSE') * zone flags. Valid flag bits are DNS_ZONE_F_*. * * Requires *\li 'zone' to be a valid zone. */ isc_result_t dns_zone_getdb(dns_zone_t *zone, dns_db_t **dbp); /*%< * Attach '*dbp' to the database to if it exists otherwise * return DNS_R_NOTLOADED. * * Require: *\li 'zone' to be a valid zone. *\li 'dbp' to be != NULL && '*dbp' == NULL. * * Returns: *\li #ISC_R_SUCCESS *\li DNS_R_NOTLOADED */ void dns_zone_setdb(dns_zone_t *zone, dns_db_t *db); /*%< * Sets the zone database to 'db'. * * This function is expected to be used to configure a zone with a * database which is not loaded from a file or zone transfer. * It can be used for a general purpose zone, but right now its use * is limited to static-stub zones to avoid possible undiscovered * problems in the general cases. * * Require: *\li 'zone' to be a valid zone of static-stub. *\li zone doesn't have a database. */ isc_result_t dns_zone_setdbtype(dns_zone_t *zone, unsigned int dbargc, const char * const *dbargv); /*%< * Sets the database type to dbargv[0] and database arguments * to subsequent dbargv elements. * 'db_type' is not checked to see if it is a valid database type. * * Require: *\li 'zone' to be a valid zone. *\li 'database' to be non NULL. *\li 'dbargc' to be >= 1 *\li 'dbargv' to point to dbargc NULL-terminated strings * * Returns: *\li #ISC_R_NOMEMORY *\li #ISC_R_SUCCESS */ isc_result_t dns_zone_getdbtype(dns_zone_t *zone, char ***argv, isc_mem_t *mctx); /*%< * Returns the current dbtype. isc_mem_free() should be used * to free 'argv' after use. * * Require: *\li 'zone' to be a valid zone. *\li 'argv' to be non NULL and *argv to be NULL. *\li 'mctx' to be valid. * * Returns: *\li #ISC_R_NOMEMORY *\li #ISC_R_SUCCESS */ void dns_zone_markdirty(dns_zone_t *zone); /*%< * Mark a zone as 'dirty'. * * Require: *\li 'zone' to be a valid zone. */ void dns_zone_expire(dns_zone_t *zone); /*%< * Mark the zone as expired. If the zone requires dumping cause it to * be initiated. Set the refresh and retry intervals to there default * values and unload the zone. * * Require *\li 'zone' to be a valid zone. */ void dns_zone_refresh(dns_zone_t *zone); /*%< * Initiate zone up to date checks. The zone must already be being * managed. * * Require *\li 'zone' to be a valid zone. */ isc_result_t dns_zone_flush(dns_zone_t *zone); /*%< * Write the zone to database if there are uncommitted changes. * * Require: *\li 'zone' to be a valid zone. */ isc_result_t dns_zone_dump(dns_zone_t *zone); /*%< * Write the zone to database. * * Require: *\li 'zone' to be a valid zone. */ isc_result_t dns_zone_dumptostream(dns_zone_t *zone, FILE *fd); isc_result_t dns_zone_dumptostream2(dns_zone_t *zone, FILE *fd, dns_masterformat_t format, const dns_master_style_t *style); isc_result_t dns_zone_dumptostream3(dns_zone_t *zone, FILE *fd, dns_masterformat_t format, const dns_master_style_t *style, const isc_uint32_t rawversion); /*%< * Write the zone to stream 'fd' in the specified 'format'. * If the 'format' is dns_masterformat_text (RFC1035), 'style' also * specifies the file style (e.g., &dns_master_style_default). * * dns_zone_dumptostream() is a backward-compatible form of * dns_zone_dumptostream2(), which always uses the dns_masterformat_text * format and the dns_master_style_default style. * * dns_zone_dumptostream2() is a backward-compatible form of * dns_zone_dumptostream3(), which always uses the current * default raw file format version. * * Note that dns_zone_dumptostream3() is the most flexible form. It * can also provide the functionality of dns_zone_fulldumptostream(). * * Require: *\li 'zone' to be a valid zone. *\li 'fd' to be a stream open for writing. */ isc_result_t dns_zone_fulldumptostream(dns_zone_t *zone, FILE *fd); /*%< * The same as dns_zone_dumptostream, but dumps the zone with * different dump settings (dns_master_style_full). * * Require: *\li 'zone' to be a valid zone. *\li 'fd' to be a stream open for writing. */ void dns_zone_maintenance(dns_zone_t *zone); /*%< * Perform regular maintenance on the zone. This is called as a * result of a zone being managed. * * Require *\li 'zone' to be a valid zone. */ isc_result_t dns_zone_setmasters(dns_zone_t *zone, const isc_sockaddr_t *masters, isc_uint32_t count); isc_result_t dns_zone_setmasterswithkeys(dns_zone_t *zone, const isc_sockaddr_t *masters, dns_name_t **keynames, isc_uint32_t count); /*%< * Set the list of master servers for the zone. * * Require: *\li 'zone' to be a valid zone. *\li 'masters' array of isc_sockaddr_t with port set or NULL. *\li 'count' the number of masters. *\li 'keynames' array of dns_name_t's for tsig keys or NULL. * * \li dns_zone_setmasters() is just a wrapper to setmasterswithkeys(), * passing NULL in the keynames field. * * \li If 'masters' is NULL then 'count' must be zero. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li Any result dns_name_dup() can return, if keynames!=NULL */ isc_result_t dns_zone_setalsonotify(dns_zone_t *zone, const isc_sockaddr_t *notify, isc_uint32_t count); isc_result_t dns_zone_setalsonotifywithkeys(dns_zone_t *zone, const isc_sockaddr_t *notify, dns_name_t **keynames, isc_uint32_t count); isc_result_t dns_zone_setalsonotifydscpkeys(dns_zone_t *zone, const isc_sockaddr_t *notify, const isc_dscp_t *dscps, dns_name_t **keynames, isc_uint32_t count); /*%< * Set the list of additional servers to be notified when * a zone changes. To clear the list use 'count = 0'. * * dns_zone_alsonotifywithkeys() allows each notify address to * be associated with a TSIG key. * * Require: *\li 'zone' to be a valid zone. *\li 'notify' to be non-NULL if count != 0. *\li 'count' to be the number of notifiees. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY */ void dns_zone_unload(dns_zone_t *zone); /*%< * detach the database from the zone structure. * * Require: *\li 'zone' to be a valid zone. */ void dns_zone_setoption(dns_zone_t *zone, unsigned int option, isc_boolean_t value); void dns_zone_setoption2(dns_zone_t *zone, unsigned int option, isc_boolean_t value); /*%< * Set the given options on ('value' == ISC_TRUE) or off * ('value' == #ISC_FALSE). * * dns_zone_setoption2() has been introduced because the number * of options needed now exceeds the 32 bits in the zone->options * field; it should be used set options with names beginning * with DNS_ZONEOPT2_. * * Require: *\li 'zone' to be a valid zone. */ unsigned int dns_zone_getoptions(dns_zone_t *zone); unsigned int dns_zone_getoptions2(dns_zone_t *zone); /*%< * Returns the current zone options. * * Callers should be aware there is now more than one set of zone * options. dns_zone_getoptions2() has been introduced because the * number of options needed now exceeds the 32 bits in the * zone->options field. It returns the options whose names begin * with DNS_ZONEOPT2_. * * Require: *\li 'zone' to be a valid zone. */ void dns_zone_setkeyopt(dns_zone_t *zone, unsigned int option, isc_boolean_t value); /*%< * Set key options on ('value' == ISC_TRUE) or off ('value' == * #ISC_FALSE). * * Require: *\li 'zone' to be a valid zone. */ unsigned int dns_zone_getkeyopts(dns_zone_t *zone); /*%< * Returns the current zone key options. * * Require: *\li 'zone' to be a valid zone. */ void dns_zone_setminrefreshtime(dns_zone_t *zone, isc_uint32_t val); /*%< * Set the minimum refresh time. * * Requires: *\li 'zone' is valid. *\li val > 0. */ void dns_zone_setmaxrefreshtime(dns_zone_t *zone, isc_uint32_t val); /*%< * Set the maximum refresh time. * * Requires: *\li 'zone' is valid. *\li val > 0. */ void dns_zone_setminretrytime(dns_zone_t *zone, isc_uint32_t val); /*%< * Set the minimum retry time. * * Requires: *\li 'zone' is valid. *\li val > 0. */ void dns_zone_setmaxretrytime(dns_zone_t *zone, isc_uint32_t val); /*%< * Set the maximum retry time. * * Requires: *\li 'zone' is valid. * val > 0. */ isc_result_t dns_zone_setxfrsource4(dns_zone_t *zone, const isc_sockaddr_t *xfrsource); isc_result_t dns_zone_setaltxfrsource4(dns_zone_t *zone, const isc_sockaddr_t *xfrsource); /*%< * Set the source address to be used in IPv4 zone transfers. * * Require: *\li 'zone' to be a valid zone. *\li 'xfrsource' to contain the address. * * Returns: *\li #ISC_R_SUCCESS */ isc_sockaddr_t * dns_zone_getxfrsource4(dns_zone_t *zone); isc_sockaddr_t * dns_zone_getaltxfrsource4(dns_zone_t *zone); /*%< * Returns the source address set by a previous dns_zone_setxfrsource4 * call, or the default of inaddr_any, port 0. * * Require: *\li 'zone' to be a valid zone. */ isc_result_t dns_zone_setxfrsource4dscp(dns_zone_t *zone, isc_dscp_t dscp); isc_result_t dns_zone_setaltxfrsource4dscp(dns_zone_t *zone, isc_dscp_t dscp); /*%< * Set the DSCP value associated with the transfer/alt-transfer source. * * Require: *\li 'zone' to be a valid zone. * * Returns: *\li #ISC_R_SUCCESS */ isc_dscp_t dns_zone_getxfrsource4dscp(dns_zone_t *zone); isc_dscp_t dns_zone_getaltxfrsource4dscp(dns_zone_t *zone); /*%/ * Get the DSCP value associated with the transfer/alt-transfer source. * * Require: *\li 'zone' to be a valid zone. */ isc_result_t dns_zone_setxfrsource6(dns_zone_t *zone, const isc_sockaddr_t *xfrsource); isc_result_t dns_zone_setaltxfrsource6(dns_zone_t *zone, const isc_sockaddr_t *xfrsource); /*%< * Set the source address to be used in IPv6 zone transfers. * * Require: *\li 'zone' to be a valid zone. *\li 'xfrsource' to contain the address. * * Returns: *\li #ISC_R_SUCCESS */ isc_sockaddr_t * dns_zone_getxfrsource6(dns_zone_t *zone); isc_sockaddr_t * dns_zone_getaltxfrsource6(dns_zone_t *zone); /*%< * Returns the source address set by a previous dns_zone_setxfrsource6 * call, or the default of in6addr_any, port 0. * * Require: *\li 'zone' to be a valid zone. */ isc_dscp_t dns_zone_getxfrsource6dscp(dns_zone_t *zone); isc_dscp_t dns_zone_getaltxfrsource6dscp(dns_zone_t *zone); /*%/ * Get the DSCP value associated with the transfer/alt-transfer source. * * Require: *\li 'zone' to be a valid zone. */ isc_result_t dns_zone_setxfrsource6dscp(dns_zone_t *zone, isc_dscp_t dscp); isc_result_t dns_zone_setaltxfrsource6dscp(dns_zone_t *zone, isc_dscp_t dscp); /*%< * Set the DSCP value associated with the transfer/alt-transfer source. * * Require: *\li 'zone' to be a valid zone. * * Returns: *\li #ISC_R_SUCCESS */ isc_result_t dns_zone_setnotifysrc4(dns_zone_t *zone, const isc_sockaddr_t *notifysrc); /*%< * Set the source address to be used with IPv4 NOTIFY messages. * * Require: *\li 'zone' to be a valid zone. *\li 'notifysrc' to contain the address. * * Returns: *\li #ISC_R_SUCCESS */ isc_sockaddr_t * dns_zone_getnotifysrc4(dns_zone_t *zone); /*%< * Returns the source address set by a previous dns_zone_setnotifysrc4 * call, or the default of inaddr_any, port 0. * * Require: *\li 'zone' to be a valid zone. */ isc_dscp_t dns_zone_getnotifysrc4dscp(dns_zone_t *zone); /*%/ * Get the DSCP value associated with the IPv4 notify source. * * Require: *\li 'zone' to be a valid zone. */ isc_result_t dns_zone_setnotifysrc4dscp(dns_zone_t *zone, isc_dscp_t dscp); /*%< * Set the DSCP value associated with the IPv4 notify source. * * Require: *\li 'zone' to be a valid zone. * * Returns: *\li #ISC_R_SUCCESS */ isc_result_t dns_zone_setnotifysrc6(dns_zone_t *zone, const isc_sockaddr_t *notifysrc); /*%< * Set the source address to be used with IPv6 NOTIFY messages. * * Require: *\li 'zone' to be a valid zone. *\li 'notifysrc' to contain the address. * * Returns: *\li #ISC_R_SUCCESS */ isc_sockaddr_t * dns_zone_getnotifysrc6(dns_zone_t *zone); /*%< * Returns the source address set by a previous dns_zone_setnotifysrc6 * call, or the default of in6addr_any, port 0. * * Require: *\li 'zone' to be a valid zone. */ isc_dscp_t dns_zone_getnotifysrc6dscp(dns_zone_t *zone); /*%/ * Get the DSCP value associated with the IPv6 notify source. * * Require: *\li 'zone' to be a valid zone. */ isc_result_t dns_zone_setnotifysrc6dscp(dns_zone_t *zone, isc_dscp_t dscp); /*%< * Set the DSCP value associated with the IPv6 notify source. * * Require: *\li 'zone' to be a valid zone. * * Returns: *\li #ISC_R_SUCCESS */ void dns_zone_setnotifyacl(dns_zone_t *zone, dns_acl_t *acl); /*%< * Sets the notify acl list for the zone. * * Require: *\li 'zone' to be a valid zone. *\li 'acl' to be a valid acl. */ void dns_zone_setqueryacl(dns_zone_t *zone, dns_acl_t *acl); /*%< * Sets the query acl list for the zone. * * Require: *\li 'zone' to be a valid zone. *\li 'acl' to be a valid acl. */ void dns_zone_setqueryonacl(dns_zone_t *zone, dns_acl_t *acl); /*%< * Sets the query-on acl list for the zone. * * Require: *\li 'zone' to be a valid zone. *\li 'acl' to be a valid acl. */ void dns_zone_setupdateacl(dns_zone_t *zone, dns_acl_t *acl); /*%< * Sets the update acl list for the zone. * * Require: *\li 'zone' to be a valid zone. *\li 'acl' to be valid acl. */ void dns_zone_setforwardacl(dns_zone_t *zone, dns_acl_t *acl); /*%< * Sets the forward unsigned updates acl list for the zone. * * Require: *\li 'zone' to be a valid zone. *\li 'acl' to be valid acl. */ void dns_zone_setxfracl(dns_zone_t *zone, dns_acl_t *acl); /*%< * Sets the transfer acl list for the zone. * * Require: *\li 'zone' to be a valid zone. *\li 'acl' to be valid acl. */ dns_acl_t * dns_zone_getnotifyacl(dns_zone_t *zone); /*%< * Returns the current notify acl or NULL. * * Require: *\li 'zone' to be a valid zone. * * Returns: *\li acl a pointer to the acl. *\li NULL */ dns_acl_t * dns_zone_getqueryacl(dns_zone_t *zone); /*%< * Returns the current query acl or NULL. * * Require: *\li 'zone' to be a valid zone. * * Returns: *\li acl a pointer to the acl. *\li NULL */ dns_acl_t * dns_zone_getqueryonacl(dns_zone_t *zone); /*%< * Returns the current query-on acl or NULL. * * Require: *\li 'zone' to be a valid zone. * * Returns: *\li acl a pointer to the acl. *\li NULL */ dns_acl_t * dns_zone_getupdateacl(dns_zone_t *zone); /*%< * Returns the current update acl or NULL. * * Require: *\li 'zone' to be a valid zone. * * Returns: *\li acl a pointer to the acl. *\li NULL */ dns_acl_t * dns_zone_getforwardacl(dns_zone_t *zone); /*%< * Returns the current forward unsigned updates acl or NULL. * * Require: *\li 'zone' to be a valid zone. * * Returns: *\li acl a pointer to the acl. *\li NULL */ dns_acl_t * dns_zone_getxfracl(dns_zone_t *zone); /*%< * Returns the current transfer acl or NULL. * * Require: *\li 'zone' to be a valid zone. * * Returns: *\li acl a pointer to the acl. *\li NULL */ void dns_zone_clearupdateacl(dns_zone_t *zone); /*%< * Clear the current update acl. * * Require: *\li 'zone' to be a valid zone. */ void dns_zone_clearforwardacl(dns_zone_t *zone); /*%< * Clear the current forward unsigned updates acl. * * Require: *\li 'zone' to be a valid zone. */ void dns_zone_clearnotifyacl(dns_zone_t *zone); /*%< * Clear the current notify acl. * * Require: *\li 'zone' to be a valid zone. */ void dns_zone_clearqueryacl(dns_zone_t *zone); /*%< * Clear the current query acl. * * Require: *\li 'zone' to be a valid zone. */ void dns_zone_clearqueryonacl(dns_zone_t *zone); /*%< * Clear the current query-on acl. * * Require: *\li 'zone' to be a valid zone. */ void dns_zone_clearxfracl(dns_zone_t *zone); /*%< * Clear the current transfer acl. * * Require: *\li 'zone' to be a valid zone. */ isc_boolean_t dns_zone_getupdatedisabled(dns_zone_t *zone); /*%< * Return update disabled. * Transient unless called when running in isc_task_exclusive() mode. */ void dns_zone_setupdatedisabled(dns_zone_t *zone, isc_boolean_t state); /*%< * Set update disabled. * Should only be called only when running in isc_task_exclusive() mode. * Failure to do so may result in updates being committed after the * call has been made. */ isc_boolean_t dns_zone_getzeronosoattl(dns_zone_t *zone); /*%< * Return zero-no-soa-ttl status. */ void dns_zone_setzeronosoattl(dns_zone_t *zone, isc_boolean_t state); /*%< * Set zero-no-soa-ttl status. */ void dns_zone_setchecknames(dns_zone_t *zone, dns_severity_t severity); /*%< * Set the severity of name checking when loading a zone. * * Require: * \li 'zone' to be a valid zone. */ dns_severity_t dns_zone_getchecknames(dns_zone_t *zone); /*%< * Return the current severity of name checking. * * Require: *\li 'zone' to be a valid zone. */ void dns_zone_setjournalsize(dns_zone_t *zone, isc_int32_t size); /*%< * Sets the journal size for the zone. * * Requires: *\li 'zone' to be a valid zone. */ isc_int32_t dns_zone_getjournalsize(dns_zone_t *zone); /*%< * Return the journal size as set with a previous call to * dns_zone_setjournalsize(). * * Requires: *\li 'zone' to be a valid zone. */ isc_result_t dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from, dns_message_t *msg); isc_result_t dns_zone_notifyreceive2(dns_zone_t *zone, isc_sockaddr_t *from, isc_sockaddr_t *to, dns_message_t *msg); /*%< * Tell the zone that it has received a NOTIFY message from another * server. This may cause some zone maintenance activity to occur. * * Requires: *\li 'zone' to be a valid zone. *\li '*from' to contain the address of the server from which 'msg' * was received. *\li 'msg' a message with opcode NOTIFY and qr clear. * * Returns: *\li DNS_R_REFUSED *\li DNS_R_NOTIMP *\li DNS_R_FORMERR *\li DNS_R_SUCCESS */ void dns_zone_setmaxxfrin(dns_zone_t *zone, isc_uint32_t maxxfrin); /*%< * Set the maximum time (in seconds) that a zone transfer in (AXFR/IXFR) * of this zone will use before being aborted. * * Requires: * \li 'zone' to be valid initialised zone. */ isc_uint32_t dns_zone_getmaxxfrin(dns_zone_t *zone); /*%< * Returns the maximum transfer time for this zone. This will be * either the value set by the last call to dns_zone_setmaxxfrin() or * the default value of 1 hour. * * Requires: *\li 'zone' to be valid initialised zone. */ void dns_zone_setmaxxfrout(dns_zone_t *zone, isc_uint32_t maxxfrout); /*%< * Set the maximum time (in seconds) that a zone transfer out (AXFR/IXFR) * of this zone will use before being aborted. * * Requires: * \li 'zone' to be valid initialised zone. */ isc_uint32_t dns_zone_getmaxxfrout(dns_zone_t *zone); /*%< * Returns the maximum transfer time for this zone. This will be * either the value set by the last call to dns_zone_setmaxxfrout() or * the default value of 1 hour. * * Requires: *\li 'zone' to be valid initialised zone. */ isc_result_t dns_zone_setjournal(dns_zone_t *zone, const char *myjournal); /*%< * Sets the filename used for journaling updates / IXFR transfers. * The default journal name is set by dns_zone_setfile() to be * "file.jnl". If 'myjournal' is NULL, the zone will have no * journal name. * * Requires: *\li 'zone' to be a valid zone. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY */ char * dns_zone_getjournal(dns_zone_t *zone); /*%< * Returns the journal name associated with this zone. * If no journal has been set this will be NULL. * * Requires: *\li 'zone' to be valid initialised zone. */ dns_zonetype_t dns_zone_gettype(dns_zone_t *zone); /*%< * Returns the type of the zone (master/slave/etc.) * * Requires: *\li 'zone' to be valid initialised zone. */ void dns_zone_settask(dns_zone_t *zone, isc_task_t *task); /*%< * Give a zone a task to work with. Any current task will be detached. * * Requires: *\li 'zone' to be valid. *\li 'task' to be valid. */ void dns_zone_gettask(dns_zone_t *zone, isc_task_t **target); /*%< * Attach '*target' to the zone's task. * * Requires: *\li 'zone' to be valid initialised zone. *\li 'zone' to have a task. *\li 'target' to be != NULL && '*target' == NULL. */ void dns_zone_notify(dns_zone_t *zone); /*%< * Generate notify events for this zone. * * Requires: *\li 'zone' to be a valid zone. */ isc_result_t dns_zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump); /*%< * Replace the database of "zone" with a new database "db". * * If "dump" is ISC_TRUE, then the new zone contents are dumped * into to the zone's master file for persistence. When replacing * a zone database by one just loaded from a master file, set * "dump" to ISC_FALSE to avoid a redundant redump of the data just * loaded. Otherwise, it should be set to ISC_TRUE. * * If the "diff-on-reload" option is enabled in the configuration file, * the differences between the old and the new database are added to the * journal file, and the master file dump is postponed. * * Requires: * \li 'zone' to be a valid zone. * * Returns: * \li DNS_R_SUCCESS * \li DNS_R_BADZONE zone failed basic consistency checks: * * a single SOA must exist * * some NS records must exist. * Others */ isc_uint32_t dns_zone_getidlein(dns_zone_t *zone); /*%< * Requires: * \li 'zone' to be a valid zone. * * Returns: * \li number of seconds of idle time before we abort the transfer in. */ void dns_zone_setidlein(dns_zone_t *zone, isc_uint32_t idlein); /*%< * \li Set the idle timeout for transfer the. * \li Zero set the default value, 1 hour. * * Requires: * \li 'zone' to be a valid zone. */ isc_uint32_t dns_zone_getidleout(dns_zone_t *zone); /*%< * * Requires: * \li 'zone' to be a valid zone. * * Returns: * \li number of seconds of idle time before we abort a transfer out. */ void dns_zone_setidleout(dns_zone_t *zone, isc_uint32_t idleout); /*%< * \li Set the idle timeout for transfers out. * \li Zero set the default value, 1 hour. * * Requires: * \li 'zone' to be a valid zone. */ void dns_zone_getssutable(dns_zone_t *zone, dns_ssutable_t **table); /*%< * Get the simple-secure-update policy table. * * Requires: * \li 'zone' to be a valid zone. */ void dns_zone_setssutable(dns_zone_t *zone, dns_ssutable_t *table); /*%< * Set / clear the simple-secure-update policy table. * * Requires: * \li 'zone' to be a valid zone. */ isc_mem_t * dns_zone_getmctx(dns_zone_t *zone); /*%< * Get the memory context of a zone. * * Requires: * \li 'zone' to be a valid zone. */ dns_zonemgr_t * dns_zone_getmgr(dns_zone_t *zone); /*%< * If 'zone' is managed return the zone manager otherwise NULL. * * Requires: * \li 'zone' to be a valid zone. */ void dns_zone_setsigvalidityinterval(dns_zone_t *zone, isc_uint32_t interval); /*%< * Set the zone's RRSIG validity interval. This is the length of time * for which DNSSEC signatures created as a result of dynamic updates * to secure zones will remain valid, in seconds. * * Requires: * \li 'zone' to be a valid zone. */ isc_uint32_t dns_zone_getsigvalidityinterval(dns_zone_t *zone); /*%< * Get the zone's RRSIG validity interval. * * Requires: * \li 'zone' to be a valid zone. */ void dns_zone_setsigresigninginterval(dns_zone_t *zone, isc_uint32_t interval); /*%< * Set the zone's RRSIG re-signing interval. A dynamic zone's RRSIG's * will be re-signed 'interval' amount of time before they expire. * * Requires: * \li 'zone' to be a valid zone. */ isc_uint32_t dns_zone_getsigresigninginterval(dns_zone_t *zone); /*%< * Get the zone's RRSIG re-signing interval. * * Requires: * \li 'zone' to be a valid zone. */ void dns_zone_setnotifytype(dns_zone_t *zone, dns_notifytype_t notifytype); /*%< * Sets zone notify method to "notifytype" */ isc_result_t dns_zone_forwardupdate(dns_zone_t *zone, dns_message_t *msg, dns_updatecallback_t callback, void *callback_arg); /*%< * Forward 'msg' to each master in turn until we get an answer or we * have exhausted the list of masters. 'callback' will be called with * ISC_R_SUCCESS if we get an answer and the returned message will be * passed as 'answer_message', otherwise a non ISC_R_SUCCESS result code * will be passed and answer_message will be NULL. The callback function * is responsible for destroying 'answer_message'. * (callback)(callback_arg, result, answer_message); * * Require: *\li 'zone' to be valid *\li 'msg' to be valid. *\li 'callback' to be non NULL. * Returns: *\li #ISC_R_SUCCESS if the message has been forwarded, *\li #ISC_R_NOMEMORY *\li Others */ isc_result_t dns_zone_next(dns_zone_t *zone, dns_zone_t **next); /*%< * Find the next zone in the list of managed zones. * * Requires: *\li 'zone' to be valid *\li The zone manager for the indicated zone MUST be locked * by the caller. This is not checked. *\li 'next' be non-NULL, and '*next' be NULL. * * Ensures: *\li 'next' points to a valid zone (result ISC_R_SUCCESS) or to NULL * (result ISC_R_NOMORE). */ isc_result_t dns_zone_first(dns_zonemgr_t *zmgr, dns_zone_t **first); /*%< * Find the first zone in the list of managed zones. * * Requires: *\li 'zonemgr' to be valid *\li The zone manager for the indicated zone MUST be locked * by the caller. This is not checked. *\li 'first' be non-NULL, and '*first' be NULL * * Ensures: *\li 'first' points to a valid zone (result ISC_R_SUCCESS) or to NULL * (result ISC_R_NOMORE). */ isc_result_t dns_zone_setkeydirectory(dns_zone_t *zone, const char *directory); /*%< * Sets the name of the directory where private keys used for * online signing of dynamic zones are found. * * Require: *\li 'zone' to be a valid zone. * * Returns: *\li #ISC_R_NOMEMORY *\li #ISC_R_SUCCESS */ const char * dns_zone_getkeydirectory(dns_zone_t *zone); /*%< * Gets the name of the directory where private keys used for * online signing of dynamic zones are found. * * Requires: *\li 'zone' to be valid initialised zone. * * Returns: * Pointer to null-terminated file name, or NULL. */ isc_result_t dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr, isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr, dns_zonemgr_t **zmgrp); /*%< * Create a zone manager. Note: the zone manager will not be able to * manage any zones until dns_zonemgr_setsize() has been run. * * Requires: *\li 'mctx' to be a valid memory context. *\li 'taskmgr' to be a valid task manager. *\li 'timermgr' to be a valid timer manager. *\li 'zmgrp' to point to a NULL pointer. */ isc_result_t dns_zonemgr_setsize(dns_zonemgr_t *zmgr, int num_zones); /*%< * Set the size of the zone manager task pool. This must be run * before zmgr can be used for managing zones. Currently, it can only * be run once; the task pool cannot be resized. * * Requires: *\li zmgr is a valid zone manager. *\li zmgr->zonetasks has been initialized. */ isc_result_t dns_zonemgr_createzone(dns_zonemgr_t *zmgr, dns_zone_t **zonep); /*%< * Allocate a new zone using a memory context from the * zone manager's memory context pool. * * Require: *\li 'zmgr' to be a valid zone manager. *\li 'zonep' != NULL and '*zonep' == NULL. */ isc_result_t dns_zonemgr_managezone(dns_zonemgr_t *zmgr, dns_zone_t *zone); /*%< * Bring the zone under control of a zone manager. * * Require: *\li 'zmgr' to be a valid zone manager. *\li 'zone' to be a valid zone. */ isc_result_t dns_zonemgr_forcemaint(dns_zonemgr_t *zmgr); /*%< * Force zone maintenance of all loaded zones managed by 'zmgr' * to take place at the system's earliest convenience. */ void dns__zonemgr_run(isc_task_t *task, isc_event_t *event); /*%< * Event handler to call dns_zonemgr_forcemaint(); used to start * zone operations from a unit test. Not intended for use outside * libdns or related tests. */ void dns_zonemgr_resumexfrs(dns_zonemgr_t *zmgr); /*%< * Attempt to start any stalled zone transfers. */ void dns_zonemgr_shutdown(dns_zonemgr_t *zmgr); /*%< * Shut down the zone manager. * * Requires: *\li 'zmgr' to be a valid zone manager. */ void dns_zonemgr_attach(dns_zonemgr_t *source, dns_zonemgr_t **target); /*%< * Attach '*target' to 'source' incrementing its external * reference count. * * Require: *\li 'zone' to be a valid zone. *\li 'target' to be non NULL and '*target' to be NULL. */ void dns_zonemgr_detach(dns_zonemgr_t **zmgrp); /*%< * Detach from a zone manager. * * Requires: *\li '*zmgrp' is a valid, non-NULL zone manager pointer. * * Ensures: *\li '*zmgrp' is NULL. */ void dns_zonemgr_releasezone(dns_zonemgr_t *zmgr, dns_zone_t *zone); /*%< * Release 'zone' from the managed by 'zmgr'. 'zmgr' is implicitly * detached from 'zone'. * * Requires: *\li 'zmgr' to be a valid zone manager. *\li 'zone' to be a valid zone. *\li 'zmgr' == 'zone->zmgr' * * Ensures: *\li 'zone->zmgr' == NULL; */ void dns_zonemgr_settransfersin(dns_zonemgr_t *zmgr, isc_uint32_t value); /*%< * Set the maximum number of simultaneous transfers in allowed by * the zone manager. * * Requires: *\li 'zmgr' to be a valid zone manager. */ isc_uint32_t dns_zonemgr_getttransfersin(dns_zonemgr_t *zmgr); /*%< * Return the maximum number of simultaneous transfers in allowed. * * Requires: *\li 'zmgr' to be a valid zone manager. */ void dns_zonemgr_settransfersperns(dns_zonemgr_t *zmgr, isc_uint32_t value); /*%< * Set the number of zone transfers allowed per nameserver. * * Requires: *\li 'zmgr' to be a valid zone manager */ isc_uint32_t dns_zonemgr_getttransfersperns(dns_zonemgr_t *zmgr); /*%< * Return the number of transfers allowed per nameserver. * * Requires: *\li 'zmgr' to be a valid zone manager. */ void dns_zonemgr_setiolimit(dns_zonemgr_t *zmgr, isc_uint32_t iolimit); /*%< * Set the number of simultaneous file descriptors available for * reading and writing masterfiles. * * Requires: *\li 'zmgr' to be a valid zone manager. *\li 'iolimit' to be positive. */ isc_uint32_t dns_zonemgr_getiolimit(dns_zonemgr_t *zmgr); /*%< * Get the number of simultaneous file descriptors available for * reading and writing masterfiles. * * Requires: *\li 'zmgr' to be a valid zone manager. */ void dns_zonemgr_setnotifyrate(dns_zonemgr_t *zmgr, unsigned int value); /*%< * Set the number of NOTIFY requests sent per second. * * Requires: *\li 'zmgr' to be a valid zone manager */ void dns_zonemgr_setstartupnotifyrate(dns_zonemgr_t *zmgr, unsigned int value); /*%< * Set the number of startup NOTIFY requests sent per second. * * Requires: *\li 'zmgr' to be a valid zone manager */ void dns_zonemgr_setserialqueryrate(dns_zonemgr_t *zmgr, unsigned int value); /*%< * Set the number of SOA queries sent per second. * * Requires: *\li 'zmgr' to be a valid zone manager */ unsigned int dns_zonemgr_getnotifyrate(dns_zonemgr_t *zmgr); /*%< * Return the number of NOTIFY requests sent per second. * * Requires: *\li 'zmgr' to be a valid zone manager. */ unsigned int dns_zonemgr_getstartupnotifyrate(dns_zonemgr_t *zmgr); /*%< * Return the number of startup NOTIFY requests sent per second. * * Requires: *\li 'zmgr' to be a valid zone manager. */ unsigned int dns_zonemgr_getserialqueryrate(dns_zonemgr_t *zmgr); /*%< * Return the number of SOA queries sent per second. * * Requires: *\li 'zmgr' to be a valid zone manager. */ unsigned int dns_zonemgr_getcount(dns_zonemgr_t *zmgr, int state); /*%< * Returns the number of zones in the specified state. * * Requires: *\li 'zmgr' to be a valid zone manager. *\li 'state' to be a valid DNS_ZONESTATE_ constant. */ void dns_zonemgr_unreachableadd(dns_zonemgr_t *zmgr, isc_sockaddr_t *remote, isc_sockaddr_t *local, isc_time_t *now); /*%< * Add the pair of addresses to the unreachable cache. * * Requires: *\li 'zmgr' to be a valid zone manager. *\li 'remote' to be a valid sockaddr. *\li 'local' to be a valid sockaddr. */ isc_boolean_t dns_zonemgr_unreachable(dns_zonemgr_t *zmgr, isc_sockaddr_t *remote, isc_sockaddr_t *local, isc_time_t *now); /*%< * Returns ISC_TRUE if the given local/remote address pair * is found in the zone maanger's unreachable cache. * * Requires: *\li 'zmgr' to be a valid zone manager. *\li 'remote' to be a valid sockaddr. *\li 'local' to be a valid sockaddr. *\li 'now' != NULL */ void dns_zonemgr_unreachabledel(dns_zonemgr_t *zmgr, isc_sockaddr_t *remote, isc_sockaddr_t *local); /*%< * Remove the pair of addresses from the unreachable cache. * * Requires: *\li 'zmgr' to be a valid zone manager. *\li 'remote' to be a valid sockaddr. *\li 'local' to be a valid sockaddr. */ void dns_zone_forcereload(dns_zone_t *zone); /*%< * Force a reload of specified zone. * * Requires: *\li 'zone' to be a valid zone. */ isc_boolean_t dns_zone_isforced(dns_zone_t *zone); /*%< * Check if the zone is waiting a forced reload. * * Requires: * \li 'zone' to be a valid zone. */ isc_result_t dns_zone_setstatistics(dns_zone_t *zone, isc_boolean_t on); /*%< * This function is obsoleted by dns_zone_setrequeststats(). */ isc_uint64_t * dns_zone_getstatscounters(dns_zone_t *zone); /*%< * This function is obsoleted by dns_zone_getrequeststats(). */ void dns_zone_setstats(dns_zone_t *zone, isc_stats_t *stats); /*%< * Set a general zone-maintenance statistics set 'stats' for 'zone'. This * function is expected to be called only on zone creation (when necessary). * Once installed, it cannot be removed or replaced. Also, there is no * interface to get the installed stats from the zone; the caller must keep the * stats to reference (e.g. dump) it later. * * Requires: * \li 'zone' to be a valid zone and does not have a statistics set already * installed. * *\li stats is a valid statistics supporting zone statistics counters * (see dns/stats.h). */ void dns_zone_setrequeststats(dns_zone_t *zone, isc_stats_t *stats); void dns_zone_setrcvquerystats(dns_zone_t *zone, dns_stats_t *stats); /*%< * Set additional statistics sets to zone. These are attached to the zone * but are not counted in the zone module; only the caller updates the * counters. * * Requires: * \li 'zone' to be a valid zone. * *\li stats is a valid statistics. */ isc_stats_t * dns_zone_getrequeststats(dns_zone_t *zone); dns_stats_t * dns_zone_getrcvquerystats(dns_zone_t *zone); /*%< * Get the additional statistics for zone, if one is installed. * * Requires: * \li 'zone' to be a valid zone. * * Returns: * \li when available, a pointer to the statistics set installed in zone; * otherwise NULL. */ void dns_zone_dialup(dns_zone_t *zone); /*%< * Perform dialup-time maintenance on 'zone'. */ void dns_zone_setdialup(dns_zone_t *zone, dns_dialuptype_t dialup); /*%< * Set the dialup type of 'zone' to 'dialup'. * * Requires: * \li 'zone' to be valid initialised zone. *\li 'dialup' to be a valid dialup type. */ void dns_zone_logv(dns_zone_t *zone, isc_logcategory_t *category, int level, const char *prefix, const char *msg, va_list ap); /*%< * Log the message 'msg...' at 'level' using log category 'category', including * text that identifies the message as applying to 'zone'. If the (optional) * 'prefix' is not NULL, it will be placed at the start of the entire log line. */ void dns_zone_log(dns_zone_t *zone, int level, const char *msg, ...) ISC_FORMAT_PRINTF(3, 4); /*%< * Log the message 'msg...' at 'level', including text that identifies * the message as applying to 'zone'. */ void dns_zone_logc(dns_zone_t *zone, isc_logcategory_t *category, int level, const char *msg, ...) ISC_FORMAT_PRINTF(4, 5); /*%< * Log the message 'msg...' at 'level', including text that identifies * the message as applying to 'zone'. */ void dns_zone_name(dns_zone_t *zone, char *buf, size_t len); /*%< * Return the name of the zone with class and view. * * Requires: *\li 'zone' to be valid. *\li 'buf' to be non NULL. */ void dns_zone_nameonly(dns_zone_t *zone, char *buf, size_t len); /*%< * Return the name of the zone only. * * Requires: *\li 'zone' to be valid. *\li 'buf' to be non NULL. */ isc_result_t dns_zone_checknames(dns_zone_t *zone, dns_name_t *name, dns_rdata_t *rdata); /*%< * Check if this record meets the check-names policy. * * Requires: * 'zone' to be valid. * 'name' to be valid. * 'rdata' to be valid. * * Returns: * DNS_R_SUCCESS passed checks. * DNS_R_BADOWNERNAME failed ownername checks. * DNS_R_BADNAME failed rdata checks. */ void dns_zone_setacache(dns_zone_t *zone, dns_acache_t *acache); /*%< * Associate the zone with an additional cache. * * Require: * 'zone' to be a valid zone. * 'acache' to be a non NULL pointer. * * Ensures: * 'zone' will have a reference to 'acache' */ void dns_zone_setcheckmx(dns_zone_t *zone, dns_checkmxfunc_t checkmx); /*%< * Set the post load integrity callback function 'checkmx'. * 'checkmx' will be called if the MX TARGET is not within the zone. * * Require: * 'zone' to be a valid zone. */ void dns_zone_setchecksrv(dns_zone_t *zone, dns_checkmxfunc_t checksrv); /*%< * Set the post load integrity callback function 'checksrv'. * 'checksrv' will be called if the SRV TARGET is not within the zone. * * Require: * 'zone' to be a valid zone. */ void dns_zone_setcheckns(dns_zone_t *zone, dns_checknsfunc_t checkns); /*%< * Set the post load integrity callback function 'checkns'. * 'checkns' will be called if the NS TARGET is not within the zone. * * Require: * 'zone' to be a valid zone. */ void dns_zone_setnotifydelay(dns_zone_t *zone, isc_uint32_t delay); /*%< * Set the minimum delay between sets of notify messages. * * Requires: * 'zone' to be valid. */ isc_uint32_t dns_zone_getnotifydelay(dns_zone_t *zone); /*%< * Get the minimum delay between sets of notify messages. * * Requires: * 'zone' to be valid. */ void dns_zone_setisself(dns_zone_t *zone, dns_isselffunc_t isself, void *arg); /*%< * Set the isself callback function and argument. * * isc_boolean_t * isself(dns_view_t *myview, dns_tsigkey_t *mykey, isc_netaddr_t *srcaddr, * isc_netaddr_t *destaddr, dns_rdataclass_t rdclass, void *arg); * * 'isself' returns ISC_TRUE if a non-recursive query from 'srcaddr' to * 'destaddr' with optional key 'mykey' for class 'rdclass' would be * delivered to 'myview'. */ void dns_zone_setnodes(dns_zone_t *zone, isc_uint32_t nodes); /*%< * Set the number of nodes that will be checked per quantum. */ void dns_zone_setsignatures(dns_zone_t *zone, isc_uint32_t signatures); /*%< * Set the number of signatures that will be generated per quantum. */ isc_uint32_t dns_zone_getsignatures(dns_zone_t *zone); /*%< * Get the number of signatures that will be generated per quantum. */ isc_result_t dns_zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm, isc_uint16_t keyid, isc_boolean_t deleteit); /*%< * Initiate/resume signing of the entire zone with the zone DNSKEY(s) * that match the given algorithm and keyid. */ isc_result_t dns_zone_addnsec3chain(dns_zone_t *zone, dns_rdata_nsec3param_t *nsec3param); /*%< * Incrementally add a NSEC3 chain that corresponds to 'nsec3param'. */ void dns_zone_setprivatetype(dns_zone_t *zone, dns_rdatatype_t type); dns_rdatatype_t dns_zone_getprivatetype(dns_zone_t *zone); /* * Get/Set the private record type. It is expected that these interfaces * will not be permanent. */ void dns_zone_rekey(dns_zone_t *zone, isc_boolean_t fullsign); /*%< * Update the zone's DNSKEY set from the key repository. * * If 'fullsign' is true, trigger an immediate full signing of * the zone with the new key. Otherwise, if there are no keys or * if the new keys are for algorithms that have already signed the * zone, then the zone can be re-signed incrementally. */ isc_result_t dns_zone_nscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version, unsigned int *errors); /*% * Check if the name servers for the zone are sane (have address, don't * refer to CNAMEs/DNAMEs. The number of constiancy errors detected in * returned in '*errors' * * Requires: * \li 'zone' to be valid. * \li 'db' to be valid. * \li 'version' to be valid or NULL. * \li 'errors' to be non NULL. * * Returns: * ISC_R_SUCCESS if there were no errors examining the zone contents. */ isc_result_t dns_zone_cdscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version); /*% * Check if CSD, CDNSKEY and DNSKEY are consistent. * * Requires: * \li 'zone' to be valid. * \li 'db' to be valid. * \li 'version' to be valid or NULL. * * Returns: *\li #ISC_R_SUCCESS *\li #DNS_R_BADCDS *\li #DNS_R_BADCDNSKEY * Others */ void dns_zone_setadded(dns_zone_t *zone, isc_boolean_t added); /*% * Sets the value of zone->added, which should be ISC_TRUE for * zones that were originally added by "rndc addzone". * * Requires: * \li 'zone' to be valid. */ isc_boolean_t dns_zone_getadded(dns_zone_t *zone); /*% * Returns ISC_TRUE if the zone was originally added at runtime * using "rndc addzone". * * Requires: * \li 'zone' to be valid. */ void dns_zone_setautomatic(dns_zone_t *zone, isc_boolean_t automatic); /*% * Sets the value of zone->automatic, which should be ISC_TRUE for * zones that were automatically added by named. * * Requires: * \li 'zone' to be valid. */ isc_boolean_t dns_zone_getautomatic(dns_zone_t *zone); /*% * Returns ISC_TRUE if the zone was added automatically by named. * * Requires: * \li 'zone' to be valid. */ isc_result_t dns_zone_dlzpostload(dns_zone_t *zone, dns_db_t *db); /*% * Load the origin names for a writeable DLZ database. */ isc_boolean_t dns_zone_isdynamic(dns_zone_t *zone, isc_boolean_t ignore_freeze); /*% * Return true iff the zone is "dynamic", in the sense that the zone's * master file (if any) is written by the server, rather than being * updated manually and read by the server. * * This is true for slave zones, stub zones, key zones, and zones that * allow dynamic updates either by having an update policy ("ssutable") * or an "allow-update" ACL with a value other than exactly "{ none; }". * * If 'ignore_freeze' is true, then the zone which has had updates disabled * will still report itself to be dynamic. * * Requires: * \li 'zone' to be valid. */ isc_result_t dns_zone_setrefreshkeyinterval(dns_zone_t *zone, isc_uint32_t interval); /*% * Sets the frequency, in minutes, with which the key repository will be * checked to see if the keys for this zone have been updated. Any value * higher than 1440 minutes (24 hours) will be silently reduced. A * value of zero will return an out-of-range error. * * Requires: * \li 'zone' to be valid. */ isc_boolean_t dns_zone_getrequestexpire(dns_zone_t *zone); /*% * Returns the true/false value of the request-expire option in the zone. * * Requires: * \li 'zone' to be valid. */ void dns_zone_setrequestexpire(dns_zone_t *zone, isc_boolean_t flag); /*% * Sets the request-expire option for the zone. Either true or false. The * default value is determined by the setting of this option in the view. * * Requires: * \li 'zone' to be valid. */ isc_boolean_t dns_zone_getrequestixfr(dns_zone_t *zone); /*% * Returns the true/false value of the request-ixfr option in the zone. * * Requires: * \li 'zone' to be valid. */ void dns_zone_setrequestixfr(dns_zone_t *zone, isc_boolean_t flag); /*% * Sets the request-ixfr option for the zone. Either true or false. The * default value is determined by the setting of this option in the view. * * Requires: * \li 'zone' to be valid. */ void dns_zone_setserialupdatemethod(dns_zone_t *zone, dns_updatemethod_t method); /*% * Sets the update method to use when incrementing the zone serial number * due to a DDNS update. Valid options are dns_updatemethod_increment * and dns_updatemethod_unixtime. * * Requires: * \li 'zone' to be valid. */ dns_updatemethod_t dns_zone_getserialupdatemethod(dns_zone_t *zone); /*% * Returns the update method to be used when incrementing the zone serial * number due to a DDNS update. * * Requires: * \li 'zone' to be valid. */ isc_result_t dns_zone_link(dns_zone_t *zone, dns_zone_t *raw); void dns_zone_getraw(dns_zone_t *zone, dns_zone_t **raw); isc_result_t dns_zone_keydone(dns_zone_t *zone, const char *data); isc_result_t dns_zone_setnsec3param(dns_zone_t *zone, isc_uint8_t hash, isc_uint8_t flags, isc_uint16_t iter, isc_uint8_t saltlen, unsigned char *salt, isc_boolean_t replace); /*% * Set the NSEC3 parameters for the zone. * * If 'replace' is ISC_TRUE, then the existing NSEC3 chain, if any, will * be replaced with the new one. If 'hash' is zero, then the replacement * chain will be NSEC rather than NSEC3. * * Requires: * \li 'zone' to be valid. */ void dns_zone_setrawdata(dns_zone_t *zone, dns_masterrawheader_t *header); /*% * Set the data to be included in the header when the zone is dumped in * binary format. */ isc_result_t dns_zone_synckeyzone(dns_zone_t *zone); /*% * Force the managed key zone to synchronize, and start the key * maintenance timer. */ isc_result_t dns_zone_getloadtime(dns_zone_t *zone, isc_time_t *loadtime); /*% * Return the time when the zone was last loaded. */ isc_result_t dns_zone_getrefreshtime(dns_zone_t *zone, isc_time_t *refreshtime); /*% * Return the time when the (slave) zone will need to be refreshed. */ isc_result_t dns_zone_getexpiretime(dns_zone_t *zone, isc_time_t *expiretime); /*% * Return the time when the (slave) zone will expire. */ isc_result_t dns_zone_getrefreshkeytime(dns_zone_t *zone, isc_time_t *refreshkeytime); /*% * Return the time of the next scheduled DNSSEC key event. */ unsigned int dns_zone_getincludes(dns_zone_t *zone, char ***includesp); /*% * Return the number include files that were encountered * during load. If the number is greater than zero, 'includesp' * will point to an array containing the filenames. * * The array and its contents need to be freed using isc_mem_free. */ isc_result_t dns_zone_rpz_enable(dns_zone_t *zone, dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num); /*% * Set the response policy associated with a zone. */ void dns_zone_rpz_enable_db(dns_zone_t *zone, dns_db_t *db); /*% * If a zone is a response policy zone, mark its new database. */ dns_rpz_num_t dns_zone_get_rpz_num(dns_zone_t *zone); void dns_zone_catz_enable(dns_zone_t *zone, dns_catz_zones_t *catzs); /*%< * Enable zone as catalog zone. * * Requires: * * \li 'zone' is a valid zone object * \li 'catzs' is not NULL * \li prior to calling, zone->catzs is NULL or is equal to 'catzs' */ void dns_zone_catz_enable_db(dns_zone_t *zone, dns_db_t *db); /*%< * If 'zone' is a catalog zone, then set up a notify-on-update trigger * in its database. (If not a catalog zone, this function has no effect.) * * Requires: * * \li 'zone' is a valid zone object * \li 'db' is not NULL */ void dns_zone_set_parentcatz(dns_zone_t *zone, dns_catz_zone_t *catz); /*%< * Set parent catalog zone for this zone * * Requires: * * \li 'zone' is a valid zone object * \li 'catz' is not NULL */ dns_catz_zone_t * dns_zone_get_parentcatz(const dns_zone_t *zone); /*%< * Get parent catalog zone for this zone * * Requires: * * \li 'zone' is a valid zone object */ void dns_zone_setstatlevel(dns_zone_t *zone, dns_zonestat_level_t level); dns_zonestat_level_t dns_zone_getstatlevel(dns_zone_t *zone); /*% * Set and get the statistics reporting level for the zone; * full, terse, or none. */ isc_result_t dns_zone_setserial(dns_zone_t *zone, isc_uint32_t serial); /*% * Set the zone's serial to 'serial'. */ ISC_LANG_ENDDECLS #endif /* DNS_ZONE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/resolver.h��������������������������������������������������������������������������������0000644�����������������00000045210�14763166026�0010364 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_RESOLVER_H #define DNS_RESOLVER_H 1 /***** ***** Module Info *****/ /*! \file dns/resolver.h * * \brief * This is the BIND 9 resolver, the module responsible for resolving DNS * requests by iteratively querying authoritative servers and following * referrals. This is a "full resolver", not to be confused with * the stub resolvers most people associate with the word "resolver". * The full resolver is part of the caching name server or resolver * daemon the stub resolver talks to. * * MP: *\li The module ensures appropriate synchronization of data structures it * creates and manipulates. * * Reliability: *\li No anticipated impact. * * Resources: *\li TBS * * Security: *\li No anticipated impact. * * Standards: *\li RFCs: 1034, 1035, 2181, TBS *\li Drafts: TBS */ #include <isc/lang.h> #include <isc/socket.h> #include <isc/stats.h> #include <dns/types.h> #include <dns/fixedname.h> ISC_LANG_BEGINDECLS /*% * A dns_fetchevent_t is sent when a 'fetch' completes. Any of 'db', * 'node', 'rdataset', and 'sigrdataset' may be bound. It is the * receiver's responsibility to detach before freeing the event. * \brief * 'rdataset', 'sigrdataset', 'client' and 'id' are the values that were * supplied when dns_resolver_createfetch() was called. They are returned * to the caller so that they may be freed. */ typedef struct dns_fetchevent { ISC_EVENT_COMMON(struct dns_fetchevent); dns_fetch_t * fetch; isc_result_t result; dns_rdatatype_t qtype; dns_db_t * db; dns_dbnode_t * node; dns_rdataset_t * rdataset; dns_rdataset_t * sigrdataset; dns_fixedname_t foundname; isc_sockaddr_t * client; dns_messageid_t id; isc_result_t vresult; } dns_fetchevent_t; /*% * The two quota types (fetches-per-zone and fetches-per-server) */ typedef enum { dns_quotatype_zone = 0, dns_quotatype_server } dns_quotatype_t; /* * Options that modify how a 'fetch' is done. */ #define DNS_FETCHOPT_TCP 0x00001 /*%< Use TCP. */ #define DNS_FETCHOPT_UNSHARED 0x00002 /*%< See below. */ #define DNS_FETCHOPT_RECURSIVE 0x00004 /*%< Set RD? */ #define DNS_FETCHOPT_NOEDNS0 0x00008 /*%< Do not use EDNS. */ #define DNS_FETCHOPT_FORWARDONLY 0x00010 /*%< Only use forwarders. */ #define DNS_FETCHOPT_NOVALIDATE 0x00020 /*%< Disable validation. */ #define DNS_FETCHOPT_EDNS512 0x00040 /*%< Advertise a 512 byte 0 UDP buffer. */ #define DNS_FETCHOPT_WANTNSID 0x00080 /*%< Request NSID */ #define DNS_FETCHOPT_PREFETCH 0x00100 /*%< Do prefetch */ #define DNS_FETCHOPT_NOCDFLAG 0x00200 /*%< Don't set CD flag. */ #define DNS_FETCHOPT_NONTA 0x00400 /*%< Ignore NTA table. */ /* RESERVED ECS 0x00000 */ /* RESERVED ECS 0x01000 */ /* RESERVED ECS 0x02000 */ /* RESERVED TCPCLIENT 0x04000 */ #define DNS_FETCHOPT_NOCACHED 0x08000 /*%< Force cache update. */ #define DNS_FETCHOPT_NOFORWARD 0x80000 /*%< Do not use forwarders if possible. */ /* Reserved in use by adb.c 0x00400000 */ #define DNS_FETCHOPT_EDNSVERSIONSET 0x00800000 #define DNS_FETCHOPT_EDNSVERSIONMASK 0xff000000 #define DNS_FETCHOPT_EDNSVERSIONSHIFT 24 /* * Upper bounds of class of query RTT (ms). Corresponds to * dns_resstatscounter_queryrttX statistics counters. */ #define DNS_RESOLVER_QRYRTTCLASS0 10 #define DNS_RESOLVER_QRYRTTCLASS0STR "10" #define DNS_RESOLVER_QRYRTTCLASS1 100 #define DNS_RESOLVER_QRYRTTCLASS1STR "100" #define DNS_RESOLVER_QRYRTTCLASS2 500 #define DNS_RESOLVER_QRYRTTCLASS2STR "500" #define DNS_RESOLVER_QRYRTTCLASS3 800 #define DNS_RESOLVER_QRYRTTCLASS3STR "800" #define DNS_RESOLVER_QRYRTTCLASS4 1600 #define DNS_RESOLVER_QRYRTTCLASS4STR "1600" /* * XXXRTH Should this API be made semi-private? (I.e. * _dns_resolver_create()). */ #define DNS_RESOLVER_CHECKNAMES 0x01 #define DNS_RESOLVER_CHECKNAMESFAIL 0x02 isc_result_t dns_resolver_create(dns_view_t *view, isc_taskmgr_t *taskmgr, unsigned int ntasks, unsigned int ndisp, isc_socketmgr_t *socketmgr, isc_timermgr_t *timermgr, unsigned int options, dns_dispatchmgr_t *dispatchmgr, dns_dispatch_t *dispatchv4, dns_dispatch_t *dispatchv6, dns_resolver_t **resp); /*%< * Create a resolver. * * Notes: * *\li Generally, applications should not create a resolver directly, but * should instead call dns_view_createresolver(). * * Requires: * *\li 'view' is a valid view. * *\li 'taskmgr' is a valid task manager. * *\li 'ntasks' > 0. * *\li 'socketmgr' is a valid socket manager. * *\li 'timermgr' is a valid timer manager. * *\li 'dispatchv4' is a dispatch with an IPv4 UDP socket, or is NULL. * If not NULL, 'ndisp' clones of it will be created by the resolver. * *\li 'dispatchv6' is a dispatch with an IPv6 UDP socket, or is NULL. * If not NULL, 'ndisp' clones of it will be created by the resolver. * *\li resp != NULL && *resp == NULL. * * Returns: * *\li #ISC_R_SUCCESS On success. * *\li Anything else Failure. */ void dns_resolver_freeze(dns_resolver_t *res); /*%< * Freeze resolver. * * Notes: * *\li Certain configuration changes cannot be made after the resolver * is frozen. Fetches cannot be created until the resolver is frozen. * * Requires: * *\li 'res' is a valid resolver. * * Ensures: * *\li 'res' is frozen. */ void dns_resolver_prime(dns_resolver_t *res); /*%< * Prime resolver. * * Notes: * *\li Resolvers which have a forwarding policy other than dns_fwdpolicy_only * need to be primed with the root nameservers, otherwise the root * nameserver hints data may be used indefinitely. This function requests * that the resolver start a priming fetch, if it isn't already priming. * * Requires: * *\li 'res' is a valid, frozen resolver. */ void dns_resolver_whenshutdown(dns_resolver_t *res, isc_task_t *task, isc_event_t **eventp); /*%< * Send '*eventp' to 'task' when 'res' has completed shutdown. * * Notes: * *\li It is not safe to detach the last reference to 'res' until * shutdown is complete. * * Requires: * *\li 'res' is a valid resolver. * *\li 'task' is a valid task. * *\li *eventp is a valid event. * * Ensures: * *\li *eventp == NULL. */ void dns_resolver_shutdown(dns_resolver_t *res); /*%< * Start the shutdown process for 'res'. * * Notes: * *\li This call has no effect if the resolver is already shutting down. * * Requires: * *\li 'res' is a valid resolver. */ void dns_resolver_attach(dns_resolver_t *source, dns_resolver_t **targetp); void dns_resolver_detach(dns_resolver_t **resp); isc_result_t dns_resolver_createfetch(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type, dns_name_t *domain, dns_rdataset_t *nameservers, dns_forwarders_t *forwarders, unsigned int options, isc_task_t *task, isc_taskaction_t action, void *arg, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, dns_fetch_t **fetchp); isc_result_t dns_resolver_createfetch2(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type, dns_name_t *domain, dns_rdataset_t *nameservers, dns_forwarders_t *forwarders, isc_sockaddr_t *client, isc_uint16_t id, unsigned int options, isc_task_t *task, isc_taskaction_t action, void *arg, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, dns_fetch_t **fetchp); isc_result_t dns_resolver_createfetch3(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type, dns_name_t *domain, dns_rdataset_t *nameservers, dns_forwarders_t *forwarders, isc_sockaddr_t *client, isc_uint16_t id, unsigned int options, unsigned int depth, isc_counter_t *qc, isc_task_t *task, isc_taskaction_t action, void *arg, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, dns_fetch_t **fetchp); /*%< * Recurse to answer a question. * * Notes: * *\li This call starts a query for 'name', type 'type'. * *\li The 'domain' is a parent domain of 'name' for which * a set of name servers 'nameservers' is known. If no * such name server information is available, set * 'domain' and 'nameservers' to NULL. * *\li 'forwarders' is unimplemented, and subject to change when * we figure out how selective forwarding will work. * *\li When the fetch completes (successfully or otherwise), a * #DNS_EVENT_FETCHDONE event with action 'action' and arg 'arg' will be * posted to 'task'. * *\li The values of 'rdataset' and 'sigrdataset' will be returned in * the FETCHDONE event. * *\li 'client' and 'id' are used for duplicate query detection. '*client' * must remain stable until after 'action' has been called or * dns_resolver_cancelfetch() is called. * * Requires: * *\li 'res' is a valid resolver that has been frozen. * *\li 'name' is a valid name. * *\li 'type' is not a meta type other than ANY. * *\li 'domain' is a valid name or NULL. * *\li 'nameservers' is a valid NS rdataset (whose owner name is 'domain') * iff. 'domain' is not NULL. * *\li 'forwarders' is NULL. * *\li 'client' is a valid sockaddr or NULL. * *\li 'options' contains valid options. * *\li 'rdataset' is a valid, disassociated rdataset. * *\li 'sigrdataset' is NULL, or is a valid, disassociated rdataset. * *\li fetchp != NULL && *fetchp == NULL. * * Returns: * *\li #ISC_R_SUCCESS Success *\li #DNS_R_DUPLICATE *\li #DNS_R_DROP * *\li Many other values are possible, all of which indicate failure. */ void dns_resolver_cancelfetch(dns_fetch_t *fetch); /*%< * Cancel 'fetch'. * * Notes: * *\li If 'fetch' has not completed, post its FETCHDONE event with a * result code of #ISC_R_CANCELED. * * Requires: * *\li 'fetch' is a valid fetch. */ void dns_resolver_destroyfetch(dns_fetch_t **fetchp); /*%< * Destroy 'fetch'. * * Requires: * *\li '*fetchp' is a valid fetch. * *\li The caller has received the FETCHDONE event (either because the * fetch completed or because dns_resolver_cancelfetch() was called). * * Ensures: * *\li *fetchp == NULL. */ void dns_resolver_logfetch(dns_fetch_t *fetch, isc_log_t *lctx, isc_logcategory_t *category, isc_logmodule_t *module, int level, isc_boolean_t duplicateok); /*%< * Dump a log message on internal state at the completion of given 'fetch'. * 'lctx', 'category', 'module', and 'level' are used to write the log message. * By default, only one log message is written even if the corresponding fetch * context serves multiple clients; if 'duplicateok' is true the suppression * is disabled and the message can be written every time this function is * called. * * Requires: * *\li 'fetch' is a valid fetch, and has completed. */ dns_dispatchmgr_t * dns_resolver_dispatchmgr(dns_resolver_t *resolver); dns_dispatch_t * dns_resolver_dispatchv4(dns_resolver_t *resolver); dns_dispatch_t * dns_resolver_dispatchv6(dns_resolver_t *resolver); isc_socketmgr_t * dns_resolver_socketmgr(dns_resolver_t *resolver); isc_taskmgr_t * dns_resolver_taskmgr(dns_resolver_t *resolver); isc_uint32_t dns_resolver_getlamettl(dns_resolver_t *resolver); /*%< * Get the resolver's lame-ttl. zero => no lame processing. * * Requires: *\li 'resolver' to be valid. */ void dns_resolver_setlamettl(dns_resolver_t *resolver, isc_uint32_t lame_ttl); /*%< * Set the resolver's lame-ttl. zero => no lame processing. * * Requires: *\li 'resolver' to be valid. */ unsigned int dns_resolver_nrunning(dns_resolver_t *resolver); /*%< * Return the number of currently running resolutions in this * resolver. This is may be less than the number of outstanding * fetches due to multiple identical fetches, or more than the * number of of outstanding fetches due to the fact that resolution * can continue even though a fetch has been canceled. */ isc_result_t dns_resolver_addalternate(dns_resolver_t *resolver, isc_sockaddr_t *alt, dns_name_t *name, in_port_t port); /*%< * Add alternate addresses to be tried in the event that the nameservers * for a zone are not available in the address families supported by the * operating system. * * Require: * \li only one of 'name' or 'alt' to be valid. */ void dns_resolver_setudpsize(dns_resolver_t *resolver, isc_uint16_t udpsize); /*%< * Set the EDNS UDP buffer size advertised by the server. */ isc_uint16_t dns_resolver_getudpsize(dns_resolver_t *resolver); /*%< * Get the current EDNS UDP buffer size. */ void dns_resolver_reset_algorithms(dns_resolver_t *resolver); /*%< * Clear the disabled DNSSEC algorithms. */ void dns_resolver_reset_ds_digests(dns_resolver_t *resolver); /*%< * Clear the disabled DS/DLV digest types. */ isc_result_t dns_resolver_disable_algorithm(dns_resolver_t *resolver, dns_name_t *name, unsigned int alg); /*%< * Mark the given DNSSEC algorithm as disabled and below 'name'. * Valid algorithms are less than 256. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_RANGE *\li #ISC_R_NOMEMORY */ isc_result_t dns_resolver_disable_ds_digest(dns_resolver_t *resolver, dns_name_t *name, unsigned int digest_type); /*%< * Mark the given DS/DLV digest type as disabled and below 'name'. * Valid types are less than 256. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_RANGE *\li #ISC_R_NOMEMORY */ isc_boolean_t dns_resolver_algorithm_supported(dns_resolver_t *resolver, dns_name_t *name, unsigned int alg); /*%< * Check if the given algorithm is supported by this resolver. * This checks whether the algorithm has been disabled via * dns_resolver_disable_algorithm(), then checks the underlying * crypto libraries if it was not specifically disabled. */ isc_boolean_t dns_resolver_ds_digest_supported(dns_resolver_t *resolver, dns_name_t *name, unsigned int digest_type); /*%< * Check if the given digest type is supported by this resolver. * This checks whether the digest type has been disabled via * dns_resolver_disable_ds_digest(), then checks the underlying * crypto libraries if it was not specifically disabled. */ void dns_resolver_resetmustbesecure(dns_resolver_t *resolver); isc_result_t dns_resolver_setmustbesecure(dns_resolver_t *resolver, dns_name_t *name, isc_boolean_t value); isc_boolean_t dns_resolver_getmustbesecure(dns_resolver_t *resolver, dns_name_t *name); void dns_resolver_settimeout(dns_resolver_t *resolver, unsigned int seconds); /*%< * Set the length of time the resolver will work on a query, in seconds. * * If timeout is 0, the default timeout will be applied. * * Requires: * \li resolver to be valid. */ unsigned int dns_resolver_gettimeout(dns_resolver_t *resolver); /*%< * Get the current length of time the resolver will work on a query, in seconds. * * Requires: * \li resolver to be valid. */ void dns_resolver_setclientsperquery(dns_resolver_t *resolver, isc_uint32_t min, isc_uint32_t max); void dns_resolver_setfetchesperzone(dns_resolver_t *resolver, isc_uint32_t clients); void dns_resolver_getclientsperquery(dns_resolver_t *resolver, isc_uint32_t *cur, isc_uint32_t *min, isc_uint32_t *max); isc_boolean_t dns_resolver_getzeronosoattl(dns_resolver_t *resolver); void dns_resolver_setzeronosoattl(dns_resolver_t *resolver, isc_boolean_t state); unsigned int dns_resolver_getoptions(dns_resolver_t *resolver); void dns_resolver_addbadcache(dns_resolver_t *resolver, dns_name_t *name, dns_rdatatype_t type, isc_time_t *expire); /*%< * Add a entry to the bad cache for <name,type> that will expire at 'expire'. * * Requires: * \li resolver to be valid. * \li name to be valid. */ isc_boolean_t dns_resolver_getbadcache(dns_resolver_t *resolver, dns_name_t *name, dns_rdatatype_t type, isc_time_t *now); /*%< * Check to see if there is a unexpired entry in the bad cache for * <name,type>. * * Requires: * \li resolver to be valid. * \li name to be valid. */ void dns_resolver_flushbadcache(dns_resolver_t *resolver, dns_name_t *name); /*%< * Flush the bad cache of all entries at 'name' if 'name' is non NULL. * Flush the entire bad cache if 'name' is NULL. * * Requires: * \li resolver to be valid. */ void dns_resolver_flushbadnames(dns_resolver_t *resolver, dns_name_t *name); /*%< * Flush the bad cache of all entries at or below 'name'. * * Requires: * \li resolver to be valid. * \li name != NULL */ void dns_resolver_printbadcache(dns_resolver_t *resolver, FILE *fp); /*% * Print out the contents of the bad cache to 'fp'. * * Requires: * \li resolver to be valid. */ void dns_resolver_setquerydscp4(dns_resolver_t *resolver, isc_dscp_t dscp); isc_dscp_t dns_resolver_getquerydscp4(dns_resolver_t *resolver); void dns_resolver_setquerydscp6(dns_resolver_t *resolver, isc_dscp_t dscp); isc_dscp_t dns_resolver_getquerydscp6(dns_resolver_t *resolver); /*% * Get and set the DSCP values for the resolver's IPv4 and IPV6 query * sources. * * Requires: * \li resolver to be valid. */ void dns_resolver_setmaxdepth(dns_resolver_t *resolver, unsigned int maxdepth); unsigned int dns_resolver_getmaxdepth(dns_resolver_t *resolver); /*% * Get and set how many NS indirections will be followed when looking for * nameserver addresses. * * Requires: * \li resolver to be valid. */ void dns_resolver_setmaxqueries(dns_resolver_t *resolver, unsigned int queries); unsigned int dns_resolver_getmaxqueries(dns_resolver_t *resolver); /*% * Get and set how many iterative queries will be allowed before * terminating a recursive query. * * Requires: * \li resolver to be valid. */ void dns_resolver_setquotaresponse(dns_resolver_t *resolver, dns_quotatype_t which, isc_result_t resp); isc_result_t dns_resolver_getquotaresponse(dns_resolver_t *resolver, dns_quotatype_t which); /*% * Get and set the result code that will be used when quotas * are exceeded. If 'which' is set to quotatype "zone", then the * result specified in 'resp' will be used when the fetches-per-zone * quota is exceeded by a fetch. If 'which' is set to quotatype "server", * then the reuslt specified in 'resp' will be used when the * fetches-per-server quota has been exceeded for all the * authoritative servers for a zone. Valid choices are * DNS_R_DROP or DNS_R_SERVFAIL. * * Requires: * \li 'resolver' to be valid. * \li 'which' to be dns_quotatype_zone or dns_quotatype_server * \li 'resp' to be DNS_R_DROP or DNS_R_SERVFAIL. */ void dns_resolver_dumpfetches(dns_resolver_t *resolver, isc_statsformat_t format, FILE *fp); #ifdef ENABLE_AFL /*% * Enable fuzzing of resolver, changes behaviour and eliminates retries */ void dns_resolver_setfuzzing(void); #endif ISC_LANG_ENDDECLS #endif /* DNS_RESOLVER_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/iptable.h���������������������������������������������������������������������������������0000644�����������������00000003152�14763166026�0010142 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_IPTABLE_H #define DNS_IPTABLE_H 1 #include <isc/lang.h> #include <isc/magic.h> #include <isc/radix.h> #include <dns/types.h> struct dns_iptable { unsigned int magic; isc_mem_t *mctx; isc_refcount_t refcount; isc_radix_tree_t *radix; ISC_LINK(dns_iptable_t) nextincache; }; #define DNS_IPTABLE_MAGIC ISC_MAGIC('T','a','b','l') #define DNS_IPTABLE_VALID(a) ISC_MAGIC_VALID(a, DNS_IPTABLE_MAGIC) /*** *** Functions ***/ ISC_LANG_BEGINDECLS isc_result_t dns_iptable_create(isc_mem_t *mctx, dns_iptable_t **target); /* * Create a new IP table and the underlying radix structure */ isc_result_t dns_iptable_addprefix(dns_iptable_t *tab, isc_netaddr_t *addr, isc_uint16_t bitlen, isc_boolean_t pos); isc_result_t dns_iptable_addprefix2(dns_iptable_t *tab, isc_netaddr_t *addr, isc_uint16_t bitlen, isc_boolean_t pos, isc_boolean_t is_ecs); /* * Add an IP prefix to an existing IP table */ isc_result_t dns_iptable_merge(dns_iptable_t *tab, dns_iptable_t *source, isc_boolean_t pos); /* * Merge one IP table into another one. */ void dns_iptable_attach(dns_iptable_t *source, dns_iptable_t **target); void dns_iptable_detach(dns_iptable_t **tabp); ISC_LANG_ENDDECLS #endif /* DNS_IPTABLE_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/journal.h���������������������������������������������������������������������������������0000644�����������������00000020057�14763166026�0010177 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_JOURNAL_H #define DNS_JOURNAL_H 1 /***** ***** Module Info *****/ /*! \file dns/journal.h * \brief * Database journaling. */ /*** *** Imports ***/ #include <isc/lang.h> #include <isc/magic.h> #include <dns/name.h> #include <dns/diff.h> #include <dns/rdata.h> #include <dns/types.h> /*** *** Defines. ***/ #define DNS_JOURNALOPT_RESIGN 0x00000001 #define DNS_JOURNAL_READ 0x00000000 /* ISC_FALSE */ #define DNS_JOURNAL_CREATE 0x00000001 /* ISC_TRUE */ #define DNS_JOURNAL_WRITE 0x00000002 /*** *** Types ***/ /*% * A dns_journal_t represents an open journal file. This is an opaque type. * * A particular dns_journal_t object may be opened for writing, in which case * it can be used for writing transactions to a journal file, or it can be * opened for reading, in which case it can be used for reading transactions * from (iterating over) a journal file. A single dns_journal_t object may * not be used for both purposes. */ typedef struct dns_journal dns_journal_t; /*** *** Functions ***/ ISC_LANG_BEGINDECLS /**************************************************************************/ isc_result_t dns_db_createsoatuple(dns_db_t *db, dns_dbversion_t *ver, isc_mem_t *mctx, dns_diffop_t op, dns_difftuple_t **tp); /*!< brief * Create a diff tuple for the current database SOA. * XXX this probably belongs somewhere else. */ /*@{*/ #define DNS_SERIAL_GT(a, b) ((int)(((a) - (b)) & 0xFFFFFFFF) > 0) #define DNS_SERIAL_GE(a, b) ((int)(((a) - (b)) & 0xFFFFFFFF) >= 0) /*!< brief * Compare SOA serial numbers. DNS_SERIAL_GT(a, b) returns true iff * a is "greater than" b where "greater than" is as defined in RFC1982. * DNS_SERIAL_GE(a, b) returns true iff a is "greater than or equal to" b. */ /*@}*/ /**************************************************************************/ /* * Journal object creation and destruction. */ isc_result_t dns_journal_open(isc_mem_t *mctx, const char *filename, unsigned int mode, dns_journal_t **journalp); /*%< * Open the journal file 'filename' and create a dns_journal_t object for it. * * DNS_JOURNAL_CREATE open the journal for reading and writing and create * the journal if it does not exist. * DNS_JOURNAL_WRITE open the journal for reading and writing. * DNS_JOURNAL_READ open the journal for reading only. */ void dns_journal_destroy(dns_journal_t **journalp); /*%< * Destroy a dns_journal_t, closing any open files and freeing its memory. */ /**************************************************************************/ /* * Writing transactions to journals. */ isc_result_t dns_journal_begin_transaction(dns_journal_t *j); /*%< * Prepare to write a new transaction to the open journal file 'j'. * * Requires: * \li 'j' is open for writing. */ isc_result_t dns_journal_writediff(dns_journal_t *j, dns_diff_t *diff); /*%< * Write 'diff' to the current transaction of journal file 'j'. * * Requires: * \li 'j' is open for writing and dns_journal_begin_transaction() * has been called. * *\li 'diff' is a full or partial, correctly ordered IXFR * difference sequence. */ isc_result_t dns_journal_commit(dns_journal_t *j); /*%< * Commit the current transaction of journal file 'j'. * * Requires: * \li 'j' is open for writing and dns_journal_begin_transaction() * has been called. * * \li dns_journal_writediff() has been called one or more times * to form a complete, correctly ordered IXFR difference * sequence. */ isc_result_t dns_journal_write_transaction(dns_journal_t *j, dns_diff_t *diff); /*% * Write a complete transaction at once to a journal file, * sorting it if necessary, and commit it. Equivalent to calling * dns_diff_sort(), dns_journal_begin_transaction(), * dns_journal_writediff(), and dns_journal_commit(). * * Requires: *\li 'j' is open for writing. * * \li 'diff' contains exactly one SOA deletion, one SOA addition * with a greater serial number, and possibly other changes, * in arbitrary order. */ /**************************************************************************/ /* * Reading transactions from journals. */ isc_uint32_t dns_journal_first_serial(dns_journal_t *j); isc_uint32_t dns_journal_last_serial(dns_journal_t *j); /*%< * Get the first and last addressable serial number in the journal. */ isc_result_t dns_journal_iter_init(dns_journal_t *j, isc_uint32_t begin_serial, isc_uint32_t end_serial); /*%< * Prepare to iterate over the transactions that will bring the database * from SOA serial number 'begin_serial' to 'end_serial'. * * Returns: *\li ISC_R_SUCCESS *\li ISC_R_RANGE begin_serial is outside the addressable range. *\li ISC_R_NOTFOUND begin_serial is within the range of addressable * serial numbers covered by the journal, but * this particular serial number does not exist. */ /*@{*/ isc_result_t dns_journal_first_rr(dns_journal_t *j); isc_result_t dns_journal_next_rr(dns_journal_t *j); /*%< * Position the iterator at the first/next RR in a journal * transaction sequence established using dns_journal_iter_init(). * * Requires: * \li dns_journal_iter_init() has been called. * */ /*@}*/ void dns_journal_current_rr(dns_journal_t *j, dns_name_t **name, isc_uint32_t *ttl, dns_rdata_t **rdata); /*%< * Get the name, ttl, and rdata of the current journal RR. * * Requires: * \li The last call to dns_journal_first_rr() or dns_journal_next_rr() * returned ISC_R_SUCCESS. */ /**************************************************************************/ /* * Database roll-forward. */ isc_result_t dns_journal_rollforward(isc_mem_t *mctx, dns_db_t *db, unsigned int options, const char *filename); /*%< * Roll forward (play back) the journal file "filename" into the * database "db". This should be called when the server starts * after a shutdown or crash. * * Requires: *\li 'mctx' is a valid memory context. *\li 'db' is a valid database which does not have a version * open for writing. *\li 'filename' is the name of the journal file belonging to 'db'. * * Returns: *\li DNS_R_NOJOURNAL when journal does not exist. *\li ISC_R_NOTFOUND when current serial in not in journal. *\li ISC_R_RANGE when current serial in not in journals range. *\li ISC_R_SUCCESS journal has been applied successfully to database. * others */ isc_result_t dns_journal_print(isc_mem_t *mctx, const char *filename, FILE *file); /* For debugging not general use */ isc_result_t dns_db_diff(isc_mem_t *mctx, dns_db_t *dba, dns_dbversion_t *dbvera, dns_db_t *dbb, dns_dbversion_t *dbverb, const char *journal_filename); isc_result_t dns_db_diffx(dns_diff_t *diff, dns_db_t *dba, dns_dbversion_t *dbvera, dns_db_t *dbb, dns_dbversion_t *dbverb, const char *journal_filename); /*%< * Compare the databases 'dba' and 'dbb' and generate a diff/journal * entry containing the changes to make 'dba' from 'dbb' (note * the order). This journal entry will consist of a single, * possibly very large transaction. Append the journal * entry to the journal file specified by 'journal_filename' if * non-NULL. */ isc_result_t dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial, isc_uint32_t target_size); /*%< * Attempt to compact the journal if it is greater that 'target_size'. * Changes from 'serial' onwards will be preserved. If the journal * exists and is non-empty 'serial' must exist in the journal. */ isc_boolean_t dns_journal_get_sourceserial(dns_journal_t *j, isc_uint32_t *sourceserial); void dns_journal_set_sourceserial(dns_journal_t *j, isc_uint32_t sourceserial); /*%< * Get and set source serial. * * Returns: * ISC_TRUE if sourceserial has previously been set. */ ISC_LANG_ENDDECLS #endif /* DNS_JOURNAL_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/forward.h���������������������������������������������������������������������������������0000644�����������������00000006573�14763166026�0010200 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_FORWARD_H #define DNS_FORWARD_H 1 /*! \file dns/forward.h */ #include <isc/lang.h> #include <isc/result.h> #include <isc/sockaddr.h> #include <dns/types.h> ISC_LANG_BEGINDECLS struct dns_forwarder { isc_sockaddr_t addr; isc_dscp_t dscp; ISC_LINK(dns_forwarder_t) link; }; typedef ISC_LIST(struct dns_forwarder) dns_forwarderlist_t; struct dns_forwarders { dns_forwarderlist_t fwdrs; dns_fwdpolicy_t fwdpolicy; }; isc_result_t dns_fwdtable_create(isc_mem_t *mctx, dns_fwdtable_t **fwdtablep); /*%< * Creates a new forwarding table. * * Requires: * \li mctx is a valid memory context. * \li fwdtablep != NULL && *fwdtablep == NULL * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_NOMEMORY */ isc_result_t dns_fwdtable_addfwd(dns_fwdtable_t *fwdtable, dns_name_t *name, dns_forwarderlist_t *fwdrs, dns_fwdpolicy_t policy); isc_result_t dns_fwdtable_add(dns_fwdtable_t *fwdtable, dns_name_t *name, isc_sockaddrlist_t *addrs, dns_fwdpolicy_t policy); /*%< * Adds an entry to the forwarding table. The entry associates * a domain with a list of forwarders and a forwarding policy. The * addrs/fwdrs list is copied if not empty, so the caller should free * its copy. * * Requires: * \li fwdtable is a valid forwarding table. * \li name is a valid name * \li addrs/fwdrs is a valid list of isc_sockaddr/dns_forwarder * structures, which may be empty. * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_NOMEMORY */ isc_result_t dns_fwdtable_delete(dns_fwdtable_t *fwdtable, dns_name_t *name); /*%< * Removes an entry for 'name' from the forwarding table. If an entry * that exactly matches 'name' does not exist, ISC_R_NOTFOUND will be returned. * * Requires: * \li fwdtable is a valid forwarding table. * \li name is a valid name * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_NOTFOUND */ isc_result_t dns_fwdtable_find(dns_fwdtable_t *fwdtable, dns_name_t *name, dns_forwarders_t **forwardersp); /*%< * Finds a domain in the forwarding table. The closest matching parent * domain is returned. * * Requires: * \li fwdtable is a valid forwarding table. * \li name is a valid name * \li forwardersp != NULL && *forwardersp == NULL * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_NOTFOUND */ isc_result_t dns_fwdtable_find2(dns_fwdtable_t *fwdtable, dns_name_t *name, dns_name_t *foundname, dns_forwarders_t **forwardersp); /*%< * Finds a domain in the forwarding table. The closest matching parent * domain is returned. * * Requires: * \li fwdtable is a valid forwarding table. * \li name is a valid name * \li forwardersp != NULL && *forwardersp == NULL * \li foundname to be NULL or a valid name with buffer. * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_NOTFOUND */ void dns_fwdtable_destroy(dns_fwdtable_t **fwdtablep); /*%< * Destroys a forwarding table. * * Requires: * \li fwtablep != NULL && *fwtablep != NULL * * Ensures: * \li all memory associated with the forwarding table is freed. */ ISC_LANG_ENDDECLS #endif /* DNS_FORWARD_H */ �������������������������������������������������������������������������������������������������������������������������������������bind9/dns/keydata.h���������������������������������������������������������������������������������0000644�����������������00000002027�14763166026�0010144 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_KEYDATA_H #define DNS_KEYDATA_H 1 /***** ***** Module Info *****/ /*! \file dns/keydata.h * \brief * KEYDATA utilities. */ /*** *** Imports ***/ #include <isc/lang.h> #include <isc/types.h> #include <dns/types.h> #include <dns/rdatastruct.h> ISC_LANG_BEGINDECLS isc_result_t dns_keydata_todnskey(dns_rdata_keydata_t *keydata, dns_rdata_dnskey_t *dnskey, isc_mem_t *mctx); isc_result_t dns_keydata_fromdnskey(dns_rdata_keydata_t *keydata, dns_rdata_dnskey_t *dnskey, isc_uint32_t refresh, isc_uint32_t addhd, isc_uint32_t removehd, isc_mem_t *mctx); ISC_LANG_ENDDECLS #endif /* DNS_KEYDATA_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/dlz.h�������������������������������������������������������������������������������������0000644�����������������00000024602�14763166026�0007316 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Portions Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the * above copyright notice and this permission notice appear in all * copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE * USE OR PERFORMANCE OF THIS SOFTWARE. * * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was * conceived and contributed by Rob Butler. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the * above copyright notice and this permission notice appear in all * copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE * USE OR PERFORMANCE OF THIS SOFTWARE. */ /*! \file dns/dlz.h */ #ifndef DLZ_H #define DLZ_H 1 /***** ***** Module Info *****/ /* * DLZ Interface * * The DLZ interface allows zones to be looked up using a driver instead of * Bind's default in memory zone table. * * * Reliability: * No anticipated impact. * * Resources: * * Security: * No anticipated impact. * * Standards: * None. */ /***** ***** Imports *****/ #include <dns/clientinfo.h> #include <dns/name.h> #include <dns/types.h> #include <dns/view.h> #include <dst/dst.h> #include <isc/lang.h> ISC_LANG_BEGINDECLS /*** *** Types ***/ #define DNS_DLZ_MAGIC ISC_MAGIC('D','L','Z','D') #define DNS_DLZ_VALID(dlz) ISC_MAGIC_VALID(dlz, DNS_DLZ_MAGIC) typedef isc_result_t (*dns_dlzallowzonexfr_t)(void *driverarg, void *dbdata, isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_name_t *name, isc_sockaddr_t *clientaddr, dns_db_t **dbp); /*%< * Method prototype. Drivers implementing the DLZ interface MUST * supply an allow zone transfer method. This method is called when * the DNS server is performing a zone transfer query. The driver's * method should return ISC_R_SUCCESS and a database pointer to the * name server if the zone is supported by the database, and zone * transfer is allowed. Otherwise it will return ISC_R_NOTFOUND if * the zone is not supported by the database, or ISC_R_NOPERM if zone * transfers are not allowed. If an error occurs it should return a * result code indicating the type of error. */ typedef isc_result_t (*dns_dlzcreate_t)(isc_mem_t *mctx, const char *dlzname, unsigned int argc, char *argv[], void *driverarg, void **dbdata); /*%< * Method prototype. Drivers implementing the DLZ interface MUST * supply a create method. This method is called when the DNS server * is starting up and creating drivers for use later. */ typedef void (*dns_dlzdestroy_t)(void *driverarg, void **dbdata); /*%< * Method prototype. Drivers implementing the DLZ interface MUST * supply a destroy method. This method is called when the DNS server * is shutting down and no longer needs the driver. */ typedef isc_result_t (*dns_dlzfindzone_t)(void *driverarg, void *dbdata, isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_name_t *name, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo, dns_db_t **dbp); /*%< * Method prototype. Drivers implementing the DLZ interface MUST * supply a find zone method. This method is called when the DNS * server is performing a query. The find zone method will be called * with the longest possible name first, and continue to be called * with successively shorter domain names, until any of the following * occur: * * \li 1) a match is found, and the function returns (ISC_R_SUCCESS) * * \li 2) a problem occurs, and the functions returns anything other * than (ISC_R_NOTFOUND) * \li 3) we run out of domain name labels. I.E. we have tried the * shortest domain name * \li 4) the number of labels in the domain name is less than * min_labels for dns_dlzfindzone * * The driver's find zone method should return ISC_R_SUCCESS and a * database pointer to the name server if the zone is supported by the * database. Otherwise it will return ISC_R_NOTFOUND, and a null * pointer if the zone is not supported. If an error occurs it should * return a result code indicating the type of error. */ typedef isc_result_t (*dns_dlzconfigure_t)(void *driverarg, void *dbdata, dns_view_t *view, dns_dlzdb_t *dlzdb); /*%< * Method prototype. Drivers implementing the DLZ interface may * optionally supply a configure method. If supplied, this will be * called immediately after the create method is called. The driver * may call configuration functions during the configure call */ typedef isc_boolean_t (*dns_dlzssumatch_t)(dns_name_t *signer, dns_name_t *name, isc_netaddr_t *tcpaddr, dns_rdatatype_t type, const dst_key_t *key, void *driverarg, void *dbdata); /*%< * Method prototype. Drivers implementing the DLZ interface may * optionally supply a ssumatch method. If supplied, this will be * called to authorize update requests */ /*% the methods supplied by a DLZ driver */ typedef struct dns_dlzmethods { dns_dlzcreate_t create; dns_dlzdestroy_t destroy; dns_dlzfindzone_t findzone; dns_dlzallowzonexfr_t allowzonexfr; dns_dlzconfigure_t configure; dns_dlzssumatch_t ssumatch; } dns_dlzmethods_t; /*% information about a DLZ driver */ struct dns_dlzimplementation { const char *name; const dns_dlzmethods_t *methods; isc_mem_t *mctx; void *driverarg; ISC_LINK(dns_dlzimplementation_t) link; }; typedef isc_result_t (*dlzconfigure_callback_t)(dns_view_t *, dns_dlzdb_t *, dns_zone_t *); /*% An instance of a DLZ driver */ struct dns_dlzdb { unsigned int magic; isc_mem_t *mctx; dns_dlzimplementation_t *implementation; void *dbdata; dlzconfigure_callback_t configure_callback; isc_boolean_t search; char *dlzname; ISC_LINK(dns_dlzdb_t) link; dns_ssutable_t *ssutable; }; /*** *** Method declarations ***/ isc_result_t dns_dlzallowzonexfr(dns_view_t *view, dns_name_t *name, isc_sockaddr_t *clientaddr, dns_db_t **dbp); /*%< * This method is called when the DNS server is performing a zone * transfer query. It will call the DLZ driver's allow zone transfer * method. */ isc_result_t dns_dlzcreate(isc_mem_t *mctx, const char *dlzname, const char *drivername, unsigned int argc, char *argv[], dns_dlzdb_t **dbp); /*%< * This method is called when the DNS server is starting up and * creating drivers for use later. It will search the DLZ driver list * for 'drivername' and return a DLZ driver via dbp if a match is * found. If the DLZ driver supplies a create method, this function * will call it. */ void dns_dlzdestroy(dns_dlzdb_t **dbp); /*%< * This method is called when the DNS server is shutting down and no * longer needs the driver. If the DLZ driver supplies a destroy * methods, this function will call it. */ isc_result_t dns_dlzregister(const char *drivername, const dns_dlzmethods_t *methods, void *driverarg, isc_mem_t *mctx, dns_dlzimplementation_t **dlzimp); /*%< * Register a dynamically loadable zones (DLZ) driver for the database * type 'drivername', implemented by the functions in '*methods'. * * dlzimp must point to a NULL dlz_implementation_t pointer. That is, * dlzimp != NULL && *dlzimp == NULL. It will be assigned a value that * will later be used to identify the driver when deregistering it. */ isc_result_t dns_dlzstrtoargv(isc_mem_t *mctx, char *s, unsigned int *argcp, char ***argvp); /*%< * This method is called when the name server is starting up to parse * the DLZ driver command line from named.conf. Basically it splits * up a string into and argc / argv. The primary difference of this * method is items between braces { } are considered only 1 word. for * example the command line "this is { one grouped phrase } and this * isn't" would be parsed into: * * \li argv[0]: "this" * \li argv[1]: "is" * \li argv{2]: " one grouped phrase " * \li argv[3]: "and" * \li argv[4]: "this" * \li argv{5}: "isn't" * * braces should NOT be nested, more than one grouping in the command * line is allowed. Notice, argv[2] has an extra space at the * beginning and end. Extra spaces are not stripped between a * grouping. You can do so in your driver if needed, or be sure not * to put extra spaces before / after the braces. */ void dns_dlzunregister(dns_dlzimplementation_t **dlzimp); /*%< * Removes the dlz driver from the list of registered dlz drivers. * There must be no active dlz drivers of this type when this function * is called. */ typedef isc_result_t dns_dlz_writeablezone_t(dns_view_t *view, dns_dlzdb_t *dlzdb, const char *zone_name); dns_dlz_writeablezone_t dns_dlz_writeablezone; /*%< * creates a writeable DLZ zone. Must be called from within the * configure() method of a DLZ driver. */ isc_result_t dns_dlzconfigure(dns_view_t *view, dns_dlzdb_t *dlzdb, dlzconfigure_callback_t callback); /*%< * call a DLZ drivers configure method, if supplied */ isc_boolean_t dns_dlz_ssumatch(dns_dlzdb_t *dlzdatabase, dns_name_t *signer, dns_name_t *name, isc_netaddr_t *tcpaddr, dns_rdatatype_t type, const dst_key_t *key); /*%< * call a DLZ drivers ssumatch method, if supplied. Otherwise return ISC_FALSE */ ISC_LANG_ENDDECLS #endif /* DLZ_H */ ������������������������������������������������������������������������������������������������������������������������������bind9/dns/dbtable.h���������������������������������������������������������������������������������0000644�����������������00000006134�14763166026�0010122 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_DBTABLE_H #define DNS_DBTABLE_H 1 /***** ***** Module Info *****/ /*! \file dns/dbtable.h * \brief * DNS DB Tables * * XXX TBS XXX * * MP: *\li The module ensures appropriate synchronization of data structures it * creates and manipulates. * * Reliability: *\li No anticipated impact. * * Resources: *\li None. * * Security: *\li No anticipated impact. * * Standards: *\li None. */ #include <isc/lang.h> #include <dns/types.h> #define DNS_DBTABLEFIND_NOEXACT 0x01 ISC_LANG_BEGINDECLS isc_result_t dns_dbtable_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_dbtable_t **dbtablep); /*%< * Make a new dbtable of class 'rdclass' * * Requires: *\li mctx != NULL * \li dbtablep != NULL && *dptablep == NULL *\li 'rdclass' is a valid class * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li #ISC_R_UNEXPECTED */ void dns_dbtable_attach(dns_dbtable_t *source, dns_dbtable_t **targetp); /*%< * Attach '*targetp' to 'source'. * * Requires: * *\li 'source' is a valid dbtable. * *\li 'targetp' points to a NULL dns_dbtable_t *. * * Ensures: * *\li *targetp is attached to source. */ void dns_dbtable_detach(dns_dbtable_t **dbtablep); /*%< * Detach *dbtablep from its dbtable. * * Requires: * *\li '*dbtablep' points to a valid dbtable. * * Ensures: * *\li *dbtablep is NULL. * *\li If '*dbtablep' is the last reference to the dbtable, * all resources used by the dbtable will be freed */ isc_result_t dns_dbtable_add(dns_dbtable_t *dbtable, dns_db_t *db); /*%< * Add 'db' to 'dbtable'. * * Requires: *\li 'dbtable' is a valid dbtable. * *\li 'db' is a valid database with the same class as 'dbtable' */ void dns_dbtable_remove(dns_dbtable_t *dbtable, dns_db_t *db); /*%< * Remove 'db' from 'dbtable'. * * Requires: *\li 'db' was previously added to 'dbtable'. */ void dns_dbtable_adddefault(dns_dbtable_t *dbtable, dns_db_t *db); /*%< * Use 'db' as the result of a dns_dbtable_find() if no better match is * available. */ void dns_dbtable_getdefault(dns_dbtable_t *dbtable, dns_db_t **db); /*%< * Get the 'db' used as the result of a dns_dbtable_find() * if no better match is available. */ void dns_dbtable_removedefault(dns_dbtable_t *dbtable); /*%< * Remove the default db from 'dbtable'. */ isc_result_t dns_dbtable_find(dns_dbtable_t *dbtable, dns_name_t *name, unsigned int options, dns_db_t **dbp); /*%< * Find the deepest match to 'name' in the dbtable, and return it * * Notes: *\li If the DNS_DBTABLEFIND_NOEXACT option is set, the best partial * match (if any) to 'name' will be returned. * * Returns: * \li #ISC_R_SUCCESS on success *\li something else: no default and match */ ISC_LANG_ENDDECLS #endif /* DNS_DBTABLE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/xfrin.h�����������������������������������������������������������������������������������0000644�����������������00000005553�14763166026�0007657 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_XFRIN_H #define DNS_XFRIN_H 1 /***** ***** Module Info *****/ /*! \file dns/xfrin.h * \brief * Incoming zone transfers (AXFR + IXFR). */ /*** *** Imports ***/ #include <isc/lang.h> #include <dns/types.h> /*** *** Types ***/ /*% * A transfer in progress. This is an opaque type. */ typedef struct dns_xfrin_ctx dns_xfrin_ctx_t; /*** *** Functions ***/ ISC_LANG_BEGINDECLS /*% see dns_xfrin_create2() */ isc_result_t dns_xfrin_create(dns_zone_t *zone, dns_rdatatype_t xfrtype, isc_sockaddr_t *masteraddr, dns_tsigkey_t *tsigkey, isc_mem_t *mctx, isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr, isc_task_t *task, dns_xfrindone_t done, dns_xfrin_ctx_t **xfrp); isc_result_t dns_xfrin_create2(dns_zone_t *zone, dns_rdatatype_t xfrtype, isc_sockaddr_t *masteraddr, isc_sockaddr_t *sourceaddr, dns_tsigkey_t *tsigkey, isc_mem_t *mctx, isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr, isc_task_t *task, dns_xfrindone_t done, dns_xfrin_ctx_t **xfrp); isc_result_t dns_xfrin_create3(dns_zone_t *zone, dns_rdatatype_t xfrtype, isc_sockaddr_t *masteraddr, isc_sockaddr_t *sourceaddr, isc_dscp_t dscp, dns_tsigkey_t *tsigkey, isc_mem_t *mctx, isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr, isc_task_t *task, dns_xfrindone_t done, dns_xfrin_ctx_t **xfrp); /*%< * Attempt to start an incoming zone transfer of 'zone' * from 'masteraddr', creating a dns_xfrin_ctx_t object to * manage it. Attach '*xfrp' to the newly created object. * * Iff ISC_R_SUCCESS is returned, '*done' is guaranteed to be * called in the context of 'task', with 'zone' and a result * code as arguments when the transfer finishes. * * Requires: *\li 'xfrtype' is dns_rdatatype_axfr, dns_rdatatype_ixfr * or dns_rdatatype_soa (soa query followed by axfr if * serial is greater than current serial). * *\li If 'xfrtype' is dns_rdatatype_ixfr or dns_rdatatype_soa, * the zone has a database. */ void dns_xfrin_shutdown(dns_xfrin_ctx_t *xfr); /*%< * If the zone transfer 'xfr' has already finished, * do nothing. Otherwise, abort it and cause it to call * its done callback with a status of ISC_R_CANCELED. */ void dns_xfrin_detach(dns_xfrin_ctx_t **xfrp); /*%< * Detach a reference to a zone transfer object. * Caller to maintain external locking if required. */ void dns_xfrin_attach(dns_xfrin_ctx_t *source, dns_xfrin_ctx_t **target); /*%< * Caller to maintain external locking if required. */ ISC_LANG_ENDDECLS #endif /* DNS_XFRIN_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/dns64.h�����������������������������������������������������������������������������������0000644�����������������00000013014�14763166026�0007456 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_DNS64_H #define DNS_DNS64_H 1 #include <isc/lang.h> #include <dns/types.h> ISC_LANG_BEGINDECLS /* * dns_dns64_create() flags. */ #define DNS_DNS64_RECURSIVE_ONLY 0x01 /* If set then this record * only applies to recursive * queries. */ #define DNS_DNS64_BREAK_DNSSEC 0x02 /* If set then still perform * DNSSEC synthesis even * though the result would * fail validation. */ /* * dns_dns64_aaaaok() and dns_dns64_aaaafroma() flags. */ #define DNS_DNS64_RECURSIVE 0x01 /* Recursive query. */ #define DNS_DNS64_DNSSEC 0x02 /* DNSSEC sensitive query. */ isc_result_t dns_dns64_create(isc_mem_t *mctx, isc_netaddr_t *prefix, unsigned int prefixlen, isc_netaddr_t *suffix, dns_acl_t *client, dns_acl_t *mapped, dns_acl_t *excluded, unsigned int flags, dns_dns64_t **dns64); /* * Create a dns64 record which is used to identify the set of clients * it applies to and how to perform the DNS64 synthesis. * * 'prefix' and 'prefixlen' defined the leading bits of the AAAA records * to be synthesised. 'suffix' defines the bits after the A records bits. * If suffix is NULL zeros will be used for these bits. 'client' defines * for which clients this record applies. If 'client' is NULL then all * clients apply. 'mapped' defines which A records are candidated for * mapping. If 'mapped' is NULL then all A records will be mapped. * 'excluded' defines which AAAA are to be treated as non-existent for the * purposed of determining whether to perform syntesis. If 'excluded' is * NULL then no AAAA records prevent synthesis. * * If DNS_DNS64_RECURSIVE_ONLY is set then the record will only match if * DNS_DNS64_RECURSIVE is set when calling dns_dns64_aaaaok() and * dns_dns64_aaaafroma(). * * If DNS_DNS64_BREAK_DNSSEC is set then the record will still apply if * DNS_DNS64_DNSSEC is set when calling dns_dns64_aaaaok() and * dns_dns64_aaaafroma() otherwise the record will be ignored. * * Requires: * 'mctx' to be valid. * 'prefix' to be valid and the address family to AF_INET6. * 'prefixlen' to be one of 32, 40, 48, 56, 72 and 96. * the bits not covered by prefixlen in prefix to * be zero. * 'suffix' to be NULL or the address family be set to AF_INET6 * and the leading 'prefixlen' + 32 bits of the 'suffix' * to be zero. If 'prefixlen' is 40, 48 or 56 then the * the leading 'prefixlen' + 40 bits of 'suffix' must be * zero. * 'client' to be NULL or a valid acl. * 'mapped' to be NULL or a valid acl. * 'excluded' to be NULL or a valid acl. * * Returns: * ISC_R_SUCCESS * ISC_R_NOMEMORY */ void dns_dns64_destroy(dns_dns64_t **dns64p); /* * Destroys a dns64 record. * * Requires the record to not be linked. */ isc_result_t dns_dns64_aaaafroma(const dns_dns64_t *dns64, const isc_netaddr_t *reqaddr, const dns_name_t *reqsigner, const dns_aclenv_t *env, unsigned int flags, unsigned char *a, unsigned char *aaaa); /* * dns_dns64_aaaafroma() determines whether to perform a DNS64 address * synthesis from 'a' based on 'dns64', 'reqaddr', 'reqsigner', 'env', * 'flags' and 'aaaa'. If synthesis is performed then the result is * written to '*aaaa'. * * The synthesised address will be of the form: * * <prefix bits><a bits><suffix bits> * * If <a bits> straddle bits 64-71 of the AAAA record, then 8 zero bits will * be inserted at bits 64-71. * * Requires: * 'dns64' to be valid. * 'reqaddr' to be valid. * 'reqsigner' to be NULL or valid. * 'env' to be valid. * 'a' to point to a IPv4 address in network order. * 'aaaa' to point to a IPv6 address buffer in network order. * * Returns: * ISC_R_SUCCESS if synthesis was performed. * DNS_R_DISALLOWED if there is no match. */ dns_dns64_t * dns_dns64_next(dns_dns64_t *dns64); /* * Return the next dns64 record in the list. */ void dns_dns64_append(dns_dns64list_t *list, dns_dns64_t *dns64); /* * Append the dns64 record to the list. */ void dns_dns64_unlink(dns_dns64list_t *list, dns_dns64_t *dns64); /* * Unlink the dns64 record from the list. */ isc_boolean_t dns_dns64_aaaaok(const dns_dns64_t *dns64, const isc_netaddr_t *reqaddr, const dns_name_t *reqsigner, const dns_aclenv_t *env, unsigned int flags, dns_rdataset_t *rdataset, isc_boolean_t *aaaaok, size_t aaaaoklen); /* * Determine if there are any non-excluded AAAA records in from the * matching dns64 records in the list starting at 'dns64'. If there * is a non-exluded address return ISC_TRUE. If all addresses are * excluded in the matched records return ISC_FALSE. If no records * match then return ISC_TRUE. * * If aaaaok is defined then dns_dns64_aaaaok() return a array of which * addresses in 'rdataset' were deemed to not be exclude by any matching * record. If there are no matching records then all entries are set * to ISC_TRUE. * * Requires * 'rdataset' to be valid and to be for type AAAA and class IN. * 'aaaaoklen' must match the number of records in 'rdataset' * if 'aaaaok' in non NULL. */ ISC_LANG_ENDDECLS #endif /* DNS_DNS64_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/nta.h�������������������������������������������������������������������������������������0000644�����������������00000010506�14763166026�0007305 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_NTA_H #define DNS_NTA_H 1 /***** ***** Module Info *****/ /*! \file * \brief * The NTA module provides services for storing and retrieving negative * trust anchors, and determine whether a given domain is subject to * DNSSEC validation. */ #include <isc/buffer.h> #include <isc/lang.h> #include <isc/magic.h> #include <isc/refcount.h> #include <isc/rwlock.h> #include <isc/stdtime.h> #include <isc/task.h> #include <isc/timer.h> #include <dns/types.h> #include <dns/rdataset.h> #include <dns/resolver.h> #include <dns/view.h> ISC_LANG_BEGINDECLS struct dns_ntatable { /* Unlocked. */ unsigned int magic; dns_view_t *view; isc_rwlock_t rwlock; isc_taskmgr_t *taskmgr; isc_timermgr_t *timermgr; isc_task_t *task; /* Locked by rwlock. */ isc_uint32_t references; dns_rbt_t *table; }; #define NTATABLE_MAGIC ISC_MAGIC('N', 'T', 'A', 't') #define VALID_NTATABLE(nt) ISC_MAGIC_VALID(nt, NTATABLE_MAGIC) isc_result_t dns_ntatable_create(dns_view_t *view, isc_taskmgr_t *taskmgr, isc_timermgr_t *timermgr, dns_ntatable_t **ntatablep); /*%< * Create an NTA table in view 'view'. * * Requires: * *\li 'view' is a valid view. * *\li 'tmgr' is a valid timer manager. * *\li ntatablep != NULL && *ntatablep == NULL * * Ensures: * *\li On success, *ntatablep is a valid, empty NTA table. * * Returns: * *\li ISC_R_SUCCESS *\li Any other result indicates failure. */ void dns_ntatable_attach(dns_ntatable_t *source, dns_ntatable_t **targetp); /*%< * Attach *targetp to source. * * Requires: * *\li 'source' is a valid ntatable. * *\li 'targetp' points to a NULL dns_ntatable_t *. * * Ensures: * *\li *targetp is attached to source. */ void dns_ntatable_detach(dns_ntatable_t **ntatablep); /*%< * Detach *ntatablep from its ntatable. * * Requires: * *\li 'ntatablep' points to a valid ntatable. * * Ensures: * *\li *ntatablep is NULL. * *\li If '*ntatablep' is the last reference to the ntatable, * all resources used by the ntatable will be freed */ isc_result_t dns_ntatable_add(dns_ntatable_t *ntatable, dns_name_t *name, isc_boolean_t force, isc_stdtime_t now, isc_uint32_t lifetime); /*%< * Add a negative trust anchor to 'ntatable' for name 'name', * which will expire at time 'now' + 'lifetime'. If 'force' is ISC_FALSE, * then the name will be checked periodically to see if it's bogus; * if not, then the NTA will be allowed to expire early. * * Notes: * *\li If an NTA already exists in the table, its expiry time * is updated. * * Requires: * *\li 'ntatable' points to a valid ntatable. * *\li 'name' points to a valid name. * * Returns: * *\li ISC_R_SUCCESS * *\li Any other result indicates failure. */ isc_result_t dns_ntatable_delete(dns_ntatable_t *ntatable, dns_name_t *keyname); /*%< * Delete node(s) from 'ntatable' matching name 'keyname' * * Requires: * *\li 'ntatable' points to a valid ntatable. * *\li 'name' is not NULL * * Returns: * *\li ISC_R_SUCCESS * *\li Any other result indicates failure. */ isc_boolean_t dns_ntatable_covered(dns_ntatable_t *ntatable, isc_stdtime_t now, dns_name_t *name, dns_name_t *anchor); /*%< * Return ISC_TRUE if 'name' is below a non-expired negative trust * anchor which in turn is at or below 'anchor'. * * If 'ntatable' has not been initialized, return ISC_FALSE. * * Requires: * *\li 'ntatable' is NULL or is a valid ntatable. * *\li 'name' is a valid absolute name. */ isc_result_t dns_ntatable_totext(dns_ntatable_t *ntatable, isc_buffer_t **buf); /*%< * Dump the NTA table to buffer at 'buf' * * Requires: * \li "ntatable" is a valid table. * * \li "*buf" is a valid buffer. */ isc_result_t dns_ntatable_dump(dns_ntatable_t *ntatable, FILE *fp); /*%< * Dump the NTA table to the file opened as 'fp'. */ isc_result_t dns_ntatable_save(dns_ntatable_t *ntatable, FILE *fp); /*%< * Save the NTA table to the file opened as 'fp', for later loading. */ ISC_LANG_ENDDECLS #endif /* DNS_NTA_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/sdb.h�������������������������������������������������������������������������������������0000644�����������������00000016044�14763166026�0007276 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_SDB_H #define DNS_SDB_H 1 /***** ***** Module Info *****/ /*! \file dns/sdb.h * \brief * Simple database API. */ /*** *** Imports ***/ #include <isc/lang.h> #include <dns/clientinfo.h> #include <dns/types.h> /*** *** Types ***/ /*% * A simple database. This is an opaque type. */ typedef struct dns_sdb dns_sdb_t; /*% * A simple database lookup in progress. This is an opaque type. */ typedef struct dns_sdblookup dns_sdblookup_t; /*% * A simple database traversal in progress. This is an opaque type. */ typedef struct dns_sdballnodes dns_sdballnodes_t; typedef isc_result_t (*dns_sdblookupfunc_t)(const char *zone, const char *name, void *dbdata, dns_sdblookup_t *lookup, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo); typedef isc_result_t (*dns_sdblookup2func_t)(const dns_name_t *zone, const dns_name_t *name, void *dbdata, dns_sdblookup_t *lookup, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo); typedef isc_result_t (*dns_sdbauthorityfunc_t)(const char *zone, void *dbdata, dns_sdblookup_t *); typedef isc_result_t (*dns_sdballnodesfunc_t)(const char *zone, void *dbdata, dns_sdballnodes_t *allnodes); typedef isc_result_t (*dns_sdbcreatefunc_t)(const char *zone, int argc, char **argv, void *driverdata, void **dbdata); typedef void (*dns_sdbdestroyfunc_t)(const char *zone, void *driverdata, void **dbdata); typedef struct dns_sdbmethods { dns_sdblookupfunc_t lookup; dns_sdbauthorityfunc_t authority; dns_sdballnodesfunc_t allnodes; dns_sdbcreatefunc_t create; dns_sdbdestroyfunc_t destroy; dns_sdblookup2func_t lookup2; } dns_sdbmethods_t; /*** *** Functions ***/ ISC_LANG_BEGINDECLS #define DNS_SDBFLAG_RELATIVEOWNER 0x00000001U #define DNS_SDBFLAG_RELATIVERDATA 0x00000002U #define DNS_SDBFLAG_THREADSAFE 0x00000004U #define DNS_SDBFLAG_DNS64 0x00000008U isc_result_t dns_sdb_register(const char *drivername, const dns_sdbmethods_t *methods, void *driverdata, unsigned int flags, isc_mem_t *mctx, dns_sdbimplementation_t **sdbimp); /*%< * Register a simple database driver for the database type 'drivername', * implemented by the functions in '*methods'. * * sdbimp must point to a NULL dns_sdbimplementation_t pointer. That is, * sdbimp != NULL && *sdbimp == NULL. It will be assigned a value that * will later be used to identify the driver when deregistering it. * * The name server will perform lookups in the database by calling the * function 'lookup', passing it a printable zone name 'zone', a printable * domain name 'name', and a copy of the argument 'dbdata' that * was potentially returned by the create function. The 'dns_sdblookup_t' * argument to 'lookup' and 'authority' is an opaque pointer to be passed to * ns_sdb_putrr(). * * The lookup function returns the lookup results to the name server * by calling ns_sdb_putrr() once for each record found. On success, * the return value of the lookup function should be ISC_R_SUCCESS. * If the domain name 'name' does not exist, the lookup function should * ISC_R_NOTFOUND. Any other return value is treated as an error. * * Lookups at the zone apex will cause the server to also call the * function 'authority' (if non-NULL), which must provide an SOA record * and NS records for the zone by calling ns_sdb_putrr() once for each of * these records. The 'authority' function may be NULL if invoking * the 'lookup' function on the zone apex will return SOA and NS records. * * The allnodes function, if non-NULL, fills in an opaque structure to be * used by a database iterator. This allows the zone to be transferred. * This may use a considerable amount of memory for large zones, and the * zone transfer may not be fully RFC1035 compliant if the zone is * frequently changed. * * The create function will be called for each zone configured * into the name server using this database type. It can be used * to create a "database object" containing zone specific data, * which can make use of the database arguments specified in the * name server configuration. * * The destroy function will be called to free the database object * when its zone is destroyed. * * The create and destroy functions may be NULL. * * If flags includes DNS_SDBFLAG_RELATIVEOWNER, the lookup and authority * functions will be called with relative names rather than absolute names. * The string "@" represents the zone apex in this case. * * If flags includes DNS_SDBFLAG_RELATIVERDATA, the rdata strings may * include relative names. Otherwise, all names in the rdata string must * be absolute. Be aware that if relative names are allowed, any * absolute names must contain a trailing dot. * * If flags includes DNS_SDBFLAG_THREADSAFE, the driver must be able to * handle multiple lookups in parallel. Otherwise, calls into the driver * are serialized. */ void dns_sdb_unregister(dns_sdbimplementation_t **sdbimp); /*%< * Removes the simple database driver from the list of registered database * types. There must be no active databases of this type when this function * is called. */ /*% See dns_sdb_putradata() */ isc_result_t dns_sdb_putrr(dns_sdblookup_t *lookup, const char *type, dns_ttl_t ttl, const char *data); isc_result_t dns_sdb_putrdata(dns_sdblookup_t *lookup, dns_rdatatype_t type, dns_ttl_t ttl, const unsigned char *rdata, unsigned int rdlen); /*%< * Add a single resource record to the lookup structure to be * returned in the query response. dns_sdb_putrr() takes the * resource record in master file text format as a null-terminated * string, and dns_sdb_putrdata() takes the raw RDATA in * uncompressed wire format. */ /*% See dns_sdb_putnamerdata() */ isc_result_t dns_sdb_putnamedrr(dns_sdballnodes_t *allnodes, const char *name, const char *type, dns_ttl_t ttl, const char *data); isc_result_t dns_sdb_putnamedrdata(dns_sdballnodes_t *allnodes, const char *name, dns_rdatatype_t type, dns_ttl_t ttl, const void *rdata, unsigned int rdlen); /*%< * Add a single resource record to the allnodes structure to be * included in a zone transfer response, in text or wire * format as above. */ isc_result_t dns_sdb_putsoa(dns_sdblookup_t *lookup, const char *mname, const char *rname, isc_uint32_t serial); /*%< * This function may optionally be called from the 'authority' callback * to simplify construction of the SOA record for 'zone'. It will * provide a SOA listing 'mname' as as the master server and 'rname' as * the responsible person mailbox. It is the responsibility of the * driver to increment the serial number between responses if necessary. * All other SOA fields will have reasonable default values. */ ISC_LANG_ENDDECLS #endif /* DNS_SDB_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/callbacks.h�������������������������������������������������������������������������������0000644�����������������00000004336�14763166026�0010446 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_CALLBACKS_H #define DNS_CALLBACKS_H 1 /*! \file dns/callbacks.h */ /*** *** Imports ***/ #include <isc/lang.h> #include <isc/magic.h> #include <dns/types.h> ISC_LANG_BEGINDECLS /*** *** Types ***/ #define DNS_CALLBACK_MAGIC ISC_MAGIC('C','L','L','B') #define DNS_CALLBACK_VALID(cb) ISC_MAGIC_VALID(cb, DNS_CALLBACK_MAGIC) struct dns_rdatacallbacks { unsigned int magic; /*% * dns_load_master calls this when it has rdatasets to commit. */ dns_addrdatasetfunc_t add; /*% * This is called when reading in a database image from a 'map' * format zone file. */ dns_deserializefunc_t deserialize; /*% * dns_master_load*() call this when loading a raw zonefile, * to pass back information obtained from the file header */ dns_rawdatafunc_t rawdata; dns_zone_t *zone; /*% * dns_load_master / dns_rdata_fromtext call this to issue a error. */ void (*error)(struct dns_rdatacallbacks *, const char *, ...); /*% * dns_load_master / dns_rdata_fromtext call this to issue a warning. */ void (*warn)(struct dns_rdatacallbacks *, const char *, ...); /*% * Private data handles for use by the above callback functions. */ void *add_private; void *deserialize_private; void *error_private; void *warn_private; }; /*** *** Initialization ***/ void dns_rdatacallbacks_init(dns_rdatacallbacks_t *callbacks); /*%< * Initialize 'callbacks'. * * \li 'magic' is set to DNS_CALLBACK_MAGIC * * \li 'error' and 'warn' are set to default callbacks that print the * error message through the DNS library log context. * *\li All other elements are initialized to NULL. * * Requires: * \li 'callbacks' is a valid dns_rdatacallbacks_t, */ void dns_rdatacallbacks_init_stdio(dns_rdatacallbacks_t *callbacks); /*%< * Like dns_rdatacallbacks_init, but logs to stdio. */ ISC_LANG_ENDDECLS #endif /* DNS_CALLBACKS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/private.h���������������������������������������������������������������������������������0000644�����������������00000003635�14763166026�0010202 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #include <isc/lang.h> #include <isc/types.h> #include <dns/types.h> #include <dns/db.h> #ifndef DNS_PRIVATE_H #define DNS_PRIVATE_H ISC_LANG_BEGINDECLS isc_result_t dns_private_chains(dns_db_t *db, dns_dbversion_t *ver, dns_rdatatype_t privatetype, isc_boolean_t *build_nsec, isc_boolean_t *build_nsec3); /*%< * Examine the NSEC, NSEC3PARAM and privatetype RRsets at the apex of the * database to determine which of NSEC or NSEC3 chains we are currently * maintaining. In normal operations only one of NSEC or NSEC3 is being * maintained but when we are transitiong between NSEC and NSEC3 we need * to update both sets of chains. If 'privatetype' is zero then the * privatetype RRset will not be examined. * * Requires: * \li 'db' is valid. * \li 'version' is valid or NULL. * \li 'build_nsec' is a pointer to a isc_boolean_t or NULL. * \li 'build_nsec3' is a pointer to a isc_boolean_t or NULL. * * Returns: * \li ISC_R_SUCCESS, 'build_nsec' and 'build_nsec3' will be valid. * \li other on error */ isc_result_t dns_private_totext(dns_rdata_t *privaterdata, isc_buffer_t *buffer); /*%< * Convert a private-type RR 'privaterdata' to human-readable form, * and place the result in 'buffer'. The text should indicate * which action the private-type record specifies and whether the * action has been completed. * * Requires: * \li 'privaterdata' is a valid rdata containing at least five bytes * \li 'buffer' is a valid buffer * * Returns: * \li ISC_R_SUCCESS * \li other on error */ ISC_LANG_ENDDECLS #endif ���������������������������������������������������������������������������������������������������bind9/dns/rdatastruct.h�����������������������������������������������������������������������������0000644�����������������00000163113�14763166026�0011066 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 1998-2022 Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /*************** *************** *************** THIS FILE IS AUTOMATICALLY GENERATED BY gen.c. *************** DO NOT EDIT! *************** ***************/ /*! \file */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_RDATASTRUCT_H #define DNS_RDATASTRUCT_H 1 #include <isc/lang.h> #include <isc/sockaddr.h> #include <dns/name.h> #include <dns/types.h> ISC_LANG_BEGINDECLS typedef struct dns_rdatacommon { dns_rdataclass_t rdclass; dns_rdatatype_t rdtype; ISC_LINK(struct dns_rdatacommon) link; } dns_rdatacommon_t; #define DNS_RDATACOMMON_INIT(_data, _rdtype, _rdclass) \ do { \ (_data)->common.rdtype = (_rdtype); \ (_data)->common.rdclass = (_rdclass); \ ISC_LINK_INIT(&(_data)->common, link); \ } while (0) /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef IN_1_A_1_H #define IN_1_A_1_H 1 typedef struct dns_rdata_in_a { dns_rdatacommon_t common; struct in_addr in_addr; } dns_rdata_in_a_t; #endif /* IN_1_A_1_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* by Bjorn.Victor@it.uu.se, 2005-05-07 */ /* Based on generic/mx_15.h */ #ifndef CH_3_A_1_H #define CH_3_A_1_H 1 typedef isc_uint16_t ch_addr_t; typedef struct dns_rdata_ch_a { dns_rdatacommon_t common; isc_mem_t *mctx; dns_name_t ch_addr_dom; /* ch-addr domain for back mapping */ ch_addr_t ch_addr; /* chaos address (16 bit) network order */ } dns_rdata_ch_a_t; #endif /* CH_3_A_1_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef HS_4_A_1_H #define HS_4_A_1_H 1 typedef struct dns_rdata_hs_a { dns_rdatacommon_t common; struct in_addr in_addr; } dns_rdata_hs_a_t; #endif /* HS_4_A_1_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_NS_2_H #define GENERIC_NS_2_H 1 typedef struct dns_rdata_ns { dns_rdatacommon_t common; isc_mem_t *mctx; dns_name_t name; } dns_rdata_ns_t; #endif /* GENERIC_NS_2_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_MD_3_H #define GENERIC_MD_3_H 1 typedef struct dns_rdata_md { dns_rdatacommon_t common; isc_mem_t *mctx; dns_name_t md; } dns_rdata_md_t; #endif /* GENERIC_MD_3_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_MF_4_H #define GENERIC_MF_4_H 1 typedef struct dns_rdata_mf { dns_rdatacommon_t common; isc_mem_t *mctx; dns_name_t mf; } dns_rdata_mf_t; #endif /* GENERIC_MF_4_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_CNAME_5_H #define GENERIC_CNAME_5_H 1 typedef struct dns_rdata_cname { dns_rdatacommon_t common; isc_mem_t *mctx; dns_name_t cname; } dns_rdata_cname_t; #endif /* GENERIC_CNAME_5_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_SOA_6_H #define GENERIC_SOA_6_H 1 typedef struct dns_rdata_soa { dns_rdatacommon_t common; isc_mem_t *mctx; dns_name_t origin; dns_name_t contact; isc_uint32_t serial; /*%< host order */ isc_uint32_t refresh; /*%< host order */ isc_uint32_t retry; /*%< host order */ isc_uint32_t expire; /*%< host order */ isc_uint32_t minimum; /*%< host order */ } dns_rdata_soa_t; #endif /* GENERIC_SOA_6_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_MB_7_H #define GENERIC_MB_7_H 1 typedef struct dns_rdata_mb { dns_rdatacommon_t common; isc_mem_t *mctx; dns_name_t mb; } dns_rdata_mb_t; #endif /* GENERIC_MB_7_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_MG_8_H #define GENERIC_MG_8_H 1 typedef struct dns_rdata_mg { dns_rdatacommon_t common; isc_mem_t *mctx; dns_name_t mg; } dns_rdata_mg_t; #endif /* GENERIC_MG_8_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_MR_9_H #define GENERIC_MR_9_H 1 typedef struct dns_rdata_mr { dns_rdatacommon_t common; isc_mem_t *mctx; dns_name_t mr; } dns_rdata_mr_t; #endif /* GENERIC_MR_9_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_NULL_10_H #define GENERIC_NULL_10_H 1 typedef struct dns_rdata_null { dns_rdatacommon_t common; isc_mem_t *mctx; isc_uint16_t length; unsigned char *data; } dns_rdata_null_t; #endif /* GENERIC_NULL_10_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef IN_1_WKS_11_H #define IN_1_WKS_11_H 1 typedef struct dns_rdata_in_wks { dns_rdatacommon_t common; isc_mem_t *mctx; struct in_addr in_addr; isc_uint16_t protocol; unsigned char *map; isc_uint16_t map_len; } dns_rdata_in_wks_t; #endif /* IN_1_WKS_11_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_PTR_12_H #define GENERIC_PTR_12_H 1 typedef struct dns_rdata_ptr { dns_rdatacommon_t common; isc_mem_t *mctx; dns_name_t ptr; } dns_rdata_ptr_t; #endif /* GENERIC_PTR_12_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_HINFO_13_H #define GENERIC_HINFO_13_H 1 typedef struct dns_rdata_hinfo { dns_rdatacommon_t common; isc_mem_t *mctx; char *cpu; char *os; isc_uint8_t cpu_len; isc_uint8_t os_len; } dns_rdata_hinfo_t; #endif /* GENERIC_HINFO_13_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_MINFO_14_H #define GENERIC_MINFO_14_H 1 typedef struct dns_rdata_minfo { dns_rdatacommon_t common; isc_mem_t *mctx; dns_name_t rmailbox; dns_name_t emailbox; } dns_rdata_minfo_t; #endif /* GENERIC_MINFO_14_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_MX_15_H #define GENERIC_MX_15_H 1 typedef struct dns_rdata_mx { dns_rdatacommon_t common; isc_mem_t *mctx; isc_uint16_t pref; dns_name_t mx; } dns_rdata_mx_t; #endif /* GENERIC_MX_15_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_TXT_16_H #define GENERIC_TXT_16_H 1 typedef struct dns_rdata_txt_string { isc_uint8_t length; unsigned char *data; } dns_rdata_txt_string_t; typedef struct dns_rdata_txt { dns_rdatacommon_t common; isc_mem_t *mctx; unsigned char *txt; isc_uint16_t txt_len; /* private */ isc_uint16_t offset; } dns_rdata_txt_t; /* * ISC_LANG_BEGINDECLS and ISC_LANG_ENDDECLS are already done * via rdatastructpre.h and rdatastructsuf.h. */ isc_result_t dns_rdata_txt_first(dns_rdata_txt_t *); isc_result_t dns_rdata_txt_next(dns_rdata_txt_t *); isc_result_t dns_rdata_txt_current(dns_rdata_txt_t *, dns_rdata_txt_string_t *); #endif /* GENERIC_TXT_16_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_RP_17_H #define GENERIC_RP_17_H 1 /*! * \brief Per RFC1183 */ typedef struct dns_rdata_rp { dns_rdatacommon_t common; isc_mem_t *mctx; dns_name_t mail; dns_name_t text; } dns_rdata_rp_t; #endif /* GENERIC_RP_17_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_AFSDB_18_H #define GENERIC_AFSDB_18_H 1 /*! * \brief Per RFC1183 */ typedef struct dns_rdata_afsdb { dns_rdatacommon_t common; isc_mem_t *mctx; isc_uint16_t subtype; dns_name_t server; } dns_rdata_afsdb_t; #endif /* GENERIC_AFSDB_18_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_X25_19_H #define GENERIC_X25_19_H 1 /*! * \brief Per RFC1183 */ typedef struct dns_rdata_x25 { dns_rdatacommon_t common; isc_mem_t *mctx; unsigned char *x25; isc_uint8_t x25_len; } dns_rdata_x25_t; #endif /* GENERIC_X25_19_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_ISDN_20_H #define GENERIC_ISDN_20_H 1 /*! * \brief Per RFC1183 */ typedef struct dns_rdata_isdn { dns_rdatacommon_t common; isc_mem_t *mctx; char *isdn; char *subaddress; isc_uint8_t isdn_len; isc_uint8_t subaddress_len; } dns_rdata_isdn_t; #endif /* GENERIC_ISDN_20_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_RT_21_H #define GENERIC_RT_21_H 1 /*! * \brief Per RFC1183 */ typedef struct dns_rdata_rt { dns_rdatacommon_t common; isc_mem_t *mctx; isc_uint16_t preference; dns_name_t host; } dns_rdata_rt_t; #endif /* GENERIC_RT_21_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef IN_1_NSAP_22_H #define IN_1_NSAP_22_H 1 /*! * \brief Per RFC1706 */ typedef struct dns_rdata_in_nsap { dns_rdatacommon_t common; isc_mem_t *mctx; unsigned char *nsap; isc_uint16_t nsap_len; } dns_rdata_in_nsap_t; #endif /* IN_1_NSAP_22_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef IN_1_NSAP_PTR_23_H #define IN_1_NSAP_PTR_23_H 1 /*! * \brief Per RFC1348. Obsoleted in RFC 1706 - use PTR instead. */ typedef struct dns_rdata_in_nsap_ptr { dns_rdatacommon_t common; isc_mem_t *mctx; dns_name_t owner; } dns_rdata_in_nsap_ptr_t; #endif /* IN_1_NSAP_PTR_23_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_SIG_24_H #define GENERIC_SIG_24_H 1 /*! * \brief Per RFC2535 */ typedef struct dns_rdata_sig_t { dns_rdatacommon_t common; isc_mem_t * mctx; dns_rdatatype_t covered; dns_secalg_t algorithm; isc_uint8_t labels; isc_uint32_t originalttl; isc_uint32_t timeexpire; isc_uint32_t timesigned; isc_uint16_t keyid; dns_name_t signer; isc_uint16_t siglen; unsigned char * signature; } dns_rdata_sig_t; #endif /* GENERIC_SIG_24_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_KEY_25_H #define GENERIC_KEY_25_H 1 /*! * \brief Per RFC2535 */ typedef struct dns_rdata_key { dns_rdatacommon_t common; isc_mem_t * mctx; isc_uint16_t flags; isc_uint8_t protocol; isc_uint8_t algorithm; isc_uint16_t datalen; unsigned char * data; } dns_rdata_key_t; #endif /* GENERIC_KEY_25_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef IN_1_PX_26_H #define IN_1_PX_26_H 1 /*! * \brief Per RFC2163 */ typedef struct dns_rdata_in_px { dns_rdatacommon_t common; isc_mem_t *mctx; isc_uint16_t preference; dns_name_t map822; dns_name_t mapx400; } dns_rdata_in_px_t; #endif /* IN_1_PX_26_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_GPOS_27_H #define GENERIC_GPOS_27_H 1 /*! * \brief per RFC1712 */ typedef struct dns_rdata_gpos { dns_rdatacommon_t common; isc_mem_t *mctx; char *longitude; char *latitude; char *altitude; isc_uint8_t long_len; isc_uint8_t lat_len; isc_uint8_t alt_len; } dns_rdata_gpos_t; #endif /* GENERIC_GPOS_27_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef IN_1_AAAA_28_H #define IN_1_AAAA_28_H 1 /*! * \brief Per RFC1886 */ typedef struct dns_rdata_in_aaaa { dns_rdatacommon_t common; struct in6_addr in6_addr; } dns_rdata_in_aaaa_t; #endif /* IN_1_AAAA_28_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_LOC_29_H #define GENERIC_LOC_29_H 1 /*! * \brief Per RFC1876 */ typedef struct dns_rdata_loc_0 { isc_uint8_t version; /* must be first and zero */ isc_uint8_t size; isc_uint8_t horizontal; isc_uint8_t vertical; isc_uint32_t latitude; isc_uint32_t longitude; isc_uint32_t altitude; } dns_rdata_loc_0_t; typedef struct dns_rdata_loc { dns_rdatacommon_t common; union { dns_rdata_loc_0_t v0; } v; } dns_rdata_loc_t; #endif /* GENERIC_LOC_29_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_NXT_30_H #define GENERIC_NXT_30_H 1 /*! * \brief RFC2535 */ typedef struct dns_rdata_nxt { dns_rdatacommon_t common; isc_mem_t *mctx; dns_name_t next; unsigned char *typebits; isc_uint16_t len; } dns_rdata_nxt_t; #endif /* GENERIC_NXT_30_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef IN_1_SRV_33_H #define IN_1_SRV_33_H 1 /*! * \brief Per RFC2782 */ typedef struct dns_rdata_in_srv { dns_rdatacommon_t common; isc_mem_t *mctx; isc_uint16_t priority; isc_uint16_t weight; isc_uint16_t port; dns_name_t target; } dns_rdata_in_srv_t; #endif /* IN_1_SRV_33_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_NAPTR_35_H #define GENERIC_NAPTR_35_H 1 /*! * \brief Per RFC2915 */ typedef struct dns_rdata_naptr { dns_rdatacommon_t common; isc_mem_t *mctx; isc_uint16_t order; isc_uint16_t preference; char *flags; isc_uint8_t flags_len; char *service; isc_uint8_t service_len; char *regexp; isc_uint8_t regexp_len; dns_name_t replacement; } dns_rdata_naptr_t; #endif /* GENERIC_NAPTR_35_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef IN_1_KX_36_H #define IN_1_KX_36_H 1 /*! * \brief Per RFC2230 */ typedef struct dns_rdata_in_kx { dns_rdatacommon_t common; isc_mem_t *mctx; isc_uint16_t preference; dns_name_t exchange; } dns_rdata_in_kx_t; #endif /* IN_1_KX_36_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_CERT_37_H #define GENERIC_CERT_37_H 1 /*% RFC2538 */ typedef struct dns_rdata_cert { dns_rdatacommon_t common; isc_mem_t *mctx; isc_uint16_t type; isc_uint16_t key_tag; isc_uint8_t algorithm; isc_uint16_t length; unsigned char *certificate; } dns_rdata_cert_t; #endif /* GENERIC_CERT_37_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef IN_1_A6_38_H #define IN_1_A6_38_H 1 /*! * \brief Per RFC2874 */ typedef struct dns_rdata_in_a6 { dns_rdatacommon_t common; isc_mem_t *mctx; dns_name_t prefix; isc_uint8_t prefixlen; struct in6_addr in6_addr; } dns_rdata_in_a6_t; #endif /* IN_1_A6_38_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_DNAME_39_H #define GENERIC_DNAME_39_H 1 /*! * \brief per RFC2672 */ typedef struct dns_rdata_dname { dns_rdatacommon_t common; isc_mem_t *mctx; dns_name_t dname; } dns_rdata_dname_t; #endif /* GENERIC_DNAME_39_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_SINK_40_H #define GENERIC_SINK_40_H 1 typedef struct dns_rdata_sink_t { dns_rdatacommon_t common; isc_mem_t * mctx; isc_uint8_t meaning; isc_uint8_t coding; isc_uint8_t subcoding; isc_uint16_t datalen; unsigned char * data; } dns_rdata_sink_t; #endif /* GENERIC_SINK_40_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_OPT_41_H #define GENERIC_OPT_41_H 1 /*! * \brief Per RFC2671 */ typedef struct dns_rdata_opt_opcode { isc_uint16_t opcode; isc_uint16_t length; unsigned char *data; } dns_rdata_opt_opcode_t; typedef struct dns_rdata_opt { dns_rdatacommon_t common; isc_mem_t *mctx; unsigned char *options; isc_uint16_t length; /* private */ isc_uint16_t offset; } dns_rdata_opt_t; /* * ISC_LANG_BEGINDECLS and ISC_LANG_ENDDECLS are already done * via rdatastructpre.h and rdatastructsuf.h. */ isc_result_t dns_rdata_opt_first(dns_rdata_opt_t *); isc_result_t dns_rdata_opt_next(dns_rdata_opt_t *); isc_result_t dns_rdata_opt_current(dns_rdata_opt_t *, dns_rdata_opt_opcode_t *); #endif /* GENERIC_OPT_41_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef IN_1_APL_42_H #define IN_1_APL_42_H 1 typedef struct dns_rdata_apl_ent { isc_boolean_t negative; isc_uint16_t family; isc_uint8_t prefix; isc_uint8_t length; unsigned char *data; } dns_rdata_apl_ent_t; typedef struct dns_rdata_in_apl { dns_rdatacommon_t common; isc_mem_t *mctx; /* type & class specific elements */ unsigned char *apl; isc_uint16_t apl_len; /* private */ isc_uint16_t offset; } dns_rdata_in_apl_t; /* * ISC_LANG_BEGINDECLS and ISC_LANG_ENDDECLS are already done * via rdatastructpre.h and rdatastructsuf.h. */ isc_result_t dns_rdata_apl_first(dns_rdata_in_apl_t *); isc_result_t dns_rdata_apl_next(dns_rdata_in_apl_t *); isc_result_t dns_rdata_apl_current(dns_rdata_in_apl_t *, dns_rdata_apl_ent_t *); unsigned int dns_rdata_apl_count(const dns_rdata_in_apl_t *apl); #endif /* IN_1_APL_42_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_DS_43_H #define GENERIC_DS_43_H 1 /*! * \brief per draft-ietf-dnsext-delegation-signer-05.txt */ typedef struct dns_rdata_ds { dns_rdatacommon_t common; isc_mem_t *mctx; isc_uint16_t key_tag; isc_uint8_t algorithm; isc_uint8_t digest_type; isc_uint16_t length; unsigned char *digest; } dns_rdata_ds_t; #endif /* GENERIC_DS_43_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! * \brief Per RFC 4255 */ #ifndef GENERIC_SSHFP_44_H #define GENERIC_SSHFP_44_H 1 typedef struct dns_rdata_sshfp { dns_rdatacommon_t common; isc_mem_t *mctx; isc_uint8_t algorithm; isc_uint8_t digest_type; isc_uint16_t length; unsigned char *digest; } dns_rdata_sshfp_t; #endif /* GENERIC_SSHFP_44_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_IPSECKEY_45_H #define GENERIC_IPSECKEY_45_H 1 typedef struct dns_rdata_ipseckey { dns_rdatacommon_t common; isc_mem_t *mctx; isc_uint8_t precedence; isc_uint8_t gateway_type; isc_uint8_t algorithm; struct in_addr in_addr; /* gateway type 1 */ struct in6_addr in6_addr; /* gateway type 2 */ dns_name_t gateway; /* gateway type 3 */ unsigned char *key; isc_uint16_t keylength; } dns_rdata_ipseckey_t; #endif /* GENERIC_IPSECKEY_45_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_DNSSIG_46_H #define GENERIC_DNSSIG_46_H 1 /*! * \brief Per RFC2535 */ typedef struct dns_rdata_rrsig { dns_rdatacommon_t common; isc_mem_t * mctx; dns_rdatatype_t covered; dns_secalg_t algorithm; isc_uint8_t labels; isc_uint32_t originalttl; isc_uint32_t timeexpire; isc_uint32_t timesigned; isc_uint16_t keyid; dns_name_t signer; isc_uint16_t siglen; unsigned char * signature; } dns_rdata_rrsig_t; #endif /* GENERIC_DNSSIG_46_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_NSEC_47_H #define GENERIC_NSEC_47_H 1 /*! * \brief Per RFC 3845 */ typedef struct dns_rdata_nsec { dns_rdatacommon_t common; isc_mem_t *mctx; dns_name_t next; unsigned char *typebits; isc_uint16_t len; } dns_rdata_nsec_t; #endif /* GENERIC_NSEC_47_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_DNSKEY_48_H #define GENERIC_DNSKEY_48_H 1 /*! * \brief per RFC2535 */ typedef struct dns_rdata_key dns_rdata_dnskey_t; #endif /* GENERIC_DNSKEY_48_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef IN_1_DHCID_49_H #define IN_1_DHCID_49_H 1 typedef struct dns_rdata_in_dhcid { dns_rdatacommon_t common; isc_mem_t *mctx; unsigned char *dhcid; unsigned int length; } dns_rdata_in_dhcid_t; #endif /* IN_1_DHCID_49_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_NSEC3_50_H #define GENERIC_NSEC3_50_H 1 /*! * \brief Per RFC 5155 */ #include <isc/iterated_hash.h> typedef struct dns_rdata_nsec3 { dns_rdatacommon_t common; isc_mem_t *mctx; dns_hash_t hash; unsigned char flags; dns_iterations_t iterations; unsigned char salt_length; unsigned char next_length; isc_uint16_t len; unsigned char *salt; unsigned char *next; unsigned char *typebits; } dns_rdata_nsec3_t; /* * The corresponding NSEC3 interval is OPTOUT indicating possible * insecure delegations. */ #define DNS_NSEC3FLAG_OPTOUT 0x01U /*% * The following flags are used in the private-type record (implemented in * lib/dns/private.c) which is used to store NSEC3PARAM data during the * time when it is not legal to have an actual NSEC3PARAM record in the * zone. They are defined here because the private-type record uses the * same flags field for the OPTOUT flag above and for the private flags * below. XXX: This should be considered for refactoring. */ /*% * Non-standard, private type only. * * Create a corresponding NSEC3 chain. * Once the NSEC3 chain is complete this flag will be removed to signal * that there is a complete chain. * * This flag is automatically set when a NSEC3PARAM record is added to * the zone via UPDATE. * * NSEC3PARAM records containing this flag should never be published, * but if they are, they should be ignored by RFC 5155 compliant * nameservers. */ #define DNS_NSEC3FLAG_CREATE 0x80U /*% * Non-standard, private type only. * * The corresponding NSEC3 set is to be removed once the NSEC chain * has been generated. * * This flag is automatically set when the last active NSEC3PARAM record * is removed from the zone via UPDATE. * * NSEC3PARAM records containing this flag should never be published, * but if they are, they should be ignored by RFC 5155 compliant * nameservers. */ #define DNS_NSEC3FLAG_REMOVE 0x40U /*% * Non-standard, private type only. * * When set with the CREATE flag, a corresponding NSEC3 chain will be * created when the zone becomes capable of supporting one (i.e., when it * has a DNSKEY RRset containing at least one NSEC3-capable algorithm). * Without this flag, NSEC3 chain creation would be attempted immediately, * fail, and the private type record would be removed. With it, the NSEC3 * parameters are stored until they can be used. When the zone has the * necessary prerequisites for NSEC3, then the INITIAL flag can be cleared, * and the record will be cleaned up normally. * * NSEC3PARAM records containing this flag should never be published, but * if they are, they should be ignored by RFC 5155 compliant nameservers. */ #define DNS_NSEC3FLAG_INITIAL 0x20U /*% * Non-standard, private type only. * * Prevent the creation of a NSEC chain before the last NSEC3 chain * is removed. This will normally only be set when the zone is * transitioning from secure with NSEC3 chains to insecure. * * NSEC3PARAM records containing this flag should never be published, * but if they are, they should be ignored by RFC 5155 compliant * nameservers. */ #define DNS_NSEC3FLAG_NONSEC 0x10U #endif /* GENERIC_NSEC3_50_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_NSEC3PARAM_51_H #define GENERIC_NSEC3PARAM_51_H 1 /*! * \brief Per RFC 5155 */ #include <isc/iterated_hash.h> typedef struct dns_rdata_nsec3param { dns_rdatacommon_t common; isc_mem_t *mctx; dns_hash_t hash; unsigned char flags; /* DNS_NSEC3FLAG_* */ dns_iterations_t iterations; unsigned char salt_length; unsigned char *salt; } dns_rdata_nsec3param_t; #endif /* GENERIC_NSEC3PARAM_51_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_TLSA_52_H #define GENERIC_TLSA_52_H 1 /*! * \brief per rfc6698.txt */ typedef struct dns_rdata_tlsa { dns_rdatacommon_t common; isc_mem_t *mctx; isc_uint8_t usage; isc_uint8_t selector; isc_uint8_t match; isc_uint16_t length; unsigned char *data; } dns_rdata_tlsa_t; #endif /* GENERIC_TLSA_52_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_SMIMEA_53_H #define GENERIC_SMIMEA_53_H 1 typedef struct dns_rdata_tlsa dns_rdata_smimea_t; #endif /* GENERIC_SMIMEA_53_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_HIP_5_H #define GENERIC_HIP_5_H 1 /* RFC 5205 */ typedef struct dns_rdata_hip { dns_rdatacommon_t common; isc_mem_t * mctx; unsigned char * hit; unsigned char * key; unsigned char * servers; isc_uint8_t algorithm; isc_uint8_t hit_len; isc_uint16_t key_len; isc_uint16_t servers_len; /* Private */ isc_uint16_t offset; } dns_rdata_hip_t; isc_result_t dns_rdata_hip_first(dns_rdata_hip_t *); isc_result_t dns_rdata_hip_next(dns_rdata_hip_t *); void dns_rdata_hip_current(dns_rdata_hip_t *, dns_name_t *); #endif /* GENERIC_HIP_5_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_NINFO_56_H #define GENERIC_NINFO_56_H 1 typedef struct dns_rdata_txt_string dns_rdata_ninfo_string_t; typedef struct dns_rdata_txt dns_rdata_ninfo_t; /* * ISC_LANG_BEGINDECLS and ISC_LANG_ENDDECLS are already done * via rdatastructpre.h and rdatastructsuf.h. */ isc_result_t dns_rdata_ninfo_first(dns_rdata_ninfo_t *); isc_result_t dns_rdata_ninfo_next(dns_rdata_ninfo_t *); isc_result_t dns_rdata_ninfo_current(dns_rdata_ninfo_t *, dns_rdata_ninfo_string_t *); #endif /* GENERIC_NINFO_16_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_RKEY_57_H #define GENERIC_RKEY_57_H 1 typedef struct dns_rdata_key dns_rdata_rkey_t; #endif /* GENERIC_RKEY_57_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* http://www.iana.org/assignments/dns-parameters/TALINK/talink-completed-template */ #ifndef GENERIC_TALINK_58_H #define GENERIC_TALINK_58_H 1 typedef struct dns_rdata_talink { dns_rdatacommon_t common; isc_mem_t *mctx; dns_name_t prev; dns_name_t next; } dns_rdata_talink_t; #endif /* GENERIC_TALINK_58_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_CDS_59_H #define GENERIC_CDS_59_H 1 /* CDS records have the same RDATA fields as DS records. */ typedef struct dns_rdata_ds dns_rdata_cds_t; #endif /* GENERIC_CDS_59_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_CDNSKEY_60_H #define GENERIC_CDNSKEY_60_H 1 /* CDNSKEY records have the same RDATA fields as DNSKEY records. */ typedef struct dns_rdata_key dns_rdata_cdnskey_t; #endif /* GENERIC_CDNSKEY_60_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_OPENPGPKEY_61_H #define GENERIC_OPENPGPKEY_61_H 1 typedef struct dns_rdata_openpgpkey { dns_rdatacommon_t common; isc_mem_t * mctx; isc_uint16_t length; unsigned char * keyring; } dns_rdata_openpgpkey_t; #endif /* GENERIC_OPENPGPKEY_61_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_CSYNC_62_H #define GENERIC_CSYNC_62_H 1 /*! * \brief Per RFC 7477 */ typedef struct dns_rdata_csync { dns_rdatacommon_t common; isc_mem_t *mctx; isc_uint32_t serial; isc_uint16_t flags; unsigned char *typebits; isc_uint16_t len; } dns_rdata_csync_t; #endif /* GENERIC_CSYNC_62_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_SPF_99_H #define GENERIC_SPF_99_H 1 typedef struct dns_rdata_spf_string { isc_uint8_t length; unsigned char *data; } dns_rdata_spf_string_t; typedef struct dns_rdata_spf { dns_rdatacommon_t common; isc_mem_t *mctx; unsigned char *txt; isc_uint16_t txt_len; /* private */ isc_uint16_t offset; } dns_rdata_spf_t; /* * ISC_LANG_BEGINDECLS and ISC_LANG_ENDDECLS are already done * via rdatastructpre.h and rdatastructsuf.h. */ #endif /* GENERIC_SPF_99_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_UNSPEC_103_H #define GENERIC_UNSPEC_103_H 1 typedef struct dns_rdata_unspec_t { dns_rdatacommon_t common; isc_mem_t *mctx; unsigned char *data; isc_uint16_t datalen; } dns_rdata_unspec_t; #endif /* GENERIC_UNSPEC_103_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_NID_104_H #define GENERIC_NID_104_H 1 typedef struct dns_rdata_nid { dns_rdatacommon_t common; isc_uint16_t pref; unsigned char nid[8]; } dns_rdata_nid_t; #endif /* GENERIC_NID_104_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_L32_105_H #define GENERIC_L32_105_H 1 typedef struct dns_rdata_l32 { dns_rdatacommon_t common; isc_uint16_t pref; struct in_addr l32; } dns_rdata_l32_t; #endif /* GENERIC_L32_105_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_L64_106_H #define GENERIC_L64_106_H 1 typedef struct dns_rdata_l64 { dns_rdatacommon_t common; isc_uint16_t pref; unsigned char l64[8]; } dns_rdata_l64_t; #endif /* GENERIC_L64_106_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_LP_107_H #define GENERIC_LP_107_H 1 typedef struct dns_rdata_lp { dns_rdatacommon_t common; isc_mem_t *mctx; isc_uint16_t pref; dns_name_t lp; } dns_rdata_lp_t; #endif /* GENERIC_LP_107_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_EUI48_108_H #define GENERIC_EUI48_108_H 1 typedef struct dns_rdata_eui48 { dns_rdatacommon_t common; unsigned char eui48[6]; } dns_rdata_eui48_t; #endif /* GENERIC_EUI48_10k_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* */ #ifndef GENERIC_EUI64_109_H #define GENERIC_EUI64_109_H 1 typedef struct dns_rdata_eui64 { dns_rdatacommon_t common; unsigned char eui64[8]; } dns_rdata_eui64_t; #endif /* GENERIC_EUI64_10k_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_TKEY_249_H #define GENERIC_TKEY_249_H 1 /*! * \brief Per draft-ietf-dnsind-tkey-00.txt */ typedef struct dns_rdata_tkey { dns_rdatacommon_t common; isc_mem_t * mctx; dns_name_t algorithm; isc_uint32_t inception; isc_uint32_t expire; isc_uint16_t mode; isc_uint16_t error; isc_uint16_t keylen; unsigned char * key; isc_uint16_t otherlen; unsigned char * other; } dns_rdata_tkey_t; #endif /* GENERIC_TKEY_249_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ANY_255_TSIG_250_H #define ANY_255_TSIG_250_H 1 /*% RFC2845 */ typedef struct dns_rdata_any_tsig { dns_rdatacommon_t common; isc_mem_t * mctx; dns_name_t algorithm; isc_uint64_t timesigned; isc_uint16_t fudge; isc_uint16_t siglen; unsigned char * signature; isc_uint16_t originalid; isc_uint16_t error; isc_uint16_t otherlen; unsigned char * other; } dns_rdata_any_tsig_t; #endif /* ANY_255_TSIG_250_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_URI_256_H #define GENERIC_URI_256_H 1 typedef struct dns_rdata_uri { dns_rdatacommon_t common; isc_mem_t * mctx; isc_uint16_t priority; isc_uint16_t weight; unsigned char * target; isc_uint16_t tgt_len; } dns_rdata_uri_t; #endif /* GENERIC_URI_256_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_CAA_257_H #define GENERIC_CAA_257_H 1 typedef struct dns_rdata_caa { dns_rdatacommon_t common; isc_mem_t * mctx; isc_uint8_t flags; unsigned char * tag; isc_uint8_t tag_len; unsigned char *value; isc_uint16_t value_len; } dns_rdata_caa_t; #endif /* GENERIC_CAA_257_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_AVC_258_H #define GENERIC_AVC_258_H 1 typedef dns_rdata_txt_string_t dns_rdata_avc_string_t; typedef struct dns_rdata_avc { dns_rdatacommon_t common; isc_mem_t *mctx; unsigned char *data; isc_uint16_t length; /* private */ isc_uint16_t offset; } dns_rdata_avc_t; /* * ISC_LANG_BEGINDECLS and ISC_LANG_ENDDECLS are already done * via rdatastructpre.h and rdatastructsuf.h. */ #endif /* GENERIC_AVC_258_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_DOA_259_H #define GENERIC_DOA_259_H 1 typedef struct dns_rdata_doa { dns_rdatacommon_t common; isc_mem_t * mctx; unsigned char * mediatype; unsigned char * data; isc_uint32_t enterprise; isc_uint32_t type; isc_uint16_t data_len; isc_uint8_t location; isc_uint8_t mediatype_len; } dns_rdata_doa_t; #endif /* GENERIC_DOA_259_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_TA_32768_H #define GENERIC_TA_32768_H 1 /* * TA records are identical to DS records. */ typedef struct dns_rdata_ds dns_rdata_ta_t; #endif /* GENERIC_TA_32768_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* draft-ietf-dnsext-delegation-signer-05.txt */ #ifndef GENERIC_DLV_32769_H #define GENERIC_DLV_32769_H 1 typedef struct dns_rdata_ds dns_rdata_dlv_t; #endif /* GENERIC_DLV_32769_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef GENERIC_KEYDATA_65533_H #define GENERIC_KEYDATA_65533_H 1 typedef struct dns_rdata_keydata { dns_rdatacommon_t common; isc_mem_t * mctx; isc_uint32_t refresh; /* Timer for refreshing data */ isc_uint32_t addhd; /* Hold-down timer for adding */ isc_uint32_t removehd; /* Hold-down timer for removing */ isc_uint16_t flags; /* Copy of DNSKEY_48 */ isc_uint8_t protocol; isc_uint8_t algorithm; isc_uint16_t datalen; unsigned char * data; } dns_rdata_keydata_t; #endif /* GENERIC_KEYDATA_65533_H */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ ISC_LANG_ENDDECLS #endif /* DNS_RDATASTRUCT_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/soa.h�������������������������������������������������������������������������������������0000644�����������������00000004256�14763166026�0007312 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_SOA_H #define DNS_SOA_H 1 /***** ***** Module Info *****/ /*! \file dns/soa.h * \brief * SOA utilities. */ /*** *** Imports ***/ #include <isc/lang.h> #include <isc/types.h> #include <dns/types.h> ISC_LANG_BEGINDECLS #define DNS_SOA_BUFFERSIZE ((2 * DNS_NAME_MAXWIRE) + (4 * 5)) isc_result_t dns_soa_buildrdata(dns_name_t *origin, dns_name_t *contact, dns_rdataclass_t rdclass, isc_uint32_t serial, isc_uint32_t refresh, isc_uint32_t retry, isc_uint32_t expire, isc_uint32_t minimum, unsigned char *buffer, dns_rdata_t *rdata); /*%< * Build the rdata of an SOA record. * * Requires: *\li buffer Points to a temporary buffer of at least * DNS_SOA_BUFFERSIZE bytes. *\li rdata Points to an initialized dns_rdata_t. * * Ensures: * \li *rdata Contains a valid SOA rdata. The 'data' member * refers to 'buffer'. */ isc_uint32_t dns_soa_getserial(dns_rdata_t *rdata); isc_uint32_t dns_soa_getrefresh(dns_rdata_t *rdata); isc_uint32_t dns_soa_getretry(dns_rdata_t *rdata); isc_uint32_t dns_soa_getexpire(dns_rdata_t *rdata); isc_uint32_t dns_soa_getminimum(dns_rdata_t *rdata); /* * Extract an integer field from the rdata of a SOA record. * * Requires: * rdata refers to the rdata of a well-formed SOA record. */ void dns_soa_setserial(isc_uint32_t val, dns_rdata_t *rdata); void dns_soa_setrefresh(isc_uint32_t val, dns_rdata_t *rdata); void dns_soa_setretry(isc_uint32_t val, dns_rdata_t *rdata); void dns_soa_setexpire(isc_uint32_t val, dns_rdata_t *rdata); void dns_soa_setminimum(isc_uint32_t val, dns_rdata_t *rdata); /* * Change an integer field of a SOA record by modifying the * rdata in-place. * * Requires: * rdata refers to the rdata of a well-formed SOA record. */ ISC_LANG_ENDDECLS #endif /* DNS_SOA_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/rdataclass.h������������������������������������������������������������������������������0000644�����������������00000004320�14763166026�0010641 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_RDATACLASS_H #define DNS_RDATACLASS_H 1 /*! \file dns/rdataclass.h */ #include <isc/lang.h> #include <dns/types.h> ISC_LANG_BEGINDECLS isc_result_t dns_rdataclass_fromtext(dns_rdataclass_t *classp, isc_textregion_t *source); /*%< * Convert the text 'source' refers to into a DNS class. * * Requires: *\li 'classp' is a valid pointer. * *\li 'source' is a valid text region. * * Returns: *\li #ISC_R_SUCCESS on success *\li #DNS_R_UNKNOWN class is unknown */ isc_result_t dns_rdataclass_totext(dns_rdataclass_t rdclass, isc_buffer_t *target); /*%< * Put a textual representation of class 'rdclass' into 'target'. * * Requires: *\li 'rdclass' is a valid class. * *\li 'target' is a valid text buffer. * * Ensures, * if the result is success: *\li The used space in 'target' is updated. * * Returns: *\li #ISC_R_SUCCESS on success *\li #ISC_R_NOSPACE target buffer is too small */ isc_result_t dns_rdataclass_tounknowntext(dns_rdataclass_t rdclass, isc_buffer_t *target); /*%< * Put textual RFC3597 CLASSXXXX representation of class 'rdclass' into * 'target'. * * Requires: *\li 'rdclass' is a valid class. * *\li 'target' is a valid text buffer. * * Ensures, * if the result is success: *\li The used space in 'target' is updated. * * Returns: *\li #ISC_R_SUCCESS on success *\li #ISC_R_NOSPACE target buffer is too small */ void dns_rdataclass_format(dns_rdataclass_t rdclass, char *array, unsigned int size); /*%< * Format a human-readable representation of the class 'rdclass' * into the character array 'array', which is of size 'size'. * The resulting string is guaranteed to be null-terminated. */ #define DNS_RDATACLASS_FORMATSIZE sizeof("CLASS65535") /*%< * Minimum size of array to pass to dns_rdataclass_format(). */ ISC_LANG_ENDDECLS #endif /* DNS_RDATACLASS_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/client.h����������������������������������������������������������������������������������0000644�����������������00000053030�14763166026�0010000 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_CLIENT_H #define DNS_CLIENT_H 1 /***** ***** Module Info *****/ /*! \file * * \brief * The DNS client module provides convenient programming interfaces to various * DNS services, such as name resolution with or without DNSSEC validation or * dynamic DNS update. This module is primarily expected to be used by other * applications than BIND9-related ones that need such advanced DNS features. * * MP: *\li In the typical usage of this module, application threads will not share * the same data structures created and manipulated in this module. * However, the module still ensures appropriate synchronization of such * data structures. * * Resources: *\li TBS * * Security: *\li This module does not handle any low-level data directly, and so no * security issue specific to this module is anticipated. */ #include <isc/event.h> #include <isc/sockaddr.h> #include <dns/tsig.h> #include <dns/types.h> #include <dst/dst.h> typedef enum { updateop_none = 0, updateop_add = 1, updateop_delete = 2, updateop_exist = 3, updateop_notexist = 4, updateop_max = 5 } dns_client_updateop_t; ISC_LANG_BEGINDECLS /*** *** Types ***/ /*% * Optional flags for dns_client_create(x). */ /*%< Enable caching resolution results (experimental). */ #define DNS_CLIENTCREATEOPT_USECACHE 0x8000 /*% * Optional flags for dns_client_(start)resolve. */ /*%< Do not return DNSSEC data (e.g. RRSIGS) with response. */ #define DNS_CLIENTRESOPT_NODNSSEC 0x01 /*%< Allow running external context. */ #define DNS_CLIENTRESOPT_ALLOWRUN 0x02 /*%< Don't validate responses. */ #define DNS_CLIENTRESOPT_NOVALIDATE 0x04 /*%< Don't set the CD flag on upstream queries. */ #define DNS_CLIENTRESOPT_NOCDFLAG 0x08 /*%< Use TCP transport. */ #define DNS_CLIENTRESOPT_TCP 0x10 /*% * Optional flags for dns_client_(start)request. */ /*%< Allow running external context. */ #define DNS_CLIENTREQOPT_ALLOWRUN 0x01 /*%< Use TCP transport. */ #define DNS_CLIENTREQOPT_TCP 0x02 /*% * Optional flags for dns_client_(start)update. */ /*%< Allow running external context. */ #define DNS_CLIENTUPDOPT_ALLOWRUN 0x01 /*%< Use TCP transport. */ #define DNS_CLIENTUPDOPT_TCP 0x02 /*% * A dns_clientresevent_t is sent when name resolution performed by a client * completes. 'result' stores the result code of the entire resolution * procedure. 'vresult' specifically stores the result code of DNSSEC * validation if it is performed. When name resolution successfully completes, * 'answerlist' is typically non empty, containing answer names along with * RRsets. It is the receiver's responsibility to free this list by calling * dns_client_freeresanswer() before freeing the event structure. */ typedef struct dns_clientresevent { ISC_EVENT_COMMON(struct dns_clientresevent); isc_result_t result; isc_result_t vresult; dns_namelist_t answerlist; } dns_clientresevent_t; /* too long? */ /*% * Status of a dynamic update procedure. */ typedef enum { dns_clientupdatestate_prepare, /*%< no updates have been sent */ dns_clientupdatestate_sent, /*%< updates were sent, no response */ dns_clientupdatestate_done /*%< update was sent and succeeded */ } dns_clientupdatestate_t; /*% * A dns_clientreqevent_t is sent when a DNS request is completed by a client. * 'result' stores the result code of the entire transaction. * If the transaction is successfully completed but the response packet cannot * be parsed, 'result' will store the result code of dns_message_parse(). * If the response packet is received, 'rmessage' will contain the response * message, whether it is successfully parsed or not. */ typedef struct dns_clientreqevent { ISC_EVENT_COMMON(struct dns_clientreqevent); isc_result_t result; dns_message_t *rmessage; } dns_clientreqevent_t; /* too long? */ /*% * A dns_clientupdateevent_t is sent when dynamic update performed by a client * completes. 'result' stores the result code of the entire update procedure. * 'state' specifies the status of the update procedure when this event is * sent. This can be used as a hint by the receiver to determine whether * the update attempt was ever made. In particular, if the state is * dns_clientupdatestate_prepare, the receiver can be sure that the requested * update was not applied. */ typedef struct dns_clientupdateevent { ISC_EVENT_COMMON(struct dns_clientupdateevent); isc_result_t result; dns_clientupdatestate_t state; } dns_clientupdateevent_t; /* too long? */ isc_result_t dns_client_create(dns_client_t **clientp, unsigned int options); isc_result_t dns_client_createx(isc_mem_t *mctx, isc_appctx_t *actx, isc_taskmgr_t *taskmgr, isc_socketmgr_t *socketmgr, isc_timermgr_t *timermgr, unsigned int options, dns_client_t **clientp); isc_result_t dns_client_createx2(isc_mem_t *mctx, isc_appctx_t *actx, isc_taskmgr_t *taskmgr, isc_socketmgr_t *socketmgr, isc_timermgr_t *timermgr, unsigned int options, dns_client_t **clientp, isc_sockaddr_t *localaddr4, isc_sockaddr_t *localaddr6); /*%< * Create a DNS client. These functions create a new client object with * minimal internal resources such as the default 'view' for the IN class and * IPv4/IPv6 dispatches for the view. * * dns_client_createx() takes 'manager' arguments so that the caller can * control the behavior of the client through the underlying event framework. * On the other hand, dns_client_create() simplifies the interface and creates * the managers internally. A DNS client object created via * dns_client_create() is expected to be used by an application that only needs * simple synchronous services or by a thread-based application. * * dns_client_createx2 takes two additional parameters, 'localaddr4' and * 'localaddr6', to specify the local address to use for each family. If * both are set to NULL, then wildcard addresses will be used for both * families. If only one is NULL, then the other address will be used * as the local address, and the other protocol family will not be used. * * If the DNS_CLIENTCREATEOPT_USECACHE flag is set in 'options', * dns_client_create(x) will create a cache database with the view. * * Requires: * *\li 'mctx' is a valid memory context. * *\li 'actx' is a valid application context. * *\li 'taskmgr' is a valid task manager. * *\li 'socketmgr' is a valid socket manager. * *\li 'timermgr' is a valid timer manager. * *\li clientp != NULL && *clientp == NULL. * * Returns: * *\li #ISC_R_SUCCESS On success. * *\li Anything else Failure. */ void dns_client_destroy(dns_client_t **clientp); /*%< * Destroy 'client'. * * Requires: * *\li '*clientp' is a valid client. * * Ensures: * *\li *clientp == NULL. */ isc_result_t dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass, dns_name_t *name_space, isc_sockaddrlist_t *addrs); /*%< * Specify a list of addresses of recursive name servers that the client will * use for name resolution. A view for the 'rdclass' class must be created * beforehand. If 'name_space' is non NULL, the specified server will be used * if and only if the query name is a subdomain of 'name_space'. When servers * for multiple 'name_space's are provided, and a query name is covered by * more than one 'name_space', the servers for the best (longest) matching * name_space will be used. If 'name_space' is NULL, it works as if * dns_rootname (.) were specified. * * Requires: * *\li 'client' is a valid client. * *\li 'name_space' is NULL or a valid name. * *\li 'addrs' != NULL. * * Returns: * *\li #ISC_R_SUCCESS On success. * *\li Anything else Failure. */ isc_result_t dns_client_clearservers(dns_client_t *client, dns_rdataclass_t rdclass, dns_name_t *name_space); /*%< * Remove configured recursive name servers for the 'rdclass' and 'name_space' * from the client. See the description of dns_client_setservers() for * the requirements about 'rdclass' and 'name_space'. * * Requires: * *\li 'client' is a valid client. * *\li 'name_space' is NULL or a valid name. * * Returns: * *\li #ISC_R_SUCCESS On success. * *\li Anything else Failure. */ isc_result_t dns_client_setdlv(dns_client_t *client, dns_rdataclass_t rdclass, const char *dlvname); /*%< * Specify a name to use for DNSSEC lookaside validation. * If a trusted key has been added for that name, then DLV will be * used during validation. If 'dlvname' is NULL, then DLV will no * longer be used for this client. * * Requires: * *\li 'client' is a valid client. * * Returns: * *\li #ISC_R_SUCCESS On success. * *\li Anything else Failure. */ isc_result_t dns_client_resolve(dns_client_t *client, dns_name_t *name, dns_rdataclass_t rdclass, dns_rdatatype_t type, unsigned int options, dns_namelist_t *namelist); isc_result_t dns_client_startresolve(dns_client_t *client, dns_name_t *name, dns_rdataclass_t rdclass, dns_rdatatype_t type, unsigned int options, isc_task_t *task, isc_taskaction_t action, void *arg, dns_clientrestrans_t **transp); /*%< * Perform name resolution for 'name', 'rdclass', and 'type'. * * If any trusted keys are configured and the query name is considered to * belong to a secure zone, these functions also validate the responses * using DNSSEC by default. If the DNS_CLIENTRESOPT_NOVALIDATE flag is set * in 'options', DNSSEC validation is disabled regardless of the configured * trusted keys or the query name. With DNS_CLIENTRESOPT_NODNSSEC * DNSSEC data is not returned with response. DNS_CLIENTRESOPT_NOCDFLAG * disables the CD flag on queries, DNS_CLIENTRESOPT_TCP switches to * the TCP (vs. UDP) transport. * * dns_client_resolve() provides a synchronous service. This function starts * name resolution internally and blocks until it completes. On success, * 'namelist' will contain a list of answer names, each of which has * corresponding RRsets. The caller must provide a valid empty list, and * is responsible for freeing the list content via dns_client_freeresanswer(). * If the name resolution fails due to an error in DNSSEC validation, * dns_client_resolve() returns the result code indicating the validation * error. Otherwise, it returns the result code of the entire resolution * process, either success or failure. * * It is typically expected that the client object passed to * dns_client_resolve() was created via dns_client_create() and has its own * managers and contexts. However, if the DNS_CLIENTRESOPT_ALLOWRUN flag is * set in 'options', this function performs the synchronous service even if * it does not have its own manager and context structures. * * dns_client_startresolve() is an asynchronous version of dns_client_resolve() * and does not block. When name resolution is completed, 'action' will be * called with the argument of a 'dns_clientresevent_t' object, which contains * the resulting list of answer names (on success). On return, '*transp' is * set to an opaque transaction ID so that the caller can cancel this * resolution process. * * Requires: * *\li 'client' is a valid client. * *\li 'addrs' != NULL. * *\li 'name' is a valid name. * *\li 'namelist' != NULL and is not empty. * *\li 'task' is a valid task. * *\li 'transp' != NULL && *transp == NULL; * * Returns: * *\li #ISC_R_SUCCESS On success. * *\li Anything else Failure. */ void dns_client_cancelresolve(dns_clientrestrans_t *trans); /*%< * Cancel an ongoing resolution procedure started via * dns_client_startresolve(). * * Notes: * *\li If the resolution procedure has not completed, post its CLIENTRESDONE * event with a result code of #ISC_R_CANCELED. * * Requires: * *\li 'trans' is a valid transaction ID. */ void dns_client_destroyrestrans(dns_clientrestrans_t **transp); /*%< * Destroy name resolution transaction state identified by '*transp'. * * Requires: * *\li '*transp' is a valid transaction ID. * *\li The caller has received the CLIENTRESDONE event (either because the * resolution completed or because dns_client_cancelresolve() was called). * * Ensures: * *\li *transp == NULL. */ void dns_client_freeresanswer(dns_client_t *client, dns_namelist_t *namelist); /*%< * Free resources allocated for the content of 'namelist'. * * Requires: * *\li 'client' is a valid client. * *\li 'namelist' != NULL. */ isc_result_t dns_client_addtrustedkey(dns_client_t *client, dns_rdataclass_t rdclass, dns_name_t *keyname, isc_buffer_t *keydatabuf); /*%< * Add a DNSSEC trusted key for the 'rdclass' class. A view for the 'rdclass' * class must be created beforehand. 'keyname' is the DNS name of the key, * and 'keydatabuf' stores the resource data of the key. * * Requires: * *\li 'client' is a valid client. * *\li 'keyname' is a valid name. * *\li 'keydatabuf' is a valid buffer. * * Returns: * *\li #ISC_R_SUCCESS On success. * *\li Anything else Failure. */ isc_result_t dns_client_request(dns_client_t *client, dns_message_t *qmessage, dns_message_t *rmessage, isc_sockaddr_t *server, unsigned int options, unsigned int parseoptions, dns_tsec_t *tsec, unsigned int timeout, unsigned int udptimeout, unsigned int udpretries); isc_result_t dns_client_startrequest(dns_client_t *client, dns_message_t *qmessage, dns_message_t *rmessage, isc_sockaddr_t *server, unsigned int options, unsigned int parseoptions, dns_tsec_t *tsec, unsigned int timeout, unsigned int udptimeout, unsigned int udpretries, isc_task_t *task, isc_taskaction_t action, void *arg, dns_clientreqtrans_t **transp); /*%< * Send a DNS request containig a query message 'query' to 'server'. * * 'parseoptions' will be used when the response packet is parsed, and will be * passed to dns_message_parse() via dns_request_getresponse(). See * dns_message_parse() for more details. * * 'tsec' is a transaction security object containing, e.g. a TSIG key for * authenticating the request/response transaction. This is optional and can * be NULL, in which case this library performs the transaction without any * transaction authentication. * * 'timeout', 'udptimeout', and 'udpretries' are passed to * dns_request_createvia3(). See dns_request_createvia3() for more details. * * dns_client_request() provides a synchronous service. This function sends * the request and blocks until a response is received. On success, * 'rmessage' will contain the response message. The caller must provide a * valid initialized message. * * It is usually expected that the client object passed to * dns_client_request() was created via dns_client_create() and has its own * managers and contexts. However, if the DNS_CLIENTREQOPT_ALLOWRUN flag is * set in 'options', this function performs the synchronous service even if * it does not have its own manager and context structures. * * dns_client_startrequest() is an asynchronous version of dns_client_request() * and does not block. When the transaction is completed, 'action' will be * called with the argument of a 'dns_clientreqevent_t' object, which contains * the response message (on success). On return, '*transp' is set to an opaque * transaction ID so that the caller can cancel this request. * * DNS_CLIENTREQOPT_TCP switches to the TCP (vs. UDP) transport. * * Requires: * *\li 'client' is a valid client. * *\li 'qmessage' and 'rmessage' are valid initialized message. * *\li 'server' is a valid socket address structure. * *\li 'task' is a valid task. * *\li 'transp' != NULL && *transp == NULL; * * Returns: * *\li #ISC_R_SUCCESS On success. * *\li Anything else Failure. * *\li Any result that dns_message_parse() can return. */ void dns_client_cancelrequest(dns_clientreqtrans_t *transp); /*%< * Cancel an ongoing DNS request procedure started via * dns_client_startrequest(). * * Notes: * *\li If the request procedure has not completed, post its CLIENTREQDONE * event with a result code of #ISC_R_CANCELED. * * Requires: * *\li 'trans' is a valid transaction ID. */ void dns_client_destroyreqtrans(dns_clientreqtrans_t **transp); /*% * Destroy DNS request transaction state identified by '*transp'. * * Requires: * *\li '*transp' is a valid transaction ID. * *\li The caller has received the CLIENTREQDONE event (either because the * request completed or because dns_client_cancelrequest() was called). * * Ensures: * *\li *transp == NULL. */ isc_result_t dns_client_update(dns_client_t *client, dns_rdataclass_t rdclass, dns_name_t *zonename, dns_namelist_t *prerequisites, dns_namelist_t *updates, isc_sockaddrlist_t *servers, dns_tsec_t *tsec, unsigned int options); isc_result_t dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass, dns_name_t *zonename, dns_namelist_t *prerequisites, dns_namelist_t *updates, isc_sockaddrlist_t *servers, dns_tsec_t *tsec, unsigned int options, isc_task_t *task, isc_taskaction_t action, void *arg, dns_clientupdatetrans_t **transp); /*%< * Perform DNS dynamic update for 'updates' of the 'rdclass' class with * optional 'prerequisites'. * * 'updates' are a list of names with associated RRsets to be updated. * * 'prerequisites' are a list of names with associated RRsets corresponding to * the prerequisites of the updates. This is optional and can be NULL, in * which case the prerequisite section of the update message will be empty. * * Both 'updates' and 'prerequisites' must be constructed as specified in * RFC2136. * * 'zonename' is the name of the zone in which the updated names exist. * This is optional and can be NULL. In this case, these functions internally * identify the appropriate zone through some queries for the SOA RR starting * with the first name in prerequisites or updates. * * 'servers' is a list of authoritative servers to which the update message * should be sent. This is optional and can be NULL. In this case, these * functions internally identify the appropriate primary server name and its * addresses through some queries for the SOA RR (like the case of zonename) * and supplemental A/AAAA queries for the server name. * Note: The client module generally assumes the given addresses are of the * primary server of the corresponding zone. It will work even if a secondary * server address is specified as long as the server allows update forwarding, * it is generally discouraged to include secondary server addresses unless * there's strong reason to do so. * * 'tsec' is a transaction security object containing, e.g. a TSIG key for * authenticating the update transaction (and the supplemental query/response * transactions if the server is specified). This is optional and can be * NULL, in which case the library tries the update without any transaction * authentication. * * It is typically expected that the client object passed to * dns_client_update() was created via dns_client_create() and has its own * managers and contexts. However, if the DNS_CLIENTUPDOPT_ALLOWRUN flag is * set in 'options', this function performs the synchronous service even if * it does not have its own manager and context structures. * * dns_client_update() provides a synchronous service. This function blocks * until the entire update procedure completes, including the additional * queries when necessary. * * dns_client_startupdate() is an asynchronous version of dns_client_update(). * It immediately returns (typically with *transp being set to a non-NULL * pointer), and performs the update procedure through a set of internal * events. All transactions including the additional query exchanges are * performed as a separate event, so none of these events cause blocking * operation. When the update procedure completes, the specified function * 'action' will be called with the argument of a 'dns_clientupdateevent_t' * structure. On return, '*transp' is set to an opaque transaction ID so that * the caller can cancel this update process. * * DNS_CLIENTUPDOPT_TCP switches to the TCP (vs. UDP) transport. * * Requires: * *\li 'client' is a valid client. * *\li 'updates' != NULL. * *\li 'task' is a valid task. * *\li 'transp' != NULL && *transp == NULL; * * Returns: * *\li #ISC_R_SUCCESS On success. * *\li Anything else Failure. */ void dns_client_cancelupdate(dns_clientupdatetrans_t *trans); /*%< * Cancel an ongoing dynamic update procedure started via * dns_client_startupdate(). * * Notes: * *\li If the update procedure has not completed, post its UPDATEDONE * event with a result code of #ISC_R_CANCELED. * * Requires: * *\li 'trans' is a valid transaction ID. */ void dns_client_destroyupdatetrans(dns_clientupdatetrans_t **transp); /*%< * Destroy dynamic update transaction identified by '*transp'. * * Requires: * *\li '*transp' is a valid transaction ID. * *\li The caller has received the UPDATEDONE event (either because the * update completed or because dns_client_cancelupdate() was called). * * Ensures: * *\li *transp == NULL. */ isc_result_t dns_client_updaterec(dns_client_updateop_t op, dns_name_t *owner, dns_rdatatype_t type, dns_rdata_t *source, dns_ttl_t ttl, dns_name_t *target, dns_rdataset_t *rdataset, dns_rdatalist_t *rdatalist, dns_rdata_t *rdata, isc_mem_t *mctx); /*%< * TBD */ void dns_client_freeupdate(dns_name_t **namep); /*%< * TBD */ isc_mem_t * dns_client_mctx(dns_client_t *client); ISC_LANG_ENDDECLS #endif /* DNS_CLIENT_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/tsig.h������������������������������������������������������������������������������������0000644�����������������00000020072�14763166026�0007470 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_TSIG_H #define DNS_TSIG_H 1 /*! \file dns/tsig.h */ #include <isc/lang.h> #include <isc/refcount.h> #include <isc/rwlock.h> #include <isc/stdio.h> #include <isc/stdtime.h> #include <pk11/site.h> #include <dns/types.h> #include <dns/name.h> #include <dst/dst.h> /* * Algorithms. */ #ifndef PK11_MD5_DISABLE LIBDNS_EXTERNAL_DATA extern dns_name_t *dns_tsig_hmacmd5_name; #define DNS_TSIG_HMACMD5_NAME dns_tsig_hmacmd5_name #endif LIBDNS_EXTERNAL_DATA extern dns_name_t *dns_tsig_gssapi_name; #define DNS_TSIG_GSSAPI_NAME dns_tsig_gssapi_name LIBDNS_EXTERNAL_DATA extern dns_name_t *dns_tsig_gssapims_name; #define DNS_TSIG_GSSAPIMS_NAME dns_tsig_gssapims_name LIBDNS_EXTERNAL_DATA extern dns_name_t *dns_tsig_hmacsha1_name; #define DNS_TSIG_HMACSHA1_NAME dns_tsig_hmacsha1_name LIBDNS_EXTERNAL_DATA extern dns_name_t *dns_tsig_hmacsha224_name; #define DNS_TSIG_HMACSHA224_NAME dns_tsig_hmacsha224_name LIBDNS_EXTERNAL_DATA extern dns_name_t *dns_tsig_hmacsha256_name; #define DNS_TSIG_HMACSHA256_NAME dns_tsig_hmacsha256_name LIBDNS_EXTERNAL_DATA extern dns_name_t *dns_tsig_hmacsha384_name; #define DNS_TSIG_HMACSHA384_NAME dns_tsig_hmacsha384_name LIBDNS_EXTERNAL_DATA extern dns_name_t *dns_tsig_hmacsha512_name; #define DNS_TSIG_HMACSHA512_NAME dns_tsig_hmacsha512_name /*% * Default fudge value. */ #define DNS_TSIG_FUDGE 300 struct dns_tsig_keyring { dns_rbt_t *keys; unsigned int writecount; isc_rwlock_t lock; isc_mem_t *mctx; /* * LRU list of generated key along with a count of the keys on the * list and a maximum size. */ unsigned int generated; unsigned int maxgenerated; ISC_LIST(dns_tsigkey_t) lru; unsigned int references; }; struct dns_tsigkey { /* Unlocked */ unsigned int magic; /*%< Magic number. */ isc_mem_t *mctx; dst_key_t *key; /*%< Key */ dns_name_t name; /*%< Key name */ dns_name_t *algorithm; /*%< Algorithm name */ dns_name_t *creator; /*%< name that created secret */ isc_boolean_t generated; /*%< was this generated? */ isc_stdtime_t inception; /*%< start of validity period */ isc_stdtime_t expire; /*%< end of validity period */ dns_tsig_keyring_t *ring; /*%< the enclosing keyring */ isc_refcount_t refs; /*%< reference counter */ ISC_LINK(dns_tsigkey_t) link; }; #define dns_tsigkey_identity(tsigkey) \ ((tsigkey) == NULL ? NULL : \ (tsigkey)->generated ? ((tsigkey)->creator) : \ (&((tsigkey)->name))) ISC_LANG_BEGINDECLS isc_result_t dns_tsigkey_create(dns_name_t *name, dns_name_t *algorithm, unsigned char *secret, int length, isc_boolean_t generated, dns_name_t *creator, isc_stdtime_t inception, isc_stdtime_t expire, isc_mem_t *mctx, dns_tsig_keyring_t *ring, dns_tsigkey_t **key); isc_result_t dns_tsigkey_createfromkey(dns_name_t *name, dns_name_t *algorithm, dst_key_t *dstkey, isc_boolean_t generated, dns_name_t *creator, isc_stdtime_t inception, isc_stdtime_t expire, isc_mem_t *mctx, dns_tsig_keyring_t *ring, dns_tsigkey_t **key); /*%< * Creates a tsig key structure and saves it in the keyring. If key is * not NULL, *key will contain a copy of the key. The keys validity * period is specified by (inception, expire), and will not expire if * inception == expire. If the key was generated, the creating identity, * if there is one, should be in the creator parameter. Specifying an * unimplemented algorithm will cause failure only if dstkey != NULL; this * allows a transient key with an invalid algorithm to exist long enough * to generate a BADKEY response. * * If dns_tsigkey_createfromkey is successful a new reference to 'dstkey' * will have been made. * * Requires: *\li 'name' is a valid dns_name_t *\li 'algorithm' is a valid dns_name_t *\li 'secret' is a valid pointer *\li 'length' is an integer >= 0 *\li 'dstkey' is a valid dst key or NULL *\li 'creator' points to a valid dns_name_t or is NULL *\li 'mctx' is a valid memory context *\li 'ring' is a valid TSIG keyring or NULL *\li 'key' or '*key' must be NULL * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_EXISTS - a key with this name already exists *\li #ISC_R_NOTIMPLEMENTED - algorithm is not implemented *\li #ISC_R_NOMEMORY */ void dns_tsigkey_attach(dns_tsigkey_t *source, dns_tsigkey_t **targetp); /*%< * Attach '*targetp' to 'source'. * * Requires: *\li 'key' is a valid TSIG key * * Ensures: *\li *targetp is attached to source. */ void dns_tsigkey_detach(dns_tsigkey_t **keyp); /*%< * Detaches from the tsig key structure pointed to by '*key'. * * Requires: *\li 'keyp' is not NULL and '*keyp' is a valid TSIG key * * Ensures: *\li 'keyp' points to NULL */ void dns_tsigkey_setdeleted(dns_tsigkey_t *key); /*%< * Prevents this key from being used again. It will be deleted when * no references exist. * * Requires: *\li 'key' is a valid TSIG key on a keyring */ isc_result_t dns_tsig_sign(dns_message_t *msg); /*%< * Generates a TSIG record for this message * * Requires: *\li 'msg' is a valid message *\li 'msg->tsigkey' is a valid TSIG key *\li 'msg->tsig' is NULL * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li #ISC_R_NOSPACE *\li #DNS_R_EXPECTEDTSIG * - this is a response & msg->querytsig is NULL */ isc_result_t dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg, dns_tsig_keyring_t *ring1, dns_tsig_keyring_t *ring2); /*%< * Verifies the TSIG record in this message * * Requires: *\li 'source' is a valid buffer containing the unparsed message *\li 'msg' is a valid message *\li 'msg->tsigkey' is a valid TSIG key if this is a response *\li 'msg->tsig' is NULL *\li 'msg->querytsig' is not NULL if this is a response *\li 'ring1' and 'ring2' are each either a valid keyring or NULL * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY *\li #DNS_R_EXPECTEDTSIG - A TSIG was expected but not seen *\li #DNS_R_UNEXPECTEDTSIG - A TSIG was seen but not expected *\li #DNS_R_TSIGERRORSET - the TSIG verified but ->error was set * and this is a query *\li #DNS_R_CLOCKSKEW - the TSIG failed to verify because of * the time was out of the allowed range. *\li #DNS_R_TSIGVERIFYFAILURE - the TSIG failed to verify *\li #DNS_R_EXPECTEDRESPONSE - the message was set over TCP and * should have been a response, * but was not. */ isc_result_t dns_tsigkey_find(dns_tsigkey_t **tsigkey, dns_name_t *name, dns_name_t *algorithm, dns_tsig_keyring_t *ring); /*%< * Returns the TSIG key corresponding to this name and (possibly) * algorithm. Also increments the key's reference counter. * * Requires: *\li 'tsigkey' is not NULL *\li '*tsigkey' is NULL *\li 'name' is a valid dns_name_t *\li 'algorithm' is a valid dns_name_t or NULL *\li 'ring' is a valid keyring * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOTFOUND */ isc_result_t dns_tsigkeyring_create(isc_mem_t *mctx, dns_tsig_keyring_t **ringp); /*%< * Create an empty TSIG key ring. * * Requires: *\li 'mctx' is not NULL *\li 'ringp' is not NULL, and '*ringp' is NULL * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMEMORY */ isc_result_t dns_tsigkeyring_add(dns_tsig_keyring_t *ring, dns_name_t *name, dns_tsigkey_t *tkey); /*%< * Place a TSIG key onto a key ring. * * Requires: *\li 'ring', 'name' and 'tkey' are not NULL * * Returns: *\li #ISC_R_SUCCESS *\li Any other value indicates failure. */ void dns_tsigkeyring_attach(dns_tsig_keyring_t *source, dns_tsig_keyring_t **target); void dns_tsigkeyring_detach(dns_tsig_keyring_t **ringp); isc_result_t dns_tsigkeyring_dumpanddetach(dns_tsig_keyring_t **ringp, FILE *fp); /*%< * Destroy a TSIG key ring. * * Requires: *\li 'ringp' is not NULL */ void dns_keyring_restore(dns_tsig_keyring_t *ring, FILE *fp); ISC_LANG_ENDDECLS #endif /* DNS_TSIG_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/events.h����������������������������������������������������������������������������������0000644�����������������00000007732�14763166026�0010036 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_EVENTS_H #define DNS_EVENTS_H 1 #include <isc/eventclass.h> /*! \file dns/events.h * \brief * Registry of DNS event numbers. */ #define DNS_EVENT_FETCHCONTROL (ISC_EVENTCLASS_DNS + 0) #define DNS_EVENT_FETCHDONE (ISC_EVENTCLASS_DNS + 1) #define DNS_EVENT_VIEWRESSHUTDOWN (ISC_EVENTCLASS_DNS + 2) #define DNS_EVENT_VIEWADBSHUTDOWN (ISC_EVENTCLASS_DNS + 3) #define DNS_EVENT_UPDATE (ISC_EVENTCLASS_DNS + 4) #define DNS_EVENT_UPDATEDONE (ISC_EVENTCLASS_DNS + 5) #define DNS_EVENT_DISPATCH (ISC_EVENTCLASS_DNS + 6) #define DNS_EVENT_TCPMSG (ISC_EVENTCLASS_DNS + 7) #define DNS_EVENT_ADBMOREADDRESSES (ISC_EVENTCLASS_DNS + 8) #define DNS_EVENT_ADBNOMOREADDRESSES (ISC_EVENTCLASS_DNS + 9) #define DNS_EVENT_ADBCANCELED (ISC_EVENTCLASS_DNS + 10) #define DNS_EVENT_ADBNAMEDELETED (ISC_EVENTCLASS_DNS + 11) #define DNS_EVENT_ADBSHUTDOWN (ISC_EVENTCLASS_DNS + 12) #define DNS_EVENT_ADBEXPIRED (ISC_EVENTCLASS_DNS + 13) #define DNS_EVENT_ADBCONTROL (ISC_EVENTCLASS_DNS + 14) #define DNS_EVENT_CACHECLEAN (ISC_EVENTCLASS_DNS + 15) #define DNS_EVENT_BYADDRDONE (ISC_EVENTCLASS_DNS + 16) #define DNS_EVENT_ZONECONTROL (ISC_EVENTCLASS_DNS + 17) #define DNS_EVENT_DBDESTROYED (ISC_EVENTCLASS_DNS + 18) #define DNS_EVENT_VALIDATORDONE (ISC_EVENTCLASS_DNS + 19) #define DNS_EVENT_REQUESTDONE (ISC_EVENTCLASS_DNS + 20) #define DNS_EVENT_VALIDATORSTART (ISC_EVENTCLASS_DNS + 21) #define DNS_EVENT_VIEWREQSHUTDOWN (ISC_EVENTCLASS_DNS + 22) #define DNS_EVENT_NOTIFYSENDTOADDR (ISC_EVENTCLASS_DNS + 23) #define DNS_EVENT_ZONE (ISC_EVENTCLASS_DNS + 24) #define DNS_EVENT_ZONESTARTXFRIN (ISC_EVENTCLASS_DNS + 25) #define DNS_EVENT_MASTERQUANTUM (ISC_EVENTCLASS_DNS + 26) #define DNS_EVENT_CACHEOVERMEM (ISC_EVENTCLASS_DNS + 27) #define DNS_EVENT_MASTERNEXTZONE (ISC_EVENTCLASS_DNS + 28) #define DNS_EVENT_IOREADY (ISC_EVENTCLASS_DNS + 29) #define DNS_EVENT_LOOKUPDONE (ISC_EVENTCLASS_DNS + 30) #define DNS_EVENT_RBTDEADNODES (ISC_EVENTCLASS_DNS + 31) #define DNS_EVENT_DISPATCHCONTROL (ISC_EVENTCLASS_DNS + 32) #define DNS_EVENT_REQUESTCONTROL (ISC_EVENTCLASS_DNS + 33) #define DNS_EVENT_DUMPQUANTUM (ISC_EVENTCLASS_DNS + 34) #define DNS_EVENT_IMPORTRECVDONE (ISC_EVENTCLASS_DNS + 35) #define DNS_EVENT_FREESTORAGE (ISC_EVENTCLASS_DNS + 36) #define DNS_EVENT_VIEWACACHESHUTDOWN (ISC_EVENTCLASS_DNS + 37) #define DNS_EVENT_ACACHECONTROL (ISC_EVENTCLASS_DNS + 38) #define DNS_EVENT_ACACHECLEAN (ISC_EVENTCLASS_DNS + 39) #define DNS_EVENT_ACACHEOVERMEM (ISC_EVENTCLASS_DNS + 40) #define DNS_EVENT_RBTPRUNE (ISC_EVENTCLASS_DNS + 41) #define DNS_EVENT_MANAGEKEYS (ISC_EVENTCLASS_DNS + 42) #define DNS_EVENT_CLIENTRESDONE (ISC_EVENTCLASS_DNS + 43) #define DNS_EVENT_CLIENTREQDONE (ISC_EVENTCLASS_DNS + 44) #define DNS_EVENT_ADBGROWENTRIES (ISC_EVENTCLASS_DNS + 45) #define DNS_EVENT_ADBGROWNAMES (ISC_EVENTCLASS_DNS + 46) #define DNS_EVENT_ZONESECURESERIAL (ISC_EVENTCLASS_DNS + 47) #define DNS_EVENT_ZONESECUREDB (ISC_EVENTCLASS_DNS + 48) #define DNS_EVENT_ZONELOAD (ISC_EVENTCLASS_DNS + 49) #define DNS_EVENT_KEYDONE (ISC_EVENTCLASS_DNS + 50) #define DNS_EVENT_SETNSEC3PARAM (ISC_EVENTCLASS_DNS + 51) #define DNS_EVENT_SETSERIAL (ISC_EVENTCLASS_DNS + 52) #define DNS_EVENT_CATZUPDATED (ISC_EVENTCLASS_DNS + 53) #define DNS_EVENT_CATZADDZONE (ISC_EVENTCLASS_DNS + 54) #define DNS_EVENT_CATZMODZONE (ISC_EVENTCLASS_DNS + 55) #define DNS_EVENT_CATZDELZONE (ISC_EVENTCLASS_DNS + 56) #define DNS_EVENT_STARTUPDATE (ISC_EVENTCLASS_DNS + 58) #define DNS_EVENT_FIRSTEVENT (ISC_EVENTCLASS_DNS + 0) #define DNS_EVENT_LASTEVENT (ISC_EVENTCLASS_DNS + 65535) #endif /* DNS_EVENTS_H */ ��������������������������������������bind9/dns/name.h������������������������������������������������������������������������������������0000644�����������������00000110636�14763166026�0007450 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_NAME_H #define DNS_NAME_H 1 /***** ***** Module Info *****/ /*! \file dns/name.h * \brief * Provides facilities for manipulating DNS names and labels, including * conversions to and from wire format and text format. * * Given the large number of names possible in a nameserver, and because * names occur in rdata, it was important to come up with a very efficient * way of storing name data, but at the same time allow names to be * manipulated. The decision was to store names in uncompressed wire format, * and not to make them fully abstracted objects; i.e. certain parts of the * server know names are stored that way. This saves a lot of memory, and * makes adding names to messages easy. Having much of the server know * the representation would be perilous, and we certainly don't want each * user of names to be manipulating such a low-level structure. This is * where the Names and Labels module comes in. The module allows name or * label handles to be created and attached to uncompressed wire format * regions. All name operations and conversions are done through these * handles. * * MP: *\li Clients of this module must impose any required synchronization. * * Reliability: *\li This module deals with low-level byte streams. Errors in any of * the functions are likely to crash the server or corrupt memory. * * Resources: *\li None. * * Security: * *\li *** WARNING *** * *\li dns_name_fromwire() deals with raw network data. An error in * this routine could result in the failure or hijacking of the server. * * Standards: *\li RFC1035 *\li Draft EDNS0 (0) *\li Draft Binary Labels (2) * */ /*** *** Imports ***/ #include <stdio.h> #include <isc/boolean.h> #include <isc/lang.h> #include <isc/magic.h> #include <isc/region.h> /* Required for storage size of dns_label_t. */ #include <dns/types.h> ISC_LANG_BEGINDECLS /***** ***** Labels ***** ***** A 'label' is basically a region. It contains one DNS wire format ***** label of type 00 (ordinary). *****/ /***** ***** Names ***** ***** A 'name' is a handle to a binary region. It contains a sequence of one ***** or more DNS wire format labels of type 00 (ordinary). ***** Note that all names are not required to end with the root label, ***** as they are in the actual DNS wire protocol. *****/ /*** *** Types ***/ /*% * Clients are strongly discouraged from using this type directly, with * the exception of the 'link' and 'list' fields which may be used directly * for whatever purpose the client desires. */ struct dns_name { unsigned int magic; unsigned char * ndata; unsigned int length; unsigned int labels; unsigned int attributes; unsigned char * offsets; isc_buffer_t * buffer; ISC_LINK(dns_name_t) link; ISC_LIST(dns_rdataset_t) list; }; #define DNS_NAME_MAGIC ISC_MAGIC('D','N','S','n') #define DNS_NAMEATTR_ABSOLUTE 0x00000001 #define DNS_NAMEATTR_READONLY 0x00000002 #define DNS_NAMEATTR_DYNAMIC 0x00000004 #define DNS_NAMEATTR_DYNOFFSETS 0x00000008 #define DNS_NAMEATTR_NOCOMPRESS 0x00000010 /* * Attributes below 0x0100 reserved for name.c usage. */ #define DNS_NAMEATTR_CACHE 0x00000100 /*%< Used by resolver. */ #define DNS_NAMEATTR_ANSWER 0x00000200 /*%< Used by resolver. */ #define DNS_NAMEATTR_NCACHE 0x00000400 /*%< Used by resolver. */ #define DNS_NAMEATTR_CHAINING 0x00000800 /*%< Used by resolver. */ #define DNS_NAMEATTR_CHASE 0x00001000 /*%< Used by resolver. */ #define DNS_NAMEATTR_WILDCARD 0x00002000 /*%< Used by server. */ #define DNS_NAMEATTR_PREREQUISITE 0x00004000 /*%< Used by client. */ #define DNS_NAMEATTR_UPDATE 0x00008000 /*%< Used by client. */ #define DNS_NAMEATTR_HASUPDATEREC 0x00010000 /*%< Used by client. */ /* * Various flags. */ #define DNS_NAME_DOWNCASE 0x0001 #define DNS_NAME_CHECKNAMES 0x0002 /*%< Used by rdata. */ #define DNS_NAME_CHECKNAMESFAIL 0x0004 /*%< Used by rdata. */ #define DNS_NAME_CHECKREVERSE 0x0008 /*%< Used by rdata. */ #define DNS_NAME_CHECKMX 0x0010 /*%< Used by rdata. */ #define DNS_NAME_CHECKMXFAIL 0x0020 /*%< Used by rdata. */ LIBDNS_EXTERNAL_DATA extern dns_name_t *dns_rootname; LIBDNS_EXTERNAL_DATA extern dns_name_t *dns_wildcardname; /*%< * DNS_NAME_INITNONABSOLUTE and DNS_NAME_INITABSOLUTE are macros for * initializing dns_name_t structures. * * Note[1]: 'length' is set to (sizeof(A) - 1) in DNS_NAME_INITNONABSOLUTE * and sizeof(A) in DNS_NAME_INITABSOLUTE to allow C strings to be used * to initialize 'ndata'. * * Note[2]: The final value of offsets for DNS_NAME_INITABSOLUTE should * match (sizeof(A) - 1) which is the offset of the root label. * * Typical usage: * unsigned char data[] = "\005value"; * unsigned char offsets[] = { 0 }; * dns_name_t value = DNS_NAME_INITNONABSOLUTE(data, offsets); * * unsigned char data[] = "\005value"; * unsigned char offsets[] = { 0, 6 }; * dns_name_t value = DNS_NAME_INITABSOLUTE(data, offsets); */ #define DNS_NAME_INITNONABSOLUTE(A,B) { \ DNS_NAME_MAGIC, \ A, (sizeof(A) - 1), sizeof(B), \ DNS_NAMEATTR_READONLY, \ B, NULL, { (void *)-1, (void *)-1}, \ {NULL, NULL} \ } #define DNS_NAME_INITABSOLUTE(A,B) { \ DNS_NAME_MAGIC, \ A, sizeof(A), sizeof(B), \ DNS_NAMEATTR_READONLY | DNS_NAMEATTR_ABSOLUTE, \ B, NULL, { (void *)-1, (void *)-1}, \ {NULL, NULL} \ } #define DNS_NAME_INITEMPTY { \ DNS_NAME_MAGIC, NULL, 0, 0, 0, NULL, NULL, \ { (void *)-1, (void *)-1 }, { NULL, NULL } \ } /*% * Standard size of a wire format name */ #define DNS_NAME_MAXWIRE 255 /* * Text output filter procedure. * 'target' is the buffer to be converted. The region to be converted * is from 'buffer'->base + 'used_org' to the end of the used region. */ typedef isc_result_t (*dns_name_totextfilter_t)(isc_buffer_t *target, unsigned int used_org, isc_boolean_t absolute); /*** *** Initialization ***/ void dns_name_init(dns_name_t *name, unsigned char *offsets); /*%< * Initialize 'name'. * * Notes: * \li 'offsets' is never required to be non-NULL, but specifying a * dns_offsets_t for 'offsets' will improve the performance of most * name operations if the name is used more than once. * * Requires: * \li 'name' is not NULL and points to a struct dns_name. * * \li offsets == NULL or offsets is a dns_offsets_t. * * Ensures: * \li 'name' is a valid name. * \li dns_name_countlabels(name) == 0 * \li dns_name_isabsolute(name) == ISC_FALSE */ void dns_name_reset(dns_name_t *name); /*%< * Reinitialize 'name'. * * Notes: * \li This function distinguishes itself from dns_name_init() in two * key ways: * * \li + If any buffer is associated with 'name' (via dns_name_setbuffer() * or by being part of a dns_fixedname_t) the link to the buffer * is retained but the buffer itself is cleared. * * \li + Of the attributes associated with 'name', all are retained except * DNS_NAMEATTR_ABSOLUTE. * * Requires: * \li 'name' is a valid name. * * Ensures: * \li 'name' is a valid name. * \li dns_name_countlabels(name) == 0 * \li dns_name_isabsolute(name) == ISC_FALSE */ void dns_name_invalidate(dns_name_t *name); /*%< * Make 'name' invalid. * * Requires: * \li 'name' is a valid name. * * Ensures: * \li If assertion checking is enabled, future attempts to use 'name' * without initializing it will cause an assertion failure. * * \li If the name had a dedicated buffer, that association is ended. */ isc_boolean_t dns_name_isvalid(const dns_name_t *name); /*%< * Check whether 'name' points to a valid dns_name */ /*** *** Dedicated Buffers ***/ void dns_name_setbuffer(dns_name_t *name, isc_buffer_t *buffer); /*%< * Dedicate a buffer for use with 'name'. * * Notes: * \li Specification of a target buffer in dns_name_fromwire(), * dns_name_fromtext(), and dns_name_concatenate() is optional if * 'name' has a dedicated buffer. * * \li The caller must not write to buffer until the name has been * invalidated or is otherwise known not to be in use. * * \li If buffer is NULL and the name previously had a dedicated buffer, * than that buffer is no longer dedicated to use with this name. * The caller is responsible for ensuring that the storage used by * the name remains valid. * * Requires: * \li 'name' is a valid name. * * \li 'buffer' is a valid binary buffer and 'name' doesn't have a * dedicated buffer already, or 'buffer' is NULL. */ isc_boolean_t dns_name_hasbuffer(const dns_name_t *name); /*%< * Does 'name' have a dedicated buffer? * * Requires: * \li 'name' is a valid name. * * Returns: * \li ISC_TRUE 'name' has a dedicated buffer. * \li ISC_FALSE 'name' does not have a dedicated buffer. */ /*** *** Properties ***/ isc_boolean_t dns_name_isabsolute(const dns_name_t *name); /*%< * Does 'name' end in the root label? * * Requires: * \li 'name' is a valid name * * Returns: * \li TRUE The last label in 'name' is the root label. * \li FALSE The last label in 'name' is not the root label. */ isc_boolean_t dns_name_iswildcard(const dns_name_t *name); /*%< * Is 'name' a wildcard name? * * Requires: * \li 'name' is a valid name * * \li dns_name_countlabels(name) > 0 * * Returns: * \li TRUE The least significant label of 'name' is '*'. * \li FALSE The least significant label of 'name' is not '*'. */ unsigned int dns_name_hash(dns_name_t *name, isc_boolean_t case_sensitive); /*%< * Provide a hash value for 'name'. * * Note: if 'case_sensitive' is ISC_FALSE, then names which differ only in * case will have the same hash value. * * Requires: * \li 'name' is a valid name * * Returns: * \li A hash value */ unsigned int dns_name_fullhash(dns_name_t *name, isc_boolean_t case_sensitive); /*%< * Provide a hash value for 'name'. Unlike dns_name_hash(), this function * always takes into account of the entire name to calculate the hash value. * * Note: if 'case_sensitive' is ISC_FALSE, then names which differ only in * case will have the same hash value. * * Requires: *\li 'name' is a valid name * * Returns: *\li A hash value */ unsigned int dns_name_hashbylabel(dns_name_t *name, isc_boolean_t case_sensitive); /*%< * Provide a hash value for 'name', where the hash value is the sum * of the hash values of each label. This function should only be used * when incremental hashing is necessary, for example, during RBT * traversal. It is not currently used in BIND. Generally, * dns_name_fullhash() is the correct function to use for name * hashing. * * Note: if 'case_sensitive' is ISC_FALSE, then names which differ only in * case will have the same hash value. * * Requires: *\li 'name' is a valid name * * Returns: *\li A hash value */ /* *** Comparisons ***/ dns_namereln_t dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2, int *orderp, unsigned int *nlabelsp); /*%< * Determine the relative ordering under the DNSSEC order relation of * 'name1' and 'name2', and also determine the hierarchical * relationship of the names. * * Note: It makes no sense for one of the names to be relative and the * other absolute. If both names are relative, then to be meaningfully * compared the caller must ensure that they are both relative to the * same domain. * * Requires: *\li 'name1' is a valid name * *\li dns_name_countlabels(name1) > 0 * *\li 'name2' is a valid name * *\li dns_name_countlabels(name2) > 0 * *\li orderp and nlabelsp are valid pointers. * *\li Either name1 is absolute and name2 is absolute, or neither is. * * Ensures: * *\li *orderp is < 0 if name1 < name2, 0 if name1 = name2, > 0 if * name1 > name2. * *\li *nlabelsp is the number of common significant labels. * * Returns: *\li dns_namereln_none There's no hierarchical relationship * between name1 and name2. *\li dns_namereln_contains name1 properly contains name2; i.e. * name2 is a proper subdomain of name1. *\li dns_namereln_subdomain name1 is a proper subdomain of name2. *\li dns_namereln_equal name1 and name2 are equal. *\li dns_namereln_commonancestor name1 and name2 share a common * ancestor. */ int dns_name_compare(const dns_name_t *name1, const dns_name_t *name2); /*%< * Determine the relative ordering under the DNSSEC order relation of * 'name1' and 'name2'. * * Note: It makes no sense for one of the names to be relative and the * other absolute. If both names are relative, then to be meaningfully * compared the caller must ensure that they are both relative to the * same domain. * * Requires: * \li 'name1' is a valid name * * \li 'name2' is a valid name * * \li Either name1 is absolute and name2 is absolute, or neither is. * * Returns: * \li < 0 'name1' is less than 'name2' * \li 0 'name1' is equal to 'name2' * \li > 0 'name1' is greater than 'name2' */ isc_boolean_t dns_name_equal(const dns_name_t *name1, const dns_name_t *name2); /*%< * Are 'name1' and 'name2' equal? * * Notes: * \li Because it only needs to test for equality, dns_name_equal() can be * significantly faster than dns_name_fullcompare() or dns_name_compare(). * * \li Offsets tables are not used in the comparision. * * \li It makes no sense for one of the names to be relative and the * other absolute. If both names are relative, then to be meaningfully * compared the caller must ensure that they are both relative to the * same domain. * * Requires: * \li 'name1' is a valid name * * \li 'name2' is a valid name * * \li Either name1 is absolute and name2 is absolute, or neither is. * * Returns: * \li ISC_TRUE 'name1' and 'name2' are equal * \li ISC_FALSE 'name1' and 'name2' are not equal */ isc_boolean_t dns_name_caseequal(const dns_name_t *name1, const dns_name_t *name2); /*%< * Case sensitive version of dns_name_equal(). */ int dns_name_rdatacompare(const dns_name_t *name1, const dns_name_t *name2); /*%< * Compare two names as if they are part of rdata in DNSSEC canonical * form. * * Requires: * \li 'name1' is a valid absolute name * * \li dns_name_countlabels(name1) > 0 * * \li 'name2' is a valid absolute name * * \li dns_name_countlabels(name2) > 0 * * Returns: * \li < 0 'name1' is less than 'name2' * \li 0 'name1' is equal to 'name2' * \li > 0 'name1' is greater than 'name2' */ isc_boolean_t dns_name_issubdomain(const dns_name_t *name1, const dns_name_t *name2); /*%< * Is 'name1' a subdomain of 'name2'? * * Notes: * \li name1 is a subdomain of name2 if name1 is contained in name2, or * name1 equals name2. * * \li It makes no sense for one of the names to be relative and the * other absolute. If both names are relative, then to be meaningfully * compared the caller must ensure that they are both relative to the * same domain. * * Requires: * \li 'name1' is a valid name * * \li 'name2' is a valid name * * \li Either name1 is absolute and name2 is absolute, or neither is. * * Returns: * \li TRUE 'name1' is a subdomain of 'name2' * \li FALSE 'name1' is not a subdomain of 'name2' */ isc_boolean_t dns_name_matcheswildcard(const dns_name_t *name, const dns_name_t *wname); /*%< * Does 'name' match the wildcard specified in 'wname'? * * Notes: * \li name matches the wildcard specified in wname if all labels * following the wildcard in wname are identical to the same number * of labels at the end of name. * * \li It makes no sense for one of the names to be relative and the * other absolute. If both names are relative, then to be meaningfully * compared the caller must ensure that they are both relative to the * same domain. * * Requires: * \li 'name' is a valid name * * \li dns_name_countlabels(name) > 0 * * \li 'wname' is a valid name * * \li dns_name_countlabels(wname) > 0 * * \li dns_name_iswildcard(wname) is true * * \li Either name is absolute and wname is absolute, or neither is. * * Returns: * \li TRUE 'name' matches the wildcard specified in 'wname' * \li FALSE 'name' does not match the wildcard specified in 'wname' */ /*** *** Labels ***/ unsigned int dns_name_countlabels(const dns_name_t *name); /*%< * How many labels does 'name' have? * * Notes: * \li In this case, as in other places, a 'label' is an ordinary label. * * Requires: * \li 'name' is a valid name * * Ensures: * \li The result is <= 128. * * Returns: * \li The number of labels in 'name'. */ void dns_name_getlabel(const dns_name_t *name, unsigned int n, dns_label_t *label); /*%< * Make 'label' refer to the 'n'th least significant label of 'name'. * * Notes: * \li Numbering starts at 0. * * \li Given "rc.vix.com.", the label 0 is "rc", and label 3 is the * root label. * * \li 'label' refers to the same memory as 'name', so 'name' must not * be changed while 'label' is still in use. * * Requires: * \li n < dns_name_countlabels(name) */ void dns_name_getlabelsequence(const dns_name_t *source, unsigned int first, unsigned int n, dns_name_t *target); /*%< * Make 'target' refer to the 'n' labels including and following 'first' * in 'source'. * * Notes: * \li Numbering starts at 0. * * \li Given "rc.vix.com.", the label 0 is "rc", and label 3 is the * root label. * * \li 'target' refers to the same memory as 'source', so 'source' * must not be changed while 'target' is still in use. * * Requires: * \li 'source' and 'target' are valid names. * * \li first < dns_name_countlabels(name) * * \li first + n <= dns_name_countlabels(name) */ void dns_name_clone(const dns_name_t *source, dns_name_t *target); /*%< * Make 'target' refer to the same name as 'source'. * * Notes: * * \li 'target' refers to the same memory as 'source', so 'source' * must not be changed while 'target' is still in use. * * \li This call is functionally equivalent to: * * \code * dns_name_getlabelsequence(source, 0, * dns_name_countlabels(source), * target); * \endcode * * but is more efficient. Also, dns_name_clone() works even if 'source' * is empty. * * Requires: * * \li 'source' is a valid name. * * \li 'target' is a valid name that is not read-only. */ /*** *** Conversions ***/ void dns_name_fromregion(dns_name_t *name, const isc_region_t *r); /*%< * Make 'name' refer to region 'r'. * * Note: * \li If the conversion encounters a root label before the end of the * region the conversion stops and the length is set to the length * so far converted. A maximum of 255 bytes is converted. * * Requires: * \li The data in 'r' is a sequence of one or more type 00 or type 01000001 * labels. */ void dns_name_toregion(dns_name_t *name, isc_region_t *r); /*%< * Make 'r' refer to 'name'. * * Requires: * * \li 'name' is a valid name. * * \li 'r' is a valid region. */ isc_result_t dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, dns_decompress_t *dctx, unsigned int options, isc_buffer_t *target); /*%< * Copy the possibly-compressed name at source (active region) into target, * decompressing it. * * Notes: * \li Decompression policy is controlled by 'dctx'. * * \li If DNS_NAME_DOWNCASE is set, any uppercase letters in 'source' will be * downcased when they are copied into 'target'. * * Security: * * \li *** WARNING *** * * \li This routine will often be used when 'source' contains raw network * data. A programming error in this routine could result in a denial * of service, or in the hijacking of the server. * * Requires: * * \li 'name' is a valid name. * * \li 'source' is a valid buffer and the first byte of the active * region should be the first byte of a DNS wire format domain name. * * \li 'target' is a valid buffer or 'target' is NULL and 'name' has * a dedicated buffer. * * \li 'dctx' is a valid decompression context. * * Ensures: * * If result is success: * \li If 'target' is not NULL, 'name' is attached to it. * * \li Uppercase letters are downcased in the copy iff * DNS_NAME_DOWNCASE is set in options. * * \li The current location in source is advanced, and the used space * in target is updated. * * Result: * \li Success * \li Bad Form: Label Length * \li Bad Form: Unknown Label Type * \li Bad Form: Name Length * \li Bad Form: Compression type not allowed * \li Bad Form: Bad compression pointer * \li Bad Form: Input too short * \li Resource Limit: Too many compression pointers * \li Resource Limit: Not enough space in buffer */ isc_result_t dns_name_towire(const dns_name_t *name, dns_compress_t *cctx, isc_buffer_t *target); /*%< * Convert 'name' into wire format, compressing it as specified by the * compression context 'cctx', and storing the result in 'target'. * * Notes: * \li If the compression context allows global compression, then the * global compression table may be updated. * * Requires: * \li 'name' is a valid name * * \li dns_name_countlabels(name) > 0 * * \li dns_name_isabsolute(name) == TRUE * * \li target is a valid buffer. * * \li Any offsets specified in a global compression table are valid * for buffer. * * Ensures: * * If the result is success: * * \li The used space in target is updated. * * Returns: * \li Success * \li Resource Limit: Not enough space in buffer */ isc_result_t dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, const dns_name_t *origin, unsigned int options, isc_buffer_t *target); /*%< * Convert the textual representation of a DNS name at source * into uncompressed wire form stored in target. * * Notes: * \li Relative domain names will have 'origin' appended to them * unless 'origin' is NULL, in which case relative domain names * will remain relative. * * \li If DNS_NAME_DOWNCASE is set in 'options', any uppercase letters * in 'source' will be downcased when they are copied into 'target'. * * Requires: * * \li 'name' is a valid name. * * \li 'source' is a valid buffer. * * \li 'target' is a valid buffer or 'target' is NULL and 'name' has * a dedicated buffer. * * Ensures: * * If result is success: * \li If 'target' is not NULL, 'name' is attached to it. * * \li Uppercase letters are downcased in the copy iff * DNS_NAME_DOWNCASE is set in 'options'. * * \li The current location in source is advanced, and the used space * in target is updated. * * Result: *\li #ISC_R_SUCCESS *\li #DNS_R_EMPTYLABEL *\li #DNS_R_LABELTOOLONG *\li #DNS_R_BADESCAPE *\li #DNS_R_BADDOTTEDQUAD *\li #ISC_R_NOSPACE *\li #ISC_R_UNEXPECTEDEND */ #define DNS_NAME_OMITFINALDOT 0x01U #define DNS_NAME_MASTERFILE 0x02U /* escape $ and @ */ isc_result_t dns_name_toprincipal(const dns_name_t *name, isc_buffer_t *target); isc_result_t dns_name_totext(const dns_name_t *name, isc_boolean_t omit_final_dot, isc_buffer_t *target); isc_result_t dns_name_totext2(const dns_name_t *name, unsigned int options, isc_buffer_t *target); /*%< * Convert 'name' into text format, storing the result in 'target'. * * Notes: *\li If 'omit_final_dot' is true, then the final '.' in absolute * names other than the root name will be omitted. * *\li If DNS_NAME_OMITFINALDOT is set in options, then the final '.' * in absolute names other than the root name will be omitted. * *\li If DNS_NAME_MASTERFILE is set in options, '$' and '@' will also * be escaped. * *\li If dns_name_countlabels == 0, the name will be "@", representing the * current origin as described by RFC1035. * *\li The name is not NUL terminated. * * Requires: * *\li 'name' is a valid name * *\li 'target' is a valid buffer. * *\li if dns_name_isabsolute == FALSE, then omit_final_dot == FALSE * * Ensures: * *\li If the result is success: * the used space in target is updated. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOSPACE */ #define DNS_NAME_MAXTEXT 1023 /*%< * The maximum length of the text representation of a domain * name as generated by dns_name_totext(). This does not * include space for a terminating NULL. * * This definition is conservative - the actual maximum * is 1004, derived as follows: * * A backslash-decimal escaped character takes 4 bytes. * A wire-encoded name can be up to 255 bytes and each * label is one length byte + at most 63 bytes of data. * Maximizing the label lengths gives us a name of * three 63-octet labels, one 61-octet label, and the * root label: * * 1 + 63 + 1 + 63 + 1 + 63 + 1 + 61 + 1 = 255 * * When printed, this is (3 * 63 + 61) * 4 * bytes for the escaped label data + 4 bytes for the * dot terminating each label = 1004 bytes total. */ isc_result_t dns_name_tofilenametext(dns_name_t *name, isc_boolean_t omit_final_dot, isc_buffer_t *target); /*%< * Convert 'name' into an alternate text format appropriate for filenames, * storing the result in 'target'. The name data is downcased, guaranteeing * that the filename does not depend on the case of the converted name. * * Notes: *\li If 'omit_final_dot' is true, then the final '.' in absolute * names other than the root name will be omitted. * *\li The name is not NUL terminated. * * Requires: * *\li 'name' is a valid absolute name * *\li 'target' is a valid buffer. * * Ensures: * *\li If the result is success: * the used space in target is updated. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOSPACE */ isc_result_t dns_name_downcase(dns_name_t *source, dns_name_t *name, isc_buffer_t *target); /*%< * Downcase 'source'. * * Requires: * *\li 'source' and 'name' are valid names. * *\li If source == name, then * 'source' must not be read-only * *\li Otherwise, * 'target' is a valid buffer or 'target' is NULL and * 'name' has a dedicated buffer. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOSPACE * * Note: if source == name, then the result will always be ISC_R_SUCCESS. */ isc_result_t dns_name_concatenate(dns_name_t *prefix, dns_name_t *suffix, dns_name_t *name, isc_buffer_t *target); /*%< * Concatenate 'prefix' and 'suffix'. * * Requires: * *\li 'prefix' is a valid name or NULL. * *\li 'suffix' is a valid name or NULL. * *\li 'name' is a valid name or NULL. * *\li 'target' is a valid buffer or 'target' is NULL and 'name' has * a dedicated buffer. * *\li If 'prefix' is absolute, 'suffix' must be NULL or the empty name. * * Ensures: * *\li On success, * If 'target' is not NULL and 'name' is not NULL, then 'name' * is attached to it. * The used space in target is updated. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOSPACE *\li #DNS_R_NAMETOOLONG */ void dns_name_split(dns_name_t *name, unsigned int suffixlabels, dns_name_t *prefix, dns_name_t *suffix); /*%< * * Split 'name' into two pieces on a label boundary. * * Notes: * \li 'name' is split such that 'suffix' holds the most significant * 'suffixlabels' labels. All other labels are stored in 'prefix'. * *\li Copying name data is avoided as much as possible, so 'prefix' * and 'suffix' will end up pointing at the data for 'name'. * *\li It is legitimate to pass a 'prefix' or 'suffix' that has * its name data stored someplace other than the dedicated buffer. * This is useful to avoid name copying in the calling function. * *\li It is also legitimate to pass a 'prefix' or 'suffix' that is * the same dns_name_t as 'name'. * * Requires: *\li 'name' is a valid name. * *\li 'suffixlabels' cannot exceed the number of labels in 'name'. * * \li 'prefix' is a valid name or NULL, and cannot be read-only. * *\li 'suffix' is a valid name or NULL, and cannot be read-only. * * Ensures: * *\li On success: * If 'prefix' is not NULL it will contain the least significant * labels. * If 'suffix' is not NULL it will contain the most significant * labels. dns_name_countlabels(suffix) will be equal to * suffixlabels. * *\li On failure: * Either 'prefix' or 'suffix' is invalidated (depending * on which one the problem was encountered with). * * Returns: *\li #ISC_R_SUCCESS No worries. (This function should always success). */ isc_result_t dns_name_dup(const dns_name_t *source, isc_mem_t *mctx, dns_name_t *target); /*%< * Make 'target' a dynamically allocated copy of 'source'. * * Requires: * *\li 'source' is a valid non-empty name. * *\li 'target' is a valid name that is not read-only. * *\li 'mctx' is a valid memory context. */ isc_result_t dns_name_dupwithoffsets(dns_name_t *source, isc_mem_t *mctx, dns_name_t *target); /*%< * Make 'target' a read-only dynamically allocated copy of 'source'. * 'target' will also have a dynamically allocated offsets table. * * Requires: * *\li 'source' is a valid non-empty name. * *\li 'target' is a valid name that is not read-only. * *\li 'target' has no offsets table. * *\li 'mctx' is a valid memory context. */ void dns_name_free(dns_name_t *name, isc_mem_t *mctx); /*%< * Free 'name'. * * Requires: * *\li 'name' is a valid name created previously in 'mctx' by dns_name_dup(). * *\li 'mctx' is a valid memory context. * * Ensures: * *\li All dynamic resources used by 'name' are freed and the name is * invalidated. */ isc_result_t dns_name_digest(dns_name_t *name, dns_digestfunc_t digest, void *arg); /*%< * Send 'name' in DNSSEC canonical form to 'digest'. * * Requires: * *\li 'name' is a valid name. * *\li 'digest' is a valid dns_digestfunc_t. * * Ensures: * *\li If successful, the DNSSEC canonical form of 'name' will have been * sent to 'digest'. * *\li If digest() returns something other than ISC_R_SUCCESS, that result * will be returned as the result of dns_name_digest(). * * Returns: * *\li #ISC_R_SUCCESS * *\li Many other results are possible if not successful. * */ isc_boolean_t dns_name_dynamic(dns_name_t *name); /*%< * Returns whether there is dynamic memory associated with this name. * * Requires: * *\li 'name' is a valid name. * * Returns: * *\li 'ISC_TRUE' if the name is dynamic otherwise 'ISC_FALSE'. */ isc_result_t dns_name_print(dns_name_t *name, FILE *stream); /*%< * Print 'name' on 'stream'. * * Requires: * *\li 'name' is a valid name. * *\li 'stream' is a valid stream. * * Returns: * *\li #ISC_R_SUCCESS * *\li Any error that dns_name_totext() can return. */ void dns_name_format(const dns_name_t *name, char *cp, unsigned int size); /*%< * Format 'name' as text appropriate for use in log messages. * * Store the formatted name at 'cp', writing no more than * 'size' bytes. The resulting string is guaranteed to be * null terminated. * * The formatted name will have a terminating dot only if it is * the root. * * This function cannot fail, instead any errors are indicated * in the returned text. * * Requires: * *\li 'name' is a valid name. * *\li 'cp' points a valid character array of size 'size'. * *\li 'size' > 0. * */ isc_result_t dns_name_tostring(dns_name_t *source, char **target, isc_mem_t *mctx); /*%< * Convert 'name' to string format, allocating sufficient memory to * hold it (free with isc_mem_free()). * * Differs from dns_name_format in that it allocates its own memory. * * Requires: * *\li 'name' is a valid name. *\li 'target' is not NULL. *\li '*target' is NULL. * * Returns: * *\li ISC_R_SUCCESS *\li ISC_R_NOMEMORY * *\li Any error that dns_name_totext() can return. */ isc_result_t dns_name_fromstring(dns_name_t *target, const char *src, unsigned int options, isc_mem_t *mctx); isc_result_t dns_name_fromstring2(dns_name_t *target, const char *src, const dns_name_t *origin, unsigned int options, isc_mem_t *mctx); /*%< * Convert a string to a name and place it in target, allocating memory * as necessary. 'options' has the same semantics as that of * dns_name_fromtext(). * * If 'target' has a buffer then the name will be copied into it rather than * memory being allocated. * * Requires: * * \li 'target' is a valid name that is not read-only. * \li 'src' is not NULL. * * Returns: * *\li #ISC_R_SUCCESS * *\li Any error that dns_name_fromtext() can return. * *\li Any error that dns_name_dup() can return. */ isc_result_t dns_name_settotextfilter(dns_name_totextfilter_t proc); /*%< * Set / clear a thread specific function 'proc' to be called at the * end of dns_name_totext(). * * Note: Under Windows you need to call "dns_name_settotextfilter(NULL);" * prior to exiting the thread otherwise memory will be leaked. * For other platforms, which are pthreads based, this is still a good * idea but not required. * * Returns *\li #ISC_R_SUCCESS *\li #ISC_R_UNEXPECTED */ #define DNS_NAME_FORMATSIZE (DNS_NAME_MAXTEXT + 1) /*%< * Suggested size of buffer passed to dns_name_format(). * Includes space for the terminating NULL. */ isc_result_t dns_name_copy(const dns_name_t *source, dns_name_t *dest, isc_buffer_t *target); /*%< * Makes 'dest' refer to a copy of the name in 'source'. The data are * either copied to 'target' or the dedicated buffer in 'dest'. * * Requires: * \li 'source' is a valid name. * * \li 'dest' is an initialized name with a dedicated buffer. * * \li 'target' is NULL or an initialized buffer. * * \li Either dest has a dedicated buffer or target != NULL. * * Ensures: * *\li On success, the used space in target is updated. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOSPACE */ isc_boolean_t dns_name_ishostname(const dns_name_t *name, isc_boolean_t wildcard); /*%< * Return if 'name' is a valid hostname. RFC 952 / RFC 1123. * If 'wildcard' is ISC_TRUE then allow the first label of name to * be a wildcard. * The root is also accepted. * * Requires: * 'name' to be valid. */ isc_boolean_t dns_name_ismailbox(const dns_name_t *name); /*%< * Return if 'name' is a valid mailbox. RFC 821. * * Requires: * \li 'name' to be valid. */ isc_boolean_t dns_name_internalwildcard(const dns_name_t *name); /*%< * Return if 'name' contains a internal wildcard name. * * Requires: * \li 'name' to be valid. */ void dns_name_destroy(void); /*%< * Cleanup dns_name_settotextfilter() / dns_name_totext() state. * * This should be called as part of the final cleanup process. * * Note: dns_name_settotextfilter(NULL); should be called for all * threads which have called dns_name_settotextfilter() with a * non-NULL argument prior to calling dns_name_destroy(); */ isc_boolean_t dns_name_isdnssd(const dns_name_t *owner); /*%< * Determine if the 'owner' is a DNS-SD prefix. */ isc_boolean_t dns_name_isrfc1918(const dns_name_t *owner); /*%< * Determine if the 'name' is in the RFC 1918 reverse namespace. */ isc_boolean_t dns_name_isula(const dns_name_t *owner); /*%< * Determine if the 'name' is in the ULA reverse namespace. */ isc_boolean_t dns_name_istat(const dns_name_t *name); /* * Determine if 'name' is a potential 'trust-anchor-telementry' name. */ ISC_LANG_ENDDECLS /* *** High Performance Macros ***/ /* * WARNING: Use of these macros by applications may require recompilation * of the application in some situations where calling the function * would not. * * WARNING: No assertion checking is done for these macros. */ #define DNS_NAME_INIT(n, o) \ do { \ dns_name_t *_n = (n); \ /* memset(_n, 0, sizeof(*_n)); */ \ _n->magic = DNS_NAME_MAGIC; \ _n->ndata = NULL; \ _n->length = 0; \ _n->labels = 0; \ _n->attributes = 0; \ _n->offsets = (o); \ _n->buffer = NULL; \ ISC_LINK_INIT(_n, link); \ ISC_LIST_INIT(_n->list); \ } while (0) #define DNS_NAME_RESET(n) \ do { \ (n)->ndata = NULL; \ (n)->length = 0; \ (n)->labels = 0; \ (n)->attributes &= ~DNS_NAMEATTR_ABSOLUTE; \ if ((n)->buffer != NULL) \ isc_buffer_clear((n)->buffer); \ } while (0) #define DNS_NAME_SETBUFFER(n, b) \ (n)->buffer = (b) #define DNS_NAME_ISABSOLUTE(n) \ (((n)->attributes & DNS_NAMEATTR_ABSOLUTE) != 0 ? ISC_TRUE : ISC_FALSE) #define DNS_NAME_COUNTLABELS(n) \ ((n)->labels) #define DNS_NAME_TOREGION(n, r) \ do { \ (r)->base = (n)->ndata; \ (r)->length = (n)->length; \ } while (0) #define DNS_NAME_SPLIT(n, l, p, s) \ do { \ dns_name_t *_n = (n); \ dns_name_t *_p = (p); \ dns_name_t *_s = (s); \ unsigned int _l = (l); \ if (_p != NULL) \ dns_name_getlabelsequence(_n, 0, _n->labels - _l, _p); \ if (_s != NULL) \ dns_name_getlabelsequence(_n, _n->labels - _l, _l, _s); \ } while (0) #ifdef DNS_NAME_USEINLINE #define dns_name_init(n, o) DNS_NAME_INIT(n, o) #define dns_name_reset(n) DNS_NAME_RESET(n) #define dns_name_setbuffer(n, b) DNS_NAME_SETBUFFER(n, b) #define dns_name_countlabels(n) DNS_NAME_COUNTLABELS(n) #define dns_name_isabsolute(n) DNS_NAME_ISABSOLUTE(n) #define dns_name_toregion(n, r) DNS_NAME_TOREGION(n, r) #define dns_name_split(n, l, p, s) DNS_NAME_SPLIT(n, l, p, s) #endif /* DNS_NAME_USEINLINE */ #endif /* DNS_NAME_H */ ��������������������������������������������������������������������������������������������������bind9/dns/tsec.h������������������������������������������������������������������������������������0000644�����������������00000005604�14763166026�0007464 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_TSEC_H #define DNS_TSEC_H 1 /***** ***** Module Info *****/ /*! \file * * \brief * The TSEC (Transaction Security) module is an abstraction layer for managing * DNS transaction mechanisms such as TSIG or SIG(0). A TSEC structure is a * mechanism-independent object containing key information specific to the * mechanism, and is expected to be used as an argument to other modules * that use transaction security in a mechanism-independent manner. * * MP: *\li A TSEC structure is expected to be thread-specific. No inter-thread * synchronization is ensured in multiple access to a single TSEC * structure. * * Resources: *\li TBS * * Security: *\li This module does not handle any low-level data directly, and so no * security issue specific to this module is anticipated. */ #include <dns/types.h> #include <dst/dst.h> ISC_LANG_BEGINDECLS /*** *** Types ***/ /*% * Transaction security types. */ typedef enum { dns_tsectype_none, dns_tsectype_tsig, dns_tsectype_sig0 } dns_tsectype_t; isc_result_t dns_tsec_create(isc_mem_t *mctx, dns_tsectype_t type, dst_key_t *key, dns_tsec_t **tsecp); /*%< * Create a TSEC structure and stores a type-dependent key structure in it. * For a TSIG key (type is dns_tsectype_tsig), dns_tsec_create() creates a * TSIG key structure from '*key' and keeps it in the structure. For other * types, this function simply retains '*key' in the structure. In either * case, the ownership of '*key' is transferred to the TSEC module; the caller * must not modify or destroy it after the call to dns_tsec_create(). * * Requires: * *\li 'mctx' is a valid memory context. * *\li 'type' is a valid value of dns_tsectype_t (see above). * *\li 'key' is a valid key. * *\li tsecp != NULL && *tsecp == NULL. * * Returns: * *\li #ISC_R_SUCCESS On success. * *\li Anything else Failure. */ void dns_tsec_destroy(dns_tsec_t **tsecp); /*%< * Destroy the TSEC structure. The stored key is also detached or destroyed. * * Requires * *\li '*tsecp' is a valid TSEC structure. * * Ensures * *\li *tsecp == NULL. * */ dns_tsectype_t dns_tsec_gettype(dns_tsec_t *tsec); /*%< * Return the TSEC type of '*tsec'. * * Requires * *\li 'tsec' is a valid TSEC structure. * */ void dns_tsec_getkey(dns_tsec_t *tsec, void *keyp); /*%< * Return the TSEC key of '*tsec' in '*keyp'. * * Requires * *\li keyp != NULL * * Ensures * *\li *tsecp points to a valid key structure depending on the TSEC type. */ ISC_LANG_ENDDECLS #endif /* DNS_TSEC_H */ ����������������������������������������������������������������������������������������������������������������������������bind9/dns/zt.h��������������������������������������������������������������������������������������0000644�����������������00000012477�14763166026�0007171 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_ZT_H #define DNS_ZT_H 1 /*! \file dns/zt.h */ #include <isc/lang.h> #include <dns/types.h> #define DNS_ZTFIND_NOEXACT 0x01 ISC_LANG_BEGINDECLS typedef isc_result_t (*dns_zt_allloaded_t)(void *arg); /*%< * Method prototype: when all pending zone loads are complete, * the zone table can inform the caller via a callback function with * this signature. */ typedef isc_result_t (*dns_zt_zoneloaded_t)(dns_zt_t *zt, dns_zone_t *zone, isc_task_t *task); /*%< * Method prototype: when a zone finishes loading, the zt object * can be informed via a callback function with this signature. */ isc_result_t dns_zt_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_zt_t **zt); /*%< * Creates a new zone table. * * Requires: * \li 'mctx' to be initialized. * * Returns: * \li #ISC_R_SUCCESS on success. * \li #ISC_R_NOMEMORY */ isc_result_t dns_zt_mount(dns_zt_t *zt, dns_zone_t *zone); /*%< * Mounts the zone on the zone table. * * Requires: * \li 'zt' to be valid * \li 'zone' to be valid * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_EXISTS * \li #ISC_R_NOSPACE * \li #ISC_R_NOMEMORY */ isc_result_t dns_zt_unmount(dns_zt_t *zt, dns_zone_t *zone); /*%< * Unmount the given zone from the table. * * Requires: * 'zt' to be valid * \li 'zone' to be valid * * Returns: * \li #ISC_R_SUCCESS * \li #ISC_R_NOTFOUND * \li #ISC_R_NOMEMORY */ isc_result_t dns_zt_find(dns_zt_t *zt, const dns_name_t *name, unsigned int options, dns_name_t *foundname, dns_zone_t **zone); /*%< * Find the best match for 'name' in 'zt'. If foundname is non NULL * then the name of the zone found is returned. * * Notes: * \li If the DNS_ZTFIND_NOEXACT is set, the best partial match (if any) * to 'name' will be returned. * * Requires: * \li 'zt' to be valid * \li 'name' to be valid * \li 'foundname' to be initialized and associated with a fixedname or NULL * \li 'zone' to be non NULL and '*zone' to be NULL * * Returns: * \li #ISC_R_SUCCESS * \li #DNS_R_PARTIALMATCH * \li #ISC_R_NOTFOUND * \li #ISC_R_NOSPACE */ void dns_zt_detach(dns_zt_t **ztp); /*%< * Detach the given zonetable, if the reference count goes to zero the * zonetable will be freed. In either case 'ztp' is set to NULL. * * Requires: * \li '*ztp' to be valid */ void dns_zt_flushanddetach(dns_zt_t **ztp); /*%< * Detach the given zonetable, if the reference count goes to zero the * zonetable will be flushed and then freed. In either case 'ztp' is * set to NULL. * * Requires: * \li '*ztp' to be valid */ void dns_zt_attach(dns_zt_t *zt, dns_zt_t **ztp); /*%< * Attach 'zt' to '*ztp'. * * Requires: * \li 'zt' to be valid * \li '*ztp' to be NULL */ isc_result_t dns_zt_load(dns_zt_t *zt, isc_boolean_t stop); isc_result_t dns_zt_loadnew(dns_zt_t *zt, isc_boolean_t stop); isc_result_t dns_zt_asyncload(dns_zt_t *zt, dns_zt_allloaded_t alldone, void *arg); /*%< * Load all zones in the table. If 'stop' is ISC_TRUE, * stop on the first error and return it. If 'stop' * is ISC_FALSE, ignore errors. * * dns_zt_loadnew() only loads zones that are not yet loaded. * dns_zt_load() also loads zones that are already loaded and * and whose master file has changed since the last load. * dns_zt_asyncload() loads zones asynchronously; when all * zones in the zone table have finished loaded (or failed due * to errors), the caller is informed by calling 'alldone' * with an argument of 'arg'. * * Requires: * \li 'zt' to be valid */ isc_result_t dns_zt_freezezones(dns_zt_t *zt, isc_boolean_t freeze); /*%< * Freeze/thaw updates to master zones. * Any pending updates will be flushed. * Zones will be reloaded on thaw. */ isc_result_t dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop, isc_result_t (*action)(dns_zone_t *, void *), void *uap); isc_result_t dns_zt_apply2(dns_zt_t *zt, isc_boolean_t stop, isc_result_t *sub, isc_result_t (*action)(dns_zone_t *, void *), void *uap); /*%< * Apply a given 'action' to all zone zones in the table. * If 'stop' is 'ISC_TRUE' then walking the zone tree will stop if * 'action' does not return ISC_R_SUCCESS. * * Requires: * \li 'zt' to be valid. * \li 'action' to be non NULL. * * Returns: * \li ISC_R_SUCCESS if action was applied to all nodes. If 'stop' is * ISC_FALSE and 'sub' is non NULL then the first error (if any) * reported by 'action' is returned in '*sub'; * any error code from 'action'. */ isc_boolean_t dns_zt_loadspending(dns_zt_t *zt); /*%< * Returns ISC_TRUE if and only if there are zones still waiting to * be loaded in zone table 'zt'. * * Requires: * \li 'zt' to be valid. */ void dns_zt_setviewcommit(dns_zt_t *zt); /*%< * Commit dns_zone_setview() calls previously made for all zones in this * zone table. * * Requires: *\li 'view' to be valid. */ void dns_zt_setviewrevert(dns_zt_t *zt); /*%< * Revert dns_zone_setview() calls previously made for all zones in this * zone table. * * Requires: *\li 'view' to be valid. */ ISC_LANG_ENDDECLS #endif /* DNS_ZT_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/dbiterator.h������������������������������������������������������������������������������0000644�����������������00000016412�14763166026�0010664 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_DBITERATOR_H #define DNS_DBITERATOR_H 1 /***** ***** Module Info *****/ /*! \file dns/dbiterator.h * \brief * The DNS DB Iterator interface allows iteration of all of the nodes in a * database. * * The dns_dbiterator_t type is like a "virtual class". To actually use * it, an implementation of the class is required. This implementation is * supplied by the database. * * It is the client's responsibility to call dns_db_detachnode() on all * nodes returned. * * XXX <more> XXX * * MP: *\li The iterator itself is not locked. The caller must ensure * synchronization. * *\li The iterator methods ensure appropriate database locking. * * Reliability: *\li No anticipated impact. * * Resources: *\li TBS * * Security: *\li No anticipated impact. * * Standards: *\li None. */ /***** ***** Imports *****/ #include <isc/lang.h> #include <isc/magic.h> #include <dns/types.h> ISC_LANG_BEGINDECLS /***** ***** Types *****/ typedef struct dns_dbiteratormethods { void (*destroy)(dns_dbiterator_t **iteratorp); isc_result_t (*first)(dns_dbiterator_t *iterator); isc_result_t (*last)(dns_dbiterator_t *iterator); isc_result_t (*seek)(dns_dbiterator_t *iterator, dns_name_t *name); isc_result_t (*prev)(dns_dbiterator_t *iterator); isc_result_t (*next)(dns_dbiterator_t *iterator); isc_result_t (*current)(dns_dbiterator_t *iterator, dns_dbnode_t **nodep, dns_name_t *name); isc_result_t (*pause)(dns_dbiterator_t *iterator); isc_result_t (*origin)(dns_dbiterator_t *iterator, dns_name_t *name); } dns_dbiteratormethods_t; #define DNS_DBITERATOR_MAGIC ISC_MAGIC('D','N','S','I') #define DNS_DBITERATOR_VALID(dbi) ISC_MAGIC_VALID(dbi, DNS_DBITERATOR_MAGIC) /*% * This structure is actually just the common prefix of a DNS db * implementation's version of a dns_dbiterator_t. * * Clients may use the 'db' field of this structure. Except for that field, * direct use of this structure by clients is forbidden. DB implementations * may change the structure. 'magic' must be DNS_DBITERATOR_MAGIC for any of * the dns_dbiterator routines to work. DB iterator implementations must * maintain all DB iterator invariants. */ struct dns_dbiterator { /* Unlocked. */ unsigned int magic; dns_dbiteratormethods_t * methods; dns_db_t * db; isc_boolean_t relative_names; isc_boolean_t cleaning; }; void dns_dbiterator_destroy(dns_dbiterator_t **iteratorp); /*%< * Destroy '*iteratorp'. * * Requires: * *\li '*iteratorp' is a valid iterator. * * Ensures: * *\li All resources used by the iterator are freed. * *\li *iteratorp == NULL. */ isc_result_t dns_dbiterator_first(dns_dbiterator_t *iterator); /*%< * Move the node cursor to the first node in the database (if any). * * Requires: *\li 'iterator' is a valid iterator. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMORE There are no nodes in the database. * *\li Other results are possible, depending on the DB implementation. */ isc_result_t dns_dbiterator_last(dns_dbiterator_t *iterator); /*%< * Move the node cursor to the last node in the database (if any). * * Requires: *\li 'iterator' is a valid iterator. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMORE There are no nodes in the database. * *\li Other results are possible, depending on the DB implementation. */ isc_result_t dns_dbiterator_seek(dns_dbiterator_t *iterator, dns_name_t *name); /*%< * Move the node cursor to the node with name 'name'. * * Requires: *\li 'iterator' is a valid iterator. * *\li 'name' is a valid name. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOTFOUND *\li #DNS_R_PARTIALMATCH * (node is at name above requested named when name has children) * *\li Other results are possible, depending on the DB implementation. */ isc_result_t dns_dbiterator_prev(dns_dbiterator_t *iterator); /*%< * Move the node cursor to the previous node in the database (if any). * * Requires: *\li 'iterator' is a valid iterator. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMORE There are no more nodes in the * database. * *\li Other results are possible, depending on the DB implementation. */ isc_result_t dns_dbiterator_next(dns_dbiterator_t *iterator); /*%< * Move the node cursor to the next node in the database (if any). * * Requires: *\li 'iterator' is a valid iterator. * * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOMORE There are no more nodes in the * database. * *\li Other results are possible, depending on the DB implementation. */ isc_result_t dns_dbiterator_current(dns_dbiterator_t *iterator, dns_dbnode_t **nodep, dns_name_t *name); /*%< * Return the current node. * * Notes: *\li If 'name' is not NULL, it will be set to the name of the node. * * Requires: *\li 'iterator' is a valid iterator. * *\li nodep != NULL && *nodep == NULL * *\li The node cursor of 'iterator' is at a valid location (i.e. the * result of last call to a cursor movement command was ISC_R_SUCCESS). * *\li 'name' is NULL, or is a valid name with a dedicated buffer. * * Returns: * *\li #ISC_R_SUCCESS *\li #DNS_R_NEWORIGIN If this iterator was created with * 'relative_names' set to ISC_TRUE, * then #DNS_R_NEWORIGIN will be returned * when the origin the names are * relative to changes. This result * can occur only when 'name' is not * NULL. This is also a successful * result. * *\li Other results are possible, depending on the DB implementation. */ isc_result_t dns_dbiterator_pause(dns_dbiterator_t *iterator); /*%< * Pause iteration. * * Calling a cursor movement method or dns_dbiterator_current() may cause * database locks to be acquired. Rather than reacquire these locks every * time one of these routines is called, the locks may simply be held. * Calling dns_dbiterator_pause() releases any such locks. Iterator clients * should call this routine any time they are not going to execute another * iterator method in the immediate future. * * Requires: *\li 'iterator' is a valid iterator. * * Ensures: *\li Any database locks being held for efficiency of iterator access are * released. * * Returns: *\li #ISC_R_SUCCESS * *\li Other results are possible, depending on the DB implementation. */ isc_result_t dns_dbiterator_origin(dns_dbiterator_t *iterator, dns_name_t *name); /*%< * Return the origin to which returned node names are relative. * * Requires: * *\li 'iterator' is a valid relative_names iterator. * *\li 'name' is a valid name with a dedicated buffer. * * Returns: * *\li #ISC_R_SUCCESS *\li #ISC_R_NOSPACE * *\li Other results are possible, depending on the DB implementation. */ void dns_dbiterator_setcleanmode(dns_dbiterator_t *iterator, isc_boolean_t mode); /*%< * Indicate that the given iterator is/is not cleaning the DB. * * Notes: *\li When 'mode' is ISC_TRUE, * * Requires: *\li 'iterator' is a valid iterator. */ ISC_LANG_ENDDECLS #endif /* DNS_DBITERATOR_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/catz.h������������������������������������������������������������������������������������0000644�����������������00000025372�14763166026�0007473 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_CATZ_H #define DNS_CATZ_H 1 #include <isc/ht.h> #include <isc/lang.h> #include <isc/refcount.h> #include <isc/rwlock.h> #include <isc/time.h> #include <isc/timer.h> #include <dns/db.h> #include <dns/fixedname.h> #include <dns/ipkeylist.h> #include <dns/rdata.h> #include <dns/types.h> ISC_LANG_BEGINDECLS #define DNS_CATZ_ERROR_LEVEL ISC_LOG_WARNING #define DNS_CATZ_INFO_LEVEL ISC_LOG_INFO #define DNS_CATZ_DEBUG_LEVEL1 ISC_LOG_DEBUG(1) #define DNS_CATZ_DEBUG_LEVEL2 ISC_LOG_DEBUG(2) #define DNS_CATZ_DEBUG_LEVEL3 ISC_LOG_DEBUG(3) #define DNS_CATZ_DEBUG_QUIET (DNS_CATZ_DEBUG_LEVEL3+1) /* * Catalog Zones functions and structures. */ /* * Options for a member zone in a catalog */ struct dns_catz_entry_options { /* * Options that can be overriden in catalog zone */ /* default-masters definition */ dns_ipkeylist_t masters; /* both as text in config format, NULL if none */ isc_buffer_t *allow_query; isc_buffer_t *allow_transfer; /* * Options that are only set in named.conf */ /* zone-directory definition */ char *zonedir; /* zone should not be stored on disk (no 'file' statement in def */ isc_boolean_t in_memory; /* * Minimal interval between catalog zone updates, if a new version * of catalog zone is received before this time the update will be * postponed. This is a global option for the whole catalog zone. */ isc_uint32_t min_update_interval; }; void dns_catz_options_init(dns_catz_options_t *options); /*%< * Initialize 'options' to NULL values. * * Requires: * \li options to be non NULL */ void dns_catz_options_free(dns_catz_options_t *options, isc_mem_t *mctx); /*%< * Free 'options' contents into 'mctx'. ('options' itself is not freed.) * * Requires: * \li options to be non NULL * \li mctx to be a valid memory context */ isc_result_t dns_catz_options_copy(isc_mem_t *mctx, const dns_catz_options_t *opts, dns_catz_options_t *nopts); /*%< * Duplicate 'opts' into 'nopts', allocating space from 'mctx' * * Requires: * \li 'mctx' to be a valid memory context * \li 'options' to be non NULL and valid options * \li 'nopts' to be non NULL */ isc_result_t dns_catz_options_setdefault(isc_mem_t *mctx, const dns_catz_options_t *defaults, dns_catz_options_t *opts); /*%< * Replace empty values in 'opts' with values from 'defaults' * * Requires: * \li mctx to be a valid memory context * \li defaults to be non NULL and valid options * \li opts to be non NULL */ dns_name_t * dns_catz_entry_getname(dns_catz_entry_t *entry); /*%< * Get domain name for 'entry' * * Requires: * \li entry to be non NULL * * Returns: * \li domain name for entry */ isc_result_t dns_catz_entry_new(isc_mem_t *mctx, const dns_name_t *domain, dns_catz_entry_t **nentryp); /*%< * Allocate a new catz_entry on 'mctx', with the name 'domain' * * Requires: * \li mctx to be a valid memory context * \li domain to be valid dns_name or NULL * \li nentryp to be non NULL, *nentryp to be NULL * * Returns: * \li ISC_R_SUCCESS on success * \li ISC_R_NOMEMORY on allocation failure */ isc_result_t dns_catz_entry_copy(dns_catz_zone_t *zone, const dns_catz_entry_t *entry, dns_catz_entry_t **nentryp); /*%< * Allocate a new catz_entry and deep copy 'entry' into 'nentryp'. * * Requires: * \li mctx to be a valid memory context * \li entry to be non NULL * \li nentryp to be non NULL, *nentryp to be NULL * * Returns: * \li ISC_R_SUCCESS on success * \li ISC_R_NOMEMORY on allocation failure */ void dns_catz_entry_attach(dns_catz_entry_t *entry, dns_catz_entry_t **entryp); /*%< * Attach an entry * * Requires: * \li entry is not NULL * \li entryp is not NULL, *entryp is NULL */ void dns_catz_entry_detach(dns_catz_zone_t *zone, dns_catz_entry_t **entryp); /*%< * Detach an entry, free if no further references * * Requires: * \li zone is not NULL * \li entryp is not NULL, *entryp is not NULL */ isc_boolean_t dns_catz_entry_validate(const dns_catz_entry_t *entry); /*%< * Validate whether entry is correct. * (NOT YET IMPLEMENTED: always returns true) */ isc_boolean_t dns_catz_entry_cmp(const dns_catz_entry_t *ea, const dns_catz_entry_t *eb); /*%< * Deep compare two entries * * Requires: * \li ea is not NULL * \li eb is not NULL * * Returns: * \li ISC_TRUE if entries are the same * \li ISC_FALSE if the entries differ */ void dns_catz_zone_attach(dns_catz_zone_t *zone, dns_catz_zone_t **zonep); /*%< * Attach a catzone * * Requires: * \li zone is not NULL * \li zonep is not NULL, *zonep is NULL */ void dns_catz_zone_detach(dns_catz_zone_t** zonep); /*%< * Detach a zone, free if no further references * * Requires: * \li zonep is not NULL, *zonep is not NULL */ isc_result_t dns_catz_new_zone(dns_catz_zones_t *catzs, dns_catz_zone_t **zonep, const dns_name_t *name); /*%< * Allocate a new catz zone on catzs mctx * * Requires: * \li catzs is not NULL * \li zonep is not NULL, *zonep is NULL * \li name is not NULL * */ dns_name_t * dns_catz_zone_getname(dns_catz_zone_t *zone); /*%< * Get catalog zone name * * Requires: * \li zone is not NULL */ dns_catz_options_t * dns_catz_zone_getdefoptions(dns_catz_zone_t *zone); /*%< * Get default member zone options for catalog zone 'zone' * * Requires: * \li zone is not NULL */ void dns_catz_zone_resetdefoptions(dns_catz_zone_t *zone); /*%< * Reset the default member zone options for catalog zone 'zone' to * the default values. * * Requires: * \li zone is not NULL */ isc_result_t dns_catz_zones_merge(dns_catz_zone_t *target, dns_catz_zone_t *newzone); /*%< * Merge 'newzone' into 'target', calling addzone/delzone/modzone * (from zone->catzs->zmm) for appropriate member zones. * * Requires: * \li orig is not NULL * \li newzone is not NULL, *newzone is not NULL * */ isc_result_t dns_catz_update_process(dns_catz_zones_t *catzs, dns_catz_zone_t *zone, dns_name_t *src_name, dns_rdataset_t *rdataset); /*%< * Process a single rdataset from a catalog zone 'zone' update, src_name is the * record name. * * Requires: * \li catzs is not NULL * \li zone is not NULL * \li src_name is not NULL * \li rdataset is valid */ isc_result_t dns_catz_generate_masterfilename(dns_catz_zone_t *zone, dns_catz_entry_t *entry, isc_buffer_t **buffer); /*%< * Generate master file name and put it into *buffer (might be reallocated). * The general format of the file name is: * __catz__catalog.zone.name__member_zone_name.db * But if it's too long it's shortened to: * __catz__unique_hash_generated_from_the_above.db * * Requires: * \li zone is not NULL * \li entry is not NULL * \li buffer is not NULL and *buffer is not NULL */ isc_result_t dns_catz_generate_zonecfg(dns_catz_zone_t *zone, dns_catz_entry_t *entry, isc_buffer_t **buf); /*%< * Generate a zone config entry (in text form) from dns_catz_entry and puts * it into *buf. buf might be reallocated. * * Requires: * \li zone is not NULL * \li entry is not NULL * \li buf is not NULL * \li *buf is NULL * */ /* Methods provided by named to dynamically modify the member zones */ /* xxxwpk TODO config! */ typedef isc_result_t (*dns_catz_zoneop_fn_t)(dns_catz_entry_t *entry, dns_catz_zone_t *origin, dns_view_t *view, isc_taskmgr_t *taskmgr, void *udata); struct dns_catz_zonemodmethods { dns_catz_zoneop_fn_t addzone; dns_catz_zoneop_fn_t modzone; dns_catz_zoneop_fn_t delzone; void * udata; }; isc_result_t dns_catz_new_zones(dns_catz_zones_t **catzsp, dns_catz_zonemodmethods_t *zmm, isc_mem_t *mctx, isc_taskmgr_t *taskmgr, isc_timermgr_t *timermgr); /*%< * Allocate a new catz_zones object, a collection storing all catalog zones * for a view. * * Requires: * \li catzsp is not NULL, *catzsp is NULL * \li zmm is not NULL * */ isc_result_t dns_catz_add_zone(dns_catz_zones_t *catzs, const dns_name_t *name, dns_catz_zone_t **catzp); /*%< * Allocate a new catz named 'name' and put it in 'catzs' collection. * * Requires: * \li catzs is not NULL * \li name is not NULL * \li zonep is not NULL, *zonep is NULL * */ dns_catz_zone_t * dns_catz_get_zone(dns_catz_zones_t *catzs, const dns_name_t *name); /*%< * Returns a zone named 'name' from collection 'catzs' * * Requires: * \li catzs is not NULL * \li name is not NULL */ void dns_catz_catzs_attach(dns_catz_zones_t *catzs, dns_catz_zones_t **catzsp); /*%< * Attach 'catzs' to 'catzsp' * * Requires: * \li catzs is not NULL * \li catzsp is not NULL, *catzsp is NULL */ void dns_catz_catzs_detach(dns_catz_zones_t **catzsp); /*%< * Detach 'catzsp', free if no further references * * Requires: * \li catzsp is not NULL, *catzsp is not NULL */ void dns_catz_catzs_set_view(dns_catz_zones_t *catzs, dns_view_t *view); /*%< * Set a view for catzs * * Requires: * \li catzs is not NULL * \li catzs->view is NULL or catzs->view == view */ isc_result_t dns_catz_dbupdate_callback(dns_db_t *db, void *fn_arg); /*%< * Callback for update of catalog zone database. * If there was no catalog zone update recently it launches an * update_taskaction immediately. * If there was an update recently it schedules update_taskaction for some time * in the future. * If there is an update scheduled it replaces old db version with a new one. * * Requires: * \li db is a valid database * \li fn_arg is not NULL (casted to dns_catz_zones_t*) */ void dns_catz_update_taskaction(isc_task_t *task, isc_event_t *event); /*%< * Task that launches dns_catz_update_from_db * * Requires: * \li event is not NULL */ void dns_catz_update_from_db(dns_db_t *db, dns_catz_zones_t *catzs); /*%< * Process an updated database for a catalog zone. * It creates a new catz, iterates over database to fill it with content, and * then merges new catz into old catz. * * Requires: * \li db is a valid DB * \li catzs is not NULL * */ void dns_catz_prereconfig(dns_catz_zones_t *catzs); /*%< * Called before reconfig, clears 'active' flag on all the zones in set * * Requires: * \li catzs is not NULL * */ void dns_catz_postreconfig(dns_catz_zones_t *catzs); /*%< * Called after reconfig, walks through all zones in set, removes those * inactive and force reload of those with changed configuration. * * Requires: * \li catzs is not NULL */ isc_result_t dns_catz_get_iterator(dns_catz_zone_t *catz, isc_ht_iter_t **itp); /*%< * Get the hashtable iterator on catalog zone members, point '*itp' to it. * * Returns: * \li #ISC_R_SUCCESS -- success * \li Any other value -- failure */ ISC_LANG_ENDDECLS #endif /* DNS_CATZ_H_ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/dlz_dlopen.h������������������������������������������������������������������������������0000644�����������������00000011056�14763166026�0010656 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! \file dns/dlz_dlopen.h */ #ifndef DLZ_DLOPEN_H #define DLZ_DLOPEN_H #include <dns/sdlz.h> ISC_LANG_BEGINDECLS /* * This header provides a minimal set of defines and typedefs needed * for the entry points of an external DLZ module for bind9. */ #define DLZ_DLOPEN_VERSION 3 #define DLZ_DLOPEN_AGE 0 /* * dlz_dlopen_version() is required for all DLZ external drivers. It * should return DLZ_DLOPEN_VERSION */ typedef int dlz_dlopen_version_t(unsigned int *flags); /* * dlz_dlopen_create() is required for all DLZ external drivers. */ typedef isc_result_t dlz_dlopen_create_t(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, ...); /* * dlz_dlopen_destroy() is optional, and will be called when the * driver is unloaded if supplied */ typedef void dlz_dlopen_destroy_t(void *dbdata); /* * dlz_dlopen_findzonedb() is required for all DLZ external drivers */ typedef isc_result_t dlz_dlopen_findzonedb_t(void *dbdata, const char *name, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo); /* * dlz_dlopen_lookup() is required for all DLZ external drivers */ typedef isc_result_t dlz_dlopen_lookup_t(const char *zone, const char *name, void *dbdata, dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo); /* * dlz_dlopen_authority is optional() if dlz_dlopen_lookup() * supplies authority information for the dns record */ typedef isc_result_t dlz_dlopen_authority_t(const char *zone, void *dbdata, dns_sdlzlookup_t *lookup); /* * dlz_dlopen_allowzonexfr() is optional, and should be supplied if * you want to support zone transfers */ typedef isc_result_t dlz_dlopen_allowzonexfr_t(void *dbdata, const char *name, const char *client); /* * dlz_dlopen_allnodes() is optional, but must be supplied if supply a * dlz_dlopen_allowzonexfr() function */ typedef isc_result_t dlz_dlopen_allnodes_t(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes); /* * dlz_dlopen_newversion() is optional. It should be supplied if you * want to support dynamic updates. */ typedef isc_result_t dlz_dlopen_newversion_t(const char *zone, void *dbdata, void **versionp); /* * dlz_closeversion() is optional, but must be supplied if you supply * a dlz_newversion() function */ typedef void dlz_dlopen_closeversion_t(const char *zone, isc_boolean_t commit, void *dbdata, void **versionp); /* * dlz_dlopen_configure() is optional, but must be supplied if you * want to support dynamic updates */ typedef isc_result_t dlz_dlopen_configure_t(dns_view_t *view, dns_dlzdb_t *dlzdb, void *dbdata); /* * dlz_dlopen_setclientcallback() is optional, but must be supplied if you * want to retrieve information about the client (e.g., source address) * before sending a replay. */ typedef isc_result_t dlz_dlopen_setclientcallback_t(dns_view_t *view, void *dbdata); /* * dlz_dlopen_ssumatch() is optional, but must be supplied if you want * to support dynamic updates */ typedef isc_boolean_t dlz_dlopen_ssumatch_t(const char *signer, const char *name, const char *tcpaddr, const char *type, const char *key, isc_uint32_t keydatalen, unsigned char *keydata, void *dbdata); /* * dlz_dlopen_addrdataset() is optional, but must be supplied if you * want to support dynamic updates */ typedef isc_result_t dlz_dlopen_addrdataset_t(const char *name, const char *rdatastr, void *dbdata, void *version); /* * dlz_dlopen_subrdataset() is optional, but must be supplied if you * want to support dynamic updates */ typedef isc_result_t dlz_dlopen_subrdataset_t(const char *name, const char *rdatastr, void *dbdata, void *version); /* * dlz_dlopen_delrdataset() is optional, but must be supplied if you * want to support dynamic updates */ typedef isc_result_t dlz_dlopen_delrdataset_t(const char *name, const char *type, void *dbdata, void *version); ISC_LANG_ENDDECLS #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/dns/dispatch.h��������������������������������������������������������������������������������0000644�����������������00000040061�14763166026�0010321 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef DNS_DISPATCH_H #define DNS_DISPATCH_H 1 /***** ***** Module Info *****/ /*! \file dns/dispatch.h * \brief * DNS Dispatch Management * Shared UDP and single-use TCP dispatches for queries and responses. * * MP: * *\li All locking is performed internally to each dispatch. * Restrictions apply to dns_dispatch_removeresponse(). * * Reliability: * * Resources: * * Security: * *\li Depends on the isc_socket_t and dns_message_t for prevention of * buffer overruns. * * Standards: * *\li None. */ /*** *** Imports ***/ #include <isc/buffer.h> #include <isc/lang.h> #include <isc/mutex.h> #include <isc/socket.h> #include <isc/types.h> #include <dns/types.h> ISC_LANG_BEGINDECLS /*% * This event is sent to a task when a response comes in. * No part of this structure should ever be modified by the caller, * other than parts of the buffer. The holy parts of the buffer are * the base and size of the buffer. All other parts of the buffer may * be used. On event delivery the used region contains the packet. * * "id" is the received message id, * * "addr" is the host that sent it to us, * * "buffer" holds state on the received data. * * The "free" routine for this event will clean up itself as well as * any buffer space allocated from common pools. */ struct dns_dispatchevent { ISC_EVENT_COMMON(dns_dispatchevent_t); /*%< standard event common */ isc_result_t result; /*%< result code */ isc_int32_t id; /*%< message id */ isc_sockaddr_t addr; /*%< address recv'd from */ struct in6_pktinfo pktinfo; /*%< reply info for v6 */ isc_buffer_t buffer; /*%< data buffer */ isc_uint32_t attributes; /*%< mirrored from socket.h */ }; /*% * This is a set of one or more dispatches which can be retrieved * round-robin fashion. */ struct dns_dispatchset { isc_mem_t *mctx; dns_dispatch_t **dispatches; int ndisp; int cur; isc_mutex_t lock; }; /*@{*/ /*% * Attributes for added dispatchers. * * Values with the mask 0xffff0000 are application defined. * Values with the mask 0x0000ffff are library defined. * * Insane values (like setting both TCP and UDP) are not caught. Don't * do that. * * _PRIVATE * The dispatcher cannot be shared. * * _TCP, _UDP * The dispatcher is a TCP or UDP socket. * * _IPV4, _IPV6 * The dispatcher uses an IPv4 or IPv6 socket. * * _NOLISTEN * The dispatcher should not listen on the socket. * * _MAKEQUERY * The dispatcher can be used to issue queries to other servers, and * accept replies from them. * * _RANDOMPORT * Previously used to indicate that the port of a dispatch UDP must be * chosen randomly. This behavior now always applies and the attribute * is obsoleted. * * _EXCLUSIVE * A separate socket will be used on-demand for each transaction. */ #define DNS_DISPATCHATTR_PRIVATE 0x00000001U #define DNS_DISPATCHATTR_TCP 0x00000002U #define DNS_DISPATCHATTR_UDP 0x00000004U #define DNS_DISPATCHATTR_IPV4 0x00000008U #define DNS_DISPATCHATTR_IPV6 0x00000010U #define DNS_DISPATCHATTR_NOLISTEN 0x00000020U #define DNS_DISPATCHATTR_MAKEQUERY 0x00000040U #define DNS_DISPATCHATTR_CONNECTED 0x00000080U #define DNS_DISPATCHATTR_FIXEDID 0x00000100U #define DNS_DISPATCHATTR_EXCLUSIVE 0x00000200U /*@}*/ /* */ #define DNS_DISPATCHOPT_FIXEDID 0x00000001U isc_result_t dns_dispatchmgr_create(isc_mem_t *mctx, isc_entropy_t *entropy, dns_dispatchmgr_t **mgrp); /*%< * Creates a new dispatchmgr object. * * Requires: *\li "mctx" be a valid memory context. * *\li mgrp != NULL && *mgrp == NULL * *\li "entropy" may be NULL, in which case an insecure random generator * will be used. If it is non-NULL, it must be a valid entropy * source. * * Returns: *\li ISC_R_SUCCESS -- all ok * *\li anything else -- failure */ void dns_dispatchmgr_destroy(dns_dispatchmgr_t **mgrp); /*%< * Destroys the dispatchmgr when it becomes empty. This could be * immediately. * * Requires: *\li mgrp != NULL && *mgrp is a valid dispatchmgr. */ void dns_dispatchmgr_setblackhole(dns_dispatchmgr_t *mgr, dns_acl_t *blackhole); /*%< * Sets the dispatcher's "blackhole list," a list of addresses that will * be ignored by all dispatchers created by the dispatchmgr. * * Requires: * \li mgrp is a valid dispatchmgr * \li blackhole is a valid acl */ dns_acl_t * dns_dispatchmgr_getblackhole(dns_dispatchmgr_t *mgr); /*%< * Gets a pointer to the dispatcher's current blackhole list, * without incrementing its reference count. * * Requires: *\li mgr is a valid dispatchmgr * Returns: *\li A pointer to the current blackhole list, or NULL. */ void dns_dispatchmgr_setblackportlist(dns_dispatchmgr_t *mgr, dns_portlist_t *portlist); /*%< * This function is deprecated. Use dns_dispatchmgr_setavailports() instead. * * Requires: *\li mgr is a valid dispatchmgr */ dns_portlist_t * dns_dispatchmgr_getblackportlist(dns_dispatchmgr_t *mgr); /*%< * This function is deprecated and always returns NULL. * * Requires: *\li mgr is a valid dispatchmgr */ isc_result_t dns_dispatchmgr_setavailports(dns_dispatchmgr_t *mgr, isc_portset_t *v4portset, isc_portset_t *v6portset); /*%< * Sets a list of UDP ports that can be used for outgoing UDP messages. * * Requires: *\li mgr is a valid dispatchmgr *\li v4portset is NULL or a valid port set *\li v6portset is NULL or a valid port set */ void dns_dispatchmgr_setstats(dns_dispatchmgr_t *mgr, isc_stats_t *stats); /*%< * Sets statistics counter for the dispatchmgr. This function is expected to * be called only on zone creation (when necessary). * Once installed, it cannot be removed or replaced. Also, there is no * interface to get the installed stats from the zone; the caller must keep the * stats to reference (e.g. dump) it later. * * Requires: *\li mgr is a valid dispatchmgr with no managed dispatch. *\li stats is a valid statistics supporting resolver statistics counters * (see dns/stats.h). */ isc_result_t dns_dispatch_getudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr, isc_taskmgr_t *taskmgr, isc_sockaddr_t *localaddr, unsigned int buffersize, unsigned int maxbuffers, unsigned int maxrequests, unsigned int buckets, unsigned int increment, unsigned int attributes, unsigned int mask, dns_dispatch_t **dispp); isc_result_t dns_dispatch_getudp_dup(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr, isc_taskmgr_t *taskmgr, isc_sockaddr_t *localaddr, unsigned int buffersize, unsigned int maxbuffers, unsigned int maxrequests, unsigned int buckets, unsigned int increment, unsigned int attributes, unsigned int mask, dns_dispatch_t **dispp, dns_dispatch_t *dup); /*%< * Attach to existing dns_dispatch_t if one is found with dns_dispatchmgr_find, * otherwise create a new UDP dispatch. * * Requires: *\li All pointer parameters be valid for their respective types. * *\li dispp != NULL && *disp == NULL * *\li 512 <= buffersize <= 64k * *\li maxbuffers > 0 * *\li buckets < 2097169 * *\li increment > buckets * *\li (attributes & DNS_DISPATCHATTR_TCP) == 0 * * Returns: *\li ISC_R_SUCCESS -- success. * *\li Anything else -- failure. */ isc_result_t dns_dispatch_createtcp(dns_dispatchmgr_t *mgr, isc_socket_t *sock, isc_taskmgr_t *taskmgr, unsigned int buffersize, unsigned int maxbuffers, unsigned int maxrequests, unsigned int buckets, unsigned int increment, unsigned int attributes, dns_dispatch_t **dispp); isc_result_t dns_dispatch_createtcp2(dns_dispatchmgr_t *mgr, isc_socket_t *sock, isc_taskmgr_t *taskmgr, isc_sockaddr_t *localaddr, isc_sockaddr_t *destaddr, unsigned int buffersize, unsigned int maxbuffers, unsigned int maxrequests, unsigned int buckets, unsigned int increment, unsigned int attributes, dns_dispatch_t **dispp); /*%< * Create a new dns_dispatch and attach it to the provided isc_socket_t. * * For all dispatches, "buffersize" is the maximum packet size we will * accept. * * "maxbuffers" and "maxrequests" control the number of buffers in the * overall system and the number of buffers which can be allocated to * requests. * * "buckets" is the number of buckets to use, and should be prime. * * "increment" is used in a collision avoidance function, and needs to be * a prime > buckets, and not 2. * * Requires: * *\li mgr is a valid dispatch manager. * *\li sock is a valid. * *\li task is a valid task that can be used internally to this dispatcher. * * \li 512 <= buffersize <= 64k * *\li maxbuffers > 0. * *\li maxrequests <= maxbuffers. * *\li buckets < 2097169 (the next prime after 65536 * 32) * *\li increment > buckets (and prime). * *\li attributes includes #DNS_DISPATCHATTR_TCP and does not include * #DNS_DISPATCHATTR_UDP. * * Returns: *\li ISC_R_SUCCESS -- success. * *\li Anything else -- failure. */ void dns_dispatch_attach(dns_dispatch_t *disp, dns_dispatch_t **dispp); /*%< * Attach to a dispatch handle. * * Requires: *\li disp is valid. * *\li dispp != NULL && *dispp == NULL */ void dns_dispatch_detach(dns_dispatch_t **dispp); /*%< * Detaches from the dispatch. * * Requires: *\li dispp != NULL and *dispp be a valid dispatch. */ void dns_dispatch_starttcp(dns_dispatch_t *disp); /*%< * Start processing of a TCP dispatch once the socket connects. * * Requires: *\li 'disp' is valid. */ isc_result_t dns_dispatch_gettcp(dns_dispatchmgr_t *mgr, isc_sockaddr_t *destaddr, isc_sockaddr_t *localaddr, dns_dispatch_t **dispp); isc_result_t dns_dispatch_gettcp2(dns_dispatchmgr_t *mgr, isc_sockaddr_t *destaddr, isc_sockaddr_t *localaddr, isc_boolean_t *connected, dns_dispatch_t **dispp); /* * Attempt to connect to a existing TCP connection (connection completed * for dns_dispatch_gettcp()). */ isc_result_t dns_dispatch_addresponse3(dns_dispatch_t *disp, unsigned int options, isc_sockaddr_t *dest, isc_task_t *task, isc_taskaction_t action, void *arg, isc_uint16_t *idp, dns_dispentry_t **resp, isc_socketmgr_t *sockmgr); isc_result_t dns_dispatch_addresponse2(dns_dispatch_t *disp, isc_sockaddr_t *dest, isc_task_t *task, isc_taskaction_t action, void *arg, isc_uint16_t *idp, dns_dispentry_t **resp, isc_socketmgr_t *sockmgr); isc_result_t dns_dispatch_addresponse(dns_dispatch_t *disp, isc_sockaddr_t *dest, isc_task_t *task, isc_taskaction_t action, void *arg, isc_uint16_t *idp, dns_dispentry_t **resp); /*%< * Add a response entry for this dispatch. * * "*idp" is filled in with the assigned message ID, and *resp is filled in * to contain the magic token used to request event flow stop. * * Arranges for the given task to get a callback for response packets. When * the event is delivered, it must be returned using dns_dispatch_freeevent() * or through dns_dispatch_removeresponse() for another to be delivered. * * Requires: *\li "idp" be non-NULL. * *\li "task" "action" and "arg" be set as appropriate. * *\li "dest" be non-NULL and valid. * *\li "resp" be non-NULL and *resp be NULL * *\li "sockmgr" be NULL or a valid socket manager. If 'disp' has * the DNS_DISPATCHATTR_EXCLUSIVE attribute, this must not be NULL, * which also means dns_dispatch_addresponse() cannot be used. * * Ensures: * *\li <id, dest> is a unique tuple. That means incoming messages * are identifiable. * * Returns: * *\li ISC_R_SUCCESS -- all is well. *\li ISC_R_NOMEMORY -- memory could not be allocated. *\li ISC_R_NOMORE -- no more message ids can be allocated * for this destination. */ void dns_dispatch_removeresponse(dns_dispentry_t **resp, dns_dispatchevent_t **sockevent); /*%< * Stops the flow of responses for the provided id and destination. * If "sockevent" is non-NULL, the dispatch event and associated buffer is * also returned to the system. * * Requires: *\li "resp" != NULL and "*resp" contain a value previously allocated * by dns_dispatch_addresponse(); * *\li May only be called from within the task given as the 'task' * argument to dns_dispatch_addresponse() when allocating '*resp'. */ isc_socket_t * dns_dispatch_getentrysocket(dns_dispentry_t *resp); isc_socket_t * dns_dispatch_getsocket(dns_dispatch_t *disp); /*%< * Return the socket associated with this dispatcher. * * Requires: *\li disp is valid. * * Returns: *\li The socket the dispatcher is using. */ isc_result_t dns_dispatch_getlocaladdress(dns_dispatch_t *disp, isc_sockaddr_t *addrp); /*%< * Return the local address for this dispatch. * This currently only works for dispatches using UDP sockets. * * Requires: *\li disp is valid. *\li addrp to be non null. * * Returns: *\li ISC_R_SUCCESS *\li ISC_R_NOTIMPLEMENTED */ void dns_dispatch_cancel(dns_dispatch_t *disp); /*%< * cancel outstanding clients * * Requires: *\li disp is valid. */ unsigned int dns_dispatch_getattributes(dns_dispatch_t *disp); /*%< * Return the attributes (DNS_DISPATCHATTR_xxx) of this dispatch. Only the * non-changeable attributes are expected to be referenced by the caller. * * Requires: *\li disp is valid. */ void dns_dispatch_changeattributes(dns_dispatch_t *disp, unsigned int attributes, unsigned int mask); /*%< * Set the bits described by "mask" to the corresponding values in * "attributes". * * That is: * * \code * new = (old & ~mask) | (attributes & mask) * \endcode * * This function has a side effect when #DNS_DISPATCHATTR_NOLISTEN changes. * When the flag becomes off, the dispatch will start receiving on the * corresponding socket. When the flag becomes on, receive events on the * corresponding socket will be canceled. * * Requires: *\li disp is valid. * *\li attributes are reasonable for the dispatch. That is, setting the UDP * attribute on a TCP socket isn't reasonable. */ void dns_dispatch_importrecv(dns_dispatch_t *disp, isc_event_t *event); /*%< * Inform the dispatcher of a socket receive. This is used for sockets * shared between dispatchers and clients. If the dispatcher fails to copy * or send the event, nothing happens. * * If the attribute DNS_DISPATCHATTR_NOLISTEN is not set, then * the dispatch is already handling a recv; return immediately. * * Requires: *\li disp is valid, and the attribute DNS_DISPATCHATTR_NOLISTEN is set. * event != NULL */ dns_dispatch_t * dns_dispatchset_get(dns_dispatchset_t *dset); /*%< * Retrieve the next dispatch from dispatch set 'dset', and increment * the round-robin counter. * * Requires: *\li dset != NULL */ isc_result_t dns_dispatchset_create(isc_mem_t *mctx, isc_socketmgr_t *sockmgr, isc_taskmgr_t *taskmgr, dns_dispatch_t *source, dns_dispatchset_t **dsetp, int n); /*%< * Given a valid dispatch 'source', create a dispatch set containing * 'n' UDP dispatches, with the remainder filled out by clones of the * source. * * Requires: *\li source is a valid UDP dispatcher *\li dsetp != NULL, *dsetp == NULL */ void dns_dispatchset_cancelall(dns_dispatchset_t *dset, isc_task_t *task); /*%< * Cancel socket operations for the dispatches in 'dset'. */ void dns_dispatchset_destroy(dns_dispatchset_t **dsetp); /*%< * Dereference all the dispatches in '*dsetp', free the dispatchset * memory, and set *dsetp to NULL. * * Requires: *\li dset is valid */ void dns_dispatch_setdscp(dns_dispatch_t *disp, isc_dscp_t dscp); isc_dscp_t dns_dispatch_getdscp(dns_dispatch_t *disp); /*%< * Set/get the DSCP value to be used when sending responses to clients, * as defined in the "listen-on" or "listen-on-v6" statements. * * Requires: *\li disp is valid. */ isc_result_t dns_dispatch_getnext(dns_dispentry_t *resp, dns_dispatchevent_t **sockevent); /*%< * Free the sockevent and trigger the sending of the next item off the * dispatch queue if present. * * Requires: *\li resp is valid *\li *sockevent to be valid */ ISC_LANG_ENDDECLS #endif /* DNS_DISPATCH_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/config.h��������������������������������������������������������������������������������������0000644�����������������00000044716�14763166026�0007216 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.in by autoheader. */ /* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! \file */ /*** *** This file is not to be included by any public header files, because *** it does not get installed. ***/ /** define on DEC OSF to enable 4.4BSD style sa_len support */ /* #undef _SOCKADDR_LEN */ /** define if your system needs pthread_init() before using pthreads */ /* #undef NEED_PTHREAD_INIT */ /** define if your system has sigwait() */ #define HAVE_SIGWAIT 1 /** define if sigwait() is the UnixWare flavor */ /* #undef HAVE_UNIXWARE_SIGWAIT */ /** define on Solaris to get sigwait() to work using pthreads semantics */ /* #undef _POSIX_PTHREAD_SEMANTICS */ /** define if LinuxThreads is in use */ #define HAVE_LINUXTHREADS 1 /** define if sysconf() is available */ #define HAVE_SYSCONF 1 /** define if sysctlbyname() is available */ /* #undef HAVE_SYSCTLBYNAME */ /** define if catgets() is available */ #define HAVE_CATGETS 1 /** define if getifaddrs() exists */ #define HAVE_GETIFADDRS 1 /** define if you have the NET_RT_IFLIST sysctl variable and sys/sysctl.h */ /* #undef HAVE_IFLIST_SYSCTL */ /** define if tzset() is available */ #define HAVE_TZSET 1 /** define if struct addrinfo exists */ #define HAVE_ADDRINFO 1 /** define if getaddrinfo() exists */ #define HAVE_GETADDRINFO 1 /** define if gai_strerror() exists */ #define HAVE_GAISTRERROR 1 /** * define if pthread_setconcurrency() should be called to tell the * OS how many threads we might want to run. */ /* #undef CALL_PTHREAD_SETCONCURRENCY */ /** define if IPv6 is not disabled */ #define WANT_IPV6 1 /** define if flockfile() is available */ #define HAVE_FLOCKFILE 1 /** define if getc_unlocked() is available */ #define HAVE_GETCUNLOCKED 1 /** Shut up warnings about sputaux in stdio.h on BSD/OS pre-4.1 */ /* #undef SHUTUP_SPUTAUX */ #ifdef SHUTUP_SPUTAUX struct __sFILE; extern __inline int __sputaux(int _c, struct __sFILE *_p); #endif /** Shut up warnings about missing sigwait prototype on BSD/OS 4.0* */ /* #undef SHUTUP_SIGWAIT */ #ifdef SHUTUP_SIGWAIT int sigwait(const unsigned int *set, int *sig); #endif /** Shut up warnings from gcc -Wcast-qual on BSD/OS 4.1. */ /* #undef SHUTUP_STDARG_CAST */ #if defined(SHUTUP_STDARG_CAST) && defined(__GNUC__) #include <stdarg.h> /** Grr. Must be included *every time*. */ /** * The silly continuation line is to keep configure from * commenting out the #undef. */ #undef \ va_start #define va_start(ap, last) \ do { \ union { const void *konst; long *var; } _u; \ _u.konst = &(last); \ ap = (va_list)(_u.var + __va_words(__typeof(last))); \ } while (0) #endif /** SHUTUP_STDARG_CAST && __GNUC__ */ /** define if the system has a random number generating device */ #define PATH_RANDOMDEV "/dev/random" /** define if pthread_attr_getstacksize() is available */ #define HAVE_PTHREAD_ATTR_GETSTACKSIZE 1 /** define if pthread_attr_setstacksize() is available */ #define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 /** define if you have strerror in the C library. */ #define HAVE_STRERROR 1 /* Define if OpenSSL includes DSA support */ #define HAVE_OPENSSL_DSA 1 /* Define if you have getpassphrase in the C library. */ /* #undef HAVE_GETPASSPHRASE */ /* Define to the length type used by the socket API (socklen_t, size_t, int). */ #define ISC_SOCKADDR_LEN_T socklen_t /* Define if threads need PTHREAD_SCOPE_SYSTEM */ /* #undef NEED_PTHREAD_SCOPE_SYSTEM */ /* Define to 1 if you have the uname library function. */ #define HAVE_UNAME 1 /* Define if building universal (internal helper macro) */ /* #undef AC_APPLE_UNIVERSAL_BUILD */ /* Use AES for Client Cookie generation */ #define AES_CC 1 /* Define to enable the "filter-aaaa-on-v4" and "filter-aaaa-on-v6" options. */ #define ALLOW_FILTER_AAAA 1 /* define if ATF unit tests are to be built. */ #define ATF_TEST 1 /* Define if recvmsg() does not meet all of the BSD socket API specifications. */ /* #undef BROKEN_RECVMSG */ /* Define if you cannot bind() before connect() for TCP sockets. */ /* #undef BROKEN_TCP_BIND_BEFORE_CONNECT */ /* Define to enable "rrset-order fixed" syntax. */ #define DNS_RDATASET_FIXED 1 /* Define to enable American Fuzzy Lop test harness */ /* #undef ENABLE_AFL */ /* Define to enable rpz-nsdname rules. */ #define ENABLE_RPZ_NSDNAME 1 /* Define to enable rpz-nsip rules. */ #define ENABLE_RPZ_NSIP 1 /* Solaris hack to get select_large_fdset. */ /* #undef FD_SETSIZE */ /* Define to nothing if C supports flexible array members, and to 1 if it does not. That way, with a declaration like `struct s { int n; double d[FLEXIBLE_ARRAY_MEMBER]; };', the struct hack can be used with pre-C99 compilers. When computing the size of such an object, don't use 'sizeof (struct s)' as it overestimates the size. Use 'offsetof (struct s, d)' instead. Don't use 'offsetof (struct s, d[0])', as this doesn't work with MSVC and with C++ compilers. */ #define FLEXIBLE_ARRAY_MEMBER /**/ /* Define to 1 if you have the `arc4random' function. */ /* #undef HAVE_ARC4RANDOM */ /* Define to 1 if you have the `arc4random_addrandom' function. */ /* #undef HAVE_ARC4RANDOM_ADDRANDOM */ /* Define to 1 if you have the `arc4random_stir' function. */ /* #undef HAVE_ARC4RANDOM_STIR */ /* Define to 1 if the compiler supports __builtin_clz. */ #define HAVE_BUILTIN_CLZ 1 /* Define to 1 if the compiler supports __builtin_expect. */ #define HAVE_BUILTIN_EXPECT 1 /* Define to 1 if you have the `chroot' function. */ #define HAVE_CHROOT 1 /* Define if clock_gettime is available. */ #define HAVE_CLOCK_GETTIME 1 /* Define to 1 if you have the <devpoll.h> header file. */ /* #undef HAVE_DEVPOLL_H */ /* Define to 1 if you have the `DH_get0_key' function. */ /* #undef HAVE_DH_GET0_KEY */ /* Define to 1 if you have the `dlclose' function. */ #define HAVE_DLCLOSE 1 /* Define to 1 if you have the <dlfcn.h> header file. */ #define HAVE_DLFCN_H 1 /* Define to 1 if you have the `dlopen' function. */ #define HAVE_DLOPEN 1 /* Define to 1 if you have the `dlsym' function. */ #define HAVE_DLSYM 1 /* Define to 1 to enable dnstap support */ /* #undef HAVE_DNSTAP */ /* Define to 1 if you have the `DSA_get0_pqg' function. */ /* #undef HAVE_DSA_GET0_PQG */ /* Define to 1 if you have the `ECDSA_SIG_get0' function. */ /* #undef HAVE_ECDSA_SIG_GET0 */ /* Define to 1 if you have the <editline/readline.h> header file. */ /* #undef HAVE_EDITLINE_READLINE_H */ /* Define to 1 if you have the <edit/readline/history.h> header file. */ /* #undef HAVE_EDIT_READLINE_HISTORY_H */ /* Define to 1 if you have the <edit/readline/readline.h> header file. */ /* #undef HAVE_EDIT_READLINE_READLINE_H */ /* Define to 1 if you have the `EVP_sha256' function. */ #define HAVE_EVP_SHA256 1 /* Define to 1 if you have the `EVP_sha384' function. */ #define HAVE_EVP_SHA384 1 /* Define to 1 if you have the `EVP_sha512' function. */ #define HAVE_EVP_SHA512 1 /* Define to 1 if you have the `explicit_bzero' function. */ /* #undef HAVE_EXPLICIT_BZERO */ /* Define to 1 if you have the <fcntl.h> header file. */ #define HAVE_FCNTL_H 1 /* Define if OpenSSL provides FIPS_mode() */ #define HAVE_FIPS_MODE 1 /* Define to 1 if you have the `fseeko' function. */ #define HAVE_FSEEKO 1 /* Define to 1 if you have the `ftello' function. */ #define HAVE_FTELLO 1 /* Build with GeoIP support */ #define HAVE_GEOIP 1 /* Build with GeoIP City IPv6 support */ #define HAVE_GEOIP_CITY_V6 1 /* Build with GeoIP Country IPv6 support */ #define HAVE_GEOIP_V6 1 /* Define to 1 if you have the `getrandom' function. */ /* #undef HAVE_GETRANDOM */ /* Define to use gperftools CPU profiler. */ /* #undef HAVE_GPERFTOOLS_PROFILER */ /* Define to 1 if you have the <gssapi/gssapi.h> header file. */ #define HAVE_GSSAPI_GSSAPI_H 1 /* Define to 1 if you have the <gssapi/gssapi_krb5.h> header file. */ #define HAVE_GSSAPI_GSSAPI_KRB5_H 1 /* Define to 1 if you have the <gssapi.h> header file. */ #define HAVE_GSSAPI_H 1 /* Define to 1 if you have the <gssapi_krb5.h> header file. */ /* #undef HAVE_GSSAPI_KRB5_H */ /* Define to 1 if you have the if_nametoindex function. */ #define HAVE_IF_NAMETOINDEX 1 /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 /* Define if libjson was found */ /* #undef HAVE_JSON */ /* Define if json-c was found */ /* #undef HAVE_JSON_C */ /* Define to 1 if you have the <kerberosv5/krb5.h> header file. */ /* #undef HAVE_KERBEROSV5_KRB5_H */ /* Define to 1 if you have the <krb5.h> header file. */ #define HAVE_KRB5_H 1 /* Define to 1 if you have the <krb5/krb5.h> header file. */ #define HAVE_KRB5_KRB5_H 1 /* Define to 1 if you have the `c' library (-lc). */ /* #undef HAVE_LIBC */ /* Define to 1 if you have the `cap' library (-lcap). */ #define HAVE_LIBCAP 1 /* if system have backtrace function */ #define HAVE_LIBCTRACE /**/ /* Define to 1 if you have the `c_r' library (-lc_r). */ /* #undef HAVE_LIBC_R */ /* Define to 1 if you have the `nsl' library (-lnsl). */ /* #undef HAVE_LIBNSL */ /* Define to 1 if you have the `pthread' library (-lpthread). */ #define HAVE_LIBPTHREAD 1 /* Define to 1 if you have the `rt' library (-lrt). */ /* #undef HAVE_LIBRT */ /* Define to 1 if you have the `scf' library (-lscf). */ /* #undef HAVE_LIBSCF */ /* Define to use libseccomp system call filtering. */ /* #undef HAVE_LIBSECCOMP */ /* Define to 1 if you have the `socket' library (-lsocket). */ /* #undef HAVE_LIBSOCKET */ /* Define to 1 if you have the `thr' library (-lthr). */ /* #undef HAVE_LIBTHR */ /* Define if libxml2 was found */ #define HAVE_LIBXML2 1 /* Define to 1 if you have the <linux/capability.h> header file. */ #define HAVE_LINUX_CAPABILITY_H 1 /* Define to 1 if you have the <linux/netlink.h> header file. */ #define HAVE_LINUX_NETLINK_H 1 /* Define to 1 if you have the <linux/rtnetlink.h> header file. */ #define HAVE_LINUX_RTNETLINK_H 1 /* Define to 1 if you have the <linux/types.h> header file. */ #define HAVE_LINUX_TYPES_H 1 /* Define if lmdb was found */ /* #undef HAVE_LMDB */ /* Define to 1 if you have the <locale.h> header file. */ #define HAVE_LOCALE_H 1 /* Define to 1 if you have the <memory.h> header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the `mmap' function. */ #define HAVE_MMAP 1 /* Define to 1 if you have the `nanosleep' function. */ #define HAVE_NANOSLEEP 1 /* Define to 1 if you have the <net/if6.h> header file. */ /* #undef HAVE_NET_IF6_H */ /* Define to 1 if you have the <net/route.h> header file. */ #define HAVE_NET_ROUTE_H 1 /* Define if your OpenSSL version supports AES */ /* #undef HAVE_OPENSSL_AES */ /* Define if your OpenSSL version supports ECDSA. */ #define HAVE_OPENSSL_ECDSA 1 /* Define if your OpenSSL version supports Ed25519. */ /* #undef HAVE_OPENSSL_ED25519 */ /* Define if your OpenSSL version supports Ed448. */ /* #undef HAVE_OPENSSL_ED448 */ /* Define if your OpenSSL version supports EVP AES */ #define HAVE_OPENSSL_EVP_AES 1 /* Define if your OpenSSL version supports GOST. */ /* #undef HAVE_OPENSSL_GOST */ /* Define if your PKCS11 provider supports ECDSA. */ #define HAVE_PKCS11_ECDSA 1 /* Define if your PKCS11 provider supports Ed25519. */ /* #undef HAVE_PKCS11_ED25519 */ /* Define if your PKCS11 provider supports Ed448. */ /* #undef HAVE_PKCS11_ED448 */ /* Define if your PKCS11 provider supports GOST. */ /* #undef HAVE_PKCS11_GOST */ /* Support for PTHREAD_MUTEX_ADAPTIVE_NP */ #define HAVE_PTHREAD_MUTEX_ADAPTIVE_NP 1 /* Define to 1 if you have the <pthread_np.h> header file. */ /* #undef HAVE_PTHREAD_NP_H */ /* Define to 1 if you have the `pthread_setname_np' function. */ #define HAVE_PTHREAD_SETNAME_NP 1 /* Define to 1 if you have the `pthread_set_name_np' function. */ /* #undef HAVE_PTHREAD_SET_NAME_NP */ /* Define to 1 if you have the `pthread_yield' function. */ #define HAVE_PTHREAD_YIELD 1 /* Define to 1 if you have the `pthread_yield_np' function. */ /* #undef HAVE_PTHREAD_YIELD_NP */ /* Define to 1 if you have the `readline' function. */ /* #undef HAVE_READLINE */ /* Define to 1 if you have the <readline/history.h> header file. */ /* #undef HAVE_READLINE_HISTORY_H */ /* Define to 1 if you have the <readline/readline.h> header file. */ /* #undef HAVE_READLINE_READLINE_H */ /* Define to 1 if you have the <regex.h> header file. */ #define HAVE_REGEX_H 1 /* Define to 1 if you have the `RSA_set0_key' function. */ /* #undef HAVE_RSA_SET0_KEY */ /* Define to 1 if you have the <sched.h> header file. */ #define HAVE_SCHED_H 1 /* Define to 1 if you have the `sched_yield' function. */ #define HAVE_SCHED_YIELD 1 /* Define to 1 if you have the `setegid' function. */ #define HAVE_SETEGID 1 /* Define to 1 if you have the `seteuid' function. */ #define HAVE_SETEUID 1 /* Define to 1 if you have the `setlocale' function. */ #define HAVE_SETLOCALE 1 /* Define to 1 if you have the `setresgid' function. */ #define HAVE_SETRESGID 1 /* Define to 1 if you have the `setresuid' function. */ #define HAVE_SETRESUID 1 /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the <strings.h> header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the <sys/capability.h> header file. */ #define HAVE_SYS_CAPABILITY_H 1 /* Define to 1 if you have the <sys/devpoll.h> header file. */ /* #undef HAVE_SYS_DEVPOLL_H */ /* Define to 1 if you have the <sys/dyntune.h> header file. */ /* #undef HAVE_SYS_DYNTUNE_H */ /* Define to 1 if you have the <sys/mman.h> header file. */ #define HAVE_SYS_MMAN_H 1 /* Define to 1 if you have the <sys/param.h> header file. */ #define HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the <sys/prctl.h> header file. */ #define HAVE_SYS_PRCTL_H 1 /* Define to 1 if you have the <sys/select.h> header file. */ #define HAVE_SYS_SELECT_H 1 /* Define to 1 if you have the <sys/socket.h> header file. */ #define HAVE_SYS_SOCKET_H 1 /* Define to 1 if you have the <sys/sockio.h> header file. */ /* #undef HAVE_SYS_SOCKIO_H */ /* Define to 1 if you have the <sys/stat.h> header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the <sys/sysctl.h> header file. */ #define HAVE_SYS_SYSCTL_H 1 /* Define to 1 if you have the <sys/time.h> header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <sys/un.h> header file. */ #define HAVE_SYS_UN_H 1 /* Define if running under Compaq TruCluster */ /* #undef HAVE_TRUCLUSTER */ /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the `usleep' function. */ #define HAVE_USLEEP 1 /* Define if zlib was found */ #define HAVE_ZLIB 1 /* Use HMAC-SHA1 for Client Cookie generation */ /* #undef HMAC_SHA1_CC */ /* Use HMAC-SHA256 for Client Cookie generation */ /* #undef HMAC_SHA256_CC */ /* return type of gai_strerror */ #define IRS_GAISTRERROR_RETURN_T const char * /* Define to the buffer length type used by getnameinfo(3). */ #define IRS_GETNAMEINFO_BUFLEN_T socklen_t /* Define to the flags type used by getnameinfo(3). */ #define IRS_GETNAMEINFO_FLAGS_T int /* Define to the sockaddr length type used by getnameinfo(3). */ #define IRS_GETNAMEINFO_SOCKLEN_T socklen_t /* Define if you want to use inline buffers */ #define ISC_BUFFER_USEINLINE 1 /* Define to allow building of objects for dlopen(). */ #define ISC_DLZ_DLOPEN 1 /* Define to the sub-directory where libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" /* Defined if extern char *optarg is not declared. */ /* #undef NEED_OPTARG */ /* Define if connect does not honour the permission on the UNIX domain socket. */ /* #undef NEED_SECURE_DIRECTORY */ /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "info@isc.org" /* Define to the full name of this package. */ #define PACKAGE_NAME "BIND" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "BIND 9.11" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "bind" /* Define to the home page for this package. */ #define PACKAGE_URL "https://www.isc.org/downloads/BIND/" /* Define to the version of this package. */ #define PACKAGE_VERSION "9.11" /* Sets which flag to pass to open/fcntl to make non-blocking (O_NDELAY/O_NONBLOCK). */ #define PORT_NONBLOCK O_NONBLOCK /* Define if GOST private keys are encoded in ASN.1. */ /* #undef PREFER_GOSTASN1 */ /* The size of `void *', as computed by sizeof. */ /* #undef SIZEOF_VOID_P */ /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ #define TIME_WITH_SYS_TIME 1 /* Define to use large-system tuning. */ #define TUNE_LARGE 1 /* Defined if you need to use ioctl(FIONBIO) instead a fcntl call to make non-blocking. */ /* #undef USE_FIONBIO_IOCTL */ /* Define to enable very verbose query trace logging. */ /* #undef WANT_QUERYTRACE */ /* define if idnkit support is to be included. */ /* #undef WITH_IDNKIT */ /* define if IDN output support is to be included. */ #define WITH_IDN_OUT_SUPPORT 1 /* define if IDN input support is to be included. */ #define WITH_IDN_SUPPORT 1 /* define if libidn support is to be included. */ #define WITH_LIBIDN 1 /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN /* # undef WORDS_BIGENDIAN */ # endif #endif /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ /* Define to empty if your compiler does not support "static inline". */ /* #undef inline */ /* Define to `unsigned int' if <sys/types.h> does not define. */ /* #undef size_t */ /* Define to `int' if <sys/types.h> does not define. */ /* #undef ssize_t */ /* Define to `unsigned long' if <sys/types.h> does not define. */ /* #undef uintptr_t */ /* Define to empty if the keyword `volatile' does not work. Warning: valid code using `volatile' can become incorrect without. Disable with care. */ /* #undef volatile */ ��������������������������������������������������bind9/pk11/site.h�����������������������������������������������������������������������������������0000644�����������������00000005441�14763166026�0007461 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /* The documentation about this file is in README.site */ #ifndef PK11_SITE_H #define PK11_SITE_H 1 /*! \file pk11/site.h */ /*\brief Put here specific PKCS#11 tweaks * *\li PK11_<mechanism>_SKIP: * Don't consider the lack of this mechanism as a fatal error. * *\li PK11_<mechanism>_REPLACE: * Same as SKIP, and implement the mechanism using lower-level steps. * *\li PK11_<algorithm>_DISABLE: * Same as SKIP, and disable support for the algorithm. * *\li PK11_PAD_HMAC_KEYS: * Extend HMAC keys shorter than digest length. */ /* current implemented flags are: PK11_DH_PKCS_PARAMETER_GEN_SKIP PK11_DSA_PARAMETER_GEN_SKIP PK11_RSA_PKCS_REPLACE PK11_MD5_HMAC_REPLACE PK11_SHA_1_HMAC_REPLACE PK11_SHA224_HMAC_REPLACE PK11_SHA256_HMAC_REPLACE PK11_SHA384_HMAC_REPLACE PK11_SHA512_HMAC_REPLACE PK11_MD5_DISABLE PK11_DSA_DISABLE PK11_DH_DISABLE PK11_PAD_HMAC_KEYS */ /* * Predefined flavors */ /* Thales nCipher */ #define PK11_THALES_FLAVOR 0 /* SoftHSMv1 with SHA224 */ #define PK11_SOFTHSMV1_FLAVOR 1 /* SoftHSMv2 */ #define PK11_SOFTHSMV2_FLAVOR 2 /* Cryptech */ #define PK11_CRYPTECH_FLAVOR 3 /* AEP Keyper */ #define PK11_AEP_FLAVOR 4 /* Default is for Thales nCipher */ #ifndef PK11_FLAVOR #define PK11_FLAVOR PK11_THALES_FLAVOR #endif #if PK11_FLAVOR == PK11_THALES_FLAVOR #define PK11_DH_PKCS_PARAMETER_GEN_SKIP /* doesn't work but supported #define PK11_DSA_PARAMETER_GEN_SKIP */ #define PK11_MD5_HMAC_REPLACE #endif #if PK11_FLAVOR == PK11_SOFTHSMV1_FLAVOR #define PK11_PAD_HMAC_KEYS #endif #if PK11_FLAVOR == PK11_SOFTHSMV2_FLAVOR /* SoftHSMv2 was updated to enforce minimal key sizes... argh! */ #define PK11_MD5_HMAC_REPLACE #define PK11_SHA_1_HMAC_REPLACE #define PK11_SHA224_HMAC_REPLACE #define PK11_SHA256_HMAC_REPLACE #define PK11_SHA384_HMAC_REPLACE #define PK11_SHA512_HMAC_REPLACE #endif #if PK11_FLAVOR == PK11_CRYPTECH_FLAVOR #define PK11_DH_DISABLE #define PK11_DSA_DISABLE #define PK11_MD5_DISABLE #define PK11_SHA_1_HMAC_REPLACE #define PK11_SHA224_HMAC_REPLACE #define PK11_SHA256_HMAC_REPLACE #define PK11_SHA384_HMAC_REPLACE #define PK11_SHA512_HMAC_REPLACE #endif #if PK11_FLAVOR == PK11_AEP_FLAVOR #define PK11_DH_DISABLE #define PK11_DSA_DISABLE #define PK11_RSA_PKCS_REPLACE #define PK11_MD5_HMAC_REPLACE #define PK11_SHA_1_HMAC_REPLACE #define PK11_SHA224_HMAC_REPLACE #define PK11_SHA256_HMAC_REPLACE #define PK11_SHA384_HMAC_REPLACE #define PK11_SHA512_HMAC_REPLACE #endif #endif /* PK11_SITE_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isccfg/dnsconf.h������������������������������������������������������������������������������0000644�����������������00000001331�14763166026�0010623 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISCCFG_DNSCONF_H #define ISCCFG_DNSCONF_H 1 /*! \file * \brief * This module defines the named.conf, rndc.conf, and rndc.key grammars. */ #include <isccfg/cfg.h> /* * Configuration object types. */ LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_dnsconf; /*%< A complete dns.conf file. */ #endif /* ISCCFG_DNSCONF_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isccfg/version.h������������������������������������������������������������������������������0000644�����������������00000001277�14763166026�0010667 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ /*! \file isccfg/version.h */ #include <isc/platform.h> LIBISCCFG_EXTERNAL_DATA extern const char cfg_version[]; LIBISCCFG_EXTERNAL_DATA extern const unsigned int cfg_libinterface; LIBISCCFG_EXTERNAL_DATA extern const unsigned int cfg_librevision; LIBISCCFG_EXTERNAL_DATA extern const unsigned int cfg_libage; ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isccfg/aclconf.h������������������������������������������������������������������������������0000644�����������������00000004740�14763166026�0010605 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISCCFG_ACLCONF_H #define ISCCFG_ACLCONF_H 1 #include <isc/lang.h> #include <isccfg/cfg.h> #ifdef HAVE_GEOIP #include <dns/geoip.h> #endif #include <dns/types.h> typedef struct cfg_aclconfctx { ISC_LIST(dns_acl_t) named_acl_cache; isc_mem_t *mctx; #ifdef HAVE_GEOIP dns_geoip_databases_t *geoip; #endif isc_refcount_t references; } cfg_aclconfctx_t; /*** *** Functions ***/ ISC_LANG_BEGINDECLS isc_result_t cfg_aclconfctx_create(isc_mem_t *mctx, cfg_aclconfctx_t **ret); /* * Creates and initializes an ACL configuration context. */ void cfg_aclconfctx_detach(cfg_aclconfctx_t **actxp); /* * Removes a reference to an ACL configuration context; when references * reaches zero, clears the contents and deallocate the structure. */ void cfg_aclconfctx_attach(cfg_aclconfctx_t *src, cfg_aclconfctx_t **dest); /* * Attaches a pointer to an existing ACL configuration context. */ isc_result_t cfg_acl_fromconfig(const cfg_obj_t *caml, const cfg_obj_t *cctx, isc_log_t *lctx, cfg_aclconfctx_t *ctx, isc_mem_t *mctx, unsigned int nest_level, dns_acl_t **target); isc_result_t cfg_acl_fromconfig2(const cfg_obj_t *caml, const cfg_obj_t *cctx, isc_log_t *lctx, cfg_aclconfctx_t *ctx, isc_mem_t *mctx, unsigned int nest_level, isc_uint16_t family, dns_acl_t **target); /* * Construct a new dns_acl_t from configuration data in 'caml' and * 'cctx'. Memory is allocated through 'mctx'. * * Any named ACLs referred to within 'caml' will be be converted * into nested dns_acl_t objects. Multiple references to the same * named ACLs will be converted into shared references to a single * nested dns_acl_t object when the referring objects were created * passing the same ACL configuration context 'ctx'. * * cfg_acl_fromconfig() is a backward-compatible version of * cfg_acl_fromconfig2(), which allows an address family to be * specified. If 'family' is not zero, then only addresses/prefixes * of a matching family (AF_INET or AF_INET6) may be configured. * * On success, attach '*target' to the new dns_acl_t object. */ ISC_LANG_ENDDECLS #endif /* ISCCFG_ACLCONF_H */ ��������������������������������bind9/isccfg/cfg.h����������������������������������������������������������������������������������0000644�����������������00000034027�14763166026�0007740 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISCCFG_CFG_H #define ISCCFG_CFG_H 1 /***** ***** Module Info *****/ /*! \file isccfg/cfg.h * \brief * This is the new, table-driven, YACC-free configuration file parser. */ /*** *** Imports ***/ #include <isc/formatcheck.h> #include <isc/lang.h> #include <isc/refcount.h> #include <isc/types.h> #include <isc/list.h> /*** *** Types ***/ /*% * A configuration parser. */ typedef struct cfg_parser cfg_parser_t; /*% * A configuration type definition object. There is a single * static cfg_type_t object for each data type supported by * the configuration parser. */ typedef struct cfg_type cfg_type_t; /*% * A configuration object. This is the basic building block of the * configuration parse tree. It contains a value (which may be * of one of several types) and information identifying the file * and line number the value came from, for printing error * messages. */ typedef struct cfg_obj cfg_obj_t; /*% * A configuration object list element. */ typedef struct cfg_listelt cfg_listelt_t; /*% * A callback function to be called when parsing an option * that needs to be interpreted at parsing time, like * "directory". */ typedef isc_result_t (*cfg_parsecallback_t)(const char *clausename, const cfg_obj_t *obj, void *arg); /*** *** Functions ***/ ISC_LANG_BEGINDECLS void cfg_parser_attach(cfg_parser_t *src, cfg_parser_t **dest); /*%< * Reference a parser object. */ isc_result_t cfg_parser_create(isc_mem_t *mctx, isc_log_t *lctx, cfg_parser_t **ret); /*%< * Create a configuration file parser. Any warning and error * messages will be logged to 'lctx'. * * The parser object returned can be used for a single call * to cfg_parse_file() or cfg_parse_buffer(). It must not * be reused for parsing multiple files or buffers. */ void cfg_parser_setcallback(cfg_parser_t *pctx, cfg_parsecallback_t callback, void *arg); /*%< * Make the parser call 'callback' whenever it encounters * a configuration clause with the callback attribute, * passing it the clause name, the clause value, * and 'arg' as arguments. * * To restore the default of not invoking callbacks, pass * callback==NULL and arg==NULL. */ isc_result_t cfg_parse_file(cfg_parser_t *pctx, const char *file, const cfg_type_t *type, cfg_obj_t **ret); isc_result_t cfg_parse_buffer(cfg_parser_t *pctx, isc_buffer_t *buffer, const cfg_type_t *type, cfg_obj_t **ret); isc_result_t cfg_parse_buffer2(cfg_parser_t *pctx, isc_buffer_t *buffer, const char *file, const cfg_type_t *type, cfg_obj_t **ret); isc_result_t cfg_parse_buffer3(cfg_parser_t *pctx, isc_buffer_t *buffer, const char *file, unsigned int line, const cfg_type_t *type, cfg_obj_t **ret); isc_result_t cfg_parse_buffer4(cfg_parser_t *pctx, isc_buffer_t *buffer, const char *file, unsigned int line, const cfg_type_t *type, unsigned int flags, cfg_obj_t **ret); /*%< * Read a configuration containing data of type 'type' * and make '*ret' point to its parse tree. * * The configuration is read from the file 'filename' * (isc_parse_file()) or the buffer 'buffer' * (isc_parse_buffer()). * * If 'file' is not NULL, it is the name of the file, or a name to use * for the buffer in place of the filename, when logging errors. * * If 'line' is not 0, then it is the beginning line number to report * when logging errors. This is useful when passing text that has been * read from the middle of a file. * * Returns an error if the file or buffer does not parse correctly. * * Requires: *\li "filename" is valid. *\li "mem" is valid. *\li "type" is valid. *\li "cfg" is non-NULL and "*cfg" is NULL. *\li "flags" be one or more of CFG_PCTX_NODEPRECATED or zero. * * Returns: * \li #ISC_R_SUCCESS - success *\li #ISC_R_NOMEMORY - no memory available *\li #ISC_R_INVALIDFILE - file doesn't exist or is unreadable *\li others - file contains errors */ isc_result_t cfg_parser_mapadd(cfg_parser_t *pctx, cfg_obj_t *mapobj, cfg_obj_t *obj, const char *clause); /*%< * Add the object 'obj' to the specified clause in mapbody 'mapobj'. * Used for adding new zones. * * Require: * \li 'obj' is a valid cfg_obj_t. * \li 'mapobj' is a valid cfg_obj_t of type map. * \li 'pctx' is a valid cfg_parser_t. */ void cfg_parser_reset(cfg_parser_t *pctx); /*%< * Reset an existing parser so it can be re-used for a new file or * buffer. */ void cfg_parser_destroy(cfg_parser_t **pctxp); /*%< * Remove a reference to a configuration parser; destroy it if there are no * more references. */ isc_boolean_t cfg_obj_isvoid(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of void type (e.g., an optional * value not specified). */ isc_boolean_t cfg_obj_ismap(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of a map type. */ isc_boolean_t cfg_obj_isfixedpoint(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of a fixedpoint type. */ isc_boolean_t cfg_obj_ispercentage(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of a percentage type. */ isc_result_t cfg_map_get(const cfg_obj_t *mapobj, const char* name, const cfg_obj_t **obj); /*%< * Extract an element from a configuration object, which * must be of a map type. * * Requires: * \li 'mapobj' points to a valid configuration object of a map type. * \li 'name' points to a null-terminated string. * \li 'obj' is non-NULL and '*obj' is NULL. * * Returns: * \li #ISC_R_SUCCESS - success * \li #ISC_R_NOTFOUND - name not found in map */ const cfg_obj_t * cfg_map_getname(const cfg_obj_t *mapobj); /*%< * Get the name of a named map object, like a server "key" clause. * * Requires: * \li 'mapobj' points to a valid configuration object of a map type. * * Returns: * \li A pointer to a configuration object naming the map object, * or NULL if the map object does not have a name. */ unsigned int cfg_map_count(const cfg_obj_t *mapobj); /*%< * Get the number of elements defined in the symbol table of a map object. * * Requires: * \li 'mapobj' points to a valid configuration object of a map type. * * Returns: * \li The number of elements in the map object. */ isc_boolean_t cfg_obj_istuple(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of a map type. */ const cfg_obj_t * cfg_tuple_get(const cfg_obj_t *tupleobj, const char *name); /*%< * Extract an element from a configuration object, which * must be of a tuple type. * * Requires: * \li 'tupleobj' points to a valid configuration object of a tuple type. * \li 'name' points to a null-terminated string naming one of the *\li fields of said tuple type. */ isc_boolean_t cfg_obj_isuint32(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of integer type. */ isc_uint32_t cfg_obj_asuint32(const cfg_obj_t *obj); /*%< * Returns the value of a configuration object of 32-bit integer type. * * Requires: * \li 'obj' points to a valid configuration object of 32-bit integer type. * * Returns: * \li A 32-bit unsigned integer. */ isc_boolean_t cfg_obj_isuint64(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of integer type. */ isc_uint64_t cfg_obj_asuint64(const cfg_obj_t *obj); /*%< * Returns the value of a configuration object of 64-bit integer type. * * Requires: * \li 'obj' points to a valid configuration object of 64-bit integer type. * * Returns: * \li A 64-bit unsigned integer. */ isc_uint32_t cfg_obj_asfixedpoint(const cfg_obj_t *obj); /*%< * Returns the value of a configuration object of fixed point number. * * Requires: * \li 'obj' points to a valid configuration object of fixed point type. * * Returns: * \li A 32-bit unsigned integer. */ isc_uint32_t cfg_obj_aspercentage(const cfg_obj_t *obj); /*%< * Returns the value of a configuration object of percentage * * Requires: * \li 'obj' points to a valid configuration object of percentage type. * * Returns: * \li A 32-bit unsigned integer. */ isc_boolean_t cfg_obj_isstring(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of string type. */ const char * cfg_obj_asstring(const cfg_obj_t *obj); /*%< * Returns the value of a configuration object of a string type * as a null-terminated string. * * Requires: * \li 'obj' points to a valid configuration object of a string type. * * Returns: * \li A pointer to a null terminated string. */ isc_boolean_t cfg_obj_isboolean(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of a boolean type. */ isc_boolean_t cfg_obj_asboolean(const cfg_obj_t *obj); /*%< * Returns the value of a configuration object of a boolean type. * * Requires: * \li 'obj' points to a valid configuration object of a boolean type. * * Returns: * \li A boolean value. */ isc_boolean_t cfg_obj_issockaddr(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is a socket address. */ const isc_sockaddr_t * cfg_obj_assockaddr(const cfg_obj_t *obj); /*%< * Returns the value of a configuration object representing a socket address. * * Requires: * \li 'obj' points to a valid configuration object of a socket address type. * * Returns: * \li A pointer to a sockaddr. The sockaddr must be copied by the caller * if necessary. */ isc_dscp_t cfg_obj_getdscp(const cfg_obj_t *obj); /*%< * Returns the DSCP value of a configuration object representing a * socket address. * * Requires: * \li 'obj' points to a valid configuration object of a * socket address type. * * Returns: * \li DSCP value associated with a sockaddr, or -1. */ isc_boolean_t cfg_obj_isnetprefix(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is a network prefix. */ void cfg_obj_asnetprefix(const cfg_obj_t *obj, isc_netaddr_t *netaddr, unsigned int *prefixlen); /*%< * Gets the value of a configuration object representing a network * prefix. The network address is returned through 'netaddr' and the * prefix length in bits through 'prefixlen'. * * Requires: * \li 'obj' points to a valid configuration object of network prefix type. *\li 'netaddr' and 'prefixlen' are non-NULL. */ isc_boolean_t cfg_obj_islist(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of list type. */ const cfg_listelt_t * cfg_list_first(const cfg_obj_t *obj); /*%< * Returns the first list element in a configuration object of a list type. * * Requires: * \li 'obj' points to a valid configuration object of a list type or NULL. * * Returns: * \li A pointer to a cfg_listelt_t representing the first list element, * or NULL if the list is empty or nonexistent. */ const cfg_listelt_t * cfg_list_next(const cfg_listelt_t *elt); /*%< * Returns the next element of a list of configuration objects. * * Requires: * \li 'elt' points to cfg_listelt_t obtained from cfg_list_first() or * a previous call to cfg_list_next(). * * Returns: * \li A pointer to a cfg_listelt_t representing the next element, * or NULL if there are no more elements. */ unsigned int cfg_list_length(const cfg_obj_t *obj, isc_boolean_t recurse); /*%< * Returns the length of a list of configure objects. If obj is * not a list, returns 0. If recurse is true, add in the length of * all contained lists. */ cfg_obj_t * cfg_listelt_value(const cfg_listelt_t *elt); /*%< * Returns the configuration object associated with cfg_listelt_t. * * Requires: * \li 'elt' points to cfg_listelt_t obtained from cfg_list_first() or * cfg_list_next(). * * Returns: * \li A non-NULL pointer to a configuration object. */ void cfg_print(const cfg_obj_t *obj, void (*f)(void *closure, const char *text, int textlen), void *closure); void cfg_printx(const cfg_obj_t *obj, unsigned int flags, void (*f)(void *closure, const char *text, int textlen), void *closure); #define CFG_PRINTER_XKEY 0x1 /* '?' out shared keys. */ #define CFG_PRINTER_ONELINE 0x2 /* print config as a single line */ /*%< * Print the configuration object 'obj' by repeatedly calling the * function 'f', passing 'closure' and a region of text starting * at 'text' and comprising 'textlen' characters. * * If CFG_PRINTER_XKEY the contents of shared keys will be obscured * by replacing them with question marks ('?') */ void cfg_print_grammar(const cfg_type_t *type, void (*f)(void *closure, const char *text, int textlen), void *closure); /*%< * Print a summary of the grammar of the configuration type 'type'. */ isc_boolean_t cfg_obj_istype(const cfg_obj_t *obj, const cfg_type_t *type); /*%< * Return true iff 'obj' is of type 'type'. */ void cfg_obj_attach(cfg_obj_t *src, cfg_obj_t **dest); /*%< * Reference a configuration object. */ void cfg_obj_destroy(cfg_parser_t *pctx, cfg_obj_t **obj); /*%< * Delete a reference to a configuration object; destroy the object if * there are no more references. * * Require: * \li '*obj' is a valid cfg_obj_t. * \li 'pctx' is a valid cfg_parser_t. */ void cfg_obj_log(const cfg_obj_t *obj, isc_log_t *lctx, int level, const char *fmt, ...) ISC_FORMAT_PRINTF(4, 5); /*%< * Log a message concerning configuration object 'obj' to the logging * channel of 'pctx', at log level 'level'. The message will be prefixed * with the file name(s) and line number where 'obj' was defined. */ const char * cfg_obj_file(const cfg_obj_t *obj); /*%< * Return the file that defined this object. */ unsigned int cfg_obj_line(const cfg_obj_t *obj); /*%< * Return the line in file where this object was defined. */ const char * cfg_map_firstclause(const cfg_type_t *map, const void **clauses, unsigned int *idx); const char * cfg_map_nextclause(const cfg_type_t *map, const void **clauses, unsigned int *idx); ISC_LANG_ENDDECLS #endif /* ISCCFG_CFG_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isccfg/log.h����������������������������������������������������������������������������������0000644�����������������00000002234�14763166026�0007755 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISCCFG_LOG_H #define ISCCFG_LOG_H 1 /*! \file isccfg/log.h */ #include <isc/lang.h> #include <isc/log.h> LIBISCCFG_EXTERNAL_DATA extern isc_logcategory_t cfg_categories[]; LIBISCCFG_EXTERNAL_DATA extern isc_logmodule_t cfg_modules[]; #define CFG_LOGCATEGORY_CONFIG (&cfg_categories[0]) #define CFG_LOGMODULE_PARSER (&cfg_modules[0]) ISC_LANG_BEGINDECLS void cfg_log_init(isc_log_t *lctx); /*%< * Make the libisccfg categories and modules available for use with the * ISC logging library. * * Requires: *\li lctx is a valid logging context. * *\li cfg_log_init() is called only once. * * Ensures: * \li The categories and modules defined above are available for * use by isc_log_usechannnel() and isc_log_write(). */ ISC_LANG_ENDDECLS #endif /* ISCCFG_LOG_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isccfg/namedconf.h����������������������������������������������������������������������������0000644�����������������00000003247�14763166026�0011133 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISCCFG_NAMEDCONF_H #define ISCCFG_NAMEDCONF_H 1 /*! \file isccfg/namedconf.h * \brief * This module defines the named.conf, rndc.conf, and rndc.key grammars. */ #include <isccfg/cfg.h> /* * Configuration object types. */ LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_namedconf; /*%< A complete named.conf file. */ LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_bindkeys; /*%< A bind.keys file. */ LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_newzones; /*%< A new-zones file (for zones added by 'rndc addzone'). */ LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_addzoneconf; /*%< A single zone passed via the addzone rndc command. */ LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_rndcconf; /*%< A complete rndc.conf file. */ LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_rndckey; /*%< A complete rndc.key file. */ LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_sessionkey; /*%< A complete session.key file. */ LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_keyref; /*%< A key reference, used as an ACL element */ /*%< An EDNS client subnet address, used as an ACL element */ LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_ecsprefix; /*%< Zone options */ LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_zoneopts; #endif /* ISCCFG_NAMEDCONF_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bind9/isccfg/grammar.h������������������������������������������������������������������������������0000644�����������������00000036654�14763166026�0010637 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) Internet Systems Consortium, Inc. ("ISC") * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * See the COPYRIGHT file distributed with this work for additional * information regarding copyright ownership. */ #ifndef ISCCFG_GRAMMAR_H #define ISCCFG_GRAMMAR_H 1 /*! \file isccfg/grammar.h */ #include <isc/lex.h> #include <isc/netaddr.h> #include <isc/sockaddr.h> #include <isc/region.h> #include <isc/types.h> #include <isccfg/cfg.h> /* * Definitions shared between the configuration parser * and the grammars; not visible to users of the parser. */ /*% Clause may occur multiple times (e.g., "zone") */ #define CFG_CLAUSEFLAG_MULTI 0x00000001 /*% Clause is obsolete */ #define CFG_CLAUSEFLAG_OBSOLETE 0x00000002 /*% Clause is not implemented, and may never be */ #define CFG_CLAUSEFLAG_NOTIMP 0x00000004 /*% Clause is not implemented yet */ #define CFG_CLAUSEFLAG_NYI 0x00000008 /*% Default value has changed since earlier release */ #define CFG_CLAUSEFLAG_NEWDEFAULT 0x00000010 /*% * Clause needs to be interpreted during parsing * by calling a callback function, like the * "directory" option. */ #define CFG_CLAUSEFLAG_CALLBACK 0x00000020 /*% A option that is only used in testing. */ #define CFG_CLAUSEFLAG_TESTONLY 0x00000040 /*% A configuration option that was not configured at compile time. */ #define CFG_CLAUSEFLAG_NOTCONFIGURED 0x00000080 /*% A option for a experimental feature. */ #define CFG_CLAUSEFLAG_EXPERIMENTAL 0x00000100 /*% A configuration option that is ineffective due to * compile time options, but is harmless. */ #define CFG_CLAUSEFLAG_NOOP 0x00000200 /*% Clause is obsolete in a future release */ #define CFG_CLAUSEFLAG_DEPRECATED 0x00000400 /*% * Zone types for which a clause is valid: * These share space with CFG_CLAUSEFLAG values, but count * down from the top. */ #define CFG_ZONE_MASTER 0x80000000 #define CFG_ZONE_SLAVE 0x40000000 #define CFG_ZONE_STUB 0x20000000 #define CFG_ZONE_HINT 0x10000000 #define CFG_ZONE_FORWARD 0x08000000 #define CFG_ZONE_STATICSTUB 0x04000000 #define CFG_ZONE_REDIRECT 0x02000000 #define CFG_ZONE_DELEGATION 0x01000000 #define CFG_ZONE_INVIEW 0x00800000 typedef struct cfg_clausedef cfg_clausedef_t; typedef struct cfg_tuplefielddef cfg_tuplefielddef_t; typedef struct cfg_printer cfg_printer_t; typedef ISC_LIST(cfg_listelt_t) cfg_list_t; typedef struct cfg_map cfg_map_t; typedef struct cfg_rep cfg_rep_t; /* * Function types for configuration object methods */ typedef isc_result_t (*cfg_parsefunc_t)(cfg_parser_t *, const cfg_type_t *type, cfg_obj_t **); typedef void (*cfg_printfunc_t)(cfg_printer_t *, const cfg_obj_t *); typedef void (*cfg_docfunc_t)(cfg_printer_t *, const cfg_type_t *); typedef void (*cfg_freefunc_t)(cfg_parser_t *, cfg_obj_t *); /* * Structure definitions */ /*% * A configuration printer object. This is an abstract * interface to a destination to which text can be printed * by calling the function 'f'. */ struct cfg_printer { void (*f)(void *closure, const char *text, int textlen); void *closure; int indent; int flags; }; /*% A clause definition. */ struct cfg_clausedef { const char *name; cfg_type_t *type; unsigned int flags; }; /*% A tuple field definition. */ struct cfg_tuplefielddef { const char *name; cfg_type_t *type; unsigned int flags; }; /*% A configuration object type definition. */ struct cfg_type { const char *name; /*%< For debugging purposes only */ cfg_parsefunc_t parse; cfg_printfunc_t print; cfg_docfunc_t doc; /*%< Print grammar description */ cfg_rep_t * rep; /*%< Data representation */ const void * of; /*%< Additional data for meta-types */ }; /*% A keyword-type definition, for things like "port <integer>". */ typedef struct { const char *name; const cfg_type_t *type; } keyword_type_t; struct cfg_map { cfg_obj_t *id; /*%< Used for 'named maps' like keys, zones, &c */ const cfg_clausedef_t * const *clausesets; /*%< The clauses that can occur in this map; used for printing */ isc_symtab_t *symtab; }; typedef struct cfg_netprefix cfg_netprefix_t; struct cfg_netprefix { isc_netaddr_t address; /* IP4/IP6 */ unsigned int prefixlen; }; /*% * A configuration data representation. */ struct cfg_rep { const char * name; /*%< For debugging only */ cfg_freefunc_t free; /*%< How to free this kind of data. */ }; /*% * A configuration object. This is the main building block * of the configuration parse tree. */ struct cfg_obj { const cfg_type_t *type; union { isc_uint32_t uint32; isc_uint64_t uint64; isc_textregion_t string; /*%< null terminated, too */ isc_boolean_t boolean; cfg_map_t map; cfg_list_t list; cfg_obj_t ** tuple; isc_sockaddr_t sockaddr; struct { isc_sockaddr_t sockaddr; isc_dscp_t dscp; } sockaddrdscp; cfg_netprefix_t netprefix; } value; isc_refcount_t references; /*%< reference counter */ const char * file; unsigned int line; cfg_parser_t * pctx; }; /*% A list element. */ struct cfg_listelt { cfg_obj_t *obj; ISC_LINK(cfg_listelt_t) link; }; /*% The parser object. */ struct cfg_parser { isc_mem_t * mctx; isc_log_t * lctx; isc_lex_t * lexer; unsigned int errors; unsigned int warnings; isc_token_t token; /*% We are at the end of all input. */ isc_boolean_t seen_eof; /*% The current token has been pushed back. */ isc_boolean_t ungotten; /*% * The stack of currently active files, represented * as a configuration list of configuration strings. * The head is the top-level file, subsequent elements * (if any) are the nested include files, and the * last element is the file currently being parsed. */ cfg_obj_t * open_files; /*% * Names of files that we have parsed and closed * and were previously on the open_file list. * We keep these objects around after closing * the files because the file names may still be * referenced from other configuration objects * for use in reporting semantic errors after * parsing is complete. */ cfg_obj_t * closed_files; /*% * Name of a buffer being parsed; used only for * logging. */ char const * buf_name; /*% * Current line number. We maintain our own * copy of this so that it is available even * when a file has just been closed. */ unsigned int line; /*% * Parser context flags, used for maintaining state * from one token to the next. */ unsigned int flags; /*%< Reference counter */ isc_refcount_t references; cfg_parsecallback_t callback; void *callbackarg; }; /* Parser context flags */ #define CFG_PCTX_SKIP 0x1 #define CFG_PCTX_NODEPRECATED 0x2 /*@{*/ /*% * Flags defining whether to accept certain types of network addresses. */ #define CFG_ADDR_V4OK 0x00000001 #define CFG_ADDR_V4PREFIXOK 0x00000002 #define CFG_ADDR_V6OK 0x00000004 #define CFG_ADDR_WILDOK 0x00000008 #define CFG_ADDR_DSCPOK 0x00000010 #define CFG_ADDR_MASK (CFG_ADDR_V6OK|CFG_ADDR_V4OK) /*@}*/ /*@{*/ /*% * Predefined data representation types. */ LIBISCCFG_EXTERNAL_DATA extern cfg_rep_t cfg_rep_uint32; LIBISCCFG_EXTERNAL_DATA extern cfg_rep_t cfg_rep_uint64; LIBISCCFG_EXTERNAL_DATA extern cfg_rep_t cfg_rep_string; LIBISCCFG_EXTERNAL_DATA extern cfg_rep_t cfg_rep_boolean; LIBISCCFG_EXTERNAL_DATA extern cfg_rep_t cfg_rep_map; LIBISCCFG_EXTERNAL_DATA extern cfg_rep_t cfg_rep_list; LIBISCCFG_EXTERNAL_DATA extern cfg_rep_t cfg_rep_tuple; LIBISCCFG_EXTERNAL_DATA extern cfg_rep_t cfg_rep_sockaddr; LIBISCCFG_EXTERNAL_DATA extern cfg_rep_t cfg_rep_netprefix; LIBISCCFG_EXTERNAL_DATA extern cfg_rep_t cfg_rep_void; LIBISCCFG_EXTERNAL_DATA extern cfg_rep_t cfg_rep_fixedpoint; LIBISCCFG_EXTERNAL_DATA extern cfg_rep_t cfg_rep_percentage; /*@}*/ /*@{*/ /*% * Predefined configuration object types. */ LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_boolean; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_uint32; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_uint64; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_qstring; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_astring; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_ustring; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_sstring; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_bracketed_text; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_sockaddr; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_sockaddrdscp; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_netaddr; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_netaddr4; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_netaddr4wild; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_netaddr6; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_netaddr6wild; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_netprefix; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_void; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_token; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_unsupported; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_fixedpoint; LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_percentage; /*@}*/ isc_result_t cfg_gettoken(cfg_parser_t *pctx, int options); isc_result_t cfg_peektoken(cfg_parser_t *pctx, int options); void cfg_ungettoken(cfg_parser_t *pctx); #define CFG_LEXOPT_QSTRING (ISC_LEXOPT_QSTRING | ISC_LEXOPT_QSTRINGMULTILINE) isc_result_t cfg_create_obj(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **objp); void cfg_print_rawuint(cfg_printer_t *pctx, unsigned int u); isc_result_t cfg_parse_uint32(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); void cfg_print_uint32(cfg_printer_t *pctx, const cfg_obj_t *obj); void cfg_print_uint64(cfg_printer_t *pctx, const cfg_obj_t *obj); isc_result_t cfg_parse_qstring(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); void cfg_print_ustring(cfg_printer_t *pctx, const cfg_obj_t *obj); isc_result_t cfg_parse_astring(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); isc_result_t cfg_parse_sstring(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); isc_result_t cfg_parse_rawaddr(cfg_parser_t *pctx, unsigned int flags, isc_netaddr_t *na); void cfg_print_rawaddr(cfg_printer_t *pctx, const isc_netaddr_t *na); isc_boolean_t cfg_lookingat_netaddr(cfg_parser_t *pctx, unsigned int flags); isc_result_t cfg_parse_rawport(cfg_parser_t *pctx, unsigned int flags, in_port_t *port); isc_result_t cfg_parse_dscp(cfg_parser_t *pctx, isc_dscp_t *dscp); isc_result_t cfg_parse_sockaddr(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); isc_result_t cfg_parse_boolean(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); void cfg_print_sockaddr(cfg_printer_t *pctx, const cfg_obj_t *obj); void cfg_print_boolean(cfg_printer_t *pctx, const cfg_obj_t *obj); void cfg_doc_sockaddr(cfg_printer_t *pctx, const cfg_type_t *type); isc_result_t cfg_parse_netprefix(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); isc_result_t cfg_parse_special(cfg_parser_t *pctx, int special); /*%< Parse a required special character 'special'. */ isc_result_t cfg_create_tuple(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **objp); isc_result_t cfg_parse_tuple(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); void cfg_print_tuple(cfg_printer_t *pctx, const cfg_obj_t *obj); void cfg_doc_tuple(cfg_printer_t *pctx, const cfg_type_t *type); isc_result_t cfg_create_list(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **objp); isc_result_t cfg_parse_listelt(cfg_parser_t *pctx, const cfg_type_t *elttype, cfg_listelt_t **ret); isc_result_t cfg_parse_bracketed_list(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); void cfg_print_bracketed_list(cfg_printer_t *pctx, const cfg_obj_t *obj); void cfg_doc_bracketed_list(cfg_printer_t *pctx, const cfg_type_t *type); isc_result_t cfg_parse_spacelist(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); void cfg_print_spacelist(cfg_printer_t *pctx, const cfg_obj_t *obj); isc_result_t cfg_parse_enum(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); void cfg_doc_enum(cfg_printer_t *pctx, const cfg_type_t *type); void cfg_print_chars(cfg_printer_t *pctx, const char *text, int len); /*%< Print 'len' characters at 'text' */ void cfg_print_cstr(cfg_printer_t *pctx, const char *s); /*%< Print the null-terminated string 's' */ isc_result_t cfg_parse_map(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); isc_result_t cfg_parse_named_map(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); isc_result_t cfg_parse_addressed_map(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); isc_result_t cfg_parse_netprefix_map(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t ** ret); void cfg_print_map(cfg_printer_t *pctx, const cfg_obj_t *obj); void cfg_doc_map(cfg_printer_t *pctx, const cfg_type_t *type); isc_result_t cfg_parse_mapbody(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); void cfg_print_mapbody(cfg_printer_t *pctx, const cfg_obj_t *obj); void cfg_doc_mapbody(cfg_printer_t *pctx, const cfg_type_t *type); isc_result_t cfg_parse_void(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); void cfg_print_void(cfg_printer_t *pctx, const cfg_obj_t *obj); void cfg_doc_void(cfg_printer_t *pctx, const cfg_type_t *type); isc_result_t cfg_parse_fixedpoint(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); void cfg_print_fixedpoint(cfg_printer_t *pctx, const cfg_obj_t *obj); isc_result_t cfg_parse_percentage(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); void cfg_print_percentage(cfg_printer_t *pctx, const cfg_obj_t *obj); isc_result_t cfg_parse_obj(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); void cfg_print_obj(cfg_printer_t *pctx, const cfg_obj_t *obj); void cfg_doc_obj(cfg_printer_t *pctx, const cfg_type_t *type); /*%< * Print a description of the grammar of an arbitrary configuration * type 'type' */ void cfg_doc_terminal(cfg_printer_t *pctx, const cfg_type_t *type); /*%< * Document the type 'type' as a terminal by printing its * name in angle brackets, e.g., <uint32>. */ void cfg_parser_error(cfg_parser_t *pctx, unsigned int flags, const char *fmt, ...) ISC_FORMAT_PRINTF(3, 4); /*! * Pass one of these flags to cfg_parser_error() to include the * token text in log message. */ #define CFG_LOG_NEAR 0x00000001 /*%< Say "near <token>" */ #define CFG_LOG_BEFORE 0x00000002 /*%< Say "before <token>" */ #define CFG_LOG_NOPREP 0x00000004 /*%< Say just "<token>" */ void cfg_parser_warning(cfg_parser_t *pctx, unsigned int flags, const char *fmt, ...) ISC_FORMAT_PRINTF(3, 4); isc_boolean_t cfg_is_enum(const char *s, const char *const *enums); /*%< Return true iff the string 's' is one of the strings in 'enums' */ isc_boolean_t cfg_clause_validforzone(const char *name, unsigned int ztype); /*%< * Check whether an option is legal for the specified zone type. */ void cfg_print_zonegrammar(const unsigned int zonetype, void (*f)(void *closure, const char *text, int textlen), void *closure); /*%< * Print a summary of the grammar of the zone type represented by * 'zonetype'. */ void cfg_print_clauseflags(cfg_printer_t *pctx, unsigned int flags); /*%< * Print clause flags (e.g. "obsolete", "not implemented", etc) in * human readable form */ void cfg_print_indent(cfg_printer_t *pctx); /*%< * Print the necessary indent required by the current settings of 'pctx'. */ #endif /* ISCCFG_GRAMMAR_H */ ������������������������������������������������������������������������������������envz.h����������������������������������������������������������������������������������������������0000644�����������������00000005507�14763166026�0005721 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Routines for dealing with '\0' separated environment vectors Copyright (C) 1995,1996,1998, 1999,2000,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ENVZ_H #define _ENVZ_H 1 #include <features.h> #include <errno.h> /* Envz's are argz's too, and should be created etc., using the same routines. */ #include <argz.h> __BEGIN_DECLS /* Returns a pointer to the entry in ENVZ for NAME, or 0 if there is none. */ extern char *envz_entry (const char *__restrict __envz, size_t __envz_len, const char *__restrict __name) __THROW __attribute_pure__; /* Returns a pointer to the value portion of the entry in ENVZ for NAME, or 0 if there is none. */ extern char *envz_get (const char *__restrict __envz, size_t __envz_len, const char *__restrict __name) __THROW __attribute_pure__; /* Adds an entry for NAME with value VALUE to ENVZ & ENVZ_LEN. If an entry with the same name already exists in ENVZ, it is removed. If VALUE is NULL, then the new entry will a special null one, for which envz_get will return NULL, although envz_entry will still return an entry; this is handy because when merging with another envz, the null entry can override an entry in the other one. Null entries can be removed with envz_strip (). */ extern error_t envz_add (char **__restrict __envz, size_t *__restrict __envz_len, const char *__restrict __name, const char *__restrict __value) __THROW; /* Adds each entry in ENVZ2 to ENVZ & ENVZ_LEN, as if with envz_add(). If OVERRIDE is true, then values in ENVZ2 will supersede those with the same name in ENV, otherwise not. */ extern error_t envz_merge (char **__restrict __envz, size_t *__restrict __envz_len, const char *__restrict __envz2, size_t __envz2_len, int __override) __THROW; /* Remove the entry for NAME from ENVZ & ENVZ_LEN, if any. */ extern void envz_remove (char **__restrict __envz, size_t *__restrict __envz_len, const char *__restrict __name) __THROW; /* Remove null entries. */ extern void envz_strip (char **__restrict __envz, size_t *__restrict __envz_len) __THROW; __END_DECLS #endif /* envz.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������a.out.h���������������������������������������������������������������������������������������������0000644�����������������00000010377�14763166026�0005766 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef __A_OUT_GNU_H__ #define __A_OUT_GNU_H__ #include <bits/a.out.h> #define __GNU_EXEC_MACROS__ struct exec { unsigned long a_info; /* Use macros N_MAGIC, etc for access. */ unsigned int a_text; /* Length of text, in bytes. */ unsigned int a_data; /* Length of data, in bytes. */ unsigned int a_bss; /* Length of uninitialized data area for file, in bytes. */ unsigned int a_syms; /* Length of symbol table data in file, in bytes. */ unsigned int a_entry; /* Start address. */ unsigned int a_trsize;/* Length of relocation info for text, in bytes. */ unsigned int a_drsize;/* Length of relocation info for data, in bytes. */ }; enum machine_type { M_OLDSUN2 = 0, M_68010 = 1, M_68020 = 2, M_SPARC = 3, M_386 = 100, M_MIPS1 = 151, M_MIPS2 = 152 }; #define N_MAGIC(exec) ((exec).a_info & 0xffff) #define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff)) #define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff) #define N_SET_INFO(exec, magic, type, flags) \ ((exec).a_info = ((magic) & 0xffff) \ | (((int)(type) & 0xff) << 16) \ | (((flags) & 0xff) << 24)) #define N_SET_MAGIC(exec, magic) \ ((exec).a_info = ((exec).a_info & 0xffff0000) | ((magic) & 0xffff)) #define N_SET_MACHTYPE(exec, machtype) \ ((exec).a_info = \ ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16)) #define N_SET_FLAGS(exec, flags) \ ((exec).a_info = \ ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24)) /* Code indicating object file or impure executable. */ #define OMAGIC 0407 /* Code indicating pure executable. */ #define NMAGIC 0410 /* Code indicating demand-paged executable. */ #define ZMAGIC 0413 /* This indicates a demand-paged executable with the header in the text. The first page is unmapped to help trap NULL pointer references. */ #define QMAGIC 0314 /* Code indicating core file. */ #define CMAGIC 0421 #define N_TRSIZE(a) ((a).a_trsize) #define N_DRSIZE(a) ((a).a_drsize) #define N_SYMSIZE(a) ((a).a_syms) #define N_BADMAG(x) \ (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC \ && N_MAGIC(x) != ZMAGIC && N_MAGIC(x) != QMAGIC) #define _N_HDROFF(x) (1024 - sizeof (struct exec)) #define N_TXTOFF(x) \ (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \ (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec))) #define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text) #define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data) #define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x)) #define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x)) #define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x)) /* Address of text segment in memory after it is loaded. */ #define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? 4096 : 0) /* Address of data segment in memory after it is loaded. */ #define SEGMENT_SIZE 1024 #define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1)) #define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text) #define N_DATADDR(x) \ (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \ : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x)))) #define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data) #if !defined (N_NLIST_DECLARED) struct nlist { union { char *n_name; struct nlist *n_next; long n_strx; } n_un; unsigned char n_type; char n_other; short n_desc; unsigned long n_value; }; #endif /* no N_NLIST_DECLARED. */ #define N_UNDF 0 #define N_ABS 2 #define N_TEXT 4 #define N_DATA 6 #define N_BSS 8 #define N_FN 15 #define N_EXT 1 #define N_TYPE 036 #define N_STAB 0340 #define N_INDR 0xa #define N_SETA 0x14 /* Absolute set element symbol. */ #define N_SETT 0x16 /* Text set element symbol. */ #define N_SETD 0x18 /* Data set element symbol. */ #define N_SETB 0x1A /* Bss set element symbol. */ #define N_SETV 0x1C /* Pointer to set vector in data area. */ #if !defined (N_RELOCATION_INFO_DECLARED) /* This structure describes a single relocation to be performed. The text-relocation section of the file is a vector of these structures, all of which apply to the text section. Likewise, the data-relocation section applies to the data section. */ struct relocation_info { int r_address; unsigned int r_symbolnum:24; unsigned int r_pcrel:1; unsigned int r_length:2; unsigned int r_extern:1; unsigned int r_pad:4; }; #endif /* no N_RELOCATION_INFO_DECLARED. */ #endif /* __A_OUT_GNU_H__ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libpq-fe.h������������������������������������������������������������������������������������������0000644�����������������00000050256�14763166026�0006437 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * libpq-fe.h * This file contains definitions for structures and * externs for functions used by frontend postgres applications. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/interfaces/libpq/libpq-fe.h * *------------------------------------------------------------------------- */ #ifndef LIBPQ_FE_H #define LIBPQ_FE_H #ifdef __cplusplus extern "C" { #endif #include <stdio.h> /* * postgres_ext.h defines the backend's externally visible types, * such as Oid. */ #include "postgres_ext.h" /* * Option flags for PQcopyResult */ #define PG_COPYRES_ATTRS 0x01 #define PG_COPYRES_TUPLES 0x02 /* Implies PG_COPYRES_ATTRS */ #define PG_COPYRES_EVENTS 0x04 #define PG_COPYRES_NOTICEHOOKS 0x08 /* Application-visible enum types */ /* * Although it is okay to add to these lists, values which become unused * should never be removed, nor should constants be redefined - that would * break compatibility with existing code. */ typedef enum { CONNECTION_OK, CONNECTION_BAD, /* Non-blocking mode only below here */ /* * The existence of these should never be relied upon - they should only * be used for user feedback or similar purposes. */ CONNECTION_STARTED, /* Waiting for connection to be made. */ CONNECTION_MADE, /* Connection OK; waiting to send. */ CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the * postmaster. */ CONNECTION_AUTH_OK, /* Received authentication; waiting for * backend startup. */ CONNECTION_SETENV, /* Negotiating environment. */ CONNECTION_SSL_STARTUP, /* Negotiating SSL. */ CONNECTION_NEEDED /* Internal state: connect() needed */ } ConnStatusType; typedef enum { PGRES_POLLING_FAILED = 0, PGRES_POLLING_READING, /* These two indicate that one may */ PGRES_POLLING_WRITING, /* use select before polling again. */ PGRES_POLLING_OK, PGRES_POLLING_ACTIVE /* unused; keep for awhile for backwards * compatibility */ } PostgresPollingStatusType; typedef enum { PGRES_EMPTY_QUERY = 0, /* empty query string was executed */ PGRES_COMMAND_OK, /* a query command that doesn't return * anything was executed properly by the * backend */ PGRES_TUPLES_OK, /* a query command that returns tuples was * executed properly by the backend, PGresult * contains the result tuples */ PGRES_COPY_OUT, /* Copy Out data transfer in progress */ PGRES_COPY_IN, /* Copy In data transfer in progress */ PGRES_BAD_RESPONSE, /* an unexpected response was recv'd from the * backend */ PGRES_NONFATAL_ERROR, /* notice or warning message */ PGRES_FATAL_ERROR, /* query failed */ PGRES_COPY_BOTH, /* Copy In/Out data transfer in progress */ PGRES_SINGLE_TUPLE /* single tuple from larger resultset */ } ExecStatusType; typedef enum { PQTRANS_IDLE, /* connection idle */ PQTRANS_ACTIVE, /* command in progress */ PQTRANS_INTRANS, /* idle, within transaction block */ PQTRANS_INERROR, /* idle, within failed transaction */ PQTRANS_UNKNOWN /* cannot determine status */ } PGTransactionStatusType; typedef enum { PQERRORS_TERSE, /* single-line error messages */ PQERRORS_DEFAULT, /* recommended style */ PQERRORS_VERBOSE /* all the facts, ma'am */ } PGVerbosity; typedef enum { PQPING_OK, /* server is accepting connections */ PQPING_REJECT, /* server is alive but rejecting connections */ PQPING_NO_RESPONSE, /* could not establish connection */ PQPING_NO_ATTEMPT /* connection not attempted (bad params) */ } PGPing; /* PGconn encapsulates a connection to the backend. * The contents of this struct are not supposed to be known to applications. */ typedef struct pg_conn PGconn; /* PGresult encapsulates the result of a query (or more precisely, of a single * SQL command --- a query string given to PQsendQuery can contain multiple * commands and thus return multiple PGresult objects). * The contents of this struct are not supposed to be known to applications. */ typedef struct pg_result PGresult; /* PGcancel encapsulates the information needed to cancel a running * query on an existing connection. * The contents of this struct are not supposed to be known to applications. */ typedef struct pg_cancel PGcancel; /* PGnotify represents the occurrence of a NOTIFY message. * Ideally this would be an opaque typedef, but it's so simple that it's * unlikely to change. * NOTE: in Postgres 6.4 and later, the be_pid is the notifying backend's, * whereas in earlier versions it was always your own backend's PID. */ typedef struct pgNotify { char *relname; /* notification condition name */ int be_pid; /* process ID of notifying server process */ char *extra; /* notification parameter */ /* Fields below here are private to libpq; apps should not use 'em */ struct pgNotify *next; /* list link */ } PGnotify; /* Function types for notice-handling callbacks */ typedef void (*PQnoticeReceiver) (void *arg, const PGresult *res); typedef void (*PQnoticeProcessor) (void *arg, const char *message); /* Print options for PQprint() */ typedef char pqbool; typedef struct _PQprintOpt { pqbool header; /* print output field headings and row count */ pqbool align; /* fill align the fields */ pqbool standard; /* old brain dead format */ pqbool html3; /* output html tables */ pqbool expanded; /* expand tables */ pqbool pager; /* use pager for output if needed */ char *fieldSep; /* field separator */ char *tableOpt; /* insert to HTML <table ...> */ char *caption; /* HTML <caption> */ char **fieldName; /* null terminated array of replacement field * names */ } PQprintOpt; /* ---------------- * Structure for the conninfo parameter definitions returned by PQconndefaults * or PQconninfoParse. * * All fields except "val" point at static strings which must not be altered. * "val" is either NULL or a malloc'd current-value string. PQconninfoFree() * will release both the val strings and the PQconninfoOption array itself. * ---------------- */ typedef struct _PQconninfoOption { char *keyword; /* The keyword of the option */ char *envvar; /* Fallback environment variable name */ char *compiled; /* Fallback compiled in default value */ char *val; /* Option's current value, or NULL */ char *label; /* Label for field in connect dialog */ char *dispchar; /* Indicates how to display this field in a * connect dialog. Values are: "" Display * entered value as is "*" Password field - * hide value "D" Debug option - don't show * by default */ int dispsize; /* Field size in characters for dialog */ } PQconninfoOption; /* ---------------- * PQArgBlock -- structure for PQfn() arguments * ---------------- */ typedef struct { int len; int isint; union { int *ptr; /* can't use void (dec compiler barfs) */ int integer; } u; } PQArgBlock; /* ---------------- * PGresAttDesc -- Data about a single attribute (column) of a query result * ---------------- */ typedef struct pgresAttDesc { char *name; /* column name */ Oid tableid; /* source table, if known */ int columnid; /* source column, if known */ int format; /* format code for value (text/binary) */ Oid typid; /* type id */ int typlen; /* type size */ int atttypmod; /* type-specific modifier info */ } PGresAttDesc; /* ---------------- * Exported functions of libpq * ---------------- */ /* === in fe-connect.c === */ /* make a new client connection to the backend */ /* Asynchronous (non-blocking) */ extern PGconn *PQconnectStart(const char *conninfo); extern PGconn *PQconnectStartParams(const char *const * keywords, const char *const * values, int expand_dbname); extern PostgresPollingStatusType PQconnectPoll(PGconn *conn); /* Synchronous (blocking) */ extern PGconn *PQconnectdb(const char *conninfo); extern PGconn *PQconnectdbParams(const char *const * keywords, const char *const * values, int expand_dbname); extern PGconn *PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions, const char *pgtty, const char *dbName, const char *login, const char *pwd); #define PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME) \ PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, NULL, NULL) /* close the current connection and free the PGconn data structure */ extern void PQfinish(PGconn *conn); /* get info about connection options known to PQconnectdb */ extern PQconninfoOption *PQconndefaults(void); /* parse connection options in same way as PQconnectdb */ extern PQconninfoOption *PQconninfoParse(const char *conninfo, char **errmsg); /* free the data structure returned by PQconndefaults() or PQconninfoParse() */ extern void PQconninfoFree(PQconninfoOption *connOptions); /* * close the current connection and restablish a new one with the same * parameters */ /* Asynchronous (non-blocking) */ extern int PQresetStart(PGconn *conn); extern PostgresPollingStatusType PQresetPoll(PGconn *conn); /* Synchronous (blocking) */ extern void PQreset(PGconn *conn); /* request a cancel structure */ extern PGcancel *PQgetCancel(PGconn *conn); /* free a cancel structure */ extern void PQfreeCancel(PGcancel *cancel); /* issue a cancel request */ extern int PQcancel(PGcancel *cancel, char *errbuf, int errbufsize); /* backwards compatible version of PQcancel; not thread-safe */ extern int PQrequestCancel(PGconn *conn); /* Accessor functions for PGconn objects */ extern char *PQdb(const PGconn *conn); extern char *PQuser(const PGconn *conn); extern char *PQpass(const PGconn *conn); extern char *PQhost(const PGconn *conn); extern char *PQport(const PGconn *conn); extern char *PQtty(const PGconn *conn); extern char *PQoptions(const PGconn *conn); extern ConnStatusType PQstatus(const PGconn *conn); extern PGTransactionStatusType PQtransactionStatus(const PGconn *conn); extern const char *PQparameterStatus(const PGconn *conn, const char *paramName); extern int PQprotocolVersion(const PGconn *conn); extern int PQserverVersion(const PGconn *conn); extern char *PQerrorMessage(const PGconn *conn); extern int PQsocket(const PGconn *conn); extern int PQbackendPID(const PGconn *conn); extern int PQconnectionNeedsPassword(const PGconn *conn); extern int PQconnectionUsedPassword(const PGconn *conn); extern int PQclientEncoding(const PGconn *conn); extern int PQsetClientEncoding(PGconn *conn, const char *encoding); /* Get the OpenSSL structure associated with a connection. Returns NULL for * unencrypted connections or if any other TLS library is in use. */ extern void *PQgetssl(PGconn *conn); /* Tell libpq whether it needs to initialize OpenSSL */ extern void PQinitSSL(int do_init); /* More detailed way to tell libpq whether it needs to initialize OpenSSL */ extern void PQinitOpenSSL(int do_ssl, int do_crypto); /* Set verbosity for PQerrorMessage and PQresultErrorMessage */ extern PGVerbosity PQsetErrorVerbosity(PGconn *conn, PGVerbosity verbosity); /* Enable/disable tracing */ extern void PQtrace(PGconn *conn, FILE *debug_port); extern void PQuntrace(PGconn *conn); /* Override default notice handling routines */ extern PQnoticeReceiver PQsetNoticeReceiver(PGconn *conn, PQnoticeReceiver proc, void *arg); extern PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn, PQnoticeProcessor proc, void *arg); /* * Used to set callback that prevents concurrent access to * non-thread safe functions that libpq needs. * The default implementation uses a libpq internal mutex. * Only required for multithreaded apps that use kerberos * both within their app and for postgresql connections. */ typedef void (*pgthreadlock_t) (int acquire); extern pgthreadlock_t PQregisterThreadLock(pgthreadlock_t newhandler); /* === in fe-exec.c === */ /* Simple synchronous query */ extern PGresult *PQexec(PGconn *conn, const char *query); extern PGresult *PQexecParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, const char *const * paramValues, const int *paramLengths, const int *paramFormats, int resultFormat); extern PGresult *PQprepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes); extern PGresult *PQexecPrepared(PGconn *conn, const char *stmtName, int nParams, const char *const * paramValues, const int *paramLengths, const int *paramFormats, int resultFormat); /* Interface for multiple-result or asynchronous queries */ extern int PQsendQuery(PGconn *conn, const char *query); extern int PQsendQueryParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, const char *const * paramValues, const int *paramLengths, const int *paramFormats, int resultFormat); extern int PQsendPrepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes); extern int PQsendQueryPrepared(PGconn *conn, const char *stmtName, int nParams, const char *const * paramValues, const int *paramLengths, const int *paramFormats, int resultFormat); extern int PQsetSingleRowMode(PGconn *conn); extern PGresult *PQgetResult(PGconn *conn); /* Routines for managing an asynchronous query */ extern int PQisBusy(PGconn *conn); extern int PQconsumeInput(PGconn *conn); /* LISTEN/NOTIFY support */ extern PGnotify *PQnotifies(PGconn *conn); /* Routines for copy in/out */ extern int PQputCopyData(PGconn *conn, const char *buffer, int nbytes); extern int PQputCopyEnd(PGconn *conn, const char *errormsg); extern int PQgetCopyData(PGconn *conn, char **buffer, int async); /* Deprecated routines for copy in/out */ extern int PQgetline(PGconn *conn, char *string, int length); extern int PQputline(PGconn *conn, const char *string); extern int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize); extern int PQputnbytes(PGconn *conn, const char *buffer, int nbytes); extern int PQendcopy(PGconn *conn); /* Set blocking/nonblocking connection to the backend */ extern int PQsetnonblocking(PGconn *conn, int arg); extern int PQisnonblocking(const PGconn *conn); extern int PQisthreadsafe(void); extern PGPing PQping(const char *conninfo); extern PGPing PQpingParams(const char *const * keywords, const char *const * values, int expand_dbname); /* Force the write buffer to be written (or at least try) */ extern int PQflush(PGconn *conn); /* * "Fast path" interface --- not really recommended for application * use */ extern PGresult *PQfn(PGconn *conn, int fnid, int *result_buf, int *result_len, int result_is_int, const PQArgBlock *args, int nargs); /* Accessor functions for PGresult objects */ extern ExecStatusType PQresultStatus(const PGresult *res); extern char *PQresStatus(ExecStatusType status); extern char *PQresultErrorMessage(const PGresult *res); extern char *PQresultErrorField(const PGresult *res, int fieldcode); extern int PQntuples(const PGresult *res); extern int PQnfields(const PGresult *res); extern int PQbinaryTuples(const PGresult *res); extern char *PQfname(const PGresult *res, int field_num); extern int PQfnumber(const PGresult *res, const char *field_name); extern Oid PQftable(const PGresult *res, int field_num); extern int PQftablecol(const PGresult *res, int field_num); extern int PQfformat(const PGresult *res, int field_num); extern Oid PQftype(const PGresult *res, int field_num); extern int PQfsize(const PGresult *res, int field_num); extern int PQfmod(const PGresult *res, int field_num); extern char *PQcmdStatus(PGresult *res); extern char *PQoidStatus(const PGresult *res); /* old and ugly */ extern Oid PQoidValue(const PGresult *res); /* new and improved */ extern char *PQcmdTuples(PGresult *res); extern char *PQgetvalue(const PGresult *res, int tup_num, int field_num); extern int PQgetlength(const PGresult *res, int tup_num, int field_num); extern int PQgetisnull(const PGresult *res, int tup_num, int field_num); extern int PQnparams(const PGresult *res); extern Oid PQparamtype(const PGresult *res, int param_num); /* Describe prepared statements and portals */ extern PGresult *PQdescribePrepared(PGconn *conn, const char *stmt); extern PGresult *PQdescribePortal(PGconn *conn, const char *portal); extern int PQsendDescribePrepared(PGconn *conn, const char *stmt); extern int PQsendDescribePortal(PGconn *conn, const char *portal); /* Delete a PGresult */ extern void PQclear(PGresult *res); /* For freeing other alloc'd results, such as PGnotify structs */ extern void PQfreemem(void *ptr); /* Exists for backward compatibility. bjm 2003-03-24 */ #define PQfreeNotify(ptr) PQfreemem(ptr) /* Error when no password was given. */ /* Note: depending on this is deprecated; use PQconnectionNeedsPassword(). */ #define PQnoPasswordSupplied "fe_sendauth: no password supplied\n" /* Create and manipulate PGresults */ extern PGresult *PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status); extern PGresult *PQcopyResult(const PGresult *src, int flags); extern int PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs); extern void *PQresultAlloc(PGresult *res, size_t nBytes); extern int PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len); /* Quoting strings before inclusion in queries. */ extern size_t PQescapeStringConn(PGconn *conn, char *to, const char *from, size_t length, int *error); extern char *PQescapeLiteral(PGconn *conn, const char *str, size_t len); extern char *PQescapeIdentifier(PGconn *conn, const char *str, size_t len); extern unsigned char *PQescapeByteaConn(PGconn *conn, const unsigned char *from, size_t from_length, size_t *to_length); extern unsigned char *PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen); /* These forms are deprecated! */ extern size_t PQescapeString(char *to, const char *from, size_t length); extern unsigned char *PQescapeBytea(const unsigned char *from, size_t from_length, size_t *to_length); /* === in fe-print.c === */ extern void PQprint(FILE *fout, /* output stream */ const PGresult *res, const PQprintOpt *ps); /* option structure */ /* * really old printing routines */ extern void PQdisplayTuples(const PGresult *res, FILE *fp, /* where to send the output */ int fillAlign, /* pad the fields with spaces */ const char *fieldSep, /* field separator */ int printHeader, /* display headers? */ int quiet); extern void PQprintTuples(const PGresult *res, FILE *fout, /* output stream */ int printAttName, /* print attribute names */ int terseOutput, /* delimiter bars */ int width); /* width of column, if 0, use variable width */ /* === in fe-lobj.c === */ /* Large-object access routines */ extern int lo_open(PGconn *conn, Oid lobjId, int mode); extern int lo_close(PGconn *conn, int fd); extern int lo_read(PGconn *conn, int fd, char *buf, size_t len); extern int lo_write(PGconn *conn, int fd, const char *buf, size_t len); extern int lo_lseek(PGconn *conn, int fd, int offset, int whence); extern Oid lo_creat(PGconn *conn, int mode); extern Oid lo_create(PGconn *conn, Oid lobjId); extern int lo_tell(PGconn *conn, int fd); extern int lo_truncate(PGconn *conn, int fd, size_t len); extern int lo_unlink(PGconn *conn, Oid lobjId); extern Oid lo_import(PGconn *conn, const char *filename); extern Oid lo_import_with_oid(PGconn *conn, const char *filename, Oid lobjId); extern int lo_export(PGconn *conn, Oid lobjId, const char *filename); /* === in fe-misc.c === */ /* Get the version of the libpq library in use */ extern int PQlibVersion(void); /* Determine length of multibyte encoded char at *s */ extern int PQmblen(const char *s, int encoding); /* Determine display length of multibyte encoded char at *s */ extern int PQdsplen(const char *s, int encoding); /* Get encoding id from environment variable PGCLIENTENCODING */ extern int PQenv2encoding(void); /* === in fe-auth.c === */ extern char *PQencryptPassword(const char *passwd, const char *user); /* === in encnames.c === */ extern int pg_char_to_encoding(const char *name); extern const char *pg_encoding_to_char(int encoding); extern int pg_valid_server_encoding_id(int encoding); #ifdef __cplusplus } #endif #endif /* LIBPQ_FE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gdbm.h����������������������������������������������������������������������������������������������0000644�����������������00000013377�14763166026�0005654 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* gdbm.h - The include file for dbm users. -*- c -*- */ /* This file is part of GDBM, the GNU data base manager, by Philip A. Nelson. Copyright (C) 1990, 1991, 1993, 2011 Free Software Foundation, Inc. GDBM 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, or (at your option) any later version. GDBM 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 GDBM. If not, see <http://www.gnu.org/licenses/>. You may contact the author by: e-mail: phil@cs.wwu.edu us-mail: Philip A. Nelson Computer Science Department Western Washington University Bellingham, WA 98226 *************************************************************************/ /* Protection for multiple includes. */ #ifndef _GDBM_H_ # define _GDBM_H_ /* GDBM C++ support */ # if defined(__cplusplus) || defined(c_plusplus) extern "C" { # endif /* Parameters to gdbm_open for READERS, WRITERS, and WRITERS who can create the database. */ # define GDBM_READER 0 /* A reader. */ # define GDBM_WRITER 1 /* A writer. */ # define GDBM_WRCREAT 2 /* A writer. Create the db if needed. */ # define GDBM_NEWDB 3 /* A writer. Always create a new db. */ # define GDBM_OPENMASK 7 /* Mask for the above. */ # define GDBM_FAST 0x010 /* Write fast! => No fsyncs. OBSOLETE. */ # define GDBM_SYNC 0x020 /* Sync operations to the disk. */ # define GDBM_NOLOCK 0x040 /* Don't do file locking operations. */ # define GDBM_NOMMAP 0x080 /* Don't use mmap(). */ # define GDBM_CLOEXEC 0x100 /* Close the underlying fd on exec(3) */ /* Parameters to gdbm_store for simple insertion or replacement in the case that the key is already in the database. */ # define GDBM_INSERT 0 /* Never replace old data with new. */ # define GDBM_REPLACE 1 /* Always replace old data with new. */ /* Parameters to gdbm_setopt, specifing the type of operation to perform. */ # define GDBM_SETCACHESIZE 1 /* Set the cache size. */ # define GDBM_FASTMODE 2 /* Toggle fast mode. OBSOLETE. */ # define GDBM_SETSYNCMODE 3 /* Turn on or off sync operations. */ # define GDBM_SETCENTFREE 4 /* Keep all free blocks in the header. */ # define GDBM_SETCOALESCEBLKS 5 /* Attempt to coalesce free blocks. */ # define GDBM_SETMAXMAPSIZE 6 /* Set maximum mapped memory size */ # define GDBM_SETMMAP 7 /* Toggle mmap mode */ /* Compatibility defines: */ # define GDBM_CACHESIZE GDBM_SETCACHESIZE # define GDBM_SYNCMODE GDBM_SETSYNCMODE # define GDBM_CENTFREE GDBM_SETCENTFREE # define GDBM_COALESCEBLKS GDBM_SETCOALESCEBLKS # define GDBM_GETFLAGS 8 /* Get gdbm_open flags */ # define GDBM_GETMMAP 9 /* Get mmap status */ # define GDBM_GETCACHESIZE 10 /* Get current cache side */ # define GDBM_GETSYNCMODE 11 /* Get synch mode */ # define GDBM_GETCENTFREE 12 /* Get "centfree" status */ # define GDBM_GETCOALESCEBLKS 13 /* Get free block coalesce status */ # define GDBM_GETMAXMAPSIZE 14 /* Get maximum mapped memory size */ # define GDBM_GETDBNAME 15 /* Return database file name */ /* The data and key structure. */ typedef struct { char *dptr; int dsize; } datum; /* The file information header. This is good enough for most applications. */ typedef struct gdbm_file_info *GDBM_FILE; /* External variable, the gdbm build release string. */ extern const char *gdbm_version; # define GDBM_VERSION_MAJOR 1 # define GDBM_VERSION_MINOR 10 # define GDBM_VERSION_PATCH 0 extern int const gdbm_version_number[3]; /* GDBM external functions. */ extern GDBM_FILE gdbm_open (const char *, int, int, int, void (*)(const char *)); extern void gdbm_close (GDBM_FILE); extern int gdbm_store (GDBM_FILE, datum, datum, int); extern datum gdbm_fetch (GDBM_FILE, datum); extern int gdbm_delete (GDBM_FILE, datum); extern datum gdbm_firstkey (GDBM_FILE); extern datum gdbm_nextkey (GDBM_FILE, datum); extern int gdbm_reorganize (GDBM_FILE); extern void gdbm_sync (GDBM_FILE); extern int gdbm_exists (GDBM_FILE, datum); extern int gdbm_setopt (GDBM_FILE, int, void *, int); extern int gdbm_fdesc (GDBM_FILE); extern int gdbm_export (GDBM_FILE, const char *, int, int); extern int gdbm_import (GDBM_FILE, const char *, int); # define GDBM_NO_ERROR 0 # define GDBM_MALLOC_ERROR 1 # define GDBM_BLOCK_SIZE_ERROR 2 # define GDBM_FILE_OPEN_ERROR 3 # define GDBM_FILE_WRITE_ERROR 4 # define GDBM_FILE_SEEK_ERROR 5 # define GDBM_FILE_READ_ERROR 6 # define GDBM_BAD_MAGIC_NUMBER 7 # define GDBM_EMPTY_DATABASE 8 # define GDBM_CANT_BE_READER 9 # define GDBM_CANT_BE_WRITER 10 # define GDBM_READER_CANT_DELETE 11 # define GDBM_READER_CANT_STORE 12 # define GDBM_READER_CANT_REORGANIZE 13 # define GDBM_UNKNOWN_UPDATE 14 # define GDBM_ITEM_NOT_FOUND 15 # define GDBM_REORGANIZE_FAILED 16 # define GDBM_CANNOT_REPLACE 17 # define GDBM_ILLEGAL_DATA 18 # define GDBM_OPT_ALREADY_SET 19 # define GDBM_OPT_ILLEGAL 20 # define GDBM_BYTE_SWAPPED 21 # define GDBM_BAD_FILE_OFFSET 22 # define GDBM_BAD_OPEN_FLAGS 23 # define GDBM_FILE_STAT_ERROR 24 # define GDBM_FILE_EOF 25 # define _GDBM_MIN_ERRNO 0 # define _GDBM_MAX_ERRNO GDBM_FILE_EOF typedef int gdbm_error; /* For compatibilities sake. */ extern gdbm_error gdbm_errno; extern const char * const gdbm_errlist[]; /* extra prototypes */ extern const char *gdbm_strerror (gdbm_error); extern int gdbm_version_cmp (int const a[], int const b[]); # if defined(__cplusplus) || defined(c_plusplus) } # endif #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ndbm.h����������������������������������������������������������������������������������������������0000644�����������������00000004614�14763166026�0005655 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ndbm.h - The include file for ndbm users. */ /* This file is part of GDBM, the GNU data base manager, by Philip A. Nelson. Copyright (C) 1990-2011 Free Software Foundation, Inc. GDBM 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, or (at your option) any later version. GDBM 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 GDBM. If not, see <http://www.gnu.org/licenses/>. You may contact the author by: e-mail: phil@cs.wwu.edu us-mail: Philip A. Nelson Computer Science Department Western Washington University Bellingham, WA 98226 *************************************************************************/ #include <gdbm.h> /* Parameters to dbm_store for simple insertion or replacement. */ #define DBM_INSERT GDBM_INSERT #define DBM_REPLACE GDBM_REPLACE /* The file information header. */ typedef struct { GDBM_FILE file; /* Actual gdbm file (held in the .pag file */ int dirfd; /* Descriptor of the .dir file */ datum _dbm_memory; /* Keeps the last returned key */ char *_dbm_fetch_val; /* Keeps the dptr of the last fetched datum */ gdbm_error _dbm_errno; /* Error code from the last failed call */ } DBM; /* Used internally by the library */ #define __gdbm_error_to_ndbm(dbm) \ do \ { \ if (gdbm_errno && gdbm_errno != GDBM_ITEM_NOT_FOUND) \ (dbm)->_dbm_errno = gdbm_errno; \ } \ while (0) /* These are the routines */ extern DBM *dbm_open (char *file, int flags, int mode); extern void dbm_close (DBM *dbf); extern datum dbm_fetch (DBM *dbf, datum key); extern int dbm_store (DBM *dbf, datum key, datum content, int flags); extern int dbm_delete (DBM *dbf, datum key); extern datum dbm_firstkey (DBM *dbf); extern datum dbm_nextkey (DBM *dbf); extern int dbm_error (DBM *dbf); extern void dbm_clearerr (DBM *dbf); extern int dbm_dirfno (DBM *dbf); extern int dbm_pagfno (DBM *dbf); extern int dbm_rdonly (DBM *dbf); ��������������������������������������������������������������������������������������������������������������������sound/compress_offload.h����������������������������������������������������������������������������0000644�����������������00000015127�14763166026�0011413 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * compress_offload.h - compress offload header definations * * Copyright (C) 2011 Intel Corporation * Authors: Vinod Koul <vinod.koul@linux.intel.com> * Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * 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; version 2 of the License. * * 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., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * */ #ifndef __COMPRESS_OFFLOAD_H #define __COMPRESS_OFFLOAD_H #include <linux/types.h> #include <sound/asound.h> #include <sound/compress_params.h> #define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 2) /** * struct snd_compressed_buffer - compressed buffer * @fragment_size: size of buffer fragment in bytes * @fragments: number of such fragments */ struct snd_compressed_buffer { __u32 fragment_size; __u32 fragments; } __attribute__((packed, aligned(4))); /** * struct snd_compr_params - compressed stream params * @buffer: buffer description * @codec: codec parameters * @no_wake_mode: dont wake on fragment elapsed */ struct snd_compr_params { struct snd_compressed_buffer buffer; struct snd_codec codec; __u8 no_wake_mode; } __attribute__((packed, aligned(4))); /** * struct snd_compr_tstamp - timestamp descriptor * @byte_offset: Byte offset in ring buffer to DSP * @copied_total: Total number of bytes copied from/to ring buffer to/by DSP * @pcm_frames: Frames decoded or encoded by DSP. This field will evolve by * large steps and should only be used to monitor encoding/decoding * progress. It shall not be used for timing estimates. * @pcm_io_frames: Frames rendered or received by DSP into a mixer or an audio * output/input. This field should be used for A/V sync or time estimates. * @sampling_rate: sampling rate of audio */ struct snd_compr_tstamp { __u32 byte_offset; __u32 copied_total; __u32 pcm_frames; __u32 pcm_io_frames; __u32 sampling_rate; } __attribute__((packed, aligned(4))); /** * struct snd_compr_avail - avail descriptor * @avail: Number of bytes available in ring buffer for writing/reading * @tstamp: timestamp information */ struct snd_compr_avail { __u64 avail; struct snd_compr_tstamp tstamp; } __attribute__((packed, aligned(4))); enum snd_compr_direction { SND_COMPRESS_PLAYBACK = 0, SND_COMPRESS_CAPTURE }; /** * struct snd_compr_caps - caps descriptor * @codecs: pointer to array of codecs * @direction: direction supported. Of type snd_compr_direction * @min_fragment_size: minimum fragment supported by DSP * @max_fragment_size: maximum fragment supported by DSP * @min_fragments: min fragments supported by DSP * @max_fragments: max fragments supported by DSP * @num_codecs: number of codecs supported * @reserved: reserved field */ struct snd_compr_caps { __u32 num_codecs; __u32 direction; __u32 min_fragment_size; __u32 max_fragment_size; __u32 min_fragments; __u32 max_fragments; __u32 codecs[MAX_NUM_CODECS]; __u32 reserved[11]; } __attribute__((packed, aligned(4))); /** * struct snd_compr_codec_caps - query capability of codec * @codec: codec for which capability is queried * @num_descriptors: number of codec descriptors * @descriptor: array of codec capability descriptor */ struct snd_compr_codec_caps { __u32 codec; __u32 num_descriptors; struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS]; } __attribute__((packed, aligned(4))); /** * enum sndrv_compress_encoder * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the * end of the track * @SNDRV_COMPRESS_ENCODER_DELAY: no of samples inserted by the encoder at the * beginning of the track */ enum sndrv_compress_encoder { SNDRV_COMPRESS_ENCODER_PADDING = 1, SNDRV_COMPRESS_ENCODER_DELAY = 2, }; /** * struct snd_compr_metadata - compressed stream metadata * @key: key id * @value: key value */ struct snd_compr_metadata { __u32 key; __u32 value[8]; } __attribute__((packed, aligned(4))); /** * compress path ioctl definitions * SNDRV_COMPRESS_GET_CAPS: Query capability of DSP * SNDRV_COMPRESS_GET_CODEC_CAPS: Query capability of a codec * SNDRV_COMPRESS_SET_PARAMS: Set codec and stream parameters * Note: only codec params can be changed runtime and stream params cant be * SNDRV_COMPRESS_GET_PARAMS: Query codec params * SNDRV_COMPRESS_TSTAMP: get the current timestamp value * SNDRV_COMPRESS_AVAIL: get the current buffer avail value. * This also queries the tstamp properties * SNDRV_COMPRESS_PAUSE: Pause the running stream * SNDRV_COMPRESS_RESUME: resume a paused stream * SNDRV_COMPRESS_START: Start a stream * SNDRV_COMPRESS_STOP: stop a running stream, discarding ring buffer content * and the buffers currently with DSP * SNDRV_COMPRESS_DRAIN: Play till end of buffers and stop after that * SNDRV_COMPRESS_IOCTL_VERSION: Query the API version */ #define SNDRV_COMPRESS_IOCTL_VERSION _IOR('C', 0x00, int) #define SNDRV_COMPRESS_GET_CAPS _IOWR('C', 0x10, struct snd_compr_caps) #define SNDRV_COMPRESS_GET_CODEC_CAPS _IOWR('C', 0x11,\ struct snd_compr_codec_caps) #define SNDRV_COMPRESS_SET_PARAMS _IOW('C', 0x12, struct snd_compr_params) #define SNDRV_COMPRESS_GET_PARAMS _IOR('C', 0x13, struct snd_codec) #define SNDRV_COMPRESS_SET_METADATA _IOW('C', 0x14,\ struct snd_compr_metadata) #define SNDRV_COMPRESS_GET_METADATA _IOWR('C', 0x15,\ struct snd_compr_metadata) #define SNDRV_COMPRESS_TSTAMP _IOR('C', 0x20, struct snd_compr_tstamp) #define SNDRV_COMPRESS_AVAIL _IOR('C', 0x21, struct snd_compr_avail) #define SNDRV_COMPRESS_PAUSE _IO('C', 0x30) #define SNDRV_COMPRESS_RESUME _IO('C', 0x31) #define SNDRV_COMPRESS_START _IO('C', 0x32) #define SNDRV_COMPRESS_STOP _IO('C', 0x33) #define SNDRV_COMPRESS_DRAIN _IO('C', 0x34) #define SNDRV_COMPRESS_NEXT_TRACK _IO('C', 0x35) #define SNDRV_COMPRESS_PARTIAL_DRAIN _IO('C', 0x36) /* * TODO * 1. add mmap support * */ #define SND_COMPR_TRIGGER_DRAIN 7 /*FIXME move this to pcm.h */ #define SND_COMPR_TRIGGER_NEXT_TRACK 8 #define SND_COMPR_TRIGGER_PARTIAL_DRAIN 9 #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sound/usb_stream.h����������������������������������������������������������������������������������0000644�����������������00000003623�14763166026�0010230 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (C) 2007, 2008 Karsten Wiese <fzu@wemgehoertderstaat.de> * * 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. */ #ifndef __SOUND_USB_STREAM_H #define __SOUND_USB_STREAM_H #define USB_STREAM_INTERFACE_VERSION 2 #define SNDRV_USB_STREAM_IOCTL_SET_PARAMS \ _IOW('H', 0x90, struct usb_stream_config) struct usb_stream_packet { unsigned offset; unsigned length; }; struct usb_stream_config { unsigned version; unsigned sample_rate; unsigned period_frames; unsigned frame_size; }; struct usb_stream { struct usb_stream_config cfg; unsigned read_size; unsigned write_size; int period_size; unsigned state; int idle_insize; int idle_outsize; int sync_packet; unsigned insize_done; unsigned periods_done; unsigned periods_polled; struct usb_stream_packet outpacket[2]; unsigned inpackets; unsigned inpacket_head; unsigned inpacket_split; unsigned inpacket_split_at; unsigned next_inpacket_split; unsigned next_inpacket_split_at; struct usb_stream_packet inpacket[0]; }; enum usb_stream_state { usb_stream_invalid, usb_stream_stopped, usb_stream_sync0, usb_stream_sync1, usb_stream_ready, usb_stream_running, usb_stream_xrun, }; #endif /* __SOUND_USB_STREAM_H */ �������������������������������������������������������������������������������������������������������������sound/hdsp.h����������������������������������������������������������������������������������������0000644�����������������00000006104�14763166026�0007017 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef __SOUND_HDSP_H #define __SOUND_HDSP_H /* * Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org) * * 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. */ #include <linux/types.h> #define HDSP_MATRIX_MIXER_SIZE 2048 enum HDSP_IO_Type { Digiface, Multiface, H9652, H9632, RPM, Undefined, }; struct hdsp_peak_rms { __u32 input_peaks[26]; __u32 playback_peaks[26]; __u32 output_peaks[28]; __u64 input_rms[26]; __u64 playback_rms[26]; /* These are only used for H96xx cards */ __u64 output_rms[26]; }; #define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct hdsp_peak_rms) struct hdsp_config_info { unsigned char pref_sync_ref; unsigned char wordclock_sync_check; unsigned char spdif_sync_check; unsigned char adatsync_sync_check; unsigned char adat_sync_check[3]; unsigned char spdif_in; unsigned char spdif_out; unsigned char spdif_professional; unsigned char spdif_emphasis; unsigned char spdif_nonaudio; unsigned int spdif_sample_rate; unsigned int system_sample_rate; unsigned int autosync_sample_rate; unsigned char system_clock_mode; unsigned char clock_source; unsigned char autosync_ref; unsigned char line_out; unsigned char passthru; unsigned char da_gain; unsigned char ad_gain; unsigned char phone_gain; unsigned char xlr_breakout_cable; unsigned char analog_extension_board; }; #define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdsp_config_info) struct hdsp_firmware { void *firmware_data; /* 24413 x 4 bytes */ }; #define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, struct hdsp_firmware) struct hdsp_version { enum HDSP_IO_Type io_type; unsigned short firmware_rev; }; #define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdsp_version) struct hdsp_mixer { unsigned short matrix[HDSP_MATRIX_MIXER_SIZE]; }; #define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdsp_mixer) struct hdsp_9632_aeb { int aebi; int aebo; }; #define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, struct hdsp_9632_aeb) /* typedefs for compatibility to user-space */ typedef enum HDSP_IO_Type HDSP_IO_Type; typedef struct hdsp_peak_rms hdsp_peak_rms_t; typedef struct hdsp_config_info hdsp_config_info_t; typedef struct hdsp_firmware hdsp_firmware_t; typedef struct hdsp_version hdsp_version_t; typedef struct hdsp_mixer hdsp_mixer_t; typedef struct hdsp_9632_aeb hdsp_9632_aeb_t; #endif /* __SOUND_HDSP_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sound/emu10k1.h�������������������������������������������������������������������������������������0000644�����������������00000041530�14763166026�0007246 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) by Jaroslav Kysela <perex@perex.cz>, * Creative Labs, Inc. * Definitions for EMU10K1 (SB Live!) chips * * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SOUND_EMU10K1_H #define __SOUND_EMU10K1_H #include <linux/types.h> #include <sound/asound.h> /* * ---- FX8010 ---- */ #define EMU10K1_CARD_CREATIVE 0x00000000 #define EMU10K1_CARD_EMUAPS 0x00000001 #define EMU10K1_FX8010_PCM_COUNT 8 /* * Following definition is copied from linux/types.h to support compiling * this header file in userspace since they are not generally available for * uapi headers. */ #define __EMU10K1_DECLARE_BITMAP(name,bits) \ unsigned long name[(bits) / (sizeof(unsigned long) * 8)] /* instruction set */ #define iMAC0 0x00 /* R = A + (X * Y >> 31) ; saturation */ #define iMAC1 0x01 /* R = A + (-X * Y >> 31) ; saturation */ #define iMAC2 0x02 /* R = A + (X * Y >> 31) ; wraparound */ #define iMAC3 0x03 /* R = A + (-X * Y >> 31) ; wraparound */ #define iMACINT0 0x04 /* R = A + X * Y ; saturation */ #define iMACINT1 0x05 /* R = A + X * Y ; wraparound (31-bit) */ #define iACC3 0x06 /* R = A + X + Y ; saturation */ #define iMACMV 0x07 /* R = A, acc += X * Y >> 31 */ #define iANDXOR 0x08 /* R = (A & X) ^ Y */ #define iTSTNEG 0x09 /* R = (A >= Y) ? X : ~X */ #define iLIMITGE 0x0a /* R = (A >= Y) ? X : Y */ #define iLIMITLT 0x0b /* R = (A < Y) ? X : Y */ #define iLOG 0x0c /* R = linear_data, A (log_data), X (max_exp), Y (format_word) */ #define iEXP 0x0d /* R = log_data, A (linear_data), X (max_exp), Y (format_word) */ #define iINTERP 0x0e /* R = A + (X * (Y - A) >> 31) ; saturation */ #define iSKIP 0x0f /* R = A (cc_reg), X (count), Y (cc_test) */ /* GPRs */ #define FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x0f */ #define EXTIN(x) (0x10 + (x)) /* x = 0x00 - 0x0f */ #define EXTOUT(x) (0x20 + (x)) /* x = 0x00 - 0x0f physical outs -> FXWC low 16 bits */ #define FXBUS2(x) (0x30 + (x)) /* x = 0x00 - 0x0f copies of fx buses for capture -> FXWC high 16 bits */ /* NB: 0x31 and 0x32 are shared with Center/LFE on SB live 5.1 */ #define C_00000000 0x40 #define C_00000001 0x41 #define C_00000002 0x42 #define C_00000003 0x43 #define C_00000004 0x44 #define C_00000008 0x45 #define C_00000010 0x46 #define C_00000020 0x47 #define C_00000100 0x48 #define C_00010000 0x49 #define C_00080000 0x4a #define C_10000000 0x4b #define C_20000000 0x4c #define C_40000000 0x4d #define C_80000000 0x4e #define C_7fffffff 0x4f #define C_ffffffff 0x50 #define C_fffffffe 0x51 #define C_c0000000 0x52 #define C_4f1bbcdc 0x53 #define C_5a7ef9db 0x54 #define C_00100000 0x55 /* ?? */ #define GPR_ACCU 0x56 /* ACCUM, accumulator */ #define GPR_COND 0x57 /* CCR, condition register */ #define GPR_NOISE0 0x58 /* noise source */ #define GPR_NOISE1 0x59 /* noise source */ #define GPR_IRQ 0x5a /* IRQ register */ #define GPR_DBAC 0x5b /* TRAM Delay Base Address Counter */ #define GPR(x) (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */ #define ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */ #define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */ #define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */ #define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */ #define A_ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ #define A_ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ #define A_ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ #define A_ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ #define A_ITRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ #define A_ETRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ #define A_FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x3f FX buses */ #define A_EXTIN(x) (0x40 + (x)) /* x = 0x00 - 0x0f physical ins */ #define A_P16VIN(x) (0x50 + (x)) /* x = 0x00 - 0x0f p16v ins (A2 only) "EMU32 inputs" */ #define A_EXTOUT(x) (0x60 + (x)) /* x = 0x00 - 0x1f physical outs -> A_FXWC1 0x79-7f unknown */ #define A_FXBUS2(x) (0x80 + (x)) /* x = 0x00 - 0x1f extra outs used for EFX capture -> A_FXWC2 */ #define A_EMU32OUTH(x) (0xa0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_10 - _1F" - ??? */ #define A_EMU32OUTL(x) (0xb0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_1 - _F" - ??? */ #define A3_EMU32IN(x) (0x160 + (x)) /* x = 0x00 - 0x3f "EMU32_IN_00 - _3F" - Only when .device = 0x0008 */ #define A3_EMU32OUT(x) (0x1E0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_00 - _3F" - Only when .device = 0x0008 */ #define A_GPR(x) (A_FXGPREGBASE + (x)) /* cc_reg constants */ #define CC_REG_NORMALIZED C_00000001 #define CC_REG_BORROW C_00000002 #define CC_REG_MINUS C_00000004 #define CC_REG_ZERO C_00000008 #define CC_REG_SATURATE C_00000010 #define CC_REG_NONZERO C_00000100 /* FX buses */ #define FXBUS_PCM_LEFT 0x00 #define FXBUS_PCM_RIGHT 0x01 #define FXBUS_PCM_LEFT_REAR 0x02 #define FXBUS_PCM_RIGHT_REAR 0x03 #define FXBUS_MIDI_LEFT 0x04 #define FXBUS_MIDI_RIGHT 0x05 #define FXBUS_PCM_CENTER 0x06 #define FXBUS_PCM_LFE 0x07 #define FXBUS_PCM_LEFT_FRONT 0x08 #define FXBUS_PCM_RIGHT_FRONT 0x09 #define FXBUS_MIDI_REVERB 0x0c #define FXBUS_MIDI_CHORUS 0x0d #define FXBUS_PCM_LEFT_SIDE 0x0e #define FXBUS_PCM_RIGHT_SIDE 0x0f #define FXBUS_PT_LEFT 0x14 #define FXBUS_PT_RIGHT 0x15 /* Inputs */ #define EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */ #define EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */ #define EXTIN_SPDIF_CD_L 0x02 /* internal S/PDIF CD - onboard - left */ #define EXTIN_SPDIF_CD_R 0x03 /* internal S/PDIF CD - onboard - right */ #define EXTIN_ZOOM_L 0x04 /* Zoom Video I2S - left */ #define EXTIN_ZOOM_R 0x05 /* Zoom Video I2S - right */ #define EXTIN_TOSLINK_L 0x06 /* LiveDrive - TOSLink Optical - left */ #define EXTIN_TOSLINK_R 0x07 /* LiveDrive - TOSLink Optical - right */ #define EXTIN_LINE1_L 0x08 /* LiveDrive - Line/Mic 1 - left */ #define EXTIN_LINE1_R 0x09 /* LiveDrive - Line/Mic 1 - right */ #define EXTIN_COAX_SPDIF_L 0x0a /* LiveDrive - Coaxial S/PDIF - left */ #define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */ #define EXTIN_LINE2_L 0x0c /* LiveDrive - Line/Mic 2 - left */ #define EXTIN_LINE2_R 0x0d /* LiveDrive - Line/Mic 2 - right */ /* Outputs */ #define EXTOUT_AC97_L 0x00 /* AC'97 playback channel - left */ #define EXTOUT_AC97_R 0x01 /* AC'97 playback channel - right */ #define EXTOUT_TOSLINK_L 0x02 /* LiveDrive - TOSLink Optical - left */ #define EXTOUT_TOSLINK_R 0x03 /* LiveDrive - TOSLink Optical - right */ #define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */ #define EXTOUT_AC97_LFE 0x05 /* SB Live 5.1 - LFE */ #define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */ #define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */ #define EXTOUT_REAR_L 0x08 /* Rear channel - left */ #define EXTOUT_REAR_R 0x09 /* Rear channel - right */ #define EXTOUT_ADC_CAP_L 0x0a /* ADC Capture buffer - left */ #define EXTOUT_ADC_CAP_R 0x0b /* ADC Capture buffer - right */ #define EXTOUT_MIC_CAP 0x0c /* MIC Capture buffer */ #define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */ #define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */ #define EXTOUT_ACENTER 0x11 /* Analog Center */ #define EXTOUT_ALFE 0x12 /* Analog LFE */ /* Audigy Inputs */ #define A_EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */ #define A_EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */ #define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */ #define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */ #define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */ #define A_EXTIN_OPT_SPDIF_R 0x05 /* right */ #define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */ #define A_EXTIN_LINE2_R 0x09 /* right */ #define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */ #define A_EXTIN_ADC_R 0x0b /* right */ #define A_EXTIN_AUX2_L 0x0c /* audigy drive aux2 - left */ #define A_EXTIN_AUX2_R 0x0d /* - right */ /* Audigiy Outputs */ #define A_EXTOUT_FRONT_L 0x00 /* digital front left */ #define A_EXTOUT_FRONT_R 0x01 /* right */ #define A_EXTOUT_CENTER 0x02 /* digital front center */ #define A_EXTOUT_LFE 0x03 /* digital front lfe */ #define A_EXTOUT_HEADPHONE_L 0x04 /* headphone audigy drive left */ #define A_EXTOUT_HEADPHONE_R 0x05 /* right */ #define A_EXTOUT_REAR_L 0x06 /* digital rear left */ #define A_EXTOUT_REAR_R 0x07 /* right */ #define A_EXTOUT_AFRONT_L 0x08 /* analog front left */ #define A_EXTOUT_AFRONT_R 0x09 /* right */ #define A_EXTOUT_ACENTER 0x0a /* analog center */ #define A_EXTOUT_ALFE 0x0b /* analog LFE */ #define A_EXTOUT_ASIDE_L 0x0c /* analog side left - Audigy 2 ZS */ #define A_EXTOUT_ASIDE_R 0x0d /* right - Audigy 2 ZS */ #define A_EXTOUT_AREAR_L 0x0e /* analog rear left */ #define A_EXTOUT_AREAR_R 0x0f /* right */ #define A_EXTOUT_AC97_L 0x10 /* AC97 left (front) */ #define A_EXTOUT_AC97_R 0x11 /* right */ #define A_EXTOUT_ADC_CAP_L 0x16 /* ADC capture buffer left */ #define A_EXTOUT_ADC_CAP_R 0x17 /* right */ #define A_EXTOUT_MIC_CAP 0x18 /* Mic capture buffer */ /* Audigy constants */ #define A_C_00000000 0xc0 #define A_C_00000001 0xc1 #define A_C_00000002 0xc2 #define A_C_00000003 0xc3 #define A_C_00000004 0xc4 #define A_C_00000008 0xc5 #define A_C_00000010 0xc6 #define A_C_00000020 0xc7 #define A_C_00000100 0xc8 #define A_C_00010000 0xc9 #define A_C_00000800 0xca #define A_C_10000000 0xcb #define A_C_20000000 0xcc #define A_C_40000000 0xcd #define A_C_80000000 0xce #define A_C_7fffffff 0xcf #define A_C_ffffffff 0xd0 #define A_C_fffffffe 0xd1 #define A_C_c0000000 0xd2 #define A_C_4f1bbcdc 0xd3 #define A_C_5a7ef9db 0xd4 #define A_C_00100000 0xd5 #define A_GPR_ACCU 0xd6 /* ACCUM, accumulator */ #define A_GPR_COND 0xd7 /* CCR, condition register */ #define A_GPR_NOISE0 0xd8 /* noise source */ #define A_GPR_NOISE1 0xd9 /* noise source */ #define A_GPR_IRQ 0xda /* IRQ register */ #define A_GPR_DBAC 0xdb /* TRAM Delay Base Address Counter - internal */ #define A_GPR_DBACE 0xde /* TRAM Delay Base Address Counter - external */ /* definitions for debug register */ #define EMU10K1_DBG_ZC 0x80000000 /* zero tram counter */ #define EMU10K1_DBG_SATURATION_OCCURED 0x02000000 /* saturation control */ #define EMU10K1_DBG_SATURATION_ADDR 0x01ff0000 /* saturation address */ #define EMU10K1_DBG_SINGLE_STEP 0x00008000 /* single step mode */ #define EMU10K1_DBG_STEP 0x00004000 /* start single step */ #define EMU10K1_DBG_CONDITION_CODE 0x00003e00 /* condition code */ #define EMU10K1_DBG_SINGLE_STEP_ADDR 0x000001ff /* single step address */ /* tank memory address line */ #define TANKMEMADDRREG_ADDR_MASK 0x000fffff /* 20 bit tank address field */ #define TANKMEMADDRREG_CLEAR 0x00800000 /* Clear tank memory */ #define TANKMEMADDRREG_ALIGN 0x00400000 /* Align read or write relative to tank access */ #define TANKMEMADDRREG_WRITE 0x00200000 /* Write to tank memory */ #define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */ struct snd_emu10k1_fx8010_info { unsigned int internal_tram_size; /* in samples */ unsigned int external_tram_size; /* in samples */ char fxbus_names[16][32]; /* names of FXBUSes */ char extin_names[16][32]; /* names of external inputs */ char extout_names[32][32]; /* names of external outputs */ unsigned int gpr_controls; /* count of GPR controls */ }; #define EMU10K1_GPR_TRANSLATION_NONE 0 #define EMU10K1_GPR_TRANSLATION_TABLE100 1 #define EMU10K1_GPR_TRANSLATION_BASS 2 #define EMU10K1_GPR_TRANSLATION_TREBLE 3 #define EMU10K1_GPR_TRANSLATION_ONOFF 4 struct snd_emu10k1_fx8010_control_gpr { struct snd_ctl_elem_id id; /* full control ID definition */ unsigned int vcount; /* visible count */ unsigned int count; /* count of GPR (1..16) */ unsigned short gpr[32]; /* GPR number(s) */ unsigned int value[32]; /* initial values */ unsigned int min; /* minimum range */ unsigned int max; /* maximum range */ unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ const unsigned int *tlv; }; /* old ABI without TLV support */ struct snd_emu10k1_fx8010_control_old_gpr { struct snd_ctl_elem_id id; unsigned int vcount; unsigned int count; unsigned short gpr[32]; unsigned int value[32]; unsigned int min; unsigned int max; unsigned int translation; }; struct snd_emu10k1_fx8010_code { char name[128]; __EMU10K1_DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */ __u32 *gpr_map; /* initializers */ unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */ struct snd_emu10k1_fx8010_control_gpr *gpr_add_controls; /* GPR controls to add/replace */ unsigned int gpr_del_control_count; /* count of GPR controls to remove */ struct snd_ctl_elem_id *gpr_del_controls; /* IDs of GPR controls to remove */ unsigned int gpr_list_control_count; /* count of GPR controls to list */ unsigned int gpr_list_control_total; /* total count of GPR controls */ struct snd_emu10k1_fx8010_control_gpr *gpr_list_controls; /* listed GPR controls */ __EMU10K1_DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */ __u32 *tram_data_map; /* data initializers */ __u32 *tram_addr_map; /* map initializers */ __EMU10K1_DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */ __u32 *code; /* one instruction - 64 bits */ }; struct snd_emu10k1_fx8010_tram { unsigned int address; /* 31.bit == 1 -> external TRAM */ unsigned int size; /* size in samples (4 bytes) */ unsigned int *samples; /* pointer to samples (20-bit) */ /* NULL->clear memory */ }; struct snd_emu10k1_fx8010_pcm_rec { unsigned int substream; /* substream number */ unsigned int res1; /* reserved */ unsigned int channels; /* 16-bit channels count, zero = remove this substream */ unsigned int tram_start; /* ring buffer position in TRAM (in samples) */ unsigned int buffer_size; /* count of buffered samples */ unsigned short gpr_size; /* GPR containing size of ringbuffer in samples (host) */ unsigned short gpr_ptr; /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */ unsigned short gpr_count; /* GPR containing count of samples between two interrupts (host) */ unsigned short gpr_tmpcount; /* GPR containing current count of samples to interrupt (host = set, FX8010) */ unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */ unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */ unsigned char pad; /* reserved */ unsigned char etram[32]; /* external TRAM address & data (one per channel) */ unsigned int res2; /* reserved */ }; #define SNDRV_EMU10K1_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) #define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info) #define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code) #define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code) #define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int) #define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram) #define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram) #define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec) #define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec) #define SNDRV_EMU10K1_IOCTL_PVERSION _IOR ('H', 0x40, int) #define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80) #define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81) #define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82) #define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int) #define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int) /* typedefs for compatibility to user-space */ typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t; typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t; typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t; typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t; typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t; #endif /* __SOUND_EMU10K1_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������sound/hdspm.h���������������������������������������������������������������������������������������0000644�����������������00000012556�14763166026�0007204 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef __SOUND_HDSPM_H #define __SOUND_HDSPM_H /* * Copyright (C) 2003 Winfried Ritsch (IEM) * based on hdsp.h from Thomas Charbonnel (thomas@undata.org) * * * 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. */ #include <linux/types.h> /* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */ #define HDSPM_MAX_CHANNELS 64 enum hdspm_io_type { MADI, MADIface, AIO, AES32, RayDAT }; enum hdspm_speed { ss, ds, qs }; /* -------------------- IOCTL Peak/RMS Meters -------------------- */ struct hdspm_peak_rms { __u32 input_peaks[64]; __u32 playback_peaks[64]; __u32 output_peaks[64]; __u64 input_rms[64]; __u64 playback_rms[64]; __u64 output_rms[64]; __u8 speed; /* enum {ss, ds, qs} */ int status2; }; #define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \ _IOR('H', 0x42, struct hdspm_peak_rms) /* ------------ CONFIG block IOCTL ---------------------- */ struct hdspm_config { unsigned char pref_sync_ref; unsigned char wordclock_sync_check; unsigned char madi_sync_check; unsigned int system_sample_rate; unsigned int autosync_sample_rate; unsigned char system_clock_mode; unsigned char clock_source; unsigned char autosync_ref; unsigned char line_out; unsigned int passthru; unsigned int analog_out; }; #define SNDRV_HDSPM_IOCTL_GET_CONFIG \ _IOR('H', 0x41, struct hdspm_config) /* * If there's a TCO (TimeCode Option) board installed, * there are further options and status data available. * The hdspm_ltc structure contains the current SMPTE * timecode and some status information and can be * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the * hdspm_status struct. */ enum hdspm_ltc_format { format_invalid, fps_24, fps_25, fps_2997, fps_30 }; enum hdspm_ltc_frame { frame_invalid, drop_frame, full_frame }; enum hdspm_ltc_input_format { ntsc, pal, no_video }; struct hdspm_ltc { unsigned int ltc; enum hdspm_ltc_format format; enum hdspm_ltc_frame frame; enum hdspm_ltc_input_format input_format; }; #define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc) /* * The status data reflects the device's current state * as determined by the card's configuration and * connection status. */ enum hdspm_sync { hdspm_sync_no_lock = 0, hdspm_sync_lock = 1, hdspm_sync_sync = 2 }; enum hdspm_madi_input { hdspm_input_optical = 0, hdspm_input_coax = 1 }; enum hdspm_madi_channel_format { hdspm_format_ch_64 = 0, hdspm_format_ch_56 = 1 }; enum hdspm_madi_frame_format { hdspm_frame_48 = 0, hdspm_frame_96 = 1 }; enum hdspm_syncsource { syncsource_wc = 0, syncsource_madi = 1, syncsource_tco = 2, syncsource_sync = 3, syncsource_none = 4 }; struct hdspm_status { __u8 card_type; /* enum hdspm_io_type */ enum hdspm_syncsource autosync_source; __u64 card_clock; __u32 master_period; union { struct { __u8 sync_wc; /* enum hdspm_sync */ __u8 sync_madi; /* enum hdspm_sync */ __u8 sync_tco; /* enum hdspm_sync */ __u8 sync_in; /* enum hdspm_sync */ __u8 madi_input; /* enum hdspm_madi_input */ __u8 channel_format; /* enum hdspm_madi_channel_format */ __u8 frame_format; /* enum hdspm_madi_frame_format */ } madi; } card_specific; }; #define SNDRV_HDSPM_IOCTL_GET_STATUS \ _IOR('H', 0x47, struct hdspm_status) /* * Get information about the card and its add-ons. */ #define HDSPM_ADDON_TCO 1 struct hdspm_version { __u8 card_type; /* enum hdspm_io_type */ char cardname[20]; unsigned int serial; unsigned short firmware_rev; int addons; }; #define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version) /* ------------- get Matrix Mixer IOCTL --------------- */ /* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte = * 32768 Bytes */ /* organisation is 64 channelfader in a continuous memory block */ /* equivalent to hardware definition, maybe for future feature of mmap of * them */ /* each of 64 outputs has 64 infader and 64 outfader: Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */ #define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS struct hdspm_channelfader { unsigned int in[HDSPM_MIXER_CHANNELS]; unsigned int pb[HDSPM_MIXER_CHANNELS]; }; struct hdspm_mixer { struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS]; }; struct hdspm_mixer_ioctl { struct hdspm_mixer *mixer; }; /* use indirect access due to the limit of ioctl bit size */ #define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl) /* typedefs for compatibility to user-space */ typedef struct hdspm_peak_rms hdspm_peak_rms_t; typedef struct hdspm_config_info hdspm_config_info_t; typedef struct hdspm_version hdspm_version_t; typedef struct hdspm_channelfader snd_hdspm_channelfader_t; typedef struct hdspm_mixer hdspm_mixer_t; #endif ��������������������������������������������������������������������������������������������������������������������������������������������������sound/skl-tplg-interface.h��������������������������������������������������������������������������0000644�����������������00000012125�14763166026�0011554 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 */ /* * skl-tplg-interface.h - Intel DSP FW private data interface * * Copyright (C) 2015 Intel Corp * Author: Jeeja KP <jeeja.kp@intel.com> * Nilofer, Samreen <samreen.nilofer@intel.com> */ #ifndef __HDA_TPLG_INTERFACE_H__ #define __HDA_TPLG_INTERFACE_H__ #include <linux/types.h> /* * Default types range from 0~12. type can range from 0 to 0xff * SST types start at higher to avoid any overlapping in future */ #define SKL_CONTROL_TYPE_BYTE_TLV 0x100 #define SKL_CONTROL_TYPE_MIC_SELECT 0x102 #define HDA_SST_CFG_MAX 900 /* size of copier cfg*/ #define MAX_IN_QUEUE 8 #define MAX_OUT_QUEUE 8 #define SKL_UUID_STR_SZ 40 /* Event types goes here */ /* Reserve event type 0 for no event handlers */ enum skl_event_types { SKL_EVENT_NONE = 0, SKL_MIXER_EVENT, SKL_MUX_EVENT, SKL_VMIXER_EVENT, SKL_PGA_EVENT }; /** * enum skl_ch_cfg - channel configuration * * @SKL_CH_CFG_MONO: One channel only * @SKL_CH_CFG_STEREO: L & R * @SKL_CH_CFG_2_1: L, R & LFE * @SKL_CH_CFG_3_0: L, C & R * @SKL_CH_CFG_3_1: L, C, R & LFE * @SKL_CH_CFG_QUATRO: L, R, Ls & Rs * @SKL_CH_CFG_4_0: L, C, R & Cs * @SKL_CH_CFG_5_0: L, C, R, Ls & Rs * @SKL_CH_CFG_5_1: L, C, R, Ls, Rs & LFE * @SKL_CH_CFG_DUAL_MONO: One channel replicated in two * @SKL_CH_CFG_I2S_DUAL_STEREO_0: Stereo(L,R) in 4 slots, 1st stream:[ L, R, -, - ] * @SKL_CH_CFG_I2S_DUAL_STEREO_1: Stereo(L,R) in 4 slots, 2nd stream:[ -, -, L, R ] * @SKL_CH_CFG_INVALID: Invalid */ enum skl_ch_cfg { SKL_CH_CFG_MONO = 0, SKL_CH_CFG_STEREO = 1, SKL_CH_CFG_2_1 = 2, SKL_CH_CFG_3_0 = 3, SKL_CH_CFG_3_1 = 4, SKL_CH_CFG_QUATRO = 5, SKL_CH_CFG_4_0 = 6, SKL_CH_CFG_5_0 = 7, SKL_CH_CFG_5_1 = 8, SKL_CH_CFG_DUAL_MONO = 9, SKL_CH_CFG_I2S_DUAL_STEREO_0 = 10, SKL_CH_CFG_I2S_DUAL_STEREO_1 = 11, SKL_CH_CFG_7_1 = 12, SKL_CH_CFG_4_CHANNEL = SKL_CH_CFG_7_1, SKL_CH_CFG_INVALID }; enum skl_module_type { SKL_MODULE_TYPE_MIXER = 0, SKL_MODULE_TYPE_COPIER, SKL_MODULE_TYPE_UPDWMIX, SKL_MODULE_TYPE_SRCINT, SKL_MODULE_TYPE_ALGO, SKL_MODULE_TYPE_BASE_OUTFMT, SKL_MODULE_TYPE_KPB, SKL_MODULE_TYPE_MIC_SELECT, }; enum skl_core_affinity { SKL_AFFINITY_CORE_0 = 0, SKL_AFFINITY_CORE_1, SKL_AFFINITY_CORE_MAX }; enum skl_pipe_conn_type { SKL_PIPE_CONN_TYPE_NONE = 0, SKL_PIPE_CONN_TYPE_FE, SKL_PIPE_CONN_TYPE_BE }; enum skl_hw_conn_type { SKL_CONN_NONE = 0, SKL_CONN_SOURCE = 1, SKL_CONN_SINK = 2 }; enum skl_dev_type { SKL_DEVICE_BT = 0x0, SKL_DEVICE_DMIC = 0x1, SKL_DEVICE_I2S = 0x2, SKL_DEVICE_SLIMBUS = 0x3, SKL_DEVICE_HDALINK = 0x4, SKL_DEVICE_HDAHOST = 0x5, SKL_DEVICE_NONE }; /** * enum skl_interleaving - interleaving style * * @SKL_INTERLEAVING_PER_CHANNEL: [s1_ch1...s1_chN,...,sM_ch1...sM_chN] * @SKL_INTERLEAVING_PER_SAMPLE: [s1_ch1...sM_ch1,...,s1_chN...sM_chN] */ enum skl_interleaving { SKL_INTERLEAVING_PER_CHANNEL = 0, SKL_INTERLEAVING_PER_SAMPLE = 1, }; enum skl_sample_type { SKL_SAMPLE_TYPE_INT_MSB = 0, SKL_SAMPLE_TYPE_INT_LSB = 1, SKL_SAMPLE_TYPE_INT_SIGNED = 2, SKL_SAMPLE_TYPE_INT_UNSIGNED = 3, SKL_SAMPLE_TYPE_FLOAT = 4 }; enum module_pin_type { /* All pins of the module takes same PCM inputs or outputs * e.g. mixout */ SKL_PIN_TYPE_HOMOGENEOUS, /* All pins of the module takes different PCM inputs or outputs * e.g mux */ SKL_PIN_TYPE_HETEROGENEOUS, }; enum skl_module_param_type { SKL_PARAM_DEFAULT = 0, SKL_PARAM_INIT, SKL_PARAM_SET, SKL_PARAM_BIND }; struct skl_dfw_algo_data { __u32 set_params:2; __u32 rsvd:30; __u32 param_id; __u32 max; char params[0]; } __attribute__((packed)); enum skl_tkn_dir { SKL_DIR_IN, SKL_DIR_OUT }; enum skl_tuple_type { SKL_TYPE_TUPLE, SKL_TYPE_DATA }; /* v4 configuration data */ struct skl_dfw_v4_module_pin { __u16 module_id; __u16 instance_id; } __attribute__((packed)); struct skl_dfw_v4_module_fmt { __u32 channels; __u32 freq; __u32 bit_depth; __u32 valid_bit_depth; __u32 ch_cfg; __u32 interleaving_style; __u32 sample_type; __u32 ch_map; } __attribute__((packed)); struct skl_dfw_v4_module_caps { __u32 set_params:2; __u32 rsvd:30; __u32 param_id; __u32 caps_size; __u32 caps[HDA_SST_CFG_MAX]; } __attribute__((packed)); struct skl_dfw_v4_pipe { __u8 pipe_id; __u8 pipe_priority; __u16 conn_type:4; __u16 rsvd:4; __u16 memory_pages:8; } __attribute__((packed)); struct skl_dfw_v4_module { char uuid[SKL_UUID_STR_SZ]; __u16 module_id; __u16 instance_id; __u32 max_mcps; __u32 mem_pages; __u32 obs; __u32 ibs; __u32 vbus_id; __u32 max_in_queue:8; __u32 max_out_queue:8; __u32 time_slot:8; __u32 core_id:4; __u32 rsvd1:4; __u32 module_type:8; __u32 conn_type:4; __u32 dev_type:4; __u32 hw_conn_type:4; __u32 rsvd2:12; __u32 params_fixup:8; __u32 converter:8; __u32 input_pin_type:1; __u32 output_pin_type:1; __u32 is_dynamic_in_pin:1; __u32 is_dynamic_out_pin:1; __u32 is_loadable:1; __u32 rsvd3:11; struct skl_dfw_v4_pipe pipe; struct skl_dfw_v4_module_fmt in_fmt[MAX_IN_QUEUE]; struct skl_dfw_v4_module_fmt out_fmt[MAX_OUT_QUEUE]; struct skl_dfw_v4_module_pin in_pin[MAX_IN_QUEUE]; struct skl_dfw_v4_module_pin out_pin[MAX_OUT_QUEUE]; struct skl_dfw_v4_module_caps caps; } __attribute__((packed)); #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sound/firewire.h������������������������������������������������������������������������������������0000644�����������������00000005211�14763166026�0007673 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _SOUND_FIREWIRE_H_INCLUDED #define _SOUND_FIREWIRE_H_INCLUDED #include <linux/ioctl.h> #include <linux/types.h> /* events can be read() from the hwdep device */ #define SNDRV_FIREWIRE_EVENT_LOCK_STATUS 0x000010cc #define SNDRV_FIREWIRE_EVENT_DICE_NOTIFICATION 0xd1ce004e #define SNDRV_FIREWIRE_EVENT_EFW_RESPONSE 0x4e617475 #define SNDRV_FIREWIRE_EVENT_DIGI00X_MESSAGE 0x746e736c #define SNDRV_FIREWIRE_EVENT_MOTU_NOTIFICATION 0x64776479 struct snd_firewire_event_common { unsigned int type; /* SNDRV_FIREWIRE_EVENT_xxx */ }; struct snd_firewire_event_lock_status { unsigned int type; unsigned int status; /* 0/1 = unlocked/locked */ }; struct snd_firewire_event_dice_notification { unsigned int type; unsigned int notification; /* DICE-specific bits */ }; #define SND_EFW_TRANSACTION_USER_SEQNUM_MAX ((__u32)((__u16)~0) - 1) /* each field should be in big endian */ struct snd_efw_transaction { __be32 length; __be32 version; __be32 seqnum; __be32 category; __be32 command; __be32 status; __be32 params[0]; }; struct snd_firewire_event_efw_response { unsigned int type; __be32 response[0]; /* some responses */ }; struct snd_firewire_event_digi00x_message { unsigned int type; __u32 message; /* Digi00x-specific message */ }; struct snd_firewire_event_motu_notification { unsigned int type; __u32 message; /* MOTU-specific bits. */ }; union snd_firewire_event { struct snd_firewire_event_common common; struct snd_firewire_event_lock_status lock_status; struct snd_firewire_event_dice_notification dice_notification; struct snd_firewire_event_efw_response efw_response; struct snd_firewire_event_digi00x_message digi00x_message; struct snd_firewire_event_motu_notification motu_notification; }; #define SNDRV_FIREWIRE_IOCTL_GET_INFO _IOR('H', 0xf8, struct snd_firewire_get_info) #define SNDRV_FIREWIRE_IOCTL_LOCK _IO('H', 0xf9) #define SNDRV_FIREWIRE_IOCTL_UNLOCK _IO('H', 0xfa) #define SNDRV_FIREWIRE_TYPE_DICE 1 #define SNDRV_FIREWIRE_TYPE_FIREWORKS 2 #define SNDRV_FIREWIRE_TYPE_BEBOB 3 #define SNDRV_FIREWIRE_TYPE_OXFW 4 #define SNDRV_FIREWIRE_TYPE_DIGI00X 5 #define SNDRV_FIREWIRE_TYPE_TASCAM 6 #define SNDRV_FIREWIRE_TYPE_MOTU 7 #define SNDRV_FIREWIRE_TYPE_FIREFACE 8 struct snd_firewire_get_info { unsigned int type; /* SNDRV_FIREWIRE_TYPE_xxx */ unsigned int card; /* same as fw_cdev_get_info.card */ unsigned char guid[8]; char device_name[16]; /* device node in /dev */ }; /* * SNDRV_FIREWIRE_IOCTL_LOCK prevents the driver from streaming. * Returns -EBUSY if the driver is already streaming. */ #endif /* _SOUND_FIREWIRE_H_INCLUDED */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sound/asound_fm.h�����������������������������������������������������������������������������������0000644�����������������00000010431�14763166026�0010032 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef __SOUND_ASOUND_FM_H #define __SOUND_ASOUND_FM_H /* * Advanced Linux Sound Architecture - ALSA * * Interface file between ALSA driver & user space * Copyright (c) 1994-98 by Jaroslav Kysela <perex@perex.cz>, * 4Front Technologies * * Direct FM control * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #define SNDRV_DM_FM_MODE_OPL2 0x00 #define SNDRV_DM_FM_MODE_OPL3 0x01 struct snd_dm_fm_info { unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ unsigned char rhythm; /* percussion mode flag */ }; /* * Data structure composing an FM "note" or sound event. */ struct snd_dm_fm_voice { unsigned char op; /* operator cell (0 or 1) */ unsigned char voice; /* FM voice (0 to 17) */ unsigned char am; /* amplitude modulation */ unsigned char vibrato; /* vibrato effect */ unsigned char do_sustain; /* sustain phase */ unsigned char kbd_scale; /* keyboard scaling */ unsigned char harmonic; /* 4 bits: harmonic and multiplier */ unsigned char scale_level; /* 2 bits: decrease output freq rises */ unsigned char volume; /* 6 bits: volume */ unsigned char attack; /* 4 bits: attack rate */ unsigned char decay; /* 4 bits: decay rate */ unsigned char sustain; /* 4 bits: sustain level */ unsigned char release; /* 4 bits: release rate */ unsigned char feedback; /* 3 bits: feedback for op0 */ unsigned char connection; /* 0 for serial, 1 for parallel */ unsigned char left; /* stereo left */ unsigned char right; /* stereo right */ unsigned char waveform; /* 3 bits: waveform shape */ }; /* * This describes an FM note by its voice, octave, frequency number (10bit) * and key on/off. */ struct snd_dm_fm_note { unsigned char voice; /* 0-17 voice channel */ unsigned char octave; /* 3 bits: what octave to play */ unsigned int fnum; /* 10 bits: frequency number */ unsigned char key_on; /* set for active, clear for silent */ }; /* * FM parameters that apply globally to all voices, and thus are not "notes" */ struct snd_dm_fm_params { unsigned char am_depth; /* amplitude modulation depth (1=hi) */ unsigned char vib_depth; /* vibrato depth (1=hi) */ unsigned char kbd_split; /* keyboard split */ unsigned char rhythm; /* percussion mode select */ /* This block is the percussion instrument data */ unsigned char bass; unsigned char snare; unsigned char tomtom; unsigned char cymbal; unsigned char hihat; }; /* * FM mode ioctl settings */ #define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info) #define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21) #define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note) #define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice) #define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params) #define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int) /* for OPL3 only */ #define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int) /* SBI patch management */ #define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40) #define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20 #define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21 #define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22 #define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23 #define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24 #define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25 /* * Patch Record - fixed size for write */ #define FM_KEY_SBI "SBI\032" #define FM_KEY_2OP "2OP\032" #define FM_KEY_4OP "4OP\032" struct sbi_patch { unsigned char prog; unsigned char bank; char key[4]; char name[25]; char extension[7]; unsigned char data[32]; }; #endif /* __SOUND_ASOUND_FM_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sound/compress_params.h�����������������������������������������������������������������������������0000644�����������������00000041140�14763166026�0011256 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) AND MIT) */ /* * compress_params.h - codec types and parameters for compressed data * streaming interface * * Copyright (C) 2011 Intel Corporation * Authors: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> * Vinod Koul <vinod.koul@linux.intel.com> * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * 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; version 2 of the License. * * 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., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * The definitions in this file are derived from the OpenMAX AL version 1.1 * and OpenMAX IL v 1.1.2 header files which contain the copyright notice below. * * Copyright (c) 2007-2010 The Khronos Group Inc. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and/or associated documentation files (the * "Materials "), to deal in the Materials without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Materials, and to * permit persons to whom the Materials are furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Materials. * * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. * */ #ifndef __SND_COMPRESS_PARAMS_H #define __SND_COMPRESS_PARAMS_H #include <linux/types.h> /* AUDIO CODECS SUPPORTED */ #define MAX_NUM_CODECS 32 #define MAX_NUM_CODEC_DESCRIPTORS 32 #define MAX_NUM_BITRATES 32 #define MAX_NUM_SAMPLE_RATES 32 /* Codecs are listed linearly to allow for extensibility */ #define SND_AUDIOCODEC_PCM ((__u32) 0x00000001) #define SND_AUDIOCODEC_MP3 ((__u32) 0x00000002) #define SND_AUDIOCODEC_AMR ((__u32) 0x00000003) #define SND_AUDIOCODEC_AMRWB ((__u32) 0x00000004) #define SND_AUDIOCODEC_AMRWBPLUS ((__u32) 0x00000005) #define SND_AUDIOCODEC_AAC ((__u32) 0x00000006) #define SND_AUDIOCODEC_WMA ((__u32) 0x00000007) #define SND_AUDIOCODEC_REAL ((__u32) 0x00000008) #define SND_AUDIOCODEC_VORBIS ((__u32) 0x00000009) #define SND_AUDIOCODEC_FLAC ((__u32) 0x0000000A) #define SND_AUDIOCODEC_IEC61937 ((__u32) 0x0000000B) #define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C) #define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D) #define SND_AUDIOCODEC_BESPOKE ((__u32) 0x0000000E) #define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_BESPOKE /* * Profile and modes are listed with bit masks. This allows for a * more compact representation of fields that will not evolve * (in contrast to the list of codecs) */ #define SND_AUDIOPROFILE_PCM ((__u32) 0x00000001) /* MP3 modes are only useful for encoders */ #define SND_AUDIOCHANMODE_MP3_MONO ((__u32) 0x00000001) #define SND_AUDIOCHANMODE_MP3_STEREO ((__u32) 0x00000002) #define SND_AUDIOCHANMODE_MP3_JOINTSTEREO ((__u32) 0x00000004) #define SND_AUDIOCHANMODE_MP3_DUAL ((__u32) 0x00000008) #define SND_AUDIOPROFILE_AMR ((__u32) 0x00000001) /* AMR modes are only useful for encoders */ #define SND_AUDIOMODE_AMR_DTX_OFF ((__u32) 0x00000001) #define SND_AUDIOMODE_AMR_VAD1 ((__u32) 0x00000002) #define SND_AUDIOMODE_AMR_VAD2 ((__u32) 0x00000004) #define SND_AUDIOSTREAMFORMAT_UNDEFINED ((__u32) 0x00000000) #define SND_AUDIOSTREAMFORMAT_CONFORMANCE ((__u32) 0x00000001) #define SND_AUDIOSTREAMFORMAT_IF1 ((__u32) 0x00000002) #define SND_AUDIOSTREAMFORMAT_IF2 ((__u32) 0x00000004) #define SND_AUDIOSTREAMFORMAT_FSF ((__u32) 0x00000008) #define SND_AUDIOSTREAMFORMAT_RTPPAYLOAD ((__u32) 0x00000010) #define SND_AUDIOSTREAMFORMAT_ITU ((__u32) 0x00000020) #define SND_AUDIOPROFILE_AMRWB ((__u32) 0x00000001) /* AMRWB modes are only useful for encoders */ #define SND_AUDIOMODE_AMRWB_DTX_OFF ((__u32) 0x00000001) #define SND_AUDIOMODE_AMRWB_VAD1 ((__u32) 0x00000002) #define SND_AUDIOMODE_AMRWB_VAD2 ((__u32) 0x00000004) #define SND_AUDIOPROFILE_AMRWBPLUS ((__u32) 0x00000001) #define SND_AUDIOPROFILE_AAC ((__u32) 0x00000001) /* AAC modes are required for encoders and decoders */ #define SND_AUDIOMODE_AAC_MAIN ((__u32) 0x00000001) #define SND_AUDIOMODE_AAC_LC ((__u32) 0x00000002) #define SND_AUDIOMODE_AAC_SSR ((__u32) 0x00000004) #define SND_AUDIOMODE_AAC_LTP ((__u32) 0x00000008) #define SND_AUDIOMODE_AAC_HE ((__u32) 0x00000010) #define SND_AUDIOMODE_AAC_SCALABLE ((__u32) 0x00000020) #define SND_AUDIOMODE_AAC_ERLC ((__u32) 0x00000040) #define SND_AUDIOMODE_AAC_LD ((__u32) 0x00000080) #define SND_AUDIOMODE_AAC_HE_PS ((__u32) 0x00000100) #define SND_AUDIOMODE_AAC_HE_MPS ((__u32) 0x00000200) /* AAC formats are required for encoders and decoders */ #define SND_AUDIOSTREAMFORMAT_MP2ADTS ((__u32) 0x00000001) #define SND_AUDIOSTREAMFORMAT_MP4ADTS ((__u32) 0x00000002) #define SND_AUDIOSTREAMFORMAT_MP4LOAS ((__u32) 0x00000004) #define SND_AUDIOSTREAMFORMAT_MP4LATM ((__u32) 0x00000008) #define SND_AUDIOSTREAMFORMAT_ADIF ((__u32) 0x00000010) #define SND_AUDIOSTREAMFORMAT_MP4FF ((__u32) 0x00000020) #define SND_AUDIOSTREAMFORMAT_RAW ((__u32) 0x00000040) #define SND_AUDIOPROFILE_WMA7 ((__u32) 0x00000001) #define SND_AUDIOPROFILE_WMA8 ((__u32) 0x00000002) #define SND_AUDIOPROFILE_WMA9 ((__u32) 0x00000004) #define SND_AUDIOPROFILE_WMA10 ((__u32) 0x00000008) #define SND_AUDIOMODE_WMA_LEVEL1 ((__u32) 0x00000001) #define SND_AUDIOMODE_WMA_LEVEL2 ((__u32) 0x00000002) #define SND_AUDIOMODE_WMA_LEVEL3 ((__u32) 0x00000004) #define SND_AUDIOMODE_WMA_LEVEL4 ((__u32) 0x00000008) #define SND_AUDIOMODE_WMAPRO_LEVELM0 ((__u32) 0x00000010) #define SND_AUDIOMODE_WMAPRO_LEVELM1 ((__u32) 0x00000020) #define SND_AUDIOMODE_WMAPRO_LEVELM2 ((__u32) 0x00000040) #define SND_AUDIOMODE_WMAPRO_LEVELM3 ((__u32) 0x00000080) #define SND_AUDIOSTREAMFORMAT_WMA_ASF ((__u32) 0x00000001) /* * Some implementations strip the ASF header and only send ASF packets * to the DSP */ #define SND_AUDIOSTREAMFORMAT_WMA_NOASF_HDR ((__u32) 0x00000002) #define SND_AUDIOPROFILE_REALAUDIO ((__u32) 0x00000001) #define SND_AUDIOMODE_REALAUDIO_G2 ((__u32) 0x00000001) #define SND_AUDIOMODE_REALAUDIO_8 ((__u32) 0x00000002) #define SND_AUDIOMODE_REALAUDIO_10 ((__u32) 0x00000004) #define SND_AUDIOMODE_REALAUDIO_SURROUND ((__u32) 0x00000008) #define SND_AUDIOPROFILE_VORBIS ((__u32) 0x00000001) #define SND_AUDIOMODE_VORBIS ((__u32) 0x00000001) #define SND_AUDIOPROFILE_FLAC ((__u32) 0x00000001) /* * Define quality levels for FLAC encoders, from LEVEL0 (fast) * to LEVEL8 (best) */ #define SND_AUDIOMODE_FLAC_LEVEL0 ((__u32) 0x00000001) #define SND_AUDIOMODE_FLAC_LEVEL1 ((__u32) 0x00000002) #define SND_AUDIOMODE_FLAC_LEVEL2 ((__u32) 0x00000004) #define SND_AUDIOMODE_FLAC_LEVEL3 ((__u32) 0x00000008) #define SND_AUDIOMODE_FLAC_LEVEL4 ((__u32) 0x00000010) #define SND_AUDIOMODE_FLAC_LEVEL5 ((__u32) 0x00000020) #define SND_AUDIOMODE_FLAC_LEVEL6 ((__u32) 0x00000040) #define SND_AUDIOMODE_FLAC_LEVEL7 ((__u32) 0x00000080) #define SND_AUDIOMODE_FLAC_LEVEL8 ((__u32) 0x00000100) #define SND_AUDIOSTREAMFORMAT_FLAC ((__u32) 0x00000001) #define SND_AUDIOSTREAMFORMAT_FLAC_OGG ((__u32) 0x00000002) /* IEC61937 payloads without CUVP and preambles */ #define SND_AUDIOPROFILE_IEC61937 ((__u32) 0x00000001) /* IEC61937 with S/PDIF preambles+CUVP bits in 32-bit containers */ #define SND_AUDIOPROFILE_IEC61937_SPDIF ((__u32) 0x00000002) /* * IEC modes are mandatory for decoders. Format autodetection * will only happen on the DSP side with mode 0. The PCM mode should * not be used, the PCM codec should be used instead. */ #define SND_AUDIOMODE_IEC_REF_STREAM_HEADER ((__u32) 0x00000000) #define SND_AUDIOMODE_IEC_LPCM ((__u32) 0x00000001) #define SND_AUDIOMODE_IEC_AC3 ((__u32) 0x00000002) #define SND_AUDIOMODE_IEC_MPEG1 ((__u32) 0x00000004) #define SND_AUDIOMODE_IEC_MP3 ((__u32) 0x00000008) #define SND_AUDIOMODE_IEC_MPEG2 ((__u32) 0x00000010) #define SND_AUDIOMODE_IEC_AACLC ((__u32) 0x00000020) #define SND_AUDIOMODE_IEC_DTS ((__u32) 0x00000040) #define SND_AUDIOMODE_IEC_ATRAC ((__u32) 0x00000080) #define SND_AUDIOMODE_IEC_SACD ((__u32) 0x00000100) #define SND_AUDIOMODE_IEC_EAC3 ((__u32) 0x00000200) #define SND_AUDIOMODE_IEC_DTS_HD ((__u32) 0x00000400) #define SND_AUDIOMODE_IEC_MLP ((__u32) 0x00000800) #define SND_AUDIOMODE_IEC_DST ((__u32) 0x00001000) #define SND_AUDIOMODE_IEC_WMAPRO ((__u32) 0x00002000) #define SND_AUDIOMODE_IEC_REF_CXT ((__u32) 0x00004000) #define SND_AUDIOMODE_IEC_HE_AAC ((__u32) 0x00008000) #define SND_AUDIOMODE_IEC_HE_AAC2 ((__u32) 0x00010000) #define SND_AUDIOMODE_IEC_MPEG_SURROUND ((__u32) 0x00020000) #define SND_AUDIOPROFILE_G723_1 ((__u32) 0x00000001) #define SND_AUDIOMODE_G723_1_ANNEX_A ((__u32) 0x00000001) #define SND_AUDIOMODE_G723_1_ANNEX_B ((__u32) 0x00000002) #define SND_AUDIOMODE_G723_1_ANNEX_C ((__u32) 0x00000004) #define SND_AUDIOPROFILE_G729 ((__u32) 0x00000001) #define SND_AUDIOMODE_G729_ANNEX_A ((__u32) 0x00000001) #define SND_AUDIOMODE_G729_ANNEX_B ((__u32) 0x00000002) /* <FIXME: multichannel encoders aren't supported for now. Would need an additional definition of channel arrangement> */ /* VBR/CBR definitions */ #define SND_RATECONTROLMODE_CONSTANTBITRATE ((__u32) 0x00000001) #define SND_RATECONTROLMODE_VARIABLEBITRATE ((__u32) 0x00000002) /* Encoder options */ struct snd_enc_wma { __u32 super_block_align; /* WMA Type-specific data */ }; /** * struct snd_enc_vorbis * @quality: Sets encoding quality to n, between -1 (low) and 10 (high). * In the default mode of operation, the quality level is 3. * Normal quality range is 0 - 10. * @managed: Boolean. Set bitrate management mode. This turns off the * normal VBR encoding, but allows hard or soft bitrate constraints to be * enforced by the encoder. This mode can be slower, and may also be * lower quality. It is primarily useful for streaming. * @max_bit_rate: Enabled only if managed is TRUE * @min_bit_rate: Enabled only if managed is TRUE * @downmix: Boolean. Downmix input from stereo to mono (has no effect on * non-stereo streams). Useful for lower-bitrate encoding. * * These options were extracted from the OpenMAX IL spec and Gstreamer vorbisenc * properties * * For best quality users should specify VBR mode and set quality levels. */ struct snd_enc_vorbis { __s32 quality; __u32 managed; __u32 max_bit_rate; __u32 min_bit_rate; __u32 downmix; } __attribute__((packed, aligned(4))); /** * struct snd_enc_real * @quant_bits: number of coupling quantization bits in the stream * @start_region: coupling start region in the stream * @num_regions: number of regions value * * These options were extracted from the OpenMAX IL spec */ struct snd_enc_real { __u32 quant_bits; __u32 start_region; __u32 num_regions; } __attribute__((packed, aligned(4))); /** * struct snd_enc_flac * @num: serial number, valid only for OGG formats * needs to be set by application * @gain: Add replay gain tags * * These options were extracted from the FLAC online documentation * at http://flac.sourceforge.net/documentation_tools_flac.html * * To make the API simpler, it is assumed that the user will select quality * profiles. Additional options that affect encoding quality and speed can * be added at a later stage if needed. * * By default the Subset format is used by encoders. * * TAGS such as pictures, etc, cannot be handled by an offloaded encoder and are * not supported in this API. */ struct snd_enc_flac { __u32 num; __u32 gain; } __attribute__((packed, aligned(4))); struct snd_enc_generic { __u32 bw; /* encoder bandwidth */ __s32 reserved[15]; /* Can be used for SND_AUDIOCODEC_BESPOKE */ } __attribute__((packed, aligned(4))); union snd_codec_options { struct snd_enc_wma wma; struct snd_enc_vorbis vorbis; struct snd_enc_real real; struct snd_enc_flac flac; struct snd_enc_generic generic; } __attribute__((packed, aligned(4))); /** struct snd_codec_desc - description of codec capabilities * @max_ch: Maximum number of audio channels * @sample_rates: Sampling rates in Hz, use values like 48000 for this * @num_sample_rates: Number of valid values in sample_rates array * @bit_rate: Indexed array containing supported bit rates * @num_bitrates: Number of valid values in bit_rate array * @rate_control: value is specified by SND_RATECONTROLMODE defines. * @profiles: Supported profiles. See SND_AUDIOPROFILE defines. * @modes: Supported modes. See SND_AUDIOMODE defines * @formats: Supported formats. See SND_AUDIOSTREAMFORMAT defines * @min_buffer: Minimum buffer size handled by codec implementation * @reserved: reserved for future use * * This structure provides a scalar value for profiles, modes and stream * format fields. * If an implementation supports multiple combinations, they will be listed as * codecs with different descriptors, for example there would be 2 descriptors * for AAC-RAW and AAC-ADTS. * This entails some redundancy but makes it easier to avoid invalid * configurations. * */ struct snd_codec_desc { __u32 max_ch; __u32 sample_rates[MAX_NUM_SAMPLE_RATES]; __u32 num_sample_rates; __u32 bit_rate[MAX_NUM_BITRATES]; __u32 num_bitrates; __u32 rate_control; __u32 profiles; __u32 modes; __u32 formats; __u32 min_buffer; __u32 reserved[15]; } __attribute__((packed, aligned(4))); /** struct snd_codec * @id: Identifies the supported audio encoder/decoder. * See SND_AUDIOCODEC macros. * @ch_in: Number of input audio channels * @ch_out: Number of output channels. In case of contradiction between * this field and the channelMode field, the channelMode field * overrides. * @sample_rate: Audio sample rate of input data in Hz, use values like 48000 * for this. * @bit_rate: Bitrate of encoded data. May be ignored by decoders * @rate_control: Encoding rate control. See SND_RATECONTROLMODE defines. * Encoders may rely on profiles for quality levels. * May be ignored by decoders. * @profile: Mandatory for encoders, can be mandatory for specific * decoders as well. See SND_AUDIOPROFILE defines. * @level: Supported level (Only used by WMA at the moment) * @ch_mode: Channel mode for encoder. See SND_AUDIOCHANMODE defines * @format: Format of encoded bistream. Mandatory when defined. * See SND_AUDIOSTREAMFORMAT defines. * @align: Block alignment in bytes of an audio sample. * Only required for PCM or IEC formats. * @options: encoder-specific settings * @reserved: reserved for future use */ struct snd_codec { __u32 id; __u32 ch_in; __u32 ch_out; __u32 sample_rate; __u32 bit_rate; __u32 rate_control; __u32 profile; __u32 level; __u32 ch_mode; __u32 format; __u32 align; union snd_codec_options options; __u32 reserved[3]; } __attribute__((packed, aligned(4))); #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sound/asound.h��������������������������������������������������������������������������������������0000644�����������������00000132722�14763166026�0007360 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Advanced Linux Sound Architecture - ALSA - Driver * Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>, * Abramo Bagnara <abramo@alsa-project.org> * * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SOUND_ASOUND_H #define __SOUND_ASOUND_H #if defined(__KERNEL__) || defined(__linux__) #include <linux/types.h> #else #include <sys/ioctl.h> #endif #include <stdlib.h> /* * protocol version */ #define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor)) #define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff) #define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff) #define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff) #define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \ (SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \ (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \ SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion))) /**************************************************************************** * * * Digital audio interface * * * ****************************************************************************/ struct snd_aes_iec958 { unsigned char status[24]; /* AES/IEC958 channel status bits */ unsigned char subcode[147]; /* AES/IEC958 subcode bits */ unsigned char pad; /* nothing */ unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */ }; /**************************************************************************** * * * CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort * * * ****************************************************************************/ struct snd_cea_861_aud_if { unsigned char db1_ct_cc; /* coding type and channel count */ unsigned char db2_sf_ss; /* sample frequency and size */ unsigned char db3; /* not used, all zeros */ unsigned char db4_ca; /* channel allocation code */ unsigned char db5_dminh_lsv; /* downmix inhibit & level-shit values */ }; /**************************************************************************** * * * Section for driver hardware dependent interface - /dev/snd/hw? * * * ****************************************************************************/ #define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) enum { SNDRV_HWDEP_IFACE_OPL2 = 0, SNDRV_HWDEP_IFACE_OPL3, SNDRV_HWDEP_IFACE_OPL4, SNDRV_HWDEP_IFACE_SB16CSP, /* Creative Signal Processor */ SNDRV_HWDEP_IFACE_EMU10K1, /* FX8010 processor in EMU10K1 chip */ SNDRV_HWDEP_IFACE_YSS225, /* Yamaha FX processor */ SNDRV_HWDEP_IFACE_ICS2115, /* Wavetable synth */ SNDRV_HWDEP_IFACE_SSCAPE, /* Ensoniq SoundScape ISA card (MC68EC000) */ SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */ SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */ SNDRV_HWDEP_IFACE_USX2Y, /* Tascam US122, US224 & US428 usb */ SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */ SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */ SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */ SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */ SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */ SNDRV_HWDEP_IFACE_HDA, /* HD-audio */ SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */ SNDRV_HWDEP_IFACE_FW_DICE, /* TC DICE FireWire device */ SNDRV_HWDEP_IFACE_FW_FIREWORKS, /* Echo Audio Fireworks based device */ SNDRV_HWDEP_IFACE_FW_BEBOB, /* BridgeCo BeBoB based device */ SNDRV_HWDEP_IFACE_FW_OXFW, /* Oxford OXFW970/971 based device */ SNDRV_HWDEP_IFACE_FW_DIGI00X, /* Digidesign Digi 002/003 family */ SNDRV_HWDEP_IFACE_FW_TASCAM, /* TASCAM FireWire series */ SNDRV_HWDEP_IFACE_LINE6, /* Line6 USB processors */ SNDRV_HWDEP_IFACE_FW_MOTU, /* MOTU FireWire series */ SNDRV_HWDEP_IFACE_FW_FIREFACE, /* RME Fireface series */ /* Don't forget to change the following: */ SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_FW_FIREFACE }; struct snd_hwdep_info { unsigned int device; /* WR: device number */ int card; /* R: card number */ unsigned char id[64]; /* ID (user selectable) */ unsigned char name[80]; /* hwdep name */ int iface; /* hwdep interface */ unsigned char reserved[64]; /* reserved for future */ }; /* generic DSP loader */ struct snd_hwdep_dsp_status { unsigned int version; /* R: driver-specific version */ unsigned char id[32]; /* R: driver-specific ID string */ unsigned int num_dsps; /* R: number of DSP images to transfer */ unsigned int dsp_loaded; /* R: bit flags indicating the loaded DSPs */ unsigned int chip_ready; /* R: 1 = initialization finished */ unsigned char reserved[16]; /* reserved for future use */ }; struct snd_hwdep_dsp_image { unsigned int index; /* W: DSP index */ unsigned char name[64]; /* W: ID (e.g. file name) */ unsigned char *image; /* W: binary image */ size_t length; /* W: size of image in bytes */ unsigned long driver_data; /* W: driver-specific data */ }; #define SNDRV_HWDEP_IOCTL_PVERSION _IOR ('H', 0x00, int) #define SNDRV_HWDEP_IOCTL_INFO _IOR ('H', 0x01, struct snd_hwdep_info) #define SNDRV_HWDEP_IOCTL_DSP_STATUS _IOR('H', 0x02, struct snd_hwdep_dsp_status) #define SNDRV_HWDEP_IOCTL_DSP_LOAD _IOW('H', 0x03, struct snd_hwdep_dsp_image) /***************************************************************************** * * * Digital Audio (PCM) interface - /dev/snd/pcm?? * * * *****************************************************************************/ #define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 14) typedef unsigned long snd_pcm_uframes_t; typedef signed long snd_pcm_sframes_t; enum { SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */ SNDRV_PCM_CLASS_MULTI, /* multichannel device */ SNDRV_PCM_CLASS_MODEM, /* software modem class */ SNDRV_PCM_CLASS_DIGITIZER, /* digitizer class */ /* Don't forget to change the following: */ SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER, }; enum { SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */ SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */ /* Don't forget to change the following: */ SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX, }; enum { SNDRV_PCM_STREAM_PLAYBACK = 0, SNDRV_PCM_STREAM_CAPTURE, SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE, }; typedef int __bitwise snd_pcm_access_t; #define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((snd_pcm_access_t) 0) /* interleaved mmap */ #define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((snd_pcm_access_t) 1) /* noninterleaved mmap */ #define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((snd_pcm_access_t) 2) /* complex mmap */ #define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((snd_pcm_access_t) 3) /* readi/writei */ #define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((snd_pcm_access_t) 4) /* readn/writen */ #define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED typedef int __bitwise snd_pcm_format_t; #define SNDRV_PCM_FORMAT_S8 ((snd_pcm_format_t) 0) #define SNDRV_PCM_FORMAT_U8 ((snd_pcm_format_t) 1) #define SNDRV_PCM_FORMAT_S16_LE ((snd_pcm_format_t) 2) #define SNDRV_PCM_FORMAT_S16_BE ((snd_pcm_format_t) 3) #define SNDRV_PCM_FORMAT_U16_LE ((snd_pcm_format_t) 4) #define SNDRV_PCM_FORMAT_U16_BE ((snd_pcm_format_t) 5) #define SNDRV_PCM_FORMAT_S24_LE ((snd_pcm_format_t) 6) /* low three bytes */ #define SNDRV_PCM_FORMAT_S24_BE ((snd_pcm_format_t) 7) /* low three bytes */ #define SNDRV_PCM_FORMAT_U24_LE ((snd_pcm_format_t) 8) /* low three bytes */ #define SNDRV_PCM_FORMAT_U24_BE ((snd_pcm_format_t) 9) /* low three bytes */ #define SNDRV_PCM_FORMAT_S32_LE ((snd_pcm_format_t) 10) #define SNDRV_PCM_FORMAT_S32_BE ((snd_pcm_format_t) 11) #define SNDRV_PCM_FORMAT_U32_LE ((snd_pcm_format_t) 12) #define SNDRV_PCM_FORMAT_U32_BE ((snd_pcm_format_t) 13) #define SNDRV_PCM_FORMAT_FLOAT_LE ((snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ #define SNDRV_PCM_FORMAT_FLOAT_BE ((snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ #define SNDRV_PCM_FORMAT_FLOAT64_LE ((snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ #define SNDRV_PCM_FORMAT_FLOAT64_BE ((snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ #define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */ #define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */ #define SNDRV_PCM_FORMAT_MU_LAW ((snd_pcm_format_t) 20) #define SNDRV_PCM_FORMAT_A_LAW ((snd_pcm_format_t) 21) #define SNDRV_PCM_FORMAT_IMA_ADPCM ((snd_pcm_format_t) 22) #define SNDRV_PCM_FORMAT_MPEG ((snd_pcm_format_t) 23) #define SNDRV_PCM_FORMAT_GSM ((snd_pcm_format_t) 24) #define SNDRV_PCM_FORMAT_S20_LE ((snd_pcm_format_t) 25) /* in four bytes, LSB justified */ #define SNDRV_PCM_FORMAT_S20_BE ((snd_pcm_format_t) 26) /* in four bytes, LSB justified */ #define SNDRV_PCM_FORMAT_U20_LE ((snd_pcm_format_t) 27) /* in four bytes, LSB justified */ #define SNDRV_PCM_FORMAT_U20_BE ((snd_pcm_format_t) 28) /* in four bytes, LSB justified */ /* gap in the numbering for a future standard linear format */ #define SNDRV_PCM_FORMAT_SPECIAL ((snd_pcm_format_t) 31) #define SNDRV_PCM_FORMAT_S24_3LE ((snd_pcm_format_t) 32) /* in three bytes */ #define SNDRV_PCM_FORMAT_S24_3BE ((snd_pcm_format_t) 33) /* in three bytes */ #define SNDRV_PCM_FORMAT_U24_3LE ((snd_pcm_format_t) 34) /* in three bytes */ #define SNDRV_PCM_FORMAT_U24_3BE ((snd_pcm_format_t) 35) /* in three bytes */ #define SNDRV_PCM_FORMAT_S20_3LE ((snd_pcm_format_t) 36) /* in three bytes */ #define SNDRV_PCM_FORMAT_S20_3BE ((snd_pcm_format_t) 37) /* in three bytes */ #define SNDRV_PCM_FORMAT_U20_3LE ((snd_pcm_format_t) 38) /* in three bytes */ #define SNDRV_PCM_FORMAT_U20_3BE ((snd_pcm_format_t) 39) /* in three bytes */ #define SNDRV_PCM_FORMAT_S18_3LE ((snd_pcm_format_t) 40) /* in three bytes */ #define SNDRV_PCM_FORMAT_S18_3BE ((snd_pcm_format_t) 41) /* in three bytes */ #define SNDRV_PCM_FORMAT_U18_3LE ((snd_pcm_format_t) 42) /* in three bytes */ #define SNDRV_PCM_FORMAT_U18_3BE ((snd_pcm_format_t) 43) /* in three bytes */ #define SNDRV_PCM_FORMAT_G723_24 ((snd_pcm_format_t) 44) /* 8 samples in 3 bytes */ #define SNDRV_PCM_FORMAT_G723_24_1B ((snd_pcm_format_t) 45) /* 1 sample in 1 byte */ #define SNDRV_PCM_FORMAT_G723_40 ((snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */ #define SNDRV_PCM_FORMAT_G723_40_1B ((snd_pcm_format_t) 47) /* 1 sample in 1 byte */ #define SNDRV_PCM_FORMAT_DSD_U8 ((snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */ #define SNDRV_PCM_FORMAT_DSD_U16_LE ((snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */ #define SNDRV_PCM_FORMAT_DSD_U32_LE ((snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */ #define SNDRV_PCM_FORMAT_DSD_U16_BE ((snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */ #define SNDRV_PCM_FORMAT_DSD_U32_BE ((snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */ #define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE #define SNDRV_PCM_FORMAT_FIRST SNDRV_PCM_FORMAT_S8 #ifdef SNDRV_LITTLE_ENDIAN #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE #define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_LE #define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_LE #define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_LE #define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_LE #define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_LE #define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_LE #define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_LE #define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE #define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_LE #define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_LE #endif #ifdef SNDRV_BIG_ENDIAN #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_BE #define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_BE #define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_BE #define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_BE #define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_BE #define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_BE #define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_BE #define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_BE #define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE #define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_BE #define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_BE #endif typedef int __bitwise snd_pcm_subformat_t; #define SNDRV_PCM_SUBFORMAT_STD ((snd_pcm_subformat_t) 0) #define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD #define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */ #define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */ #define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */ #define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */ #define SNDRV_PCM_INFO_SYNC_APPLPTR 0x00000020 /* need the explicit sync of appl_ptr update */ #define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */ #define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */ #define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */ #define SNDRV_PCM_INFO_BLOCK_TRANSFER 0x00010000 /* hardware transfer block of samples */ #define SNDRV_PCM_INFO_OVERRANGE 0x00020000 /* hardware supports ADC (capture) overrange detection */ #define SNDRV_PCM_INFO_RESUME 0x00040000 /* hardware supports stream resume after suspend */ #define SNDRV_PCM_INFO_PAUSE 0x00080000 /* pause ioctl is supported */ #define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */ #define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */ #define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */ #define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000 /* period wakeup can be disabled */ #define SNDRV_PCM_INFO_HAS_WALL_CLOCK 0x01000000 /* (Deprecated)has audio wall clock for audio/system time sync */ #define SNDRV_PCM_INFO_HAS_LINK_ATIME 0x01000000 /* report hardware link audio time, reset on startup */ #define SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME 0x02000000 /* report absolute hardware link audio time, not reset on startup */ #define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME 0x04000000 /* report estimated link audio time */ #define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000 /* report synchronized audio/system time */ #define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */ #define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */ typedef int __bitwise snd_pcm_state_t; #define SNDRV_PCM_STATE_OPEN ((snd_pcm_state_t) 0) /* stream is open */ #define SNDRV_PCM_STATE_SETUP ((snd_pcm_state_t) 1) /* stream has a setup */ #define SNDRV_PCM_STATE_PREPARED ((snd_pcm_state_t) 2) /* stream is ready to start */ #define SNDRV_PCM_STATE_RUNNING ((snd_pcm_state_t) 3) /* stream is running */ #define SNDRV_PCM_STATE_XRUN ((snd_pcm_state_t) 4) /* stream reached an xrun */ #define SNDRV_PCM_STATE_DRAINING ((snd_pcm_state_t) 5) /* stream is draining */ #define SNDRV_PCM_STATE_PAUSED ((snd_pcm_state_t) 6) /* stream is paused */ #define SNDRV_PCM_STATE_SUSPENDED ((snd_pcm_state_t) 7) /* hardware is suspended */ #define SNDRV_PCM_STATE_DISCONNECTED ((snd_pcm_state_t) 8) /* hardware is disconnected */ #define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED enum { SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000, SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000, SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000, }; union snd_pcm_sync_id { unsigned char id[16]; unsigned short id16[8]; unsigned int id32[4]; }; struct snd_pcm_info { unsigned int device; /* RO/WR (control): device number */ unsigned int subdevice; /* RO/WR (control): subdevice number */ int stream; /* RO/WR (control): stream direction */ int card; /* R: card number */ unsigned char id[64]; /* ID (user selectable) */ unsigned char name[80]; /* name of this device */ unsigned char subname[32]; /* subdevice name */ int dev_class; /* SNDRV_PCM_CLASS_* */ int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */ unsigned int subdevices_count; unsigned int subdevices_avail; union snd_pcm_sync_id sync; /* hardware synchronization ID */ unsigned char reserved[64]; /* reserved for future... */ }; typedef int snd_pcm_hw_param_t; #define SNDRV_PCM_HW_PARAM_ACCESS 0 /* Access type */ #define SNDRV_PCM_HW_PARAM_FORMAT 1 /* Format */ #define SNDRV_PCM_HW_PARAM_SUBFORMAT 2 /* Subformat */ #define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS #define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT #define SNDRV_PCM_HW_PARAM_SAMPLE_BITS 8 /* Bits per sample */ #define SNDRV_PCM_HW_PARAM_FRAME_BITS 9 /* Bits per frame */ #define SNDRV_PCM_HW_PARAM_CHANNELS 10 /* Channels */ #define SNDRV_PCM_HW_PARAM_RATE 11 /* Approx rate */ #define SNDRV_PCM_HW_PARAM_PERIOD_TIME 12 /* Approx distance between * interrupts in us */ #define SNDRV_PCM_HW_PARAM_PERIOD_SIZE 13 /* Approx frames between * interrupts */ #define SNDRV_PCM_HW_PARAM_PERIOD_BYTES 14 /* Approx bytes between * interrupts */ #define SNDRV_PCM_HW_PARAM_PERIODS 15 /* Approx interrupts per * buffer */ #define SNDRV_PCM_HW_PARAM_BUFFER_TIME 16 /* Approx duration of buffer * in us */ #define SNDRV_PCM_HW_PARAM_BUFFER_SIZE 17 /* Size of buffer in frames */ #define SNDRV_PCM_HW_PARAM_BUFFER_BYTES 18 /* Size of buffer in bytes */ #define SNDRV_PCM_HW_PARAM_TICK_TIME 19 /* Approx tick duration in us */ #define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS #define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME #define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */ #define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */ #define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */ struct snd_interval { unsigned int min, max; unsigned int openmin:1, openmax:1, integer:1, empty:1; }; #define SNDRV_MASK_MAX 256 struct snd_mask { __u32 bits[(SNDRV_MASK_MAX+31)/32]; }; struct snd_pcm_hw_params { unsigned int flags; struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; struct snd_mask mres[5]; /* reserved masks */ struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; struct snd_interval ires[9]; /* reserved intervals */ unsigned int rmask; /* W: requested masks */ unsigned int cmask; /* R: changed masks */ unsigned int info; /* R: Info flags for returned setup */ unsigned int msbits; /* R: used most significant bits */ unsigned int rate_num; /* R: rate numerator */ unsigned int rate_den; /* R: rate denominator */ snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */ unsigned char reserved[64]; /* reserved for future */ }; enum { SNDRV_PCM_TSTAMP_NONE = 0, SNDRV_PCM_TSTAMP_ENABLE, SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE, }; struct snd_pcm_sw_params { int tstamp_mode; /* timestamp mode */ unsigned int period_step; unsigned int sleep_min; /* min ticks to sleep */ snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */ snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */ snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */ snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */ snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ snd_pcm_uframes_t silence_size; /* silence block size */ snd_pcm_uframes_t boundary; /* pointers wrap point */ unsigned int proto; /* protocol version */ unsigned int tstamp_type; /* timestamp type (req. proto >= 2.0.12) */ unsigned char reserved[56]; /* reserved for future */ }; struct snd_pcm_channel_info { unsigned int channel; __kernel_off_t offset; /* mmap offset */ unsigned int first; /* offset to first sample in bits */ unsigned int step; /* samples distance in bits */ }; enum { /* * first definition for backwards compatibility only, * maps to wallclock/link time for HDAudio playback and DEFAULT/DMA time for everything else */ SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT = 0, /* timestamp definitions */ SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT = 1, /* DMA time, reported as per hw_ptr */ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK = 2, /* link time reported by sample or wallclock counter, reset on startup */ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE = 3, /* link time reported by sample or wallclock counter, not reset on startup */ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED = 4, /* link time estimated indirectly */ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5, /* link time synchronized with system time */ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED }; struct snd_pcm_status { snd_pcm_state_t state; /* stream state */ struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ struct timespec tstamp; /* reference timestamp */ snd_pcm_uframes_t appl_ptr; /* appl ptr */ snd_pcm_uframes_t hw_ptr; /* hw ptr */ snd_pcm_sframes_t delay; /* current delay in frames */ snd_pcm_uframes_t avail; /* number of frames available */ snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */ snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ snd_pcm_state_t suspended_state; /* suspended stream state */ __u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */ struct timespec audio_tstamp; /* sample counter, wall clock, PHC or on-demand sync'ed */ struct timespec driver_tstamp; /* useful in case reference system tstamp is reported with delay */ __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */ unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */ }; struct snd_pcm_mmap_status { snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */ int pad1; /* Needed for 64 bit alignment */ snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ struct timespec tstamp; /* Timestamp */ snd_pcm_state_t suspended_state; /* RO: suspended stream state */ struct timespec audio_tstamp; /* from sample counter or wall clock */ }; struct snd_pcm_mmap_control { snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ }; #define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */ #define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */ #define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */ struct snd_pcm_sync_ptr { unsigned int flags; union { struct snd_pcm_mmap_status status; unsigned char reserved[64]; } s; union { struct snd_pcm_mmap_control control; unsigned char reserved[64]; } c; }; struct snd_xferi { snd_pcm_sframes_t result; void *buf; snd_pcm_uframes_t frames; }; struct snd_xfern { snd_pcm_sframes_t result; void * *bufs; snd_pcm_uframes_t frames; }; enum { SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */ SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */ SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /* monotonic_raw (no NTP) */ SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, }; /* channel positions */ enum { SNDRV_CHMAP_UNKNOWN = 0, SNDRV_CHMAP_NA, /* N/A, silent */ SNDRV_CHMAP_MONO, /* mono stream */ /* this follows the alsa-lib mixer channel value + 3 */ SNDRV_CHMAP_FL, /* front left */ SNDRV_CHMAP_FR, /* front right */ SNDRV_CHMAP_RL, /* rear left */ SNDRV_CHMAP_RR, /* rear right */ SNDRV_CHMAP_FC, /* front center */ SNDRV_CHMAP_LFE, /* LFE */ SNDRV_CHMAP_SL, /* side left */ SNDRV_CHMAP_SR, /* side right */ SNDRV_CHMAP_RC, /* rear center */ /* new definitions */ SNDRV_CHMAP_FLC, /* front left center */ SNDRV_CHMAP_FRC, /* front right center */ SNDRV_CHMAP_RLC, /* rear left center */ SNDRV_CHMAP_RRC, /* rear right center */ SNDRV_CHMAP_FLW, /* front left wide */ SNDRV_CHMAP_FRW, /* front right wide */ SNDRV_CHMAP_FLH, /* front left high */ SNDRV_CHMAP_FCH, /* front center high */ SNDRV_CHMAP_FRH, /* front right high */ SNDRV_CHMAP_TC, /* top center */ SNDRV_CHMAP_TFL, /* top front left */ SNDRV_CHMAP_TFR, /* top front right */ SNDRV_CHMAP_TFC, /* top front center */ SNDRV_CHMAP_TRL, /* top rear left */ SNDRV_CHMAP_TRR, /* top rear right */ SNDRV_CHMAP_TRC, /* top rear center */ /* new definitions for UAC2 */ SNDRV_CHMAP_TFLC, /* top front left center */ SNDRV_CHMAP_TFRC, /* top front right center */ SNDRV_CHMAP_TSL, /* top side left */ SNDRV_CHMAP_TSR, /* top side right */ SNDRV_CHMAP_LLFE, /* left LFE */ SNDRV_CHMAP_RLFE, /* right LFE */ SNDRV_CHMAP_BC, /* bottom center */ SNDRV_CHMAP_BLC, /* bottom left center */ SNDRV_CHMAP_BRC, /* bottom right center */ SNDRV_CHMAP_LAST = SNDRV_CHMAP_BRC, }; #define SNDRV_CHMAP_POSITION_MASK 0xffff #define SNDRV_CHMAP_PHASE_INVERSE (0x01 << 16) #define SNDRV_CHMAP_DRIVER_SPEC (0x02 << 16) #define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int) #define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info) #define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int) #define SNDRV_PCM_IOCTL_TTSTAMP _IOW('A', 0x03, int) #define SNDRV_PCM_IOCTL_USER_PVERSION _IOW('A', 0x04, int) #define SNDRV_PCM_IOCTL_HW_REFINE _IOWR('A', 0x10, struct snd_pcm_hw_params) #define SNDRV_PCM_IOCTL_HW_PARAMS _IOWR('A', 0x11, struct snd_pcm_hw_params) #define SNDRV_PCM_IOCTL_HW_FREE _IO('A', 0x12) #define SNDRV_PCM_IOCTL_SW_PARAMS _IOWR('A', 0x13, struct snd_pcm_sw_params) #define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status) #define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t) #define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22) #define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr) #define SNDRV_PCM_IOCTL_STATUS_EXT _IOWR('A', 0x24, struct snd_pcm_status) #define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info) #define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40) #define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41) #define SNDRV_PCM_IOCTL_START _IO('A', 0x42) #define SNDRV_PCM_IOCTL_DROP _IO('A', 0x43) #define SNDRV_PCM_IOCTL_DRAIN _IO('A', 0x44) #define SNDRV_PCM_IOCTL_PAUSE _IOW('A', 0x45, int) #define SNDRV_PCM_IOCTL_REWIND _IOW('A', 0x46, snd_pcm_uframes_t) #define SNDRV_PCM_IOCTL_RESUME _IO('A', 0x47) #define SNDRV_PCM_IOCTL_XRUN _IO('A', 0x48) #define SNDRV_PCM_IOCTL_FORWARD _IOW('A', 0x49, snd_pcm_uframes_t) #define SNDRV_PCM_IOCTL_WRITEI_FRAMES _IOW('A', 0x50, struct snd_xferi) #define SNDRV_PCM_IOCTL_READI_FRAMES _IOR('A', 0x51, struct snd_xferi) #define SNDRV_PCM_IOCTL_WRITEN_FRAMES _IOW('A', 0x52, struct snd_xfern) #define SNDRV_PCM_IOCTL_READN_FRAMES _IOR('A', 0x53, struct snd_xfern) #define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int) #define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61) /***************************************************************************** * * * MIDI v1.0 interface * * * *****************************************************************************/ /* * Raw MIDI section - /dev/snd/midi?? */ #define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) enum { SNDRV_RAWMIDI_STREAM_OUTPUT = 0, SNDRV_RAWMIDI_STREAM_INPUT, SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT, }; #define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001 #define SNDRV_RAWMIDI_INFO_INPUT 0x00000002 #define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004 struct snd_rawmidi_info { unsigned int device; /* RO/WR (control): device number */ unsigned int subdevice; /* RO/WR (control): subdevice number */ int stream; /* WR: stream */ int card; /* R: card number */ unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */ unsigned char id[64]; /* ID (user selectable) */ unsigned char name[80]; /* name of device */ unsigned char subname[32]; /* name of active or selected subdevice */ unsigned int subdevices_count; unsigned int subdevices_avail; unsigned char reserved[64]; /* reserved for future use */ }; struct snd_rawmidi_params { int stream; size_t buffer_size; /* queue size in bytes */ size_t avail_min; /* minimum avail bytes for wakeup */ unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */ unsigned char reserved[16]; /* reserved for future use */ }; struct snd_rawmidi_status { int stream; struct timespec tstamp; /* Timestamp */ size_t avail; /* available bytes */ size_t xruns; /* count of overruns since last status (in bytes) */ unsigned char reserved[16]; /* reserved for future use */ }; #define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int) #define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info) #define SNDRV_RAWMIDI_IOCTL_PARAMS _IOWR('W', 0x10, struct snd_rawmidi_params) #define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status) #define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int) #define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int) /* * Timer section - /dev/snd/timer */ #define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6) enum { SNDRV_TIMER_CLASS_NONE = -1, SNDRV_TIMER_CLASS_SLAVE = 0, SNDRV_TIMER_CLASS_GLOBAL, SNDRV_TIMER_CLASS_CARD, SNDRV_TIMER_CLASS_PCM, SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM, }; /* slave timer classes */ enum { SNDRV_TIMER_SCLASS_NONE = 0, SNDRV_TIMER_SCLASS_APPLICATION, SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */ SNDRV_TIMER_SCLASS_OSS_SEQUENCER, /* alias */ SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER, }; /* global timers (device member) */ #define SNDRV_TIMER_GLOBAL_SYSTEM 0 #define SNDRV_TIMER_GLOBAL_RTC 1 /* unused */ #define SNDRV_TIMER_GLOBAL_HPET 2 #define SNDRV_TIMER_GLOBAL_HRTIMER 3 /* info flags */ #define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ struct snd_timer_id { int dev_class; int dev_sclass; int card; int device; int subdevice; }; struct snd_timer_ginfo { struct snd_timer_id tid; /* requested timer ID */ unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ int card; /* card number */ unsigned char id[64]; /* timer identification */ unsigned char name[80]; /* timer name */ unsigned long reserved0; /* reserved for future use */ unsigned long resolution; /* average period resolution in ns */ unsigned long resolution_min; /* minimal period resolution in ns */ unsigned long resolution_max; /* maximal period resolution in ns */ unsigned int clients; /* active timer clients */ unsigned char reserved[32]; }; struct snd_timer_gparams { struct snd_timer_id tid; /* requested timer ID */ unsigned long period_num; /* requested precise period duration (in seconds) - numerator */ unsigned long period_den; /* requested precise period duration (in seconds) - denominator */ unsigned char reserved[32]; }; struct snd_timer_gstatus { struct snd_timer_id tid; /* requested timer ID */ unsigned long resolution; /* current period resolution in ns */ unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */ unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */ unsigned char reserved[32]; }; struct snd_timer_select { struct snd_timer_id id; /* bind to timer ID */ unsigned char reserved[32]; /* reserved */ }; struct snd_timer_info { unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ int card; /* card number */ unsigned char id[64]; /* timer identificator */ unsigned char name[80]; /* timer name */ unsigned long reserved0; /* reserved for future use */ unsigned long resolution; /* average period resolution in ns */ unsigned char reserved[64]; /* reserved */ }; #define SNDRV_TIMER_PSFLG_AUTO (1<<0) /* auto start, otherwise one-shot */ #define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */ #define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */ struct snd_timer_params { unsigned int flags; /* flags - SNDRV_MIXER_PSFLG_* */ unsigned int ticks; /* requested resolution in ticks */ unsigned int queue_size; /* total size of queue (32-1024) */ unsigned int reserved0; /* reserved, was: failure locations */ unsigned int filter; /* event filter (bitmask of SNDRV_TIMER_EVENT_*) */ unsigned char reserved[60]; /* reserved */ }; struct snd_timer_status { struct timespec tstamp; /* Timestamp - last update */ unsigned int resolution; /* current period resolution in ns */ unsigned int lost; /* counter of master tick lost */ unsigned int overrun; /* count of read queue overruns */ unsigned int queue; /* used queue size */ unsigned char reserved[64]; /* reserved */ }; #define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int) #define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id) #define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int) #define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo) #define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams) #define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus) #define SNDRV_TIMER_IOCTL_SELECT _IOW('T', 0x10, struct snd_timer_select) #define SNDRV_TIMER_IOCTL_INFO _IOR('T', 0x11, struct snd_timer_info) #define SNDRV_TIMER_IOCTL_PARAMS _IOW('T', 0x12, struct snd_timer_params) #define SNDRV_TIMER_IOCTL_STATUS _IOR('T', 0x14, struct snd_timer_status) /* The following four ioctls are changed since 1.0.9 due to confliction */ #define SNDRV_TIMER_IOCTL_START _IO('T', 0xa0) #define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1) #define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2) #define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3) struct snd_timer_read { unsigned int resolution; unsigned int ticks; }; enum { SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */ SNDRV_TIMER_EVENT_TICK, /* val = ticks */ SNDRV_TIMER_EVENT_START, /* val = resolution in ns */ SNDRV_TIMER_EVENT_STOP, /* val = 0 */ SNDRV_TIMER_EVENT_CONTINUE, /* val = resolution in ns */ SNDRV_TIMER_EVENT_PAUSE, /* val = 0 */ SNDRV_TIMER_EVENT_EARLY, /* val = 0, early event */ SNDRV_TIMER_EVENT_SUSPEND, /* val = 0 */ SNDRV_TIMER_EVENT_RESUME, /* val = resolution in ns */ /* master timer events for slave timer instances */ SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10, SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10, SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10, SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10, SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10, SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10, }; struct snd_timer_tread { int event; struct timespec tstamp; unsigned int val; }; /**************************************************************************** * * * Section for driver control interface - /dev/snd/control? * * * ****************************************************************************/ #define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) struct snd_ctl_card_info { int card; /* card number */ int pad; /* reserved for future (was type) */ unsigned char id[16]; /* ID of card (user selectable) */ unsigned char driver[16]; /* Driver name */ unsigned char name[32]; /* Short name of soundcard */ unsigned char longname[80]; /* name + info text about soundcard */ unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */ unsigned char mixername[80]; /* visual mixer identification */ unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */ }; typedef int __bitwise snd_ctl_elem_type_t; #define SNDRV_CTL_ELEM_TYPE_NONE ((snd_ctl_elem_type_t) 0) /* invalid */ #define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((snd_ctl_elem_type_t) 1) /* boolean type */ #define SNDRV_CTL_ELEM_TYPE_INTEGER ((snd_ctl_elem_type_t) 2) /* integer type */ #define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((snd_ctl_elem_type_t) 3) /* enumerated type */ #define SNDRV_CTL_ELEM_TYPE_BYTES ((snd_ctl_elem_type_t) 4) /* byte array */ #define SNDRV_CTL_ELEM_TYPE_IEC958 ((snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */ #define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((snd_ctl_elem_type_t) 6) /* 64-bit integer type */ #define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64 typedef int __bitwise snd_ctl_elem_iface_t; #define SNDRV_CTL_ELEM_IFACE_CARD ((snd_ctl_elem_iface_t) 0) /* global control */ #define SNDRV_CTL_ELEM_IFACE_HWDEP ((snd_ctl_elem_iface_t) 1) /* hardware dependent device */ #define SNDRV_CTL_ELEM_IFACE_MIXER ((snd_ctl_elem_iface_t) 2) /* virtual mixer device */ #define SNDRV_CTL_ELEM_IFACE_PCM ((snd_ctl_elem_iface_t) 3) /* PCM device */ #define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((snd_ctl_elem_iface_t) 4) /* RawMidi device */ #define SNDRV_CTL_ELEM_IFACE_TIMER ((snd_ctl_elem_iface_t) 5) /* timer device */ #define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((snd_ctl_elem_iface_t) 6) /* sequencer client */ #define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER #define SNDRV_CTL_ELEM_ACCESS_READ (1<<0) #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) #define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ #define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */ #define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ #define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ #define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) #define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6) /* TLV command is possible */ #define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */ #define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */ #define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */ #define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */ #define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ /* bits 30 and 31 are obsoleted (for indirect access) */ /* for further details see the ACPI and PCI power management specification */ #define SNDRV_CTL_POWER_D0 0x0000 /* full On */ #define SNDRV_CTL_POWER_D1 0x0100 /* partial On */ #define SNDRV_CTL_POWER_D2 0x0200 /* partial On */ #define SNDRV_CTL_POWER_D3 0x0300 /* Off */ #define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */ #define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */ #define SNDRV_CTL_ELEM_ID_NAME_MAXLEN 44 struct snd_ctl_elem_id { unsigned int numid; /* numeric identifier, zero = invalid */ snd_ctl_elem_iface_t iface; /* interface identifier */ unsigned int device; /* device/client number */ unsigned int subdevice; /* subdevice (substream) number */ unsigned char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* ASCII name of item */ unsigned int index; /* index of item */ }; struct snd_ctl_elem_list { unsigned int offset; /* W: first element ID to get */ unsigned int space; /* W: count of element IDs to get */ unsigned int used; /* R: count of element IDs set */ unsigned int count; /* R: count of all elements */ struct snd_ctl_elem_id *pids; /* R: IDs */ unsigned char reserved[50]; }; struct snd_ctl_elem_info { struct snd_ctl_elem_id id; /* W: element ID */ snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */ unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */ unsigned int count; /* count of values */ __kernel_pid_t owner; /* owner's PID of this control */ union { struct { long min; /* R: minimum value */ long max; /* R: maximum value */ long step; /* R: step (0 variable) */ } integer; struct { long long min; /* R: minimum value */ long long max; /* R: maximum value */ long long step; /* R: step (0 variable) */ } integer64; struct { unsigned int items; /* R: number of items */ unsigned int item; /* W: item number */ char name[64]; /* R: value name */ __u64 names_ptr; /* W: names list (ELEM_ADD only) */ unsigned int names_length; } enumerated; unsigned char reserved[128]; } value; union { unsigned short d[4]; /* dimensions */ unsigned short *d_ptr; /* indirect - obsoleted */ } dimen; unsigned char reserved[64-4*sizeof(unsigned short)]; }; struct snd_ctl_elem_value { struct snd_ctl_elem_id id; /* W: element ID */ unsigned int indirect: 1; /* W: indirect access - obsoleted */ union { union { long value[128]; long *value_ptr; /* obsoleted */ } integer; union { long long value[64]; long long *value_ptr; /* obsoleted */ } integer64; union { unsigned int item[128]; unsigned int *item_ptr; /* obsoleted */ } enumerated; union { unsigned char data[512]; unsigned char *data_ptr; /* obsoleted */ } bytes; struct snd_aes_iec958 iec958; } value; /* RO */ struct timespec tstamp; unsigned char reserved[128-sizeof(struct timespec)]; }; struct snd_ctl_tlv { unsigned int numid; /* control element numeric identification */ unsigned int length; /* in bytes aligned to 4 */ unsigned int tlv[0]; /* first TLV */ }; #define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int) #define SNDRV_CTL_IOCTL_CARD_INFO _IOR('U', 0x01, struct snd_ctl_card_info) #define SNDRV_CTL_IOCTL_ELEM_LIST _IOWR('U', 0x10, struct snd_ctl_elem_list) #define SNDRV_CTL_IOCTL_ELEM_INFO _IOWR('U', 0x11, struct snd_ctl_elem_info) #define SNDRV_CTL_IOCTL_ELEM_READ _IOWR('U', 0x12, struct snd_ctl_elem_value) #define SNDRV_CTL_IOCTL_ELEM_WRITE _IOWR('U', 0x13, struct snd_ctl_elem_value) #define SNDRV_CTL_IOCTL_ELEM_LOCK _IOW('U', 0x14, struct snd_ctl_elem_id) #define SNDRV_CTL_IOCTL_ELEM_UNLOCK _IOW('U', 0x15, struct snd_ctl_elem_id) #define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int) #define SNDRV_CTL_IOCTL_ELEM_ADD _IOWR('U', 0x17, struct snd_ctl_elem_info) #define SNDRV_CTL_IOCTL_ELEM_REPLACE _IOWR('U', 0x18, struct snd_ctl_elem_info) #define SNDRV_CTL_IOCTL_ELEM_REMOVE _IOWR('U', 0x19, struct snd_ctl_elem_id) #define SNDRV_CTL_IOCTL_TLV_READ _IOWR('U', 0x1a, struct snd_ctl_tlv) #define SNDRV_CTL_IOCTL_TLV_WRITE _IOWR('U', 0x1b, struct snd_ctl_tlv) #define SNDRV_CTL_IOCTL_TLV_COMMAND _IOWR('U', 0x1c, struct snd_ctl_tlv) #define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int) #define SNDRV_CTL_IOCTL_HWDEP_INFO _IOR('U', 0x21, struct snd_hwdep_info) #define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE _IOR('U', 0x30, int) #define SNDRV_CTL_IOCTL_PCM_INFO _IOWR('U', 0x31, struct snd_pcm_info) #define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int) #define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int) #define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info) #define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int) #define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int) #define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int) /* * Read interface. */ enum sndrv_ctl_event_type { SNDRV_CTL_EVENT_ELEM = 0, SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM, }; #define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */ #define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */ #define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */ #define SNDRV_CTL_EVENT_MASK_TLV (1<<3) /* element TLV tree was changed */ #define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */ struct snd_ctl_event { int type; /* event type - SNDRV_CTL_EVENT_* */ union { struct { unsigned int mask; struct snd_ctl_elem_id id; } elem; unsigned char data8[60]; } data; }; /* * Control names */ #define SNDRV_CTL_NAME_NONE "" #define SNDRV_CTL_NAME_PLAYBACK "Playback " #define SNDRV_CTL_NAME_CAPTURE "Capture " #define SNDRV_CTL_NAME_IEC958_NONE "" #define SNDRV_CTL_NAME_IEC958_SWITCH "Switch" #define SNDRV_CTL_NAME_IEC958_VOLUME "Volume" #define SNDRV_CTL_NAME_IEC958_DEFAULT "Default" #define SNDRV_CTL_NAME_IEC958_MASK "Mask" #define SNDRV_CTL_NAME_IEC958_CON_MASK "Con Mask" #define SNDRV_CTL_NAME_IEC958_PRO_MASK "Pro Mask" #define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream" #define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what #endif /* __SOUND_ASOUND_H */ ����������������������������������������������sound/sb16_csp.h������������������������������������������������������������������������������������0000644�����������������00000010320�14763166026�0007474 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si> * Takashi Iwai <tiwai@suse.de> * * SB16ASP/AWE32 CSP control * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SOUND_SB16_CSP_H #define __SOUND_SB16_CSP_H /* CSP modes */ #define SNDRV_SB_CSP_MODE_NONE 0x00 #define SNDRV_SB_CSP_MODE_DSP_READ 0x01 /* Record from DSP */ #define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02 /* Play to DSP */ #define SNDRV_SB_CSP_MODE_QSOUND 0x04 /* QSound */ /* CSP load flags */ #define SNDRV_SB_CSP_LOAD_FROMUSER 0x01 #define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02 /* CSP sample width */ #define SNDRV_SB_CSP_SAMPLE_8BIT 0x01 #define SNDRV_SB_CSP_SAMPLE_16BIT 0x02 /* CSP channels */ #define SNDRV_SB_CSP_MONO 0x01 #define SNDRV_SB_CSP_STEREO 0x02 /* CSP rates */ #define SNDRV_SB_CSP_RATE_8000 0x01 #define SNDRV_SB_CSP_RATE_11025 0x02 #define SNDRV_SB_CSP_RATE_22050 0x04 #define SNDRV_SB_CSP_RATE_44100 0x08 #define SNDRV_SB_CSP_RATE_ALL 0x0f /* CSP running state */ #define SNDRV_SB_CSP_ST_IDLE 0x00 #define SNDRV_SB_CSP_ST_LOADED 0x01 #define SNDRV_SB_CSP_ST_RUNNING 0x02 #define SNDRV_SB_CSP_ST_PAUSED 0x04 #define SNDRV_SB_CSP_ST_AUTO 0x08 #define SNDRV_SB_CSP_ST_QSOUND 0x10 /* maximum QSound value (180 degrees right) */ #define SNDRV_SB_CSP_QSOUND_MAX_RIGHT 0x20 /* maximum microcode RIFF file size */ #define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000 /* microcode header */ struct snd_sb_csp_mc_header { char codec_name[16]; /* id name of codec */ unsigned short func_req; /* requested function */ }; /* microcode to be loaded */ struct snd_sb_csp_microcode { struct snd_sb_csp_mc_header info; unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE]; }; /* start CSP with sample_width in mono/stereo */ struct snd_sb_csp_start { int sample_width; /* sample width, look above */ int channels; /* channels, look above */ }; /* CSP information */ struct snd_sb_csp_info { char codec_name[16]; /* id name of codec */ unsigned short func_nr; /* function number */ unsigned int acc_format; /* accepted PCM formats */ unsigned short acc_channels; /* accepted channels */ unsigned short acc_width; /* accepted sample width */ unsigned short acc_rates; /* accepted sample rates */ unsigned short csp_mode; /* CSP mode, see above */ unsigned short run_channels; /* current channels */ unsigned short run_width; /* current sample width */ unsigned short version; /* version id: 0x10 - 0x1f */ unsigned short state; /* state bits */ }; /* HWDEP controls */ /* get CSP information */ #define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info) /* load microcode to CSP */ /* NOTE: struct snd_sb_csp_microcode overflows the max size (13 bits) * defined for some architectures like MIPS, and it leads to build errors. * (x86 and co have 14-bit size, thus it's valid, though.) * As a workaround for skipping the size-limit check, here we don't use the * normal _IOW() macro but _IOC() with the manual argument. */ #define SNDRV_SB_CSP_IOCTL_LOAD_CODE \ _IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode)) /* unload microcode from CSP */ #define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12) /* start CSP */ #define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start) /* stop CSP */ #define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14) /* pause CSP and DMA transfer */ #define SNDRV_SB_CSP_IOCTL_PAUSE _IO('H', 0x15) /* restart CSP and DMA transfer */ #define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16) #endif /* __SOUND_SB16_CSP_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sound/asoc.h����������������������������������������������������������������������������������������0000644�����������������00000053316�14763166026�0007015 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * uapi/sound/asoc.h -- ALSA SoC Firmware Controls and DAPM * * Copyright (C) 2012 Texas Instruments Inc. * Copyright (C) 2015 Intel Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * Simple file API to load FW that includes mixers, coefficients, DAPM graphs, * algorithms, equalisers, DAIs, widgets etc. */ #ifndef __LINUX_UAPI_SND_ASOC_H #define __LINUX_UAPI_SND_ASOC_H #include <linux/types.h> #include <sound/asound.h> /* * Maximum number of channels topology kcontrol can represent. */ #define SND_SOC_TPLG_MAX_CHAN 8 /* * Maximum number of PCM formats capability */ #define SND_SOC_TPLG_MAX_FORMATS 16 /* * Maximum number of PCM stream configs */ #define SND_SOC_TPLG_STREAM_CONFIG_MAX 8 /* * Maximum number of physical link's hardware configs */ #define SND_SOC_TPLG_HW_CONFIG_MAX 8 /* individual kcontrol info types - can be mixed with other types */ #define SND_SOC_TPLG_CTL_VOLSW 1 #define SND_SOC_TPLG_CTL_VOLSW_SX 2 #define SND_SOC_TPLG_CTL_VOLSW_XR_SX 3 #define SND_SOC_TPLG_CTL_ENUM 4 #define SND_SOC_TPLG_CTL_BYTES 5 #define SND_SOC_TPLG_CTL_ENUM_VALUE 6 #define SND_SOC_TPLG_CTL_RANGE 7 #define SND_SOC_TPLG_CTL_STROBE 8 /* individual widget kcontrol info types - can be mixed with other types */ #define SND_SOC_TPLG_DAPM_CTL_VOLSW 64 #define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE 65 #define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT 66 #define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE 67 #define SND_SOC_TPLG_DAPM_CTL_PIN 68 /* DAPM widget types - add new items to the end */ #define SND_SOC_TPLG_DAPM_INPUT 0 #define SND_SOC_TPLG_DAPM_OUTPUT 1 #define SND_SOC_TPLG_DAPM_MUX 2 #define SND_SOC_TPLG_DAPM_MIXER 3 #define SND_SOC_TPLG_DAPM_PGA 4 #define SND_SOC_TPLG_DAPM_OUT_DRV 5 #define SND_SOC_TPLG_DAPM_ADC 6 #define SND_SOC_TPLG_DAPM_DAC 7 #define SND_SOC_TPLG_DAPM_SWITCH 8 #define SND_SOC_TPLG_DAPM_PRE 9 #define SND_SOC_TPLG_DAPM_POST 10 #define SND_SOC_TPLG_DAPM_AIF_IN 11 #define SND_SOC_TPLG_DAPM_AIF_OUT 12 #define SND_SOC_TPLG_DAPM_DAI_IN 13 #define SND_SOC_TPLG_DAPM_DAI_OUT 14 #define SND_SOC_TPLG_DAPM_DAI_LINK 15 #define SND_SOC_TPLG_DAPM_BUFFER 16 #define SND_SOC_TPLG_DAPM_SCHEDULER 17 #define SND_SOC_TPLG_DAPM_EFFECT 18 #define SND_SOC_TPLG_DAPM_SIGGEN 19 #define SND_SOC_TPLG_DAPM_SRC 20 #define SND_SOC_TPLG_DAPM_ASRC 21 #define SND_SOC_TPLG_DAPM_ENCODER 22 #define SND_SOC_TPLG_DAPM_DECODER 23 #define SND_SOC_TPLG_DAPM_LAST SND_SOC_TPLG_DAPM_DECODER /* Header magic number and string sizes */ #define SND_SOC_TPLG_MAGIC 0x41536F43 /* ASoC */ /* string sizes */ #define SND_SOC_TPLG_NUM_TEXTS 16 /* ABI version */ #define SND_SOC_TPLG_ABI_VERSION 0x5 /* current version */ #define SND_SOC_TPLG_ABI_VERSION_MIN 0x4 /* oldest version supported */ /* Max size of TLV data */ #define SND_SOC_TPLG_TLV_SIZE 32 /* * File and Block header data types. * Add new generic and vendor types to end of list. * Generic types are handled by the core whilst vendors types are passed * to the component drivers for handling. */ #define SND_SOC_TPLG_TYPE_MIXER 1 #define SND_SOC_TPLG_TYPE_BYTES 2 #define SND_SOC_TPLG_TYPE_ENUM 3 #define SND_SOC_TPLG_TYPE_DAPM_GRAPH 4 #define SND_SOC_TPLG_TYPE_DAPM_WIDGET 5 #define SND_SOC_TPLG_TYPE_DAI_LINK 6 #define SND_SOC_TPLG_TYPE_PCM 7 #define SND_SOC_TPLG_TYPE_MANIFEST 8 #define SND_SOC_TPLG_TYPE_CODEC_LINK 9 #define SND_SOC_TPLG_TYPE_BACKEND_LINK 10 #define SND_SOC_TPLG_TYPE_PDATA 11 #define SND_SOC_TPLG_TYPE_DAI 12 #define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_DAI /* vendor block IDs - please add new vendor types to end */ #define SND_SOC_TPLG_TYPE_VENDOR_FW 1000 #define SND_SOC_TPLG_TYPE_VENDOR_CONFIG 1001 #define SND_SOC_TPLG_TYPE_VENDOR_COEFF 1002 #define SND_SOC_TPLG_TYPEVENDOR_CODEC 1003 #define SND_SOC_TPLG_STREAM_PLAYBACK 0 #define SND_SOC_TPLG_STREAM_CAPTURE 1 /* vendor tuple types */ #define SND_SOC_TPLG_TUPLE_TYPE_UUID 0 #define SND_SOC_TPLG_TUPLE_TYPE_STRING 1 #define SND_SOC_TPLG_TUPLE_TYPE_BOOL 2 #define SND_SOC_TPLG_TUPLE_TYPE_BYTE 3 #define SND_SOC_TPLG_TUPLE_TYPE_WORD 4 #define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5 /* DAI flags */ #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES (1 << 0) #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1) #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) /* DAI clock gating */ #define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED 0 #define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1 #define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2 /* DAI mclk_direction */ #define SND_SOC_TPLG_MCLK_CO 0 /* for codec, mclk is output */ #define SND_SOC_TPLG_MCLK_CI 1 /* for codec, mclk is input */ /* DAI physical PCM data formats. * Add new formats to the end of the list. */ #define SND_SOC_DAI_FORMAT_I2S 1 /* I2S mode */ #define SND_SOC_DAI_FORMAT_RIGHT_J 2 /* Right Justified mode */ #define SND_SOC_DAI_FORMAT_LEFT_J 3 /* Left Justified mode */ #define SND_SOC_DAI_FORMAT_DSP_A 4 /* L data MSB after FRM LRC */ #define SND_SOC_DAI_FORMAT_DSP_B 5 /* L data MSB during FRM LRC */ #define SND_SOC_DAI_FORMAT_AC97 6 /* AC97 */ #define SND_SOC_DAI_FORMAT_PDM 7 /* Pulse density modulation */ /* left and right justified also known as MSB and LSB respectively */ #define SND_SOC_DAI_FORMAT_MSB SND_SOC_DAI_FORMAT_LEFT_J #define SND_SOC_DAI_FORMAT_LSB SND_SOC_DAI_FORMAT_RIGHT_J /* DAI link flags */ #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES (1 << 0) #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS (1 << 1) #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) #define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3) /* DAI topology BCLK parameter * For the backwards capability, by default codec is bclk master */ #define SND_SOC_TPLG_BCLK_CM 0 /* codec is bclk master */ #define SND_SOC_TPLG_BCLK_CS 1 /* codec is bclk slave */ /* DAI topology FSYNC parameter * For the backwards capability, by default codec is fsync master */ #define SND_SOC_TPLG_FSYNC_CM 0 /* codec is fsync master */ #define SND_SOC_TPLG_FSYNC_CS 1 /* codec is fsync slave */ /* * Block Header. * This header precedes all object and object arrays below. */ struct snd_soc_tplg_hdr { __le32 magic; /* magic number */ __le32 abi; /* ABI version */ __le32 version; /* optional vendor specific version details */ __le32 type; /* SND_SOC_TPLG_TYPE_ */ __le32 size; /* size of this structure */ __le32 vendor_type; /* optional vendor specific type info */ __le32 payload_size; /* data bytes, excluding this header */ __le32 index; /* identifier for block */ __le32 count; /* number of elements in block */ } __attribute__((packed)); /* vendor tuple for uuid */ struct snd_soc_tplg_vendor_uuid_elem { __le32 token; char uuid[16]; } __attribute__((packed)); /* vendor tuple for a bool/byte/short/word value */ struct snd_soc_tplg_vendor_value_elem { __le32 token; __le32 value; } __attribute__((packed)); /* vendor tuple for string */ struct snd_soc_tplg_vendor_string_elem { __le32 token; char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; } __attribute__((packed)); struct snd_soc_tplg_vendor_array { __le32 size; /* size in bytes of the array, including all elements */ __le32 type; /* SND_SOC_TPLG_TUPLE_TYPE_ */ __le32 num_elems; /* number of elements in array */ union { struct snd_soc_tplg_vendor_uuid_elem uuid[0]; struct snd_soc_tplg_vendor_value_elem value[0]; struct snd_soc_tplg_vendor_string_elem string[0]; }; } __attribute__((packed)); /* * Private data. * All topology objects may have private data that can be used by the driver or * firmware. Core will ignore this data. */ struct snd_soc_tplg_private { __le32 size; /* in bytes of private data */ union { char data[0]; struct snd_soc_tplg_vendor_array array[0]; }; } __attribute__((packed)); /* * Kcontrol TLV data. */ struct snd_soc_tplg_tlv_dbscale { __le32 min; __le32 step; __le32 mute; } __attribute__((packed)); struct snd_soc_tplg_ctl_tlv { __le32 size; /* in bytes of this structure */ __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */ union { __le32 data[SND_SOC_TPLG_TLV_SIZE]; struct snd_soc_tplg_tlv_dbscale scale; }; } __attribute__((packed)); /* * Kcontrol channel data */ struct snd_soc_tplg_channel { __le32 size; /* in bytes of this structure */ __le32 reg; __le32 shift; __le32 id; /* ID maps to Left, Right, LFE etc */ } __attribute__((packed)); /* * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops * Kcontrol ops need get/put/info. * Bytes ext ops need get/put. */ struct snd_soc_tplg_io_ops { __le32 get; __le32 put; __le32 info; } __attribute__((packed)); /* * kcontrol header */ struct snd_soc_tplg_ctl_hdr { __le32 size; /* in bytes of this structure */ __le32 type; char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; __le32 access; struct snd_soc_tplg_io_ops ops; struct snd_soc_tplg_ctl_tlv tlv; } __attribute__((packed)); /* * Stream Capabilities */ struct snd_soc_tplg_stream_caps { __le32 size; /* in bytes of this structure */ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */ __le32 rates; /* supported rates SNDRV_PCM_RATE_* */ __le32 rate_min; /* min rate */ __le32 rate_max; /* max rate */ __le32 channels_min; /* min channels */ __le32 channels_max; /* max channels */ __le32 periods_min; /* min number of periods */ __le32 periods_max; /* max number of periods */ __le32 period_size_min; /* min period size bytes */ __le32 period_size_max; /* max period size bytes */ __le32 buffer_size_min; /* min buffer size bytes */ __le32 buffer_size_max; /* max buffer size bytes */ __le32 sig_bits; /* number of bits of content */ } __attribute__((packed)); /* * FE or BE Stream configuration supported by SW/FW */ struct snd_soc_tplg_stream { __le32 size; /* in bytes of this structure */ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */ __le64 format; /* SNDRV_PCM_FMTBIT_* */ __le32 rate; /* SNDRV_PCM_RATE_* */ __le32 period_bytes; /* size of period in bytes */ __le32 buffer_bytes; /* size of buffer in bytes */ __le32 channels; /* channels */ } __attribute__((packed)); /* * Describes a physical link's runtime supported hardware config, * i.e. hardware audio formats. */ struct snd_soc_tplg_hw_config { __le32 size; /* in bytes of this structure */ __le32 id; /* unique ID - - used to match */ __le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */ __u8 clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */ __u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */ __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */ __u8 bclk_master; /* SND_SOC_TPLG_BCLK_ value */ __u8 fsync_master; /* SND_SOC_TPLG_FSYNC_ value */ __u8 mclk_direction; /* SND_SOC_TPLG_MCLK_ value */ __le16 reserved; /* for 32bit alignment */ __le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */ __le32 bclk_rate; /* BCLK freqency in Hz */ __le32 fsync_rate; /* frame clock in Hz */ __le32 tdm_slots; /* number of TDM slots in use */ __le32 tdm_slot_width; /* width in bits for each slot */ __le32 tx_slots; /* bit mask for active Tx slots */ __le32 rx_slots; /* bit mask for active Rx slots */ __le32 tx_channels; /* number of Tx channels */ __le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */ __le32 rx_channels; /* number of Rx channels */ __le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */ } __attribute__((packed)); /* * Manifest. List totals for each payload type. Not used in parsing, but will * be passed to the component driver before any other objects in order for any * global component resource allocations. * * File block representation for manifest :- * +-----------------------------------+----+ * | struct snd_soc_tplg_hdr | 1 | * +-----------------------------------+----+ * | struct snd_soc_tplg_manifest | 1 | * +-----------------------------------+----+ */ struct snd_soc_tplg_manifest { __le32 size; /* in bytes of this structure */ __le32 control_elems; /* number of control elements */ __le32 widget_elems; /* number of widget elements */ __le32 graph_elems; /* number of graph elements */ __le32 pcm_elems; /* number of PCM elements */ __le32 dai_link_elems; /* number of DAI link elements */ __le32 dai_elems; /* number of physical DAI elements */ __le32 reserved[20]; /* reserved for new ABI element types */ struct snd_soc_tplg_private priv; } __attribute__((packed)); /* * Mixer kcontrol. * * File block representation for mixer kcontrol :- * +-----------------------------------+----+ * | struct snd_soc_tplg_hdr | 1 | * +-----------------------------------+----+ * | struct snd_soc_tplg_mixer_control | N | * +-----------------------------------+----+ */ struct snd_soc_tplg_mixer_control { struct snd_soc_tplg_ctl_hdr hdr; __le32 size; /* in bytes of this structure */ __le32 min; __le32 max; __le32 platform_max; __le32 invert; __le32 num_channels; struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; struct snd_soc_tplg_private priv; } __attribute__((packed)); /* * Enumerated kcontrol * * File block representation for enum kcontrol :- * +-----------------------------------+----+ * | struct snd_soc_tplg_hdr | 1 | * +-----------------------------------+----+ * | struct snd_soc_tplg_enum_control | N | * +-----------------------------------+----+ */ struct snd_soc_tplg_enum_control { struct snd_soc_tplg_ctl_hdr hdr; __le32 size; /* in bytes of this structure */ __le32 num_channels; struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; __le32 items; __le32 mask; __le32 count; char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; __le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4]; struct snd_soc_tplg_private priv; } __attribute__((packed)); /* * Bytes kcontrol * * File block representation for bytes kcontrol :- * +-----------------------------------+----+ * | struct snd_soc_tplg_hdr | 1 | * +-----------------------------------+----+ * | struct snd_soc_tplg_bytes_control | N | * +-----------------------------------+----+ */ struct snd_soc_tplg_bytes_control { struct snd_soc_tplg_ctl_hdr hdr; __le32 size; /* in bytes of this structure */ __le32 max; __le32 mask; __le32 base; __le32 num_regs; struct snd_soc_tplg_io_ops ext_ops; struct snd_soc_tplg_private priv; } __attribute__((packed)); /* * DAPM Graph Element * * File block representation for DAPM graph elements :- * +-------------------------------------+----+ * | struct snd_soc_tplg_hdr | 1 | * +-------------------------------------+----+ * | struct snd_soc_tplg_dapm_graph_elem | N | * +-------------------------------------+----+ */ struct snd_soc_tplg_dapm_graph_elem { char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; } __attribute__((packed)); /* * DAPM Widget. * * File block representation for DAPM widget :- * +-------------------------------------+-----+ * | struct snd_soc_tplg_hdr | 1 | * +-------------------------------------+-----+ * | struct snd_soc_tplg_dapm_widget | N | * +-------------------------------------+-----+ * | struct snd_soc_tplg_enum_control | 0|1 | * | struct snd_soc_tplg_mixer_control | 0|N | * +-------------------------------------+-----+ * * Optional enum or mixer control can be appended to the end of each widget * in the block. */ struct snd_soc_tplg_dapm_widget { __le32 size; /* in bytes of this structure */ __le32 id; /* SND_SOC_DAPM_CTL */ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; __le32 reg; /* negative reg = no direct dapm */ __le32 shift; /* bits to shift */ __le32 mask; /* non-shifted mask */ __le32 subseq; /* sort within widget type */ __le32 invert; /* invert the power bit */ __le32 ignore_suspend; /* kept enabled over suspend */ __le16 event_flags; __le16 event_type; __le32 num_kcontrols; struct snd_soc_tplg_private priv; /* * kcontrols that relate to this widget * follow here after widget private data */ } __attribute__((packed)); /* * Describes SW/FW specific features of PCM (FE DAI & DAI link). * * File block representation for PCM :- * +-----------------------------------+-----+ * | struct snd_soc_tplg_hdr | 1 | * +-----------------------------------+-----+ * | struct snd_soc_tplg_pcm | N | * +-----------------------------------+-----+ */ struct snd_soc_tplg_pcm { __le32 size; /* in bytes of this structure */ char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; __le32 pcm_id; /* unique ID - used to match with DAI link */ __le32 dai_id; /* unique ID - used to match */ __le32 playback; /* supports playback mode */ __le32 capture; /* supports capture mode */ __le32 compress; /* 1 = compressed; 0 = PCM */ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */ __le32 num_streams; /* number of streams */ struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ __le32 flag_mask; /* bitmask of flags to configure */ __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ struct snd_soc_tplg_private priv; } __attribute__((packed)); /* * Describes the physical link runtime supported configs or params * * File block representation for physical link config :- * +-----------------------------------+-----+ * | struct snd_soc_tplg_hdr | 1 | * +-----------------------------------+-----+ * | struct snd_soc_tplg_link_config | N | * +-----------------------------------+-----+ */ struct snd_soc_tplg_link_config { __le32 size; /* in bytes of this structure */ __le32 id; /* unique ID - used to match */ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */ char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* stream name - used to match */ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */ __le32 num_streams; /* number of streams */ struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX]; /* hw configs */ __le32 num_hw_configs; /* number of hw configs */ __le32 default_hw_config_id; /* default hw config ID for init */ __le32 flag_mask; /* bitmask of flags to configure */ __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ struct snd_soc_tplg_private priv; } __attribute__((packed)); /* * Describes SW/FW specific features of physical DAI. * It can be used to configure backend DAIs for DPCM. * * File block representation for physical DAI :- * +-----------------------------------+-----+ * | struct snd_soc_tplg_hdr | 1 | * +-----------------------------------+-----+ * | struct snd_soc_tplg_dai | N | * +-----------------------------------+-----+ */ struct snd_soc_tplg_dai { __le32 size; /* in bytes of this structure */ char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */ __le32 dai_id; /* unique ID - used to match */ __le32 playback; /* supports playback mode */ __le32 capture; /* supports capture mode */ struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ __le32 flag_mask; /* bitmask of flags to configure */ __le32 flags; /* SND_SOC_TPLG_DAI_FLGBIT_* */ struct snd_soc_tplg_private priv; } __attribute__((packed)); /* * Old version of ABI structs, supported for backward compatibility. */ /* Manifest v4 */ struct snd_soc_tplg_manifest_v4 { __le32 size; /* in bytes of this structure */ __le32 control_elems; /* number of control elements */ __le32 widget_elems; /* number of widget elements */ __le32 graph_elems; /* number of graph elements */ __le32 pcm_elems; /* number of PCM elements */ __le32 dai_link_elems; /* number of DAI link elements */ struct snd_soc_tplg_private priv; } __attribute__((packed)); /* Stream Capabilities v4 */ struct snd_soc_tplg_stream_caps_v4 { __le32 size; /* in bytes of this structure */ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */ __le32 rates; /* supported rates SNDRV_PCM_RATE_* */ __le32 rate_min; /* min rate */ __le32 rate_max; /* max rate */ __le32 channels_min; /* min channels */ __le32 channels_max; /* max channels */ __le32 periods_min; /* min number of periods */ __le32 periods_max; /* max number of periods */ __le32 period_size_min; /* min period size bytes */ __le32 period_size_max; /* max period size bytes */ __le32 buffer_size_min; /* min buffer size bytes */ __le32 buffer_size_max; /* max buffer size bytes */ } __attribute__((packed)); /* PCM v4 */ struct snd_soc_tplg_pcm_v4 { __le32 size; /* in bytes of this structure */ char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; __le32 pcm_id; /* unique ID - used to match with DAI link */ __le32 dai_id; /* unique ID - used to match */ __le32 playback; /* supports playback mode */ __le32 capture; /* supports capture mode */ __le32 compress; /* 1 = compressed; 0 = PCM */ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */ __le32 num_streams; /* number of streams */ struct snd_soc_tplg_stream_caps_v4 caps[2]; /* playback and capture for DAI */ } __attribute__((packed)); /* Physical link config v4 */ struct snd_soc_tplg_link_config_v4 { __le32 size; /* in bytes of this structure */ __le32 id; /* unique ID - used to match */ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */ __le32 num_streams; /* number of streams */ } __attribute__((packed)); #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sound/sfnt_info.h�����������������������������������������������������������������������������������0000644�����������������00000016506�14763166026�0010055 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef __SOUND_SFNT_INFO_H #define __SOUND_SFNT_INFO_H /* * Patch record compatible with AWE driver on OSS * * Copyright (C) 1999-2000 Takashi Iwai * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include <sound/asound.h> /* * patch information record */ #ifdef SNDRV_BIG_ENDIAN #define SNDRV_OSS_PATCHKEY(id) (0xfd00|id) #else #define SNDRV_OSS_PATCHKEY(id) ((id<<8)|0xfd) #endif /* patch interface header: 16 bytes */ struct soundfont_patch_info { unsigned short key; /* use the key below */ #define SNDRV_OSS_SOUNDFONT_PATCH SNDRV_OSS_PATCHKEY(0x07) short device_no; /* synthesizer number */ unsigned short sf_id; /* file id (should be zero) */ short optarg; /* optional argument */ int len; /* data length (without this header) */ short type; /* patch operation type */ #define SNDRV_SFNT_LOAD_INFO 0 /* awe_voice_rec */ #define SNDRV_SFNT_LOAD_DATA 1 /* awe_sample_info */ #define SNDRV_SFNT_OPEN_PATCH 2 /* awe_open_parm */ #define SNDRV_SFNT_CLOSE_PATCH 3 /* none */ /* 4 is obsolete */ #define SNDRV_SFNT_REPLACE_DATA 5 /* awe_sample_info (optarg=#channels)*/ #define SNDRV_SFNT_MAP_PRESET 6 /* awe_voice_map */ /* 7 is not used */ #define SNDRV_SFNT_PROBE_DATA 8 /* optarg=sample */ #define SNDRV_SFNT_REMOVE_INFO 9 /* optarg=(bank<<8)|instr */ short reserved; /* word alignment data */ /* the actual patch data begins after this */ }; /* * open patch */ #define SNDRV_SFNT_PATCH_NAME_LEN 32 struct soundfont_open_parm { unsigned short type; /* sample type */ #define SNDRV_SFNT_PAT_TYPE_MISC 0 #define SNDRV_SFNT_PAT_TYPE_GUS 6 #define SNDRV_SFNT_PAT_TYPE_MAP 7 #define SNDRV_SFNT_PAT_LOCKED 0x100 /* lock the samples */ #define SNDRV_SFNT_PAT_SHARED 0x200 /* sample is shared */ short reserved; char name[SNDRV_SFNT_PATCH_NAME_LEN]; }; /* * raw voice information record */ /* wave table envelope & effect parameters to control EMU8000 */ struct soundfont_voice_parm { unsigned short moddelay; /* modulation delay (0x8000) */ unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */ unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */ unsigned short modrelease; /* modulation release time (0x807f) */ short modkeyhold, modkeydecay; /* envelope change per key (not used) */ unsigned short voldelay; /* volume delay (0x8000) */ unsigned short volatkhld; /* volume attack & hold time (0x7f7f) */ unsigned short voldcysus; /* volume decay & sustain (0x7f7f) */ unsigned short volrelease; /* volume release time (0x807f) */ short volkeyhold, volkeydecay; /* envelope change per key (not used) */ unsigned short lfo1delay; /* LFO1 delay (0x8000) */ unsigned short lfo2delay; /* LFO2 delay (0x8000) */ unsigned short pefe; /* modulation pitch & cutoff (0x0000) */ unsigned short fmmod; /* LFO1 pitch & cutoff (0x0000) */ unsigned short tremfrq; /* LFO1 volume & freq (0x0000) */ unsigned short fm2frq2; /* LFO2 pitch & freq (0x0000) */ unsigned char cutoff; /* initial cutoff (0xff) */ unsigned char filterQ; /* initial filter Q [0-15] (0x0) */ unsigned char chorus; /* chorus send (0x00) */ unsigned char reverb; /* reverb send (0x00) */ unsigned short reserved[4]; /* not used */ }; /* wave table parameters: 92 bytes */ struct soundfont_voice_info { unsigned short sf_id; /* file id (should be zero) */ unsigned short sample; /* sample id */ int start, end; /* sample offset correction */ int loopstart, loopend; /* loop offset correction */ short rate_offset; /* sample rate pitch offset */ unsigned short mode; /* sample mode */ #define SNDRV_SFNT_MODE_ROMSOUND 0x8000 #define SNDRV_SFNT_MODE_STEREO 1 #define SNDRV_SFNT_MODE_LOOPING 2 #define SNDRV_SFNT_MODE_NORELEASE 4 /* obsolete */ #define SNDRV_SFNT_MODE_INIT_PARM 8 short root; /* midi root key */ short tune; /* pitch tuning (in cents) */ unsigned char low, high; /* key note range */ unsigned char vellow, velhigh; /* velocity range */ signed char fixkey, fixvel; /* fixed key, velocity */ signed char pan, fixpan; /* panning, fixed panning */ short exclusiveClass; /* exclusive class (0 = none) */ unsigned char amplitude; /* sample volume (127 max) */ unsigned char attenuation; /* attenuation (0.375dB) */ short scaleTuning; /* pitch scale tuning(%), normally 100 */ struct soundfont_voice_parm parm; /* voice envelope parameters */ unsigned short sample_mode; /* sample mode_flag (set by driver) */ }; /* instrument info header: 4 bytes */ struct soundfont_voice_rec_hdr { unsigned char bank; /* midi bank number */ unsigned char instr; /* midi preset number */ char nvoices; /* number of voices */ char write_mode; /* write mode; normally 0 */ #define SNDRV_SFNT_WR_APPEND 0 /* append anyway */ #define SNDRV_SFNT_WR_EXCLUSIVE 1 /* skip if already exists */ #define SNDRV_SFNT_WR_REPLACE 2 /* replace if already exists */ }; /* * sample wave information */ /* wave table sample header: 32 bytes */ struct soundfont_sample_info { unsigned short sf_id; /* file id (should be zero) */ unsigned short sample; /* sample id */ int start, end; /* start & end offset */ int loopstart, loopend; /* loop start & end offset */ int size; /* size (0 = ROM) */ short dummy; /* not used */ unsigned short mode_flags; /* mode flags */ #define SNDRV_SFNT_SAMPLE_8BITS 1 /* wave data is 8bits */ #define SNDRV_SFNT_SAMPLE_UNSIGNED 2 /* wave data is unsigned */ #define SNDRV_SFNT_SAMPLE_NO_BLANK 4 /* no blank loop is attached */ #define SNDRV_SFNT_SAMPLE_SINGLESHOT 8 /* single-shot w/o loop */ #define SNDRV_SFNT_SAMPLE_BIDIR_LOOP 16 /* bidirectional looping */ #define SNDRV_SFNT_SAMPLE_STEREO_LEFT 32 /* stereo left sound */ #define SNDRV_SFNT_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */ #define SNDRV_SFNT_SAMPLE_REVERSE_LOOP 128 /* reverse looping */ unsigned int truesize; /* used memory size (set by driver) */ }; /* * voice preset mapping (aliasing) */ struct soundfont_voice_map { int map_bank, map_instr, map_key; /* key = -1 means all keys */ int src_bank, src_instr, src_key; }; /* * ioctls for hwdep */ #define SNDRV_EMUX_HWDEP_NAME "Emux WaveTable" #define SNDRV_EMUX_VERSION ((1 << 16) | (0 << 8) | 0) /* 1.0.0 */ struct snd_emux_misc_mode { int port; /* -1 = all */ int mode; int value; int value2; /* reserved */ }; #define SNDRV_EMUX_IOCTL_VERSION _IOR('H', 0x80, unsigned int) #define SNDRV_EMUX_IOCTL_LOAD_PATCH _IOWR('H', 0x81, struct soundfont_patch_info) #define SNDRV_EMUX_IOCTL_RESET_SAMPLES _IO('H', 0x82) #define SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES _IO('H', 0x83) #define SNDRV_EMUX_IOCTL_MEM_AVAIL _IOW('H', 0x84, int) #define SNDRV_EMUX_IOCTL_MISC_MODE _IOWR('H', 0x84, struct snd_emux_misc_mode) #endif /* __SOUND_SFNT_INFO_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sound/tlv.h�����������������������������������������������������������������������������������������0000644�����������������00000010771�14763166026�0006673 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * 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. */ #ifndef __UAPI_SOUND_TLV_H #define __UAPI_SOUND_TLV_H #define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */ #define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */ #define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */ #define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */ #define SNDRV_CTL_TLVT_DB_MINMAX 4 /* dB scale with min/max */ #define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5 /* dB scale with min/max with mute */ /* * channel-mapping TLV items * TLV length must match with num_channels */ #define SNDRV_CTL_TLVT_CHMAP_FIXED 0x101 /* fixed channel position */ #define SNDRV_CTL_TLVT_CHMAP_VAR 0x102 /* channels freely swappable */ #define SNDRV_CTL_TLVT_CHMAP_PAIRED 0x103 /* pair-wise swappable */ /* * TLV structure is right behind the struct snd_ctl_tlv: * unsigned int type - see SNDRV_CTL_TLVT_* * unsigned int length * .... data aligned to sizeof(unsigned int), use * block_length = (length + (sizeof(unsigned int) - 1)) & * ~(sizeof(unsigned int) - 1)) .... */ #define SNDRV_CTL_TLVD_ITEM(type, ...) \ (type), SNDRV_CTL_TLVD_LENGTH(__VA_ARGS__), __VA_ARGS__ #define SNDRV_CTL_TLVD_LENGTH(...) \ ((unsigned int)sizeof((const unsigned int[]) { __VA_ARGS__ })) /* Accessor offsets for TLV data items */ #define SNDRV_CTL_TLVO_TYPE 0 #define SNDRV_CTL_TLVO_LEN 1 #define SNDRV_CTL_TLVD_CONTAINER_ITEM(...) \ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_CONTAINER, __VA_ARGS__) #define SNDRV_CTL_TLVD_DECLARE_CONTAINER(name, ...) \ unsigned int name[] = { \ SNDRV_CTL_TLVD_CONTAINER_ITEM(__VA_ARGS__) \ } #define SNDRV_CTL_TLVD_DB_SCALE_MASK 0xffff #define SNDRV_CTL_TLVD_DB_SCALE_MUTE 0x10000 #define SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_SCALE, \ (min), \ ((step) & SNDRV_CTL_TLVD_DB_SCALE_MASK) | \ ((mute) ? SNDRV_CTL_TLVD_DB_SCALE_MUTE : 0)) #define SNDRV_CTL_TLVD_DECLARE_DB_SCALE(name, min, step, mute) \ unsigned int name[] = { \ SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \ } /* Accessor offsets for min, mute and step items in dB scale type TLV */ #define SNDRV_CTL_TLVO_DB_SCALE_MIN 2 #define SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP 3 /* dB scale specified with min/max values instead of step */ #define SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX, (min_dB), (max_dB)) #define SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX_MUTE, (min_dB), (max_dB)) #define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(name, min_dB, max_dB) \ unsigned int name[] = { \ SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \ } #define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX_MUTE(name, min_dB, max_dB) \ unsigned int name[] = { \ SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \ } /* Accessor offsets for min, max items in db-minmax types of TLV. */ #define SNDRV_CTL_TLVO_DB_MINMAX_MIN 2 #define SNDRV_CTL_TLVO_DB_MINMAX_MAX 3 /* linear volume between min_dB and max_dB (.01dB unit) */ #define SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_LINEAR, (min_dB), (max_dB)) #define SNDRV_CTL_TLVD_DECLARE_DB_LINEAR(name, min_dB, max_dB) \ unsigned int name[] = { \ SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \ } /* Accessor offsets for min, max items in db-linear type of TLV. */ #define SNDRV_CTL_TLVO_DB_LINEAR_MIN 2 #define SNDRV_CTL_TLVO_DB_LINEAR_MAX 3 /* dB range container: * Items in dB range container must be ordered by their values and by their * dB values. This implies that larger values must correspond with larger * dB values (which is also required for all other mixer controls). */ /* Each item is: <min> <max> <TLV> */ #define SNDRV_CTL_TLVD_DB_RANGE_ITEM(...) \ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_RANGE, __VA_ARGS__) #define SNDRV_CTL_TLVD_DECLARE_DB_RANGE(name, ...) \ unsigned int name[] = { \ SNDRV_CTL_TLVD_DB_RANGE_ITEM(__VA_ARGS__) \ } #define SNDRV_CTL_TLVD_DB_GAIN_MUTE -9999999 #endif �������sound/asequencer.h����������������������������������������������������������������������������������0000644�����������������00000052533�14763166026�0010223 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Main header file for the ALSA sequencer * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl> * (c) 1998-1999 by Jaroslav Kysela <perex@perex.cz> * * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SOUND_ASEQUENCER_H #define __SOUND_ASEQUENCER_H #include <sound/asound.h> /** version of the sequencer */ #define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 2) /** * definition of sequencer event types */ /** system messages * event data type = #snd_seq_result */ #define SNDRV_SEQ_EVENT_SYSTEM 0 #define SNDRV_SEQ_EVENT_RESULT 1 /** note messages (channel specific) * event data type = #snd_seq_ev_note */ #define SNDRV_SEQ_EVENT_NOTE 5 #define SNDRV_SEQ_EVENT_NOTEON 6 #define SNDRV_SEQ_EVENT_NOTEOFF 7 #define SNDRV_SEQ_EVENT_KEYPRESS 8 /** control messages (channel specific) * event data type = #snd_seq_ev_ctrl */ #define SNDRV_SEQ_EVENT_CONTROLLER 10 #define SNDRV_SEQ_EVENT_PGMCHANGE 11 #define SNDRV_SEQ_EVENT_CHANPRESS 12 #define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */ #define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */ #define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN address + 14 bit unsigned value */ #define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */ /** synchronisation messages * event data type = #snd_seq_ev_ctrl */ #define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */ #define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */ #define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */ #define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */ #define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */ /** timer messages * event data type = snd_seq_ev_queue_control */ #define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */ #define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */ #define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */ #define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */ #define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */ #define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */ #define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */ #define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */ #define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */ /** others * event data type = none */ #define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */ #define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */ #define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */ /** echo back, kernel private messages * event data type = any type */ #define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */ #define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */ /** system status messages (broadcast for subscribers) * event data type = snd_seq_addr */ #define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */ #define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */ #define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */ #define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */ #define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */ #define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */ /** port connection changes * event data type = snd_seq_connect */ #define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */ #define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */ /* 70-89: synthesizer events - obsoleted */ /** user-defined events with fixed length * event data type = any */ #define SNDRV_SEQ_EVENT_USR0 90 #define SNDRV_SEQ_EVENT_USR1 91 #define SNDRV_SEQ_EVENT_USR2 92 #define SNDRV_SEQ_EVENT_USR3 93 #define SNDRV_SEQ_EVENT_USR4 94 #define SNDRV_SEQ_EVENT_USR5 95 #define SNDRV_SEQ_EVENT_USR6 96 #define SNDRV_SEQ_EVENT_USR7 97 #define SNDRV_SEQ_EVENT_USR8 98 #define SNDRV_SEQ_EVENT_USR9 99 /* 100-118: instrument layer - obsoleted */ /* 119-129: reserved */ /* 130-139: variable length events * event data type = snd_seq_ev_ext * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set) */ #define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */ #define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */ /* 132-134: reserved */ #define SNDRV_SEQ_EVENT_USR_VAR0 135 #define SNDRV_SEQ_EVENT_USR_VAR1 136 #define SNDRV_SEQ_EVENT_USR_VAR2 137 #define SNDRV_SEQ_EVENT_USR_VAR3 138 #define SNDRV_SEQ_EVENT_USR_VAR4 139 /* 150-151: kernel events with quote - DO NOT use in user clients */ #define SNDRV_SEQ_EVENT_KERNEL_ERROR 150 #define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151 /* obsolete */ /* 152-191: reserved */ /* 192-254: hardware specific events */ /* 255: special event */ #define SNDRV_SEQ_EVENT_NONE 255 typedef unsigned char snd_seq_event_type_t; /** event address */ struct snd_seq_addr { unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */ unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */ }; /** port connection */ struct snd_seq_connect { struct snd_seq_addr sender; struct snd_seq_addr dest; }; #define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */ #define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */ #define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */ #define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */ /* event mode flag - NOTE: only 8 bits available! */ #define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */ #define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */ #define SNDRV_SEQ_TIME_STAMP_MASK (1<<0) #define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */ #define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */ #define SNDRV_SEQ_TIME_MODE_MASK (1<<1) #define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */ #define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */ #define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */ #define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2) #define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */ #define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */ #define SNDRV_SEQ_PRIORITY_MASK (1<<4) /* note event */ struct snd_seq_ev_note { unsigned char channel; unsigned char note; unsigned char velocity; unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */ unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */ }; /* controller event */ struct snd_seq_ev_ctrl { unsigned char channel; unsigned char unused1, unused2, unused3; /* pad */ unsigned int param; signed int value; }; /* generic set of bytes (12x8 bit) */ struct snd_seq_ev_raw8 { unsigned char d[12]; /* 8 bit value */ }; /* generic set of integers (3x32 bit) */ struct snd_seq_ev_raw32 { unsigned int d[3]; /* 32 bit value */ }; /* external stored data */ struct snd_seq_ev_ext { unsigned int len; /* length of data */ void *ptr; /* pointer to data (note: maybe 64-bit) */ } __attribute__((packed)); struct snd_seq_result { int event; /* processed event type */ int result; }; struct snd_seq_real_time { unsigned int tv_sec; /* seconds */ unsigned int tv_nsec; /* nanoseconds */ }; typedef unsigned int snd_seq_tick_time_t; /* midi ticks */ union snd_seq_timestamp { snd_seq_tick_time_t tick; struct snd_seq_real_time time; }; struct snd_seq_queue_skew { unsigned int value; unsigned int base; }; /* queue timer control */ struct snd_seq_ev_queue_control { unsigned char queue; /* affected queue */ unsigned char pad[3]; /* reserved */ union { signed int value; /* affected value (e.g. tempo) */ union snd_seq_timestamp time; /* time */ unsigned int position; /* sync position */ struct snd_seq_queue_skew skew; unsigned int d32[2]; unsigned char d8[8]; } param; }; /* quoted event - inside the kernel only */ struct snd_seq_ev_quote { struct snd_seq_addr origin; /* original sender */ unsigned short value; /* optional data */ struct snd_seq_event *event; /* quoted event */ } __attribute__((packed)); /* sequencer event */ struct snd_seq_event { snd_seq_event_type_t type; /* event type */ unsigned char flags; /* event flags */ char tag; unsigned char queue; /* schedule queue */ union snd_seq_timestamp time; /* schedule time */ struct snd_seq_addr source; /* source address */ struct snd_seq_addr dest; /* destination address */ union { /* event data... */ struct snd_seq_ev_note note; struct snd_seq_ev_ctrl control; struct snd_seq_ev_raw8 raw8; struct snd_seq_ev_raw32 raw32; struct snd_seq_ev_ext ext; struct snd_seq_ev_queue_control queue; union snd_seq_timestamp time; struct snd_seq_addr addr; struct snd_seq_connect connect; struct snd_seq_result result; struct snd_seq_ev_quote quote; } data; }; /* * bounce event - stored as variable size data */ struct snd_seq_event_bounce { int err; struct snd_seq_event event; /* external data follows here. */ }; /* system information */ struct snd_seq_system_info { int queues; /* maximum queues count */ int clients; /* maximum clients count */ int ports; /* maximum ports per client */ int channels; /* maximum channels per port */ int cur_clients; /* current clients */ int cur_queues; /* current queues */ char reserved[24]; }; /* system running information */ struct snd_seq_running_info { unsigned char client; /* client id */ unsigned char big_endian; /* 1 = big-endian */ unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */ unsigned char pad; /* reserved */ unsigned char reserved[12]; }; /* known client numbers */ #define SNDRV_SEQ_CLIENT_SYSTEM 0 /* internal client numbers */ #define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */ #define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */ /* client types */ typedef int __bitwise snd_seq_client_type_t; #define NO_CLIENT ((snd_seq_client_type_t) 0) #define USER_CLIENT ((snd_seq_client_type_t) 1) #define KERNEL_CLIENT ((snd_seq_client_type_t) 2) /* event filter flags */ #define SNDRV_SEQ_FILTER_BROADCAST (1U<<0) /* accept broadcast messages */ #define SNDRV_SEQ_FILTER_MULTICAST (1U<<1) /* accept multicast messages */ #define SNDRV_SEQ_FILTER_BOUNCE (1U<<2) /* accept bounce event in error */ #define SNDRV_SEQ_FILTER_USE_EVENT (1U<<31) /* use event filter */ struct snd_seq_client_info { int client; /* client number to inquire */ snd_seq_client_type_t type; /* client type */ char name[64]; /* client name */ unsigned int filter; /* filter flags */ unsigned char multicast_filter[8]; /* multicast filter bitmap */ unsigned char event_filter[32]; /* event filter bitmap */ int num_ports; /* RO: number of ports */ int event_lost; /* number of lost events */ int card; /* RO: card number[kernel] */ int pid; /* RO: pid[user] */ char reserved[56]; /* for future use */ }; /* client pool size */ struct snd_seq_client_pool { int client; /* client number to inquire */ int output_pool; /* outgoing (write) pool size */ int input_pool; /* incoming (read) pool size */ int output_room; /* minimum free pool size for select/blocking mode */ int output_free; /* unused size */ int input_free; /* unused size */ char reserved[64]; }; /* Remove events by specified criteria */ #define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */ #define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */ #define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */ #define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */ #define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */ #define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */ #define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */ #define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */ #define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */ #define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */ struct snd_seq_remove_events { unsigned int remove_mode; /* Flags that determine what gets removed */ union snd_seq_timestamp time; unsigned char queue; /* Queue for REMOVE_DEST */ struct snd_seq_addr dest; /* Address for REMOVE_DEST */ unsigned char channel; /* Channel for REMOVE_DEST */ int type; /* For REMOVE_EVENT_TYPE */ char tag; /* Tag for REMOVE_TAG */ int reserved[10]; /* To allow for future binary compatibility */ }; /* known port numbers */ #define SNDRV_SEQ_PORT_SYSTEM_TIMER 0 #define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1 /* port capabilities (32 bits) */ #define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */ #define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */ #define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2) #define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3) #define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4) #define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */ #define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */ #define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */ /* port type */ #define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */ #define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */ #define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */ #define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */ #define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */ #define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */ #define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */ /* other standards...*/ #define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */ #define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */ #define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */ /*...*/ #define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */ #define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */ #define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */ #define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */ #define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */ /* misc. conditioning flags */ #define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0) #define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1) #define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2) struct snd_seq_port_info { struct snd_seq_addr addr; /* client/port numbers */ char name[64]; /* port name */ unsigned int capability; /* port capability bits */ unsigned int type; /* port type bits */ int midi_channels; /* channels per MIDI port */ int midi_voices; /* voices per MIDI port */ int synth_voices; /* voices per SYNTH port */ int read_use; /* R/O: subscribers for output (from this port) */ int write_use; /* R/O: subscribers for input (to this port) */ void *kernel; /* reserved for kernel use (must be NULL) */ unsigned int flags; /* misc. conditioning */ unsigned char time_queue; /* queue # for timestamping */ char reserved[59]; /* for future use */ }; /* queue flags */ #define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */ /* queue information */ struct snd_seq_queue_info { int queue; /* queue id */ /* * security settings, only owner of this queue can start/stop timer * etc. if the queue is locked for other clients */ int owner; /* client id for owner of the queue */ unsigned locked:1; /* timing queue locked for other queues */ char name[64]; /* name of this queue */ unsigned int flags; /* flags */ char reserved[60]; /* for future use */ }; /* queue info/status */ struct snd_seq_queue_status { int queue; /* queue id */ int events; /* read-only - queue size */ snd_seq_tick_time_t tick; /* current tick */ struct snd_seq_real_time time; /* current time */ int running; /* running state of queue */ int flags; /* various flags */ char reserved[64]; /* for the future */ }; /* queue tempo */ struct snd_seq_queue_tempo { int queue; /* sequencer queue */ unsigned int tempo; /* current tempo, us/tick */ int ppq; /* time resolution, ticks/quarter */ unsigned int skew_value; /* queue skew */ unsigned int skew_base; /* queue skew base */ char reserved[24]; /* for the future */ }; /* sequencer timer sources */ #define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */ #define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */ #define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */ /* queue timer info */ struct snd_seq_queue_timer { int queue; /* sequencer queue */ int type; /* source timer type */ union { struct { struct snd_timer_id id; /* ALSA's timer ID */ unsigned int resolution; /* resolution in Hz */ } alsa; } u; char reserved[64]; /* for the future use */ }; struct snd_seq_queue_client { int queue; /* sequencer queue */ int client; /* sequencer client */ int used; /* queue is used with this client (must be set for accepting events) */ /* per client watermarks */ char reserved[64]; /* for future use */ }; #define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */ #define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1) #define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2) struct snd_seq_port_subscribe { struct snd_seq_addr sender; /* sender address */ struct snd_seq_addr dest; /* destination address */ unsigned int voices; /* number of voices to be allocated (0 = don't care) */ unsigned int flags; /* modes */ unsigned char queue; /* input time-stamp queue (optional) */ unsigned char pad[3]; /* reserved */ char reserved[64]; }; /* type of query subscription */ #define SNDRV_SEQ_QUERY_SUBS_READ 0 #define SNDRV_SEQ_QUERY_SUBS_WRITE 1 struct snd_seq_query_subs { struct snd_seq_addr root; /* client/port id to be searched */ int type; /* READ or WRITE */ int index; /* 0..N-1 */ int num_subs; /* R/O: number of subscriptions on this port */ struct snd_seq_addr addr; /* R/O: result */ unsigned char queue; /* R/O: result */ unsigned int flags; /* R/O: result */ char reserved[64]; /* for future use */ }; /* * IOCTL commands */ #define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int) #define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int) #define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info) #define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info) #define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info) #define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info) #define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info) #define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info) #define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info) #define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info) #define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe) #define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe) #define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info) #define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info) #define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info) #define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info) #define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info) #define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status) #define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo) #define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo) #define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer) #define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer) #define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client) #define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client) #define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool) #define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool) #define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events) #define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs) #define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe) #define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info) #define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info) #endif /* __SOUND_ASEQUENCER_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������sound/snd_sst_tokens.h������������������������������������������������������������������������������0000644�����������������00000027637�14763166026�0011137 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * snd_sst_tokens.h - Intel SST tokens definition * * Copyright (C) 2016 Intel Corp * Author: Shreyas NC <shreyas.nc@intel.com> * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as version 2, as * published by the Free Software Foundation. * * 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. */ #ifndef __SND_SST_TOKENS_H__ #define __SND_SST_TOKENS_H__ /** * %SKL_TKN_UUID: Module UUID * * %SKL_TKN_U8_BLOCK_TYPE: Type of the private data block.Can be: * tuples, bytes, short and words * * %SKL_TKN_U8_IN_PIN_TYPE: Input pin type, * homogenous=0, heterogenous=1 * * %SKL_TKN_U8_OUT_PIN_TYPE: Output pin type, * homogenous=0, heterogenous=1 * %SKL_TKN_U8_DYN_IN_PIN: Configure Input pin dynamically * if true * * %SKL_TKN_U8_DYN_OUT_PIN: Configure Output pin dynamically * if true * * %SKL_TKN_U8_IN_QUEUE_COUNT: Store the number of Input pins * * %SKL_TKN_U8_OUT_QUEUE_COUNT: Store the number of Output pins * * %SKL_TKN_U8_TIME_SLOT: TDM slot number * * %SKL_TKN_U8_CORE_ID: Stores module affinity value.Can take * the values: * SKL_AFFINITY_CORE_0 = 0, * SKL_AFFINITY_CORE_1, * SKL_AFFINITY_CORE_MAX * * %SKL_TKN_U8_MOD_TYPE: Module type value. * * %SKL_TKN_U8_CONN_TYPE: Module connection type can be a FE, * BE or NONE as defined : * SKL_PIPE_CONN_TYPE_NONE = 0, * SKL_PIPE_CONN_TYPE_FE = 1 (HOST_DMA) * SKL_PIPE_CONN_TYPE_BE = 2 (LINK_DMA) * * %SKL_TKN_U8_DEV_TYPE: Type of device to which the module is * connected * Can take the values: * SKL_DEVICE_BT = 0x0, * SKL_DEVICE_DMIC = 0x1, * SKL_DEVICE_I2S = 0x2, * SKL_DEVICE_SLIMBUS = 0x3, * SKL_DEVICE_HDALINK = 0x4, * SKL_DEVICE_HDAHOST = 0x5, * SKL_DEVICE_NONE * * %SKL_TKN_U8_HW_CONN_TYPE: Connection type of the HW to which the * module is connected * SKL_CONN_NONE = 0, * SKL_CONN_SOURCE = 1, * SKL_CONN_SINK = 2 * * %SKL_TKN_U16_PIN_INST_ID: Stores the pin instance id * * %SKL_TKN_U16_MOD_INST_ID: Stores the mdule instance id * * %SKL_TKN_U32_MAX_MCPS: Module max mcps value * * %SKL_TKN_U32_MEM_PAGES: Module resource pages * * %SKL_TKN_U32_OBS: Stores Output Buffer size * * %SKL_TKN_U32_IBS: Stores input buffer size * * %SKL_TKN_U32_VBUS_ID: Module VBUS_ID. PDM=0, SSP0=0, * SSP1=1,SSP2=2, * SSP3=3, SSP4=4, * SSP5=5, SSP6=6,INVALID * * %SKL_TKN_U32_PARAMS_FIXUP: Module Params fixup mask * %SKL_TKN_U32_CONVERTER: Module params converter mask * %SKL_TKN_U32_PIPE_ID: Stores the pipe id * * %SKL_TKN_U32_PIPE_CONN_TYPE: Type of the token to which the pipe is * connected to. It can be * SKL_PIPE_CONN_TYPE_NONE = 0, * SKL_PIPE_CONN_TYPE_FE = 1 (HOST_DMA), * SKL_PIPE_CONN_TYPE_BE = 2 (LINK_DMA), * * %SKL_TKN_U32_PIPE_PRIORITY: Pipe priority value * %SKL_TKN_U32_PIPE_MEM_PGS: Pipe resource pages * * %SKL_TKN_U32_DIR_PIN_COUNT: Value for the direction to set input/output * formats and the pin count. * The first 4 bits have the direction * value and the next 4 have * the pin count value. * SKL_DIR_IN = 0, SKL_DIR_OUT = 1. * The input and output formats * share the same set of tokens * with the distinction between input * and output made by reading direction * token. * * %SKL_TKN_U32_FMT_CH: Supported channel count * * %SKL_TKN_U32_FMT_FREQ: Supported frequency/sample rate * * %SKL_TKN_U32_FMT_BIT_DEPTH: Supported container size * * %SKL_TKN_U32_FMT_SAMPLE_SIZE:Number of samples in the container * * %SKL_TKN_U32_FMT_CH_CONFIG: Supported channel configurations for the * input/output. * * %SKL_TKN_U32_FMT_INTERLEAVE: Interleaving style which can be per * channel or per sample. The values can be : * SKL_INTERLEAVING_PER_CHANNEL = 0, * SKL_INTERLEAVING_PER_SAMPLE = 1, * * %SKL_TKN_U32_FMT_SAMPLE_TYPE: * Specifies the sample type. Can take the * values: SKL_SAMPLE_TYPE_INT_MSB = 0, * SKL_SAMPLE_TYPE_INT_LSB = 1, * SKL_SAMPLE_TYPE_INT_SIGNED = 2, * SKL_SAMPLE_TYPE_INT_UNSIGNED = 3, * SKL_SAMPLE_TYPE_FLOAT = 4 * * %SKL_TKN_U32_CH_MAP: Channel map values * %SKL_TKN_U32_MOD_SET_PARAMS: It can take these values: * SKL_PARAM_DEFAULT, SKL_PARAM_INIT, * SKL_PARAM_SET, SKL_PARAM_BIND * * %SKL_TKN_U32_MOD_PARAM_ID: ID of the module params * * %SKL_TKN_U32_CAPS_SET_PARAMS: * Set params value * * %SKL_TKN_U32_CAPS_PARAMS_ID: Params ID * * %SKL_TKN_U32_CAPS_SIZE: Caps size * * %SKL_TKN_U32_PROC_DOMAIN: Specify processing domain * * %SKL_TKN_U32_LIB_COUNT: Specifies the number of libraries * * %SKL_TKN_STR_LIB_NAME: Specifies the library name * * %SKL_TKN_U32_PMODE: Specifies the power mode for pipe * * %SKL_TKL_U32_D0I3_CAPS: Specifies the D0i3 capability for module * * %SKL_TKN_U32_DMA_BUF_SIZE: DMA buffer size in millisec * * %SKL_TKN_U32_PIPE_DIR: Specifies pipe direction. Can be * playback/capture. * * %SKL_TKN_U32_NUM_CONFIGS: Number of pipe configs * * %SKL_TKN_U32_PATH_MEM_PGS: Size of memory (in pages) required for pipeline * and its data * * %SKL_TKN_U32_PIPE_CONFIG_ID: Config id for the modules in the pipe * and PCM params supported by that pipe * config. This is used as index to fill * up the pipe config and module config * structure. * * %SKL_TKN_U32_CFG_FREQ: * %SKL_TKN_U8_CFG_CHAN: * %SKL_TKN_U8_CFG_BPS: PCM params (freq, channels, bits per sample) * supported for each of the pipe configs. * * %SKL_TKN_CFG_MOD_RES_ID: Module's resource index for each of the * pipe config * * %SKL_TKN_CFG_MOD_FMT_ID: Module's interface index for each of the * pipe config * * %SKL_TKN_U8_NUM_MOD: Number of modules in the manifest * * %SKL_TKN_MM_U8_MOD_IDX: Current index of the module in the manifest * * %SKL_TKN_MM_U8_NUM_RES: Number of resources for the module * * %SKL_TKN_MM_U8_NUM_INTF: Number of interfaces for the module * * %SKL_TKN_MM_U32_RES_ID: Resource index for the resource info to * be filled into. * A module can support multiple resource * configuration and is represnted as a * resource table. This index is used to * fill information into appropriate index. * * %SKL_TKN_MM_U32_CPS: DSP cycles per second * * %SKL_TKN_MM_U32_DMA_SIZE: Allocated buffer size for gateway DMA * * %SKL_TKN_MM_U32_CPC: DSP cycles allocated per frame * * %SKL_TKN_MM_U32_RES_PIN_ID: Resource pin index in the module * * %SKL_TKN_MM_U32_INTF_PIN_ID: Interface index in the module * * %SKL_TKN_MM_U32_PIN_BUF: Buffer size of the module pin * * %SKL_TKN_MM_U32_FMT_ID: Format index for each of the interface/ * format information to be filled into. * * %SKL_TKN_MM_U32_NUM_IN_FMT: Number of input formats * %SKL_TKN_MM_U32_NUM_OUT_FMT: Number of output formats * * %SKL_TKN_U32_ASTATE_IDX: Table Index for the A-State entry to be filled * with kcps and clock source * * %SKL_TKN_U32_ASTATE_COUNT: Number of valid entries in A-State table * * %SKL_TKN_U32_ASTATE_KCPS: Specifies the core load threshold (in kilo * cycles per second) below which DSP is clocked * from source specified by clock source. * * %SKL_TKN_U32_ASTATE_CLK_SRC: Clock source for A-State entry * * module_id and loadable flags dont have tokens as these values will be * read from the DSP FW manifest * * Tokens defined can be used either in the manifest or widget private data. * * SKL_TKN_MM is used as a suffix for all tokens that represent * module data in the manifest. */ enum SKL_TKNS { SKL_TKN_UUID = 1, SKL_TKN_U8_NUM_BLOCKS, SKL_TKN_U8_BLOCK_TYPE, SKL_TKN_U8_IN_PIN_TYPE, SKL_TKN_U8_OUT_PIN_TYPE, SKL_TKN_U8_DYN_IN_PIN, SKL_TKN_U8_DYN_OUT_PIN, SKL_TKN_U8_IN_QUEUE_COUNT, SKL_TKN_U8_OUT_QUEUE_COUNT, SKL_TKN_U8_TIME_SLOT, SKL_TKN_U8_CORE_ID, SKL_TKN_U8_MOD_TYPE, SKL_TKN_U8_CONN_TYPE, SKL_TKN_U8_DEV_TYPE, SKL_TKN_U8_HW_CONN_TYPE, SKL_TKN_U16_MOD_INST_ID, SKL_TKN_U16_BLOCK_SIZE, SKL_TKN_U32_MAX_MCPS, SKL_TKN_U32_MEM_PAGES, SKL_TKN_U32_OBS, SKL_TKN_U32_IBS, SKL_TKN_U32_VBUS_ID, SKL_TKN_U32_PARAMS_FIXUP, SKL_TKN_U32_CONVERTER, SKL_TKN_U32_PIPE_ID, SKL_TKN_U32_PIPE_CONN_TYPE, SKL_TKN_U32_PIPE_PRIORITY, SKL_TKN_U32_PIPE_MEM_PGS, SKL_TKN_U32_DIR_PIN_COUNT, SKL_TKN_U32_FMT_CH, SKL_TKN_U32_FMT_FREQ, SKL_TKN_U32_FMT_BIT_DEPTH, SKL_TKN_U32_FMT_SAMPLE_SIZE, SKL_TKN_U32_FMT_CH_CONFIG, SKL_TKN_U32_FMT_INTERLEAVE, SKL_TKN_U32_FMT_SAMPLE_TYPE, SKL_TKN_U32_FMT_CH_MAP, SKL_TKN_U32_PIN_MOD_ID, SKL_TKN_U32_PIN_INST_ID, SKL_TKN_U32_MOD_SET_PARAMS, SKL_TKN_U32_MOD_PARAM_ID, SKL_TKN_U32_CAPS_SET_PARAMS, SKL_TKN_U32_CAPS_PARAMS_ID, SKL_TKN_U32_CAPS_SIZE, SKL_TKN_U32_PROC_DOMAIN, SKL_TKN_U32_LIB_COUNT, SKL_TKN_STR_LIB_NAME, SKL_TKN_U32_PMODE, SKL_TKL_U32_D0I3_CAPS, /* Typo added at v4.10 */ SKL_TKN_U32_D0I3_CAPS = SKL_TKL_U32_D0I3_CAPS, SKL_TKN_U32_DMA_BUF_SIZE, SKL_TKN_U32_PIPE_DIRECTION, SKL_TKN_U32_PIPE_CONFIG_ID, SKL_TKN_U32_NUM_CONFIGS, SKL_TKN_U32_PATH_MEM_PGS, SKL_TKN_U32_CFG_FREQ, SKL_TKN_U8_CFG_CHAN, SKL_TKN_U8_CFG_BPS, SKL_TKN_CFG_MOD_RES_ID, SKL_TKN_CFG_MOD_FMT_ID, SKL_TKN_U8_NUM_MOD, SKL_TKN_MM_U8_MOD_IDX, SKL_TKN_MM_U8_NUM_RES, SKL_TKN_MM_U8_NUM_INTF, SKL_TKN_MM_U32_RES_ID, SKL_TKN_MM_U32_CPS, SKL_TKN_MM_U32_DMA_SIZE, SKL_TKN_MM_U32_CPC, SKL_TKN_MM_U32_RES_PIN_ID, SKL_TKN_MM_U32_INTF_PIN_ID, SKL_TKN_MM_U32_PIN_BUF, SKL_TKN_MM_U32_FMT_ID, SKL_TKN_MM_U32_NUM_IN_FMT, SKL_TKN_MM_U32_NUM_OUT_FMT, SKL_TKN_U32_ASTATE_IDX, SKL_TKN_U32_ASTATE_COUNT, SKL_TKN_U32_ASTATE_KCPS, SKL_TKN_U32_ASTATE_CLK_SRC, SKL_TKN_MAX = SKL_TKN_U32_ASTATE_CLK_SRC, }; #endif �������������������������������������������������������������������������������������������������gshadow.h�������������������������������������������������������������������������������������������0000644�����������������00000010674�14763166026�0006374 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2009, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* Declaration of types and functions for shadow group suite. */ #ifndef _GSHADOW_H #define _GSHADOW_H 1 #include <features.h> #include <paths.h> #define __need_FILE #include <stdio.h> #define __need_size_t #include <stddef.h> /* Path to the user database files. */ #define GSHADOW _PATH_GSHADOW __BEGIN_DECLS /* Structure of the group file. */ struct sgrp { char *sg_namp; /* Group name. */ char *sg_passwd; /* Encrypted password. */ char **sg_adm; /* Group administrator list. */ char **sg_mem; /* Group member list. */ }; /* Open database for reading. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern void setsgent (void); /* Close database. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern void endsgent (void); /* Get next entry from database, perhaps after opening the file. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern struct sgrp *getsgent (void); /* Get shadow entry matching NAME. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern struct sgrp *getsgnam (const char *__name); /* Read shadow entry from STRING. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern struct sgrp *sgetsgent (const char *__string); /* Read next shadow entry from STREAM. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern struct sgrp *fgetsgent (FILE *__stream); /* Write line containing shadow password entry to stream. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int putsgent (const struct sgrp *__g, FILE *__stream); #ifdef __USE_MISC /* Reentrant versions of some of the functions above. These functions are not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation they are cancellation points and therefore not marked with __THROW. */ extern int getsgent_r (struct sgrp *__result_buf, char *__buffer, size_t __buflen, struct sgrp **__result); extern int getsgnam_r (const char *__name, struct sgrp *__result_buf, char *__buffer, size_t __buflen, struct sgrp **__result); extern int sgetsgent_r (const char *__string, struct sgrp *__result_buf, char *__buffer, size_t __buflen, struct sgrp **__result); extern int fgetsgent_r (FILE *__stream, struct sgrp *__result_buf, char *__buffer, size_t __buflen, struct sgrp **__result); #endif /* misc */ __END_DECLS #endif /* gshadow.h */ ��������������������������������������������������������������������mntent.h��������������������������������������������������������������������������������������������0000644�����������������00000006457�14763166026�0006251 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Utilities for reading/writing fstab, mtab, etc. Copyright (C) 1995-1999, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MNTENT_H #define _MNTENT_H 1 #include <features.h> #define __need_FILE #include <stdio.h> #include <paths.h> /* File listing canonical interesting mount points. */ #define MNTTAB _PATH_MNTTAB /* Deprecated alias. */ /* File listing currently active mount points. */ #define MOUNTED _PATH_MOUNTED /* Deprecated alias. */ /* General filesystem types. */ #define MNTTYPE_IGNORE "ignore" /* Ignore this entry. */ #define MNTTYPE_NFS "nfs" /* Network file system. */ #define MNTTYPE_SWAP "swap" /* Swap device. */ /* Generic mount options. */ #define MNTOPT_DEFAULTS "defaults" /* Use all default options. */ #define MNTOPT_RO "ro" /* Read only. */ #define MNTOPT_RW "rw" /* Read/write. */ #define MNTOPT_SUID "suid" /* Set uid allowed. */ #define MNTOPT_NOSUID "nosuid" /* No set uid allowed. */ #define MNTOPT_NOAUTO "noauto" /* Do not auto mount. */ __BEGIN_DECLS /* Structure describing a mount table entry. */ struct mntent { char *mnt_fsname; /* Device or server for filesystem. */ char *mnt_dir; /* Directory mounted on. */ char *mnt_type; /* Type of filesystem: ufs, nfs, etc. */ char *mnt_opts; /* Comma-separated options for fs. */ int mnt_freq; /* Dump frequency (in days). */ int mnt_passno; /* Pass number for `fsck'. */ }; /* Prepare to begin reading and/or writing mount table entries from the beginning of FILE. MODE is as for `fopen'. */ extern FILE *setmntent (const char *__file, const char *__mode) __THROW; /* Read one mount table entry from STREAM. Returns a pointer to storage reused on the next call, or null for EOF or error (use feof/ferror to check). */ extern struct mntent *getmntent (FILE *__stream) __THROW; #ifdef __USE_MISC /* Reentrant version of the above function. */ extern struct mntent *getmntent_r (FILE *__restrict __stream, struct mntent *__restrict __result, char *__restrict __buffer, int __bufsize) __THROW; #endif /* Write the mount table entry described by MNT to STREAM. Return zero on success, nonzero on failure. */ extern int addmntent (FILE *__restrict __stream, const struct mntent *__restrict __mnt) __THROW; /* Close a stream opened with `setmntent'. */ extern int endmntent (FILE *__stream) __THROW; /* Search MNT->mnt_opts for an option matching OPT. Returns the address of the substring, or null if none found. */ extern char *hasmntopt (const struct mntent *__mnt, const char *__opt) __THROW; __END_DECLS #endif /* mntent.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gssapi/mechglue.h�����������������������������������������������������������������������������������0000644�����������������00000003164�14763166026�0010013 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* #ident "@(#)mechglue.h 1.13 95/08/07 SMI" */ /* * Copyright 1996 by Sun Microsystems, Inc. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and * that both that copyright notice and this permission notice appear in * supporting documentation, and that the name of Sun Microsystems not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. Sun Microsystems makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ /* * This header contains the mechglue definitions. */ #ifndef _GSS_MECHGLUE_H #define _GSS_MECHGLUE_H #include <gssapi/gssapi.h> /********************************************************/ /* GSSAPI Extension functions -- these functions aren't */ /* in the GSSAPI, but they are provided in this library */ #include <gssapi/gssapi_ext.h> void KRB5_CALLCONV gss_initialize(void); #endif /* _GSS_MECHGLUE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gssapi/gssapi_krb5.h��������������������������������������������������������������������������������0000644�����������������00000025524�14763166026�0010437 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- mode: c; indent-tabs-mode: nil -*- */ /* * Copyright 1993 by OpenVision Technologies, Inc. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and * that both that copyright notice and this permission notice appear in * supporting documentation, and that the name of OpenVision not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. OpenVision makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _GSSAPI_KRB5_H_ #define _GSSAPI_KRB5_H_ #include <gssapi/gssapi.h> #include <gssapi/gssapi_ext.h> #include <krb5.h> #include <stdint.h> /* C++ friendlyness */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* Reserved static storage for GSS_oids. See rfc 1964 for more details. */ /* 2.1.1. Kerberos Principal Name Form: */ GSS_DLLIMP extern const gss_OID GSS_KRB5_NT_PRINCIPAL_NAME; /* This name form shall be represented by the Object Identifier {iso(1) * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2) * krb5(2) krb5_name(1)}. The recommended symbolic name for this type * is "GSS_KRB5_NT_PRINCIPAL_NAME". */ /* 2.1.2. Host-Based Service Name Form */ #define GSS_KRB5_NT_HOSTBASED_SERVICE_NAME GSS_C_NT_HOSTBASED_SERVICE /* This name form shall be represented by the Object Identifier {iso(1) * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2) * generic(1) service_name(4)}. The previously recommended symbolic * name for this type is "GSS_KRB5_NT_HOSTBASED_SERVICE_NAME". The * currently preferred symbolic name for this type is * "GSS_C_NT_HOSTBASED_SERVICE". */ /* 2.2.1. User Name Form */ #define GSS_KRB5_NT_USER_NAME GSS_C_NT_USER_NAME /* This name form shall be represented by the Object Identifier {iso(1) * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2) * generic(1) user_name(1)}. The recommended symbolic name for this * type is "GSS_KRB5_NT_USER_NAME". */ /* 2.2.2. Machine UID Form */ #define GSS_KRB5_NT_MACHINE_UID_NAME GSS_C_NT_MACHINE_UID_NAME /* This name form shall be represented by the Object Identifier {iso(1) * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2) * generic(1) machine_uid_name(2)}. The recommended symbolic name for * this type is "GSS_KRB5_NT_MACHINE_UID_NAME". */ /* 2.2.3. String UID Form */ #define GSS_KRB5_NT_STRING_UID_NAME GSS_C_NT_STRING_UID_NAME /* This name form shall be represented by the Object Identifier {iso(1) * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2) * generic(1) string_uid_name(3)}. The recommended symbolic name for * this type is "GSS_KRB5_NT_STRING_UID_NAME". */ GSS_DLLIMP extern const gss_OID gss_mech_krb5; GSS_DLLIMP extern const gss_OID gss_mech_krb5_old; GSS_DLLIMP extern const gss_OID gss_mech_krb5_wrong; GSS_DLLIMP extern const gss_OID gss_mech_iakerb; GSS_DLLIMP extern const gss_OID_set gss_mech_set_krb5; GSS_DLLIMP extern const gss_OID_set gss_mech_set_krb5_old; GSS_DLLIMP extern const gss_OID_set gss_mech_set_krb5_both; GSS_DLLIMP extern const gss_OID gss_nt_krb5_name; GSS_DLLIMP extern const gss_OID gss_nt_krb5_principal; GSS_DLLIMP extern const gss_OID_desc krb5_gss_oid_array[]; /* * This OID can be used with gss_set_cred_option() to suppress the * confidentiality and integrity flags from being asserted in initial context * tokens. * * iso(1) member-body(2) Sweden(752) Stockholm University(43) Heimdal GSS-API * Extensions(13) no_ci_flags(29) */ GSS_DLLIMP extern const gss_OID GSS_KRB5_CRED_NO_CI_FLAGS_X; #define gss_krb5_nt_general_name gss_nt_krb5_name #define gss_krb5_nt_principal gss_nt_krb5_principal #define gss_krb5_nt_service_name gss_nt_service_name #define gss_krb5_nt_user_name gss_nt_user_name #define gss_krb5_nt_machine_uid_name gss_nt_machine_uid_name #define gss_krb5_nt_string_uid_name gss_nt_string_uid_name typedef struct gss_krb5_lucid_key { OM_uint32 type; /* key encryption type */ OM_uint32 length; /* length of key data */ void * data; /* actual key data */ } gss_krb5_lucid_key_t; typedef struct gss_krb5_rfc1964_keydata { OM_uint32 sign_alg; /* signing algorthm */ OM_uint32 seal_alg; /* seal/encrypt algorithm */ gss_krb5_lucid_key_t ctx_key; /* Context key (Kerberos session key or subkey) */ } gss_krb5_rfc1964_keydata_t; typedef struct gss_krb5_cfx_keydata { OM_uint32 have_acceptor_subkey; /* 1 if there is an acceptor_subkey present, 0 otherwise */ gss_krb5_lucid_key_t ctx_key; /* Context key (Kerberos session key or subkey) */ gss_krb5_lucid_key_t acceptor_subkey; /* acceptor-asserted subkey or 0's if no acceptor subkey */ } gss_krb5_cfx_keydata_t; typedef struct gss_krb5_lucid_context_v1 { OM_uint32 version; /* Structure version number (1) MUST be at beginning of struct! */ OM_uint32 initiate; /* Are we the initiator? */ OM_uint32 endtime; /* expiration time of context */ uint64_t send_seq; /* sender sequence number */ uint64_t recv_seq; /* receive sequence number */ OM_uint32 protocol; /* 0: rfc1964, 1: draft-ietf-krb-wg-gssapi-cfx-07 */ /* * if (protocol == 0) rfc1964_kd should be used * and cfx_kd contents are invalid and should be zero * if (protocol == 1) cfx_kd should be used * and rfc1964_kd contents are invalid and should be zero */ gss_krb5_rfc1964_keydata_t rfc1964_kd; gss_krb5_cfx_keydata_t cfx_kd; } gss_krb5_lucid_context_v1_t; /* * Mask for determining the version of a lucid context structure. Callers * should not require this. */ typedef struct gss_krb5_lucid_context_version { OM_uint32 version; /* Structure version number */ } gss_krb5_lucid_context_version_t; /* Alias for Heimdal compat. */ #define gsskrb5_register_acceptor_identity krb5_gss_register_acceptor_identity OM_uint32 KRB5_CALLCONV krb5_gss_register_acceptor_identity(const char *); OM_uint32 KRB5_CALLCONV gss_krb5_get_tkt_flags( OM_uint32 *minor_status, gss_ctx_id_t context_handle, krb5_flags *ticket_flags); OM_uint32 KRB5_CALLCONV gss_krb5_copy_ccache( OM_uint32 *minor_status, gss_cred_id_t cred_handle, krb5_ccache out_ccache); OM_uint32 KRB5_CALLCONV gss_krb5_ccache_name( OM_uint32 *minor_status, const char *name, const char **out_name); /* * gss_krb5_set_allowable_enctypes * * This function may be called by a context initiator after calling * gss_acquire_cred(), but before calling gss_init_sec_context(), * to restrict the set of enctypes which will be negotiated during * context establishment to those in the provided array. * * 'cred' must be a valid credential handle obtained via * gss_acquire_cred(). It may not be GSS_C_NO_CREDENTIAL. * gss_acquire_cred() may have been called to get a handle to * the default credential. * * The purpose of this function is to limit the keys that may * be exported via gss_krb5_export_lucid_sec_context(); thus it * should limit the enctypes of all keys that will be needed * after the security context has been established. * (i.e. context establishment may use a session key with a * stronger enctype than in the provided array, however a * subkey must be established within the enctype limits * established by this function.) * */ OM_uint32 KRB5_CALLCONV gss_krb5_set_allowable_enctypes(OM_uint32 *minor_status, gss_cred_id_t cred, OM_uint32 num_ktypes, krb5_enctype *ktypes); /* * Returns a non-opaque (lucid) version of the internal context * information. * * Note that context_handle must not be used again by the caller * after this call. The GSS implementation is free to release any * resources associated with the original context. It is up to the * GSS implementation whether it returns pointers to existing data, * or copies of the data. The caller should treat the returned * lucid context as read-only. * * The caller must call gss_krb5_free_lucid_context() to free * the context and allocated resources when it is finished with it. * * 'version' is an integer indicating the requested version of the lucid * context. If the implementation does not understand the requested version, * it will return an error. * * For example: * void *return_ctx; * gss_krb5_lucid_context_v1_t *ctx; * OM_uint32 min_stat, maj_stat; * OM_uint32 vers; * gss_ctx_id_t *ctx_handle; * * maj_stat = gss_krb5_export_lucid_sec_context(&min_stat, * ctx_handle, 1, &return_ctx); * // Verify success * ctx = (gss_krb5_lucid_context_v1_t *) return_ctx; */ OM_uint32 KRB5_CALLCONV gss_krb5_export_lucid_sec_context(OM_uint32 *minor_status, gss_ctx_id_t *context_handle, OM_uint32 version, void **kctx); /* * Frees the allocated storage associated with an * exported struct gss_krb5_lucid_context. */ OM_uint32 KRB5_CALLCONV gss_krb5_free_lucid_sec_context(OM_uint32 *minor_status, void *kctx); OM_uint32 KRB5_CALLCONV gsskrb5_extract_authz_data_from_sec_context(OM_uint32 *minor_status, const gss_ctx_id_t context_handle, int ad_type, gss_buffer_t ad_data); OM_uint32 KRB5_CALLCONV gss_krb5_set_cred_rcache(OM_uint32 *minor_status, gss_cred_id_t cred, krb5_rcache rcache); OM_uint32 KRB5_CALLCONV gsskrb5_extract_authtime_from_sec_context(OM_uint32 *, gss_ctx_id_t, krb5_timestamp *); OM_uint32 KRB5_CALLCONV gss_krb5_import_cred(OM_uint32 *minor_status, krb5_ccache id, krb5_principal keytab_principal, krb5_keytab keytab, gss_cred_id_t *cred); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _GSSAPI_KRB5_H_ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������gssapi/gssapi_generic.h�����������������������������������������������������������������������������0000644�����������������00000004251�14763166026�0011202 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 1993 by OpenVision Technologies, Inc. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and * that both that copyright notice and this permission notice appear in * supporting documentation, and that the name of OpenVision not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. OpenVision makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _GSSAPI_GENERIC_H_ #define _GSSAPI_GENERIC_H_ /* * $Id$ */ #include <gssapi/gssapi.h> #if defined(__cplusplus) && !defined(GSSAPIGENERIC_BEGIN_DECLS) #define GSSAPIGENERIC_BEGIN_DECLS extern "C" { #define GSSAPIGENERIC_END_DECLS } #else #define GSSAPIGENERIC_BEGIN_DECLS #define GSSAPIGENERIC_END_DECLS #endif #define GSS_EMPTY_BUFFER(buf) ((buf) == NULL || \ (buf)->value == NULL || (buf)->length == 0) GSSAPIGENERIC_BEGIN_DECLS /* Deprecated MIT krb5 oid names provided for compatibility. * The correct oids (GSS_C_NT_USER_NAME, etc) from rfc 2744 * are defined in gssapi.h. */ GSS_DLLIMP extern gss_OID gss_nt_user_name; GSS_DLLIMP extern gss_OID gss_nt_machine_uid_name; GSS_DLLIMP extern gss_OID gss_nt_string_uid_name; extern gss_OID gss_nt_service_name_v2; GSS_DLLIMP extern gss_OID gss_nt_service_name; extern gss_OID gss_nt_exported_name; GSSAPIGENERIC_END_DECLS #endif /* _GSSAPI_GENERIC_H_ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gssapi/gssapi.h�������������������������������������������������������������������������������������0000644�����������������00000072321�14763166026�0007511 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* This is the gssapi.h prologue. */ /* no xom.h */ /* End of gssapi.h prologue. */ /* -*- mode: c; indent-tabs-mode: nil -*- */ /* * Copyright 1993 by OpenVision Technologies, Inc. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appears in all copies and * that both that copyright notice and this permission notice appear in * supporting documentation, and that the name of OpenVision not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. OpenVision makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _GSSAPI_H_ #define _GSSAPI_H_ /* * Determine platform-dependent configuration. */ #if defined(__MACH__) && defined(__APPLE__) # include <TargetConditionals.h> # if TARGET_RT_MAC_CFM # error "Use KfM 4.0 SDK headers for CFM compilation." # endif #endif #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #if TARGET_OS_MAC # pragma pack(push,2) #endif #if defined(_MSDOS) || defined(_WIN32) #include <win-mac.h> #endif #ifndef KRB5_CALLCONV #define KRB5_CALLCONV #define KRB5_CALLCONV_C #endif #include <stdint.h> /* * First, include stddef.h to get size_t defined. */ #include <stddef.h> /* * POSIX says that sys/types.h is where size_t is defined. */ #include <sys/types.h> /* * $Id$ */ /* * First, define the three platform-dependent pointer types. */ struct gss_name_struct; typedef struct gss_name_struct * gss_name_t; struct gss_cred_id_struct; typedef struct gss_cred_id_struct * gss_cred_id_t; struct gss_ctx_id_struct; typedef struct gss_ctx_id_struct * gss_ctx_id_t; /* * The following type must be defined as the smallest natural unsigned integer * supported by the platform that has at least 32 bits of precision. */ typedef uint32_t gss_uint32; typedef int32_t gss_int32; #ifdef OM_STRING /* * We have included the xom.h header file. Use the definition for * OM_object identifier. */ typedef OM_object_identifier gss_OID_desc, *gss_OID; #else /* OM_STRING */ /* * We can't use X/Open definitions, so roll our own. */ typedef gss_uint32 OM_uint32; typedef struct gss_OID_desc_struct { OM_uint32 length; void *elements; } gss_OID_desc, *gss_OID; #endif /* OM_STRING */ typedef struct gss_OID_set_desc_struct { size_t count; gss_OID elements; } gss_OID_set_desc, *gss_OID_set; typedef struct gss_buffer_desc_struct { size_t length; void *value; } gss_buffer_desc, *gss_buffer_t; typedef struct gss_channel_bindings_struct { OM_uint32 initiator_addrtype; gss_buffer_desc initiator_address; OM_uint32 acceptor_addrtype; gss_buffer_desc acceptor_address; gss_buffer_desc application_data; } *gss_channel_bindings_t; /* * For now, define a QOP-type as an OM_uint32 (pending resolution of ongoing * discussions). */ typedef OM_uint32 gss_qop_t; typedef int gss_cred_usage_t; /* * Flag bits for context-level services. */ #define GSS_C_DELEG_FLAG 1 #define GSS_C_MUTUAL_FLAG 2 #define GSS_C_REPLAY_FLAG 4 #define GSS_C_SEQUENCE_FLAG 8 #define GSS_C_CONF_FLAG 16 #define GSS_C_INTEG_FLAG 32 #define GSS_C_ANON_FLAG 64 #define GSS_C_PROT_READY_FLAG 128 #define GSS_C_TRANS_FLAG 256 #define GSS_C_DELEG_POLICY_FLAG 32768 /* * Credential usage options */ #define GSS_C_BOTH 0 #define GSS_C_INITIATE 1 #define GSS_C_ACCEPT 2 /* * Status code types for gss_display_status */ #define GSS_C_GSS_CODE 1 #define GSS_C_MECH_CODE 2 /* * The constant definitions for channel-bindings address families */ #define GSS_C_AF_UNSPEC 0 #define GSS_C_AF_LOCAL 1 #define GSS_C_AF_INET 2 #define GSS_C_AF_IMPLINK 3 #define GSS_C_AF_PUP 4 #define GSS_C_AF_CHAOS 5 #define GSS_C_AF_NS 6 #define GSS_C_AF_NBS 7 #define GSS_C_AF_ECMA 8 #define GSS_C_AF_DATAKIT 9 #define GSS_C_AF_CCITT 10 #define GSS_C_AF_SNA 11 #define GSS_C_AF_DECnet 12 #define GSS_C_AF_DLI 13 #define GSS_C_AF_LAT 14 #define GSS_C_AF_HYLINK 15 #define GSS_C_AF_APPLETALK 16 #define GSS_C_AF_BSC 17 #define GSS_C_AF_DSS 18 #define GSS_C_AF_OSI 19 #define GSS_C_AF_NETBIOS 20 #define GSS_C_AF_X25 21 #define GSS_C_AF_NULLADDR 255 /* * Various Null values. */ #define GSS_C_NO_NAME ((gss_name_t) 0) #define GSS_C_NO_BUFFER ((gss_buffer_t) 0) #define GSS_C_NO_OID ((gss_OID) 0) #define GSS_C_NO_OID_SET ((gss_OID_set) 0) #define GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0) #define GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0) #define GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0) #define GSS_C_EMPTY_BUFFER {0, NULL} /* * Some alternate names for a couple of the above values. These are defined * for V1 compatibility. */ #define GSS_C_NULL_OID GSS_C_NO_OID #define GSS_C_NULL_OID_SET GSS_C_NO_OID_SET /* * Define the default Quality of Protection for per-message services. Note * that an implementation that offers multiple levels of QOP may either reserve * a value (for example zero, as assumed here) to mean "default protection", or * alternatively may simply equate GSS_C_QOP_DEFAULT to a specific explicit * QOP value. However a value of 0 should always be interpreted by a GSSAPI * implementation as a request for the default protection level. */ #define GSS_C_QOP_DEFAULT 0 /* * Expiration time of 2^32-1 seconds means infinite lifetime for a * credential or security context */ #define GSS_C_INDEFINITE ((OM_uint32) 0xfffffffful) /* Major status codes */ #define GSS_S_COMPLETE 0 /* * Some "helper" definitions to make the status code macros obvious. */ #define GSS_C_CALLING_ERROR_OFFSET 24 #define GSS_C_ROUTINE_ERROR_OFFSET 16 #define GSS_C_SUPPLEMENTARY_OFFSET 0 #define GSS_C_CALLING_ERROR_MASK ((OM_uint32) 0377ul) #define GSS_C_ROUTINE_ERROR_MASK ((OM_uint32) 0377ul) #define GSS_C_SUPPLEMENTARY_MASK ((OM_uint32) 0177777ul) /* * The macros that test status codes for error conditions. Note that the * GSS_ERROR() macro has changed slightly from the V1 GSSAPI so that it now * evaluates its argument only once. */ #define GSS_CALLING_ERROR(x) \ ((x) & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET)) #define GSS_ROUTINE_ERROR(x) \ ((x) & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET)) #define GSS_SUPPLEMENTARY_INFO(x) \ ((x) & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET)) #define GSS_ERROR(x) \ ((x) & ((GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET) | \ (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))) /* * Now the actual status code definitions */ /* * Calling errors: */ #define GSS_S_CALL_INACCESSIBLE_READ \ (((OM_uint32) 1ul) << GSS_C_CALLING_ERROR_OFFSET) #define GSS_S_CALL_INACCESSIBLE_WRITE \ (((OM_uint32) 2ul) << GSS_C_CALLING_ERROR_OFFSET) #define GSS_S_CALL_BAD_STRUCTURE \ (((OM_uint32) 3ul) << GSS_C_CALLING_ERROR_OFFSET) /* * Routine errors: */ #define GSS_S_BAD_MECH (((OM_uint32) 1ul) << GSS_C_ROUTINE_ERROR_OFFSET) #define GSS_S_BAD_NAME (((OM_uint32) 2ul) << GSS_C_ROUTINE_ERROR_OFFSET) #define GSS_S_BAD_NAMETYPE (((OM_uint32) 3ul) << GSS_C_ROUTINE_ERROR_OFFSET) #define GSS_S_BAD_BINDINGS (((OM_uint32) 4ul) << GSS_C_ROUTINE_ERROR_OFFSET) #define GSS_S_BAD_STATUS (((OM_uint32) 5ul) << GSS_C_ROUTINE_ERROR_OFFSET) #define GSS_S_BAD_SIG (((OM_uint32) 6ul) << GSS_C_ROUTINE_ERROR_OFFSET) #define GSS_S_BAD_MIC GSS_S_BAD_SIG #define GSS_S_NO_CRED (((OM_uint32) 7ul) << GSS_C_ROUTINE_ERROR_OFFSET) #define GSS_S_NO_CONTEXT (((OM_uint32) 8ul) << GSS_C_ROUTINE_ERROR_OFFSET) #define GSS_S_DEFECTIVE_TOKEN (((OM_uint32) 9ul) << GSS_C_ROUTINE_ERROR_OFFSET) #define GSS_S_DEFECTIVE_CREDENTIAL \ (((OM_uint32) 10ul) << GSS_C_ROUTINE_ERROR_OFFSET) #define GSS_S_CREDENTIALS_EXPIRED \ (((OM_uint32) 11ul) << GSS_C_ROUTINE_ERROR_OFFSET) #define GSS_S_CONTEXT_EXPIRED \ (((OM_uint32) 12ul) << GSS_C_ROUTINE_ERROR_OFFSET) #define GSS_S_FAILURE (((OM_uint32) 13ul) << GSS_C_ROUTINE_ERROR_OFFSET) #define GSS_S_BAD_QOP (((OM_uint32) 14ul) << GSS_C_ROUTINE_ERROR_OFFSET) #define GSS_S_UNAUTHORIZED (((OM_uint32) 15ul) << GSS_C_ROUTINE_ERROR_OFFSET) #define GSS_S_UNAVAILABLE (((OM_uint32) 16ul) << GSS_C_ROUTINE_ERROR_OFFSET) #define GSS_S_DUPLICATE_ELEMENT \ (((OM_uint32) 17ul) << GSS_C_ROUTINE_ERROR_OFFSET) #define GSS_S_NAME_NOT_MN \ (((OM_uint32) 18ul) << GSS_C_ROUTINE_ERROR_OFFSET) #define GSS_S_BAD_MECH_ATTR \ (((OM_uint32) 19ul) << GSS_C_ROUTINE_ERROR_OFFSET) /* * Supplementary info bits: */ #define GSS_S_CONTINUE_NEEDED (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 0)) #define GSS_S_DUPLICATE_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 1)) #define GSS_S_OLD_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 2)) #define GSS_S_UNSEQ_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 3)) #define GSS_S_GAP_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 4)) /* * Finally, function prototypes for the GSSAPI routines. */ #if defined (_WIN32) && defined (_MSC_VER) # ifdef GSS_DLL_FILE # define GSS_DLLIMP __declspec(dllexport) # else # define GSS_DLLIMP __declspec(dllimport) # endif #else # define GSS_DLLIMP #endif /* Reserved static storage for GSS_oids. Comments are quotes from RFC 2744. * * The implementation must reserve static storage for a * gss_OID_desc object containing the value * {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x01"}, * corresponding to an object-identifier value of * {iso(1) member-body(2) United States(840) mit(113554) * infosys(1) gssapi(2) generic(1) user_name(1)}. The constant * GSS_C_NT_USER_NAME should be initialized to point * to that gss_OID_desc. */ GSS_DLLIMP extern gss_OID GSS_C_NT_USER_NAME; /* * The implementation must reserve static storage for a * gss_OID_desc object containing the value * {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x02"}, * corresponding to an object-identifier value of * {iso(1) member-body(2) United States(840) mit(113554) * infosys(1) gssapi(2) generic(1) machine_uid_name(2)}. * The constant GSS_C_NT_MACHINE_UID_NAME should be * initialized to point to that gss_OID_desc. */ GSS_DLLIMP extern gss_OID GSS_C_NT_MACHINE_UID_NAME; /* * The implementation must reserve static storage for a * gss_OID_desc object containing the value * {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x03"}, * corresponding to an object-identifier value of * {iso(1) member-body(2) United States(840) mit(113554) * infosys(1) gssapi(2) generic(1) string_uid_name(3)}. * The constant GSS_C_NT_STRING_UID_NAME should be * initialized to point to that gss_OID_desc. */ GSS_DLLIMP extern gss_OID GSS_C_NT_STRING_UID_NAME; /* * The implementation must reserve static storage for a * gss_OID_desc object containing the value * {6, (void *)"\x2b\x06\x01\x05\x06\x02"}, * corresponding to an object-identifier value of * {iso(1) org(3) dod(6) internet(1) security(5) * nametypes(6) gss-host-based-services(2)). The constant * GSS_C_NT_HOSTBASED_SERVICE_X should be initialized to point * to that gss_OID_desc. This is a deprecated OID value, and * implementations wishing to support hostbased-service names * should instead use the GSS_C_NT_HOSTBASED_SERVICE OID, * defined below, to identify such names; * GSS_C_NT_HOSTBASED_SERVICE_X should be accepted a synonym * for GSS_C_NT_HOSTBASED_SERVICE when presented as an input * parameter, but should not be emitted by GSS-API * implementations */ GSS_DLLIMP extern gss_OID GSS_C_NT_HOSTBASED_SERVICE_X; /* * The implementation must reserve static storage for a * gss_OID_desc object containing the value * {10, (void *)"\x2a\x86\x48\x86\xf7\x12" * "\x01\x02\x01\x04"}, corresponding to an * object-identifier value of {iso(1) member-body(2) * Unites States(840) mit(113554) infosys(1) gssapi(2) * generic(1) service_name(4)}. The constant * GSS_C_NT_HOSTBASED_SERVICE should be initialized * to point to that gss_OID_desc. */ GSS_DLLIMP extern gss_OID GSS_C_NT_HOSTBASED_SERVICE; /* * The implementation must reserve static storage for a * gss_OID_desc object containing the value * {6, (void *)"\x2b\x06\01\x05\x06\x03"}, * corresponding to an object identifier value of * {1(iso), 3(org), 6(dod), 1(internet), 5(security), * 6(nametypes), 3(gss-anonymous-name)}. The constant * and GSS_C_NT_ANONYMOUS should be initialized to point * to that gss_OID_desc. */ GSS_DLLIMP extern gss_OID GSS_C_NT_ANONYMOUS; /* * The implementation must reserve static storage for a * gss_OID_desc object containing the value * {6, (void *)"\x2b\x06\x01\x05\x06\x04"}, * corresponding to an object-identifier value of * {1(iso), 3(org), 6(dod), 1(internet), 5(security), * 6(nametypes), 4(gss-api-exported-name)}. The constant * GSS_C_NT_EXPORT_NAME should be initialized to point * to that gss_OID_desc. */ GSS_DLLIMP extern gss_OID GSS_C_NT_EXPORT_NAME; /* Function Prototypes */ OM_uint32 KRB5_CALLCONV gss_acquire_cred( OM_uint32 *, /* minor_status */ gss_name_t, /* desired_name */ OM_uint32, /* time_req */ gss_OID_set, /* desired_mechs */ gss_cred_usage_t, /* cred_usage */ gss_cred_id_t *, /* output_cred_handle */ gss_OID_set *, /* actual_mechs */ OM_uint32 *); /* time_rec */ OM_uint32 KRB5_CALLCONV gss_release_cred( OM_uint32 *, /* minor_status */ gss_cred_id_t *); /* cred_handle */ OM_uint32 KRB5_CALLCONV gss_init_sec_context( OM_uint32 *, /* minor_status */ gss_cred_id_t, /* claimant_cred_handle */ gss_ctx_id_t *, /* context_handle */ gss_name_t, /* target_name */ gss_OID, /* mech_type (used to be const) */ OM_uint32, /* req_flags */ OM_uint32, /* time_req */ gss_channel_bindings_t, /* input_chan_bindings */ gss_buffer_t, /* input_token */ gss_OID *, /* actual_mech_type */ gss_buffer_t, /* output_token */ OM_uint32 *, /* ret_flags */ OM_uint32 *); /* time_rec */ OM_uint32 KRB5_CALLCONV gss_accept_sec_context( OM_uint32 *, /* minor_status */ gss_ctx_id_t *, /* context_handle */ gss_cred_id_t, /* acceptor_cred_handle */ gss_buffer_t, /* input_token_buffer */ gss_channel_bindings_t, /* input_chan_bindings */ gss_name_t *, /* src_name */ gss_OID *, /* mech_type */ gss_buffer_t, /* output_token */ OM_uint32 *, /* ret_flags */ OM_uint32 *, /* time_rec */ gss_cred_id_t *); /* delegated_cred_handle */ OM_uint32 KRB5_CALLCONV gss_process_context_token( OM_uint32 *, /* minor_status */ gss_ctx_id_t, /* context_handle */ gss_buffer_t); /* token_buffer */ OM_uint32 KRB5_CALLCONV gss_delete_sec_context( OM_uint32 *, /* minor_status */ gss_ctx_id_t *, /* context_handle */ gss_buffer_t); /* output_token */ OM_uint32 KRB5_CALLCONV gss_context_time( OM_uint32 *, /* minor_status */ gss_ctx_id_t, /* context_handle */ OM_uint32 *); /* time_rec */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_get_mic( OM_uint32 *, /* minor_status */ gss_ctx_id_t, /* context_handle */ gss_qop_t, /* qop_req */ gss_buffer_t, /* message_buffer */ gss_buffer_t); /* message_token */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_verify_mic(OM_uint32 *, /* minor_status */ gss_ctx_id_t, /* context_handle */ gss_buffer_t, /* message_buffer */ gss_buffer_t, /* message_token */ gss_qop_t * /* qop_state */ ); /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_wrap( OM_uint32 *, /* minor_status */ gss_ctx_id_t, /* context_handle */ int, /* conf_req_flag */ gss_qop_t, /* qop_req */ gss_buffer_t, /* input_message_buffer */ int *, /* conf_state */ gss_buffer_t); /* output_message_buffer */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_unwrap( OM_uint32 *, /* minor_status */ gss_ctx_id_t, /* context_handle */ gss_buffer_t, /* input_message_buffer */ gss_buffer_t, /* output_message_buffer */ int *, /* conf_state */ gss_qop_t *); /* qop_state */ OM_uint32 KRB5_CALLCONV gss_display_status( OM_uint32 *, /* minor_status */ OM_uint32, /* status_value */ int, /* status_type */ gss_OID, /* mech_type (used to be const) */ OM_uint32 *, /* message_context */ gss_buffer_t); /* status_string */ OM_uint32 KRB5_CALLCONV gss_indicate_mechs( OM_uint32 *, /* minor_status */ gss_OID_set *); /* mech_set */ OM_uint32 KRB5_CALLCONV gss_compare_name( OM_uint32 *, /* minor_status */ gss_name_t, /* name1 */ gss_name_t, /* name2 */ int *); /* name_equal */ OM_uint32 KRB5_CALLCONV gss_display_name( OM_uint32 *, /* minor_status */ gss_name_t, /* input_name */ gss_buffer_t, /* output_name_buffer */ gss_OID *); /* output_name_type */ OM_uint32 KRB5_CALLCONV gss_import_name( OM_uint32 *, /* minor_status */ gss_buffer_t, /* input_name_buffer */ gss_OID, /* input_name_type(used to be const) */ gss_name_t *); /* output_name */ OM_uint32 KRB5_CALLCONV gss_release_name( OM_uint32 *, /* minor_status */ gss_name_t *); /* input_name */ OM_uint32 KRB5_CALLCONV gss_release_buffer( OM_uint32 *, /* minor_status */ gss_buffer_t); /* buffer */ OM_uint32 KRB5_CALLCONV gss_release_oid_set( OM_uint32 *, /* minor_status */ gss_OID_set *); /* set */ OM_uint32 KRB5_CALLCONV gss_inquire_cred( OM_uint32 *, /* minor_status */ gss_cred_id_t, /* cred_handle */ gss_name_t *, /* name */ OM_uint32 *, /* lifetime */ gss_cred_usage_t *, /* cred_usage */ gss_OID_set *); /* mechanisms */ /* Last argument new for V2 */ OM_uint32 KRB5_CALLCONV gss_inquire_context( OM_uint32 *, /* minor_status */ gss_ctx_id_t, /* context_handle */ gss_name_t *, /* src_name */ gss_name_t *, /* targ_name */ OM_uint32 *, /* lifetime_rec */ gss_OID *, /* mech_type */ OM_uint32 *, /* ctx_flags */ int *, /* locally_initiated */ int *); /* open */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_wrap_size_limit( OM_uint32 *, /* minor_status */ gss_ctx_id_t, /* context_handle */ int, /* conf_req_flag */ gss_qop_t, /* qop_req */ OM_uint32, /* req_output_size */ OM_uint32 *); /* max_input_size */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_import_name_object( OM_uint32 *, /* minor_status */ void *, /* input_name */ gss_OID, /* input_name_type */ gss_name_t *); /* output_name */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_export_name_object( OM_uint32 *, /* minor_status */ gss_name_t, /* input_name */ gss_OID, /* desired_name_type */ void **); /* output_name */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_add_cred( OM_uint32 *, /* minor_status */ gss_cred_id_t, /* input_cred_handle */ gss_name_t, /* desired_name */ gss_OID, /* desired_mech */ gss_cred_usage_t, /* cred_usage */ OM_uint32, /* initiator_time_req */ OM_uint32, /* acceptor_time_req */ gss_cred_id_t *, /* output_cred_handle */ gss_OID_set *, /* actual_mechs */ OM_uint32 *, /* initiator_time_rec */ OM_uint32 *); /* acceptor_time_rec */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_inquire_cred_by_mech( OM_uint32 *, /* minor_status */ gss_cred_id_t, /* cred_handle */ gss_OID, /* mech_type */ gss_name_t *, /* name */ OM_uint32 *, /* initiator_lifetime */ OM_uint32 *, /* acceptor_lifetime */ gss_cred_usage_t *); /* cred_usage */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_export_sec_context( OM_uint32 *, /* minor_status */ gss_ctx_id_t *, /* context_handle */ gss_buffer_t); /* interprocess_token */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_import_sec_context( OM_uint32 *, /* minor_status */ gss_buffer_t, /* interprocess_token */ gss_ctx_id_t *); /* context_handle */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_release_oid( OM_uint32 *, /* minor_status */ gss_OID *); /* oid */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_create_empty_oid_set( OM_uint32 *, /* minor_status */ gss_OID_set *); /* oid_set */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_add_oid_set_member( OM_uint32 *, /* minor_status */ gss_OID, /* member_oid */ gss_OID_set *); /* oid_set */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_test_oid_set_member( OM_uint32 *, /* minor_status */ gss_OID, /* member */ gss_OID_set, /* set */ int *); /* present */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_str_to_oid( OM_uint32 *, /* minor_status */ gss_buffer_t, /* oid_str */ gss_OID *); /* oid */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_oid_to_str( OM_uint32 *, /* minor_status */ gss_OID, /* oid */ gss_buffer_t); /* oid_str */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_inquire_names_for_mech( OM_uint32 *, /* minor_status */ gss_OID, /* mechanism */ gss_OID_set *); /* name_types */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_inquire_mechs_for_name( OM_uint32 *, /* minor_status */ const gss_name_t, /* input_name */ gss_OID_set *); /* mech_types */ /* * The following routines are obsolete variants of gss_get_mic, gss_wrap, * gss_verify_mic and gss_unwrap. They should be provided by GSSAPI V2 * implementations for backwards compatibility with V1 applications. Distinct * entrypoints (as opposed to #defines) should be provided, to allow GSSAPI * V1 applications to link against GSSAPI V2 implementations. */ OM_uint32 KRB5_CALLCONV gss_sign( OM_uint32 *, /* minor_status */ gss_ctx_id_t, /* context_handle */ int, /* qop_req */ gss_buffer_t, /* message_buffer */ gss_buffer_t); /* message_token */ OM_uint32 KRB5_CALLCONV gss_verify( OM_uint32 *, /* minor_status */ gss_ctx_id_t, /* context_handle */ gss_buffer_t, /* message_buffer */ gss_buffer_t, /* token_buffer */ int *); /* qop_state */ OM_uint32 KRB5_CALLCONV gss_seal( OM_uint32 *, /* minor_status */ gss_ctx_id_t, /* context_handle */ int, /* conf_req_flag */ int, /* qop_req */ gss_buffer_t, /* input_message_buffer */ int *, /* conf_state */ gss_buffer_t); /* output_message_buffer */ OM_uint32 KRB5_CALLCONV gss_unseal( OM_uint32 *, /* minor_status */ gss_ctx_id_t, /* context_handle */ gss_buffer_t, /* input_message_buffer */ gss_buffer_t, /* output_message_buffer */ int *, /* conf_state */ int *); /* qop_state */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_export_name( OM_uint32 *, /* minor_status */ const gss_name_t, /* input_name */ gss_buffer_t); /* exported_name */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_duplicate_name( OM_uint32 *, /* minor_status */ const gss_name_t, /* input_name */ gss_name_t *); /* dest_name */ /* New for V2 */ OM_uint32 KRB5_CALLCONV gss_canonicalize_name( OM_uint32 *, /* minor_status */ const gss_name_t, /* input_name */ const gss_OID, /* mech_type */ gss_name_t *); /* output_name */ /* RFC 4401 */ #define GSS_C_PRF_KEY_FULL 0 #define GSS_C_PRF_KEY_PARTIAL 1 OM_uint32 KRB5_CALLCONV gss_pseudo_random( OM_uint32 *, /* minor_status */ gss_ctx_id_t, /* context */ int, /* prf_key */ const gss_buffer_t, /* prf_in */ ssize_t, /* desired_output_len */ gss_buffer_t); /* prf_out */ OM_uint32 KRB5_CALLCONV gss_store_cred( OM_uint32 *, /* minor_status */ const gss_cred_id_t,/* input_cred_handle */ gss_cred_usage_t, /* input_usage */ const gss_OID, /* desired_mech */ OM_uint32, /* overwrite_cred */ OM_uint32, /* default_cred */ gss_OID_set *, /* elements_stored */ gss_cred_usage_t *);/* cred_usage_stored */ OM_uint32 KRB5_CALLCONV gss_set_neg_mechs( OM_uint32 *, /* minor_status */ gss_cred_id_t, /* cred_handle */ const gss_OID_set); /* mech_set */ #if TARGET_OS_MAC # pragma pack(pop) #endif #ifdef __cplusplus } #endif /* XXXX these are not part of the GSSAPI C bindings! (but should be) */ #define GSS_CALLING_ERROR_FIELD(x) \ (((x) >> GSS_C_CALLING_ERROR_OFFSET) & GSS_C_CALLING_ERROR_MASK) #define GSS_ROUTINE_ERROR_FIELD(x) \ (((x) >> GSS_C_ROUTINE_ERROR_OFFSET) & GSS_C_ROUTINE_ERROR_MASK) #define GSS_SUPPLEMENTARY_INFO_FIELD(x) \ (((x) >> GSS_C_SUPPLEMENTARY_OFFSET) & GSS_C_SUPPLEMENTARY_MASK) /* XXXX This is a necessary evil until the spec is fixed */ #define GSS_S_CRED_UNAVAIL GSS_S_FAILURE /* * RFC 5587 */ typedef const gss_buffer_desc *gss_const_buffer_t; typedef const struct gss_channel_bindings_struct *gss_const_channel_bindings_t; typedef const struct gss_ctx_id_struct *gss_const_ctx_id_t; typedef const struct gss_cred_id_struct *gss_const_cred_id_t; typedef const struct gss_name_struct *gss_const_name_t; typedef const gss_OID_desc *gss_const_OID; typedef const gss_OID_set_desc *gss_const_OID_set; OM_uint32 KRB5_CALLCONV gss_indicate_mechs_by_attrs( OM_uint32 *, /* minor_status */ gss_const_OID_set, /* desired_mech_attrs */ gss_const_OID_set, /* except_mech_attrs */ gss_const_OID_set, /* critical_mech_attrs */ gss_OID_set *); /* mechs */ OM_uint32 KRB5_CALLCONV gss_inquire_attrs_for_mech( OM_uint32 *, /* minor_status */ gss_const_OID, /* mech */ gss_OID_set *, /* mech_attrs */ gss_OID_set *); /* known_mech_attrs */ OM_uint32 KRB5_CALLCONV gss_display_mech_attr( OM_uint32 *, /* minor_status */ gss_const_OID, /* mech_attr */ gss_buffer_t, /* name */ gss_buffer_t, /* short_desc */ gss_buffer_t); /* long_desc */ GSS_DLLIMP extern gss_const_OID GSS_C_MA_MECH_CONCRETE; GSS_DLLIMP extern gss_const_OID GSS_C_MA_MECH_PSEUDO; GSS_DLLIMP extern gss_const_OID GSS_C_MA_MECH_COMPOSITE; GSS_DLLIMP extern gss_const_OID GSS_C_MA_MECH_NEGO; GSS_DLLIMP extern gss_const_OID GSS_C_MA_MECH_GLUE; GSS_DLLIMP extern gss_const_OID GSS_C_MA_NOT_MECH; GSS_DLLIMP extern gss_const_OID GSS_C_MA_DEPRECATED; GSS_DLLIMP extern gss_const_OID GSS_C_MA_NOT_DFLT_MECH; GSS_DLLIMP extern gss_const_OID GSS_C_MA_ITOK_FRAMED; GSS_DLLIMP extern gss_const_OID GSS_C_MA_AUTH_INIT; GSS_DLLIMP extern gss_const_OID GSS_C_MA_AUTH_TARG; GSS_DLLIMP extern gss_const_OID GSS_C_MA_AUTH_INIT_INIT; GSS_DLLIMP extern gss_const_OID GSS_C_MA_AUTH_TARG_INIT; GSS_DLLIMP extern gss_const_OID GSS_C_MA_AUTH_INIT_ANON; GSS_DLLIMP extern gss_const_OID GSS_C_MA_AUTH_TARG_ANON; GSS_DLLIMP extern gss_const_OID GSS_C_MA_DELEG_CRED; GSS_DLLIMP extern gss_const_OID GSS_C_MA_INTEG_PROT; GSS_DLLIMP extern gss_const_OID GSS_C_MA_CONF_PROT; GSS_DLLIMP extern gss_const_OID GSS_C_MA_MIC; GSS_DLLIMP extern gss_const_OID GSS_C_MA_WRAP; GSS_DLLIMP extern gss_const_OID GSS_C_MA_PROT_READY; GSS_DLLIMP extern gss_const_OID GSS_C_MA_REPLAY_DET; GSS_DLLIMP extern gss_const_OID GSS_C_MA_OOS_DET; GSS_DLLIMP extern gss_const_OID GSS_C_MA_CBINDINGS; GSS_DLLIMP extern gss_const_OID GSS_C_MA_PFS; GSS_DLLIMP extern gss_const_OID GSS_C_MA_COMPRESS; GSS_DLLIMP extern gss_const_OID GSS_C_MA_CTX_TRANS; /* * RFC 5801 */ OM_uint32 KRB5_CALLCONV gss_inquire_saslname_for_mech( OM_uint32 *, /* minor_status */ const gss_OID, /* desired_mech */ gss_buffer_t, /* sasl_mech_name */ gss_buffer_t, /* mech_name */ gss_buffer_t /* mech_description */ ); OM_uint32 KRB5_CALLCONV gss_inquire_mech_for_saslname( OM_uint32 *, /* minor_status */ const gss_buffer_t, /* sasl_mech_name */ gss_OID * /* mech_type */ ); #endif /* _GSSAPI_H_ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gssapi/gssapi_ext.h���������������������������������������������������������������������������������0000644�����������������00000045450�14763166026�0010374 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright 2008 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of M.I.T. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a * fashion that it might be confused with the original M.I.T. software. * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. */ #ifndef GSSAPI_EXT_H_ #define GSSAPI_EXT_H_ #include <gssapi/gssapi.h> #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* * Solaris extensions */ #ifndef _WIN32 OM_uint32 KRB5_CALLCONV gss_pname_to_uid (OM_uint32 *minor, const gss_name_t name, const gss_OID mech_type, uid_t *uidOut); #endif /** * Provides a platform-specific name for a GSSAPI name as interpreted by a * given mechanism. * * @param [out] minor Minor status code * @param [in] name The gss name resulting from accept_sec_context * @param [in] mech_type The mechanism that will be asked to map @a name to a * local name * @param [out] localname Caller-allocated buffer to be filled in with the * local name on success */ OM_uint32 KRB5_CALLCONV gss_localname (OM_uint32 *minor, const gss_name_t name, gss_const_OID mech_type, gss_buffer_t localname); /** * Determine whether a mechanism name is authorized to act as a username. * * @param [in] name Mechanism name * @param [in] username System username * * This is a simple wrapper around gss_authorize_localname(). It only supports * system usernames as local names, and cannot distinguish between lack of * authorization and other errors. * * @retval 1 @a name is authorized to act as @a username * @retval 0 @a name is not authorized or an error occurred */ int KRB5_CALLCONV gss_userok(const gss_name_t name, const char *username); /** * Determine whether a mechanism name is authorized to act as a local name. * * @param [out] minor Minor status code * @param [in] name Mechanism name * @param [in] user Local name * * @a name is a mechanism name, typically the result of a completed * gss_accept_sec_context(). @a user is an internal name representing a local * name, such as a name imported by gss_import_name() with an @a * input_name_type of @c GSS_C_NT_USER_NAME. * * @return Return GSS_S_COMPLETE if @a name is authorized to act as @a user, * GSS_S_UNAUTHORIZED if not, or an appropriate GSS error code if an error * occured. * * @sa gss_userok */ OM_uint32 KRB5_CALLCONV gss_authorize_localname(OM_uint32 *minor, const gss_name_t name, const gss_name_t user); OM_uint32 KRB5_CALLCONV gss_acquire_cred_with_password( OM_uint32 *, /* minor_status */ const gss_name_t, /* desired_name */ const gss_buffer_t, /* password */ OM_uint32, /* time_req */ const gss_OID_set, /* desired_mechs */ gss_cred_usage_t, /* cred_usage */ gss_cred_id_t *, /* output_cred_handle */ gss_OID_set *, /* actual_mechs */ OM_uint32 *); /* time_rec */ OM_uint32 KRB5_CALLCONV gss_add_cred_with_password( OM_uint32 *, /* minor_status */ const gss_cred_id_t,/* input_cred_handle */ const gss_name_t, /* desired_name */ const gss_OID, /* desired_mech */ const gss_buffer_t, /* password */ gss_cred_usage_t, /* cred_usage */ OM_uint32, /* initiator_time_req */ OM_uint32, /* acceptor_time_req */ gss_cred_id_t *, /* output_cred_handle */ gss_OID_set *, /* actual_mechs */ OM_uint32 *, /* initiator_time_rec */ OM_uint32 *); /* acceptor_time_rec */ /* * GGF extensions */ typedef struct gss_buffer_set_desc_struct { size_t count; gss_buffer_desc *elements; } gss_buffer_set_desc, *gss_buffer_set_t; #define GSS_C_NO_BUFFER_SET ((gss_buffer_set_t) 0) OM_uint32 KRB5_CALLCONV gss_create_empty_buffer_set (OM_uint32 * /*minor_status*/, gss_buffer_set_t * /*buffer_set*/); OM_uint32 KRB5_CALLCONV gss_add_buffer_set_member (OM_uint32 * /*minor_status*/, const gss_buffer_t /*member_buffer*/, gss_buffer_set_t * /*buffer_set*/); OM_uint32 KRB5_CALLCONV gss_release_buffer_set (OM_uint32 * /*minor_status*/, gss_buffer_set_t * /*buffer_set*/); OM_uint32 KRB5_CALLCONV gss_inquire_sec_context_by_oid (OM_uint32 * /*minor_status*/, const gss_ctx_id_t /*context_handle*/, const gss_OID /*desired_object*/, gss_buffer_set_t * /*data_set*/); OM_uint32 KRB5_CALLCONV gss_inquire_cred_by_oid (OM_uint32 * /*minor_status*/, const gss_cred_id_t /*cred_handle*/, const gss_OID /*desired_object*/, gss_buffer_set_t * /*data_set*/); OM_uint32 KRB5_CALLCONV gss_set_sec_context_option (OM_uint32 * /*minor_status*/, gss_ctx_id_t * /*cred_handle*/, const gss_OID /*desired_object*/, const gss_buffer_t /*value*/); OM_uint32 KRB5_CALLCONV gss_set_cred_option (OM_uint32 * /*minor_status*/, gss_cred_id_t * /*cred*/, const gss_OID /*desired_object*/, const gss_buffer_t /*value*/); OM_uint32 KRB5_CALLCONV gssspi_mech_invoke (OM_uint32 * /*minor_status*/, const gss_OID /*desired_mech*/, const gss_OID /*desired_object*/, gss_buffer_t /*value*/); /* * AEAD extensions */ OM_uint32 KRB5_CALLCONV gss_wrap_aead (OM_uint32 * /*minor_status*/, gss_ctx_id_t /*context_handle*/, int /*conf_req_flag*/, gss_qop_t /*qop_req*/, gss_buffer_t /*input_assoc_buffer*/, gss_buffer_t /*input_payload_buffer*/, int * /*conf_state*/, gss_buffer_t /*output_message_buffer*/); OM_uint32 KRB5_CALLCONV gss_unwrap_aead (OM_uint32 * /*minor_status*/, gss_ctx_id_t /*context_handle*/, gss_buffer_t /*input_message_buffer*/, gss_buffer_t /*input_assoc_buffer*/, gss_buffer_t /*output_payload_buffer*/, int * /*conf_state*/, gss_qop_t * /*qop_state*/); /* * SSPI extensions */ #define GSS_C_DCE_STYLE 0x1000 #define GSS_C_IDENTIFY_FLAG 0x2000 #define GSS_C_EXTENDED_ERROR_FLAG 0x4000 /* * Returns a buffer set with the first member containing the * session key for SSPI compatibility. The optional second * member contains an OID identifying the session key type. */ GSS_DLLIMP extern gss_OID GSS_C_INQ_SSPI_SESSION_KEY; OM_uint32 KRB5_CALLCONV gss_complete_auth_token (OM_uint32 *minor_status, const gss_ctx_id_t context_handle, gss_buffer_t input_message_buffer); typedef struct gss_iov_buffer_desc_struct { OM_uint32 type; gss_buffer_desc buffer; } gss_iov_buffer_desc, *gss_iov_buffer_t; #define GSS_C_NO_IOV_BUFFER ((gss_iov_buffer_t)0) #define GSS_IOV_BUFFER_TYPE_EMPTY 0 #define GSS_IOV_BUFFER_TYPE_DATA 1 /* Packet data */ #define GSS_IOV_BUFFER_TYPE_HEADER 2 /* Mechanism header */ #define GSS_IOV_BUFFER_TYPE_MECH_PARAMS 3 /* Mechanism specific parameters */ #define GSS_IOV_BUFFER_TYPE_TRAILER 7 /* Mechanism trailer */ #define GSS_IOV_BUFFER_TYPE_PADDING 9 /* Padding */ #define GSS_IOV_BUFFER_TYPE_STREAM 10 /* Complete wrap token */ #define GSS_IOV_BUFFER_TYPE_SIGN_ONLY 11 /* Sign only packet data */ #define GSS_IOV_BUFFER_TYPE_MIC_TOKEN 12 /* MIC token destination */ #define GSS_IOV_BUFFER_FLAG_MASK 0xFFFF0000 #define GSS_IOV_BUFFER_FLAG_ALLOCATE 0x00010000 /* indicates GSS should allocate */ #define GSS_IOV_BUFFER_FLAG_ALLOCATED 0x00020000 /* indicates caller should free */ #define GSS_IOV_BUFFER_TYPE(_type) ((_type) & ~(GSS_IOV_BUFFER_FLAG_MASK)) #define GSS_IOV_BUFFER_FLAGS(_type) ((_type) & GSS_IOV_BUFFER_FLAG_MASK) /* * Sign and optionally encrypt a sequence of buffers. The buffers * shall be ordered HEADER | DATA | PADDING | TRAILER. Suitable * space for the header, padding and trailer should be provided * by calling gss_wrap_iov_length(), or the ALLOCATE flag should * be set on those buffers. * * Encryption is in-place. SIGN_ONLY buffers are untouched. Only * a single PADDING buffer should be provided. The order of the * buffers in memory does not matter. Buffers in the IOV should * be arranged in the order above, and in the case of multiple * DATA buffers the sender and receiver should agree on the * order. * * With GSS_C_DCE_STYLE it is acceptable to not provide PADDING * and TRAILER, but the caller must guarantee the plaintext data * being encrypted is correctly padded, otherwise an error will * be returned. * * While applications that have knowledge of the underlying * cryptosystem may request a specific configuration of data * buffers, the only generally supported configurations are: * * HEADER | DATA | PADDING | TRAILER * * which will emit GSS_Wrap() compatible tokens, and: * * HEADER | SIGN_ONLY | DATA | PADDING | TRAILER * * for AEAD. * * The typical (special cased) usage for DCE is as follows: * * SIGN_ONLY_1 | DATA | SIGN_ONLY_2 | HEADER */ OM_uint32 KRB5_CALLCONV gss_wrap_iov ( OM_uint32 *, /* minor_status */ gss_ctx_id_t, /* context_handle */ int, /* conf_req_flag */ gss_qop_t, /* qop_req */ int *, /* conf_state */ gss_iov_buffer_desc *, /* iov */ int); /* iov_count */ /* * Verify and optionally decrypt a sequence of buffers. To process * a GSS-API message without separate buffer, pass STREAM | DATA. * Upon return DATA will contain the decrypted or integrity * protected message. Only a single DATA buffer may be provided * with this usage. DATA by default will point into STREAM, but if * the ALLOCATE flag is set a copy will be returned. * * Otherwise, decryption is in-place. SIGN_ONLY buffers are * untouched. */ OM_uint32 KRB5_CALLCONV gss_unwrap_iov ( OM_uint32 *, /* minor_status */ gss_ctx_id_t, /* context_handle */ int *, /* conf_state */ gss_qop_t *, /* qop_state */ gss_iov_buffer_desc *, /* iov */ int); /* iov_count */ /* * Query HEADER, PADDING and TRAILER buffer lengths. DATA buffers * should be provided so the correct padding length can be determined. */ OM_uint32 KRB5_CALLCONV gss_wrap_iov_length ( OM_uint32 *, /* minor_status */ gss_ctx_id_t, /* context_handle */ int, /* conf_req_flag */ gss_qop_t, /* qop_req */ int *, /* conf_state */ gss_iov_buffer_desc *, /* iov */ int); /* iov_count */ /* * Produce a GSSAPI MIC token for a sequence of buffers. All SIGN_ONLY and * DATA buffers will be signed, in the order they appear. One MIC_TOKEN buffer * must be included for the result. Suitable space should be provided for the * MIC_TOKEN buffer by calling gss_get_mic_iov_length, or the ALLOCATE flag * should be set on that buffer. If the ALLOCATE flag is used, use * gss_release_iov_buffer to free the allocated buffer within the iov list when * it is no longer needed. */ OM_uint32 KRB5_CALLCONV gss_get_mic_iov ( OM_uint32 *, /* minor_status */ gss_ctx_id_t, /* context_handle */ gss_qop_t, /* qop_req */ gss_iov_buffer_desc *, /* iov */ int); /* iov_count */ /* * Query the MIC_TOKEN buffer length within the iov list. */ OM_uint32 KRB5_CALLCONV gss_get_mic_iov_length( OM_uint32 *, /* minor_status */ gss_ctx_id_t, /* context_handle */ gss_qop_t, /* qop_req */ gss_iov_buffer_desc *, /* iov */ int); /* iov_count */ /* * Verify the MIC_TOKEN buffer within the iov list against the SIGN_ONLY and * DATA buffers in the order they appear. Return values are the same as for * gss_verify_mic. */ OM_uint32 KRB5_CALLCONV gss_verify_mic_iov ( OM_uint32 *, /* minor_status */ gss_ctx_id_t, /* context_handle */ gss_qop_t *, /* qop_state */ gss_iov_buffer_desc *, /* iov */ int); /* iov_count */ /* * Release buffers that have the ALLOCATED flag set. */ OM_uint32 KRB5_CALLCONV gss_release_iov_buffer ( OM_uint32 *, /* minor_status */ gss_iov_buffer_desc *, /* iov */ int); /* iov_count */ /* * Protocol transition */ OM_uint32 KRB5_CALLCONV gss_acquire_cred_impersonate_name( OM_uint32 *, /* minor_status */ const gss_cred_id_t, /* impersonator_cred_handle */ const gss_name_t, /* desired_name */ OM_uint32, /* time_req */ const gss_OID_set, /* desired_mechs */ gss_cred_usage_t, /* cred_usage */ gss_cred_id_t *, /* output_cred_handle */ gss_OID_set *, /* actual_mechs */ OM_uint32 *); /* time_rec */ OM_uint32 KRB5_CALLCONV gss_add_cred_impersonate_name( OM_uint32 *, /* minor_status */ gss_cred_id_t, /* input_cred_handle */ const gss_cred_id_t, /* impersonator_cred_handle */ const gss_name_t, /* desired_name */ const gss_OID, /* desired_mech */ gss_cred_usage_t, /* cred_usage */ OM_uint32, /* initiator_time_req */ OM_uint32, /* acceptor_time_req */ gss_cred_id_t *, /* output_cred_handle */ gss_OID_set *, /* actual_mechs */ OM_uint32 *, /* initiator_time_rec */ OM_uint32 *); /* acceptor_time_rec */ /* * Naming extensions */ GSS_DLLIMP extern gss_buffer_t GSS_C_ATTR_LOCAL_LOGIN_USER; GSS_DLLIMP extern gss_OID GSS_C_NT_COMPOSITE_EXPORT; OM_uint32 KRB5_CALLCONV gss_display_name_ext ( OM_uint32 *, /* minor_status */ gss_name_t, /* name */ gss_OID, /* display_as_name_type */ gss_buffer_t /* display_name */ ); OM_uint32 KRB5_CALLCONV gss_inquire_name ( OM_uint32 *, /* minor_status */ gss_name_t, /* name */ int *, /* name_is_MN */ gss_OID *, /* MN_mech */ gss_buffer_set_t * /* attrs */ ); OM_uint32 KRB5_CALLCONV gss_get_name_attribute ( OM_uint32 *, /* minor_status */ gss_name_t, /* name */ gss_buffer_t, /* attr */ int *, /* authenticated */ int *, /* complete */ gss_buffer_t, /* value */ gss_buffer_t, /* display_value */ int * /* more */ ); OM_uint32 KRB5_CALLCONV gss_set_name_attribute ( OM_uint32 *, /* minor_status */ gss_name_t, /* name */ int, /* complete */ gss_buffer_t, /* attr */ gss_buffer_t /* value */ ); OM_uint32 KRB5_CALLCONV gss_delete_name_attribute ( OM_uint32 *, /* minor_status */ gss_name_t, /* name */ gss_buffer_t /* attr */ ); OM_uint32 KRB5_CALLCONV gss_export_name_composite ( OM_uint32 *, /* minor_status */ gss_name_t, /* name */ gss_buffer_t /* exp_composite_name */ ); typedef struct gss_any *gss_any_t; OM_uint32 KRB5_CALLCONV gss_map_name_to_any ( OM_uint32 *, /* minor_status */ gss_name_t, /* name */ int, /* authenticated */ gss_buffer_t, /* type_id */ gss_any_t * /* output */ ); OM_uint32 KRB5_CALLCONV gss_release_any_name_mapping ( OM_uint32 *, /* minor_status */ gss_name_t, /* name */ gss_buffer_t, /* type_id */ gss_any_t * /* input */ ); /* draft-josefsson-gss-capsulate */ OM_uint32 KRB5_CALLCONV gss_encapsulate_token ( gss_const_buffer_t, /* input_token */ gss_const_OID, /* token_oid */ gss_buffer_t /* output_token */ ); OM_uint32 KRB5_CALLCONV gss_decapsulate_token ( gss_const_buffer_t, /* input_token */ gss_const_OID, /* token_oid */ gss_buffer_t /* output_token */ ); int KRB5_CALLCONV gss_oid_equal ( gss_const_OID, /* first_oid */ gss_const_OID /* second_oid */ ); /* Credential store extensions */ struct gss_key_value_element_struct { const char *key; const char *value; }; typedef struct gss_key_value_element_struct gss_key_value_element_desc; struct gss_key_value_set_struct { OM_uint32 count; gss_key_value_element_desc *elements; }; typedef struct gss_key_value_set_struct gss_key_value_set_desc; typedef const gss_key_value_set_desc *gss_const_key_value_set_t; #define GSS_C_NO_CRED_STORE ((gss_const_key_value_set_t) 0) OM_uint32 KRB5_CALLCONV gss_acquire_cred_from( OM_uint32 *, /* minor_status */ gss_name_t, /* desired_name */ OM_uint32, /* time_req */ gss_OID_set, /* desired_mechs */ gss_cred_usage_t, /* cred_usage */ gss_const_key_value_set_t, /* cred_store */ gss_cred_id_t *, /* output_cred_handle */ gss_OID_set *, /* actual_mechs */ OM_uint32 *); /* time_rec */ OM_uint32 KRB5_CALLCONV gss_add_cred_from( OM_uint32 *, /* minor_status */ gss_cred_id_t, /* input_cred_handle */ gss_name_t, /* desired_name */ gss_OID, /* desired_mech */ gss_cred_usage_t, /* cred_usage */ OM_uint32, /* initiator_time_req */ OM_uint32, /* acceptor_time_req */ gss_const_key_value_set_t, /* cred_store */ gss_cred_id_t *, /* output_cred_handle */ gss_OID_set *, /* actual_mechs */ OM_uint32 *, /* initiator_time_rec */ OM_uint32 *); /* acceptor_time_rec */ OM_uint32 KRB5_CALLCONV gss_store_cred_into( OM_uint32 *, /* minor_status */ gss_cred_id_t, /* input_cred_handle */ gss_cred_usage_t, /* input_usage */ gss_OID, /* desired_mech */ OM_uint32, /* overwrite_cred */ OM_uint32, /* default_cred */ gss_const_key_value_set_t, /* cred_store */ gss_OID_set *, /* elements_stored */ gss_cred_usage_t *); /* cred_usage_stored */ OM_uint32 KRB5_CALLCONV gss_export_cred( OM_uint32 *, /* minor_status */ gss_cred_id_t, /* cred_handle */ gss_buffer_t); /* token */ OM_uint32 KRB5_CALLCONV gss_import_cred( OM_uint32 *, /* minor_status */ gss_buffer_t, /* token */ gss_cred_id_t *); /* cred_handle */ #ifdef __cplusplus } #endif /* * When used with gss_inquire_sec_context_by_oid(), return a buffer set with * the first member containing an unsigned 32-bit integer in network byte * order. This is the Security Strength Factor (SSF) associated with the * secure channel established by the security context. NOTE: This value is * made available solely as an indication for use by APIs like Cyrus SASL that * classify the strength of a secure channel via this number. The strength of * a channel cannot necessarily be represented by a simple number. */ GSS_DLLIMP extern gss_OID GSS_C_SEC_CONTEXT_SASL_SSF; #endif /* GSSAPI_EXT_H_ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������security/pam_ext.h����������������������������������������������������������������������������������0000644�����������������00000007057�14763166026�0010245 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 2005, 2006, 2008, 2009 Thorsten Kukuk. * * <security/pam_ext.h> * * This header file collects definitions for the extended PAM API. * This is a public interface of the PAM library for PAM modules, * which makes the life of PAM developers easier, but are not documented * in any standard and are not portable between different PAM * implementations. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, and the entire permission notice in its entirety, * including the disclaimer of warranties. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * ALTERNATIVELY, this product may be distributed under the terms of * the GNU Public License, in which case the provisions of the GPL are * required INSTEAD OF the above restrictions. (This clause is * necessary due to a potential bad interaction between the GPL and * the restrictions contained in a BSD-style copyright.) * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _SECURITY__PAM_EXT_H_ #define _SECURITY__PAM_EXT_H_ #ifdef __cplusplus extern "C" { #endif #include <security/_pam_types.h> #include <stdarg.h> extern void PAM_FORMAT((printf, 3, 0)) PAM_NONNULL((3)) pam_vsyslog (const pam_handle_t *pamh, int priority, const char *fmt, va_list args); extern void PAM_FORMAT((printf, 3, 4)) PAM_NONNULL((3)) pam_syslog (const pam_handle_t *pamh, int priority, const char *fmt, ...); extern int PAM_FORMAT((printf, 4, 0)) PAM_NONNULL((1,4)) pam_vprompt (pam_handle_t *pamh, int style, char **response, const char *fmt, va_list args); extern int PAM_FORMAT((printf, 4, 5)) PAM_NONNULL((1,4)) pam_prompt (pam_handle_t *pamh, int style, char **response, const char *fmt, ...); #define pam_error(pamh, fmt...) \ pam_prompt(pamh, PAM_ERROR_MSG, NULL, fmt) #define pam_verror(pamh, fmt, args) \ pam_vprompt(pamh, PAM_ERROR_MSG, NULL, fmt, args) #define pam_info(pamh, fmt...) pam_prompt(pamh, PAM_TEXT_INFO, NULL, fmt) #define pam_vinfo(pamh, fmt, args) pam_vprompt(pamh, PAM_TEXT_INFO, NULL, fmt, args) extern int PAM_NONNULL((1,3)) pam_get_authtok (pam_handle_t *pamh, int item, const char **authtok, const char *prompt); extern int PAM_NONNULL((1,2)) pam_get_authtok_noverify (pam_handle_t *pamh, const char **authtok, const char *prompt); extern int PAM_NONNULL((1,2)) pam_get_authtok_verify (pam_handle_t *pamh, const char **authtok, const char *prompt); #ifdef __cplusplus } #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������security/pam_modutil.h������������������������������������������������������������������������������0000644�����������������00000011211�14763166026�0011105 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2001-2002 Andrew Morgan <morgan@kernel.org> * * <security/pam_modutil.h> * * This file is a list of handy libc wrappers that attempt to provide some * thread-safe and other convenient functionality to modules in a common form. * * A number of these functions reserve space in a pam_[sg]et_data item. * In all cases, the name of the item is prefixed with "pam_modutil_*". * * On systems that simply can't support thread safe programming, these * functions don't support it either - sorry. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, and the entire permission notice in its entirety, * including the disclaimer of warranties. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * ALTERNATIVELY, this product may be distributed under the terms of * the GNU Public License, in which case the provisions of the GPL are * required INSTEAD OF the above restrictions. (This clause is * necessary due to a potential bad interaction between the GPL and * the restrictions contained in a BSD-style copyright.) * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _SECURITY__PAM_MODUTIL_H #define _SECURITY__PAM_MODUTIL_H #include <sys/types.h> #include <pwd.h> #include <grp.h> #include <shadow.h> #ifdef __cplusplus extern "C" { #endif #include <security/_pam_types.h> extern struct passwd * PAM_NONNULL((1,2)) pam_modutil_getpwnam(pam_handle_t *pamh, const char *user); extern struct passwd * PAM_NONNULL((1)) pam_modutil_getpwuid(pam_handle_t *pamh, uid_t uid); extern struct group * PAM_NONNULL((1,2)) pam_modutil_getgrnam(pam_handle_t *pamh, const char *group); extern struct group * PAM_NONNULL((1)) pam_modutil_getgrgid(pam_handle_t *pamh, gid_t gid); extern struct spwd * PAM_NONNULL((1,2)) pam_modutil_getspnam(pam_handle_t *pamh, const char *user); extern int PAM_NONNULL((1,2,3)) pam_modutil_user_in_group_nam_nam(pam_handle_t *pamh, const char *user, const char *group); extern int PAM_NONNULL((1,2)) pam_modutil_user_in_group_nam_gid(pam_handle_t *pamh, const char *user, gid_t group); extern int PAM_NONNULL((1,3)) pam_modutil_user_in_group_uid_nam(pam_handle_t *pamh, uid_t user, const char *group); extern int PAM_NONNULL((1)) pam_modutil_user_in_group_uid_gid(pam_handle_t *pamh, uid_t user, gid_t group); extern const char * PAM_NONNULL((1)) pam_modutil_getlogin(pam_handle_t *pamh); extern int pam_modutil_read(int fd, char *buffer, int count); extern int pam_modutil_write(int fd, const char *buffer, int count); extern int PAM_NONNULL((1,3)) pam_modutil_audit_write(pam_handle_t *pamh, int type, const char *message, int retval); struct pam_modutil_privs { gid_t *grplist; int number_of_groups; int allocated; gid_t old_gid; uid_t old_uid; int is_dropped; }; #define PAM_MODUTIL_NGROUPS 64 #define PAM_MODUTIL_DEF_PRIVS(n) \ gid_t n##_grplist[PAM_MODUTIL_NGROUPS]; \ struct pam_modutil_privs n = { n##_grplist, PAM_MODUTIL_NGROUPS, 0, -1, -1, 0 } extern int PAM_NONNULL((1,2,3)) pam_modutil_drop_priv(pam_handle_t *pamh, struct pam_modutil_privs *p, const struct passwd *pw); extern int PAM_NONNULL((1,2)) pam_modutil_regain_priv(pam_handle_t *pamh, struct pam_modutil_privs *p); #ifdef __cplusplus } #endif #endif /* _SECURITY__PAM_MODUTIL_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������security/_pam_macros.h������������������������������������������������������������������������������0000644�����������������00000013735�14763166026�0011070 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef PAM_MACROS_H #define PAM_MACROS_H /* * All kind of macros used by PAM, but usable in some other * programs too. * Organized by Cristian Gafton <gafton@redhat.com> */ /* a 'safe' version of strdup */ #include <stdlib.h> #include <string.h> #define x_strdup(s) ( (s) ? strdup(s):NULL ) /* Good policy to strike out passwords with some characters not just free the memory */ #define _pam_overwrite(x) \ do { \ register char *__xx__; \ if ((__xx__=(x))) \ while (*__xx__) \ *__xx__++ = '\0'; \ } while (0) #define _pam_overwrite_n(x,n) \ do { \ register char *__xx__; \ register unsigned int __i__ = 0; \ if ((__xx__=(x))) \ for (;__i__<n; __i__++) \ __xx__[__i__] = 0; \ } while (0) /* * Don't just free it, forget it too. */ #define _pam_drop(X) \ do { \ if (X) { \ free(X); \ X=NULL; \ } \ } while (0) #define _pam_drop_reply(/* struct pam_response * */ reply, /* int */ replies) \ do { \ int reply_i; \ \ for (reply_i=0; reply_i<replies; ++reply_i) { \ if (reply[reply_i].resp) { \ _pam_overwrite(reply[reply_i].resp); \ free(reply[reply_i].resp); \ } \ } \ if (reply) \ free(reply); \ } while (0) /* some debugging code */ #ifdef PAM_DEBUG /* * This provides the necessary function to do debugging in PAM. * Cristian Gafton <gafton@redhat.com> */ #include <stdio.h> #include <sys/types.h> #include <stdarg.h> #include <errno.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> /* * This is for debugging purposes ONLY. DO NOT use on live systems !!! * You have been warned :-) - CG * * to get automated debugging to the log file, it must be created manually. * _PAM_LOGFILE must exist and be writable to the programs you debug. */ #ifndef _PAM_LOGFILE #define _PAM_LOGFILE "/var/run/pam-debug.log" #endif static void _pam_output_debug_info(const char *file, const char *fn , const int line) { FILE *logfile; int must_close = 1, fd; #ifdef O_NOFOLLOW if ((fd = open(_PAM_LOGFILE, O_WRONLY|O_NOFOLLOW|O_APPEND)) != -1) { #else if ((fd = open(_PAM_LOGFILE, O_WRONLY|O_APPEND)) != -1) { #endif if (!(logfile = fdopen(fd,"a"))) { logfile = stderr; must_close = 0; close(fd); } } else { logfile = stderr; must_close = 0; } fprintf(logfile,"[%s:%s(%d)] ",file, fn, line); fflush(logfile); if (must_close) fclose(logfile); } static void _pam_output_debug(const char *format, ...) { va_list args; FILE *logfile; int must_close = 1, fd; va_start(args, format); #ifdef O_NOFOLLOW if ((fd = open(_PAM_LOGFILE, O_WRONLY|O_NOFOLLOW|O_APPEND)) != -1) { #else if ((fd = open(_PAM_LOGFILE, O_WRONLY|O_APPEND)) != -1) { #endif if (!(logfile = fdopen(fd,"a"))) { logfile = stderr; must_close = 0; close(fd); } } else { logfile = stderr; must_close = 0; } vfprintf(logfile, format, args); fprintf(logfile, "\n"); fflush(logfile); if (must_close) fclose(logfile); va_end(args); } #define D(x) do { \ _pam_output_debug_info(__FILE__, __FUNCTION__, __LINE__); \ _pam_output_debug x ; \ } while (0) #define _pam_show_mem(X,XS) do { \ int i; \ register unsigned char *x; \ x = (unsigned char *)X; \ fprintf(stderr, " <start at %p>\n", X); \ for (i = 0; i < XS ; ++x, ++i) { \ fprintf(stderr, " %02X. <%p:%02X>\n", i, x, *x); \ } \ fprintf(stderr, " <end for %p after %d bytes>\n", X, XS); \ } while (0) #define _pam_show_reply(/* struct pam_response * */reply, /* int */replies) \ do { \ int reply_i; \ setbuf(stderr, NULL); \ fprintf(stderr, "array at %p of size %d\n",reply,replies); \ fflush(stderr); \ if (reply) { \ for (reply_i = 0; reply_i < replies; reply_i++) { \ fprintf(stderr, " elem# %d at %p: resp = %p, retcode = %d\n", \ reply_i, reply+reply_i, reply[reply_i].resp, \ reply[reply_i].resp, _retcode); \ fflush(stderr); \ if (reply[reply_i].resp) { \ fprintf(stderr, " resp[%d] = '%s'\n", \ strlen(reply[reply_i].resp), reply[reply_i].resp); \ fflush(stderr); \ } \ } \ } \ fprintf(stderr, "done here\n"); \ fflush(stderr); \ } while (0) #else #define D(x) do { } while (0) #define _pam_show_mem(X,XS) do { } while (0) #define _pam_show_reply(reply, replies) do { } while (0) #endif /* PAM_DEBUG */ #endif /* PAM_MACROS_H */ �����������������������������������security/pam_modules.h������������������������������������������������������������������������������0000644�����������������00000014440�14763166026�0011107 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * <security/pam_modules.h> * * This header file collects definitions for the PAM API --- that is, * public interface between the PAM library and PAM modules. * * Note, the copyright information is at end of file. */ #ifndef _SECURITY_PAM_MODULES_H #define _SECURITY_PAM_MODULES_H #ifdef __cplusplus extern "C" { #endif #include <security/_pam_types.h> /* Linux-PAM common defined types */ /* -------------- The Linux-PAM Module PI ------------- */ extern int PAM_NONNULL((1,2)) pam_set_data(pam_handle_t *pamh, const char *module_data_name, void *data, void (*cleanup)(pam_handle_t *pamh, void *data, int error_status)); extern int PAM_NONNULL((1,2,3)) pam_get_data(const pam_handle_t *pamh, const char *module_data_name, const void **data); extern int PAM_NONNULL((1,2)) pam_get_user(pam_handle_t *pamh, const char **user, const char *prompt); #ifdef PAM_STATIC #define PAM_EXTERN static struct pam_module { const char *name; /* Name of the module */ /* These are function pointers to the module's key functions. */ int (*pam_sm_authenticate)(pam_handle_t *pamh, int flags, int argc, const char **argv); int (*pam_sm_setcred)(pam_handle_t *pamh, int flags, int argc, const char **argv); int (*pam_sm_acct_mgmt)(pam_handle_t *pamh, int flags, int argc, const char **argv); int (*pam_sm_open_session)(pam_handle_t *pamh, int flags, int argc, const char **argv); int (*pam_sm_close_session)(pam_handle_t *pamh, int flags, int argc, const char **argv); int (*pam_sm_chauthtok)(pam_handle_t *pamh, int flags, int argc, const char **argv); }; #else /* !PAM_STATIC */ #define PAM_EXTERN extern #endif /* PAM_STATIC */ /* Lots of files include pam_modules.h that don't need these * declared. However, when they are declared static, they * need to be defined later. So we have to protect C files * that include these without wanting these functions defined.. */ #if (defined(PAM_STATIC) && defined(PAM_SM_AUTH)) || !defined(PAM_STATIC) /* Authentication API's */ PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char **argv); PAM_EXTERN int pam_sm_setcred(pam_handle_t *pamh, int flags, int argc, const char **argv); #endif /*(defined(PAM_STATIC) && defined(PAM_SM_AUTH)) || !defined(PAM_STATIC)*/ #if (defined(PAM_STATIC) && defined(PAM_SM_ACCOUNT)) || !defined(PAM_STATIC) /* Account Management API's */ PAM_EXTERN int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags, int argc, const char **argv); #endif /*(defined(PAM_STATIC) && defined(PAM_SM_ACCOUNT)) || !defined(PAM_STATIC)*/ #if (defined(PAM_STATIC) && defined(PAM_SM_SESSION)) || !defined(PAM_STATIC) /* Session Management API's */ PAM_EXTERN int pam_sm_open_session(pam_handle_t *pamh, int flags, int argc, const char **argv); PAM_EXTERN int pam_sm_close_session(pam_handle_t *pamh, int flags, int argc, const char **argv); #endif /*(defined(PAM_STATIC) && defined(PAM_SM_SESSION)) || !defined(PAM_STATIC)*/ #if (defined(PAM_STATIC) && defined(PAM_SM_PASSWORD)) || !defined(PAM_STATIC) /* Password Management API's */ PAM_EXTERN int pam_sm_chauthtok(pam_handle_t *pamh, int flags, int argc, const char **argv); #endif /*(defined(PAM_STATIC) && defined(PAM_SM_PASSWORD)) || !defined(PAM_STATIC)*/ /* The following two flags are for use across the Linux-PAM/module * interface only. The Application is not permitted to use these * tokens. * * The password service should only perform preliminary checks. No * passwords should be updated. */ #define PAM_PRELIM_CHECK 0x4000 /* The password service should update passwords Note: PAM_PRELIM_CHECK * and PAM_UPDATE_AUTHTOK cannot both be set simultaneously! */ #define PAM_UPDATE_AUTHTOK 0x2000 /* * here are some proposed error status definitions for the * 'error_status' argument used by the cleanup function associated * with data items they should be logically OR'd with the error_status * of the latest return from libpam -- new with .52 and positive * impression from Sun although not official as of 1996/9/4 there are * others in _pam_types.h -- they are for common module/app use. */ #define PAM_DATA_REPLACE 0x20000000 /* used when replacing a data item */ /* take care of any compatibility issues */ #include <security/_pam_compat.h> #ifdef __cplusplus } #endif /* Copyright (C) Theodore Ts'o, 1996. * Copyright (C) Andrew Morgan, 1996-8. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, and the entire permission notice in its entirety, * including the disclaimer of warranties. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * ALTERNATIVELY, this product may be distributed under the terms of * the GNU General Public License, in which case the provisions of the * GNU GPL are required INSTEAD OF the above restrictions. (This * clause is necessary due to a potential bad interaction between the * GNU GPL and the restrictions contained in a BSD-style copyright.) * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #endif /* _SECURITY_PAM_MODULES_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������security/pam_appl.h���������������������������������������������������������������������������������0000644�����������������00000006341�14763166026�0010374 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * <security/pam_appl.h> * * This header file collects definitions for the PAM API --- that is, * public interface between the PAM library and an application program * that wishes to use it. * * Note, the copyright information is at end of file. */ #ifndef _SECURITY_PAM_APPL_H #define _SECURITY_PAM_APPL_H #ifdef __cplusplus extern "C" { #endif #include <security/_pam_types.h> /* Linux-PAM common defined types */ /* -------------- The Linux-PAM Framework layer API ------------- */ extern int PAM_NONNULL((1,3,4)) pam_start(const char *service_name, const char *user, const struct pam_conv *pam_conversation, pam_handle_t **pamh); extern int PAM_NONNULL((1)) pam_end(pam_handle_t *pamh, int pam_status); /* Authentication API's */ extern int PAM_NONNULL((1)) pam_authenticate(pam_handle_t *pamh, int flags); extern int PAM_NONNULL((1)) pam_setcred(pam_handle_t *pamh, int flags); /* Account Management API's */ extern int PAM_NONNULL((1)) pam_acct_mgmt(pam_handle_t *pamh, int flags); /* Session Management API's */ extern int PAM_NONNULL((1)) pam_open_session(pam_handle_t *pamh, int flags); extern int PAM_NONNULL((1)) pam_close_session(pam_handle_t *pamh, int flags); /* Password Management API's */ extern int PAM_NONNULL((1)) pam_chauthtok(pam_handle_t *pamh, int flags); /* take care of any compatibility issues */ #include <security/_pam_compat.h> #ifdef __cplusplus } #endif /* * Copyright Theodore Ts'o, 1996. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, and the entire permission notice in its entirety, * including the disclaimer of warranties. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * ALTERNATIVELY, this product may be distributed under the terms of * the GNU Public License, in which case the provisions of the GPL are * required INSTEAD OF the above restrictions. (This clause is * necessary due to a potential bad interaction between the GPL and * the restrictions contained in a BSD-style copyright.) * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #endif /* _SECURITY_PAM_APPL_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������security/_pam_types.h�������������������������������������������������������������������������������0000644�����������������00000031150�14763166026�0010737 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * <security/_pam_types.h> * * This file defines all of the types common to the Linux-PAM library * applications and modules. * * Note, the copyright+license information is at end of file. */ #ifndef _SECURITY__PAM_TYPES_H #define _SECURITY__PAM_TYPES_H /* This is a blind structure; users aren't allowed to see inside a * pam_handle_t, so we don't define struct pam_handle here. This is * defined in a file private to the PAM library. (i.e., it's private * to PAM service modules, too!) */ typedef struct pam_handle pam_handle_t; /* ---------------- The Linux-PAM Version defines ----------------- */ /* Major and minor version number of the Linux-PAM package. Use these macros to test for features in specific releases. */ #define __LINUX_PAM__ 1 #define __LINUX_PAM_MINOR__ 0 /* ----------------- The Linux-PAM return values ------------------ */ #define PAM_SUCCESS 0 /* Successful function return */ #define PAM_OPEN_ERR 1 /* dlopen() failure when dynamically */ /* loading a service module */ #define PAM_SYMBOL_ERR 2 /* Symbol not found */ #define PAM_SERVICE_ERR 3 /* Error in service module */ #define PAM_SYSTEM_ERR 4 /* System error */ #define PAM_BUF_ERR 5 /* Memory buffer error */ #define PAM_PERM_DENIED 6 /* Permission denied */ #define PAM_AUTH_ERR 7 /* Authentication failure */ #define PAM_CRED_INSUFFICIENT 8 /* Can not access authentication data */ /* due to insufficient credentials */ #define PAM_AUTHINFO_UNAVAIL 9 /* Underlying authentication service */ /* can not retrieve authentication */ /* information */ #define PAM_USER_UNKNOWN 10 /* User not known to the underlying */ /* authenticaiton module */ #define PAM_MAXTRIES 11 /* An authentication service has */ /* maintained a retry count which has */ /* been reached. No further retries */ /* should be attempted */ #define PAM_NEW_AUTHTOK_REQD 12 /* New authentication token required. */ /* This is normally returned if the */ /* machine security policies require */ /* that the password should be changed */ /* beccause the password is NULL or it */ /* has aged */ #define PAM_ACCT_EXPIRED 13 /* User account has expired */ #define PAM_SESSION_ERR 14 /* Can not make/remove an entry for */ /* the specified session */ #define PAM_CRED_UNAVAIL 15 /* Underlying authentication service */ /* can not retrieve user credentials */ /* unavailable */ #define PAM_CRED_EXPIRED 16 /* User credentials expired */ #define PAM_CRED_ERR 17 /* Failure setting user credentials */ #define PAM_NO_MODULE_DATA 18 /* No module specific data is present */ #define PAM_CONV_ERR 19 /* Conversation error */ #define PAM_AUTHTOK_ERR 20 /* Authentication token manipulation error */ #define PAM_AUTHTOK_RECOVERY_ERR 21 /* Authentication information */ /* cannot be recovered */ #define PAM_AUTHTOK_LOCK_BUSY 22 /* Authentication token lock busy */ #define PAM_AUTHTOK_DISABLE_AGING 23 /* Authentication token aging disabled */ #define PAM_TRY_AGAIN 24 /* Preliminary check by password service */ #define PAM_IGNORE 25 /* Ignore underlying account module */ /* regardless of whether the control */ /* flag is required, optional, or sufficient */ #define PAM_ABORT 26 /* Critical error (?module fail now request) */ #define PAM_AUTHTOK_EXPIRED 27 /* user's authentication token has expired */ #define PAM_MODULE_UNKNOWN 28 /* module is not known */ #define PAM_BAD_ITEM 29 /* Bad item passed to pam_*_item() */ #define PAM_CONV_AGAIN 30 /* conversation function is event driven and data is not available yet */ #define PAM_INCOMPLETE 31 /* please call this function again to complete authentication stack. Before calling again, verify that conversation is completed */ /* * Add new #define's here - take care to also extend the libpam code: * pam_strerror() and "libpam/pam_tokens.h" . */ #define _PAM_RETURN_VALUES 32 /* this is the number of return values */ /* ---------------------- The Linux-PAM flags -------------------- */ /* Authentication service should not generate any messages */ #define PAM_SILENT 0x8000U /* Note: these flags are used by pam_authenticate{,_secondary}() */ /* The authentication service should return PAM_AUTH_ERROR if the * user has a null authentication token */ #define PAM_DISALLOW_NULL_AUTHTOK 0x0001U /* Note: these flags are used for pam_setcred() */ /* Set user credentials for an authentication service */ #define PAM_ESTABLISH_CRED 0x0002U /* Delete user credentials associated with an authentication service */ #define PAM_DELETE_CRED 0x0004U /* Reinitialize user credentials */ #define PAM_REINITIALIZE_CRED 0x0008U /* Extend lifetime of user credentials */ #define PAM_REFRESH_CRED 0x0010U /* Note: these flags are used by pam_chauthtok */ /* The password service should only update those passwords that have * aged. If this flag is not passed, the password service should * update all passwords. */ #define PAM_CHANGE_EXPIRED_AUTHTOK 0x0020U /* ------------------ The Linux-PAM item types ------------------- */ /* These defines are used by pam_set_item() and pam_get_item(). Please check the spec which are allowed for use by applications and which are only allowed for use by modules. */ #define PAM_SERVICE 1 /* The service name */ #define PAM_USER 2 /* The user name */ #define PAM_TTY 3 /* The tty name */ #define PAM_RHOST 4 /* The remote host name */ #define PAM_CONV 5 /* The pam_conv structure */ #define PAM_AUTHTOK 6 /* The authentication token (password) */ #define PAM_OLDAUTHTOK 7 /* The old authentication token */ #define PAM_RUSER 8 /* The remote user name */ #define PAM_USER_PROMPT 9 /* the prompt for getting a username */ /* Linux-PAM extensions */ #define PAM_FAIL_DELAY 10 /* app supplied function to override failure delays */ #define PAM_XDISPLAY 11 /* X display name */ #define PAM_XAUTHDATA 12 /* X server authentication data */ #define PAM_AUTHTOK_TYPE 13 /* The type for pam_get_authtok */ /* -------------- Special defines used by Linux-PAM -------------- */ #if defined(__GNUC__) && defined(__GNUC_MINOR__) # define PAM_GNUC_PREREQ(maj, min) \ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) #else # define PAM_GNUC_PREREQ(maj, min) 0 #endif #if PAM_GNUC_PREREQ(2,5) # define PAM_FORMAT(params) __attribute__((__format__ params)) #else # define PAM_FORMAT(params) #endif #if PAM_GNUC_PREREQ(3,3) && !defined(LIBPAM_COMPILE) # define PAM_NONNULL(params) __attribute__((__nonnull__ params)) #else # define PAM_NONNULL(params) #endif /* ---------- Common Linux-PAM application/module PI ----------- */ extern int PAM_NONNULL((1)) pam_set_item(pam_handle_t *pamh, int item_type, const void *item); extern int PAM_NONNULL((1)) pam_get_item(const pam_handle_t *pamh, int item_type, const void **item); extern const char * pam_strerror(pam_handle_t *pamh, int errnum); extern int PAM_NONNULL((1,2)) pam_putenv(pam_handle_t *pamh, const char *name_value); extern const char * PAM_NONNULL((1,2)) pam_getenv(pam_handle_t *pamh, const char *name); extern char ** PAM_NONNULL((1)) pam_getenvlist(pam_handle_t *pamh); /* ---------- Common Linux-PAM application/module PI ----------- */ /* * here are some proposed error status definitions for the * 'error_status' argument used by the cleanup function associated * with data items they should be logically OR'd with the error_status * of the latest return from libpam -- new with .52 and positive * impression from Sun although not official as of 1996/9/4 * [generally the other flags are to be found in pam_modules.h] */ #define PAM_DATA_SILENT 0x40000000 /* used to suppress messages... */ /* * here we define an externally (by apps or modules) callable function * that primes the libpam library to delay when a stacked set of * modules results in a failure. In the case of PAM_SUCCESS this delay * is ignored. * * Note, the pam_[gs]et_item(... PAM_FAIL_DELAY ...) can be used to set * a function pointer which can override the default fail-delay behavior. * This item was added to accommodate event driven programs that need to * manage delays more carefully. The function prototype for this data * item is * void (*fail_delay)(int status, unsigned int delay, void *appdata_ptr); */ #define HAVE_PAM_FAIL_DELAY extern int pam_fail_delay(pam_handle_t *pamh, unsigned int musec_delay); /* ------------ The Linux-PAM conversation structures ------------ */ /* Message styles */ #define PAM_PROMPT_ECHO_OFF 1 #define PAM_PROMPT_ECHO_ON 2 #define PAM_ERROR_MSG 3 #define PAM_TEXT_INFO 4 /* Linux-PAM specific types */ #define PAM_RADIO_TYPE 5 /* yes/no/maybe conditionals */ /* This is for server client non-human interaction.. these are NOT part of the X/Open PAM specification. */ #define PAM_BINARY_PROMPT 7 /* maximum size of messages/responses etc.. (these are mostly arbitrary so Linux-PAM should handle longer values). */ #define PAM_MAX_NUM_MSG 32 #define PAM_MAX_MSG_SIZE 512 #define PAM_MAX_RESP_SIZE 512 /* Used to pass prompting text, error messages, or other informatory * text to the user. This structure is allocated and freed by the PAM * library (or loaded module). */ struct pam_message { int msg_style; const char *msg; }; /* if the pam_message.msg_style = PAM_BINARY_PROMPT the 'pam_message.msg' is a pointer to a 'const *' for the following pseudo-structure. When used with a PAM_BINARY_PROMPT, the returned pam_response.resp pointer points to an object with the following structure: struct { u32 length; # network byte order unsigned char type; unsigned char data[length-5]; }; The 'libpamc' library is designed around this flavor of message and should be used to handle this flavor of msg_style. */ /* Used to return the user's response to the PAM library. This structure is allocated by the application program, and free()'d by the Linux-PAM library (or calling module). */ struct pam_response { char *resp; int resp_retcode; /* currently un-used, zero expected */ }; /* The actual conversation structure itself */ struct pam_conv { int (*conv)(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr); void *appdata_ptr; }; /* Used by the PAM_XAUTHDATA pam item. Contains X authentication data used by modules to connect to the user's X display. Note: this structure is intentionally compatible with xcb_auth_info_t. */ struct pam_xauth_data { int namelen; char *name; int datalen; char *data; }; /* ... adapted from the pam_appl.h file created by Theodore Ts'o and * * Copyright Theodore Ts'o, 1996. All rights reserved. * Copyright (c) Andrew G. Morgan <morgan@linux.kernel.org>, 1996-8 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, and the entire permission notice in its entirety, * including the disclaimer of warranties. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * ALTERNATIVELY, this product may be distributed under the terms of * the GNU Public License, in which case the provisions of the GPL are * required INSTEAD OF the above restrictions. (This clause is * necessary due to a potential bad interaction between the GPL and * the restrictions contained in a BSD-style copyright.) * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #endif /* _SECURITY__PAM_TYPES_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������security/pam_client.h�������������������������������������������������������������������������������0000644�����������������00000016107�14763166026�0010717 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * $Id$ * * Copyright (c) 1999 Andrew G. Morgan <morgan@linux.kernel.org> * * This header file provides the prototypes for the PAM client API */ #ifndef PAM_CLIENT_H #define PAM_CLIENT_H #ifdef __cplusplus extern "C" { #endif /* def __cplusplus */ #include <unistd.h> #include <string.h> #include <stdio.h> #include <sys/types.h> /* opaque agent handling structure */ typedef struct pamc_handle_s *pamc_handle_t; /* binary prompt structure pointer */ typedef struct { u_int32_t length; u_int8_t control; } *pamc_bp_t; /* * functions provided by libpamc */ /* * Initialize the agent abstraction library */ pamc_handle_t pamc_start(void); /* * Terminate the authentication process */ int pamc_end(pamc_handle_t *pch); /* * force the loading of a specified agent */ int pamc_load(pamc_handle_t pch, const char *agent_id); /* * Single conversation interface for binary prompts */ int pamc_converse(pamc_handle_t pch, pamc_bp_t *prompt_p); /* * disable an agent */ int pamc_disable(pamc_handle_t pch, const char *agent_id); /* * obtain a list of available agents */ char **pamc_list_agents(pamc_handle_t pch); /* * PAM_BP_ MACROS for creating, destroying and manipulating binary prompts */ #include <stdlib.h> #include <stdio.h> #include <unistd.h> #ifndef PAM_BP_ASSERT # ifdef NDEBUG # define PAM_BP_ASSERT(x) do {} while (0) # else # define PAM_BP_ASSERT(x) do { printf(__FILE__ "(%d): %s\n", \ __LINE__, x) ; exit(1); } while (0) # endif /* NDEBUG */ #endif /* PAM_BP_ASSERT */ #ifndef PAM_BP_CALLOC # define PAM_BP_CALLOC calloc #endif /* PAM_BP_CALLOC */ #ifndef PAM_BP_FREE # define PAM_BP_FREE free #endif /* PAM_BP_FREE */ #define __PAM_BP_WOCTET(x,y) (*((y) + (u_int8_t *)(x))) #define __PAM_BP_ROCTET(x,y) (*((y) + (const u_int8_t *)(x))) #define PAM_BP_MIN_SIZE (sizeof(u_int32_t) + sizeof(u_int8_t)) #define PAM_BP_MAX_LENGTH 0x20000 /* an advisory limit */ #define PAM_BP_WCONTROL(x) (__PAM_BP_WOCTET(x,4)) #define PAM_BP_RCONTROL(x) (__PAM_BP_ROCTET(x,4)) #define PAM_BP_SIZE(x) ((__PAM_BP_ROCTET(x,0)<<24)+ \ (__PAM_BP_ROCTET(x,1)<<16)+ \ (__PAM_BP_ROCTET(x,2)<< 8)+ \ (__PAM_BP_ROCTET(x,3) )) #define PAM_BP_LENGTH(x) (PAM_BP_SIZE(x) - PAM_BP_MIN_SIZE) #define PAM_BP_WDATA(x) (PAM_BP_MIN_SIZE + (u_int8_t *) (x)) #define PAM_BP_RDATA(x) (PAM_BP_MIN_SIZE + (const u_int8_t *) (x)) /* Note, this macro always '\0' terminates renewed packets */ #define PAM_BP_RENEW(old_p, cntrl, data_length) \ do { \ if (old_p) { \ if (*(old_p)) { \ u_int32_t __size; \ __size = PAM_BP_SIZE(*(old_p)); \ memset(*(old_p), 0, __size); \ PAM_BP_FREE(*(old_p)); \ } \ if (cntrl) { \ u_int32_t __size; \ \ __size = PAM_BP_MIN_SIZE + data_length; \ if ((*(old_p) = PAM_BP_CALLOC(1, 1+__size))) { \ __PAM_BP_WOCTET(*(old_p), 3) = __size & 0xFF; \ __PAM_BP_WOCTET(*(old_p), 2) = (__size>>=8) & 0xFF; \ __PAM_BP_WOCTET(*(old_p), 1) = (__size>>=8) & 0xFF; \ __PAM_BP_WOCTET(*(old_p), 0) = (__size>>=8) & 0xFF; \ (*(old_p))->control = cntrl; \ } else { \ PAM_BP_ASSERT("out of memory for binary prompt"); \ } \ } else { \ *old_p = NULL; \ } \ } else { \ PAM_BP_ASSERT("programming error, invalid binary prompt pointer"); \ } \ } while (0) #define PAM_BP_FILL(prmpt, offset, length, data) \ do { \ size_t bp_length; \ u_int8_t *prompt = (u_int8_t *) (prmpt); \ bp_length = PAM_BP_LENGTH(prompt); \ if (bp_length < ((length)+(offset))) { \ PAM_BP_ASSERT("attempt to write over end of prompt"); \ } \ memcpy((offset) + PAM_BP_WDATA(prompt), (data), (length)); \ } while (0) #define PAM_BP_EXTRACT(prmpt, offset, length, data) \ do { \ size_t __bp_length; \ const u_int8_t *__prompt = (const u_int8_t *) (prmpt); \ __bp_length = PAM_BP_LENGTH(__prompt); \ if (((offset) < 0) || (__bp_length < ((length)+(offset))) \ || ((length) < 0)) { \ PAM_BP_ASSERT("invalid extraction from prompt"); \ } \ memcpy((data), (offset) + PAM_BP_RDATA(__prompt), (length)); \ } while (0) /* Control types */ #define PAM_BPC_FALSE 0 #define PAM_BPC_TRUE 1 #define PAM_BPC_OK 0x01 /* continuation packet */ #define PAM_BPC_SELECT 0x02 /* initialization packet */ #define PAM_BPC_DONE 0x03 /* termination packet */ #define PAM_BPC_FAIL 0x04 /* unable to execute */ /* The following control characters are only legal for echanges between an agent and a client (it is the responsibility of the client to enforce this rule in the face of a rogue server): */ #define PAM_BPC_GETENV 0x41 /* obtain client env.var */ #define PAM_BPC_PUTENV 0x42 /* set client env.var */ #define PAM_BPC_TEXT 0x43 /* display message */ #define PAM_BPC_ERROR 0x44 /* display error message */ #define PAM_BPC_PROMPT 0x45 /* echo'd text prompt */ #define PAM_BPC_PASS 0x46 /* non-echo'd text prompt*/ /* quick check for prompts that are legal for the client (by implication the server too) to send to libpamc */ #define PAM_BPC_FOR_CLIENT(/* pamc_bp_t */ prompt) \ (((prompt)->control <= PAM_BPC_FAIL && (prompt)->control >= PAM_BPC_OK) \ ? PAM_BPC_TRUE:PAM_BPC_FALSE) #ifdef __cplusplus } #endif /* def __cplusplus */ #endif /* PAM_CLIENT_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������security/pam_misc.h���������������������������������������������������������������������������������0000644�����������������00000002766�14763166026�0010402 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id$ */ #ifndef __PAMMISC_H #define __PAMMISC_H #include <security/pam_appl.h> #include <security/pam_client.h> #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* include some useful macros */ #include <security/_pam_macros.h> /* functions defined in pam_misc.* libraries */ extern int misc_conv(int num_msg, const struct pam_message **msgm, struct pam_response **response, void *appdata_ptr); #include <time.h> extern time_t pam_misc_conv_warn_time; /* time that we should warn user */ extern time_t pam_misc_conv_die_time; /* cut-off time for input */ extern const char *pam_misc_conv_warn_line; /* warning notice */ extern const char *pam_misc_conv_die_line; /* cut-off remark */ extern int pam_misc_conv_died; /* 1 = cut-off time reached (0 not) */ extern int (*pam_binary_handler_fn)(void *appdata, pamc_bp_t *prompt_p); extern void (*pam_binary_handler_free)(void *appdata, pamc_bp_t *prompt_p); /* * Environment helper functions */ /* transcribe given environment (to pam) */ extern int pam_misc_paste_env(pam_handle_t *pamh , const char * const * user_env); /* delete environment as obtained from (pam_getenvlist) */ extern char **pam_misc_drop_env(char **env); /* provide something like the POSIX setenv function for the (Linux-)PAM * environment. */ extern int pam_misc_setenv(pam_handle_t *pamh, const char *name , const char *value, int readonly); #ifdef __cplusplus } #endif /* def __cplusplus */ #endif /* ndef __PAMMISC_H */ ����������security/pam_filter.h�������������������������������������������������������������������������������0000644�����������������00000002101�14763166026�0010713 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * $Id$ * * this file is associated with the Linux-PAM filter module. * it was written by Andrew G. Morgan <morgan@linux.kernel.org> * */ #ifndef PAM_FILTER_H #define PAM_FILTER_H #include <sys/file.h> /* * this will fail if there is some problem with these file descriptors * being allocated by the pam_filter Linux-PAM module. The numbers * here are thought safe, but the filter developer should use the * macros, as these numbers are subject to change. * * The APPXXX_FILENO file descriptors are the STDIN/OUT/ERR_FILENO of the * application. The filter uses the STDIN/OUT/ERR_FILENO's to converse * with the user, passes (modified) user input to the application via * APPIN_FILENO, and receives application output from APPOUT_FILENO/ERR. */ #define APPIN_FILENO 3 /* write here to give application input */ #define APPOUT_FILENO 4 /* read here to get application output */ #define APPERR_FILENO 5 /* read here to get application errors */ #define APPTOP_FILE 6 /* used by select */ #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������security/_pam_compat.h������������������������������������������������������������������������������0000644�����������������00000005634�14763166026�0011066 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _PAM_COMPAT_H #define _PAM_COMPAT_H /* * This file was contributed by Derrick J Brashear <shadow@dementia.org> * slight modification by Brad M. Garcia <bgarcia@fore.com> * * A number of operating systems have started to implement PAM. * unfortunately, they have a different set of numeric values for * certain constants. This file is included for compatibility's sake. */ /* Solaris uses different constants. We redefine to those here */ #if defined(solaris) || (defined(__SVR4) && defined(sun)) # ifdef _SECURITY_PAM_MODULES_H /* flags for pam_chauthtok() */ # undef PAM_PRELIM_CHECK # define PAM_PRELIM_CHECK 0x1 # undef PAM_UPDATE_AUTHTOK # define PAM_UPDATE_AUTHTOK 0x2 # endif /* _SECURITY_PAM_MODULES_H */ # ifdef _SECURITY__PAM_TYPES_H /* generic for pam_* functions */ # undef PAM_SILENT # define PAM_SILENT 0x80000000 # undef PAM_CHANGE_EXPIRED_AUTHTOK # define PAM_CHANGE_EXPIRED_AUTHTOK 0x4 /* flags for pam_setcred() */ # undef PAM_ESTABLISH_CRED # define PAM_ESTABLISH_CRED 0x1 # undef PAM_DELETE_CRED # define PAM_DELETE_CRED 0x2 # undef PAM_REINITIALIZE_CRED # define PAM_REINITIALIZE_CRED 0x4 # undef PAM_REFRESH_CRED # define PAM_REFRESH_CRED 0x8 /* another binary incompatibility comes from the return codes! */ # undef PAM_CONV_ERR # define PAM_CONV_ERR 6 # undef PAM_PERM_DENIED # define PAM_PERM_DENIED 7 # undef PAM_MAXTRIES # define PAM_MAXTRIES 8 # undef PAM_AUTH_ERR # define PAM_AUTH_ERR 9 # undef PAM_NEW_AUTHTOK_REQD # define PAM_NEW_AUTHTOK_REQD 10 # undef PAM_CRED_INSUFFICIENT # define PAM_CRED_INSUFFICIENT 11 # undef PAM_AUTHINFO_UNAVAIL # define PAM_AUTHINFO_UNAVAIL 12 # undef PAM_USER_UNKNOWN # define PAM_USER_UNKNOWN 13 # undef PAM_CRED_UNAVAIL # define PAM_CRED_UNAVAIL 14 # undef PAM_CRED_EXPIRED # define PAM_CRED_EXPIRED 15 # undef PAM_CRED_ERR # define PAM_CRED_ERR 16 # undef PAM_ACCT_EXPIRED # define PAM_ACCT_EXPIRED 17 # undef PAM_AUTHTOK_EXPIRED # define PAM_AUTHTOK_EXPIRED 18 # undef PAM_SESSION_ERR # define PAM_SESSION_ERR 19 # undef PAM_AUTHTOK_ERR # define PAM_AUTHTOK_ERR 20 # undef PAM_AUTHTOK_RECOVERY_ERR # define PAM_AUTHTOK_RECOVERY_ERR 21 # undef PAM_AUTHTOK_LOCK_BUSY # define PAM_AUTHTOK_LOCK_BUSY 22 # undef PAM_AUTHTOK_DISABLE_AGING # define PAM_AUTHTOK_DISABLE_AGING 23 # undef PAM_NO_MODULE_DATA # define PAM_NO_MODULE_DATA 24 # undef PAM_IGNORE # define PAM_IGNORE 25 # undef PAM_ABORT # define PAM_ABORT 26 # undef PAM_TRY_AGAIN # define PAM_TRY_AGAIN 27 #endif /* _SECURITY__PAM_TYPES_H */ #else /* For compatibility with old Linux-PAM implementations. */ #define PAM_AUTHTOK_RECOVER_ERR PAM_AUTHTOK_RECOVERY_ERR #endif /* defined(solaris) || (defined(__SVR4) && defined(sun)) */ #endif /* _PAM_COMPAT_H */ ����������������������������������������������������������������������������������������������������fontconfig/fontconfig.h�����������������������������������������������������������������������������0000644�����������������00000065513�14763166026�0011232 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * fontconfig/fontconfig/fontconfig.h * * Copyright © 2001 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _FONTCONFIG_H_ #define _FONTCONFIG_H_ #include <sys/types.h> #include <sys/stat.h> #include <stdarg.h> #include <limits.h> #if defined(__GNUC__) && (__GNUC__ >= 4) #define FC_ATTRIBUTE_SENTINEL(x) __attribute__((__sentinel__(0))) #else #define FC_ATTRIBUTE_SENTINEL(x) #endif #ifndef FcPublic #define FcPublic #endif typedef unsigned char FcChar8; typedef unsigned short FcChar16; typedef unsigned int FcChar32; typedef int FcBool; /* * Current Fontconfig version number. This same number * must appear in the fontconfig configure.in file. Yes, * it'a a pain to synchronize version numbers like this. */ #define FC_MAJOR 2 #define FC_MINOR 13 #define FC_REVISION 0 #define FC_VERSION ((FC_MAJOR * 10000) + (FC_MINOR * 100) + (FC_REVISION)) /* * Current font cache file format version * This is appended to the cache files so that multiple * versions of the library will peacefully coexist * * Change this value whenever the disk format for the cache file * changes in any non-compatible way. Try to avoid such changes as * it means multiple copies of the font information. */ #define FC_CACHE_VERSION_NUMBER 7 #define _FC_STRINGIFY_(s) #s #define _FC_STRINGIFY(s) _FC_STRINGIFY_(s) #define FC_CACHE_VERSION _FC_STRINGIFY(FC_CACHE_VERSION_NUMBER) #define FcFalse 0 #define FcTrue 1 #define FcDontCare 2 #define FC_FAMILY "family" /* String */ #define FC_STYLE "style" /* String */ #define FC_SLANT "slant" /* Int */ #define FC_WEIGHT "weight" /* Int */ #define FC_SIZE "size" /* Range (double) */ #define FC_ASPECT "aspect" /* Double */ #define FC_PIXEL_SIZE "pixelsize" /* Double */ #define FC_SPACING "spacing" /* Int */ #define FC_FOUNDRY "foundry" /* String */ #define FC_ANTIALIAS "antialias" /* Bool (depends) */ #define FC_HINTING "hinting" /* Bool (true) */ #define FC_HINT_STYLE "hintstyle" /* Int */ #define FC_VERTICAL_LAYOUT "verticallayout" /* Bool (false) */ #define FC_AUTOHINT "autohint" /* Bool (false) */ /* FC_GLOBAL_ADVANCE is deprecated. this is simply ignored on freetype 2.4.5 or later */ #define FC_GLOBAL_ADVANCE "globaladvance" /* Bool (true) */ #define FC_WIDTH "width" /* Int */ #define FC_FILE "file" /* String */ #define FC_INDEX "index" /* Int */ #define FC_FT_FACE "ftface" /* FT_Face */ #define FC_RASTERIZER "rasterizer" /* String (deprecated) */ #define FC_OUTLINE "outline" /* Bool */ #define FC_SCALABLE "scalable" /* Bool */ #define FC_COLOR "color" /* Bool */ #define FC_VARIABLE "variable" /* Bool */ #define FC_SCALE "scale" /* double (deprecated) */ #define FC_SYMBOL "symbol" /* Bool */ #define FC_DPI "dpi" /* double */ #define FC_RGBA "rgba" /* Int */ #define FC_MINSPACE "minspace" /* Bool use minimum line spacing */ #define FC_SOURCE "source" /* String (deprecated) */ #define FC_CHARSET "charset" /* CharSet */ #define FC_LANG "lang" /* String RFC 3066 langs */ #define FC_FONTVERSION "fontversion" /* Int from 'head' table */ #define FC_FULLNAME "fullname" /* String */ #define FC_FAMILYLANG "familylang" /* String RFC 3066 langs */ #define FC_STYLELANG "stylelang" /* String RFC 3066 langs */ #define FC_FULLNAMELANG "fullnamelang" /* String RFC 3066 langs */ #define FC_CAPABILITY "capability" /* String */ #define FC_FONTFORMAT "fontformat" /* String */ #define FC_EMBOLDEN "embolden" /* Bool - true if emboldening needed*/ #define FC_EMBEDDED_BITMAP "embeddedbitmap" /* Bool - true to enable embedded bitmaps */ #define FC_DECORATIVE "decorative" /* Bool - true if style is a decorative variant */ #define FC_LCD_FILTER "lcdfilter" /* Int */ #define FC_FONT_FEATURES "fontfeatures" /* String */ #define FC_FONT_VARIATIONS "fontvariations" /* String */ #define FC_NAMELANG "namelang" /* String RFC 3866 langs */ #define FC_PRGNAME "prgname" /* String */ #define FC_HASH "hash" /* String (deprecated) */ #define FC_POSTSCRIPT_NAME "postscriptname" /* String */ #define FC_CACHE_SUFFIX ".cache-" FC_CACHE_VERSION #define FC_DIR_CACHE_FILE "fonts.cache-" FC_CACHE_VERSION #define FC_USER_CACHE_FILE ".fonts.cache-" FC_CACHE_VERSION /* Adjust outline rasterizer */ #define FC_CHARWIDTH "charwidth" /* Int */ #define FC_CHAR_WIDTH FC_CHARWIDTH #define FC_CHAR_HEIGHT "charheight"/* Int */ #define FC_MATRIX "matrix" /* FcMatrix */ #define FC_WEIGHT_THIN 0 #define FC_WEIGHT_EXTRALIGHT 40 #define FC_WEIGHT_ULTRALIGHT FC_WEIGHT_EXTRALIGHT #define FC_WEIGHT_LIGHT 50 #define FC_WEIGHT_DEMILIGHT 55 #define FC_WEIGHT_SEMILIGHT FC_WEIGHT_DEMILIGHT #define FC_WEIGHT_BOOK 75 #define FC_WEIGHT_REGULAR 80 #define FC_WEIGHT_NORMAL FC_WEIGHT_REGULAR #define FC_WEIGHT_MEDIUM 100 #define FC_WEIGHT_DEMIBOLD 180 #define FC_WEIGHT_SEMIBOLD FC_WEIGHT_DEMIBOLD #define FC_WEIGHT_BOLD 200 #define FC_WEIGHT_EXTRABOLD 205 #define FC_WEIGHT_ULTRABOLD FC_WEIGHT_EXTRABOLD #define FC_WEIGHT_BLACK 210 #define FC_WEIGHT_HEAVY FC_WEIGHT_BLACK #define FC_WEIGHT_EXTRABLACK 215 #define FC_WEIGHT_ULTRABLACK FC_WEIGHT_EXTRABLACK #define FC_SLANT_ROMAN 0 #define FC_SLANT_ITALIC 100 #define FC_SLANT_OBLIQUE 110 #define FC_WIDTH_ULTRACONDENSED 50 #define FC_WIDTH_EXTRACONDENSED 63 #define FC_WIDTH_CONDENSED 75 #define FC_WIDTH_SEMICONDENSED 87 #define FC_WIDTH_NORMAL 100 #define FC_WIDTH_SEMIEXPANDED 113 #define FC_WIDTH_EXPANDED 125 #define FC_WIDTH_EXTRAEXPANDED 150 #define FC_WIDTH_ULTRAEXPANDED 200 #define FC_PROPORTIONAL 0 #define FC_DUAL 90 #define FC_MONO 100 #define FC_CHARCELL 110 /* sub-pixel order */ #define FC_RGBA_UNKNOWN 0 #define FC_RGBA_RGB 1 #define FC_RGBA_BGR 2 #define FC_RGBA_VRGB 3 #define FC_RGBA_VBGR 4 #define FC_RGBA_NONE 5 /* hinting style */ #define FC_HINT_NONE 0 #define FC_HINT_SLIGHT 1 #define FC_HINT_MEDIUM 2 #define FC_HINT_FULL 3 /* LCD filter */ #define FC_LCD_NONE 0 #define FC_LCD_DEFAULT 1 #define FC_LCD_LIGHT 2 #define FC_LCD_LEGACY 3 typedef enum _FcType { FcTypeUnknown = -1, FcTypeVoid, FcTypeInteger, FcTypeDouble, FcTypeString, FcTypeBool, FcTypeMatrix, FcTypeCharSet, FcTypeFTFace, FcTypeLangSet, FcTypeRange } FcType; typedef struct _FcMatrix { double xx, xy, yx, yy; } FcMatrix; #define FcMatrixInit(m) ((m)->xx = (m)->yy = 1, \ (m)->xy = (m)->yx = 0) /* * A data structure to represent the available glyphs in a font. * This is represented as a sparse boolean btree. */ typedef struct _FcCharSet FcCharSet; typedef struct _FcObjectType { char *object; FcType type; } FcObjectType; typedef struct _FcConstant { const FcChar8 *name; const char *object; int value; } FcConstant; typedef enum _FcResult { FcResultMatch, FcResultNoMatch, FcResultTypeMismatch, FcResultNoId, FcResultOutOfMemory } FcResult; typedef enum _FcValueBinding { FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame, /* to make sure sizeof (FcValueBinding) == 4 even with -fshort-enums */ FcValueBindingEnd = INT_MAX } FcValueBinding; typedef struct _FcPattern FcPattern; typedef struct _FcLangSet FcLangSet; typedef struct _FcRange FcRange; typedef struct _FcValue { FcType type; union { const FcChar8 *s; int i; FcBool b; double d; const FcMatrix *m; const FcCharSet *c; void *f; const FcLangSet *l; const FcRange *r; } u; } FcValue; typedef struct _FcFontSet { int nfont; int sfont; FcPattern **fonts; } FcFontSet; typedef struct _FcObjectSet { int nobject; int sobject; const char **objects; } FcObjectSet; typedef enum _FcMatchKind { FcMatchPattern, FcMatchFont, FcMatchScan, FcMatchKindEnd, FcMatchKindBegin = FcMatchPattern } FcMatchKind; typedef enum _FcLangResult { FcLangEqual = 0, FcLangDifferentCountry = 1, FcLangDifferentTerritory = 1, FcLangDifferentLang = 2 } FcLangResult; typedef enum _FcSetName { FcSetSystem = 0, FcSetApplication = 1 } FcSetName; typedef struct _FcConfigFileInfoIter { void *dummy1; void *dummy2; void *dummy3; } FcConfigFileInfoIter; typedef struct _FcAtomic FcAtomic; #if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */ #define _FCFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */ #define _FCFUNCPROTOEND } #else #define _FCFUNCPROTOBEGIN #define _FCFUNCPROTOEND #endif typedef enum { FcEndianBig, FcEndianLittle } FcEndian; typedef struct _FcConfig FcConfig; typedef struct _FcGlobalCache FcFileCache; typedef struct _FcBlanks FcBlanks; typedef struct _FcStrList FcStrList; typedef struct _FcStrSet FcStrSet; typedef struct _FcCache FcCache; _FCFUNCPROTOBEGIN /* fcblanks.c */ FcPublic FcBlanks * FcBlanksCreate (void); FcPublic void FcBlanksDestroy (FcBlanks *b); FcPublic FcBool FcBlanksAdd (FcBlanks *b, FcChar32 ucs4); FcPublic FcBool FcBlanksIsMember (FcBlanks *b, FcChar32 ucs4); /* fccache.c */ FcPublic const FcChar8 * FcCacheDir(const FcCache *c); FcPublic FcFontSet * FcCacheCopySet(const FcCache *c); FcPublic const FcChar8 * FcCacheSubdir (const FcCache *c, int i); FcPublic int FcCacheNumSubdir (const FcCache *c); FcPublic int FcCacheNumFont (const FcCache *c); FcPublic FcBool FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config); FcPublic FcBool FcDirCacheValid (const FcChar8 *cache_file); FcPublic FcBool FcDirCacheClean (const FcChar8 *cache_dir, FcBool verbose); FcPublic void FcCacheCreateTagFile (const FcConfig *config); FcPublic FcBool FcDirCacheCreateUUID (FcChar8 *dir, FcBool force, FcConfig *config); /* fccfg.c */ FcPublic FcChar8 * FcConfigHome (void); FcPublic FcBool FcConfigEnableHome (FcBool enable); FcPublic FcChar8 * FcConfigFilename (const FcChar8 *url); FcPublic FcConfig * FcConfigCreate (void); FcPublic FcConfig * FcConfigReference (FcConfig *config); FcPublic void FcConfigDestroy (FcConfig *config); FcPublic FcBool FcConfigSetCurrent (FcConfig *config); FcPublic FcConfig * FcConfigGetCurrent (void); FcPublic FcBool FcConfigUptoDate (FcConfig *config); FcPublic FcBool FcConfigBuildFonts (FcConfig *config); FcPublic FcStrList * FcConfigGetFontDirs (FcConfig *config); FcPublic FcStrList * FcConfigGetConfigDirs (FcConfig *config); FcPublic FcStrList * FcConfigGetConfigFiles (FcConfig *config); FcPublic FcChar8 * FcConfigGetCache (FcConfig *config); FcPublic FcBlanks * FcConfigGetBlanks (FcConfig *config); FcPublic FcStrList * FcConfigGetCacheDirs (const FcConfig *config); FcPublic int FcConfigGetRescanInterval (FcConfig *config); FcPublic FcBool FcConfigSetRescanInterval (FcConfig *config, int rescanInterval); FcPublic FcFontSet * FcConfigGetFonts (FcConfig *config, FcSetName set); FcPublic FcBool FcConfigAppFontAddFile (FcConfig *config, const FcChar8 *file); FcPublic FcBool FcConfigAppFontAddDir (FcConfig *config, const FcChar8 *dir); FcPublic void FcConfigAppFontClear (FcConfig *config); FcPublic FcBool FcConfigSubstituteWithPat (FcConfig *config, FcPattern *p, FcPattern *p_pat, FcMatchKind kind); FcPublic FcBool FcConfigSubstitute (FcConfig *config, FcPattern *p, FcMatchKind kind); FcPublic const FcChar8 * FcConfigGetSysRoot (const FcConfig *config); FcPublic void FcConfigSetSysRoot (FcConfig *config, const FcChar8 *sysroot); FcPublic void FcConfigFileInfoIterInit (FcConfig *config, FcConfigFileInfoIter *iter); FcPublic FcBool FcConfigFileInfoIterNext (FcConfig *config, FcConfigFileInfoIter *iter); FcPublic FcBool FcConfigFileInfoIterGet (FcConfig *config, FcConfigFileInfoIter *iter, FcChar8 **name, FcChar8 **description, FcBool *enabled); /* fccharset.c */ FcPublic FcCharSet* FcCharSetCreate (void); /* deprecated alias for FcCharSetCreate */ FcPublic FcCharSet * FcCharSetNew (void); FcPublic void FcCharSetDestroy (FcCharSet *fcs); FcPublic FcBool FcCharSetAddChar (FcCharSet *fcs, FcChar32 ucs4); FcPublic FcBool FcCharSetDelChar (FcCharSet *fcs, FcChar32 ucs4); FcPublic FcCharSet* FcCharSetCopy (FcCharSet *src); FcPublic FcBool FcCharSetEqual (const FcCharSet *a, const FcCharSet *b); FcPublic FcCharSet* FcCharSetIntersect (const FcCharSet *a, const FcCharSet *b); FcPublic FcCharSet* FcCharSetUnion (const FcCharSet *a, const FcCharSet *b); FcPublic FcCharSet* FcCharSetSubtract (const FcCharSet *a, const FcCharSet *b); FcPublic FcBool FcCharSetMerge (FcCharSet *a, const FcCharSet *b, FcBool *changed); FcPublic FcBool FcCharSetHasChar (const FcCharSet *fcs, FcChar32 ucs4); FcPublic FcChar32 FcCharSetCount (const FcCharSet *a); FcPublic FcChar32 FcCharSetIntersectCount (const FcCharSet *a, const FcCharSet *b); FcPublic FcChar32 FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b); FcPublic FcBool FcCharSetIsSubset (const FcCharSet *a, const FcCharSet *b); #define FC_CHARSET_MAP_SIZE (256/32) #define FC_CHARSET_DONE ((FcChar32) -1) FcPublic FcChar32 FcCharSetFirstPage (const FcCharSet *a, FcChar32 map[FC_CHARSET_MAP_SIZE], FcChar32 *next); FcPublic FcChar32 FcCharSetNextPage (const FcCharSet *a, FcChar32 map[FC_CHARSET_MAP_SIZE], FcChar32 *next); /* * old coverage API, rather hard to use correctly */ FcPublic FcChar32 FcCharSetCoverage (const FcCharSet *a, FcChar32 page, FcChar32 *result); /* fcdbg.c */ FcPublic void FcValuePrint (const FcValue v); FcPublic void FcPatternPrint (const FcPattern *p); FcPublic void FcFontSetPrint (const FcFontSet *s); /* fcdefault.c */ FcPublic FcStrSet * FcGetDefaultLangs (void); FcPublic void FcDefaultSubstitute (FcPattern *pattern); /* fcdir.c */ FcPublic FcBool FcFileIsDir (const FcChar8 *file); FcPublic FcBool FcFileScan (FcFontSet *set, FcStrSet *dirs, FcFileCache *cache, FcBlanks *blanks, const FcChar8 *file, FcBool force); FcPublic FcBool FcDirScan (FcFontSet *set, FcStrSet *dirs, FcFileCache *cache, FcBlanks *blanks, const FcChar8 *dir, FcBool force); FcPublic FcBool FcDirSave (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir); FcPublic FcCache * FcDirCacheLoad (const FcChar8 *dir, FcConfig *config, FcChar8 **cache_file); FcPublic FcCache * FcDirCacheRescan (const FcChar8 *dir, FcConfig *config); FcPublic FcCache * FcDirCacheRead (const FcChar8 *dir, FcBool force, FcConfig *config); FcPublic FcCache * FcDirCacheLoadFile (const FcChar8 *cache_file, struct stat *file_stat); FcPublic void FcDirCacheUnload (FcCache *cache); /* fcfreetype.c */ FcPublic FcPattern * FcFreeTypeQuery (const FcChar8 *file, unsigned int id, FcBlanks *blanks, int *count); FcPublic unsigned int FcFreeTypeQueryAll(const FcChar8 *file, unsigned int id, FcBlanks *blanks, int *count, FcFontSet *set); /* fcfs.c */ FcPublic FcFontSet * FcFontSetCreate (void); FcPublic void FcFontSetDestroy (FcFontSet *s); FcPublic FcBool FcFontSetAdd (FcFontSet *s, FcPattern *font); /* fcinit.c */ FcPublic FcConfig * FcInitLoadConfig (void); FcPublic FcConfig * FcInitLoadConfigAndFonts (void); FcPublic FcBool FcInit (void); FcPublic void FcFini (void); FcPublic int FcGetVersion (void); FcPublic FcBool FcInitReinitialize (void); FcPublic FcBool FcInitBringUptoDate (void); /* fclang.c */ FcPublic FcStrSet * FcGetLangs (void); FcPublic FcChar8 * FcLangNormalize (const FcChar8 *lang); FcPublic const FcCharSet * FcLangGetCharSet (const FcChar8 *lang); FcPublic FcLangSet* FcLangSetCreate (void); FcPublic void FcLangSetDestroy (FcLangSet *ls); FcPublic FcLangSet* FcLangSetCopy (const FcLangSet *ls); FcPublic FcBool FcLangSetAdd (FcLangSet *ls, const FcChar8 *lang); FcPublic FcBool FcLangSetDel (FcLangSet *ls, const FcChar8 *lang); FcPublic FcLangResult FcLangSetHasLang (const FcLangSet *ls, const FcChar8 *lang); FcPublic FcLangResult FcLangSetCompare (const FcLangSet *lsa, const FcLangSet *lsb); FcPublic FcBool FcLangSetContains (const FcLangSet *lsa, const FcLangSet *lsb); FcPublic FcBool FcLangSetEqual (const FcLangSet *lsa, const FcLangSet *lsb); FcPublic FcChar32 FcLangSetHash (const FcLangSet *ls); FcPublic FcStrSet * FcLangSetGetLangs (const FcLangSet *ls); FcPublic FcLangSet * FcLangSetUnion (const FcLangSet *a, const FcLangSet *b); FcPublic FcLangSet * FcLangSetSubtract (const FcLangSet *a, const FcLangSet *b); /* fclist.c */ FcPublic FcObjectSet * FcObjectSetCreate (void); FcPublic FcBool FcObjectSetAdd (FcObjectSet *os, const char *object); FcPublic void FcObjectSetDestroy (FcObjectSet *os); FcPublic FcObjectSet * FcObjectSetVaBuild (const char *first, va_list va); FcPublic FcObjectSet * FcObjectSetBuild (const char *first, ...) FC_ATTRIBUTE_SENTINEL(0); FcPublic FcFontSet * FcFontSetList (FcConfig *config, FcFontSet **sets, int nsets, FcPattern *p, FcObjectSet *os); FcPublic FcFontSet * FcFontList (FcConfig *config, FcPattern *p, FcObjectSet *os); /* fcatomic.c */ FcPublic FcAtomic * FcAtomicCreate (const FcChar8 *file); FcPublic FcBool FcAtomicLock (FcAtomic *atomic); FcPublic FcChar8 * FcAtomicNewFile (FcAtomic *atomic); FcPublic FcChar8 * FcAtomicOrigFile (FcAtomic *atomic); FcPublic FcBool FcAtomicReplaceOrig (FcAtomic *atomic); FcPublic void FcAtomicDeleteNew (FcAtomic *atomic); FcPublic void FcAtomicUnlock (FcAtomic *atomic); FcPublic void FcAtomicDestroy (FcAtomic *atomic); /* fcmatch.c */ FcPublic FcPattern * FcFontSetMatch (FcConfig *config, FcFontSet **sets, int nsets, FcPattern *p, FcResult *result); FcPublic FcPattern * FcFontMatch (FcConfig *config, FcPattern *p, FcResult *result); FcPublic FcPattern * FcFontRenderPrepare (FcConfig *config, FcPattern *pat, FcPattern *font); FcPublic FcFontSet * FcFontSetSort (FcConfig *config, FcFontSet **sets, int nsets, FcPattern *p, FcBool trim, FcCharSet **csp, FcResult *result); FcPublic FcFontSet * FcFontSort (FcConfig *config, FcPattern *p, FcBool trim, FcCharSet **csp, FcResult *result); FcPublic void FcFontSetSortDestroy (FcFontSet *fs); /* fcmatrix.c */ FcPublic FcMatrix * FcMatrixCopy (const FcMatrix *mat); FcPublic FcBool FcMatrixEqual (const FcMatrix *mat1, const FcMatrix *mat2); FcPublic void FcMatrixMultiply (FcMatrix *result, const FcMatrix *a, const FcMatrix *b); FcPublic void FcMatrixRotate (FcMatrix *m, double c, double s); FcPublic void FcMatrixScale (FcMatrix *m, double sx, double sy); FcPublic void FcMatrixShear (FcMatrix *m, double sh, double sv); /* fcname.c */ /* Deprecated. Does nothing. Returns FcFalse. */ FcPublic FcBool FcNameRegisterObjectTypes (const FcObjectType *types, int ntype); /* Deprecated. Does nothing. Returns FcFalse. */ FcPublic FcBool FcNameUnregisterObjectTypes (const FcObjectType *types, int ntype); FcPublic const FcObjectType * FcNameGetObjectType (const char *object); /* Deprecated. Does nothing. Returns FcFalse. */ FcPublic FcBool FcNameRegisterConstants (const FcConstant *consts, int nconsts); /* Deprecated. Does nothing. Returns FcFalse. */ FcPublic FcBool FcNameUnregisterConstants (const FcConstant *consts, int nconsts); FcPublic const FcConstant * FcNameGetConstant (const FcChar8 *string); FcPublic FcBool FcNameConstant (const FcChar8 *string, int *result); FcPublic FcPattern * FcNameParse (const FcChar8 *name); FcPublic FcChar8 * FcNameUnparse (FcPattern *pat); /* fcpat.c */ FcPublic FcPattern * FcPatternCreate (void); FcPublic FcPattern * FcPatternDuplicate (const FcPattern *p); FcPublic void FcPatternReference (FcPattern *p); FcPublic FcPattern * FcPatternFilter (FcPattern *p, const FcObjectSet *os); FcPublic void FcValueDestroy (FcValue v); FcPublic FcBool FcValueEqual (FcValue va, FcValue vb); FcPublic FcValue FcValueSave (FcValue v); FcPublic void FcPatternDestroy (FcPattern *p); FcPublic FcBool FcPatternEqual (const FcPattern *pa, const FcPattern *pb); FcPublic FcBool FcPatternEqualSubset (const FcPattern *pa, const FcPattern *pb, const FcObjectSet *os); FcPublic FcChar32 FcPatternHash (const FcPattern *p); FcPublic FcBool FcPatternAdd (FcPattern *p, const char *object, FcValue value, FcBool append); FcPublic FcBool FcPatternAddWeak (FcPattern *p, const char *object, FcValue value, FcBool append); FcPublic FcResult FcPatternGet (const FcPattern *p, const char *object, int id, FcValue *v); FcPublic FcResult FcPatternGetWithBinding (const FcPattern *p, const char *object, int id, FcValue *v, FcValueBinding *b); FcPublic FcBool FcPatternDel (FcPattern *p, const char *object); FcPublic FcBool FcPatternRemove (FcPattern *p, const char *object, int id); FcPublic FcBool FcPatternAddInteger (FcPattern *p, const char *object, int i); FcPublic FcBool FcPatternAddDouble (FcPattern *p, const char *object, double d); FcPublic FcBool FcPatternAddString (FcPattern *p, const char *object, const FcChar8 *s); FcPublic FcBool FcPatternAddMatrix (FcPattern *p, const char *object, const FcMatrix *s); FcPublic FcBool FcPatternAddCharSet (FcPattern *p, const char *object, const FcCharSet *c); FcPublic FcBool FcPatternAddBool (FcPattern *p, const char *object, FcBool b); FcPublic FcBool FcPatternAddLangSet (FcPattern *p, const char *object, const FcLangSet *ls); FcPublic FcBool FcPatternAddRange (FcPattern *p, const char *object, const FcRange *r); FcPublic FcResult FcPatternGetInteger (const FcPattern *p, const char *object, int n, int *i); FcPublic FcResult FcPatternGetDouble (const FcPattern *p, const char *object, int n, double *d); FcPublic FcResult FcPatternGetString (const FcPattern *p, const char *object, int n, FcChar8 ** s); FcPublic FcResult FcPatternGetMatrix (const FcPattern *p, const char *object, int n, FcMatrix **s); FcPublic FcResult FcPatternGetCharSet (const FcPattern *p, const char *object, int n, FcCharSet **c); FcPublic FcResult FcPatternGetBool (const FcPattern *p, const char *object, int n, FcBool *b); FcPublic FcResult FcPatternGetLangSet (const FcPattern *p, const char *object, int n, FcLangSet **ls); FcPublic FcResult FcPatternGetRange (const FcPattern *p, const char *object, int id, FcRange **r); FcPublic FcPattern * FcPatternVaBuild (FcPattern *p, va_list va); FcPublic FcPattern * FcPatternBuild (FcPattern *p, ...) FC_ATTRIBUTE_SENTINEL(0); FcPublic FcChar8 * FcPatternFormat (FcPattern *pat, const FcChar8 *format); /* fcrange.c */ FcPublic FcRange * FcRangeCreateDouble (double begin, double end); FcPublic FcRange * FcRangeCreateInteger (FcChar32 begin, FcChar32 end); FcPublic void FcRangeDestroy (FcRange *range); FcPublic FcRange * FcRangeCopy (const FcRange *r); FcPublic FcBool FcRangeGetDouble(const FcRange *range, double *begin, double *end); /* fcweight.c */ FcPublic int FcWeightFromOpenType (int ot_weight); FcPublic double FcWeightFromOpenTypeDouble (double ot_weight); FcPublic int FcWeightToOpenType (int fc_weight); FcPublic double FcWeightToOpenTypeDouble (double fc_weight); /* fcstr.c */ FcPublic FcChar8 * FcStrCopy (const FcChar8 *s); FcPublic FcChar8 * FcStrCopyFilename (const FcChar8 *s); FcPublic FcChar8 * FcStrPlus (const FcChar8 *s1, const FcChar8 *s2); FcPublic void FcStrFree (FcChar8 *s); /* These are ASCII only, suitable only for pattern element names */ #define FcIsUpper(c) ((0101 <= (c) && (c) <= 0132)) #define FcIsLower(c) ((0141 <= (c) && (c) <= 0172)) #define FcToLower(c) (FcIsUpper(c) ? (c) - 0101 + 0141 : (c)) FcPublic FcChar8 * FcStrDowncase (const FcChar8 *s); FcPublic int FcStrCmpIgnoreCase (const FcChar8 *s1, const FcChar8 *s2); FcPublic int FcStrCmp (const FcChar8 *s1, const FcChar8 *s2); FcPublic const FcChar8 * FcStrStrIgnoreCase (const FcChar8 *s1, const FcChar8 *s2); FcPublic const FcChar8 * FcStrStr (const FcChar8 *s1, const FcChar8 *s2); FcPublic int FcUtf8ToUcs4 (const FcChar8 *src_orig, FcChar32 *dst, int len); FcPublic FcBool FcUtf8Len (const FcChar8 *string, int len, int *nchar, int *wchar); #define FC_UTF8_MAX_LEN 6 FcPublic int FcUcs4ToUtf8 (FcChar32 ucs4, FcChar8 dest[FC_UTF8_MAX_LEN]); FcPublic int FcUtf16ToUcs4 (const FcChar8 *src_orig, FcEndian endian, FcChar32 *dst, int len); /* in bytes */ FcPublic FcBool FcUtf16Len (const FcChar8 *string, FcEndian endian, int len, /* in bytes */ int *nchar, int *wchar); FcPublic FcChar8 * FcStrDirname (const FcChar8 *file); FcPublic FcChar8 * FcStrBasename (const FcChar8 *file); FcPublic FcStrSet * FcStrSetCreate (void); FcPublic FcBool FcStrSetMember (FcStrSet *set, const FcChar8 *s); FcPublic FcBool FcStrSetEqual (FcStrSet *sa, FcStrSet *sb); FcPublic FcBool FcStrSetAdd (FcStrSet *set, const FcChar8 *s); FcPublic FcBool FcStrSetAddFilename (FcStrSet *set, const FcChar8 *s); FcPublic FcBool FcStrSetDel (FcStrSet *set, const FcChar8 *s); FcPublic void FcStrSetDestroy (FcStrSet *set); FcPublic FcStrList * FcStrListCreate (FcStrSet *set); FcPublic void FcStrListFirst (FcStrList *list); FcPublic FcChar8 * FcStrListNext (FcStrList *list); FcPublic void FcStrListDone (FcStrList *list); /* fcxml.c */ FcPublic FcBool FcConfigParseAndLoad (FcConfig *config, const FcChar8 *file, FcBool complain); FcPublic FcBool FcConfigParseAndLoadFromMemory (FcConfig *config, const FcChar8 *buffer, FcBool complain); _FCFUNCPROTOEND #undef FC_ATTRIBUTE_SENTINEL #ifndef _FCINT_H_ /* * Deprecated functions are placed here to help users fix their code without * digging through documentation */ #define FcConfigGetRescanInverval FcConfigGetRescanInverval_REPLACE_BY_FcConfigGetRescanInterval #define FcConfigSetRescanInverval FcConfigSetRescanInverval_REPLACE_BY_FcConfigSetRescanInterval #endif #endif /* _FONTCONFIG_H_ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������fontconfig/fcfreetype.h�����������������������������������������������������������������������������0000644�����������������00000003646�14763166026�0011231 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * fontconfig/fontconfig/fcfreetype.h * * Copyright © 2001 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _FCFREETYPE_H_ #define _FCFREETYPE_H_ #include <ft2build.h> #include FT_FREETYPE_H #ifndef FcPublic #define FcPublic #endif _FCFUNCPROTOBEGIN FcPublic FT_UInt FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4); FcPublic FcCharSet * FcFreeTypeCharSetAndSpacing (FT_Face face, FcBlanks *blanks, int *spacing); FcPublic FcCharSet * FcFreeTypeCharSet (FT_Face face, FcBlanks *blanks); FcPublic FcResult FcPatternGetFTFace (const FcPattern *p, const char *object, int n, FT_Face *f); FcPublic FcBool FcPatternAddFTFace (FcPattern *p, const char *object, const FT_Face f); FcPublic FcPattern * FcFreeTypeQueryFace (const FT_Face face, const FcChar8 *file, unsigned int id, FcBlanks *blanks); _FCFUNCPROTOEND #endif ������������������������������������������������������������������������������������������fontconfig/fcprivate.h������������������������������������������������������������������������������0000644�����������������00000010611�14763166026�0011046 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * fontconfig/fontconfig/fcprivate.h * * Copyright © 2001 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _FCPRIVATE_H_ #define _FCPRIVATE_H_ /* * I tried this with functions that took va_list* arguments * but portability concerns made me change these functions * into macros (sigh). */ #define FcPatternVapBuild(result, orig, va) \ { \ FcPattern *__p__ = (orig); \ const char *__o__; \ FcValue __v__; \ \ if (!__p__) \ { \ __p__ = FcPatternCreate (); \ if (!__p__) \ goto _FcPatternVapBuild_bail0; \ } \ for (;;) \ { \ __o__ = va_arg (va, const char *); \ if (!__o__) \ break; \ __v__.type = va_arg (va, int); \ switch (__v__.type) { \ case FcTypeUnknown: \ case FcTypeVoid: \ goto _FcPatternVapBuild_bail1; \ case FcTypeInteger: \ __v__.u.i = va_arg (va, int); \ break; \ case FcTypeDouble: \ __v__.u.d = va_arg (va, double); \ break; \ case FcTypeString: \ __v__.u.s = va_arg (va, const FcChar8 *); \ break; \ case FcTypeBool: \ __v__.u.b = va_arg (va, FcBool); \ break; \ case FcTypeMatrix: \ __v__.u.m = va_arg (va, const FcMatrix *); \ break; \ case FcTypeCharSet: \ __v__.u.c = va_arg (va, const FcCharSet *); \ break; \ case FcTypeFTFace: \ __v__.u.f = va_arg (va, FT_Face); \ break; \ case FcTypeLangSet: \ __v__.u.l = va_arg (va, const FcLangSet *); \ break; \ case FcTypeRange: \ __v__.u.r = va_arg (va, const FcRange *); \ break; \ } \ if (!FcPatternAdd (__p__, __o__, __v__, FcTrue)) \ goto _FcPatternVapBuild_bail1; \ } \ result = __p__; \ goto _FcPatternVapBuild_return; \ \ _FcPatternVapBuild_bail1: \ if (!orig) \ FcPatternDestroy (__p__); \ _FcPatternVapBuild_bail0: \ result = (void*)0; \ \ _FcPatternVapBuild_return: \ ; \ } #define FcObjectSetVapBuild(__ret__, __first__, __va__) \ { \ FcObjectSet *__os__; \ const char *__ob__; \ \ __ret__ = 0; \ __os__ = FcObjectSetCreate (); \ if (!__os__) \ goto _FcObjectSetVapBuild_bail0; \ __ob__ = __first__; \ while (__ob__) \ { \ if (!FcObjectSetAdd (__os__, __ob__)) \ goto _FcObjectSetVapBuild_bail1; \ __ob__ = va_arg (__va__, const char *); \ } \ __ret__ = __os__; \ \ _FcObjectSetVapBuild_bail1: \ if (!__ret__ && __os__) \ FcObjectSetDestroy (__os__); \ _FcObjectSetVapBuild_bail0: \ ; \ } #ifndef FC_ATTRIBUTE_VISIBILITY_HIDDEN #define FC_ATTRIBUTE_VISIBILITY_HIDDEN __attribute((visibility("hidden"))) #endif #ifndef FC_ATTRIBUTE_VISIBILITY_EXPORT #define FC_ATTRIBUTE_VISIBILITY_EXPORT __attribute((visibility("default"))) #endif #endif /* _FCPRIVATE_H_ */ �����������������������������������������������������������������������������������������������������������������������ecpgerrno.h�����������������������������������������������������������������������������������������0000644�����������������00000004754�14763166026�0006726 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/interfaces/ecpg/include/ecpgerrno.h */ #ifndef _ECPG_ERRNO_H #define _ECPG_ERRNO_H #include <errno.h> /* This is a list of all error codes the embedded SQL program can return */ #define ECPG_NO_ERROR 0 #define ECPG_NOT_FOUND 100 /* system error codes returned by ecpglib get the correct number, * but are made negative */ #define ECPG_OUT_OF_MEMORY -ENOMEM /* first we have a set of ecpg messages, they start at 200 */ #define ECPG_UNSUPPORTED -200 #define ECPG_TOO_MANY_ARGUMENTS -201 #define ECPG_TOO_FEW_ARGUMENTS -202 #define ECPG_TOO_MANY_MATCHES -203 #define ECPG_INT_FORMAT -204 #define ECPG_UINT_FORMAT -205 #define ECPG_FLOAT_FORMAT -206 #define ECPG_NUMERIC_FORMAT -207 #define ECPG_INTERVAL_FORMAT -208 #define ECPG_DATE_FORMAT -209 #define ECPG_TIMESTAMP_FORMAT -210 #define ECPG_CONVERT_BOOL -211 #define ECPG_EMPTY -212 #define ECPG_MISSING_INDICATOR -213 #define ECPG_NO_ARRAY -214 #define ECPG_DATA_NOT_ARRAY -215 #define ECPG_ARRAY_INSERT -216 #define ECPG_NO_CONN -220 #define ECPG_NOT_CONN -221 #define ECPG_INVALID_STMT -230 /* dynamic SQL related */ #define ECPG_UNKNOWN_DESCRIPTOR -240 #define ECPG_INVALID_DESCRIPTOR_INDEX -241 #define ECPG_UNKNOWN_DESCRIPTOR_ITEM -242 #define ECPG_VAR_NOT_NUMERIC -243 #define ECPG_VAR_NOT_CHAR -244 /* finally the backend error messages, they start at 400 */ #define ECPG_PGSQL -400 #define ECPG_TRANS -401 #define ECPG_CONNECT -402 #define ECPG_DUPLICATE_KEY -403 #define ECPG_SUBSELECT_NOT_ONE -404 /* for compatibility we define some different error codes for the same error * if adding a new one make sure to not double define it */ #define ECPG_INFORMIX_DUPLICATE_KEY -239 #define ECPG_INFORMIX_SUBSELECT_NOT_ONE -284 /* backend WARNINGs, starting at 600 */ #define ECPG_WARNING_UNRECOGNIZED -600 /* WARNING: (transaction aborted): queries ignored until END */ /* * WARNING: current transaction is aborted, queries ignored until end of * transaction block */ #define ECPG_WARNING_QUERY_IGNORED -601 /* WARNING: PerformPortalClose: portal "*" not found */ #define ECPG_WARNING_UNKNOWN_PORTAL -602 /* WARNING: BEGIN: already a transaction in progress */ #define ECPG_WARNING_IN_TRANSACTION -603 /* WARNING: AbortTransaction and not in in-progress state */ /* WARNING: COMMIT: no transaction in progress */ #define ECPG_WARNING_NO_TRANSACTION -604 /* WARNING: BlankPortalAssignName: portal * already exists */ #define ECPG_WARNING_PORTAL_EXISTS -605 #endif /* !_ECPG_ERRNO_H */ ��������������������inttypes.h������������������������������������������������������������������������������������������0000644�����������������00000027155�14763166026�0006621 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997-2001, 2004, 2007, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99: 7.8 Format conversion of integer types <inttypes.h> */ #ifndef _INTTYPES_H #define _INTTYPES_H 1 #include <features.h> /* Get the type definitions. */ #include <stdint.h> /* Get a definition for wchar_t. But we must not define wchar_t itself. */ #ifndef ____gwchar_t_defined # ifdef __cplusplus # define __gwchar_t wchar_t # elif defined __WCHAR_TYPE__ typedef __WCHAR_TYPE__ __gwchar_t; # else # define __need_wchar_t # include <stddef.h> typedef wchar_t __gwchar_t; # endif # define ____gwchar_t_defined 1 #endif # if __WORDSIZE == 64 # define __PRI64_PREFIX "l" # define __PRIPTR_PREFIX "l" # else # define __PRI64_PREFIX "ll" # define __PRIPTR_PREFIX # endif /* Macros for printing format specifiers. */ /* Decimal notation. */ # define PRId8 "d" # define PRId16 "d" # define PRId32 "d" # define PRId64 __PRI64_PREFIX "d" # define PRIdLEAST8 "d" # define PRIdLEAST16 "d" # define PRIdLEAST32 "d" # define PRIdLEAST64 __PRI64_PREFIX "d" # define PRIdFAST8 "d" # define PRIdFAST16 __PRIPTR_PREFIX "d" # define PRIdFAST32 __PRIPTR_PREFIX "d" # define PRIdFAST64 __PRI64_PREFIX "d" # define PRIi8 "i" # define PRIi16 "i" # define PRIi32 "i" # define PRIi64 __PRI64_PREFIX "i" # define PRIiLEAST8 "i" # define PRIiLEAST16 "i" # define PRIiLEAST32 "i" # define PRIiLEAST64 __PRI64_PREFIX "i" # define PRIiFAST8 "i" # define PRIiFAST16 __PRIPTR_PREFIX "i" # define PRIiFAST32 __PRIPTR_PREFIX "i" # define PRIiFAST64 __PRI64_PREFIX "i" /* Octal notation. */ # define PRIo8 "o" # define PRIo16 "o" # define PRIo32 "o" # define PRIo64 __PRI64_PREFIX "o" # define PRIoLEAST8 "o" # define PRIoLEAST16 "o" # define PRIoLEAST32 "o" # define PRIoLEAST64 __PRI64_PREFIX "o" # define PRIoFAST8 "o" # define PRIoFAST16 __PRIPTR_PREFIX "o" # define PRIoFAST32 __PRIPTR_PREFIX "o" # define PRIoFAST64 __PRI64_PREFIX "o" /* Unsigned integers. */ # define PRIu8 "u" # define PRIu16 "u" # define PRIu32 "u" # define PRIu64 __PRI64_PREFIX "u" # define PRIuLEAST8 "u" # define PRIuLEAST16 "u" # define PRIuLEAST32 "u" # define PRIuLEAST64 __PRI64_PREFIX "u" # define PRIuFAST8 "u" # define PRIuFAST16 __PRIPTR_PREFIX "u" # define PRIuFAST32 __PRIPTR_PREFIX "u" # define PRIuFAST64 __PRI64_PREFIX "u" /* lowercase hexadecimal notation. */ # define PRIx8 "x" # define PRIx16 "x" # define PRIx32 "x" # define PRIx64 __PRI64_PREFIX "x" # define PRIxLEAST8 "x" # define PRIxLEAST16 "x" # define PRIxLEAST32 "x" # define PRIxLEAST64 __PRI64_PREFIX "x" # define PRIxFAST8 "x" # define PRIxFAST16 __PRIPTR_PREFIX "x" # define PRIxFAST32 __PRIPTR_PREFIX "x" # define PRIxFAST64 __PRI64_PREFIX "x" /* UPPERCASE hexadecimal notation. */ # define PRIX8 "X" # define PRIX16 "X" # define PRIX32 "X" # define PRIX64 __PRI64_PREFIX "X" # define PRIXLEAST8 "X" # define PRIXLEAST16 "X" # define PRIXLEAST32 "X" # define PRIXLEAST64 __PRI64_PREFIX "X" # define PRIXFAST8 "X" # define PRIXFAST16 __PRIPTR_PREFIX "X" # define PRIXFAST32 __PRIPTR_PREFIX "X" # define PRIXFAST64 __PRI64_PREFIX "X" /* Macros for printing `intmax_t' and `uintmax_t'. */ # define PRIdMAX __PRI64_PREFIX "d" # define PRIiMAX __PRI64_PREFIX "i" # define PRIoMAX __PRI64_PREFIX "o" # define PRIuMAX __PRI64_PREFIX "u" # define PRIxMAX __PRI64_PREFIX "x" # define PRIXMAX __PRI64_PREFIX "X" /* Macros for printing `intptr_t' and `uintptr_t'. */ # define PRIdPTR __PRIPTR_PREFIX "d" # define PRIiPTR __PRIPTR_PREFIX "i" # define PRIoPTR __PRIPTR_PREFIX "o" # define PRIuPTR __PRIPTR_PREFIX "u" # define PRIxPTR __PRIPTR_PREFIX "x" # define PRIXPTR __PRIPTR_PREFIX "X" /* Macros for scanning format specifiers. */ /* Signed decimal notation. */ # define SCNd8 "hhd" # define SCNd16 "hd" # define SCNd32 "d" # define SCNd64 __PRI64_PREFIX "d" # define SCNdLEAST8 "hhd" # define SCNdLEAST16 "hd" # define SCNdLEAST32 "d" # define SCNdLEAST64 __PRI64_PREFIX "d" # define SCNdFAST8 "hhd" # define SCNdFAST16 __PRIPTR_PREFIX "d" # define SCNdFAST32 __PRIPTR_PREFIX "d" # define SCNdFAST64 __PRI64_PREFIX "d" /* Signed decimal notation. */ # define SCNi8 "hhi" # define SCNi16 "hi" # define SCNi32 "i" # define SCNi64 __PRI64_PREFIX "i" # define SCNiLEAST8 "hhi" # define SCNiLEAST16 "hi" # define SCNiLEAST32 "i" # define SCNiLEAST64 __PRI64_PREFIX "i" # define SCNiFAST8 "hhi" # define SCNiFAST16 __PRIPTR_PREFIX "i" # define SCNiFAST32 __PRIPTR_PREFIX "i" # define SCNiFAST64 __PRI64_PREFIX "i" /* Unsigned decimal notation. */ # define SCNu8 "hhu" # define SCNu16 "hu" # define SCNu32 "u" # define SCNu64 __PRI64_PREFIX "u" # define SCNuLEAST8 "hhu" # define SCNuLEAST16 "hu" # define SCNuLEAST32 "u" # define SCNuLEAST64 __PRI64_PREFIX "u" # define SCNuFAST8 "hhu" # define SCNuFAST16 __PRIPTR_PREFIX "u" # define SCNuFAST32 __PRIPTR_PREFIX "u" # define SCNuFAST64 __PRI64_PREFIX "u" /* Octal notation. */ # define SCNo8 "hho" # define SCNo16 "ho" # define SCNo32 "o" # define SCNo64 __PRI64_PREFIX "o" # define SCNoLEAST8 "hho" # define SCNoLEAST16 "ho" # define SCNoLEAST32 "o" # define SCNoLEAST64 __PRI64_PREFIX "o" # define SCNoFAST8 "hho" # define SCNoFAST16 __PRIPTR_PREFIX "o" # define SCNoFAST32 __PRIPTR_PREFIX "o" # define SCNoFAST64 __PRI64_PREFIX "o" /* Hexadecimal notation. */ # define SCNx8 "hhx" # define SCNx16 "hx" # define SCNx32 "x" # define SCNx64 __PRI64_PREFIX "x" # define SCNxLEAST8 "hhx" # define SCNxLEAST16 "hx" # define SCNxLEAST32 "x" # define SCNxLEAST64 __PRI64_PREFIX "x" # define SCNxFAST8 "hhx" # define SCNxFAST16 __PRIPTR_PREFIX "x" # define SCNxFAST32 __PRIPTR_PREFIX "x" # define SCNxFAST64 __PRI64_PREFIX "x" /* Macros for scanning `intmax_t' and `uintmax_t'. */ # define SCNdMAX __PRI64_PREFIX "d" # define SCNiMAX __PRI64_PREFIX "i" # define SCNoMAX __PRI64_PREFIX "o" # define SCNuMAX __PRI64_PREFIX "u" # define SCNxMAX __PRI64_PREFIX "x" /* Macros for scaning `intptr_t' and `uintptr_t'. */ # define SCNdPTR __PRIPTR_PREFIX "d" # define SCNiPTR __PRIPTR_PREFIX "i" # define SCNoPTR __PRIPTR_PREFIX "o" # define SCNuPTR __PRIPTR_PREFIX "u" # define SCNxPTR __PRIPTR_PREFIX "x" __BEGIN_DECLS #if __WORDSIZE == 64 /* We have to define the `uintmax_t' type using `ldiv_t'. */ typedef struct { long int quot; /* Quotient. */ long int rem; /* Remainder. */ } imaxdiv_t; #else /* We have to define the `uintmax_t' type using `lldiv_t'. */ typedef struct { long long int quot; /* Quotient. */ long long int rem; /* Remainder. */ } imaxdiv_t; #endif /* Compute absolute value of N. */ extern intmax_t imaxabs (intmax_t __n) __THROW __attribute__ ((__const__)); /* Return the `imaxdiv_t' representation of the value of NUMER over DENOM. */ extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) __THROW __attribute__ ((__const__)); /* Like `strtol' but convert to `intmax_t'. */ extern intmax_t strtoimax (const char *__restrict __nptr, char **__restrict __endptr, int __base) __THROW; /* Like `strtoul' but convert to `uintmax_t'. */ extern uintmax_t strtoumax (const char *__restrict __nptr, char ** __restrict __endptr, int __base) __THROW; /* Like `wcstol' but convert to `intmax_t'. */ extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, __gwchar_t **__restrict __endptr, int __base) __THROW; /* Like `wcstoul' but convert to `uintmax_t'. */ extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, __gwchar_t ** __restrict __endptr, int __base) __THROW; #ifdef __USE_EXTERN_INLINES # if __WORDSIZE == 64 extern long int __strtol_internal (const char *__restrict __nptr, char **__restrict __endptr, int __base, int __group) __THROW __nonnull ((1)) __wur; /* Like `strtol' but convert to `intmax_t'. */ __extern_inline intmax_t __NTH (strtoimax (const char *__restrict nptr, char **__restrict endptr, int base)) { return __strtol_internal (nptr, endptr, base, 0); } extern unsigned long int __strtoul_internal (const char *__restrict __nptr, char ** __restrict __endptr, int __base, int __group) __THROW __nonnull ((1)) __wur; /* Like `strtoul' but convert to `uintmax_t'. */ __extern_inline uintmax_t __NTH (strtoumax (const char *__restrict nptr, char **__restrict endptr, int base)) { return __strtoul_internal (nptr, endptr, base, 0); } extern long int __wcstol_internal (const __gwchar_t * __restrict __nptr, __gwchar_t **__restrict __endptr, int __base, int __group) __THROW __nonnull ((1)) __wur; /* Like `wcstol' but convert to `intmax_t'. */ __extern_inline intmax_t __NTH (wcstoimax (const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr, int base)) { return __wcstol_internal (nptr, endptr, base, 0); } extern unsigned long int __wcstoul_internal (const __gwchar_t * __restrict __nptr, __gwchar_t ** __restrict __endptr, int __base, int __group) __THROW __nonnull ((1)) __wur; /* Like `wcstoul' but convert to `uintmax_t'. */ __extern_inline uintmax_t __NTH (wcstoumax (const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr, int base)) { return __wcstoul_internal (nptr, endptr, base, 0); } # else /* __WORDSIZE == 32 */ __extension__ extern long long int __strtoll_internal (const char *__restrict __nptr, char **__restrict __endptr, int __base, int __group) __THROW __nonnull ((1)) __wur; /* Like `strtol' but convert to `intmax_t'. */ __extern_inline intmax_t __NTH (strtoimax (const char *__restrict nptr, char **__restrict endptr, int base)) { return __strtoll_internal (nptr, endptr, base, 0); } __extension__ extern unsigned long long int __strtoull_internal (const char * __restrict __nptr, char ** __restrict __endptr, int __base, int __group) __THROW __nonnull ((1)) __wur; /* Like `strtoul' but convert to `uintmax_t'. */ __extern_inline uintmax_t __NTH (strtoumax (const char *__restrict nptr, char **__restrict endptr, int base)) { return __strtoull_internal (nptr, endptr, base, 0); } __extension__ extern long long int __wcstoll_internal (const __gwchar_t *__restrict __nptr, __gwchar_t **__restrict __endptr, int __base, int __group) __THROW __nonnull ((1)) __wur; /* Like `wcstol' but convert to `intmax_t'. */ __extern_inline intmax_t __NTH (wcstoimax (const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr, int base)) { return __wcstoll_internal (nptr, endptr, base, 0); } __extension__ extern unsigned long long int __wcstoull_internal (const __gwchar_t * __restrict __nptr, __gwchar_t ** __restrict __endptr, int __base, int __group) __THROW __nonnull ((1)) __wur; /* Like `wcstoul' but convert to `uintmax_t'. */ __extern_inline uintmax_t __NTH (wcstoumax (const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr, int base)) { return __wcstoull_internal (nptr, endptr, base, 0); } # endif /* __WORDSIZE == 32 */ #endif /* Use extern inlines. */ __END_DECLS #endif /* inttypes.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������postgres_ext.h��������������������������������������������������������������������������������������0000644�����������������00000003363�14763166026�0007463 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * postgres_ext.h * * This file contains declarations of things that are visible everywhere * in PostgreSQL *and* are visible to clients of frontend interface libraries. * For example, the Oid type is part of the API of libpq and other libraries. * * Declarations which are specific to a particular interface should * go in the header file for that interface (such as libpq-fe.h). This * file is only for fundamental Postgres declarations. * * User-written C functions don't count as "external to Postgres." * Those function much as local modifications to the backend itself, and * use header files that are otherwise internal to Postgres to interface * with the backend. * * src/include/postgres_ext.h * *------------------------------------------------------------------------- */ #ifndef POSTGRES_EXT_H #define POSTGRES_EXT_H /* * Object ID is a fundamental type in Postgres. */ typedef unsigned int Oid; #ifdef __cplusplus #define InvalidOid (Oid(0)) #else #define InvalidOid ((Oid) 0) #endif #define OID_MAX UINT_MAX /* you will need to include <limits.h> to use the above #define */ /* * Identifiers of error message fields. Kept here to keep common * between frontend and backend, and also to export them to libpq * applications. */ #define PG_DIAG_SEVERITY 'S' #define PG_DIAG_SQLSTATE 'C' #define PG_DIAG_MESSAGE_PRIMARY 'M' #define PG_DIAG_MESSAGE_DETAIL 'D' #define PG_DIAG_MESSAGE_HINT 'H' #define PG_DIAG_STATEMENT_POSITION 'P' #define PG_DIAG_INTERNAL_POSITION 'p' #define PG_DIAG_INTERNAL_QUERY 'q' #define PG_DIAG_CONTEXT 'W' #define PG_DIAG_SOURCE_FILE 'F' #define PG_DIAG_SOURCE_LINE 'L' #define PG_DIAG_SOURCE_FUNCTION 'R' #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ieee754.h�������������������������������������������������������������������������������������������0000644�����������������00000011473�14763166026�0006105 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1992, 1995, 1996, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _IEEE754_H #define _IEEE754_H 1 #include <features.h> #include <endian.h> __BEGIN_DECLS union ieee754_float { float f; /* This is the IEEE 754 single-precision format. */ struct { #if __BYTE_ORDER == __BIG_ENDIAN unsigned int negative:1; unsigned int exponent:8; unsigned int mantissa:23; #endif /* Big endian. */ #if __BYTE_ORDER == __LITTLE_ENDIAN unsigned int mantissa:23; unsigned int exponent:8; unsigned int negative:1; #endif /* Little endian. */ } ieee; /* This format makes it easier to see if a NaN is a signalling NaN. */ struct { #if __BYTE_ORDER == __BIG_ENDIAN unsigned int negative:1; unsigned int exponent:8; unsigned int quiet_nan:1; unsigned int mantissa:22; #endif /* Big endian. */ #if __BYTE_ORDER == __LITTLE_ENDIAN unsigned int mantissa:22; unsigned int quiet_nan:1; unsigned int exponent:8; unsigned int negative:1; #endif /* Little endian. */ } ieee_nan; }; #define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */ union ieee754_double { double d; /* This is the IEEE 754 double-precision format. */ struct { #if __BYTE_ORDER == __BIG_ENDIAN unsigned int negative:1; unsigned int exponent:11; /* Together these comprise the mantissa. */ unsigned int mantissa0:20; unsigned int mantissa1:32; #endif /* Big endian. */ #if __BYTE_ORDER == __LITTLE_ENDIAN # if __FLOAT_WORD_ORDER == __BIG_ENDIAN unsigned int mantissa0:20; unsigned int exponent:11; unsigned int negative:1; unsigned int mantissa1:32; # else /* Together these comprise the mantissa. */ unsigned int mantissa1:32; unsigned int mantissa0:20; unsigned int exponent:11; unsigned int negative:1; # endif #endif /* Little endian. */ } ieee; /* This format makes it easier to see if a NaN is a signalling NaN. */ struct { #if __BYTE_ORDER == __BIG_ENDIAN unsigned int negative:1; unsigned int exponent:11; unsigned int quiet_nan:1; /* Together these comprise the mantissa. */ unsigned int mantissa0:19; unsigned int mantissa1:32; #else # if __FLOAT_WORD_ORDER == __BIG_ENDIAN unsigned int mantissa0:19; unsigned int quiet_nan:1; unsigned int exponent:11; unsigned int negative:1; unsigned int mantissa1:32; # else /* Together these comprise the mantissa. */ unsigned int mantissa1:32; unsigned int mantissa0:19; unsigned int quiet_nan:1; unsigned int exponent:11; unsigned int negative:1; # endif #endif } ieee_nan; }; #define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */ union ieee854_long_double { long double d; /* This is the IEEE 854 double-extended-precision format. */ struct { #if __BYTE_ORDER == __BIG_ENDIAN unsigned int negative:1; unsigned int exponent:15; unsigned int empty:16; unsigned int mantissa0:32; unsigned int mantissa1:32; #endif #if __BYTE_ORDER == __LITTLE_ENDIAN # if __FLOAT_WORD_ORDER == __BIG_ENDIAN unsigned int exponent:15; unsigned int negative:1; unsigned int empty:16; unsigned int mantissa0:32; unsigned int mantissa1:32; # else unsigned int mantissa1:32; unsigned int mantissa0:32; unsigned int exponent:15; unsigned int negative:1; unsigned int empty:16; # endif #endif } ieee; /* This is for NaNs in the IEEE 854 double-extended-precision format. */ struct { #if __BYTE_ORDER == __BIG_ENDIAN unsigned int negative:1; unsigned int exponent:15; unsigned int empty:16; unsigned int one:1; unsigned int quiet_nan:1; unsigned int mantissa0:30; unsigned int mantissa1:32; #endif #if __BYTE_ORDER == __LITTLE_ENDIAN # if __FLOAT_WORD_ORDER == __BIG_ENDIAN unsigned int exponent:15; unsigned int negative:1; unsigned int empty:16; unsigned int mantissa0:30; unsigned int quiet_nan:1; unsigned int one:1; unsigned int mantissa1:32; # else unsigned int mantissa1:32; unsigned int mantissa0:30; unsigned int quiet_nan:1; unsigned int one:1; unsigned int exponent:15; unsigned int negative:1; unsigned int empty:16; # endif #endif } ieee_nan; }; #define IEEE854_LONG_DOUBLE_BIAS 0x3fff __END_DECLS #endif /* ieee754.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/nislib.h�������������������������������������������������������������������������������������0000644�����������������00000031277�14763166026�0007522 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997, 1998, 1999, 2006, 2007, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __RPCSVC_NISLIB_H__ #define __RPCSVC_NISLIB_H__ #include <features.h> __BEGIN_DECLS typedef const char *const_nis_name; /* nis_names: These functions are used to locate and manipulate all NIS+ * objects except the NIS+ entry objects. * * nis_lookup (name, flags) resolves a NIS+ name and returns a copy of * that object from a NIS+ server. * const nis_name name: name of the object to be resolved * unsigned int flags: logically ORing zero or more flags (FOLLOW_LINKS, * HARD_LOOKUP, [NO_CACHE], MASTER_ONLY, EXPAND_NAME) * * nis_add (name, obj) adds objects to the NIS+ namespace. * const nis_name name: fully qualified NIS+ name. * const nis_object *obj: object members zo_name and zo_domain will be * constructed from name. * * nis_remove (name, obj) removes objects from the NIS+ namespace. * const nis_name name: fully qualified NIS+ name. * const nis_object *obj: if not NULL, it is assumed to point to a copy * of the object being removed. In this case, if * the object on the server does not have the same * object identifier as the object being passed, * the operation will fail with the NIS_NOTSAMEOBJ * error. * * nis_modify (name, obj) can change specific attributes of an object * that already exists in the namespace. */ extern nis_result *nis_lookup (const_nis_name name, unsigned int flags) __THROW; extern nis_result *nis_add (const_nis_name name, const nis_object *obj) __THROW; extern nis_result *nis_remove (const_nis_name name, const nis_object *obj) __THROW; extern nis_result *nis_modify (const_nis_name name, const nis_object *obj) __THROW; /* nis_tables: These functions are used to search and modify NIS+ tables. * * nis_list (table_name, flags, callback(table_name, obj, userdata), userdata) * search a table in the NIS+ namespace. * const nis_name table_name: indexed name ([xx=yy],table.dir) * unsigned int flags: logically ORing one or more flags (FOLLOW_LINKS, * [FOLLOW_PATH], HARD_LOOKUP, [ALL_RESULTS], [NO_CACHE], * MASTER_ONLY, EXPAND_NAME, RETURN_RESULT) * callback(): callback is an optional pointer to a function that will * process the ENTRY type objects that are returned from the * search. If this pointer is NULL, then all entries that match * the search criteria are returned in the nis_result structure, * otherwise this function will be called once for each * entry returned. * void *userdata: passed to callback function along with the returned * entry object. * * nis_add_entry (table_name, obj, flags) will add the NIS+ object to the * NIS+ table_name. * const nis_name table_name * const nis_object *obj * unsigned int flags: 0, ADD_OVERWRITE, RETURN_RESULT * * nis_modify_entry (name, obj, flags) modifies an object identified by name. * const nis_name name: object identifier * const nis_object *obj: should point to an entry with the EN_MODIFIED * flag set in each column that contains new * information. * unsigned int flags: 0, MOD_SAMEOBJ, RETURN_RESULT * * nis_remove_entry (table_name, obj, flags) removes a set of entries * identified by table_name from the table. * const nis_name table_name: indexed NIS+ name * const nis_object *obj: if obj is non-null, it is presumed to point to * a cached copy of the entry. When the removal is * attempted, and the object that would be removed * is not the same as the cached object pointed to * by object then the operation will fail with an * NIS_NOTSAMEOBJ error * unsigned int flags: 0, REM_MULTIPLE * * nis_first_entry (table_name) fetches entries from a table one at a time. * const nis_name table_name * * nis_next_entry (table_name, cookie) retrieves the "next" entry from a * table specified by table_name. * const nis_name table_name: * const netobj *cookie: The value of cookie from the nis_result structure * form the previous call. */ extern nis_result *nis_list (const_nis_name __name, unsigned int __flags, int (*__callback)(const_nis_name __table_name, const nis_object *__obj, const void *__userdata), const void *__userdata) __THROW; extern nis_result *nis_add_entry (const_nis_name __table_name, const nis_object *__obj, unsigned int __flags) __THROW; extern nis_result *nis_modify_entry (const_nis_name __name, const nis_object *__obj, unsigned int __flags) __THROW; extern nis_result *nis_remove_entry (const_nis_name __table_name, const nis_object *__obj, unsigned int __flags) __THROW; extern nis_result *nis_first_entry (const_nis_name __table_name) __THROW; extern nis_result *nis_next_entry (const_nis_name __table_name, const netobj *__cookie) __THROW; /* ** nis_server */ extern nis_error nis_mkdir (const_nis_name __dirname, const nis_server *__machine) __THROW; extern nis_error nis_rmdir (const_nis_name __dirname, const nis_server *__machine) __THROW; extern nis_error nis_servstate (const nis_server *__machine, const nis_tag *__tags, int __numtags, nis_tag **__result) __THROW; extern nis_error nis_stats (const nis_server *__machine, const nis_tag *__tags, int __numtags, nis_tag **__result) __THROW; extern void nis_freetags (nis_tag *__tags, int __numtags) __THROW; extern nis_server **nis_getservlist (const_nis_name __dirname) __THROW; extern void nis_freeservlist (nis_server **__machines) __THROW; /* ** nis_subr */ extern nis_name nis_leaf_of (const_nis_name __name) __THROW; extern nis_name nis_leaf_of_r (const_nis_name __name, char *__buffer, size_t __buflen) __THROW; extern nis_name nis_name_of (const_nis_name __name) __THROW; extern nis_name nis_name_of_r (const_nis_name __name, char *__buffer, size_t __buflen) __THROW; extern nis_name nis_domain_of (const_nis_name __name) __THROW; extern nis_name nis_domain_of_r (const_nis_name __name, char *__buffer, size_t __buflen) __THROW; extern nis_name *nis_getnames (const_nis_name __name) __THROW; extern void nis_freenames (nis_name *__namelist) __THROW; extern name_pos nis_dir_cmp (const_nis_name __n1, const_nis_name __n2) __THROW; extern nis_object *nis_clone_object (const nis_object *__src, nis_object *__dest) __THROW; extern void nis_destroy_object (nis_object *__obj) __THROW; extern void nis_print_object (const nis_object *__obj) __THROW; /* ** nis_local_names */ extern nis_name nis_local_group (void) __THROW; extern nis_name nis_local_directory (void) __THROW; extern nis_name nis_local_principal (void) __THROW; extern nis_name nis_local_host (void) __THROW; /* ** nis_error */ extern const char *nis_sperrno (const nis_error __status) __THROW; extern void nis_perror (const nis_error __status, const char *__label) __THROW; extern void nis_lerror (const nis_error __status, const char *__label) __THROW; extern char *nis_sperror (const nis_error status, const char *__label) __THROW; extern char *nis_sperror_r (const nis_error __status, const char *__label, char *__buffer, size_t __buflen) __THROW; /* ** nis_groups */ extern bool_t nis_ismember (const_nis_name __principal, const_nis_name __group) __THROW; extern nis_error nis_addmember (const_nis_name __member, const_nis_name __group) __THROW; extern nis_error nis_removemember (const_nis_name __member, const_nis_name __group) __THROW; extern nis_error nis_creategroup (const_nis_name __group, unsigned int __flags) __THROW; extern nis_error nis_destroygroup (const_nis_name __group) __THROW; extern void nis_print_group_entry (const_nis_name __group) __THROW; extern nis_error nis_verifygroup (const_nis_name __group) __THROW; /* ** nis_ping */ extern void nis_ping (const_nis_name __dirname, uint32_t __utime, const nis_object *__dirobj) __THROW; extern nis_result *nis_checkpoint (const_nis_name __dirname) __THROW; /* ** nis_print (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */ extern void nis_print_result (const nis_result *__result) __THROW; extern void nis_print_rights (unsigned int __rights) __THROW; extern void nis_print_directory (const directory_obj *__dirobj) __THROW; extern void nis_print_group (const group_obj *__grpobj) __THROW; extern void nis_print_table (const table_obj *__tblobj) __THROW; extern void nis_print_link (const link_obj *__lnkobj) __THROW; extern void nis_print_entry (const entry_obj *__enobj) __THROW; /* ** nis_file (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */ extern directory_obj *readColdStartFile (void) __THROW; extern bool_t writeColdStartFile (const directory_obj *__dirobj) __THROW; extern nis_object *nis_read_obj (const char *__obj) __THROW; extern bool_t nis_write_obj (const char *__file, const nis_object *__obj) __THROW; /* ** nis_clone - (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */ extern directory_obj *nis_clone_directory (const directory_obj *__src, directory_obj *__dest) __THROW; extern nis_result *nis_clone_result (const nis_result *__src, nis_result *__dest) __THROW; /* nis_free - nis_freeresult */ extern void nis_freeresult (nis_result *__result) __THROW; /* (XXX THE FOLLOWING ARE INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */ extern void nis_free_request (ib_request *__req) __THROW; extern void nis_free_directory (directory_obj *__dirobj) __THROW; extern void nis_free_object (nis_object *__obj) __THROW; /* (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */ extern nis_name __nis_default_owner (char *) __THROW; extern nis_name __nis_default_group (char *) __THROW; extern uint32_t __nis_default_ttl (char *) __THROW; extern unsigned int __nis_default_access (char *, unsigned int) __THROW; extern fd_result *__nis_finddirectory (directory_obj *, const_nis_name) __THROW; extern void __free_fdresult (fd_result *) __THROW; extern uint32_t __nis_hash (const void *__keyarg, size_t __len) __THROW; /* NIS+ cache locking */ extern int __nis_lock_cache (void) __THROW; extern int __nis_unlock_cache (void) __THROW; /* (XXX INTERNAL FUNCTIONS, ONLY FOR rpc.nisd AND glibc !!) */ #if defined (NIS_INTERNAL) || defined (_LIBC) struct dir_binding { CLIENT *clnt; /* RPC CLIENT handle */ nis_server *server_val; /* List of servers */ unsigned int server_len; /* # of servers */ unsigned int server_used; /* Which server we are bind in the moment ? */ unsigned int current_ep; /* Which endpoint of the server are in use? */ unsigned int trys; /* How many server have we tried ? */ unsigned int class; /* From which class is server_val ? */ bool_t master_only; /* Is only binded to the master */ bool_t use_auth; /* Do we use AUTH ? */ bool_t use_udp; /* Do we use UDP ? */ struct sockaddr_in addr; /* Server's IP address */ int socket; /* Server's local socket */ }; typedef struct dir_binding dir_binding; extern nis_error __nisbind_create (dir_binding *, const nis_server *, unsigned int, unsigned int, unsigned int, unsigned int) __THROW; extern nis_error __nisbind_connect (dir_binding *) __THROW; extern nis_error __nisbind_next (dir_binding *) __THROW; extern void __nisbind_destroy (dir_binding *) __THROW; extern nis_error __nisfind_server (const_nis_name, int, directory_obj **, dir_binding *, unsigned int) __THROW; #endif __END_DECLS #endif /* __RPCSVC_NISLIB_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/yp_prot.h������������������������������������������������������������������������������������0000644�����������������00000024403�14763166026�0007727 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file contains symbols and structures defining the rpc protocol * between the NIS clients and the NIS servers. The servers * are the NIS database servers, and the NIS binders. */ #ifndef _RPCSVC_YP_PROT_H #define _RPCSVC_YP_PROT_H #include <features.h> #include <rpc/rpc.h> #include <rpcsvc/ypclnt.h> __BEGIN_DECLS /* * The following procedures are supported by the protocol: * * YPPROC_NULL() returns () takes nothing, returns nothing. This indicates * that the NIS server is alive. * * YPPROC_DOMAIN (char *) returns (bool_t) TRUE. Indicates that the * responding NIS server does serve the named domain; FALSE indicates no * support. * * YPPROC_DOMAIN_NONACK (char *) returns (TRUE) if the NIS server does serve * the named domain, otherwise does not return. Used in the broadcast case. * * YPPROC_MATCH (struct ypreq_key) returns (struct ypresp_val). Returns the * right-hand value for a passed left-hand key, within a named map and * domain. * * YPPROC_FIRST (struct ypreq_nokey) returns (struct ypresp_key_val). * Returns the first key-value pair from a named domain and map. * * YPPROC_NEXT (struct ypreq_key) returns (struct ypresp_key_val). Returns * the key-value pair following a passed key-value pair within a named * domain and map. * * YPPROC_XFR (struct ypreq_xfr) returns nothing. Indicates to a server that * a map should be updated. * * YPPROC_CLEAR takes nothing, returns nothing. Instructs a NIS server to * close the current map, so that old versions of the disk file don't get * held open. * * YPPROC_ALL (struct ypreq_nokey), returns * union switch (bool_t more) { * TRUE: (struct ypresp_key_val); * FALSE: (struct) {}; * } * * YPPROC_MASTER (struct ypreq_nokey), returns (ypresp_master) * * YPPROC_ORDER (struct ypreq_nokey), returns (ypresp_order) * * YPPROC_MAPLIST (char *), returns (struct ypmaplist *) */ /* Program and version symbols, magic numbers */ #define YPPROG 100004 #define YPVERS 2 #define YPVERS_ORIG 1 #define YPMAXRECORD 1024 #define YPMAXDOMAIN 64 /* XXX orig. yp_prot.h defines 256 */ #define YPMAXMAP 64 #define YPMAXPEER 64 /* XXX orig. yp_prot.h defines 256 */ /* byte size of a large NIS packet */ #define YPMSGSZ 1600 typedef struct { u_int keydat_len; char *keydat_val; } keydat_t; typedef struct { u_int valdat_len; char *valdat_val; } valdat_t; struct ypmap_parms { char *domain; /* Null string means not available */ char *map; /* Null string means not available */ unsigned int ordernum; /* 0 means not available */ char *owner; /* Null string means not available */ }; /* * Request parameter structures */ struct ypreq_key { const char *domain; const char *map; keydat_t keydat; }; struct ypreq_nokey { char *domain; char *map; }; struct ypreq_xfr { struct ypmap_parms map_parms; u_int transid; u_int proto; u_int port; }; #define ypxfr_domain map_parms.domain #define ypxfr_map map_parms.map #define ypxfr_ordernum map_parms.ordernum #define ypxfr_owner map_parms.owner /* Return status values */ enum ypstat { YP_TRUE = 1, /* General purpose success code */ #define YP_TRUE YP_TRUE YP_NOMORE = 2, /* No more entries in map */ #define YP_NOMORE YP_NOMORE YP_FALSE = 0, /* General purpose failure code */ #define YP_FALSE YP_FALSE YP_NOMAP = -1, /* No such map in domain */ #define YP_NOMAP YP_NOMAP YP_NODOM = -2, /* Domain not supported */ #define YP_NODOM YP_NODOM YP_NOKEY = -3, /* No such key in map */ #define YP_NOKEY YP_NOKEY YP_BADOP = -4, /* Invalid operation */ #define YP_BADOP YP_BADOP YP_BADDB = -5, /* Server data base is bad */ #define YP_BADDB YP_BADDB YP_YPERR = -6, /* NIS server error */ #define YP_YPERR YP_YPERR YP_BADARGS = -7, /* Request arguments bad */ #define YP_BADARGS YP_BADARGS YP_VERS = -8, /* NIS server version mismatch - server can't supply requested service. */ #define YP_VERS YP_VERS }; /* * Response parameter structures */ typedef enum ypstat ypstat; struct ypresp_val { ypstat status; valdat_t valdat; }; struct ypresp_key_val { ypstat status; #ifdef STUPID_SUN_BUG /* This is the form as distributed by Sun. But even the Sun NIS servers expect the values in the other order. So their implementation somehow must change the order internally. We don't want to follow this bad example since the user should be able to use rpcgen on this file. */ keydat_t keydat; valdat_t valdat; #else valdat_t valdat; keydat_t keydat; #endif }; struct ypresp_master { ypstat status; char *master; }; struct ypresp_order { ypstat status; u_int ordernum; }; struct ypmaplist { char *map; #define ypml_name map struct ypmaplist *next; #define ypml_next next }; struct ypresp_maplist { ypstat status; struct ypmaplist *list; }; /* * Procedure symbols. YPPROC_NULL, YPPROC_DOMAIN, and YPPROC_DOMAIN_NONACK * must keep the same values (0, 1, and 2) that they had in the first version * of the protocol. */ #define YPPROC_NULL 0 #define YPPROC_DOMAIN 1 #define YPPROC_DOMAIN_NONACK 2 #define YPPROC_MATCH 3 #define YPPROC_FIRST 4 #define YPPROC_NEXT 5 #define YPPROC_XFR 6 #define YPPROC_CLEAR 7 #define YPPROC_ALL 8 #define YPPROC_MASTER 9 #define YPPROC_ORDER 10 #define YPPROC_MAPLIST 11 #define YPPROC_NEWXFR 12 /* * Protocol between clients and NIS binder servers */ /* * The following procedures are supported by the protocol: * * YPBINDPROC_NULL() returns () * takes nothing, returns nothing * * YPBINDPROC_DOMAIN takes (char *) returns (struct ypbind_resp) * * YPBINDPROC_SETDOM takes (struct ypbind_setdom) returns nothing */ /* Program and version symbols, magic numbers */ #define YPBINDPROG 100007 #define YPBINDVERS 2 #define YPBINDVERS_ORIG 1 /* Procedure symbols */ #define YPBINDPROC_NULL 0 #define YPBINDPROC_DOMAIN 1 #define YPBINDPROC_SETDOM 2 /* * Response structure and overall result status codes. Success and failure * represent two separate response message types. */ enum ypbind_resptype {YPBIND_SUCC_VAL = 1, YPBIND_FAIL_VAL = 2}; struct ypbind_binding { struct in_addr ypbind_binding_addr; /* In network order */ unsigned short int ypbind_binding_port; /* In network order */ }; struct ypbind_resp { enum ypbind_resptype ypbind_status; union { u_int ypbind_error; struct ypbind_binding ypbind_bindinfo; } ypbind_respbody; }; /* Detailed failure reason codes for response field ypbind_error*/ #define YPBIND_ERR_ERR 1 /* Internal error */ #define YPBIND_ERR_NOSERV 2 /* No bound server for passed domain */ #define YPBIND_ERR_RESC 3 /* System resource allocation failure */ /* * Request data structure for ypbind "Set domain" procedure. */ struct ypbind_setdom { char *ypsetdom_domain; struct ypbind_binding ypsetdom_binding; u_int ypsetdom_vers; }; #define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr #define ypsetdom_port ypsetdom_binding.ypbind_binding_port /* * Protocol between clients (ypxfr, only) and yppush * yppush speaks a protocol in the transient range, which * is supplied to ypxfr as a command-line parameter when it * is activated by ypserv. */ #define YPPUSHVERS 1 #define YPPUSHVERS_ORIG 1 /* Procedure symbols */ #define YPPUSHPROC_NULL 0 #define YPPUSHPROC_XFRRESP 1 /* Status values for yppushresp_xfr.status */ enum yppush_status { YPPUSH_SUCC = 1, /* Success */ #define YPPUSH_SUCC YPPUSH_SUCC YPPUSH_AGE = 2, /* Master's version not newer */ #define YPPUSH_AGE YPPUSH_AGE YPPUSH_NOMAP = -1, /* Can't find server for map */ #define YPPUSH_NOMAP YPPUSH_NOMAP YPPUSH_NODOM = -2, /* Domain not supported */ #define YPPUSH_NODOM YPPUSH_NODOM YPPUSH_RSRC = -3, /* Local resouce alloc failure */ #define YPPUSH_RSRC YPPUSH_RSRC YPPUSH_RPC = -4, /* RPC failure talking to server */ #define YPPUSH_RPC YPPUSH_RPC YPPUSH_MADDR = -5, /* Can't get master address */ #define YPPUSH_MADDR YPPUSH_MADDR YPPUSH_YPERR = -6, /* NIS server/map db error */ #define YPPUSH_YPERR YPPUSH_YPERR YPPUSH_BADARGS = -7, /* Request arguments bad */ #define YPPUSH_BADARGS YPPUSH_BADARGS YPPUSH_DBM = -8, /* Local dbm operation failed */ #define YPPUSH_DBM YPPUSH_DBM YPPUSH_FILE = -9, /* Local file I/O operation failed */ #define YPPUSH_FILE YPPUSH_FILE YPPUSH_SKEW = -10, /* Map version skew during transfer */ #define YPPUSH_SKEW YPPUSH_SKEW YPPUSH_CLEAR = -11, /* Can't send "Clear" req to local ypserv */ #define YPPUSH_CLEAR YPPUSH_CLEAR YPPUSH_FORCE = -12, /* No local order number in map - use -f flag*/ #define YPPUSH_FORCE YPPUSH_FORCE YPPUSH_XFRERR = -13, /* ypxfr error */ #define YPPUSH_XFRERR YPPUSH_XFRERR YPPUSH_REFUSED = -14, /* Transfer request refused by ypserv */ #define YPPUSH_REFUSED YPPUSH_REFUSED YPPUSH_NOALIAS = -15 /* Alias not found for map or domain */ #define YPPUSH_NOALIAS YPPUSH_NOALIAS }; typedef enum yppush_status yppush_status; struct yppushresp_xfr { u_int transid; yppush_status status; }; struct ypresp_all { bool_t more; union { struct ypresp_key_val val; } ypresp_all_u; }; extern bool_t xdr_ypreq_key (XDR *__xdrs, struct ypreq_key * __objp); extern bool_t xdr_ypreq_nokey (XDR *__xdrs, struct ypreq_nokey * __objp); extern bool_t xdr_ypreq_xfr (XDR *__xdrs, struct ypreq_xfr * __objp); extern bool_t xdr_ypresp_val (XDR *__xdrs, struct ypresp_val * __objp); extern bool_t xdr_ypresp_key_val (XDR *__xdrs, struct ypresp_key_val * __objp); extern bool_t xdr_ypbind_resp (XDR *__xdrs, struct ypbind_resp * __objp); extern bool_t xdr_ypbind_setdom (XDR *__xdrs, struct ypbind_setdom * __objp); extern bool_t xdr_ypmap_parms (XDR *__xdrs, struct ypmap_parms * __objp); extern bool_t xdr_yppushresp_xfr (XDR *__xdrs, struct yppushresp_xfr * __objp); extern bool_t xdr_ypresp_order (XDR *__xdrs, struct ypresp_order * __objp); extern bool_t xdr_ypresp_master (XDR *__xdrs, struct ypresp_master * __objp); extern bool_t xdr_ypall (XDR *__xdrs, struct ypall_callback * __objp); extern bool_t xdr_ypresp_maplist (XDR *__xdrs, struct ypresp_maplist * __objp); extern bool_t xdr_ypbind_binding (XDR *__xdrs, struct ypbind_binding * __objp); extern bool_t xdr_ypbind_resptype (XDR *__xdrs, enum ypbind_resptype * __objp); extern bool_t xdr_ypstat (XDR *__xdrs, enum ypbind_resptype * __objp); extern bool_t xdr_ypresp_all (XDR *__xdrs, struct ypresp_all * __objp); extern bool_t xdr_domainname (XDR *__xdrs, char ** __objp); __END_DECLS #endif /* _RPCSVC_YP_PROT_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/rusers.h�������������������������������������������������������������������������������������0000644�����������������00000006317�14763166026�0007562 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _RUSERS_H_RPCGEN #define _RUSERS_H_RPCGEN #include <rpc/rpc.h> #ifdef __cplusplus extern "C" { #endif /* * Find out about remote users */ #define RUSERS_MAXUSERLEN 32 #define RUSERS_MAXLINELEN 32 #define RUSERS_MAXHOSTLEN 257 struct rusers_utmp { char *ut_user; char *ut_line; char *ut_host; int ut_type; int ut_time; u_int ut_idle; }; typedef struct rusers_utmp rusers_utmp; typedef struct { u_int utmp_array_len; rusers_utmp *utmp_array_val; } utmp_array; /* * Values for ut_type field above. */ #define RUSERS_EMPTY 0 #define RUSERS_RUN_LVL 1 #define RUSERS_BOOT_TIME 2 #define RUSERS_OLD_TIME 3 #define RUSERS_NEW_TIME 4 #define RUSERS_INIT_PROCESS 5 #define RUSERS_LOGIN_PROCESS 6 #define RUSERS_USER_PROCESS 7 #define RUSERS_DEAD_PROCESS 8 #define RUSERS_ACCOUNTING 9 #ifdef __cplusplus extern "C" { #endif #include <rpc/xdr.h> /* * The following structures are used by version 2 of the rusersd protocol. * They were not developed with rpcgen, so they do not appear as RPCL. */ #define RUSERSVERS_IDLE 2 #define RUSERSVERS 3 /* current version */ #define MAXUSERS 100 /* * This is the structure used in version 2 of the rusersd RPC service. * It corresponds to the utmp structure for BSD systems. */ struct ru_utmp { char ut_line[8]; /* tty name */ char ut_name[8]; /* user id */ char ut_host[16]; /* host name, if remote */ long int ut_time; /* time on */ }; struct utmparr { struct ru_utmp **uta_arr; int uta_cnt; }; typedef struct utmparr utmparr; extern bool_t xdr_utmparr (XDR *xdrs, struct utmparr *objp) __THROW; struct utmpidle { struct ru_utmp ui_utmp; unsigned int ui_idle; }; struct utmpidlearr { struct utmpidle **uia_arr; int uia_cnt; }; extern bool_t xdr_utmpidlearr (XDR *xdrs, struct utmpidlearr *objp) __THROW; #ifdef __cplusplus } #endif #define RUSERSPROG 100002 #define RUSERSVERS_3 3 #if defined(__STDC__) || defined(__cplusplus) #define RUSERSPROC_NUM 1 extern int * rusersproc_num_3(void *, CLIENT *); extern int * rusersproc_num_3_svc(void *, struct svc_req *); #define RUSERSPROC_NAMES 2 extern utmp_array * rusersproc_names_3(void *, CLIENT *); extern utmp_array * rusersproc_names_3_svc(void *, struct svc_req *); #define RUSERSPROC_ALLNAMES 3 extern utmp_array * rusersproc_allnames_3(void *, CLIENT *); extern utmp_array * rusersproc_allnames_3_svc(void *, struct svc_req *); extern int rusersprog_3_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define RUSERSPROC_NUM 1 extern int * rusersproc_num_3(); extern int * rusersproc_num_3_svc(); #define RUSERSPROC_NAMES 2 extern utmp_array * rusersproc_names_3(); extern utmp_array * rusersproc_names_3_svc(); #define RUSERSPROC_ALLNAMES 3 extern utmp_array * rusersproc_allnames_3(); extern utmp_array * rusersproc_allnames_3_svc(); extern int rusersprog_3_freeresult (); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_rusers_utmp (XDR *, rusers_utmp*); extern bool_t xdr_utmp_array (XDR *, utmp_array*); #else /* K&R C */ extern bool_t xdr_rusers_utmp (); extern bool_t xdr_utmp_array (); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_RUSERS_H_RPCGEN */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/nis.h����������������������������������������������������������������������������������������0000644�����������������00000037522�14763166026�0007032 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RPCSVC_NIS_H #define _RPCSVC_NIS_H 1 #include <features.h> #include <rpc/rpc.h> #include <rpcsvc/nis_tags.h> __BEGIN_DECLS /* * nis.h * * This file is the main include file for NIS clients. It contains * both the client library function defines and the various data * structures used by the NIS service. It includes the file nis_tags.h * which defines the tag values. This allows the tags to change without * having to change the nis.x file. * * NOTE : THIS FILE IS NOT GENERATED WITH RPCGEN ! SO YOU HAVE TO * ADD ALL THE CHANGES ON nis_*.x FILES HERE AGAIN ! * * I have removed all the Solaris internal structs and variables, * because they are not supported, Sun changed them between various * releases and they shouldn't be used in user programs. * <kukuk@suse.de> */ #ifndef __nis_object_h #define __nis_object_h #define NIS_MAXSTRINGLEN 255 #define NIS_MAXNAMELEN 1024 #define NIS_MAXATTRNAME 32 #define NIS_MAXATTRVAL 2048 #define NIS_MAXCOLUMNS 64 #define NIS_MAXATTR 16 #define NIS_MAXPATH 1024 #define NIS_MAXREPLICAS 128 #define NIS_MAXLINKS 16 #define NIS_PK_NONE 0 #define NIS_PK_DH 1 #define NIS_PK_RSA 2 #define NIS_PK_KERB 3 #define NIS_PK_DHEXT 4 struct nis_attr { char *zattr_ndx; struct { u_int zattr_val_len; char *zattr_val_val; } zattr_val; }; typedef struct nis_attr nis_attr; typedef char *nis_name; enum zotypes { BOGUS_OBJ = 0, NO_OBJ = 1, DIRECTORY_OBJ = 2, GROUP_OBJ = 3, TABLE_OBJ = 4, ENTRY_OBJ = 5, LINK_OBJ = 6, PRIVATE_OBJ = 7, NIS_BOGUS_OBJ = 0, NIS_NO_OBJ = 1, NIS_DIRECTORY_OBJ = 2, NIS_GROUP_OBJ = 3, NIS_TABLE_OBJ = 4, NIS_ENTRY_OBJ = 5, NIS_LINK_OBJ = 6, NIS_PRIVATE_OBJ = 7 }; typedef enum zotypes zotypes; enum nstype { UNKNOWN = 0, NIS = 1, SUNYP = 2, IVY = 3, DNS = 4, X500 = 5, DNANS = 6, XCHS = 7, CDS = 8, }; typedef enum nstype nstype; struct oar_mask { uint32_t oa_rights; zotypes oa_otype; }; typedef struct oar_mask oar_mask; struct endpoint { char *uaddr; char *family; char *proto; }; typedef struct endpoint endpoint; struct nis_server { nis_name name; struct { u_int ep_len; endpoint *ep_val; } ep; uint32_t key_type; netobj pkey; }; typedef struct nis_server nis_server; struct directory_obj { nis_name do_name; nstype do_type; struct { u_int do_servers_len; nis_server *do_servers_val; } do_servers; uint32_t do_ttl; struct { u_int do_armask_len; oar_mask *do_armask_val; } do_armask; }; typedef struct directory_obj directory_obj; #define EN_BINARY 1 #define EN_CRYPT 2 #define EN_XDR 4 #define EN_MODIFIED 8 #define EN_ASN1 64 struct entry_col { uint32_t ec_flags; struct { u_int ec_value_len; char *ec_value_val; } ec_value; }; typedef struct entry_col entry_col; struct entry_obj { char *en_type; struct { u_int en_cols_len; entry_col *en_cols_val; } en_cols; }; typedef struct entry_obj entry_obj; struct group_obj { uint32_t gr_flags; struct { u_int gr_members_len; nis_name *gr_members_val; } gr_members; }; typedef struct group_obj group_obj; struct link_obj { zotypes li_rtype; struct { u_int li_attrs_len; nis_attr *li_attrs_val; } li_attrs; nis_name li_name; }; typedef struct link_obj link_obj; #define TA_BINARY 1 #define TA_CRYPT 2 #define TA_XDR 4 #define TA_SEARCHABLE 8 #define TA_CASE 16 #define TA_MODIFIED 32 #define TA_ASN1 64 struct table_col { char *tc_name; uint32_t tc_flags; uint32_t tc_rights; }; typedef struct table_col table_col; struct table_obj { char *ta_type; int ta_maxcol; u_char ta_sep; struct { u_int ta_cols_len; table_col *ta_cols_val; } ta_cols; char *ta_path; }; typedef struct table_obj table_obj; struct objdata { zotypes zo_type; union { struct directory_obj di_data; struct group_obj gr_data; struct table_obj ta_data; struct entry_obj en_data; struct link_obj li_data; struct { u_int po_data_len; char *po_data_val; } po_data; } objdata_u; }; typedef struct objdata objdata; struct nis_oid { uint32_t ctime; uint32_t mtime; }; typedef struct nis_oid nis_oid; struct nis_object { nis_oid zo_oid; nis_name zo_name; nis_name zo_owner; nis_name zo_group; nis_name zo_domain; uint32_t zo_access; uint32_t zo_ttl; objdata zo_data; }; typedef struct nis_object nis_object; #endif /* if __nis_object_h */ enum nis_error { NIS_SUCCESS = 0, NIS_S_SUCCESS = 1, NIS_NOTFOUND = 2, NIS_S_NOTFOUND = 3, NIS_CACHEEXPIRED = 4, NIS_NAMEUNREACHABLE = 5, NIS_UNKNOWNOBJ = 6, NIS_TRYAGAIN = 7, NIS_SYSTEMERROR = 8, NIS_CHAINBROKEN = 9, NIS_PERMISSION = 10, NIS_NOTOWNER = 11, NIS_NOT_ME = 12, NIS_NOMEMORY = 13, NIS_NAMEEXISTS = 14, NIS_NOTMASTER = 15, NIS_INVALIDOBJ = 16, NIS_BADNAME = 17, NIS_NOCALLBACK = 18, NIS_CBRESULTS = 19, NIS_NOSUCHNAME = 20, NIS_NOTUNIQUE = 21, NIS_IBMODERROR = 22, NIS_NOSUCHTABLE = 23, NIS_TYPEMISMATCH = 24, NIS_LINKNAMEERROR = 25, NIS_PARTIAL = 26, NIS_TOOMANYATTRS = 27, NIS_RPCERROR = 28, NIS_BADATTRIBUTE = 29, NIS_NOTSEARCHABLE = 30, NIS_CBERROR = 31, NIS_FOREIGNNS = 32, NIS_BADOBJECT = 33, NIS_NOTSAMEOBJ = 34, NIS_MODFAIL = 35, NIS_BADREQUEST = 36, NIS_NOTEMPTY = 37, NIS_COLDSTART_ERR = 38, NIS_RESYNC = 39, NIS_FAIL = 40, NIS_UNAVAIL = 41, NIS_RES2BIG = 42, NIS_SRVAUTH = 43, NIS_CLNTAUTH = 44, NIS_NOFILESPACE = 45, NIS_NOPROC = 46, NIS_DUMPLATER = 47, }; typedef enum nis_error nis_error; struct nis_result { nis_error status; struct { u_int objects_len; nis_object *objects_val; } objects; netobj cookie; uint32_t zticks; uint32_t dticks; uint32_t aticks; uint32_t cticks; }; typedef struct nis_result nis_result; struct ns_request { nis_name ns_name; struct { u_int ns_object_len; nis_object *ns_object_val; } ns_object; }; typedef struct ns_request ns_request; struct ib_request { nis_name ibr_name; struct { u_int ibr_srch_len; nis_attr *ibr_srch_val; } ibr_srch; uint32_t ibr_flags; struct { u_int ibr_obj_len; nis_object *ibr_obj_val; } ibr_obj; struct { u_int ibr_cbhost_len; nis_server *ibr_cbhost_val; } ibr_cbhost; u_int ibr_bufsize; netobj ibr_cookie; }; typedef struct ib_request ib_request; struct ping_args { nis_name dir; uint32_t stamp; }; typedef struct ping_args ping_args; enum log_entry_t { LOG_NOP = 0, ADD_NAME = 1, REM_NAME = 2, MOD_NAME_OLD = 3, MOD_NAME_NEW = 4, ADD_IBASE = 5, REM_IBASE = 6, MOD_IBASE = 7, UPD_STAMP = 8, }; typedef enum log_entry_t log_entry_t; struct log_entry { uint32_t le_time; log_entry_t le_type; nis_name le_princp; nis_name le_name; struct { u_int le_attrs_len; nis_attr *le_attrs_val; } le_attrs; nis_object le_object; }; typedef struct log_entry log_entry; struct log_result { nis_error lr_status; netobj lr_cookie; struct { u_int lr_entries_len; log_entry *lr_entries_val; } lr_entries; }; typedef struct log_result log_result; struct cp_result { nis_error cp_status; uint32_t cp_zticks; uint32_t cp_dticks; }; typedef struct cp_result cp_result; struct nis_tag { uint32_t tag_type; char *tag_val; }; typedef struct nis_tag nis_tag; struct nis_taglist { struct { u_int tags_len; nis_tag *tags_val; } tags; }; typedef struct nis_taglist nis_taglist; struct dump_args { nis_name da_dir; uint32_t da_time; struct { u_int da_cbhost_len; nis_server *da_cbhost_val; } da_cbhost; }; typedef struct dump_args dump_args; struct fd_args { nis_name dir_name; nis_name requester; }; typedef struct fd_args fd_args; struct fd_result { nis_error status; nis_name source; struct { u_int dir_data_len; char *dir_data_val; } dir_data; struct { u_int signature_len; char *signature_val; } signature; }; typedef struct fd_result fd_result; /* Generic client creating flags */ #define ZMH_VC 1 #define ZMH_DG 2 #define ZMH_AUTH 4 /* Testing Access rights for objects */ #define NIS_READ_ACC 1 #define NIS_MODIFY_ACC 2 #define NIS_CREATE_ACC 4 #define NIS_DESTROY_ACC 8 /* Test macros. a == access rights, m == desired rights. */ #define NIS_WORLD(a, m) (((a) & (m)) != 0) #define NIS_GROUP(a, m) (((a) & ((m) << 8)) != 0) #define NIS_OWNER(a, m) (((a) & ((m) << 16)) != 0) #define NIS_NOBODY(a, m) (((a) & ((m) << 24)) != 0) /* * EOL Alert - The following non-prefixed test macros are * here for backward compatability, and will be not be present * in future releases - use the NIS_*() macros above. */ #define WORLD(a, m) (((a) & (m)) != 0) #define GROUP(a, m) (((a) & ((m) << 8)) != 0) #define OWNER(a, m) (((a) & ((m) << 16)) != 0) #define NOBODY(a, m) (((a) & ((m) << 24)) != 0) #define OATYPE(d, n) (((d)->do_armask.do_armask_val+n)->oa_otype) #define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights) #define WORLD_DEFAULT (NIS_READ_ACC) #define GROUP_DEFAULT (NIS_READ_ACC << 8) #define OWNER_DEFAULT ((NIS_READ_ACC + NIS_MODIFY_ACC + NIS_CREATE_ACC +\ NIS_DESTROY_ACC) << 16) #define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT) /* Result manipulation defines ... */ #define NIS_RES_NUMOBJ(x) ((x)->objects.objects_len) #define NIS_RES_OBJECT(x) ((x)->objects.objects_val) #define NIS_RES_COOKIE(x) ((x)->cookie) #define NIS_RES_STATUS(x) ((x)->status) /* These defines make getting at the variant part of the object easier. */ #define TA_data zo_data.objdata_u.ta_data #define EN_data zo_data.objdata_u.en_data #define DI_data zo_data.objdata_u.di_data #define LI_data zo_data.objdata_u.li_data #define GR_data zo_data.objdata_u.gr_data #define __type_of(o) ((o)->zo_data.zo_type) /* Declarations for the internal subroutines in nislib.c */ enum name_pos {SAME_NAME, HIGHER_NAME, LOWER_NAME, NOT_SEQUENTIAL, BAD_NAME}; typedef enum name_pos name_pos; /* * Defines for getting at column data in entry objects. Because RPCGEN * generates some rather wordy structures, we create some defines that * collapse the needed keystrokes to access a particular value using * these definitions they take an nis_object *, and an int and return * a u_char * for Value, and an int for length. */ #define ENTRY_VAL(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val #define ENTRY_LEN(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len /* Prototypes, and extern declarations for the NIS library functions. */ #include <rpcsvc/nislib.h> #endif /* * nis_3.h * * This file contains definitions that are only of interest to the actual * service daemon and client stubs. Normal users of NIS will not include * this file. * * NOTE : This include file is automatically created by a combination * of rpcgen and sed. DO NOT EDIT IT, change the nis.x file instead * and then remake this file. */ #ifndef __nis_3_h #define __nis_3_h #define NIS_PROG 100300 #define NIS_VERSION 3 #define NIS_LOOKUP 1 extern nis_result * nis_lookup_3 (ns_request *, CLIENT *) __THROW; extern nis_result * nis_lookup_3_svc (ns_request *, struct svc_req *) __THROW; #define NIS_ADD 2 extern nis_result * nis_add_3 (ns_request *, CLIENT *) __THROW; extern nis_result * nis_add_3_svc (ns_request *, struct svc_req *) __THROW; #define NIS_MODIFY 3 extern nis_result * nis_modify_3 (ns_request *, CLIENT *) __THROW; extern nis_result * nis_modify_3_svc (ns_request *, struct svc_req *) __THROW; #define NIS_REMOVE 4 extern nis_result * nis_remove_3 (ns_request *, CLIENT *) __THROW; extern nis_result * nis_remove_3_svc (ns_request *, struct svc_req *) __THROW; #define NIS_IBLIST 5 extern nis_result * nis_iblist_3 (ib_request *, CLIENT *) __THROW; extern nis_result * nis_iblist_3_svc (ib_request *, struct svc_req *) __THROW; #define NIS_IBADD 6 extern nis_result * nis_ibadd_3 (ib_request *, CLIENT *) __THROW; extern nis_result * nis_ibadd_3_svc (ib_request *, struct svc_req *) __THROW; #define NIS_IBMODIFY 7 extern nis_result * nis_ibmodify_3 (ib_request *, CLIENT *) __THROW; extern nis_result * nis_ibmodify_3_svc (ib_request *, struct svc_req *) __THROW; #define NIS_IBREMOVE 8 extern nis_result * nis_ibremove_3 (ib_request *, CLIENT *) __THROW; extern nis_result * nis_ibremove_3_svc (ib_request *, struct svc_req *) __THROW; #define NIS_IBFIRST 9 extern nis_result * nis_ibfirst_3 (ib_request *, CLIENT *) __THROW; extern nis_result * nis_ibfirst_3_svc (ib_request *, struct svc_req *) __THROW; #define NIS_IBNEXT 10 extern nis_result * nis_ibnext_3 (ib_request *, CLIENT *) __THROW; extern nis_result * nis_ibnext_3_svc (ib_request *, struct svc_req *) __THROW; #define NIS_FINDDIRECTORY 12 extern fd_result * nis_finddirectory_3 (fd_args *, CLIENT *) __THROW; extern fd_result * nis_finddirectory_3_svc (fd_args *, struct svc_req *) __THROW; #define NIS_STATUS 14 extern nis_taglist * nis_status_3 (nis_taglist *, CLIENT *) __THROW; extern nis_taglist * nis_status_3_svc (nis_taglist *, struct svc_req *) __THROW; #define NIS_DUMPLOG 15 extern log_result * nis_dumplog_3 (dump_args *, CLIENT *) __THROW; extern log_result * nis_dumplog_3_svc (dump_args *, struct svc_req *) __THROW; #define NIS_DUMP 16 extern log_result * nis_dump_3 (dump_args *, CLIENT *) __THROW; extern log_result * nis_dump_3_svc (dump_args *, struct svc_req *) __THROW; #define NIS_CALLBACK 17 extern bool_t * nis_callback_3 (netobj *, CLIENT *) __THROW; extern bool_t * nis_callback_3_svc (netobj *, struct svc_req *) __THROW; #define NIS_CPTIME 18 extern uint32_t * nis_cptime_3 (nis_name *, CLIENT *) __THROW; extern uint32_t * nis_cptime_3_svc (nis_name *, struct svc_req *) __THROW; #define NIS_CHECKPOINT 19 extern cp_result * nis_checkpoint_3 (nis_name *, CLIENT *) __THROW; extern cp_result * nis_checkpoint_3_svc (nis_name *, struct svc_req *) __THROW; #define NIS_PING 20 extern void * nis_ping_3 (ping_args *, CLIENT *) __THROW; extern void * nis_ping_3_svc (ping_args *, struct svc_req *) __THROW; #define NIS_SERVSTATE 21 extern nis_taglist * nis_servstate_3 (nis_taglist *, CLIENT *) __THROW; extern nis_taglist * nis_servstate_3_svc (nis_taglist *, struct svc_req *) __THROW; #define NIS_MKDIR 22 extern nis_error * nis_mkdir_3 (nis_name *, CLIENT *) __THROW; extern nis_error * nis_mkdir_3_svc (nis_name *, struct svc_req *) __THROW; #define NIS_RMDIR 23 extern nis_error * nis_rmdir_3 (nis_name *, CLIENT *) __THROW; extern nis_error * nis_rmdir_3_svc (nis_name *, struct svc_req *) __THROW; #define NIS_UPDKEYS 24 extern nis_error * nis_updkeys_3 (nis_name *, CLIENT *) __THROW; extern nis_error * nis_updkeys_3_svc (nis_name *, struct svc_req *) __THROW; __END_DECLS #endif /* ! _RPCSVC_NIS_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/yppasswd.x�����������������������������������������������������������������������������������0000644�����������������00000004356�14763166026�0010132 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)yppasswd.x 2.1 88/08/01 4.0 RPCSRC */ /* * Copyright (c) 2010, Oracle America, Inc. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * YP password update protocol * Requires unix authentication */ program YPPASSWDPROG { version YPPASSWDVERS { /* * Update my passwd entry */ int YPPASSWDPROC_UPDATE(yppasswd) = 1; } = 1; } = 100009; struct passwd { string pw_name<>; /* username */ string pw_passwd<>; /* encrypted password */ int pw_uid; /* user id */ int pw_gid; /* group id */ string pw_gecos<>; /* in real life name */ string pw_dir<>; /* home directory */ string pw_shell<>; /* default shell */ }; struct yppasswd { string oldpass<>; /* unencrypted old password */ passwd newpw; /* new passwd entry */ }; ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/bootparam_prot.x�����������������������������������������������������������������������������0000644�����������������00000006060�14763166026�0011302 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)bootparam_prot.x 2.1 88/08/01 4.0 RPCSRC */ /* * Copyright (c) 2010, Oracle America, Inc. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * RPC for bootparms service. * There are two procedures: * WHOAMI takes a net address and returns a client name and also a * likely net address for routing * GETFILE takes a client name and file identifier and returns the * server name, server net address and pathname for the file. * file identifiers typically include root, swap, pub and dump */ #ifdef RPC_HDR %#include <rpc/types.h> %#include <sys/time.h> %#include <sys/errno.h> %#include <nfs/nfs.h> #endif const MAX_MACHINE_NAME = 255; const MAX_PATH_LEN = 1024; const MAX_FILEID = 32; const IP_ADDR_TYPE = 1; typedef string bp_machine_name_t<MAX_MACHINE_NAME>; typedef string bp_path_t<MAX_PATH_LEN>; typedef string bp_fileid_t<MAX_FILEID>; struct ip_addr_t { char net; char host; char lh; char impno; }; union bp_address switch (int address_type) { case IP_ADDR_TYPE: ip_addr_t ip_addr; }; struct bp_whoami_arg { bp_address client_address; }; struct bp_whoami_res { bp_machine_name_t client_name; bp_machine_name_t domain_name; bp_address router_address; }; struct bp_getfile_arg { bp_machine_name_t client_name; bp_fileid_t file_id; }; struct bp_getfile_res { bp_machine_name_t server_name; bp_address server_address; bp_path_t server_path; }; program BOOTPARAMPROG { version BOOTPARAMVERS { bp_whoami_res BOOTPARAMPROC_WHOAMI(bp_whoami_arg) = 1; bp_getfile_res BOOTPARAMPROC_GETFILE(bp_getfile_arg) = 2; } = 1; } = 100026; ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/nis_callback.x�������������������������������������������������������������������������������0000644�����������������00000004202�14763166026�0010653 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������%/* % * Copyright (c) 2010, Oracle America, Inc. % * % * Redistribution and use in source and binary forms, with or without % * modification, are permitted provided that the following conditions are % * met: % * % * * Redistributions of source code must retain the above copyright % * notice, this list of conditions and the following disclaimer. % * * Redistributions in binary form must reproduce the above % * copyright notice, this list of conditions and the following % * disclaimer in the documentation and/or other materials % * provided with the distribution. % * * Neither the name of the "Oracle America, Inc." nor the names of its % * contributors may be used to endorse or promote products derived % * from this software without specific prior written permission. % * % * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS % * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT % * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS % * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE % * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, % * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL % * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE % * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS % * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, % * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE % * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. % */ /* * nis_callback.x */ %#pragma ident "@(#)nis_callback.x 1.7 94/05/03" /* * "@(#)zns_cback.x 1.2 90/09/10" * * RPCL description of the Callback Service. */ #ifdef RPC_HDR %#include <rpcsvc/nis.h> #endif #ifdef RPC_XDR %#include "nis_clnt.h" #endif typedef nis_object *obj_p; struct cback_data { obj_p entries<>; /* List of objects */ }; program CB_PROG { version CB_VERS { bool CBPROC_RECEIVE(cback_data) = 1; void CBPROC_FINISH(void) = 2; void CBPROC_ERROR(nis_error) = 3; } = 1; } = 100302; ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/nis_object.x���������������������������������������������������������������������������������0000644�����������������00000031442�14763166026�0010373 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * nis_object.x * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ %#pragma ident "@(#)nis_object.x 1.12 97/11/19" #if RPC_HDR % %#ifndef __nis_object_h %#define __nis_object_h % #endif /* * This file defines the format for a NIS object in RPC language. * It is included by the main .x file and the database access protocol * file. It is common because both of them need to deal with the same * type of object. Generating the actual code though is a bit messy because * the nis.x file and the nis_dba.x file will generate xdr routines to * encode/decode objects when only one set is needed. Such is life when * one is using rpcgen. * * Note, the protocol doesn't specify any limits on such things as * maximum name length, number of attributes, etc. These are enforced * by the database backend. When you hit them you will no. Also see * the db_getlimits() function for fetching the limit values. * */ /* Some manifest constants, chosen to maximize flexibility without * plugging the wire full of data. */ const NIS_MAXSTRINGLEN = 255; const NIS_MAXNAMELEN = 1024; const NIS_MAXATTRNAME = 32; const NIS_MAXATTRVAL = 2048; const NIS_MAXCOLUMNS = 64; const NIS_MAXATTR = 16; const NIS_MAXPATH = 1024; const NIS_MAXREPLICAS = 128; const NIS_MAXLINKS = 16; const NIS_PK_NONE = 0; /* no public key (unix/sys auth) */ const NIS_PK_DH = 1; /* Public key is Diffie-Hellman type */ const NIS_PK_RSA = 2; /* Public key if RSA type */ const NIS_PK_KERB = 3; /* Use kerberos style authentication */ const NIS_PK_DHEXT = 4; /* Extended Diffie-Hellman for RPC-GSS */ /* * The fundamental name type of NIS. The name may consist of two parts, * the first being the fully qualified name, and the second being an * optional set of attribute/value pairs. */ struct nis_attr { string zattr_ndx<>; /* name of the index */ opaque zattr_val<>; /* Value for the attribute. */ }; typedef string nis_name<>; /* The NIS name itself. */ /* NIS object types are defined by the following enumeration. The numbers * they use are based on the following scheme : * 0 - 1023 are reserved for Sun, * 1024 - 2047 are defined to be private to a particular tree. * 2048 - 4095 are defined to be user defined. * 4096 - ... are reserved for future use. * * EOL Alert - The non-prefixed names are present for backward * compatability only, and will not exist in future releases. Use * the NIS_* names for future compatability. */ enum zotypes { BOGUS_OBJ = 0, /* Uninitialized object structure */ NO_OBJ = 1, /* NULL object (no data) */ DIRECTORY_OBJ = 2, /* Directory object describing domain */ GROUP_OBJ = 3, /* Group object (a list of names) */ TABLE_OBJ = 4, /* Table object (a database schema) */ ENTRY_OBJ = 5, /* Entry object (a database record) */ LINK_OBJ = 6, /* A name link. */ PRIVATE_OBJ = 7, /* Private object (all opaque data) */ NIS_BOGUS_OBJ = 0, /* Uninitialized object structure */ NIS_NO_OBJ = 1, /* NULL object (no data) */ NIS_DIRECTORY_OBJ = 2, /* Directory object describing domain */ NIS_GROUP_OBJ = 3, /* Group object (a list of names) */ NIS_TABLE_OBJ = 4, /* Table object (a database schema) */ NIS_ENTRY_OBJ = 5, /* Entry object (a database record) */ NIS_LINK_OBJ = 6, /* A name link. */ NIS_PRIVATE_OBJ = 7 /* Private object (all opaque data) */ }; /* * The types of Name services NIS knows about. They are enumerated * here. The Binder code will use this type to determine if it has * a set of library routines that will access the indicated name service. */ enum nstype { UNKNOWN = 0, NIS = 1, /* Nis Plus Service */ SUNYP = 2, /* Old NIS Service */ IVY = 3, /* Nis Plus Plus Service */ DNS = 4, /* Domain Name Service */ X500 = 5, /* ISO/CCCIT X.500 Service */ DNANS = 6, /* Digital DECNet Name Service */ XCHS = 7, /* Xerox ClearingHouse Service */ CDS= 8 }; /* * DIRECTORY - The name service object. These objects identify other name * servers that are serving some portion of the name space. Each has a * type associated with it. The resolver library will note whether or not * is has the needed routines to access that type of service. * The oarmask structure defines an access rights mask on a per object * type basis for the name spaces. The only bits currently used are * create and destroy. By enabling or disabling these access rights for * a specific object type for a one of the accessor entities (owner, * group, world) the administrator can control what types of objects * may be freely added to the name space and which require the * administrator's approval. */ struct oar_mask { uint32_t oa_rights; /* Access rights mask */ zotypes oa_otype; /* Object type */ }; struct endpoint { string uaddr<>; string family<>; /* Transport family (INET, OSI, etc) */ string proto<>; /* Protocol (TCP, UDP, CLNP, etc) */ }; /* * Note: pkey is a netobj which is limited to 1024 bytes which limits the * keysize to 8192 bits. This is consider to be a reasonable limit for * the expected lifetime of this service. */ struct nis_server { nis_name name; /* Principal name of the server */ endpoint ep<>; /* Universal addr(s) for server */ uint32_t key_type; /* Public key type */ netobj pkey; /* server's public key */ }; struct directory_obj { nis_name do_name; /* Name of the directory being served */ nstype do_type; /* one of NIS, DNS, IVY, YP, or X.500 */ nis_server do_servers<>; /* <0> == Primary name server */ uint32_t do_ttl; /* Time To Live (for caches) */ oar_mask do_armask<>; /* Create/Destroy rights by object type */ }; /* * ENTRY - This is one row of data from an information base. * The type value is used by the client library to convert the entry to * it's internal structure representation. The Table name is a back pointer * to the table where the entry is stored. This allows the client library * to determine where to send a request if the client wishes to change this * entry but got to it through a LINK rather than directly. * If the entry is a "standalone" entry then this field is void. */ const EN_BINARY = 1; /* Indicates value is binary data */ const EN_CRYPT = 2; /* Indicates the value is encrypted */ const EN_XDR = 4; /* Indicates the value is XDR encoded */ const EN_MODIFIED = 8; /* Indicates entry is modified. */ const EN_ASN1 = 64; /* Means contents use ASN.1 encoding */ struct entry_col { uint32_t ec_flags; /* Flags for this value */ opaque ec_value<>; /* It's textual value */ }; struct entry_obj { string en_type<>; /* Type of entry such as "passwd" */ entry_col en_cols<>; /* Value for the entry */ }; /* * GROUP - The group object contains a list of NIS principal names. Groups * are used to authorize principals. Each object has a set of access rights * for members of its group. Principal names in groups are in the form * name.directory and recursive groups are expressed as @groupname.directory */ struct group_obj { uint32_t gr_flags; /* Flags controlling group */ nis_name gr_members<>; /* List of names in group */ }; /* * LINK - This is the LINK object. It is quite similar to a symbolic link * in the UNIX filesystem. The attributes in the main object structure are * relative to the LINK data and not what it points to (like the file system) * "modify" privleges here indicate the right to modify what the link points * at and not to modify that actual object pointed to by the link. */ struct link_obj { zotypes li_rtype; /* Real type of the object */ nis_attr li_attrs<>; /* Attribute/Values for tables */ nis_name li_name; /* The object's real NIS name */ }; /* * TABLE - This is the table object. It implements a simple * data base that applications and use for configuration or * administration purposes. The role of the table is to group together * a set of related entries. Tables are the simple database component * of NIS. Like many databases, tables are logically divided into columns * and rows. The columns are labeled with indexes and each ENTRY makes * up a row. Rows may be addressed within the table by selecting one * or more indexes, and values for those indexes. Each row which has * a value for the given index that matches the desired value is returned. * Within the definition of each column there is a flags variable, this * variable contains flags which determine whether or not the column is * searchable, contains binary data, and access rights for the entry objects * column value. */ const TA_BINARY = 1; /* Means table data is binary */ const TA_CRYPT = 2; /* Means value should be encrypted */ const TA_XDR = 4; /* Means value is XDR encoded */ const TA_SEARCHABLE = 8; /* Means this column is searchable */ const TA_CASE = 16; /* Means this column is Case Sensitive */ const TA_MODIFIED = 32; /* Means this columns attrs are modified*/ const TA_ASN1 = 64; /* Means contents use ASN.1 encoding */ struct table_col { string tc_name<64>; /* Column Name */ uint32_t tc_flags; /* control flags */ uint32_t tc_rights; /* Access rights mask */ }; struct table_obj { string ta_type<64>; /* Table type such as "passwd" */ int ta_maxcol; /* Total number of columns */ u_char ta_sep; /* Separator character */ table_col ta_cols<>; /* The number of table indexes */ string ta_path<>; /* A search path for this table */ }; /* * This union joins together all of the currently known objects. */ union objdata switch (zotypes zo_type) { case NIS_DIRECTORY_OBJ : struct directory_obj di_data; case NIS_GROUP_OBJ : struct group_obj gr_data; case NIS_TABLE_OBJ : struct table_obj ta_data; case NIS_ENTRY_OBJ: struct entry_obj en_data; case NIS_LINK_OBJ : struct link_obj li_data; case NIS_PRIVATE_OBJ : opaque po_data<>; case NIS_NO_OBJ : void; case NIS_BOGUS_OBJ : void; default : void; }; /* * This is the basic NIS object data type. It consists of a generic part * which all objects contain, and a specialized part which varies depending * on the type of the object. All of the specialized sections have been * described above. You might have wondered why they all start with an * integer size, followed by the useful data. The answer is, when the * server doesn't recognize the type returned it treats it as opaque data. * And the definition for opaque data is {int size; char *data;}. In this * way, servers and utility routines that do not understand a given type * may still pass it around. One has to be careful in setting * this variable accurately, it must take into account such things as * XDR padding of structures etc. The best way to set it is to note one's * position in the XDR encoding stream, encode the structure, look at the * new position and calculate the size. */ struct nis_oid { uint32_t ctime; /* Time of objects creation */ uint32_t mtime; /* Time of objects modification */ }; struct nis_object { nis_oid zo_oid; /* object identity verifier. */ nis_name zo_name; /* The NIS name for this object */ nis_name zo_owner; /* NIS name of object owner. */ nis_name zo_group; /* NIS name of access group. */ nis_name zo_domain; /* The administrator for the object */ uint32_t zo_access; /* Access rights (owner, group, world) */ uint32_t zo_ttl; /* Object's time to live in seconds. */ objdata zo_data; /* Data structure for this type */ }; #if RPC_HDR % %#endif /* if __nis_object_h */ % #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/nfs_prot.x�����������������������������������������������������������������������������������0000644�����������������00000017462�14763166026�0010114 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)nfs_prot.x 2.1 88/08/01 4.0 RPCSRC */ /* * nfs_prot.x 1.2 87/10/12 * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ const NFS_PORT = 2049; const NFS_MAXDATA = 8192; const NFS_MAXPATHLEN = 1024; const NFS_MAXNAMLEN = 255; const NFS_FHSIZE = 32; const NFS_COOKIESIZE = 4; const NFS_FIFO_DEV = -1; /* size kludge for named pipes */ /* * File types */ const NFSMODE_FMT = 0170000; /* type of file */ const NFSMODE_DIR = 0040000; /* directory */ const NFSMODE_CHR = 0020000; /* character special */ const NFSMODE_BLK = 0060000; /* block special */ const NFSMODE_REG = 0100000; /* regular */ const NFSMODE_LNK = 0120000; /* symbolic link */ const NFSMODE_SOCK = 0140000; /* socket */ const NFSMODE_FIFO = 0010000; /* fifo */ /* * Error status */ enum nfsstat { NFS_OK= 0, /* no error */ NFSERR_PERM=1, /* Not owner */ NFSERR_NOENT=2, /* No such file or directory */ NFSERR_IO=5, /* I/O error */ NFSERR_NXIO=6, /* No such device or address */ NFSERR_ACCES=13, /* Permission denied */ NFSERR_EXIST=17, /* File exists */ NFSERR_NODEV=19, /* No such device */ NFSERR_NOTDIR=20, /* Not a directory*/ NFSERR_ISDIR=21, /* Is a directory */ NFSERR_FBIG=27, /* File too large */ NFSERR_NOSPC=28, /* No space left on device */ NFSERR_ROFS=30, /* Read-only file system */ NFSERR_NAMETOOLONG=63, /* File name too long */ NFSERR_NOTEMPTY=66, /* Directory not empty */ NFSERR_DQUOT=69, /* Disc quota exceeded */ NFSERR_STALE=70, /* Stale NFS file handle */ NFSERR_WFLUSH=99 /* write cache flushed */ }; /* * File types */ enum ftype { NFNON = 0, /* non-file */ NFREG = 1, /* regular file */ NFDIR = 2, /* directory */ NFBLK = 3, /* block special */ NFCHR = 4, /* character special */ NFLNK = 5, /* symbolic link */ NFSOCK = 6, /* unix domain sockets */ NFBAD = 7, /* unused */ NFFIFO = 8 /* named pipe */ }; /* * File access handle */ struct nfs_fh { opaque data[NFS_FHSIZE]; }; /* * Timeval */ struct nfstime { unsigned seconds; unsigned useconds; }; /* * File attributes */ struct fattr { ftype type; /* file type */ unsigned mode; /* protection mode bits */ unsigned nlink; /* # hard links */ unsigned uid; /* owner user id */ unsigned gid; /* owner group id */ unsigned size; /* file size in bytes */ unsigned blocksize; /* preferred block size */ unsigned rdev; /* special device # */ unsigned blocks; /* Kb of disk used by file */ unsigned fsid; /* device # */ unsigned fileid; /* inode # */ nfstime atime; /* time of last access */ nfstime mtime; /* time of last modification */ nfstime ctime; /* time of last change */ }; /* * File attributes which can be set */ struct sattr { unsigned mode; /* protection mode bits */ unsigned uid; /* owner user id */ unsigned gid; /* owner group id */ unsigned size; /* file size in bytes */ nfstime atime; /* time of last access */ nfstime mtime; /* time of last modification */ }; typedef string filename<NFS_MAXNAMLEN>; typedef string nfspath<NFS_MAXPATHLEN>; /* * Reply status with file attributes */ union attrstat switch (nfsstat status) { case NFS_OK: fattr attributes; default: void; }; struct sattrargs { nfs_fh file; sattr attributes; }; /* * Arguments for directory operations */ struct diropargs { nfs_fh dir; /* directory file handle */ filename name; /* name (up to NFS_MAXNAMLEN bytes) */ }; struct diropokres { nfs_fh file; fattr attributes; }; /* * Results from directory operation */ union diropres switch (nfsstat status) { case NFS_OK: diropokres diropres; default: void; }; union readlinkres switch (nfsstat status) { case NFS_OK: nfspath data; default: void; }; /* * Arguments to remote read */ struct readargs { nfs_fh file; /* handle for file */ unsigned offset; /* byte offset in file */ unsigned count; /* immediate read count */ unsigned totalcount; /* total read count (from this offset)*/ }; /* * Status OK portion of remote read reply */ struct readokres { fattr attributes; /* attributes, need for pagin*/ opaque data<NFS_MAXDATA>; }; union readres switch (nfsstat status) { case NFS_OK: readokres reply; default: void; }; /* * Arguments to remote write */ struct writeargs { nfs_fh file; /* handle for file */ unsigned beginoffset; /* beginning byte offset in file */ unsigned offset; /* current byte offset in file */ unsigned totalcount; /* total write count (to this offset)*/ opaque data<NFS_MAXDATA>; }; struct createargs { diropargs where; sattr attributes; }; struct renameargs { diropargs from; diropargs to; }; struct linkargs { nfs_fh from; diropargs to; }; struct symlinkargs { diropargs from; nfspath to; sattr attributes; }; typedef opaque nfscookie[NFS_COOKIESIZE]; /* * Arguments to readdir */ struct readdirargs { nfs_fh dir; /* directory handle */ nfscookie cookie; unsigned count; /* number of directory bytes to read */ }; struct entry { unsigned fileid; filename name; nfscookie cookie; entry *nextentry; }; struct dirlist { entry *entries; bool eof; }; union readdirres switch (nfsstat status) { case NFS_OK: dirlist reply; default: void; }; struct statfsokres { unsigned tsize; /* preferred transfer size in bytes */ unsigned bsize; /* fundamental file system block size */ unsigned blocks; /* total blocks in file system */ unsigned bfree; /* free blocks in fs */ unsigned bavail; /* free blocks avail to non-superuser */ }; union statfsres switch (nfsstat status) { case NFS_OK: statfsokres reply; default: void; }; /* * Remote file service routines */ program NFS_PROGRAM { version NFS_VERSION { void NFSPROC_NULL(void) = 0; attrstat NFSPROC_GETATTR(nfs_fh) = 1; attrstat NFSPROC_SETATTR(sattrargs) = 2; void NFSPROC_ROOT(void) = 3; diropres NFSPROC_LOOKUP(diropargs) = 4; readlinkres NFSPROC_READLINK(nfs_fh) = 5; readres NFSPROC_READ(readargs) = 6; void NFSPROC_WRITECACHE(void) = 7; attrstat NFSPROC_WRITE(writeargs) = 8; diropres NFSPROC_CREATE(createargs) = 9; nfsstat NFSPROC_REMOVE(diropargs) = 10; nfsstat NFSPROC_RENAME(renameargs) = 11; nfsstat NFSPROC_LINK(linkargs) = 12; nfsstat NFSPROC_SYMLINK(symlinkargs) = 13; diropres NFSPROC_MKDIR(createargs) = 14; nfsstat NFSPROC_RMDIR(diropargs) = 15; readdirres NFSPROC_READDIR(readdirargs) = 16; statfsres NFSPROC_STATFS(nfs_fh) = 17; } = 2; } = 100003; ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/bootparam_prot.h�����������������������������������������������������������������������������0000644�����������������00000006164�14763166026�0011267 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _BOOTPARAM_PROT_H_RPCGEN #define _BOOTPARAM_PROT_H_RPCGEN #include <rpc/rpc.h> #ifdef __cplusplus extern "C" { #endif #include <rpc/types.h> #include <sys/time.h> #include <sys/errno.h> #include <nfs/nfs.h> #define MAX_MACHINE_NAME 255 #define MAX_PATH_LEN 1024 #define MAX_FILEID 32 #define IP_ADDR_TYPE 1 typedef char *bp_machine_name_t; typedef char *bp_path_t; typedef char *bp_fileid_t; struct ip_addr_t { char net; char host; char lh; char impno; }; typedef struct ip_addr_t ip_addr_t; struct bp_address { int address_type; union { ip_addr_t ip_addr; } bp_address_u; }; typedef struct bp_address bp_address; struct bp_whoami_arg { bp_address client_address; }; typedef struct bp_whoami_arg bp_whoami_arg; struct bp_whoami_res { bp_machine_name_t client_name; bp_machine_name_t domain_name; bp_address router_address; }; typedef struct bp_whoami_res bp_whoami_res; struct bp_getfile_arg { bp_machine_name_t client_name; bp_fileid_t file_id; }; typedef struct bp_getfile_arg bp_getfile_arg; struct bp_getfile_res { bp_machine_name_t server_name; bp_address server_address; bp_path_t server_path; }; typedef struct bp_getfile_res bp_getfile_res; #define BOOTPARAMPROG 100026 #define BOOTPARAMVERS 1 #if defined(__STDC__) || defined(__cplusplus) #define BOOTPARAMPROC_WHOAMI 1 extern bp_whoami_res * bootparamproc_whoami_1(bp_whoami_arg *, CLIENT *); extern bp_whoami_res * bootparamproc_whoami_1_svc(bp_whoami_arg *, struct svc_req *); #define BOOTPARAMPROC_GETFILE 2 extern bp_getfile_res * bootparamproc_getfile_1(bp_getfile_arg *, CLIENT *); extern bp_getfile_res * bootparamproc_getfile_1_svc(bp_getfile_arg *, struct svc_req *); extern int bootparamprog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define BOOTPARAMPROC_WHOAMI 1 extern bp_whoami_res * bootparamproc_whoami_1(); extern bp_whoami_res * bootparamproc_whoami_1_svc(); #define BOOTPARAMPROC_GETFILE 2 extern bp_getfile_res * bootparamproc_getfile_1(); extern bp_getfile_res * bootparamproc_getfile_1_svc(); extern int bootparamprog_1_freeresult (); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_bp_machine_name_t (XDR *, bp_machine_name_t*); extern bool_t xdr_bp_path_t (XDR *, bp_path_t*); extern bool_t xdr_bp_fileid_t (XDR *, bp_fileid_t*); extern bool_t xdr_ip_addr_t (XDR *, ip_addr_t*); extern bool_t xdr_bp_address (XDR *, bp_address*); extern bool_t xdr_bp_whoami_arg (XDR *, bp_whoami_arg*); extern bool_t xdr_bp_whoami_res (XDR *, bp_whoami_res*); extern bool_t xdr_bp_getfile_arg (XDR *, bp_getfile_arg*); extern bool_t xdr_bp_getfile_res (XDR *, bp_getfile_res*); #else /* K&R C */ extern bool_t xdr_bp_machine_name_t (); extern bool_t xdr_bp_path_t (); extern bool_t xdr_bp_fileid_t (); extern bool_t xdr_ip_addr_t (); extern bool_t xdr_bp_address (); extern bool_t xdr_bp_whoami_arg (); extern bool_t xdr_bp_whoami_res (); extern bool_t xdr_bp_getfile_arg (); extern bool_t xdr_bp_getfile_res (); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_BOOTPARAM_PROT_H_RPCGEN */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/rquota.h�������������������������������������������������������������������������������������0000644�����������������00000012651�14763166026�0007550 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _RQUOTA_H_RPCGEN #define _RQUOTA_H_RPCGEN #include <rpc/rpc.h> #ifdef __cplusplus extern "C" { #endif #define RQ_PATHLEN 1024 struct sq_dqblk { u_int rq_bhardlimit; u_int rq_bsoftlimit; u_int rq_curblocks; u_int rq_fhardlimit; u_int rq_fsoftlimit; u_int rq_curfiles; u_int rq_btimeleft; u_int rq_ftimeleft; }; typedef struct sq_dqblk sq_dqblk; struct getquota_args { char *gqa_pathp; int gqa_uid; }; typedef struct getquota_args getquota_args; struct setquota_args { int sqa_qcmd; char *sqa_pathp; int sqa_id; sq_dqblk sqa_dqblk; }; typedef struct setquota_args setquota_args; struct ext_getquota_args { char *gqa_pathp; int gqa_type; int gqa_id; }; typedef struct ext_getquota_args ext_getquota_args; struct ext_setquota_args { int sqa_qcmd; char *sqa_pathp; int sqa_id; int sqa_type; sq_dqblk sqa_dqblk; }; typedef struct ext_setquota_args ext_setquota_args; struct rquota { int rq_bsize; bool_t rq_active; u_int rq_bhardlimit; u_int rq_bsoftlimit; u_int rq_curblocks; u_int rq_fhardlimit; u_int rq_fsoftlimit; u_int rq_curfiles; u_int rq_btimeleft; u_int rq_ftimeleft; }; typedef struct rquota rquota; enum qr_status { Q_OK = 1, Q_NOQUOTA = 2, Q_EPERM = 3, }; typedef enum qr_status qr_status; struct getquota_rslt { qr_status status; union { rquota gqr_rquota; } getquota_rslt_u; }; typedef struct getquota_rslt getquota_rslt; struct setquota_rslt { qr_status status; union { rquota sqr_rquota; } setquota_rslt_u; }; typedef struct setquota_rslt setquota_rslt; #define RQUOTAPROG 100011 #define RQUOTAVERS 1 #if defined(__STDC__) || defined(__cplusplus) #define RQUOTAPROC_GETQUOTA 1 extern getquota_rslt * rquotaproc_getquota_1(getquota_args *, CLIENT *); extern getquota_rslt * rquotaproc_getquota_1_svc(getquota_args *, struct svc_req *); #define RQUOTAPROC_GETACTIVEQUOTA 2 extern getquota_rslt * rquotaproc_getactivequota_1(getquota_args *, CLIENT *); extern getquota_rslt * rquotaproc_getactivequota_1_svc(getquota_args *, struct svc_req *); #define RQUOTAPROC_SETQUOTA 3 extern setquota_rslt * rquotaproc_setquota_1(setquota_args *, CLIENT *); extern setquota_rslt * rquotaproc_setquota_1_svc(setquota_args *, struct svc_req *); #define RQUOTAPROC_SETACTIVEQUOTA 4 extern setquota_rslt * rquotaproc_setactivequota_1(setquota_args *, CLIENT *); extern setquota_rslt * rquotaproc_setactivequota_1_svc(setquota_args *, struct svc_req *); extern int rquotaprog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define RQUOTAPROC_GETQUOTA 1 extern getquota_rslt * rquotaproc_getquota_1(); extern getquota_rslt * rquotaproc_getquota_1_svc(); #define RQUOTAPROC_GETACTIVEQUOTA 2 extern getquota_rslt * rquotaproc_getactivequota_1(); extern getquota_rslt * rquotaproc_getactivequota_1_svc(); #define RQUOTAPROC_SETQUOTA 3 extern setquota_rslt * rquotaproc_setquota_1(); extern setquota_rslt * rquotaproc_setquota_1_svc(); #define RQUOTAPROC_SETACTIVEQUOTA 4 extern setquota_rslt * rquotaproc_setactivequota_1(); extern setquota_rslt * rquotaproc_setactivequota_1_svc(); extern int rquotaprog_1_freeresult (); #endif /* K&R C */ #define EXT_RQUOTAVERS 2 #if defined(__STDC__) || defined(__cplusplus) extern getquota_rslt * rquotaproc_getquota_2(ext_getquota_args *, CLIENT *); extern getquota_rslt * rquotaproc_getquota_2_svc(ext_getquota_args *, struct svc_req *); extern getquota_rslt * rquotaproc_getactivequota_2(ext_getquota_args *, CLIENT *); extern getquota_rslt * rquotaproc_getactivequota_2_svc(ext_getquota_args *, struct svc_req *); extern setquota_rslt * rquotaproc_setquota_2(ext_setquota_args *, CLIENT *); extern setquota_rslt * rquotaproc_setquota_2_svc(ext_setquota_args *, struct svc_req *); extern setquota_rslt * rquotaproc_setactivequota_2(ext_setquota_args *, CLIENT *); extern setquota_rslt * rquotaproc_setactivequota_2_svc(ext_setquota_args *, struct svc_req *); extern int rquotaprog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ extern getquota_rslt * rquotaproc_getquota_2(); extern getquota_rslt * rquotaproc_getquota_2_svc(); extern getquota_rslt * rquotaproc_getactivequota_2(); extern getquota_rslt * rquotaproc_getactivequota_2_svc(); extern setquota_rslt * rquotaproc_setquota_2(); extern setquota_rslt * rquotaproc_setquota_2_svc(); extern setquota_rslt * rquotaproc_setactivequota_2(); extern setquota_rslt * rquotaproc_setactivequota_2_svc(); extern int rquotaprog_2_freeresult (); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_sq_dqblk (XDR *, sq_dqblk*); extern bool_t xdr_getquota_args (XDR *, getquota_args*); extern bool_t xdr_setquota_args (XDR *, setquota_args*); extern bool_t xdr_ext_getquota_args (XDR *, ext_getquota_args*); extern bool_t xdr_ext_setquota_args (XDR *, ext_setquota_args*); extern bool_t xdr_rquota (XDR *, rquota*); extern bool_t xdr_qr_status (XDR *, qr_status*); extern bool_t xdr_getquota_rslt (XDR *, getquota_rslt*); extern bool_t xdr_setquota_rslt (XDR *, setquota_rslt*); #else /* K&R C */ extern bool_t xdr_sq_dqblk (); extern bool_t xdr_getquota_args (); extern bool_t xdr_setquota_args (); extern bool_t xdr_ext_getquota_args (); extern bool_t xdr_ext_setquota_args (); extern bool_t xdr_rquota (); extern bool_t xdr_qr_status (); extern bool_t xdr_getquota_rslt (); extern bool_t xdr_setquota_rslt (); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_RQUOTA_H_RPCGEN */ ���������������������������������������������������������������������������������������rpcsvc/key_prot.x�����������������������������������������������������������������������������������0000644�����������������00000014650�14763166026�0010112 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Key server protocol definition * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The keyserver is a public key storage/encryption/decryption service * The encryption method used is based on the Diffie-Hellman exponential * key exchange technology. * * The key server is local to each machine, akin to the portmapper. * Under TI-RPC, communication with the keyserver is through the * loopback transport. * * NOTE: This .x file generates the USER level headers for the keyserver. * the KERNEL level headers are created by hand as they kernel has special * requirements. */ %#if 0 %#pragma ident "@(#)key_prot.x 1.7 94/04/29 SMI" %#endif % %/* Copyright (c) 1990, 1991 Sun Microsystems, Inc. */ % %/* % * Compiled from key_prot.x using rpcgen. % * DO NOT EDIT THIS FILE! % * This is NOT source code! % */ /* * PROOT and MODULUS define the way the Diffie-Hellman key is generated. * * MODULUS should be chosen as a prime of the form: MODULUS == 2*p + 1, * where p is also prime. * * PROOT satisfies the following two conditions: * (1) (PROOT ** 2) % MODULUS != 1 * (2) (PROOT ** p) % MODULUS != 1 * */ const PROOT = 3; const HEXMODULUS = "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b"; const HEXKEYBYTES = 48; /* HEXKEYBYTES == strlen(HEXMODULUS) */ const KEYSIZE = 192; /* KEYSIZE == bit length of key */ const KEYBYTES = 24; /* byte length of key */ /* * The first 16 hex digits of the encrypted secret key are used as * a checksum in the database. */ const KEYCHECKSUMSIZE = 16; /* * status of operation */ enum keystatus { KEY_SUCCESS, /* no problems */ KEY_NOSECRET, /* no secret key stored */ KEY_UNKNOWN, /* unknown netname */ KEY_SYSTEMERR /* system error (out of memory, encryption failure) */ }; typedef opaque keybuf[HEXKEYBYTES]; /* store key in hex */ typedef string netnamestr<MAXNETNAMELEN>; /* * Argument to ENCRYPT or DECRYPT */ struct cryptkeyarg { netnamestr remotename; des_block deskey; }; /* * Argument to ENCRYPT_PK or DECRYPT_PK */ struct cryptkeyarg2 { netnamestr remotename; netobj remotekey; /* Contains a length up to 1024 bytes */ des_block deskey; }; /* * Result of ENCRYPT, DECRYPT, ENCRYPT_PK, and DECRYPT_PK */ union cryptkeyres switch (keystatus status) { case KEY_SUCCESS: des_block deskey; default: void; }; const MAXGIDS = 16; /* max number of gids in gid list */ /* * Unix credential */ struct unixcred { u_int uid; u_int gid; u_int gids<MAXGIDS>; }; /* * Result returned from GETCRED */ union getcredres switch (keystatus status) { case KEY_SUCCESS: unixcred cred; default: void; }; /* * key_netstarg; */ struct key_netstarg { keybuf st_priv_key; keybuf st_pub_key; netnamestr st_netname; }; union key_netstres switch (keystatus status){ case KEY_SUCCESS: key_netstarg knet; default: void; }; #ifdef RPC_HDR % %#ifndef opaque %#define opaque char %#endif % #endif program KEY_PROG { version KEY_VERS { /* * This is my secret key. * Store it for me. */ keystatus KEY_SET(keybuf) = 1; /* * I want to talk to X. * Encrypt a conversation key for me. */ cryptkeyres KEY_ENCRYPT(cryptkeyarg) = 2; /* * X just sent me a message. * Decrypt the conversation key for me. */ cryptkeyres KEY_DECRYPT(cryptkeyarg) = 3; /* * Generate a secure conversation key for me */ des_block KEY_GEN(void) = 4; /* * Get me the uid, gid and group-access-list associated * with this netname (for kernel which cannot use NIS) */ getcredres KEY_GETCRED(netnamestr) = 5; } = 1; version KEY_VERS2 { /* * ####### * Procedures 1-5 are identical to version 1 * ####### */ /* * This is my secret key. * Store it for me. */ keystatus KEY_SET(keybuf) = 1; /* * I want to talk to X. * Encrypt a conversation key for me. */ cryptkeyres KEY_ENCRYPT(cryptkeyarg) = 2; /* * X just sent me a message. * Decrypt the conversation key for me. */ cryptkeyres KEY_DECRYPT(cryptkeyarg) = 3; /* * Generate a secure conversation key for me */ des_block KEY_GEN(void) = 4; /* * Get me the uid, gid and group-access-list associated * with this netname (for kernel which cannot use NIS) */ getcredres KEY_GETCRED(netnamestr) = 5; /* * I want to talk to X. and I know X's public key * Encrypt a conversation key for me. */ cryptkeyres KEY_ENCRYPT_PK(cryptkeyarg2) = 6; /* * X just sent me a message. and I know X's public key * Decrypt the conversation key for me. */ cryptkeyres KEY_DECRYPT_PK(cryptkeyarg2) = 7; /* * Store my public key, netname and private key. */ keystatus KEY_NET_PUT(key_netstarg) = 8; /* * Retrieve my public key, netname and private key. */ key_netstres KEY_NET_GET(void) = 9; /* * Return me the conversation key that is constructed * from my secret key and this publickey. */ cryptkeyres KEY_GET_CONV(keybuf) = 10; } = 2; } = 100029; ����������������������������������������������������������������������������������������rpcsvc/spray.h��������������������������������������������������������������������������������������0000644�����������������00000003537�14763166026�0007376 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _SPRAY_H_RPCGEN #define _SPRAY_H_RPCGEN #include <rpc/rpc.h> #ifdef __cplusplus extern "C" { #endif #define SPRAYMAX 8845 struct spraytimeval { u_int sec; u_int usec; }; typedef struct spraytimeval spraytimeval; struct spraycumul { u_int counter; spraytimeval clock; }; typedef struct spraycumul spraycumul; typedef struct { u_int sprayarr_len; char *sprayarr_val; } sprayarr; #define SPRAYPROG 100012 #define SPRAYVERS 1 #if defined(__STDC__) || defined(__cplusplus) #define SPRAYPROC_SPRAY 1 extern void * sprayproc_spray_1(sprayarr *, CLIENT *); extern void * sprayproc_spray_1_svc(sprayarr *, struct svc_req *); #define SPRAYPROC_GET 2 extern spraycumul * sprayproc_get_1(void *, CLIENT *); extern spraycumul * sprayproc_get_1_svc(void *, struct svc_req *); #define SPRAYPROC_CLEAR 3 extern void * sprayproc_clear_1(void *, CLIENT *); extern void * sprayproc_clear_1_svc(void *, struct svc_req *); extern int sprayprog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define SPRAYPROC_SPRAY 1 extern void * sprayproc_spray_1(); extern void * sprayproc_spray_1_svc(); #define SPRAYPROC_GET 2 extern spraycumul * sprayproc_get_1(); extern spraycumul * sprayproc_get_1_svc(); #define SPRAYPROC_CLEAR 3 extern void * sprayproc_clear_1(); extern void * sprayproc_clear_1_svc(); extern int sprayprog_1_freeresult (); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_spraytimeval (XDR *, spraytimeval*); extern bool_t xdr_spraycumul (XDR *, spraycumul*); extern bool_t xdr_sprayarr (XDR *, sprayarr*); #else /* K&R C */ extern bool_t xdr_spraytimeval (); extern bool_t xdr_spraycumul (); extern bool_t xdr_sprayarr (); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_SPRAY_H_RPCGEN */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/nis_callback.h�������������������������������������������������������������������������������0000644�����������������00000005220�14763166026�0010634 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RPCSVC_NIS_CALLBACK_H #define _RPCSVC_NIS_CALLBACK_H 1 #include <rpc/rpc.h> #include <rpcsvc/nis.h> __BEGIN_DECLS typedef nis_object *obj_p; struct cback_data { struct { u_int entries_len; obj_p *entries_val; } entries; }; typedef struct cback_data cback_data; #define CB_PROG 100302 #define CB_VERS 1 #define CBPROC_RECEIVE 1 extern bool_t * cbproc_receive_1 (cback_data *, CLIENT *) __THROW; extern bool_t * cbproc_receive_1_svc (cback_data *, struct svc_req *) __THROW; #define CBPROC_FINISH 2 extern void * cbproc_finish_1 (void *, CLIENT *) __THROW; extern void * cbproc_finish_1_svc (void *, struct svc_req *) __THROW; #define CBPROC_ERROR 3 extern void * cbproc_error_1 (nis_error *, CLIENT *) __THROW; extern void * cbproc_error_1_svc (nis_error *, struct svc_req *) __THROW; extern int cb_prog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t) __THROW; /* the xdr functions */ extern bool_t xdr_obj_p (XDR *, obj_p*) __THROW; extern bool_t xdr_cback_data (XDR *, cback_data*) __THROW; __END_DECLS #endif /* !_RPCVSC_NIS_CALLBACK_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/klm_prot.h�����������������������������������������������������������������������������������0000644�����������������00000006332�14763166026�0010063 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _KLM_PROT_H_RPCGEN #define _KLM_PROT_H_RPCGEN #include <rpc/rpc.h> #ifdef __cplusplus extern "C" { #endif #define LM_MAXSTRLEN 1024 enum klm_stats { klm_granted = 0, klm_denied = 1, klm_denied_nolocks = 2, klm_working = 3, }; typedef enum klm_stats klm_stats; struct klm_lock { char *server_name; netobj fh; int pid; u_int l_offset; u_int l_len; }; typedef struct klm_lock klm_lock; struct klm_holder { bool_t exclusive; int svid; u_int l_offset; u_int l_len; }; typedef struct klm_holder klm_holder; struct klm_stat { klm_stats stat; }; typedef struct klm_stat klm_stat; struct klm_testrply { klm_stats stat; union { struct klm_holder holder; } klm_testrply_u; }; typedef struct klm_testrply klm_testrply; struct klm_lockargs { bool_t block; bool_t exclusive; struct klm_lock alock; }; typedef struct klm_lockargs klm_lockargs; struct klm_testargs { bool_t exclusive; struct klm_lock alock; }; typedef struct klm_testargs klm_testargs; struct klm_unlockargs { struct klm_lock alock; }; typedef struct klm_unlockargs klm_unlockargs; #define KLM_PROG 100020 #define KLM_VERS 1 #if defined(__STDC__) || defined(__cplusplus) #define KLM_TEST 1 extern klm_testrply * klm_test_1(struct klm_testargs *, CLIENT *); extern klm_testrply * klm_test_1_svc(struct klm_testargs *, struct svc_req *); #define KLM_LOCK 2 extern klm_stat * klm_lock_1(struct klm_lockargs *, CLIENT *); extern klm_stat * klm_lock_1_svc(struct klm_lockargs *, struct svc_req *); #define KLM_CANCEL 3 extern klm_stat * klm_cancel_1(struct klm_lockargs *, CLIENT *); extern klm_stat * klm_cancel_1_svc(struct klm_lockargs *, struct svc_req *); #define KLM_UNLOCK 4 extern klm_stat * klm_unlock_1(struct klm_unlockargs *, CLIENT *); extern klm_stat * klm_unlock_1_svc(struct klm_unlockargs *, struct svc_req *); extern int klm_prog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define KLM_TEST 1 extern klm_testrply * klm_test_1(); extern klm_testrply * klm_test_1_svc(); #define KLM_LOCK 2 extern klm_stat * klm_lock_1(); extern klm_stat * klm_lock_1_svc(); #define KLM_CANCEL 3 extern klm_stat * klm_cancel_1(); extern klm_stat * klm_cancel_1_svc(); #define KLM_UNLOCK 4 extern klm_stat * klm_unlock_1(); extern klm_stat * klm_unlock_1_svc(); extern int klm_prog_1_freeresult (); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_klm_stats (XDR *, klm_stats*); extern bool_t xdr_klm_lock (XDR *, klm_lock*); extern bool_t xdr_klm_holder (XDR *, klm_holder*); extern bool_t xdr_klm_stat (XDR *, klm_stat*); extern bool_t xdr_klm_testrply (XDR *, klm_testrply*); extern bool_t xdr_klm_lockargs (XDR *, klm_lockargs*); extern bool_t xdr_klm_testargs (XDR *, klm_testargs*); extern bool_t xdr_klm_unlockargs (XDR *, klm_unlockargs*); #else /* K&R C */ extern bool_t xdr_klm_stats (); extern bool_t xdr_klm_lock (); extern bool_t xdr_klm_holder (); extern bool_t xdr_klm_stat (); extern bool_t xdr_klm_testrply (); extern bool_t xdr_klm_lockargs (); extern bool_t xdr_klm_testargs (); extern bool_t xdr_klm_unlockargs (); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_KLM_PROT_H_RPCGEN */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/spray.x��������������������������������������������������������������������������������������0000644�����������������00000004757�14763166026�0007423 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)spray.x 2.1 88/08/01 4.0 RPCSRC */ /* * Copyright (c) 2010, Oracle America, Inc. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Spray a server with packets * Useful for testing flakiness of network interfaces */ const SPRAYMAX = 8845; /* max amount can spray */ /* * GMT since 0:00, 1 January 1970 */ struct spraytimeval { unsigned int sec; unsigned int usec; }; /* * spray statistics */ struct spraycumul { unsigned int counter; spraytimeval clock; }; /* * spray data */ typedef opaque sprayarr<SPRAYMAX>; program SPRAYPROG { version SPRAYVERS { /* * Just throw away the data and increment the counter * This call never returns, so the client should always * time it out. */ void SPRAYPROC_SPRAY(sprayarr) = 1; /* * Get the value of the counter and elapsed time since * last CLEAR. */ spraycumul SPRAYPROC_GET(void) = 2; /* * Clear the counter and reset the elapsed time */ void SPRAYPROC_CLEAR(void) = 3; } = 1; } = 100012; �����������������rpcsvc/nis_tags.h�����������������������������������������������������������������������������������0000644�����������������00000012372�14763166026�0010044 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * nis_tags.h * * This file contains the tags and statistics definitions. It is * automatically included by nis.h */ #ifndef _RPCSVC_NIS_TAGS_H #define _RPCSVC_NIS_TAGS_H #if 0 #pragma ident "@(#)nis_tags.h 1.16 96/10/25" #endif /* from file: zns_tags.h 1.7 */ #ifdef __cplusplus extern "C" { #endif #define NIS_DIR "data" /* Lookup and List function flags */ #define FOLLOW_LINKS (1<<0) /* Follow link objects */ #define FOLLOW_PATH (1<<1) /* Follow the path in a table */ #define HARD_LOOKUP (1<<2) /* Block until successful */ #define ALL_RESULTS (1<<3) /* Retrieve all results */ #define NO_CACHE (1<<4) /* Do not return 'cached' results */ #define MASTER_ONLY (1<<5) /* Get value only from master server */ #define EXPAND_NAME (1<<6) /* Expand partitially qualified names */ /* Semantic modification for table operations flags */ #define RETURN_RESULT (1<<7) /* Return resulting object to client */ #define ADD_OVERWRITE (1<<8) /* Allow overwrites on ADD */ #define REM_MULTIPLE (1<<9) /* Allow wildcard deletes */ #define MOD_SAMEOBJ (1<<10) /* Check modified object before write */ #define ADD_RESERVED (1<<11) /* Spare ADD semantic */ #define REM_RESERVED (1<<12) /* Spare REM semantic */ #define MOD_EXCLUSIVE (1<<13) /* Modify no overwrite on modified keys */ /* Lookup and List function flags (continued) */ #define SOFT_LOOKUP (1<<14) /* The "old default" return on failure */ /* Transport specific modifications to the operation */ #define USE_DGRAM (1<<16) /* Use a datagram transport */ #define NO_AUTHINFO (1<<17) /* Don't bother attaching auth info */ /* * Declarations for "standard" NIS+ tags * State variable tags have values 0 - 2047 * Statistic tags have values 2048 - 65535 * User Tags have values >2^16 */ #define TAG_DEBUG 1 /* set debug level */ #define TAG_STATS 2 /* Enable/disable statistics */ #define TAG_GCACHE 3 /* Flush the Group Cache */ #define TAG_GCACHE_ALL TAG_GCACHE #define TAG_DCACHE 4 /* Flush the directory cache */ #define TAG_DCACHE_ONE TAG_DCACHE #define TAG_OCACHE 5 /* Flush the Object Cache */ #define TAG_SECURE 6 /* Set the security level */ #define TAG_TCACHE_ONE 7 /* Flush the table cache */ #define TAG_DCACHE_ALL 8 /* Flush entire directory cache */ #define TAG_TCACHE_ALL 9 /* Flush entire table cache */ #define TAG_GCACHE_ONE 10 /* Flush one group object */ #define TAG_DCACHE_ONE_REFRESH 11 /* Flush and refresh one DO */ #define TAG_READONLY 12 /* Set read only mode */ #define TAG_READWRITE 14 /* Reset read-write mode */ #define TAG_OPSTATS 2048 /* NIS+ operations statistics */ #define TAG_THREADS 2049 /* Child process/thread status */ #define TAG_HEAP 2050 /* Heap usage statistics */ #define TAG_UPDATES 2051 /* Updates to this service */ #define TAG_VISIBLE 2052 /* First update that isn't replicated */ #define TAG_S_DCACHE 2053 /* Directory cache statistics */ #define TAG_S_OCACHE 2054 /* Object cache statistics */ #define TAG_S_GCACHE 2055 /* Group cache statistics */ #define TAG_S_STORAGE 2056 /* Group cache statistics */ #define TAG_UPTIME 2057 /* Time that server has been up */ #define TAG_DIRLIST 2058 /* Dir served by this server */ #define TAG_NISCOMPAT 2059 /* Whether supports NIS compat mode */ #define TAG_DNSFORWARDING 2060 /* Whether DNS forwarding supported */ #define TAG_SECURITY_LEVEL 2061 /* Security level of the server */ #define TAG_ROOTSERVER 2062 /* Whether root server */ /* * Declarations for the Group object flags. Currently * there are only 3. */ #define IMPMEM_GROUPS 1 /* Implicit Membership allowed */ #define RECURS_GROUPS 2 /* Recursive Groups allowed */ #define NEGMEM_GROUPS 4 /* Negative Groups allowed */ #ifdef __cplusplus } #endif #endif /* _RPCSVC_NIS_TAGS_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/sm_inter.x�����������������������������������������������������������������������������������0000644�����������������00000007250�14763166026�0010074 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Status monitor protocol specification * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ program SM_PROG { version SM_VERS { /* res_stat = stat_succ if status monitor agrees to monitor */ /* res_stat = stat_fail if status monitor cannot monitor */ /* if res_stat == stat_succ, state = state number of site sm_name */ struct sm_stat_res SM_STAT(struct sm_name) = 1; /* res_stat = stat_succ if status monitor agrees to monitor */ /* res_stat = stat_fail if status monitor cannot monitor */ /* stat consists of state number of local site */ struct sm_stat_res SM_MON(struct mon) = 2; /* stat consists of state number of local site */ struct sm_stat SM_UNMON(struct mon_id) = 3; /* stat consists of state number of local site */ struct sm_stat SM_UNMON_ALL(struct my_id) = 4; void SM_SIMU_CRASH(void) = 5; } = 1; } = 100024; const SM_MAXSTRLEN = 1024; struct sm_name { string mon_name<SM_MAXSTRLEN>; }; struct my_id { string my_name<SM_MAXSTRLEN>; /* name of the site initiating the monitoring request*/ int my_prog; /* rpc program # of the requesting process */ int my_vers; /* rpc version # of the requesting process */ int my_proc; /* rpc procedure # of the requesting process */ }; struct mon_id { string mon_name<SM_MAXSTRLEN>; /* name of the site to be monitored */ struct my_id my_id; }; struct mon{ struct mon_id mon_id; opaque priv[16]; /* private information to store at monitor for requesting process */ }; /* * state # of status monitor monotonically increases each time * status of the site changes: * an even number (>= 0) indicates the site is down and * an odd number (> 0) indicates the site is up; */ struct sm_stat { int state; /* state # of status monitor */ }; enum res { stat_succ = 0, /* status monitor agrees to monitor */ stat_fail = 1 /* status monitor cannot monitor */ }; struct sm_stat_res { res res_stat; int state; }; /* * structure of the status message sent back by the status monitor * when monitor site status changes */ struct status { string mon_name<SM_MAXSTRLEN>; int state; opaque priv[16]; /* stored private information */ }; ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/rusers.x�������������������������������������������������������������������������������������0000644�����������������00000013352�14763166026�0007577 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2010, Oracle America, Inc. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ %/* % * Find out about remote users % */ const RUSERS_MAXUSERLEN = 32; const RUSERS_MAXLINELEN = 32; const RUSERS_MAXHOSTLEN = 257; struct rusers_utmp { string ut_user<RUSERS_MAXUSERLEN>; /* aka ut_name */ string ut_line<RUSERS_MAXLINELEN>; /* device */ string ut_host<RUSERS_MAXHOSTLEN>; /* host user logged on from */ int ut_type; /* type of entry */ int ut_time; /* time entry was made */ unsigned int ut_idle; /* minutes idle */ }; typedef rusers_utmp utmp_array<>; #ifdef RPC_HDR % %/* % * Values for ut_type field above. % */ #endif const RUSERS_EMPTY = 0; const RUSERS_RUN_LVL = 1; const RUSERS_BOOT_TIME = 2; const RUSERS_OLD_TIME = 3; const RUSERS_NEW_TIME = 4; const RUSERS_INIT_PROCESS = 5; const RUSERS_LOGIN_PROCESS = 6; const RUSERS_USER_PROCESS = 7; const RUSERS_DEAD_PROCESS = 8; const RUSERS_ACCOUNTING = 9; program RUSERSPROG { version RUSERSVERS_3 { int RUSERSPROC_NUM(void) = 1; utmp_array RUSERSPROC_NAMES(void) = 2; utmp_array RUSERSPROC_ALLNAMES(void) = 3; } = 3; } = 100002; #ifdef RPC_HDR % % %#ifdef __cplusplus %extern "C" { %#endif % %#include <rpc/xdr.h> % %/* % * The following structures are used by version 2 of the rusersd protocol. % * They were not developed with rpcgen, so they do not appear as RPCL. % */ % %#define RUSERSVERS_IDLE 2 %#define RUSERSVERS 3 /* current version */ %#define MAXUSERS 100 % %/* % * This is the structure used in version 2 of the rusersd RPC service. % * It corresponds to the utmp structure for BSD systems. % */ %struct ru_utmp { % char ut_line[8]; /* tty name */ % char ut_name[8]; /* user id */ % char ut_host[16]; /* host name, if remote */ % long int ut_time; /* time on */ %}; % %struct utmparr { % struct ru_utmp **uta_arr; % int uta_cnt; %}; %typedef struct utmparr utmparr; % %extern bool_t xdr_utmparr (XDR *xdrs, struct utmparr *objp) __THROW; % %struct utmpidle { % struct ru_utmp ui_utmp; % unsigned int ui_idle; %}; % %struct utmpidlearr { % struct utmpidle **uia_arr; % int uia_cnt; %}; % %extern bool_t xdr_utmpidlearr (XDR *xdrs, struct utmpidlearr *objp) __THROW; % %#ifdef __cplusplus %} %#endif #endif #ifdef RPC_XDR %bool_t xdr_utmp (XDR *xdrs, struct ru_utmp *objp); % %bool_t %xdr_utmp (XDR *xdrs, struct ru_utmp *objp) %{ % /* Since the fields are char foo [xxx], we should not free them. */ % if (xdrs->x_op != XDR_FREE) % { % char *ptr; % unsigned int size; % ptr = objp->ut_line; % size = sizeof (objp->ut_line); % if (!xdr_bytes (xdrs, &ptr, &size, size)) { % return (FALSE); % } % ptr = objp->ut_name; % size = sizeof (objp->ut_name); % if (!xdr_bytes (xdrs, &ptr, &size, size)) { % return (FALSE); % } % ptr = objp->ut_host; % size = sizeof (objp->ut_host); % if (!xdr_bytes (xdrs, &ptr, &size, size)) { % return (FALSE); % } % } % if (!xdr_long(xdrs, &objp->ut_time)) { % return (FALSE); % } % return (TRUE); %} % %bool_t xdr_utmpptr(XDR *xdrs, struct ru_utmp **objpp); % %bool_t %xdr_utmpptr (XDR *xdrs, struct ru_utmp **objpp) %{ % if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct ru_utmp), % (xdrproc_t) xdr_utmp)) { % return (FALSE); % } % return (TRUE); %} % %bool_t %xdr_utmparr (XDR *xdrs, struct utmparr *objp) %{ % if (!xdr_array(xdrs, (char **)&objp->uta_arr, (u_int *)&objp->uta_cnt, % MAXUSERS, sizeof(struct ru_utmp *), % (xdrproc_t) xdr_utmpptr)) { % return (FALSE); % } % return (TRUE); %} % %bool_t xdr_utmpidle(XDR *xdrs, struct utmpidle *objp); % %bool_t %xdr_utmpidle (XDR *xdrs, struct utmpidle *objp) %{ % if (!xdr_utmp(xdrs, &objp->ui_utmp)) { % return (FALSE); % } % if (!xdr_u_int(xdrs, &objp->ui_idle)) { % return (FALSE); % } % return (TRUE); %} % %bool_t xdr_utmpidleptr(XDR *xdrs, struct utmpidle **objp); % %bool_t %xdr_utmpidleptr (XDR *xdrs, struct utmpidle **objpp) %{ % if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct utmpidle), % (xdrproc_t) xdr_utmpidle)) { % return (FALSE); % } % return (TRUE); %} % %bool_t %xdr_utmpidlearr (XDR *xdrs, struct utmpidlearr *objp) %{ % if (!xdr_array(xdrs, (char **)&objp->uia_arr, (u_int *)&objp->uia_cnt, % MAXUSERS, sizeof(struct utmpidle *), % (xdrproc_t) xdr_utmpidleptr)) { % return (FALSE); % } % return (TRUE); %} #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/bootparam.h����������������������������������������������������������������������������������0000644�����������������00000001617�14763166026�0010221 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _RPCSVC_BOOTPARAM_H #define _RPCSVC_BOOTPARAM_H #include <rpcsvc/bootparam_prot.h> #endif /* _RPCSVC_BOOTPARAM_H */ �����������������������������������������������������������������������������������������������������������������rpcsvc/nis.x����������������������������������������������������������������������������������������0000644�����������������00000040642�14763166026�0007047 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������%/* % * Copyright (c) 2010, Oracle America, Inc. % * % * Redistribution and use in source and binary forms, with or without % * modification, are permitted provided that the following conditions are % * met: % * % * * Redistributions of source code must retain the above copyright % * notice, this list of conditions and the following disclaimer. % * * Redistributions in binary form must reproduce the above % * copyright notice, this list of conditions and the following % * disclaimer in the documentation and/or other materials % * provided with the distribution. % * * Neither the name of the "Oracle America, Inc." nor the names of its % * contributors may be used to endorse or promote products derived % * from this software without specific prior written permission. % * % * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS % * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT % * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS % * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE % * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, % * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL % * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE % * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS % * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, % * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE % * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. % */ #ifdef RPC_HDR %/* % * nis.h % * % * This file is the main include file for NIS clients. It contains % * both the client library function defines and the various data % * structures used by the NIS service. It includes the file nis_tags.h % * which defines the tag values. This allows the tags to change without % * having to change the nis.x file. % * % * NOTE : DO NOT EDIT THIS FILE! It is automatically generated when % * rpcgen is run on the nis.x file. Note that there is a % * simple sed script to remove some unneeded lines. (See the % * Makefile target nis.h) % * % */ %#include <rpcsvc/nis_tags.h> #endif /* This gets stuffed into the source files. */ #if RPC_HDR %#include <rpc/xdr.h> #endif /* Include the RPC Language description of NIS objects */ #include "nis_object.x" /* Errors that can be returned by the service */ enum nis_error { NIS_SUCCESS = 0, /* A-ok, let's rock n roll */ NIS_S_SUCCESS = 1, /* Name found (maybe) */ NIS_NOTFOUND = 2, /* Name definitely not found */ NIS_S_NOTFOUND = 3, /* Name maybe not found */ NIS_CACHEEXPIRED = 4, /* Name exists but cache out of date */ NIS_NAMEUNREACHABLE = 5, /* Can't get there from here */ NIS_UNKNOWNOBJ = 6, /* Object type is bogus */ NIS_TRYAGAIN = 7, /* I'm busy, call back */ NIS_SYSTEMERROR = 8, /* Generic system error */ NIS_CHAINBROKEN = 9, /* First/Next warning */ NIS_PERMISSION = 10, /* Not enough permission to access */ NIS_NOTOWNER = 11, /* You don't own it, sorry */ NIS_NOT_ME = 12, /* I don't serve this name */ NIS_NOMEMORY = 13, /* Outta VM! Help! */ NIS_NAMEEXISTS = 14, /* Can't create over another name */ NIS_NOTMASTER = 15, /* I'm justa secondaray, don't ask me */ NIS_INVALIDOBJ = 16, /* Object is broken somehow */ NIS_BADNAME = 17, /* Unparsable name */ NIS_NOCALLBACK = 18, /* Couldn't talk to call back proc */ NIS_CBRESULTS = 19, /* Results being called back to you */ NIS_NOSUCHNAME = 20, /* Name unknown */ NIS_NOTUNIQUE = 21, /* Value is not uniques (entry) */ NIS_IBMODERROR = 22, /* Inf. Base. Modify error. */ NIS_NOSUCHTABLE = 23, /* Name for table was wrong */ NIS_TYPEMISMATCH = 24, /* Entry and table type mismatch */ NIS_LINKNAMEERROR = 25, /* Link points to bogus name */ NIS_PARTIAL = 26, /* Partial success, found table */ NIS_TOOMANYATTRS = 27, /* Too many attributes */ NIS_RPCERROR = 28, /* RPC error encountered */ NIS_BADATTRIBUTE = 29, /* Bad or invalid attribute */ NIS_NOTSEARCHABLE = 30, /* Non-searchable object searched */ NIS_CBERROR = 31, /* Error during callback (svc crash) */ NIS_FOREIGNNS = 32, /* Foreign Namespace */ NIS_BADOBJECT = 33, /* Malformed object structure */ NIS_NOTSAMEOBJ = 34, /* Object swapped during deletion */ NIS_MODFAIL = 35, /* Failure during a Modify. */ NIS_BADREQUEST = 36, /* Illegal query for table */ NIS_NOTEMPTY = 37, /* Attempt to remove a non-empty tbl */ NIS_COLDSTART_ERR = 38, /* Error accesing the cold start file */ NIS_RESYNC = 39, /* Transaction log too far out of date */ NIS_FAIL = 40, /* NIS operation failed. */ NIS_UNAVAIL = 41, /* NIS+ service is unavailable (client) */ NIS_RES2BIG = 42, /* NIS+ result too big for datagram */ NIS_SRVAUTH = 43, /* NIS+ server wasn't authenticated. */ NIS_CLNTAUTH = 44, /* NIS+ Client wasn't authenticated. */ NIS_NOFILESPACE = 45, /* NIS+ server ran out of disk space */ NIS_NOPROC = 46, /* NIS+ server couldn't create new proc */ NIS_DUMPLATER = 47 /* NIS+ server already has dump child */ }; /* * Structure definitions for the parameters and results of the actual * NIS RPC calls. * * This is the standard result (in the protocol) of most of the nis * requests. */ struct nis_result { nis_error status; /* Status of the response */ nis_object objects<>; /* objects found */ netobj cookie; /* Cookie Data */ uint32_t zticks; /* server ticks */ uint32_t dticks; /* DBM ticks. */ uint32_t aticks; /* Cache (accel) ticks */ uint32_t cticks; /* Client ticks */ }; /* * A Name Service request * This request is used to access the name space, ns_name is the name * of the object within the namespace and the object is it's value, for * add/modify, a copy of the original for remove. */ struct ns_request { nis_name ns_name; /* Name in the NIS name space */ nis_object ns_object<1>; /* Optional Object (add/remove) */ }; /* * An information base request * This request includes the NIS name of the table we wish to search, the * search criteria in the form of attribute/value pairs and an optional * callback program number. If the callback program number is provided * the server will send back objects one at a time, otherwise it will * return them all in the response. */ struct ib_request { nis_name ibr_name; /* The name of the Table */ nis_attr ibr_srch<>; /* The search critereia */ uint32_t ibr_flags; /* Optional flags */ nis_object ibr_obj<1>; /* optional object (add/modify) */ nis_server ibr_cbhost<1>; /* Optional callback info */ u_int ibr_bufsize; /* Optional first/next bufsize */ netobj ibr_cookie; /* The first/next cookie */ }; /* * This argument to the PING call notifies the replicas that something in * a directory has changed and this is it's timestamp. The replica will use * the timestamp to determine if its resync operation was successful. */ struct ping_args { nis_name dir; /* Directory that had the change */ uint32_t stamp; /* timestamp of the transaction */ }; /* * These are the type of entries that are stored in the transaction log, * note that modifications will appear as two entries, for names, they have * a "OLD" entry followed by a "NEW" entry. For entries in tables, there * is a remove followed by an add. It is done this way so that we can read * the log backwards to back out transactions and forwards to propogate * updated. */ enum log_entry_t { LOG_NOP = 0, ADD_NAME = 1, /* Name Added to name space */ REM_NAME = 2, /* Name removed from name space */ MOD_NAME_OLD = 3, /* Name was modified in the name space */ MOD_NAME_NEW = 4, /* Name was modified in the name space */ ADD_IBASE = 5, /* Entry added to information base */ REM_IBASE = 6, /* Entry removed from information base */ MOD_IBASE = 7, /* Entry was modified in information base */ UPD_STAMP = 8 /* Update timestamp (used as fenceposts) */ }; /* * This result is returned from the name service when it is requested to * dump logged entries from its transaction log. Information base updates * will have the name of the information base in the le_name field and * a canonical set of attribute/value pairs to fully specify the entry's * 'name'. */ struct log_entry { uint32_t le_time; /* Time in seconds */ log_entry_t le_type; /* Type of log entry */ nis_name le_princp; /* Principal making the change */ nis_name le_name; /* Name of table/dir involved */ nis_attr le_attrs<>; /* List of AV pairs. */ nis_object le_object; /* Actual object value */ }; struct log_result { nis_error lr_status; /* The status itself */ netobj lr_cookie; /* Used by the dump callback */ log_entry lr_entries<>; /* zero or more entries */ }; struct cp_result { nis_error cp_status; /* Status of the checkpoint */ uint32_t cp_zticks; /* Service 'ticks' */ uint32_t cp_dticks; /* Database 'ticks' */ }; /* * This structure defines a generic NIS tag list. The taglist contains * zero or tags, each of which is a type and a value. (u_int). * These are used to report statistics (see tag definitions below) * and to set or reset state variables. */ struct nis_tag { uint32_t tag_type; /* Statistic tag (may vary) */ string tag_val<>; /* Statistic value may also vary */ }; struct nis_taglist { nis_tag tags<>; /* List of tags */ }; struct dump_args { nis_name da_dir; /* Directory to dump */ uint32_t da_time; /* From this timestamp */ nis_server da_cbhost<1>; /* Callback to use. */ }; struct fd_args { nis_name dir_name; /* The directory we're looking for */ nis_name requester; /* Host principal name for signature */ }; struct fd_result { nis_error status; /* Status returned by function */ nis_name source; /* Source of this answer */ opaque dir_data<>; /* Directory Data (XDR'ed) */ opaque signature<>; /* Signature of the source */ }; %/* % * Structures used for server binding. % */ struct nis_bound_endpoint { endpoint ep; int generation; int rank; uint32_t flags; int hostnum; int epnum; nis_name uaddr; endpoint cbep; }; typedef struct nis_bound_endpoint nis_bound_endpoint; struct nis_bound_directory { int generation; int min_rank; /* minimum rank of bound endpoints */ int optimal_rank; /* best possible rank of all endpoints */ directory_obj dobj; nis_bound_endpoint BEP<>; }; typedef struct nis_bound_directory nis_bound_directory; %#define bep_len BEP.BEP_len %#define bep_val BEP.BEP_val struct nis_active_endpoint { endpoint ep; nis_name hostname; int rank; int uaddr_generation; nis_name uaddr; int cbep_generation; endpoint cbep; }; typedef struct nis_active_endpoint nis_active_endpoint; %/* defines for nis_bound_endpoint.flags */ %#define NIS_BOUND 0x1 %#define NIS_TRANSIENT_ERRORS 0x2 program NIS_PROG { /* RPC Language description of the NIS+ protocol */ version NIS_VERSION { /* The name service functions */ nis_result NIS_LOOKUP(ns_request) = 1; nis_result NIS_ADD(ns_request) = 2; nis_result NIS_MODIFY(ns_request) = 3; nis_result NIS_REMOVE(ns_request) = 4; /* The information base functions */ nis_result NIS_IBLIST(ib_request) = 5; nis_result NIS_IBADD(ib_request) = 6; nis_result NIS_IBMODIFY(ib_request) = 7; nis_result NIS_IBREMOVE(ib_request) = 8; nis_result NIS_IBFIRST(ib_request) = 9; nis_result NIS_IBNEXT(ib_request) = 10; /* NIS Administrative functions */ fd_result NIS_FINDDIRECTORY(fd_args) = 12; /* If fetch and optionally reset statistics */ nis_taglist NIS_STATUS(nis_taglist) = 14; /* Dump changes to directory since time in da_time */ log_result NIS_DUMPLOG(dump_args) = 15; /* Dump contents of directory named */ log_result NIS_DUMP(dump_args) = 16; /* Check status of callback thread */ bool NIS_CALLBACK(netobj) = 17; /* Return last update time for named dir */ uint32_t NIS_CPTIME(nis_name) = 18; /* Checkpoint directory or table named */ cp_result NIS_CHECKPOINT(nis_name) = 19; /* Send 'status changed' ping to replicates */ void NIS_PING(ping_args) = 20; /* Modify server behaviour (such as debugging) */ nis_taglist NIS_SERVSTATE(nis_taglist) = 21; /* Create a Directory */ nis_error NIS_MKDIR(nis_name) = 22; /* Remove a Directory */ nis_error NIS_RMDIR(nis_name) = 23; /* Update public keys of a directory object */ nis_error NIS_UPDKEYS(nis_name) = 24; } = 3; } = 100300; /* * Included below are the defines that become part of nis.h, * they are technically not part of the protocol, but do define * key aspects of the implementation and are therefore useful * in building a conforming server or client. */ #if RPC_HDR %/* % * Generic "hash" datastructures, used by all types of hashed data. % */ %struct nis_hash_data { % nis_name name; /* NIS name of hashed item */ % int keychain; /* It's hash key (for pop) */ % struct nis_hash_data *next; /* Hash collision pointer */ % struct nis_hash_data *prv_item; /* A serial, doubly linked list */ % struct nis_hash_data *nxt_item; /* of items in the hash table */ %}; %typedef struct nis_hash_data NIS_HASH_ITEM; % %struct nis_hash_table { % NIS_HASH_ITEM *keys[64]; /* A hash table of items */ % NIS_HASH_ITEM *first; /* The first "item" in serial list */ %}; %typedef struct nis_hash_table NIS_HASH_TABLE; % %/* Structure for storing dynamically allocated static data */ %struct nis_sdata { % void *buf; /* Memory allocation pointer */ % u_int size; /* Buffer size */ %}; % %/* Generic client creating flags */ %#define ZMH_VC 1 %#define ZMH_DG 2 %#define ZMH_AUTH 4 % %/* Testing Access rights for objects */ % %#define NIS_READ_ACC 1 %#define NIS_MODIFY_ACC 2 %#define NIS_CREATE_ACC 4 %#define NIS_DESTROY_ACC 8 %/* Test macros. a == access rights, m == desired rights. */ %#define NIS_WORLD(a, m) (((a) & (m)) != 0) %#define NIS_GROUP(a, m) (((a) & ((m) << 8)) != 0) %#define NIS_OWNER(a, m) (((a) & ((m) << 16)) != 0) %#define NIS_NOBODY(a, m) (((a) & ((m) << 24)) != 0) %/* % * EOL Alert - The following non-prefixed test macros are % * here for backward compatability, and will be not be present % * in future releases - use the NIS_*() macros above. % */ %#define WORLD(a, m) (((a) & (m)) != 0) %#define GROUP(a, m) (((a) & ((m) << 8)) != 0) %#define OWNER(a, m) (((a) & ((m) << 16)) != 0) %#define NOBODY(a, m) (((a) & ((m) << 24)) != 0) % %#define OATYPE(d, n) (((d)->do_armask.do_armask_val+n)->oa_otype) %#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights) %#define WORLD_DEFAULT (NIS_READ_ACC) %#define GROUP_DEFAULT (NIS_READ_ACC << 8) %#define OWNER_DEFAULT ((NIS_READ_ACC +\ NIS_MODIFY_ACC +\ NIS_CREATE_ACC +\ NIS_DESTROY_ACC) << 16) %#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT) % %/* Result manipulation defines ... */ %#define NIS_RES_NUMOBJ(x) ((x)->objects.objects_len) %#define NIS_RES_OBJECT(x) ((x)->objects.objects_val) %#define NIS_RES_COOKIE(x) ((x)->cookie) %#define NIS_RES_STATUS(x) ((x)->status) % %/* These defines make getting at the variant part of the object easier. */ %#define TA_data zo_data.objdata_u.ta_data %#define EN_data zo_data.objdata_u.en_data %#define DI_data zo_data.objdata_u.di_data %#define LI_data zo_data.objdata_u.li_data %#define GR_data zo_data.objdata_u.gr_data % %#define __type_of(o) ((o)->zo_data.zo_type) % %/* Declarations for the internal subroutines in nislib.c */ %enum name_pos {SAME_NAME, HIGHER_NAME, LOWER_NAME, NOT_SEQUENTIAL, BAD_NAME}; %typedef enum name_pos name_pos; % %/* % * Defines for getting at column data in entry objects. Because RPCGEN % * generates some rather wordy structures, we create some defines that % * collapse the needed keystrokes to access a particular value using % * these definitions they take an nis_object *, and an int and return % * a u_char * for Value, and an int for length. % */ %#define ENTRY_VAL(obj, col) \ % (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val %#define ENTRY_LEN(obj, col) \ % (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len % % % %#ifdef __cplusplus %} %#endif % %/* Prototypes, and extern declarations for the NIS library functions. */ %#include <rpcsvc/nislib.h> %#endif /* __NIS_RPCGEN_H */ %/* EDIT_START */ % %/* % * nis_3.h % * % * This file contains definitions that are only of interest to the actual % * service daemon and client stubs. Normal users of NIS will not include % * this file. % * % * NOTE : This include file is automatically created by a combination % * of rpcgen and sed. DO NOT EDIT IT, change the nis.x file instead % * and then remake this file. % */ %#ifndef __nis_3_h %#define __nis_3_h %#ifdef __cplusplus %extern "C" { %#endif #endif ����������������������������������������������������������������������������������������������rpcsvc/nlm_prot.x�����������������������������������������������������������������������������������0000644�����������������00000011576�14763166026�0010114 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)nlm_prot.x 2.1 88/08/01 4.0 RPCSRC */ /* * Network lock manager protocol definition * Copyright (c) 2010, Oracle America, Inc. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * protocol used between local lock manager and remote lock manager */ #ifdef RPC_HDR %#define LM_MAXSTRLEN 1024 %#define MAXNAMELEN LM_MAXSTRLEN+1 #endif /* * status of a call to the lock manager */ enum nlm_stats { nlm_granted = 0, nlm_denied = 1, nlm_denied_nolocks = 2, nlm_blocked = 3, nlm_denied_grace_period = 4 }; struct nlm_holder { bool exclusive; int svid; netobj oh; unsigned l_offset; unsigned l_len; }; union nlm_testrply switch (nlm_stats stat) { case nlm_denied: struct nlm_holder holder; default: void; }; struct nlm_stat { nlm_stats stat; }; struct nlm_res { netobj cookie; nlm_stat stat; }; struct nlm_testres { netobj cookie; nlm_testrply stat; }; struct nlm_lock { string caller_name<LM_MAXSTRLEN>; netobj fh; /* identify a file */ netobj oh; /* identify owner of a lock */ int svid; /* generated from pid for svid */ unsigned l_offset; unsigned l_len; }; struct nlm_lockargs { netobj cookie; bool block; bool exclusive; struct nlm_lock alock; bool reclaim; /* used for recovering locks */ int state; /* specify local status monitor state */ }; struct nlm_cancargs { netobj cookie; bool block; bool exclusive; struct nlm_lock alock; }; struct nlm_testargs { netobj cookie; bool exclusive; struct nlm_lock alock; }; struct nlm_unlockargs { netobj cookie; struct nlm_lock alock; }; #ifdef RPC_HDR %/* % * The following enums are actually bit encoded for efficient % * boolean algebra.... DON'T change them..... % */ #endif enum fsh_mode { fsm_DN = 0, /* deny none */ fsm_DR = 1, /* deny read */ fsm_DW = 2, /* deny write */ fsm_DRW = 3 /* deny read/write */ }; enum fsh_access { fsa_NONE = 0, /* for completeness */ fsa_R = 1, /* read only */ fsa_W = 2, /* write only */ fsa_RW = 3 /* read/write */ }; struct nlm_share { string caller_name<LM_MAXSTRLEN>; netobj fh; netobj oh; fsh_mode mode; fsh_access access; }; struct nlm_shareargs { netobj cookie; nlm_share share; bool reclaim; }; struct nlm_shareres { netobj cookie; nlm_stats stat; int sequence; }; struct nlm_notify { string name<MAXNAMELEN>; long state; }; /* * Over-the-wire protocol used between the network lock managers */ program NLM_PROG { version NLM_VERS { nlm_testres NLM_TEST(struct nlm_testargs) = 1; nlm_res NLM_LOCK(struct nlm_lockargs) = 2; nlm_res NLM_CANCEL(struct nlm_cancargs) = 3; nlm_res NLM_UNLOCK(struct nlm_unlockargs) = 4; /* * remote lock manager call-back to grant lock */ nlm_res NLM_GRANTED(struct nlm_testargs)= 5; /* * message passing style of requesting lock */ void NLM_TEST_MSG(struct nlm_testargs) = 6; void NLM_LOCK_MSG(struct nlm_lockargs) = 7; void NLM_CANCEL_MSG(struct nlm_cancargs) =8; void NLM_UNLOCK_MSG(struct nlm_unlockargs) = 9; void NLM_GRANTED_MSG(struct nlm_testargs) = 10; void NLM_TEST_RES(nlm_testres) = 11; void NLM_LOCK_RES(nlm_res) = 12; void NLM_CANCEL_RES(nlm_res) = 13; void NLM_UNLOCK_RES(nlm_res) = 14; void NLM_GRANTED_RES(nlm_res) = 15; } = 1; version NLM_VERSX { nlm_shareres NLM_SHARE(nlm_shareargs) = 20; nlm_shareres NLM_UNSHARE(nlm_shareargs) = 21; nlm_res NLM_NM_LOCK(nlm_lockargs) = 22; void NLM_FREE_ALL(nlm_notify) = 23; } = 3; } = 100021; ����������������������������������������������������������������������������������������������������������������������������������rpcsvc/yppasswd.h�����������������������������������������������������������������������������������0000644�����������������00000002405�14763166026�0010103 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _YPPASSWD_H_RPCGEN #define _YPPASSWD_H_RPCGEN #include <rpc/rpc.h> #ifdef __cplusplus extern "C" { #endif struct passwd { char *pw_name; char *pw_passwd; int pw_uid; int pw_gid; char *pw_gecos; char *pw_dir; char *pw_shell; }; typedef struct passwd passwd; struct yppasswd { char *oldpass; passwd newpw; }; typedef struct yppasswd yppasswd; #define YPPASSWDPROG 100009 #define YPPASSWDVERS 1 #if defined(__STDC__) || defined(__cplusplus) #define YPPASSWDPROC_UPDATE 1 extern int * yppasswdproc_update_1(yppasswd *, CLIENT *); extern int * yppasswdproc_update_1_svc(yppasswd *, struct svc_req *); extern int yppasswdprog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define YPPASSWDPROC_UPDATE 1 extern int * yppasswdproc_update_1(); extern int * yppasswdproc_update_1_svc(); extern int yppasswdprog_1_freeresult (); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_passwd (XDR *, passwd*); extern bool_t xdr_yppasswd (XDR *, yppasswd*); #else /* K&R C */ extern bool_t xdr_passwd (); extern bool_t xdr_yppasswd (); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_YPPASSWD_H_RPCGEN */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/rex.h����������������������������������������������������������������������������������������0000644�����������������00000012204�14763166026�0007025 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _REX_H_RPCGEN #define _REX_H_RPCGEN #include <rpc/rpc.h> #ifdef __cplusplus extern "C" { #endif #define STRINGSIZE 1024 typedef char *rexstring; #define SIGINT 2 #define REX_INTERACTIVE 1 struct rex_start { struct { u_int rst_cmd_len; rexstring *rst_cmd_val; } rst_cmd; rexstring rst_host; rexstring rst_fsname; rexstring rst_dirwithin; struct { u_int rst_env_len; rexstring *rst_env_val; } rst_env; u_int rst_port0; u_int rst_port1; u_int rst_port2; u_int rst_flags; }; typedef struct rex_start rex_start; struct rex_result { int rlt_stat; rexstring rlt_message; }; typedef struct rex_result rex_result; struct sgttyb { u_int four; char chars[4]; u_int flags; }; typedef struct sgttyb sgttyb; #define B0 0 #define B50 1 #define B75 2 #define B110 3 #define B134 4 #define B150 5 #define B200 6 #define B300 7 #define B600 8 #define B1200 9 #define B1800 10 #define B2400 11 #define B4800 12 #define B9600 13 #define B19200 14 #define B38400 15 #define TANDEM 0x00000001 #define CBREAK 0x00000002 #define LCASE 0x00000004 #define ECHO 0x00000008 #define CRMOD 0x00000010 #define RAW 0x00000020 #define ODDP 0x00000040 #define EVENP 0x00000080 #define ANYP 0x000000c0 #define NLDELAY 0x00000300 #define NL0 0x00000000 #define NL1 0x00000100 #define NL2 0x00000200 #define NL3 0x00000300 #define TBDELAY 0x00000c00 #define TAB0 0x00000000 #define TAB1 0x00000400 #define TAB2 0x00000800 #define XTABS 0x00000c00 #define CRDELAY 0x00003000 #define CR0 0x00000000 #define CR1 0x00001000 #define CR2 0x00002000 #define CR3 0x00003000 #define VTDELAY 0x00004000 #define FF0 0x00000000 #define FF1 0x00004000 #define BSDELAY 0x00008000 #define BS0 0x00000000 #define BS1 0x00008000 #define CRTBS 0x00010000 #define PRTERA 0x00020000 #define CRTERA 0x00040000 #define TILDE 0x00080000 #define MDMBUF 0x00100000 #define LITOUT 0x00200000 #define TOSTOP 0x00400000 #define FLUSHO 0x00800000 #define NOHANG 0x01000000 #define L001000 0x02000000 #define CRTKIL 0x04000000 #define PASS8 0x08000000 #define CTLECH 0x10000000 #define PENDIN 0x20000000 #define DECCTQ 0x40000000 #define NOFLSH 0x80000000 struct tchars { u_int six; char chars[6]; }; typedef struct tchars tchars; struct ltchars { u_int six; char chars[6]; u_int mode; }; typedef struct ltchars ltchars; struct rex_ttysize { int ts_lines; int ts_cols; }; typedef struct rex_ttysize rex_ttysize; struct rex_ttymode { sgttyb basic; tchars more; ltchars yetmore; u_int andmore; }; typedef struct rex_ttymode rex_ttymode; #define LCRTBS 0x0001 #define LPRTERA 0x0002 #define LCRTERA 0x0004 #define LTILDE 0x0008 #define LMDMBUF 0x0010 #define LLITOUT 0x0020 #define LTOSTOP 0x0040 #define LFLUSHO 0x0080 #define LNOHANG 0x0100 #define LL001000 0x0200 #define LCRTKIL 0x0400 #define LPASS8 0x0800 #define LCTLECH 0x1000 #define LPENDIN 0x2000 #define LDECCTQ 0x4000 #define LNOFLSH 0x8000 #define REXPROG 100017 #define REXVERS 1 #if defined(__STDC__) || defined(__cplusplus) #define REXPROC_START 1 extern rex_result * rexproc_start_1(rex_start *, CLIENT *); extern rex_result * rexproc_start_1_svc(rex_start *, struct svc_req *); #define REXPROC_WAIT 2 extern rex_result * rexproc_wait_1(void *, CLIENT *); extern rex_result * rexproc_wait_1_svc(void *, struct svc_req *); #define REXPROC_MODES 3 extern void * rexproc_modes_1(rex_ttymode *, CLIENT *); extern void * rexproc_modes_1_svc(rex_ttymode *, struct svc_req *); #define REXPROC_WINCH 4 extern void * rexproc_winch_1(rex_ttysize *, CLIENT *); extern void * rexproc_winch_1_svc(rex_ttysize *, struct svc_req *); #define REXPROC_SIGNAL 5 extern void * rexproc_signal_1(int *, CLIENT *); extern void * rexproc_signal_1_svc(int *, struct svc_req *); extern int rexprog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define REXPROC_START 1 extern rex_result * rexproc_start_1(); extern rex_result * rexproc_start_1_svc(); #define REXPROC_WAIT 2 extern rex_result * rexproc_wait_1(); extern rex_result * rexproc_wait_1_svc(); #define REXPROC_MODES 3 extern void * rexproc_modes_1(); extern void * rexproc_modes_1_svc(); #define REXPROC_WINCH 4 extern void * rexproc_winch_1(); extern void * rexproc_winch_1_svc(); #define REXPROC_SIGNAL 5 extern void * rexproc_signal_1(); extern void * rexproc_signal_1_svc(); extern int rexprog_1_freeresult (); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_rexstring (XDR *, rexstring*); extern bool_t xdr_rex_start (XDR *, rex_start*); extern bool_t xdr_rex_result (XDR *, rex_result*); extern bool_t xdr_sgttyb (XDR *, sgttyb*); extern bool_t xdr_tchars (XDR *, tchars*); extern bool_t xdr_ltchars (XDR *, ltchars*); extern bool_t xdr_rex_ttysize (XDR *, rex_ttysize*); extern bool_t xdr_rex_ttymode (XDR *, rex_ttymode*); #else /* K&R C */ extern bool_t xdr_rexstring (); extern bool_t xdr_rex_start (); extern bool_t xdr_rex_result (); extern bool_t xdr_sgttyb (); extern bool_t xdr_tchars (); extern bool_t xdr_ltchars (); extern bool_t xdr_rex_ttysize (); extern bool_t xdr_rex_ttymode (); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_REX_H_RPCGEN */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/rstat.h��������������������������������������������������������������������������������������0000644�����������������00000007715�14763166026�0007377 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _RSTAT_H_RPCGEN #define _RSTAT_H_RPCGEN #include <rpc/rpc.h> #ifdef __cplusplus extern "C" { #endif #ifndef FSCALE /* * Scale factor for scaled integers used to count load averages. */ #define FSHIFT 8 /* bits to right of fixed binary point */ #define FSCALE (1<<FSHIFT) #endif /* ndef FSCALE */ #define CPUSTATES 4 #define DK_NDRIVE 4 struct rstat_timeval { u_int tv_sec; u_int tv_usec; }; typedef struct rstat_timeval rstat_timeval; struct statstime { int cp_time[CPUSTATES]; int dk_xfer[DK_NDRIVE]; u_int v_pgpgin; u_int v_pgpgout; u_int v_pswpin; u_int v_pswpout; u_int v_intr; int if_ipackets; int if_ierrors; int if_oerrors; int if_collisions; u_int v_swtch; int avenrun[3]; rstat_timeval boottime; rstat_timeval curtime; int if_opackets; }; typedef struct statstime statstime; struct statsswtch { int cp_time[CPUSTATES]; int dk_xfer[DK_NDRIVE]; u_int v_pgpgin; u_int v_pgpgout; u_int v_pswpin; u_int v_pswpout; u_int v_intr; int if_ipackets; int if_ierrors; int if_oerrors; int if_collisions; u_int v_swtch; u_int avenrun[3]; rstat_timeval boottime; int if_opackets; }; typedef struct statsswtch statsswtch; struct stats { int cp_time[CPUSTATES]; int dk_xfer[DK_NDRIVE]; u_int v_pgpgin; u_int v_pgpgout; u_int v_pswpin; u_int v_pswpout; u_int v_intr; int if_ipackets; int if_ierrors; int if_oerrors; int if_collisions; int if_opackets; }; typedef struct stats stats; #define RSTATPROG 100001 #define RSTATVERS_TIME 3 #if defined(__STDC__) || defined(__cplusplus) #define RSTATPROC_STATS 1 extern statstime * rstatproc_stats_3(void *, CLIENT *); extern statstime * rstatproc_stats_3_svc(void *, struct svc_req *); #define RSTATPROC_HAVEDISK 2 extern u_int * rstatproc_havedisk_3(void *, CLIENT *); extern u_int * rstatproc_havedisk_3_svc(void *, struct svc_req *); extern int rstatprog_3_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define RSTATPROC_STATS 1 extern statstime * rstatproc_stats_3(); extern statstime * rstatproc_stats_3_svc(); #define RSTATPROC_HAVEDISK 2 extern u_int * rstatproc_havedisk_3(); extern u_int * rstatproc_havedisk_3_svc(); extern int rstatprog_3_freeresult (); #endif /* K&R C */ #define RSTATVERS_SWTCH 2 #if defined(__STDC__) || defined(__cplusplus) extern statsswtch * rstatproc_stats_2(void *, CLIENT *); extern statsswtch * rstatproc_stats_2_svc(void *, struct svc_req *); extern u_int * rstatproc_havedisk_2(void *, CLIENT *); extern u_int * rstatproc_havedisk_2_svc(void *, struct svc_req *); extern int rstatprog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ extern statsswtch * rstatproc_stats_2(); extern statsswtch * rstatproc_stats_2_svc(); extern u_int * rstatproc_havedisk_2(); extern u_int * rstatproc_havedisk_2_svc(); extern int rstatprog_2_freeresult (); #endif /* K&R C */ #define RSTATVERS_ORIG 1 #if defined(__STDC__) || defined(__cplusplus) extern stats * rstatproc_stats_1(void *, CLIENT *); extern stats * rstatproc_stats_1_svc(void *, struct svc_req *); extern u_int * rstatproc_havedisk_1(void *, CLIENT *); extern u_int * rstatproc_havedisk_1_svc(void *, struct svc_req *); extern int rstatprog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ extern stats * rstatproc_stats_1(); extern stats * rstatproc_stats_1_svc(); extern u_int * rstatproc_havedisk_1(); extern u_int * rstatproc_havedisk_1_svc(); extern int rstatprog_1_freeresult (); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_rstat_timeval (XDR *, rstat_timeval*); extern bool_t xdr_statstime (XDR *, statstime*); extern bool_t xdr_statsswtch (XDR *, statsswtch*); extern bool_t xdr_stats (XDR *, stats*); #else /* K&R C */ extern bool_t xdr_rstat_timeval (); extern bool_t xdr_statstime (); extern bool_t xdr_statsswtch (); extern bool_t xdr_stats (); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_RSTAT_H_RPCGEN */ ���������������������������������������������������rpcsvc/sm_inter.h�����������������������������������������������������������������������������������0000644�����������������00000006145�14763166026�0010056 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _SM_INTER_H_RPCGEN #define _SM_INTER_H_RPCGEN #include <rpc/rpc.h> #ifdef __cplusplus extern "C" { #endif #define SM_MAXSTRLEN 1024 struct sm_name { char *mon_name; }; typedef struct sm_name sm_name; struct my_id { char *my_name; int my_prog; int my_vers; int my_proc; }; typedef struct my_id my_id; struct mon_id { char *mon_name; struct my_id my_id; }; typedef struct mon_id mon_id; struct mon { struct mon_id mon_id; char priv[16]; }; typedef struct mon mon; struct sm_stat { int state; }; typedef struct sm_stat sm_stat; enum res { stat_succ = 0, stat_fail = 1, }; typedef enum res res; struct sm_stat_res { res res_stat; int state; }; typedef struct sm_stat_res sm_stat_res; struct status { char *mon_name; int state; char priv[16]; }; typedef struct status status; #define SM_PROG 100024 #define SM_VERS 1 #if defined(__STDC__) || defined(__cplusplus) #define SM_STAT 1 extern struct sm_stat_res * sm_stat_1(struct sm_name *, CLIENT *); extern struct sm_stat_res * sm_stat_1_svc(struct sm_name *, struct svc_req *); #define SM_MON 2 extern struct sm_stat_res * sm_mon_1(struct mon *, CLIENT *); extern struct sm_stat_res * sm_mon_1_svc(struct mon *, struct svc_req *); #define SM_UNMON 3 extern struct sm_stat * sm_unmon_1(struct mon_id *, CLIENT *); extern struct sm_stat * sm_unmon_1_svc(struct mon_id *, struct svc_req *); #define SM_UNMON_ALL 4 extern struct sm_stat * sm_unmon_all_1(struct my_id *, CLIENT *); extern struct sm_stat * sm_unmon_all_1_svc(struct my_id *, struct svc_req *); #define SM_SIMU_CRASH 5 extern void * sm_simu_crash_1(void *, CLIENT *); extern void * sm_simu_crash_1_svc(void *, struct svc_req *); extern int sm_prog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define SM_STAT 1 extern struct sm_stat_res * sm_stat_1(); extern struct sm_stat_res * sm_stat_1_svc(); #define SM_MON 2 extern struct sm_stat_res * sm_mon_1(); extern struct sm_stat_res * sm_mon_1_svc(); #define SM_UNMON 3 extern struct sm_stat * sm_unmon_1(); extern struct sm_stat * sm_unmon_1_svc(); #define SM_UNMON_ALL 4 extern struct sm_stat * sm_unmon_all_1(); extern struct sm_stat * sm_unmon_all_1_svc(); #define SM_SIMU_CRASH 5 extern void * sm_simu_crash_1(); extern void * sm_simu_crash_1_svc(); extern int sm_prog_1_freeresult (); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_sm_name (XDR *, sm_name*); extern bool_t xdr_my_id (XDR *, my_id*); extern bool_t xdr_mon_id (XDR *, mon_id*); extern bool_t xdr_mon (XDR *, mon*); extern bool_t xdr_sm_stat (XDR *, sm_stat*); extern bool_t xdr_res (XDR *, res*); extern bool_t xdr_sm_stat_res (XDR *, sm_stat_res*); extern bool_t xdr_status (XDR *, status*); #else /* K&R C */ extern bool_t xdr_sm_name (); extern bool_t xdr_my_id (); extern bool_t xdr_mon_id (); extern bool_t xdr_mon (); extern bool_t xdr_sm_stat (); extern bool_t xdr_res (); extern bool_t xdr_sm_stat_res (); extern bool_t xdr_status (); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_SM_INTER_H_RPCGEN */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/key_prot.h�����������������������������������������������������������������������������������0000644�����������������00000015145�14763166026�0010072 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _KEY_PROT_H_RPCGEN #define _KEY_PROT_H_RPCGEN #include <rpc/rpc.h> #ifdef __cplusplus extern "C" { #endif #if 0 #pragma ident "@(#)key_prot.x 1.7 94/04/29 SMI" #endif /* Copyright (c) 1990, 1991 Sun Microsystems, Inc. */ /* * Compiled from key_prot.x using rpcgen. * DO NOT EDIT THIS FILE! * This is NOT source code! */ #define PROOT 3 #define HEXMODULUS "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b" #define HEXKEYBYTES 48 #define KEYSIZE 192 #define KEYBYTES 24 #define KEYCHECKSUMSIZE 16 enum keystatus { KEY_SUCCESS = 0, KEY_NOSECRET = 1, KEY_UNKNOWN = 2, KEY_SYSTEMERR = 3, }; typedef enum keystatus keystatus; typedef char keybuf[HEXKEYBYTES]; typedef char *netnamestr; struct cryptkeyarg { netnamestr remotename; des_block deskey; }; typedef struct cryptkeyarg cryptkeyarg; struct cryptkeyarg2 { netnamestr remotename; netobj remotekey; des_block deskey; }; typedef struct cryptkeyarg2 cryptkeyarg2; struct cryptkeyres { keystatus status; union { des_block deskey; } cryptkeyres_u; }; typedef struct cryptkeyres cryptkeyres; #define MAXGIDS 16 struct unixcred { u_int uid; u_int gid; struct { u_int gids_len; u_int *gids_val; } gids; }; typedef struct unixcred unixcred; struct getcredres { keystatus status; union { unixcred cred; } getcredres_u; }; typedef struct getcredres getcredres; struct key_netstarg { keybuf st_priv_key; keybuf st_pub_key; netnamestr st_netname; }; typedef struct key_netstarg key_netstarg; struct key_netstres { keystatus status; union { key_netstarg knet; } key_netstres_u; }; typedef struct key_netstres key_netstres; #ifndef opaque #define opaque char #endif #define KEY_PROG 100029 #define KEY_VERS 1 #if defined(__STDC__) || defined(__cplusplus) #define KEY_SET 1 extern keystatus * key_set_1(char *, CLIENT *); extern keystatus * key_set_1_svc(char *, struct svc_req *); #define KEY_ENCRYPT 2 extern cryptkeyres * key_encrypt_1(cryptkeyarg *, CLIENT *); extern cryptkeyres * key_encrypt_1_svc(cryptkeyarg *, struct svc_req *); #define KEY_DECRYPT 3 extern cryptkeyres * key_decrypt_1(cryptkeyarg *, CLIENT *); extern cryptkeyres * key_decrypt_1_svc(cryptkeyarg *, struct svc_req *); #define KEY_GEN 4 extern des_block * key_gen_1(void *, CLIENT *); extern des_block * key_gen_1_svc(void *, struct svc_req *); #define KEY_GETCRED 5 extern getcredres * key_getcred_1(netnamestr *, CLIENT *); extern getcredres * key_getcred_1_svc(netnamestr *, struct svc_req *); extern int key_prog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define KEY_SET 1 extern keystatus * key_set_1(); extern keystatus * key_set_1_svc(); #define KEY_ENCRYPT 2 extern cryptkeyres * key_encrypt_1(); extern cryptkeyres * key_encrypt_1_svc(); #define KEY_DECRYPT 3 extern cryptkeyres * key_decrypt_1(); extern cryptkeyres * key_decrypt_1_svc(); #define KEY_GEN 4 extern des_block * key_gen_1(); extern des_block * key_gen_1_svc(); #define KEY_GETCRED 5 extern getcredres * key_getcred_1(); extern getcredres * key_getcred_1_svc(); extern int key_prog_1_freeresult (); #endif /* K&R C */ #define KEY_VERS2 2 #if defined(__STDC__) || defined(__cplusplus) extern keystatus * key_set_2(char *, CLIENT *); extern keystatus * key_set_2_svc(char *, struct svc_req *); extern cryptkeyres * key_encrypt_2(cryptkeyarg *, CLIENT *); extern cryptkeyres * key_encrypt_2_svc(cryptkeyarg *, struct svc_req *); extern cryptkeyres * key_decrypt_2(cryptkeyarg *, CLIENT *); extern cryptkeyres * key_decrypt_2_svc(cryptkeyarg *, struct svc_req *); extern des_block * key_gen_2(void *, CLIENT *); extern des_block * key_gen_2_svc(void *, struct svc_req *); extern getcredres * key_getcred_2(netnamestr *, CLIENT *); extern getcredres * key_getcred_2_svc(netnamestr *, struct svc_req *); #define KEY_ENCRYPT_PK 6 extern cryptkeyres * key_encrypt_pk_2(cryptkeyarg2 *, CLIENT *); extern cryptkeyres * key_encrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *); #define KEY_DECRYPT_PK 7 extern cryptkeyres * key_decrypt_pk_2(cryptkeyarg2 *, CLIENT *); extern cryptkeyres * key_decrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *); #define KEY_NET_PUT 8 extern keystatus * key_net_put_2(key_netstarg *, CLIENT *); extern keystatus * key_net_put_2_svc(key_netstarg *, struct svc_req *); #define KEY_NET_GET 9 extern key_netstres * key_net_get_2(void *, CLIENT *); extern key_netstres * key_net_get_2_svc(void *, struct svc_req *); #define KEY_GET_CONV 10 extern cryptkeyres * key_get_conv_2(char *, CLIENT *); extern cryptkeyres * key_get_conv_2_svc(char *, struct svc_req *); extern int key_prog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ extern keystatus * key_set_2(); extern keystatus * key_set_2_svc(); extern cryptkeyres * key_encrypt_2(); extern cryptkeyres * key_encrypt_2_svc(); extern cryptkeyres * key_decrypt_2(); extern cryptkeyres * key_decrypt_2_svc(); extern des_block * key_gen_2(); extern des_block * key_gen_2_svc(); extern getcredres * key_getcred_2(); extern getcredres * key_getcred_2_svc(); #define KEY_ENCRYPT_PK 6 extern cryptkeyres * key_encrypt_pk_2(); extern cryptkeyres * key_encrypt_pk_2_svc(); #define KEY_DECRYPT_PK 7 extern cryptkeyres * key_decrypt_pk_2(); extern cryptkeyres * key_decrypt_pk_2_svc(); #define KEY_NET_PUT 8 extern keystatus * key_net_put_2(); extern keystatus * key_net_put_2_svc(); #define KEY_NET_GET 9 extern key_netstres * key_net_get_2(); extern key_netstres * key_net_get_2_svc(); #define KEY_GET_CONV 10 extern cryptkeyres * key_get_conv_2(); extern cryptkeyres * key_get_conv_2_svc(); extern int key_prog_2_freeresult (); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_keystatus (XDR *, keystatus*); extern bool_t xdr_keybuf (XDR *, keybuf); extern bool_t xdr_netnamestr (XDR *, netnamestr*); extern bool_t xdr_cryptkeyarg (XDR *, cryptkeyarg*); extern bool_t xdr_cryptkeyarg2 (XDR *, cryptkeyarg2*); extern bool_t xdr_cryptkeyres (XDR *, cryptkeyres*); extern bool_t xdr_unixcred (XDR *, unixcred*); extern bool_t xdr_getcredres (XDR *, getcredres*); extern bool_t xdr_key_netstarg (XDR *, key_netstarg*); extern bool_t xdr_key_netstres (XDR *, key_netstres*); #else /* K&R C */ extern bool_t xdr_keystatus (); extern bool_t xdr_keybuf (); extern bool_t xdr_netnamestr (); extern bool_t xdr_cryptkeyarg (); extern bool_t xdr_cryptkeyarg2 (); extern bool_t xdr_cryptkeyres (); extern bool_t xdr_unixcred (); extern bool_t xdr_getcredres (); extern bool_t xdr_key_netstarg (); extern bool_t xdr_key_netstres (); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_KEY_PROT_H_RPCGEN */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/nlm_prot.h�����������������������������������������������������������������������������������0000644�����������������00000022236�14763166026�0010067 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _NLM_PROT_H_RPCGEN #define _NLM_PROT_H_RPCGEN #include <rpc/rpc.h> #ifdef __cplusplus extern "C" { #endif #define LM_MAXSTRLEN 1024 #define MAXNAMELEN LM_MAXSTRLEN+1 enum nlm_stats { nlm_granted = 0, nlm_denied = 1, nlm_denied_nolocks = 2, nlm_blocked = 3, nlm_denied_grace_period = 4, }; typedef enum nlm_stats nlm_stats; struct nlm_holder { bool_t exclusive; int svid; netobj oh; u_int l_offset; u_int l_len; }; typedef struct nlm_holder nlm_holder; struct nlm_testrply { nlm_stats stat; union { struct nlm_holder holder; } nlm_testrply_u; }; typedef struct nlm_testrply nlm_testrply; struct nlm_stat { nlm_stats stat; }; typedef struct nlm_stat nlm_stat; struct nlm_res { netobj cookie; nlm_stat stat; }; typedef struct nlm_res nlm_res; struct nlm_testres { netobj cookie; nlm_testrply stat; }; typedef struct nlm_testres nlm_testres; struct nlm_lock { char *caller_name; netobj fh; netobj oh; int svid; u_int l_offset; u_int l_len; }; typedef struct nlm_lock nlm_lock; struct nlm_lockargs { netobj cookie; bool_t block; bool_t exclusive; struct nlm_lock alock; bool_t reclaim; int state; }; typedef struct nlm_lockargs nlm_lockargs; struct nlm_cancargs { netobj cookie; bool_t block; bool_t exclusive; struct nlm_lock alock; }; typedef struct nlm_cancargs nlm_cancargs; struct nlm_testargs { netobj cookie; bool_t exclusive; struct nlm_lock alock; }; typedef struct nlm_testargs nlm_testargs; struct nlm_unlockargs { netobj cookie; struct nlm_lock alock; }; typedef struct nlm_unlockargs nlm_unlockargs; /* * The following enums are actually bit encoded for efficient * boolean algebra.... DON'T change them..... */ enum fsh_mode { fsm_DN = 0, fsm_DR = 1, fsm_DW = 2, fsm_DRW = 3, }; typedef enum fsh_mode fsh_mode; enum fsh_access { fsa_NONE = 0, fsa_R = 1, fsa_W = 2, fsa_RW = 3, }; typedef enum fsh_access fsh_access; struct nlm_share { char *caller_name; netobj fh; netobj oh; fsh_mode mode; fsh_access access; }; typedef struct nlm_share nlm_share; struct nlm_shareargs { netobj cookie; nlm_share share; bool_t reclaim; }; typedef struct nlm_shareargs nlm_shareargs; struct nlm_shareres { netobj cookie; nlm_stats stat; int sequence; }; typedef struct nlm_shareres nlm_shareres; struct nlm_notify { char *name; long state; }; typedef struct nlm_notify nlm_notify; #define NLM_PROG 100021 #define NLM_VERS 1 #if defined(__STDC__) || defined(__cplusplus) #define NLM_TEST 1 extern nlm_testres * nlm_test_1(struct nlm_testargs *, CLIENT *); extern nlm_testres * nlm_test_1_svc(struct nlm_testargs *, struct svc_req *); #define NLM_LOCK 2 extern nlm_res * nlm_lock_1(struct nlm_lockargs *, CLIENT *); extern nlm_res * nlm_lock_1_svc(struct nlm_lockargs *, struct svc_req *); #define NLM_CANCEL 3 extern nlm_res * nlm_cancel_1(struct nlm_cancargs *, CLIENT *); extern nlm_res * nlm_cancel_1_svc(struct nlm_cancargs *, struct svc_req *); #define NLM_UNLOCK 4 extern nlm_res * nlm_unlock_1(struct nlm_unlockargs *, CLIENT *); extern nlm_res * nlm_unlock_1_svc(struct nlm_unlockargs *, struct svc_req *); #define NLM_GRANTED 5 extern nlm_res * nlm_granted_1(struct nlm_testargs *, CLIENT *); extern nlm_res * nlm_granted_1_svc(struct nlm_testargs *, struct svc_req *); #define NLM_TEST_MSG 6 extern void * nlm_test_msg_1(struct nlm_testargs *, CLIENT *); extern void * nlm_test_msg_1_svc(struct nlm_testargs *, struct svc_req *); #define NLM_LOCK_MSG 7 extern void * nlm_lock_msg_1(struct nlm_lockargs *, CLIENT *); extern void * nlm_lock_msg_1_svc(struct nlm_lockargs *, struct svc_req *); #define NLM_CANCEL_MSG 8 extern void * nlm_cancel_msg_1(struct nlm_cancargs *, CLIENT *); extern void * nlm_cancel_msg_1_svc(struct nlm_cancargs *, struct svc_req *); #define NLM_UNLOCK_MSG 9 extern void * nlm_unlock_msg_1(struct nlm_unlockargs *, CLIENT *); extern void * nlm_unlock_msg_1_svc(struct nlm_unlockargs *, struct svc_req *); #define NLM_GRANTED_MSG 10 extern void * nlm_granted_msg_1(struct nlm_testargs *, CLIENT *); extern void * nlm_granted_msg_1_svc(struct nlm_testargs *, struct svc_req *); #define NLM_TEST_RES 11 extern void * nlm_test_res_1(nlm_testres *, CLIENT *); extern void * nlm_test_res_1_svc(nlm_testres *, struct svc_req *); #define NLM_LOCK_RES 12 extern void * nlm_lock_res_1(nlm_res *, CLIENT *); extern void * nlm_lock_res_1_svc(nlm_res *, struct svc_req *); #define NLM_CANCEL_RES 13 extern void * nlm_cancel_res_1(nlm_res *, CLIENT *); extern void * nlm_cancel_res_1_svc(nlm_res *, struct svc_req *); #define NLM_UNLOCK_RES 14 extern void * nlm_unlock_res_1(nlm_res *, CLIENT *); extern void * nlm_unlock_res_1_svc(nlm_res *, struct svc_req *); #define NLM_GRANTED_RES 15 extern void * nlm_granted_res_1(nlm_res *, CLIENT *); extern void * nlm_granted_res_1_svc(nlm_res *, struct svc_req *); extern int nlm_prog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define NLM_TEST 1 extern nlm_testres * nlm_test_1(); extern nlm_testres * nlm_test_1_svc(); #define NLM_LOCK 2 extern nlm_res * nlm_lock_1(); extern nlm_res * nlm_lock_1_svc(); #define NLM_CANCEL 3 extern nlm_res * nlm_cancel_1(); extern nlm_res * nlm_cancel_1_svc(); #define NLM_UNLOCK 4 extern nlm_res * nlm_unlock_1(); extern nlm_res * nlm_unlock_1_svc(); #define NLM_GRANTED 5 extern nlm_res * nlm_granted_1(); extern nlm_res * nlm_granted_1_svc(); #define NLM_TEST_MSG 6 extern void * nlm_test_msg_1(); extern void * nlm_test_msg_1_svc(); #define NLM_LOCK_MSG 7 extern void * nlm_lock_msg_1(); extern void * nlm_lock_msg_1_svc(); #define NLM_CANCEL_MSG 8 extern void * nlm_cancel_msg_1(); extern void * nlm_cancel_msg_1_svc(); #define NLM_UNLOCK_MSG 9 extern void * nlm_unlock_msg_1(); extern void * nlm_unlock_msg_1_svc(); #define NLM_GRANTED_MSG 10 extern void * nlm_granted_msg_1(); extern void * nlm_granted_msg_1_svc(); #define NLM_TEST_RES 11 extern void * nlm_test_res_1(); extern void * nlm_test_res_1_svc(); #define NLM_LOCK_RES 12 extern void * nlm_lock_res_1(); extern void * nlm_lock_res_1_svc(); #define NLM_CANCEL_RES 13 extern void * nlm_cancel_res_1(); extern void * nlm_cancel_res_1_svc(); #define NLM_UNLOCK_RES 14 extern void * nlm_unlock_res_1(); extern void * nlm_unlock_res_1_svc(); #define NLM_GRANTED_RES 15 extern void * nlm_granted_res_1(); extern void * nlm_granted_res_1_svc(); extern int nlm_prog_1_freeresult (); #endif /* K&R C */ #define NLM_VERSX 3 #if defined(__STDC__) || defined(__cplusplus) #define NLM_SHARE 20 extern nlm_shareres * nlm_share_3(nlm_shareargs *, CLIENT *); extern nlm_shareres * nlm_share_3_svc(nlm_shareargs *, struct svc_req *); #define NLM_UNSHARE 21 extern nlm_shareres * nlm_unshare_3(nlm_shareargs *, CLIENT *); extern nlm_shareres * nlm_unshare_3_svc(nlm_shareargs *, struct svc_req *); #define NLM_NM_LOCK 22 extern nlm_res * nlm_nm_lock_3(nlm_lockargs *, CLIENT *); extern nlm_res * nlm_nm_lock_3_svc(nlm_lockargs *, struct svc_req *); #define NLM_FREE_ALL 23 extern void * nlm_free_all_3(nlm_notify *, CLIENT *); extern void * nlm_free_all_3_svc(nlm_notify *, struct svc_req *); extern int nlm_prog_3_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define NLM_SHARE 20 extern nlm_shareres * nlm_share_3(); extern nlm_shareres * nlm_share_3_svc(); #define NLM_UNSHARE 21 extern nlm_shareres * nlm_unshare_3(); extern nlm_shareres * nlm_unshare_3_svc(); #define NLM_NM_LOCK 22 extern nlm_res * nlm_nm_lock_3(); extern nlm_res * nlm_nm_lock_3_svc(); #define NLM_FREE_ALL 23 extern void * nlm_free_all_3(); extern void * nlm_free_all_3_svc(); extern int nlm_prog_3_freeresult (); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_nlm_stats (XDR *, nlm_stats*); extern bool_t xdr_nlm_holder (XDR *, nlm_holder*); extern bool_t xdr_nlm_testrply (XDR *, nlm_testrply*); extern bool_t xdr_nlm_stat (XDR *, nlm_stat*); extern bool_t xdr_nlm_res (XDR *, nlm_res*); extern bool_t xdr_nlm_testres (XDR *, nlm_testres*); extern bool_t xdr_nlm_lock (XDR *, nlm_lock*); extern bool_t xdr_nlm_lockargs (XDR *, nlm_lockargs*); extern bool_t xdr_nlm_cancargs (XDR *, nlm_cancargs*); extern bool_t xdr_nlm_testargs (XDR *, nlm_testargs*); extern bool_t xdr_nlm_unlockargs (XDR *, nlm_unlockargs*); extern bool_t xdr_fsh_mode (XDR *, fsh_mode*); extern bool_t xdr_fsh_access (XDR *, fsh_access*); extern bool_t xdr_nlm_share (XDR *, nlm_share*); extern bool_t xdr_nlm_shareargs (XDR *, nlm_shareargs*); extern bool_t xdr_nlm_shareres (XDR *, nlm_shareres*); extern bool_t xdr_nlm_notify (XDR *, nlm_notify*); #else /* K&R C */ extern bool_t xdr_nlm_stats (); extern bool_t xdr_nlm_holder (); extern bool_t xdr_nlm_testrply (); extern bool_t xdr_nlm_stat (); extern bool_t xdr_nlm_res (); extern bool_t xdr_nlm_testres (); extern bool_t xdr_nlm_lock (); extern bool_t xdr_nlm_lockargs (); extern bool_t xdr_nlm_cancargs (); extern bool_t xdr_nlm_testargs (); extern bool_t xdr_nlm_unlockargs (); extern bool_t xdr_fsh_mode (); extern bool_t xdr_fsh_access (); extern bool_t xdr_nlm_share (); extern bool_t xdr_nlm_shareargs (); extern bool_t xdr_nlm_shareres (); extern bool_t xdr_nlm_notify (); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_NLM_PROT_H_RPCGEN */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/mount.x��������������������������������������������������������������������������������������0000644�����������������00000011071�14763166026�0007412 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)mount.x 2.1 88/08/01 4.0 RPCSRC */ /* * Copyright (c) 2010, Oracle America, Inc. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Protocol description for the mount program */ const MNTPATHLEN = 1024; /* maximum bytes in a pathname argument */ const MNTNAMLEN = 255; /* maximum bytes in a name argument */ const FHSIZE = 32; /* size in bytes of a file handle */ /* * The fhandle is the file handle that the server passes to the client. * All file operations are done using the file handles to refer to a file * or a directory. The file handle can contain whatever information the * server needs to distinguish an individual file. */ typedef opaque fhandle[FHSIZE]; /* * If a status of zero is returned, the call completed successfully, and * a file handle for the directory follows. A non-zero status indicates * some sort of error. The status corresponds with UNIX error numbers. */ union fhstatus switch (unsigned fhs_status) { case 0: fhandle fhs_fhandle; default: void; }; /* * The type dirpath is the pathname of a directory */ typedef string dirpath<MNTPATHLEN>; /* * The type name is used for arbitrary names (hostnames, groupnames) */ typedef string name<MNTNAMLEN>; /* * A list of who has what mounted */ typedef struct mountbody *mountlist; struct mountbody { name ml_hostname; dirpath ml_directory; mountlist ml_next; }; /* * A list of netgroups */ typedef struct groupnode *groups; struct groupnode { name gr_name; groups gr_next; }; /* * A list of what is exported and to whom */ typedef struct exportnode *exports; struct exportnode { dirpath ex_dir; groups ex_groups; exports ex_next; }; program MOUNTPROG { /* * Version one of the mount protocol communicates with version two * of the NFS protocol. The only connecting point is the fhandle * structure, which is the same for both protocols. */ version MOUNTVERS { /* * Does no work. It is made available in all RPC services * to allow server response testing and timing */ void MOUNTPROC_NULL(void) = 0; /* * If fhs_status is 0, then fhs_fhandle contains the * file handle for the directory. This file handle may * be used in the NFS protocol. This procedure also adds * a new entry to the mount list for this client mounting * the directory. * Unix authentication required. */ fhstatus MOUNTPROC_MNT(dirpath) = 1; /* * Returns the list of remotely mounted filesystems. The * mountlist contains one entry for each hostname and * directory pair. */ mountlist MOUNTPROC_DUMP(void) = 2; /* * Removes the mount list entry for the directory * Unix authentication required. */ void MOUNTPROC_UMNT(dirpath) = 3; /* * Removes all of the mount list entries for this client * Unix authentication required. */ void MOUNTPROC_UMNTALL(void) = 4; /* * Returns a list of all the exported filesystems, and which * machines are allowed to import it. */ exports MOUNTPROC_EXPORT(void) = 5; /* * Identical to MOUNTPROC_EXPORT above */ exports MOUNTPROC_EXPORTALL(void) = 6; } = 1; } = 100005; �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/rex.x����������������������������������������������������������������������������������������0000644�����������������00000016376�14763166026�0007063 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)rex.x 2.1 88/08/01 4.0 RPCSRC */ /* * Copyright (c) 2010, Oracle America, Inc. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Remote execution (rex) protocol specification */ const STRINGSIZE = 1024; typedef string rexstring<1024>; /* * values to pass to REXPROC_SIGNAL */ const SIGINT = 2; /* interrupt */ /* * Values for rst_flags, below */ const REX_INTERACTIVE = 1; /* interactive mode */ struct rex_start { rexstring rst_cmd<>; /* list of command and args */ rexstring rst_host; /* working directory host name */ rexstring rst_fsname; /* working directory file system name */ rexstring rst_dirwithin;/* working directory within file system */ rexstring rst_env<>; /* list of environment */ unsigned int rst_port0; /* port for stdin */ unsigned int rst_port1; /* port for stdout */ unsigned int rst_port2; /* port for stderr */ unsigned int rst_flags; /* options - see const above */ }; struct rex_result { int rlt_stat; /* integer status code */ rexstring rlt_message; /* string message for human consumption */ }; struct sgttyb { unsigned four; /* always equals 4 */ opaque chars[4]; /* chars[0] == input speed */ /* chars[1] == output speed */ /* chars[2] == kill character */ /* chars[3] == erase character */ unsigned flags; }; /* values for speeds above (baud rates) */ const B0 = 0; const B50 = 1; const B75 = 2; const B110 = 3; const B134 = 4; const B150 = 5; const B200 = 6; const B300 = 7; const B600 = 8; const B1200 = 9; const B1800 = 10; const B2400 = 11; const B4800 = 12; const B9600 = 13; const B19200 = 14; const B38400 = 15; /* values for flags above */ const TANDEM = 0x00000001; /* send stopc on out q full */ const CBREAK = 0x00000002; /* half-cooked mode */ const LCASE = 0x00000004; /* simulate lower case */ const ECHO = 0x00000008; /* echo input */ const CRMOD = 0x00000010; /* map \r to \r\n on output */ const RAW = 0x00000020; /* no i/o processing */ const ODDP = 0x00000040; /* get/send odd parity */ const EVENP = 0x00000080; /* get/send even parity */ const ANYP = 0x000000c0; /* get any parity/send none */ const NLDELAY = 0x00000300; /* \n delay */ const NL0 = 0x00000000; const NL1 = 0x00000100; /* tty 37 */ const NL2 = 0x00000200; /* vt05 */ const NL3 = 0x00000300; const TBDELAY = 0x00000c00; /* horizontal tab delay */ const TAB0 = 0x00000000; const TAB1 = 0x00000400; /* tty 37 */ const TAB2 = 0x00000800; const XTABS = 0x00000c00; /* expand tabs on output */ const CRDELAY = 0x00003000; /* \r delay */ const CR0 = 0x00000000; const CR1 = 0x00001000; /* tn 300 */ const CR2 = 0x00002000; /* tty 37 */ const CR3 = 0x00003000; /* concept 100 */ const VTDELAY = 0x00004000; /* vertical tab delay */ const FF0 = 0x00000000; const FF1 = 0x00004000; /* tty 37 */ const BSDELAY = 0x00008000; /* \b delay */ const BS0 = 0x00000000; const BS1 = 0x00008000; const CRTBS = 0x00010000; /* do backspacing for crt */ const PRTERA = 0x00020000; /* \ ... / erase */ const CRTERA = 0x00040000; /* " \b " to wipe out char */ const TILDE = 0x00080000; /* hazeltine tilde kludge */ const MDMBUF = 0x00100000; /* start/stop output on carrier intr */ const LITOUT = 0x00200000; /* literal output */ const TOSTOP = 0x00400000; /* SIGTTOU on background output */ const FLUSHO = 0x00800000; /* flush output to terminal */ const NOHANG = 0x01000000; /* no SIGHUP on carrier drop */ const L001000 = 0x02000000; const CRTKIL = 0x04000000; /* kill line with " \b " */ const PASS8 = 0x08000000; const CTLECH = 0x10000000; /* echo control chars as ^X */ const PENDIN = 0x20000000; /* tp->t_rawq needs reread */ const DECCTQ = 0x40000000; /* only ^Q starts after ^S */ const NOFLSH = 0x80000000; /* no output flush on signal */ struct tchars { unsigned six; /* always equals 6 */ opaque chars[6]; /* chars[0] == interrupt char */ /* chars[1] == quit char */ /* chars[2] == start output char */ /* chars[3] == stop output char */ /* chars[4] == end-of-file char */ /* chars[5] == input delimiter (like nl) */ }; struct ltchars { unsigned six; /* always equals 6 */ opaque chars[6]; /* chars[0] == stop process signal */ /* chars[1] == delayed stop process signal */ /* chars[2] == reprint line */ /* chars[3] == flush output */ /* chars[4] == word erase */ /* chars[5] == literal next character */ unsigned mode; }; struct rex_ttysize { int ts_lines; int ts_cols; }; struct rex_ttymode { sgttyb basic; /* standard unix tty flags */ tchars more; /* interrupt, kill characters, etc. */ ltchars yetmore; /* special Berkeley characters */ unsigned andmore; /* and Berkeley modes */ }; /* values for andmore above */ const LCRTBS = 0x0001; /* do backspacing for crt */ const LPRTERA = 0x0002; /* \ ... / erase */ const LCRTERA = 0x0004; /* " \b " to wipe out char */ const LTILDE = 0x0008; /* hazeltine tilde kludge */ const LMDMBUF = 0x0010; /* start/stop output on carrier intr */ const LLITOUT = 0x0020; /* literal output */ const LTOSTOP = 0x0040; /* SIGTTOU on background output */ const LFLUSHO = 0x0080; /* flush output to terminal */ const LNOHANG = 0x0100; /* no SIGHUP on carrier drop */ const LL001000 = 0x0200; const LCRTKIL = 0x0400; /* kill line with " \b " */ const LPASS8 = 0x0800; const LCTLECH = 0x1000; /* echo control chars as ^X */ const LPENDIN = 0x2000; /* needs reread */ const LDECCTQ = 0x4000; /* only ^Q starts after ^S */ const LNOFLSH = 0x8000; /* no output flush on signal */ program REXPROG { version REXVERS { /* * Start remote execution */ rex_result REXPROC_START(rex_start) = 1; /* * Wait for remote execution to terminate */ rex_result REXPROC_WAIT(void) = 2; /* * Send tty modes */ void REXPROC_MODES(rex_ttymode) = 3; /* * Send window size change */ void REXPROC_WINCH(rex_ttysize) = 4; /* * Send other signal */ void REXPROC_SIGNAL(int) = 5; } = 1; } = 100017; ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/nfs_prot.h�����������������������������������������������������������������������������������0000644�����������������00000026270�14763166026�0010071 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _NFS_PROT_H_RPCGEN #define _NFS_PROT_H_RPCGEN #include <rpc/rpc.h> #ifdef __cplusplus extern "C" { #endif #define NFS_PORT 2049 #define NFS_MAXDATA 8192 #define NFS_MAXPATHLEN 1024 #define NFS_MAXNAMLEN 255 #define NFS_FHSIZE 32 #define NFS_COOKIESIZE 4 #define NFS_FIFO_DEV -1 #define NFSMODE_FMT 0170000 #define NFSMODE_DIR 0040000 #define NFSMODE_CHR 0020000 #define NFSMODE_BLK 0060000 #define NFSMODE_REG 0100000 #define NFSMODE_LNK 0120000 #define NFSMODE_SOCK 0140000 #define NFSMODE_FIFO 0010000 enum nfsstat { NFS_OK = 0, NFSERR_PERM = 1, NFSERR_NOENT = 2, NFSERR_IO = 5, NFSERR_NXIO = 6, NFSERR_ACCES = 13, NFSERR_EXIST = 17, NFSERR_NODEV = 19, NFSERR_NOTDIR = 20, NFSERR_ISDIR = 21, NFSERR_FBIG = 27, NFSERR_NOSPC = 28, NFSERR_ROFS = 30, NFSERR_NAMETOOLONG = 63, NFSERR_NOTEMPTY = 66, NFSERR_DQUOT = 69, NFSERR_STALE = 70, NFSERR_WFLUSH = 99, }; typedef enum nfsstat nfsstat; enum ftype { NFNON = 0, NFREG = 1, NFDIR = 2, NFBLK = 3, NFCHR = 4, NFLNK = 5, NFSOCK = 6, NFBAD = 7, NFFIFO = 8, }; typedef enum ftype ftype; struct nfs_fh { char data[NFS_FHSIZE]; }; typedef struct nfs_fh nfs_fh; struct nfstime { u_int seconds; u_int useconds; }; typedef struct nfstime nfstime; struct fattr { ftype type; u_int mode; u_int nlink; u_int uid; u_int gid; u_int size; u_int blocksize; u_int rdev; u_int blocks; u_int fsid; u_int fileid; nfstime atime; nfstime mtime; nfstime ctime; }; typedef struct fattr fattr; struct sattr { u_int mode; u_int uid; u_int gid; u_int size; nfstime atime; nfstime mtime; }; typedef struct sattr sattr; typedef char *filename; typedef char *nfspath; struct attrstat { nfsstat status; union { fattr attributes; } attrstat_u; }; typedef struct attrstat attrstat; struct sattrargs { nfs_fh file; sattr attributes; }; typedef struct sattrargs sattrargs; struct diropargs { nfs_fh dir; filename name; }; typedef struct diropargs diropargs; struct diropokres { nfs_fh file; fattr attributes; }; typedef struct diropokres diropokres; struct diropres { nfsstat status; union { diropokres diropres; } diropres_u; }; typedef struct diropres diropres; struct readlinkres { nfsstat status; union { nfspath data; } readlinkres_u; }; typedef struct readlinkres readlinkres; struct readargs { nfs_fh file; u_int offset; u_int count; u_int totalcount; }; typedef struct readargs readargs; struct readokres { fattr attributes; struct { u_int data_len; char *data_val; } data; }; typedef struct readokres readokres; struct readres { nfsstat status; union { readokres reply; } readres_u; }; typedef struct readres readres; struct writeargs { nfs_fh file; u_int beginoffset; u_int offset; u_int totalcount; struct { u_int data_len; char *data_val; } data; }; typedef struct writeargs writeargs; struct createargs { diropargs where; sattr attributes; }; typedef struct createargs createargs; struct renameargs { diropargs from; diropargs to; }; typedef struct renameargs renameargs; struct linkargs { nfs_fh from; diropargs to; }; typedef struct linkargs linkargs; struct symlinkargs { diropargs from; nfspath to; sattr attributes; }; typedef struct symlinkargs symlinkargs; typedef char nfscookie[NFS_COOKIESIZE]; struct readdirargs { nfs_fh dir; nfscookie cookie; u_int count; }; typedef struct readdirargs readdirargs; struct entry { u_int fileid; filename name; nfscookie cookie; struct entry *nextentry; }; typedef struct entry entry; struct dirlist { entry *entries; bool_t eof; }; typedef struct dirlist dirlist; struct readdirres { nfsstat status; union { dirlist reply; } readdirres_u; }; typedef struct readdirres readdirres; struct statfsokres { u_int tsize; u_int bsize; u_int blocks; u_int bfree; u_int bavail; }; typedef struct statfsokres statfsokres; struct statfsres { nfsstat status; union { statfsokres reply; } statfsres_u; }; typedef struct statfsres statfsres; #define NFS_PROGRAM 100003 #define NFS_VERSION 2 #if defined(__STDC__) || defined(__cplusplus) #define NFSPROC_NULL 0 extern void * nfsproc_null_2(void *, CLIENT *); extern void * nfsproc_null_2_svc(void *, struct svc_req *); #define NFSPROC_GETATTR 1 extern attrstat * nfsproc_getattr_2(nfs_fh *, CLIENT *); extern attrstat * nfsproc_getattr_2_svc(nfs_fh *, struct svc_req *); #define NFSPROC_SETATTR 2 extern attrstat * nfsproc_setattr_2(sattrargs *, CLIENT *); extern attrstat * nfsproc_setattr_2_svc(sattrargs *, struct svc_req *); #define NFSPROC_ROOT 3 extern void * nfsproc_root_2(void *, CLIENT *); extern void * nfsproc_root_2_svc(void *, struct svc_req *); #define NFSPROC_LOOKUP 4 extern diropres * nfsproc_lookup_2(diropargs *, CLIENT *); extern diropres * nfsproc_lookup_2_svc(diropargs *, struct svc_req *); #define NFSPROC_READLINK 5 extern readlinkres * nfsproc_readlink_2(nfs_fh *, CLIENT *); extern readlinkres * nfsproc_readlink_2_svc(nfs_fh *, struct svc_req *); #define NFSPROC_READ 6 extern readres * nfsproc_read_2(readargs *, CLIENT *); extern readres * nfsproc_read_2_svc(readargs *, struct svc_req *); #define NFSPROC_WRITECACHE 7 extern void * nfsproc_writecache_2(void *, CLIENT *); extern void * nfsproc_writecache_2_svc(void *, struct svc_req *); #define NFSPROC_WRITE 8 extern attrstat * nfsproc_write_2(writeargs *, CLIENT *); extern attrstat * nfsproc_write_2_svc(writeargs *, struct svc_req *); #define NFSPROC_CREATE 9 extern diropres * nfsproc_create_2(createargs *, CLIENT *); extern diropres * nfsproc_create_2_svc(createargs *, struct svc_req *); #define NFSPROC_REMOVE 10 extern nfsstat * nfsproc_remove_2(diropargs *, CLIENT *); extern nfsstat * nfsproc_remove_2_svc(diropargs *, struct svc_req *); #define NFSPROC_RENAME 11 extern nfsstat * nfsproc_rename_2(renameargs *, CLIENT *); extern nfsstat * nfsproc_rename_2_svc(renameargs *, struct svc_req *); #define NFSPROC_LINK 12 extern nfsstat * nfsproc_link_2(linkargs *, CLIENT *); extern nfsstat * nfsproc_link_2_svc(linkargs *, struct svc_req *); #define NFSPROC_SYMLINK 13 extern nfsstat * nfsproc_symlink_2(symlinkargs *, CLIENT *); extern nfsstat * nfsproc_symlink_2_svc(symlinkargs *, struct svc_req *); #define NFSPROC_MKDIR 14 extern diropres * nfsproc_mkdir_2(createargs *, CLIENT *); extern diropres * nfsproc_mkdir_2_svc(createargs *, struct svc_req *); #define NFSPROC_RMDIR 15 extern nfsstat * nfsproc_rmdir_2(diropargs *, CLIENT *); extern nfsstat * nfsproc_rmdir_2_svc(diropargs *, struct svc_req *); #define NFSPROC_READDIR 16 extern readdirres * nfsproc_readdir_2(readdirargs *, CLIENT *); extern readdirres * nfsproc_readdir_2_svc(readdirargs *, struct svc_req *); #define NFSPROC_STATFS 17 extern statfsres * nfsproc_statfs_2(nfs_fh *, CLIENT *); extern statfsres * nfsproc_statfs_2_svc(nfs_fh *, struct svc_req *); extern int nfs_program_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define NFSPROC_NULL 0 extern void * nfsproc_null_2(); extern void * nfsproc_null_2_svc(); #define NFSPROC_GETATTR 1 extern attrstat * nfsproc_getattr_2(); extern attrstat * nfsproc_getattr_2_svc(); #define NFSPROC_SETATTR 2 extern attrstat * nfsproc_setattr_2(); extern attrstat * nfsproc_setattr_2_svc(); #define NFSPROC_ROOT 3 extern void * nfsproc_root_2(); extern void * nfsproc_root_2_svc(); #define NFSPROC_LOOKUP 4 extern diropres * nfsproc_lookup_2(); extern diropres * nfsproc_lookup_2_svc(); #define NFSPROC_READLINK 5 extern readlinkres * nfsproc_readlink_2(); extern readlinkres * nfsproc_readlink_2_svc(); #define NFSPROC_READ 6 extern readres * nfsproc_read_2(); extern readres * nfsproc_read_2_svc(); #define NFSPROC_WRITECACHE 7 extern void * nfsproc_writecache_2(); extern void * nfsproc_writecache_2_svc(); #define NFSPROC_WRITE 8 extern attrstat * nfsproc_write_2(); extern attrstat * nfsproc_write_2_svc(); #define NFSPROC_CREATE 9 extern diropres * nfsproc_create_2(); extern diropres * nfsproc_create_2_svc(); #define NFSPROC_REMOVE 10 extern nfsstat * nfsproc_remove_2(); extern nfsstat * nfsproc_remove_2_svc(); #define NFSPROC_RENAME 11 extern nfsstat * nfsproc_rename_2(); extern nfsstat * nfsproc_rename_2_svc(); #define NFSPROC_LINK 12 extern nfsstat * nfsproc_link_2(); extern nfsstat * nfsproc_link_2_svc(); #define NFSPROC_SYMLINK 13 extern nfsstat * nfsproc_symlink_2(); extern nfsstat * nfsproc_symlink_2_svc(); #define NFSPROC_MKDIR 14 extern diropres * nfsproc_mkdir_2(); extern diropres * nfsproc_mkdir_2_svc(); #define NFSPROC_RMDIR 15 extern nfsstat * nfsproc_rmdir_2(); extern nfsstat * nfsproc_rmdir_2_svc(); #define NFSPROC_READDIR 16 extern readdirres * nfsproc_readdir_2(); extern readdirres * nfsproc_readdir_2_svc(); #define NFSPROC_STATFS 17 extern statfsres * nfsproc_statfs_2(); extern statfsres * nfsproc_statfs_2_svc(); extern int nfs_program_2_freeresult (); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_nfsstat (XDR *, nfsstat*); extern bool_t xdr_ftype (XDR *, ftype*); extern bool_t xdr_nfs_fh (XDR *, nfs_fh*); extern bool_t xdr_nfstime (XDR *, nfstime*); extern bool_t xdr_fattr (XDR *, fattr*); extern bool_t xdr_sattr (XDR *, sattr*); extern bool_t xdr_filename (XDR *, filename*); extern bool_t xdr_nfspath (XDR *, nfspath*); extern bool_t xdr_attrstat (XDR *, attrstat*); extern bool_t xdr_sattrargs (XDR *, sattrargs*); extern bool_t xdr_diropargs (XDR *, diropargs*); extern bool_t xdr_diropokres (XDR *, diropokres*); extern bool_t xdr_diropres (XDR *, diropres*); extern bool_t xdr_readlinkres (XDR *, readlinkres*); extern bool_t xdr_readargs (XDR *, readargs*); extern bool_t xdr_readokres (XDR *, readokres*); extern bool_t xdr_readres (XDR *, readres*); extern bool_t xdr_writeargs (XDR *, writeargs*); extern bool_t xdr_createargs (XDR *, createargs*); extern bool_t xdr_renameargs (XDR *, renameargs*); extern bool_t xdr_linkargs (XDR *, linkargs*); extern bool_t xdr_symlinkargs (XDR *, symlinkargs*); extern bool_t xdr_nfscookie (XDR *, nfscookie); extern bool_t xdr_readdirargs (XDR *, readdirargs*); extern bool_t xdr_entry (XDR *, entry*); extern bool_t xdr_dirlist (XDR *, dirlist*); extern bool_t xdr_readdirres (XDR *, readdirres*); extern bool_t xdr_statfsokres (XDR *, statfsokres*); extern bool_t xdr_statfsres (XDR *, statfsres*); #else /* K&R C */ extern bool_t xdr_nfsstat (); extern bool_t xdr_ftype (); extern bool_t xdr_nfs_fh (); extern bool_t xdr_nfstime (); extern bool_t xdr_fattr (); extern bool_t xdr_sattr (); extern bool_t xdr_filename (); extern bool_t xdr_nfspath (); extern bool_t xdr_attrstat (); extern bool_t xdr_sattrargs (); extern bool_t xdr_diropargs (); extern bool_t xdr_diropokres (); extern bool_t xdr_diropres (); extern bool_t xdr_readlinkres (); extern bool_t xdr_readargs (); extern bool_t xdr_readokres (); extern bool_t xdr_readres (); extern bool_t xdr_writeargs (); extern bool_t xdr_createargs (); extern bool_t xdr_renameargs (); extern bool_t xdr_linkargs (); extern bool_t xdr_symlinkargs (); extern bool_t xdr_nfscookie (); extern bool_t xdr_readdirargs (); extern bool_t xdr_entry (); extern bool_t xdr_dirlist (); extern bool_t xdr_readdirres (); extern bool_t xdr_statfsokres (); extern bool_t xdr_statfsres (); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_NFS_PROT_H_RPCGEN */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/rquota.x�������������������������������������������������������������������������������������0000644�����������������00000006616�14763166026�0007574 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)rquota.x 2.1 88/08/01 4.0 RPCSRC */ /* @(#)rquota.x 1.2 87/09/20 Copyr 1987 Sun Micro */ /* * Remote quota protocol * Requires unix authentication */ const RQ_PATHLEN = 1024; struct sq_dqblk { unsigned int rq_bhardlimit; /* absolute limit on disk blks alloc */ unsigned int rq_bsoftlimit; /* preferred limit on disk blks */ unsigned int rq_curblocks; /* current block count */ unsigned int rq_fhardlimit; /* absolute limit on allocated files */ unsigned int rq_fsoftlimit; /* preferred file limit */ unsigned int rq_curfiles; /* current # allocated files */ unsigned int rq_btimeleft; /* time left for excessive disk use */ unsigned int rq_ftimeleft; /* time left for excessive files */ }; struct getquota_args { string gqa_pathp<RQ_PATHLEN>; /* path to filesystem of interest */ int gqa_uid; /* Inquire about quota for uid */ }; struct setquota_args { int sqa_qcmd; string sqa_pathp<RQ_PATHLEN>; /* path to filesystem of interest */ int sqa_id; /* Set quota for uid */ sq_dqblk sqa_dqblk; }; struct ext_getquota_args { string gqa_pathp<RQ_PATHLEN>; /* path to filesystem of interest */ int gqa_type; /* Type of quota info is needed about */ int gqa_id; /* Inquire about quota for id */ }; struct ext_setquota_args { int sqa_qcmd; string sqa_pathp<RQ_PATHLEN>; /* path to filesystem of interest */ int sqa_id; /* Set quota for id */ int sqa_type; /* Type of quota to set */ sq_dqblk sqa_dqblk; }; /* * remote quota structure */ struct rquota { int rq_bsize; /* block size for block counts */ bool rq_active; /* indicates whether quota is active */ unsigned int rq_bhardlimit; /* absolute limit on disk blks alloc */ unsigned int rq_bsoftlimit; /* preferred limit on disk blks */ unsigned int rq_curblocks; /* current block count */ unsigned int rq_fhardlimit; /* absolute limit on allocated files */ unsigned int rq_fsoftlimit; /* preferred file limit */ unsigned int rq_curfiles; /* current # allocated files */ unsigned int rq_btimeleft; /* time left for excessive disk use */ unsigned int rq_ftimeleft; /* time left for excessive files */ }; enum qr_status { Q_OK = 1, /* quota returned */ Q_NOQUOTA = 2, /* noquota for uid */ Q_EPERM = 3 /* no permission to access quota */ }; union getquota_rslt switch (qr_status status) { case Q_OK: rquota gqr_rquota; /* valid if status == Q_OK */ case Q_NOQUOTA: void; case Q_EPERM: void; }; union setquota_rslt switch (qr_status status) { case Q_OK: rquota sqr_rquota; /* valid if status == Q_OK */ case Q_NOQUOTA: void; case Q_EPERM: void; }; program RQUOTAPROG { version RQUOTAVERS { /* * Get all quotas */ getquota_rslt RQUOTAPROC_GETQUOTA(getquota_args) = 1; /* * Get active quotas only */ getquota_rslt RQUOTAPROC_GETACTIVEQUOTA(getquota_args) = 2; /* * Set all quotas */ setquota_rslt RQUOTAPROC_SETQUOTA(setquota_args) = 3; /* * Get active quotas only */ setquota_rslt RQUOTAPROC_SETACTIVEQUOTA(setquota_args) = 4; } = 1; version EXT_RQUOTAVERS { /* * Get all quotas */ getquota_rslt RQUOTAPROC_GETQUOTA(ext_getquota_args) = 1; /* * Get active quotas only */ getquota_rslt RQUOTAPROC_GETACTIVEQUOTA(ext_getquota_args) = 2; /* * Set all quotas */ setquota_rslt RQUOTAPROC_SETQUOTA(ext_setquota_args) = 3; /* * Set active quotas only */ setquota_rslt RQUOTAPROC_SETACTIVEQUOTA(ext_setquota_args) = 4; } = 2; } = 100011; ������������������������������������������������������������������������������������������������������������������rpcsvc/ypupd.h��������������������������������������������������������������������������������������0000644�����������������00000005677�14763166026�0007410 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* from @(#)ypupdate_prot.x 1.3 91/03/11 TIRPC 1.0 */ #ifndef __RPCSVC_YPUPD_H__ #define __RPCSVC_YPUPD_H__ #include <features.h> #include <rpc/rpc.h> #define MAXMAPNAMELEN 255 #define MAXYPDATALEN 1023 #define MAXERRMSGLEN 255 __BEGIN_DECLS typedef struct { u_int yp_buf_len; char *yp_buf_val; } yp_buf; extern bool_t xdr_yp_buf (XDR *, yp_buf*); struct ypupdate_args { char *mapname; yp_buf key; yp_buf datum; }; typedef struct ypupdate_args ypupdate_args; extern bool_t xdr_ypupdate_args (XDR *, ypupdate_args*); struct ypdelete_args { char *mapname; yp_buf key; }; typedef struct ypdelete_args ypdelete_args; extern bool_t xdr_ypdelete_args (XDR *, ypdelete_args*); #define YPU_PROG 100028 #define YPU_VERS 1 #define YPU_CHANGE 1 extern u_int * ypu_change_1 (ypupdate_args *, CLIENT *); extern u_int * ypu_change_1_svc (ypupdate_args *, struct svc_req *); #define YPU_INSERT 2 extern u_int * ypu_insert_1 (ypupdate_args *, CLIENT *); extern u_int * ypu_insert_1_svc (ypupdate_args *, struct svc_req *); #define YPU_DELETE 3 extern u_int * ypu_delete_1 (ypdelete_args *, CLIENT *); extern u_int * ypu_delete_1_svc (ypdelete_args *, struct svc_req *); #define YPU_STORE 4 extern u_int * ypu_store_1 (ypupdate_args *, CLIENT *); extern u_int * ypu_store_1_svc (ypupdate_args *, struct svc_req *); __END_DECLS #endif /* !__RPCSVC_YPUPD_H__ */ �����������������������������������������������������������������rpcsvc/rstat.x��������������������������������������������������������������������������������������0000644�����������������00000007641�14763166026�0007415 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)rstat.x 2.2 88/08/01 4.0 RPCSRC */ /* * Copyright (c) 2010, Oracle America, Inc. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Gather statistics on remote machines */ #ifdef RPC_HDR %#ifndef FSCALE %/* % * Scale factor for scaled integers used to count load averages. % */ %#define FSHIFT 8 /* bits to right of fixed binary point */ %#define FSCALE (1<<FSHIFT) % %#endif /* ndef FSCALE */ #endif /* def RPC_HDR */ const CPUSTATES = 4; const DK_NDRIVE = 4; /* * GMT since 0:00, January 1, 1970 */ struct rstat_timeval { unsigned int tv_sec; /* seconds */ unsigned int tv_usec; /* and microseconds */ }; struct statstime { /* RSTATVERS_TIME */ int cp_time[CPUSTATES]; int dk_xfer[DK_NDRIVE]; unsigned int v_pgpgin; /* these are cumulative sum */ unsigned int v_pgpgout; unsigned int v_pswpin; unsigned int v_pswpout; unsigned int v_intr; int if_ipackets; int if_ierrors; int if_oerrors; int if_collisions; unsigned int v_swtch; int avenrun[3]; /* scaled by FSCALE */ rstat_timeval boottime; rstat_timeval curtime; int if_opackets; }; struct statsswtch { /* RSTATVERS_SWTCH */ int cp_time[CPUSTATES]; int dk_xfer[DK_NDRIVE]; unsigned int v_pgpgin; /* these are cumulative sum */ unsigned int v_pgpgout; unsigned int v_pswpin; unsigned int v_pswpout; unsigned int v_intr; int if_ipackets; int if_ierrors; int if_oerrors; int if_collisions; unsigned int v_swtch; unsigned int avenrun[3];/* scaled by FSCALE */ rstat_timeval boottime; int if_opackets; }; struct stats { /* RSTATVERS_ORIG */ int cp_time[CPUSTATES]; int dk_xfer[DK_NDRIVE]; unsigned int v_pgpgin; /* these are cumulative sum */ unsigned int v_pgpgout; unsigned int v_pswpin; unsigned int v_pswpout; unsigned int v_intr; int if_ipackets; int if_ierrors; int if_oerrors; int if_collisions; int if_opackets; }; program RSTATPROG { /* * Newest version includes current time and context switching info */ version RSTATVERS_TIME { statstime RSTATPROC_STATS(void) = 1; unsigned int RSTATPROC_HAVEDISK(void) = 2; } = 3; /* * Does not have current time */ version RSTATVERS_SWTCH { statsswtch RSTATPROC_STATS(void) = 1; unsigned int RSTATPROC_HAVEDISK(void) = 2; } = 2; /* * Old version has no info about current time or context switching */ version RSTATVERS_ORIG { stats RSTATPROC_STATS(void) = 1; unsigned int RSTATPROC_HAVEDISK(void) = 2; } = 1; } = 100001; �����������������������������������������������������������������������������������������������rpcsvc/ypclnt.h�������������������������������������������������������������������������������������0000644�����������������00000007017�14763166026�0007546 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996, 1997, 1998, 1999, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __RPCSVC_YPCLNT_H__ #define __RPCSVC_YPCLNT_H__ #include <features.h> /* Some defines */ #define YPERR_SUCCESS 0 /* There is no error */ #define YPERR_BADARGS 1 /* Args to function are bad */ #define YPERR_RPC 2 /* RPC failure */ #define YPERR_DOMAIN 3 /* Can't bind to a server with this domain */ #define YPERR_MAP 4 /* No such map in server's domain */ #define YPERR_KEY 5 /* No such key in map */ #define YPERR_YPERR 6 /* Internal yp server or client error */ #define YPERR_RESRC 7 /* Local resource allocation failure */ #define YPERR_NOMORE 8 /* No more records in map database */ #define YPERR_PMAP 9 /* Can't communicate with portmapper */ #define YPERR_YPBIND 10 /* Can't communicate with ypbind */ #define YPERR_YPSERV 11 /* Can't communicate with ypserv */ #define YPERR_NODOM 12 /* Local domain name not set */ #define YPERR_BADDB 13 /* yp data base is bad */ #define YPERR_VERS 14 /* YP version mismatch */ #define YPERR_ACCESS 15 /* Access violation */ #define YPERR_BUSY 16 /* Database is busy */ /* Types of update operations */ #define YPOP_CHANGE 1 /* Change, do not add */ #define YPOP_INSERT 2 /* Add, do not change */ #define YPOP_DELETE 3 /* Delete this entry */ #define YPOP_STORE 4 /* Add, or change */ __BEGIN_DECLS /* struct ypall_callback * is the arg which must be passed to yp_all. */ struct ypall_callback { int (*foreach) (int __status, char *__key, int __keylen, char *__val, int __vallen, char *__data); char *data; }; /* External NIS client function references. */ extern int yp_bind (const char *) __THROW; extern void yp_unbind (const char *) __THROW; extern int yp_get_default_domain (char **) __THROW; extern int yp_match (const char *, const char *, const char *, const int, char **, int *) __THROW; extern int yp_first (const char *, const char *, char **, int *, char **, int *) __THROW; extern int yp_next (const char *, const char *, const char *, const int, char **, int *, char **, int *) __THROW; extern int yp_master (const char *, const char *, char **) __THROW; extern int yp_order (const char *, const char *, unsigned int *) __THROW; extern int yp_all (const char *, const char *, const struct ypall_callback *) __THROW; extern const char *yperr_string (const int) __THROW; extern const char *ypbinderr_string (const int) __THROW; extern int ypprot_err (const int) __THROW; extern int yp_update (char *, char *, unsigned int, char *, int, char *, int) __THROW; #if 0 extern int yp_maplist (const char *, struct ypmaplist **) __THROW; #endif /* This functions exists only under BSD and Linux systems. */ extern int __yp_check (char **) __THROW; __END_DECLS #endif /* __RPCSVC_YPCLNT_H__ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/yp.h�����������������������������������������������������������������������������������������0000644�����������������00000023274�14763166026�0006670 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef __RPCSVC_YP_H__ #define __RPCSVC_YP_H__ #include <features.h> #include <rpc/rpc.h> #define YPMAXRECORD 1024 #define YPMAXDOMAIN 64 #define YPMAXMAP 64 #define YPMAXPEER 64 enum ypstat { YP_TRUE = 1, YP_NOMORE = 2, YP_FALSE = 0, YP_NOMAP = -1, YP_NODOM = -2, YP_NOKEY = -3, YP_BADOP = -4, YP_BADDB = -5, YP_YPERR = -6, YP_BADARGS = -7, YP_VERS = -8, }; typedef enum ypstat ypstat; enum ypxfrstat { YPXFR_SUCC = 1, YPXFR_AGE = 2, YPXFR_NOMAP = -1, YPXFR_NODOM = -2, YPXFR_RSRC = -3, YPXFR_RPC = -4, YPXFR_MADDR = -5, YPXFR_YPERR = -6, YPXFR_BADARGS = -7, YPXFR_DBM = -8, YPXFR_FILE = -9, YPXFR_SKEW = -10, YPXFR_CLEAR = -11, YPXFR_FORCE = -12, YPXFR_XFRERR = -13, YPXFR_REFUSED = -14, }; typedef enum ypxfrstat ypxfrstat; typedef char *domainname; typedef char *mapname; typedef char *peername; typedef struct { u_int keydat_len; char *keydat_val; } keydat; typedef struct { u_int valdat_len; char *valdat_val; } valdat; struct ypmap_parms { domainname domain; mapname map; u_int ordernum; peername peer; }; typedef struct ypmap_parms ypmap_parms; struct ypreq_key { domainname domain; mapname map; keydat key; }; typedef struct ypreq_key ypreq_key; struct ypreq_nokey { domainname domain; mapname map; }; typedef struct ypreq_nokey ypreq_nokey; struct ypreq_xfr { ypmap_parms map_parms; u_int transid; u_int prog; u_int port; }; typedef struct ypreq_xfr ypreq_xfr; struct ypresp_val { ypstat stat; valdat val; }; typedef struct ypresp_val ypresp_val; struct ypresp_key_val { ypstat stat; #ifdef STUPID_SUN_BUG /* This is the form as distributed by Sun. But even the Sun NIS servers expect the values in the other order. So their implementation somehow must change the order internally. We don't want to follow this bad example since the user should be able to use rpcgen on this file. */ keydat key; valdat val; #else valdat val; keydat key; #endif }; typedef struct ypresp_key_val ypresp_key_val; struct ypresp_master { ypstat stat; peername peer; }; typedef struct ypresp_master ypresp_master; struct ypresp_order { ypstat stat; u_int ordernum; }; typedef struct ypresp_order ypresp_order; struct ypresp_all { bool_t more; union { ypresp_key_val val; } ypresp_all_u; }; typedef struct ypresp_all ypresp_all; struct ypresp_xfr { u_int transid; ypxfrstat xfrstat; }; typedef struct ypresp_xfr ypresp_xfr; struct ypmaplist { mapname map; struct ypmaplist *next; }; typedef struct ypmaplist ypmaplist; struct ypresp_maplist { ypstat stat; ypmaplist *maps; }; typedef struct ypresp_maplist ypresp_maplist; enum yppush_status { YPPUSH_SUCC = 1, YPPUSH_AGE = 2, YPPUSH_NOMAP = -1, YPPUSH_NODOM = -2, YPPUSH_RSRC = -3, YPPUSH_RPC = -4, YPPUSH_MADDR = -5, YPPUSH_YPERR = -6, YPPUSH_BADARGS = -7, YPPUSH_DBM = -8, YPPUSH_FILE = -9, YPPUSH_SKEW = -10, YPPUSH_CLEAR = -11, YPPUSH_FORCE = -12, YPPUSH_XFRERR = -13, YPPUSH_REFUSED = -14, }; typedef enum yppush_status yppush_status; struct yppushresp_xfr { u_int transid; yppush_status status; }; typedef struct yppushresp_xfr yppushresp_xfr; enum ypbind_resptype { YPBIND_SUCC_VAL = 1, YPBIND_FAIL_VAL = 2, }; typedef enum ypbind_resptype ypbind_resptype; struct ypbind_binding { char ypbind_binding_addr[4]; char ypbind_binding_port[2]; }; typedef struct ypbind_binding ypbind_binding; struct ypbind_resp { ypbind_resptype ypbind_status; union { u_int ypbind_error; ypbind_binding ypbind_bindinfo; } ypbind_resp_u; }; typedef struct ypbind_resp ypbind_resp; #define YPBIND_ERR_ERR 1 #define YPBIND_ERR_NOSERV 2 #define YPBIND_ERR_RESC 3 struct ypbind_setdom { domainname ypsetdom_domain; ypbind_binding ypsetdom_binding; u_int ypsetdom_vers; }; typedef struct ypbind_setdom ypbind_setdom; __BEGIN_DECLS #define YPPROG 100004 #define YPVERS 2 #define YPPROC_NULL 0 extern void *ypproc_null_2 (void *, CLIENT *); extern void *ypproc_null_2_svc (void *, struct svc_req *); #define YPPROC_DOMAIN 1 extern bool_t *ypproc_domain_2 (domainname *, CLIENT *); extern bool_t *ypproc_domain_2_svc (domainname *, struct svc_req *); #define YPPROC_DOMAIN_NONACK 2 extern bool_t *ypproc_domain_nonack_2 (domainname *, CLIENT *); extern bool_t *ypproc_domain_nonack_2_svc (domainname *, struct svc_req *); #define YPPROC_MATCH 3 extern ypresp_val *ypproc_match_2 (ypreq_key *, CLIENT *); extern ypresp_val *ypproc_match_2_svc (ypreq_key *, struct svc_req *); #define YPPROC_FIRST 4 extern ypresp_key_val *ypproc_first_2 (ypreq_key *, CLIENT *); extern ypresp_key_val *ypproc_first_2_svc (ypreq_key *, struct svc_req *); #define YPPROC_NEXT 5 extern ypresp_key_val *ypproc_next_2 (ypreq_key *, CLIENT *); extern ypresp_key_val *ypproc_next_2_svc (ypreq_key *, struct svc_req *); #define YPPROC_XFR 6 extern ypresp_xfr *ypproc_xfr_2 (ypreq_xfr *, CLIENT *); extern ypresp_xfr *ypproc_xfr_2_svc (ypreq_xfr *, struct svc_req *); #define YPPROC_CLEAR 7 extern void *ypproc_clear_2 (void *, CLIENT *); extern void *ypproc_clear_2_svc (void *, struct svc_req *); #define YPPROC_ALL 8 extern ypresp_all *ypproc_all_2 (ypreq_nokey *, CLIENT *); extern ypresp_all *ypproc_all_2_svc (ypreq_nokey *, struct svc_req *); #define YPPROC_MASTER 9 extern ypresp_master *ypproc_master_2 (ypreq_nokey *, CLIENT *); extern ypresp_master *ypproc_master_2_svc (ypreq_nokey *, struct svc_req *); #define YPPROC_ORDER 10 extern ypresp_order *ypproc_order_2 (ypreq_nokey *, CLIENT *); extern ypresp_order *ypproc_order_2_svc (ypreq_nokey *, struct svc_req *); #define YPPROC_MAPLIST 11 extern ypresp_maplist *ypproc_maplist_2 (domainname *, CLIENT *); extern ypresp_maplist *ypproc_maplist_2_svc (domainname *, struct svc_req *); extern int ypprog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #define YPPUSH_XFRRESPPROG (0x40000000) #define YPPUSH_XFRRESPVERS 1 #define YPPUSHPROC_NULL 0 extern void *yppushproc_null_1 (void *, CLIENT *); extern void *yppushproc_null_1_svc (void *, struct svc_req *); #define YPPUSHPROC_XFRRESP 1 extern void *yppushproc_xfrresp_1 (yppushresp_xfr *, CLIENT *); extern void *yppushproc_xfrresp_1_svc (yppushresp_xfr *, struct svc_req *); extern int yppush_xfrrespprog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #define YPBINDPROG 100007 #define YPBINDVERS 2 #define YPBINDPROC_NULL 0 extern void *ypbindproc_null_2 (void *, CLIENT *); extern void *ypbindproc_null_2_svc (void *, struct svc_req *); #define YPBINDPROC_DOMAIN 1 extern ypbind_resp *ypbindproc_domain_2 (domainname *, CLIENT *); extern ypbind_resp *ypbindproc_domain_2_svc (domainname *, struct svc_req *); #define YPBINDPROC_SETDOM 2 extern void *ypbindproc_setdom_2 (ypbind_setdom *, CLIENT *); extern void *ypbindproc_setdom_2_svc (ypbind_setdom *, struct svc_req *); extern int ypbindprog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t); extern bool_t xdr_ypstat (XDR *, ypstat*); extern bool_t xdr_ypxfrstat (XDR *, ypxfrstat*); extern bool_t xdr_domainname (XDR *, domainname*); extern bool_t xdr_mapname (XDR *, mapname*); extern bool_t xdr_peername (XDR *, peername*); extern bool_t xdr_keydat (XDR *, keydat*); extern bool_t xdr_valdat (XDR *, valdat*); extern bool_t xdr_ypmap_parms (XDR *, ypmap_parms*); extern bool_t xdr_ypreq_key (XDR *, ypreq_key*); extern bool_t xdr_ypreq_nokey (XDR *, ypreq_nokey*); extern bool_t xdr_ypreq_xfr (XDR *, ypreq_xfr*); extern bool_t xdr_ypresp_val (XDR *, ypresp_val*); extern bool_t xdr_ypresp_key_val (XDR *, ypresp_key_val*); extern bool_t xdr_ypresp_master (XDR *, ypresp_master*); extern bool_t xdr_ypresp_order (XDR *, ypresp_order*); extern bool_t xdr_ypresp_all (XDR *, ypresp_all*); extern bool_t xdr_ypresp_xfr (XDR *, ypresp_xfr*); extern bool_t xdr_ypmaplist (XDR *, ypmaplist*); extern bool_t xdr_ypresp_maplist (XDR *, ypresp_maplist*); extern bool_t xdr_yppush_status (XDR *, yppush_status*); extern bool_t xdr_yppushresp_xfr (XDR *, yppushresp_xfr*); extern bool_t xdr_ypbind_resptype (XDR *, ypbind_resptype*); extern bool_t xdr_ypbind_binding (XDR *, ypbind_binding*); extern bool_t xdr_ypbind_resp (XDR *, ypbind_resp*); extern bool_t xdr_ypbind_setdom (XDR *, ypbind_setdom*); __END_DECLS #endif /* !__RPCSVC_YP_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/yp.x�����������������������������������������������������������������������������������������0000644�����������������00000016036�14763166026�0006706 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)yp.x 2.1 88/08/01 4.0 RPCSRC */ /* * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Protocol description file for the Yellow Pages Service */ const YPMAXRECORD = 1024; const YPMAXDOMAIN = 64; const YPMAXMAP = 64; const YPMAXPEER = 64; enum ypstat { YP_TRUE = 1, YP_NOMORE = 2, YP_FALSE = 0, YP_NOMAP = -1, YP_NODOM = -2, YP_NOKEY = -3, YP_BADOP = -4, YP_BADDB = -5, YP_YPERR = -6, YP_BADARGS = -7, YP_VERS = -8 }; enum ypxfrstat { YPXFR_SUCC = 1, YPXFR_AGE = 2, YPXFR_NOMAP = -1, YPXFR_NODOM = -2, YPXFR_RSRC = -3, YPXFR_RPC = -4, YPXFR_MADDR = -5, YPXFR_YPERR = -6, YPXFR_BADARGS = -7, YPXFR_DBM = -8, YPXFR_FILE = -9, YPXFR_SKEW = -10, YPXFR_CLEAR = -11, YPXFR_FORCE = -12, YPXFR_XFRERR = -13, YPXFR_REFUSED = -14 }; typedef string domainname<YPMAXDOMAIN>; typedef string mapname<YPMAXMAP>; typedef string peername<YPMAXPEER>; typedef opaque keydat<YPMAXRECORD>; typedef opaque valdat<YPMAXRECORD>; struct ypmap_parms { domainname domain; mapname map; unsigned int ordernum; peername peer; }; struct ypreq_key { domainname domain; mapname map; keydat key; }; struct ypreq_nokey { domainname domain; mapname map; }; struct ypreq_xfr { ypmap_parms map_parms; unsigned int transid; unsigned int prog; unsigned int port; }; struct ypresp_val { ypstat stat; valdat val; }; struct ypresp_key_val { ypstat stat; #ifdef STUPID_SUN_BUG /* This is the form as distributed by Sun. But even the Sun NIS servers expect the values in the other order. So their implementation somehow must change the order internally. We don't want to follow this bad example since the user should be able to use rpcgen on this file. */ keydat key; valdat val; #else valdat val; keydat key; #endif }; struct ypresp_master { ypstat stat; peername peer; }; struct ypresp_order { ypstat stat; unsigned int ordernum; }; union ypresp_all switch (bool more) { case TRUE: ypresp_key_val val; case FALSE: void; }; struct ypresp_xfr { unsigned int transid; ypxfrstat xfrstat; }; struct ypmaplist { mapname map; ypmaplist *next; }; struct ypresp_maplist { ypstat stat; ypmaplist *maps; }; enum yppush_status { YPPUSH_SUCC = 1, /* Success */ YPPUSH_AGE = 2, /* Master's version not newer */ YPPUSH_NOMAP = -1, /* Can't find server for map */ YPPUSH_NODOM = -2, /* Domain not supported */ YPPUSH_RSRC = -3, /* Local resource alloc failure */ YPPUSH_RPC = -4, /* RPC failure talking to server */ YPPUSH_MADDR = -5, /* Can't get master address */ YPPUSH_YPERR = -6, /* YP server/map db error */ YPPUSH_BADARGS = -7, /* Request arguments bad */ YPPUSH_DBM = -8, /* Local dbm operation failed */ YPPUSH_FILE = -9, /* Local file I/O operation failed */ YPPUSH_SKEW = -10, /* Map version skew during transfer */ YPPUSH_CLEAR = -11, /* Can't send "Clear" req to local ypserv */ YPPUSH_FORCE = -12, /* No local order number in map use -f flag. */ YPPUSH_XFRERR = -13, /* ypxfr error */ YPPUSH_REFUSED = -14 /* Transfer request refused by ypserv */ }; struct yppushresp_xfr { unsigned transid; yppush_status status; }; /* * Response structure and overall result status codes. Success and failure * represent two separate response message types. */ enum ypbind_resptype { YPBIND_SUCC_VAL = 1, YPBIND_FAIL_VAL = 2 }; struct ypbind_binding { opaque ypbind_binding_addr[4]; /* In network order */ opaque ypbind_binding_port[2]; /* In network order */ }; union ypbind_resp switch (ypbind_resptype ypbind_status) { case YPBIND_FAIL_VAL: unsigned ypbind_error; case YPBIND_SUCC_VAL: ypbind_binding ypbind_bindinfo; }; /* Detailed failure reason codes for response field ypbind_error*/ const YPBIND_ERR_ERR = 1; /* Internal error */ const YPBIND_ERR_NOSERV = 2; /* No bound server for passed domain */ const YPBIND_ERR_RESC = 3; /* System resource allocation failure */ /* * Request data structure for ypbind "Set domain" procedure. */ struct ypbind_setdom { domainname ypsetdom_domain; ypbind_binding ypsetdom_binding; unsigned ypsetdom_vers; }; /* * YP access protocol */ program YPPROG { version YPVERS { void YPPROC_NULL(void) = 0; bool YPPROC_DOMAIN(domainname) = 1; bool YPPROC_DOMAIN_NONACK(domainname) = 2; ypresp_val YPPROC_MATCH(ypreq_key) = 3; ypresp_key_val YPPROC_FIRST(ypreq_key) = 4; ypresp_key_val YPPROC_NEXT(ypreq_key) = 5; ypresp_xfr YPPROC_XFR(ypreq_xfr) = 6; void YPPROC_CLEAR(void) = 7; ypresp_all YPPROC_ALL(ypreq_nokey) = 8; ypresp_master YPPROC_MASTER(ypreq_nokey) = 9; ypresp_order YPPROC_ORDER(ypreq_nokey) = 10; ypresp_maplist YPPROC_MAPLIST(domainname) = 11; } = 2; } = 100004; /* * YPPUSHPROC_XFRRESP is the callback routine for result of YPPROC_XFR */ program YPPUSH_XFRRESPPROG { version YPPUSH_XFRRESPVERS { void YPPUSHPROC_NULL(void) = 0; #ifdef STUPID_SUN_BUG /* This is the form as distributed by Sun. But even the Sun NIS servers expect the values in the other order. So their implementation somehow must change the order internally. We don't want to follow this bad example since the user should be able to use rpcgen on this file. */ yppushresp_xfr YPPUSHPROC_XFRRESP(void) = 1; #else void YPPUSHPROC_XFRRESP(yppushresp_xfr) = 1; #endif } = 1; } = 0x40000000; /* transient: could be anything up to 0x5fffffff */ /* * YP binding protocol */ program YPBINDPROG { version YPBINDVERS { void YPBINDPROC_NULL(void) = 0; ypbind_resp YPBINDPROC_DOMAIN(domainname) = 1; void YPBINDPROC_SETDOM(ypbind_setdom) = 2; } = 2; } = 100007; ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/klm_prot.x�����������������������������������������������������������������������������������0000644�����������������00000007235�14763166026�0010106 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)klm_prot.x 2.1 88/08/01 4.0 RPCSRC */ /* * Kernel/lock manager protocol definition * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * protocol used between the UNIX kernel (the "client") and the * local lock manager. The local lock manager is a deamon running * above the kernel. */ const LM_MAXSTRLEN = 1024; /* * lock manager status returns */ enum klm_stats { klm_granted = 0, /* lock is granted */ klm_denied = 1, /* lock is denied */ klm_denied_nolocks = 2, /* no lock entry available */ klm_working = 3 /* lock is being processed */ }; /* * lock manager lock identifier */ struct klm_lock { string server_name<LM_MAXSTRLEN>; netobj fh; /* a counted file handle */ int pid; /* holder of the lock */ unsigned l_offset; /* beginning offset of the lock */ unsigned l_len; /* byte length of the lock; * zero means through end of file */ }; /* * lock holder identifier */ struct klm_holder { bool exclusive; /* FALSE if shared lock */ int svid; /* holder of the lock (pid) */ unsigned l_offset; /* beginning offset of the lock */ unsigned l_len; /* byte length of the lock; * zero means through end of file */ }; /* * reply to KLM_LOCK / KLM_UNLOCK / KLM_CANCEL */ struct klm_stat { klm_stats stat; }; /* * reply to a KLM_TEST call */ union klm_testrply switch (klm_stats stat) { case klm_denied: struct klm_holder holder; default: /* All other cases return no arguments */ void; }; /* * arguments to KLM_LOCK */ struct klm_lockargs { bool block; bool exclusive; struct klm_lock alock; }; /* * arguments to KLM_TEST */ struct klm_testargs { bool exclusive; struct klm_lock alock; }; /* * arguments to KLM_UNLOCK */ struct klm_unlockargs { struct klm_lock alock; }; program KLM_PROG { version KLM_VERS { klm_testrply KLM_TEST (struct klm_testargs) = 1; klm_stat KLM_LOCK (struct klm_lockargs) = 2; klm_stat KLM_CANCEL (struct klm_lockargs) = 3; /* klm_granted=> the cancel request fails due to lock is already granted */ /* klm_denied=> the cancel request successfully aborts lock request */ klm_stat KLM_UNLOCK (struct klm_unlockargs) = 4; } = 1; } = 100020; �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpcsvc/mount.h��������������������������������������������������������������������������������������0000644�����������������00000007427�14763166026�0007404 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _MOUNT_H_RPCGEN #define _MOUNT_H_RPCGEN #include <rpc/rpc.h> #ifdef __cplusplus extern "C" { #endif #define MNTPATHLEN 1024 #define MNTNAMLEN 255 #define FHSIZE 32 typedef char fhandle[FHSIZE]; struct fhstatus { u_int fhs_status; union { fhandle fhs_fhandle; } fhstatus_u; }; typedef struct fhstatus fhstatus; typedef char *dirpath; typedef char *name; typedef struct mountbody *mountlist; struct mountbody { name ml_hostname; dirpath ml_directory; mountlist ml_next; }; typedef struct mountbody mountbody; typedef struct groupnode *groups; struct groupnode { name gr_name; groups gr_next; }; typedef struct groupnode groupnode; typedef struct exportnode *exports; struct exportnode { dirpath ex_dir; groups ex_groups; exports ex_next; }; typedef struct exportnode exportnode; #define MOUNTPROG 100005 #define MOUNTVERS 1 #if defined(__STDC__) || defined(__cplusplus) #define MOUNTPROC_NULL 0 extern void * mountproc_null_1(void *, CLIENT *); extern void * mountproc_null_1_svc(void *, struct svc_req *); #define MOUNTPROC_MNT 1 extern fhstatus * mountproc_mnt_1(dirpath *, CLIENT *); extern fhstatus * mountproc_mnt_1_svc(dirpath *, struct svc_req *); #define MOUNTPROC_DUMP 2 extern mountlist * mountproc_dump_1(void *, CLIENT *); extern mountlist * mountproc_dump_1_svc(void *, struct svc_req *); #define MOUNTPROC_UMNT 3 extern void * mountproc_umnt_1(dirpath *, CLIENT *); extern void * mountproc_umnt_1_svc(dirpath *, struct svc_req *); #define MOUNTPROC_UMNTALL 4 extern void * mountproc_umntall_1(void *, CLIENT *); extern void * mountproc_umntall_1_svc(void *, struct svc_req *); #define MOUNTPROC_EXPORT 5 extern exports * mountproc_export_1(void *, CLIENT *); extern exports * mountproc_export_1_svc(void *, struct svc_req *); #define MOUNTPROC_EXPORTALL 6 extern exports * mountproc_exportall_1(void *, CLIENT *); extern exports * mountproc_exportall_1_svc(void *, struct svc_req *); extern int mountprog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ #define MOUNTPROC_NULL 0 extern void * mountproc_null_1(); extern void * mountproc_null_1_svc(); #define MOUNTPROC_MNT 1 extern fhstatus * mountproc_mnt_1(); extern fhstatus * mountproc_mnt_1_svc(); #define MOUNTPROC_DUMP 2 extern mountlist * mountproc_dump_1(); extern mountlist * mountproc_dump_1_svc(); #define MOUNTPROC_UMNT 3 extern void * mountproc_umnt_1(); extern void * mountproc_umnt_1_svc(); #define MOUNTPROC_UMNTALL 4 extern void * mountproc_umntall_1(); extern void * mountproc_umntall_1_svc(); #define MOUNTPROC_EXPORT 5 extern exports * mountproc_export_1(); extern exports * mountproc_export_1_svc(); #define MOUNTPROC_EXPORTALL 6 extern exports * mountproc_exportall_1(); extern exports * mountproc_exportall_1_svc(); extern int mountprog_1_freeresult (); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) extern bool_t xdr_fhandle (XDR *, fhandle); extern bool_t xdr_fhstatus (XDR *, fhstatus*); extern bool_t xdr_dirpath (XDR *, dirpath*); extern bool_t xdr_name (XDR *, name*); extern bool_t xdr_mountlist (XDR *, mountlist*); extern bool_t xdr_mountbody (XDR *, mountbody*); extern bool_t xdr_groups (XDR *, groups*); extern bool_t xdr_groupnode (XDR *, groupnode*); extern bool_t xdr_exports (XDR *, exports*); extern bool_t xdr_exportnode (XDR *, exportnode*); #else /* K&R C */ extern bool_t xdr_fhandle (); extern bool_t xdr_fhstatus (); extern bool_t xdr_dirpath (); extern bool_t xdr_name (); extern bool_t xdr_mountlist (); extern bool_t xdr_mountbody (); extern bool_t xdr_groups (); extern bool_t xdr_groupnode (); extern bool_t xdr_exports (); extern bool_t xdr_exportnode (); #endif /* K&R C */ #ifdef __cplusplus } #endif #endif /* !_MOUNT_H_RPCGEN */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cursslk.h�������������������������������������������������������������������������������������������0000644�����������������00000016210�14763166026�0006416 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /**************************************************************************** * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ // $Id: cursslk.h,v 1.13 2005/05/28 21:58:18 tom Exp $ #ifndef NCURSES_CURSSLK_H_incl #define NCURSES_CURSSLK_H_incl #include <cursesw.h> class NCURSES_IMPEXP Soft_Label_Key_Set { public: // This inner class represents the attributes of a Soft Label Key (SLK) class NCURSES_IMPEXP Soft_Label_Key { friend class Soft_Label_Key_Set; public: typedef enum { Left=0, Center=1, Right=2 } Justification; private: char *label; // The Text of the Label Justification format; // The Justification int num; // The number of the Label Soft_Label_Key() : label(NULL), format(Left), num(-1) { } virtual ~Soft_Label_Key() { delete[] label; }; public: // Set the text of the Label Soft_Label_Key& operator=(char *text); // Set the Justification of the Label Soft_Label_Key& operator=(Justification just) { format = just; return *this; } // Retrieve the text of the label inline char* operator()(void) const { return label; } Soft_Label_Key& operator=(const Soft_Label_Key& rhs) { if (this != &rhs) { *this = rhs; } return *this; } Soft_Label_Key(const Soft_Label_Key& rhs) : label(NULL), format(rhs.format), num(rhs.num) { *this = rhs.label; } }; public: typedef enum { None = -1, Three_Two_Three = 0, Four_Four = 1, PC_Style = 2, PC_Style_With_Index = 3 } Label_Layout; private: static long NCURSES_IMPEXP count; // Number of Key Sets static Label_Layout NCURSES_IMPEXP format; // Layout of the Key Sets static int NCURSES_IMPEXP num_labels; // Number Of Labels in Key Sets bool NCURSES_IMPEXP b_attrInit; // Are attributes initialized Soft_Label_Key *slk_array; // The array of SLK's // Init the Key Set void init(); // Activate or Deactivate Label# i, Label counting starts with 1! void activate_label(int i, bool bf=TRUE); // Activate of Deactivate all Labels void activate_labels(bool bf); protected: inline void Error (const char* msg) const THROWS(NCursesException) { THROW(new NCursesException (msg)); } // Remove SLK's from screen void clear() { if (ERR==::slk_clear()) Error("slk_clear"); } // Restore them void restore() { if (ERR==::slk_restore()) Error("slk_restore"); } public: // Construct a Key Set, use the most comfortable layout as default. // You must create a Soft_Label_Key_Set before you create any object of // the NCursesWindow, NCursesPanel or derived classes. (Actually before // ::initscr() is called). Soft_Label_Key_Set(Label_Layout fmt); // This constructor assumes, that you already constructed a Key Set // with a layout by the constructor above. This layout will be reused. NCURSES_IMPEXP Soft_Label_Key_Set(); Soft_Label_Key_Set& operator=(const Soft_Label_Key_Set& rhs) { if (this != &rhs) { *this = rhs; init(); // allocate a new slk_array[] } return *this; } Soft_Label_Key_Set(const Soft_Label_Key_Set& rhs) : b_attrInit(rhs.b_attrInit), slk_array(NULL) { init(); // allocate a new slk_array[] } virtual ~Soft_Label_Key_Set(); // Get Label# i. Label counting starts with 1! NCURSES_IMPEXP Soft_Label_Key& operator[](int i); // Retrieve number of Labels inline int labels() const { return num_labels; } // Refresh the SLK portion of the screen inline void refresh() { if (ERR==::slk_refresh()) Error("slk_refresh"); } // Mark the SLK portion of the screen for refresh, defer actual refresh // until next update call. inline void noutrefresh() { if (ERR==::slk_noutrefresh()) Error("slk_noutrefresh"); } // Mark the whole SLK portion of the screen as modified inline void touch() { if (ERR==::slk_touch()) Error("slk_touch"); } // Activate Label# i inline void show(int i) { activate_label(i,FALSE); activate_label(i,TRUE); } // Hide Label# i inline void hide(int i) { activate_label(i,FALSE); } // Show all Labels inline void show() { activate_labels(FALSE); activate_labels(TRUE); } // Hide all Labels inline void hide() { activate_labels(FALSE); } inline void attron(attr_t attrs) { if (ERR==::slk_attron(attrs)) Error("slk_attron"); } inline void attroff(attr_t attrs) { if (ERR==::slk_attroff(attrs)) Error("slk_attroff"); } inline void attrset(attr_t attrs) { if (ERR==::slk_attrset(attrs)) Error("slk_attrset"); } inline void color(short color_pair_number) { if (ERR==::slk_color(color_pair_number)) Error("slk_color"); } inline attr_t attr() const { return ::slk_attr(); } }; #endif /* NCURSES_CURSSLK_H_incl */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������curses.h��������������������������������������������������������������������������������������������0000644�����������������00000272307�14763166026�0006247 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/**************************************************************************** * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /**************************************************************************** * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * * and: Eric S. Raymond <esr@snark.thyrsus.com> * * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* $Id: curses.h.in,v 1.233 2012/09/16 21:05:02 tom Exp $ */ #ifndef __NCURSES_H #define __NCURSES_H #define CURSES 1 #define CURSES_H 1 /* These are defined only in curses.h, and are used for conditional compiles */ #define NCURSES_VERSION_MAJOR 5 #define NCURSES_VERSION_MINOR 9 #define NCURSES_VERSION_PATCH 20130511 /* This is defined in more than one ncurses header, for identification */ #undef NCURSES_VERSION #define NCURSES_VERSION "5.9" /* * Identify the mouse encoding version. */ #define NCURSES_MOUSE_VERSION 1 /* * Definitions to facilitate DLL's. */ #include <ncurses_dll.h> /* * User-definable tweak to disable the include of <stdbool.h>. */ #ifndef NCURSES_ENABLE_STDBOOL_H #define NCURSES_ENABLE_STDBOOL_H 1 #endif /* * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses * configured using --disable-macros. */ #ifdef NCURSES_NOMACROS #ifndef NCURSES_ATTR_T #define NCURSES_ATTR_T attr_t #endif #endif /* NCURSES_NOMACROS */ #ifndef NCURSES_ATTR_T #define NCURSES_ATTR_T int #endif /* * Expands to 'const' if ncurses is configured using --enable-const. Note that * doing so makes it incompatible with other implementations of X/Open Curses. */ #undef NCURSES_CONST #define NCURSES_CONST /*nothing*/ #undef NCURSES_INLINE #define NCURSES_INLINE inline /* * The internal type used for color values */ #undef NCURSES_COLOR_T #define NCURSES_COLOR_T short /* * Definition used to make WINDOW and similar structs opaque. */ #ifndef NCURSES_OPAQUE #define NCURSES_OPAQUE 0 #endif /* * The reentrant code relies on the opaque setting, but adds features. */ #ifndef NCURSES_REENTRANT #define NCURSES_REENTRANT 0 #endif /* * Control whether bindings for interop support are added. */ #undef NCURSES_INTEROP_FUNCS #define NCURSES_INTEROP_FUNCS 0 /* * The internal type used for window dimensions. */ #undef NCURSES_SIZE_T #define NCURSES_SIZE_T short /* * Control whether tparm() supports varargs or fixed-parameter list. */ #undef NCURSES_TPARM_VARARGS #define NCURSES_TPARM_VARARGS 1 /* * Control type used for tparm's arguments. While X/Open equates long and * char* values, this is not always workable for 64-bit platforms. */ #undef NCURSES_TPARM_ARG #define NCURSES_TPARM_ARG long /* * NCURSES_CH_T is used in building the library, but not used otherwise in * this header file, since that would make the normal/wide-character versions * of the header incompatible. */ #undef NCURSES_CH_T #define NCURSES_CH_T cchar_t #if 0 && defined(_LP64) typedef unsigned chtype; typedef unsigned mmask_t; #else typedef unsigned long chtype; typedef unsigned long mmask_t; #endif /* * We need FILE, etc. Include this before checking any feature symbols. */ #include <stdio.h> /* * With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or * conflicting) when _XOPEN_SOURCE is 500 or greater. If NCURSES_WIDECHAR is * not already defined, e.g., if the platform relies upon nonstandard feature * test macros, define it at this point if the standard feature test macros * indicate that it should be defined. */ #ifndef NCURSES_WIDECHAR #if defined(_XOPEN_SOURCE_EXTENDED) || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500)) #define NCURSES_WIDECHAR 1 #else #define NCURSES_WIDECHAR 0 #endif #endif /* NCURSES_WIDECHAR */ #include <stdarg.h> /* we need va_list */ #if NCURSES_WIDECHAR #include <stddef.h> /* we want wchar_t */ #endif /* X/Open and SVr4 specify that curses implements 'bool'. However, C++ may also * implement it. If so, we must use the C++ compiler's type to avoid conflict * with other interfaces. * * A further complication is that <stdbool.h> may declare 'bool' to be a * different type, such as an enum which is not necessarily compatible with * C++. If we have <stdbool.h>, make 'bool' a macro, so users may #undef it. * Otherwise, let it remain a typedef to avoid conflicts with other #define's. * In either case, make a typedef for NCURSES_BOOL which can be used if needed * from either C or C++. */ #undef TRUE #define TRUE 1 #undef FALSE #define FALSE 0 typedef unsigned char NCURSES_BOOL; #if defined(__cplusplus) /* __cplusplus, etc. */ /* use the C++ compiler's bool type */ #define NCURSES_BOOL bool #else /* c89, c99, etc. */ #if NCURSES_ENABLE_STDBOOL_H #include <stdbool.h> /* use whatever the C compiler decides bool really is */ #define NCURSES_BOOL bool #else /* there is no predefined bool - use our own */ #undef bool #define bool NCURSES_BOOL #endif #endif /* !__cplusplus, etc. */ #ifdef __cplusplus extern "C" { #define NCURSES_CAST(type,value) static_cast<type>(value) #else #define NCURSES_CAST(type,value) (type)(value) #endif /* * X/Open attributes. In the ncurses implementation, they are identical to the * A_ attributes. */ #define WA_ATTRIBUTES A_ATTRIBUTES #define WA_NORMAL A_NORMAL #define WA_STANDOUT A_STANDOUT #define WA_UNDERLINE A_UNDERLINE #define WA_REVERSE A_REVERSE #define WA_BLINK A_BLINK #define WA_DIM A_DIM #define WA_BOLD A_BOLD #define WA_ALTCHARSET A_ALTCHARSET #define WA_INVIS A_INVIS #define WA_PROTECT A_PROTECT #define WA_HORIZONTAL A_HORIZONTAL #define WA_LEFT A_LEFT #define WA_LOW A_LOW #define WA_RIGHT A_RIGHT #define WA_TOP A_TOP #define WA_VERTICAL A_VERTICAL /* colors */ #define COLOR_BLACK 0 #define COLOR_RED 1 #define COLOR_GREEN 2 #define COLOR_YELLOW 3 #define COLOR_BLUE 4 #define COLOR_MAGENTA 5 #define COLOR_CYAN 6 #define COLOR_WHITE 7 /* line graphics */ #if 0 || NCURSES_REENTRANT NCURSES_WRAPPED_VAR(chtype*, acs_map); #define acs_map NCURSES_PUBLIC_VAR(acs_map()) #else extern NCURSES_EXPORT_VAR(chtype) acs_map[]; #endif #define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char,(c))]) /* VT100 symbols begin here */ #define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */ #define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */ #define ACS_URCORNER NCURSES_ACS('k') /* upper right corner */ #define ACS_LRCORNER NCURSES_ACS('j') /* lower right corner */ #define ACS_LTEE NCURSES_ACS('t') /* tee pointing right */ #define ACS_RTEE NCURSES_ACS('u') /* tee pointing left */ #define ACS_BTEE NCURSES_ACS('v') /* tee pointing up */ #define ACS_TTEE NCURSES_ACS('w') /* tee pointing down */ #define ACS_HLINE NCURSES_ACS('q') /* horizontal line */ #define ACS_VLINE NCURSES_ACS('x') /* vertical line */ #define ACS_PLUS NCURSES_ACS('n') /* large plus or crossover */ #define ACS_S1 NCURSES_ACS('o') /* scan line 1 */ #define ACS_S9 NCURSES_ACS('s') /* scan line 9 */ #define ACS_DIAMOND NCURSES_ACS('`') /* diamond */ #define ACS_CKBOARD NCURSES_ACS('a') /* checker board (stipple) */ #define ACS_DEGREE NCURSES_ACS('f') /* degree symbol */ #define ACS_PLMINUS NCURSES_ACS('g') /* plus/minus */ #define ACS_BULLET NCURSES_ACS('~') /* bullet */ /* Teletype 5410v1 symbols begin here */ #define ACS_LARROW NCURSES_ACS(',') /* arrow pointing left */ #define ACS_RARROW NCURSES_ACS('+') /* arrow pointing right */ #define ACS_DARROW NCURSES_ACS('.') /* arrow pointing down */ #define ACS_UARROW NCURSES_ACS('-') /* arrow pointing up */ #define ACS_BOARD NCURSES_ACS('h') /* board of squares */ #define ACS_LANTERN NCURSES_ACS('i') /* lantern symbol */ #define ACS_BLOCK NCURSES_ACS('0') /* solid square block */ /* * These aren't documented, but a lot of System Vs have them anyway * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings). * The ACS_names may not match AT&T's, our source didn't know them. */ #define ACS_S3 NCURSES_ACS('p') /* scan line 3 */ #define ACS_S7 NCURSES_ACS('r') /* scan line 7 */ #define ACS_LEQUAL NCURSES_ACS('y') /* less/equal */ #define ACS_GEQUAL NCURSES_ACS('z') /* greater/equal */ #define ACS_PI NCURSES_ACS('{') /* Pi */ #define ACS_NEQUAL NCURSES_ACS('|') /* not equal */ #define ACS_STERLING NCURSES_ACS('}') /* UK pound sign */ /* * Line drawing ACS names are of the form ACS_trbl, where t is the top, r * is the right, b is the bottom, and l is the left. t, r, b, and l might * be B (blank), S (single), D (double), or T (thick). The subset defined * here only uses B and S. */ #define ACS_BSSB ACS_ULCORNER #define ACS_SSBB ACS_LLCORNER #define ACS_BBSS ACS_URCORNER #define ACS_SBBS ACS_LRCORNER #define ACS_SBSS ACS_RTEE #define ACS_SSSB ACS_LTEE #define ACS_SSBS ACS_BTEE #define ACS_BSSS ACS_TTEE #define ACS_BSBS ACS_HLINE #define ACS_SBSB ACS_VLINE #define ACS_SSSS ACS_PLUS #undef ERR #define ERR (-1) #undef OK #define OK (0) /* values for the _flags member */ #define _SUBWIN 0x01 /* is this a sub-window? */ #define _ENDLINE 0x02 /* is the window flush right? */ #define _FULLWIN 0x04 /* is the window full-screen? */ #define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */ #define _ISPAD 0x10 /* is this window a pad? */ #define _HASMOVED 0x20 /* has cursor moved since last refresh? */ #define _WRAPPED 0x40 /* cursor was just wrappped */ /* * this value is used in the firstchar and lastchar fields to mark * unchanged lines */ #define _NOCHANGE -1 /* * this value is used in the oldindex field to mark lines created by insertions * and scrolls. */ #define _NEWINDEX -1 typedef struct screen SCREEN; typedef struct _win_st WINDOW; typedef chtype attr_t; /* ...must be at least as wide as chtype */ #if NCURSES_WIDECHAR #if 0 #ifdef mblen /* libutf8.h defines it w/o undefining first */ #undef mblen #endif #include <libutf8.h> #endif #if 1 #include <wchar.h> /* ...to get mbstate_t, etc. */ #endif #if 0 typedef unsigned short wchar_t1; #endif #if 0 typedef unsigned int wint_t1; #endif /* * cchar_t stores an array of CCHARW_MAX wide characters. The first is * normally a spacing character. The others are non-spacing. If those * (spacing and nonspacing) do not fill the array, a null L'\0' follows. * Otherwise, a null is assumed to follow when extracting via getcchar(). */ #define CCHARW_MAX 5 typedef struct { attr_t attr; wchar_t chars[CCHARW_MAX]; #if 0 #undef NCURSES_EXT_COLORS #define NCURSES_EXT_COLORS 20130511 int ext_color; /* color pair, must be more than 16-bits */ #endif } cchar_t; #endif /* NCURSES_WIDECHAR */ #if !NCURSES_OPAQUE struct ldat; struct _win_st { NCURSES_SIZE_T _cury, _curx; /* current cursor position */ /* window location and size */ NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */ NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */ short _flags; /* window state flags */ /* attribute tracking */ attr_t _attrs; /* current attribute for non-space character */ chtype _bkgd; /* current background char/attribute pair */ /* option values set by user */ bool _notimeout; /* no time out on function-key entry? */ bool _clear; /* consider all data in the window invalid? */ bool _leaveok; /* OK to not reset cursor on exit? */ bool _scroll; /* OK to scroll this window? */ bool _idlok; /* OK to use insert/delete line? */ bool _idcok; /* OK to use insert/delete char? */ bool _immed; /* window in immed mode? (not yet used) */ bool _sync; /* window in sync mode? */ bool _use_keypad; /* process function keys into KEY_ symbols? */ int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */ struct ldat *_line; /* the actual line data */ /* global screen state */ NCURSES_SIZE_T _regtop; /* top line of scrolling region */ NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */ /* these are used only if this is a sub-window */ int _parx; /* x coordinate of this window in parent */ int _pary; /* y coordinate of this window in parent */ WINDOW *_parent; /* pointer to parent if a sub-window */ /* these are used only if this is a pad */ struct pdat { NCURSES_SIZE_T _pad_y, _pad_x; NCURSES_SIZE_T _pad_top, _pad_left; NCURSES_SIZE_T _pad_bottom, _pad_right; } _pad; NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ #if NCURSES_WIDECHAR cchar_t _bkgrnd; /* current background char/attribute pair */ #if 0 int _color; /* current color-pair for non-space character */ #endif #endif }; #endif /* NCURSES_OPAQUE */ /* * This is an extension to support events... */ #if 1 #ifdef NCURSES_WGETCH_EVENTS #if !defined(__BEOS__) || defined(__HAIKU__) /* Fix _nc_timed_wait() on BEOS... */ # define NCURSES_EVENT_VERSION 1 #endif /* !defined(__BEOS__) */ /* * Bits to set in _nc_event.data.flags */ # define _NC_EVENT_TIMEOUT_MSEC 1 # define _NC_EVENT_FILE 2 # define _NC_EVENT_FILE_READABLE 2 # if 0 /* Not supported yet... */ # define _NC_EVENT_FILE_WRITABLE 4 # define _NC_EVENT_FILE_EXCEPTION 8 # endif typedef struct { int type; union { long timeout_msec; /* _NC_EVENT_TIMEOUT_MSEC */ struct { unsigned int flags; int fd; unsigned int result; } fev; /* _NC_EVENT_FILE */ } data; } _nc_event; typedef struct { int count; int result_flags; /* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */ _nc_event *events[1]; } _nc_eventlist; extern NCURSES_EXPORT(int) wgetch_events (WINDOW *, _nc_eventlist *); /* experimental */ extern NCURSES_EXPORT(int) wgetnstr_events (WINDOW *,char *,int,_nc_eventlist *);/* experimental */ #endif /* NCURSES_WGETCH_EVENTS */ #endif /* NCURSES_EXT_FUNCS */ /* * GCC (and some other compilers) define '__attribute__'; we're using this * macro to alert the compiler to flag inconsistencies in printf/scanf-like * function calls. Just in case '__attribute__' isn't defined, make a dummy. * Old versions of G++ do not accept it anyway, at least not consistently with * GCC. */ #if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__)) #define __attribute__(p) /* nothing */ #endif /* * We cannot define these in ncurses_cfg.h, since they require parameters to be * passed (that is non-portable). If you happen to be using gcc with warnings * enabled, define * GCC_PRINTF * GCC_SCANF * to improve checking of calls to printw(), etc. */ #ifndef GCC_PRINTFLIKE #if defined(GCC_PRINTF) && !defined(printf) #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) #else #define GCC_PRINTFLIKE(fmt,var) /*nothing*/ #endif #endif #ifndef GCC_SCANFLIKE #if defined(GCC_SCANF) && !defined(scanf) #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) #else #define GCC_SCANFLIKE(fmt,var) /*nothing*/ #endif #endif #ifndef GCC_NORETURN #define GCC_NORETURN /* nothing */ #endif #ifndef GCC_UNUSED #define GCC_UNUSED /* nothing */ #endif /* * Curses uses a helper function. Define our type for this to simplify * extending it for the sp-funcs feature. */ typedef int (*NCURSES_OUTC)(int); /* * Function prototypes. This is the complete X/Open Curses list of required * functions. Those marked `generated' will have sources generated from the * macro definitions later in this file, in order to satisfy XPG4.2 * requirements. */ extern NCURSES_EXPORT(int) addch (const chtype); /* generated */ extern NCURSES_EXPORT(int) addchnstr (const chtype *, int); /* generated */ extern NCURSES_EXPORT(int) addchstr (const chtype *); /* generated */ extern NCURSES_EXPORT(int) addnstr (const char *, int); /* generated */ extern NCURSES_EXPORT(int) addstr (const char *); /* generated */ extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T); /* generated */ extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T); /* generated */ extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T); /* generated */ extern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *); /* generated */ extern NCURSES_EXPORT(int) attr_off (attr_t, void *); /* generated */ extern NCURSES_EXPORT(int) attr_on (attr_t, void *); /* generated */ extern NCURSES_EXPORT(int) attr_set (attr_t, short, void *); /* generated */ extern NCURSES_EXPORT(int) baudrate (void); /* implemented */ extern NCURSES_EXPORT(int) beep (void); /* implemented */ extern NCURSES_EXPORT(int) bkgd (chtype); /* generated */ extern NCURSES_EXPORT(void) bkgdset (chtype); /* generated */ extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */ extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype); /* generated */ extern NCURSES_EXPORT(bool) can_change_color (void); /* implemented */ extern NCURSES_EXPORT(int) cbreak (void); /* implemented */ extern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *); /* generated */ extern NCURSES_EXPORT(int) clear (void); /* generated */ extern NCURSES_EXPORT(int) clearok (WINDOW *,bool); /* implemented */ extern NCURSES_EXPORT(int) clrtobot (void); /* generated */ extern NCURSES_EXPORT(int) clrtoeol (void); /* generated */ extern NCURSES_EXPORT(int) color_content (short,short*,short*,short*); /* implemented */ extern NCURSES_EXPORT(int) color_set (short,void*); /* generated */ extern NCURSES_EXPORT(int) COLOR_PAIR (int); /* generated */ extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */ extern NCURSES_EXPORT(int) curs_set (int); /* implemented */ extern NCURSES_EXPORT(int) def_prog_mode (void); /* implemented */ extern NCURSES_EXPORT(int) def_shell_mode (void); /* implemented */ extern NCURSES_EXPORT(int) delay_output (int); /* implemented */ extern NCURSES_EXPORT(int) delch (void); /* generated */ extern NCURSES_EXPORT(void) delscreen (SCREEN *); /* implemented */ extern NCURSES_EXPORT(int) delwin (WINDOW *); /* implemented */ extern NCURSES_EXPORT(int) deleteln (void); /* generated */ extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int); /* implemented */ extern NCURSES_EXPORT(int) doupdate (void); /* implemented */ extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *); /* implemented */ extern NCURSES_EXPORT(int) echo (void); /* implemented */ extern NCURSES_EXPORT(int) echochar (const chtype); /* generated */ extern NCURSES_EXPORT(int) erase (void); /* generated */ extern NCURSES_EXPORT(int) endwin (void); /* implemented */ extern NCURSES_EXPORT(char) erasechar (void); /* implemented */ extern NCURSES_EXPORT(void) filter (void); /* implemented */ extern NCURSES_EXPORT(int) flash (void); /* implemented */ extern NCURSES_EXPORT(int) flushinp (void); /* implemented */ extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *); /* generated */ extern NCURSES_EXPORT(int) getch (void); /* generated */ extern NCURSES_EXPORT(int) getnstr (char *, int); /* generated */ extern NCURSES_EXPORT(int) getstr (char *); /* generated */ extern NCURSES_EXPORT(WINDOW *) getwin (FILE *); /* implemented */ extern NCURSES_EXPORT(int) halfdelay (int); /* implemented */ extern NCURSES_EXPORT(bool) has_colors (void); /* implemented */ extern NCURSES_EXPORT(bool) has_ic (void); /* implemented */ extern NCURSES_EXPORT(bool) has_il (void); /* implemented */ extern NCURSES_EXPORT(int) hline (chtype, int); /* generated */ extern NCURSES_EXPORT(void) idcok (WINDOW *, bool); /* implemented */ extern NCURSES_EXPORT(int) idlok (WINDOW *, bool); /* implemented */ extern NCURSES_EXPORT(void) immedok (WINDOW *, bool); /* implemented */ extern NCURSES_EXPORT(chtype) inch (void); /* generated */ extern NCURSES_EXPORT(int) inchnstr (chtype *, int); /* generated */ extern NCURSES_EXPORT(int) inchstr (chtype *); /* generated */ extern NCURSES_EXPORT(WINDOW *) initscr (void); /* implemented */ extern NCURSES_EXPORT(int) init_color (short,short,short,short); /* implemented */ extern NCURSES_EXPORT(int) init_pair (short,short,short); /* implemented */ extern NCURSES_EXPORT(int) innstr (char *, int); /* generated */ extern NCURSES_EXPORT(int) insch (chtype); /* generated */ extern NCURSES_EXPORT(int) insdelln (int); /* generated */ extern NCURSES_EXPORT(int) insertln (void); /* generated */ extern NCURSES_EXPORT(int) insnstr (const char *, int); /* generated */ extern NCURSES_EXPORT(int) insstr (const char *); /* generated */ extern NCURSES_EXPORT(int) instr (char *); /* generated */ extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool); /* implemented */ extern NCURSES_EXPORT(bool) isendwin (void); /* implemented */ extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int); /* implemented */ extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *); /* implemented */ extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int); /* implemented */ extern NCURSES_EXPORT(int) keypad (WINDOW *,bool); /* implemented */ extern NCURSES_EXPORT(char) killchar (void); /* implemented */ extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool); /* implemented */ extern NCURSES_EXPORT(char *) longname (void); /* implemented */ extern NCURSES_EXPORT(int) meta (WINDOW *,bool); /* implemented */ extern NCURSES_EXPORT(int) move (int, int); /* generated */ extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype); /* generated */ extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int); /* generated */ extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *); /* generated */ extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int); /* generated */ extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *); /* generated */ extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, short, const void *); /* generated */ extern NCURSES_EXPORT(int) mvcur (int,int,int,int); /* implemented */ extern NCURSES_EXPORT(int) mvdelch (int, int); /* generated */ extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int); /* implemented */ extern NCURSES_EXPORT(int) mvgetch (int, int); /* generated */ extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int); /* generated */ extern NCURSES_EXPORT(int) mvgetstr (int, int, char *); /* generated */ extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int); /* generated */ extern NCURSES_EXPORT(chtype) mvinch (int, int); /* generated */ extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int); /* generated */ extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *); /* generated */ extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int); /* generated */ extern NCURSES_EXPORT(int) mvinsch (int, int, chtype); /* generated */ extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int); /* generated */ extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *); /* generated */ extern NCURSES_EXPORT(int) mvinstr (int, int, char *); /* generated */ extern NCURSES_EXPORT(int) mvprintw (int,int, const char *,...) /* implemented */ GCC_PRINTFLIKE(3,4); extern NCURSES_EXPORT(int) mvscanw (int,int, NCURSES_CONST char *,...) /* implemented */ GCC_SCANFLIKE(3,4); extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int); /* generated */ extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype); /* generated */ extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */ extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *); /* generated */ extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int); /* generated */ extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *); /* generated */ extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);/* generated */ extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int); /* generated */ extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int); /* generated */ extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int); /* generated */ extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *); /* generated */ extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int); /* generated */ extern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int); /* implemented */ extern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int); /* generated */ extern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int); /* generated */ extern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *); /* generated */ extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int); /* generated */ extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype); /* generated */ extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int); /* generated */ extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *); /* generated */ extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *); /* generated */ extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, const char *,...) /* implemented */ GCC_PRINTFLIKE(4,5); extern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, NCURSES_CONST char *,...) /* implemented */ GCC_SCANFLIKE(4,5); extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int); /* generated */ extern NCURSES_EXPORT(int) napms (int); /* implemented */ extern NCURSES_EXPORT(WINDOW *) newpad (int,int); /* implemented */ extern NCURSES_EXPORT(SCREEN *) newterm (NCURSES_CONST char *,FILE *,FILE *); /* implemented */ extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int); /* implemented */ extern NCURSES_EXPORT(int) nl (void); /* implemented */ extern NCURSES_EXPORT(int) nocbreak (void); /* implemented */ extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool); /* implemented */ extern NCURSES_EXPORT(int) noecho (void); /* implemented */ extern NCURSES_EXPORT(int) nonl (void); /* implemented */ extern NCURSES_EXPORT(void) noqiflush (void); /* implemented */ extern NCURSES_EXPORT(int) noraw (void); /* implemented */ extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool); /* implemented */ extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *); /* implemented */ extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *); /* implemented */ extern NCURSES_EXPORT(int) pair_content (short,short*,short*); /* implemented */ extern NCURSES_EXPORT(int) PAIR_NUMBER (int); /* generated */ extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype); /* implemented */ extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */ extern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int); /* implemented */ extern NCURSES_EXPORT(int) printw (const char *,...) /* implemented */ GCC_PRINTFLIKE(1,2); extern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *); /* implemented */ extern NCURSES_EXPORT(void) qiflush (void); /* implemented */ extern NCURSES_EXPORT(int) raw (void); /* implemented */ extern NCURSES_EXPORT(int) redrawwin (WINDOW *); /* generated */ extern NCURSES_EXPORT(int) refresh (void); /* generated */ extern NCURSES_EXPORT(int) resetty (void); /* implemented */ extern NCURSES_EXPORT(int) reset_prog_mode (void); /* implemented */ extern NCURSES_EXPORT(int) reset_shell_mode (void); /* implemented */ extern NCURSES_EXPORT(int) ripoffline (int, int (*)(WINDOW *, int)); /* implemented */ extern NCURSES_EXPORT(int) savetty (void); /* implemented */ extern NCURSES_EXPORT(int) scanw (NCURSES_CONST char *,...) /* implemented */ GCC_SCANFLIKE(1,2); extern NCURSES_EXPORT(int) scr_dump (const char *); /* implemented */ extern NCURSES_EXPORT(int) scr_init (const char *); /* implemented */ extern NCURSES_EXPORT(int) scrl (int); /* generated */ extern NCURSES_EXPORT(int) scroll (WINDOW *); /* generated */ extern NCURSES_EXPORT(int) scrollok (WINDOW *,bool); /* implemented */ extern NCURSES_EXPORT(int) scr_restore (const char *); /* implemented */ extern NCURSES_EXPORT(int) scr_set (const char *); /* implemented */ extern NCURSES_EXPORT(int) setscrreg (int,int); /* generated */ extern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *); /* implemented */ extern NCURSES_EXPORT(int) slk_attroff (const chtype); /* implemented */ extern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) slk_attron (const chtype); /* implemented */ extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*); /* generated:WIDEC */ extern NCURSES_EXPORT(int) slk_attrset (const chtype); /* implemented */ extern NCURSES_EXPORT(attr_t) slk_attr (void); /* implemented */ extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,short,void*); /* implemented */ extern NCURSES_EXPORT(int) slk_clear (void); /* implemented */ extern NCURSES_EXPORT(int) slk_color (short); /* implemented */ extern NCURSES_EXPORT(int) slk_init (int); /* implemented */ extern NCURSES_EXPORT(char *) slk_label (int); /* implemented */ extern NCURSES_EXPORT(int) slk_noutrefresh (void); /* implemented */ extern NCURSES_EXPORT(int) slk_refresh (void); /* implemented */ extern NCURSES_EXPORT(int) slk_restore (void); /* implemented */ extern NCURSES_EXPORT(int) slk_set (int,const char *,int); /* implemented */ extern NCURSES_EXPORT(int) slk_touch (void); /* implemented */ extern NCURSES_EXPORT(int) standout (void); /* generated */ extern NCURSES_EXPORT(int) standend (void); /* generated */ extern NCURSES_EXPORT(int) start_color (void); /* implemented */ extern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int); /* implemented */ extern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *, int, int, int, int); /* implemented */ extern NCURSES_EXPORT(int) syncok (WINDOW *, bool); /* implemented */ extern NCURSES_EXPORT(chtype) termattrs (void); /* implemented */ extern NCURSES_EXPORT(char *) termname (void); /* implemented */ extern NCURSES_EXPORT(void) timeout (int); /* generated */ extern NCURSES_EXPORT(int) touchline (WINDOW *, int, int); /* generated */ extern NCURSES_EXPORT(int) touchwin (WINDOW *); /* generated */ extern NCURSES_EXPORT(int) typeahead (int); /* implemented */ extern NCURSES_EXPORT(int) ungetch (int); /* implemented */ extern NCURSES_EXPORT(int) untouchwin (WINDOW *); /* generated */ extern NCURSES_EXPORT(void) use_env (bool); /* implemented */ extern NCURSES_EXPORT(void) use_tioctl (bool); /* implemented */ extern NCURSES_EXPORT(int) vidattr (chtype); /* implemented */ extern NCURSES_EXPORT(int) vidputs (chtype, NCURSES_OUTC); /* implemented */ extern NCURSES_EXPORT(int) vline (chtype, int); /* generated */ extern NCURSES_EXPORT(int) vwprintw (WINDOW *, const char *,va_list); /* implemented */ extern NCURSES_EXPORT(int) vw_printw (WINDOW *, const char *,va_list); /* generated */ extern NCURSES_EXPORT(int) vwscanw (WINDOW *, NCURSES_CONST char *,va_list); /* implemented */ extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, NCURSES_CONST char *,va_list); /* generated */ extern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype); /* implemented */ extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *,int); /* implemented */ extern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *); /* generated */ extern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *,int); /* implemented */ extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *); /* generated */ extern NCURSES_EXPORT(int) wattron (WINDOW *, int); /* generated */ extern NCURSES_EXPORT(int) wattroff (WINDOW *, int); /* generated */ extern NCURSES_EXPORT(int) wattrset (WINDOW *, int); /* generated */ extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, short *, void *); /* generated */ extern NCURSES_EXPORT(int) wattr_on (WINDOW *, attr_t, void *); /* implemented */ extern NCURSES_EXPORT(int) wattr_off (WINDOW *, attr_t, void *); /* implemented */ extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, short, void *); /* generated */ extern NCURSES_EXPORT(int) wbkgd (WINDOW *, chtype); /* implemented */ extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype); /* implemented */ extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */ extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, short, const void *);/* implemented */ extern NCURSES_EXPORT(int) wclear (WINDOW *); /* implemented */ extern NCURSES_EXPORT(int) wclrtobot (WINDOW *); /* implemented */ extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *); /* implemented */ extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,short,void*); /* implemented */ extern NCURSES_EXPORT(void) wcursyncup (WINDOW *); /* implemented */ extern NCURSES_EXPORT(int) wdelch (WINDOW *); /* implemented */ extern NCURSES_EXPORT(int) wdeleteln (WINDOW *); /* generated */ extern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype); /* implemented */ extern NCURSES_EXPORT(int) werase (WINDOW *); /* implemented */ extern NCURSES_EXPORT(int) wgetch (WINDOW *); /* implemented */ extern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int); /* implemented */ extern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *); /* generated */ extern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int); /* implemented */ extern NCURSES_EXPORT(chtype) winch (WINDOW *); /* implemented */ extern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int); /* implemented */ extern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *); /* generated */ extern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int); /* implemented */ extern NCURSES_EXPORT(int) winsch (WINDOW *, chtype); /* implemented */ extern NCURSES_EXPORT(int) winsdelln (WINDOW *,int); /* implemented */ extern NCURSES_EXPORT(int) winsertln (WINDOW *); /* generated */ extern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int); /* implemented */ extern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *); /* generated */ extern NCURSES_EXPORT(int) winstr (WINDOW *, char *); /* generated */ extern NCURSES_EXPORT(int) wmove (WINDOW *,int,int); /* implemented */ extern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *); /* implemented */ extern NCURSES_EXPORT(int) wprintw (WINDOW *, const char *,...) /* implemented */ GCC_PRINTFLIKE(2,3); extern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int); /* implemented */ extern NCURSES_EXPORT(int) wrefresh (WINDOW *); /* implemented */ extern NCURSES_EXPORT(int) wscanw (WINDOW *, NCURSES_CONST char *,...) /* implemented */ GCC_SCANFLIKE(2,3); extern NCURSES_EXPORT(int) wscrl (WINDOW *,int); /* implemented */ extern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int); /* implemented */ extern NCURSES_EXPORT(int) wstandout (WINDOW *); /* generated */ extern NCURSES_EXPORT(int) wstandend (WINDOW *); /* generated */ extern NCURSES_EXPORT(void) wsyncdown (WINDOW *); /* implemented */ extern NCURSES_EXPORT(void) wsyncup (WINDOW *); /* implemented */ extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int); /* implemented */ extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int); /* implemented */ extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ /* * These are also declared in <term.h>: */ extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *); /* implemented */ extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *); /* implemented */ extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *); /* implemented */ extern NCURSES_EXPORT(int) putp (const char *); /* implemented */ #if NCURSES_TPARM_VARARGS extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* special */ #else extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG); /* special */ extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...); /* special */ #endif extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */ /* * These functions are not in X/Open, but we use them in macro definitions: */ extern NCURSES_EXPORT(int) getattrs (const WINDOW *); /* generated */ extern NCURSES_EXPORT(int) getcurx (const WINDOW *); /* generated */ extern NCURSES_EXPORT(int) getcury (const WINDOW *); /* generated */ extern NCURSES_EXPORT(int) getbegx (const WINDOW *); /* generated */ extern NCURSES_EXPORT(int) getbegy (const WINDOW *); /* generated */ extern NCURSES_EXPORT(int) getmaxx (const WINDOW *); /* generated */ extern NCURSES_EXPORT(int) getmaxy (const WINDOW *); /* generated */ extern NCURSES_EXPORT(int) getparx (const WINDOW *); /* generated */ extern NCURSES_EXPORT(int) getpary (const WINDOW *); /* generated */ /* * vid_attr() was implemented originally based on a draft of X/Open curses. */ #if !NCURSES_WIDECHAR #define vid_attr(a,pair,opts) vidattr(a) #endif /* * These functions are extensions - not in X/Open Curses. */ #if 1 #undef NCURSES_EXT_FUNCS #define NCURSES_EXT_FUNCS 20130511 typedef int (*NCURSES_WINDOW_CB)(WINDOW *, void *); typedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *); extern NCURSES_EXPORT(bool) is_term_resized (int, int); extern NCURSES_EXPORT(char *) keybound (int, int); extern NCURSES_EXPORT(const char *) curses_version (void); extern NCURSES_EXPORT(int) assume_default_colors (int, int); extern NCURSES_EXPORT(int) define_key (const char *, int); extern NCURSES_EXPORT(int) get_escdelay (void); extern NCURSES_EXPORT(int) key_defined (const char *); extern NCURSES_EXPORT(int) keyok (int, bool); extern NCURSES_EXPORT(int) resize_term (int, int); extern NCURSES_EXPORT(int) resizeterm (int, int); extern NCURSES_EXPORT(int) set_escdelay (int); extern NCURSES_EXPORT(int) set_tabsize (int); extern NCURSES_EXPORT(int) use_default_colors (void); extern NCURSES_EXPORT(int) use_extended_names (bool); extern NCURSES_EXPORT(int) use_legacy_coding (int); extern NCURSES_EXPORT(int) use_screen (SCREEN *, NCURSES_SCREEN_CB, void *); extern NCURSES_EXPORT(int) use_window (WINDOW *, NCURSES_WINDOW_CB, void *); extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int); extern NCURSES_EXPORT(void) nofilter(void); /* * These extensions provide access to information stored in the WINDOW even * when NCURSES_OPAQUE is set: */ extern NCURSES_EXPORT(WINDOW *) wgetparent (const WINDOW *); /* generated */ extern NCURSES_EXPORT(bool) is_cleared (const WINDOW *); /* generated */ extern NCURSES_EXPORT(bool) is_idcok (const WINDOW *); /* generated */ extern NCURSES_EXPORT(bool) is_idlok (const WINDOW *); /* generated */ extern NCURSES_EXPORT(bool) is_immedok (const WINDOW *); /* generated */ extern NCURSES_EXPORT(bool) is_keypad (const WINDOW *); /* generated */ extern NCURSES_EXPORT(bool) is_leaveok (const WINDOW *); /* generated */ extern NCURSES_EXPORT(bool) is_nodelay (const WINDOW *); /* generated */ extern NCURSES_EXPORT(bool) is_notimeout (const WINDOW *); /* generated */ extern NCURSES_EXPORT(bool) is_pad (const WINDOW *); /* generated */ extern NCURSES_EXPORT(bool) is_scrollok (const WINDOW *); /* generated */ extern NCURSES_EXPORT(bool) is_subwin (const WINDOW *); /* generated */ extern NCURSES_EXPORT(bool) is_syncok (const WINDOW *); /* generated */ extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* generated */ #else #define curses_version() NCURSES_VERSION #endif /* * Extra extension-functions, which pass a SCREEN pointer rather than using * a global variable SP. */ #if 0 #undef NCURSES_SP_FUNCS #define NCURSES_SP_FUNCS 20130511 #define NCURSES_SP_NAME(name) name##_sp /* Define the sp-funcs helper function */ #define NCURSES_SP_OUTC NCURSES_SP_NAME(NCURSES_OUTC) typedef int (*NCURSES_SP_OUTC)(SCREEN*, int); extern NCURSES_EXPORT(SCREEN *) new_prescr (void); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(baudrate) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(beep) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(can_change_color) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(cbreak) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(curs_set) (SCREEN*, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content) (SCREEN*, short, short*, short*, short*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_prog_mode) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_shell_mode) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(delay_output) (SCREEN*, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(doupdate) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(echo) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(endwin) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(char) NCURSES_SP_NAME(erasechar) (SCREEN*);/* implemented:SP_FUNC */ extern NCURSES_EXPORT(void) NCURSES_SP_NAME(filter) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(flash) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(flushinp) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(getwin) (SCREEN*, FILE *); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(halfdelay) (SCREEN*, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_colors) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_ic) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_il) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color) (SCREEN*, short, short, short, short); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair) (SCREEN*, short, short, short); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(intrflush) (SCREEN*, WINDOW*, bool); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(isendwin) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(keyname) (SCREEN*, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(char) NCURSES_SP_NAME(killchar) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(longname) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mvcur) (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(napms) (SCREEN*, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(newpad) (SCREEN*, int, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(SCREEN *) NCURSES_SP_NAME(newterm) (SCREEN*, NCURSES_CONST char *, FILE *, FILE *); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(newwin) (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nl) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nocbreak) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noecho) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nonl) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(void) NCURSES_SP_NAME(noqiflush) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noraw) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content) (SCREEN*, short, short*, short*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(void) NCURSES_SP_NAME(qiflush) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(raw) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(reset_prog_mode) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(reset_shell_mode) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resetty) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ripoffline) (SCREEN*, int, int (*)(WINDOW *, int)); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(savetty) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_init) (SCREEN*, const char *); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_restore) (SCREEN*, const char *); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_set) (SCREEN*, const char *); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attroff) (SCREEN*, const chtype); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attron) (SCREEN*, const chtype); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attrset) (SCREEN*, const chtype); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(slk_attr) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set) (SCREEN*, const attr_t, short, void*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_clear) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_color) (SCREEN*, short); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_init) (SCREEN*, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(slk_label) (SCREEN*, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_noutrefresh) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_refresh) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_restore) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_set) (SCREEN*, int, const char *, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_touch) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(start_color) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(chtype) NCURSES_SP_NAME(termattrs) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(termname) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(typeahead) (SCREEN*, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetch) (SCREEN*, int); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_env) (SCREEN*, bool); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_tioctl) (SCREEN*, bool); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidattr) (SCREEN*, chtype); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidputs) (SCREEN*, chtype, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ #if 1 extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(keybound) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(assume_default_colors) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(define_key) (SCREEN*, const char *, int); /* implemented:EXT_SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(get_escdelay) (SCREEN*); /* implemented:EXT_SP_FUNC */ extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(is_term_resized) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(key_defined) (SCREEN*, const char *); /* implemented:EXT_SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(keyok) (SCREEN*, int, bool); /* implemented:EXT_SP_FUNC */ extern NCURSES_EXPORT(void) NCURSES_SP_NAME(nofilter) (SCREEN*); /* implemented */ /* implemented:EXT_SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resize_term) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resizeterm) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_escdelay) (SCREEN*, int); /* implemented:EXT_SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_tabsize) (SCREEN*, int); /* implemented:EXT_SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_default_colors) (SCREEN*); /* implemented:EXT_SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /* implemented:EXT_SP_FUNC */ #endif #else #undef NCURSES_SP_FUNCS #define NCURSES_SP_FUNCS 0 #define NCURSES_SP_NAME(name) name #define NCURSES_SP_OUTC NCURSES_OUTC #endif /* attributes */ #define NCURSES_ATTR_SHIFT 8 #define NCURSES_BITS(mask,shift) ((mask) << ((shift) + NCURSES_ATTR_SHIFT)) #define A_NORMAL (1UL - 1UL) #define A_ATTRIBUTES NCURSES_BITS(~(1UL - 1UL),0) #define A_CHARTEXT (NCURSES_BITS(1UL,0) - 1UL) #define A_COLOR NCURSES_BITS(((1UL) << 8) - 1UL,0) #define A_STANDOUT NCURSES_BITS(1UL,8) #define A_UNDERLINE NCURSES_BITS(1UL,9) #define A_REVERSE NCURSES_BITS(1UL,10) #define A_BLINK NCURSES_BITS(1UL,11) #define A_DIM NCURSES_BITS(1UL,12) #define A_BOLD NCURSES_BITS(1UL,13) #define A_ALTCHARSET NCURSES_BITS(1UL,14) #define A_INVIS NCURSES_BITS(1UL,15) #define A_PROTECT NCURSES_BITS(1UL,16) #define A_HORIZONTAL NCURSES_BITS(1UL,17) #define A_LEFT NCURSES_BITS(1UL,18) #define A_LOW NCURSES_BITS(1UL,19) #define A_RIGHT NCURSES_BITS(1UL,20) #define A_TOP NCURSES_BITS(1UL,21) #define A_VERTICAL NCURSES_BITS(1UL,22) /* * Most of the pseudo functions are macros that either provide compatibility * with older versions of curses, or provide inline functionality to improve * performance. */ /* * These pseudo functions are always implemented as macros: */ #define getyx(win,y,x) (y = getcury(win), x = getcurx(win)) #define getbegyx(win,y,x) (y = getbegy(win), x = getbegx(win)) #define getmaxyx(win,y,x) (y = getmaxy(win), x = getmaxx(win)) #define getparyx(win,y,x) (y = getpary(win), x = getparx(win)) #define getsyx(y,x) do { if (newscr) { \ if (is_leaveok(newscr)) \ (y) = (x) = -1; \ else \ getyx(newscr,(y), (x)); \ } \ } while(0) #define setsyx(y,x) do { if (newscr) { \ if ((y) == -1 && (x) == -1) \ leaveok(newscr, TRUE); \ else { \ leaveok(newscr, FALSE); \ wmove(newscr, (y), (x)); \ } \ } \ } while(0) #ifndef NCURSES_NOMACROS /* * These miscellaneous pseudo functions are provided for compatibility: */ #define wgetstr(w, s) wgetnstr(w, s, -1) #define getnstr(s, n) wgetnstr(stdscr, s, (n)) #define setterm(term) setupterm(term, 1, (int *)0) #define fixterm() reset_prog_mode() #define resetterm() reset_shell_mode() #define saveterm() def_prog_mode() #define crmode() cbreak() #define nocrmode() nocbreak() #define gettmode() /* It seems older SYSV curses versions define these */ #if !NCURSES_OPAQUE #define getattrs(win) NCURSES_CAST(int, (win) ? (win)->_attrs : A_NORMAL) #define getcurx(win) ((win) ? (win)->_curx : ERR) #define getcury(win) ((win) ? (win)->_cury : ERR) #define getbegx(win) ((win) ? (win)->_begx : ERR) #define getbegy(win) ((win) ? (win)->_begy : ERR) #define getmaxx(win) ((win) ? ((win)->_maxx + 1) : ERR) #define getmaxy(win) ((win) ? ((win)->_maxy + 1) : ERR) #define getparx(win) ((win) ? (win)->_parx : ERR) #define getpary(win) ((win) ? (win)->_pary : ERR) #endif /* NCURSES_OPAQUE */ #define wstandout(win) (wattrset(win,A_STANDOUT)) #define wstandend(win) (wattrset(win,A_NORMAL)) #define wattron(win,at) wattr_on(win, NCURSES_CAST(attr_t, at), NULL) #define wattroff(win,at) wattr_off(win, NCURSES_CAST(attr_t, at), NULL) #if !NCURSES_OPAQUE #if NCURSES_WIDECHAR && 0 #define wattrset(win,at) ((win) \ ? ((win)->_color = PAIR_NUMBER(at), \ (win)->_attrs = NCURSES_CAST(attr_t, at), \ OK) \ : ERR) #else #define wattrset(win,at) ((win) \ ? ((win)->_attrs = NCURSES_CAST(attr_t, at), \ OK) \ : ERR) #endif #endif /* NCURSES_OPAQUE */ #define scroll(win) wscrl(win,1) #define touchwin(win) wtouchln((win), 0, getmaxy(win), 1) #define touchline(win, s, c) wtouchln((win), s, c, 1) #define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0) #define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0) #define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) #define hline(ch, n) whline(stdscr, ch, (n)) #define vline(ch, n) wvline(stdscr, ch, (n)) #define winstr(w, s) winnstr(w, s, -1) #define winchstr(w, s) winchnstr(w, s, -1) #define winsstr(w, s) winsnstr(w, s, -1) #if !NCURSES_OPAQUE #define redrawwin(win) wredrawln(win, 0, ((win) ? (win)->_maxy+1 : -1)) #endif /* NCURSES_OPAQUE */ #define waddstr(win,str) waddnstr(win,str,-1) #define waddchstr(win,str) waddchnstr(win,str,-1) /* * These apply to the first 256 color pairs. */ #define COLOR_PAIR(n) NCURSES_BITS((n), 0) #define PAIR_NUMBER(a) (NCURSES_CAST(int,((NCURSES_CAST(unsigned long,(a)) & A_COLOR) >> NCURSES_ATTR_SHIFT))) /* * pseudo functions for standard screen */ #define addch(ch) waddch(stdscr,(ch)) #define addchnstr(str,n) waddchnstr(stdscr,(str),(n)) #define addchstr(str) waddchstr(stdscr,(str)) #define addnstr(str,n) waddnstr(stdscr,(str),(n)) #define addstr(str) waddnstr(stdscr,(str),-1) #define attroff(at) wattroff(stdscr,(at)) #define attron(at) wattron(stdscr,(at)) #define attrset(at) wattrset(stdscr,(at)) #define attr_get(ap,cp,o) wattr_get(stdscr,(ap),(cp),(o)) #define attr_off(a,o) wattr_off(stdscr,(a),(o)) #define attr_on(a,o) wattr_on(stdscr,(a),(o)) #define attr_set(a,c,o) wattr_set(stdscr,(a),(c),(o)) #define bkgd(ch) wbkgd(stdscr,(ch)) #define bkgdset(ch) wbkgdset(stdscr,(ch)) #define chgat(n,a,c,o) wchgat(stdscr,(n),(a),(c),(o)) #define clear() wclear(stdscr) #define clrtobot() wclrtobot(stdscr) #define clrtoeol() wclrtoeol(stdscr) #define color_set(c,o) wcolor_set(stdscr,(c),(o)) #define delch() wdelch(stdscr) #define deleteln() winsdelln(stdscr,-1) #define echochar(c) wechochar(stdscr,(c)) #define erase() werase(stdscr) #define getch() wgetch(stdscr) #define getstr(str) wgetstr(stdscr,(str)) #define inch() winch(stdscr) #define inchnstr(s,n) winchnstr(stdscr,(s),(n)) #define inchstr(s) winchstr(stdscr,(s)) #define innstr(s,n) winnstr(stdscr,(s),(n)) #define insch(c) winsch(stdscr,(c)) #define insdelln(n) winsdelln(stdscr,(n)) #define insertln() winsdelln(stdscr,1) #define insnstr(s,n) winsnstr(stdscr,(s),(n)) #define insstr(s) winsstr(stdscr,(s)) #define instr(s) winstr(stdscr,(s)) #define move(y,x) wmove(stdscr,(y),(x)) #define refresh() wrefresh(stdscr) #define scrl(n) wscrl(stdscr,(n)) #define setscrreg(t,b) wsetscrreg(stdscr,(t),(b)) #define standend() wstandend(stdscr) #define standout() wstandout(stdscr) #define timeout(delay) wtimeout(stdscr,(delay)) #define wdeleteln(win) winsdelln(win,-1) #define winsertln(win) winsdelln(win,1) /* * mv functions */ #define mvwaddch(win,y,x,ch) (wmove((win),(y),(x)) == ERR ? ERR : waddch((win),(ch))) #define mvwaddchnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),(n))) #define mvwaddchstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),-1)) #define mvwaddnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),(n))) #define mvwaddstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),-1)) #define mvwdelch(win,y,x) (wmove((win),(y),(x)) == ERR ? ERR : wdelch(win)) #define mvwchgat(win,y,x,n,a,c,o) (wmove((win),(y),(x)) == ERR ? ERR : wchgat((win),(n),(a),(c),(o))) #define mvwgetch(win,y,x) (wmove((win),(y),(x)) == ERR ? ERR : wgetch(win)) #define mvwgetnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : wgetnstr((win),(str),(n))) #define mvwgetstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : wgetstr((win),(str))) #define mvwhline(win,y,x,c,n) (wmove((win),(y),(x)) == ERR ? ERR : whline((win),(c),(n))) #define mvwinch(win,y,x) (wmove((win),(y),(x)) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win)) #define mvwinchnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winchnstr((win),(s),(n))) #define mvwinchstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winchstr((win),(s))) #define mvwinnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winnstr((win),(s),(n))) #define mvwinsch(win,y,x,c) (wmove((win),(y),(x)) == ERR ? ERR : winsch((win),(c))) #define mvwinsnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winsnstr((win),(s),(n))) #define mvwinsstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winsstr((win),(s))) #define mvwinstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winstr((win),(s))) #define mvwvline(win,y,x,c,n) (wmove((win),(y),(x)) == ERR ? ERR : wvline((win),(c),(n))) #define mvaddch(y,x,ch) mvwaddch(stdscr,(y),(x),(ch)) #define mvaddchnstr(y,x,str,n) mvwaddchnstr(stdscr,(y),(x),(str),(n)) #define mvaddchstr(y,x,str) mvwaddchstr(stdscr,(y),(x),(str)) #define mvaddnstr(y,x,str,n) mvwaddnstr(stdscr,(y),(x),(str),(n)) #define mvaddstr(y,x,str) mvwaddstr(stdscr,(y),(x),(str)) #define mvchgat(y,x,n,a,c,o) mvwchgat(stdscr,(y),(x),(n),(a),(c),(o)) #define mvdelch(y,x) mvwdelch(stdscr,(y),(x)) #define mvgetch(y,x) mvwgetch(stdscr,(y),(x)) #define mvgetnstr(y,x,str,n) mvwgetnstr(stdscr,(y),(x),(str),(n)) #define mvgetstr(y,x,str) mvwgetstr(stdscr,(y),(x),(str)) #define mvhline(y,x,c,n) mvwhline(stdscr,(y),(x),(c),(n)) #define mvinch(y,x) mvwinch(stdscr,(y),(x)) #define mvinchnstr(y,x,s,n) mvwinchnstr(stdscr,(y),(x),(s),(n)) #define mvinchstr(y,x,s) mvwinchstr(stdscr,(y),(x),(s)) #define mvinnstr(y,x,s,n) mvwinnstr(stdscr,(y),(x),(s),(n)) #define mvinsch(y,x,c) mvwinsch(stdscr,(y),(x),(c)) #define mvinsnstr(y,x,s,n) mvwinsnstr(stdscr,(y),(x),(s),(n)) #define mvinsstr(y,x,s) mvwinsstr(stdscr,(y),(x),(s)) #define mvinstr(y,x,s) mvwinstr(stdscr,(y),(x),(s)) #define mvvline(y,x,c,n) mvwvline(stdscr,(y),(x),(c),(n)) /* * Some wide-character functions can be implemented without the extensions. */ #if !NCURSES_OPAQUE #define getbkgd(win) ((win) ? ((win)->_bkgd) : 0) #endif /* NCURSES_OPAQUE */ #define slk_attr_off(a,v) ((v) ? ERR : slk_attroff(a)) #define slk_attr_on(a,v) ((v) ? ERR : slk_attron(a)) #if !NCURSES_OPAQUE #if NCURSES_WIDECHAR && 0 #define wattr_set(win,a,p,opts) (((win) \ ? ((win)->_attrs = ((a) & ~A_COLOR), \ (win)->_color = (p)) \ : OK), \ OK) #define wattr_get(win,a,p,opts) ((void)(((a) != (void *)0) ? (*(a) = (win) ? (win)->_attrs : 0) : OK), \ (void)(((p) != (void *)0) ? (*(p) = (win) ? (short)(win)->_color : 0) : OK), \ OK) #else #define wattr_set(win,a,p,opts) (((win) \ ? ((win)->_attrs = (((a) & ~A_COLOR) | (attr_t)COLOR_PAIR(p))) \ : OK), \ OK) #define wattr_get(win,a,p,opts) ((void)(((a) != (void *)0) ? (*(a) = (win) ? (win)->_attrs : 0) : OK), \ (void)(((p) != (void *)0) ? (*(p) = (win) ? (short)PAIR_NUMBER((win)->_attrs) : 0) : OK), \ OK) #endif #endif /* NCURSES_OPAQUE */ /* * X/Open curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use * varargs.h. It adds new calls vw_printw/vw_scanw, which are supposed to * use POSIX stdarg.h. The ncurses versions of vwprintw/vwscanw already * use stdarg.h, so... */ #define vw_printw vwprintw #define vw_scanw vwscanw /* * Export fallback function for use in C++ binding. */ #if !1 #define vsscanf(a,b,c) _nc_vsscanf(a,b,c) NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list); #endif /* * These macros are extensions - not in X/Open Curses. */ #if 1 #if !NCURSES_OPAQUE #define is_cleared(win) ((win) ? (win)->_clear : FALSE) #define is_idcok(win) ((win) ? (win)->_idcok : FALSE) #define is_idlok(win) ((win) ? (win)->_idlok : FALSE) #define is_immedok(win) ((win) ? (win)->_immed : FALSE) #define is_keypad(win) ((win) ? (win)->_use_keypad : FALSE) #define is_leaveok(win) ((win) ? (win)->_leaveok : FALSE) #define is_nodelay(win) ((win) ? ((win)->_delay == 0) : FALSE) #define is_notimeout(win) ((win) ? (win)->_notimeout : FALSE) #define is_pad(win) ((win) ? ((win)->_flags & _ISPAD) != 0 : FALSE) #define is_scrollok(win) ((win) ? (win)->_scroll : FALSE) #define is_subwin(win) ((win) ? ((win)->_flags & _SUBWIN) != 0 : FALSE) #define is_syncok(win) ((win) ? (win)->_sync : FALSE) #define wgetparent(win) ((win) ? (win)->_parent : 0) #define wgetscrreg(win,t,b) ((win) ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) : ERR) #endif #endif #endif /* NCURSES_NOMACROS */ /* * Public variables. * * Notes: * a. ESCDELAY was an undocumented feature under AIX curses. * It gives the ESC expire time in milliseconds. * b. ttytype is needed for backward compatibility */ #if NCURSES_REENTRANT NCURSES_WRAPPED_VAR(WINDOW *, curscr); NCURSES_WRAPPED_VAR(WINDOW *, newscr); NCURSES_WRAPPED_VAR(WINDOW *, stdscr); NCURSES_WRAPPED_VAR(char *, ttytype); NCURSES_WRAPPED_VAR(int, COLORS); NCURSES_WRAPPED_VAR(int, COLOR_PAIRS); NCURSES_WRAPPED_VAR(int, COLS); NCURSES_WRAPPED_VAR(int, ESCDELAY); NCURSES_WRAPPED_VAR(int, LINES); NCURSES_WRAPPED_VAR(int, TABSIZE); #define curscr NCURSES_PUBLIC_VAR(curscr()) #define newscr NCURSES_PUBLIC_VAR(newscr()) #define stdscr NCURSES_PUBLIC_VAR(stdscr()) #define ttytype NCURSES_PUBLIC_VAR(ttytype()) #define COLORS NCURSES_PUBLIC_VAR(COLORS()) #define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS()) #define COLS NCURSES_PUBLIC_VAR(COLS()) #define ESCDELAY NCURSES_PUBLIC_VAR(ESCDELAY()) #define LINES NCURSES_PUBLIC_VAR(LINES()) #define TABSIZE NCURSES_PUBLIC_VAR(TABSIZE()) #else extern NCURSES_EXPORT_VAR(WINDOW *) curscr; extern NCURSES_EXPORT_VAR(WINDOW *) newscr; extern NCURSES_EXPORT_VAR(WINDOW *) stdscr; extern NCURSES_EXPORT_VAR(char) ttytype[]; extern NCURSES_EXPORT_VAR(int) COLORS; extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS; extern NCURSES_EXPORT_VAR(int) COLS; extern NCURSES_EXPORT_VAR(int) ESCDELAY; extern NCURSES_EXPORT_VAR(int) LINES; extern NCURSES_EXPORT_VAR(int) TABSIZE; #endif /* * Pseudo-character tokens outside ASCII range. The curses wgetch() function * will return any given one of these only if the corresponding k- capability * is defined in your terminal's terminfo entry. * * Some keys (KEY_A1, etc) are arranged like this: * a1 up a3 * left b2 right * c1 down c3 * * A few key codes do not depend upon the terminfo entry. */ #define KEY_CODE_YES 0400 /* A wchar_t contains a key code */ #define KEY_MIN 0401 /* Minimum curses key */ #define KEY_BREAK 0401 /* Break key (unreliable) */ #define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */ #define KEY_RESET 0531 /* Reset or hard reset (unreliable) */ /* * These definitions were generated by ./MKkey_defs.sh ./Caps */ #define KEY_DOWN 0402 /* down-arrow key */ #define KEY_UP 0403 /* up-arrow key */ #define KEY_LEFT 0404 /* left-arrow key */ #define KEY_RIGHT 0405 /* right-arrow key */ #define KEY_HOME 0406 /* home key */ #define KEY_BACKSPACE 0407 /* backspace key */ #define KEY_F0 0410 /* Function keys. Space for 64 */ #define KEY_F(n) (KEY_F0+(n)) /* Value of function key n */ #define KEY_DL 0510 /* delete-line key */ #define KEY_IL 0511 /* insert-line key */ #define KEY_DC 0512 /* delete-character key */ #define KEY_IC 0513 /* insert-character key */ #define KEY_EIC 0514 /* sent by rmir or smir in insert mode */ #define KEY_CLEAR 0515 /* clear-screen or erase key */ #define KEY_EOS 0516 /* clear-to-end-of-screen key */ #define KEY_EOL 0517 /* clear-to-end-of-line key */ #define KEY_SF 0520 /* scroll-forward key */ #define KEY_SR 0521 /* scroll-backward key */ #define KEY_NPAGE 0522 /* next-page key */ #define KEY_PPAGE 0523 /* previous-page key */ #define KEY_STAB 0524 /* set-tab key */ #define KEY_CTAB 0525 /* clear-tab key */ #define KEY_CATAB 0526 /* clear-all-tabs key */ #define KEY_ENTER 0527 /* enter/send key */ #define KEY_PRINT 0532 /* print key */ #define KEY_LL 0533 /* lower-left key (home down) */ #define KEY_A1 0534 /* upper left of keypad */ #define KEY_A3 0535 /* upper right of keypad */ #define KEY_B2 0536 /* center of keypad */ #define KEY_C1 0537 /* lower left of keypad */ #define KEY_C3 0540 /* lower right of keypad */ #define KEY_BTAB 0541 /* back-tab key */ #define KEY_BEG 0542 /* begin key */ #define KEY_CANCEL 0543 /* cancel key */ #define KEY_CLOSE 0544 /* close key */ #define KEY_COMMAND 0545 /* command key */ #define KEY_COPY 0546 /* copy key */ #define KEY_CREATE 0547 /* create key */ #define KEY_END 0550 /* end key */ #define KEY_EXIT 0551 /* exit key */ #define KEY_FIND 0552 /* find key */ #define KEY_HELP 0553 /* help key */ #define KEY_MARK 0554 /* mark key */ #define KEY_MESSAGE 0555 /* message key */ #define KEY_MOVE 0556 /* move key */ #define KEY_NEXT 0557 /* next key */ #define KEY_OPEN 0560 /* open key */ #define KEY_OPTIONS 0561 /* options key */ #define KEY_PREVIOUS 0562 /* previous key */ #define KEY_REDO 0563 /* redo key */ #define KEY_REFERENCE 0564 /* reference key */ #define KEY_REFRESH 0565 /* refresh key */ #define KEY_REPLACE 0566 /* replace key */ #define KEY_RESTART 0567 /* restart key */ #define KEY_RESUME 0570 /* resume key */ #define KEY_SAVE 0571 /* save key */ #define KEY_SBEG 0572 /* shifted begin key */ #define KEY_SCANCEL 0573 /* shifted cancel key */ #define KEY_SCOMMAND 0574 /* shifted command key */ #define KEY_SCOPY 0575 /* shifted copy key */ #define KEY_SCREATE 0576 /* shifted create key */ #define KEY_SDC 0577 /* shifted delete-character key */ #define KEY_SDL 0600 /* shifted delete-line key */ #define KEY_SELECT 0601 /* select key */ #define KEY_SEND 0602 /* shifted end key */ #define KEY_SEOL 0603 /* shifted clear-to-end-of-line key */ #define KEY_SEXIT 0604 /* shifted exit key */ #define KEY_SFIND 0605 /* shifted find key */ #define KEY_SHELP 0606 /* shifted help key */ #define KEY_SHOME 0607 /* shifted home key */ #define KEY_SIC 0610 /* shifted insert-character key */ #define KEY_SLEFT 0611 /* shifted left-arrow key */ #define KEY_SMESSAGE 0612 /* shifted message key */ #define KEY_SMOVE 0613 /* shifted move key */ #define KEY_SNEXT 0614 /* shifted next key */ #define KEY_SOPTIONS 0615 /* shifted options key */ #define KEY_SPREVIOUS 0616 /* shifted previous key */ #define KEY_SPRINT 0617 /* shifted print key */ #define KEY_SREDO 0620 /* shifted redo key */ #define KEY_SREPLACE 0621 /* shifted replace key */ #define KEY_SRIGHT 0622 /* shifted right-arrow key */ #define KEY_SRSUME 0623 /* shifted resume key */ #define KEY_SSAVE 0624 /* shifted save key */ #define KEY_SSUSPEND 0625 /* shifted suspend key */ #define KEY_SUNDO 0626 /* shifted undo key */ #define KEY_SUSPEND 0627 /* suspend key */ #define KEY_UNDO 0630 /* undo key */ #define KEY_MOUSE 0631 /* Mouse event has occurred */ #define KEY_RESIZE 0632 /* Terminal resize event */ #define KEY_EVENT 0633 /* We were interrupted by an event */ #define KEY_MAX 0777 /* Maximum key value is 0633 */ /* $Id: curses.wide,v 1.45 2012/07/28 18:10:02 tom Exp $ */ /* * vile:cmode: * This file is part of ncurses, designed to be appended after curses.h.in * (see that file for the relevant copyright). */ #define _XOPEN_CURSES 1 #if NCURSES_WIDECHAR extern NCURSES_EXPORT_VAR(cchar_t *) _nc_wacs; #define NCURSES_WACS(c) (&_nc_wacs[NCURSES_CAST(unsigned char,(c))]) #define WACS_BSSB NCURSES_WACS('l') #define WACS_SSBB NCURSES_WACS('m') #define WACS_BBSS NCURSES_WACS('k') #define WACS_SBBS NCURSES_WACS('j') #define WACS_SBSS NCURSES_WACS('u') #define WACS_SSSB NCURSES_WACS('t') #define WACS_SSBS NCURSES_WACS('v') #define WACS_BSSS NCURSES_WACS('w') #define WACS_BSBS NCURSES_WACS('q') #define WACS_SBSB NCURSES_WACS('x') #define WACS_SSSS NCURSES_WACS('n') #define WACS_ULCORNER WACS_BSSB #define WACS_LLCORNER WACS_SSBB #define WACS_URCORNER WACS_BBSS #define WACS_LRCORNER WACS_SBBS #define WACS_RTEE WACS_SBSS #define WACS_LTEE WACS_SSSB #define WACS_BTEE WACS_SSBS #define WACS_TTEE WACS_BSSS #define WACS_HLINE WACS_BSBS #define WACS_VLINE WACS_SBSB #define WACS_PLUS WACS_SSSS #define WACS_S1 NCURSES_WACS('o') /* scan line 1 */ #define WACS_S9 NCURSES_WACS('s') /* scan line 9 */ #define WACS_DIAMOND NCURSES_WACS('`') /* diamond */ #define WACS_CKBOARD NCURSES_WACS('a') /* checker board */ #define WACS_DEGREE NCURSES_WACS('f') /* degree symbol */ #define WACS_PLMINUS NCURSES_WACS('g') /* plus/minus */ #define WACS_BULLET NCURSES_WACS('~') /* bullet */ /* Teletype 5410v1 symbols */ #define WACS_LARROW NCURSES_WACS(',') /* arrow left */ #define WACS_RARROW NCURSES_WACS('+') /* arrow right */ #define WACS_DARROW NCURSES_WACS('.') /* arrow down */ #define WACS_UARROW NCURSES_WACS('-') /* arrow up */ #define WACS_BOARD NCURSES_WACS('h') /* board of squares */ #define WACS_LANTERN NCURSES_WACS('i') /* lantern symbol */ #define WACS_BLOCK NCURSES_WACS('0') /* solid square block */ /* ncurses extensions */ #define WACS_S3 NCURSES_WACS('p') /* scan line 3 */ #define WACS_S7 NCURSES_WACS('r') /* scan line 7 */ #define WACS_LEQUAL NCURSES_WACS('y') /* less/equal */ #define WACS_GEQUAL NCURSES_WACS('z') /* greater/equal */ #define WACS_PI NCURSES_WACS('{') /* Pi */ #define WACS_NEQUAL NCURSES_WACS('|') /* not equal */ #define WACS_STERLING NCURSES_WACS('}') /* UK pound sign */ /* double lines */ #define WACS_BDDB NCURSES_WACS('C') #define WACS_DDBB NCURSES_WACS('D') #define WACS_BBDD NCURSES_WACS('B') #define WACS_DBBD NCURSES_WACS('A') #define WACS_DBDD NCURSES_WACS('G') #define WACS_DDDB NCURSES_WACS('F') #define WACS_DDBD NCURSES_WACS('H') #define WACS_BDDD NCURSES_WACS('I') #define WACS_BDBD NCURSES_WACS('R') #define WACS_DBDB NCURSES_WACS('Y') #define WACS_DDDD NCURSES_WACS('E') #define WACS_D_ULCORNER WACS_BDDB #define WACS_D_LLCORNER WACS_DDBB #define WACS_D_URCORNER WACS_BBDD #define WACS_D_LRCORNER WACS_DBBD #define WACS_D_RTEE WACS_DBDD #define WACS_D_LTEE WACS_DDDB #define WACS_D_BTEE WACS_DDBD #define WACS_D_TTEE WACS_BDDD #define WACS_D_HLINE WACS_BDBD #define WACS_D_VLINE WACS_DBDB #define WACS_D_PLUS WACS_DDDD /* thick lines */ #define WACS_BTTB NCURSES_WACS('L') #define WACS_TTBB NCURSES_WACS('M') #define WACS_BBTT NCURSES_WACS('K') #define WACS_TBBT NCURSES_WACS('J') #define WACS_TBTT NCURSES_WACS('U') #define WACS_TTTB NCURSES_WACS('T') #define WACS_TTBT NCURSES_WACS('V') #define WACS_BTTT NCURSES_WACS('W') #define WACS_BTBT NCURSES_WACS('Q') #define WACS_TBTB NCURSES_WACS('X') #define WACS_TTTT NCURSES_WACS('N') #define WACS_T_ULCORNER WACS_BTTB #define WACS_T_LLCORNER WACS_TTBB #define WACS_T_URCORNER WACS_BBTT #define WACS_T_LRCORNER WACS_TBBT #define WACS_T_RTEE WACS_TBTT #define WACS_T_LTEE WACS_TTTB #define WACS_T_BTEE WACS_TTBT #define WACS_T_TTEE WACS_BTTT #define WACS_T_HLINE WACS_BTBT #define WACS_T_VLINE WACS_TBTB #define WACS_T_PLUS WACS_TTTT /* * Function prototypes for wide-character operations. * * "generated" comments should include ":WIDEC" to make the corresponding * functions ifdef'd in lib_gen.c * * "implemented" comments do not need this marker. */ extern NCURSES_EXPORT(int) add_wch (const cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) add_wchnstr (const cchar_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) add_wchstr (const cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) addnwstr (const wchar_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) addwstr (const wchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) bkgrnd (const cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(void) bkgrndset (const cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) border_set (const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* generated:WIDEC */ extern NCURSES_EXPORT(int) box_set (WINDOW *, const cchar_t *, const cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) echo_wchar (const cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) erasewchar (wchar_t*); /* implemented */ extern NCURSES_EXPORT(int) get_wch (wint_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) get_wstr (wint_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) getbkgrnd (cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, short*, void*); /* implemented */ extern NCURSES_EXPORT(int) getn_wstr (wint_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) hline_set (const cchar_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) in_wch (cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) in_wchnstr (cchar_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) in_wchstr (cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) innwstr (wchar_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) ins_nwstr (const wchar_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) ins_wch (const cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) ins_wstr (const wchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) inwstr (wchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(NCURSES_CONST char*) key_name (wchar_t); /* implemented */ extern NCURSES_EXPORT(int) killwchar (wchar_t *); /* implemented */ extern NCURSES_EXPORT(int) mvadd_wch (int, int, const cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvadd_wchnstr (int, int, const cchar_t *, int);/* generated:WIDEC */ extern NCURSES_EXPORT(int) mvadd_wchstr (int, int, const cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvaddnwstr (int, int, const wchar_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvaddwstr (int, int, const wchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvget_wch (int, int, wint_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvget_wstr (int, int, wint_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvgetn_wstr (int, int, wint_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvhline_set (int, int, const cchar_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvin_wch (int, int, cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvin_wchnstr (int, int, cchar_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvin_wchstr (int, int, cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvinnwstr (int, int, wchar_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvins_nwstr (int, int, const wchar_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvins_wch (int, int, const cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvins_wstr (int, int, const wchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvinwstr (int, int, wchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvvline_set (int, int, const cchar_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwadd_wch (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwadd_wchnstr (WINDOW *, int, int, const cchar_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwadd_wchstr (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwaddnwstr (WINDOW *, int, int, const wchar_t *, int);/* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwaddwstr (WINDOW *, int, int, const wchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwget_wch (WINDOW *, int, int, wint_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwget_wstr (WINDOW *, int, int, wint_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwgetn_wstr (WINDOW *, int, int, wint_t *, int);/* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwhline_set (WINDOW *, int, int, const cchar_t *, int);/* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwin_wch (WINDOW *, int, int, cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwin_wchnstr (WINDOW *, int,int, cchar_t *,int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwin_wchstr (WINDOW *, int, int, cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwinnwstr (WINDOW *, int, int, wchar_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwins_nwstr (WINDOW *, int,int, const wchar_t *,int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwins_wch (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwins_wstr (WINDOW *, int, int, const wchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwinwstr (WINDOW *, int, int, wchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) mvwvline_set (WINDOW *, int,int, const cchar_t *,int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) pecho_wchar (WINDOW *, const cchar_t *); /* implemented */ extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, short, const void *); /* implemented */ extern NCURSES_EXPORT(int) slk_wset (int, const wchar_t *, int); /* implemented */ extern NCURSES_EXPORT(attr_t) term_attrs (void); /* implemented */ extern NCURSES_EXPORT(int) unget_wch (const wchar_t); /* implemented */ extern NCURSES_EXPORT(int) vid_attr (attr_t, short, void *); /* implemented */ extern NCURSES_EXPORT(int) vid_puts (attr_t, short, void *, NCURSES_OUTC); /* implemented */ extern NCURSES_EXPORT(int) vline_set (const cchar_t *, int); /* generated:WIDEC */ extern NCURSES_EXPORT(int) wadd_wch (WINDOW *,const cchar_t *); /* implemented */ extern NCURSES_EXPORT(int) wadd_wchnstr (WINDOW *,const cchar_t *,int); /* implemented */ extern NCURSES_EXPORT(int) wadd_wchstr (WINDOW *,const cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) waddnwstr (WINDOW *,const wchar_t *,int); /* implemented */ extern NCURSES_EXPORT(int) waddwstr (WINDOW *,const wchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) wbkgrnd (WINDOW *,const cchar_t *); /* implemented */ extern NCURSES_EXPORT(void) wbkgrndset (WINDOW *,const cchar_t *); /* implemented */ extern NCURSES_EXPORT(int) wborder_set (WINDOW *,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* implemented */ extern NCURSES_EXPORT(int) wecho_wchar (WINDOW *, const cchar_t *); /* implemented */ extern NCURSES_EXPORT(int) wget_wch (WINDOW *, wint_t *); /* implemented */ extern NCURSES_EXPORT(int) wget_wstr (WINDOW *, wint_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) wgetbkgrnd (WINDOW *, cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) wgetn_wstr (WINDOW *,wint_t *, int); /* implemented */ extern NCURSES_EXPORT(int) whline_set (WINDOW *, const cchar_t *, int); /* implemented */ extern NCURSES_EXPORT(int) win_wch (WINDOW *, cchar_t *); /* implemented */ extern NCURSES_EXPORT(int) win_wchnstr (WINDOW *, cchar_t *, int); /* implemented */ extern NCURSES_EXPORT(int) win_wchstr (WINDOW *, cchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) winnwstr (WINDOW *, wchar_t *, int); /* implemented */ extern NCURSES_EXPORT(int) wins_nwstr (WINDOW *, const wchar_t *, int); /* implemented */ extern NCURSES_EXPORT(int) wins_wch (WINDOW *, const cchar_t *); /* implemented */ extern NCURSES_EXPORT(int) wins_wstr (WINDOW *, const wchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(int) winwstr (WINDOW *, wchar_t *); /* implemented */ extern NCURSES_EXPORT(wchar_t*) wunctrl (cchar_t *); /* implemented */ extern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int); /* implemented */ #if NCURSES_SP_FUNCS extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(term_attrs) (SCREEN*); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(unget_wch) (SCREEN*, const wchar_t); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(wchar_t*) NCURSES_SP_NAME(wunctrl) (SCREEN*, cchar_t *); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr) (SCREEN*, attr_t, short, void *); /* implemented:SP_FUNC */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, short, void *, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ #endif #ifndef NCURSES_NOMACROS /* * XSI curses macros for XPG4 conformance. */ #define add_wch(c) wadd_wch(stdscr,(c)) #define add_wchnstr(str,n) wadd_wchnstr(stdscr,(str),(n)) #define add_wchstr(str) wadd_wchstr(stdscr,(str)) #define addnwstr(wstr,n) waddnwstr(stdscr,(wstr),(n)) #define addwstr(wstr) waddwstr(stdscr,(wstr)) #define bkgrnd(c) wbkgrnd(stdscr,(c)) #define bkgrndset(c) wbkgrndset(stdscr,(c)) #define border_set(l,r,t,b,tl,tr,bl,br) wborder_set(stdscr,(l),(r),(t),(b),tl,tr,bl,br) #define box_set(w,v,h) wborder_set((w),(v),(v),(h),(h),0,0,0,0) #define echo_wchar(c) wecho_wchar(stdscr,(c)) #define get_wch(c) wget_wch(stdscr,(c)) #define get_wstr(t) wget_wstr(stdscr,(t)) #define getbkgrnd(wch) wgetbkgrnd(stdscr,(wch)) #define getn_wstr(t,n) wgetn_wstr(stdscr,(t),(n)) #define hline_set(c,n) whline_set(stdscr,(c),(n)) #define in_wch(c) win_wch(stdscr,(c)) #define in_wchnstr(c,n) win_wchnstr(stdscr,(c),(n)) #define in_wchstr(c) win_wchstr(stdscr,(c)) #define innwstr(c,n) winnwstr(stdscr,(c),(n)) #define ins_nwstr(t,n) wins_nwstr(stdscr,(t),(n)) #define ins_wch(c) wins_wch(stdscr,(c)) #define ins_wstr(t) wins_wstr(stdscr,(t)) #define inwstr(c) winwstr(stdscr,(c)) #define vline_set(c,n) wvline_set(stdscr,(c),(n)) #define wadd_wchstr(win,str) wadd_wchnstr((win),(str),-1) #define waddwstr(win,wstr) waddnwstr((win),(wstr),-1) #define wget_wstr(w,t) wgetn_wstr((w),(t),-1) #define win_wchstr(w,c) win_wchnstr((w),(c),-1) #define wins_wstr(w,t) wins_nwstr((w),(t),-1) #if !NCURSES_OPAQUE #define wgetbkgrnd(win,wch) ((win) ? (*(wch) = (win)->_bkgrnd) : *(wch), OK) #endif #define mvadd_wch(y,x,c) mvwadd_wch(stdscr,(y),(x),(c)) #define mvadd_wchnstr(y,x,s,n) mvwadd_wchnstr(stdscr,(y),(x),(s),(n)) #define mvadd_wchstr(y,x,s) mvwadd_wchstr(stdscr,(y),(x),(s)) #define mvaddnwstr(y,x,wstr,n) mvwaddnwstr(stdscr,(y),(x),(wstr),(n)) #define mvaddwstr(y,x,wstr) mvwaddwstr(stdscr,(y),(x),(wstr)) #define mvget_wch(y,x,c) mvwget_wch(stdscr,(y),(x),(c)) #define mvget_wstr(y,x,t) mvwget_wstr(stdscr,(y),(x),(t)) #define mvgetn_wstr(y,x,t,n) mvwgetn_wstr(stdscr,(y),(x),(t),(n)) #define mvhline_set(y,x,c,n) mvwhline_set(stdscr,(y),(x),(c),(n)) #define mvin_wch(y,x,c) mvwin_wch(stdscr,(y),(x),(c)) #define mvin_wchnstr(y,x,c,n) mvwin_wchnstr(stdscr,(y),(x),(c),(n)) #define mvin_wchstr(y,x,c) mvwin_wchstr(stdscr,(y),(x),(c)) #define mvinnwstr(y,x,c,n) mvwinnwstr(stdscr,(y),(x),(c),(n)) #define mvins_nwstr(y,x,t,n) mvwins_nwstr(stdscr,(y),(x),(t),(n)) #define mvins_wch(y,x,c) mvwins_wch(stdscr,(y),(x),(c)) #define mvins_wstr(y,x,t) mvwins_wstr(stdscr,(y),(x),(t)) #define mvinwstr(y,x,c) mvwinwstr(stdscr,(y),(x),(c)) #define mvvline_set(y,x,c,n) mvwvline_set(stdscr,(y),(x),(c),(n)) #define mvwadd_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wch((win),(c))) #define mvwadd_wchnstr(win,y,x,s,n) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wchnstr((win),(s),(n))) #define mvwadd_wchstr(win,y,x,s) (wmove(win,(y),(x)) == ERR ? ERR : wadd_wchstr((win),(s))) #define mvwaddnwstr(win,y,x,wstr,n) (wmove(win,(y),(x)) == ERR ? ERR : waddnwstr((win),(wstr),(n))) #define mvwaddwstr(win,y,x,wstr) (wmove(win,(y),(x)) == ERR ? ERR : waddwstr((win),(wstr))) #define mvwget_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wget_wch((win),(c))) #define mvwget_wstr(win,y,x,t) (wmove(win,(y),(x)) == ERR ? ERR : wget_wstr((win),(t))) #define mvwgetn_wstr(win,y,x,t,n) (wmove(win,(y),(x)) == ERR ? ERR : wgetn_wstr((win),(t),(n))) #define mvwhline_set(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : whline_set((win),(c),(n))) #define mvwin_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : win_wch((win),(c))) #define mvwin_wchnstr(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : win_wchnstr((win),(c),(n))) #define mvwin_wchstr(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : win_wchstr((win),(c))) #define mvwinnwstr(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : winnwstr((win),(c),(n))) #define mvwins_nwstr(win,y,x,t,n) (wmove(win,(y),(x)) == ERR ? ERR : wins_nwstr((win),(t),(n))) #define mvwins_wch(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : wins_wch((win),(c))) #define mvwins_wstr(win,y,x,t) (wmove(win,(y),(x)) == ERR ? ERR : wins_wstr((win),(t))) #define mvwinwstr(win,y,x,c) (wmove(win,(y),(x)) == ERR ? ERR : winwstr((win),(c))) #define mvwvline_set(win,y,x,c,n) (wmove(win,(y),(x)) == ERR ? ERR : wvline_set((win),(c),(n))) #endif /* NCURSES_NOMACROS */ #if defined(TRACE) || defined(NCURSES_TEST) extern NCURSES_EXPORT(const char *) _nc_viswbuf(const wchar_t *); extern NCURSES_EXPORT(const char *) _nc_viswibuf(const wint_t *); #endif #endif /* NCURSES_WIDECHAR */ /* $Id: curses.tail,v 1.21 2011/10/29 20:03:22 tom Exp $ */ /* * vile:cmode: * This file is part of ncurses, designed to be appended after curses.h.in * (see that file for the relevant copyright). */ /* mouse interface */ #if NCURSES_MOUSE_VERSION > 1 #define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 5)) #else #define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 6)) #endif #define NCURSES_BUTTON_RELEASED 001L #define NCURSES_BUTTON_PRESSED 002L #define NCURSES_BUTTON_CLICKED 004L #define NCURSES_DOUBLE_CLICKED 010L #define NCURSES_TRIPLE_CLICKED 020L #define NCURSES_RESERVED_EVENT 040L /* event masks */ #define BUTTON1_RELEASED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED) #define BUTTON1_PRESSED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED) #define BUTTON1_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED) #define BUTTON1_DOUBLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED) #define BUTTON1_TRIPLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED) #define BUTTON2_RELEASED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED) #define BUTTON2_PRESSED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED) #define BUTTON2_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED) #define BUTTON2_DOUBLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED) #define BUTTON2_TRIPLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED) #define BUTTON3_RELEASED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED) #define BUTTON3_PRESSED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED) #define BUTTON3_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED) #define BUTTON3_DOUBLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED) #define BUTTON3_TRIPLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED) #define BUTTON4_RELEASED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED) #define BUTTON4_PRESSED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED) #define BUTTON4_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED) #define BUTTON4_DOUBLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED) #define BUTTON4_TRIPLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED) /* * In 32 bits the version-1 scheme does not provide enough space for a 5th * button, unless we choose to change the ABI by omitting the reserved-events. */ #if NCURSES_MOUSE_VERSION > 1 #define BUTTON5_RELEASED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED) #define BUTTON5_PRESSED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED) #define BUTTON5_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED) #define BUTTON5_DOUBLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED) #define BUTTON5_TRIPLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED) #define BUTTON_CTRL NCURSES_MOUSE_MASK(6, 0001L) #define BUTTON_SHIFT NCURSES_MOUSE_MASK(6, 0002L) #define BUTTON_ALT NCURSES_MOUSE_MASK(6, 0004L) #define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(6, 0010L) #else #define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT) #define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT) #define BUTTON3_RESERVED_EVENT NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT) #define BUTTON4_RESERVED_EVENT NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT) #define BUTTON_CTRL NCURSES_MOUSE_MASK(5, 0001L) #define BUTTON_SHIFT NCURSES_MOUSE_MASK(5, 0002L) #define BUTTON_ALT NCURSES_MOUSE_MASK(5, 0004L) #define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(5, 0010L) #endif #define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1) /* macros to extract single event-bits from masks */ #define BUTTON_RELEASE(e, x) ((e) & NCURSES_MOUSE_MASK(x, 001)) #define BUTTON_PRESS(e, x) ((e) & NCURSES_MOUSE_MASK(x, 002)) #define BUTTON_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 004)) #define BUTTON_DOUBLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 010)) #define BUTTON_TRIPLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 020)) #define BUTTON_RESERVED_EVENT(e, x) ((e) & NCURSES_MOUSE_MASK(x, 040)) typedef struct { short id; /* ID to distinguish multiple devices */ int x, y, z; /* event coordinates (character-cell) */ mmask_t bstate; /* button state bits */ } MEVENT; extern NCURSES_EXPORT(bool) has_mouse(void); extern NCURSES_EXPORT(int) getmouse (MEVENT *); extern NCURSES_EXPORT(int) ungetmouse (MEVENT *); extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *); extern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int); extern NCURSES_EXPORT(int) mouseinterval (int); extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW*, int*, int*, bool); extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool); /* generated */ #if NCURSES_SP_FUNCS extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_mouse) (SCREEN*); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(getmouse) (SCREEN*, MEVENT *); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetmouse) (SCREEN*,MEVENT *); extern NCURSES_EXPORT(mmask_t) NCURSES_SP_NAME(mousemask) (SCREEN*, mmask_t, mmask_t *); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mouseinterval) (SCREEN*, int); #endif #define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen) /* other non-XSI functions */ extern NCURSES_EXPORT(int) mcprint (char *, int); /* direct data to printer */ extern NCURSES_EXPORT(int) has_key (int); /* do we have given key? */ #if NCURSES_SP_FUNCS extern NCURSES_EXPORT(int) NCURSES_SP_NAME(has_key) (SCREEN*, int); /* do we have given key? */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mcprint) (SCREEN*, char *, int); /* direct data to printer */ #endif /* Debugging : use with libncurses_g.a */ extern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2); extern NCURSES_EXPORT(void) _tracedump (const char *, WINDOW *); extern NCURSES_EXPORT(char *) _traceattr (attr_t); extern NCURSES_EXPORT(char *) _traceattr2 (int, chtype); extern NCURSES_EXPORT(char *) _nc_tracebits (void); extern NCURSES_EXPORT(char *) _tracechar (int); extern NCURSES_EXPORT(char *) _tracechtype (chtype); extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype); #if NCURSES_WIDECHAR #define _tracech_t _tracecchar_t extern NCURSES_EXPORT(char *) _tracecchar_t (const cchar_t *); #define _tracech_t2 _tracecchar_t2 extern NCURSES_EXPORT(char *) _tracecchar_t2 (int, const cchar_t *); #else #define _tracech_t _tracechtype #define _tracech_t2 _tracechtype2 #endif extern NCURSES_EXPORT(char *) _tracemouse (const MEVENT *); extern NCURSES_EXPORT(void) trace (const unsigned int); /* trace masks */ #define TRACE_DISABLE 0x0000 /* turn off tracing */ #define TRACE_TIMES 0x0001 /* trace user and system times of updates */ #define TRACE_TPUTS 0x0002 /* trace tputs calls */ #define TRACE_UPDATE 0x0004 /* trace update actions, old & new screens */ #define TRACE_MOVE 0x0008 /* trace cursor moves and scrolls */ #define TRACE_CHARPUT 0x0010 /* trace all character outputs */ #define TRACE_ORDINARY 0x001F /* trace all update actions */ #define TRACE_CALLS 0x0020 /* trace all curses calls */ #define TRACE_VIRTPUT 0x0040 /* trace virtual character puts */ #define TRACE_IEVENT 0x0080 /* trace low-level input processing */ #define TRACE_BITS 0x0100 /* trace state of TTY control bits */ #define TRACE_ICALLS 0x0200 /* trace internal/nested calls */ #define TRACE_CCALLS 0x0400 /* trace per-character calls */ #define TRACE_DATABASE 0x0800 /* trace read/write of terminfo/termcap data */ #define TRACE_ATTRS 0x1000 /* trace attribute updates */ #define TRACE_SHIFT 13 /* number of bits in the trace masks */ #define TRACE_MAXIMUM ((1 << TRACE_SHIFT) - 1) /* maximum trace level */ #if defined(TRACE) || defined(NCURSES_TEST) extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */ extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *); #define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ #define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */ #define OPTIMIZE_SCROLL 0x04 /* scroll optimization */ #define OPTIMIZE_ALL 0xff /* enable all optimizations (dflt) */ #endif #include <unctrl.h> #ifdef __cplusplus #ifndef NCURSES_NOMACROS /* these names conflict with STL */ #undef box #undef clear #undef erase #undef move #undef refresh #endif /* NCURSES_NOMACROS */ } #endif #endif /* __NCURSES_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cursesf.h�������������������������������������������������������������������������������������������0000644�����������������00000066070�14763166026�0006413 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /**************************************************************************** * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ // $Id: cursesf.h,v 1.31 2012/12/29 21:49:58 tom Exp $ #ifndef NCURSES_CURSESF_H_incl #define NCURSES_CURSESF_H_incl 1 #include <cursesp.h> #ifndef __EXT_QNX #include <string.h> #endif extern "C" { # include <form.h> } // // ------------------------------------------------------------------------- // The abstract base class for buitin and user defined Fieldtypes. // ------------------------------------------------------------------------- // class NCURSES_IMPEXP NCursesFormField; // forward declaration // Class to represent builtin field types as well as C++ written new // fieldtypes (see classes UserDefineFieldType... class NCURSES_IMPEXP NCursesFieldType { friend class NCursesFormField; protected: FIELDTYPE* fieldtype; inline void OnError(int err) const THROW2(NCursesException const, NCursesFormException) { if (err!=E_OK) THROW(new NCursesFormException (err)); } NCursesFieldType(FIELDTYPE *f) : fieldtype(f) { } virtual ~NCursesFieldType() {} // Set the fields f fieldtype to this one. virtual void set(NCursesFormField& f) = 0; public: NCursesFieldType() : fieldtype(STATIC_CAST(FIELDTYPE*)(0)) { } NCursesFieldType& operator=(const NCursesFieldType& rhs) { if (this != &rhs) { *this = rhs; } return *this; } NCursesFieldType(const NCursesFieldType& rhs) : fieldtype(rhs.fieldtype) { } }; // // ------------------------------------------------------------------------- // The class representing a forms field, wrapping the lowlevel FIELD struct // ------------------------------------------------------------------------- // class NCURSES_IMPEXP NCursesFormField { friend class NCursesForm; protected: FIELD *field; // lowlevel structure NCursesFieldType* ftype; // Associated field type // Error handler inline void OnError (int err) const THROW2(NCursesException const, NCursesFormException) { if (err != E_OK) THROW(new NCursesFormException (err)); } public: // Create a 'Null' field. Can be used to delimit a field list NCursesFormField() : field(STATIC_CAST(FIELD*)(0)), ftype(STATIC_CAST(NCursesFieldType*)(0)) { } // Create a new field NCursesFormField (int rows, int ncols, int first_row = 0, int first_col = 0, int offscreen_rows = 0, int additional_buffers = 0) : field(0), ftype(STATIC_CAST(NCursesFieldType*)(0)) { field = ::new_field(rows, ncols, first_row, first_col, offscreen_rows, additional_buffers); if (!field) OnError(errno); } NCursesFormField& operator=(const NCursesFormField& rhs) { if (this != &rhs) { *this = rhs; } return *this; } NCursesFormField(const NCursesFormField& rhs) : field(rhs.field), ftype(rhs.ftype) { } virtual ~NCursesFormField (); // Duplicate the field at a new position inline NCursesFormField* dup(int first_row, int first_col) { NCursesFormField* f = new NCursesFormField(); if (!f) OnError(E_SYSTEM_ERROR); else { f->ftype = ftype; f->field = ::dup_field(field,first_row,first_col); if (!f->field) OnError(errno); } return f; } // Link the field to a new location inline NCursesFormField* link(int first_row, int first_col) { NCursesFormField* f = new NCursesFormField(); if (!f) OnError(E_SYSTEM_ERROR); else { f->ftype = ftype; f->field = ::link_field(field,first_row,first_col); if (!f->field) OnError(errno); } return f; } // Get the lowlevel field representation inline FIELD* get_field() const { return field; } // Retrieve info about the field inline void info(int& rows, int& ncols, int& first_row, int& first_col, int& offscreen_rows, int& additional_buffers) const { OnError(::field_info(field, &rows, &ncols, &first_row, &first_col, &offscreen_rows, &additional_buffers)); } // Retrieve info about the fields dynamic properties. inline void dynamic_info(int& dynamic_rows, int& dynamic_cols, int& max_growth) const { OnError(::dynamic_field_info(field, &dynamic_rows, &dynamic_cols, &max_growth)); } // For a dynamic field you may set the maximum growth limit. // A zero means unlimited growth. inline void set_maximum_growth(int growth = 0) { OnError(::set_max_field(field,growth)); } // Move the field to a new position inline void move(int row, int col) { OnError(::move_field(field,row,col)); } // Mark the field to start a new page inline void new_page(bool pageFlag = FALSE) { OnError(::set_new_page(field,pageFlag)); } // Retrieve whether or not the field starts a new page. inline bool is_new_page() const { return ::new_page(field); } // Set the justification for the field inline void set_justification(int just) { OnError(::set_field_just(field,just)); } // Retrieve the fields justification inline int justification() const { return ::field_just(field); } // Set the foreground attribute for the field inline void set_foreground(chtype foreground) { OnError(::set_field_fore(field,foreground)); } // Retrieve the fields foreground attribute inline chtype fore() const { return ::field_fore(field); } // Set the background attribute for the field inline void set_background(chtype background) { OnError(::set_field_back(field,background)); } // Retrieve the fields background attribute inline chtype back() const { return ::field_back(field); } // Set the padding character for the field inline void set_pad_character(int padding) { OnError(::set_field_pad(field, padding)); } // Retrieve the fields padding character inline int pad() const { return ::field_pad(field); } // Switch on the fields options inline void options_on (Field_Options opts) { OnError (::field_opts_on (field, opts)); } // Switch off the fields options inline void options_off (Field_Options opts) { OnError (::field_opts_off (field, opts)); } // Retrieve the fields options inline Field_Options options () const { return ::field_opts (field); } // Set the fields options inline void set_options (Field_Options opts) { OnError (::set_field_opts (field, opts)); } // Mark the field as changed inline void set_changed(bool changeFlag = TRUE) { OnError(::set_field_status(field,changeFlag)); } // Test whether or not the field is marked as changed inline bool changed() const { return ::field_status(field); } // Return the index of the field in the field array of a form // or -1 if the field is not associated to a form inline int (index)() const { return ::field_index(field); } // Store a value in a fields buffer. The default buffer is nr. 0 inline void set_value(const char *val, int buffer = 0) { OnError(::set_field_buffer(field,buffer,val)); } // Retrieve the value of a fields buffer. The default buffer is nr. 0 inline char* value(int buffer = 0) const { return ::field_buffer(field,buffer); } // Set the validation type of the field. inline void set_fieldtype(NCursesFieldType& f) { ftype = &f; f.set(*this); // A good friend may do that... } // Retrieve the validation type of the field. inline NCursesFieldType* fieldtype() const { return ftype; } }; // This are the built-in hook functions in this C++ binding. In C++ we use // virtual member functions (see below On_..._Init and On_..._Termination) // to provide this functionality in an object oriented manner. extern "C" { void _nc_xx_frm_init(FORM *); void _nc_xx_frm_term(FORM *); void _nc_xx_fld_init(FORM *); void _nc_xx_fld_term(FORM *); } // // ------------------------------------------------------------------------- // The class representing a form, wrapping the lowlevel FORM struct // ------------------------------------------------------------------------- // class NCURSES_IMPEXP NCursesForm : public NCursesPanel { protected: FORM* form; // the lowlevel structure private: NCursesWindow* sub; // the subwindow object bool b_sub_owner; // is this our own subwindow? bool b_framed; // has the form a border? bool b_autoDelete; // Delete fields when deleting form? NCursesFormField** my_fields; // The array of fields for this form // This structure is used for the form's user data field to link the // FORM* to the C++ object and to provide extra space for a user pointer. typedef struct { void* m_user; // the pointer for the user's data const NCursesForm* m_back; // backward pointer to C++ object const FORM* m_owner; } UserHook; // Get the backward pointer to the C++ object from a FORM static inline NCursesForm* getHook(const FORM *f) { UserHook* hook = reinterpret_cast<UserHook*>(::form_userptr(f)); assert(hook != 0 && hook->m_owner==f); return const_cast<NCursesForm*>(hook->m_back); } friend void _nc_xx_frm_init(FORM *); friend void _nc_xx_frm_term(FORM *); friend void _nc_xx_fld_init(FORM *); friend void _nc_xx_fld_term(FORM *); // Calculate FIELD* array for the menu FIELD** mapFields(NCursesFormField* nfields[]); protected: // internal routines inline void set_user(void *user) { UserHook* uptr = reinterpret_cast<UserHook*>(::form_userptr (form)); assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==form); uptr->m_user = user; } inline void *get_user() { UserHook* uptr = reinterpret_cast<UserHook*>(::form_userptr (form)); assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==form); return uptr->m_user; } void InitForm (NCursesFormField* Fields[], bool with_frame, bool autoDeleteFields); inline void OnError (int err) const THROW2(NCursesException const, NCursesFormException) { if (err != E_OK) THROW(new NCursesFormException (err)); } // this wraps the form_driver call. virtual int driver (int c) ; // 'Internal' constructor, builds an object without association to a // field array. NCursesForm( int nlines, int ncols, int begin_y = 0, int begin_x = 0) : NCursesPanel(nlines, ncols, begin_y, begin_x), form (STATIC_CAST(FORM*)(0)), sub(0), b_sub_owner(0), b_framed(0), b_autoDelete(0), my_fields(0) { } public: // Create form for the default panel. NCursesForm (NCursesFormField* Fields[], bool with_frame=FALSE, // reserve space for a frame? bool autoDelete_Fields=FALSE) // do automatic cleanup? : NCursesPanel(), form(0), sub(0), b_sub_owner(0), b_framed(0), b_autoDelete(0), my_fields(0) { InitForm(Fields, with_frame, autoDelete_Fields); } // Create a form in a panel with the given position and size. NCursesForm (NCursesFormField* Fields[], int nlines, int ncols, int begin_y, int begin_x, bool with_frame=FALSE, // reserve space for a frame? bool autoDelete_Fields=FALSE) // do automatic cleanup? : NCursesPanel(nlines, ncols, begin_y, begin_x), form(0), sub(0), b_sub_owner(0), b_framed(0), b_autoDelete(0), my_fields(0) { InitForm(Fields, with_frame, autoDelete_Fields); } NCursesForm& operator=(const NCursesForm& rhs) { if (this != &rhs) { *this = rhs; NCursesPanel::operator=(rhs); } return *this; } NCursesForm(const NCursesForm& rhs) : NCursesPanel(rhs), form(rhs.form), sub(rhs.sub), b_sub_owner(rhs.b_sub_owner), b_framed(rhs.b_framed), b_autoDelete(rhs.b_autoDelete), my_fields(rhs.my_fields) { } virtual ~NCursesForm(); // Set the default attributes for the form virtual void setDefaultAttributes(); // Retrieve current field of the form. inline NCursesFormField* current_field() const { return my_fields[::field_index(::current_field(form))]; } // Set the forms subwindow void setSubWindow(NCursesWindow& sub); // Set these fields for the form inline void setFields(NCursesFormField* Fields[]) { OnError(::set_form_fields(form,mapFields(Fields))); } // Remove the form from the screen inline void unpost (void) { OnError (::unpost_form (form)); } // Post the form to the screen if flag is true, unpost it otherwise inline void post(bool flag = TRUE) { OnError (flag ? ::post_form(form) : ::unpost_form (form)); } // Decorations inline void frame(const char *title=NULL, const char* btitle=NULL) { if (b_framed) NCursesPanel::frame(title,btitle); else OnError(E_SYSTEM_ERROR); } inline void boldframe(const char *title=NULL, const char* btitle=NULL) { if (b_framed) NCursesPanel::boldframe(title,btitle); else OnError(E_SYSTEM_ERROR); } inline void label(const char *topLabel, const char *bottomLabel) { if (b_framed) NCursesPanel::label(topLabel,bottomLabel); else OnError(E_SYSTEM_ERROR); } // ----- // Hooks // ----- // Called after the form gets repositioned in its window. // This is especially true if the form is posted. virtual void On_Form_Init(); // Called before the form gets repositioned in its window. // This is especially true if the form is unposted. virtual void On_Form_Termination(); // Called after the field became the current field virtual void On_Field_Init(NCursesFormField& field); // Called before this field is left as current field. virtual void On_Field_Termination(NCursesFormField& field); // Calculate required window size for the form. void scale(int& rows, int& ncols) const { OnError(::scale_form(form,&rows,&ncols)); } // Retrieve number of fields in the form. int count() const { return ::field_count(form); } // Make the page the current page of the form. void set_page(int pageNum) { OnError(::set_form_page(form, pageNum)); } // Retrieve current page number int page() const { return ::form_page(form); } // Switch on the forms options inline void options_on (Form_Options opts) { OnError (::form_opts_on (form, opts)); } // Switch off the forms options inline void options_off (Form_Options opts) { OnError (::form_opts_off (form, opts)); } // Retrieve the forms options inline Form_Options options () const { return ::form_opts (form); } // Set the forms options inline void set_options (Form_Options opts) { OnError (::set_form_opts (form, opts)); } // Are there more data in the current field after the data shown inline bool data_ahead() const { return ::data_ahead(form); } // Are there more data in the current field before the data shown inline bool data_behind() const { return ::data_behind(form); } // Position the cursor to the current field inline void position_cursor () { OnError (::pos_form_cursor (form)); } // Set the current field inline void set_current(NCursesFormField& F) { OnError (::set_current_field(form, F.field)); } // Provide a default key virtualization. Translate the keyboard // code c into a form request code. // The default implementation provides a hopefully straightforward // mapping for the most common keystrokes and form requests. virtual int virtualize(int c); // Operators inline NCursesFormField* operator[](int i) const { if ( (i < 0) || (i >= ::field_count (form)) ) OnError (E_BAD_ARGUMENT); return my_fields[i]; } // Perform the menu's operation // Return the field where you left the form. virtual NCursesFormField* operator()(void); // Exception handlers. The default is a Beep. virtual void On_Request_Denied(int c) const; virtual void On_Invalid_Field(int c) const; virtual void On_Unknown_Command(int c) const; }; // // ------------------------------------------------------------------------- // This is the typical C++ typesafe way to allow to attach // user data to a field of a form. Its assumed that the user // data belongs to some class T. Use T as template argument // to create a UserField. // ------------------------------------------------------------------------- template<class T> class NCURSES_IMPEXP NCursesUserField : public NCursesFormField { public: NCursesUserField (int rows, int ncols, int first_row = 0, int first_col = 0, const T* p_UserData = STATIC_CAST(T*)(0), int offscreen_rows = 0, int additional_buffers = 0) : NCursesFormField (rows, ncols, first_row, first_col, offscreen_rows, additional_buffers) { if (field) OnError(::set_field_userptr(field, STATIC_CAST(void *)(p_UserData))); } virtual ~NCursesUserField() {}; inline const T* UserData (void) const { return reinterpret_cast<const T*>(::field_userptr (field)); } inline virtual void setUserData(const T* p_UserData) { if (field) OnError (::set_field_userptr (field, STATIC_CAST(void *)(p_UserData))); } }; // // ------------------------------------------------------------------------- // The same mechanism is used to attach user data to a form // ------------------------------------------------------------------------- // template<class T> class NCURSES_IMPEXP NCursesUserForm : public NCursesForm { protected: // 'Internal' constructor, builds an object without association to a // field array. NCursesUserForm( int nlines, int ncols, int begin_y = 0, int begin_x = 0, const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesForm(nlines,ncols,begin_y,begin_x) { if (form) set_user (const_cast<void *>(p_UserData)); } public: NCursesUserForm (NCursesFormField* Fields[], const T* p_UserData = STATIC_CAST(T*)(0), bool with_frame=FALSE, bool autoDelete_Fields=FALSE) : NCursesForm (Fields, with_frame, autoDelete_Fields) { if (form) set_user (const_cast<void *>(p_UserData)); }; NCursesUserForm (NCursesFormField* Fields[], int nlines, int ncols, int begin_y = 0, int begin_x = 0, const T* p_UserData = STATIC_CAST(T*)(0), bool with_frame=FALSE, bool autoDelete_Fields=FALSE) : NCursesForm (Fields, nlines, ncols, begin_y, begin_x, with_frame, autoDelete_Fields) { if (form) set_user (const_cast<void *>(p_UserData)); }; virtual ~NCursesUserForm() { }; inline T* UserData (void) const { return reinterpret_cast<T*>(get_user ()); }; inline virtual void setUserData (const T* p_UserData) { if (form) set_user (const_cast<void *>(p_UserData)); } }; // // ------------------------------------------------------------------------- // Builtin Fieldtypes // ------------------------------------------------------------------------- // class NCURSES_IMPEXP Alpha_Field : public NCursesFieldType { private: int min_field_width; void set(NCursesFormField& f) { OnError(::set_field_type(f.get_field(),fieldtype,min_field_width)); } public: Alpha_Field(int width) : NCursesFieldType(TYPE_ALPHA), min_field_width(width) { } }; class NCURSES_IMPEXP Alphanumeric_Field : public NCursesFieldType { private: int min_field_width; void set(NCursesFormField& f) { OnError(::set_field_type(f.get_field(),fieldtype,min_field_width)); } public: Alphanumeric_Field(int width) : NCursesFieldType(TYPE_ALNUM), min_field_width(width) { } }; class NCURSES_IMPEXP Integer_Field : public NCursesFieldType { private: int precision; long lower_limit, upper_limit; void set(NCursesFormField& f) { OnError(::set_field_type(f.get_field(),fieldtype, precision,lower_limit,upper_limit)); } public: Integer_Field(int prec, long low=0L, long high=0L) : NCursesFieldType(TYPE_INTEGER), precision(prec), lower_limit(low), upper_limit(high) { } }; class NCURSES_IMPEXP Numeric_Field : public NCursesFieldType { private: int precision; double lower_limit, upper_limit; void set(NCursesFormField& f) { OnError(::set_field_type(f.get_field(),fieldtype, precision,lower_limit,upper_limit)); } public: Numeric_Field(int prec, double low=0.0, double high=0.0) : NCursesFieldType(TYPE_NUMERIC), precision(prec), lower_limit(low), upper_limit(high) { } }; class NCURSES_IMPEXP Regular_Expression_Field : public NCursesFieldType { private: char* regex; void set(NCursesFormField& f) { OnError(::set_field_type(f.get_field(),fieldtype,regex)); } void copy_regex(const char *source) { regex = new char[1 + ::strlen(source)]; (::strcpy)(regex, source); } public: Regular_Expression_Field(const char *expr) : NCursesFieldType(TYPE_REGEXP), regex(NULL) { copy_regex(expr); } Regular_Expression_Field& operator=(const Regular_Expression_Field& rhs) { if (this != &rhs) { *this = rhs; copy_regex(rhs.regex); NCursesFieldType::operator=(rhs); } return *this; } Regular_Expression_Field(const Regular_Expression_Field& rhs) : NCursesFieldType(rhs), regex(NULL) { copy_regex(rhs.regex); } ~Regular_Expression_Field() { delete[] regex; } }; class NCURSES_IMPEXP Enumeration_Field : public NCursesFieldType { private: const char** list; int case_sensitive; int non_unique_matches; void set(NCursesFormField& f) { OnError(::set_field_type(f.get_field(),fieldtype, list,case_sensitive,non_unique_matches)); } public: Enumeration_Field(const char* enums[], bool case_sens=FALSE, bool non_unique=FALSE) : NCursesFieldType(TYPE_ENUM), list(enums), case_sensitive(case_sens ? -1 : 0), non_unique_matches(non_unique ? -1 : 0) { } Enumeration_Field& operator=(const Enumeration_Field& rhs) { if (this != &rhs) { *this = rhs; NCursesFieldType::operator=(rhs); } return *this; } Enumeration_Field(const Enumeration_Field& rhs) : NCursesFieldType(rhs), list(rhs.list), case_sensitive(rhs.case_sensitive), non_unique_matches(rhs.non_unique_matches) { } }; class NCURSES_IMPEXP IPV4_Address_Field : public NCursesFieldType { private: void set(NCursesFormField& f) { OnError(::set_field_type(f.get_field(),fieldtype)); } public: IPV4_Address_Field() : NCursesFieldType(TYPE_IPV4) { } }; extern "C" { bool _nc_xx_fld_fcheck(FIELD *, const void*); bool _nc_xx_fld_ccheck(int c, const void *); void* _nc_xx_fld_makearg(va_list*); } // // ------------------------------------------------------------------------- // Abstract base class for User-Defined Fieldtypes // ------------------------------------------------------------------------- // class NCURSES_IMPEXP UserDefinedFieldType : public NCursesFieldType { friend class UDF_Init; // Internal helper to set up statics private: // For all C++ defined fieldtypes we need only one generic lowlevel // FIELDTYPE* element. static FIELDTYPE* generic_fieldtype; protected: // This are the functions required by the low level libforms functions // to construct a fieldtype. friend bool _nc_xx_fld_fcheck(FIELD *, const void*); friend bool _nc_xx_fld_ccheck(int c, const void *); friend void* _nc_xx_fld_makearg(va_list*); void set(NCursesFormField& f) { OnError(::set_field_type(f.get_field(),fieldtype,&f)); } protected: // Redefine this function to do a field validation. The argument // is a reference to the field you should validate. virtual bool field_check(NCursesFormField& f) = 0; // Redefine this function to do a character validation. The argument // is the character to be validated. virtual bool char_check (int c) = 0; public: UserDefinedFieldType() : NCursesFieldType(generic_fieldtype) { } }; extern "C" { bool _nc_xx_next_choice(FIELD*, const void *); bool _nc_xx_prev_choice(FIELD*, const void *); } // // ------------------------------------------------------------------------- // Abstract base class for User-Defined Fieldtypes with Choice functions // ------------------------------------------------------------------------- // class NCURSES_IMPEXP UserDefinedFieldType_With_Choice : public UserDefinedFieldType { friend class UDF_Init; // Internal helper to set up statics private: // For all C++ defined fieldtypes with choice functions we need only one // generic lowlevel FIELDTYPE* element. static FIELDTYPE* generic_fieldtype_with_choice; // This are the functions required by the low level libforms functions // to construct a fieldtype with choice functions. friend bool _nc_xx_next_choice(FIELD*, const void *); friend bool _nc_xx_prev_choice(FIELD*, const void *); protected: // Redefine this function to do the retrieval of the next choice value. // The argument is a reference to the field tobe examined. virtual bool next (NCursesFormField& f) = 0; // Redefine this function to do the retrieval of the previous choice value. // The argument is a reference to the field tobe examined. virtual bool previous(NCursesFormField& f) = 0; public: UserDefinedFieldType_With_Choice() { fieldtype = generic_fieldtype_with_choice; } }; #endif /* NCURSES_CURSESF_H_incl */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cursesp.h�������������������������������������������������������������������������������������������0000644�����������������00000020461�14763166026�0006417 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** * Copyright (c) 1998-2008,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /**************************************************************************** * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ #ifndef NCURSES_CURSESP_H_incl #define NCURSES_CURSESP_H_incl 1 // $Id: cursesp.h,v 1.30 2012/12/29 21:50:55 tom Exp $ #include <cursesw.h> extern "C" { # include <panel.h> } class NCURSES_IMPEXP NCursesPanel : public NCursesWindow { protected: PANEL *p; static NCursesPanel *dummy; private: // This structure is used for the panel's user data field to link the // PANEL* to the C++ object and to provide extra space for a user pointer. typedef struct { void* m_user; // the pointer for the user's data const NCursesPanel* m_back; // backward pointer to C++ object const PANEL* m_owner; // the panel itself } UserHook; inline UserHook *UserPointer() { UserHook* uptr = reinterpret_cast<UserHook*>( const_cast<void *>(::panel_userptr (p))); return uptr; } void init(); // Initialize the panel object protected: void set_user(void *user) { UserHook* uptr = UserPointer(); if (uptr != 0 && uptr->m_back==this && uptr->m_owner==p) { uptr->m_user = user; } } // Set the user pointer of the panel. void *get_user() { UserHook* uptr = UserPointer(); void *result = 0; if (uptr != 0 && uptr->m_back==this && uptr->m_owner==p) result = uptr->m_user; return result; } void OnError (int err) const THROW2(NCursesException const, NCursesPanelException) { if (err==ERR) THROW(new NCursesPanelException (this, err)); } // If err is equal to the curses error indicator ERR, an error handler // is called. // Get a keystroke. Default implementation calls getch() virtual int getKey(void); public: NCursesPanel(int nlines, int ncols, int begin_y = 0, int begin_x = 0) : NCursesWindow(nlines,ncols,begin_y,begin_x), p(0) { init(); } // Create a panel with this size starting at the requested position. NCursesPanel() : NCursesWindow(::stdscr), p(0) { init(); } // This constructor creates the default Panel associated with the // ::stdscr window NCursesPanel& operator=(const NCursesPanel& rhs) { if (this != &rhs) { *this = rhs; NCursesWindow::operator=(rhs); } return *this; } NCursesPanel(const NCursesPanel& rhs) : NCursesWindow(rhs), p(rhs.p) { } virtual ~NCursesPanel(); // basic manipulation inline void hide() { OnError (::hide_panel(p)); } // Hide the panel. It stays in the stack but becomes invisible. inline void show() { OnError (::show_panel(p)); } // Show the panel, i.e. make it visible. inline void top() { OnError (::top_panel(p)); } // Make this panel the top panel in the stack. inline void bottom() { OnError (::bottom_panel(p)); } // Make this panel the bottom panel in the stack. // N.B.: The panel associated with ::stdscr is always on the bottom. So // actually bottom() makes the panel the first above ::stdscr. virtual int mvwin(int y, int x) { OnError(::move_panel(p, y, x)); return OK; } inline bool hidden() const { return (::panel_hidden (p) ? TRUE : FALSE); } // Return TRUE if the panel is hidden, FALSE otherwise. /* The functions panel_above() and panel_below() are not reflected in the NCursesPanel class. The reason for this is, that we cannot assume that a panel retrieved by those operations is one wrapped by a C++ class. Although this situation might be handled, we also need a reverse mapping from PANEL to NCursesPanel which needs some redesign of the low level stuff. At the moment, we define them in the interface but they will always produce an error. */ inline NCursesPanel& above() const { OnError(ERR); return *dummy; } inline NCursesPanel& below() const { OnError(ERR); return *dummy; } // Those two are rewrites of the corresponding virtual members of // NCursesWindow virtual int refresh(); // Propagate all panel changes to the virtual screen and update the // physical screen. virtual int noutrefresh(); // Propagate all panel changes to the virtual screen. static void redraw(); // Redraw all panels. // decorations virtual void frame(const char* title=NULL, const char* btitle=NULL); // Put a frame around the panel and put the title centered in the top line // and btitle in the bottom line. virtual void boldframe(const char* title=NULL, const char* btitle=NULL); // Same as frame(), but use highlighted attributes. virtual void label(const char* topLabel, const char* bottomLabel); // Put the title centered in the top line and btitle in the bottom line. virtual void centertext(int row,const char* label); // Put the label text centered in the specified row. }; /* We use templates to provide a typesafe mechanism to associate * user data with a panel. A NCursesUserPanel<T> is a panel * associated with some user data of type T. */ template<class T> class NCursesUserPanel : public NCursesPanel { public: NCursesUserPanel (int nlines, int ncols, int begin_y = 0, int begin_x = 0, const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesPanel (nlines, ncols, begin_y, begin_x) { if (p) set_user (const_cast<void *>(p_UserData)); }; // This creates an user panel of the requested size with associated // user data pointed to by p_UserData. NCursesUserPanel(const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesPanel() { if (p) set_user(const_cast<void *>(p_UserData)); }; // This creates an user panel associated with the ::stdscr and user data // pointed to by p_UserData. virtual ~NCursesUserPanel() {}; T* UserData (void) const { return reinterpret_cast<T*>(get_user ()); }; // Retrieve the user data associated with the panel. virtual void setUserData (const T* p_UserData) { if (p) set_user (const_cast<void *>(p_UserData)); } // Associate the user panel with the user data pointed to by p_UserData. }; #endif /* NCURSES_CURSESP_H_incl */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������unctrl.h��������������������������������������������������������������������������������������������0000644�����������������00000006033�14763166026�0006241 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/**************************************************************************** * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /**************************************************************************** * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ /* * unctrl.h * * Display a printable version of a control character. * Control characters are displayed in caret notation (^x), DELETE is displayed * as ^?. Printable characters are displayed as is. */ /* $Id: unctrl.h.in,v 1.11 2009/04/18 21:00:52 tom Exp $ */ #ifndef NCURSES_UNCTRL_H_incl #define NCURSES_UNCTRL_H_incl 1 #undef NCURSES_VERSION #define NCURSES_VERSION "5.9" #ifdef __cplusplus extern "C" { #endif #include <curses.h> #undef unctrl NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype); #if 0 NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, chtype); #endif #ifdef __cplusplus } #endif #endif /* NCURSES_UNCTRL_H_incl */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cursesm.h�������������������������������������������������������������������������������������������0000644�����������������00000046140�14763166026�0006416 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /**************************************************************************** * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ // $Id: cursesm.h,v 1.29 2012/12/29 21:48:33 tom Exp $ #ifndef NCURSES_CURSESM_H_incl #define NCURSES_CURSESM_H_incl 1 #include <cursesp.h> extern "C" { # include <menu.h> } // // ------------------------------------------------------------------------- // This wraps the ITEM type of <menu.h> // ------------------------------------------------------------------------- // class NCURSES_IMPEXP NCursesMenuItem { friend class NCursesMenu; protected: ITEM *item; inline void OnError (int err) const THROW2(NCursesException const, NCursesMenuException) { if (err != E_OK) THROW(new NCursesMenuException (err)); } public: NCursesMenuItem (const char* p_name = NULL, const char* p_descript = NULL) : item(0) { item = p_name ? ::new_item (p_name, p_descript) : STATIC_CAST(ITEM*)(0); if (p_name && !item) OnError (E_SYSTEM_ERROR); } // Create an item. If you pass both parameters as NULL, a delimiting // item is constructed which can be used to terminate a list of // NCursesMenu objects. NCursesMenuItem& operator=(const NCursesMenuItem& rhs) { if (this != &rhs) { *this = rhs; } return *this; } NCursesMenuItem(const NCursesMenuItem& rhs) : item(0) { (void) rhs; } virtual ~NCursesMenuItem (); // Release the items memory inline const char* name () const { return ::item_name (item); } // Name of the item inline const char* description () const { return ::item_description (item); } // Description of the item inline int (index) (void) const { return ::item_index (item); } // Index of the item in an item array (or -1) inline void options_on (Item_Options opts) { OnError (::item_opts_on (item, opts)); } // Switch on the items options inline void options_off (Item_Options opts) { OnError (::item_opts_off (item, opts)); } // Switch off the item's option inline Item_Options options () const { return ::item_opts (item); } // Retrieve the items options inline void set_options (Item_Options opts) { OnError (::set_item_opts (item, opts)); } // Set the items options inline void set_value (bool f) { OnError (::set_item_value (item,f)); } // Set/Reset the items selection state inline bool value () const { return ::item_value (item); } // Retrieve the items selection state inline bool visible () const { return ::item_visible (item); } // Retrieve visibility of the item virtual bool action(); // Perform an action associated with this item; you may use this in an // user supplied driver for a menu; you may derive from this class and // overload action() to supply items with different actions. // If an action returns true, the menu will be exited. The default action // is to do nothing. }; // Prototype for an items callback function. typedef bool ITEMCALLBACK(NCursesMenuItem&); // If you don't like to create a child class for individual items to // overload action(), you may use this class and provide a callback // function pointer for items. class NCURSES_IMPEXP NCursesMenuCallbackItem : public NCursesMenuItem { private: ITEMCALLBACK* p_fct; public: NCursesMenuCallbackItem(ITEMCALLBACK* fct = NULL, const char* p_name = NULL, const char* p_descript = NULL ) : NCursesMenuItem (p_name, p_descript), p_fct (fct) { } NCursesMenuCallbackItem& operator=(const NCursesMenuCallbackItem& rhs) { if (this != &rhs) { *this = rhs; } return *this; } NCursesMenuCallbackItem(const NCursesMenuCallbackItem& rhs) : NCursesMenuItem(rhs), p_fct(0) { } virtual ~NCursesMenuCallbackItem(); bool action(); }; // This are the built-in hook functions in this C++ binding. In C++ we use // virtual member functions (see below On_..._Init and On_..._Termination) // to provide this functionality in an object oriented manner. extern "C" { void _nc_xx_mnu_init(MENU *); void _nc_xx_mnu_term(MENU *); void _nc_xx_itm_init(MENU *); void _nc_xx_itm_term(MENU *); } // // ------------------------------------------------------------------------- // This wraps the MENU type of <menu.h> // ------------------------------------------------------------------------- // class NCURSES_IMPEXP NCursesMenu : public NCursesPanel { protected: MENU *menu; private: NCursesWindow* sub; // the subwindow object bool b_sub_owner; // is this our own subwindow? bool b_framed; // has the menu a border? bool b_autoDelete; // Delete items when deleting menu? NCursesMenuItem** my_items; // The array of items for this menu // This structure is used for the menu's user data field to link the // MENU* to the C++ object and to provide extra space for a user pointer. typedef struct { void* m_user; // the pointer for the user's data const NCursesMenu* m_back; // backward pointer to C++ object const MENU* m_owner; } UserHook; // Get the backward pointer to the C++ object from a MENU static inline NCursesMenu* getHook(const MENU *m) { UserHook* hook = STATIC_CAST(UserHook*)(::menu_userptr(m)); assert(hook != 0 && hook->m_owner==m); return const_cast<NCursesMenu*>(hook->m_back); } friend void _nc_xx_mnu_init(MENU *); friend void _nc_xx_mnu_term(MENU *); friend void _nc_xx_itm_init(MENU *); friend void _nc_xx_itm_term(MENU *); // Calculate ITEM* array for the menu ITEM** mapItems(NCursesMenuItem* nitems[]); protected: // internal routines inline void set_user(void *user) { UserHook* uptr = STATIC_CAST(UserHook*)(::menu_userptr (menu)); assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==menu); uptr->m_user = user; } inline void *get_user() { UserHook* uptr = STATIC_CAST(UserHook*)(::menu_userptr (menu)); assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==menu); return uptr->m_user; } void InitMenu (NCursesMenuItem* menu[], bool with_frame, bool autoDeleteItems); inline void OnError (int err) const THROW2(NCursesException const, NCursesMenuException) { if (err != E_OK) THROW(new NCursesMenuException (this, err)); } // this wraps the menu_driver call. virtual int driver (int c) ; // 'Internal' constructor to create a menu without association to // an array of items. NCursesMenu( int nlines, int ncols, int begin_y = 0, int begin_x = 0) : NCursesPanel(nlines,ncols,begin_y,begin_x), menu (STATIC_CAST(MENU*)(0)), sub(0), b_sub_owner(0), b_framed(0), b_autoDelete(0), my_items(0) { } public: // Make a full window size menu NCursesMenu (NCursesMenuItem* Items[], bool with_frame=FALSE, // Reserve space for a frame? bool autoDelete_Items=FALSE) // Autocleanup of Items? : NCursesPanel(), menu(0), sub(0), b_sub_owner(0), b_framed(0), b_autoDelete(0), my_items(0) { InitMenu(Items, with_frame, autoDelete_Items); } // Make a menu with a window of this size. NCursesMenu (NCursesMenuItem* Items[], int nlines, int ncols, int begin_y = 0, int begin_x = 0, bool with_frame=FALSE, // Reserve space for a frame? bool autoDelete_Items=FALSE) // Autocleanup of Items? : NCursesPanel(nlines, ncols, begin_y, begin_x), menu(0), sub(0), b_sub_owner(0), b_framed(0), b_autoDelete(0), my_items(0) { InitMenu(Items, with_frame, autoDelete_Items); } NCursesMenu& operator=(const NCursesMenu& rhs) { if (this != &rhs) { *this = rhs; NCursesPanel::operator=(rhs); } return *this; } NCursesMenu(const NCursesMenu& rhs) : NCursesPanel(rhs), menu(rhs.menu), sub(rhs.sub), b_sub_owner(rhs.b_sub_owner), b_framed(rhs.b_framed), b_autoDelete(rhs.b_autoDelete), my_items(rhs.my_items) { } virtual ~NCursesMenu (); // Retrieve the menus subwindow inline NCursesWindow& subWindow() const { assert(sub!=NULL); return *sub; } // Set the menus subwindow void setSubWindow(NCursesWindow& sub); // Set these items for the menu inline void setItems(NCursesMenuItem* Items[]) { OnError(::set_menu_items(menu,mapItems(Items))); } // Remove the menu from the screen inline void unpost (void) { OnError (::unpost_menu (menu)); } // Post the menu to the screen if flag is true, unpost it otherwise inline void post(bool flag = TRUE) { flag ? OnError (::post_menu(menu)) : OnError (::unpost_menu (menu)); } // Get the numer of rows and columns for this menu inline void scale (int& mrows, int& mcols) const { OnError (::scale_menu (menu, &mrows, &mcols)); } // Set the format of this menu inline void set_format(int mrows, int mcols) { OnError (::set_menu_format(menu, mrows, mcols)); } // Get the format of this menu inline void menu_format(int& rows,int& ncols) { ::menu_format(menu,&rows,&ncols); } // Items of the menu inline NCursesMenuItem* items() const { return *my_items; } // Get the number of items in this menu inline int count() const { return ::item_count(menu); } // Get the current item (i.e. the one the cursor is located) inline NCursesMenuItem* current_item() const { return my_items[::item_index(::current_item(menu))]; } // Get the marker string inline const char* mark() const { return ::menu_mark(menu); } // Set the marker string inline void set_mark(const char *marker) { OnError (::set_menu_mark (menu, marker)); } // Get the name of the request code c inline static const char* request_name(int c) { return ::menu_request_name(c); } // Get the current pattern inline char* pattern() const { return ::menu_pattern(menu); } // true if there is a pattern match, false otherwise. bool set_pattern (const char *pat); // set the default attributes for the menu // i.e. set fore, back and grey attribute virtual void setDefaultAttributes(); // Get the menus background attributes inline chtype back() const { return ::menu_back(menu); } // Get the menus foreground attributes inline chtype fore() const { return ::menu_fore(menu); } // Get the menus grey attributes (used for unselectable items) inline chtype grey() const { return ::menu_grey(menu); } // Set the menus background attributes inline chtype set_background(chtype a) { return ::set_menu_back(menu,a); } // Set the menus foreground attributes inline chtype set_foreground(chtype a) { return ::set_menu_fore(menu,a); } // Set the menus grey attributes (used for unselectable items) inline chtype set_grey(chtype a) { return ::set_menu_grey(menu,a); } inline void options_on (Menu_Options opts) { OnError (::menu_opts_on (menu,opts)); } inline void options_off(Menu_Options opts) { OnError (::menu_opts_off(menu,opts)); } inline Menu_Options options() const { return ::menu_opts(menu); } inline void set_options (Menu_Options opts) { OnError (::set_menu_opts (menu,opts)); } inline int pad() const { return ::menu_pad(menu); } inline void set_pad (int padch) { OnError (::set_menu_pad (menu, padch)); } // Position the cursor to the current item inline void position_cursor () const { OnError (::pos_menu_cursor (menu)); } // Set the current item inline void set_current(NCursesMenuItem& I) { OnError (::set_current_item(menu, I.item)); } // Get the current top row of the menu inline int top_row (void) const { return ::top_row (menu); } // Set the current top row of the menu inline void set_top_row (int row) { OnError (::set_top_row (menu, row)); } // spacing control // Set the spacing for the menu inline void setSpacing(int spc_description, int spc_rows, int spc_columns) { OnError(::set_menu_spacing(menu, spc_description, spc_rows, spc_columns)); } // Get the spacing info for the menu inline void Spacing(int& spc_description, int& spc_rows, int& spc_columns) const { OnError(::menu_spacing(menu, &spc_description, &spc_rows, &spc_columns)); } // Decorations inline void frame(const char *title=NULL, const char* btitle=NULL) { if (b_framed) NCursesPanel::frame(title,btitle); else OnError(E_SYSTEM_ERROR); } inline void boldframe(const char *title=NULL, const char* btitle=NULL) { if (b_framed) NCursesPanel::boldframe(title,btitle); else OnError(E_SYSTEM_ERROR); } inline void label(const char *topLabel, const char *bottomLabel) { if (b_framed) NCursesPanel::label(topLabel,bottomLabel); else OnError(E_SYSTEM_ERROR); } // ----- // Hooks // ----- // Called after the menu gets repositioned in its window. // This is especially true if the menu is posted. virtual void On_Menu_Init(); // Called before the menu gets repositioned in its window. // This is especially true if the menu is unposted. virtual void On_Menu_Termination(); // Called after the item became the current item virtual void On_Item_Init(NCursesMenuItem& item); // Called before this item is left as current item. virtual void On_Item_Termination(NCursesMenuItem& item); // Provide a default key virtualization. Translate the keyboard // code c into a menu request code. // The default implementation provides a hopefully straightforward // mapping for the most common keystrokes and menu requests. virtual int virtualize(int c); // Operators inline NCursesMenuItem* operator[](int i) const { if ( (i < 0) || (i >= ::item_count (menu)) ) OnError (E_BAD_ARGUMENT); return (my_items[i]); } // Perform the menu's operation // Return the item where you left the selection mark for a single // selection menu, or NULL for a multivalued menu. virtual NCursesMenuItem* operator()(void); // -------------------- // Exception handlers // Called by operator() // -------------------- // Called if the request is denied virtual void On_Request_Denied(int c) const; // Called if the item is not selectable virtual void On_Not_Selectable(int c) const; // Called if pattern doesn't match virtual void On_No_Match(int c) const; // Called if the command is unknown virtual void On_Unknown_Command(int c) const; }; // // ------------------------------------------------------------------------- // This is the typical C++ typesafe way to allow to attach // user data to an item of a menu. Its assumed that the user // data belongs to some class T. Use T as template argument // to create a UserItem. // ------------------------------------------------------------------------- // template<class T> class NCURSES_IMPEXP NCursesUserItem : public NCursesMenuItem { public: NCursesUserItem (const char* p_name, const char* p_descript = NULL, const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesMenuItem (p_name, p_descript) { if (item) OnError (::set_item_userptr (item, const_cast<void *>(reinterpret_cast<const void*>(p_UserData)))); } virtual ~NCursesUserItem() {} inline const T* UserData (void) const { return reinterpret_cast<const T*>(::item_userptr (item)); }; inline virtual void setUserData(const T* p_UserData) { if (item) OnError (::set_item_userptr (item, const_cast<void *>(reinterpret_cast<const void *>(p_UserData)))); } }; // // ------------------------------------------------------------------------- // The same mechanism is used to attach user data to a menu // ------------------------------------------------------------------------- // template<class T> class NCURSES_IMPEXP NCursesUserMenu : public NCursesMenu { protected: NCursesUserMenu( int nlines, int ncols, int begin_y = 0, int begin_x = 0, const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesMenu(nlines,ncols,begin_y,begin_x) { if (menu) set_user (const_cast<void *>(p_UserData)); } public: NCursesUserMenu (NCursesMenuItem* Items[], const T* p_UserData = STATIC_CAST(T*)(0), bool with_frame=FALSE, bool autoDelete_Items=FALSE) : NCursesMenu (Items, with_frame, autoDelete_Items) { if (menu) set_user (const_cast<void *>(p_UserData)); }; NCursesUserMenu (NCursesMenuItem* Items[], int nlines, int ncols, int begin_y = 0, int begin_x = 0, const T* p_UserData = STATIC_CAST(T*)(0), bool with_frame=FALSE) : NCursesMenu (Items, nlines, ncols, begin_y, begin_x, with_frame) { if (menu) set_user (const_cast<void *>(p_UserData)); }; virtual ~NCursesUserMenu() { }; inline T* UserData (void) const { return reinterpret_cast<T*>(get_user ()); }; inline virtual void setUserData (const T* p_UserData) { if (menu) set_user (const_cast<void *>(p_UserData)); } }; #endif /* NCURSES_CURSESM_H_incl */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������panel.h���������������������������������������������������������������������������������������������0000644�����������������00000007736�14763166026�0006044 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/**************************************************************************** * Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /**************************************************************************** * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 * * and: Eric S. Raymond <esr@snark.thyrsus.com> * * and: Juergen Pfeifer 1996-1999,2008 * ****************************************************************************/ /* $Id: panel.h,v 1.11 2009/04/11 19:50:40 tom Exp $ */ /* panel.h -- interface file for panels library */ #ifndef NCURSES_PANEL_H_incl #define NCURSES_PANEL_H_incl 1 #include <curses.h> typedef struct panel { WINDOW *win; struct panel *below; struct panel *above; NCURSES_CONST void *user; } PANEL; #if defined(__cplusplus) extern "C" { #endif extern NCURSES_EXPORT(WINDOW*) panel_window (const PANEL *); extern NCURSES_EXPORT(void) update_panels (void); extern NCURSES_EXPORT(int) hide_panel (PANEL *); extern NCURSES_EXPORT(int) show_panel (PANEL *); extern NCURSES_EXPORT(int) del_panel (PANEL *); extern NCURSES_EXPORT(int) top_panel (PANEL *); extern NCURSES_EXPORT(int) bottom_panel (PANEL *); extern NCURSES_EXPORT(PANEL*) new_panel (WINDOW *); extern NCURSES_EXPORT(PANEL*) panel_above (const PANEL *); extern NCURSES_EXPORT(PANEL*) panel_below (const PANEL *); extern NCURSES_EXPORT(int) set_panel_userptr (PANEL *, NCURSES_CONST void *); extern NCURSES_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *); extern NCURSES_EXPORT(int) move_panel (PANEL *, int, int); extern NCURSES_EXPORT(int) replace_panel (PANEL *,WINDOW *); extern NCURSES_EXPORT(int) panel_hidden (const PANEL *); #if NCURSES_SP_FUNCS extern NCURSES_EXPORT(PANEL *) ground_panel(SCREEN *); extern NCURSES_EXPORT(PANEL *) ceiling_panel(SCREEN *); extern NCURSES_EXPORT(void) NCURSES_SP_NAME(update_panels) (SCREEN*); #endif #if defined(__cplusplus) } #endif #endif /* NCURSES_PANEL_H_incl */ /* end of panel.h */ ����������������������������������form.h����������������������������������������������������������������������������������������������0000644�����������������00000043102�14763166026�0005673 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/**************************************************************************** * Copyright (c) 1998-2004,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /**************************************************************************** * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ /* $Id: form.h,v 0.21 2009/11/07 19:31:11 tom Exp $ */ #ifndef FORM_H #define FORM_H #include <curses.h> #include <eti.h> #ifdef __cplusplus extern "C" { #endif #ifndef FORM_PRIV_H typedef void *FIELD_CELL; #endif #ifndef NCURSES_FIELD_INTERNALS #define NCURSES_FIELD_INTERNALS /* nothing */ #endif typedef int Form_Options; typedef int Field_Options; /********** * _PAGE * **********/ typedef struct { short pmin; /* index of first field on page */ short pmax; /* index of last field on page */ short smin; /* index of top leftmost field on page */ short smax; /* index of bottom rightmost field on page */ } _PAGE; /********** * FIELD * **********/ typedef struct fieldnode { unsigned short status; /* flags */ short rows; /* size in rows */ short cols; /* size in cols */ short frow; /* first row */ short fcol; /* first col */ int drows; /* dynamic rows */ int dcols; /* dynamic cols */ int maxgrow; /* maximum field growth */ int nrow; /* off-screen rows */ short nbuf; /* additional buffers */ short just; /* justification */ short page; /* page on form */ short index; /* into form -> field */ int pad; /* pad character */ chtype fore; /* foreground attribute */ chtype back; /* background attribute */ Field_Options opts; /* options */ struct fieldnode * snext; /* sorted order pointer */ struct fieldnode * sprev; /* sorted order pointer */ struct fieldnode * link; /* linked field chain */ struct formnode * form; /* containing form */ struct typenode * type; /* field type */ void * arg; /* argument for type */ FIELD_CELL * buf; /* field buffers */ void * usrptr; /* user pointer */ /* * The wide-character configuration requires extra information. Because * there are existing applications that manipulate the members of FIELD * directly, we cannot make the struct opaque. Offsets of members up to * this point are the same in the narrow- and wide-character configuration. * But note that the type of buf depends on the configuration, and is made * opaque for that reason. */ NCURSES_FIELD_INTERNALS } FIELD; /********* * FORM * *********/ typedef struct formnode { unsigned short status; /* flags */ short rows; /* size in rows */ short cols; /* size in cols */ int currow; /* current row in field window */ int curcol; /* current col in field window */ int toprow; /* in scrollable field window */ int begincol; /* in horiz. scrollable field */ short maxfield; /* number of fields */ short maxpage; /* number of pages */ short curpage; /* index into page */ Form_Options opts; /* options */ WINDOW * win; /* window */ WINDOW * sub; /* subwindow */ WINDOW * w; /* window for current field */ FIELD ** field; /* field [maxfield] */ FIELD * current; /* current field */ _PAGE * page; /* page [maxpage] */ void * usrptr; /* user pointer */ void (*forminit)(struct formnode *); void (*formterm)(struct formnode *); void (*fieldinit)(struct formnode *); void (*fieldterm)(struct formnode *); } FORM; /************** * FIELDTYPE * **************/ typedef struct typenode { unsigned short status; /* flags */ long ref; /* reference count */ struct typenode * left; /* ptr to operand for | */ struct typenode * right; /* ptr to operand for | */ void* (*makearg)(va_list *); /* make fieldtype arg */ void* (*copyarg)(const void *); /* copy fieldtype arg */ void (*freearg)(void *); /* free fieldtype arg */ #if NCURSES_INTEROP_FUNCS union { bool (*ofcheck)(FIELD *,const void *); /* field validation */ bool (*gfcheck)(FORM*,FIELD *,const void*); /* generic field validation */ } fieldcheck; union { bool (*occheck)(int,const void *); /* character validation */ bool (*gccheck)(int,FORM*, FIELD*,const void*); /* generic char validation */ } charcheck; union { bool (*onext)(FIELD *,const void *); /* enumerate next value */ bool (*gnext)(FORM*,FIELD*,const void*); /* generic enumerate next */ } enum_next; union { bool (*oprev)(FIELD *,const void *); /* enumerate prev value */ bool (*gprev)(FORM*,FIELD*,const void*); /* generic enumerate prev */ } enum_prev; void* (*genericarg)(void*); /* Alternate Arg method */ #else bool (*fcheck)(FIELD *,const void *); /* field validation */ bool (*ccheck)(int,const void *); /* character validation */ bool (*next)(FIELD *,const void *); /* enumerate next value */ bool (*prev)(FIELD *,const void *); /* enumerate prev value */ #endif } FIELDTYPE; typedef void (*Form_Hook)(FORM *); /*************************** * miscellaneous #defines * ***************************/ /* field justification */ #define NO_JUSTIFICATION (0) #define JUSTIFY_LEFT (1) #define JUSTIFY_CENTER (2) #define JUSTIFY_RIGHT (3) /* field options */ #define O_VISIBLE (0x0001U) #define O_ACTIVE (0x0002U) #define O_PUBLIC (0x0004U) #define O_EDIT (0x0008U) #define O_WRAP (0x0010U) #define O_BLANK (0x0020U) #define O_AUTOSKIP (0x0040U) #define O_NULLOK (0x0080U) #define O_PASSOK (0x0100U) #define O_STATIC (0x0200U) /* form options */ #define O_NL_OVERLOAD (0x0001U) #define O_BS_OVERLOAD (0x0002U) /* form driver commands */ #define REQ_NEXT_PAGE (KEY_MAX + 1) /* move to next page */ #define REQ_PREV_PAGE (KEY_MAX + 2) /* move to previous page */ #define REQ_FIRST_PAGE (KEY_MAX + 3) /* move to first page */ #define REQ_LAST_PAGE (KEY_MAX + 4) /* move to last page */ #define REQ_NEXT_FIELD (KEY_MAX + 5) /* move to next field */ #define REQ_PREV_FIELD (KEY_MAX + 6) /* move to previous field */ #define REQ_FIRST_FIELD (KEY_MAX + 7) /* move to first field */ #define REQ_LAST_FIELD (KEY_MAX + 8) /* move to last field */ #define REQ_SNEXT_FIELD (KEY_MAX + 9) /* move to sorted next field */ #define REQ_SPREV_FIELD (KEY_MAX + 10) /* move to sorted prev field */ #define REQ_SFIRST_FIELD (KEY_MAX + 11) /* move to sorted first field */ #define REQ_SLAST_FIELD (KEY_MAX + 12) /* move to sorted last field */ #define REQ_LEFT_FIELD (KEY_MAX + 13) /* move to left to field */ #define REQ_RIGHT_FIELD (KEY_MAX + 14) /* move to right to field */ #define REQ_UP_FIELD (KEY_MAX + 15) /* move to up to field */ #define REQ_DOWN_FIELD (KEY_MAX + 16) /* move to down to field */ #define REQ_NEXT_CHAR (KEY_MAX + 17) /* move to next char in field */ #define REQ_PREV_CHAR (KEY_MAX + 18) /* move to prev char in field */ #define REQ_NEXT_LINE (KEY_MAX + 19) /* move to next line in field */ #define REQ_PREV_LINE (KEY_MAX + 20) /* move to prev line in field */ #define REQ_NEXT_WORD (KEY_MAX + 21) /* move to next word in field */ #define REQ_PREV_WORD (KEY_MAX + 22) /* move to prev word in field */ #define REQ_BEG_FIELD (KEY_MAX + 23) /* move to first char in field */ #define REQ_END_FIELD (KEY_MAX + 24) /* move after last char in fld */ #define REQ_BEG_LINE (KEY_MAX + 25) /* move to beginning of line */ #define REQ_END_LINE (KEY_MAX + 26) /* move after last char in line */ #define REQ_LEFT_CHAR (KEY_MAX + 27) /* move left in field */ #define REQ_RIGHT_CHAR (KEY_MAX + 28) /* move right in field */ #define REQ_UP_CHAR (KEY_MAX + 29) /* move up in field */ #define REQ_DOWN_CHAR (KEY_MAX + 30) /* move down in field */ #define REQ_NEW_LINE (KEY_MAX + 31) /* insert/overlay new line */ #define REQ_INS_CHAR (KEY_MAX + 32) /* insert blank char at cursor */ #define REQ_INS_LINE (KEY_MAX + 33) /* insert blank line at cursor */ #define REQ_DEL_CHAR (KEY_MAX + 34) /* delete char at cursor */ #define REQ_DEL_PREV (KEY_MAX + 35) /* delete char before cursor */ #define REQ_DEL_LINE (KEY_MAX + 36) /* delete line at cursor */ #define REQ_DEL_WORD (KEY_MAX + 37) /* delete word at cursor */ #define REQ_CLR_EOL (KEY_MAX + 38) /* clear to end of line */ #define REQ_CLR_EOF (KEY_MAX + 39) /* clear to end of field */ #define REQ_CLR_FIELD (KEY_MAX + 40) /* clear entire field */ #define REQ_OVL_MODE (KEY_MAX + 41) /* begin overlay mode */ #define REQ_INS_MODE (KEY_MAX + 42) /* begin insert mode */ #define REQ_SCR_FLINE (KEY_MAX + 43) /* scroll field forward a line */ #define REQ_SCR_BLINE (KEY_MAX + 44) /* scroll field backward a line */ #define REQ_SCR_FPAGE (KEY_MAX + 45) /* scroll field forward a page */ #define REQ_SCR_BPAGE (KEY_MAX + 46) /* scroll field backward a page */ #define REQ_SCR_FHPAGE (KEY_MAX + 47) /* scroll field forward half page */ #define REQ_SCR_BHPAGE (KEY_MAX + 48) /* scroll field backward half page */ #define REQ_SCR_FCHAR (KEY_MAX + 49) /* horizontal scroll char */ #define REQ_SCR_BCHAR (KEY_MAX + 50) /* horizontal scroll char */ #define REQ_SCR_HFLINE (KEY_MAX + 51) /* horizontal scroll line */ #define REQ_SCR_HBLINE (KEY_MAX + 52) /* horizontal scroll line */ #define REQ_SCR_HFHALF (KEY_MAX + 53) /* horizontal scroll half line */ #define REQ_SCR_HBHALF (KEY_MAX + 54) /* horizontal scroll half line */ #define REQ_VALIDATION (KEY_MAX + 55) /* validate field */ #define REQ_NEXT_CHOICE (KEY_MAX + 56) /* display next field choice */ #define REQ_PREV_CHOICE (KEY_MAX + 57) /* display prev field choice */ #define MIN_FORM_COMMAND (KEY_MAX + 1) /* used by form_driver */ #define MAX_FORM_COMMAND (KEY_MAX + 57) /* used by form_driver */ #if defined(MAX_COMMAND) # if (MAX_FORM_COMMAND > MAX_COMMAND) # error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND # elif (MAX_COMMAND != (KEY_MAX + 128)) # error Something is wrong -- MAX_COMMAND is already inconsistently defined. # endif #else # define MAX_COMMAND (KEY_MAX + 128) #endif /************************* * standard field types * *************************/ extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA; extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM; extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM; extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER; extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC; extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP; /************************************ * built-in additional field types * * They are not defined in SVr4 * ************************************/ extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */ /*********************** * FIELDTYPE routines * ***********************/ extern NCURSES_EXPORT(FIELDTYPE *) new_fieldtype ( bool (* const field_check)(FIELD *,const void *), bool (* const char_check)(int,const void *)); extern NCURSES_EXPORT(FIELDTYPE *) link_fieldtype( FIELDTYPE *, FIELDTYPE *); extern NCURSES_EXPORT(int) free_fieldtype (FIELDTYPE *); extern NCURSES_EXPORT(int) set_fieldtype_arg (FIELDTYPE *, void * (* const make_arg)(va_list *), void * (* const copy_arg)(const void *), void (* const free_arg)(void *)); extern NCURSES_EXPORT(int) set_fieldtype_choice (FIELDTYPE *, bool (* const next_choice)(FIELD *,const void *), bool (* const prev_choice)(FIELD *,const void *)); /******************* * FIELD routines * *******************/ extern NCURSES_EXPORT(FIELD *) new_field (int,int,int,int,int,int); extern NCURSES_EXPORT(FIELD *) dup_field (FIELD *,int,int); extern NCURSES_EXPORT(FIELD *) link_field (FIELD *,int,int); extern NCURSES_EXPORT(int) free_field (FIELD *); extern NCURSES_EXPORT(int) field_info (const FIELD *,int *,int *,int *,int *,int *,int *); extern NCURSES_EXPORT(int) dynamic_field_info (const FIELD *,int *,int *,int *); extern NCURSES_EXPORT(int) set_max_field ( FIELD *,int); extern NCURSES_EXPORT(int) move_field (FIELD *,int,int); extern NCURSES_EXPORT(int) set_field_type (FIELD *,FIELDTYPE *,...); extern NCURSES_EXPORT(int) set_new_page (FIELD *,bool); extern NCURSES_EXPORT(int) set_field_just (FIELD *,int); extern NCURSES_EXPORT(int) field_just (const FIELD *); extern NCURSES_EXPORT(int) set_field_fore (FIELD *,chtype); extern NCURSES_EXPORT(int) set_field_back (FIELD *,chtype); extern NCURSES_EXPORT(int) set_field_pad (FIELD *,int); extern NCURSES_EXPORT(int) field_pad (const FIELD *); extern NCURSES_EXPORT(int) set_field_buffer (FIELD *,int,const char *); extern NCURSES_EXPORT(int) set_field_status (FIELD *,bool); extern NCURSES_EXPORT(int) set_field_userptr (FIELD *, void *); extern NCURSES_EXPORT(int) set_field_opts (FIELD *,Field_Options); extern NCURSES_EXPORT(int) field_opts_on (FIELD *,Field_Options); extern NCURSES_EXPORT(int) field_opts_off (FIELD *,Field_Options); extern NCURSES_EXPORT(chtype) field_fore (const FIELD *); extern NCURSES_EXPORT(chtype) field_back (const FIELD *); extern NCURSES_EXPORT(bool) new_page (const FIELD *); extern NCURSES_EXPORT(bool) field_status (const FIELD *); extern NCURSES_EXPORT(void *) field_arg (const FIELD *); extern NCURSES_EXPORT(void *) field_userptr (const FIELD *); extern NCURSES_EXPORT(FIELDTYPE *) field_type (const FIELD *); extern NCURSES_EXPORT(char *) field_buffer (const FIELD *,int); extern NCURSES_EXPORT(Field_Options) field_opts (const FIELD *); /****************** * FORM routines * ******************/ extern NCURSES_EXPORT(FORM *) new_form (FIELD **); extern NCURSES_EXPORT(FIELD **) form_fields (const FORM *); extern NCURSES_EXPORT(FIELD *) current_field (const FORM *); extern NCURSES_EXPORT(WINDOW *) form_win (const FORM *); extern NCURSES_EXPORT(WINDOW *) form_sub (const FORM *); extern NCURSES_EXPORT(Form_Hook) form_init (const FORM *); extern NCURSES_EXPORT(Form_Hook) form_term (const FORM *); extern NCURSES_EXPORT(Form_Hook) field_init (const FORM *); extern NCURSES_EXPORT(Form_Hook) field_term (const FORM *); extern NCURSES_EXPORT(int) free_form (FORM *); extern NCURSES_EXPORT(int) set_form_fields (FORM *,FIELD **); extern NCURSES_EXPORT(int) field_count (const FORM *); extern NCURSES_EXPORT(int) set_form_win (FORM *,WINDOW *); extern NCURSES_EXPORT(int) set_form_sub (FORM *,WINDOW *); extern NCURSES_EXPORT(int) set_current_field (FORM *,FIELD *); extern NCURSES_EXPORT(int) field_index (const FIELD *); extern NCURSES_EXPORT(int) set_form_page (FORM *,int); extern NCURSES_EXPORT(int) form_page (const FORM *); extern NCURSES_EXPORT(int) scale_form (const FORM *,int *,int *); extern NCURSES_EXPORT(int) set_form_init (FORM *,Form_Hook); extern NCURSES_EXPORT(int) set_form_term (FORM *,Form_Hook); extern NCURSES_EXPORT(int) set_field_init (FORM *,Form_Hook); extern NCURSES_EXPORT(int) set_field_term (FORM *,Form_Hook); extern NCURSES_EXPORT(int) post_form (FORM *); extern NCURSES_EXPORT(int) unpost_form (FORM *); extern NCURSES_EXPORT(int) pos_form_cursor (FORM *); extern NCURSES_EXPORT(int) form_driver (FORM *,int); extern NCURSES_EXPORT(int) set_form_userptr (FORM *,void *); extern NCURSES_EXPORT(int) set_form_opts (FORM *,Form_Options); extern NCURSES_EXPORT(int) form_opts_on (FORM *,Form_Options); extern NCURSES_EXPORT(int) form_opts_off (FORM *,Form_Options); extern NCURSES_EXPORT(int) form_request_by_name (const char *); extern NCURSES_EXPORT(const char *) form_request_name (int); extern NCURSES_EXPORT(void *) form_userptr (const FORM *); extern NCURSES_EXPORT(Form_Options) form_opts (const FORM *); extern NCURSES_EXPORT(bool) data_ahead (const FORM *); extern NCURSES_EXPORT(bool) data_behind (const FORM *); #if NCURSES_SP_FUNCS extern NCURSES_EXPORT(FORM *) NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **); #endif #ifdef __cplusplus } #endif #endif /* FORM_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ncurses_dll.h���������������������������������������������������������������������������������������0000644�����������������00000007525�14763166026�0007256 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/**************************************************************************** * Copyright (c) 1998-2007,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /* $Id: ncurses_dll.h.in,v 1.8 2009/04/04 22:26:27 tom Exp $ */ #ifndef NCURSES_DLL_H_incl #define NCURSES_DLL_H_incl 1 /* * For reentrant code, we map the various global variables into SCREEN by * using functions to access them. */ #define NCURSES_PUBLIC_VAR(name) _nc_##name #define NCURSES_WRAPPED_VAR(type,name) extern type NCURSES_PUBLIC_VAR(name)(void) /* no longer needed on cygwin or mingw, thanks to auto-import */ /* but this structure may be useful at some point for an MSVC build */ /* so, for now unconditionally define the important flags */ /* "the right way" for proper static and dll+auto-import behavior */ #undef NCURSES_DLL #define NCURSES_STATIC #if defined(__CYGWIN__) || defined(__MINGW32__) # if defined(NCURSES_DLL) # if defined(NCURSES_STATIC) # undef NCURSES_STATIC # endif # endif # undef NCURSES_IMPEXP # undef NCURSES_API # undef NCURSES_EXPORT # undef NCURSES_EXPORT_VAR # if defined(NCURSES_DLL) /* building a DLL */ # define NCURSES_IMPEXP __declspec(dllexport) # elif defined(NCURSES_STATIC) /* building or linking to a static library */ # define NCURSES_IMPEXP /* nothing */ # else /* linking to the DLL */ # define NCURSES_IMPEXP __declspec(dllimport) # endif # define NCURSES_API __cdecl # define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API # define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type #endif /* Take care of non-cygwin platforms */ #if !defined(NCURSES_IMPEXP) # define NCURSES_IMPEXP /* nothing */ #endif #if !defined(NCURSES_API) # define NCURSES_API /* nothing */ #endif #if !defined(NCURSES_EXPORT) # define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API #endif #if !defined(NCURSES_EXPORT_VAR) # define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type #endif #endif /* NCURSES_DLL_H_incl */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������term.h����������������������������������������������������������������������������������������������0000644�����������������00000115202�14763166026�0005700 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/**************************************************************************** * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /****************************************************************************/ /* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 */ /* and: Eric S. Raymond <esr@snark.thyrsus.com> */ /* and: Thomas E. Dickey 1995-on */ /****************************************************************************/ /* $Id: MKterm.h.awk.in,v 1.60 2011/06/25 20:51:00 tom Exp $ */ /* ** term.h -- Definition of struct term */ #ifndef NCURSES_TERM_H_incl #define NCURSES_TERM_H_incl 1 #undef NCURSES_VERSION #define NCURSES_VERSION "5.9" #include <ncurses_dll.h> #ifdef __cplusplus extern "C" { #endif /* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H * definition (based on the system for which this was configured). */ #undef NCURSES_CONST #define NCURSES_CONST /*nothing*/ #undef NCURSES_SBOOL #define NCURSES_SBOOL char #undef NCURSES_XNAMES #define NCURSES_XNAMES 1 /* We will use these symbols to hide differences between * termios/termio/sgttyb interfaces. */ #undef TTY #undef SET_TTY #undef GET_TTY /* Assume POSIX termio if we have the header and function */ /* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */ #if 1 && 1 #undef TERMIOS #define TERMIOS 1 #include <termios.h> #define TTY struct termios #else /* !HAVE_TERMIOS_H */ /* #if HAVE_TERMIO_H */ #if 1 #undef TERMIOS #define TERMIOS 1 #include <termio.h> #define TTY struct termio #else /* !HAVE_TERMIO_H */ #if __MINGW32__ # include <ncurses_mingw.h> # define TTY struct termios #else #undef TERMIOS #include <sgtty.h> #include <sys/ioctl.h> #define TTY struct sgttyb #endif /* MINGW32 */ #endif /* HAVE_TERMIO_H */ #endif /* HAVE_TERMIOS_H */ #ifdef TERMIOS #define GET_TTY(fd, buf) tcgetattr(fd, buf) #define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf) #else #define GET_TTY(fd, buf) gtty(fd, buf) #define SET_TTY(fd, buf) stty(fd, buf) #endif #define NAMESIZE 256 #define CUR cur_term->type. #define auto_left_margin CUR Booleans[0] #define auto_right_margin CUR Booleans[1] #define no_esc_ctlc CUR Booleans[2] #define ceol_standout_glitch CUR Booleans[3] #define eat_newline_glitch CUR Booleans[4] #define erase_overstrike CUR Booleans[5] #define generic_type CUR Booleans[6] #define hard_copy CUR Booleans[7] #define has_meta_key CUR Booleans[8] #define has_status_line CUR Booleans[9] #define insert_null_glitch CUR Booleans[10] #define memory_above CUR Booleans[11] #define memory_below CUR Booleans[12] #define move_insert_mode CUR Booleans[13] #define move_standout_mode CUR Booleans[14] #define over_strike CUR Booleans[15] #define status_line_esc_ok CUR Booleans[16] #define dest_tabs_magic_smso CUR Booleans[17] #define tilde_glitch CUR Booleans[18] #define transparent_underline CUR Booleans[19] #define xon_xoff CUR Booleans[20] #define needs_xon_xoff CUR Booleans[21] #define prtr_silent CUR Booleans[22] #define hard_cursor CUR Booleans[23] #define non_rev_rmcup CUR Booleans[24] #define no_pad_char CUR Booleans[25] #define non_dest_scroll_region CUR Booleans[26] #define can_change CUR Booleans[27] #define back_color_erase CUR Booleans[28] #define hue_lightness_saturation CUR Booleans[29] #define col_addr_glitch CUR Booleans[30] #define cr_cancels_micro_mode CUR Booleans[31] #define has_print_wheel CUR Booleans[32] #define row_addr_glitch CUR Booleans[33] #define semi_auto_right_margin CUR Booleans[34] #define cpi_changes_res CUR Booleans[35] #define lpi_changes_res CUR Booleans[36] #define columns CUR Numbers[0] #define init_tabs CUR Numbers[1] #define lines CUR Numbers[2] #define lines_of_memory CUR Numbers[3] #define magic_cookie_glitch CUR Numbers[4] #define padding_baud_rate CUR Numbers[5] #define virtual_terminal CUR Numbers[6] #define width_status_line CUR Numbers[7] #define num_labels CUR Numbers[8] #define label_height CUR Numbers[9] #define label_width CUR Numbers[10] #define max_attributes CUR Numbers[11] #define maximum_windows CUR Numbers[12] #define max_colors CUR Numbers[13] #define max_pairs CUR Numbers[14] #define no_color_video CUR Numbers[15] #define buffer_capacity CUR Numbers[16] #define dot_vert_spacing CUR Numbers[17] #define dot_horz_spacing CUR Numbers[18] #define max_micro_address CUR Numbers[19] #define max_micro_jump CUR Numbers[20] #define micro_col_size CUR Numbers[21] #define micro_line_size CUR Numbers[22] #define number_of_pins CUR Numbers[23] #define output_res_char CUR Numbers[24] #define output_res_line CUR Numbers[25] #define output_res_horz_inch CUR Numbers[26] #define output_res_vert_inch CUR Numbers[27] #define print_rate CUR Numbers[28] #define wide_char_size CUR Numbers[29] #define buttons CUR Numbers[30] #define bit_image_entwining CUR Numbers[31] #define bit_image_type CUR Numbers[32] #define back_tab CUR Strings[0] #define bell CUR Strings[1] #define carriage_return CUR Strings[2] #define change_scroll_region CUR Strings[3] #define clear_all_tabs CUR Strings[4] #define clear_screen CUR Strings[5] #define clr_eol CUR Strings[6] #define clr_eos CUR Strings[7] #define column_address CUR Strings[8] #define command_character CUR Strings[9] #define cursor_address CUR Strings[10] #define cursor_down CUR Strings[11] #define cursor_home CUR Strings[12] #define cursor_invisible CUR Strings[13] #define cursor_left CUR Strings[14] #define cursor_mem_address CUR Strings[15] #define cursor_normal CUR Strings[16] #define cursor_right CUR Strings[17] #define cursor_to_ll CUR Strings[18] #define cursor_up CUR Strings[19] #define cursor_visible CUR Strings[20] #define delete_character CUR Strings[21] #define delete_line CUR Strings[22] #define dis_status_line CUR Strings[23] #define down_half_line CUR Strings[24] #define enter_alt_charset_mode CUR Strings[25] #define enter_blink_mode CUR Strings[26] #define enter_bold_mode CUR Strings[27] #define enter_ca_mode CUR Strings[28] #define enter_delete_mode CUR Strings[29] #define enter_dim_mode CUR Strings[30] #define enter_insert_mode CUR Strings[31] #define enter_secure_mode CUR Strings[32] #define enter_protected_mode CUR Strings[33] #define enter_reverse_mode CUR Strings[34] #define enter_standout_mode CUR Strings[35] #define enter_underline_mode CUR Strings[36] #define erase_chars CUR Strings[37] #define exit_alt_charset_mode CUR Strings[38] #define exit_attribute_mode CUR Strings[39] #define exit_ca_mode CUR Strings[40] #define exit_delete_mode CUR Strings[41] #define exit_insert_mode CUR Strings[42] #define exit_standout_mode CUR Strings[43] #define exit_underline_mode CUR Strings[44] #define flash_screen CUR Strings[45] #define form_feed CUR Strings[46] #define from_status_line CUR Strings[47] #define init_1string CUR Strings[48] #define init_2string CUR Strings[49] #define init_3string CUR Strings[50] #define init_file CUR Strings[51] #define insert_character CUR Strings[52] #define insert_line CUR Strings[53] #define insert_padding CUR Strings[54] #define key_backspace CUR Strings[55] #define key_catab CUR Strings[56] #define key_clear CUR Strings[57] #define key_ctab CUR Strings[58] #define key_dc CUR Strings[59] #define key_dl CUR Strings[60] #define key_down CUR Strings[61] #define key_eic CUR Strings[62] #define key_eol CUR Strings[63] #define key_eos CUR Strings[64] #define key_f0 CUR Strings[65] #define key_f1 CUR Strings[66] #define key_f10 CUR Strings[67] #define key_f2 CUR Strings[68] #define key_f3 CUR Strings[69] #define key_f4 CUR Strings[70] #define key_f5 CUR Strings[71] #define key_f6 CUR Strings[72] #define key_f7 CUR Strings[73] #define key_f8 CUR Strings[74] #define key_f9 CUR Strings[75] #define key_home CUR Strings[76] #define key_ic CUR Strings[77] #define key_il CUR Strings[78] #define key_left CUR Strings[79] #define key_ll CUR Strings[80] #define key_npage CUR Strings[81] #define key_ppage CUR Strings[82] #define key_right CUR Strings[83] #define key_sf CUR Strings[84] #define key_sr CUR Strings[85] #define key_stab CUR Strings[86] #define key_up CUR Strings[87] #define keypad_local CUR Strings[88] #define keypad_xmit CUR Strings[89] #define lab_f0 CUR Strings[90] #define lab_f1 CUR Strings[91] #define lab_f10 CUR Strings[92] #define lab_f2 CUR Strings[93] #define lab_f3 CUR Strings[94] #define lab_f4 CUR Strings[95] #define lab_f5 CUR Strings[96] #define lab_f6 CUR Strings[97] #define lab_f7 CUR Strings[98] #define lab_f8 CUR Strings[99] #define lab_f9 CUR Strings[100] #define meta_off CUR Strings[101] #define meta_on CUR Strings[102] #define newline CUR Strings[103] #define pad_char CUR Strings[104] #define parm_dch CUR Strings[105] #define parm_delete_line CUR Strings[106] #define parm_down_cursor CUR Strings[107] #define parm_ich CUR Strings[108] #define parm_index CUR Strings[109] #define parm_insert_line CUR Strings[110] #define parm_left_cursor CUR Strings[111] #define parm_right_cursor CUR Strings[112] #define parm_rindex CUR Strings[113] #define parm_up_cursor CUR Strings[114] #define pkey_key CUR Strings[115] #define pkey_local CUR Strings[116] #define pkey_xmit CUR Strings[117] #define print_screen CUR Strings[118] #define prtr_off CUR Strings[119] #define prtr_on CUR Strings[120] #define repeat_char CUR Strings[121] #define reset_1string CUR Strings[122] #define reset_2string CUR Strings[123] #define reset_3string CUR Strings[124] #define reset_file CUR Strings[125] #define restore_cursor CUR Strings[126] #define row_address CUR Strings[127] #define save_cursor CUR Strings[128] #define scroll_forward CUR Strings[129] #define scroll_reverse CUR Strings[130] #define set_attributes CUR Strings[131] #define set_tab CUR Strings[132] #define set_window CUR Strings[133] #define tab CUR Strings[134] #define to_status_line CUR Strings[135] #define underline_char CUR Strings[136] #define up_half_line CUR Strings[137] #define init_prog CUR Strings[138] #define key_a1 CUR Strings[139] #define key_a3 CUR Strings[140] #define key_b2 CUR Strings[141] #define key_c1 CUR Strings[142] #define key_c3 CUR Strings[143] #define prtr_non CUR Strings[144] #define char_padding CUR Strings[145] #define acs_chars CUR Strings[146] #define plab_norm CUR Strings[147] #define key_btab CUR Strings[148] #define enter_xon_mode CUR Strings[149] #define exit_xon_mode CUR Strings[150] #define enter_am_mode CUR Strings[151] #define exit_am_mode CUR Strings[152] #define xon_character CUR Strings[153] #define xoff_character CUR Strings[154] #define ena_acs CUR Strings[155] #define label_on CUR Strings[156] #define label_off CUR Strings[157] #define key_beg CUR Strings[158] #define key_cancel CUR Strings[159] #define key_close CUR Strings[160] #define key_command CUR Strings[161] #define key_copy CUR Strings[162] #define key_create CUR Strings[163] #define key_end CUR Strings[164] #define key_enter CUR Strings[165] #define key_exit CUR Strings[166] #define key_find CUR Strings[167] #define key_help CUR Strings[168] #define key_mark CUR Strings[169] #define key_message CUR Strings[170] #define key_move CUR Strings[171] #define key_next CUR Strings[172] #define key_open CUR Strings[173] #define key_options CUR Strings[174] #define key_previous CUR Strings[175] #define key_print CUR Strings[176] #define key_redo CUR Strings[177] #define key_reference CUR Strings[178] #define key_refresh CUR Strings[179] #define key_replace CUR Strings[180] #define key_restart CUR Strings[181] #define key_resume CUR Strings[182] #define key_save CUR Strings[183] #define key_suspend CUR Strings[184] #define key_undo CUR Strings[185] #define key_sbeg CUR Strings[186] #define key_scancel CUR Strings[187] #define key_scommand CUR Strings[188] #define key_scopy CUR Strings[189] #define key_screate CUR Strings[190] #define key_sdc CUR Strings[191] #define key_sdl CUR Strings[192] #define key_select CUR Strings[193] #define key_send CUR Strings[194] #define key_seol CUR Strings[195] #define key_sexit CUR Strings[196] #define key_sfind CUR Strings[197] #define key_shelp CUR Strings[198] #define key_shome CUR Strings[199] #define key_sic CUR Strings[200] #define key_sleft CUR Strings[201] #define key_smessage CUR Strings[202] #define key_smove CUR Strings[203] #define key_snext CUR Strings[204] #define key_soptions CUR Strings[205] #define key_sprevious CUR Strings[206] #define key_sprint CUR Strings[207] #define key_sredo CUR Strings[208] #define key_sreplace CUR Strings[209] #define key_sright CUR Strings[210] #define key_srsume CUR Strings[211] #define key_ssave CUR Strings[212] #define key_ssuspend CUR Strings[213] #define key_sundo CUR Strings[214] #define req_for_input CUR Strings[215] #define key_f11 CUR Strings[216] #define key_f12 CUR Strings[217] #define key_f13 CUR Strings[218] #define key_f14 CUR Strings[219] #define key_f15 CUR Strings[220] #define key_f16 CUR Strings[221] #define key_f17 CUR Strings[222] #define key_f18 CUR Strings[223] #define key_f19 CUR Strings[224] #define key_f20 CUR Strings[225] #define key_f21 CUR Strings[226] #define key_f22 CUR Strings[227] #define key_f23 CUR Strings[228] #define key_f24 CUR Strings[229] #define key_f25 CUR Strings[230] #define key_f26 CUR Strings[231] #define key_f27 CUR Strings[232] #define key_f28 CUR Strings[233] #define key_f29 CUR Strings[234] #define key_f30 CUR Strings[235] #define key_f31 CUR Strings[236] #define key_f32 CUR Strings[237] #define key_f33 CUR Strings[238] #define key_f34 CUR Strings[239] #define key_f35 CUR Strings[240] #define key_f36 CUR Strings[241] #define key_f37 CUR Strings[242] #define key_f38 CUR Strings[243] #define key_f39 CUR Strings[244] #define key_f40 CUR Strings[245] #define key_f41 CUR Strings[246] #define key_f42 CUR Strings[247] #define key_f43 CUR Strings[248] #define key_f44 CUR Strings[249] #define key_f45 CUR Strings[250] #define key_f46 CUR Strings[251] #define key_f47 CUR Strings[252] #define key_f48 CUR Strings[253] #define key_f49 CUR Strings[254] #define key_f50 CUR Strings[255] #define key_f51 CUR Strings[256] #define key_f52 CUR Strings[257] #define key_f53 CUR Strings[258] #define key_f54 CUR Strings[259] #define key_f55 CUR Strings[260] #define key_f56 CUR Strings[261] #define key_f57 CUR Strings[262] #define key_f58 CUR Strings[263] #define key_f59 CUR Strings[264] #define key_f60 CUR Strings[265] #define key_f61 CUR Strings[266] #define key_f62 CUR Strings[267] #define key_f63 CUR Strings[268] #define clr_bol CUR Strings[269] #define clear_margins CUR Strings[270] #define set_left_margin CUR Strings[271] #define set_right_margin CUR Strings[272] #define label_format CUR Strings[273] #define set_clock CUR Strings[274] #define display_clock CUR Strings[275] #define remove_clock CUR Strings[276] #define create_window CUR Strings[277] #define goto_window CUR Strings[278] #define hangup CUR Strings[279] #define dial_phone CUR Strings[280] #define quick_dial CUR Strings[281] #define tone CUR Strings[282] #define pulse CUR Strings[283] #define flash_hook CUR Strings[284] #define fixed_pause CUR Strings[285] #define wait_tone CUR Strings[286] #define user0 CUR Strings[287] #define user1 CUR Strings[288] #define user2 CUR Strings[289] #define user3 CUR Strings[290] #define user4 CUR Strings[291] #define user5 CUR Strings[292] #define user6 CUR Strings[293] #define user7 CUR Strings[294] #define user8 CUR Strings[295] #define user9 CUR Strings[296] #define orig_pair CUR Strings[297] #define orig_colors CUR Strings[298] #define initialize_color CUR Strings[299] #define initialize_pair CUR Strings[300] #define set_color_pair CUR Strings[301] #define set_foreground CUR Strings[302] #define set_background CUR Strings[303] #define change_char_pitch CUR Strings[304] #define change_line_pitch CUR Strings[305] #define change_res_horz CUR Strings[306] #define change_res_vert CUR Strings[307] #define define_char CUR Strings[308] #define enter_doublewide_mode CUR Strings[309] #define enter_draft_quality CUR Strings[310] #define enter_italics_mode CUR Strings[311] #define enter_leftward_mode CUR Strings[312] #define enter_micro_mode CUR Strings[313] #define enter_near_letter_quality CUR Strings[314] #define enter_normal_quality CUR Strings[315] #define enter_shadow_mode CUR Strings[316] #define enter_subscript_mode CUR Strings[317] #define enter_superscript_mode CUR Strings[318] #define enter_upward_mode CUR Strings[319] #define exit_doublewide_mode CUR Strings[320] #define exit_italics_mode CUR Strings[321] #define exit_leftward_mode CUR Strings[322] #define exit_micro_mode CUR Strings[323] #define exit_shadow_mode CUR Strings[324] #define exit_subscript_mode CUR Strings[325] #define exit_superscript_mode CUR Strings[326] #define exit_upward_mode CUR Strings[327] #define micro_column_address CUR Strings[328] #define micro_down CUR Strings[329] #define micro_left CUR Strings[330] #define micro_right CUR Strings[331] #define micro_row_address CUR Strings[332] #define micro_up CUR Strings[333] #define order_of_pins CUR Strings[334] #define parm_down_micro CUR Strings[335] #define parm_left_micro CUR Strings[336] #define parm_right_micro CUR Strings[337] #define parm_up_micro CUR Strings[338] #define select_char_set CUR Strings[339] #define set_bottom_margin CUR Strings[340] #define set_bottom_margin_parm CUR Strings[341] #define set_left_margin_parm CUR Strings[342] #define set_right_margin_parm CUR Strings[343] #define set_top_margin CUR Strings[344] #define set_top_margin_parm CUR Strings[345] #define start_bit_image CUR Strings[346] #define start_char_set_def CUR Strings[347] #define stop_bit_image CUR Strings[348] #define stop_char_set_def CUR Strings[349] #define subscript_characters CUR Strings[350] #define superscript_characters CUR Strings[351] #define these_cause_cr CUR Strings[352] #define zero_motion CUR Strings[353] #define char_set_names CUR Strings[354] #define key_mouse CUR Strings[355] #define mouse_info CUR Strings[356] #define req_mouse_pos CUR Strings[357] #define get_mouse CUR Strings[358] #define set_a_foreground CUR Strings[359] #define set_a_background CUR Strings[360] #define pkey_plab CUR Strings[361] #define device_type CUR Strings[362] #define code_set_init CUR Strings[363] #define set0_des_seq CUR Strings[364] #define set1_des_seq CUR Strings[365] #define set2_des_seq CUR Strings[366] #define set3_des_seq CUR Strings[367] #define set_lr_margin CUR Strings[368] #define set_tb_margin CUR Strings[369] #define bit_image_repeat CUR Strings[370] #define bit_image_newline CUR Strings[371] #define bit_image_carriage_return CUR Strings[372] #define color_names CUR Strings[373] #define define_bit_image_region CUR Strings[374] #define end_bit_image_region CUR Strings[375] #define set_color_band CUR Strings[376] #define set_page_length CUR Strings[377] #define display_pc_char CUR Strings[378] #define enter_pc_charset_mode CUR Strings[379] #define exit_pc_charset_mode CUR Strings[380] #define enter_scancode_mode CUR Strings[381] #define exit_scancode_mode CUR Strings[382] #define pc_term_options CUR Strings[383] #define scancode_escape CUR Strings[384] #define alt_scancode_esc CUR Strings[385] #define enter_horizontal_hl_mode CUR Strings[386] #define enter_left_hl_mode CUR Strings[387] #define enter_low_hl_mode CUR Strings[388] #define enter_right_hl_mode CUR Strings[389] #define enter_top_hl_mode CUR Strings[390] #define enter_vertical_hl_mode CUR Strings[391] #define set_a_attributes CUR Strings[392] #define set_pglen_inch CUR Strings[393] #define BOOLWRITE 37 #define NUMWRITE 33 #define STRWRITE 394 /* older synonyms for some capabilities */ #define beehive_glitch no_esc_ctlc #define teleray_glitch dest_tabs_magic_smso #define micro_char_size micro_col_size #ifdef __INTERNAL_CAPS_VISIBLE #define termcap_init2 CUR Strings[394] #define termcap_reset CUR Strings[395] #define magic_cookie_glitch_ul CUR Numbers[33] #define backspaces_with_bs CUR Booleans[37] #define crt_no_scrolling CUR Booleans[38] #define no_correctly_working_cr CUR Booleans[39] #define carriage_return_delay CUR Numbers[34] #define new_line_delay CUR Numbers[35] #define linefeed_if_not_lf CUR Strings[396] #define backspace_if_not_bs CUR Strings[397] #define gnu_has_meta_key CUR Booleans[40] #define linefeed_is_newline CUR Booleans[41] #define backspace_delay CUR Numbers[36] #define horizontal_tab_delay CUR Numbers[37] #define number_of_function_keys CUR Numbers[38] #define other_non_function_keys CUR Strings[398] #define arrow_key_map CUR Strings[399] #define has_hardware_tabs CUR Booleans[42] #define return_does_clr_eol CUR Booleans[43] #define acs_ulcorner CUR Strings[400] #define acs_llcorner CUR Strings[401] #define acs_urcorner CUR Strings[402] #define acs_lrcorner CUR Strings[403] #define acs_ltee CUR Strings[404] #define acs_rtee CUR Strings[405] #define acs_btee CUR Strings[406] #define acs_ttee CUR Strings[407] #define acs_hline CUR Strings[408] #define acs_vline CUR Strings[409] #define acs_plus CUR Strings[410] #define memory_lock CUR Strings[411] #define memory_unlock CUR Strings[412] #define box_chars_1 CUR Strings[413] #endif /* __INTERNAL_CAPS_VISIBLE */ /* * Predefined terminfo array sizes */ #define BOOLCOUNT 44 #define NUMCOUNT 39 #define STRCOUNT 414 /* used by code for comparing entries */ #define acs_chars_index 146 typedef struct termtype { /* in-core form of terminfo data */ char *term_names; /* str_table offset of term names */ char *str_table; /* pointer to string table */ NCURSES_SBOOL *Booleans; /* array of boolean values */ short *Numbers; /* array of integer values */ char **Strings; /* array of string offsets */ #if NCURSES_XNAMES char *ext_str_table; /* pointer to extended string table */ char **ext_Names; /* corresponding names */ unsigned short num_Booleans;/* count total Booleans */ unsigned short num_Numbers; /* count total Numbers */ unsigned short num_Strings; /* count total Strings */ unsigned short ext_Booleans;/* count extensions to Booleans */ unsigned short ext_Numbers; /* count extensions to Numbers */ unsigned short ext_Strings; /* count extensions to Strings */ #endif /* NCURSES_XNAMES */ } TERMTYPE; typedef struct term { /* describe an actual terminal */ TERMTYPE type; /* terminal type description */ short Filedes; /* file description being written to */ TTY Ottyb, /* original state of the terminal */ Nttyb; /* current state of the terminal */ int _baudrate; /* used to compute padding */ char * _termname; /* used for termname() */ } TERMINAL; #if 0 && !0 extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term; #elif 0 NCURSES_WRAPPED_VAR(TERMINAL *, cur_term); #define cur_term NCURSES_PUBLIC_VAR(cur_term()) #else extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term; #endif #if 0 || 0 NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames); NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes); NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames); NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames); NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes); NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames); NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames); NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes); NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames); #define boolnames NCURSES_PUBLIC_VAR(boolnames()) #define boolcodes NCURSES_PUBLIC_VAR(boolcodes()) #define boolfnames NCURSES_PUBLIC_VAR(boolfnames()) #define numnames NCURSES_PUBLIC_VAR(numnames()) #define numcodes NCURSES_PUBLIC_VAR(numcodes()) #define numfnames NCURSES_PUBLIC_VAR(numfnames()) #define strnames NCURSES_PUBLIC_VAR(strnames()) #define strcodes NCURSES_PUBLIC_VAR(strcodes()) #define strfnames NCURSES_PUBLIC_VAR(strfnames()) #else extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[]; extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[]; extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[]; extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[]; extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[]; extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[]; extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[]; extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[]; extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[]; #endif /* internals */ extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf); extern NCURSES_EXPORT(int) _nc_get_tty_mode (TTY *buf); extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const); extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *); extern NCURSES_EXPORT(int) _nc_read_termtype (TERMTYPE *, char *, int); extern NCURSES_EXPORT(char *) _nc_first_name (const char *const); extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const); extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *); /* entry points */ extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *); extern NCURSES_EXPORT(int) del_curterm (TERMINAL *); /* miscellaneous entry points */ extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *); extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *); /* terminfo entry points, also declared in curses.h */ #if !defined(__NCURSES_H) extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *); extern NCURSES_EXPORT_VAR(char) ttytype[]; extern NCURSES_EXPORT(int) putp (const char *); extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *); extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *); #if 1 /* NCURSES_TPARM_VARARGS */ extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* special */ #else extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */ extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...); /* special */ #endif extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */ #endif /* __NCURSES_H */ /* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */ #if !defined(NCURSES_TERMCAP_H_incl) extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **); extern NCURSES_EXPORT(char *) tgoto (const char *, int, int); extern NCURSES_EXPORT(int) tgetent (char *, const char *); extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *); extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *); extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int)); #endif /* NCURSES_TERMCAP_H_incl */ /* * Include curses.h before term.h to enable these extensions. */ #if defined(NCURSES_SP_FUNCS) && (NCURSES_SP_FUNCS != 0) extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tigetstr) (SCREEN*, NCURSES_CONST char *); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(putp) (SCREEN*, const char *); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetflag) (SCREEN*, NCURSES_CONST char *); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetnum) (SCREEN*, NCURSES_CONST char *); #if 1 /* NCURSES_TPARM_VARARGS */ extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, ...); /* special */ #else extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */ extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm_varargs) (SCREEN*, NCURSES_CONST char *, ...); /* special */ #endif /* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */ extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgetstr) (SCREEN*, NCURSES_CONST char *, char **); extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgoto) (SCREEN*, const char *, int, int); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetent) (SCREEN*, char *, const char *); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetflag) (SCREEN*, NCURSES_CONST char *); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetnum) (SCREEN*, NCURSES_CONST char *); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tputs) (SCREEN*, const char *, int, NCURSES_SP_OUTC); extern NCURSES_EXPORT(TERMINAL *) NCURSES_SP_NAME(set_curterm) (SCREEN*, TERMINAL *); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(del_curterm) (SCREEN*, TERMINAL *); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(restartterm) (SCREEN*, NCURSES_CONST char *, int, int *); #endif /* NCURSES_SP_FUNCS */ #ifdef __cplusplus } #endif #endif /* NCURSES_TERM_H_incl */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������termcap.h�������������������������������������������������������������������������������������������0000644�����������������00000006627�14763166026�0006376 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/**************************************************************************** * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /**************************************************************************** * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ /* $Id: termcap.h.in,v 1.16 2001/03/24 21:53:27 tom Exp $ */ #ifndef NCURSES_TERMCAP_H_incl #define NCURSES_TERMCAP_H_incl 1 #undef NCURSES_VERSION #define NCURSES_VERSION "5.9" #include <ncurses_dll.h> #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include <sys/types.h> #undef NCURSES_CONST #define NCURSES_CONST /*nothing*/ #undef NCURSES_OSPEED #define NCURSES_OSPEED unsigned extern NCURSES_EXPORT_VAR(char) PC; extern NCURSES_EXPORT_VAR(char *) UP; extern NCURSES_EXPORT_VAR(char *) BC; extern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed; #if !defined(NCURSES_TERM_H_incl) extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **); extern NCURSES_EXPORT(char *) tgoto (const char *, int, int); extern NCURSES_EXPORT(int) tgetent (char *, const char *); extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *); extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *); extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int)); #endif #ifdef __cplusplus } #endif #endif /* NCURSES_TERMCAP_H_incl */ ���������������������������������������������������������������������������������������������������������etip.h����������������������������������������������������������������������������������������������0000644�����������������00000022050�14763166026�0005670 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /**************************************************************************** * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ // $Id: etip.h.in,v 1.39 2012/12/29 21:50:44 tom Exp $ #ifndef NCURSES_ETIP_H_incl #define NCURSES_ETIP_H_incl 1 // These are substituted at configure/build time #ifndef HAVE_BUILTIN_H #define HAVE_BUILTIN_H 0 #endif #ifndef HAVE_GXX_BUILTIN_H #define HAVE_GXX_BUILTIN_H 0 #endif #ifndef HAVE_GPP_BUILTIN_H #define HAVE_GPP_BUILTIN_H 0 #endif #ifndef HAVE_IOSTREAM #define HAVE_IOSTREAM 1 #endif #ifndef HAVE_TYPEINFO #define HAVE_TYPEINFO 1 #endif #ifndef HAVE_VALUES_H #define HAVE_VALUES_H 0 #endif #ifndef ETIP_NEEDS_MATH_H #define ETIP_NEEDS_MATH_H 0 #endif #ifndef ETIP_NEEDS_MATH_EXCEPTION #define ETIP_NEEDS_MATH_EXCEPTION 0 #endif #ifndef CPP_HAS_PARAM_INIT #define CPP_HAS_PARAM_INIT 0 #endif #ifndef CPP_HAS_STATIC_CAST #define CPP_HAS_STATIC_CAST 1 #endif #ifndef IOSTREAM_NAMESPACE #define IOSTREAM_NAMESPACE 1 #endif #ifdef __GNUG__ # if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) # if HAVE_TYPEINFO # include <typeinfo> # endif # endif #endif #if defined(__GNUG__) # if HAVE_BUILTIN_H || HAVE_GXX_BUILTIN_H || HAVE_GPP_BUILTIN_H # if ETIP_NEEDS_MATH_H # if ETIP_NEEDS_MATH_EXCEPTION # undef exception # define exception math_exception # endif # include <math.h> # endif # undef exception # define exception builtin_exception # if HAVE_GPP_BUILTIN_H # include <gpp/builtin.h> # elif HAVE_GXX_BUILTIN_H # include <g++/builtin.h> # else # include <builtin.h> # endif # undef exception # endif #elif defined (__SUNPRO_CC) # include <generic.h> #endif #include <ncurses_dll.h> extern "C" { #if HAVE_VALUES_H # include <values.h> #endif #include <assert.h> #include <eti.h> #include <errno.h> } // Language features #if CPP_HAS_PARAM_INIT #define NCURSES_PARAM_INIT(value) = value #else #define NCURSES_PARAM_INIT(value) /*nothing*/ #endif #if CPP_HAS_STATIC_CAST #define STATIC_CAST(s) static_cast<s> #else #define STATIC_CAST(s) (s) #endif // Forward Declarations class NCURSES_IMPEXP NCursesPanel; class NCURSES_IMPEXP NCursesMenu; class NCURSES_IMPEXP NCursesForm; class NCURSES_IMPEXP NCursesException { public: const char *message; int errorno; NCursesException (const char* msg, int err) : message(msg), errorno (err) {}; NCursesException (const char* msg) : message(msg), errorno (E_SYSTEM_ERROR) {}; NCursesException& operator=(const NCursesException& rhs) { errorno = rhs.errorno; return *this; } NCursesException(const NCursesException& rhs) : message(rhs.message), errorno(rhs.errorno) { } virtual const char *classname() const { return "NCursesWindow"; } virtual ~NCursesException() { } }; class NCURSES_IMPEXP NCursesPanelException : public NCursesException { public: const NCursesPanel* p; NCursesPanelException (const char *msg, int err) : NCursesException (msg, err), p (0) {}; NCursesPanelException (const NCursesPanel* panel, const char *msg, int err) : NCursesException (msg, err), p (panel) {}; NCursesPanelException (int err) : NCursesException ("panel library error", err), p (0) {}; NCursesPanelException (const NCursesPanel* panel, int err) : NCursesException ("panel library error", err), p (panel) {}; NCursesPanelException& operator=(const NCursesPanelException& rhs) { if (this != &rhs) { NCursesException::operator=(rhs); p = rhs.p; } return *this; } NCursesPanelException(const NCursesPanelException& rhs) : NCursesException(rhs), p(rhs.p) { } virtual const char *classname() const { return "NCursesPanel"; } virtual ~NCursesPanelException() { } }; class NCURSES_IMPEXP NCursesMenuException : public NCursesException { public: const NCursesMenu* m; NCursesMenuException (const char *msg, int err) : NCursesException (msg, err), m (0) {}; NCursesMenuException (const NCursesMenu* menu, const char *msg, int err) : NCursesException (msg, err), m (menu) {}; NCursesMenuException (int err) : NCursesException ("menu library error", err), m (0) {}; NCursesMenuException (const NCursesMenu* menu, int err) : NCursesException ("menu library error", err), m (menu) {}; NCursesMenuException& operator=(const NCursesMenuException& rhs) { if (this != &rhs) { NCursesException::operator=(rhs); m = rhs.m; } return *this; } NCursesMenuException(const NCursesMenuException& rhs) : NCursesException(rhs), m(rhs.m) { } virtual const char *classname() const { return "NCursesMenu"; } virtual ~NCursesMenuException() { } }; class NCURSES_IMPEXP NCursesFormException : public NCursesException { public: const NCursesForm* f; NCursesFormException (const char *msg, int err) : NCursesException (msg, err), f (0) {}; NCursesFormException (const NCursesForm* form, const char *msg, int err) : NCursesException (msg, err), f (form) {}; NCursesFormException (int err) : NCursesException ("form library error", err), f (0) {}; NCursesFormException (const NCursesForm* form, int err) : NCursesException ("form library error", err), f (form) {}; NCursesFormException& operator=(const NCursesFormException& rhs) { if (this != &rhs) { NCursesException::operator=(rhs); f = rhs.f; } return *this; } NCursesFormException(const NCursesFormException& rhs) : NCursesException(rhs), f(rhs.f) { } virtual const char *classname() const { return "NCursesForm"; } virtual ~NCursesFormException() { } }; #if !((defined(__GNUG__) && defined(__EXCEPTIONS)) || defined(__SUNPRO_CC)) # if HAVE_IOSTREAM # include <iostream> # if IOSTREAM_NAMESPACE using std::cerr; using std::endl; # endif # else # include <iostream.h> # endif extern "C" void exit(int); #endif inline void THROW(const NCursesException *e) { #if defined(__GNUG__) && defined(__EXCEPTIONS) # if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) (*lib_error_handler)(e ? e->classname() : "", e ? e->message : ""); #else #define CPP_HAS_TRY_CATCH 1 #endif #elif defined(__SUNPRO_CC) # if !defined(__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT < 5) genericerror(1, ((e != 0) ? (char *)(e->message) : "")); #else #define CPP_HAS_TRY_CATCH 1 #endif #else if (e) cerr << e->message << endl; exit(0); #endif #ifndef CPP_HAS_TRY_CATCH #define CPP_HAS_TRY_CATCH 0 #define NCURSES_CPP_TRY /* nothing */ #define NCURSES_CPP_CATCH(e) if (false) #define THROWS(s) /* nothing */ #define THROW2(s,t) /* nothing */ #elif CPP_HAS_TRY_CATCH throw *e; #define NCURSES_CPP_TRY try #define NCURSES_CPP_CATCH(e) catch(e) #define THROWS(s) throw(s) #define THROW2(s,t) throw(s,t) #endif } #endif /* NCURSES_ETIP_H_incl */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tic.h�����������������������������������������������������������������������������������������������0000644�����������������00000030552�14763166026�0005514 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/**************************************************************************** * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /**************************************************************************** * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * * and: Eric S. Raymond <esr@snark.thyrsus.com> * * and: Thomas E. Dickey 1996 on * ****************************************************************************/ /* * $Id: tic.h,v 1.69 2012/03/17 18:22:10 tom Exp $ * tic.h - Global variables and structures for the terminfo * compiler. */ #ifndef __TIC_H #define __TIC_H /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { #endif #include <curses.h> /* for the _tracef() prototype, ERR/OK, bool defs */ /* ** The format of compiled terminfo files is as follows: ** ** Header (12 bytes), containing information given below ** Names Section, containing the names of the terminal ** Boolean Section, containing the values of all of the ** boolean capabilities ** A null byte may be inserted here to make ** sure that the Number Section begins on an ** even word boundary. ** Number Section, containing the values of all of the numeric ** capabilities, each as a short integer ** String Section, containing short integer offsets into the ** String Table, one per string capability ** String Table, containing the actual characters of the string ** capabilities. ** ** NOTE that all short integers in the file are stored using VAX/PDP-style ** byte-order, i.e., least-significant byte first. ** ** There is no structure definition here because it would only confuse ** matters. Terminfo format is a raw byte layout, not a structure ** dump. If you happen to be on a little-endian machine with 16-bit ** shorts that requires no padding between short members in a struct, ** then there is a natural C structure that captures the header, but ** not very helpfully. */ #define MAGIC 0432 /* first two bytes of a compiled entry */ #undef BYTE #define BYTE(p,n) (unsigned char)((p)[n]) #define IS_NEG1(p) ((BYTE(p,0) == 0377) && (BYTE(p,1) == 0377)) #define IS_NEG2(p) ((BYTE(p,0) == 0376) && (BYTE(p,1) == 0377)) #define LOW_MSB(p) (BYTE(p,0) + 256*BYTE(p,1)) #define IS_TIC_MAGIC(p) (LOW_MSB(p) == MAGIC) /* * The "maximum" here is misleading; XSI guarantees minimum values, which a * given implementation may exceed. */ #define MAX_NAME_SIZE 512 /* maximum legal name field size (XSI:127) */ #define MAX_ENTRY_SIZE 4096 /* maximum legal entry size */ /* * The maximum size of individual name or alias is guaranteed in XSI to be at * least 14, since that corresponds to the older filename lengths. Newer * systems allow longer aliases, though not many terminal descriptions are * written to use them. The MAX_ALIAS symbol is used for warnings. */ #if HAVE_LONG_FILE_NAMES #define MAX_ALIAS 32 /* smaller than POSIX minimum for PATH_MAX */ #else #define MAX_ALIAS 14 /* SVr3 filename length */ #endif /* location of user's personal info directory */ #define PRIVATE_INFO "%s/.terminfo" /* plug getenv("HOME") into %s */ /* * Some traces are designed to be used via tic's verbose option (and similar in * infocmp and toe) rather than the 'trace()' function. So we use the bits * above the normal trace() parameter as a debug-level. */ #define MAX_DEBUG_LEVEL 15 #define DEBUG_LEVEL(n) ((n) << TRACE_SHIFT) #define set_trace_level(n) \ _nc_tracing &= DEBUG_LEVEL(MAX_DEBUG_LEVEL), \ _nc_tracing |= DEBUG_LEVEL(n) #ifdef TRACE #define DEBUG(n, a) if (_nc_tracing >= DEBUG_LEVEL(n)) _tracef a #else #define DEBUG(n, a) /*nothing*/ #endif extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing; extern NCURSES_EXPORT(void) _nc_tracef (char *, ...) GCC_PRINTFLIKE(1,2); extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *); extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *); /* * These are the types of tokens returned by the scanner. The first * three are also used in the hash table of capability names. The scanner * returns one of these values after loading the specifics into the global * structure curr_token. */ #define BOOLEAN 0 /* Boolean capability */ #define NUMBER 1 /* Numeric capability */ #define STRING 2 /* String-valued capability */ #define CANCEL 3 /* Capability to be cancelled in following tc's */ #define NAMES 4 /* The names for a terminal type */ #define UNDEF 5 /* Undefined */ #define NO_PUSHBACK -1 /* used in pushtype to indicate no pushback */ /* * The global structure in which the specific parts of a * scanned token are returned. * */ struct token { char *tk_name; /* name of capability */ int tk_valnumber; /* value of capability (if a number) */ char *tk_valstring; /* value of capability (if a string) */ }; extern NCURSES_EXPORT_VAR(struct token) _nc_curr_token; /* * Offsets to string capabilities, with the corresponding functionkey * codes. */ struct tinfo_fkeys { unsigned offset; chtype code; }; #if BROKEN_LINKER #define _nc_tinfo_fkeys _nc_tinfo_fkeysf() extern NCURSES_EXPORT(const struct tinfo_fkeys *) _nc_tinfo_fkeysf (void); #else extern NCURSES_EXPORT_VAR(const struct tinfo_fkeys) _nc_tinfo_fkeys[]; #endif typedef short HashValue; /* * The file comp_captab.c contains an array of these structures, one * per possible capability. These are indexed by a hash table array of * pointers to the same structures for use by the parser. */ struct name_table_entry { const char *nte_name; /* name to hash on */ int nte_type; /* BOOLEAN, NUMBER or STRING */ HashValue nte_index; /* index of associated variable in its array */ HashValue nte_link; /* index in table of next hash, or -1 */ }; /* * Use this structure to hide differences between terminfo and termcap * tables. */ typedef struct { unsigned table_size; const HashValue *table_data; HashValue (*hash_of)(const char *); int (*compare_names)(const char *, const char *); } HashData; struct alias { const char *from; const char *to; const char *source; }; extern NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool); extern NCURSES_EXPORT(const HashData *) _nc_get_hash_info (bool); extern NCURSES_EXPORT(const HashValue *) _nc_get_hash_table (bool); extern NCURSES_EXPORT(const struct alias *) _nc_get_alias_table (bool); #define NOTFOUND ((struct name_table_entry *) 0) /* * The casts are required for correct sign-propagation with systems such as * AIX, IRIX64, Solaris which default to unsigned characters. The C standard * leaves this detail unspecified. */ /* out-of-band values for representing absent capabilities */ #define ABSENT_BOOLEAN ((signed char)-1) /* 255 */ #define ABSENT_NUMERIC (-1) #define ABSENT_STRING (char *)0 /* out-of-band values for representing cancels */ #define CANCELLED_BOOLEAN ((signed char)-2) /* 254 */ #define CANCELLED_NUMERIC (-2) #define CANCELLED_STRING (char *)(-1) #define VALID_BOOLEAN(s) ((unsigned char)(s) <= 1) /* reject "-1" */ #define VALID_NUMERIC(s) ((s) >= 0) #define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING) /* termcap entries longer than this may break old binaries */ #define MAX_TERMCAP_LENGTH 1023 /* this is a documented limitation of terminfo */ #define MAX_TERMINFO_LENGTH 4096 #ifndef TERMINFO #define TERMINFO "/usr/share/terminfo" #endif #ifdef NCURSES_TERM_ENTRY_H_incl /* access.c */ extern NCURSES_EXPORT(unsigned) _nc_pathlast (const char *); extern NCURSES_EXPORT(bool) _nc_is_abs_path (const char *); extern NCURSES_EXPORT(bool) _nc_is_dir_path (const char *); extern NCURSES_EXPORT(bool) _nc_is_file_path (const char *); extern NCURSES_EXPORT(char *) _nc_basename (char *); extern NCURSES_EXPORT(char *) _nc_rootname (char *); /* comp_hash.c: name lookup */ extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_entry (const char *, const HashValue *); extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_type_entry (const char *, int, bool); /* comp_scan.c: lexical analysis */ extern NCURSES_EXPORT(int) _nc_get_token (bool); extern NCURSES_EXPORT(void) _nc_panic_mode (char); extern NCURSES_EXPORT(void) _nc_push_token (int); extern NCURSES_EXPORT(void) _nc_reset_input (FILE *, char *); extern NCURSES_EXPORT_VAR(int) _nc_curr_col; extern NCURSES_EXPORT_VAR(int) _nc_curr_line; extern NCURSES_EXPORT_VAR(int) _nc_syntax; extern NCURSES_EXPORT_VAR(int) _nc_strict_bsd; extern NCURSES_EXPORT_VAR(long) _nc_comment_end; extern NCURSES_EXPORT_VAR(long) _nc_comment_start; extern NCURSES_EXPORT_VAR(long) _nc_curr_file_pos; extern NCURSES_EXPORT_VAR(long) _nc_start_line; #define SYN_TERMINFO 0 #define SYN_TERMCAP 1 /* comp_error.c: warning & abort messages */ extern NCURSES_EXPORT(const char *) _nc_get_source (void); extern NCURSES_EXPORT(void) _nc_err_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; extern NCURSES_EXPORT(void) _nc_get_type (char *name); extern NCURSES_EXPORT(void) _nc_set_source (const char *const); extern NCURSES_EXPORT(void) _nc_set_type (const char *const); extern NCURSES_EXPORT(void) _nc_syserr_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; extern NCURSES_EXPORT(void) _nc_warning (const char *const,...) GCC_PRINTFLIKE(1,2); extern NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings; /* comp_expand.c: expand string into readable form */ extern NCURSES_EXPORT(char *) _nc_tic_expand (const char *, bool, int); /* comp_scan.c: decode string from readable form */ extern NCURSES_EXPORT(int) _nc_trans_string (char *, char *); /* captoinfo.c: capability conversion */ extern NCURSES_EXPORT(char *) _nc_captoinfo (const char *, const char *, int const); extern NCURSES_EXPORT(char *) _nc_infotocap (const char *, const char *, int const); /* home_terminfo.c */ extern NCURSES_EXPORT(char *) _nc_home_terminfo (void); /* lib_tparm.c */ #define NUM_PARM 9 extern NCURSES_EXPORT_VAR(int) _nc_tparm_err; extern NCURSES_EXPORT(int) _nc_tparm_analyze(const char *, char **, int *); /* lib_tputs.c */ extern NCURSES_EXPORT_VAR(int) _nc_nulls_sent; /* Add one for every null sent */ /* comp_main.c: compiler main */ extern const char * _nc_progname; /* db_iterator.c */ extern NCURSES_EXPORT(const char *) _nc_next_db(DBDIRS *, int *); extern NCURSES_EXPORT(const char *) _nc_tic_dir (const char *); extern NCURSES_EXPORT(void) _nc_first_db(DBDIRS *, int *); extern NCURSES_EXPORT(void) _nc_last_db(void); /* write_entry.c */ extern NCURSES_EXPORT(int) _nc_tic_written (void); #endif /* NCURSES_TERM_ENTRY_H_incl */ #ifdef __cplusplus } #endif /* *INDENT-ON* */ #endif /* __TIC_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������cursesw.h�������������������������������������������������������������������������������������������0000644�����������������00000140363�14763166026�0006432 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// * This makes emacs happy -*-Mode: C++;-*- // vile:cppmode /**************************************************************************** * Copyright (c) 1998-2008,2011 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ #ifndef NCURSES_CURSESW_H_incl #define NCURSES_CURSESW_H_incl 1 // $Id: cursesw.h,v 1.49 2011/09/17 22:12:10 tom Exp $ #include <etip.h> extern "C" { # include <curses.h> } /* SCO 3.2v4 curses.h includes term.h, which defines lines as a macro. Undefine it here, because NCursesWindow uses lines as a method. */ #undef lines /* "Convert" macros to inlines. We'll define it as another symbol to avoid * conflict with library symbols. */ #undef UNDEF #define UNDEF(name) CUR_ ##name #ifdef addch inline int UNDEF(addch)(chtype ch) { return addch(ch); } #undef addch #define addch UNDEF(addch) #endif #ifdef addchstr inline int UNDEF(addchstr)(chtype *at) { return addchstr(at); } #undef addchstr #define addchstr UNDEF(addchstr) #endif #ifdef addnstr inline int UNDEF(addnstr)(const char *str, int n) { return addnstr(str, n); } #undef addnstr #define addnstr UNDEF(addnstr) #endif #ifdef addstr inline int UNDEF(addstr)(const char * str) { return addstr(str); } #undef addstr #define addstr UNDEF(addstr) #endif #ifdef attroff inline int UNDEF(attroff)(chtype at) { return attroff(at); } #undef attroff #define attroff UNDEF(attroff) #endif #ifdef attron inline int UNDEF(attron)(chtype at) { return attron(at); } #undef attron #define attron UNDEF(attron) #endif #ifdef attrset inline chtype UNDEF(attrset)(chtype at) { return attrset(at); } #undef attrset #define attrset UNDEF(attrset) #endif #ifdef bkgd inline int UNDEF(bkgd)(chtype ch) { return bkgd(ch); } #undef bkgd #define bkgd UNDEF(bkgd) #endif #ifdef bkgdset inline void UNDEF(bkgdset)(chtype ch) { bkgdset(ch); } #undef bkgdset #define bkgdset UNDEF(bkgdset) #endif #ifdef border inline int UNDEF(border)(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br) { return border(ls, rs, ts, bs, tl, tr, bl, br); } #undef border #define border UNDEF(border) #endif #ifdef box inline int UNDEF(box)(WINDOW *win, int v, int h) { return box(win, v, h); } #undef box #define box UNDEF(box) #endif #ifdef chgat inline int UNDEF(chgat)(int n, attr_t attr, short color, const void *opts) { return chgat(n, attr, color, opts); } #undef chgat #define chgat UNDEF(chgat) #endif #ifdef clear inline int UNDEF(clear)() { return clear(); } #undef clear #define clear UNDEF(clear) #endif #ifdef clearok inline int UNDEF(clearok)(WINDOW* win, bool bf) { return clearok(win, bf); } #undef clearok #define clearok UNDEF(clearok) #else extern "C" NCURSES_IMPEXP int NCURSES_API clearok(WINDOW*, bool); #endif #ifdef clrtobot inline int UNDEF(clrtobot)() { return clrtobot(); } #undef clrtobot #define clrtobot UNDEF(clrtobot) #endif #ifdef clrtoeol inline int UNDEF(clrtoeol)() { return clrtoeol(); } #undef clrtoeol #define clrtoeol UNDEF(clrtoeol) #endif #ifdef color_set inline chtype UNDEF(color_set)(short p, void* opts) { return color_set(p, opts); } #undef color_set #define color_set UNDEF(color_set) #endif #ifdef crmode inline int UNDEF(crmode)(void) { return crmode(); } #undef crmode #define crmode UNDEF(crmode) #endif #ifdef delch inline int UNDEF(delch)() { return delch(); } #undef delch #define delch UNDEF(delch) #endif #ifdef deleteln inline int UNDEF(deleteln)() { return deleteln(); } #undef deleteln #define deleteln UNDEF(deleteln) #endif #ifdef echochar inline int UNDEF(echochar)(chtype ch) { return echochar(ch); } #undef echochar #define echochar UNDEF(echochar) #endif #ifdef erase inline int UNDEF(erase)() { return erase(); } #undef erase #define erase UNDEF(erase) #endif #ifdef fixterm inline int UNDEF(fixterm)(void) { return fixterm(); } #undef fixterm #define fixterm UNDEF(fixterm) #endif #ifdef flushok inline int UNDEF(flushok)(WINDOW* _win, bool _bf) { return flushok(_win, _bf); } #undef flushok #define flushok UNDEF(flushok) #else #define _no_flushok #endif #ifdef getattrs inline int UNDEF(getattrs)(WINDOW *win) { return getattrs(win); } #undef getattrs #define getattrs UNDEF(getattrs) #endif #ifdef getbegyx inline void UNDEF(getbegyx)(WINDOW* win, int& y, int& x) { getbegyx(win, y, x); } #undef getbegyx #define getbegyx UNDEF(getbegyx) #endif #ifdef getbkgd inline chtype UNDEF(getbkgd)(const WINDOW *win) { return getbkgd(win); } #undef getbkgd #define getbkgd UNDEF(getbkgd) #endif #ifdef getch inline int UNDEF(getch)() { return getch(); } #undef getch #define getch UNDEF(getch) #endif #ifdef getmaxyx inline void UNDEF(getmaxyx)(WINDOW* win, int& y, int& x) { getmaxyx(win, y, x); } #undef getmaxyx #define getmaxyx UNDEF(getmaxyx) #endif #ifdef getnstr inline int UNDEF(getnstr)(char *_str, int n) { return getnstr(_str, n); } #undef getnstr #define getnstr UNDEF(getnstr) #endif #ifdef getparyx inline void UNDEF(getparyx)(WINDOW* win, int& y, int& x) { getparyx(win, y, x); } #undef getparyx #define getparyx UNDEF(getparyx) #endif #ifdef getstr inline int UNDEF(getstr)(char *_str) { return getstr(_str); } #undef getstr #define getstr UNDEF(getstr) #endif #ifdef getyx inline void UNDEF(getyx)(const WINDOW* win, int& y, int& x) { getyx(win, y, x); } #undef getyx #define getyx UNDEF(getyx) #endif #ifdef hline inline int UNDEF(hline)(chtype ch, int n) { return hline(ch, n); } #undef hline #define hline UNDEF(hline) #endif #ifdef inch inline chtype UNDEF(inch)() { return inch(); } #undef inch #define inch UNDEF(inch) #endif #ifdef inchstr inline int UNDEF(inchstr)(chtype *str) { return inchstr(str); } #undef inchstr #define inchstr UNDEF(inchstr) #endif #ifdef innstr inline int UNDEF(innstr)(char *_str, int n) { return innstr(_str, n); } #undef innstr #define innstr UNDEF(innstr) #endif #ifdef insch inline int UNDEF(insch)(chtype c) { return insch(c); } #undef insch #define insch UNDEF(insch) #endif #ifdef insdelln inline int UNDEF(insdelln)(int n) { return insdelln(n); } #undef insdelln #define insdelln UNDEF(insdelln) #endif #ifdef insertln inline int UNDEF(insertln)() { return insertln(); } #undef insertln #define insertln UNDEF(insertln) #endif #ifdef insnstr inline int UNDEF(insnstr)(const char *_str, int n) { return insnstr(_str, n); } #undef insnstr #define insnstr UNDEF(insnstr) #endif #ifdef insstr inline int UNDEF(insstr)(const char *_str) { return insstr(_str); } #undef insstr #define insstr UNDEF(insstr) #endif #ifdef instr inline int UNDEF(instr)(char *_str) { return instr(_str); } #undef instr #define instr UNDEF(instr) #endif #ifdef intrflush inline void UNDEF(intrflush)(WINDOW *win, bool bf) { intrflush(); } #undef intrflush #define intrflush UNDEF(intrflush) #endif #ifdef leaveok inline int UNDEF(leaveok)(WINDOW* win, bool bf) { return leaveok(win, bf); } #undef leaveok #define leaveok UNDEF(leaveok) #else extern "C" NCURSES_IMPEXP int NCURSES_API leaveok(WINDOW* win, bool bf); #endif #ifdef move inline int UNDEF(move)(int x, int y) { return move(x, y); } #undef move #define move UNDEF(move) #endif #ifdef mvaddch inline int UNDEF(mvaddch)(int y, int x, chtype ch) { return mvaddch(y, x, ch); } #undef mvaddch #define mvaddch UNDEF(mvaddch) #endif #ifdef mvaddnstr inline int UNDEF(mvaddnstr)(int y, int x, const char *str, int n) { return mvaddnstr(y, x, str, n); } #undef mvaddnstr #define mvaddnstr UNDEF(mvaddnstr) #endif #ifdef mvaddstr inline int UNDEF(mvaddstr)(int y, int x, const char * str) { return mvaddstr(y, x, str); } #undef mvaddstr #define mvaddstr UNDEF(mvaddstr) #endif #ifdef mvchgat inline int UNDEF(mvchgat)(int y, int x, int n, attr_t attr, short color, const void *opts) { return mvchgat(y, x, n, attr, color, opts); } #undef mvchgat #define mvchgat UNDEF(mvchgat) #endif #ifdef mvdelch inline int UNDEF(mvdelch)(int y, int x) { return mvdelch(y, x);} #undef mvdelch #define mvdelch UNDEF(mvdelch) #endif #ifdef mvgetch inline int UNDEF(mvgetch)(int y, int x) { return mvgetch(y, x);} #undef mvgetch #define mvgetch UNDEF(mvgetch) #endif #ifdef mvgetnstr inline int UNDEF(mvgetnstr)(int y, int x, char *str, int n) { return mvgetnstr(y, x, str, n);} #undef mvgetnstr #define mvgetnstr UNDEF(mvgetnstr) #endif #ifdef mvgetstr inline int UNDEF(mvgetstr)(int y, int x, char *str) {return mvgetstr(y, x, str);} #undef mvgetstr #define mvgetstr UNDEF(mvgetstr) #endif #ifdef mvinch inline chtype UNDEF(mvinch)(int y, int x) { return mvinch(y, x);} #undef mvinch #define mvinch UNDEF(mvinch) #endif #ifdef mvinnstr inline int UNDEF(mvinnstr)(int y, int x, char *_str, int n) { return mvinnstr(y, x, _str, n); } #undef mvinnstr #define mvinnstr UNDEF(mvinnstr) #endif #ifdef mvinsch inline int UNDEF(mvinsch)(int y, int x, chtype c) { return mvinsch(y, x, c); } #undef mvinsch #define mvinsch UNDEF(mvinsch) #endif #ifdef mvinsnstr inline int UNDEF(mvinsnstr)(int y, int x, const char *_str, int n) { return mvinsnstr(y, x, _str, n); } #undef mvinsnstr #define mvinsnstr UNDEF(mvinsnstr) #endif #ifdef mvinsstr inline int UNDEF(mvinsstr)(int y, int x, const char *_str) { return mvinsstr(y, x, _str); } #undef mvinsstr #define mvinsstr UNDEF(mvinsstr) #endif #ifdef mvwaddch inline int UNDEF(mvwaddch)(WINDOW *win, int y, int x, const chtype ch) { return mvwaddch(win, y, x, ch); } #undef mvwaddch #define mvwaddch UNDEF(mvwaddch) #endif #ifdef mvwaddchnstr inline int UNDEF(mvwaddchnstr)(WINDOW *win, int y, int x, const chtype *str, int n) { return mvwaddchnstr(win, y, x, str, n); } #undef mvwaddchnstr #define mvwaddchnstr UNDEF(mvwaddchnstr) #endif #ifdef mvwaddchstr inline int UNDEF(mvwaddchstr)(WINDOW *win, int y, int x, const chtype *str) { return mvwaddchstr(win, y, x, str); } #undef mvwaddchstr #define mvwaddchstr UNDEF(mvwaddchstr) #endif #ifdef mvwaddnstr inline int UNDEF(mvwaddnstr)(WINDOW *win, int y, int x, const char *str, int n) { return mvwaddnstr(win, y, x, str, n); } #undef mvwaddnstr #define mvwaddnstr UNDEF(mvwaddnstr) #endif #ifdef mvwaddstr inline int UNDEF(mvwaddstr)(WINDOW *win, int y, int x, const char * str) { return mvwaddstr(win, y, x, str); } #undef mvwaddstr #define mvwaddstr UNDEF(mvwaddstr) #endif #ifdef mvwchgat inline int UNDEF(mvwchgat)(WINDOW *win, int y, int x, int n, attr_t attr, short color, const void *opts) { return mvwchgat(win, y, x, n, attr, color, opts); } #undef mvwchgat #define mvwchgat UNDEF(mvwchgat) #endif #ifdef mvwdelch inline int UNDEF(mvwdelch)(WINDOW *win, int y, int x) { return mvwdelch(win, y, x); } #undef mvwdelch #define mvwdelch UNDEF(mvwdelch) #endif #ifdef mvwgetch inline int UNDEF(mvwgetch)(WINDOW *win, int y, int x) { return mvwgetch(win, y, x);} #undef mvwgetch #define mvwgetch UNDEF(mvwgetch) #endif #ifdef mvwgetnstr inline int UNDEF(mvwgetnstr)(WINDOW *win, int y, int x, char *str, int n) {return mvwgetnstr(win, y, x, str, n);} #undef mvwgetnstr #define mvwgetnstr UNDEF(mvwgetnstr) #endif #ifdef mvwgetstr inline int UNDEF(mvwgetstr)(WINDOW *win, int y, int x, char *str) {return mvwgetstr(win, y, x, str);} #undef mvwgetstr #define mvwgetstr UNDEF(mvwgetstr) #endif #ifdef mvwhline inline int UNDEF(mvwhline)(WINDOW *win, int y, int x, chtype c, int n) { return mvwhline(win, y, x, c, n); } #undef mvwhline #define mvwhline UNDEF(mvwhline) #endif #ifdef mvwinch inline chtype UNDEF(mvwinch)(WINDOW *win, int y, int x) { return mvwinch(win, y, x);} #undef mvwinch #define mvwinch UNDEF(mvwinch) #endif #ifdef mvwinchnstr inline int UNDEF(mvwinchnstr)(WINDOW *win, int y, int x, chtype *str, int n) { return mvwinchnstr(win, y, x, str, n); } #undef mvwinchnstr #define mvwinchnstr UNDEF(mvwinchnstr) #endif #ifdef mvwinchstr inline int UNDEF(mvwinchstr)(WINDOW *win, int y, int x, chtype *str) { return mvwinchstr(win, y, x, str); } #undef mvwinchstr #define mvwinchstr UNDEF(mvwinchstr) #endif #ifdef mvwinnstr inline int UNDEF(mvwinnstr)(WINDOW *win, int y, int x, char *_str, int n) { return mvwinnstr(win, y, x, _str, n); } #undef mvwinnstr #define mvwinnstr UNDEF(mvwinnstr) #endif #ifdef mvwinsch inline int UNDEF(mvwinsch)(WINDOW *win, int y, int x, chtype c) { return mvwinsch(win, y, x, c); } #undef mvwinsch #define mvwinsch UNDEF(mvwinsch) #endif #ifdef mvwinsnstr inline int UNDEF(mvwinsnstr)(WINDOW *w, int y, int x, const char *_str, int n) { return mvwinsnstr(w, y, x, _str, n); } #undef mvwinsnstr #define mvwinsnstr UNDEF(mvwinsnstr) #endif #ifdef mvwinsstr inline int UNDEF(mvwinsstr)(WINDOW *w, int y, int x, const char *_str) { return mvwinsstr(w, y, x, _str); } #undef mvwinsstr #define mvwinsstr UNDEF(mvwinsstr) #endif #ifdef mvwvline inline int UNDEF(mvwvline)(WINDOW *win, int y, int x, chtype c, int n) { return mvwvline(win, y, x, c, n); } #undef mvwvline #define mvwvline UNDEF(mvwvline) #endif #ifdef napms inline void UNDEF(napms)(unsigned long x) { napms(x); } #undef napms #define napms UNDEF(napms) #endif #ifdef nocrmode inline int UNDEF(nocrmode)(void) { return nocrmode(); } #undef nocrmode #define nocrmode UNDEF(nocrmode) #endif #ifdef nodelay inline void UNDEF(nodelay)() { nodelay(); } #undef nodelay #define nodelay UNDEF(nodelay) #endif #ifdef redrawwin inline int UNDEF(redrawwin)(WINDOW *win) { return redrawwin(win); } #undef redrawwin #define redrawwin UNDEF(redrawwin) #endif #ifdef refresh inline int UNDEF(refresh)() { return refresh(); } #undef refresh #define refresh UNDEF(refresh) #endif #ifdef resetterm inline int UNDEF(resetterm)(void) { return resetterm(); } #undef resetterm #define resetterm UNDEF(resetterm) #endif #ifdef saveterm inline int UNDEF(saveterm)(void) { return saveterm(); } #undef saveterm #define saveterm UNDEF(saveterm) #endif #ifdef scrl inline int UNDEF(scrl)(int l) { return scrl(l); } #undef scrl #define scrl UNDEF(scrl) #endif #ifdef scroll inline int UNDEF(scroll)(WINDOW *win) { return scroll(win); } #undef scroll #define scroll UNDEF(scroll) #endif #ifdef scrollok inline int UNDEF(scrollok)(WINDOW* win, bool bf) { return scrollok(win, bf); } #undef scrollok #define scrollok UNDEF(scrollok) #else #if defined(__NCURSES_H) extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, bool); #else extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, char); #endif #endif #ifdef setscrreg inline int UNDEF(setscrreg)(int t, int b) { return setscrreg(t, b); } #undef setscrreg #define setscrreg UNDEF(setscrreg) #endif #ifdef standend inline int UNDEF(standend)() { return standend(); } #undef standend #define standend UNDEF(standend) #endif #ifdef standout inline int UNDEF(standout)() { return standout(); } #undef standout #define standout UNDEF(standout) #endif #ifdef subpad inline WINDOW *UNDEF(subpad)(WINDOW *p, int l, int c, int y, int x) { return derwin(p, l, c, y, x); } #undef subpad #define subpad UNDEF(subpad) #endif #ifdef timeout inline void UNDEF(timeout)(int delay) { timeout(delay); } #undef timeout #define timeout UNDEF(timeout) #endif #ifdef touchline inline int UNDEF(touchline)(WINDOW *win, int s, int c) { return touchline(win, s, c); } #undef touchline #define touchline UNDEF(touchline) #endif #ifdef touchwin inline int UNDEF(touchwin)(WINDOW *win) { return touchwin(win); } #undef touchwin #define touchwin UNDEF(touchwin) #endif #ifdef untouchwin inline int UNDEF(untouchwin)(WINDOW *win) { return untouchwin(win); } #undef untouchwin #define untouchwin UNDEF(untouchwin) #endif #ifdef vline inline int UNDEF(vline)(chtype ch, int n) { return vline(ch, n); } #undef vline #define vline UNDEF(vline) #endif #ifdef waddchstr inline int UNDEF(waddchstr)(WINDOW *win, chtype *at) { return waddchstr(win, at); } #undef waddchstr #define waddchstr UNDEF(waddchstr) #endif #ifdef waddstr inline int UNDEF(waddstr)(WINDOW *win, char *str) { return waddstr(win, str); } #undef waddstr #define waddstr UNDEF(waddstr) #endif #ifdef wattroff inline int UNDEF(wattroff)(WINDOW *win, int att) { return wattroff(win, att); } #undef wattroff #define wattroff UNDEF(wattroff) #endif #ifdef wattrset inline int UNDEF(wattrset)(WINDOW *win, int att) { return wattrset(win, att); } #undef wattrset #define wattrset UNDEF(wattrset) #endif #ifdef winch inline chtype UNDEF(winch)(const WINDOW* win) { return winch(win); } #undef winch #define winch UNDEF(winch) #endif #ifdef winchnstr inline int UNDEF(winchnstr)(WINDOW *win, chtype *str, int n) { return winchnstr(win, str, n); } #undef winchnstr #define winchnstr UNDEF(winchnstr) #endif #ifdef winchstr inline int UNDEF(winchstr)(WINDOW *win, chtype *str) { return winchstr(win, str); } #undef winchstr #define winchstr UNDEF(winchstr) #endif #ifdef winsstr inline int UNDEF(winsstr)(WINDOW *w, const char *_str) { return winsstr(w, _str); } #undef winsstr #define winsstr UNDEF(winsstr) #endif #ifdef wstandend inline int UNDEF(wstandend)(WINDOW *win) { return wstandend(win); } #undef wstandend #define wstandend UNDEF(wstandend) #endif #ifdef wstandout inline int UNDEF(wstandout)(WINDOW *win) { return wstandout(win); } #undef wstandout #define wstandout UNDEF(wstandout) #endif /* * * C++ class for windows. * */ extern "C" int _nc_ripoffline(int, int (*init)(WINDOW*, int)); extern "C" int _nc_xx_ripoff_init(WINDOW *, int); extern "C" int _nc_has_mouse(void); class NCURSES_IMPEXP NCursesWindow { friend class NCursesMenu; friend class NCursesForm; private: static bool b_initialized; static void initialize(); void constructing(); friend int _nc_xx_ripoff_init(WINDOW *, int); void set_keyboard(); short getcolor(int getback) const; short getPair() const; static int setpalette(short fore, short back, short pair); static int colorInitialized; // This private constructor is only used during the initialization // of windows generated by ripoffline() calls. NCursesWindow(WINDOW* win, int ncols); protected: virtual void err_handler(const char *) const THROWS(NCursesException); // Signal an error with the given message text. static long count; // count of all active windows: // We rely on the c++ promise that // all otherwise uninitialized // static class vars are set to 0 WINDOW* w; // the curses WINDOW bool alloced; // TRUE if we own the WINDOW NCursesWindow* par; // parent, if subwindow NCursesWindow* subwins; // head of subwindows list NCursesWindow* sib; // next subwindow of parent void kill_subwindows(); // disable all subwindows // Destroy all subwindows. /* Only for use by derived classes. They are then in charge to fill the member variables correctly. */ NCursesWindow(); public: NCursesWindow(WINDOW* window); // useful only for stdscr NCursesWindow(int nlines, // number of lines int ncols, // number of columns int begin_y, // line origin int begin_x); // col origin NCursesWindow(NCursesWindow& par,// parent window int nlines, // number of lines int ncols, // number of columns int begin_y, // absolute or relative int begin_x, // origins: char absrel = 'a');// if `a', begin_y & begin_x are // absolute screen pos, else if `r', they are relative to par origin NCursesWindow(NCursesWindow& par,// parent window bool do_box = TRUE); // this is the very common case that we want to create the subwindow that // is two lines and two columns smaller and begins at (1,1). // We may automatically request the box around it. NCursesWindow& operator=(const NCursesWindow& rhs) { if (this != &rhs) *this = rhs; return *this; } NCursesWindow(const NCursesWindow& rhs) : w(rhs.w), alloced(rhs.alloced), par(rhs.par), subwins(rhs.subwins), sib(rhs.sib) { } virtual ~NCursesWindow(); NCursesWindow Clone(); // Make an exact copy of the window. // Initialization. static void useColors(void); // Call this routine very early if you want to have colors. static int ripoffline(int ripoff_lines, int (*init)(NCursesWindow& win)); // This function is used to generate a window of ripped-of lines. // If the argument is positive, lines are removed from the top, if it // is negative lines are removed from the bottom. This enhances the // lowlevel ripoffline() function because it uses the internal // implementation that allows to remove more than just a single line. // This function must be called before any other ncurses function. The // creation of the window is deferred until ncurses gets initialized. // The initialization function is then called. // ------------------------------------------------------------------------- // terminal status // ------------------------------------------------------------------------- int lines() const { initialize(); return LINES; } // Number of lines on terminal, *not* window int cols() const { initialize(); return COLS; } // Number of cols on terminal, *not* window int tabsize() const { initialize(); return TABSIZE; } // Size of a tab on terminal, *not* window static int NumberOfColors(); // Number of available colors int colors() const { return NumberOfColors(); } // Number of available colors // ------------------------------------------------------------------------- // window status // ------------------------------------------------------------------------- int height() const { return maxy() + 1; } // Number of lines in this window int width() const { return maxx() + 1; } // Number of columns in this window int begx() const { return getbegx(w); } // Column of top left corner relative to stdscr int begy() const { return getbegy(w); } // Line of top left corner relative to stdscr int curx() const { return getcurx(w); } // Column of top left corner relative to stdscr int cury() const { return getcury(w); } // Line of top left corner relative to stdscr int maxx() const { return getmaxx(w) == ERR ? ERR : getmaxx(w)-1; } // Largest x coord in window int maxy() const { return getmaxy(w) == ERR ? ERR : getmaxy(w)-1; } // Largest y coord in window short getcolor() const; // Actual color pair short foreground() const { return getcolor(0); } // Actual foreground color short background() const { return getcolor(1); } // Actual background color int setpalette(short fore, short back); // Set color palette entry int setcolor(short pair); // Set actually used palette entry // ------------------------------------------------------------------------- // window positioning // ------------------------------------------------------------------------- virtual int mvwin(int begin_y, int begin_x) { return ::mvwin(w, begin_y, begin_x); } // Move window to new position with the new position as top left corner. // This is virtual because it is redefined in NCursesPanel. // ------------------------------------------------------------------------- // coordinate positioning // ------------------------------------------------------------------------- int move(int y, int x) { return ::wmove(w, y, x); } // Move cursor the this position void getyx(int& y, int& x) const { ::getyx(w, y, x); } // Get current position of the cursor void getbegyx(int& y, int& x) const { ::getbegyx(w, y, x); } // Get beginning of the window void getmaxyx(int& y, int& x) const { ::getmaxyx(w, y, x); } // Get size of the window void getparyx(int& y, int& x) const { ::getparyx(w, y, x); } // Get parent's beginning of the window int mvcur(int oldrow, int oldcol, int newrow, int newcol) const { return ::mvcur(oldrow, oldcol, newrow, newcol); } // Perform lowlevel cursor motion that takes effect immediately. // ------------------------------------------------------------------------- // input // ------------------------------------------------------------------------- int getch() { return ::wgetch(w); } // Get a keystroke from the window. int getch(int y, int x) { return ::mvwgetch(w, y, x); } // Move cursor to position and get a keystroke from the window int getstr(char* str, int n=-1) { return ::wgetnstr(w, str, n); } // Read a series of characters into str until a newline or carriage return // is received. Read at most n characters. If n is negative, the limit is // ignored. int getstr(int y, int x, char* str, int n=-1) { return ::mvwgetnstr(w, y, x, str, n); } // Move the cursor to the requested position and then perform the getstr() // as described above. int instr(char *s, int n=-1) { return ::winnstr(w, s, n); } // Get a string of characters from the window into the buffer s. Retrieve // at most n characters, if n is negative retrieve all characters up to the // end of the current line. Attributes are stripped from the characters. int instr(int y, int x, char *s, int n=-1) { return ::mvwinnstr(w, y, x, s, n); } // Move the cursor to the requested position and then perform the instr() // as described above. int scanw(const char* fmt, ...) // Perform a scanw function from the window. #if __GNUG__ >= 2 __attribute__ ((format (scanf, 2, 3))); #else ; #endif int scanw(const char*, va_list); // Perform a scanw function from the window. int scanw(int y, int x, const char* fmt, ...) // Move the cursor to the requested position and then perform a scanw // from the window. #if __GNUG__ >= 2 __attribute__ ((format (scanf, 4, 5))); #else ; #endif int scanw(int y, int x, const char* fmt, va_list); // Move the cursor to the requested position and then perform a scanw // from the window. // ------------------------------------------------------------------------- // output // ------------------------------------------------------------------------- int addch(const chtype ch) { return ::waddch(w, ch); } // Put attributed character to the window. int addch(int y, int x, const chtype ch) { return ::mvwaddch(w, y, x, ch); } // Move cursor to the requested position and then put attributed character // to the window. int echochar(const chtype ch) { return ::wechochar(w, ch); } // Put attributed character to the window and refresh it immediately. int addstr(const char* str, int n=-1) { return ::waddnstr(w, str, n); } // Write the string str to the window, stop writing if the terminating // NUL or the limit n is reached. If n is negative, it is ignored. int addstr(int y, int x, const char * str, int n=-1) { return ::mvwaddnstr(w, y, x, str, n); } // Move the cursor to the requested position and then perform the addchstr // as described above. int addchstr(const chtype* str, int n=-1) { return ::waddchnstr(w, str, n); } // Write the string str to the window, stop writing if the terminating // NUL or the limit n is reached. If n is negative, it is ignored. int addchstr(int y, int x, const chtype * str, int n=-1) { return ::mvwaddchnstr(w, y, x, str, n); } // Move the cursor to the requested position and then perform the addchstr // as described above. int printw(const char* fmt, ...) // Do a formatted print to the window. #if (__GNUG__ >= 2) && !defined(printf) __attribute__ ((format (printf, 2, 3))); #else ; #endif int printw(int y, int x, const char * fmt, ...) // Move the cursor and then do a formatted print to the window. #if (__GNUG__ >= 2) && !defined(printf) __attribute__ ((format (printf, 4, 5))); #else ; #endif int printw(const char* fmt, va_list args); // Do a formatted print to the window. int printw(int y, int x, const char * fmt, va_list args); // Move the cursor and then do a formatted print to the window. chtype inch() const { return ::winch(w); } // Retrieve attributed character under the current cursor position. chtype inch(int y, int x) { return ::mvwinch(w, y, x); } // Move cursor to requested position and then retrieve attributed character // at this position. int inchstr(chtype* str, int n=-1) { return ::winchnstr(w, str, n); } // Read the string str from the window, stop reading if the terminating // NUL or the limit n is reached. If n is negative, it is ignored. int inchstr(int y, int x, chtype * str, int n=-1) { return ::mvwinchnstr(w, y, x, str, n); } // Move the cursor to the requested position and then perform the inchstr // as described above. int insch(chtype ch) { return ::winsch(w, ch); } // Insert attributed character into the window before current cursor // position. int insch(int y, int x, chtype ch) { return ::mvwinsch(w, y, x, ch); } // Move cursor to requested position and then insert the attributed // character before that position. int insertln() { return ::winsdelln(w, 1); } // Insert an empty line above the current line. int insdelln(int n=1) { return ::winsdelln(w, n); } // If n>0 insert that many lines above the current line. If n<0 delete // that many lines beginning with the current line. int insstr(const char *s, int n=-1) { return ::winsnstr(w, s, n); } // Insert the string into the window before the current cursor position. // Insert stops at end of string or when the limit n is reached. If n is // negative, it is ignored. int insstr(int y, int x, const char *s, int n=-1) { return ::mvwinsnstr(w, y, x, s, n); } // Move the cursor to the requested position and then perform the insstr() // as described above. int attron (chtype at) { return ::wattron (w, at); } // Switch on the window attributes; int attroff(chtype at) { return ::wattroff(w, static_cast<int>(at)); } // Switch off the window attributes; int attrset(chtype at) { return ::wattrset(w, static_cast<int>(at)); } // Set the window attributes; chtype attrget() { return ::getattrs(w); } // Get the window attributes; int color_set(short color_pair_number, void* opts=NULL) { return ::wcolor_set(w, color_pair_number, opts); } // Set the window color attribute; int chgat(int n, attr_t attr, short color, const void *opts=NULL) { return ::wchgat(w, n, attr, color, opts); } // Change the attributes of the next n characters in the current line. If // n is negative or greater than the number of remaining characters in the // line, the attributes will be changed up to the end of the line. int chgat(int y, int x, int n, attr_t attr, short color, const void *opts=NULL) { return ::mvwchgat(w, y, x, n, attr, color, opts); } // Move the cursor to the requested position and then perform chgat() as // described above. // ------------------------------------------------------------------------- // background // ------------------------------------------------------------------------- chtype getbkgd() const { return ::getbkgd(w); } // Get current background setting. int bkgd(const chtype ch) { return ::wbkgd(w, ch); } // Set the background property and apply it to the window. void bkgdset(chtype ch) { ::wbkgdset(w, ch); } // Set the background property. // ------------------------------------------------------------------------- // borders // ------------------------------------------------------------------------- int box(chtype vert=0, chtype hor=0) { return ::wborder(w, vert, vert, hor, hor, 0, 0, 0, 0); } // Draw a box around the window with the given vertical and horizontal // drawing characters. If you specify a zero as character, curses will try // to find a "nice" character. int border(chtype left=0, chtype right=0, chtype top =0, chtype bottom=0, chtype top_left =0, chtype top_right=0, chtype bottom_left =0, chtype bottom_right=0) { return ::wborder(w, left, right, top, bottom, top_left, top_right, bottom_left, bottom_right); } // Draw a border around the window with the given characters for the // various parts of the border. If you pass zero for a character, curses // will try to find "nice" characters. // ------------------------------------------------------------------------- // lines and boxes // ------------------------------------------------------------------------- int hline(int len, chtype ch=0) { return ::whline(w, ch, len); } // Draw a horizontal line of len characters with the given character. If // you pass zero for the character, curses will try to find a "nice" one. int hline(int y, int x, int len, chtype ch=0) { return ::mvwhline(w, y, x, ch, len); } // Move the cursor to the requested position and then draw a horizontal line. int vline(int len, chtype ch=0) { return ::wvline(w, ch, len); } // Draw a vertical line of len characters with the given character. If // you pass zero for the character, curses will try to find a "nice" one. int vline(int y, int x, int len, chtype ch=0) { return ::mvwvline(w, y, x, ch, len); } // Move the cursor to the requested position and then draw a vertical line. // ------------------------------------------------------------------------- // erasure // ------------------------------------------------------------------------- int erase() { return ::werase(w); } // Erase the window. int clear() { return ::wclear(w); } // Clear the window. int clearok(bool bf) { return ::clearok(w, bf); } // Set/Reset the clear flag. If set, the next refresh() will clear the // screen. int clrtobot() { return ::wclrtobot(w); } // Clear to the end of the window. int clrtoeol() { return ::wclrtoeol(w); } // Clear to the end of the line. int delch() { return ::wdelch(w); } // Delete character under the cursor. int delch(int y, int x) { return ::mvwdelch(w, y, x); } // Move cursor to requested position and delete the character under the // cursor. int deleteln() { return ::winsdelln(w, -1); } // Delete the current line. // ------------------------------------------------------------------------- // screen control // ------------------------------------------------------------------------- int scroll(int amount=1) { return ::wscrl(w, amount); } // Scroll amount lines. If amount is positive, scroll up, otherwise // scroll down. int scrollok(bool bf) { return ::scrollok(w, bf); } // If bf is TRUE, window scrolls if cursor is moved off the bottom // edge of the window or a scrolling region, otherwise the cursor is left // at the bottom line. int setscrreg(int from, int to) { return ::wsetscrreg(w, from, to); } // Define a soft scrolling region. int idlok(bool bf) { return ::idlok(w, bf); } // If bf is TRUE, use insert/delete line hardware support if possible. // Otherwise do it in software. void idcok(bool bf) { ::idcok(w, bf); } // If bf is TRUE, use insert/delete character hardware support if possible. // Otherwise do it in software. int touchline(int s, int c) { return ::touchline(w, s, c); } // Mark the given lines as modified. int touchwin() { return ::wtouchln(w, 0, height(), 1); } // Mark the whole window as modified. int untouchwin() { return ::wtouchln(w, 0, height(), 0); } // Mark the whole window as unmodified. int touchln(int s, int cnt, bool changed=TRUE) { return ::wtouchln(w, s, cnt, static_cast<int>(changed ? 1 : 0)); } // Mark cnt lines beginning from line s as changed or unchanged, depending // on the value of the changed flag. bool is_linetouched(int line) const { return (::is_linetouched(w, line) ? TRUE:FALSE); } // Return TRUE if line is marked as changed, FALSE otherwise bool is_wintouched() const { return (::is_wintouched(w) ? TRUE:FALSE); } // Return TRUE if window is marked as changed, FALSE otherwise int leaveok(bool bf) { return ::leaveok(w, bf); } // If bf is TRUE, curses will leave the cursor after an update whereever // it is after the update. int redrawln(int from, int n) { return ::wredrawln(w, from, n); } // Redraw n lines starting from the requested line int redrawwin() { return ::wredrawln(w, 0, height()); } // Redraw the whole window int doupdate() { return ::doupdate(); } // Do all outputs to make the physical screen looking like the virtual one void syncdown() { ::wsyncdown(w); } // Propagate the changes down to all descendant windows void syncup() { ::wsyncup(w); } // Propagate the changes up in the hierarchy void cursyncup() { ::wcursyncup(w); } // Position the cursor in all ancestor windows corresponding to our setting int syncok(bool bf) { return ::syncok(w, bf); } // If called with bf=TRUE, syncup() is called whenever the window is changed #ifndef _no_flushok int flushok(bool bf) { return ::flushok(w, bf); } #endif void immedok(bool bf) { ::immedok(w, bf); } // If called with bf=TRUE, any change in the window will cause an // automatic immediate refresh() int intrflush(bool bf) { return ::intrflush(w, bf); } int keypad(bool bf) { return ::keypad(w, bf); } // If called with bf=TRUE, the application will interpret function keys. int nodelay(bool bf) { return ::nodelay(w, bf); } int meta(bool bf) { return ::meta(w, bf); } // If called with bf=TRUE, keys may generate 8-Bit characters. Otherwise // 7-Bit characters are generated. int standout() { return ::wstandout(w); } // Enable "standout" attributes int standend() { return ::wstandend(w); } // Disable "standout" attributes // ------------------------------------------------------------------------- // The next two are virtual, because we redefine them in the // NCursesPanel class. // ------------------------------------------------------------------------- virtual int refresh() { return ::wrefresh(w); } // Propagate the changes in this window to the virtual screen and call // doupdate(). This is redefined in NCursesPanel. virtual int noutrefresh() { return ::wnoutrefresh(w); } // Propagate the changes in this window to the virtual screen. This is // redefined in NCursesPanel. // ------------------------------------------------------------------------- // multiple window control // ------------------------------------------------------------------------- int overlay(NCursesWindow& win) { return ::overlay(w, win.w); } // Overlay this window over win. int overwrite(NCursesWindow& win) { return ::overwrite(w, win.w); } // Overwrite win with this window. int copywin(NCursesWindow& win, int sminrow, int smincol, int dminrow, int dmincol, int dmaxrow, int dmaxcol, bool overlaywin=TRUE) { return ::copywin(w, win.w, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, static_cast<int>(overlaywin ? 1 : 0)); } // Overlay or overwrite the rectangle in win given by dminrow,dmincol, // dmaxrow,dmaxcol with the rectangle in this window beginning at // sminrow,smincol. // ------------------------------------------------------------------------- // Extended functions // ------------------------------------------------------------------------- #if defined(NCURSES_EXT_FUNCS) && (NCURSES_EXT_FUNCS != 0) int wresize(int newLines, int newColumns) { return ::wresize(w, newLines, newColumns); } #endif // ------------------------------------------------------------------------- // Mouse related // ------------------------------------------------------------------------- bool has_mouse() const; // Return TRUE if terminal supports a mouse, FALSE otherwise // ------------------------------------------------------------------------- // traversal support // ------------------------------------------------------------------------- NCursesWindow* child() { return subwins; } // Get the first child window. NCursesWindow* sibling() { return sib; } // Get the next child of my parent. NCursesWindow* parent() { return par; } // Get my parent. bool isDescendant(NCursesWindow& win); // Return TRUE if win is a descendant of this. }; // ------------------------------------------------------------------------- // We leave this here for compatibility reasons. // ------------------------------------------------------------------------- class NCURSES_IMPEXP NCursesColorWindow : public NCursesWindow { public: NCursesColorWindow(WINDOW* &window) // useful only for stdscr : NCursesWindow(window) { useColors(); } NCursesColorWindow(int nlines, // number of lines int ncols, // number of columns int begin_y, // line origin int begin_x) // col origin : NCursesWindow(nlines, ncols, begin_y, begin_x) { useColors(); } NCursesColorWindow(NCursesWindow& parentWin,// parent window int nlines, // number of lines int ncols, // number of columns int begin_y, // absolute or relative int begin_x, // origins: char absrel = 'a') // if `a', by & bx are : NCursesWindow(parentWin, nlines, ncols, // absolute screen pos, begin_y, begin_x, // else if `r', they are absrel ) { // relative to par origin useColors(); } }; // These enum definitions really belong inside the NCursesPad class, but only // recent compilers support that feature. typedef enum { REQ_PAD_REFRESH = KEY_MAX + 1, REQ_PAD_UP, REQ_PAD_DOWN, REQ_PAD_LEFT, REQ_PAD_RIGHT, REQ_PAD_EXIT } Pad_Request; const Pad_Request PAD_LOW = REQ_PAD_REFRESH; // lowest op-code const Pad_Request PAD_HIGH = REQ_PAD_EXIT; // highest op-code // ------------------------------------------------------------------------- // Pad Support. We allow an association of a pad with a "real" window // through which the pad may be viewed. // ------------------------------------------------------------------------- class NCURSES_IMPEXP NCursesPad : public NCursesWindow { private: NCursesWindow* viewWin; // the "viewport" window NCursesWindow* viewSub; // the "viewport" subwindow int h_gridsize, v_gridsize; protected: int min_row, min_col; // top left row/col of the pads display area NCursesWindow* Win(void) const { // Get the window into which the pad should be copied (if any) return (viewSub?viewSub:(viewWin?viewWin:0)); } NCursesWindow* getWindow(void) const { return viewWin; } NCursesWindow* getSubWindow(void) const { return viewSub; } virtual int driver (int key); // Virtualize keystroke key // The driver translates the keystroke c into an Pad_Request virtual void OnUnknownOperation(int pad_req) { (void) pad_req; ::beep(); } // This is called if the driver returns an unknown op-code virtual void OnNavigationError(int pad_req) { (void) pad_req; ::beep(); } // This is called if a navigation request couldn't be satisfied virtual void OnOperation(int pad_req) { (void) pad_req; }; // OnOperation is called if a Pad_Operation was executed and just before // the refresh() operation is done. public: NCursesPad(int nlines, int ncols); // create a pad with the given size NCursesPad& operator=(const NCursesPad& rhs) { if (this != &rhs) { *this = rhs; NCursesWindow::operator=(rhs); } return *this; } NCursesPad(const NCursesPad& rhs) : NCursesWindow(rhs), viewWin(rhs.viewWin), viewSub(rhs.viewSub), h_gridsize(rhs.h_gridsize), v_gridsize(rhs.v_gridsize), min_row(rhs.min_row), min_col(rhs.min_col) { } virtual ~NCursesPad() {} int echochar(const chtype ch) { return ::pechochar(w, ch); } // Put the attributed character onto the pad and immediately do a // prefresh(). int refresh(); // If a viewport is defined the pad is displayed in this window, otherwise // this is a noop. int refresh(int pminrow, int pmincol, int sminrow, int smincol, int smaxrow, int smaxcol) { return ::prefresh(w, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol); } // The coordinates sminrow,smincol,smaxrow,smaxcol describe a rectangle // on the screen. <b>refresh</b> copies a rectangle of this size beginning // with top left corner pminrow,pmincol onto the screen and calls doupdate(). int noutrefresh(); // If a viewport is defined the pad is displayed in this window, otherwise // this is a noop. int noutrefresh(int pminrow, int pmincol, int sminrow, int smincol, int smaxrow, int smaxcol) { return ::pnoutrefresh(w, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol); } // Does the same as refresh() but without calling doupdate(). virtual void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1); // Add the window "view" as viewing window to the pad. virtual void setSubWindow(NCursesWindow& sub); // Use the subwindow "sub" of the viewport window for the actual viewing. // The full viewport window is usually used to provide some decorations // like frames, titles etc. virtual void operator() (void); // Perform Pad's operation }; // A FramedPad is constructed always with a viewport window. This viewport // will be framed (by a box() command) and the interior of the box is the // viewport subwindow. On the frame we display scrollbar sliders. class NCURSES_IMPEXP NCursesFramedPad : public NCursesPad { protected: virtual void OnOperation(int pad_req); public: NCursesFramedPad(NCursesWindow& win, int nlines, int ncols, int v_grid = 1, int h_grid = 1) : NCursesPad(nlines, ncols) { NCursesPad::setWindow(win, v_grid, h_grid); NCursesPad::setSubWindow(*(new NCursesWindow(win))); } // Construct the FramedPad with the given Window win as viewport. virtual ~NCursesFramedPad() { delete getSubWindow(); } void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1) { (void) view; (void) v_grid; (void) h_grid; err_handler("Operation not allowed"); } // Disable this call; the viewport is already defined void setSubWindow(NCursesWindow& sub) { (void) sub; err_handler("Operation not allowed"); } // Disable this call; the viewport subwindow is already defined }; #endif /* NCURSES_CURSESW_H_incl */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������term_entry.h����������������������������������������������������������������������������������������0000644�����������������00000017641�14763166026�0007131 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/**************************************************************************** * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /**************************************************************************** * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * * and: Eric S. Raymond <esr@snark.thyrsus.com> * * and: Thomas E. Dickey 1998-on * ****************************************************************************/ /* $Id: term_entry.h,v 1.43 2013/02/02 20:07:23 tom Exp $ */ /* * term_entry.h -- interface to entry-manipulation code */ #ifndef NCURSES_TERM_ENTRY_H_incl #define NCURSES_TERM_ENTRY_H_incl 1 #ifdef __cplusplus extern "C" { #endif #include <term.h> /* * see db_iterator.c - this enumeration lists the places searched for a * terminal description and defines the order in which they are searched. */ typedef enum { dbdTIC = 0, /* special, used by tic when writing entry */ #if USE_DATABASE dbdEnvOnce, /* the $TERMINFO environment variable */ dbdHome, /* $HOME/.terminfo */ dbdEnvList, /* the $TERMINFO_DIRS environment variable */ dbdCfgList, /* the compiled-in TERMINFO_DIRS value */ dbdCfgOnce, /* the compiled-in TERMINFO value */ #endif #if USE_TERMCAP dbdEnvOnce2, /* the $TERMCAP environment variable */ dbdEnvList2, /* the $TERMPATH environment variable */ dbdCfgList2, /* the compiled-in TERMPATH */ #endif dbdLAST } DBDIRS; #define MAX_USES 32 #define MAX_CROSSLINKS 16 typedef struct entry { TERMTYPE tterm; unsigned nuses; struct { char *name; struct entry *link; long line; } uses[MAX_USES]; int ncrosslinks; struct entry *crosslinks[MAX_CROSSLINKS]; long cstart, cend; long startline; struct entry *next; struct entry *last; } ENTRY; /* *INDENT-OFF* */ #if NCURSES_XNAMES #define NUM_BOOLEANS(tp) (tp)->num_Booleans #define NUM_NUMBERS(tp) (tp)->num_Numbers #define NUM_STRINGS(tp) (tp)->num_Strings #define EXT_NAMES(tp,i,limit,index,table) (i >= limit) ? tp->ext_Names[index] : table[i] #else #define NUM_BOOLEANS(tp) BOOLCOUNT #define NUM_NUMBERS(tp) NUMCOUNT #define NUM_STRINGS(tp) STRCOUNT #define EXT_NAMES(tp,i,limit,index,table) table[i] #endif #define NUM_EXT_NAMES(tp) (unsigned) ((tp)->ext_Booleans + (tp)->ext_Numbers + (tp)->ext_Strings) #define for_each_boolean(n,tp) for(n = 0; n < NUM_BOOLEANS(tp); n++) #define for_each_number(n,tp) for(n = 0; n < NUM_NUMBERS(tp); n++) #define for_each_string(n,tp) for(n = 0; n < NUM_STRINGS(tp); n++) #if NCURSES_XNAMES #define for_each_ext_boolean(n,tp) for(n = BOOLCOUNT; n < NUM_BOOLEANS(tp); n++) #define for_each_ext_number(n,tp) for(n = NUMCOUNT; n < NUM_NUMBERS(tp); n++) #define for_each_ext_string(n,tp) for(n = STRCOUNT; n < NUM_STRINGS(tp); n++) #endif #define ExtBoolname(tp,i,names) EXT_NAMES(tp, i, BOOLCOUNT, (i - (tp->num_Booleans - tp->ext_Booleans)), names) #define ExtNumname(tp,i,names) EXT_NAMES(tp, i, NUMCOUNT, (i - (tp->num_Numbers - tp->ext_Numbers)) + tp->ext_Booleans, names) #define ExtStrname(tp,i,names) EXT_NAMES(tp, i, STRCOUNT, (i - (tp->num_Strings - tp->ext_Strings)) + (tp->ext_Numbers + tp->ext_Booleans), names) extern NCURSES_EXPORT_VAR(ENTRY *) _nc_head; extern NCURSES_EXPORT_VAR(ENTRY *) _nc_tail; #define for_entry_list(qp) for (qp = _nc_head; qp; qp = qp->next) #define MAX_LINE 132 #define NULLHOOK (bool(*)(ENTRY *))0 /* * Note that WANTED and PRESENT are not simple inverses! If a capability * has been explicitly cancelled, it's not considered WANTED. */ #define WANTED(s) ((s) == ABSENT_STRING) #define PRESENT(s) (((s) != ABSENT_STRING) && ((s) != CANCELLED_STRING)) #define ANDMISSING(p,q) \ {if (PRESENT(p) && !PRESENT(q)) _nc_warning(#p " but no " #q);} #define PAIRED(p,q) \ { \ if (PRESENT(q) && !PRESENT(p)) \ _nc_warning(#q " but no " #p); \ if (PRESENT(p) && !PRESENT(q)) \ _nc_warning(#p " but no " #q); \ } /* alloc_entry.c: elementary allocation code */ extern NCURSES_EXPORT(ENTRY *) _nc_copy_entry (ENTRY *oldp); extern NCURSES_EXPORT(char *) _nc_save_str (const char *const); extern NCURSES_EXPORT(void) _nc_init_entry (TERMTYPE *const); extern NCURSES_EXPORT(void) _nc_merge_entry (TERMTYPE *const, TERMTYPE *const); extern NCURSES_EXPORT(void) _nc_wrap_entry (ENTRY *const, bool); /* alloc_ttype.c: elementary allocation code */ extern NCURSES_EXPORT(void) _nc_align_termtype (TERMTYPE *, TERMTYPE *); extern NCURSES_EXPORT(void) _nc_copy_termtype (TERMTYPE *, const TERMTYPE *); /* free_ttype.c: elementary allocation code */ extern NCURSES_EXPORT(void) _nc_free_termtype (TERMTYPE *); /* lib_acs.c */ extern NCURSES_EXPORT(void) _nc_init_acs (void); /* corresponds to traditional 'init_acs()' */ /* lib_termcap.c: trim sgr0 string for termcap users */ extern NCURSES_EXPORT(char *) _nc_trim_sgr0 (TERMTYPE *); /* parse_entry.c: entry-parsing code */ #if NCURSES_XNAMES extern NCURSES_EXPORT_VAR(bool) _nc_user_definable; extern NCURSES_EXPORT_VAR(bool) _nc_disable_period; #endif extern NCURSES_EXPORT(int) _nc_parse_entry (ENTRY *, int, bool); extern NCURSES_EXPORT(int) _nc_capcmp (const char *, const char *); /* write_entry.c: writing an entry to the file system */ extern NCURSES_EXPORT(void) _nc_set_writedir (char *); extern NCURSES_EXPORT(void) _nc_write_entry (TERMTYPE *const); /* comp_parse.c: entry list handling */ extern NCURSES_EXPORT(void) _nc_read_entry_source (FILE*, char*, int, bool, bool (*)(ENTRY*)); extern NCURSES_EXPORT(bool) _nc_entry_match (char *, char *); extern NCURSES_EXPORT(int) _nc_resolve_uses (bool); /* obs 20040705 */ extern NCURSES_EXPORT(int) _nc_resolve_uses2 (bool, bool); extern NCURSES_EXPORT(void) _nc_free_entries (ENTRY *); extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype)(TERMTYPE *); /* obs 20040705 */ extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype2)(TERMTYPE *, bool); /* trace_xnames.c */ extern NCURSES_EXPORT(void) _nc_trace_xnames (TERMTYPE *); /* *INDENT-ON* */ #ifdef __cplusplus } #endif #endif /* NCURSES_TERM_ENTRY_H_incl */ �����������������������������������������������������������������������������������������������misc/cxl.h������������������������������������������������������������������������������������������0000644�����������������00000007540�14763166026�0006457 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright 2014 IBM Corp. * * 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. */ #ifndef _MISC_CXL_H #define _MISC_CXL_H #include <linux/types.h> #include <linux/ioctl.h> struct cxl_ioctl_start_work { __u64 flags; __u64 work_element_descriptor; __u64 amr; __s16 num_interrupts; __u16 tid; __s32 reserved1; __u64 reserved2; __u64 reserved3; __u64 reserved4; __u64 reserved5; }; #define CXL_START_WORK_AMR 0x0000000000000001ULL #define CXL_START_WORK_NUM_IRQS 0x0000000000000002ULL #define CXL_START_WORK_ERR_FF 0x0000000000000004ULL #define CXL_START_WORK_TID 0x0000000000000008ULL #define CXL_START_WORK_ALL (CXL_START_WORK_AMR |\ CXL_START_WORK_NUM_IRQS |\ CXL_START_WORK_ERR_FF |\ CXL_START_WORK_TID) /* Possible modes that an afu can be in */ #define CXL_MODE_DEDICATED 0x1 #define CXL_MODE_DIRECTED 0x2 /* possible flags for the cxl_afu_id flags field */ #define CXL_AFUID_FLAG_SLAVE 0x1 /* In directed-mode afu is in slave mode */ struct cxl_afu_id { __u64 flags; /* One of CXL_AFUID_FLAG_X */ __u32 card_id; __u32 afu_offset; __u32 afu_mode; /* one of the CXL_MODE_X */ __u32 reserved1; __u64 reserved2; __u64 reserved3; __u64 reserved4; __u64 reserved5; __u64 reserved6; }; /* base adapter image header is included in the image */ #define CXL_AI_NEED_HEADER 0x0000000000000001ULL #define CXL_AI_ALL CXL_AI_NEED_HEADER #define CXL_AI_HEADER_SIZE 128 #define CXL_AI_BUFFER_SIZE 4096 #define CXL_AI_MAX_ENTRIES 256 #define CXL_AI_MAX_CHUNK_SIZE (CXL_AI_BUFFER_SIZE * CXL_AI_MAX_ENTRIES) struct cxl_adapter_image { __u64 flags; __u64 data; __u64 len_data; __u64 len_image; __u64 reserved1; __u64 reserved2; __u64 reserved3; __u64 reserved4; }; /* ioctl numbers */ #define CXL_MAGIC 0xCA /* AFU devices */ #define CXL_IOCTL_START_WORK _IOW(CXL_MAGIC, 0x00, struct cxl_ioctl_start_work) #define CXL_IOCTL_GET_PROCESS_ELEMENT _IOR(CXL_MAGIC, 0x01, __u32) #define CXL_IOCTL_GET_AFU_ID _IOR(CXL_MAGIC, 0x02, struct cxl_afu_id) /* adapter devices */ #define CXL_IOCTL_DOWNLOAD_IMAGE _IOW(CXL_MAGIC, 0x0A, struct cxl_adapter_image) #define CXL_IOCTL_VALIDATE_IMAGE _IOW(CXL_MAGIC, 0x0B, struct cxl_adapter_image) #define CXL_READ_MIN_SIZE 0x1000 /* 4K */ /* Events from read() */ enum cxl_event_type { CXL_EVENT_RESERVED = 0, CXL_EVENT_AFU_INTERRUPT = 1, CXL_EVENT_DATA_STORAGE = 2, CXL_EVENT_AFU_ERROR = 3, CXL_EVENT_AFU_DRIVER = 4, }; struct cxl_event_header { __u16 type; __u16 size; __u16 process_element; __u16 reserved1; }; struct cxl_event_afu_interrupt { __u16 flags; __u16 irq; /* Raised AFU interrupt number */ __u32 reserved1; }; struct cxl_event_data_storage { __u16 flags; __u16 reserved1; __u32 reserved2; __u64 addr; __u64 dsisr; __u64 reserved3; }; struct cxl_event_afu_error { __u16 flags; __u16 reserved1; __u32 reserved2; __u64 error; }; struct cxl_event_afu_driver_reserved { /* * Defines the buffer passed to the cxl driver by the AFU driver. * * This is not ABI since the event header.size passed to the user for * existing events is set in the read call to sizeof(cxl_event_header) * + sizeof(whatever event is being dispatched) and the user is already * required to use a 4K buffer on the read call. * * Of course the contents will be ABI, but that's up the AFU driver. */ __u32 data_size; __u8 data[]; }; struct cxl_event { struct cxl_event_header header; union { struct cxl_event_afu_interrupt irq; struct cxl_event_data_storage fault; struct cxl_event_afu_error afu_error; struct cxl_event_afu_driver_reserved afu_driver_event; }; }; #endif /* _MISC_CXL_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������misc/ocxl.h�����������������������������������������������������������������������������������������0000644�����������������00000003606�14763166026�0006635 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* Copyright 2017 IBM Corp. */ #ifndef _MISC_OCXL_H #define _MISC_OCXL_H #include <linux/types.h> #include <linux/ioctl.h> enum ocxl_event_type { OCXL_AFU_EVENT_XSL_FAULT_ERROR = 0, }; #define OCXL_KERNEL_EVENT_FLAG_LAST 0x0001 /* This is the last event pending */ struct ocxl_kernel_event_header { __u16 type; __u16 flags; __u32 reserved; }; struct ocxl_kernel_event_xsl_fault_error { __u64 addr; __u64 dsisr; __u64 count; __u64 reserved; }; struct ocxl_ioctl_attach { __u64 amr; __u64 reserved1; __u64 reserved2; __u64 reserved3; }; struct ocxl_ioctl_metadata { __u16 version; // struct version, always backwards compatible // Version 0 fields __u8 afu_version_major; __u8 afu_version_minor; __u32 pasid; // PASID assigned to the current context __u64 pp_mmio_size; // Per PASID MMIO size __u64 global_mmio_size; // End version 0 fields __u64 reserved[13]; // Total of 16*u64 }; struct ocxl_ioctl_p9_wait { __u16 thread_id; // The thread ID required to wake this thread __u16 reserved1; __u32 reserved2; __u64 reserved3[3]; }; #define OCXL_IOCTL_FEATURES_FLAGS0_P9_WAIT 0x01 struct ocxl_ioctl_features { __u64 flags[4]; }; struct ocxl_ioctl_irq_fd { __u64 irq_offset; __s32 eventfd; __u32 reserved; }; /* ioctl numbers */ #define OCXL_MAGIC 0xCA /* AFU devices */ #define OCXL_IOCTL_ATTACH _IOW(OCXL_MAGIC, 0x10, struct ocxl_ioctl_attach) #define OCXL_IOCTL_IRQ_ALLOC _IOR(OCXL_MAGIC, 0x11, __u64) #define OCXL_IOCTL_IRQ_FREE _IOW(OCXL_MAGIC, 0x12, __u64) #define OCXL_IOCTL_IRQ_SET_FD _IOW(OCXL_MAGIC, 0x13, struct ocxl_ioctl_irq_fd) #define OCXL_IOCTL_GET_METADATA _IOR(OCXL_MAGIC, 0x14, struct ocxl_ioctl_metadata) #define OCXL_IOCTL_ENABLE_P9_WAIT _IOR(OCXL_MAGIC, 0x15, struct ocxl_ioctl_p9_wait) #define OCXL_IOCTL_GET_FEATURES _IOR(OCXL_MAGIC, 0x16, struct ocxl_ioctl_features) #endif /* _MISC_OCXL_H */ ��������������������������������������������������������������������������������������������������������������������������netrose/rose.h��������������������������������������������������������������������������������������0000644�����������������00000006075�14763166026�0007367 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Definitions for Rose packet radio address family. Copyright (C) 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* What follows is copied from the 2.1.93 <linux/rose.h>. */ #ifndef _NETROSE_ROSE_H #define _NETROSE_ROSE_H 1 /* Socket level values. */ #define SOL_ROSE 260 /* These are the public elements of the Linux kernel Rose implementation. For kernel AX.25 see the file ax25.h. This file requires ax25.h for the definition of the ax25_address structure. */ #define ROSE_MTU 251 #define ROSE_MAX_DIGIS 6 #define ROSE_DEFER 1 #define ROSE_T1 2 #define ROSE_T2 3 #define ROSE_T3 4 #define ROSE_IDLE 5 #define ROSE_QBITINCL 6 #define ROSE_HOLDBACK 7 #define SIOCRSGCAUSE (SIOCPROTOPRIVATE + 0) #define SIOCRSSCAUSE (SIOCPROTOPRIVATE + 1) #define SIOCRSL2CALL (SIOCPROTOPRIVATE + 2) #define SIOCRSSL2CALL (SIOCPROTOPRIVATE + 2) #define SIOCRSACCEPT (SIOCPROTOPRIVATE + 3) #define SIOCRSCLRRT (SIOCPROTOPRIVATE + 4) #define SIOCRSGL2CALL (SIOCPROTOPRIVATE + 5) #define SIOCRSGFACILITIES (SIOCPROTOPRIVATE + 6) #define ROSE_DTE_ORIGINATED 0x00 #define ROSE_NUMBER_BUSY 0x01 #define ROSE_INVALID_FACILITY 0x03 #define ROSE_NETWORK_CONGESTION 0x05 #define ROSE_OUT_OF_ORDER 0x09 #define ROSE_ACCESS_BARRED 0x0B #define ROSE_NOT_OBTAINABLE 0x0D #define ROSE_REMOTE_PROCEDURE 0x11 #define ROSE_LOCAL_PROCEDURE 0x13 #define ROSE_SHIP_ABSENT 0x39 typedef struct { char rose_addr[5]; } rose_address; struct sockaddr_rose { sa_family_t srose_family; rose_address srose_addr; ax25_address srose_call; int srose_ndigis; ax25_address srose_digi; }; struct full_sockaddr_rose { sa_family_t srose_family; rose_address srose_addr; ax25_address srose_call; unsigned int srose_ndigis; ax25_address srose_digis[ROSE_MAX_DIGIS]; }; struct rose_route_struct { rose_address address; unsigned short int mask; ax25_address neighbour; char device[16]; unsigned char ndigis; ax25_address digipeaters[AX25_MAX_DIGIS]; }; struct rose_cause_struct { unsigned char cause; unsigned char diagnostic; }; struct rose_facilities_struct { rose_address source_addr, dest_addr; ax25_address source_call, dest_call; unsigned char source_ndigis, dest_ndigis; ax25_address source_digis[ROSE_MAX_DIGIS]; ax25_address dest_digis[ROSE_MAX_DIGIS]; unsigned int rand; rose_address fail_addr; ax25_address fail_call; }; #endif /* netrose/rose.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sql3types.h�����������������������������������������������������������������������������������������0000644�����������������00000001502�14763166026�0006675 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _ECPG_SQL3TYPES_H #define _ECPG_SQL3TYPES_H /* SQL3 dynamic type codes */ /* chapter 13.1 table 2: Codes used for SQL data types in Dynamic SQL */ enum { SQL3_CHARACTER = 1, SQL3_NUMERIC, SQL3_DECIMAL, SQL3_INTEGER, SQL3_SMALLINT, SQL3_FLOAT, SQL3_REAL, SQL3_DOUBLE_PRECISION, SQL3_DATE_TIME_TIMESTAMP, SQL3_INTERVAL, /* 10 */ SQL3_CHARACTER_VARYING = 12, SQL3_ENUMERATED, SQL3_BIT, SQL3_BIT_VARYING, SQL3_BOOLEAN, SQL3_abstract /* the rest is xLOB stuff */ }; /* chapter 13.1 table 3: Codes associated with datetime data types in Dynamic SQL */ enum { SQL3_DDT_DATE = 1, SQL3_DDT_TIME, SQL3_DDT_TIMESTAMP, SQL3_DDT_TIME_WITH_TIME_ZONE, SQL3_DDT_TIMESTAMP_WITH_TIME_ZONE, SQL3_DDT_ILLEGAL /* not a datetime data type (not part of * standard) */ }; #endif /* !_ECPG_SQL3TYPES_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������db4.7.25/db.h���������������������������������������������������������������������������������������0000644�����������������00000302145�14763166026�0006365 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * See the file LICENSE for redistribution information. * * Copyright (c) 1996,2008 Oracle. All rights reserved. * * $Id: db.in,v 12.193 2008/05/07 12:33:12 bschmeck Exp $ * * db.h include file layout: * General. * Database Environment. * Locking subsystem. * Logging subsystem. * Shared buffer cache (mpool) subsystem. * Transaction subsystem. * Access methods. * Access method cursors. * Dbm/Ndbm, Hsearch historic interfaces. */ #ifndef _DB_H_ #define _DB_H_ #ifndef __NO_SYSTEM_INCLUDES #include <sys/types.h> #include <inttypes.h> #include <stdint.h> #include <stddef.h> #include <stdio.h> #include <unistd.h> #include <pthread.h> #endif #if defined(__cplusplus) extern "C" { #endif #undef __P #define __P(protos) protos /* * Berkeley DB version information. */ #define DB_VERSION_MAJOR 4 #define DB_VERSION_MINOR 7 #define DB_VERSION_PATCH 25 #define DB_VERSION_STRING "Berkeley DB 4.7.25: (September 11, 2014)" /* * !!! * Berkeley DB uses specifically sized types. If they're not provided by * the system, typedef them here. * * We protect them against multiple inclusion using __BIT_TYPES_DEFINED__, * as does BIND and Kerberos, since we don't know for sure what #include * files the user is using. * * !!! * We also provide the standard u_int, u_long etc., if they're not provided * by the system. */ #ifndef __BIT_TYPES_DEFINED__ #define __BIT_TYPES_DEFINED__ #endif /* * Missing ANSI types. * * uintmax_t -- * Largest unsigned type, used to align structures in memory. We don't store * floating point types in structures, so integral types should be sufficient * (and we don't have to worry about systems that store floats in other than * power-of-2 numbers of bytes). Additionally this fixes compilers that rewrite * structure assignments and ANSI C memcpy calls to be in-line instructions * that happen to require alignment. * * uintptr_t -- * Unsigned type that's the same size as a pointer. There are places where * DB modifies pointers by discarding the bottom bits to guarantee alignment. * We can't use uintmax_t, it may be larger than the pointer, and compilers * get upset about that. So far we haven't run on any machine where there's * no unsigned type the same size as a pointer -- here's hoping. */ /* * Sequences are only available on machines with 64-bit integral types. */ typedef int64_t db_seq_t; /* Thread and process identification. */ typedef pthread_t db_threadid_t; /* Basic types that are exported or quasi-exported. */ typedef u_int32_t db_pgno_t; /* Page number type. */ typedef u_int16_t db_indx_t; /* Page offset type. */ #define DB_MAX_PAGES 0xffffffff /* >= # of pages in a file */ typedef u_int32_t db_recno_t; /* Record number type. */ #define DB_MAX_RECORDS 0xffffffff /* >= # of records in a tree */ typedef u_int32_t db_timeout_t; /* Type of a timeout. */ /* * Region offsets are the difference between a pointer in a region and the * region's base address. With private environments, both addresses are the * result of calling malloc, and we can't assume anything about what malloc * will return, so region offsets have to be able to hold differences between * arbitrary pointers. */ typedef uintptr_t roff_t; /* * Forward structure declarations, so we can declare pointers and * applications can get type checking. */ struct __db; typedef struct __db DB; struct __db_bt_stat; typedef struct __db_bt_stat DB_BTREE_STAT; struct __db_cipher; typedef struct __db_cipher DB_CIPHER; struct __db_compact; typedef struct __db_compact DB_COMPACT; struct __db_dbt; typedef struct __db_dbt DBT; struct __db_distab; typedef struct __db_distab DB_DISTAB; struct __db_env; typedef struct __db_env DB_ENV; struct __db_h_stat; typedef struct __db_h_stat DB_HASH_STAT; struct __db_ilock; typedef struct __db_ilock DB_LOCK_ILOCK; struct __db_lock_hstat; typedef struct __db_lock_hstat DB_LOCK_HSTAT; struct __db_lock_pstat; typedef struct __db_lock_pstat DB_LOCK_PSTAT; struct __db_lock_stat; typedef struct __db_lock_stat DB_LOCK_STAT; struct __db_lock_u; typedef struct __db_lock_u DB_LOCK; struct __db_locker; typedef struct __db_locker DB_LOCKER; struct __db_lockreq; typedef struct __db_lockreq DB_LOCKREQ; struct __db_locktab; typedef struct __db_locktab DB_LOCKTAB; struct __db_log; typedef struct __db_log DB_LOG; struct __db_log_cursor; typedef struct __db_log_cursor DB_LOGC; struct __db_log_stat; typedef struct __db_log_stat DB_LOG_STAT; struct __db_lsn; typedef struct __db_lsn DB_LSN; struct __db_mpool; typedef struct __db_mpool DB_MPOOL; struct __db_mpool_fstat;typedef struct __db_mpool_fstat DB_MPOOL_FSTAT; struct __db_mpool_stat; typedef struct __db_mpool_stat DB_MPOOL_STAT; struct __db_mpoolfile; typedef struct __db_mpoolfile DB_MPOOLFILE; struct __db_mutex_stat; typedef struct __db_mutex_stat DB_MUTEX_STAT; struct __db_mutex_t; typedef struct __db_mutex_t DB_MUTEX; struct __db_mutexmgr; typedef struct __db_mutexmgr DB_MUTEXMGR; struct __db_preplist; typedef struct __db_preplist DB_PREPLIST; struct __db_qam_stat; typedef struct __db_qam_stat DB_QUEUE_STAT; struct __db_rep; typedef struct __db_rep DB_REP; struct __db_rep_stat; typedef struct __db_rep_stat DB_REP_STAT; struct __db_repmgr_site;typedef struct __db_repmgr_site DB_REPMGR_SITE; struct __db_repmgr_stat;typedef struct __db_repmgr_stat DB_REPMGR_STAT; struct __db_seq_record; typedef struct __db_seq_record DB_SEQ_RECORD; struct __db_seq_stat; typedef struct __db_seq_stat DB_SEQUENCE_STAT; struct __db_sequence; typedef struct __db_sequence DB_SEQUENCE; struct __db_thread_info;typedef struct __db_thread_info DB_THREAD_INFO; struct __db_txn; typedef struct __db_txn DB_TXN; struct __db_txn_active; typedef struct __db_txn_active DB_TXN_ACTIVE; struct __db_txn_stat; typedef struct __db_txn_stat DB_TXN_STAT; struct __db_txnmgr; typedef struct __db_txnmgr DB_TXNMGR; struct __dbc; typedef struct __dbc DBC; struct __dbc_internal; typedef struct __dbc_internal DBC_INTERNAL; struct __env; typedef struct __env ENV; struct __fh_t; typedef struct __fh_t DB_FH; struct __fname; typedef struct __fname FNAME; struct __key_range; typedef struct __key_range DB_KEY_RANGE; struct __mpoolfile; typedef struct __mpoolfile MPOOLFILE; /* * The Berkeley DB API flags are automatically-generated -- the following flag names are * no longer used, but remain for compatibility reasons. */ #define DB_DEGREE_2 DB_READ_COMMITTED #define DB_DIRTY_READ DB_READ_UNCOMMITTED #define DB_JOINENV 0x0 /* Key/data structure -- a Data-Base Thang. */ struct __db_dbt { void *data; /* Key/data */ u_int32_t size; /* key/data length */ u_int32_t ulen; /* RO: length of user buffer. */ u_int32_t dlen; /* RO: get/put record length. */ u_int32_t doff; /* RO: get/put record offset. */ void *app_data; #define DB_DBT_APPMALLOC 0x001 /* Callback allocated memory. */ #define DB_DBT_DUPOK 0x002 /* Insert if duplicate. */ #define DB_DBT_ISSET 0x004 /* Lower level calls set value. */ #define DB_DBT_MALLOC 0x008 /* Return in malloc'd memory. */ #define DB_DBT_MULTIPLE 0x010 /* References multiple records. */ #define DB_DBT_PARTIAL 0x020 /* Partial put/get. */ #define DB_DBT_REALLOC 0x040 /* Return in realloc'd memory. */ #define DB_DBT_USERCOPY 0x080 /* Use the user-supplied callback. */ #define DB_DBT_USERMEM 0x100 /* Return in user's memory. */ u_int32_t flags; }; /******************************************************* * Mutexes. *******************************************************/ typedef u_int32_t db_mutex_t; struct __db_mutex_stat { /* The following fields are maintained in the region's copy. */ u_int32_t st_mutex_align; /* Mutex alignment */ u_int32_t st_mutex_tas_spins; /* Mutex test-and-set spins */ u_int32_t st_mutex_cnt; /* Mutex count */ u_int32_t st_mutex_free; /* Available mutexes */ u_int32_t st_mutex_inuse; /* Mutexes in use */ u_int32_t st_mutex_inuse_max; /* Maximum mutexes ever in use */ /* The following fields are filled-in from other places. */ #ifndef __TEST_DB_NO_STATISTICS u_int32_t st_region_wait; /* Region lock granted after wait. */ u_int32_t st_region_nowait; /* Region lock granted without wait. */ roff_t st_regsize; /* Region size. */ #endif }; /* This is the length of the buffer passed to DB_ENV->thread_id_string() */ #define DB_THREADID_STRLEN 128 /******************************************************* * Locking. *******************************************************/ #define DB_LOCKVERSION 1 #define DB_FILE_ID_LEN 20 /* Unique file ID length. */ /* * Deadlock detector modes; used in the DB_ENV structure to configure the * locking subsystem. */ #define DB_LOCK_NORUN 0 #define DB_LOCK_DEFAULT 1 /* Default policy. */ #define DB_LOCK_EXPIRE 2 /* Only expire locks, no detection. */ #define DB_LOCK_MAXLOCKS 3 /* Select locker with max locks. */ #define DB_LOCK_MAXWRITE 4 /* Select locker with max writelocks. */ #define DB_LOCK_MINLOCKS 5 /* Select locker with min locks. */ #define DB_LOCK_MINWRITE 6 /* Select locker with min writelocks. */ #define DB_LOCK_OLDEST 7 /* Select oldest locker. */ #define DB_LOCK_RANDOM 8 /* Select random locker. */ #define DB_LOCK_YOUNGEST 9 /* Select youngest locker. */ /* * Simple R/W lock modes and for multi-granularity intention locking. * * !!! * These values are NOT random, as they are used as an index into the lock * conflicts arrays, i.e., DB_LOCK_IWRITE must be == 3, and DB_LOCK_IREAD * must be == 4. */ typedef enum { DB_LOCK_NG=0, /* Not granted. */ DB_LOCK_READ=1, /* Shared/read. */ DB_LOCK_WRITE=2, /* Exclusive/write. */ DB_LOCK_WAIT=3, /* Wait for event */ DB_LOCK_IWRITE=4, /* Intent exclusive/write. */ DB_LOCK_IREAD=5, /* Intent to share/read. */ DB_LOCK_IWR=6, /* Intent to read and write. */ DB_LOCK_READ_UNCOMMITTED=7, /* Degree 1 isolation. */ DB_LOCK_WWRITE=8 /* Was Written. */ } db_lockmode_t; /* * Request types. */ typedef enum { DB_LOCK_DUMP=0, /* Display held locks. */ DB_LOCK_GET=1, /* Get the lock. */ DB_LOCK_GET_TIMEOUT=2, /* Get lock with a timeout. */ DB_LOCK_INHERIT=3, /* Pass locks to parent. */ DB_LOCK_PUT=4, /* Release the lock. */ DB_LOCK_PUT_ALL=5, /* Release locker's locks. */ DB_LOCK_PUT_OBJ=6, /* Release locker's locks on obj. */ DB_LOCK_PUT_READ=7, /* Release locker's read locks. */ DB_LOCK_TIMEOUT=8, /* Force a txn to timeout. */ DB_LOCK_TRADE=9, /* Trade locker ids on a lock. */ DB_LOCK_UPGRADE_WRITE=10 /* Upgrade writes for dirty reads. */ } db_lockop_t; /* * Status of a lock. */ typedef enum { DB_LSTAT_ABORTED=1, /* Lock belongs to an aborted txn. */ DB_LSTAT_EXPIRED=2, /* Lock has expired. */ DB_LSTAT_FREE=3, /* Lock is unallocated. */ DB_LSTAT_HELD=4, /* Lock is currently held. */ DB_LSTAT_PENDING=5, /* Lock was waiting and has been * promoted; waiting for the owner * to run and upgrade it to held. */ DB_LSTAT_WAITING=6 /* Lock is on the wait queue. */ }db_status_t; /* Lock statistics structure. */ struct __db_lock_stat { u_int32_t st_id; /* Last allocated locker ID. */ u_int32_t st_cur_maxid; /* Current maximum unused ID. */ u_int32_t st_maxlocks; /* Maximum number of locks in table. */ u_int32_t st_maxlockers; /* Maximum num of lockers in table. */ u_int32_t st_maxobjects; /* Maximum num of objects in table. */ u_int32_t st_partitions; /* number of partitions. */ int st_nmodes; /* Number of lock modes. */ u_int32_t st_nlockers; /* Current number of lockers. */ #ifndef __TEST_DB_NO_STATISTICS u_int32_t st_nlocks; /* Current number of locks. */ u_int32_t st_maxnlocks; /* Maximum number of locks so far. */ u_int32_t st_maxhlocks; /* Maximum number of locks in any bucket. */ u_int32_t st_locksteals; /* Number of lock steals so far. */ u_int32_t st_maxlsteals; /* Maximum number steals in any partition. */ u_int32_t st_maxnlockers; /* Maximum number of lockers so far. */ u_int32_t st_nobjects; /* Current number of objects. */ u_int32_t st_maxnobjects; /* Maximum number of objects so far. */ u_int32_t st_maxhobjects; /* Maximum number of objectsin any bucket. */ u_int32_t st_objectsteals; /* Number of objects steals so far. */ u_int32_t st_maxosteals; /* Maximum number of steals in any partition. */ u_int32_t st_nrequests; /* Number of lock gets. */ u_int32_t st_nreleases; /* Number of lock puts. */ u_int32_t st_nupgrade; /* Number of lock upgrades. */ u_int32_t st_ndowngrade; /* Number of lock downgrades. */ u_int32_t st_lock_wait; /* Lock conflicts w/ subsequent wait */ u_int32_t st_lock_nowait; /* Lock conflicts w/o subsequent wait */ u_int32_t st_ndeadlocks; /* Number of lock deadlocks. */ db_timeout_t st_locktimeout; /* Lock timeout. */ u_int32_t st_nlocktimeouts; /* Number of lock timeouts. */ db_timeout_t st_txntimeout; /* Transaction timeout. */ u_int32_t st_ntxntimeouts; /* Number of transaction timeouts. */ u_int32_t st_part_wait; /* Partition lock granted after wait. */ u_int32_t st_part_nowait; /* Partition lock granted without wait. */ u_int32_t st_part_max_wait; /* Max partition lock granted after wait. */ u_int32_t st_part_max_nowait; /* Max partition lock granted without wait. */ u_int32_t st_objs_wait; /* Object lock granted after wait. */ u_int32_t st_objs_nowait; /* Object lock granted without wait. */ u_int32_t st_lockers_wait; /* Locker lock granted after wait. */ u_int32_t st_lockers_nowait; /* Locker lock granted without wait. */ u_int32_t st_region_wait; /* Region lock granted after wait. */ u_int32_t st_region_nowait; /* Region lock granted without wait. */ u_int32_t st_hash_len; /* Max length of bucket. */ roff_t st_regsize; /* Region size. */ #endif }; struct __db_lock_hstat { u_int32_t st_nrequests; /* Number of lock gets. */ u_int32_t st_nreleases; /* Number of lock puts. */ u_int32_t st_nupgrade; /* Number of lock upgrades. */ u_int32_t st_ndowngrade; /* Number of lock downgrades. */ u_int32_t st_nlocks; /* Current number of locks. */ u_int32_t st_maxnlocks; /* Maximum number of locks so far. */ u_int32_t st_nobjects; /* Current number of objects. */ u_int32_t st_maxnobjects; /* Maximum number of objects so far. */ u_int32_t st_lock_wait; /* Lock conflicts w/ subsequent wait */ u_int32_t st_lock_nowait; /* Lock conflicts w/o subsequent wait */ u_int32_t st_nlocktimeouts; /* Number of lock timeouts. */ u_int32_t st_ntxntimeouts; /* Number of transaction timeouts. */ u_int32_t st_hash_len; /* Max length of bucket. */ }; struct __db_lock_pstat { u_int32_t st_nlocks; /* Current number of locks. */ u_int32_t st_maxnlocks; /* Maximum number of locks so far. */ u_int32_t st_nobjects; /* Current number of objects. */ u_int32_t st_maxnobjects; /* Maximum number of objects so far. */ u_int32_t st_locksteals; /* Number of lock steals so far. */ u_int32_t st_objectsteals; /* Number of objects steals so far. */ }; /* * DB_LOCK_ILOCK -- * Internal DB access method lock. */ struct __db_ilock { db_pgno_t pgno; /* Page being locked. */ u_int8_t fileid[DB_FILE_ID_LEN];/* File id. */ #define DB_HANDLE_LOCK 1 #define DB_RECORD_LOCK 2 #define DB_PAGE_LOCK 3 u_int32_t type; /* Type of lock. */ }; /* * DB_LOCK -- * The structure is allocated by the caller and filled in during a * lock_get request (or a lock_vec/DB_LOCK_GET). */ struct __db_lock_u { roff_t off; /* Offset of the lock in the region */ u_int32_t ndx; /* Index of the object referenced by * this lock; used for locking. */ u_int32_t gen; /* Generation number of this lock. */ db_lockmode_t mode; /* mode of this lock. */ }; /* Lock request structure. */ struct __db_lockreq { db_lockop_t op; /* Operation. */ db_lockmode_t mode; /* Requested mode. */ db_timeout_t timeout; /* Time to expire lock. */ DBT *obj; /* Object being locked. */ DB_LOCK lock; /* Lock returned. */ }; /******************************************************* * Logging. *******************************************************/ #define DB_LOGVERSION 14 /* Current log version. */ #define DB_LOGOLDVER 8 /* Oldest log version supported. */ #define DB_LOGMAGIC 0x040988 /* * A DB_LSN has two parts, a fileid which identifies a specific file, and an * offset within that file. The fileid is an unsigned 4-byte quantity that * uniquely identifies a file within the log directory -- currently a simple * counter inside the log. The offset is also an unsigned 4-byte value. The * log manager guarantees the offset is never more than 4 bytes by switching * to a new log file before the maximum length imposed by an unsigned 4-byte * offset is reached. */ struct __db_lsn { u_int32_t file; /* File ID. */ u_int32_t offset; /* File offset. */ }; /* * Application-specified log record types start at DB_user_BEGIN, and must not * equal or exceed DB_debug_FLAG. * * DB_debug_FLAG is the high-bit of the u_int32_t that specifies a log record * type. If the flag is set, it's a log record that was logged for debugging * purposes only, even if it reflects a database change -- the change was part * of a non-durable transaction. */ #define DB_user_BEGIN 10000 #define DB_debug_FLAG 0x80000000 /* * DB_LOGC -- * Log cursor. */ struct __db_log_cursor { ENV *env; /* Environment */ DB_FH *fhp; /* File handle. */ DB_LSN lsn; /* Cursor: LSN */ u_int32_t len; /* Cursor: record length */ u_int32_t prev; /* Cursor: previous record's offset */ DBT dbt; /* Return DBT. */ DB_LSN p_lsn; /* Persist LSN. */ u_int32_t p_version; /* Persist version. */ u_int8_t *bp; /* Allocated read buffer. */ u_int32_t bp_size; /* Read buffer length in bytes. */ u_int32_t bp_rlen; /* Read buffer valid data length. */ DB_LSN bp_lsn; /* Read buffer first byte LSN. */ u_int32_t bp_maxrec; /* Max record length in the log file. */ /* DB_LOGC PUBLIC HANDLE LIST BEGIN */ int (*close) __P((DB_LOGC *, u_int32_t)); int (*get) __P((DB_LOGC *, DB_LSN *, DBT *, u_int32_t)); int (*version) __P((DB_LOGC *, u_int32_t *, u_int32_t)); /* DB_LOGC PUBLIC HANDLE LIST END */ #define DB_LOG_DISK 0x01 /* Log record came from disk. */ #define DB_LOG_LOCKED 0x02 /* Log region already locked */ #define DB_LOG_SILENT_ERR 0x04 /* Turn-off error messages. */ u_int32_t flags; }; /* Log statistics structure. */ struct __db_log_stat { u_int32_t st_magic; /* Log file magic number. */ u_int32_t st_version; /* Log file version number. */ int st_mode; /* Log file permissions mode. */ u_int32_t st_lg_bsize; /* Log buffer size. */ u_int32_t st_lg_size; /* Log file size. */ u_int32_t st_wc_bytes; /* Bytes to log since checkpoint. */ u_int32_t st_wc_mbytes; /* Megabytes to log since checkpoint. */ #ifndef __TEST_DB_NO_STATISTICS u_int32_t st_record; /* Records entered into the log. */ u_int32_t st_w_bytes; /* Bytes to log. */ u_int32_t st_w_mbytes; /* Megabytes to log. */ u_int32_t st_wcount; /* Total I/O writes to the log. */ u_int32_t st_wcount_fill; /* Overflow writes to the log. */ u_int32_t st_rcount; /* Total I/O reads from the log. */ u_int32_t st_scount; /* Total syncs to the log. */ u_int32_t st_region_wait; /* Region lock granted after wait. */ u_int32_t st_region_nowait; /* Region lock granted without wait. */ u_int32_t st_cur_file; /* Current log file number. */ u_int32_t st_cur_offset; /* Current log file offset. */ u_int32_t st_disk_file; /* Known on disk log file number. */ u_int32_t st_disk_offset; /* Known on disk log file offset. */ u_int32_t st_maxcommitperflush; /* Max number of commits in a flush. */ u_int32_t st_mincommitperflush; /* Min number of commits in a flush. */ roff_t st_regsize; /* Region size. */ #endif }; /* * We need to record the first log record of a transaction. For user * defined logging this macro returns the place to put that information, * if it is need in rlsnp, otherwise it leaves it unchanged. We also * need to track the last record of the transaction, this returns the * place to put that info. */ #define DB_SET_TXN_LSNP(txn, blsnp, llsnp) \ ((txn)->set_txn_lsnp(txn, blsnp, llsnp)) /******************************************************* * Shared buffer cache (mpool). *******************************************************/ /* Priority values for DB_MPOOLFILE->{put,set_priority}. */ typedef enum { DB_PRIORITY_UNCHANGED=0, DB_PRIORITY_VERY_LOW=1, DB_PRIORITY_LOW=2, DB_PRIORITY_DEFAULT=3, DB_PRIORITY_HIGH=4, DB_PRIORITY_VERY_HIGH=5 } DB_CACHE_PRIORITY; /* Per-process DB_MPOOLFILE information. */ struct __db_mpoolfile { DB_FH *fhp; /* Underlying file handle. */ /* * !!! * The ref, pinref and q fields are protected by the region lock. */ u_int32_t ref; /* Reference count. */ u_int32_t pinref; /* Pinned block reference count. */ /* * !!! * Explicit representations of structures from queue.h. * TAILQ_ENTRY(__db_mpoolfile) q; */ struct { struct __db_mpoolfile *tqe_next; struct __db_mpoolfile **tqe_prev; } q; /* Linked list of DB_MPOOLFILE's. */ /* * !!! * The rest of the fields (with the exception of the MP_FLUSH flag) * are not thread-protected, even when they may be modified at any * time by the application. The reason is the DB_MPOOLFILE handle * is single-threaded from the viewpoint of the application, and so * the only fields needing to be thread-protected are those accessed * by checkpoint or sync threads when using DB_MPOOLFILE structures * to flush buffers from the cache. */ ENV *env; /* Environment */ MPOOLFILE *mfp; /* Underlying MPOOLFILE. */ u_int32_t clear_len; /* Cleared length on created pages. */ u_int8_t /* Unique file ID. */ fileid[DB_FILE_ID_LEN]; int ftype; /* File type. */ int32_t lsn_offset; /* LSN offset in page. */ u_int32_t gbytes, bytes; /* Maximum file size. */ DBT *pgcookie; /* Byte-string passed to pgin/pgout. */ int32_t priority; /* Cache priority. */ void *addr; /* Address of mmap'd region. */ size_t len; /* Length of mmap'd region. */ u_int32_t config_flags; /* Flags to DB_MPOOLFILE->set_flags. */ /* DB_MPOOLFILE PUBLIC HANDLE LIST BEGIN */ int (*close) __P((DB_MPOOLFILE *, u_int32_t)); int (*get) __P((DB_MPOOLFILE *, db_pgno_t *, DB_TXN *, u_int32_t, void *)); int (*get_clear_len) __P((DB_MPOOLFILE *, u_int32_t *)); int (*get_fileid) __P((DB_MPOOLFILE *, u_int8_t *)); int (*get_flags) __P((DB_MPOOLFILE *, u_int32_t *)); int (*get_ftype) __P((DB_MPOOLFILE *, int *)); int (*get_last_pgno) __P((DB_MPOOLFILE *, db_pgno_t *)); int (*get_lsn_offset) __P((DB_MPOOLFILE *, int32_t *)); int (*get_maxsize) __P((DB_MPOOLFILE *, u_int32_t *, u_int32_t *)); int (*get_pgcookie) __P((DB_MPOOLFILE *, DBT *)); int (*get_priority) __P((DB_MPOOLFILE *, DB_CACHE_PRIORITY *)); int (*open) __P((DB_MPOOLFILE *, const char *, u_int32_t, int, size_t)); int (*put) __P((DB_MPOOLFILE *, void *, DB_CACHE_PRIORITY, u_int32_t)); int (*set_clear_len) __P((DB_MPOOLFILE *, u_int32_t)); int (*set_fileid) __P((DB_MPOOLFILE *, u_int8_t *)); int (*set_flags) __P((DB_MPOOLFILE *, u_int32_t, int)); int (*set_ftype) __P((DB_MPOOLFILE *, int)); int (*set_lsn_offset) __P((DB_MPOOLFILE *, int32_t)); int (*set_maxsize) __P((DB_MPOOLFILE *, u_int32_t, u_int32_t)); int (*set_pgcookie) __P((DB_MPOOLFILE *, DBT *)); int (*set_priority) __P((DB_MPOOLFILE *, DB_CACHE_PRIORITY)); int (*sync) __P((DB_MPOOLFILE *)); /* DB_MPOOLFILE PUBLIC HANDLE LIST END */ /* * MP_FILEID_SET, MP_OPEN_CALLED and MP_READONLY do not need to be * thread protected because they are initialized before the file is * linked onto the per-process lists, and never modified. * * MP_FLUSH is thread protected because it is potentially read/set by * multiple threads of control. */ #define MP_FILEID_SET 0x001 /* Application supplied a file ID. */ #define MP_FLUSH 0x002 /* Was opened to flush a buffer. */ #define MP_MULTIVERSION 0x004 /* Opened for multiversion access. */ #define MP_OPEN_CALLED 0x008 /* File opened. */ #define MP_READONLY 0x010 /* File is readonly. */ #define MP_DUMMY 0x020 /* File is dummy for __memp_fput. */ u_int32_t flags; }; /* Mpool statistics structure. */ struct __db_mpool_stat { u_int32_t st_gbytes; /* Total cache size: GB. */ u_int32_t st_bytes; /* Total cache size: B. */ u_int32_t st_ncache; /* Number of cache regions. */ u_int32_t st_max_ncache; /* Maximum number of regions. */ size_t st_mmapsize; /* Maximum file size for mmap. */ int st_maxopenfd; /* Maximum number of open fd's. */ int st_maxwrite; /* Maximum buffers to write. */ db_timeout_t st_maxwrite_sleep; /* Sleep after writing max buffers. */ u_int32_t st_pages; /* Total number of pages. */ #ifndef __TEST_DB_NO_STATISTICS u_int32_t st_map; /* Pages from mapped files. */ u_int32_t st_cache_hit; /* Pages found in the cache. */ u_int32_t st_cache_miss; /* Pages not found in the cache. */ u_int32_t st_page_create; /* Pages created in the cache. */ u_int32_t st_page_in; /* Pages read in. */ u_int32_t st_page_out; /* Pages written out. */ u_int32_t st_ro_evict; /* Clean pages forced from the cache. */ u_int32_t st_rw_evict; /* Dirty pages forced from the cache. */ u_int32_t st_page_trickle; /* Pages written by memp_trickle. */ u_int32_t st_page_clean; /* Clean pages. */ u_int32_t st_page_dirty; /* Dirty pages. */ u_int32_t st_hash_buckets; /* Number of hash buckets. */ u_int32_t st_hash_searches; /* Total hash chain searches. */ u_int32_t st_hash_longest; /* Longest hash chain searched. */ u_int32_t st_hash_examined; /* Total hash entries searched. */ u_int32_t st_hash_nowait; /* Hash lock granted with nowait. */ u_int32_t st_hash_wait; /* Hash lock granted after wait. */ u_int32_t st_hash_max_nowait; /* Max hash lock granted with nowait. */ u_int32_t st_hash_max_wait; /* Max hash lock granted after wait. */ u_int32_t st_region_nowait; /* Region lock granted with nowait. */ u_int32_t st_region_wait; /* Region lock granted after wait. */ u_int32_t st_mvcc_frozen; /* Buffers frozen. */ u_int32_t st_mvcc_thawed; /* Buffers thawed. */ u_int32_t st_mvcc_freed; /* Frozen buffers freed. */ u_int32_t st_alloc; /* Number of page allocations. */ u_int32_t st_alloc_buckets; /* Buckets checked during allocation. */ u_int32_t st_alloc_max_buckets; /* Max checked during allocation. */ u_int32_t st_alloc_pages; /* Pages checked during allocation. */ u_int32_t st_alloc_max_pages; /* Max checked during allocation. */ u_int32_t st_io_wait; /* Thread waited on buffer I/O. */ roff_t st_regsize; /* Region size. */ #endif }; /* Mpool file statistics structure. */ struct __db_mpool_fstat { char *file_name; /* File name. */ u_int32_t st_pagesize; /* Page size. */ #ifndef __TEST_DB_NO_STATISTICS u_int32_t st_map; /* Pages from mapped files. */ u_int32_t st_cache_hit; /* Pages found in the cache. */ u_int32_t st_cache_miss; /* Pages not found in the cache. */ u_int32_t st_page_create; /* Pages created in the cache. */ u_int32_t st_page_in; /* Pages read in. */ u_int32_t st_page_out; /* Pages written out. */ #endif }; /******************************************************* * Transactions and recovery. *******************************************************/ #define DB_TXNVERSION 1 typedef enum { DB_TXN_ABORT=0, /* Public. */ DB_TXN_APPLY=1, /* Public. */ DB_TXN_BACKWARD_ROLL=3, /* Public. */ DB_TXN_FORWARD_ROLL=4, /* Public. */ DB_TXN_OPENFILES=5, /* Internal. */ DB_TXN_POPENFILES=6, /* Internal. */ DB_TXN_PRINT=7 /* Public. */ } db_recops; /* * BACKWARD_ALLOC is used during the forward pass to pick up any aborted * allocations for files that were created during the forward pass. * The main difference between _ALLOC and _ROLL is that the entry for * the file not exist during the rollforward pass. */ #define DB_UNDO(op) ((op) == DB_TXN_ABORT || (op) == DB_TXN_BACKWARD_ROLL) #define DB_REDO(op) ((op) == DB_TXN_FORWARD_ROLL || (op) == DB_TXN_APPLY) struct __db_txn { DB_TXNMGR *mgrp; /* Pointer to transaction manager. */ DB_TXN *parent; /* Pointer to transaction's parent. */ DB_THREAD_INFO *thread_info; /* Pointer to thread information. */ u_int32_t txnid; /* Unique transaction id. */ char *name; /* Transaction name. */ DB_LOCKER *locker; /* Locker for this txn. */ db_threadid_t tid; /* Thread id for use in MT XA. */ void *td; /* Detail structure within region. */ db_timeout_t lock_timeout; /* Timeout for locks for this txn. */ db_timeout_t expire; /* Time transaction expires. */ void *txn_list; /* Undo information for parent. */ /* * !!! * Explicit representations of structures from queue.h. * TAILQ_ENTRY(__db_txn) links; * TAILQ_ENTRY(__db_txn) xalinks; */ struct { struct __db_txn *tqe_next; struct __db_txn **tqe_prev; } links; /* Links transactions off manager. */ struct { struct __db_txn *tqe_next; struct __db_txn **tqe_prev; } xalinks; /* Links active XA transactions. */ /* * !!! * Explicit representations of structures from queue.h. * TAILQ_HEAD(__kids, __db_txn) kids; */ struct __kids { struct __db_txn *tqh_first; struct __db_txn **tqh_last; } kids; /* * !!! * Explicit representations of structures from queue.h. * TAILQ_HEAD(__events, __txn_event) events; */ struct { struct __txn_event *tqh_first; struct __txn_event **tqh_last; } events; /* Links deferred events. */ /* * !!! * Explicit representations of structures from queue.h. * STAILQ_HEAD(__logrec, __txn_logrec) logs; */ struct { struct __txn_logrec *stqh_first; struct __txn_logrec **stqh_last; } logs; /* Links in memory log records. */ /* * !!! * Explicit representations of structures from queue.h. * TAILQ_ENTRY(__db_txn) klinks; */ struct { struct __db_txn *tqe_next; struct __db_txn **tqe_prev; } klinks; void *api_internal; /* C++ API private. */ void *xml_internal; /* XML API private. */ u_int32_t cursors; /* Number of cursors open for txn */ /* DB_TXN PUBLIC HANDLE LIST BEGIN */ int (*abort) __P((DB_TXN *)); int (*commit) __P((DB_TXN *, u_int32_t)); int (*discard) __P((DB_TXN *, u_int32_t)); int (*get_name) __P((DB_TXN *, const char **)); u_int32_t (*id) __P((DB_TXN *)); int (*prepare) __P((DB_TXN *, u_int8_t *)); int (*set_name) __P((DB_TXN *, const char *)); int (*set_timeout) __P((DB_TXN *, db_timeout_t, u_int32_t)); /* DB_TXN PUBLIC HANDLE LIST END */ /* DB_TXN PRIVATE HANDLE LIST BEGIN */ void (*set_txn_lsnp) __P((DB_TXN *txn, DB_LSN **, DB_LSN **)); /* DB_TXN PRIVATE HANDLE LIST END */ #define TXN_CHILDCOMMIT 0x0001 /* Txn has committed. */ #define TXN_CDSGROUP 0x0002 /* CDS group handle. */ #define TXN_COMPENSATE 0x0004 /* Compensating transaction. */ #define TXN_DEADLOCK 0x0008 /* Txn has deadlocked. */ #define TXN_LOCKTIMEOUT 0x0010 /* Txn has a lock timeout. */ #define TXN_MALLOC 0x0020 /* Structure allocated by TXN system. */ #define TXN_NOSYNC 0x0040 /* Do not sync on prepare and commit. */ #define TXN_NOWAIT 0x0080 /* Do not wait on locks. */ #define TXN_PRIVATE 0x0100 /* Txn owned by cursor.. */ #define TXN_READ_COMMITTED 0x0200 /* Txn has degree 2 isolation. */ #define TXN_READ_UNCOMMITTED 0x0400 /* Txn has degree 1 isolation. */ #define TXN_RESTORED 0x0800 /* Txn has been restored. */ #define TXN_SNAPSHOT 0x1000 /* Snapshot Isolation. */ #define TXN_SYNC 0x2000 /* Write and sync on prepare/commit. */ #define TXN_WRITE_NOSYNC 0x4000 /* Write only on prepare/commit. */ u_int32_t flags; }; #define TXN_SYNC_FLAGS (TXN_SYNC | TXN_NOSYNC | TXN_WRITE_NOSYNC) /* * Structure used for two phase commit interface. Berkeley DB support for two * phase commit is compatible with the X/Open XA interface. * * The XA #define XIDDATASIZE defines the size of a global transaction ID. We * have our own version here (for name space reasons) which must have the same * value. */ #define DB_XIDDATASIZE 128 struct __db_preplist { DB_TXN *txn; u_int8_t gid[DB_XIDDATASIZE]; }; /* Transaction statistics structure. */ struct __db_txn_active { u_int32_t txnid; /* Transaction ID */ u_int32_t parentid; /* Transaction ID of parent */ pid_t pid; /* Process owning txn ID */ db_threadid_t tid; /* Thread owning txn ID */ DB_LSN lsn; /* LSN when transaction began */ DB_LSN read_lsn; /* Read LSN for MVCC */ u_int32_t mvcc_ref; /* MVCC reference count */ #define TXN_ABORTED 1 #define TXN_COMMITTED 2 #define TXN_PREPARED 3 #define TXN_RUNNING 4 u_int32_t status; /* Status of the transaction */ #define TXN_XA_ABORTED 1 #define TXN_XA_DEADLOCKED 2 #define TXN_XA_ENDED 3 #define TXN_XA_PREPARED 4 #define TXN_XA_STARTED 5 #define TXN_XA_SUSPENDED 6 u_int32_t xa_status; /* XA status */ u_int8_t xid[DB_XIDDATASIZE]; /* Global transaction ID */ char name[51]; /* 50 bytes of name, nul termination */ }; struct __db_txn_stat { u_int32_t st_nrestores; /* number of restored transactions after recovery. */ #ifndef __TEST_DB_NO_STATISTICS DB_LSN st_last_ckp; /* lsn of the last checkpoint */ time_t st_time_ckp; /* time of last checkpoint */ u_int32_t st_last_txnid; /* last transaction id given out */ u_int32_t st_maxtxns; /* maximum txns possible */ u_int32_t st_naborts; /* number of aborted transactions */ u_int32_t st_nbegins; /* number of begun transactions */ u_int32_t st_ncommits; /* number of committed transactions */ u_int32_t st_nactive; /* number of active transactions */ u_int32_t st_nsnapshot; /* number of snapshot transactions */ u_int32_t st_maxnactive; /* maximum active transactions */ u_int32_t st_maxnsnapshot; /* maximum snapshot transactions */ DB_TXN_ACTIVE *st_txnarray; /* array of active transactions */ u_int32_t st_region_wait; /* Region lock granted after wait. */ u_int32_t st_region_nowait; /* Region lock granted without wait. */ roff_t st_regsize; /* Region size. */ #endif }; /******************************************************* * Replication. *******************************************************/ /* Special, out-of-band environment IDs. */ #define DB_EID_BROADCAST -1 #define DB_EID_INVALID -2 #define DB_REP_DEFAULT_PRIORITY 100 /* Acknowledgement policies. */ #define DB_REPMGR_ACKS_ALL 1 #define DB_REPMGR_ACKS_ALL_PEERS 2 #define DB_REPMGR_ACKS_NONE 3 #define DB_REPMGR_ACKS_ONE 4 #define DB_REPMGR_ACKS_ONE_PEER 5 #define DB_REPMGR_ACKS_QUORUM 6 /* Replication timeout configuration values. */ #define DB_REP_ACK_TIMEOUT 1 /* RepMgr acknowledgements. */ #define DB_REP_CHECKPOINT_DELAY 2 /* Master checkpoint delay. */ #define DB_REP_CONNECTION_RETRY 3 /* RepMgr connections. */ #define DB_REP_ELECTION_RETRY 4 /* RepMgr elect retries. */ #define DB_REP_ELECTION_TIMEOUT 5 /* Rep normal elections. */ #define DB_REP_FULL_ELECTION_TIMEOUT 6 /* Rep full elections. */ #define DB_REP_HEARTBEAT_MONITOR 7 /* RepMgr client HB monitor. */ #define DB_REP_HEARTBEAT_SEND 8 /* RepMgr master send freq. */ #define DB_REP_LEASE_TIMEOUT 9 /* Master leases. */ /* Event notification types. */ #define DB_EVENT_NO_SUCH_EVENT 0 /* out-of-band sentinel value */ #define DB_EVENT_PANIC 1 #define DB_EVENT_REP_CLIENT 2 #define DB_EVENT_REP_ELECTED 3 #define DB_EVENT_REP_MASTER 4 #define DB_EVENT_REP_NEWMASTER 5 #define DB_EVENT_REP_PERM_FAILED 6 #define DB_EVENT_REP_STARTUPDONE 7 #define DB_EVENT_WRITE_FAILED 8 /* Replication Manager site status. */ struct __db_repmgr_site { int eid; char *host; u_int port; #define DB_REPMGR_CONNECTED 0x01 #define DB_REPMGR_DISCONNECTED 0x02 u_int32_t status; }; /* Replication statistics. */ struct __db_rep_stat { /* !!! * Many replication statistics fields cannot be protected by a mutex * without an unacceptable performance penalty, since most message * processing is done without the need to hold a region-wide lock. * Fields whose comments end with a '+' may be updated without holding * the replication or log mutexes (as appropriate), and thus may be * off somewhat (or, on unreasonable architectures under unlucky * circumstances, garbaged). */ u_int32_t st_log_queued; /* Log records currently queued.+ */ u_int32_t st_startup_complete; /* Site completed client sync-up. */ #ifndef __TEST_DB_NO_STATISTICS u_int32_t st_status; /* Current replication status. */ DB_LSN st_next_lsn; /* Next LSN to use or expect. */ DB_LSN st_waiting_lsn; /* LSN we're awaiting, if any. */ DB_LSN st_max_perm_lsn; /* Maximum permanent LSN. */ db_pgno_t st_next_pg; /* Next pg we expect. */ db_pgno_t st_waiting_pg; /* pg we're awaiting, if any. */ u_int32_t st_dupmasters; /* # of times a duplicate master condition was detected.+ */ int st_env_id; /* Current environment ID. */ u_int32_t st_env_priority; /* Current environment priority. */ u_int32_t st_bulk_fills; /* Bulk buffer fills. */ u_int32_t st_bulk_overflows; /* Bulk buffer overflows. */ u_int32_t st_bulk_records; /* Bulk records stored. */ u_int32_t st_bulk_transfers; /* Transfers of bulk buffers. */ u_int32_t st_client_rerequests; /* Number of forced rerequests. */ u_int32_t st_client_svc_req; /* Number of client service requests received by this client. */ u_int32_t st_client_svc_miss; /* Number of client service requests missing on this client. */ u_int32_t st_gen; /* Current generation number. */ u_int32_t st_egen; /* Current election gen number. */ u_int32_t st_log_duplicated; /* Log records received multiply.+ */ u_int32_t st_log_queued_max; /* Max. log records queued at once.+ */ u_int32_t st_log_queued_total; /* Total # of log recs. ever queued.+ */ u_int32_t st_log_records; /* Log records received and put.+ */ u_int32_t st_log_requested; /* Log recs. missed and requested.+ */ int st_master; /* Env. ID of the current master. */ u_int32_t st_master_changes; /* # of times we've switched masters. */ u_int32_t st_msgs_badgen; /* Messages with a bad generation #.+ */ u_int32_t st_msgs_processed; /* Messages received and processed.+ */ u_int32_t st_msgs_recover; /* Messages ignored because this site was a client in recovery.+ */ u_int32_t st_msgs_send_failures;/* # of failed message sends.+ */ u_int32_t st_msgs_sent; /* # of successful message sends.+ */ u_int32_t st_newsites; /* # of NEWSITE msgs. received.+ */ u_int32_t st_nsites; /* Current number of sites we will assume during elections. */ u_int32_t st_nthrottles; /* # of times we were throttled. */ u_int32_t st_outdated; /* # of times we detected and returned an OUTDATED condition.+ */ u_int32_t st_pg_duplicated; /* Pages received multiply.+ */ u_int32_t st_pg_records; /* Pages received and stored.+ */ u_int32_t st_pg_requested; /* Pages missed and requested.+ */ u_int32_t st_txns_applied; /* # of transactions applied.+ */ u_int32_t st_startsync_delayed; /* # of STARTSYNC msgs delayed.+ */ /* Elections generally. */ u_int32_t st_elections; /* # of elections held.+ */ u_int32_t st_elections_won; /* # of elections won by this site.+ */ /* Statistics about an in-progress election. */ int st_election_cur_winner; /* Current front-runner. */ u_int32_t st_election_gen; /* Election generation number. */ DB_LSN st_election_lsn; /* Max. LSN of current winner. */ u_int32_t st_election_nsites; /* # of "registered voters". */ u_int32_t st_election_nvotes; /* # of "registered voters" needed. */ u_int32_t st_election_priority; /* Current election priority. */ int st_election_status; /* Current election status. */ u_int32_t st_election_tiebreaker;/* Election tiebreaker value. */ u_int32_t st_election_votes; /* Votes received in this round. */ u_int32_t st_election_sec; /* Last election time seconds. */ u_int32_t st_election_usec; /* Last election time useconds. */ u_int32_t st_max_lease_sec; /* Maximum lease timestamp seconds. */ u_int32_t st_max_lease_usec; /* Maximum lease timestamp useconds. */ #endif }; /* Replication Manager statistics. */ struct __db_repmgr_stat { u_int32_t st_perm_failed; /* # of insufficiently ack'ed msgs. */ u_int32_t st_msgs_queued; /* # msgs queued for network delay. */ u_int32_t st_msgs_dropped; /* # msgs discarded due to excessive queue length. */ u_int32_t st_connection_drop; /* Existing connections dropped. */ u_int32_t st_connect_fail; /* Failed new connection attempts. */ }; /******************************************************* * Sequences. *******************************************************/ /* * The storage record for a sequence. */ struct __db_seq_record { u_int32_t seq_version; /* Version size/number. */ u_int32_t flags; /* DB_SEQ_XXX Flags. */ db_seq_t seq_value; /* Current value. */ db_seq_t seq_max; /* Max permitted. */ db_seq_t seq_min; /* Min permitted. */ }; /* * Handle for a sequence object. */ struct __db_sequence { DB *seq_dbp; /* DB handle for this sequence. */ db_mutex_t mtx_seq; /* Mutex if sequence is threaded. */ DB_SEQ_RECORD *seq_rp; /* Pointer to current data. */ DB_SEQ_RECORD seq_record; /* Data from DB_SEQUENCE. */ int32_t seq_cache_size; /* Number of values cached. */ db_seq_t seq_last_value; /* Last value cached. */ DBT seq_key; /* DBT pointing to sequence key. */ DBT seq_data; /* DBT pointing to seq_record. */ /* API-private structure: used by C++ and Java. */ void *api_internal; /* DB_SEQUENCE PUBLIC HANDLE LIST BEGIN */ int (*close) __P((DB_SEQUENCE *, u_int32_t)); int (*get) __P((DB_SEQUENCE *, DB_TXN *, int32_t, db_seq_t *, u_int32_t)); int (*get_cachesize) __P((DB_SEQUENCE *, int32_t *)); int (*get_db) __P((DB_SEQUENCE *, DB **)); int (*get_flags) __P((DB_SEQUENCE *, u_int32_t *)); int (*get_key) __P((DB_SEQUENCE *, DBT *)); int (*get_range) __P((DB_SEQUENCE *, db_seq_t *, db_seq_t *)); int (*initial_value) __P((DB_SEQUENCE *, db_seq_t)); int (*open) __P((DB_SEQUENCE *, DB_TXN *, DBT *, u_int32_t)); int (*remove) __P((DB_SEQUENCE *, DB_TXN *, u_int32_t)); int (*set_cachesize) __P((DB_SEQUENCE *, int32_t)); int (*set_flags) __P((DB_SEQUENCE *, u_int32_t)); int (*set_range) __P((DB_SEQUENCE *, db_seq_t, db_seq_t)); int (*stat) __P((DB_SEQUENCE *, DB_SEQUENCE_STAT **, u_int32_t)); int (*stat_print) __P((DB_SEQUENCE *, u_int32_t)); /* DB_SEQUENCE PUBLIC HANDLE LIST END */ }; struct __db_seq_stat { u_int32_t st_wait; /* Sequence lock granted w/o wait. */ u_int32_t st_nowait; /* Sequence lock granted after wait. */ db_seq_t st_current; /* Current value in db. */ db_seq_t st_value; /* Current cached value. */ db_seq_t st_last_value; /* Last cached value. */ db_seq_t st_min; /* Minimum value. */ db_seq_t st_max; /* Maximum value. */ int32_t st_cache_size; /* Cache size. */ u_int32_t st_flags; /* Flag value. */ }; /******************************************************* * Access methods. *******************************************************/ typedef enum { DB_BTREE=1, DB_HASH=2, DB_RECNO=3, DB_QUEUE=4, DB_UNKNOWN=5 /* Figure it out on open. */ } DBTYPE; #define DB_RENAMEMAGIC 0x030800 /* File has been renamed. */ #define DB_BTREEVERSION 9 /* Current btree version. */ #define DB_BTREEOLDVER 8 /* Oldest btree version supported. */ #define DB_BTREEMAGIC 0x053162 #define DB_HASHVERSION 9 /* Current hash version. */ #define DB_HASHOLDVER 7 /* Oldest hash version supported. */ #define DB_HASHMAGIC 0x061561 #define DB_QAMVERSION 4 /* Current queue version. */ #define DB_QAMOLDVER 3 /* Oldest queue version supported. */ #define DB_QAMMAGIC 0x042253 #define DB_SEQUENCE_VERSION 2 /* Current sequence version. */ #define DB_SEQUENCE_OLDVER 1 /* Oldest sequence version supported. */ /* * DB access method and cursor operation values. Each value is an operation * code to which additional bit flags are added. */ #define DB_AFTER 1 /* Dbc.put */ #define DB_APPEND 2 /* Db.put */ #define DB_BEFORE 3 /* Dbc.put */ #define DB_CONSUME 4 /* Db.get */ #define DB_CONSUME_WAIT 5 /* Db.get */ #define DB_CURRENT 6 /* Dbc.get, Dbc.put, DbLogc.get */ #define DB_FIRST 7 /* Dbc.get, DbLogc->get */ #define DB_GET_BOTH 8 /* Db.get, Dbc.get */ #define DB_GET_BOTHC 9 /* Dbc.get (internal) */ #define DB_GET_BOTH_RANGE 10 /* Db.get, Dbc.get */ #define DB_GET_RECNO 11 /* Dbc.get */ #define DB_JOIN_ITEM 12 /* Dbc.get; don't do primary lookup */ #define DB_KEYFIRST 13 /* Dbc.put */ #define DB_KEYLAST 14 /* Dbc.put */ #define DB_LAST 15 /* Dbc.get, DbLogc->get */ #define DB_NEXT 16 /* Dbc.get, DbLogc->get */ #define DB_NEXT_DUP 17 /* Dbc.get */ #define DB_NEXT_NODUP 18 /* Dbc.get */ #define DB_NODUPDATA 19 /* Db.put, Dbc.put */ #define DB_NOOVERWRITE 20 /* Db.put */ #define DB_NOSYNC 21 /* Db.close */ #define DB_POSITION 22 /* Dbc.dup */ #define DB_PREV 23 /* Dbc.get, DbLogc->get */ #define DB_PREV_DUP 24 /* Dbc.get */ #define DB_PREV_NODUP 25 /* Dbc.get */ #define DB_SET 26 /* Dbc.get, DbLogc->get */ #define DB_SET_RANGE 27 /* Dbc.get */ #define DB_SET_RECNO 28 /* Db.get, Dbc.get */ #define DB_UPDATE_SECONDARY 29 /* Dbc.get, Dbc.del (internal) */ #define DB_WRITECURSOR 30 /* Db.cursor */ #define DB_WRITELOCK 31 /* Db.cursor (internal) */ /* This has to change when the max opcode hits 255. */ #define DB_OPFLAGS_MASK 0x000000ff /* Mask for operations flags. */ /* * DB (user visible) error return codes. * * !!! * We don't want our error returns to conflict with other packages where * possible, so pick a base error value that's hopefully not common. We * document that we own the error name space from -30,800 to -30,999. */ /* DB (public) error return codes. */ #define DB_BUFFER_SMALL (-30999)/* User memory too small for return. */ #define DB_DONOTINDEX (-30998)/* "Null" return from 2ndary callbk. */ #define DB_FOREIGN_CONFLICT (-30997)/* A foreign db constraint triggered. */ #define DB_KEYEMPTY (-30996)/* Key/data deleted or never created. */ #define DB_KEYEXIST (-30995)/* The key/data pair already exists. */ #define DB_LOCK_DEADLOCK (-30994)/* Deadlock. */ #define DB_LOCK_NOTGRANTED (-30993)/* Lock unavailable. */ #define DB_LOG_BUFFER_FULL (-30992)/* In-memory log buffer full. */ #define DB_NOSERVER (-30991)/* Server panic return. */ #define DB_NOSERVER_HOME (-30990)/* Bad home sent to server. */ #define DB_NOSERVER_ID (-30989)/* Bad ID sent to server. */ #define DB_NOTFOUND (-30988)/* Key/data pair not found (EOF). */ #define DB_OLD_VERSION (-30987)/* Out-of-date version. */ #define DB_PAGE_NOTFOUND (-30986)/* Requested page not found. */ #define DB_REP_DUPMASTER (-30985)/* There are two masters. */ #define DB_REP_HANDLE_DEAD (-30984)/* Rolled back a commit. */ #define DB_REP_HOLDELECTION (-30983)/* Time to hold an election. */ #define DB_REP_IGNORE (-30982)/* This msg should be ignored.*/ #define DB_REP_ISPERM (-30981)/* Cached not written perm written.*/ #define DB_REP_JOIN_FAILURE (-30980)/* Unable to join replication group. */ #define DB_REP_LEASE_EXPIRED (-30979)/* Master lease has expired. */ #define DB_REP_LOCKOUT (-30978)/* API/Replication lockout now. */ #define DB_REP_NEWSITE (-30977)/* New site entered system. */ #define DB_REP_NOTPERM (-30976)/* Permanent log record not written. */ #define DB_REP_UNAVAIL (-30975)/* Site cannot currently be reached. */ #define DB_RUNRECOVERY (-30974)/* Panic return. */ #define DB_SECONDARY_BAD (-30973)/* Secondary index corrupt. */ #define DB_VERIFY_BAD (-30972)/* Verify failed; bad format. */ #define DB_VERSION_MISMATCH (-30971)/* Environment version mismatch. */ /* DB (private) error return codes. */ #define DB_ALREADY_ABORTED (-30899) #define DB_DELETED (-30898)/* Recovery file marked deleted. */ #define DB_EVENT_NOT_HANDLED (-30897)/* Forward event to application. */ #define DB_NEEDSPLIT (-30896)/* Page needs to be split. */ #define DB_REP_BULKOVF (-30895)/* Rep bulk buffer overflow. */ #define DB_REP_EGENCHG (-30894)/* Egen changed while in election. */ #define DB_REP_LOGREADY (-30893)/* Rep log ready for recovery. */ #define DB_REP_NEWMASTER (-30892)/* We have learned of a new master. */ #define DB_REP_PAGEDONE (-30891)/* This page was already done. */ #define DB_SURPRISE_KID (-30890)/* Child commit where parent didn't know it was a parent. */ #define DB_SWAPBYTES (-30889)/* Database needs byte swapping. */ #define DB_TIMEOUT (-30888)/* Timed out waiting for election. */ #define DB_TXN_CKP (-30887)/* Encountered ckp record in log. */ #define DB_VERIFY_FATAL (-30886)/* DB->verify cannot proceed. */ /* Database handle. */ struct __db { /******************************************************* * Public: owned by the application. *******************************************************/ u_int32_t pgsize; /* Database logical page size. */ DB_CACHE_PRIORITY priority; /* Database priority in cache. */ /* Callbacks. */ int (*db_append_recno) __P((DB *, DBT *, db_recno_t)); void (*db_feedback) __P((DB *, int, int)); int (*dup_compare) __P((DB *, const DBT *, const DBT *)); void *app_private; /* Application-private handle. */ /******************************************************* * Private: owned by DB. *******************************************************/ DB_ENV *dbenv; /* Backing public environment. */ ENV *env; /* Backing private environment. */ DBTYPE type; /* DB access method type. */ DB_MPOOLFILE *mpf; /* Backing buffer pool. */ db_mutex_t mutex; /* Synchronization for free threading */ char *fname, *dname; /* File/database passed to DB->open. */ u_int32_t open_flags; /* Flags passed to DB->open. */ u_int8_t fileid[DB_FILE_ID_LEN];/* File's unique ID for locking. */ u_int32_t adj_fileid; /* File's unique ID for curs. adj. */ #define DB_LOGFILEID_INVALID -1 FNAME *log_filename; /* File's naming info for logging. */ db_pgno_t meta_pgno; /* Meta page number */ DB_LOCKER *locker; /* Locker for handle locking. */ DB_LOCKER *cur_locker; /* Current handle lock holder. */ DB_TXN *cur_txn; /* Opening transaction. */ DB_LOCKER *associate_locker; /* Locker for DB->associate call. */ DB_LOCK handle_lock; /* Lock held on this handle. */ u_int cl_id; /* RPC: remote client id. */ time_t timestamp; /* Handle timestamp for replication. */ u_int32_t fid_gen; /* Rep generation number for fids. */ /* * Returned data memory for DB->get() and friends. */ DBT my_rskey; /* Secondary key. */ DBT my_rkey; /* [Primary] key. */ DBT my_rdata; /* Data. */ /* * !!! * Some applications use DB but implement their own locking outside of * DB. If they're using fcntl(2) locking on the underlying database * file, and we open and close a file descriptor for that file, we will * discard their locks. The DB_FCNTL_LOCKING flag to DB->open is an * undocumented interface to support this usage which leaves any file * descriptors we open until DB->close. This will only work with the * DB->open interface and simple caches, e.g., creating a transaction * thread may open/close file descriptors this flag doesn't protect. * Locking with fcntl(2) on a file that you don't own is a very, very * unsafe thing to do. 'Nuff said. */ DB_FH *saved_open_fhp; /* Saved file handle. */ /* * Linked list of DBP's, linked from the ENV, used to keep track * of all open db handles for cursor adjustment. * * !!! * Explicit representations of structures from queue.h. * TAILQ_ENTRY(__db) dblistlinks; */ struct { struct __db *tqe_next; struct __db **tqe_prev; } dblistlinks; /* * Cursor queues. * * !!! * Explicit representations of structures from queue.h. * TAILQ_HEAD(__cq_fq, __dbc) free_queue; * TAILQ_HEAD(__cq_aq, __dbc) active_queue; * TAILQ_HEAD(__cq_jq, __dbc) join_queue; */ struct __cq_fq { struct __dbc *tqh_first; struct __dbc **tqh_last; } free_queue; struct __cq_aq { struct __dbc *tqh_first; struct __dbc **tqh_last; } active_queue; struct __cq_jq { struct __dbc *tqh_first; struct __dbc **tqh_last; } join_queue; /* * Secondary index support. * * Linked list of secondary indices -- set in the primary. * * !!! * Explicit representations of structures from queue.h. * LIST_HEAD(s_secondaries, __db); */ struct { struct __db *lh_first; } s_secondaries; /* * List entries for secondaries, and reference count of how many * threads are updating this secondary (see Dbc.put). * * !!! * Note that these are synchronized by the primary's mutex, but * filled in in the secondaries. * * !!! * Explicit representations of structures from queue.h. * LIST_ENTRY(__db) s_links; */ struct { struct __db *le_next; struct __db **le_prev; } s_links; u_int32_t s_refcnt; /* Secondary callback and free functions -- set in the secondary. */ int (*s_callback) __P((DB *, const DBT *, const DBT *, DBT *)); /* Reference to primary -- set in the secondary. */ DB *s_primary; #define DB_ASSOC_IMMUTABLE_KEY 0x00000001 /* Secondary key is immutable. */ /* Flags passed to associate -- set in the secondary. */ u_int32_t s_assoc_flags; /* * Foreign key support. * * Linked list of primary dbs -- set in the foreign db * * !!! * Explicit representations of structures from queue.h. * LIST_HEAD(f_primaries, __db); */ struct { struct __db_foreign_info *lh_first; } f_primaries; /* Reference to foreign -- set in the secondary. */ DB *s_foreign; /* API-private structure: used by DB 1.85, C++, Java, Perl and Tcl */ void *api_internal; /* Subsystem-private structure. */ void *bt_internal; /* Btree/Recno access method. */ void *h_internal; /* Hash access method. */ void *q_internal; /* Queue access method. */ void *xa_internal; /* XA. */ /* DB PUBLIC HANDLE LIST BEGIN */ int (*associate) __P((DB *, DB_TXN *, DB *, int (*)(DB *, const DBT *, const DBT *, DBT *), u_int32_t)); int (*associate_foreign) __P((DB *, DB *, int (*)(DB *, const DBT *, DBT *, const DBT *, int *), u_int32_t)); int (*close) __P((DB *, u_int32_t)); int (*compact) __P((DB *, DB_TXN *, DBT *, DBT *, DB_COMPACT *, u_int32_t, DBT *)); int (*cursor) __P((DB *, DB_TXN *, DBC **, u_int32_t)); int (*del) __P((DB *, DB_TXN *, DBT *, u_int32_t)); void (*err) __P((DB *, int, const char *, ...)); void (*errx) __P((DB *, const char *, ...)); int (*exists) __P((DB *, DB_TXN *, DBT *, u_int32_t)); int (*fd) __P((DB *, int *)); int (*get) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); int (*get_bt_minkey) __P((DB *, u_int32_t *)); int (*get_byteswapped) __P((DB *, int *)); int (*get_cachesize) __P((DB *, u_int32_t *, u_int32_t *, int *)); int (*get_dbname) __P((DB *, const char **, const char **)); int (*get_encrypt_flags) __P((DB *, u_int32_t *)); DB_ENV *(*get_env) __P((DB *)); void (*get_errcall) __P((DB *, void (**)(const DB_ENV *, const char *, const char *))); void (*get_errfile) __P((DB *, FILE **)); void (*get_errpfx) __P((DB *, const char **)); int (*get_flags) __P((DB *, u_int32_t *)); int (*get_h_ffactor) __P((DB *, u_int32_t *)); int (*get_h_nelem) __P((DB *, u_int32_t *)); int (*get_lorder) __P((DB *, int *)); DB_MPOOLFILE *(*get_mpf) __P((DB *)); void (*get_msgfile) __P((DB *, FILE **)); int (*get_multiple) __P((DB *)); int (*get_open_flags) __P((DB *, u_int32_t *)); int (*get_pagesize) __P((DB *, u_int32_t *)); int (*get_priority) __P((DB *, DB_CACHE_PRIORITY *)); int (*get_q_extentsize) __P((DB *, u_int32_t *)); int (*get_re_delim) __P((DB *, int *)); int (*get_re_len) __P((DB *, u_int32_t *)); int (*get_re_pad) __P((DB *, int *)); int (*get_re_source) __P((DB *, const char **)); int (*get_transactional) __P((DB *)); int (*get_type) __P((DB *, DBTYPE *)); int (*join) __P((DB *, DBC **, DBC **, u_int32_t)); int (*key_range) __P((DB *, DB_TXN *, DBT *, DB_KEY_RANGE *, u_int32_t)); int (*open) __P((DB *, DB_TXN *, const char *, const char *, DBTYPE, u_int32_t, int)); int (*pget) __P((DB *, DB_TXN *, DBT *, DBT *, DBT *, u_int32_t)); int (*put) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); int (*remove) __P((DB *, const char *, const char *, u_int32_t)); int (*rename) __P((DB *, const char *, const char *, const char *, u_int32_t)); int (*set_alloc) __P((DB *, void *(*)(size_t), void *(*)(void *, size_t), void (*)(void *))); int (*set_append_recno) __P((DB *, int (*)(DB *, DBT *, db_recno_t))); int (*set_bt_compare) __P((DB *, int (*)(DB *, const DBT *, const DBT *))); int (*set_bt_minkey) __P((DB *, u_int32_t)); int (*set_bt_prefix) __P((DB *, size_t (*)(DB *, const DBT *, const DBT *))); int (*set_cachesize) __P((DB *, u_int32_t, u_int32_t, int)); int (*set_dup_compare) __P((DB *, int (*)(DB *, const DBT *, const DBT *))); int (*set_encrypt) __P((DB *, const char *, u_int32_t)); void (*set_errcall) __P((DB *, void (*)(const DB_ENV *, const char *, const char *))); void (*set_errfile) __P((DB *, FILE *)); void (*set_errpfx) __P((DB *, const char *)); int (*set_feedback) __P((DB *, void (*)(DB *, int, int))); int (*set_flags) __P((DB *, u_int32_t)); int (*set_h_compare) __P((DB *, int (*)(DB *, const DBT *, const DBT *))); int (*set_h_ffactor) __P((DB *, u_int32_t)); int (*set_h_hash) __P((DB *, u_int32_t (*)(DB *, const void *, u_int32_t))); int (*set_h_nelem) __P((DB *, u_int32_t)); int (*set_lorder) __P((DB *, int)); void (*set_msgcall) __P((DB *, void (*)(const DB_ENV *, const char *))); void (*set_msgfile) __P((DB *, FILE *)); int (*set_pagesize) __P((DB *, u_int32_t)); int (*set_paniccall) __P((DB *, void (*)(DB_ENV *, int))); int (*set_priority) __P((DB *, DB_CACHE_PRIORITY)); int (*set_q_extentsize) __P((DB *, u_int32_t)); int (*set_re_delim) __P((DB *, int)); int (*set_re_len) __P((DB *, u_int32_t)); int (*set_re_pad) __P((DB *, int)); int (*set_re_source) __P((DB *, const char *)); int (*stat) __P((DB *, DB_TXN *, void *, u_int32_t)); int (*stat_print) __P((DB *, u_int32_t)); int (*sync) __P((DB *, u_int32_t)); int (*truncate) __P((DB *, DB_TXN *, u_int32_t *, u_int32_t)); int (*upgrade) __P((DB *, const char *, u_int32_t)); int (*verify) __P((DB *, const char *, const char *, FILE *, u_int32_t)); /* DB PUBLIC HANDLE LIST END */ /* DB PRIVATE HANDLE LIST BEGIN */ int (*dump) __P((DB *, const char *, int (*)(void *, const void *), void *, int, int)); int (*db_am_remove) __P((DB *, DB_TXN *, const char *, const char *)); int (*db_am_rename) __P((DB *, DB_TXN *, const char *, const char *, const char *)); /* DB PRIVATE HANDLE LIST END */ /* * Never called; these are a place to save function pointers * so that we can undo an associate. */ int (*stored_get) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); int (*stored_close) __P((DB *, u_int32_t)); #define DB_OK_BTREE 0x01 #define DB_OK_HASH 0x02 #define DB_OK_QUEUE 0x04 #define DB_OK_RECNO 0x08 u_int32_t am_ok; /* Legal AM choices. */ /* * This field really ought to be an AM_FLAG, but we have * have run out of bits. If/when we decide to split up * the flags, we can incorporate it. */ int preserve_fid; /* Do not free fileid on close. */ #define DB_AM_CHKSUM 0x00000001 /* Checksumming */ #define DB_AM_COMPENSATE 0x00000002 /* Created by compensating txn */ #define DB_AM_CREATED 0x00000004 /* Database was created upon open */ #define DB_AM_CREATED_MSTR 0x00000008 /* Encompassing file was created */ #define DB_AM_DBM_ERROR 0x00000010 /* Error in DBM/NDBM database */ #define DB_AM_DELIMITER 0x00000020 /* Variable length delimiter set */ #define DB_AM_DISCARD 0x00000040 /* Discard any cached pages */ #define DB_AM_DUP 0x00000080 /* DB_DUP */ #define DB_AM_DUPSORT 0x00000100 /* DB_DUPSORT */ #define DB_AM_ENCRYPT 0x00000200 /* Encryption */ #define DB_AM_FIXEDLEN 0x00000400 /* Fixed-length records */ #define DB_AM_INMEM 0x00000800 /* In-memory; no sync on close */ #define DB_AM_INORDER 0x00001000 /* DB_INORDER */ #define DB_AM_IN_RENAME 0x00002000 /* File is being renamed */ #define DB_AM_NOT_DURABLE 0x00004000 /* Do not log changes */ #define DB_AM_OPEN_CALLED 0x00008000 /* DB->open called */ #define DB_AM_PAD 0x00010000 /* Fixed-length record pad */ #define DB_AM_PGDEF 0x00020000 /* Page size was defaulted */ #define DB_AM_RDONLY 0x00040000 /* Database is readonly */ #define DB_AM_READ_UNCOMMITTED 0x00080000 /* Support degree 1 isolation */ #define DB_AM_RECNUM 0x00100000 /* DB_RECNUM */ #define DB_AM_RECOVER 0x00200000 /* DB opened by recovery routine */ #define DB_AM_RENUMBER 0x00400000 /* DB_RENUMBER */ #define DB_AM_REVSPLITOFF 0x00800000 /* DB_REVSPLITOFF */ #define DB_AM_SECONDARY 0x01000000 /* Database is a secondary index */ #define DB_AM_SNAPSHOT 0x02000000 /* DB_SNAPSHOT */ #define DB_AM_SUBDB 0x04000000 /* Subdatabases supported */ #define DB_AM_SWAP 0x08000000 /* Pages need to be byte-swapped */ #define DB_AM_TXN 0x10000000 /* Opened in a transaction */ #define DB_AM_VERIFYING 0x20000000 /* DB handle is in the verifier */ u_int32_t orig_flags; /* Flags at open, for refresh */ u_int32_t flags; }; /* * Macros for bulk get. These are only intended for the C API. * For C++, use DbMultiple*Iterator. */ #define DB_MULTIPLE_INIT(pointer, dbt) \ (pointer = (u_int8_t *)(dbt)->data + \ (dbt)->ulen - sizeof(u_int32_t)) #define DB_MULTIPLE_NEXT(pointer, dbt, retdata, retdlen) \ do { \ if (*((u_int32_t *)(pointer)) == (u_int32_t)-1) { \ retdata = NULL; \ pointer = NULL; \ break; \ } \ retdata = (u_int8_t *) \ (dbt)->data + *(u_int32_t *)(pointer); \ (pointer) = (u_int32_t *)(pointer) - 1; \ retdlen = *(u_int32_t *)(pointer); \ (pointer) = (u_int32_t *)(pointer) - 1; \ if (retdlen == 0 && \ retdata == (u_int8_t *)(dbt)->data) \ retdata = NULL; \ } while (0) #define DB_MULTIPLE_KEY_NEXT(pointer, dbt, retkey, retklen, retdata, retdlen) \ do { \ if (*((u_int32_t *)(pointer)) == (u_int32_t)-1) { \ retdata = NULL; \ retkey = NULL; \ pointer = NULL; \ break; \ } \ retkey = (u_int8_t *) \ (dbt)->data + *(u_int32_t *)(pointer); \ (pointer) = (u_int32_t *)(pointer) - 1; \ retklen = *(u_int32_t *)(pointer); \ (pointer) = (u_int32_t *)(pointer) - 1; \ retdata = (u_int8_t *) \ (dbt)->data + *(u_int32_t *)(pointer); \ (pointer) = (u_int32_t *)(pointer) - 1; \ retdlen = *(u_int32_t *)(pointer); \ (pointer) = (u_int32_t *)(pointer) - 1; \ } while (0) #define DB_MULTIPLE_RECNO_NEXT(pointer, dbt, recno, retdata, retdlen) \ do { \ if (*((u_int32_t *)(pointer)) == (u_int32_t)0) { \ recno = 0; \ retdata = NULL; \ pointer = NULL; \ break; \ } \ recno = *(u_int32_t *)(pointer); \ (pointer) = (u_int32_t *)(pointer) - 1; \ retdata = (u_int8_t *) \ (dbt)->data + *(u_int32_t *)(pointer); \ (pointer) = (u_int32_t *)(pointer) - 1; \ retdlen = *(u_int32_t *)(pointer); \ (pointer) = (u_int32_t *)(pointer) - 1; \ } while (0) /******************************************************* * Access method cursors. *******************************************************/ struct __dbc { DB *dbp; /* Backing database */ DB_ENV *dbenv; /* Backing environment */ ENV *env; /* Backing environment */ DB_THREAD_INFO *thread_info; /* Thread that owns this cursor. */ DB_TXN *txn; /* Associated transaction. */ DB_CACHE_PRIORITY priority; /* Priority in cache. */ /* * Active/free cursor queues. * * !!! * Explicit representations of structures from queue.h. * TAILQ_ENTRY(__dbc) links; */ struct { DBC *tqe_next; DBC **tqe_prev; } links; /* * The DBT *'s below are used by the cursor routines to return * data to the user when DBT flags indicate that DB should manage * the returned memory. They point at a DBT containing the buffer * and length that will be used, and "belonging" to the handle that * should "own" this memory. This may be a "my_*" field of this * cursor--the default--or it may be the corresponding field of * another cursor, a DB handle, a join cursor, etc. In general, it * will be whatever handle the user originally used for the current * DB interface call. */ DBT *rskey; /* Returned secondary key. */ DBT *rkey; /* Returned [primary] key. */ DBT *rdata; /* Returned data. */ DBT my_rskey; /* Space for returned secondary key. */ DBT my_rkey; /* Space for returned [primary] key. */ DBT my_rdata; /* Space for returned data. */ DB_LOCKER *lref; /* Reference to default locker. */ DB_LOCKER *locker; /* Locker for this operation. */ DBT lock_dbt; /* DBT referencing lock. */ DB_LOCK_ILOCK lock; /* Object to be locked. */ DB_LOCK mylock; /* CDB lock held on this cursor. */ u_int cl_id; /* Remote client id. */ DBTYPE dbtype; /* Cursor type. */ DBC_INTERNAL *internal; /* Access method private. */ /* DBC PUBLIC HANDLE LIST BEGIN */ int (*close) __P((DBC *)); int (*count) __P((DBC *, db_recno_t *, u_int32_t)); int (*del) __P((DBC *, u_int32_t)); int (*dup) __P((DBC *, DBC **, u_int32_t)); int (*get) __P((DBC *, DBT *, DBT *, u_int32_t)); int (*get_priority) __P((DBC *, DB_CACHE_PRIORITY *)); int (*pget) __P((DBC *, DBT *, DBT *, DBT *, u_int32_t)); int (*put) __P((DBC *, DBT *, DBT *, u_int32_t)); int (*set_priority) __P((DBC *, DB_CACHE_PRIORITY)); /* DBC PUBLIC HANDLE LIST END */ /* The following are the method names deprecated in the 4.6 release. */ int (*c_close) __P((DBC *)); int (*c_count) __P((DBC *, db_recno_t *, u_int32_t)); int (*c_del) __P((DBC *, u_int32_t)); int (*c_dup) __P((DBC *, DBC **, u_int32_t)); int (*c_get) __P((DBC *, DBT *, DBT *, u_int32_t)); int (*c_pget) __P((DBC *, DBT *, DBT *, DBT *, u_int32_t)); int (*c_put) __P((DBC *, DBT *, DBT *, u_int32_t)); /* DBC PRIVATE HANDLE LIST BEGIN */ int (*am_bulk) __P((DBC *, DBT *, u_int32_t)); int (*am_close) __P((DBC *, db_pgno_t, int *)); int (*am_del) __P((DBC *)); int (*am_destroy) __P((DBC *)); int (*am_get) __P((DBC *, DBT *, DBT *, u_int32_t, db_pgno_t *)); int (*am_put) __P((DBC *, DBT *, DBT *, u_int32_t, db_pgno_t *)); int (*am_writelock) __P((DBC *)); /* DBC PRIVATE HANDLE LIST END */ /* * DBC_DONTLOCK and DBC_RECOVER are used during recovery and transaction * abort. If a transaction is being aborted or recovered then DBC_RECOVER * will be set and locking and logging will be disabled on this cursor. If * we are performing a compensating transaction (e.g. free page processing) * then DB_DONTLOCK will be set to inhibit locking, but logging will still * be required. DB_DONTLOCK is also used if the whole database is locked. */ #define DBC_ACTIVE 0x0001 /* Cursor in use. */ #define DBC_DONTLOCK 0x0002 /* Don't lock on this cursor. */ #define DBC_DUPLICATE 0x0004 /* Create a duplicate cursor. */ #define DBC_MULTIPLE 0x0008 /* Return Multiple data. */ #define DBC_MULTIPLE_KEY 0x0010 /* Return Multiple keys and data. */ #define DBC_OPD 0x0020 /* Cursor references off-page dups. */ #define DBC_OWN_LID 0x0040 /* Free lock id on destroy. */ #define DBC_READ_COMMITTED 0x0080 /* Cursor has degree 2 isolation. */ #define DBC_READ_UNCOMMITTED 0x0100 /* Cursor has degree 1 isolation. */ #define DBC_RECOVER 0x0200 /* Recovery cursor; don't log/lock. */ #define DBC_RMW 0x0400 /* Acquire write flag in read op. */ #define DBC_TRANSIENT 0x0800 /* Cursor is transient. */ #define DBC_WRITECURSOR 0x1000 /* Cursor may be used to write (CDB). */ #define DBC_WRITER 0x2000 /* Cursor immediately writing (CDB). */ u_int32_t flags; }; /* Key range statistics structure */ struct __key_range { double less; double equal; double greater; }; /* Btree/Recno statistics structure. */ struct __db_bt_stat { u_int32_t bt_magic; /* Magic number. */ u_int32_t bt_version; /* Version number. */ u_int32_t bt_metaflags; /* Metadata flags. */ u_int32_t bt_nkeys; /* Number of unique keys. */ u_int32_t bt_ndata; /* Number of data items. */ u_int32_t bt_pagecnt; /* Page count. */ u_int32_t bt_pagesize; /* Page size. */ u_int32_t bt_minkey; /* Minkey value. */ u_int32_t bt_re_len; /* Fixed-length record length. */ u_int32_t bt_re_pad; /* Fixed-length record pad. */ u_int32_t bt_levels; /* Tree levels. */ u_int32_t bt_int_pg; /* Internal pages. */ u_int32_t bt_leaf_pg; /* Leaf pages. */ u_int32_t bt_dup_pg; /* Duplicate pages. */ u_int32_t bt_over_pg; /* Overflow pages. */ u_int32_t bt_empty_pg; /* Empty pages. */ u_int32_t bt_free; /* Pages on the free list. */ u_int32_t bt_int_pgfree; /* Bytes free in internal pages. */ u_int32_t bt_leaf_pgfree; /* Bytes free in leaf pages. */ u_int32_t bt_dup_pgfree; /* Bytes free in duplicate pages. */ u_int32_t bt_over_pgfree; /* Bytes free in overflow pages. */ }; struct __db_compact { /* Input Parameters. */ u_int32_t compact_fillpercent; /* Desired fillfactor: 1-100 */ db_timeout_t compact_timeout; /* Lock timeout. */ u_int32_t compact_pages; /* Max pages to process. */ /* Output Stats. */ u_int32_t compact_pages_free; /* Number of pages freed. */ u_int32_t compact_pages_examine; /* Number of pages examine. */ u_int32_t compact_levels; /* Number of levels removed. */ u_int32_t compact_deadlock; /* Number of deadlocks. */ db_pgno_t compact_pages_truncated; /* Pages truncated to OS. */ /* Internal. */ db_pgno_t compact_truncate; /* Page number for truncation */ }; /* Hash statistics structure. */ struct __db_h_stat { u_int32_t hash_magic; /* Magic number. */ u_int32_t hash_version; /* Version number. */ u_int32_t hash_metaflags; /* Metadata flags. */ u_int32_t hash_nkeys; /* Number of unique keys. */ u_int32_t hash_ndata; /* Number of data items. */ u_int32_t hash_pagecnt; /* Page count. */ u_int32_t hash_pagesize; /* Page size. */ u_int32_t hash_ffactor; /* Fill factor specified at create. */ u_int32_t hash_buckets; /* Number of hash buckets. */ u_int32_t hash_free; /* Pages on the free list. */ u_int32_t hash_bfree; /* Bytes free on bucket pages. */ u_int32_t hash_bigpages; /* Number of big key/data pages. */ u_int32_t hash_big_bfree; /* Bytes free on big item pages. */ u_int32_t hash_overflows; /* Number of overflow pages. */ u_int32_t hash_ovfl_free; /* Bytes free on ovfl pages. */ u_int32_t hash_dup; /* Number of dup pages. */ u_int32_t hash_dup_free; /* Bytes free on duplicate pages. */ }; /* Queue statistics structure. */ struct __db_qam_stat { u_int32_t qs_magic; /* Magic number. */ u_int32_t qs_version; /* Version number. */ u_int32_t qs_metaflags; /* Metadata flags. */ u_int32_t qs_nkeys; /* Number of unique keys. */ u_int32_t qs_ndata; /* Number of data items. */ u_int32_t qs_pagesize; /* Page size. */ u_int32_t qs_extentsize; /* Pages per extent. */ u_int32_t qs_pages; /* Data pages. */ u_int32_t qs_re_len; /* Fixed-length record length. */ u_int32_t qs_re_pad; /* Fixed-length record pad. */ u_int32_t qs_pgfree; /* Bytes free in data pages. */ u_int32_t qs_first_recno; /* First not deleted record. */ u_int32_t qs_cur_recno; /* Next available record number. */ }; /******************************************************* * Environment. *******************************************************/ #define DB_REGION_MAGIC 0x120897 /* Environment magic number. */ /* * Database environment structure. * * This is the public database environment handle. The private environment * handle is the ENV structure. The user owns this structure, the library * owns the ENV structure. The reason there are two structures is because * the user's configuration outlives any particular DB_ENV->open call, and * separate structures allows us to easily discard internal information without * discarding the user's configuration. * * Fields in the DB_ENV structure should normally be set only by application * DB_ENV handle methods. */ struct __db_env { ENV *env; /* Linked ENV structure */ /* * The DB_ENV structure can be used concurrently, so field access is * protected. */ db_mutex_t mtx_db_env; /* DB_ENV structure mutex */ /* Error message callback */ void (*db_errcall) __P((const DB_ENV *, const char *, const char *)); FILE *db_errfile; /* Error message file stream */ const char *db_errpfx; /* Error message prefix */ /* Other message callback */ void (*db_msgcall) __P((const DB_ENV *, const char *)); FILE *db_msgfile; /* Other message file stream */ /* Other application callback functions */ int (*app_dispatch) __P((DB_ENV *, DBT *, DB_LSN *, db_recops)); void (*db_event_func) __P((DB_ENV *, u_int32_t, void *)); void (*db_feedback) __P((DB_ENV *, int, int)); void (*db_free) __P((void *)); void (*db_paniccall) __P((DB_ENV *, int)); void *(*db_malloc) __P((size_t)); void *(*db_realloc) __P((void *, size_t)); int (*is_alive) __P((DB_ENV *, pid_t, db_threadid_t, u_int32_t)); void (*thread_id) __P((DB_ENV *, pid_t *, db_threadid_t *)); char *(*thread_id_string) __P((DB_ENV *, pid_t, db_threadid_t, char *)); /* Application specified paths */ char *db_log_dir; /* Database log file directory */ char *db_tmp_dir; /* Database tmp file directory */ char **db_data_dir; /* Database data file directories */ int data_cnt; /* Database data file slots */ int data_next; /* Next database data file slot */ char *intermediate_dir_mode; /* Intermediate directory perms */ long shm_key; /* shmget key */ char *passwd; /* Cryptography support */ size_t passwd_len; void *cl_handle; /* RPC: remote client handle */ u_int cl_id; /* RPC: remote client env id */ /* Private handle references */ void *app_private; /* Application-private handle */ void *api1_internal; /* C++, Perl API private */ void *api2_internal; /* Java API private */ u_int32_t verbose; /* DB_VERB_XXX flags */ /* Mutex configuration */ u_int32_t mutex_align; /* Mutex alignment */ u_int32_t mutex_cnt; /* Number of mutexes to configure */ u_int32_t mutex_inc; /* Number of mutexes to add */ u_int32_t mutex_tas_spins;/* Test-and-set spin count */ /* Locking configuration */ u_int8_t *lk_conflicts; /* Two dimensional conflict matrix */ int lk_modes; /* Number of lock modes in table */ u_int32_t lk_detect; /* Deadlock detect on all conflicts */ u_int32_t lk_max; /* Maximum number of locks */ u_int32_t lk_max_lockers;/* Maximum number of lockers */ u_int32_t lk_max_objects;/* Maximum number of locked objects */ u_int32_t lk_partitions ;/* Number of object partitions */ db_timeout_t lk_timeout; /* Lock timeout period */ /* Logging configuration */ u_int32_t lg_bsize; /* Buffer size */ int lg_filemode; /* Log file permission mode */ u_int32_t lg_regionmax; /* Region size */ u_int32_t lg_size; /* Log file size */ u_int32_t lg_flags; /* Log configuration */ /* Memory pool configuration */ u_int32_t mp_gbytes; /* Cache size: GB */ u_int32_t mp_bytes; /* Cache size: bytes */ u_int32_t mp_max_gbytes; /* Maximum cache size: GB */ u_int32_t mp_max_bytes; /* Maximum cache size: bytes */ size_t mp_mmapsize; /* Maximum file size for mmap */ int mp_maxopenfd; /* Maximum open file descriptors */ int mp_maxwrite; /* Maximum buffers to write */ u_int mp_ncache; /* Initial number of cache regions */ /* Sleep after writing max buffers */ db_timeout_t mp_maxwrite_sleep; /* Transaction configuration */ u_int32_t tx_max; /* Maximum number of transactions */ time_t tx_timestamp; /* Recover to specific timestamp */ db_timeout_t tx_timeout; /* Timeout for transactions */ /* Thread tracking configuration */ u_int32_t thr_max; /* Thread count */ /* * The following fields are not strictly user-owned, but they outlive * the ENV structure, and so are stored here. */ DB_FH *registry; /* DB_REGISTER file handle */ u_int32_t registry_off; /* * Offset of our slot. We can't use * off_t because its size depends on * build settings. */ #define DB_ENV_AUTO_COMMIT 0x00000001 /* DB_AUTO_COMMIT */ #define DB_ENV_CDB_ALLDB 0x00000002 /* CDB environment wide locking */ #define DB_ENV_DIRECT_DB 0x00000004 /* DB_DIRECT_DB set */ #define DB_ENV_DSYNC_DB 0x00000008 /* DB_DSYNC_DB set */ #define DB_ENV_MULTIVERSION 0x00000010 /* DB_MULTIVERSION set */ #define DB_ENV_NOLOCKING 0x00000020 /* DB_NOLOCKING set */ #define DB_ENV_NOMMAP 0x00000040 /* DB_NOMMAP set */ #define DB_ENV_NOPANIC 0x00000080 /* Okay if panic set */ #define DB_ENV_OVERWRITE 0x00000100 /* DB_OVERWRITE set */ #define DB_ENV_REGION_INIT 0x00000200 /* DB_REGION_INIT set */ #define DB_ENV_RPCCLIENT 0x00000400 /* DB_RPCCLIENT set */ #define DB_ENV_RPCCLIENT_GIVEN 0x00000800 /* User-supplied RPC client struct */ #define DB_ENV_TIME_NOTGRANTED 0x00001000 /* DB_TIME_NOTGRANTED set */ #define DB_ENV_TXN_NOSYNC 0x00002000 /* DB_TXN_NOSYNC set */ #define DB_ENV_TXN_NOWAIT 0x00004000 /* DB_TXN_NOWAIT set */ #define DB_ENV_TXN_SNAPSHOT 0x00008000 /* DB_TXN_SNAPSHOT set */ #define DB_ENV_TXN_WRITE_NOSYNC 0x00010000 /* DB_TXN_WRITE_NOSYNC set */ #define DB_ENV_YIELDCPU 0x00020000 /* DB_YIELDCPU set */ u_int32_t flags; /* DB_ENV PUBLIC HANDLE LIST BEGIN */ int (*cdsgroup_begin) __P((DB_ENV *, DB_TXN **)); int (*close) __P((DB_ENV *, u_int32_t)); int (*dbremove) __P((DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)); int (*dbrename) __P((DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)); void (*err) __P((const DB_ENV *, int, const char *, ...)); void (*errx) __P((const DB_ENV *, const char *, ...)); int (*failchk) __P((DB_ENV *, u_int32_t)); int (*fileid_reset) __P((DB_ENV *, const char *, u_int32_t)); int (*get_cache_max) __P((DB_ENV *, u_int32_t *, u_int32_t *)); int (*get_cachesize) __P((DB_ENV *, u_int32_t *, u_int32_t *, int *)); int (*get_data_dirs) __P((DB_ENV *, const char ***)); int (*get_encrypt_flags) __P((DB_ENV *, u_int32_t *)); void (*get_errcall) __P((DB_ENV *, void (**)(const DB_ENV *, const char *, const char *))); void (*get_errfile) __P((DB_ENV *, FILE **)); void (*get_errpfx) __P((DB_ENV *, const char **)); int (*get_flags) __P((DB_ENV *, u_int32_t *)); int (*get_home) __P((DB_ENV *, const char **)); int (*get_intermediate_dir_mode) __P((DB_ENV *, const char **)); int (*get_lg_bsize) __P((DB_ENV *, u_int32_t *)); int (*get_lg_dir) __P((DB_ENV *, const char **)); int (*get_lg_filemode) __P((DB_ENV *, int *)); int (*get_lg_max) __P((DB_ENV *, u_int32_t *)); int (*get_lg_regionmax) __P((DB_ENV *, u_int32_t *)); int (*get_lk_conflicts) __P((DB_ENV *, const u_int8_t **, int *)); int (*get_lk_detect) __P((DB_ENV *, u_int32_t *)); int (*get_lk_max_lockers) __P((DB_ENV *, u_int32_t *)); int (*get_lk_max_locks) __P((DB_ENV *, u_int32_t *)); int (*get_lk_max_objects) __P((DB_ENV *, u_int32_t *)); int (*get_lk_partitions) __P((DB_ENV *, u_int32_t *)); int (*get_mp_max_openfd) __P((DB_ENV *, int *)); int (*get_mp_max_write) __P((DB_ENV *, int *, db_timeout_t *)); int (*get_mp_mmapsize) __P((DB_ENV *, size_t *)); void (*get_msgfile) __P((DB_ENV *, FILE **)); int (*get_open_flags) __P((DB_ENV *, u_int32_t *)); int (*get_shm_key) __P((DB_ENV *, long *)); int (*get_thread_count) __P((DB_ENV *, u_int32_t *)); int (*get_timeout) __P((DB_ENV *, db_timeout_t *, u_int32_t)); int (*get_tmp_dir) __P((DB_ENV *, const char **)); int (*get_tx_max) __P((DB_ENV *, u_int32_t *)); int (*get_tx_timestamp) __P((DB_ENV *, time_t *)); int (*get_verbose) __P((DB_ENV *, u_int32_t, int *)); int (*is_bigendian) __P((void)); int (*lock_detect) __P((DB_ENV *, u_int32_t, u_int32_t, int *)); int (*lock_get) __P((DB_ENV *, u_int32_t, u_int32_t, const DBT *, db_lockmode_t, DB_LOCK *)); int (*lock_id) __P((DB_ENV *, u_int32_t *)); int (*lock_id_free) __P((DB_ENV *, u_int32_t)); int (*lock_put) __P((DB_ENV *, DB_LOCK *)); int (*lock_stat) __P((DB_ENV *, DB_LOCK_STAT **, u_int32_t)); int (*lock_stat_print) __P((DB_ENV *, u_int32_t)); int (*lock_vec) __P((DB_ENV *, u_int32_t, u_int32_t, DB_LOCKREQ *, int, DB_LOCKREQ **)); int (*log_archive) __P((DB_ENV *, char **[], u_int32_t)); int (*log_cursor) __P((DB_ENV *, DB_LOGC **, u_int32_t)); int (*log_file) __P((DB_ENV *, const DB_LSN *, char *, size_t)); int (*log_flush) __P((DB_ENV *, const DB_LSN *)); int (*log_get_config) __P((DB_ENV *, u_int32_t, int *)); int (*log_printf) __P((DB_ENV *, DB_TXN *, const char *, ...)); int (*log_put) __P((DB_ENV *, DB_LSN *, const DBT *, u_int32_t)); int (*log_set_config) __P((DB_ENV *, u_int32_t, int)); int (*log_stat) __P((DB_ENV *, DB_LOG_STAT **, u_int32_t)); int (*log_stat_print) __P((DB_ENV *, u_int32_t)); int (*lsn_reset) __P((DB_ENV *, const char *, u_int32_t)); int (*memp_fcreate) __P((DB_ENV *, DB_MPOOLFILE **, u_int32_t)); int (*memp_register) __P((DB_ENV *, int, int (*)(DB_ENV *, db_pgno_t, void *, DBT *), int (*)(DB_ENV *, db_pgno_t, void *, DBT *))); int (*memp_stat) __P((DB_ENV *, DB_MPOOL_STAT **, DB_MPOOL_FSTAT ***, u_int32_t)); int (*memp_stat_print) __P((DB_ENV *, u_int32_t)); int (*memp_sync) __P((DB_ENV *, DB_LSN *)); int (*memp_trickle) __P((DB_ENV *, int, int *)); int (*mutex_alloc) __P((DB_ENV *, u_int32_t, db_mutex_t *)); int (*mutex_free) __P((DB_ENV *, db_mutex_t)); int (*mutex_get_align) __P((DB_ENV *, u_int32_t *)); int (*mutex_get_increment) __P((DB_ENV *, u_int32_t *)); int (*mutex_get_max) __P((DB_ENV *, u_int32_t *)); int (*mutex_get_tas_spins) __P((DB_ENV *, u_int32_t *)); int (*mutex_lock) __P((DB_ENV *, db_mutex_t)); int (*mutex_set_align) __P((DB_ENV *, u_int32_t)); int (*mutex_set_increment) __P((DB_ENV *, u_int32_t)); int (*mutex_set_max) __P((DB_ENV *, u_int32_t)); int (*mutex_set_tas_spins) __P((DB_ENV *, u_int32_t)); int (*mutex_stat) __P((DB_ENV *, DB_MUTEX_STAT **, u_int32_t)); int (*mutex_stat_print) __P((DB_ENV *, u_int32_t)); int (*mutex_unlock) __P((DB_ENV *, db_mutex_t)); int (*open) __P((DB_ENV *, const char *, u_int32_t, int)); int (*remove) __P((DB_ENV *, const char *, u_int32_t)); int (*rep_elect) __P((DB_ENV *, u_int32_t, u_int32_t, u_int32_t)); int (*rep_flush) __P((DB_ENV *)); int (*rep_get_clockskew) __P((DB_ENV *, u_int32_t *, u_int32_t *)); int (*rep_get_config) __P((DB_ENV *, u_int32_t, int *)); int (*rep_get_limit) __P((DB_ENV *, u_int32_t *, u_int32_t *)); int (*rep_get_nsites) __P((DB_ENV *, u_int32_t *)); int (*rep_get_priority) __P((DB_ENV *, u_int32_t *)); int (*rep_get_request) __P((DB_ENV *, u_int32_t *, u_int32_t *)); int (*rep_get_timeout) __P((DB_ENV *, int, u_int32_t *)); int (*rep_process_message) __P((DB_ENV *, DBT *, DBT *, int, DB_LSN *)); int (*rep_set_clockskew) __P((DB_ENV *, u_int32_t, u_int32_t)); int (*rep_set_config) __P((DB_ENV *, u_int32_t, int)); int (*rep_set_limit) __P((DB_ENV *, u_int32_t, u_int32_t)); int (*rep_set_nsites) __P((DB_ENV *, u_int32_t)); int (*rep_set_priority) __P((DB_ENV *, u_int32_t)); int (*rep_set_request) __P((DB_ENV *, u_int32_t, u_int32_t)); int (*rep_set_timeout) __P((DB_ENV *, int, db_timeout_t)); int (*rep_set_transport) __P((DB_ENV *, int, int (*)(DB_ENV *, const DBT *, const DBT *, const DB_LSN *, int, u_int32_t))); int (*rep_start) __P((DB_ENV *, DBT *, u_int32_t)); int (*rep_stat) __P((DB_ENV *, DB_REP_STAT **, u_int32_t)); int (*rep_stat_print) __P((DB_ENV *, u_int32_t)); int (*rep_sync) __P((DB_ENV *, u_int32_t)); int (*repmgr_add_remote_site) __P((DB_ENV *, const char *, u_int, int *, u_int32_t)); int (*repmgr_get_ack_policy) __P((DB_ENV *, int *)); int (*repmgr_set_ack_policy) __P((DB_ENV *, int)); int (*repmgr_set_local_site) __P((DB_ENV *, const char *, u_int, u_int32_t)); int (*repmgr_site_list) __P((DB_ENV *, u_int *, DB_REPMGR_SITE **)); int (*repmgr_start) __P((DB_ENV *, int, u_int32_t)); int (*repmgr_stat) __P((DB_ENV *, DB_REPMGR_STAT **, u_int32_t)); int (*repmgr_stat_print) __P((DB_ENV *, u_int32_t)); int (*set_alloc) __P((DB_ENV *, void *(*)(size_t), void *(*)(void *, size_t), void (*)(void *))); int (*set_app_dispatch) __P((DB_ENV *, int (*)(DB_ENV *, DBT *, DB_LSN *, db_recops))); int (*set_cache_max) __P((DB_ENV *, u_int32_t, u_int32_t)); int (*set_cachesize) __P((DB_ENV *, u_int32_t, u_int32_t, int)); int (*set_data_dir) __P((DB_ENV *, const char *)); int (*set_encrypt) __P((DB_ENV *, const char *, u_int32_t)); void (*set_errcall) __P((DB_ENV *, void (*)(const DB_ENV *, const char *, const char *))); void (*set_errfile) __P((DB_ENV *, FILE *)); void (*set_errpfx) __P((DB_ENV *, const char *)); int (*set_event_notify) __P((DB_ENV *, void (*)(DB_ENV *, u_int32_t, void *))); int (*set_feedback) __P((DB_ENV *, void (*)(DB_ENV *, int, int))); int (*set_flags) __P((DB_ENV *, u_int32_t, int)); int (*set_intermediate_dir_mode) __P((DB_ENV *, const char *)); int (*set_isalive) __P((DB_ENV *, int (*)(DB_ENV *, pid_t, db_threadid_t, u_int32_t))); int (*set_lg_bsize) __P((DB_ENV *, u_int32_t)); int (*set_lg_dir) __P((DB_ENV *, const char *)); int (*set_lg_filemode) __P((DB_ENV *, int)); int (*set_lg_max) __P((DB_ENV *, u_int32_t)); int (*set_lg_regionmax) __P((DB_ENV *, u_int32_t)); int (*set_lk_conflicts) __P((DB_ENV *, u_int8_t *, int)); int (*set_lk_detect) __P((DB_ENV *, u_int32_t)); int (*set_lk_max_lockers) __P((DB_ENV *, u_int32_t)); int (*set_lk_max_locks) __P((DB_ENV *, u_int32_t)); int (*set_lk_max_objects) __P((DB_ENV *, u_int32_t)); int (*set_lk_partitions) __P((DB_ENV *, u_int32_t)); int (*set_mp_max_openfd) __P((DB_ENV *, int)); int (*set_mp_max_write) __P((DB_ENV *, int, db_timeout_t)); int (*set_mp_mmapsize) __P((DB_ENV *, size_t)); void (*set_msgcall) __P((DB_ENV *, void (*)(const DB_ENV *, const char *))); void (*set_msgfile) __P((DB_ENV *, FILE *)); int (*set_paniccall) __P((DB_ENV *, void (*)(DB_ENV *, int))); int (*set_rpc_server) __P((DB_ENV *, void *, const char *, long, long, u_int32_t)); int (*set_shm_key) __P((DB_ENV *, long)); int (*set_thread_count) __P((DB_ENV *, u_int32_t)); int (*set_thread_id) __P((DB_ENV *, void (*)(DB_ENV *, pid_t *, db_threadid_t *))); int (*set_thread_id_string) __P((DB_ENV *, char *(*)(DB_ENV *, pid_t, db_threadid_t, char *))); int (*set_timeout) __P((DB_ENV *, db_timeout_t, u_int32_t)); int (*set_tmp_dir) __P((DB_ENV *, const char *)); int (*set_tx_max) __P((DB_ENV *, u_int32_t)); int (*set_tx_timestamp) __P((DB_ENV *, time_t *)); int (*set_verbose) __P((DB_ENV *, u_int32_t, int)); int (*stat_print) __P((DB_ENV *, u_int32_t)); int (*txn_begin) __P((DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)); int (*txn_checkpoint) __P((DB_ENV *, u_int32_t, u_int32_t, u_int32_t)); int (*txn_recover) __P((DB_ENV *, DB_PREPLIST *, long, long *, u_int32_t)); int (*txn_stat) __P((DB_ENV *, DB_TXN_STAT **, u_int32_t)); int (*txn_stat_print) __P((DB_ENV *, u_int32_t)); /* DB_ENV PUBLIC HANDLE LIST END */ /* DB_ENV PRIVATE HANDLE LIST BEGIN */ int (*prdbt) __P((DBT *, int, const char *, void *, int (*)(void *, const void *), int)); /* DB_ENV PRIVATE HANDLE LIST END */ }; /* * Dispatch structure for recovery and print routines. Since internal and * external routines take different arguments (ENV versus DB_ENV), we need * something more elaborate than a single pointer and size. */ struct __db_distab { int (**int_dispatch) __P((ENV *, DBT *, DB_LSN *, db_recops, void *)); size_t int_size; int (**ext_dispatch) __P((DB_ENV *, DBT *, DB_LSN *, db_recops)); size_t ext_size; }; #ifndef DB_DBM_HSEARCH #define DB_DBM_HSEARCH 0 /* No historic interfaces by default. */ #endif #if DB_DBM_HSEARCH != 0 /******************************************************* * Dbm/Ndbm historic interfaces. *******************************************************/ typedef struct __db DBM; #define DBM_INSERT 0 /* Flags to dbm_store(). */ #define DBM_REPLACE 1 /* * The DB support for ndbm(3) always appends this suffix to the * file name to avoid overwriting the user's original database. */ #define DBM_SUFFIX ".db" #if defined(_XPG4_2) typedef struct { char *dptr; size_t dsize; } datum; #else typedef struct { char *dptr; int dsize; } datum; #endif /* * Translate NDBM calls into DB calls so that DB doesn't step on the * application's name space. */ #define dbm_clearerr(a) __db_ndbm_clearerr(a) #define dbm_close(a) __db_ndbm_close(a) #define dbm_delete(a, b) __db_ndbm_delete(a, b) #define dbm_dirfno(a) __db_ndbm_dirfno(a) #define dbm_error(a) __db_ndbm_error(a) #define dbm_fetch(a, b) __db_ndbm_fetch(a, b) #define dbm_firstkey(a) __db_ndbm_firstkey(a) #define dbm_nextkey(a) __db_ndbm_nextkey(a) #define dbm_open(a, b, c) __db_ndbm_open(a, b, c) #define dbm_pagfno(a) __db_ndbm_pagfno(a) #define dbm_rdonly(a) __db_ndbm_rdonly(a) #define dbm_store(a, b, c, d) \ __db_ndbm_store(a, b, c, d) /* * Translate DBM calls into DB calls so that DB doesn't step on the * application's name space. * * The global variables dbrdonly, dirf and pagf were not retained when 4BSD * replaced the dbm interface with ndbm, and are not supported here. */ #define dbminit(a) __db_dbm_init(a) #define dbmclose __db_dbm_close #if !defined(__cplusplus) #define delete(a) __db_dbm_delete(a) #endif #define fetch(a) __db_dbm_fetch(a) #define firstkey __db_dbm_firstkey #define nextkey(a) __db_dbm_nextkey(a) #define store(a, b) __db_dbm_store(a, b) /******************************************************* * Hsearch historic interface. *******************************************************/ typedef enum { FIND, ENTER } ACTION; typedef struct entry { char *key; char *data; } ENTRY; #define hcreate(a) __db_hcreate(a) #define hdestroy __db_hdestroy #define hsearch(a, b) __db_hsearch(a, b) #endif /* DB_DBM_HSEARCH */ #if defined(__cplusplus) } #endif #endif /* !_DB_H_ */ /* DO NOT EDIT: automatically built by dist/s_apiflags. */ #define DB_AGGRESSIVE 0x00000001 #define DB_ARCH_ABS 0x00000001 #define DB_ARCH_DATA 0x00000002 #define DB_ARCH_LOG 0x00000004 #define DB_ARCH_REMOVE 0x00000008 #define DB_AUTO_COMMIT 0x00000100 #define DB_CDB_ALLDB 0x00000004 #define DB_CHKSUM 0x00000004 #define DB_CKP_INTERNAL 0x00000002 #define DB_CREATE 0x00000001 #define DB_CXX_NO_EXCEPTIONS 0x00000002 #define DB_DIRECT 0x00000002 #define DB_DIRECT_DB 0x00000040 #define DB_DSYNC_DB 0x00000080 #define DB_DUP 0x00000008 #define DB_DUPSORT 0x00000002 #define DB_DURABLE_UNKNOWN 0x00000020 #define DB_ENCRYPT 0x00000001 #define DB_ENCRYPT_AES 0x00000001 #define DB_EXCL 0x00000400 #define DB_EXTENT 0x00000004 #define DB_FAST_STAT 0x00000001 #define DB_FCNTL_LOCKING 0x00001000 #define DB_FLUSH 0x00000001 #define DB_FORCE 0x00000001 #define DB_FOREIGN_ABORT 0x00000001 #define DB_FOREIGN_CASCADE 0x00000002 #define DB_FOREIGN_NULLIFY 0x00000004 #define DB_FREELIST_ONLY 0x00000001 #define DB_FREE_SPACE 0x00000002 #define DB_IGNORE_LEASE 0x00001000 #define DB_IMMUTABLE_KEY 0x00000002 #define DB_INIT_CDB 0x00000020 #define DB_INIT_LOCK 0x00000040 #define DB_INIT_LOG 0x00000080 #define DB_INIT_MPOOL 0x00000100 #define DB_INIT_REP 0x00000200 #define DB_INIT_TXN 0x00000400 #define DB_INORDER 0x00000010 #define DB_JOIN_NOSORT 0x00000001 #define DB_LOCKDOWN 0x00000800 #define DB_LOCK_NOWAIT 0x00000001 #define DB_LOCK_RECORD 0x00000002 #define DB_LOCK_SET_TIMEOUT 0x00000004 #define DB_LOCK_SWITCH 0x00000008 #define DB_LOCK_UPGRADE 0x00000010 #define DB_LOG_AUTO_REMOVE 0x00000004 #define DB_LOG_CHKPNT 0x00000002 #define DB_LOG_COMMIT 0x00000004 #define DB_LOG_DIRECT 0x00000001 #define DB_LOG_DSYNC 0x00000002 #define DB_LOG_IN_MEMORY 0x00000008 #define DB_LOG_NOCOPY 0x00000008 #define DB_LOG_NOT_DURABLE 0x00000010 #define DB_LOG_WRNOSYNC 0x00000020 #define DB_LOG_ZERO 0x00000010 #define DB_MPOOL_CREATE 0x00000001 #define DB_MPOOL_DIRTY 0x00000002 #define DB_MPOOL_DISCARD 0x00000001 #define DB_MPOOL_EDIT 0x00000004 #define DB_MPOOL_FREE 0x00000008 #define DB_MPOOL_LAST 0x00000010 #define DB_MPOOL_NEW 0x00000020 #define DB_MPOOL_NOFILE 0x00000001 #define DB_MPOOL_NOLOCK 0x00000002 #define DB_MPOOL_UNLINK 0x00000002 #define DB_MULTIPLE 0x00002000 #define DB_MULTIPLE_KEY 0x00000100 #define DB_MULTIVERSION 0x00000008 #define DB_MUTEX_ALLOCATED 0x00000001 #define DB_MUTEX_LOCKED 0x00000002 #define DB_MUTEX_LOGICAL_LOCK 0x00000004 #define DB_MUTEX_PROCESS_ONLY 0x00000008 #define DB_MUTEX_SELF_BLOCK 0x00000010 #define DB_NOLOCKING 0x00000200 #define DB_NOMMAP 0x00000010 #define DB_NOORDERCHK 0x00000002 #define DB_NOPANIC 0x00000400 #define DB_NO_AUTO_COMMIT 0x00002000 #define DB_ODDFILESIZE 0x00000040 #define DB_ORDERCHKONLY 0x00000004 #define DB_OVERWRITE 0x00001000 #define DB_PANIC_ENVIRONMENT 0x00002000 #define DB_PRINTABLE 0x00000008 #define DB_PRIVATE 0x00001000 #define DB_PR_PAGE 0x00000010 #define DB_PR_RECOVERYTEST 0x00000020 #define DB_RDONLY 0x00000080 #define DB_RDWRMASTER 0x00004000 #define DB_READ_COMMITTED 0x00000400 #define DB_READ_UNCOMMITTED 0x00000200 #define DB_RECNUM 0x00000020 #define DB_RECOVER 0x00000010 #define DB_RECOVER_FATAL 0x00002000 #define DB_REGION_INIT 0x00004000 #define DB_REGISTER 0x00004000 #define DB_RENUMBER 0x00000040 #define DB_REPMGR_CONF_2SITE_STRICT 0x00000001 #define DB_REPMGR_PEER 0x00000001 #define DB_REP_ANYWHERE 0x00000001 #define DB_REP_CLIENT 0x00000001 #define DB_REP_CONF_BULK 0x00000002 #define DB_REP_CONF_DELAYCLIENT 0x00000004 #define DB_REP_CONF_LEASE 0x00000008 #define DB_REP_CONF_NOAUTOINIT 0x00000010 #define DB_REP_CONF_NOWAIT 0x00000020 #define DB_REP_ELECTION 0x00000004 #define DB_REP_MASTER 0x00000002 #define DB_REP_NOBUFFER 0x00000002 #define DB_REP_PERMANENT 0x00000004 #define DB_REP_REREQUEST 0x00000008 #define DB_REVSPLITOFF 0x00000080 #define DB_RMW 0x00000800 #define DB_RPCCLIENT 0x00000001 #define DB_SALVAGE 0x00000040 #define DB_SA_SKIPFIRSTKEY 0x00010000 #define DB_SEQ_DEC 0x00000001 #define DB_SEQ_INC 0x00000002 #define DB_SEQ_RANGE_SET 0x00000004 #define DB_SEQ_WRAP 0x00000008 #define DB_SEQ_WRAPPED 0x00000010 #define DB_SET_LOCK_TIMEOUT 0x00000002 #define DB_SET_TXN_NOW 0x00000004 #define DB_SET_TXN_TIMEOUT 0x00000001 #define DB_SNAPSHOT 0x00000100 #define DB_STAT_ALL 0x00000002 #define DB_STAT_CLEAR 0x00000001 #define DB_STAT_LOCK_CONF 0x00000004 #define DB_STAT_LOCK_LOCKERS 0x00000008 #define DB_STAT_LOCK_OBJECTS 0x00000010 #define DB_STAT_LOCK_PARAMS 0x00000020 #define DB_STAT_MEMP_HASH 0x00000004 #define DB_STAT_MEMP_NOERROR 0x00000008 #define DB_STAT_SUBSYSTEM 0x00000004 #define DB_ST_DUPOK 0x00000100 #define DB_ST_DUPSET 0x00000200 #define DB_ST_DUPSORT 0x00000400 #define DB_ST_IS_RECNO 0x00000800 #define DB_ST_OVFL_LEAF 0x00001000 #define DB_ST_RECNUM 0x00002000 #define DB_ST_RELEN 0x00004000 #define DB_ST_TOPLEVEL 0x00008000 #define DB_SYSTEM_MEM 0x00008000 #define DB_THREAD 0x00000004 #define DB_TIME_NOTGRANTED 0x00008000 #define DB_TRUNCATE 0x00008000 #define DB_TXN_NOSYNC 0x00000001 #define DB_TXN_NOT_DURABLE 0x00000200 #define DB_TXN_NOWAIT 0x00000002 #define DB_TXN_SNAPSHOT 0x00000800 #define DB_TXN_SYNC 0x00000004 #define DB_TXN_WAIT 0x00000008 #define DB_TXN_WRITE_NOSYNC 0x00000020 #define DB_UNREF 0x00000080 #define DB_UPGRADE 0x00000001 #define DB_USE_ENVIRON 0x00000002 #define DB_USE_ENVIRON_ROOT 0x00000008 #define DB_VERB_DEADLOCK 0x00000001 #define DB_VERB_FILEOPS 0x00000002 #define DB_VERB_FILEOPS_ALL 0x00000004 #define DB_VERB_RECOVERY 0x00000008 #define DB_VERB_REGISTER 0x00000010 #define DB_VERB_REPLICATION 0x00000020 #define DB_VERB_REPMGR_CONNFAIL 0x00000040 #define DB_VERB_REPMGR_MISC 0x00000080 #define DB_VERB_REP_ELECT 0x00000100 #define DB_VERB_REP_LEASE 0x00000200 #define DB_VERB_REP_MISC 0x00000400 #define DB_VERB_REP_MSGS 0x00000800 #define DB_VERB_REP_SYNC 0x00001000 #define DB_VERB_WAITSFOR 0x00002000 #define DB_VERIFY 0x00000002 #define DB_WRITEOPEN 0x00010000 #define DB_XA_CREATE 0x00000800 #define DB_YIELDCPU 0x00010000 /* DO NOT EDIT: automatically built by dist/s_include. */ #ifndef _DB_EXT_PROT_IN_ #define _DB_EXT_PROT_IN_ #if defined(__cplusplus) extern "C" { #endif int db_create __P((DB **, DB_ENV *, u_int32_t)); char *db_strerror __P((int)); int db_env_set_func_close __P((int (*)(int))); int db_env_set_func_dirfree __P((void (*)(char **, int))); int db_env_set_func_dirlist __P((int (*)(const char *, char ***, int *))); int db_env_set_func_exists __P((int (*)(const char *, int *))); int db_env_set_func_free __P((void (*)(void *))); int db_env_set_func_fsync __P((int (*)(int))); int db_env_set_func_ftruncate __P((int (*)(int, off_t))); int db_env_set_func_ioinfo __P((int (*)(const char *, int, u_int32_t *, u_int32_t *, u_int32_t *))); int db_env_set_func_malloc __P((void *(*)(size_t))); int db_env_set_func_file_map __P((int (*)(DB_ENV *, char *, size_t, int, void **), int (*)(DB_ENV *, void *))); int db_env_set_func_region_map __P((int (*)(DB_ENV *, char *, size_t, int *, void **), int (*)(DB_ENV *, void *))); int db_env_set_func_pread __P((ssize_t (*)(int, void *, size_t, off_t))); int db_env_set_func_pwrite __P((ssize_t (*)(int, const void *, size_t, off_t))); int db_env_set_func_open __P((int (*)(const char *, int, ...))); int db_env_set_func_read __P((ssize_t (*)(int, void *, size_t))); int db_env_set_func_realloc __P((void *(*)(void *, size_t))); int db_env_set_func_rename __P((int (*)(const char *, const char *))); int db_env_set_func_seek __P((int (*)(int, off_t, int))); int db_env_set_func_unlink __P((int (*)(const char *))); int db_env_set_func_write __P((ssize_t (*)(int, const void *, size_t))); int db_env_set_func_yield __P((int (*)(u_long, u_long))); int db_env_create __P((DB_ENV **, u_int32_t)); char *db_version __P((int *, int *, int *)); int log_compare __P((const DB_LSN *, const DB_LSN *)); int db_sequence_create __P((DB_SEQUENCE **, DB *, u_int32_t)); #if DB_DBM_HSEARCH != 0 int __db_ndbm_clearerr __P((DBM *)); void __db_ndbm_close __P((DBM *)); int __db_ndbm_delete __P((DBM *, datum)); int __db_ndbm_dirfno __P((DBM *)); int __db_ndbm_error __P((DBM *)); datum __db_ndbm_fetch __P((DBM *, datum)); datum __db_ndbm_firstkey __P((DBM *)); datum __db_ndbm_nextkey __P((DBM *)); DBM *__db_ndbm_open __P((const char *, int, int)); int __db_ndbm_pagfno __P((DBM *)); int __db_ndbm_rdonly __P((DBM *)); int __db_ndbm_store __P((DBM *, datum, datum, int)); int __db_dbm_close __P((void)); int __db_dbm_delete __P((datum)); datum __db_dbm_fetch __P((datum)); datum __db_dbm_firstkey __P((void)); int __db_dbm_init __P((char *)); datum __db_dbm_nextkey __P((datum)); int __db_dbm_store __P((datum, datum)); #endif #if DB_DBM_HSEARCH != 0 int __db_hcreate __P((size_t)); ENTRY *__db_hsearch __P((ENTRY, ACTION)); void __db_hdestroy __P((void)); #endif #if defined(__cplusplus) } #endif #endif /* !_DB_EXT_PROT_IN_ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������db4.7.25/db_cxx.h�����������������������������������������������������������������������������������0000644�����������������00000113356�14763166026�0007253 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*- * See the file LICENSE for redistribution information. * * Copyright (c) 1997,2008 Oracle. All rights reserved. * * $Id: db_cxx.in,v 12.49 2008/01/12 13:42:37 bostic Exp $ */ #ifndef _DB_CXX_H_ #define _DB_CXX_H_ // // C++ assumptions: // // To ensure portability to many platforms, both new and old, we make // few assumptions about the C++ compiler and library. For example, // we do not expect STL, templates or namespaces to be available. The // "newest" C++ feature used is exceptions, which are used liberally // to transmit error information. Even the use of exceptions can be // disabled at runtime, to do so, use the DB_CXX_NO_EXCEPTIONS flags // with the DbEnv or Db constructor. // // C++ naming conventions: // // - All top level class names start with Db. // - All class members start with lower case letter. // - All private data members are suffixed with underscore. // - Use underscores to divide names into multiple words. // - Simple data accessors are named with get_ or set_ prefix. // - All method names are taken from names of functions in the C // layer of db (usually by dropping a prefix like "db_"). // These methods have the same argument types and order, // other than dropping the explicit arg that acts as "this". // // As a rule, each DbFoo object has exactly one underlying DB_FOO struct // (defined in db.h) associated with it. In some cases, we inherit directly // from the DB_FOO structure to make this relationship explicit. Often, // the underlying C layer allocates and deallocates these structures, so // there is no easy way to add any data to the DbFoo class. When you see // a comment about whether data is permitted to be added, this is what // is going on. Of course, if we need to add data to such C++ classes // in the future, we will arrange to have an indirect pointer to the // DB_FOO struct (as some of the classes already have). // //////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// // // Forward declarations // #include <stdarg.h> #define HAVE_CXX_STDHEADERS 1 #ifdef HAVE_CXX_STDHEADERS #include <iostream> #include <exception> #define __DB_STD(x) std::x #else #include <iostream.h> #include <exception.h> #define __DB_STD(x) x #endif #include "db.h" class Db; // forward class Dbc; // forward class DbEnv; // forward class DbInfo; // forward class DbLock; // forward class DbLogc; // forward class DbLsn; // forward class DbMpoolFile; // forward class DbPreplist; // forward class DbSequence; // forward class Dbt; // forward class DbTxn; // forward class DbMultipleIterator; // forward class DbMultipleKeyDataIterator; // forward class DbMultipleRecnoDataIterator; // forward class DbMultipleDataIterator; // forward class DbException; // forward class DbDeadlockException; // forward class DbLockNotGrantedException; // forward class DbMemoryException; // forward class DbRepHandleDeadException; // forward class DbRunRecoveryException; // forward //////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// // // Turn off inappropriate compiler warnings // #ifdef _MSC_VER // These are level 4 warnings that are explicitly disabled. // With Visual C++, by default you do not see above level 3 unless // you use /W4. But we like to compile with the highest level // warnings to catch other errors. // // 4201: nameless struct/union // triggered by standard include file <winnt.h> // // 4514: unreferenced inline function has been removed // certain include files in MSVC define methods that are not called // #pragma warning(push) #pragma warning(disable: 4201 4514) #endif //////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// // // Mechanisms for declaring classes // // // Every class defined in this file has an _exported next to the class name. // This is needed for WinTel machines so that the class methods can // be exported or imported in a DLL as appropriate. Users of the DLL // use the define DB_USE_DLL. When the DLL is built, DB_CREATE_DLL // must be defined. // #if defined(_MSC_VER) # if defined(DB_CREATE_DLL) # define _exported __declspec(dllexport) // creator of dll # elif defined(DB_USE_DLL) # define _exported __declspec(dllimport) // user of dll # else # define _exported // static lib creator or user # endif #else /* _MSC_VER */ # define _exported #endif /* _MSC_VER */ // Some interfaces can be customized by allowing users to define // callback functions. For performance and logistical reasons, some // callback functions must be declared in extern "C" blocks. For others, // we allow you to declare the callbacks in C++ or C (or an extern "C" // block) as you wish. See the set methods for the callbacks for // the choices. // extern "C" { typedef void * (*db_malloc_fcn_type) (size_t); typedef void * (*db_realloc_fcn_type) (void *, size_t); typedef void (*db_free_fcn_type) (void *); typedef int (*bt_compare_fcn_type) /*C++ version available*/ (DB *, const DBT *, const DBT *); typedef size_t (*bt_prefix_fcn_type) /*C++ version available*/ (DB *, const DBT *, const DBT *); typedef int (*dup_compare_fcn_type) /*C++ version available*/ (DB *, const DBT *, const DBT *); typedef int (*h_compare_fcn_type) /*C++ version available*/ (DB *, const DBT *, const DBT *); typedef u_int32_t (*h_hash_fcn_type) /*C++ version available*/ (DB *, const void *, u_int32_t); typedef int (*pgin_fcn_type) (DB_ENV *dbenv, db_pgno_t pgno, void *pgaddr, DBT *pgcookie); typedef int (*pgout_fcn_type) (DB_ENV *dbenv, db_pgno_t pgno, void *pgaddr, DBT *pgcookie); } // // Represents a database table = a set of keys with associated values. // class _exported Db { friend class DbEnv; public: Db(DbEnv*, u_int32_t); // Create a Db object. virtual ~Db(); // Calls close() if the user hasn't. // These methods exactly match those in the C interface. // virtual int associate(DbTxn *txn, Db *secondary, int (*callback) (Db *, const Dbt *, const Dbt *, Dbt *), u_int32_t flags); virtual int close(u_int32_t flags); virtual int compact(DbTxn *txnid, Dbt *start, Dbt *stop, DB_COMPACT *c_data, u_int32_t flags, Dbt *end); virtual int cursor(DbTxn *txnid, Dbc **cursorp, u_int32_t flags); virtual int del(DbTxn *txnid, Dbt *key, u_int32_t flags); virtual void err(int, const char *, ...); virtual void errx(const char *, ...); virtual int exists(DbTxn *txnid, Dbt *key, u_int32_t flags); virtual int fd(int *fdp); virtual int get(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t flags); virtual int get_bt_minkey(u_int32_t *); virtual int get_byteswapped(int *); virtual int get_cachesize(u_int32_t *, u_int32_t *, int *); virtual int get_dbname(const char **, const char **); virtual int get_encrypt_flags(u_int32_t *); virtual void get_errfile(FILE **); virtual void get_errpfx(const char **); virtual int get_flags(u_int32_t *); virtual int get_h_ffactor(u_int32_t *); virtual int get_h_nelem(u_int32_t *); virtual int get_lorder(int *); virtual void get_msgfile(FILE **); virtual int get_multiple(); virtual int get_open_flags(u_int32_t *); virtual int get_pagesize(u_int32_t *); virtual int get_priority(DB_CACHE_PRIORITY *); virtual int get_q_extentsize(u_int32_t *); virtual int get_re_delim(int *); virtual int get_re_len(u_int32_t *); virtual int get_re_pad(int *); virtual int get_re_source(const char **); virtual int get_transactional(); virtual int get_type(DBTYPE *); virtual int join(Dbc **curslist, Dbc **dbcp, u_int32_t flags); virtual int key_range(DbTxn *, Dbt *, DB_KEY_RANGE *, u_int32_t); virtual int open(DbTxn *txnid, const char *, const char *subname, DBTYPE, u_int32_t, int); virtual int pget(DbTxn *txnid, Dbt *key, Dbt *pkey, Dbt *data, u_int32_t flags); virtual int put(DbTxn *, Dbt *, Dbt *, u_int32_t); virtual int remove(const char *, const char *, u_int32_t); virtual int rename(const char *, const char *, const char *, u_int32_t); virtual int set_alloc( db_malloc_fcn_type, db_realloc_fcn_type, db_free_fcn_type); virtual void set_app_private(void *); virtual int set_append_recno(int (*)(Db *, Dbt *, db_recno_t)); virtual int set_bt_compare(bt_compare_fcn_type); /*deprecated*/ virtual int set_bt_compare(int (*)(Db *, const Dbt *, const Dbt *)); virtual int set_bt_minkey(u_int32_t); virtual int set_bt_prefix(bt_prefix_fcn_type); /*deprecated*/ virtual int set_bt_prefix(size_t (*)(Db *, const Dbt *, const Dbt *)); virtual int set_cachesize(u_int32_t, u_int32_t, int); virtual int set_dup_compare(dup_compare_fcn_type); /*deprecated*/ virtual int set_dup_compare(int (*)(Db *, const Dbt *, const Dbt *)); virtual int set_encrypt(const char *, u_int32_t); virtual void set_errcall( void (*)(const DbEnv *, const char *, const char *)); virtual void set_errfile(FILE *); virtual void set_errpfx(const char *); virtual int set_feedback(void (*)(Db *, int, int)); virtual int set_flags(u_int32_t); virtual int set_h_compare(h_compare_fcn_type); /*deprecated*/ virtual int set_h_compare(int (*)(Db *, const Dbt *, const Dbt *)); virtual int set_h_ffactor(u_int32_t); virtual int set_h_hash(h_hash_fcn_type); /*deprecated*/ virtual int set_h_hash(u_int32_t (*)(Db *, const void *, u_int32_t)); virtual int set_h_nelem(u_int32_t); virtual int set_lorder(int); virtual void set_msgcall(void (*)(const DbEnv *, const char *)); virtual void set_msgfile(FILE *); virtual int set_pagesize(u_int32_t); virtual int set_paniccall(void (*)(DbEnv *, int)); virtual int set_priority(DB_CACHE_PRIORITY); virtual int set_q_extentsize(u_int32_t); virtual int set_re_delim(int); virtual int set_re_len(u_int32_t); virtual int set_re_pad(int); virtual int set_re_source(const char *); virtual int stat(DbTxn *, void *sp, u_int32_t flags); virtual int stat_print(u_int32_t flags); virtual int sync(u_int32_t flags); virtual int truncate(DbTxn *, u_int32_t *, u_int32_t); virtual int upgrade(const char *name, u_int32_t flags); virtual int verify( const char *, const char *, __DB_STD(ostream) *, u_int32_t); // These additional methods are not in the C interface, and // are only available for C++. // virtual void *get_app_private() const; virtual __DB_STD(ostream) *get_error_stream(); virtual void set_error_stream(__DB_STD(ostream) *); virtual __DB_STD(ostream) *get_message_stream(); virtual void set_message_stream(__DB_STD(ostream) *); virtual DbEnv *get_env(); virtual DbMpoolFile *get_mpf(); virtual ENV *get_ENV() { return imp_->env; } virtual DB *get_DB() { return imp_; } virtual const DB *get_const_DB() const { return imp_; } static Db* get_Db(DB *db) { return (Db *)db->api_internal; } static const Db* get_const_Db(const DB *db) { return (const Db *)db->api_internal; } private: // no copying Db(const Db &); Db &operator = (const Db &); void cleanup(); int initialize(); int error_policy(); // instance data DB *imp_; DbEnv *dbenv_; DbMpoolFile *mpf_; int construct_error_; u_int32_t flags_; u_int32_t construct_flags_; public: // These are public only because they need to be called // via C callback functions. They should never be used by // external users of this class. // int (*append_recno_callback_)(Db *, Dbt *, db_recno_t); int (*associate_callback_)(Db *, const Dbt *, const Dbt *, Dbt *); int (*bt_compare_callback_)(Db *, const Dbt *, const Dbt *); size_t (*bt_prefix_callback_)(Db *, const Dbt *, const Dbt *); int (*dup_compare_callback_)(Db *, const Dbt *, const Dbt *); void (*feedback_callback_)(Db *, int, int); int (*h_compare_callback_)(Db *, const Dbt *, const Dbt *); u_int32_t (*h_hash_callback_)(Db *, const void *, u_int32_t); }; // // Cursor // class _exported Dbc : protected DBC { friend class Db; public: int close(); int count(db_recno_t *countp, u_int32_t flags); int del(u_int32_t flags); int dup(Dbc** cursorp, u_int32_t flags); int get(Dbt* key, Dbt *data, u_int32_t flags); int get_priority(DB_CACHE_PRIORITY *priorityp); int pget(Dbt* key, Dbt* pkey, Dbt *data, u_int32_t flags); int put(Dbt* key, Dbt *data, u_int32_t flags); int set_priority(DB_CACHE_PRIORITY priority); private: // No data is permitted in this class (see comment at top) // Note: use Db::cursor() to get pointers to a Dbc, // and call Dbc::close() rather than delete to release them. // Dbc(); ~Dbc(); // no copying Dbc(const Dbc &); Dbc &operator = (const Dbc &); }; // // Berkeley DB environment class. Provides functions for opening databases. // User of this library can use this class as a starting point for // developing a DB application - derive their application class from // this one, add application control logic. // // Note that if you use the default constructor, you must explicitly // call appinit() before any other db activity (e.g. opening files) // class _exported DbEnv { friend class Db; friend class DbLock; friend class DbMpoolFile; public: // After using this constructor, you can set any needed // parameters for the environment using the set_* methods. // Then call open() to finish initializing the environment // and attaching it to underlying files. // DbEnv(u_int32_t flags); virtual ~DbEnv(); // These methods match those in the C interface. // virtual int cdsgroup_begin(DbTxn **tid); virtual int close(u_int32_t); virtual int dbremove(DbTxn *txn, const char *name, const char *subdb, u_int32_t flags); virtual int dbrename(DbTxn *txn, const char *name, const char *subdb, const char *newname, u_int32_t flags); virtual void err(int, const char *, ...); virtual void errx(const char *, ...); virtual int failchk(u_int32_t); virtual int fileid_reset(const char *, u_int32_t); virtual void *get_app_private() const; virtual int get_home(const char **); virtual int get_open_flags(u_int32_t *); virtual int open(const char *, u_int32_t, int); virtual int remove(const char *, u_int32_t); virtual int stat_print(u_int32_t flags); virtual int set_alloc(db_malloc_fcn_type, db_realloc_fcn_type, db_free_fcn_type); virtual void set_app_private(void *); virtual int get_cachesize(u_int32_t *, u_int32_t *, int *); virtual int set_cachesize(u_int32_t, u_int32_t, int); virtual int get_cache_max(u_int32_t *, u_int32_t *); virtual int set_cache_max(u_int32_t, u_int32_t); virtual int get_data_dirs(const char ***); virtual int set_data_dir(const char *); virtual int get_encrypt_flags(u_int32_t *); virtual int get_intermediate_dir_mode(const char **); virtual int set_intermediate_dir_mode(const char *); virtual int set_isalive( int (*)(DbEnv *, pid_t, db_threadid_t, u_int32_t)); virtual int set_encrypt(const char *, u_int32_t); virtual void set_errcall( void (*)(const DbEnv *, const char *, const char *)); virtual void get_errfile(FILE **); virtual void set_errfile(FILE *); virtual void get_errpfx(const char **); virtual void set_errpfx(const char *); virtual int set_event_notify(void (*)(DbEnv *, u_int32_t, void *)); virtual int get_flags(u_int32_t *); virtual int set_flags(u_int32_t, int); virtual bool is_bigendian(); virtual int lsn_reset(const char *, u_int32_t); virtual int set_feedback(void (*)(DbEnv *, int, int)); virtual int get_lg_bsize(u_int32_t *); virtual int set_lg_bsize(u_int32_t); virtual int get_lg_dir(const char **); virtual int set_lg_dir(const char *); virtual int get_lg_filemode(int *); virtual int set_lg_filemode(int); virtual int get_lg_max(u_int32_t *); virtual int set_lg_max(u_int32_t); virtual int get_lg_regionmax(u_int32_t *); virtual int set_lg_regionmax(u_int32_t); virtual int get_lk_conflicts(const u_int8_t **, int *); virtual int set_lk_conflicts(u_int8_t *, int); virtual int get_lk_detect(u_int32_t *); virtual int set_lk_detect(u_int32_t); virtual int get_lk_max_lockers(u_int32_t *); virtual int set_lk_max_lockers(u_int32_t); virtual int get_lk_max_locks(u_int32_t *); virtual int set_lk_max_locks(u_int32_t); virtual int get_lk_max_objects(u_int32_t *); virtual int set_lk_max_objects(u_int32_t); virtual int get_mp_mmapsize(size_t *); virtual int set_mp_mmapsize(size_t); virtual int get_mp_max_openfd(int *); virtual int set_mp_max_openfd(int); virtual int get_mp_max_write(int *, db_timeout_t *); virtual int set_mp_max_write(int, db_timeout_t); virtual void set_msgcall(void (*)(const DbEnv *, const char *)); virtual void get_msgfile(FILE **); virtual void set_msgfile(FILE *); virtual int set_paniccall(void (*)(DbEnv *, int)); virtual int set_rpc_server(void *, char *, long, long, u_int32_t); virtual int get_shm_key(long *); virtual int set_shm_key(long); virtual int get_timeout(db_timeout_t *, u_int32_t); virtual int set_timeout(db_timeout_t, u_int32_t); virtual int get_tmp_dir(const char **); virtual int set_tmp_dir(const char *); virtual int get_tx_max(u_int32_t *); virtual int set_tx_max(u_int32_t); virtual int set_app_dispatch(int (*)(DbEnv *, Dbt *, DbLsn *, db_recops)); virtual int get_tx_timestamp(time_t *); virtual int set_tx_timestamp(time_t *); virtual int get_verbose(u_int32_t which, int *); virtual int set_verbose(u_int32_t which, int); // Version information. A static method so it can be obtained anytime. // static char *version(int *major, int *minor, int *patch); // Convert DB errors to strings static char *strerror(int); // If an error is detected and the error call function // or stream is set, a message is dispatched or printed. // If a prefix is set, each message is prefixed. // // You can use set_errcall() or set_errfile() above to control // error functionality. Alternatively, you can call // set_error_stream() to force all errors to a C++ stream. // It is unwise to mix these approaches. // virtual __DB_STD(ostream) *get_error_stream(); virtual void set_error_stream(__DB_STD(ostream) *); virtual __DB_STD(ostream) *get_message_stream(); virtual void set_message_stream(__DB_STD(ostream) *); // used internally static void runtime_error(DbEnv *dbenv, const char *caller, int err, int error_policy); static void runtime_error_dbt(DbEnv *dbenv, const char *caller, Dbt *dbt, int error_policy); static void runtime_error_lock_get(DbEnv *dbenv, const char *caller, int err, db_lockop_t op, db_lockmode_t mode, const Dbt *obj, DbLock lock, int index, int error_policy); // Lock functions // virtual int lock_detect(u_int32_t flags, u_int32_t atype, int *aborted); virtual int lock_get(u_int32_t locker, u_int32_t flags, const Dbt *obj, db_lockmode_t lock_mode, DbLock *lock); virtual int lock_id(u_int32_t *idp); virtual int lock_id_free(u_int32_t id); virtual int lock_put(DbLock *lock); virtual int lock_stat(DB_LOCK_STAT **statp, u_int32_t flags); virtual int lock_stat_print(u_int32_t flags); virtual int lock_vec(u_int32_t locker, u_int32_t flags, DB_LOCKREQ list[], int nlist, DB_LOCKREQ **elistp); // Log functions // virtual int log_archive(char **list[], u_int32_t flags); static int log_compare(const DbLsn *lsn0, const DbLsn *lsn1); virtual int log_cursor(DbLogc **cursorp, u_int32_t flags); virtual int log_file(DbLsn *lsn, char *namep, size_t len); virtual int log_flush(const DbLsn *lsn); virtual int log_get_config(u_int32_t, int *); virtual int log_put(DbLsn *lsn, const Dbt *data, u_int32_t flags); virtual int log_printf(DbTxn *, const char *, ...); virtual int log_set_config(u_int32_t, int); virtual int log_stat(DB_LOG_STAT **spp, u_int32_t flags); virtual int log_stat_print(u_int32_t flags); // Mpool functions // virtual int memp_fcreate(DbMpoolFile **dbmfp, u_int32_t flags); virtual int memp_register(int ftype, pgin_fcn_type pgin_fcn, pgout_fcn_type pgout_fcn); virtual int memp_stat(DB_MPOOL_STAT **gsp, DB_MPOOL_FSTAT ***fsp, u_int32_t flags); virtual int memp_stat_print(u_int32_t flags); virtual int memp_sync(DbLsn *lsn); virtual int memp_trickle(int pct, int *nwrotep); // Mpool functions // virtual int mutex_alloc(u_int32_t, db_mutex_t *); virtual int mutex_free(db_mutex_t); virtual int mutex_get_align(u_int32_t *); virtual int mutex_get_increment(u_int32_t *); virtual int mutex_get_max(u_int32_t *); virtual int mutex_get_tas_spins(u_int32_t *); virtual int mutex_lock(db_mutex_t); virtual int mutex_set_align(u_int32_t); virtual int mutex_set_increment(u_int32_t); virtual int mutex_set_max(u_int32_t); virtual int mutex_set_tas_spins(u_int32_t); virtual int mutex_stat(DB_MUTEX_STAT **, u_int32_t); virtual int mutex_stat_print(u_int32_t); virtual int mutex_unlock(db_mutex_t); // Transaction functions // virtual int txn_begin(DbTxn *pid, DbTxn **tid, u_int32_t flags); virtual int txn_checkpoint(u_int32_t kbyte, u_int32_t min, u_int32_t flags); virtual int txn_recover(DbPreplist *preplist, long count, long *retp, u_int32_t flags); virtual int txn_stat(DB_TXN_STAT **statp, u_int32_t flags); virtual int txn_stat_print(u_int32_t flags); // Replication functions // virtual int rep_elect(u_int32_t, u_int32_t, u_int32_t); virtual int rep_flush(); virtual int rep_process_message(Dbt *, Dbt *, int, DbLsn *); virtual int rep_start(Dbt *, u_int32_t); virtual int rep_stat(DB_REP_STAT **statp, u_int32_t flags); virtual int rep_stat_print(u_int32_t flags); virtual int rep_get_clockskew(u_int32_t *, u_int32_t *); virtual int rep_set_clockskew(u_int32_t, u_int32_t); virtual int rep_get_limit(u_int32_t *, u_int32_t *); virtual int rep_set_limit(u_int32_t, u_int32_t); virtual int rep_set_transport(int, int (*)(DbEnv *, const Dbt *, const Dbt *, const DbLsn *, int, u_int32_t)); virtual int rep_set_request(u_int32_t, u_int32_t); virtual int rep_get_request(u_int32_t *, u_int32_t *); virtual int get_thread_count(u_int32_t *); virtual int set_thread_count(u_int32_t); virtual int set_thread_id(void (*)(DbEnv *, pid_t *, db_threadid_t *)); virtual int set_thread_id_string(char *(*)(DbEnv *, pid_t, db_threadid_t, char *)); virtual int rep_set_config(u_int32_t, int); virtual int rep_get_config(u_int32_t, int *); virtual int rep_sync(u_int32_t flags); // Advanced replication functions // virtual int rep_get_nsites(u_int32_t *n); virtual int rep_set_nsites(u_int32_t n); virtual int rep_get_priority(u_int32_t *priorityp); virtual int rep_set_priority(u_int32_t priority); virtual int rep_get_timeout(int which, db_timeout_t *timeout); virtual int rep_set_timeout(int which, db_timeout_t timeout); virtual int repmgr_add_remote_site(const char * host, u_int16_t port, int *eidp, u_int32_t flags); virtual int repmgr_get_ack_policy(int *policy); virtual int repmgr_set_ack_policy(int policy); virtual int repmgr_set_local_site(const char * host, u_int16_t port, u_int32_t flags); virtual int repmgr_site_list(u_int *countp, DB_REPMGR_SITE **listp); virtual int repmgr_start(int nthreads, u_int32_t flags); virtual int repmgr_stat(DB_REPMGR_STAT **statp, u_int32_t flags); virtual int repmgr_stat_print(u_int32_t flags); // Conversion functions // virtual ENV *get_ENV() { return imp_->env; } virtual DB_ENV *get_DB_ENV() { return imp_; } virtual const DB_ENV *get_const_DB_ENV() const { return imp_; } static DbEnv* get_DbEnv(DB_ENV *dbenv) { return dbenv ? (DbEnv *)dbenv->api1_internal : 0; } static const DbEnv* get_const_DbEnv(const DB_ENV *dbenv) { return dbenv ? (const DbEnv *)dbenv->api1_internal : 0; } // For internal use only. static DbEnv* wrap_DB_ENV(DB_ENV *dbenv); // These are public only because they need to be called // via C functions. They should never be called by users // of this class. // static int _app_dispatch_intercept(DB_ENV *dbenv, DBT *dbt, DB_LSN *lsn, db_recops op); static void _paniccall_intercept(DB_ENV *dbenv, int errval); static void _feedback_intercept(DB_ENV *dbenv, int opcode, int pct); static void _event_func_intercept(DB_ENV *dbenv, u_int32_t, void *); static int _isalive_intercept(DB_ENV *dbenv, pid_t pid, db_threadid_t thrid, u_int32_t flags); static int _rep_send_intercept(DB_ENV *dbenv, const DBT *cntrl, const DBT *data, const DB_LSN *lsn, int id, u_int32_t flags); static void _stream_error_function(const DB_ENV *dbenv, const char *prefix, const char *message); static void _stream_message_function(const DB_ENV *dbenv, const char *message); static void _thread_id_intercept(DB_ENV *dbenv, pid_t *pidp, db_threadid_t *thridp); static char *_thread_id_string_intercept(DB_ENV *dbenv, pid_t pid, db_threadid_t thrid, char *buf); private: void cleanup(); int initialize(DB_ENV *dbenv); int error_policy(); // For internal use only. DbEnv(DB_ENV *, u_int32_t flags); // no copying DbEnv(const DbEnv &); void operator = (const DbEnv &); // instance data DB_ENV *imp_; int construct_error_; u_int32_t construct_flags_; __DB_STD(ostream) *error_stream_; __DB_STD(ostream) *message_stream_; int (*app_dispatch_callback_)(DbEnv *, Dbt *, DbLsn *, db_recops); int (*isalive_callback_)(DbEnv *, pid_t, db_threadid_t, u_int32_t); void (*error_callback_)(const DbEnv *, const char *, const char *); void (*feedback_callback_)(DbEnv *, int, int); void (*message_callback_)(const DbEnv *, const char *); void (*paniccall_callback_)(DbEnv *, int); void (*event_func_callback_)(DbEnv *, u_int32_t, void *); int (*rep_send_callback_)(DbEnv *, const Dbt *, const Dbt *, const DbLsn *, int, u_int32_t); void (*thread_id_callback_)(DbEnv *, pid_t *, db_threadid_t *); char *(*thread_id_string_callback_)(DbEnv *, pid_t, db_threadid_t, char *); }; // // Lock // class _exported DbLock { friend class DbEnv; public: DbLock(); DbLock(const DbLock &); DbLock &operator = (const DbLock &); protected: // We can add data to this class if needed // since its contained class is not allocated by db. // (see comment at top) DbLock(DB_LOCK); DB_LOCK lock_; }; // // Log cursor // class _exported DbLogc : protected DB_LOGC { friend class DbEnv; public: int close(u_int32_t _flags); int get(DbLsn *lsn, Dbt *data, u_int32_t _flags); int version(u_int32_t *versionp, u_int32_t _flags); private: // No data is permitted in this class (see comment at top) // Note: use Db::cursor() to get pointers to a Dbc, // and call Dbc::close() rather than delete to release them. // DbLogc(); ~DbLogc(); // no copying DbLogc(const Dbc &); DbLogc &operator = (const Dbc &); }; // // Log sequence number // class _exported DbLsn : public DB_LSN { friend class DbEnv; // friendship needed to cast to base class friend class DbLogc; // friendship needed to cast to base class }; // // Memory pool file // class _exported DbMpoolFile { friend class DbEnv; friend class Db; public: int close(u_int32_t flags); int get(db_pgno_t *pgnoaddr, DbTxn *txn, u_int32_t flags, void *pagep); int get_clear_len(u_int32_t *len); int get_fileid(u_int8_t *fileid); int get_flags(u_int32_t *flagsp); int get_ftype(int *ftype); int get_last_pgno(db_pgno_t *pgnop); int get_lsn_offset(int32_t *offsetp); int get_maxsize(u_int32_t *gbytes, u_int32_t *bytes); int get_pgcookie(DBT *dbt); int get_priority(DB_CACHE_PRIORITY *priorityp); int get_transactional(void); int open(const char *file, u_int32_t flags, int mode, size_t pagesize); int put(void *pgaddr, DB_CACHE_PRIORITY priority, u_int32_t flags); int set_clear_len(u_int32_t len); int set_fileid(u_int8_t *fileid); int set_flags(u_int32_t flags, int onoff); int set_ftype(int ftype); int set_lsn_offset(int32_t offset); int set_maxsize(u_int32_t gbytes, u_int32_t bytes); int set_pgcookie(DBT *dbt); int set_priority(DB_CACHE_PRIORITY priority); int sync(); virtual DB_MPOOLFILE *get_DB_MPOOLFILE() { return imp_; } virtual const DB_MPOOLFILE *get_const_DB_MPOOLFILE() const { return imp_; } private: DB_MPOOLFILE *imp_; // We can add data to this class if needed // since it is implemented via a pointer. // (see comment at top) // Note: use DbEnv::memp_fcreate() to get pointers to a DbMpoolFile, // and call DbMpoolFile::close() rather than delete to release them. // DbMpoolFile(); // Shut g++ up. protected: virtual ~DbMpoolFile(); private: // no copying DbMpoolFile(const DbMpoolFile &); void operator = (const DbMpoolFile &); }; // // This is filled in and returned by the DbEnv::txn_recover() method. // class _exported DbPreplist { public: DbTxn *txn; u_int8_t gid[DB_XIDDATASIZE]; }; // // A sequence record in a database // class _exported DbSequence { public: DbSequence(Db *db, u_int32_t flags); virtual ~DbSequence(); int open(DbTxn *txnid, Dbt *key, u_int32_t flags); int initial_value(db_seq_t value); int close(u_int32_t flags); int remove(DbTxn *txnid, u_int32_t flags); int stat(DB_SEQUENCE_STAT **sp, u_int32_t flags); int stat_print(u_int32_t flags); int get(DbTxn *txnid, int32_t delta, db_seq_t *retp, u_int32_t flags); int get_cachesize(int32_t *sizep); int set_cachesize(int32_t size); int get_flags(u_int32_t *flagsp); int set_flags(u_int32_t flags); int get_range(db_seq_t *minp, db_seq_t *maxp); int set_range(db_seq_t min, db_seq_t max); Db *get_db(); Dbt *get_key(); virtual DB_SEQUENCE *get_DB_SEQUENCE() { return imp_; } virtual const DB_SEQUENCE *get_const_DB_SEQUENCE() const { return imp_; } static DbSequence* get_DbSequence(DB_SEQUENCE *seq) { return (DbSequence *)seq->api_internal; } static const DbSequence* get_const_DbSequence(const DB_SEQUENCE *seq) { return (const DbSequence *)seq->api_internal; } // For internal use only. static DbSequence* wrap_DB_SEQUENCE(DB_SEQUENCE *seq); private: DbSequence(DB_SEQUENCE *seq); // no copying DbSequence(const DbSequence &); DbSequence &operator = (const DbSequence &); DB_SEQUENCE *imp_; DBT key_; }; // // Transaction // class _exported DbTxn { friend class DbEnv; public: int abort(); int commit(u_int32_t flags); int discard(u_int32_t flags); u_int32_t id(); int get_name(const char **namep); int prepare(u_int8_t *gid); int set_name(const char *name); int set_timeout(db_timeout_t timeout, u_int32_t flags); virtual DB_TXN *get_DB_TXN() { return imp_; } virtual const DB_TXN *get_const_DB_TXN() const { return imp_; } static DbTxn* get_DbTxn(DB_TXN *txn) { return (DbTxn *)txn->api_internal; } static const DbTxn* get_const_DbTxn(const DB_TXN *txn) { return (const DbTxn *)txn->api_internal; } // For internal use only. static DbTxn* wrap_DB_TXN(DB_TXN *txn); private: DB_TXN *imp_; // We can add data to this class if needed // since it is implemented via a pointer. // (see comment at top) // Note: use DbEnv::txn_begin() to get pointers to a DbTxn, // and call DbTxn::abort() or DbTxn::commit rather than // delete to release them. // DbTxn(); // For internal use only. DbTxn(DB_TXN *txn); virtual ~DbTxn(); // no copying DbTxn(const DbTxn &); void operator = (const DbTxn &); }; // // A chunk of data, maybe a key or value. // class _exported Dbt : private DBT { friend class Db; friend class Dbc; friend class DbEnv; friend class DbLogc; friend class DbSequence; public: // key/data void *get_data() const { return data; } void set_data(void *value) { data = value; } // key/data length u_int32_t get_size() const { return size; } void set_size(u_int32_t value) { size = value; } // RO: length of user buffer. u_int32_t get_ulen() const { return ulen; } void set_ulen(u_int32_t value) { ulen = value; } // RO: get/put record length. u_int32_t get_dlen() const { return dlen; } void set_dlen(u_int32_t value) { dlen = value; } // RO: get/put record offset. u_int32_t get_doff() const { return doff; } void set_doff(u_int32_t value) { doff = value; } // flags u_int32_t get_flags() const { return flags; } void set_flags(u_int32_t value) { flags = value; } // Conversion functions DBT *get_DBT() { return (DBT *)this; } const DBT *get_const_DBT() const { return (const DBT *)this; } static Dbt* get_Dbt(DBT *dbt) { return (Dbt *)dbt; } static const Dbt* get_const_Dbt(const DBT *dbt) { return (const Dbt *)dbt; } Dbt(void *data, u_int32_t size); Dbt(); ~Dbt(); Dbt(const Dbt &); Dbt &operator = (const Dbt &); private: // Note: no extra data appears in this class (other than // inherited from DBT) since we need DBT and Dbt objects // to have interchangable pointers. // // When subclassing this class, remember that callback // methods like bt_compare, bt_prefix, dup_compare may // internally manufacture DBT objects (which later are // cast to Dbt), so such callbacks might receive objects // not of your subclassed type. }; //////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// // // multiple key/data/reco iterator classes // // DbMultipleIterator is a shared private base class for the three types // of bulk-return Iterator; it should never be instantiated directly, // but it handles the functionality shared by its subclasses. class _exported DbMultipleIterator { public: DbMultipleIterator(const Dbt &dbt); protected: u_int8_t *data_; u_int32_t *p_; }; class _exported DbMultipleKeyDataIterator : private DbMultipleIterator { public: DbMultipleKeyDataIterator(const Dbt &dbt) : DbMultipleIterator(dbt) {} bool next(Dbt &key, Dbt &data); }; class _exported DbMultipleRecnoDataIterator : private DbMultipleIterator { public: DbMultipleRecnoDataIterator(const Dbt &dbt) : DbMultipleIterator(dbt) {} bool next(db_recno_t &recno, Dbt &data); }; class _exported DbMultipleDataIterator : private DbMultipleIterator { public: DbMultipleDataIterator(const Dbt &dbt) : DbMultipleIterator(dbt) {} bool next(Dbt &data); }; //////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// // // Exception classes // // Almost any error in the DB library throws a DbException. // Every exception should be considered an abnormality // (e.g. bug, misuse of DB, file system error). // class _exported DbException : public __DB_STD(exception) { public: virtual ~DbException() throw(); DbException(int err); DbException(const char *description); DbException(const char *description, int err); DbException(const char *prefix, const char *description, int err); int get_errno() const; virtual const char *what() const throw(); DbEnv *get_env() const; void set_env(DbEnv *dbenv); DbException(const DbException &); DbException &operator = (const DbException &); private: void describe(const char *prefix, const char *description); char *what_; int err_; // errno DbEnv *dbenv_; }; // // A specific sort of exception that occurs when // an operation is aborted to resolve a deadlock. // class _exported DbDeadlockException : public DbException { public: virtual ~DbDeadlockException() throw(); DbDeadlockException(const char *description); DbDeadlockException(const DbDeadlockException &); DbDeadlockException &operator = (const DbDeadlockException &); }; // // A specific sort of exception that occurs when // a lock is not granted, e.g. by lock_get or lock_vec. // Note that the Dbt is only live as long as the Dbt used // in the offending call. // class _exported DbLockNotGrantedException : public DbException { public: virtual ~DbLockNotGrantedException() throw(); DbLockNotGrantedException(const char *prefix, db_lockop_t op, db_lockmode_t mode, const Dbt *obj, const DbLock lock, int index); DbLockNotGrantedException(const char *description); DbLockNotGrantedException(const DbLockNotGrantedException &); DbLockNotGrantedException &operator = (const DbLockNotGrantedException &); db_lockop_t get_op() const; db_lockmode_t get_mode() const; const Dbt* get_obj() const; DbLock *get_lock() const; int get_index() const; private: db_lockop_t op_; db_lockmode_t mode_; const Dbt *obj_; DbLock *lock_; int index_; }; // // A specific sort of exception that occurs when // user declared memory is insufficient in a Dbt. // class _exported DbMemoryException : public DbException { public: virtual ~DbMemoryException() throw(); DbMemoryException(Dbt *dbt); DbMemoryException(const char *prefix, Dbt *dbt); DbMemoryException(const DbMemoryException &); DbMemoryException &operator = (const DbMemoryException &); Dbt *get_dbt() const; private: Dbt *dbt_; }; // // A specific sort of exception that occurs when a change of replication // master requires that all handles be re-opened. // class _exported DbRepHandleDeadException : public DbException { public: virtual ~DbRepHandleDeadException() throw(); DbRepHandleDeadException(const char *description); DbRepHandleDeadException(const DbRepHandleDeadException &); DbRepHandleDeadException &operator = (const DbRepHandleDeadException &); }; // // A specific sort of exception that occurs when // recovery is required before continuing DB activity. // class _exported DbRunRecoveryException : public DbException { public: virtual ~DbRunRecoveryException() throw(); DbRunRecoveryException(const char *description); DbRunRecoveryException(const DbRunRecoveryException &); DbRunRecoveryException &operator = (const DbRunRecoveryException &); }; // // A specific sort of exception that occurs when //////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// // // Restore default compiler warnings // #ifdef _MSC_VER #pragma warning(pop) #endif #endif /* !_DB_CXX_H_ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������db4.7.25/db_185.h�����������������������������������������������������������������������������������0000644�����������������00000013572�14763166026�0006765 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*- * See the file LICENSE for redistribution information. * * Copyright (c) 1996,2008 Oracle. All rights reserved. */ /* * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $Id: db_185.in,v 12.8 2008/01/08 20:58:17 bostic Exp $ */ #ifndef _DB_185_H_ #define _DB_185_H_ #include <sys/types.h> #include <limits.h> #if defined(__cplusplus) extern "C" { #endif /* * XXX * Handle function prototypes and the keyword "const". This steps on name * space that DB doesn't control, but all of the other solutions are worse. */ #undef __P #if defined(__STDC__) || defined(__cplusplus) #define __P(protos) protos /* ANSI C prototypes */ #else #define const #define __P(protos) () /* K&R C preprocessor */ #endif #define RET_ERROR -1 /* Return values. */ #define RET_SUCCESS 0 #define RET_SPECIAL 1 #ifndef __BIT_TYPES_DEFINED__ #define __BIT_TYPES_DEFINED__ #endif /* * XXX * SGI/IRIX already has a pgno_t. */ #ifdef __sgi #define pgno_t db_pgno_t #endif #define MAX_PAGE_NUMBER 0xffffffff /* >= # of pages in a file */ typedef u_int32_t pgno_t; #define MAX_PAGE_OFFSET 65535 /* >= # of bytes in a page */ typedef u_int16_t indx_t; #define MAX_REC_NUMBER 0xffffffff /* >= # of records in a tree */ typedef u_int32_t recno_t; /* Key/data structure -- a Data-Base Thang. */ typedef struct { void *data; /* data */ size_t size; /* data length */ } DBT; /* Routine flags. */ #define R_CURSOR 1 /* del, put, seq */ #define __R_UNUSED 2 /* UNUSED */ #define R_FIRST 3 /* seq */ #define R_IAFTER 4 /* put (RECNO) */ #define R_IBEFORE 5 /* put (RECNO) */ #define R_LAST 6 /* seq (BTREE, RECNO) */ #define R_NEXT 7 /* seq */ #define R_NOOVERWRITE 8 /* put */ #define R_PREV 9 /* seq (BTREE, RECNO) */ #define R_SETCURSOR 10 /* put (RECNO) */ #define R_RECNOSYNC 11 /* sync (RECNO) */ typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE; /* Access method description structure. */ typedef struct __db { DBTYPE type; /* Underlying db type. */ int (*close) __P((struct __db *)); int (*del) __P((const struct __db *, const DBT *, u_int)); int (*get) __P((const struct __db *, const DBT *, DBT *, u_int)); int (*put) __P((const struct __db *, DBT *, const DBT *, u_int)); int (*seq) __P((const struct __db *, DBT *, DBT *, u_int)); int (*sync) __P((const struct __db *, u_int)); void *internal; /* Access method private. */ int (*fd) __P((const struct __db *)); } DB; #define BTREEMAGIC 0x053162 #define BTREEVERSION 3 /* Structure used to pass parameters to the btree routines. */ typedef struct { #define R_DUP 0x01 /* duplicate keys */ u_int32_t flags; u_int32_t cachesize; /* bytes to cache */ u_int32_t maxkeypage; /* maximum keys per page */ u_int32_t minkeypage; /* minimum keys per page */ u_int32_t psize; /* page size */ int (*compare) /* comparison function */ __P((const DBT *, const DBT *)); size_t (*prefix) /* prefix function */ __P((const DBT *, const DBT *)); int lorder; /* byte order */ } BTREEINFO; #define HASHMAGIC 0x061561 #define HASHVERSION 2 /* Structure used to pass parameters to the hashing routines. */ typedef struct { u_int32_t bsize; /* bucket size */ u_int32_t ffactor; /* fill factor */ u_int32_t nelem; /* number of elements */ u_int32_t cachesize; /* bytes to cache */ u_int32_t /* hash function */ (*hash) __P((const void *, size_t)); int lorder; /* byte order */ } HASHINFO; /* Structure used to pass parameters to the record routines. */ typedef struct { #define R_FIXEDLEN 0x01 /* fixed-length records */ #define R_NOKEY 0x02 /* key not required */ #define R_SNAPSHOT 0x04 /* snapshot the input */ u_int32_t flags; u_int32_t cachesize; /* bytes to cache */ u_int32_t psize; /* page size */ int lorder; /* byte order */ size_t reclen; /* record length (fixed-length records) */ u_char bval; /* delimiting byte (variable-length records */ char *bfname; /* btree file name */ } RECNOINFO; /* Re-define the user's dbopen calls. */ #define dbopen __db185_open #if defined(__cplusplus) } #endif #endif /* !_DB_185_H_ */ /* DO NOT EDIT: automatically built by dist/s_include. */ #ifndef _DB_EXT_185_PROT_IN_ #define _DB_EXT_185_PROT_IN_ #if defined(__cplusplus) extern "C" { #endif #ifdef _DB185_INT_H_ DB185 *__db185_open __P((const char *, int, int, DBTYPE, const void *)); #else DB *__db185_open __P((const char *, int, int, DBTYPE, const void *)); #endif #if defined(__cplusplus) } #endif #endif /* !_DB_EXT_185_PROT_IN_ */ ��������������������������������������������������������������������������������������������������������������������������������������ecpg_config_x86_64.h��������������������������������������������������������������������������������0000644�����������������00000001312�14763166026�0010206 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/interfaces/ecpg/include/ecpg_config.h. Generated from ecpg_config.h.in by configure. */ /* Define to 1 if the system has the type `int64'. */ /* #undef HAVE_INT64 */ /* Define to 1 if `long int' works and is 64 bits. */ #define HAVE_LONG_INT_64 1 /* Define to 1 if the system has the type `long long int'. */ #define HAVE_LONG_LONG_INT 1 /* Define to 1 if `long long int' works and is 64 bits. */ /* #undef HAVE_LONG_LONG_INT_64 */ /* Define to 1 if you want 64-bit integer timestamp and interval support. (--enable-integer-datetimes) */ #define USE_INTEGER_DATETIMES 1 /* Define to 1 to build client libraries as thread-safe code. * (--enable-thread-safety) */ #define ENABLE_THREAD_SAFETY 1 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xen/privcmd.h���������������������������������������������������������������������������������������0000644�����������������00000010156�14763166026�0007171 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR MIT) */ /****************************************************************************** * privcmd.h * * Interface to /proc/xen/privcmd. * * Copyright (c) 2003-2005, K A Fraser * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation; or, when distributed * separately from the Linux kernel or incorporated into other * software packages, subject to the following license: * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this source file (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, modify, * merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef __LINUX_PUBLIC_PRIVCMD_H__ #define __LINUX_PUBLIC_PRIVCMD_H__ #include <linux/types.h> #include <xen/interface/xen.h> struct privcmd_hypercall { __u64 op; __u64 arg[5]; }; struct privcmd_mmap_entry { __u64 va; /* * This should be a GFN. It's not possible to change the name because * it's exposed to the user-space. */ __u64 mfn; __u64 npages; }; struct privcmd_mmap { int num; domid_t dom; /* target domain */ struct privcmd_mmap_entry *entry; }; struct privcmd_mmapbatch { int num; /* number of pages to populate */ domid_t dom; /* target domain */ __u64 addr; /* virtual address */ xen_pfn_t *arr; /* array of mfns - or'd with PRIVCMD_MMAPBATCH_*_ERROR on err */ }; #define PRIVCMD_MMAPBATCH_MFN_ERROR 0xf0000000U #define PRIVCMD_MMAPBATCH_PAGED_ERROR 0x80000000U struct privcmd_mmapbatch_v2 { unsigned int num; /* number of pages to populate */ domid_t dom; /* target domain */ __u64 addr; /* virtual address */ const xen_pfn_t *arr; /* array of mfns */ int *err; /* array of error codes */ }; struct privcmd_dm_op_buf { void *uptr; size_t size; }; struct privcmd_dm_op { domid_t dom; __u16 num; const struct privcmd_dm_op_buf *ubufs; }; struct privcmd_mmap_resource { domid_t dom; __u32 type; __u32 id; __u32 idx; __u64 num; __u64 addr; }; /* * @cmd: IOCTL_PRIVCMD_HYPERCALL * @arg: &privcmd_hypercall_t * Return: Value returned from execution of the specified hypercall. * * @cmd: IOCTL_PRIVCMD_MMAPBATCH_V2 * @arg: &struct privcmd_mmapbatch_v2 * Return: 0 on success (i.e., arg->err contains valid error codes for * each frame). On an error other than a failed frame remap, -1 is * returned and errno is set to EINVAL, EFAULT etc. As an exception, * if the operation was otherwise successful but any frame failed with * -ENOENT, then -1 is returned and errno is set to ENOENT. */ #define IOCTL_PRIVCMD_HYPERCALL \ _IOC(_IOC_NONE, 'P', 0, sizeof(struct privcmd_hypercall)) #define IOCTL_PRIVCMD_MMAP \ _IOC(_IOC_NONE, 'P', 2, sizeof(struct privcmd_mmap)) #define IOCTL_PRIVCMD_MMAPBATCH \ _IOC(_IOC_NONE, 'P', 3, sizeof(struct privcmd_mmapbatch)) #define IOCTL_PRIVCMD_MMAPBATCH_V2 \ _IOC(_IOC_NONE, 'P', 4, sizeof(struct privcmd_mmapbatch_v2)) #define IOCTL_PRIVCMD_DM_OP \ _IOC(_IOC_NONE, 'P', 5, sizeof(struct privcmd_dm_op)) #define IOCTL_PRIVCMD_RESTRICT \ _IOC(_IOC_NONE, 'P', 6, sizeof(domid_t)) #define IOCTL_PRIVCMD_MMAP_RESOURCE \ _IOC(_IOC_NONE, 'P', 7, sizeof(struct privcmd_mmap_resource)) #endif /* __LINUX_PUBLIC_PRIVCMD_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xen/evtchn.h����������������������������������������������������������������������������������������0000644�����������������00000006741�14763166026�0007021 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR MIT) */ /****************************************************************************** * evtchn.h * * Interface to /dev/xen/evtchn. * * Copyright (c) 2003-2005, K A Fraser * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation; or, when distributed * separately from the Linux kernel or incorporated into other * software packages, subject to the following license: * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this source file (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, modify, * merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef __LINUX_PUBLIC_EVTCHN_H__ #define __LINUX_PUBLIC_EVTCHN_H__ /* * Bind a fresh port to VIRQ @virq. * Return allocated port. */ #define IOCTL_EVTCHN_BIND_VIRQ \ _IOC(_IOC_NONE, 'E', 0, sizeof(struct ioctl_evtchn_bind_virq)) struct ioctl_evtchn_bind_virq { unsigned int virq; }; /* * Bind a fresh port to remote <@remote_domain, @remote_port>. * Return allocated port. */ #define IOCTL_EVTCHN_BIND_INTERDOMAIN \ _IOC(_IOC_NONE, 'E', 1, sizeof(struct ioctl_evtchn_bind_interdomain)) struct ioctl_evtchn_bind_interdomain { unsigned int remote_domain, remote_port; }; /* * Allocate a fresh port for binding to @remote_domain. * Return allocated port. */ #define IOCTL_EVTCHN_BIND_UNBOUND_PORT \ _IOC(_IOC_NONE, 'E', 2, sizeof(struct ioctl_evtchn_bind_unbound_port)) struct ioctl_evtchn_bind_unbound_port { unsigned int remote_domain; }; /* * Unbind previously allocated @port. */ #define IOCTL_EVTCHN_UNBIND \ _IOC(_IOC_NONE, 'E', 3, sizeof(struct ioctl_evtchn_unbind)) struct ioctl_evtchn_unbind { unsigned int port; }; /* * Unbind previously allocated @port. */ #define IOCTL_EVTCHN_NOTIFY \ _IOC(_IOC_NONE, 'E', 4, sizeof(struct ioctl_evtchn_notify)) struct ioctl_evtchn_notify { unsigned int port; }; /* Clear and reinitialise the event buffer. Clear error condition. */ #define IOCTL_EVTCHN_RESET \ _IOC(_IOC_NONE, 'E', 5, 0) /* * Restrict this file descriptor so that it can only be used to bind * new interdomain events from one domain. * * Once a file descriptor has been restricted it cannot be * de-restricted, and must be closed and re-opened. Event channels * which were bound before restricting remain bound afterwards, and * can be notified as usual. */ #define IOCTL_EVTCHN_RESTRICT_DOMID \ _IOC(_IOC_NONE, 'E', 6, sizeof(struct ioctl_evtchn_restrict_domid)) struct ioctl_evtchn_restrict_domid { domid_t domid; }; #endif /* __LINUX_PUBLIC_EVTCHN_H__ */ �������������������������������xen/gntdev.h����������������������������������������������������������������������������������������0000644�����������������00000024627�14763166026�0007024 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR MIT) */ /****************************************************************************** * gntdev.h * * Interface to /dev/xen/gntdev. * * Copyright (c) 2007, D G Murray * Copyright (c) 2018, Oleksandr Andrushchenko, EPAM Systems Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation; or, when distributed * separately from the Linux kernel or incorporated into other * software packages, subject to the following license: * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this source file (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, modify, * merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef __LINUX_PUBLIC_GNTDEV_H__ #define __LINUX_PUBLIC_GNTDEV_H__ #include <linux/types.h> struct ioctl_gntdev_grant_ref { /* The domain ID of the grant to be mapped. */ __u32 domid; /* The grant reference of the grant to be mapped. */ __u32 ref; }; /* * Inserts the grant references into the mapping table of an instance * of gntdev. N.B. This does not perform the mapping, which is deferred * until mmap() is called with @index as the offset. */ #define IOCTL_GNTDEV_MAP_GRANT_REF \ _IOC(_IOC_NONE, 'G', 0, sizeof(struct ioctl_gntdev_map_grant_ref)) struct ioctl_gntdev_map_grant_ref { /* IN parameters */ /* The number of grants to be mapped. */ __u32 count; __u32 pad; /* OUT parameters */ /* The offset to be used on a subsequent call to mmap(). */ __u64 index; /* Variable IN parameter. */ /* Array of grant references, of size @count. */ struct ioctl_gntdev_grant_ref refs[1]; }; /* * Removes the grant references from the mapping table of an instance of * of gntdev. N.B. munmap() must be called on the relevant virtual address(es) * before this ioctl is called, or an error will result. */ #define IOCTL_GNTDEV_UNMAP_GRANT_REF \ _IOC(_IOC_NONE, 'G', 1, sizeof(struct ioctl_gntdev_unmap_grant_ref)) struct ioctl_gntdev_unmap_grant_ref { /* IN parameters */ /* The offset was returned by the corresponding map operation. */ __u64 index; /* The number of pages to be unmapped. */ __u32 count; __u32 pad; }; /* * Returns the offset in the driver's address space that corresponds * to @vaddr. This can be used to perform a munmap(), followed by an * UNMAP_GRANT_REF ioctl, where no state about the offset is retained by * the caller. The number of pages that were allocated at the same time as * @vaddr is returned in @count. * * N.B. Where more than one page has been mapped into a contiguous range, the * supplied @vaddr must correspond to the start of the range; otherwise * an error will result. It is only possible to munmap() the entire * contiguously-allocated range at once, and not any subrange thereof. */ #define IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR \ _IOC(_IOC_NONE, 'G', 2, sizeof(struct ioctl_gntdev_get_offset_for_vaddr)) struct ioctl_gntdev_get_offset_for_vaddr { /* IN parameters */ /* The virtual address of the first mapped page in a range. */ __u64 vaddr; /* OUT parameters */ /* The offset that was used in the initial mmap() operation. */ __u64 offset; /* The number of pages mapped in the VM area that begins at @vaddr. */ __u32 count; __u32 pad; }; /* * Sets the maximum number of grants that may mapped at once by this gntdev * instance. * * N.B. This must be called before any other ioctl is performed on the device. */ #define IOCTL_GNTDEV_SET_MAX_GRANTS \ _IOC(_IOC_NONE, 'G', 3, sizeof(struct ioctl_gntdev_set_max_grants)) struct ioctl_gntdev_set_max_grants { /* IN parameter */ /* The maximum number of grants that may be mapped at once. */ __u32 count; }; /* * Sets up an unmap notification within the page, so that the other side can do * cleanup if this side crashes. Required to implement cross-domain robust * mutexes or close notification on communication channels. * * Each mapped page only supports one notification; multiple calls referring to * the same page overwrite the previous notification. You must clear the * notification prior to the IOCTL_GNTALLOC_DEALLOC_GREF if you do not want it * to occur. */ #define IOCTL_GNTDEV_SET_UNMAP_NOTIFY \ _IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntdev_unmap_notify)) struct ioctl_gntdev_unmap_notify { /* IN parameters */ /* Offset in the file descriptor for a byte within the page (same as * used in mmap). If using UNMAP_NOTIFY_CLEAR_BYTE, this is the byte to * be cleared. Otherwise, it can be any byte in the page whose * notification we are adjusting. */ __u64 index; /* Action(s) to take on unmap */ __u32 action; /* Event channel to notify */ __u32 event_channel_port; }; struct gntdev_grant_copy_segment { union { void *virt; struct { grant_ref_t ref; __u16 offset; domid_t domid; } foreign; } source, dest; __u16 len; __u16 flags; /* GNTCOPY_* */ __s16 status; /* GNTST_* */ }; /* * Copy between grant references and local buffers. * * The copy is split into @count @segments, each of which can copy * to/from one grant reference. * * Each segment is similar to struct gnttab_copy in the hypervisor ABI * except the local buffer is specified using a virtual address * (instead of a GFN and offset). * * The local buffer may cross a Xen page boundary -- the driver will * split segments into multiple ops if required. * * Returns 0 if all segments have been processed and @status in each * segment is valid. Note that one or more segments may have failed * (status != GNTST_okay). * * If the driver had to split a segment into two or more ops, @status * includes the status of the first failed op for that segment (or * GNTST_okay if all ops were successful). * * If -1 is returned, the status of all segments is undefined. * * EINVAL: A segment has local buffers for both source and * destination. * EINVAL: A segment crosses the boundary of a foreign page. * EFAULT: A segment's local buffer is not accessible. */ #define IOCTL_GNTDEV_GRANT_COPY \ _IOC(_IOC_NONE, 'G', 8, sizeof(struct ioctl_gntdev_grant_copy)) struct ioctl_gntdev_grant_copy { unsigned int count; struct gntdev_grant_copy_segment *segments; }; /* Clear (set to zero) the byte specified by index */ #define UNMAP_NOTIFY_CLEAR_BYTE 0x1 /* Send an interrupt on the indicated event channel */ #define UNMAP_NOTIFY_SEND_EVENT 0x2 /* * Flags to be used while requesting memory mapping's backing storage * to be allocated with DMA API. */ /* * The buffer is backed with memory allocated with dma_alloc_wc. */ #define GNTDEV_DMA_FLAG_WC (1 << 0) /* * The buffer is backed with memory allocated with dma_alloc_coherent. */ #define GNTDEV_DMA_FLAG_COHERENT (1 << 1) /* * Create a dma-buf [1] from grant references @refs of count @count provided * by the foreign domain @domid with flags @flags. * * By default dma-buf is backed by system memory pages, but by providing * one of the GNTDEV_DMA_FLAG_XXX flags it can also be created as * a DMA write-combine or coherent buffer, e.g. allocated with dma_alloc_wc/ * dma_alloc_coherent. * * Returns 0 if dma-buf was successfully created and the corresponding * dma-buf's file descriptor is returned in @fd. * * [1] Documentation/driver-api/dma-buf.rst */ #define IOCTL_GNTDEV_DMABUF_EXP_FROM_REFS \ _IOC(_IOC_NONE, 'G', 9, \ sizeof(struct ioctl_gntdev_dmabuf_exp_from_refs)) struct ioctl_gntdev_dmabuf_exp_from_refs { /* IN parameters. */ /* Specific options for this dma-buf: see GNTDEV_DMA_FLAG_XXX. */ __u32 flags; /* Number of grant references in @refs array. */ __u32 count; /* OUT parameters. */ /* File descriptor of the dma-buf. */ __u32 fd; /* The domain ID of the grant references to be mapped. */ __u32 domid; /* Variable IN parameter. */ /* Array of grant references of size @count. */ __u32 refs[1]; }; /* * This will block until the dma-buf with the file descriptor @fd is * released. This is only valid for buffers created with * IOCTL_GNTDEV_DMABUF_EXP_FROM_REFS. * * If within @wait_to_ms milliseconds the buffer is not released * then -ETIMEDOUT error is returned. * If the buffer with the file descriptor @fd does not exist or has already * been released, then -ENOENT is returned. For valid file descriptors * this must not be treated as error. */ #define IOCTL_GNTDEV_DMABUF_EXP_WAIT_RELEASED \ _IOC(_IOC_NONE, 'G', 10, \ sizeof(struct ioctl_gntdev_dmabuf_exp_wait_released)) struct ioctl_gntdev_dmabuf_exp_wait_released { /* IN parameters */ __u32 fd; __u32 wait_to_ms; }; /* * Import a dma-buf with file descriptor @fd and export granted references * to the pages of that dma-buf into array @refs of size @count. */ #define IOCTL_GNTDEV_DMABUF_IMP_TO_REFS \ _IOC(_IOC_NONE, 'G', 11, \ sizeof(struct ioctl_gntdev_dmabuf_imp_to_refs)) struct ioctl_gntdev_dmabuf_imp_to_refs { /* IN parameters. */ /* File descriptor of the dma-buf. */ __u32 fd; /* Number of grant references in @refs array. */ __u32 count; /* The domain ID for which references to be granted. */ __u32 domid; /* Reserved - must be zero. */ __u32 reserved; /* OUT parameters. */ /* Array of grant references of size @count. */ __u32 refs[1]; }; /* * This will close all references to the imported buffer with file descriptor * @fd, so it can be released by the owner. This is only valid for buffers * created with IOCTL_GNTDEV_DMABUF_IMP_TO_REFS. */ #define IOCTL_GNTDEV_DMABUF_IMP_RELEASE \ _IOC(_IOC_NONE, 'G', 12, \ sizeof(struct ioctl_gntdev_dmabuf_imp_release)) struct ioctl_gntdev_dmabuf_imp_release { /* IN parameters */ __u32 fd; __u32 reserved; }; #endif /* __LINUX_PUBLIC_GNTDEV_H__ */ ���������������������������������������������������������������������������������������������������������xen/gntalloc.h��������������������������������������������������������������������������������������0000644�����������������00000005073�14763166026�0007332 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/****************************************************************************** * gntalloc.h * * Interface to /dev/xen/gntalloc. * * Author: Daniel De Graaf <dgdegra@tycho.nsa.gov> * * This file is in the public domain. */ #ifndef __LINUX_PUBLIC_GNTALLOC_H__ #define __LINUX_PUBLIC_GNTALLOC_H__ #include <linux/types.h> /* * Allocates a new page and creates a new grant reference. */ #define IOCTL_GNTALLOC_ALLOC_GREF \ _IOC(_IOC_NONE, 'G', 5, sizeof(struct ioctl_gntalloc_alloc_gref)) struct ioctl_gntalloc_alloc_gref { /* IN parameters */ /* The ID of the domain to be given access to the grants. */ __u16 domid; /* Flags for this mapping */ __u16 flags; /* Number of pages to map */ __u32 count; /* OUT parameters */ /* The offset to be used on a subsequent call to mmap(). */ __u64 index; /* The grant references of the newly created grant, one per page */ /* Variable size, depending on count */ __u32 gref_ids[1]; }; #define GNTALLOC_FLAG_WRITABLE 1 /* * Deallocates the grant reference, allowing the associated page to be freed if * no other domains are using it. */ #define IOCTL_GNTALLOC_DEALLOC_GREF \ _IOC(_IOC_NONE, 'G', 6, sizeof(struct ioctl_gntalloc_dealloc_gref)) struct ioctl_gntalloc_dealloc_gref { /* IN parameters */ /* The offset returned in the map operation */ __u64 index; /* Number of references to unmap */ __u32 count; }; /* * Sets up an unmap notification within the page, so that the other side can do * cleanup if this side crashes. Required to implement cross-domain robust * mutexes or close notification on communication channels. * * Each mapped page only supports one notification; multiple calls referring to * the same page overwrite the previous notification. You must clear the * notification prior to the IOCTL_GNTALLOC_DEALLOC_GREF if you do not want it * to occur. */ #define IOCTL_GNTALLOC_SET_UNMAP_NOTIFY \ _IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntalloc_unmap_notify)) struct ioctl_gntalloc_unmap_notify { /* IN parameters */ /* Offset in the file descriptor for a byte within the page (same as * used in mmap). If using UNMAP_NOTIFY_CLEAR_BYTE, this is the byte to * be cleared. Otherwise, it can be any byte in the page whose * notification we are adjusting. */ __u64 index; /* Action(s) to take on unmap */ __u32 action; /* Event channel to notify */ __u32 event_channel_port; }; /* Clear (set to zero) the byte specified by index */ #define UNMAP_NOTIFY_CLEAR_BYTE 0x1 /* Send an interrupt on the indicated event channel */ #define UNMAP_NOTIFY_SEND_EVENT 0x2 #endif /* __LINUX_PUBLIC_GNTALLOC_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/fsuid.h�����������������������������������������������������������������������������������������0000644�����������������00000002260�14763166026�0006660 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_FSUID_H #define _SYS_FSUID_H 1 #include <features.h> #include <sys/types.h> __BEGIN_DECLS /* Change uid used for file access control to UID, without affecting other privileges (such as who can send signals at the process). */ extern int setfsuid (__uid_t __uid) __THROW __wur; /* Ditto for group id. */ extern int setfsgid (__gid_t __gid) __THROW __wur; __END_DECLS #endif /* fsuid.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/ioctl.h�����������������������������������������������������������������������������������������0000644�����������������00000003336�14763166026�0006665 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991, 92, 93, 94, 96, 98, 99 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_IOCTL_H #define _SYS_IOCTL_H 1 #include <features.h> __BEGIN_DECLS /* Get the list of `ioctl' requests and related constants. */ #include <bits/ioctls.h> /* Define some types used by `ioctl' requests. */ #include <bits/ioctl-types.h> /* On a Unix system, the system <sys/ioctl.h> probably defines some of the symbols we define in <sys/ttydefaults.h> (usually with the same values). The code to generate <bits/ioctls.h> has omitted these symbols to avoid the conflict, but a Unix program expects <sys/ioctl.h> to define them, so we must include <sys/ttydefaults.h> here. */ #include <sys/ttydefaults.h> /* Perform the I/O control operation specified by REQUEST on FD. One argument may follow; its presence and type depend on REQUEST. Return value depends on REQUEST. Usually -1 indicates error. */ extern int ioctl (int __fd, unsigned long int __request, ...) __THROW; __END_DECLS #endif /* sys/ioctl.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/prctl.h�����������������������������������������������������������������������������������������0000644�����������������00000002043�14763166026�0006671 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_PRCTL_H #define _SYS_PRCTL_H 1 #include <features.h> #include <linux/prctl.h> /* The magic values come from here */ __BEGIN_DECLS /* Control process execution. */ extern int prctl (int __option, ...) __THROW; __END_DECLS #endif /* sys/prctl.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/reg.h�������������������������������������������������������������������������������������������0000644�����������������00000003442�14763166026�0006326 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2001-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_REG_H #define _SYS_REG_H 1 #ifdef __x86_64__ /* Index into an array of 8 byte longs returned from ptrace for location of the users' stored general purpose registers. */ # define R15 0 # define R14 1 # define R13 2 # define R12 3 # define RBP 4 # define RBX 5 # define R11 6 # define R10 7 # define R9 8 # define R8 9 # define RAX 10 # define RCX 11 # define RDX 12 # define RSI 13 # define RDI 14 # define ORIG_RAX 15 # define RIP 16 # define CS 17 # define EFLAGS 18 # define RSP 19 # define SS 20 # define FS_BASE 21 # define GS_BASE 22 # define DS 23 # define ES 24 # define FS 25 # define GS 26 #else /* Index into an array of 4 byte integers returned from ptrace for * location of the users' stored general purpose registers. */ # define EBX 0 # define ECX 1 # define EDX 2 # define ESI 3 # define EDI 4 # define EBP 5 # define EAX 6 # define DS 7 # define ES 8 # define FS 9 # define GS 10 # define ORIG_EAX 11 # define EIP 12 # define CS 13 # define EFL 14 # define UESP 15 # define SS 16 #endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/types.h�����������������������������������������������������������������������������������������0000644�����������������00000015163�14763166026�0006720 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991,1992,1994-2002,2006,2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 2.6 Primitive System Data Types <sys/types.h> */ #ifndef _SYS_TYPES_H #define _SYS_TYPES_H 1 #include <features.h> __BEGIN_DECLS #include <bits/types.h> #ifdef __USE_BSD # ifndef __u_char_defined typedef __u_char u_char; typedef __u_short u_short; typedef __u_int u_int; typedef __u_long u_long; typedef __quad_t quad_t; typedef __u_quad_t u_quad_t; typedef __fsid_t fsid_t; # define __u_char_defined # endif #endif typedef __loff_t loff_t; #ifndef __ino_t_defined # ifndef __USE_FILE_OFFSET64 typedef __ino_t ino_t; # else typedef __ino64_t ino_t; # endif # define __ino_t_defined #endif #if defined __USE_LARGEFILE64 && !defined __ino64_t_defined typedef __ino64_t ino64_t; # define __ino64_t_defined #endif #ifndef __dev_t_defined typedef __dev_t dev_t; # define __dev_t_defined #endif #ifndef __gid_t_defined typedef __gid_t gid_t; # define __gid_t_defined #endif #ifndef __mode_t_defined typedef __mode_t mode_t; # define __mode_t_defined #endif #ifndef __nlink_t_defined typedef __nlink_t nlink_t; # define __nlink_t_defined #endif #ifndef __uid_t_defined typedef __uid_t uid_t; # define __uid_t_defined #endif #ifndef __off_t_defined # ifndef __USE_FILE_OFFSET64 typedef __off_t off_t; # else typedef __off64_t off_t; # endif # define __off_t_defined #endif #if defined __USE_LARGEFILE64 && !defined __off64_t_defined typedef __off64_t off64_t; # define __off64_t_defined #endif #ifndef __pid_t_defined typedef __pid_t pid_t; # define __pid_t_defined #endif #if (defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8) \ && !defined __id_t_defined typedef __id_t id_t; # define __id_t_defined #endif #ifndef __ssize_t_defined typedef __ssize_t ssize_t; # define __ssize_t_defined #endif #ifdef __USE_BSD # ifndef __daddr_t_defined typedef __daddr_t daddr_t; typedef __caddr_t caddr_t; # define __daddr_t_defined # endif #endif #if (defined __USE_SVID || defined __USE_XOPEN) && !defined __key_t_defined typedef __key_t key_t; # define __key_t_defined #endif #if defined __USE_XOPEN || defined __USE_XOPEN2K8 # define __need_clock_t #endif #define __need_time_t #define __need_timer_t #define __need_clockid_t #include <time.h> #ifdef __USE_XOPEN # ifndef __useconds_t_defined typedef __useconds_t useconds_t; # define __useconds_t_defined # endif # ifndef __suseconds_t_defined typedef __suseconds_t suseconds_t; # define __suseconds_t_defined # endif #endif #define __need_size_t #include <stddef.h> #ifdef __USE_MISC /* Old compatibility names for C types. */ typedef unsigned long int ulong; typedef unsigned short int ushort; typedef unsigned int uint; #endif /* These size-specific names are used by some of the inet code. */ #if !__GNUC_PREREQ (2, 7) /* These types are defined by the ISO C99 header <inttypes.h>. */ # ifndef __int8_t_defined # define __int8_t_defined typedef char int8_t; typedef short int int16_t; typedef int int32_t; # if __WORDSIZE == 64 typedef long int int64_t; # elif __GLIBC_HAVE_LONG_LONG __extension__ typedef long long int int64_t; # endif # endif /* But these were defined by ISO C without the first `_'. */ typedef unsigned char u_int8_t; typedef unsigned short int u_int16_t; typedef unsigned int u_int32_t; # if __WORDSIZE == 64 typedef unsigned long int u_int64_t; # elif __GLIBC_HAVE_LONG_LONG __extension__ typedef unsigned long long int u_int64_t; # endif typedef int register_t; #else /* For GCC 2.7 and later, we can use specific type-size attributes. */ # define __intN_t(N, MODE) \ typedef int int##N##_t __attribute__ ((__mode__ (MODE))) # define __u_intN_t(N, MODE) \ typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE))) # ifndef __int8_t_defined # define __int8_t_defined __intN_t (8, __QI__); __intN_t (16, __HI__); __intN_t (32, __SI__); __intN_t (64, __DI__); # endif __u_intN_t (8, __QI__); __u_intN_t (16, __HI__); __u_intN_t (32, __SI__); __u_intN_t (64, __DI__); typedef int register_t __attribute__ ((__mode__ (__word__))); /* Some code from BIND tests this macro to see if the types above are defined. */ #endif #define __BIT_TYPES_DEFINED__ 1 #ifdef __USE_BSD /* In BSD <sys/types.h> is expected to define BYTE_ORDER. */ # include <endian.h> /* It also defines `fd_set' and the FD_* macros for `select'. */ # include <sys/select.h> /* BSD defines these symbols, so we follow. */ # include <sys/sysmacros.h> #endif /* Use BSD. */ #if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) \ && !defined __blksize_t_defined typedef __blksize_t blksize_t; # define __blksize_t_defined #endif /* Types from the Large File Support interface. */ #ifndef __USE_FILE_OFFSET64 # ifndef __blkcnt_t_defined typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */ # define __blkcnt_t_defined # endif # ifndef __fsblkcnt_t_defined typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */ # define __fsblkcnt_t_defined # endif # ifndef __fsfilcnt_t_defined typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */ # define __fsfilcnt_t_defined # endif #else # ifndef __blkcnt_t_defined typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */ # define __blkcnt_t_defined # endif # ifndef __fsblkcnt_t_defined typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */ # define __fsblkcnt_t_defined # endif # ifndef __fsfilcnt_t_defined typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */ # define __fsfilcnt_t_defined # endif #endif #ifdef __USE_LARGEFILE64 typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */ typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */ typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */ #endif /* Now add the thread types. */ #if defined __USE_POSIX199506 || defined __USE_UNIX98 # include <bits/pthreadtypes.h> #endif __END_DECLS #endif /* sys/types.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/vfs.h�������������������������������������������������������������������������������������������0000644�����������������00000000241�14763166026�0006341 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Other systems declare `struct statfs' et al in <sys/vfs.h>, so we have this file to be compatible with programs expecting it. */ #include <sys/statfs.h> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/cdefs.h�����������������������������������������������������������������������������������������0000644�����������������00000034622�14763166026�0006641 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1992-2002, 2004, 2005, 2006, 2007, 2009, 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_CDEFS_H #define _SYS_CDEFS_H 1 /* We are almost always included from features.h. */ #ifndef _FEATURES_H # include <features.h> #endif /* The GNU libc does not support any K&R compilers or the traditional mode of ISO C compilers anymore. Check for some of the combinations not anymore supported. */ #if defined __GNUC__ && !defined __STDC__ # error "You need a ISO C conforming compiler to use the glibc headers" #endif /* Some user header file might have defined this before. */ #undef __P #undef __PMT #ifdef __GNUC__ /* All functions, except those with callbacks or those that synchronize memory, are leaf functions. */ # if __GNUC_PREREQ (4, 6) && !defined _LIBC # define __LEAF , __leaf__ # define __LEAF_ATTR __attribute__ ((__leaf__)) # else # define __LEAF # define __LEAF_ATTR # endif /* GCC can always grok prototypes. For C++ programs we add throw() to help it optimize the function calls. But this works only with gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions as non-throwing using a function attribute since programs can use the -fexceptions options for C code as well. */ # if !defined __cplusplus && __GNUC_PREREQ (3, 3) # define __THROW __attribute__ ((__nothrow__ __LEAF)) # define __THROWNL __attribute__ ((__nothrow__)) # define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct # else # if defined __cplusplus && __GNUC_PREREQ (2,8) # define __THROW throw () # define __THROWNL throw () # define __NTH(fct) __LEAF_ATTR fct throw () # else # define __THROW # define __THROWNL # define __NTH(fct) fct # endif # endif #else /* Not GCC. */ # define __inline /* No inline functions. */ # define __THROW # define __THROWNL # define __NTH(fct) fct #endif /* GCC. */ /* These two macros are not used in glibc anymore. They are kept here only because some other projects expect the macros to be defined. */ #define __P(args) args #define __PMT(args) args /* For these things, GCC behaves the ANSI way normally, and the non-ANSI way under -traditional. */ #define __CONCAT(x,y) x ## y #define __STRING(x) #x /* This is not a typedef so `const __ptr_t' does the right thing. */ #define __ptr_t void * #define __long_double_t long double /* C++ needs to know that types and declarations are C, not C++. */ #ifdef __cplusplus # define __BEGIN_DECLS extern "C" { # define __END_DECLS } #else # define __BEGIN_DECLS # define __END_DECLS #endif /* The standard library needs the functions from the ISO C90 standard in the std namespace. At the same time we want to be safe for future changes and we include the ISO C99 code in the non-standard namespace __c99. The C++ wrapper header take case of adding the definitions to the global namespace. */ #if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES # define __BEGIN_NAMESPACE_STD namespace std { # define __END_NAMESPACE_STD } # define __USING_NAMESPACE_STD(name) using std::name; # define __BEGIN_NAMESPACE_C99 namespace __c99 { # define __END_NAMESPACE_C99 } # define __USING_NAMESPACE_C99(name) using __c99::name; #else /* For compatibility we do not add the declarations into any namespace. They will end up in the global namespace which is what old code expects. */ # define __BEGIN_NAMESPACE_STD # define __END_NAMESPACE_STD # define __USING_NAMESPACE_STD(name) # define __BEGIN_NAMESPACE_C99 # define __END_NAMESPACE_C99 # define __USING_NAMESPACE_C99(name) #endif /* Support for bounded pointers. */ #ifndef __BOUNDED_POINTERS__ # define __bounded /* nothing */ # define __unbounded /* nothing */ # define __ptrvalue /* nothing */ #endif /* Fortify support. */ #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) #define __bos0(ptr) __builtin_object_size (ptr, 0) #if __GNUC_PREREQ (4,3) # define __warndecl(name, msg) \ extern void name (void) __attribute__((__warning__ (msg))) # define __warnattr(msg) __attribute__((__warning__ (msg))) # define __errordecl(name, msg) \ extern void name (void) __attribute__((__error__ (msg))) #else # define __warndecl(name, msg) extern void name (void) # define __warnattr(msg) # define __errordecl(name, msg) extern void name (void) #endif /* Support for flexible arrays. */ #if __GNUC_PREREQ (2,97) /* GCC 2.97 supports C99 flexible array members. */ # define __flexarr [] #else # ifdef __GNUC__ # define __flexarr [0] # else # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L # define __flexarr [] # else /* Some other non-C99 compiler. Approximate with [1]. */ # define __flexarr [1] # endif # endif #endif /* __asm__ ("xyz") is used throughout the headers to rename functions at the assembly language level. This is wrapped by the __REDIRECT macro, in order to support compilers that can do this some other way. When compilers don't support asm-names at all, we have to do preprocessor tricks instead (which don't have exactly the right semantics, but it's the best we can do). Example: int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */ #if defined __GNUC__ && __GNUC__ >= 2 # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) # ifdef __cplusplus # define __REDIRECT_NTH(name, proto, alias) \ name proto __THROW __asm__ (__ASMNAME (#alias)) # define __REDIRECT_NTHNL(name, proto, alias) \ name proto __THROWNL __asm__ (__ASMNAME (#alias)) # else # define __REDIRECT_NTH(name, proto, alias) \ name proto __asm__ (__ASMNAME (#alias)) __THROW # define __REDIRECT_NTHNL(name, proto, alias) \ name proto __asm__ (__ASMNAME (#alias)) __THROWNL # endif # define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) # define __ASMNAME2(prefix, cname) __STRING (prefix) cname /* #elif __SOME_OTHER_COMPILER__ # define __REDIRECT(name, proto, alias) name proto; \ _Pragma("let " #name " = " #alias) */ #endif /* GCC has various useful declarations that can be made with the `__attribute__' syntax. All of the ways we use this do fine if they are omitted for compilers that don't understand it. */ #if !defined __GNUC__ || __GNUC__ < 2 # define __attribute__(xyz) /* Ignore */ #endif /* At some point during the gcc 2.96 development the `malloc' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ #if __GNUC_PREREQ (2,96) # define __attribute_malloc__ __attribute__ ((__malloc__)) #else # define __attribute_malloc__ /* Ignore */ #endif /* At some point during the gcc 2.96 development the `pure' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ #if __GNUC_PREREQ (2,96) # define __attribute_pure__ __attribute__ ((__pure__)) #else # define __attribute_pure__ /* Ignore */ #endif /* This declaration tells the compiler that the value is constant. */ #if __GNUC_PREREQ (2,5) # define __attribute_const__ __attribute__ ((__const__)) #else # define __attribute_const__ /* Ignore */ #endif /* At some point during the gcc 3.1 development the `used' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ #if __GNUC_PREREQ (3,1) # define __attribute_used__ __attribute__ ((__used__)) # define __attribute_noinline__ __attribute__ ((__noinline__)) #else # define __attribute_used__ __attribute__ ((__unused__)) # define __attribute_noinline__ /* Ignore */ #endif /* gcc allows marking deprecated functions. */ #if __GNUC_PREREQ (3,2) # define __attribute_deprecated__ __attribute__ ((__deprecated__)) #else # define __attribute_deprecated__ /* Ignore */ #endif /* At some point during the gcc 2.8 development the `format_arg' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. If several `format_arg' attributes are given for the same function, in gcc-3.0 and older, all but the last one are ignored. In newer gccs, all designated arguments are considered. */ #if __GNUC_PREREQ (2,8) # define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x))) #else # define __attribute_format_arg__(x) /* Ignore */ #endif /* At some point during the gcc 2.97 development the `strfmon' format attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ #if __GNUC_PREREQ (2,97) # define __attribute_format_strfmon__(a,b) \ __attribute__ ((__format__ (__strfmon__, a, b))) #else # define __attribute_format_strfmon__(a,b) /* Ignore */ #endif /* The nonull function attribute allows to mark pointer parameters which must not be NULL. */ #if __GNUC_PREREQ (3,3) # define __nonnull(params) __attribute__ ((__nonnull__ params)) #else # define __nonnull(params) #endif /* If fortification mode, we warn about unused results of certain function calls which can lead to problems. */ #if __GNUC_PREREQ (3,4) # define __attribute_warn_unused_result__ \ __attribute__ ((__warn_unused_result__)) # if __USE_FORTIFY_LEVEL > 0 # define __wur __attribute_warn_unused_result__ # endif #else # define __attribute_warn_unused_result__ /* empty */ #endif #ifndef __wur # define __wur /* Ignore */ #endif /* Forces a function to be always inlined. */ #if __GNUC_PREREQ (3,2) # define __always_inline __inline __attribute__ ((__always_inline__)) #else # define __always_inline __inline #endif /* Associate error messages with the source location of the call site rather than with the source location inside the function. */ #if __GNUC_PREREQ (4,3) # define __attribute_artificial__ __attribute__ ((__artificial__)) #else # define __attribute_artificial__ /* Ignore */ #endif /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__ or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions older than 4.3 may define these macros and still not guarantee GNU inlining semantics. clang++ identifies itself as gcc-4.2, but has support for GNU inlining semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and __GNUC_GNU_INLINE__ macro definitions. */ #if (!defined __cplusplus || __GNUC_PREREQ (4,3) \ || (defined __clang__ && (defined __GNUC_STDC_INLINE__ \ || defined __GNUC_GNU_INLINE__))) # if defined __GNUC_STDC_INLINE__ || defined __cplusplus # define __extern_inline extern __inline __attribute__ ((__gnu_inline__)) # define __extern_always_inline \ extern __always_inline __attribute__ ((__gnu_inline__)) # else # define __extern_inline extern __inline # define __extern_always_inline extern __always_inline # endif #endif #ifdef __extern_always_inline # define __fortify_function __extern_always_inline __attribute_artificial__ #endif /* GCC 4.3 and above allow passing all anonymous arguments of an __extern_always_inline function to some other vararg function. */ #if __GNUC_PREREQ (4,3) # define __va_arg_pack() __builtin_va_arg_pack () # define __va_arg_pack_len() __builtin_va_arg_pack_len () #endif /* It is possible to compile containing GCC extensions even if GCC is run in pedantic mode if the uses are carefully marked using the `__extension__' keyword. But this is not generally available before version 2.8. */ #if !__GNUC_PREREQ (2,8) # define __extension__ /* Ignore */ #endif /* __restrict is known in EGCS 1.2 and above. */ #if !__GNUC_PREREQ (2,92) # define __restrict /* Ignore */ #endif /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is array_name[restrict] GCC 3.1 supports this. */ #if __GNUC_PREREQ (3,1) && !defined __GNUG__ # define __restrict_arr __restrict #else # ifdef __GNUC__ # define __restrict_arr /* Not supported in old GCC. */ # else # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L # define __restrict_arr restrict # else /* Some other non-C99 compiler. */ # define __restrict_arr /* Not supported. */ # endif # endif #endif #if __GNUC__ >= 3 # define __glibc_unlikely(cond) __builtin_expect((cond), 0) # define __glibc_likely(cond) __builtin_expect((cond), 1) #else # define __glibc_unlikely(cond) (cond) # define __glibc_likely(cond) (cond) #endif #include <bits/wordsize.h> #if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH # define __LDBL_COMPAT 1 # ifdef __REDIRECT # define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias) # define __LDBL_REDIR(name, proto) \ __LDBL_REDIR1 (name, proto, __nldbl_##name) # define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias) # define __LDBL_REDIR_NTH(name, proto) \ __LDBL_REDIR1_NTH (name, proto, __nldbl_##name) # define __LDBL_REDIR1_DECL(name, alias) \ extern __typeof (name) name __asm (__ASMNAME (#alias)); # define __LDBL_REDIR_DECL(name) \ extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name)); # define __REDIRECT_LDBL(name, proto, alias) \ __LDBL_REDIR1 (name, proto, __nldbl_##alias) # define __REDIRECT_NTH_LDBL(name, proto, alias) \ __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias) # endif #endif #if !defined __LDBL_COMPAT || !defined __REDIRECT # define __LDBL_REDIR1(name, proto, alias) name proto # define __LDBL_REDIR(name, proto) name proto # define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW # define __LDBL_REDIR_NTH(name, proto) name proto __THROW # define __LDBL_REDIR_DECL(name) # ifdef __REDIRECT # define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias) # define __REDIRECT_NTH_LDBL(name, proto, alias) \ __REDIRECT_NTH (name, proto, alias) # endif #endif #endif /* sys/cdefs.h */ ��������������������������������������������������������������������������������������������������������������sys/fcntl.h�����������������������������������������������������������������������������������������0000644�����������������00000000023�14763166026�0006647 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <fcntl.h> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/user.h������������������������������������������������������������������������������������������0000644�����������������00000012127�14763166026�0006527 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2001-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_USER_H #define _SYS_USER_H 1 /* The whole purpose of this file is for GDB and GDB only. Don't read too much into it. Don't use it for anything other than GDB unless you know what you are doing. */ #ifdef __x86_64__ struct user_fpregs_struct { unsigned short int cwd; unsigned short int swd; unsigned short int ftw; unsigned short int fop; __extension__ unsigned long long int rip; __extension__ unsigned long long int rdp; unsigned int mxcsr; unsigned int mxcr_mask; unsigned int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ unsigned int xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */ unsigned int padding[24]; }; struct user_regs_struct { __extension__ unsigned long long int r15; __extension__ unsigned long long int r14; __extension__ unsigned long long int r13; __extension__ unsigned long long int r12; __extension__ unsigned long long int rbp; __extension__ unsigned long long int rbx; __extension__ unsigned long long int r11; __extension__ unsigned long long int r10; __extension__ unsigned long long int r9; __extension__ unsigned long long int r8; __extension__ unsigned long long int rax; __extension__ unsigned long long int rcx; __extension__ unsigned long long int rdx; __extension__ unsigned long long int rsi; __extension__ unsigned long long int rdi; __extension__ unsigned long long int orig_rax; __extension__ unsigned long long int rip; __extension__ unsigned long long int cs; __extension__ unsigned long long int eflags; __extension__ unsigned long long int rsp; __extension__ unsigned long long int ss; __extension__ unsigned long long int fs_base; __extension__ unsigned long long int gs_base; __extension__ unsigned long long int ds; __extension__ unsigned long long int es; __extension__ unsigned long long int fs; __extension__ unsigned long long int gs; }; struct user { struct user_regs_struct regs; int u_fpvalid; struct user_fpregs_struct i387; __extension__ unsigned long long int u_tsize; __extension__ unsigned long long int u_dsize; __extension__ unsigned long long int u_ssize; __extension__ unsigned long long int start_code; __extension__ unsigned long long int start_stack; __extension__ long long int signal; int reserved; __extension__ union { struct user_regs_struct* u_ar0; __extension__ unsigned long long int __u_ar0_word; }; __extension__ union { struct user_fpregs_struct* u_fpstate; __extension__ unsigned long long int __u_fpstate_word; }; __extension__ unsigned long long int magic; char u_comm [32]; __extension__ unsigned long long int u_debugreg [8]; }; #else /* These are the 32-bit x86 structures. */ struct user_fpregs_struct { long int cwd; long int swd; long int twd; long int fip; long int fcs; long int foo; long int fos; long int st_space [20]; }; struct user_fpxregs_struct { unsigned short int cwd; unsigned short int swd; unsigned short int twd; unsigned short int fop; long int fip; long int fcs; long int foo; long int fos; long int mxcsr; long int reserved; long int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ long int xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */ long int padding[56]; }; struct user_regs_struct { long int ebx; long int ecx; long int edx; long int esi; long int edi; long int ebp; long int eax; long int xds; long int xes; long int xfs; long int xgs; long int orig_eax; long int eip; long int xcs; long int eflags; long int esp; long int xss; }; struct user { struct user_regs_struct regs; int u_fpvalid; struct user_fpregs_struct i387; unsigned long int u_tsize; unsigned long int u_dsize; unsigned long int u_ssize; unsigned long int start_code; unsigned long int start_stack; long int signal; int reserved; struct user_regs_struct* u_ar0; struct user_fpregs_struct* u_fpstate; unsigned long int magic; char u_comm [32]; int u_debugreg [8]; }; #endif /* __x86_64__ */ #define PAGE_SHIFT 12 #define PAGE_SIZE (1UL << PAGE_SHIFT) #define PAGE_MASK (~(PAGE_SIZE-1)) #define NBPG PAGE_SIZE #define UPAGES 1 #define HOST_TEXT_START_ADDR (u.start_code) #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) #endif /* _SYS_USER_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/signal.h����������������������������������������������������������������������������������������0000644�����������������00000000024�14763166026�0007017 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <signal.h> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/fanotify.h��������������������������������������������������������������������������������������0000644�����������������00000002406�14763166026�0007367 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_FANOTIFY_H #define _SYS_FANOTIFY_H 1 #include <stdint.h> #include <linux/fanotify.h> __BEGIN_DECLS /* Create and initialize fanotify group. */ extern int fanotify_init (unsigned int __flags, unsigned int __event_f_flags) __THROW; /* Add, remove, or modify an fanotify mark on a filesystem object. */ extern int fanotify_mark (int __fanotify_fd, unsigned int __flags, uint64_t __mask, int __dfd, const char *__pathname) __THROW; __END_DECLS #endif /* sys/fanotify.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/time.h������������������������������������������������������������������������������������������0000644�����������������00000015051�14763166026�0006506 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-1994,1996-2003,2005,2006,2009,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_TIME_H #define _SYS_TIME_H 1 #include <features.h> #include <bits/types.h> #define __need_time_t #include <time.h> #define __need_timeval #include <bits/time.h> #include <sys/select.h> #ifndef __suseconds_t_defined typedef __suseconds_t suseconds_t; # define __suseconds_t_defined #endif __BEGIN_DECLS #ifdef __USE_GNU /* Macros for converting between `struct timeval' and `struct timespec'. */ # define TIMEVAL_TO_TIMESPEC(tv, ts) { \ (ts)->tv_sec = (tv)->tv_sec; \ (ts)->tv_nsec = (tv)->tv_usec * 1000; \ } # define TIMESPEC_TO_TIMEVAL(tv, ts) { \ (tv)->tv_sec = (ts)->tv_sec; \ (tv)->tv_usec = (ts)->tv_nsec / 1000; \ } #endif #ifdef __USE_BSD /* Structure crudely representing a timezone. This is obsolete and should never be used. */ struct timezone { int tz_minuteswest; /* Minutes west of GMT. */ int tz_dsttime; /* Nonzero if DST is ever in effect. */ }; typedef struct timezone *__restrict __timezone_ptr_t; #else typedef void *__restrict __timezone_ptr_t; #endif /* Get the current time of day and timezone information, putting it into *TV and *TZ. If TZ is NULL, *TZ is not filled. Returns 0 on success, -1 on errors. NOTE: This form of timezone information is obsolete. Use the functions and variables declared in <time.h> instead. */ extern int gettimeofday (struct timeval *__restrict __tv, __timezone_ptr_t __tz) __THROW __nonnull ((1)); #ifdef __USE_BSD /* Set the current time of day and timezone information. This call is restricted to the super-user. */ extern int settimeofday (const struct timeval *__tv, const struct timezone *__tz) __THROW; /* Adjust the current time of day by the amount in DELTA. If OLDDELTA is not NULL, it is filled in with the amount of time adjustment remaining to be done from the last `adjtime' call. This call is restricted to the super-user. */ extern int adjtime (const struct timeval *__delta, struct timeval *__olddelta) __THROW; #endif /* Values for the first argument to `getitimer' and `setitimer'. */ enum __itimer_which { /* Timers run in real time. */ ITIMER_REAL = 0, #define ITIMER_REAL ITIMER_REAL /* Timers run only when the process is executing. */ ITIMER_VIRTUAL = 1, #define ITIMER_VIRTUAL ITIMER_VIRTUAL /* Timers run when the process is executing and when the system is executing on behalf of the process. */ ITIMER_PROF = 2 #define ITIMER_PROF ITIMER_PROF }; /* Type of the second argument to `getitimer' and the second and third arguments `setitimer'. */ struct itimerval { /* Value to put into `it_value' when the timer expires. */ struct timeval it_interval; /* Time to the next timer expiration. */ struct timeval it_value; }; #if defined __USE_GNU && !defined __cplusplus /* Use the nicer parameter type only in GNU mode and not for C++ since the strict C++ rules prevent the automatic promotion. */ typedef enum __itimer_which __itimer_which_t; #else typedef int __itimer_which_t; #endif /* Set *VALUE to the current setting of timer WHICH. Return 0 on success, -1 on errors. */ extern int getitimer (__itimer_which_t __which, struct itimerval *__value) __THROW; /* Set the timer WHICH to *NEW. If OLD is not NULL, set *OLD to the old value of timer WHICH. Returns 0 on success, -1 on errors. */ extern int setitimer (__itimer_which_t __which, const struct itimerval *__restrict __new, struct itimerval *__restrict __old) __THROW; /* Change the access time of FILE to TVP[0] and the modification time of FILE to TVP[1]. If TVP is a null pointer, use the current time instead. Returns 0 on success, -1 on errors. */ extern int utimes (const char *__file, const struct timeval __tvp[2]) __THROW __nonnull ((1)); #ifdef __USE_BSD /* Same as `utimes', but does not follow symbolic links. */ extern int lutimes (const char *__file, const struct timeval __tvp[2]) __THROW __nonnull ((1)); /* Same as `utimes', but takes an open file descriptor instead of a name. */ extern int futimes (int __fd, const struct timeval __tvp[2]) __THROW; #endif #ifdef __USE_GNU /* Change the access time of FILE relative to FD to TVP[0] and the modification time of FILE to TVP[1]. If TVP is a null pointer, use the current time instead. Returns 0 on success, -1 on errors. */ extern int futimesat (int __fd, const char *__file, const struct timeval __tvp[2]) __THROW; #endif #ifdef __USE_BSD /* Convenience macros for operations on timevals. NOTE: `timercmp' does not work for >= or <=. */ # define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) # define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) # define timercmp(a, b, CMP) \ (((a)->tv_sec == (b)->tv_sec) ? \ ((a)->tv_usec CMP (b)->tv_usec) : \ ((a)->tv_sec CMP (b)->tv_sec)) # define timeradd(a, b, result) \ do { \ (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ if ((result)->tv_usec >= 1000000) \ { \ ++(result)->tv_sec; \ (result)->tv_usec -= 1000000; \ } \ } while (0) # define timersub(a, b, result) \ do { \ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ if ((result)->tv_usec < 0) { \ --(result)->tv_sec; \ (result)->tv_usec += 1000000; \ } \ } while (0) #endif /* BSD */ __END_DECLS #endif /* sys/time.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/queue.h�����������������������������������������������������������������������������������������0000644�����������������00000046123�14763166026�0006700 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)queue.h 8.5 (Berkeley) 8/20/94 */ #ifndef _SYS_QUEUE_H_ #define _SYS_QUEUE_H_ /* * This file defines five types of data structures: singly-linked lists, * lists, simple queues, tail queues, and circular queues. * * A singly-linked list is headed by a single forward pointer. The * elements are singly linked for minimum space and pointer manipulation * overhead at the expense of O(n) removal for arbitrary elements. New * elements can be added to the list after an existing element or at the * head of the list. Elements being removed from the head of the list * should use the explicit macro for this purpose for optimum * efficiency. A singly-linked list may only be traversed in the forward * direction. Singly-linked lists are ideal for applications with large * datasets and few or no removals or for implementing a LIFO queue. * * A list is headed by a single forward pointer (or an array of forward * pointers for a hash table header). The elements are doubly linked * so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before * or after an existing element or at the head of the list. A list * may only be traversed in the forward direction. * * A simple queue is headed by a pair of pointers, one the head of the * list and the other to the tail of the list. The elements are singly * linked to save space, so elements can only be removed from the * head of the list. New elements can be added to the list after * an existing element, at the head of the list, or at the end of the * list. A simple queue may only be traversed in the forward direction. * * A tail queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are doubly * linked so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before or * after an existing element, at the head of the list, or at the end of * the list. A tail queue may be traversed in either direction. * * A circle queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are doubly * linked so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before or after * an existing element, at the head of the list, or at the end of the list. * A circle queue may be traversed in either direction, but has a more * complex end of list detection. * * For details on the use of these macros, see the queue(3) manual page. */ /* * List definitions. */ #define LIST_HEAD(name, type) \ struct name { \ struct type *lh_first; /* first element */ \ } #define LIST_HEAD_INITIALIZER(head) \ { NULL } #define LIST_ENTRY(type) \ struct { \ struct type *le_next; /* next element */ \ struct type **le_prev; /* address of previous next element */ \ } /* * List functions. */ #define LIST_INIT(head) do { \ (head)->lh_first = NULL; \ } while (/*CONSTCOND*/0) #define LIST_INSERT_AFTER(listelm, elm, field) do { \ if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ (listelm)->field.le_next->field.le_prev = \ &(elm)->field.le_next; \ (listelm)->field.le_next = (elm); \ (elm)->field.le_prev = &(listelm)->field.le_next; \ } while (/*CONSTCOND*/0) #define LIST_INSERT_BEFORE(listelm, elm, field) do { \ (elm)->field.le_prev = (listelm)->field.le_prev; \ (elm)->field.le_next = (listelm); \ *(listelm)->field.le_prev = (elm); \ (listelm)->field.le_prev = &(elm)->field.le_next; \ } while (/*CONSTCOND*/0) #define LIST_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.le_next = (head)->lh_first) != NULL) \ (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ (head)->lh_first = (elm); \ (elm)->field.le_prev = &(head)->lh_first; \ } while (/*CONSTCOND*/0) #define LIST_REMOVE(elm, field) do { \ if ((elm)->field.le_next != NULL) \ (elm)->field.le_next->field.le_prev = \ (elm)->field.le_prev; \ *(elm)->field.le_prev = (elm)->field.le_next; \ } while (/*CONSTCOND*/0) #define LIST_FOREACH(var, head, field) \ for ((var) = ((head)->lh_first); \ (var); \ (var) = ((var)->field.le_next)) /* * List access methods. */ #define LIST_EMPTY(head) ((head)->lh_first == NULL) #define LIST_FIRST(head) ((head)->lh_first) #define LIST_NEXT(elm, field) ((elm)->field.le_next) /* * Singly-linked List definitions. */ #define SLIST_HEAD(name, type) \ struct name { \ struct type *slh_first; /* first element */ \ } #define SLIST_HEAD_INITIALIZER(head) \ { NULL } #define SLIST_ENTRY(type) \ struct { \ struct type *sle_next; /* next element */ \ } /* * Singly-linked List functions. */ #define SLIST_INIT(head) do { \ (head)->slh_first = NULL; \ } while (/*CONSTCOND*/0) #define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ (elm)->field.sle_next = (slistelm)->field.sle_next; \ (slistelm)->field.sle_next = (elm); \ } while (/*CONSTCOND*/0) #define SLIST_INSERT_HEAD(head, elm, field) do { \ (elm)->field.sle_next = (head)->slh_first; \ (head)->slh_first = (elm); \ } while (/*CONSTCOND*/0) #define SLIST_REMOVE_HEAD(head, field) do { \ (head)->slh_first = (head)->slh_first->field.sle_next; \ } while (/*CONSTCOND*/0) #define SLIST_REMOVE(head, elm, type, field) do { \ if ((head)->slh_first == (elm)) { \ SLIST_REMOVE_HEAD((head), field); \ } \ else { \ struct type *curelm = (head)->slh_first; \ while(curelm->field.sle_next != (elm)) \ curelm = curelm->field.sle_next; \ curelm->field.sle_next = \ curelm->field.sle_next->field.sle_next; \ } \ } while (/*CONSTCOND*/0) #define SLIST_FOREACH(var, head, field) \ for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next) /* * Singly-linked List access methods. */ #define SLIST_EMPTY(head) ((head)->slh_first == NULL) #define SLIST_FIRST(head) ((head)->slh_first) #define SLIST_NEXT(elm, field) ((elm)->field.sle_next) /* * Singly-linked Tail queue declarations. */ #define STAILQ_HEAD(name, type) \ struct name { \ struct type *stqh_first; /* first element */ \ struct type **stqh_last; /* addr of last next element */ \ } #define STAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).stqh_first } #define STAILQ_ENTRY(type) \ struct { \ struct type *stqe_next; /* next element */ \ } /* * Singly-linked Tail queue functions. */ #define STAILQ_INIT(head) do { \ (head)->stqh_first = NULL; \ (head)->stqh_last = &(head)->stqh_first; \ } while (/*CONSTCOND*/0) #define STAILQ_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ (head)->stqh_last = &(elm)->field.stqe_next; \ (head)->stqh_first = (elm); \ } while (/*CONSTCOND*/0) #define STAILQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.stqe_next = NULL; \ *(head)->stqh_last = (elm); \ (head)->stqh_last = &(elm)->field.stqe_next; \ } while (/*CONSTCOND*/0) #define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\ (head)->stqh_last = &(elm)->field.stqe_next; \ (listelm)->field.stqe_next = (elm); \ } while (/*CONSTCOND*/0) #define STAILQ_REMOVE_HEAD(head, field) do { \ if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \ (head)->stqh_last = &(head)->stqh_first; \ } while (/*CONSTCOND*/0) #define STAILQ_REMOVE(head, elm, type, field) do { \ if ((head)->stqh_first == (elm)) { \ STAILQ_REMOVE_HEAD((head), field); \ } else { \ struct type *curelm = (head)->stqh_first; \ while (curelm->field.stqe_next != (elm)) \ curelm = curelm->field.stqe_next; \ if ((curelm->field.stqe_next = \ curelm->field.stqe_next->field.stqe_next) == NULL) \ (head)->stqh_last = &(curelm)->field.stqe_next; \ } \ } while (/*CONSTCOND*/0) #define STAILQ_FOREACH(var, head, field) \ for ((var) = ((head)->stqh_first); \ (var); \ (var) = ((var)->field.stqe_next)) #define STAILQ_CONCAT(head1, head2) do { \ if (!STAILQ_EMPTY((head2))) { \ *(head1)->stqh_last = (head2)->stqh_first; \ (head1)->stqh_last = (head2)->stqh_last; \ STAILQ_INIT((head2)); \ } \ } while (/*CONSTCOND*/0) /* * Singly-linked Tail queue access methods. */ #define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) #define STAILQ_FIRST(head) ((head)->stqh_first) #define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) /* * Simple queue definitions. */ #define SIMPLEQ_HEAD(name, type) \ struct name { \ struct type *sqh_first; /* first element */ \ struct type **sqh_last; /* addr of last next element */ \ } #define SIMPLEQ_HEAD_INITIALIZER(head) \ { NULL, &(head).sqh_first } #define SIMPLEQ_ENTRY(type) \ struct { \ struct type *sqe_next; /* next element */ \ } /* * Simple queue functions. */ #define SIMPLEQ_INIT(head) do { \ (head)->sqh_first = NULL; \ (head)->sqh_last = &(head)->sqh_first; \ } while (/*CONSTCOND*/0) #define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ (head)->sqh_last = &(elm)->field.sqe_next; \ (head)->sqh_first = (elm); \ } while (/*CONSTCOND*/0) #define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.sqe_next = NULL; \ *(head)->sqh_last = (elm); \ (head)->sqh_last = &(elm)->field.sqe_next; \ } while (/*CONSTCOND*/0) #define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ (head)->sqh_last = &(elm)->field.sqe_next; \ (listelm)->field.sqe_next = (elm); \ } while (/*CONSTCOND*/0) #define SIMPLEQ_REMOVE_HEAD(head, field) do { \ if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ (head)->sqh_last = &(head)->sqh_first; \ } while (/*CONSTCOND*/0) #define SIMPLEQ_REMOVE(head, elm, type, field) do { \ if ((head)->sqh_first == (elm)) { \ SIMPLEQ_REMOVE_HEAD((head), field); \ } else { \ struct type *curelm = (head)->sqh_first; \ while (curelm->field.sqe_next != (elm)) \ curelm = curelm->field.sqe_next; \ if ((curelm->field.sqe_next = \ curelm->field.sqe_next->field.sqe_next) == NULL) \ (head)->sqh_last = &(curelm)->field.sqe_next; \ } \ } while (/*CONSTCOND*/0) #define SIMPLEQ_FOREACH(var, head, field) \ for ((var) = ((head)->sqh_first); \ (var); \ (var) = ((var)->field.sqe_next)) /* * Simple queue access methods. */ #define SIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL) #define SIMPLEQ_FIRST(head) ((head)->sqh_first) #define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) /* * Tail queue definitions. */ #define _TAILQ_HEAD(name, type, qual) \ struct name { \ qual type *tqh_first; /* first element */ \ qual type *qual *tqh_last; /* addr of last next element */ \ } #define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,) #define TAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).tqh_first } #define _TAILQ_ENTRY(type, qual) \ struct { \ qual type *tqe_next; /* next element */ \ qual type *qual *tqe_prev; /* address of previous next element */\ } #define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,) /* * Tail queue functions. */ #define TAILQ_INIT(head) do { \ (head)->tqh_first = NULL; \ (head)->tqh_last = &(head)->tqh_first; \ } while (/*CONSTCOND*/0) #define TAILQ_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ (head)->tqh_first->field.tqe_prev = \ &(elm)->field.tqe_next; \ else \ (head)->tqh_last = &(elm)->field.tqe_next; \ (head)->tqh_first = (elm); \ (elm)->field.tqe_prev = &(head)->tqh_first; \ } while (/*CONSTCOND*/0) #define TAILQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.tqe_next = NULL; \ (elm)->field.tqe_prev = (head)->tqh_last; \ *(head)->tqh_last = (elm); \ (head)->tqh_last = &(elm)->field.tqe_next; \ } while (/*CONSTCOND*/0) #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ (elm)->field.tqe_next->field.tqe_prev = \ &(elm)->field.tqe_next; \ else \ (head)->tqh_last = &(elm)->field.tqe_next; \ (listelm)->field.tqe_next = (elm); \ (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ } while (/*CONSTCOND*/0) #define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ (elm)->field.tqe_next = (listelm); \ *(listelm)->field.tqe_prev = (elm); \ (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ } while (/*CONSTCOND*/0) #define TAILQ_REMOVE(head, elm, field) do { \ if (((elm)->field.tqe_next) != NULL) \ (elm)->field.tqe_next->field.tqe_prev = \ (elm)->field.tqe_prev; \ else \ (head)->tqh_last = (elm)->field.tqe_prev; \ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ } while (/*CONSTCOND*/0) #define TAILQ_FOREACH(var, head, field) \ for ((var) = ((head)->tqh_first); \ (var); \ (var) = ((var)->field.tqe_next)) #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ (var); \ (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last))) #define TAILQ_CONCAT(head1, head2, field) do { \ if (!TAILQ_EMPTY(head2)) { \ *(head1)->tqh_last = (head2)->tqh_first; \ (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ (head1)->tqh_last = (head2)->tqh_last; \ TAILQ_INIT((head2)); \ } \ } while (/*CONSTCOND*/0) /* * Tail queue access methods. */ #define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) #define TAILQ_FIRST(head) ((head)->tqh_first) #define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) #define TAILQ_LAST(head, headname) \ (*(((struct headname *)((head)->tqh_last))->tqh_last)) #define TAILQ_PREV(elm, headname, field) \ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) /* * Circular queue definitions. */ #define CIRCLEQ_HEAD(name, type) \ struct name { \ struct type *cqh_first; /* first element */ \ struct type *cqh_last; /* last element */ \ } #define CIRCLEQ_HEAD_INITIALIZER(head) \ { (void *)&head, (void *)&head } #define CIRCLEQ_ENTRY(type) \ struct { \ struct type *cqe_next; /* next element */ \ struct type *cqe_prev; /* previous element */ \ } /* * Circular queue functions. */ #define CIRCLEQ_INIT(head) do { \ (head)->cqh_first = (void *)(head); \ (head)->cqh_last = (void *)(head); \ } while (/*CONSTCOND*/0) #define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ (elm)->field.cqe_next = (listelm)->field.cqe_next; \ (elm)->field.cqe_prev = (listelm); \ if ((listelm)->field.cqe_next == (void *)(head)) \ (head)->cqh_last = (elm); \ else \ (listelm)->field.cqe_next->field.cqe_prev = (elm); \ (listelm)->field.cqe_next = (elm); \ } while (/*CONSTCOND*/0) #define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ (elm)->field.cqe_next = (listelm); \ (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ if ((listelm)->field.cqe_prev == (void *)(head)) \ (head)->cqh_first = (elm); \ else \ (listelm)->field.cqe_prev->field.cqe_next = (elm); \ (listelm)->field.cqe_prev = (elm); \ } while (/*CONSTCOND*/0) #define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ (elm)->field.cqe_next = (head)->cqh_first; \ (elm)->field.cqe_prev = (void *)(head); \ if ((head)->cqh_last == (void *)(head)) \ (head)->cqh_last = (elm); \ else \ (head)->cqh_first->field.cqe_prev = (elm); \ (head)->cqh_first = (elm); \ } while (/*CONSTCOND*/0) #define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.cqe_next = (void *)(head); \ (elm)->field.cqe_prev = (head)->cqh_last; \ if ((head)->cqh_first == (void *)(head)) \ (head)->cqh_first = (elm); \ else \ (head)->cqh_last->field.cqe_next = (elm); \ (head)->cqh_last = (elm); \ } while (/*CONSTCOND*/0) #define CIRCLEQ_REMOVE(head, elm, field) do { \ if ((elm)->field.cqe_next == (void *)(head)) \ (head)->cqh_last = (elm)->field.cqe_prev; \ else \ (elm)->field.cqe_next->field.cqe_prev = \ (elm)->field.cqe_prev; \ if ((elm)->field.cqe_prev == (void *)(head)) \ (head)->cqh_first = (elm)->field.cqe_next; \ else \ (elm)->field.cqe_prev->field.cqe_next = \ (elm)->field.cqe_next; \ } while (/*CONSTCOND*/0) #define CIRCLEQ_FOREACH(var, head, field) \ for ((var) = ((head)->cqh_first); \ (var) != (const void *)(head); \ (var) = ((var)->field.cqe_next)) #define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ for ((var) = ((head)->cqh_last); \ (var) != (const void *)(head); \ (var) = ((var)->field.cqe_prev)) /* * Circular queue access methods. */ #define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) #define CIRCLEQ_FIRST(head) ((head)->cqh_first) #define CIRCLEQ_LAST(head) ((head)->cqh_last) #define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) #define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) #define CIRCLEQ_LOOP_NEXT(head, elm, field) \ (((elm)->field.cqe_next == (void *)(head)) \ ? ((head)->cqh_first) \ : (elm->field.cqe_next)) #define CIRCLEQ_LOOP_PREV(head, elm, field) \ (((elm)->field.cqe_prev == (void *)(head)) \ ? ((head)->cqh_last) \ : (elm->field.cqe_prev)) #endif /* sys/queue.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/quota.h�����������������������������������������������������������������������������������������0000644�����������������00000017337�14763166026�0006712 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* This just represents the non-kernel parts of <linux/quota.h>. * * here's the corresponding copyright: * Copyright (c) 1982, 1986 Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * Robert Elz at The University of Melbourne. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _SYS_QUOTA_H #define _SYS_QUOTA_H 1 #include <features.h> #include <sys/types.h> /* * Select between different incompatible quota versions. * Default to the version used by Linux kernel version 2.4.22 * or later. */ #ifndef _LINUX_QUOTA_VERSION # define _LINUX_QUOTA_VERSION 2 #endif /* * Convert diskblocks to blocks and the other way around. * currently only to fool the BSD source. :-) */ #define dbtob(num) ((num) << 10) #define btodb(num) ((num) >> 10) /* * Convert count of filesystem blocks to diskquota blocks, meant * for filesystems where i_blksize != BLOCK_SIZE */ #define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / BLOCK_SIZE) /* * Definitions for disk quotas imposed on the average user * (big brother finally hits Linux). * * The following constants define the amount of time given a user * before the soft limits are treated as hard limits (usually resulting * in an allocation failure). The timer is started when the user crosses * their soft limit, it is reset when they go below their soft limit. */ #define MAX_IQ_TIME 604800 /* (7*24*60*60) 1 week */ #define MAX_DQ_TIME 604800 /* (7*24*60*60) 1 week */ #define MAXQUOTAS 2 #define USRQUOTA 0 /* element used for user quotas */ #define GRPQUOTA 1 /* element used for group quotas */ /* * Definitions for the default names of the quotas files. */ #define INITQFNAMES { \ "user", /* USRQUOTA */ \ "group", /* GRPQUOTA */ \ "undefined", \ }; #define QUOTAFILENAME "quota" #define QUOTAGROUP "staff" #define NR_DQHASH 43 /* Just an arbitrary number any suggestions ? */ #define NR_DQUOTS 256 /* Number of quotas active at one time */ /* * Command definitions for the 'quotactl' system call. * The commands are broken into a main command defined below * and a subcommand that is used to convey the type of * quota that is being manipulated (see above). */ #define SUBCMDMASK 0x00ff #define SUBCMDSHIFT 8 #define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK)) #if _LINUX_QUOTA_VERSION < 2 # define Q_QUOTAON 0x0100 /* enable quotas */ # define Q_QUOTAOFF 0x0200 /* disable quotas */ # define Q_GETQUOTA 0x0300 /* get limits and usage */ # define Q_SETQUOTA 0x0400 /* set limits and usage */ # define Q_SETUSE 0x0500 /* set usage */ # define Q_SYNC 0x0600 /* sync disk copy of a filesystems quotas */ # define Q_SETQLIM 0x0700 /* set limits */ # define Q_GETSTATS 0x0800 /* get collected stats */ # define Q_RSQUASH 0x1000 /* set root_squash option */ #else # define Q_SYNC 0x800001 /* sync disk copy of a filesystems quotas */ # define Q_QUOTAON 0x800002 /* turn quotas on */ # define Q_QUOTAOFF 0x800003 /* turn quotas off */ # define Q_GETFMT 0x800004 /* get quota format used on given filesystem */ # define Q_GETINFO 0x800005 /* get information about quota files */ # define Q_SETINFO 0x800006 /* set information about quota files */ # define Q_GETQUOTA 0x800007 /* get user quota structure */ # define Q_SETQUOTA 0x800008 /* set user quota structure */ #endif /* * The following structure defines the format of the disk quota file * (as it appears on disk) - the file is an array of these structures * indexed by user or group number. */ #if _LINUX_QUOTA_VERSION < 2 struct dqblk { u_int32_t dqb_bhardlimit; /* absolute limit on disk blks alloc */ u_int32_t dqb_bsoftlimit; /* preferred limit on disk blks */ u_int32_t dqb_curblocks; /* current block count */ u_int32_t dqb_ihardlimit; /* maximum # allocated inodes */ u_int32_t dqb_isoftlimit; /* preferred inode limit */ u_int32_t dqb_curinodes; /* current # allocated inodes */ time_t dqb_btime; /* time limit for excessive disk use */ time_t dqb_itime; /* time limit for excessive files */ }; #else /* Flags that indicate which fields in dqblk structure are valid. */ #define QIF_BLIMITS 1 #define QIF_SPACE 2 #define QIF_ILIMITS 4 #define QIF_INODES 8 #define QIF_BTIME 16 #define QIF_ITIME 32 #define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) #define QIF_USAGE (QIF_SPACE | QIF_INODES) #define QIF_TIMES (QIF_BTIME | QIF_ITIME) #define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES) struct dqblk { u_int64_t dqb_bhardlimit; /* absolute limit on disk quota blocks alloc */ u_int64_t dqb_bsoftlimit; /* preferred limit on disk quota blocks */ u_int64_t dqb_curspace; /* current quota block count */ u_int64_t dqb_ihardlimit; /* maximum # allocated inodes */ u_int64_t dqb_isoftlimit; /* preferred inode limit */ u_int64_t dqb_curinodes; /* current # allocated inodes */ u_int64_t dqb_btime; /* time limit for excessive disk use */ u_int64_t dqb_itime; /* time limit for excessive files */ u_int32_t dqb_valid; /* bitmask of QIF_* constants */ }; #endif /* * Shorthand notation. */ #define dq_bhardlimit dq_dqb.dqb_bhardlimit #define dq_bsoftlimit dq_dqb.dqb_bsoftlimit #if _LINUX_QUOTA_VERSION < 2 # define dq_curblocks dq_dqb.dqb_curblocks #else # define dq_curspace dq_dqb.dqb_curspace # define dq_valid dq_dqb.dqb_valid #endif #define dq_ihardlimit dq_dqb.dqb_ihardlimit #define dq_isoftlimit dq_dqb.dqb_isoftlimit #define dq_curinodes dq_dqb.dqb_curinodes #define dq_btime dq_dqb.dqb_btime #define dq_itime dq_dqb.dqb_itime #define dqoff(UID) ((loff_t)((UID) * sizeof (struct dqblk))) #if _LINUX_QUOTA_VERSION < 2 struct dqstats { u_int32_t lookups; u_int32_t drops; u_int32_t reads; u_int32_t writes; u_int32_t cache_hits; u_int32_t pages_allocated; u_int32_t allocated_dquots; u_int32_t free_dquots; u_int32_t syncs; }; #else /* Flags that indicate which fields in dqinfo structure are valid. */ # define IIF_BGRACE 1 # define IIF_IGRACE 2 # define IIF_FLAGS 4 # define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS) struct dqinfo { u_int64_t dqi_bgrace; u_int64_t dqi_igrace; u_int32_t dqi_flags; u_int32_t dqi_valid; }; #endif __BEGIN_DECLS extern int quotactl (int __cmd, const char *__special, int __id, caddr_t __addr) __THROW; __END_DECLS #endif /* sys/quota.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/sysctl.h����������������������������������������������������������������������������������������0000644�����������������00000003747�14763166026�0007102 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996, 1999, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SYSCTL_H #define _SYS_SYSCTL_H 1 #include <features.h> #define __need_size_t #include <stddef.h> /* Prevent more kernel headers than necessary to be included. */ #ifndef _LINUX_KERNEL_H # define _LINUX_KERNEL_H 1 # define __undef_LINUX_KERNEL_H #endif #ifndef _LINUX_TYPES_H # define _LINUX_TYPES_H 1 # define __undef_LINUX_TYPES_H #endif #ifndef _LINUX_LIST_H # define _LINUX_LIST_H 1 # define __undef_LINUX_LIST_H #endif #ifndef __LINUX_COMPILER_H # define __LINUX_COMPILER_H 1 # define __user # define __undef__LINUX_COMPILER_H #endif #include <linux/sysctl.h> #ifdef __undef_LINUX_KERNEL_H # undef _LINUX_KERNEL_H # undef __undef_LINUX_KERNEL_H #endif #ifdef __undef_LINUX_TYPES_H # undef _LINUX_TYPES_H # undef __undef_LINUX_TYPES_H #endif #ifdef __undef_LINUX_LIST_H # undef _LINUX_LIST_H # undef __undef_LINUX_LIST_H #endif #ifdef __undef__LINUX_COMPILER_H # undef __LINUX_COMPILER_H # undef __user # undef __undef__LINUX_COMPILER_H #endif #include <bits/sysctl.h> __BEGIN_DECLS /* Read or write system parameters. */ extern int sysctl (int *__name, int __nlen, void *__oldval, size_t *__oldlenp, void *__newval, size_t __newlen) __THROW; __END_DECLS #endif /* _SYS_SYSCTL_H */ �������������������������sys/reboot.h����������������������������������������������������������������������������������������0000644�����������������00000003140�14763166026�0007036 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* This file should define RB_* macros to be used as flag bits in the argument to the `reboot' system call. */ #ifndef _SYS_REBOOT_H #define _SYS_REBOOT_H 1 #include <features.h> /* Perform a hard reset now. */ #define RB_AUTOBOOT 0x01234567 /* Halt the system. */ #define RB_HALT_SYSTEM 0xcdef0123 /* Enable reboot using Ctrl-Alt-Delete keystroke. */ #define RB_ENABLE_CAD 0x89abcdef /* Disable reboot using Ctrl-Alt-Delete keystroke. */ #define RB_DISABLE_CAD 0 /* Stop system and switch power off if possible. */ #define RB_POWER_OFF 0x4321fedc /* Suspend system using software suspend. */ #define RB_SW_SUSPEND 0xd000fce2 /* Reboot system into new kernel. */ #define RB_KEXEC 0x45584543 __BEGIN_DECLS /* Reboot or halt the system. */ extern int reboot (int __howto) __THROW; __END_DECLS #endif /* _SYS_REBOOT_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/ultrasound.h������������������������������������������������������������������������������������0000644�����������������00000000036�14763166026�0007745 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <linux/ultrasound.h> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/sysmacros.h�������������������������������������������������������������������������������������0000644�����������������00000004771�14763166026�0007602 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Definitions of macros to access `dev_t' values. Copyright (C) 1996, 1997, 1999, 2003, 2004, 2007, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SYSMACROS_H #define _SYS_SYSMACROS_H 1 #include <features.h> /* If the compiler does not know long long it is out of luck. We are not going to hack weird hacks to support the dev_t representation they need. */ #ifdef __GLIBC_HAVE_LONG_LONG __BEGIN_DECLS __extension__ extern unsigned int gnu_dev_major (unsigned long long int __dev) __THROW __attribute_const__; __extension__ extern unsigned int gnu_dev_minor (unsigned long long int __dev) __THROW __attribute_const__; __extension__ extern unsigned long long int gnu_dev_makedev (unsigned int __major, unsigned int __minor) __THROW __attribute_const__; # if defined __GNUC__ && __GNUC__ >= 2 && defined __USE_EXTERN_INLINES __extension__ __extern_inline __attribute_const__ unsigned int __NTH (gnu_dev_major (unsigned long long int __dev)) { return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff); } __extension__ __extern_inline __attribute_const__ unsigned int __NTH (gnu_dev_minor (unsigned long long int __dev)) { return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff); } __extension__ __extern_inline __attribute_const__ unsigned long long int __NTH (gnu_dev_makedev (unsigned int __major, unsigned int __minor)) { return ((__minor & 0xff) | ((__major & 0xfff) << 8) | (((unsigned long long int) (__minor & ~0xff)) << 12) | (((unsigned long long int) (__major & ~0xfff)) << 32)); } # endif __END_DECLS /* Access the functions with their traditional names. */ # define major(dev) gnu_dev_major (dev) # define minor(dev) gnu_dev_minor (dev) # define makedev(maj, min) gnu_dev_makedev (maj, min) #endif #endif /* sys/sysmacros.h */ �������sys/inotify.h���������������������������������������������������������������������������������������0000644�����������������00000007375�14763166026�0007243 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2005-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_INOTIFY_H #define _SYS_INOTIFY_H 1 #include <stdint.h> /* Get the platform-dependent flags. */ #include <bits/inotify.h> /* Structure describing an inotify event. */ struct inotify_event { int wd; /* Watch descriptor. */ uint32_t mask; /* Watch mask. */ uint32_t cookie; /* Cookie to synchronize two events. */ uint32_t len; /* Length (including NULs) of name. */ char name __flexarr; /* Name. */ }; /* Supported events suitable for MASK parameter of INOTIFY_ADD_WATCH. */ #define IN_ACCESS 0x00000001 /* File was accessed. */ #define IN_MODIFY 0x00000002 /* File was modified. */ #define IN_ATTRIB 0x00000004 /* Metadata changed. */ #define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed. */ #define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed. */ #define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */ #define IN_OPEN 0x00000020 /* File was opened. */ #define IN_MOVED_FROM 0x00000040 /* File was moved from X. */ #define IN_MOVED_TO 0x00000080 /* File was moved to Y. */ #define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */ #define IN_CREATE 0x00000100 /* Subfile was created. */ #define IN_DELETE 0x00000200 /* Subfile was deleted. */ #define IN_DELETE_SELF 0x00000400 /* Self was deleted. */ #define IN_MOVE_SELF 0x00000800 /* Self was moved. */ /* Events sent by the kernel. */ #define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted. */ #define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed. */ #define IN_IGNORED 0x00008000 /* File was ignored. */ /* Helper events. */ #define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */ #define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */ /* Special flags. */ #define IN_ONLYDIR 0x01000000 /* Only watch the path if it is a directory. */ #define IN_DONT_FOLLOW 0x02000000 /* Do not follow a sym link. */ #define IN_EXCL_UNLINK 0x04000000 /* Exclude events on unlinked objects. */ #define IN_MASK_ADD 0x20000000 /* Add to the mask of an already existing watch. */ #define IN_ISDIR 0x40000000 /* Event occurred against dir. */ #define IN_ONESHOT 0x80000000 /* Only send event once. */ /* All events which a program can wait on. */ #define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE \ | IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM \ | IN_MOVED_TO | IN_CREATE | IN_DELETE \ | IN_DELETE_SELF | IN_MOVE_SELF) __BEGIN_DECLS /* Create and initialize inotify instance. */ extern int inotify_init (void) __THROW; /* Create and initialize inotify instance. */ extern int inotify_init1 (int __flags) __THROW; /* Add watch of object NAME to inotify instance FD. Notify about events specified by MASK. */ extern int inotify_add_watch (int __fd, const char *__name, uint32_t __mask) __THROW; /* Remove the watch specified by WD from the inotify instance FD. */ extern int inotify_rm_watch (int __fd, int __wd) __THROW; __END_DECLS #endif /* sys/inotify.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/timerfd.h���������������������������������������������������������������������������������������0000644�����������������00000003310�14763166026�0007175 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2008, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_TIMERFD_H #define _SYS_TIMERFD_H 1 #include <time.h> /* Get the platform-dependent flags. */ #include <bits/timerfd.h> /* Bits to be set in the FLAGS parameter of `timerfd_settime'. */ enum { TFD_TIMER_ABSTIME = 1 << 0 #define TFD_TIMER_ABSTIME TFD_TIMER_ABSTIME }; __BEGIN_DECLS /* Return file descriptor for new interval timer source. */ extern int timerfd_create (clockid_t __clock_id, int __flags) __THROW; /* Set next expiration time of interval timer source UFD to UTMR. If FLAGS has the TFD_TIMER_ABSTIME flag set the timeout value is absolute. Optionally return the old expiration time in OTMR. */ extern int timerfd_settime (int __ufd, int __flags, const struct itimerspec *__utmr, struct itimerspec *__otmr) __THROW; /* Return the next expiration time of UFD. */ extern int timerfd_gettime (int __ufd, struct itimerspec *__otmr) __THROW; __END_DECLS #endif /* sys/timerfd.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/un.h��������������������������������������������������������������������������������������������0000644�����������������00000002671�14763166026�0006176 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991, 1995, 1996, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_UN_H #define _SYS_UN_H 1 #include <sys/cdefs.h> /* Get the definition of the macro to define the common sockaddr members. */ #include <bits/sockaddr.h> __BEGIN_DECLS /* Structure describing the address of an AF_LOCAL (aka AF_UNIX) socket. */ struct sockaddr_un { __SOCKADDR_COMMON (sun_); char sun_path[108]; /* Path name. */ }; #ifdef __USE_MISC # include <string.h> /* For prototype of `strlen'. */ /* Evaluate to actual length of the `sockaddr_un' structure. */ # define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \ + strlen ((ptr)->sun_path)) #endif __END_DECLS #endif /* sys/un.h */ �����������������������������������������������������������������������sys/profil.h����������������������������������������������������������������������������������������0000644�����������������00000003641�14763166026�0007045 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _PROFIL_H #define _PROFIL_H 1 #include <features.h> #include <sys/time.h> #include <sys/types.h> /* This interface is intended to follow the sprofil() system calls as described by the sprofil(2) man page of Irix v6.5, except that: - there is no a priori limit on number of text sections - pr_scale is declared as unsigned long (instead of "unsigned int") - pr_size is declared as size_t (instead of "unsigned int") - pr_off is declared as void * (instead of "__psunsigned_t") - the overflow bin (pr_base==0, pr_scale==2) can appear anywhere in the profp array - PROF_FAST has no effect */ struct prof { void *pr_base; /* buffer base */ size_t pr_size; /* buffer size */ size_t pr_off; /* pc offset */ unsigned long int pr_scale; /* pc scaling (fixed-point number) */ }; enum { PROF_USHORT = 0, /* use 16-bit counters (default) */ PROF_UINT = 1 << 0, /* use 32-bit counters */ PROF_FAST = 1 << 1 /* profile faster than usual */ }; __BEGIN_DECLS extern int sprofil (struct prof *__profp, int __profcnt, struct timeval *__tvp, unsigned int __flags) __THROW; __END_DECLS #endif /* profil.h */ �����������������������������������������������������������������������������������������������sys/xattr.h�����������������������������������������������������������������������������������������0000644�����������������00000010214�14763166026�0006706 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2002, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_XATTR_H #define _SYS_XATTR_H 1 #include <features.h> #include <sys/types.h> __BEGIN_DECLS /* The following constants should be used for the fifth parameter of `*setxattr'. */ enum { XATTR_CREATE = 1, /* set value, fail if attr already exists. */ #define XATTR_CREATE XATTR_CREATE XATTR_REPLACE = 2 /* set value, fail if attr does not exist. */ #define XATTR_REPLACE XATTR_REPLACE }; /* Set the attribute NAME of the file pointed to by PATH to VALUE (which is SIZE bytes long). Return 0 on success, -1 for errors. */ extern int setxattr (const char *__path, const char *__name, const void *__value, size_t __size, int __flags) __THROW; /* Set the attribute NAME of the file pointed to by PATH to VALUE (which is SIZE bytes long), not following symlinks for the last pathname component. Return 0 on success, -1 for errors. */ extern int lsetxattr (const char *__path, const char *__name, const void *__value, size_t __size, int __flags) __THROW; /* Set the attribute NAME of the file descriptor FD to VALUE (which is SIZE bytes long). Return 0 on success, -1 for errors. */ extern int fsetxattr (int __fd, const char *__name, const void *__value, size_t __size, int __flags) __THROW; /* Get the attribute NAME of the file pointed to by PATH to VALUE (which is SIZE bytes long). Return 0 on success, -1 for errors. */ extern ssize_t getxattr (const char *__path, const char *__name, void *__value, size_t __size) __THROW; /* Get the attribute NAME of the file pointed to by PATH to VALUE (which is SIZE bytes long), not following symlinks for the last pathname component. Return 0 on success, -1 for errors. */ extern ssize_t lgetxattr (const char *__path, const char *__name, void *__value, size_t __size) __THROW; /* Get the attribute NAME of the file descriptor FD to VALUE (which is SIZE bytes long). Return 0 on success, -1 for errors. */ extern ssize_t fgetxattr (int __fd, const char *__name, void *__value, size_t __size) __THROW; /* List attributes of the file pointed to by PATH into the user-supplied buffer LIST (which is SIZE bytes big). Return 0 on success, -1 for errors. */ extern ssize_t listxattr (const char *__path, char *__list, size_t __size) __THROW; /* List attributes of the file pointed to by PATH into the user-supplied buffer LIST (which is SIZE bytes big), not following symlinks for the last pathname component. Return 0 on success, -1 for errors. */ extern ssize_t llistxattr (const char *__path, char *__list, size_t __size) __THROW; /* List attributes of the file descriptor FD into the user-supplied buffer LIST (which is SIZE bytes big). Return 0 on success, -1 for errors. */ extern ssize_t flistxattr (int __fd, char *__list, size_t __size) __THROW; /* Remove the attribute NAME from the file pointed to by PATH. Return 0 on success, -1 for errors. */ extern int removexattr (const char *__path, const char *__name) __THROW; /* Remove the attribute NAME from the file pointed to by PATH, not following symlinks for the last pathname component. Return 0 on success, -1 for errors. */ extern int lremovexattr (const char *__path, const char *__name) __THROW; /* Remove the attribute NAME from the file descriptor FD. Return 0 on success, -1 for errors. */ extern int fremovexattr (int __fd, const char *__name) __THROW; __END_DECLS #endif /* sys/xattr.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/signalfd.h��������������������������������������������������������������������������������������0000644�����������������00000003112�14763166026�0007332 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2007-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SIGNALFD_H #define _SYS_SIGNALFD_H 1 #define __need_sigset_t #include <signal.h> #include <stdint.h> /* Get the platform-dependent flags. */ #include <bits/signalfd.h> struct signalfd_siginfo { uint32_t ssi_signo; int32_t ssi_errno; int32_t ssi_code; uint32_t ssi_pid; uint32_t ssi_uid; int32_t ssi_fd; uint32_t ssi_tid; uint32_t ssi_band; uint32_t ssi_overrun; uint32_t ssi_trapno; int32_t ssi_status; int32_t ssi_int; uint64_t ssi_ptr; uint64_t ssi_utime; uint64_t ssi_stime; uint64_t ssi_addr; uint8_t __pad[48]; }; __BEGIN_DECLS /* Request notification for delivery of signals in MASK to be performed using descriptor FD.*/ extern int signalfd (int __fd, const sigset_t *__mask, int __flags) __THROW __nonnull ((2)); __END_DECLS #endif /* sys/signalfd.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/vt.h��������������������������������������������������������������������������������������������0000644�����������������00000000026�14763166026�0006175 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <linux/vt.h> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/sdt.h�������������������������������������������������������������������������������������������0000644�����������������00000044250�14763166026�0006345 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* <sys/sdt.h> - Systemtap static probe definition macros. This file is dedicated to the public domain, pursuant to CC0 (https://creativecommons.org/publicdomain/zero/1.0/) */ #ifndef _SYS_SDT_H #define _SYS_SDT_H 1 /* This file defines a family of macros STAP_PROBEn(op1, ..., opn) that emit a nop into the instruction stream, and some data into an auxiliary note section. The data in the note section describes the operands, in terms of size and location. Each location is encoded as assembler operand string. Consumer tools such as gdb or systemtap insert breakpoints on top of the nop, and decode the location operand-strings, like an assembler, to find the values being passed. The operand strings are selected by the compiler for each operand. They are constrained by gcc inline-assembler codes. The default is: #define STAP_SDT_ARG_CONSTRAINT nor This is a good default if the operands tend to be integral and moderate in number (smaller than number of registers). In other cases, the compiler may report "'asm' requires impossible reload" or similar. In this case, consider simplifying the macro call (fewer and simpler operands), reduce optimization, or override the default constraints string via: #define STAP_SDT_ARG_CONSTRAINT g #include <sys/sdt.h> See also: https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation https://gcc.gnu.org/onlinedocs/gcc/Constraints.html */ #ifdef __ASSEMBLER__ # define _SDT_PROBE(provider, name, n, arglist) \ _SDT_ASM_BODY(provider, name, _SDT_ASM_STRING_1, (_SDT_DEPAREN_##n arglist)) \ _SDT_ASM_BASE # define _SDT_ASM_1(x) x; # define _SDT_ASM_2(a, b) a,b; # define _SDT_ASM_3(a, b, c) a,b,c; # define _SDT_ASM_5(a, b, c, d, e) a,b,c,d,e; # define _SDT_ASM_STRING_1(x) .asciz #x; # define _SDT_DEPAREN_0() /* empty */ # define _SDT_DEPAREN_1(a) a # define _SDT_DEPAREN_2(a,b) a b # define _SDT_DEPAREN_3(a,b,c) a b c # define _SDT_DEPAREN_4(a,b,c,d) a b c d # define _SDT_DEPAREN_5(a,b,c,d,e) a b c d e # define _SDT_DEPAREN_6(a,b,c,d,e,f) a b c d e f # define _SDT_DEPAREN_7(a,b,c,d,e,f,g) a b c d e f g # define _SDT_DEPAREN_8(a,b,c,d,e,f,g,h) a b c d e f g h # define _SDT_DEPAREN_9(a,b,c,d,e,f,g,h,i) a b c d e f g h i # define _SDT_DEPAREN_10(a,b,c,d,e,f,g,h,i,j) a b c d e f g h i j # define _SDT_DEPAREN_11(a,b,c,d,e,f,g,h,i,j,k) a b c d e f g h i j k # define _SDT_DEPAREN_12(a,b,c,d,e,f,g,h,i,j,k,l) a b c d e f g h i j k l #else # define _SDT_PROBE(provider, name, n, arglist) \ do { \ __asm__ __volatile__ (_SDT_ASM_BODY(provider, name, _SDT_ASM_ARGS, (n)) \ :: _SDT_ASM_OPERANDS_##n arglist); \ __asm__ __volatile__ (_SDT_ASM_BASE); \ } while (0) # define _SDT_S(x) #x # define _SDT_ASM_1(x) _SDT_S(x) "\n" # define _SDT_ASM_2(a, b) _SDT_S(a) "," _SDT_S(b) "\n" # define _SDT_ASM_3(a, b, c) _SDT_S(a) "," _SDT_S(b) "," \ _SDT_S(c) "\n" # define _SDT_ASM_5(a, b, c, d, e) _SDT_S(a) "," _SDT_S(b) "," \ _SDT_S(c) "," _SDT_S(d) "," \ _SDT_S(e) "\n" # define _SDT_ASM_ARGS(n) _SDT_ASM_STRING(_SDT_ASM_TEMPLATE_##n) # define _SDT_ASM_STRING_1(x) _SDT_ASM_1(.asciz #x) # define _SDT_ARGFMT(no) %n[_SDT_S##no]@_SDT_ARGTMPL(_SDT_A##no) # ifndef STAP_SDT_ARG_CONSTRAINT # if defined __powerpc__ # define STAP_SDT_ARG_CONSTRAINT nZr # else # define STAP_SDT_ARG_CONSTRAINT nor # endif # endif # define _SDT_STRINGIFY(x) #x # define _SDT_ARG_CONSTRAINT_STRING(x) _SDT_STRINGIFY(x) # define _SDT_ARG(n, x) \ [_SDT_S##n] "n" ((_SDT_ARGSIGNED (x) ? 1 : -1) * (int) _SDT_ARGSIZE (x)), \ [_SDT_A##n] _SDT_ARG_CONSTRAINT_STRING (STAP_SDT_ARG_CONSTRAINT) (_SDT_ARGVAL (x)) #endif #define _SDT_ASM_STRING(x) _SDT_ASM_STRING_1(x) #define _SDT_ARGARRAY(x) (__builtin_classify_type (x) == 14 \ || __builtin_classify_type (x) == 5) #ifdef __cplusplus # define _SDT_ARGSIGNED(x) (!_SDT_ARGARRAY (x) \ && __sdt_type<__typeof (x)>::__sdt_signed) # define _SDT_ARGSIZE(x) (_SDT_ARGARRAY (x) \ ? sizeof (void *) : sizeof (x)) # define _SDT_ARGVAL(x) (x) # include <cstddef> template<typename __sdt_T> struct __sdt_type { static const bool __sdt_signed = false; }; #define __SDT_ALWAYS_SIGNED(T) \ template<> struct __sdt_type<T> { static const bool __sdt_signed = true; }; #define __SDT_COND_SIGNED(T,CT) \ template<> struct __sdt_type<T> { static const bool __sdt_signed = ((CT)(-1) < 1); }; __SDT_ALWAYS_SIGNED(signed char) __SDT_ALWAYS_SIGNED(short) __SDT_ALWAYS_SIGNED(int) __SDT_ALWAYS_SIGNED(long) __SDT_ALWAYS_SIGNED(long long) __SDT_ALWAYS_SIGNED(volatile signed char) __SDT_ALWAYS_SIGNED(volatile short) __SDT_ALWAYS_SIGNED(volatile int) __SDT_ALWAYS_SIGNED(volatile long) __SDT_ALWAYS_SIGNED(volatile long long) __SDT_ALWAYS_SIGNED(const signed char) __SDT_ALWAYS_SIGNED(const short) __SDT_ALWAYS_SIGNED(const int) __SDT_ALWAYS_SIGNED(const long) __SDT_ALWAYS_SIGNED(const long long) __SDT_ALWAYS_SIGNED(const volatile signed char) __SDT_ALWAYS_SIGNED(const volatile short) __SDT_ALWAYS_SIGNED(const volatile int) __SDT_ALWAYS_SIGNED(const volatile long) __SDT_ALWAYS_SIGNED(const volatile long long) __SDT_COND_SIGNED(char, char) __SDT_COND_SIGNED(wchar_t, wchar_t) __SDT_COND_SIGNED(volatile char, char) __SDT_COND_SIGNED(volatile wchar_t, wchar_t) __SDT_COND_SIGNED(const char, char) __SDT_COND_SIGNED(const wchar_t, wchar_t) __SDT_COND_SIGNED(const volatile char, char) __SDT_COND_SIGNED(const volatile wchar_t, wchar_t) #if defined (__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) /* __SDT_COND_SIGNED(char16_t) */ /* __SDT_COND_SIGNED(char32_t) */ #endif template<typename __sdt_E> struct __sdt_type<__sdt_E[]> : public __sdt_type<__sdt_E *> {}; template<typename __sdt_E, size_t __sdt_N> struct __sdt_type<__sdt_E[__sdt_N]> : public __sdt_type<__sdt_E *> {}; #elif !defined(__ASSEMBLER__) __extension__ extern unsigned long long __sdt_unsp; # define _SDT_ARGINTTYPE(x) \ __typeof (__builtin_choose_expr (((__builtin_classify_type (x) \ + 3) & -4) == 4, (x), 0U)) # define _SDT_ARGSIGNED(x) \ (!__extension__ \ (__builtin_constant_p ((((unsigned long long) \ (_SDT_ARGINTTYPE (x)) __sdt_unsp) \ & ((unsigned long long)1 << (sizeof (unsigned long long) \ * __CHAR_BIT__ - 1))) == 0) \ || (_SDT_ARGINTTYPE (x)) -1 > (_SDT_ARGINTTYPE (x)) 0)) # define _SDT_ARGSIZE(x) \ (_SDT_ARGARRAY (x) ? sizeof (void *) : sizeof (x)) # define _SDT_ARGVAL(x) (x) #endif #if defined __powerpc__ || defined __powerpc64__ # define _SDT_ARGTMPL(id) %I[id]%[id] #elif defined __i386__ # define _SDT_ARGTMPL(id) %w[id] /* gcc.gnu.org/PR80115 */ #else # define _SDT_ARGTMPL(id) %[id] #endif #ifdef __LP64__ # define _SDT_ASM_ADDR .8byte #else # define _SDT_ASM_ADDR .4byte #endif /* The ia64 and s390 nop instructions take an argument. */ #if defined(__ia64__) || defined(__s390__) || defined(__s390x__) #define _SDT_NOP nop 0 #else #define _SDT_NOP nop #endif #define _SDT_NOTE_NAME "stapsdt" #define _SDT_NOTE_TYPE 3 /* If the assembler supports the necessary feature, then we can play nice with code in COMDAT sections, which comes up in C++ code. Without that assembler support, some combinations of probe placements in certain kinds of C++ code may produce link-time errors. */ #include "sdt-config.h" #if _SDT_ASM_SECTION_AUTOGROUP_SUPPORT # define _SDT_ASM_AUTOGROUP "?" #else # define _SDT_ASM_AUTOGROUP "" #endif #define _SDT_ASM_BODY(provider, name, pack_args, args) \ _SDT_ASM_1(990: _SDT_NOP) \ _SDT_ASM_3( .pushsection .note.stapsdt,_SDT_ASM_AUTOGROUP,"note") \ _SDT_ASM_1( .balign 4) \ _SDT_ASM_3( .4byte 992f-991f, 994f-993f, _SDT_NOTE_TYPE) \ _SDT_ASM_1(991: .asciz _SDT_NOTE_NAME) \ _SDT_ASM_1(992: .balign 4) \ _SDT_ASM_1(993: _SDT_ASM_ADDR 990b) \ _SDT_ASM_1( _SDT_ASM_ADDR _.stapsdt.base) \ _SDT_SEMAPHORE(provider,name) \ _SDT_ASM_STRING(provider) \ _SDT_ASM_STRING(name) \ pack_args args \ _SDT_ASM_1(994: .balign 4) \ _SDT_ASM_1( .popsection) #define _SDT_ASM_BASE \ _SDT_ASM_1(.ifndef _.stapsdt.base) \ _SDT_ASM_5( .pushsection .stapsdt.base,"aG","progbits", \ .stapsdt.base,comdat) \ _SDT_ASM_1( .weak _.stapsdt.base) \ _SDT_ASM_1( .hidden _.stapsdt.base) \ _SDT_ASM_1( _.stapsdt.base: .space 1) \ _SDT_ASM_2( .size _.stapsdt.base, 1) \ _SDT_ASM_1( .popsection) \ _SDT_ASM_1(.endif) #if defined _SDT_HAS_SEMAPHORES #define _SDT_SEMAPHORE(p,n) _SDT_ASM_1( _SDT_ASM_ADDR p##_##n##_semaphore) #else #define _SDT_SEMAPHORE(p,n) _SDT_ASM_1( _SDT_ASM_ADDR 0) #endif #define _SDT_ASM_TEMPLATE_0 /* no arguments */ #define _SDT_ASM_TEMPLATE_1 _SDT_ARGFMT(1) #define _SDT_ASM_TEMPLATE_2 _SDT_ASM_TEMPLATE_1 _SDT_ARGFMT(2) #define _SDT_ASM_TEMPLATE_3 _SDT_ASM_TEMPLATE_2 _SDT_ARGFMT(3) #define _SDT_ASM_TEMPLATE_4 _SDT_ASM_TEMPLATE_3 _SDT_ARGFMT(4) #define _SDT_ASM_TEMPLATE_5 _SDT_ASM_TEMPLATE_4 _SDT_ARGFMT(5) #define _SDT_ASM_TEMPLATE_6 _SDT_ASM_TEMPLATE_5 _SDT_ARGFMT(6) #define _SDT_ASM_TEMPLATE_7 _SDT_ASM_TEMPLATE_6 _SDT_ARGFMT(7) #define _SDT_ASM_TEMPLATE_8 _SDT_ASM_TEMPLATE_7 _SDT_ARGFMT(8) #define _SDT_ASM_TEMPLATE_9 _SDT_ASM_TEMPLATE_8 _SDT_ARGFMT(9) #define _SDT_ASM_TEMPLATE_10 _SDT_ASM_TEMPLATE_9 _SDT_ARGFMT(10) #define _SDT_ASM_TEMPLATE_11 _SDT_ASM_TEMPLATE_10 _SDT_ARGFMT(11) #define _SDT_ASM_TEMPLATE_12 _SDT_ASM_TEMPLATE_11 _SDT_ARGFMT(12) #define _SDT_ASM_OPERANDS_0() [__sdt_dummy] "g" (0) #define _SDT_ASM_OPERANDS_1(arg1) _SDT_ARG(1, arg1) #define _SDT_ASM_OPERANDS_2(arg1, arg2) \ _SDT_ASM_OPERANDS_1(arg1), _SDT_ARG(2, arg2) #define _SDT_ASM_OPERANDS_3(arg1, arg2, arg3) \ _SDT_ASM_OPERANDS_2(arg1, arg2), _SDT_ARG(3, arg3) #define _SDT_ASM_OPERANDS_4(arg1, arg2, arg3, arg4) \ _SDT_ASM_OPERANDS_3(arg1, arg2, arg3), _SDT_ARG(4, arg4) #define _SDT_ASM_OPERANDS_5(arg1, arg2, arg3, arg4, arg5) \ _SDT_ASM_OPERANDS_4(arg1, arg2, arg3, arg4), _SDT_ARG(5, arg5) #define _SDT_ASM_OPERANDS_6(arg1, arg2, arg3, arg4, arg5, arg6) \ _SDT_ASM_OPERANDS_5(arg1, arg2, arg3, arg4, arg5), _SDT_ARG(6, arg6) #define _SDT_ASM_OPERANDS_7(arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ _SDT_ASM_OPERANDS_6(arg1, arg2, arg3, arg4, arg5, arg6), _SDT_ARG(7, arg7) #define _SDT_ASM_OPERANDS_8(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ _SDT_ASM_OPERANDS_7(arg1, arg2, arg3, arg4, arg5, arg6, arg7), \ _SDT_ARG(8, arg8) #define _SDT_ASM_OPERANDS_9(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) \ _SDT_ASM_OPERANDS_8(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8), \ _SDT_ARG(9, arg9) #define _SDT_ASM_OPERANDS_10(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) \ _SDT_ASM_OPERANDS_9(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9), \ _SDT_ARG(10, arg10) #define _SDT_ASM_OPERANDS_11(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11) \ _SDT_ASM_OPERANDS_10(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10), \ _SDT_ARG(11, arg11) #define _SDT_ASM_OPERANDS_12(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12) \ _SDT_ASM_OPERANDS_11(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11), \ _SDT_ARG(12, arg12) /* These macros can be used in C, C++, or assembly code. In assembly code the arguments should use normal assembly operand syntax. */ #define STAP_PROBE(provider, name) \ _SDT_PROBE(provider, name, 0, ()) #define STAP_PROBE1(provider, name, arg1) \ _SDT_PROBE(provider, name, 1, (arg1)) #define STAP_PROBE2(provider, name, arg1, arg2) \ _SDT_PROBE(provider, name, 2, (arg1, arg2)) #define STAP_PROBE3(provider, name, arg1, arg2, arg3) \ _SDT_PROBE(provider, name, 3, (arg1, arg2, arg3)) #define STAP_PROBE4(provider, name, arg1, arg2, arg3, arg4) \ _SDT_PROBE(provider, name, 4, (arg1, arg2, arg3, arg4)) #define STAP_PROBE5(provider, name, arg1, arg2, arg3, arg4, arg5) \ _SDT_PROBE(provider, name, 5, (arg1, arg2, arg3, arg4, arg5)) #define STAP_PROBE6(provider, name, arg1, arg2, arg3, arg4, arg5, arg6) \ _SDT_PROBE(provider, name, 6, (arg1, arg2, arg3, arg4, arg5, arg6)) #define STAP_PROBE7(provider, name, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ _SDT_PROBE(provider, name, 7, (arg1, arg2, arg3, arg4, arg5, arg6, arg7)) #define STAP_PROBE8(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) \ _SDT_PROBE(provider, name, 8, (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) #define STAP_PROBE9(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)\ _SDT_PROBE(provider, name, 9, (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)) #define STAP_PROBE10(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) \ _SDT_PROBE(provider, name, 10, \ (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10)) #define STAP_PROBE11(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11) \ _SDT_PROBE(provider, name, 11, \ (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11)) #define STAP_PROBE12(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12) \ _SDT_PROBE(provider, name, 12, \ (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12)) /* This STAP_PROBEV macro can be used in variadic scenarios, where the number of probe arguments is not known until compile time. Since variadic macro support may vary with compiler options, you must pre-#define SDT_USE_VARIADIC to enable this type of probe. The trick to count __VA_ARGS__ was inspired by this post by Laurent Deniau <laurent.deniau@cern.ch>: http://groups.google.com/group/comp.std.c/msg/346fc464319b1ee5 Note that our _SDT_NARG is called with an extra 0 arg that's not counted, so we don't have to worry about the behavior of macros called without any arguments. */ #ifdef SDT_USE_VARIADIC #define _SDT_NARG(...) __SDT_NARG(__VA_ARGS__, 12,11,10,9,8,7,6,5,4,3,2,1,0) #define __SDT_NARG(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12, N, ...) N #define _SDT_PROBE_N(provider, name, N, ...) \ _SDT_PROBE(provider, name, N, (__VA_ARGS__)) #define STAP_PROBEV(provider, name, ...) \ _SDT_PROBE_N(provider, name, _SDT_NARG(0, ##__VA_ARGS__), ##__VA_ARGS__) #endif /* These macros are for use in asm statements. You must compile with -std=gnu99 or -std=c99 to use the STAP_PROBE_ASM macro. The STAP_PROBE_ASM macro generates a quoted string to be used in the template portion of the asm statement, concatenated with strings that contain the actual assembly code around the probe site. For example: asm ("before\n" STAP_PROBE_ASM(provider, fooprobe, %eax 4(%esi)) "after"); emits the assembly code for "before\nafter", with a probe in between. The probe arguments are the %eax register, and the value of the memory word located 4 bytes past the address in the %esi register. Note that because this is a simple asm, not a GNU C extended asm statement, these % characters do not need to be doubled to generate literal %reg names. In a GNU C extended asm statement, the probe arguments can be specified using the macro STAP_PROBE_ASM_TEMPLATE(n) for n arguments. The paired macro STAP_PROBE_ASM_OPERANDS gives the C values of these probe arguments, and appears in the input operand list of the asm statement. For example: asm ("someinsn %0,%1\n" // %0 is output operand, %1 is input operand STAP_PROBE_ASM(provider, fooprobe, STAP_PROBE_ASM_TEMPLATE(3)) "otherinsn %[namedarg]" : "r" (outvar) : "g" (some_value), [namedarg] "i" (1234), STAP_PROBE_ASM_OPERANDS(3, some_value, some_ptr->field, 1234)); This is just like writing: STAP_PROBE3(provider, fooprobe, some_value, some_ptr->field, 1234)); but the probe site is right between "someinsn" and "otherinsn". The probe arguments in STAP_PROBE_ASM can be given as assembly operands instead, even inside a GNU C extended asm statement. Note that these can use operand templates like %0 or %[name], and likewise they must write %%reg for a literal operand of %reg. */ #if __STDC_VERSION__ >= 199901L # define STAP_PROBE_ASM(provider, name, ...) \ _SDT_ASM_BODY(provider, name, _SDT_ASM_STRING, (__VA_ARGS__)) \ _SDT_ASM_BASE # define STAP_PROBE_ASM_OPERANDS(n, ...) _SDT_ASM_OPERANDS_##n(__VA_ARGS__) #else # define STAP_PROBE_ASM(provider, name, args) \ _SDT_ASM_BODY(provider, name, _SDT_ASM_STRING, (args)) \ _SDT_ASM_BASE #endif #define STAP_PROBE_ASM_TEMPLATE(n) _SDT_ASM_TEMPLATE_##n /* DTrace compatible macro names. */ #define DTRACE_PROBE(provider,probe) \ STAP_PROBE(provider,probe) #define DTRACE_PROBE1(provider,probe,parm1) \ STAP_PROBE1(provider,probe,parm1) #define DTRACE_PROBE2(provider,probe,parm1,parm2) \ STAP_PROBE2(provider,probe,parm1,parm2) #define DTRACE_PROBE3(provider,probe,parm1,parm2,parm3) \ STAP_PROBE3(provider,probe,parm1,parm2,parm3) #define DTRACE_PROBE4(provider,probe,parm1,parm2,parm3,parm4) \ STAP_PROBE4(provider,probe,parm1,parm2,parm3,parm4) #define DTRACE_PROBE5(provider,probe,parm1,parm2,parm3,parm4,parm5) \ STAP_PROBE5(provider,probe,parm1,parm2,parm3,parm4,parm5) #define DTRACE_PROBE6(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6) \ STAP_PROBE6(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6) #define DTRACE_PROBE7(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7) \ STAP_PROBE7(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7) #define DTRACE_PROBE8(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8) \ STAP_PROBE8(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8) #define DTRACE_PROBE9(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9) \ STAP_PROBE9(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9) #define DTRACE_PROBE10(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10) \ STAP_PROBE10(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10) #define DTRACE_PROBE11(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11) \ STAP_PROBE11(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11) #define DTRACE_PROBE12(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11,parm12) \ STAP_PROBE12(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11,parm12) #endif /* sys/sdt.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/uio.h�������������������������������������������������������������������������������������������0000644�����������������00000011156�14763166026�0006346 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991,1992,1996-1999,2003,2009,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_UIO_H #define _SYS_UIO_H 1 #include <features.h> #include <sys/types.h> __BEGIN_DECLS /* This file defines `struct iovec'. */ #include <bits/uio.h> /* Read data from file descriptor FD, and put the result in the buffers described by IOVEC, which is a vector of COUNT 'struct iovec's. The buffers are filled in the order specified. Operates just like 'read' (see <unistd.h>) except that data are put in IOVEC instead of a contiguous buffer. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t readv (int __fd, const struct iovec *__iovec, int __count) __wur; /* Write data pointed by the buffers described by IOVEC, which is a vector of COUNT 'struct iovec's, to file descriptor FD. The data is written in the order specified. Operates just like 'write' (see <unistd.h>) except that the data are taken from IOVEC instead of a contiguous buffer. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t writev (int __fd, const struct iovec *__iovec, int __count) __wur; #ifdef __USE_BSD # ifndef __USE_FILE_OFFSET64 /* Read data from file descriptor FD at the given position OFFSET without change the file pointer, and put the result in the buffers described by IOVEC, which is a vector of COUNT 'struct iovec's. The buffers are filled in the order specified. Operates just like 'pread' (see <unistd.h>) except that data are put in IOVEC instead of a contiguous buffer. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t preadv (int __fd, const struct iovec *__iovec, int __count, __off_t __offset) __wur; /* Write data pointed by the buffers described by IOVEC, which is a vector of COUNT 'struct iovec's, to file descriptor FD at the given position OFFSET without change the file pointer. The data is written in the order specified. Operates just like 'pwrite' (see <unistd.h>) except that the data are taken from IOVEC instead of a contiguous buffer. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t pwritev (int __fd, const struct iovec *__iovec, int __count, __off_t __offset) __wur; # else # ifdef __REDIRECT extern ssize_t __REDIRECT (preadv, (int __fd, const struct iovec *__iovec, int __count, __off64_t __offset), preadv64) __wur; extern ssize_t __REDIRECT (pwritev, (int __fd, const struct iovec *__iovec, int __count, __off64_t __offset), pwritev64) __wur; # else # define preadv preadv64 # define pwritev pwritev64 # endif # endif # ifdef __USE_LARGEFILE64 /* Read data from file descriptor FD at the given position OFFSET without change the file pointer, and put the result in the buffers described by IOVEC, which is a vector of COUNT 'struct iovec's. The buffers are filled in the order specified. Operates just like 'pread' (see <unistd.h>) except that data are put in IOVEC instead of a contiguous buffer. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t preadv64 (int __fd, const struct iovec *__iovec, int __count, __off64_t __offset) __wur; /* Write data pointed by the buffers described by IOVEC, which is a vector of COUNT 'struct iovec's, to file descriptor FD at the given position OFFSET without change the file pointer. The data is written in the order specified. Operates just like 'pwrite' (see <unistd.h>) except that the data are taken from IOVEC instead of a contiguous buffer. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t pwritev64 (int __fd, const struct iovec *__iovec, int __count, __off64_t __offset) __wur; # endif #endif /* Use BSD */ __END_DECLS #endif /* sys/uio.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/ptrace.h����������������������������������������������������������������������������������������0000644�����������������00000015164�14763166026�0007033 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* `ptrace' debugger support interface. Linux version. Copyright (C) 1996-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_PTRACE_H #define _SYS_PTRACE_H 1 #include <features.h> #include <bits/types.h> __BEGIN_DECLS /* Type of the REQUEST argument to `ptrace.' */ enum __ptrace_request { /* Indicate that the process making this request should be traced. All signals received by this process can be intercepted by its parent, and its parent can use the other `ptrace' requests. */ PTRACE_TRACEME = 0, #define PT_TRACE_ME PTRACE_TRACEME /* Return the word in the process's text space at address ADDR. */ PTRACE_PEEKTEXT = 1, #define PT_READ_I PTRACE_PEEKTEXT /* Return the word in the process's data space at address ADDR. */ PTRACE_PEEKDATA = 2, #define PT_READ_D PTRACE_PEEKDATA /* Return the word in the process's user area at offset ADDR. */ PTRACE_PEEKUSER = 3, #define PT_READ_U PTRACE_PEEKUSER /* Write the word DATA into the process's text space at address ADDR. */ PTRACE_POKETEXT = 4, #define PT_WRITE_I PTRACE_POKETEXT /* Write the word DATA into the process's data space at address ADDR. */ PTRACE_POKEDATA = 5, #define PT_WRITE_D PTRACE_POKEDATA /* Write the word DATA into the process's user area at offset ADDR. */ PTRACE_POKEUSER = 6, #define PT_WRITE_U PTRACE_POKEUSER /* Continue the process. */ PTRACE_CONT = 7, #define PT_CONTINUE PTRACE_CONT /* Kill the process. */ PTRACE_KILL = 8, #define PT_KILL PTRACE_KILL /* Single step the process. This is not supported on all machines. */ PTRACE_SINGLESTEP = 9, #define PT_STEP PTRACE_SINGLESTEP /* Get all general purpose registers used by a processes. This is not supported on all machines. */ PTRACE_GETREGS = 12, #define PT_GETREGS PTRACE_GETREGS /* Set all general purpose registers used by a processes. This is not supported on all machines. */ PTRACE_SETREGS = 13, #define PT_SETREGS PTRACE_SETREGS /* Get all floating point registers used by a processes. This is not supported on all machines. */ PTRACE_GETFPREGS = 14, #define PT_GETFPREGS PTRACE_GETFPREGS /* Set all floating point registers used by a processes. This is not supported on all machines. */ PTRACE_SETFPREGS = 15, #define PT_SETFPREGS PTRACE_SETFPREGS /* Attach to a process that is already running. */ PTRACE_ATTACH = 16, #define PT_ATTACH PTRACE_ATTACH /* Detach from a process attached to with PTRACE_ATTACH. */ PTRACE_DETACH = 17, #define PT_DETACH PTRACE_DETACH /* Get all extended floating point registers used by a processes. This is not supported on all machines. */ PTRACE_GETFPXREGS = 18, #define PT_GETFPXREGS PTRACE_GETFPXREGS /* Set all extended floating point registers used by a processes. This is not supported on all machines. */ PTRACE_SETFPXREGS = 19, #define PT_SETFPXREGS PTRACE_SETFPXREGS /* Continue and stop at the next (return from) syscall. */ PTRACE_SYSCALL = 24, #define PT_SYSCALL PTRACE_SYSCALL /* Set ptrace filter options. */ PTRACE_SETOPTIONS = 0x4200, #define PT_SETOPTIONS PTRACE_SETOPTIONS /* Get last ptrace message. */ PTRACE_GETEVENTMSG = 0x4201, #define PT_GETEVENTMSG PTRACE_GETEVENTMSG /* Get siginfo for process. */ PTRACE_GETSIGINFO = 0x4202, #define PT_GETSIGINFO PTRACE_GETSIGINFO /* Set new siginfo for process. */ PTRACE_SETSIGINFO = 0x4203, #define PT_SETSIGINFO PTRACE_SETSIGINFO /* Get register content. */ PTRACE_GETREGSET = 0x4204, #define PTRACE_GETREGSET PTRACE_GETREGSET /* Set register content. */ PTRACE_SETREGSET = 0x4205, #define PTRACE_SETREGSET PTRACE_SETREGSET /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect signal or group stop state. */ PTRACE_SEIZE = 0x4206, #define PTRACE_SEIZE PTRACE_SEIZE /* Trap seized tracee. */ PTRACE_INTERRUPT = 0x4207, #define PTRACE_INTERRUPT PTRACE_INTERRUPT /* Wait for next group event. */ PTRACE_LISTEN = 0x4208, #define PTRACE_LISTEN PTRACE_LISTEN PTRACE_PEEKSIGINFO = 0x4209, #define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO PTRACE_GETSIGMASK = 0x420a, #define PTRACE_GETSIGMASK PTRACE_GETSIGMASK PTRACE_SETSIGMASK = 0x420b, #define PTRACE_SETSIGMASK PTRACE_SETSIGMASK PTRACE_SECCOMP_GET_FILTER = 0x420c #define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER }; /* Flag for PTRACE_LISTEN. */ enum __ptrace_flags { PTRACE_SEIZE_DEVEL = 0x80000000 }; /* Options set using PTRACE_SETOPTIONS. */ enum __ptrace_setoptions { PTRACE_O_TRACESYSGOOD = 0x00000001, PTRACE_O_TRACEFORK = 0x00000002, PTRACE_O_TRACEVFORK = 0x00000004, PTRACE_O_TRACECLONE = 0x00000008, PTRACE_O_TRACEEXEC = 0x00000010, PTRACE_O_TRACEVFORKDONE = 0x00000020, PTRACE_O_TRACEEXIT = 0x00000040, PTRACE_O_TRACESECCOMP = 0x00000080, PTRACE_O_MASK = 0x000000ff }; /* Wait extended result codes for the above trace options. */ enum __ptrace_eventcodes { PTRACE_EVENT_FORK = 1, PTRACE_EVENT_VFORK = 2, PTRACE_EVENT_CLONE = 3, PTRACE_EVENT_EXEC = 4, PTRACE_EVENT_VFORK_DONE = 5, PTRACE_EVENT_EXIT = 6, PTRAVE_EVENT_SECCOMP = 7 }; /* Arguments for PTRACE_PEEKSIGINFO. */ struct __ptrace_peeksiginfo_args { __uint64_t off; /* From which siginfo to start. */ __uint32_t flags; /* Flags for peeksiginfo. */ __int32_t nr; /* How many siginfos to take. */ }; enum __ptrace_peeksiginfo_flags { /* Read signals from a shared (process wide) queue. */ PTRACE_PEEKSIGINFO_SHARED = (1 << 0) }; /* Perform process tracing functions. REQUEST is one of the values above, and determines the action to be taken. For all requests except PTRACE_TRACEME, PID specifies the process to be traced. PID and the other arguments described above for the various requests should appear (those that are used for the particular request) as: pid_t PID, void *ADDR, int DATA, void *ADDR2 after REQUEST. */ extern long int ptrace (enum __ptrace_request __request, ...) __THROW; __END_DECLS #endif /* _SYS_PTRACE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/mman.h������������������������������������������������������������������������������������������0000644�����������������00000012676�14763166026�0006512 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Definitions for BSD-style memory management. Copyright (C) 1994-2000, 2003-2005, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_MMAN_H #define _SYS_MMAN_H 1 #include <features.h> #include <bits/types.h> #define __need_size_t #include <stddef.h> #ifndef __off_t_defined # ifndef __USE_FILE_OFFSET64 typedef __off_t off_t; # else typedef __off64_t off_t; # endif # define __off_t_defined #endif #ifndef __mode_t_defined typedef __mode_t mode_t; # define __mode_t_defined #endif #include <bits/mman.h> /* Return value of `mmap' in case of an error. */ #define MAP_FAILED ((void *) -1) __BEGIN_DECLS /* Map addresses starting near ADDR and extending for LEN bytes. from OFFSET into the file FD describes according to PROT and FLAGS. If ADDR is nonzero, it is the desired mapping address. If the MAP_FIXED bit is set in FLAGS, the mapping will be at ADDR exactly (which must be page-aligned); otherwise the system chooses a convenient nearby address. The return value is the actual mapping address chosen or MAP_FAILED for errors (in which case `errno' is set). A successful `mmap' call deallocates any previous mapping for the affected region. */ #ifndef __USE_FILE_OFFSET64 extern void *mmap (void *__addr, size_t __len, int __prot, int __flags, int __fd, __off_t __offset) __THROW; #else # ifdef __REDIRECT_NTH extern void * __REDIRECT_NTH (mmap, (void *__addr, size_t __len, int __prot, int __flags, int __fd, __off64_t __offset), mmap64); # else # define mmap mmap64 # endif #endif #ifdef __USE_LARGEFILE64 extern void *mmap64 (void *__addr, size_t __len, int __prot, int __flags, int __fd, __off64_t __offset) __THROW; #endif /* Deallocate any mapping for the region starting at ADDR and extending LEN bytes. Returns 0 if successful, -1 for errors (and sets errno). */ extern int munmap (void *__addr, size_t __len) __THROW; /* Change the memory protection of the region starting at ADDR and extending LEN bytes to PROT. Returns 0 if successful, -1 for errors (and sets errno). */ extern int mprotect (void *__addr, size_t __len, int __prot) __THROW; /* Synchronize the region starting at ADDR and extending LEN bytes with the file it maps. Filesystem operations on a file being mapped are unpredictable before this is done. Flags are from the MS_* set. This function is a cancellation point and therefore not marked with __THROW. */ extern int msync (void *__addr, size_t __len, int __flags); #ifdef __USE_BSD /* Advise the system about particular usage patterns the program follows for the region starting at ADDR and extending LEN bytes. */ extern int madvise (void *__addr, size_t __len, int __advice) __THROW; #endif #ifdef __USE_XOPEN2K /* This is the POSIX name for this function. */ extern int posix_madvise (void *__addr, size_t __len, int __advice) __THROW; #endif /* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to be memory resident. */ extern int mlock (const void *__addr, size_t __len) __THROW; /* Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). */ extern int munlock (const void *__addr, size_t __len) __THROW; /* Cause all currently mapped pages of the process to be memory resident until unlocked by a call to the `munlockall', until the process exits, or until the process calls `execve'. */ extern int mlockall (int __flags) __THROW; /* All currently mapped pages of the process' address space become unlocked. */ extern int munlockall (void) __THROW; #ifdef __USE_MISC /* mincore returns the memory residency status of the pages in the current process's address space specified by [start, start + len). The status is returned in a vector of bytes. The least significant bit of each byte is 1 if the referenced page is in memory, otherwise it is zero. */ extern int mincore (void *__start, size_t __len, unsigned char *__vec) __THROW; #endif #ifdef __USE_GNU /* Remap pages mapped by the range [ADDR,ADDR+OLD_LEN) to new length NEW_LEN. If MREMAP_MAYMOVE is set in FLAGS the returned address may differ from ADDR. If MREMAP_FIXED is set in FLAGS the function takes another paramter which is a fixed address at which the block resides after a successful call. */ extern void *mremap (void *__addr, size_t __old_len, size_t __new_len, int __flags, ...) __THROW; /* Remap arbitrary pages of a shared backing store within an existing VMA. */ extern int remap_file_pages (void *__start, size_t __size, int __prot, size_t __pgoff, int __flags) __THROW; #endif /* Open shared memory segment. */ extern int shm_open (const char *__name, int __oflag, mode_t __mode); /* Remove shared memory segment. */ extern int shm_unlink (const char *__name); __END_DECLS #endif /* sys/mman.h */ ������������������������������������������������������������������sys/utsname.h���������������������������������������������������������������������������������������0000644�����������������00000004677�14763166026�0007240 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991,92,94,96,97,99,2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 4.4 System Identification <sys/utsname.h> */ #ifndef _SYS_UTSNAME_H #define _SYS_UTSNAME_H 1 #include <features.h> __BEGIN_DECLS #include <bits/utsname.h> #ifndef _UTSNAME_SYSNAME_LENGTH # define _UTSNAME_SYSNAME_LENGTH _UTSNAME_LENGTH #endif #ifndef _UTSNAME_NODENAME_LENGTH # define _UTSNAME_NODENAME_LENGTH _UTSNAME_LENGTH #endif #ifndef _UTSNAME_RELEASE_LENGTH # define _UTSNAME_RELEASE_LENGTH _UTSNAME_LENGTH #endif #ifndef _UTSNAME_VERSION_LENGTH # define _UTSNAME_VERSION_LENGTH _UTSNAME_LENGTH #endif #ifndef _UTSNAME_MACHINE_LENGTH # define _UTSNAME_MACHINE_LENGTH _UTSNAME_LENGTH #endif /* Structure describing the system and machine. */ struct utsname { /* Name of the implementation of the operating system. */ char sysname[_UTSNAME_SYSNAME_LENGTH]; /* Name of this node on the network. */ char nodename[_UTSNAME_NODENAME_LENGTH]; /* Current release level of this implementation. */ char release[_UTSNAME_RELEASE_LENGTH]; /* Current version level of this release. */ char version[_UTSNAME_VERSION_LENGTH]; /* Name of the hardware type the system is running on. */ char machine[_UTSNAME_MACHINE_LENGTH]; #if _UTSNAME_DOMAIN_LENGTH - 0 /* Name of the domain of this node on the network. */ # ifdef __USE_GNU char domainname[_UTSNAME_DOMAIN_LENGTH]; # else char __domainname[_UTSNAME_DOMAIN_LENGTH]; # endif #endif }; #ifdef __USE_SVID /* Note that SVID assumes all members have the same size. */ # define SYS_NMLN _UTSNAME_LENGTH #endif /* Put information about the system in NAME. */ extern int uname (struct utsname *__name) __THROW; __END_DECLS #endif /* sys/utsname.h */ �����������������������������������������������������������������sys/file.h������������������������������������������������������������������������������������������0000644�����������������00000003231�14763166026�0006464 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991, 92, 96, 97, 98, 99 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_FILE_H #define _SYS_FILE_H 1 #include <features.h> #ifndef _FCNTL_H # include <fcntl.h> #endif __BEGIN_DECLS /* Alternate names for values for the WHENCE argument to `lseek'. These are the same as SEEK_SET, SEEK_CUR, and SEEK_END, respectively. */ #ifndef L_SET # define L_SET 0 /* Seek from beginning of file. */ # define L_INCR 1 /* Seek from current position. */ # define L_XTND 2 /* Seek from end of file. */ #endif /* Operations for the `flock' call. */ #define LOCK_SH 1 /* Shared lock. */ #define LOCK_EX 2 /* Exclusive lock. */ #define LOCK_UN 8 /* Unlock. */ /* Can be OR'd in to one of the above. */ #define LOCK_NB 4 /* Don't block when locking. */ /* Apply or remove an advisory lock, according to OPERATION, on the file FD refers to. */ extern int flock (int __fd, int __operation) __THROW; __END_DECLS #endif /* sys/file.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/bitypes.h���������������������������������������������������������������������������������������0000644�����������������00000000126�14763166026�0007224 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* The GNU <sys/types.h> defines all the necessary types. */ #include <sys/types.h> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/epoll.h�����������������������������������������������������������������������������������������0000644�����������������00000010540�14763166026�0006661 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2002-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_EPOLL_H #define _SYS_EPOLL_H 1 #include <stdint.h> #include <sys/types.h> /* Get __sigset_t. */ #include <bits/sigset.h> #ifndef __sigset_t_defined # define __sigset_t_defined typedef __sigset_t sigset_t; #endif /* Get the platform-dependent flags. */ #include <bits/epoll.h> #ifndef __EPOLL_PACKED # define __EPOLL_PACKED #endif enum EPOLL_EVENTS { EPOLLIN = 0x001, #define EPOLLIN EPOLLIN EPOLLPRI = 0x002, #define EPOLLPRI EPOLLPRI EPOLLOUT = 0x004, #define EPOLLOUT EPOLLOUT EPOLLRDNORM = 0x040, #define EPOLLRDNORM EPOLLRDNORM EPOLLRDBAND = 0x080, #define EPOLLRDBAND EPOLLRDBAND EPOLLWRNORM = 0x100, #define EPOLLWRNORM EPOLLWRNORM EPOLLWRBAND = 0x200, #define EPOLLWRBAND EPOLLWRBAND EPOLLMSG = 0x400, #define EPOLLMSG EPOLLMSG EPOLLERR = 0x008, #define EPOLLERR EPOLLERR EPOLLHUP = 0x010, #define EPOLLHUP EPOLLHUP EPOLLRDHUP = 0x2000, #define EPOLLRDHUP EPOLLRDHUP EPOLLWAKEUP = 1u << 29, #define EPOLLWAKEUP EPOLLWAKEUP EPOLLONESHOT = 1u << 30, #define EPOLLONESHOT EPOLLONESHOT EPOLLET = 1u << 31 #define EPOLLET EPOLLET }; /* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */ #define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */ #define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */ #define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */ typedef union epoll_data { void *ptr; int fd; uint32_t u32; uint64_t u64; } epoll_data_t; struct epoll_event { uint32_t events; /* Epoll events */ epoll_data_t data; /* User data variable */ } __EPOLL_PACKED; __BEGIN_DECLS /* Creates an epoll instance. Returns an fd for the new instance. The "size" parameter is a hint specifying the number of file descriptors to be associated with the new instance. The fd returned by epoll_create() should be closed with close(). */ extern int epoll_create (int __size) __THROW; /* Same as epoll_create but with an FLAGS parameter. The unused SIZE parameter has been dropped. */ extern int epoll_create1 (int __flags) __THROW; /* Manipulate an epoll instance "epfd". Returns 0 in case of success, -1 in case of error ( the "errno" variable will contain the specific error code ) The "op" parameter is one of the EPOLL_CTL_* constants defined above. The "fd" parameter is the target of the operation. The "event" parameter describes which events the caller is interested in and any associated user data. */ extern int epoll_ctl (int __epfd, int __op, int __fd, struct epoll_event *__event) __THROW; /* Wait for events on an epoll instance "epfd". Returns the number of triggered events returned in "events" buffer. Or -1 in case of error with the "errno" variable set to the specific error code. The "events" parameter is a buffer that will contain triggered events. The "maxevents" is the maximum number of events to be returned ( usually size of "events" ). The "timeout" parameter specifies the maximum wait time in milliseconds (-1 == infinite). This function is a cancellation point and therefore not marked with __THROW. */ extern int epoll_wait (int __epfd, struct epoll_event *__events, int __maxevents, int __timeout); /* Same as epoll_wait, but the thread's signal mask is temporarily and atomically replaced with the one provided as parameter. This function is a cancellation point and therefore not marked with __THROW. */ extern int epoll_pwait (int __epfd, struct epoll_event *__events, int __maxevents, int __timeout, const __sigset_t *__ss); __END_DECLS #endif /* sys/epoll.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������sys/personality.h�����������������������������������������������������������������������������������0000644�����������������00000005074�14763166026�0010125 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2002, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* Taken verbatim from Linux 2.6 (include/linux/personality.h). */ #ifndef _SYS_PERSONALITY_H #define _SYS_PERSONALITY_H 1 #include <features.h> /* Flags for bug emulation. These occupy the top three bytes. */ enum { ADDR_NO_RANDOMIZE = 0x0040000, MMAP_PAGE_ZERO = 0x0100000, ADDR_COMPAT_LAYOUT = 0x0200000, READ_IMPLIES_EXEC = 0x0400000, ADDR_LIMIT_32BIT = 0x0800000, SHORT_INODE = 0x1000000, WHOLE_SECONDS = 0x2000000, STICKY_TIMEOUTS = 0x4000000, ADDR_LIMIT_3GB = 0x8000000 }; /* Personality types. These go in the low byte. Avoid using the top bit, it will conflict with error returns. */ enum { PER_LINUX = 0x0000, PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT, PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE, PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE, PER_OSR5 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS, PER_WYSEV386 = 0x0004 | STICKY_TIMEOUTS | SHORT_INODE, PER_ISCR4 = 0x0005 | STICKY_TIMEOUTS, PER_BSD = 0x0006, PER_SUNOS = 0x0006 | STICKY_TIMEOUTS, PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE, PER_LINUX32 = 0x0008, PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB, PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS, /* IRIX5 32-bit */ PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS, /* IRIX6 new 32-bit */ PER_IRIX64 = 0x000b | STICKY_TIMEOUTS, /* IRIX6 64-bit */ PER_RISCOS = 0x000c, PER_SOLARIS = 0x000d | STICKY_TIMEOUTS, PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, PER_OSF4 = 0x000f, PER_HPUX = 0x0010, PER_MASK = 0x00ff, }; __BEGIN_DECLS /* Set different ABIs (personalities). */ extern int personality (unsigned long int __persona) __THROW; __END_DECLS #endif /* sys/personality.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/vm86.h������������������������������������������������������������������������������������������0000644�����������������00000002256�14763166026�0006353 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_VM86_H #define _SYS_VM86_H 1 #include <features.h> #ifdef __x86_64__ # error This header is unsupported on x86-64. #else /* Get constants and data types from kernel header file. */ # include <asm/vm86.h> __BEGIN_DECLS /* Enter virtual 8086 mode. */ extern int vm86 (unsigned long int __subfunction, struct vm86plus_struct *__info) __THROW; __END_DECLS # endif #endif /* _SYS_VM86_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/gmon.h������������������������������������������������������������������������������������������0000644�����������������00000013735�14763166026�0006517 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*- * Copyright (c) 1982, 1986, 1992, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)gmon.h 8.2 (Berkeley) 1/4/94 */ #ifndef _SYS_GMON_H #define _SYS_GMON_H 1 #include <features.h> #include <sys/types.h> /* * See gmon_out.h for gmon.out format. */ /* structure emitted by "gcc -a". This must match struct bb in gcc/libgcc2.c. It is OK for gcc to declare a longer structure as long as the members below are present. */ struct __bb { long zero_word; const char *filename; long *counts; long ncounts; struct __bb *next; const unsigned long *addresses; }; extern struct __bb *__bb_head; /* * histogram counters are unsigned shorts (according to the kernel). */ #define HISTCOUNTER unsigned short /* * fraction of text space to allocate for histogram counters here, 1/2 */ #define HISTFRACTION 2 /* * Fraction of text space to allocate for from hash buckets. * The value of HASHFRACTION is based on the minimum number of bytes * of separation between two subroutine call points in the object code. * Given MIN_SUBR_SEPARATION bytes of separation the value of * HASHFRACTION is calculated as: * * HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1); * * For example, on the VAX, the shortest two call sequence is: * * calls $0,(r0) * calls $0,(r0) * * which is separated by only three bytes, thus HASHFRACTION is * calculated as: * * HASHFRACTION = 3 / (2 * 2 - 1) = 1 * * Note that the division above rounds down, thus if MIN_SUBR_FRACTION * is less than three, this algorithm will not work! * * In practice, however, call instructions are rarely at a minimal * distance. Hence, we will define HASHFRACTION to be 2 across all * architectures. This saves a reasonable amount of space for * profiling data structures without (in practice) sacrificing * any granularity. */ #define HASHFRACTION 2 /* * Percent of text space to allocate for tostructs. * This is a heuristic; we will fail with a warning when profiling programs * with a very large number of very small functions, but that's * normally OK. * 2 is probably still a good value for normal programs. * Profiling a test case with 64000 small functions will work if * you raise this value to 3 and link statically (which bloats the * text size, thus raising the number of arcs expected by the heuristic). */ #define ARCDENSITY 3 /* * Always allocate at least this many tostructs. This * hides the inadequacy of the ARCDENSITY heuristic, at least * for small programs. */ #define MINARCS 50 /* * The type used to represent indices into gmonparam.tos[]. */ #define ARCINDEX u_long /* * Maximum number of arcs we want to allow. * Used to be max representable value of ARCINDEX minus 2, but now * that ARCINDEX is a long, that's too large; we don't really want * to allow a 48 gigabyte table. * The old value of 1<<16 wasn't high enough in practice for large C++ * programs; will 1<<20 be adequate for long? FIXME */ #define MAXARCS (1 << 20) struct tostruct { u_long selfpc; long count; ARCINDEX link; }; /* * a raw arc, with pointers to the calling site and * the called site and a count. */ struct rawarc { u_long raw_frompc; u_long raw_selfpc; long raw_count; }; /* * general rounding functions. */ #define ROUNDDOWN(x,y) (((x)/(y))*(y)) #define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y)) /* * The profiling data structures are housed in this structure. */ struct gmonparam { long int state; u_short *kcount; u_long kcountsize; ARCINDEX *froms; u_long fromssize; struct tostruct *tos; u_long tossize; long tolimit; u_long lowpc; u_long highpc; u_long textsize; u_long hashfraction; long log_hashfraction; }; /* * Possible states of profiling. */ #define GMON_PROF_ON 0 #define GMON_PROF_BUSY 1 #define GMON_PROF_ERROR 2 #define GMON_PROF_OFF 3 /* * Sysctl definitions for extracting profiling information from the kernel. */ #define GPROF_STATE 0 /* int: profiling enabling variable */ #define GPROF_COUNT 1 /* struct: profile tick count buffer */ #define GPROF_FROMS 2 /* struct: from location hash bucket */ #define GPROF_TOS 3 /* struct: destination/count structure */ #define GPROF_GMONPARAM 4 /* struct: profiling parameters (see above) */ __BEGIN_DECLS /* Set up data structures and start profiling. */ extern void __monstartup (u_long __lowpc, u_long __highpc) __THROW; extern void monstartup (u_long __lowpc, u_long __highpc) __THROW; /* Clean up profiling and write out gmon.out. */ extern void _mcleanup (void) __THROW; __END_DECLS #endif /* sys/gmon.h */ �����������������������������������sys/kdaemon.h���������������������������������������������������������������������������������������0000644�����������������00000002115�14763166026�0007163 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* Interfaces to control the various kernel daemons. */ #ifndef _SYS_KDAEMON_H #define _SYS_KDAEMON_H 1 #include <features.h> __BEGIN_DECLS /* Start, flush, or tune the kernel's buffer flushing daemon. */ extern int bdflush (int __func, long int __data) __THROW; __END_DECLS #endif /* _SYS_KDAEMON_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/vtimes.h����������������������������������������������������������������������������������������0000644�����������������00000004653�14763166026�0007065 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991, 1992, 1996, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_VTIMES_H #define _SYS_VTIMES_H 1 #include <features.h> __BEGIN_DECLS /* This interface is obsolete; use `getrusage' instead. */ /* Granularity of the `vm_utime' and `vm_stime' fields of a `struct vtimes'. (This is the frequency of the machine's power supply, in Hz.) */ #define VTIMES_UNITS_PER_SECOND 60 struct vtimes { /* User time used in units of 1/VTIMES_UNITS_PER_SECOND seconds. */ int vm_utime; /* System time used in units of 1/VTIMES_UNITS_PER_SECOND seconds. */ int vm_stime; /* Amount of data and stack memory used (kilobyte-seconds). */ unsigned int vm_idsrss; /* Amount of text memory used (kilobyte-seconds). */ unsigned int vm_ixrss; /* Maximum resident set size (text, data, and stack) (kilobytes). */ int vm_maxrss; /* Number of hard page faults (i.e. those that required I/O). */ int vm_majflt; /* Number of soft page faults (i.e. those serviced by reclaiming a page from the list of pages awaiting reallocation. */ int vm_minflt; /* Number of times a process was swapped out of physical memory. */ int vm_nswap; /* Number of input operations via the file system. Note: This and `ru_oublock' do not include operations with the cache. */ int vm_inblk; /* Number of output operations via the file system. */ int vm_oublk; }; /* If CURRENT is not NULL, write statistics for the current process into *CURRENT. If CHILD is not NULL, write statistics for all terminated child processes into *CHILD. Returns 0 for success, -1 for failure. */ extern int vtimes (struct vtimes * __current, struct vtimes * __child) __THROW; __END_DECLS #endif /* sys/vtimes.h */ �������������������������������������������������������������������������������������sys/auxv.h������������������������������������������������������������������������������������������0000644�����������������00000002341�14763166026�0006531 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Access to the auxiliary vector. Copyright (C) 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_AUXV_H #define _SYS_AUXV_H 1 #include <elf.h> #include <sys/cdefs.h> #include <bits/hwcap.h> __BEGIN_DECLS /* Return the value associated with an Elf*_auxv_t type from the auxv list passed to the program on startup. If TYPE was not present in the auxv list, returns zero. */ extern unsigned long int getauxval (unsigned long int __type) __THROW __attribute_const__; __END_DECLS #endif /* sys/auxv.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/dir.h�������������������������������������������������������������������������������������������0000644�����������������00000001632�14763166026�0006326 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_DIR_H #define _SYS_DIR_H 1 #include <features.h> #include <dirent.h> #define direct dirent #endif /* sys/dir.h */ ������������������������������������������������������������������������������������������������������sys/sem.h�������������������������������������������������������������������������������������������0000644�����������������00000004011�14763166026�0006326 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1995-1999, 2000, 2003, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SEM_H #define _SYS_SEM_H 1 #include <features.h> #define __need_size_t #include <stddef.h> /* Get common definition of System V style IPC. */ #include <sys/ipc.h> /* Get system dependent definition of `struct semid_ds' and more. */ #include <bits/sem.h> #ifdef __USE_GNU # define __need_timespec # include <time.h> #endif /* The following System V style IPC functions implement a semaphore handling. The definition is found in XPG2. */ /* Structure used for argument to `semop' to describe operations. */ struct sembuf { unsigned short int sem_num; /* semaphore number */ short int sem_op; /* semaphore operation */ short int sem_flg; /* operation flag */ }; __BEGIN_DECLS /* Semaphore control operation. */ extern int semctl (int __semid, int __semnum, int __cmd, ...) __THROW; /* Get semaphore. */ extern int semget (key_t __key, int __nsems, int __semflg) __THROW; /* Operate on semaphore. */ extern int semop (int __semid, struct sembuf *__sops, size_t __nsops) __THROW; #ifdef __USE_GNU /* Operate on semaphore with timeout. */ extern int semtimedop (int __semid, struct sembuf *__sops, size_t __nsops, const struct timespec *__timeout) __THROW; #endif __END_DECLS #endif /* sys/sem.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/poll.h������������������������������������������������������������������������������������������0000644�����������������00000005114�14763166026�0006515 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Compatibility definitions for System V `poll' interface. Copyright (C) 1994,1996-2001,2004-2006,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_POLL_H #define _SYS_POLL_H 1 #include <features.h> /* Get the platform dependent bits of `poll'. */ #include <bits/poll.h> #ifdef __USE_GNU /* Get the __sigset_t definition. */ # include <bits/sigset.h> /* Get the timespec definition. */ # define __need_timespec # include <time.h> #endif /* Type used for the number of file descriptors. */ typedef unsigned long int nfds_t; /* Data structure describing a polling request. */ struct pollfd { int fd; /* File descriptor to poll. */ short int events; /* Types of events poller cares about. */ short int revents; /* Types of events that actually occurred. */ }; __BEGIN_DECLS /* Poll the file descriptors described by the NFDS structures starting at FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for an event to occur; if TIMEOUT is -1, block until an event occurs. Returns the number of file descriptors with events, zero if timed out, or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout); #ifdef __USE_GNU /* Like poll, but before waiting the threads signal mask is replaced with that specified in the fourth parameter. For better usability, the timeout value is specified using a TIMESPEC object. This function is a cancellation point and therefore not marked with __THROW. */ extern int ppoll (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, const __sigset_t *__ss); #endif __END_DECLS /* Define some inlines helping to catch common problems. */ #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function # include <bits/poll2.h> #endif #endif /* sys/poll.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/statvfs.h���������������������������������������������������������������������������������������0000644�����������������00000005426�14763166026�0007247 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Definitions for getting information about a filesystem. Copyright (C) 1998, 1999, 2000, 2004, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_STATVFS_H #define _SYS_STATVFS_H 1 #include <features.h> /* Get the system-specific definition of `struct statfs'. */ #include <bits/statvfs.h> #ifndef __USE_FILE_OFFSET64 # ifndef __fsblkcnt_t_defined typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */ # define __fsblkcnt_t_defined # endif # ifndef __fsfilcnt_t_defined typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */ # define __fsfilcnt_t_defined # endif #else # ifndef __fsblkcnt_t_defined typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */ # define __fsblkcnt_t_defined # endif # ifndef __fsfilcnt_t_defined typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */ # define __fsfilcnt_t_defined # endif #endif __BEGIN_DECLS /* Return information about the filesystem on which FILE resides. */ #ifndef __USE_FILE_OFFSET64 extern int statvfs (const char *__restrict __file, struct statvfs *__restrict __buf) __THROW __nonnull ((1, 2)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (statvfs, (const char *__restrict __file, struct statvfs *__restrict __buf), statvfs64) __nonnull ((1, 2)); # else # define statvfs statvfs64 # endif #endif #ifdef __USE_LARGEFILE64 extern int statvfs64 (const char *__restrict __file, struct statvfs64 *__restrict __buf) __THROW __nonnull ((1, 2)); #endif /* Return information about the filesystem containing the file FILDES refers to. */ #ifndef __USE_FILE_OFFSET64 extern int fstatvfs (int __fildes, struct statvfs *__buf) __THROW __nonnull ((2)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (fstatvfs, (int __fildes, struct statvfs *__buf), fstatvfs64) __nonnull ((2)); # else # define fstatvfs fstatvfs64 # endif #endif #ifdef __USE_LARGEFILE64 extern int fstatvfs64 (int __fildes, struct statvfs64 *__buf) __THROW __nonnull ((2)); #endif __END_DECLS #endif /* sys/statvfs.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/gmon_out.h��������������������������������������������������������������������������������������0000644�����������������00000005114�14763166026�0007376 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by David Mosberger <davidm@cs.arizona.edu>. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* This file specifies the format of gmon.out files. It should have as few external dependencies as possible as it is going to be included in many different programs. That is, minimize the number of #include's. A gmon.out file consists of a header (defined by gmon_hdr) followed by a sequence of records. Each record starts with a one-byte tag identifying the type of records, followed by records specific data. */ #ifndef _SYS_GMON_OUT_H #define _SYS_GMON_OUT_H 1 #include <features.h> #define GMON_MAGIC "gmon" /* magic cookie */ #define GMON_VERSION 1 /* version number */ /* For profiling shared object we need a new format. */ #define GMON_SHOBJ_VERSION 0x1ffff __BEGIN_DECLS /* * Raw header as it appears on file (without padding). This header * always comes first in gmon.out and is then followed by a series * records defined below. */ struct gmon_hdr { char cookie[4]; char version[4]; char spare[3 * 4]; }; /* types of records in this file: */ typedef enum { GMON_TAG_TIME_HIST = 0, GMON_TAG_CG_ARC = 1, GMON_TAG_BB_COUNT = 2 } GMON_Record_Tag; struct gmon_hist_hdr { char low_pc[sizeof (char *)]; /* base pc address of sample buffer */ char high_pc[sizeof (char *)]; /* max pc address of sampled buffer */ char hist_size[4]; /* size of sample buffer */ char prof_rate[4]; /* profiling clock rate */ char dimen[15]; /* phys. dim., usually "seconds" */ char dimen_abbrev; /* usually 's' for "seconds" */ }; struct gmon_cg_arc_record { char from_pc[sizeof (char *)]; /* address within caller's body */ char self_pc[sizeof (char *)]; /* address within callee's body */ char count[4]; /* number of arc traversals */ }; __END_DECLS #endif /* sys/gmon_out.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/soundcard.h�������������������������������������������������������������������������������������0000644�����������������00000000035�14763166026�0007526 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <linux/soundcard.h> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/shm.h�������������������������������������������������������������������������������������������0000644�����������������00000003554�14763166026�0006344 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1995-1999, 2000, 2002, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SHM_H #define _SYS_SHM_H 1 #include <features.h> #define __need_size_t #include <stddef.h> /* Get common definition of System V style IPC. */ #include <sys/ipc.h> /* Get system dependent definition of `struct shmid_ds' and more. */ #include <bits/shm.h> /* Define types required by the standard. */ #define __need_time_t #include <time.h> #ifdef __USE_XOPEN # ifndef __pid_t_defined typedef __pid_t pid_t; # define __pid_t_defined # endif #endif /* X/Open */ __BEGIN_DECLS /* The following System V style IPC functions implement a shared memory facility. The definition is found in XPG4.2. */ /* Shared memory control operation. */ extern int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf) __THROW; /* Get shared memory segment. */ extern int shmget (key_t __key, size_t __size, int __shmflg) __THROW; /* Attach shared memory segment. */ extern void *shmat (int __shmid, const void *__shmaddr, int __shmflg) __THROW; /* Detach shared memory segment. */ extern int shmdt (const void *__shmaddr) __THROW; __END_DECLS #endif /* sys/shm.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������sys/timeb.h�����������������������������������������������������������������������������������������0000644�����������������00000002567�14763166026�0006660 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1994, 1995, 1996, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_TIMEB_H #define _SYS_TIMEB_H 1 #include <features.h> #define __need_time_t #include <time.h> __BEGIN_DECLS /* Structure returned by the `ftime' function. */ struct timeb { time_t time; /* Seconds since epoch, as from `time'. */ unsigned short int millitm; /* Additional milliseconds. */ short int timezone; /* Minutes west of GMT. */ short int dstflag; /* Nonzero if Daylight Savings Time used. */ }; /* Fill in TIMEBUF with information about the current time. */ extern int ftime (struct timeb *__timebuf); __END_DECLS #endif /* sys/timeb.h */ �����������������������������������������������������������������������������������������������������������������������������������������sys/ustat.h�����������������������������������������������������������������������������������������0000644�����������������00000002173�14763166026�0006711 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Header describing obsolete `ustat' interface. Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * This interface is obsolete. Use <sys/statfs.h> instead. */ #ifndef _SYS_USTAT_H #define _SYS_USTAT_H 1 #include <features.h> #include <sys/types.h> #include <bits/ustat.h> __BEGIN_DECLS extern int ustat (__dev_t __dev, struct ustat *__ubuf) __THROW; __END_DECLS #endif /* sys/ustat.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/times.h�����������������������������������������������������������������������������������������0000644�����������������00000003131�14763166026�0006665 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991, 1992, 1996, 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 4.5.2 Process Times <sys/times.h> */ #ifndef _SYS_TIMES_H #define _SYS_TIMES_H 1 #include <features.h> #define __need_clock_t #include <time.h> __BEGIN_DECLS /* Structure describing CPU time used by a process and its children. */ struct tms { clock_t tms_utime; /* User CPU time. */ clock_t tms_stime; /* System CPU time. */ clock_t tms_cutime; /* User CPU time of dead children. */ clock_t tms_cstime; /* System CPU time of dead children. */ }; /* Store the CPU time used by this process and all its dead children (and their dead children) in BUFFER. Return the elapsed real time, or (clock_t) -1 for errors. All times are in CLK_TCKths of a second. */ extern clock_t times (struct tms *__buffer) __THROW; __END_DECLS #endif /* sys/times.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/wait.h������������������������������������������������������������������������������������������0000644�����������������00000014703�14763166026�0006517 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-1994,1996-2001,2003,2004,2005,2007,2009,2010,2011,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 3.2.1 Wait for Process Termination <sys/wait.h> */ #ifndef _SYS_WAIT_H #define _SYS_WAIT_H 1 #include <features.h> __BEGIN_DECLS #include <signal.h> /* These macros could also be defined in <stdlib.h>. */ #if !defined _STDLIB_H || (!defined __USE_XOPEN && !defined __USE_XOPEN2K8) /* This will define the `W*' macros for the flag bits to `waitpid', `wait3', and `wait4'. */ # include <bits/waitflags.h> # ifdef __USE_BSD /* Lots of hair to allow traditional BSD use of `union wait' as well as POSIX.1 use of `int' for the status word. */ # if defined __GNUC__ && !defined __cplusplus # define __WAIT_INT(status) \ (__extension__ (((union { __typeof(status) __in; int __i; }) \ { .__in = (status) }).__i)) # else # define __WAIT_INT(status) (*(const int *) &(status)) # endif /* This is the type of the argument to `wait'. The funky union causes redeclarations with either `int *' or `union wait *' to be allowed without complaint. __WAIT_STATUS_DEFN is the type used in the actual function definitions. */ # if !defined __GNUC__ || __GNUC__ < 2 || defined __cplusplus # define __WAIT_STATUS void * # define __WAIT_STATUS_DEFN void * # else /* This works in GCC 2.6.1 and later. */ typedef union { union wait *__uptr; int *__iptr; } __WAIT_STATUS __attribute__ ((__transparent_union__)); # define __WAIT_STATUS_DEFN int * # endif # else /* Don't use BSD. */ # define __WAIT_INT(status) (status) # define __WAIT_STATUS int * # define __WAIT_STATUS_DEFN int * # endif /* Use BSD. */ /* This will define all the `__W*' macros. */ # include <bits/waitstatus.h> # define WEXITSTATUS(status) __WEXITSTATUS (__WAIT_INT (status)) # define WTERMSIG(status) __WTERMSIG (__WAIT_INT (status)) # define WSTOPSIG(status) __WSTOPSIG (__WAIT_INT (status)) # define WIFEXITED(status) __WIFEXITED (__WAIT_INT (status)) # define WIFSIGNALED(status) __WIFSIGNALED (__WAIT_INT (status)) # define WIFSTOPPED(status) __WIFSTOPPED (__WAIT_INT (status)) # ifdef __WIFCONTINUED # define WIFCONTINUED(status) __WIFCONTINUED (__WAIT_INT (status)) # endif #endif /* <stdlib.h> not included. */ #ifdef __USE_BSD # define WCOREFLAG __WCOREFLAG # define WCOREDUMP(status) __WCOREDUMP (__WAIT_INT (status)) # define W_EXITCODE(ret, sig) __W_EXITCODE (ret, sig) # define W_STOPCODE(sig) __W_STOPCODE (sig) #endif /* The following values are used by the `waitid' function. */ #if defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8 typedef enum { P_ALL, /* Wait for any child. */ P_PID, /* Wait for specified process. */ P_PGID /* Wait for members of process group. */ } idtype_t; #endif /* Wait for a child to die. When one does, put its status in *STAT_LOC and return its process ID. For errors, return (pid_t) -1. This function is a cancellation point and therefore not marked with __THROW. */ extern __pid_t wait (__WAIT_STATUS __stat_loc); #ifdef __USE_BSD /* Special values for the PID argument to `waitpid' and `wait4'. */ # define WAIT_ANY (-1) /* Any process. */ # define WAIT_MYPGRP 0 /* Any process in my process group. */ #endif /* Wait for a child matching PID to die. If PID is greater than 0, match any process whose process ID is PID. If PID is (pid_t) -1, match any process. If PID is (pid_t) 0, match any process with the same process group as the current process. If PID is less than -1, match any process whose process group is the absolute value of PID. If the WNOHANG bit is set in OPTIONS, and that child is not already dead, return (pid_t) 0. If successful, return PID and store the dead child's status in STAT_LOC. Return (pid_t) -1 for errors. If the WUNTRACED bit is set in OPTIONS, return status for stopped children; otherwise don't. This function is a cancellation point and therefore not marked with __THROW. */ extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options); #if defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8 # ifndef __id_t_defined # include <bits/types.h> typedef __id_t id_t; # define __id_t_defined # endif # define __need_siginfo_t # include <bits/siginfo.h> /* Wait for a childing matching IDTYPE and ID to change the status and place appropriate information in *INFOP. If IDTYPE is P_PID, match any process whose process ID is ID. If IDTYPE is P_PGID, match any process whose process group is ID. If IDTYPE is P_ALL, match any process. If the WNOHANG bit is set in OPTIONS, and that child is not already dead, clear *INFOP and return 0. If successful, store exit code and status in *INFOP. This function is a cancellation point and therefore not marked with __THROW. */ extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop, int __options); #endif #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* This being here makes the prototypes valid whether or not we have already included <sys/resource.h> to define `struct rusage'. */ struct rusage; /* Wait for a child to exit. When one does, put its status in *STAT_LOC and return its process ID. For errors return (pid_t) -1. If USAGE is not nil, store information about the child's resource usage there. If the WUNTRACED bit is set in OPTIONS, return status for stopped children; otherwise don't. */ extern __pid_t wait3 (__WAIT_STATUS __stat_loc, int __options, struct rusage * __usage) __THROWNL; #endif #ifdef __USE_BSD /* PID is like waitpid. Other args are like wait3. */ extern __pid_t wait4 (__pid_t __pid, __WAIT_STATUS __stat_loc, int __options, struct rusage *__usage) __THROWNL; #endif /* Use BSD. */ __END_DECLS #endif /* sys/wait.h */ �������������������������������������������������������������sys/stat.h������������������������������������������������������������������������������������������0000644�����������������00000040355�14763166026�0006530 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991, 1992, 1995-2007, 2009, 2010, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 5.6 File Characteristics <sys/stat.h> */ #ifndef _SYS_STAT_H #define _SYS_STAT_H 1 #include <features.h> #include <bits/types.h> /* For __mode_t and __dev_t. */ #if defined __USE_XOPEN || defined __USE_XOPEN2K || defined __USE_MISC \ || defined __USE_ATFILE # if defined __USE_XOPEN || defined __USE_XOPEN2K # define __need_time_t # endif # if defined __USE_MISC || defined __USE_ATFILE # define __need_timespec # endif # include <time.h> /* For time_t resp. timespec. */ #endif #if defined __USE_XOPEN || defined __USE_XOPEN2K /* The Single Unix specification says that some more types are available here. */ # ifndef __dev_t_defined typedef __dev_t dev_t; # define __dev_t_defined # endif # ifndef __gid_t_defined typedef __gid_t gid_t; # define __gid_t_defined # endif # ifndef __ino_t_defined # ifndef __USE_FILE_OFFSET64 typedef __ino_t ino_t; # else typedef __ino64_t ino_t; # endif # define __ino_t_defined # endif # ifndef __mode_t_defined typedef __mode_t mode_t; # define __mode_t_defined # endif # ifndef __nlink_t_defined typedef __nlink_t nlink_t; # define __nlink_t_defined # endif # ifndef __off_t_defined # ifndef __USE_FILE_OFFSET64 typedef __off_t off_t; # else typedef __off64_t off_t; # endif # define __off_t_defined # endif # ifndef __uid_t_defined typedef __uid_t uid_t; # define __uid_t_defined # endif #endif /* X/Open */ #ifdef __USE_UNIX98 # ifndef __blkcnt_t_defined # ifndef __USE_FILE_OFFSET64 typedef __blkcnt_t blkcnt_t; # else typedef __blkcnt64_t blkcnt_t; # endif # define __blkcnt_t_defined # endif # ifndef __blksize_t_defined typedef __blksize_t blksize_t; # define __blksize_t_defined # endif #endif /* Unix98 */ __BEGIN_DECLS #include <bits/stat.h> #if defined __USE_BSD || defined __USE_MISC || defined __USE_XOPEN # define S_IFMT __S_IFMT # define S_IFDIR __S_IFDIR # define S_IFCHR __S_IFCHR # define S_IFBLK __S_IFBLK # define S_IFREG __S_IFREG # ifdef __S_IFIFO # define S_IFIFO __S_IFIFO # endif # ifdef __S_IFLNK # define S_IFLNK __S_IFLNK # endif # if (defined __USE_BSD || defined __USE_MISC || defined __USE_UNIX98) \ && defined __S_IFSOCK # define S_IFSOCK __S_IFSOCK # endif #endif /* Test macros for file types. */ #define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask)) #define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR) #define S_ISCHR(mode) __S_ISTYPE((mode), __S_IFCHR) #define S_ISBLK(mode) __S_ISTYPE((mode), __S_IFBLK) #define S_ISREG(mode) __S_ISTYPE((mode), __S_IFREG) #ifdef __S_IFIFO # define S_ISFIFO(mode) __S_ISTYPE((mode), __S_IFIFO) #endif #ifdef __S_IFLNK # define S_ISLNK(mode) __S_ISTYPE((mode), __S_IFLNK) #endif #if defined __USE_BSD && !defined __S_IFLNK # define S_ISLNK(mode) 0 #endif #if (defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K) \ && defined __S_IFSOCK # define S_ISSOCK(mode) __S_ISTYPE((mode), __S_IFSOCK) #elif defined __USE_XOPEN2K # define S_ISSOCK(mode) 0 #endif /* These are from POSIX.1b. If the objects are not implemented using separate distinct file types, the macros always will evaluate to zero. Unlike the other S_* macros the following three take a pointer to a `struct stat' object as the argument. */ #ifdef __USE_POSIX199309 # define S_TYPEISMQ(buf) __S_TYPEISMQ(buf) # define S_TYPEISSEM(buf) __S_TYPEISSEM(buf) # define S_TYPEISSHM(buf) __S_TYPEISSHM(buf) #endif /* Protection bits. */ #define S_ISUID __S_ISUID /* Set user ID on execution. */ #define S_ISGID __S_ISGID /* Set group ID on execution. */ #if defined __USE_BSD || defined __USE_MISC || defined __USE_XOPEN /* Save swapped text after use (sticky bit). This is pretty well obsolete. */ # define S_ISVTX __S_ISVTX #endif #define S_IRUSR __S_IREAD /* Read by owner. */ #define S_IWUSR __S_IWRITE /* Write by owner. */ #define S_IXUSR __S_IEXEC /* Execute by owner. */ /* Read, write, and execute by owner. */ #define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC) #if defined __USE_MISC && defined __USE_BSD # define S_IREAD S_IRUSR # define S_IWRITE S_IWUSR # define S_IEXEC S_IXUSR #endif #define S_IRGRP (S_IRUSR >> 3) /* Read by group. */ #define S_IWGRP (S_IWUSR >> 3) /* Write by group. */ #define S_IXGRP (S_IXUSR >> 3) /* Execute by group. */ /* Read, write, and execute by group. */ #define S_IRWXG (S_IRWXU >> 3) #define S_IROTH (S_IRGRP >> 3) /* Read by others. */ #define S_IWOTH (S_IWGRP >> 3) /* Write by others. */ #define S_IXOTH (S_IXGRP >> 3) /* Execute by others. */ /* Read, write, and execute by others. */ #define S_IRWXO (S_IRWXG >> 3) #ifdef __USE_BSD /* Macros for common mode bit masks. */ # define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ # define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)/* 07777 */ # define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/ # define S_BLKSIZE 512 /* Block size for `st_blocks'. */ #endif #ifndef __USE_FILE_OFFSET64 /* Get file attributes for FILE and put them in BUF. */ extern int stat (const char *__restrict __file, struct stat *__restrict __buf) __THROW __nonnull ((1, 2)); /* Get file attributes for the file, device, pipe, or socket that file descriptor FD is open on and put them in BUF. */ extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (stat, (const char *__restrict __file, struct stat *__restrict __buf), stat64) __nonnull ((1, 2)); extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64) __nonnull ((2)); # else # define stat stat64 # define fstat fstat64 # endif #endif #ifdef __USE_LARGEFILE64 extern int stat64 (const char *__restrict __file, struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2)); extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2)); #endif #ifdef __USE_ATFILE /* Similar to stat, get the attributes for FILE and put them in BUF. Relative path names are interpreted relative to FD unless FD is AT_FDCWD. */ # ifndef __USE_FILE_OFFSET64 extern int fstatat (int __fd, const char *__restrict __file, struct stat *__restrict __buf, int __flag) __THROW __nonnull ((2, 3)); # else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file, struct stat *__restrict __buf, int __flag), fstatat64) __nonnull ((2, 3)); # else # define fstatat fstatat64 # endif # endif # ifdef __USE_LARGEFILE64 extern int fstatat64 (int __fd, const char *__restrict __file, struct stat64 *__restrict __buf, int __flag) __THROW __nonnull ((2, 3)); # endif #endif #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K # ifndef __USE_FILE_OFFSET64 /* Get file attributes about FILE and put them in BUF. If FILE is a symbolic link, do not follow it. */ extern int lstat (const char *__restrict __file, struct stat *__restrict __buf) __THROW __nonnull ((1, 2)); # else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (lstat, (const char *__restrict __file, struct stat *__restrict __buf), lstat64) __nonnull ((1, 2)); # else # define lstat lstat64 # endif # endif # ifdef __USE_LARGEFILE64 extern int lstat64 (const char *__restrict __file, struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2)); # endif #endif /* Set file access permissions for FILE to MODE. If FILE is a symbolic link, this affects its target instead. */ extern int chmod (const char *__file, __mode_t __mode) __THROW __nonnull ((1)); #ifdef __USE_BSD /* Set file access permissions for FILE to MODE. If FILE is a symbolic link, this affects the link itself rather than its target. */ extern int lchmod (const char *__file, __mode_t __mode) __THROW __nonnull ((1)); #endif /* Set file access permissions of the file FD is open on to MODE. */ #if defined __USE_BSD || defined __USE_POSIX extern int fchmod (int __fd, __mode_t __mode) __THROW; #endif #ifdef __USE_ATFILE /* Set file access permissions of FILE relative to the directory FD is open on. */ extern int fchmodat (int __fd, const char *__file, __mode_t __mode, int __flag) __THROW __nonnull ((2)) __wur; #endif /* Use ATFILE. */ /* Set the file creation mask of the current process to MASK, and return the old creation mask. */ extern __mode_t umask (__mode_t __mask) __THROW; #ifdef __USE_GNU /* Get the current `umask' value without changing it. This function is only available under the GNU Hurd. */ extern __mode_t getumask (void) __THROW; #endif /* Create a new directory named PATH, with permission bits MODE. */ extern int mkdir (const char *__path, __mode_t __mode) __THROW __nonnull ((1)); #ifdef __USE_ATFILE /* Like mkdir, create a new directory with permission bits MODE. But interpret relative PATH names relative to the directory associated with FD. */ extern int mkdirat (int __fd, const char *__path, __mode_t __mode) __THROW __nonnull ((2)); #endif /* Create a device file named PATH, with permission and special bits MODE and device number DEV (which can be constructed from major and minor device numbers with the `makedev' macro above). */ #if defined __USE_MISC || defined __USE_BSD || defined __USE_XOPEN_EXTENDED extern int mknod (const char *__path, __mode_t __mode, __dev_t __dev) __THROW __nonnull ((1)); # ifdef __USE_ATFILE /* Like mknod, create a new device file with permission bits MODE and device number DEV. But interpret relative PATH names relative to the directory associated with FD. */ extern int mknodat (int __fd, const char *__path, __mode_t __mode, __dev_t __dev) __THROW __nonnull ((2)); # endif #endif /* Create a new FIFO named PATH, with permission bits MODE. */ extern int mkfifo (const char *__path, __mode_t __mode) __THROW __nonnull ((1)); #ifdef __USE_ATFILE /* Like mkfifo, create a new FIFO with permission bits MODE. But interpret relative PATH names relative to the directory associated with FD. */ extern int mkfifoat (int __fd, const char *__path, __mode_t __mode) __THROW __nonnull ((2)); #endif #ifdef __USE_ATFILE /* Set file access and modification times relative to directory file descriptor. */ extern int utimensat (int __fd, const char *__path, const struct timespec __times[2], int __flags) __THROW __nonnull ((2)); #endif #ifdef __USE_XOPEN2K8 /* Set file access and modification times of the file associated with FD. */ extern int futimens (int __fd, const struct timespec __times[2]) __THROW; #endif /* To allow the `struct stat' structure and the file type `mode_t' bits to vary without changing shared library major version number, the `stat' family of functions and `mknod' are in fact inline wrappers around calls to `xstat', `fxstat', `lxstat', and `xmknod', which all take a leading version-number argument designating the data structure and bits used. <bits/stat.h> defines _STAT_VER with the version number corresponding to `struct stat' as defined in that file; and _MKNOD_VER with the version number corresponding to the S_IF* macros defined therein. It is arranged that when not inlined these function are always statically linked; that way a dynamically-linked executable always encodes the version number corresponding to the data structures it uses, so the `x' functions in the shared library can adapt without needing to recompile all callers. */ #ifndef _STAT_VER # define _STAT_VER 0 #endif #ifndef _MKNOD_VER # define _MKNOD_VER 0 #endif /* Wrappers for stat and mknod system calls. */ #ifndef __USE_FILE_OFFSET64 extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf) __THROW __nonnull ((3)); extern int __xstat (int __ver, const char *__filename, struct stat *__stat_buf) __THROW __nonnull ((2, 3)); extern int __lxstat (int __ver, const char *__filename, struct stat *__stat_buf) __THROW __nonnull ((2, 3)); extern int __fxstatat (int __ver, int __fildes, const char *__filename, struct stat *__stat_buf, int __flag) __THROW __nonnull ((3, 4)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes, struct stat *__stat_buf), __fxstat64) __nonnull ((3)); extern int __REDIRECT_NTH (__xstat, (int __ver, const char *__filename, struct stat *__stat_buf), __xstat64) __nonnull ((2, 3)); extern int __REDIRECT_NTH (__lxstat, (int __ver, const char *__filename, struct stat *__stat_buf), __lxstat64) __nonnull ((2, 3)); extern int __REDIRECT_NTH (__fxstatat, (int __ver, int __fildes, const char *__filename, struct stat *__stat_buf, int __flag), __fxstatat64) __nonnull ((3, 4)); # else # define __fxstat __fxstat64 # define __xstat __xstat64 # define __lxstat __lxstat64 # endif #endif #ifdef __USE_LARGEFILE64 extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf) __THROW __nonnull ((3)); extern int __xstat64 (int __ver, const char *__filename, struct stat64 *__stat_buf) __THROW __nonnull ((2, 3)); extern int __lxstat64 (int __ver, const char *__filename, struct stat64 *__stat_buf) __THROW __nonnull ((2, 3)); extern int __fxstatat64 (int __ver, int __fildes, const char *__filename, struct stat64 *__stat_buf, int __flag) __THROW __nonnull ((3, 4)); #endif extern int __xmknod (int __ver, const char *__path, __mode_t __mode, __dev_t *__dev) __THROW __nonnull ((2, 4)); extern int __xmknodat (int __ver, int __fd, const char *__path, __mode_t __mode, __dev_t *__dev) __THROW __nonnull ((3, 5)); #if defined __GNUC__ && __GNUC__ >= 2 && defined __USE_EXTERN_INLINES /* Inlined versions of the real stat and mknod functions. */ __extern_inline int __NTH (stat (const char *__path, struct stat *__statbuf)) { return __xstat (_STAT_VER, __path, __statbuf); } # if defined __USE_BSD || defined __USE_XOPEN_EXTENDED __extern_inline int __NTH (lstat (const char *__path, struct stat *__statbuf)) { return __lxstat (_STAT_VER, __path, __statbuf); } # endif __extern_inline int __NTH (fstat (int __fd, struct stat *__statbuf)) { return __fxstat (_STAT_VER, __fd, __statbuf); } # ifdef __USE_ATFILE __extern_inline int __NTH (fstatat (int __fd, const char *__filename, struct stat *__statbuf, int __flag)) { return __fxstatat (_STAT_VER, __fd, __filename, __statbuf, __flag); } # endif # if defined __USE_MISC || defined __USE_BSD __extern_inline int __NTH (mknod (const char *__path, __mode_t __mode, __dev_t __dev)) { return __xmknod (_MKNOD_VER, __path, __mode, &__dev); } # endif # ifdef __USE_ATFILE __extern_inline int __NTH (mknodat (int __fd, const char *__path, __mode_t __mode, __dev_t __dev)) { return __xmknodat (_MKNOD_VER, __fd, __path, __mode, &__dev); } # endif # if defined __USE_LARGEFILE64 \ && (! defined __USE_FILE_OFFSET64 \ || (defined __REDIRECT_NTH && defined __OPTIMIZE__)) __extern_inline int __NTH (stat64 (const char *__path, struct stat64 *__statbuf)) { return __xstat64 (_STAT_VER, __path, __statbuf); } # if defined __USE_BSD || defined __USE_XOPEN_EXTENDED __extern_inline int __NTH (lstat64 (const char *__path, struct stat64 *__statbuf)) { return __lxstat64 (_STAT_VER, __path, __statbuf); } # endif __extern_inline int __NTH (fstat64 (int __fd, struct stat64 *__statbuf)) { return __fxstat64 (_STAT_VER, __fd, __statbuf); } # ifdef __USE_ATFILE __extern_inline int __NTH (fstatat64 (int __fd, const char *__filename, struct stat64 *__statbuf, int __flag)) { return __fxstatat64 (_STAT_VER, __fd, __filename, __statbuf, __flag); } # endif # endif #endif __END_DECLS #endif /* sys/stat.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/syslog.h����������������������������������������������������������������������������������������0000644�����������������00000017025�14763166026�0007073 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 1982, 1986, 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)syslog.h 8.1 (Berkeley) 6/2/93 */ #ifndef _SYS_SYSLOG_H #define _SYS_SYSLOG_H 1 #include <features.h> #define __need___va_list #include <stdarg.h> /* This file defines _PATH_LOG. */ #include <bits/syslog-path.h> /* * priorities/facilities are encoded into a single 32-bit quantity, where the * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility * (0-big number). Both the priorities and the facilities map roughly * one-to-one to strings in the syslogd(8) source code. This mapping is * included in this file. * * priorities (these are ordered) */ #define LOG_EMERG 0 /* system is unusable */ #define LOG_ALERT 1 /* action must be taken immediately */ #define LOG_CRIT 2 /* critical conditions */ #define LOG_ERR 3 /* error conditions */ #define LOG_WARNING 4 /* warning conditions */ #define LOG_NOTICE 5 /* normal but significant condition */ #define LOG_INFO 6 /* informational */ #define LOG_DEBUG 7 /* debug-level messages */ #define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ /* extract priority */ #define LOG_PRI(p) ((p) & LOG_PRIMASK) #define LOG_MAKEPRI(fac, pri) ((fac) | (pri)) #ifdef SYSLOG_NAMES #define INTERNAL_NOPRI 0x10 /* the "no priority" priority */ /* mark "facility" */ #define INTERNAL_MARK LOG_MAKEPRI(LOG_NFACILITIES << 3, 0) typedef struct _code { char *c_name; int c_val; } CODE; CODE prioritynames[] = { { "alert", LOG_ALERT }, { "crit", LOG_CRIT }, { "debug", LOG_DEBUG }, { "emerg", LOG_EMERG }, { "err", LOG_ERR }, { "error", LOG_ERR }, /* DEPRECATED */ { "info", LOG_INFO }, { "none", INTERNAL_NOPRI }, /* INTERNAL */ { "notice", LOG_NOTICE }, { "panic", LOG_EMERG }, /* DEPRECATED */ { "warn", LOG_WARNING }, /* DEPRECATED */ { "warning", LOG_WARNING }, { NULL, -1 } }; #endif /* facility codes */ #define LOG_KERN (0<<3) /* kernel messages */ #define LOG_USER (1<<3) /* random user-level messages */ #define LOG_MAIL (2<<3) /* mail system */ #define LOG_DAEMON (3<<3) /* system daemons */ #define LOG_AUTH (4<<3) /* security/authorization messages */ #define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ #define LOG_LPR (6<<3) /* line printer subsystem */ #define LOG_NEWS (7<<3) /* network news subsystem */ #define LOG_UUCP (8<<3) /* UUCP subsystem */ #define LOG_CRON (9<<3) /* clock daemon */ #define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */ #define LOG_FTP (11<<3) /* ftp daemon */ /* other codes through 15 reserved for system use */ #define LOG_LOCAL0 (16<<3) /* reserved for local use */ #define LOG_LOCAL1 (17<<3) /* reserved for local use */ #define LOG_LOCAL2 (18<<3) /* reserved for local use */ #define LOG_LOCAL3 (19<<3) /* reserved for local use */ #define LOG_LOCAL4 (20<<3) /* reserved for local use */ #define LOG_LOCAL5 (21<<3) /* reserved for local use */ #define LOG_LOCAL6 (22<<3) /* reserved for local use */ #define LOG_LOCAL7 (23<<3) /* reserved for local use */ #define LOG_NFACILITIES 24 /* current number of facilities */ #define LOG_FACMASK 0x03f8 /* mask to extract facility part */ /* facility of pri */ #define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) #ifdef SYSLOG_NAMES CODE facilitynames[] = { { "auth", LOG_AUTH }, { "authpriv", LOG_AUTHPRIV }, { "cron", LOG_CRON }, { "daemon", LOG_DAEMON }, { "ftp", LOG_FTP }, { "kern", LOG_KERN }, { "lpr", LOG_LPR }, { "mail", LOG_MAIL }, { "mark", INTERNAL_MARK }, /* INTERNAL */ { "news", LOG_NEWS }, { "security", LOG_AUTH }, /* DEPRECATED */ { "syslog", LOG_SYSLOG }, { "user", LOG_USER }, { "uucp", LOG_UUCP }, { "local0", LOG_LOCAL0 }, { "local1", LOG_LOCAL1 }, { "local2", LOG_LOCAL2 }, { "local3", LOG_LOCAL3 }, { "local4", LOG_LOCAL4 }, { "local5", LOG_LOCAL5 }, { "local6", LOG_LOCAL6 }, { "local7", LOG_LOCAL7 }, { NULL, -1 } }; #endif /* * arguments to setlogmask. */ #define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ #define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ /* * Option flags for openlog. * * LOG_ODELAY no longer does anything. * LOG_NDELAY is the inverse of what it used to be. */ #define LOG_PID 0x01 /* log the pid with each message */ #define LOG_CONS 0x02 /* log on the console if errors in sending */ #define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ #define LOG_NDELAY 0x08 /* don't delay open */ #define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ #define LOG_PERROR 0x20 /* log to stderr as well */ __BEGIN_DECLS /* Close descriptor used to write to system logger. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void closelog (void); /* Open connection to system logger. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void openlog (const char *__ident, int __option, int __facility); /* Set the log mask level. */ extern int setlogmask (int __mask) __THROW; /* Generate a log message using FMT string and option arguments. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void syslog (int __pri, const char *__fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); #ifdef __USE_BSD /* Generate a log message using FMT and using arguments pointed to by AP. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap) __attribute__ ((__format__ (__printf__, 2, 0))); #endif /* Define some macros helping to catch buffer overflows. */ #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function # include <bits/syslog.h> #endif #ifdef __LDBL_COMPAT # include <bits/syslog-ldbl.h> #endif __END_DECLS #endif /* sys/syslog.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/eventfd.h���������������������������������������������������������������������������������������0000644�����������������00000002556�14763166026�0007211 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2007-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_EVENTFD_H #define _SYS_EVENTFD_H 1 #include <stdint.h> /* Get the platform-dependent flags. */ #include <bits/eventfd.h> /* Type for event counter. */ typedef uint64_t eventfd_t; __BEGIN_DECLS /* Return file descriptor for generic event channel. Set initial value to COUNT. */ extern int eventfd (int __count, int __flags) __THROW; /* Read event counter and possibly wait for events. */ extern int eventfd_read (int __fd, eventfd_t *__value); /* Increment event counter. */ extern int eventfd_write (int __fd, eventfd_t __value); __END_DECLS #endif /* sys/eventfd.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������sys/ttydefaults.h�����������������������������������������������������������������������������������0000644�����������������00000006760�14763166026�0010127 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*- * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94 */ /* * System wide defaults for terminal state. Linux version. */ #ifndef _SYS_TTYDEFAULTS_H_ #define _SYS_TTYDEFAULTS_H_ /* * Defaults on "first" open. */ #define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY) #define TTYDEF_OFLAG (OPOST | ONLCR | XTABS) #define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL) #define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL) #define TTYDEF_SPEED (B9600) /* * Control Character Defaults */ #define CTRL(x) (x&037) #define CEOF CTRL('d') #ifdef _POSIX_VDISABLE # define CEOL _POSIX_VDISABLE #else # define CEOL '\0' /* XXX avoid _POSIX_VDISABLE */ #endif #define CERASE 0177 #define CINTR CTRL('c') #ifdef _POSIX_VDISABLE # define CSTATUS _POSIX_VDISABLE #else # define CSTATUS '\0' /* XXX avoid _POSIX_VDISABLE */ #endif #define CKILL CTRL('u') #define CMIN 1 #define CQUIT 034 /* FS, ^\ */ #define CSUSP CTRL('z') #define CTIME 0 #define CDSUSP CTRL('y') #define CSTART CTRL('q') #define CSTOP CTRL('s') #define CLNEXT CTRL('v') #define CDISCARD CTRL('o') #define CWERASE CTRL('w') #define CREPRINT CTRL('r') #define CEOT CEOF /* compat */ #define CBRK CEOL #define CRPRNT CREPRINT #define CFLUSH CDISCARD /* PROTECTED INCLUSION ENDS HERE */ #endif /* !_SYS_TTYDEFAULTS_H_ */ /* * #define TTYDEFCHARS to include an array of default control characters. */ #ifdef TTYDEFCHARS cc_t ttydefchars[NCCS] = { CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT, _POSIX_VDISABLE, CINTR, CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT, CDISCARD, CMIN, CTIME, CSTATUS, _POSIX_VDISABLE }; #undef TTYDEFCHARS #endif ����������������sys/perm.h������������������������������������������������������������������������������������������0000644�����������������00000002155�14763166026�0006514 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996, 1999, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_PERM_H #define _SYS_PERM_H 1 #include <features.h> __BEGIN_DECLS /* Set port input/output permissions. */ extern int ioperm (unsigned long int __from, unsigned long int __num, int __turn_on) __THROW; /* Change I/O privilege level. */ extern int iopl (int __level) __THROW; __END_DECLS #endif /* _SYS_PERM_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/kd.h��������������������������������������������������������������������������������������������0000644�����������������00000002136�14763166026�0006146 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_KD_H #define _SYS_KD_H 1 /* Make sure the <linux/types.h> header is not loaded. */ #ifndef _LINUX_TYPES_H # define _LINUX_TYPES_H 1 # define __undef_LINUX_TYPES_H #endif #include <linux/kd.h> #ifdef __undef_LINUX_TYPES_H # undef _LINUX_TYPES_H # undef __undef_LINUX_TYPES_H #endif #endif /* sys/kd.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/vlimit.h����������������������������������������������������������������������������������������0000644�����������������00000003544�14763166026�0007060 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991, 1992, 1996, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_VLIMIT_H #define _SYS_VLIMIT_H 1 #include <features.h> __BEGIN_DECLS /* This interface is obsolete, and is superseded by <sys/resource.h>. */ /* Kinds of resource limit. */ enum __vlimit_resource { /* Setting this non-zero makes it impossible to raise limits. Only the super-use can set it to zero. This is not implemented in recent versions of BSD, nor by the GNU C library. */ LIM_NORAISE, /* CPU time available for each process (seconds). */ LIM_CPU, /* Largest file which can be created (bytes). */ LIM_FSIZE, /* Maximum size of the data segment (bytes). */ LIM_DATA, /* Maximum size of the stack segment (bytes). */ LIM_STACK, /* Largest core file that will be created (bytes). */ LIM_CORE, /* Resident set size (bytes). */ LIM_MAXRSS }; /* This means no limit. */ #define INFINITY 0x7fffffff /* Set the soft limit for RESOURCE to be VALUE. Returns 0 for success, -1 for failure. */ extern int vlimit (enum __vlimit_resource __resource, int __value) __THROW; __END_DECLS #endif /* sys/vlimit.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������sys/syscall.h���������������������������������������������������������������������������������������0000644�����������������00000002504�14763166026�0007221 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1995, 1996, 1997, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYSCALL_H #define _SYSCALL_H 1 /* This file should list the numbers of the system calls the system knows. But instead of duplicating this we use the information available from the kernel sources. */ #include <asm/unistd.h> #ifndef _LIBC /* The Linux kernel header file defines macros `__NR_<name>', but some programs expect the traditional form `SYS_<name>'. So in building libc we scan the kernel's list and produce <bits/syscall.h> with macros for all the `SYS_' names. */ # include <bits/syscall.h> #endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/select.h����������������������������������������������������������������������������������������0000644�����������������00000010155�14763166026�0007027 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* `fd_set' type and related macros, and `select'/`pselect' declarations. Copyright (C) 1996-2003, 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* POSIX 1003.1g: 6.2 Select from File Descriptor Sets <sys/select.h> */ #ifndef _SYS_SELECT_H #define _SYS_SELECT_H 1 #include <features.h> /* Get definition of needed basic types. */ #include <bits/types.h> /* Get __FD_* definitions. */ #include <bits/select.h> /* Get __sigset_t. */ #include <bits/sigset.h> #ifndef __sigset_t_defined # define __sigset_t_defined typedef __sigset_t sigset_t; #endif /* Get definition of timer specification structures. */ #define __need_time_t #define __need_timespec #include <time.h> #define __need_timeval #include <bits/time.h> #ifndef __suseconds_t_defined typedef __suseconds_t suseconds_t; # define __suseconds_t_defined #endif /* The fd_set member is required to be an array of longs. */ typedef long int __fd_mask; /* Some versions of <linux/posix_types.h> define this macros. */ #undef __NFDBITS /* It's easier to assume 8-bit bytes than to get CHAR_BIT. */ #define __NFDBITS (8 * (int) sizeof (__fd_mask)) #define __FD_ELT(d) ((d) / __NFDBITS) #define __FD_MASK(d) ((__fd_mask) 1 << ((d) % __NFDBITS)) /* fd_set for select and pselect. */ typedef struct { /* XPG4.2 requires this member name. Otherwise avoid the name from the global namespace. */ #ifdef __USE_XOPEN __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS]; # define __FDS_BITS(set) ((set)->fds_bits) #else __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS]; # define __FDS_BITS(set) ((set)->__fds_bits) #endif } fd_set; /* Maximum number of file descriptors in `fd_set'. */ #define FD_SETSIZE __FD_SETSIZE #ifdef __USE_MISC /* Sometimes the fd_set member is assumed to have this type. */ typedef __fd_mask fd_mask; /* Number of bits per word of `fd_set' (some code assumes this is 32). */ # define NFDBITS __NFDBITS #endif /* Access macros for `fd_set'. */ #define FD_SET(fd, fdsetp) __FD_SET (fd, fdsetp) #define FD_CLR(fd, fdsetp) __FD_CLR (fd, fdsetp) #define FD_ISSET(fd, fdsetp) __FD_ISSET (fd, fdsetp) #define FD_ZERO(fdsetp) __FD_ZERO (fdsetp) __BEGIN_DECLS /* Check the first NFDS descriptors each in READFDS (if not NULL) for read readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS (if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out after waiting the interval specified therein. Returns the number of ready descriptors, or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern int select (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, struct timeval *__restrict __timeout); #ifdef __USE_XOPEN2K /* Same as above only that the TIMEOUT value is given with higher resolution and a sigmask which is been set temporarily. This version should be used. This function is a cancellation point and therefore not marked with __THROW. */ extern int pselect (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, const struct timespec *__restrict __timeout, const __sigset_t *__restrict __sigmask); #endif /* Define some inlines helping to catch common problems. */ #if __USE_FORTIFY_LEVEL > 0 && defined __GNUC__ # include <bits/select2.h> #endif __END_DECLS #endif /* sys/select.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/timex.h�����������������������������������������������������������������������������������������0000644�����������������00000004221�14763166026�0006673 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1995-1997,1999,2007,2009,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_TIMEX_H #define _SYS_TIMEX_H 1 #include <features.h> #include <sys/time.h> /* These definitions from linux/timex.h as of 2.6.30. */ #include <bits/timex.h> #define NTP_API 4 /* NTP API version */ struct ntptimeval { struct timeval time; /* current time (ro) */ long int maxerror; /* maximum error (us) (ro) */ long int esterror; /* estimated error (us) (ro) */ long int tai; /* TAI offset (ro) */ long int __unused1; long int __unused2; long int __unused3; long int __unused4; }; /* Clock states (time_state) */ #define TIME_OK 0 /* clock synchronized, no leap second */ #define TIME_INS 1 /* insert leap second */ #define TIME_DEL 2 /* delete leap second */ #define TIME_OOP 3 /* leap second in progress */ #define TIME_WAIT 4 /* leap second has occurred */ #define TIME_ERROR 5 /* clock not synchronized */ #define TIME_BAD TIME_ERROR /* bw compat */ /* Maximum time constant of the PLL. */ #define MAXTC 6 __BEGIN_DECLS extern int __adjtimex (struct timex *__ntx) __THROW; extern int adjtimex (struct timex *__ntx) __THROW; #ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv), ntp_gettimex); #else extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW; # define ntp_gettime ntp_gettimex #endif extern int ntp_adjtime (struct timex *__tntx) __THROW; __END_DECLS #endif /* sys/timex.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/termios.h���������������������������������������������������������������������������������������0000644�����������������00000000112�14763166026�0007222 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SYS_TERMIOS_H #define _SYS_TERMIOS_H #include <termios.h> #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/unistd.h����������������������������������������������������������������������������������������0000644�����������������00000000024�14763166026�0007050 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <unistd.h> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/sysinfo.h���������������������������������������������������������������������������������������0000644�����������������00000002764�14763166026�0007251 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996, 1999, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SYSINFO_H #define _SYS_SYSINFO_H 1 #include <features.h> /* Get sysinfo structure from kernel header. */ #include <linux/kernel.h> __BEGIN_DECLS /* Returns information on overall system statistics. */ extern int sysinfo (struct sysinfo *__info) __THROW; /* Return number of configured processors. */ extern int get_nprocs_conf (void) __THROW; /* Return number of available processors. */ extern int get_nprocs (void) __THROW; /* Return number of physical pages of memory in the system. */ extern long int get_phys_pages (void) __THROW; /* Return number of available physical pages of memory in the system. */ extern long int get_avphys_pages (void) __THROW; __END_DECLS #endif /* sys/sysinfo.h */ ������������sys/param.h�����������������������������������������������������������������������������������������0000644�����������������00000005726�14763166026�0006660 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Compatibility header for old-style Unix parameters and limits. Copyright (C) 1995-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_PARAM_H #define _SYS_PARAM_H 1 #define __need_NULL #include <stddef.h> #include <sys/types.h> #include <limits.h> #include <endian.h> /* Define BYTE_ORDER et al. */ #include <signal.h> /* Define NSIG. */ /* This file defines some things in system-specific ways. */ #include <bits/param.h> /* BSD names for some <limits.h> values. */ #define NBBY CHAR_BIT #if !defined NGROUPS && defined NGROUPS_MAX # define NGROUPS NGROUPS_MAX #endif #if !defined MAXSYMLINKS && defined SYMLOOP_MAX # define MAXSYMLINKS SYMLOOP_MAX #endif #if !defined CANBSIZ && defined MAX_CANON # define CANBSIZ MAX_CANON #endif #if !defined MAXPATHLEN && defined PATH_MAX # define MAXPATHLEN PATH_MAX #endif #if !defined NOFILE && defined OPEN_MAX # define NOFILE OPEN_MAX #endif #ifndef NCARGS # ifdef ARG_MAX # define NCARGS ARG_MAX # else /* ARG_MAX is unlimited, but we define NCARGS for BSD programs that want to compare against some fixed limit. */ # define NCARGS INT_MAX # endif #endif /* Magical constants. */ #ifndef NOGROUP # define NOGROUP 65535 /* Marker for empty group set member. */ #endif #ifndef NODEV # define NODEV ((dev_t) -1) /* Non-existent device. */ #endif /* Unit of `st_blocks'. */ #define DEV_BSIZE 512 /* Bit map related macros. */ #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) /* Macros for counting and rounding. */ #ifndef howmany # define howmany(x, y) (((x) + ((y) - 1)) / (y)) #endif #ifdef __GNUC__ # define roundup(x, y) (__builtin_constant_p (y) && powerof2 (y) \ ? (((x) + (y) - 1) & ~((y) - 1)) \ : ((((x) + ((y) - 1)) / (y)) * (y))) #else # define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) #endif #define powerof2(x) ((((x) - 1) & (x)) == 0) /* Macros for min/max. */ #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) #endif /* sys/param.h */ ������������������������������������������sys/klog.h������������������������������������������������������������������������������������������0000644�����������������00000002264�14763166026�0006506 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_KLOG_H #define _SYS_KLOG_H 1 #include <features.h> __BEGIN_DECLS /* Control the kernel's logging facility. This corresponds exactly to the kernel's syslog system call, but that name is easily confused with the user-level syslog facility, which is something completely different. */ extern int klogctl (int __type, char *__bufp, int __len) __THROW; __END_DECLS #endif /* _SYS_KLOG_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/socketvar.h�������������������������������������������������������������������������������������0000644�����������������00000000215�14763166026�0007545 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* This header is used on many systems but for GNU we have everything already defined in the standard header. */ #include <sys/socket.h> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/resource.h��������������������������������������������������������������������������������������0000644�����������������00000007127�14763166026�0007404 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1992,94,1996-2000,2002,2004,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_RESOURCE_H #define _SYS_RESOURCE_H 1 #include <features.h> /* Get the system-dependent definitions of structures and bit values. */ #include <bits/resource.h> #ifndef __id_t_defined typedef __id_t id_t; # define __id_t_defined #endif __BEGIN_DECLS /* The X/Open standard defines that all the functions below must use `int' as the type for the first argument. When we are compiling with GNU extensions we change this slightly to provide better error checking. */ #if defined __USE_GNU && !defined __cplusplus typedef enum __rlimit_resource __rlimit_resource_t; typedef enum __rusage_who __rusage_who_t; typedef enum __priority_which __priority_which_t; #else typedef int __rlimit_resource_t; typedef int __rusage_who_t; typedef int __priority_which_t; #endif /* Put the soft and hard limits for RESOURCE in *RLIMITS. Returns 0 if successful, -1 if not (and sets errno). */ #ifndef __USE_FILE_OFFSET64 extern int getrlimit (__rlimit_resource_t __resource, struct rlimit *__rlimits) __THROW; #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (getrlimit, (__rlimit_resource_t __resource, struct rlimit *__rlimits), getrlimit64); # else # define getrlimit getrlimit64 # endif #endif #ifdef __USE_LARGEFILE64 extern int getrlimit64 (__rlimit_resource_t __resource, struct rlimit64 *__rlimits) __THROW; #endif /* Set the soft and hard limits for RESOURCE to *RLIMITS. Only the super-user can increase hard limits. Return 0 if successful, -1 if not (and sets errno). */ #ifndef __USE_FILE_OFFSET64 extern int setrlimit (__rlimit_resource_t __resource, const struct rlimit *__rlimits) __THROW; #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (setrlimit, (__rlimit_resource_t __resource, const struct rlimit *__rlimits), setrlimit64); # else # define setrlimit setrlimit64 # endif #endif #ifdef __USE_LARGEFILE64 extern int setrlimit64 (__rlimit_resource_t __resource, const struct rlimit64 *__rlimits) __THROW; #endif /* Return resource usage information on process indicated by WHO and put it in *USAGE. Returns 0 for success, -1 for failure. */ extern int getrusage (__rusage_who_t __who, struct rusage *__usage) __THROW; /* Return the highest priority of any process specified by WHICH and WHO (see above); if WHO is zero, the current process, process group, or user (as specified by WHO) is used. A lower priority number means higher priority. Priorities range from PRIO_MIN to PRIO_MAX (above). */ extern int getpriority (__priority_which_t __which, id_t __who) __THROW; /* Set the priority of all processes specified by WHICH and WHO (see above) to PRIO. Returns 0 on success, -1 on errors. */ extern int setpriority (__priority_which_t __which, id_t __who, int __prio) __THROW; __END_DECLS #endif /* sys/resource.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/mtio.h������������������������������������������������������������������������������������������0000644�����������������00000025633�14763166026�0006527 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Structures and definitions for magnetic tape I/O control commands. Copyright (C) 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* Written by H. Bergman <hennus@cybercomm.nl>. */ #ifndef _SYS_MTIO_H #define _SYS_MTIO_H 1 /* Get necessary definitions from system and kernel headers. */ #include <sys/types.h> #include <sys/ioctl.h> /* Structure for MTIOCTOP - magnetic tape operation command. */ struct mtop { short int mt_op; /* Operations defined below. */ int mt_count; /* How many of them. */ }; #define _IOT_mtop /* Hurd ioctl type field. */ \ _IOT (_IOTS (short), 1, _IOTS (int), 1, 0, 0) /* Magnetic Tape operations [Not all operations supported by all drivers]. */ #define MTRESET 0 /* +reset drive in case of problems. */ #define MTFSF 1 /* Forward space over FileMark, * position at first record of next file. */ #define MTBSF 2 /* Backward space FileMark (position before FM). */ #define MTFSR 3 /* Forward space record. */ #define MTBSR 4 /* Backward space record. */ #define MTWEOF 5 /* Write an end-of-file record (mark). */ #define MTREW 6 /* Rewind. */ #define MTOFFL 7 /* Rewind and put the drive offline (eject?). */ #define MTNOP 8 /* No op, set status only (read with MTIOCGET). */ #define MTRETEN 9 /* Retension tape. */ #define MTBSFM 10 /* +backward space FileMark, position at FM. */ #define MTFSFM 11 /* +forward space FileMark, position at FM. */ #define MTEOM 12 /* Goto end of recorded media (for appending files). MTEOM positions after the last FM, ready for appending another file. */ #define MTERASE 13 /* Erase tape -- be careful! */ #define MTRAS1 14 /* Run self test 1 (nondestructive). */ #define MTRAS2 15 /* Run self test 2 (destructive). */ #define MTRAS3 16 /* Reserved for self test 3. */ #define MTSETBLK 20 /* Set block length (SCSI). */ #define MTSETDENSITY 21 /* Set tape density (SCSI). */ #define MTSEEK 22 /* Seek to block (Tandberg, etc.). */ #define MTTELL 23 /* Tell block (Tandberg, etc.). */ #define MTSETDRVBUFFER 24 /* Set the drive buffering according to SCSI-2. Ordinary buffered operation with code 1. */ #define MTFSS 25 /* Space forward over setmarks. */ #define MTBSS 26 /* Space backward over setmarks. */ #define MTWSM 27 /* Write setmarks. */ #define MTLOCK 28 /* Lock the drive door. */ #define MTUNLOCK 29 /* Unlock the drive door. */ #define MTLOAD 30 /* Execute the SCSI load command. */ #define MTUNLOAD 31 /* Execute the SCSI unload command. */ #define MTCOMPRESSION 32/* Control compression with SCSI mode page 15. */ #define MTSETPART 33 /* Change the active tape partition. */ #define MTMKPART 34 /* Format the tape with one or two partitions. */ /* structure for MTIOCGET - mag tape get status command */ struct mtget { long int mt_type; /* Type of magtape device. */ long int mt_resid; /* Residual count: (not sure) number of bytes ignored, or number of files not skipped, or number of records not skipped. */ /* The following registers are device dependent. */ long int mt_dsreg; /* Status register. */ long int mt_gstat; /* Generic (device independent) status. */ long int mt_erreg; /* Error register. */ /* The next two fields are not always used. */ __daddr_t mt_fileno; /* Number of current file on tape. */ __daddr_t mt_blkno; /* Current block number. */ }; #define _IOT_mtget /* Hurd ioctl type field. */ \ _IOT (_IOTS (long), 7, 0, 0, 0, 0) /* Constants for mt_type. Not all of these are supported, and these are not all of the ones that are supported. */ #define MT_ISUNKNOWN 0x01 #define MT_ISQIC02 0x02 /* Generic QIC-02 tape streamer. */ #define MT_ISWT5150 0x03 /* Wangtek 5150EQ, QIC-150, QIC-02. */ #define MT_ISARCHIVE_5945L2 0x04 /* Archive 5945L-2, QIC-24, QIC-02?. */ #define MT_ISCMSJ500 0x05 /* CMS Jumbo 500 (QIC-02?). */ #define MT_ISTDC3610 0x06 /* Tandberg 6310, QIC-24. */ #define MT_ISARCHIVE_VP60I 0x07 /* Archive VP60i, QIC-02. */ #define MT_ISARCHIVE_2150L 0x08 /* Archive Viper 2150L. */ #define MT_ISARCHIVE_2060L 0x09 /* Archive Viper 2060L. */ #define MT_ISARCHIVESC499 0x0A /* Archive SC-499 QIC-36 controller. */ #define MT_ISQIC02_ALL_FEATURES 0x0F /* Generic QIC-02 with all features. */ #define MT_ISWT5099EEN24 0x11 /* Wangtek 5099-een24, 60MB, QIC-24. */ #define MT_ISTEAC_MT2ST 0x12 /* Teac MT-2ST 155mb drive, Teac DC-1 card (Wangtek type). */ #define MT_ISEVEREX_FT40A 0x32 /* Everex FT40A (QIC-40). */ #define MT_ISDDS1 0x51 /* DDS device without partitions. */ #define MT_ISDDS2 0x52 /* DDS device with partitions. */ #define MT_ISSCSI1 0x71 /* Generic ANSI SCSI-1 tape unit. */ #define MT_ISSCSI2 0x72 /* Generic ANSI SCSI-2 tape unit. */ /* QIC-40/80/3010/3020 ftape supported drives. 20bit vendor ID + 0x800000 (see vendors.h in ftape distribution). */ #define MT_ISFTAPE_UNKNOWN 0x800000 /* obsolete */ #define MT_ISFTAPE_FLAG 0x800000 struct mt_tape_info { long int t_type; /* Device type id (mt_type). */ char *t_name; /* Descriptive name. */ }; #define MT_TAPE_INFO \ { \ {MT_ISUNKNOWN, "Unknown type of tape device"}, \ {MT_ISQIC02, "Generic QIC-02 tape streamer"}, \ {MT_ISWT5150, "Wangtek 5150, QIC-150"}, \ {MT_ISARCHIVE_5945L2, "Archive 5945L-2"}, \ {MT_ISCMSJ500, "CMS Jumbo 500"}, \ {MT_ISTDC3610, "Tandberg TDC 3610, QIC-24"}, \ {MT_ISARCHIVE_VP60I, "Archive VP60i, QIC-02"}, \ {MT_ISARCHIVE_2150L, "Archive Viper 2150L"}, \ {MT_ISARCHIVE_2060L, "Archive Viper 2060L"}, \ {MT_ISARCHIVESC499, "Archive SC-499 QIC-36 controller"}, \ {MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"}, \ {MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, \ {MT_ISTEAC_MT2ST, "Teac MT-2ST 155mb data cassette drive"}, \ {MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, \ {MT_ISSCSI1, "Generic SCSI-1 tape"}, \ {MT_ISSCSI2, "Generic SCSI-2 tape"}, \ {0, NULL} \ } /* Structure for MTIOCPOS - mag tape get position command. */ struct mtpos { long int mt_blkno; /* Current block number. */ }; #define _IOT_mtpos /* Hurd ioctl type field. */ \ _IOT_SIMPLE (long) /* Structure for MTIOCGETCONFIG/MTIOCSETCONFIG primarily intended as an interim solution for QIC-02 until DDI is fully implemented. */ struct mtconfiginfo { long int mt_type; /* Drive type. */ long int ifc_type; /* Interface card type. */ unsigned short int irqnr; /* IRQ number to use. */ unsigned short int dmanr; /* DMA channel to use. */ unsigned short int port; /* IO port base address. */ unsigned long int debug; /* Debugging flags. */ unsigned have_dens:1; unsigned have_bsf:1; unsigned have_fsr:1; unsigned have_bsr:1; unsigned have_eod:1; unsigned have_seek:1; unsigned have_tell:1; unsigned have_ras1:1; unsigned have_ras2:1; unsigned have_ras3:1; unsigned have_qfa:1; unsigned pad1:5; char reserved[10]; }; #define _IOT_mtconfiginfo /* Hurd ioctl type field. */ \ _IOT (_IOTS (long), 2, _IOTS (short), 3, _IOTS (long), 1) /* XXX wrong */ /* Magnetic tape I/O control commands. */ #define MTIOCTOP _IOW('m', 1, struct mtop) /* Do a mag tape op. */ #define MTIOCGET _IOR('m', 2, struct mtget) /* Get tape status. */ #define MTIOCPOS _IOR('m', 3, struct mtpos) /* Get tape position.*/ /* The next two are used by the QIC-02 driver for runtime reconfiguration. See tpqic02.h for struct mtconfiginfo. */ #define MTIOCGETCONFIG _IOR('m', 4, struct mtconfiginfo) /* Get tape config.*/ #define MTIOCSETCONFIG _IOW('m', 5, struct mtconfiginfo) /* Set tape config.*/ /* Generic Mag Tape (device independent) status macros for examining mt_gstat -- HP-UX compatible. There is room for more generic status bits here, but I don't know which of them are reserved. At least three or so should be added to make this really useful. */ #define GMT_EOF(x) ((x) & 0x80000000) #define GMT_BOT(x) ((x) & 0x40000000) #define GMT_EOT(x) ((x) & 0x20000000) #define GMT_SM(x) ((x) & 0x10000000) /* DDS setmark */ #define GMT_EOD(x) ((x) & 0x08000000) /* DDS EOD */ #define GMT_WR_PROT(x) ((x) & 0x04000000) /* #define GMT_ ? ((x) & 0x02000000) */ #define GMT_ONLINE(x) ((x) & 0x01000000) #define GMT_D_6250(x) ((x) & 0x00800000) #define GMT_D_1600(x) ((x) & 0x00400000) #define GMT_D_800(x) ((x) & 0x00200000) /* #define GMT_ ? ((x) & 0x00100000) */ /* #define GMT_ ? ((x) & 0x00080000) */ #define GMT_DR_OPEN(x) ((x) & 0x00040000) /* Door open (no tape). */ /* #define GMT_ ? ((x) & 0x00020000) */ #define GMT_IM_REP_EN(x) ((x) & 0x00010000) /* Immediate report mode.*/ /* 16 generic status bits unused. */ /* SCSI-tape specific definitions. Bitfield shifts in the status */ #define MT_ST_BLKSIZE_SHIFT 0 #define MT_ST_BLKSIZE_MASK 0xffffff #define MT_ST_DENSITY_SHIFT 24 #define MT_ST_DENSITY_MASK 0xff000000 #define MT_ST_SOFTERR_SHIFT 0 #define MT_ST_SOFTERR_MASK 0xffff /* Bitfields for the MTSETDRVBUFFER ioctl. */ #define MT_ST_OPTIONS 0xf0000000 #define MT_ST_BOOLEANS 0x10000000 #define MT_ST_SETBOOLEANS 0x30000000 #define MT_ST_CLEARBOOLEANS 0x40000000 #define MT_ST_WRITE_THRESHOLD 0x20000000 #define MT_ST_DEF_BLKSIZE 0x50000000 #define MT_ST_DEF_OPTIONS 0x60000000 #define MT_ST_BUFFER_WRITES 0x1 #define MT_ST_ASYNC_WRITES 0x2 #define MT_ST_READ_AHEAD 0x4 #define MT_ST_DEBUGGING 0x8 #define MT_ST_TWO_FM 0x10 #define MT_ST_FAST_MTEOM 0x20 #define MT_ST_AUTO_LOCK 0x40 #define MT_ST_DEF_WRITES 0x80 #define MT_ST_CAN_BSR 0x100 #define MT_ST_NO_BLKLIMS 0x200 #define MT_ST_CAN_PARTITIONS 0x400 #define MT_ST_SCSI2LOGICAL 0x800 /* The mode parameters to be controlled. Parameter chosen with bits 20-28. */ #define MT_ST_CLEAR_DEFAULT 0xfffff #define MT_ST_DEF_DENSITY (MT_ST_DEF_OPTIONS | 0x100000) #define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000) #define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000) /* The offset for the arguments for the special HP changer load command. */ #define MT_ST_HPLOADER_OFFSET 10000 /* Specify default tape device. */ #ifndef DEFTAPE # define DEFTAPE "/dev/tape" #endif #endif /* mtio.h */ �����������������������������������������������������������������������������������������������������sys/swap.h������������������������������������������������������������������������������������������0000644�����������������00000003113�14763166026�0006516 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Calls to enable and disable swapping on specified locations. Linux version. Copyright (C) 1996, 1998, 1999, 2010, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SWAP_H #define _SYS_SWAP_H 1 #include <features.h> /* The swap priority is encoded as: (prio << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK */ #define SWAP_FLAG_PREFER 0x8000 /* Set if swap priority is specified. */ #define SWAP_FLAG_PRIO_MASK 0x7fff #define SWAP_FLAG_PRIO_SHIFT 0 #define SWAP_FLAG_DISCARD 0x10000 /* Discard swap cluster after use. */ __BEGIN_DECLS /* Make the block special device PATH available to the system for swapping. This call is restricted to the super-user. */ extern int swapon (const char *__path, int __flags) __THROW; /* Stop using block special device PATH for swapping. */ extern int swapoff (const char *__path) __THROW; __END_DECLS #endif /* _SYS_SWAP_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/statfs.h����������������������������������������������������������������������������������������0000644�����������������00000004071�14763166026�0007054 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Definitions for getting information about a filesystem. Copyright (C) 1996-1999, 2004, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_STATFS_H #define _SYS_STATFS_H 1 #include <features.h> /* Get the system-specific definition of `struct statfs'. */ #include <bits/statfs.h> __BEGIN_DECLS /* Return information about the filesystem on which FILE resides. */ #ifndef __USE_FILE_OFFSET64 extern int statfs (const char *__file, struct statfs *__buf) __THROW __nonnull ((1, 2)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (statfs, (const char *__file, struct statfs *__buf), statfs64) __nonnull ((1, 2)); # else # define statfs statfs64 # endif #endif #ifdef __USE_LARGEFILE64 extern int statfs64 (const char *__file, struct statfs64 *__buf) __THROW __nonnull ((1, 2)); #endif /* Return information about the filesystem containing the file FILDES refers to. */ #ifndef __USE_FILE_OFFSET64 extern int fstatfs (int __fildes, struct statfs *__buf) __THROW __nonnull ((2)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (fstatfs, (int __fildes, struct statfs *__buf), fstatfs64) __nonnull ((2)); # else # define fstatfs fstatfs64 # endif #endif #ifdef __USE_LARGEFILE64 extern int fstatfs64 (int __fildes, struct statfs64 *__buf) __THROW __nonnull ((2)); #endif __END_DECLS #endif /* sys/statfs.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/acct.h������������������������������������������������������������������������������������������0000644�����������������00000006403�14763166026�0006463 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996-1999, 2007, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_ACCT_H #define _SYS_ACCT_H 1 #include <features.h> #include <endian.h> #define __need_time_t #include <time.h> #include <sys/types.h> __BEGIN_DECLS #define ACCT_COMM 16 /* comp_t is a 16-bit "floating" point number with a 3-bit base 8 exponent and a 13-bit fraction. See linux/kernel/acct.c for the specific encoding system used. */ typedef u_int16_t comp_t; struct acct { char ac_flag; /* Flags. */ u_int16_t ac_uid; /* Real user ID. */ u_int16_t ac_gid; /* Real group ID. */ u_int16_t ac_tty; /* Controlling terminal. */ u_int32_t ac_btime; /* Beginning time. */ comp_t ac_utime; /* User time. */ comp_t ac_stime; /* System time. */ comp_t ac_etime; /* Elapsed time. */ comp_t ac_mem; /* Average memory usage. */ comp_t ac_io; /* Chars transferred. */ comp_t ac_rw; /* Blocks read or written. */ comp_t ac_minflt; /* Minor pagefaults. */ comp_t ac_majflt; /* Major pagefaults. */ comp_t ac_swaps; /* Number of swaps. */ u_int32_t ac_exitcode; /* Process exitcode. */ char ac_comm[ACCT_COMM+1]; /* Command name. */ char ac_pad[10]; /* Padding bytes. */ }; struct acct_v3 { char ac_flag; /* Flags */ char ac_version; /* Always set to ACCT_VERSION */ u_int16_t ac_tty; /* Control Terminal */ u_int32_t ac_exitcode; /* Exitcode */ u_int32_t ac_uid; /* Real User ID */ u_int32_t ac_gid; /* Real Group ID */ u_int32_t ac_pid; /* Process ID */ u_int32_t ac_ppid; /* Parent Process ID */ u_int32_t ac_btime; /* Process Creation Time */ float ac_etime; /* Elapsed Time */ comp_t ac_utime; /* User Time */ comp_t ac_stime; /* System Time */ comp_t ac_mem; /* Average Memory Usage */ comp_t ac_io; /* Chars Transferred */ comp_t ac_rw; /* Blocks Read or Written */ comp_t ac_minflt; /* Minor Pagefaults */ comp_t ac_majflt; /* Major Pagefaults */ comp_t ac_swaps; /* Number of Swaps */ char ac_comm[ACCT_COMM]; /* Command Name */ }; enum { AFORK = 0x01, /* Has executed fork, but no exec. */ ASU = 0x02, /* Used super-user privileges. */ ACORE = 0x08, /* Dumped core. */ AXSIG = 0x10 /* Killed by a signal. */ }; #if __BYTE_ORDER == __BIG_ENDIAN # define ACCT_BYTEORDER 0x80 /* Accounting file is big endian. */ #else # define ACCT_BYTEORDER 0x00 /* Accounting file is little endian. */ #endif #define AHZ 100 /* Switch process accounting on and off. */ extern int acct (const char *__filename) __THROW; __END_DECLS #endif /* sys/acct.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/ucontext.h��������������������������������������������������������������������������������������0000644�����������������00000012411�14763166026�0007416 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2001-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_UCONTEXT_H #define _SYS_UCONTEXT_H 1 #include <features.h> #include <signal.h> /* We need the signal context definitions even if they are not used included in <signal.h>. */ #include <bits/sigcontext.h> #ifdef __x86_64__ /* Type for general register. */ __extension__ typedef long long int greg_t; /* Number of general registers. */ #define NGREG 23 /* Container for all general registers. */ typedef greg_t gregset_t[NGREG]; #ifdef __USE_GNU /* Number of each register in the `gregset_t' array. */ enum { REG_R8 = 0, # define REG_R8 REG_R8 REG_R9, # define REG_R9 REG_R9 REG_R10, # define REG_R10 REG_R10 REG_R11, # define REG_R11 REG_R11 REG_R12, # define REG_R12 REG_R12 REG_R13, # define REG_R13 REG_R13 REG_R14, # define REG_R14 REG_R14 REG_R15, # define REG_R15 REG_R15 REG_RDI, # define REG_RDI REG_RDI REG_RSI, # define REG_RSI REG_RSI REG_RBP, # define REG_RBP REG_RBP REG_RBX, # define REG_RBX REG_RBX REG_RDX, # define REG_RDX REG_RDX REG_RAX, # define REG_RAX REG_RAX REG_RCX, # define REG_RCX REG_RCX REG_RSP, # define REG_RSP REG_RSP REG_RIP, # define REG_RIP REG_RIP REG_EFL, # define REG_EFL REG_EFL REG_CSGSFS, /* Actually short cs, gs, fs, __pad0. */ # define REG_CSGSFS REG_CSGSFS REG_ERR, # define REG_ERR REG_ERR REG_TRAPNO, # define REG_TRAPNO REG_TRAPNO REG_OLDMASK, # define REG_OLDMASK REG_OLDMASK REG_CR2 # define REG_CR2 REG_CR2 }; #endif struct _libc_fpxreg { unsigned short int significand[4]; unsigned short int exponent; unsigned short int padding[3]; }; struct _libc_xmmreg { __uint32_t element[4]; }; struct _libc_fpstate { /* 64-bit FXSAVE format. */ __uint16_t cwd; __uint16_t swd; __uint16_t ftw; __uint16_t fop; __uint64_t rip; __uint64_t rdp; __uint32_t mxcsr; __uint32_t mxcr_mask; struct _libc_fpxreg _st[8]; struct _libc_xmmreg _xmm[16]; __uint32_t padding[24]; }; /* Structure to describe FPU registers. */ typedef struct _libc_fpstate *fpregset_t; /* Context to describe whole processor state. */ typedef struct { gregset_t gregs; /* Note that fpregs is a pointer. */ fpregset_t fpregs; __extension__ unsigned long long __reserved1 [8]; } mcontext_t; /* Userlevel context. */ typedef struct ucontext { unsigned long int uc_flags; struct ucontext *uc_link; stack_t uc_stack; mcontext_t uc_mcontext; __sigset_t uc_sigmask; struct _libc_fpstate __fpregs_mem; } ucontext_t; #else /* !__x86_64__ */ /* Type for general register. */ typedef int greg_t; /* Number of general registers. */ #define NGREG 19 /* Container for all general registers. */ typedef greg_t gregset_t[NGREG]; #ifdef __USE_GNU /* Number of each register is the `gregset_t' array. */ enum { REG_GS = 0, # define REG_GS REG_GS REG_FS, # define REG_FS REG_FS REG_ES, # define REG_ES REG_ES REG_DS, # define REG_DS REG_DS REG_EDI, # define REG_EDI REG_EDI REG_ESI, # define REG_ESI REG_ESI REG_EBP, # define REG_EBP REG_EBP REG_ESP, # define REG_ESP REG_ESP REG_EBX, # define REG_EBX REG_EBX REG_EDX, # define REG_EDX REG_EDX REG_ECX, # define REG_ECX REG_ECX REG_EAX, # define REG_EAX REG_EAX REG_TRAPNO, # define REG_TRAPNO REG_TRAPNO REG_ERR, # define REG_ERR REG_ERR REG_EIP, # define REG_EIP REG_EIP REG_CS, # define REG_CS REG_CS REG_EFL, # define REG_EFL REG_EFL REG_UESP, # define REG_UESP REG_UESP REG_SS # define REG_SS REG_SS }; #endif /* Definitions taken from the kernel headers. */ struct _libc_fpreg { unsigned short int significand[4]; unsigned short int exponent; }; struct _libc_fpstate { unsigned long int cw; unsigned long int sw; unsigned long int tag; unsigned long int ipoff; unsigned long int cssel; unsigned long int dataoff; unsigned long int datasel; struct _libc_fpreg _st[8]; unsigned long int status; }; /* Structure to describe FPU registers. */ typedef struct _libc_fpstate *fpregset_t; /* Context to describe whole processor state. */ typedef struct { gregset_t gregs; /* Due to Linux's history we have to use a pointer here. The SysV/i386 ABI requires a struct with the values. */ fpregset_t fpregs; unsigned long int oldmask; unsigned long int cr2; } mcontext_t; /* Userlevel context. */ typedef struct ucontext { unsigned long int uc_flags; struct ucontext *uc_link; stack_t uc_stack; mcontext_t uc_mcontext; __sigset_t uc_sigmask; struct _libc_fpstate __fpregs_mem; } ucontext_t; #endif /* !__x86_64__ */ #endif /* sys/ucontext.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/socket.h����������������������������������������������������������������������������������������0000644�����������������00000024363�14763166026�0007046 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Declarations of socket constants, types, and functions. Copyright (C) 1991,92,1994-2001,2003,2005,2007,2008,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SOCKET_H #define _SYS_SOCKET_H 1 #include <features.h> __BEGIN_DECLS #include <sys/uio.h> #define __need_size_t #include <stddef.h> #ifdef __USE_GNU /* Get the __sigset_t definition. */ # include <bits/sigset.h> #endif /* This operating system-specific header file defines the SOCK_*, PF_*, AF_*, MSG_*, SOL_*, and SO_* constants, and the `struct sockaddr', `struct msghdr', and `struct linger' types. */ #include <bits/socket.h> #ifdef __USE_BSD /* This is the 4.3 BSD `struct sockaddr' format, which is used as wire format in the grotty old 4.3 `talk' protocol. */ struct osockaddr { unsigned short int sa_family; unsigned char sa_data[14]; }; #endif /* The following constants should be used for the second parameter of `shutdown'. */ enum { SHUT_RD = 0, /* No more receptions. */ #define SHUT_RD SHUT_RD SHUT_WR, /* No more transmissions. */ #define SHUT_WR SHUT_WR SHUT_RDWR /* No more receptions or transmissions. */ #define SHUT_RDWR SHUT_RDWR }; /* This is the type we use for generic socket address arguments. With GCC 2.7 and later, the funky union causes redeclarations or uses with any of the listed types to be allowed without complaint. G++ 2.7 does not support transparent unions so there we want the old-style declaration, too. */ #if defined __cplusplus || !__GNUC_PREREQ (2, 7) || !defined __USE_GNU # define __SOCKADDR_ARG struct sockaddr *__restrict # define __CONST_SOCKADDR_ARG const struct sockaddr * #else /* Add more `struct sockaddr_AF' types here as necessary. These are all the ones I found on NetBSD and Linux. */ # define __SOCKADDR_ALLTYPES \ __SOCKADDR_ONETYPE (sockaddr) \ __SOCKADDR_ONETYPE (sockaddr_at) \ __SOCKADDR_ONETYPE (sockaddr_ax25) \ __SOCKADDR_ONETYPE (sockaddr_dl) \ __SOCKADDR_ONETYPE (sockaddr_eon) \ __SOCKADDR_ONETYPE (sockaddr_in) \ __SOCKADDR_ONETYPE (sockaddr_in6) \ __SOCKADDR_ONETYPE (sockaddr_inarp) \ __SOCKADDR_ONETYPE (sockaddr_ipx) \ __SOCKADDR_ONETYPE (sockaddr_iso) \ __SOCKADDR_ONETYPE (sockaddr_ns) \ __SOCKADDR_ONETYPE (sockaddr_un) \ __SOCKADDR_ONETYPE (sockaddr_x25) # define __SOCKADDR_ONETYPE(type) struct type *__restrict __##type##__; typedef union { __SOCKADDR_ALLTYPES } __SOCKADDR_ARG __attribute__ ((__transparent_union__)); # undef __SOCKADDR_ONETYPE # define __SOCKADDR_ONETYPE(type) const struct type *__restrict __##type##__; typedef union { __SOCKADDR_ALLTYPES } __CONST_SOCKADDR_ARG __attribute__ ((__transparent_union__)); # undef __SOCKADDR_ONETYPE #endif #ifdef __USE_GNU /* For `recvmmsg' and `sendmmsg'. */ struct mmsghdr { struct msghdr msg_hdr; /* Actual message header. */ unsigned int msg_len; /* Number of received or sent bytes for the entry. */ }; #endif /* Create a new socket of type TYPE in domain DOMAIN, using protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically. Returns a file descriptor for the new socket, or -1 for errors. */ extern int socket (int __domain, int __type, int __protocol) __THROW; /* Create two new sockets, of type TYPE in domain DOMAIN and using protocol PROTOCOL, which are connected to each other, and put file descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero, one will be chosen automatically. Returns 0 on success, -1 for errors. */ extern int socketpair (int __domain, int __type, int __protocol, int __fds[2]) __THROW; /* Give the socket FD the local address ADDR (which is LEN bytes long). */ extern int bind (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len) __THROW; /* Put the local address of FD into *ADDR and its length in *LEN. */ extern int getsockname (int __fd, __SOCKADDR_ARG __addr, socklen_t *__restrict __len) __THROW; /* Open a connection on socket FD to peer at ADDR (which LEN bytes long). For connectionless socket types, just set the default address to send to and the only address from which to accept transmissions. Return 0 on success, -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern int connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len); /* Put the address of the peer connected to socket FD into *ADDR (which is *LEN bytes long), and its actual length into *LEN. */ extern int getpeername (int __fd, __SOCKADDR_ARG __addr, socklen_t *__restrict __len) __THROW; /* Send N bytes of BUF to socket FD. Returns the number sent or -1. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t send (int __fd, const void *__buf, size_t __n, int __flags); /* Read N bytes into BUF from socket FD. Returns the number read or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t recv (int __fd, void *__buf, size_t __n, int __flags); /* Send N bytes of BUF on socket FD to peer at address ADDR (which is ADDR_LEN bytes long). Returns the number sent, or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t sendto (int __fd, const void *__buf, size_t __n, int __flags, __CONST_SOCKADDR_ARG __addr, socklen_t __addr_len); /* Read N bytes into BUF through socket FD. If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of the sender, and store the actual size of the address in *ADDR_LEN. Returns the number of bytes read or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len); /* Send a message described MESSAGE on socket FD. Returns the number of bytes sent, or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t sendmsg (int __fd, const struct msghdr *__message, int __flags); #ifdef __USE_GNU /* Send a VLEN messages as described by VMESSAGES to socket FD. Returns the number of datagrams successfully written or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern int sendmmsg (int __fd, struct mmsghdr *__vmessages, unsigned int __vlen, int __flags); #endif /* Receive a message as described by MESSAGE from socket FD. Returns the number of bytes read or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags); #ifdef __USE_GNU /* Receive up to VLEN messages as described by VMESSAGES from socket FD. Returns the number of bytes read or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern int recvmmsg (int __fd, struct mmsghdr *__vmessages, unsigned int __vlen, int __flags, const struct timespec *__tmo); #endif /* Put the current value for socket FD's option OPTNAME at protocol level LEVEL into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's actual length. Returns 0 on success, -1 for errors. */ extern int getsockopt (int __fd, int __level, int __optname, void *__restrict __optval, socklen_t *__restrict __optlen) __THROW; /* Set socket FD's option OPTNAME at protocol level LEVEL to *OPTVAL (which is OPTLEN bytes long). Returns 0 on success, -1 for errors. */ extern int setsockopt (int __fd, int __level, int __optname, const void *__optval, socklen_t __optlen) __THROW; /* Prepare to accept connections on socket FD. N connection requests will be queued before further requests are refused. Returns 0 on success, -1 for errors. */ extern int listen (int __fd, int __n) __THROW; /* Await a connection on socket FD. When a connection arrives, open a new socket to communicate with it, set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting peer and *ADDR_LEN to the address's actual length, and return the new socket's descriptor, or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern int accept (int __fd, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len); #ifdef __USE_GNU /* Similar to 'accept' but takes an additional parameter to specify flags. This function is a cancellation point and therefore not marked with __THROW. */ extern int accept4 (int __fd, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len, int __flags); #endif /* Shut down all or part of the connection open on socket FD. HOW determines what to shut down: SHUT_RD = No more receptions; SHUT_WR = No more transmissions; SHUT_RDWR = No more receptions or transmissions. Returns 0 on success, -1 for errors. */ extern int shutdown (int __fd, int __how) __THROW; #ifdef __USE_XOPEN2K /* Determine wheter socket is at a out-of-band mark. */ extern int sockatmark (int __fd) __THROW; #endif #ifdef __USE_MISC /* FDTYPE is S_IFSOCK or another S_IF* macro defined in <sys/stat.h>; returns 1 if FD is open on an object of the indicated type, 0 if not, or -1 for errors (setting errno). */ extern int isfdtype (int __fd, int __fdtype) __THROW; #endif /* Define some macros helping to catch buffer overflows. */ #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function # include <bits/socket2.h> #endif __END_DECLS #endif /* sys/socket.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/pci.h�������������������������������������������������������������������������������������������0000644�����������������00000001625�14763166026�0006325 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_PCI_H #define _SYS_PCI_H 1 /* We use the constants from the kernel. */ #include <linux/pci.h> #endif /* sys/pci.h */ �����������������������������������������������������������������������������������������������������������sys/elf.h�������������������������������������������������������������������������������������������0000644�����������������00000001777�14763166026�0006330 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1998-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_ELF_H #define _SYS_ELF_H 1 #ifdef __x86_64__ # error This header is unsupported on x86-64. #else # warning "This header is obsolete; use <sys/procfs.h> instead." # include <sys/procfs.h> #endif #endif /* _SYS_ELF_H */ �sys/msg.h�������������������������������������������������������������������������������������������0000644�����������������00000004547�14763166026�0006346 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1995-1997,1999,2000,2003,2006,2007,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_MSG_H #define _SYS_MSG_H #include <features.h> #define __need_size_t #include <stddef.h> /* Get common definition of System V style IPC. */ #include <sys/ipc.h> /* Get system dependent definition of `struct msqid_ds' and more. */ #include <bits/msq.h> /* Define types required by the standard. */ #define __need_time_t #include <time.h> #ifndef __pid_t_defined typedef __pid_t pid_t; # define __pid_t_defined #endif #ifndef __ssize_t_defined typedef __ssize_t ssize_t; # define __ssize_t_defined #endif /* The following System V style IPC functions implement a message queue system. The definition is found in XPG2. */ #ifdef __USE_GNU /* Template for struct to be used as argument for `msgsnd' and `msgrcv'. */ struct msgbuf { __syscall_slong_t mtype; /* type of received/sent message */ char mtext[1]; /* text of the message */ }; #endif __BEGIN_DECLS /* Message queue control operation. */ extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf) __THROW; /* Get messages queue. */ extern int msgget (key_t __key, int __msgflg) __THROW; /* Receive message from message queue. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t msgrcv (int __msqid, void *__msgp, size_t __msgsz, long int __msgtyp, int __msgflg); /* Send message to message queue. This function is a cancellation point and therefore not marked with __THROW. */ extern int msgsnd (int __msqid, const void *__msgp, size_t __msgsz, int __msgflg); __END_DECLS #endif /* sys/msg.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������sys/sendfile.h��������������������������������������������������������������������������������������0000644�����������������00000003430�14763166026�0007337 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* sendfile -- copy data directly from one file descriptor to another Copyright (C) 1998,99,01,2002,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SENDFILE_H #define _SYS_SENDFILE_H 1 #include <features.h> #include <sys/types.h> __BEGIN_DECLS /* Send up to COUNT bytes from file associated with IN_FD starting at *OFFSET to descriptor OUT_FD. Set *OFFSET to the IN_FD's file position following the read bytes. If OFFSET is a null pointer, use the normal file position instead. Return the number of written bytes, or -1 in case of error. */ #ifndef __USE_FILE_OFFSET64 extern ssize_t sendfile (int __out_fd, int __in_fd, off_t *__offset, size_t __count) __THROW; #else # ifdef __REDIRECT_NTH extern ssize_t __REDIRECT_NTH (sendfile, (int __out_fd, int __in_fd, __off64_t *__offset, size_t __count), sendfile64); # else # define sendfile sendfile64 # endif #endif #ifdef __USE_LARGEFILE64 extern ssize_t sendfile64 (int __out_fd, int __in_fd, __off64_t *__offset, size_t __count) __THROW; #endif __END_DECLS #endif /* sys/sendfile.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/debugreg.h��������������������������������������������������������������������������������������0000644�����������������00000006767�14763166026�0007352 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2001-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_DEBUGREG_H #define _SYS_DEBUGREG_H 1 /* Indicate the register numbers for a number of the specific debug registers. Registers 0-3 contain the addresses we wish to trap on */ #define DR_FIRSTADDR 0 /* u_debugreg[DR_FIRSTADDR] */ #define DR_LASTADDR 3 /* u_debugreg[DR_LASTADDR] */ #define DR_STATUS 6 /* u_debugreg[DR_STATUS] */ #define DR_CONTROL 7 /* u_debugreg[DR_CONTROL] */ /* Define a few things for the status register. We can use this to determine which debugging register was responsible for the trap. The other bits are either reserved or not of interest to us. */ #define DR_TRAP0 (0x1) /* db0 */ #define DR_TRAP1 (0x2) /* db1 */ #define DR_TRAP2 (0x4) /* db2 */ #define DR_TRAP3 (0x8) /* db3 */ #define DR_STEP (0x4000) /* single-step */ #define DR_SWITCH (0x8000) /* task switch */ /* Now define a bunch of things for manipulating the control register. The top two bytes of the control register consist of 4 fields of 4 bits - each field corresponds to one of the four debug registers, and indicates what types of access we trap on, and how large the data field is that we are looking at */ #define DR_CONTROL_SHIFT 16 /* Skip this many bits in ctl register */ #define DR_CONTROL_SIZE 4 /* 4 control bits per register */ #define DR_RW_EXECUTE (0x0) /* Settings for the access types to trap on */ #define DR_RW_WRITE (0x1) #define DR_RW_READ (0x3) #define DR_LEN_1 (0x0) /* Settings for data length to trap on */ #define DR_LEN_2 (0x4) #define DR_LEN_4 (0xC) #ifdef __x86_64__ # define DR_LEN_8 (0x8) #endif /* The low byte to the control register determine which registers are enabled. There are 4 fields of two bits. One bit is "local", meaning that the processor will reset the bit after a task switch and the other is global meaning that we have to explicitly reset the bit. With linux, you can use either one, since we explicitly zero the register when we enter kernel mode. */ #define DR_LOCAL_ENABLE_SHIFT 0 /* Extra shift to the local enable bit */ #define DR_GLOBAL_ENABLE_SHIFT 1 /* Extra shift to the global enable bit */ #define DR_ENABLE_SIZE 2 /* 2 enable bits per register */ #define DR_LOCAL_ENABLE_MASK (0x55) /* Set local bits for all 4 regs */ #define DR_GLOBAL_ENABLE_MASK (0xAA) /* Set global bits for all 4 regs */ /* The second byte to the control register has a few special things. */ #ifdef __x86_64__ # define DR_CONTROL_RESERVED (0xFFFFFFFF0000FC00ULL) /* Reserved */ #else # define DR_CONTROL_RESERVED (0x00FC00U) /* Reserved */ #endif #define DR_LOCAL_SLOWDOWN (0x100) /* Local slow the pipeline */ #define DR_GLOBAL_SLOWDOWN (0x200) /* Global slow the pipeline */ #endif /* sys/debugreg.h */ ���������sys/raw.h�������������������������������������������������������������������������������������������0000644�����������������00000002230�14763166026�0006334 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_RAW_H #define _SYS_RAW_H 1 #include <stdint.h> #include <sys/ioctl.h> /* The major device number for raw devices. */ #define RAW_MAJOR 162 /* `ioctl' commands for raw devices. */ #define RAW_SETBIND _IO(0xac, 0) #define RAW_GETBIND _IO(0xac, 1) struct raw_config_request { int raw_minor; uint64_t block_major; uint64_t block_minor; }; #endif /* sys/raw.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/ttychars.h��������������������������������������������������������������������������������������0000644�����������������00000004703�14763166026�0007413 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*- * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)ttychars.h 8.2 (Berkeley) 1/4/94 */ /* * 4.3 COMPATIBILITY FILE * * User visible structures and constants related to terminal handling. */ #ifndef _SYS_TTYCHARS_H #define _SYS_TTYCHARS_H 1 struct ttychars { char tc_erase; /* erase last character */ char tc_kill; /* erase entire line */ char tc_intrc; /* interrupt */ char tc_quitc; /* quit */ char tc_startc; /* start output */ char tc_stopc; /* stop output */ char tc_eofc; /* end-of-file */ char tc_brkc; /* input delimiter (like nl) */ char tc_suspc; /* stop process signal */ char tc_dsuspc; /* delayed stop process signal */ char tc_rprntc; /* reprint line */ char tc_flushc; /* flush output (toggles) */ char tc_werasc; /* word erase */ char tc_lnextc; /* literal next character */ }; #ifdef __USE_OLD_TTY #include <sys/ttydefaults.h> /* to pick up character defaults */ #endif #endif /* sys/ttychars.h */ �������������������������������������������������������������sys/errno.h�����������������������������������������������������������������������������������������0000644�����������������00000000023�14763166026�0006666 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <errno.h> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/ipc.h�������������������������������������������������������������������������������������������0000644�����������������00000003152�14763166026�0006322 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1995,1996,1997,1999,2002,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_IPC_H #define _SYS_IPC_H 1 #include <features.h> #if !defined __USE_SVID && !defined __USE_XOPEN && __GNUC__ >= 2 # warning "Files using this header must be compiled with _SVID_SOURCE or _XOPEN_SOURCE" #endif /* Get system dependent definition of `struct ipc_perm' and more. */ #include <bits/ipctypes.h> #include <bits/ipc.h> #ifndef __uid_t_defined typedef __uid_t uid_t; # define __uid_t_defined #endif #ifndef __gid_t_defined typedef __gid_t gid_t; # define __gid_t_defined #endif #ifndef __mode_t_defined typedef __mode_t mode_t; # define __mode_t_defined #endif #ifndef __key_t_defined typedef __key_t key_t; # define __key_t_defined #endif __BEGIN_DECLS /* Generates key for System V style IPC. */ extern key_t ftok (const char *__pathname, int __proj_id) __THROW; __END_DECLS #endif /* sys/ipc.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/io.h��������������������������������������������������������������������������������������������0000644�����������������00000011735�14763166026�0006164 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_IO_H #define _SYS_IO_H 1 #include <features.h> __BEGIN_DECLS /* If TURN_ON is TRUE, request for permission to do direct i/o on the port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O permission off for that range. This call requires root privileges. Portability note: not all Linux platforms support this call. Most platforms based on the PC I/O architecture probably will, however. E.g., Linux/Alpha for Alpha PCs supports this. */ extern int ioperm (unsigned long int __from, unsigned long int __num, int __turn_on) __THROW; /* Set the I/O privilege level to LEVEL. If LEVEL>3, permission to access any I/O port is granted. This call requires root privileges. */ extern int iopl (int __level) __THROW; #if defined __GNUC__ && __GNUC__ >= 2 static __inline unsigned char inb (unsigned short int __port) { unsigned char _v; __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" (__port)); return _v; } static __inline unsigned char inb_p (unsigned short int __port) { unsigned char _v; __asm__ __volatile__ ("inb %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); return _v; } static __inline unsigned short int inw (unsigned short int __port) { unsigned short _v; __asm__ __volatile__ ("inw %w1,%0":"=a" (_v):"Nd" (__port)); return _v; } static __inline unsigned short int inw_p (unsigned short int __port) { unsigned short int _v; __asm__ __volatile__ ("inw %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); return _v; } static __inline unsigned int inl (unsigned short int __port) { unsigned int _v; __asm__ __volatile__ ("inl %w1,%0":"=a" (_v):"Nd" (__port)); return _v; } static __inline unsigned int inl_p (unsigned short int __port) { unsigned int _v; __asm__ __volatile__ ("inl %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); return _v; } static __inline void outb (unsigned char __value, unsigned short int __port) { __asm__ __volatile__ ("outb %b0,%w1": :"a" (__value), "Nd" (__port)); } static __inline void outb_p (unsigned char __value, unsigned short int __port) { __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80": :"a" (__value), "Nd" (__port)); } static __inline void outw (unsigned short int __value, unsigned short int __port) { __asm__ __volatile__ ("outw %w0,%w1": :"a" (__value), "Nd" (__port)); } static __inline void outw_p (unsigned short int __value, unsigned short int __port) { __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80": :"a" (__value), "Nd" (__port)); } static __inline void outl (unsigned int __value, unsigned short int __port) { __asm__ __volatile__ ("outl %0,%w1": :"a" (__value), "Nd" (__port)); } static __inline void outl_p (unsigned int __value, unsigned short int __port) { __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80": :"a" (__value), "Nd" (__port)); } static __inline void insb (unsigned short int __port, void *__addr, unsigned long int __count) { __asm__ __volatile__ ("cld ; rep ; insb":"=D" (__addr), "=c" (__count) :"d" (__port), "0" (__addr), "1" (__count)); } static __inline void insw (unsigned short int __port, void *__addr, unsigned long int __count) { __asm__ __volatile__ ("cld ; rep ; insw":"=D" (__addr), "=c" (__count) :"d" (__port), "0" (__addr), "1" (__count)); } static __inline void insl (unsigned short int __port, void *__addr, unsigned long int __count) { __asm__ __volatile__ ("cld ; rep ; insl":"=D" (__addr), "=c" (__count) :"d" (__port), "0" (__addr), "1" (__count)); } static __inline void outsb (unsigned short int __port, const void *__addr, unsigned long int __count) { __asm__ __volatile__ ("cld ; rep ; outsb":"=S" (__addr), "=c" (__count) :"d" (__port), "0" (__addr), "1" (__count)); } static __inline void outsw (unsigned short int __port, const void *__addr, unsigned long int __count) { __asm__ __volatile__ ("cld ; rep ; outsw":"=S" (__addr), "=c" (__count) :"d" (__port), "0" (__addr), "1" (__count)); } static __inline void outsl (unsigned short int __port, const void *__addr, unsigned long int __count) { __asm__ __volatile__ ("cld ; rep ; outsl":"=S" (__addr), "=c" (__count) :"d" (__port), "0" (__addr), "1" (__count)); } #endif /* GNU C */ __END_DECLS #endif /* _SYS_IO_H */ �����������������������������������sys/procfs.h����������������������������������������������������������������������������������������0000644�����������������00000011553�14763166026�0007047 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2001-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_PROCFS_H #define _SYS_PROCFS_H 1 /* This is somewhat modelled after the file of the same name on SVR4 systems. It provides a definition of the core file format for ELF used on Linux. It doesn't have anything to do with the /proc file system, even though Linux has one. Anyway, the whole purpose of this file is for GDB and GDB only. Don't read too much into it. Don't use it for anything other than GDB unless you know what you are doing. */ #include <features.h> #include <sys/time.h> #include <sys/types.h> #include <sys/user.h> __BEGIN_DECLS /* Type for a general-purpose register. */ #ifdef __x86_64__ typedef unsigned long long elf_greg_t; #else typedef unsigned long elf_greg_t; #endif /* And the whole bunch of them. We could have used `struct user_regs_struct' directly in the typedef, but tradition says that the register set is an array, which does have some peculiar semantics, so leave it that way. */ #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t)) typedef elf_greg_t elf_gregset_t[ELF_NGREG]; #ifndef __x86_64__ /* Register set for the floating-point registers. */ typedef struct user_fpregs_struct elf_fpregset_t; /* Register set for the extended floating-point registers. Includes the Pentium III SSE registers in addition to the classic floating-point stuff. */ typedef struct user_fpxregs_struct elf_fpxregset_t; #else /* Register set for the extended floating-point registers. Includes the Pentium III SSE registers in addition to the classic floating-point stuff. */ typedef struct user_fpregs_struct elf_fpregset_t; #endif /* Signal info. */ struct elf_siginfo { int si_signo; /* Signal number. */ int si_code; /* Extra code. */ int si_errno; /* Errno. */ }; /* Definitions to generate Intel SVR4-like core files. These mostly have the same names as the SVR4 types with "elf_" tacked on the front to prevent clashes with Linux definitions, and the typedef forms have been avoided. This is mostly like the SVR4 structure, but more Linuxy, with things that Linux does not support and which GDB doesn't really use excluded. */ struct elf_prstatus { struct elf_siginfo pr_info; /* Info associated with signal. */ short int pr_cursig; /* Current signal. */ unsigned long int pr_sigpend; /* Set of pending signals. */ unsigned long int pr_sighold; /* Set of held signals. */ __pid_t pr_pid; __pid_t pr_ppid; __pid_t pr_pgrp; __pid_t pr_sid; struct timeval pr_utime; /* User time. */ struct timeval pr_stime; /* System time. */ struct timeval pr_cutime; /* Cumulative user time. */ struct timeval pr_cstime; /* Cumulative system time. */ elf_gregset_t pr_reg; /* GP registers. */ int pr_fpvalid; /* True if math copro being used. */ }; #define ELF_PRARGSZ (80) /* Number of chars for args. */ struct elf_prpsinfo { char pr_state; /* Numeric process state. */ char pr_sname; /* Char for pr_state. */ char pr_zomb; /* Zombie. */ char pr_nice; /* Nice val. */ unsigned long int pr_flag; /* Flags. */ #if __WORDSIZE == 32 unsigned short int pr_uid; unsigned short int pr_gid; #else unsigned int pr_uid; unsigned int pr_gid; #endif int pr_pid, pr_ppid, pr_pgrp, pr_sid; /* Lots missing */ char pr_fname[16]; /* Filename of executable. */ char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ }; /* The rest of this file provides the types for emulation of the Solaris <proc_service.h> interfaces that should be implemented by users of libthread_db. */ /* Addresses. */ typedef void *psaddr_t; /* Register sets. Linux has different names. */ typedef elf_gregset_t prgregset_t; typedef elf_fpregset_t prfpregset_t; /* We don't have any differences between processes and threads, therefore have only one PID type. */ typedef __pid_t lwpid_t; /* Process status and info. In the end we do provide typedefs for them. */ typedef struct elf_prstatus prstatus_t; typedef struct elf_prpsinfo prpsinfo_t; __END_DECLS #endif /* sys/procfs.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������sys/sdt-config.h������������������������������������������������������������������������������������0000644�����������������00000000424�14763166026�0007603 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* includes/sys/sdt-config.h. Generated from sdt-config.h.in by configure. This file just defines _SDT_ASM_SECTION_AUTOGROUP_SUPPORT to 0 or 1 to indicate whether the assembler supports "?" in .pushsection directives. */ #define _SDT_ASM_SECTION_AUTOGROUP_SUPPORT 1 ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sys/mount.h�����������������������������������������������������������������������������������������0000644�����������������00000013005�14763166026�0006707 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Header file for mounting/unmount Linux filesystems. Copyright (C) 1996-2000, 2004, 2010, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* This is taken from /usr/include/linux/fs.h. */ #ifndef _SYS_MOUNT_H #define _SYS_MOUNT_H 1 #include <features.h> #include <sys/ioctl.h> #define BLOCK_SIZE 1024 #define BLOCK_SIZE_BITS 10 /* These are the fs-independent mount-flags: up to 16 flags are supported */ enum { MS_RDONLY = 1, /* Mount read-only. */ #define MS_RDONLY MS_RDONLY MS_NOSUID = 2, /* Ignore suid and sgid bits. */ #define MS_NOSUID MS_NOSUID MS_NODEV = 4, /* Disallow access to device special files. */ #define MS_NODEV MS_NODEV MS_NOEXEC = 8, /* Disallow program execution. */ #define MS_NOEXEC MS_NOEXEC MS_SYNCHRONOUS = 16, /* Writes are synced at once. */ #define MS_SYNCHRONOUS MS_SYNCHRONOUS MS_REMOUNT = 32, /* Alter flags of a mounted FS. */ #define MS_REMOUNT MS_REMOUNT MS_MANDLOCK = 64, /* Allow mandatory locks on an FS. */ #define MS_MANDLOCK MS_MANDLOCK MS_DIRSYNC = 128, /* Directory modifications are synchronous. */ #define MS_DIRSYNC MS_DIRSYNC MS_NOATIME = 1024, /* Do not update access times. */ #define MS_NOATIME MS_NOATIME MS_NODIRATIME = 2048, /* Do not update directory access times. */ #define MS_NODIRATIME MS_NODIRATIME MS_BIND = 4096, /* Bind directory at different place. */ #define MS_BIND MS_BIND MS_MOVE = 8192, #define MS_MOVE MS_MOVE MS_REC = 16384, #define MS_REC MS_REC MS_SILENT = 32768, #define MS_SILENT MS_SILENT MS_POSIXACL = 1 << 16, /* VFS does not apply the umask. */ #define MS_POSIXACL MS_POSIXACL MS_UNBINDABLE = 1 << 17, /* Change to unbindable. */ #define MS_UNBINDABLE MS_UNBINDABLE MS_PRIVATE = 1 << 18, /* Change to private. */ #define MS_PRIVATE MS_PRIVATE MS_SLAVE = 1 << 19, /* Change to slave. */ #define MS_SLAVE MS_SLAVE MS_SHARED = 1 << 20, /* Change to shared. */ #define MS_SHARED MS_SHARED MS_RELATIME = 1 << 21, /* Update atime relative to mtime/ctime. */ #define MS_RELATIME MS_RELATIME MS_KERNMOUNT = 1 << 22, /* This is a kern_mount call. */ #define MS_KERNMOUNT MS_KERNMOUNT MS_I_VERSION = 1 << 23, /* Update inode I_version field. */ #define MS_I_VERSION MS_I_VERSION MS_STRICTATIME = 1 << 24, /* Always perform atime updates. */ #define MS_STRICTATIME MS_STRICTATIME MS_LAZYTIME = 1 << 25, /* Update the on-disk [acm]times lazily. */ #define MS_LAZYTIME MS_LAZYTIME MS_ACTIVE = 1 << 30, #define MS_ACTIVE MS_ACTIVE MS_NOUSER = 1 << 31 #define MS_NOUSER MS_NOUSER }; /* Flags that can be altered by MS_REMOUNT */ #define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION \ |MS_LAZYTIME) /* Magic mount flag number. Has to be or-ed to the flag values. */ #define MS_MGC_VAL 0xc0ed0000 /* Magic flag number to indicate "new" flags */ #define MS_MGC_MSK 0xffff0000 /* Magic flag number mask */ /* The read-only stuff doesn't really belong here, but any other place is probably as bad and I don't want to create yet another include file. */ #define BLKROSET _IO(0x12, 93) /* Set device read-only (0 = read-write). */ #define BLKROGET _IO(0x12, 94) /* Get read-only status (0 = read_write). */ #define BLKRRPART _IO(0x12, 95) /* Re-read partition table. */ #define BLKGETSIZE _IO(0x12, 96) /* Return device size. */ #define BLKFLSBUF _IO(0x12, 97) /* Flush buffer cache. */ #define BLKRASET _IO(0x12, 98) /* Set read ahead for block device. */ #define BLKRAGET _IO(0x12, 99) /* Get current read ahead setting. */ #define BLKFRASET _IO(0x12,100) /* Set filesystem read-ahead. */ #define BLKFRAGET _IO(0x12,101) /* Get filesystem read-ahead. */ #define BLKSECTSET _IO(0x12,102) /* Set max sectors per request. */ #define BLKSECTGET _IO(0x12,103) /* Get max sectors per request. */ #define BLKSSZGET _IO(0x12,104) /* Get block device sector size. */ #define BLKBSZGET _IOR(0x12,112,size_t) #define BLKBSZSET _IOW(0x12,113,size_t) #define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size. */ /* Possible value for FLAGS parameter of `umount2'. */ enum { MNT_FORCE = 1, /* Force unmounting. */ #define MNT_FORCE MNT_FORCE MNT_DETACH = 2, /* Just detach from the tree. */ #define MNT_DETACH MNT_DETACH MNT_EXPIRE = 4, /* Mark for expiry. */ #define MNT_EXPIRE MNT_EXPIRE UMOUNT_NOFOLLOW = 8 /* Don't follow symlink on umount. */ #define UMOUNT_NOFOLLOW UMOUNT_NOFOLLOW }; __BEGIN_DECLS /* Mount a filesystem. */ extern int mount (const char *__special_file, const char *__dir, const char *__fstype, unsigned long int __rwflag, const void *__data) __THROW; /* Unmount a filesystem. */ extern int umount (const char *__special_file) __THROW; /* Unmount a filesystem. Force unmounting if FLAGS is set to MNT_FORCE. */ extern int umount2 (const char *__special_file, int __flags) __THROW; __END_DECLS #endif /* _SYS_MOUNT_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netrom/netrom.h�������������������������������������������������������������������������������������0000644�����������������00000004254�14763166026�0007545 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _NETROM_NETROM_H #define _NETROM_NETROM_H 1 #include <netax25/ax25.h> /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx. */ #define SOL_NETROM 259 /* NetRom control values: */ #define NETROM_T1 1 #define NETROM_T2 2 #define NETROM_N2 3 #define NETROM_PACLEN 5 #define NETROM_T4 6 #define NETROM_IDLE 7 #define NETROM_KILL 99 /* Type of route: */ #define NETROM_NEIGH 0 #define NETROM_NODE 1 struct nr_route_struct { int type; ax25_address callsign; char device[16]; unsigned int quality; char mnemonic[7]; ax25_address neighbour; unsigned int obs_count; unsigned int ndigis; ax25_address digipeaters[AX25_MAX_DIGIS]; }; /* NetRom socket ioctls: */ #define SIOCNRGETPARMS (SIOCPROTOPRIVATE+0) #define SIOCNRSETPARMS (SIOCPROTOPRIVATE+1) #define SIOCNRDECOBS (SIOCPROTOPRIVATE+2) #define SIOCNRRTCTL (SIOCPROTOPRIVATE+3) #define SIOCNRCTLCON (SIOCPROTOPRIVATE+4) /* NetRom parameter structure: */ struct nr_parms_struct { unsigned int quality; unsigned int obs_count; unsigned int ttl; unsigned int timeout; unsigned int ack_delay; unsigned int busy_delay; unsigned int tries; unsigned int window; unsigned int paclen; }; /* NetRom control structure: */ struct nr_ctl_struct { unsigned char index; unsigned char id; unsigned int cmd; unsigned long arg; }; #endif /* netrom/netrom.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sqlca.h���������������������������������������������������������������������������������������������0000644�����������������00000002374�14763166026�0006041 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef POSTGRES_SQLCA_H #define POSTGRES_SQLCA_H #ifndef PGDLLIMPORT #if defined(WIN32) || defined(__CYGWIN__) #define PGDLLIMPORT __declspec (dllimport) #else #define PGDLLIMPORT #endif /* __CYGWIN__ */ #endif /* PGDLLIMPORT */ #define SQLERRMC_LEN 150 #ifdef __cplusplus extern "C" { #endif struct sqlca_t { char sqlcaid[8]; long sqlabc; long sqlcode; struct { int sqlerrml; char sqlerrmc[SQLERRMC_LEN]; } sqlerrm; char sqlerrp[8]; long sqlerrd[6]; /* Element 0: empty */ /* 1: OID of processed tuple if applicable */ /* 2: number of rows processed */ /* after an INSERT, UPDATE or */ /* DELETE statement */ /* 3: empty */ /* 4: empty */ /* 5: empty */ char sqlwarn[8]; /* Element 0: set to 'W' if at least one other is 'W' */ /* 1: if 'W' at least one character string */ /* value was truncated when it was */ /* stored into a host variable. */ /* * 2: if 'W' a (hopefully) non-fatal notice occurred */ /* 3: empty */ /* 4: empty */ /* 5: empty */ /* 6: empty */ /* 7: empty */ char sqlstate[5]; }; struct sqlca_t *ECPGget_sqlca(void); #ifndef POSTGRES_ECPG_INTERNAL #define sqlca (*ECPGget_sqlca()) #endif #ifdef __cplusplus } #endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gd.h������������������������������������������������������������������������������������������������0000644�����������������00000100026�14763166026�0005321 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifdef __cplusplus extern "C" { #endif #ifndef GD_H #define GD_H 1 #define GD_MAJOR_VERSION 2 #define GD_MINOR_VERSION 0 #define GD_RELEASE_VERSION 35 #define GD_EXTRA_VERSION "" #define GD_VERSION_STRING "2.0.35" /* Do the DLL dance: dllexport when building the DLL, dllimport when importing from it, nothing when not on Silly Silly Windows (tm Aardman Productions). */ /* 2.0.20: for headers */ /* 2.0.24: __stdcall also needed for Visual BASIC and other languages. This breaks ABI compatibility with previous DLL revs, but it's necessary. */ /* 2.0.29: WIN32 programmers can declare the NONDLL macro if they wish to build gd as a static library or by directly including the gd sources in a project. */ #ifndef WIN32 #define NONDLL 1 #endif /* WIN32 */ #ifdef NONDLL #define BGD_DECLARE(rt) extern rt #else #ifdef BGDWIN32 #define BGD_DECLARE(rt) __declspec(dllexport) rt __stdcall #else #define BGD_DECLARE(rt) __declspec(dllimport) rt _stdcall #endif /* BGDWIN32 */ #endif /* NONDLL */ /* 2.0.20: for actual storage of exported data, functions don't need this, currently needed only for font pointers */ #ifdef NONDLL /* 2.0.25: bring back extern */ #define BGD_EXPORT_DATA_PROT extern #define BGD_EXPORT_DATA_IMPL #else #ifdef BGDWIN32 #define BGD_EXPORT_DATA_PROT __declspec(dllexport) extern #define BGD_EXPORT_DATA_IMPL __declspec(dllexport) #else #define BGD_EXPORT_DATA_PROT __declspec(dllimport) extern #define BGD_EXPORT_DATA_IMPL __declspec(dllimport) #endif /* BGDWIN32 */ #endif /* NONDLL */ #ifdef __cplusplus extern "C" { #endif /* some might want to set DEFAULT_FONTPATH from configure in config.h */ #ifdef NETWARE /* default fontpath for netware systems, could probably be handled in configure for 2.1 */ #define DEFAULT_FONTPATH "sys:/java/nwgfx/lib/x11/fonts/ttf;." #define PATHSEPARATOR ";" #endif /* 2.0.23: more Type 1 fonts */ #ifndef DEFAULT_FONTPATH /* default fontpath for unix systems - whatever happened to standards ! */ #define DEFAULT_FONTPATH "/usr/X11R6/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/truetype:/usr/X11R6/lib/X11/fonts/TTF:/usr/share/fonts/TrueType:/usr/share/fonts/truetype:/usr/openwin/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/Type1:/usr/lib/X11/fonts/Type1:/usr/openwin/lib/X11/fonts/Type1" #endif #ifndef PATHSEPARATOR #define PATHSEPARATOR ":" #endif /* gd.h: declarations file for the graphic-draw module. * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation. This software is provided "AS IS." Thomas Boutell and * Boutell.Com, Inc. disclaim all warranties, either express or implied, * including but not limited to implied warranties of merchantability and * fitness for a particular purpose, with respect to this code and accompanying * documentation. */ /* stdio is needed for file I/O. */ #include <stdio.h> #include "gd_io.h" /* The maximum number of palette entries in palette-based images. In the wonderful new world of gd 2.0, you can of course have many more colors when using truecolor mode. */ #define gdMaxColors 256 /* Image type. See functions below; you will not need to change the elements directly. Use the provided macros to access sx, sy, the color table, and colorsTotal for read-only purposes. */ /* If 'truecolor' is set true, the image is truecolor; pixels are represented by integers, which must be 32 bits wide or more. True colors are repsented as follows: ARGB Where 'A' (alpha channel) occupies only the LOWER 7 BITS of the MSB. This very small loss of alpha channel resolution allows gd 2.x to keep backwards compatibility by allowing signed integers to be used to represent colors, and negative numbers to represent special cases, just as in gd 1.x. */ #define gdAlphaMax 127 #define gdAlphaOpaque 0 #define gdAlphaTransparent 127 #define gdRedMax 255 #define gdGreenMax 255 #define gdBlueMax 255 #define gdTrueColorGetAlpha(c) (((c) & 0x7F000000) >> 24) #define gdTrueColorGetRed(c) (((c) & 0xFF0000) >> 16) #define gdTrueColorGetGreen(c) (((c) & 0x00FF00) >> 8) #define gdTrueColorGetBlue(c) ((c) & 0x0000FF) /* This function accepts truecolor pixel values only. The source color is composited with the destination color based on the alpha channel value of the source color. The resulting color is opaque. */ BGD_DECLARE(int) gdAlphaBlend (int dest, int src); typedef struct gdImageStruct { /* Palette-based image pixels */ unsigned char **pixels; int sx; int sy; /* These are valid in palette images only. See also 'alpha', which appears later in the structure to preserve binary backwards compatibility */ int colorsTotal; int red[gdMaxColors]; int green[gdMaxColors]; int blue[gdMaxColors]; int open[gdMaxColors]; /* For backwards compatibility, this is set to the first palette entry with 100% transparency, and is also set and reset by the gdImageColorTransparent function. Newer applications can allocate palette entries with any desired level of transparency; however, bear in mind that many viewers, notably many web browsers, fail to implement full alpha channel for PNG and provide support for full opacity or transparency only. */ int transparent; int *polyInts; int polyAllocated; struct gdImageStruct *brush; struct gdImageStruct *tile; int brushColorMap[gdMaxColors]; int tileColorMap[gdMaxColors]; int styleLength; int stylePos; int *style; int interlace; /* New in 2.0: thickness of line. Initialized to 1. */ int thick; /* New in 2.0: alpha channel for palettes. Note that only Macintosh Internet Explorer and (possibly) Netscape 6 really support multiple levels of transparency in palettes, to my knowledge, as of 2/15/01. Most common browsers will display 100% opaque and 100% transparent correctly, and do something unpredictable and/or undesirable for levels in between. TBB */ int alpha[gdMaxColors]; /* Truecolor flag and pixels. New 2.0 fields appear here at the end to minimize breakage of existing object code. */ int trueColor; int **tpixels; /* Should alpha channel be copied, or applied, each time a pixel is drawn? This applies to truecolor images only. No attempt is made to alpha-blend in palette images, even if semitransparent palette entries exist. To do that, build your image as a truecolor image, then quantize down to 8 bits. */ int alphaBlendingFlag; /* Should the alpha channel of the image be saved? This affects PNG at the moment; other future formats may also have that capability. JPEG doesn't. */ int saveAlphaFlag; /* There should NEVER BE ACCESSOR MACROS FOR ITEMS BELOW HERE, so this part of the structure can be safely changed in new releases. */ /* 2.0.12: anti-aliased globals. 2.0.26: just a few vestiges after switching to the fast, memory-cheap implementation from PHP-gd. */ int AA; int AA_color; int AA_dont_blend; /* 2.0.12: simple clipping rectangle. These values must be checked for safety when set; please use gdImageSetClip */ int cx1; int cy1; int cx2; int cy2; } gdImage; typedef gdImage *gdImagePtr; typedef struct { /* # of characters in font */ int nchars; /* First character is numbered... (usually 32 = space) */ int offset; /* Character width and height */ int w; int h; /* Font data; array of characters, one row after another. Easily included in code, also easily loaded from data files. */ char *data; } gdFont; /* Text functions take these. */ typedef gdFont *gdFontPtr; /* For backwards compatibility only. Use gdImageSetStyle() for MUCH more flexible line drawing. Also see gdImageSetBrush(). */ #define gdDashSize 4 /* Special colors. */ #define gdStyled (-2) #define gdBrushed (-3) #define gdStyledBrushed (-4) #define gdTiled (-5) /* NOT the same as the transparent color index. This is used in line styles only. */ #define gdTransparent (-6) #define gdAntiAliased (-7) /* Functions to manipulate images. */ /* Creates a palette-based image (up to 256 colors). */ BGD_DECLARE(gdImagePtr) gdImageCreate (int sx, int sy); /* An alternate name for the above (2.0). */ #define gdImageCreatePalette gdImageCreate /* Creates a truecolor image (millions of colors). */ BGD_DECLARE(gdImagePtr) gdImageCreateTrueColor (int sx, int sy); /* Creates an image from various file types. These functions return a palette or truecolor image based on the nature of the file being loaded. Truecolor PNG stays truecolor; palette PNG stays palette-based; JPEG is always truecolor. */ BGD_DECLARE(gdImagePtr) gdImageCreateFromPng (FILE * fd); BGD_DECLARE(gdImagePtr) gdImageCreateFromPngCtx (gdIOCtxPtr in); BGD_DECLARE(gdImagePtr) gdImageCreateFromPngPtr (int size, void *data); /* These read the first frame only */ BGD_DECLARE(gdImagePtr) gdImageCreateFromGif (FILE * fd); BGD_DECLARE(gdImagePtr) gdImageCreateFromGifCtx (gdIOCtxPtr in); BGD_DECLARE(gdImagePtr) gdImageCreateFromGifPtr (int size, void *data); BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMP (FILE * inFile); BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMPCtx (gdIOCtx * infile); BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMPPtr (int size, void *data); BGD_DECLARE(gdImagePtr) gdImageCreateFromJpeg (FILE * infile); BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegCtx (gdIOCtx * infile); BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegPtr (int size, void *data); /* A custom data source. */ /* The source function must return -1 on error, otherwise the number of bytes fetched. 0 is EOF, not an error! */ /* context will be passed to your source function. */ typedef struct { int (*source) (void *context, char *buffer, int len); void *context; } gdSource, *gdSourcePtr; /* Deprecated in favor of gdImageCreateFromPngCtx */ BGD_DECLARE(gdImagePtr) gdImageCreateFromPngSource (gdSourcePtr in); BGD_DECLARE(gdImagePtr) gdImageCreateFromGd (FILE * in); BGD_DECLARE(gdImagePtr) gdImageCreateFromGdCtx (gdIOCtxPtr in); BGD_DECLARE(gdImagePtr) gdImageCreateFromGdPtr (int size, void *data); BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2 (FILE * in); BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ctx (gdIOCtxPtr in); BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ptr (int size, void *data); BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Part (FILE * in, int srcx, int srcy, int w, int h); BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartCtx (gdIOCtxPtr in, int srcx, int srcy, int w, int h); BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartPtr (int size, void *data, int srcx, int srcy, int w, int h); /* 2.0.10: prototype was missing */ BGD_DECLARE(gdImagePtr) gdImageCreateFromXbm (FILE * in); /* NOTE: filename, not FILE */ BGD_DECLARE(gdImagePtr) gdImageCreateFromXpm (char *filename); BGD_DECLARE(void) gdImageDestroy (gdImagePtr im); /* Replaces or blends with the background depending on the most recent call to gdImageAlphaBlending and the alpha channel value of 'color'; default is to overwrite. Tiling and line styling are also implemented here. All other gd drawing functions pass through this call, allowing for many useful effects. */ BGD_DECLARE(void) gdImageSetPixel (gdImagePtr im, int x, int y, int color); /* FreeType 2 text output with hook to extra flags */ BGD_DECLARE(int) gdImageGetPixel (gdImagePtr im, int x, int y); BGD_DECLARE(int) gdImageGetTrueColorPixel (gdImagePtr im, int x, int y); BGD_DECLARE(void) gdImageAABlend (gdImagePtr im); BGD_DECLARE(void) gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color); /* For backwards compatibility only. Use gdImageSetStyle() for much more flexible line drawing. */ BGD_DECLARE(void) gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color); /* Corners specified (not width and height). Upper left first, lower right second. */ BGD_DECLARE(void) gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color); /* Solid bar. Upper left corner first, lower right corner second. */ BGD_DECLARE(void) gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color); BGD_DECLARE(void) gdImageSetClip(gdImagePtr im, int x1, int y1, int x2, int y2); BGD_DECLARE(void) gdImageGetClip(gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P); BGD_DECLARE(int) gdImageBoundsSafe (gdImagePtr im, int x, int y); BGD_DECLARE(void) gdImageChar (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color); BGD_DECLARE(void) gdImageCharUp (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color); BGD_DECLARE(void) gdImageString (gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color); BGD_DECLARE(void) gdImageStringUp (gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color); BGD_DECLARE(void) gdImageString16 (gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color); BGD_DECLARE(void) gdImageStringUp16 (gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color); /* 2.0.16: for thread-safe use of gdImageStringFT and friends, call this before allowing any thread to call gdImageStringFT. Otherwise it is invoked by the first thread to invoke gdImageStringFT, with a very small but real risk of a race condition. Return 0 on success, nonzero on failure to initialize freetype. */ BGD_DECLARE(int) gdFontCacheSetup (void); /* Optional: clean up after application is done using fonts in BGD_DECLARE( ) gdImageStringFT(). */ BGD_DECLARE(void) gdFontCacheShutdown (void); /* 2.0.20: for backwards compatibility. A few applications did start calling this function when it first appeared although it was never documented. Simply invokes gdFontCacheShutdown. */ BGD_DECLARE(void) gdFreeFontCache (void); /* Calls gdImageStringFT. Provided for backwards compatibility only. */ BGD_DECLARE(char *) gdImageStringTTF (gdImage * im, int *brect, int fg, char *fontlist, double ptsize, double angle, int x, int y, char *string); /* FreeType 2 text output */ BGD_DECLARE(char *) gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist, double ptsize, double angle, int x, int y, char *string); /* 2.0.5: provides an extensible way to pass additional parameters. Thanks to Wez Furlong, sorry for the delay. */ typedef struct { int flags; /* Logical OR of gdFTEX_ values */ double linespacing; /* fine tune line spacing for '\n' */ int charmap; /* TBB: 2.0.12: may be gdFTEX_Unicode, gdFTEX_Shift_JIS, gdFTEX_Big5, or gdFTEX_Adobe_Custom; when not specified, maps are searched for in the above order. */ int hdpi; /* if (flags & gdFTEX_RESOLUTION) */ int vdpi; /* if (flags & gdFTEX_RESOLUTION) */ char *xshow; /* if (flags & gdFTEX_XSHOW) then, on return, xshow is a malloc'ed string contining xshow position data for the last string. NB. The caller is responsible for gdFree'ing the xshow string. */ char *fontpath; /* if (flags & gdFTEX_RETURNFONTPATHNAME) then, on return, fontpath is a malloc'ed string containing the actual font file path name used, which can be interesting when fontconfig is in use. The caller is responsible for gdFree'ing the fontpath string. */ } gdFTStringExtra, *gdFTStringExtraPtr; #define gdFTEX_LINESPACE 1 #define gdFTEX_CHARMAP 2 #define gdFTEX_RESOLUTION 4 #define gdFTEX_DISABLE_KERNING 8 #define gdFTEX_XSHOW 16 /* The default unless gdFTUseFontConfig(1); has been called: fontlist is a full or partial font file pathname or list thereof (i.e. just like before 2.0.29) */ #define gdFTEX_FONTPATHNAME 32 /* Necessary to use fontconfig patterns instead of font pathnames as the fontlist argument, unless gdFTUseFontConfig(1); has been called. New in 2.0.29 */ #define gdFTEX_FONTCONFIG 64 /* Sometimes interesting when fontconfig is used: the fontpath element of the structure above will contain a gdMalloc'd string copy of the actual font file pathname used, if this flag is set when the call is made */ #define gdFTEX_RETURNFONTPATHNAME 128 /* If flag is nonzero, the fontlist parameter to gdImageStringFT and gdImageStringFTEx shall be assumed to be a fontconfig font pattern if fontconfig was compiled into gd. This function returns zero if fontconfig is not available, nonzero otherwise. */ BGD_DECLARE(int) gdFTUseFontConfig(int flag); /* These are NOT flags; set one in 'charmap' if you set the gdFTEX_CHARMAP bit in 'flags'. */ #define gdFTEX_Unicode 0 #define gdFTEX_Shift_JIS 1 #define gdFTEX_Big5 2 #define gdFTEX_Adobe_Custom 3 BGD_DECLARE(char *) gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsize, double angle, int x, int y, char *string, gdFTStringExtraPtr strex); /* Point type for use in polygon drawing. */ typedef struct { int x, y; } gdPoint, *gdPointPtr; BGD_DECLARE(void) gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c); BGD_DECLARE(void) gdImageOpenPolygon (gdImagePtr im, gdPointPtr p, int n, int c); BGD_DECLARE(void) gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c); /* These functions still work with truecolor images, for which they never return error. */ BGD_DECLARE(int) gdImageColorAllocate (gdImagePtr im, int r, int g, int b); /* gd 2.0: palette entries with non-opaque transparency are permitted. */ BGD_DECLARE(int) gdImageColorAllocateAlpha (gdImagePtr im, int r, int g, int b, int a); /* Assumes opaque is the preferred alpha channel value */ BGD_DECLARE(int) gdImageColorClosest (gdImagePtr im, int r, int g, int b); /* Closest match taking all four parameters into account. A slightly different color with the same transparency beats the exact same color with radically different transparency */ BGD_DECLARE(int) gdImageColorClosestAlpha (gdImagePtr im, int r, int g, int b, int a); /* An alternate method */ BGD_DECLARE(int) gdImageColorClosestHWB (gdImagePtr im, int r, int g, int b); /* Returns exact, 100% opaque matches only */ BGD_DECLARE(int) gdImageColorExact (gdImagePtr im, int r, int g, int b); /* Returns an exact match only, including alpha */ BGD_DECLARE(int) gdImageColorExactAlpha (gdImagePtr im, int r, int g, int b, int a); /* Opaque only */ BGD_DECLARE(int) gdImageColorResolve (gdImagePtr im, int r, int g, int b); /* Based on gdImageColorExactAlpha and gdImageColorClosestAlpha */ BGD_DECLARE(int) gdImageColorResolveAlpha (gdImagePtr im, int r, int g, int b, int a); /* A simpler way to obtain an opaque truecolor value for drawing on a truecolor image. Not for use with palette images! */ #define gdTrueColor(r, g, b) (((r) << 16) + \ ((g) << 8) + \ (b)) /* Returns a truecolor value with an alpha channel component. gdAlphaMax (127, **NOT 255**) is transparent, 0 is completely opaque. */ #define gdTrueColorAlpha(r, g, b, a) (((a) << 24) + \ ((r) << 16) + \ ((g) << 8) + \ (b)) BGD_DECLARE(void) gdImageColorDeallocate (gdImagePtr im, int color); /* Converts a truecolor image to a palette-based image, using a high-quality two-pass quantization routine which attempts to preserve alpha channel information as well as R/G/B color information when creating a palette. If ditherFlag is set, the image will be dithered to approximate colors better, at the expense of some obvious "speckling." colorsWanted can be anything up to 256. If the original source image includes photographic information or anything that came out of a JPEG, 256 is strongly recommended. Better yet, don't use these function -- write real truecolor PNGs and JPEGs. The disk space gain of conversion to palette is not great (for small images it can be negative) and the quality loss is ugly. DIFFERENCES: gdImageCreatePaletteFromTrueColor creates and returns a new image. gdImageTrueColorToPalette modifies an existing image, and the truecolor pixels are discarded. */ BGD_DECLARE(gdImagePtr) gdImageCreatePaletteFromTrueColor (gdImagePtr im, int ditherFlag, int colorsWanted); BGD_DECLARE(void) gdImageTrueColorToPalette (gdImagePtr im, int ditherFlag, int colorsWanted); /* Specifies a color index (if a palette image) or an RGB color (if a truecolor image) which should be considered 100% transparent. FOR TRUECOLOR IMAGES, THIS IS IGNORED IF AN ALPHA CHANNEL IS BEING SAVED. Use gdImageSaveAlpha(im, 0); to turn off the saving of a full alpha channel in a truecolor image. Note that gdImageColorTransparent is usually compatible with older browsers that do not understand full alpha channels well. TBB */ BGD_DECLARE(void) gdImageColorTransparent (gdImagePtr im, int color); BGD_DECLARE(void) gdImagePaletteCopy (gdImagePtr dst, gdImagePtr src); BGD_DECLARE(void) gdImageGif (gdImagePtr im, FILE * out); BGD_DECLARE(void) gdImagePng (gdImagePtr im, FILE * out); BGD_DECLARE(void) gdImagePngCtx (gdImagePtr im, gdIOCtx * out); BGD_DECLARE(void) gdImageGifCtx (gdImagePtr im, gdIOCtx * out); /* 2.0.12: Compression level: 0-9 or -1, where 0 is NO COMPRESSION at all, 1 is FASTEST but produces larger files, 9 provides the best compression (smallest files) but takes a long time to compress, and -1 selects the default compiled into the zlib library. */ BGD_DECLARE(void) gdImagePngEx (gdImagePtr im, FILE * out, int level); BGD_DECLARE(void) gdImagePngCtxEx (gdImagePtr im, gdIOCtx * out, int level); BGD_DECLARE(void) gdImageWBMP (gdImagePtr image, int fg, FILE * out); BGD_DECLARE(void) gdImageWBMPCtx (gdImagePtr image, int fg, gdIOCtx * out); /* Guaranteed to correctly free memory returned by the gdImage*Ptr functions */ BGD_DECLARE(void) gdFree (void *m); /* Best to free this memory with gdFree(), not free() */ BGD_DECLARE(void *) gdImageWBMPPtr (gdImagePtr im, int *size, int fg); /* 100 is highest quality (there is always a little loss with JPEG). 0 is lowest. 10 is about the lowest useful setting. */ BGD_DECLARE(void) gdImageJpeg (gdImagePtr im, FILE * out, int quality); BGD_DECLARE(void) gdImageJpegCtx (gdImagePtr im, gdIOCtx * out, int quality); /* Best to free this memory with gdFree(), not free() */ BGD_DECLARE(void *) gdImageJpegPtr (gdImagePtr im, int *size, int quality); /* Legal values for Disposal. gdDisposalNone is always used by the built-in optimizer if previm is passed. */ enum { gdDisposalUnknown, gdDisposalNone, gdDisposalRestoreBackground, gdDisposalRestorePrevious }; BGD_DECLARE(void) gdImageGifAnimBegin(gdImagePtr im, FILE *outFile, int GlobalCM, int Loops); BGD_DECLARE(void) gdImageGifAnimAdd(gdImagePtr im, FILE *outFile, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm); BGD_DECLARE(void) gdImageGifAnimEnd(FILE *outFile); BGD_DECLARE(void) gdImageGifAnimBeginCtx(gdImagePtr im, gdIOCtx *out, int GlobalCM, int Loops); BGD_DECLARE(void) gdImageGifAnimAddCtx(gdImagePtr im, gdIOCtx *out, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm); BGD_DECLARE(void) gdImageGifAnimEndCtx(gdIOCtx *out); BGD_DECLARE(void *) gdImageGifAnimBeginPtr(gdImagePtr im, int *size, int GlobalCM, int Loops); BGD_DECLARE(void *) gdImageGifAnimAddPtr(gdImagePtr im, int *size, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm); BGD_DECLARE(void *) gdImageGifAnimEndPtr(int *size); /* A custom data sink. For backwards compatibility. Use gdIOCtx instead. */ /* The sink function must return -1 on error, otherwise the number of bytes written, which must be equal to len. */ /* context will be passed to your sink function. */ typedef struct { int (*sink) (void *context, const char *buffer, int len); void *context; } gdSink, *gdSinkPtr; BGD_DECLARE(void) gdImagePngToSink (gdImagePtr im, gdSinkPtr out); BGD_DECLARE(void) gdImageGd (gdImagePtr im, FILE * out); BGD_DECLARE(void) gdImageGd2 (gdImagePtr im, FILE * out, int cs, int fmt); /* Best to free this memory with gdFree(), not free() */ BGD_DECLARE(void *) gdImageGifPtr (gdImagePtr im, int *size); /* Best to free this memory with gdFree(), not free() */ BGD_DECLARE(void *) gdImagePngPtr (gdImagePtr im, int *size); BGD_DECLARE(void *) gdImagePngPtrEx (gdImagePtr im, int *size, int level); /* Best to free this memory with gdFree(), not free() */ BGD_DECLARE(void *) gdImageGdPtr (gdImagePtr im, int *size); /* Best to free this memory with gdFree(), not free() */ BGD_DECLARE(void *) gdImageGd2Ptr (gdImagePtr im, int cs, int fmt, int *size); BGD_DECLARE(void) gdImageEllipse (gdImagePtr im, int cx, int cy, int w, int h, int color); /* Style is a bitwise OR ( | operator ) of these. gdArc and gdChord are mutually exclusive; gdChord just connects the starting and ending angles with a straight line, while gdArc produces a rounded edge. gdPie is a synonym for gdArc. gdNoFill indicates that the arc or chord should be outlined, not filled. gdEdged, used together with gdNoFill, indicates that the beginning and ending angles should be connected to the center; this is a good way to outline (rather than fill) a 'pie slice'. */ #define gdArc 0 #define gdPie gdArc #define gdChord 1 #define gdNoFill 2 #define gdEdged 4 BGD_DECLARE(void) gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color, int style); BGD_DECLARE(void) gdImageArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color); BGD_DECLARE(void) gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int color); BGD_DECLARE(void) gdImageFilledEllipse (gdImagePtr im, int cx, int cy, int w, int h, int color); BGD_DECLARE(void) gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color); BGD_DECLARE(void) gdImageFill (gdImagePtr im, int x, int y, int color); BGD_DECLARE(void) gdImageCopy (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h); BGD_DECLARE(void) gdImageCopyMerge (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h, int pct); BGD_DECLARE(void) gdImageCopyMergeGray (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h, int pct); /* Stretches or shrinks to fit, as needed. Does NOT attempt to average the entire set of source pixels that scale down onto the destination pixel. */ BGD_DECLARE(void) gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH); /* gd 2.0: stretches or shrinks to fit, as needed. When called with a truecolor destination image, this function averages the entire set of source pixels that scale down onto the destination pixel, taking into account what portion of the destination pixel each source pixel represents. This is a floating point operation, but this is not a performance issue on modern hardware, except for some embedded devices. If the destination is a palette image, gdImageCopyResized is substituted automatically. */ BGD_DECLARE(void) gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH); /* gd 2.0.8: gdImageCopyRotated is added. Source is a rectangle, with its upper left corner at srcX and srcY. Destination is the *center* of the rotated copy. Angle is in degrees, same as gdImageArc. Floating point destination center coordinates allow accurate rotation of objects of odd-numbered width or height. */ BGD_DECLARE(void) gdImageCopyRotated (gdImagePtr dst, gdImagePtr src, double dstX, double dstY, int srcX, int srcY, int srcWidth, int srcHeight, int angle); BGD_DECLARE(void) gdImageSetBrush (gdImagePtr im, gdImagePtr brush); BGD_DECLARE(void) gdImageSetTile (gdImagePtr im, gdImagePtr tile); BGD_DECLARE(void) gdImageSetAntiAliased (gdImagePtr im, int c); BGD_DECLARE(void) gdImageSetAntiAliasedDontBlend (gdImagePtr im, int c, int dont_blend); BGD_DECLARE(void) gdImageSetStyle (gdImagePtr im, int *style, int noOfPixels); /* Line thickness (defaults to 1). Affects lines, ellipses, rectangles, polygons and so forth. */ BGD_DECLARE(void) gdImageSetThickness (gdImagePtr im, int thickness); /* On or off (1 or 0) for all three of these. */ BGD_DECLARE(void) gdImageInterlace (gdImagePtr im, int interlaceArg); BGD_DECLARE(void) gdImageAlphaBlending (gdImagePtr im, int alphaBlendingArg); BGD_DECLARE(void) gdImageSaveAlpha (gdImagePtr im, int saveAlphaArg); /* Macros to access information about images. */ /* Returns nonzero if the image is a truecolor image, zero for a palette image. */ #define gdImageTrueColor(im) ((im)->trueColor) #define gdImageSX(im) ((im)->sx) #define gdImageSY(im) ((im)->sy) #define gdImageColorsTotal(im) ((im)->colorsTotal) #define gdImageRed(im, c) ((im)->trueColor ? gdTrueColorGetRed(c) : \ (im)->red[(c)]) #define gdImageGreen(im, c) ((im)->trueColor ? gdTrueColorGetGreen(c) : \ (im)->green[(c)]) #define gdImageBlue(im, c) ((im)->trueColor ? gdTrueColorGetBlue(c) : \ (im)->blue[(c)]) #define gdImageAlpha(im, c) ((im)->trueColor ? gdTrueColorGetAlpha(c) : \ (im)->alpha[(c)]) #define gdImageGetTransparent(im) ((im)->transparent) #define gdImageGetInterlaced(im) ((im)->interlace) /* These macros provide direct access to pixels in palette-based and truecolor images, respectively. If you use these macros, you must perform your own bounds checking. Use of the macro for the correct type of image is also your responsibility. */ #define gdImagePalettePixel(im, x, y) (im)->pixels[(y)][(x)] #define gdImageTrueColorPixel(im, x, y) (im)->tpixels[(y)][(x)] /* I/O Support routines. */ BGD_DECLARE(gdIOCtx *) gdNewFileCtx (FILE *); /* If data is null, size is ignored and an initial data buffer is allocated automatically. NOTE: this function assumes gd has the right to free or reallocate "data" at will! Also note that gd will free "data" when the IO context is freed. If data is not null, it must point to memory allocated with gdMalloc, or by a call to gdImage[something]Ptr. If not, see gdNewDynamicCtxEx for an alternative. */ BGD_DECLARE(gdIOCtx *) gdNewDynamicCtx (int size, void *data); /* 2.0.21: if freeFlag is nonzero, gd will free and/or reallocate "data" as needed as described above. If freeFlag is zero, gd will never free or reallocate "data," which means that the context should only be used for *reading* an image from a memory buffer, or writing an image to a memory buffer which is already large enough. If the memory buffer is not large enough and an image write is attempted, the write operation will fail. Those wishing to write an image to a buffer in memory have a much simpler alternative in the gdImage[something]Ptr functions. */ BGD_DECLARE(gdIOCtx *) gdNewDynamicCtxEx (int size, void *data, int freeFlag); BGD_DECLARE(gdIOCtx *) gdNewSSCtx (gdSourcePtr in, gdSinkPtr out); BGD_DECLARE(void *) gdDPExtractData (struct gdIOCtx *ctx, int *size); #define GD2_CHUNKSIZE 128 #define GD2_CHUNKSIZE_MIN 64 #define GD2_CHUNKSIZE_MAX 4096 #define GD2_VERS 2 #define GD2_ID "gd2" #define GD2_FMT_RAW 1 #define GD2_FMT_COMPRESSED 2 /* Image comparison definitions */ BGD_DECLARE(int) gdImageCompare (gdImagePtr im1, gdImagePtr im2); #define GD_CMP_IMAGE 1 /* Actual image IS different */ #define GD_CMP_NUM_COLORS 2 /* Number of Colours in pallette differ */ #define GD_CMP_COLOR 4 /* Image colours differ */ #define GD_CMP_SIZE_X 8 /* Image width differs */ #define GD_CMP_SIZE_Y 16 /* Image heights differ */ #define GD_CMP_TRANSPARENT 32 /* Transparent colour */ #define GD_CMP_BACKGROUND 64 /* Background colour */ #define GD_CMP_INTERLACE 128 /* Interlaced setting */ #define GD_CMP_TRUECOLOR 256 /* Truecolor vs palette differs */ /* resolution affects ttf font rendering, particularly hinting */ #define GD_RESOLUTION 96 /* pixels per inch */ #ifdef __cplusplus } #endif /* newfangled special effects */ #include "gdfx.h" #endif /* GD_H */ #ifdef __cplusplus } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������GL/internal/glcore.h��������������������������������������������������������������������������������0000644�����������������00000014256�14763166026�0010331 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef __gl_core_h_ #define __gl_core_h_ /* * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice including the dates of first publication and * either this permission notice or a reference to * http://oss.sgi.com/projects/FreeB/ * shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of Silicon Graphics, Inc. * shall not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization from * Silicon Graphics, Inc. */ #if !defined(_WIN32_WCE) #include <sys/types.h> #endif #define GL_CORE_SGI 1 #define GL_CORE_MESA 2 #define GL_CORE_APPLE 4 #define GL_CORE_WINDOWS 8 typedef struct __GLcontextRec __GLcontext; /* ** This file defines the interface between the GL core and the surrounding ** "operating system" that supports it (currently the GLX or WGL extensions). ** ** Members (data and function pointers) are documented as imported or ** exported according to how they are used by the core rendering functions. ** Imported members are initialized by the "operating system" and used by ** the core functions. Exported members are initialized by the core functions ** and used by the "operating system". */ /** * Mode and limit information for a context. This information is * kept around in the context so that values can be used during * command execution, and for returning information about the * context to the application. * * Instances of this structure are shared by the driver and the loader. To * maintain binary compatability, new fields \b must be added only to the * end of the structure. * * \sa _gl_context_modes_create */ typedef struct __GLcontextModesRec { struct __GLcontextModesRec * next; GLboolean rgbMode; GLboolean floatMode; GLboolean colorIndexMode; GLuint doubleBufferMode; GLuint stereoMode; GLboolean haveAccumBuffer; GLboolean haveDepthBuffer; GLboolean haveStencilBuffer; GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */ GLuint redMask, greenMask, blueMask, alphaMask; GLint rgbBits; /* total bits for rgb */ GLint indexBits; /* total bits for colorindex */ GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits; GLint depthBits; GLint stencilBits; GLint numAuxBuffers; GLint level; GLint pixmapMode; /* GLX */ GLint visualID; GLint visualType; /**< One of the GLX X visual types. (i.e., * \c GLX_TRUE_COLOR, etc.) */ /* EXT_visual_rating / GLX 1.2 */ GLint visualRating; /* EXT_visual_info / GLX 1.2 */ GLint transparentPixel; /* colors are floats scaled to ints */ GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha; GLint transparentIndex; /* ARB_multisample / SGIS_multisample */ GLint sampleBuffers; GLint samples; /* SGIX_fbconfig / GLX 1.3 */ GLint drawableType; GLint renderType; GLint xRenderable; GLint fbconfigID; /* SGIX_pbuffer / GLX 1.3 */ GLint maxPbufferWidth; GLint maxPbufferHeight; GLint maxPbufferPixels; GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */ GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */ /* SGIX_visual_select_group */ GLint visualSelectGroup; /* OML_swap_method */ GLint swapMethod; GLint screen; /* EXT_texture_from_pixmap */ GLint bindToTextureRgb; GLint bindToTextureRgba; GLint bindToMipmapTexture; GLint bindToTextureTargets; GLint yInverted; } __GLcontextModes; /* Several fields of __GLcontextModes can take these as values. Since * GLX header files may not be available everywhere they need to be used, * redefine them here. */ #define GLX_NONE 0x8000 #define GLX_SLOW_CONFIG 0x8001 #define GLX_TRUE_COLOR 0x8002 #define GLX_DIRECT_COLOR 0x8003 #define GLX_PSEUDO_COLOR 0x8004 #define GLX_STATIC_COLOR 0x8005 #define GLX_GRAY_SCALE 0x8006 #define GLX_STATIC_GRAY 0x8007 #define GLX_TRANSPARENT_RGB 0x8008 #define GLX_TRANSPARENT_INDEX 0x8009 #define GLX_NON_CONFORMANT_CONFIG 0x800D #define GLX_SWAP_EXCHANGE_OML 0x8061 #define GLX_SWAP_COPY_OML 0x8062 #define GLX_SWAP_UNDEFINED_OML 0x8063 #define GLX_DONT_CARE 0xFFFFFFFF #define GLX_RGBA_BIT 0x00000001 #define GLX_COLOR_INDEX_BIT 0x00000002 #define GLX_WINDOW_BIT 0x00000001 #define GLX_PIXMAP_BIT 0x00000002 #define GLX_PBUFFER_BIT 0x00000004 #define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 #define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 #define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 #define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 #define GLX_Y_INVERTED_EXT 0x20D4 #define GLX_TEXTURE_1D_BIT_EXT 0x00000001 #define GLX_TEXTURE_2D_BIT_EXT 0x00000002 #define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 #endif /* __gl_core_h_ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������GL/glxint.h�����������������������������������������������������������������������������������������0000644�����������������00000011142�14763166026�0006536 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef __GLX_glxint_h__ #define __GLX_glxint_h__ /* * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice including the dates of first publication and * either this permission notice or a reference to * http://oss.sgi.com/projects/FreeB/ * shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of Silicon Graphics, Inc. * shall not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization from * Silicon Graphics, Inc. */ #include <X11/X.h> #include <X11/Xdefs.h> #include "GL/gl.h" typedef struct __GLXvisualConfigRec __GLXvisualConfig; typedef struct __GLXFBConfigRec __GLXFBConfig; struct __GLXvisualConfigRec { VisualID vid; int class; Bool rgba; int redSize, greenSize, blueSize, alphaSize; unsigned long redMask, greenMask, blueMask, alphaMask; int accumRedSize, accumGreenSize, accumBlueSize, accumAlphaSize; Bool doubleBuffer; Bool stereo; int bufferSize; int depthSize; int stencilSize; int auxBuffers; int level; /* Start of Extended Visual Properties */ int visualRating; /* visual_rating extension */ int transparentPixel; /* visual_info extension */ /* colors are floats scaled to ints */ int transparentRed, transparentGreen, transparentBlue, transparentAlpha; int transparentIndex; int multiSampleSize; int nMultiSampleBuffers; int visualSelectGroup; }; #define __GLX_MIN_CONFIG_PROPS 18 #define __GLX_MAX_CONFIG_PROPS 500 #define __GLX_EXT_CONFIG_PROPS 10 /* ** Since we send all non-core visual properties as token, value pairs, ** we require 2 words across the wire. In order to maintain backwards ** compatibility, we need to send the total number of words that the ** VisualConfigs are sent back in so old libraries can simply "ignore" ** the new properties. */ #define __GLX_TOTAL_CONFIG (__GLX_MIN_CONFIG_PROPS + \ 2 * __GLX_EXT_CONFIG_PROPS) struct __GLXFBConfigRec { int visualType; int transparentType; /* colors are floats scaled to ints */ int transparentRed, transparentGreen, transparentBlue, transparentAlpha; int transparentIndex; int visualCaveat; int associatedVisualId; int screen; int drawableType; int renderType; int maxPbufferWidth, maxPbufferHeight, maxPbufferPixels; int optimalPbufferWidth, optimalPbufferHeight; /* for SGIX_pbuffer */ int visualSelectGroup; /* visuals grouped by select priority */ unsigned int id; GLboolean rgbMode; GLboolean colorIndexMode; GLboolean doubleBufferMode; GLboolean stereoMode; GLboolean haveAccumBuffer; GLboolean haveDepthBuffer; GLboolean haveStencilBuffer; /* The number of bits present in various buffers */ GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits; GLint depthBits; GLint stencilBits; GLint indexBits; GLint redBits, greenBits, blueBits, alphaBits; GLuint redMask, greenMask, blueMask, alphaMask; GLuint multiSampleSize; /* Number of samples per pixel (0 if no ms) */ GLuint nMultiSampleBuffers; /* Number of availble ms buffers */ GLint maxAuxBuffers; /* frame buffer level */ GLint level; /* color ranges (for SGI_color_range) */ GLboolean extendedRange; GLdouble minRed, maxRed; GLdouble minGreen, maxGreen; GLdouble minBlue, maxBlue; GLdouble minAlpha, maxAlpha; }; #define __GLX_TOTAL_FBCONFIG_PROPS 35 #endif /* !__GLX_glxint_h__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������GL/glxmd.h������������������������������������������������������������������������������������������0000644�����������������00000004046�14763166026�0006351 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _GLX_glxmd_h_ #define _GLX_glxmd_h_ /* * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice including the dates of first publication and * either this permission notice or a reference to * http://oss.sgi.com/projects/FreeB/ * shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of Silicon Graphics, Inc. * shall not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization from * Silicon Graphics, Inc. */ /* ** Machine dependent declarations. */ /* ** Define floating point wire types. These are in IEEE format on the wire. */ typedef float FLOAT32; typedef double FLOAT64; /* ** Like B32, but this is used to store floats in a request. ** ** NOTE: Machines that have a native 32-bit IEEE float can define this as ** nothing. Machines that don't might mimic the float with an integer, ** and then define this to :32. */ #define F32 #endif /* _GLX_glxmd_h_ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������GL/glxtokens.h��������������������������������������������������������������������������������������0000644�����������������00000026254�14763166026�0007261 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef __GLX_glxtokens_h__ #define __GLX_glxtokens_h__ /* * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice including the dates of first publication and * either this permission notice or a reference to * http://oss.sgi.com/projects/FreeB/ * shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of Silicon Graphics, Inc. * shall not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization from * Silicon Graphics, Inc. */ #ifdef __cplusplus extern "C" { #endif #define GLX_VERSION_1_1 1 #define GLX_VERSION_1_2 1 #define GLX_VERSION_1_3 1 #define GLX_VERSION_1_4 1 /* ** Visual Config Attributes (glXGetConfig, glXGetFBConfigAttrib) */ #define GLX_USE_GL 1 /* support GLX rendering */ #define GLX_BUFFER_SIZE 2 /* depth of the color buffer */ #define GLX_LEVEL 3 /* level in plane stacking */ #define GLX_RGBA 4 /* true if RGBA mode */ #define GLX_DOUBLEBUFFER 5 /* double buffering supported */ #define GLX_STEREO 6 /* stereo buffering supported */ #define GLX_AUX_BUFFERS 7 /* number of aux buffers */ #define GLX_RED_SIZE 8 /* number of red component bits */ #define GLX_GREEN_SIZE 9 /* number of green component bits */ #define GLX_BLUE_SIZE 10 /* number of blue component bits */ #define GLX_ALPHA_SIZE 11 /* number of alpha component bits */ #define GLX_DEPTH_SIZE 12 /* number of depth bits */ #define GLX_STENCIL_SIZE 13 /* number of stencil bits */ #define GLX_ACCUM_RED_SIZE 14 /* number of red accum bits */ #define GLX_ACCUM_GREEN_SIZE 15 /* number of green accum bits */ #define GLX_ACCUM_BLUE_SIZE 16 /* number of blue accum bits */ #define GLX_ACCUM_ALPHA_SIZE 17 /* number of alpha accum bits */ /* ** FBConfig-specific attributes */ #define GLX_X_VISUAL_TYPE 0x22 #define GLX_CONFIG_CAVEAT 0x20 /* Like visual_info VISUAL_CAVEAT_EXT */ #define GLX_TRANSPARENT_TYPE 0x23 #define GLX_TRANSPARENT_INDEX_VALUE 0x24 #define GLX_TRANSPARENT_RED_VALUE 0x25 #define GLX_TRANSPARENT_GREEN_VALUE 0x26 #define GLX_TRANSPARENT_BLUE_VALUE 0x27 #define GLX_TRANSPARENT_ALPHA_VALUE 0x28 #define GLX_DRAWABLE_TYPE 0x8010 #define GLX_RENDER_TYPE 0x8011 #define GLX_X_RENDERABLE 0x8012 #define GLX_FBCONFIG_ID 0x8013 #define GLX_MAX_PBUFFER_WIDTH 0x8016 #define GLX_MAX_PBUFFER_HEIGHT 0x8017 #define GLX_MAX_PBUFFER_PIXELS 0x8018 #define GLX_VISUAL_ID 0x800B /* FBConfigSGIX Attributes */ #define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 #define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A /* ** Error return values from glXGetConfig. Success is indicated by ** a value of 0. */ #define GLX_BAD_SCREEN 1 /* screen # is bad */ #define GLX_BAD_ATTRIBUTE 2 /* attribute to get is bad */ #define GLX_NO_EXTENSION 3 /* no glx extension on server */ #define GLX_BAD_VISUAL 4 /* visual # not known by GLX */ #define GLX_BAD_CONTEXT 5 /* returned only by import_context EXT? */ #define GLX_BAD_VALUE 6 /* returned only by glXSwapIntervalSGI? */ #define GLX_BAD_ENUM 7 /* unused? */ /* FBConfig attribute values */ /* ** Generic "don't care" value for glX ChooseFBConfig attributes (except ** GLX_LEVEL) */ #define GLX_DONT_CARE 0xFFFFFFFF /* GLX_RENDER_TYPE bits */ #define GLX_RGBA_BIT 0x00000001 #define GLX_COLOR_INDEX_BIT 0x00000002 #define GLX_RGBA_FLOAT_BIT_ARB 0x00000004 #define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008 /* GLX_DRAWABLE_TYPE bits */ #define GLX_WINDOW_BIT 0x00000001 #define GLX_PIXMAP_BIT 0x00000002 #define GLX_PBUFFER_BIT 0x00000004 /* GLX_CONFIG_CAVEAT attribute values */ #define GLX_NONE 0x8000 #define GLX_SLOW_CONFIG 0x8001 #define GLX_NON_CONFORMANT_CONFIG 0x800D /* GLX_X_VISUAL_TYPE attribute values */ #define GLX_TRUE_COLOR 0x8002 #define GLX_DIRECT_COLOR 0x8003 #define GLX_PSEUDO_COLOR 0x8004 #define GLX_STATIC_COLOR 0x8005 #define GLX_GRAY_SCALE 0x8006 #define GLX_STATIC_GRAY 0x8007 /* GLX_TRANSPARENT_TYPE attribute values */ /* #define GLX_NONE 0x8000 */ #define GLX_TRANSPARENT_RGB 0x8008 #define GLX_TRANSPARENT_INDEX 0x8009 /* glXCreateGLXPbuffer attributes */ #define GLX_PRESERVED_CONTENTS 0x801B #define GLX_LARGEST_PBUFFER 0x801C #define GLX_PBUFFER_HEIGHT 0x8040 /* New for GLX 1.3 */ #define GLX_PBUFFER_WIDTH 0x8041 /* New for GLX 1.3 */ /* glXQueryGLXPBuffer attributes */ #define GLX_WIDTH 0x801D #define GLX_HEIGHT 0x801E #define GLX_EVENT_MASK 0x801F /* glXCreateNewContext render_type attribute values */ #define GLX_RGBA_TYPE 0x8014 #define GLX_COLOR_INDEX_TYPE 0x8015 /* glXQueryContext attributes */ /* #define GLX_FBCONFIG_ID 0x8013 */ /* #define GLX_RENDER_TYPE 0x8011 */ #define GLX_SCREEN 0x800C /* glXSelectEvent event mask bits */ #define GLX_PBUFFER_CLOBBER_MASK 0x08000000 #define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x04000000 /* GLXPbufferClobberEvent event_type values */ #define GLX_DAMAGED 0x8020 #define GLX_SAVED 0x8021 #define GLX_EXCHANGE_COMPLETE_INTEL 0x8180 #define GLX_BLIT_COMPLETE_INTEL 0x8181 #define GLX_FLIP_COMPLETE_INTEL 0x8182 /* GLXPbufferClobberEvent draw_type values */ #define GLX_WINDOW 0x8022 #define GLX_PBUFFER 0x8023 /* GLXPbufferClobberEvent buffer_mask bits */ #define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 #define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 #define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 #define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 #define GLX_AUX_BUFFERS_BIT 0x00000010 #define GLX_DEPTH_BUFFER_BIT 0x00000020 #define GLX_STENCIL_BUFFER_BIT 0x00000040 #define GLX_ACCUM_BUFFER_BIT 0x00000080 /* ** Extension return values from glXGetConfig. These are also ** accepted as parameter values for glXChooseVisual. */ #define GLX_X_VISUAL_TYPE_EXT 0x22 /* visual_info extension type */ #define GLX_TRANSPARENT_TYPE_EXT 0x23 /* visual_info extension */ #define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 /* visual_info extension */ #define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 /* visual_info extension */ #define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 /* visual_info extension */ #define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 /* visual_info extension */ #define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 /* visual_info extension */ /* Property values for visual_type */ #define GLX_TRUE_COLOR_EXT 0x8002 #define GLX_DIRECT_COLOR_EXT 0x8003 #define GLX_PSEUDO_COLOR_EXT 0x8004 #define GLX_STATIC_COLOR_EXT 0x8005 #define GLX_GRAY_SCALE_EXT 0x8006 #define GLX_STATIC_GRAY_EXT 0x8007 /* Property values for transparent pixel */ #define GLX_NONE_EXT 0x8000 #define GLX_TRANSPARENT_RGB_EXT 0x8008 #define GLX_TRANSPARENT_INDEX_EXT 0x8009 /* Property values for visual_rating */ #define GLX_VISUAL_CAVEAT_EXT 0x20 /* visual_rating extension type */ #define GLX_SLOW_VISUAL_EXT 0x8001 #define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D /* Property values for swap method (GLX_OML_swap_method) */ #define GLX_SWAP_METHOD_OML 0x8060 #define GLX_SWAP_EXCHANGE_OML 0x8061 #define GLX_SWAP_COPY_OML 0x8062 #define GLX_SWAP_UNDEFINED_OML 0x8063 /* Property values for multi-sampling */ #define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028 /* visuals grouped by select priority */ /* ** Names for attributes to glXGetClientString. */ #define GLX_VENDOR 0x1 #define GLX_VERSION 0x2 #define GLX_EXTENSIONS 0x3 /* ** Names for attributes to glXQueryContextInfoEXT. */ #define GLX_SHARE_CONTEXT_EXT 0x800A /* id of share context */ #define GLX_VISUAL_ID_EXT 0x800B /* id of context's visual */ #define GLX_SCREEN_EXT 0x800C /* screen number */ /* ** GLX_EXT_texture_from_pixmap */ #define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 #define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 #define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 #define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 #define GLX_Y_INVERTED_EXT 0x20D4 #define GLX_TEXTURE_FORMAT_EXT 0x20D5 #define GLX_TEXTURE_TARGET_EXT 0x20D6 #define GLX_MIPMAP_TEXTURE_EXT 0x20D7 #define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8 #define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9 #define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA #define GLX_TEXTURE_1D_BIT_EXT 0x00000001 #define GLX_TEXTURE_2D_BIT_EXT 0x00000002 #define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 #define GLX_TEXTURE_1D_EXT 0x20DB #define GLX_TEXTURE_2D_EXT 0x20DC #define GLX_TEXTURE_RECTANGLE_EXT 0x20DD #define GLX_FRONT_LEFT_EXT 0x20DE #define GLX_FRONT_RIGHT_EXT 0x20DF #define GLX_BACK_LEFT_EXT 0x20E0 #define GLX_BACK_RIGHT_EXT 0x20E1 #define GLX_FRONT_EXT GLX_FRONT_LEFT_EXT #define GLX_BACK_EXT GLX_BACK_LEFT_EXT #define GLX_AUX0_EXT 0x20E2 #define GLX_AUX1_EXT 0x20E3 #define GLX_AUX2_EXT 0x20E4 #define GLX_AUX3_EXT 0x20E5 #define GLX_AUX4_EXT 0x20E6 #define GLX_AUX5_EXT 0x20E7 #define GLX_AUX6_EXT 0x20E8 #define GLX_AUX7_EXT 0x20E9 #define GLX_AUX8_EXT 0x20EA #define GLX_AUX9_EXT 0x20EB /* * GLX 1.4 and later: */ #define GLX_SAMPLE_BUFFERS_SGIS 100000 #define GLX_SAMPLES_SGIS 100001 /* * GLX_EXT_framebuffer_SRGB */ #define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2 /* * GLX_ARB_create_context * GLX_ARB_create_context_profile * GLX_EXT_create_context_es2_profile */ #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 #define GLX_CONTEXT_FLAGS_ARB 0x2094 #define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 #define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001 #define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 #define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x0001 #define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x0002 #define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x0004 /* * GLX_ARB_create_context_robustness */ #define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x0004 #define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 #define GLX_NO_RESET_NOTIFICATION_ARB 0x8261 #define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252 #ifdef __cplusplus } #endif #endif /* !__GLX_glxtokens_h__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������GL/glxproto.h���������������������������������������������������������������������������������������0000644�����������������00000236330�14763166026�0007117 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _GLX_glxproto_h_ #define _GLX_glxproto_h_ /* * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice including the dates of first publication and * either this permission notice or a reference to * http://oss.sgi.com/projects/FreeB/ * shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of Silicon Graphics, Inc. * shall not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization from * Silicon Graphics, Inc. */ #include <GL/glxmd.h> /*****************************************************************************/ /* ** Errrors. */ #define GLXBadContext 0 #define GLXBadContextState 1 #define GLXBadDrawable 2 #define GLXBadPixmap 3 #define GLXBadContextTag 4 #define GLXBadCurrentWindow 5 #define GLXBadRenderRequest 6 #define GLXBadLargeRequest 7 #define GLXUnsupportedPrivateRequest 8 #define GLXBadFBConfig 9 #define GLXBadPbuffer 10 #define GLXBadCurrentDrawable 11 #define GLXBadWindow 12 #define GLXBadProfileARB 13 #define __GLX_NUMBER_ERRORS 14 /* ** Events. ** __GLX_NUMBER_EVENTS is set to 17 to account for the BufferClobberSGIX ** event - this helps initialization if the server supports the pbuffer ** extension and the client doesn't. */ #define GLX_PbufferClobber 0 #define GLX_BufferSwapComplete 1 #define __GLX_NUMBER_EVENTS 17 #define GLX_EXTENSION_NAME "GLX" #define GLX_EXTENSION_ALIAS "SGI-GLX" #define __GLX_MAX_CONTEXT_PROPS 3 #ifndef GLX_VENDOR #define GLX_VENDOR 0x1 #endif #ifndef GLX_VERSION #define GLX_VERSION 0x2 #endif #ifndef GLX_EXTENSIONS #define GLX_EXTENSIONS 0x3 #endif /*****************************************************************************/ /* ** For the structure definitions in this file, we must redefine these types in ** terms of Xmd.h types, which may include bitfields. All of these are ** undef'ed at the end of this file, restoring the definitions in glx.h. */ #define GLXContextID CARD32 #define GLXPixmap CARD32 #define GLXDrawable CARD32 #define GLXPbuffer CARD32 #define GLXWindow CARD32 #define GLXFBConfigID CARD32 #define GLXFBConfigIDSGIX CARD32 #define GLXPbufferSGIX CARD32 /* ** ContextTag is not exposed to the API. */ typedef CARD32 GLXContextTag; /*****************************************************************************/ /* ** Sizes of basic wire types. */ #define __GLX_SIZE_INT8 1 #define __GLX_SIZE_INT16 2 #define __GLX_SIZE_INT32 4 #define __GLX_SIZE_CARD8 1 #define __GLX_SIZE_CARD16 2 #define __GLX_SIZE_CARD32 4 #define __GLX_SIZE_FLOAT32 4 #define __GLX_SIZE_FLOAT64 8 /*****************************************************************************/ /* Requests */ /* ** Render command request. A bunch of rendering commands are packed into ** a single X extension request. */ typedef struct GLXRender { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextTag contextTag B32; } xGLXRenderReq; #define sz_xGLXRenderReq 8 /* ** The maximum size that a GLXRender command can be. The value must fit ** in 16 bits and should be a multiple of 4. */ #define __GLX_MAX_RENDER_CMD_SIZE 64000 /* ** Large render command request. A single large rendering command ** is output in multiple X extension requests. The first packet ** contains an opcode dependent header (see below) that describes ** the data that follows. */ typedef struct GLXRenderLarge { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextTag contextTag B32; CARD16 requestNumber B16; CARD16 requestTotal B16; CARD32 dataBytes B32; } xGLXRenderLargeReq; #define sz_xGLXRenderLargeReq 16 /* ** GLX single request. Commands that go over as single GLX protocol ** requests use this structure. The glxCode will be one of the X_GLsop ** opcodes. */ typedef struct GLXSingle { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextTag contextTag B32; } xGLXSingleReq; #define sz_xGLXSingleReq 8 /* ** glXQueryVersion request */ typedef struct GLXQueryVersion { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 majorVersion B32; CARD32 minorVersion B32; } xGLXQueryVersionReq; #define sz_xGLXQueryVersionReq 12 /* ** glXIsDirect request */ typedef struct GLXIsDirect { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextID context B32; } xGLXIsDirectReq; #define sz_xGLXIsDirectReq 8 /* ** glXCreateContext request */ typedef struct GLXCreateContext { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextID context B32; CARD32 visual B32; CARD32 screen B32; GLXContextID shareList B32; BOOL isDirect; CARD8 reserved1; CARD16 reserved2 B16; } xGLXCreateContextReq; #define sz_xGLXCreateContextReq 24 /* ** glXDestroyContext request */ typedef struct GLXDestroyContext { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextID context B32; } xGLXDestroyContextReq; #define sz_xGLXDestroyContextReq 8 /* ** glXMakeCurrent request */ typedef struct GLXMakeCurrent { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXDrawable drawable B32; GLXContextID context B32; GLXContextTag oldContextTag B32; } xGLXMakeCurrentReq; #define sz_xGLXMakeCurrentReq 16 /* ** glXWaitGL request */ typedef struct GLXWaitGL { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextTag contextTag B32; } xGLXWaitGLReq; #define sz_xGLXWaitGLReq 8 /* ** glXWaitX request */ typedef struct GLXWaitX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextTag contextTag B32; } xGLXWaitXReq; #define sz_xGLXWaitXReq 8 /* ** glXCopyContext request */ typedef struct GLXCopyContext { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextID source B32; GLXContextID dest B32; CARD32 mask B32; GLXContextTag contextTag B32; } xGLXCopyContextReq; #define sz_xGLXCopyContextReq 20 /* ** glXSwapBuffers request */ typedef struct GLXSwapBuffers { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextTag contextTag B32; GLXDrawable drawable B32; } xGLXSwapBuffersReq; #define sz_xGLXSwapBuffersReq 12 /* ** glXUseXFont request */ typedef struct GLXUseXFont { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextTag contextTag B32; CARD32 font B32; CARD32 first B32; CARD32 count B32; CARD32 listBase B32; } xGLXUseXFontReq; #define sz_xGLXUseXFontReq 24 /* ** glXCreateGLXPixmap request */ typedef struct GLXCreateGLXPixmap { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 screen B32; CARD32 visual B32; CARD32 pixmap B32; GLXPixmap glxpixmap B32; } xGLXCreateGLXPixmapReq; #define sz_xGLXCreateGLXPixmapReq 20 /* ** glXDestroyGLXPixmap request */ typedef struct GLXDestroyGLXPixmap { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXPixmap glxpixmap B32; } xGLXDestroyGLXPixmapReq; #define sz_xGLXDestroyGLXPixmapReq 8 /* ** glXGetVisualConfigs request */ typedef struct GLXGetVisualConfigs { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 screen B32; } xGLXGetVisualConfigsReq; #define sz_xGLXGetVisualConfigsReq 8 /* ** glXVendorPrivate request. */ typedef struct GLXVendorPrivate { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ GLXContextTag contextTag B32; /* ** More data may follow; this is just the header. */ } xGLXVendorPrivateReq; #define sz_xGLXVendorPrivateReq 12 /* ** glXVendorPrivateWithReply request */ typedef struct GLXVendorPrivateWithReply { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ GLXContextTag contextTag B32; /* ** More data may follow; this is just the header. */ } xGLXVendorPrivateWithReplyReq; #define sz_xGLXVendorPrivateWithReplyReq 12 /* ** glXQueryExtensionsString request */ typedef struct GLXQueryExtensionsString { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 screen B32; } xGLXQueryExtensionsStringReq; #define sz_xGLXQueryExtensionsStringReq 8 /* ** glXQueryServerString request */ typedef struct GLXQueryServerString { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 screen B32; CARD32 name B32; } xGLXQueryServerStringReq; #define sz_xGLXQueryServerStringReq 12 /* ** glXClientInfo request */ typedef struct GLXClientInfo { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 major B32; CARD32 minor B32; CARD32 numbytes B32; } xGLXClientInfoReq; #define sz_xGLXClientInfoReq 16 /*** Start of GLX 1.3 requests */ /* ** glXGetFBConfigs request */ typedef struct GLXGetFBConfigs { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 screen B32; } xGLXGetFBConfigsReq; #define sz_xGLXGetFBConfigsReq 8 /* ** glXCreatePixmap request */ typedef struct GLXCreatePixmap { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 screen B32; GLXFBConfigID fbconfig B32; CARD32 pixmap B32; GLXPixmap glxpixmap B32; CARD32 numAttribs B32; /* followed by attribute list */ } xGLXCreatePixmapReq; #define sz_xGLXCreatePixmapReq 24 /* ** glXDestroyPixmap request */ typedef struct GLXDestroyPixmap { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXPixmap glxpixmap B32; } xGLXDestroyPixmapReq; #define sz_xGLXDestroyPixmapReq 8 /* ** glXCreateNewContext request */ typedef struct GLXCreateNewContext { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextID context B32; GLXFBConfigID fbconfig B32; CARD32 screen B32; CARD32 renderType; GLXContextID shareList B32; BOOL isDirect; CARD8 reserved1; CARD16 reserved2 B16; } xGLXCreateNewContextReq; #define sz_xGLXCreateNewContextReq 28 /* ** glXQueryContext request */ typedef struct GLXQueryContext { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextID context B32; } xGLXQueryContextReq; #define sz_xGLXQueryContextReq 8 /* ** glXMakeContextCurrent request */ typedef struct GLXMakeContextCurrent { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextTag oldContextTag B32; GLXDrawable drawable B32; GLXDrawable readdrawable B32; GLXContextID context B32; } xGLXMakeContextCurrentReq; #define sz_xGLXMakeContextCurrentReq 20 /* ** glXCreatePbuffer request */ typedef struct GLXCreatePbuffer { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 screen B32; GLXFBConfigID fbconfig B32; GLXPbuffer pbuffer B32; CARD32 numAttribs B32; /* followed by attribute list */ } xGLXCreatePbufferReq; #define sz_xGLXCreatePbufferReq 20 /* ** glXDestroyPbuffer request */ typedef struct GLXDestroyPbuffer { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXPbuffer pbuffer B32; } xGLXDestroyPbufferReq; #define sz_xGLXDestroyPbufferReq 8 /* ** glXGetDrawableAttributes request */ typedef struct GLXGetDrawableAttributes { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXDrawable drawable B32; } xGLXGetDrawableAttributesReq; #define sz_xGLXGetDrawableAttributesReq 8 /* ** glXChangeDrawableAttributes request */ typedef struct GLXChangeDrawableAttributes { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXDrawable drawable B32; CARD32 numAttribs B32; /* followed by attribute list */ } xGLXChangeDrawableAttributesReq; #define sz_xGLXChangeDrawableAttributesReq 12 /* ** glXCreateWindow request */ typedef struct GLXCreateWindow { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 screen B32; GLXFBConfigID fbconfig B32; CARD32 window B32; GLXWindow glxwindow B32; CARD32 numAttribs B32; /* followed by attribute list */ } xGLXCreateWindowReq; #define sz_xGLXCreateWindowReq 24 /* ** glXDestroyWindow request */ typedef struct GLXDestroyWindow { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXWindow glxwindow B32; } xGLXDestroyWindowReq; #define sz_xGLXDestroyWindowReq 8 /* Replies */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 error B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXGetErrorReply; #define sz_xGLXGetErrorReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; GLXContextTag contextTag B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXMakeCurrentReply; #define sz_xGLXMakeCurrentReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXReadPixelsReply; #define sz_xGLXReadPixelsReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 width B32; CARD32 height B32; CARD32 depth B32; CARD32 pad6 B32; } xGLXGetTexImageReply; #define sz_xGLXGetTexImageReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 width B32; CARD32 height B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXGetSeparableFilterReply; #define sz_xGLXGetSeparableFilterReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 width B32; CARD32 height B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXGetConvolutionFilterReply; #define sz_xGLXGetConvolutionFilterReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 width B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXGetHistogramReply; #define sz_xGLXGetHistogramReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXGetMinmaxReply; #define sz_xGLXGetMinmaxReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 retval B32; CARD32 size B32; CARD32 newMode B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXRenderModeReply; #define sz_xGLXRenderModeReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 majorVersion B32; CARD32 minorVersion B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXQueryVersionReply; #define sz_xGLXQueryVersionReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 numVisuals B32; CARD32 numProps B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXGetVisualConfigsReply; #define sz_xGLXGetVisualConfigsReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; BOOL isDirect; CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGLXIsDirectReply; #define sz_xGLXIsDirectReply 32 /* ** This reply structure is used for all single replies. Single replies ** ship either 1 piece of data or N pieces of data. In these cases ** size indicates how much data is to be returned. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 retval B32; CARD32 size B32; CARD32 pad3 B32; /* NOTE: may hold a single value */ CARD32 pad4 B32; /* NOTE: may hold half a double */ CARD32 pad5 B32; CARD32 pad6 B32; } xGLXSingleReply; #define sz_xGLXSingleReply 32 /* ** This reply structure is used for all Vendor Private replies. Vendor ** Private replies can ship up to 24 bytes within the header or can ** be variable sized, in which case, the reply length field indicates ** the number of words of data which follow the header. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 retval B32; CARD32 size B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXVendorPrivReply; #define sz_xGLXVendorPrivReply 32 /* ** QueryExtensionsStringReply ** n indicates the number of bytes to be returned. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 n B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXQueryExtensionsStringReply; #define sz_xGLXQueryExtensionsStringReply 32 /* ** QueryServerString Reply struct ** n indicates the number of bytes to be returned. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 n B32; CARD32 pad3 B32; /* NOTE: may hold a single value */ CARD32 pad4 B32; /* NOTE: may hold half a double */ CARD32 pad5 B32; CARD32 pad6 B32; } xGLXQueryServerStringReply; #define sz_xGLXQueryServerStringReply 32 /*** Start of GLX 1.3 replies */ /* ** glXGetFBConfigs reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 numFBConfigs B32; CARD32 numAttribs B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXGetFBConfigsReply; #define sz_xGLXGetFBConfigsReply 32 /* ** glXQueryContext reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 n B32; /* number of attribute/value pairs */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXQueryContextReply; #define sz_xGLXQueryContextReply 32 /* ** glXMakeContextCurrent reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; GLXContextTag contextTag B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXMakeContextCurrentReply; #define sz_xGLXMakeContextCurrentReply 32 /* ** glXCreateGLXPbuffer reply ** This is used only in the direct rendering case on SGIs - otherwise ** CreateGLXPbuffer has no reply. It is not part of GLX 1.3. */ typedef struct { BYTE type; /* X_Reply */ CARD8 success; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXCreateGLXPbufferReply; #define sz_xGLXCreateGLXPbufferReply 32 /* ** glXGetDrawableAttributes reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 numAttribs B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXGetDrawableAttributesReply; #define sz_xGLXGetDrawableAttributesReply 32 /* ** glXGetColorTable reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 width B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXGetColorTableReply; #define sz_xGLXGetColorTableReply 32 /************************************************************************/ /* GLX extension requests and replies */ /* ** glXQueryContextInfoEXT request */ typedef struct GLXQueryContextInfoEXT { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ GLXContextID context B32; } xGLXQueryContextInfoEXTReq; #define sz_xGLXQueryContextInfoEXTReq 16 /* ** glXQueryContextInfoEXT reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 n B32; /* number of attribute/value pairs */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXQueryContextInfoEXTReply; #define sz_xGLXQueryContextInfoEXTReply 32 /* ** glXMakeCurrentReadSGI request */ typedef struct GLXMakeCurrentReadSGI { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ GLXContextTag oldContextTag B32; GLXDrawable drawable B32; GLXDrawable readable B32; GLXContextID context B32; } xGLXMakeCurrentReadSGIReq; #define sz_xGLXMakeCurrentReadSGIReq 24 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; GLXContextTag contextTag B32; CARD32 writeVid B32; CARD32 writeType B32; CARD32 readVid B32; CARD32 readType B32; CARD32 pad6 B32; } xGLXMakeCurrentReadSGIReply; #define sz_xGLXMakeCurrentReadSGIReply 32 /* ** glXGetFBConfigsSGIX request */ typedef struct GLXGetFBConfigsSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ CARD32 screen B32; } xGLXGetFBConfigsSGIXReq; #define sz_xGLXGetFBConfigsSGIXReq 16 /* ** glXCreateContextWithConfigSGIX request */ typedef struct GLXCreateContextWithConfigSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ GLXContextID context B32; GLXFBConfigID fbconfig B32; CARD32 screen B32; CARD32 renderType; GLXContextID shareList B32; BOOL isDirect; CARD8 reserved1; CARD16 reserved2 B16; } xGLXCreateContextWithConfigSGIXReq; #define sz_xGLXCreateContextWithConfigSGIXReq 36 /* ** glXCreatePixmapWithConfigSGIX request */ typedef struct GLXCreateGLXPixmapWithConfigSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ CARD32 screen B32; GLXFBConfigID fbconfig B32; CARD32 pixmap B32; GLXPixmap glxpixmap B32; } xGLXCreateGLXPixmapWithConfigSGIXReq; #define sz_xGLXCreateGLXPixmapWithConfigSGIXReq 28 /* ** glXCreateGLXPbufferSGIX request */ typedef struct GLXCreateGLXPbufferSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ CARD32 screen B32; GLXFBConfigID fbconfig B32; GLXPbuffer pbuffer B32; CARD32 width B32; CARD32 height B32; /* followed by attribute list */ } xGLXCreateGLXPbufferSGIXReq; #define sz_xGLXCreateGLXPbufferSGIXReq 32 /* ** glXDestroyGLXPbufferSGIX request */ typedef struct GLXDestroyGLXPbuffer { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ GLXPbuffer pbuffer B32; } xGLXDestroyGLXPbufferSGIXReq; #define sz_xGLXDestroyGLXPbufferSGIXReq 16 /* ** glXChangeDrawableAttributesSGIX request */ typedef struct GLXChangeDrawableAttributesSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ GLXDrawable drawable B32; CARD32 numAttribs B32; /* followed by attribute list */ } xGLXChangeDrawableAttributesSGIXReq; #define sz_xGLXChangeDrawableAttributesSGIXReq 20 /* ** glXGetDrawableAttributesSGIX request */ typedef struct GLXGetDrawableAttributesSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ GLXDrawable drawable B32; } xGLXGetDrawableAttributesSGIXReq; #define sz_xGLXGetDrawableAttributesSGIXReq 16 /* ** glXGetDrawableAttributesSGIX reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 numAttribs B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXGetDrawableAttributesSGIXReply; #define sz_xGLXGetDrawableAttributesSGIXReply 32 /* ** glXJoinSwapGroupSGIX request */ typedef struct GLXJoinSwapGroupSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 unused B32; /* corresponds to contextTag in hdr */ GLXDrawable drawable B32; GLXDrawable member B32; } xGLXJoinSwapGroupSGIXReq; #define sz_xGLXJoinSwapGroupSGIXReq 20 /* ** glXBindSwapBarrierSGIX request */ typedef struct GLXBindSwapBarrierSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 unused B32; /* corresponds to contextTag in hdr */ GLXDrawable drawable B32; CARD32 barrier B32; } xGLXBindSwapBarrierSGIXReq; #define sz_xGLXBindSwapBarrierSGIXReq 20 /* ** glXQueryMaxSwapBarriersSGIX request */ typedef struct GLXQueryMaxSwapBarriersSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 unused B32; /* corresponds to contextTag in hdr */ CARD32 screen B32; } xGLXQueryMaxSwapBarriersSGIXReq; #define sz_xGLXQueryMaxSwapBarriersSGIXReq 16 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 max B32; CARD32 size B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXQueryMaxSwapBarriersSGIXReply; #define sz_xGLXQueryMaxSwapBarriersSGIXReply 32 /* ** glXQueryHyperpipeNetworkSGIX request */ typedef struct GLXQueryHyperpipeNetworkSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ CARD32 screen B32; } xGLXQueryHyperpipeNetworkSGIXReq; #define sz_xGLXQueryHyperpipeNetworkSGIXReq 16 /* ** glXQueryHyperpipeNetworkSGIX reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 n B32; CARD32 npipes B32; /* NOTE: may hold a single value */ CARD32 pad4 B32; /* NOTE: may hold half a double */ CARD32 pad5 B32; CARD32 pad6 B32; } xGLXQueryHyperpipeNetworkSGIXReply; #define sz_xGLXQueryHyperpipeNetworkSGIXReply 32 /* ** glXDestroyHyperpipeConfigSGIX request */ typedef struct GLXDestroyHyperpipeConfigSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ CARD32 screen B32; CARD32 hpId B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xGLXDestroyHyperpipeConfigSGIXReq; #define sz_xGLXDestroyHyperpipeConfigSGIXReq 32 /* ** glXDestroyHyperpipeConfigSGIX reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 n B32; CARD32 success B32; /* NOTE: may hold a single value */ CARD32 pad4 B32; /* NOTE: may hold half a double */ CARD32 pad5 B32; CARD32 pad6 B32; } xGLXDestroyHyperpipeConfigSGIXReply; #define sz_xGLXDestroyHyperpipeConfigSGIXReply 32 /* ** glXQueryHyperpipeConfigSGIX request */ typedef struct GLXQueryHyperpipeConfigSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ CARD32 screen B32; CARD32 hpId B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xGLXQueryHyperpipeConfigSGIXReq; #define sz_xGLXQueryHyperpipeConfigSGIXReq 32 /* ** glXQueryHyperpipeConfigSGIX reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 n B32; CARD32 npipes B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXQueryHyperpipeConfigSGIXReply; #define sz_xGLXQueryHyperpipeConfigSGIXReply 32 /* ** glXHyperpipeConfigSGIX request */ typedef struct { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ CARD32 screen B32; CARD32 npipes B32; CARD32 networkId B32; CARD32 pad2 B32; CARD32 pad3 B32; /* followed by attribute list */ } xGLXHyperpipeConfigSGIXReq; #define sz_xGLXHyperpipeConfigSGIXReq 32 /* ** glXHyperpipeConfigSGIX reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 n B32; CARD32 npipes B32; CARD32 hpId B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXHyperpipeConfigSGIXReply; #define sz_xGLXHyperpipeConfigSGIXReply 32 /** * \name Protocol structures for GLX_ARB_create_context and * GLX_ARB_create_context_profile */ /*@{*/ /** * Protocol header for glXSetClientInfoARB * * This structure is follwed by \c numVersions * 2 \c CARD32 values listing * the OpenGL versions supported by the client. The pairs of values are an * OpenGL major version followed by a minor version. For example, * * CARD32 versions[4] = { 2, 1, 3, 0 }; * * says that the client supports OpenGL 2.1 and OpenGL 3.0. * * These are followed by \c numGLExtensionBytes bytes of \c STRING8 containing * the OpenGL extension string supported by the client and up to 3 bytes of * padding. * * The list of OpenGL extensions is followed by \c numGLXExtensionBytes bytes * of \c STRING8 containing the GLX extension string supported by the client * and up to 3 bytes of padding. * * This protocol replaces \c GLXClientInfo. * * \sa GLXClientInfo, GLXSetClientInfo2ARB */ typedef struct GLXSetClientInfoARB { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 major B32; CARD32 minor B32; CARD32 numVersions B32; CARD32 numGLExtensionBytes B32; CARD32 numGLXExtensionBytes B32; /* ** More data may follow; this is just the header. */ } xGLXSetClientInfoARBReq; #define sz_xGLXSetClientInfoARBReq 24 /** * Protocol head for glXCreateContextAttribsARB * * This protocol replaces \c GLXCreateContext, \c GLXCreateNewContext, and * \c GLXCreateContextWithConfigSGIX. */ typedef struct GLXCreateContextAttribsARB { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextID context B32; GLXFBConfigID fbconfig B32; CARD32 screen; GLXContextID shareList B32; BOOL isDirect; CARD8 reserved1; CARD16 reserved2 B16; CARD32 numAttribs B32; /* followed by attribute list */ } xGLXCreateContextAttribsARBReq; #define sz_xGLXCreateContextAttribsARBReq 28 /** * Protocol header for glXSetClientInfo2ARB * * The glXSetClientInfo2ARB protocol differs from glXSetClientInfoARB in that * the list of OpenGL versions supported by the client is 3 \c CARD32 values * per version: major version, minor version, and supported profile mask. * * This protocol replaces \c GLXClientInfo and \c GLXSetClientInfoARB. * * \sa GLXClientInfo, GLXSetClientInfoARB */ typedef struct GLXSetClientInfo2ARB { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 major B32; CARD32 minor B32; CARD32 numVersions B32; CARD32 numGLExtensionBytes B32; CARD32 numGLXExtensionBytes B32; /* ** More data may follow; this is just the header. */ } xGLXSetClientInfo2ARBReq; #define sz_xGLXSetClientInfo2ARBReq 24 /*@}*/ /************************************************************************/ /* ** Events */ typedef struct { BYTE type; BYTE pad; CARD16 sequenceNumber B16; CARD16 event_type B16; /*** was clobber_class */ CARD16 draw_type B16; CARD32 drawable B32; CARD32 buffer_mask B32; /*** was mask */ CARD16 aux_buffer B16; CARD16 x B16; CARD16 y B16; CARD16 width B16; CARD16 height B16; CARD16 count B16; CARD32 unused2 B32; } xGLXPbufferClobberEvent; typedef struct { BYTE type; BYTE pad; CARD16 sequenceNumber B16; CARD16 event_type B16; CARD32 drawable; CARD32 ust_hi B32; CARD32 ust_lo B32; CARD32 msc_hi B32; CARD32 msc_lo B32; CARD32 sbc_hi B32; CARD32 sbc_lo B32; } xGLXBufferSwapComplete; typedef struct { BYTE type; BYTE pad; CARD16 sequenceNumber B16; CARD16 event_type B16; CARD16 pad2; CARD32 drawable; CARD32 ust_hi B32; CARD32 ust_lo B32; CARD32 msc_hi B32; CARD32 msc_lo B32; CARD32 sbc B32; } xGLXBufferSwapComplete2; /************************************************************************/ /* ** Size of the standard X request header. */ #define __GLX_SINGLE_HDR_SIZE sz_xGLXSingleReq #define __GLX_VENDPRIV_HDR_SIZE sz_xGLXVendorPrivateReq #define __GLX_RENDER_HDR \ CARD16 length B16; \ CARD16 opcode B16 #define __GLX_RENDER_HDR_SIZE 4 typedef struct { __GLX_RENDER_HDR; } __GLXrenderHeader; #define __GLX_RENDER_LARGE_HDR \ CARD32 length B32; \ CARD32 opcode B32 #define __GLX_RENDER_LARGE_HDR_SIZE 8 typedef struct { __GLX_RENDER_LARGE_HDR; } __GLXrenderLargeHeader; /* ** The glBitmap, glPolygonStipple, glTexImage[12]D, glTexSubImage[12]D ** and glDrawPixels calls all have a pixel header transmitted after the ** Render or RenderLarge header and before their own opcode specific ** headers. */ #define __GLX_PIXEL_HDR \ BOOL swapBytes; \ BOOL lsbFirst; \ CARD8 reserved0; \ CARD8 reserved1; \ CARD32 rowLength B32; \ CARD32 skipRows B32; \ CARD32 skipPixels B32; \ CARD32 alignment B32 #define __GLX_PIXEL_HDR_SIZE 20 typedef struct { __GLX_PIXEL_HDR; } __GLXpixelHeader; /* ** glTexImage[34]D and glTexSubImage[34]D calls ** all have a pixel header transmitted after the Render or RenderLarge ** header and before their own opcode specific headers. */ #define __GLX_PIXEL_3D_HDR \ BOOL swapBytes; \ BOOL lsbFirst; \ CARD8 reserved0; \ CARD8 reserved1; \ CARD32 rowLength B32; \ CARD32 imageHeight B32; \ CARD32 imageDepth B32; \ CARD32 skipRows B32; \ CARD32 skipImages B32; \ CARD32 skipVolumes B32; \ CARD32 skipPixels B32; \ CARD32 alignment B32 #define __GLX_PIXEL_3D_HDR_SIZE 36 /* ** Data that is specific to a glBitmap call. The data is sent in the ** following order: ** Render or RenderLarge header ** Pixel header ** Bitmap header */ #define __GLX_BITMAP_HDR \ CARD32 width B32; \ CARD32 height B32; \ FLOAT32 xorig F32; \ FLOAT32 yorig F32; \ FLOAT32 xmove F32; \ FLOAT32 ymove F32 typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_HDR; __GLX_BITMAP_HDR; } __GLXbitmapHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_PIXEL_HDR; __GLX_BITMAP_HDR; } __GLXbitmapLargeHeader; typedef struct { __GLX_PIXEL_HDR; __GLX_BITMAP_HDR; } __GLXdispatchBitmapHeader; #define __GLX_BITMAP_HDR_SIZE 24 #define __GLX_BITMAP_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + __GLX_BITMAP_HDR_SIZE) #define __GLX_BITMAP_CMD_DISPATCH_HDR_SIZE \ (__GLX_PIXEL_HDR_SIZE + __GLX_BITMAP_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_HDR; } __GLXpolygonStippleHeader; #define __GLX_POLYGONSTIPPLE_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE) /* ** Data that is specific to a glTexImage1D or glTexImage2D call. The ** data is sent in the following order: ** Render or RenderLarge header ** Pixel header ** TexImage header ** When a glTexImage1D call the height field is unexamined by the server. */ #define __GLX_TEXIMAGE_HDR \ CARD32 target B32; \ CARD32 level B32; \ CARD32 components B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 border B32; \ CARD32 format B32; \ CARD32 type B32 #define __GLX_TEXIMAGE_HDR_SIZE 32 #define __GLX_TEXIMAGE_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + __GLX_TEXIMAGE_HDR_SIZE) #define __GLX_TEXIMAGE_CMD_DISPATCH_HDR_SIZE \ (__GLX_PIXEL_HDR_SIZE + __GLX_TEXIMAGE_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_HDR; __GLX_TEXIMAGE_HDR; } __GLXtexImageHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_PIXEL_HDR; __GLX_TEXIMAGE_HDR; } __GLXtexImageLargeHeader; typedef struct { __GLX_PIXEL_HDR; __GLX_TEXIMAGE_HDR; } __GLXdispatchTexImageHeader; /* ** Data that is specific to a glTexImage3D or glTexImage4D call. The ** data is sent in the following order: ** Render or RenderLarge header ** Pixel 3D header ** TexImage 3D header ** When a glTexImage3D call the size4d and woffset fields are unexamined ** by the server. ** Could be used by all TexImage commands and perhaps should be in the ** future. */ #define __GLX_TEXIMAGE_3D_HDR \ CARD32 target B32; \ CARD32 level B32; \ CARD32 internalformat B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 depth B32; \ CARD32 size4d B32; \ CARD32 border B32; \ CARD32 format B32; \ CARD32 type B32; \ CARD32 nullimage B32 #define __GLX_TEXIMAGE_3D_HDR_SIZE 44 #define __GLX_TEXIMAGE_3D_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_3D_HDR_SIZE + \ __GLX_TEXIMAGE_3D_HDR_SIZE) #define __GLX_TEXIMAGE_3D_CMD_DISPATCH_HDR_SIZE \ (__GLX_PIXEL_3D_HDR_SIZE + __GLX_TEXIMAGE_3D_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_3D_HDR; __GLX_TEXIMAGE_3D_HDR; } __GLXtexImage3DHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_PIXEL_3D_HDR; __GLX_TEXIMAGE_3D_HDR; } __GLXtexImage3DLargeHeader; typedef struct { __GLX_PIXEL_3D_HDR; __GLX_TEXIMAGE_3D_HDR; } __GLXdispatchTexImage3DHeader; /* ** Data that is specific to a glTexSubImage1D or glTexSubImage2D call. The ** data is sent in the following order: ** Render or RenderLarge header ** Pixel header ** TexSubImage header ** When a glTexSubImage1D call is made, the yoffset and height fields ** are unexamined by the server and are considered to be padding. */ #define __GLX_TEXSUBIMAGE_HDR \ CARD32 target B32; \ CARD32 level B32; \ CARD32 xoffset B32; \ CARD32 yoffset B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 format B32; \ CARD32 type B32; \ CARD32 nullImage \ #define __GLX_TEXSUBIMAGE_HDR_SIZE 36 #define __GLX_TEXSUBIMAGE_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + __GLX_TEXSUBIMAGE_HDR_SIZE) #define __GLX_TEXSUBIMAGE_CMD_DISPATCH_HDR_SIZE \ (__GLX_PIXEL_HDR_SIZE + __GLX_TEXSUBIMAGE_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_HDR; __GLX_TEXSUBIMAGE_HDR; } __GLXtexSubImageHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_PIXEL_HDR; __GLX_TEXSUBIMAGE_HDR; } __GLXtexSubImageLargeHeader; typedef struct { __GLX_PIXEL_HDR; __GLX_TEXSUBIMAGE_HDR; } __GLXdispatchTexSubImageHeader; /* ** Data that is specific to a glTexSubImage3D and 4D calls. The ** data is sent in the following order: ** Render or RenderLarge header ** Pixel 3D header ** TexSubImage 3D header ** When a glTexSubImage3D call is made, the woffset and size4d fields ** are unexamined by the server and are considered to be padding. */ #define __GLX_TEXSUBIMAGE_3D_HDR \ CARD32 target B32; \ CARD32 level B32; \ CARD32 xoffset B32; \ CARD32 yoffset B32; \ CARD32 zoffset B32; \ CARD32 woffset B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 depth B32; \ CARD32 size4d B32; \ CARD32 format B32; \ CARD32 type B32; \ CARD32 nullImage \ #define __GLX_TEXSUBIMAGE_3D_HDR_SIZE 52 #define __GLX_TEXSUBIMAGE_3D_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_3D_HDR_SIZE + \ __GLX_TEXSUBIMAGE_3D_HDR_SIZE) #define __GLX_TEXSUBIMAGE_3D_CMD_DISPATCH_HDR_SIZE \ (__GLX_PIXEL_3D_HDR_SIZE + __GLX_TEXSUBIMAGE_3D_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_3D_HDR; __GLX_TEXSUBIMAGE_3D_HDR; } __GLXtexSubImage3DHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_PIXEL_3D_HDR; __GLX_TEXSUBIMAGE_3D_HDR; } __GLXtexSubImage3DLargeHeader; typedef struct { __GLX_PIXEL_3D_HDR; __GLX_TEXSUBIMAGE_3D_HDR; } __GLXdispatchTexSubImage3DHeader; /** * Data that is specific to a \c glCompressedTexImage1D or * \c glCompressedTexImage2D call. The data is sent in the following * order: * - Render or RenderLarge header * - CompressedTexImage header * * When a \c glCompressedTexImage1D call is made, the \c height field is * not examined by the server and is considered padding. */ #define __GLX_COMPRESSED_TEXIMAGE_HDR \ CARD32 target B32; \ CARD32 level B32; \ CARD32 internalFormat B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 border B32; \ CARD32 imageSize B32 #define __GLX_COMPRESSED_TEXIMAGE_HDR_SIZE 28 #define __GLX_COMPRESSED_TEXIMAGE_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_COMPRESSED_TEXIMAGE_HDR_SIZE) #define __GLX_COMPRESSED_TEXIMAGE_DISPATCH_HDR_SIZE \ (__GLX_COMPRESSED_TEXIMAGE_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_COMPRESSED_TEXIMAGE_HDR; } __GLXcompressedTexImageHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_COMPRESSED_TEXIMAGE_HDR; } __GLXcompressedTexImageLargeHeader; typedef struct { __GLX_COMPRESSED_TEXIMAGE_HDR; } __GLXdispatchCompressedTexImageHeader; /** * Data that is specifi to a \c glCompressedTexSubImage1D or * \c glCompressedTexSubImage2D call. The data is sent in the following * order: * - Render or RenderLarge header * - CompressedTexSubImage header * * When a \c glCompressedTexSubImage1D call is made, the \c yoffset and * \c height fields are not examined by the server and are considered padding. */ #define __GLX_COMPRESSED_TEXSUBIMAGE_HDR \ CARD32 target B32; \ CARD32 level B32; \ CARD32 xoffset B32; \ CARD32 yoffset B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 format B32; \ CARD32 imageSize B32 #define __GLX_COMPRESSED_TEXSUBIMAGE_HDR_SIZE 32 #define __GLX_COMPRESSED_TEXSUBIMAGE_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_COMPRESSED_TEXSUBIMAGE_HDR_SIZE) #define __GLX_COMPRESSED_TEXSUBIMAGE_DISPATCH_HDR_SIZE \ (__GLX_COMPRESSED_TEXSUBIMAGE_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_COMPRESSED_TEXSUBIMAGE_HDR; } __GLXcompressedTexSubImageHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_COMPRESSED_TEXSUBIMAGE_HDR; } __GLXcompressedTexSubImageLargeHeader; typedef struct { __GLX_COMPRESSED_TEXSUBIMAGE_HDR; } __GLXdispatchCompressedTexSubImageHeader; /** * Data that is specific to a \c glCompressedTexImage3D call. The data is * sent in the following order: * - Render or RenderLarge header * - CompressedTexImage3D header */ #define __GLX_COMPRESSED_TEXIMAGE_3D_HDR \ CARD32 target B32; \ CARD32 level B32; \ CARD32 internalFormat B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 depth B32; \ CARD32 border B32; \ CARD32 imageSize B32 #define __GLX_COMPRESSED_TEXIMAGE_3D_HDR_SIZE 32 #define __GLX_COMPRESSED_TEXIMAGE_3D_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_COMPRESSED_TEXIMAGE_3D_HDR_SIZE) #define __GLX_COMPRESSED_TEXIMAGE_3D_DISPATCH_HDR_SIZE \ (__GLX_COMPRESSED_TEXIMAGE_3D_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_COMPRESSED_TEXIMAGE_3D_HDR; } __GLXcompressedTexImage3DHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_COMPRESSED_TEXIMAGE_3D_HDR; } __GLXcompressedTexImage3DLargeHeader; typedef struct { __GLX_COMPRESSED_TEXIMAGE_3D_HDR; } __GLXdispatchCompressedTexImage3DHeader; /** * Data that is specifi to a \c glCompressedTexSubImage3D call. The data is * sent in the following order: * - Render or RenderLarge header * - CompressedTexSubImage3D header */ #define __GLX_COMPRESSED_TEXSUBIMAGE_3D_HDR \ CARD32 target B32; \ CARD32 level B32; \ CARD32 xoffset B32; \ CARD32 yoffset B32; \ CARD32 zoffset B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 depth B32; \ CARD32 format B32; \ CARD32 imageSize B32 #define __GLX_COMPRESSED_TEXSUBIMAGE_3D_HDR_SIZE 32 #define __GLX_COMPRESSED_TEXSUBIMAGE_3D_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_COMPRESSED_TEXSUBIMAGE_3D_HDR_SIZE) #define __GLX_COMPRESSED_TEXSUBIMAGE_3D_DISPATCH_HDR_SIZE \ (__GLX_COMPRESSED_TEXSUBIMAGE_3D_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_COMPRESSED_TEXSUBIMAGE_3D_HDR; } __GLXcompressedTexSubImage3DHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_COMPRESSED_TEXSUBIMAGE_3D_HDR; } __GLXcompressedTexSubImage3DLargeHeader; typedef struct { __GLX_COMPRESSED_TEXSUBIMAGE_3D_HDR; } __GLXdispatchCompressedTexSubImage3DHeader; /* ** Data that is specific to a glDrawPixels call. The data is sent in the ** following order: ** Render or RenderLarge header ** Pixel header ** DrawPixels header */ #define __GLX_DRAWPIXELS_HDR \ CARD32 width B32; \ CARD32 height B32; \ CARD32 format B32; \ CARD32 type B32 #define __GLX_DRAWPIXELS_HDR_SIZE 16 #define __GLX_DRAWPIXELS_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + __GLX_DRAWPIXELS_HDR_SIZE) #define __GLX_DRAWPIXELS_CMD_DISPATCH_HDR_SIZE \ (__GLX_PIXEL_HDR_SIZE + __GLX_DRAWPIXELS_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_HDR; __GLX_DRAWPIXELS_HDR; } __GLXdrawPixelsHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_PIXEL_HDR; __GLX_DRAWPIXELS_HDR; } __GLXdrawPixelsLargeHeader; typedef struct { __GLX_PIXEL_HDR; __GLX_DRAWPIXELS_HDR; } __GLXdispatchDrawPixelsHeader; /* ** Data that is specific to a glConvolutionFilter1D or glConvolutionFilter2D ** call. The data is sent in the following order: ** Render or RenderLarge header ** Pixel header ** ConvolutionFilter header ** When a glConvolutionFilter1D call the height field is unexamined by the server. */ #define __GLX_CONV_FILT_HDR \ CARD32 target B32; \ CARD32 internalformat B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 format B32; \ CARD32 type B32 #define __GLX_CONV_FILT_HDR_SIZE 24 #define __GLX_CONV_FILT_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + __GLX_CONV_FILT_HDR_SIZE) #define __GLX_CONV_FILT_CMD_DISPATCH_HDR_SIZE \ (__GLX_PIXEL_HDR_SIZE + __GLX_CONV_FILT_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_HDR; __GLX_CONV_FILT_HDR; } __GLXConvolutionFilterHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_PIXEL_HDR; __GLX_CONV_FILT_HDR; } __GLXConvolutionFilterLargeHeader; typedef struct { __GLX_PIXEL_HDR; __GLX_CONV_FILT_HDR; } __GLXdispatchConvolutionFilterHeader; /* ** Data that is specific to a glDrawArraysEXT call. The data is sent in the ** following order: ** Render or RenderLarge header ** Draw Arrays header ** a variable number of Component headers ** vertex data for each component type */ #define __GLX_DRAWARRAYS_HDR \ CARD32 numVertexes B32; \ CARD32 numComponents B32; \ CARD32 primType B32 #define __GLX_DRAWARRAYS_HDR_SIZE 12 #define __GLX_DRAWARRAYS_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_DRAWARRAYS_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_DRAWARRAYS_HDR; } __GLXdrawArraysHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_DRAWARRAYS_HDR; } __GLXdrawArraysLargeHeader; typedef struct { __GLX_DRAWARRAYS_HDR; } __GLXdispatchDrawArraysHeader; #define __GLX_COMPONENT_HDR \ CARD32 datatype B32; \ INT32 numVals B32; \ CARD32 component B32 typedef struct { __GLX_COMPONENT_HDR; } __GLXdispatchDrawArraysComponentHeader; #define __GLX_COMPONENT_HDR_SIZE 12 /* ** Data that is specific to a glColorTable call ** The data is sent in the following order: ** Render or RenderLarge header ** Pixel header ** ColorTable header */ #define __GLX_COLOR_TABLE_HDR \ CARD32 target B32; \ CARD32 internalformat B32; \ CARD32 width B32; \ CARD32 format B32; \ CARD32 type B32 #define __GLX_COLOR_TABLE_HDR_SIZE 20 #define __GLX_COLOR_TABLE_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + __GLX_COLOR_TABLE_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_HDR; __GLX_COLOR_TABLE_HDR; } __GLXColorTableHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_PIXEL_HDR; __GLX_COLOR_TABLE_HDR; } __GLXColorTableLargeHeader; typedef struct { __GLX_PIXEL_HDR; __GLX_COLOR_TABLE_HDR; } __GLXdispatchColorTableHeader; /* ** Data that is specific to a glColorSubTable call ** The data is sent in the following order: ** Render or RenderLarge header ** Pixel header ** ColorTable header */ #define __GLX_COLOR_SUBTABLE_HDR \ CARD32 target B32; \ CARD32 start B32; \ CARD32 count B32; \ CARD32 format B32; \ CARD32 type B32 #define __GLX_COLOR_SUBTABLE_HDR_SIZE 20 #define __GLX_COLOR_SUBTABLE_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + \ __GLX_COLOR_SUBTABLE_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_HDR; __GLX_COLOR_SUBTABLE_HDR; } __GLXColorSubTableHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_PIXEL_HDR; __GLX_COLOR_SUBTABLE_HDR; } __GLXColorSubTableLargeHeader; typedef struct { __GLX_PIXEL_HDR; __GLX_COLOR_SUBTABLE_HDR; } __GLXdispatchColorSubTableHeader; #define GLX_WINDOW_TYPE 1 #define GLX_PIXMAP_TYPE 2 #define GLX_VIDEO_SOURCE_TYPE 3 #define GLX_PBUFFER_TYPE 4 /* 5 is for DM_PBUFFER */ #define GLX_GLXWINDOW_TYPE 6 /*****************************************************************************/ /* ** Restore these definitions back to the typedefs in glx.h */ #undef GLXContextID #undef GLXPixmap #undef GLXDrawable #undef GLXPbuffer #undef GLXWindow #undef GLXFBConfigID #undef GLXFBConfigIDSGIX #undef GLXPbufferSGIX /* Opcodes for GLX commands */ #define X_GLXRender 1 #define X_GLXRenderLarge 2 #define X_GLXCreateContext 3 #define X_GLXDestroyContext 4 #define X_GLXMakeCurrent 5 #define X_GLXIsDirect 6 #define X_GLXQueryVersion 7 #define X_GLXWaitGL 8 #define X_GLXWaitX 9 #define X_GLXCopyContext 10 #define X_GLXSwapBuffers 11 #define X_GLXUseXFont 12 #define X_GLXCreateGLXPixmap 13 #define X_GLXGetVisualConfigs 14 #define X_GLXDestroyGLXPixmap 15 #define X_GLXVendorPrivate 16 #define X_GLXVendorPrivateWithReply 17 #define X_GLXQueryExtensionsString 18 #define X_GLXQueryServerString 19 #define X_GLXClientInfo 20 #define X_GLXGetFBConfigs 21 #define X_GLXCreatePixmap 22 #define X_GLXDestroyPixmap 23 #define X_GLXCreateNewContext 24 #define X_GLXQueryContext 25 #define X_GLXMakeContextCurrent 26 #define X_GLXCreatePbuffer 27 #define X_GLXDestroyPbuffer 28 #define X_GLXGetDrawableAttributes 29 #define X_GLXChangeDrawableAttributes 30 #define X_GLXCreateWindow 31 #define X_GLXDestroyWindow 32 #define X_GLXSetClientInfoARB 33 #define X_GLXCreateContextAttribsARB 34 #define X_GLXSetClientInfo2ARB 35 /* typo compatibility with older headers */ #define X_GLXCreateContextAtrribsARB 34 #define X_GLXSetConfigInfo2ARB 35 /* Opcodes for single commands (part of GLX command space) */ #define X_GLsop_NewList 101 #define X_GLsop_EndList 102 #define X_GLsop_DeleteLists 103 #define X_GLsop_GenLists 104 #define X_GLsop_FeedbackBuffer 105 #define X_GLsop_SelectBuffer 106 #define X_GLsop_RenderMode 107 #define X_GLsop_Finish 108 #define X_GLsop_Flush 142 #define X_GLsop_PixelStoref 109 #define X_GLsop_PixelStorei 110 #define X_GLsop_ReadPixels 111 #define X_GLsop_GetBooleanv 112 #define X_GLsop_GetClipPlane 113 #define X_GLsop_GetDoublev 114 #define X_GLsop_GetError 115 #define X_GLsop_GetFloatv 116 #define X_GLsop_GetIntegerv 117 #define X_GLsop_GetLightfv 118 #define X_GLsop_GetLightiv 119 #define X_GLsop_GetMapdv 120 #define X_GLsop_GetMapfv 121 #define X_GLsop_GetMapiv 122 #define X_GLsop_GetMaterialfv 123 #define X_GLsop_GetMaterialiv 124 #define X_GLsop_GetPixelMapfv 125 #define X_GLsop_GetPixelMapuiv 126 #define X_GLsop_GetPixelMapusv 127 #define X_GLsop_GetPolygonStipple 128 #define X_GLsop_GetString 129 #define X_GLsop_GetTexEnvfv 130 #define X_GLsop_GetTexEnviv 131 #define X_GLsop_GetTexGendv 132 #define X_GLsop_GetTexGenfv 133 #define X_GLsop_GetTexGeniv 134 #define X_GLsop_GetTexImage 135 #define X_GLsop_GetTexParameterfv 136 #define X_GLsop_GetTexParameteriv 137 #define X_GLsop_GetTexLevelParameterfv 138 #define X_GLsop_GetTexLevelParameteriv 139 #define X_GLsop_IsEnabled 140 #define X_GLsop_IsList 141 #define X_GLsop_AreTexturesResident 143 #define X_GLsop_DeleteTextures 144 #define X_GLsop_GenTextures 145 #define X_GLsop_IsTexture 146 #define X_GLsop_GetColorTable 147 #define X_GLsop_GetColorTableParameterfv 148 #define X_GLsop_GetColorTableParameteriv 149 #define X_GLsop_GetConvolutionFilter 150 #define X_GLsop_GetConvolutionParameterfv 151 #define X_GLsop_GetConvolutionParameteriv 152 #define X_GLsop_GetSeparableFilter 153 #define X_GLsop_GetHistogram 154 #define X_GLsop_GetHistogramParameterfv 155 #define X_GLsop_GetHistogramParameteriv 156 #define X_GLsop_GetMinmax 157 #define X_GLsop_GetMinmaxParameterfv 158 #define X_GLsop_GetMinmaxParameteriv 159 #define X_GLsop_GetCompressedTexImage 160 /* Opcodes for rendering commands */ #define X_GLrop_CallList 1 #define X_GLrop_CallLists 2 #define X_GLrop_ListBase 3 #define X_GLrop_Begin 4 #define X_GLrop_Bitmap 5 #define X_GLrop_Color3bv 6 #define X_GLrop_Color3dv 7 #define X_GLrop_Color3fv 8 #define X_GLrop_Color3iv 9 #define X_GLrop_Color3sv 10 #define X_GLrop_Color3ubv 11 #define X_GLrop_Color3uiv 12 #define X_GLrop_Color3usv 13 #define X_GLrop_Color4bv 14 #define X_GLrop_Color4dv 15 #define X_GLrop_Color4fv 16 #define X_GLrop_Color4iv 17 #define X_GLrop_Color4sv 18 #define X_GLrop_Color4ubv 19 #define X_GLrop_Color4uiv 20 #define X_GLrop_Color4usv 21 #define X_GLrop_EdgeFlagv 22 #define X_GLrop_End 23 #define X_GLrop_Indexdv 24 #define X_GLrop_Indexfv 25 #define X_GLrop_Indexiv 26 #define X_GLrop_Indexsv 27 #define X_GLrop_Normal3bv 28 #define X_GLrop_Normal3dv 29 #define X_GLrop_Normal3fv 30 #define X_GLrop_Normal3iv 31 #define X_GLrop_Normal3sv 32 #define X_GLrop_RasterPos2dv 33 #define X_GLrop_RasterPos2fv 34 #define X_GLrop_RasterPos2iv 35 #define X_GLrop_RasterPos2sv 36 #define X_GLrop_RasterPos3dv 37 #define X_GLrop_RasterPos3fv 38 #define X_GLrop_RasterPos3iv 39 #define X_GLrop_RasterPos3sv 40 #define X_GLrop_RasterPos4dv 41 #define X_GLrop_RasterPos4fv 42 #define X_GLrop_RasterPos4iv 43 #define X_GLrop_RasterPos4sv 44 #define X_GLrop_Rectdv 45 #define X_GLrop_Rectfv 46 #define X_GLrop_Rectiv 47 #define X_GLrop_Rectsv 48 #define X_GLrop_TexCoord1dv 49 #define X_GLrop_TexCoord1fv 50 #define X_GLrop_TexCoord1iv 51 #define X_GLrop_TexCoord1sv 52 #define X_GLrop_TexCoord2dv 53 #define X_GLrop_TexCoord2fv 54 #define X_GLrop_TexCoord2iv 55 #define X_GLrop_TexCoord2sv 56 #define X_GLrop_TexCoord3dv 57 #define X_GLrop_TexCoord3fv 58 #define X_GLrop_TexCoord3iv 59 #define X_GLrop_TexCoord3sv 60 #define X_GLrop_TexCoord4dv 61 #define X_GLrop_TexCoord4fv 62 #define X_GLrop_TexCoord4iv 63 #define X_GLrop_TexCoord4sv 64 #define X_GLrop_Vertex2dv 65 #define X_GLrop_Vertex2fv 66 #define X_GLrop_Vertex2iv 67 #define X_GLrop_Vertex2sv 68 #define X_GLrop_Vertex3dv 69 #define X_GLrop_Vertex3fv 70 #define X_GLrop_Vertex3iv 71 #define X_GLrop_Vertex3sv 72 #define X_GLrop_Vertex4dv 73 #define X_GLrop_Vertex4fv 74 #define X_GLrop_Vertex4iv 75 #define X_GLrop_Vertex4sv 76 #define X_GLrop_ClipPlane 77 #define X_GLrop_ColorMaterial 78 #define X_GLrop_CullFace 79 #define X_GLrop_Fogf 80 #define X_GLrop_Fogfv 81 #define X_GLrop_Fogi 82 #define X_GLrop_Fogiv 83 #define X_GLrop_FrontFace 84 #define X_GLrop_Hint 85 #define X_GLrop_Lightf 86 #define X_GLrop_Lightfv 87 #define X_GLrop_Lighti 88 #define X_GLrop_Lightiv 89 #define X_GLrop_LightModelf 90 #define X_GLrop_LightModelfv 91 #define X_GLrop_LightModeli 92 #define X_GLrop_LightModeliv 93 #define X_GLrop_LineStipple 94 #define X_GLrop_LineWidth 95 #define X_GLrop_Materialf 96 #define X_GLrop_Materialfv 97 #define X_GLrop_Materiali 98 #define X_GLrop_Materialiv 99 #define X_GLrop_PointSize 100 #define X_GLrop_PolygonMode 101 #define X_GLrop_PolygonStipple 102 #define X_GLrop_Scissor 103 #define X_GLrop_ShadeModel 104 #define X_GLrop_TexParameterf 105 #define X_GLrop_TexParameterfv 106 #define X_GLrop_TexParameteri 107 #define X_GLrop_TexParameteriv 108 #define X_GLrop_TexImage1D 109 #define X_GLrop_TexImage2D 110 #define X_GLrop_TexEnvf 111 #define X_GLrop_TexEnvfv 112 #define X_GLrop_TexEnvi 113 #define X_GLrop_TexEnviv 114 #define X_GLrop_TexGend 115 #define X_GLrop_TexGendv 116 #define X_GLrop_TexGenf 117 #define X_GLrop_TexGenfv 118 #define X_GLrop_TexGeni 119 #define X_GLrop_TexGeniv 120 #define X_GLrop_InitNames 121 #define X_GLrop_LoadName 122 #define X_GLrop_PassThrough 123 #define X_GLrop_PopName 124 #define X_GLrop_PushName 125 #define X_GLrop_DrawBuffer 126 #define X_GLrop_Clear 127 #define X_GLrop_ClearAccum 128 #define X_GLrop_ClearIndex 129 #define X_GLrop_ClearColor 130 #define X_GLrop_ClearStencil 131 #define X_GLrop_ClearDepth 132 #define X_GLrop_StencilMask 133 #define X_GLrop_ColorMask 134 #define X_GLrop_DepthMask 135 #define X_GLrop_IndexMask 136 #define X_GLrop_Accum 137 #define X_GLrop_Disable 138 #define X_GLrop_Enable 139 #define X_GLrop_PopAttrib 141 #define X_GLrop_PushAttrib 142 #define X_GLrop_Map1d 143 #define X_GLrop_Map1f 144 #define X_GLrop_Map2d 145 #define X_GLrop_Map2f 146 #define X_GLrop_MapGrid1d 147 #define X_GLrop_MapGrid1f 148 #define X_GLrop_MapGrid2d 149 #define X_GLrop_MapGrid2f 150 #define X_GLrop_EvalCoord1dv 151 #define X_GLrop_EvalCoord1fv 152 #define X_GLrop_EvalCoord2dv 153 #define X_GLrop_EvalCoord2fv 154 #define X_GLrop_EvalMesh1 155 #define X_GLrop_EvalPoint1 156 #define X_GLrop_EvalMesh2 157 #define X_GLrop_EvalPoint2 158 #define X_GLrop_AlphaFunc 159 #define X_GLrop_BlendFunc 160 #define X_GLrop_LogicOp 161 #define X_GLrop_StencilFunc 162 #define X_GLrop_StencilOp 163 #define X_GLrop_DepthFunc 164 #define X_GLrop_PixelZoom 165 #define X_GLrop_PixelTransferf 166 #define X_GLrop_PixelTransferi 167 #define X_GLrop_PixelMapfv 168 #define X_GLrop_PixelMapuiv 169 #define X_GLrop_PixelMapusv 170 #define X_GLrop_ReadBuffer 171 #define X_GLrop_CopyPixels 172 #define X_GLrop_DrawPixels 173 #define X_GLrop_DepthRange 174 #define X_GLrop_Frustum 175 #define X_GLrop_LoadIdentity 176 #define X_GLrop_LoadMatrixf 177 #define X_GLrop_LoadMatrixd 178 #define X_GLrop_MatrixMode 179 #define X_GLrop_MultMatrixf 180 #define X_GLrop_MultMatrixd 181 #define X_GLrop_Ortho 182 #define X_GLrop_PopMatrix 183 #define X_GLrop_PushMatrix 184 #define X_GLrop_Rotated 185 #define X_GLrop_Rotatef 186 #define X_GLrop_Scaled 187 #define X_GLrop_Scalef 188 #define X_GLrop_Translated 189 #define X_GLrop_Translatef 190 #define X_GLrop_Viewport 191 #define X_GLrop_DrawArrays 193 #define X_GLrop_PolygonOffset 192 #define X_GLrop_CopyTexImage1D 4119 #define X_GLrop_CopyTexImage2D 4120 #define X_GLrop_CopyTexSubImage1D 4121 #define X_GLrop_CopyTexSubImage2D 4122 #define X_GLrop_TexSubImage1D 4099 #define X_GLrop_TexSubImage2D 4100 #define X_GLrop_BindTexture 4117 #define X_GLrop_PrioritizeTextures 4118 #define X_GLrop_Indexubv 194 #define X_GLrop_BlendColor 4096 #define X_GLrop_BlendEquation 4097 #define X_GLrop_ColorTable 2053 #define X_GLrop_ColorTableParameterfv 2054 #define X_GLrop_ColorTableParameteriv 2055 #define X_GLrop_CopyColorTable 2056 #define X_GLrop_ColorSubTable 195 #define X_GLrop_CopyColorSubTable 196 #define X_GLrop_ConvolutionFilter1D 4101 #define X_GLrop_ConvolutionFilter2D 4102 #define X_GLrop_ConvolutionParameterf 4103 #define X_GLrop_ConvolutionParameterfv 4104 #define X_GLrop_ConvolutionParameteri 4105 #define X_GLrop_ConvolutionParameteriv 4106 #define X_GLrop_CopyConvolutionFilter1D 4107 #define X_GLrop_CopyConvolutionFilter2D 4108 #define X_GLrop_SeparableFilter2D 4109 #define X_GLrop_Histogram 4110 #define X_GLrop_Minmax 4111 #define X_GLrop_ResetHistogram 4112 #define X_GLrop_ResetMinmax 4113 #define X_GLrop_TexImage3D 4114 #define X_GLrop_TexSubImage3D 4115 #define X_GLrop_CopyTexSubImage3D 4123 #define X_GLrop_DrawArraysEXT 4116 /* Added for core GL version 1.3 */ #define X_GLrop_ActiveTextureARB 197 #define X_GLrop_MultiTexCoord1dvARB 198 #define X_GLrop_MultiTexCoord1fvARB 199 #define X_GLrop_MultiTexCoord1ivARB 200 #define X_GLrop_MultiTexCoord1svARB 201 #define X_GLrop_MultiTexCoord2dvARB 202 #define X_GLrop_MultiTexCoord2fvARB 203 #define X_GLrop_MultiTexCoord2ivARB 204 #define X_GLrop_MultiTexCoord2svARB 205 #define X_GLrop_MultiTexCoord3dvARB 206 #define X_GLrop_MultiTexCoord3fvARB 207 #define X_GLrop_MultiTexCoord3ivARB 208 #define X_GLrop_MultiTexCoord3svARB 209 #define X_GLrop_MultiTexCoord4dvARB 210 #define X_GLrop_MultiTexCoord4fvARB 211 #define X_GLrop_MultiTexCoord4ivARB 212 #define X_GLrop_MultiTexCoord4svARB 213 #define X_GLrop_CompressedTexImage1D 214 #define X_GLrop_CompressedTexImage2D 215 #define X_GLrop_CompressedTexImage3D 216 #define X_GLrop_CompressedTexSubImage1D 217 #define X_GLrop_CompressedTexSubImage2D 218 #define X_GLrop_CompressedTexSubImage3D 219 #define X_GLrop_SampleCoverageARB 229 /* Added for core GL version 1.4 */ #define X_GLrop_WindowPos3fARB 230 #define X_GLrop_FogCoordfv 4124 #define X_GLrop_FogCoorddv 4125 #define X_GLrop_PointParameterfARB 2065 #define X_GLrop_PointParameterfvARB 2066 #define X_GLrop_SecondaryColor3bv 4126 #define X_GLrop_SecondaryColor3sv 4127 #define X_GLrop_SecondaryColor3iv 4128 #define X_GLrop_SecondaryColor3fv 4129 #define X_GLrop_SecondaryColor3dv 4130 #define X_GLrop_SecondaryColor3ubv 4131 #define X_GLrop_SecondaryColor3usv 4132 #define X_GLrop_SecondaryColor3uiv 4133 #define X_GLrop_BlendFuncSeparate 4134 #define X_GLrop_PointParameteri 4221 #define X_GLrop_PointParameteriv 4222 /* Added for core GL version 1.5 */ /* XXX opcodes not defined in the spec */ /* Opcodes for Vendor Private commands */ #define X_GLvop_GetConvolutionFilterEXT 1 #define X_GLvop_GetConvolutionParameterfvEXT 2 #define X_GLvop_GetConvolutionParameterivEXT 3 #define X_GLvop_GetSeparableFilterEXT 4 #define X_GLvop_GetHistogramEXT 5 #define X_GLvop_GetHistogramParameterfvEXT 6 #define X_GLvop_GetHistogramParameterivEXT 7 #define X_GLvop_GetMinmaxEXT 8 #define X_GLvop_GetMinmaxParameterfvEXT 9 #define X_GLvop_GetMinmaxParameterivEXT 10 #define X_GLvop_AreTexturesResidentEXT 11 #define X_GLvop_DeleteTexturesEXT 12 #define X_GLvop_GenTexturesEXT 13 #define X_GLvop_IsTextureEXT 14 #define X_GLvop_GetCombinerInputParameterfvNV 1270 #define X_GLvop_GetCombinerInputParameterivNV 1271 #define X_GLvop_GetCombinerOutputParameterfvNV 1272 #define X_GLvop_GetCombinerOutputParameterivNV 1273 #define X_GLvop_GetFinalCombinerOutputParameterfvNV 1274 #define X_GLvop_GetFinalCombinerOutputParameterivNV 1275 #define X_GLvop_DeleteFenceNV 1276 #define X_GLvop_GenFencesNV 1277 #define X_GLvop_IsFenceNV 1278 #define X_GLvop_TestFenceNV 1279 #define X_GLvop_GetFenceivNV 1280 #define X_GLvop_AreProgramsResidentNV 1293 #define X_GLvop_DeleteProgramARB 1294 #define X_GLvop_GenProgramsARB 1295 #define X_GLvop_GetProgramEnvParameterfvARB 1296 #define X_GLvop_GetProgramEnvParameterdvARB 1297 #define X_GLvop_GetProgramEnvParameterivNV 1298 #define X_GLvop_GetProgramStringNV 1299 #define X_GLvop_GetTrackMatrixivNV 1300 #define X_GLvop_GetVertexAttribdvARB 1301 #define X_GLvop_GetVertexAttribfvARB 1302 #define X_GLvop_GetVertexAttribivARB 1303 #define X_GLvop_IsProgramARB 1304 #define X_GLvop_GetProgramLocalParameterfvARB 1305 #define X_GLvop_GetProgramLocalParameterdvARB 1306 #define X_GLvop_GetProgramivARB 1307 #define X_GLvop_GetProgramStringARB 1308 #define X_GLvop_GetProgramNamedParameter4fvNV 1310 #define X_GLvop_GetProgramNamedParameter4dvNV 1311 #define X_GLvop_SampleMaskSGIS 2048 #define X_GLvop_SamplePatternSGIS 2049 #define X_GLvop_GetDetailTexFuncSGIS 4096 #define X_GLvop_GetSharpenTexFuncSGIS 4097 #define X_GLvop_GetColorTableSGI 4098 #define X_GLvop_GetColorTableParameterfvSGI 4099 #define X_GLvop_GetColorTableParameterivSGI 4100 #define X_GLvop_GetTexFilterFuncSGIS 4101 #define X_GLvop_GetInstrumentsSGIX 4102 #define X_GLvop_InstrumentsBufferSGIX 4103 #define X_GLvop_PollInstrumentsSGIX 4104 #define X_GLvop_FlushRasterSGIX 4105 /* Opcodes for GLX vendor private commands */ #define X_GLXvop_QueryContextInfoEXT 1024 #define X_GLXvop_BindTexImageEXT 1330 #define X_GLXvop_ReleaseTexImageEXT 1331 #define X_GLXvop_SwapIntervalSGI 65536 #define X_GLXvop_MakeCurrentReadSGI 65537 #define X_GLXvop_CreateGLXVideoSourceSGIX 65538 #define X_GLXvop_DestroyGLXVideoSourceSGIX 65539 #define X_GLXvop_GetFBConfigsSGIX 65540 #define X_GLXvop_CreateContextWithConfigSGIX 65541 #define X_GLXvop_CreateGLXPixmapWithConfigSGIX 65542 #define X_GLXvop_CreateGLXPbufferSGIX 65543 #define X_GLXvop_DestroyGLXPbufferSGIX 65544 #define X_GLXvop_ChangeDrawableAttributesSGIX 65545 #define X_GLXvop_GetDrawableAttributesSGIX 65546 #define X_GLXvop_JoinSwapGroupSGIX 65547 #define X_GLXvop_BindSwapBarrierSGIX 65548 #define X_GLXvop_QueryMaxSwapBarriersSGIX 65549 #define X_GLXvop_QueryHyperpipeNetworkSGIX 65550 #define X_GLXvop_QueryHyperpipeConfigSGIX 65551 #define X_GLXvop_HyperpipeConfigSGIX 65552 #define X_GLXvop_DestroyHyperpipeConfigSGIX 65553 /* ARB extension opcodes */ /* 1. GL_ARB_multitexture - see GL 1.2 opcodes */ /* 5. GL_ARB_multisample - see GL 1.3 opcodes */ /* 12. GL_ARB_texture_compression - see GL 1.3 opcodes */ /* 14. GL_ARB_point_parameters - see GL 1.4 opcodees */ /* 15. GL_ARB_vertex_blend */ #define X_GLrop_WeightbvARB 220 #define X_GLrop_WeightubvARB 221 #define X_GLrop_WeightsvARB 222 #define X_GLrop_WeightusvARB 223 #define X_GLrop_WeightivARB 224 #define X_GLrop_WeightuivARB 225 #define X_GLrop_VertexBlendARB 226 #define X_GLrop_WeightfvARB 227 #define X_GLrop_WeightdvARB 228 /* 16. GL_ARB_matrix_palette */ /* XXX opcodes not defined in the spec */ /* 25. GL_ARB_window_pos - see GL 1.4 opcodes */ /* 26. GL_ARB_vertex_program */ #define X_GLrop_BindProgramARB 4180 #define X_GLrop_ProgramEnvParameter4fvARB 4184 #define X_GLrop_ProgramEnvParameter4dvARB 4185 #define X_GLrop_VertexAttrib1svARB 4189 #define X_GLrop_VertexAttrib2svARB 4190 #define X_GLrop_VertexAttrib3svARB 4191 #define X_GLrop_VertexAttrib4svARB 4192 #define X_GLrop_VertexAttrib1fvARB 4193 #define X_GLrop_VertexAttrib2fvARB 4194 #define X_GLrop_VertexAttrib3fvARB 4195 #define X_GLrop_VertexAttrib4fvARB 4196 #define X_GLrop_VertexAttrib1dvARB 4197 #define X_GLrop_VertexAttrib2dvARB 4198 #define X_GLrop_VertexAttrib3dvARB 4199 #define X_GLrop_ProgramLocalParameter4fvARB 4215 #define X_GLrop_ProgramLocalParameter4dvARB 4216 #define X_GLrop_ProgramStringARB 4217 #define X_GLrop_VertexAttrib4dvARB 4200 #define X_GLrop_VertexAttrib4NubvARB 4201 #define X_GLrop_VertexAttrib4bvARB 4230 #define X_GLrop_VertexAttrib4ivARB 4231 #define X_GLrop_VertexAttrib4ubvARB 4232 #define X_GLrop_VertexAttrib4usvARB 4233 #define X_GLrop_VertexAttrib4uivARB 4234 #define X_GLrop_VertexAttrib4NbvARB 4235 #define X_GLrop_VertexAttrib4NsvARB 4236 #define X_GLrop_VertexAttrib4NivARB 4237 #define X_GLrop_VertexAttrib4NusvARB 4238 #define X_GLrop_VertexAttrib4NuivARB 4239 /* 27. GL_ARB_fragment_program - see GL_ARB_vertex_program opcodes */ /* 29. GL_ARB_occlusion_query */ /* XXX opcodes not defined in the spec */ /* New extension opcodes */ /* 145. GL_EXT_secondary_color - see GL 1.4 opcodes */ /* 188. GL_EXT_vertex_weighting */ #define X_GLrop_VertexWeightfvEXT 4135 /* 191. GL_NV_register_combiners */ #define X_GLrop_CombinerParameterfNV 4136 #define X_GLrop_CombinerParameterfvNV 4137 #define X_GLrop_CombinerParameteriNV 4138 #define X_GLrop_CombinerParameterivNV 4139 #define X_GLrop_CombinerInputNV 4140 #define X_GLrop_CombinerOutputNV 4141 #define X_GLrop_FinalCombinerInputNV 4142 /* 222. GL_NV_fence */ #define X_GLrop_SetFenceNV 4143 #define X_GLrop_FinishFenceNV 4144 /* 227. GL_NV_register_combiners2 */ /* XXX opcodes not defined in the spec */ /* 233. GL_NV_vertex_program - see also GL_ARB_vertex_program opcodes */ #define X_GLrop_ExecuteProgramNV 4181 #define X_GLrop_RequestResidentProgramsNV 4182 #define X_GLrop_LoadProgamNV 4183 #define X_GLrop_ProgramParameters4fvNV 4186 #define X_GLrop_ProgramParameters4dvNV 4187 #define X_GLrop_TrackMatrixNV 4188 #define X_GLrop_VertexAttribs1svNV 4202 #define X_GLrop_VertexAttribs2svNV 4203 #define X_GLrop_VertexAttribs3svNV 4204 #define X_GLrop_VertexAttribs4svNV 4205 #define X_GLrop_VertexAttribs1fvNV 4206 #define X_GLrop_VertexAttribs2fvNV 4207 #define X_GLrop_VertexAttribs3fvNV 4208 #define X_GLrop_VertexAttribs4fvNV 4209 #define X_GLrop_VertexAttribs1dvNV 4210 #define X_GLrop_VertexAttribs2dvNV 4211 #define X_GLrop_VertexAttribs3dvNV 4212 #define X_GLrop_VertexAttribs4dvNV 4213 #define X_GLrop_VertexAttribs4ubvNV 4214 /* 261. GL_NV_occlusion_query */ /* XXX opcodes not defined in the spec */ /* 262. GL_NV_point_sprite - see GL 1.4 opcodes */ /* 268. GL_EXT_stencil_two_side */ #define X_GLrop_ActiveStencilFaceEXT 4220 /* 282. GL_NV_fragment_program - see also GL_NV_vertex_program and GL_ARB_vertex_program opcodes */ #define X_GLrop_ProgramNamedParameter4fvNV 4218 #define X_GLrop_ProgramNamedParameter4dvNV 4219 /* 285. GL_NV_primitive_restart */ /* XXX opcodes not defined in the spec */ /* 297. GL_EXT_depth_bounds_test */ #define X_GLrop_DepthBoundsEXT 4229 /* 299. GL_EXT_blend_equation_separate */ #define X_GLrop_BlendEquationSeparateEXT 4228 /* 310. GL_EXT_framebuffer_object */ #define X_GLvop_IsRenderbufferEXT 1422 #define X_GLvop_GenRenderbuffersEXT 1423 #define X_GLvop_GetRenderbufferParameterivEXT 1424 #define X_GLvop_IsFramebufferEXT 1425 #define X_GLvop_GenFramebuffersEXT 1426 #define X_GLvop_CheckFramebufferStatusEXT 1427 #define X_GLvop_GetFramebufferAttachmentParameterivEXT 1428 #endif /* _GLX_glxproto_h_ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ltdl.h����������������������������������������������������������������������������������������������0000644�����������������00000013125�14763166026�0005671 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ltdl.h -- generic dlopen functions Copyright (C) 1998-2000, 2004, 2005, 2007, 2008 Free Software Foundation, Inc. Written by Thomas Tanner, 1998 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Only include this header file once. */ #if !defined(LTDL_H) #define LTDL_H 1 #include <libltdl/lt_system.h> #include <libltdl/lt_error.h> #include <libltdl/lt_dlloader.h> LT_BEGIN_C_DECLS /* LT_STRLEN can be used safely on NULL pointers. */ #define LT_STRLEN(s) (((s) && (s)[0]) ? strlen (s) : 0) /* --- DYNAMIC MODULE LOADING API --- */ typedef struct lt__handle *lt_dlhandle; /* A loaded module. */ /* Initialisation and finalisation functions for libltdl. */ LT_SCOPE int lt_dlinit (void); LT_SCOPE int lt_dlexit (void); /* Module search path manipulation. */ LT_SCOPE int lt_dladdsearchdir (const char *search_dir); LT_SCOPE int lt_dlinsertsearchdir (const char *before, const char *search_dir); LT_SCOPE int lt_dlsetsearchpath (const char *search_path); LT_SCOPE const char *lt_dlgetsearchpath (void); LT_SCOPE int lt_dlforeachfile ( const char *search_path, int (*func) (const char *filename, void *data), void *data); /* User module loading advisors. */ LT_SCOPE int lt_dladvise_init (lt_dladvise *advise); LT_SCOPE int lt_dladvise_destroy (lt_dladvise *advise); LT_SCOPE int lt_dladvise_ext (lt_dladvise *advise); LT_SCOPE int lt_dladvise_resident (lt_dladvise *advise); LT_SCOPE int lt_dladvise_local (lt_dladvise *advise); LT_SCOPE int lt_dladvise_global (lt_dladvise *advise); LT_SCOPE int lt_dladvise_preload (lt_dladvise *advise); /* Portable libltdl versions of the system dlopen() API. */ LT_SCOPE lt_dlhandle lt_dlopen (const char *filename); LT_SCOPE lt_dlhandle lt_dlopenext (const char *filename); LT_SCOPE lt_dlhandle lt_dlopenadvise (const char *filename, lt_dladvise advise); LT_SCOPE void * lt_dlsym (lt_dlhandle handle, const char *name); LT_SCOPE const char *lt_dlerror (void); LT_SCOPE int lt_dlclose (lt_dlhandle handle); /* --- PRELOADED MODULE SUPPORT --- */ /* A preopened symbol. Arrays of this type comprise the exported symbols for a dlpreopened module. */ typedef struct { const char *name; void *address; } lt_dlsymlist; typedef int lt_dlpreload_callback_func (lt_dlhandle handle); LT_SCOPE int lt_dlpreload (const lt_dlsymlist *preloaded); LT_SCOPE int lt_dlpreload_default (const lt_dlsymlist *preloaded); LT_SCOPE int lt_dlpreload_open (const char *originator, lt_dlpreload_callback_func *func); #define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols /* Ensure C linkage. */ extern LT_DLSYM_CONST lt_dlsymlist lt__PROGRAM__LTX_preloaded_symbols[]; #define LTDL_SET_PRELOADED_SYMBOLS() \ lt_dlpreload_default(lt_preloaded_symbols) /* --- MODULE INFORMATION --- */ /* Associating user data with loaded modules. */ typedef void * lt_dlinterface_id; typedef int lt_dlhandle_interface (lt_dlhandle handle, const char *id_string); LT_SCOPE lt_dlinterface_id lt_dlinterface_register (const char *id_string, lt_dlhandle_interface *iface); LT_SCOPE void lt_dlinterface_free (lt_dlinterface_id key); LT_SCOPE void * lt_dlcaller_set_data (lt_dlinterface_id key, lt_dlhandle handle, void *data); LT_SCOPE void * lt_dlcaller_get_data (lt_dlinterface_id key, lt_dlhandle handle); /* Read only information pertaining to a loaded module. */ typedef struct { char * filename; /* file name */ char * name; /* module name */ int ref_count; /* number of times lt_dlopened minus number of times lt_dlclosed. */ unsigned int is_resident:1; /* module can't be unloaded. */ unsigned int is_symglobal:1; /* module symbols can satisfy subsequently loaded modules. */ unsigned int is_symlocal:1; /* module symbols are only available locally. */ } lt_dlinfo; LT_SCOPE const lt_dlinfo *lt_dlgetinfo (lt_dlhandle handle); LT_SCOPE lt_dlhandle lt_dlhandle_iterate (lt_dlinterface_id iface, lt_dlhandle place); LT_SCOPE lt_dlhandle lt_dlhandle_fetch (lt_dlinterface_id iface, const char *module_name); LT_SCOPE int lt_dlhandle_map (lt_dlinterface_id iface, int (*func) (lt_dlhandle handle, void *data), void *data); /* Deprecated module residency management API. */ LT_SCOPE int lt_dlmakeresident (lt_dlhandle handle); LT_SCOPE int lt_dlisresident (lt_dlhandle handle); #define lt_ptr void * LT_END_C_DECLS #endif /*!defined(LTDL_H)*/ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������fstab.h���������������������������������������������������������������������������������������������0000644�����������������00000006047�14763166026�0006036 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 1980, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)fstab.h 8.1 (Berkeley) 6/2/93 */ #ifndef _FSTAB_H #define _FSTAB_H 1 #include <features.h> /* * File system table, see fstab(5). * * Used by dump, mount, umount, swapon, fsck, df, ... * * For ufs fs_spec field is the block special name. Programs that want to * use the character special name must create that name by prepending a 'r' * after the right most slash. Quota files are always named "quotas", so * if type is "rq", then use concatenation of fs_file and "quotas" to locate * quota file. */ #define _PATH_FSTAB "/etc/fstab" #define FSTAB "/etc/fstab" /* deprecated */ #define FSTAB_RW "rw" /* read/write device */ #define FSTAB_RQ "rq" /* read/write with quotas */ #define FSTAB_RO "ro" /* read-only device */ #define FSTAB_SW "sw" /* swap device */ #define FSTAB_XX "xx" /* ignore totally */ struct fstab { char *fs_spec; /* block special device name */ char *fs_file; /* file system path prefix */ char *fs_vfstype; /* File system type, ufs, nfs */ char *fs_mntops; /* Mount options ala -o */ const char *fs_type; /* FSTAB_* from fs_mntops */ int fs_freq; /* dump frequency, in days */ int fs_passno; /* pass number on parallel dump */ }; __BEGIN_DECLS extern struct fstab *getfsent (void) __THROW; extern struct fstab *getfsspec (const char *__name) __THROW; extern struct fstab *getfsfile (const char *__name) __THROW; extern int setfsent (void) __THROW; extern void endfsent (void) __THROW; __END_DECLS #endif /* fstab.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libgen.h��������������������������������������������������������������������������������������������0000644�����������������00000002566�14763166026�0006201 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _LIBGEN_H #define _LIBGEN_H 1 #include <features.h> __BEGIN_DECLS /* Return directory part of PATH or "." if none is available. */ extern char *dirname (char *__path) __THROW; /* Return final component of PATH. This is the weird XPG version of this function. It sometimes will modify its argument. Therefore we normally use the GNU version (in <string.h>) and only if this header is included make the XPG version available under the real name. */ extern char *__xpg_basename (char *__path) __THROW; #define basename __xpg_basename __END_DECLS #endif /* libgen.h */ ������������������������������������������������������������������������������������������������������������������������������������������collectd/network_parse.h����������������������������������������������������������������������������0000644�����������������00000004046�14763166026�0011410 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * Copyright 2017 Florian Forster * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Authors: * Florian octo Forster <octo at collectd.org> **/ #ifndef LIBCOLLECTD_NETWORK_PARSE_H #define LIBCOLLECTD_NETWORK_PARSE_H 1 #include "collectd/lcc_features.h" #include "collectd/network.h" /* for lcc_security_level_t */ #include "collectd/types.h" #include <stdint.h> LCC_BEGIN_DECLS typedef struct { /* writer is the callback used to send incoming lcc_value_list_t to. */ lcc_value_list_writer_t writer; /* password_lookup is used to look up the password for a given username. */ lcc_password_lookup_t password_lookup; /* security_level is the minimal required security level. */ lcc_security_level_t security_level; } lcc_network_parse_options_t; /* lcc_network_parse parses data received from the network and calls "w" with * the parsed lcc_value_list_ts. */ int lcc_network_parse(void *buffer, size_t buffer_size, lcc_network_parse_options_t opts); LCC_END_DECLS #endif /* LIBCOLLECTD_NETWORK_PARSE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������collectd/types.h������������������������������������������������������������������������������������0000644�����������������00000005677�14763166026�0007704 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * libcollectdclient - src/libcollectdclient/collectd/types.h * Copyright (C) 2008-2017 Florian octo Forster * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Authors: * Florian octo Forster <octo at collectd.org> **/ #ifndef LIBCOLLECTD_COLLECTD_TYPES_H #define LIBCOLLECTD_COLLECTD_TYPES_H 1 #include "collectd/lcc_features.h" #include <stdint.h> /* for uint64_t */ #include <sys/types.h> /* for size_t */ /* * Defines */ #define LCC_NAME_LEN 64 #define LCC_DEFAULT_PORT "25826" /* * Types */ #define LCC_TYPE_COUNTER 0 #define LCC_TYPE_GAUGE 1 #define LCC_TYPE_DERIVE 2 #define LCC_TYPE_ABSOLUTE 3 LCC_BEGIN_DECLS typedef uint64_t counter_t; typedef double gauge_t; typedef uint64_t derive_t; typedef uint64_t absolute_t; union value_u { counter_t counter; gauge_t gauge; derive_t derive; absolute_t absolute; }; typedef union value_u value_t; struct lcc_identifier_s { char host[LCC_NAME_LEN]; char plugin[LCC_NAME_LEN]; char plugin_instance[LCC_NAME_LEN]; char type[LCC_NAME_LEN]; char type_instance[LCC_NAME_LEN]; }; typedef struct lcc_identifier_s lcc_identifier_t; #define LCC_IDENTIFIER_INIT \ { "localhost", "", "", "", "" } struct lcc_value_list_s { value_t *values; int *values_types; size_t values_len; double time; double interval; lcc_identifier_t identifier; }; typedef struct lcc_value_list_s lcc_value_list_t; #define LCC_VALUE_LIST_INIT \ { NULL, NULL, 0, 0, 0, LCC_IDENTIFIER_INIT } /* lcc_value_list_writer_t is a write callback to which value lists are * dispatched. */ typedef int (*lcc_value_list_writer_t)(lcc_value_list_t const *); /* lcc_password_lookup_t is a callback for looking up the password for a given * user. Must return NULL if the user is not known. */ typedef char const *(*lcc_password_lookup_t)(char const *); LCC_END_DECLS #endif /* LIBCOLLECTD_COLLECTD_TYPES_H */ �����������������������������������������������������������������collectd/lcc_features.h�����������������������������������������������������������������������������0000644�����������������00000003750�14763166026�0011165 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * libcollectdclient - src/libcollectdclient/lcc_features.h * Copyright (C) 2009 Sebastian Harl * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Authors: * Sebastian tokkee Harl <sh at tokkee.org> **/ #ifndef LIBCOLLECTD_LCC_FEATURES_H #define LIBCOLLECTD_LCC_FEATURES_H 1 #ifdef __cplusplus # define LCC_BEGIN_DECLS extern "C" { # define LCC_END_DECLS } #else # define LCC_BEGIN_DECLS # define LCC_END_DECLS #endif #define LCC_API_VERSION 0 #define LCC_VERSION_MAJOR 5 #define LCC_VERSION_MINOR 8 #define LCC_VERSION_PATCH 1 #define LCC_VERSION_EXTRA "" #define LCC_VERSION_STRING "5.8.1" #define LCC_VERSION_ENCODE(major, minor, patch) \ ((major) * 10000 + (minor) * 100 + (patch)) #define LCC_VERSION \ LCC_VERSION_ENCODE(LCC_VERSION_MAJOR, LCC_VERSION_MINOR, LCC_VERSION_PATCH) LCC_BEGIN_DECLS unsigned int lcc_version (void); const char *lcc_version_string (void); const char *lcc_version_extra (void); LCC_END_DECLS #endif /* ! LIBCOLLECTD_LCC_FEATURES_H */ ������������������������collectd/server.h�����������������������������������������������������������������������������������0000644�����������������00000006536�14763166026�0010041 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * Copyright 2017 Florian Forster * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Authors: * Florian octo Forster <octo at collectd.org> **/ #ifndef LIBCOLLECTD_SERVER_H #define LIBCOLLECTD_SERVER_H 1 #include "collectd/lcc_features.h" #include "collectd/network.h" /* for lcc_security_level_t */ #include "collectd/network_parse.h" /* for lcc_network_parse_options_t */ #include "collectd/types.h" #include <stdint.h> #ifndef LCC_NETWORK_BUFFER_SIZE #define LCC_NETWORK_BUFFER_SIZE 1452 #endif LCC_BEGIN_DECLS /* lcc_network_parser_t is a callback that parses received network packets. It * is expected to call lcc_network_parse_options_t.writer with each * lcc_value_list_t it parses that has the required security level. */ typedef int (*lcc_network_parser_t)(void *payload, size_t payload_size, lcc_network_parse_options_t opts); /* lcc_listener_t holds parameters for running a collectd server. */ typedef struct { /* conn is a UDP socket for the server to listen on. If set to <0 node and * service will be used to open a new UDP socket. If >=0, it is the caller's * job to clean up the socket. */ int conn; /* node is the local address to listen on if conn is <0. Defaults to "::" (any * address). */ char *node; /* service is the local address to listen on if conn is <0. Defaults to * LCC_DEFAULT_PORT. */ char *service; /* parser is the callback used to parse incoming network packets. Defaults to * lcc_network_parse() if set to NULL. */ lcc_network_parser_t parser; /* parse_options contains options for parser and is passed on verbatimely. */ lcc_network_parse_options_t parse_options; /* buffer_size determines the maximum packet size to accept. Defaults to * LCC_NETWORK_BUFFER_SIZE if set to zero. */ uint16_t buffer_size; /* interface is the name of the interface to use when subscribing to a * multicast group. Has no effect when using unicast. */ char *interface; } lcc_listener_t; /* lcc_listen_and_write listens on the provided UDP socket (or opens one using * srv.addr if srv.conn is less than zero), parses the received packets and * writes them to the provided lcc_value_list_writer_t. Returns non-zero on * failure and does not return otherwise. */ int lcc_listen_and_write(lcc_listener_t srv); LCC_END_DECLS #endif /* LIBCOLLECTD_SERVER_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������collectd/network.h����������������������������������������������������������������������������������0000644�����������������00000005136�14763166026�0010217 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * collectd - src/libcollectdclient/collectd/network.h * Copyright (C) 2005-2012 Florian octo Forster * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Authors: * Florian octo Forster <octo at collectd.org> **/ #ifndef LIBCOLLECTDCLIENT_NETWORK_H #define LIBCOLLECTDCLIENT_NETWORK_H 1 #include "collectd/client.h" #include <inttypes.h> #include <stdint.h> #define NET_DEFAULT_V4_ADDR "239.192.74.66" #define NET_DEFAULT_V6_ADDR "ff18::efc0:4a42" #define NET_DEFAULT_PORT "25826" struct lcc_network_s; typedef struct lcc_network_s lcc_network_t; struct lcc_server_s; typedef struct lcc_server_s lcc_server_t; enum lcc_security_level_e { NONE, SIGN, ENCRYPT }; typedef enum lcc_security_level_e lcc_security_level_t; /* * Create / destroy object */ lcc_network_t *lcc_network_create(void); void lcc_network_destroy(lcc_network_t *net); /* * Add servers */ lcc_server_t *lcc_server_create(lcc_network_t *net, const char *node, const char *service); int lcc_server_destroy(lcc_network_t *net, lcc_server_t *srv); /* Configure servers */ int lcc_server_set_ttl(lcc_server_t *srv, uint8_t ttl); int lcc_server_set_interface(lcc_server_t *srv, char const *interface); int lcc_server_set_security_level(lcc_server_t *srv, lcc_security_level_t level, const char *username, const char *password); /* * Send data */ int lcc_network_values_send(lcc_network_t *net, const lcc_value_list_t *vl); #if 0 int lcc_network_notification_send (lcc_network_t *net, const lcc_notification_t *notif); #endif #endif /* LIBCOLLECTDCLIENT_NETWORK_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������collectd/network_buffer.h���������������������������������������������������������������������������0000644�����������������00000004606�14763166026�0011551 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * collectd - src/libcollectdclient/collectd/network_buffer.h * Copyright (C) 2010-2012 Florian octo Forster * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Authors: * Florian octo Forster <octo at collectd.org> **/ #ifndef LIBCOLLECTDCLIENT_NETWORK_BUFFER_H #define LIBCOLLECTDCLIENT_NETWORK_BUFFER_H 1 #include "config.h" #include "collectd/network.h" /* for lcc_security_level_t */ #include "collectd/types.h" /* Ethernet frame - (IPv6 header + UDP header) */ #define LCC_NETWORK_BUFFER_SIZE_DEFAULT 1452 struct lcc_network_buffer_s; typedef struct lcc_network_buffer_s lcc_network_buffer_t; lcc_network_buffer_t *lcc_network_buffer_create(size_t size); void lcc_network_buffer_destroy(lcc_network_buffer_t *nb); int lcc_network_buffer_set_security_level(lcc_network_buffer_t *nb, lcc_security_level_t level, const char *user, const char *password); int lcc_network_buffer_initialize(lcc_network_buffer_t *nb); int lcc_network_buffer_finalize(lcc_network_buffer_t *nb); int lcc_network_buffer_add_value(lcc_network_buffer_t *nb, const lcc_value_list_t *vl); int lcc_network_buffer_get(lcc_network_buffer_t *nb, void *buffer, size_t *buffer_size); #endif /* LIBCOLLECTDCLIENT_NETWORK_BUFFER_H */ ��������������������������������������������������������������������������������������������������������������������������collectd/client.h�����������������������������������������������������������������������������������0000644�����������������00000006731�14763166026�0010006 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * libcollectdclient - src/libcollectdclient/collectd/client.h * Copyright (C) 2008-2012 Florian octo Forster * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Authors: * Florian octo Forster <octo at collectd.org> **/ #ifndef LIBCOLLECTD_COLLECTDCLIENT_H #define LIBCOLLECTD_COLLECTDCLIENT_H 1 #include "collectd/lcc_features.h" #include "collectd/types.h" /* COLLECTD_TRACE is the environment variable used to control trace output. When * set to something non-zero, all lines sent to / received from the daemon are * printed to STDOUT. */ #ifndef LCC_TRACE_ENV #define LCC_TRACE_ENV "COLLECTD_TRACE" #endif /* * Includes (for data types) */ #include <inttypes.h> #include <stdint.h> #include <time.h> LCC_BEGIN_DECLS struct lcc_connection_s; typedef struct lcc_connection_s lcc_connection_t; /* * Functions */ int lcc_connect(const char *address, lcc_connection_t **ret_con); int lcc_disconnect(lcc_connection_t *c); #define LCC_DESTROY(c) \ do { \ lcc_disconnect(c); \ (c) = NULL; \ } while (0) int lcc_getval(lcc_connection_t *c, lcc_identifier_t *ident, size_t *ret_values_num, gauge_t **ret_values, char ***ret_values_names); int lcc_putval(lcc_connection_t *c, const lcc_value_list_t *vl); int lcc_flush(lcc_connection_t *c, const char *plugin, lcc_identifier_t *ident, int timeout); int lcc_listval(lcc_connection_t *c, lcc_identifier_t **ret_ident, size_t *ret_ident_num); /* TODO: putnotif */ const char *lcc_strerror(lcc_connection_t *c); int lcc_identifier_to_string(lcc_connection_t *c, char *string, size_t string_size, const lcc_identifier_t *ident); int lcc_string_to_identifier(lcc_connection_t *c, lcc_identifier_t *ident, const char *string); /* Compares the identifiers "i0" and "i1" and returns less than zero or greater * than zero if "i0" is smaller than or greater than "i1", respectively. If * "i0" and "i1" are identical, zero is returned. */ int lcc_identifier_compare(const void *i0, const void *i1); int lcc_sort_identifiers(lcc_connection_t *c, lcc_identifier_t *idents, size_t idents_num); LCC_END_DECLS #endif /* LIBCOLLECTD_COLLECTDCLIENT_H */ ���������������������������������������ttyent.h��������������������������������������������������������������������������������������������0000644�����������������00000004676�14763166026�0006274 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)ttyent.h 8.1 (Berkeley) 6/2/93 */ #ifndef _TTYENT_H #define _TTYENT_H 1 #include <features.h> #define _PATH_TTYS "/etc/ttys" #define _TTYS_OFF "off" #define _TTYS_ON "on" #define _TTYS_SECURE "secure" #define _TTYS_WINDOW "window" struct ttyent { char *ty_name; /* terminal device name */ char *ty_getty; /* command to execute, usually getty */ char *ty_type; /* terminal type for termcap */ #define TTY_ON 0x01 /* enable logins (start ty_getty program) */ #define TTY_SECURE 0x02 /* allow uid of 0 to login */ int ty_status; /* status flags */ char *ty_window; /* command to start up window manager */ char *ty_comment; /* comment field */ }; __BEGIN_DECLS extern struct ttyent *getttyent (void) __THROW; extern struct ttyent *getttynam (const char *__tty) __THROW; extern int setttyent (void) __THROW; extern int endttyent (void) __THROW; __END_DECLS #endif /* ttyent.h */ ������������������������������������������������������������������dirent.h��������������������������������������������������������������������������������������������0000644�����������������00000030533�14763166026�0006221 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-2000,2003-2005,2009,2010,2011,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 5.1.2 Directory Operations <dirent.h> */ #ifndef _DIRENT_H #define _DIRENT_H 1 #include <features.h> __BEGIN_DECLS #include <bits/types.h> #ifdef __USE_XOPEN # ifndef __ino_t_defined # ifndef __USE_FILE_OFFSET64 typedef __ino_t ino_t; # else typedef __ino64_t ino_t; # endif # define __ino_t_defined # endif # if defined __USE_LARGEFILE64 && !defined __ino64_t_defined typedef __ino64_t ino64_t; # define __ino64_t_defined # endif #endif /* This file defines `struct dirent'. It defines the macro `_DIRENT_HAVE_D_NAMLEN' iff there is a `d_namlen' member that gives the length of `d_name'. It defines the macro `_DIRENT_HAVE_D_RECLEN' iff there is a `d_reclen' member that gives the size of the entire directory entry. It defines the macro `_DIRENT_HAVE_D_OFF' iff there is a `d_off' member that gives the file offset of the next directory entry. It defines the macro `_DIRENT_HAVE_D_TYPE' iff there is a `d_type' member that gives the type of the file. */ #include <bits/dirent.h> #if (defined __USE_BSD || defined __USE_MISC) && !defined d_fileno # define d_ino d_fileno /* Backward compatibility. */ #endif /* These macros extract size information from a `struct dirent *'. They may evaluate their argument multiple times, so it must not have side effects. Each of these may involve a relatively costly call to `strlen' on some systems, so these values should be cached. _D_EXACT_NAMLEN (DP) returns the length of DP->d_name, not including its terminating null character. _D_ALLOC_NAMLEN (DP) returns a size at least (_D_EXACT_NAMLEN (DP) + 1); that is, the allocation size needed to hold the DP->d_name string. Use this macro when you don't need the exact length, just an upper bound. This macro is less likely to require calling `strlen' than _D_EXACT_NAMLEN. */ #ifdef _DIRENT_HAVE_D_NAMLEN # define _D_EXACT_NAMLEN(d) ((d)->d_namlen) # define _D_ALLOC_NAMLEN(d) (_D_EXACT_NAMLEN (d) + 1) #else # define _D_EXACT_NAMLEN(d) (strlen ((d)->d_name)) # ifdef _DIRENT_HAVE_D_RECLEN # define _D_ALLOC_NAMLEN(d) (((char *) (d) + (d)->d_reclen) - &(d)->d_name[0]) # else # define _D_ALLOC_NAMLEN(d) (sizeof (d)->d_name > 1 ? sizeof (d)->d_name : \ _D_EXACT_NAMLEN (d) + 1) # endif #endif #ifdef __USE_BSD /* File types for `d_type'. */ enum { DT_UNKNOWN = 0, # define DT_UNKNOWN DT_UNKNOWN DT_FIFO = 1, # define DT_FIFO DT_FIFO DT_CHR = 2, # define DT_CHR DT_CHR DT_DIR = 4, # define DT_DIR DT_DIR DT_BLK = 6, # define DT_BLK DT_BLK DT_REG = 8, # define DT_REG DT_REG DT_LNK = 10, # define DT_LNK DT_LNK DT_SOCK = 12, # define DT_SOCK DT_SOCK DT_WHT = 14 # define DT_WHT DT_WHT }; /* Convert between stat structure types and directory types. */ # define IFTODT(mode) (((mode) & 0170000) >> 12) # define DTTOIF(dirtype) ((dirtype) << 12) #endif /* This is the data type of directory stream objects. The actual structure is opaque to users. */ typedef struct __dirstream DIR; /* Open a directory stream on NAME. Return a DIR stream on the directory, or NULL if it could not be opened. This function is a possible cancellation point and therefore not marked with __THROW. */ extern DIR *opendir (const char *__name) __nonnull ((1)); #ifdef __USE_XOPEN2K8 /* Same as opendir, but open the stream on the file descriptor FD. This function is a possible cancellation point and therefore not marked with __THROW. */ extern DIR *fdopendir (int __fd); #endif /* Close the directory stream DIRP. Return 0 if successful, -1 if not. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int closedir (DIR *__dirp) __nonnull ((1)); /* Read a directory entry from DIRP. Return a pointer to a `struct dirent' describing the entry, or NULL for EOF or error. The storage returned may be overwritten by a later readdir call on the same DIR stream. If the Large File Support API is selected we have to use the appropriate interface. This function is a possible cancellation point and therefore not marked with __THROW. */ #ifndef __USE_FILE_OFFSET64 extern struct dirent *readdir (DIR *__dirp) __nonnull ((1)); #else # ifdef __REDIRECT extern struct dirent *__REDIRECT (readdir, (DIR *__dirp), readdir64) __nonnull ((1)); # else # define readdir readdir64 # endif #endif #ifdef __USE_LARGEFILE64 extern struct dirent64 *readdir64 (DIR *__dirp) __nonnull ((1)); #endif #if defined __USE_POSIX || defined __USE_MISC /* Reentrant version of `readdir'. Return in RESULT a pointer to the next entry. This function is a possible cancellation point and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int readdir_r (DIR *__restrict __dirp, struct dirent *__restrict __entry, struct dirent **__restrict __result) __nonnull ((1, 2, 3)); # else # ifdef __REDIRECT extern int __REDIRECT (readdir_r, (DIR *__restrict __dirp, struct dirent *__restrict __entry, struct dirent **__restrict __result), readdir64_r) __nonnull ((1, 2, 3)); # else # define readdir_r readdir64_r # endif # endif # ifdef __USE_LARGEFILE64 extern int readdir64_r (DIR *__restrict __dirp, struct dirent64 *__restrict __entry, struct dirent64 **__restrict __result) __nonnull ((1, 2, 3)); # endif #endif /* POSIX or misc */ /* Rewind DIRP to the beginning of the directory. */ extern void rewinddir (DIR *__dirp) __THROW __nonnull ((1)); #if defined __USE_BSD || defined __USE_MISC || defined __USE_XOPEN # include <bits/types.h> /* Seek to position POS on DIRP. */ extern void seekdir (DIR *__dirp, long int __pos) __THROW __nonnull ((1)); /* Return the current position of DIRP. */ extern long int telldir (DIR *__dirp) __THROW __nonnull ((1)); #endif #if defined __USE_BSD || defined __USE_MISC || defined __USE_XOPEN2K8 /* Return the file descriptor used by DIRP. */ extern int dirfd (DIR *__dirp) __THROW __nonnull ((1)); # if defined __OPTIMIZE__ && defined _DIR_dirfd # define dirfd(dirp) _DIR_dirfd (dirp) # endif # if defined __USE_BSD || defined __USE_MISC # ifndef MAXNAMLEN /* Get the definitions of the POSIX.1 limits. */ # include <bits/posix1_lim.h> /* `MAXNAMLEN' is the BSD name for what POSIX calls `NAME_MAX'. */ # ifdef NAME_MAX # define MAXNAMLEN NAME_MAX # else # define MAXNAMLEN 255 # endif # endif # endif # define __need_size_t # include <stddef.h> /* Scan the directory DIR, calling SELECTOR on each directory entry. Entries for which SELECT returns nonzero are individually malloc'd, sorted using qsort with CMP, and collected in a malloc'd array in *NAMELIST. Returns the number of entries selected, or -1 on error. This function is a cancellation point and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int scandir (const char *__restrict __dir, struct dirent ***__restrict __namelist, int (*__selector) (const struct dirent *), int (*__cmp) (const struct dirent **, const struct dirent **)) __nonnull ((1, 2)); # else # ifdef __REDIRECT extern int __REDIRECT (scandir, (const char *__restrict __dir, struct dirent ***__restrict __namelist, int (*__selector) (const struct dirent *), int (*__cmp) (const struct dirent **, const struct dirent **)), scandir64) __nonnull ((1, 2)); # else # define scandir scandir64 # endif # endif # if defined __USE_GNU && defined __USE_LARGEFILE64 /* This function is like `scandir' but it uses the 64bit dirent structure. Please note that the CMP function must now work with struct dirent64 **. */ extern int scandir64 (const char *__restrict __dir, struct dirent64 ***__restrict __namelist, int (*__selector) (const struct dirent64 *), int (*__cmp) (const struct dirent64 **, const struct dirent64 **)) __nonnull ((1, 2)); # endif # ifdef __USE_GNU /* Similar to `scandir' but a relative DIR name is interpreted relative to the directory for which DFD is a descriptor. This function is a cancellation point and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int scandirat (int __dfd, const char *__restrict __dir, struct dirent ***__restrict __namelist, int (*__selector) (const struct dirent *), int (*__cmp) (const struct dirent **, const struct dirent **)) __nonnull ((2, 3)); # else # ifdef __REDIRECT extern int __REDIRECT (scandirat, (int __dfd, const char *__restrict __dir, struct dirent ***__restrict __namelist, int (*__selector) (const struct dirent *), int (*__cmp) (const struct dirent **, const struct dirent **)), scandirat64) __nonnull ((2, 3)); # else # define scandirat scandirat64 # endif # endif /* This function is like `scandir' but it uses the 64bit dirent structure. Please note that the CMP function must now work with struct dirent64 **. */ extern int scandirat64 (int __dfd, const char *__restrict __dir, struct dirent64 ***__restrict __namelist, int (*__selector) (const struct dirent64 *), int (*__cmp) (const struct dirent64 **, const struct dirent64 **)) __nonnull ((2, 3)); # endif /* Function to compare two `struct dirent's alphabetically. */ # ifndef __USE_FILE_OFFSET64 extern int alphasort (const struct dirent **__e1, const struct dirent **__e2) __THROW __attribute_pure__ __nonnull ((1, 2)); # else # ifdef __REDIRECT extern int __REDIRECT_NTH (alphasort, (const struct dirent **__e1, const struct dirent **__e2), alphasort64) __attribute_pure__ __nonnull ((1, 2)); # else # define alphasort alphasort64 # endif # endif # if defined __USE_GNU && defined __USE_LARGEFILE64 extern int alphasort64 (const struct dirent64 **__e1, const struct dirent64 **__e2) __THROW __attribute_pure__ __nonnull ((1, 2)); # endif #endif /* Use BSD or misc or XPG7. */ #if defined __USE_BSD || defined __USE_MISC /* Read directory entries from FD into BUF, reading at most NBYTES. Reading starts at offset *BASEP, and *BASEP is updated with the new position after reading. Returns the number of bytes read; zero when at end of directory; or -1 for errors. */ # ifndef __USE_FILE_OFFSET64 extern __ssize_t getdirentries (int __fd, char *__restrict __buf, size_t __nbytes, __off_t *__restrict __basep) __THROW __nonnull ((2, 4)); # else # ifdef __REDIRECT extern __ssize_t __REDIRECT_NTH (getdirentries, (int __fd, char *__restrict __buf, size_t __nbytes, __off64_t *__restrict __basep), getdirentries64) __nonnull ((2, 4)); # else # define getdirentries getdirentries64 # endif # endif # ifdef __USE_LARGEFILE64 extern __ssize_t getdirentries64 (int __fd, char *__restrict __buf, size_t __nbytes, __off64_t *__restrict __basep) __THROW __nonnull ((2, 4)); # endif #endif /* Use BSD or misc. */ #ifdef __USE_GNU /* Function to compare two `struct dirent's by name & version. */ # ifndef __USE_FILE_OFFSET64 extern int versionsort (const struct dirent **__e1, const struct dirent **__e2) __THROW __attribute_pure__ __nonnull ((1, 2)); # else # ifdef __REDIRECT extern int __REDIRECT_NTH (versionsort, (const struct dirent **__e1, const struct dirent **__e2), versionsort64) __attribute_pure__ __nonnull ((1, 2)); # else # define versionsort versionsort64 # endif # endif # ifdef __USE_LARGEFILE64 extern int versionsort64 (const struct dirent64 **__e1, const struct dirent64 **__e2) __THROW __attribute_pure__ __nonnull ((1, 2)); # endif #endif /* Use GNU. */ __END_DECLS #endif /* dirent.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������rpc/xdr.h�������������������������������������������������������������������������������������������0000644�����������������00000034360�14763166026�0006317 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * xdr.h, External Data Representation Serialization Routines. * * Copyright (c) 2010, 2012, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RPC_XDR_H #define _RPC_XDR_H 1 #include <features.h> #include <sys/types.h> #include <rpc/types.h> /* We need FILE. */ #include <stdio.h> __BEGIN_DECLS /* * XDR provides a conventional way for converting between C data * types and an external bit-string representation. Library supplied * routines provide for the conversion on built-in C data types. These * routines and utility routines defined here are used to help implement * a type encode/decode routine for each user-defined type. * * Each data type provides a single procedure which takes two arguments: * * bool_t * xdrproc(xdrs, argresp) * XDR *xdrs; * <type> *argresp; * * xdrs is an instance of a XDR handle, to which or from which the data * type is to be converted. argresp is a pointer to the structure to be * converted. The XDR handle contains an operation field which indicates * which of the operations (ENCODE, DECODE * or FREE) is to be performed. * * XDR_DECODE may allocate space if the pointer argresp is null. This * data can be freed with the XDR_FREE operation. * * We write only one procedure per data type to make it easy * to keep the encode and decode procedures for a data type consistent. * In many cases the same code performs all operations on a user defined type, * because all the hard work is done in the component type routines. * decode as a series of calls on the nested data types. */ /* * Xdr operations. XDR_ENCODE causes the type to be encoded into the * stream. XDR_DECODE causes the type to be extracted from the stream. * XDR_FREE can be used to release the space allocated by an XDR_DECODE * request. */ enum xdr_op { XDR_ENCODE = 0, XDR_DECODE = 1, XDR_FREE = 2 }; /* * This is the number of bytes per unit of external data. */ #define BYTES_PER_XDR_UNIT (4) /* * This only works if the above is a power of 2. But it's defined to be * 4 by the appropriate RFCs. So it will work. And it's normally quicker * than the old routine. */ #if 1 #define RNDUP(x) (((x) + BYTES_PER_XDR_UNIT - 1) & ~(BYTES_PER_XDR_UNIT - 1)) #else /* this is the old routine */ #define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \ * BYTES_PER_XDR_UNIT) #endif /* * The XDR handle. * Contains operation which is being applied to the stream, * an operations vector for the particular implementation (e.g. see xdr_mem.c), * and two private fields for the use of the particular implementation. */ typedef struct XDR XDR; struct XDR { enum xdr_op x_op; /* operation; fast additional param */ struct xdr_ops { bool_t (*x_getlong) (XDR *__xdrs, long *__lp); /* get a long from underlying stream */ bool_t (*x_putlong) (XDR *__xdrs, const long *__lp); /* put a long to " */ bool_t (*x_getbytes) (XDR *__xdrs, caddr_t __addr, u_int __len); /* get some bytes from " */ bool_t (*x_putbytes) (XDR *__xdrs, const char *__addr, u_int __len); /* put some bytes to " */ u_int (*x_getpostn) (const XDR *__xdrs); /* returns bytes off from beginning */ bool_t (*x_setpostn) (XDR *__xdrs, u_int __pos); /* lets you reposition the stream */ int32_t *(*x_inline) (XDR *__xdrs, u_int __len); /* buf quick ptr to buffered data */ void (*x_destroy) (XDR *__xdrs); /* free privates of this xdr_stream */ bool_t (*x_getint32) (XDR *__xdrs, int32_t *__ip); /* get a int from underlying stream */ bool_t (*x_putint32) (XDR *__xdrs, const int32_t *__ip); /* put a int to " */ } *x_ops; caddr_t x_public; /* users' data */ caddr_t x_private; /* pointer to private data */ caddr_t x_base; /* private used for position info */ u_int x_handy; /* extra private word */ }; /* * A xdrproc_t exists for each data type which is to be encoded or decoded. * * The second argument to the xdrproc_t is a pointer to an opaque pointer. * The opaque pointer generally points to a structure of the data type * to be decoded. If this pointer is 0, then the type routines should * allocate dynamic storage of the appropriate size and return it. * bool_t (*xdrproc_t)(XDR *, caddr_t *); */ typedef bool_t (*xdrproc_t) (XDR *, void *,...); /* * Operations defined on a XDR handle * * XDR *xdrs; * int32_t *int32p; * long *longp; * caddr_t addr; * u_int len; * u_int pos; */ #define XDR_GETINT32(xdrs, int32p) \ (*(xdrs)->x_ops->x_getint32)(xdrs, int32p) #define xdr_getint32(xdrs, int32p) \ (*(xdrs)->x_ops->x_getint32)(xdrs, int32p) #define XDR_PUTINT32(xdrs, int32p) \ (*(xdrs)->x_ops->x_putint32)(xdrs, int32p) #define xdr_putint32(xdrs, int32p) \ (*(xdrs)->x_ops->x_putint32)(xdrs, int32p) #define XDR_GETLONG(xdrs, longp) \ (*(xdrs)->x_ops->x_getlong)(xdrs, longp) #define xdr_getlong(xdrs, longp) \ (*(xdrs)->x_ops->x_getlong)(xdrs, longp) #define XDR_PUTLONG(xdrs, longp) \ (*(xdrs)->x_ops->x_putlong)(xdrs, longp) #define xdr_putlong(xdrs, longp) \ (*(xdrs)->x_ops->x_putlong)(xdrs, longp) #define XDR_GETBYTES(xdrs, addr, len) \ (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) #define xdr_getbytes(xdrs, addr, len) \ (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) #define XDR_PUTBYTES(xdrs, addr, len) \ (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) #define xdr_putbytes(xdrs, addr, len) \ (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) #define XDR_GETPOS(xdrs) \ (*(xdrs)->x_ops->x_getpostn)(xdrs) #define xdr_getpos(xdrs) \ (*(xdrs)->x_ops->x_getpostn)(xdrs) #define XDR_SETPOS(xdrs, pos) \ (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) #define xdr_setpos(xdrs, pos) \ (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) #define XDR_INLINE(xdrs, len) \ (*(xdrs)->x_ops->x_inline)(xdrs, len) #define xdr_inline(xdrs, len) \ (*(xdrs)->x_ops->x_inline)(xdrs, len) #define XDR_DESTROY(xdrs) \ do { \ if ((xdrs)->x_ops->x_destroy) \ (*(xdrs)->x_ops->x_destroy)(xdrs); \ } while (0) #define xdr_destroy(xdrs) \ do { \ if ((xdrs)->x_ops->x_destroy) \ (*(xdrs)->x_ops->x_destroy)(xdrs); \ } while (0) /* * Support struct for discriminated unions. * You create an array of xdrdiscrim structures, terminated with * a entry with a null procedure pointer. The xdr_union routine gets * the discriminant value and then searches the array of structures * for a matching value. If a match is found the associated xdr routine * is called to handle that part of the union. If there is * no match, then a default routine may be called. * If there is no match and no default routine it is an error. */ #define NULL_xdrproc_t ((xdrproc_t)0) struct xdr_discrim { int value; xdrproc_t proc; }; /* * Inline routines for fast encode/decode of primitive data types. * Caveat emptor: these use single memory cycles to get the * data from the underlying buffer, and will fail to operate * properly if the data is not aligned. The standard way to use these * is to say: * if ((buf = XDR_INLINE(xdrs, count)) == NULL) * return (FALSE); * <<< macro calls >>> * where ``count'' is the number of bytes of data occupied * by the primitive data types. * * N.B. and frozen for all time: each data type here uses 4 bytes * of external representation. */ #define IXDR_GET_INT32(buf) ((int32_t)ntohl((uint32_t)*(buf)++)) #define IXDR_PUT_INT32(buf, v) (*(buf)++ = (int32_t)htonl((uint32_t)(v))) #define IXDR_GET_U_INT32(buf) ((uint32_t)IXDR_GET_INT32(buf)) #define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_INT32(buf, (int32_t)(v)) /* WARNING: The IXDR_*_LONG defines are removed by Sun for new platforms * and shouldn't be used any longer. Code which use this defines or longs * in the RPC code will not work on 64bit Solaris platforms ! */ #define IXDR_GET_LONG(buf) ((long)IXDR_GET_U_INT32(buf)) #define IXDR_PUT_LONG(buf, v) ((long)IXDR_PUT_INT32(buf, (long)(v))) #define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf)) #define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG(buf, (long)(v)) #define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf)) #define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf)) #define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf)) #define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf)) #define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG(buf, (long)(v)) #define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG(buf, (long)(v)) #define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG(buf, (long)(v)) #define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG(buf, (long)(v)) /* * These are the "generic" xdr routines. * None of these can have const applied because it's not possible to * know whether the call is a read or a write to the passed parameter * also, the XDR structure is always updated by some of these calls. */ extern bool_t xdr_void (void) __THROW; extern bool_t xdr_short (XDR *__xdrs, short *__sp) __THROW; extern bool_t xdr_u_short (XDR *__xdrs, u_short *__usp) __THROW; extern bool_t xdr_int (XDR *__xdrs, int *__ip) __THROW; extern bool_t xdr_u_int (XDR *__xdrs, u_int *__up) __THROW; extern bool_t xdr_long (XDR *__xdrs, long *__lp) __THROW; extern bool_t xdr_u_long (XDR *__xdrs, u_long *__ulp) __THROW; extern bool_t xdr_hyper (XDR *__xdrs, quad_t *__llp) __THROW; extern bool_t xdr_u_hyper (XDR *__xdrs, u_quad_t *__ullp) __THROW; extern bool_t xdr_longlong_t (XDR *__xdrs, quad_t *__llp) __THROW; extern bool_t xdr_u_longlong_t (XDR *__xdrs, u_quad_t *__ullp) __THROW; extern bool_t xdr_int8_t (XDR *__xdrs, int8_t *__ip) __THROW; extern bool_t xdr_uint8_t (XDR *__xdrs, uint8_t *__up) __THROW; extern bool_t xdr_int16_t (XDR *__xdrs, int16_t *__ip) __THROW; extern bool_t xdr_uint16_t (XDR *__xdrs, uint16_t *__up) __THROW; extern bool_t xdr_int32_t (XDR *__xdrs, int32_t *__ip) __THROW; extern bool_t xdr_uint32_t (XDR *__xdrs, uint32_t *__up) __THROW; extern bool_t xdr_int64_t (XDR *__xdrs, int64_t *__ip) __THROW; extern bool_t xdr_uint64_t (XDR *__xdrs, uint64_t *__up) __THROW; extern bool_t xdr_quad_t (XDR *__xdrs, quad_t *__ip) __THROW; extern bool_t xdr_u_quad_t (XDR *__xdrs, u_quad_t *__up) __THROW; extern bool_t xdr_bool (XDR *__xdrs, bool_t *__bp) __THROW; extern bool_t xdr_enum (XDR *__xdrs, enum_t *__ep) __THROW; extern bool_t xdr_array (XDR * _xdrs, caddr_t *__addrp, u_int *__sizep, u_int __maxsize, u_int __elsize, xdrproc_t __elproc) __THROW; extern bool_t xdr_bytes (XDR *__xdrs, char **__cpp, u_int *__sizep, u_int __maxsize) __THROW; extern bool_t xdr_opaque (XDR *__xdrs, caddr_t __cp, u_int __cnt) __THROW; extern bool_t xdr_string (XDR *__xdrs, char **__cpp, u_int __maxsize) __THROW; extern bool_t xdr_union (XDR *__xdrs, enum_t *__dscmp, char *__unp, const struct xdr_discrim *__choices, xdrproc_t __dfault) __THROW; extern bool_t xdr_char (XDR *__xdrs, char *__cp) __THROW; extern bool_t xdr_u_char (XDR *__xdrs, u_char *__cp) __THROW; extern bool_t xdr_vector (XDR *__xdrs, char *__basep, u_int __nelem, u_int __elemsize, xdrproc_t __xdr_elem) __THROW; extern bool_t xdr_float (XDR *__xdrs, float *__fp) __THROW; extern bool_t xdr_double (XDR *__xdrs, double *__dp) __THROW; extern bool_t xdr_reference (XDR *__xdrs, caddr_t *__xpp, u_int __size, xdrproc_t __proc) __THROW; extern bool_t xdr_pointer (XDR *__xdrs, char **__objpp, u_int __obj_size, xdrproc_t __xdr_obj) __THROW; extern bool_t xdr_wrapstring (XDR *__xdrs, char **__cpp) __THROW; extern u_long xdr_sizeof (xdrproc_t, void *) __THROW; /* * Common opaque bytes objects used by many rpc protocols; * declared here due to commonality. */ #define MAX_NETOBJ_SZ 1024 struct netobj { u_int n_len; char *n_bytes; }; typedef struct netobj netobj; extern bool_t xdr_netobj (XDR *__xdrs, struct netobj *__np) __THROW; /* * These are the public routines for the various implementations of * xdr streams. */ /* XDR using memory buffers */ extern void xdrmem_create (XDR *__xdrs, const caddr_t __addr, u_int __size, enum xdr_op __xop) __THROW; /* XDR using stdio library */ extern void xdrstdio_create (XDR *__xdrs, FILE *__file, enum xdr_op __xop) __THROW; /* XDR pseudo records for tcp */ extern void xdrrec_create (XDR *__xdrs, u_int __sendsize, u_int __recvsize, caddr_t __tcp_handle, int (*__readit) (char *, char *, int), int (*__writeit) (char *, char *, int)) __THROW; /* make end of xdr record */ extern bool_t xdrrec_endofrecord (XDR *__xdrs, bool_t __sendnow) __THROW; /* move to beginning of next record */ extern bool_t xdrrec_skiprecord (XDR *__xdrs) __THROW; /* true if no more input */ extern bool_t xdrrec_eof (XDR *__xdrs) __THROW; /* free memory buffers for xdr */ extern void xdr_free (xdrproc_t __proc, char *__objp) __THROW; __END_DECLS #endif /* rpc/xdr.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpc/types.h�����������������������������������������������������������������������������������������0000644�����������������00000006064�14763166026�0006666 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2010, Oracle America, Inc. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* fixincludes should not add extern "C" to this file */ /* * Rpc additions to <sys/types.h> */ #ifndef _RPC_TYPES_H #define _RPC_TYPES_H 1 typedef int bool_t; typedef int enum_t; /* This needs to be changed to uint32_t in the future */ typedef unsigned long rpcprog_t; typedef unsigned long rpcvers_t; typedef unsigned long rpcproc_t; typedef unsigned long rpcprot_t; typedef unsigned long rpcport_t; #define __dontcare__ -1 #ifndef FALSE # define FALSE (0) #endif #ifndef TRUE # define TRUE (1) #endif #ifndef NULL # define NULL 0 #endif #include <stdlib.h> /* For malloc decl. */ #define mem_alloc(bsize) malloc(bsize) /* * XXX: This must not use the second argument, or code in xdr_array.c needs * to be modified. */ #define mem_free(ptr, bsize) free(ptr) #ifndef makedev /* ie, we haven't already included it */ #include <sys/types.h> #endif #ifndef __u_char_defined typedef __u_char u_char; typedef __u_short u_short; typedef __u_int u_int; typedef __u_long u_long; typedef __quad_t quad_t; typedef __u_quad_t u_quad_t; typedef __fsid_t fsid_t; # define __u_char_defined #endif #ifndef __daddr_t_defined typedef __daddr_t daddr_t; typedef __caddr_t caddr_t; # define __daddr_t_defined #endif #include <sys/time.h> #include <sys/param.h> #include <netinet/in.h> #ifndef INADDR_LOOPBACK #define INADDR_LOOPBACK (u_long)0x7F000001 #endif #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 64 #endif #endif /* rpc/types.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpc/pmap_rmt.h��������������������������������������������������������������������������������������0000644�����������������00000004407�14763166026�0007340 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Structures and XDR routines for parameters to and replies from * the portmapper remote-call-service. * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RPC_PMAP_RMT_H #define _RPC_PMAP_RMT_H 1 #include <features.h> #include <sys/types.h> #include <rpc/types.h> #include <rpc/xdr.h> __BEGIN_DECLS struct rmtcallargs { u_long prog, vers, proc, arglen; caddr_t args_ptr; xdrproc_t xdr_args; }; extern bool_t xdr_rmtcall_args (XDR *__xdrs, struct rmtcallargs *__crp) __THROW; struct rmtcallres { u_long *port_ptr; u_long resultslen; caddr_t results_ptr; xdrproc_t xdr_results; }; extern bool_t xdr_rmtcallres (XDR *__xdrs, struct rmtcallres *__crp) __THROW; __END_DECLS #endif /* rpc/pmap_rmt.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpc/rpc.h�������������������������������������������������������������������������������������������0000644�����������������00000007542�14763166026�0006310 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * rpc.h, Just includes the billions of rpc header files necessary to * do remote procedure calling. * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RPC_RPC_H #define _RPC_RPC_H 1 #include <rpc/types.h> /* some typedefs */ #include <netinet/in.h> /* external data representation interfaces */ #include <rpc/xdr.h> /* generic (de)serializer */ /* Client side only authentication */ #include <rpc/auth.h> /* generic authenticator (client side) */ /* Client side (mostly) remote procedure call */ #include <rpc/clnt.h> /* generic rpc stuff */ /* semi-private protocol headers */ #include <rpc/rpc_msg.h> /* protocol for rpc messages */ #include <rpc/auth_unix.h> /* protocol for unix style cred */ #include <rpc/auth_des.h> /* protocol for des style cred */ /* Server side only remote procedure callee */ #include <rpc/svc.h> /* service manager and multiplexer */ #include <rpc/svc_auth.h> /* service side authenticator */ /* * COMMENT OUT THE NEXT INCLUDE IF RUNNING ON SUN OS OR ON A VERSION * OF UNIX BASED ON NFSSRC. These systems will already have the structures * defined by <rpc/netdb.h> included in <netdb.h>. */ /* routines for parsing /etc/rpc */ #include <rpc/netdb.h> /* structures and routines to parse /etc/rpc */ __BEGIN_DECLS /* Global variables, protected for multi-threaded applications. */ extern fd_set *__rpc_thread_svc_fdset (void) __attribute__ ((__const__)); #define svc_fdset (*__rpc_thread_svc_fdset ()) extern struct rpc_createerr *__rpc_thread_createerr (void) __attribute__ ((__const__)); #define get_rpc_createerr() (*__rpc_thread_createerr ()) /* The people who "engineered" RPC should bee punished for naming the data structure and the variable the same. We cannot always define the macro 'rpc_createerr' because this would prevent people from defining object of type 'struct rpc_createerr'. So we leave it up to the user to select transparent replacement also of this variable. */ #ifdef _RPC_MT_VARS # define rpc_createerr (*__rpc_thread_createerr ()) #endif extern struct pollfd **__rpc_thread_svc_pollfd (void) __attribute__ ((__const__)); #define svc_pollfd (*__rpc_thread_svc_pollfd ()) extern int *__rpc_thread_svc_max_pollfd (void) __attribute__ ((__const__)); #define svc_max_pollfd (*__rpc_thread_svc_max_pollfd ()) __END_DECLS #endif /* rpc/rpc.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������rpc/rpc_des.h���������������������������������������������������������������������������������������0000644�����������������00000004665�14763166026�0007146 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Generic DES driver interface * Keep this file hardware independent! * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _DES_H #define _DES_H #include <sys/types.h> #define DES_MAXLEN 65536 /* maximum # of bytes to encrypt */ #define DES_QUICKLEN 16 /* maximum # of bytes to encrypt quickly */ enum desdir { ENCRYPT, DECRYPT }; enum desmode { CBC, ECB }; /* * parameters to ioctl call */ struct desparams { u_char des_key[8]; /* key (with low bit parity) */ enum desdir des_dir; /* direction */ enum desmode des_mode; /* mode */ u_char des_ivec[8]; /* input vector */ unsigned des_len; /* number of bytes to crypt */ union { u_char UDES_data[DES_QUICKLEN]; u_char *UDES_buf; } UDES; #define des_data UDES.UDES_data /* direct data here if quick */ #define des_buf UDES.UDES_buf /* otherwise, pointer to data */ }; #endif ���������������������������������������������������������������������������rpc/rpc_msg.h���������������������������������������������������������������������������������������0000644�����������������00000011221�14763166026�0007143 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * rpc_msg.h * rpc message definition * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RPC_MSG_H #define _RPC_MSG_H 1 #include <sys/cdefs.h> #include <rpc/xdr.h> #include <rpc/clnt.h> #define RPC_MSG_VERSION ((u_long) 2) #define RPC_SERVICE_PORT ((u_short) 2048) __BEGIN_DECLS /* * Bottom up definition of an rpc message. * NOTE: call and reply use the same overall struct but * different parts of unions within it. */ enum msg_type { CALL=0, REPLY=1 }; enum reply_stat { MSG_ACCEPTED=0, MSG_DENIED=1 }; enum accept_stat { SUCCESS=0, PROG_UNAVAIL=1, PROG_MISMATCH=2, PROC_UNAVAIL=3, GARBAGE_ARGS=4, SYSTEM_ERR=5 }; enum reject_stat { RPC_MISMATCH=0, AUTH_ERROR=1 }; /* * Reply part of an rpc exchange */ /* * Reply to an rpc request that was accepted by the server. * Note: there could be an error even though the request was * accepted. */ struct accepted_reply { struct opaque_auth ar_verf; enum accept_stat ar_stat; union { struct { u_long low; u_long high; } AR_versions; struct { caddr_t where; xdrproc_t proc; } AR_results; /* and many other null cases */ } ru; #define ar_results ru.AR_results #define ar_vers ru.AR_versions }; /* * Reply to an rpc request that was rejected by the server. */ struct rejected_reply { enum reject_stat rj_stat; union { struct { u_long low; u_long high; } RJ_versions; enum auth_stat RJ_why; /* why authentication did not work */ } ru; #define rj_vers ru.RJ_versions #define rj_why ru.RJ_why }; /* * Body of a reply to an rpc request. */ struct reply_body { enum reply_stat rp_stat; union { struct accepted_reply RP_ar; struct rejected_reply RP_dr; } ru; #define rp_acpt ru.RP_ar #define rp_rjct ru.RP_dr }; /* * Body of an rpc request call. */ struct call_body { u_long cb_rpcvers; /* must be equal to two */ u_long cb_prog; u_long cb_vers; u_long cb_proc; struct opaque_auth cb_cred; struct opaque_auth cb_verf; /* protocol specific - provided by client */ }; /* * The rpc message */ struct rpc_msg { u_long rm_xid; enum msg_type rm_direction; union { struct call_body RM_cmb; struct reply_body RM_rmb; } ru; #define rm_call ru.RM_cmb #define rm_reply ru.RM_rmb }; #define acpted_rply ru.RM_rmb.ru.RP_ar #define rjcted_rply ru.RM_rmb.ru.RP_dr /* * XDR routine to handle a rpc message. * xdr_callmsg(xdrs, cmsg) * XDR *xdrs; * struct rpc_msg *cmsg; */ extern bool_t xdr_callmsg (XDR *__xdrs, struct rpc_msg *__cmsg) __THROW; /* * XDR routine to pre-serialize the static part of a rpc message. * xdr_callhdr(xdrs, cmsg) * XDR *xdrs; * struct rpc_msg *cmsg; */ extern bool_t xdr_callhdr (XDR *__xdrs, struct rpc_msg *__cmsg) __THROW; /* * XDR routine to handle a rpc reply. * xdr_replymsg(xdrs, rmsg) * XDR *xdrs; * struct rpc_msg *rmsg; */ extern bool_t xdr_replymsg (XDR *__xdrs, struct rpc_msg *__rmsg) __THROW; /* * Fills in the error part of a reply message. * _seterr_reply(msg, error) * struct rpc_msg *msg; * struct rpc_err *error; */ extern void _seterr_reply (struct rpc_msg *__msg, struct rpc_err *__error) __THROW; __END_DECLS #endif /* rpc/rpc_msg.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpc/svc_auth.h��������������������������������������������������������������������������������������0000644�����������������00000003670�14763166026�0007336 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * svc_auth.h, Service side of rpc authentication. * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RPC_SVC_AUTH_H #define _RPC_SVC_AUTH_H 1 #include <features.h> #include <rpc/svc.h> __BEGIN_DECLS /* * Server side authenticator */ extern enum auth_stat _authenticate (struct svc_req *__rqst, struct rpc_msg *__msg) __THROW; __END_DECLS #endif /* rpc/svc_auth.h */ ������������������������������������������������������������������������rpc/auth.h������������������������������������������������������������������������������������������0000644�����������������00000014754�14763166026�0006470 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * auth.h, Authentication interface. * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The data structures are completely opaque to the client. The client * is required to pass a AUTH * to routines that create rpc * "sessions". */ #ifndef _RPC_AUTH_H #define _RPC_AUTH_H 1 #include <features.h> #include <rpc/xdr.h> __BEGIN_DECLS #define MAX_AUTH_BYTES 400 #define MAXNETNAMELEN 255 /* maximum length of network user's name */ /* * Status returned from authentication check */ enum auth_stat { AUTH_OK=0, /* * failed at remote end */ AUTH_BADCRED=1, /* bogus credentials (seal broken) */ AUTH_REJECTEDCRED=2, /* client should begin new session */ AUTH_BADVERF=3, /* bogus verifier (seal broken) */ AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */ AUTH_TOOWEAK=5, /* rejected due to security reasons */ /* * failed locally */ AUTH_INVALIDRESP=6, /* bogus response verifier */ AUTH_FAILED=7 /* some unknown reason */ }; union des_block { struct { u_int32_t high; u_int32_t low; } key; char c[8]; }; typedef union des_block des_block; extern bool_t xdr_des_block (XDR *__xdrs, des_block *__blkp) __THROW; /* * Authentication info. Opaque to client. */ struct opaque_auth { enum_t oa_flavor; /* flavor of auth */ caddr_t oa_base; /* address of more auth stuff */ u_int oa_length; /* not to exceed MAX_AUTH_BYTES */ }; /* * Auth handle, interface to client side authenticators. */ typedef struct AUTH AUTH; struct AUTH { struct opaque_auth ah_cred; struct opaque_auth ah_verf; union des_block ah_key; struct auth_ops { void (*ah_nextverf) (AUTH *); int (*ah_marshal) (AUTH *, XDR *); /* nextverf & serialize */ int (*ah_validate) (AUTH *, struct opaque_auth *); /* validate verifier */ int (*ah_refresh) (AUTH *); /* refresh credentials */ void (*ah_destroy) (AUTH *); /* destroy this structure */ } *ah_ops; caddr_t ah_private; }; /* * Authentication ops. * The ops and the auth handle provide the interface to the authenticators. * * AUTH *auth; * XDR *xdrs; * struct opaque_auth verf; */ #define AUTH_NEXTVERF(auth) \ ((*((auth)->ah_ops->ah_nextverf))(auth)) #define auth_nextverf(auth) \ ((*((auth)->ah_ops->ah_nextverf))(auth)) #define AUTH_MARSHALL(auth, xdrs) \ ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) #define auth_marshall(auth, xdrs) \ ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) #define AUTH_VALIDATE(auth, verfp) \ ((*((auth)->ah_ops->ah_validate))((auth), verfp)) #define auth_validate(auth, verfp) \ ((*((auth)->ah_ops->ah_validate))((auth), verfp)) #define AUTH_REFRESH(auth) \ ((*((auth)->ah_ops->ah_refresh))(auth)) #define auth_refresh(auth) \ ((*((auth)->ah_ops->ah_refresh))(auth)) #define AUTH_DESTROY(auth) \ ((*((auth)->ah_ops->ah_destroy))(auth)) #define auth_destroy(auth) \ ((*((auth)->ah_ops->ah_destroy))(auth)) extern struct opaque_auth _null_auth; /* * These are the various implementations of client side authenticators. */ /* * Unix style authentication * AUTH *authunix_create(machname, uid, gid, len, aup_gids) * char *machname; * int uid; * int gid; * int len; * int *aup_gids; */ extern AUTH *authunix_create (char *__machname, __uid_t __uid, __gid_t __gid, int __len, __gid_t *__aup_gids); extern AUTH *authunix_create_default (void); extern AUTH *authnone_create (void) __THROW; extern AUTH *authdes_create (const char *__servername, u_int __window, struct sockaddr *__syncaddr, des_block *__ckey) __THROW; extern AUTH *authdes_pk_create (const char *, netobj *, u_int, struct sockaddr *, des_block *) __THROW; #define AUTH_NONE 0 /* no authentication */ #define AUTH_NULL 0 /* backward compatibility */ #define AUTH_SYS 1 /* unix style (uid, gids) */ #define AUTH_UNIX AUTH_SYS #define AUTH_SHORT 2 /* short hand unix style */ #define AUTH_DES 3 /* des style (encrypted timestamps) */ #define AUTH_DH AUTH_DES /* Diffie-Hellman (this is DES) */ #define AUTH_KERB 4 /* kerberos style */ /* * Netname manipulating functions * */ extern int getnetname (char *) __THROW; extern int host2netname (char *, const char *, const char *) __THROW; extern int user2netname (char *, const uid_t, const char *) __THROW; extern int netname2user (const char *, uid_t *, gid_t *, int *, gid_t *) __THROW; extern int netname2host (const char *, char *, const int) __THROW; /* * * These routines interface to the keyserv daemon * */ extern int key_decryptsession (char *, des_block *); extern int key_decryptsession_pk (char *, netobj *, des_block *); extern int key_encryptsession (char *, des_block *); extern int key_encryptsession_pk (char *, netobj *, des_block *); extern int key_gendes (des_block *); extern int key_setsecret (char *); extern int key_secretkey_is_set (void); extern int key_get_conv (char *, des_block *); /* * XDR an opaque authentication struct. */ extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *) __THROW; __END_DECLS #endif /* rpc/auth.h */ ��������������������rpc/auth_unix.h�������������������������������������������������������������������������������������0000644�����������������00000005542�14763166026�0007526 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * auth_unix.h, Protocol for UNIX style authentication parameters for RPC * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * The system is very weak. The client uses no encryption for it * credentials and only sends null verifiers. The server sends backs * null verifiers or optionally a verifier that suggests a new short hand * for the credentials. */ #ifndef _RPC_AUTH_UNIX_H #define _RPC_AUTH_UNIX_H 1 #include <features.h> #include <sys/types.h> #include <rpc/types.h> #include <rpc/auth.h> #include <rpc/xdr.h> __BEGIN_DECLS /* The machine name is part of a credential; it may not exceed 255 bytes */ #define MAX_MACHINE_NAME 255 /* gids compose part of a credential; there may not be more than 16 of them */ #define NGRPS 16 /* * Unix style credentials. */ struct authunix_parms { u_long aup_time; char *aup_machname; __uid_t aup_uid; __gid_t aup_gid; u_int aup_len; __gid_t *aup_gids; }; extern bool_t xdr_authunix_parms (XDR *__xdrs, struct authunix_parms *__p) __THROW; /* * If a response verifier has flavor AUTH_SHORT, * then the body of the response verifier encapsulates the following structure; * again it is serialized in the obvious fashion. */ struct short_hand_verf { struct opaque_auth new_cred; }; __END_DECLS #endif /* rpc/auth_unix.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������rpc/pmap_prot.h�������������������������������������������������������������������������������������0000644�����������������00000007342�14763166026�0007523 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * pmap_prot.h * Protocol for the local binder service, or pmap. * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RPC_PMAP_PROT_H #define _RPC_PMAP_PROT_H 1 #include <features.h> #include <rpc/xdr.h> __BEGIN_DECLS /* The following procedures are supported by the protocol: * * PMAPPROC_NULL() returns () * takes nothing, returns nothing * * PMAPPROC_SET(struct pmap) returns (bool_t) * TRUE is success, FALSE is failure. Registers the tuple * [prog, vers, prot, port]. * * PMAPPROC_UNSET(struct pmap) returns (bool_t) * TRUE is success, FALSE is failure. Un-registers pair * [prog, vers]. prot and port are ignored. * * PMAPPROC_GETPORT(struct pmap) returns (long unsigned). * 0 is failure. Otherwise returns the port number where the pair * [prog, vers] is registered. It may lie! * * PMAPPROC_DUMP() RETURNS (struct pmaplist *) * * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>) * RETURNS (port, string<>); * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs); * Calls the procedure on the local machine. If it is not registered, * this procedure is quite; ie it does not return error information!!! * This procedure only is supported on rpc/udp and calls via * rpc/udp. This routine only passes null authentication parameters. * This file has no interface to xdr routines for PMAPPROC_CALLIT. * * The service supports remote procedure calls on udp/ip or tcp/ip socket 111. */ #define PMAPPORT ((u_short)111) #define PMAPPROG ((u_long)100000) #define PMAPVERS ((u_long)2) #define PMAPVERS_PROTO ((u_long)2) #define PMAPVERS_ORIG ((u_long)1) #define PMAPPROC_NULL ((u_long)0) #define PMAPPROC_SET ((u_long)1) #define PMAPPROC_UNSET ((u_long)2) #define PMAPPROC_GETPORT ((u_long)3) #define PMAPPROC_DUMP ((u_long)4) #define PMAPPROC_CALLIT ((u_long)5) struct pmap { long unsigned pm_prog; long unsigned pm_vers; long unsigned pm_prot; long unsigned pm_port; }; extern bool_t xdr_pmap (XDR *__xdrs, struct pmap *__regs) __THROW; struct pmaplist { struct pmap pml_map; struct pmaplist *pml_next; }; extern bool_t xdr_pmaplist (XDR *__xdrs, struct pmaplist **__rp) __THROW; __END_DECLS #endif /* rpc/pmap_prot.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpc/key_prot.h��������������������������������������������������������������������������������������0000644�����������������00000026754�14763166026�0007366 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _KEY_PROT_H_RPCGEN #define _KEY_PROT_H_RPCGEN #include <rpc/rpc.h> /* Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Compiled from key_prot.x using rpcgen. * DO NOT EDIT THIS FILE! * This is NOT source code! */ #define PROOT 3 #define HEXMODULUS "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b" #define HEXKEYBYTES 48 #define KEYSIZE 192 #define KEYBYTES 24 #define KEYCHECKSUMSIZE 16 enum keystatus { KEY_SUCCESS = 0, KEY_NOSECRET = 1, KEY_UNKNOWN = 2, KEY_SYSTEMERR = 3, }; typedef enum keystatus keystatus; #ifdef __cplusplus extern "C" bool_t xdr_keystatus(XDR *, keystatus*); #elif __STDC__ extern bool_t xdr_keystatus(XDR *, keystatus*); #else /* Old Style C */ bool_t xdr_keystatus(); #endif /* Old Style C */ typedef char keybuf[HEXKEYBYTES]; #ifdef __cplusplus extern "C" bool_t xdr_keybuf(XDR *, keybuf); #elif __STDC__ extern bool_t xdr_keybuf(XDR *, keybuf); #else /* Old Style C */ bool_t xdr_keybuf(); #endif /* Old Style C */ typedef char *netnamestr; #ifdef __cplusplus extern "C" bool_t xdr_netnamestr(XDR *, netnamestr*); #elif __STDC__ extern bool_t xdr_netnamestr(XDR *, netnamestr*); #else /* Old Style C */ bool_t xdr_netnamestr(); #endif /* Old Style C */ struct cryptkeyarg { netnamestr remotename; des_block deskey; }; typedef struct cryptkeyarg cryptkeyarg; #ifdef __cplusplus extern "C" bool_t xdr_cryptkeyarg(XDR *, cryptkeyarg*); #elif __STDC__ extern bool_t xdr_cryptkeyarg(XDR *, cryptkeyarg*); #else /* Old Style C */ bool_t xdr_cryptkeyarg(); #endif /* Old Style C */ struct cryptkeyarg2 { netnamestr remotename; netobj remotekey; des_block deskey; }; typedef struct cryptkeyarg2 cryptkeyarg2; #ifdef __cplusplus extern "C" bool_t xdr_cryptkeyarg2(XDR *, cryptkeyarg2*); #elif __STDC__ extern bool_t xdr_cryptkeyarg2(XDR *, cryptkeyarg2*); #else /* Old Style C */ bool_t xdr_cryptkeyarg2(); #endif /* Old Style C */ struct cryptkeyres { keystatus status; union { des_block deskey; } cryptkeyres_u; }; typedef struct cryptkeyres cryptkeyres; #ifdef __cplusplus extern "C" bool_t xdr_cryptkeyres(XDR *, cryptkeyres*); #elif __STDC__ extern bool_t xdr_cryptkeyres(XDR *, cryptkeyres*); #else /* Old Style C */ bool_t xdr_cryptkeyres(); #endif /* Old Style C */ #define MAXGIDS 16 struct unixcred { u_int uid; u_int gid; struct { u_int gids_len; u_int *gids_val; } gids; }; typedef struct unixcred unixcred; #ifdef __cplusplus extern "C" bool_t xdr_unixcred(XDR *, unixcred*); #elif __STDC__ extern bool_t xdr_unixcred(XDR *, unixcred*); #else /* Old Style C */ bool_t xdr_unixcred(); #endif /* Old Style C */ struct getcredres { keystatus status; union { unixcred cred; } getcredres_u; }; typedef struct getcredres getcredres; #ifdef __cplusplus extern "C" bool_t xdr_getcredres(XDR *, getcredres*); #elif __STDC__ extern bool_t xdr_getcredres(XDR *, getcredres*); #else /* Old Style C */ bool_t xdr_getcredres(); #endif /* Old Style C */ struct key_netstarg { keybuf st_priv_key; keybuf st_pub_key; netnamestr st_netname; }; typedef struct key_netstarg key_netstarg; #ifdef __cplusplus extern "C" bool_t xdr_key_netstarg(XDR *, key_netstarg*); #elif __STDC__ extern bool_t xdr_key_netstarg(XDR *, key_netstarg*); #else /* Old Style C */ bool_t xdr_key_netstarg(); #endif /* Old Style C */ struct key_netstres { keystatus status; union { key_netstarg knet; } key_netstres_u; }; typedef struct key_netstres key_netstres; #ifdef __cplusplus extern "C" bool_t xdr_key_netstres(XDR *, key_netstres*); #elif __STDC__ extern bool_t xdr_key_netstres(XDR *, key_netstres*); #else /* Old Style C */ bool_t xdr_key_netstres(); #endif /* Old Style C */ #ifndef opaque #define opaque char #endif #define KEY_PROG ((u_long)100029) #define KEY_VERS ((u_long)1) #ifdef __cplusplus #define KEY_SET ((u_long)1) extern "C" keystatus * key_set_1(opaque *, CLIENT *); extern "C" keystatus * key_set_1_svc(opaque *, struct svc_req *); #define KEY_ENCRYPT ((u_long)2) extern "C" cryptkeyres * key_encrypt_1(cryptkeyarg *, CLIENT *); extern "C" cryptkeyres * key_encrypt_1_svc(cryptkeyarg *, struct svc_req *); #define KEY_DECRYPT ((u_long)3) extern "C" cryptkeyres * key_decrypt_1(cryptkeyarg *, CLIENT *); extern "C" cryptkeyres * key_decrypt_1_svc(cryptkeyarg *, struct svc_req *); #define KEY_GEN ((u_long)4) extern "C" des_block * key_gen_1(void *, CLIENT *); extern "C" des_block * key_gen_1_svc(void *, struct svc_req *); #define KEY_GETCRED ((u_long)5) extern "C" getcredres * key_getcred_1(netnamestr *, CLIENT *); extern "C" getcredres * key_getcred_1_svc(netnamestr *, struct svc_req *); #elif __STDC__ #define KEY_SET ((u_long)1) extern keystatus * key_set_1(opaque *, CLIENT *); extern keystatus * key_set_1_svc(opaque *, struct svc_req *); #define KEY_ENCRYPT ((u_long)2) extern cryptkeyres * key_encrypt_1(cryptkeyarg *, CLIENT *); extern cryptkeyres * key_encrypt_1_svc(cryptkeyarg *, struct svc_req *); #define KEY_DECRYPT ((u_long)3) extern cryptkeyres * key_decrypt_1(cryptkeyarg *, CLIENT *); extern cryptkeyres * key_decrypt_1_svc(cryptkeyarg *, struct svc_req *); #define KEY_GEN ((u_long)4) extern des_block * key_gen_1(void *, CLIENT *); extern des_block * key_gen_1_svc(void *, struct svc_req *); #define KEY_GETCRED ((u_long)5) extern getcredres * key_getcred_1(netnamestr *, CLIENT *); extern getcredres * key_getcred_1_svc(netnamestr *, struct svc_req *); #else /* Old Style C */ #define KEY_SET ((u_long)1) extern keystatus * key_set_1(); extern keystatus * key_set_1_svc(); #define KEY_ENCRYPT ((u_long)2) extern cryptkeyres * key_encrypt_1(); extern cryptkeyres * key_encrypt_1_svc(); #define KEY_DECRYPT ((u_long)3) extern cryptkeyres * key_decrypt_1(); extern cryptkeyres * key_decrypt_1_svc(); #define KEY_GEN ((u_long)4) extern des_block * key_gen_1(); extern des_block * key_gen_1_svc(); #define KEY_GETCRED ((u_long)5) extern getcredres * key_getcred_1(); extern getcredres * key_getcred_1_svc(); #endif /* Old Style C */ #define KEY_VERS2 ((u_long)2) #ifdef __cplusplus extern "C" keystatus * key_set_2(opaque *, CLIENT *); extern "C" keystatus * key_set_2_svc(opaque *, struct svc_req *); extern "C" cryptkeyres * key_encrypt_2(cryptkeyarg *, CLIENT *); extern "C" cryptkeyres * key_encrypt_2_svc(cryptkeyarg *, struct svc_req *); extern "C" cryptkeyres * key_decrypt_2(cryptkeyarg *, CLIENT *); extern "C" cryptkeyres * key_decrypt_2_svc(cryptkeyarg *, struct svc_req *); extern "C" des_block * key_gen_2(void *, CLIENT *); extern "C" des_block * key_gen_2_svc(void *, struct svc_req *); extern "C" getcredres * key_getcred_2(netnamestr *, CLIENT *); extern "C" getcredres * key_getcred_2_svc(netnamestr *, struct svc_req *); #define KEY_ENCRYPT_PK ((u_long)6) extern "C" cryptkeyres * key_encrypt_pk_2(cryptkeyarg2 *, CLIENT *); extern "C" cryptkeyres * key_encrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *); #define KEY_DECRYPT_PK ((u_long)7) extern "C" cryptkeyres * key_decrypt_pk_2(cryptkeyarg2 *, CLIENT *); extern "C" cryptkeyres * key_decrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *); #define KEY_NET_PUT ((u_long)8) extern "C" keystatus * key_net_put_2(key_netstarg *, CLIENT *); extern "C" keystatus * key_net_put_2_svc(key_netstarg *, struct svc_req *); #define KEY_NET_GET ((u_long)9) extern "C" key_netstres * key_net_get_2(void *, CLIENT *); extern "C" key_netstres * key_net_get_2_svc(void *, struct svc_req *); #define KEY_GET_CONV ((u_long)10) extern "C" cryptkeyres * key_get_conv_2(opaque *, CLIENT *); extern "C" cryptkeyres * key_get_conv_2_svc(opaque *, struct svc_req *); #elif __STDC__ extern keystatus * key_set_2(opaque *, CLIENT *); extern keystatus * key_set_2_svc(opaque *, struct svc_req *); extern cryptkeyres * key_encrypt_2(cryptkeyarg *, CLIENT *); extern cryptkeyres * key_encrypt_2_svc(cryptkeyarg *, struct svc_req *); extern cryptkeyres * key_decrypt_2(cryptkeyarg *, CLIENT *); extern cryptkeyres * key_decrypt_2_svc(cryptkeyarg *, struct svc_req *); extern des_block * key_gen_2(void *, CLIENT *); extern des_block * key_gen_2_svc(void *, struct svc_req *); extern getcredres * key_getcred_2(netnamestr *, CLIENT *); extern getcredres * key_getcred_2_svc(netnamestr *, struct svc_req *); #define KEY_ENCRYPT_PK ((u_long)6) extern cryptkeyres * key_encrypt_pk_2(cryptkeyarg2 *, CLIENT *); extern cryptkeyres * key_encrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *); #define KEY_DECRYPT_PK ((u_long)7) extern cryptkeyres * key_decrypt_pk_2(cryptkeyarg2 *, CLIENT *); extern cryptkeyres * key_decrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *); #define KEY_NET_PUT ((u_long)8) extern keystatus * key_net_put_2(key_netstarg *, CLIENT *); extern keystatus * key_net_put_2_svc(key_netstarg *, struct svc_req *); #define KEY_NET_GET ((u_long)9) extern key_netstres * key_net_get_2(void *, CLIENT *); extern key_netstres * key_net_get_2_svc(void *, struct svc_req *); #define KEY_GET_CONV ((u_long)10) extern cryptkeyres * key_get_conv_2(opaque *, CLIENT *); extern cryptkeyres * key_get_conv_2_svc(opaque *, struct svc_req *); #else /* Old Style C */ extern keystatus * key_set_2(); extern keystatus * key_set_2_svc(); extern cryptkeyres * key_encrypt_2(); extern cryptkeyres * key_encrypt_2_svc(); extern cryptkeyres * key_decrypt_2(); extern cryptkeyres * key_decrypt_2_svc(); extern des_block * key_gen_2(); extern des_block * key_gen_2_svc(); extern getcredres * key_getcred_2(); extern getcredres * key_getcred_2_svc(); #define KEY_ENCRYPT_PK ((u_long)6) extern cryptkeyres * key_encrypt_pk_2(); extern cryptkeyres * key_encrypt_pk_2_svc(); #define KEY_DECRYPT_PK ((u_long)7) extern cryptkeyres * key_decrypt_pk_2(); extern cryptkeyres * key_decrypt_pk_2_svc(); #define KEY_NET_PUT ((u_long)8) extern keystatus * key_net_put_2(); extern keystatus * key_net_put_2_svc(); #define KEY_NET_GET ((u_long)9) extern key_netstres * key_net_get_2(); extern key_netstres * key_net_get_2_svc(); #define KEY_GET_CONV ((u_long)10) extern cryptkeyres * key_get_conv_2(); extern cryptkeyres * key_get_conv_2_svc(); #endif /* Old Style C */ #endif /* !_KEY_PROT_H_RPCGEN */ ��������������������rpc/clnt.h������������������������������������������������������������������������������������������0000644�����������������00000030372�14763166026�0006461 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * clnt.h - Client side remote procedure call interface. * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RPC_CLNT_H #define _RPC_CLNT_H 1 #include <features.h> #include <sys/types.h> #include <rpc/types.h> #include <rpc/auth.h> #include <sys/un.h> __BEGIN_DECLS /* * Rpc calls return an enum clnt_stat. This should be looked at more, * since each implementation is required to live with this (implementation * independent) list of errors. */ enum clnt_stat { RPC_SUCCESS=0, /* call succeeded */ /* * local errors */ RPC_CANTENCODEARGS=1, /* can't encode arguments */ RPC_CANTDECODERES=2, /* can't decode results */ RPC_CANTSEND=3, /* failure in sending call */ RPC_CANTRECV=4, /* failure in receiving result */ RPC_TIMEDOUT=5, /* call timed out */ /* * remote errors */ RPC_VERSMISMATCH=6, /* rpc versions not compatible */ RPC_AUTHERROR=7, /* authentication error */ RPC_PROGUNAVAIL=8, /* program not available */ RPC_PROGVERSMISMATCH=9, /* program version mismatched */ RPC_PROCUNAVAIL=10, /* procedure unavailable */ RPC_CANTDECODEARGS=11, /* decode arguments error */ RPC_SYSTEMERROR=12, /* generic "other problem" */ RPC_NOBROADCAST = 21, /* Broadcasting not supported */ /* * callrpc & clnt_create errors */ RPC_UNKNOWNHOST=13, /* unknown host name */ RPC_UNKNOWNPROTO=17, /* unknown protocol */ RPC_UNKNOWNADDR = 19, /* Remote address unknown */ /* * rpcbind errors */ RPC_RPCBFAILURE=14, /* portmapper failed in its call */ #define RPC_PMAPFAILURE RPC_RPCBFAILURE RPC_PROGNOTREGISTERED=15, /* remote program is not registered */ RPC_N2AXLATEFAILURE = 22, /* Name to addr translation failed */ /* * unspecified error */ RPC_FAILED=16, RPC_INTR=18, RPC_TLIERROR=20, RPC_UDERROR=23, /* * asynchronous errors */ RPC_INPROGRESS = 24, RPC_STALERACHANDLE = 25 }; /* * Error info. */ struct rpc_err { enum clnt_stat re_status; union { int RE_errno; /* related system error */ enum auth_stat RE_why; /* why the auth error occurred */ struct { u_long low; /* lowest verion supported */ u_long high; /* highest verion supported */ } RE_vers; struct { /* maybe meaningful if RPC_FAILED */ long s1; long s2; } RE_lb; /* life boot & debugging only */ } ru; #define re_errno ru.RE_errno #define re_why ru.RE_why #define re_vers ru.RE_vers #define re_lb ru.RE_lb }; /* * Client rpc handle. * Created by individual implementations, see e.g. rpc_udp.c. * Client is responsible for initializing auth, see e.g. auth_none.c. */ typedef struct CLIENT CLIENT; struct CLIENT { AUTH *cl_auth; /* authenticator */ struct clnt_ops { enum clnt_stat (*cl_call) (CLIENT *, u_long, xdrproc_t, caddr_t, xdrproc_t, caddr_t, struct timeval); /* call remote procedure */ void (*cl_abort) (void); /* abort a call */ void (*cl_geterr) (CLIENT *, struct rpc_err *); /* get specific error code */ bool_t (*cl_freeres) (CLIENT *, xdrproc_t, caddr_t); /* frees results */ void (*cl_destroy) (CLIENT *); /* destroy this structure */ bool_t (*cl_control) (CLIENT *, int, char *); /* the ioctl() of rpc */ } *cl_ops; caddr_t cl_private; /* private stuff */ }; /* * client side rpc interface ops * * Parameter types are: * */ /* * enum clnt_stat * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout) * CLIENT *rh; * u_long proc; * xdrproc_t xargs; * caddr_t argsp; * xdrproc_t xres; * caddr_t resp; * struct timeval timeout; */ #define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \ ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) #define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \ ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) /* * void * CLNT_ABORT(rh); * CLIENT *rh; */ #define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh)) #define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) /* * struct rpc_err * CLNT_GETERR(rh); * CLIENT *rh; */ #define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) #define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) /* * bool_t * CLNT_FREERES(rh, xres, resp); * CLIENT *rh; * xdrproc_t xres; * caddr_t resp; */ #define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) #define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) /* * bool_t * CLNT_CONTROL(cl, request, info) * CLIENT *cl; * u_int request; * char *info; */ #define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) #define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) /* * control operations that apply to all transports * * Note: options marked XXX are no-ops in this implementation of RPC. * The are present in TI-RPC but can't be implemented here since they * depend on the presence of STREAMS/TLI, which we don't have. */ #define CLSET_TIMEOUT 1 /* set timeout (timeval) */ #define CLGET_TIMEOUT 2 /* get timeout (timeval) */ #define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */ #define CLGET_FD 6 /* get connections file descriptor */ #define CLGET_SVC_ADDR 7 /* get server's address (netbuf) XXX */ #define CLSET_FD_CLOSE 8 /* close fd while clnt_destroy */ #define CLSET_FD_NCLOSE 9 /* Do not close fd while clnt_destroy*/ #define CLGET_XID 10 /* Get xid */ #define CLSET_XID 11 /* Set xid */ #define CLGET_VERS 12 /* Get version number */ #define CLSET_VERS 13 /* Set version number */ #define CLGET_PROG 14 /* Get program number */ #define CLSET_PROG 15 /* Set program number */ #define CLSET_SVC_ADDR 16 /* get server's address (netbuf) XXX */ #define CLSET_PUSH_TIMOD 17 /* push timod if not already present XXX */ #define CLSET_POP_TIMOD 18 /* pop timod XXX */ /* * Connectionless only control operations */ #define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */ #define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ /* * void * CLNT_DESTROY(rh); * CLIENT *rh; */ #define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) #define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) /* * RPCTEST is a test program which is accessible on every rpc * transport/port. It is used for testing, performance evaluation, * and network administration. */ #define RPCTEST_PROGRAM ((u_long)1) #define RPCTEST_VERSION ((u_long)1) #define RPCTEST_NULL_PROC ((u_long)2) #define RPCTEST_NULL_BATCH_PROC ((u_long)3) /* * By convention, procedure 0 takes null arguments and returns them */ #define NULLPROC ((u_long)0) /* * Below are the client handle creation routines for the various * implementations of client side rpc. They can return NULL if a * creation failure occurs. */ /* * Memory based rpc (for speed check and testing) * CLIENT * * clntraw_create(prog, vers) * u_long prog; * u_long vers; */ extern CLIENT *clntraw_create (const u_long __prog, const u_long __vers) __THROW; /* * Generic client creation routine. Supported protocols are "udp", "tcp" and * "unix" * CLIENT * * clnt_create(host, prog, vers, prot) * char *host; -- hostname * u_long prog; -- program number * u_ong vers; -- version number * char *prot; -- protocol */ extern CLIENT *clnt_create (const char *__host, const u_long __prog, const u_long __vers, const char *__prot) __THROW; /* * TCP based rpc * CLIENT * * clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) * struct sockaddr_in *raddr; * u_long prog; * u_long version; * register int *sockp; * u_int sendsz; * u_int recvsz; */ extern CLIENT *clnttcp_create (struct sockaddr_in *__raddr, u_long __prog, u_long __version, int *__sockp, u_int __sendsz, u_int __recvsz) __THROW; /* * UDP based rpc. * CLIENT * * clntudp_create(raddr, program, version, wait, sockp) * struct sockaddr_in *raddr; * u_long program; * u_long version; * struct timeval wait_resend; * int *sockp; * * Same as above, but you specify max packet sizes. * CLIENT * * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz) * struct sockaddr_in *raddr; * u_long program; * u_long version; * struct timeval wait_resend; * int *sockp; * u_int sendsz; * u_int recvsz; */ extern CLIENT *clntudp_create (struct sockaddr_in *__raddr, u_long __program, u_long __version, struct timeval __wait_resend, int *__sockp) __THROW; extern CLIENT *clntudp_bufcreate (struct sockaddr_in *__raddr, u_long __program, u_long __version, struct timeval __wait_resend, int *__sockp, u_int __sendsz, u_int __recvsz) __THROW; /* * AF_UNIX based rpc * CLIENT * * clntunix_create(raddr, prog, vers, sockp, sendsz, recvsz) * struct sockaddr_un *raddr; * u_long prog; * u_long version; * register int *sockp; * u_int sendsz; * u_int recvsz; */ extern CLIENT *clntunix_create (struct sockaddr_un *__raddr, u_long __program, u_long __version, int *__sockp, u_int __sendsz, u_int __recvsz) __THROW; extern int callrpc (const char *__host, const u_long __prognum, const u_long __versnum, const u_long __procnum, const xdrproc_t __inproc, const char *__in, const xdrproc_t __outproc, char *__out) __THROW; extern int _rpc_dtablesize (void) __THROW; /* * Print why creation failed */ extern void clnt_pcreateerror (const char *__msg); /* stderr */ extern char *clnt_spcreateerror(const char *__msg) __THROW; /* string */ /* * Like clnt_perror(), but is more verbose in its output */ extern void clnt_perrno (enum clnt_stat __num); /* stderr */ /* * Print an English error message, given the client error code */ extern void clnt_perror (CLIENT *__clnt, const char *__msg); /* stderr */ extern char *clnt_sperror (CLIENT *__clnt, const char *__msg) __THROW; /* string */ /* * If a creation fails, the following allows the user to figure out why. */ struct rpc_createerr { enum clnt_stat cf_stat; struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */ }; extern struct rpc_createerr rpc_createerr; /* * Copy error message to buffer. */ extern char *clnt_sperrno (enum clnt_stat __num) __THROW; /* string */ /* * get the port number on the host for the rpc program,version and proto */ extern int getrpcport (const char * __host, u_long __prognum, u_long __versnum, u_int __proto) __THROW; /* * get the local host's IP address without consulting * name service library functions */ extern void get_myaddress (struct sockaddr_in *) __THROW; #define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */ #define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ __END_DECLS #endif /* rpc/clnt.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpc/auth_des.h��������������������������������������������������������������������������������������0000644�����������������00000006772�14763166026�0007324 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996, 1997, 1998, 1999, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _RPC_AUTH_DES_H #define _RPC_AUTH_DES_H 1 #include <sys/cdefs.h> #include <rpc/auth.h> __BEGIN_DECLS /* There are two kinds of "names": fullnames and nicknames */ enum authdes_namekind { ADN_FULLNAME, ADN_NICKNAME }; /* A fullname contains the network name of the client, a conversation key and the window */ struct authdes_fullname { char *name; /* network name of client, up to MAXNETNAMELEN */ des_block key; /* conversation key */ uint32_t window; /* associated window */ }; /* A credential */ struct authdes_cred { enum authdes_namekind adc_namekind; struct authdes_fullname adc_fullname; uint32_t adc_nickname; }; /* A timeval replacement for !32bit platforms */ struct rpc_timeval { uint32_t tv_sec; /* Seconds. */ uint32_t tv_usec; /* Microseconds. */ }; /* A des authentication verifier */ struct authdes_verf { union { struct rpc_timeval adv_ctime; /* clear time */ des_block adv_xtime; /* crypt time */ } adv_time_u; uint32_t adv_int_u; }; /* des authentication verifier: client variety adv_timestamp is the current time. adv_winverf is the credential window + 1. Both are encrypted using the conversation key. */ #define adv_timestamp adv_time_u.adv_ctime #define adv_xtimestamp adv_time_u.adv_xtime #define adv_winverf adv_int_u /* des authentication verifier: server variety adv_timeverf is the client's timestamp + client's window adv_nickname is the server's nickname for the client. adv_timeverf is encrypted using the conversation key. */ #define adv_timeverf adv_time_u.adv_ctime #define adv_xtimeverf adv_time_u.adv_xtime #define adv_nickname adv_int_u /* Map a des credential into a unix cred. */ extern int authdes_getucred (const struct authdes_cred * __adc, uid_t * __uid, gid_t * __gid, short *__grouplen, gid_t * __groups) __THROW; /* Get the public key for NAME and place it in KEY. NAME can only be up to MAXNETNAMELEN bytes long and the destination buffer KEY should have HEXKEYBYTES + 1 bytes long to fit all characters from the key. */ extern int getpublickey (const char *__name, char *__key) __THROW; /* Get the secret key for NAME and place it in KEY. PASSWD is used to decrypt the encrypted key stored in the database. NAME can only be up to MAXNETNAMELEN bytes long and the destination buffer KEY should have HEXKEYBYTES + 1 bytes long to fit all characters from the key. */ extern int getsecretkey (const char *__name, char *__key, const char *__passwd) __THROW; extern int rtime (struct sockaddr_in *__addrp, struct rpc_timeval *__timep, struct rpc_timeval *__timeout) __THROW; __END_DECLS #endif /* rpc/auth_des.h */ ������rpc/pmap_clnt.h�������������������������������������������������������������������������������������0000644�����������������00000007375�14763166026�0007505 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * pmap_clnt.h * Supplies C routines to get to portmap services. * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RPC_PMAP_CLNT_H #define _RPC_PMAP_CLNT_H 1 #include <features.h> #include <rpc/types.h> #include <rpc/xdr.h> #include <rpc/clnt.h> __BEGIN_DECLS typedef bool_t (*resultproc_t) (caddr_t __resp, struct sockaddr_in *__raddr); /* * Usage: * success = pmap_set(program, version, protocol, port); * success = pmap_unset(program, version); * port = pmap_getport(address, program, version, protocol); * head = pmap_getmaps(address); * clnt_stat = pmap_rmtcall(address, program, version, procedure, * xdrargs, argsp, xdrres, resp, tout, port_ptr) * (works for udp only.) * clnt_stat = clnt_broadcast(program, version, procedure, * xdrargs, argsp, xdrres, resp, eachresult) * (like pmap_rmtcall, except the call is broadcasted to all * locally connected nets. For each valid response received, * the procedure eachresult is called. Its form is: * done = eachresult(resp, raddr) * bool_t done; * caddr_t resp; * struct sockaddr_in raddr; * where resp points to the results of the call and raddr is the * address if the responder to the broadcast. */ extern bool_t pmap_set (const u_long __program, const u_long __vers, int __protocol, u_short __port) __THROW; extern bool_t pmap_unset (const u_long __program, const u_long __vers) __THROW; extern struct pmaplist *pmap_getmaps (struct sockaddr_in *__address) __THROW; extern enum clnt_stat pmap_rmtcall (struct sockaddr_in *__addr, const u_long __prog, const u_long __vers, const u_long __proc, xdrproc_t __xdrargs, caddr_t __argsp, xdrproc_t __xdrres, caddr_t __resp, struct timeval __tout, u_long *__port_ptr) __THROW; extern enum clnt_stat clnt_broadcast (const u_long __prog, const u_long __vers, const u_long __proc, xdrproc_t __xargs, caddr_t __argsp, xdrproc_t __xresults, caddr_t __resultsp, resultproc_t __eachresult) __THROW; extern u_short pmap_getport (struct sockaddr_in *__address, const u_long __program, const u_long __version, u_int __protocol) __THROW; __END_DECLS #endif /* rpc/pmap_clnt.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpc/netdb.h�����������������������������������������������������������������������������������������0000644�����������������00000005521�14763166026�0006613 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)netdb.h 2.1 88/07/29 3.9 RPCSRC */ /* * Copyright (c) 2010, Oracle America, Inc. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* Cleaned up for GNU C library roland@gnu.ai.mit.edu: added multiple inclusion protection and use of <sys/cdefs.h>. In GNU this file is #include'd by <netdb.h>. */ #ifndef _RPC_NETDB_H #define _RPC_NETDB_H 1 #include <features.h> #define __need_size_t #include <stddef.h> __BEGIN_DECLS struct rpcent { char *r_name; /* Name of server for this rpc program. */ char **r_aliases; /* Alias list. */ int r_number; /* RPC program number. */ }; extern void setrpcent (int __stayopen) __THROW; extern void endrpcent (void) __THROW; extern struct rpcent *getrpcbyname (const char *__name) __THROW; extern struct rpcent *getrpcbynumber (int __number) __THROW; extern struct rpcent *getrpcent (void) __THROW; #ifdef __USE_MISC extern int getrpcbyname_r (const char *__name, struct rpcent *__result_buf, char *__buffer, size_t __buflen, struct rpcent **__result) __THROW; extern int getrpcbynumber_r (int __number, struct rpcent *__result_buf, char *__buffer, size_t __buflen, struct rpcent **__result) __THROW; extern int getrpcent_r (struct rpcent *__result_buf, char *__buffer, size_t __buflen, struct rpcent **__result) __THROW; #endif __END_DECLS #endif /* rpc/netdb.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpc/des_crypt.h�������������������������������������������������������������������������������������0000644�����������������00000006467�14763166026�0007525 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * @(#)des_crypt.h 2.1 88/08/11 4.0 RPCSRC * * des_crypt.h, des library routine interface * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef __DES_CRYPT_H__ #define __DES_CRYPT_H__ 1 #include <features.h> __BEGIN_DECLS #define DES_MAXDATA 8192 /* max bytes encrypted in one call */ #define DES_DIRMASK (1 << 0) #define DES_ENCRYPT (0*DES_DIRMASK) /* Encrypt */ #define DES_DECRYPT (1*DES_DIRMASK) /* Decrypt */ #define DES_DEVMASK (1 << 1) #define DES_HW (0*DES_DEVMASK) /* Use hardware device */ #define DES_SW (1*DES_DEVMASK) /* Use software device */ #define DESERR_NONE 0 /* succeeded */ #define DESERR_NOHWDEVICE 1 /* succeeded, but hw device not available */ #define DESERR_HWERROR 2 /* failed, hardware/driver error */ #define DESERR_BADPARAM 3 /* failed, bad parameter to call */ #define DES_FAILED(err) \ ((err) > DESERR_NOHWDEVICE) /* * cbc_crypt() * ecb_crypt() * * Encrypt (or decrypt) len bytes of a buffer buf. * The length must be a multiple of eight. * The key should have odd parity in the low bit of each byte. * ivec is the input vector, and is updated to the new one (cbc only). * The mode is created by oring together the appropriate parameters. * DESERR_NOHWDEVICE is returned if DES_HW was specified but * there was no hardware to do it on (the data will still be * encrypted though, in software). */ /* * Cipher Block Chaining mode */ extern int cbc_crypt (char *__key, char *__buf, unsigned __len, unsigned __mode, char *__ivec) __THROW; /* * Electronic Code Book mode */ extern int ecb_crypt (char *__key, char *__buf, unsigned __len, unsigned __mode) __THROW; /* * Set des parity for a key. * DES parity is odd and in the low bit of each byte */ extern void des_setparity (char *__key) __THROW; __END_DECLS #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rpc/svc.h�������������������������������������������������������������������������������������������0000644�����������������00000026377�14763166026�0006326 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * svc.h, Server-side remote procedure call interface. * * Copyright (C) 2012 Free Software Foundation, Inc. * This file is part of the GNU C Library. * * The GNU C Library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * The GNU C Library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with the GNU C Library; if not, see * <http://www.gnu.org/licenses/>. * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RPC_SVC_H #define _RPC_SVC_H 1 #include <features.h> #include <rpc/rpc_msg.h> __BEGIN_DECLS /* * This interface must manage two items concerning remote procedure calling: * * 1) An arbitrary number of transport connections upon which rpc requests * are received. The two most notable transports are TCP and UDP; they are * created and registered by routines in svc_tcp.c and svc_udp.c, respectively; * they in turn call xprt_register and xprt_unregister. * * 2) An arbitrary number of locally registered services. Services are * described by the following four data: program number, version number, * "service dispatch" function, a transport handle, and a boolean that * indicates whether or not the exported program should be registered with a * local binder service; if true the program's number and version and the * port number from the transport handle are registered with the binder. * These data are registered with the rpc svc system via svc_register. * * A service's dispatch function is called whenever an rpc request comes in * on a transport. The request's program and version numbers must match * those of the registered service. The dispatch function is passed two * parameters, struct svc_req * and SVCXPRT *, defined below. */ enum xprt_stat { XPRT_DIED, XPRT_MOREREQS, XPRT_IDLE }; /* * Server side transport handle */ typedef struct SVCXPRT SVCXPRT; struct SVCXPRT { int xp_sock; u_short xp_port; /* associated port number */ const struct xp_ops { bool_t (*xp_recv) (SVCXPRT *__xprt, struct rpc_msg *__msg); /* receive incoming requests */ enum xprt_stat (*xp_stat) (SVCXPRT *__xprt); /* get transport status */ bool_t (*xp_getargs) (SVCXPRT *__xprt, xdrproc_t __xdr_args, caddr_t __args_ptr); /* get arguments */ bool_t (*xp_reply) (SVCXPRT *__xprt, struct rpc_msg *__msg); /* send reply */ bool_t (*xp_freeargs) (SVCXPRT *__xprt, xdrproc_t __xdr_args, caddr_t __args_ptr); /* free mem allocated for args */ void (*xp_destroy) (SVCXPRT *__xprt); /* destroy this struct */ } *xp_ops; int xp_addrlen; /* length of remote address */ struct sockaddr_in xp_raddr; /* remote address */ struct opaque_auth xp_verf; /* raw response verifier */ caddr_t xp_p1; /* private */ caddr_t xp_p2; /* private */ char xp_pad [256]; /* padding, internal use */ }; /* * Approved way of getting address of caller */ #define svc_getcaller(x) (&(x)->xp_raddr) /* * Operations defined on an SVCXPRT handle * * SVCXPRT *xprt; * struct rpc_msg *msg; * xdrproc_t xargs; * caddr_t argsp; */ #define SVC_RECV(xprt, msg) \ (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) #define svc_recv(xprt, msg) \ (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) #define SVC_STAT(xprt) \ (*(xprt)->xp_ops->xp_stat)(xprt) #define svc_stat(xprt) \ (*(xprt)->xp_ops->xp_stat)(xprt) #define SVC_GETARGS(xprt, xargs, argsp) \ (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) #define svc_getargs(xprt, xargs, argsp) \ (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) #define SVC_REPLY(xprt, msg) \ (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) #define svc_reply(xprt, msg) \ (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) #define SVC_FREEARGS(xprt, xargs, argsp) \ (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) #define svc_freeargs(xprt, xargs, argsp) \ (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) #define SVC_DESTROY(xprt) \ (*(xprt)->xp_ops->xp_destroy)(xprt) #define svc_destroy(xprt) \ (*(xprt)->xp_ops->xp_destroy)(xprt) /* * Service request */ struct svc_req { rpcprog_t rq_prog; /* service program number */ rpcvers_t rq_vers; /* service protocol version */ rpcproc_t rq_proc; /* the desired procedure */ struct opaque_auth rq_cred; /* raw creds from the wire */ caddr_t rq_clntcred; /* read only cooked cred */ SVCXPRT *rq_xprt; /* associated transport */ }; #ifndef __DISPATCH_FN_T #define __DISPATCH_FN_T typedef void (*__dispatch_fn_t) (struct svc_req*, SVCXPRT*); #endif /* * Service registration * * svc_register(xprt, prog, vers, dispatch, protocol) * SVCXPRT *xprt; * rpcprog_t prog; * rpcvers_t vers; * void (*dispatch)(struct svc_req*, SVCXPRT*); * rpcprot_t protocol; like TCP or UDP, zero means do not register */ extern bool_t svc_register (SVCXPRT *__xprt, rpcprog_t __prog, rpcvers_t __vers, __dispatch_fn_t __dispatch, rpcprot_t __protocol) __THROW; /* * Service un-registration * * svc_unregister(prog, vers) * rpcprog_t prog; * rpcvers_t vers; */ extern void svc_unregister (rpcprog_t __prog, rpcvers_t __vers) __THROW; /* * Transport registration. * * xprt_register(xprt) * SVCXPRT *xprt; */ extern void xprt_register (SVCXPRT *__xprt) __THROW; /* * Transport un-register * * xprt_unregister(xprt) * SVCXPRT *xprt; */ extern void xprt_unregister (SVCXPRT *__xprt) __THROW; /* * When the service routine is called, it must first check to see if it * knows about the procedure; if not, it should call svcerr_noproc * and return. If so, it should deserialize its arguments via * SVC_GETARGS (defined above). If the deserialization does not work, * svcerr_decode should be called followed by a return. Successful * decoding of the arguments should be followed the execution of the * procedure's code and a call to svc_sendreply. * * Also, if the service refuses to execute the procedure due to too- * weak authentication parameters, svcerr_weakauth should be called. * Note: do not confuse access-control failure with weak authentication! * * NB: In pure implementations of rpc, the caller always waits for a reply * msg. This message is sent when svc_sendreply is called. * Therefore pure service implementations should always call * svc_sendreply even if the function logically returns void; use * xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows * for the abuse of pure rpc via batched calling or pipelining. In the * case of a batched call, svc_sendreply should NOT be called since * this would send a return message, which is what batching tries to avoid. * It is the service/protocol writer's responsibility to know which calls are * batched and which are not. Warning: responding to batch calls may * deadlock the caller and server processes! */ extern bool_t svc_sendreply (SVCXPRT *__xprt, xdrproc_t __xdr_results, caddr_t __xdr_location) __THROW; extern void svcerr_decode (SVCXPRT *__xprt) __THROW; extern void svcerr_weakauth (SVCXPRT *__xprt) __THROW; extern void svcerr_noproc (SVCXPRT *__xprt) __THROW; extern void svcerr_progvers (SVCXPRT *__xprt, rpcvers_t __low_vers, rpcvers_t __high_vers) __THROW; extern void svcerr_auth (SVCXPRT *__xprt, enum auth_stat __why) __THROW; extern void svcerr_noprog (SVCXPRT *__xprt) __THROW; extern void svcerr_systemerr (SVCXPRT *__xprt) __THROW; /* * Lowest level dispatching -OR- who owns this process anyway. * Somebody has to wait for incoming requests and then call the correct * service routine. The routine svc_run does infinite waiting; i.e., * svc_run never returns. * Since another (coexistent) package may wish to selectively wait for * incoming calls or other events outside of the rpc architecture, the * routine svc_getreq is provided. It must be passed readfds, the * "in-place" results of a select system call (see select, section 2). */ /* * Global keeper of rpc service descriptors in use * dynamic; must be inspected before each call to select */ extern struct pollfd *svc_pollfd; extern int svc_max_pollfd; extern fd_set svc_fdset; #define svc_fds svc_fdset.fds_bits[0] /* compatibility */ /* * a small program implemented by the svc_rpc implementation itself; * also see clnt.h for protocol numbers. */ extern void svc_getreq (int __rdfds) __THROW; extern void svc_getreq_common (const int __fd) __THROW; extern void svc_getreqset (fd_set *__readfds) __THROW; extern void svc_getreq_poll (struct pollfd *, const int) __THROW; extern void svc_exit (void) __THROW; extern void svc_run (void) __THROW; /* * Socket to use on svcxxx_create call to get default socket */ #define RPC_ANYSOCK -1 /* * These are the existing service side transport implementations */ /* * Memory based rpc for testing and timing. */ extern SVCXPRT *svcraw_create (void) __THROW; /* * Udp based rpc. */ extern SVCXPRT *svcudp_create (int __sock) __THROW; extern SVCXPRT *svcudp_bufcreate (int __sock, u_int __sendsz, u_int __recvsz) __THROW; /* * Tcp based rpc. */ extern SVCXPRT *svctcp_create (int __sock, u_int __sendsize, u_int __recvsize) __THROW; /* * FD based rpc. */ extern SVCXPRT *svcfd_create (int __sock, u_int __sendsize, u_int __recvsize) __THROW; /* * Unix based rpc. */ extern SVCXPRT *svcunix_create (int __sock, u_int __sendsize, u_int __recvsize, char *__path) __THROW; __END_DECLS #endif /* rpc/svc.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/xevie.h�����������������������������������������������������������������������������������������0000644�����������������00000026511�14763166026�0006631 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from xevie.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_Xevie_API XCB Xevie API * @brief Xevie XCB Protocol Implementation. * @{ **/ #ifndef __XEVIE_H #define __XEVIE_H #include "xcb.h" #ifdef __cplusplus extern "C" { #endif #define XCB_XEVIE_MAJOR_VERSION 1 #define XCB_XEVIE_MINOR_VERSION 0 extern xcb_extension_t xcb_xevie_id; /** * @brief xcb_xevie_query_version_cookie_t **/ typedef struct xcb_xevie_query_version_cookie_t { unsigned int sequence; } xcb_xevie_query_version_cookie_t; /** Opcode for xcb_xevie_query_version. */ #define XCB_XEVIE_QUERY_VERSION 0 /** * @brief xcb_xevie_query_version_request_t **/ typedef struct xcb_xevie_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint16_t client_major_version; uint16_t client_minor_version; } xcb_xevie_query_version_request_t; /** * @brief xcb_xevie_query_version_reply_t **/ typedef struct xcb_xevie_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t server_major_version; uint16_t server_minor_version; uint8_t pad1[20]; } xcb_xevie_query_version_reply_t; /** * @brief xcb_xevie_start_cookie_t **/ typedef struct xcb_xevie_start_cookie_t { unsigned int sequence; } xcb_xevie_start_cookie_t; /** Opcode for xcb_xevie_start. */ #define XCB_XEVIE_START 1 /** * @brief xcb_xevie_start_request_t **/ typedef struct xcb_xevie_start_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; } xcb_xevie_start_request_t; /** * @brief xcb_xevie_start_reply_t **/ typedef struct xcb_xevie_start_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[24]; } xcb_xevie_start_reply_t; /** * @brief xcb_xevie_end_cookie_t **/ typedef struct xcb_xevie_end_cookie_t { unsigned int sequence; } xcb_xevie_end_cookie_t; /** Opcode for xcb_xevie_end. */ #define XCB_XEVIE_END 2 /** * @brief xcb_xevie_end_request_t **/ typedef struct xcb_xevie_end_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t cmap; } xcb_xevie_end_request_t; /** * @brief xcb_xevie_end_reply_t **/ typedef struct xcb_xevie_end_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[24]; } xcb_xevie_end_reply_t; typedef enum xcb_xevie_datatype_t { XCB_XEVIE_DATATYPE_UNMODIFIED = 0, XCB_XEVIE_DATATYPE_MODIFIED = 1 } xcb_xevie_datatype_t; /** * @brief xcb_xevie_event_t **/ typedef struct xcb_xevie_event_t { uint8_t pad0[32]; } xcb_xevie_event_t; /** * @brief xcb_xevie_event_iterator_t **/ typedef struct xcb_xevie_event_iterator_t { xcb_xevie_event_t *data; int rem; int index; } xcb_xevie_event_iterator_t; /** * @brief xcb_xevie_send_cookie_t **/ typedef struct xcb_xevie_send_cookie_t { unsigned int sequence; } xcb_xevie_send_cookie_t; /** Opcode for xcb_xevie_send. */ #define XCB_XEVIE_SEND 3 /** * @brief xcb_xevie_send_request_t **/ typedef struct xcb_xevie_send_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xevie_event_t event; uint32_t data_type; uint8_t pad0[64]; } xcb_xevie_send_request_t; /** * @brief xcb_xevie_send_reply_t **/ typedef struct xcb_xevie_send_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[24]; } xcb_xevie_send_reply_t; /** * @brief xcb_xevie_select_input_cookie_t **/ typedef struct xcb_xevie_select_input_cookie_t { unsigned int sequence; } xcb_xevie_select_input_cookie_t; /** Opcode for xcb_xevie_select_input. */ #define XCB_XEVIE_SELECT_INPUT 4 /** * @brief xcb_xevie_select_input_request_t **/ typedef struct xcb_xevie_select_input_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t event_mask; } xcb_xevie_select_input_request_t; /** * @brief xcb_xevie_select_input_reply_t **/ typedef struct xcb_xevie_select_input_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[24]; } xcb_xevie_select_input_reply_t; /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xevie_query_version_cookie_t xcb_xevie_query_version (xcb_connection_t *c, uint16_t client_major_version, uint16_t client_minor_version); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xevie_query_version_cookie_t xcb_xevie_query_version_unchecked (xcb_connection_t *c, uint16_t client_major_version, uint16_t client_minor_version); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xevie_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xevie_query_version_reply_t * xcb_xevie_query_version_reply (xcb_connection_t *c, xcb_xevie_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xevie_start_cookie_t xcb_xevie_start (xcb_connection_t *c, uint32_t screen); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xevie_start_cookie_t xcb_xevie_start_unchecked (xcb_connection_t *c, uint32_t screen); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xevie_start_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xevie_start_reply_t * xcb_xevie_start_reply (xcb_connection_t *c, xcb_xevie_start_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xevie_end_cookie_t xcb_xevie_end (xcb_connection_t *c, uint32_t cmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xevie_end_cookie_t xcb_xevie_end_unchecked (xcb_connection_t *c, uint32_t cmap); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xevie_end_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xevie_end_reply_t * xcb_xevie_end_reply (xcb_connection_t *c, xcb_xevie_end_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * Get the next element of the iterator * @param i Pointer to a xcb_xevie_event_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xevie_event_t) */ void xcb_xevie_event_next (xcb_xevie_event_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xevie_event_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xevie_event_end (xcb_xevie_event_iterator_t i); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xevie_send_cookie_t xcb_xevie_send (xcb_connection_t *c, xcb_xevie_event_t event, uint32_t data_type); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xevie_send_cookie_t xcb_xevie_send_unchecked (xcb_connection_t *c, xcb_xevie_event_t event, uint32_t data_type); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xevie_send_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xevie_send_reply_t * xcb_xevie_send_reply (xcb_connection_t *c, xcb_xevie_send_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xevie_select_input_cookie_t xcb_xevie_select_input (xcb_connection_t *c, uint32_t event_mask); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xevie_select_input_cookie_t xcb_xevie_select_input_unchecked (xcb_connection_t *c, uint32_t event_mask); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xevie_select_input_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xevie_select_input_reply_t * xcb_xevie_select_input_reply (xcb_connection_t *c, xcb_xevie_select_input_cookie_t cookie /**< */, xcb_generic_error_t **e); #ifdef __cplusplus } #endif #endif /** * @} */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/bigreq.h����������������������������������������������������������������������������������������0000644�����������������00000004547�14763166026�0006767 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from bigreq.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_BigRequests_API XCB BigRequests API * @brief BigRequests XCB Protocol Implementation. * @{ **/ #ifndef __BIGREQ_H #define __BIGREQ_H #include "xcb.h" #ifdef __cplusplus extern "C" { #endif #define XCB_BIGREQUESTS_MAJOR_VERSION 0 #define XCB_BIGREQUESTS_MINOR_VERSION 0 extern xcb_extension_t xcb_big_requests_id; /** * @brief xcb_big_requests_enable_cookie_t **/ typedef struct xcb_big_requests_enable_cookie_t { unsigned int sequence; } xcb_big_requests_enable_cookie_t; /** Opcode for xcb_big_requests_enable. */ #define XCB_BIG_REQUESTS_ENABLE 0 /** * @brief xcb_big_requests_enable_request_t **/ typedef struct xcb_big_requests_enable_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_big_requests_enable_request_t; /** * @brief xcb_big_requests_enable_reply_t **/ typedef struct xcb_big_requests_enable_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t maximum_request_length; } xcb_big_requests_enable_reply_t; /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_big_requests_enable_cookie_t xcb_big_requests_enable (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_big_requests_enable_cookie_t xcb_big_requests_enable_unchecked (xcb_connection_t *c); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_big_requests_enable_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_big_requests_enable_reply_t * xcb_big_requests_enable_reply (xcb_connection_t *c, xcb_big_requests_enable_cookie_t cookie /**< */, xcb_generic_error_t **e); #ifdef __cplusplus } #endif #endif /** * @} */ ���������������������������������������������������������������������������������������������������������������������������������������������������������xcb/xinerama.h��������������������������������������������������������������������������������������0000644�����������������00000035153�14763166026�0007317 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from xinerama.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_Xinerama_API XCB Xinerama API * @brief Xinerama XCB Protocol Implementation. * @{ **/ #ifndef __XINERAMA_H #define __XINERAMA_H #include "xcb.h" #include "xproto.h" #ifdef __cplusplus extern "C" { #endif #define XCB_XINERAMA_MAJOR_VERSION 1 #define XCB_XINERAMA_MINOR_VERSION 1 extern xcb_extension_t xcb_xinerama_id; /** * @brief xcb_xinerama_screen_info_t **/ typedef struct xcb_xinerama_screen_info_t { int16_t x_org; int16_t y_org; uint16_t width; uint16_t height; } xcb_xinerama_screen_info_t; /** * @brief xcb_xinerama_screen_info_iterator_t **/ typedef struct xcb_xinerama_screen_info_iterator_t { xcb_xinerama_screen_info_t *data; int rem; int index; } xcb_xinerama_screen_info_iterator_t; /** * @brief xcb_xinerama_query_version_cookie_t **/ typedef struct xcb_xinerama_query_version_cookie_t { unsigned int sequence; } xcb_xinerama_query_version_cookie_t; /** Opcode for xcb_xinerama_query_version. */ #define XCB_XINERAMA_QUERY_VERSION 0 /** * @brief xcb_xinerama_query_version_request_t **/ typedef struct xcb_xinerama_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t major; uint8_t minor; } xcb_xinerama_query_version_request_t; /** * @brief xcb_xinerama_query_version_reply_t **/ typedef struct xcb_xinerama_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t major; uint16_t minor; } xcb_xinerama_query_version_reply_t; /** * @brief xcb_xinerama_get_state_cookie_t **/ typedef struct xcb_xinerama_get_state_cookie_t { unsigned int sequence; } xcb_xinerama_get_state_cookie_t; /** Opcode for xcb_xinerama_get_state. */ #define XCB_XINERAMA_GET_STATE 1 /** * @brief xcb_xinerama_get_state_request_t **/ typedef struct xcb_xinerama_get_state_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_xinerama_get_state_request_t; /** * @brief xcb_xinerama_get_state_reply_t **/ typedef struct xcb_xinerama_get_state_reply_t { uint8_t response_type; uint8_t state; uint16_t sequence; uint32_t length; xcb_window_t window; } xcb_xinerama_get_state_reply_t; /** * @brief xcb_xinerama_get_screen_count_cookie_t **/ typedef struct xcb_xinerama_get_screen_count_cookie_t { unsigned int sequence; } xcb_xinerama_get_screen_count_cookie_t; /** Opcode for xcb_xinerama_get_screen_count. */ #define XCB_XINERAMA_GET_SCREEN_COUNT 2 /** * @brief xcb_xinerama_get_screen_count_request_t **/ typedef struct xcb_xinerama_get_screen_count_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_xinerama_get_screen_count_request_t; /** * @brief xcb_xinerama_get_screen_count_reply_t **/ typedef struct xcb_xinerama_get_screen_count_reply_t { uint8_t response_type; uint8_t screen_count; uint16_t sequence; uint32_t length; xcb_window_t window; } xcb_xinerama_get_screen_count_reply_t; /** * @brief xcb_xinerama_get_screen_size_cookie_t **/ typedef struct xcb_xinerama_get_screen_size_cookie_t { unsigned int sequence; } xcb_xinerama_get_screen_size_cookie_t; /** Opcode for xcb_xinerama_get_screen_size. */ #define XCB_XINERAMA_GET_SCREEN_SIZE 3 /** * @brief xcb_xinerama_get_screen_size_request_t **/ typedef struct xcb_xinerama_get_screen_size_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; uint32_t screen; } xcb_xinerama_get_screen_size_request_t; /** * @brief xcb_xinerama_get_screen_size_reply_t **/ typedef struct xcb_xinerama_get_screen_size_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t width; uint32_t height; xcb_window_t window; uint32_t screen; } xcb_xinerama_get_screen_size_reply_t; /** * @brief xcb_xinerama_is_active_cookie_t **/ typedef struct xcb_xinerama_is_active_cookie_t { unsigned int sequence; } xcb_xinerama_is_active_cookie_t; /** Opcode for xcb_xinerama_is_active. */ #define XCB_XINERAMA_IS_ACTIVE 4 /** * @brief xcb_xinerama_is_active_request_t **/ typedef struct xcb_xinerama_is_active_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_xinerama_is_active_request_t; /** * @brief xcb_xinerama_is_active_reply_t **/ typedef struct xcb_xinerama_is_active_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t state; } xcb_xinerama_is_active_reply_t; /** * @brief xcb_xinerama_query_screens_cookie_t **/ typedef struct xcb_xinerama_query_screens_cookie_t { unsigned int sequence; } xcb_xinerama_query_screens_cookie_t; /** Opcode for xcb_xinerama_query_screens. */ #define XCB_XINERAMA_QUERY_SCREENS 5 /** * @brief xcb_xinerama_query_screens_request_t **/ typedef struct xcb_xinerama_query_screens_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_xinerama_query_screens_request_t; /** * @brief xcb_xinerama_query_screens_reply_t **/ typedef struct xcb_xinerama_query_screens_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t number; uint8_t pad1[20]; } xcb_xinerama_query_screens_reply_t; /** * Get the next element of the iterator * @param i Pointer to a xcb_xinerama_screen_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xinerama_screen_info_t) */ void xcb_xinerama_screen_info_next (xcb_xinerama_screen_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xinerama_screen_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xinerama_screen_info_end (xcb_xinerama_screen_info_iterator_t i); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xinerama_query_version_cookie_t xcb_xinerama_query_version (xcb_connection_t *c, uint8_t major, uint8_t minor); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xinerama_query_version_cookie_t xcb_xinerama_query_version_unchecked (xcb_connection_t *c, uint8_t major, uint8_t minor); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xinerama_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xinerama_query_version_reply_t * xcb_xinerama_query_version_reply (xcb_connection_t *c, xcb_xinerama_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xinerama_get_state_cookie_t xcb_xinerama_get_state (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xinerama_get_state_cookie_t xcb_xinerama_get_state_unchecked (xcb_connection_t *c, xcb_window_t window); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xinerama_get_state_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xinerama_get_state_reply_t * xcb_xinerama_get_state_reply (xcb_connection_t *c, xcb_xinerama_get_state_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xinerama_get_screen_count_cookie_t xcb_xinerama_get_screen_count (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xinerama_get_screen_count_cookie_t xcb_xinerama_get_screen_count_unchecked (xcb_connection_t *c, xcb_window_t window); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xinerama_get_screen_count_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xinerama_get_screen_count_reply_t * xcb_xinerama_get_screen_count_reply (xcb_connection_t *c, xcb_xinerama_get_screen_count_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xinerama_get_screen_size_cookie_t xcb_xinerama_get_screen_size (xcb_connection_t *c, xcb_window_t window, uint32_t screen); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xinerama_get_screen_size_cookie_t xcb_xinerama_get_screen_size_unchecked (xcb_connection_t *c, xcb_window_t window, uint32_t screen); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xinerama_get_screen_size_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xinerama_get_screen_size_reply_t * xcb_xinerama_get_screen_size_reply (xcb_connection_t *c, xcb_xinerama_get_screen_size_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xinerama_is_active_cookie_t xcb_xinerama_is_active (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xinerama_is_active_cookie_t xcb_xinerama_is_active_unchecked (xcb_connection_t *c); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xinerama_is_active_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xinerama_is_active_reply_t * xcb_xinerama_is_active_reply (xcb_connection_t *c, xcb_xinerama_is_active_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xinerama_query_screens_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xinerama_query_screens_cookie_t xcb_xinerama_query_screens (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xinerama_query_screens_cookie_t xcb_xinerama_query_screens_unchecked (xcb_connection_t *c); xcb_xinerama_screen_info_t * xcb_xinerama_query_screens_screen_info (const xcb_xinerama_query_screens_reply_t *R); int xcb_xinerama_query_screens_screen_info_length (const xcb_xinerama_query_screens_reply_t *R); xcb_xinerama_screen_info_iterator_t xcb_xinerama_query_screens_screen_info_iterator (const xcb_xinerama_query_screens_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xinerama_query_screens_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xinerama_query_screens_reply_t * xcb_xinerama_query_screens_reply (xcb_connection_t *c, xcb_xinerama_query_screens_cookie_t cookie /**< */, xcb_generic_error_t **e); #ifdef __cplusplus } #endif #endif /** * @} */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/xcbext.h����������������������������������������������������������������������������������������0000644�����������������00000033246�14763166026�0007011 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 2001-2004 Bart Massey and Jamey Sharp. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the names of the authors or their * institutions shall not be used in advertising or otherwise to promote the * sale, use or other dealings in this Software without prior written * authorization from the authors. */ #ifndef __XCBEXT_H #define __XCBEXT_H #include "xcb.h" #ifdef __cplusplus extern "C" { #endif /* xcb_ext.c */ struct xcb_extension_t { const char *name; int global_id; }; /* xcb_out.c */ typedef struct { size_t count; xcb_extension_t *ext; uint8_t opcode; uint8_t isvoid; } xcb_protocol_request_t; enum xcb_send_request_flags_t { XCB_REQUEST_CHECKED = 1 << 0, XCB_REQUEST_RAW = 1 << 1, XCB_REQUEST_DISCARD_REPLY = 1 << 2, XCB_REQUEST_REPLY_FDS = 1 << 3 }; /** * @brief Send a request to the server. * @param c The connection to the X server. * @param flags A combination of flags from the xcb_send_request_flags_t enumeration. * @param vector Data to send; must have two iovecs before start for internal use. * @param request Information about the request to be sent. * @return The request's sequence number on success, 0 otherwise. * * This function sends a new request to the X server. The data of the request is * given as an array of @c iovecs in the @p vector argument. The length of that * array and the necessary management information are given in the @p request * argument. * * When this function returns, the request might or might not be sent already. * Use xcb_flush() to make sure that it really was sent. * * Please note that this function is not the preferred way for sending requests. * It's better to use the generated wrapper functions. * * Please note that xcb might use index -1 and -2 of the @p vector array internally, * so they must be valid! */ unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *request); /** * @brief Send a request to the server. * @param c The connection to the X server. * @param flags A combination of flags from the xcb_send_request_flags_t enumeration. * @param vector Data to send; must have two iovecs before start for internal use. * @param request Information about the request to be sent. * @param num_fds Number of additional file descriptors to send to the server * @param fds Additional file descriptors that should be send to the server. * @return The request's sequence number on success, 0 otherwise. * * This function sends a new request to the X server. The data of the request is * given as an array of @c iovecs in the @p vector argument. The length of that * array and the necessary management information are given in the @p request * argument. * * If @p num_fds is non-zero, @p fds points to an array of file descriptors that * will be sent to the X server along with this request. After this function * returns, all file descriptors sent are owned by xcb and will be closed * eventually. * * When this function returns, the request might or might not be sent already. * Use xcb_flush() to make sure that it really was sent. * * Please note that this function is not the preferred way for sending requests. * * Please note that xcb might use index -1 and -2 of the @p vector array internally, * so they must be valid! */ unsigned int xcb_send_request_with_fds(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *request, unsigned int num_fds, int *fds); /** * @brief Send a request to the server, with 64-bit sequence number returned. * @param c The connection to the X server. * @param flags A combination of flags from the xcb_send_request_flags_t enumeration. * @param vector Data to send; must have two iovecs before start for internal use. * @param request Information about the request to be sent. * @return The request's sequence number on success, 0 otherwise. * * This function sends a new request to the X server. The data of the request is * given as an array of @c iovecs in the @p vector argument. The length of that * array and the necessary management information are given in the @p request * argument. * * When this function returns, the request might or might not be sent already. * Use xcb_flush() to make sure that it really was sent. * * Please note that this function is not the preferred way for sending requests. * It's better to use the generated wrapper functions. * * Please note that xcb might use index -1 and -2 of the @p vector array internally, * so they must be valid! */ uint64_t xcb_send_request64(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *request); /** * @brief Send a request to the server, with 64-bit sequence number returned. * @param c The connection to the X server. * @param flags A combination of flags from the xcb_send_request_flags_t enumeration. * @param vector Data to send; must have two iovecs before start for internal use. * @param request Information about the request to be sent. * @param num_fds Number of additional file descriptors to send to the server * @param fds Additional file descriptors that should be send to the server. * @return The request's sequence number on success, 0 otherwise. * * This function sends a new request to the X server. The data of the request is * given as an array of @c iovecs in the @p vector argument. The length of that * array and the necessary management information are given in the @p request * argument. * * If @p num_fds is non-zero, @p fds points to an array of file descriptors that * will be sent to the X server along with this request. After this function * returns, all file descriptors sent are owned by xcb and will be closed * eventually. * * When this function returns, the request might or might not be sent already. * Use xcb_flush() to make sure that it really was sent. * * Please note that this function is not the preferred way for sending requests. * It's better to use the generated wrapper functions. * * Please note that xcb might use index -1 and -2 of the @p vector array internally, * so they must be valid! */ uint64_t xcb_send_request_with_fds64(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *request, unsigned int num_fds, int *fds); /** * @brief Send a file descriptor to the server in the next call to xcb_send_request. * @param c The connection to the X server. * @param fd The file descriptor to send. * * After this function returns, the file descriptor given is owned by xcb and * will be closed eventually. * * @deprecated This function cannot be used in a thread-safe way. Two threads * that run xcb_send_fd(); xcb_send_request(); could mix up their file * descriptors. Instead, xcb_send_request_with_fds() should be used. */ void xcb_send_fd(xcb_connection_t *c, int fd); /** * @brief Take over the write side of the socket * @param c The connection to the X server. * @param return_socket Callback function that will be called when xcb wants * to use the socket again. * @param closure Argument to the callback function. * @param flags A combination of flags from the xcb_send_request_flags_t enumeration. * @param sent Location to the sequence number of the last sequence request. * Must not be NULL. * @return 1 on success, else 0. * * xcb_take_socket allows external code to ask XCB for permission to * take over the write side of the socket and send raw data with * xcb_writev. xcb_take_socket provides the sequence number of the last * request XCB sent. The caller of xcb_take_socket must supply a * callback which XCB can call when it wants the write side of the * socket back to make a request. This callback synchronizes with the * external socket owner and flushes any output queues if appropriate. * If you are sending requests which won't cause a reply, please note the * comment for xcb_writev which explains some sequence number wrap issues. * * All replies that are generated while the socket is owned externally have * @p flags applied to them. For example, use XCB_REQUEST_CHECK if you don't * want errors to go to xcb's normal error handling, but instead having to be * picked up via xcb_wait_for_reply(), xcb_poll_for_reply() or * xcb_request_check(). */ int xcb_take_socket(xcb_connection_t *c, void (*return_socket)(void *closure), void *closure, int flags, uint64_t *sent); /** * @brief Send raw data to the X server. * @param c The connection to the X server. * @param vector Array of data to be sent. * @param count Number of entries in @p vector. * @param requests Number of requests that are being sent. * @return 1 on success, else 0. * * You must own the write-side of the socket (you've called * xcb_take_socket, and haven't returned from return_socket yet) to call * xcb_writev. Also, the iovec must have at least 1 byte of data in it. * You have to make sure that xcb can detect sequence number wraps correctly. * This means that the first request you send after xcb_take_socket must cause a * reply (e.g. just insert a GetInputFocus request). After every (1 << 16) - 1 * requests without a reply, you have to insert a request which will cause a * reply. You can again use GetInputFocus for this. You do not have to wait for * any of the GetInputFocus replies, but can instead handle them via * xcb_discard_reply(). */ int xcb_writev(xcb_connection_t *c, struct iovec *vector, int count, uint64_t requests); /* xcb_in.c */ /** * @brief Wait for the reply of a given request. * @param c The connection to the X server. * @param request Sequence number of the request as returned by xcb_send_request(). * @param e Location to store errors in, or NULL. Ignored for unchecked requests. * * Returns the reply to the given request or returns null in the event of * errors. Blocks until the reply or error for the request arrives, or an I/O * error occurs. */ void *xcb_wait_for_reply(xcb_connection_t *c, unsigned int request, xcb_generic_error_t **e); /** * @brief Wait for the reply of a given request, with 64-bit sequence number * @param c The connection to the X server. * @param request 64-bit sequence number of the request as returned by xcb_send_request64(). * @param e Location to store errors in, or NULL. Ignored for unchecked requests. * * Returns the reply to the given request or returns null in the event of * errors. Blocks until the reply or error for the request arrives, or an I/O * error occurs. * * Unlike its xcb_wait_for_reply() counterpart, the given sequence number is not * automatically "widened" to 64-bit. */ void *xcb_wait_for_reply64(xcb_connection_t *c, uint64_t request, xcb_generic_error_t **e); /** * @brief Poll for the reply of a given request. * @param c The connection to the X server. * @param request Sequence number of the request as returned by xcb_send_request(). * @param reply Location to store the reply in, must not be NULL. * @param error Location to store errors in, or NULL. Ignored for unchecked requests. * @return 1 when the reply to the request was returned, else 0. * * Checks if the reply to the given request already received. Does not block. */ int xcb_poll_for_reply(xcb_connection_t *c, unsigned int request, void **reply, xcb_generic_error_t **error); /** * @brief Poll for the reply of a given request, with 64-bit sequence number. * @param c The connection to the X server. * @param request 64-bit sequence number of the request as returned by xcb_send_request(). * @param reply Location to store the reply in, must not be NULL. * @param error Location to store errors in, or NULL. Ignored for unchecked requests. * @return 1 when the reply to the request was returned, else 0. * * Checks if the reply to the given request already received. Does not block. * * Unlike its xcb_poll_for_reply() counterpart, the given sequence number is not * automatically "widened" to 64-bit. */ int xcb_poll_for_reply64(xcb_connection_t *c, uint64_t request, void **reply, xcb_generic_error_t **error); /** * @brief Don't use this, only needed by the generated code. * @param c The connection to the X server. * @param reply A reply that was received from the server * @param replylen The size of the reply. * @return Pointer to the location where received file descriptors are stored. */ int *xcb_get_reply_fds(xcb_connection_t *c, void *reply, size_t replylen); /* xcb_util.c */ /** * @param mask The mask to check * @return The number of set bits in the mask */ int xcb_popcount(uint32_t mask); /** * @param list The base of an array * @param len The length of the array * @return The sum of all entries in the array. */ int xcb_sumof(uint8_t *list, int len); #ifdef __cplusplus } #endif #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/xkb.h�������������������������������������������������������������������������������������������0000644�����������������00000741260�14763166026�0006302 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from xkb.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_xkb_API XCB xkb API * @brief xkb XCB Protocol Implementation. * @{ **/ #ifndef __XKB_H #define __XKB_H #include "xcb.h" #include "xproto.h" #ifdef __cplusplus extern "C" { #endif #define XCB_XKB_MAJOR_VERSION 1 #define XCB_XKB_MINOR_VERSION 0 extern xcb_extension_t xcb_xkb_id; typedef enum xcb_xkb_const_t { XCB_XKB_CONST_MAX_LEGAL_KEY_CODE = 255, XCB_XKB_CONST_PER_KEY_BIT_ARRAY_SIZE = 32, XCB_XKB_CONST_KEY_NAME_LENGTH = 4 } xcb_xkb_const_t; typedef enum xcb_xkb_event_type_t { XCB_XKB_EVENT_TYPE_NEW_KEYBOARD_NOTIFY = 1, XCB_XKB_EVENT_TYPE_MAP_NOTIFY = 2, XCB_XKB_EVENT_TYPE_STATE_NOTIFY = 4, XCB_XKB_EVENT_TYPE_CONTROLS_NOTIFY = 8, XCB_XKB_EVENT_TYPE_INDICATOR_STATE_NOTIFY = 16, XCB_XKB_EVENT_TYPE_INDICATOR_MAP_NOTIFY = 32, XCB_XKB_EVENT_TYPE_NAMES_NOTIFY = 64, XCB_XKB_EVENT_TYPE_COMPAT_MAP_NOTIFY = 128, XCB_XKB_EVENT_TYPE_BELL_NOTIFY = 256, XCB_XKB_EVENT_TYPE_ACTION_MESSAGE = 512, XCB_XKB_EVENT_TYPE_ACCESS_X_NOTIFY = 1024, XCB_XKB_EVENT_TYPE_EXTENSION_DEVICE_NOTIFY = 2048 } xcb_xkb_event_type_t; typedef enum xcb_xkb_nkn_detail_t { XCB_XKB_NKN_DETAIL_KEYCODES = 1, XCB_XKB_NKN_DETAIL_GEOMETRY = 2, XCB_XKB_NKN_DETAIL_DEVICE_ID = 4 } xcb_xkb_nkn_detail_t; typedef enum xcb_xkb_axn_detail_t { XCB_XKB_AXN_DETAIL_SK_PRESS = 1, XCB_XKB_AXN_DETAIL_SK_ACCEPT = 2, XCB_XKB_AXN_DETAIL_SK_REJECT = 4, XCB_XKB_AXN_DETAIL_SK_RELEASE = 8, XCB_XKB_AXN_DETAIL_BK_ACCEPT = 16, XCB_XKB_AXN_DETAIL_BK_REJECT = 32, XCB_XKB_AXN_DETAIL_AXK_WARNING = 64 } xcb_xkb_axn_detail_t; typedef enum xcb_xkb_map_part_t { XCB_XKB_MAP_PART_KEY_TYPES = 1, XCB_XKB_MAP_PART_KEY_SYMS = 2, XCB_XKB_MAP_PART_MODIFIER_MAP = 4, XCB_XKB_MAP_PART_EXPLICIT_COMPONENTS = 8, XCB_XKB_MAP_PART_KEY_ACTIONS = 16, XCB_XKB_MAP_PART_KEY_BEHAVIORS = 32, XCB_XKB_MAP_PART_VIRTUAL_MODS = 64, XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP = 128 } xcb_xkb_map_part_t; typedef enum xcb_xkb_set_map_flags_t { XCB_XKB_SET_MAP_FLAGS_RESIZE_TYPES = 1, XCB_XKB_SET_MAP_FLAGS_RECOMPUTE_ACTIONS = 2 } xcb_xkb_set_map_flags_t; typedef enum xcb_xkb_state_part_t { XCB_XKB_STATE_PART_MODIFIER_STATE = 1, XCB_XKB_STATE_PART_MODIFIER_BASE = 2, XCB_XKB_STATE_PART_MODIFIER_LATCH = 4, XCB_XKB_STATE_PART_MODIFIER_LOCK = 8, XCB_XKB_STATE_PART_GROUP_STATE = 16, XCB_XKB_STATE_PART_GROUP_BASE = 32, XCB_XKB_STATE_PART_GROUP_LATCH = 64, XCB_XKB_STATE_PART_GROUP_LOCK = 128, XCB_XKB_STATE_PART_COMPAT_STATE = 256, XCB_XKB_STATE_PART_GRAB_MODS = 512, XCB_XKB_STATE_PART_COMPAT_GRAB_MODS = 1024, XCB_XKB_STATE_PART_LOOKUP_MODS = 2048, XCB_XKB_STATE_PART_COMPAT_LOOKUP_MODS = 4096, XCB_XKB_STATE_PART_POINTER_BUTTONS = 8192 } xcb_xkb_state_part_t; typedef enum xcb_xkb_bool_ctrl_t { XCB_XKB_BOOL_CTRL_REPEAT_KEYS = 1, XCB_XKB_BOOL_CTRL_SLOW_KEYS = 2, XCB_XKB_BOOL_CTRL_BOUNCE_KEYS = 4, XCB_XKB_BOOL_CTRL_STICKY_KEYS = 8, XCB_XKB_BOOL_CTRL_MOUSE_KEYS = 16, XCB_XKB_BOOL_CTRL_MOUSE_KEYS_ACCEL = 32, XCB_XKB_BOOL_CTRL_ACCESS_X_KEYS = 64, XCB_XKB_BOOL_CTRL_ACCESS_X_TIMEOUT_MASK = 128, XCB_XKB_BOOL_CTRL_ACCESS_X_FEEDBACK_MASK = 256, XCB_XKB_BOOL_CTRL_AUDIBLE_BELL_MASK = 512, XCB_XKB_BOOL_CTRL_OVERLAY_1_MASK = 1024, XCB_XKB_BOOL_CTRL_OVERLAY_2_MASK = 2048, XCB_XKB_BOOL_CTRL_IGNORE_GROUP_LOCK_MASK = 4096 } xcb_xkb_bool_ctrl_t; typedef enum xcb_xkb_control_t { XCB_XKB_CONTROL_GROUPS_WRAP = 134217728, XCB_XKB_CONTROL_INTERNAL_MODS = 268435456, XCB_XKB_CONTROL_IGNORE_LOCK_MODS = 536870912, XCB_XKB_CONTROL_PER_KEY_REPEAT = 1073741824, XCB_XKB_CONTROL_CONTROLS_ENABLED = 2147483648 } xcb_xkb_control_t; typedef enum xcb_xkb_ax_option_t { XCB_XKB_AX_OPTION_SK_PRESS_FB = 1, XCB_XKB_AX_OPTION_SK_ACCEPT_FB = 2, XCB_XKB_AX_OPTION_FEATURE_FB = 4, XCB_XKB_AX_OPTION_SLOW_WARN_FB = 8, XCB_XKB_AX_OPTION_INDICATOR_FB = 16, XCB_XKB_AX_OPTION_STICKY_KEYS_FB = 32, XCB_XKB_AX_OPTION_TWO_KEYS = 64, XCB_XKB_AX_OPTION_LATCH_TO_LOCK = 128, XCB_XKB_AX_OPTION_SK_RELEASE_FB = 256, XCB_XKB_AX_OPTION_SK_REJECT_FB = 512, XCB_XKB_AX_OPTION_BK_REJECT_FB = 1024, XCB_XKB_AX_OPTION_DUMB_BELL = 2048 } xcb_xkb_ax_option_t; typedef uint16_t xcb_xkb_device_spec_t; /** * @brief xcb_xkb_device_spec_iterator_t **/ typedef struct xcb_xkb_device_spec_iterator_t { xcb_xkb_device_spec_t *data; int rem; int index; } xcb_xkb_device_spec_iterator_t; typedef enum xcb_xkb_led_class_result_t { XCB_XKB_LED_CLASS_RESULT_KBD_FEEDBACK_CLASS = 0, XCB_XKB_LED_CLASS_RESULT_LED_FEEDBACK_CLASS = 4 } xcb_xkb_led_class_result_t; typedef enum xcb_xkb_led_class_t { XCB_XKB_LED_CLASS_KBD_FEEDBACK_CLASS = 0, XCB_XKB_LED_CLASS_LED_FEEDBACK_CLASS = 4, XCB_XKB_LED_CLASS_DFLT_XI_CLASS = 768, XCB_XKB_LED_CLASS_ALL_XI_CLASSES = 1280 } xcb_xkb_led_class_t; typedef uint16_t xcb_xkb_led_class_spec_t; /** * @brief xcb_xkb_led_class_spec_iterator_t **/ typedef struct xcb_xkb_led_class_spec_iterator_t { xcb_xkb_led_class_spec_t *data; int rem; int index; } xcb_xkb_led_class_spec_iterator_t; typedef enum xcb_xkb_bell_class_result_t { XCB_XKB_BELL_CLASS_RESULT_KBD_FEEDBACK_CLASS = 0, XCB_XKB_BELL_CLASS_RESULT_BELL_FEEDBACK_CLASS = 5 } xcb_xkb_bell_class_result_t; typedef enum xcb_xkb_bell_class_t { XCB_XKB_BELL_CLASS_KBD_FEEDBACK_CLASS = 0, XCB_XKB_BELL_CLASS_BELL_FEEDBACK_CLASS = 5, XCB_XKB_BELL_CLASS_DFLT_XI_CLASS = 768 } xcb_xkb_bell_class_t; typedef uint16_t xcb_xkb_bell_class_spec_t; /** * @brief xcb_xkb_bell_class_spec_iterator_t **/ typedef struct xcb_xkb_bell_class_spec_iterator_t { xcb_xkb_bell_class_spec_t *data; int rem; int index; } xcb_xkb_bell_class_spec_iterator_t; typedef enum xcb_xkb_id_t { XCB_XKB_ID_USE_CORE_KBD = 256, XCB_XKB_ID_USE_CORE_PTR = 512, XCB_XKB_ID_DFLT_XI_CLASS = 768, XCB_XKB_ID_DFLT_XI_ID = 1024, XCB_XKB_ID_ALL_XI_CLASS = 1280, XCB_XKB_ID_ALL_XI_ID = 1536, XCB_XKB_ID_XI_NONE = 65280 } xcb_xkb_id_t; typedef uint16_t xcb_xkb_id_spec_t; /** * @brief xcb_xkb_id_spec_iterator_t **/ typedef struct xcb_xkb_id_spec_iterator_t { xcb_xkb_id_spec_t *data; int rem; int index; } xcb_xkb_id_spec_iterator_t; typedef enum xcb_xkb_group_t { XCB_XKB_GROUP_1 = 0, XCB_XKB_GROUP_2 = 1, XCB_XKB_GROUP_3 = 2, XCB_XKB_GROUP_4 = 3 } xcb_xkb_group_t; typedef enum xcb_xkb_groups_t { XCB_XKB_GROUPS_ANY = 254, XCB_XKB_GROUPS_ALL = 255 } xcb_xkb_groups_t; typedef enum xcb_xkb_set_of_group_t { XCB_XKB_SET_OF_GROUP_GROUP_1 = 1, XCB_XKB_SET_OF_GROUP_GROUP_2 = 2, XCB_XKB_SET_OF_GROUP_GROUP_3 = 4, XCB_XKB_SET_OF_GROUP_GROUP_4 = 8 } xcb_xkb_set_of_group_t; typedef enum xcb_xkb_set_of_groups_t { XCB_XKB_SET_OF_GROUPS_ANY = 128 } xcb_xkb_set_of_groups_t; typedef enum xcb_xkb_groups_wrap_t { XCB_XKB_GROUPS_WRAP_WRAP_INTO_RANGE = 0, XCB_XKB_GROUPS_WRAP_CLAMP_INTO_RANGE = 64, XCB_XKB_GROUPS_WRAP_REDIRECT_INTO_RANGE = 128 } xcb_xkb_groups_wrap_t; typedef enum xcb_xkb_v_mods_high_t { XCB_XKB_V_MODS_HIGH_15 = 128, XCB_XKB_V_MODS_HIGH_14 = 64, XCB_XKB_V_MODS_HIGH_13 = 32, XCB_XKB_V_MODS_HIGH_12 = 16, XCB_XKB_V_MODS_HIGH_11 = 8, XCB_XKB_V_MODS_HIGH_10 = 4, XCB_XKB_V_MODS_HIGH_9 = 2, XCB_XKB_V_MODS_HIGH_8 = 1 } xcb_xkb_v_mods_high_t; typedef enum xcb_xkb_v_mods_low_t { XCB_XKB_V_MODS_LOW_7 = 128, XCB_XKB_V_MODS_LOW_6 = 64, XCB_XKB_V_MODS_LOW_5 = 32, XCB_XKB_V_MODS_LOW_4 = 16, XCB_XKB_V_MODS_LOW_3 = 8, XCB_XKB_V_MODS_LOW_2 = 4, XCB_XKB_V_MODS_LOW_1 = 2, XCB_XKB_V_MODS_LOW_0 = 1 } xcb_xkb_v_mods_low_t; typedef enum xcb_xkb_v_mod_t { XCB_XKB_V_MOD_15 = 32768, XCB_XKB_V_MOD_14 = 16384, XCB_XKB_V_MOD_13 = 8192, XCB_XKB_V_MOD_12 = 4096, XCB_XKB_V_MOD_11 = 2048, XCB_XKB_V_MOD_10 = 1024, XCB_XKB_V_MOD_9 = 512, XCB_XKB_V_MOD_8 = 256, XCB_XKB_V_MOD_7 = 128, XCB_XKB_V_MOD_6 = 64, XCB_XKB_V_MOD_5 = 32, XCB_XKB_V_MOD_4 = 16, XCB_XKB_V_MOD_3 = 8, XCB_XKB_V_MOD_2 = 4, XCB_XKB_V_MOD_1 = 2, XCB_XKB_V_MOD_0 = 1 } xcb_xkb_v_mod_t; typedef enum xcb_xkb_explicit_t { XCB_XKB_EXPLICIT_V_MOD_MAP = 128, XCB_XKB_EXPLICIT_BEHAVIOR = 64, XCB_XKB_EXPLICIT_AUTO_REPEAT = 32, XCB_XKB_EXPLICIT_INTERPRET = 16, XCB_XKB_EXPLICIT_KEY_TYPE_4 = 8, XCB_XKB_EXPLICIT_KEY_TYPE_3 = 4, XCB_XKB_EXPLICIT_KEY_TYPE_2 = 2, XCB_XKB_EXPLICIT_KEY_TYPE_1 = 1 } xcb_xkb_explicit_t; typedef enum xcb_xkb_sym_interpret_match_t { XCB_XKB_SYM_INTERPRET_MATCH_NONE_OF = 0, XCB_XKB_SYM_INTERPRET_MATCH_ANY_OF_OR_NONE = 1, XCB_XKB_SYM_INTERPRET_MATCH_ANY_OF = 2, XCB_XKB_SYM_INTERPRET_MATCH_ALL_OF = 3, XCB_XKB_SYM_INTERPRET_MATCH_EXACTLY = 4 } xcb_xkb_sym_interpret_match_t; typedef enum xcb_xkb_sym_interp_match_t { XCB_XKB_SYM_INTERP_MATCH_LEVEL_ONE_ONLY = 128, XCB_XKB_SYM_INTERP_MATCH_OP_MASK = 127 } xcb_xkb_sym_interp_match_t; typedef enum xcb_xkb_im_flag_t { XCB_XKB_IM_FLAG_NO_EXPLICIT = 128, XCB_XKB_IM_FLAG_NO_AUTOMATIC = 64, XCB_XKB_IM_FLAG_LED_DRIVES_KB = 32 } xcb_xkb_im_flag_t; typedef enum xcb_xkb_im_mods_which_t { XCB_XKB_IM_MODS_WHICH_USE_COMPAT = 16, XCB_XKB_IM_MODS_WHICH_USE_EFFECTIVE = 8, XCB_XKB_IM_MODS_WHICH_USE_LOCKED = 4, XCB_XKB_IM_MODS_WHICH_USE_LATCHED = 2, XCB_XKB_IM_MODS_WHICH_USE_BASE = 1 } xcb_xkb_im_mods_which_t; typedef enum xcb_xkb_im_groups_which_t { XCB_XKB_IM_GROUPS_WHICH_USE_COMPAT = 16, XCB_XKB_IM_GROUPS_WHICH_USE_EFFECTIVE = 8, XCB_XKB_IM_GROUPS_WHICH_USE_LOCKED = 4, XCB_XKB_IM_GROUPS_WHICH_USE_LATCHED = 2, XCB_XKB_IM_GROUPS_WHICH_USE_BASE = 1 } xcb_xkb_im_groups_which_t; /** * @brief xcb_xkb_indicator_map_t **/ typedef struct xcb_xkb_indicator_map_t { uint8_t flags; uint8_t whichGroups; uint8_t groups; uint8_t whichMods; uint8_t mods; uint8_t realMods; uint16_t vmods; uint32_t ctrls; } xcb_xkb_indicator_map_t; /** * @brief xcb_xkb_indicator_map_iterator_t **/ typedef struct xcb_xkb_indicator_map_iterator_t { xcb_xkb_indicator_map_t *data; int rem; int index; } xcb_xkb_indicator_map_iterator_t; typedef enum xcb_xkb_cm_detail_t { XCB_XKB_CM_DETAIL_SYM_INTERP = 1, XCB_XKB_CM_DETAIL_GROUP_COMPAT = 2 } xcb_xkb_cm_detail_t; typedef enum xcb_xkb_name_detail_t { XCB_XKB_NAME_DETAIL_KEYCODES = 1, XCB_XKB_NAME_DETAIL_GEOMETRY = 2, XCB_XKB_NAME_DETAIL_SYMBOLS = 4, XCB_XKB_NAME_DETAIL_PHYS_SYMBOLS = 8, XCB_XKB_NAME_DETAIL_TYPES = 16, XCB_XKB_NAME_DETAIL_COMPAT = 32, XCB_XKB_NAME_DETAIL_KEY_TYPE_NAMES = 64, XCB_XKB_NAME_DETAIL_KT_LEVEL_NAMES = 128, XCB_XKB_NAME_DETAIL_INDICATOR_NAMES = 256, XCB_XKB_NAME_DETAIL_KEY_NAMES = 512, XCB_XKB_NAME_DETAIL_KEY_ALIASES = 1024, XCB_XKB_NAME_DETAIL_VIRTUAL_MOD_NAMES = 2048, XCB_XKB_NAME_DETAIL_GROUP_NAMES = 4096, XCB_XKB_NAME_DETAIL_RG_NAMES = 8192 } xcb_xkb_name_detail_t; typedef enum xcb_xkb_gbn_detail_t { XCB_XKB_GBN_DETAIL_TYPES = 1, XCB_XKB_GBN_DETAIL_COMPAT_MAP = 2, XCB_XKB_GBN_DETAIL_CLIENT_SYMBOLS = 4, XCB_XKB_GBN_DETAIL_SERVER_SYMBOLS = 8, XCB_XKB_GBN_DETAIL_INDICATOR_MAPS = 16, XCB_XKB_GBN_DETAIL_KEY_NAMES = 32, XCB_XKB_GBN_DETAIL_GEOMETRY = 64, XCB_XKB_GBN_DETAIL_OTHER_NAMES = 128 } xcb_xkb_gbn_detail_t; typedef enum xcb_xkb_xi_feature_t { XCB_XKB_XI_FEATURE_KEYBOARDS = 1, XCB_XKB_XI_FEATURE_BUTTON_ACTIONS = 2, XCB_XKB_XI_FEATURE_INDICATOR_NAMES = 4, XCB_XKB_XI_FEATURE_INDICATOR_MAPS = 8, XCB_XKB_XI_FEATURE_INDICATOR_STATE = 16 } xcb_xkb_xi_feature_t; typedef enum xcb_xkb_per_client_flag_t { XCB_XKB_PER_CLIENT_FLAG_DETECTABLE_AUTO_REPEAT = 1, XCB_XKB_PER_CLIENT_FLAG_GRABS_USE_XKB_STATE = 2, XCB_XKB_PER_CLIENT_FLAG_AUTO_RESET_CONTROLS = 4, XCB_XKB_PER_CLIENT_FLAG_LOOKUP_STATE_WHEN_GRABBED = 8, XCB_XKB_PER_CLIENT_FLAG_SEND_EVENT_USES_XKB_STATE = 16 } xcb_xkb_per_client_flag_t; /** * @brief xcb_xkb_mod_def_t **/ typedef struct xcb_xkb_mod_def_t { uint8_t mask; uint8_t realMods; uint16_t vmods; } xcb_xkb_mod_def_t; /** * @brief xcb_xkb_mod_def_iterator_t **/ typedef struct xcb_xkb_mod_def_iterator_t { xcb_xkb_mod_def_t *data; int rem; int index; } xcb_xkb_mod_def_iterator_t; /** * @brief xcb_xkb_key_name_t **/ typedef struct xcb_xkb_key_name_t { char name[4]; } xcb_xkb_key_name_t; /** * @brief xcb_xkb_key_name_iterator_t **/ typedef struct xcb_xkb_key_name_iterator_t { xcb_xkb_key_name_t *data; int rem; int index; } xcb_xkb_key_name_iterator_t; /** * @brief xcb_xkb_key_alias_t **/ typedef struct xcb_xkb_key_alias_t { char real[4]; char alias[4]; } xcb_xkb_key_alias_t; /** * @brief xcb_xkb_key_alias_iterator_t **/ typedef struct xcb_xkb_key_alias_iterator_t { xcb_xkb_key_alias_t *data; int rem; int index; } xcb_xkb_key_alias_iterator_t; /** * @brief xcb_xkb_counted_string_16_t **/ typedef struct xcb_xkb_counted_string_16_t { uint16_t length; } xcb_xkb_counted_string_16_t; /** * @brief xcb_xkb_counted_string_16_iterator_t **/ typedef struct xcb_xkb_counted_string_16_iterator_t { xcb_xkb_counted_string_16_t *data; int rem; int index; } xcb_xkb_counted_string_16_iterator_t; /** * @brief xcb_xkb_kt_map_entry_t **/ typedef struct xcb_xkb_kt_map_entry_t { uint8_t active; uint8_t mods_mask; uint8_t level; uint8_t mods_mods; uint16_t mods_vmods; uint8_t pad0[2]; } xcb_xkb_kt_map_entry_t; /** * @brief xcb_xkb_kt_map_entry_iterator_t **/ typedef struct xcb_xkb_kt_map_entry_iterator_t { xcb_xkb_kt_map_entry_t *data; int rem; int index; } xcb_xkb_kt_map_entry_iterator_t; /** * @brief xcb_xkb_key_type_t **/ typedef struct xcb_xkb_key_type_t { uint8_t mods_mask; uint8_t mods_mods; uint16_t mods_vmods; uint8_t numLevels; uint8_t nMapEntries; uint8_t hasPreserve; uint8_t pad0; } xcb_xkb_key_type_t; /** * @brief xcb_xkb_key_type_iterator_t **/ typedef struct xcb_xkb_key_type_iterator_t { xcb_xkb_key_type_t *data; int rem; int index; } xcb_xkb_key_type_iterator_t; /** * @brief xcb_xkb_key_sym_map_t **/ typedef struct xcb_xkb_key_sym_map_t { uint8_t kt_index[4]; uint8_t groupInfo; uint8_t width; uint16_t nSyms; } xcb_xkb_key_sym_map_t; /** * @brief xcb_xkb_key_sym_map_iterator_t **/ typedef struct xcb_xkb_key_sym_map_iterator_t { xcb_xkb_key_sym_map_t *data; int rem; int index; } xcb_xkb_key_sym_map_iterator_t; /** * @brief xcb_xkb_common_behavior_t **/ typedef struct xcb_xkb_common_behavior_t { uint8_t type; uint8_t data; } xcb_xkb_common_behavior_t; /** * @brief xcb_xkb_common_behavior_iterator_t **/ typedef struct xcb_xkb_common_behavior_iterator_t { xcb_xkb_common_behavior_t *data; int rem; int index; } xcb_xkb_common_behavior_iterator_t; /** * @brief xcb_xkb_default_behavior_t **/ typedef struct xcb_xkb_default_behavior_t { uint8_t type; uint8_t pad0; } xcb_xkb_default_behavior_t; /** * @brief xcb_xkb_default_behavior_iterator_t **/ typedef struct xcb_xkb_default_behavior_iterator_t { xcb_xkb_default_behavior_t *data; int rem; int index; } xcb_xkb_default_behavior_iterator_t; /** * @brief xcb_xkb_lock_behavior_t **/ typedef struct xcb_xkb_lock_behavior_t { uint8_t type; uint8_t pad0; } xcb_xkb_lock_behavior_t; /** * @brief xcb_xkb_lock_behavior_iterator_t **/ typedef struct xcb_xkb_lock_behavior_iterator_t { xcb_xkb_lock_behavior_t *data; int rem; int index; } xcb_xkb_lock_behavior_iterator_t; /** * @brief xcb_xkb_radio_group_behavior_t **/ typedef struct xcb_xkb_radio_group_behavior_t { uint8_t type; uint8_t group; } xcb_xkb_radio_group_behavior_t; /** * @brief xcb_xkb_radio_group_behavior_iterator_t **/ typedef struct xcb_xkb_radio_group_behavior_iterator_t { xcb_xkb_radio_group_behavior_t *data; int rem; int index; } xcb_xkb_radio_group_behavior_iterator_t; /** * @brief xcb_xkb_overlay_behavior_t **/ typedef struct xcb_xkb_overlay_behavior_t { uint8_t type; xcb_keycode_t key; } xcb_xkb_overlay_behavior_t; /** * @brief xcb_xkb_overlay_behavior_iterator_t **/ typedef struct xcb_xkb_overlay_behavior_iterator_t { xcb_xkb_overlay_behavior_t *data; int rem; int index; } xcb_xkb_overlay_behavior_iterator_t; /** * @brief xcb_xkb_permament_lock_behavior_t **/ typedef struct xcb_xkb_permament_lock_behavior_t { uint8_t type; uint8_t pad0; } xcb_xkb_permament_lock_behavior_t; /** * @brief xcb_xkb_permament_lock_behavior_iterator_t **/ typedef struct xcb_xkb_permament_lock_behavior_iterator_t { xcb_xkb_permament_lock_behavior_t *data; int rem; int index; } xcb_xkb_permament_lock_behavior_iterator_t; /** * @brief xcb_xkb_permament_radio_group_behavior_t **/ typedef struct xcb_xkb_permament_radio_group_behavior_t { uint8_t type; uint8_t group; } xcb_xkb_permament_radio_group_behavior_t; /** * @brief xcb_xkb_permament_radio_group_behavior_iterator_t **/ typedef struct xcb_xkb_permament_radio_group_behavior_iterator_t { xcb_xkb_permament_radio_group_behavior_t *data; int rem; int index; } xcb_xkb_permament_radio_group_behavior_iterator_t; /** * @brief xcb_xkb_permament_overlay_behavior_t **/ typedef struct xcb_xkb_permament_overlay_behavior_t { uint8_t type; xcb_keycode_t key; } xcb_xkb_permament_overlay_behavior_t; /** * @brief xcb_xkb_permament_overlay_behavior_iterator_t **/ typedef struct xcb_xkb_permament_overlay_behavior_iterator_t { xcb_xkb_permament_overlay_behavior_t *data; int rem; int index; } xcb_xkb_permament_overlay_behavior_iterator_t; /** * @brief xcb_xkb_behavior_t **/ typedef union xcb_xkb_behavior_t { xcb_xkb_common_behavior_t common; xcb_xkb_default_behavior_t _default; xcb_xkb_lock_behavior_t lock; xcb_xkb_radio_group_behavior_t radioGroup; xcb_xkb_overlay_behavior_t overlay1; xcb_xkb_overlay_behavior_t overlay2; xcb_xkb_permament_lock_behavior_t permamentLock; xcb_xkb_permament_radio_group_behavior_t permamentRadioGroup; xcb_xkb_permament_overlay_behavior_t permamentOverlay1; xcb_xkb_permament_overlay_behavior_t permamentOverlay2; uint8_t type; } xcb_xkb_behavior_t; /** * @brief xcb_xkb_behavior_iterator_t **/ typedef struct xcb_xkb_behavior_iterator_t { xcb_xkb_behavior_t *data; int rem; int index; } xcb_xkb_behavior_iterator_t; typedef enum xcb_xkb_behavior_type_t { XCB_XKB_BEHAVIOR_TYPE_DEFAULT = 0, XCB_XKB_BEHAVIOR_TYPE_LOCK = 1, XCB_XKB_BEHAVIOR_TYPE_RADIO_GROUP = 2, XCB_XKB_BEHAVIOR_TYPE_OVERLAY_1 = 3, XCB_XKB_BEHAVIOR_TYPE_OVERLAY_2 = 4, XCB_XKB_BEHAVIOR_TYPE_PERMAMENT_LOCK = 129, XCB_XKB_BEHAVIOR_TYPE_PERMAMENT_RADIO_GROUP = 130, XCB_XKB_BEHAVIOR_TYPE_PERMAMENT_OVERLAY_1 = 131, XCB_XKB_BEHAVIOR_TYPE_PERMAMENT_OVERLAY_2 = 132 } xcb_xkb_behavior_type_t; /** * @brief xcb_xkb_set_behavior_t **/ typedef struct xcb_xkb_set_behavior_t { xcb_keycode_t keycode; xcb_xkb_behavior_t behavior; uint8_t pad0; } xcb_xkb_set_behavior_t; /** * @brief xcb_xkb_set_behavior_iterator_t **/ typedef struct xcb_xkb_set_behavior_iterator_t { xcb_xkb_set_behavior_t *data; int rem; int index; } xcb_xkb_set_behavior_iterator_t; /** * @brief xcb_xkb_set_explicit_t **/ typedef struct xcb_xkb_set_explicit_t { xcb_keycode_t keycode; uint8_t explicit; } xcb_xkb_set_explicit_t; /** * @brief xcb_xkb_set_explicit_iterator_t **/ typedef struct xcb_xkb_set_explicit_iterator_t { xcb_xkb_set_explicit_t *data; int rem; int index; } xcb_xkb_set_explicit_iterator_t; /** * @brief xcb_xkb_key_mod_map_t **/ typedef struct xcb_xkb_key_mod_map_t { xcb_keycode_t keycode; uint8_t mods; } xcb_xkb_key_mod_map_t; /** * @brief xcb_xkb_key_mod_map_iterator_t **/ typedef struct xcb_xkb_key_mod_map_iterator_t { xcb_xkb_key_mod_map_t *data; int rem; int index; } xcb_xkb_key_mod_map_iterator_t; /** * @brief xcb_xkb_key_v_mod_map_t **/ typedef struct xcb_xkb_key_v_mod_map_t { xcb_keycode_t keycode; uint8_t pad0; uint16_t vmods; } xcb_xkb_key_v_mod_map_t; /** * @brief xcb_xkb_key_v_mod_map_iterator_t **/ typedef struct xcb_xkb_key_v_mod_map_iterator_t { xcb_xkb_key_v_mod_map_t *data; int rem; int index; } xcb_xkb_key_v_mod_map_iterator_t; /** * @brief xcb_xkb_kt_set_map_entry_t **/ typedef struct xcb_xkb_kt_set_map_entry_t { uint8_t level; uint8_t realMods; uint16_t virtualMods; } xcb_xkb_kt_set_map_entry_t; /** * @brief xcb_xkb_kt_set_map_entry_iterator_t **/ typedef struct xcb_xkb_kt_set_map_entry_iterator_t { xcb_xkb_kt_set_map_entry_t *data; int rem; int index; } xcb_xkb_kt_set_map_entry_iterator_t; /** * @brief xcb_xkb_set_key_type_t **/ typedef struct xcb_xkb_set_key_type_t { uint8_t mask; uint8_t realMods; uint16_t virtualMods; uint8_t numLevels; uint8_t nMapEntries; uint8_t preserve; uint8_t pad0; } xcb_xkb_set_key_type_t; /** * @brief xcb_xkb_set_key_type_iterator_t **/ typedef struct xcb_xkb_set_key_type_iterator_t { xcb_xkb_set_key_type_t *data; int rem; int index; } xcb_xkb_set_key_type_iterator_t; typedef char xcb_xkb_string8_t; /** * @brief xcb_xkb_string8_iterator_t **/ typedef struct xcb_xkb_string8_iterator_t { xcb_xkb_string8_t *data; int rem; int index; } xcb_xkb_string8_iterator_t; /** * @brief xcb_xkb_outline_t **/ typedef struct xcb_xkb_outline_t { uint8_t nPoints; uint8_t cornerRadius; uint8_t pad0[2]; } xcb_xkb_outline_t; /** * @brief xcb_xkb_outline_iterator_t **/ typedef struct xcb_xkb_outline_iterator_t { xcb_xkb_outline_t *data; int rem; int index; } xcb_xkb_outline_iterator_t; /** * @brief xcb_xkb_shape_t **/ typedef struct xcb_xkb_shape_t { xcb_atom_t name; uint8_t nOutlines; uint8_t primaryNdx; uint8_t approxNdx; uint8_t pad0; } xcb_xkb_shape_t; /** * @brief xcb_xkb_shape_iterator_t **/ typedef struct xcb_xkb_shape_iterator_t { xcb_xkb_shape_t *data; int rem; int index; } xcb_xkb_shape_iterator_t; /** * @brief xcb_xkb_key_t **/ typedef struct xcb_xkb_key_t { xcb_xkb_string8_t name[4]; int16_t gap; uint8_t shapeNdx; uint8_t colorNdx; } xcb_xkb_key_t; /** * @brief xcb_xkb_key_iterator_t **/ typedef struct xcb_xkb_key_iterator_t { xcb_xkb_key_t *data; int rem; int index; } xcb_xkb_key_iterator_t; /** * @brief xcb_xkb_overlay_key_t **/ typedef struct xcb_xkb_overlay_key_t { xcb_xkb_string8_t over[4]; xcb_xkb_string8_t under[4]; } xcb_xkb_overlay_key_t; /** * @brief xcb_xkb_overlay_key_iterator_t **/ typedef struct xcb_xkb_overlay_key_iterator_t { xcb_xkb_overlay_key_t *data; int rem; int index; } xcb_xkb_overlay_key_iterator_t; /** * @brief xcb_xkb_overlay_row_t **/ typedef struct xcb_xkb_overlay_row_t { uint8_t rowUnder; uint8_t nKeys; uint8_t pad0[2]; } xcb_xkb_overlay_row_t; /** * @brief xcb_xkb_overlay_row_iterator_t **/ typedef struct xcb_xkb_overlay_row_iterator_t { xcb_xkb_overlay_row_t *data; int rem; int index; } xcb_xkb_overlay_row_iterator_t; /** * @brief xcb_xkb_overlay_t **/ typedef struct xcb_xkb_overlay_t { xcb_atom_t name; uint8_t nRows; uint8_t pad0[3]; } xcb_xkb_overlay_t; /** * @brief xcb_xkb_overlay_iterator_t **/ typedef struct xcb_xkb_overlay_iterator_t { xcb_xkb_overlay_t *data; int rem; int index; } xcb_xkb_overlay_iterator_t; /** * @brief xcb_xkb_row_t **/ typedef struct xcb_xkb_row_t { int16_t top; int16_t left; uint8_t nKeys; uint8_t vertical; uint8_t pad0[2]; } xcb_xkb_row_t; /** * @brief xcb_xkb_row_iterator_t **/ typedef struct xcb_xkb_row_iterator_t { xcb_xkb_row_t *data; int rem; int index; } xcb_xkb_row_iterator_t; typedef enum xcb_xkb_doodad_type_t { XCB_XKB_DOODAD_TYPE_OUTLINE = 1, XCB_XKB_DOODAD_TYPE_SOLID = 2, XCB_XKB_DOODAD_TYPE_TEXT = 3, XCB_XKB_DOODAD_TYPE_INDICATOR = 4, XCB_XKB_DOODAD_TYPE_LOGO = 5 } xcb_xkb_doodad_type_t; /** * @brief xcb_xkb_listing_t **/ typedef struct xcb_xkb_listing_t { uint16_t flags; uint16_t length; } xcb_xkb_listing_t; /** * @brief xcb_xkb_listing_iterator_t **/ typedef struct xcb_xkb_listing_iterator_t { xcb_xkb_listing_t *data; int rem; int index; } xcb_xkb_listing_iterator_t; /** * @brief xcb_xkb_device_led_info_t **/ typedef struct xcb_xkb_device_led_info_t { xcb_xkb_led_class_spec_t ledClass; xcb_xkb_id_spec_t ledID; uint32_t namesPresent; uint32_t mapsPresent; uint32_t physIndicators; uint32_t state; } xcb_xkb_device_led_info_t; /** * @brief xcb_xkb_device_led_info_iterator_t **/ typedef struct xcb_xkb_device_led_info_iterator_t { xcb_xkb_device_led_info_t *data; int rem; int index; } xcb_xkb_device_led_info_iterator_t; typedef enum xcb_xkb_error_t { XCB_XKB_ERROR_BAD_DEVICE = 255, XCB_XKB_ERROR_BAD_CLASS = 254, XCB_XKB_ERROR_BAD_ID = 253 } xcb_xkb_error_t; /** Opcode for xcb_xkb_keyboard. */ #define XCB_XKB_KEYBOARD 0 /** * @brief xcb_xkb_keyboard_error_t **/ typedef struct xcb_xkb_keyboard_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; uint32_t value; uint16_t minorOpcode; uint8_t majorOpcode; uint8_t pad0[21]; } xcb_xkb_keyboard_error_t; typedef enum xcb_xkb_sa_t { XCB_XKB_SA_CLEAR_LOCKS = 1, XCB_XKB_SA_LATCH_TO_LOCK = 2, XCB_XKB_SA_USE_MOD_MAP_MODS = 4, XCB_XKB_SA_GROUP_ABSOLUTE = 4 } xcb_xkb_sa_t; typedef enum xcb_xkb_sa_type_t { XCB_XKB_SA_TYPE_NO_ACTION = 0, XCB_XKB_SA_TYPE_SET_MODS = 1, XCB_XKB_SA_TYPE_LATCH_MODS = 2, XCB_XKB_SA_TYPE_LOCK_MODS = 3, XCB_XKB_SA_TYPE_SET_GROUP = 4, XCB_XKB_SA_TYPE_LATCH_GROUP = 5, XCB_XKB_SA_TYPE_LOCK_GROUP = 6, XCB_XKB_SA_TYPE_MOVE_PTR = 7, XCB_XKB_SA_TYPE_PTR_BTN = 8, XCB_XKB_SA_TYPE_LOCK_PTR_BTN = 9, XCB_XKB_SA_TYPE_SET_PTR_DFLT = 10, XCB_XKB_SA_TYPE_ISO_LOCK = 11, XCB_XKB_SA_TYPE_TERMINATE = 12, XCB_XKB_SA_TYPE_SWITCH_SCREEN = 13, XCB_XKB_SA_TYPE_SET_CONTROLS = 14, XCB_XKB_SA_TYPE_LOCK_CONTROLS = 15, XCB_XKB_SA_TYPE_ACTION_MESSAGE = 16, XCB_XKB_SA_TYPE_REDIRECT_KEY = 17, XCB_XKB_SA_TYPE_DEVICE_BTN = 18, XCB_XKB_SA_TYPE_LOCK_DEVICE_BTN = 19, XCB_XKB_SA_TYPE_DEVICE_VALUATOR = 20 } xcb_xkb_sa_type_t; /** * @brief xcb_xkb_sa_no_action_t **/ typedef struct xcb_xkb_sa_no_action_t { uint8_t type; uint8_t pad0[7]; } xcb_xkb_sa_no_action_t; /** * @brief xcb_xkb_sa_no_action_iterator_t **/ typedef struct xcb_xkb_sa_no_action_iterator_t { xcb_xkb_sa_no_action_t *data; int rem; int index; } xcb_xkb_sa_no_action_iterator_t; /** * @brief xcb_xkb_sa_set_mods_t **/ typedef struct xcb_xkb_sa_set_mods_t { uint8_t type; uint8_t flags; uint8_t mask; uint8_t realMods; uint8_t vmodsHigh; uint8_t vmodsLow; uint8_t pad0[2]; } xcb_xkb_sa_set_mods_t; /** * @brief xcb_xkb_sa_set_mods_iterator_t **/ typedef struct xcb_xkb_sa_set_mods_iterator_t { xcb_xkb_sa_set_mods_t *data; int rem; int index; } xcb_xkb_sa_set_mods_iterator_t; /** * @brief xcb_xkb_sa_latch_mods_t **/ typedef struct xcb_xkb_sa_latch_mods_t { uint8_t type; uint8_t flags; uint8_t mask; uint8_t realMods; uint8_t vmodsHigh; uint8_t vmodsLow; uint8_t pad0[2]; } xcb_xkb_sa_latch_mods_t; /** * @brief xcb_xkb_sa_latch_mods_iterator_t **/ typedef struct xcb_xkb_sa_latch_mods_iterator_t { xcb_xkb_sa_latch_mods_t *data; int rem; int index; } xcb_xkb_sa_latch_mods_iterator_t; /** * @brief xcb_xkb_sa_lock_mods_t **/ typedef struct xcb_xkb_sa_lock_mods_t { uint8_t type; uint8_t flags; uint8_t mask; uint8_t realMods; uint8_t vmodsHigh; uint8_t vmodsLow; uint8_t pad0[2]; } xcb_xkb_sa_lock_mods_t; /** * @brief xcb_xkb_sa_lock_mods_iterator_t **/ typedef struct xcb_xkb_sa_lock_mods_iterator_t { xcb_xkb_sa_lock_mods_t *data; int rem; int index; } xcb_xkb_sa_lock_mods_iterator_t; /** * @brief xcb_xkb_sa_set_group_t **/ typedef struct xcb_xkb_sa_set_group_t { uint8_t type; uint8_t flags; int8_t group; uint8_t pad0[5]; } xcb_xkb_sa_set_group_t; /** * @brief xcb_xkb_sa_set_group_iterator_t **/ typedef struct xcb_xkb_sa_set_group_iterator_t { xcb_xkb_sa_set_group_t *data; int rem; int index; } xcb_xkb_sa_set_group_iterator_t; /** * @brief xcb_xkb_sa_latch_group_t **/ typedef struct xcb_xkb_sa_latch_group_t { uint8_t type; uint8_t flags; int8_t group; uint8_t pad0[5]; } xcb_xkb_sa_latch_group_t; /** * @brief xcb_xkb_sa_latch_group_iterator_t **/ typedef struct xcb_xkb_sa_latch_group_iterator_t { xcb_xkb_sa_latch_group_t *data; int rem; int index; } xcb_xkb_sa_latch_group_iterator_t; /** * @brief xcb_xkb_sa_lock_group_t **/ typedef struct xcb_xkb_sa_lock_group_t { uint8_t type; uint8_t flags; int8_t group; uint8_t pad0[5]; } xcb_xkb_sa_lock_group_t; /** * @brief xcb_xkb_sa_lock_group_iterator_t **/ typedef struct xcb_xkb_sa_lock_group_iterator_t { xcb_xkb_sa_lock_group_t *data; int rem; int index; } xcb_xkb_sa_lock_group_iterator_t; typedef enum xcb_xkb_sa_move_ptr_flag_t { XCB_XKB_SA_MOVE_PTR_FLAG_NO_ACCELERATION = 1, XCB_XKB_SA_MOVE_PTR_FLAG_MOVE_ABSOLUTE_X = 2, XCB_XKB_SA_MOVE_PTR_FLAG_MOVE_ABSOLUTE_Y = 4 } xcb_xkb_sa_move_ptr_flag_t; /** * @brief xcb_xkb_sa_move_ptr_t **/ typedef struct xcb_xkb_sa_move_ptr_t { uint8_t type; uint8_t flags; int8_t xHigh; uint8_t xLow; int8_t yHigh; uint8_t yLow; uint8_t pad0[2]; } xcb_xkb_sa_move_ptr_t; /** * @brief xcb_xkb_sa_move_ptr_iterator_t **/ typedef struct xcb_xkb_sa_move_ptr_iterator_t { xcb_xkb_sa_move_ptr_t *data; int rem; int index; } xcb_xkb_sa_move_ptr_iterator_t; /** * @brief xcb_xkb_sa_ptr_btn_t **/ typedef struct xcb_xkb_sa_ptr_btn_t { uint8_t type; uint8_t flags; uint8_t count; uint8_t button; uint8_t pad0[4]; } xcb_xkb_sa_ptr_btn_t; /** * @brief xcb_xkb_sa_ptr_btn_iterator_t **/ typedef struct xcb_xkb_sa_ptr_btn_iterator_t { xcb_xkb_sa_ptr_btn_t *data; int rem; int index; } xcb_xkb_sa_ptr_btn_iterator_t; /** * @brief xcb_xkb_sa_lock_ptr_btn_t **/ typedef struct xcb_xkb_sa_lock_ptr_btn_t { uint8_t type; uint8_t flags; uint8_t pad0; uint8_t button; uint8_t pad1[4]; } xcb_xkb_sa_lock_ptr_btn_t; /** * @brief xcb_xkb_sa_lock_ptr_btn_iterator_t **/ typedef struct xcb_xkb_sa_lock_ptr_btn_iterator_t { xcb_xkb_sa_lock_ptr_btn_t *data; int rem; int index; } xcb_xkb_sa_lock_ptr_btn_iterator_t; typedef enum xcb_xkb_sa_set_ptr_dflt_flag_t { XCB_XKB_SA_SET_PTR_DFLT_FLAG_DFLT_BTN_ABSOLUTE = 4, XCB_XKB_SA_SET_PTR_DFLT_FLAG_AFFECT_DFLT_BUTTON = 1 } xcb_xkb_sa_set_ptr_dflt_flag_t; /** * @brief xcb_xkb_sa_set_ptr_dflt_t **/ typedef struct xcb_xkb_sa_set_ptr_dflt_t { uint8_t type; uint8_t flags; uint8_t affect; int8_t value; uint8_t pad0[4]; } xcb_xkb_sa_set_ptr_dflt_t; /** * @brief xcb_xkb_sa_set_ptr_dflt_iterator_t **/ typedef struct xcb_xkb_sa_set_ptr_dflt_iterator_t { xcb_xkb_sa_set_ptr_dflt_t *data; int rem; int index; } xcb_xkb_sa_set_ptr_dflt_iterator_t; typedef enum xcb_xkb_sa_iso_lock_flag_t { XCB_XKB_SA_ISO_LOCK_FLAG_NO_LOCK = 1, XCB_XKB_SA_ISO_LOCK_FLAG_NO_UNLOCK = 2, XCB_XKB_SA_ISO_LOCK_FLAG_USE_MOD_MAP_MODS = 4, XCB_XKB_SA_ISO_LOCK_FLAG_GROUP_ABSOLUTE = 4, XCB_XKB_SA_ISO_LOCK_FLAG_ISO_DFLT_IS_GROUP = 8 } xcb_xkb_sa_iso_lock_flag_t; typedef enum xcb_xkb_sa_iso_lock_no_affect_t { XCB_XKB_SA_ISO_LOCK_NO_AFFECT_CTRLS = 8, XCB_XKB_SA_ISO_LOCK_NO_AFFECT_PTR = 16, XCB_XKB_SA_ISO_LOCK_NO_AFFECT_GROUP = 32, XCB_XKB_SA_ISO_LOCK_NO_AFFECT_MODS = 64 } xcb_xkb_sa_iso_lock_no_affect_t; /** * @brief xcb_xkb_sa_iso_lock_t **/ typedef struct xcb_xkb_sa_iso_lock_t { uint8_t type; uint8_t flags; uint8_t mask; uint8_t realMods; int8_t group; uint8_t affect; uint8_t vmodsHigh; uint8_t vmodsLow; } xcb_xkb_sa_iso_lock_t; /** * @brief xcb_xkb_sa_iso_lock_iterator_t **/ typedef struct xcb_xkb_sa_iso_lock_iterator_t { xcb_xkb_sa_iso_lock_t *data; int rem; int index; } xcb_xkb_sa_iso_lock_iterator_t; /** * @brief xcb_xkb_sa_terminate_t **/ typedef struct xcb_xkb_sa_terminate_t { uint8_t type; uint8_t pad0[7]; } xcb_xkb_sa_terminate_t; /** * @brief xcb_xkb_sa_terminate_iterator_t **/ typedef struct xcb_xkb_sa_terminate_iterator_t { xcb_xkb_sa_terminate_t *data; int rem; int index; } xcb_xkb_sa_terminate_iterator_t; typedef enum xcb_xkb_switch_screen_flag_t { XCB_XKB_SWITCH_SCREEN_FLAG_APPLICATION = 1, XCB_XKB_SWITCH_SCREEN_FLAG_ABSOLUTE = 4 } xcb_xkb_switch_screen_flag_t; /** * @brief xcb_xkb_sa_switch_screen_t **/ typedef struct xcb_xkb_sa_switch_screen_t { uint8_t type; uint8_t flags; int8_t newScreen; uint8_t pad0[5]; } xcb_xkb_sa_switch_screen_t; /** * @brief xcb_xkb_sa_switch_screen_iterator_t **/ typedef struct xcb_xkb_sa_switch_screen_iterator_t { xcb_xkb_sa_switch_screen_t *data; int rem; int index; } xcb_xkb_sa_switch_screen_iterator_t; typedef enum xcb_xkb_bool_ctrls_high_t { XCB_XKB_BOOL_CTRLS_HIGH_ACCESS_X_FEEDBACK = 1, XCB_XKB_BOOL_CTRLS_HIGH_AUDIBLE_BELL = 2, XCB_XKB_BOOL_CTRLS_HIGH_OVERLAY_1 = 4, XCB_XKB_BOOL_CTRLS_HIGH_OVERLAY_2 = 8, XCB_XKB_BOOL_CTRLS_HIGH_IGNORE_GROUP_LOCK = 16 } xcb_xkb_bool_ctrls_high_t; typedef enum xcb_xkb_bool_ctrls_low_t { XCB_XKB_BOOL_CTRLS_LOW_REPEAT_KEYS = 1, XCB_XKB_BOOL_CTRLS_LOW_SLOW_KEYS = 2, XCB_XKB_BOOL_CTRLS_LOW_BOUNCE_KEYS = 4, XCB_XKB_BOOL_CTRLS_LOW_STICKY_KEYS = 8, XCB_XKB_BOOL_CTRLS_LOW_MOUSE_KEYS = 16, XCB_XKB_BOOL_CTRLS_LOW_MOUSE_KEYS_ACCEL = 32, XCB_XKB_BOOL_CTRLS_LOW_ACCESS_X_KEYS = 64, XCB_XKB_BOOL_CTRLS_LOW_ACCESS_X_TIMEOUT = 128 } xcb_xkb_bool_ctrls_low_t; /** * @brief xcb_xkb_sa_set_controls_t **/ typedef struct xcb_xkb_sa_set_controls_t { uint8_t type; uint8_t pad0[3]; uint8_t boolCtrlsHigh; uint8_t boolCtrlsLow; uint8_t pad1[2]; } xcb_xkb_sa_set_controls_t; /** * @brief xcb_xkb_sa_set_controls_iterator_t **/ typedef struct xcb_xkb_sa_set_controls_iterator_t { xcb_xkb_sa_set_controls_t *data; int rem; int index; } xcb_xkb_sa_set_controls_iterator_t; /** * @brief xcb_xkb_sa_lock_controls_t **/ typedef struct xcb_xkb_sa_lock_controls_t { uint8_t type; uint8_t pad0[3]; uint8_t boolCtrlsHigh; uint8_t boolCtrlsLow; uint8_t pad1[2]; } xcb_xkb_sa_lock_controls_t; /** * @brief xcb_xkb_sa_lock_controls_iterator_t **/ typedef struct xcb_xkb_sa_lock_controls_iterator_t { xcb_xkb_sa_lock_controls_t *data; int rem; int index; } xcb_xkb_sa_lock_controls_iterator_t; typedef enum xcb_xkb_action_message_flag_t { XCB_XKB_ACTION_MESSAGE_FLAG_ON_PRESS = 1, XCB_XKB_ACTION_MESSAGE_FLAG_ON_RELEASE = 2, XCB_XKB_ACTION_MESSAGE_FLAG_GEN_KEY_EVENT = 4 } xcb_xkb_action_message_flag_t; /** * @brief xcb_xkb_sa_action_message_t **/ typedef struct xcb_xkb_sa_action_message_t { uint8_t type; uint8_t flags; uint8_t message[6]; } xcb_xkb_sa_action_message_t; /** * @brief xcb_xkb_sa_action_message_iterator_t **/ typedef struct xcb_xkb_sa_action_message_iterator_t { xcb_xkb_sa_action_message_t *data; int rem; int index; } xcb_xkb_sa_action_message_iterator_t; /** * @brief xcb_xkb_sa_redirect_key_t **/ typedef struct xcb_xkb_sa_redirect_key_t { uint8_t type; xcb_keycode_t newkey; uint8_t mask; uint8_t realModifiers; uint8_t vmodsMaskHigh; uint8_t vmodsMaskLow; uint8_t vmodsHigh; uint8_t vmodsLow; } xcb_xkb_sa_redirect_key_t; /** * @brief xcb_xkb_sa_redirect_key_iterator_t **/ typedef struct xcb_xkb_sa_redirect_key_iterator_t { xcb_xkb_sa_redirect_key_t *data; int rem; int index; } xcb_xkb_sa_redirect_key_iterator_t; /** * @brief xcb_xkb_sa_device_btn_t **/ typedef struct xcb_xkb_sa_device_btn_t { uint8_t type; uint8_t flags; uint8_t count; uint8_t button; uint8_t device; uint8_t pad0[3]; } xcb_xkb_sa_device_btn_t; /** * @brief xcb_xkb_sa_device_btn_iterator_t **/ typedef struct xcb_xkb_sa_device_btn_iterator_t { xcb_xkb_sa_device_btn_t *data; int rem; int index; } xcb_xkb_sa_device_btn_iterator_t; typedef enum xcb_xkb_lock_device_flags_t { XCB_XKB_LOCK_DEVICE_FLAGS_NO_LOCK = 1, XCB_XKB_LOCK_DEVICE_FLAGS_NO_UNLOCK = 2 } xcb_xkb_lock_device_flags_t; /** * @brief xcb_xkb_sa_lock_device_btn_t **/ typedef struct xcb_xkb_sa_lock_device_btn_t { uint8_t type; uint8_t flags; uint8_t pad0; uint8_t button; uint8_t device; uint8_t pad1[3]; } xcb_xkb_sa_lock_device_btn_t; /** * @brief xcb_xkb_sa_lock_device_btn_iterator_t **/ typedef struct xcb_xkb_sa_lock_device_btn_iterator_t { xcb_xkb_sa_lock_device_btn_t *data; int rem; int index; } xcb_xkb_sa_lock_device_btn_iterator_t; typedef enum xcb_xkb_sa_val_what_t { XCB_XKB_SA_VAL_WHAT_IGNORE_VAL = 0, XCB_XKB_SA_VAL_WHAT_SET_VAL_MIN = 1, XCB_XKB_SA_VAL_WHAT_SET_VAL_CENTER = 2, XCB_XKB_SA_VAL_WHAT_SET_VAL_MAX = 3, XCB_XKB_SA_VAL_WHAT_SET_VAL_RELATIVE = 4, XCB_XKB_SA_VAL_WHAT_SET_VAL_ABSOLUTE = 5 } xcb_xkb_sa_val_what_t; /** * @brief xcb_xkb_sa_device_valuator_t **/ typedef struct xcb_xkb_sa_device_valuator_t { uint8_t type; uint8_t device; uint8_t val1what; uint8_t val1index; uint8_t val1value; uint8_t val2what; uint8_t val2index; uint8_t val2value; } xcb_xkb_sa_device_valuator_t; /** * @brief xcb_xkb_sa_device_valuator_iterator_t **/ typedef struct xcb_xkb_sa_device_valuator_iterator_t { xcb_xkb_sa_device_valuator_t *data; int rem; int index; } xcb_xkb_sa_device_valuator_iterator_t; /** * @brief xcb_xkb_si_action_t **/ typedef struct xcb_xkb_si_action_t { uint8_t type; uint8_t data[7]; } xcb_xkb_si_action_t; /** * @brief xcb_xkb_si_action_iterator_t **/ typedef struct xcb_xkb_si_action_iterator_t { xcb_xkb_si_action_t *data; int rem; int index; } xcb_xkb_si_action_iterator_t; /** * @brief xcb_xkb_sym_interpret_t **/ typedef struct xcb_xkb_sym_interpret_t { xcb_keysym_t sym; uint8_t mods; uint8_t match; uint8_t virtualMod; uint8_t flags; xcb_xkb_si_action_t action; } xcb_xkb_sym_interpret_t; /** * @brief xcb_xkb_sym_interpret_iterator_t **/ typedef struct xcb_xkb_sym_interpret_iterator_t { xcb_xkb_sym_interpret_t *data; int rem; int index; } xcb_xkb_sym_interpret_iterator_t; /** * @brief xcb_xkb_action_t **/ typedef union xcb_xkb_action_t { xcb_xkb_sa_no_action_t noaction; xcb_xkb_sa_set_mods_t setmods; xcb_xkb_sa_latch_mods_t latchmods; xcb_xkb_sa_lock_mods_t lockmods; xcb_xkb_sa_set_group_t setgroup; xcb_xkb_sa_latch_group_t latchgroup; xcb_xkb_sa_lock_group_t lockgroup; xcb_xkb_sa_move_ptr_t moveptr; xcb_xkb_sa_ptr_btn_t ptrbtn; xcb_xkb_sa_lock_ptr_btn_t lockptrbtn; xcb_xkb_sa_set_ptr_dflt_t setptrdflt; xcb_xkb_sa_iso_lock_t isolock; xcb_xkb_sa_terminate_t terminate; xcb_xkb_sa_switch_screen_t switchscreen; xcb_xkb_sa_set_controls_t setcontrols; xcb_xkb_sa_lock_controls_t lockcontrols; xcb_xkb_sa_action_message_t message; xcb_xkb_sa_redirect_key_t redirect; xcb_xkb_sa_device_btn_t devbtn; xcb_xkb_sa_lock_device_btn_t lockdevbtn; xcb_xkb_sa_device_valuator_t devval; uint8_t type; } xcb_xkb_action_t; /** * @brief xcb_xkb_action_iterator_t **/ typedef struct xcb_xkb_action_iterator_t { xcb_xkb_action_t *data; int rem; int index; } xcb_xkb_action_iterator_t; /** * @brief xcb_xkb_use_extension_cookie_t **/ typedef struct xcb_xkb_use_extension_cookie_t { unsigned int sequence; } xcb_xkb_use_extension_cookie_t; /** Opcode for xcb_xkb_use_extension. */ #define XCB_XKB_USE_EXTENSION 0 /** * @brief xcb_xkb_use_extension_request_t **/ typedef struct xcb_xkb_use_extension_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint16_t wantedMajor; uint16_t wantedMinor; } xcb_xkb_use_extension_request_t; /** * @brief xcb_xkb_use_extension_reply_t **/ typedef struct xcb_xkb_use_extension_reply_t { uint8_t response_type; uint8_t supported; uint16_t sequence; uint32_t length; uint16_t serverMajor; uint16_t serverMinor; uint8_t pad0[20]; } xcb_xkb_use_extension_reply_t; /** * @brief xcb_xkb_select_events_details_t **/ typedef struct xcb_xkb_select_events_details_t { uint16_t affectNewKeyboard; uint16_t newKeyboardDetails; uint16_t affectState; uint16_t stateDetails; uint32_t affectCtrls; uint32_t ctrlDetails; uint32_t affectIndicatorState; uint32_t indicatorStateDetails; uint32_t affectIndicatorMap; uint32_t indicatorMapDetails; uint16_t affectNames; uint16_t namesDetails; uint8_t affectCompat; uint8_t compatDetails; uint8_t affectBell; uint8_t bellDetails; uint8_t affectMsgDetails; uint8_t msgDetails; uint16_t affectAccessX; uint16_t accessXDetails; uint16_t affectExtDev; uint16_t extdevDetails; } xcb_xkb_select_events_details_t; /** Opcode for xcb_xkb_select_events. */ #define XCB_XKB_SELECT_EVENTS 1 /** * @brief xcb_xkb_select_events_request_t **/ typedef struct xcb_xkb_select_events_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; uint16_t affectWhich; uint16_t clear; uint16_t selectAll; uint16_t affectMap; uint16_t map; } xcb_xkb_select_events_request_t; /** Opcode for xcb_xkb_bell. */ #define XCB_XKB_BELL 3 /** * @brief xcb_xkb_bell_request_t **/ typedef struct xcb_xkb_bell_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; xcb_xkb_bell_class_spec_t bellClass; xcb_xkb_id_spec_t bellID; int8_t percent; uint8_t forceSound; uint8_t eventOnly; uint8_t pad0; int16_t pitch; int16_t duration; uint8_t pad1[2]; xcb_atom_t name; xcb_window_t window; } xcb_xkb_bell_request_t; /** * @brief xcb_xkb_get_state_cookie_t **/ typedef struct xcb_xkb_get_state_cookie_t { unsigned int sequence; } xcb_xkb_get_state_cookie_t; /** Opcode for xcb_xkb_get_state. */ #define XCB_XKB_GET_STATE 4 /** * @brief xcb_xkb_get_state_request_t **/ typedef struct xcb_xkb_get_state_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; uint8_t pad0[2]; } xcb_xkb_get_state_request_t; /** * @brief xcb_xkb_get_state_reply_t **/ typedef struct xcb_xkb_get_state_reply_t { uint8_t response_type; uint8_t deviceID; uint16_t sequence; uint32_t length; uint8_t mods; uint8_t baseMods; uint8_t latchedMods; uint8_t lockedMods; uint8_t group; uint8_t lockedGroup; int16_t baseGroup; int16_t latchedGroup; uint8_t compatState; uint8_t grabMods; uint8_t compatGrabMods; uint8_t lookupMods; uint8_t compatLookupMods; uint8_t pad0; uint16_t ptrBtnState; uint8_t pad1[6]; } xcb_xkb_get_state_reply_t; /** Opcode for xcb_xkb_latch_lock_state. */ #define XCB_XKB_LATCH_LOCK_STATE 5 /** * @brief xcb_xkb_latch_lock_state_request_t **/ typedef struct xcb_xkb_latch_lock_state_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; uint8_t affectModLocks; uint8_t modLocks; uint8_t lockGroup; uint8_t groupLock; uint8_t affectModLatches; uint8_t pad0; uint8_t pad1; uint8_t latchGroup; uint16_t groupLatch; } xcb_xkb_latch_lock_state_request_t; /** * @brief xcb_xkb_get_controls_cookie_t **/ typedef struct xcb_xkb_get_controls_cookie_t { unsigned int sequence; } xcb_xkb_get_controls_cookie_t; /** Opcode for xcb_xkb_get_controls. */ #define XCB_XKB_GET_CONTROLS 6 /** * @brief xcb_xkb_get_controls_request_t **/ typedef struct xcb_xkb_get_controls_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; uint8_t pad0[2]; } xcb_xkb_get_controls_request_t; /** * @brief xcb_xkb_get_controls_reply_t **/ typedef struct xcb_xkb_get_controls_reply_t { uint8_t response_type; uint8_t deviceID; uint16_t sequence; uint32_t length; uint8_t mouseKeysDfltBtn; uint8_t numGroups; uint8_t groupsWrap; uint8_t internalModsMask; uint8_t ignoreLockModsMask; uint8_t internalModsRealMods; uint8_t ignoreLockModsRealMods; uint8_t pad0; uint16_t internalModsVmods; uint16_t ignoreLockModsVmods; uint16_t repeatDelay; uint16_t repeatInterval; uint16_t slowKeysDelay; uint16_t debounceDelay; uint16_t mouseKeysDelay; uint16_t mouseKeysInterval; uint16_t mouseKeysTimeToMax; uint16_t mouseKeysMaxSpeed; int16_t mouseKeysCurve; uint16_t accessXOption; uint16_t accessXTimeout; uint16_t accessXTimeoutOptionsMask; uint16_t accessXTimeoutOptionsValues; uint8_t pad1[2]; uint32_t accessXTimeoutMask; uint32_t accessXTimeoutValues; uint32_t enabledControls; uint8_t perKeyRepeat[32]; } xcb_xkb_get_controls_reply_t; /** Opcode for xcb_xkb_set_controls. */ #define XCB_XKB_SET_CONTROLS 7 /** * @brief xcb_xkb_set_controls_request_t **/ typedef struct xcb_xkb_set_controls_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; uint8_t affectInternalRealMods; uint8_t internalRealMods; uint8_t affectIgnoreLockRealMods; uint8_t ignoreLockRealMods; uint16_t affectInternalVirtualMods; uint16_t internalVirtualMods; uint16_t affectIgnoreLockVirtualMods; uint16_t ignoreLockVirtualMods; uint8_t mouseKeysDfltBtn; uint8_t groupsWrap; uint16_t accessXOptions; uint8_t pad0[2]; uint32_t affectEnabledControls; uint32_t enabledControls; uint32_t changeControls; uint16_t repeatDelay; uint16_t repeatInterval; uint16_t slowKeysDelay; uint16_t debounceDelay; uint16_t mouseKeysDelay; uint16_t mouseKeysInterval; uint16_t mouseKeysTimeToMax; uint16_t mouseKeysMaxSpeed; int16_t mouseKeysCurve; uint16_t accessXTimeout; uint32_t accessXTimeoutMask; uint32_t accessXTimeoutValues; uint16_t accessXTimeoutOptionsMask; uint16_t accessXTimeoutOptionsValues; uint8_t perKeyRepeat[32]; } xcb_xkb_set_controls_request_t; /** * @brief xcb_xkb_get_map_cookie_t **/ typedef struct xcb_xkb_get_map_cookie_t { unsigned int sequence; } xcb_xkb_get_map_cookie_t; /** Opcode for xcb_xkb_get_map. */ #define XCB_XKB_GET_MAP 8 /** * @brief xcb_xkb_get_map_request_t **/ typedef struct xcb_xkb_get_map_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; uint16_t full; uint16_t partial; uint8_t firstType; uint8_t nTypes; xcb_keycode_t firstKeySym; uint8_t nKeySyms; xcb_keycode_t firstKeyAction; uint8_t nKeyActions; xcb_keycode_t firstKeyBehavior; uint8_t nKeyBehaviors; uint16_t virtualMods; xcb_keycode_t firstKeyExplicit; uint8_t nKeyExplicit; xcb_keycode_t firstModMapKey; uint8_t nModMapKeys; xcb_keycode_t firstVModMapKey; uint8_t nVModMapKeys; uint8_t pad0[2]; } xcb_xkb_get_map_request_t; /** * @brief xcb_xkb_get_map_map_t **/ typedef struct xcb_xkb_get_map_map_t { xcb_xkb_key_type_t *types_rtrn; xcb_xkb_key_sym_map_t *syms_rtrn; uint8_t *acts_rtrn_count; uint8_t *pad2; xcb_xkb_action_t *acts_rtrn_acts; xcb_xkb_set_behavior_t *behaviors_rtrn; uint8_t *vmods_rtrn; uint8_t *pad3; xcb_xkb_set_explicit_t *explicit_rtrn; uint8_t *pad4; xcb_xkb_key_mod_map_t *modmap_rtrn; uint8_t *pad5; xcb_xkb_key_v_mod_map_t *vmodmap_rtrn; } xcb_xkb_get_map_map_t; /** * @brief xcb_xkb_get_map_reply_t **/ typedef struct xcb_xkb_get_map_reply_t { uint8_t response_type; uint8_t deviceID; uint16_t sequence; uint32_t length; uint8_t pad0[2]; xcb_keycode_t minKeyCode; xcb_keycode_t maxKeyCode; uint16_t present; uint8_t firstType; uint8_t nTypes; uint8_t totalTypes; xcb_keycode_t firstKeySym; uint16_t totalSyms; uint8_t nKeySyms; xcb_keycode_t firstKeyAction; uint16_t totalActions; uint8_t nKeyActions; xcb_keycode_t firstKeyBehavior; uint8_t nKeyBehaviors; uint8_t totalKeyBehaviors; xcb_keycode_t firstKeyExplicit; uint8_t nKeyExplicit; uint8_t totalKeyExplicit; xcb_keycode_t firstModMapKey; uint8_t nModMapKeys; uint8_t totalModMapKeys; xcb_keycode_t firstVModMapKey; uint8_t nVModMapKeys; uint8_t totalVModMapKeys; uint8_t pad1; uint16_t virtualMods; } xcb_xkb_get_map_reply_t; /** * @brief xcb_xkb_set_map_values_t **/ typedef struct xcb_xkb_set_map_values_t { xcb_xkb_set_key_type_t *types; xcb_xkb_key_sym_map_t *syms; uint8_t *actionsCount; xcb_xkb_action_t *actions; xcb_xkb_set_behavior_t *behaviors; uint8_t *vmods; xcb_xkb_set_explicit_t *explicit; xcb_xkb_key_mod_map_t *modmap; xcb_xkb_key_v_mod_map_t *vmodmap; } xcb_xkb_set_map_values_t; /** Opcode for xcb_xkb_set_map. */ #define XCB_XKB_SET_MAP 9 /** * @brief xcb_xkb_set_map_request_t **/ typedef struct xcb_xkb_set_map_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; uint16_t present; uint16_t flags; xcb_keycode_t minKeyCode; xcb_keycode_t maxKeyCode; uint8_t firstType; uint8_t nTypes; xcb_keycode_t firstKeySym; uint8_t nKeySyms; uint16_t totalSyms; xcb_keycode_t firstKeyAction; uint8_t nKeyActions; uint16_t totalActions; xcb_keycode_t firstKeyBehavior; uint8_t nKeyBehaviors; uint8_t totalKeyBehaviors; xcb_keycode_t firstKeyExplicit; uint8_t nKeyExplicit; uint8_t totalKeyExplicit; xcb_keycode_t firstModMapKey; uint8_t nModMapKeys; uint8_t totalModMapKeys; xcb_keycode_t firstVModMapKey; uint8_t nVModMapKeys; uint8_t totalVModMapKeys; uint16_t virtualMods; } xcb_xkb_set_map_request_t; /** * @brief xcb_xkb_get_compat_map_cookie_t **/ typedef struct xcb_xkb_get_compat_map_cookie_t { unsigned int sequence; } xcb_xkb_get_compat_map_cookie_t; /** Opcode for xcb_xkb_get_compat_map. */ #define XCB_XKB_GET_COMPAT_MAP 10 /** * @brief xcb_xkb_get_compat_map_request_t **/ typedef struct xcb_xkb_get_compat_map_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; uint8_t groups; uint8_t getAllSI; uint16_t firstSI; uint16_t nSI; } xcb_xkb_get_compat_map_request_t; /** * @brief xcb_xkb_get_compat_map_reply_t **/ typedef struct xcb_xkb_get_compat_map_reply_t { uint8_t response_type; uint8_t deviceID; uint16_t sequence; uint32_t length; uint8_t groupsRtrn; uint8_t pad0; uint16_t firstSIRtrn; uint16_t nSIRtrn; uint16_t nTotalSI; uint8_t pad1[16]; } xcb_xkb_get_compat_map_reply_t; /** Opcode for xcb_xkb_set_compat_map. */ #define XCB_XKB_SET_COMPAT_MAP 11 /** * @brief xcb_xkb_set_compat_map_request_t **/ typedef struct xcb_xkb_set_compat_map_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; uint8_t pad0; uint8_t recomputeActions; uint8_t truncateSI; uint8_t groups; uint16_t firstSI; uint16_t nSI; uint8_t pad1[2]; } xcb_xkb_set_compat_map_request_t; /** * @brief xcb_xkb_get_indicator_state_cookie_t **/ typedef struct xcb_xkb_get_indicator_state_cookie_t { unsigned int sequence; } xcb_xkb_get_indicator_state_cookie_t; /** Opcode for xcb_xkb_get_indicator_state. */ #define XCB_XKB_GET_INDICATOR_STATE 12 /** * @brief xcb_xkb_get_indicator_state_request_t **/ typedef struct xcb_xkb_get_indicator_state_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; uint8_t pad0[2]; } xcb_xkb_get_indicator_state_request_t; /** * @brief xcb_xkb_get_indicator_state_reply_t **/ typedef struct xcb_xkb_get_indicator_state_reply_t { uint8_t response_type; uint8_t deviceID; uint16_t sequence; uint32_t length; uint32_t state; uint8_t pad0[20]; } xcb_xkb_get_indicator_state_reply_t; /** * @brief xcb_xkb_get_indicator_map_cookie_t **/ typedef struct xcb_xkb_get_indicator_map_cookie_t { unsigned int sequence; } xcb_xkb_get_indicator_map_cookie_t; /** Opcode for xcb_xkb_get_indicator_map. */ #define XCB_XKB_GET_INDICATOR_MAP 13 /** * @brief xcb_xkb_get_indicator_map_request_t **/ typedef struct xcb_xkb_get_indicator_map_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; uint8_t pad0[2]; uint32_t which; } xcb_xkb_get_indicator_map_request_t; /** * @brief xcb_xkb_get_indicator_map_reply_t **/ typedef struct xcb_xkb_get_indicator_map_reply_t { uint8_t response_type; uint8_t deviceID; uint16_t sequence; uint32_t length; uint32_t which; uint32_t realIndicators; uint8_t nIndicators; uint8_t pad0[15]; } xcb_xkb_get_indicator_map_reply_t; /** Opcode for xcb_xkb_set_indicator_map. */ #define XCB_XKB_SET_INDICATOR_MAP 14 /** * @brief xcb_xkb_set_indicator_map_request_t **/ typedef struct xcb_xkb_set_indicator_map_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; uint8_t pad0[2]; uint32_t which; } xcb_xkb_set_indicator_map_request_t; /** * @brief xcb_xkb_get_named_indicator_cookie_t **/ typedef struct xcb_xkb_get_named_indicator_cookie_t { unsigned int sequence; } xcb_xkb_get_named_indicator_cookie_t; /** Opcode for xcb_xkb_get_named_indicator. */ #define XCB_XKB_GET_NAMED_INDICATOR 15 /** * @brief xcb_xkb_get_named_indicator_request_t **/ typedef struct xcb_xkb_get_named_indicator_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; xcb_xkb_led_class_spec_t ledClass; xcb_xkb_id_spec_t ledID; uint8_t pad0[2]; xcb_atom_t indicator; } xcb_xkb_get_named_indicator_request_t; /** * @brief xcb_xkb_get_named_indicator_reply_t **/ typedef struct xcb_xkb_get_named_indicator_reply_t { uint8_t response_type; uint8_t deviceID; uint16_t sequence; uint32_t length; xcb_atom_t indicator; uint8_t found; uint8_t on; uint8_t realIndicator; uint8_t ndx; uint8_t map_flags; uint8_t map_whichGroups; uint8_t map_groups; uint8_t map_whichMods; uint8_t map_mods; uint8_t map_realMods; uint16_t map_vmod; uint32_t map_ctrls; uint8_t supported; uint8_t pad0[3]; } xcb_xkb_get_named_indicator_reply_t; /** Opcode for xcb_xkb_set_named_indicator. */ #define XCB_XKB_SET_NAMED_INDICATOR 16 /** * @brief xcb_xkb_set_named_indicator_request_t **/ typedef struct xcb_xkb_set_named_indicator_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; xcb_xkb_led_class_spec_t ledClass; xcb_xkb_id_spec_t ledID; uint8_t pad0[2]; xcb_atom_t indicator; uint8_t setState; uint8_t on; uint8_t setMap; uint8_t createMap; uint8_t pad1; uint8_t map_flags; uint8_t map_whichGroups; uint8_t map_groups; uint8_t map_whichMods; uint8_t map_realMods; uint16_t map_vmods; uint32_t map_ctrls; } xcb_xkb_set_named_indicator_request_t; /** * @brief xcb_xkb_get_names_cookie_t **/ typedef struct xcb_xkb_get_names_cookie_t { unsigned int sequence; } xcb_xkb_get_names_cookie_t; /** Opcode for xcb_xkb_get_names. */ #define XCB_XKB_GET_NAMES 17 /** * @brief xcb_xkb_get_names_request_t **/ typedef struct xcb_xkb_get_names_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; uint8_t pad0[2]; uint32_t which; } xcb_xkb_get_names_request_t; /** * @brief xcb_xkb_get_names_value_list_t **/ typedef struct xcb_xkb_get_names_value_list_t { xcb_atom_t keycodesName; xcb_atom_t geometryName; xcb_atom_t symbolsName; xcb_atom_t physSymbolsName; xcb_atom_t typesName; xcb_atom_t compatName; xcb_atom_t *typeNames; uint8_t *nLevelsPerType; uint8_t *pad1; xcb_atom_t *ktLevelNames; xcb_atom_t *indicatorNames; xcb_atom_t *virtualModNames; xcb_atom_t *groups; xcb_xkb_key_name_t *keyNames; xcb_xkb_key_alias_t *keyAliases; xcb_atom_t *radioGroupNames; } xcb_xkb_get_names_value_list_t; /** * @brief xcb_xkb_get_names_reply_t **/ typedef struct xcb_xkb_get_names_reply_t { uint8_t response_type; uint8_t deviceID; uint16_t sequence; uint32_t length; uint32_t which; xcb_keycode_t minKeyCode; xcb_keycode_t maxKeyCode; uint8_t nTypes; uint8_t groupNames; uint16_t virtualMods; xcb_keycode_t firstKey; uint8_t nKeys; uint32_t indicators; uint8_t nRadioGroups; uint8_t nKeyAliases; uint16_t nKTLevels; uint8_t pad0[4]; } xcb_xkb_get_names_reply_t; /** * @brief xcb_xkb_set_names_values_t **/ typedef struct xcb_xkb_set_names_values_t { xcb_atom_t keycodesName; xcb_atom_t geometryName; xcb_atom_t symbolsName; xcb_atom_t physSymbolsName; xcb_atom_t typesName; xcb_atom_t compatName; xcb_atom_t *typeNames; uint8_t *nLevelsPerType; xcb_atom_t *ktLevelNames; xcb_atom_t *indicatorNames; xcb_atom_t *virtualModNames; xcb_atom_t *groups; xcb_xkb_key_name_t *keyNames; xcb_xkb_key_alias_t *keyAliases; xcb_atom_t *radioGroupNames; } xcb_xkb_set_names_values_t; /** Opcode for xcb_xkb_set_names. */ #define XCB_XKB_SET_NAMES 18 /** * @brief xcb_xkb_set_names_request_t **/ typedef struct xcb_xkb_set_names_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; uint16_t virtualMods; uint32_t which; uint8_t firstType; uint8_t nTypes; uint8_t firstKTLevelt; uint8_t nKTLevels; uint32_t indicators; uint8_t groupNames; uint8_t nRadioGroups; xcb_keycode_t firstKey; uint8_t nKeys; uint8_t nKeyAliases; uint8_t pad0; uint16_t totalKTLevelNames; } xcb_xkb_set_names_request_t; /** * @brief xcb_xkb_per_client_flags_cookie_t **/ typedef struct xcb_xkb_per_client_flags_cookie_t { unsigned int sequence; } xcb_xkb_per_client_flags_cookie_t; /** Opcode for xcb_xkb_per_client_flags. */ #define XCB_XKB_PER_CLIENT_FLAGS 21 /** * @brief xcb_xkb_per_client_flags_request_t **/ typedef struct xcb_xkb_per_client_flags_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; uint8_t pad0[2]; uint32_t change; uint32_t value; uint32_t ctrlsToChange; uint32_t autoCtrls; uint32_t autoCtrlsValues; } xcb_xkb_per_client_flags_request_t; /** * @brief xcb_xkb_per_client_flags_reply_t **/ typedef struct xcb_xkb_per_client_flags_reply_t { uint8_t response_type; uint8_t deviceID; uint16_t sequence; uint32_t length; uint32_t supported; uint32_t value; uint32_t autoCtrls; uint32_t autoCtrlsValues; uint8_t pad0[8]; } xcb_xkb_per_client_flags_reply_t; /** * @brief xcb_xkb_list_components_cookie_t **/ typedef struct xcb_xkb_list_components_cookie_t { unsigned int sequence; } xcb_xkb_list_components_cookie_t; /** Opcode for xcb_xkb_list_components. */ #define XCB_XKB_LIST_COMPONENTS 22 /** * @brief xcb_xkb_list_components_request_t **/ typedef struct xcb_xkb_list_components_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; uint16_t maxNames; } xcb_xkb_list_components_request_t; /** * @brief xcb_xkb_list_components_reply_t **/ typedef struct xcb_xkb_list_components_reply_t { uint8_t response_type; uint8_t deviceID; uint16_t sequence; uint32_t length; uint16_t nKeymaps; uint16_t nKeycodes; uint16_t nTypes; uint16_t nCompatMaps; uint16_t nSymbols; uint16_t nGeometries; uint16_t extra; uint8_t pad0[10]; } xcb_xkb_list_components_reply_t; /** * @brief xcb_xkb_get_kbd_by_name_cookie_t **/ typedef struct xcb_xkb_get_kbd_by_name_cookie_t { unsigned int sequence; } xcb_xkb_get_kbd_by_name_cookie_t; /** Opcode for xcb_xkb_get_kbd_by_name. */ #define XCB_XKB_GET_KBD_BY_NAME 23 /** * @brief xcb_xkb_get_kbd_by_name_request_t **/ typedef struct xcb_xkb_get_kbd_by_name_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; uint16_t need; uint16_t want; uint8_t load; uint8_t pad0; } xcb_xkb_get_kbd_by_name_request_t; /** * @brief xcb_xkb_get_kbd_by_name_replies_types_map_t **/ typedef struct xcb_xkb_get_kbd_by_name_replies_types_map_t { xcb_xkb_key_type_t *types_rtrn; xcb_xkb_key_sym_map_t *syms_rtrn; uint8_t *acts_rtrn_count; xcb_xkb_action_t *acts_rtrn_acts; xcb_xkb_set_behavior_t *behaviors_rtrn; uint8_t *vmods_rtrn; xcb_xkb_set_explicit_t *explicit_rtrn; xcb_xkb_key_mod_map_t *modmap_rtrn; xcb_xkb_key_v_mod_map_t *vmodmap_rtrn; } xcb_xkb_get_kbd_by_name_replies_types_map_t; /** * @brief xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t **/ typedef struct xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t { xcb_atom_t keycodesName; xcb_atom_t geometryName; xcb_atom_t symbolsName; xcb_atom_t physSymbolsName; xcb_atom_t typesName; xcb_atom_t compatName; xcb_atom_t *typeNames; uint8_t *nLevelsPerType; xcb_atom_t *ktLevelNames; xcb_atom_t *indicatorNames; xcb_atom_t *virtualModNames; xcb_atom_t *groups; xcb_xkb_key_name_t *keyNames; xcb_xkb_key_alias_t *keyAliases; xcb_atom_t *radioGroupNames; } xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t; /** * @brief xcb_xkb_get_kbd_by_name_replies_t **/ typedef struct xcb_xkb_get_kbd_by_name_replies_t { struct { uint8_t getmap_type; uint8_t typeDeviceID; uint16_t getmap_sequence; uint32_t getmap_length; uint8_t pad1[2]; xcb_keycode_t typeMinKeyCode; xcb_keycode_t typeMaxKeyCode; uint16_t present; uint8_t firstType; uint8_t nTypes; uint8_t totalTypes; xcb_keycode_t firstKeySym; uint16_t totalSyms; uint8_t nKeySyms; xcb_keycode_t firstKeyAction; uint16_t totalActions; uint8_t nKeyActions; xcb_keycode_t firstKeyBehavior; uint8_t nKeyBehaviors; uint8_t totalKeyBehaviors; xcb_keycode_t firstKeyExplicit; uint8_t nKeyExplicit; uint8_t totalKeyExplicit; xcb_keycode_t firstModMapKey; uint8_t nModMapKeys; uint8_t totalModMapKeys; xcb_keycode_t firstVModMapKey; uint8_t nVModMapKeys; uint8_t totalVModMapKeys; uint8_t pad2; uint16_t virtualMods; xcb_xkb_get_kbd_by_name_replies_types_map_t map; } types; struct { uint8_t compatmap_type; uint8_t compatDeviceID; uint16_t compatmap_sequence; uint32_t compatmap_length; uint8_t groupsRtrn; uint8_t pad7; uint16_t firstSIRtrn; uint16_t nSIRtrn; uint16_t nTotalSI; uint8_t pad8[16]; xcb_xkb_sym_interpret_t *si_rtrn; xcb_xkb_mod_def_t *group_rtrn; } compat_map; struct { uint8_t indicatormap_type; uint8_t indicatorDeviceID; uint16_t indicatormap_sequence; uint32_t indicatormap_length; uint32_t which; uint32_t realIndicators; uint8_t nIndicators; uint8_t pad9[15]; xcb_xkb_indicator_map_t *maps; } indicator_maps; struct { uint8_t keyname_type; uint8_t keyDeviceID; uint16_t keyname_sequence; uint32_t keyname_length; uint32_t which; xcb_keycode_t keyMinKeyCode; xcb_keycode_t keyMaxKeyCode; uint8_t nTypes; uint8_t groupNames; uint16_t virtualMods; xcb_keycode_t firstKey; uint8_t nKeys; uint32_t indicators; uint8_t nRadioGroups; uint8_t nKeyAliases; uint16_t nKTLevels; uint8_t pad10[4]; xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t valueList; } key_names; struct { uint8_t geometry_type; uint8_t geometryDeviceID; uint16_t geometry_sequence; uint32_t geometry_length; xcb_atom_t name; uint8_t geometryFound; uint8_t pad12; uint16_t widthMM; uint16_t heightMM; uint16_t nProperties; uint16_t nColors; uint16_t nShapes; uint16_t nSections; uint16_t nDoodads; uint16_t nKeyAliases; uint8_t baseColorNdx; uint8_t labelColorNdx; xcb_xkb_counted_string_16_t *labelFont; } geometry; } xcb_xkb_get_kbd_by_name_replies_t; xcb_xkb_get_kbd_by_name_replies_types_map_t * xcb_xkb_get_kbd_by_name_replies_types_map (const xcb_xkb_get_kbd_by_name_replies_t *R); /** * @brief xcb_xkb_get_kbd_by_name_reply_t **/ typedef struct xcb_xkb_get_kbd_by_name_reply_t { uint8_t response_type; uint8_t deviceID; uint16_t sequence; uint32_t length; xcb_keycode_t minKeyCode; xcb_keycode_t maxKeyCode; uint8_t loaded; uint8_t newKeyboard; uint16_t found; uint16_t reported; uint8_t pad0[16]; } xcb_xkb_get_kbd_by_name_reply_t; /** * @brief xcb_xkb_get_device_info_cookie_t **/ typedef struct xcb_xkb_get_device_info_cookie_t { unsigned int sequence; } xcb_xkb_get_device_info_cookie_t; /** Opcode for xcb_xkb_get_device_info. */ #define XCB_XKB_GET_DEVICE_INFO 24 /** * @brief xcb_xkb_get_device_info_request_t **/ typedef struct xcb_xkb_get_device_info_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; uint16_t wanted; uint8_t allButtons; uint8_t firstButton; uint8_t nButtons; uint8_t pad0; xcb_xkb_led_class_spec_t ledClass; xcb_xkb_id_spec_t ledID; } xcb_xkb_get_device_info_request_t; /** * @brief xcb_xkb_get_device_info_reply_t **/ typedef struct xcb_xkb_get_device_info_reply_t { uint8_t response_type; uint8_t deviceID; uint16_t sequence; uint32_t length; uint16_t present; uint16_t supported; uint16_t unsupported; uint16_t nDeviceLedFBs; uint8_t firstBtnWanted; uint8_t nBtnsWanted; uint8_t firstBtnRtrn; uint8_t nBtnsRtrn; uint8_t totalBtns; uint8_t hasOwnState; uint16_t dfltKbdFB; uint16_t dfltLedFB; uint8_t pad0[2]; xcb_atom_t devType; uint16_t nameLen; } xcb_xkb_get_device_info_reply_t; /** Opcode for xcb_xkb_set_device_info. */ #define XCB_XKB_SET_DEVICE_INFO 25 /** * @brief xcb_xkb_set_device_info_request_t **/ typedef struct xcb_xkb_set_device_info_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xkb_device_spec_t deviceSpec; uint8_t firstBtn; uint8_t nBtns; uint16_t change; uint16_t nDeviceLedFBs; } xcb_xkb_set_device_info_request_t; /** * @brief xcb_xkb_set_debugging_flags_cookie_t **/ typedef struct xcb_xkb_set_debugging_flags_cookie_t { unsigned int sequence; } xcb_xkb_set_debugging_flags_cookie_t; /** Opcode for xcb_xkb_set_debugging_flags. */ #define XCB_XKB_SET_DEBUGGING_FLAGS 101 /** * @brief xcb_xkb_set_debugging_flags_request_t **/ typedef struct xcb_xkb_set_debugging_flags_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint16_t msgLength; uint8_t pad0[2]; uint32_t affectFlags; uint32_t flags; uint32_t affectCtrls; uint32_t ctrls; } xcb_xkb_set_debugging_flags_request_t; /** * @brief xcb_xkb_set_debugging_flags_reply_t **/ typedef struct xcb_xkb_set_debugging_flags_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t currentFlags; uint32_t currentCtrls; uint32_t supportedFlags; uint32_t supportedCtrls; uint8_t pad1[8]; } xcb_xkb_set_debugging_flags_reply_t; /** Opcode for xcb_xkb_new_keyboard_notify. */ #define XCB_XKB_NEW_KEYBOARD_NOTIFY 0 /** * @brief xcb_xkb_new_keyboard_notify_event_t **/ typedef struct xcb_xkb_new_keyboard_notify_event_t { uint8_t response_type; uint8_t xkbType; uint16_t sequence; xcb_timestamp_t time; uint8_t deviceID; uint8_t oldDeviceID; xcb_keycode_t minKeyCode; xcb_keycode_t maxKeyCode; xcb_keycode_t oldMinKeyCode; xcb_keycode_t oldMaxKeyCode; uint8_t requestMajor; uint8_t requestMinor; uint16_t changed; uint8_t pad0[14]; } xcb_xkb_new_keyboard_notify_event_t; /** Opcode for xcb_xkb_map_notify. */ #define XCB_XKB_MAP_NOTIFY 1 /** * @brief xcb_xkb_map_notify_event_t **/ typedef struct xcb_xkb_map_notify_event_t { uint8_t response_type; uint8_t xkbType; uint16_t sequence; xcb_timestamp_t time; uint8_t deviceID; uint8_t ptrBtnActions; uint16_t changed; xcb_keycode_t minKeyCode; xcb_keycode_t maxKeyCode; uint8_t firstType; uint8_t nTypes; xcb_keycode_t firstKeySym; uint8_t nKeySyms; xcb_keycode_t firstKeyAct; uint8_t nKeyActs; xcb_keycode_t firstKeyBehavior; uint8_t nKeyBehavior; xcb_keycode_t firstKeyExplicit; uint8_t nKeyExplicit; xcb_keycode_t firstModMapKey; uint8_t nModMapKeys; xcb_keycode_t firstVModMapKey; uint8_t nVModMapKeys; uint16_t virtualMods; uint8_t pad0[2]; } xcb_xkb_map_notify_event_t; /** Opcode for xcb_xkb_state_notify. */ #define XCB_XKB_STATE_NOTIFY 2 /** * @brief xcb_xkb_state_notify_event_t **/ typedef struct xcb_xkb_state_notify_event_t { uint8_t response_type; uint8_t xkbType; uint16_t sequence; xcb_timestamp_t time; uint8_t deviceID; uint8_t mods; uint8_t baseMods; uint8_t latchedMods; uint8_t lockedMods; uint8_t group; int16_t baseGroup; int16_t latchedGroup; uint8_t lockedGroup; uint8_t compatState; uint8_t grabMods; uint8_t compatGrabMods; uint8_t lookupMods; uint8_t compatLoockupMods; uint16_t ptrBtnState; uint16_t changed; xcb_keycode_t keycode; uint8_t eventType; uint8_t requestMajor; uint8_t requestMinor; } xcb_xkb_state_notify_event_t; /** Opcode for xcb_xkb_controls_notify. */ #define XCB_XKB_CONTROLS_NOTIFY 3 /** * @brief xcb_xkb_controls_notify_event_t **/ typedef struct xcb_xkb_controls_notify_event_t { uint8_t response_type; uint8_t xkbType; uint16_t sequence; xcb_timestamp_t time; uint8_t deviceID; uint8_t numGroups; uint8_t pad0[2]; uint32_t changedControls; uint32_t enabledControls; uint32_t enabledControlChanges; xcb_keycode_t keycode; uint8_t eventType; uint8_t requestMajor; uint8_t requestMinor; uint8_t pad1[4]; } xcb_xkb_controls_notify_event_t; /** Opcode for xcb_xkb_indicator_state_notify. */ #define XCB_XKB_INDICATOR_STATE_NOTIFY 4 /** * @brief xcb_xkb_indicator_state_notify_event_t **/ typedef struct xcb_xkb_indicator_state_notify_event_t { uint8_t response_type; uint8_t xkbType; uint16_t sequence; xcb_timestamp_t time; uint8_t deviceID; uint8_t pad0[3]; uint32_t state; uint32_t stateChanged; uint8_t pad1[12]; } xcb_xkb_indicator_state_notify_event_t; /** Opcode for xcb_xkb_indicator_map_notify. */ #define XCB_XKB_INDICATOR_MAP_NOTIFY 5 /** * @brief xcb_xkb_indicator_map_notify_event_t **/ typedef struct xcb_xkb_indicator_map_notify_event_t { uint8_t response_type; uint8_t xkbType; uint16_t sequence; xcb_timestamp_t time; uint8_t deviceID; uint8_t pad0[3]; uint32_t state; uint32_t mapChanged; uint8_t pad1[12]; } xcb_xkb_indicator_map_notify_event_t; /** Opcode for xcb_xkb_names_notify. */ #define XCB_XKB_NAMES_NOTIFY 6 /** * @brief xcb_xkb_names_notify_event_t **/ typedef struct xcb_xkb_names_notify_event_t { uint8_t response_type; uint8_t xkbType; uint16_t sequence; xcb_timestamp_t time; uint8_t deviceID; uint8_t pad0; uint16_t changed; uint8_t firstType; uint8_t nTypes; uint8_t firstLevelName; uint8_t nLevelNames; uint8_t pad1; uint8_t nRadioGroups; uint8_t nKeyAliases; uint8_t changedGroupNames; uint16_t changedVirtualMods; xcb_keycode_t firstKey; uint8_t nKeys; uint32_t changedIndicators; uint8_t pad2[4]; } xcb_xkb_names_notify_event_t; /** Opcode for xcb_xkb_compat_map_notify. */ #define XCB_XKB_COMPAT_MAP_NOTIFY 7 /** * @brief xcb_xkb_compat_map_notify_event_t **/ typedef struct xcb_xkb_compat_map_notify_event_t { uint8_t response_type; uint8_t xkbType; uint16_t sequence; xcb_timestamp_t time; uint8_t deviceID; uint8_t changedGroups; uint16_t firstSI; uint16_t nSI; uint16_t nTotalSI; uint8_t pad0[16]; } xcb_xkb_compat_map_notify_event_t; /** Opcode for xcb_xkb_bell_notify. */ #define XCB_XKB_BELL_NOTIFY 8 /** * @brief xcb_xkb_bell_notify_event_t **/ typedef struct xcb_xkb_bell_notify_event_t { uint8_t response_type; uint8_t xkbType; uint16_t sequence; xcb_timestamp_t time; uint8_t deviceID; uint8_t bellClass; uint8_t bellID; uint8_t percent; uint16_t pitch; uint16_t duration; xcb_atom_t name; xcb_window_t window; uint8_t eventOnly; uint8_t pad0[7]; } xcb_xkb_bell_notify_event_t; /** Opcode for xcb_xkb_action_message. */ #define XCB_XKB_ACTION_MESSAGE 9 /** * @brief xcb_xkb_action_message_event_t **/ typedef struct xcb_xkb_action_message_event_t { uint8_t response_type; uint8_t xkbType; uint16_t sequence; xcb_timestamp_t time; uint8_t deviceID; xcb_keycode_t keycode; uint8_t press; uint8_t keyEventFollows; uint8_t mods; uint8_t group; xcb_xkb_string8_t message[8]; uint8_t pad0[10]; } xcb_xkb_action_message_event_t; /** Opcode for xcb_xkb_access_x_notify. */ #define XCB_XKB_ACCESS_X_NOTIFY 10 /** * @brief xcb_xkb_access_x_notify_event_t **/ typedef struct xcb_xkb_access_x_notify_event_t { uint8_t response_type; uint8_t xkbType; uint16_t sequence; xcb_timestamp_t time; uint8_t deviceID; xcb_keycode_t keycode; uint16_t detailt; uint16_t slowKeysDelay; uint16_t debounceDelay; uint8_t pad0[16]; } xcb_xkb_access_x_notify_event_t; /** Opcode for xcb_xkb_extension_device_notify. */ #define XCB_XKB_EXTENSION_DEVICE_NOTIFY 11 /** * @brief xcb_xkb_extension_device_notify_event_t **/ typedef struct xcb_xkb_extension_device_notify_event_t { uint8_t response_type; uint8_t xkbType; uint16_t sequence; xcb_timestamp_t time; uint8_t deviceID; uint8_t pad0; uint16_t reason; uint16_t ledClass; uint16_t ledID; uint32_t ledsDefined; uint32_t ledState; uint8_t firstButton; uint8_t nButtons; uint16_t supported; uint16_t unsupported; uint8_t pad1[2]; } xcb_xkb_extension_device_notify_event_t; /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_device_spec_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_device_spec_t) */ void xcb_xkb_device_spec_next (xcb_xkb_device_spec_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_device_spec_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_device_spec_end (xcb_xkb_device_spec_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_led_class_spec_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_led_class_spec_t) */ void xcb_xkb_led_class_spec_next (xcb_xkb_led_class_spec_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_led_class_spec_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_led_class_spec_end (xcb_xkb_led_class_spec_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_bell_class_spec_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_bell_class_spec_t) */ void xcb_xkb_bell_class_spec_next (xcb_xkb_bell_class_spec_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_bell_class_spec_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_bell_class_spec_end (xcb_xkb_bell_class_spec_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_id_spec_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_id_spec_t) */ void xcb_xkb_id_spec_next (xcb_xkb_id_spec_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_id_spec_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_id_spec_end (xcb_xkb_id_spec_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_indicator_map_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_indicator_map_t) */ void xcb_xkb_indicator_map_next (xcb_xkb_indicator_map_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_indicator_map_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_indicator_map_end (xcb_xkb_indicator_map_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_mod_def_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_mod_def_t) */ void xcb_xkb_mod_def_next (xcb_xkb_mod_def_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_mod_def_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_mod_def_end (xcb_xkb_mod_def_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_key_name_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_key_name_t) */ void xcb_xkb_key_name_next (xcb_xkb_key_name_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_key_name_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_key_name_end (xcb_xkb_key_name_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_key_alias_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_key_alias_t) */ void xcb_xkb_key_alias_next (xcb_xkb_key_alias_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_key_alias_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_key_alias_end (xcb_xkb_key_alias_iterator_t i); int xcb_xkb_counted_string_16_sizeof (const void *_buffer); char * xcb_xkb_counted_string_16_string (const xcb_xkb_counted_string_16_t *R); int xcb_xkb_counted_string_16_string_length (const xcb_xkb_counted_string_16_t *R); xcb_generic_iterator_t xcb_xkb_counted_string_16_string_end (const xcb_xkb_counted_string_16_t *R); void * xcb_xkb_counted_string_16_alignment_pad (const xcb_xkb_counted_string_16_t *R); int xcb_xkb_counted_string_16_alignment_pad_length (const xcb_xkb_counted_string_16_t *R); xcb_generic_iterator_t xcb_xkb_counted_string_16_alignment_pad_end (const xcb_xkb_counted_string_16_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_counted_string_16_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_counted_string_16_t) */ void xcb_xkb_counted_string_16_next (xcb_xkb_counted_string_16_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_counted_string_16_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_counted_string_16_end (xcb_xkb_counted_string_16_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_kt_map_entry_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_kt_map_entry_t) */ void xcb_xkb_kt_map_entry_next (xcb_xkb_kt_map_entry_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_kt_map_entry_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_kt_map_entry_end (xcb_xkb_kt_map_entry_iterator_t i); int xcb_xkb_key_type_sizeof (const void *_buffer); xcb_xkb_kt_map_entry_t * xcb_xkb_key_type_map (const xcb_xkb_key_type_t *R); int xcb_xkb_key_type_map_length (const xcb_xkb_key_type_t *R); xcb_xkb_kt_map_entry_iterator_t xcb_xkb_key_type_map_iterator (const xcb_xkb_key_type_t *R); xcb_xkb_mod_def_t * xcb_xkb_key_type_preserve (const xcb_xkb_key_type_t *R); int xcb_xkb_key_type_preserve_length (const xcb_xkb_key_type_t *R); xcb_xkb_mod_def_iterator_t xcb_xkb_key_type_preserve_iterator (const xcb_xkb_key_type_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_key_type_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_key_type_t) */ void xcb_xkb_key_type_next (xcb_xkb_key_type_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_key_type_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_key_type_end (xcb_xkb_key_type_iterator_t i); int xcb_xkb_key_sym_map_sizeof (const void *_buffer); xcb_keysym_t * xcb_xkb_key_sym_map_syms (const xcb_xkb_key_sym_map_t *R); int xcb_xkb_key_sym_map_syms_length (const xcb_xkb_key_sym_map_t *R); xcb_generic_iterator_t xcb_xkb_key_sym_map_syms_end (const xcb_xkb_key_sym_map_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_key_sym_map_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_key_sym_map_t) */ void xcb_xkb_key_sym_map_next (xcb_xkb_key_sym_map_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_key_sym_map_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_key_sym_map_end (xcb_xkb_key_sym_map_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_common_behavior_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_common_behavior_t) */ void xcb_xkb_common_behavior_next (xcb_xkb_common_behavior_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_common_behavior_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_common_behavior_end (xcb_xkb_common_behavior_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_default_behavior_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_default_behavior_t) */ void xcb_xkb_default_behavior_next (xcb_xkb_default_behavior_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_default_behavior_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_default_behavior_end (xcb_xkb_default_behavior_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_lock_behavior_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_lock_behavior_t) */ void xcb_xkb_lock_behavior_next (xcb_xkb_lock_behavior_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_lock_behavior_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_lock_behavior_end (xcb_xkb_lock_behavior_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_radio_group_behavior_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_radio_group_behavior_t) */ void xcb_xkb_radio_group_behavior_next (xcb_xkb_radio_group_behavior_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_radio_group_behavior_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_radio_group_behavior_end (xcb_xkb_radio_group_behavior_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_overlay_behavior_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_overlay_behavior_t) */ void xcb_xkb_overlay_behavior_next (xcb_xkb_overlay_behavior_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_overlay_behavior_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_overlay_behavior_end (xcb_xkb_overlay_behavior_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_permament_lock_behavior_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_permament_lock_behavior_t) */ void xcb_xkb_permament_lock_behavior_next (xcb_xkb_permament_lock_behavior_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_permament_lock_behavior_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_permament_lock_behavior_end (xcb_xkb_permament_lock_behavior_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_permament_radio_group_behavior_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_permament_radio_group_behavior_t) */ void xcb_xkb_permament_radio_group_behavior_next (xcb_xkb_permament_radio_group_behavior_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_permament_radio_group_behavior_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_permament_radio_group_behavior_end (xcb_xkb_permament_radio_group_behavior_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_permament_overlay_behavior_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_permament_overlay_behavior_t) */ void xcb_xkb_permament_overlay_behavior_next (xcb_xkb_permament_overlay_behavior_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_permament_overlay_behavior_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_permament_overlay_behavior_end (xcb_xkb_permament_overlay_behavior_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_behavior_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_behavior_t) */ void xcb_xkb_behavior_next (xcb_xkb_behavior_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_behavior_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_behavior_end (xcb_xkb_behavior_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_set_behavior_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_set_behavior_t) */ void xcb_xkb_set_behavior_next (xcb_xkb_set_behavior_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_set_behavior_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_set_behavior_end (xcb_xkb_set_behavior_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_set_explicit_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_set_explicit_t) */ void xcb_xkb_set_explicit_next (xcb_xkb_set_explicit_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_set_explicit_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_set_explicit_end (xcb_xkb_set_explicit_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_key_mod_map_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_key_mod_map_t) */ void xcb_xkb_key_mod_map_next (xcb_xkb_key_mod_map_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_key_mod_map_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_key_mod_map_end (xcb_xkb_key_mod_map_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_key_v_mod_map_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_key_v_mod_map_t) */ void xcb_xkb_key_v_mod_map_next (xcb_xkb_key_v_mod_map_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_key_v_mod_map_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_key_v_mod_map_end (xcb_xkb_key_v_mod_map_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_kt_set_map_entry_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_kt_set_map_entry_t) */ void xcb_xkb_kt_set_map_entry_next (xcb_xkb_kt_set_map_entry_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_kt_set_map_entry_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_kt_set_map_entry_end (xcb_xkb_kt_set_map_entry_iterator_t i); int xcb_xkb_set_key_type_sizeof (const void *_buffer); xcb_xkb_kt_set_map_entry_t * xcb_xkb_set_key_type_entries (const xcb_xkb_set_key_type_t *R); int xcb_xkb_set_key_type_entries_length (const xcb_xkb_set_key_type_t *R); xcb_xkb_kt_set_map_entry_iterator_t xcb_xkb_set_key_type_entries_iterator (const xcb_xkb_set_key_type_t *R); xcb_xkb_kt_set_map_entry_t * xcb_xkb_set_key_type_preserve_entries (const xcb_xkb_set_key_type_t *R); int xcb_xkb_set_key_type_preserve_entries_length (const xcb_xkb_set_key_type_t *R); xcb_xkb_kt_set_map_entry_iterator_t xcb_xkb_set_key_type_preserve_entries_iterator (const xcb_xkb_set_key_type_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_set_key_type_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_set_key_type_t) */ void xcb_xkb_set_key_type_next (xcb_xkb_set_key_type_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_set_key_type_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_set_key_type_end (xcb_xkb_set_key_type_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_string8_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_string8_t) */ void xcb_xkb_string8_next (xcb_xkb_string8_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_string8_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_string8_end (xcb_xkb_string8_iterator_t i); int xcb_xkb_outline_sizeof (const void *_buffer); xcb_point_t * xcb_xkb_outline_points (const xcb_xkb_outline_t *R); int xcb_xkb_outline_points_length (const xcb_xkb_outline_t *R); xcb_point_iterator_t xcb_xkb_outline_points_iterator (const xcb_xkb_outline_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_outline_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_outline_t) */ void xcb_xkb_outline_next (xcb_xkb_outline_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_outline_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_outline_end (xcb_xkb_outline_iterator_t i); int xcb_xkb_shape_sizeof (const void *_buffer); int xcb_xkb_shape_outlines_length (const xcb_xkb_shape_t *R); xcb_xkb_outline_iterator_t xcb_xkb_shape_outlines_iterator (const xcb_xkb_shape_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_shape_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_shape_t) */ void xcb_xkb_shape_next (xcb_xkb_shape_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_shape_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_shape_end (xcb_xkb_shape_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_key_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_key_t) */ void xcb_xkb_key_next (xcb_xkb_key_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_key_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_key_end (xcb_xkb_key_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_overlay_key_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_overlay_key_t) */ void xcb_xkb_overlay_key_next (xcb_xkb_overlay_key_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_overlay_key_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_overlay_key_end (xcb_xkb_overlay_key_iterator_t i); int xcb_xkb_overlay_row_sizeof (const void *_buffer); xcb_xkb_overlay_key_t * xcb_xkb_overlay_row_keys (const xcb_xkb_overlay_row_t *R); int xcb_xkb_overlay_row_keys_length (const xcb_xkb_overlay_row_t *R); xcb_xkb_overlay_key_iterator_t xcb_xkb_overlay_row_keys_iterator (const xcb_xkb_overlay_row_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_overlay_row_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_overlay_row_t) */ void xcb_xkb_overlay_row_next (xcb_xkb_overlay_row_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_overlay_row_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_overlay_row_end (xcb_xkb_overlay_row_iterator_t i); int xcb_xkb_overlay_sizeof (const void *_buffer); int xcb_xkb_overlay_rows_length (const xcb_xkb_overlay_t *R); xcb_xkb_overlay_row_iterator_t xcb_xkb_overlay_rows_iterator (const xcb_xkb_overlay_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_overlay_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_overlay_t) */ void xcb_xkb_overlay_next (xcb_xkb_overlay_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_overlay_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_overlay_end (xcb_xkb_overlay_iterator_t i); int xcb_xkb_row_sizeof (const void *_buffer); xcb_xkb_key_t * xcb_xkb_row_keys (const xcb_xkb_row_t *R); int xcb_xkb_row_keys_length (const xcb_xkb_row_t *R); xcb_xkb_key_iterator_t xcb_xkb_row_keys_iterator (const xcb_xkb_row_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_row_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_row_t) */ void xcb_xkb_row_next (xcb_xkb_row_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_row_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_row_end (xcb_xkb_row_iterator_t i); int xcb_xkb_listing_sizeof (const void *_buffer); xcb_xkb_string8_t * xcb_xkb_listing_string (const xcb_xkb_listing_t *R); int xcb_xkb_listing_string_length (const xcb_xkb_listing_t *R); xcb_generic_iterator_t xcb_xkb_listing_string_end (const xcb_xkb_listing_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_listing_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_listing_t) */ void xcb_xkb_listing_next (xcb_xkb_listing_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_listing_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_listing_end (xcb_xkb_listing_iterator_t i); int xcb_xkb_device_led_info_sizeof (const void *_buffer); xcb_atom_t * xcb_xkb_device_led_info_names (const xcb_xkb_device_led_info_t *R); int xcb_xkb_device_led_info_names_length (const xcb_xkb_device_led_info_t *R); xcb_generic_iterator_t xcb_xkb_device_led_info_names_end (const xcb_xkb_device_led_info_t *R); xcb_xkb_indicator_map_t * xcb_xkb_device_led_info_maps (const xcb_xkb_device_led_info_t *R); int xcb_xkb_device_led_info_maps_length (const xcb_xkb_device_led_info_t *R); xcb_xkb_indicator_map_iterator_t xcb_xkb_device_led_info_maps_iterator (const xcb_xkb_device_led_info_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_device_led_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_device_led_info_t) */ void xcb_xkb_device_led_info_next (xcb_xkb_device_led_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_device_led_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_device_led_info_end (xcb_xkb_device_led_info_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_no_action_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_no_action_t) */ void xcb_xkb_sa_no_action_next (xcb_xkb_sa_no_action_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_no_action_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_no_action_end (xcb_xkb_sa_no_action_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_set_mods_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_set_mods_t) */ void xcb_xkb_sa_set_mods_next (xcb_xkb_sa_set_mods_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_set_mods_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_set_mods_end (xcb_xkb_sa_set_mods_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_latch_mods_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_latch_mods_t) */ void xcb_xkb_sa_latch_mods_next (xcb_xkb_sa_latch_mods_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_latch_mods_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_latch_mods_end (xcb_xkb_sa_latch_mods_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_lock_mods_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_lock_mods_t) */ void xcb_xkb_sa_lock_mods_next (xcb_xkb_sa_lock_mods_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_lock_mods_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_lock_mods_end (xcb_xkb_sa_lock_mods_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_set_group_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_set_group_t) */ void xcb_xkb_sa_set_group_next (xcb_xkb_sa_set_group_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_set_group_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_set_group_end (xcb_xkb_sa_set_group_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_latch_group_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_latch_group_t) */ void xcb_xkb_sa_latch_group_next (xcb_xkb_sa_latch_group_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_latch_group_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_latch_group_end (xcb_xkb_sa_latch_group_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_lock_group_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_lock_group_t) */ void xcb_xkb_sa_lock_group_next (xcb_xkb_sa_lock_group_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_lock_group_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_lock_group_end (xcb_xkb_sa_lock_group_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_move_ptr_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_move_ptr_t) */ void xcb_xkb_sa_move_ptr_next (xcb_xkb_sa_move_ptr_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_move_ptr_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_move_ptr_end (xcb_xkb_sa_move_ptr_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_ptr_btn_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_ptr_btn_t) */ void xcb_xkb_sa_ptr_btn_next (xcb_xkb_sa_ptr_btn_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_ptr_btn_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_ptr_btn_end (xcb_xkb_sa_ptr_btn_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_lock_ptr_btn_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_lock_ptr_btn_t) */ void xcb_xkb_sa_lock_ptr_btn_next (xcb_xkb_sa_lock_ptr_btn_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_lock_ptr_btn_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_lock_ptr_btn_end (xcb_xkb_sa_lock_ptr_btn_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_set_ptr_dflt_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_set_ptr_dflt_t) */ void xcb_xkb_sa_set_ptr_dflt_next (xcb_xkb_sa_set_ptr_dflt_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_set_ptr_dflt_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_set_ptr_dflt_end (xcb_xkb_sa_set_ptr_dflt_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_iso_lock_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_iso_lock_t) */ void xcb_xkb_sa_iso_lock_next (xcb_xkb_sa_iso_lock_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_iso_lock_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_iso_lock_end (xcb_xkb_sa_iso_lock_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_terminate_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_terminate_t) */ void xcb_xkb_sa_terminate_next (xcb_xkb_sa_terminate_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_terminate_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_terminate_end (xcb_xkb_sa_terminate_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_switch_screen_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_switch_screen_t) */ void xcb_xkb_sa_switch_screen_next (xcb_xkb_sa_switch_screen_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_switch_screen_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_switch_screen_end (xcb_xkb_sa_switch_screen_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_set_controls_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_set_controls_t) */ void xcb_xkb_sa_set_controls_next (xcb_xkb_sa_set_controls_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_set_controls_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_set_controls_end (xcb_xkb_sa_set_controls_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_lock_controls_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_lock_controls_t) */ void xcb_xkb_sa_lock_controls_next (xcb_xkb_sa_lock_controls_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_lock_controls_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_lock_controls_end (xcb_xkb_sa_lock_controls_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_action_message_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_action_message_t) */ void xcb_xkb_sa_action_message_next (xcb_xkb_sa_action_message_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_action_message_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_action_message_end (xcb_xkb_sa_action_message_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_redirect_key_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_redirect_key_t) */ void xcb_xkb_sa_redirect_key_next (xcb_xkb_sa_redirect_key_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_redirect_key_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_redirect_key_end (xcb_xkb_sa_redirect_key_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_device_btn_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_device_btn_t) */ void xcb_xkb_sa_device_btn_next (xcb_xkb_sa_device_btn_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_device_btn_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_device_btn_end (xcb_xkb_sa_device_btn_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_lock_device_btn_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_lock_device_btn_t) */ void xcb_xkb_sa_lock_device_btn_next (xcb_xkb_sa_lock_device_btn_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_lock_device_btn_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_lock_device_btn_end (xcb_xkb_sa_lock_device_btn_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sa_device_valuator_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sa_device_valuator_t) */ void xcb_xkb_sa_device_valuator_next (xcb_xkb_sa_device_valuator_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sa_device_valuator_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sa_device_valuator_end (xcb_xkb_sa_device_valuator_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_si_action_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_si_action_t) */ void xcb_xkb_si_action_next (xcb_xkb_si_action_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_si_action_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_si_action_end (xcb_xkb_si_action_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_sym_interpret_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_sym_interpret_t) */ void xcb_xkb_sym_interpret_next (xcb_xkb_sym_interpret_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_sym_interpret_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_sym_interpret_end (xcb_xkb_sym_interpret_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_action_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xkb_action_t) */ void xcb_xkb_action_next (xcb_xkb_action_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xkb_action_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xkb_action_end (xcb_xkb_action_iterator_t i); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xkb_use_extension_cookie_t xcb_xkb_use_extension (xcb_connection_t *c, uint16_t wantedMajor, uint16_t wantedMinor); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xkb_use_extension_cookie_t xcb_xkb_use_extension_unchecked (xcb_connection_t *c, uint16_t wantedMajor, uint16_t wantedMinor); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xkb_use_extension_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xkb_use_extension_reply_t * xcb_xkb_use_extension_reply (xcb_connection_t *c, xcb_xkb_use_extension_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xkb_select_events_details_serialize (void **_buffer, uint16_t affectWhich, uint16_t clear, uint16_t selectAll, const xcb_xkb_select_events_details_t *_aux); int xcb_xkb_select_events_details_unpack (const void *_buffer, uint16_t affectWhich, uint16_t clear, uint16_t selectAll, xcb_xkb_select_events_details_t *_aux); int xcb_xkb_select_events_details_sizeof (const void *_buffer, uint16_t affectWhich, uint16_t clear, uint16_t selectAll); int xcb_xkb_select_events_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xkb_select_events_checked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t affectWhich, uint16_t clear, uint16_t selectAll, uint16_t affectMap, uint16_t map, const void *details); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xkb_select_events (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t affectWhich, uint16_t clear, uint16_t selectAll, uint16_t affectMap, uint16_t map, const void *details); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xkb_select_events_aux_checked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t affectWhich, uint16_t clear, uint16_t selectAll, uint16_t affectMap, uint16_t map, const xcb_xkb_select_events_details_t *details); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xkb_select_events_aux (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t affectWhich, uint16_t clear, uint16_t selectAll, uint16_t affectMap, uint16_t map, const xcb_xkb_select_events_details_t *details); void * xcb_xkb_select_events_details (const xcb_xkb_select_events_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xkb_bell_checked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, xcb_xkb_bell_class_spec_t bellClass, xcb_xkb_id_spec_t bellID, int8_t percent, uint8_t forceSound, uint8_t eventOnly, int16_t pitch, int16_t duration, xcb_atom_t name, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xkb_bell (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, xcb_xkb_bell_class_spec_t bellClass, xcb_xkb_id_spec_t bellID, int8_t percent, uint8_t forceSound, uint8_t eventOnly, int16_t pitch, int16_t duration, xcb_atom_t name, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xkb_get_state_cookie_t xcb_xkb_get_state (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xkb_get_state_cookie_t xcb_xkb_get_state_unchecked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xkb_get_state_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xkb_get_state_reply_t * xcb_xkb_get_state_reply (xcb_connection_t *c, xcb_xkb_get_state_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xkb_latch_lock_state_checked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint8_t affectModLocks, uint8_t modLocks, uint8_t lockGroup, uint8_t groupLock, uint8_t affectModLatches, uint8_t latchGroup, uint16_t groupLatch); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xkb_latch_lock_state (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint8_t affectModLocks, uint8_t modLocks, uint8_t lockGroup, uint8_t groupLock, uint8_t affectModLatches, uint8_t latchGroup, uint16_t groupLatch); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xkb_get_controls_cookie_t xcb_xkb_get_controls (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xkb_get_controls_cookie_t xcb_xkb_get_controls_unchecked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xkb_get_controls_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xkb_get_controls_reply_t * xcb_xkb_get_controls_reply (xcb_connection_t *c, xcb_xkb_get_controls_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xkb_set_controls_checked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint8_t affectInternalRealMods, uint8_t internalRealMods, uint8_t affectIgnoreLockRealMods, uint8_t ignoreLockRealMods, uint16_t affectInternalVirtualMods, uint16_t internalVirtualMods, uint16_t affectIgnoreLockVirtualMods, uint16_t ignoreLockVirtualMods, uint8_t mouseKeysDfltBtn, uint8_t groupsWrap, uint16_t accessXOptions, uint32_t affectEnabledControls, uint32_t enabledControls, uint32_t changeControls, uint16_t repeatDelay, uint16_t repeatInterval, uint16_t slowKeysDelay, uint16_t debounceDelay, uint16_t mouseKeysDelay, uint16_t mouseKeysInterval, uint16_t mouseKeysTimeToMax, uint16_t mouseKeysMaxSpeed, int16_t mouseKeysCurve, uint16_t accessXTimeout, uint32_t accessXTimeoutMask, uint32_t accessXTimeoutValues, uint16_t accessXTimeoutOptionsMask, uint16_t accessXTimeoutOptionsValues, const uint8_t *perKeyRepeat); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xkb_set_controls (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint8_t affectInternalRealMods, uint8_t internalRealMods, uint8_t affectIgnoreLockRealMods, uint8_t ignoreLockRealMods, uint16_t affectInternalVirtualMods, uint16_t internalVirtualMods, uint16_t affectIgnoreLockVirtualMods, uint16_t ignoreLockVirtualMods, uint8_t mouseKeysDfltBtn, uint8_t groupsWrap, uint16_t accessXOptions, uint32_t affectEnabledControls, uint32_t enabledControls, uint32_t changeControls, uint16_t repeatDelay, uint16_t repeatInterval, uint16_t slowKeysDelay, uint16_t debounceDelay, uint16_t mouseKeysDelay, uint16_t mouseKeysInterval, uint16_t mouseKeysTimeToMax, uint16_t mouseKeysMaxSpeed, int16_t mouseKeysCurve, uint16_t accessXTimeout, uint32_t accessXTimeoutMask, uint32_t accessXTimeoutValues, uint16_t accessXTimeoutOptionsMask, uint16_t accessXTimeoutOptionsValues, const uint8_t *perKeyRepeat); int xcb_xkb_get_map_map_types_rtrn_length (const xcb_xkb_get_map_reply_t *R, const xcb_xkb_get_map_map_t *S); xcb_xkb_key_type_iterator_t xcb_xkb_get_map_map_types_rtrn_iterator (const xcb_xkb_get_map_reply_t *R, const xcb_xkb_get_map_map_t *S); int xcb_xkb_get_map_map_syms_rtrn_length (const xcb_xkb_get_map_reply_t *R, const xcb_xkb_get_map_map_t *S); xcb_xkb_key_sym_map_iterator_t xcb_xkb_get_map_map_syms_rtrn_iterator (const xcb_xkb_get_map_reply_t *R, const xcb_xkb_get_map_map_t *S); uint8_t * xcb_xkb_get_map_map_acts_rtrn_count (const xcb_xkb_get_map_map_t *S); int xcb_xkb_get_map_map_acts_rtrn_count_length (const xcb_xkb_get_map_reply_t *R, const xcb_xkb_get_map_map_t *S); xcb_generic_iterator_t xcb_xkb_get_map_map_acts_rtrn_count_end (const xcb_xkb_get_map_reply_t *R, const xcb_xkb_get_map_map_t *S); xcb_xkb_action_t * xcb_xkb_get_map_map_acts_rtrn_acts (const xcb_xkb_get_map_map_t *S); int xcb_xkb_get_map_map_acts_rtrn_acts_length (const xcb_xkb_get_map_reply_t *R, const xcb_xkb_get_map_map_t *S); xcb_xkb_action_iterator_t xcb_xkb_get_map_map_acts_rtrn_acts_iterator (const xcb_xkb_get_map_reply_t *R, const xcb_xkb_get_map_map_t *S); xcb_xkb_set_behavior_t * xcb_xkb_get_map_map_behaviors_rtrn (const xcb_xkb_get_map_map_t *S); int xcb_xkb_get_map_map_behaviors_rtrn_length (const xcb_xkb_get_map_reply_t *R, const xcb_xkb_get_map_map_t *S); xcb_xkb_set_behavior_iterator_t xcb_xkb_get_map_map_behaviors_rtrn_iterator (const xcb_xkb_get_map_reply_t *R, const xcb_xkb_get_map_map_t *S); uint8_t * xcb_xkb_get_map_map_vmods_rtrn (const xcb_xkb_get_map_map_t *S); int xcb_xkb_get_map_map_vmods_rtrn_length (const xcb_xkb_get_map_reply_t *R, const xcb_xkb_get_map_map_t *S); xcb_generic_iterator_t xcb_xkb_get_map_map_vmods_rtrn_end (const xcb_xkb_get_map_reply_t *R, const xcb_xkb_get_map_map_t *S); xcb_xkb_set_explicit_t * xcb_xkb_get_map_map_explicit_rtrn (const xcb_xkb_get_map_map_t *S); int xcb_xkb_get_map_map_explicit_rtrn_length (const xcb_xkb_get_map_reply_t *R, const xcb_xkb_get_map_map_t *S); xcb_xkb_set_explicit_iterator_t xcb_xkb_get_map_map_explicit_rtrn_iterator (const xcb_xkb_get_map_reply_t *R, const xcb_xkb_get_map_map_t *S); xcb_xkb_key_mod_map_t * xcb_xkb_get_map_map_modmap_rtrn (const xcb_xkb_get_map_map_t *S); int xcb_xkb_get_map_map_modmap_rtrn_length (const xcb_xkb_get_map_reply_t *R, const xcb_xkb_get_map_map_t *S); xcb_xkb_key_mod_map_iterator_t xcb_xkb_get_map_map_modmap_rtrn_iterator (const xcb_xkb_get_map_reply_t *R, const xcb_xkb_get_map_map_t *S); xcb_xkb_key_v_mod_map_t * xcb_xkb_get_map_map_vmodmap_rtrn (const xcb_xkb_get_map_map_t *S); int xcb_xkb_get_map_map_vmodmap_rtrn_length (const xcb_xkb_get_map_reply_t *R, const xcb_xkb_get_map_map_t *S); xcb_xkb_key_v_mod_map_iterator_t xcb_xkb_get_map_map_vmodmap_rtrn_iterator (const xcb_xkb_get_map_reply_t *R, const xcb_xkb_get_map_map_t *S); int xcb_xkb_get_map_map_serialize (void **_buffer, uint8_t nTypes, uint8_t nKeySyms, uint8_t nKeyActions, uint16_t totalActions, uint8_t totalKeyBehaviors, uint16_t virtualMods, uint8_t totalKeyExplicit, uint8_t totalModMapKeys, uint8_t totalVModMapKeys, uint16_t present, const xcb_xkb_get_map_map_t *_aux); int xcb_xkb_get_map_map_unpack (const void *_buffer, uint8_t nTypes, uint8_t nKeySyms, uint8_t nKeyActions, uint16_t totalActions, uint8_t totalKeyBehaviors, uint16_t virtualMods, uint8_t totalKeyExplicit, uint8_t totalModMapKeys, uint8_t totalVModMapKeys, uint16_t present, xcb_xkb_get_map_map_t *_aux); int xcb_xkb_get_map_map_sizeof (const void *_buffer, uint8_t nTypes, uint8_t nKeySyms, uint8_t nKeyActions, uint16_t totalActions, uint8_t totalKeyBehaviors, uint16_t virtualMods, uint8_t totalKeyExplicit, uint8_t totalModMapKeys, uint8_t totalVModMapKeys, uint16_t present); int xcb_xkb_get_map_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xkb_get_map_cookie_t xcb_xkb_get_map (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t full, uint16_t partial, uint8_t firstType, uint8_t nTypes, xcb_keycode_t firstKeySym, uint8_t nKeySyms, xcb_keycode_t firstKeyAction, uint8_t nKeyActions, xcb_keycode_t firstKeyBehavior, uint8_t nKeyBehaviors, uint16_t virtualMods, xcb_keycode_t firstKeyExplicit, uint8_t nKeyExplicit, xcb_keycode_t firstModMapKey, uint8_t nModMapKeys, xcb_keycode_t firstVModMapKey, uint8_t nVModMapKeys); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xkb_get_map_cookie_t xcb_xkb_get_map_unchecked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t full, uint16_t partial, uint8_t firstType, uint8_t nTypes, xcb_keycode_t firstKeySym, uint8_t nKeySyms, xcb_keycode_t firstKeyAction, uint8_t nKeyActions, xcb_keycode_t firstKeyBehavior, uint8_t nKeyBehaviors, uint16_t virtualMods, xcb_keycode_t firstKeyExplicit, uint8_t nKeyExplicit, xcb_keycode_t firstModMapKey, uint8_t nModMapKeys, xcb_keycode_t firstVModMapKey, uint8_t nVModMapKeys); void * xcb_xkb_get_map_map (const xcb_xkb_get_map_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xkb_get_map_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xkb_get_map_reply_t * xcb_xkb_get_map_reply (xcb_connection_t *c, xcb_xkb_get_map_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xkb_set_map_values_types_length (const xcb_xkb_set_map_request_t *R, const xcb_xkb_set_map_values_t *S); xcb_xkb_set_key_type_iterator_t xcb_xkb_set_map_values_types_iterator (const xcb_xkb_set_map_request_t *R, const xcb_xkb_set_map_values_t *S); int xcb_xkb_set_map_values_syms_length (const xcb_xkb_set_map_request_t *R, const xcb_xkb_set_map_values_t *S); xcb_xkb_key_sym_map_iterator_t xcb_xkb_set_map_values_syms_iterator (const xcb_xkb_set_map_request_t *R, const xcb_xkb_set_map_values_t *S); uint8_t * xcb_xkb_set_map_values_actions_count (const xcb_xkb_set_map_values_t *S); int xcb_xkb_set_map_values_actions_count_length (const xcb_xkb_set_map_request_t *R, const xcb_xkb_set_map_values_t *S); xcb_generic_iterator_t xcb_xkb_set_map_values_actions_count_end (const xcb_xkb_set_map_request_t *R, const xcb_xkb_set_map_values_t *S); xcb_xkb_action_t * xcb_xkb_set_map_values_actions (const xcb_xkb_set_map_values_t *S); int xcb_xkb_set_map_values_actions_length (const xcb_xkb_set_map_request_t *R, const xcb_xkb_set_map_values_t *S); xcb_xkb_action_iterator_t xcb_xkb_set_map_values_actions_iterator (const xcb_xkb_set_map_request_t *R, const xcb_xkb_set_map_values_t *S); xcb_xkb_set_behavior_t * xcb_xkb_set_map_values_behaviors (const xcb_xkb_set_map_values_t *S); int xcb_xkb_set_map_values_behaviors_length (const xcb_xkb_set_map_request_t *R, const xcb_xkb_set_map_values_t *S); xcb_xkb_set_behavior_iterator_t xcb_xkb_set_map_values_behaviors_iterator (const xcb_xkb_set_map_request_t *R, const xcb_xkb_set_map_values_t *S); uint8_t * xcb_xkb_set_map_values_vmods (const xcb_xkb_set_map_values_t *S); int xcb_xkb_set_map_values_vmods_length (const xcb_xkb_set_map_request_t *R, const xcb_xkb_set_map_values_t *S); xcb_generic_iterator_t xcb_xkb_set_map_values_vmods_end (const xcb_xkb_set_map_request_t *R, const xcb_xkb_set_map_values_t *S); xcb_xkb_set_explicit_t * xcb_xkb_set_map_values_explicit (const xcb_xkb_set_map_values_t *S); int xcb_xkb_set_map_values_explicit_length (const xcb_xkb_set_map_request_t *R, const xcb_xkb_set_map_values_t *S); xcb_xkb_set_explicit_iterator_t xcb_xkb_set_map_values_explicit_iterator (const xcb_xkb_set_map_request_t *R, const xcb_xkb_set_map_values_t *S); xcb_xkb_key_mod_map_t * xcb_xkb_set_map_values_modmap (const xcb_xkb_set_map_values_t *S); int xcb_xkb_set_map_values_modmap_length (const xcb_xkb_set_map_request_t *R, const xcb_xkb_set_map_values_t *S); xcb_xkb_key_mod_map_iterator_t xcb_xkb_set_map_values_modmap_iterator (const xcb_xkb_set_map_request_t *R, const xcb_xkb_set_map_values_t *S); xcb_xkb_key_v_mod_map_t * xcb_xkb_set_map_values_vmodmap (const xcb_xkb_set_map_values_t *S); int xcb_xkb_set_map_values_vmodmap_length (const xcb_xkb_set_map_request_t *R, const xcb_xkb_set_map_values_t *S); xcb_xkb_key_v_mod_map_iterator_t xcb_xkb_set_map_values_vmodmap_iterator (const xcb_xkb_set_map_request_t *R, const xcb_xkb_set_map_values_t *S); int xcb_xkb_set_map_values_serialize (void **_buffer, uint8_t nTypes, uint8_t nKeySyms, uint8_t nKeyActions, uint16_t totalActions, uint8_t totalKeyBehaviors, uint16_t virtualMods, uint8_t totalKeyExplicit, uint8_t totalModMapKeys, uint8_t totalVModMapKeys, uint16_t present, const xcb_xkb_set_map_values_t *_aux); int xcb_xkb_set_map_values_unpack (const void *_buffer, uint8_t nTypes, uint8_t nKeySyms, uint8_t nKeyActions, uint16_t totalActions, uint8_t totalKeyBehaviors, uint16_t virtualMods, uint8_t totalKeyExplicit, uint8_t totalModMapKeys, uint8_t totalVModMapKeys, uint16_t present, xcb_xkb_set_map_values_t *_aux); int xcb_xkb_set_map_values_sizeof (const void *_buffer, uint8_t nTypes, uint8_t nKeySyms, uint8_t nKeyActions, uint16_t totalActions, uint8_t totalKeyBehaviors, uint16_t virtualMods, uint8_t totalKeyExplicit, uint8_t totalModMapKeys, uint8_t totalVModMapKeys, uint16_t present); int xcb_xkb_set_map_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xkb_set_map_checked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t present, uint16_t flags, xcb_keycode_t minKeyCode, xcb_keycode_t maxKeyCode, uint8_t firstType, uint8_t nTypes, xcb_keycode_t firstKeySym, uint8_t nKeySyms, uint16_t totalSyms, xcb_keycode_t firstKeyAction, uint8_t nKeyActions, uint16_t totalActions, xcb_keycode_t firstKeyBehavior, uint8_t nKeyBehaviors, uint8_t totalKeyBehaviors, xcb_keycode_t firstKeyExplicit, uint8_t nKeyExplicit, uint8_t totalKeyExplicit, xcb_keycode_t firstModMapKey, uint8_t nModMapKeys, uint8_t totalModMapKeys, xcb_keycode_t firstVModMapKey, uint8_t nVModMapKeys, uint8_t totalVModMapKeys, uint16_t virtualMods, const void *values); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xkb_set_map (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t present, uint16_t flags, xcb_keycode_t minKeyCode, xcb_keycode_t maxKeyCode, uint8_t firstType, uint8_t nTypes, xcb_keycode_t firstKeySym, uint8_t nKeySyms, uint16_t totalSyms, xcb_keycode_t firstKeyAction, uint8_t nKeyActions, uint16_t totalActions, xcb_keycode_t firstKeyBehavior, uint8_t nKeyBehaviors, uint8_t totalKeyBehaviors, xcb_keycode_t firstKeyExplicit, uint8_t nKeyExplicit, uint8_t totalKeyExplicit, xcb_keycode_t firstModMapKey, uint8_t nModMapKeys, uint8_t totalModMapKeys, xcb_keycode_t firstVModMapKey, uint8_t nVModMapKeys, uint8_t totalVModMapKeys, uint16_t virtualMods, const void *values); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xkb_set_map_aux_checked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t present, uint16_t flags, xcb_keycode_t minKeyCode, xcb_keycode_t maxKeyCode, uint8_t firstType, uint8_t nTypes, xcb_keycode_t firstKeySym, uint8_t nKeySyms, uint16_t totalSyms, xcb_keycode_t firstKeyAction, uint8_t nKeyActions, uint16_t totalActions, xcb_keycode_t firstKeyBehavior, uint8_t nKeyBehaviors, uint8_t totalKeyBehaviors, xcb_keycode_t firstKeyExplicit, uint8_t nKeyExplicit, uint8_t totalKeyExplicit, xcb_keycode_t firstModMapKey, uint8_t nModMapKeys, uint8_t totalModMapKeys, xcb_keycode_t firstVModMapKey, uint8_t nVModMapKeys, uint8_t totalVModMapKeys, uint16_t virtualMods, const xcb_xkb_set_map_values_t *values); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xkb_set_map_aux (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t present, uint16_t flags, xcb_keycode_t minKeyCode, xcb_keycode_t maxKeyCode, uint8_t firstType, uint8_t nTypes, xcb_keycode_t firstKeySym, uint8_t nKeySyms, uint16_t totalSyms, xcb_keycode_t firstKeyAction, uint8_t nKeyActions, uint16_t totalActions, xcb_keycode_t firstKeyBehavior, uint8_t nKeyBehaviors, uint8_t totalKeyBehaviors, xcb_keycode_t firstKeyExplicit, uint8_t nKeyExplicit, uint8_t totalKeyExplicit, xcb_keycode_t firstModMapKey, uint8_t nModMapKeys, uint8_t totalModMapKeys, xcb_keycode_t firstVModMapKey, uint8_t nVModMapKeys, uint8_t totalVModMapKeys, uint16_t virtualMods, const xcb_xkb_set_map_values_t *values); void * xcb_xkb_set_map_values (const xcb_xkb_set_map_request_t *R); int xcb_xkb_get_compat_map_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xkb_get_compat_map_cookie_t xcb_xkb_get_compat_map (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint8_t groups, uint8_t getAllSI, uint16_t firstSI, uint16_t nSI); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xkb_get_compat_map_cookie_t xcb_xkb_get_compat_map_unchecked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint8_t groups, uint8_t getAllSI, uint16_t firstSI, uint16_t nSI); xcb_xkb_sym_interpret_t * xcb_xkb_get_compat_map_si_rtrn (const xcb_xkb_get_compat_map_reply_t *R); int xcb_xkb_get_compat_map_si_rtrn_length (const xcb_xkb_get_compat_map_reply_t *R); xcb_xkb_sym_interpret_iterator_t xcb_xkb_get_compat_map_si_rtrn_iterator (const xcb_xkb_get_compat_map_reply_t *R); xcb_xkb_mod_def_t * xcb_xkb_get_compat_map_group_rtrn (const xcb_xkb_get_compat_map_reply_t *R); int xcb_xkb_get_compat_map_group_rtrn_length (const xcb_xkb_get_compat_map_reply_t *R); xcb_xkb_mod_def_iterator_t xcb_xkb_get_compat_map_group_rtrn_iterator (const xcb_xkb_get_compat_map_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xkb_get_compat_map_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xkb_get_compat_map_reply_t * xcb_xkb_get_compat_map_reply (xcb_connection_t *c, xcb_xkb_get_compat_map_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xkb_set_compat_map_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xkb_set_compat_map_checked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint8_t recomputeActions, uint8_t truncateSI, uint8_t groups, uint16_t firstSI, uint16_t nSI, const xcb_xkb_sym_interpret_t *si, const xcb_xkb_mod_def_t *groupMaps); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xkb_set_compat_map (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint8_t recomputeActions, uint8_t truncateSI, uint8_t groups, uint16_t firstSI, uint16_t nSI, const xcb_xkb_sym_interpret_t *si, const xcb_xkb_mod_def_t *groupMaps); xcb_xkb_sym_interpret_t * xcb_xkb_set_compat_map_si (const xcb_xkb_set_compat_map_request_t *R); int xcb_xkb_set_compat_map_si_length (const xcb_xkb_set_compat_map_request_t *R); xcb_xkb_sym_interpret_iterator_t xcb_xkb_set_compat_map_si_iterator (const xcb_xkb_set_compat_map_request_t *R); xcb_xkb_mod_def_t * xcb_xkb_set_compat_map_group_maps (const xcb_xkb_set_compat_map_request_t *R); int xcb_xkb_set_compat_map_group_maps_length (const xcb_xkb_set_compat_map_request_t *R); xcb_xkb_mod_def_iterator_t xcb_xkb_set_compat_map_group_maps_iterator (const xcb_xkb_set_compat_map_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xkb_get_indicator_state_cookie_t xcb_xkb_get_indicator_state (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xkb_get_indicator_state_cookie_t xcb_xkb_get_indicator_state_unchecked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xkb_get_indicator_state_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xkb_get_indicator_state_reply_t * xcb_xkb_get_indicator_state_reply (xcb_connection_t *c, xcb_xkb_get_indicator_state_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xkb_get_indicator_map_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xkb_get_indicator_map_cookie_t xcb_xkb_get_indicator_map (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint32_t which); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xkb_get_indicator_map_cookie_t xcb_xkb_get_indicator_map_unchecked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint32_t which); xcb_xkb_indicator_map_t * xcb_xkb_get_indicator_map_maps (const xcb_xkb_get_indicator_map_reply_t *R); int xcb_xkb_get_indicator_map_maps_length (const xcb_xkb_get_indicator_map_reply_t *R); xcb_xkb_indicator_map_iterator_t xcb_xkb_get_indicator_map_maps_iterator (const xcb_xkb_get_indicator_map_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xkb_get_indicator_map_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xkb_get_indicator_map_reply_t * xcb_xkb_get_indicator_map_reply (xcb_connection_t *c, xcb_xkb_get_indicator_map_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xkb_set_indicator_map_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xkb_set_indicator_map_checked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint32_t which, const xcb_xkb_indicator_map_t *maps); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xkb_set_indicator_map (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint32_t which, const xcb_xkb_indicator_map_t *maps); xcb_xkb_indicator_map_t * xcb_xkb_set_indicator_map_maps (const xcb_xkb_set_indicator_map_request_t *R); int xcb_xkb_set_indicator_map_maps_length (const xcb_xkb_set_indicator_map_request_t *R); xcb_xkb_indicator_map_iterator_t xcb_xkb_set_indicator_map_maps_iterator (const xcb_xkb_set_indicator_map_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xkb_get_named_indicator_cookie_t xcb_xkb_get_named_indicator (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, xcb_xkb_led_class_spec_t ledClass, xcb_xkb_id_spec_t ledID, xcb_atom_t indicator); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xkb_get_named_indicator_cookie_t xcb_xkb_get_named_indicator_unchecked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, xcb_xkb_led_class_spec_t ledClass, xcb_xkb_id_spec_t ledID, xcb_atom_t indicator); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xkb_get_named_indicator_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xkb_get_named_indicator_reply_t * xcb_xkb_get_named_indicator_reply (xcb_connection_t *c, xcb_xkb_get_named_indicator_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xkb_set_named_indicator_checked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, xcb_xkb_led_class_spec_t ledClass, xcb_xkb_id_spec_t ledID, xcb_atom_t indicator, uint8_t setState, uint8_t on, uint8_t setMap, uint8_t createMap, uint8_t map_flags, uint8_t map_whichGroups, uint8_t map_groups, uint8_t map_whichMods, uint8_t map_realMods, uint16_t map_vmods, uint32_t map_ctrls); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xkb_set_named_indicator (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, xcb_xkb_led_class_spec_t ledClass, xcb_xkb_id_spec_t ledID, xcb_atom_t indicator, uint8_t setState, uint8_t on, uint8_t setMap, uint8_t createMap, uint8_t map_flags, uint8_t map_whichGroups, uint8_t map_groups, uint8_t map_whichMods, uint8_t map_realMods, uint16_t map_vmods, uint32_t map_ctrls); xcb_atom_t * xcb_xkb_get_names_value_list_type_names (const xcb_xkb_get_names_value_list_t *S); int xcb_xkb_get_names_value_list_type_names_length (const xcb_xkb_get_names_reply_t *R, const xcb_xkb_get_names_value_list_t *S); xcb_generic_iterator_t xcb_xkb_get_names_value_list_type_names_end (const xcb_xkb_get_names_reply_t *R, const xcb_xkb_get_names_value_list_t *S); uint8_t * xcb_xkb_get_names_value_list_n_levels_per_type (const xcb_xkb_get_names_value_list_t *S); int xcb_xkb_get_names_value_list_n_levels_per_type_length (const xcb_xkb_get_names_reply_t *R, const xcb_xkb_get_names_value_list_t *S); xcb_generic_iterator_t xcb_xkb_get_names_value_list_n_levels_per_type_end (const xcb_xkb_get_names_reply_t *R, const xcb_xkb_get_names_value_list_t *S); xcb_atom_t * xcb_xkb_get_names_value_list_kt_level_names (const xcb_xkb_get_names_value_list_t *S); int xcb_xkb_get_names_value_list_kt_level_names_length (const xcb_xkb_get_names_reply_t *R, const xcb_xkb_get_names_value_list_t *S); xcb_generic_iterator_t xcb_xkb_get_names_value_list_kt_level_names_end (const xcb_xkb_get_names_reply_t *R, const xcb_xkb_get_names_value_list_t *S); xcb_atom_t * xcb_xkb_get_names_value_list_indicator_names (const xcb_xkb_get_names_value_list_t *S); int xcb_xkb_get_names_value_list_indicator_names_length (const xcb_xkb_get_names_reply_t *R, const xcb_xkb_get_names_value_list_t *S); xcb_generic_iterator_t xcb_xkb_get_names_value_list_indicator_names_end (const xcb_xkb_get_names_reply_t *R, const xcb_xkb_get_names_value_list_t *S); xcb_atom_t * xcb_xkb_get_names_value_list_virtual_mod_names (const xcb_xkb_get_names_value_list_t *S); int xcb_xkb_get_names_value_list_virtual_mod_names_length (const xcb_xkb_get_names_reply_t *R, const xcb_xkb_get_names_value_list_t *S); xcb_generic_iterator_t xcb_xkb_get_names_value_list_virtual_mod_names_end (const xcb_xkb_get_names_reply_t *R, const xcb_xkb_get_names_value_list_t *S); xcb_atom_t * xcb_xkb_get_names_value_list_groups (const xcb_xkb_get_names_value_list_t *S); int xcb_xkb_get_names_value_list_groups_length (const xcb_xkb_get_names_reply_t *R, const xcb_xkb_get_names_value_list_t *S); xcb_generic_iterator_t xcb_xkb_get_names_value_list_groups_end (const xcb_xkb_get_names_reply_t *R, const xcb_xkb_get_names_value_list_t *S); xcb_xkb_key_name_t * xcb_xkb_get_names_value_list_key_names (const xcb_xkb_get_names_value_list_t *S); int xcb_xkb_get_names_value_list_key_names_length (const xcb_xkb_get_names_reply_t *R, const xcb_xkb_get_names_value_list_t *S); xcb_xkb_key_name_iterator_t xcb_xkb_get_names_value_list_key_names_iterator (const xcb_xkb_get_names_reply_t *R, const xcb_xkb_get_names_value_list_t *S); xcb_xkb_key_alias_t * xcb_xkb_get_names_value_list_key_aliases (const xcb_xkb_get_names_value_list_t *S); int xcb_xkb_get_names_value_list_key_aliases_length (const xcb_xkb_get_names_reply_t *R, const xcb_xkb_get_names_value_list_t *S); xcb_xkb_key_alias_iterator_t xcb_xkb_get_names_value_list_key_aliases_iterator (const xcb_xkb_get_names_reply_t *R, const xcb_xkb_get_names_value_list_t *S); xcb_atom_t * xcb_xkb_get_names_value_list_radio_group_names (const xcb_xkb_get_names_value_list_t *S); int xcb_xkb_get_names_value_list_radio_group_names_length (const xcb_xkb_get_names_reply_t *R, const xcb_xkb_get_names_value_list_t *S); xcb_generic_iterator_t xcb_xkb_get_names_value_list_radio_group_names_end (const xcb_xkb_get_names_reply_t *R, const xcb_xkb_get_names_value_list_t *S); int xcb_xkb_get_names_value_list_serialize (void **_buffer, uint8_t nTypes, uint32_t indicators, uint16_t virtualMods, uint8_t groupNames, uint8_t nKeys, uint8_t nKeyAliases, uint8_t nRadioGroups, uint32_t which, const xcb_xkb_get_names_value_list_t *_aux); int xcb_xkb_get_names_value_list_unpack (const void *_buffer, uint8_t nTypes, uint32_t indicators, uint16_t virtualMods, uint8_t groupNames, uint8_t nKeys, uint8_t nKeyAliases, uint8_t nRadioGroups, uint32_t which, xcb_xkb_get_names_value_list_t *_aux); int xcb_xkb_get_names_value_list_sizeof (const void *_buffer, uint8_t nTypes, uint32_t indicators, uint16_t virtualMods, uint8_t groupNames, uint8_t nKeys, uint8_t nKeyAliases, uint8_t nRadioGroups, uint32_t which); int xcb_xkb_get_names_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xkb_get_names_cookie_t xcb_xkb_get_names (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint32_t which); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xkb_get_names_cookie_t xcb_xkb_get_names_unchecked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint32_t which); void * xcb_xkb_get_names_value_list (const xcb_xkb_get_names_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xkb_get_names_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xkb_get_names_reply_t * xcb_xkb_get_names_reply (xcb_connection_t *c, xcb_xkb_get_names_cookie_t cookie /**< */, xcb_generic_error_t **e); xcb_atom_t * xcb_xkb_set_names_values_type_names (const xcb_xkb_set_names_values_t *S); int xcb_xkb_set_names_values_type_names_length (const xcb_xkb_set_names_request_t *R, const xcb_xkb_set_names_values_t *S); xcb_generic_iterator_t xcb_xkb_set_names_values_type_names_end (const xcb_xkb_set_names_request_t *R, const xcb_xkb_set_names_values_t *S); uint8_t * xcb_xkb_set_names_values_n_levels_per_type (const xcb_xkb_set_names_values_t *S); int xcb_xkb_set_names_values_n_levels_per_type_length (const xcb_xkb_set_names_request_t *R, const xcb_xkb_set_names_values_t *S); xcb_generic_iterator_t xcb_xkb_set_names_values_n_levels_per_type_end (const xcb_xkb_set_names_request_t *R, const xcb_xkb_set_names_values_t *S); xcb_atom_t * xcb_xkb_set_names_values_kt_level_names (const xcb_xkb_set_names_values_t *S); int xcb_xkb_set_names_values_kt_level_names_length (const xcb_xkb_set_names_request_t *R, const xcb_xkb_set_names_values_t *S); xcb_generic_iterator_t xcb_xkb_set_names_values_kt_level_names_end (const xcb_xkb_set_names_request_t *R, const xcb_xkb_set_names_values_t *S); xcb_atom_t * xcb_xkb_set_names_values_indicator_names (const xcb_xkb_set_names_values_t *S); int xcb_xkb_set_names_values_indicator_names_length (const xcb_xkb_set_names_request_t *R, const xcb_xkb_set_names_values_t *S); xcb_generic_iterator_t xcb_xkb_set_names_values_indicator_names_end (const xcb_xkb_set_names_request_t *R, const xcb_xkb_set_names_values_t *S); xcb_atom_t * xcb_xkb_set_names_values_virtual_mod_names (const xcb_xkb_set_names_values_t *S); int xcb_xkb_set_names_values_virtual_mod_names_length (const xcb_xkb_set_names_request_t *R, const xcb_xkb_set_names_values_t *S); xcb_generic_iterator_t xcb_xkb_set_names_values_virtual_mod_names_end (const xcb_xkb_set_names_request_t *R, const xcb_xkb_set_names_values_t *S); xcb_atom_t * xcb_xkb_set_names_values_groups (const xcb_xkb_set_names_values_t *S); int xcb_xkb_set_names_values_groups_length (const xcb_xkb_set_names_request_t *R, const xcb_xkb_set_names_values_t *S); xcb_generic_iterator_t xcb_xkb_set_names_values_groups_end (const xcb_xkb_set_names_request_t *R, const xcb_xkb_set_names_values_t *S); xcb_xkb_key_name_t * xcb_xkb_set_names_values_key_names (const xcb_xkb_set_names_values_t *S); int xcb_xkb_set_names_values_key_names_length (const xcb_xkb_set_names_request_t *R, const xcb_xkb_set_names_values_t *S); xcb_xkb_key_name_iterator_t xcb_xkb_set_names_values_key_names_iterator (const xcb_xkb_set_names_request_t *R, const xcb_xkb_set_names_values_t *S); xcb_xkb_key_alias_t * xcb_xkb_set_names_values_key_aliases (const xcb_xkb_set_names_values_t *S); int xcb_xkb_set_names_values_key_aliases_length (const xcb_xkb_set_names_request_t *R, const xcb_xkb_set_names_values_t *S); xcb_xkb_key_alias_iterator_t xcb_xkb_set_names_values_key_aliases_iterator (const xcb_xkb_set_names_request_t *R, const xcb_xkb_set_names_values_t *S); xcb_atom_t * xcb_xkb_set_names_values_radio_group_names (const xcb_xkb_set_names_values_t *S); int xcb_xkb_set_names_values_radio_group_names_length (const xcb_xkb_set_names_request_t *R, const xcb_xkb_set_names_values_t *S); xcb_generic_iterator_t xcb_xkb_set_names_values_radio_group_names_end (const xcb_xkb_set_names_request_t *R, const xcb_xkb_set_names_values_t *S); int xcb_xkb_set_names_values_serialize (void **_buffer, uint8_t nTypes, uint32_t indicators, uint16_t virtualMods, uint8_t groupNames, uint8_t nKeys, uint8_t nKeyAliases, uint8_t nRadioGroups, uint32_t which, const xcb_xkb_set_names_values_t *_aux); int xcb_xkb_set_names_values_unpack (const void *_buffer, uint8_t nTypes, uint32_t indicators, uint16_t virtualMods, uint8_t groupNames, uint8_t nKeys, uint8_t nKeyAliases, uint8_t nRadioGroups, uint32_t which, xcb_xkb_set_names_values_t *_aux); int xcb_xkb_set_names_values_sizeof (const void *_buffer, uint8_t nTypes, uint32_t indicators, uint16_t virtualMods, uint8_t groupNames, uint8_t nKeys, uint8_t nKeyAliases, uint8_t nRadioGroups, uint32_t which); int xcb_xkb_set_names_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xkb_set_names_checked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t virtualMods, uint32_t which, uint8_t firstType, uint8_t nTypes, uint8_t firstKTLevelt, uint8_t nKTLevels, uint32_t indicators, uint8_t groupNames, uint8_t nRadioGroups, xcb_keycode_t firstKey, uint8_t nKeys, uint8_t nKeyAliases, uint16_t totalKTLevelNames, const void *values); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xkb_set_names (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t virtualMods, uint32_t which, uint8_t firstType, uint8_t nTypes, uint8_t firstKTLevelt, uint8_t nKTLevels, uint32_t indicators, uint8_t groupNames, uint8_t nRadioGroups, xcb_keycode_t firstKey, uint8_t nKeys, uint8_t nKeyAliases, uint16_t totalKTLevelNames, const void *values); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xkb_set_names_aux_checked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t virtualMods, uint32_t which, uint8_t firstType, uint8_t nTypes, uint8_t firstKTLevelt, uint8_t nKTLevels, uint32_t indicators, uint8_t groupNames, uint8_t nRadioGroups, xcb_keycode_t firstKey, uint8_t nKeys, uint8_t nKeyAliases, uint16_t totalKTLevelNames, const xcb_xkb_set_names_values_t *values); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xkb_set_names_aux (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t virtualMods, uint32_t which, uint8_t firstType, uint8_t nTypes, uint8_t firstKTLevelt, uint8_t nKTLevels, uint32_t indicators, uint8_t groupNames, uint8_t nRadioGroups, xcb_keycode_t firstKey, uint8_t nKeys, uint8_t nKeyAliases, uint16_t totalKTLevelNames, const xcb_xkb_set_names_values_t *values); void * xcb_xkb_set_names_values (const xcb_xkb_set_names_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xkb_per_client_flags_cookie_t xcb_xkb_per_client_flags (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint32_t change, uint32_t value, uint32_t ctrlsToChange, uint32_t autoCtrls, uint32_t autoCtrlsValues); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xkb_per_client_flags_cookie_t xcb_xkb_per_client_flags_unchecked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint32_t change, uint32_t value, uint32_t ctrlsToChange, uint32_t autoCtrls, uint32_t autoCtrlsValues); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xkb_per_client_flags_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xkb_per_client_flags_reply_t * xcb_xkb_per_client_flags_reply (xcb_connection_t *c, xcb_xkb_per_client_flags_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xkb_list_components_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xkb_list_components_cookie_t xcb_xkb_list_components (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t maxNames); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xkb_list_components_cookie_t xcb_xkb_list_components_unchecked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t maxNames); int xcb_xkb_list_components_keymaps_length (const xcb_xkb_list_components_reply_t *R); xcb_xkb_listing_iterator_t xcb_xkb_list_components_keymaps_iterator (const xcb_xkb_list_components_reply_t *R); int xcb_xkb_list_components_keycodes_length (const xcb_xkb_list_components_reply_t *R); xcb_xkb_listing_iterator_t xcb_xkb_list_components_keycodes_iterator (const xcb_xkb_list_components_reply_t *R); int xcb_xkb_list_components_types_length (const xcb_xkb_list_components_reply_t *R); xcb_xkb_listing_iterator_t xcb_xkb_list_components_types_iterator (const xcb_xkb_list_components_reply_t *R); int xcb_xkb_list_components_compat_maps_length (const xcb_xkb_list_components_reply_t *R); xcb_xkb_listing_iterator_t xcb_xkb_list_components_compat_maps_iterator (const xcb_xkb_list_components_reply_t *R); int xcb_xkb_list_components_symbols_length (const xcb_xkb_list_components_reply_t *R); xcb_xkb_listing_iterator_t xcb_xkb_list_components_symbols_iterator (const xcb_xkb_list_components_reply_t *R); int xcb_xkb_list_components_geometries_length (const xcb_xkb_list_components_reply_t *R); xcb_xkb_listing_iterator_t xcb_xkb_list_components_geometries_iterator (const xcb_xkb_list_components_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xkb_list_components_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xkb_list_components_reply_t * xcb_xkb_list_components_reply (xcb_connection_t *c, xcb_xkb_list_components_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xkb_get_kbd_by_name_replies_types_map_types_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_key_type_iterator_t xcb_xkb_get_kbd_by_name_replies_types_map_types_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_types_map_syms_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_key_sym_map_iterator_t xcb_xkb_get_kbd_by_name_replies_types_map_syms_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); uint8_t * xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_count (const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_count_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_count_end (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_action_t * xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_acts (const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_acts_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_action_iterator_t xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_acts_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_set_behavior_t * xcb_xkb_get_kbd_by_name_replies_types_map_behaviors_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_types_map_behaviors_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_set_behavior_iterator_t xcb_xkb_get_kbd_by_name_replies_types_map_behaviors_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); uint8_t * xcb_xkb_get_kbd_by_name_replies_types_map_vmods_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_types_map_vmods_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_types_map_vmods_rtrn_end (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_set_explicit_t * xcb_xkb_get_kbd_by_name_replies_types_map_explicit_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_types_map_explicit_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_set_explicit_iterator_t xcb_xkb_get_kbd_by_name_replies_types_map_explicit_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_key_mod_map_t * xcb_xkb_get_kbd_by_name_replies_types_map_modmap_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_types_map_modmap_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_key_mod_map_iterator_t xcb_xkb_get_kbd_by_name_replies_types_map_modmap_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_key_v_mod_map_t * xcb_xkb_get_kbd_by_name_replies_types_map_vmodmap_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_types_map_vmodmap_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_key_v_mod_map_iterator_t xcb_xkb_get_kbd_by_name_replies_types_map_vmodmap_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_types_map_serialize (void **_buffer, uint8_t nTypes, uint8_t nKeySyms, uint8_t nKeyActions, uint16_t totalActions, uint8_t totalKeyBehaviors, uint16_t virtualMods, uint8_t totalKeyExplicit, uint8_t totalModMapKeys, uint8_t totalVModMapKeys, uint16_t present, const xcb_xkb_get_kbd_by_name_replies_types_map_t *_aux); int xcb_xkb_get_kbd_by_name_replies_types_map_unpack (const void *_buffer, uint8_t nTypes, uint8_t nKeySyms, uint8_t nKeyActions, uint16_t totalActions, uint8_t totalKeyBehaviors, uint16_t virtualMods, uint8_t totalKeyExplicit, uint8_t totalModMapKeys, uint8_t totalVModMapKeys, uint16_t present, xcb_xkb_get_kbd_by_name_replies_types_map_t *_aux); int xcb_xkb_get_kbd_by_name_replies_types_map_sizeof (const void *_buffer, uint8_t nTypes, uint8_t nKeySyms, uint8_t nKeyActions, uint16_t totalActions, uint8_t totalKeyBehaviors, uint16_t virtualMods, uint8_t totalKeyExplicit, uint8_t totalModMapKeys, uint8_t totalVModMapKeys, uint16_t present); xcb_atom_t * xcb_xkb_get_kbd_by_name_replies_key_names_value_list_type_names (const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_key_names_value_list_type_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_key_names_value_list_type_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); uint8_t * xcb_xkb_get_kbd_by_name_replies_key_names_value_list_n_levels_per_type (const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_key_names_value_list_n_levels_per_type_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_key_names_value_list_n_levels_per_type_end (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_atom_t * xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names (const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_atom_t * xcb_xkb_get_kbd_by_name_replies_key_names_value_list_indicator_names (const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_key_names_value_list_indicator_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_key_names_value_list_indicator_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_atom_t * xcb_xkb_get_kbd_by_name_replies_key_names_value_list_virtual_mod_names (const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_key_names_value_list_virtual_mod_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_key_names_value_list_virtual_mod_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_atom_t * xcb_xkb_get_kbd_by_name_replies_key_names_value_list_groups (const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_key_names_value_list_groups_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_key_names_value_list_groups_end (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_key_name_t * xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_names (const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_key_name_iterator_t xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_names_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_key_alias_t * xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_aliases (const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_aliases_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_key_alias_iterator_t xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_aliases_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_atom_t * xcb_xkb_get_kbd_by_name_replies_key_names_value_list_radio_group_names (const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_key_names_value_list_radio_group_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_key_names_value_list_radio_group_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_key_names_value_list_serialize (void **_buffer, uint8_t nTypes, uint32_t indicators, uint16_t virtualMods, uint8_t groupNames, uint8_t nKeys, uint8_t nKeyAliases, uint8_t nRadioGroups, uint32_t which, const xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t *_aux); int xcb_xkb_get_kbd_by_name_replies_key_names_value_list_unpack (const void *_buffer, uint8_t nTypes, uint32_t indicators, uint16_t virtualMods, uint8_t groupNames, uint8_t nKeys, uint8_t nKeyAliases, uint8_t nRadioGroups, uint32_t which, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t *_aux); int xcb_xkb_get_kbd_by_name_replies_key_names_value_list_sizeof (const void *_buffer, uint8_t nTypes, uint32_t indicators, uint16_t virtualMods, uint8_t groupNames, uint8_t nKeys, uint8_t nKeyAliases, uint8_t nRadioGroups, uint32_t which); xcb_xkb_sym_interpret_t * xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_sym_interpret_iterator_t xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_mod_def_t * xcb_xkb_get_kbd_by_name_replies_compat_map_group_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_compat_map_group_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_mod_def_iterator_t xcb_xkb_get_kbd_by_name_replies_compat_map_group_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_indicator_map_t * xcb_xkb_get_kbd_by_name_replies_indicator_maps_maps (const xcb_xkb_get_kbd_by_name_replies_t *S); int xcb_xkb_get_kbd_by_name_replies_indicator_maps_maps_length (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_indicator_map_iterator_t xcb_xkb_get_kbd_by_name_replies_indicator_maps_maps_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, const xcb_xkb_get_kbd_by_name_replies_t *S); xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t * xcb_xkb_get_kbd_by_name_replies_key_names_value_list (const xcb_xkb_get_kbd_by_name_replies_t *R); xcb_xkb_counted_string_16_t * xcb_xkb_get_kbd_by_name_replies_geometry_label_font (const xcb_xkb_get_kbd_by_name_replies_t *R); int xcb_xkb_get_kbd_by_name_replies_serialize (void **_buffer, uint16_t reported, const xcb_xkb_get_kbd_by_name_replies_t *_aux); int xcb_xkb_get_kbd_by_name_replies_unpack (const void *_buffer, uint16_t reported, xcb_xkb_get_kbd_by_name_replies_t *_aux); int xcb_xkb_get_kbd_by_name_replies_sizeof (const void *_buffer, uint16_t reported); int xcb_xkb_get_kbd_by_name_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xkb_get_kbd_by_name_cookie_t xcb_xkb_get_kbd_by_name (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t need, uint16_t want, uint8_t load); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xkb_get_kbd_by_name_cookie_t xcb_xkb_get_kbd_by_name_unchecked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t need, uint16_t want, uint8_t load); void * xcb_xkb_get_kbd_by_name_replies (const xcb_xkb_get_kbd_by_name_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xkb_get_kbd_by_name_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xkb_get_kbd_by_name_reply_t * xcb_xkb_get_kbd_by_name_reply (xcb_connection_t *c, xcb_xkb_get_kbd_by_name_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xkb_get_device_info_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xkb_get_device_info_cookie_t xcb_xkb_get_device_info (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t wanted, uint8_t allButtons, uint8_t firstButton, uint8_t nButtons, xcb_xkb_led_class_spec_t ledClass, xcb_xkb_id_spec_t ledID); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xkb_get_device_info_cookie_t xcb_xkb_get_device_info_unchecked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint16_t wanted, uint8_t allButtons, uint8_t firstButton, uint8_t nButtons, xcb_xkb_led_class_spec_t ledClass, xcb_xkb_id_spec_t ledID); xcb_xkb_string8_t * xcb_xkb_get_device_info_name (const xcb_xkb_get_device_info_reply_t *R); int xcb_xkb_get_device_info_name_length (const xcb_xkb_get_device_info_reply_t *R); xcb_generic_iterator_t xcb_xkb_get_device_info_name_end (const xcb_xkb_get_device_info_reply_t *R); xcb_xkb_action_t * xcb_xkb_get_device_info_btn_actions (const xcb_xkb_get_device_info_reply_t *R); int xcb_xkb_get_device_info_btn_actions_length (const xcb_xkb_get_device_info_reply_t *R); xcb_xkb_action_iterator_t xcb_xkb_get_device_info_btn_actions_iterator (const xcb_xkb_get_device_info_reply_t *R); int xcb_xkb_get_device_info_leds_length (const xcb_xkb_get_device_info_reply_t *R); xcb_xkb_device_led_info_iterator_t xcb_xkb_get_device_info_leds_iterator (const xcb_xkb_get_device_info_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xkb_get_device_info_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xkb_get_device_info_reply_t * xcb_xkb_get_device_info_reply (xcb_connection_t *c, xcb_xkb_get_device_info_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xkb_set_device_info_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xkb_set_device_info_checked (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint8_t firstBtn, uint8_t nBtns, uint16_t change, uint16_t nDeviceLedFBs, const xcb_xkb_action_t *btnActions, const xcb_xkb_device_led_info_t *leds); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xkb_set_device_info (xcb_connection_t *c, xcb_xkb_device_spec_t deviceSpec, uint8_t firstBtn, uint8_t nBtns, uint16_t change, uint16_t nDeviceLedFBs, const xcb_xkb_action_t *btnActions, const xcb_xkb_device_led_info_t *leds); xcb_xkb_action_t * xcb_xkb_set_device_info_btn_actions (const xcb_xkb_set_device_info_request_t *R); int xcb_xkb_set_device_info_btn_actions_length (const xcb_xkb_set_device_info_request_t *R); xcb_xkb_action_iterator_t xcb_xkb_set_device_info_btn_actions_iterator (const xcb_xkb_set_device_info_request_t *R); int xcb_xkb_set_device_info_leds_length (const xcb_xkb_set_device_info_request_t *R); xcb_xkb_device_led_info_iterator_t xcb_xkb_set_device_info_leds_iterator (const xcb_xkb_set_device_info_request_t *R); int xcb_xkb_set_debugging_flags_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xkb_set_debugging_flags_cookie_t xcb_xkb_set_debugging_flags (xcb_connection_t *c, uint16_t msgLength, uint32_t affectFlags, uint32_t flags, uint32_t affectCtrls, uint32_t ctrls, const xcb_xkb_string8_t *message); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xkb_set_debugging_flags_cookie_t xcb_xkb_set_debugging_flags_unchecked (xcb_connection_t *c, uint16_t msgLength, uint32_t affectFlags, uint32_t flags, uint32_t affectCtrls, uint32_t ctrls, const xcb_xkb_string8_t *message); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xkb_set_debugging_flags_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xkb_set_debugging_flags_reply_t * xcb_xkb_set_debugging_flags_reply (xcb_connection_t *c, xcb_xkb_set_debugging_flags_cookie_t cookie /**< */, xcb_generic_error_t **e); #ifdef __cplusplus } #endif #endif /** * @} */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/xcb.h�������������������������������������������������������������������������������������������0000644�����������������00000051725�14763166026�0006272 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 2001-2006 Bart Massey, Jamey Sharp, and Josh Triplett. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the names of the authors or their * institutions shall not be used in advertising or otherwise to promote the * sale, use or other dealings in this Software without prior written * authorization from the authors. */ #ifndef __XCB_H__ #define __XCB_H__ #include <sys/types.h> #if defined(__solaris__) #include <inttypes.h> #else #include <stdint.h> #endif #ifndef _WIN32 #include <sys/uio.h> #else #include "xcb_windefs.h" #endif #include <pthread.h> #ifdef __cplusplus extern "C" { #endif /** * @file xcb.h */ #define XCB_PACKED __attribute__((__packed__)) /** * @defgroup XCB_Core_API XCB Core API * @brief Core API of the XCB library. * * @{ */ /* Pre-defined constants */ /** Current protocol version */ #define X_PROTOCOL 11 /** Current minor version */ #define X_PROTOCOL_REVISION 0 /** X_TCP_PORT + display number = server port for TCP transport */ #define X_TCP_PORT 6000 /** xcb connection errors because of socket, pipe and other stream errors. */ #define XCB_CONN_ERROR 1 /** xcb connection shutdown because of extension not supported */ #define XCB_CONN_CLOSED_EXT_NOTSUPPORTED 2 /** malloc(), calloc() and realloc() error upon failure, for eg ENOMEM */ #define XCB_CONN_CLOSED_MEM_INSUFFICIENT 3 /** Connection closed, exceeding request length that server accepts. */ #define XCB_CONN_CLOSED_REQ_LEN_EXCEED 4 /** Connection closed, error during parsing display string. */ #define XCB_CONN_CLOSED_PARSE_ERR 5 /** Connection closed because the server does not have a screen matching the display. */ #define XCB_CONN_CLOSED_INVALID_SCREEN 6 /** Connection closed because some FD passing operation failed */ #define XCB_CONN_CLOSED_FDPASSING_FAILED 7 #define XCB_TYPE_PAD(T,I) (-(I) & (sizeof(T) > 4 ? 3 : sizeof(T) - 1)) /* Opaque structures */ /** * @brief XCB Connection structure. * * A structure that contain all data that XCB needs to communicate with an X server. */ typedef struct xcb_connection_t xcb_connection_t; /**< Opaque structure containing all data that XCB needs to communicate with an X server. */ /* Other types */ /** * @brief Generic iterator. * * A generic iterator structure. */ typedef struct { void *data; /**< Data of the current iterator */ int rem; /**< remaining elements */ int index; /**< index of the current iterator */ } xcb_generic_iterator_t; /** * @brief Generic reply. * * A generic reply structure. */ typedef struct { uint8_t response_type; /**< Type of the response */ uint8_t pad0; /**< Padding */ uint16_t sequence; /**< Sequence number */ uint32_t length; /**< Length of the response */ } xcb_generic_reply_t; /** * @brief Generic event. * * A generic event structure. */ typedef struct { uint8_t response_type; /**< Type of the response */ uint8_t pad0; /**< Padding */ uint16_t sequence; /**< Sequence number */ uint32_t pad[7]; /**< Padding */ uint32_t full_sequence; /**< full sequence */ } xcb_generic_event_t; /** * @brief Raw Generic event. * * A generic event structure as used on the wire, i.e., without the full_sequence field */ typedef struct { uint8_t response_type; /**< Type of the response */ uint8_t pad0; /**< Padding */ uint16_t sequence; /**< Sequence number */ uint32_t pad[7]; /**< Padding */ } xcb_raw_generic_event_t; /** * @brief GE event * * An event as sent by the XGE extension. The length field specifies the * number of 4-byte blocks trailing the struct. * * @deprecated Since some fields in this struct have unfortunate names, it is * recommended to use xcb_ge_generic_event_t instead. */ typedef struct { uint8_t response_type; /**< Type of the response */ uint8_t pad0; /**< Padding */ uint16_t sequence; /**< Sequence number */ uint32_t length; uint16_t event_type; uint16_t pad1; uint32_t pad[5]; /**< Padding */ uint32_t full_sequence; /**< full sequence */ } xcb_ge_event_t; /** * @brief Generic error. * * A generic error structure. */ typedef struct { uint8_t response_type; /**< Type of the response */ uint8_t error_code; /**< Error code */ uint16_t sequence; /**< Sequence number */ uint32_t resource_id; /** < Resource ID for requests with side effects only */ uint16_t minor_code; /** < Minor opcode of the failed request */ uint8_t major_code; /** < Major opcode of the failed request */ uint8_t pad0; uint32_t pad[5]; /**< Padding */ uint32_t full_sequence; /**< full sequence */ } xcb_generic_error_t; /** * @brief Generic cookie. * * A generic cookie structure. */ typedef struct { unsigned int sequence; /**< Sequence number */ } xcb_void_cookie_t; /* Include the generated xproto header. */ #include "xproto.h" /** XCB_NONE is the universal null resource or null atom parameter value for many core X requests */ #define XCB_NONE 0L /** XCB_COPY_FROM_PARENT can be used for many xcb_create_window parameters */ #define XCB_COPY_FROM_PARENT 0L /** XCB_CURRENT_TIME can be used in most requests that take an xcb_timestamp_t */ #define XCB_CURRENT_TIME 0L /** XCB_NO_SYMBOL fills in unused entries in xcb_keysym_t tables */ #define XCB_NO_SYMBOL 0L /* xcb_auth.c */ /** * @brief Container for authorization information. * * A container for authorization information to be sent to the X server. */ typedef struct xcb_auth_info_t { int namelen; /**< Length of the string name (as returned by strlen). */ char *name; /**< String containing the authentication protocol name, such as "MIT-MAGIC-COOKIE-1" or "XDM-AUTHORIZATION-1". */ int datalen; /**< Length of the data member. */ char *data; /**< Data interpreted in a protocol-specific manner. */ } xcb_auth_info_t; /* xcb_out.c */ /** * @brief Forces any buffered output to be written to the server. * @param c The connection to the X server. * @return > @c 0 on success, <= @c 0 otherwise. * * Forces any buffered output to be written to the server. Blocks * until the write is complete. */ int xcb_flush(xcb_connection_t *c); /** * @brief Returns the maximum request length that this server accepts. * @param c The connection to the X server. * @return The maximum request length field. * * In the absence of the BIG-REQUESTS extension, returns the * maximum request length field from the connection setup data, which * may be as much as 65535. If the server supports BIG-REQUESTS, then * the maximum request length field from the reply to the * BigRequestsEnable request will be returned instead. * * Note that this length is measured in four-byte units, making the * theoretical maximum lengths roughly 256kB without BIG-REQUESTS and * 16GB with. */ uint32_t xcb_get_maximum_request_length(xcb_connection_t *c); /** * @brief Prefetch the maximum request length without blocking. * @param c The connection to the X server. * * Without blocking, does as much work as possible toward computing * the maximum request length accepted by the X server. * * Invoking this function may cause a call to xcb_big_requests_enable, * but will not block waiting for the reply. * xcb_get_maximum_request_length will return the prefetched data * after possibly blocking while the reply is retrieved. * * Note that in order for this function to be fully non-blocking, the * application must previously have called * xcb_prefetch_extension_data(c, &xcb_big_requests_id) and the reply * must have already arrived. */ void xcb_prefetch_maximum_request_length(xcb_connection_t *c); /* xcb_in.c */ /** * @brief Returns the next event or error from the server. * @param c The connection to the X server. * @return The next event from the server. * * Returns the next event or error from the server, or returns null in * the event of an I/O error. Blocks until either an event or error * arrive, or an I/O error occurs. */ xcb_generic_event_t *xcb_wait_for_event(xcb_connection_t *c); /** * @brief Returns the next event or error from the server. * @param c The connection to the X server. * @return The next event from the server. * * Returns the next event or error from the server, if one is * available, or returns @c NULL otherwise. If no event is available, that * might be because an I/O error like connection close occurred while * attempting to read the next event, in which case the connection is * shut down when this function returns. */ xcb_generic_event_t *xcb_poll_for_event(xcb_connection_t *c); /** * @brief Returns the next event without reading from the connection. * @param c The connection to the X server. * @return The next already queued event from the server. * * This is a version of xcb_poll_for_event that only examines the * event queue for new events. The function doesn't try to read new * events from the connection if no queued events are found. * * This function is useful for callers that know in advance that all * interesting events have already been read from the connection. For * example, callers might use xcb_wait_for_reply and be interested * only of events that preceded a specific reply. */ xcb_generic_event_t *xcb_poll_for_queued_event(xcb_connection_t *c); typedef struct xcb_special_event xcb_special_event_t; /** * @brief Returns the next event from a special queue */ xcb_generic_event_t *xcb_poll_for_special_event(xcb_connection_t *c, xcb_special_event_t *se); /** * @brief Returns the next event from a special queue, blocking until one arrives */ xcb_generic_event_t *xcb_wait_for_special_event(xcb_connection_t *c, xcb_special_event_t *se); /** * @typedef typedef struct xcb_extension_t xcb_extension_t */ typedef struct xcb_extension_t xcb_extension_t; /**< Opaque structure used as key for xcb_get_extension_data_t. */ /** * @brief Listen for a special event */ xcb_special_event_t *xcb_register_for_special_xge(xcb_connection_t *c, xcb_extension_t *ext, uint32_t eid, uint32_t *stamp); /** * @brief Stop listening for a special event */ void xcb_unregister_for_special_event(xcb_connection_t *c, xcb_special_event_t *se); /** * @brief Return the error for a request, or NULL if none can ever arrive. * @param c The connection to the X server. * @param cookie The request cookie. * @return The error for the request, or NULL if none can ever arrive. * * The xcb_void_cookie_t cookie supplied to this function must have resulted * from a call to xcb_[request_name]_checked(). This function will block * until one of two conditions happens. If an error is received, it will be * returned. If a reply to a subsequent request has already arrived, no error * can arrive for this request, so this function will return NULL. * * Note that this function will perform a sync if needed to ensure that the * sequence number will advance beyond that provided in cookie; this is a * convenience to avoid races in determining whether the sync is needed. */ xcb_generic_error_t *xcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie); /** * @brief Discards the reply for a request. * @param c The connection to the X server. * @param sequence The request sequence number from a cookie. * * Discards the reply for a request. Additionally, any error generated * by the request is also discarded (unless it was an _unchecked request * and the error has already arrived). * * This function will not block even if the reply is not yet available. * * Note that the sequence really does have to come from an xcb cookie; * this function is not designed to operate on socket-handoff replies. */ void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence); /** * @brief Discards the reply for a request, given by a 64bit sequence number * @param c The connection to the X server. * @param sequence 64-bit sequence number as returned by xcb_send_request64(). * * Discards the reply for a request. Additionally, any error generated * by the request is also discarded (unless it was an _unchecked request * and the error has already arrived). * * This function will not block even if the reply is not yet available. * * Note that the sequence really does have to come from xcb_send_request64(); * the cookie sequence number is defined as "unsigned" int and therefore * not 64-bit on all platforms. * This function is not designed to operate on socket-handoff replies. * * Unlike its xcb_discard_reply() counterpart, the given sequence number is not * automatically "widened" to 64-bit. */ void xcb_discard_reply64(xcb_connection_t *c, uint64_t sequence); /* xcb_ext.c */ /** * @brief Caches reply information from QueryExtension requests. * @param c The connection. * @param ext The extension data. * @return A pointer to the xcb_query_extension_reply_t for the extension. * * This function is the primary interface to the "extension cache", * which caches reply information from QueryExtension * requests. Invoking this function may cause a call to * xcb_query_extension to retrieve extension information from the * server, and may block until extension data is received from the * server. * * The result must not be freed. This storage is managed by the cache * itself. */ const struct xcb_query_extension_reply_t *xcb_get_extension_data(xcb_connection_t *c, xcb_extension_t *ext); /** * @brief Prefetch of extension data into the extension cache * @param c The connection. * @param ext The extension data. * * This function allows a "prefetch" of extension data into the * extension cache. Invoking the function may cause a call to * xcb_query_extension, but will not block waiting for the * reply. xcb_get_extension_data will return the prefetched data after * possibly blocking while it is retrieved. */ void xcb_prefetch_extension_data(xcb_connection_t *c, xcb_extension_t *ext); /* xcb_conn.c */ /** * @brief Access the data returned by the server. * @param c The connection. * @return A pointer to an xcb_setup_t structure. * * Accessor for the data returned by the server when the xcb_connection_t * was initialized. This data includes * - the server's required format for images, * - a list of available visuals, * - a list of available screens, * - the server's maximum request length (in the absence of the * BIG-REQUESTS extension), * - and other assorted information. * * See the X protocol specification for more details. * * The result must not be freed. */ const struct xcb_setup_t *xcb_get_setup(xcb_connection_t *c); /** * @brief Access the file descriptor of the connection. * @param c The connection. * @return The file descriptor. * * Accessor for the file descriptor that was passed to the * xcb_connect_to_fd call that returned @p c. */ int xcb_get_file_descriptor(xcb_connection_t *c); /** * @brief Test whether the connection has shut down due to a fatal error. * @param c The connection. * @return > 0 if the connection is in an error state; 0 otherwise. * * Some errors that occur in the context of an xcb_connection_t * are unrecoverable. When such an error occurs, the * connection is shut down and further operations on the * xcb_connection_t have no effect, but memory will not be freed until * xcb_disconnect() is called on the xcb_connection_t. * * @return XCB_CONN_ERROR, because of socket errors, pipe errors or other stream errors. * @return XCB_CONN_CLOSED_EXT_NOTSUPPORTED, when extension not supported. * @return XCB_CONN_CLOSED_MEM_INSUFFICIENT, when memory not available. * @return XCB_CONN_CLOSED_REQ_LEN_EXCEED, exceeding request length that server accepts. * @return XCB_CONN_CLOSED_PARSE_ERR, error during parsing display string. * @return XCB_CONN_CLOSED_INVALID_SCREEN, because the server does not have a screen matching the display. */ int xcb_connection_has_error(xcb_connection_t *c); /** * @brief Connects to the X server. * @param fd The file descriptor. * @param auth_info Authentication data. * @return A newly allocated xcb_connection_t structure. * * Connects to an X server, given the open socket @p fd and the * xcb_auth_info_t @p auth_info. The file descriptor @p fd is * bidirectionally connected to an X server. If the connection * should be unauthenticated, @p auth_info must be @c * NULL. * * Always returns a non-NULL pointer to a xcb_connection_t, even on failure. * Callers need to use xcb_connection_has_error() to check for failure. * When finished, use xcb_disconnect() to close the connection and free * the structure. */ xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info); /** * @brief Closes the connection. * @param c The connection. * * Closes the file descriptor and frees all memory associated with the * connection @c c. If @p c is @c NULL, nothing is done. */ void xcb_disconnect(xcb_connection_t *c); /* xcb_util.c */ /** * @brief Parses a display string name in the form documented by X(7x). * @param name The name of the display. * @param host A pointer to a malloc'd copy of the hostname. * @param display A pointer to the display number. * @param screen A pointer to the screen number. * @return 0 on failure, non 0 otherwise. * * Parses the display string name @p display_name in the form * documented by X(7x). Has no side effects on failure. If * @p displayname is @c NULL or empty, it uses the environment * variable DISPLAY. @p hostp is a pointer to a newly allocated string * that contain the host name. @p displayp is set to the display * number and @p screenp to the preferred screen number. @p screenp * can be @c NULL. If @p displayname does not contain a screen number, * it is set to @c 0. */ int xcb_parse_display(const char *name, char **host, int *display, int *screen); /** * @brief Connects to the X server. * @param displayname The name of the display. * @param screenp A pointer to a preferred screen number. * @return A newly allocated xcb_connection_t structure. * * Connects to the X server specified by @p displayname. If @p * displayname is @c NULL, uses the value of the DISPLAY environment * variable. If a particular screen on that server is preferred, the * int pointed to by @p screenp (if not @c NULL) will be set to that * screen; otherwise the screen will be set to 0. * * Always returns a non-NULL pointer to a xcb_connection_t, even on failure. * Callers need to use xcb_connection_has_error() to check for failure. * When finished, use xcb_disconnect() to close the connection and free * the structure. */ xcb_connection_t *xcb_connect(const char *displayname, int *screenp); /** * @brief Connects to the X server, using an authorization information. * @param display The name of the display. * @param auth The authorization information. * @param screen A pointer to a preferred screen number. * @return A newly allocated xcb_connection_t structure. * * Connects to the X server specified by @p displayname, using the * authorization @p auth. If a particular screen on that server is * preferred, the int pointed to by @p screenp (if not @c NULL) will * be set to that screen; otherwise @p screenp will be set to 0. * * Always returns a non-NULL pointer to a xcb_connection_t, even on failure. * Callers need to use xcb_connection_has_error() to check for failure. * When finished, use xcb_disconnect() to close the connection and free * the structure. */ xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *display, xcb_auth_info_t *auth, int *screen); /* xcb_xid.c */ /** * @brief Allocates an XID for a new object. * @param c The connection. * @return A newly allocated XID. * * Allocates an XID for a new object. Typically used just prior to * various object creation functions, such as xcb_create_window. */ uint32_t xcb_generate_id(xcb_connection_t *c); /** * @} */ #ifdef __cplusplus } #endif #endif /* __XCB_H__ */ �������������������������������������������xcb/res.h�������������������������������������������������������������������������������������������0000644�����������������00000057643�14763166026�0006314 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from res.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_Res_API XCB Res API * @brief Res XCB Protocol Implementation. * @{ **/ #ifndef __RES_H #define __RES_H #include "xcb.h" #include "xproto.h" #ifdef __cplusplus extern "C" { #endif #define XCB_RES_MAJOR_VERSION 1 #define XCB_RES_MINOR_VERSION 2 extern xcb_extension_t xcb_res_id; /** * @brief xcb_res_client_t **/ typedef struct xcb_res_client_t { uint32_t resource_base; uint32_t resource_mask; } xcb_res_client_t; /** * @brief xcb_res_client_iterator_t **/ typedef struct xcb_res_client_iterator_t { xcb_res_client_t *data; int rem; int index; } xcb_res_client_iterator_t; /** * @brief xcb_res_type_t **/ typedef struct xcb_res_type_t { xcb_atom_t resource_type; uint32_t count; } xcb_res_type_t; /** * @brief xcb_res_type_iterator_t **/ typedef struct xcb_res_type_iterator_t { xcb_res_type_t *data; int rem; int index; } xcb_res_type_iterator_t; typedef enum xcb_res_client_id_mask_t { XCB_RES_CLIENT_ID_MASK_CLIENT_XID = 1, XCB_RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID = 2 } xcb_res_client_id_mask_t; /** * @brief xcb_res_client_id_spec_t **/ typedef struct xcb_res_client_id_spec_t { uint32_t client; uint32_t mask; } xcb_res_client_id_spec_t; /** * @brief xcb_res_client_id_spec_iterator_t **/ typedef struct xcb_res_client_id_spec_iterator_t { xcb_res_client_id_spec_t *data; int rem; int index; } xcb_res_client_id_spec_iterator_t; /** * @brief xcb_res_client_id_value_t **/ typedef struct xcb_res_client_id_value_t { xcb_res_client_id_spec_t spec; uint32_t length; } xcb_res_client_id_value_t; /** * @brief xcb_res_client_id_value_iterator_t **/ typedef struct xcb_res_client_id_value_iterator_t { xcb_res_client_id_value_t *data; int rem; int index; } xcb_res_client_id_value_iterator_t; /** * @brief xcb_res_resource_id_spec_t **/ typedef struct xcb_res_resource_id_spec_t { uint32_t resource; uint32_t type; } xcb_res_resource_id_spec_t; /** * @brief xcb_res_resource_id_spec_iterator_t **/ typedef struct xcb_res_resource_id_spec_iterator_t { xcb_res_resource_id_spec_t *data; int rem; int index; } xcb_res_resource_id_spec_iterator_t; /** * @brief xcb_res_resource_size_spec_t **/ typedef struct xcb_res_resource_size_spec_t { xcb_res_resource_id_spec_t spec; uint32_t bytes; uint32_t ref_count; uint32_t use_count; } xcb_res_resource_size_spec_t; /** * @brief xcb_res_resource_size_spec_iterator_t **/ typedef struct xcb_res_resource_size_spec_iterator_t { xcb_res_resource_size_spec_t *data; int rem; int index; } xcb_res_resource_size_spec_iterator_t; /** * @brief xcb_res_resource_size_value_t **/ typedef struct xcb_res_resource_size_value_t { xcb_res_resource_size_spec_t size; uint32_t num_cross_references; } xcb_res_resource_size_value_t; /** * @brief xcb_res_resource_size_value_iterator_t **/ typedef struct xcb_res_resource_size_value_iterator_t { xcb_res_resource_size_value_t *data; int rem; int index; } xcb_res_resource_size_value_iterator_t; /** * @brief xcb_res_query_version_cookie_t **/ typedef struct xcb_res_query_version_cookie_t { unsigned int sequence; } xcb_res_query_version_cookie_t; /** Opcode for xcb_res_query_version. */ #define XCB_RES_QUERY_VERSION 0 /** * @brief xcb_res_query_version_request_t **/ typedef struct xcb_res_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t client_major; uint8_t client_minor; } xcb_res_query_version_request_t; /** * @brief xcb_res_query_version_reply_t **/ typedef struct xcb_res_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t server_major; uint16_t server_minor; } xcb_res_query_version_reply_t; /** * @brief xcb_res_query_clients_cookie_t **/ typedef struct xcb_res_query_clients_cookie_t { unsigned int sequence; } xcb_res_query_clients_cookie_t; /** Opcode for xcb_res_query_clients. */ #define XCB_RES_QUERY_CLIENTS 1 /** * @brief xcb_res_query_clients_request_t **/ typedef struct xcb_res_query_clients_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_res_query_clients_request_t; /** * @brief xcb_res_query_clients_reply_t **/ typedef struct xcb_res_query_clients_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t num_clients; uint8_t pad1[20]; } xcb_res_query_clients_reply_t; /** * @brief xcb_res_query_client_resources_cookie_t **/ typedef struct xcb_res_query_client_resources_cookie_t { unsigned int sequence; } xcb_res_query_client_resources_cookie_t; /** Opcode for xcb_res_query_client_resources. */ #define XCB_RES_QUERY_CLIENT_RESOURCES 2 /** * @brief xcb_res_query_client_resources_request_t **/ typedef struct xcb_res_query_client_resources_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t xid; } xcb_res_query_client_resources_request_t; /** * @brief xcb_res_query_client_resources_reply_t **/ typedef struct xcb_res_query_client_resources_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t num_types; uint8_t pad1[20]; } xcb_res_query_client_resources_reply_t; /** * @brief xcb_res_query_client_pixmap_bytes_cookie_t **/ typedef struct xcb_res_query_client_pixmap_bytes_cookie_t { unsigned int sequence; } xcb_res_query_client_pixmap_bytes_cookie_t; /** Opcode for xcb_res_query_client_pixmap_bytes. */ #define XCB_RES_QUERY_CLIENT_PIXMAP_BYTES 3 /** * @brief xcb_res_query_client_pixmap_bytes_request_t **/ typedef struct xcb_res_query_client_pixmap_bytes_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t xid; } xcb_res_query_client_pixmap_bytes_request_t; /** * @brief xcb_res_query_client_pixmap_bytes_reply_t **/ typedef struct xcb_res_query_client_pixmap_bytes_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t bytes; uint32_t bytes_overflow; } xcb_res_query_client_pixmap_bytes_reply_t; /** * @brief xcb_res_query_client_ids_cookie_t **/ typedef struct xcb_res_query_client_ids_cookie_t { unsigned int sequence; } xcb_res_query_client_ids_cookie_t; /** Opcode for xcb_res_query_client_ids. */ #define XCB_RES_QUERY_CLIENT_IDS 4 /** * @brief xcb_res_query_client_ids_request_t **/ typedef struct xcb_res_query_client_ids_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t num_specs; } xcb_res_query_client_ids_request_t; /** * @brief xcb_res_query_client_ids_reply_t **/ typedef struct xcb_res_query_client_ids_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t num_ids; uint8_t pad1[20]; } xcb_res_query_client_ids_reply_t; /** * @brief xcb_res_query_resource_bytes_cookie_t **/ typedef struct xcb_res_query_resource_bytes_cookie_t { unsigned int sequence; } xcb_res_query_resource_bytes_cookie_t; /** Opcode for xcb_res_query_resource_bytes. */ #define XCB_RES_QUERY_RESOURCE_BYTES 5 /** * @brief xcb_res_query_resource_bytes_request_t **/ typedef struct xcb_res_query_resource_bytes_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t client; uint32_t num_specs; } xcb_res_query_resource_bytes_request_t; /** * @brief xcb_res_query_resource_bytes_reply_t **/ typedef struct xcb_res_query_resource_bytes_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t num_sizes; uint8_t pad1[20]; } xcb_res_query_resource_bytes_reply_t; /** * Get the next element of the iterator * @param i Pointer to a xcb_res_client_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_res_client_t) */ void xcb_res_client_next (xcb_res_client_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_res_client_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_res_client_end (xcb_res_client_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_res_type_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_res_type_t) */ void xcb_res_type_next (xcb_res_type_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_res_type_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_res_type_end (xcb_res_type_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_res_client_id_spec_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_res_client_id_spec_t) */ void xcb_res_client_id_spec_next (xcb_res_client_id_spec_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_res_client_id_spec_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_res_client_id_spec_end (xcb_res_client_id_spec_iterator_t i); int xcb_res_client_id_value_sizeof (const void *_buffer); uint32_t * xcb_res_client_id_value_value (const xcb_res_client_id_value_t *R); int xcb_res_client_id_value_value_length (const xcb_res_client_id_value_t *R); xcb_generic_iterator_t xcb_res_client_id_value_value_end (const xcb_res_client_id_value_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_res_client_id_value_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_res_client_id_value_t) */ void xcb_res_client_id_value_next (xcb_res_client_id_value_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_res_client_id_value_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_res_client_id_value_end (xcb_res_client_id_value_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_res_resource_id_spec_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_res_resource_id_spec_t) */ void xcb_res_resource_id_spec_next (xcb_res_resource_id_spec_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_res_resource_id_spec_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_res_resource_id_spec_end (xcb_res_resource_id_spec_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_res_resource_size_spec_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_res_resource_size_spec_t) */ void xcb_res_resource_size_spec_next (xcb_res_resource_size_spec_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_res_resource_size_spec_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_res_resource_size_spec_end (xcb_res_resource_size_spec_iterator_t i); int xcb_res_resource_size_value_sizeof (const void *_buffer); xcb_res_resource_size_spec_t * xcb_res_resource_size_value_cross_references (const xcb_res_resource_size_value_t *R); int xcb_res_resource_size_value_cross_references_length (const xcb_res_resource_size_value_t *R); xcb_res_resource_size_spec_iterator_t xcb_res_resource_size_value_cross_references_iterator (const xcb_res_resource_size_value_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_res_resource_size_value_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_res_resource_size_value_t) */ void xcb_res_resource_size_value_next (xcb_res_resource_size_value_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_res_resource_size_value_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_res_resource_size_value_end (xcb_res_resource_size_value_iterator_t i); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_res_query_version_cookie_t xcb_res_query_version (xcb_connection_t *c, uint8_t client_major, uint8_t client_minor); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_res_query_version_cookie_t xcb_res_query_version_unchecked (xcb_connection_t *c, uint8_t client_major, uint8_t client_minor); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_res_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_res_query_version_reply_t * xcb_res_query_version_reply (xcb_connection_t *c, xcb_res_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_res_query_clients_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_res_query_clients_cookie_t xcb_res_query_clients (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_res_query_clients_cookie_t xcb_res_query_clients_unchecked (xcb_connection_t *c); xcb_res_client_t * xcb_res_query_clients_clients (const xcb_res_query_clients_reply_t *R); int xcb_res_query_clients_clients_length (const xcb_res_query_clients_reply_t *R); xcb_res_client_iterator_t xcb_res_query_clients_clients_iterator (const xcb_res_query_clients_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_res_query_clients_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_res_query_clients_reply_t * xcb_res_query_clients_reply (xcb_connection_t *c, xcb_res_query_clients_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_res_query_client_resources_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_res_query_client_resources_cookie_t xcb_res_query_client_resources (xcb_connection_t *c, uint32_t xid); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_res_query_client_resources_cookie_t xcb_res_query_client_resources_unchecked (xcb_connection_t *c, uint32_t xid); xcb_res_type_t * xcb_res_query_client_resources_types (const xcb_res_query_client_resources_reply_t *R); int xcb_res_query_client_resources_types_length (const xcb_res_query_client_resources_reply_t *R); xcb_res_type_iterator_t xcb_res_query_client_resources_types_iterator (const xcb_res_query_client_resources_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_res_query_client_resources_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_res_query_client_resources_reply_t * xcb_res_query_client_resources_reply (xcb_connection_t *c, xcb_res_query_client_resources_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_res_query_client_pixmap_bytes_cookie_t xcb_res_query_client_pixmap_bytes (xcb_connection_t *c, uint32_t xid); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_res_query_client_pixmap_bytes_cookie_t xcb_res_query_client_pixmap_bytes_unchecked (xcb_connection_t *c, uint32_t xid); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_res_query_client_pixmap_bytes_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_res_query_client_pixmap_bytes_reply_t * xcb_res_query_client_pixmap_bytes_reply (xcb_connection_t *c, xcb_res_query_client_pixmap_bytes_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_res_query_client_ids_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_res_query_client_ids_cookie_t xcb_res_query_client_ids (xcb_connection_t *c, uint32_t num_specs, const xcb_res_client_id_spec_t *specs); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_res_query_client_ids_cookie_t xcb_res_query_client_ids_unchecked (xcb_connection_t *c, uint32_t num_specs, const xcb_res_client_id_spec_t *specs); int xcb_res_query_client_ids_ids_length (const xcb_res_query_client_ids_reply_t *R); xcb_res_client_id_value_iterator_t xcb_res_query_client_ids_ids_iterator (const xcb_res_query_client_ids_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_res_query_client_ids_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_res_query_client_ids_reply_t * xcb_res_query_client_ids_reply (xcb_connection_t *c, xcb_res_query_client_ids_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_res_query_resource_bytes_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_res_query_resource_bytes_cookie_t xcb_res_query_resource_bytes (xcb_connection_t *c, uint32_t client, uint32_t num_specs, const xcb_res_resource_id_spec_t *specs); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_res_query_resource_bytes_cookie_t xcb_res_query_resource_bytes_unchecked (xcb_connection_t *c, uint32_t client, uint32_t num_specs, const xcb_res_resource_id_spec_t *specs); int xcb_res_query_resource_bytes_sizes_length (const xcb_res_query_resource_bytes_reply_t *R); xcb_res_resource_size_value_iterator_t xcb_res_query_resource_bytes_sizes_iterator (const xcb_res_query_resource_bytes_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_res_query_resource_bytes_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_res_query_resource_bytes_reply_t * xcb_res_query_resource_bytes_reply (xcb_connection_t *c, xcb_res_query_resource_bytes_cookie_t cookie /**< */, xcb_generic_error_t **e); #ifdef __cplusplus } #endif #endif /** * @} */ ���������������������������������������������������������������������������������������������xcb/dpms.h������������������������������������������������������������������������������������������0000644�����������������00000027224�14763166026�0006456 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from dpms.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_DPMS_API XCB DPMS API * @brief DPMS XCB Protocol Implementation. * @{ **/ #ifndef __DPMS_H #define __DPMS_H #include "xcb.h" #ifdef __cplusplus extern "C" { #endif #define XCB_DPMS_MAJOR_VERSION 0 #define XCB_DPMS_MINOR_VERSION 0 extern xcb_extension_t xcb_dpms_id; /** * @brief xcb_dpms_get_version_cookie_t **/ typedef struct xcb_dpms_get_version_cookie_t { unsigned int sequence; } xcb_dpms_get_version_cookie_t; /** Opcode for xcb_dpms_get_version. */ #define XCB_DPMS_GET_VERSION 0 /** * @brief xcb_dpms_get_version_request_t **/ typedef struct xcb_dpms_get_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint16_t client_major_version; uint16_t client_minor_version; } xcb_dpms_get_version_request_t; /** * @brief xcb_dpms_get_version_reply_t **/ typedef struct xcb_dpms_get_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t server_major_version; uint16_t server_minor_version; } xcb_dpms_get_version_reply_t; /** * @brief xcb_dpms_capable_cookie_t **/ typedef struct xcb_dpms_capable_cookie_t { unsigned int sequence; } xcb_dpms_capable_cookie_t; /** Opcode for xcb_dpms_capable. */ #define XCB_DPMS_CAPABLE 1 /** * @brief xcb_dpms_capable_request_t **/ typedef struct xcb_dpms_capable_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_dpms_capable_request_t; /** * @brief xcb_dpms_capable_reply_t **/ typedef struct xcb_dpms_capable_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t capable; uint8_t pad1[23]; } xcb_dpms_capable_reply_t; /** * @brief xcb_dpms_get_timeouts_cookie_t **/ typedef struct xcb_dpms_get_timeouts_cookie_t { unsigned int sequence; } xcb_dpms_get_timeouts_cookie_t; /** Opcode for xcb_dpms_get_timeouts. */ #define XCB_DPMS_GET_TIMEOUTS 2 /** * @brief xcb_dpms_get_timeouts_request_t **/ typedef struct xcb_dpms_get_timeouts_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_dpms_get_timeouts_request_t; /** * @brief xcb_dpms_get_timeouts_reply_t **/ typedef struct xcb_dpms_get_timeouts_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t standby_timeout; uint16_t suspend_timeout; uint16_t off_timeout; uint8_t pad1[18]; } xcb_dpms_get_timeouts_reply_t; /** Opcode for xcb_dpms_set_timeouts. */ #define XCB_DPMS_SET_TIMEOUTS 3 /** * @brief xcb_dpms_set_timeouts_request_t **/ typedef struct xcb_dpms_set_timeouts_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint16_t standby_timeout; uint16_t suspend_timeout; uint16_t off_timeout; } xcb_dpms_set_timeouts_request_t; /** Opcode for xcb_dpms_enable. */ #define XCB_DPMS_ENABLE 4 /** * @brief xcb_dpms_enable_request_t **/ typedef struct xcb_dpms_enable_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_dpms_enable_request_t; /** Opcode for xcb_dpms_disable. */ #define XCB_DPMS_DISABLE 5 /** * @brief xcb_dpms_disable_request_t **/ typedef struct xcb_dpms_disable_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_dpms_disable_request_t; typedef enum xcb_dpms_dpms_mode_t { XCB_DPMS_DPMS_MODE_ON = 0, XCB_DPMS_DPMS_MODE_STANDBY = 1, XCB_DPMS_DPMS_MODE_SUSPEND = 2, XCB_DPMS_DPMS_MODE_OFF = 3 } xcb_dpms_dpms_mode_t; /** Opcode for xcb_dpms_force_level. */ #define XCB_DPMS_FORCE_LEVEL 6 /** * @brief xcb_dpms_force_level_request_t **/ typedef struct xcb_dpms_force_level_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint16_t power_level; } xcb_dpms_force_level_request_t; /** * @brief xcb_dpms_info_cookie_t **/ typedef struct xcb_dpms_info_cookie_t { unsigned int sequence; } xcb_dpms_info_cookie_t; /** Opcode for xcb_dpms_info. */ #define XCB_DPMS_INFO 7 /** * @brief xcb_dpms_info_request_t **/ typedef struct xcb_dpms_info_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_dpms_info_request_t; /** * @brief xcb_dpms_info_reply_t **/ typedef struct xcb_dpms_info_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t power_level; uint8_t state; uint8_t pad1[21]; } xcb_dpms_info_reply_t; /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dpms_get_version_cookie_t xcb_dpms_get_version (xcb_connection_t *c, uint16_t client_major_version, uint16_t client_minor_version); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dpms_get_version_cookie_t xcb_dpms_get_version_unchecked (xcb_connection_t *c, uint16_t client_major_version, uint16_t client_minor_version); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dpms_get_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dpms_get_version_reply_t * xcb_dpms_get_version_reply (xcb_connection_t *c, xcb_dpms_get_version_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dpms_capable_cookie_t xcb_dpms_capable (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dpms_capable_cookie_t xcb_dpms_capable_unchecked (xcb_connection_t *c); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dpms_capable_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dpms_capable_reply_t * xcb_dpms_capable_reply (xcb_connection_t *c, xcb_dpms_capable_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dpms_get_timeouts_cookie_t xcb_dpms_get_timeouts (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dpms_get_timeouts_cookie_t xcb_dpms_get_timeouts_unchecked (xcb_connection_t *c); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dpms_get_timeouts_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dpms_get_timeouts_reply_t * xcb_dpms_get_timeouts_reply (xcb_connection_t *c, xcb_dpms_get_timeouts_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_dpms_set_timeouts_checked (xcb_connection_t *c, uint16_t standby_timeout, uint16_t suspend_timeout, uint16_t off_timeout); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_dpms_set_timeouts (xcb_connection_t *c, uint16_t standby_timeout, uint16_t suspend_timeout, uint16_t off_timeout); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_dpms_enable_checked (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_dpms_enable (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_dpms_disable_checked (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_dpms_disable (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_dpms_force_level_checked (xcb_connection_t *c, uint16_t power_level); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_dpms_force_level (xcb_connection_t *c, uint16_t power_level); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dpms_info_cookie_t xcb_dpms_info (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dpms_info_cookie_t xcb_dpms_info_unchecked (xcb_connection_t *c); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dpms_info_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dpms_info_reply_t * xcb_dpms_info_reply (xcb_connection_t *c, xcb_dpms_info_cookie_t cookie /**< */, xcb_generic_error_t **e); #ifdef __cplusplus } #endif #endif /** * @} */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/ge.h��������������������������������������������������������������������������������������������0000644�����������������00000005645�14763166026�0006111 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from ge.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_GenericEvent_API XCB GenericEvent API * @brief GenericEvent XCB Protocol Implementation. * @{ **/ #ifndef __GE_H #define __GE_H #include "xcb.h" #ifdef __cplusplus extern "C" { #endif #define XCB_GENERICEVENT_MAJOR_VERSION 1 #define XCB_GENERICEVENT_MINOR_VERSION 0 extern xcb_extension_t xcb_genericevent_id; /** * @brief xcb_genericevent_query_version_cookie_t **/ typedef struct xcb_genericevent_query_version_cookie_t { unsigned int sequence; } xcb_genericevent_query_version_cookie_t; /** Opcode for xcb_genericevent_query_version. */ #define XCB_GENERICEVENT_QUERY_VERSION 0 /** * @brief xcb_genericevent_query_version_request_t **/ typedef struct xcb_genericevent_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint16_t client_major_version; uint16_t client_minor_version; } xcb_genericevent_query_version_request_t; /** * @brief xcb_genericevent_query_version_reply_t **/ typedef struct xcb_genericevent_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t major_version; uint16_t minor_version; uint8_t pad1[20]; } xcb_genericevent_query_version_reply_t; /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_genericevent_query_version_cookie_t xcb_genericevent_query_version (xcb_connection_t *c, uint16_t client_major_version, uint16_t client_minor_version); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_genericevent_query_version_cookie_t xcb_genericevent_query_version_unchecked (xcb_connection_t *c, uint16_t client_major_version, uint16_t client_minor_version); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_genericevent_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_genericevent_query_version_reply_t * xcb_genericevent_query_version_reply (xcb_connection_t *c, xcb_genericevent_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); #ifdef __cplusplus } #endif #endif /** * @} */ �������������������������������������������������������������������������������������������xcb/sync.h������������������������������������������������������������������������������������������0000644�����������������00000125354�14763166026�0006472 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from sync.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_Sync_API XCB Sync API * @brief Sync XCB Protocol Implementation. * @{ **/ #ifndef __SYNC_H #define __SYNC_H #include "xcb.h" #include "xproto.h" #ifdef __cplusplus extern "C" { #endif #define XCB_SYNC_MAJOR_VERSION 3 #define XCB_SYNC_MINOR_VERSION 1 extern xcb_extension_t xcb_sync_id; typedef uint32_t xcb_sync_alarm_t; /** * @brief xcb_sync_alarm_iterator_t **/ typedef struct xcb_sync_alarm_iterator_t { xcb_sync_alarm_t *data; int rem; int index; } xcb_sync_alarm_iterator_t; typedef enum xcb_sync_alarmstate_t { XCB_SYNC_ALARMSTATE_ACTIVE = 0, XCB_SYNC_ALARMSTATE_INACTIVE = 1, XCB_SYNC_ALARMSTATE_DESTROYED = 2 } xcb_sync_alarmstate_t; typedef uint32_t xcb_sync_counter_t; /** * @brief xcb_sync_counter_iterator_t **/ typedef struct xcb_sync_counter_iterator_t { xcb_sync_counter_t *data; int rem; int index; } xcb_sync_counter_iterator_t; typedef uint32_t xcb_sync_fence_t; /** * @brief xcb_sync_fence_iterator_t **/ typedef struct xcb_sync_fence_iterator_t { xcb_sync_fence_t *data; int rem; int index; } xcb_sync_fence_iterator_t; typedef enum xcb_sync_testtype_t { XCB_SYNC_TESTTYPE_POSITIVE_TRANSITION = 0, XCB_SYNC_TESTTYPE_NEGATIVE_TRANSITION = 1, XCB_SYNC_TESTTYPE_POSITIVE_COMPARISON = 2, XCB_SYNC_TESTTYPE_NEGATIVE_COMPARISON = 3 } xcb_sync_testtype_t; typedef enum xcb_sync_valuetype_t { XCB_SYNC_VALUETYPE_ABSOLUTE = 0, XCB_SYNC_VALUETYPE_RELATIVE = 1 } xcb_sync_valuetype_t; typedef enum xcb_sync_ca_t { XCB_SYNC_CA_COUNTER = 1, XCB_SYNC_CA_VALUE_TYPE = 2, XCB_SYNC_CA_VALUE = 4, XCB_SYNC_CA_TEST_TYPE = 8, XCB_SYNC_CA_DELTA = 16, XCB_SYNC_CA_EVENTS = 32 } xcb_sync_ca_t; /** * @brief xcb_sync_int64_t **/ typedef struct xcb_sync_int64_t { int32_t hi; uint32_t lo; } xcb_sync_int64_t; /** * @brief xcb_sync_int64_iterator_t **/ typedef struct xcb_sync_int64_iterator_t { xcb_sync_int64_t *data; int rem; int index; } xcb_sync_int64_iterator_t; /** * @brief xcb_sync_systemcounter_t **/ typedef struct xcb_sync_systemcounter_t { xcb_sync_counter_t counter; xcb_sync_int64_t resolution; uint16_t name_len; } xcb_sync_systemcounter_t; /** * @brief xcb_sync_systemcounter_iterator_t **/ typedef struct xcb_sync_systemcounter_iterator_t { xcb_sync_systemcounter_t *data; int rem; int index; } xcb_sync_systemcounter_iterator_t; /** * @brief xcb_sync_trigger_t **/ typedef struct xcb_sync_trigger_t { xcb_sync_counter_t counter; uint32_t wait_type; xcb_sync_int64_t wait_value; uint32_t test_type; } xcb_sync_trigger_t; /** * @brief xcb_sync_trigger_iterator_t **/ typedef struct xcb_sync_trigger_iterator_t { xcb_sync_trigger_t *data; int rem; int index; } xcb_sync_trigger_iterator_t; /** * @brief xcb_sync_waitcondition_t **/ typedef struct xcb_sync_waitcondition_t { xcb_sync_trigger_t trigger; xcb_sync_int64_t event_threshold; } xcb_sync_waitcondition_t; /** * @brief xcb_sync_waitcondition_iterator_t **/ typedef struct xcb_sync_waitcondition_iterator_t { xcb_sync_waitcondition_t *data; int rem; int index; } xcb_sync_waitcondition_iterator_t; /** Opcode for xcb_sync_counter. */ #define XCB_SYNC_COUNTER 0 /** * @brief xcb_sync_counter_error_t **/ typedef struct xcb_sync_counter_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; uint32_t bad_counter; uint16_t minor_opcode; uint8_t major_opcode; } xcb_sync_counter_error_t; /** Opcode for xcb_sync_alarm. */ #define XCB_SYNC_ALARM 1 /** * @brief xcb_sync_alarm_error_t **/ typedef struct xcb_sync_alarm_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; uint32_t bad_alarm; uint16_t minor_opcode; uint8_t major_opcode; } xcb_sync_alarm_error_t; /** * @brief xcb_sync_initialize_cookie_t **/ typedef struct xcb_sync_initialize_cookie_t { unsigned int sequence; } xcb_sync_initialize_cookie_t; /** Opcode for xcb_sync_initialize. */ #define XCB_SYNC_INITIALIZE 0 /** * @brief xcb_sync_initialize_request_t **/ typedef struct xcb_sync_initialize_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t desired_major_version; uint8_t desired_minor_version; } xcb_sync_initialize_request_t; /** * @brief xcb_sync_initialize_reply_t **/ typedef struct xcb_sync_initialize_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t major_version; uint8_t minor_version; uint8_t pad1[22]; } xcb_sync_initialize_reply_t; /** * @brief xcb_sync_list_system_counters_cookie_t **/ typedef struct xcb_sync_list_system_counters_cookie_t { unsigned int sequence; } xcb_sync_list_system_counters_cookie_t; /** Opcode for xcb_sync_list_system_counters. */ #define XCB_SYNC_LIST_SYSTEM_COUNTERS 1 /** * @brief xcb_sync_list_system_counters_request_t **/ typedef struct xcb_sync_list_system_counters_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_sync_list_system_counters_request_t; /** * @brief xcb_sync_list_system_counters_reply_t **/ typedef struct xcb_sync_list_system_counters_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t counters_len; uint8_t pad1[20]; } xcb_sync_list_system_counters_reply_t; /** Opcode for xcb_sync_create_counter. */ #define XCB_SYNC_CREATE_COUNTER 2 /** * @brief xcb_sync_create_counter_request_t **/ typedef struct xcb_sync_create_counter_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_sync_counter_t id; xcb_sync_int64_t initial_value; } xcb_sync_create_counter_request_t; /** Opcode for xcb_sync_destroy_counter. */ #define XCB_SYNC_DESTROY_COUNTER 6 /** * @brief xcb_sync_destroy_counter_request_t **/ typedef struct xcb_sync_destroy_counter_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_sync_counter_t counter; } xcb_sync_destroy_counter_request_t; /** * @brief xcb_sync_query_counter_cookie_t **/ typedef struct xcb_sync_query_counter_cookie_t { unsigned int sequence; } xcb_sync_query_counter_cookie_t; /** Opcode for xcb_sync_query_counter. */ #define XCB_SYNC_QUERY_COUNTER 5 /** * @brief xcb_sync_query_counter_request_t **/ typedef struct xcb_sync_query_counter_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_sync_counter_t counter; } xcb_sync_query_counter_request_t; /** * @brief xcb_sync_query_counter_reply_t **/ typedef struct xcb_sync_query_counter_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_sync_int64_t counter_value; } xcb_sync_query_counter_reply_t; /** Opcode for xcb_sync_await. */ #define XCB_SYNC_AWAIT 7 /** * @brief xcb_sync_await_request_t **/ typedef struct xcb_sync_await_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_sync_await_request_t; /** Opcode for xcb_sync_change_counter. */ #define XCB_SYNC_CHANGE_COUNTER 4 /** * @brief xcb_sync_change_counter_request_t **/ typedef struct xcb_sync_change_counter_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_sync_counter_t counter; xcb_sync_int64_t amount; } xcb_sync_change_counter_request_t; /** Opcode for xcb_sync_set_counter. */ #define XCB_SYNC_SET_COUNTER 3 /** * @brief xcb_sync_set_counter_request_t **/ typedef struct xcb_sync_set_counter_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_sync_counter_t counter; xcb_sync_int64_t value; } xcb_sync_set_counter_request_t; /** * @brief xcb_sync_create_alarm_value_list_t **/ typedef struct xcb_sync_create_alarm_value_list_t { xcb_sync_counter_t counter; uint32_t valueType; xcb_sync_int64_t value; uint32_t testType; xcb_sync_int64_t delta; uint32_t events; } xcb_sync_create_alarm_value_list_t; /** Opcode for xcb_sync_create_alarm. */ #define XCB_SYNC_CREATE_ALARM 8 /** * @brief xcb_sync_create_alarm_request_t **/ typedef struct xcb_sync_create_alarm_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_sync_alarm_t id; uint32_t value_mask; } xcb_sync_create_alarm_request_t; /** * @brief xcb_sync_change_alarm_value_list_t **/ typedef struct xcb_sync_change_alarm_value_list_t { xcb_sync_counter_t counter; uint32_t valueType; xcb_sync_int64_t value; uint32_t testType; xcb_sync_int64_t delta; uint32_t events; } xcb_sync_change_alarm_value_list_t; /** Opcode for xcb_sync_change_alarm. */ #define XCB_SYNC_CHANGE_ALARM 9 /** * @brief xcb_sync_change_alarm_request_t **/ typedef struct xcb_sync_change_alarm_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_sync_alarm_t id; uint32_t value_mask; } xcb_sync_change_alarm_request_t; /** Opcode for xcb_sync_destroy_alarm. */ #define XCB_SYNC_DESTROY_ALARM 11 /** * @brief xcb_sync_destroy_alarm_request_t **/ typedef struct xcb_sync_destroy_alarm_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_sync_alarm_t alarm; } xcb_sync_destroy_alarm_request_t; /** * @brief xcb_sync_query_alarm_cookie_t **/ typedef struct xcb_sync_query_alarm_cookie_t { unsigned int sequence; } xcb_sync_query_alarm_cookie_t; /** Opcode for xcb_sync_query_alarm. */ #define XCB_SYNC_QUERY_ALARM 10 /** * @brief xcb_sync_query_alarm_request_t **/ typedef struct xcb_sync_query_alarm_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_sync_alarm_t alarm; } xcb_sync_query_alarm_request_t; /** * @brief xcb_sync_query_alarm_reply_t **/ typedef struct xcb_sync_query_alarm_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_sync_trigger_t trigger; xcb_sync_int64_t delta; uint8_t events; uint8_t state; uint8_t pad1[2]; } xcb_sync_query_alarm_reply_t; /** Opcode for xcb_sync_set_priority. */ #define XCB_SYNC_SET_PRIORITY 12 /** * @brief xcb_sync_set_priority_request_t **/ typedef struct xcb_sync_set_priority_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t id; int32_t priority; } xcb_sync_set_priority_request_t; /** * @brief xcb_sync_get_priority_cookie_t **/ typedef struct xcb_sync_get_priority_cookie_t { unsigned int sequence; } xcb_sync_get_priority_cookie_t; /** Opcode for xcb_sync_get_priority. */ #define XCB_SYNC_GET_PRIORITY 13 /** * @brief xcb_sync_get_priority_request_t **/ typedef struct xcb_sync_get_priority_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t id; } xcb_sync_get_priority_request_t; /** * @brief xcb_sync_get_priority_reply_t **/ typedef struct xcb_sync_get_priority_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; int32_t priority; } xcb_sync_get_priority_reply_t; /** Opcode for xcb_sync_create_fence. */ #define XCB_SYNC_CREATE_FENCE 14 /** * @brief xcb_sync_create_fence_request_t **/ typedef struct xcb_sync_create_fence_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; xcb_sync_fence_t fence; uint8_t initially_triggered; } xcb_sync_create_fence_request_t; /** Opcode for xcb_sync_trigger_fence. */ #define XCB_SYNC_TRIGGER_FENCE 15 /** * @brief xcb_sync_trigger_fence_request_t **/ typedef struct xcb_sync_trigger_fence_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_sync_fence_t fence; } xcb_sync_trigger_fence_request_t; /** Opcode for xcb_sync_reset_fence. */ #define XCB_SYNC_RESET_FENCE 16 /** * @brief xcb_sync_reset_fence_request_t **/ typedef struct xcb_sync_reset_fence_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_sync_fence_t fence; } xcb_sync_reset_fence_request_t; /** Opcode for xcb_sync_destroy_fence. */ #define XCB_SYNC_DESTROY_FENCE 17 /** * @brief xcb_sync_destroy_fence_request_t **/ typedef struct xcb_sync_destroy_fence_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_sync_fence_t fence; } xcb_sync_destroy_fence_request_t; /** * @brief xcb_sync_query_fence_cookie_t **/ typedef struct xcb_sync_query_fence_cookie_t { unsigned int sequence; } xcb_sync_query_fence_cookie_t; /** Opcode for xcb_sync_query_fence. */ #define XCB_SYNC_QUERY_FENCE 18 /** * @brief xcb_sync_query_fence_request_t **/ typedef struct xcb_sync_query_fence_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_sync_fence_t fence; } xcb_sync_query_fence_request_t; /** * @brief xcb_sync_query_fence_reply_t **/ typedef struct xcb_sync_query_fence_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t triggered; uint8_t pad1[23]; } xcb_sync_query_fence_reply_t; /** Opcode for xcb_sync_await_fence. */ #define XCB_SYNC_AWAIT_FENCE 19 /** * @brief xcb_sync_await_fence_request_t **/ typedef struct xcb_sync_await_fence_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_sync_await_fence_request_t; /** Opcode for xcb_sync_counter_notify. */ #define XCB_SYNC_COUNTER_NOTIFY 0 /** * @brief xcb_sync_counter_notify_event_t **/ typedef struct xcb_sync_counter_notify_event_t { uint8_t response_type; uint8_t kind; uint16_t sequence; xcb_sync_counter_t counter; xcb_sync_int64_t wait_value; xcb_sync_int64_t counter_value; xcb_timestamp_t timestamp; uint16_t count; uint8_t destroyed; uint8_t pad0; } xcb_sync_counter_notify_event_t; /** Opcode for xcb_sync_alarm_notify. */ #define XCB_SYNC_ALARM_NOTIFY 1 /** * @brief xcb_sync_alarm_notify_event_t **/ typedef struct xcb_sync_alarm_notify_event_t { uint8_t response_type; uint8_t kind; uint16_t sequence; xcb_sync_alarm_t alarm; xcb_sync_int64_t counter_value; xcb_sync_int64_t alarm_value; xcb_timestamp_t timestamp; uint8_t state; uint8_t pad0[3]; } xcb_sync_alarm_notify_event_t; /** * Get the next element of the iterator * @param i Pointer to a xcb_sync_alarm_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_sync_alarm_t) */ void xcb_sync_alarm_next (xcb_sync_alarm_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_sync_alarm_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_sync_alarm_end (xcb_sync_alarm_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_sync_counter_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_sync_counter_t) */ void xcb_sync_counter_next (xcb_sync_counter_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_sync_counter_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_sync_counter_end (xcb_sync_counter_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_sync_fence_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_sync_fence_t) */ void xcb_sync_fence_next (xcb_sync_fence_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_sync_fence_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_sync_fence_end (xcb_sync_fence_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_sync_int64_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_sync_int64_t) */ void xcb_sync_int64_next (xcb_sync_int64_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_sync_int64_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_sync_int64_end (xcb_sync_int64_iterator_t i); int xcb_sync_systemcounter_sizeof (const void *_buffer); char * xcb_sync_systemcounter_name (const xcb_sync_systemcounter_t *R); int xcb_sync_systemcounter_name_length (const xcb_sync_systemcounter_t *R); xcb_generic_iterator_t xcb_sync_systemcounter_name_end (const xcb_sync_systemcounter_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_sync_systemcounter_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_sync_systemcounter_t) */ void xcb_sync_systemcounter_next (xcb_sync_systemcounter_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_sync_systemcounter_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_sync_systemcounter_end (xcb_sync_systemcounter_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_sync_trigger_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_sync_trigger_t) */ void xcb_sync_trigger_next (xcb_sync_trigger_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_sync_trigger_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_sync_trigger_end (xcb_sync_trigger_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_sync_waitcondition_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_sync_waitcondition_t) */ void xcb_sync_waitcondition_next (xcb_sync_waitcondition_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_sync_waitcondition_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_sync_waitcondition_end (xcb_sync_waitcondition_iterator_t i); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_sync_initialize_cookie_t xcb_sync_initialize (xcb_connection_t *c, uint8_t desired_major_version, uint8_t desired_minor_version); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_sync_initialize_cookie_t xcb_sync_initialize_unchecked (xcb_connection_t *c, uint8_t desired_major_version, uint8_t desired_minor_version); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_sync_initialize_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_sync_initialize_reply_t * xcb_sync_initialize_reply (xcb_connection_t *c, xcb_sync_initialize_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_sync_list_system_counters_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_sync_list_system_counters_cookie_t xcb_sync_list_system_counters (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_sync_list_system_counters_cookie_t xcb_sync_list_system_counters_unchecked (xcb_connection_t *c); int xcb_sync_list_system_counters_counters_length (const xcb_sync_list_system_counters_reply_t *R); xcb_sync_systemcounter_iterator_t xcb_sync_list_system_counters_counters_iterator (const xcb_sync_list_system_counters_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_sync_list_system_counters_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_sync_list_system_counters_reply_t * xcb_sync_list_system_counters_reply (xcb_connection_t *c, xcb_sync_list_system_counters_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_sync_create_counter_checked (xcb_connection_t *c, xcb_sync_counter_t id, xcb_sync_int64_t initial_value); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_sync_create_counter (xcb_connection_t *c, xcb_sync_counter_t id, xcb_sync_int64_t initial_value); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_sync_destroy_counter_checked (xcb_connection_t *c, xcb_sync_counter_t counter); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_sync_destroy_counter (xcb_connection_t *c, xcb_sync_counter_t counter); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_sync_query_counter_cookie_t xcb_sync_query_counter (xcb_connection_t *c, xcb_sync_counter_t counter); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_sync_query_counter_cookie_t xcb_sync_query_counter_unchecked (xcb_connection_t *c, xcb_sync_counter_t counter); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_sync_query_counter_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_sync_query_counter_reply_t * xcb_sync_query_counter_reply (xcb_connection_t *c, xcb_sync_query_counter_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_sync_await_sizeof (const void *_buffer, uint32_t wait_list_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_sync_await_checked (xcb_connection_t *c, uint32_t wait_list_len, const xcb_sync_waitcondition_t *wait_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_sync_await (xcb_connection_t *c, uint32_t wait_list_len, const xcb_sync_waitcondition_t *wait_list); xcb_sync_waitcondition_t * xcb_sync_await_wait_list (const xcb_sync_await_request_t *R); int xcb_sync_await_wait_list_length (const xcb_sync_await_request_t *R); xcb_sync_waitcondition_iterator_t xcb_sync_await_wait_list_iterator (const xcb_sync_await_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_sync_change_counter_checked (xcb_connection_t *c, xcb_sync_counter_t counter, xcb_sync_int64_t amount); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_sync_change_counter (xcb_connection_t *c, xcb_sync_counter_t counter, xcb_sync_int64_t amount); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_sync_set_counter_checked (xcb_connection_t *c, xcb_sync_counter_t counter, xcb_sync_int64_t value); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_sync_set_counter (xcb_connection_t *c, xcb_sync_counter_t counter, xcb_sync_int64_t value); int xcb_sync_create_alarm_value_list_serialize (void **_buffer, uint32_t value_mask, const xcb_sync_create_alarm_value_list_t *_aux); int xcb_sync_create_alarm_value_list_unpack (const void *_buffer, uint32_t value_mask, xcb_sync_create_alarm_value_list_t *_aux); int xcb_sync_create_alarm_value_list_sizeof (const void *_buffer, uint32_t value_mask); int xcb_sync_create_alarm_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_sync_create_alarm_checked (xcb_connection_t *c, xcb_sync_alarm_t id, uint32_t value_mask, const void *value_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_sync_create_alarm (xcb_connection_t *c, xcb_sync_alarm_t id, uint32_t value_mask, const void *value_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_sync_create_alarm_aux_checked (xcb_connection_t *c, xcb_sync_alarm_t id, uint32_t value_mask, const xcb_sync_create_alarm_value_list_t *value_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_sync_create_alarm_aux (xcb_connection_t *c, xcb_sync_alarm_t id, uint32_t value_mask, const xcb_sync_create_alarm_value_list_t *value_list); void * xcb_sync_create_alarm_value_list (const xcb_sync_create_alarm_request_t *R); int xcb_sync_change_alarm_value_list_serialize (void **_buffer, uint32_t value_mask, const xcb_sync_change_alarm_value_list_t *_aux); int xcb_sync_change_alarm_value_list_unpack (const void *_buffer, uint32_t value_mask, xcb_sync_change_alarm_value_list_t *_aux); int xcb_sync_change_alarm_value_list_sizeof (const void *_buffer, uint32_t value_mask); int xcb_sync_change_alarm_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_sync_change_alarm_checked (xcb_connection_t *c, xcb_sync_alarm_t id, uint32_t value_mask, const void *value_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_sync_change_alarm (xcb_connection_t *c, xcb_sync_alarm_t id, uint32_t value_mask, const void *value_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_sync_change_alarm_aux_checked (xcb_connection_t *c, xcb_sync_alarm_t id, uint32_t value_mask, const xcb_sync_change_alarm_value_list_t *value_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_sync_change_alarm_aux (xcb_connection_t *c, xcb_sync_alarm_t id, uint32_t value_mask, const xcb_sync_change_alarm_value_list_t *value_list); void * xcb_sync_change_alarm_value_list (const xcb_sync_change_alarm_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_sync_destroy_alarm_checked (xcb_connection_t *c, xcb_sync_alarm_t alarm); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_sync_destroy_alarm (xcb_connection_t *c, xcb_sync_alarm_t alarm); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_sync_query_alarm_cookie_t xcb_sync_query_alarm (xcb_connection_t *c, xcb_sync_alarm_t alarm); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_sync_query_alarm_cookie_t xcb_sync_query_alarm_unchecked (xcb_connection_t *c, xcb_sync_alarm_t alarm); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_sync_query_alarm_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_sync_query_alarm_reply_t * xcb_sync_query_alarm_reply (xcb_connection_t *c, xcb_sync_query_alarm_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_sync_set_priority_checked (xcb_connection_t *c, uint32_t id, int32_t priority); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_sync_set_priority (xcb_connection_t *c, uint32_t id, int32_t priority); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_sync_get_priority_cookie_t xcb_sync_get_priority (xcb_connection_t *c, uint32_t id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_sync_get_priority_cookie_t xcb_sync_get_priority_unchecked (xcb_connection_t *c, uint32_t id); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_sync_get_priority_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_sync_get_priority_reply_t * xcb_sync_get_priority_reply (xcb_connection_t *c, xcb_sync_get_priority_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_sync_create_fence_checked (xcb_connection_t *c, xcb_drawable_t drawable, xcb_sync_fence_t fence, uint8_t initially_triggered); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_sync_create_fence (xcb_connection_t *c, xcb_drawable_t drawable, xcb_sync_fence_t fence, uint8_t initially_triggered); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_sync_trigger_fence_checked (xcb_connection_t *c, xcb_sync_fence_t fence); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_sync_trigger_fence (xcb_connection_t *c, xcb_sync_fence_t fence); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_sync_reset_fence_checked (xcb_connection_t *c, xcb_sync_fence_t fence); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_sync_reset_fence (xcb_connection_t *c, xcb_sync_fence_t fence); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_sync_destroy_fence_checked (xcb_connection_t *c, xcb_sync_fence_t fence); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_sync_destroy_fence (xcb_connection_t *c, xcb_sync_fence_t fence); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_sync_query_fence_cookie_t xcb_sync_query_fence (xcb_connection_t *c, xcb_sync_fence_t fence); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_sync_query_fence_cookie_t xcb_sync_query_fence_unchecked (xcb_connection_t *c, xcb_sync_fence_t fence); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_sync_query_fence_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_sync_query_fence_reply_t * xcb_sync_query_fence_reply (xcb_connection_t *c, xcb_sync_query_fence_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_sync_await_fence_sizeof (const void *_buffer, uint32_t fence_list_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_sync_await_fence_checked (xcb_connection_t *c, uint32_t fence_list_len, const xcb_sync_fence_t *fence_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_sync_await_fence (xcb_connection_t *c, uint32_t fence_list_len, const xcb_sync_fence_t *fence_list); xcb_sync_fence_t * xcb_sync_await_fence_fence_list (const xcb_sync_await_fence_request_t *R); int xcb_sync_await_fence_fence_list_length (const xcb_sync_await_fence_request_t *R); xcb_generic_iterator_t xcb_sync_await_fence_fence_list_end (const xcb_sync_await_fence_request_t *R); #ifdef __cplusplus } #endif #endif /** * @} */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/dri2.h������������������������������������������������������������������������������������������0000644�����������������00000105657�14763166026�0006362 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from dri2.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_DRI2_API XCB DRI2 API * @brief DRI2 XCB Protocol Implementation. * @{ **/ #ifndef __DRI2_H #define __DRI2_H #include "xcb.h" #include "xproto.h" #ifdef __cplusplus extern "C" { #endif #define XCB_DRI2_MAJOR_VERSION 1 #define XCB_DRI2_MINOR_VERSION 4 extern xcb_extension_t xcb_dri2_id; typedef enum xcb_dri2_attachment_t { XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT = 0, XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT = 1, XCB_DRI2_ATTACHMENT_BUFFER_FRONT_RIGHT = 2, XCB_DRI2_ATTACHMENT_BUFFER_BACK_RIGHT = 3, XCB_DRI2_ATTACHMENT_BUFFER_DEPTH = 4, XCB_DRI2_ATTACHMENT_BUFFER_STENCIL = 5, XCB_DRI2_ATTACHMENT_BUFFER_ACCUM = 6, XCB_DRI2_ATTACHMENT_BUFFER_FAKE_FRONT_LEFT = 7, XCB_DRI2_ATTACHMENT_BUFFER_FAKE_FRONT_RIGHT = 8, XCB_DRI2_ATTACHMENT_BUFFER_DEPTH_STENCIL = 9, XCB_DRI2_ATTACHMENT_BUFFER_HIZ = 10 } xcb_dri2_attachment_t; typedef enum xcb_dri2_driver_type_t { XCB_DRI2_DRIVER_TYPE_DRI = 0, XCB_DRI2_DRIVER_TYPE_VDPAU = 1 } xcb_dri2_driver_type_t; typedef enum xcb_dri2_event_type_t { XCB_DRI2_EVENT_TYPE_EXCHANGE_COMPLETE = 1, XCB_DRI2_EVENT_TYPE_BLIT_COMPLETE = 2, XCB_DRI2_EVENT_TYPE_FLIP_COMPLETE = 3 } xcb_dri2_event_type_t; /** * @brief xcb_dri2_dri2_buffer_t **/ typedef struct xcb_dri2_dri2_buffer_t { uint32_t attachment; uint32_t name; uint32_t pitch; uint32_t cpp; uint32_t flags; } xcb_dri2_dri2_buffer_t; /** * @brief xcb_dri2_dri2_buffer_iterator_t **/ typedef struct xcb_dri2_dri2_buffer_iterator_t { xcb_dri2_dri2_buffer_t *data; int rem; int index; } xcb_dri2_dri2_buffer_iterator_t; /** * @brief xcb_dri2_attach_format_t **/ typedef struct xcb_dri2_attach_format_t { uint32_t attachment; uint32_t format; } xcb_dri2_attach_format_t; /** * @brief xcb_dri2_attach_format_iterator_t **/ typedef struct xcb_dri2_attach_format_iterator_t { xcb_dri2_attach_format_t *data; int rem; int index; } xcb_dri2_attach_format_iterator_t; /** * @brief xcb_dri2_query_version_cookie_t **/ typedef struct xcb_dri2_query_version_cookie_t { unsigned int sequence; } xcb_dri2_query_version_cookie_t; /** Opcode for xcb_dri2_query_version. */ #define XCB_DRI2_QUERY_VERSION 0 /** * @brief xcb_dri2_query_version_request_t **/ typedef struct xcb_dri2_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t major_version; uint32_t minor_version; } xcb_dri2_query_version_request_t; /** * @brief xcb_dri2_query_version_reply_t **/ typedef struct xcb_dri2_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t major_version; uint32_t minor_version; } xcb_dri2_query_version_reply_t; /** * @brief xcb_dri2_connect_cookie_t **/ typedef struct xcb_dri2_connect_cookie_t { unsigned int sequence; } xcb_dri2_connect_cookie_t; /** Opcode for xcb_dri2_connect. */ #define XCB_DRI2_CONNECT 1 /** * @brief xcb_dri2_connect_request_t **/ typedef struct xcb_dri2_connect_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; uint32_t driver_type; } xcb_dri2_connect_request_t; /** * @brief xcb_dri2_connect_reply_t **/ typedef struct xcb_dri2_connect_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t driver_name_length; uint32_t device_name_length; uint8_t pad1[16]; } xcb_dri2_connect_reply_t; /** * @brief xcb_dri2_authenticate_cookie_t **/ typedef struct xcb_dri2_authenticate_cookie_t { unsigned int sequence; } xcb_dri2_authenticate_cookie_t; /** Opcode for xcb_dri2_authenticate. */ #define XCB_DRI2_AUTHENTICATE 2 /** * @brief xcb_dri2_authenticate_request_t **/ typedef struct xcb_dri2_authenticate_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; uint32_t magic; } xcb_dri2_authenticate_request_t; /** * @brief xcb_dri2_authenticate_reply_t **/ typedef struct xcb_dri2_authenticate_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t authenticated; } xcb_dri2_authenticate_reply_t; /** Opcode for xcb_dri2_create_drawable. */ #define XCB_DRI2_CREATE_DRAWABLE 3 /** * @brief xcb_dri2_create_drawable_request_t **/ typedef struct xcb_dri2_create_drawable_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; } xcb_dri2_create_drawable_request_t; /** Opcode for xcb_dri2_destroy_drawable. */ #define XCB_DRI2_DESTROY_DRAWABLE 4 /** * @brief xcb_dri2_destroy_drawable_request_t **/ typedef struct xcb_dri2_destroy_drawable_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; } xcb_dri2_destroy_drawable_request_t; /** * @brief xcb_dri2_get_buffers_cookie_t **/ typedef struct xcb_dri2_get_buffers_cookie_t { unsigned int sequence; } xcb_dri2_get_buffers_cookie_t; /** Opcode for xcb_dri2_get_buffers. */ #define XCB_DRI2_GET_BUFFERS 5 /** * @brief xcb_dri2_get_buffers_request_t **/ typedef struct xcb_dri2_get_buffers_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; uint32_t count; } xcb_dri2_get_buffers_request_t; /** * @brief xcb_dri2_get_buffers_reply_t **/ typedef struct xcb_dri2_get_buffers_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t width; uint32_t height; uint32_t count; uint8_t pad1[12]; } xcb_dri2_get_buffers_reply_t; /** * @brief xcb_dri2_copy_region_cookie_t **/ typedef struct xcb_dri2_copy_region_cookie_t { unsigned int sequence; } xcb_dri2_copy_region_cookie_t; /** Opcode for xcb_dri2_copy_region. */ #define XCB_DRI2_COPY_REGION 6 /** * @brief xcb_dri2_copy_region_request_t **/ typedef struct xcb_dri2_copy_region_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; uint32_t region; uint32_t dest; uint32_t src; } xcb_dri2_copy_region_request_t; /** * @brief xcb_dri2_copy_region_reply_t **/ typedef struct xcb_dri2_copy_region_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; } xcb_dri2_copy_region_reply_t; /** * @brief xcb_dri2_get_buffers_with_format_cookie_t **/ typedef struct xcb_dri2_get_buffers_with_format_cookie_t { unsigned int sequence; } xcb_dri2_get_buffers_with_format_cookie_t; /** Opcode for xcb_dri2_get_buffers_with_format. */ #define XCB_DRI2_GET_BUFFERS_WITH_FORMAT 7 /** * @brief xcb_dri2_get_buffers_with_format_request_t **/ typedef struct xcb_dri2_get_buffers_with_format_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; uint32_t count; } xcb_dri2_get_buffers_with_format_request_t; /** * @brief xcb_dri2_get_buffers_with_format_reply_t **/ typedef struct xcb_dri2_get_buffers_with_format_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t width; uint32_t height; uint32_t count; uint8_t pad1[12]; } xcb_dri2_get_buffers_with_format_reply_t; /** * @brief xcb_dri2_swap_buffers_cookie_t **/ typedef struct xcb_dri2_swap_buffers_cookie_t { unsigned int sequence; } xcb_dri2_swap_buffers_cookie_t; /** Opcode for xcb_dri2_swap_buffers. */ #define XCB_DRI2_SWAP_BUFFERS 8 /** * @brief xcb_dri2_swap_buffers_request_t **/ typedef struct xcb_dri2_swap_buffers_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; uint32_t target_msc_hi; uint32_t target_msc_lo; uint32_t divisor_hi; uint32_t divisor_lo; uint32_t remainder_hi; uint32_t remainder_lo; } xcb_dri2_swap_buffers_request_t; /** * @brief xcb_dri2_swap_buffers_reply_t **/ typedef struct xcb_dri2_swap_buffers_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t swap_hi; uint32_t swap_lo; } xcb_dri2_swap_buffers_reply_t; /** * @brief xcb_dri2_get_msc_cookie_t **/ typedef struct xcb_dri2_get_msc_cookie_t { unsigned int sequence; } xcb_dri2_get_msc_cookie_t; /** Opcode for xcb_dri2_get_msc. */ #define XCB_DRI2_GET_MSC 9 /** * @brief xcb_dri2_get_msc_request_t **/ typedef struct xcb_dri2_get_msc_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; } xcb_dri2_get_msc_request_t; /** * @brief xcb_dri2_get_msc_reply_t **/ typedef struct xcb_dri2_get_msc_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t ust_hi; uint32_t ust_lo; uint32_t msc_hi; uint32_t msc_lo; uint32_t sbc_hi; uint32_t sbc_lo; } xcb_dri2_get_msc_reply_t; /** * @brief xcb_dri2_wait_msc_cookie_t **/ typedef struct xcb_dri2_wait_msc_cookie_t { unsigned int sequence; } xcb_dri2_wait_msc_cookie_t; /** Opcode for xcb_dri2_wait_msc. */ #define XCB_DRI2_WAIT_MSC 10 /** * @brief xcb_dri2_wait_msc_request_t **/ typedef struct xcb_dri2_wait_msc_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; uint32_t target_msc_hi; uint32_t target_msc_lo; uint32_t divisor_hi; uint32_t divisor_lo; uint32_t remainder_hi; uint32_t remainder_lo; } xcb_dri2_wait_msc_request_t; /** * @brief xcb_dri2_wait_msc_reply_t **/ typedef struct xcb_dri2_wait_msc_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t ust_hi; uint32_t ust_lo; uint32_t msc_hi; uint32_t msc_lo; uint32_t sbc_hi; uint32_t sbc_lo; } xcb_dri2_wait_msc_reply_t; /** * @brief xcb_dri2_wait_sbc_cookie_t **/ typedef struct xcb_dri2_wait_sbc_cookie_t { unsigned int sequence; } xcb_dri2_wait_sbc_cookie_t; /** Opcode for xcb_dri2_wait_sbc. */ #define XCB_DRI2_WAIT_SBC 11 /** * @brief xcb_dri2_wait_sbc_request_t **/ typedef struct xcb_dri2_wait_sbc_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; uint32_t target_sbc_hi; uint32_t target_sbc_lo; } xcb_dri2_wait_sbc_request_t; /** * @brief xcb_dri2_wait_sbc_reply_t **/ typedef struct xcb_dri2_wait_sbc_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t ust_hi; uint32_t ust_lo; uint32_t msc_hi; uint32_t msc_lo; uint32_t sbc_hi; uint32_t sbc_lo; } xcb_dri2_wait_sbc_reply_t; /** Opcode for xcb_dri2_swap_interval. */ #define XCB_DRI2_SWAP_INTERVAL 12 /** * @brief xcb_dri2_swap_interval_request_t **/ typedef struct xcb_dri2_swap_interval_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; uint32_t interval; } xcb_dri2_swap_interval_request_t; /** * @brief xcb_dri2_get_param_cookie_t **/ typedef struct xcb_dri2_get_param_cookie_t { unsigned int sequence; } xcb_dri2_get_param_cookie_t; /** Opcode for xcb_dri2_get_param. */ #define XCB_DRI2_GET_PARAM 13 /** * @brief xcb_dri2_get_param_request_t **/ typedef struct xcb_dri2_get_param_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; uint32_t param; } xcb_dri2_get_param_request_t; /** * @brief xcb_dri2_get_param_reply_t **/ typedef struct xcb_dri2_get_param_reply_t { uint8_t response_type; uint8_t is_param_recognized; uint16_t sequence; uint32_t length; uint32_t value_hi; uint32_t value_lo; } xcb_dri2_get_param_reply_t; /** Opcode for xcb_dri2_buffer_swap_complete. */ #define XCB_DRI2_BUFFER_SWAP_COMPLETE 0 /** * @brief xcb_dri2_buffer_swap_complete_event_t **/ typedef struct xcb_dri2_buffer_swap_complete_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint16_t event_type; uint8_t pad1[2]; xcb_drawable_t drawable; uint32_t ust_hi; uint32_t ust_lo; uint32_t msc_hi; uint32_t msc_lo; uint32_t sbc; } xcb_dri2_buffer_swap_complete_event_t; /** Opcode for xcb_dri2_invalidate_buffers. */ #define XCB_DRI2_INVALIDATE_BUFFERS 1 /** * @brief xcb_dri2_invalidate_buffers_event_t **/ typedef struct xcb_dri2_invalidate_buffers_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_drawable_t drawable; } xcb_dri2_invalidate_buffers_event_t; /** * Get the next element of the iterator * @param i Pointer to a xcb_dri2_dri2_buffer_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_dri2_dri2_buffer_t) */ void xcb_dri2_dri2_buffer_next (xcb_dri2_dri2_buffer_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_dri2_dri2_buffer_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_dri2_dri2_buffer_end (xcb_dri2_dri2_buffer_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_dri2_attach_format_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_dri2_attach_format_t) */ void xcb_dri2_attach_format_next (xcb_dri2_attach_format_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_dri2_attach_format_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_dri2_attach_format_end (xcb_dri2_attach_format_iterator_t i); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dri2_query_version_cookie_t xcb_dri2_query_version (xcb_connection_t *c, uint32_t major_version, uint32_t minor_version); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dri2_query_version_cookie_t xcb_dri2_query_version_unchecked (xcb_connection_t *c, uint32_t major_version, uint32_t minor_version); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dri2_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dri2_query_version_reply_t * xcb_dri2_query_version_reply (xcb_connection_t *c, xcb_dri2_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_dri2_connect_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dri2_connect_cookie_t xcb_dri2_connect (xcb_connection_t *c, xcb_window_t window, uint32_t driver_type); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dri2_connect_cookie_t xcb_dri2_connect_unchecked (xcb_connection_t *c, xcb_window_t window, uint32_t driver_type); char * xcb_dri2_connect_driver_name (const xcb_dri2_connect_reply_t *R); int xcb_dri2_connect_driver_name_length (const xcb_dri2_connect_reply_t *R); xcb_generic_iterator_t xcb_dri2_connect_driver_name_end (const xcb_dri2_connect_reply_t *R); void * xcb_dri2_connect_alignment_pad (const xcb_dri2_connect_reply_t *R); int xcb_dri2_connect_alignment_pad_length (const xcb_dri2_connect_reply_t *R); xcb_generic_iterator_t xcb_dri2_connect_alignment_pad_end (const xcb_dri2_connect_reply_t *R); char * xcb_dri2_connect_device_name (const xcb_dri2_connect_reply_t *R); int xcb_dri2_connect_device_name_length (const xcb_dri2_connect_reply_t *R); xcb_generic_iterator_t xcb_dri2_connect_device_name_end (const xcb_dri2_connect_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dri2_connect_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dri2_connect_reply_t * xcb_dri2_connect_reply (xcb_connection_t *c, xcb_dri2_connect_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dri2_authenticate_cookie_t xcb_dri2_authenticate (xcb_connection_t *c, xcb_window_t window, uint32_t magic); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dri2_authenticate_cookie_t xcb_dri2_authenticate_unchecked (xcb_connection_t *c, xcb_window_t window, uint32_t magic); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dri2_authenticate_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dri2_authenticate_reply_t * xcb_dri2_authenticate_reply (xcb_connection_t *c, xcb_dri2_authenticate_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_dri2_create_drawable_checked (xcb_connection_t *c, xcb_drawable_t drawable); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_dri2_create_drawable (xcb_connection_t *c, xcb_drawable_t drawable); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_dri2_destroy_drawable_checked (xcb_connection_t *c, xcb_drawable_t drawable); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_dri2_destroy_drawable (xcb_connection_t *c, xcb_drawable_t drawable); int xcb_dri2_get_buffers_sizeof (const void *_buffer, uint32_t attachments_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dri2_get_buffers_cookie_t xcb_dri2_get_buffers (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t count, uint32_t attachments_len, const uint32_t *attachments); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dri2_get_buffers_cookie_t xcb_dri2_get_buffers_unchecked (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t count, uint32_t attachments_len, const uint32_t *attachments); xcb_dri2_dri2_buffer_t * xcb_dri2_get_buffers_buffers (const xcb_dri2_get_buffers_reply_t *R); int xcb_dri2_get_buffers_buffers_length (const xcb_dri2_get_buffers_reply_t *R); xcb_dri2_dri2_buffer_iterator_t xcb_dri2_get_buffers_buffers_iterator (const xcb_dri2_get_buffers_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dri2_get_buffers_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dri2_get_buffers_reply_t * xcb_dri2_get_buffers_reply (xcb_connection_t *c, xcb_dri2_get_buffers_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dri2_copy_region_cookie_t xcb_dri2_copy_region (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t region, uint32_t dest, uint32_t src); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dri2_copy_region_cookie_t xcb_dri2_copy_region_unchecked (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t region, uint32_t dest, uint32_t src); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dri2_copy_region_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dri2_copy_region_reply_t * xcb_dri2_copy_region_reply (xcb_connection_t *c, xcb_dri2_copy_region_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_dri2_get_buffers_with_format_sizeof (const void *_buffer, uint32_t attachments_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dri2_get_buffers_with_format_cookie_t xcb_dri2_get_buffers_with_format (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t count, uint32_t attachments_len, const xcb_dri2_attach_format_t *attachments); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dri2_get_buffers_with_format_cookie_t xcb_dri2_get_buffers_with_format_unchecked (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t count, uint32_t attachments_len, const xcb_dri2_attach_format_t *attachments); xcb_dri2_dri2_buffer_t * xcb_dri2_get_buffers_with_format_buffers (const xcb_dri2_get_buffers_with_format_reply_t *R); int xcb_dri2_get_buffers_with_format_buffers_length (const xcb_dri2_get_buffers_with_format_reply_t *R); xcb_dri2_dri2_buffer_iterator_t xcb_dri2_get_buffers_with_format_buffers_iterator (const xcb_dri2_get_buffers_with_format_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dri2_get_buffers_with_format_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dri2_get_buffers_with_format_reply_t * xcb_dri2_get_buffers_with_format_reply (xcb_connection_t *c, xcb_dri2_get_buffers_with_format_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dri2_swap_buffers_cookie_t xcb_dri2_swap_buffers (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t target_msc_hi, uint32_t target_msc_lo, uint32_t divisor_hi, uint32_t divisor_lo, uint32_t remainder_hi, uint32_t remainder_lo); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dri2_swap_buffers_cookie_t xcb_dri2_swap_buffers_unchecked (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t target_msc_hi, uint32_t target_msc_lo, uint32_t divisor_hi, uint32_t divisor_lo, uint32_t remainder_hi, uint32_t remainder_lo); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dri2_swap_buffers_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dri2_swap_buffers_reply_t * xcb_dri2_swap_buffers_reply (xcb_connection_t *c, xcb_dri2_swap_buffers_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dri2_get_msc_cookie_t xcb_dri2_get_msc (xcb_connection_t *c, xcb_drawable_t drawable); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dri2_get_msc_cookie_t xcb_dri2_get_msc_unchecked (xcb_connection_t *c, xcb_drawable_t drawable); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dri2_get_msc_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dri2_get_msc_reply_t * xcb_dri2_get_msc_reply (xcb_connection_t *c, xcb_dri2_get_msc_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dri2_wait_msc_cookie_t xcb_dri2_wait_msc (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t target_msc_hi, uint32_t target_msc_lo, uint32_t divisor_hi, uint32_t divisor_lo, uint32_t remainder_hi, uint32_t remainder_lo); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dri2_wait_msc_cookie_t xcb_dri2_wait_msc_unchecked (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t target_msc_hi, uint32_t target_msc_lo, uint32_t divisor_hi, uint32_t divisor_lo, uint32_t remainder_hi, uint32_t remainder_lo); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dri2_wait_msc_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dri2_wait_msc_reply_t * xcb_dri2_wait_msc_reply (xcb_connection_t *c, xcb_dri2_wait_msc_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dri2_wait_sbc_cookie_t xcb_dri2_wait_sbc (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t target_sbc_hi, uint32_t target_sbc_lo); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dri2_wait_sbc_cookie_t xcb_dri2_wait_sbc_unchecked (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t target_sbc_hi, uint32_t target_sbc_lo); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dri2_wait_sbc_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dri2_wait_sbc_reply_t * xcb_dri2_wait_sbc_reply (xcb_connection_t *c, xcb_dri2_wait_sbc_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_dri2_swap_interval_checked (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t interval); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_dri2_swap_interval (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t interval); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dri2_get_param_cookie_t xcb_dri2_get_param (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t param); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dri2_get_param_cookie_t xcb_dri2_get_param_unchecked (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t param); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dri2_get_param_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dri2_get_param_reply_t * xcb_dri2_get_param_reply (xcb_connection_t *c, xcb_dri2_get_param_cookie_t cookie /**< */, xcb_generic_error_t **e); #ifdef __cplusplus } #endif #endif /** * @} */ ���������������������������������������������������������������������������������xcb/record.h����������������������������������������������������������������������������������������0000644�����������������00000066410�14763166026�0006771 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from record.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_Record_API XCB Record API * @brief Record XCB Protocol Implementation. * @{ **/ #ifndef __RECORD_H #define __RECORD_H #include "xcb.h" #ifdef __cplusplus extern "C" { #endif #define XCB_RECORD_MAJOR_VERSION 1 #define XCB_RECORD_MINOR_VERSION 13 extern xcb_extension_t xcb_record_id; typedef uint32_t xcb_record_context_t; /** * @brief xcb_record_context_iterator_t **/ typedef struct xcb_record_context_iterator_t { xcb_record_context_t *data; int rem; int index; } xcb_record_context_iterator_t; /** * @brief xcb_record_range_8_t **/ typedef struct xcb_record_range_8_t { uint8_t first; uint8_t last; } xcb_record_range_8_t; /** * @brief xcb_record_range_8_iterator_t **/ typedef struct xcb_record_range_8_iterator_t { xcb_record_range_8_t *data; int rem; int index; } xcb_record_range_8_iterator_t; /** * @brief xcb_record_range_16_t **/ typedef struct xcb_record_range_16_t { uint16_t first; uint16_t last; } xcb_record_range_16_t; /** * @brief xcb_record_range_16_iterator_t **/ typedef struct xcb_record_range_16_iterator_t { xcb_record_range_16_t *data; int rem; int index; } xcb_record_range_16_iterator_t; /** * @brief xcb_record_ext_range_t **/ typedef struct xcb_record_ext_range_t { xcb_record_range_8_t major; xcb_record_range_16_t minor; } xcb_record_ext_range_t; /** * @brief xcb_record_ext_range_iterator_t **/ typedef struct xcb_record_ext_range_iterator_t { xcb_record_ext_range_t *data; int rem; int index; } xcb_record_ext_range_iterator_t; /** * @brief xcb_record_range_t **/ typedef struct xcb_record_range_t { xcb_record_range_8_t core_requests; xcb_record_range_8_t core_replies; xcb_record_ext_range_t ext_requests; xcb_record_ext_range_t ext_replies; xcb_record_range_8_t delivered_events; xcb_record_range_8_t device_events; xcb_record_range_8_t errors; uint8_t client_started; uint8_t client_died; } xcb_record_range_t; /** * @brief xcb_record_range_iterator_t **/ typedef struct xcb_record_range_iterator_t { xcb_record_range_t *data; int rem; int index; } xcb_record_range_iterator_t; typedef uint8_t xcb_record_element_header_t; /** * @brief xcb_record_element_header_iterator_t **/ typedef struct xcb_record_element_header_iterator_t { xcb_record_element_header_t *data; int rem; int index; } xcb_record_element_header_iterator_t; typedef enum xcb_record_h_type_t { XCB_RECORD_H_TYPE_FROM_SERVER_TIME = 1, XCB_RECORD_H_TYPE_FROM_CLIENT_TIME = 2, XCB_RECORD_H_TYPE_FROM_CLIENT_SEQUENCE = 4 } xcb_record_h_type_t; typedef uint32_t xcb_record_client_spec_t; /** * @brief xcb_record_client_spec_iterator_t **/ typedef struct xcb_record_client_spec_iterator_t { xcb_record_client_spec_t *data; int rem; int index; } xcb_record_client_spec_iterator_t; typedef enum xcb_record_cs_t { XCB_RECORD_CS_CURRENT_CLIENTS = 1, XCB_RECORD_CS_FUTURE_CLIENTS = 2, XCB_RECORD_CS_ALL_CLIENTS = 3 } xcb_record_cs_t; /** * @brief xcb_record_client_info_t **/ typedef struct xcb_record_client_info_t { xcb_record_client_spec_t client_resource; uint32_t num_ranges; } xcb_record_client_info_t; /** * @brief xcb_record_client_info_iterator_t **/ typedef struct xcb_record_client_info_iterator_t { xcb_record_client_info_t *data; int rem; int index; } xcb_record_client_info_iterator_t; /** Opcode for xcb_record_bad_context. */ #define XCB_RECORD_BAD_CONTEXT 0 /** * @brief xcb_record_bad_context_error_t **/ typedef struct xcb_record_bad_context_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; uint32_t invalid_record; } xcb_record_bad_context_error_t; /** * @brief xcb_record_query_version_cookie_t **/ typedef struct xcb_record_query_version_cookie_t { unsigned int sequence; } xcb_record_query_version_cookie_t; /** Opcode for xcb_record_query_version. */ #define XCB_RECORD_QUERY_VERSION 0 /** * @brief xcb_record_query_version_request_t **/ typedef struct xcb_record_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint16_t major_version; uint16_t minor_version; } xcb_record_query_version_request_t; /** * @brief xcb_record_query_version_reply_t **/ typedef struct xcb_record_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t major_version; uint16_t minor_version; } xcb_record_query_version_reply_t; /** Opcode for xcb_record_create_context. */ #define XCB_RECORD_CREATE_CONTEXT 1 /** * @brief xcb_record_create_context_request_t **/ typedef struct xcb_record_create_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_record_context_t context; xcb_record_element_header_t element_header; uint8_t pad0[3]; uint32_t num_client_specs; uint32_t num_ranges; } xcb_record_create_context_request_t; /** Opcode for xcb_record_register_clients. */ #define XCB_RECORD_REGISTER_CLIENTS 2 /** * @brief xcb_record_register_clients_request_t **/ typedef struct xcb_record_register_clients_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_record_context_t context; xcb_record_element_header_t element_header; uint8_t pad0[3]; uint32_t num_client_specs; uint32_t num_ranges; } xcb_record_register_clients_request_t; /** Opcode for xcb_record_unregister_clients. */ #define XCB_RECORD_UNREGISTER_CLIENTS 3 /** * @brief xcb_record_unregister_clients_request_t **/ typedef struct xcb_record_unregister_clients_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_record_context_t context; uint32_t num_client_specs; } xcb_record_unregister_clients_request_t; /** * @brief xcb_record_get_context_cookie_t **/ typedef struct xcb_record_get_context_cookie_t { unsigned int sequence; } xcb_record_get_context_cookie_t; /** Opcode for xcb_record_get_context. */ #define XCB_RECORD_GET_CONTEXT 4 /** * @brief xcb_record_get_context_request_t **/ typedef struct xcb_record_get_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_record_context_t context; } xcb_record_get_context_request_t; /** * @brief xcb_record_get_context_reply_t **/ typedef struct xcb_record_get_context_reply_t { uint8_t response_type; uint8_t enabled; uint16_t sequence; uint32_t length; xcb_record_element_header_t element_header; uint8_t pad0[3]; uint32_t num_intercepted_clients; uint8_t pad1[16]; } xcb_record_get_context_reply_t; /** * @brief xcb_record_enable_context_cookie_t **/ typedef struct xcb_record_enable_context_cookie_t { unsigned int sequence; } xcb_record_enable_context_cookie_t; /** Opcode for xcb_record_enable_context. */ #define XCB_RECORD_ENABLE_CONTEXT 5 /** * @brief xcb_record_enable_context_request_t **/ typedef struct xcb_record_enable_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_record_context_t context; } xcb_record_enable_context_request_t; /** * @brief xcb_record_enable_context_reply_t **/ typedef struct xcb_record_enable_context_reply_t { uint8_t response_type; uint8_t category; uint16_t sequence; uint32_t length; xcb_record_element_header_t element_header; uint8_t client_swapped; uint8_t pad0[2]; uint32_t xid_base; uint32_t server_time; uint32_t rec_sequence_num; uint8_t pad1[8]; } xcb_record_enable_context_reply_t; /** Opcode for xcb_record_disable_context. */ #define XCB_RECORD_DISABLE_CONTEXT 6 /** * @brief xcb_record_disable_context_request_t **/ typedef struct xcb_record_disable_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_record_context_t context; } xcb_record_disable_context_request_t; /** Opcode for xcb_record_free_context. */ #define XCB_RECORD_FREE_CONTEXT 7 /** * @brief xcb_record_free_context_request_t **/ typedef struct xcb_record_free_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_record_context_t context; } xcb_record_free_context_request_t; /** * Get the next element of the iterator * @param i Pointer to a xcb_record_context_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_record_context_t) */ void xcb_record_context_next (xcb_record_context_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_record_context_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_record_context_end (xcb_record_context_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_record_range_8_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_record_range_8_t) */ void xcb_record_range_8_next (xcb_record_range_8_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_record_range_8_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_record_range_8_end (xcb_record_range_8_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_record_range_16_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_record_range_16_t) */ void xcb_record_range_16_next (xcb_record_range_16_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_record_range_16_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_record_range_16_end (xcb_record_range_16_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_record_ext_range_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_record_ext_range_t) */ void xcb_record_ext_range_next (xcb_record_ext_range_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_record_ext_range_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_record_ext_range_end (xcb_record_ext_range_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_record_range_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_record_range_t) */ void xcb_record_range_next (xcb_record_range_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_record_range_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_record_range_end (xcb_record_range_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_record_element_header_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_record_element_header_t) */ void xcb_record_element_header_next (xcb_record_element_header_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_record_element_header_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_record_element_header_end (xcb_record_element_header_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_record_client_spec_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_record_client_spec_t) */ void xcb_record_client_spec_next (xcb_record_client_spec_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_record_client_spec_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_record_client_spec_end (xcb_record_client_spec_iterator_t i); int xcb_record_client_info_sizeof (const void *_buffer); xcb_record_range_t * xcb_record_client_info_ranges (const xcb_record_client_info_t *R); int xcb_record_client_info_ranges_length (const xcb_record_client_info_t *R); xcb_record_range_iterator_t xcb_record_client_info_ranges_iterator (const xcb_record_client_info_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_record_client_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_record_client_info_t) */ void xcb_record_client_info_next (xcb_record_client_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_record_client_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_record_client_info_end (xcb_record_client_info_iterator_t i); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_record_query_version_cookie_t xcb_record_query_version (xcb_connection_t *c, uint16_t major_version, uint16_t minor_version); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_record_query_version_cookie_t xcb_record_query_version_unchecked (xcb_connection_t *c, uint16_t major_version, uint16_t minor_version); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_record_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_record_query_version_reply_t * xcb_record_query_version_reply (xcb_connection_t *c, xcb_record_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_record_create_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_record_create_context_checked (xcb_connection_t *c, xcb_record_context_t context, xcb_record_element_header_t element_header, uint32_t num_client_specs, uint32_t num_ranges, const xcb_record_client_spec_t *client_specs, const xcb_record_range_t *ranges); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_record_create_context (xcb_connection_t *c, xcb_record_context_t context, xcb_record_element_header_t element_header, uint32_t num_client_specs, uint32_t num_ranges, const xcb_record_client_spec_t *client_specs, const xcb_record_range_t *ranges); xcb_record_client_spec_t * xcb_record_create_context_client_specs (const xcb_record_create_context_request_t *R); int xcb_record_create_context_client_specs_length (const xcb_record_create_context_request_t *R); xcb_generic_iterator_t xcb_record_create_context_client_specs_end (const xcb_record_create_context_request_t *R); xcb_record_range_t * xcb_record_create_context_ranges (const xcb_record_create_context_request_t *R); int xcb_record_create_context_ranges_length (const xcb_record_create_context_request_t *R); xcb_record_range_iterator_t xcb_record_create_context_ranges_iterator (const xcb_record_create_context_request_t *R); int xcb_record_register_clients_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_record_register_clients_checked (xcb_connection_t *c, xcb_record_context_t context, xcb_record_element_header_t element_header, uint32_t num_client_specs, uint32_t num_ranges, const xcb_record_client_spec_t *client_specs, const xcb_record_range_t *ranges); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_record_register_clients (xcb_connection_t *c, xcb_record_context_t context, xcb_record_element_header_t element_header, uint32_t num_client_specs, uint32_t num_ranges, const xcb_record_client_spec_t *client_specs, const xcb_record_range_t *ranges); xcb_record_client_spec_t * xcb_record_register_clients_client_specs (const xcb_record_register_clients_request_t *R); int xcb_record_register_clients_client_specs_length (const xcb_record_register_clients_request_t *R); xcb_generic_iterator_t xcb_record_register_clients_client_specs_end (const xcb_record_register_clients_request_t *R); xcb_record_range_t * xcb_record_register_clients_ranges (const xcb_record_register_clients_request_t *R); int xcb_record_register_clients_ranges_length (const xcb_record_register_clients_request_t *R); xcb_record_range_iterator_t xcb_record_register_clients_ranges_iterator (const xcb_record_register_clients_request_t *R); int xcb_record_unregister_clients_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_record_unregister_clients_checked (xcb_connection_t *c, xcb_record_context_t context, uint32_t num_client_specs, const xcb_record_client_spec_t *client_specs); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_record_unregister_clients (xcb_connection_t *c, xcb_record_context_t context, uint32_t num_client_specs, const xcb_record_client_spec_t *client_specs); xcb_record_client_spec_t * xcb_record_unregister_clients_client_specs (const xcb_record_unregister_clients_request_t *R); int xcb_record_unregister_clients_client_specs_length (const xcb_record_unregister_clients_request_t *R); xcb_generic_iterator_t xcb_record_unregister_clients_client_specs_end (const xcb_record_unregister_clients_request_t *R); int xcb_record_get_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_record_get_context_cookie_t xcb_record_get_context (xcb_connection_t *c, xcb_record_context_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_record_get_context_cookie_t xcb_record_get_context_unchecked (xcb_connection_t *c, xcb_record_context_t context); int xcb_record_get_context_intercepted_clients_length (const xcb_record_get_context_reply_t *R); xcb_record_client_info_iterator_t xcb_record_get_context_intercepted_clients_iterator (const xcb_record_get_context_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_record_get_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_record_get_context_reply_t * xcb_record_get_context_reply (xcb_connection_t *c, xcb_record_get_context_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_record_enable_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_record_enable_context_cookie_t xcb_record_enable_context (xcb_connection_t *c, xcb_record_context_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_record_enable_context_cookie_t xcb_record_enable_context_unchecked (xcb_connection_t *c, xcb_record_context_t context); uint8_t * xcb_record_enable_context_data (const xcb_record_enable_context_reply_t *R); int xcb_record_enable_context_data_length (const xcb_record_enable_context_reply_t *R); xcb_generic_iterator_t xcb_record_enable_context_data_end (const xcb_record_enable_context_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_record_enable_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_record_enable_context_reply_t * xcb_record_enable_context_reply (xcb_connection_t *c, xcb_record_enable_context_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_record_disable_context_checked (xcb_connection_t *c, xcb_record_context_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_record_disable_context (xcb_connection_t *c, xcb_record_context_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_record_free_context_checked (xcb_connection_t *c, xcb_record_context_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_record_free_context (xcb_connection_t *c, xcb_record_context_t context); #ifdef __cplusplus } #endif #endif /** * @} */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/xselinux.h��������������������������������������������������������������������������������������0000644�����������������00000156456�14763166026�0007404 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from xselinux.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_SELinux_API XCB SELinux API * @brief SELinux XCB Protocol Implementation. * @{ **/ #ifndef __XSELINUX_H #define __XSELINUX_H #include "xcb.h" #include "xproto.h" #ifdef __cplusplus extern "C" { #endif #define XCB_SELINUX_MAJOR_VERSION 1 #define XCB_SELINUX_MINOR_VERSION 0 extern xcb_extension_t xcb_selinux_id; /** * @brief xcb_selinux_query_version_cookie_t **/ typedef struct xcb_selinux_query_version_cookie_t { unsigned int sequence; } xcb_selinux_query_version_cookie_t; /** Opcode for xcb_selinux_query_version. */ #define XCB_SELINUX_QUERY_VERSION 0 /** * @brief xcb_selinux_query_version_request_t **/ typedef struct xcb_selinux_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t client_major; uint8_t client_minor; } xcb_selinux_query_version_request_t; /** * @brief xcb_selinux_query_version_reply_t **/ typedef struct xcb_selinux_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t server_major; uint16_t server_minor; } xcb_selinux_query_version_reply_t; /** Opcode for xcb_selinux_set_device_create_context. */ #define XCB_SELINUX_SET_DEVICE_CREATE_CONTEXT 1 /** * @brief xcb_selinux_set_device_create_context_request_t **/ typedef struct xcb_selinux_set_device_create_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t context_len; } xcb_selinux_set_device_create_context_request_t; /** * @brief xcb_selinux_get_device_create_context_cookie_t **/ typedef struct xcb_selinux_get_device_create_context_cookie_t { unsigned int sequence; } xcb_selinux_get_device_create_context_cookie_t; /** Opcode for xcb_selinux_get_device_create_context. */ #define XCB_SELINUX_GET_DEVICE_CREATE_CONTEXT 2 /** * @brief xcb_selinux_get_device_create_context_request_t **/ typedef struct xcb_selinux_get_device_create_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_selinux_get_device_create_context_request_t; /** * @brief xcb_selinux_get_device_create_context_reply_t **/ typedef struct xcb_selinux_get_device_create_context_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t context_len; uint8_t pad1[20]; } xcb_selinux_get_device_create_context_reply_t; /** Opcode for xcb_selinux_set_device_context. */ #define XCB_SELINUX_SET_DEVICE_CONTEXT 3 /** * @brief xcb_selinux_set_device_context_request_t **/ typedef struct xcb_selinux_set_device_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t device; uint32_t context_len; } xcb_selinux_set_device_context_request_t; /** * @brief xcb_selinux_get_device_context_cookie_t **/ typedef struct xcb_selinux_get_device_context_cookie_t { unsigned int sequence; } xcb_selinux_get_device_context_cookie_t; /** Opcode for xcb_selinux_get_device_context. */ #define XCB_SELINUX_GET_DEVICE_CONTEXT 4 /** * @brief xcb_selinux_get_device_context_request_t **/ typedef struct xcb_selinux_get_device_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t device; } xcb_selinux_get_device_context_request_t; /** * @brief xcb_selinux_get_device_context_reply_t **/ typedef struct xcb_selinux_get_device_context_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t context_len; uint8_t pad1[20]; } xcb_selinux_get_device_context_reply_t; /** Opcode for xcb_selinux_set_window_create_context. */ #define XCB_SELINUX_SET_WINDOW_CREATE_CONTEXT 5 /** * @brief xcb_selinux_set_window_create_context_request_t **/ typedef struct xcb_selinux_set_window_create_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t context_len; } xcb_selinux_set_window_create_context_request_t; /** * @brief xcb_selinux_get_window_create_context_cookie_t **/ typedef struct xcb_selinux_get_window_create_context_cookie_t { unsigned int sequence; } xcb_selinux_get_window_create_context_cookie_t; /** Opcode for xcb_selinux_get_window_create_context. */ #define XCB_SELINUX_GET_WINDOW_CREATE_CONTEXT 6 /** * @brief xcb_selinux_get_window_create_context_request_t **/ typedef struct xcb_selinux_get_window_create_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_selinux_get_window_create_context_request_t; /** * @brief xcb_selinux_get_window_create_context_reply_t **/ typedef struct xcb_selinux_get_window_create_context_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t context_len; uint8_t pad1[20]; } xcb_selinux_get_window_create_context_reply_t; /** * @brief xcb_selinux_get_window_context_cookie_t **/ typedef struct xcb_selinux_get_window_context_cookie_t { unsigned int sequence; } xcb_selinux_get_window_context_cookie_t; /** Opcode for xcb_selinux_get_window_context. */ #define XCB_SELINUX_GET_WINDOW_CONTEXT 7 /** * @brief xcb_selinux_get_window_context_request_t **/ typedef struct xcb_selinux_get_window_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_selinux_get_window_context_request_t; /** * @brief xcb_selinux_get_window_context_reply_t **/ typedef struct xcb_selinux_get_window_context_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t context_len; uint8_t pad1[20]; } xcb_selinux_get_window_context_reply_t; /** * @brief xcb_selinux_list_item_t **/ typedef struct xcb_selinux_list_item_t { xcb_atom_t name; uint32_t object_context_len; uint32_t data_context_len; } xcb_selinux_list_item_t; /** * @brief xcb_selinux_list_item_iterator_t **/ typedef struct xcb_selinux_list_item_iterator_t { xcb_selinux_list_item_t *data; int rem; int index; } xcb_selinux_list_item_iterator_t; /** Opcode for xcb_selinux_set_property_create_context. */ #define XCB_SELINUX_SET_PROPERTY_CREATE_CONTEXT 8 /** * @brief xcb_selinux_set_property_create_context_request_t **/ typedef struct xcb_selinux_set_property_create_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t context_len; } xcb_selinux_set_property_create_context_request_t; /** * @brief xcb_selinux_get_property_create_context_cookie_t **/ typedef struct xcb_selinux_get_property_create_context_cookie_t { unsigned int sequence; } xcb_selinux_get_property_create_context_cookie_t; /** Opcode for xcb_selinux_get_property_create_context. */ #define XCB_SELINUX_GET_PROPERTY_CREATE_CONTEXT 9 /** * @brief xcb_selinux_get_property_create_context_request_t **/ typedef struct xcb_selinux_get_property_create_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_selinux_get_property_create_context_request_t; /** * @brief xcb_selinux_get_property_create_context_reply_t **/ typedef struct xcb_selinux_get_property_create_context_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t context_len; uint8_t pad1[20]; } xcb_selinux_get_property_create_context_reply_t; /** Opcode for xcb_selinux_set_property_use_context. */ #define XCB_SELINUX_SET_PROPERTY_USE_CONTEXT 10 /** * @brief xcb_selinux_set_property_use_context_request_t **/ typedef struct xcb_selinux_set_property_use_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t context_len; } xcb_selinux_set_property_use_context_request_t; /** * @brief xcb_selinux_get_property_use_context_cookie_t **/ typedef struct xcb_selinux_get_property_use_context_cookie_t { unsigned int sequence; } xcb_selinux_get_property_use_context_cookie_t; /** Opcode for xcb_selinux_get_property_use_context. */ #define XCB_SELINUX_GET_PROPERTY_USE_CONTEXT 11 /** * @brief xcb_selinux_get_property_use_context_request_t **/ typedef struct xcb_selinux_get_property_use_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_selinux_get_property_use_context_request_t; /** * @brief xcb_selinux_get_property_use_context_reply_t **/ typedef struct xcb_selinux_get_property_use_context_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t context_len; uint8_t pad1[20]; } xcb_selinux_get_property_use_context_reply_t; /** * @brief xcb_selinux_get_property_context_cookie_t **/ typedef struct xcb_selinux_get_property_context_cookie_t { unsigned int sequence; } xcb_selinux_get_property_context_cookie_t; /** Opcode for xcb_selinux_get_property_context. */ #define XCB_SELINUX_GET_PROPERTY_CONTEXT 12 /** * @brief xcb_selinux_get_property_context_request_t **/ typedef struct xcb_selinux_get_property_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; xcb_atom_t property; } xcb_selinux_get_property_context_request_t; /** * @brief xcb_selinux_get_property_context_reply_t **/ typedef struct xcb_selinux_get_property_context_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t context_len; uint8_t pad1[20]; } xcb_selinux_get_property_context_reply_t; /** * @brief xcb_selinux_get_property_data_context_cookie_t **/ typedef struct xcb_selinux_get_property_data_context_cookie_t { unsigned int sequence; } xcb_selinux_get_property_data_context_cookie_t; /** Opcode for xcb_selinux_get_property_data_context. */ #define XCB_SELINUX_GET_PROPERTY_DATA_CONTEXT 13 /** * @brief xcb_selinux_get_property_data_context_request_t **/ typedef struct xcb_selinux_get_property_data_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; xcb_atom_t property; } xcb_selinux_get_property_data_context_request_t; /** * @brief xcb_selinux_get_property_data_context_reply_t **/ typedef struct xcb_selinux_get_property_data_context_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t context_len; uint8_t pad1[20]; } xcb_selinux_get_property_data_context_reply_t; /** * @brief xcb_selinux_list_properties_cookie_t **/ typedef struct xcb_selinux_list_properties_cookie_t { unsigned int sequence; } xcb_selinux_list_properties_cookie_t; /** Opcode for xcb_selinux_list_properties. */ #define XCB_SELINUX_LIST_PROPERTIES 14 /** * @brief xcb_selinux_list_properties_request_t **/ typedef struct xcb_selinux_list_properties_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_selinux_list_properties_request_t; /** * @brief xcb_selinux_list_properties_reply_t **/ typedef struct xcb_selinux_list_properties_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t properties_len; uint8_t pad1[20]; } xcb_selinux_list_properties_reply_t; /** Opcode for xcb_selinux_set_selection_create_context. */ #define XCB_SELINUX_SET_SELECTION_CREATE_CONTEXT 15 /** * @brief xcb_selinux_set_selection_create_context_request_t **/ typedef struct xcb_selinux_set_selection_create_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t context_len; } xcb_selinux_set_selection_create_context_request_t; /** * @brief xcb_selinux_get_selection_create_context_cookie_t **/ typedef struct xcb_selinux_get_selection_create_context_cookie_t { unsigned int sequence; } xcb_selinux_get_selection_create_context_cookie_t; /** Opcode for xcb_selinux_get_selection_create_context. */ #define XCB_SELINUX_GET_SELECTION_CREATE_CONTEXT 16 /** * @brief xcb_selinux_get_selection_create_context_request_t **/ typedef struct xcb_selinux_get_selection_create_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_selinux_get_selection_create_context_request_t; /** * @brief xcb_selinux_get_selection_create_context_reply_t **/ typedef struct xcb_selinux_get_selection_create_context_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t context_len; uint8_t pad1[20]; } xcb_selinux_get_selection_create_context_reply_t; /** Opcode for xcb_selinux_set_selection_use_context. */ #define XCB_SELINUX_SET_SELECTION_USE_CONTEXT 17 /** * @brief xcb_selinux_set_selection_use_context_request_t **/ typedef struct xcb_selinux_set_selection_use_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t context_len; } xcb_selinux_set_selection_use_context_request_t; /** * @brief xcb_selinux_get_selection_use_context_cookie_t **/ typedef struct xcb_selinux_get_selection_use_context_cookie_t { unsigned int sequence; } xcb_selinux_get_selection_use_context_cookie_t; /** Opcode for xcb_selinux_get_selection_use_context. */ #define XCB_SELINUX_GET_SELECTION_USE_CONTEXT 18 /** * @brief xcb_selinux_get_selection_use_context_request_t **/ typedef struct xcb_selinux_get_selection_use_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_selinux_get_selection_use_context_request_t; /** * @brief xcb_selinux_get_selection_use_context_reply_t **/ typedef struct xcb_selinux_get_selection_use_context_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t context_len; uint8_t pad1[20]; } xcb_selinux_get_selection_use_context_reply_t; /** * @brief xcb_selinux_get_selection_context_cookie_t **/ typedef struct xcb_selinux_get_selection_context_cookie_t { unsigned int sequence; } xcb_selinux_get_selection_context_cookie_t; /** Opcode for xcb_selinux_get_selection_context. */ #define XCB_SELINUX_GET_SELECTION_CONTEXT 19 /** * @brief xcb_selinux_get_selection_context_request_t **/ typedef struct xcb_selinux_get_selection_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_atom_t selection; } xcb_selinux_get_selection_context_request_t; /** * @brief xcb_selinux_get_selection_context_reply_t **/ typedef struct xcb_selinux_get_selection_context_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t context_len; uint8_t pad1[20]; } xcb_selinux_get_selection_context_reply_t; /** * @brief xcb_selinux_get_selection_data_context_cookie_t **/ typedef struct xcb_selinux_get_selection_data_context_cookie_t { unsigned int sequence; } xcb_selinux_get_selection_data_context_cookie_t; /** Opcode for xcb_selinux_get_selection_data_context. */ #define XCB_SELINUX_GET_SELECTION_DATA_CONTEXT 20 /** * @brief xcb_selinux_get_selection_data_context_request_t **/ typedef struct xcb_selinux_get_selection_data_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_atom_t selection; } xcb_selinux_get_selection_data_context_request_t; /** * @brief xcb_selinux_get_selection_data_context_reply_t **/ typedef struct xcb_selinux_get_selection_data_context_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t context_len; uint8_t pad1[20]; } xcb_selinux_get_selection_data_context_reply_t; /** * @brief xcb_selinux_list_selections_cookie_t **/ typedef struct xcb_selinux_list_selections_cookie_t { unsigned int sequence; } xcb_selinux_list_selections_cookie_t; /** Opcode for xcb_selinux_list_selections. */ #define XCB_SELINUX_LIST_SELECTIONS 21 /** * @brief xcb_selinux_list_selections_request_t **/ typedef struct xcb_selinux_list_selections_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_selinux_list_selections_request_t; /** * @brief xcb_selinux_list_selections_reply_t **/ typedef struct xcb_selinux_list_selections_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t selections_len; uint8_t pad1[20]; } xcb_selinux_list_selections_reply_t; /** * @brief xcb_selinux_get_client_context_cookie_t **/ typedef struct xcb_selinux_get_client_context_cookie_t { unsigned int sequence; } xcb_selinux_get_client_context_cookie_t; /** Opcode for xcb_selinux_get_client_context. */ #define XCB_SELINUX_GET_CLIENT_CONTEXT 22 /** * @brief xcb_selinux_get_client_context_request_t **/ typedef struct xcb_selinux_get_client_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t resource; } xcb_selinux_get_client_context_request_t; /** * @brief xcb_selinux_get_client_context_reply_t **/ typedef struct xcb_selinux_get_client_context_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t context_len; uint8_t pad1[20]; } xcb_selinux_get_client_context_reply_t; /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_selinux_query_version_cookie_t xcb_selinux_query_version (xcb_connection_t *c, uint8_t client_major, uint8_t client_minor); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_selinux_query_version_cookie_t xcb_selinux_query_version_unchecked (xcb_connection_t *c, uint8_t client_major, uint8_t client_minor); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_selinux_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_selinux_query_version_reply_t * xcb_selinux_query_version_reply (xcb_connection_t *c, xcb_selinux_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_selinux_set_device_create_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_selinux_set_device_create_context_checked (xcb_connection_t *c, uint32_t context_len, const char *context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_selinux_set_device_create_context (xcb_connection_t *c, uint32_t context_len, const char *context); char * xcb_selinux_set_device_create_context_context (const xcb_selinux_set_device_create_context_request_t *R); int xcb_selinux_set_device_create_context_context_length (const xcb_selinux_set_device_create_context_request_t *R); xcb_generic_iterator_t xcb_selinux_set_device_create_context_context_end (const xcb_selinux_set_device_create_context_request_t *R); int xcb_selinux_get_device_create_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_selinux_get_device_create_context_cookie_t xcb_selinux_get_device_create_context (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_selinux_get_device_create_context_cookie_t xcb_selinux_get_device_create_context_unchecked (xcb_connection_t *c); char * xcb_selinux_get_device_create_context_context (const xcb_selinux_get_device_create_context_reply_t *R); int xcb_selinux_get_device_create_context_context_length (const xcb_selinux_get_device_create_context_reply_t *R); xcb_generic_iterator_t xcb_selinux_get_device_create_context_context_end (const xcb_selinux_get_device_create_context_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_selinux_get_device_create_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_selinux_get_device_create_context_reply_t * xcb_selinux_get_device_create_context_reply (xcb_connection_t *c, xcb_selinux_get_device_create_context_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_selinux_set_device_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_selinux_set_device_context_checked (xcb_connection_t *c, uint32_t device, uint32_t context_len, const char *context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_selinux_set_device_context (xcb_connection_t *c, uint32_t device, uint32_t context_len, const char *context); char * xcb_selinux_set_device_context_context (const xcb_selinux_set_device_context_request_t *R); int xcb_selinux_set_device_context_context_length (const xcb_selinux_set_device_context_request_t *R); xcb_generic_iterator_t xcb_selinux_set_device_context_context_end (const xcb_selinux_set_device_context_request_t *R); int xcb_selinux_get_device_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_selinux_get_device_context_cookie_t xcb_selinux_get_device_context (xcb_connection_t *c, uint32_t device); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_selinux_get_device_context_cookie_t xcb_selinux_get_device_context_unchecked (xcb_connection_t *c, uint32_t device); char * xcb_selinux_get_device_context_context (const xcb_selinux_get_device_context_reply_t *R); int xcb_selinux_get_device_context_context_length (const xcb_selinux_get_device_context_reply_t *R); xcb_generic_iterator_t xcb_selinux_get_device_context_context_end (const xcb_selinux_get_device_context_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_selinux_get_device_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_selinux_get_device_context_reply_t * xcb_selinux_get_device_context_reply (xcb_connection_t *c, xcb_selinux_get_device_context_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_selinux_set_window_create_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_selinux_set_window_create_context_checked (xcb_connection_t *c, uint32_t context_len, const char *context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_selinux_set_window_create_context (xcb_connection_t *c, uint32_t context_len, const char *context); char * xcb_selinux_set_window_create_context_context (const xcb_selinux_set_window_create_context_request_t *R); int xcb_selinux_set_window_create_context_context_length (const xcb_selinux_set_window_create_context_request_t *R); xcb_generic_iterator_t xcb_selinux_set_window_create_context_context_end (const xcb_selinux_set_window_create_context_request_t *R); int xcb_selinux_get_window_create_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_selinux_get_window_create_context_cookie_t xcb_selinux_get_window_create_context (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_selinux_get_window_create_context_cookie_t xcb_selinux_get_window_create_context_unchecked (xcb_connection_t *c); char * xcb_selinux_get_window_create_context_context (const xcb_selinux_get_window_create_context_reply_t *R); int xcb_selinux_get_window_create_context_context_length (const xcb_selinux_get_window_create_context_reply_t *R); xcb_generic_iterator_t xcb_selinux_get_window_create_context_context_end (const xcb_selinux_get_window_create_context_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_selinux_get_window_create_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_selinux_get_window_create_context_reply_t * xcb_selinux_get_window_create_context_reply (xcb_connection_t *c, xcb_selinux_get_window_create_context_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_selinux_get_window_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_selinux_get_window_context_cookie_t xcb_selinux_get_window_context (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_selinux_get_window_context_cookie_t xcb_selinux_get_window_context_unchecked (xcb_connection_t *c, xcb_window_t window); char * xcb_selinux_get_window_context_context (const xcb_selinux_get_window_context_reply_t *R); int xcb_selinux_get_window_context_context_length (const xcb_selinux_get_window_context_reply_t *R); xcb_generic_iterator_t xcb_selinux_get_window_context_context_end (const xcb_selinux_get_window_context_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_selinux_get_window_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_selinux_get_window_context_reply_t * xcb_selinux_get_window_context_reply (xcb_connection_t *c, xcb_selinux_get_window_context_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_selinux_list_item_sizeof (const void *_buffer); char * xcb_selinux_list_item_object_context (const xcb_selinux_list_item_t *R); int xcb_selinux_list_item_object_context_length (const xcb_selinux_list_item_t *R); xcb_generic_iterator_t xcb_selinux_list_item_object_context_end (const xcb_selinux_list_item_t *R); char * xcb_selinux_list_item_data_context (const xcb_selinux_list_item_t *R); int xcb_selinux_list_item_data_context_length (const xcb_selinux_list_item_t *R); xcb_generic_iterator_t xcb_selinux_list_item_data_context_end (const xcb_selinux_list_item_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_selinux_list_item_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_selinux_list_item_t) */ void xcb_selinux_list_item_next (xcb_selinux_list_item_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_selinux_list_item_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_selinux_list_item_end (xcb_selinux_list_item_iterator_t i); int xcb_selinux_set_property_create_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_selinux_set_property_create_context_checked (xcb_connection_t *c, uint32_t context_len, const char *context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_selinux_set_property_create_context (xcb_connection_t *c, uint32_t context_len, const char *context); char * xcb_selinux_set_property_create_context_context (const xcb_selinux_set_property_create_context_request_t *R); int xcb_selinux_set_property_create_context_context_length (const xcb_selinux_set_property_create_context_request_t *R); xcb_generic_iterator_t xcb_selinux_set_property_create_context_context_end (const xcb_selinux_set_property_create_context_request_t *R); int xcb_selinux_get_property_create_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_selinux_get_property_create_context_cookie_t xcb_selinux_get_property_create_context (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_selinux_get_property_create_context_cookie_t xcb_selinux_get_property_create_context_unchecked (xcb_connection_t *c); char * xcb_selinux_get_property_create_context_context (const xcb_selinux_get_property_create_context_reply_t *R); int xcb_selinux_get_property_create_context_context_length (const xcb_selinux_get_property_create_context_reply_t *R); xcb_generic_iterator_t xcb_selinux_get_property_create_context_context_end (const xcb_selinux_get_property_create_context_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_selinux_get_property_create_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_selinux_get_property_create_context_reply_t * xcb_selinux_get_property_create_context_reply (xcb_connection_t *c, xcb_selinux_get_property_create_context_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_selinux_set_property_use_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_selinux_set_property_use_context_checked (xcb_connection_t *c, uint32_t context_len, const char *context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_selinux_set_property_use_context (xcb_connection_t *c, uint32_t context_len, const char *context); char * xcb_selinux_set_property_use_context_context (const xcb_selinux_set_property_use_context_request_t *R); int xcb_selinux_set_property_use_context_context_length (const xcb_selinux_set_property_use_context_request_t *R); xcb_generic_iterator_t xcb_selinux_set_property_use_context_context_end (const xcb_selinux_set_property_use_context_request_t *R); int xcb_selinux_get_property_use_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_selinux_get_property_use_context_cookie_t xcb_selinux_get_property_use_context (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_selinux_get_property_use_context_cookie_t xcb_selinux_get_property_use_context_unchecked (xcb_connection_t *c); char * xcb_selinux_get_property_use_context_context (const xcb_selinux_get_property_use_context_reply_t *R); int xcb_selinux_get_property_use_context_context_length (const xcb_selinux_get_property_use_context_reply_t *R); xcb_generic_iterator_t xcb_selinux_get_property_use_context_context_end (const xcb_selinux_get_property_use_context_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_selinux_get_property_use_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_selinux_get_property_use_context_reply_t * xcb_selinux_get_property_use_context_reply (xcb_connection_t *c, xcb_selinux_get_property_use_context_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_selinux_get_property_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_selinux_get_property_context_cookie_t xcb_selinux_get_property_context (xcb_connection_t *c, xcb_window_t window, xcb_atom_t property); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_selinux_get_property_context_cookie_t xcb_selinux_get_property_context_unchecked (xcb_connection_t *c, xcb_window_t window, xcb_atom_t property); char * xcb_selinux_get_property_context_context (const xcb_selinux_get_property_context_reply_t *R); int xcb_selinux_get_property_context_context_length (const xcb_selinux_get_property_context_reply_t *R); xcb_generic_iterator_t xcb_selinux_get_property_context_context_end (const xcb_selinux_get_property_context_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_selinux_get_property_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_selinux_get_property_context_reply_t * xcb_selinux_get_property_context_reply (xcb_connection_t *c, xcb_selinux_get_property_context_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_selinux_get_property_data_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_selinux_get_property_data_context_cookie_t xcb_selinux_get_property_data_context (xcb_connection_t *c, xcb_window_t window, xcb_atom_t property); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_selinux_get_property_data_context_cookie_t xcb_selinux_get_property_data_context_unchecked (xcb_connection_t *c, xcb_window_t window, xcb_atom_t property); char * xcb_selinux_get_property_data_context_context (const xcb_selinux_get_property_data_context_reply_t *R); int xcb_selinux_get_property_data_context_context_length (const xcb_selinux_get_property_data_context_reply_t *R); xcb_generic_iterator_t xcb_selinux_get_property_data_context_context_end (const xcb_selinux_get_property_data_context_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_selinux_get_property_data_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_selinux_get_property_data_context_reply_t * xcb_selinux_get_property_data_context_reply (xcb_connection_t *c, xcb_selinux_get_property_data_context_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_selinux_list_properties_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_selinux_list_properties_cookie_t xcb_selinux_list_properties (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_selinux_list_properties_cookie_t xcb_selinux_list_properties_unchecked (xcb_connection_t *c, xcb_window_t window); int xcb_selinux_list_properties_properties_length (const xcb_selinux_list_properties_reply_t *R); xcb_selinux_list_item_iterator_t xcb_selinux_list_properties_properties_iterator (const xcb_selinux_list_properties_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_selinux_list_properties_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_selinux_list_properties_reply_t * xcb_selinux_list_properties_reply (xcb_connection_t *c, xcb_selinux_list_properties_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_selinux_set_selection_create_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_selinux_set_selection_create_context_checked (xcb_connection_t *c, uint32_t context_len, const char *context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_selinux_set_selection_create_context (xcb_connection_t *c, uint32_t context_len, const char *context); char * xcb_selinux_set_selection_create_context_context (const xcb_selinux_set_selection_create_context_request_t *R); int xcb_selinux_set_selection_create_context_context_length (const xcb_selinux_set_selection_create_context_request_t *R); xcb_generic_iterator_t xcb_selinux_set_selection_create_context_context_end (const xcb_selinux_set_selection_create_context_request_t *R); int xcb_selinux_get_selection_create_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_selinux_get_selection_create_context_cookie_t xcb_selinux_get_selection_create_context (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_selinux_get_selection_create_context_cookie_t xcb_selinux_get_selection_create_context_unchecked (xcb_connection_t *c); char * xcb_selinux_get_selection_create_context_context (const xcb_selinux_get_selection_create_context_reply_t *R); int xcb_selinux_get_selection_create_context_context_length (const xcb_selinux_get_selection_create_context_reply_t *R); xcb_generic_iterator_t xcb_selinux_get_selection_create_context_context_end (const xcb_selinux_get_selection_create_context_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_selinux_get_selection_create_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_selinux_get_selection_create_context_reply_t * xcb_selinux_get_selection_create_context_reply (xcb_connection_t *c, xcb_selinux_get_selection_create_context_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_selinux_set_selection_use_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_selinux_set_selection_use_context_checked (xcb_connection_t *c, uint32_t context_len, const char *context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_selinux_set_selection_use_context (xcb_connection_t *c, uint32_t context_len, const char *context); char * xcb_selinux_set_selection_use_context_context (const xcb_selinux_set_selection_use_context_request_t *R); int xcb_selinux_set_selection_use_context_context_length (const xcb_selinux_set_selection_use_context_request_t *R); xcb_generic_iterator_t xcb_selinux_set_selection_use_context_context_end (const xcb_selinux_set_selection_use_context_request_t *R); int xcb_selinux_get_selection_use_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_selinux_get_selection_use_context_cookie_t xcb_selinux_get_selection_use_context (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_selinux_get_selection_use_context_cookie_t xcb_selinux_get_selection_use_context_unchecked (xcb_connection_t *c); char * xcb_selinux_get_selection_use_context_context (const xcb_selinux_get_selection_use_context_reply_t *R); int xcb_selinux_get_selection_use_context_context_length (const xcb_selinux_get_selection_use_context_reply_t *R); xcb_generic_iterator_t xcb_selinux_get_selection_use_context_context_end (const xcb_selinux_get_selection_use_context_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_selinux_get_selection_use_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_selinux_get_selection_use_context_reply_t * xcb_selinux_get_selection_use_context_reply (xcb_connection_t *c, xcb_selinux_get_selection_use_context_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_selinux_get_selection_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_selinux_get_selection_context_cookie_t xcb_selinux_get_selection_context (xcb_connection_t *c, xcb_atom_t selection); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_selinux_get_selection_context_cookie_t xcb_selinux_get_selection_context_unchecked (xcb_connection_t *c, xcb_atom_t selection); char * xcb_selinux_get_selection_context_context (const xcb_selinux_get_selection_context_reply_t *R); int xcb_selinux_get_selection_context_context_length (const xcb_selinux_get_selection_context_reply_t *R); xcb_generic_iterator_t xcb_selinux_get_selection_context_context_end (const xcb_selinux_get_selection_context_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_selinux_get_selection_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_selinux_get_selection_context_reply_t * xcb_selinux_get_selection_context_reply (xcb_connection_t *c, xcb_selinux_get_selection_context_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_selinux_get_selection_data_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_selinux_get_selection_data_context_cookie_t xcb_selinux_get_selection_data_context (xcb_connection_t *c, xcb_atom_t selection); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_selinux_get_selection_data_context_cookie_t xcb_selinux_get_selection_data_context_unchecked (xcb_connection_t *c, xcb_atom_t selection); char * xcb_selinux_get_selection_data_context_context (const xcb_selinux_get_selection_data_context_reply_t *R); int xcb_selinux_get_selection_data_context_context_length (const xcb_selinux_get_selection_data_context_reply_t *R); xcb_generic_iterator_t xcb_selinux_get_selection_data_context_context_end (const xcb_selinux_get_selection_data_context_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_selinux_get_selection_data_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_selinux_get_selection_data_context_reply_t * xcb_selinux_get_selection_data_context_reply (xcb_connection_t *c, xcb_selinux_get_selection_data_context_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_selinux_list_selections_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_selinux_list_selections_cookie_t xcb_selinux_list_selections (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_selinux_list_selections_cookie_t xcb_selinux_list_selections_unchecked (xcb_connection_t *c); int xcb_selinux_list_selections_selections_length (const xcb_selinux_list_selections_reply_t *R); xcb_selinux_list_item_iterator_t xcb_selinux_list_selections_selections_iterator (const xcb_selinux_list_selections_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_selinux_list_selections_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_selinux_list_selections_reply_t * xcb_selinux_list_selections_reply (xcb_connection_t *c, xcb_selinux_list_selections_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_selinux_get_client_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_selinux_get_client_context_cookie_t xcb_selinux_get_client_context (xcb_connection_t *c, uint32_t resource); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_selinux_get_client_context_cookie_t xcb_selinux_get_client_context_unchecked (xcb_connection_t *c, uint32_t resource); char * xcb_selinux_get_client_context_context (const xcb_selinux_get_client_context_reply_t *R); int xcb_selinux_get_client_context_context_length (const xcb_selinux_get_client_context_reply_t *R); xcb_generic_iterator_t xcb_selinux_get_client_context_context_end (const xcb_selinux_get_client_context_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_selinux_get_client_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_selinux_get_client_context_reply_t * xcb_selinux_get_client_context_reply (xcb_connection_t *c, xcb_selinux_get_client_context_cookie_t cookie /**< */, xcb_generic_error_t **e); #ifdef __cplusplus } #endif #endif /** * @} */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/render.h����������������������������������������������������������������������������������������0000644�����������������00000312456�14763166026�0006776 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from render.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_Render_API XCB Render API * @brief Render XCB Protocol Implementation. * @{ **/ #ifndef __RENDER_H #define __RENDER_H #include "xcb.h" #include "xproto.h" #ifdef __cplusplus extern "C" { #endif #define XCB_RENDER_MAJOR_VERSION 0 #define XCB_RENDER_MINOR_VERSION 11 extern xcb_extension_t xcb_render_id; typedef enum xcb_render_pict_type_t { XCB_RENDER_PICT_TYPE_INDEXED = 0, XCB_RENDER_PICT_TYPE_DIRECT = 1 } xcb_render_pict_type_t; typedef enum xcb_render_picture_enum_t { XCB_RENDER_PICTURE_NONE = 0 } xcb_render_picture_enum_t; typedef enum xcb_render_pict_op_t { XCB_RENDER_PICT_OP_CLEAR = 0, XCB_RENDER_PICT_OP_SRC = 1, XCB_RENDER_PICT_OP_DST = 2, XCB_RENDER_PICT_OP_OVER = 3, XCB_RENDER_PICT_OP_OVER_REVERSE = 4, XCB_RENDER_PICT_OP_IN = 5, XCB_RENDER_PICT_OP_IN_REVERSE = 6, XCB_RENDER_PICT_OP_OUT = 7, XCB_RENDER_PICT_OP_OUT_REVERSE = 8, XCB_RENDER_PICT_OP_ATOP = 9, XCB_RENDER_PICT_OP_ATOP_REVERSE = 10, XCB_RENDER_PICT_OP_XOR = 11, XCB_RENDER_PICT_OP_ADD = 12, XCB_RENDER_PICT_OP_SATURATE = 13, XCB_RENDER_PICT_OP_DISJOINT_CLEAR = 16, XCB_RENDER_PICT_OP_DISJOINT_SRC = 17, XCB_RENDER_PICT_OP_DISJOINT_DST = 18, XCB_RENDER_PICT_OP_DISJOINT_OVER = 19, XCB_RENDER_PICT_OP_DISJOINT_OVER_REVERSE = 20, XCB_RENDER_PICT_OP_DISJOINT_IN = 21, XCB_RENDER_PICT_OP_DISJOINT_IN_REVERSE = 22, XCB_RENDER_PICT_OP_DISJOINT_OUT = 23, XCB_RENDER_PICT_OP_DISJOINT_OUT_REVERSE = 24, XCB_RENDER_PICT_OP_DISJOINT_ATOP = 25, XCB_RENDER_PICT_OP_DISJOINT_ATOP_REVERSE = 26, XCB_RENDER_PICT_OP_DISJOINT_XOR = 27, XCB_RENDER_PICT_OP_CONJOINT_CLEAR = 32, XCB_RENDER_PICT_OP_CONJOINT_SRC = 33, XCB_RENDER_PICT_OP_CONJOINT_DST = 34, XCB_RENDER_PICT_OP_CONJOINT_OVER = 35, XCB_RENDER_PICT_OP_CONJOINT_OVER_REVERSE = 36, XCB_RENDER_PICT_OP_CONJOINT_IN = 37, XCB_RENDER_PICT_OP_CONJOINT_IN_REVERSE = 38, XCB_RENDER_PICT_OP_CONJOINT_OUT = 39, XCB_RENDER_PICT_OP_CONJOINT_OUT_REVERSE = 40, XCB_RENDER_PICT_OP_CONJOINT_ATOP = 41, XCB_RENDER_PICT_OP_CONJOINT_ATOP_REVERSE = 42, XCB_RENDER_PICT_OP_CONJOINT_XOR = 43, XCB_RENDER_PICT_OP_MULTIPLY = 48, XCB_RENDER_PICT_OP_SCREEN = 49, XCB_RENDER_PICT_OP_OVERLAY = 50, XCB_RENDER_PICT_OP_DARKEN = 51, XCB_RENDER_PICT_OP_LIGHTEN = 52, XCB_RENDER_PICT_OP_COLOR_DODGE = 53, XCB_RENDER_PICT_OP_COLOR_BURN = 54, XCB_RENDER_PICT_OP_HARD_LIGHT = 55, XCB_RENDER_PICT_OP_SOFT_LIGHT = 56, XCB_RENDER_PICT_OP_DIFFERENCE = 57, XCB_RENDER_PICT_OP_EXCLUSION = 58, XCB_RENDER_PICT_OP_HSL_HUE = 59, XCB_RENDER_PICT_OP_HSL_SATURATION = 60, XCB_RENDER_PICT_OP_HSL_COLOR = 61, XCB_RENDER_PICT_OP_HSL_LUMINOSITY = 62 } xcb_render_pict_op_t; typedef enum xcb_render_poly_edge_t { XCB_RENDER_POLY_EDGE_SHARP = 0, XCB_RENDER_POLY_EDGE_SMOOTH = 1 } xcb_render_poly_edge_t; typedef enum xcb_render_poly_mode_t { XCB_RENDER_POLY_MODE_PRECISE = 0, XCB_RENDER_POLY_MODE_IMPRECISE = 1 } xcb_render_poly_mode_t; typedef enum xcb_render_cp_t { XCB_RENDER_CP_REPEAT = 1, XCB_RENDER_CP_ALPHA_MAP = 2, XCB_RENDER_CP_ALPHA_X_ORIGIN = 4, XCB_RENDER_CP_ALPHA_Y_ORIGIN = 8, XCB_RENDER_CP_CLIP_X_ORIGIN = 16, XCB_RENDER_CP_CLIP_Y_ORIGIN = 32, XCB_RENDER_CP_CLIP_MASK = 64, XCB_RENDER_CP_GRAPHICS_EXPOSURE = 128, XCB_RENDER_CP_SUBWINDOW_MODE = 256, XCB_RENDER_CP_POLY_EDGE = 512, XCB_RENDER_CP_POLY_MODE = 1024, XCB_RENDER_CP_DITHER = 2048, XCB_RENDER_CP_COMPONENT_ALPHA = 4096 } xcb_render_cp_t; typedef enum xcb_render_sub_pixel_t { XCB_RENDER_SUB_PIXEL_UNKNOWN = 0, XCB_RENDER_SUB_PIXEL_HORIZONTAL_RGB = 1, XCB_RENDER_SUB_PIXEL_HORIZONTAL_BGR = 2, XCB_RENDER_SUB_PIXEL_VERTICAL_RGB = 3, XCB_RENDER_SUB_PIXEL_VERTICAL_BGR = 4, XCB_RENDER_SUB_PIXEL_NONE = 5 } xcb_render_sub_pixel_t; typedef enum xcb_render_repeat_t { XCB_RENDER_REPEAT_NONE = 0, XCB_RENDER_REPEAT_NORMAL = 1, XCB_RENDER_REPEAT_PAD = 2, XCB_RENDER_REPEAT_REFLECT = 3 } xcb_render_repeat_t; typedef uint32_t xcb_render_glyph_t; /** * @brief xcb_render_glyph_iterator_t **/ typedef struct xcb_render_glyph_iterator_t { xcb_render_glyph_t *data; int rem; int index; } xcb_render_glyph_iterator_t; typedef uint32_t xcb_render_glyphset_t; /** * @brief xcb_render_glyphset_iterator_t **/ typedef struct xcb_render_glyphset_iterator_t { xcb_render_glyphset_t *data; int rem; int index; } xcb_render_glyphset_iterator_t; typedef uint32_t xcb_render_picture_t; /** * @brief xcb_render_picture_iterator_t **/ typedef struct xcb_render_picture_iterator_t { xcb_render_picture_t *data; int rem; int index; } xcb_render_picture_iterator_t; typedef uint32_t xcb_render_pictformat_t; /** * @brief xcb_render_pictformat_iterator_t **/ typedef struct xcb_render_pictformat_iterator_t { xcb_render_pictformat_t *data; int rem; int index; } xcb_render_pictformat_iterator_t; typedef int32_t xcb_render_fixed_t; /** * @brief xcb_render_fixed_iterator_t **/ typedef struct xcb_render_fixed_iterator_t { xcb_render_fixed_t *data; int rem; int index; } xcb_render_fixed_iterator_t; /** Opcode for xcb_render_pict_format. */ #define XCB_RENDER_PICT_FORMAT 0 /** * @brief xcb_render_pict_format_error_t **/ typedef struct xcb_render_pict_format_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_render_pict_format_error_t; /** Opcode for xcb_render_picture. */ #define XCB_RENDER_PICTURE 1 /** * @brief xcb_render_picture_error_t **/ typedef struct xcb_render_picture_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_render_picture_error_t; /** Opcode for xcb_render_pict_op. */ #define XCB_RENDER_PICT_OP 2 /** * @brief xcb_render_pict_op_error_t **/ typedef struct xcb_render_pict_op_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_render_pict_op_error_t; /** Opcode for xcb_render_glyph_set. */ #define XCB_RENDER_GLYPH_SET 3 /** * @brief xcb_render_glyph_set_error_t **/ typedef struct xcb_render_glyph_set_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_render_glyph_set_error_t; /** Opcode for xcb_render_glyph. */ #define XCB_RENDER_GLYPH 4 /** * @brief xcb_render_glyph_error_t **/ typedef struct xcb_render_glyph_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_render_glyph_error_t; /** * @brief xcb_render_directformat_t **/ typedef struct xcb_render_directformat_t { uint16_t red_shift; uint16_t red_mask; uint16_t green_shift; uint16_t green_mask; uint16_t blue_shift; uint16_t blue_mask; uint16_t alpha_shift; uint16_t alpha_mask; } xcb_render_directformat_t; /** * @brief xcb_render_directformat_iterator_t **/ typedef struct xcb_render_directformat_iterator_t { xcb_render_directformat_t *data; int rem; int index; } xcb_render_directformat_iterator_t; /** * @brief xcb_render_pictforminfo_t **/ typedef struct xcb_render_pictforminfo_t { xcb_render_pictformat_t id; uint8_t type; uint8_t depth; uint8_t pad0[2]; xcb_render_directformat_t direct; xcb_colormap_t colormap; } xcb_render_pictforminfo_t; /** * @brief xcb_render_pictforminfo_iterator_t **/ typedef struct xcb_render_pictforminfo_iterator_t { xcb_render_pictforminfo_t *data; int rem; int index; } xcb_render_pictforminfo_iterator_t; /** * @brief xcb_render_pictvisual_t **/ typedef struct xcb_render_pictvisual_t { xcb_visualid_t visual; xcb_render_pictformat_t format; } xcb_render_pictvisual_t; /** * @brief xcb_render_pictvisual_iterator_t **/ typedef struct xcb_render_pictvisual_iterator_t { xcb_render_pictvisual_t *data; int rem; int index; } xcb_render_pictvisual_iterator_t; /** * @brief xcb_render_pictdepth_t **/ typedef struct xcb_render_pictdepth_t { uint8_t depth; uint8_t pad0; uint16_t num_visuals; uint8_t pad1[4]; } xcb_render_pictdepth_t; /** * @brief xcb_render_pictdepth_iterator_t **/ typedef struct xcb_render_pictdepth_iterator_t { xcb_render_pictdepth_t *data; int rem; int index; } xcb_render_pictdepth_iterator_t; /** * @brief xcb_render_pictscreen_t **/ typedef struct xcb_render_pictscreen_t { uint32_t num_depths; xcb_render_pictformat_t fallback; } xcb_render_pictscreen_t; /** * @brief xcb_render_pictscreen_iterator_t **/ typedef struct xcb_render_pictscreen_iterator_t { xcb_render_pictscreen_t *data; int rem; int index; } xcb_render_pictscreen_iterator_t; /** * @brief xcb_render_indexvalue_t **/ typedef struct xcb_render_indexvalue_t { uint32_t pixel; uint16_t red; uint16_t green; uint16_t blue; uint16_t alpha; } xcb_render_indexvalue_t; /** * @brief xcb_render_indexvalue_iterator_t **/ typedef struct xcb_render_indexvalue_iterator_t { xcb_render_indexvalue_t *data; int rem; int index; } xcb_render_indexvalue_iterator_t; /** * @brief xcb_render_color_t **/ typedef struct xcb_render_color_t { uint16_t red; uint16_t green; uint16_t blue; uint16_t alpha; } xcb_render_color_t; /** * @brief xcb_render_color_iterator_t **/ typedef struct xcb_render_color_iterator_t { xcb_render_color_t *data; int rem; int index; } xcb_render_color_iterator_t; /** * @brief xcb_render_pointfix_t **/ typedef struct xcb_render_pointfix_t { xcb_render_fixed_t x; xcb_render_fixed_t y; } xcb_render_pointfix_t; /** * @brief xcb_render_pointfix_iterator_t **/ typedef struct xcb_render_pointfix_iterator_t { xcb_render_pointfix_t *data; int rem; int index; } xcb_render_pointfix_iterator_t; /** * @brief xcb_render_linefix_t **/ typedef struct xcb_render_linefix_t { xcb_render_pointfix_t p1; xcb_render_pointfix_t p2; } xcb_render_linefix_t; /** * @brief xcb_render_linefix_iterator_t **/ typedef struct xcb_render_linefix_iterator_t { xcb_render_linefix_t *data; int rem; int index; } xcb_render_linefix_iterator_t; /** * @brief xcb_render_triangle_t **/ typedef struct xcb_render_triangle_t { xcb_render_pointfix_t p1; xcb_render_pointfix_t p2; xcb_render_pointfix_t p3; } xcb_render_triangle_t; /** * @brief xcb_render_triangle_iterator_t **/ typedef struct xcb_render_triangle_iterator_t { xcb_render_triangle_t *data; int rem; int index; } xcb_render_triangle_iterator_t; /** * @brief xcb_render_trapezoid_t **/ typedef struct xcb_render_trapezoid_t { xcb_render_fixed_t top; xcb_render_fixed_t bottom; xcb_render_linefix_t left; xcb_render_linefix_t right; } xcb_render_trapezoid_t; /** * @brief xcb_render_trapezoid_iterator_t **/ typedef struct xcb_render_trapezoid_iterator_t { xcb_render_trapezoid_t *data; int rem; int index; } xcb_render_trapezoid_iterator_t; /** * @brief xcb_render_glyphinfo_t **/ typedef struct xcb_render_glyphinfo_t { uint16_t width; uint16_t height; int16_t x; int16_t y; int16_t x_off; int16_t y_off; } xcb_render_glyphinfo_t; /** * @brief xcb_render_glyphinfo_iterator_t **/ typedef struct xcb_render_glyphinfo_iterator_t { xcb_render_glyphinfo_t *data; int rem; int index; } xcb_render_glyphinfo_iterator_t; /** * @brief xcb_render_query_version_cookie_t **/ typedef struct xcb_render_query_version_cookie_t { unsigned int sequence; } xcb_render_query_version_cookie_t; /** Opcode for xcb_render_query_version. */ #define XCB_RENDER_QUERY_VERSION 0 /** * @brief xcb_render_query_version_request_t **/ typedef struct xcb_render_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t client_major_version; uint32_t client_minor_version; } xcb_render_query_version_request_t; /** * @brief xcb_render_query_version_reply_t **/ typedef struct xcb_render_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t major_version; uint32_t minor_version; uint8_t pad1[16]; } xcb_render_query_version_reply_t; /** * @brief xcb_render_query_pict_formats_cookie_t **/ typedef struct xcb_render_query_pict_formats_cookie_t { unsigned int sequence; } xcb_render_query_pict_formats_cookie_t; /** Opcode for xcb_render_query_pict_formats. */ #define XCB_RENDER_QUERY_PICT_FORMATS 1 /** * @brief xcb_render_query_pict_formats_request_t **/ typedef struct xcb_render_query_pict_formats_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_render_query_pict_formats_request_t; /** * @brief xcb_render_query_pict_formats_reply_t **/ typedef struct xcb_render_query_pict_formats_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t num_formats; uint32_t num_screens; uint32_t num_depths; uint32_t num_visuals; uint32_t num_subpixel; uint8_t pad1[4]; } xcb_render_query_pict_formats_reply_t; /** * @brief xcb_render_query_pict_index_values_cookie_t **/ typedef struct xcb_render_query_pict_index_values_cookie_t { unsigned int sequence; } xcb_render_query_pict_index_values_cookie_t; /** Opcode for xcb_render_query_pict_index_values. */ #define XCB_RENDER_QUERY_PICT_INDEX_VALUES 2 /** * @brief xcb_render_query_pict_index_values_request_t **/ typedef struct xcb_render_query_pict_index_values_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_render_pictformat_t format; } xcb_render_query_pict_index_values_request_t; /** * @brief xcb_render_query_pict_index_values_reply_t **/ typedef struct xcb_render_query_pict_index_values_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t num_values; uint8_t pad1[20]; } xcb_render_query_pict_index_values_reply_t; /** * @brief xcb_render_create_picture_value_list_t **/ typedef struct xcb_render_create_picture_value_list_t { uint32_t repeat; xcb_render_picture_t alphamap; int32_t alphaxorigin; int32_t alphayorigin; int32_t clipxorigin; int32_t clipyorigin; xcb_pixmap_t clipmask; uint32_t graphicsexposure; uint32_t subwindowmode; uint32_t polyedge; uint32_t polymode; xcb_atom_t dither; uint32_t componentalpha; } xcb_render_create_picture_value_list_t; /** Opcode for xcb_render_create_picture. */ #define XCB_RENDER_CREATE_PICTURE 4 /** * @brief xcb_render_create_picture_request_t **/ typedef struct xcb_render_create_picture_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_render_picture_t pid; xcb_drawable_t drawable; xcb_render_pictformat_t format; uint32_t value_mask; } xcb_render_create_picture_request_t; /** * @brief xcb_render_change_picture_value_list_t **/ typedef struct xcb_render_change_picture_value_list_t { uint32_t repeat; xcb_render_picture_t alphamap; int32_t alphaxorigin; int32_t alphayorigin; int32_t clipxorigin; int32_t clipyorigin; xcb_pixmap_t clipmask; uint32_t graphicsexposure; uint32_t subwindowmode; uint32_t polyedge; uint32_t polymode; xcb_atom_t dither; uint32_t componentalpha; } xcb_render_change_picture_value_list_t; /** Opcode for xcb_render_change_picture. */ #define XCB_RENDER_CHANGE_PICTURE 5 /** * @brief xcb_render_change_picture_request_t **/ typedef struct xcb_render_change_picture_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_render_picture_t picture; uint32_t value_mask; } xcb_render_change_picture_request_t; /** Opcode for xcb_render_set_picture_clip_rectangles. */ #define XCB_RENDER_SET_PICTURE_CLIP_RECTANGLES 6 /** * @brief xcb_render_set_picture_clip_rectangles_request_t **/ typedef struct xcb_render_set_picture_clip_rectangles_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_render_picture_t picture; int16_t clip_x_origin; int16_t clip_y_origin; } xcb_render_set_picture_clip_rectangles_request_t; /** Opcode for xcb_render_free_picture. */ #define XCB_RENDER_FREE_PICTURE 7 /** * @brief xcb_render_free_picture_request_t **/ typedef struct xcb_render_free_picture_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_render_picture_t picture; } xcb_render_free_picture_request_t; /** Opcode for xcb_render_composite. */ #define XCB_RENDER_COMPOSITE 8 /** * @brief xcb_render_composite_request_t **/ typedef struct xcb_render_composite_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t op; uint8_t pad0[3]; xcb_render_picture_t src; xcb_render_picture_t mask; xcb_render_picture_t dst; int16_t src_x; int16_t src_y; int16_t mask_x; int16_t mask_y; int16_t dst_x; int16_t dst_y; uint16_t width; uint16_t height; } xcb_render_composite_request_t; /** Opcode for xcb_render_trapezoids. */ #define XCB_RENDER_TRAPEZOIDS 10 /** * @brief xcb_render_trapezoids_request_t **/ typedef struct xcb_render_trapezoids_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t op; uint8_t pad0[3]; xcb_render_picture_t src; xcb_render_picture_t dst; xcb_render_pictformat_t mask_format; int16_t src_x; int16_t src_y; } xcb_render_trapezoids_request_t; /** Opcode for xcb_render_triangles. */ #define XCB_RENDER_TRIANGLES 11 /** * @brief xcb_render_triangles_request_t **/ typedef struct xcb_render_triangles_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t op; uint8_t pad0[3]; xcb_render_picture_t src; xcb_render_picture_t dst; xcb_render_pictformat_t mask_format; int16_t src_x; int16_t src_y; } xcb_render_triangles_request_t; /** Opcode for xcb_render_tri_strip. */ #define XCB_RENDER_TRI_STRIP 12 /** * @brief xcb_render_tri_strip_request_t **/ typedef struct xcb_render_tri_strip_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t op; uint8_t pad0[3]; xcb_render_picture_t src; xcb_render_picture_t dst; xcb_render_pictformat_t mask_format; int16_t src_x; int16_t src_y; } xcb_render_tri_strip_request_t; /** Opcode for xcb_render_tri_fan. */ #define XCB_RENDER_TRI_FAN 13 /** * @brief xcb_render_tri_fan_request_t **/ typedef struct xcb_render_tri_fan_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t op; uint8_t pad0[3]; xcb_render_picture_t src; xcb_render_picture_t dst; xcb_render_pictformat_t mask_format; int16_t src_x; int16_t src_y; } xcb_render_tri_fan_request_t; /** Opcode for xcb_render_create_glyph_set. */ #define XCB_RENDER_CREATE_GLYPH_SET 17 /** * @brief xcb_render_create_glyph_set_request_t **/ typedef struct xcb_render_create_glyph_set_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_render_glyphset_t gsid; xcb_render_pictformat_t format; } xcb_render_create_glyph_set_request_t; /** Opcode for xcb_render_reference_glyph_set. */ #define XCB_RENDER_REFERENCE_GLYPH_SET 18 /** * @brief xcb_render_reference_glyph_set_request_t **/ typedef struct xcb_render_reference_glyph_set_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_render_glyphset_t gsid; xcb_render_glyphset_t existing; } xcb_render_reference_glyph_set_request_t; /** Opcode for xcb_render_free_glyph_set. */ #define XCB_RENDER_FREE_GLYPH_SET 19 /** * @brief xcb_render_free_glyph_set_request_t **/ typedef struct xcb_render_free_glyph_set_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_render_glyphset_t glyphset; } xcb_render_free_glyph_set_request_t; /** Opcode for xcb_render_add_glyphs. */ #define XCB_RENDER_ADD_GLYPHS 20 /** * @brief xcb_render_add_glyphs_request_t **/ typedef struct xcb_render_add_glyphs_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_render_glyphset_t glyphset; uint32_t glyphs_len; } xcb_render_add_glyphs_request_t; /** Opcode for xcb_render_free_glyphs. */ #define XCB_RENDER_FREE_GLYPHS 22 /** * @brief xcb_render_free_glyphs_request_t **/ typedef struct xcb_render_free_glyphs_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_render_glyphset_t glyphset; } xcb_render_free_glyphs_request_t; /** Opcode for xcb_render_composite_glyphs_8. */ #define XCB_RENDER_COMPOSITE_GLYPHS_8 23 /** * @brief xcb_render_composite_glyphs_8_request_t **/ typedef struct xcb_render_composite_glyphs_8_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t op; uint8_t pad0[3]; xcb_render_picture_t src; xcb_render_picture_t dst; xcb_render_pictformat_t mask_format; xcb_render_glyphset_t glyphset; int16_t src_x; int16_t src_y; } xcb_render_composite_glyphs_8_request_t; /** Opcode for xcb_render_composite_glyphs_16. */ #define XCB_RENDER_COMPOSITE_GLYPHS_16 24 /** * @brief xcb_render_composite_glyphs_16_request_t **/ typedef struct xcb_render_composite_glyphs_16_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t op; uint8_t pad0[3]; xcb_render_picture_t src; xcb_render_picture_t dst; xcb_render_pictformat_t mask_format; xcb_render_glyphset_t glyphset; int16_t src_x; int16_t src_y; } xcb_render_composite_glyphs_16_request_t; /** Opcode for xcb_render_composite_glyphs_32. */ #define XCB_RENDER_COMPOSITE_GLYPHS_32 25 /** * @brief xcb_render_composite_glyphs_32_request_t **/ typedef struct xcb_render_composite_glyphs_32_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t op; uint8_t pad0[3]; xcb_render_picture_t src; xcb_render_picture_t dst; xcb_render_pictformat_t mask_format; xcb_render_glyphset_t glyphset; int16_t src_x; int16_t src_y; } xcb_render_composite_glyphs_32_request_t; /** Opcode for xcb_render_fill_rectangles. */ #define XCB_RENDER_FILL_RECTANGLES 26 /** * @brief xcb_render_fill_rectangles_request_t **/ typedef struct xcb_render_fill_rectangles_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t op; uint8_t pad0[3]; xcb_render_picture_t dst; xcb_render_color_t color; } xcb_render_fill_rectangles_request_t; /** Opcode for xcb_render_create_cursor. */ #define XCB_RENDER_CREATE_CURSOR 27 /** * @brief xcb_render_create_cursor_request_t **/ typedef struct xcb_render_create_cursor_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_cursor_t cid; xcb_render_picture_t source; uint16_t x; uint16_t y; } xcb_render_create_cursor_request_t; /** * @brief xcb_render_transform_t **/ typedef struct xcb_render_transform_t { xcb_render_fixed_t matrix11; xcb_render_fixed_t matrix12; xcb_render_fixed_t matrix13; xcb_render_fixed_t matrix21; xcb_render_fixed_t matrix22; xcb_render_fixed_t matrix23; xcb_render_fixed_t matrix31; xcb_render_fixed_t matrix32; xcb_render_fixed_t matrix33; } xcb_render_transform_t; /** * @brief xcb_render_transform_iterator_t **/ typedef struct xcb_render_transform_iterator_t { xcb_render_transform_t *data; int rem; int index; } xcb_render_transform_iterator_t; /** Opcode for xcb_render_set_picture_transform. */ #define XCB_RENDER_SET_PICTURE_TRANSFORM 28 /** * @brief xcb_render_set_picture_transform_request_t **/ typedef struct xcb_render_set_picture_transform_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_render_picture_t picture; xcb_render_transform_t transform; } xcb_render_set_picture_transform_request_t; /** * @brief xcb_render_query_filters_cookie_t **/ typedef struct xcb_render_query_filters_cookie_t { unsigned int sequence; } xcb_render_query_filters_cookie_t; /** Opcode for xcb_render_query_filters. */ #define XCB_RENDER_QUERY_FILTERS 29 /** * @brief xcb_render_query_filters_request_t **/ typedef struct xcb_render_query_filters_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; } xcb_render_query_filters_request_t; /** * @brief xcb_render_query_filters_reply_t **/ typedef struct xcb_render_query_filters_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t num_aliases; uint32_t num_filters; uint8_t pad1[16]; } xcb_render_query_filters_reply_t; /** Opcode for xcb_render_set_picture_filter. */ #define XCB_RENDER_SET_PICTURE_FILTER 30 /** * @brief xcb_render_set_picture_filter_request_t **/ typedef struct xcb_render_set_picture_filter_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_render_picture_t picture; uint16_t filter_len; uint8_t pad0[2]; } xcb_render_set_picture_filter_request_t; /** * @brief xcb_render_animcursorelt_t **/ typedef struct xcb_render_animcursorelt_t { xcb_cursor_t cursor; uint32_t delay; } xcb_render_animcursorelt_t; /** * @brief xcb_render_animcursorelt_iterator_t **/ typedef struct xcb_render_animcursorelt_iterator_t { xcb_render_animcursorelt_t *data; int rem; int index; } xcb_render_animcursorelt_iterator_t; /** Opcode for xcb_render_create_anim_cursor. */ #define XCB_RENDER_CREATE_ANIM_CURSOR 31 /** * @brief xcb_render_create_anim_cursor_request_t **/ typedef struct xcb_render_create_anim_cursor_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_cursor_t cid; } xcb_render_create_anim_cursor_request_t; /** * @brief xcb_render_spanfix_t **/ typedef struct xcb_render_spanfix_t { xcb_render_fixed_t l; xcb_render_fixed_t r; xcb_render_fixed_t y; } xcb_render_spanfix_t; /** * @brief xcb_render_spanfix_iterator_t **/ typedef struct xcb_render_spanfix_iterator_t { xcb_render_spanfix_t *data; int rem; int index; } xcb_render_spanfix_iterator_t; /** * @brief xcb_render_trap_t **/ typedef struct xcb_render_trap_t { xcb_render_spanfix_t top; xcb_render_spanfix_t bot; } xcb_render_trap_t; /** * @brief xcb_render_trap_iterator_t **/ typedef struct xcb_render_trap_iterator_t { xcb_render_trap_t *data; int rem; int index; } xcb_render_trap_iterator_t; /** Opcode for xcb_render_add_traps. */ #define XCB_RENDER_ADD_TRAPS 32 /** * @brief xcb_render_add_traps_request_t **/ typedef struct xcb_render_add_traps_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_render_picture_t picture; int16_t x_off; int16_t y_off; } xcb_render_add_traps_request_t; /** Opcode for xcb_render_create_solid_fill. */ #define XCB_RENDER_CREATE_SOLID_FILL 33 /** * @brief xcb_render_create_solid_fill_request_t **/ typedef struct xcb_render_create_solid_fill_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_render_picture_t picture; xcb_render_color_t color; } xcb_render_create_solid_fill_request_t; /** Opcode for xcb_render_create_linear_gradient. */ #define XCB_RENDER_CREATE_LINEAR_GRADIENT 34 /** * @brief xcb_render_create_linear_gradient_request_t **/ typedef struct xcb_render_create_linear_gradient_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_render_picture_t picture; xcb_render_pointfix_t p1; xcb_render_pointfix_t p2; uint32_t num_stops; } xcb_render_create_linear_gradient_request_t; /** Opcode for xcb_render_create_radial_gradient. */ #define XCB_RENDER_CREATE_RADIAL_GRADIENT 35 /** * @brief xcb_render_create_radial_gradient_request_t **/ typedef struct xcb_render_create_radial_gradient_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_render_picture_t picture; xcb_render_pointfix_t inner; xcb_render_pointfix_t outer; xcb_render_fixed_t inner_radius; xcb_render_fixed_t outer_radius; uint32_t num_stops; } xcb_render_create_radial_gradient_request_t; /** Opcode for xcb_render_create_conical_gradient. */ #define XCB_RENDER_CREATE_CONICAL_GRADIENT 36 /** * @brief xcb_render_create_conical_gradient_request_t **/ typedef struct xcb_render_create_conical_gradient_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_render_picture_t picture; xcb_render_pointfix_t center; xcb_render_fixed_t angle; uint32_t num_stops; } xcb_render_create_conical_gradient_request_t; /** * Get the next element of the iterator * @param i Pointer to a xcb_render_glyph_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_glyph_t) */ void xcb_render_glyph_next (xcb_render_glyph_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_glyph_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_glyph_end (xcb_render_glyph_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_glyphset_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_glyphset_t) */ void xcb_render_glyphset_next (xcb_render_glyphset_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_glyphset_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_glyphset_end (xcb_render_glyphset_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_picture_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_picture_t) */ void xcb_render_picture_next (xcb_render_picture_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_picture_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_picture_end (xcb_render_picture_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_pictformat_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_pictformat_t) */ void xcb_render_pictformat_next (xcb_render_pictformat_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_pictformat_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_pictformat_end (xcb_render_pictformat_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_fixed_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_fixed_t) */ void xcb_render_fixed_next (xcb_render_fixed_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_fixed_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_fixed_end (xcb_render_fixed_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_directformat_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_directformat_t) */ void xcb_render_directformat_next (xcb_render_directformat_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_directformat_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_directformat_end (xcb_render_directformat_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_pictforminfo_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_pictforminfo_t) */ void xcb_render_pictforminfo_next (xcb_render_pictforminfo_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_pictforminfo_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_pictforminfo_end (xcb_render_pictforminfo_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_pictvisual_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_pictvisual_t) */ void xcb_render_pictvisual_next (xcb_render_pictvisual_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_pictvisual_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_pictvisual_end (xcb_render_pictvisual_iterator_t i); int xcb_render_pictdepth_sizeof (const void *_buffer); xcb_render_pictvisual_t * xcb_render_pictdepth_visuals (const xcb_render_pictdepth_t *R); int xcb_render_pictdepth_visuals_length (const xcb_render_pictdepth_t *R); xcb_render_pictvisual_iterator_t xcb_render_pictdepth_visuals_iterator (const xcb_render_pictdepth_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_pictdepth_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_pictdepth_t) */ void xcb_render_pictdepth_next (xcb_render_pictdepth_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_pictdepth_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_pictdepth_end (xcb_render_pictdepth_iterator_t i); int xcb_render_pictscreen_sizeof (const void *_buffer); int xcb_render_pictscreen_depths_length (const xcb_render_pictscreen_t *R); xcb_render_pictdepth_iterator_t xcb_render_pictscreen_depths_iterator (const xcb_render_pictscreen_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_pictscreen_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_pictscreen_t) */ void xcb_render_pictscreen_next (xcb_render_pictscreen_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_pictscreen_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_pictscreen_end (xcb_render_pictscreen_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_indexvalue_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_indexvalue_t) */ void xcb_render_indexvalue_next (xcb_render_indexvalue_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_indexvalue_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_indexvalue_end (xcb_render_indexvalue_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_color_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_color_t) */ void xcb_render_color_next (xcb_render_color_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_color_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_color_end (xcb_render_color_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_pointfix_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_pointfix_t) */ void xcb_render_pointfix_next (xcb_render_pointfix_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_pointfix_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_pointfix_end (xcb_render_pointfix_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_linefix_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_linefix_t) */ void xcb_render_linefix_next (xcb_render_linefix_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_linefix_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_linefix_end (xcb_render_linefix_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_triangle_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_triangle_t) */ void xcb_render_triangle_next (xcb_render_triangle_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_triangle_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_triangle_end (xcb_render_triangle_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_trapezoid_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_trapezoid_t) */ void xcb_render_trapezoid_next (xcb_render_trapezoid_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_trapezoid_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_trapezoid_end (xcb_render_trapezoid_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_glyphinfo_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_glyphinfo_t) */ void xcb_render_glyphinfo_next (xcb_render_glyphinfo_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_glyphinfo_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_glyphinfo_end (xcb_render_glyphinfo_iterator_t i); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_render_query_version_cookie_t xcb_render_query_version (xcb_connection_t *c, uint32_t client_major_version, uint32_t client_minor_version); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_render_query_version_cookie_t xcb_render_query_version_unchecked (xcb_connection_t *c, uint32_t client_major_version, uint32_t client_minor_version); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_render_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_render_query_version_reply_t * xcb_render_query_version_reply (xcb_connection_t *c, xcb_render_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_render_query_pict_formats_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_render_query_pict_formats_cookie_t xcb_render_query_pict_formats (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_render_query_pict_formats_cookie_t xcb_render_query_pict_formats_unchecked (xcb_connection_t *c); xcb_render_pictforminfo_t * xcb_render_query_pict_formats_formats (const xcb_render_query_pict_formats_reply_t *R); int xcb_render_query_pict_formats_formats_length (const xcb_render_query_pict_formats_reply_t *R); xcb_render_pictforminfo_iterator_t xcb_render_query_pict_formats_formats_iterator (const xcb_render_query_pict_formats_reply_t *R); int xcb_render_query_pict_formats_screens_length (const xcb_render_query_pict_formats_reply_t *R); xcb_render_pictscreen_iterator_t xcb_render_query_pict_formats_screens_iterator (const xcb_render_query_pict_formats_reply_t *R); uint32_t * xcb_render_query_pict_formats_subpixels (const xcb_render_query_pict_formats_reply_t *R); int xcb_render_query_pict_formats_subpixels_length (const xcb_render_query_pict_formats_reply_t *R); xcb_generic_iterator_t xcb_render_query_pict_formats_subpixels_end (const xcb_render_query_pict_formats_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_render_query_pict_formats_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_render_query_pict_formats_reply_t * xcb_render_query_pict_formats_reply (xcb_connection_t *c, xcb_render_query_pict_formats_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_render_query_pict_index_values_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_render_query_pict_index_values_cookie_t xcb_render_query_pict_index_values (xcb_connection_t *c, xcb_render_pictformat_t format); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_render_query_pict_index_values_cookie_t xcb_render_query_pict_index_values_unchecked (xcb_connection_t *c, xcb_render_pictformat_t format); xcb_render_indexvalue_t * xcb_render_query_pict_index_values_values (const xcb_render_query_pict_index_values_reply_t *R); int xcb_render_query_pict_index_values_values_length (const xcb_render_query_pict_index_values_reply_t *R); xcb_render_indexvalue_iterator_t xcb_render_query_pict_index_values_values_iterator (const xcb_render_query_pict_index_values_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_render_query_pict_index_values_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_render_query_pict_index_values_reply_t * xcb_render_query_pict_index_values_reply (xcb_connection_t *c, xcb_render_query_pict_index_values_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_render_create_picture_value_list_serialize (void **_buffer, uint32_t value_mask, const xcb_render_create_picture_value_list_t *_aux); int xcb_render_create_picture_value_list_unpack (const void *_buffer, uint32_t value_mask, xcb_render_create_picture_value_list_t *_aux); int xcb_render_create_picture_value_list_sizeof (const void *_buffer, uint32_t value_mask); int xcb_render_create_picture_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_create_picture_checked (xcb_connection_t *c, xcb_render_picture_t pid, xcb_drawable_t drawable, xcb_render_pictformat_t format, uint32_t value_mask, const void *value_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_create_picture (xcb_connection_t *c, xcb_render_picture_t pid, xcb_drawable_t drawable, xcb_render_pictformat_t format, uint32_t value_mask, const void *value_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_create_picture_aux_checked (xcb_connection_t *c, xcb_render_picture_t pid, xcb_drawable_t drawable, xcb_render_pictformat_t format, uint32_t value_mask, const xcb_render_create_picture_value_list_t *value_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_create_picture_aux (xcb_connection_t *c, xcb_render_picture_t pid, xcb_drawable_t drawable, xcb_render_pictformat_t format, uint32_t value_mask, const xcb_render_create_picture_value_list_t *value_list); void * xcb_render_create_picture_value_list (const xcb_render_create_picture_request_t *R); int xcb_render_change_picture_value_list_serialize (void **_buffer, uint32_t value_mask, const xcb_render_change_picture_value_list_t *_aux); int xcb_render_change_picture_value_list_unpack (const void *_buffer, uint32_t value_mask, xcb_render_change_picture_value_list_t *_aux); int xcb_render_change_picture_value_list_sizeof (const void *_buffer, uint32_t value_mask); int xcb_render_change_picture_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_change_picture_checked (xcb_connection_t *c, xcb_render_picture_t picture, uint32_t value_mask, const void *value_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_change_picture (xcb_connection_t *c, xcb_render_picture_t picture, uint32_t value_mask, const void *value_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_change_picture_aux_checked (xcb_connection_t *c, xcb_render_picture_t picture, uint32_t value_mask, const xcb_render_change_picture_value_list_t *value_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_change_picture_aux (xcb_connection_t *c, xcb_render_picture_t picture, uint32_t value_mask, const xcb_render_change_picture_value_list_t *value_list); void * xcb_render_change_picture_value_list (const xcb_render_change_picture_request_t *R); int xcb_render_set_picture_clip_rectangles_sizeof (const void *_buffer, uint32_t rectangles_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_set_picture_clip_rectangles_checked (xcb_connection_t *c, xcb_render_picture_t picture, int16_t clip_x_origin, int16_t clip_y_origin, uint32_t rectangles_len, const xcb_rectangle_t *rectangles); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_set_picture_clip_rectangles (xcb_connection_t *c, xcb_render_picture_t picture, int16_t clip_x_origin, int16_t clip_y_origin, uint32_t rectangles_len, const xcb_rectangle_t *rectangles); xcb_rectangle_t * xcb_render_set_picture_clip_rectangles_rectangles (const xcb_render_set_picture_clip_rectangles_request_t *R); int xcb_render_set_picture_clip_rectangles_rectangles_length (const xcb_render_set_picture_clip_rectangles_request_t *R); xcb_rectangle_iterator_t xcb_render_set_picture_clip_rectangles_rectangles_iterator (const xcb_render_set_picture_clip_rectangles_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_free_picture_checked (xcb_connection_t *c, xcb_render_picture_t picture); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_free_picture (xcb_connection_t *c, xcb_render_picture_t picture); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_composite_checked (xcb_connection_t *c, uint8_t op, xcb_render_picture_t src, xcb_render_picture_t mask, xcb_render_picture_t dst, int16_t src_x, int16_t src_y, int16_t mask_x, int16_t mask_y, int16_t dst_x, int16_t dst_y, uint16_t width, uint16_t height); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_composite (xcb_connection_t *c, uint8_t op, xcb_render_picture_t src, xcb_render_picture_t mask, xcb_render_picture_t dst, int16_t src_x, int16_t src_y, int16_t mask_x, int16_t mask_y, int16_t dst_x, int16_t dst_y, uint16_t width, uint16_t height); int xcb_render_trapezoids_sizeof (const void *_buffer, uint32_t traps_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_trapezoids_checked (xcb_connection_t *c, uint8_t op, xcb_render_picture_t src, xcb_render_picture_t dst, xcb_render_pictformat_t mask_format, int16_t src_x, int16_t src_y, uint32_t traps_len, const xcb_render_trapezoid_t *traps); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_trapezoids (xcb_connection_t *c, uint8_t op, xcb_render_picture_t src, xcb_render_picture_t dst, xcb_render_pictformat_t mask_format, int16_t src_x, int16_t src_y, uint32_t traps_len, const xcb_render_trapezoid_t *traps); xcb_render_trapezoid_t * xcb_render_trapezoids_traps (const xcb_render_trapezoids_request_t *R); int xcb_render_trapezoids_traps_length (const xcb_render_trapezoids_request_t *R); xcb_render_trapezoid_iterator_t xcb_render_trapezoids_traps_iterator (const xcb_render_trapezoids_request_t *R); int xcb_render_triangles_sizeof (const void *_buffer, uint32_t triangles_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_triangles_checked (xcb_connection_t *c, uint8_t op, xcb_render_picture_t src, xcb_render_picture_t dst, xcb_render_pictformat_t mask_format, int16_t src_x, int16_t src_y, uint32_t triangles_len, const xcb_render_triangle_t *triangles); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_triangles (xcb_connection_t *c, uint8_t op, xcb_render_picture_t src, xcb_render_picture_t dst, xcb_render_pictformat_t mask_format, int16_t src_x, int16_t src_y, uint32_t triangles_len, const xcb_render_triangle_t *triangles); xcb_render_triangle_t * xcb_render_triangles_triangles (const xcb_render_triangles_request_t *R); int xcb_render_triangles_triangles_length (const xcb_render_triangles_request_t *R); xcb_render_triangle_iterator_t xcb_render_triangles_triangles_iterator (const xcb_render_triangles_request_t *R); int xcb_render_tri_strip_sizeof (const void *_buffer, uint32_t points_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_tri_strip_checked (xcb_connection_t *c, uint8_t op, xcb_render_picture_t src, xcb_render_picture_t dst, xcb_render_pictformat_t mask_format, int16_t src_x, int16_t src_y, uint32_t points_len, const xcb_render_pointfix_t *points); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_tri_strip (xcb_connection_t *c, uint8_t op, xcb_render_picture_t src, xcb_render_picture_t dst, xcb_render_pictformat_t mask_format, int16_t src_x, int16_t src_y, uint32_t points_len, const xcb_render_pointfix_t *points); xcb_render_pointfix_t * xcb_render_tri_strip_points (const xcb_render_tri_strip_request_t *R); int xcb_render_tri_strip_points_length (const xcb_render_tri_strip_request_t *R); xcb_render_pointfix_iterator_t xcb_render_tri_strip_points_iterator (const xcb_render_tri_strip_request_t *R); int xcb_render_tri_fan_sizeof (const void *_buffer, uint32_t points_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_tri_fan_checked (xcb_connection_t *c, uint8_t op, xcb_render_picture_t src, xcb_render_picture_t dst, xcb_render_pictformat_t mask_format, int16_t src_x, int16_t src_y, uint32_t points_len, const xcb_render_pointfix_t *points); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_tri_fan (xcb_connection_t *c, uint8_t op, xcb_render_picture_t src, xcb_render_picture_t dst, xcb_render_pictformat_t mask_format, int16_t src_x, int16_t src_y, uint32_t points_len, const xcb_render_pointfix_t *points); xcb_render_pointfix_t * xcb_render_tri_fan_points (const xcb_render_tri_fan_request_t *R); int xcb_render_tri_fan_points_length (const xcb_render_tri_fan_request_t *R); xcb_render_pointfix_iterator_t xcb_render_tri_fan_points_iterator (const xcb_render_tri_fan_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_create_glyph_set_checked (xcb_connection_t *c, xcb_render_glyphset_t gsid, xcb_render_pictformat_t format); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_create_glyph_set (xcb_connection_t *c, xcb_render_glyphset_t gsid, xcb_render_pictformat_t format); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_reference_glyph_set_checked (xcb_connection_t *c, xcb_render_glyphset_t gsid, xcb_render_glyphset_t existing); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_reference_glyph_set (xcb_connection_t *c, xcb_render_glyphset_t gsid, xcb_render_glyphset_t existing); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_free_glyph_set_checked (xcb_connection_t *c, xcb_render_glyphset_t glyphset); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_free_glyph_set (xcb_connection_t *c, xcb_render_glyphset_t glyphset); int xcb_render_add_glyphs_sizeof (const void *_buffer, uint32_t data_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_add_glyphs_checked (xcb_connection_t *c, xcb_render_glyphset_t glyphset, uint32_t glyphs_len, const uint32_t *glyphids, const xcb_render_glyphinfo_t *glyphs, uint32_t data_len, const uint8_t *data); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_add_glyphs (xcb_connection_t *c, xcb_render_glyphset_t glyphset, uint32_t glyphs_len, const uint32_t *glyphids, const xcb_render_glyphinfo_t *glyphs, uint32_t data_len, const uint8_t *data); uint32_t * xcb_render_add_glyphs_glyphids (const xcb_render_add_glyphs_request_t *R); int xcb_render_add_glyphs_glyphids_length (const xcb_render_add_glyphs_request_t *R); xcb_generic_iterator_t xcb_render_add_glyphs_glyphids_end (const xcb_render_add_glyphs_request_t *R); xcb_render_glyphinfo_t * xcb_render_add_glyphs_glyphs (const xcb_render_add_glyphs_request_t *R); int xcb_render_add_glyphs_glyphs_length (const xcb_render_add_glyphs_request_t *R); xcb_render_glyphinfo_iterator_t xcb_render_add_glyphs_glyphs_iterator (const xcb_render_add_glyphs_request_t *R); uint8_t * xcb_render_add_glyphs_data (const xcb_render_add_glyphs_request_t *R); int xcb_render_add_glyphs_data_length (const xcb_render_add_glyphs_request_t *R); xcb_generic_iterator_t xcb_render_add_glyphs_data_end (const xcb_render_add_glyphs_request_t *R); int xcb_render_free_glyphs_sizeof (const void *_buffer, uint32_t glyphs_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_free_glyphs_checked (xcb_connection_t *c, xcb_render_glyphset_t glyphset, uint32_t glyphs_len, const xcb_render_glyph_t *glyphs); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_free_glyphs (xcb_connection_t *c, xcb_render_glyphset_t glyphset, uint32_t glyphs_len, const xcb_render_glyph_t *glyphs); xcb_render_glyph_t * xcb_render_free_glyphs_glyphs (const xcb_render_free_glyphs_request_t *R); int xcb_render_free_glyphs_glyphs_length (const xcb_render_free_glyphs_request_t *R); xcb_generic_iterator_t xcb_render_free_glyphs_glyphs_end (const xcb_render_free_glyphs_request_t *R); int xcb_render_composite_glyphs_8_sizeof (const void *_buffer, uint32_t glyphcmds_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_composite_glyphs_8_checked (xcb_connection_t *c, uint8_t op, xcb_render_picture_t src, xcb_render_picture_t dst, xcb_render_pictformat_t mask_format, xcb_render_glyphset_t glyphset, int16_t src_x, int16_t src_y, uint32_t glyphcmds_len, const uint8_t *glyphcmds); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_composite_glyphs_8 (xcb_connection_t *c, uint8_t op, xcb_render_picture_t src, xcb_render_picture_t dst, xcb_render_pictformat_t mask_format, xcb_render_glyphset_t glyphset, int16_t src_x, int16_t src_y, uint32_t glyphcmds_len, const uint8_t *glyphcmds); uint8_t * xcb_render_composite_glyphs_8_glyphcmds (const xcb_render_composite_glyphs_8_request_t *R); int xcb_render_composite_glyphs_8_glyphcmds_length (const xcb_render_composite_glyphs_8_request_t *R); xcb_generic_iterator_t xcb_render_composite_glyphs_8_glyphcmds_end (const xcb_render_composite_glyphs_8_request_t *R); int xcb_render_composite_glyphs_16_sizeof (const void *_buffer, uint32_t glyphcmds_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_composite_glyphs_16_checked (xcb_connection_t *c, uint8_t op, xcb_render_picture_t src, xcb_render_picture_t dst, xcb_render_pictformat_t mask_format, xcb_render_glyphset_t glyphset, int16_t src_x, int16_t src_y, uint32_t glyphcmds_len, const uint8_t *glyphcmds); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_composite_glyphs_16 (xcb_connection_t *c, uint8_t op, xcb_render_picture_t src, xcb_render_picture_t dst, xcb_render_pictformat_t mask_format, xcb_render_glyphset_t glyphset, int16_t src_x, int16_t src_y, uint32_t glyphcmds_len, const uint8_t *glyphcmds); uint8_t * xcb_render_composite_glyphs_16_glyphcmds (const xcb_render_composite_glyphs_16_request_t *R); int xcb_render_composite_glyphs_16_glyphcmds_length (const xcb_render_composite_glyphs_16_request_t *R); xcb_generic_iterator_t xcb_render_composite_glyphs_16_glyphcmds_end (const xcb_render_composite_glyphs_16_request_t *R); int xcb_render_composite_glyphs_32_sizeof (const void *_buffer, uint32_t glyphcmds_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_composite_glyphs_32_checked (xcb_connection_t *c, uint8_t op, xcb_render_picture_t src, xcb_render_picture_t dst, xcb_render_pictformat_t mask_format, xcb_render_glyphset_t glyphset, int16_t src_x, int16_t src_y, uint32_t glyphcmds_len, const uint8_t *glyphcmds); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_composite_glyphs_32 (xcb_connection_t *c, uint8_t op, xcb_render_picture_t src, xcb_render_picture_t dst, xcb_render_pictformat_t mask_format, xcb_render_glyphset_t glyphset, int16_t src_x, int16_t src_y, uint32_t glyphcmds_len, const uint8_t *glyphcmds); uint8_t * xcb_render_composite_glyphs_32_glyphcmds (const xcb_render_composite_glyphs_32_request_t *R); int xcb_render_composite_glyphs_32_glyphcmds_length (const xcb_render_composite_glyphs_32_request_t *R); xcb_generic_iterator_t xcb_render_composite_glyphs_32_glyphcmds_end (const xcb_render_composite_glyphs_32_request_t *R); int xcb_render_fill_rectangles_sizeof (const void *_buffer, uint32_t rects_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_fill_rectangles_checked (xcb_connection_t *c, uint8_t op, xcb_render_picture_t dst, xcb_render_color_t color, uint32_t rects_len, const xcb_rectangle_t *rects); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_fill_rectangles (xcb_connection_t *c, uint8_t op, xcb_render_picture_t dst, xcb_render_color_t color, uint32_t rects_len, const xcb_rectangle_t *rects); xcb_rectangle_t * xcb_render_fill_rectangles_rects (const xcb_render_fill_rectangles_request_t *R); int xcb_render_fill_rectangles_rects_length (const xcb_render_fill_rectangles_request_t *R); xcb_rectangle_iterator_t xcb_render_fill_rectangles_rects_iterator (const xcb_render_fill_rectangles_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_create_cursor_checked (xcb_connection_t *c, xcb_cursor_t cid, xcb_render_picture_t source, uint16_t x, uint16_t y); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_create_cursor (xcb_connection_t *c, xcb_cursor_t cid, xcb_render_picture_t source, uint16_t x, uint16_t y); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_transform_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_transform_t) */ void xcb_render_transform_next (xcb_render_transform_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_transform_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_transform_end (xcb_render_transform_iterator_t i); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_set_picture_transform_checked (xcb_connection_t *c, xcb_render_picture_t picture, xcb_render_transform_t transform); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_set_picture_transform (xcb_connection_t *c, xcb_render_picture_t picture, xcb_render_transform_t transform); int xcb_render_query_filters_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_render_query_filters_cookie_t xcb_render_query_filters (xcb_connection_t *c, xcb_drawable_t drawable); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_render_query_filters_cookie_t xcb_render_query_filters_unchecked (xcb_connection_t *c, xcb_drawable_t drawable); uint16_t * xcb_render_query_filters_aliases (const xcb_render_query_filters_reply_t *R); int xcb_render_query_filters_aliases_length (const xcb_render_query_filters_reply_t *R); xcb_generic_iterator_t xcb_render_query_filters_aliases_end (const xcb_render_query_filters_reply_t *R); int xcb_render_query_filters_filters_length (const xcb_render_query_filters_reply_t *R); xcb_str_iterator_t xcb_render_query_filters_filters_iterator (const xcb_render_query_filters_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_render_query_filters_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_render_query_filters_reply_t * xcb_render_query_filters_reply (xcb_connection_t *c, xcb_render_query_filters_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_render_set_picture_filter_sizeof (const void *_buffer, uint32_t values_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_set_picture_filter_checked (xcb_connection_t *c, xcb_render_picture_t picture, uint16_t filter_len, const char *filter, uint32_t values_len, const xcb_render_fixed_t *values); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_set_picture_filter (xcb_connection_t *c, xcb_render_picture_t picture, uint16_t filter_len, const char *filter, uint32_t values_len, const xcb_render_fixed_t *values); char * xcb_render_set_picture_filter_filter (const xcb_render_set_picture_filter_request_t *R); int xcb_render_set_picture_filter_filter_length (const xcb_render_set_picture_filter_request_t *R); xcb_generic_iterator_t xcb_render_set_picture_filter_filter_end (const xcb_render_set_picture_filter_request_t *R); xcb_render_fixed_t * xcb_render_set_picture_filter_values (const xcb_render_set_picture_filter_request_t *R); int xcb_render_set_picture_filter_values_length (const xcb_render_set_picture_filter_request_t *R); xcb_generic_iterator_t xcb_render_set_picture_filter_values_end (const xcb_render_set_picture_filter_request_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_animcursorelt_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_animcursorelt_t) */ void xcb_render_animcursorelt_next (xcb_render_animcursorelt_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_animcursorelt_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_animcursorelt_end (xcb_render_animcursorelt_iterator_t i); int xcb_render_create_anim_cursor_sizeof (const void *_buffer, uint32_t cursors_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_create_anim_cursor_checked (xcb_connection_t *c, xcb_cursor_t cid, uint32_t cursors_len, const xcb_render_animcursorelt_t *cursors); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_create_anim_cursor (xcb_connection_t *c, xcb_cursor_t cid, uint32_t cursors_len, const xcb_render_animcursorelt_t *cursors); xcb_render_animcursorelt_t * xcb_render_create_anim_cursor_cursors (const xcb_render_create_anim_cursor_request_t *R); int xcb_render_create_anim_cursor_cursors_length (const xcb_render_create_anim_cursor_request_t *R); xcb_render_animcursorelt_iterator_t xcb_render_create_anim_cursor_cursors_iterator (const xcb_render_create_anim_cursor_request_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_spanfix_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_spanfix_t) */ void xcb_render_spanfix_next (xcb_render_spanfix_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_spanfix_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_spanfix_end (xcb_render_spanfix_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_render_trap_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_render_trap_t) */ void xcb_render_trap_next (xcb_render_trap_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_render_trap_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_render_trap_end (xcb_render_trap_iterator_t i); int xcb_render_add_traps_sizeof (const void *_buffer, uint32_t traps_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_add_traps_checked (xcb_connection_t *c, xcb_render_picture_t picture, int16_t x_off, int16_t y_off, uint32_t traps_len, const xcb_render_trap_t *traps); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_add_traps (xcb_connection_t *c, xcb_render_picture_t picture, int16_t x_off, int16_t y_off, uint32_t traps_len, const xcb_render_trap_t *traps); xcb_render_trap_t * xcb_render_add_traps_traps (const xcb_render_add_traps_request_t *R); int xcb_render_add_traps_traps_length (const xcb_render_add_traps_request_t *R); xcb_render_trap_iterator_t xcb_render_add_traps_traps_iterator (const xcb_render_add_traps_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_create_solid_fill_checked (xcb_connection_t *c, xcb_render_picture_t picture, xcb_render_color_t color); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_create_solid_fill (xcb_connection_t *c, xcb_render_picture_t picture, xcb_render_color_t color); int xcb_render_create_linear_gradient_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_create_linear_gradient_checked (xcb_connection_t *c, xcb_render_picture_t picture, xcb_render_pointfix_t p1, xcb_render_pointfix_t p2, uint32_t num_stops, const xcb_render_fixed_t *stops, const xcb_render_color_t *colors); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_create_linear_gradient (xcb_connection_t *c, xcb_render_picture_t picture, xcb_render_pointfix_t p1, xcb_render_pointfix_t p2, uint32_t num_stops, const xcb_render_fixed_t *stops, const xcb_render_color_t *colors); xcb_render_fixed_t * xcb_render_create_linear_gradient_stops (const xcb_render_create_linear_gradient_request_t *R); int xcb_render_create_linear_gradient_stops_length (const xcb_render_create_linear_gradient_request_t *R); xcb_generic_iterator_t xcb_render_create_linear_gradient_stops_end (const xcb_render_create_linear_gradient_request_t *R); xcb_render_color_t * xcb_render_create_linear_gradient_colors (const xcb_render_create_linear_gradient_request_t *R); int xcb_render_create_linear_gradient_colors_length (const xcb_render_create_linear_gradient_request_t *R); xcb_render_color_iterator_t xcb_render_create_linear_gradient_colors_iterator (const xcb_render_create_linear_gradient_request_t *R); int xcb_render_create_radial_gradient_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_create_radial_gradient_checked (xcb_connection_t *c, xcb_render_picture_t picture, xcb_render_pointfix_t inner, xcb_render_pointfix_t outer, xcb_render_fixed_t inner_radius, xcb_render_fixed_t outer_radius, uint32_t num_stops, const xcb_render_fixed_t *stops, const xcb_render_color_t *colors); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_create_radial_gradient (xcb_connection_t *c, xcb_render_picture_t picture, xcb_render_pointfix_t inner, xcb_render_pointfix_t outer, xcb_render_fixed_t inner_radius, xcb_render_fixed_t outer_radius, uint32_t num_stops, const xcb_render_fixed_t *stops, const xcb_render_color_t *colors); xcb_render_fixed_t * xcb_render_create_radial_gradient_stops (const xcb_render_create_radial_gradient_request_t *R); int xcb_render_create_radial_gradient_stops_length (const xcb_render_create_radial_gradient_request_t *R); xcb_generic_iterator_t xcb_render_create_radial_gradient_stops_end (const xcb_render_create_radial_gradient_request_t *R); xcb_render_color_t * xcb_render_create_radial_gradient_colors (const xcb_render_create_radial_gradient_request_t *R); int xcb_render_create_radial_gradient_colors_length (const xcb_render_create_radial_gradient_request_t *R); xcb_render_color_iterator_t xcb_render_create_radial_gradient_colors_iterator (const xcb_render_create_radial_gradient_request_t *R); int xcb_render_create_conical_gradient_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_render_create_conical_gradient_checked (xcb_connection_t *c, xcb_render_picture_t picture, xcb_render_pointfix_t center, xcb_render_fixed_t angle, uint32_t num_stops, const xcb_render_fixed_t *stops, const xcb_render_color_t *colors); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_render_create_conical_gradient (xcb_connection_t *c, xcb_render_picture_t picture, xcb_render_pointfix_t center, xcb_render_fixed_t angle, uint32_t num_stops, const xcb_render_fixed_t *stops, const xcb_render_color_t *colors); xcb_render_fixed_t * xcb_render_create_conical_gradient_stops (const xcb_render_create_conical_gradient_request_t *R); int xcb_render_create_conical_gradient_stops_length (const xcb_render_create_conical_gradient_request_t *R); xcb_generic_iterator_t xcb_render_create_conical_gradient_stops_end (const xcb_render_create_conical_gradient_request_t *R); xcb_render_color_t * xcb_render_create_conical_gradient_colors (const xcb_render_create_conical_gradient_request_t *R); int xcb_render_create_conical_gradient_colors_length (const xcb_render_create_conical_gradient_request_t *R); xcb_render_color_iterator_t xcb_render_create_conical_gradient_colors_iterator (const xcb_render_create_conical_gradient_request_t *R); #ifdef __cplusplus } #endif #endif /** * @} */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/glx.h�������������������������������������������������������������������������������������������0000644�����������������00000755622�14763166026�0006317 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from glx.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_Glx_API XCB Glx API * @brief Glx XCB Protocol Implementation. * @{ **/ #ifndef __GLX_H #define __GLX_H #include "xcb.h" #include "xproto.h" #ifdef __cplusplus extern "C" { #endif #define XCB_GLX_MAJOR_VERSION 1 #define XCB_GLX_MINOR_VERSION 4 extern xcb_extension_t xcb_glx_id; typedef uint32_t xcb_glx_pixmap_t; /** * @brief xcb_glx_pixmap_iterator_t **/ typedef struct xcb_glx_pixmap_iterator_t { xcb_glx_pixmap_t *data; int rem; int index; } xcb_glx_pixmap_iterator_t; typedef uint32_t xcb_glx_context_t; /** * @brief xcb_glx_context_iterator_t **/ typedef struct xcb_glx_context_iterator_t { xcb_glx_context_t *data; int rem; int index; } xcb_glx_context_iterator_t; typedef uint32_t xcb_glx_pbuffer_t; /** * @brief xcb_glx_pbuffer_iterator_t **/ typedef struct xcb_glx_pbuffer_iterator_t { xcb_glx_pbuffer_t *data; int rem; int index; } xcb_glx_pbuffer_iterator_t; typedef uint32_t xcb_glx_window_t; /** * @brief xcb_glx_window_iterator_t **/ typedef struct xcb_glx_window_iterator_t { xcb_glx_window_t *data; int rem; int index; } xcb_glx_window_iterator_t; typedef uint32_t xcb_glx_fbconfig_t; /** * @brief xcb_glx_fbconfig_iterator_t **/ typedef struct xcb_glx_fbconfig_iterator_t { xcb_glx_fbconfig_t *data; int rem; int index; } xcb_glx_fbconfig_iterator_t; typedef uint32_t xcb_glx_drawable_t; /** * @brief xcb_glx_drawable_iterator_t **/ typedef struct xcb_glx_drawable_iterator_t { xcb_glx_drawable_t *data; int rem; int index; } xcb_glx_drawable_iterator_t; typedef float xcb_glx_float32_t; /** * @brief xcb_glx_float32_iterator_t **/ typedef struct xcb_glx_float32_iterator_t { xcb_glx_float32_t *data; int rem; int index; } xcb_glx_float32_iterator_t; typedef double xcb_glx_float64_t; /** * @brief xcb_glx_float64_iterator_t **/ typedef struct xcb_glx_float64_iterator_t { xcb_glx_float64_t *data; int rem; int index; } xcb_glx_float64_iterator_t; typedef uint32_t xcb_glx_bool32_t; /** * @brief xcb_glx_bool32_iterator_t **/ typedef struct xcb_glx_bool32_iterator_t { xcb_glx_bool32_t *data; int rem; int index; } xcb_glx_bool32_iterator_t; typedef uint32_t xcb_glx_context_tag_t; /** * @brief xcb_glx_context_tag_iterator_t **/ typedef struct xcb_glx_context_tag_iterator_t { xcb_glx_context_tag_t *data; int rem; int index; } xcb_glx_context_tag_iterator_t; /** Opcode for xcb_glx_generic. */ #define XCB_GLX_GENERIC -1 /** * @brief xcb_glx_generic_error_t **/ typedef struct xcb_glx_generic_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; uint32_t bad_value; uint16_t minor_opcode; uint8_t major_opcode; uint8_t pad0[21]; } xcb_glx_generic_error_t; /** Opcode for xcb_glx_bad_context. */ #define XCB_GLX_BAD_CONTEXT 0 typedef xcb_glx_generic_error_t xcb_glx_bad_context_error_t; /** Opcode for xcb_glx_bad_context_state. */ #define XCB_GLX_BAD_CONTEXT_STATE 1 typedef xcb_glx_generic_error_t xcb_glx_bad_context_state_error_t; /** Opcode for xcb_glx_bad_drawable. */ #define XCB_GLX_BAD_DRAWABLE 2 typedef xcb_glx_generic_error_t xcb_glx_bad_drawable_error_t; /** Opcode for xcb_glx_bad_pixmap. */ #define XCB_GLX_BAD_PIXMAP 3 typedef xcb_glx_generic_error_t xcb_glx_bad_pixmap_error_t; /** Opcode for xcb_glx_bad_context_tag. */ #define XCB_GLX_BAD_CONTEXT_TAG 4 typedef xcb_glx_generic_error_t xcb_glx_bad_context_tag_error_t; /** Opcode for xcb_glx_bad_current_window. */ #define XCB_GLX_BAD_CURRENT_WINDOW 5 typedef xcb_glx_generic_error_t xcb_glx_bad_current_window_error_t; /** Opcode for xcb_glx_bad_render_request. */ #define XCB_GLX_BAD_RENDER_REQUEST 6 typedef xcb_glx_generic_error_t xcb_glx_bad_render_request_error_t; /** Opcode for xcb_glx_bad_large_request. */ #define XCB_GLX_BAD_LARGE_REQUEST 7 typedef xcb_glx_generic_error_t xcb_glx_bad_large_request_error_t; /** Opcode for xcb_glx_unsupported_private_request. */ #define XCB_GLX_UNSUPPORTED_PRIVATE_REQUEST 8 typedef xcb_glx_generic_error_t xcb_glx_unsupported_private_request_error_t; /** Opcode for xcb_glx_bad_fb_config. */ #define XCB_GLX_BAD_FB_CONFIG 9 typedef xcb_glx_generic_error_t xcb_glx_bad_fb_config_error_t; /** Opcode for xcb_glx_bad_pbuffer. */ #define XCB_GLX_BAD_PBUFFER 10 typedef xcb_glx_generic_error_t xcb_glx_bad_pbuffer_error_t; /** Opcode for xcb_glx_bad_current_drawable. */ #define XCB_GLX_BAD_CURRENT_DRAWABLE 11 typedef xcb_glx_generic_error_t xcb_glx_bad_current_drawable_error_t; /** Opcode for xcb_glx_bad_window. */ #define XCB_GLX_BAD_WINDOW 12 typedef xcb_glx_generic_error_t xcb_glx_bad_window_error_t; /** Opcode for xcb_glx_glx_bad_profile_arb. */ #define XCB_GLX_GLX_BAD_PROFILE_ARB 13 typedef xcb_glx_generic_error_t xcb_glx_glx_bad_profile_arb_error_t; /** Opcode for xcb_glx_pbuffer_clobber. */ #define XCB_GLX_PBUFFER_CLOBBER 0 /** * @brief xcb_glx_pbuffer_clobber_event_t **/ typedef struct xcb_glx_pbuffer_clobber_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint16_t event_type; uint16_t draw_type; xcb_glx_drawable_t drawable; uint32_t b_mask; uint16_t aux_buffer; uint16_t x; uint16_t y; uint16_t width; uint16_t height; uint16_t count; uint8_t pad1[4]; } xcb_glx_pbuffer_clobber_event_t; /** Opcode for xcb_glx_buffer_swap_complete. */ #define XCB_GLX_BUFFER_SWAP_COMPLETE 1 /** * @brief xcb_glx_buffer_swap_complete_event_t **/ typedef struct xcb_glx_buffer_swap_complete_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint16_t event_type; uint8_t pad1[2]; xcb_glx_drawable_t drawable; uint32_t ust_hi; uint32_t ust_lo; uint32_t msc_hi; uint32_t msc_lo; uint32_t sbc; } xcb_glx_buffer_swap_complete_event_t; typedef enum xcb_glx_pbcet_t { XCB_GLX_PBCET_DAMAGED = 32791, XCB_GLX_PBCET_SAVED = 32792 } xcb_glx_pbcet_t; typedef enum xcb_glx_pbcdt_t { XCB_GLX_PBCDT_WINDOW = 32793, XCB_GLX_PBCDT_PBUFFER = 32794 } xcb_glx_pbcdt_t; /** Opcode for xcb_glx_render. */ #define XCB_GLX_RENDER 1 /** * @brief xcb_glx_render_request_t **/ typedef struct xcb_glx_render_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; } xcb_glx_render_request_t; /** Opcode for xcb_glx_render_large. */ #define XCB_GLX_RENDER_LARGE 2 /** * @brief xcb_glx_render_large_request_t **/ typedef struct xcb_glx_render_large_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint16_t request_num; uint16_t request_total; uint32_t data_len; } xcb_glx_render_large_request_t; /** Opcode for xcb_glx_create_context. */ #define XCB_GLX_CREATE_CONTEXT 3 /** * @brief xcb_glx_create_context_request_t **/ typedef struct xcb_glx_create_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_t context; xcb_visualid_t visual; uint32_t screen; xcb_glx_context_t share_list; uint8_t is_direct; uint8_t pad0[3]; } xcb_glx_create_context_request_t; /** Opcode for xcb_glx_destroy_context. */ #define XCB_GLX_DESTROY_CONTEXT 4 /** * @brief xcb_glx_destroy_context_request_t **/ typedef struct xcb_glx_destroy_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_t context; } xcb_glx_destroy_context_request_t; /** * @brief xcb_glx_make_current_cookie_t **/ typedef struct xcb_glx_make_current_cookie_t { unsigned int sequence; } xcb_glx_make_current_cookie_t; /** Opcode for xcb_glx_make_current. */ #define XCB_GLX_MAKE_CURRENT 5 /** * @brief xcb_glx_make_current_request_t **/ typedef struct xcb_glx_make_current_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_drawable_t drawable; xcb_glx_context_t context; xcb_glx_context_tag_t old_context_tag; } xcb_glx_make_current_request_t; /** * @brief xcb_glx_make_current_reply_t **/ typedef struct xcb_glx_make_current_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_glx_context_tag_t context_tag; uint8_t pad1[20]; } xcb_glx_make_current_reply_t; /** * @brief xcb_glx_is_direct_cookie_t **/ typedef struct xcb_glx_is_direct_cookie_t { unsigned int sequence; } xcb_glx_is_direct_cookie_t; /** Opcode for xcb_glx_is_direct. */ #define XCB_GLX_IS_DIRECT 6 /** * @brief xcb_glx_is_direct_request_t **/ typedef struct xcb_glx_is_direct_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_t context; } xcb_glx_is_direct_request_t; /** * @brief xcb_glx_is_direct_reply_t **/ typedef struct xcb_glx_is_direct_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t is_direct; uint8_t pad1[23]; } xcb_glx_is_direct_reply_t; /** * @brief xcb_glx_query_version_cookie_t **/ typedef struct xcb_glx_query_version_cookie_t { unsigned int sequence; } xcb_glx_query_version_cookie_t; /** Opcode for xcb_glx_query_version. */ #define XCB_GLX_QUERY_VERSION 7 /** * @brief xcb_glx_query_version_request_t **/ typedef struct xcb_glx_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t major_version; uint32_t minor_version; } xcb_glx_query_version_request_t; /** * @brief xcb_glx_query_version_reply_t **/ typedef struct xcb_glx_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t major_version; uint32_t minor_version; uint8_t pad1[16]; } xcb_glx_query_version_reply_t; /** Opcode for xcb_glx_wait_gl. */ #define XCB_GLX_WAIT_GL 8 /** * @brief xcb_glx_wait_gl_request_t **/ typedef struct xcb_glx_wait_gl_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; } xcb_glx_wait_gl_request_t; /** Opcode for xcb_glx_wait_x. */ #define XCB_GLX_WAIT_X 9 /** * @brief xcb_glx_wait_x_request_t **/ typedef struct xcb_glx_wait_x_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; } xcb_glx_wait_x_request_t; /** Opcode for xcb_glx_copy_context. */ #define XCB_GLX_COPY_CONTEXT 10 /** * @brief xcb_glx_copy_context_request_t **/ typedef struct xcb_glx_copy_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_t src; xcb_glx_context_t dest; uint32_t mask; xcb_glx_context_tag_t src_context_tag; } xcb_glx_copy_context_request_t; typedef enum xcb_glx_gc_t { XCB_GLX_GC_GL_CURRENT_BIT = 1, XCB_GLX_GC_GL_POINT_BIT = 2, XCB_GLX_GC_GL_LINE_BIT = 4, XCB_GLX_GC_GL_POLYGON_BIT = 8, XCB_GLX_GC_GL_POLYGON_STIPPLE_BIT = 16, XCB_GLX_GC_GL_PIXEL_MODE_BIT = 32, XCB_GLX_GC_GL_LIGHTING_BIT = 64, XCB_GLX_GC_GL_FOG_BIT = 128, XCB_GLX_GC_GL_DEPTH_BUFFER_BIT = 256, XCB_GLX_GC_GL_ACCUM_BUFFER_BIT = 512, XCB_GLX_GC_GL_STENCIL_BUFFER_BIT = 1024, XCB_GLX_GC_GL_VIEWPORT_BIT = 2048, XCB_GLX_GC_GL_TRANSFORM_BIT = 4096, XCB_GLX_GC_GL_ENABLE_BIT = 8192, XCB_GLX_GC_GL_COLOR_BUFFER_BIT = 16384, XCB_GLX_GC_GL_HINT_BIT = 32768, XCB_GLX_GC_GL_EVAL_BIT = 65536, XCB_GLX_GC_GL_LIST_BIT = 131072, XCB_GLX_GC_GL_TEXTURE_BIT = 262144, XCB_GLX_GC_GL_SCISSOR_BIT = 524288, XCB_GLX_GC_GL_ALL_ATTRIB_BITS = 16777215 } xcb_glx_gc_t; /** Opcode for xcb_glx_swap_buffers. */ #define XCB_GLX_SWAP_BUFFERS 11 /** * @brief xcb_glx_swap_buffers_request_t **/ typedef struct xcb_glx_swap_buffers_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; xcb_glx_drawable_t drawable; } xcb_glx_swap_buffers_request_t; /** Opcode for xcb_glx_use_x_font. */ #define XCB_GLX_USE_X_FONT 12 /** * @brief xcb_glx_use_x_font_request_t **/ typedef struct xcb_glx_use_x_font_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; xcb_font_t font; uint32_t first; uint32_t count; uint32_t list_base; } xcb_glx_use_x_font_request_t; /** Opcode for xcb_glx_create_glx_pixmap. */ #define XCB_GLX_CREATE_GLX_PIXMAP 13 /** * @brief xcb_glx_create_glx_pixmap_request_t **/ typedef struct xcb_glx_create_glx_pixmap_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; xcb_visualid_t visual; xcb_pixmap_t pixmap; xcb_glx_pixmap_t glx_pixmap; } xcb_glx_create_glx_pixmap_request_t; /** * @brief xcb_glx_get_visual_configs_cookie_t **/ typedef struct xcb_glx_get_visual_configs_cookie_t { unsigned int sequence; } xcb_glx_get_visual_configs_cookie_t; /** Opcode for xcb_glx_get_visual_configs. */ #define XCB_GLX_GET_VISUAL_CONFIGS 14 /** * @brief xcb_glx_get_visual_configs_request_t **/ typedef struct xcb_glx_get_visual_configs_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; } xcb_glx_get_visual_configs_request_t; /** * @brief xcb_glx_get_visual_configs_reply_t **/ typedef struct xcb_glx_get_visual_configs_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t num_visuals; uint32_t num_properties; uint8_t pad1[16]; } xcb_glx_get_visual_configs_reply_t; /** Opcode for xcb_glx_destroy_glx_pixmap. */ #define XCB_GLX_DESTROY_GLX_PIXMAP 15 /** * @brief xcb_glx_destroy_glx_pixmap_request_t **/ typedef struct xcb_glx_destroy_glx_pixmap_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_pixmap_t glx_pixmap; } xcb_glx_destroy_glx_pixmap_request_t; /** Opcode for xcb_glx_vendor_private. */ #define XCB_GLX_VENDOR_PRIVATE 16 /** * @brief xcb_glx_vendor_private_request_t **/ typedef struct xcb_glx_vendor_private_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t vendor_code; xcb_glx_context_tag_t context_tag; } xcb_glx_vendor_private_request_t; /** * @brief xcb_glx_vendor_private_with_reply_cookie_t **/ typedef struct xcb_glx_vendor_private_with_reply_cookie_t { unsigned int sequence; } xcb_glx_vendor_private_with_reply_cookie_t; /** Opcode for xcb_glx_vendor_private_with_reply. */ #define XCB_GLX_VENDOR_PRIVATE_WITH_REPLY 17 /** * @brief xcb_glx_vendor_private_with_reply_request_t **/ typedef struct xcb_glx_vendor_private_with_reply_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t vendor_code; xcb_glx_context_tag_t context_tag; } xcb_glx_vendor_private_with_reply_request_t; /** * @brief xcb_glx_vendor_private_with_reply_reply_t **/ typedef struct xcb_glx_vendor_private_with_reply_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t retval; uint8_t data1[24]; } xcb_glx_vendor_private_with_reply_reply_t; /** * @brief xcb_glx_query_extensions_string_cookie_t **/ typedef struct xcb_glx_query_extensions_string_cookie_t { unsigned int sequence; } xcb_glx_query_extensions_string_cookie_t; /** Opcode for xcb_glx_query_extensions_string. */ #define XCB_GLX_QUERY_EXTENSIONS_STRING 18 /** * @brief xcb_glx_query_extensions_string_request_t **/ typedef struct xcb_glx_query_extensions_string_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; } xcb_glx_query_extensions_string_request_t; /** * @brief xcb_glx_query_extensions_string_reply_t **/ typedef struct xcb_glx_query_extensions_string_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; uint8_t pad2[16]; } xcb_glx_query_extensions_string_reply_t; /** * @brief xcb_glx_query_server_string_cookie_t **/ typedef struct xcb_glx_query_server_string_cookie_t { unsigned int sequence; } xcb_glx_query_server_string_cookie_t; /** Opcode for xcb_glx_query_server_string. */ #define XCB_GLX_QUERY_SERVER_STRING 19 /** * @brief xcb_glx_query_server_string_request_t **/ typedef struct xcb_glx_query_server_string_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; uint32_t name; } xcb_glx_query_server_string_request_t; /** * @brief xcb_glx_query_server_string_reply_t **/ typedef struct xcb_glx_query_server_string_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t str_len; uint8_t pad2[16]; } xcb_glx_query_server_string_reply_t; /** Opcode for xcb_glx_client_info. */ #define XCB_GLX_CLIENT_INFO 20 /** * @brief xcb_glx_client_info_request_t **/ typedef struct xcb_glx_client_info_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t major_version; uint32_t minor_version; uint32_t str_len; } xcb_glx_client_info_request_t; /** * @brief xcb_glx_get_fb_configs_cookie_t **/ typedef struct xcb_glx_get_fb_configs_cookie_t { unsigned int sequence; } xcb_glx_get_fb_configs_cookie_t; /** Opcode for xcb_glx_get_fb_configs. */ #define XCB_GLX_GET_FB_CONFIGS 21 /** * @brief xcb_glx_get_fb_configs_request_t **/ typedef struct xcb_glx_get_fb_configs_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; } xcb_glx_get_fb_configs_request_t; /** * @brief xcb_glx_get_fb_configs_reply_t **/ typedef struct xcb_glx_get_fb_configs_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t num_FB_configs; uint32_t num_properties; uint8_t pad1[16]; } xcb_glx_get_fb_configs_reply_t; /** Opcode for xcb_glx_create_pixmap. */ #define XCB_GLX_CREATE_PIXMAP 22 /** * @brief xcb_glx_create_pixmap_request_t **/ typedef struct xcb_glx_create_pixmap_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; xcb_glx_fbconfig_t fbconfig; xcb_pixmap_t pixmap; xcb_glx_pixmap_t glx_pixmap; uint32_t num_attribs; } xcb_glx_create_pixmap_request_t; /** Opcode for xcb_glx_destroy_pixmap. */ #define XCB_GLX_DESTROY_PIXMAP 23 /** * @brief xcb_glx_destroy_pixmap_request_t **/ typedef struct xcb_glx_destroy_pixmap_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_pixmap_t glx_pixmap; } xcb_glx_destroy_pixmap_request_t; /** Opcode for xcb_glx_create_new_context. */ #define XCB_GLX_CREATE_NEW_CONTEXT 24 /** * @brief xcb_glx_create_new_context_request_t **/ typedef struct xcb_glx_create_new_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_t context; xcb_glx_fbconfig_t fbconfig; uint32_t screen; uint32_t render_type; xcb_glx_context_t share_list; uint8_t is_direct; uint8_t pad0[3]; } xcb_glx_create_new_context_request_t; /** * @brief xcb_glx_query_context_cookie_t **/ typedef struct xcb_glx_query_context_cookie_t { unsigned int sequence; } xcb_glx_query_context_cookie_t; /** Opcode for xcb_glx_query_context. */ #define XCB_GLX_QUERY_CONTEXT 25 /** * @brief xcb_glx_query_context_request_t **/ typedef struct xcb_glx_query_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_t context; } xcb_glx_query_context_request_t; /** * @brief xcb_glx_query_context_reply_t **/ typedef struct xcb_glx_query_context_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t num_attribs; uint8_t pad1[20]; } xcb_glx_query_context_reply_t; /** * @brief xcb_glx_make_context_current_cookie_t **/ typedef struct xcb_glx_make_context_current_cookie_t { unsigned int sequence; } xcb_glx_make_context_current_cookie_t; /** Opcode for xcb_glx_make_context_current. */ #define XCB_GLX_MAKE_CONTEXT_CURRENT 26 /** * @brief xcb_glx_make_context_current_request_t **/ typedef struct xcb_glx_make_context_current_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t old_context_tag; xcb_glx_drawable_t drawable; xcb_glx_drawable_t read_drawable; xcb_glx_context_t context; } xcb_glx_make_context_current_request_t; /** * @brief xcb_glx_make_context_current_reply_t **/ typedef struct xcb_glx_make_context_current_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_glx_context_tag_t context_tag; uint8_t pad1[20]; } xcb_glx_make_context_current_reply_t; /** Opcode for xcb_glx_create_pbuffer. */ #define XCB_GLX_CREATE_PBUFFER 27 /** * @brief xcb_glx_create_pbuffer_request_t **/ typedef struct xcb_glx_create_pbuffer_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; xcb_glx_fbconfig_t fbconfig; xcb_glx_pbuffer_t pbuffer; uint32_t num_attribs; } xcb_glx_create_pbuffer_request_t; /** Opcode for xcb_glx_destroy_pbuffer. */ #define XCB_GLX_DESTROY_PBUFFER 28 /** * @brief xcb_glx_destroy_pbuffer_request_t **/ typedef struct xcb_glx_destroy_pbuffer_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_pbuffer_t pbuffer; } xcb_glx_destroy_pbuffer_request_t; /** * @brief xcb_glx_get_drawable_attributes_cookie_t **/ typedef struct xcb_glx_get_drawable_attributes_cookie_t { unsigned int sequence; } xcb_glx_get_drawable_attributes_cookie_t; /** Opcode for xcb_glx_get_drawable_attributes. */ #define XCB_GLX_GET_DRAWABLE_ATTRIBUTES 29 /** * @brief xcb_glx_get_drawable_attributes_request_t **/ typedef struct xcb_glx_get_drawable_attributes_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_drawable_t drawable; } xcb_glx_get_drawable_attributes_request_t; /** * @brief xcb_glx_get_drawable_attributes_reply_t **/ typedef struct xcb_glx_get_drawable_attributes_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t num_attribs; uint8_t pad1[20]; } xcb_glx_get_drawable_attributes_reply_t; /** Opcode for xcb_glx_change_drawable_attributes. */ #define XCB_GLX_CHANGE_DRAWABLE_ATTRIBUTES 30 /** * @brief xcb_glx_change_drawable_attributes_request_t **/ typedef struct xcb_glx_change_drawable_attributes_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_drawable_t drawable; uint32_t num_attribs; } xcb_glx_change_drawable_attributes_request_t; /** Opcode for xcb_glx_create_window. */ #define XCB_GLX_CREATE_WINDOW 31 /** * @brief xcb_glx_create_window_request_t **/ typedef struct xcb_glx_create_window_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; xcb_glx_fbconfig_t fbconfig; xcb_window_t window; xcb_glx_window_t glx_window; uint32_t num_attribs; } xcb_glx_create_window_request_t; /** Opcode for xcb_glx_delete_window. */ #define XCB_GLX_DELETE_WINDOW 32 /** * @brief xcb_glx_delete_window_request_t **/ typedef struct xcb_glx_delete_window_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_window_t glxwindow; } xcb_glx_delete_window_request_t; /** Opcode for xcb_glx_set_client_info_arb. */ #define XCB_GLX_SET_CLIENT_INFO_ARB 33 /** * @brief xcb_glx_set_client_info_arb_request_t **/ typedef struct xcb_glx_set_client_info_arb_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t major_version; uint32_t minor_version; uint32_t num_versions; uint32_t gl_str_len; uint32_t glx_str_len; } xcb_glx_set_client_info_arb_request_t; /** Opcode for xcb_glx_create_context_attribs_arb. */ #define XCB_GLX_CREATE_CONTEXT_ATTRIBS_ARB 34 /** * @brief xcb_glx_create_context_attribs_arb_request_t **/ typedef struct xcb_glx_create_context_attribs_arb_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_t context; xcb_glx_fbconfig_t fbconfig; uint32_t screen; xcb_glx_context_t share_list; uint8_t is_direct; uint8_t pad0[3]; uint32_t num_attribs; } xcb_glx_create_context_attribs_arb_request_t; /** Opcode for xcb_glx_set_client_info_2arb. */ #define XCB_GLX_SET_CLIENT_INFO_2ARB 35 /** * @brief xcb_glx_set_client_info_2arb_request_t **/ typedef struct xcb_glx_set_client_info_2arb_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t major_version; uint32_t minor_version; uint32_t num_versions; uint32_t gl_str_len; uint32_t glx_str_len; } xcb_glx_set_client_info_2arb_request_t; /** Opcode for xcb_glx_new_list. */ #define XCB_GLX_NEW_LIST 101 /** * @brief xcb_glx_new_list_request_t **/ typedef struct xcb_glx_new_list_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t list; uint32_t mode; } xcb_glx_new_list_request_t; /** Opcode for xcb_glx_end_list. */ #define XCB_GLX_END_LIST 102 /** * @brief xcb_glx_end_list_request_t **/ typedef struct xcb_glx_end_list_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; } xcb_glx_end_list_request_t; /** Opcode for xcb_glx_delete_lists. */ #define XCB_GLX_DELETE_LISTS 103 /** * @brief xcb_glx_delete_lists_request_t **/ typedef struct xcb_glx_delete_lists_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t list; int32_t range; } xcb_glx_delete_lists_request_t; /** * @brief xcb_glx_gen_lists_cookie_t **/ typedef struct xcb_glx_gen_lists_cookie_t { unsigned int sequence; } xcb_glx_gen_lists_cookie_t; /** Opcode for xcb_glx_gen_lists. */ #define XCB_GLX_GEN_LISTS 104 /** * @brief xcb_glx_gen_lists_request_t **/ typedef struct xcb_glx_gen_lists_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; int32_t range; } xcb_glx_gen_lists_request_t; /** * @brief xcb_glx_gen_lists_reply_t **/ typedef struct xcb_glx_gen_lists_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t ret_val; } xcb_glx_gen_lists_reply_t; /** Opcode for xcb_glx_feedback_buffer. */ #define XCB_GLX_FEEDBACK_BUFFER 105 /** * @brief xcb_glx_feedback_buffer_request_t **/ typedef struct xcb_glx_feedback_buffer_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; int32_t size; int32_t type; } xcb_glx_feedback_buffer_request_t; /** Opcode for xcb_glx_select_buffer. */ #define XCB_GLX_SELECT_BUFFER 106 /** * @brief xcb_glx_select_buffer_request_t **/ typedef struct xcb_glx_select_buffer_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; int32_t size; } xcb_glx_select_buffer_request_t; /** * @brief xcb_glx_render_mode_cookie_t **/ typedef struct xcb_glx_render_mode_cookie_t { unsigned int sequence; } xcb_glx_render_mode_cookie_t; /** Opcode for xcb_glx_render_mode. */ #define XCB_GLX_RENDER_MODE 107 /** * @brief xcb_glx_render_mode_request_t **/ typedef struct xcb_glx_render_mode_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t mode; } xcb_glx_render_mode_request_t; /** * @brief xcb_glx_render_mode_reply_t **/ typedef struct xcb_glx_render_mode_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t ret_val; uint32_t n; uint32_t new_mode; uint8_t pad1[12]; } xcb_glx_render_mode_reply_t; typedef enum xcb_glx_rm_t { XCB_GLX_RM_GL_RENDER = 7168, XCB_GLX_RM_GL_FEEDBACK = 7169, XCB_GLX_RM_GL_SELECT = 7170 } xcb_glx_rm_t; /** * @brief xcb_glx_finish_cookie_t **/ typedef struct xcb_glx_finish_cookie_t { unsigned int sequence; } xcb_glx_finish_cookie_t; /** Opcode for xcb_glx_finish. */ #define XCB_GLX_FINISH 108 /** * @brief xcb_glx_finish_request_t **/ typedef struct xcb_glx_finish_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; } xcb_glx_finish_request_t; /** * @brief xcb_glx_finish_reply_t **/ typedef struct xcb_glx_finish_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; } xcb_glx_finish_reply_t; /** Opcode for xcb_glx_pixel_storef. */ #define XCB_GLX_PIXEL_STOREF 109 /** * @brief xcb_glx_pixel_storef_request_t **/ typedef struct xcb_glx_pixel_storef_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t pname; xcb_glx_float32_t datum; } xcb_glx_pixel_storef_request_t; /** Opcode for xcb_glx_pixel_storei. */ #define XCB_GLX_PIXEL_STOREI 110 /** * @brief xcb_glx_pixel_storei_request_t **/ typedef struct xcb_glx_pixel_storei_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t pname; int32_t datum; } xcb_glx_pixel_storei_request_t; /** * @brief xcb_glx_read_pixels_cookie_t **/ typedef struct xcb_glx_read_pixels_cookie_t { unsigned int sequence; } xcb_glx_read_pixels_cookie_t; /** Opcode for xcb_glx_read_pixels. */ #define XCB_GLX_READ_PIXELS 111 /** * @brief xcb_glx_read_pixels_request_t **/ typedef struct xcb_glx_read_pixels_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; int32_t x; int32_t y; int32_t width; int32_t height; uint32_t format; uint32_t type; uint8_t swap_bytes; uint8_t lsb_first; } xcb_glx_read_pixels_request_t; /** * @brief xcb_glx_read_pixels_reply_t **/ typedef struct xcb_glx_read_pixels_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[24]; } xcb_glx_read_pixels_reply_t; /** * @brief xcb_glx_get_booleanv_cookie_t **/ typedef struct xcb_glx_get_booleanv_cookie_t { unsigned int sequence; } xcb_glx_get_booleanv_cookie_t; /** Opcode for xcb_glx_get_booleanv. */ #define XCB_GLX_GET_BOOLEANV 112 /** * @brief xcb_glx_get_booleanv_request_t **/ typedef struct xcb_glx_get_booleanv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; int32_t pname; } xcb_glx_get_booleanv_request_t; /** * @brief xcb_glx_get_booleanv_reply_t **/ typedef struct xcb_glx_get_booleanv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; uint8_t datum; uint8_t pad2[15]; } xcb_glx_get_booleanv_reply_t; /** * @brief xcb_glx_get_clip_plane_cookie_t **/ typedef struct xcb_glx_get_clip_plane_cookie_t { unsigned int sequence; } xcb_glx_get_clip_plane_cookie_t; /** Opcode for xcb_glx_get_clip_plane. */ #define XCB_GLX_GET_CLIP_PLANE 113 /** * @brief xcb_glx_get_clip_plane_request_t **/ typedef struct xcb_glx_get_clip_plane_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; int32_t plane; } xcb_glx_get_clip_plane_request_t; /** * @brief xcb_glx_get_clip_plane_reply_t **/ typedef struct xcb_glx_get_clip_plane_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[24]; } xcb_glx_get_clip_plane_reply_t; /** * @brief xcb_glx_get_doublev_cookie_t **/ typedef struct xcb_glx_get_doublev_cookie_t { unsigned int sequence; } xcb_glx_get_doublev_cookie_t; /** Opcode for xcb_glx_get_doublev. */ #define XCB_GLX_GET_DOUBLEV 114 /** * @brief xcb_glx_get_doublev_request_t **/ typedef struct xcb_glx_get_doublev_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t pname; } xcb_glx_get_doublev_request_t; /** * @brief xcb_glx_get_doublev_reply_t **/ typedef struct xcb_glx_get_doublev_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; xcb_glx_float64_t datum; uint8_t pad2[8]; } xcb_glx_get_doublev_reply_t; /** * @brief xcb_glx_get_error_cookie_t **/ typedef struct xcb_glx_get_error_cookie_t { unsigned int sequence; } xcb_glx_get_error_cookie_t; /** Opcode for xcb_glx_get_error. */ #define XCB_GLX_GET_ERROR 115 /** * @brief xcb_glx_get_error_request_t **/ typedef struct xcb_glx_get_error_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; } xcb_glx_get_error_request_t; /** * @brief xcb_glx_get_error_reply_t **/ typedef struct xcb_glx_get_error_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; int32_t error; } xcb_glx_get_error_reply_t; /** * @brief xcb_glx_get_floatv_cookie_t **/ typedef struct xcb_glx_get_floatv_cookie_t { unsigned int sequence; } xcb_glx_get_floatv_cookie_t; /** Opcode for xcb_glx_get_floatv. */ #define XCB_GLX_GET_FLOATV 116 /** * @brief xcb_glx_get_floatv_request_t **/ typedef struct xcb_glx_get_floatv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t pname; } xcb_glx_get_floatv_request_t; /** * @brief xcb_glx_get_floatv_reply_t **/ typedef struct xcb_glx_get_floatv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; xcb_glx_float32_t datum; uint8_t pad2[12]; } xcb_glx_get_floatv_reply_t; /** * @brief xcb_glx_get_integerv_cookie_t **/ typedef struct xcb_glx_get_integerv_cookie_t { unsigned int sequence; } xcb_glx_get_integerv_cookie_t; /** Opcode for xcb_glx_get_integerv. */ #define XCB_GLX_GET_INTEGERV 117 /** * @brief xcb_glx_get_integerv_request_t **/ typedef struct xcb_glx_get_integerv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t pname; } xcb_glx_get_integerv_request_t; /** * @brief xcb_glx_get_integerv_reply_t **/ typedef struct xcb_glx_get_integerv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; int32_t datum; uint8_t pad2[12]; } xcb_glx_get_integerv_reply_t; /** * @brief xcb_glx_get_lightfv_cookie_t **/ typedef struct xcb_glx_get_lightfv_cookie_t { unsigned int sequence; } xcb_glx_get_lightfv_cookie_t; /** Opcode for xcb_glx_get_lightfv. */ #define XCB_GLX_GET_LIGHTFV 118 /** * @brief xcb_glx_get_lightfv_request_t **/ typedef struct xcb_glx_get_lightfv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t light; uint32_t pname; } xcb_glx_get_lightfv_request_t; /** * @brief xcb_glx_get_lightfv_reply_t **/ typedef struct xcb_glx_get_lightfv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; xcb_glx_float32_t datum; uint8_t pad2[12]; } xcb_glx_get_lightfv_reply_t; /** * @brief xcb_glx_get_lightiv_cookie_t **/ typedef struct xcb_glx_get_lightiv_cookie_t { unsigned int sequence; } xcb_glx_get_lightiv_cookie_t; /** Opcode for xcb_glx_get_lightiv. */ #define XCB_GLX_GET_LIGHTIV 119 /** * @brief xcb_glx_get_lightiv_request_t **/ typedef struct xcb_glx_get_lightiv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t light; uint32_t pname; } xcb_glx_get_lightiv_request_t; /** * @brief xcb_glx_get_lightiv_reply_t **/ typedef struct xcb_glx_get_lightiv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; int32_t datum; uint8_t pad2[12]; } xcb_glx_get_lightiv_reply_t; /** * @brief xcb_glx_get_mapdv_cookie_t **/ typedef struct xcb_glx_get_mapdv_cookie_t { unsigned int sequence; } xcb_glx_get_mapdv_cookie_t; /** Opcode for xcb_glx_get_mapdv. */ #define XCB_GLX_GET_MAPDV 120 /** * @brief xcb_glx_get_mapdv_request_t **/ typedef struct xcb_glx_get_mapdv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t query; } xcb_glx_get_mapdv_request_t; /** * @brief xcb_glx_get_mapdv_reply_t **/ typedef struct xcb_glx_get_mapdv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; xcb_glx_float64_t datum; uint8_t pad2[8]; } xcb_glx_get_mapdv_reply_t; /** * @brief xcb_glx_get_mapfv_cookie_t **/ typedef struct xcb_glx_get_mapfv_cookie_t { unsigned int sequence; } xcb_glx_get_mapfv_cookie_t; /** Opcode for xcb_glx_get_mapfv. */ #define XCB_GLX_GET_MAPFV 121 /** * @brief xcb_glx_get_mapfv_request_t **/ typedef struct xcb_glx_get_mapfv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t query; } xcb_glx_get_mapfv_request_t; /** * @brief xcb_glx_get_mapfv_reply_t **/ typedef struct xcb_glx_get_mapfv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; xcb_glx_float32_t datum; uint8_t pad2[12]; } xcb_glx_get_mapfv_reply_t; /** * @brief xcb_glx_get_mapiv_cookie_t **/ typedef struct xcb_glx_get_mapiv_cookie_t { unsigned int sequence; } xcb_glx_get_mapiv_cookie_t; /** Opcode for xcb_glx_get_mapiv. */ #define XCB_GLX_GET_MAPIV 122 /** * @brief xcb_glx_get_mapiv_request_t **/ typedef struct xcb_glx_get_mapiv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t query; } xcb_glx_get_mapiv_request_t; /** * @brief xcb_glx_get_mapiv_reply_t **/ typedef struct xcb_glx_get_mapiv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; int32_t datum; uint8_t pad2[12]; } xcb_glx_get_mapiv_reply_t; /** * @brief xcb_glx_get_materialfv_cookie_t **/ typedef struct xcb_glx_get_materialfv_cookie_t { unsigned int sequence; } xcb_glx_get_materialfv_cookie_t; /** Opcode for xcb_glx_get_materialfv. */ #define XCB_GLX_GET_MATERIALFV 123 /** * @brief xcb_glx_get_materialfv_request_t **/ typedef struct xcb_glx_get_materialfv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t face; uint32_t pname; } xcb_glx_get_materialfv_request_t; /** * @brief xcb_glx_get_materialfv_reply_t **/ typedef struct xcb_glx_get_materialfv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; xcb_glx_float32_t datum; uint8_t pad2[12]; } xcb_glx_get_materialfv_reply_t; /** * @brief xcb_glx_get_materialiv_cookie_t **/ typedef struct xcb_glx_get_materialiv_cookie_t { unsigned int sequence; } xcb_glx_get_materialiv_cookie_t; /** Opcode for xcb_glx_get_materialiv. */ #define XCB_GLX_GET_MATERIALIV 124 /** * @brief xcb_glx_get_materialiv_request_t **/ typedef struct xcb_glx_get_materialiv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t face; uint32_t pname; } xcb_glx_get_materialiv_request_t; /** * @brief xcb_glx_get_materialiv_reply_t **/ typedef struct xcb_glx_get_materialiv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; int32_t datum; uint8_t pad2[12]; } xcb_glx_get_materialiv_reply_t; /** * @brief xcb_glx_get_pixel_mapfv_cookie_t **/ typedef struct xcb_glx_get_pixel_mapfv_cookie_t { unsigned int sequence; } xcb_glx_get_pixel_mapfv_cookie_t; /** Opcode for xcb_glx_get_pixel_mapfv. */ #define XCB_GLX_GET_PIXEL_MAPFV 125 /** * @brief xcb_glx_get_pixel_mapfv_request_t **/ typedef struct xcb_glx_get_pixel_mapfv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t map; } xcb_glx_get_pixel_mapfv_request_t; /** * @brief xcb_glx_get_pixel_mapfv_reply_t **/ typedef struct xcb_glx_get_pixel_mapfv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; xcb_glx_float32_t datum; uint8_t pad2[12]; } xcb_glx_get_pixel_mapfv_reply_t; /** * @brief xcb_glx_get_pixel_mapuiv_cookie_t **/ typedef struct xcb_glx_get_pixel_mapuiv_cookie_t { unsigned int sequence; } xcb_glx_get_pixel_mapuiv_cookie_t; /** Opcode for xcb_glx_get_pixel_mapuiv. */ #define XCB_GLX_GET_PIXEL_MAPUIV 126 /** * @brief xcb_glx_get_pixel_mapuiv_request_t **/ typedef struct xcb_glx_get_pixel_mapuiv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t map; } xcb_glx_get_pixel_mapuiv_request_t; /** * @brief xcb_glx_get_pixel_mapuiv_reply_t **/ typedef struct xcb_glx_get_pixel_mapuiv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; uint32_t datum; uint8_t pad2[12]; } xcb_glx_get_pixel_mapuiv_reply_t; /** * @brief xcb_glx_get_pixel_mapusv_cookie_t **/ typedef struct xcb_glx_get_pixel_mapusv_cookie_t { unsigned int sequence; } xcb_glx_get_pixel_mapusv_cookie_t; /** Opcode for xcb_glx_get_pixel_mapusv. */ #define XCB_GLX_GET_PIXEL_MAPUSV 127 /** * @brief xcb_glx_get_pixel_mapusv_request_t **/ typedef struct xcb_glx_get_pixel_mapusv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t map; } xcb_glx_get_pixel_mapusv_request_t; /** * @brief xcb_glx_get_pixel_mapusv_reply_t **/ typedef struct xcb_glx_get_pixel_mapusv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; uint16_t datum; uint8_t pad2[16]; } xcb_glx_get_pixel_mapusv_reply_t; /** * @brief xcb_glx_get_polygon_stipple_cookie_t **/ typedef struct xcb_glx_get_polygon_stipple_cookie_t { unsigned int sequence; } xcb_glx_get_polygon_stipple_cookie_t; /** Opcode for xcb_glx_get_polygon_stipple. */ #define XCB_GLX_GET_POLYGON_STIPPLE 128 /** * @brief xcb_glx_get_polygon_stipple_request_t **/ typedef struct xcb_glx_get_polygon_stipple_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint8_t lsb_first; } xcb_glx_get_polygon_stipple_request_t; /** * @brief xcb_glx_get_polygon_stipple_reply_t **/ typedef struct xcb_glx_get_polygon_stipple_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[24]; } xcb_glx_get_polygon_stipple_reply_t; /** * @brief xcb_glx_get_string_cookie_t **/ typedef struct xcb_glx_get_string_cookie_t { unsigned int sequence; } xcb_glx_get_string_cookie_t; /** Opcode for xcb_glx_get_string. */ #define XCB_GLX_GET_STRING 129 /** * @brief xcb_glx_get_string_request_t **/ typedef struct xcb_glx_get_string_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t name; } xcb_glx_get_string_request_t; /** * @brief xcb_glx_get_string_reply_t **/ typedef struct xcb_glx_get_string_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; uint8_t pad2[16]; } xcb_glx_get_string_reply_t; /** * @brief xcb_glx_get_tex_envfv_cookie_t **/ typedef struct xcb_glx_get_tex_envfv_cookie_t { unsigned int sequence; } xcb_glx_get_tex_envfv_cookie_t; /** Opcode for xcb_glx_get_tex_envfv. */ #define XCB_GLX_GET_TEX_ENVFV 130 /** * @brief xcb_glx_get_tex_envfv_request_t **/ typedef struct xcb_glx_get_tex_envfv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t pname; } xcb_glx_get_tex_envfv_request_t; /** * @brief xcb_glx_get_tex_envfv_reply_t **/ typedef struct xcb_glx_get_tex_envfv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; xcb_glx_float32_t datum; uint8_t pad2[12]; } xcb_glx_get_tex_envfv_reply_t; /** * @brief xcb_glx_get_tex_enviv_cookie_t **/ typedef struct xcb_glx_get_tex_enviv_cookie_t { unsigned int sequence; } xcb_glx_get_tex_enviv_cookie_t; /** Opcode for xcb_glx_get_tex_enviv. */ #define XCB_GLX_GET_TEX_ENVIV 131 /** * @brief xcb_glx_get_tex_enviv_request_t **/ typedef struct xcb_glx_get_tex_enviv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t pname; } xcb_glx_get_tex_enviv_request_t; /** * @brief xcb_glx_get_tex_enviv_reply_t **/ typedef struct xcb_glx_get_tex_enviv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; int32_t datum; uint8_t pad2[12]; } xcb_glx_get_tex_enviv_reply_t; /** * @brief xcb_glx_get_tex_gendv_cookie_t **/ typedef struct xcb_glx_get_tex_gendv_cookie_t { unsigned int sequence; } xcb_glx_get_tex_gendv_cookie_t; /** Opcode for xcb_glx_get_tex_gendv. */ #define XCB_GLX_GET_TEX_GENDV 132 /** * @brief xcb_glx_get_tex_gendv_request_t **/ typedef struct xcb_glx_get_tex_gendv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t coord; uint32_t pname; } xcb_glx_get_tex_gendv_request_t; /** * @brief xcb_glx_get_tex_gendv_reply_t **/ typedef struct xcb_glx_get_tex_gendv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; xcb_glx_float64_t datum; uint8_t pad2[8]; } xcb_glx_get_tex_gendv_reply_t; /** * @brief xcb_glx_get_tex_genfv_cookie_t **/ typedef struct xcb_glx_get_tex_genfv_cookie_t { unsigned int sequence; } xcb_glx_get_tex_genfv_cookie_t; /** Opcode for xcb_glx_get_tex_genfv. */ #define XCB_GLX_GET_TEX_GENFV 133 /** * @brief xcb_glx_get_tex_genfv_request_t **/ typedef struct xcb_glx_get_tex_genfv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t coord; uint32_t pname; } xcb_glx_get_tex_genfv_request_t; /** * @brief xcb_glx_get_tex_genfv_reply_t **/ typedef struct xcb_glx_get_tex_genfv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; xcb_glx_float32_t datum; uint8_t pad2[12]; } xcb_glx_get_tex_genfv_reply_t; /** * @brief xcb_glx_get_tex_geniv_cookie_t **/ typedef struct xcb_glx_get_tex_geniv_cookie_t { unsigned int sequence; } xcb_glx_get_tex_geniv_cookie_t; /** Opcode for xcb_glx_get_tex_geniv. */ #define XCB_GLX_GET_TEX_GENIV 134 /** * @brief xcb_glx_get_tex_geniv_request_t **/ typedef struct xcb_glx_get_tex_geniv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t coord; uint32_t pname; } xcb_glx_get_tex_geniv_request_t; /** * @brief xcb_glx_get_tex_geniv_reply_t **/ typedef struct xcb_glx_get_tex_geniv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; int32_t datum; uint8_t pad2[12]; } xcb_glx_get_tex_geniv_reply_t; /** * @brief xcb_glx_get_tex_image_cookie_t **/ typedef struct xcb_glx_get_tex_image_cookie_t { unsigned int sequence; } xcb_glx_get_tex_image_cookie_t; /** Opcode for xcb_glx_get_tex_image. */ #define XCB_GLX_GET_TEX_IMAGE 135 /** * @brief xcb_glx_get_tex_image_request_t **/ typedef struct xcb_glx_get_tex_image_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; int32_t level; uint32_t format; uint32_t type; uint8_t swap_bytes; } xcb_glx_get_tex_image_request_t; /** * @brief xcb_glx_get_tex_image_reply_t **/ typedef struct xcb_glx_get_tex_image_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[8]; int32_t width; int32_t height; int32_t depth; uint8_t pad2[4]; } xcb_glx_get_tex_image_reply_t; /** * @brief xcb_glx_get_tex_parameterfv_cookie_t **/ typedef struct xcb_glx_get_tex_parameterfv_cookie_t { unsigned int sequence; } xcb_glx_get_tex_parameterfv_cookie_t; /** Opcode for xcb_glx_get_tex_parameterfv. */ #define XCB_GLX_GET_TEX_PARAMETERFV 136 /** * @brief xcb_glx_get_tex_parameterfv_request_t **/ typedef struct xcb_glx_get_tex_parameterfv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t pname; } xcb_glx_get_tex_parameterfv_request_t; /** * @brief xcb_glx_get_tex_parameterfv_reply_t **/ typedef struct xcb_glx_get_tex_parameterfv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; xcb_glx_float32_t datum; uint8_t pad2[12]; } xcb_glx_get_tex_parameterfv_reply_t; /** * @brief xcb_glx_get_tex_parameteriv_cookie_t **/ typedef struct xcb_glx_get_tex_parameteriv_cookie_t { unsigned int sequence; } xcb_glx_get_tex_parameteriv_cookie_t; /** Opcode for xcb_glx_get_tex_parameteriv. */ #define XCB_GLX_GET_TEX_PARAMETERIV 137 /** * @brief xcb_glx_get_tex_parameteriv_request_t **/ typedef struct xcb_glx_get_tex_parameteriv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t pname; } xcb_glx_get_tex_parameteriv_request_t; /** * @brief xcb_glx_get_tex_parameteriv_reply_t **/ typedef struct xcb_glx_get_tex_parameteriv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; int32_t datum; uint8_t pad2[12]; } xcb_glx_get_tex_parameteriv_reply_t; /** * @brief xcb_glx_get_tex_level_parameterfv_cookie_t **/ typedef struct xcb_glx_get_tex_level_parameterfv_cookie_t { unsigned int sequence; } xcb_glx_get_tex_level_parameterfv_cookie_t; /** Opcode for xcb_glx_get_tex_level_parameterfv. */ #define XCB_GLX_GET_TEX_LEVEL_PARAMETERFV 138 /** * @brief xcb_glx_get_tex_level_parameterfv_request_t **/ typedef struct xcb_glx_get_tex_level_parameterfv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; int32_t level; uint32_t pname; } xcb_glx_get_tex_level_parameterfv_request_t; /** * @brief xcb_glx_get_tex_level_parameterfv_reply_t **/ typedef struct xcb_glx_get_tex_level_parameterfv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; xcb_glx_float32_t datum; uint8_t pad2[12]; } xcb_glx_get_tex_level_parameterfv_reply_t; /** * @brief xcb_glx_get_tex_level_parameteriv_cookie_t **/ typedef struct xcb_glx_get_tex_level_parameteriv_cookie_t { unsigned int sequence; } xcb_glx_get_tex_level_parameteriv_cookie_t; /** Opcode for xcb_glx_get_tex_level_parameteriv. */ #define XCB_GLX_GET_TEX_LEVEL_PARAMETERIV 139 /** * @brief xcb_glx_get_tex_level_parameteriv_request_t **/ typedef struct xcb_glx_get_tex_level_parameteriv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; int32_t level; uint32_t pname; } xcb_glx_get_tex_level_parameteriv_request_t; /** * @brief xcb_glx_get_tex_level_parameteriv_reply_t **/ typedef struct xcb_glx_get_tex_level_parameteriv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; int32_t datum; uint8_t pad2[12]; } xcb_glx_get_tex_level_parameteriv_reply_t; /** * @brief xcb_glx_is_enabled_cookie_t **/ typedef struct xcb_glx_is_enabled_cookie_t { unsigned int sequence; } xcb_glx_is_enabled_cookie_t; /** Opcode for xcb_glx_is_enabled. */ #define XCB_GLX_IS_ENABLED 140 /** * @brief xcb_glx_is_enabled_request_t **/ typedef struct xcb_glx_is_enabled_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t capability; } xcb_glx_is_enabled_request_t; /** * @brief xcb_glx_is_enabled_reply_t **/ typedef struct xcb_glx_is_enabled_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_glx_bool32_t ret_val; } xcb_glx_is_enabled_reply_t; /** * @brief xcb_glx_is_list_cookie_t **/ typedef struct xcb_glx_is_list_cookie_t { unsigned int sequence; } xcb_glx_is_list_cookie_t; /** Opcode for xcb_glx_is_list. */ #define XCB_GLX_IS_LIST 141 /** * @brief xcb_glx_is_list_request_t **/ typedef struct xcb_glx_is_list_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t list; } xcb_glx_is_list_request_t; /** * @brief xcb_glx_is_list_reply_t **/ typedef struct xcb_glx_is_list_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_glx_bool32_t ret_val; } xcb_glx_is_list_reply_t; /** Opcode for xcb_glx_flush. */ #define XCB_GLX_FLUSH 142 /** * @brief xcb_glx_flush_request_t **/ typedef struct xcb_glx_flush_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; } xcb_glx_flush_request_t; /** * @brief xcb_glx_are_textures_resident_cookie_t **/ typedef struct xcb_glx_are_textures_resident_cookie_t { unsigned int sequence; } xcb_glx_are_textures_resident_cookie_t; /** Opcode for xcb_glx_are_textures_resident. */ #define XCB_GLX_ARE_TEXTURES_RESIDENT 143 /** * @brief xcb_glx_are_textures_resident_request_t **/ typedef struct xcb_glx_are_textures_resident_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; int32_t n; } xcb_glx_are_textures_resident_request_t; /** * @brief xcb_glx_are_textures_resident_reply_t **/ typedef struct xcb_glx_are_textures_resident_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_glx_bool32_t ret_val; uint8_t pad1[20]; } xcb_glx_are_textures_resident_reply_t; /** Opcode for xcb_glx_delete_textures. */ #define XCB_GLX_DELETE_TEXTURES 144 /** * @brief xcb_glx_delete_textures_request_t **/ typedef struct xcb_glx_delete_textures_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; int32_t n; } xcb_glx_delete_textures_request_t; /** * @brief xcb_glx_gen_textures_cookie_t **/ typedef struct xcb_glx_gen_textures_cookie_t { unsigned int sequence; } xcb_glx_gen_textures_cookie_t; /** Opcode for xcb_glx_gen_textures. */ #define XCB_GLX_GEN_TEXTURES 145 /** * @brief xcb_glx_gen_textures_request_t **/ typedef struct xcb_glx_gen_textures_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; int32_t n; } xcb_glx_gen_textures_request_t; /** * @brief xcb_glx_gen_textures_reply_t **/ typedef struct xcb_glx_gen_textures_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[24]; } xcb_glx_gen_textures_reply_t; /** * @brief xcb_glx_is_texture_cookie_t **/ typedef struct xcb_glx_is_texture_cookie_t { unsigned int sequence; } xcb_glx_is_texture_cookie_t; /** Opcode for xcb_glx_is_texture. */ #define XCB_GLX_IS_TEXTURE 146 /** * @brief xcb_glx_is_texture_request_t **/ typedef struct xcb_glx_is_texture_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t texture; } xcb_glx_is_texture_request_t; /** * @brief xcb_glx_is_texture_reply_t **/ typedef struct xcb_glx_is_texture_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_glx_bool32_t ret_val; } xcb_glx_is_texture_reply_t; /** * @brief xcb_glx_get_color_table_cookie_t **/ typedef struct xcb_glx_get_color_table_cookie_t { unsigned int sequence; } xcb_glx_get_color_table_cookie_t; /** Opcode for xcb_glx_get_color_table. */ #define XCB_GLX_GET_COLOR_TABLE 147 /** * @brief xcb_glx_get_color_table_request_t **/ typedef struct xcb_glx_get_color_table_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t format; uint32_t type; uint8_t swap_bytes; } xcb_glx_get_color_table_request_t; /** * @brief xcb_glx_get_color_table_reply_t **/ typedef struct xcb_glx_get_color_table_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[8]; int32_t width; uint8_t pad2[12]; } xcb_glx_get_color_table_reply_t; /** * @brief xcb_glx_get_color_table_parameterfv_cookie_t **/ typedef struct xcb_glx_get_color_table_parameterfv_cookie_t { unsigned int sequence; } xcb_glx_get_color_table_parameterfv_cookie_t; /** Opcode for xcb_glx_get_color_table_parameterfv. */ #define XCB_GLX_GET_COLOR_TABLE_PARAMETERFV 148 /** * @brief xcb_glx_get_color_table_parameterfv_request_t **/ typedef struct xcb_glx_get_color_table_parameterfv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t pname; } xcb_glx_get_color_table_parameterfv_request_t; /** * @brief xcb_glx_get_color_table_parameterfv_reply_t **/ typedef struct xcb_glx_get_color_table_parameterfv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; xcb_glx_float32_t datum; uint8_t pad2[12]; } xcb_glx_get_color_table_parameterfv_reply_t; /** * @brief xcb_glx_get_color_table_parameteriv_cookie_t **/ typedef struct xcb_glx_get_color_table_parameteriv_cookie_t { unsigned int sequence; } xcb_glx_get_color_table_parameteriv_cookie_t; /** Opcode for xcb_glx_get_color_table_parameteriv. */ #define XCB_GLX_GET_COLOR_TABLE_PARAMETERIV 149 /** * @brief xcb_glx_get_color_table_parameteriv_request_t **/ typedef struct xcb_glx_get_color_table_parameteriv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t pname; } xcb_glx_get_color_table_parameteriv_request_t; /** * @brief xcb_glx_get_color_table_parameteriv_reply_t **/ typedef struct xcb_glx_get_color_table_parameteriv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; int32_t datum; uint8_t pad2[12]; } xcb_glx_get_color_table_parameteriv_reply_t; /** * @brief xcb_glx_get_convolution_filter_cookie_t **/ typedef struct xcb_glx_get_convolution_filter_cookie_t { unsigned int sequence; } xcb_glx_get_convolution_filter_cookie_t; /** Opcode for xcb_glx_get_convolution_filter. */ #define XCB_GLX_GET_CONVOLUTION_FILTER 150 /** * @brief xcb_glx_get_convolution_filter_request_t **/ typedef struct xcb_glx_get_convolution_filter_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t format; uint32_t type; uint8_t swap_bytes; } xcb_glx_get_convolution_filter_request_t; /** * @brief xcb_glx_get_convolution_filter_reply_t **/ typedef struct xcb_glx_get_convolution_filter_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[8]; int32_t width; int32_t height; uint8_t pad2[8]; } xcb_glx_get_convolution_filter_reply_t; /** * @brief xcb_glx_get_convolution_parameterfv_cookie_t **/ typedef struct xcb_glx_get_convolution_parameterfv_cookie_t { unsigned int sequence; } xcb_glx_get_convolution_parameterfv_cookie_t; /** Opcode for xcb_glx_get_convolution_parameterfv. */ #define XCB_GLX_GET_CONVOLUTION_PARAMETERFV 151 /** * @brief xcb_glx_get_convolution_parameterfv_request_t **/ typedef struct xcb_glx_get_convolution_parameterfv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t pname; } xcb_glx_get_convolution_parameterfv_request_t; /** * @brief xcb_glx_get_convolution_parameterfv_reply_t **/ typedef struct xcb_glx_get_convolution_parameterfv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; xcb_glx_float32_t datum; uint8_t pad2[12]; } xcb_glx_get_convolution_parameterfv_reply_t; /** * @brief xcb_glx_get_convolution_parameteriv_cookie_t **/ typedef struct xcb_glx_get_convolution_parameteriv_cookie_t { unsigned int sequence; } xcb_glx_get_convolution_parameteriv_cookie_t; /** Opcode for xcb_glx_get_convolution_parameteriv. */ #define XCB_GLX_GET_CONVOLUTION_PARAMETERIV 152 /** * @brief xcb_glx_get_convolution_parameteriv_request_t **/ typedef struct xcb_glx_get_convolution_parameteriv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t pname; } xcb_glx_get_convolution_parameteriv_request_t; /** * @brief xcb_glx_get_convolution_parameteriv_reply_t **/ typedef struct xcb_glx_get_convolution_parameteriv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; int32_t datum; uint8_t pad2[12]; } xcb_glx_get_convolution_parameteriv_reply_t; /** * @brief xcb_glx_get_separable_filter_cookie_t **/ typedef struct xcb_glx_get_separable_filter_cookie_t { unsigned int sequence; } xcb_glx_get_separable_filter_cookie_t; /** Opcode for xcb_glx_get_separable_filter. */ #define XCB_GLX_GET_SEPARABLE_FILTER 153 /** * @brief xcb_glx_get_separable_filter_request_t **/ typedef struct xcb_glx_get_separable_filter_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t format; uint32_t type; uint8_t swap_bytes; } xcb_glx_get_separable_filter_request_t; /** * @brief xcb_glx_get_separable_filter_reply_t **/ typedef struct xcb_glx_get_separable_filter_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[8]; int32_t row_w; int32_t col_h; uint8_t pad2[8]; } xcb_glx_get_separable_filter_reply_t; /** * @brief xcb_glx_get_histogram_cookie_t **/ typedef struct xcb_glx_get_histogram_cookie_t { unsigned int sequence; } xcb_glx_get_histogram_cookie_t; /** Opcode for xcb_glx_get_histogram. */ #define XCB_GLX_GET_HISTOGRAM 154 /** * @brief xcb_glx_get_histogram_request_t **/ typedef struct xcb_glx_get_histogram_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t format; uint32_t type; uint8_t swap_bytes; uint8_t reset; } xcb_glx_get_histogram_request_t; /** * @brief xcb_glx_get_histogram_reply_t **/ typedef struct xcb_glx_get_histogram_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[8]; int32_t width; uint8_t pad2[12]; } xcb_glx_get_histogram_reply_t; /** * @brief xcb_glx_get_histogram_parameterfv_cookie_t **/ typedef struct xcb_glx_get_histogram_parameterfv_cookie_t { unsigned int sequence; } xcb_glx_get_histogram_parameterfv_cookie_t; /** Opcode for xcb_glx_get_histogram_parameterfv. */ #define XCB_GLX_GET_HISTOGRAM_PARAMETERFV 155 /** * @brief xcb_glx_get_histogram_parameterfv_request_t **/ typedef struct xcb_glx_get_histogram_parameterfv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t pname; } xcb_glx_get_histogram_parameterfv_request_t; /** * @brief xcb_glx_get_histogram_parameterfv_reply_t **/ typedef struct xcb_glx_get_histogram_parameterfv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; xcb_glx_float32_t datum; uint8_t pad2[12]; } xcb_glx_get_histogram_parameterfv_reply_t; /** * @brief xcb_glx_get_histogram_parameteriv_cookie_t **/ typedef struct xcb_glx_get_histogram_parameteriv_cookie_t { unsigned int sequence; } xcb_glx_get_histogram_parameteriv_cookie_t; /** Opcode for xcb_glx_get_histogram_parameteriv. */ #define XCB_GLX_GET_HISTOGRAM_PARAMETERIV 156 /** * @brief xcb_glx_get_histogram_parameteriv_request_t **/ typedef struct xcb_glx_get_histogram_parameteriv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t pname; } xcb_glx_get_histogram_parameteriv_request_t; /** * @brief xcb_glx_get_histogram_parameteriv_reply_t **/ typedef struct xcb_glx_get_histogram_parameteriv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; int32_t datum; uint8_t pad2[12]; } xcb_glx_get_histogram_parameteriv_reply_t; /** * @brief xcb_glx_get_minmax_cookie_t **/ typedef struct xcb_glx_get_minmax_cookie_t { unsigned int sequence; } xcb_glx_get_minmax_cookie_t; /** Opcode for xcb_glx_get_minmax. */ #define XCB_GLX_GET_MINMAX 157 /** * @brief xcb_glx_get_minmax_request_t **/ typedef struct xcb_glx_get_minmax_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t format; uint32_t type; uint8_t swap_bytes; uint8_t reset; } xcb_glx_get_minmax_request_t; /** * @brief xcb_glx_get_minmax_reply_t **/ typedef struct xcb_glx_get_minmax_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[24]; } xcb_glx_get_minmax_reply_t; /** * @brief xcb_glx_get_minmax_parameterfv_cookie_t **/ typedef struct xcb_glx_get_minmax_parameterfv_cookie_t { unsigned int sequence; } xcb_glx_get_minmax_parameterfv_cookie_t; /** Opcode for xcb_glx_get_minmax_parameterfv. */ #define XCB_GLX_GET_MINMAX_PARAMETERFV 158 /** * @brief xcb_glx_get_minmax_parameterfv_request_t **/ typedef struct xcb_glx_get_minmax_parameterfv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t pname; } xcb_glx_get_minmax_parameterfv_request_t; /** * @brief xcb_glx_get_minmax_parameterfv_reply_t **/ typedef struct xcb_glx_get_minmax_parameterfv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; xcb_glx_float32_t datum; uint8_t pad2[12]; } xcb_glx_get_minmax_parameterfv_reply_t; /** * @brief xcb_glx_get_minmax_parameteriv_cookie_t **/ typedef struct xcb_glx_get_minmax_parameteriv_cookie_t { unsigned int sequence; } xcb_glx_get_minmax_parameteriv_cookie_t; /** Opcode for xcb_glx_get_minmax_parameteriv. */ #define XCB_GLX_GET_MINMAX_PARAMETERIV 159 /** * @brief xcb_glx_get_minmax_parameteriv_request_t **/ typedef struct xcb_glx_get_minmax_parameteriv_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t pname; } xcb_glx_get_minmax_parameteriv_request_t; /** * @brief xcb_glx_get_minmax_parameteriv_reply_t **/ typedef struct xcb_glx_get_minmax_parameteriv_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; int32_t datum; uint8_t pad2[12]; } xcb_glx_get_minmax_parameteriv_reply_t; /** * @brief xcb_glx_get_compressed_tex_image_arb_cookie_t **/ typedef struct xcb_glx_get_compressed_tex_image_arb_cookie_t { unsigned int sequence; } xcb_glx_get_compressed_tex_image_arb_cookie_t; /** Opcode for xcb_glx_get_compressed_tex_image_arb. */ #define XCB_GLX_GET_COMPRESSED_TEX_IMAGE_ARB 160 /** * @brief xcb_glx_get_compressed_tex_image_arb_request_t **/ typedef struct xcb_glx_get_compressed_tex_image_arb_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; int32_t level; } xcb_glx_get_compressed_tex_image_arb_request_t; /** * @brief xcb_glx_get_compressed_tex_image_arb_reply_t **/ typedef struct xcb_glx_get_compressed_tex_image_arb_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[8]; int32_t size; uint8_t pad2[12]; } xcb_glx_get_compressed_tex_image_arb_reply_t; /** Opcode for xcb_glx_delete_queries_arb. */ #define XCB_GLX_DELETE_QUERIES_ARB 161 /** * @brief xcb_glx_delete_queries_arb_request_t **/ typedef struct xcb_glx_delete_queries_arb_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; int32_t n; } xcb_glx_delete_queries_arb_request_t; /** * @brief xcb_glx_gen_queries_arb_cookie_t **/ typedef struct xcb_glx_gen_queries_arb_cookie_t { unsigned int sequence; } xcb_glx_gen_queries_arb_cookie_t; /** Opcode for xcb_glx_gen_queries_arb. */ #define XCB_GLX_GEN_QUERIES_ARB 162 /** * @brief xcb_glx_gen_queries_arb_request_t **/ typedef struct xcb_glx_gen_queries_arb_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; int32_t n; } xcb_glx_gen_queries_arb_request_t; /** * @brief xcb_glx_gen_queries_arb_reply_t **/ typedef struct xcb_glx_gen_queries_arb_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[24]; } xcb_glx_gen_queries_arb_reply_t; /** * @brief xcb_glx_is_query_arb_cookie_t **/ typedef struct xcb_glx_is_query_arb_cookie_t { unsigned int sequence; } xcb_glx_is_query_arb_cookie_t; /** Opcode for xcb_glx_is_query_arb. */ #define XCB_GLX_IS_QUERY_ARB 163 /** * @brief xcb_glx_is_query_arb_request_t **/ typedef struct xcb_glx_is_query_arb_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t id; } xcb_glx_is_query_arb_request_t; /** * @brief xcb_glx_is_query_arb_reply_t **/ typedef struct xcb_glx_is_query_arb_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_glx_bool32_t ret_val; } xcb_glx_is_query_arb_reply_t; /** * @brief xcb_glx_get_queryiv_arb_cookie_t **/ typedef struct xcb_glx_get_queryiv_arb_cookie_t { unsigned int sequence; } xcb_glx_get_queryiv_arb_cookie_t; /** Opcode for xcb_glx_get_queryiv_arb. */ #define XCB_GLX_GET_QUERYIV_ARB 164 /** * @brief xcb_glx_get_queryiv_arb_request_t **/ typedef struct xcb_glx_get_queryiv_arb_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t target; uint32_t pname; } xcb_glx_get_queryiv_arb_request_t; /** * @brief xcb_glx_get_queryiv_arb_reply_t **/ typedef struct xcb_glx_get_queryiv_arb_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; int32_t datum; uint8_t pad2[12]; } xcb_glx_get_queryiv_arb_reply_t; /** * @brief xcb_glx_get_query_objectiv_arb_cookie_t **/ typedef struct xcb_glx_get_query_objectiv_arb_cookie_t { unsigned int sequence; } xcb_glx_get_query_objectiv_arb_cookie_t; /** Opcode for xcb_glx_get_query_objectiv_arb. */ #define XCB_GLX_GET_QUERY_OBJECTIV_ARB 165 /** * @brief xcb_glx_get_query_objectiv_arb_request_t **/ typedef struct xcb_glx_get_query_objectiv_arb_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t id; uint32_t pname; } xcb_glx_get_query_objectiv_arb_request_t; /** * @brief xcb_glx_get_query_objectiv_arb_reply_t **/ typedef struct xcb_glx_get_query_objectiv_arb_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; int32_t datum; uint8_t pad2[12]; } xcb_glx_get_query_objectiv_arb_reply_t; /** * @brief xcb_glx_get_query_objectuiv_arb_cookie_t **/ typedef struct xcb_glx_get_query_objectuiv_arb_cookie_t { unsigned int sequence; } xcb_glx_get_query_objectuiv_arb_cookie_t; /** Opcode for xcb_glx_get_query_objectuiv_arb. */ #define XCB_GLX_GET_QUERY_OBJECTUIV_ARB 166 /** * @brief xcb_glx_get_query_objectuiv_arb_request_t **/ typedef struct xcb_glx_get_query_objectuiv_arb_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_glx_context_tag_t context_tag; uint32_t id; uint32_t pname; } xcb_glx_get_query_objectuiv_arb_request_t; /** * @brief xcb_glx_get_query_objectuiv_arb_reply_t **/ typedef struct xcb_glx_get_query_objectuiv_arb_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[4]; uint32_t n; uint32_t datum; uint8_t pad2[12]; } xcb_glx_get_query_objectuiv_arb_reply_t; /** * Get the next element of the iterator * @param i Pointer to a xcb_glx_pixmap_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_glx_pixmap_t) */ void xcb_glx_pixmap_next (xcb_glx_pixmap_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_glx_pixmap_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_glx_pixmap_end (xcb_glx_pixmap_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_glx_context_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_glx_context_t) */ void xcb_glx_context_next (xcb_glx_context_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_glx_context_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_glx_context_end (xcb_glx_context_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_glx_pbuffer_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_glx_pbuffer_t) */ void xcb_glx_pbuffer_next (xcb_glx_pbuffer_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_glx_pbuffer_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_glx_pbuffer_end (xcb_glx_pbuffer_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_glx_window_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_glx_window_t) */ void xcb_glx_window_next (xcb_glx_window_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_glx_window_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_glx_window_end (xcb_glx_window_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_glx_fbconfig_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_glx_fbconfig_t) */ void xcb_glx_fbconfig_next (xcb_glx_fbconfig_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_glx_fbconfig_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_glx_fbconfig_end (xcb_glx_fbconfig_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_glx_drawable_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_glx_drawable_t) */ void xcb_glx_drawable_next (xcb_glx_drawable_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_glx_drawable_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_glx_drawable_end (xcb_glx_drawable_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_glx_float32_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_glx_float32_t) */ void xcb_glx_float32_next (xcb_glx_float32_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_glx_float32_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_glx_float32_end (xcb_glx_float32_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_glx_float64_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_glx_float64_t) */ void xcb_glx_float64_next (xcb_glx_float64_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_glx_float64_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_glx_float64_end (xcb_glx_float64_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_glx_bool32_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_glx_bool32_t) */ void xcb_glx_bool32_next (xcb_glx_bool32_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_glx_bool32_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_glx_bool32_end (xcb_glx_bool32_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_glx_context_tag_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_glx_context_tag_t) */ void xcb_glx_context_tag_next (xcb_glx_context_tag_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_glx_context_tag_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_glx_context_tag_end (xcb_glx_context_tag_iterator_t i); int xcb_glx_render_sizeof (const void *_buffer, uint32_t data_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_render_checked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t data_len, const uint8_t *data); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_render (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t data_len, const uint8_t *data); uint8_t * xcb_glx_render_data (const xcb_glx_render_request_t *R); int xcb_glx_render_data_length (const xcb_glx_render_request_t *R); xcb_generic_iterator_t xcb_glx_render_data_end (const xcb_glx_render_request_t *R); int xcb_glx_render_large_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_render_large_checked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint16_t request_num, uint16_t request_total, uint32_t data_len, const uint8_t *data); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_render_large (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint16_t request_num, uint16_t request_total, uint32_t data_len, const uint8_t *data); uint8_t * xcb_glx_render_large_data (const xcb_glx_render_large_request_t *R); int xcb_glx_render_large_data_length (const xcb_glx_render_large_request_t *R); xcb_generic_iterator_t xcb_glx_render_large_data_end (const xcb_glx_render_large_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_create_context_checked (xcb_connection_t *c, xcb_glx_context_t context, xcb_visualid_t visual, uint32_t screen, xcb_glx_context_t share_list, uint8_t is_direct); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_create_context (xcb_connection_t *c, xcb_glx_context_t context, xcb_visualid_t visual, uint32_t screen, xcb_glx_context_t share_list, uint8_t is_direct); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_destroy_context_checked (xcb_connection_t *c, xcb_glx_context_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_destroy_context (xcb_connection_t *c, xcb_glx_context_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_make_current_cookie_t xcb_glx_make_current (xcb_connection_t *c, xcb_glx_drawable_t drawable, xcb_glx_context_t context, xcb_glx_context_tag_t old_context_tag); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_make_current_cookie_t xcb_glx_make_current_unchecked (xcb_connection_t *c, xcb_glx_drawable_t drawable, xcb_glx_context_t context, xcb_glx_context_tag_t old_context_tag); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_make_current_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_make_current_reply_t * xcb_glx_make_current_reply (xcb_connection_t *c, xcb_glx_make_current_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_is_direct_cookie_t xcb_glx_is_direct (xcb_connection_t *c, xcb_glx_context_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_is_direct_cookie_t xcb_glx_is_direct_unchecked (xcb_connection_t *c, xcb_glx_context_t context); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_is_direct_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_is_direct_reply_t * xcb_glx_is_direct_reply (xcb_connection_t *c, xcb_glx_is_direct_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_query_version_cookie_t xcb_glx_query_version (xcb_connection_t *c, uint32_t major_version, uint32_t minor_version); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_query_version_cookie_t xcb_glx_query_version_unchecked (xcb_connection_t *c, uint32_t major_version, uint32_t minor_version); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_query_version_reply_t * xcb_glx_query_version_reply (xcb_connection_t *c, xcb_glx_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_wait_gl_checked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_wait_gl (xcb_connection_t *c, xcb_glx_context_tag_t context_tag); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_wait_x_checked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_wait_x (xcb_connection_t *c, xcb_glx_context_tag_t context_tag); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_copy_context_checked (xcb_connection_t *c, xcb_glx_context_t src, xcb_glx_context_t dest, uint32_t mask, xcb_glx_context_tag_t src_context_tag); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_copy_context (xcb_connection_t *c, xcb_glx_context_t src, xcb_glx_context_t dest, uint32_t mask, xcb_glx_context_tag_t src_context_tag); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_swap_buffers_checked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, xcb_glx_drawable_t drawable); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_swap_buffers (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, xcb_glx_drawable_t drawable); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_use_x_font_checked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, xcb_font_t font, uint32_t first, uint32_t count, uint32_t list_base); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_use_x_font (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, xcb_font_t font, uint32_t first, uint32_t count, uint32_t list_base); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_create_glx_pixmap_checked (xcb_connection_t *c, uint32_t screen, xcb_visualid_t visual, xcb_pixmap_t pixmap, xcb_glx_pixmap_t glx_pixmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_create_glx_pixmap (xcb_connection_t *c, uint32_t screen, xcb_visualid_t visual, xcb_pixmap_t pixmap, xcb_glx_pixmap_t glx_pixmap); int xcb_glx_get_visual_configs_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_visual_configs_cookie_t xcb_glx_get_visual_configs (xcb_connection_t *c, uint32_t screen); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_visual_configs_cookie_t xcb_glx_get_visual_configs_unchecked (xcb_connection_t *c, uint32_t screen); uint32_t * xcb_glx_get_visual_configs_property_list (const xcb_glx_get_visual_configs_reply_t *R); int xcb_glx_get_visual_configs_property_list_length (const xcb_glx_get_visual_configs_reply_t *R); xcb_generic_iterator_t xcb_glx_get_visual_configs_property_list_end (const xcb_glx_get_visual_configs_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_visual_configs_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_visual_configs_reply_t * xcb_glx_get_visual_configs_reply (xcb_connection_t *c, xcb_glx_get_visual_configs_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_destroy_glx_pixmap_checked (xcb_connection_t *c, xcb_glx_pixmap_t glx_pixmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_destroy_glx_pixmap (xcb_connection_t *c, xcb_glx_pixmap_t glx_pixmap); int xcb_glx_vendor_private_sizeof (const void *_buffer, uint32_t data_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_vendor_private_checked (xcb_connection_t *c, uint32_t vendor_code, xcb_glx_context_tag_t context_tag, uint32_t data_len, const uint8_t *data); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_vendor_private (xcb_connection_t *c, uint32_t vendor_code, xcb_glx_context_tag_t context_tag, uint32_t data_len, const uint8_t *data); uint8_t * xcb_glx_vendor_private_data (const xcb_glx_vendor_private_request_t *R); int xcb_glx_vendor_private_data_length (const xcb_glx_vendor_private_request_t *R); xcb_generic_iterator_t xcb_glx_vendor_private_data_end (const xcb_glx_vendor_private_request_t *R); int xcb_glx_vendor_private_with_reply_sizeof (const void *_buffer, uint32_t data_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_vendor_private_with_reply_cookie_t xcb_glx_vendor_private_with_reply (xcb_connection_t *c, uint32_t vendor_code, xcb_glx_context_tag_t context_tag, uint32_t data_len, const uint8_t *data); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_vendor_private_with_reply_cookie_t xcb_glx_vendor_private_with_reply_unchecked (xcb_connection_t *c, uint32_t vendor_code, xcb_glx_context_tag_t context_tag, uint32_t data_len, const uint8_t *data); uint8_t * xcb_glx_vendor_private_with_reply_data_2 (const xcb_glx_vendor_private_with_reply_reply_t *R); int xcb_glx_vendor_private_with_reply_data_2_length (const xcb_glx_vendor_private_with_reply_reply_t *R); xcb_generic_iterator_t xcb_glx_vendor_private_with_reply_data_2_end (const xcb_glx_vendor_private_with_reply_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_vendor_private_with_reply_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_vendor_private_with_reply_reply_t * xcb_glx_vendor_private_with_reply_reply (xcb_connection_t *c, xcb_glx_vendor_private_with_reply_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_query_extensions_string_cookie_t xcb_glx_query_extensions_string (xcb_connection_t *c, uint32_t screen); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_query_extensions_string_cookie_t xcb_glx_query_extensions_string_unchecked (xcb_connection_t *c, uint32_t screen); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_query_extensions_string_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_query_extensions_string_reply_t * xcb_glx_query_extensions_string_reply (xcb_connection_t *c, xcb_glx_query_extensions_string_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_query_server_string_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_query_server_string_cookie_t xcb_glx_query_server_string (xcb_connection_t *c, uint32_t screen, uint32_t name); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_query_server_string_cookie_t xcb_glx_query_server_string_unchecked (xcb_connection_t *c, uint32_t screen, uint32_t name); char * xcb_glx_query_server_string_string (const xcb_glx_query_server_string_reply_t *R); int xcb_glx_query_server_string_string_length (const xcb_glx_query_server_string_reply_t *R); xcb_generic_iterator_t xcb_glx_query_server_string_string_end (const xcb_glx_query_server_string_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_query_server_string_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_query_server_string_reply_t * xcb_glx_query_server_string_reply (xcb_connection_t *c, xcb_glx_query_server_string_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_client_info_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_client_info_checked (xcb_connection_t *c, uint32_t major_version, uint32_t minor_version, uint32_t str_len, const char *string); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_client_info (xcb_connection_t *c, uint32_t major_version, uint32_t minor_version, uint32_t str_len, const char *string); char * xcb_glx_client_info_string (const xcb_glx_client_info_request_t *R); int xcb_glx_client_info_string_length (const xcb_glx_client_info_request_t *R); xcb_generic_iterator_t xcb_glx_client_info_string_end (const xcb_glx_client_info_request_t *R); int xcb_glx_get_fb_configs_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_fb_configs_cookie_t xcb_glx_get_fb_configs (xcb_connection_t *c, uint32_t screen); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_fb_configs_cookie_t xcb_glx_get_fb_configs_unchecked (xcb_connection_t *c, uint32_t screen); uint32_t * xcb_glx_get_fb_configs_property_list (const xcb_glx_get_fb_configs_reply_t *R); int xcb_glx_get_fb_configs_property_list_length (const xcb_glx_get_fb_configs_reply_t *R); xcb_generic_iterator_t xcb_glx_get_fb_configs_property_list_end (const xcb_glx_get_fb_configs_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_fb_configs_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_fb_configs_reply_t * xcb_glx_get_fb_configs_reply (xcb_connection_t *c, xcb_glx_get_fb_configs_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_create_pixmap_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_create_pixmap_checked (xcb_connection_t *c, uint32_t screen, xcb_glx_fbconfig_t fbconfig, xcb_pixmap_t pixmap, xcb_glx_pixmap_t glx_pixmap, uint32_t num_attribs, const uint32_t *attribs); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_create_pixmap (xcb_connection_t *c, uint32_t screen, xcb_glx_fbconfig_t fbconfig, xcb_pixmap_t pixmap, xcb_glx_pixmap_t glx_pixmap, uint32_t num_attribs, const uint32_t *attribs); uint32_t * xcb_glx_create_pixmap_attribs (const xcb_glx_create_pixmap_request_t *R); int xcb_glx_create_pixmap_attribs_length (const xcb_glx_create_pixmap_request_t *R); xcb_generic_iterator_t xcb_glx_create_pixmap_attribs_end (const xcb_glx_create_pixmap_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_destroy_pixmap_checked (xcb_connection_t *c, xcb_glx_pixmap_t glx_pixmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_destroy_pixmap (xcb_connection_t *c, xcb_glx_pixmap_t glx_pixmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_create_new_context_checked (xcb_connection_t *c, xcb_glx_context_t context, xcb_glx_fbconfig_t fbconfig, uint32_t screen, uint32_t render_type, xcb_glx_context_t share_list, uint8_t is_direct); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_create_new_context (xcb_connection_t *c, xcb_glx_context_t context, xcb_glx_fbconfig_t fbconfig, uint32_t screen, uint32_t render_type, xcb_glx_context_t share_list, uint8_t is_direct); int xcb_glx_query_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_query_context_cookie_t xcb_glx_query_context (xcb_connection_t *c, xcb_glx_context_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_query_context_cookie_t xcb_glx_query_context_unchecked (xcb_connection_t *c, xcb_glx_context_t context); uint32_t * xcb_glx_query_context_attribs (const xcb_glx_query_context_reply_t *R); int xcb_glx_query_context_attribs_length (const xcb_glx_query_context_reply_t *R); xcb_generic_iterator_t xcb_glx_query_context_attribs_end (const xcb_glx_query_context_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_query_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_query_context_reply_t * xcb_glx_query_context_reply (xcb_connection_t *c, xcb_glx_query_context_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_make_context_current_cookie_t xcb_glx_make_context_current (xcb_connection_t *c, xcb_glx_context_tag_t old_context_tag, xcb_glx_drawable_t drawable, xcb_glx_drawable_t read_drawable, xcb_glx_context_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_make_context_current_cookie_t xcb_glx_make_context_current_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t old_context_tag, xcb_glx_drawable_t drawable, xcb_glx_drawable_t read_drawable, xcb_glx_context_t context); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_make_context_current_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_make_context_current_reply_t * xcb_glx_make_context_current_reply (xcb_connection_t *c, xcb_glx_make_context_current_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_create_pbuffer_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_create_pbuffer_checked (xcb_connection_t *c, uint32_t screen, xcb_glx_fbconfig_t fbconfig, xcb_glx_pbuffer_t pbuffer, uint32_t num_attribs, const uint32_t *attribs); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_create_pbuffer (xcb_connection_t *c, uint32_t screen, xcb_glx_fbconfig_t fbconfig, xcb_glx_pbuffer_t pbuffer, uint32_t num_attribs, const uint32_t *attribs); uint32_t * xcb_glx_create_pbuffer_attribs (const xcb_glx_create_pbuffer_request_t *R); int xcb_glx_create_pbuffer_attribs_length (const xcb_glx_create_pbuffer_request_t *R); xcb_generic_iterator_t xcb_glx_create_pbuffer_attribs_end (const xcb_glx_create_pbuffer_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_destroy_pbuffer_checked (xcb_connection_t *c, xcb_glx_pbuffer_t pbuffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_destroy_pbuffer (xcb_connection_t *c, xcb_glx_pbuffer_t pbuffer); int xcb_glx_get_drawable_attributes_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_drawable_attributes_cookie_t xcb_glx_get_drawable_attributes (xcb_connection_t *c, xcb_glx_drawable_t drawable); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_drawable_attributes_cookie_t xcb_glx_get_drawable_attributes_unchecked (xcb_connection_t *c, xcb_glx_drawable_t drawable); uint32_t * xcb_glx_get_drawable_attributes_attribs (const xcb_glx_get_drawable_attributes_reply_t *R); int xcb_glx_get_drawable_attributes_attribs_length (const xcb_glx_get_drawable_attributes_reply_t *R); xcb_generic_iterator_t xcb_glx_get_drawable_attributes_attribs_end (const xcb_glx_get_drawable_attributes_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_drawable_attributes_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_drawable_attributes_reply_t * xcb_glx_get_drawable_attributes_reply (xcb_connection_t *c, xcb_glx_get_drawable_attributes_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_change_drawable_attributes_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_change_drawable_attributes_checked (xcb_connection_t *c, xcb_glx_drawable_t drawable, uint32_t num_attribs, const uint32_t *attribs); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_change_drawable_attributes (xcb_connection_t *c, xcb_glx_drawable_t drawable, uint32_t num_attribs, const uint32_t *attribs); uint32_t * xcb_glx_change_drawable_attributes_attribs (const xcb_glx_change_drawable_attributes_request_t *R); int xcb_glx_change_drawable_attributes_attribs_length (const xcb_glx_change_drawable_attributes_request_t *R); xcb_generic_iterator_t xcb_glx_change_drawable_attributes_attribs_end (const xcb_glx_change_drawable_attributes_request_t *R); int xcb_glx_create_window_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_create_window_checked (xcb_connection_t *c, uint32_t screen, xcb_glx_fbconfig_t fbconfig, xcb_window_t window, xcb_glx_window_t glx_window, uint32_t num_attribs, const uint32_t *attribs); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_create_window (xcb_connection_t *c, uint32_t screen, xcb_glx_fbconfig_t fbconfig, xcb_window_t window, xcb_glx_window_t glx_window, uint32_t num_attribs, const uint32_t *attribs); uint32_t * xcb_glx_create_window_attribs (const xcb_glx_create_window_request_t *R); int xcb_glx_create_window_attribs_length (const xcb_glx_create_window_request_t *R); xcb_generic_iterator_t xcb_glx_create_window_attribs_end (const xcb_glx_create_window_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_delete_window_checked (xcb_connection_t *c, xcb_glx_window_t glxwindow); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_delete_window (xcb_connection_t *c, xcb_glx_window_t glxwindow); int xcb_glx_set_client_info_arb_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_set_client_info_arb_checked (xcb_connection_t *c, uint32_t major_version, uint32_t minor_version, uint32_t num_versions, uint32_t gl_str_len, uint32_t glx_str_len, const uint32_t *gl_versions, const char *gl_extension_string, const char *glx_extension_string); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_set_client_info_arb (xcb_connection_t *c, uint32_t major_version, uint32_t minor_version, uint32_t num_versions, uint32_t gl_str_len, uint32_t glx_str_len, const uint32_t *gl_versions, const char *gl_extension_string, const char *glx_extension_string); uint32_t * xcb_glx_set_client_info_arb_gl_versions (const xcb_glx_set_client_info_arb_request_t *R); int xcb_glx_set_client_info_arb_gl_versions_length (const xcb_glx_set_client_info_arb_request_t *R); xcb_generic_iterator_t xcb_glx_set_client_info_arb_gl_versions_end (const xcb_glx_set_client_info_arb_request_t *R); char * xcb_glx_set_client_info_arb_gl_extension_string (const xcb_glx_set_client_info_arb_request_t *R); int xcb_glx_set_client_info_arb_gl_extension_string_length (const xcb_glx_set_client_info_arb_request_t *R); xcb_generic_iterator_t xcb_glx_set_client_info_arb_gl_extension_string_end (const xcb_glx_set_client_info_arb_request_t *R); char * xcb_glx_set_client_info_arb_glx_extension_string (const xcb_glx_set_client_info_arb_request_t *R); int xcb_glx_set_client_info_arb_glx_extension_string_length (const xcb_glx_set_client_info_arb_request_t *R); xcb_generic_iterator_t xcb_glx_set_client_info_arb_glx_extension_string_end (const xcb_glx_set_client_info_arb_request_t *R); int xcb_glx_create_context_attribs_arb_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_create_context_attribs_arb_checked (xcb_connection_t *c, xcb_glx_context_t context, xcb_glx_fbconfig_t fbconfig, uint32_t screen, xcb_glx_context_t share_list, uint8_t is_direct, uint32_t num_attribs, const uint32_t *attribs); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_create_context_attribs_arb (xcb_connection_t *c, xcb_glx_context_t context, xcb_glx_fbconfig_t fbconfig, uint32_t screen, xcb_glx_context_t share_list, uint8_t is_direct, uint32_t num_attribs, const uint32_t *attribs); uint32_t * xcb_glx_create_context_attribs_arb_attribs (const xcb_glx_create_context_attribs_arb_request_t *R); int xcb_glx_create_context_attribs_arb_attribs_length (const xcb_glx_create_context_attribs_arb_request_t *R); xcb_generic_iterator_t xcb_glx_create_context_attribs_arb_attribs_end (const xcb_glx_create_context_attribs_arb_request_t *R); int xcb_glx_set_client_info_2arb_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_set_client_info_2arb_checked (xcb_connection_t *c, uint32_t major_version, uint32_t minor_version, uint32_t num_versions, uint32_t gl_str_len, uint32_t glx_str_len, const uint32_t *gl_versions, const char *gl_extension_string, const char *glx_extension_string); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_set_client_info_2arb (xcb_connection_t *c, uint32_t major_version, uint32_t minor_version, uint32_t num_versions, uint32_t gl_str_len, uint32_t glx_str_len, const uint32_t *gl_versions, const char *gl_extension_string, const char *glx_extension_string); uint32_t * xcb_glx_set_client_info_2arb_gl_versions (const xcb_glx_set_client_info_2arb_request_t *R); int xcb_glx_set_client_info_2arb_gl_versions_length (const xcb_glx_set_client_info_2arb_request_t *R); xcb_generic_iterator_t xcb_glx_set_client_info_2arb_gl_versions_end (const xcb_glx_set_client_info_2arb_request_t *R); char * xcb_glx_set_client_info_2arb_gl_extension_string (const xcb_glx_set_client_info_2arb_request_t *R); int xcb_glx_set_client_info_2arb_gl_extension_string_length (const xcb_glx_set_client_info_2arb_request_t *R); xcb_generic_iterator_t xcb_glx_set_client_info_2arb_gl_extension_string_end (const xcb_glx_set_client_info_2arb_request_t *R); char * xcb_glx_set_client_info_2arb_glx_extension_string (const xcb_glx_set_client_info_2arb_request_t *R); int xcb_glx_set_client_info_2arb_glx_extension_string_length (const xcb_glx_set_client_info_2arb_request_t *R); xcb_generic_iterator_t xcb_glx_set_client_info_2arb_glx_extension_string_end (const xcb_glx_set_client_info_2arb_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_new_list_checked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t list, uint32_t mode); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_new_list (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t list, uint32_t mode); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_end_list_checked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_end_list (xcb_connection_t *c, xcb_glx_context_tag_t context_tag); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_delete_lists_checked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t list, int32_t range); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_delete_lists (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t list, int32_t range); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_gen_lists_cookie_t xcb_glx_gen_lists (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t range); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_gen_lists_cookie_t xcb_glx_gen_lists_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t range); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_gen_lists_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_gen_lists_reply_t * xcb_glx_gen_lists_reply (xcb_connection_t *c, xcb_glx_gen_lists_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_feedback_buffer_checked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t size, int32_t type); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_feedback_buffer (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t size, int32_t type); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_select_buffer_checked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t size); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_select_buffer (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t size); int xcb_glx_render_mode_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_render_mode_cookie_t xcb_glx_render_mode (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t mode); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_render_mode_cookie_t xcb_glx_render_mode_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t mode); uint32_t * xcb_glx_render_mode_data (const xcb_glx_render_mode_reply_t *R); int xcb_glx_render_mode_data_length (const xcb_glx_render_mode_reply_t *R); xcb_generic_iterator_t xcb_glx_render_mode_data_end (const xcb_glx_render_mode_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_render_mode_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_render_mode_reply_t * xcb_glx_render_mode_reply (xcb_connection_t *c, xcb_glx_render_mode_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_finish_cookie_t xcb_glx_finish (xcb_connection_t *c, xcb_glx_context_tag_t context_tag); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_finish_cookie_t xcb_glx_finish_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_finish_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_finish_reply_t * xcb_glx_finish_reply (xcb_connection_t *c, xcb_glx_finish_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_pixel_storef_checked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t pname, xcb_glx_float32_t datum); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_pixel_storef (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t pname, xcb_glx_float32_t datum); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_pixel_storei_checked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t pname, int32_t datum); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_pixel_storei (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t pname, int32_t datum); int xcb_glx_read_pixels_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_read_pixels_cookie_t xcb_glx_read_pixels (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t x, int32_t y, int32_t width, int32_t height, uint32_t format, uint32_t type, uint8_t swap_bytes, uint8_t lsb_first); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_read_pixels_cookie_t xcb_glx_read_pixels_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t x, int32_t y, int32_t width, int32_t height, uint32_t format, uint32_t type, uint8_t swap_bytes, uint8_t lsb_first); uint8_t * xcb_glx_read_pixels_data (const xcb_glx_read_pixels_reply_t *R); int xcb_glx_read_pixels_data_length (const xcb_glx_read_pixels_reply_t *R); xcb_generic_iterator_t xcb_glx_read_pixels_data_end (const xcb_glx_read_pixels_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_read_pixels_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_read_pixels_reply_t * xcb_glx_read_pixels_reply (xcb_connection_t *c, xcb_glx_read_pixels_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_booleanv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_booleanv_cookie_t xcb_glx_get_booleanv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_booleanv_cookie_t xcb_glx_get_booleanv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t pname); uint8_t * xcb_glx_get_booleanv_data (const xcb_glx_get_booleanv_reply_t *R); int xcb_glx_get_booleanv_data_length (const xcb_glx_get_booleanv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_booleanv_data_end (const xcb_glx_get_booleanv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_booleanv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_booleanv_reply_t * xcb_glx_get_booleanv_reply (xcb_connection_t *c, xcb_glx_get_booleanv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_clip_plane_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_clip_plane_cookie_t xcb_glx_get_clip_plane (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t plane); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_clip_plane_cookie_t xcb_glx_get_clip_plane_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t plane); xcb_glx_float64_t * xcb_glx_get_clip_plane_data (const xcb_glx_get_clip_plane_reply_t *R); int xcb_glx_get_clip_plane_data_length (const xcb_glx_get_clip_plane_reply_t *R); xcb_generic_iterator_t xcb_glx_get_clip_plane_data_end (const xcb_glx_get_clip_plane_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_clip_plane_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_clip_plane_reply_t * xcb_glx_get_clip_plane_reply (xcb_connection_t *c, xcb_glx_get_clip_plane_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_doublev_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_doublev_cookie_t xcb_glx_get_doublev (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_doublev_cookie_t xcb_glx_get_doublev_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t pname); xcb_glx_float64_t * xcb_glx_get_doublev_data (const xcb_glx_get_doublev_reply_t *R); int xcb_glx_get_doublev_data_length (const xcb_glx_get_doublev_reply_t *R); xcb_generic_iterator_t xcb_glx_get_doublev_data_end (const xcb_glx_get_doublev_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_doublev_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_doublev_reply_t * xcb_glx_get_doublev_reply (xcb_connection_t *c, xcb_glx_get_doublev_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_error_cookie_t xcb_glx_get_error (xcb_connection_t *c, xcb_glx_context_tag_t context_tag); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_error_cookie_t xcb_glx_get_error_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_error_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_error_reply_t * xcb_glx_get_error_reply (xcb_connection_t *c, xcb_glx_get_error_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_floatv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_floatv_cookie_t xcb_glx_get_floatv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_floatv_cookie_t xcb_glx_get_floatv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t pname); xcb_glx_float32_t * xcb_glx_get_floatv_data (const xcb_glx_get_floatv_reply_t *R); int xcb_glx_get_floatv_data_length (const xcb_glx_get_floatv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_floatv_data_end (const xcb_glx_get_floatv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_floatv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_floatv_reply_t * xcb_glx_get_floatv_reply (xcb_connection_t *c, xcb_glx_get_floatv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_integerv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_integerv_cookie_t xcb_glx_get_integerv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_integerv_cookie_t xcb_glx_get_integerv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t pname); int32_t * xcb_glx_get_integerv_data (const xcb_glx_get_integerv_reply_t *R); int xcb_glx_get_integerv_data_length (const xcb_glx_get_integerv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_integerv_data_end (const xcb_glx_get_integerv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_integerv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_integerv_reply_t * xcb_glx_get_integerv_reply (xcb_connection_t *c, xcb_glx_get_integerv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_lightfv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_lightfv_cookie_t xcb_glx_get_lightfv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t light, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_lightfv_cookie_t xcb_glx_get_lightfv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t light, uint32_t pname); xcb_glx_float32_t * xcb_glx_get_lightfv_data (const xcb_glx_get_lightfv_reply_t *R); int xcb_glx_get_lightfv_data_length (const xcb_glx_get_lightfv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_lightfv_data_end (const xcb_glx_get_lightfv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_lightfv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_lightfv_reply_t * xcb_glx_get_lightfv_reply (xcb_connection_t *c, xcb_glx_get_lightfv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_lightiv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_lightiv_cookie_t xcb_glx_get_lightiv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t light, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_lightiv_cookie_t xcb_glx_get_lightiv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t light, uint32_t pname); int32_t * xcb_glx_get_lightiv_data (const xcb_glx_get_lightiv_reply_t *R); int xcb_glx_get_lightiv_data_length (const xcb_glx_get_lightiv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_lightiv_data_end (const xcb_glx_get_lightiv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_lightiv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_lightiv_reply_t * xcb_glx_get_lightiv_reply (xcb_connection_t *c, xcb_glx_get_lightiv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_mapdv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_mapdv_cookie_t xcb_glx_get_mapdv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t query); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_mapdv_cookie_t xcb_glx_get_mapdv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t query); xcb_glx_float64_t * xcb_glx_get_mapdv_data (const xcb_glx_get_mapdv_reply_t *R); int xcb_glx_get_mapdv_data_length (const xcb_glx_get_mapdv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_mapdv_data_end (const xcb_glx_get_mapdv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_mapdv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_mapdv_reply_t * xcb_glx_get_mapdv_reply (xcb_connection_t *c, xcb_glx_get_mapdv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_mapfv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_mapfv_cookie_t xcb_glx_get_mapfv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t query); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_mapfv_cookie_t xcb_glx_get_mapfv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t query); xcb_glx_float32_t * xcb_glx_get_mapfv_data (const xcb_glx_get_mapfv_reply_t *R); int xcb_glx_get_mapfv_data_length (const xcb_glx_get_mapfv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_mapfv_data_end (const xcb_glx_get_mapfv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_mapfv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_mapfv_reply_t * xcb_glx_get_mapfv_reply (xcb_connection_t *c, xcb_glx_get_mapfv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_mapiv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_mapiv_cookie_t xcb_glx_get_mapiv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t query); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_mapiv_cookie_t xcb_glx_get_mapiv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t query); int32_t * xcb_glx_get_mapiv_data (const xcb_glx_get_mapiv_reply_t *R); int xcb_glx_get_mapiv_data_length (const xcb_glx_get_mapiv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_mapiv_data_end (const xcb_glx_get_mapiv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_mapiv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_mapiv_reply_t * xcb_glx_get_mapiv_reply (xcb_connection_t *c, xcb_glx_get_mapiv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_materialfv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_materialfv_cookie_t xcb_glx_get_materialfv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t face, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_materialfv_cookie_t xcb_glx_get_materialfv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t face, uint32_t pname); xcb_glx_float32_t * xcb_glx_get_materialfv_data (const xcb_glx_get_materialfv_reply_t *R); int xcb_glx_get_materialfv_data_length (const xcb_glx_get_materialfv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_materialfv_data_end (const xcb_glx_get_materialfv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_materialfv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_materialfv_reply_t * xcb_glx_get_materialfv_reply (xcb_connection_t *c, xcb_glx_get_materialfv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_materialiv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_materialiv_cookie_t xcb_glx_get_materialiv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t face, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_materialiv_cookie_t xcb_glx_get_materialiv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t face, uint32_t pname); int32_t * xcb_glx_get_materialiv_data (const xcb_glx_get_materialiv_reply_t *R); int xcb_glx_get_materialiv_data_length (const xcb_glx_get_materialiv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_materialiv_data_end (const xcb_glx_get_materialiv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_materialiv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_materialiv_reply_t * xcb_glx_get_materialiv_reply (xcb_connection_t *c, xcb_glx_get_materialiv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_pixel_mapfv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_pixel_mapfv_cookie_t xcb_glx_get_pixel_mapfv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t map); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_pixel_mapfv_cookie_t xcb_glx_get_pixel_mapfv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t map); xcb_glx_float32_t * xcb_glx_get_pixel_mapfv_data (const xcb_glx_get_pixel_mapfv_reply_t *R); int xcb_glx_get_pixel_mapfv_data_length (const xcb_glx_get_pixel_mapfv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_pixel_mapfv_data_end (const xcb_glx_get_pixel_mapfv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_pixel_mapfv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_pixel_mapfv_reply_t * xcb_glx_get_pixel_mapfv_reply (xcb_connection_t *c, xcb_glx_get_pixel_mapfv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_pixel_mapuiv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_pixel_mapuiv_cookie_t xcb_glx_get_pixel_mapuiv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t map); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_pixel_mapuiv_cookie_t xcb_glx_get_pixel_mapuiv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t map); uint32_t * xcb_glx_get_pixel_mapuiv_data (const xcb_glx_get_pixel_mapuiv_reply_t *R); int xcb_glx_get_pixel_mapuiv_data_length (const xcb_glx_get_pixel_mapuiv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_pixel_mapuiv_data_end (const xcb_glx_get_pixel_mapuiv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_pixel_mapuiv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_pixel_mapuiv_reply_t * xcb_glx_get_pixel_mapuiv_reply (xcb_connection_t *c, xcb_glx_get_pixel_mapuiv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_pixel_mapusv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_pixel_mapusv_cookie_t xcb_glx_get_pixel_mapusv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t map); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_pixel_mapusv_cookie_t xcb_glx_get_pixel_mapusv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t map); uint16_t * xcb_glx_get_pixel_mapusv_data (const xcb_glx_get_pixel_mapusv_reply_t *R); int xcb_glx_get_pixel_mapusv_data_length (const xcb_glx_get_pixel_mapusv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_pixel_mapusv_data_end (const xcb_glx_get_pixel_mapusv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_pixel_mapusv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_pixel_mapusv_reply_t * xcb_glx_get_pixel_mapusv_reply (xcb_connection_t *c, xcb_glx_get_pixel_mapusv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_polygon_stipple_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_polygon_stipple_cookie_t xcb_glx_get_polygon_stipple (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint8_t lsb_first); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_polygon_stipple_cookie_t xcb_glx_get_polygon_stipple_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint8_t lsb_first); uint8_t * xcb_glx_get_polygon_stipple_data (const xcb_glx_get_polygon_stipple_reply_t *R); int xcb_glx_get_polygon_stipple_data_length (const xcb_glx_get_polygon_stipple_reply_t *R); xcb_generic_iterator_t xcb_glx_get_polygon_stipple_data_end (const xcb_glx_get_polygon_stipple_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_polygon_stipple_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_polygon_stipple_reply_t * xcb_glx_get_polygon_stipple_reply (xcb_connection_t *c, xcb_glx_get_polygon_stipple_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_string_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_string_cookie_t xcb_glx_get_string (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t name); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_string_cookie_t xcb_glx_get_string_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t name); char * xcb_glx_get_string_string (const xcb_glx_get_string_reply_t *R); int xcb_glx_get_string_string_length (const xcb_glx_get_string_reply_t *R); xcb_generic_iterator_t xcb_glx_get_string_string_end (const xcb_glx_get_string_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_string_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_string_reply_t * xcb_glx_get_string_reply (xcb_connection_t *c, xcb_glx_get_string_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_tex_envfv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_tex_envfv_cookie_t xcb_glx_get_tex_envfv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_tex_envfv_cookie_t xcb_glx_get_tex_envfv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); xcb_glx_float32_t * xcb_glx_get_tex_envfv_data (const xcb_glx_get_tex_envfv_reply_t *R); int xcb_glx_get_tex_envfv_data_length (const xcb_glx_get_tex_envfv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_tex_envfv_data_end (const xcb_glx_get_tex_envfv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_tex_envfv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_tex_envfv_reply_t * xcb_glx_get_tex_envfv_reply (xcb_connection_t *c, xcb_glx_get_tex_envfv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_tex_enviv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_tex_enviv_cookie_t xcb_glx_get_tex_enviv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_tex_enviv_cookie_t xcb_glx_get_tex_enviv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); int32_t * xcb_glx_get_tex_enviv_data (const xcb_glx_get_tex_enviv_reply_t *R); int xcb_glx_get_tex_enviv_data_length (const xcb_glx_get_tex_enviv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_tex_enviv_data_end (const xcb_glx_get_tex_enviv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_tex_enviv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_tex_enviv_reply_t * xcb_glx_get_tex_enviv_reply (xcb_connection_t *c, xcb_glx_get_tex_enviv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_tex_gendv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_tex_gendv_cookie_t xcb_glx_get_tex_gendv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t coord, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_tex_gendv_cookie_t xcb_glx_get_tex_gendv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t coord, uint32_t pname); xcb_glx_float64_t * xcb_glx_get_tex_gendv_data (const xcb_glx_get_tex_gendv_reply_t *R); int xcb_glx_get_tex_gendv_data_length (const xcb_glx_get_tex_gendv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_tex_gendv_data_end (const xcb_glx_get_tex_gendv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_tex_gendv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_tex_gendv_reply_t * xcb_glx_get_tex_gendv_reply (xcb_connection_t *c, xcb_glx_get_tex_gendv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_tex_genfv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_tex_genfv_cookie_t xcb_glx_get_tex_genfv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t coord, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_tex_genfv_cookie_t xcb_glx_get_tex_genfv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t coord, uint32_t pname); xcb_glx_float32_t * xcb_glx_get_tex_genfv_data (const xcb_glx_get_tex_genfv_reply_t *R); int xcb_glx_get_tex_genfv_data_length (const xcb_glx_get_tex_genfv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_tex_genfv_data_end (const xcb_glx_get_tex_genfv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_tex_genfv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_tex_genfv_reply_t * xcb_glx_get_tex_genfv_reply (xcb_connection_t *c, xcb_glx_get_tex_genfv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_tex_geniv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_tex_geniv_cookie_t xcb_glx_get_tex_geniv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t coord, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_tex_geniv_cookie_t xcb_glx_get_tex_geniv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t coord, uint32_t pname); int32_t * xcb_glx_get_tex_geniv_data (const xcb_glx_get_tex_geniv_reply_t *R); int xcb_glx_get_tex_geniv_data_length (const xcb_glx_get_tex_geniv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_tex_geniv_data_end (const xcb_glx_get_tex_geniv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_tex_geniv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_tex_geniv_reply_t * xcb_glx_get_tex_geniv_reply (xcb_connection_t *c, xcb_glx_get_tex_geniv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_tex_image_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_tex_image_cookie_t xcb_glx_get_tex_image (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, int32_t level, uint32_t format, uint32_t type, uint8_t swap_bytes); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_tex_image_cookie_t xcb_glx_get_tex_image_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, int32_t level, uint32_t format, uint32_t type, uint8_t swap_bytes); uint8_t * xcb_glx_get_tex_image_data (const xcb_glx_get_tex_image_reply_t *R); int xcb_glx_get_tex_image_data_length (const xcb_glx_get_tex_image_reply_t *R); xcb_generic_iterator_t xcb_glx_get_tex_image_data_end (const xcb_glx_get_tex_image_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_tex_image_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_tex_image_reply_t * xcb_glx_get_tex_image_reply (xcb_connection_t *c, xcb_glx_get_tex_image_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_tex_parameterfv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_tex_parameterfv_cookie_t xcb_glx_get_tex_parameterfv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_tex_parameterfv_cookie_t xcb_glx_get_tex_parameterfv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); xcb_glx_float32_t * xcb_glx_get_tex_parameterfv_data (const xcb_glx_get_tex_parameterfv_reply_t *R); int xcb_glx_get_tex_parameterfv_data_length (const xcb_glx_get_tex_parameterfv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_tex_parameterfv_data_end (const xcb_glx_get_tex_parameterfv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_tex_parameterfv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_tex_parameterfv_reply_t * xcb_glx_get_tex_parameterfv_reply (xcb_connection_t *c, xcb_glx_get_tex_parameterfv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_tex_parameteriv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_tex_parameteriv_cookie_t xcb_glx_get_tex_parameteriv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_tex_parameteriv_cookie_t xcb_glx_get_tex_parameteriv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); int32_t * xcb_glx_get_tex_parameteriv_data (const xcb_glx_get_tex_parameteriv_reply_t *R); int xcb_glx_get_tex_parameteriv_data_length (const xcb_glx_get_tex_parameteriv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_tex_parameteriv_data_end (const xcb_glx_get_tex_parameteriv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_tex_parameteriv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_tex_parameteriv_reply_t * xcb_glx_get_tex_parameteriv_reply (xcb_connection_t *c, xcb_glx_get_tex_parameteriv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_tex_level_parameterfv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_tex_level_parameterfv_cookie_t xcb_glx_get_tex_level_parameterfv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, int32_t level, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_tex_level_parameterfv_cookie_t xcb_glx_get_tex_level_parameterfv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, int32_t level, uint32_t pname); xcb_glx_float32_t * xcb_glx_get_tex_level_parameterfv_data (const xcb_glx_get_tex_level_parameterfv_reply_t *R); int xcb_glx_get_tex_level_parameterfv_data_length (const xcb_glx_get_tex_level_parameterfv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_tex_level_parameterfv_data_end (const xcb_glx_get_tex_level_parameterfv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_tex_level_parameterfv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_tex_level_parameterfv_reply_t * xcb_glx_get_tex_level_parameterfv_reply (xcb_connection_t *c, xcb_glx_get_tex_level_parameterfv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_tex_level_parameteriv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_tex_level_parameteriv_cookie_t xcb_glx_get_tex_level_parameteriv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, int32_t level, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_tex_level_parameteriv_cookie_t xcb_glx_get_tex_level_parameteriv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, int32_t level, uint32_t pname); int32_t * xcb_glx_get_tex_level_parameteriv_data (const xcb_glx_get_tex_level_parameteriv_reply_t *R); int xcb_glx_get_tex_level_parameteriv_data_length (const xcb_glx_get_tex_level_parameteriv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_tex_level_parameteriv_data_end (const xcb_glx_get_tex_level_parameteriv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_tex_level_parameteriv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_tex_level_parameteriv_reply_t * xcb_glx_get_tex_level_parameteriv_reply (xcb_connection_t *c, xcb_glx_get_tex_level_parameteriv_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_is_enabled_cookie_t xcb_glx_is_enabled (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t capability); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_is_enabled_cookie_t xcb_glx_is_enabled_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t capability); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_is_enabled_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_is_enabled_reply_t * xcb_glx_is_enabled_reply (xcb_connection_t *c, xcb_glx_is_enabled_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_is_list_cookie_t xcb_glx_is_list (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_is_list_cookie_t xcb_glx_is_list_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t list); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_is_list_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_is_list_reply_t * xcb_glx_is_list_reply (xcb_connection_t *c, xcb_glx_is_list_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_flush_checked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_flush (xcb_connection_t *c, xcb_glx_context_tag_t context_tag); int xcb_glx_are_textures_resident_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_are_textures_resident_cookie_t xcb_glx_are_textures_resident (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t n, const uint32_t *textures); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_are_textures_resident_cookie_t xcb_glx_are_textures_resident_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t n, const uint32_t *textures); uint8_t * xcb_glx_are_textures_resident_data (const xcb_glx_are_textures_resident_reply_t *R); int xcb_glx_are_textures_resident_data_length (const xcb_glx_are_textures_resident_reply_t *R); xcb_generic_iterator_t xcb_glx_are_textures_resident_data_end (const xcb_glx_are_textures_resident_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_are_textures_resident_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_are_textures_resident_reply_t * xcb_glx_are_textures_resident_reply (xcb_connection_t *c, xcb_glx_are_textures_resident_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_delete_textures_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_delete_textures_checked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t n, const uint32_t *textures); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_delete_textures (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t n, const uint32_t *textures); uint32_t * xcb_glx_delete_textures_textures (const xcb_glx_delete_textures_request_t *R); int xcb_glx_delete_textures_textures_length (const xcb_glx_delete_textures_request_t *R); xcb_generic_iterator_t xcb_glx_delete_textures_textures_end (const xcb_glx_delete_textures_request_t *R); int xcb_glx_gen_textures_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_gen_textures_cookie_t xcb_glx_gen_textures (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t n); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_gen_textures_cookie_t xcb_glx_gen_textures_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t n); uint32_t * xcb_glx_gen_textures_data (const xcb_glx_gen_textures_reply_t *R); int xcb_glx_gen_textures_data_length (const xcb_glx_gen_textures_reply_t *R); xcb_generic_iterator_t xcb_glx_gen_textures_data_end (const xcb_glx_gen_textures_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_gen_textures_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_gen_textures_reply_t * xcb_glx_gen_textures_reply (xcb_connection_t *c, xcb_glx_gen_textures_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_is_texture_cookie_t xcb_glx_is_texture (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t texture); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_is_texture_cookie_t xcb_glx_is_texture_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t texture); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_is_texture_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_is_texture_reply_t * xcb_glx_is_texture_reply (xcb_connection_t *c, xcb_glx_is_texture_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_color_table_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_color_table_cookie_t xcb_glx_get_color_table (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t format, uint32_t type, uint8_t swap_bytes); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_color_table_cookie_t xcb_glx_get_color_table_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t format, uint32_t type, uint8_t swap_bytes); uint8_t * xcb_glx_get_color_table_data (const xcb_glx_get_color_table_reply_t *R); int xcb_glx_get_color_table_data_length (const xcb_glx_get_color_table_reply_t *R); xcb_generic_iterator_t xcb_glx_get_color_table_data_end (const xcb_glx_get_color_table_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_color_table_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_color_table_reply_t * xcb_glx_get_color_table_reply (xcb_connection_t *c, xcb_glx_get_color_table_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_color_table_parameterfv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_color_table_parameterfv_cookie_t xcb_glx_get_color_table_parameterfv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_color_table_parameterfv_cookie_t xcb_glx_get_color_table_parameterfv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); xcb_glx_float32_t * xcb_glx_get_color_table_parameterfv_data (const xcb_glx_get_color_table_parameterfv_reply_t *R); int xcb_glx_get_color_table_parameterfv_data_length (const xcb_glx_get_color_table_parameterfv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_color_table_parameterfv_data_end (const xcb_glx_get_color_table_parameterfv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_color_table_parameterfv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_color_table_parameterfv_reply_t * xcb_glx_get_color_table_parameterfv_reply (xcb_connection_t *c, xcb_glx_get_color_table_parameterfv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_color_table_parameteriv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_color_table_parameteriv_cookie_t xcb_glx_get_color_table_parameteriv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_color_table_parameteriv_cookie_t xcb_glx_get_color_table_parameteriv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); int32_t * xcb_glx_get_color_table_parameteriv_data (const xcb_glx_get_color_table_parameteriv_reply_t *R); int xcb_glx_get_color_table_parameteriv_data_length (const xcb_glx_get_color_table_parameteriv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_color_table_parameteriv_data_end (const xcb_glx_get_color_table_parameteriv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_color_table_parameteriv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_color_table_parameteriv_reply_t * xcb_glx_get_color_table_parameteriv_reply (xcb_connection_t *c, xcb_glx_get_color_table_parameteriv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_convolution_filter_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_convolution_filter_cookie_t xcb_glx_get_convolution_filter (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t format, uint32_t type, uint8_t swap_bytes); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_convolution_filter_cookie_t xcb_glx_get_convolution_filter_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t format, uint32_t type, uint8_t swap_bytes); uint8_t * xcb_glx_get_convolution_filter_data (const xcb_glx_get_convolution_filter_reply_t *R); int xcb_glx_get_convolution_filter_data_length (const xcb_glx_get_convolution_filter_reply_t *R); xcb_generic_iterator_t xcb_glx_get_convolution_filter_data_end (const xcb_glx_get_convolution_filter_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_convolution_filter_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_convolution_filter_reply_t * xcb_glx_get_convolution_filter_reply (xcb_connection_t *c, xcb_glx_get_convolution_filter_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_convolution_parameterfv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_convolution_parameterfv_cookie_t xcb_glx_get_convolution_parameterfv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_convolution_parameterfv_cookie_t xcb_glx_get_convolution_parameterfv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); xcb_glx_float32_t * xcb_glx_get_convolution_parameterfv_data (const xcb_glx_get_convolution_parameterfv_reply_t *R); int xcb_glx_get_convolution_parameterfv_data_length (const xcb_glx_get_convolution_parameterfv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_convolution_parameterfv_data_end (const xcb_glx_get_convolution_parameterfv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_convolution_parameterfv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_convolution_parameterfv_reply_t * xcb_glx_get_convolution_parameterfv_reply (xcb_connection_t *c, xcb_glx_get_convolution_parameterfv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_convolution_parameteriv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_convolution_parameteriv_cookie_t xcb_glx_get_convolution_parameteriv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_convolution_parameteriv_cookie_t xcb_glx_get_convolution_parameteriv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); int32_t * xcb_glx_get_convolution_parameteriv_data (const xcb_glx_get_convolution_parameteriv_reply_t *R); int xcb_glx_get_convolution_parameteriv_data_length (const xcb_glx_get_convolution_parameteriv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_convolution_parameteriv_data_end (const xcb_glx_get_convolution_parameteriv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_convolution_parameteriv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_convolution_parameteriv_reply_t * xcb_glx_get_convolution_parameteriv_reply (xcb_connection_t *c, xcb_glx_get_convolution_parameteriv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_separable_filter_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_separable_filter_cookie_t xcb_glx_get_separable_filter (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t format, uint32_t type, uint8_t swap_bytes); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_separable_filter_cookie_t xcb_glx_get_separable_filter_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t format, uint32_t type, uint8_t swap_bytes); uint8_t * xcb_glx_get_separable_filter_rows_and_cols (const xcb_glx_get_separable_filter_reply_t *R); int xcb_glx_get_separable_filter_rows_and_cols_length (const xcb_glx_get_separable_filter_reply_t *R); xcb_generic_iterator_t xcb_glx_get_separable_filter_rows_and_cols_end (const xcb_glx_get_separable_filter_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_separable_filter_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_separable_filter_reply_t * xcb_glx_get_separable_filter_reply (xcb_connection_t *c, xcb_glx_get_separable_filter_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_histogram_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_histogram_cookie_t xcb_glx_get_histogram (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t format, uint32_t type, uint8_t swap_bytes, uint8_t reset); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_histogram_cookie_t xcb_glx_get_histogram_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t format, uint32_t type, uint8_t swap_bytes, uint8_t reset); uint8_t * xcb_glx_get_histogram_data (const xcb_glx_get_histogram_reply_t *R); int xcb_glx_get_histogram_data_length (const xcb_glx_get_histogram_reply_t *R); xcb_generic_iterator_t xcb_glx_get_histogram_data_end (const xcb_glx_get_histogram_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_histogram_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_histogram_reply_t * xcb_glx_get_histogram_reply (xcb_connection_t *c, xcb_glx_get_histogram_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_histogram_parameterfv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_histogram_parameterfv_cookie_t xcb_glx_get_histogram_parameterfv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_histogram_parameterfv_cookie_t xcb_glx_get_histogram_parameterfv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); xcb_glx_float32_t * xcb_glx_get_histogram_parameterfv_data (const xcb_glx_get_histogram_parameterfv_reply_t *R); int xcb_glx_get_histogram_parameterfv_data_length (const xcb_glx_get_histogram_parameterfv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_histogram_parameterfv_data_end (const xcb_glx_get_histogram_parameterfv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_histogram_parameterfv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_histogram_parameterfv_reply_t * xcb_glx_get_histogram_parameterfv_reply (xcb_connection_t *c, xcb_glx_get_histogram_parameterfv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_histogram_parameteriv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_histogram_parameteriv_cookie_t xcb_glx_get_histogram_parameteriv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_histogram_parameteriv_cookie_t xcb_glx_get_histogram_parameteriv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); int32_t * xcb_glx_get_histogram_parameteriv_data (const xcb_glx_get_histogram_parameteriv_reply_t *R); int xcb_glx_get_histogram_parameteriv_data_length (const xcb_glx_get_histogram_parameteriv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_histogram_parameteriv_data_end (const xcb_glx_get_histogram_parameteriv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_histogram_parameteriv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_histogram_parameteriv_reply_t * xcb_glx_get_histogram_parameteriv_reply (xcb_connection_t *c, xcb_glx_get_histogram_parameteriv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_minmax_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_minmax_cookie_t xcb_glx_get_minmax (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t format, uint32_t type, uint8_t swap_bytes, uint8_t reset); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_minmax_cookie_t xcb_glx_get_minmax_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t format, uint32_t type, uint8_t swap_bytes, uint8_t reset); uint8_t * xcb_glx_get_minmax_data (const xcb_glx_get_minmax_reply_t *R); int xcb_glx_get_minmax_data_length (const xcb_glx_get_minmax_reply_t *R); xcb_generic_iterator_t xcb_glx_get_minmax_data_end (const xcb_glx_get_minmax_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_minmax_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_minmax_reply_t * xcb_glx_get_minmax_reply (xcb_connection_t *c, xcb_glx_get_minmax_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_minmax_parameterfv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_minmax_parameterfv_cookie_t xcb_glx_get_minmax_parameterfv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_minmax_parameterfv_cookie_t xcb_glx_get_minmax_parameterfv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); xcb_glx_float32_t * xcb_glx_get_minmax_parameterfv_data (const xcb_glx_get_minmax_parameterfv_reply_t *R); int xcb_glx_get_minmax_parameterfv_data_length (const xcb_glx_get_minmax_parameterfv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_minmax_parameterfv_data_end (const xcb_glx_get_minmax_parameterfv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_minmax_parameterfv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_minmax_parameterfv_reply_t * xcb_glx_get_minmax_parameterfv_reply (xcb_connection_t *c, xcb_glx_get_minmax_parameterfv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_minmax_parameteriv_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_minmax_parameteriv_cookie_t xcb_glx_get_minmax_parameteriv (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_minmax_parameteriv_cookie_t xcb_glx_get_minmax_parameteriv_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); int32_t * xcb_glx_get_minmax_parameteriv_data (const xcb_glx_get_minmax_parameteriv_reply_t *R); int xcb_glx_get_minmax_parameteriv_data_length (const xcb_glx_get_minmax_parameteriv_reply_t *R); xcb_generic_iterator_t xcb_glx_get_minmax_parameteriv_data_end (const xcb_glx_get_minmax_parameteriv_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_minmax_parameteriv_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_minmax_parameteriv_reply_t * xcb_glx_get_minmax_parameteriv_reply (xcb_connection_t *c, xcb_glx_get_minmax_parameteriv_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_compressed_tex_image_arb_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_compressed_tex_image_arb_cookie_t xcb_glx_get_compressed_tex_image_arb (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, int32_t level); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_compressed_tex_image_arb_cookie_t xcb_glx_get_compressed_tex_image_arb_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, int32_t level); uint8_t * xcb_glx_get_compressed_tex_image_arb_data (const xcb_glx_get_compressed_tex_image_arb_reply_t *R); int xcb_glx_get_compressed_tex_image_arb_data_length (const xcb_glx_get_compressed_tex_image_arb_reply_t *R); xcb_generic_iterator_t xcb_glx_get_compressed_tex_image_arb_data_end (const xcb_glx_get_compressed_tex_image_arb_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_compressed_tex_image_arb_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_compressed_tex_image_arb_reply_t * xcb_glx_get_compressed_tex_image_arb_reply (xcb_connection_t *c, xcb_glx_get_compressed_tex_image_arb_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_delete_queries_arb_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_glx_delete_queries_arb_checked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t n, const uint32_t *ids); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_glx_delete_queries_arb (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t n, const uint32_t *ids); uint32_t * xcb_glx_delete_queries_arb_ids (const xcb_glx_delete_queries_arb_request_t *R); int xcb_glx_delete_queries_arb_ids_length (const xcb_glx_delete_queries_arb_request_t *R); xcb_generic_iterator_t xcb_glx_delete_queries_arb_ids_end (const xcb_glx_delete_queries_arb_request_t *R); int xcb_glx_gen_queries_arb_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_gen_queries_arb_cookie_t xcb_glx_gen_queries_arb (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t n); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_gen_queries_arb_cookie_t xcb_glx_gen_queries_arb_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, int32_t n); uint32_t * xcb_glx_gen_queries_arb_data (const xcb_glx_gen_queries_arb_reply_t *R); int xcb_glx_gen_queries_arb_data_length (const xcb_glx_gen_queries_arb_reply_t *R); xcb_generic_iterator_t xcb_glx_gen_queries_arb_data_end (const xcb_glx_gen_queries_arb_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_gen_queries_arb_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_gen_queries_arb_reply_t * xcb_glx_gen_queries_arb_reply (xcb_connection_t *c, xcb_glx_gen_queries_arb_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_is_query_arb_cookie_t xcb_glx_is_query_arb (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_is_query_arb_cookie_t xcb_glx_is_query_arb_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t id); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_is_query_arb_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_is_query_arb_reply_t * xcb_glx_is_query_arb_reply (xcb_connection_t *c, xcb_glx_is_query_arb_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_queryiv_arb_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_queryiv_arb_cookie_t xcb_glx_get_queryiv_arb (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_queryiv_arb_cookie_t xcb_glx_get_queryiv_arb_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t target, uint32_t pname); int32_t * xcb_glx_get_queryiv_arb_data (const xcb_glx_get_queryiv_arb_reply_t *R); int xcb_glx_get_queryiv_arb_data_length (const xcb_glx_get_queryiv_arb_reply_t *R); xcb_generic_iterator_t xcb_glx_get_queryiv_arb_data_end (const xcb_glx_get_queryiv_arb_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_queryiv_arb_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_queryiv_arb_reply_t * xcb_glx_get_queryiv_arb_reply (xcb_connection_t *c, xcb_glx_get_queryiv_arb_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_query_objectiv_arb_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_query_objectiv_arb_cookie_t xcb_glx_get_query_objectiv_arb (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t id, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_query_objectiv_arb_cookie_t xcb_glx_get_query_objectiv_arb_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t id, uint32_t pname); int32_t * xcb_glx_get_query_objectiv_arb_data (const xcb_glx_get_query_objectiv_arb_reply_t *R); int xcb_glx_get_query_objectiv_arb_data_length (const xcb_glx_get_query_objectiv_arb_reply_t *R); xcb_generic_iterator_t xcb_glx_get_query_objectiv_arb_data_end (const xcb_glx_get_query_objectiv_arb_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_query_objectiv_arb_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_query_objectiv_arb_reply_t * xcb_glx_get_query_objectiv_arb_reply (xcb_connection_t *c, xcb_glx_get_query_objectiv_arb_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_glx_get_query_objectuiv_arb_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_glx_get_query_objectuiv_arb_cookie_t xcb_glx_get_query_objectuiv_arb (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t id, uint32_t pname); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_glx_get_query_objectuiv_arb_cookie_t xcb_glx_get_query_objectuiv_arb_unchecked (xcb_connection_t *c, xcb_glx_context_tag_t context_tag, uint32_t id, uint32_t pname); uint32_t * xcb_glx_get_query_objectuiv_arb_data (const xcb_glx_get_query_objectuiv_arb_reply_t *R); int xcb_glx_get_query_objectuiv_arb_data_length (const xcb_glx_get_query_objectuiv_arb_reply_t *R); xcb_generic_iterator_t xcb_glx_get_query_objectuiv_arb_data_end (const xcb_glx_get_query_objectuiv_arb_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_glx_get_query_objectuiv_arb_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_glx_get_query_objectuiv_arb_reply_t * xcb_glx_get_query_objectuiv_arb_reply (xcb_connection_t *c, xcb_glx_get_query_objectuiv_arb_cookie_t cookie /**< */, xcb_generic_error_t **e); #ifdef __cplusplus } #endif #endif /** * @} */ ��������������������������������������������������������������������������������������������������������������xcb/damage.h����������������������������������������������������������������������������������������0000644�����������������00000022105�14763166026�0006722 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from damage.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_Damage_API XCB Damage API * @brief Damage XCB Protocol Implementation. * @{ **/ #ifndef __DAMAGE_H #define __DAMAGE_H #include "xcb.h" #include "xproto.h" #include "xfixes.h" #ifdef __cplusplus extern "C" { #endif #define XCB_DAMAGE_MAJOR_VERSION 1 #define XCB_DAMAGE_MINOR_VERSION 1 extern xcb_extension_t xcb_damage_id; typedef uint32_t xcb_damage_damage_t; /** * @brief xcb_damage_damage_iterator_t **/ typedef struct xcb_damage_damage_iterator_t { xcb_damage_damage_t *data; int rem; int index; } xcb_damage_damage_iterator_t; typedef enum xcb_damage_report_level_t { XCB_DAMAGE_REPORT_LEVEL_RAW_RECTANGLES = 0, XCB_DAMAGE_REPORT_LEVEL_DELTA_RECTANGLES = 1, XCB_DAMAGE_REPORT_LEVEL_BOUNDING_BOX = 2, XCB_DAMAGE_REPORT_LEVEL_NON_EMPTY = 3 } xcb_damage_report_level_t; /** Opcode for xcb_damage_bad_damage. */ #define XCB_DAMAGE_BAD_DAMAGE 0 /** * @brief xcb_damage_bad_damage_error_t **/ typedef struct xcb_damage_bad_damage_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_damage_bad_damage_error_t; /** * @brief xcb_damage_query_version_cookie_t **/ typedef struct xcb_damage_query_version_cookie_t { unsigned int sequence; } xcb_damage_query_version_cookie_t; /** Opcode for xcb_damage_query_version. */ #define XCB_DAMAGE_QUERY_VERSION 0 /** * @brief xcb_damage_query_version_request_t **/ typedef struct xcb_damage_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t client_major_version; uint32_t client_minor_version; } xcb_damage_query_version_request_t; /** * @brief xcb_damage_query_version_reply_t **/ typedef struct xcb_damage_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t major_version; uint32_t minor_version; uint8_t pad1[16]; } xcb_damage_query_version_reply_t; /** Opcode for xcb_damage_create. */ #define XCB_DAMAGE_CREATE 1 /** * @brief xcb_damage_create_request_t **/ typedef struct xcb_damage_create_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_damage_damage_t damage; xcb_drawable_t drawable; uint8_t level; uint8_t pad0[3]; } xcb_damage_create_request_t; /** Opcode for xcb_damage_destroy. */ #define XCB_DAMAGE_DESTROY 2 /** * @brief xcb_damage_destroy_request_t **/ typedef struct xcb_damage_destroy_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_damage_damage_t damage; } xcb_damage_destroy_request_t; /** Opcode for xcb_damage_subtract. */ #define XCB_DAMAGE_SUBTRACT 3 /** * @brief xcb_damage_subtract_request_t **/ typedef struct xcb_damage_subtract_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_damage_damage_t damage; xcb_xfixes_region_t repair; xcb_xfixes_region_t parts; } xcb_damage_subtract_request_t; /** Opcode for xcb_damage_add. */ #define XCB_DAMAGE_ADD 4 /** * @brief xcb_damage_add_request_t **/ typedef struct xcb_damage_add_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; xcb_xfixes_region_t region; } xcb_damage_add_request_t; /** Opcode for xcb_damage_notify. */ #define XCB_DAMAGE_NOTIFY 0 /** * @brief xcb_damage_notify_event_t **/ typedef struct xcb_damage_notify_event_t { uint8_t response_type; uint8_t level; uint16_t sequence; xcb_drawable_t drawable; xcb_damage_damage_t damage; xcb_timestamp_t timestamp; xcb_rectangle_t area; xcb_rectangle_t geometry; } xcb_damage_notify_event_t; /** * Get the next element of the iterator * @param i Pointer to a xcb_damage_damage_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_damage_damage_t) */ void xcb_damage_damage_next (xcb_damage_damage_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_damage_damage_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_damage_damage_end (xcb_damage_damage_iterator_t i); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_damage_query_version_cookie_t xcb_damage_query_version (xcb_connection_t *c, uint32_t client_major_version, uint32_t client_minor_version); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_damage_query_version_cookie_t xcb_damage_query_version_unchecked (xcb_connection_t *c, uint32_t client_major_version, uint32_t client_minor_version); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_damage_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_damage_query_version_reply_t * xcb_damage_query_version_reply (xcb_connection_t *c, xcb_damage_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_damage_create_checked (xcb_connection_t *c, xcb_damage_damage_t damage, xcb_drawable_t drawable, uint8_t level); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_damage_create (xcb_connection_t *c, xcb_damage_damage_t damage, xcb_drawable_t drawable, uint8_t level); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_damage_destroy_checked (xcb_connection_t *c, xcb_damage_damage_t damage); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_damage_destroy (xcb_connection_t *c, xcb_damage_damage_t damage); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_damage_subtract_checked (xcb_connection_t *c, xcb_damage_damage_t damage, xcb_xfixes_region_t repair, xcb_xfixes_region_t parts); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_damage_subtract (xcb_connection_t *c, xcb_damage_damage_t damage, xcb_xfixes_region_t repair, xcb_xfixes_region_t parts); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_damage_add_checked (xcb_connection_t *c, xcb_drawable_t drawable, xcb_xfixes_region_t region); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_damage_add (xcb_connection_t *c, xcb_drawable_t drawable, xcb_xfixes_region_t region); #ifdef __cplusplus } #endif #endif /** * @} */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/xc_misc.h���������������������������������������������������������������������������������������0000644�����������������00000015741�14763166026�0007141 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from xc_misc.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_XCMisc_API XCB XCMisc API * @brief XCMisc XCB Protocol Implementation. * @{ **/ #ifndef __XC_MISC_H #define __XC_MISC_H #include "xcb.h" #ifdef __cplusplus extern "C" { #endif #define XCB_XCMISC_MAJOR_VERSION 1 #define XCB_XCMISC_MINOR_VERSION 1 extern xcb_extension_t xcb_xc_misc_id; /** * @brief xcb_xc_misc_get_version_cookie_t **/ typedef struct xcb_xc_misc_get_version_cookie_t { unsigned int sequence; } xcb_xc_misc_get_version_cookie_t; /** Opcode for xcb_xc_misc_get_version. */ #define XCB_XC_MISC_GET_VERSION 0 /** * @brief xcb_xc_misc_get_version_request_t **/ typedef struct xcb_xc_misc_get_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint16_t client_major_version; uint16_t client_minor_version; } xcb_xc_misc_get_version_request_t; /** * @brief xcb_xc_misc_get_version_reply_t **/ typedef struct xcb_xc_misc_get_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t server_major_version; uint16_t server_minor_version; } xcb_xc_misc_get_version_reply_t; /** * @brief xcb_xc_misc_get_xid_range_cookie_t **/ typedef struct xcb_xc_misc_get_xid_range_cookie_t { unsigned int sequence; } xcb_xc_misc_get_xid_range_cookie_t; /** Opcode for xcb_xc_misc_get_xid_range. */ #define XCB_XC_MISC_GET_XID_RANGE 1 /** * @brief xcb_xc_misc_get_xid_range_request_t **/ typedef struct xcb_xc_misc_get_xid_range_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_xc_misc_get_xid_range_request_t; /** * @brief xcb_xc_misc_get_xid_range_reply_t **/ typedef struct xcb_xc_misc_get_xid_range_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t start_id; uint32_t count; } xcb_xc_misc_get_xid_range_reply_t; /** * @brief xcb_xc_misc_get_xid_list_cookie_t **/ typedef struct xcb_xc_misc_get_xid_list_cookie_t { unsigned int sequence; } xcb_xc_misc_get_xid_list_cookie_t; /** Opcode for xcb_xc_misc_get_xid_list. */ #define XCB_XC_MISC_GET_XID_LIST 2 /** * @brief xcb_xc_misc_get_xid_list_request_t **/ typedef struct xcb_xc_misc_get_xid_list_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t count; } xcb_xc_misc_get_xid_list_request_t; /** * @brief xcb_xc_misc_get_xid_list_reply_t **/ typedef struct xcb_xc_misc_get_xid_list_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t ids_len; uint8_t pad1[20]; } xcb_xc_misc_get_xid_list_reply_t; /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xc_misc_get_version_cookie_t xcb_xc_misc_get_version (xcb_connection_t *c, uint16_t client_major_version, uint16_t client_minor_version); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xc_misc_get_version_cookie_t xcb_xc_misc_get_version_unchecked (xcb_connection_t *c, uint16_t client_major_version, uint16_t client_minor_version); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xc_misc_get_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xc_misc_get_version_reply_t * xcb_xc_misc_get_version_reply (xcb_connection_t *c, xcb_xc_misc_get_version_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xc_misc_get_xid_range_cookie_t xcb_xc_misc_get_xid_range (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xc_misc_get_xid_range_cookie_t xcb_xc_misc_get_xid_range_unchecked (xcb_connection_t *c); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xc_misc_get_xid_range_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xc_misc_get_xid_range_reply_t * xcb_xc_misc_get_xid_range_reply (xcb_connection_t *c, xcb_xc_misc_get_xid_range_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xc_misc_get_xid_list_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xc_misc_get_xid_list_cookie_t xcb_xc_misc_get_xid_list (xcb_connection_t *c, uint32_t count); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xc_misc_get_xid_list_cookie_t xcb_xc_misc_get_xid_list_unchecked (xcb_connection_t *c, uint32_t count); uint32_t * xcb_xc_misc_get_xid_list_ids (const xcb_xc_misc_get_xid_list_reply_t *R); int xcb_xc_misc_get_xid_list_ids_length (const xcb_xc_misc_get_xid_list_reply_t *R); xcb_generic_iterator_t xcb_xc_misc_get_xid_list_ids_end (const xcb_xc_misc_get_xid_list_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xc_misc_get_xid_list_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xc_misc_get_xid_list_reply_t * xcb_xc_misc_get_xid_list_reply (xcb_connection_t *c, xcb_xc_misc_get_xid_list_cookie_t cookie /**< */, xcb_generic_error_t **e); #ifdef __cplusplus } #endif #endif /** * @} */ �������������������������������xcb/xfixes.h����������������������������������������������������������������������������������������0000644�����������������00000161337�14763166026�0007025 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from xfixes.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_XFixes_API XCB XFixes API * @brief XFixes XCB Protocol Implementation. * @{ **/ #ifndef __XFIXES_H #define __XFIXES_H #include "xcb.h" #include "xproto.h" #include "render.h" #include "shape.h" #ifdef __cplusplus extern "C" { #endif #define XCB_XFIXES_MAJOR_VERSION 5 #define XCB_XFIXES_MINOR_VERSION 0 extern xcb_extension_t xcb_xfixes_id; /** * @brief xcb_xfixes_query_version_cookie_t **/ typedef struct xcb_xfixes_query_version_cookie_t { unsigned int sequence; } xcb_xfixes_query_version_cookie_t; /** Opcode for xcb_xfixes_query_version. */ #define XCB_XFIXES_QUERY_VERSION 0 /** * @brief xcb_xfixes_query_version_request_t **/ typedef struct xcb_xfixes_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t client_major_version; uint32_t client_minor_version; } xcb_xfixes_query_version_request_t; /** * @brief xcb_xfixes_query_version_reply_t **/ typedef struct xcb_xfixes_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t major_version; uint32_t minor_version; uint8_t pad1[16]; } xcb_xfixes_query_version_reply_t; typedef enum xcb_xfixes_save_set_mode_t { XCB_XFIXES_SAVE_SET_MODE_INSERT = 0, XCB_XFIXES_SAVE_SET_MODE_DELETE = 1 } xcb_xfixes_save_set_mode_t; typedef enum xcb_xfixes_save_set_target_t { XCB_XFIXES_SAVE_SET_TARGET_NEAREST = 0, XCB_XFIXES_SAVE_SET_TARGET_ROOT = 1 } xcb_xfixes_save_set_target_t; typedef enum xcb_xfixes_save_set_mapping_t { XCB_XFIXES_SAVE_SET_MAPPING_MAP = 0, XCB_XFIXES_SAVE_SET_MAPPING_UNMAP = 1 } xcb_xfixes_save_set_mapping_t; /** Opcode for xcb_xfixes_change_save_set. */ #define XCB_XFIXES_CHANGE_SAVE_SET 1 /** * @brief xcb_xfixes_change_save_set_request_t **/ typedef struct xcb_xfixes_change_save_set_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t mode; uint8_t target; uint8_t map; uint8_t pad0; xcb_window_t window; } xcb_xfixes_change_save_set_request_t; typedef enum xcb_xfixes_selection_event_t { XCB_XFIXES_SELECTION_EVENT_SET_SELECTION_OWNER = 0, XCB_XFIXES_SELECTION_EVENT_SELECTION_WINDOW_DESTROY = 1, XCB_XFIXES_SELECTION_EVENT_SELECTION_CLIENT_CLOSE = 2 } xcb_xfixes_selection_event_t; typedef enum xcb_xfixes_selection_event_mask_t { XCB_XFIXES_SELECTION_EVENT_MASK_SET_SELECTION_OWNER = 1, XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_WINDOW_DESTROY = 2, XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_CLIENT_CLOSE = 4 } xcb_xfixes_selection_event_mask_t; /** Opcode for xcb_xfixes_selection_notify. */ #define XCB_XFIXES_SELECTION_NOTIFY 0 /** * @brief xcb_xfixes_selection_notify_event_t **/ typedef struct xcb_xfixes_selection_notify_event_t { uint8_t response_type; uint8_t subtype; uint16_t sequence; xcb_window_t window; xcb_window_t owner; xcb_atom_t selection; xcb_timestamp_t timestamp; xcb_timestamp_t selection_timestamp; uint8_t pad0[8]; } xcb_xfixes_selection_notify_event_t; /** Opcode for xcb_xfixes_select_selection_input. */ #define XCB_XFIXES_SELECT_SELECTION_INPUT 2 /** * @brief xcb_xfixes_select_selection_input_request_t **/ typedef struct xcb_xfixes_select_selection_input_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; xcb_atom_t selection; uint32_t event_mask; } xcb_xfixes_select_selection_input_request_t; typedef enum xcb_xfixes_cursor_notify_t { XCB_XFIXES_CURSOR_NOTIFY_DISPLAY_CURSOR = 0 } xcb_xfixes_cursor_notify_t; typedef enum xcb_xfixes_cursor_notify_mask_t { XCB_XFIXES_CURSOR_NOTIFY_MASK_DISPLAY_CURSOR = 1 } xcb_xfixes_cursor_notify_mask_t; /** Opcode for xcb_xfixes_cursor_notify. */ #define XCB_XFIXES_CURSOR_NOTIFY 1 /** * @brief xcb_xfixes_cursor_notify_event_t **/ typedef struct xcb_xfixes_cursor_notify_event_t { uint8_t response_type; uint8_t subtype; uint16_t sequence; xcb_window_t window; uint32_t cursor_serial; xcb_timestamp_t timestamp; xcb_atom_t name; uint8_t pad0[12]; } xcb_xfixes_cursor_notify_event_t; /** Opcode for xcb_xfixes_select_cursor_input. */ #define XCB_XFIXES_SELECT_CURSOR_INPUT 3 /** * @brief xcb_xfixes_select_cursor_input_request_t **/ typedef struct xcb_xfixes_select_cursor_input_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; uint32_t event_mask; } xcb_xfixes_select_cursor_input_request_t; /** * @brief xcb_xfixes_get_cursor_image_cookie_t **/ typedef struct xcb_xfixes_get_cursor_image_cookie_t { unsigned int sequence; } xcb_xfixes_get_cursor_image_cookie_t; /** Opcode for xcb_xfixes_get_cursor_image. */ #define XCB_XFIXES_GET_CURSOR_IMAGE 4 /** * @brief xcb_xfixes_get_cursor_image_request_t **/ typedef struct xcb_xfixes_get_cursor_image_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_xfixes_get_cursor_image_request_t; /** * @brief xcb_xfixes_get_cursor_image_reply_t **/ typedef struct xcb_xfixes_get_cursor_image_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; int16_t x; int16_t y; uint16_t width; uint16_t height; uint16_t xhot; uint16_t yhot; uint32_t cursor_serial; uint8_t pad1[8]; } xcb_xfixes_get_cursor_image_reply_t; typedef uint32_t xcb_xfixes_region_t; /** * @brief xcb_xfixes_region_iterator_t **/ typedef struct xcb_xfixes_region_iterator_t { xcb_xfixes_region_t *data; int rem; int index; } xcb_xfixes_region_iterator_t; /** Opcode for xcb_xfixes_bad_region. */ #define XCB_XFIXES_BAD_REGION 0 /** * @brief xcb_xfixes_bad_region_error_t **/ typedef struct xcb_xfixes_bad_region_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_xfixes_bad_region_error_t; typedef enum xcb_xfixes_region_enum_t { XCB_XFIXES_REGION_NONE = 0 } xcb_xfixes_region_enum_t; /** Opcode for xcb_xfixes_create_region. */ #define XCB_XFIXES_CREATE_REGION 5 /** * @brief xcb_xfixes_create_region_request_t **/ typedef struct xcb_xfixes_create_region_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xfixes_region_t region; } xcb_xfixes_create_region_request_t; /** Opcode for xcb_xfixes_create_region_from_bitmap. */ #define XCB_XFIXES_CREATE_REGION_FROM_BITMAP 6 /** * @brief xcb_xfixes_create_region_from_bitmap_request_t **/ typedef struct xcb_xfixes_create_region_from_bitmap_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xfixes_region_t region; xcb_pixmap_t bitmap; } xcb_xfixes_create_region_from_bitmap_request_t; /** Opcode for xcb_xfixes_create_region_from_window. */ #define XCB_XFIXES_CREATE_REGION_FROM_WINDOW 7 /** * @brief xcb_xfixes_create_region_from_window_request_t **/ typedef struct xcb_xfixes_create_region_from_window_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xfixes_region_t region; xcb_window_t window; xcb_shape_kind_t kind; uint8_t pad0[3]; } xcb_xfixes_create_region_from_window_request_t; /** Opcode for xcb_xfixes_create_region_from_gc. */ #define XCB_XFIXES_CREATE_REGION_FROM_GC 8 /** * @brief xcb_xfixes_create_region_from_gc_request_t **/ typedef struct xcb_xfixes_create_region_from_gc_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xfixes_region_t region; xcb_gcontext_t gc; } xcb_xfixes_create_region_from_gc_request_t; /** Opcode for xcb_xfixes_create_region_from_picture. */ #define XCB_XFIXES_CREATE_REGION_FROM_PICTURE 9 /** * @brief xcb_xfixes_create_region_from_picture_request_t **/ typedef struct xcb_xfixes_create_region_from_picture_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xfixes_region_t region; xcb_render_picture_t picture; } xcb_xfixes_create_region_from_picture_request_t; /** Opcode for xcb_xfixes_destroy_region. */ #define XCB_XFIXES_DESTROY_REGION 10 /** * @brief xcb_xfixes_destroy_region_request_t **/ typedef struct xcb_xfixes_destroy_region_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xfixes_region_t region; } xcb_xfixes_destroy_region_request_t; /** Opcode for xcb_xfixes_set_region. */ #define XCB_XFIXES_SET_REGION 11 /** * @brief xcb_xfixes_set_region_request_t **/ typedef struct xcb_xfixes_set_region_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xfixes_region_t region; } xcb_xfixes_set_region_request_t; /** Opcode for xcb_xfixes_copy_region. */ #define XCB_XFIXES_COPY_REGION 12 /** * @brief xcb_xfixes_copy_region_request_t **/ typedef struct xcb_xfixes_copy_region_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xfixes_region_t source; xcb_xfixes_region_t destination; } xcb_xfixes_copy_region_request_t; /** Opcode for xcb_xfixes_union_region. */ #define XCB_XFIXES_UNION_REGION 13 /** * @brief xcb_xfixes_union_region_request_t **/ typedef struct xcb_xfixes_union_region_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xfixes_region_t source1; xcb_xfixes_region_t source2; xcb_xfixes_region_t destination; } xcb_xfixes_union_region_request_t; /** Opcode for xcb_xfixes_intersect_region. */ #define XCB_XFIXES_INTERSECT_REGION 14 /** * @brief xcb_xfixes_intersect_region_request_t **/ typedef struct xcb_xfixes_intersect_region_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xfixes_region_t source1; xcb_xfixes_region_t source2; xcb_xfixes_region_t destination; } xcb_xfixes_intersect_region_request_t; /** Opcode for xcb_xfixes_subtract_region. */ #define XCB_XFIXES_SUBTRACT_REGION 15 /** * @brief xcb_xfixes_subtract_region_request_t **/ typedef struct xcb_xfixes_subtract_region_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xfixes_region_t source1; xcb_xfixes_region_t source2; xcb_xfixes_region_t destination; } xcb_xfixes_subtract_region_request_t; /** Opcode for xcb_xfixes_invert_region. */ #define XCB_XFIXES_INVERT_REGION 16 /** * @brief xcb_xfixes_invert_region_request_t **/ typedef struct xcb_xfixes_invert_region_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xfixes_region_t source; xcb_rectangle_t bounds; xcb_xfixes_region_t destination; } xcb_xfixes_invert_region_request_t; /** Opcode for xcb_xfixes_translate_region. */ #define XCB_XFIXES_TRANSLATE_REGION 17 /** * @brief xcb_xfixes_translate_region_request_t **/ typedef struct xcb_xfixes_translate_region_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xfixes_region_t region; int16_t dx; int16_t dy; } xcb_xfixes_translate_region_request_t; /** Opcode for xcb_xfixes_region_extents. */ #define XCB_XFIXES_REGION_EXTENTS 18 /** * @brief xcb_xfixes_region_extents_request_t **/ typedef struct xcb_xfixes_region_extents_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xfixes_region_t source; xcb_xfixes_region_t destination; } xcb_xfixes_region_extents_request_t; /** * @brief xcb_xfixes_fetch_region_cookie_t **/ typedef struct xcb_xfixes_fetch_region_cookie_t { unsigned int sequence; } xcb_xfixes_fetch_region_cookie_t; /** Opcode for xcb_xfixes_fetch_region. */ #define XCB_XFIXES_FETCH_REGION 19 /** * @brief xcb_xfixes_fetch_region_request_t **/ typedef struct xcb_xfixes_fetch_region_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xfixes_region_t region; } xcb_xfixes_fetch_region_request_t; /** * @brief xcb_xfixes_fetch_region_reply_t **/ typedef struct xcb_xfixes_fetch_region_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_rectangle_t extents; uint8_t pad1[16]; } xcb_xfixes_fetch_region_reply_t; /** Opcode for xcb_xfixes_set_gc_clip_region. */ #define XCB_XFIXES_SET_GC_CLIP_REGION 20 /** * @brief xcb_xfixes_set_gc_clip_region_request_t **/ typedef struct xcb_xfixes_set_gc_clip_region_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_gcontext_t gc; xcb_xfixes_region_t region; int16_t x_origin; int16_t y_origin; } xcb_xfixes_set_gc_clip_region_request_t; /** Opcode for xcb_xfixes_set_window_shape_region. */ #define XCB_XFIXES_SET_WINDOW_SHAPE_REGION 21 /** * @brief xcb_xfixes_set_window_shape_region_request_t **/ typedef struct xcb_xfixes_set_window_shape_region_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t dest; xcb_shape_kind_t dest_kind; uint8_t pad0[3]; int16_t x_offset; int16_t y_offset; xcb_xfixes_region_t region; } xcb_xfixes_set_window_shape_region_request_t; /** Opcode for xcb_xfixes_set_picture_clip_region. */ #define XCB_XFIXES_SET_PICTURE_CLIP_REGION 22 /** * @brief xcb_xfixes_set_picture_clip_region_request_t **/ typedef struct xcb_xfixes_set_picture_clip_region_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_render_picture_t picture; xcb_xfixes_region_t region; int16_t x_origin; int16_t y_origin; } xcb_xfixes_set_picture_clip_region_request_t; /** Opcode for xcb_xfixes_set_cursor_name. */ #define XCB_XFIXES_SET_CURSOR_NAME 23 /** * @brief xcb_xfixes_set_cursor_name_request_t **/ typedef struct xcb_xfixes_set_cursor_name_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_cursor_t cursor; uint16_t nbytes; uint8_t pad0[2]; } xcb_xfixes_set_cursor_name_request_t; /** * @brief xcb_xfixes_get_cursor_name_cookie_t **/ typedef struct xcb_xfixes_get_cursor_name_cookie_t { unsigned int sequence; } xcb_xfixes_get_cursor_name_cookie_t; /** Opcode for xcb_xfixes_get_cursor_name. */ #define XCB_XFIXES_GET_CURSOR_NAME 24 /** * @brief xcb_xfixes_get_cursor_name_request_t **/ typedef struct xcb_xfixes_get_cursor_name_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_cursor_t cursor; } xcb_xfixes_get_cursor_name_request_t; /** * @brief xcb_xfixes_get_cursor_name_reply_t **/ typedef struct xcb_xfixes_get_cursor_name_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_atom_t atom; uint16_t nbytes; uint8_t pad1[18]; } xcb_xfixes_get_cursor_name_reply_t; /** * @brief xcb_xfixes_get_cursor_image_and_name_cookie_t **/ typedef struct xcb_xfixes_get_cursor_image_and_name_cookie_t { unsigned int sequence; } xcb_xfixes_get_cursor_image_and_name_cookie_t; /** Opcode for xcb_xfixes_get_cursor_image_and_name. */ #define XCB_XFIXES_GET_CURSOR_IMAGE_AND_NAME 25 /** * @brief xcb_xfixes_get_cursor_image_and_name_request_t **/ typedef struct xcb_xfixes_get_cursor_image_and_name_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_xfixes_get_cursor_image_and_name_request_t; /** * @brief xcb_xfixes_get_cursor_image_and_name_reply_t **/ typedef struct xcb_xfixes_get_cursor_image_and_name_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; int16_t x; int16_t y; uint16_t width; uint16_t height; uint16_t xhot; uint16_t yhot; uint32_t cursor_serial; xcb_atom_t cursor_atom; uint16_t nbytes; uint8_t pad1[2]; } xcb_xfixes_get_cursor_image_and_name_reply_t; /** Opcode for xcb_xfixes_change_cursor. */ #define XCB_XFIXES_CHANGE_CURSOR 26 /** * @brief xcb_xfixes_change_cursor_request_t **/ typedef struct xcb_xfixes_change_cursor_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_cursor_t source; xcb_cursor_t destination; } xcb_xfixes_change_cursor_request_t; /** Opcode for xcb_xfixes_change_cursor_by_name. */ #define XCB_XFIXES_CHANGE_CURSOR_BY_NAME 27 /** * @brief xcb_xfixes_change_cursor_by_name_request_t **/ typedef struct xcb_xfixes_change_cursor_by_name_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_cursor_t src; uint16_t nbytes; uint8_t pad0[2]; } xcb_xfixes_change_cursor_by_name_request_t; /** Opcode for xcb_xfixes_expand_region. */ #define XCB_XFIXES_EXPAND_REGION 28 /** * @brief xcb_xfixes_expand_region_request_t **/ typedef struct xcb_xfixes_expand_region_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xfixes_region_t source; xcb_xfixes_region_t destination; uint16_t left; uint16_t right; uint16_t top; uint16_t bottom; } xcb_xfixes_expand_region_request_t; /** Opcode for xcb_xfixes_hide_cursor. */ #define XCB_XFIXES_HIDE_CURSOR 29 /** * @brief xcb_xfixes_hide_cursor_request_t **/ typedef struct xcb_xfixes_hide_cursor_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_xfixes_hide_cursor_request_t; /** Opcode for xcb_xfixes_show_cursor. */ #define XCB_XFIXES_SHOW_CURSOR 30 /** * @brief xcb_xfixes_show_cursor_request_t **/ typedef struct xcb_xfixes_show_cursor_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_xfixes_show_cursor_request_t; typedef uint32_t xcb_xfixes_barrier_t; /** * @brief xcb_xfixes_barrier_iterator_t **/ typedef struct xcb_xfixes_barrier_iterator_t { xcb_xfixes_barrier_t *data; int rem; int index; } xcb_xfixes_barrier_iterator_t; typedef enum xcb_xfixes_barrier_directions_t { XCB_XFIXES_BARRIER_DIRECTIONS_POSITIVE_X = 1, XCB_XFIXES_BARRIER_DIRECTIONS_POSITIVE_Y = 2, XCB_XFIXES_BARRIER_DIRECTIONS_NEGATIVE_X = 4, XCB_XFIXES_BARRIER_DIRECTIONS_NEGATIVE_Y = 8 } xcb_xfixes_barrier_directions_t; /** Opcode for xcb_xfixes_create_pointer_barrier. */ #define XCB_XFIXES_CREATE_POINTER_BARRIER 31 /** * @brief xcb_xfixes_create_pointer_barrier_request_t **/ typedef struct xcb_xfixes_create_pointer_barrier_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xfixes_barrier_t barrier; xcb_window_t window; uint16_t x1; uint16_t y1; uint16_t x2; uint16_t y2; uint32_t directions; uint8_t pad0[2]; uint16_t num_devices; } xcb_xfixes_create_pointer_barrier_request_t; /** Opcode for xcb_xfixes_delete_pointer_barrier. */ #define XCB_XFIXES_DELETE_POINTER_BARRIER 32 /** * @brief xcb_xfixes_delete_pointer_barrier_request_t **/ typedef struct xcb_xfixes_delete_pointer_barrier_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xfixes_barrier_t barrier; } xcb_xfixes_delete_pointer_barrier_request_t; /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xfixes_query_version_cookie_t xcb_xfixes_query_version (xcb_connection_t *c, uint32_t client_major_version, uint32_t client_minor_version); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xfixes_query_version_cookie_t xcb_xfixes_query_version_unchecked (xcb_connection_t *c, uint32_t client_major_version, uint32_t client_minor_version); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xfixes_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xfixes_query_version_reply_t * xcb_xfixes_query_version_reply (xcb_connection_t *c, xcb_xfixes_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_change_save_set_checked (xcb_connection_t *c, uint8_t mode, uint8_t target, uint8_t map, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_change_save_set (xcb_connection_t *c, uint8_t mode, uint8_t target, uint8_t map, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_select_selection_input_checked (xcb_connection_t *c, xcb_window_t window, xcb_atom_t selection, uint32_t event_mask); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_select_selection_input (xcb_connection_t *c, xcb_window_t window, xcb_atom_t selection, uint32_t event_mask); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_select_cursor_input_checked (xcb_connection_t *c, xcb_window_t window, uint32_t event_mask); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_select_cursor_input (xcb_connection_t *c, xcb_window_t window, uint32_t event_mask); int xcb_xfixes_get_cursor_image_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xfixes_get_cursor_image_cookie_t xcb_xfixes_get_cursor_image (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xfixes_get_cursor_image_cookie_t xcb_xfixes_get_cursor_image_unchecked (xcb_connection_t *c); uint32_t * xcb_xfixes_get_cursor_image_cursor_image (const xcb_xfixes_get_cursor_image_reply_t *R); int xcb_xfixes_get_cursor_image_cursor_image_length (const xcb_xfixes_get_cursor_image_reply_t *R); xcb_generic_iterator_t xcb_xfixes_get_cursor_image_cursor_image_end (const xcb_xfixes_get_cursor_image_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xfixes_get_cursor_image_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xfixes_get_cursor_image_reply_t * xcb_xfixes_get_cursor_image_reply (xcb_connection_t *c, xcb_xfixes_get_cursor_image_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * Get the next element of the iterator * @param i Pointer to a xcb_xfixes_region_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xfixes_region_t) */ void xcb_xfixes_region_next (xcb_xfixes_region_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xfixes_region_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xfixes_region_end (xcb_xfixes_region_iterator_t i); int xcb_xfixes_create_region_sizeof (const void *_buffer, uint32_t rectangles_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_create_region_checked (xcb_connection_t *c, xcb_xfixes_region_t region, uint32_t rectangles_len, const xcb_rectangle_t *rectangles); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_create_region (xcb_connection_t *c, xcb_xfixes_region_t region, uint32_t rectangles_len, const xcb_rectangle_t *rectangles); xcb_rectangle_t * xcb_xfixes_create_region_rectangles (const xcb_xfixes_create_region_request_t *R); int xcb_xfixes_create_region_rectangles_length (const xcb_xfixes_create_region_request_t *R); xcb_rectangle_iterator_t xcb_xfixes_create_region_rectangles_iterator (const xcb_xfixes_create_region_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_create_region_from_bitmap_checked (xcb_connection_t *c, xcb_xfixes_region_t region, xcb_pixmap_t bitmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_create_region_from_bitmap (xcb_connection_t *c, xcb_xfixes_region_t region, xcb_pixmap_t bitmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_create_region_from_window_checked (xcb_connection_t *c, xcb_xfixes_region_t region, xcb_window_t window, xcb_shape_kind_t kind); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_create_region_from_window (xcb_connection_t *c, xcb_xfixes_region_t region, xcb_window_t window, xcb_shape_kind_t kind); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_create_region_from_gc_checked (xcb_connection_t *c, xcb_xfixes_region_t region, xcb_gcontext_t gc); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_create_region_from_gc (xcb_connection_t *c, xcb_xfixes_region_t region, xcb_gcontext_t gc); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_create_region_from_picture_checked (xcb_connection_t *c, xcb_xfixes_region_t region, xcb_render_picture_t picture); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_create_region_from_picture (xcb_connection_t *c, xcb_xfixes_region_t region, xcb_render_picture_t picture); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_destroy_region_checked (xcb_connection_t *c, xcb_xfixes_region_t region); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_destroy_region (xcb_connection_t *c, xcb_xfixes_region_t region); int xcb_xfixes_set_region_sizeof (const void *_buffer, uint32_t rectangles_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_set_region_checked (xcb_connection_t *c, xcb_xfixes_region_t region, uint32_t rectangles_len, const xcb_rectangle_t *rectangles); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_set_region (xcb_connection_t *c, xcb_xfixes_region_t region, uint32_t rectangles_len, const xcb_rectangle_t *rectangles); xcb_rectangle_t * xcb_xfixes_set_region_rectangles (const xcb_xfixes_set_region_request_t *R); int xcb_xfixes_set_region_rectangles_length (const xcb_xfixes_set_region_request_t *R); xcb_rectangle_iterator_t xcb_xfixes_set_region_rectangles_iterator (const xcb_xfixes_set_region_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_copy_region_checked (xcb_connection_t *c, xcb_xfixes_region_t source, xcb_xfixes_region_t destination); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_copy_region (xcb_connection_t *c, xcb_xfixes_region_t source, xcb_xfixes_region_t destination); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_union_region_checked (xcb_connection_t *c, xcb_xfixes_region_t source1, xcb_xfixes_region_t source2, xcb_xfixes_region_t destination); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_union_region (xcb_connection_t *c, xcb_xfixes_region_t source1, xcb_xfixes_region_t source2, xcb_xfixes_region_t destination); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_intersect_region_checked (xcb_connection_t *c, xcb_xfixes_region_t source1, xcb_xfixes_region_t source2, xcb_xfixes_region_t destination); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_intersect_region (xcb_connection_t *c, xcb_xfixes_region_t source1, xcb_xfixes_region_t source2, xcb_xfixes_region_t destination); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_subtract_region_checked (xcb_connection_t *c, xcb_xfixes_region_t source1, xcb_xfixes_region_t source2, xcb_xfixes_region_t destination); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_subtract_region (xcb_connection_t *c, xcb_xfixes_region_t source1, xcb_xfixes_region_t source2, xcb_xfixes_region_t destination); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_invert_region_checked (xcb_connection_t *c, xcb_xfixes_region_t source, xcb_rectangle_t bounds, xcb_xfixes_region_t destination); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_invert_region (xcb_connection_t *c, xcb_xfixes_region_t source, xcb_rectangle_t bounds, xcb_xfixes_region_t destination); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_translate_region_checked (xcb_connection_t *c, xcb_xfixes_region_t region, int16_t dx, int16_t dy); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_translate_region (xcb_connection_t *c, xcb_xfixes_region_t region, int16_t dx, int16_t dy); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_region_extents_checked (xcb_connection_t *c, xcb_xfixes_region_t source, xcb_xfixes_region_t destination); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_region_extents (xcb_connection_t *c, xcb_xfixes_region_t source, xcb_xfixes_region_t destination); int xcb_xfixes_fetch_region_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xfixes_fetch_region_cookie_t xcb_xfixes_fetch_region (xcb_connection_t *c, xcb_xfixes_region_t region); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xfixes_fetch_region_cookie_t xcb_xfixes_fetch_region_unchecked (xcb_connection_t *c, xcb_xfixes_region_t region); xcb_rectangle_t * xcb_xfixes_fetch_region_rectangles (const xcb_xfixes_fetch_region_reply_t *R); int xcb_xfixes_fetch_region_rectangles_length (const xcb_xfixes_fetch_region_reply_t *R); xcb_rectangle_iterator_t xcb_xfixes_fetch_region_rectangles_iterator (const xcb_xfixes_fetch_region_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xfixes_fetch_region_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xfixes_fetch_region_reply_t * xcb_xfixes_fetch_region_reply (xcb_connection_t *c, xcb_xfixes_fetch_region_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_set_gc_clip_region_checked (xcb_connection_t *c, xcb_gcontext_t gc, xcb_xfixes_region_t region, int16_t x_origin, int16_t y_origin); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_set_gc_clip_region (xcb_connection_t *c, xcb_gcontext_t gc, xcb_xfixes_region_t region, int16_t x_origin, int16_t y_origin); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_set_window_shape_region_checked (xcb_connection_t *c, xcb_window_t dest, xcb_shape_kind_t dest_kind, int16_t x_offset, int16_t y_offset, xcb_xfixes_region_t region); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_set_window_shape_region (xcb_connection_t *c, xcb_window_t dest, xcb_shape_kind_t dest_kind, int16_t x_offset, int16_t y_offset, xcb_xfixes_region_t region); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_set_picture_clip_region_checked (xcb_connection_t *c, xcb_render_picture_t picture, xcb_xfixes_region_t region, int16_t x_origin, int16_t y_origin); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_set_picture_clip_region (xcb_connection_t *c, xcb_render_picture_t picture, xcb_xfixes_region_t region, int16_t x_origin, int16_t y_origin); int xcb_xfixes_set_cursor_name_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_set_cursor_name_checked (xcb_connection_t *c, xcb_cursor_t cursor, uint16_t nbytes, const char *name); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_set_cursor_name (xcb_connection_t *c, xcb_cursor_t cursor, uint16_t nbytes, const char *name); char * xcb_xfixes_set_cursor_name_name (const xcb_xfixes_set_cursor_name_request_t *R); int xcb_xfixes_set_cursor_name_name_length (const xcb_xfixes_set_cursor_name_request_t *R); xcb_generic_iterator_t xcb_xfixes_set_cursor_name_name_end (const xcb_xfixes_set_cursor_name_request_t *R); int xcb_xfixes_get_cursor_name_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xfixes_get_cursor_name_cookie_t xcb_xfixes_get_cursor_name (xcb_connection_t *c, xcb_cursor_t cursor); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xfixes_get_cursor_name_cookie_t xcb_xfixes_get_cursor_name_unchecked (xcb_connection_t *c, xcb_cursor_t cursor); char * xcb_xfixes_get_cursor_name_name (const xcb_xfixes_get_cursor_name_reply_t *R); int xcb_xfixes_get_cursor_name_name_length (const xcb_xfixes_get_cursor_name_reply_t *R); xcb_generic_iterator_t xcb_xfixes_get_cursor_name_name_end (const xcb_xfixes_get_cursor_name_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xfixes_get_cursor_name_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xfixes_get_cursor_name_reply_t * xcb_xfixes_get_cursor_name_reply (xcb_connection_t *c, xcb_xfixes_get_cursor_name_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xfixes_get_cursor_image_and_name_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xfixes_get_cursor_image_and_name_cookie_t xcb_xfixes_get_cursor_image_and_name (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xfixes_get_cursor_image_and_name_cookie_t xcb_xfixes_get_cursor_image_and_name_unchecked (xcb_connection_t *c); uint32_t * xcb_xfixes_get_cursor_image_and_name_cursor_image (const xcb_xfixes_get_cursor_image_and_name_reply_t *R); int xcb_xfixes_get_cursor_image_and_name_cursor_image_length (const xcb_xfixes_get_cursor_image_and_name_reply_t *R); xcb_generic_iterator_t xcb_xfixes_get_cursor_image_and_name_cursor_image_end (const xcb_xfixes_get_cursor_image_and_name_reply_t *R); char * xcb_xfixes_get_cursor_image_and_name_name (const xcb_xfixes_get_cursor_image_and_name_reply_t *R); int xcb_xfixes_get_cursor_image_and_name_name_length (const xcb_xfixes_get_cursor_image_and_name_reply_t *R); xcb_generic_iterator_t xcb_xfixes_get_cursor_image_and_name_name_end (const xcb_xfixes_get_cursor_image_and_name_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xfixes_get_cursor_image_and_name_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xfixes_get_cursor_image_and_name_reply_t * xcb_xfixes_get_cursor_image_and_name_reply (xcb_connection_t *c, xcb_xfixes_get_cursor_image_and_name_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_change_cursor_checked (xcb_connection_t *c, xcb_cursor_t source, xcb_cursor_t destination); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_change_cursor (xcb_connection_t *c, xcb_cursor_t source, xcb_cursor_t destination); int xcb_xfixes_change_cursor_by_name_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_change_cursor_by_name_checked (xcb_connection_t *c, xcb_cursor_t src, uint16_t nbytes, const char *name); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_change_cursor_by_name (xcb_connection_t *c, xcb_cursor_t src, uint16_t nbytes, const char *name); char * xcb_xfixes_change_cursor_by_name_name (const xcb_xfixes_change_cursor_by_name_request_t *R); int xcb_xfixes_change_cursor_by_name_name_length (const xcb_xfixes_change_cursor_by_name_request_t *R); xcb_generic_iterator_t xcb_xfixes_change_cursor_by_name_name_end (const xcb_xfixes_change_cursor_by_name_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_expand_region_checked (xcb_connection_t *c, xcb_xfixes_region_t source, xcb_xfixes_region_t destination, uint16_t left, uint16_t right, uint16_t top, uint16_t bottom); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_expand_region (xcb_connection_t *c, xcb_xfixes_region_t source, xcb_xfixes_region_t destination, uint16_t left, uint16_t right, uint16_t top, uint16_t bottom); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_hide_cursor_checked (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_hide_cursor (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_show_cursor_checked (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_show_cursor (xcb_connection_t *c, xcb_window_t window); /** * Get the next element of the iterator * @param i Pointer to a xcb_xfixes_barrier_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xfixes_barrier_t) */ void xcb_xfixes_barrier_next (xcb_xfixes_barrier_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xfixes_barrier_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xfixes_barrier_end (xcb_xfixes_barrier_iterator_t i); int xcb_xfixes_create_pointer_barrier_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_create_pointer_barrier_checked (xcb_connection_t *c, xcb_xfixes_barrier_t barrier, xcb_window_t window, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint32_t directions, uint16_t num_devices, const uint16_t *devices); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_create_pointer_barrier (xcb_connection_t *c, xcb_xfixes_barrier_t barrier, xcb_window_t window, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint32_t directions, uint16_t num_devices, const uint16_t *devices); uint16_t * xcb_xfixes_create_pointer_barrier_devices (const xcb_xfixes_create_pointer_barrier_request_t *R); int xcb_xfixes_create_pointer_barrier_devices_length (const xcb_xfixes_create_pointer_barrier_request_t *R); xcb_generic_iterator_t xcb_xfixes_create_pointer_barrier_devices_end (const xcb_xfixes_create_pointer_barrier_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xfixes_delete_pointer_barrier_checked (xcb_connection_t *c, xcb_xfixes_barrier_t barrier); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xfixes_delete_pointer_barrier (xcb_connection_t *c, xcb_xfixes_barrier_t barrier); #ifdef __cplusplus } #endif #endif /** * @} */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/composite.h�������������������������������������������������������������������������������������0000644�����������������00000033053�14763166026�0007512 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from composite.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_Composite_API XCB Composite API * @brief Composite XCB Protocol Implementation. * @{ **/ #ifndef __COMPOSITE_H #define __COMPOSITE_H #include "xcb.h" #include "xproto.h" #include "xfixes.h" #ifdef __cplusplus extern "C" { #endif #define XCB_COMPOSITE_MAJOR_VERSION 0 #define XCB_COMPOSITE_MINOR_VERSION 4 extern xcb_extension_t xcb_composite_id; typedef enum xcb_composite_redirect_t { XCB_COMPOSITE_REDIRECT_AUTOMATIC = 0, XCB_COMPOSITE_REDIRECT_MANUAL = 1 } xcb_composite_redirect_t; /** * @brief xcb_composite_query_version_cookie_t **/ typedef struct xcb_composite_query_version_cookie_t { unsigned int sequence; } xcb_composite_query_version_cookie_t; /** Opcode for xcb_composite_query_version. */ #define XCB_COMPOSITE_QUERY_VERSION 0 /** * @brief xcb_composite_query_version_request_t **/ typedef struct xcb_composite_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t client_major_version; uint32_t client_minor_version; } xcb_composite_query_version_request_t; /** * @brief xcb_composite_query_version_reply_t **/ typedef struct xcb_composite_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t major_version; uint32_t minor_version; uint8_t pad1[16]; } xcb_composite_query_version_reply_t; /** Opcode for xcb_composite_redirect_window. */ #define XCB_COMPOSITE_REDIRECT_WINDOW 1 /** * @brief xcb_composite_redirect_window_request_t **/ typedef struct xcb_composite_redirect_window_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; uint8_t update; uint8_t pad0[3]; } xcb_composite_redirect_window_request_t; /** Opcode for xcb_composite_redirect_subwindows. */ #define XCB_COMPOSITE_REDIRECT_SUBWINDOWS 2 /** * @brief xcb_composite_redirect_subwindows_request_t **/ typedef struct xcb_composite_redirect_subwindows_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; uint8_t update; uint8_t pad0[3]; } xcb_composite_redirect_subwindows_request_t; /** Opcode for xcb_composite_unredirect_window. */ #define XCB_COMPOSITE_UNREDIRECT_WINDOW 3 /** * @brief xcb_composite_unredirect_window_request_t **/ typedef struct xcb_composite_unredirect_window_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; uint8_t update; uint8_t pad0[3]; } xcb_composite_unredirect_window_request_t; /** Opcode for xcb_composite_unredirect_subwindows. */ #define XCB_COMPOSITE_UNREDIRECT_SUBWINDOWS 4 /** * @brief xcb_composite_unredirect_subwindows_request_t **/ typedef struct xcb_composite_unredirect_subwindows_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; uint8_t update; uint8_t pad0[3]; } xcb_composite_unredirect_subwindows_request_t; /** Opcode for xcb_composite_create_region_from_border_clip. */ #define XCB_COMPOSITE_CREATE_REGION_FROM_BORDER_CLIP 5 /** * @brief xcb_composite_create_region_from_border_clip_request_t **/ typedef struct xcb_composite_create_region_from_border_clip_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xfixes_region_t region; xcb_window_t window; } xcb_composite_create_region_from_border_clip_request_t; /** Opcode for xcb_composite_name_window_pixmap. */ #define XCB_COMPOSITE_NAME_WINDOW_PIXMAP 6 /** * @brief xcb_composite_name_window_pixmap_request_t **/ typedef struct xcb_composite_name_window_pixmap_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; xcb_pixmap_t pixmap; } xcb_composite_name_window_pixmap_request_t; /** * @brief xcb_composite_get_overlay_window_cookie_t **/ typedef struct xcb_composite_get_overlay_window_cookie_t { unsigned int sequence; } xcb_composite_get_overlay_window_cookie_t; /** Opcode for xcb_composite_get_overlay_window. */ #define XCB_COMPOSITE_GET_OVERLAY_WINDOW 7 /** * @brief xcb_composite_get_overlay_window_request_t **/ typedef struct xcb_composite_get_overlay_window_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_composite_get_overlay_window_request_t; /** * @brief xcb_composite_get_overlay_window_reply_t **/ typedef struct xcb_composite_get_overlay_window_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_window_t overlay_win; uint8_t pad1[20]; } xcb_composite_get_overlay_window_reply_t; /** Opcode for xcb_composite_release_overlay_window. */ #define XCB_COMPOSITE_RELEASE_OVERLAY_WINDOW 8 /** * @brief xcb_composite_release_overlay_window_request_t **/ typedef struct xcb_composite_release_overlay_window_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_composite_release_overlay_window_request_t; /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_composite_query_version_cookie_t xcb_composite_query_version (xcb_connection_t *c, uint32_t client_major_version, uint32_t client_minor_version); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_composite_query_version_cookie_t xcb_composite_query_version_unchecked (xcb_connection_t *c, uint32_t client_major_version, uint32_t client_minor_version); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_composite_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_composite_query_version_reply_t * xcb_composite_query_version_reply (xcb_connection_t *c, xcb_composite_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_composite_redirect_window_checked (xcb_connection_t *c, xcb_window_t window, uint8_t update); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_composite_redirect_window (xcb_connection_t *c, xcb_window_t window, uint8_t update); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_composite_redirect_subwindows_checked (xcb_connection_t *c, xcb_window_t window, uint8_t update); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_composite_redirect_subwindows (xcb_connection_t *c, xcb_window_t window, uint8_t update); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_composite_unredirect_window_checked (xcb_connection_t *c, xcb_window_t window, uint8_t update); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_composite_unredirect_window (xcb_connection_t *c, xcb_window_t window, uint8_t update); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_composite_unredirect_subwindows_checked (xcb_connection_t *c, xcb_window_t window, uint8_t update); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_composite_unredirect_subwindows (xcb_connection_t *c, xcb_window_t window, uint8_t update); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_composite_create_region_from_border_clip_checked (xcb_connection_t *c, xcb_xfixes_region_t region, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_composite_create_region_from_border_clip (xcb_connection_t *c, xcb_xfixes_region_t region, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_composite_name_window_pixmap_checked (xcb_connection_t *c, xcb_window_t window, xcb_pixmap_t pixmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_composite_name_window_pixmap (xcb_connection_t *c, xcb_window_t window, xcb_pixmap_t pixmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_composite_get_overlay_window_cookie_t xcb_composite_get_overlay_window (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_composite_get_overlay_window_cookie_t xcb_composite_get_overlay_window_unchecked (xcb_connection_t *c, xcb_window_t window); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_composite_get_overlay_window_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_composite_get_overlay_window_reply_t * xcb_composite_get_overlay_window_reply (xcb_connection_t *c, xcb_composite_get_overlay_window_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_composite_release_overlay_window_checked (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_composite_release_overlay_window (xcb_connection_t *c, xcb_window_t window); #ifdef __cplusplus } #endif #endif /** * @} */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/screensaver.h�����������������������������������������������������������������������������������0000644�����������������00000040142�14763166026�0010025 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from screensaver.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_ScreenSaver_API XCB ScreenSaver API * @brief ScreenSaver XCB Protocol Implementation. * @{ **/ #ifndef __SCREENSAVER_H #define __SCREENSAVER_H #include "xcb.h" #include "xproto.h" #ifdef __cplusplus extern "C" { #endif #define XCB_SCREENSAVER_MAJOR_VERSION 1 #define XCB_SCREENSAVER_MINOR_VERSION 1 extern xcb_extension_t xcb_screensaver_id; typedef enum xcb_screensaver_kind_t { XCB_SCREENSAVER_KIND_BLANKED = 0, XCB_SCREENSAVER_KIND_INTERNAL = 1, XCB_SCREENSAVER_KIND_EXTERNAL = 2 } xcb_screensaver_kind_t; typedef enum xcb_screensaver_event_t { XCB_SCREENSAVER_EVENT_NOTIFY_MASK = 1, XCB_SCREENSAVER_EVENT_CYCLE_MASK = 2 } xcb_screensaver_event_t; typedef enum xcb_screensaver_state_t { XCB_SCREENSAVER_STATE_OFF = 0, XCB_SCREENSAVER_STATE_ON = 1, XCB_SCREENSAVER_STATE_CYCLE = 2, XCB_SCREENSAVER_STATE_DISABLED = 3 } xcb_screensaver_state_t; /** * @brief xcb_screensaver_query_version_cookie_t **/ typedef struct xcb_screensaver_query_version_cookie_t { unsigned int sequence; } xcb_screensaver_query_version_cookie_t; /** Opcode for xcb_screensaver_query_version. */ #define XCB_SCREENSAVER_QUERY_VERSION 0 /** * @brief xcb_screensaver_query_version_request_t **/ typedef struct xcb_screensaver_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t client_major_version; uint8_t client_minor_version; uint8_t pad0[2]; } xcb_screensaver_query_version_request_t; /** * @brief xcb_screensaver_query_version_reply_t **/ typedef struct xcb_screensaver_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t server_major_version; uint16_t server_minor_version; uint8_t pad1[20]; } xcb_screensaver_query_version_reply_t; /** * @brief xcb_screensaver_query_info_cookie_t **/ typedef struct xcb_screensaver_query_info_cookie_t { unsigned int sequence; } xcb_screensaver_query_info_cookie_t; /** Opcode for xcb_screensaver_query_info. */ #define XCB_SCREENSAVER_QUERY_INFO 1 /** * @brief xcb_screensaver_query_info_request_t **/ typedef struct xcb_screensaver_query_info_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; } xcb_screensaver_query_info_request_t; /** * @brief xcb_screensaver_query_info_reply_t **/ typedef struct xcb_screensaver_query_info_reply_t { uint8_t response_type; uint8_t state; uint16_t sequence; uint32_t length; xcb_window_t saver_window; uint32_t ms_until_server; uint32_t ms_since_user_input; uint32_t event_mask; uint8_t kind; uint8_t pad0[7]; } xcb_screensaver_query_info_reply_t; /** Opcode for xcb_screensaver_select_input. */ #define XCB_SCREENSAVER_SELECT_INPUT 2 /** * @brief xcb_screensaver_select_input_request_t **/ typedef struct xcb_screensaver_select_input_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; uint32_t event_mask; } xcb_screensaver_select_input_request_t; /** * @brief xcb_screensaver_set_attributes_value_list_t **/ typedef struct xcb_screensaver_set_attributes_value_list_t { xcb_pixmap_t background_pixmap; uint32_t background_pixel; xcb_pixmap_t border_pixmap; uint32_t border_pixel; uint32_t bit_gravity; uint32_t win_gravity; uint32_t backing_store; uint32_t backing_planes; uint32_t backing_pixel; xcb_bool32_t override_redirect; xcb_bool32_t save_under; uint32_t event_mask; uint32_t do_not_propogate_mask; xcb_colormap_t colormap; xcb_cursor_t cursor; } xcb_screensaver_set_attributes_value_list_t; /** Opcode for xcb_screensaver_set_attributes. */ #define XCB_SCREENSAVER_SET_ATTRIBUTES 3 /** * @brief xcb_screensaver_set_attributes_request_t **/ typedef struct xcb_screensaver_set_attributes_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; int16_t x; int16_t y; uint16_t width; uint16_t height; uint16_t border_width; uint8_t _class; uint8_t depth; xcb_visualid_t visual; uint32_t value_mask; } xcb_screensaver_set_attributes_request_t; /** Opcode for xcb_screensaver_unset_attributes. */ #define XCB_SCREENSAVER_UNSET_ATTRIBUTES 4 /** * @brief xcb_screensaver_unset_attributes_request_t **/ typedef struct xcb_screensaver_unset_attributes_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; } xcb_screensaver_unset_attributes_request_t; /** Opcode for xcb_screensaver_suspend. */ #define XCB_SCREENSAVER_SUSPEND 5 /** * @brief xcb_screensaver_suspend_request_t **/ typedef struct xcb_screensaver_suspend_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t suspend; uint8_t pad0[3]; } xcb_screensaver_suspend_request_t; /** Opcode for xcb_screensaver_notify. */ #define XCB_SCREENSAVER_NOTIFY 0 /** * @brief xcb_screensaver_notify_event_t **/ typedef struct xcb_screensaver_notify_event_t { uint8_t response_type; uint8_t state; uint16_t sequence; xcb_timestamp_t time; xcb_window_t root; xcb_window_t window; uint8_t kind; uint8_t forced; uint8_t pad0[14]; } xcb_screensaver_notify_event_t; /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_screensaver_query_version_cookie_t xcb_screensaver_query_version (xcb_connection_t *c, uint8_t client_major_version, uint8_t client_minor_version); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_screensaver_query_version_cookie_t xcb_screensaver_query_version_unchecked (xcb_connection_t *c, uint8_t client_major_version, uint8_t client_minor_version); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_screensaver_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_screensaver_query_version_reply_t * xcb_screensaver_query_version_reply (xcb_connection_t *c, xcb_screensaver_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_screensaver_query_info_cookie_t xcb_screensaver_query_info (xcb_connection_t *c, xcb_drawable_t drawable); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_screensaver_query_info_cookie_t xcb_screensaver_query_info_unchecked (xcb_connection_t *c, xcb_drawable_t drawable); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_screensaver_query_info_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_screensaver_query_info_reply_t * xcb_screensaver_query_info_reply (xcb_connection_t *c, xcb_screensaver_query_info_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_screensaver_select_input_checked (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t event_mask); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_screensaver_select_input (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t event_mask); int xcb_screensaver_set_attributes_value_list_serialize (void **_buffer, uint32_t value_mask, const xcb_screensaver_set_attributes_value_list_t *_aux); int xcb_screensaver_set_attributes_value_list_unpack (const void *_buffer, uint32_t value_mask, xcb_screensaver_set_attributes_value_list_t *_aux); int xcb_screensaver_set_attributes_value_list_sizeof (const void *_buffer, uint32_t value_mask); int xcb_screensaver_set_attributes_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_screensaver_set_attributes_checked (xcb_connection_t *c, xcb_drawable_t drawable, int16_t x, int16_t y, uint16_t width, uint16_t height, uint16_t border_width, uint8_t _class, uint8_t depth, xcb_visualid_t visual, uint32_t value_mask, const void *value_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_screensaver_set_attributes (xcb_connection_t *c, xcb_drawable_t drawable, int16_t x, int16_t y, uint16_t width, uint16_t height, uint16_t border_width, uint8_t _class, uint8_t depth, xcb_visualid_t visual, uint32_t value_mask, const void *value_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_screensaver_set_attributes_aux_checked (xcb_connection_t *c, xcb_drawable_t drawable, int16_t x, int16_t y, uint16_t width, uint16_t height, uint16_t border_width, uint8_t _class, uint8_t depth, xcb_visualid_t visual, uint32_t value_mask, const xcb_screensaver_set_attributes_value_list_t *value_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_screensaver_set_attributes_aux (xcb_connection_t *c, xcb_drawable_t drawable, int16_t x, int16_t y, uint16_t width, uint16_t height, uint16_t border_width, uint8_t _class, uint8_t depth, xcb_visualid_t visual, uint32_t value_mask, const xcb_screensaver_set_attributes_value_list_t *value_list); void * xcb_screensaver_set_attributes_value_list (const xcb_screensaver_set_attributes_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_screensaver_unset_attributes_checked (xcb_connection_t *c, xcb_drawable_t drawable); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_screensaver_unset_attributes (xcb_connection_t *c, xcb_drawable_t drawable); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_screensaver_suspend_checked (xcb_connection_t *c, uint8_t suspend); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_screensaver_suspend (xcb_connection_t *c, uint8_t suspend); #ifdef __cplusplus } #endif #endif /** * @} */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/present.h���������������������������������������������������������������������������������������0000644�����������������00000045534�14763166026�0007177 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from present.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_Present_API XCB Present API * @brief Present XCB Protocol Implementation. * @{ **/ #ifndef __PRESENT_H #define __PRESENT_H #include "xcb.h" #include "xproto.h" #include "randr.h" #include "xfixes.h" #include "sync.h" #ifdef __cplusplus extern "C" { #endif #define XCB_PRESENT_MAJOR_VERSION 1 #define XCB_PRESENT_MINOR_VERSION 2 extern xcb_extension_t xcb_present_id; typedef enum xcb_present_event_enum_t { XCB_PRESENT_EVENT_CONFIGURE_NOTIFY = 0, XCB_PRESENT_EVENT_COMPLETE_NOTIFY = 1, XCB_PRESENT_EVENT_IDLE_NOTIFY = 2, XCB_PRESENT_EVENT_REDIRECT_NOTIFY = 3 } xcb_present_event_enum_t; typedef enum xcb_present_event_mask_t { XCB_PRESENT_EVENT_MASK_NO_EVENT = 0, XCB_PRESENT_EVENT_MASK_CONFIGURE_NOTIFY = 1, XCB_PRESENT_EVENT_MASK_COMPLETE_NOTIFY = 2, XCB_PRESENT_EVENT_MASK_IDLE_NOTIFY = 4, XCB_PRESENT_EVENT_MASK_REDIRECT_NOTIFY = 8 } xcb_present_event_mask_t; typedef enum xcb_present_option_t { XCB_PRESENT_OPTION_NONE = 0, XCB_PRESENT_OPTION_ASYNC = 1, XCB_PRESENT_OPTION_COPY = 2, XCB_PRESENT_OPTION_UST = 4, XCB_PRESENT_OPTION_SUBOPTIMAL = 8 } xcb_present_option_t; typedef enum xcb_present_capability_t { XCB_PRESENT_CAPABILITY_NONE = 0, XCB_PRESENT_CAPABILITY_ASYNC = 1, XCB_PRESENT_CAPABILITY_FENCE = 2, XCB_PRESENT_CAPABILITY_UST = 4 } xcb_present_capability_t; typedef enum xcb_present_complete_kind_t { XCB_PRESENT_COMPLETE_KIND_PIXMAP = 0, XCB_PRESENT_COMPLETE_KIND_NOTIFY_MSC = 1 } xcb_present_complete_kind_t; typedef enum xcb_present_complete_mode_t { XCB_PRESENT_COMPLETE_MODE_COPY = 0, XCB_PRESENT_COMPLETE_MODE_FLIP = 1, XCB_PRESENT_COMPLETE_MODE_SKIP = 2, XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY = 3 } xcb_present_complete_mode_t; /** * @brief xcb_present_notify_t **/ typedef struct xcb_present_notify_t { xcb_window_t window; uint32_t serial; } xcb_present_notify_t; /** * @brief xcb_present_notify_iterator_t **/ typedef struct xcb_present_notify_iterator_t { xcb_present_notify_t *data; int rem; int index; } xcb_present_notify_iterator_t; /** * @brief xcb_present_query_version_cookie_t **/ typedef struct xcb_present_query_version_cookie_t { unsigned int sequence; } xcb_present_query_version_cookie_t; /** Opcode for xcb_present_query_version. */ #define XCB_PRESENT_QUERY_VERSION 0 /** * @brief xcb_present_query_version_request_t **/ typedef struct xcb_present_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t major_version; uint32_t minor_version; } xcb_present_query_version_request_t; /** * @brief xcb_present_query_version_reply_t **/ typedef struct xcb_present_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t major_version; uint32_t minor_version; } xcb_present_query_version_reply_t; /** Opcode for xcb_present_pixmap. */ #define XCB_PRESENT_PIXMAP 1 /** * @brief xcb_present_pixmap_request_t **/ typedef struct xcb_present_pixmap_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; xcb_pixmap_t pixmap; uint32_t serial; xcb_xfixes_region_t valid; xcb_xfixes_region_t update; int16_t x_off; int16_t y_off; xcb_randr_crtc_t target_crtc; xcb_sync_fence_t wait_fence; xcb_sync_fence_t idle_fence; uint32_t options; uint8_t pad0[4]; uint64_t target_msc; uint64_t divisor; uint64_t remainder; } xcb_present_pixmap_request_t; /** Opcode for xcb_present_notify_msc. */ #define XCB_PRESENT_NOTIFY_MSC 2 /** * @brief xcb_present_notify_msc_request_t **/ typedef struct xcb_present_notify_msc_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; uint32_t serial; uint8_t pad0[4]; uint64_t target_msc; uint64_t divisor; uint64_t remainder; } xcb_present_notify_msc_request_t; typedef uint32_t xcb_present_event_t; /** * @brief xcb_present_event_iterator_t **/ typedef struct xcb_present_event_iterator_t { xcb_present_event_t *data; int rem; int index; } xcb_present_event_iterator_t; /** Opcode for xcb_present_select_input. */ #define XCB_PRESENT_SELECT_INPUT 3 /** * @brief xcb_present_select_input_request_t **/ typedef struct xcb_present_select_input_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_present_event_t eid; xcb_window_t window; uint32_t event_mask; } xcb_present_select_input_request_t; /** * @brief xcb_present_query_capabilities_cookie_t **/ typedef struct xcb_present_query_capabilities_cookie_t { unsigned int sequence; } xcb_present_query_capabilities_cookie_t; /** Opcode for xcb_present_query_capabilities. */ #define XCB_PRESENT_QUERY_CAPABILITIES 4 /** * @brief xcb_present_query_capabilities_request_t **/ typedef struct xcb_present_query_capabilities_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t target; } xcb_present_query_capabilities_request_t; /** * @brief xcb_present_query_capabilities_reply_t **/ typedef struct xcb_present_query_capabilities_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t capabilities; } xcb_present_query_capabilities_reply_t; /** Opcode for xcb_present_generic. */ #define XCB_PRESENT_GENERIC 0 /** * @brief xcb_present_generic_event_t **/ typedef struct xcb_present_generic_event_t { uint8_t response_type; uint8_t extension; uint16_t sequence; uint32_t length; uint16_t evtype; uint8_t pad0[2]; xcb_present_event_t event; } xcb_present_generic_event_t; /** Opcode for xcb_present_configure_notify. */ #define XCB_PRESENT_CONFIGURE_NOTIFY 0 /** * @brief xcb_present_configure_notify_event_t **/ typedef struct xcb_present_configure_notify_event_t { uint8_t response_type; uint8_t extension; uint16_t sequence; uint32_t length; uint16_t event_type; uint8_t pad0[2]; xcb_present_event_t event; xcb_window_t window; int16_t x; int16_t y; uint16_t width; uint16_t height; int16_t off_x; int16_t off_y; uint32_t full_sequence; uint16_t pixmap_width; uint16_t pixmap_height; uint32_t pixmap_flags; } xcb_present_configure_notify_event_t; /** Opcode for xcb_present_complete_notify. */ #define XCB_PRESENT_COMPLETE_NOTIFY 1 /** * @brief xcb_present_complete_notify_event_t **/ typedef struct xcb_present_complete_notify_event_t { uint8_t response_type; uint8_t extension; uint16_t sequence; uint32_t length; uint16_t event_type; uint8_t kind; uint8_t mode; xcb_present_event_t event; xcb_window_t window; uint32_t serial; uint64_t ust; uint32_t full_sequence; uint64_t msc; } XCB_PACKED xcb_present_complete_notify_event_t; /** Opcode for xcb_present_idle_notify. */ #define XCB_PRESENT_IDLE_NOTIFY 2 /** * @brief xcb_present_idle_notify_event_t **/ typedef struct xcb_present_idle_notify_event_t { uint8_t response_type; uint8_t extension; uint16_t sequence; uint32_t length; uint16_t event_type; uint8_t pad0[2]; xcb_present_event_t event; xcb_window_t window; uint32_t serial; xcb_pixmap_t pixmap; xcb_sync_fence_t idle_fence; uint32_t full_sequence; } xcb_present_idle_notify_event_t; /** Opcode for xcb_present_redirect_notify. */ #define XCB_PRESENT_REDIRECT_NOTIFY 3 /** * @brief xcb_present_redirect_notify_event_t **/ typedef struct xcb_present_redirect_notify_event_t { uint8_t response_type; uint8_t extension; uint16_t sequence; uint32_t length; uint16_t event_type; uint8_t update_window; uint8_t pad0; xcb_present_event_t event; xcb_window_t event_window; xcb_window_t window; xcb_pixmap_t pixmap; uint32_t serial; uint32_t full_sequence; xcb_xfixes_region_t valid_region; xcb_xfixes_region_t update_region; xcb_rectangle_t valid_rect; xcb_rectangle_t update_rect; int16_t x_off; int16_t y_off; xcb_randr_crtc_t target_crtc; xcb_sync_fence_t wait_fence; xcb_sync_fence_t idle_fence; uint32_t options; uint8_t pad1[4]; uint64_t target_msc; uint64_t divisor; uint64_t remainder; } XCB_PACKED xcb_present_redirect_notify_event_t; /** * Get the next element of the iterator * @param i Pointer to a xcb_present_notify_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_present_notify_t) */ void xcb_present_notify_next (xcb_present_notify_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_present_notify_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_present_notify_end (xcb_present_notify_iterator_t i); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_present_query_version_cookie_t xcb_present_query_version (xcb_connection_t *c, uint32_t major_version, uint32_t minor_version); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_present_query_version_cookie_t xcb_present_query_version_unchecked (xcb_connection_t *c, uint32_t major_version, uint32_t minor_version); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_present_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_present_query_version_reply_t * xcb_present_query_version_reply (xcb_connection_t *c, xcb_present_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_present_pixmap_sizeof (const void *_buffer, uint32_t notifies_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_present_pixmap_checked (xcb_connection_t *c, xcb_window_t window, xcb_pixmap_t pixmap, uint32_t serial, xcb_xfixes_region_t valid, xcb_xfixes_region_t update, int16_t x_off, int16_t y_off, xcb_randr_crtc_t target_crtc, xcb_sync_fence_t wait_fence, xcb_sync_fence_t idle_fence, uint32_t options, uint64_t target_msc, uint64_t divisor, uint64_t remainder, uint32_t notifies_len, const xcb_present_notify_t *notifies); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_present_pixmap (xcb_connection_t *c, xcb_window_t window, xcb_pixmap_t pixmap, uint32_t serial, xcb_xfixes_region_t valid, xcb_xfixes_region_t update, int16_t x_off, int16_t y_off, xcb_randr_crtc_t target_crtc, xcb_sync_fence_t wait_fence, xcb_sync_fence_t idle_fence, uint32_t options, uint64_t target_msc, uint64_t divisor, uint64_t remainder, uint32_t notifies_len, const xcb_present_notify_t *notifies); xcb_present_notify_t * xcb_present_pixmap_notifies (const xcb_present_pixmap_request_t *R); int xcb_present_pixmap_notifies_length (const xcb_present_pixmap_request_t *R); xcb_present_notify_iterator_t xcb_present_pixmap_notifies_iterator (const xcb_present_pixmap_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_present_notify_msc_checked (xcb_connection_t *c, xcb_window_t window, uint32_t serial, uint64_t target_msc, uint64_t divisor, uint64_t remainder); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_present_notify_msc (xcb_connection_t *c, xcb_window_t window, uint32_t serial, uint64_t target_msc, uint64_t divisor, uint64_t remainder); /** * Get the next element of the iterator * @param i Pointer to a xcb_present_event_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_present_event_t) */ void xcb_present_event_next (xcb_present_event_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_present_event_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_present_event_end (xcb_present_event_iterator_t i); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_present_select_input_checked (xcb_connection_t *c, xcb_present_event_t eid, xcb_window_t window, uint32_t event_mask); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_present_select_input (xcb_connection_t *c, xcb_present_event_t eid, xcb_window_t window, uint32_t event_mask); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_present_query_capabilities_cookie_t xcb_present_query_capabilities (xcb_connection_t *c, uint32_t target); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_present_query_capabilities_cookie_t xcb_present_query_capabilities_unchecked (xcb_connection_t *c, uint32_t target); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_present_query_capabilities_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_present_query_capabilities_reply_t * xcb_present_query_capabilities_reply (xcb_connection_t *c, xcb_present_query_capabilities_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_present_redirect_notify_sizeof (const void *_buffer, uint32_t notifies_len); xcb_present_notify_t * xcb_present_redirect_notify_notifies (const xcb_present_redirect_notify_event_t *R); int xcb_present_redirect_notify_notifies_length (const xcb_present_redirect_notify_event_t *R); xcb_present_notify_iterator_t xcb_present_redirect_notify_notifies_iterator (const xcb_present_redirect_notify_event_t *R); #ifdef __cplusplus } #endif #endif /** * @} */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/xinput.h����������������������������������������������������������������������������������������0000644�����������������00001124625�14763166026�0007046 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from xinput.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_Input_API XCB Input API * @brief Input XCB Protocol Implementation. * @{ **/ #ifndef __XINPUT_H #define __XINPUT_H #include "xcb.h" #include "xfixes.h" #ifdef __cplusplus extern "C" { #endif #define XCB_INPUT_MAJOR_VERSION 2 #define XCB_INPUT_MINOR_VERSION 3 extern xcb_extension_t xcb_input_id; typedef uint32_t xcb_input_event_class_t; /** * @brief xcb_input_event_class_iterator_t **/ typedef struct xcb_input_event_class_iterator_t { xcb_input_event_class_t *data; int rem; int index; } xcb_input_event_class_iterator_t; typedef uint8_t xcb_input_key_code_t; /** * @brief xcb_input_key_code_iterator_t **/ typedef struct xcb_input_key_code_iterator_t { xcb_input_key_code_t *data; int rem; int index; } xcb_input_key_code_iterator_t; typedef uint16_t xcb_input_device_id_t; /** * @brief xcb_input_device_id_iterator_t **/ typedef struct xcb_input_device_id_iterator_t { xcb_input_device_id_t *data; int rem; int index; } xcb_input_device_id_iterator_t; typedef int32_t xcb_input_fp1616_t; /** * @brief xcb_input_fp1616_iterator_t **/ typedef struct xcb_input_fp1616_iterator_t { xcb_input_fp1616_t *data; int rem; int index; } xcb_input_fp1616_iterator_t; /** * @brief xcb_input_fp3232_t **/ typedef struct xcb_input_fp3232_t { int32_t integral; uint32_t frac; } xcb_input_fp3232_t; /** * @brief xcb_input_fp3232_iterator_t **/ typedef struct xcb_input_fp3232_iterator_t { xcb_input_fp3232_t *data; int rem; int index; } xcb_input_fp3232_iterator_t; /** * @brief xcb_input_get_extension_version_cookie_t **/ typedef struct xcb_input_get_extension_version_cookie_t { unsigned int sequence; } xcb_input_get_extension_version_cookie_t; /** Opcode for xcb_input_get_extension_version. */ #define XCB_INPUT_GET_EXTENSION_VERSION 1 /** * @brief xcb_input_get_extension_version_request_t **/ typedef struct xcb_input_get_extension_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint16_t name_len; uint8_t pad0[2]; } xcb_input_get_extension_version_request_t; /** * @brief xcb_input_get_extension_version_reply_t **/ typedef struct xcb_input_get_extension_version_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint16_t server_major; uint16_t server_minor; uint8_t present; uint8_t pad0[19]; } xcb_input_get_extension_version_reply_t; typedef enum xcb_input_device_use_t { XCB_INPUT_DEVICE_USE_IS_X_POINTER = 0, XCB_INPUT_DEVICE_USE_IS_X_KEYBOARD = 1, XCB_INPUT_DEVICE_USE_IS_X_EXTENSION_DEVICE = 2, XCB_INPUT_DEVICE_USE_IS_X_EXTENSION_KEYBOARD = 3, XCB_INPUT_DEVICE_USE_IS_X_EXTENSION_POINTER = 4 } xcb_input_device_use_t; typedef enum xcb_input_input_class_t { XCB_INPUT_INPUT_CLASS_KEY = 0, XCB_INPUT_INPUT_CLASS_BUTTON = 1, XCB_INPUT_INPUT_CLASS_VALUATOR = 2, XCB_INPUT_INPUT_CLASS_FEEDBACK = 3, XCB_INPUT_INPUT_CLASS_PROXIMITY = 4, XCB_INPUT_INPUT_CLASS_FOCUS = 5, XCB_INPUT_INPUT_CLASS_OTHER = 6 } xcb_input_input_class_t; typedef enum xcb_input_valuator_mode_t { XCB_INPUT_VALUATOR_MODE_RELATIVE = 0, XCB_INPUT_VALUATOR_MODE_ABSOLUTE = 1 } xcb_input_valuator_mode_t; /** * @brief xcb_input_device_info_t **/ typedef struct xcb_input_device_info_t { xcb_atom_t device_type; uint8_t device_id; uint8_t num_class_info; uint8_t device_use; uint8_t pad0; } xcb_input_device_info_t; /** * @brief xcb_input_device_info_iterator_t **/ typedef struct xcb_input_device_info_iterator_t { xcb_input_device_info_t *data; int rem; int index; } xcb_input_device_info_iterator_t; /** * @brief xcb_input_key_info_t **/ typedef struct xcb_input_key_info_t { uint8_t class_id; uint8_t len; xcb_input_key_code_t min_keycode; xcb_input_key_code_t max_keycode; uint16_t num_keys; uint8_t pad0[2]; } xcb_input_key_info_t; /** * @brief xcb_input_key_info_iterator_t **/ typedef struct xcb_input_key_info_iterator_t { xcb_input_key_info_t *data; int rem; int index; } xcb_input_key_info_iterator_t; /** * @brief xcb_input_button_info_t **/ typedef struct xcb_input_button_info_t { uint8_t class_id; uint8_t len; uint16_t num_buttons; } xcb_input_button_info_t; /** * @brief xcb_input_button_info_iterator_t **/ typedef struct xcb_input_button_info_iterator_t { xcb_input_button_info_t *data; int rem; int index; } xcb_input_button_info_iterator_t; /** * @brief xcb_input_axis_info_t **/ typedef struct xcb_input_axis_info_t { uint32_t resolution; int32_t minimum; int32_t maximum; } xcb_input_axis_info_t; /** * @brief xcb_input_axis_info_iterator_t **/ typedef struct xcb_input_axis_info_iterator_t { xcb_input_axis_info_t *data; int rem; int index; } xcb_input_axis_info_iterator_t; /** * @brief xcb_input_valuator_info_t **/ typedef struct xcb_input_valuator_info_t { uint8_t class_id; uint8_t len; uint8_t axes_len; uint8_t mode; uint32_t motion_size; } xcb_input_valuator_info_t; /** * @brief xcb_input_valuator_info_iterator_t **/ typedef struct xcb_input_valuator_info_iterator_t { xcb_input_valuator_info_t *data; int rem; int index; } xcb_input_valuator_info_iterator_t; /** * @brief xcb_input_input_info_info_t **/ typedef struct xcb_input_input_info_info_t { struct { xcb_input_key_code_t min_keycode; xcb_input_key_code_t max_keycode; uint16_t num_keys; uint8_t pad0[2]; } key; struct { uint16_t num_buttons; } button; struct { uint8_t axes_len; uint8_t mode; uint32_t motion_size; xcb_input_axis_info_t *axes; } valuator; } xcb_input_input_info_info_t; /** * @brief xcb_input_input_info_t **/ typedef struct xcb_input_input_info_t { uint8_t class_id; uint8_t len; } xcb_input_input_info_t; void * xcb_input_input_info_info (const xcb_input_input_info_t *R); /** * @brief xcb_input_input_info_iterator_t **/ typedef struct xcb_input_input_info_iterator_t { xcb_input_input_info_t *data; int rem; int index; } xcb_input_input_info_iterator_t; /** * @brief xcb_input_device_name_t **/ typedef struct xcb_input_device_name_t { uint8_t len; } xcb_input_device_name_t; /** * @brief xcb_input_device_name_iterator_t **/ typedef struct xcb_input_device_name_iterator_t { xcb_input_device_name_t *data; int rem; int index; } xcb_input_device_name_iterator_t; /** * @brief xcb_input_list_input_devices_cookie_t **/ typedef struct xcb_input_list_input_devices_cookie_t { unsigned int sequence; } xcb_input_list_input_devices_cookie_t; /** Opcode for xcb_input_list_input_devices. */ #define XCB_INPUT_LIST_INPUT_DEVICES 2 /** * @brief xcb_input_list_input_devices_request_t **/ typedef struct xcb_input_list_input_devices_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_input_list_input_devices_request_t; /** * @brief xcb_input_list_input_devices_reply_t **/ typedef struct xcb_input_list_input_devices_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint8_t devices_len; uint8_t pad0[23]; } xcb_input_list_input_devices_reply_t; typedef uint8_t xcb_input_event_type_base_t; /** * @brief xcb_input_event_type_base_iterator_t **/ typedef struct xcb_input_event_type_base_iterator_t { xcb_input_event_type_base_t *data; int rem; int index; } xcb_input_event_type_base_iterator_t; /** * @brief xcb_input_input_class_info_t **/ typedef struct xcb_input_input_class_info_t { uint8_t class_id; xcb_input_event_type_base_t event_type_base; } xcb_input_input_class_info_t; /** * @brief xcb_input_input_class_info_iterator_t **/ typedef struct xcb_input_input_class_info_iterator_t { xcb_input_input_class_info_t *data; int rem; int index; } xcb_input_input_class_info_iterator_t; /** * @brief xcb_input_open_device_cookie_t **/ typedef struct xcb_input_open_device_cookie_t { unsigned int sequence; } xcb_input_open_device_cookie_t; /** Opcode for xcb_input_open_device. */ #define XCB_INPUT_OPEN_DEVICE 3 /** * @brief xcb_input_open_device_request_t **/ typedef struct xcb_input_open_device_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t device_id; uint8_t pad0[3]; } xcb_input_open_device_request_t; /** * @brief xcb_input_open_device_reply_t **/ typedef struct xcb_input_open_device_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint8_t num_classes; uint8_t pad0[23]; } xcb_input_open_device_reply_t; /** Opcode for xcb_input_close_device. */ #define XCB_INPUT_CLOSE_DEVICE 4 /** * @brief xcb_input_close_device_request_t **/ typedef struct xcb_input_close_device_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t device_id; uint8_t pad0[3]; } xcb_input_close_device_request_t; /** * @brief xcb_input_set_device_mode_cookie_t **/ typedef struct xcb_input_set_device_mode_cookie_t { unsigned int sequence; } xcb_input_set_device_mode_cookie_t; /** Opcode for xcb_input_set_device_mode. */ #define XCB_INPUT_SET_DEVICE_MODE 5 /** * @brief xcb_input_set_device_mode_request_t **/ typedef struct xcb_input_set_device_mode_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t device_id; uint8_t mode; uint8_t pad0[2]; } xcb_input_set_device_mode_request_t; /** * @brief xcb_input_set_device_mode_reply_t **/ typedef struct xcb_input_set_device_mode_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint8_t status; uint8_t pad0[23]; } xcb_input_set_device_mode_reply_t; /** Opcode for xcb_input_select_extension_event. */ #define XCB_INPUT_SELECT_EXTENSION_EVENT 6 /** * @brief xcb_input_select_extension_event_request_t **/ typedef struct xcb_input_select_extension_event_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; uint16_t num_classes; uint8_t pad0[2]; } xcb_input_select_extension_event_request_t; /** * @brief xcb_input_get_selected_extension_events_cookie_t **/ typedef struct xcb_input_get_selected_extension_events_cookie_t { unsigned int sequence; } xcb_input_get_selected_extension_events_cookie_t; /** Opcode for xcb_input_get_selected_extension_events. */ #define XCB_INPUT_GET_SELECTED_EXTENSION_EVENTS 7 /** * @brief xcb_input_get_selected_extension_events_request_t **/ typedef struct xcb_input_get_selected_extension_events_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_input_get_selected_extension_events_request_t; /** * @brief xcb_input_get_selected_extension_events_reply_t **/ typedef struct xcb_input_get_selected_extension_events_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint16_t num_this_classes; uint16_t num_all_classes; uint8_t pad0[20]; } xcb_input_get_selected_extension_events_reply_t; typedef enum xcb_input_propagate_mode_t { XCB_INPUT_PROPAGATE_MODE_ADD_TO_LIST = 0, XCB_INPUT_PROPAGATE_MODE_DELETE_FROM_LIST = 1 } xcb_input_propagate_mode_t; /** Opcode for xcb_input_change_device_dont_propagate_list. */ #define XCB_INPUT_CHANGE_DEVICE_DONT_PROPAGATE_LIST 8 /** * @brief xcb_input_change_device_dont_propagate_list_request_t **/ typedef struct xcb_input_change_device_dont_propagate_list_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; uint16_t num_classes; uint8_t mode; uint8_t pad0; } xcb_input_change_device_dont_propagate_list_request_t; /** * @brief xcb_input_get_device_dont_propagate_list_cookie_t **/ typedef struct xcb_input_get_device_dont_propagate_list_cookie_t { unsigned int sequence; } xcb_input_get_device_dont_propagate_list_cookie_t; /** Opcode for xcb_input_get_device_dont_propagate_list. */ #define XCB_INPUT_GET_DEVICE_DONT_PROPAGATE_LIST 9 /** * @brief xcb_input_get_device_dont_propagate_list_request_t **/ typedef struct xcb_input_get_device_dont_propagate_list_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_input_get_device_dont_propagate_list_request_t; /** * @brief xcb_input_get_device_dont_propagate_list_reply_t **/ typedef struct xcb_input_get_device_dont_propagate_list_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint16_t num_classes; uint8_t pad0[22]; } xcb_input_get_device_dont_propagate_list_reply_t; /** * @brief xcb_input_device_time_coord_t **/ typedef struct xcb_input_device_time_coord_t { xcb_timestamp_t time; } xcb_input_device_time_coord_t; /** * @brief xcb_input_device_time_coord_iterator_t **/ typedef struct xcb_input_device_time_coord_iterator_t { xcb_input_device_time_coord_t *data; int rem; int index; uint8_t num_axes; /**< */ } xcb_input_device_time_coord_iterator_t; /** * @brief xcb_input_get_device_motion_events_cookie_t **/ typedef struct xcb_input_get_device_motion_events_cookie_t { unsigned int sequence; } xcb_input_get_device_motion_events_cookie_t; /** Opcode for xcb_input_get_device_motion_events. */ #define XCB_INPUT_GET_DEVICE_MOTION_EVENTS 10 /** * @brief xcb_input_get_device_motion_events_request_t **/ typedef struct xcb_input_get_device_motion_events_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_timestamp_t start; xcb_timestamp_t stop; uint8_t device_id; uint8_t pad0[3]; } xcb_input_get_device_motion_events_request_t; /** * @brief xcb_input_get_device_motion_events_reply_t **/ typedef struct xcb_input_get_device_motion_events_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint32_t num_events; uint8_t num_axes; uint8_t device_mode; uint8_t pad0[18]; } xcb_input_get_device_motion_events_reply_t; /** * @brief xcb_input_change_keyboard_device_cookie_t **/ typedef struct xcb_input_change_keyboard_device_cookie_t { unsigned int sequence; } xcb_input_change_keyboard_device_cookie_t; /** Opcode for xcb_input_change_keyboard_device. */ #define XCB_INPUT_CHANGE_KEYBOARD_DEVICE 11 /** * @brief xcb_input_change_keyboard_device_request_t **/ typedef struct xcb_input_change_keyboard_device_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t device_id; uint8_t pad0[3]; } xcb_input_change_keyboard_device_request_t; /** * @brief xcb_input_change_keyboard_device_reply_t **/ typedef struct xcb_input_change_keyboard_device_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint8_t status; uint8_t pad0[23]; } xcb_input_change_keyboard_device_reply_t; /** * @brief xcb_input_change_pointer_device_cookie_t **/ typedef struct xcb_input_change_pointer_device_cookie_t { unsigned int sequence; } xcb_input_change_pointer_device_cookie_t; /** Opcode for xcb_input_change_pointer_device. */ #define XCB_INPUT_CHANGE_POINTER_DEVICE 12 /** * @brief xcb_input_change_pointer_device_request_t **/ typedef struct xcb_input_change_pointer_device_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t x_axis; uint8_t y_axis; uint8_t device_id; uint8_t pad0; } xcb_input_change_pointer_device_request_t; /** * @brief xcb_input_change_pointer_device_reply_t **/ typedef struct xcb_input_change_pointer_device_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint8_t status; uint8_t pad0[23]; } xcb_input_change_pointer_device_reply_t; /** * @brief xcb_input_grab_device_cookie_t **/ typedef struct xcb_input_grab_device_cookie_t { unsigned int sequence; } xcb_input_grab_device_cookie_t; /** Opcode for xcb_input_grab_device. */ #define XCB_INPUT_GRAB_DEVICE 13 /** * @brief xcb_input_grab_device_request_t **/ typedef struct xcb_input_grab_device_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t grab_window; xcb_timestamp_t time; uint16_t num_classes; uint8_t this_device_mode; uint8_t other_device_mode; uint8_t owner_events; uint8_t device_id; uint8_t pad0[2]; } xcb_input_grab_device_request_t; /** * @brief xcb_input_grab_device_reply_t **/ typedef struct xcb_input_grab_device_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint8_t status; uint8_t pad0[23]; } xcb_input_grab_device_reply_t; /** Opcode for xcb_input_ungrab_device. */ #define XCB_INPUT_UNGRAB_DEVICE 14 /** * @brief xcb_input_ungrab_device_request_t **/ typedef struct xcb_input_ungrab_device_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_timestamp_t time; uint8_t device_id; uint8_t pad0[3]; } xcb_input_ungrab_device_request_t; typedef enum xcb_input_modifier_device_t { XCB_INPUT_MODIFIER_DEVICE_USE_X_KEYBOARD = 255 } xcb_input_modifier_device_t; /** Opcode for xcb_input_grab_device_key. */ #define XCB_INPUT_GRAB_DEVICE_KEY 15 /** * @brief xcb_input_grab_device_key_request_t **/ typedef struct xcb_input_grab_device_key_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t grab_window; uint16_t num_classes; uint16_t modifiers; uint8_t modifier_device; uint8_t grabbed_device; uint8_t key; uint8_t this_device_mode; uint8_t other_device_mode; uint8_t owner_events; uint8_t pad0[2]; } xcb_input_grab_device_key_request_t; /** Opcode for xcb_input_ungrab_device_key. */ #define XCB_INPUT_UNGRAB_DEVICE_KEY 16 /** * @brief xcb_input_ungrab_device_key_request_t **/ typedef struct xcb_input_ungrab_device_key_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t grabWindow; uint16_t modifiers; uint8_t modifier_device; uint8_t key; uint8_t grabbed_device; } xcb_input_ungrab_device_key_request_t; /** Opcode for xcb_input_grab_device_button. */ #define XCB_INPUT_GRAB_DEVICE_BUTTON 17 /** * @brief xcb_input_grab_device_button_request_t **/ typedef struct xcb_input_grab_device_button_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t grab_window; uint8_t grabbed_device; uint8_t modifier_device; uint16_t num_classes; uint16_t modifiers; uint8_t this_device_mode; uint8_t other_device_mode; uint8_t button; uint8_t owner_events; uint8_t pad0[2]; } xcb_input_grab_device_button_request_t; /** Opcode for xcb_input_ungrab_device_button. */ #define XCB_INPUT_UNGRAB_DEVICE_BUTTON 18 /** * @brief xcb_input_ungrab_device_button_request_t **/ typedef struct xcb_input_ungrab_device_button_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t grab_window; uint16_t modifiers; uint8_t modifier_device; uint8_t button; uint8_t grabbed_device; uint8_t pad0[3]; } xcb_input_ungrab_device_button_request_t; typedef enum xcb_input_device_input_mode_t { XCB_INPUT_DEVICE_INPUT_MODE_ASYNC_THIS_DEVICE = 0, XCB_INPUT_DEVICE_INPUT_MODE_SYNC_THIS_DEVICE = 1, XCB_INPUT_DEVICE_INPUT_MODE_REPLAY_THIS_DEVICE = 2, XCB_INPUT_DEVICE_INPUT_MODE_ASYNC_OTHER_DEVICES = 3, XCB_INPUT_DEVICE_INPUT_MODE_ASYNC_ALL = 4, XCB_INPUT_DEVICE_INPUT_MODE_SYNC_ALL = 5 } xcb_input_device_input_mode_t; /** Opcode for xcb_input_allow_device_events. */ #define XCB_INPUT_ALLOW_DEVICE_EVENTS 19 /** * @brief xcb_input_allow_device_events_request_t **/ typedef struct xcb_input_allow_device_events_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_timestamp_t time; uint8_t mode; uint8_t device_id; uint8_t pad0[2]; } xcb_input_allow_device_events_request_t; /** * @brief xcb_input_get_device_focus_cookie_t **/ typedef struct xcb_input_get_device_focus_cookie_t { unsigned int sequence; } xcb_input_get_device_focus_cookie_t; /** Opcode for xcb_input_get_device_focus. */ #define XCB_INPUT_GET_DEVICE_FOCUS 20 /** * @brief xcb_input_get_device_focus_request_t **/ typedef struct xcb_input_get_device_focus_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t device_id; uint8_t pad0[3]; } xcb_input_get_device_focus_request_t; /** * @brief xcb_input_get_device_focus_reply_t **/ typedef struct xcb_input_get_device_focus_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; xcb_window_t focus; xcb_timestamp_t time; uint8_t revert_to; uint8_t pad0[15]; } xcb_input_get_device_focus_reply_t; /** Opcode for xcb_input_set_device_focus. */ #define XCB_INPUT_SET_DEVICE_FOCUS 21 /** * @brief xcb_input_set_device_focus_request_t **/ typedef struct xcb_input_set_device_focus_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t focus; xcb_timestamp_t time; uint8_t revert_to; uint8_t device_id; uint8_t pad0[2]; } xcb_input_set_device_focus_request_t; typedef enum xcb_input_feedback_class_t { XCB_INPUT_FEEDBACK_CLASS_KEYBOARD = 0, XCB_INPUT_FEEDBACK_CLASS_POINTER = 1, XCB_INPUT_FEEDBACK_CLASS_STRING = 2, XCB_INPUT_FEEDBACK_CLASS_INTEGER = 3, XCB_INPUT_FEEDBACK_CLASS_LED = 4, XCB_INPUT_FEEDBACK_CLASS_BELL = 5 } xcb_input_feedback_class_t; /** * @brief xcb_input_kbd_feedback_state_t **/ typedef struct xcb_input_kbd_feedback_state_t { uint8_t class_id; uint8_t feedback_id; uint16_t len; uint16_t pitch; uint16_t duration; uint32_t led_mask; uint32_t led_values; uint8_t global_auto_repeat; uint8_t click; uint8_t percent; uint8_t pad0; uint8_t auto_repeats[32]; } xcb_input_kbd_feedback_state_t; /** * @brief xcb_input_kbd_feedback_state_iterator_t **/ typedef struct xcb_input_kbd_feedback_state_iterator_t { xcb_input_kbd_feedback_state_t *data; int rem; int index; } xcb_input_kbd_feedback_state_iterator_t; /** * @brief xcb_input_ptr_feedback_state_t **/ typedef struct xcb_input_ptr_feedback_state_t { uint8_t class_id; uint8_t feedback_id; uint16_t len; uint8_t pad0[2]; uint16_t accel_num; uint16_t accel_denom; uint16_t threshold; } xcb_input_ptr_feedback_state_t; /** * @brief xcb_input_ptr_feedback_state_iterator_t **/ typedef struct xcb_input_ptr_feedback_state_iterator_t { xcb_input_ptr_feedback_state_t *data; int rem; int index; } xcb_input_ptr_feedback_state_iterator_t; /** * @brief xcb_input_integer_feedback_state_t **/ typedef struct xcb_input_integer_feedback_state_t { uint8_t class_id; uint8_t feedback_id; uint16_t len; uint32_t resolution; int32_t min_value; int32_t max_value; } xcb_input_integer_feedback_state_t; /** * @brief xcb_input_integer_feedback_state_iterator_t **/ typedef struct xcb_input_integer_feedback_state_iterator_t { xcb_input_integer_feedback_state_t *data; int rem; int index; } xcb_input_integer_feedback_state_iterator_t; /** * @brief xcb_input_string_feedback_state_t **/ typedef struct xcb_input_string_feedback_state_t { uint8_t class_id; uint8_t feedback_id; uint16_t len; uint16_t max_symbols; uint16_t num_keysyms; } xcb_input_string_feedback_state_t; /** * @brief xcb_input_string_feedback_state_iterator_t **/ typedef struct xcb_input_string_feedback_state_iterator_t { xcb_input_string_feedback_state_t *data; int rem; int index; } xcb_input_string_feedback_state_iterator_t; /** * @brief xcb_input_bell_feedback_state_t **/ typedef struct xcb_input_bell_feedback_state_t { uint8_t class_id; uint8_t feedback_id; uint16_t len; uint8_t percent; uint8_t pad0[3]; uint16_t pitch; uint16_t duration; } xcb_input_bell_feedback_state_t; /** * @brief xcb_input_bell_feedback_state_iterator_t **/ typedef struct xcb_input_bell_feedback_state_iterator_t { xcb_input_bell_feedback_state_t *data; int rem; int index; } xcb_input_bell_feedback_state_iterator_t; /** * @brief xcb_input_led_feedback_state_t **/ typedef struct xcb_input_led_feedback_state_t { uint8_t class_id; uint8_t feedback_id; uint16_t len; uint32_t led_mask; uint32_t led_values; } xcb_input_led_feedback_state_t; /** * @brief xcb_input_led_feedback_state_iterator_t **/ typedef struct xcb_input_led_feedback_state_iterator_t { xcb_input_led_feedback_state_t *data; int rem; int index; } xcb_input_led_feedback_state_iterator_t; /** * @brief xcb_input_feedback_state_data_t **/ typedef struct xcb_input_feedback_state_data_t { struct { uint16_t pitch; uint16_t duration; uint32_t led_mask; uint32_t led_values; uint8_t global_auto_repeat; uint8_t click; uint8_t percent; uint8_t pad0; uint8_t auto_repeats[32]; } keyboard; struct { uint8_t pad1[2]; uint16_t accel_num; uint16_t accel_denom; uint16_t threshold; } pointer; struct { uint16_t max_symbols; uint16_t num_keysyms; xcb_keysym_t *keysyms; } string; struct { uint32_t resolution; int32_t min_value; int32_t max_value; } integer; struct { uint32_t led_mask; uint32_t led_values; } led; struct { uint8_t percent; uint8_t pad2[3]; uint16_t pitch; uint16_t duration; } bell; } xcb_input_feedback_state_data_t; /** * @brief xcb_input_feedback_state_t **/ typedef struct xcb_input_feedback_state_t { uint8_t class_id; uint8_t feedback_id; uint16_t len; } xcb_input_feedback_state_t; void * xcb_input_feedback_state_data (const xcb_input_feedback_state_t *R); /** * @brief xcb_input_feedback_state_iterator_t **/ typedef struct xcb_input_feedback_state_iterator_t { xcb_input_feedback_state_t *data; int rem; int index; } xcb_input_feedback_state_iterator_t; /** * @brief xcb_input_get_feedback_control_cookie_t **/ typedef struct xcb_input_get_feedback_control_cookie_t { unsigned int sequence; } xcb_input_get_feedback_control_cookie_t; /** Opcode for xcb_input_get_feedback_control. */ #define XCB_INPUT_GET_FEEDBACK_CONTROL 22 /** * @brief xcb_input_get_feedback_control_request_t **/ typedef struct xcb_input_get_feedback_control_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t device_id; uint8_t pad0[3]; } xcb_input_get_feedback_control_request_t; /** * @brief xcb_input_get_feedback_control_reply_t **/ typedef struct xcb_input_get_feedback_control_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint16_t num_feedbacks; uint8_t pad0[22]; } xcb_input_get_feedback_control_reply_t; /** * @brief xcb_input_kbd_feedback_ctl_t **/ typedef struct xcb_input_kbd_feedback_ctl_t { uint8_t class_id; uint8_t feedback_id; uint16_t len; xcb_input_key_code_t key; uint8_t auto_repeat_mode; int8_t key_click_percent; int8_t bell_percent; int16_t bell_pitch; int16_t bell_duration; uint32_t led_mask; uint32_t led_values; } xcb_input_kbd_feedback_ctl_t; /** * @brief xcb_input_kbd_feedback_ctl_iterator_t **/ typedef struct xcb_input_kbd_feedback_ctl_iterator_t { xcb_input_kbd_feedback_ctl_t *data; int rem; int index; } xcb_input_kbd_feedback_ctl_iterator_t; /** * @brief xcb_input_ptr_feedback_ctl_t **/ typedef struct xcb_input_ptr_feedback_ctl_t { uint8_t class_id; uint8_t feedback_id; uint16_t len; uint8_t pad0[2]; int16_t num; int16_t denom; int16_t threshold; } xcb_input_ptr_feedback_ctl_t; /** * @brief xcb_input_ptr_feedback_ctl_iterator_t **/ typedef struct xcb_input_ptr_feedback_ctl_iterator_t { xcb_input_ptr_feedback_ctl_t *data; int rem; int index; } xcb_input_ptr_feedback_ctl_iterator_t; /** * @brief xcb_input_integer_feedback_ctl_t **/ typedef struct xcb_input_integer_feedback_ctl_t { uint8_t class_id; uint8_t feedback_id; uint16_t len; int32_t int_to_display; } xcb_input_integer_feedback_ctl_t; /** * @brief xcb_input_integer_feedback_ctl_iterator_t **/ typedef struct xcb_input_integer_feedback_ctl_iterator_t { xcb_input_integer_feedback_ctl_t *data; int rem; int index; } xcb_input_integer_feedback_ctl_iterator_t; /** * @brief xcb_input_string_feedback_ctl_t **/ typedef struct xcb_input_string_feedback_ctl_t { uint8_t class_id; uint8_t feedback_id; uint16_t len; uint8_t pad0[2]; uint16_t num_keysyms; } xcb_input_string_feedback_ctl_t; /** * @brief xcb_input_string_feedback_ctl_iterator_t **/ typedef struct xcb_input_string_feedback_ctl_iterator_t { xcb_input_string_feedback_ctl_t *data; int rem; int index; } xcb_input_string_feedback_ctl_iterator_t; /** * @brief xcb_input_bell_feedback_ctl_t **/ typedef struct xcb_input_bell_feedback_ctl_t { uint8_t class_id; uint8_t feedback_id; uint16_t len; int8_t percent; uint8_t pad0[3]; int16_t pitch; int16_t duration; } xcb_input_bell_feedback_ctl_t; /** * @brief xcb_input_bell_feedback_ctl_iterator_t **/ typedef struct xcb_input_bell_feedback_ctl_iterator_t { xcb_input_bell_feedback_ctl_t *data; int rem; int index; } xcb_input_bell_feedback_ctl_iterator_t; /** * @brief xcb_input_led_feedback_ctl_t **/ typedef struct xcb_input_led_feedback_ctl_t { uint8_t class_id; uint8_t feedback_id; uint16_t len; uint32_t led_mask; uint32_t led_values; } xcb_input_led_feedback_ctl_t; /** * @brief xcb_input_led_feedback_ctl_iterator_t **/ typedef struct xcb_input_led_feedback_ctl_iterator_t { xcb_input_led_feedback_ctl_t *data; int rem; int index; } xcb_input_led_feedback_ctl_iterator_t; /** * @brief xcb_input_feedback_ctl_data_t **/ typedef struct xcb_input_feedback_ctl_data_t { struct { xcb_input_key_code_t key; uint8_t auto_repeat_mode; int8_t key_click_percent; int8_t bell_percent; int16_t bell_pitch; int16_t bell_duration; uint32_t led_mask; uint32_t led_values; } keyboard; struct { uint8_t pad0[2]; int16_t num; int16_t denom; int16_t threshold; } pointer; struct { uint8_t pad1[2]; uint16_t num_keysyms; xcb_keysym_t *keysyms; } string; struct { int32_t int_to_display; } integer; struct { uint32_t led_mask; uint32_t led_values; } led; struct { int8_t percent; uint8_t pad2[3]; int16_t pitch; int16_t duration; } bell; } xcb_input_feedback_ctl_data_t; /** * @brief xcb_input_feedback_ctl_t **/ typedef struct xcb_input_feedback_ctl_t { uint8_t class_id; uint8_t feedback_id; uint16_t len; } xcb_input_feedback_ctl_t; void * xcb_input_feedback_ctl_data (const xcb_input_feedback_ctl_t *R); /** * @brief xcb_input_feedback_ctl_iterator_t **/ typedef struct xcb_input_feedback_ctl_iterator_t { xcb_input_feedback_ctl_t *data; int rem; int index; } xcb_input_feedback_ctl_iterator_t; typedef enum xcb_input_change_feedback_control_mask_t { XCB_INPUT_CHANGE_FEEDBACK_CONTROL_MASK_KEY_CLICK_PERCENT = 1, XCB_INPUT_CHANGE_FEEDBACK_CONTROL_MASK_PERCENT = 2, XCB_INPUT_CHANGE_FEEDBACK_CONTROL_MASK_PITCH = 4, XCB_INPUT_CHANGE_FEEDBACK_CONTROL_MASK_DURATION = 8, XCB_INPUT_CHANGE_FEEDBACK_CONTROL_MASK_LED = 16, XCB_INPUT_CHANGE_FEEDBACK_CONTROL_MASK_LED_MODE = 32, XCB_INPUT_CHANGE_FEEDBACK_CONTROL_MASK_KEY = 64, XCB_INPUT_CHANGE_FEEDBACK_CONTROL_MASK_AUTO_REPEAT_MODE = 128, XCB_INPUT_CHANGE_FEEDBACK_CONTROL_MASK_STRING = 1, XCB_INPUT_CHANGE_FEEDBACK_CONTROL_MASK_INTEGER = 1, XCB_INPUT_CHANGE_FEEDBACK_CONTROL_MASK_ACCEL_NUM = 1, XCB_INPUT_CHANGE_FEEDBACK_CONTROL_MASK_ACCEL_DENOM = 2, XCB_INPUT_CHANGE_FEEDBACK_CONTROL_MASK_THRESHOLD = 4 } xcb_input_change_feedback_control_mask_t; /** Opcode for xcb_input_change_feedback_control. */ #define XCB_INPUT_CHANGE_FEEDBACK_CONTROL 23 /** * @brief xcb_input_change_feedback_control_request_t **/ typedef struct xcb_input_change_feedback_control_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t mask; uint8_t device_id; uint8_t feedback_id; uint8_t pad0[2]; } xcb_input_change_feedback_control_request_t; /** * @brief xcb_input_get_device_key_mapping_cookie_t **/ typedef struct xcb_input_get_device_key_mapping_cookie_t { unsigned int sequence; } xcb_input_get_device_key_mapping_cookie_t; /** Opcode for xcb_input_get_device_key_mapping. */ #define XCB_INPUT_GET_DEVICE_KEY_MAPPING 24 /** * @brief xcb_input_get_device_key_mapping_request_t **/ typedef struct xcb_input_get_device_key_mapping_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t device_id; xcb_input_key_code_t first_keycode; uint8_t count; uint8_t pad0; } xcb_input_get_device_key_mapping_request_t; /** * @brief xcb_input_get_device_key_mapping_reply_t **/ typedef struct xcb_input_get_device_key_mapping_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint8_t keysyms_per_keycode; uint8_t pad0[23]; } xcb_input_get_device_key_mapping_reply_t; /** Opcode for xcb_input_change_device_key_mapping. */ #define XCB_INPUT_CHANGE_DEVICE_KEY_MAPPING 25 /** * @brief xcb_input_change_device_key_mapping_request_t **/ typedef struct xcb_input_change_device_key_mapping_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t device_id; xcb_input_key_code_t first_keycode; uint8_t keysyms_per_keycode; uint8_t keycode_count; } xcb_input_change_device_key_mapping_request_t; /** * @brief xcb_input_get_device_modifier_mapping_cookie_t **/ typedef struct xcb_input_get_device_modifier_mapping_cookie_t { unsigned int sequence; } xcb_input_get_device_modifier_mapping_cookie_t; /** Opcode for xcb_input_get_device_modifier_mapping. */ #define XCB_INPUT_GET_DEVICE_MODIFIER_MAPPING 26 /** * @brief xcb_input_get_device_modifier_mapping_request_t **/ typedef struct xcb_input_get_device_modifier_mapping_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t device_id; uint8_t pad0[3]; } xcb_input_get_device_modifier_mapping_request_t; /** * @brief xcb_input_get_device_modifier_mapping_reply_t **/ typedef struct xcb_input_get_device_modifier_mapping_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint8_t keycodes_per_modifier; uint8_t pad0[23]; } xcb_input_get_device_modifier_mapping_reply_t; /** * @brief xcb_input_set_device_modifier_mapping_cookie_t **/ typedef struct xcb_input_set_device_modifier_mapping_cookie_t { unsigned int sequence; } xcb_input_set_device_modifier_mapping_cookie_t; /** Opcode for xcb_input_set_device_modifier_mapping. */ #define XCB_INPUT_SET_DEVICE_MODIFIER_MAPPING 27 /** * @brief xcb_input_set_device_modifier_mapping_request_t **/ typedef struct xcb_input_set_device_modifier_mapping_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t device_id; uint8_t keycodes_per_modifier; uint8_t pad0[2]; } xcb_input_set_device_modifier_mapping_request_t; /** * @brief xcb_input_set_device_modifier_mapping_reply_t **/ typedef struct xcb_input_set_device_modifier_mapping_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint8_t status; uint8_t pad0[23]; } xcb_input_set_device_modifier_mapping_reply_t; /** * @brief xcb_input_get_device_button_mapping_cookie_t **/ typedef struct xcb_input_get_device_button_mapping_cookie_t { unsigned int sequence; } xcb_input_get_device_button_mapping_cookie_t; /** Opcode for xcb_input_get_device_button_mapping. */ #define XCB_INPUT_GET_DEVICE_BUTTON_MAPPING 28 /** * @brief xcb_input_get_device_button_mapping_request_t **/ typedef struct xcb_input_get_device_button_mapping_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t device_id; uint8_t pad0[3]; } xcb_input_get_device_button_mapping_request_t; /** * @brief xcb_input_get_device_button_mapping_reply_t **/ typedef struct xcb_input_get_device_button_mapping_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint8_t map_size; uint8_t pad0[23]; } xcb_input_get_device_button_mapping_reply_t; /** * @brief xcb_input_set_device_button_mapping_cookie_t **/ typedef struct xcb_input_set_device_button_mapping_cookie_t { unsigned int sequence; } xcb_input_set_device_button_mapping_cookie_t; /** Opcode for xcb_input_set_device_button_mapping. */ #define XCB_INPUT_SET_DEVICE_BUTTON_MAPPING 29 /** * @brief xcb_input_set_device_button_mapping_request_t **/ typedef struct xcb_input_set_device_button_mapping_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t device_id; uint8_t map_size; uint8_t pad0[2]; } xcb_input_set_device_button_mapping_request_t; /** * @brief xcb_input_set_device_button_mapping_reply_t **/ typedef struct xcb_input_set_device_button_mapping_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint8_t status; uint8_t pad0[23]; } xcb_input_set_device_button_mapping_reply_t; /** * @brief xcb_input_key_state_t **/ typedef struct xcb_input_key_state_t { uint8_t class_id; uint8_t len; uint8_t num_keys; uint8_t pad0; uint8_t keys[32]; } xcb_input_key_state_t; /** * @brief xcb_input_key_state_iterator_t **/ typedef struct xcb_input_key_state_iterator_t { xcb_input_key_state_t *data; int rem; int index; } xcb_input_key_state_iterator_t; /** * @brief xcb_input_button_state_t **/ typedef struct xcb_input_button_state_t { uint8_t class_id; uint8_t len; uint8_t num_buttons; uint8_t pad0; uint8_t buttons[32]; } xcb_input_button_state_t; /** * @brief xcb_input_button_state_iterator_t **/ typedef struct xcb_input_button_state_iterator_t { xcb_input_button_state_t *data; int rem; int index; } xcb_input_button_state_iterator_t; typedef enum xcb_input_valuator_state_mode_mask_t { XCB_INPUT_VALUATOR_STATE_MODE_MASK_DEVICE_MODE_ABSOLUTE = 1, XCB_INPUT_VALUATOR_STATE_MODE_MASK_OUT_OF_PROXIMITY = 2 } xcb_input_valuator_state_mode_mask_t; /** * @brief xcb_input_valuator_state_t **/ typedef struct xcb_input_valuator_state_t { uint8_t class_id; uint8_t len; uint8_t num_valuators; uint8_t mode; } xcb_input_valuator_state_t; /** * @brief xcb_input_valuator_state_iterator_t **/ typedef struct xcb_input_valuator_state_iterator_t { xcb_input_valuator_state_t *data; int rem; int index; } xcb_input_valuator_state_iterator_t; /** * @brief xcb_input_input_state_data_t **/ typedef struct xcb_input_input_state_data_t { struct { uint8_t num_keys; uint8_t pad0; uint8_t keys[32]; } key; struct { uint8_t num_buttons; uint8_t pad1; uint8_t buttons[32]; } button; struct { uint8_t num_valuators; uint8_t mode; int32_t *valuators; } valuator; } xcb_input_input_state_data_t; /** * @brief xcb_input_input_state_t **/ typedef struct xcb_input_input_state_t { uint8_t class_id; uint8_t len; } xcb_input_input_state_t; void * xcb_input_input_state_data (const xcb_input_input_state_t *R); /** * @brief xcb_input_input_state_iterator_t **/ typedef struct xcb_input_input_state_iterator_t { xcb_input_input_state_t *data; int rem; int index; } xcb_input_input_state_iterator_t; /** * @brief xcb_input_query_device_state_cookie_t **/ typedef struct xcb_input_query_device_state_cookie_t { unsigned int sequence; } xcb_input_query_device_state_cookie_t; /** Opcode for xcb_input_query_device_state. */ #define XCB_INPUT_QUERY_DEVICE_STATE 30 /** * @brief xcb_input_query_device_state_request_t **/ typedef struct xcb_input_query_device_state_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t device_id; uint8_t pad0[3]; } xcb_input_query_device_state_request_t; /** * @brief xcb_input_query_device_state_reply_t **/ typedef struct xcb_input_query_device_state_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint8_t num_classes; uint8_t pad0[23]; } xcb_input_query_device_state_reply_t; /** Opcode for xcb_input_device_bell. */ #define XCB_INPUT_DEVICE_BELL 32 /** * @brief xcb_input_device_bell_request_t **/ typedef struct xcb_input_device_bell_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t device_id; uint8_t feedback_id; uint8_t feedback_class; int8_t percent; } xcb_input_device_bell_request_t; /** * @brief xcb_input_set_device_valuators_cookie_t **/ typedef struct xcb_input_set_device_valuators_cookie_t { unsigned int sequence; } xcb_input_set_device_valuators_cookie_t; /** Opcode for xcb_input_set_device_valuators. */ #define XCB_INPUT_SET_DEVICE_VALUATORS 33 /** * @brief xcb_input_set_device_valuators_request_t **/ typedef struct xcb_input_set_device_valuators_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t device_id; uint8_t first_valuator; uint8_t num_valuators; uint8_t pad0; } xcb_input_set_device_valuators_request_t; /** * @brief xcb_input_set_device_valuators_reply_t **/ typedef struct xcb_input_set_device_valuators_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint8_t status; uint8_t pad0[23]; } xcb_input_set_device_valuators_reply_t; typedef enum xcb_input_device_control_t { XCB_INPUT_DEVICE_CONTROL_RESOLUTION = 1, XCB_INPUT_DEVICE_CONTROL_ABS_CALIB = 2, XCB_INPUT_DEVICE_CONTROL_CORE = 3, XCB_INPUT_DEVICE_CONTROL_ENABLE = 4, XCB_INPUT_DEVICE_CONTROL_ABS_AREA = 5 } xcb_input_device_control_t; /** * @brief xcb_input_device_resolution_state_t **/ typedef struct xcb_input_device_resolution_state_t { uint16_t control_id; uint16_t len; uint32_t num_valuators; } xcb_input_device_resolution_state_t; /** * @brief xcb_input_device_resolution_state_iterator_t **/ typedef struct xcb_input_device_resolution_state_iterator_t { xcb_input_device_resolution_state_t *data; int rem; int index; } xcb_input_device_resolution_state_iterator_t; /** * @brief xcb_input_device_abs_calib_state_t **/ typedef struct xcb_input_device_abs_calib_state_t { uint16_t control_id; uint16_t len; int32_t min_x; int32_t max_x; int32_t min_y; int32_t max_y; uint32_t flip_x; uint32_t flip_y; uint32_t rotation; uint32_t button_threshold; } xcb_input_device_abs_calib_state_t; /** * @brief xcb_input_device_abs_calib_state_iterator_t **/ typedef struct xcb_input_device_abs_calib_state_iterator_t { xcb_input_device_abs_calib_state_t *data; int rem; int index; } xcb_input_device_abs_calib_state_iterator_t; /** * @brief xcb_input_device_abs_area_state_t **/ typedef struct xcb_input_device_abs_area_state_t { uint16_t control_id; uint16_t len; uint32_t offset_x; uint32_t offset_y; uint32_t width; uint32_t height; uint32_t screen; uint32_t following; } xcb_input_device_abs_area_state_t; /** * @brief xcb_input_device_abs_area_state_iterator_t **/ typedef struct xcb_input_device_abs_area_state_iterator_t { xcb_input_device_abs_area_state_t *data; int rem; int index; } xcb_input_device_abs_area_state_iterator_t; /** * @brief xcb_input_device_core_state_t **/ typedef struct xcb_input_device_core_state_t { uint16_t control_id; uint16_t len; uint8_t status; uint8_t iscore; uint8_t pad0[2]; } xcb_input_device_core_state_t; /** * @brief xcb_input_device_core_state_iterator_t **/ typedef struct xcb_input_device_core_state_iterator_t { xcb_input_device_core_state_t *data; int rem; int index; } xcb_input_device_core_state_iterator_t; /** * @brief xcb_input_device_enable_state_t **/ typedef struct xcb_input_device_enable_state_t { uint16_t control_id; uint16_t len; uint8_t enable; uint8_t pad0[3]; } xcb_input_device_enable_state_t; /** * @brief xcb_input_device_enable_state_iterator_t **/ typedef struct xcb_input_device_enable_state_iterator_t { xcb_input_device_enable_state_t *data; int rem; int index; } xcb_input_device_enable_state_iterator_t; /** * @brief xcb_input_device_state_data_t **/ typedef struct xcb_input_device_state_data_t { struct { uint32_t num_valuators; uint32_t *resolution_values; uint32_t *resolution_min; uint32_t *resolution_max; } resolution; struct { int32_t min_x; int32_t max_x; int32_t min_y; int32_t max_y; uint32_t flip_x; uint32_t flip_y; uint32_t rotation; uint32_t button_threshold; } abs_calib; struct { uint8_t status; uint8_t iscore; uint8_t pad0[2]; } core; struct { uint8_t enable; uint8_t pad1[3]; } enable; struct { uint32_t offset_x; uint32_t offset_y; uint32_t width; uint32_t height; uint32_t screen; uint32_t following; } abs_area; } xcb_input_device_state_data_t; /** * @brief xcb_input_device_state_t **/ typedef struct xcb_input_device_state_t { uint16_t control_id; uint16_t len; } xcb_input_device_state_t; void * xcb_input_device_state_data (const xcb_input_device_state_t *R); /** * @brief xcb_input_device_state_iterator_t **/ typedef struct xcb_input_device_state_iterator_t { xcb_input_device_state_t *data; int rem; int index; } xcb_input_device_state_iterator_t; /** * @brief xcb_input_get_device_control_cookie_t **/ typedef struct xcb_input_get_device_control_cookie_t { unsigned int sequence; } xcb_input_get_device_control_cookie_t; /** Opcode for xcb_input_get_device_control. */ #define XCB_INPUT_GET_DEVICE_CONTROL 34 /** * @brief xcb_input_get_device_control_request_t **/ typedef struct xcb_input_get_device_control_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint16_t control_id; uint8_t device_id; uint8_t pad0; } xcb_input_get_device_control_request_t; /** * @brief xcb_input_get_device_control_reply_t **/ typedef struct xcb_input_get_device_control_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint8_t status; uint8_t pad0[23]; } xcb_input_get_device_control_reply_t; /** * @brief xcb_input_device_resolution_ctl_t **/ typedef struct xcb_input_device_resolution_ctl_t { uint16_t control_id; uint16_t len; uint8_t first_valuator; uint8_t num_valuators; uint8_t pad0[2]; } xcb_input_device_resolution_ctl_t; /** * @brief xcb_input_device_resolution_ctl_iterator_t **/ typedef struct xcb_input_device_resolution_ctl_iterator_t { xcb_input_device_resolution_ctl_t *data; int rem; int index; } xcb_input_device_resolution_ctl_iterator_t; /** * @brief xcb_input_device_abs_calib_ctl_t **/ typedef struct xcb_input_device_abs_calib_ctl_t { uint16_t control_id; uint16_t len; int32_t min_x; int32_t max_x; int32_t min_y; int32_t max_y; uint32_t flip_x; uint32_t flip_y; uint32_t rotation; uint32_t button_threshold; } xcb_input_device_abs_calib_ctl_t; /** * @brief xcb_input_device_abs_calib_ctl_iterator_t **/ typedef struct xcb_input_device_abs_calib_ctl_iterator_t { xcb_input_device_abs_calib_ctl_t *data; int rem; int index; } xcb_input_device_abs_calib_ctl_iterator_t; /** * @brief xcb_input_device_abs_area_ctrl_t **/ typedef struct xcb_input_device_abs_area_ctrl_t { uint16_t control_id; uint16_t len; uint32_t offset_x; uint32_t offset_y; int32_t width; int32_t height; int32_t screen; uint32_t following; } xcb_input_device_abs_area_ctrl_t; /** * @brief xcb_input_device_abs_area_ctrl_iterator_t **/ typedef struct xcb_input_device_abs_area_ctrl_iterator_t { xcb_input_device_abs_area_ctrl_t *data; int rem; int index; } xcb_input_device_abs_area_ctrl_iterator_t; /** * @brief xcb_input_device_core_ctrl_t **/ typedef struct xcb_input_device_core_ctrl_t { uint16_t control_id; uint16_t len; uint8_t status; uint8_t pad0[3]; } xcb_input_device_core_ctrl_t; /** * @brief xcb_input_device_core_ctrl_iterator_t **/ typedef struct xcb_input_device_core_ctrl_iterator_t { xcb_input_device_core_ctrl_t *data; int rem; int index; } xcb_input_device_core_ctrl_iterator_t; /** * @brief xcb_input_device_enable_ctrl_t **/ typedef struct xcb_input_device_enable_ctrl_t { uint16_t control_id; uint16_t len; uint8_t enable; uint8_t pad0[3]; } xcb_input_device_enable_ctrl_t; /** * @brief xcb_input_device_enable_ctrl_iterator_t **/ typedef struct xcb_input_device_enable_ctrl_iterator_t { xcb_input_device_enable_ctrl_t *data; int rem; int index; } xcb_input_device_enable_ctrl_iterator_t; /** * @brief xcb_input_device_ctl_data_t **/ typedef struct xcb_input_device_ctl_data_t { struct { uint8_t first_valuator; uint8_t num_valuators; uint8_t pad0[2]; uint32_t *resolution_values; } resolution; struct { int32_t min_x; int32_t max_x; int32_t min_y; int32_t max_y; uint32_t flip_x; uint32_t flip_y; uint32_t rotation; uint32_t button_threshold; } abs_calib; struct { uint8_t status; uint8_t pad1[3]; } core; struct { uint8_t enable; uint8_t pad2[3]; } enable; struct { uint32_t offset_x; uint32_t offset_y; int32_t width; int32_t height; int32_t screen; uint32_t following; } abs_area; } xcb_input_device_ctl_data_t; /** * @brief xcb_input_device_ctl_t **/ typedef struct xcb_input_device_ctl_t { uint16_t control_id; uint16_t len; } xcb_input_device_ctl_t; void * xcb_input_device_ctl_data (const xcb_input_device_ctl_t *R); /** * @brief xcb_input_device_ctl_iterator_t **/ typedef struct xcb_input_device_ctl_iterator_t { xcb_input_device_ctl_t *data; int rem; int index; } xcb_input_device_ctl_iterator_t; /** * @brief xcb_input_change_device_control_cookie_t **/ typedef struct xcb_input_change_device_control_cookie_t { unsigned int sequence; } xcb_input_change_device_control_cookie_t; /** Opcode for xcb_input_change_device_control. */ #define XCB_INPUT_CHANGE_DEVICE_CONTROL 35 /** * @brief xcb_input_change_device_control_request_t **/ typedef struct xcb_input_change_device_control_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint16_t control_id; uint8_t device_id; uint8_t pad0; } xcb_input_change_device_control_request_t; /** * @brief xcb_input_change_device_control_reply_t **/ typedef struct xcb_input_change_device_control_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint8_t status; uint8_t pad0[23]; } xcb_input_change_device_control_reply_t; /** * @brief xcb_input_list_device_properties_cookie_t **/ typedef struct xcb_input_list_device_properties_cookie_t { unsigned int sequence; } xcb_input_list_device_properties_cookie_t; /** Opcode for xcb_input_list_device_properties. */ #define XCB_INPUT_LIST_DEVICE_PROPERTIES 36 /** * @brief xcb_input_list_device_properties_request_t **/ typedef struct xcb_input_list_device_properties_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t device_id; uint8_t pad0[3]; } xcb_input_list_device_properties_request_t; /** * @brief xcb_input_list_device_properties_reply_t **/ typedef struct xcb_input_list_device_properties_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; uint16_t num_atoms; uint8_t pad0[22]; } xcb_input_list_device_properties_reply_t; typedef enum xcb_input_property_format_t { XCB_INPUT_PROPERTY_FORMAT_8_BITS = 8, XCB_INPUT_PROPERTY_FORMAT_16_BITS = 16, XCB_INPUT_PROPERTY_FORMAT_32_BITS = 32 } xcb_input_property_format_t; /** * @brief xcb_input_change_device_property_items_t **/ typedef struct xcb_input_change_device_property_items_t { uint8_t *data8; uint16_t *data16; uint32_t *data32; } xcb_input_change_device_property_items_t; /** Opcode for xcb_input_change_device_property. */ #define XCB_INPUT_CHANGE_DEVICE_PROPERTY 37 /** * @brief xcb_input_change_device_property_request_t **/ typedef struct xcb_input_change_device_property_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_atom_t property; xcb_atom_t type; uint8_t device_id; uint8_t format; uint8_t mode; uint8_t pad0; uint32_t num_items; } xcb_input_change_device_property_request_t; /** Opcode for xcb_input_delete_device_property. */ #define XCB_INPUT_DELETE_DEVICE_PROPERTY 38 /** * @brief xcb_input_delete_device_property_request_t **/ typedef struct xcb_input_delete_device_property_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_atom_t property; uint8_t device_id; uint8_t pad0[3]; } xcb_input_delete_device_property_request_t; /** * @brief xcb_input_get_device_property_cookie_t **/ typedef struct xcb_input_get_device_property_cookie_t { unsigned int sequence; } xcb_input_get_device_property_cookie_t; /** Opcode for xcb_input_get_device_property. */ #define XCB_INPUT_GET_DEVICE_PROPERTY 39 /** * @brief xcb_input_get_device_property_request_t **/ typedef struct xcb_input_get_device_property_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_atom_t property; xcb_atom_t type; uint32_t offset; uint32_t len; uint8_t device_id; uint8_t _delete; uint8_t pad0[2]; } xcb_input_get_device_property_request_t; /** * @brief xcb_input_get_device_property_items_t **/ typedef struct xcb_input_get_device_property_items_t { uint8_t *data8; uint16_t *data16; uint32_t *data32; } xcb_input_get_device_property_items_t; /** * @brief xcb_input_get_device_property_reply_t **/ typedef struct xcb_input_get_device_property_reply_t { uint8_t response_type; uint8_t xi_reply_type; uint16_t sequence; uint32_t length; xcb_atom_t type; uint32_t bytes_after; uint32_t num_items; uint8_t format; uint8_t device_id; uint8_t pad0[10]; } xcb_input_get_device_property_reply_t; typedef enum xcb_input_device_t { XCB_INPUT_DEVICE_ALL = 0, XCB_INPUT_DEVICE_ALL_MASTER = 1 } xcb_input_device_t; /** * @brief xcb_input_group_info_t **/ typedef struct xcb_input_group_info_t { uint8_t base; uint8_t latched; uint8_t locked; uint8_t effective; } xcb_input_group_info_t; /** * @brief xcb_input_group_info_iterator_t **/ typedef struct xcb_input_group_info_iterator_t { xcb_input_group_info_t *data; int rem; int index; } xcb_input_group_info_iterator_t; /** * @brief xcb_input_modifier_info_t **/ typedef struct xcb_input_modifier_info_t { uint32_t base; uint32_t latched; uint32_t locked; uint32_t effective; } xcb_input_modifier_info_t; /** * @brief xcb_input_modifier_info_iterator_t **/ typedef struct xcb_input_modifier_info_iterator_t { xcb_input_modifier_info_t *data; int rem; int index; } xcb_input_modifier_info_iterator_t; /** * @brief xcb_input_xi_query_pointer_cookie_t **/ typedef struct xcb_input_xi_query_pointer_cookie_t { unsigned int sequence; } xcb_input_xi_query_pointer_cookie_t; /** Opcode for xcb_input_xi_query_pointer. */ #define XCB_INPUT_XI_QUERY_POINTER 40 /** * @brief xcb_input_xi_query_pointer_request_t **/ typedef struct xcb_input_xi_query_pointer_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; xcb_input_device_id_t deviceid; uint8_t pad0[2]; } xcb_input_xi_query_pointer_request_t; /** * @brief xcb_input_xi_query_pointer_reply_t **/ typedef struct xcb_input_xi_query_pointer_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_window_t root; xcb_window_t child; xcb_input_fp1616_t root_x; xcb_input_fp1616_t root_y; xcb_input_fp1616_t win_x; xcb_input_fp1616_t win_y; uint8_t same_screen; uint8_t pad1; uint16_t buttons_len; xcb_input_modifier_info_t mods; xcb_input_group_info_t group; } xcb_input_xi_query_pointer_reply_t; /** Opcode for xcb_input_xi_warp_pointer. */ #define XCB_INPUT_XI_WARP_POINTER 41 /** * @brief xcb_input_xi_warp_pointer_request_t **/ typedef struct xcb_input_xi_warp_pointer_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t src_win; xcb_window_t dst_win; xcb_input_fp1616_t src_x; xcb_input_fp1616_t src_y; uint16_t src_width; uint16_t src_height; xcb_input_fp1616_t dst_x; xcb_input_fp1616_t dst_y; xcb_input_device_id_t deviceid; uint8_t pad0[2]; } xcb_input_xi_warp_pointer_request_t; /** Opcode for xcb_input_xi_change_cursor. */ #define XCB_INPUT_XI_CHANGE_CURSOR 42 /** * @brief xcb_input_xi_change_cursor_request_t **/ typedef struct xcb_input_xi_change_cursor_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; xcb_cursor_t cursor; xcb_input_device_id_t deviceid; uint8_t pad0[2]; } xcb_input_xi_change_cursor_request_t; typedef enum xcb_input_hierarchy_change_type_t { XCB_INPUT_HIERARCHY_CHANGE_TYPE_ADD_MASTER = 1, XCB_INPUT_HIERARCHY_CHANGE_TYPE_REMOVE_MASTER = 2, XCB_INPUT_HIERARCHY_CHANGE_TYPE_ATTACH_SLAVE = 3, XCB_INPUT_HIERARCHY_CHANGE_TYPE_DETACH_SLAVE = 4 } xcb_input_hierarchy_change_type_t; typedef enum xcb_input_change_mode_t { XCB_INPUT_CHANGE_MODE_ATTACH = 1, XCB_INPUT_CHANGE_MODE_FLOAT = 2 } xcb_input_change_mode_t; /** * @brief xcb_input_add_master_t **/ typedef struct xcb_input_add_master_t { uint16_t type; uint16_t len; uint16_t name_len; uint8_t send_core; uint8_t enable; } xcb_input_add_master_t; /** * @brief xcb_input_add_master_iterator_t **/ typedef struct xcb_input_add_master_iterator_t { xcb_input_add_master_t *data; int rem; int index; } xcb_input_add_master_iterator_t; /** * @brief xcb_input_remove_master_t **/ typedef struct xcb_input_remove_master_t { uint16_t type; uint16_t len; xcb_input_device_id_t deviceid; uint8_t return_mode; uint8_t pad0; xcb_input_device_id_t return_pointer; xcb_input_device_id_t return_keyboard; } xcb_input_remove_master_t; /** * @brief xcb_input_remove_master_iterator_t **/ typedef struct xcb_input_remove_master_iterator_t { xcb_input_remove_master_t *data; int rem; int index; } xcb_input_remove_master_iterator_t; /** * @brief xcb_input_attach_slave_t **/ typedef struct xcb_input_attach_slave_t { uint16_t type; uint16_t len; xcb_input_device_id_t deviceid; xcb_input_device_id_t master; } xcb_input_attach_slave_t; /** * @brief xcb_input_attach_slave_iterator_t **/ typedef struct xcb_input_attach_slave_iterator_t { xcb_input_attach_slave_t *data; int rem; int index; } xcb_input_attach_slave_iterator_t; /** * @brief xcb_input_detach_slave_t **/ typedef struct xcb_input_detach_slave_t { uint16_t type; uint16_t len; xcb_input_device_id_t deviceid; uint8_t pad0[2]; } xcb_input_detach_slave_t; /** * @brief xcb_input_detach_slave_iterator_t **/ typedef struct xcb_input_detach_slave_iterator_t { xcb_input_detach_slave_t *data; int rem; int index; } xcb_input_detach_slave_iterator_t; /** * @brief xcb_input_hierarchy_change_data_t **/ typedef struct xcb_input_hierarchy_change_data_t { struct { uint16_t name_len; uint8_t send_core; uint8_t enable; char *name; } add_master; struct { xcb_input_device_id_t deviceid; uint8_t return_mode; uint8_t pad1; xcb_input_device_id_t return_pointer; xcb_input_device_id_t return_keyboard; } remove_master; struct { xcb_input_device_id_t deviceid; xcb_input_device_id_t master; } attach_slave; struct { xcb_input_device_id_t deviceid; uint8_t pad2[2]; } detach_slave; } xcb_input_hierarchy_change_data_t; /** * @brief xcb_input_hierarchy_change_t **/ typedef struct xcb_input_hierarchy_change_t { uint16_t type; uint16_t len; } xcb_input_hierarchy_change_t; void * xcb_input_hierarchy_change_data (const xcb_input_hierarchy_change_t *R); /** * @brief xcb_input_hierarchy_change_iterator_t **/ typedef struct xcb_input_hierarchy_change_iterator_t { xcb_input_hierarchy_change_t *data; int rem; int index; } xcb_input_hierarchy_change_iterator_t; /** Opcode for xcb_input_xi_change_hierarchy. */ #define XCB_INPUT_XI_CHANGE_HIERARCHY 43 /** * @brief xcb_input_xi_change_hierarchy_request_t **/ typedef struct xcb_input_xi_change_hierarchy_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t num_changes; uint8_t pad0[3]; } xcb_input_xi_change_hierarchy_request_t; /** Opcode for xcb_input_xi_set_client_pointer. */ #define XCB_INPUT_XI_SET_CLIENT_POINTER 44 /** * @brief xcb_input_xi_set_client_pointer_request_t **/ typedef struct xcb_input_xi_set_client_pointer_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; xcb_input_device_id_t deviceid; uint8_t pad0[2]; } xcb_input_xi_set_client_pointer_request_t; /** * @brief xcb_input_xi_get_client_pointer_cookie_t **/ typedef struct xcb_input_xi_get_client_pointer_cookie_t { unsigned int sequence; } xcb_input_xi_get_client_pointer_cookie_t; /** Opcode for xcb_input_xi_get_client_pointer. */ #define XCB_INPUT_XI_GET_CLIENT_POINTER 45 /** * @brief xcb_input_xi_get_client_pointer_request_t **/ typedef struct xcb_input_xi_get_client_pointer_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_input_xi_get_client_pointer_request_t; /** * @brief xcb_input_xi_get_client_pointer_reply_t **/ typedef struct xcb_input_xi_get_client_pointer_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t set; uint8_t pad1; xcb_input_device_id_t deviceid; uint8_t pad2[20]; } xcb_input_xi_get_client_pointer_reply_t; typedef enum xcb_input_xi_event_mask_t { XCB_INPUT_XI_EVENT_MASK_DEVICE_CHANGED = 2, XCB_INPUT_XI_EVENT_MASK_KEY_PRESS = 4, XCB_INPUT_XI_EVENT_MASK_KEY_RELEASE = 8, XCB_INPUT_XI_EVENT_MASK_BUTTON_PRESS = 16, XCB_INPUT_XI_EVENT_MASK_BUTTON_RELEASE = 32, XCB_INPUT_XI_EVENT_MASK_MOTION = 64, XCB_INPUT_XI_EVENT_MASK_ENTER = 128, XCB_INPUT_XI_EVENT_MASK_LEAVE = 256, XCB_INPUT_XI_EVENT_MASK_FOCUS_IN = 512, XCB_INPUT_XI_EVENT_MASK_FOCUS_OUT = 1024, XCB_INPUT_XI_EVENT_MASK_HIERARCHY = 2048, XCB_INPUT_XI_EVENT_MASK_PROPERTY = 4096, XCB_INPUT_XI_EVENT_MASK_RAW_KEY_PRESS = 8192, XCB_INPUT_XI_EVENT_MASK_RAW_KEY_RELEASE = 16384, XCB_INPUT_XI_EVENT_MASK_RAW_BUTTON_PRESS = 32768, XCB_INPUT_XI_EVENT_MASK_RAW_BUTTON_RELEASE = 65536, XCB_INPUT_XI_EVENT_MASK_RAW_MOTION = 131072, XCB_INPUT_XI_EVENT_MASK_TOUCH_BEGIN = 262144, XCB_INPUT_XI_EVENT_MASK_TOUCH_UPDATE = 524288, XCB_INPUT_XI_EVENT_MASK_TOUCH_END = 1048576, XCB_INPUT_XI_EVENT_MASK_TOUCH_OWNERSHIP = 2097152, XCB_INPUT_XI_EVENT_MASK_RAW_TOUCH_BEGIN = 4194304, XCB_INPUT_XI_EVENT_MASK_RAW_TOUCH_UPDATE = 8388608, XCB_INPUT_XI_EVENT_MASK_RAW_TOUCH_END = 16777216, XCB_INPUT_XI_EVENT_MASK_BARRIER_HIT = 33554432, XCB_INPUT_XI_EVENT_MASK_BARRIER_LEAVE = 67108864 } xcb_input_xi_event_mask_t; /** * @brief xcb_input_event_mask_t **/ typedef struct xcb_input_event_mask_t { xcb_input_device_id_t deviceid; uint16_t mask_len; } xcb_input_event_mask_t; /** * @brief xcb_input_event_mask_iterator_t **/ typedef struct xcb_input_event_mask_iterator_t { xcb_input_event_mask_t *data; int rem; int index; } xcb_input_event_mask_iterator_t; /** Opcode for xcb_input_xi_select_events. */ #define XCB_INPUT_XI_SELECT_EVENTS 46 /** * @brief xcb_input_xi_select_events_request_t **/ typedef struct xcb_input_xi_select_events_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; uint16_t num_mask; uint8_t pad0[2]; } xcb_input_xi_select_events_request_t; /** * @brief xcb_input_xi_query_version_cookie_t **/ typedef struct xcb_input_xi_query_version_cookie_t { unsigned int sequence; } xcb_input_xi_query_version_cookie_t; /** Opcode for xcb_input_xi_query_version. */ #define XCB_INPUT_XI_QUERY_VERSION 47 /** * @brief xcb_input_xi_query_version_request_t **/ typedef struct xcb_input_xi_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint16_t major_version; uint16_t minor_version; } xcb_input_xi_query_version_request_t; /** * @brief xcb_input_xi_query_version_reply_t **/ typedef struct xcb_input_xi_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t major_version; uint16_t minor_version; uint8_t pad1[20]; } xcb_input_xi_query_version_reply_t; typedef enum xcb_input_device_class_type_t { XCB_INPUT_DEVICE_CLASS_TYPE_KEY = 0, XCB_INPUT_DEVICE_CLASS_TYPE_BUTTON = 1, XCB_INPUT_DEVICE_CLASS_TYPE_VALUATOR = 2, XCB_INPUT_DEVICE_CLASS_TYPE_SCROLL = 3, XCB_INPUT_DEVICE_CLASS_TYPE_TOUCH = 8 } xcb_input_device_class_type_t; typedef enum xcb_input_device_type_t { XCB_INPUT_DEVICE_TYPE_MASTER_POINTER = 1, XCB_INPUT_DEVICE_TYPE_MASTER_KEYBOARD = 2, XCB_INPUT_DEVICE_TYPE_SLAVE_POINTER = 3, XCB_INPUT_DEVICE_TYPE_SLAVE_KEYBOARD = 4, XCB_INPUT_DEVICE_TYPE_FLOATING_SLAVE = 5 } xcb_input_device_type_t; typedef enum xcb_input_scroll_flags_t { XCB_INPUT_SCROLL_FLAGS_NO_EMULATION = 1, XCB_INPUT_SCROLL_FLAGS_PREFERRED = 2 } xcb_input_scroll_flags_t; typedef enum xcb_input_scroll_type_t { XCB_INPUT_SCROLL_TYPE_VERTICAL = 1, XCB_INPUT_SCROLL_TYPE_HORIZONTAL = 2 } xcb_input_scroll_type_t; typedef enum xcb_input_touch_mode_t { XCB_INPUT_TOUCH_MODE_DIRECT = 1, XCB_INPUT_TOUCH_MODE_DEPENDENT = 2 } xcb_input_touch_mode_t; /** * @brief xcb_input_button_class_t **/ typedef struct xcb_input_button_class_t { uint16_t type; uint16_t len; xcb_input_device_id_t sourceid; uint16_t num_buttons; } xcb_input_button_class_t; /** * @brief xcb_input_button_class_iterator_t **/ typedef struct xcb_input_button_class_iterator_t { xcb_input_button_class_t *data; int rem; int index; } xcb_input_button_class_iterator_t; /** * @brief xcb_input_key_class_t **/ typedef struct xcb_input_key_class_t { uint16_t type; uint16_t len; xcb_input_device_id_t sourceid; uint16_t num_keys; } xcb_input_key_class_t; /** * @brief xcb_input_key_class_iterator_t **/ typedef struct xcb_input_key_class_iterator_t { xcb_input_key_class_t *data; int rem; int index; } xcb_input_key_class_iterator_t; /** * @brief xcb_input_scroll_class_t **/ typedef struct xcb_input_scroll_class_t { uint16_t type; uint16_t len; xcb_input_device_id_t sourceid; uint16_t number; uint16_t scroll_type; uint8_t pad0[2]; uint32_t flags; xcb_input_fp3232_t increment; } xcb_input_scroll_class_t; /** * @brief xcb_input_scroll_class_iterator_t **/ typedef struct xcb_input_scroll_class_iterator_t { xcb_input_scroll_class_t *data; int rem; int index; } xcb_input_scroll_class_iterator_t; /** * @brief xcb_input_touch_class_t **/ typedef struct xcb_input_touch_class_t { uint16_t type; uint16_t len; xcb_input_device_id_t sourceid; uint8_t mode; uint8_t num_touches; } xcb_input_touch_class_t; /** * @brief xcb_input_touch_class_iterator_t **/ typedef struct xcb_input_touch_class_iterator_t { xcb_input_touch_class_t *data; int rem; int index; } xcb_input_touch_class_iterator_t; /** * @brief xcb_input_valuator_class_t **/ typedef struct xcb_input_valuator_class_t { uint16_t type; uint16_t len; xcb_input_device_id_t sourceid; uint16_t number; xcb_atom_t label; xcb_input_fp3232_t min; xcb_input_fp3232_t max; xcb_input_fp3232_t value; uint32_t resolution; uint8_t mode; uint8_t pad0[3]; } xcb_input_valuator_class_t; /** * @brief xcb_input_valuator_class_iterator_t **/ typedef struct xcb_input_valuator_class_iterator_t { xcb_input_valuator_class_t *data; int rem; int index; } xcb_input_valuator_class_iterator_t; /** * @brief xcb_input_device_class_data_t **/ typedef struct xcb_input_device_class_data_t { struct { uint16_t num_keys; uint32_t *keys; } key; struct { uint16_t num_buttons; uint32_t *state; xcb_atom_t *labels; } button; struct { uint16_t number; xcb_atom_t label; xcb_input_fp3232_t min; xcb_input_fp3232_t max; xcb_input_fp3232_t value; uint32_t resolution; uint8_t mode; uint8_t pad0[3]; } valuator; struct { uint16_t number; uint16_t scroll_type; uint8_t pad1[2]; uint32_t flags; xcb_input_fp3232_t increment; } scroll; struct { uint8_t mode; uint8_t num_touches; } touch; } xcb_input_device_class_data_t; /** * @brief xcb_input_device_class_t **/ typedef struct xcb_input_device_class_t { uint16_t type; uint16_t len; xcb_input_device_id_t sourceid; } xcb_input_device_class_t; void * xcb_input_device_class_data (const xcb_input_device_class_t *R); /** * @brief xcb_input_device_class_iterator_t **/ typedef struct xcb_input_device_class_iterator_t { xcb_input_device_class_t *data; int rem; int index; } xcb_input_device_class_iterator_t; /** * @brief xcb_input_xi_device_info_t **/ typedef struct xcb_input_xi_device_info_t { xcb_input_device_id_t deviceid; uint16_t type; xcb_input_device_id_t attachment; uint16_t num_classes; uint16_t name_len; uint8_t enabled; uint8_t pad0; } xcb_input_xi_device_info_t; /** * @brief xcb_input_xi_device_info_iterator_t **/ typedef struct xcb_input_xi_device_info_iterator_t { xcb_input_xi_device_info_t *data; int rem; int index; } xcb_input_xi_device_info_iterator_t; /** * @brief xcb_input_xi_query_device_cookie_t **/ typedef struct xcb_input_xi_query_device_cookie_t { unsigned int sequence; } xcb_input_xi_query_device_cookie_t; /** Opcode for xcb_input_xi_query_device. */ #define XCB_INPUT_XI_QUERY_DEVICE 48 /** * @brief xcb_input_xi_query_device_request_t **/ typedef struct xcb_input_xi_query_device_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_input_device_id_t deviceid; uint8_t pad0[2]; } xcb_input_xi_query_device_request_t; /** * @brief xcb_input_xi_query_device_reply_t **/ typedef struct xcb_input_xi_query_device_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t num_infos; uint8_t pad1[22]; } xcb_input_xi_query_device_reply_t; /** Opcode for xcb_input_xi_set_focus. */ #define XCB_INPUT_XI_SET_FOCUS 49 /** * @brief xcb_input_xi_set_focus_request_t **/ typedef struct xcb_input_xi_set_focus_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; xcb_timestamp_t time; xcb_input_device_id_t deviceid; uint8_t pad0[2]; } xcb_input_xi_set_focus_request_t; /** * @brief xcb_input_xi_get_focus_cookie_t **/ typedef struct xcb_input_xi_get_focus_cookie_t { unsigned int sequence; } xcb_input_xi_get_focus_cookie_t; /** Opcode for xcb_input_xi_get_focus. */ #define XCB_INPUT_XI_GET_FOCUS 50 /** * @brief xcb_input_xi_get_focus_request_t **/ typedef struct xcb_input_xi_get_focus_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_input_device_id_t deviceid; uint8_t pad0[2]; } xcb_input_xi_get_focus_request_t; /** * @brief xcb_input_xi_get_focus_reply_t **/ typedef struct xcb_input_xi_get_focus_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_window_t focus; uint8_t pad1[20]; } xcb_input_xi_get_focus_reply_t; typedef enum xcb_input_grab_owner_t { XCB_INPUT_GRAB_OWNER_NO_OWNER = 0, XCB_INPUT_GRAB_OWNER_OWNER = 1 } xcb_input_grab_owner_t; /** * @brief xcb_input_xi_grab_device_cookie_t **/ typedef struct xcb_input_xi_grab_device_cookie_t { unsigned int sequence; } xcb_input_xi_grab_device_cookie_t; /** Opcode for xcb_input_xi_grab_device. */ #define XCB_INPUT_XI_GRAB_DEVICE 51 /** * @brief xcb_input_xi_grab_device_request_t **/ typedef struct xcb_input_xi_grab_device_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; xcb_timestamp_t time; xcb_cursor_t cursor; xcb_input_device_id_t deviceid; uint8_t mode; uint8_t paired_device_mode; uint8_t owner_events; uint8_t pad0; uint16_t mask_len; } xcb_input_xi_grab_device_request_t; /** * @brief xcb_input_xi_grab_device_reply_t **/ typedef struct xcb_input_xi_grab_device_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t status; uint8_t pad1[23]; } xcb_input_xi_grab_device_reply_t; /** Opcode for xcb_input_xi_ungrab_device. */ #define XCB_INPUT_XI_UNGRAB_DEVICE 52 /** * @brief xcb_input_xi_ungrab_device_request_t **/ typedef struct xcb_input_xi_ungrab_device_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_timestamp_t time; xcb_input_device_id_t deviceid; uint8_t pad0[2]; } xcb_input_xi_ungrab_device_request_t; typedef enum xcb_input_event_mode_t { XCB_INPUT_EVENT_MODE_ASYNC_DEVICE = 0, XCB_INPUT_EVENT_MODE_SYNC_DEVICE = 1, XCB_INPUT_EVENT_MODE_REPLAY_DEVICE = 2, XCB_INPUT_EVENT_MODE_ASYNC_PAIRED_DEVICE = 3, XCB_INPUT_EVENT_MODE_ASYNC_PAIR = 4, XCB_INPUT_EVENT_MODE_SYNC_PAIR = 5, XCB_INPUT_EVENT_MODE_ACCEPT_TOUCH = 6, XCB_INPUT_EVENT_MODE_REJECT_TOUCH = 7 } xcb_input_event_mode_t; /** Opcode for xcb_input_xi_allow_events. */ #define XCB_INPUT_XI_ALLOW_EVENTS 53 /** * @brief xcb_input_xi_allow_events_request_t **/ typedef struct xcb_input_xi_allow_events_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_timestamp_t time; xcb_input_device_id_t deviceid; uint8_t event_mode; uint8_t pad0; uint32_t touchid; xcb_window_t grab_window; } xcb_input_xi_allow_events_request_t; typedef enum xcb_input_grab_mode_22_t { XCB_INPUT_GRAB_MODE_22_SYNC = 0, XCB_INPUT_GRAB_MODE_22_ASYNC = 1, XCB_INPUT_GRAB_MODE_22_TOUCH = 2 } xcb_input_grab_mode_22_t; typedef enum xcb_input_grab_type_t { XCB_INPUT_GRAB_TYPE_BUTTON = 0, XCB_INPUT_GRAB_TYPE_KEYCODE = 1, XCB_INPUT_GRAB_TYPE_ENTER = 2, XCB_INPUT_GRAB_TYPE_FOCUS_IN = 3, XCB_INPUT_GRAB_TYPE_TOUCH_BEGIN = 4 } xcb_input_grab_type_t; typedef enum xcb_input_modifier_mask_t { XCB_INPUT_MODIFIER_MASK_ANY = 2147483648 } xcb_input_modifier_mask_t; /** * @brief xcb_input_grab_modifier_info_t **/ typedef struct xcb_input_grab_modifier_info_t { uint32_t modifiers; uint8_t status; uint8_t pad0[3]; } xcb_input_grab_modifier_info_t; /** * @brief xcb_input_grab_modifier_info_iterator_t **/ typedef struct xcb_input_grab_modifier_info_iterator_t { xcb_input_grab_modifier_info_t *data; int rem; int index; } xcb_input_grab_modifier_info_iterator_t; /** * @brief xcb_input_xi_passive_grab_device_cookie_t **/ typedef struct xcb_input_xi_passive_grab_device_cookie_t { unsigned int sequence; } xcb_input_xi_passive_grab_device_cookie_t; /** Opcode for xcb_input_xi_passive_grab_device. */ #define XCB_INPUT_XI_PASSIVE_GRAB_DEVICE 54 /** * @brief xcb_input_xi_passive_grab_device_request_t **/ typedef struct xcb_input_xi_passive_grab_device_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_timestamp_t time; xcb_window_t grab_window; xcb_cursor_t cursor; uint32_t detail; xcb_input_device_id_t deviceid; uint16_t num_modifiers; uint16_t mask_len; uint8_t grab_type; uint8_t grab_mode; uint8_t paired_device_mode; uint8_t owner_events; uint8_t pad0[2]; } xcb_input_xi_passive_grab_device_request_t; /** * @brief xcb_input_xi_passive_grab_device_reply_t **/ typedef struct xcb_input_xi_passive_grab_device_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t num_modifiers; uint8_t pad1[22]; } xcb_input_xi_passive_grab_device_reply_t; /** Opcode for xcb_input_xi_passive_ungrab_device. */ #define XCB_INPUT_XI_PASSIVE_UNGRAB_DEVICE 55 /** * @brief xcb_input_xi_passive_ungrab_device_request_t **/ typedef struct xcb_input_xi_passive_ungrab_device_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t grab_window; uint32_t detail; xcb_input_device_id_t deviceid; uint16_t num_modifiers; uint8_t grab_type; uint8_t pad0[3]; } xcb_input_xi_passive_ungrab_device_request_t; /** * @brief xcb_input_xi_list_properties_cookie_t **/ typedef struct xcb_input_xi_list_properties_cookie_t { unsigned int sequence; } xcb_input_xi_list_properties_cookie_t; /** Opcode for xcb_input_xi_list_properties. */ #define XCB_INPUT_XI_LIST_PROPERTIES 56 /** * @brief xcb_input_xi_list_properties_request_t **/ typedef struct xcb_input_xi_list_properties_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_input_device_id_t deviceid; uint8_t pad0[2]; } xcb_input_xi_list_properties_request_t; /** * @brief xcb_input_xi_list_properties_reply_t **/ typedef struct xcb_input_xi_list_properties_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t num_properties; uint8_t pad1[22]; } xcb_input_xi_list_properties_reply_t; /** * @brief xcb_input_xi_change_property_items_t **/ typedef struct xcb_input_xi_change_property_items_t { uint8_t *data8; uint16_t *data16; uint32_t *data32; } xcb_input_xi_change_property_items_t; /** Opcode for xcb_input_xi_change_property. */ #define XCB_INPUT_XI_CHANGE_PROPERTY 57 /** * @brief xcb_input_xi_change_property_request_t **/ typedef struct xcb_input_xi_change_property_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_input_device_id_t deviceid; uint8_t mode; uint8_t format; xcb_atom_t property; xcb_atom_t type; uint32_t num_items; } xcb_input_xi_change_property_request_t; /** Opcode for xcb_input_xi_delete_property. */ #define XCB_INPUT_XI_DELETE_PROPERTY 58 /** * @brief xcb_input_xi_delete_property_request_t **/ typedef struct xcb_input_xi_delete_property_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_input_device_id_t deviceid; uint8_t pad0[2]; xcb_atom_t property; } xcb_input_xi_delete_property_request_t; /** * @brief xcb_input_xi_get_property_cookie_t **/ typedef struct xcb_input_xi_get_property_cookie_t { unsigned int sequence; } xcb_input_xi_get_property_cookie_t; /** Opcode for xcb_input_xi_get_property. */ #define XCB_INPUT_XI_GET_PROPERTY 59 /** * @brief xcb_input_xi_get_property_request_t **/ typedef struct xcb_input_xi_get_property_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_input_device_id_t deviceid; uint8_t _delete; uint8_t pad0; xcb_atom_t property; xcb_atom_t type; uint32_t offset; uint32_t len; } xcb_input_xi_get_property_request_t; /** * @brief xcb_input_xi_get_property_items_t **/ typedef struct xcb_input_xi_get_property_items_t { uint8_t *data8; uint16_t *data16; uint32_t *data32; } xcb_input_xi_get_property_items_t; /** * @brief xcb_input_xi_get_property_reply_t **/ typedef struct xcb_input_xi_get_property_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_atom_t type; uint32_t bytes_after; uint32_t num_items; uint8_t format; uint8_t pad1[11]; } xcb_input_xi_get_property_reply_t; /** * @brief xcb_input_xi_get_selected_events_cookie_t **/ typedef struct xcb_input_xi_get_selected_events_cookie_t { unsigned int sequence; } xcb_input_xi_get_selected_events_cookie_t; /** Opcode for xcb_input_xi_get_selected_events. */ #define XCB_INPUT_XI_GET_SELECTED_EVENTS 60 /** * @brief xcb_input_xi_get_selected_events_request_t **/ typedef struct xcb_input_xi_get_selected_events_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_input_xi_get_selected_events_request_t; /** * @brief xcb_input_xi_get_selected_events_reply_t **/ typedef struct xcb_input_xi_get_selected_events_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t num_masks; uint8_t pad1[22]; } xcb_input_xi_get_selected_events_reply_t; /** * @brief xcb_input_barrier_release_pointer_info_t **/ typedef struct xcb_input_barrier_release_pointer_info_t { xcb_input_device_id_t deviceid; uint8_t pad0[2]; xcb_xfixes_barrier_t barrier; uint32_t eventid; } xcb_input_barrier_release_pointer_info_t; /** * @brief xcb_input_barrier_release_pointer_info_iterator_t **/ typedef struct xcb_input_barrier_release_pointer_info_iterator_t { xcb_input_barrier_release_pointer_info_t *data; int rem; int index; } xcb_input_barrier_release_pointer_info_iterator_t; /** Opcode for xcb_input_xi_barrier_release_pointer. */ #define XCB_INPUT_XI_BARRIER_RELEASE_POINTER 61 /** * @brief xcb_input_xi_barrier_release_pointer_request_t **/ typedef struct xcb_input_xi_barrier_release_pointer_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t num_barriers; } xcb_input_xi_barrier_release_pointer_request_t; /** Opcode for xcb_input_device_valuator. */ #define XCB_INPUT_DEVICE_VALUATOR 0 /** * @brief xcb_input_device_valuator_event_t **/ typedef struct xcb_input_device_valuator_event_t { uint8_t response_type; uint8_t device_id; uint16_t sequence; uint16_t device_state; uint8_t num_valuators; uint8_t first_valuator; int32_t valuators[6]; } xcb_input_device_valuator_event_t; typedef enum xcb_input_more_events_mask_t { XCB_INPUT_MORE_EVENTS_MASK_MORE_EVENTS = 128 } xcb_input_more_events_mask_t; /** Opcode for xcb_input_device_key_press. */ #define XCB_INPUT_DEVICE_KEY_PRESS 1 /** * @brief xcb_input_device_key_press_event_t **/ typedef struct xcb_input_device_key_press_event_t { uint8_t response_type; uint8_t detail; uint16_t sequence; xcb_timestamp_t time; xcb_window_t root; xcb_window_t event; xcb_window_t child; int16_t root_x; int16_t root_y; int16_t event_x; int16_t event_y; uint16_t state; uint8_t same_screen; uint8_t device_id; } xcb_input_device_key_press_event_t; /** Opcode for xcb_input_device_key_release. */ #define XCB_INPUT_DEVICE_KEY_RELEASE 2 typedef xcb_input_device_key_press_event_t xcb_input_device_key_release_event_t; /** Opcode for xcb_input_device_button_press. */ #define XCB_INPUT_DEVICE_BUTTON_PRESS 3 typedef xcb_input_device_key_press_event_t xcb_input_device_button_press_event_t; /** Opcode for xcb_input_device_button_release. */ #define XCB_INPUT_DEVICE_BUTTON_RELEASE 4 typedef xcb_input_device_key_press_event_t xcb_input_device_button_release_event_t; /** Opcode for xcb_input_device_motion_notify. */ #define XCB_INPUT_DEVICE_MOTION_NOTIFY 5 typedef xcb_input_device_key_press_event_t xcb_input_device_motion_notify_event_t; /** Opcode for xcb_input_device_focus_in. */ #define XCB_INPUT_DEVICE_FOCUS_IN 6 /** * @brief xcb_input_device_focus_in_event_t **/ typedef struct xcb_input_device_focus_in_event_t { uint8_t response_type; uint8_t detail; uint16_t sequence; xcb_timestamp_t time; xcb_window_t window; uint8_t mode; uint8_t device_id; uint8_t pad0[18]; } xcb_input_device_focus_in_event_t; /** Opcode for xcb_input_device_focus_out. */ #define XCB_INPUT_DEVICE_FOCUS_OUT 7 typedef xcb_input_device_focus_in_event_t xcb_input_device_focus_out_event_t; /** Opcode for xcb_input_proximity_in. */ #define XCB_INPUT_PROXIMITY_IN 8 typedef xcb_input_device_key_press_event_t xcb_input_proximity_in_event_t; /** Opcode for xcb_input_proximity_out. */ #define XCB_INPUT_PROXIMITY_OUT 9 typedef xcb_input_device_key_press_event_t xcb_input_proximity_out_event_t; typedef enum xcb_input_classes_reported_mask_t { XCB_INPUT_CLASSES_REPORTED_MASK_OUT_OF_PROXIMITY = 128, XCB_INPUT_CLASSES_REPORTED_MASK_DEVICE_MODE_ABSOLUTE = 64, XCB_INPUT_CLASSES_REPORTED_MASK_REPORTING_VALUATORS = 4, XCB_INPUT_CLASSES_REPORTED_MASK_REPORTING_BUTTONS = 2, XCB_INPUT_CLASSES_REPORTED_MASK_REPORTING_KEYS = 1 } xcb_input_classes_reported_mask_t; /** Opcode for xcb_input_device_state_notify. */ #define XCB_INPUT_DEVICE_STATE_NOTIFY 10 /** * @brief xcb_input_device_state_notify_event_t **/ typedef struct xcb_input_device_state_notify_event_t { uint8_t response_type; uint8_t device_id; uint16_t sequence; xcb_timestamp_t time; uint8_t num_keys; uint8_t num_buttons; uint8_t num_valuators; uint8_t classes_reported; uint8_t buttons[4]; uint8_t keys[4]; uint32_t valuators[3]; } xcb_input_device_state_notify_event_t; /** Opcode for xcb_input_device_mapping_notify. */ #define XCB_INPUT_DEVICE_MAPPING_NOTIFY 11 /** * @brief xcb_input_device_mapping_notify_event_t **/ typedef struct xcb_input_device_mapping_notify_event_t { uint8_t response_type; uint8_t device_id; uint16_t sequence; uint8_t request; xcb_input_key_code_t first_keycode; uint8_t count; uint8_t pad0; xcb_timestamp_t time; uint8_t pad1[20]; } xcb_input_device_mapping_notify_event_t; typedef enum xcb_input_change_device_t { XCB_INPUT_CHANGE_DEVICE_NEW_POINTER = 0, XCB_INPUT_CHANGE_DEVICE_NEW_KEYBOARD = 1 } xcb_input_change_device_t; /** Opcode for xcb_input_change_device_notify. */ #define XCB_INPUT_CHANGE_DEVICE_NOTIFY 12 /** * @brief xcb_input_change_device_notify_event_t **/ typedef struct xcb_input_change_device_notify_event_t { uint8_t response_type; uint8_t device_id; uint16_t sequence; xcb_timestamp_t time; uint8_t request; uint8_t pad0[23]; } xcb_input_change_device_notify_event_t; /** Opcode for xcb_input_device_key_state_notify. */ #define XCB_INPUT_DEVICE_KEY_STATE_NOTIFY 13 /** * @brief xcb_input_device_key_state_notify_event_t **/ typedef struct xcb_input_device_key_state_notify_event_t { uint8_t response_type; uint8_t device_id; uint16_t sequence; uint8_t keys[28]; } xcb_input_device_key_state_notify_event_t; /** Opcode for xcb_input_device_button_state_notify. */ #define XCB_INPUT_DEVICE_BUTTON_STATE_NOTIFY 14 /** * @brief xcb_input_device_button_state_notify_event_t **/ typedef struct xcb_input_device_button_state_notify_event_t { uint8_t response_type; uint8_t device_id; uint16_t sequence; uint8_t buttons[28]; } xcb_input_device_button_state_notify_event_t; typedef enum xcb_input_device_change_t { XCB_INPUT_DEVICE_CHANGE_ADDED = 0, XCB_INPUT_DEVICE_CHANGE_REMOVED = 1, XCB_INPUT_DEVICE_CHANGE_ENABLED = 2, XCB_INPUT_DEVICE_CHANGE_DISABLED = 3, XCB_INPUT_DEVICE_CHANGE_UNRECOVERABLE = 4, XCB_INPUT_DEVICE_CHANGE_CONTROL_CHANGED = 5 } xcb_input_device_change_t; /** Opcode for xcb_input_device_presence_notify. */ #define XCB_INPUT_DEVICE_PRESENCE_NOTIFY 15 /** * @brief xcb_input_device_presence_notify_event_t **/ typedef struct xcb_input_device_presence_notify_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_timestamp_t time; uint8_t devchange; uint8_t device_id; uint16_t control; uint8_t pad1[20]; } xcb_input_device_presence_notify_event_t; /** Opcode for xcb_input_device_property_notify. */ #define XCB_INPUT_DEVICE_PROPERTY_NOTIFY 16 /** * @brief xcb_input_device_property_notify_event_t **/ typedef struct xcb_input_device_property_notify_event_t { uint8_t response_type; uint8_t state; uint16_t sequence; xcb_timestamp_t time; xcb_atom_t property; uint8_t pad0[19]; uint8_t device_id; } xcb_input_device_property_notify_event_t; typedef enum xcb_input_change_reason_t { XCB_INPUT_CHANGE_REASON_SLAVE_SWITCH = 1, XCB_INPUT_CHANGE_REASON_DEVICE_CHANGE = 2 } xcb_input_change_reason_t; /** Opcode for xcb_input_device_changed. */ #define XCB_INPUT_DEVICE_CHANGED 1 /** * @brief xcb_input_device_changed_event_t **/ typedef struct xcb_input_device_changed_event_t { uint8_t response_type; uint8_t extension; uint16_t sequence; uint32_t length; uint16_t event_type; xcb_input_device_id_t deviceid; xcb_timestamp_t time; uint16_t num_classes; xcb_input_device_id_t sourceid; uint8_t reason; uint8_t pad0[11]; uint32_t full_sequence; } xcb_input_device_changed_event_t; typedef enum xcb_input_key_event_flags_t { XCB_INPUT_KEY_EVENT_FLAGS_KEY_REPEAT = 65536 } xcb_input_key_event_flags_t; /** Opcode for xcb_input_key_press. */ #define XCB_INPUT_KEY_PRESS 2 /** * @brief xcb_input_key_press_event_t **/ typedef struct xcb_input_key_press_event_t { uint8_t response_type; uint8_t extension; uint16_t sequence; uint32_t length; uint16_t event_type; xcb_input_device_id_t deviceid; xcb_timestamp_t time; uint32_t detail; xcb_window_t root; xcb_window_t event; xcb_window_t child; uint32_t full_sequence; xcb_input_fp1616_t root_x; xcb_input_fp1616_t root_y; xcb_input_fp1616_t event_x; xcb_input_fp1616_t event_y; uint16_t buttons_len; uint16_t valuators_len; xcb_input_device_id_t sourceid; uint8_t pad0[2]; uint32_t flags; xcb_input_modifier_info_t mods; xcb_input_group_info_t group; } xcb_input_key_press_event_t; /** Opcode for xcb_input_key_release. */ #define XCB_INPUT_KEY_RELEASE 3 typedef xcb_input_key_press_event_t xcb_input_key_release_event_t; typedef enum xcb_input_pointer_event_flags_t { XCB_INPUT_POINTER_EVENT_FLAGS_POINTER_EMULATED = 65536 } xcb_input_pointer_event_flags_t; /** Opcode for xcb_input_button_press. */ #define XCB_INPUT_BUTTON_PRESS 4 /** * @brief xcb_input_button_press_event_t **/ typedef struct xcb_input_button_press_event_t { uint8_t response_type; uint8_t extension; uint16_t sequence; uint32_t length; uint16_t event_type; xcb_input_device_id_t deviceid; xcb_timestamp_t time; uint32_t detail; xcb_window_t root; xcb_window_t event; xcb_window_t child; uint32_t full_sequence; xcb_input_fp1616_t root_x; xcb_input_fp1616_t root_y; xcb_input_fp1616_t event_x; xcb_input_fp1616_t event_y; uint16_t buttons_len; uint16_t valuators_len; xcb_input_device_id_t sourceid; uint8_t pad0[2]; uint32_t flags; xcb_input_modifier_info_t mods; xcb_input_group_info_t group; } xcb_input_button_press_event_t; /** Opcode for xcb_input_button_release. */ #define XCB_INPUT_BUTTON_RELEASE 5 typedef xcb_input_button_press_event_t xcb_input_button_release_event_t; /** Opcode for xcb_input_motion. */ #define XCB_INPUT_MOTION 6 typedef xcb_input_button_press_event_t xcb_input_motion_event_t; typedef enum xcb_input_notify_mode_t { XCB_INPUT_NOTIFY_MODE_NORMAL = 0, XCB_INPUT_NOTIFY_MODE_GRAB = 1, XCB_INPUT_NOTIFY_MODE_UNGRAB = 2, XCB_INPUT_NOTIFY_MODE_WHILE_GRABBED = 3, XCB_INPUT_NOTIFY_MODE_PASSIVE_GRAB = 4, XCB_INPUT_NOTIFY_MODE_PASSIVE_UNGRAB = 5 } xcb_input_notify_mode_t; typedef enum xcb_input_notify_detail_t { XCB_INPUT_NOTIFY_DETAIL_ANCESTOR = 0, XCB_INPUT_NOTIFY_DETAIL_VIRTUAL = 1, XCB_INPUT_NOTIFY_DETAIL_INFERIOR = 2, XCB_INPUT_NOTIFY_DETAIL_NONLINEAR = 3, XCB_INPUT_NOTIFY_DETAIL_NONLINEAR_VIRTUAL = 4, XCB_INPUT_NOTIFY_DETAIL_POINTER = 5, XCB_INPUT_NOTIFY_DETAIL_POINTER_ROOT = 6, XCB_INPUT_NOTIFY_DETAIL_NONE = 7 } xcb_input_notify_detail_t; /** Opcode for xcb_input_enter. */ #define XCB_INPUT_ENTER 7 /** * @brief xcb_input_enter_event_t **/ typedef struct xcb_input_enter_event_t { uint8_t response_type; uint8_t extension; uint16_t sequence; uint32_t length; uint16_t event_type; xcb_input_device_id_t deviceid; xcb_timestamp_t time; xcb_input_device_id_t sourceid; uint8_t mode; uint8_t detail; xcb_window_t root; xcb_window_t event; xcb_window_t child; uint32_t full_sequence; xcb_input_fp1616_t root_x; xcb_input_fp1616_t root_y; xcb_input_fp1616_t event_x; xcb_input_fp1616_t event_y; uint8_t same_screen; uint8_t focus; uint16_t buttons_len; xcb_input_modifier_info_t mods; xcb_input_group_info_t group; } xcb_input_enter_event_t; /** Opcode for xcb_input_leave. */ #define XCB_INPUT_LEAVE 8 typedef xcb_input_enter_event_t xcb_input_leave_event_t; /** Opcode for xcb_input_focus_in. */ #define XCB_INPUT_FOCUS_IN 9 typedef xcb_input_enter_event_t xcb_input_focus_in_event_t; /** Opcode for xcb_input_focus_out. */ #define XCB_INPUT_FOCUS_OUT 10 typedef xcb_input_enter_event_t xcb_input_focus_out_event_t; typedef enum xcb_input_hierarchy_mask_t { XCB_INPUT_HIERARCHY_MASK_MASTER_ADDED = 1, XCB_INPUT_HIERARCHY_MASK_MASTER_REMOVED = 2, XCB_INPUT_HIERARCHY_MASK_SLAVE_ADDED = 4, XCB_INPUT_HIERARCHY_MASK_SLAVE_REMOVED = 8, XCB_INPUT_HIERARCHY_MASK_SLAVE_ATTACHED = 16, XCB_INPUT_HIERARCHY_MASK_SLAVE_DETACHED = 32, XCB_INPUT_HIERARCHY_MASK_DEVICE_ENABLED = 64, XCB_INPUT_HIERARCHY_MASK_DEVICE_DISABLED = 128 } xcb_input_hierarchy_mask_t; /** * @brief xcb_input_hierarchy_info_t **/ typedef struct xcb_input_hierarchy_info_t { xcb_input_device_id_t deviceid; xcb_input_device_id_t attachment; uint8_t type; uint8_t enabled; uint8_t pad0[2]; uint32_t flags; } xcb_input_hierarchy_info_t; /** * @brief xcb_input_hierarchy_info_iterator_t **/ typedef struct xcb_input_hierarchy_info_iterator_t { xcb_input_hierarchy_info_t *data; int rem; int index; } xcb_input_hierarchy_info_iterator_t; /** Opcode for xcb_input_hierarchy. */ #define XCB_INPUT_HIERARCHY 11 /** * @brief xcb_input_hierarchy_event_t **/ typedef struct xcb_input_hierarchy_event_t { uint8_t response_type; uint8_t extension; uint16_t sequence; uint32_t length; uint16_t event_type; xcb_input_device_id_t deviceid; xcb_timestamp_t time; uint32_t flags; uint16_t num_infos; uint8_t pad0[10]; uint32_t full_sequence; } xcb_input_hierarchy_event_t; typedef enum xcb_input_property_flag_t { XCB_INPUT_PROPERTY_FLAG_DELETED = 0, XCB_INPUT_PROPERTY_FLAG_CREATED = 1, XCB_INPUT_PROPERTY_FLAG_MODIFIED = 2 } xcb_input_property_flag_t; /** Opcode for xcb_input_property. */ #define XCB_INPUT_PROPERTY 12 /** * @brief xcb_input_property_event_t **/ typedef struct xcb_input_property_event_t { uint8_t response_type; uint8_t extension; uint16_t sequence; uint32_t length; uint16_t event_type; xcb_input_device_id_t deviceid; xcb_timestamp_t time; xcb_atom_t property; uint8_t what; uint8_t pad0[11]; uint32_t full_sequence; } xcb_input_property_event_t; /** Opcode for xcb_input_raw_key_press. */ #define XCB_INPUT_RAW_KEY_PRESS 13 /** * @brief xcb_input_raw_key_press_event_t **/ typedef struct xcb_input_raw_key_press_event_t { uint8_t response_type; uint8_t extension; uint16_t sequence; uint32_t length; uint16_t event_type; xcb_input_device_id_t deviceid; xcb_timestamp_t time; uint32_t detail; xcb_input_device_id_t sourceid; uint16_t valuators_len; uint32_t flags; uint8_t pad0[4]; uint32_t full_sequence; } xcb_input_raw_key_press_event_t; /** Opcode for xcb_input_raw_key_release. */ #define XCB_INPUT_RAW_KEY_RELEASE 14 typedef xcb_input_raw_key_press_event_t xcb_input_raw_key_release_event_t; /** Opcode for xcb_input_raw_button_press. */ #define XCB_INPUT_RAW_BUTTON_PRESS 15 /** * @brief xcb_input_raw_button_press_event_t **/ typedef struct xcb_input_raw_button_press_event_t { uint8_t response_type; uint8_t extension; uint16_t sequence; uint32_t length; uint16_t event_type; xcb_input_device_id_t deviceid; xcb_timestamp_t time; uint32_t detail; xcb_input_device_id_t sourceid; uint16_t valuators_len; uint32_t flags; uint8_t pad0[4]; uint32_t full_sequence; } xcb_input_raw_button_press_event_t; /** Opcode for xcb_input_raw_button_release. */ #define XCB_INPUT_RAW_BUTTON_RELEASE 16 typedef xcb_input_raw_button_press_event_t xcb_input_raw_button_release_event_t; /** Opcode for xcb_input_raw_motion. */ #define XCB_INPUT_RAW_MOTION 17 typedef xcb_input_raw_button_press_event_t xcb_input_raw_motion_event_t; typedef enum xcb_input_touch_event_flags_t { XCB_INPUT_TOUCH_EVENT_FLAGS_TOUCH_PENDING_END = 65536, XCB_INPUT_TOUCH_EVENT_FLAGS_TOUCH_EMULATING_POINTER = 131072 } xcb_input_touch_event_flags_t; /** Opcode for xcb_input_touch_begin. */ #define XCB_INPUT_TOUCH_BEGIN 18 /** * @brief xcb_input_touch_begin_event_t **/ typedef struct xcb_input_touch_begin_event_t { uint8_t response_type; uint8_t extension; uint16_t sequence; uint32_t length; uint16_t event_type; xcb_input_device_id_t deviceid; xcb_timestamp_t time; uint32_t detail; xcb_window_t root; xcb_window_t event; xcb_window_t child; uint32_t full_sequence; xcb_input_fp1616_t root_x; xcb_input_fp1616_t root_y; xcb_input_fp1616_t event_x; xcb_input_fp1616_t event_y; uint16_t buttons_len; uint16_t valuators_len; xcb_input_device_id_t sourceid; uint8_t pad0[2]; uint32_t flags; xcb_input_modifier_info_t mods; xcb_input_group_info_t group; } xcb_input_touch_begin_event_t; /** Opcode for xcb_input_touch_update. */ #define XCB_INPUT_TOUCH_UPDATE 19 typedef xcb_input_touch_begin_event_t xcb_input_touch_update_event_t; /** Opcode for xcb_input_touch_end. */ #define XCB_INPUT_TOUCH_END 20 typedef xcb_input_touch_begin_event_t xcb_input_touch_end_event_t; typedef enum xcb_input_touch_ownership_flags_t { XCB_INPUT_TOUCH_OWNERSHIP_FLAGS_NONE = 0 } xcb_input_touch_ownership_flags_t; /** Opcode for xcb_input_touch_ownership. */ #define XCB_INPUT_TOUCH_OWNERSHIP 21 /** * @brief xcb_input_touch_ownership_event_t **/ typedef struct xcb_input_touch_ownership_event_t { uint8_t response_type; uint8_t extension; uint16_t sequence; uint32_t length; uint16_t event_type; xcb_input_device_id_t deviceid; xcb_timestamp_t time; uint32_t touchid; xcb_window_t root; xcb_window_t event; xcb_window_t child; uint32_t full_sequence; xcb_input_device_id_t sourceid; uint8_t pad0[2]; uint32_t flags; uint8_t pad1[8]; } xcb_input_touch_ownership_event_t; /** Opcode for xcb_input_raw_touch_begin. */ #define XCB_INPUT_RAW_TOUCH_BEGIN 22 /** * @brief xcb_input_raw_touch_begin_event_t **/ typedef struct xcb_input_raw_touch_begin_event_t { uint8_t response_type; uint8_t extension; uint16_t sequence; uint32_t length; uint16_t event_type; xcb_input_device_id_t deviceid; xcb_timestamp_t time; uint32_t detail; xcb_input_device_id_t sourceid; uint16_t valuators_len; uint32_t flags; uint8_t pad0[4]; uint32_t full_sequence; } xcb_input_raw_touch_begin_event_t; /** Opcode for xcb_input_raw_touch_update. */ #define XCB_INPUT_RAW_TOUCH_UPDATE 23 typedef xcb_input_raw_touch_begin_event_t xcb_input_raw_touch_update_event_t; /** Opcode for xcb_input_raw_touch_end. */ #define XCB_INPUT_RAW_TOUCH_END 24 typedef xcb_input_raw_touch_begin_event_t xcb_input_raw_touch_end_event_t; typedef enum xcb_input_barrier_flags_t { XCB_INPUT_BARRIER_FLAGS_POINTER_RELEASED = 1, XCB_INPUT_BARRIER_FLAGS_DEVICE_IS_GRABBED = 2 } xcb_input_barrier_flags_t; /** Opcode for xcb_input_barrier_hit. */ #define XCB_INPUT_BARRIER_HIT 25 /** * @brief xcb_input_barrier_hit_event_t **/ typedef struct xcb_input_barrier_hit_event_t { uint8_t response_type; uint8_t extension; uint16_t sequence; uint32_t length; uint16_t event_type; xcb_input_device_id_t deviceid; xcb_timestamp_t time; uint32_t eventid; xcb_window_t root; xcb_window_t event; xcb_xfixes_barrier_t barrier; uint32_t full_sequence; uint32_t dtime; uint32_t flags; xcb_input_device_id_t sourceid; uint8_t pad0[2]; xcb_input_fp1616_t root_x; xcb_input_fp1616_t root_y; xcb_input_fp3232_t dx; xcb_input_fp3232_t dy; } xcb_input_barrier_hit_event_t; /** Opcode for xcb_input_barrier_leave. */ #define XCB_INPUT_BARRIER_LEAVE 26 typedef xcb_input_barrier_hit_event_t xcb_input_barrier_leave_event_t; /** * @brief xcb_input_event_for_send_t **/ typedef union xcb_input_event_for_send_t { xcb_input_device_valuator_event_t device_valuator; xcb_input_device_key_press_event_t device_key_press; xcb_input_device_key_release_event_t device_key_release; xcb_input_device_button_press_event_t device_button_press; xcb_input_device_button_release_event_t device_button_release; xcb_input_device_motion_notify_event_t device_motion_notify; xcb_input_device_focus_in_event_t device_focus_in; xcb_input_device_focus_out_event_t device_focus_out; xcb_input_proximity_in_event_t proximity_in; xcb_input_proximity_out_event_t proximity_out; xcb_input_device_state_notify_event_t device_state_notify; xcb_input_device_mapping_notify_event_t device_mapping_notify; xcb_input_change_device_notify_event_t change_device_notify; xcb_input_device_key_state_notify_event_t device_key_state_notify; xcb_input_device_button_state_notify_event_t device_button_state_notify; xcb_input_device_presence_notify_event_t device_presence_notify; xcb_raw_generic_event_t event_header; } xcb_input_event_for_send_t; /** * @brief xcb_input_event_for_send_iterator_t **/ typedef struct xcb_input_event_for_send_iterator_t { xcb_input_event_for_send_t *data; int rem; int index; } xcb_input_event_for_send_iterator_t; /** Opcode for xcb_input_send_extension_event. */ #define XCB_INPUT_SEND_EXTENSION_EVENT 31 /** * @brief xcb_input_send_extension_event_request_t **/ typedef struct xcb_input_send_extension_event_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t destination; uint8_t device_id; uint8_t propagate; uint16_t num_classes; uint8_t num_events; uint8_t pad0[3]; } xcb_input_send_extension_event_request_t; /** Opcode for xcb_input_device. */ #define XCB_INPUT_DEVICE 0 /** * @brief xcb_input_device_error_t **/ typedef struct xcb_input_device_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_input_device_error_t; /** Opcode for xcb_input_event. */ #define XCB_INPUT_EVENT 1 /** * @brief xcb_input_event_error_t **/ typedef struct xcb_input_event_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_input_event_error_t; /** Opcode for xcb_input_mode. */ #define XCB_INPUT_MODE 2 /** * @brief xcb_input_mode_error_t **/ typedef struct xcb_input_mode_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_input_mode_error_t; /** Opcode for xcb_input_device_busy. */ #define XCB_INPUT_DEVICE_BUSY 3 /** * @brief xcb_input_device_busy_error_t **/ typedef struct xcb_input_device_busy_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_input_device_busy_error_t; /** Opcode for xcb_input_class. */ #define XCB_INPUT_CLASS 4 /** * @brief xcb_input_class_error_t **/ typedef struct xcb_input_class_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_input_class_error_t; /** * Get the next element of the iterator * @param i Pointer to a xcb_input_event_class_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_event_class_t) */ void xcb_input_event_class_next (xcb_input_event_class_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_event_class_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_event_class_end (xcb_input_event_class_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_key_code_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_key_code_t) */ void xcb_input_key_code_next (xcb_input_key_code_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_key_code_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_key_code_end (xcb_input_key_code_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_device_id_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_device_id_t) */ void xcb_input_device_id_next (xcb_input_device_id_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_device_id_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_device_id_end (xcb_input_device_id_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_fp1616_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_fp1616_t) */ void xcb_input_fp1616_next (xcb_input_fp1616_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_fp1616_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_fp1616_end (xcb_input_fp1616_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_fp3232_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_fp3232_t) */ void xcb_input_fp3232_next (xcb_input_fp3232_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_fp3232_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_fp3232_end (xcb_input_fp3232_iterator_t i); int xcb_input_get_extension_version_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_get_extension_version_cookie_t xcb_input_get_extension_version (xcb_connection_t *c, uint16_t name_len, const char *name); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_get_extension_version_cookie_t xcb_input_get_extension_version_unchecked (xcb_connection_t *c, uint16_t name_len, const char *name); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_get_extension_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_get_extension_version_reply_t * xcb_input_get_extension_version_reply (xcb_connection_t *c, xcb_input_get_extension_version_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_device_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_device_info_t) */ void xcb_input_device_info_next (xcb_input_device_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_device_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_device_info_end (xcb_input_device_info_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_key_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_key_info_t) */ void xcb_input_key_info_next (xcb_input_key_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_key_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_key_info_end (xcb_input_key_info_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_button_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_button_info_t) */ void xcb_input_button_info_next (xcb_input_button_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_button_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_button_info_end (xcb_input_button_info_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_axis_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_axis_info_t) */ void xcb_input_axis_info_next (xcb_input_axis_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_axis_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_axis_info_end (xcb_input_axis_info_iterator_t i); int xcb_input_valuator_info_sizeof (const void *_buffer); xcb_input_axis_info_t * xcb_input_valuator_info_axes (const xcb_input_valuator_info_t *R); int xcb_input_valuator_info_axes_length (const xcb_input_valuator_info_t *R); xcb_input_axis_info_iterator_t xcb_input_valuator_info_axes_iterator (const xcb_input_valuator_info_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_valuator_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_valuator_info_t) */ void xcb_input_valuator_info_next (xcb_input_valuator_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_valuator_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_valuator_info_end (xcb_input_valuator_info_iterator_t i); xcb_input_axis_info_t * xcb_input_input_info_info_valuator_axes (const xcb_input_input_info_info_t *S); int xcb_input_input_info_info_valuator_axes_length (const xcb_input_input_info_t *R, const xcb_input_input_info_info_t *S); xcb_input_axis_info_iterator_t xcb_input_input_info_info_valuator_axes_iterator (const xcb_input_input_info_t *R, const xcb_input_input_info_info_t *S); int xcb_input_input_info_info_serialize (void **_buffer, uint8_t class_id, const xcb_input_input_info_info_t *_aux); int xcb_input_input_info_info_unpack (const void *_buffer, uint8_t class_id, xcb_input_input_info_info_t *_aux); int xcb_input_input_info_info_sizeof (const void *_buffer, uint8_t class_id); int xcb_input_input_info_sizeof (const void *_buffer); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_input_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_input_info_t) */ void xcb_input_input_info_next (xcb_input_input_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_input_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_input_info_end (xcb_input_input_info_iterator_t i); int xcb_input_device_name_sizeof (const void *_buffer); char * xcb_input_device_name_string (const xcb_input_device_name_t *R); int xcb_input_device_name_string_length (const xcb_input_device_name_t *R); xcb_generic_iterator_t xcb_input_device_name_string_end (const xcb_input_device_name_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_device_name_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_device_name_t) */ void xcb_input_device_name_next (xcb_input_device_name_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_device_name_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_device_name_end (xcb_input_device_name_iterator_t i); int xcb_input_list_input_devices_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_list_input_devices_cookie_t xcb_input_list_input_devices (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_list_input_devices_cookie_t xcb_input_list_input_devices_unchecked (xcb_connection_t *c); xcb_input_device_info_t * xcb_input_list_input_devices_devices (const xcb_input_list_input_devices_reply_t *R); int xcb_input_list_input_devices_devices_length (const xcb_input_list_input_devices_reply_t *R); xcb_input_device_info_iterator_t xcb_input_list_input_devices_devices_iterator (const xcb_input_list_input_devices_reply_t *R); int xcb_input_list_input_devices_infos_length (const xcb_input_list_input_devices_reply_t *R); xcb_input_input_info_iterator_t xcb_input_list_input_devices_infos_iterator (const xcb_input_list_input_devices_reply_t *R); int xcb_input_list_input_devices_names_length (const xcb_input_list_input_devices_reply_t *R); xcb_str_iterator_t xcb_input_list_input_devices_names_iterator (const xcb_input_list_input_devices_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_list_input_devices_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_list_input_devices_reply_t * xcb_input_list_input_devices_reply (xcb_connection_t *c, xcb_input_list_input_devices_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_event_type_base_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_event_type_base_t) */ void xcb_input_event_type_base_next (xcb_input_event_type_base_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_event_type_base_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_event_type_base_end (xcb_input_event_type_base_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_input_class_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_input_class_info_t) */ void xcb_input_input_class_info_next (xcb_input_input_class_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_input_class_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_input_class_info_end (xcb_input_input_class_info_iterator_t i); int xcb_input_open_device_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_open_device_cookie_t xcb_input_open_device (xcb_connection_t *c, uint8_t device_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_open_device_cookie_t xcb_input_open_device_unchecked (xcb_connection_t *c, uint8_t device_id); xcb_input_input_class_info_t * xcb_input_open_device_class_info (const xcb_input_open_device_reply_t *R); int xcb_input_open_device_class_info_length (const xcb_input_open_device_reply_t *R); xcb_input_input_class_info_iterator_t xcb_input_open_device_class_info_iterator (const xcb_input_open_device_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_open_device_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_open_device_reply_t * xcb_input_open_device_reply (xcb_connection_t *c, xcb_input_open_device_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_close_device_checked (xcb_connection_t *c, uint8_t device_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_close_device (xcb_connection_t *c, uint8_t device_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_set_device_mode_cookie_t xcb_input_set_device_mode (xcb_connection_t *c, uint8_t device_id, uint8_t mode); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_set_device_mode_cookie_t xcb_input_set_device_mode_unchecked (xcb_connection_t *c, uint8_t device_id, uint8_t mode); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_set_device_mode_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_set_device_mode_reply_t * xcb_input_set_device_mode_reply (xcb_connection_t *c, xcb_input_set_device_mode_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_input_select_extension_event_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_select_extension_event_checked (xcb_connection_t *c, xcb_window_t window, uint16_t num_classes, const xcb_input_event_class_t *classes); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_select_extension_event (xcb_connection_t *c, xcb_window_t window, uint16_t num_classes, const xcb_input_event_class_t *classes); xcb_input_event_class_t * xcb_input_select_extension_event_classes (const xcb_input_select_extension_event_request_t *R); int xcb_input_select_extension_event_classes_length (const xcb_input_select_extension_event_request_t *R); xcb_generic_iterator_t xcb_input_select_extension_event_classes_end (const xcb_input_select_extension_event_request_t *R); int xcb_input_get_selected_extension_events_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_get_selected_extension_events_cookie_t xcb_input_get_selected_extension_events (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_get_selected_extension_events_cookie_t xcb_input_get_selected_extension_events_unchecked (xcb_connection_t *c, xcb_window_t window); xcb_input_event_class_t * xcb_input_get_selected_extension_events_this_classes (const xcb_input_get_selected_extension_events_reply_t *R); int xcb_input_get_selected_extension_events_this_classes_length (const xcb_input_get_selected_extension_events_reply_t *R); xcb_generic_iterator_t xcb_input_get_selected_extension_events_this_classes_end (const xcb_input_get_selected_extension_events_reply_t *R); xcb_input_event_class_t * xcb_input_get_selected_extension_events_all_classes (const xcb_input_get_selected_extension_events_reply_t *R); int xcb_input_get_selected_extension_events_all_classes_length (const xcb_input_get_selected_extension_events_reply_t *R); xcb_generic_iterator_t xcb_input_get_selected_extension_events_all_classes_end (const xcb_input_get_selected_extension_events_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_get_selected_extension_events_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_get_selected_extension_events_reply_t * xcb_input_get_selected_extension_events_reply (xcb_connection_t *c, xcb_input_get_selected_extension_events_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_input_change_device_dont_propagate_list_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_change_device_dont_propagate_list_checked (xcb_connection_t *c, xcb_window_t window, uint16_t num_classes, uint8_t mode, const xcb_input_event_class_t *classes); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_change_device_dont_propagate_list (xcb_connection_t *c, xcb_window_t window, uint16_t num_classes, uint8_t mode, const xcb_input_event_class_t *classes); xcb_input_event_class_t * xcb_input_change_device_dont_propagate_list_classes (const xcb_input_change_device_dont_propagate_list_request_t *R); int xcb_input_change_device_dont_propagate_list_classes_length (const xcb_input_change_device_dont_propagate_list_request_t *R); xcb_generic_iterator_t xcb_input_change_device_dont_propagate_list_classes_end (const xcb_input_change_device_dont_propagate_list_request_t *R); int xcb_input_get_device_dont_propagate_list_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_get_device_dont_propagate_list_cookie_t xcb_input_get_device_dont_propagate_list (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_get_device_dont_propagate_list_cookie_t xcb_input_get_device_dont_propagate_list_unchecked (xcb_connection_t *c, xcb_window_t window); xcb_input_event_class_t * xcb_input_get_device_dont_propagate_list_classes (const xcb_input_get_device_dont_propagate_list_reply_t *R); int xcb_input_get_device_dont_propagate_list_classes_length (const xcb_input_get_device_dont_propagate_list_reply_t *R); xcb_generic_iterator_t xcb_input_get_device_dont_propagate_list_classes_end (const xcb_input_get_device_dont_propagate_list_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_get_device_dont_propagate_list_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_get_device_dont_propagate_list_reply_t * xcb_input_get_device_dont_propagate_list_reply (xcb_connection_t *c, xcb_input_get_device_dont_propagate_list_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_input_device_time_coord_sizeof (const void *_buffer, uint8_t num_axes); int32_t * xcb_input_device_time_coord_axisvalues (const xcb_input_device_time_coord_t *R); int xcb_input_device_time_coord_axisvalues_length (const xcb_input_device_time_coord_t *R, uint8_t num_axes); xcb_generic_iterator_t xcb_input_device_time_coord_axisvalues_end (const xcb_input_device_time_coord_t *R, uint8_t num_axes); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_device_time_coord_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_device_time_coord_t) */ void xcb_input_device_time_coord_next (xcb_input_device_time_coord_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_device_time_coord_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_device_time_coord_end (xcb_input_device_time_coord_iterator_t i); int xcb_input_get_device_motion_events_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_get_device_motion_events_cookie_t xcb_input_get_device_motion_events (xcb_connection_t *c, xcb_timestamp_t start, xcb_timestamp_t stop, uint8_t device_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_get_device_motion_events_cookie_t xcb_input_get_device_motion_events_unchecked (xcb_connection_t *c, xcb_timestamp_t start, xcb_timestamp_t stop, uint8_t device_id); int xcb_input_get_device_motion_events_events_length (const xcb_input_get_device_motion_events_reply_t *R); xcb_input_device_time_coord_iterator_t xcb_input_get_device_motion_events_events_iterator (const xcb_input_get_device_motion_events_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_get_device_motion_events_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_get_device_motion_events_reply_t * xcb_input_get_device_motion_events_reply (xcb_connection_t *c, xcb_input_get_device_motion_events_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_change_keyboard_device_cookie_t xcb_input_change_keyboard_device (xcb_connection_t *c, uint8_t device_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_change_keyboard_device_cookie_t xcb_input_change_keyboard_device_unchecked (xcb_connection_t *c, uint8_t device_id); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_change_keyboard_device_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_change_keyboard_device_reply_t * xcb_input_change_keyboard_device_reply (xcb_connection_t *c, xcb_input_change_keyboard_device_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_change_pointer_device_cookie_t xcb_input_change_pointer_device (xcb_connection_t *c, uint8_t x_axis, uint8_t y_axis, uint8_t device_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_change_pointer_device_cookie_t xcb_input_change_pointer_device_unchecked (xcb_connection_t *c, uint8_t x_axis, uint8_t y_axis, uint8_t device_id); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_change_pointer_device_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_change_pointer_device_reply_t * xcb_input_change_pointer_device_reply (xcb_connection_t *c, xcb_input_change_pointer_device_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_input_grab_device_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_grab_device_cookie_t xcb_input_grab_device (xcb_connection_t *c, xcb_window_t grab_window, xcb_timestamp_t time, uint16_t num_classes, uint8_t this_device_mode, uint8_t other_device_mode, uint8_t owner_events, uint8_t device_id, const xcb_input_event_class_t *classes); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_grab_device_cookie_t xcb_input_grab_device_unchecked (xcb_connection_t *c, xcb_window_t grab_window, xcb_timestamp_t time, uint16_t num_classes, uint8_t this_device_mode, uint8_t other_device_mode, uint8_t owner_events, uint8_t device_id, const xcb_input_event_class_t *classes); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_grab_device_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_grab_device_reply_t * xcb_input_grab_device_reply (xcb_connection_t *c, xcb_input_grab_device_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_ungrab_device_checked (xcb_connection_t *c, xcb_timestamp_t time, uint8_t device_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_ungrab_device (xcb_connection_t *c, xcb_timestamp_t time, uint8_t device_id); int xcb_input_grab_device_key_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_grab_device_key_checked (xcb_connection_t *c, xcb_window_t grab_window, uint16_t num_classes, uint16_t modifiers, uint8_t modifier_device, uint8_t grabbed_device, uint8_t key, uint8_t this_device_mode, uint8_t other_device_mode, uint8_t owner_events, const xcb_input_event_class_t *classes); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_grab_device_key (xcb_connection_t *c, xcb_window_t grab_window, uint16_t num_classes, uint16_t modifiers, uint8_t modifier_device, uint8_t grabbed_device, uint8_t key, uint8_t this_device_mode, uint8_t other_device_mode, uint8_t owner_events, const xcb_input_event_class_t *classes); xcb_input_event_class_t * xcb_input_grab_device_key_classes (const xcb_input_grab_device_key_request_t *R); int xcb_input_grab_device_key_classes_length (const xcb_input_grab_device_key_request_t *R); xcb_generic_iterator_t xcb_input_grab_device_key_classes_end (const xcb_input_grab_device_key_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_ungrab_device_key_checked (xcb_connection_t *c, xcb_window_t grabWindow, uint16_t modifiers, uint8_t modifier_device, uint8_t key, uint8_t grabbed_device); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_ungrab_device_key (xcb_connection_t *c, xcb_window_t grabWindow, uint16_t modifiers, uint8_t modifier_device, uint8_t key, uint8_t grabbed_device); int xcb_input_grab_device_button_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_grab_device_button_checked (xcb_connection_t *c, xcb_window_t grab_window, uint8_t grabbed_device, uint8_t modifier_device, uint16_t num_classes, uint16_t modifiers, uint8_t this_device_mode, uint8_t other_device_mode, uint8_t button, uint8_t owner_events, const xcb_input_event_class_t *classes); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_grab_device_button (xcb_connection_t *c, xcb_window_t grab_window, uint8_t grabbed_device, uint8_t modifier_device, uint16_t num_classes, uint16_t modifiers, uint8_t this_device_mode, uint8_t other_device_mode, uint8_t button, uint8_t owner_events, const xcb_input_event_class_t *classes); xcb_input_event_class_t * xcb_input_grab_device_button_classes (const xcb_input_grab_device_button_request_t *R); int xcb_input_grab_device_button_classes_length (const xcb_input_grab_device_button_request_t *R); xcb_generic_iterator_t xcb_input_grab_device_button_classes_end (const xcb_input_grab_device_button_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_ungrab_device_button_checked (xcb_connection_t *c, xcb_window_t grab_window, uint16_t modifiers, uint8_t modifier_device, uint8_t button, uint8_t grabbed_device); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_ungrab_device_button (xcb_connection_t *c, xcb_window_t grab_window, uint16_t modifiers, uint8_t modifier_device, uint8_t button, uint8_t grabbed_device); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_allow_device_events_checked (xcb_connection_t *c, xcb_timestamp_t time, uint8_t mode, uint8_t device_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_allow_device_events (xcb_connection_t *c, xcb_timestamp_t time, uint8_t mode, uint8_t device_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_get_device_focus_cookie_t xcb_input_get_device_focus (xcb_connection_t *c, uint8_t device_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_get_device_focus_cookie_t xcb_input_get_device_focus_unchecked (xcb_connection_t *c, uint8_t device_id); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_get_device_focus_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_get_device_focus_reply_t * xcb_input_get_device_focus_reply (xcb_connection_t *c, xcb_input_get_device_focus_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_set_device_focus_checked (xcb_connection_t *c, xcb_window_t focus, xcb_timestamp_t time, uint8_t revert_to, uint8_t device_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_set_device_focus (xcb_connection_t *c, xcb_window_t focus, xcb_timestamp_t time, uint8_t revert_to, uint8_t device_id); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_kbd_feedback_state_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_kbd_feedback_state_t) */ void xcb_input_kbd_feedback_state_next (xcb_input_kbd_feedback_state_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_kbd_feedback_state_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_kbd_feedback_state_end (xcb_input_kbd_feedback_state_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_ptr_feedback_state_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_ptr_feedback_state_t) */ void xcb_input_ptr_feedback_state_next (xcb_input_ptr_feedback_state_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_ptr_feedback_state_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_ptr_feedback_state_end (xcb_input_ptr_feedback_state_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_integer_feedback_state_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_integer_feedback_state_t) */ void xcb_input_integer_feedback_state_next (xcb_input_integer_feedback_state_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_integer_feedback_state_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_integer_feedback_state_end (xcb_input_integer_feedback_state_iterator_t i); int xcb_input_string_feedback_state_sizeof (const void *_buffer); xcb_keysym_t * xcb_input_string_feedback_state_keysyms (const xcb_input_string_feedback_state_t *R); int xcb_input_string_feedback_state_keysyms_length (const xcb_input_string_feedback_state_t *R); xcb_generic_iterator_t xcb_input_string_feedback_state_keysyms_end (const xcb_input_string_feedback_state_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_string_feedback_state_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_string_feedback_state_t) */ void xcb_input_string_feedback_state_next (xcb_input_string_feedback_state_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_string_feedback_state_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_string_feedback_state_end (xcb_input_string_feedback_state_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_bell_feedback_state_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_bell_feedback_state_t) */ void xcb_input_bell_feedback_state_next (xcb_input_bell_feedback_state_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_bell_feedback_state_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_bell_feedback_state_end (xcb_input_bell_feedback_state_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_led_feedback_state_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_led_feedback_state_t) */ void xcb_input_led_feedback_state_next (xcb_input_led_feedback_state_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_led_feedback_state_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_led_feedback_state_end (xcb_input_led_feedback_state_iterator_t i); xcb_keysym_t * xcb_input_feedback_state_data_string_keysyms (const xcb_input_feedback_state_data_t *S); int xcb_input_feedback_state_data_string_keysyms_length (const xcb_input_feedback_state_t *R, const xcb_input_feedback_state_data_t *S); xcb_generic_iterator_t xcb_input_feedback_state_data_string_keysyms_end (const xcb_input_feedback_state_t *R, const xcb_input_feedback_state_data_t *S); int xcb_input_feedback_state_data_serialize (void **_buffer, uint8_t class_id, const xcb_input_feedback_state_data_t *_aux); int xcb_input_feedback_state_data_unpack (const void *_buffer, uint8_t class_id, xcb_input_feedback_state_data_t *_aux); int xcb_input_feedback_state_data_sizeof (const void *_buffer, uint8_t class_id); int xcb_input_feedback_state_sizeof (const void *_buffer); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_feedback_state_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_feedback_state_t) */ void xcb_input_feedback_state_next (xcb_input_feedback_state_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_feedback_state_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_feedback_state_end (xcb_input_feedback_state_iterator_t i); int xcb_input_get_feedback_control_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_get_feedback_control_cookie_t xcb_input_get_feedback_control (xcb_connection_t *c, uint8_t device_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_get_feedback_control_cookie_t xcb_input_get_feedback_control_unchecked (xcb_connection_t *c, uint8_t device_id); int xcb_input_get_feedback_control_feedbacks_length (const xcb_input_get_feedback_control_reply_t *R); xcb_input_feedback_state_iterator_t xcb_input_get_feedback_control_feedbacks_iterator (const xcb_input_get_feedback_control_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_get_feedback_control_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_get_feedback_control_reply_t * xcb_input_get_feedback_control_reply (xcb_connection_t *c, xcb_input_get_feedback_control_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_kbd_feedback_ctl_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_kbd_feedback_ctl_t) */ void xcb_input_kbd_feedback_ctl_next (xcb_input_kbd_feedback_ctl_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_kbd_feedback_ctl_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_kbd_feedback_ctl_end (xcb_input_kbd_feedback_ctl_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_ptr_feedback_ctl_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_ptr_feedback_ctl_t) */ void xcb_input_ptr_feedback_ctl_next (xcb_input_ptr_feedback_ctl_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_ptr_feedback_ctl_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_ptr_feedback_ctl_end (xcb_input_ptr_feedback_ctl_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_integer_feedback_ctl_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_integer_feedback_ctl_t) */ void xcb_input_integer_feedback_ctl_next (xcb_input_integer_feedback_ctl_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_integer_feedback_ctl_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_integer_feedback_ctl_end (xcb_input_integer_feedback_ctl_iterator_t i); int xcb_input_string_feedback_ctl_sizeof (const void *_buffer); xcb_keysym_t * xcb_input_string_feedback_ctl_keysyms (const xcb_input_string_feedback_ctl_t *R); int xcb_input_string_feedback_ctl_keysyms_length (const xcb_input_string_feedback_ctl_t *R); xcb_generic_iterator_t xcb_input_string_feedback_ctl_keysyms_end (const xcb_input_string_feedback_ctl_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_string_feedback_ctl_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_string_feedback_ctl_t) */ void xcb_input_string_feedback_ctl_next (xcb_input_string_feedback_ctl_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_string_feedback_ctl_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_string_feedback_ctl_end (xcb_input_string_feedback_ctl_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_bell_feedback_ctl_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_bell_feedback_ctl_t) */ void xcb_input_bell_feedback_ctl_next (xcb_input_bell_feedback_ctl_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_bell_feedback_ctl_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_bell_feedback_ctl_end (xcb_input_bell_feedback_ctl_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_led_feedback_ctl_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_led_feedback_ctl_t) */ void xcb_input_led_feedback_ctl_next (xcb_input_led_feedback_ctl_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_led_feedback_ctl_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_led_feedback_ctl_end (xcb_input_led_feedback_ctl_iterator_t i); xcb_keysym_t * xcb_input_feedback_ctl_data_string_keysyms (const xcb_input_feedback_ctl_data_t *S); int xcb_input_feedback_ctl_data_string_keysyms_length (const xcb_input_feedback_ctl_t *R, const xcb_input_feedback_ctl_data_t *S); xcb_generic_iterator_t xcb_input_feedback_ctl_data_string_keysyms_end (const xcb_input_feedback_ctl_t *R, const xcb_input_feedback_ctl_data_t *S); int xcb_input_feedback_ctl_data_serialize (void **_buffer, uint8_t class_id, const xcb_input_feedback_ctl_data_t *_aux); int xcb_input_feedback_ctl_data_unpack (const void *_buffer, uint8_t class_id, xcb_input_feedback_ctl_data_t *_aux); int xcb_input_feedback_ctl_data_sizeof (const void *_buffer, uint8_t class_id); int xcb_input_feedback_ctl_sizeof (const void *_buffer); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_feedback_ctl_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_feedback_ctl_t) */ void xcb_input_feedback_ctl_next (xcb_input_feedback_ctl_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_feedback_ctl_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_feedback_ctl_end (xcb_input_feedback_ctl_iterator_t i); int xcb_input_change_feedback_control_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_change_feedback_control_checked (xcb_connection_t *c, uint32_t mask, uint8_t device_id, uint8_t feedback_id, xcb_input_feedback_ctl_t *feedback); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_change_feedback_control (xcb_connection_t *c, uint32_t mask, uint8_t device_id, uint8_t feedback_id, xcb_input_feedback_ctl_t *feedback); xcb_input_feedback_ctl_t * xcb_input_change_feedback_control_feedback (const xcb_input_change_feedback_control_request_t *R); int xcb_input_get_device_key_mapping_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_get_device_key_mapping_cookie_t xcb_input_get_device_key_mapping (xcb_connection_t *c, uint8_t device_id, xcb_input_key_code_t first_keycode, uint8_t count); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_get_device_key_mapping_cookie_t xcb_input_get_device_key_mapping_unchecked (xcb_connection_t *c, uint8_t device_id, xcb_input_key_code_t first_keycode, uint8_t count); xcb_keysym_t * xcb_input_get_device_key_mapping_keysyms (const xcb_input_get_device_key_mapping_reply_t *R); int xcb_input_get_device_key_mapping_keysyms_length (const xcb_input_get_device_key_mapping_reply_t *R); xcb_generic_iterator_t xcb_input_get_device_key_mapping_keysyms_end (const xcb_input_get_device_key_mapping_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_get_device_key_mapping_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_get_device_key_mapping_reply_t * xcb_input_get_device_key_mapping_reply (xcb_connection_t *c, xcb_input_get_device_key_mapping_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_input_change_device_key_mapping_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_change_device_key_mapping_checked (xcb_connection_t *c, uint8_t device_id, xcb_input_key_code_t first_keycode, uint8_t keysyms_per_keycode, uint8_t keycode_count, const xcb_keysym_t *keysyms); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_change_device_key_mapping (xcb_connection_t *c, uint8_t device_id, xcb_input_key_code_t first_keycode, uint8_t keysyms_per_keycode, uint8_t keycode_count, const xcb_keysym_t *keysyms); xcb_keysym_t * xcb_input_change_device_key_mapping_keysyms (const xcb_input_change_device_key_mapping_request_t *R); int xcb_input_change_device_key_mapping_keysyms_length (const xcb_input_change_device_key_mapping_request_t *R); xcb_generic_iterator_t xcb_input_change_device_key_mapping_keysyms_end (const xcb_input_change_device_key_mapping_request_t *R); int xcb_input_get_device_modifier_mapping_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_get_device_modifier_mapping_cookie_t xcb_input_get_device_modifier_mapping (xcb_connection_t *c, uint8_t device_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_get_device_modifier_mapping_cookie_t xcb_input_get_device_modifier_mapping_unchecked (xcb_connection_t *c, uint8_t device_id); uint8_t * xcb_input_get_device_modifier_mapping_keymaps (const xcb_input_get_device_modifier_mapping_reply_t *R); int xcb_input_get_device_modifier_mapping_keymaps_length (const xcb_input_get_device_modifier_mapping_reply_t *R); xcb_generic_iterator_t xcb_input_get_device_modifier_mapping_keymaps_end (const xcb_input_get_device_modifier_mapping_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_get_device_modifier_mapping_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_get_device_modifier_mapping_reply_t * xcb_input_get_device_modifier_mapping_reply (xcb_connection_t *c, xcb_input_get_device_modifier_mapping_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_input_set_device_modifier_mapping_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_set_device_modifier_mapping_cookie_t xcb_input_set_device_modifier_mapping (xcb_connection_t *c, uint8_t device_id, uint8_t keycodes_per_modifier, const uint8_t *keymaps); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_set_device_modifier_mapping_cookie_t xcb_input_set_device_modifier_mapping_unchecked (xcb_connection_t *c, uint8_t device_id, uint8_t keycodes_per_modifier, const uint8_t *keymaps); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_set_device_modifier_mapping_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_set_device_modifier_mapping_reply_t * xcb_input_set_device_modifier_mapping_reply (xcb_connection_t *c, xcb_input_set_device_modifier_mapping_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_input_get_device_button_mapping_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_get_device_button_mapping_cookie_t xcb_input_get_device_button_mapping (xcb_connection_t *c, uint8_t device_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_get_device_button_mapping_cookie_t xcb_input_get_device_button_mapping_unchecked (xcb_connection_t *c, uint8_t device_id); uint8_t * xcb_input_get_device_button_mapping_map (const xcb_input_get_device_button_mapping_reply_t *R); int xcb_input_get_device_button_mapping_map_length (const xcb_input_get_device_button_mapping_reply_t *R); xcb_generic_iterator_t xcb_input_get_device_button_mapping_map_end (const xcb_input_get_device_button_mapping_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_get_device_button_mapping_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_get_device_button_mapping_reply_t * xcb_input_get_device_button_mapping_reply (xcb_connection_t *c, xcb_input_get_device_button_mapping_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_input_set_device_button_mapping_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_set_device_button_mapping_cookie_t xcb_input_set_device_button_mapping (xcb_connection_t *c, uint8_t device_id, uint8_t map_size, const uint8_t *map); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_set_device_button_mapping_cookie_t xcb_input_set_device_button_mapping_unchecked (xcb_connection_t *c, uint8_t device_id, uint8_t map_size, const uint8_t *map); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_set_device_button_mapping_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_set_device_button_mapping_reply_t * xcb_input_set_device_button_mapping_reply (xcb_connection_t *c, xcb_input_set_device_button_mapping_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_key_state_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_key_state_t) */ void xcb_input_key_state_next (xcb_input_key_state_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_key_state_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_key_state_end (xcb_input_key_state_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_button_state_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_button_state_t) */ void xcb_input_button_state_next (xcb_input_button_state_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_button_state_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_button_state_end (xcb_input_button_state_iterator_t i); int xcb_input_valuator_state_sizeof (const void *_buffer); int32_t * xcb_input_valuator_state_valuators (const xcb_input_valuator_state_t *R); int xcb_input_valuator_state_valuators_length (const xcb_input_valuator_state_t *R); xcb_generic_iterator_t xcb_input_valuator_state_valuators_end (const xcb_input_valuator_state_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_valuator_state_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_valuator_state_t) */ void xcb_input_valuator_state_next (xcb_input_valuator_state_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_valuator_state_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_valuator_state_end (xcb_input_valuator_state_iterator_t i); int32_t * xcb_input_input_state_data_valuator_valuators (const xcb_input_input_state_data_t *S); int xcb_input_input_state_data_valuator_valuators_length (const xcb_input_input_state_t *R, const xcb_input_input_state_data_t *S); xcb_generic_iterator_t xcb_input_input_state_data_valuator_valuators_end (const xcb_input_input_state_t *R, const xcb_input_input_state_data_t *S); int xcb_input_input_state_data_serialize (void **_buffer, uint8_t class_id, const xcb_input_input_state_data_t *_aux); int xcb_input_input_state_data_unpack (const void *_buffer, uint8_t class_id, xcb_input_input_state_data_t *_aux); int xcb_input_input_state_data_sizeof (const void *_buffer, uint8_t class_id); int xcb_input_input_state_sizeof (const void *_buffer); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_input_state_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_input_state_t) */ void xcb_input_input_state_next (xcb_input_input_state_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_input_state_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_input_state_end (xcb_input_input_state_iterator_t i); int xcb_input_query_device_state_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_query_device_state_cookie_t xcb_input_query_device_state (xcb_connection_t *c, uint8_t device_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_query_device_state_cookie_t xcb_input_query_device_state_unchecked (xcb_connection_t *c, uint8_t device_id); int xcb_input_query_device_state_classes_length (const xcb_input_query_device_state_reply_t *R); xcb_input_input_state_iterator_t xcb_input_query_device_state_classes_iterator (const xcb_input_query_device_state_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_query_device_state_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_query_device_state_reply_t * xcb_input_query_device_state_reply (xcb_connection_t *c, xcb_input_query_device_state_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_device_bell_checked (xcb_connection_t *c, uint8_t device_id, uint8_t feedback_id, uint8_t feedback_class, int8_t percent); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_device_bell (xcb_connection_t *c, uint8_t device_id, uint8_t feedback_id, uint8_t feedback_class, int8_t percent); int xcb_input_set_device_valuators_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_set_device_valuators_cookie_t xcb_input_set_device_valuators (xcb_connection_t *c, uint8_t device_id, uint8_t first_valuator, uint8_t num_valuators, const int32_t *valuators); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_set_device_valuators_cookie_t xcb_input_set_device_valuators_unchecked (xcb_connection_t *c, uint8_t device_id, uint8_t first_valuator, uint8_t num_valuators, const int32_t *valuators); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_set_device_valuators_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_set_device_valuators_reply_t * xcb_input_set_device_valuators_reply (xcb_connection_t *c, xcb_input_set_device_valuators_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_input_device_resolution_state_sizeof (const void *_buffer); uint32_t * xcb_input_device_resolution_state_resolution_values (const xcb_input_device_resolution_state_t *R); int xcb_input_device_resolution_state_resolution_values_length (const xcb_input_device_resolution_state_t *R); xcb_generic_iterator_t xcb_input_device_resolution_state_resolution_values_end (const xcb_input_device_resolution_state_t *R); uint32_t * xcb_input_device_resolution_state_resolution_min (const xcb_input_device_resolution_state_t *R); int xcb_input_device_resolution_state_resolution_min_length (const xcb_input_device_resolution_state_t *R); xcb_generic_iterator_t xcb_input_device_resolution_state_resolution_min_end (const xcb_input_device_resolution_state_t *R); uint32_t * xcb_input_device_resolution_state_resolution_max (const xcb_input_device_resolution_state_t *R); int xcb_input_device_resolution_state_resolution_max_length (const xcb_input_device_resolution_state_t *R); xcb_generic_iterator_t xcb_input_device_resolution_state_resolution_max_end (const xcb_input_device_resolution_state_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_device_resolution_state_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_device_resolution_state_t) */ void xcb_input_device_resolution_state_next (xcb_input_device_resolution_state_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_device_resolution_state_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_device_resolution_state_end (xcb_input_device_resolution_state_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_device_abs_calib_state_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_device_abs_calib_state_t) */ void xcb_input_device_abs_calib_state_next (xcb_input_device_abs_calib_state_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_device_abs_calib_state_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_device_abs_calib_state_end (xcb_input_device_abs_calib_state_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_device_abs_area_state_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_device_abs_area_state_t) */ void xcb_input_device_abs_area_state_next (xcb_input_device_abs_area_state_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_device_abs_area_state_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_device_abs_area_state_end (xcb_input_device_abs_area_state_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_device_core_state_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_device_core_state_t) */ void xcb_input_device_core_state_next (xcb_input_device_core_state_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_device_core_state_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_device_core_state_end (xcb_input_device_core_state_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_device_enable_state_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_device_enable_state_t) */ void xcb_input_device_enable_state_next (xcb_input_device_enable_state_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_device_enable_state_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_device_enable_state_end (xcb_input_device_enable_state_iterator_t i); uint32_t * xcb_input_device_state_data_resolution_resolution_values (const xcb_input_device_state_data_t *S); int xcb_input_device_state_data_resolution_resolution_values_length (const xcb_input_device_state_t *R, const xcb_input_device_state_data_t *S); xcb_generic_iterator_t xcb_input_device_state_data_resolution_resolution_values_end (const xcb_input_device_state_t *R, const xcb_input_device_state_data_t *S); uint32_t * xcb_input_device_state_data_resolution_resolution_min (const xcb_input_device_state_data_t *S); int xcb_input_device_state_data_resolution_resolution_min_length (const xcb_input_device_state_t *R, const xcb_input_device_state_data_t *S); xcb_generic_iterator_t xcb_input_device_state_data_resolution_resolution_min_end (const xcb_input_device_state_t *R, const xcb_input_device_state_data_t *S); uint32_t * xcb_input_device_state_data_resolution_resolution_max (const xcb_input_device_state_data_t *S); int xcb_input_device_state_data_resolution_resolution_max_length (const xcb_input_device_state_t *R, const xcb_input_device_state_data_t *S); xcb_generic_iterator_t xcb_input_device_state_data_resolution_resolution_max_end (const xcb_input_device_state_t *R, const xcb_input_device_state_data_t *S); int xcb_input_device_state_data_serialize (void **_buffer, uint16_t control_id, const xcb_input_device_state_data_t *_aux); int xcb_input_device_state_data_unpack (const void *_buffer, uint16_t control_id, xcb_input_device_state_data_t *_aux); int xcb_input_device_state_data_sizeof (const void *_buffer, uint16_t control_id); int xcb_input_device_state_sizeof (const void *_buffer); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_device_state_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_device_state_t) */ void xcb_input_device_state_next (xcb_input_device_state_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_device_state_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_device_state_end (xcb_input_device_state_iterator_t i); int xcb_input_get_device_control_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_get_device_control_cookie_t xcb_input_get_device_control (xcb_connection_t *c, uint16_t control_id, uint8_t device_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_get_device_control_cookie_t xcb_input_get_device_control_unchecked (xcb_connection_t *c, uint16_t control_id, uint8_t device_id); xcb_input_device_state_t * xcb_input_get_device_control_control (const xcb_input_get_device_control_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_get_device_control_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_get_device_control_reply_t * xcb_input_get_device_control_reply (xcb_connection_t *c, xcb_input_get_device_control_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_input_device_resolution_ctl_sizeof (const void *_buffer); uint32_t * xcb_input_device_resolution_ctl_resolution_values (const xcb_input_device_resolution_ctl_t *R); int xcb_input_device_resolution_ctl_resolution_values_length (const xcb_input_device_resolution_ctl_t *R); xcb_generic_iterator_t xcb_input_device_resolution_ctl_resolution_values_end (const xcb_input_device_resolution_ctl_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_device_resolution_ctl_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_device_resolution_ctl_t) */ void xcb_input_device_resolution_ctl_next (xcb_input_device_resolution_ctl_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_device_resolution_ctl_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_device_resolution_ctl_end (xcb_input_device_resolution_ctl_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_device_abs_calib_ctl_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_device_abs_calib_ctl_t) */ void xcb_input_device_abs_calib_ctl_next (xcb_input_device_abs_calib_ctl_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_device_abs_calib_ctl_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_device_abs_calib_ctl_end (xcb_input_device_abs_calib_ctl_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_device_abs_area_ctrl_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_device_abs_area_ctrl_t) */ void xcb_input_device_abs_area_ctrl_next (xcb_input_device_abs_area_ctrl_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_device_abs_area_ctrl_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_device_abs_area_ctrl_end (xcb_input_device_abs_area_ctrl_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_device_core_ctrl_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_device_core_ctrl_t) */ void xcb_input_device_core_ctrl_next (xcb_input_device_core_ctrl_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_device_core_ctrl_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_device_core_ctrl_end (xcb_input_device_core_ctrl_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_device_enable_ctrl_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_device_enable_ctrl_t) */ void xcb_input_device_enable_ctrl_next (xcb_input_device_enable_ctrl_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_device_enable_ctrl_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_device_enable_ctrl_end (xcb_input_device_enable_ctrl_iterator_t i); uint32_t * xcb_input_device_ctl_data_resolution_resolution_values (const xcb_input_device_ctl_data_t *S); int xcb_input_device_ctl_data_resolution_resolution_values_length (const xcb_input_device_ctl_t *R, const xcb_input_device_ctl_data_t *S); xcb_generic_iterator_t xcb_input_device_ctl_data_resolution_resolution_values_end (const xcb_input_device_ctl_t *R, const xcb_input_device_ctl_data_t *S); int xcb_input_device_ctl_data_serialize (void **_buffer, uint16_t control_id, const xcb_input_device_ctl_data_t *_aux); int xcb_input_device_ctl_data_unpack (const void *_buffer, uint16_t control_id, xcb_input_device_ctl_data_t *_aux); int xcb_input_device_ctl_data_sizeof (const void *_buffer, uint16_t control_id); int xcb_input_device_ctl_sizeof (const void *_buffer); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_device_ctl_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_device_ctl_t) */ void xcb_input_device_ctl_next (xcb_input_device_ctl_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_device_ctl_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_device_ctl_end (xcb_input_device_ctl_iterator_t i); int xcb_input_change_device_control_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_change_device_control_cookie_t xcb_input_change_device_control (xcb_connection_t *c, uint16_t control_id, uint8_t device_id, xcb_input_device_ctl_t *control); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_change_device_control_cookie_t xcb_input_change_device_control_unchecked (xcb_connection_t *c, uint16_t control_id, uint8_t device_id, xcb_input_device_ctl_t *control); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_change_device_control_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_change_device_control_reply_t * xcb_input_change_device_control_reply (xcb_connection_t *c, xcb_input_change_device_control_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_input_list_device_properties_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_list_device_properties_cookie_t xcb_input_list_device_properties (xcb_connection_t *c, uint8_t device_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_list_device_properties_cookie_t xcb_input_list_device_properties_unchecked (xcb_connection_t *c, uint8_t device_id); xcb_atom_t * xcb_input_list_device_properties_atoms (const xcb_input_list_device_properties_reply_t *R); int xcb_input_list_device_properties_atoms_length (const xcb_input_list_device_properties_reply_t *R); xcb_generic_iterator_t xcb_input_list_device_properties_atoms_end (const xcb_input_list_device_properties_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_list_device_properties_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_list_device_properties_reply_t * xcb_input_list_device_properties_reply (xcb_connection_t *c, xcb_input_list_device_properties_cookie_t cookie /**< */, xcb_generic_error_t **e); uint8_t * xcb_input_change_device_property_items_data_8 (const xcb_input_change_device_property_items_t *S); int xcb_input_change_device_property_items_data_8_length (const xcb_input_change_device_property_request_t *R, const xcb_input_change_device_property_items_t *S); xcb_generic_iterator_t xcb_input_change_device_property_items_data_8_end (const xcb_input_change_device_property_request_t *R, const xcb_input_change_device_property_items_t *S); uint16_t * xcb_input_change_device_property_items_data_16 (const xcb_input_change_device_property_items_t *S); int xcb_input_change_device_property_items_data_16_length (const xcb_input_change_device_property_request_t *R, const xcb_input_change_device_property_items_t *S); xcb_generic_iterator_t xcb_input_change_device_property_items_data_16_end (const xcb_input_change_device_property_request_t *R, const xcb_input_change_device_property_items_t *S); uint32_t * xcb_input_change_device_property_items_data_32 (const xcb_input_change_device_property_items_t *S); int xcb_input_change_device_property_items_data_32_length (const xcb_input_change_device_property_request_t *R, const xcb_input_change_device_property_items_t *S); xcb_generic_iterator_t xcb_input_change_device_property_items_data_32_end (const xcb_input_change_device_property_request_t *R, const xcb_input_change_device_property_items_t *S); int xcb_input_change_device_property_items_serialize (void **_buffer, uint32_t num_items, uint8_t format, const xcb_input_change_device_property_items_t *_aux); int xcb_input_change_device_property_items_unpack (const void *_buffer, uint32_t num_items, uint8_t format, xcb_input_change_device_property_items_t *_aux); int xcb_input_change_device_property_items_sizeof (const void *_buffer, uint32_t num_items, uint8_t format); int xcb_input_change_device_property_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_change_device_property_checked (xcb_connection_t *c, xcb_atom_t property, xcb_atom_t type, uint8_t device_id, uint8_t format, uint8_t mode, uint32_t num_items, const void *items); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_change_device_property (xcb_connection_t *c, xcb_atom_t property, xcb_atom_t type, uint8_t device_id, uint8_t format, uint8_t mode, uint32_t num_items, const void *items); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_change_device_property_aux_checked (xcb_connection_t *c, xcb_atom_t property, xcb_atom_t type, uint8_t device_id, uint8_t format, uint8_t mode, uint32_t num_items, const xcb_input_change_device_property_items_t *items); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_change_device_property_aux (xcb_connection_t *c, xcb_atom_t property, xcb_atom_t type, uint8_t device_id, uint8_t format, uint8_t mode, uint32_t num_items, const xcb_input_change_device_property_items_t *items); void * xcb_input_change_device_property_items (const xcb_input_change_device_property_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_delete_device_property_checked (xcb_connection_t *c, xcb_atom_t property, uint8_t device_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_delete_device_property (xcb_connection_t *c, xcb_atom_t property, uint8_t device_id); uint8_t * xcb_input_get_device_property_items_data_8 (const xcb_input_get_device_property_items_t *S); int xcb_input_get_device_property_items_data_8_length (const xcb_input_get_device_property_reply_t *R, const xcb_input_get_device_property_items_t *S); xcb_generic_iterator_t xcb_input_get_device_property_items_data_8_end (const xcb_input_get_device_property_reply_t *R, const xcb_input_get_device_property_items_t *S); uint16_t * xcb_input_get_device_property_items_data_16 (const xcb_input_get_device_property_items_t *S); int xcb_input_get_device_property_items_data_16_length (const xcb_input_get_device_property_reply_t *R, const xcb_input_get_device_property_items_t *S); xcb_generic_iterator_t xcb_input_get_device_property_items_data_16_end (const xcb_input_get_device_property_reply_t *R, const xcb_input_get_device_property_items_t *S); uint32_t * xcb_input_get_device_property_items_data_32 (const xcb_input_get_device_property_items_t *S); int xcb_input_get_device_property_items_data_32_length (const xcb_input_get_device_property_reply_t *R, const xcb_input_get_device_property_items_t *S); xcb_generic_iterator_t xcb_input_get_device_property_items_data_32_end (const xcb_input_get_device_property_reply_t *R, const xcb_input_get_device_property_items_t *S); int xcb_input_get_device_property_items_serialize (void **_buffer, uint32_t num_items, uint8_t format, const xcb_input_get_device_property_items_t *_aux); int xcb_input_get_device_property_items_unpack (const void *_buffer, uint32_t num_items, uint8_t format, xcb_input_get_device_property_items_t *_aux); int xcb_input_get_device_property_items_sizeof (const void *_buffer, uint32_t num_items, uint8_t format); int xcb_input_get_device_property_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_get_device_property_cookie_t xcb_input_get_device_property (xcb_connection_t *c, xcb_atom_t property, xcb_atom_t type, uint32_t offset, uint32_t len, uint8_t device_id, uint8_t _delete); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_get_device_property_cookie_t xcb_input_get_device_property_unchecked (xcb_connection_t *c, xcb_atom_t property, xcb_atom_t type, uint32_t offset, uint32_t len, uint8_t device_id, uint8_t _delete); void * xcb_input_get_device_property_items (const xcb_input_get_device_property_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_get_device_property_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_get_device_property_reply_t * xcb_input_get_device_property_reply (xcb_connection_t *c, xcb_input_get_device_property_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_group_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_group_info_t) */ void xcb_input_group_info_next (xcb_input_group_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_group_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_group_info_end (xcb_input_group_info_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_modifier_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_modifier_info_t) */ void xcb_input_modifier_info_next (xcb_input_modifier_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_modifier_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_modifier_info_end (xcb_input_modifier_info_iterator_t i); int xcb_input_xi_query_pointer_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_xi_query_pointer_cookie_t xcb_input_xi_query_pointer (xcb_connection_t *c, xcb_window_t window, xcb_input_device_id_t deviceid); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_xi_query_pointer_cookie_t xcb_input_xi_query_pointer_unchecked (xcb_connection_t *c, xcb_window_t window, xcb_input_device_id_t deviceid); uint32_t * xcb_input_xi_query_pointer_buttons (const xcb_input_xi_query_pointer_reply_t *R); int xcb_input_xi_query_pointer_buttons_length (const xcb_input_xi_query_pointer_reply_t *R); xcb_generic_iterator_t xcb_input_xi_query_pointer_buttons_end (const xcb_input_xi_query_pointer_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_xi_query_pointer_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_xi_query_pointer_reply_t * xcb_input_xi_query_pointer_reply (xcb_connection_t *c, xcb_input_xi_query_pointer_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_xi_warp_pointer_checked (xcb_connection_t *c, xcb_window_t src_win, xcb_window_t dst_win, xcb_input_fp1616_t src_x, xcb_input_fp1616_t src_y, uint16_t src_width, uint16_t src_height, xcb_input_fp1616_t dst_x, xcb_input_fp1616_t dst_y, xcb_input_device_id_t deviceid); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_xi_warp_pointer (xcb_connection_t *c, xcb_window_t src_win, xcb_window_t dst_win, xcb_input_fp1616_t src_x, xcb_input_fp1616_t src_y, uint16_t src_width, uint16_t src_height, xcb_input_fp1616_t dst_x, xcb_input_fp1616_t dst_y, xcb_input_device_id_t deviceid); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_xi_change_cursor_checked (xcb_connection_t *c, xcb_window_t window, xcb_cursor_t cursor, xcb_input_device_id_t deviceid); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_xi_change_cursor (xcb_connection_t *c, xcb_window_t window, xcb_cursor_t cursor, xcb_input_device_id_t deviceid); int xcb_input_add_master_sizeof (const void *_buffer); char * xcb_input_add_master_name (const xcb_input_add_master_t *R); int xcb_input_add_master_name_length (const xcb_input_add_master_t *R); xcb_generic_iterator_t xcb_input_add_master_name_end (const xcb_input_add_master_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_add_master_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_add_master_t) */ void xcb_input_add_master_next (xcb_input_add_master_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_add_master_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_add_master_end (xcb_input_add_master_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_remove_master_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_remove_master_t) */ void xcb_input_remove_master_next (xcb_input_remove_master_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_remove_master_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_remove_master_end (xcb_input_remove_master_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_attach_slave_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_attach_slave_t) */ void xcb_input_attach_slave_next (xcb_input_attach_slave_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_attach_slave_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_attach_slave_end (xcb_input_attach_slave_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_detach_slave_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_detach_slave_t) */ void xcb_input_detach_slave_next (xcb_input_detach_slave_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_detach_slave_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_detach_slave_end (xcb_input_detach_slave_iterator_t i); char * xcb_input_hierarchy_change_data_add_master_name (const xcb_input_hierarchy_change_data_t *S); int xcb_input_hierarchy_change_data_add_master_name_length (const xcb_input_hierarchy_change_t *R, const xcb_input_hierarchy_change_data_t *S); xcb_generic_iterator_t xcb_input_hierarchy_change_data_add_master_name_end (const xcb_input_hierarchy_change_t *R, const xcb_input_hierarchy_change_data_t *S); int xcb_input_hierarchy_change_data_serialize (void **_buffer, uint16_t type, const xcb_input_hierarchy_change_data_t *_aux); int xcb_input_hierarchy_change_data_unpack (const void *_buffer, uint16_t type, xcb_input_hierarchy_change_data_t *_aux); int xcb_input_hierarchy_change_data_sizeof (const void *_buffer, uint16_t type); int xcb_input_hierarchy_change_sizeof (const void *_buffer); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_hierarchy_change_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_hierarchy_change_t) */ void xcb_input_hierarchy_change_next (xcb_input_hierarchy_change_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_hierarchy_change_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_hierarchy_change_end (xcb_input_hierarchy_change_iterator_t i); int xcb_input_xi_change_hierarchy_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_xi_change_hierarchy_checked (xcb_connection_t *c, uint8_t num_changes, const xcb_input_hierarchy_change_t *changes); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_xi_change_hierarchy (xcb_connection_t *c, uint8_t num_changes, const xcb_input_hierarchy_change_t *changes); int xcb_input_xi_change_hierarchy_changes_length (const xcb_input_xi_change_hierarchy_request_t *R); xcb_input_hierarchy_change_iterator_t xcb_input_xi_change_hierarchy_changes_iterator (const xcb_input_xi_change_hierarchy_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_xi_set_client_pointer_checked (xcb_connection_t *c, xcb_window_t window, xcb_input_device_id_t deviceid); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_xi_set_client_pointer (xcb_connection_t *c, xcb_window_t window, xcb_input_device_id_t deviceid); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_xi_get_client_pointer_cookie_t xcb_input_xi_get_client_pointer (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_xi_get_client_pointer_cookie_t xcb_input_xi_get_client_pointer_unchecked (xcb_connection_t *c, xcb_window_t window); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_xi_get_client_pointer_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_xi_get_client_pointer_reply_t * xcb_input_xi_get_client_pointer_reply (xcb_connection_t *c, xcb_input_xi_get_client_pointer_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_input_event_mask_sizeof (const void *_buffer); uint32_t * xcb_input_event_mask_mask (const xcb_input_event_mask_t *R); int xcb_input_event_mask_mask_length (const xcb_input_event_mask_t *R); xcb_generic_iterator_t xcb_input_event_mask_mask_end (const xcb_input_event_mask_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_event_mask_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_event_mask_t) */ void xcb_input_event_mask_next (xcb_input_event_mask_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_event_mask_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_event_mask_end (xcb_input_event_mask_iterator_t i); int xcb_input_xi_select_events_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_xi_select_events_checked (xcb_connection_t *c, xcb_window_t window, uint16_t num_mask, const xcb_input_event_mask_t *masks); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_xi_select_events (xcb_connection_t *c, xcb_window_t window, uint16_t num_mask, const xcb_input_event_mask_t *masks); int xcb_input_xi_select_events_masks_length (const xcb_input_xi_select_events_request_t *R); xcb_input_event_mask_iterator_t xcb_input_xi_select_events_masks_iterator (const xcb_input_xi_select_events_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_xi_query_version_cookie_t xcb_input_xi_query_version (xcb_connection_t *c, uint16_t major_version, uint16_t minor_version); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_xi_query_version_cookie_t xcb_input_xi_query_version_unchecked (xcb_connection_t *c, uint16_t major_version, uint16_t minor_version); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_xi_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_xi_query_version_reply_t * xcb_input_xi_query_version_reply (xcb_connection_t *c, xcb_input_xi_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_input_button_class_sizeof (const void *_buffer); uint32_t * xcb_input_button_class_state (const xcb_input_button_class_t *R); int xcb_input_button_class_state_length (const xcb_input_button_class_t *R); xcb_generic_iterator_t xcb_input_button_class_state_end (const xcb_input_button_class_t *R); xcb_atom_t * xcb_input_button_class_labels (const xcb_input_button_class_t *R); int xcb_input_button_class_labels_length (const xcb_input_button_class_t *R); xcb_generic_iterator_t xcb_input_button_class_labels_end (const xcb_input_button_class_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_button_class_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_button_class_t) */ void xcb_input_button_class_next (xcb_input_button_class_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_button_class_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_button_class_end (xcb_input_button_class_iterator_t i); int xcb_input_key_class_sizeof (const void *_buffer); uint32_t * xcb_input_key_class_keys (const xcb_input_key_class_t *R); int xcb_input_key_class_keys_length (const xcb_input_key_class_t *R); xcb_generic_iterator_t xcb_input_key_class_keys_end (const xcb_input_key_class_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_key_class_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_key_class_t) */ void xcb_input_key_class_next (xcb_input_key_class_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_key_class_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_key_class_end (xcb_input_key_class_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_scroll_class_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_scroll_class_t) */ void xcb_input_scroll_class_next (xcb_input_scroll_class_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_scroll_class_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_scroll_class_end (xcb_input_scroll_class_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_touch_class_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_touch_class_t) */ void xcb_input_touch_class_next (xcb_input_touch_class_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_touch_class_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_touch_class_end (xcb_input_touch_class_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_valuator_class_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_valuator_class_t) */ void xcb_input_valuator_class_next (xcb_input_valuator_class_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_valuator_class_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_valuator_class_end (xcb_input_valuator_class_iterator_t i); uint32_t * xcb_input_device_class_data_key_keys (const xcb_input_device_class_data_t *S); int xcb_input_device_class_data_key_keys_length (const xcb_input_device_class_t *R, const xcb_input_device_class_data_t *S); xcb_generic_iterator_t xcb_input_device_class_data_key_keys_end (const xcb_input_device_class_t *R, const xcb_input_device_class_data_t *S); uint32_t * xcb_input_device_class_data_button_state (const xcb_input_device_class_data_t *S); int xcb_input_device_class_data_button_state_length (const xcb_input_device_class_t *R, const xcb_input_device_class_data_t *S); xcb_generic_iterator_t xcb_input_device_class_data_button_state_end (const xcb_input_device_class_t *R, const xcb_input_device_class_data_t *S); xcb_atom_t * xcb_input_device_class_data_button_labels (const xcb_input_device_class_data_t *S); int xcb_input_device_class_data_button_labels_length (const xcb_input_device_class_t *R, const xcb_input_device_class_data_t *S); xcb_generic_iterator_t xcb_input_device_class_data_button_labels_end (const xcb_input_device_class_t *R, const xcb_input_device_class_data_t *S); int xcb_input_device_class_data_serialize (void **_buffer, uint16_t type, const xcb_input_device_class_data_t *_aux); int xcb_input_device_class_data_unpack (const void *_buffer, uint16_t type, xcb_input_device_class_data_t *_aux); int xcb_input_device_class_data_sizeof (const void *_buffer, uint16_t type); int xcb_input_device_class_sizeof (const void *_buffer); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_device_class_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_device_class_t) */ void xcb_input_device_class_next (xcb_input_device_class_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_device_class_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_device_class_end (xcb_input_device_class_iterator_t i); int xcb_input_xi_device_info_sizeof (const void *_buffer); char * xcb_input_xi_device_info_name (const xcb_input_xi_device_info_t *R); int xcb_input_xi_device_info_name_length (const xcb_input_xi_device_info_t *R); xcb_generic_iterator_t xcb_input_xi_device_info_name_end (const xcb_input_xi_device_info_t *R); int xcb_input_xi_device_info_classes_length (const xcb_input_xi_device_info_t *R); xcb_input_device_class_iterator_t xcb_input_xi_device_info_classes_iterator (const xcb_input_xi_device_info_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_xi_device_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_xi_device_info_t) */ void xcb_input_xi_device_info_next (xcb_input_xi_device_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_xi_device_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_xi_device_info_end (xcb_input_xi_device_info_iterator_t i); int xcb_input_xi_query_device_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_xi_query_device_cookie_t xcb_input_xi_query_device (xcb_connection_t *c, xcb_input_device_id_t deviceid); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_xi_query_device_cookie_t xcb_input_xi_query_device_unchecked (xcb_connection_t *c, xcb_input_device_id_t deviceid); int xcb_input_xi_query_device_infos_length (const xcb_input_xi_query_device_reply_t *R); xcb_input_xi_device_info_iterator_t xcb_input_xi_query_device_infos_iterator (const xcb_input_xi_query_device_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_xi_query_device_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_xi_query_device_reply_t * xcb_input_xi_query_device_reply (xcb_connection_t *c, xcb_input_xi_query_device_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_xi_set_focus_checked (xcb_connection_t *c, xcb_window_t window, xcb_timestamp_t time, xcb_input_device_id_t deviceid); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_xi_set_focus (xcb_connection_t *c, xcb_window_t window, xcb_timestamp_t time, xcb_input_device_id_t deviceid); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_xi_get_focus_cookie_t xcb_input_xi_get_focus (xcb_connection_t *c, xcb_input_device_id_t deviceid); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_xi_get_focus_cookie_t xcb_input_xi_get_focus_unchecked (xcb_connection_t *c, xcb_input_device_id_t deviceid); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_xi_get_focus_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_xi_get_focus_reply_t * xcb_input_xi_get_focus_reply (xcb_connection_t *c, xcb_input_xi_get_focus_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_input_xi_grab_device_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_xi_grab_device_cookie_t xcb_input_xi_grab_device (xcb_connection_t *c, xcb_window_t window, xcb_timestamp_t time, xcb_cursor_t cursor, xcb_input_device_id_t deviceid, uint8_t mode, uint8_t paired_device_mode, uint8_t owner_events, uint16_t mask_len, const uint32_t *mask); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_xi_grab_device_cookie_t xcb_input_xi_grab_device_unchecked (xcb_connection_t *c, xcb_window_t window, xcb_timestamp_t time, xcb_cursor_t cursor, xcb_input_device_id_t deviceid, uint8_t mode, uint8_t paired_device_mode, uint8_t owner_events, uint16_t mask_len, const uint32_t *mask); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_xi_grab_device_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_xi_grab_device_reply_t * xcb_input_xi_grab_device_reply (xcb_connection_t *c, xcb_input_xi_grab_device_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_xi_ungrab_device_checked (xcb_connection_t *c, xcb_timestamp_t time, xcb_input_device_id_t deviceid); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_xi_ungrab_device (xcb_connection_t *c, xcb_timestamp_t time, xcb_input_device_id_t deviceid); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_xi_allow_events_checked (xcb_connection_t *c, xcb_timestamp_t time, xcb_input_device_id_t deviceid, uint8_t event_mode, uint32_t touchid, xcb_window_t grab_window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_xi_allow_events (xcb_connection_t *c, xcb_timestamp_t time, xcb_input_device_id_t deviceid, uint8_t event_mode, uint32_t touchid, xcb_window_t grab_window); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_grab_modifier_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_grab_modifier_info_t) */ void xcb_input_grab_modifier_info_next (xcb_input_grab_modifier_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_grab_modifier_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_grab_modifier_info_end (xcb_input_grab_modifier_info_iterator_t i); int xcb_input_xi_passive_grab_device_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_xi_passive_grab_device_cookie_t xcb_input_xi_passive_grab_device (xcb_connection_t *c, xcb_timestamp_t time, xcb_window_t grab_window, xcb_cursor_t cursor, uint32_t detail, xcb_input_device_id_t deviceid, uint16_t num_modifiers, uint16_t mask_len, uint8_t grab_type, uint8_t grab_mode, uint8_t paired_device_mode, uint8_t owner_events, const uint32_t *mask, const uint32_t *modifiers); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_xi_passive_grab_device_cookie_t xcb_input_xi_passive_grab_device_unchecked (xcb_connection_t *c, xcb_timestamp_t time, xcb_window_t grab_window, xcb_cursor_t cursor, uint32_t detail, xcb_input_device_id_t deviceid, uint16_t num_modifiers, uint16_t mask_len, uint8_t grab_type, uint8_t grab_mode, uint8_t paired_device_mode, uint8_t owner_events, const uint32_t *mask, const uint32_t *modifiers); xcb_input_grab_modifier_info_t * xcb_input_xi_passive_grab_device_modifiers (const xcb_input_xi_passive_grab_device_reply_t *R); int xcb_input_xi_passive_grab_device_modifiers_length (const xcb_input_xi_passive_grab_device_reply_t *R); xcb_input_grab_modifier_info_iterator_t xcb_input_xi_passive_grab_device_modifiers_iterator (const xcb_input_xi_passive_grab_device_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_xi_passive_grab_device_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_xi_passive_grab_device_reply_t * xcb_input_xi_passive_grab_device_reply (xcb_connection_t *c, xcb_input_xi_passive_grab_device_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_input_xi_passive_ungrab_device_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_xi_passive_ungrab_device_checked (xcb_connection_t *c, xcb_window_t grab_window, uint32_t detail, xcb_input_device_id_t deviceid, uint16_t num_modifiers, uint8_t grab_type, const uint32_t *modifiers); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_xi_passive_ungrab_device (xcb_connection_t *c, xcb_window_t grab_window, uint32_t detail, xcb_input_device_id_t deviceid, uint16_t num_modifiers, uint8_t grab_type, const uint32_t *modifiers); uint32_t * xcb_input_xi_passive_ungrab_device_modifiers (const xcb_input_xi_passive_ungrab_device_request_t *R); int xcb_input_xi_passive_ungrab_device_modifiers_length (const xcb_input_xi_passive_ungrab_device_request_t *R); xcb_generic_iterator_t xcb_input_xi_passive_ungrab_device_modifiers_end (const xcb_input_xi_passive_ungrab_device_request_t *R); int xcb_input_xi_list_properties_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_xi_list_properties_cookie_t xcb_input_xi_list_properties (xcb_connection_t *c, xcb_input_device_id_t deviceid); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_xi_list_properties_cookie_t xcb_input_xi_list_properties_unchecked (xcb_connection_t *c, xcb_input_device_id_t deviceid); xcb_atom_t * xcb_input_xi_list_properties_properties (const xcb_input_xi_list_properties_reply_t *R); int xcb_input_xi_list_properties_properties_length (const xcb_input_xi_list_properties_reply_t *R); xcb_generic_iterator_t xcb_input_xi_list_properties_properties_end (const xcb_input_xi_list_properties_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_xi_list_properties_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_xi_list_properties_reply_t * xcb_input_xi_list_properties_reply (xcb_connection_t *c, xcb_input_xi_list_properties_cookie_t cookie /**< */, xcb_generic_error_t **e); uint8_t * xcb_input_xi_change_property_items_data_8 (const xcb_input_xi_change_property_items_t *S); int xcb_input_xi_change_property_items_data_8_length (const xcb_input_xi_change_property_request_t *R, const xcb_input_xi_change_property_items_t *S); xcb_generic_iterator_t xcb_input_xi_change_property_items_data_8_end (const xcb_input_xi_change_property_request_t *R, const xcb_input_xi_change_property_items_t *S); uint16_t * xcb_input_xi_change_property_items_data_16 (const xcb_input_xi_change_property_items_t *S); int xcb_input_xi_change_property_items_data_16_length (const xcb_input_xi_change_property_request_t *R, const xcb_input_xi_change_property_items_t *S); xcb_generic_iterator_t xcb_input_xi_change_property_items_data_16_end (const xcb_input_xi_change_property_request_t *R, const xcb_input_xi_change_property_items_t *S); uint32_t * xcb_input_xi_change_property_items_data_32 (const xcb_input_xi_change_property_items_t *S); int xcb_input_xi_change_property_items_data_32_length (const xcb_input_xi_change_property_request_t *R, const xcb_input_xi_change_property_items_t *S); xcb_generic_iterator_t xcb_input_xi_change_property_items_data_32_end (const xcb_input_xi_change_property_request_t *R, const xcb_input_xi_change_property_items_t *S); int xcb_input_xi_change_property_items_serialize (void **_buffer, uint32_t num_items, uint8_t format, const xcb_input_xi_change_property_items_t *_aux); int xcb_input_xi_change_property_items_unpack (const void *_buffer, uint32_t num_items, uint8_t format, xcb_input_xi_change_property_items_t *_aux); int xcb_input_xi_change_property_items_sizeof (const void *_buffer, uint32_t num_items, uint8_t format); int xcb_input_xi_change_property_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_xi_change_property_checked (xcb_connection_t *c, xcb_input_device_id_t deviceid, uint8_t mode, uint8_t format, xcb_atom_t property, xcb_atom_t type, uint32_t num_items, const void *items); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_xi_change_property (xcb_connection_t *c, xcb_input_device_id_t deviceid, uint8_t mode, uint8_t format, xcb_atom_t property, xcb_atom_t type, uint32_t num_items, const void *items); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_xi_change_property_aux_checked (xcb_connection_t *c, xcb_input_device_id_t deviceid, uint8_t mode, uint8_t format, xcb_atom_t property, xcb_atom_t type, uint32_t num_items, const xcb_input_xi_change_property_items_t *items); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_xi_change_property_aux (xcb_connection_t *c, xcb_input_device_id_t deviceid, uint8_t mode, uint8_t format, xcb_atom_t property, xcb_atom_t type, uint32_t num_items, const xcb_input_xi_change_property_items_t *items); void * xcb_input_xi_change_property_items (const xcb_input_xi_change_property_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_xi_delete_property_checked (xcb_connection_t *c, xcb_input_device_id_t deviceid, xcb_atom_t property); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_xi_delete_property (xcb_connection_t *c, xcb_input_device_id_t deviceid, xcb_atom_t property); uint8_t * xcb_input_xi_get_property_items_data_8 (const xcb_input_xi_get_property_items_t *S); int xcb_input_xi_get_property_items_data_8_length (const xcb_input_xi_get_property_reply_t *R, const xcb_input_xi_get_property_items_t *S); xcb_generic_iterator_t xcb_input_xi_get_property_items_data_8_end (const xcb_input_xi_get_property_reply_t *R, const xcb_input_xi_get_property_items_t *S); uint16_t * xcb_input_xi_get_property_items_data_16 (const xcb_input_xi_get_property_items_t *S); int xcb_input_xi_get_property_items_data_16_length (const xcb_input_xi_get_property_reply_t *R, const xcb_input_xi_get_property_items_t *S); xcb_generic_iterator_t xcb_input_xi_get_property_items_data_16_end (const xcb_input_xi_get_property_reply_t *R, const xcb_input_xi_get_property_items_t *S); uint32_t * xcb_input_xi_get_property_items_data_32 (const xcb_input_xi_get_property_items_t *S); int xcb_input_xi_get_property_items_data_32_length (const xcb_input_xi_get_property_reply_t *R, const xcb_input_xi_get_property_items_t *S); xcb_generic_iterator_t xcb_input_xi_get_property_items_data_32_end (const xcb_input_xi_get_property_reply_t *R, const xcb_input_xi_get_property_items_t *S); int xcb_input_xi_get_property_items_serialize (void **_buffer, uint32_t num_items, uint8_t format, const xcb_input_xi_get_property_items_t *_aux); int xcb_input_xi_get_property_items_unpack (const void *_buffer, uint32_t num_items, uint8_t format, xcb_input_xi_get_property_items_t *_aux); int xcb_input_xi_get_property_items_sizeof (const void *_buffer, uint32_t num_items, uint8_t format); int xcb_input_xi_get_property_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_xi_get_property_cookie_t xcb_input_xi_get_property (xcb_connection_t *c, xcb_input_device_id_t deviceid, uint8_t _delete, xcb_atom_t property, xcb_atom_t type, uint32_t offset, uint32_t len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_xi_get_property_cookie_t xcb_input_xi_get_property_unchecked (xcb_connection_t *c, xcb_input_device_id_t deviceid, uint8_t _delete, xcb_atom_t property, xcb_atom_t type, uint32_t offset, uint32_t len); void * xcb_input_xi_get_property_items (const xcb_input_xi_get_property_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_xi_get_property_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_xi_get_property_reply_t * xcb_input_xi_get_property_reply (xcb_connection_t *c, xcb_input_xi_get_property_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_input_xi_get_selected_events_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_input_xi_get_selected_events_cookie_t xcb_input_xi_get_selected_events (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_input_xi_get_selected_events_cookie_t xcb_input_xi_get_selected_events_unchecked (xcb_connection_t *c, xcb_window_t window); int xcb_input_xi_get_selected_events_masks_length (const xcb_input_xi_get_selected_events_reply_t *R); xcb_input_event_mask_iterator_t xcb_input_xi_get_selected_events_masks_iterator (const xcb_input_xi_get_selected_events_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_input_xi_get_selected_events_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_input_xi_get_selected_events_reply_t * xcb_input_xi_get_selected_events_reply (xcb_connection_t *c, xcb_input_xi_get_selected_events_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_barrier_release_pointer_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_barrier_release_pointer_info_t) */ void xcb_input_barrier_release_pointer_info_next (xcb_input_barrier_release_pointer_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_barrier_release_pointer_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_barrier_release_pointer_info_end (xcb_input_barrier_release_pointer_info_iterator_t i); int xcb_input_xi_barrier_release_pointer_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_xi_barrier_release_pointer_checked (xcb_connection_t *c, uint32_t num_barriers, const xcb_input_barrier_release_pointer_info_t *barriers); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_xi_barrier_release_pointer (xcb_connection_t *c, uint32_t num_barriers, const xcb_input_barrier_release_pointer_info_t *barriers); xcb_input_barrier_release_pointer_info_t * xcb_input_xi_barrier_release_pointer_barriers (const xcb_input_xi_barrier_release_pointer_request_t *R); int xcb_input_xi_barrier_release_pointer_barriers_length (const xcb_input_xi_barrier_release_pointer_request_t *R); xcb_input_barrier_release_pointer_info_iterator_t xcb_input_xi_barrier_release_pointer_barriers_iterator (const xcb_input_xi_barrier_release_pointer_request_t *R); int xcb_input_device_changed_sizeof (const void *_buffer); int xcb_input_device_changed_classes_length (const xcb_input_device_changed_event_t *R); xcb_input_device_class_iterator_t xcb_input_device_changed_classes_iterator (const xcb_input_device_changed_event_t *R); int xcb_input_key_press_sizeof (const void *_buffer); uint32_t * xcb_input_key_press_button_mask (const xcb_input_key_press_event_t *R); int xcb_input_key_press_button_mask_length (const xcb_input_key_press_event_t *R); xcb_generic_iterator_t xcb_input_key_press_button_mask_end (const xcb_input_key_press_event_t *R); uint32_t * xcb_input_key_press_valuator_mask (const xcb_input_key_press_event_t *R); int xcb_input_key_press_valuator_mask_length (const xcb_input_key_press_event_t *R); xcb_generic_iterator_t xcb_input_key_press_valuator_mask_end (const xcb_input_key_press_event_t *R); xcb_input_fp3232_t * xcb_input_key_press_axisvalues (const xcb_input_key_press_event_t *R); int xcb_input_key_press_axisvalues_length (const xcb_input_key_press_event_t *R); xcb_input_fp3232_iterator_t xcb_input_key_press_axisvalues_iterator (const xcb_input_key_press_event_t *R); int xcb_input_key_release_sizeof (const void *_buffer /**< */); int xcb_input_button_press_sizeof (const void *_buffer); uint32_t * xcb_input_button_press_button_mask (const xcb_input_button_press_event_t *R); int xcb_input_button_press_button_mask_length (const xcb_input_button_press_event_t *R); xcb_generic_iterator_t xcb_input_button_press_button_mask_end (const xcb_input_button_press_event_t *R); uint32_t * xcb_input_button_press_valuator_mask (const xcb_input_button_press_event_t *R); int xcb_input_button_press_valuator_mask_length (const xcb_input_button_press_event_t *R); xcb_generic_iterator_t xcb_input_button_press_valuator_mask_end (const xcb_input_button_press_event_t *R); xcb_input_fp3232_t * xcb_input_button_press_axisvalues (const xcb_input_button_press_event_t *R); int xcb_input_button_press_axisvalues_length (const xcb_input_button_press_event_t *R); xcb_input_fp3232_iterator_t xcb_input_button_press_axisvalues_iterator (const xcb_input_button_press_event_t *R); int xcb_input_button_release_sizeof (const void *_buffer /**< */); int xcb_input_motion_sizeof (const void *_buffer /**< */); int xcb_input_enter_sizeof (const void *_buffer); uint32_t * xcb_input_enter_buttons (const xcb_input_enter_event_t *R); int xcb_input_enter_buttons_length (const xcb_input_enter_event_t *R); xcb_generic_iterator_t xcb_input_enter_buttons_end (const xcb_input_enter_event_t *R); int xcb_input_leave_sizeof (const void *_buffer /**< */); int xcb_input_focus_in_sizeof (const void *_buffer /**< */); int xcb_input_focus_out_sizeof (const void *_buffer /**< */); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_hierarchy_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_hierarchy_info_t) */ void xcb_input_hierarchy_info_next (xcb_input_hierarchy_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_hierarchy_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_hierarchy_info_end (xcb_input_hierarchy_info_iterator_t i); int xcb_input_hierarchy_sizeof (const void *_buffer); xcb_input_hierarchy_info_t * xcb_input_hierarchy_infos (const xcb_input_hierarchy_event_t *R); int xcb_input_hierarchy_infos_length (const xcb_input_hierarchy_event_t *R); xcb_input_hierarchy_info_iterator_t xcb_input_hierarchy_infos_iterator (const xcb_input_hierarchy_event_t *R); int xcb_input_raw_key_press_sizeof (const void *_buffer); uint32_t * xcb_input_raw_key_press_valuator_mask (const xcb_input_raw_key_press_event_t *R); int xcb_input_raw_key_press_valuator_mask_length (const xcb_input_raw_key_press_event_t *R); xcb_generic_iterator_t xcb_input_raw_key_press_valuator_mask_end (const xcb_input_raw_key_press_event_t *R); xcb_input_fp3232_t * xcb_input_raw_key_press_axisvalues (const xcb_input_raw_key_press_event_t *R); int xcb_input_raw_key_press_axisvalues_length (const xcb_input_raw_key_press_event_t *R); xcb_input_fp3232_iterator_t xcb_input_raw_key_press_axisvalues_iterator (const xcb_input_raw_key_press_event_t *R); xcb_input_fp3232_t * xcb_input_raw_key_press_axisvalues_raw (const xcb_input_raw_key_press_event_t *R); int xcb_input_raw_key_press_axisvalues_raw_length (const xcb_input_raw_key_press_event_t *R); xcb_input_fp3232_iterator_t xcb_input_raw_key_press_axisvalues_raw_iterator (const xcb_input_raw_key_press_event_t *R); int xcb_input_raw_key_release_sizeof (const void *_buffer /**< */); int xcb_input_raw_button_press_sizeof (const void *_buffer); uint32_t * xcb_input_raw_button_press_valuator_mask (const xcb_input_raw_button_press_event_t *R); int xcb_input_raw_button_press_valuator_mask_length (const xcb_input_raw_button_press_event_t *R); xcb_generic_iterator_t xcb_input_raw_button_press_valuator_mask_end (const xcb_input_raw_button_press_event_t *R); xcb_input_fp3232_t * xcb_input_raw_button_press_axisvalues (const xcb_input_raw_button_press_event_t *R); int xcb_input_raw_button_press_axisvalues_length (const xcb_input_raw_button_press_event_t *R); xcb_input_fp3232_iterator_t xcb_input_raw_button_press_axisvalues_iterator (const xcb_input_raw_button_press_event_t *R); xcb_input_fp3232_t * xcb_input_raw_button_press_axisvalues_raw (const xcb_input_raw_button_press_event_t *R); int xcb_input_raw_button_press_axisvalues_raw_length (const xcb_input_raw_button_press_event_t *R); xcb_input_fp3232_iterator_t xcb_input_raw_button_press_axisvalues_raw_iterator (const xcb_input_raw_button_press_event_t *R); int xcb_input_raw_button_release_sizeof (const void *_buffer /**< */); int xcb_input_raw_motion_sizeof (const void *_buffer /**< */); int xcb_input_touch_begin_sizeof (const void *_buffer); uint32_t * xcb_input_touch_begin_button_mask (const xcb_input_touch_begin_event_t *R); int xcb_input_touch_begin_button_mask_length (const xcb_input_touch_begin_event_t *R); xcb_generic_iterator_t xcb_input_touch_begin_button_mask_end (const xcb_input_touch_begin_event_t *R); uint32_t * xcb_input_touch_begin_valuator_mask (const xcb_input_touch_begin_event_t *R); int xcb_input_touch_begin_valuator_mask_length (const xcb_input_touch_begin_event_t *R); xcb_generic_iterator_t xcb_input_touch_begin_valuator_mask_end (const xcb_input_touch_begin_event_t *R); xcb_input_fp3232_t * xcb_input_touch_begin_axisvalues (const xcb_input_touch_begin_event_t *R); int xcb_input_touch_begin_axisvalues_length (const xcb_input_touch_begin_event_t *R); xcb_input_fp3232_iterator_t xcb_input_touch_begin_axisvalues_iterator (const xcb_input_touch_begin_event_t *R); int xcb_input_touch_update_sizeof (const void *_buffer /**< */); int xcb_input_touch_end_sizeof (const void *_buffer /**< */); int xcb_input_raw_touch_begin_sizeof (const void *_buffer); uint32_t * xcb_input_raw_touch_begin_valuator_mask (const xcb_input_raw_touch_begin_event_t *R); int xcb_input_raw_touch_begin_valuator_mask_length (const xcb_input_raw_touch_begin_event_t *R); xcb_generic_iterator_t xcb_input_raw_touch_begin_valuator_mask_end (const xcb_input_raw_touch_begin_event_t *R); xcb_input_fp3232_t * xcb_input_raw_touch_begin_axisvalues (const xcb_input_raw_touch_begin_event_t *R); int xcb_input_raw_touch_begin_axisvalues_length (const xcb_input_raw_touch_begin_event_t *R); xcb_input_fp3232_iterator_t xcb_input_raw_touch_begin_axisvalues_iterator (const xcb_input_raw_touch_begin_event_t *R); xcb_input_fp3232_t * xcb_input_raw_touch_begin_axisvalues_raw (const xcb_input_raw_touch_begin_event_t *R); int xcb_input_raw_touch_begin_axisvalues_raw_length (const xcb_input_raw_touch_begin_event_t *R); xcb_input_fp3232_iterator_t xcb_input_raw_touch_begin_axisvalues_raw_iterator (const xcb_input_raw_touch_begin_event_t *R); int xcb_input_raw_touch_update_sizeof (const void *_buffer /**< */); int xcb_input_raw_touch_end_sizeof (const void *_buffer /**< */); /** * Get the next element of the iterator * @param i Pointer to a xcb_input_event_for_send_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_input_event_for_send_t) */ void xcb_input_event_for_send_next (xcb_input_event_for_send_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_input_event_for_send_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_input_event_for_send_end (xcb_input_event_for_send_iterator_t i); int xcb_input_send_extension_event_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_input_send_extension_event_checked (xcb_connection_t *c, xcb_window_t destination, uint8_t device_id, uint8_t propagate, uint16_t num_classes, uint8_t num_events, const xcb_input_event_for_send_t *events, const xcb_input_event_class_t *classes); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_input_send_extension_event (xcb_connection_t *c, xcb_window_t destination, uint8_t device_id, uint8_t propagate, uint16_t num_classes, uint8_t num_events, const xcb_input_event_for_send_t *events, const xcb_input_event_class_t *classes); xcb_input_event_for_send_t * xcb_input_send_extension_event_events (const xcb_input_send_extension_event_request_t *R); int xcb_input_send_extension_event_events_length (const xcb_input_send_extension_event_request_t *R); xcb_input_event_for_send_iterator_t xcb_input_send_extension_event_events_iterator (const xcb_input_send_extension_event_request_t *R); xcb_input_event_class_t * xcb_input_send_extension_event_classes (const xcb_input_send_extension_event_request_t *R); int xcb_input_send_extension_event_classes_length (const xcb_input_send_extension_event_request_t *R); xcb_generic_iterator_t xcb_input_send_extension_event_classes_end (const xcb_input_send_extension_event_request_t *R); #ifdef __cplusplus } #endif #endif /** * @} */ �����������������������������������������������������������������������������������������������������������xcb/shm.h�������������������������������������������������������������������������������������������0000644�����������������00000041555�14763166026�0006305 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from shm.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_Shm_API XCB Shm API * @brief Shm XCB Protocol Implementation. * @{ **/ #ifndef __SHM_H #define __SHM_H #include "xcb.h" #include "xproto.h" #ifdef __cplusplus extern "C" { #endif #define XCB_SHM_MAJOR_VERSION 1 #define XCB_SHM_MINOR_VERSION 2 extern xcb_extension_t xcb_shm_id; typedef uint32_t xcb_shm_seg_t; /** * @brief xcb_shm_seg_iterator_t **/ typedef struct xcb_shm_seg_iterator_t { xcb_shm_seg_t *data; int rem; int index; } xcb_shm_seg_iterator_t; /** Opcode for xcb_shm_completion. */ #define XCB_SHM_COMPLETION 0 /** * @brief xcb_shm_completion_event_t **/ typedef struct xcb_shm_completion_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_drawable_t drawable; uint16_t minor_event; uint8_t major_event; uint8_t pad1; xcb_shm_seg_t shmseg; uint32_t offset; } xcb_shm_completion_event_t; /** Opcode for xcb_shm_bad_seg. */ #define XCB_SHM_BAD_SEG 0 typedef xcb_value_error_t xcb_shm_bad_seg_error_t; /** * @brief xcb_shm_query_version_cookie_t **/ typedef struct xcb_shm_query_version_cookie_t { unsigned int sequence; } xcb_shm_query_version_cookie_t; /** Opcode for xcb_shm_query_version. */ #define XCB_SHM_QUERY_VERSION 0 /** * @brief xcb_shm_query_version_request_t **/ typedef struct xcb_shm_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_shm_query_version_request_t; /** * @brief xcb_shm_query_version_reply_t **/ typedef struct xcb_shm_query_version_reply_t { uint8_t response_type; uint8_t shared_pixmaps; uint16_t sequence; uint32_t length; uint16_t major_version; uint16_t minor_version; uint16_t uid; uint16_t gid; uint8_t pixmap_format; uint8_t pad0[15]; } xcb_shm_query_version_reply_t; /** Opcode for xcb_shm_attach. */ #define XCB_SHM_ATTACH 1 /** * @brief xcb_shm_attach_request_t **/ typedef struct xcb_shm_attach_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_shm_seg_t shmseg; uint32_t shmid; uint8_t read_only; uint8_t pad0[3]; } xcb_shm_attach_request_t; /** Opcode for xcb_shm_detach. */ #define XCB_SHM_DETACH 2 /** * @brief xcb_shm_detach_request_t **/ typedef struct xcb_shm_detach_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_shm_seg_t shmseg; } xcb_shm_detach_request_t; /** Opcode for xcb_shm_put_image. */ #define XCB_SHM_PUT_IMAGE 3 /** * @brief xcb_shm_put_image_request_t **/ typedef struct xcb_shm_put_image_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; xcb_gcontext_t gc; uint16_t total_width; uint16_t total_height; uint16_t src_x; uint16_t src_y; uint16_t src_width; uint16_t src_height; int16_t dst_x; int16_t dst_y; uint8_t depth; uint8_t format; uint8_t send_event; uint8_t pad0; xcb_shm_seg_t shmseg; uint32_t offset; } xcb_shm_put_image_request_t; /** * @brief xcb_shm_get_image_cookie_t **/ typedef struct xcb_shm_get_image_cookie_t { unsigned int sequence; } xcb_shm_get_image_cookie_t; /** Opcode for xcb_shm_get_image. */ #define XCB_SHM_GET_IMAGE 4 /** * @brief xcb_shm_get_image_request_t **/ typedef struct xcb_shm_get_image_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; int16_t x; int16_t y; uint16_t width; uint16_t height; uint32_t plane_mask; uint8_t format; uint8_t pad0[3]; xcb_shm_seg_t shmseg; uint32_t offset; } xcb_shm_get_image_request_t; /** * @brief xcb_shm_get_image_reply_t **/ typedef struct xcb_shm_get_image_reply_t { uint8_t response_type; uint8_t depth; uint16_t sequence; uint32_t length; xcb_visualid_t visual; uint32_t size; } xcb_shm_get_image_reply_t; /** Opcode for xcb_shm_create_pixmap. */ #define XCB_SHM_CREATE_PIXMAP 5 /** * @brief xcb_shm_create_pixmap_request_t **/ typedef struct xcb_shm_create_pixmap_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_pixmap_t pid; xcb_drawable_t drawable; uint16_t width; uint16_t height; uint8_t depth; uint8_t pad0[3]; xcb_shm_seg_t shmseg; uint32_t offset; } xcb_shm_create_pixmap_request_t; /** Opcode for xcb_shm_attach_fd. */ #define XCB_SHM_ATTACH_FD 6 /** * @brief xcb_shm_attach_fd_request_t **/ typedef struct xcb_shm_attach_fd_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_shm_seg_t shmseg; uint8_t read_only; uint8_t pad0[3]; } xcb_shm_attach_fd_request_t; /** * @brief xcb_shm_create_segment_cookie_t **/ typedef struct xcb_shm_create_segment_cookie_t { unsigned int sequence; } xcb_shm_create_segment_cookie_t; /** Opcode for xcb_shm_create_segment. */ #define XCB_SHM_CREATE_SEGMENT 7 /** * @brief xcb_shm_create_segment_request_t **/ typedef struct xcb_shm_create_segment_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_shm_seg_t shmseg; uint32_t size; uint8_t read_only; uint8_t pad0[3]; } xcb_shm_create_segment_request_t; /** * @brief xcb_shm_create_segment_reply_t **/ typedef struct xcb_shm_create_segment_reply_t { uint8_t response_type; uint8_t nfd; uint16_t sequence; uint32_t length; uint8_t pad0[24]; } xcb_shm_create_segment_reply_t; /** * Get the next element of the iterator * @param i Pointer to a xcb_shm_seg_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_shm_seg_t) */ void xcb_shm_seg_next (xcb_shm_seg_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_shm_seg_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_shm_seg_end (xcb_shm_seg_iterator_t i); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_shm_query_version_cookie_t xcb_shm_query_version (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_shm_query_version_cookie_t xcb_shm_query_version_unchecked (xcb_connection_t *c); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_shm_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_shm_query_version_reply_t * xcb_shm_query_version_reply (xcb_connection_t *c, xcb_shm_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_shm_attach_checked (xcb_connection_t *c, xcb_shm_seg_t shmseg, uint32_t shmid, uint8_t read_only); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_shm_attach (xcb_connection_t *c, xcb_shm_seg_t shmseg, uint32_t shmid, uint8_t read_only); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_shm_detach_checked (xcb_connection_t *c, xcb_shm_seg_t shmseg); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_shm_detach (xcb_connection_t *c, xcb_shm_seg_t shmseg); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_shm_put_image_checked (xcb_connection_t *c, xcb_drawable_t drawable, xcb_gcontext_t gc, uint16_t total_width, uint16_t total_height, uint16_t src_x, uint16_t src_y, uint16_t src_width, uint16_t src_height, int16_t dst_x, int16_t dst_y, uint8_t depth, uint8_t format, uint8_t send_event, xcb_shm_seg_t shmseg, uint32_t offset); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_shm_put_image (xcb_connection_t *c, xcb_drawable_t drawable, xcb_gcontext_t gc, uint16_t total_width, uint16_t total_height, uint16_t src_x, uint16_t src_y, uint16_t src_width, uint16_t src_height, int16_t dst_x, int16_t dst_y, uint8_t depth, uint8_t format, uint8_t send_event, xcb_shm_seg_t shmseg, uint32_t offset); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_shm_get_image_cookie_t xcb_shm_get_image (xcb_connection_t *c, xcb_drawable_t drawable, int16_t x, int16_t y, uint16_t width, uint16_t height, uint32_t plane_mask, uint8_t format, xcb_shm_seg_t shmseg, uint32_t offset); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_shm_get_image_cookie_t xcb_shm_get_image_unchecked (xcb_connection_t *c, xcb_drawable_t drawable, int16_t x, int16_t y, uint16_t width, uint16_t height, uint32_t plane_mask, uint8_t format, xcb_shm_seg_t shmseg, uint32_t offset); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_shm_get_image_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_shm_get_image_reply_t * xcb_shm_get_image_reply (xcb_connection_t *c, xcb_shm_get_image_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_shm_create_pixmap_checked (xcb_connection_t *c, xcb_pixmap_t pid, xcb_drawable_t drawable, uint16_t width, uint16_t height, uint8_t depth, xcb_shm_seg_t shmseg, uint32_t offset); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_shm_create_pixmap (xcb_connection_t *c, xcb_pixmap_t pid, xcb_drawable_t drawable, uint16_t width, uint16_t height, uint8_t depth, xcb_shm_seg_t shmseg, uint32_t offset); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_shm_attach_fd_checked (xcb_connection_t *c, xcb_shm_seg_t shmseg, int32_t shm_fd, uint8_t read_only); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_shm_attach_fd (xcb_connection_t *c, xcb_shm_seg_t shmseg, int32_t shm_fd, uint8_t read_only); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_shm_create_segment_cookie_t xcb_shm_create_segment (xcb_connection_t *c, xcb_shm_seg_t shmseg, uint32_t size, uint8_t read_only); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_shm_create_segment_cookie_t xcb_shm_create_segment_unchecked (xcb_connection_t *c, xcb_shm_seg_t shmseg, uint32_t size, uint8_t read_only); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_shm_create_segment_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_shm_create_segment_reply_t * xcb_shm_create_segment_reply (xcb_connection_t *c, xcb_shm_create_segment_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * Return the reply fds * @param c The connection * @param reply The reply * * Returns the array of reply fds of the request asked by * * The returned value must be freed by the caller using free(). */ int * xcb_shm_create_segment_reply_fds (xcb_connection_t *c /**< */, xcb_shm_create_segment_reply_t *reply); #ifdef __cplusplus } #endif #endif /** * @} */ ���������������������������������������������������������������������������������������������������������������������������������������������������xcb/shape.h�����������������������������������������������������������������������������������������0000644�����������������00000050506�14763166026�0006612 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from shape.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_Shape_API XCB Shape API * @brief Shape XCB Protocol Implementation. * @{ **/ #ifndef __SHAPE_H #define __SHAPE_H #include "xcb.h" #include "xproto.h" #ifdef __cplusplus extern "C" { #endif #define XCB_SHAPE_MAJOR_VERSION 1 #define XCB_SHAPE_MINOR_VERSION 1 extern xcb_extension_t xcb_shape_id; typedef uint8_t xcb_shape_op_t; /** * @brief xcb_shape_op_iterator_t **/ typedef struct xcb_shape_op_iterator_t { xcb_shape_op_t *data; int rem; int index; } xcb_shape_op_iterator_t; typedef uint8_t xcb_shape_kind_t; /** * @brief xcb_shape_kind_iterator_t **/ typedef struct xcb_shape_kind_iterator_t { xcb_shape_kind_t *data; int rem; int index; } xcb_shape_kind_iterator_t; typedef enum xcb_shape_so_t { XCB_SHAPE_SO_SET = 0, XCB_SHAPE_SO_UNION = 1, XCB_SHAPE_SO_INTERSECT = 2, XCB_SHAPE_SO_SUBTRACT = 3, XCB_SHAPE_SO_INVERT = 4 } xcb_shape_so_t; typedef enum xcb_shape_sk_t { XCB_SHAPE_SK_BOUNDING = 0, XCB_SHAPE_SK_CLIP = 1, XCB_SHAPE_SK_INPUT = 2 } xcb_shape_sk_t; /** Opcode for xcb_shape_notify. */ #define XCB_SHAPE_NOTIFY 0 /** * @brief xcb_shape_notify_event_t **/ typedef struct xcb_shape_notify_event_t { uint8_t response_type; xcb_shape_kind_t shape_kind; uint16_t sequence; xcb_window_t affected_window; int16_t extents_x; int16_t extents_y; uint16_t extents_width; uint16_t extents_height; xcb_timestamp_t server_time; uint8_t shaped; uint8_t pad0[11]; } xcb_shape_notify_event_t; /** * @brief xcb_shape_query_version_cookie_t **/ typedef struct xcb_shape_query_version_cookie_t { unsigned int sequence; } xcb_shape_query_version_cookie_t; /** Opcode for xcb_shape_query_version. */ #define XCB_SHAPE_QUERY_VERSION 0 /** * @brief xcb_shape_query_version_request_t **/ typedef struct xcb_shape_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_shape_query_version_request_t; /** * @brief xcb_shape_query_version_reply_t **/ typedef struct xcb_shape_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t major_version; uint16_t minor_version; } xcb_shape_query_version_reply_t; /** Opcode for xcb_shape_rectangles. */ #define XCB_SHAPE_RECTANGLES 1 /** * @brief xcb_shape_rectangles_request_t **/ typedef struct xcb_shape_rectangles_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_shape_op_t operation; xcb_shape_kind_t destination_kind; uint8_t ordering; uint8_t pad0; xcb_window_t destination_window; int16_t x_offset; int16_t y_offset; } xcb_shape_rectangles_request_t; /** Opcode for xcb_shape_mask. */ #define XCB_SHAPE_MASK 2 /** * @brief xcb_shape_mask_request_t **/ typedef struct xcb_shape_mask_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_shape_op_t operation; xcb_shape_kind_t destination_kind; uint8_t pad0[2]; xcb_window_t destination_window; int16_t x_offset; int16_t y_offset; xcb_pixmap_t source_bitmap; } xcb_shape_mask_request_t; /** Opcode for xcb_shape_combine. */ #define XCB_SHAPE_COMBINE 3 /** * @brief xcb_shape_combine_request_t **/ typedef struct xcb_shape_combine_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_shape_op_t operation; xcb_shape_kind_t destination_kind; xcb_shape_kind_t source_kind; uint8_t pad0; xcb_window_t destination_window; int16_t x_offset; int16_t y_offset; xcb_window_t source_window; } xcb_shape_combine_request_t; /** Opcode for xcb_shape_offset. */ #define XCB_SHAPE_OFFSET 4 /** * @brief xcb_shape_offset_request_t **/ typedef struct xcb_shape_offset_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_shape_kind_t destination_kind; uint8_t pad0[3]; xcb_window_t destination_window; int16_t x_offset; int16_t y_offset; } xcb_shape_offset_request_t; /** * @brief xcb_shape_query_extents_cookie_t **/ typedef struct xcb_shape_query_extents_cookie_t { unsigned int sequence; } xcb_shape_query_extents_cookie_t; /** Opcode for xcb_shape_query_extents. */ #define XCB_SHAPE_QUERY_EXTENTS 5 /** * @brief xcb_shape_query_extents_request_t **/ typedef struct xcb_shape_query_extents_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t destination_window; } xcb_shape_query_extents_request_t; /** * @brief xcb_shape_query_extents_reply_t **/ typedef struct xcb_shape_query_extents_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t bounding_shaped; uint8_t clip_shaped; uint8_t pad1[2]; int16_t bounding_shape_extents_x; int16_t bounding_shape_extents_y; uint16_t bounding_shape_extents_width; uint16_t bounding_shape_extents_height; int16_t clip_shape_extents_x; int16_t clip_shape_extents_y; uint16_t clip_shape_extents_width; uint16_t clip_shape_extents_height; } xcb_shape_query_extents_reply_t; /** Opcode for xcb_shape_select_input. */ #define XCB_SHAPE_SELECT_INPUT 6 /** * @brief xcb_shape_select_input_request_t **/ typedef struct xcb_shape_select_input_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t destination_window; uint8_t enable; uint8_t pad0[3]; } xcb_shape_select_input_request_t; /** * @brief xcb_shape_input_selected_cookie_t **/ typedef struct xcb_shape_input_selected_cookie_t { unsigned int sequence; } xcb_shape_input_selected_cookie_t; /** Opcode for xcb_shape_input_selected. */ #define XCB_SHAPE_INPUT_SELECTED 7 /** * @brief xcb_shape_input_selected_request_t **/ typedef struct xcb_shape_input_selected_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t destination_window; } xcb_shape_input_selected_request_t; /** * @brief xcb_shape_input_selected_reply_t **/ typedef struct xcb_shape_input_selected_reply_t { uint8_t response_type; uint8_t enabled; uint16_t sequence; uint32_t length; } xcb_shape_input_selected_reply_t; /** * @brief xcb_shape_get_rectangles_cookie_t **/ typedef struct xcb_shape_get_rectangles_cookie_t { unsigned int sequence; } xcb_shape_get_rectangles_cookie_t; /** Opcode for xcb_shape_get_rectangles. */ #define XCB_SHAPE_GET_RECTANGLES 8 /** * @brief xcb_shape_get_rectangles_request_t **/ typedef struct xcb_shape_get_rectangles_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; xcb_shape_kind_t source_kind; uint8_t pad0[3]; } xcb_shape_get_rectangles_request_t; /** * @brief xcb_shape_get_rectangles_reply_t **/ typedef struct xcb_shape_get_rectangles_reply_t { uint8_t response_type; uint8_t ordering; uint16_t sequence; uint32_t length; uint32_t rectangles_len; uint8_t pad0[20]; } xcb_shape_get_rectangles_reply_t; /** * Get the next element of the iterator * @param i Pointer to a xcb_shape_op_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_shape_op_t) */ void xcb_shape_op_next (xcb_shape_op_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_shape_op_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_shape_op_end (xcb_shape_op_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_shape_kind_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_shape_kind_t) */ void xcb_shape_kind_next (xcb_shape_kind_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_shape_kind_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_shape_kind_end (xcb_shape_kind_iterator_t i); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_shape_query_version_cookie_t xcb_shape_query_version (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_shape_query_version_cookie_t xcb_shape_query_version_unchecked (xcb_connection_t *c); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_shape_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_shape_query_version_reply_t * xcb_shape_query_version_reply (xcb_connection_t *c, xcb_shape_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_shape_rectangles_sizeof (const void *_buffer, uint32_t rectangles_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_shape_rectangles_checked (xcb_connection_t *c, xcb_shape_op_t operation, xcb_shape_kind_t destination_kind, uint8_t ordering, xcb_window_t destination_window, int16_t x_offset, int16_t y_offset, uint32_t rectangles_len, const xcb_rectangle_t *rectangles); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_shape_rectangles (xcb_connection_t *c, xcb_shape_op_t operation, xcb_shape_kind_t destination_kind, uint8_t ordering, xcb_window_t destination_window, int16_t x_offset, int16_t y_offset, uint32_t rectangles_len, const xcb_rectangle_t *rectangles); xcb_rectangle_t * xcb_shape_rectangles_rectangles (const xcb_shape_rectangles_request_t *R); int xcb_shape_rectangles_rectangles_length (const xcb_shape_rectangles_request_t *R); xcb_rectangle_iterator_t xcb_shape_rectangles_rectangles_iterator (const xcb_shape_rectangles_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_shape_mask_checked (xcb_connection_t *c, xcb_shape_op_t operation, xcb_shape_kind_t destination_kind, xcb_window_t destination_window, int16_t x_offset, int16_t y_offset, xcb_pixmap_t source_bitmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_shape_mask (xcb_connection_t *c, xcb_shape_op_t operation, xcb_shape_kind_t destination_kind, xcb_window_t destination_window, int16_t x_offset, int16_t y_offset, xcb_pixmap_t source_bitmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_shape_combine_checked (xcb_connection_t *c, xcb_shape_op_t operation, xcb_shape_kind_t destination_kind, xcb_shape_kind_t source_kind, xcb_window_t destination_window, int16_t x_offset, int16_t y_offset, xcb_window_t source_window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_shape_combine (xcb_connection_t *c, xcb_shape_op_t operation, xcb_shape_kind_t destination_kind, xcb_shape_kind_t source_kind, xcb_window_t destination_window, int16_t x_offset, int16_t y_offset, xcb_window_t source_window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_shape_offset_checked (xcb_connection_t *c, xcb_shape_kind_t destination_kind, xcb_window_t destination_window, int16_t x_offset, int16_t y_offset); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_shape_offset (xcb_connection_t *c, xcb_shape_kind_t destination_kind, xcb_window_t destination_window, int16_t x_offset, int16_t y_offset); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_shape_query_extents_cookie_t xcb_shape_query_extents (xcb_connection_t *c, xcb_window_t destination_window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_shape_query_extents_cookie_t xcb_shape_query_extents_unchecked (xcb_connection_t *c, xcb_window_t destination_window); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_shape_query_extents_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_shape_query_extents_reply_t * xcb_shape_query_extents_reply (xcb_connection_t *c, xcb_shape_query_extents_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_shape_select_input_checked (xcb_connection_t *c, xcb_window_t destination_window, uint8_t enable); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_shape_select_input (xcb_connection_t *c, xcb_window_t destination_window, uint8_t enable); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_shape_input_selected_cookie_t xcb_shape_input_selected (xcb_connection_t *c, xcb_window_t destination_window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_shape_input_selected_cookie_t xcb_shape_input_selected_unchecked (xcb_connection_t *c, xcb_window_t destination_window); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_shape_input_selected_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_shape_input_selected_reply_t * xcb_shape_input_selected_reply (xcb_connection_t *c, xcb_shape_input_selected_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_shape_get_rectangles_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_shape_get_rectangles_cookie_t xcb_shape_get_rectangles (xcb_connection_t *c, xcb_window_t window, xcb_shape_kind_t source_kind); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_shape_get_rectangles_cookie_t xcb_shape_get_rectangles_unchecked (xcb_connection_t *c, xcb_window_t window, xcb_shape_kind_t source_kind); xcb_rectangle_t * xcb_shape_get_rectangles_rectangles (const xcb_shape_get_rectangles_reply_t *R); int xcb_shape_get_rectangles_rectangles_length (const xcb_shape_get_rectangles_reply_t *R); xcb_rectangle_iterator_t xcb_shape_get_rectangles_rectangles_iterator (const xcb_shape_get_rectangles_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_shape_get_rectangles_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_shape_get_rectangles_reply_t * xcb_shape_get_rectangles_reply (xcb_connection_t *c, xcb_shape_get_rectangles_cookie_t cookie /**< */, xcb_generic_error_t **e); #ifdef __cplusplus } #endif #endif /** * @} */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/xf86dri.h���������������������������������������������������������������������������������������0000644�����������������00000066602�14763166026�0007010 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from xf86dri.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_XF86Dri_API XCB XF86Dri API * @brief XF86Dri XCB Protocol Implementation. * @{ **/ #ifndef __XF86DRI_H #define __XF86DRI_H #include "xcb.h" #ifdef __cplusplus extern "C" { #endif #define XCB_XF86DRI_MAJOR_VERSION 4 #define XCB_XF86DRI_MINOR_VERSION 1 extern xcb_extension_t xcb_xf86dri_id; /** * @brief xcb_xf86dri_drm_clip_rect_t **/ typedef struct xcb_xf86dri_drm_clip_rect_t { int16_t x1; int16_t y1; int16_t x2; int16_t x3; } xcb_xf86dri_drm_clip_rect_t; /** * @brief xcb_xf86dri_drm_clip_rect_iterator_t **/ typedef struct xcb_xf86dri_drm_clip_rect_iterator_t { xcb_xf86dri_drm_clip_rect_t *data; int rem; int index; } xcb_xf86dri_drm_clip_rect_iterator_t; /** * @brief xcb_xf86dri_query_version_cookie_t **/ typedef struct xcb_xf86dri_query_version_cookie_t { unsigned int sequence; } xcb_xf86dri_query_version_cookie_t; /** Opcode for xcb_xf86dri_query_version. */ #define XCB_XF86DRI_QUERY_VERSION 0 /** * @brief xcb_xf86dri_query_version_request_t **/ typedef struct xcb_xf86dri_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_xf86dri_query_version_request_t; /** * @brief xcb_xf86dri_query_version_reply_t **/ typedef struct xcb_xf86dri_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t dri_major_version; uint16_t dri_minor_version; uint32_t dri_minor_patch; } xcb_xf86dri_query_version_reply_t; /** * @brief xcb_xf86dri_query_direct_rendering_capable_cookie_t **/ typedef struct xcb_xf86dri_query_direct_rendering_capable_cookie_t { unsigned int sequence; } xcb_xf86dri_query_direct_rendering_capable_cookie_t; /** Opcode for xcb_xf86dri_query_direct_rendering_capable. */ #define XCB_XF86DRI_QUERY_DIRECT_RENDERING_CAPABLE 1 /** * @brief xcb_xf86dri_query_direct_rendering_capable_request_t **/ typedef struct xcb_xf86dri_query_direct_rendering_capable_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; } xcb_xf86dri_query_direct_rendering_capable_request_t; /** * @brief xcb_xf86dri_query_direct_rendering_capable_reply_t **/ typedef struct xcb_xf86dri_query_direct_rendering_capable_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t is_capable; } xcb_xf86dri_query_direct_rendering_capable_reply_t; /** * @brief xcb_xf86dri_open_connection_cookie_t **/ typedef struct xcb_xf86dri_open_connection_cookie_t { unsigned int sequence; } xcb_xf86dri_open_connection_cookie_t; /** Opcode for xcb_xf86dri_open_connection. */ #define XCB_XF86DRI_OPEN_CONNECTION 2 /** * @brief xcb_xf86dri_open_connection_request_t **/ typedef struct xcb_xf86dri_open_connection_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; } xcb_xf86dri_open_connection_request_t; /** * @brief xcb_xf86dri_open_connection_reply_t **/ typedef struct xcb_xf86dri_open_connection_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t sarea_handle_low; uint32_t sarea_handle_high; uint32_t bus_id_len; uint8_t pad1[12]; } xcb_xf86dri_open_connection_reply_t; /** Opcode for xcb_xf86dri_close_connection. */ #define XCB_XF86DRI_CLOSE_CONNECTION 3 /** * @brief xcb_xf86dri_close_connection_request_t **/ typedef struct xcb_xf86dri_close_connection_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; } xcb_xf86dri_close_connection_request_t; /** * @brief xcb_xf86dri_get_client_driver_name_cookie_t **/ typedef struct xcb_xf86dri_get_client_driver_name_cookie_t { unsigned int sequence; } xcb_xf86dri_get_client_driver_name_cookie_t; /** Opcode for xcb_xf86dri_get_client_driver_name. */ #define XCB_XF86DRI_GET_CLIENT_DRIVER_NAME 4 /** * @brief xcb_xf86dri_get_client_driver_name_request_t **/ typedef struct xcb_xf86dri_get_client_driver_name_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; } xcb_xf86dri_get_client_driver_name_request_t; /** * @brief xcb_xf86dri_get_client_driver_name_reply_t **/ typedef struct xcb_xf86dri_get_client_driver_name_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t client_driver_major_version; uint32_t client_driver_minor_version; uint32_t client_driver_patch_version; uint32_t client_driver_name_len; uint8_t pad1[8]; } xcb_xf86dri_get_client_driver_name_reply_t; /** * @brief xcb_xf86dri_create_context_cookie_t **/ typedef struct xcb_xf86dri_create_context_cookie_t { unsigned int sequence; } xcb_xf86dri_create_context_cookie_t; /** Opcode for xcb_xf86dri_create_context. */ #define XCB_XF86DRI_CREATE_CONTEXT 5 /** * @brief xcb_xf86dri_create_context_request_t **/ typedef struct xcb_xf86dri_create_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; uint32_t visual; uint32_t context; } xcb_xf86dri_create_context_request_t; /** * @brief xcb_xf86dri_create_context_reply_t **/ typedef struct xcb_xf86dri_create_context_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t hw_context; } xcb_xf86dri_create_context_reply_t; /** Opcode for xcb_xf86dri_destroy_context. */ #define XCB_XF86DRI_DESTROY_CONTEXT 6 /** * @brief xcb_xf86dri_destroy_context_request_t **/ typedef struct xcb_xf86dri_destroy_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; uint32_t context; } xcb_xf86dri_destroy_context_request_t; /** * @brief xcb_xf86dri_create_drawable_cookie_t **/ typedef struct xcb_xf86dri_create_drawable_cookie_t { unsigned int sequence; } xcb_xf86dri_create_drawable_cookie_t; /** Opcode for xcb_xf86dri_create_drawable. */ #define XCB_XF86DRI_CREATE_DRAWABLE 7 /** * @brief xcb_xf86dri_create_drawable_request_t **/ typedef struct xcb_xf86dri_create_drawable_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; uint32_t drawable; } xcb_xf86dri_create_drawable_request_t; /** * @brief xcb_xf86dri_create_drawable_reply_t **/ typedef struct xcb_xf86dri_create_drawable_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t hw_drawable_handle; } xcb_xf86dri_create_drawable_reply_t; /** Opcode for xcb_xf86dri_destroy_drawable. */ #define XCB_XF86DRI_DESTROY_DRAWABLE 8 /** * @brief xcb_xf86dri_destroy_drawable_request_t **/ typedef struct xcb_xf86dri_destroy_drawable_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; uint32_t drawable; } xcb_xf86dri_destroy_drawable_request_t; /** * @brief xcb_xf86dri_get_drawable_info_cookie_t **/ typedef struct xcb_xf86dri_get_drawable_info_cookie_t { unsigned int sequence; } xcb_xf86dri_get_drawable_info_cookie_t; /** Opcode for xcb_xf86dri_get_drawable_info. */ #define XCB_XF86DRI_GET_DRAWABLE_INFO 9 /** * @brief xcb_xf86dri_get_drawable_info_request_t **/ typedef struct xcb_xf86dri_get_drawable_info_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; uint32_t drawable; } xcb_xf86dri_get_drawable_info_request_t; /** * @brief xcb_xf86dri_get_drawable_info_reply_t **/ typedef struct xcb_xf86dri_get_drawable_info_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t drawable_table_index; uint32_t drawable_table_stamp; int16_t drawable_origin_X; int16_t drawable_origin_Y; int16_t drawable_size_W; int16_t drawable_size_H; uint32_t num_clip_rects; int16_t back_x; int16_t back_y; uint32_t num_back_clip_rects; } xcb_xf86dri_get_drawable_info_reply_t; /** * @brief xcb_xf86dri_get_device_info_cookie_t **/ typedef struct xcb_xf86dri_get_device_info_cookie_t { unsigned int sequence; } xcb_xf86dri_get_device_info_cookie_t; /** Opcode for xcb_xf86dri_get_device_info. */ #define XCB_XF86DRI_GET_DEVICE_INFO 10 /** * @brief xcb_xf86dri_get_device_info_request_t **/ typedef struct xcb_xf86dri_get_device_info_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; } xcb_xf86dri_get_device_info_request_t; /** * @brief xcb_xf86dri_get_device_info_reply_t **/ typedef struct xcb_xf86dri_get_device_info_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t framebuffer_handle_low; uint32_t framebuffer_handle_high; uint32_t framebuffer_origin_offset; uint32_t framebuffer_size; uint32_t framebuffer_stride; uint32_t device_private_size; } xcb_xf86dri_get_device_info_reply_t; /** * @brief xcb_xf86dri_auth_connection_cookie_t **/ typedef struct xcb_xf86dri_auth_connection_cookie_t { unsigned int sequence; } xcb_xf86dri_auth_connection_cookie_t; /** Opcode for xcb_xf86dri_auth_connection. */ #define XCB_XF86DRI_AUTH_CONNECTION 11 /** * @brief xcb_xf86dri_auth_connection_request_t **/ typedef struct xcb_xf86dri_auth_connection_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t screen; uint32_t magic; } xcb_xf86dri_auth_connection_request_t; /** * @brief xcb_xf86dri_auth_connection_reply_t **/ typedef struct xcb_xf86dri_auth_connection_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t authenticated; } xcb_xf86dri_auth_connection_reply_t; /** * Get the next element of the iterator * @param i Pointer to a xcb_xf86dri_drm_clip_rect_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xf86dri_drm_clip_rect_t) */ void xcb_xf86dri_drm_clip_rect_next (xcb_xf86dri_drm_clip_rect_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xf86dri_drm_clip_rect_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xf86dri_drm_clip_rect_end (xcb_xf86dri_drm_clip_rect_iterator_t i); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xf86dri_query_version_cookie_t xcb_xf86dri_query_version (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xf86dri_query_version_cookie_t xcb_xf86dri_query_version_unchecked (xcb_connection_t *c); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xf86dri_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xf86dri_query_version_reply_t * xcb_xf86dri_query_version_reply (xcb_connection_t *c, xcb_xf86dri_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xf86dri_query_direct_rendering_capable_cookie_t xcb_xf86dri_query_direct_rendering_capable (xcb_connection_t *c, uint32_t screen); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xf86dri_query_direct_rendering_capable_cookie_t xcb_xf86dri_query_direct_rendering_capable_unchecked (xcb_connection_t *c, uint32_t screen); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xf86dri_query_direct_rendering_capable_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xf86dri_query_direct_rendering_capable_reply_t * xcb_xf86dri_query_direct_rendering_capable_reply (xcb_connection_t *c, xcb_xf86dri_query_direct_rendering_capable_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xf86dri_open_connection_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xf86dri_open_connection_cookie_t xcb_xf86dri_open_connection (xcb_connection_t *c, uint32_t screen); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xf86dri_open_connection_cookie_t xcb_xf86dri_open_connection_unchecked (xcb_connection_t *c, uint32_t screen); char * xcb_xf86dri_open_connection_bus_id (const xcb_xf86dri_open_connection_reply_t *R); int xcb_xf86dri_open_connection_bus_id_length (const xcb_xf86dri_open_connection_reply_t *R); xcb_generic_iterator_t xcb_xf86dri_open_connection_bus_id_end (const xcb_xf86dri_open_connection_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xf86dri_open_connection_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xf86dri_open_connection_reply_t * xcb_xf86dri_open_connection_reply (xcb_connection_t *c, xcb_xf86dri_open_connection_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xf86dri_close_connection_checked (xcb_connection_t *c, uint32_t screen); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xf86dri_close_connection (xcb_connection_t *c, uint32_t screen); int xcb_xf86dri_get_client_driver_name_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xf86dri_get_client_driver_name_cookie_t xcb_xf86dri_get_client_driver_name (xcb_connection_t *c, uint32_t screen); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xf86dri_get_client_driver_name_cookie_t xcb_xf86dri_get_client_driver_name_unchecked (xcb_connection_t *c, uint32_t screen); char * xcb_xf86dri_get_client_driver_name_client_driver_name (const xcb_xf86dri_get_client_driver_name_reply_t *R); int xcb_xf86dri_get_client_driver_name_client_driver_name_length (const xcb_xf86dri_get_client_driver_name_reply_t *R); xcb_generic_iterator_t xcb_xf86dri_get_client_driver_name_client_driver_name_end (const xcb_xf86dri_get_client_driver_name_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xf86dri_get_client_driver_name_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xf86dri_get_client_driver_name_reply_t * xcb_xf86dri_get_client_driver_name_reply (xcb_connection_t *c, xcb_xf86dri_get_client_driver_name_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xf86dri_create_context_cookie_t xcb_xf86dri_create_context (xcb_connection_t *c, uint32_t screen, uint32_t visual, uint32_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xf86dri_create_context_cookie_t xcb_xf86dri_create_context_unchecked (xcb_connection_t *c, uint32_t screen, uint32_t visual, uint32_t context); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xf86dri_create_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xf86dri_create_context_reply_t * xcb_xf86dri_create_context_reply (xcb_connection_t *c, xcb_xf86dri_create_context_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xf86dri_destroy_context_checked (xcb_connection_t *c, uint32_t screen, uint32_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xf86dri_destroy_context (xcb_connection_t *c, uint32_t screen, uint32_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xf86dri_create_drawable_cookie_t xcb_xf86dri_create_drawable (xcb_connection_t *c, uint32_t screen, uint32_t drawable); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xf86dri_create_drawable_cookie_t xcb_xf86dri_create_drawable_unchecked (xcb_connection_t *c, uint32_t screen, uint32_t drawable); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xf86dri_create_drawable_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xf86dri_create_drawable_reply_t * xcb_xf86dri_create_drawable_reply (xcb_connection_t *c, xcb_xf86dri_create_drawable_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xf86dri_destroy_drawable_checked (xcb_connection_t *c, uint32_t screen, uint32_t drawable); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xf86dri_destroy_drawable (xcb_connection_t *c, uint32_t screen, uint32_t drawable); int xcb_xf86dri_get_drawable_info_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xf86dri_get_drawable_info_cookie_t xcb_xf86dri_get_drawable_info (xcb_connection_t *c, uint32_t screen, uint32_t drawable); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xf86dri_get_drawable_info_cookie_t xcb_xf86dri_get_drawable_info_unchecked (xcb_connection_t *c, uint32_t screen, uint32_t drawable); xcb_xf86dri_drm_clip_rect_t * xcb_xf86dri_get_drawable_info_clip_rects (const xcb_xf86dri_get_drawable_info_reply_t *R); int xcb_xf86dri_get_drawable_info_clip_rects_length (const xcb_xf86dri_get_drawable_info_reply_t *R); xcb_xf86dri_drm_clip_rect_iterator_t xcb_xf86dri_get_drawable_info_clip_rects_iterator (const xcb_xf86dri_get_drawable_info_reply_t *R); xcb_xf86dri_drm_clip_rect_t * xcb_xf86dri_get_drawable_info_back_clip_rects (const xcb_xf86dri_get_drawable_info_reply_t *R); int xcb_xf86dri_get_drawable_info_back_clip_rects_length (const xcb_xf86dri_get_drawable_info_reply_t *R); xcb_xf86dri_drm_clip_rect_iterator_t xcb_xf86dri_get_drawable_info_back_clip_rects_iterator (const xcb_xf86dri_get_drawable_info_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xf86dri_get_drawable_info_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xf86dri_get_drawable_info_reply_t * xcb_xf86dri_get_drawable_info_reply (xcb_connection_t *c, xcb_xf86dri_get_drawable_info_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xf86dri_get_device_info_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xf86dri_get_device_info_cookie_t xcb_xf86dri_get_device_info (xcb_connection_t *c, uint32_t screen); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xf86dri_get_device_info_cookie_t xcb_xf86dri_get_device_info_unchecked (xcb_connection_t *c, uint32_t screen); uint32_t * xcb_xf86dri_get_device_info_device_private (const xcb_xf86dri_get_device_info_reply_t *R); int xcb_xf86dri_get_device_info_device_private_length (const xcb_xf86dri_get_device_info_reply_t *R); xcb_generic_iterator_t xcb_xf86dri_get_device_info_device_private_end (const xcb_xf86dri_get_device_info_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xf86dri_get_device_info_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xf86dri_get_device_info_reply_t * xcb_xf86dri_get_device_info_reply (xcb_connection_t *c, xcb_xf86dri_get_device_info_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xf86dri_auth_connection_cookie_t xcb_xf86dri_auth_connection (xcb_connection_t *c, uint32_t screen, uint32_t magic); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xf86dri_auth_connection_cookie_t xcb_xf86dri_auth_connection_unchecked (xcb_connection_t *c, uint32_t screen, uint32_t magic); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xf86dri_auth_connection_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xf86dri_auth_connection_reply_t * xcb_xf86dri_auth_connection_reply (xcb_connection_t *c, xcb_xf86dri_auth_connection_cookie_t cookie /**< */, xcb_generic_error_t **e); #ifdef __cplusplus } #endif #endif /** * @} */ ������������������������������������������������������������������������������������������������������������������������������xcb/xvmc.h������������������������������������������������������������������������������������������0000644�����������������00000057722�14763166026�0006476 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from xvmc.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_XvMC_API XCB XvMC API * @brief XvMC XCB Protocol Implementation. * @{ **/ #ifndef __XVMC_H #define __XVMC_H #include "xcb.h" #include "xv.h" #ifdef __cplusplus extern "C" { #endif #define XCB_XVMC_MAJOR_VERSION 1 #define XCB_XVMC_MINOR_VERSION 1 extern xcb_extension_t xcb_xvmc_id; typedef uint32_t xcb_xvmc_context_t; /** * @brief xcb_xvmc_context_iterator_t **/ typedef struct xcb_xvmc_context_iterator_t { xcb_xvmc_context_t *data; int rem; int index; } xcb_xvmc_context_iterator_t; typedef uint32_t xcb_xvmc_surface_t; /** * @brief xcb_xvmc_surface_iterator_t **/ typedef struct xcb_xvmc_surface_iterator_t { xcb_xvmc_surface_t *data; int rem; int index; } xcb_xvmc_surface_iterator_t; typedef uint32_t xcb_xvmc_subpicture_t; /** * @brief xcb_xvmc_subpicture_iterator_t **/ typedef struct xcb_xvmc_subpicture_iterator_t { xcb_xvmc_subpicture_t *data; int rem; int index; } xcb_xvmc_subpicture_iterator_t; /** * @brief xcb_xvmc_surface_info_t **/ typedef struct xcb_xvmc_surface_info_t { xcb_xvmc_surface_t id; uint16_t chroma_format; uint16_t pad0; uint16_t max_width; uint16_t max_height; uint16_t subpicture_max_width; uint16_t subpicture_max_height; uint32_t mc_type; uint32_t flags; } xcb_xvmc_surface_info_t; /** * @brief xcb_xvmc_surface_info_iterator_t **/ typedef struct xcb_xvmc_surface_info_iterator_t { xcb_xvmc_surface_info_t *data; int rem; int index; } xcb_xvmc_surface_info_iterator_t; /** * @brief xcb_xvmc_query_version_cookie_t **/ typedef struct xcb_xvmc_query_version_cookie_t { unsigned int sequence; } xcb_xvmc_query_version_cookie_t; /** Opcode for xcb_xvmc_query_version. */ #define XCB_XVMC_QUERY_VERSION 0 /** * @brief xcb_xvmc_query_version_request_t **/ typedef struct xcb_xvmc_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_xvmc_query_version_request_t; /** * @brief xcb_xvmc_query_version_reply_t **/ typedef struct xcb_xvmc_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t major; uint32_t minor; } xcb_xvmc_query_version_reply_t; /** * @brief xcb_xvmc_list_surface_types_cookie_t **/ typedef struct xcb_xvmc_list_surface_types_cookie_t { unsigned int sequence; } xcb_xvmc_list_surface_types_cookie_t; /** Opcode for xcb_xvmc_list_surface_types. */ #define XCB_XVMC_LIST_SURFACE_TYPES 1 /** * @brief xcb_xvmc_list_surface_types_request_t **/ typedef struct xcb_xvmc_list_surface_types_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xv_port_t port_id; } xcb_xvmc_list_surface_types_request_t; /** * @brief xcb_xvmc_list_surface_types_reply_t **/ typedef struct xcb_xvmc_list_surface_types_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t num; uint8_t pad1[20]; } xcb_xvmc_list_surface_types_reply_t; /** * @brief xcb_xvmc_create_context_cookie_t **/ typedef struct xcb_xvmc_create_context_cookie_t { unsigned int sequence; } xcb_xvmc_create_context_cookie_t; /** Opcode for xcb_xvmc_create_context. */ #define XCB_XVMC_CREATE_CONTEXT 2 /** * @brief xcb_xvmc_create_context_request_t **/ typedef struct xcb_xvmc_create_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xvmc_context_t context_id; xcb_xv_port_t port_id; xcb_xvmc_surface_t surface_id; uint16_t width; uint16_t height; uint32_t flags; } xcb_xvmc_create_context_request_t; /** * @brief xcb_xvmc_create_context_reply_t **/ typedef struct xcb_xvmc_create_context_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t width_actual; uint16_t height_actual; uint32_t flags_return; uint8_t pad1[20]; } xcb_xvmc_create_context_reply_t; /** Opcode for xcb_xvmc_destroy_context. */ #define XCB_XVMC_DESTROY_CONTEXT 3 /** * @brief xcb_xvmc_destroy_context_request_t **/ typedef struct xcb_xvmc_destroy_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xvmc_context_t context_id; } xcb_xvmc_destroy_context_request_t; /** * @brief xcb_xvmc_create_surface_cookie_t **/ typedef struct xcb_xvmc_create_surface_cookie_t { unsigned int sequence; } xcb_xvmc_create_surface_cookie_t; /** Opcode for xcb_xvmc_create_surface. */ #define XCB_XVMC_CREATE_SURFACE 4 /** * @brief xcb_xvmc_create_surface_request_t **/ typedef struct xcb_xvmc_create_surface_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xvmc_surface_t surface_id; xcb_xvmc_context_t context_id; } xcb_xvmc_create_surface_request_t; /** * @brief xcb_xvmc_create_surface_reply_t **/ typedef struct xcb_xvmc_create_surface_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pad1[24]; } xcb_xvmc_create_surface_reply_t; /** Opcode for xcb_xvmc_destroy_surface. */ #define XCB_XVMC_DESTROY_SURFACE 5 /** * @brief xcb_xvmc_destroy_surface_request_t **/ typedef struct xcb_xvmc_destroy_surface_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xvmc_surface_t surface_id; } xcb_xvmc_destroy_surface_request_t; /** * @brief xcb_xvmc_create_subpicture_cookie_t **/ typedef struct xcb_xvmc_create_subpicture_cookie_t { unsigned int sequence; } xcb_xvmc_create_subpicture_cookie_t; /** Opcode for xcb_xvmc_create_subpicture. */ #define XCB_XVMC_CREATE_SUBPICTURE 6 /** * @brief xcb_xvmc_create_subpicture_request_t **/ typedef struct xcb_xvmc_create_subpicture_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xvmc_subpicture_t subpicture_id; xcb_xvmc_context_t context; uint32_t xvimage_id; uint16_t width; uint16_t height; } xcb_xvmc_create_subpicture_request_t; /** * @brief xcb_xvmc_create_subpicture_reply_t **/ typedef struct xcb_xvmc_create_subpicture_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t width_actual; uint16_t height_actual; uint16_t num_palette_entries; uint16_t entry_bytes; uint8_t component_order[4]; uint8_t pad1[12]; } xcb_xvmc_create_subpicture_reply_t; /** Opcode for xcb_xvmc_destroy_subpicture. */ #define XCB_XVMC_DESTROY_SUBPICTURE 7 /** * @brief xcb_xvmc_destroy_subpicture_request_t **/ typedef struct xcb_xvmc_destroy_subpicture_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xvmc_subpicture_t subpicture_id; } xcb_xvmc_destroy_subpicture_request_t; /** * @brief xcb_xvmc_list_subpicture_types_cookie_t **/ typedef struct xcb_xvmc_list_subpicture_types_cookie_t { unsigned int sequence; } xcb_xvmc_list_subpicture_types_cookie_t; /** Opcode for xcb_xvmc_list_subpicture_types. */ #define XCB_XVMC_LIST_SUBPICTURE_TYPES 8 /** * @brief xcb_xvmc_list_subpicture_types_request_t **/ typedef struct xcb_xvmc_list_subpicture_types_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xv_port_t port_id; xcb_xvmc_surface_t surface_id; } xcb_xvmc_list_subpicture_types_request_t; /** * @brief xcb_xvmc_list_subpicture_types_reply_t **/ typedef struct xcb_xvmc_list_subpicture_types_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t num; uint8_t pad1[20]; } xcb_xvmc_list_subpicture_types_reply_t; /** * Get the next element of the iterator * @param i Pointer to a xcb_xvmc_context_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xvmc_context_t) */ void xcb_xvmc_context_next (xcb_xvmc_context_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xvmc_context_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xvmc_context_end (xcb_xvmc_context_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xvmc_surface_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xvmc_surface_t) */ void xcb_xvmc_surface_next (xcb_xvmc_surface_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xvmc_surface_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xvmc_surface_end (xcb_xvmc_surface_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xvmc_subpicture_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xvmc_subpicture_t) */ void xcb_xvmc_subpicture_next (xcb_xvmc_subpicture_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xvmc_subpicture_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xvmc_subpicture_end (xcb_xvmc_subpicture_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xvmc_surface_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xvmc_surface_info_t) */ void xcb_xvmc_surface_info_next (xcb_xvmc_surface_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xvmc_surface_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xvmc_surface_info_end (xcb_xvmc_surface_info_iterator_t i); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xvmc_query_version_cookie_t xcb_xvmc_query_version (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xvmc_query_version_cookie_t xcb_xvmc_query_version_unchecked (xcb_connection_t *c); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xvmc_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xvmc_query_version_reply_t * xcb_xvmc_query_version_reply (xcb_connection_t *c, xcb_xvmc_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xvmc_list_surface_types_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xvmc_list_surface_types_cookie_t xcb_xvmc_list_surface_types (xcb_connection_t *c, xcb_xv_port_t port_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xvmc_list_surface_types_cookie_t xcb_xvmc_list_surface_types_unchecked (xcb_connection_t *c, xcb_xv_port_t port_id); xcb_xvmc_surface_info_t * xcb_xvmc_list_surface_types_surfaces (const xcb_xvmc_list_surface_types_reply_t *R); int xcb_xvmc_list_surface_types_surfaces_length (const xcb_xvmc_list_surface_types_reply_t *R); xcb_xvmc_surface_info_iterator_t xcb_xvmc_list_surface_types_surfaces_iterator (const xcb_xvmc_list_surface_types_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xvmc_list_surface_types_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xvmc_list_surface_types_reply_t * xcb_xvmc_list_surface_types_reply (xcb_connection_t *c, xcb_xvmc_list_surface_types_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xvmc_create_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xvmc_create_context_cookie_t xcb_xvmc_create_context (xcb_connection_t *c, xcb_xvmc_context_t context_id, xcb_xv_port_t port_id, xcb_xvmc_surface_t surface_id, uint16_t width, uint16_t height, uint32_t flags); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xvmc_create_context_cookie_t xcb_xvmc_create_context_unchecked (xcb_connection_t *c, xcb_xvmc_context_t context_id, xcb_xv_port_t port_id, xcb_xvmc_surface_t surface_id, uint16_t width, uint16_t height, uint32_t flags); uint32_t * xcb_xvmc_create_context_priv_data (const xcb_xvmc_create_context_reply_t *R); int xcb_xvmc_create_context_priv_data_length (const xcb_xvmc_create_context_reply_t *R); xcb_generic_iterator_t xcb_xvmc_create_context_priv_data_end (const xcb_xvmc_create_context_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xvmc_create_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xvmc_create_context_reply_t * xcb_xvmc_create_context_reply (xcb_connection_t *c, xcb_xvmc_create_context_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xvmc_destroy_context_checked (xcb_connection_t *c, xcb_xvmc_context_t context_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xvmc_destroy_context (xcb_connection_t *c, xcb_xvmc_context_t context_id); int xcb_xvmc_create_surface_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xvmc_create_surface_cookie_t xcb_xvmc_create_surface (xcb_connection_t *c, xcb_xvmc_surface_t surface_id, xcb_xvmc_context_t context_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xvmc_create_surface_cookie_t xcb_xvmc_create_surface_unchecked (xcb_connection_t *c, xcb_xvmc_surface_t surface_id, xcb_xvmc_context_t context_id); uint32_t * xcb_xvmc_create_surface_priv_data (const xcb_xvmc_create_surface_reply_t *R); int xcb_xvmc_create_surface_priv_data_length (const xcb_xvmc_create_surface_reply_t *R); xcb_generic_iterator_t xcb_xvmc_create_surface_priv_data_end (const xcb_xvmc_create_surface_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xvmc_create_surface_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xvmc_create_surface_reply_t * xcb_xvmc_create_surface_reply (xcb_connection_t *c, xcb_xvmc_create_surface_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xvmc_destroy_surface_checked (xcb_connection_t *c, xcb_xvmc_surface_t surface_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xvmc_destroy_surface (xcb_connection_t *c, xcb_xvmc_surface_t surface_id); int xcb_xvmc_create_subpicture_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xvmc_create_subpicture_cookie_t xcb_xvmc_create_subpicture (xcb_connection_t *c, xcb_xvmc_subpicture_t subpicture_id, xcb_xvmc_context_t context, uint32_t xvimage_id, uint16_t width, uint16_t height); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xvmc_create_subpicture_cookie_t xcb_xvmc_create_subpicture_unchecked (xcb_connection_t *c, xcb_xvmc_subpicture_t subpicture_id, xcb_xvmc_context_t context, uint32_t xvimage_id, uint16_t width, uint16_t height); uint32_t * xcb_xvmc_create_subpicture_priv_data (const xcb_xvmc_create_subpicture_reply_t *R); int xcb_xvmc_create_subpicture_priv_data_length (const xcb_xvmc_create_subpicture_reply_t *R); xcb_generic_iterator_t xcb_xvmc_create_subpicture_priv_data_end (const xcb_xvmc_create_subpicture_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xvmc_create_subpicture_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xvmc_create_subpicture_reply_t * xcb_xvmc_create_subpicture_reply (xcb_connection_t *c, xcb_xvmc_create_subpicture_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xvmc_destroy_subpicture_checked (xcb_connection_t *c, xcb_xvmc_subpicture_t subpicture_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xvmc_destroy_subpicture (xcb_connection_t *c, xcb_xvmc_subpicture_t subpicture_id); int xcb_xvmc_list_subpicture_types_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xvmc_list_subpicture_types_cookie_t xcb_xvmc_list_subpicture_types (xcb_connection_t *c, xcb_xv_port_t port_id, xcb_xvmc_surface_t surface_id); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xvmc_list_subpicture_types_cookie_t xcb_xvmc_list_subpicture_types_unchecked (xcb_connection_t *c, xcb_xv_port_t port_id, xcb_xvmc_surface_t surface_id); xcb_xv_image_format_info_t * xcb_xvmc_list_subpicture_types_types (const xcb_xvmc_list_subpicture_types_reply_t *R); int xcb_xvmc_list_subpicture_types_types_length (const xcb_xvmc_list_subpicture_types_reply_t *R); xcb_xv_image_format_info_iterator_t xcb_xvmc_list_subpicture_types_types_iterator (const xcb_xvmc_list_subpicture_types_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xvmc_list_subpicture_types_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xvmc_list_subpicture_types_reply_t * xcb_xvmc_list_subpicture_types_reply (xcb_connection_t *c, xcb_xvmc_list_subpicture_types_cookie_t cookie /**< */, xcb_generic_error_t **e); #ifdef __cplusplus } #endif #endif /** * @} */ ����������������������������������������������xcb/dri3.h������������������������������������������������������������������������������������������0000644�����������������00000057261�14763166026�0006360 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from dri3.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_DRI3_API XCB DRI3 API * @brief DRI3 XCB Protocol Implementation. * @{ **/ #ifndef __DRI3_H #define __DRI3_H #include "xcb.h" #include "xproto.h" #ifdef __cplusplus extern "C" { #endif #define XCB_DRI3_MAJOR_VERSION 1 #define XCB_DRI3_MINOR_VERSION 2 extern xcb_extension_t xcb_dri3_id; /** * @brief xcb_dri3_query_version_cookie_t **/ typedef struct xcb_dri3_query_version_cookie_t { unsigned int sequence; } xcb_dri3_query_version_cookie_t; /** Opcode for xcb_dri3_query_version. */ #define XCB_DRI3_QUERY_VERSION 0 /** * @brief xcb_dri3_query_version_request_t **/ typedef struct xcb_dri3_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t major_version; uint32_t minor_version; } xcb_dri3_query_version_request_t; /** * @brief xcb_dri3_query_version_reply_t **/ typedef struct xcb_dri3_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t major_version; uint32_t minor_version; } xcb_dri3_query_version_reply_t; /** * @brief xcb_dri3_open_cookie_t **/ typedef struct xcb_dri3_open_cookie_t { unsigned int sequence; } xcb_dri3_open_cookie_t; /** Opcode for xcb_dri3_open. */ #define XCB_DRI3_OPEN 1 /** * @brief xcb_dri3_open_request_t **/ typedef struct xcb_dri3_open_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; uint32_t provider; } xcb_dri3_open_request_t; /** * @brief xcb_dri3_open_reply_t **/ typedef struct xcb_dri3_open_reply_t { uint8_t response_type; uint8_t nfd; uint16_t sequence; uint32_t length; uint8_t pad0[24]; } xcb_dri3_open_reply_t; /** Opcode for xcb_dri3_pixmap_from_buffer. */ #define XCB_DRI3_PIXMAP_FROM_BUFFER 2 /** * @brief xcb_dri3_pixmap_from_buffer_request_t **/ typedef struct xcb_dri3_pixmap_from_buffer_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_pixmap_t pixmap; xcb_drawable_t drawable; uint32_t size; uint16_t width; uint16_t height; uint16_t stride; uint8_t depth; uint8_t bpp; } xcb_dri3_pixmap_from_buffer_request_t; /** * @brief xcb_dri3_buffer_from_pixmap_cookie_t **/ typedef struct xcb_dri3_buffer_from_pixmap_cookie_t { unsigned int sequence; } xcb_dri3_buffer_from_pixmap_cookie_t; /** Opcode for xcb_dri3_buffer_from_pixmap. */ #define XCB_DRI3_BUFFER_FROM_PIXMAP 3 /** * @brief xcb_dri3_buffer_from_pixmap_request_t **/ typedef struct xcb_dri3_buffer_from_pixmap_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_pixmap_t pixmap; } xcb_dri3_buffer_from_pixmap_request_t; /** * @brief xcb_dri3_buffer_from_pixmap_reply_t **/ typedef struct xcb_dri3_buffer_from_pixmap_reply_t { uint8_t response_type; uint8_t nfd; uint16_t sequence; uint32_t length; uint32_t size; uint16_t width; uint16_t height; uint16_t stride; uint8_t depth; uint8_t bpp; uint8_t pad0[12]; } xcb_dri3_buffer_from_pixmap_reply_t; /** Opcode for xcb_dri3_fence_from_fd. */ #define XCB_DRI3_FENCE_FROM_FD 4 /** * @brief xcb_dri3_fence_from_fd_request_t **/ typedef struct xcb_dri3_fence_from_fd_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; uint32_t fence; uint8_t initially_triggered; uint8_t pad0[3]; } xcb_dri3_fence_from_fd_request_t; /** * @brief xcb_dri3_fd_from_fence_cookie_t **/ typedef struct xcb_dri3_fd_from_fence_cookie_t { unsigned int sequence; } xcb_dri3_fd_from_fence_cookie_t; /** Opcode for xcb_dri3_fd_from_fence. */ #define XCB_DRI3_FD_FROM_FENCE 5 /** * @brief xcb_dri3_fd_from_fence_request_t **/ typedef struct xcb_dri3_fd_from_fence_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; uint32_t fence; } xcb_dri3_fd_from_fence_request_t; /** * @brief xcb_dri3_fd_from_fence_reply_t **/ typedef struct xcb_dri3_fd_from_fence_reply_t { uint8_t response_type; uint8_t nfd; uint16_t sequence; uint32_t length; uint8_t pad0[24]; } xcb_dri3_fd_from_fence_reply_t; /** * @brief xcb_dri3_get_supported_modifiers_cookie_t **/ typedef struct xcb_dri3_get_supported_modifiers_cookie_t { unsigned int sequence; } xcb_dri3_get_supported_modifiers_cookie_t; /** Opcode for xcb_dri3_get_supported_modifiers. */ #define XCB_DRI3_GET_SUPPORTED_MODIFIERS 6 /** * @brief xcb_dri3_get_supported_modifiers_request_t **/ typedef struct xcb_dri3_get_supported_modifiers_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t window; uint8_t depth; uint8_t bpp; uint8_t pad0[2]; } xcb_dri3_get_supported_modifiers_request_t; /** * @brief xcb_dri3_get_supported_modifiers_reply_t **/ typedef struct xcb_dri3_get_supported_modifiers_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t num_window_modifiers; uint32_t num_screen_modifiers; uint8_t pad1[16]; } xcb_dri3_get_supported_modifiers_reply_t; /** Opcode for xcb_dri3_pixmap_from_buffers. */ #define XCB_DRI3_PIXMAP_FROM_BUFFERS 7 /** * @brief xcb_dri3_pixmap_from_buffers_request_t **/ typedef struct xcb_dri3_pixmap_from_buffers_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_pixmap_t pixmap; xcb_window_t window; uint8_t num_buffers; uint8_t pad0[3]; uint16_t width; uint16_t height; uint32_t stride0; uint32_t offset0; uint32_t stride1; uint32_t offset1; uint32_t stride2; uint32_t offset2; uint32_t stride3; uint32_t offset3; uint8_t depth; uint8_t bpp; uint8_t pad1[2]; uint64_t modifier; } xcb_dri3_pixmap_from_buffers_request_t; /** * @brief xcb_dri3_buffers_from_pixmap_cookie_t **/ typedef struct xcb_dri3_buffers_from_pixmap_cookie_t { unsigned int sequence; } xcb_dri3_buffers_from_pixmap_cookie_t; /** Opcode for xcb_dri3_buffers_from_pixmap. */ #define XCB_DRI3_BUFFERS_FROM_PIXMAP 8 /** * @brief xcb_dri3_buffers_from_pixmap_request_t **/ typedef struct xcb_dri3_buffers_from_pixmap_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_pixmap_t pixmap; } xcb_dri3_buffers_from_pixmap_request_t; /** * @brief xcb_dri3_buffers_from_pixmap_reply_t **/ typedef struct xcb_dri3_buffers_from_pixmap_reply_t { uint8_t response_type; uint8_t nfd; uint16_t sequence; uint32_t length; uint16_t width; uint16_t height; uint8_t pad0[4]; uint64_t modifier; uint8_t depth; uint8_t bpp; uint8_t pad1[6]; } xcb_dri3_buffers_from_pixmap_reply_t; /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dri3_query_version_cookie_t xcb_dri3_query_version (xcb_connection_t *c, uint32_t major_version, uint32_t minor_version); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dri3_query_version_cookie_t xcb_dri3_query_version_unchecked (xcb_connection_t *c, uint32_t major_version, uint32_t minor_version); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dri3_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dri3_query_version_reply_t * xcb_dri3_query_version_reply (xcb_connection_t *c, xcb_dri3_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dri3_open_cookie_t xcb_dri3_open (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t provider); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dri3_open_cookie_t xcb_dri3_open_unchecked (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t provider); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dri3_open_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dri3_open_reply_t * xcb_dri3_open_reply (xcb_connection_t *c, xcb_dri3_open_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * Return the reply fds * @param c The connection * @param reply The reply * * Returns the array of reply fds of the request asked by * * The returned value must be freed by the caller using free(). */ int * xcb_dri3_open_reply_fds (xcb_connection_t *c /**< */, xcb_dri3_open_reply_t *reply); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_dri3_pixmap_from_buffer_checked (xcb_connection_t *c, xcb_pixmap_t pixmap, xcb_drawable_t drawable, uint32_t size, uint16_t width, uint16_t height, uint16_t stride, uint8_t depth, uint8_t bpp, int32_t pixmap_fd); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_dri3_pixmap_from_buffer (xcb_connection_t *c, xcb_pixmap_t pixmap, xcb_drawable_t drawable, uint32_t size, uint16_t width, uint16_t height, uint16_t stride, uint8_t depth, uint8_t bpp, int32_t pixmap_fd); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dri3_buffer_from_pixmap_cookie_t xcb_dri3_buffer_from_pixmap (xcb_connection_t *c, xcb_pixmap_t pixmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dri3_buffer_from_pixmap_cookie_t xcb_dri3_buffer_from_pixmap_unchecked (xcb_connection_t *c, xcb_pixmap_t pixmap); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dri3_buffer_from_pixmap_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dri3_buffer_from_pixmap_reply_t * xcb_dri3_buffer_from_pixmap_reply (xcb_connection_t *c, xcb_dri3_buffer_from_pixmap_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * Return the reply fds * @param c The connection * @param reply The reply * * Returns the array of reply fds of the request asked by * * The returned value must be freed by the caller using free(). */ int * xcb_dri3_buffer_from_pixmap_reply_fds (xcb_connection_t *c /**< */, xcb_dri3_buffer_from_pixmap_reply_t *reply); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_dri3_fence_from_fd_checked (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t fence, uint8_t initially_triggered, int32_t fence_fd); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_dri3_fence_from_fd (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t fence, uint8_t initially_triggered, int32_t fence_fd); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dri3_fd_from_fence_cookie_t xcb_dri3_fd_from_fence (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t fence); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dri3_fd_from_fence_cookie_t xcb_dri3_fd_from_fence_unchecked (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t fence); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dri3_fd_from_fence_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dri3_fd_from_fence_reply_t * xcb_dri3_fd_from_fence_reply (xcb_connection_t *c, xcb_dri3_fd_from_fence_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * Return the reply fds * @param c The connection * @param reply The reply * * Returns the array of reply fds of the request asked by * * The returned value must be freed by the caller using free(). */ int * xcb_dri3_fd_from_fence_reply_fds (xcb_connection_t *c /**< */, xcb_dri3_fd_from_fence_reply_t *reply); int xcb_dri3_get_supported_modifiers_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dri3_get_supported_modifiers_cookie_t xcb_dri3_get_supported_modifiers (xcb_connection_t *c, uint32_t window, uint8_t depth, uint8_t bpp); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dri3_get_supported_modifiers_cookie_t xcb_dri3_get_supported_modifiers_unchecked (xcb_connection_t *c, uint32_t window, uint8_t depth, uint8_t bpp); uint64_t * xcb_dri3_get_supported_modifiers_window_modifiers (const xcb_dri3_get_supported_modifiers_reply_t *R); int xcb_dri3_get_supported_modifiers_window_modifiers_length (const xcb_dri3_get_supported_modifiers_reply_t *R); xcb_generic_iterator_t xcb_dri3_get_supported_modifiers_window_modifiers_end (const xcb_dri3_get_supported_modifiers_reply_t *R); uint64_t * xcb_dri3_get_supported_modifiers_screen_modifiers (const xcb_dri3_get_supported_modifiers_reply_t *R); int xcb_dri3_get_supported_modifiers_screen_modifiers_length (const xcb_dri3_get_supported_modifiers_reply_t *R); xcb_generic_iterator_t xcb_dri3_get_supported_modifiers_screen_modifiers_end (const xcb_dri3_get_supported_modifiers_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dri3_get_supported_modifiers_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dri3_get_supported_modifiers_reply_t * xcb_dri3_get_supported_modifiers_reply (xcb_connection_t *c, xcb_dri3_get_supported_modifiers_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_dri3_pixmap_from_buffers_checked (xcb_connection_t *c, xcb_pixmap_t pixmap, xcb_window_t window, uint8_t num_buffers, uint16_t width, uint16_t height, uint32_t stride0, uint32_t offset0, uint32_t stride1, uint32_t offset1, uint32_t stride2, uint32_t offset2, uint32_t stride3, uint32_t offset3, uint8_t depth, uint8_t bpp, uint64_t modifier, const int32_t *buffers); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_dri3_pixmap_from_buffers (xcb_connection_t *c, xcb_pixmap_t pixmap, xcb_window_t window, uint8_t num_buffers, uint16_t width, uint16_t height, uint32_t stride0, uint32_t offset0, uint32_t stride1, uint32_t offset1, uint32_t stride2, uint32_t offset2, uint32_t stride3, uint32_t offset3, uint8_t depth, uint8_t bpp, uint64_t modifier, const int32_t *buffers); int xcb_dri3_buffers_from_pixmap_sizeof (const void *_buffer, int32_t buffers); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_dri3_buffers_from_pixmap_cookie_t xcb_dri3_buffers_from_pixmap (xcb_connection_t *c, xcb_pixmap_t pixmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_dri3_buffers_from_pixmap_cookie_t xcb_dri3_buffers_from_pixmap_unchecked (xcb_connection_t *c, xcb_pixmap_t pixmap); uint32_t * xcb_dri3_buffers_from_pixmap_strides (const xcb_dri3_buffers_from_pixmap_reply_t *R); int xcb_dri3_buffers_from_pixmap_strides_length (const xcb_dri3_buffers_from_pixmap_reply_t *R); xcb_generic_iterator_t xcb_dri3_buffers_from_pixmap_strides_end (const xcb_dri3_buffers_from_pixmap_reply_t *R); uint32_t * xcb_dri3_buffers_from_pixmap_offsets (const xcb_dri3_buffers_from_pixmap_reply_t *R); int xcb_dri3_buffers_from_pixmap_offsets_length (const xcb_dri3_buffers_from_pixmap_reply_t *R); xcb_generic_iterator_t xcb_dri3_buffers_from_pixmap_offsets_end (const xcb_dri3_buffers_from_pixmap_reply_t *R); int32_t * xcb_dri3_buffers_from_pixmap_buffers (const xcb_dri3_buffers_from_pixmap_reply_t *R); int xcb_dri3_buffers_from_pixmap_buffers_length (const xcb_dri3_buffers_from_pixmap_reply_t *R); xcb_generic_iterator_t xcb_dri3_buffers_from_pixmap_buffers_end (const xcb_dri3_buffers_from_pixmap_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_dri3_buffers_from_pixmap_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_dri3_buffers_from_pixmap_reply_t * xcb_dri3_buffers_from_pixmap_reply (xcb_connection_t *c, xcb_dri3_buffers_from_pixmap_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * Return the reply fds * @param c The connection * @param reply The reply * * Returns the array of reply fds of the request asked by * * The returned value must be freed by the caller using free(). */ int * xcb_dri3_buffers_from_pixmap_reply_fds (xcb_connection_t *c /**< */, xcb_dri3_buffers_from_pixmap_reply_t *reply); #ifdef __cplusplus } #endif #endif /** * @} */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/xproto.h����������������������������������������������������������������������������������������0000644�����������������00001361410�14763166026�0007045 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from xproto.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB__API XCB API * @brief XCB Protocol Implementation. * @{ **/ #ifndef __XPROTO_H #define __XPROTO_H #include "xcb.h" #ifdef __cplusplus extern "C" { #endif /** * @brief xcb_char2b_t **/ typedef struct xcb_char2b_t { uint8_t byte1; uint8_t byte2; } xcb_char2b_t; /** * @brief xcb_char2b_iterator_t **/ typedef struct xcb_char2b_iterator_t { xcb_char2b_t *data; int rem; int index; } xcb_char2b_iterator_t; typedef uint32_t xcb_window_t; /** * @brief xcb_window_iterator_t **/ typedef struct xcb_window_iterator_t { xcb_window_t *data; int rem; int index; } xcb_window_iterator_t; typedef uint32_t xcb_pixmap_t; /** * @brief xcb_pixmap_iterator_t **/ typedef struct xcb_pixmap_iterator_t { xcb_pixmap_t *data; int rem; int index; } xcb_pixmap_iterator_t; typedef uint32_t xcb_cursor_t; /** * @brief xcb_cursor_iterator_t **/ typedef struct xcb_cursor_iterator_t { xcb_cursor_t *data; int rem; int index; } xcb_cursor_iterator_t; typedef uint32_t xcb_font_t; /** * @brief xcb_font_iterator_t **/ typedef struct xcb_font_iterator_t { xcb_font_t *data; int rem; int index; } xcb_font_iterator_t; typedef uint32_t xcb_gcontext_t; /** * @brief xcb_gcontext_iterator_t **/ typedef struct xcb_gcontext_iterator_t { xcb_gcontext_t *data; int rem; int index; } xcb_gcontext_iterator_t; typedef uint32_t xcb_colormap_t; /** * @brief xcb_colormap_iterator_t **/ typedef struct xcb_colormap_iterator_t { xcb_colormap_t *data; int rem; int index; } xcb_colormap_iterator_t; typedef uint32_t xcb_atom_t; /** * @brief xcb_atom_iterator_t **/ typedef struct xcb_atom_iterator_t { xcb_atom_t *data; int rem; int index; } xcb_atom_iterator_t; typedef uint32_t xcb_drawable_t; /** * @brief xcb_drawable_iterator_t **/ typedef struct xcb_drawable_iterator_t { xcb_drawable_t *data; int rem; int index; } xcb_drawable_iterator_t; typedef uint32_t xcb_fontable_t; /** * @brief xcb_fontable_iterator_t **/ typedef struct xcb_fontable_iterator_t { xcb_fontable_t *data; int rem; int index; } xcb_fontable_iterator_t; typedef uint32_t xcb_bool32_t; /** * @brief xcb_bool32_iterator_t **/ typedef struct xcb_bool32_iterator_t { xcb_bool32_t *data; int rem; int index; } xcb_bool32_iterator_t; typedef uint32_t xcb_visualid_t; /** * @brief xcb_visualid_iterator_t **/ typedef struct xcb_visualid_iterator_t { xcb_visualid_t *data; int rem; int index; } xcb_visualid_iterator_t; typedef uint32_t xcb_timestamp_t; /** * @brief xcb_timestamp_iterator_t **/ typedef struct xcb_timestamp_iterator_t { xcb_timestamp_t *data; int rem; int index; } xcb_timestamp_iterator_t; typedef uint32_t xcb_keysym_t; /** * @brief xcb_keysym_iterator_t **/ typedef struct xcb_keysym_iterator_t { xcb_keysym_t *data; int rem; int index; } xcb_keysym_iterator_t; typedef uint8_t xcb_keycode_t; /** * @brief xcb_keycode_iterator_t **/ typedef struct xcb_keycode_iterator_t { xcb_keycode_t *data; int rem; int index; } xcb_keycode_iterator_t; typedef uint32_t xcb_keycode32_t; /** * @brief xcb_keycode32_iterator_t **/ typedef struct xcb_keycode32_iterator_t { xcb_keycode32_t *data; int rem; int index; } xcb_keycode32_iterator_t; typedef uint8_t xcb_button_t; /** * @brief xcb_button_iterator_t **/ typedef struct xcb_button_iterator_t { xcb_button_t *data; int rem; int index; } xcb_button_iterator_t; /** * @brief xcb_point_t **/ typedef struct xcb_point_t { int16_t x; int16_t y; } xcb_point_t; /** * @brief xcb_point_iterator_t **/ typedef struct xcb_point_iterator_t { xcb_point_t *data; int rem; int index; } xcb_point_iterator_t; /** * @brief xcb_rectangle_t **/ typedef struct xcb_rectangle_t { int16_t x; int16_t y; uint16_t width; uint16_t height; } xcb_rectangle_t; /** * @brief xcb_rectangle_iterator_t **/ typedef struct xcb_rectangle_iterator_t { xcb_rectangle_t *data; int rem; int index; } xcb_rectangle_iterator_t; /** * @brief xcb_arc_t **/ typedef struct xcb_arc_t { int16_t x; int16_t y; uint16_t width; uint16_t height; int16_t angle1; int16_t angle2; } xcb_arc_t; /** * @brief xcb_arc_iterator_t **/ typedef struct xcb_arc_iterator_t { xcb_arc_t *data; int rem; int index; } xcb_arc_iterator_t; /** * @brief xcb_format_t **/ typedef struct xcb_format_t { uint8_t depth; uint8_t bits_per_pixel; uint8_t scanline_pad; uint8_t pad0[5]; } xcb_format_t; /** * @brief xcb_format_iterator_t **/ typedef struct xcb_format_iterator_t { xcb_format_t *data; int rem; int index; } xcb_format_iterator_t; typedef enum xcb_visual_class_t { XCB_VISUAL_CLASS_STATIC_GRAY = 0, XCB_VISUAL_CLASS_GRAY_SCALE = 1, XCB_VISUAL_CLASS_STATIC_COLOR = 2, XCB_VISUAL_CLASS_PSEUDO_COLOR = 3, XCB_VISUAL_CLASS_TRUE_COLOR = 4, XCB_VISUAL_CLASS_DIRECT_COLOR = 5 } xcb_visual_class_t; /** * @brief xcb_visualtype_t **/ typedef struct xcb_visualtype_t { xcb_visualid_t visual_id; uint8_t _class; uint8_t bits_per_rgb_value; uint16_t colormap_entries; uint32_t red_mask; uint32_t green_mask; uint32_t blue_mask; uint8_t pad0[4]; } xcb_visualtype_t; /** * @brief xcb_visualtype_iterator_t **/ typedef struct xcb_visualtype_iterator_t { xcb_visualtype_t *data; int rem; int index; } xcb_visualtype_iterator_t; /** * @brief xcb_depth_t **/ typedef struct xcb_depth_t { uint8_t depth; uint8_t pad0; uint16_t visuals_len; uint8_t pad1[4]; } xcb_depth_t; /** * @brief xcb_depth_iterator_t **/ typedef struct xcb_depth_iterator_t { xcb_depth_t *data; int rem; int index; } xcb_depth_iterator_t; typedef enum xcb_event_mask_t { XCB_EVENT_MASK_NO_EVENT = 0, XCB_EVENT_MASK_KEY_PRESS = 1, XCB_EVENT_MASK_KEY_RELEASE = 2, XCB_EVENT_MASK_BUTTON_PRESS = 4, XCB_EVENT_MASK_BUTTON_RELEASE = 8, XCB_EVENT_MASK_ENTER_WINDOW = 16, XCB_EVENT_MASK_LEAVE_WINDOW = 32, XCB_EVENT_MASK_POINTER_MOTION = 64, XCB_EVENT_MASK_POINTER_MOTION_HINT = 128, XCB_EVENT_MASK_BUTTON_1_MOTION = 256, XCB_EVENT_MASK_BUTTON_2_MOTION = 512, XCB_EVENT_MASK_BUTTON_3_MOTION = 1024, XCB_EVENT_MASK_BUTTON_4_MOTION = 2048, XCB_EVENT_MASK_BUTTON_5_MOTION = 4096, XCB_EVENT_MASK_BUTTON_MOTION = 8192, XCB_EVENT_MASK_KEYMAP_STATE = 16384, XCB_EVENT_MASK_EXPOSURE = 32768, XCB_EVENT_MASK_VISIBILITY_CHANGE = 65536, XCB_EVENT_MASK_STRUCTURE_NOTIFY = 131072, XCB_EVENT_MASK_RESIZE_REDIRECT = 262144, XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY = 524288, XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT = 1048576, XCB_EVENT_MASK_FOCUS_CHANGE = 2097152, XCB_EVENT_MASK_PROPERTY_CHANGE = 4194304, XCB_EVENT_MASK_COLOR_MAP_CHANGE = 8388608, XCB_EVENT_MASK_OWNER_GRAB_BUTTON = 16777216 } xcb_event_mask_t; typedef enum xcb_backing_store_t { XCB_BACKING_STORE_NOT_USEFUL = 0, XCB_BACKING_STORE_WHEN_MAPPED = 1, XCB_BACKING_STORE_ALWAYS = 2 } xcb_backing_store_t; /** * @brief xcb_screen_t **/ typedef struct xcb_screen_t { xcb_window_t root; xcb_colormap_t default_colormap; uint32_t white_pixel; uint32_t black_pixel; uint32_t current_input_masks; uint16_t width_in_pixels; uint16_t height_in_pixels; uint16_t width_in_millimeters; uint16_t height_in_millimeters; uint16_t min_installed_maps; uint16_t max_installed_maps; xcb_visualid_t root_visual; uint8_t backing_stores; uint8_t save_unders; uint8_t root_depth; uint8_t allowed_depths_len; } xcb_screen_t; /** * @brief xcb_screen_iterator_t **/ typedef struct xcb_screen_iterator_t { xcb_screen_t *data; int rem; int index; } xcb_screen_iterator_t; /** * @brief xcb_setup_request_t **/ typedef struct xcb_setup_request_t { uint8_t byte_order; uint8_t pad0; uint16_t protocol_major_version; uint16_t protocol_minor_version; uint16_t authorization_protocol_name_len; uint16_t authorization_protocol_data_len; uint8_t pad1[2]; } xcb_setup_request_t; /** * @brief xcb_setup_request_iterator_t **/ typedef struct xcb_setup_request_iterator_t { xcb_setup_request_t *data; int rem; int index; } xcb_setup_request_iterator_t; /** * @brief xcb_setup_failed_t **/ typedef struct xcb_setup_failed_t { uint8_t status; uint8_t reason_len; uint16_t protocol_major_version; uint16_t protocol_minor_version; uint16_t length; } xcb_setup_failed_t; /** * @brief xcb_setup_failed_iterator_t **/ typedef struct xcb_setup_failed_iterator_t { xcb_setup_failed_t *data; int rem; int index; } xcb_setup_failed_iterator_t; /** * @brief xcb_setup_authenticate_t **/ typedef struct xcb_setup_authenticate_t { uint8_t status; uint8_t pad0[5]; uint16_t length; } xcb_setup_authenticate_t; /** * @brief xcb_setup_authenticate_iterator_t **/ typedef struct xcb_setup_authenticate_iterator_t { xcb_setup_authenticate_t *data; int rem; int index; } xcb_setup_authenticate_iterator_t; typedef enum xcb_image_order_t { XCB_IMAGE_ORDER_LSB_FIRST = 0, XCB_IMAGE_ORDER_MSB_FIRST = 1 } xcb_image_order_t; /** * @brief xcb_setup_t **/ typedef struct xcb_setup_t { uint8_t status; uint8_t pad0; uint16_t protocol_major_version; uint16_t protocol_minor_version; uint16_t length; uint32_t release_number; uint32_t resource_id_base; uint32_t resource_id_mask; uint32_t motion_buffer_size; uint16_t vendor_len; uint16_t maximum_request_length; uint8_t roots_len; uint8_t pixmap_formats_len; uint8_t image_byte_order; uint8_t bitmap_format_bit_order; uint8_t bitmap_format_scanline_unit; uint8_t bitmap_format_scanline_pad; xcb_keycode_t min_keycode; xcb_keycode_t max_keycode; uint8_t pad1[4]; } xcb_setup_t; /** * @brief xcb_setup_iterator_t **/ typedef struct xcb_setup_iterator_t { xcb_setup_t *data; int rem; int index; } xcb_setup_iterator_t; typedef enum xcb_mod_mask_t { XCB_MOD_MASK_SHIFT = 1, XCB_MOD_MASK_LOCK = 2, XCB_MOD_MASK_CONTROL = 4, XCB_MOD_MASK_1 = 8, XCB_MOD_MASK_2 = 16, XCB_MOD_MASK_3 = 32, XCB_MOD_MASK_4 = 64, XCB_MOD_MASK_5 = 128, XCB_MOD_MASK_ANY = 32768 } xcb_mod_mask_t; typedef enum xcb_key_but_mask_t { XCB_KEY_BUT_MASK_SHIFT = 1, XCB_KEY_BUT_MASK_LOCK = 2, XCB_KEY_BUT_MASK_CONTROL = 4, XCB_KEY_BUT_MASK_MOD_1 = 8, XCB_KEY_BUT_MASK_MOD_2 = 16, XCB_KEY_BUT_MASK_MOD_3 = 32, XCB_KEY_BUT_MASK_MOD_4 = 64, XCB_KEY_BUT_MASK_MOD_5 = 128, XCB_KEY_BUT_MASK_BUTTON_1 = 256, XCB_KEY_BUT_MASK_BUTTON_2 = 512, XCB_KEY_BUT_MASK_BUTTON_3 = 1024, XCB_KEY_BUT_MASK_BUTTON_4 = 2048, XCB_KEY_BUT_MASK_BUTTON_5 = 4096 } xcb_key_but_mask_t; typedef enum xcb_window_enum_t { XCB_WINDOW_NONE = 0 } xcb_window_enum_t; /** Opcode for xcb_key_press. */ #define XCB_KEY_PRESS 2 /** * @brief xcb_key_press_event_t **/ typedef struct xcb_key_press_event_t { uint8_t response_type; xcb_keycode_t detail; uint16_t sequence; xcb_timestamp_t time; xcb_window_t root; xcb_window_t event; xcb_window_t child; int16_t root_x; int16_t root_y; int16_t event_x; int16_t event_y; uint16_t state; uint8_t same_screen; uint8_t pad0; } xcb_key_press_event_t; /** Opcode for xcb_key_release. */ #define XCB_KEY_RELEASE 3 typedef xcb_key_press_event_t xcb_key_release_event_t; typedef enum xcb_button_mask_t { XCB_BUTTON_MASK_1 = 256, XCB_BUTTON_MASK_2 = 512, XCB_BUTTON_MASK_3 = 1024, XCB_BUTTON_MASK_4 = 2048, XCB_BUTTON_MASK_5 = 4096, XCB_BUTTON_MASK_ANY = 32768 } xcb_button_mask_t; /** Opcode for xcb_button_press. */ #define XCB_BUTTON_PRESS 4 /** * @brief xcb_button_press_event_t **/ typedef struct xcb_button_press_event_t { uint8_t response_type; xcb_button_t detail; uint16_t sequence; xcb_timestamp_t time; xcb_window_t root; xcb_window_t event; xcb_window_t child; int16_t root_x; int16_t root_y; int16_t event_x; int16_t event_y; uint16_t state; uint8_t same_screen; uint8_t pad0; } xcb_button_press_event_t; /** Opcode for xcb_button_release. */ #define XCB_BUTTON_RELEASE 5 typedef xcb_button_press_event_t xcb_button_release_event_t; typedef enum xcb_motion_t { XCB_MOTION_NORMAL = 0, XCB_MOTION_HINT = 1 } xcb_motion_t; /** Opcode for xcb_motion_notify. */ #define XCB_MOTION_NOTIFY 6 /** * @brief xcb_motion_notify_event_t **/ typedef struct xcb_motion_notify_event_t { uint8_t response_type; uint8_t detail; uint16_t sequence; xcb_timestamp_t time; xcb_window_t root; xcb_window_t event; xcb_window_t child; int16_t root_x; int16_t root_y; int16_t event_x; int16_t event_y; uint16_t state; uint8_t same_screen; uint8_t pad0; } xcb_motion_notify_event_t; typedef enum xcb_notify_detail_t { XCB_NOTIFY_DETAIL_ANCESTOR = 0, XCB_NOTIFY_DETAIL_VIRTUAL = 1, XCB_NOTIFY_DETAIL_INFERIOR = 2, XCB_NOTIFY_DETAIL_NONLINEAR = 3, XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL = 4, XCB_NOTIFY_DETAIL_POINTER = 5, XCB_NOTIFY_DETAIL_POINTER_ROOT = 6, XCB_NOTIFY_DETAIL_NONE = 7 } xcb_notify_detail_t; typedef enum xcb_notify_mode_t { XCB_NOTIFY_MODE_NORMAL = 0, XCB_NOTIFY_MODE_GRAB = 1, XCB_NOTIFY_MODE_UNGRAB = 2, XCB_NOTIFY_MODE_WHILE_GRABBED = 3 } xcb_notify_mode_t; /** Opcode for xcb_enter_notify. */ #define XCB_ENTER_NOTIFY 7 /** * @brief xcb_enter_notify_event_t **/ typedef struct xcb_enter_notify_event_t { uint8_t response_type; uint8_t detail; uint16_t sequence; xcb_timestamp_t time; xcb_window_t root; xcb_window_t event; xcb_window_t child; int16_t root_x; int16_t root_y; int16_t event_x; int16_t event_y; uint16_t state; uint8_t mode; uint8_t same_screen_focus; } xcb_enter_notify_event_t; /** Opcode for xcb_leave_notify. */ #define XCB_LEAVE_NOTIFY 8 typedef xcb_enter_notify_event_t xcb_leave_notify_event_t; /** Opcode for xcb_focus_in. */ #define XCB_FOCUS_IN 9 /** * @brief xcb_focus_in_event_t **/ typedef struct xcb_focus_in_event_t { uint8_t response_type; uint8_t detail; uint16_t sequence; xcb_window_t event; uint8_t mode; uint8_t pad0[3]; } xcb_focus_in_event_t; /** Opcode for xcb_focus_out. */ #define XCB_FOCUS_OUT 10 typedef xcb_focus_in_event_t xcb_focus_out_event_t; /** Opcode for xcb_keymap_notify. */ #define XCB_KEYMAP_NOTIFY 11 /** * @brief xcb_keymap_notify_event_t **/ typedef struct xcb_keymap_notify_event_t { uint8_t response_type; uint8_t keys[31]; } xcb_keymap_notify_event_t; /** Opcode for xcb_expose. */ #define XCB_EXPOSE 12 /** * @brief xcb_expose_event_t **/ typedef struct xcb_expose_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_window_t window; uint16_t x; uint16_t y; uint16_t width; uint16_t height; uint16_t count; uint8_t pad1[2]; } xcb_expose_event_t; /** Opcode for xcb_graphics_exposure. */ #define XCB_GRAPHICS_EXPOSURE 13 /** * @brief xcb_graphics_exposure_event_t **/ typedef struct xcb_graphics_exposure_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_drawable_t drawable; uint16_t x; uint16_t y; uint16_t width; uint16_t height; uint16_t minor_opcode; uint16_t count; uint8_t major_opcode; uint8_t pad1[3]; } xcb_graphics_exposure_event_t; /** Opcode for xcb_no_exposure. */ #define XCB_NO_EXPOSURE 14 /** * @brief xcb_no_exposure_event_t **/ typedef struct xcb_no_exposure_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_drawable_t drawable; uint16_t minor_opcode; uint8_t major_opcode; uint8_t pad1; } xcb_no_exposure_event_t; typedef enum xcb_visibility_t { XCB_VISIBILITY_UNOBSCURED = 0, XCB_VISIBILITY_PARTIALLY_OBSCURED = 1, XCB_VISIBILITY_FULLY_OBSCURED = 2 } xcb_visibility_t; /** Opcode for xcb_visibility_notify. */ #define XCB_VISIBILITY_NOTIFY 15 /** * @brief xcb_visibility_notify_event_t **/ typedef struct xcb_visibility_notify_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_window_t window; uint8_t state; uint8_t pad1[3]; } xcb_visibility_notify_event_t; /** Opcode for xcb_create_notify. */ #define XCB_CREATE_NOTIFY 16 /** * @brief xcb_create_notify_event_t **/ typedef struct xcb_create_notify_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_window_t parent; xcb_window_t window; int16_t x; int16_t y; uint16_t width; uint16_t height; uint16_t border_width; uint8_t override_redirect; uint8_t pad1; } xcb_create_notify_event_t; /** Opcode for xcb_destroy_notify. */ #define XCB_DESTROY_NOTIFY 17 /** * @brief xcb_destroy_notify_event_t **/ typedef struct xcb_destroy_notify_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_window_t event; xcb_window_t window; } xcb_destroy_notify_event_t; /** Opcode for xcb_unmap_notify. */ #define XCB_UNMAP_NOTIFY 18 /** * @brief xcb_unmap_notify_event_t **/ typedef struct xcb_unmap_notify_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_window_t event; xcb_window_t window; uint8_t from_configure; uint8_t pad1[3]; } xcb_unmap_notify_event_t; /** Opcode for xcb_map_notify. */ #define XCB_MAP_NOTIFY 19 /** * @brief xcb_map_notify_event_t **/ typedef struct xcb_map_notify_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_window_t event; xcb_window_t window; uint8_t override_redirect; uint8_t pad1[3]; } xcb_map_notify_event_t; /** Opcode for xcb_map_request. */ #define XCB_MAP_REQUEST 20 /** * @brief xcb_map_request_event_t **/ typedef struct xcb_map_request_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_window_t parent; xcb_window_t window; } xcb_map_request_event_t; /** Opcode for xcb_reparent_notify. */ #define XCB_REPARENT_NOTIFY 21 /** * @brief xcb_reparent_notify_event_t **/ typedef struct xcb_reparent_notify_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_window_t event; xcb_window_t window; xcb_window_t parent; int16_t x; int16_t y; uint8_t override_redirect; uint8_t pad1[3]; } xcb_reparent_notify_event_t; /** Opcode for xcb_configure_notify. */ #define XCB_CONFIGURE_NOTIFY 22 /** * @brief xcb_configure_notify_event_t **/ typedef struct xcb_configure_notify_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_window_t event; xcb_window_t window; xcb_window_t above_sibling; int16_t x; int16_t y; uint16_t width; uint16_t height; uint16_t border_width; uint8_t override_redirect; uint8_t pad1; } xcb_configure_notify_event_t; /** Opcode for xcb_configure_request. */ #define XCB_CONFIGURE_REQUEST 23 /** * @brief xcb_configure_request_event_t **/ typedef struct xcb_configure_request_event_t { uint8_t response_type; uint8_t stack_mode; uint16_t sequence; xcb_window_t parent; xcb_window_t window; xcb_window_t sibling; int16_t x; int16_t y; uint16_t width; uint16_t height; uint16_t border_width; uint16_t value_mask; } xcb_configure_request_event_t; /** Opcode for xcb_gravity_notify. */ #define XCB_GRAVITY_NOTIFY 24 /** * @brief xcb_gravity_notify_event_t **/ typedef struct xcb_gravity_notify_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_window_t event; xcb_window_t window; int16_t x; int16_t y; } xcb_gravity_notify_event_t; /** Opcode for xcb_resize_request. */ #define XCB_RESIZE_REQUEST 25 /** * @brief xcb_resize_request_event_t **/ typedef struct xcb_resize_request_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_window_t window; uint16_t width; uint16_t height; } xcb_resize_request_event_t; typedef enum xcb_place_t { XCB_PLACE_ON_TOP = 0, /**< The window is now on top of all siblings. */ XCB_PLACE_ON_BOTTOM = 1 /**< The window is now below all siblings. */ } xcb_place_t; /** Opcode for xcb_circulate_notify. */ #define XCB_CIRCULATE_NOTIFY 26 /** * @brief xcb_circulate_notify_event_t **/ typedef struct xcb_circulate_notify_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_window_t event; xcb_window_t window; uint8_t pad1[4]; uint8_t place; uint8_t pad2[3]; } xcb_circulate_notify_event_t; /** Opcode for xcb_circulate_request. */ #define XCB_CIRCULATE_REQUEST 27 typedef xcb_circulate_notify_event_t xcb_circulate_request_event_t; typedef enum xcb_property_t { XCB_PROPERTY_NEW_VALUE = 0, XCB_PROPERTY_DELETE = 1 } xcb_property_t; /** Opcode for xcb_property_notify. */ #define XCB_PROPERTY_NOTIFY 28 /** * @brief xcb_property_notify_event_t **/ typedef struct xcb_property_notify_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_window_t window; xcb_atom_t atom; xcb_timestamp_t time; uint8_t state; uint8_t pad1[3]; } xcb_property_notify_event_t; /** Opcode for xcb_selection_clear. */ #define XCB_SELECTION_CLEAR 29 /** * @brief xcb_selection_clear_event_t **/ typedef struct xcb_selection_clear_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_timestamp_t time; xcb_window_t owner; xcb_atom_t selection; } xcb_selection_clear_event_t; typedef enum xcb_time_t { XCB_TIME_CURRENT_TIME = 0 } xcb_time_t; typedef enum xcb_atom_enum_t { XCB_ATOM_NONE = 0, XCB_ATOM_ANY = 0, XCB_ATOM_PRIMARY = 1, XCB_ATOM_SECONDARY = 2, XCB_ATOM_ARC = 3, XCB_ATOM_ATOM = 4, XCB_ATOM_BITMAP = 5, XCB_ATOM_CARDINAL = 6, XCB_ATOM_COLORMAP = 7, XCB_ATOM_CURSOR = 8, XCB_ATOM_CUT_BUFFER0 = 9, XCB_ATOM_CUT_BUFFER1 = 10, XCB_ATOM_CUT_BUFFER2 = 11, XCB_ATOM_CUT_BUFFER3 = 12, XCB_ATOM_CUT_BUFFER4 = 13, XCB_ATOM_CUT_BUFFER5 = 14, XCB_ATOM_CUT_BUFFER6 = 15, XCB_ATOM_CUT_BUFFER7 = 16, XCB_ATOM_DRAWABLE = 17, XCB_ATOM_FONT = 18, XCB_ATOM_INTEGER = 19, XCB_ATOM_PIXMAP = 20, XCB_ATOM_POINT = 21, XCB_ATOM_RECTANGLE = 22, XCB_ATOM_RESOURCE_MANAGER = 23, XCB_ATOM_RGB_COLOR_MAP = 24, XCB_ATOM_RGB_BEST_MAP = 25, XCB_ATOM_RGB_BLUE_MAP = 26, XCB_ATOM_RGB_DEFAULT_MAP = 27, XCB_ATOM_RGB_GRAY_MAP = 28, XCB_ATOM_RGB_GREEN_MAP = 29, XCB_ATOM_RGB_RED_MAP = 30, XCB_ATOM_STRING = 31, XCB_ATOM_VISUALID = 32, XCB_ATOM_WINDOW = 33, XCB_ATOM_WM_COMMAND = 34, XCB_ATOM_WM_HINTS = 35, XCB_ATOM_WM_CLIENT_MACHINE = 36, XCB_ATOM_WM_ICON_NAME = 37, XCB_ATOM_WM_ICON_SIZE = 38, XCB_ATOM_WM_NAME = 39, XCB_ATOM_WM_NORMAL_HINTS = 40, XCB_ATOM_WM_SIZE_HINTS = 41, XCB_ATOM_WM_ZOOM_HINTS = 42, XCB_ATOM_MIN_SPACE = 43, XCB_ATOM_NORM_SPACE = 44, XCB_ATOM_MAX_SPACE = 45, XCB_ATOM_END_SPACE = 46, XCB_ATOM_SUPERSCRIPT_X = 47, XCB_ATOM_SUPERSCRIPT_Y = 48, XCB_ATOM_SUBSCRIPT_X = 49, XCB_ATOM_SUBSCRIPT_Y = 50, XCB_ATOM_UNDERLINE_POSITION = 51, XCB_ATOM_UNDERLINE_THICKNESS = 52, XCB_ATOM_STRIKEOUT_ASCENT = 53, XCB_ATOM_STRIKEOUT_DESCENT = 54, XCB_ATOM_ITALIC_ANGLE = 55, XCB_ATOM_X_HEIGHT = 56, XCB_ATOM_QUAD_WIDTH = 57, XCB_ATOM_WEIGHT = 58, XCB_ATOM_POINT_SIZE = 59, XCB_ATOM_RESOLUTION = 60, XCB_ATOM_COPYRIGHT = 61, XCB_ATOM_NOTICE = 62, XCB_ATOM_FONT_NAME = 63, XCB_ATOM_FAMILY_NAME = 64, XCB_ATOM_FULL_NAME = 65, XCB_ATOM_CAP_HEIGHT = 66, XCB_ATOM_WM_CLASS = 67, XCB_ATOM_WM_TRANSIENT_FOR = 68 } xcb_atom_enum_t; /** Opcode for xcb_selection_request. */ #define XCB_SELECTION_REQUEST 30 /** * @brief xcb_selection_request_event_t **/ typedef struct xcb_selection_request_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_timestamp_t time; xcb_window_t owner; xcb_window_t requestor; xcb_atom_t selection; xcb_atom_t target; xcb_atom_t property; } xcb_selection_request_event_t; /** Opcode for xcb_selection_notify. */ #define XCB_SELECTION_NOTIFY 31 /** * @brief xcb_selection_notify_event_t **/ typedef struct xcb_selection_notify_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_timestamp_t time; xcb_window_t requestor; xcb_atom_t selection; xcb_atom_t target; xcb_atom_t property; } xcb_selection_notify_event_t; typedef enum xcb_colormap_state_t { XCB_COLORMAP_STATE_UNINSTALLED = 0, /**< The colormap was uninstalled. */ XCB_COLORMAP_STATE_INSTALLED = 1 /**< The colormap was installed. */ } xcb_colormap_state_t; typedef enum xcb_colormap_enum_t { XCB_COLORMAP_NONE = 0 } xcb_colormap_enum_t; /** Opcode for xcb_colormap_notify. */ #define XCB_COLORMAP_NOTIFY 32 /** * @brief xcb_colormap_notify_event_t **/ typedef struct xcb_colormap_notify_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_window_t window; xcb_colormap_t colormap; uint8_t _new; uint8_t state; uint8_t pad1[2]; } xcb_colormap_notify_event_t; /** * @brief xcb_client_message_data_t **/ typedef union xcb_client_message_data_t { uint8_t data8[20]; uint16_t data16[10]; uint32_t data32[5]; } xcb_client_message_data_t; /** * @brief xcb_client_message_data_iterator_t **/ typedef struct xcb_client_message_data_iterator_t { xcb_client_message_data_t *data; int rem; int index; } xcb_client_message_data_iterator_t; /** Opcode for xcb_client_message. */ #define XCB_CLIENT_MESSAGE 33 /** * @brief xcb_client_message_event_t **/ typedef struct xcb_client_message_event_t { uint8_t response_type; uint8_t format; uint16_t sequence; xcb_window_t window; xcb_atom_t type; xcb_client_message_data_t data; } xcb_client_message_event_t; typedef enum xcb_mapping_t { XCB_MAPPING_MODIFIER = 0, XCB_MAPPING_KEYBOARD = 1, XCB_MAPPING_POINTER = 2 } xcb_mapping_t; /** Opcode for xcb_mapping_notify. */ #define XCB_MAPPING_NOTIFY 34 /** * @brief xcb_mapping_notify_event_t **/ typedef struct xcb_mapping_notify_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint8_t request; xcb_keycode_t first_keycode; uint8_t count; uint8_t pad1; } xcb_mapping_notify_event_t; /** Opcode for xcb_ge_generic. */ #define XCB_GE_GENERIC 35 /** * @brief xcb_ge_generic_event_t **/ typedef struct xcb_ge_generic_event_t { uint8_t response_type; uint8_t extension; uint16_t sequence; uint32_t length; uint16_t event_type; uint8_t pad0[22]; uint32_t full_sequence; } xcb_ge_generic_event_t; /** Opcode for xcb_request. */ #define XCB_REQUEST 1 /** * @brief xcb_request_error_t **/ typedef struct xcb_request_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; uint32_t bad_value; uint16_t minor_opcode; uint8_t major_opcode; uint8_t pad0; } xcb_request_error_t; /** Opcode for xcb_value. */ #define XCB_VALUE 2 /** * @brief xcb_value_error_t **/ typedef struct xcb_value_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; uint32_t bad_value; uint16_t minor_opcode; uint8_t major_opcode; uint8_t pad0; } xcb_value_error_t; /** Opcode for xcb_window. */ #define XCB_WINDOW 3 typedef xcb_value_error_t xcb_window_error_t; /** Opcode for xcb_pixmap. */ #define XCB_PIXMAP 4 typedef xcb_value_error_t xcb_pixmap_error_t; /** Opcode for xcb_atom. */ #define XCB_ATOM 5 typedef xcb_value_error_t xcb_atom_error_t; /** Opcode for xcb_cursor. */ #define XCB_CURSOR 6 typedef xcb_value_error_t xcb_cursor_error_t; /** Opcode for xcb_font. */ #define XCB_FONT 7 typedef xcb_value_error_t xcb_font_error_t; /** Opcode for xcb_match. */ #define XCB_MATCH 8 typedef xcb_request_error_t xcb_match_error_t; /** Opcode for xcb_drawable. */ #define XCB_DRAWABLE 9 typedef xcb_value_error_t xcb_drawable_error_t; /** Opcode for xcb_access. */ #define XCB_ACCESS 10 typedef xcb_request_error_t xcb_access_error_t; /** Opcode for xcb_alloc. */ #define XCB_ALLOC 11 typedef xcb_request_error_t xcb_alloc_error_t; /** Opcode for xcb_colormap. */ #define XCB_COLORMAP 12 typedef xcb_value_error_t xcb_colormap_error_t; /** Opcode for xcb_g_context. */ #define XCB_G_CONTEXT 13 typedef xcb_value_error_t xcb_g_context_error_t; /** Opcode for xcb_id_choice. */ #define XCB_ID_CHOICE 14 typedef xcb_value_error_t xcb_id_choice_error_t; /** Opcode for xcb_name. */ #define XCB_NAME 15 typedef xcb_request_error_t xcb_name_error_t; /** Opcode for xcb_length. */ #define XCB_LENGTH 16 typedef xcb_request_error_t xcb_length_error_t; /** Opcode for xcb_implementation. */ #define XCB_IMPLEMENTATION 17 typedef xcb_request_error_t xcb_implementation_error_t; typedef enum xcb_window_class_t { XCB_WINDOW_CLASS_COPY_FROM_PARENT = 0, XCB_WINDOW_CLASS_INPUT_OUTPUT = 1, XCB_WINDOW_CLASS_INPUT_ONLY = 2 } xcb_window_class_t; typedef enum xcb_cw_t { XCB_CW_BACK_PIXMAP = 1, /**< Overrides the default background-pixmap. The background pixmap and window must have the same root and same depth. Any size pixmap can be used, although some sizes may be faster than others. If `XCB_BACK_PIXMAP_NONE` is specified, the window has no defined background. The server may fill the contents with the previous screen contents or with contents of its own choosing. If `XCB_BACK_PIXMAP_PARENT_RELATIVE` is specified, the parent's background is used, but the window must have the same depth as the parent (or a Match error results). The parent's background is tracked, and the current version is used each time the window background is required. */ XCB_CW_BACK_PIXEL = 2, /**< Overrides `BackPixmap`. A pixmap of undefined size filled with the specified background pixel is used for the background. Range-checking is not performed, the background pixel is truncated to the appropriate number of bits. */ XCB_CW_BORDER_PIXMAP = 4, /**< Overrides the default border-pixmap. The border pixmap and window must have the same root and the same depth. Any size pixmap can be used, although some sizes may be faster than others. The special value `XCB_COPY_FROM_PARENT` means the parent's border pixmap is copied (subsequent changes to the parent's border attribute do not affect the child), but the window must have the same depth as the parent. */ XCB_CW_BORDER_PIXEL = 8, /**< Overrides `BorderPixmap`. A pixmap of undefined size filled with the specified border pixel is used for the border. Range checking is not performed on the border-pixel value, it is truncated to the appropriate number of bits. */ XCB_CW_BIT_GRAVITY = 16, /**< Defines which region of the window should be retained if the window is resized. */ XCB_CW_WIN_GRAVITY = 32, /**< Defines how the window should be repositioned if the parent is resized (see `ConfigureWindow`). */ XCB_CW_BACKING_STORE = 64, /**< A backing-store of `WhenMapped` advises the server that maintaining contents of obscured regions when the window is mapped would be beneficial. A backing-store of `Always` advises the server that maintaining contents even when the window is unmapped would be beneficial. In this case, the server may generate an exposure event when the window is created. A value of `NotUseful` advises the server that maintaining contents is unnecessary, although a server may still choose to maintain contents while the window is mapped. Note that if the server maintains contents, then the server should maintain complete contents not just the region within the parent boundaries, even if the window is larger than its parent. While the server maintains contents, exposure events will not normally be generated, but the server may stop maintaining contents at any time. */ XCB_CW_BACKING_PLANES = 128, /**< The backing-planes indicates (with bits set to 1) which bit planes of the window hold dynamic data that must be preserved in backing-stores and during save-unders. */ XCB_CW_BACKING_PIXEL = 256, /**< The backing-pixel specifies what value to use in planes not covered by backing-planes. The server is free to save only the specified bit planes in the backing-store or save-under and regenerate the remaining planes with the specified pixel value. Any bits beyond the specified depth of the window in these values are simply ignored. */ XCB_CW_OVERRIDE_REDIRECT = 512, /**< The override-redirect specifies whether map and configure requests on this window should override a SubstructureRedirect on the parent, typically to inform a window manager not to tamper with the window. */ XCB_CW_SAVE_UNDER = 1024, /**< If 1, the server is advised that when this window is mapped, saving the contents of windows it obscures would be beneficial. */ XCB_CW_EVENT_MASK = 2048, /**< The event-mask defines which events the client is interested in for this window (or for some event types, inferiors of the window). */ XCB_CW_DONT_PROPAGATE = 4096, /**< The do-not-propagate-mask defines which events should not be propagated to ancestor windows when no client has the event type selected in this window. */ XCB_CW_COLORMAP = 8192, /**< The colormap specifies the colormap that best reflects the true colors of the window. Servers capable of supporting multiple hardware colormaps may use this information, and window man- agers may use it for InstallColormap requests. The colormap must have the same visual type and root as the window (or a Match error results). If CopyFromParent is specified, the parent's colormap is copied (subsequent changes to the parent's colormap attribute do not affect the child). However, the window must have the same visual type as the parent (or a Match error results), and the parent must not have a colormap of None (or a Match error results). For an explanation of None, see FreeColormap request. The colormap is copied by sharing the colormap object between the child and the parent, not by making a complete copy of the colormap contents. */ XCB_CW_CURSOR = 16384 /**< If a cursor is specified, it will be used whenever the pointer is in the window. If None is speci- fied, the parent's cursor will be used when the pointer is in the window, and any change in the parent's cursor will cause an immediate change in the displayed cursor. */ } xcb_cw_t; typedef enum xcb_back_pixmap_t { XCB_BACK_PIXMAP_NONE = 0, XCB_BACK_PIXMAP_PARENT_RELATIVE = 1 } xcb_back_pixmap_t; typedef enum xcb_gravity_t { XCB_GRAVITY_BIT_FORGET = 0, XCB_GRAVITY_WIN_UNMAP = 0, XCB_GRAVITY_NORTH_WEST = 1, XCB_GRAVITY_NORTH = 2, XCB_GRAVITY_NORTH_EAST = 3, XCB_GRAVITY_WEST = 4, XCB_GRAVITY_CENTER = 5, XCB_GRAVITY_EAST = 6, XCB_GRAVITY_SOUTH_WEST = 7, XCB_GRAVITY_SOUTH = 8, XCB_GRAVITY_SOUTH_EAST = 9, XCB_GRAVITY_STATIC = 10 } xcb_gravity_t; /** * @brief xcb_create_window_value_list_t **/ typedef struct xcb_create_window_value_list_t { xcb_pixmap_t background_pixmap; uint32_t background_pixel; xcb_pixmap_t border_pixmap; uint32_t border_pixel; uint32_t bit_gravity; uint32_t win_gravity; uint32_t backing_store; uint32_t backing_planes; uint32_t backing_pixel; xcb_bool32_t override_redirect; xcb_bool32_t save_under; uint32_t event_mask; uint32_t do_not_propogate_mask; xcb_colormap_t colormap; xcb_cursor_t cursor; } xcb_create_window_value_list_t; /** Opcode for xcb_create_window. */ #define XCB_CREATE_WINDOW 1 /** * @brief xcb_create_window_request_t **/ typedef struct xcb_create_window_request_t { uint8_t major_opcode; uint8_t depth; uint16_t length; xcb_window_t wid; xcb_window_t parent; int16_t x; int16_t y; uint16_t width; uint16_t height; uint16_t border_width; uint16_t _class; xcb_visualid_t visual; uint32_t value_mask; } xcb_create_window_request_t; /** * @brief xcb_change_window_attributes_value_list_t **/ typedef struct xcb_change_window_attributes_value_list_t { xcb_pixmap_t background_pixmap; uint32_t background_pixel; xcb_pixmap_t border_pixmap; uint32_t border_pixel; uint32_t bit_gravity; uint32_t win_gravity; uint32_t backing_store; uint32_t backing_planes; uint32_t backing_pixel; xcb_bool32_t override_redirect; xcb_bool32_t save_under; uint32_t event_mask; uint32_t do_not_propogate_mask; xcb_colormap_t colormap; xcb_cursor_t cursor; } xcb_change_window_attributes_value_list_t; /** Opcode for xcb_change_window_attributes. */ #define XCB_CHANGE_WINDOW_ATTRIBUTES 2 /** * @brief xcb_change_window_attributes_request_t **/ typedef struct xcb_change_window_attributes_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t window; uint32_t value_mask; } xcb_change_window_attributes_request_t; typedef enum xcb_map_state_t { XCB_MAP_STATE_UNMAPPED = 0, XCB_MAP_STATE_UNVIEWABLE = 1, XCB_MAP_STATE_VIEWABLE = 2 } xcb_map_state_t; /** * @brief xcb_get_window_attributes_cookie_t **/ typedef struct xcb_get_window_attributes_cookie_t { unsigned int sequence; } xcb_get_window_attributes_cookie_t; /** Opcode for xcb_get_window_attributes. */ #define XCB_GET_WINDOW_ATTRIBUTES 3 /** * @brief xcb_get_window_attributes_request_t **/ typedef struct xcb_get_window_attributes_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t window; } xcb_get_window_attributes_request_t; /** * @brief xcb_get_window_attributes_reply_t **/ typedef struct xcb_get_window_attributes_reply_t { uint8_t response_type; uint8_t backing_store; uint16_t sequence; uint32_t length; xcb_visualid_t visual; uint16_t _class; uint8_t bit_gravity; uint8_t win_gravity; uint32_t backing_planes; uint32_t backing_pixel; uint8_t save_under; uint8_t map_is_installed; uint8_t map_state; uint8_t override_redirect; xcb_colormap_t colormap; uint32_t all_event_masks; uint32_t your_event_mask; uint16_t do_not_propagate_mask; uint8_t pad0[2]; } xcb_get_window_attributes_reply_t; /** Opcode for xcb_destroy_window. */ #define XCB_DESTROY_WINDOW 4 /** * @brief xcb_destroy_window_request_t **/ typedef struct xcb_destroy_window_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t window; } xcb_destroy_window_request_t; /** Opcode for xcb_destroy_subwindows. */ #define XCB_DESTROY_SUBWINDOWS 5 /** * @brief xcb_destroy_subwindows_request_t **/ typedef struct xcb_destroy_subwindows_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t window; } xcb_destroy_subwindows_request_t; typedef enum xcb_set_mode_t { XCB_SET_MODE_INSERT = 0, XCB_SET_MODE_DELETE = 1 } xcb_set_mode_t; /** Opcode for xcb_change_save_set. */ #define XCB_CHANGE_SAVE_SET 6 /** * @brief xcb_change_save_set_request_t **/ typedef struct xcb_change_save_set_request_t { uint8_t major_opcode; uint8_t mode; uint16_t length; xcb_window_t window; } xcb_change_save_set_request_t; /** Opcode for xcb_reparent_window. */ #define XCB_REPARENT_WINDOW 7 /** * @brief xcb_reparent_window_request_t **/ typedef struct xcb_reparent_window_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t window; xcb_window_t parent; int16_t x; int16_t y; } xcb_reparent_window_request_t; /** Opcode for xcb_map_window. */ #define XCB_MAP_WINDOW 8 /** * @brief xcb_map_window_request_t **/ typedef struct xcb_map_window_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t window; } xcb_map_window_request_t; /** Opcode for xcb_map_subwindows. */ #define XCB_MAP_SUBWINDOWS 9 /** * @brief xcb_map_subwindows_request_t **/ typedef struct xcb_map_subwindows_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t window; } xcb_map_subwindows_request_t; /** Opcode for xcb_unmap_window. */ #define XCB_UNMAP_WINDOW 10 /** * @brief xcb_unmap_window_request_t **/ typedef struct xcb_unmap_window_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t window; } xcb_unmap_window_request_t; /** Opcode for xcb_unmap_subwindows. */ #define XCB_UNMAP_SUBWINDOWS 11 /** * @brief xcb_unmap_subwindows_request_t **/ typedef struct xcb_unmap_subwindows_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t window; } xcb_unmap_subwindows_request_t; typedef enum xcb_config_window_t { XCB_CONFIG_WINDOW_X = 1, XCB_CONFIG_WINDOW_Y = 2, XCB_CONFIG_WINDOW_WIDTH = 4, XCB_CONFIG_WINDOW_HEIGHT = 8, XCB_CONFIG_WINDOW_BORDER_WIDTH = 16, XCB_CONFIG_WINDOW_SIBLING = 32, XCB_CONFIG_WINDOW_STACK_MODE = 64 } xcb_config_window_t; typedef enum xcb_stack_mode_t { XCB_STACK_MODE_ABOVE = 0, XCB_STACK_MODE_BELOW = 1, XCB_STACK_MODE_TOP_IF = 2, XCB_STACK_MODE_BOTTOM_IF = 3, XCB_STACK_MODE_OPPOSITE = 4 } xcb_stack_mode_t; /** * @brief xcb_configure_window_value_list_t **/ typedef struct xcb_configure_window_value_list_t { int32_t x; int32_t y; uint32_t width; uint32_t height; uint32_t border_width; xcb_window_t sibling; uint32_t stack_mode; } xcb_configure_window_value_list_t; /** Opcode for xcb_configure_window. */ #define XCB_CONFIGURE_WINDOW 12 /** * @brief xcb_configure_window_request_t **/ typedef struct xcb_configure_window_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t window; uint16_t value_mask; uint8_t pad1[2]; } xcb_configure_window_request_t; typedef enum xcb_circulate_t { XCB_CIRCULATE_RAISE_LOWEST = 0, XCB_CIRCULATE_LOWER_HIGHEST = 1 } xcb_circulate_t; /** Opcode for xcb_circulate_window. */ #define XCB_CIRCULATE_WINDOW 13 /** * @brief xcb_circulate_window_request_t **/ typedef struct xcb_circulate_window_request_t { uint8_t major_opcode; uint8_t direction; uint16_t length; xcb_window_t window; } xcb_circulate_window_request_t; /** * @brief xcb_get_geometry_cookie_t **/ typedef struct xcb_get_geometry_cookie_t { unsigned int sequence; } xcb_get_geometry_cookie_t; /** Opcode for xcb_get_geometry. */ #define XCB_GET_GEOMETRY 14 /** * @brief xcb_get_geometry_request_t **/ typedef struct xcb_get_geometry_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_drawable_t drawable; } xcb_get_geometry_request_t; /** * @brief xcb_get_geometry_reply_t **/ typedef struct xcb_get_geometry_reply_t { uint8_t response_type; uint8_t depth; uint16_t sequence; uint32_t length; xcb_window_t root; int16_t x; int16_t y; uint16_t width; uint16_t height; uint16_t border_width; uint8_t pad0[2]; } xcb_get_geometry_reply_t; /** * @brief xcb_query_tree_cookie_t **/ typedef struct xcb_query_tree_cookie_t { unsigned int sequence; } xcb_query_tree_cookie_t; /** Opcode for xcb_query_tree. */ #define XCB_QUERY_TREE 15 /** * @brief xcb_query_tree_request_t **/ typedef struct xcb_query_tree_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t window; } xcb_query_tree_request_t; /** * @brief xcb_query_tree_reply_t **/ typedef struct xcb_query_tree_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_window_t root; xcb_window_t parent; uint16_t children_len; uint8_t pad1[14]; } xcb_query_tree_reply_t; /** * @brief xcb_intern_atom_cookie_t **/ typedef struct xcb_intern_atom_cookie_t { unsigned int sequence; } xcb_intern_atom_cookie_t; /** Opcode for xcb_intern_atom. */ #define XCB_INTERN_ATOM 16 /** * @brief xcb_intern_atom_request_t **/ typedef struct xcb_intern_atom_request_t { uint8_t major_opcode; uint8_t only_if_exists; uint16_t length; uint16_t name_len; uint8_t pad0[2]; } xcb_intern_atom_request_t; /** * @brief xcb_intern_atom_reply_t **/ typedef struct xcb_intern_atom_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_atom_t atom; } xcb_intern_atom_reply_t; /** * @brief xcb_get_atom_name_cookie_t **/ typedef struct xcb_get_atom_name_cookie_t { unsigned int sequence; } xcb_get_atom_name_cookie_t; /** Opcode for xcb_get_atom_name. */ #define XCB_GET_ATOM_NAME 17 /** * @brief xcb_get_atom_name_request_t **/ typedef struct xcb_get_atom_name_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_atom_t atom; } xcb_get_atom_name_request_t; /** * @brief xcb_get_atom_name_reply_t **/ typedef struct xcb_get_atom_name_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t name_len; uint8_t pad1[22]; } xcb_get_atom_name_reply_t; typedef enum xcb_prop_mode_t { XCB_PROP_MODE_REPLACE = 0, /**< Discard the previous property value and store the new data. */ XCB_PROP_MODE_PREPEND = 1, /**< Insert the new data before the beginning of existing data. The `format` must match existing property value. If the property is undefined, it is treated as defined with the correct type and format with zero-length data. */ XCB_PROP_MODE_APPEND = 2 /**< Insert the new data after the beginning of existing data. The `format` must match existing property value. If the property is undefined, it is treated as defined with the correct type and format with zero-length data. */ } xcb_prop_mode_t; /** Opcode for xcb_change_property. */ #define XCB_CHANGE_PROPERTY 18 /** * @brief xcb_change_property_request_t **/ typedef struct xcb_change_property_request_t { uint8_t major_opcode; uint8_t mode; uint16_t length; xcb_window_t window; xcb_atom_t property; xcb_atom_t type; uint8_t format; uint8_t pad0[3]; uint32_t data_len; } xcb_change_property_request_t; /** Opcode for xcb_delete_property. */ #define XCB_DELETE_PROPERTY 19 /** * @brief xcb_delete_property_request_t **/ typedef struct xcb_delete_property_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t window; xcb_atom_t property; } xcb_delete_property_request_t; typedef enum xcb_get_property_type_t { XCB_GET_PROPERTY_TYPE_ANY = 0 } xcb_get_property_type_t; /** * @brief xcb_get_property_cookie_t **/ typedef struct xcb_get_property_cookie_t { unsigned int sequence; } xcb_get_property_cookie_t; /** Opcode for xcb_get_property. */ #define XCB_GET_PROPERTY 20 /** * @brief xcb_get_property_request_t **/ typedef struct xcb_get_property_request_t { uint8_t major_opcode; uint8_t _delete; uint16_t length; xcb_window_t window; xcb_atom_t property; xcb_atom_t type; uint32_t long_offset; uint32_t long_length; } xcb_get_property_request_t; /** * @brief xcb_get_property_reply_t **/ typedef struct xcb_get_property_reply_t { uint8_t response_type; uint8_t format; uint16_t sequence; uint32_t length; xcb_atom_t type; uint32_t bytes_after; uint32_t value_len; uint8_t pad0[12]; } xcb_get_property_reply_t; /** * @brief xcb_list_properties_cookie_t **/ typedef struct xcb_list_properties_cookie_t { unsigned int sequence; } xcb_list_properties_cookie_t; /** Opcode for xcb_list_properties. */ #define XCB_LIST_PROPERTIES 21 /** * @brief xcb_list_properties_request_t **/ typedef struct xcb_list_properties_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t window; } xcb_list_properties_request_t; /** * @brief xcb_list_properties_reply_t **/ typedef struct xcb_list_properties_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t atoms_len; uint8_t pad1[22]; } xcb_list_properties_reply_t; /** Opcode for xcb_set_selection_owner. */ #define XCB_SET_SELECTION_OWNER 22 /** * @brief xcb_set_selection_owner_request_t **/ typedef struct xcb_set_selection_owner_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t owner; xcb_atom_t selection; xcb_timestamp_t time; } xcb_set_selection_owner_request_t; /** * @brief xcb_get_selection_owner_cookie_t **/ typedef struct xcb_get_selection_owner_cookie_t { unsigned int sequence; } xcb_get_selection_owner_cookie_t; /** Opcode for xcb_get_selection_owner. */ #define XCB_GET_SELECTION_OWNER 23 /** * @brief xcb_get_selection_owner_request_t **/ typedef struct xcb_get_selection_owner_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_atom_t selection; } xcb_get_selection_owner_request_t; /** * @brief xcb_get_selection_owner_reply_t **/ typedef struct xcb_get_selection_owner_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_window_t owner; } xcb_get_selection_owner_reply_t; /** Opcode for xcb_convert_selection. */ #define XCB_CONVERT_SELECTION 24 /** * @brief xcb_convert_selection_request_t **/ typedef struct xcb_convert_selection_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t requestor; xcb_atom_t selection; xcb_atom_t target; xcb_atom_t property; xcb_timestamp_t time; } xcb_convert_selection_request_t; typedef enum xcb_send_event_dest_t { XCB_SEND_EVENT_DEST_POINTER_WINDOW = 0, XCB_SEND_EVENT_DEST_ITEM_FOCUS = 1 } xcb_send_event_dest_t; /** Opcode for xcb_send_event. */ #define XCB_SEND_EVENT 25 /** * @brief xcb_send_event_request_t **/ typedef struct xcb_send_event_request_t { uint8_t major_opcode; uint8_t propagate; uint16_t length; xcb_window_t destination; uint32_t event_mask; char event[32]; } xcb_send_event_request_t; typedef enum xcb_grab_mode_t { XCB_GRAB_MODE_SYNC = 0, /**< The state of the keyboard appears to freeze: No further keyboard events are generated by the server until the grabbing client issues a releasing `AllowEvents` request or until the keyboard grab is released. */ XCB_GRAB_MODE_ASYNC = 1 /**< Keyboard event processing continues normally. */ } xcb_grab_mode_t; typedef enum xcb_grab_status_t { XCB_GRAB_STATUS_SUCCESS = 0, XCB_GRAB_STATUS_ALREADY_GRABBED = 1, XCB_GRAB_STATUS_INVALID_TIME = 2, XCB_GRAB_STATUS_NOT_VIEWABLE = 3, XCB_GRAB_STATUS_FROZEN = 4 } xcb_grab_status_t; typedef enum xcb_cursor_enum_t { XCB_CURSOR_NONE = 0 } xcb_cursor_enum_t; /** * @brief xcb_grab_pointer_cookie_t **/ typedef struct xcb_grab_pointer_cookie_t { unsigned int sequence; } xcb_grab_pointer_cookie_t; /** Opcode for xcb_grab_pointer. */ #define XCB_GRAB_POINTER 26 /** * @brief xcb_grab_pointer_request_t **/ typedef struct xcb_grab_pointer_request_t { uint8_t major_opcode; uint8_t owner_events; uint16_t length; xcb_window_t grab_window; uint16_t event_mask; uint8_t pointer_mode; uint8_t keyboard_mode; xcb_window_t confine_to; xcb_cursor_t cursor; xcb_timestamp_t time; } xcb_grab_pointer_request_t; /** * @brief xcb_grab_pointer_reply_t **/ typedef struct xcb_grab_pointer_reply_t { uint8_t response_type; uint8_t status; uint16_t sequence; uint32_t length; } xcb_grab_pointer_reply_t; /** Opcode for xcb_ungrab_pointer. */ #define XCB_UNGRAB_POINTER 27 /** * @brief xcb_ungrab_pointer_request_t **/ typedef struct xcb_ungrab_pointer_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_timestamp_t time; } xcb_ungrab_pointer_request_t; typedef enum xcb_button_index_t { XCB_BUTTON_INDEX_ANY = 0, /**< Any of the following (or none): */ XCB_BUTTON_INDEX_1 = 1, /**< The left mouse button. */ XCB_BUTTON_INDEX_2 = 2, /**< The right mouse button. */ XCB_BUTTON_INDEX_3 = 3, /**< The middle mouse button. */ XCB_BUTTON_INDEX_4 = 4, /**< Scroll wheel. TODO: direction? */ XCB_BUTTON_INDEX_5 = 5 /**< Scroll wheel. TODO: direction? */ } xcb_button_index_t; /** Opcode for xcb_grab_button. */ #define XCB_GRAB_BUTTON 28 /** * @brief xcb_grab_button_request_t **/ typedef struct xcb_grab_button_request_t { uint8_t major_opcode; uint8_t owner_events; uint16_t length; xcb_window_t grab_window; uint16_t event_mask; uint8_t pointer_mode; uint8_t keyboard_mode; xcb_window_t confine_to; xcb_cursor_t cursor; uint8_t button; uint8_t pad0; uint16_t modifiers; } xcb_grab_button_request_t; /** Opcode for xcb_ungrab_button. */ #define XCB_UNGRAB_BUTTON 29 /** * @brief xcb_ungrab_button_request_t **/ typedef struct xcb_ungrab_button_request_t { uint8_t major_opcode; uint8_t button; uint16_t length; xcb_window_t grab_window; uint16_t modifiers; uint8_t pad0[2]; } xcb_ungrab_button_request_t; /** Opcode for xcb_change_active_pointer_grab. */ #define XCB_CHANGE_ACTIVE_POINTER_GRAB 30 /** * @brief xcb_change_active_pointer_grab_request_t **/ typedef struct xcb_change_active_pointer_grab_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_cursor_t cursor; xcb_timestamp_t time; uint16_t event_mask; uint8_t pad1[2]; } xcb_change_active_pointer_grab_request_t; /** * @brief xcb_grab_keyboard_cookie_t **/ typedef struct xcb_grab_keyboard_cookie_t { unsigned int sequence; } xcb_grab_keyboard_cookie_t; /** Opcode for xcb_grab_keyboard. */ #define XCB_GRAB_KEYBOARD 31 /** * @brief xcb_grab_keyboard_request_t **/ typedef struct xcb_grab_keyboard_request_t { uint8_t major_opcode; uint8_t owner_events; uint16_t length; xcb_window_t grab_window; xcb_timestamp_t time; uint8_t pointer_mode; uint8_t keyboard_mode; uint8_t pad0[2]; } xcb_grab_keyboard_request_t; /** * @brief xcb_grab_keyboard_reply_t **/ typedef struct xcb_grab_keyboard_reply_t { uint8_t response_type; uint8_t status; uint16_t sequence; uint32_t length; } xcb_grab_keyboard_reply_t; /** Opcode for xcb_ungrab_keyboard. */ #define XCB_UNGRAB_KEYBOARD 32 /** * @brief xcb_ungrab_keyboard_request_t **/ typedef struct xcb_ungrab_keyboard_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_timestamp_t time; } xcb_ungrab_keyboard_request_t; typedef enum xcb_grab_t { XCB_GRAB_ANY = 0 } xcb_grab_t; /** Opcode for xcb_grab_key. */ #define XCB_GRAB_KEY 33 /** * @brief xcb_grab_key_request_t **/ typedef struct xcb_grab_key_request_t { uint8_t major_opcode; uint8_t owner_events; uint16_t length; xcb_window_t grab_window; uint16_t modifiers; xcb_keycode_t key; uint8_t pointer_mode; uint8_t keyboard_mode; uint8_t pad0[3]; } xcb_grab_key_request_t; /** Opcode for xcb_ungrab_key. */ #define XCB_UNGRAB_KEY 34 /** * @brief xcb_ungrab_key_request_t **/ typedef struct xcb_ungrab_key_request_t { uint8_t major_opcode; xcb_keycode_t key; uint16_t length; xcb_window_t grab_window; uint16_t modifiers; uint8_t pad0[2]; } xcb_ungrab_key_request_t; typedef enum xcb_allow_t { XCB_ALLOW_ASYNC_POINTER = 0, /**< For AsyncPointer, if the pointer is frozen by the client, pointer event processing continues normally. If the pointer is frozen twice by the client on behalf of two separate grabs, AsyncPointer thaws for both. AsyncPointer has no effect if the pointer is not frozen by the client, but the pointer need not be grabbed by the client. TODO: rewrite this in more understandable terms. */ XCB_ALLOW_SYNC_POINTER = 1, /**< For SyncPointer, if the pointer is frozen and actively grabbed by the client, pointer event processing continues normally until the next ButtonPress or ButtonRelease event is reported to the client, at which time the pointer again appears to freeze. However, if the reported event causes the pointer grab to be released, then the pointer does not freeze. SyncPointer has no effect if the pointer is not frozen by the client or if the pointer is not grabbed by the client. */ XCB_ALLOW_REPLAY_POINTER = 2, /**< For ReplayPointer, if the pointer is actively grabbed by the client and is frozen as the result of an event having been sent to the client (either from the activation of a GrabButton or from a previous AllowEvents with mode SyncPointer but not from a GrabPointer), then the pointer grab is released and that event is completely reprocessed, this time ignoring any passive grabs at or above (towards the root) the grab-window of the grab just released. The request has no effect if the pointer is not grabbed by the client or if the pointer is not frozen as the result of an event. */ XCB_ALLOW_ASYNC_KEYBOARD = 3, /**< For AsyncKeyboard, if the keyboard is frozen by the client, keyboard event processing continues normally. If the keyboard is frozen twice by the client on behalf of two separate grabs, AsyncKeyboard thaws for both. AsyncKeyboard has no effect if the keyboard is not frozen by the client, but the keyboard need not be grabbed by the client. */ XCB_ALLOW_SYNC_KEYBOARD = 4, /**< For SyncKeyboard, if the keyboard is frozen and actively grabbed by the client, keyboard event processing continues normally until the next KeyPress or KeyRelease event is reported to the client, at which time the keyboard again appears to freeze. However, if the reported event causes the keyboard grab to be released, then the keyboard does not freeze. SyncKeyboard has no effect if the keyboard is not frozen by the client or if the keyboard is not grabbed by the client. */ XCB_ALLOW_REPLAY_KEYBOARD = 5, /**< For ReplayKeyboard, if the keyboard is actively grabbed by the client and is frozen as the result of an event having been sent to the client (either from the activation of a GrabKey or from a previous AllowEvents with mode SyncKeyboard but not from a GrabKeyboard), then the keyboard grab is released and that event is completely reprocessed, this time ignoring any passive grabs at or above (towards the root) the grab-window of the grab just released. The request has no effect if the keyboard is not grabbed by the client or if the keyboard is not frozen as the result of an event. */ XCB_ALLOW_ASYNC_BOTH = 6, /**< For AsyncBoth, if the pointer and the keyboard are frozen by the client, event processing for both devices continues normally. If a device is frozen twice by the client on behalf of two separate grabs, AsyncBoth thaws for both. AsyncBoth has no effect unless both pointer and keyboard are frozen by the client. */ XCB_ALLOW_SYNC_BOTH = 7 /**< For SyncBoth, if both pointer and keyboard are frozen by the client, event processing (for both devices) continues normally until the next ButtonPress, ButtonRelease, KeyPress, or KeyRelease event is reported to the client for a grabbed device (button event for the pointer, key event for the keyboard), at which time the devices again appear to freeze. However, if the reported event causes the grab to be released, then the devices do not freeze (but if the other device is still grabbed, then a subsequent event for it will still cause both devices to freeze). SyncBoth has no effect unless both pointer and keyboard are frozen by the client. If the pointer or keyboard is frozen twice by the client on behalf of two separate grabs, SyncBoth thaws for both (but a subsequent freeze for SyncBoth will only freeze each device once). */ } xcb_allow_t; /** Opcode for xcb_allow_events. */ #define XCB_ALLOW_EVENTS 35 /** * @brief xcb_allow_events_request_t **/ typedef struct xcb_allow_events_request_t { uint8_t major_opcode; uint8_t mode; uint16_t length; xcb_timestamp_t time; } xcb_allow_events_request_t; /** Opcode for xcb_grab_server. */ #define XCB_GRAB_SERVER 36 /** * @brief xcb_grab_server_request_t **/ typedef struct xcb_grab_server_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; } xcb_grab_server_request_t; /** Opcode for xcb_ungrab_server. */ #define XCB_UNGRAB_SERVER 37 /** * @brief xcb_ungrab_server_request_t **/ typedef struct xcb_ungrab_server_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; } xcb_ungrab_server_request_t; /** * @brief xcb_query_pointer_cookie_t **/ typedef struct xcb_query_pointer_cookie_t { unsigned int sequence; } xcb_query_pointer_cookie_t; /** Opcode for xcb_query_pointer. */ #define XCB_QUERY_POINTER 38 /** * @brief xcb_query_pointer_request_t **/ typedef struct xcb_query_pointer_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t window; } xcb_query_pointer_request_t; /** * @brief xcb_query_pointer_reply_t **/ typedef struct xcb_query_pointer_reply_t { uint8_t response_type; uint8_t same_screen; uint16_t sequence; uint32_t length; xcb_window_t root; xcb_window_t child; int16_t root_x; int16_t root_y; int16_t win_x; int16_t win_y; uint16_t mask; uint8_t pad0[2]; } xcb_query_pointer_reply_t; /** * @brief xcb_timecoord_t **/ typedef struct xcb_timecoord_t { xcb_timestamp_t time; int16_t x; int16_t y; } xcb_timecoord_t; /** * @brief xcb_timecoord_iterator_t **/ typedef struct xcb_timecoord_iterator_t { xcb_timecoord_t *data; int rem; int index; } xcb_timecoord_iterator_t; /** * @brief xcb_get_motion_events_cookie_t **/ typedef struct xcb_get_motion_events_cookie_t { unsigned int sequence; } xcb_get_motion_events_cookie_t; /** Opcode for xcb_get_motion_events. */ #define XCB_GET_MOTION_EVENTS 39 /** * @brief xcb_get_motion_events_request_t **/ typedef struct xcb_get_motion_events_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t window; xcb_timestamp_t start; xcb_timestamp_t stop; } xcb_get_motion_events_request_t; /** * @brief xcb_get_motion_events_reply_t **/ typedef struct xcb_get_motion_events_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t events_len; uint8_t pad1[20]; } xcb_get_motion_events_reply_t; /** * @brief xcb_translate_coordinates_cookie_t **/ typedef struct xcb_translate_coordinates_cookie_t { unsigned int sequence; } xcb_translate_coordinates_cookie_t; /** Opcode for xcb_translate_coordinates. */ #define XCB_TRANSLATE_COORDINATES 40 /** * @brief xcb_translate_coordinates_request_t **/ typedef struct xcb_translate_coordinates_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t src_window; xcb_window_t dst_window; int16_t src_x; int16_t src_y; } xcb_translate_coordinates_request_t; /** * @brief xcb_translate_coordinates_reply_t **/ typedef struct xcb_translate_coordinates_reply_t { uint8_t response_type; uint8_t same_screen; uint16_t sequence; uint32_t length; xcb_window_t child; int16_t dst_x; int16_t dst_y; } xcb_translate_coordinates_reply_t; /** Opcode for xcb_warp_pointer. */ #define XCB_WARP_POINTER 41 /** * @brief xcb_warp_pointer_request_t **/ typedef struct xcb_warp_pointer_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t src_window; xcb_window_t dst_window; int16_t src_x; int16_t src_y; uint16_t src_width; uint16_t src_height; int16_t dst_x; int16_t dst_y; } xcb_warp_pointer_request_t; typedef enum xcb_input_focus_t { XCB_INPUT_FOCUS_NONE = 0, /**< The focus reverts to `XCB_NONE`, so no window will have the input focus. */ XCB_INPUT_FOCUS_POINTER_ROOT = 1, /**< The focus reverts to `XCB_POINTER_ROOT` respectively. When the focus reverts, FocusIn and FocusOut events are generated, but the last-focus-change time is not changed. */ XCB_INPUT_FOCUS_PARENT = 2, /**< The focus reverts to the parent (or closest viewable ancestor) and the new revert_to value is `XCB_INPUT_FOCUS_NONE`. */ XCB_INPUT_FOCUS_FOLLOW_KEYBOARD = 3 /**< NOT YET DOCUMENTED. Only relevant for the xinput extension. */ } xcb_input_focus_t; /** Opcode for xcb_set_input_focus. */ #define XCB_SET_INPUT_FOCUS 42 /** * @brief xcb_set_input_focus_request_t **/ typedef struct xcb_set_input_focus_request_t { uint8_t major_opcode; uint8_t revert_to; uint16_t length; xcb_window_t focus; xcb_timestamp_t time; } xcb_set_input_focus_request_t; /** * @brief xcb_get_input_focus_cookie_t **/ typedef struct xcb_get_input_focus_cookie_t { unsigned int sequence; } xcb_get_input_focus_cookie_t; /** Opcode for xcb_get_input_focus. */ #define XCB_GET_INPUT_FOCUS 43 /** * @brief xcb_get_input_focus_request_t **/ typedef struct xcb_get_input_focus_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; } xcb_get_input_focus_request_t; /** * @brief xcb_get_input_focus_reply_t **/ typedef struct xcb_get_input_focus_reply_t { uint8_t response_type; uint8_t revert_to; uint16_t sequence; uint32_t length; xcb_window_t focus; } xcb_get_input_focus_reply_t; /** * @brief xcb_query_keymap_cookie_t **/ typedef struct xcb_query_keymap_cookie_t { unsigned int sequence; } xcb_query_keymap_cookie_t; /** Opcode for xcb_query_keymap. */ #define XCB_QUERY_KEYMAP 44 /** * @brief xcb_query_keymap_request_t **/ typedef struct xcb_query_keymap_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; } xcb_query_keymap_request_t; /** * @brief xcb_query_keymap_reply_t **/ typedef struct xcb_query_keymap_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t keys[32]; } xcb_query_keymap_reply_t; /** Opcode for xcb_open_font. */ #define XCB_OPEN_FONT 45 /** * @brief xcb_open_font_request_t **/ typedef struct xcb_open_font_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_font_t fid; uint16_t name_len; uint8_t pad1[2]; } xcb_open_font_request_t; /** Opcode for xcb_close_font. */ #define XCB_CLOSE_FONT 46 /** * @brief xcb_close_font_request_t **/ typedef struct xcb_close_font_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_font_t font; } xcb_close_font_request_t; typedef enum xcb_font_draw_t { XCB_FONT_DRAW_LEFT_TO_RIGHT = 0, XCB_FONT_DRAW_RIGHT_TO_LEFT = 1 } xcb_font_draw_t; /** * @brief xcb_fontprop_t **/ typedef struct xcb_fontprop_t { xcb_atom_t name; uint32_t value; } xcb_fontprop_t; /** * @brief xcb_fontprop_iterator_t **/ typedef struct xcb_fontprop_iterator_t { xcb_fontprop_t *data; int rem; int index; } xcb_fontprop_iterator_t; /** * @brief xcb_charinfo_t **/ typedef struct xcb_charinfo_t { int16_t left_side_bearing; int16_t right_side_bearing; int16_t character_width; int16_t ascent; int16_t descent; uint16_t attributes; } xcb_charinfo_t; /** * @brief xcb_charinfo_iterator_t **/ typedef struct xcb_charinfo_iterator_t { xcb_charinfo_t *data; int rem; int index; } xcb_charinfo_iterator_t; /** * @brief xcb_query_font_cookie_t **/ typedef struct xcb_query_font_cookie_t { unsigned int sequence; } xcb_query_font_cookie_t; /** Opcode for xcb_query_font. */ #define XCB_QUERY_FONT 47 /** * @brief xcb_query_font_request_t **/ typedef struct xcb_query_font_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_fontable_t font; } xcb_query_font_request_t; /** * @brief xcb_query_font_reply_t **/ typedef struct xcb_query_font_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_charinfo_t min_bounds; uint8_t pad1[4]; xcb_charinfo_t max_bounds; uint8_t pad2[4]; uint16_t min_char_or_byte2; uint16_t max_char_or_byte2; uint16_t default_char; uint16_t properties_len; uint8_t draw_direction; uint8_t min_byte1; uint8_t max_byte1; uint8_t all_chars_exist; int16_t font_ascent; int16_t font_descent; uint32_t char_infos_len; } xcb_query_font_reply_t; /** * @brief xcb_query_text_extents_cookie_t **/ typedef struct xcb_query_text_extents_cookie_t { unsigned int sequence; } xcb_query_text_extents_cookie_t; /** Opcode for xcb_query_text_extents. */ #define XCB_QUERY_TEXT_EXTENTS 48 /** * @brief xcb_query_text_extents_request_t **/ typedef struct xcb_query_text_extents_request_t { uint8_t major_opcode; uint8_t odd_length; uint16_t length; xcb_fontable_t font; } xcb_query_text_extents_request_t; /** * @brief xcb_query_text_extents_reply_t **/ typedef struct xcb_query_text_extents_reply_t { uint8_t response_type; uint8_t draw_direction; uint16_t sequence; uint32_t length; int16_t font_ascent; int16_t font_descent; int16_t overall_ascent; int16_t overall_descent; int32_t overall_width; int32_t overall_left; int32_t overall_right; } xcb_query_text_extents_reply_t; /** * @brief xcb_str_t **/ typedef struct xcb_str_t { uint8_t name_len; } xcb_str_t; /** * @brief xcb_str_iterator_t **/ typedef struct xcb_str_iterator_t { xcb_str_t *data; int rem; int index; } xcb_str_iterator_t; /** * @brief xcb_list_fonts_cookie_t **/ typedef struct xcb_list_fonts_cookie_t { unsigned int sequence; } xcb_list_fonts_cookie_t; /** Opcode for xcb_list_fonts. */ #define XCB_LIST_FONTS 49 /** * @brief xcb_list_fonts_request_t **/ typedef struct xcb_list_fonts_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; uint16_t max_names; uint16_t pattern_len; } xcb_list_fonts_request_t; /** * @brief xcb_list_fonts_reply_t **/ typedef struct xcb_list_fonts_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t names_len; uint8_t pad1[22]; } xcb_list_fonts_reply_t; /** * @brief xcb_list_fonts_with_info_cookie_t **/ typedef struct xcb_list_fonts_with_info_cookie_t { unsigned int sequence; } xcb_list_fonts_with_info_cookie_t; /** Opcode for xcb_list_fonts_with_info. */ #define XCB_LIST_FONTS_WITH_INFO 50 /** * @brief xcb_list_fonts_with_info_request_t **/ typedef struct xcb_list_fonts_with_info_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; uint16_t max_names; uint16_t pattern_len; } xcb_list_fonts_with_info_request_t; /** * @brief xcb_list_fonts_with_info_reply_t **/ typedef struct xcb_list_fonts_with_info_reply_t { uint8_t response_type; uint8_t name_len; uint16_t sequence; uint32_t length; xcb_charinfo_t min_bounds; uint8_t pad0[4]; xcb_charinfo_t max_bounds; uint8_t pad1[4]; uint16_t min_char_or_byte2; uint16_t max_char_or_byte2; uint16_t default_char; uint16_t properties_len; uint8_t draw_direction; uint8_t min_byte1; uint8_t max_byte1; uint8_t all_chars_exist; int16_t font_ascent; int16_t font_descent; uint32_t replies_hint; } xcb_list_fonts_with_info_reply_t; /** Opcode for xcb_set_font_path. */ #define XCB_SET_FONT_PATH 51 /** * @brief xcb_set_font_path_request_t **/ typedef struct xcb_set_font_path_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; uint16_t font_qty; uint8_t pad1[2]; } xcb_set_font_path_request_t; /** * @brief xcb_get_font_path_cookie_t **/ typedef struct xcb_get_font_path_cookie_t { unsigned int sequence; } xcb_get_font_path_cookie_t; /** Opcode for xcb_get_font_path. */ #define XCB_GET_FONT_PATH 52 /** * @brief xcb_get_font_path_request_t **/ typedef struct xcb_get_font_path_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; } xcb_get_font_path_request_t; /** * @brief xcb_get_font_path_reply_t **/ typedef struct xcb_get_font_path_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t path_len; uint8_t pad1[22]; } xcb_get_font_path_reply_t; /** Opcode for xcb_create_pixmap. */ #define XCB_CREATE_PIXMAP 53 /** * @brief xcb_create_pixmap_request_t **/ typedef struct xcb_create_pixmap_request_t { uint8_t major_opcode; uint8_t depth; uint16_t length; xcb_pixmap_t pid; xcb_drawable_t drawable; uint16_t width; uint16_t height; } xcb_create_pixmap_request_t; /** Opcode for xcb_free_pixmap. */ #define XCB_FREE_PIXMAP 54 /** * @brief xcb_free_pixmap_request_t **/ typedef struct xcb_free_pixmap_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_pixmap_t pixmap; } xcb_free_pixmap_request_t; typedef enum xcb_gc_t { XCB_GC_FUNCTION = 1, /**< TODO: Refer to GX */ XCB_GC_PLANE_MASK = 2, /**< In graphics operations, given a source and destination pixel, the result is computed bitwise on corresponding bits of the pixels; that is, a Boolean operation is performed in each bit plane. The plane-mask restricts the operation to a subset of planes, so the result is: ((src FUNC dst) AND plane-mask) OR (dst AND (NOT plane-mask)) */ XCB_GC_FOREGROUND = 4, /**< Foreground colorpixel. */ XCB_GC_BACKGROUND = 8, /**< Background colorpixel. */ XCB_GC_LINE_WIDTH = 16, /**< The line-width is measured in pixels and can be greater than or equal to one, a wide line, or the special value zero, a thin line. */ XCB_GC_LINE_STYLE = 32, /**< The line-style defines which sections of a line are drawn: Solid The full path of the line is drawn. DoubleDash The full path of the line is drawn, but the even dashes are filled differently than the odd dashes (see fill-style), with Butt cap-style used where even and odd dashes meet. OnOffDash Only the even dashes are drawn, and cap-style applies to all internal ends of the individual dashes (except NotLast is treated as Butt). */ XCB_GC_CAP_STYLE = 64, /**< The cap-style defines how the endpoints of a path are drawn: NotLast The result is equivalent to Butt, except that for a line-width of zero the final endpoint is not drawn. Butt The result is square at the endpoint (perpendicular to the slope of the line) with no projection beyond. Round The result is a circular arc with its diameter equal to the line-width, centered on the endpoint; it is equivalent to Butt for line-width zero. Projecting The result is square at the end, but the path continues beyond the endpoint for a distance equal to half the line-width; it is equivalent to Butt for line-width zero. */ XCB_GC_JOIN_STYLE = 128, /**< The join-style defines how corners are drawn for wide lines: Miter The outer edges of the two lines extend to meet at an angle. However, if the angle is less than 11 degrees, a Bevel join-style is used instead. Round The result is a circular arc with a diameter equal to the line-width, centered on the joinpoint. Bevel The result is Butt endpoint styles, and then the triangular notch is filled. */ XCB_GC_FILL_STYLE = 256, /**< The fill-style defines the contents of the source for line, text, and fill requests. For all text and fill requests (for example, PolyText8, PolyText16, PolyFillRectangle, FillPoly, and PolyFillArc) as well as for line requests with line-style Solid, (for example, PolyLine, PolySegment, PolyRectangle, PolyArc) and for the even dashes for line requests with line-style OnOffDash or DoubleDash: Solid Foreground Tiled Tile OpaqueStippled A tile with the same width and height as stipple but with background everywhere stipple has a zero and with foreground everywhere stipple has a one Stippled Foreground masked by stipple For the odd dashes for line requests with line-style DoubleDash: Solid Background Tiled Same as for even dashes OpaqueStippled Same as for even dashes Stippled Background masked by stipple */ XCB_GC_FILL_RULE = 512, /**< */ XCB_GC_TILE = 1024, /**< The tile/stipple represents an infinite two-dimensional plane with the tile/stipple replicated in all dimensions. When that plane is superimposed on the drawable for use in a graphics operation, the upper-left corner of some instance of the tile/stipple is at the coordinates within the drawable specified by the tile/stipple origin. The tile/stipple and clip origins are interpreted relative to the origin of whatever destination drawable is specified in a graphics request. The tile pixmap must have the same root and depth as the gcontext (or a Match error results). The stipple pixmap must have depth one and must have the same root as the gcontext (or a Match error results). For fill-style Stippled (but not fill-style OpaqueStippled), the stipple pattern is tiled in a single plane and acts as an additional clip mask to be ANDed with the clip-mask. Any size pixmap can be used for tiling or stippling, although some sizes may be faster to use than others. */ XCB_GC_STIPPLE = 2048, /**< The tile/stipple represents an infinite two-dimensional plane with the tile/stipple replicated in all dimensions. When that plane is superimposed on the drawable for use in a graphics operation, the upper-left corner of some instance of the tile/stipple is at the coordinates within the drawable specified by the tile/stipple origin. The tile/stipple and clip origins are interpreted relative to the origin of whatever destination drawable is specified in a graphics request. The tile pixmap must have the same root and depth as the gcontext (or a Match error results). The stipple pixmap must have depth one and must have the same root as the gcontext (or a Match error results). For fill-style Stippled (but not fill-style OpaqueStippled), the stipple pattern is tiled in a single plane and acts as an additional clip mask to be ANDed with the clip-mask. Any size pixmap can be used for tiling or stippling, although some sizes may be faster to use than others. */ XCB_GC_TILE_STIPPLE_ORIGIN_X = 4096, /**< TODO */ XCB_GC_TILE_STIPPLE_ORIGIN_Y = 8192, /**< TODO */ XCB_GC_FONT = 16384, /**< Which font to use for the `ImageText8` and `ImageText16` requests. */ XCB_GC_SUBWINDOW_MODE = 32768, /**< For ClipByChildren, both source and destination windows are additionally clipped by all viewable InputOutput children. For IncludeInferiors, neither source nor destination window is clipped by inferiors. This will result in including subwindow contents in the source and drawing through subwindow boundaries of the destination. The use of IncludeInferiors with a source or destination window of one depth with mapped inferiors of differing depth is not illegal, but the semantics is undefined by the core protocol. */ XCB_GC_GRAPHICS_EXPOSURES = 65536, /**< Whether ExposureEvents should be generated (1) or not (0). The default is 1. */ XCB_GC_CLIP_ORIGIN_X = 131072, /**< TODO */ XCB_GC_CLIP_ORIGIN_Y = 262144, /**< TODO */ XCB_GC_CLIP_MASK = 524288, /**< The clip-mask restricts writes to the destination drawable. Only pixels where the clip-mask has bits set to 1 are drawn. Pixels are not drawn outside the area covered by the clip-mask or where the clip-mask has bits set to 0. The clip-mask affects all graphics requests, but it does not clip sources. The clip-mask origin is interpreted relative to the origin of whatever destination drawable is specified in a graphics request. If a pixmap is specified as the clip-mask, it must have depth 1 and have the same root as the gcontext (or a Match error results). If clip-mask is None, then pixels are always drawn, regardless of the clip origin. The clip-mask can also be set with the SetClipRectangles request. */ XCB_GC_DASH_OFFSET = 1048576, /**< TODO */ XCB_GC_DASH_LIST = 2097152, /**< TODO */ XCB_GC_ARC_MODE = 4194304 /**< TODO */ } xcb_gc_t; typedef enum xcb_gx_t { XCB_GX_CLEAR = 0, XCB_GX_AND = 1, XCB_GX_AND_REVERSE = 2, XCB_GX_COPY = 3, XCB_GX_AND_INVERTED = 4, XCB_GX_NOOP = 5, XCB_GX_XOR = 6, XCB_GX_OR = 7, XCB_GX_NOR = 8, XCB_GX_EQUIV = 9, XCB_GX_INVERT = 10, XCB_GX_OR_REVERSE = 11, XCB_GX_COPY_INVERTED = 12, XCB_GX_OR_INVERTED = 13, XCB_GX_NAND = 14, XCB_GX_SET = 15 } xcb_gx_t; typedef enum xcb_line_style_t { XCB_LINE_STYLE_SOLID = 0, XCB_LINE_STYLE_ON_OFF_DASH = 1, XCB_LINE_STYLE_DOUBLE_DASH = 2 } xcb_line_style_t; typedef enum xcb_cap_style_t { XCB_CAP_STYLE_NOT_LAST = 0, XCB_CAP_STYLE_BUTT = 1, XCB_CAP_STYLE_ROUND = 2, XCB_CAP_STYLE_PROJECTING = 3 } xcb_cap_style_t; typedef enum xcb_join_style_t { XCB_JOIN_STYLE_MITER = 0, XCB_JOIN_STYLE_ROUND = 1, XCB_JOIN_STYLE_BEVEL = 2 } xcb_join_style_t; typedef enum xcb_fill_style_t { XCB_FILL_STYLE_SOLID = 0, XCB_FILL_STYLE_TILED = 1, XCB_FILL_STYLE_STIPPLED = 2, XCB_FILL_STYLE_OPAQUE_STIPPLED = 3 } xcb_fill_style_t; typedef enum xcb_fill_rule_t { XCB_FILL_RULE_EVEN_ODD = 0, XCB_FILL_RULE_WINDING = 1 } xcb_fill_rule_t; typedef enum xcb_subwindow_mode_t { XCB_SUBWINDOW_MODE_CLIP_BY_CHILDREN = 0, XCB_SUBWINDOW_MODE_INCLUDE_INFERIORS = 1 } xcb_subwindow_mode_t; typedef enum xcb_arc_mode_t { XCB_ARC_MODE_CHORD = 0, XCB_ARC_MODE_PIE_SLICE = 1 } xcb_arc_mode_t; /** * @brief xcb_create_gc_value_list_t **/ typedef struct xcb_create_gc_value_list_t { uint32_t function; uint32_t plane_mask; uint32_t foreground; uint32_t background; uint32_t line_width; uint32_t line_style; uint32_t cap_style; uint32_t join_style; uint32_t fill_style; uint32_t fill_rule; xcb_pixmap_t tile; xcb_pixmap_t stipple; int32_t tile_stipple_x_origin; int32_t tile_stipple_y_origin; xcb_font_t font; uint32_t subwindow_mode; xcb_bool32_t graphics_exposures; int32_t clip_x_origin; int32_t clip_y_origin; xcb_pixmap_t clip_mask; uint32_t dash_offset; uint32_t dashes; uint32_t arc_mode; } xcb_create_gc_value_list_t; /** Opcode for xcb_create_gc. */ #define XCB_CREATE_GC 55 /** * @brief xcb_create_gc_request_t **/ typedef struct xcb_create_gc_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_gcontext_t cid; xcb_drawable_t drawable; uint32_t value_mask; } xcb_create_gc_request_t; /** * @brief xcb_change_gc_value_list_t **/ typedef struct xcb_change_gc_value_list_t { uint32_t function; uint32_t plane_mask; uint32_t foreground; uint32_t background; uint32_t line_width; uint32_t line_style; uint32_t cap_style; uint32_t join_style; uint32_t fill_style; uint32_t fill_rule; xcb_pixmap_t tile; xcb_pixmap_t stipple; int32_t tile_stipple_x_origin; int32_t tile_stipple_y_origin; xcb_font_t font; uint32_t subwindow_mode; xcb_bool32_t graphics_exposures; int32_t clip_x_origin; int32_t clip_y_origin; xcb_pixmap_t clip_mask; uint32_t dash_offset; uint32_t dashes; uint32_t arc_mode; } xcb_change_gc_value_list_t; /** Opcode for xcb_change_gc. */ #define XCB_CHANGE_GC 56 /** * @brief xcb_change_gc_request_t **/ typedef struct xcb_change_gc_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_gcontext_t gc; uint32_t value_mask; } xcb_change_gc_request_t; /** Opcode for xcb_copy_gc. */ #define XCB_COPY_GC 57 /** * @brief xcb_copy_gc_request_t **/ typedef struct xcb_copy_gc_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_gcontext_t src_gc; xcb_gcontext_t dst_gc; uint32_t value_mask; } xcb_copy_gc_request_t; /** Opcode for xcb_set_dashes. */ #define XCB_SET_DASHES 58 /** * @brief xcb_set_dashes_request_t **/ typedef struct xcb_set_dashes_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_gcontext_t gc; uint16_t dash_offset; uint16_t dashes_len; } xcb_set_dashes_request_t; typedef enum xcb_clip_ordering_t { XCB_CLIP_ORDERING_UNSORTED = 0, XCB_CLIP_ORDERING_Y_SORTED = 1, XCB_CLIP_ORDERING_YX_SORTED = 2, XCB_CLIP_ORDERING_YX_BANDED = 3 } xcb_clip_ordering_t; /** Opcode for xcb_set_clip_rectangles. */ #define XCB_SET_CLIP_RECTANGLES 59 /** * @brief xcb_set_clip_rectangles_request_t **/ typedef struct xcb_set_clip_rectangles_request_t { uint8_t major_opcode; uint8_t ordering; uint16_t length; xcb_gcontext_t gc; int16_t clip_x_origin; int16_t clip_y_origin; } xcb_set_clip_rectangles_request_t; /** Opcode for xcb_free_gc. */ #define XCB_FREE_GC 60 /** * @brief xcb_free_gc_request_t **/ typedef struct xcb_free_gc_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_gcontext_t gc; } xcb_free_gc_request_t; /** Opcode for xcb_clear_area. */ #define XCB_CLEAR_AREA 61 /** * @brief xcb_clear_area_request_t **/ typedef struct xcb_clear_area_request_t { uint8_t major_opcode; uint8_t exposures; uint16_t length; xcb_window_t window; int16_t x; int16_t y; uint16_t width; uint16_t height; } xcb_clear_area_request_t; /** Opcode for xcb_copy_area. */ #define XCB_COPY_AREA 62 /** * @brief xcb_copy_area_request_t **/ typedef struct xcb_copy_area_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_drawable_t src_drawable; xcb_drawable_t dst_drawable; xcb_gcontext_t gc; int16_t src_x; int16_t src_y; int16_t dst_x; int16_t dst_y; uint16_t width; uint16_t height; } xcb_copy_area_request_t; /** Opcode for xcb_copy_plane. */ #define XCB_COPY_PLANE 63 /** * @brief xcb_copy_plane_request_t **/ typedef struct xcb_copy_plane_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_drawable_t src_drawable; xcb_drawable_t dst_drawable; xcb_gcontext_t gc; int16_t src_x; int16_t src_y; int16_t dst_x; int16_t dst_y; uint16_t width; uint16_t height; uint32_t bit_plane; } xcb_copy_plane_request_t; typedef enum xcb_coord_mode_t { XCB_COORD_MODE_ORIGIN = 0, /**< Treats all coordinates as relative to the origin. */ XCB_COORD_MODE_PREVIOUS = 1 /**< Treats all coordinates after the first as relative to the previous coordinate. */ } xcb_coord_mode_t; /** Opcode for xcb_poly_point. */ #define XCB_POLY_POINT 64 /** * @brief xcb_poly_point_request_t **/ typedef struct xcb_poly_point_request_t { uint8_t major_opcode; uint8_t coordinate_mode; uint16_t length; xcb_drawable_t drawable; xcb_gcontext_t gc; } xcb_poly_point_request_t; /** Opcode for xcb_poly_line. */ #define XCB_POLY_LINE 65 /** * @brief xcb_poly_line_request_t **/ typedef struct xcb_poly_line_request_t { uint8_t major_opcode; uint8_t coordinate_mode; uint16_t length; xcb_drawable_t drawable; xcb_gcontext_t gc; } xcb_poly_line_request_t; /** * @brief xcb_segment_t **/ typedef struct xcb_segment_t { int16_t x1; int16_t y1; int16_t x2; int16_t y2; } xcb_segment_t; /** * @brief xcb_segment_iterator_t **/ typedef struct xcb_segment_iterator_t { xcb_segment_t *data; int rem; int index; } xcb_segment_iterator_t; /** Opcode for xcb_poly_segment. */ #define XCB_POLY_SEGMENT 66 /** * @brief xcb_poly_segment_request_t **/ typedef struct xcb_poly_segment_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_drawable_t drawable; xcb_gcontext_t gc; } xcb_poly_segment_request_t; /** Opcode for xcb_poly_rectangle. */ #define XCB_POLY_RECTANGLE 67 /** * @brief xcb_poly_rectangle_request_t **/ typedef struct xcb_poly_rectangle_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_drawable_t drawable; xcb_gcontext_t gc; } xcb_poly_rectangle_request_t; /** Opcode for xcb_poly_arc. */ #define XCB_POLY_ARC 68 /** * @brief xcb_poly_arc_request_t **/ typedef struct xcb_poly_arc_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_drawable_t drawable; xcb_gcontext_t gc; } xcb_poly_arc_request_t; typedef enum xcb_poly_shape_t { XCB_POLY_SHAPE_COMPLEX = 0, XCB_POLY_SHAPE_NONCONVEX = 1, XCB_POLY_SHAPE_CONVEX = 2 } xcb_poly_shape_t; /** Opcode for xcb_fill_poly. */ #define XCB_FILL_POLY 69 /** * @brief xcb_fill_poly_request_t **/ typedef struct xcb_fill_poly_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_drawable_t drawable; xcb_gcontext_t gc; uint8_t shape; uint8_t coordinate_mode; uint8_t pad1[2]; } xcb_fill_poly_request_t; /** Opcode for xcb_poly_fill_rectangle. */ #define XCB_POLY_FILL_RECTANGLE 70 /** * @brief xcb_poly_fill_rectangle_request_t **/ typedef struct xcb_poly_fill_rectangle_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_drawable_t drawable; xcb_gcontext_t gc; } xcb_poly_fill_rectangle_request_t; /** Opcode for xcb_poly_fill_arc. */ #define XCB_POLY_FILL_ARC 71 /** * @brief xcb_poly_fill_arc_request_t **/ typedef struct xcb_poly_fill_arc_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_drawable_t drawable; xcb_gcontext_t gc; } xcb_poly_fill_arc_request_t; typedef enum xcb_image_format_t { XCB_IMAGE_FORMAT_XY_BITMAP = 0, XCB_IMAGE_FORMAT_XY_PIXMAP = 1, XCB_IMAGE_FORMAT_Z_PIXMAP = 2 } xcb_image_format_t; /** Opcode for xcb_put_image. */ #define XCB_PUT_IMAGE 72 /** * @brief xcb_put_image_request_t **/ typedef struct xcb_put_image_request_t { uint8_t major_opcode; uint8_t format; uint16_t length; xcb_drawable_t drawable; xcb_gcontext_t gc; uint16_t width; uint16_t height; int16_t dst_x; int16_t dst_y; uint8_t left_pad; uint8_t depth; uint8_t pad0[2]; } xcb_put_image_request_t; /** * @brief xcb_get_image_cookie_t **/ typedef struct xcb_get_image_cookie_t { unsigned int sequence; } xcb_get_image_cookie_t; /** Opcode for xcb_get_image. */ #define XCB_GET_IMAGE 73 /** * @brief xcb_get_image_request_t **/ typedef struct xcb_get_image_request_t { uint8_t major_opcode; uint8_t format; uint16_t length; xcb_drawable_t drawable; int16_t x; int16_t y; uint16_t width; uint16_t height; uint32_t plane_mask; } xcb_get_image_request_t; /** * @brief xcb_get_image_reply_t **/ typedef struct xcb_get_image_reply_t { uint8_t response_type; uint8_t depth; uint16_t sequence; uint32_t length; xcb_visualid_t visual; uint8_t pad0[20]; } xcb_get_image_reply_t; /** Opcode for xcb_poly_text_8. */ #define XCB_POLY_TEXT_8 74 /** * @brief xcb_poly_text_8_request_t **/ typedef struct xcb_poly_text_8_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_drawable_t drawable; xcb_gcontext_t gc; int16_t x; int16_t y; } xcb_poly_text_8_request_t; /** Opcode for xcb_poly_text_16. */ #define XCB_POLY_TEXT_16 75 /** * @brief xcb_poly_text_16_request_t **/ typedef struct xcb_poly_text_16_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_drawable_t drawable; xcb_gcontext_t gc; int16_t x; int16_t y; } xcb_poly_text_16_request_t; /** Opcode for xcb_image_text_8. */ #define XCB_IMAGE_TEXT_8 76 /** * @brief xcb_image_text_8_request_t **/ typedef struct xcb_image_text_8_request_t { uint8_t major_opcode; uint8_t string_len; uint16_t length; xcb_drawable_t drawable; xcb_gcontext_t gc; int16_t x; int16_t y; } xcb_image_text_8_request_t; /** Opcode for xcb_image_text_16. */ #define XCB_IMAGE_TEXT_16 77 /** * @brief xcb_image_text_16_request_t **/ typedef struct xcb_image_text_16_request_t { uint8_t major_opcode; uint8_t string_len; uint16_t length; xcb_drawable_t drawable; xcb_gcontext_t gc; int16_t x; int16_t y; } xcb_image_text_16_request_t; typedef enum xcb_colormap_alloc_t { XCB_COLORMAP_ALLOC_NONE = 0, XCB_COLORMAP_ALLOC_ALL = 1 } xcb_colormap_alloc_t; /** Opcode for xcb_create_colormap. */ #define XCB_CREATE_COLORMAP 78 /** * @brief xcb_create_colormap_request_t **/ typedef struct xcb_create_colormap_request_t { uint8_t major_opcode; uint8_t alloc; uint16_t length; xcb_colormap_t mid; xcb_window_t window; xcb_visualid_t visual; } xcb_create_colormap_request_t; /** Opcode for xcb_free_colormap. */ #define XCB_FREE_COLORMAP 79 /** * @brief xcb_free_colormap_request_t **/ typedef struct xcb_free_colormap_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_colormap_t cmap; } xcb_free_colormap_request_t; /** Opcode for xcb_copy_colormap_and_free. */ #define XCB_COPY_COLORMAP_AND_FREE 80 /** * @brief xcb_copy_colormap_and_free_request_t **/ typedef struct xcb_copy_colormap_and_free_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_colormap_t mid; xcb_colormap_t src_cmap; } xcb_copy_colormap_and_free_request_t; /** Opcode for xcb_install_colormap. */ #define XCB_INSTALL_COLORMAP 81 /** * @brief xcb_install_colormap_request_t **/ typedef struct xcb_install_colormap_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_colormap_t cmap; } xcb_install_colormap_request_t; /** Opcode for xcb_uninstall_colormap. */ #define XCB_UNINSTALL_COLORMAP 82 /** * @brief xcb_uninstall_colormap_request_t **/ typedef struct xcb_uninstall_colormap_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_colormap_t cmap; } xcb_uninstall_colormap_request_t; /** * @brief xcb_list_installed_colormaps_cookie_t **/ typedef struct xcb_list_installed_colormaps_cookie_t { unsigned int sequence; } xcb_list_installed_colormaps_cookie_t; /** Opcode for xcb_list_installed_colormaps. */ #define XCB_LIST_INSTALLED_COLORMAPS 83 /** * @brief xcb_list_installed_colormaps_request_t **/ typedef struct xcb_list_installed_colormaps_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t window; } xcb_list_installed_colormaps_request_t; /** * @brief xcb_list_installed_colormaps_reply_t **/ typedef struct xcb_list_installed_colormaps_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t cmaps_len; uint8_t pad1[22]; } xcb_list_installed_colormaps_reply_t; /** * @brief xcb_alloc_color_cookie_t **/ typedef struct xcb_alloc_color_cookie_t { unsigned int sequence; } xcb_alloc_color_cookie_t; /** Opcode for xcb_alloc_color. */ #define XCB_ALLOC_COLOR 84 /** * @brief xcb_alloc_color_request_t **/ typedef struct xcb_alloc_color_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_colormap_t cmap; uint16_t red; uint16_t green; uint16_t blue; uint8_t pad1[2]; } xcb_alloc_color_request_t; /** * @brief xcb_alloc_color_reply_t **/ typedef struct xcb_alloc_color_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t red; uint16_t green; uint16_t blue; uint8_t pad1[2]; uint32_t pixel; } xcb_alloc_color_reply_t; /** * @brief xcb_alloc_named_color_cookie_t **/ typedef struct xcb_alloc_named_color_cookie_t { unsigned int sequence; } xcb_alloc_named_color_cookie_t; /** Opcode for xcb_alloc_named_color. */ #define XCB_ALLOC_NAMED_COLOR 85 /** * @brief xcb_alloc_named_color_request_t **/ typedef struct xcb_alloc_named_color_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_colormap_t cmap; uint16_t name_len; uint8_t pad1[2]; } xcb_alloc_named_color_request_t; /** * @brief xcb_alloc_named_color_reply_t **/ typedef struct xcb_alloc_named_color_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t pixel; uint16_t exact_red; uint16_t exact_green; uint16_t exact_blue; uint16_t visual_red; uint16_t visual_green; uint16_t visual_blue; } xcb_alloc_named_color_reply_t; /** * @brief xcb_alloc_color_cells_cookie_t **/ typedef struct xcb_alloc_color_cells_cookie_t { unsigned int sequence; } xcb_alloc_color_cells_cookie_t; /** Opcode for xcb_alloc_color_cells. */ #define XCB_ALLOC_COLOR_CELLS 86 /** * @brief xcb_alloc_color_cells_request_t **/ typedef struct xcb_alloc_color_cells_request_t { uint8_t major_opcode; uint8_t contiguous; uint16_t length; xcb_colormap_t cmap; uint16_t colors; uint16_t planes; } xcb_alloc_color_cells_request_t; /** * @brief xcb_alloc_color_cells_reply_t **/ typedef struct xcb_alloc_color_cells_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t pixels_len; uint16_t masks_len; uint8_t pad1[20]; } xcb_alloc_color_cells_reply_t; /** * @brief xcb_alloc_color_planes_cookie_t **/ typedef struct xcb_alloc_color_planes_cookie_t { unsigned int sequence; } xcb_alloc_color_planes_cookie_t; /** Opcode for xcb_alloc_color_planes. */ #define XCB_ALLOC_COLOR_PLANES 87 /** * @brief xcb_alloc_color_planes_request_t **/ typedef struct xcb_alloc_color_planes_request_t { uint8_t major_opcode; uint8_t contiguous; uint16_t length; xcb_colormap_t cmap; uint16_t colors; uint16_t reds; uint16_t greens; uint16_t blues; } xcb_alloc_color_planes_request_t; /** * @brief xcb_alloc_color_planes_reply_t **/ typedef struct xcb_alloc_color_planes_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t pixels_len; uint8_t pad1[2]; uint32_t red_mask; uint32_t green_mask; uint32_t blue_mask; uint8_t pad2[8]; } xcb_alloc_color_planes_reply_t; /** Opcode for xcb_free_colors. */ #define XCB_FREE_COLORS 88 /** * @brief xcb_free_colors_request_t **/ typedef struct xcb_free_colors_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_colormap_t cmap; uint32_t plane_mask; } xcb_free_colors_request_t; typedef enum xcb_color_flag_t { XCB_COLOR_FLAG_RED = 1, XCB_COLOR_FLAG_GREEN = 2, XCB_COLOR_FLAG_BLUE = 4 } xcb_color_flag_t; /** * @brief xcb_coloritem_t **/ typedef struct xcb_coloritem_t { uint32_t pixel; uint16_t red; uint16_t green; uint16_t blue; uint8_t flags; uint8_t pad0; } xcb_coloritem_t; /** * @brief xcb_coloritem_iterator_t **/ typedef struct xcb_coloritem_iterator_t { xcb_coloritem_t *data; int rem; int index; } xcb_coloritem_iterator_t; /** Opcode for xcb_store_colors. */ #define XCB_STORE_COLORS 89 /** * @brief xcb_store_colors_request_t **/ typedef struct xcb_store_colors_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_colormap_t cmap; } xcb_store_colors_request_t; /** Opcode for xcb_store_named_color. */ #define XCB_STORE_NAMED_COLOR 90 /** * @brief xcb_store_named_color_request_t **/ typedef struct xcb_store_named_color_request_t { uint8_t major_opcode; uint8_t flags; uint16_t length; xcb_colormap_t cmap; uint32_t pixel; uint16_t name_len; uint8_t pad0[2]; } xcb_store_named_color_request_t; /** * @brief xcb_rgb_t **/ typedef struct xcb_rgb_t { uint16_t red; uint16_t green; uint16_t blue; uint8_t pad0[2]; } xcb_rgb_t; /** * @brief xcb_rgb_iterator_t **/ typedef struct xcb_rgb_iterator_t { xcb_rgb_t *data; int rem; int index; } xcb_rgb_iterator_t; /** * @brief xcb_query_colors_cookie_t **/ typedef struct xcb_query_colors_cookie_t { unsigned int sequence; } xcb_query_colors_cookie_t; /** Opcode for xcb_query_colors. */ #define XCB_QUERY_COLORS 91 /** * @brief xcb_query_colors_request_t **/ typedef struct xcb_query_colors_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_colormap_t cmap; } xcb_query_colors_request_t; /** * @brief xcb_query_colors_reply_t **/ typedef struct xcb_query_colors_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t colors_len; uint8_t pad1[22]; } xcb_query_colors_reply_t; /** * @brief xcb_lookup_color_cookie_t **/ typedef struct xcb_lookup_color_cookie_t { unsigned int sequence; } xcb_lookup_color_cookie_t; /** Opcode for xcb_lookup_color. */ #define XCB_LOOKUP_COLOR 92 /** * @brief xcb_lookup_color_request_t **/ typedef struct xcb_lookup_color_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_colormap_t cmap; uint16_t name_len; uint8_t pad1[2]; } xcb_lookup_color_request_t; /** * @brief xcb_lookup_color_reply_t **/ typedef struct xcb_lookup_color_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t exact_red; uint16_t exact_green; uint16_t exact_blue; uint16_t visual_red; uint16_t visual_green; uint16_t visual_blue; } xcb_lookup_color_reply_t; typedef enum xcb_pixmap_enum_t { XCB_PIXMAP_NONE = 0 } xcb_pixmap_enum_t; /** Opcode for xcb_create_cursor. */ #define XCB_CREATE_CURSOR 93 /** * @brief xcb_create_cursor_request_t **/ typedef struct xcb_create_cursor_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_cursor_t cid; xcb_pixmap_t source; xcb_pixmap_t mask; uint16_t fore_red; uint16_t fore_green; uint16_t fore_blue; uint16_t back_red; uint16_t back_green; uint16_t back_blue; uint16_t x; uint16_t y; } xcb_create_cursor_request_t; typedef enum xcb_font_enum_t { XCB_FONT_NONE = 0 } xcb_font_enum_t; /** Opcode for xcb_create_glyph_cursor. */ #define XCB_CREATE_GLYPH_CURSOR 94 /** * @brief xcb_create_glyph_cursor_request_t **/ typedef struct xcb_create_glyph_cursor_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_cursor_t cid; xcb_font_t source_font; xcb_font_t mask_font; uint16_t source_char; uint16_t mask_char; uint16_t fore_red; uint16_t fore_green; uint16_t fore_blue; uint16_t back_red; uint16_t back_green; uint16_t back_blue; } xcb_create_glyph_cursor_request_t; /** Opcode for xcb_free_cursor. */ #define XCB_FREE_CURSOR 95 /** * @brief xcb_free_cursor_request_t **/ typedef struct xcb_free_cursor_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_cursor_t cursor; } xcb_free_cursor_request_t; /** Opcode for xcb_recolor_cursor. */ #define XCB_RECOLOR_CURSOR 96 /** * @brief xcb_recolor_cursor_request_t **/ typedef struct xcb_recolor_cursor_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_cursor_t cursor; uint16_t fore_red; uint16_t fore_green; uint16_t fore_blue; uint16_t back_red; uint16_t back_green; uint16_t back_blue; } xcb_recolor_cursor_request_t; typedef enum xcb_query_shape_of_t { XCB_QUERY_SHAPE_OF_LARGEST_CURSOR = 0, XCB_QUERY_SHAPE_OF_FASTEST_TILE = 1, XCB_QUERY_SHAPE_OF_FASTEST_STIPPLE = 2 } xcb_query_shape_of_t; /** * @brief xcb_query_best_size_cookie_t **/ typedef struct xcb_query_best_size_cookie_t { unsigned int sequence; } xcb_query_best_size_cookie_t; /** Opcode for xcb_query_best_size. */ #define XCB_QUERY_BEST_SIZE 97 /** * @brief xcb_query_best_size_request_t **/ typedef struct xcb_query_best_size_request_t { uint8_t major_opcode; uint8_t _class; uint16_t length; xcb_drawable_t drawable; uint16_t width; uint16_t height; } xcb_query_best_size_request_t; /** * @brief xcb_query_best_size_reply_t **/ typedef struct xcb_query_best_size_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t width; uint16_t height; } xcb_query_best_size_reply_t; /** * @brief xcb_query_extension_cookie_t **/ typedef struct xcb_query_extension_cookie_t { unsigned int sequence; } xcb_query_extension_cookie_t; /** Opcode for xcb_query_extension. */ #define XCB_QUERY_EXTENSION 98 /** * @brief xcb_query_extension_request_t **/ typedef struct xcb_query_extension_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; uint16_t name_len; uint8_t pad1[2]; } xcb_query_extension_request_t; /** * @brief xcb_query_extension_reply_t **/ typedef struct xcb_query_extension_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t present; uint8_t major_opcode; uint8_t first_event; uint8_t first_error; } xcb_query_extension_reply_t; /** * @brief xcb_list_extensions_cookie_t **/ typedef struct xcb_list_extensions_cookie_t { unsigned int sequence; } xcb_list_extensions_cookie_t; /** Opcode for xcb_list_extensions. */ #define XCB_LIST_EXTENSIONS 99 /** * @brief xcb_list_extensions_request_t **/ typedef struct xcb_list_extensions_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; } xcb_list_extensions_request_t; /** * @brief xcb_list_extensions_reply_t **/ typedef struct xcb_list_extensions_reply_t { uint8_t response_type; uint8_t names_len; uint16_t sequence; uint32_t length; uint8_t pad0[24]; } xcb_list_extensions_reply_t; /** Opcode for xcb_change_keyboard_mapping. */ #define XCB_CHANGE_KEYBOARD_MAPPING 100 /** * @brief xcb_change_keyboard_mapping_request_t **/ typedef struct xcb_change_keyboard_mapping_request_t { uint8_t major_opcode; uint8_t keycode_count; uint16_t length; xcb_keycode_t first_keycode; uint8_t keysyms_per_keycode; uint8_t pad0[2]; } xcb_change_keyboard_mapping_request_t; /** * @brief xcb_get_keyboard_mapping_cookie_t **/ typedef struct xcb_get_keyboard_mapping_cookie_t { unsigned int sequence; } xcb_get_keyboard_mapping_cookie_t; /** Opcode for xcb_get_keyboard_mapping. */ #define XCB_GET_KEYBOARD_MAPPING 101 /** * @brief xcb_get_keyboard_mapping_request_t **/ typedef struct xcb_get_keyboard_mapping_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_keycode_t first_keycode; uint8_t count; } xcb_get_keyboard_mapping_request_t; /** * @brief xcb_get_keyboard_mapping_reply_t **/ typedef struct xcb_get_keyboard_mapping_reply_t { uint8_t response_type; uint8_t keysyms_per_keycode; uint16_t sequence; uint32_t length; uint8_t pad0[24]; } xcb_get_keyboard_mapping_reply_t; typedef enum xcb_kb_t { XCB_KB_KEY_CLICK_PERCENT = 1, XCB_KB_BELL_PERCENT = 2, XCB_KB_BELL_PITCH = 4, XCB_KB_BELL_DURATION = 8, XCB_KB_LED = 16, XCB_KB_LED_MODE = 32, XCB_KB_KEY = 64, XCB_KB_AUTO_REPEAT_MODE = 128 } xcb_kb_t; typedef enum xcb_led_mode_t { XCB_LED_MODE_OFF = 0, XCB_LED_MODE_ON = 1 } xcb_led_mode_t; typedef enum xcb_auto_repeat_mode_t { XCB_AUTO_REPEAT_MODE_OFF = 0, XCB_AUTO_REPEAT_MODE_ON = 1, XCB_AUTO_REPEAT_MODE_DEFAULT = 2 } xcb_auto_repeat_mode_t; /** * @brief xcb_change_keyboard_control_value_list_t **/ typedef struct xcb_change_keyboard_control_value_list_t { int32_t key_click_percent; int32_t bell_percent; int32_t bell_pitch; int32_t bell_duration; uint32_t led; uint32_t led_mode; xcb_keycode32_t key; uint32_t auto_repeat_mode; } xcb_change_keyboard_control_value_list_t; /** Opcode for xcb_change_keyboard_control. */ #define XCB_CHANGE_KEYBOARD_CONTROL 102 /** * @brief xcb_change_keyboard_control_request_t **/ typedef struct xcb_change_keyboard_control_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; uint32_t value_mask; } xcb_change_keyboard_control_request_t; /** * @brief xcb_get_keyboard_control_cookie_t **/ typedef struct xcb_get_keyboard_control_cookie_t { unsigned int sequence; } xcb_get_keyboard_control_cookie_t; /** Opcode for xcb_get_keyboard_control. */ #define XCB_GET_KEYBOARD_CONTROL 103 /** * @brief xcb_get_keyboard_control_request_t **/ typedef struct xcb_get_keyboard_control_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; } xcb_get_keyboard_control_request_t; /** * @brief xcb_get_keyboard_control_reply_t **/ typedef struct xcb_get_keyboard_control_reply_t { uint8_t response_type; uint8_t global_auto_repeat; uint16_t sequence; uint32_t length; uint32_t led_mask; uint8_t key_click_percent; uint8_t bell_percent; uint16_t bell_pitch; uint16_t bell_duration; uint8_t pad0[2]; uint8_t auto_repeats[32]; } xcb_get_keyboard_control_reply_t; /** Opcode for xcb_bell. */ #define XCB_BELL 104 /** * @brief xcb_bell_request_t **/ typedef struct xcb_bell_request_t { uint8_t major_opcode; int8_t percent; uint16_t length; } xcb_bell_request_t; /** Opcode for xcb_change_pointer_control. */ #define XCB_CHANGE_POINTER_CONTROL 105 /** * @brief xcb_change_pointer_control_request_t **/ typedef struct xcb_change_pointer_control_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; int16_t acceleration_numerator; int16_t acceleration_denominator; int16_t threshold; uint8_t do_acceleration; uint8_t do_threshold; } xcb_change_pointer_control_request_t; /** * @brief xcb_get_pointer_control_cookie_t **/ typedef struct xcb_get_pointer_control_cookie_t { unsigned int sequence; } xcb_get_pointer_control_cookie_t; /** Opcode for xcb_get_pointer_control. */ #define XCB_GET_POINTER_CONTROL 106 /** * @brief xcb_get_pointer_control_request_t **/ typedef struct xcb_get_pointer_control_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; } xcb_get_pointer_control_request_t; /** * @brief xcb_get_pointer_control_reply_t **/ typedef struct xcb_get_pointer_control_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t acceleration_numerator; uint16_t acceleration_denominator; uint16_t threshold; uint8_t pad1[18]; } xcb_get_pointer_control_reply_t; typedef enum xcb_blanking_t { XCB_BLANKING_NOT_PREFERRED = 0, XCB_BLANKING_PREFERRED = 1, XCB_BLANKING_DEFAULT = 2 } xcb_blanking_t; typedef enum xcb_exposures_t { XCB_EXPOSURES_NOT_ALLOWED = 0, XCB_EXPOSURES_ALLOWED = 1, XCB_EXPOSURES_DEFAULT = 2 } xcb_exposures_t; /** Opcode for xcb_set_screen_saver. */ #define XCB_SET_SCREEN_SAVER 107 /** * @brief xcb_set_screen_saver_request_t **/ typedef struct xcb_set_screen_saver_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; int16_t timeout; int16_t interval; uint8_t prefer_blanking; uint8_t allow_exposures; } xcb_set_screen_saver_request_t; /** * @brief xcb_get_screen_saver_cookie_t **/ typedef struct xcb_get_screen_saver_cookie_t { unsigned int sequence; } xcb_get_screen_saver_cookie_t; /** Opcode for xcb_get_screen_saver. */ #define XCB_GET_SCREEN_SAVER 108 /** * @brief xcb_get_screen_saver_request_t **/ typedef struct xcb_get_screen_saver_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; } xcb_get_screen_saver_request_t; /** * @brief xcb_get_screen_saver_reply_t **/ typedef struct xcb_get_screen_saver_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t timeout; uint16_t interval; uint8_t prefer_blanking; uint8_t allow_exposures; uint8_t pad1[18]; } xcb_get_screen_saver_reply_t; typedef enum xcb_host_mode_t { XCB_HOST_MODE_INSERT = 0, XCB_HOST_MODE_DELETE = 1 } xcb_host_mode_t; typedef enum xcb_family_t { XCB_FAMILY_INTERNET = 0, XCB_FAMILY_DECNET = 1, XCB_FAMILY_CHAOS = 2, XCB_FAMILY_SERVER_INTERPRETED = 5, XCB_FAMILY_INTERNET_6 = 6 } xcb_family_t; /** Opcode for xcb_change_hosts. */ #define XCB_CHANGE_HOSTS 109 /** * @brief xcb_change_hosts_request_t **/ typedef struct xcb_change_hosts_request_t { uint8_t major_opcode; uint8_t mode; uint16_t length; uint8_t family; uint8_t pad0; uint16_t address_len; } xcb_change_hosts_request_t; /** * @brief xcb_host_t **/ typedef struct xcb_host_t { uint8_t family; uint8_t pad0; uint16_t address_len; } xcb_host_t; /** * @brief xcb_host_iterator_t **/ typedef struct xcb_host_iterator_t { xcb_host_t *data; int rem; int index; } xcb_host_iterator_t; /** * @brief xcb_list_hosts_cookie_t **/ typedef struct xcb_list_hosts_cookie_t { unsigned int sequence; } xcb_list_hosts_cookie_t; /** Opcode for xcb_list_hosts. */ #define XCB_LIST_HOSTS 110 /** * @brief xcb_list_hosts_request_t **/ typedef struct xcb_list_hosts_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; } xcb_list_hosts_request_t; /** * @brief xcb_list_hosts_reply_t **/ typedef struct xcb_list_hosts_reply_t { uint8_t response_type; uint8_t mode; uint16_t sequence; uint32_t length; uint16_t hosts_len; uint8_t pad0[22]; } xcb_list_hosts_reply_t; typedef enum xcb_access_control_t { XCB_ACCESS_CONTROL_DISABLE = 0, XCB_ACCESS_CONTROL_ENABLE = 1 } xcb_access_control_t; /** Opcode for xcb_set_access_control. */ #define XCB_SET_ACCESS_CONTROL 111 /** * @brief xcb_set_access_control_request_t **/ typedef struct xcb_set_access_control_request_t { uint8_t major_opcode; uint8_t mode; uint16_t length; } xcb_set_access_control_request_t; typedef enum xcb_close_down_t { XCB_CLOSE_DOWN_DESTROY_ALL = 0, XCB_CLOSE_DOWN_RETAIN_PERMANENT = 1, XCB_CLOSE_DOWN_RETAIN_TEMPORARY = 2 } xcb_close_down_t; /** Opcode for xcb_set_close_down_mode. */ #define XCB_SET_CLOSE_DOWN_MODE 112 /** * @brief xcb_set_close_down_mode_request_t **/ typedef struct xcb_set_close_down_mode_request_t { uint8_t major_opcode; uint8_t mode; uint16_t length; } xcb_set_close_down_mode_request_t; typedef enum xcb_kill_t { XCB_KILL_ALL_TEMPORARY = 0 } xcb_kill_t; /** Opcode for xcb_kill_client. */ #define XCB_KILL_CLIENT 113 /** * @brief xcb_kill_client_request_t **/ typedef struct xcb_kill_client_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; uint32_t resource; } xcb_kill_client_request_t; /** Opcode for xcb_rotate_properties. */ #define XCB_ROTATE_PROPERTIES 114 /** * @brief xcb_rotate_properties_request_t **/ typedef struct xcb_rotate_properties_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; xcb_window_t window; uint16_t atoms_len; int16_t delta; } xcb_rotate_properties_request_t; typedef enum xcb_screen_saver_t { XCB_SCREEN_SAVER_RESET = 0, XCB_SCREEN_SAVER_ACTIVE = 1 } xcb_screen_saver_t; /** Opcode for xcb_force_screen_saver. */ #define XCB_FORCE_SCREEN_SAVER 115 /** * @brief xcb_force_screen_saver_request_t **/ typedef struct xcb_force_screen_saver_request_t { uint8_t major_opcode; uint8_t mode; uint16_t length; } xcb_force_screen_saver_request_t; typedef enum xcb_mapping_status_t { XCB_MAPPING_STATUS_SUCCESS = 0, XCB_MAPPING_STATUS_BUSY = 1, XCB_MAPPING_STATUS_FAILURE = 2 } xcb_mapping_status_t; /** * @brief xcb_set_pointer_mapping_cookie_t **/ typedef struct xcb_set_pointer_mapping_cookie_t { unsigned int sequence; } xcb_set_pointer_mapping_cookie_t; /** Opcode for xcb_set_pointer_mapping. */ #define XCB_SET_POINTER_MAPPING 116 /** * @brief xcb_set_pointer_mapping_request_t **/ typedef struct xcb_set_pointer_mapping_request_t { uint8_t major_opcode; uint8_t map_len; uint16_t length; } xcb_set_pointer_mapping_request_t; /** * @brief xcb_set_pointer_mapping_reply_t **/ typedef struct xcb_set_pointer_mapping_reply_t { uint8_t response_type; uint8_t status; uint16_t sequence; uint32_t length; } xcb_set_pointer_mapping_reply_t; /** * @brief xcb_get_pointer_mapping_cookie_t **/ typedef struct xcb_get_pointer_mapping_cookie_t { unsigned int sequence; } xcb_get_pointer_mapping_cookie_t; /** Opcode for xcb_get_pointer_mapping. */ #define XCB_GET_POINTER_MAPPING 117 /** * @brief xcb_get_pointer_mapping_request_t **/ typedef struct xcb_get_pointer_mapping_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; } xcb_get_pointer_mapping_request_t; /** * @brief xcb_get_pointer_mapping_reply_t **/ typedef struct xcb_get_pointer_mapping_reply_t { uint8_t response_type; uint8_t map_len; uint16_t sequence; uint32_t length; uint8_t pad0[24]; } xcb_get_pointer_mapping_reply_t; typedef enum xcb_map_index_t { XCB_MAP_INDEX_SHIFT = 0, XCB_MAP_INDEX_LOCK = 1, XCB_MAP_INDEX_CONTROL = 2, XCB_MAP_INDEX_1 = 3, XCB_MAP_INDEX_2 = 4, XCB_MAP_INDEX_3 = 5, XCB_MAP_INDEX_4 = 6, XCB_MAP_INDEX_5 = 7 } xcb_map_index_t; /** * @brief xcb_set_modifier_mapping_cookie_t **/ typedef struct xcb_set_modifier_mapping_cookie_t { unsigned int sequence; } xcb_set_modifier_mapping_cookie_t; /** Opcode for xcb_set_modifier_mapping. */ #define XCB_SET_MODIFIER_MAPPING 118 /** * @brief xcb_set_modifier_mapping_request_t **/ typedef struct xcb_set_modifier_mapping_request_t { uint8_t major_opcode; uint8_t keycodes_per_modifier; uint16_t length; } xcb_set_modifier_mapping_request_t; /** * @brief xcb_set_modifier_mapping_reply_t **/ typedef struct xcb_set_modifier_mapping_reply_t { uint8_t response_type; uint8_t status; uint16_t sequence; uint32_t length; } xcb_set_modifier_mapping_reply_t; /** * @brief xcb_get_modifier_mapping_cookie_t **/ typedef struct xcb_get_modifier_mapping_cookie_t { unsigned int sequence; } xcb_get_modifier_mapping_cookie_t; /** Opcode for xcb_get_modifier_mapping. */ #define XCB_GET_MODIFIER_MAPPING 119 /** * @brief xcb_get_modifier_mapping_request_t **/ typedef struct xcb_get_modifier_mapping_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; } xcb_get_modifier_mapping_request_t; /** * @brief xcb_get_modifier_mapping_reply_t **/ typedef struct xcb_get_modifier_mapping_reply_t { uint8_t response_type; uint8_t keycodes_per_modifier; uint16_t sequence; uint32_t length; uint8_t pad0[24]; } xcb_get_modifier_mapping_reply_t; /** Opcode for xcb_no_operation. */ #define XCB_NO_OPERATION 127 /** * @brief xcb_no_operation_request_t **/ typedef struct xcb_no_operation_request_t { uint8_t major_opcode; uint8_t pad0; uint16_t length; } xcb_no_operation_request_t; /** * Get the next element of the iterator * @param i Pointer to a xcb_char2b_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_char2b_t) */ void xcb_char2b_next (xcb_char2b_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_char2b_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_char2b_end (xcb_char2b_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_window_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_window_t) */ void xcb_window_next (xcb_window_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_window_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_window_end (xcb_window_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_pixmap_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_pixmap_t) */ void xcb_pixmap_next (xcb_pixmap_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_pixmap_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_pixmap_end (xcb_pixmap_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_cursor_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_cursor_t) */ void xcb_cursor_next (xcb_cursor_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_cursor_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_cursor_end (xcb_cursor_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_font_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_font_t) */ void xcb_font_next (xcb_font_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_font_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_font_end (xcb_font_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_gcontext_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_gcontext_t) */ void xcb_gcontext_next (xcb_gcontext_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_gcontext_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_gcontext_end (xcb_gcontext_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_colormap_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_colormap_t) */ void xcb_colormap_next (xcb_colormap_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_colormap_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_colormap_end (xcb_colormap_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_atom_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_atom_t) */ void xcb_atom_next (xcb_atom_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_atom_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_atom_end (xcb_atom_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_drawable_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_drawable_t) */ void xcb_drawable_next (xcb_drawable_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_drawable_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_drawable_end (xcb_drawable_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_fontable_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_fontable_t) */ void xcb_fontable_next (xcb_fontable_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_fontable_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_fontable_end (xcb_fontable_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_bool32_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_bool32_t) */ void xcb_bool32_next (xcb_bool32_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_bool32_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_bool32_end (xcb_bool32_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_visualid_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_visualid_t) */ void xcb_visualid_next (xcb_visualid_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_visualid_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_visualid_end (xcb_visualid_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_timestamp_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_timestamp_t) */ void xcb_timestamp_next (xcb_timestamp_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_timestamp_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_timestamp_end (xcb_timestamp_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_keysym_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_keysym_t) */ void xcb_keysym_next (xcb_keysym_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_keysym_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_keysym_end (xcb_keysym_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_keycode_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_keycode_t) */ void xcb_keycode_next (xcb_keycode_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_keycode_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_keycode_end (xcb_keycode_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_keycode32_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_keycode32_t) */ void xcb_keycode32_next (xcb_keycode32_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_keycode32_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_keycode32_end (xcb_keycode32_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_button_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_button_t) */ void xcb_button_next (xcb_button_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_button_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_button_end (xcb_button_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_point_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_point_t) */ void xcb_point_next (xcb_point_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_point_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_point_end (xcb_point_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_rectangle_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_rectangle_t) */ void xcb_rectangle_next (xcb_rectangle_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_rectangle_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_rectangle_end (xcb_rectangle_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_arc_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_arc_t) */ void xcb_arc_next (xcb_arc_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_arc_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_arc_end (xcb_arc_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_format_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_format_t) */ void xcb_format_next (xcb_format_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_format_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_format_end (xcb_format_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_visualtype_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_visualtype_t) */ void xcb_visualtype_next (xcb_visualtype_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_visualtype_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_visualtype_end (xcb_visualtype_iterator_t i); int xcb_depth_sizeof (const void *_buffer); xcb_visualtype_t * xcb_depth_visuals (const xcb_depth_t *R); int xcb_depth_visuals_length (const xcb_depth_t *R); xcb_visualtype_iterator_t xcb_depth_visuals_iterator (const xcb_depth_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_depth_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_depth_t) */ void xcb_depth_next (xcb_depth_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_depth_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_depth_end (xcb_depth_iterator_t i); int xcb_screen_sizeof (const void *_buffer); int xcb_screen_allowed_depths_length (const xcb_screen_t *R); xcb_depth_iterator_t xcb_screen_allowed_depths_iterator (const xcb_screen_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_screen_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_screen_t) */ void xcb_screen_next (xcb_screen_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_screen_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_screen_end (xcb_screen_iterator_t i); int xcb_setup_request_sizeof (const void *_buffer); char * xcb_setup_request_authorization_protocol_name (const xcb_setup_request_t *R); int xcb_setup_request_authorization_protocol_name_length (const xcb_setup_request_t *R); xcb_generic_iterator_t xcb_setup_request_authorization_protocol_name_end (const xcb_setup_request_t *R); char * xcb_setup_request_authorization_protocol_data (const xcb_setup_request_t *R); int xcb_setup_request_authorization_protocol_data_length (const xcb_setup_request_t *R); xcb_generic_iterator_t xcb_setup_request_authorization_protocol_data_end (const xcb_setup_request_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_setup_request_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_setup_request_t) */ void xcb_setup_request_next (xcb_setup_request_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_setup_request_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_setup_request_end (xcb_setup_request_iterator_t i); int xcb_setup_failed_sizeof (const void *_buffer); char * xcb_setup_failed_reason (const xcb_setup_failed_t *R); int xcb_setup_failed_reason_length (const xcb_setup_failed_t *R); xcb_generic_iterator_t xcb_setup_failed_reason_end (const xcb_setup_failed_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_setup_failed_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_setup_failed_t) */ void xcb_setup_failed_next (xcb_setup_failed_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_setup_failed_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_setup_failed_end (xcb_setup_failed_iterator_t i); int xcb_setup_authenticate_sizeof (const void *_buffer); char * xcb_setup_authenticate_reason (const xcb_setup_authenticate_t *R); int xcb_setup_authenticate_reason_length (const xcb_setup_authenticate_t *R); xcb_generic_iterator_t xcb_setup_authenticate_reason_end (const xcb_setup_authenticate_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_setup_authenticate_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_setup_authenticate_t) */ void xcb_setup_authenticate_next (xcb_setup_authenticate_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_setup_authenticate_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_setup_authenticate_end (xcb_setup_authenticate_iterator_t i); int xcb_setup_sizeof (const void *_buffer); char * xcb_setup_vendor (const xcb_setup_t *R); int xcb_setup_vendor_length (const xcb_setup_t *R); xcb_generic_iterator_t xcb_setup_vendor_end (const xcb_setup_t *R); xcb_format_t * xcb_setup_pixmap_formats (const xcb_setup_t *R); int xcb_setup_pixmap_formats_length (const xcb_setup_t *R); xcb_format_iterator_t xcb_setup_pixmap_formats_iterator (const xcb_setup_t *R); int xcb_setup_roots_length (const xcb_setup_t *R); xcb_screen_iterator_t xcb_setup_roots_iterator (const xcb_setup_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_setup_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_setup_t) */ void xcb_setup_next (xcb_setup_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_setup_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_setup_end (xcb_setup_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_client_message_data_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_client_message_data_t) */ void xcb_client_message_data_next (xcb_client_message_data_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_client_message_data_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_client_message_data_end (xcb_client_message_data_iterator_t i); int xcb_create_window_value_list_serialize (void **_buffer, uint32_t value_mask, const xcb_create_window_value_list_t *_aux); int xcb_create_window_value_list_unpack (const void *_buffer, uint32_t value_mask, xcb_create_window_value_list_t *_aux); int xcb_create_window_value_list_sizeof (const void *_buffer, uint32_t value_mask); int xcb_create_window_sizeof (const void *_buffer); /** * @brief Creates a window * * @param c The connection * @param depth Specifies the new window's depth (TODO: what unit?). * \n * The special value `XCB_COPY_FROM_PARENT` means the depth is taken from the * \a parent window. * @param wid The ID with which you will refer to the new window, created by * `xcb_generate_id`. * @param parent The parent window of the new window. * @param x The X coordinate of the new window. * @param y The Y coordinate of the new window. * @param width The width of the new window. * @param height The height of the new window. * @param border_width TODO: * \n * Must be zero if the `class` is `InputOnly` or a `xcb_match_error_t` occurs. * @param _class A bitmask of #xcb_window_class_t values. * @param _class \n * @param visual Specifies the id for the new window's visual. * \n * The special value `XCB_COPY_FROM_PARENT` means the visual is taken from the * \a parent window. * @param value_mask A bitmask of #xcb_cw_t values. * @return A cookie * * Creates an unmapped window as child of the specified \a parent window. A * CreateNotify event will be generated. The new window is placed on top in the * stacking order with respect to siblings. * * The coordinate system has the X axis horizontal and the Y axis vertical with * the origin [0, 0] at the upper-left corner. Coordinates are integral, in terms * of pixels, and coincide with pixel centers. Each window and pixmap has its own * coordinate system. For a window, the origin is inside the border at the inside, * upper-left corner. * * The created window is not yet displayed (mapped), call `xcb_map_window` to * display it. * * The created window will initially use the same cursor as its parent. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_create_window_checked (xcb_connection_t *c, uint8_t depth, xcb_window_t wid, xcb_window_t parent, int16_t x, int16_t y, uint16_t width, uint16_t height, uint16_t border_width, uint16_t _class, xcb_visualid_t visual, uint32_t value_mask, const void *value_list); /** * @brief Creates a window * * @param c The connection * @param depth Specifies the new window's depth (TODO: what unit?). * \n * The special value `XCB_COPY_FROM_PARENT` means the depth is taken from the * \a parent window. * @param wid The ID with which you will refer to the new window, created by * `xcb_generate_id`. * @param parent The parent window of the new window. * @param x The X coordinate of the new window. * @param y The Y coordinate of the new window. * @param width The width of the new window. * @param height The height of the new window. * @param border_width TODO: * \n * Must be zero if the `class` is `InputOnly` or a `xcb_match_error_t` occurs. * @param _class A bitmask of #xcb_window_class_t values. * @param _class \n * @param visual Specifies the id for the new window's visual. * \n * The special value `XCB_COPY_FROM_PARENT` means the visual is taken from the * \a parent window. * @param value_mask A bitmask of #xcb_cw_t values. * @return A cookie * * Creates an unmapped window as child of the specified \a parent window. A * CreateNotify event will be generated. The new window is placed on top in the * stacking order with respect to siblings. * * The coordinate system has the X axis horizontal and the Y axis vertical with * the origin [0, 0] at the upper-left corner. Coordinates are integral, in terms * of pixels, and coincide with pixel centers. Each window and pixmap has its own * coordinate system. For a window, the origin is inside the border at the inside, * upper-left corner. * * The created window is not yet displayed (mapped), call `xcb_map_window` to * display it. * * The created window will initially use the same cursor as its parent. * */ xcb_void_cookie_t xcb_create_window (xcb_connection_t *c, uint8_t depth, xcb_window_t wid, xcb_window_t parent, int16_t x, int16_t y, uint16_t width, uint16_t height, uint16_t border_width, uint16_t _class, xcb_visualid_t visual, uint32_t value_mask, const void *value_list); /** * @brief Creates a window * * @param c The connection * @param depth Specifies the new window's depth (TODO: what unit?). * \n * The special value `XCB_COPY_FROM_PARENT` means the depth is taken from the * \a parent window. * @param wid The ID with which you will refer to the new window, created by * `xcb_generate_id`. * @param parent The parent window of the new window. * @param x The X coordinate of the new window. * @param y The Y coordinate of the new window. * @param width The width of the new window. * @param height The height of the new window. * @param border_width TODO: * \n * Must be zero if the `class` is `InputOnly` or a `xcb_match_error_t` occurs. * @param _class A bitmask of #xcb_window_class_t values. * @param _class \n * @param visual Specifies the id for the new window's visual. * \n * The special value `XCB_COPY_FROM_PARENT` means the visual is taken from the * \a parent window. * @param value_mask A bitmask of #xcb_cw_t values. * @return A cookie * * Creates an unmapped window as child of the specified \a parent window. A * CreateNotify event will be generated. The new window is placed on top in the * stacking order with respect to siblings. * * The coordinate system has the X axis horizontal and the Y axis vertical with * the origin [0, 0] at the upper-left corner. Coordinates are integral, in terms * of pixels, and coincide with pixel centers. Each window and pixmap has its own * coordinate system. For a window, the origin is inside the border at the inside, * upper-left corner. * * The created window is not yet displayed (mapped), call `xcb_map_window` to * display it. * * The created window will initially use the same cursor as its parent. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_create_window_aux_checked (xcb_connection_t *c, uint8_t depth, xcb_window_t wid, xcb_window_t parent, int16_t x, int16_t y, uint16_t width, uint16_t height, uint16_t border_width, uint16_t _class, xcb_visualid_t visual, uint32_t value_mask, const xcb_create_window_value_list_t *value_list); /** * @brief Creates a window * * @param c The connection * @param depth Specifies the new window's depth (TODO: what unit?). * \n * The special value `XCB_COPY_FROM_PARENT` means the depth is taken from the * \a parent window. * @param wid The ID with which you will refer to the new window, created by * `xcb_generate_id`. * @param parent The parent window of the new window. * @param x The X coordinate of the new window. * @param y The Y coordinate of the new window. * @param width The width of the new window. * @param height The height of the new window. * @param border_width TODO: * \n * Must be zero if the `class` is `InputOnly` or a `xcb_match_error_t` occurs. * @param _class A bitmask of #xcb_window_class_t values. * @param _class \n * @param visual Specifies the id for the new window's visual. * \n * The special value `XCB_COPY_FROM_PARENT` means the visual is taken from the * \a parent window. * @param value_mask A bitmask of #xcb_cw_t values. * @return A cookie * * Creates an unmapped window as child of the specified \a parent window. A * CreateNotify event will be generated. The new window is placed on top in the * stacking order with respect to siblings. * * The coordinate system has the X axis horizontal and the Y axis vertical with * the origin [0, 0] at the upper-left corner. Coordinates are integral, in terms * of pixels, and coincide with pixel centers. Each window and pixmap has its own * coordinate system. For a window, the origin is inside the border at the inside, * upper-left corner. * * The created window is not yet displayed (mapped), call `xcb_map_window` to * display it. * * The created window will initially use the same cursor as its parent. * */ xcb_void_cookie_t xcb_create_window_aux (xcb_connection_t *c, uint8_t depth, xcb_window_t wid, xcb_window_t parent, int16_t x, int16_t y, uint16_t width, uint16_t height, uint16_t border_width, uint16_t _class, xcb_visualid_t visual, uint32_t value_mask, const xcb_create_window_value_list_t *value_list); void * xcb_create_window_value_list (const xcb_create_window_request_t *R); int xcb_change_window_attributes_value_list_serialize (void **_buffer, uint32_t value_mask, const xcb_change_window_attributes_value_list_t *_aux); int xcb_change_window_attributes_value_list_unpack (const void *_buffer, uint32_t value_mask, xcb_change_window_attributes_value_list_t *_aux); int xcb_change_window_attributes_value_list_sizeof (const void *_buffer, uint32_t value_mask); int xcb_change_window_attributes_sizeof (const void *_buffer); /** * @brief change window attributes * * @param c The connection * @param window The window to change. * @param value_mask A bitmask of #xcb_cw_t values. * @param value_mask \n * @param value_list Values for each of the attributes specified in the bitmask \a value_mask. The * order has to correspond to the order of possible \a value_mask bits. See the * example. * @return A cookie * * Changes the attributes specified by \a value_mask for the specified \a window. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_change_window_attributes_checked (xcb_connection_t *c, xcb_window_t window, uint32_t value_mask, const void *value_list); /** * @brief change window attributes * * @param c The connection * @param window The window to change. * @param value_mask A bitmask of #xcb_cw_t values. * @param value_mask \n * @param value_list Values for each of the attributes specified in the bitmask \a value_mask. The * order has to correspond to the order of possible \a value_mask bits. See the * example. * @return A cookie * * Changes the attributes specified by \a value_mask for the specified \a window. * */ xcb_void_cookie_t xcb_change_window_attributes (xcb_connection_t *c, xcb_window_t window, uint32_t value_mask, const void *value_list); /** * @brief change window attributes * * @param c The connection * @param window The window to change. * @param value_mask A bitmask of #xcb_cw_t values. * @param value_mask \n * @param value_list Values for each of the attributes specified in the bitmask \a value_mask. The * order has to correspond to the order of possible \a value_mask bits. See the * example. * @return A cookie * * Changes the attributes specified by \a value_mask for the specified \a window. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_change_window_attributes_aux_checked (xcb_connection_t *c, xcb_window_t window, uint32_t value_mask, const xcb_change_window_attributes_value_list_t *value_list); /** * @brief change window attributes * * @param c The connection * @param window The window to change. * @param value_mask A bitmask of #xcb_cw_t values. * @param value_mask \n * @param value_list Values for each of the attributes specified in the bitmask \a value_mask. The * order has to correspond to the order of possible \a value_mask bits. See the * example. * @return A cookie * * Changes the attributes specified by \a value_mask for the specified \a window. * */ xcb_void_cookie_t xcb_change_window_attributes_aux (xcb_connection_t *c, xcb_window_t window, uint32_t value_mask, const xcb_change_window_attributes_value_list_t *value_list); void * xcb_change_window_attributes_value_list (const xcb_change_window_attributes_request_t *R); /** * @brief Gets window attributes * * @param c The connection * @param window The window to get the attributes from. * @return A cookie * * Gets the current attributes for the specified \a window. * */ xcb_get_window_attributes_cookie_t xcb_get_window_attributes (xcb_connection_t *c, xcb_window_t window); /** * @brief Gets window attributes * * @param c The connection * @param window The window to get the attributes from. * @return A cookie * * Gets the current attributes for the specified \a window. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_get_window_attributes_cookie_t xcb_get_window_attributes_unchecked (xcb_connection_t *c, xcb_window_t window); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_get_window_attributes_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_get_window_attributes_reply_t * xcb_get_window_attributes_reply (xcb_connection_t *c, xcb_get_window_attributes_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * @brief Destroys a window * * @param c The connection * @param window The window to destroy. * @return A cookie * * Destroys the specified window and all of its subwindows. A DestroyNotify event * is generated for each destroyed window (a DestroyNotify event is first generated * for any given window's inferiors). If the window was mapped, it will be * automatically unmapped before destroying. * * Calling DestroyWindow on the root window will do nothing. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_destroy_window_checked (xcb_connection_t *c, xcb_window_t window); /** * @brief Destroys a window * * @param c The connection * @param window The window to destroy. * @return A cookie * * Destroys the specified window and all of its subwindows. A DestroyNotify event * is generated for each destroyed window (a DestroyNotify event is first generated * for any given window's inferiors). If the window was mapped, it will be * automatically unmapped before destroying. * * Calling DestroyWindow on the root window will do nothing. * */ xcb_void_cookie_t xcb_destroy_window (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_destroy_subwindows_checked (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_destroy_subwindows (xcb_connection_t *c, xcb_window_t window); /** * @brief Changes a client's save set * * @param c The connection * @param mode A bitmask of #xcb_set_mode_t values. * @param mode Insert to add the specified window to the save set or Delete to delete it from the save set. * @param window The window to add or delete to/from your save set. * @return A cookie * * TODO: explain what the save set is for. * * This function either adds or removes the specified window to the client's (your * application's) save set. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_change_save_set_checked (xcb_connection_t *c, uint8_t mode, xcb_window_t window); /** * @brief Changes a client's save set * * @param c The connection * @param mode A bitmask of #xcb_set_mode_t values. * @param mode Insert to add the specified window to the save set or Delete to delete it from the save set. * @param window The window to add or delete to/from your save set. * @return A cookie * * TODO: explain what the save set is for. * * This function either adds or removes the specified window to the client's (your * application's) save set. * */ xcb_void_cookie_t xcb_change_save_set (xcb_connection_t *c, uint8_t mode, xcb_window_t window); /** * @brief Reparents a window * * @param c The connection * @param window The window to reparent. * @param parent The new parent of the window. * @param x The X position of the window within its new parent. * @param y The Y position of the window within its new parent. * @return A cookie * * Makes the specified window a child of the specified parent window. If the * window is mapped, it will automatically be unmapped before reparenting and * re-mapped after reparenting. The window is placed in the stacking order on top * with respect to sibling windows. * * After reparenting, a ReparentNotify event is generated. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_reparent_window_checked (xcb_connection_t *c, xcb_window_t window, xcb_window_t parent, int16_t x, int16_t y); /** * @brief Reparents a window * * @param c The connection * @param window The window to reparent. * @param parent The new parent of the window. * @param x The X position of the window within its new parent. * @param y The Y position of the window within its new parent. * @return A cookie * * Makes the specified window a child of the specified parent window. If the * window is mapped, it will automatically be unmapped before reparenting and * re-mapped after reparenting. The window is placed in the stacking order on top * with respect to sibling windows. * * After reparenting, a ReparentNotify event is generated. * */ xcb_void_cookie_t xcb_reparent_window (xcb_connection_t *c, xcb_window_t window, xcb_window_t parent, int16_t x, int16_t y); /** * @brief Makes a window visible * * @param c The connection * @param window The window to make visible. * @return A cookie * * Maps the specified window. This means making the window visible (as long as its * parent is visible). * * This MapWindow request will be translated to a MapRequest request if a window * manager is running. The window manager then decides to either map the window or * not. Set the override-redirect window attribute to true if you want to bypass * this mechanism. * * If the window manager decides to map the window (or if no window manager is * running), a MapNotify event is generated. * * If the window becomes viewable and no earlier contents for it are remembered, * the X server tiles the window with its background. If the window's background * is undefined, the existing screen contents are not altered, and the X server * generates zero or more Expose events. * * If the window type is InputOutput, an Expose event will be generated when the * window becomes visible. The normal response to an Expose event should be to * repaint the window. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_map_window_checked (xcb_connection_t *c, xcb_window_t window); /** * @brief Makes a window visible * * @param c The connection * @param window The window to make visible. * @return A cookie * * Maps the specified window. This means making the window visible (as long as its * parent is visible). * * This MapWindow request will be translated to a MapRequest request if a window * manager is running. The window manager then decides to either map the window or * not. Set the override-redirect window attribute to true if you want to bypass * this mechanism. * * If the window manager decides to map the window (or if no window manager is * running), a MapNotify event is generated. * * If the window becomes viewable and no earlier contents for it are remembered, * the X server tiles the window with its background. If the window's background * is undefined, the existing screen contents are not altered, and the X server * generates zero or more Expose events. * * If the window type is InputOutput, an Expose event will be generated when the * window becomes visible. The normal response to an Expose event should be to * repaint the window. * */ xcb_void_cookie_t xcb_map_window (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_map_subwindows_checked (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_map_subwindows (xcb_connection_t *c, xcb_window_t window); /** * @brief Makes a window invisible * * @param c The connection * @param window The window to make invisible. * @return A cookie * * Unmaps the specified window. This means making the window invisible (and all * its child windows). * * Unmapping a window leads to the `UnmapNotify` event being generated. Also, * `Expose` events are generated for formerly obscured windows. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_unmap_window_checked (xcb_connection_t *c, xcb_window_t window); /** * @brief Makes a window invisible * * @param c The connection * @param window The window to make invisible. * @return A cookie * * Unmaps the specified window. This means making the window invisible (and all * its child windows). * * Unmapping a window leads to the `UnmapNotify` event being generated. Also, * `Expose` events are generated for formerly obscured windows. * */ xcb_void_cookie_t xcb_unmap_window (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_unmap_subwindows_checked (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_unmap_subwindows (xcb_connection_t *c, xcb_window_t window); int xcb_configure_window_value_list_serialize (void **_buffer, uint16_t value_mask, const xcb_configure_window_value_list_t *_aux); int xcb_configure_window_value_list_unpack (const void *_buffer, uint16_t value_mask, xcb_configure_window_value_list_t *_aux); int xcb_configure_window_value_list_sizeof (const void *_buffer, uint16_t value_mask); int xcb_configure_window_sizeof (const void *_buffer); /** * @brief Configures window attributes * * @param c The connection * @param window The window to configure. * @param value_mask Bitmask of attributes to change. * @param value_list New values, corresponding to the attributes in value_mask. The order has to * correspond to the order of possible \a value_mask bits. See the example. * @return A cookie * * Configures a window's size, position, border width and stacking order. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_configure_window_checked (xcb_connection_t *c, xcb_window_t window, uint16_t value_mask, const void *value_list); /** * @brief Configures window attributes * * @param c The connection * @param window The window to configure. * @param value_mask Bitmask of attributes to change. * @param value_list New values, corresponding to the attributes in value_mask. The order has to * correspond to the order of possible \a value_mask bits. See the example. * @return A cookie * * Configures a window's size, position, border width and stacking order. * */ xcb_void_cookie_t xcb_configure_window (xcb_connection_t *c, xcb_window_t window, uint16_t value_mask, const void *value_list); /** * @brief Configures window attributes * * @param c The connection * @param window The window to configure. * @param value_mask Bitmask of attributes to change. * @param value_list New values, corresponding to the attributes in value_mask. The order has to * correspond to the order of possible \a value_mask bits. See the example. * @return A cookie * * Configures a window's size, position, border width and stacking order. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_configure_window_aux_checked (xcb_connection_t *c, xcb_window_t window, uint16_t value_mask, const xcb_configure_window_value_list_t *value_list); /** * @brief Configures window attributes * * @param c The connection * @param window The window to configure. * @param value_mask Bitmask of attributes to change. * @param value_list New values, corresponding to the attributes in value_mask. The order has to * correspond to the order of possible \a value_mask bits. See the example. * @return A cookie * * Configures a window's size, position, border width and stacking order. * */ xcb_void_cookie_t xcb_configure_window_aux (xcb_connection_t *c, xcb_window_t window, uint16_t value_mask, const xcb_configure_window_value_list_t *value_list); void * xcb_configure_window_value_list (const xcb_configure_window_request_t *R); /** * @brief Change window stacking order * * @param c The connection * @param direction A bitmask of #xcb_circulate_t values. * @param direction \n * @param window The window to raise/lower (depending on \a direction). * @return A cookie * * If \a direction is `XCB_CIRCULATE_RAISE_LOWEST`, the lowest mapped child (if * any) will be raised to the top of the stack. * * If \a direction is `XCB_CIRCULATE_LOWER_HIGHEST`, the highest mapped child will * be lowered to the bottom of the stack. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_circulate_window_checked (xcb_connection_t *c, uint8_t direction, xcb_window_t window); /** * @brief Change window stacking order * * @param c The connection * @param direction A bitmask of #xcb_circulate_t values. * @param direction \n * @param window The window to raise/lower (depending on \a direction). * @return A cookie * * If \a direction is `XCB_CIRCULATE_RAISE_LOWEST`, the lowest mapped child (if * any) will be raised to the top of the stack. * * If \a direction is `XCB_CIRCULATE_LOWER_HIGHEST`, the highest mapped child will * be lowered to the bottom of the stack. * */ xcb_void_cookie_t xcb_circulate_window (xcb_connection_t *c, uint8_t direction, xcb_window_t window); /** * @brief Get current window geometry * * @param c The connection * @param drawable The drawable (`Window` or `Pixmap`) of which the geometry will be received. * @return A cookie * * Gets the current geometry of the specified drawable (either `Window` or `Pixmap`). * */ xcb_get_geometry_cookie_t xcb_get_geometry (xcb_connection_t *c, xcb_drawable_t drawable); /** * @brief Get current window geometry * * @param c The connection * @param drawable The drawable (`Window` or `Pixmap`) of which the geometry will be received. * @return A cookie * * Gets the current geometry of the specified drawable (either `Window` or `Pixmap`). * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_get_geometry_cookie_t xcb_get_geometry_unchecked (xcb_connection_t *c, xcb_drawable_t drawable); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_get_geometry_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_get_geometry_reply_t * xcb_get_geometry_reply (xcb_connection_t *c, xcb_get_geometry_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_query_tree_sizeof (const void *_buffer); /** * @brief query the window tree * * @param c The connection * @param window The \a window to query. * @return A cookie * * Gets the root window ID, parent window ID and list of children windows for the * specified \a window. The children are listed in bottom-to-top stacking order. * */ xcb_query_tree_cookie_t xcb_query_tree (xcb_connection_t *c, xcb_window_t window); /** * @brief query the window tree * * @param c The connection * @param window The \a window to query. * @return A cookie * * Gets the root window ID, parent window ID and list of children windows for the * specified \a window. The children are listed in bottom-to-top stacking order. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_query_tree_cookie_t xcb_query_tree_unchecked (xcb_connection_t *c, xcb_window_t window); xcb_window_t * xcb_query_tree_children (const xcb_query_tree_reply_t *R); int xcb_query_tree_children_length (const xcb_query_tree_reply_t *R); xcb_generic_iterator_t xcb_query_tree_children_end (const xcb_query_tree_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_query_tree_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_query_tree_reply_t * xcb_query_tree_reply (xcb_connection_t *c, xcb_query_tree_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_intern_atom_sizeof (const void *_buffer); /** * @brief Get atom identifier by name * * @param c The connection * @param only_if_exists Return a valid atom id only if the atom already exists. * @param name_len The length of the following \a name. * @param name The name of the atom. * @return A cookie * * Retrieves the identifier (xcb_atom_t TODO) for the atom with the specified * name. Atoms are used in protocols like EWMH, for example to store window titles * (`_NET_WM_NAME` atom) as property of a window. * * If \a only_if_exists is 0, the atom will be created if it does not already exist. * If \a only_if_exists is 1, `XCB_ATOM_NONE` will be returned if the atom does * not yet exist. * */ xcb_intern_atom_cookie_t xcb_intern_atom (xcb_connection_t *c, uint8_t only_if_exists, uint16_t name_len, const char *name); /** * @brief Get atom identifier by name * * @param c The connection * @param only_if_exists Return a valid atom id only if the atom already exists. * @param name_len The length of the following \a name. * @param name The name of the atom. * @return A cookie * * Retrieves the identifier (xcb_atom_t TODO) for the atom with the specified * name. Atoms are used in protocols like EWMH, for example to store window titles * (`_NET_WM_NAME` atom) as property of a window. * * If \a only_if_exists is 0, the atom will be created if it does not already exist. * If \a only_if_exists is 1, `XCB_ATOM_NONE` will be returned if the atom does * not yet exist. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_intern_atom_cookie_t xcb_intern_atom_unchecked (xcb_connection_t *c, uint8_t only_if_exists, uint16_t name_len, const char *name); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_intern_atom_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_intern_atom_reply_t * xcb_intern_atom_reply (xcb_connection_t *c, xcb_intern_atom_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_get_atom_name_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_get_atom_name_cookie_t xcb_get_atom_name (xcb_connection_t *c, xcb_atom_t atom); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_get_atom_name_cookie_t xcb_get_atom_name_unchecked (xcb_connection_t *c, xcb_atom_t atom); char * xcb_get_atom_name_name (const xcb_get_atom_name_reply_t *R); int xcb_get_atom_name_name_length (const xcb_get_atom_name_reply_t *R); xcb_generic_iterator_t xcb_get_atom_name_name_end (const xcb_get_atom_name_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_get_atom_name_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_get_atom_name_reply_t * xcb_get_atom_name_reply (xcb_connection_t *c, xcb_get_atom_name_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_change_property_sizeof (const void *_buffer); /** * @brief Changes a window property * * @param c The connection * @param mode A bitmask of #xcb_prop_mode_t values. * @param mode \n * @param window The window whose property you want to change. * @param property The property you want to change (an atom). * @param type The type of the property you want to change (an atom). * @param format Specifies whether the data should be viewed as a list of 8-bit, 16-bit or * 32-bit quantities. Possible values are 8, 16 and 32. This information allows * the X server to correctly perform byte-swap operations as necessary. * @param data_len Specifies the number of elements (see \a format). * @param data The property data. * @return A cookie * * Sets or updates a property on the specified \a window. Properties are for * example the window title (`WM_NAME`) or its minimum size (`WM_NORMAL_HINTS`). * Protocols such as EWMH also use properties - for example EWMH defines the * window title, encoded as UTF-8 string, in the `_NET_WM_NAME` property. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_change_property_checked (xcb_connection_t *c, uint8_t mode, xcb_window_t window, xcb_atom_t property, xcb_atom_t type, uint8_t format, uint32_t data_len, const void *data); /** * @brief Changes a window property * * @param c The connection * @param mode A bitmask of #xcb_prop_mode_t values. * @param mode \n * @param window The window whose property you want to change. * @param property The property you want to change (an atom). * @param type The type of the property you want to change (an atom). * @param format Specifies whether the data should be viewed as a list of 8-bit, 16-bit or * 32-bit quantities. Possible values are 8, 16 and 32. This information allows * the X server to correctly perform byte-swap operations as necessary. * @param data_len Specifies the number of elements (see \a format). * @param data The property data. * @return A cookie * * Sets or updates a property on the specified \a window. Properties are for * example the window title (`WM_NAME`) or its minimum size (`WM_NORMAL_HINTS`). * Protocols such as EWMH also use properties - for example EWMH defines the * window title, encoded as UTF-8 string, in the `_NET_WM_NAME` property. * */ xcb_void_cookie_t xcb_change_property (xcb_connection_t *c, uint8_t mode, xcb_window_t window, xcb_atom_t property, xcb_atom_t type, uint8_t format, uint32_t data_len, const void *data); void * xcb_change_property_data (const xcb_change_property_request_t *R); int xcb_change_property_data_length (const xcb_change_property_request_t *R); xcb_generic_iterator_t xcb_change_property_data_end (const xcb_change_property_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_delete_property_checked (xcb_connection_t *c, xcb_window_t window, xcb_atom_t property); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_delete_property (xcb_connection_t *c, xcb_window_t window, xcb_atom_t property); int xcb_get_property_sizeof (const void *_buffer); /** * @brief Gets a window property * * @param c The connection * @param _delete Whether the property should actually be deleted. For deleting a property, the * specified \a type has to match the actual property type. * @param window The window whose property you want to get. * @param property The property you want to get (an atom). * @param type The type of the property you want to get (an atom). * @param long_offset Specifies the offset (in 32-bit multiples) in the specified property where the * data is to be retrieved. * @param long_length Specifies how many 32-bit multiples of data should be retrieved (e.g. if you * set \a long_length to 4, you will receive 16 bytes of data). * @return A cookie * * Gets the specified \a property from the specified \a window. Properties are for * example the window title (`WM_NAME`) or its minimum size (`WM_NORMAL_HINTS`). * Protocols such as EWMH also use properties - for example EWMH defines the * window title, encoded as UTF-8 string, in the `_NET_WM_NAME` property. * * TODO: talk about \a type * * TODO: talk about `delete` * * TODO: talk about the offset/length thing. what's a valid use case? * */ xcb_get_property_cookie_t xcb_get_property (xcb_connection_t *c, uint8_t _delete, xcb_window_t window, xcb_atom_t property, xcb_atom_t type, uint32_t long_offset, uint32_t long_length); /** * @brief Gets a window property * * @param c The connection * @param _delete Whether the property should actually be deleted. For deleting a property, the * specified \a type has to match the actual property type. * @param window The window whose property you want to get. * @param property The property you want to get (an atom). * @param type The type of the property you want to get (an atom). * @param long_offset Specifies the offset (in 32-bit multiples) in the specified property where the * data is to be retrieved. * @param long_length Specifies how many 32-bit multiples of data should be retrieved (e.g. if you * set \a long_length to 4, you will receive 16 bytes of data). * @return A cookie * * Gets the specified \a property from the specified \a window. Properties are for * example the window title (`WM_NAME`) or its minimum size (`WM_NORMAL_HINTS`). * Protocols such as EWMH also use properties - for example EWMH defines the * window title, encoded as UTF-8 string, in the `_NET_WM_NAME` property. * * TODO: talk about \a type * * TODO: talk about `delete` * * TODO: talk about the offset/length thing. what's a valid use case? * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_get_property_cookie_t xcb_get_property_unchecked (xcb_connection_t *c, uint8_t _delete, xcb_window_t window, xcb_atom_t property, xcb_atom_t type, uint32_t long_offset, uint32_t long_length); void * xcb_get_property_value (const xcb_get_property_reply_t *R); int xcb_get_property_value_length (const xcb_get_property_reply_t *R); xcb_generic_iterator_t xcb_get_property_value_end (const xcb_get_property_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_get_property_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_get_property_reply_t * xcb_get_property_reply (xcb_connection_t *c, xcb_get_property_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_list_properties_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_list_properties_cookie_t xcb_list_properties (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_list_properties_cookie_t xcb_list_properties_unchecked (xcb_connection_t *c, xcb_window_t window); xcb_atom_t * xcb_list_properties_atoms (const xcb_list_properties_reply_t *R); int xcb_list_properties_atoms_length (const xcb_list_properties_reply_t *R); xcb_generic_iterator_t xcb_list_properties_atoms_end (const xcb_list_properties_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_list_properties_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_list_properties_reply_t * xcb_list_properties_reply (xcb_connection_t *c, xcb_list_properties_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * @brief Sets the owner of a selection * * @param c The connection * @param owner The new owner of the selection. * \n * The special value `XCB_NONE` means that the selection will have no owner. * @param selection The selection. * @param time Timestamp to avoid race conditions when running X over the network. * \n * The selection will not be changed if \a time is earlier than the current * last-change time of the \a selection or is later than the current X server time. * Otherwise, the last-change time is set to the specified time. * \n * The special value `XCB_CURRENT_TIME` will be replaced with the current server * time. * @return A cookie * * Makes `window` the owner of the selection \a selection and updates the * last-change time of the specified selection. * * TODO: briefly explain what a selection is. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_set_selection_owner_checked (xcb_connection_t *c, xcb_window_t owner, xcb_atom_t selection, xcb_timestamp_t time); /** * @brief Sets the owner of a selection * * @param c The connection * @param owner The new owner of the selection. * \n * The special value `XCB_NONE` means that the selection will have no owner. * @param selection The selection. * @param time Timestamp to avoid race conditions when running X over the network. * \n * The selection will not be changed if \a time is earlier than the current * last-change time of the \a selection or is later than the current X server time. * Otherwise, the last-change time is set to the specified time. * \n * The special value `XCB_CURRENT_TIME` will be replaced with the current server * time. * @return A cookie * * Makes `window` the owner of the selection \a selection and updates the * last-change time of the specified selection. * * TODO: briefly explain what a selection is. * */ xcb_void_cookie_t xcb_set_selection_owner (xcb_connection_t *c, xcb_window_t owner, xcb_atom_t selection, xcb_timestamp_t time); /** * @brief Gets the owner of a selection * * @param c The connection * @param selection The selection. * @return A cookie * * Gets the owner of the specified selection. * * TODO: briefly explain what a selection is. * */ xcb_get_selection_owner_cookie_t xcb_get_selection_owner (xcb_connection_t *c, xcb_atom_t selection); /** * @brief Gets the owner of a selection * * @param c The connection * @param selection The selection. * @return A cookie * * Gets the owner of the specified selection. * * TODO: briefly explain what a selection is. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_get_selection_owner_cookie_t xcb_get_selection_owner_unchecked (xcb_connection_t *c, xcb_atom_t selection); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_get_selection_owner_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_get_selection_owner_reply_t * xcb_get_selection_owner_reply (xcb_connection_t *c, xcb_get_selection_owner_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_convert_selection_checked (xcb_connection_t *c, xcb_window_t requestor, xcb_atom_t selection, xcb_atom_t target, xcb_atom_t property, xcb_timestamp_t time); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_convert_selection (xcb_connection_t *c, xcb_window_t requestor, xcb_atom_t selection, xcb_atom_t target, xcb_atom_t property, xcb_timestamp_t time); /** * @brief send an event * * @param c The connection * @param propagate If \a propagate is true and no clients have selected any event on \a destination, * the destination is replaced with the closest ancestor of \a destination for * which some client has selected a type in \a event_mask and for which no * intervening window has that type in its do-not-propagate-mask. If no such * window exists or if the window is an ancestor of the focus window and * `InputFocus` was originally specified as the destination, the event is not sent * to any clients. Otherwise, the event is reported to every client selecting on * the final destination any of the types specified in \a event_mask. * @param destination The window to send this event to. Every client which selects any event within * \a event_mask on \a destination will get the event. * \n * The special value `XCB_SEND_EVENT_DEST_POINTER_WINDOW` refers to the window * that contains the mouse pointer. * \n * The special value `XCB_SEND_EVENT_DEST_ITEM_FOCUS` refers to the window which * has the keyboard focus. * @param event_mask Event_mask for determining which clients should receive the specified event. * See \a destination and \a propagate. * @param event The event to send to the specified \a destination. * @return A cookie * * Identifies the \a destination window, determines which clients should receive * the specified event and ignores any active grabs. * * The \a event must be one of the core events or an event defined by an extension, * so that the X server can correctly byte-swap the contents as necessary. The * contents of \a event are otherwise unaltered and unchecked except for the * `send_event` field which is forced to 'true'. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_send_event_checked (xcb_connection_t *c, uint8_t propagate, xcb_window_t destination, uint32_t event_mask, const char *event); /** * @brief send an event * * @param c The connection * @param propagate If \a propagate is true and no clients have selected any event on \a destination, * the destination is replaced with the closest ancestor of \a destination for * which some client has selected a type in \a event_mask and for which no * intervening window has that type in its do-not-propagate-mask. If no such * window exists or if the window is an ancestor of the focus window and * `InputFocus` was originally specified as the destination, the event is not sent * to any clients. Otherwise, the event is reported to every client selecting on * the final destination any of the types specified in \a event_mask. * @param destination The window to send this event to. Every client which selects any event within * \a event_mask on \a destination will get the event. * \n * The special value `XCB_SEND_EVENT_DEST_POINTER_WINDOW` refers to the window * that contains the mouse pointer. * \n * The special value `XCB_SEND_EVENT_DEST_ITEM_FOCUS` refers to the window which * has the keyboard focus. * @param event_mask Event_mask for determining which clients should receive the specified event. * See \a destination and \a propagate. * @param event The event to send to the specified \a destination. * @return A cookie * * Identifies the \a destination window, determines which clients should receive * the specified event and ignores any active grabs. * * The \a event must be one of the core events or an event defined by an extension, * so that the X server can correctly byte-swap the contents as necessary. The * contents of \a event are otherwise unaltered and unchecked except for the * `send_event` field which is forced to 'true'. * */ xcb_void_cookie_t xcb_send_event (xcb_connection_t *c, uint8_t propagate, xcb_window_t destination, uint32_t event_mask, const char *event); /** * @brief Grab the pointer * * @param c The connection * @param owner_events If 1, the \a grab_window will still get the pointer events. If 0, events are not * reported to the \a grab_window. * @param grab_window Specifies the window on which the pointer should be grabbed. * @param event_mask Specifies which pointer events are reported to the client. * \n * TODO: which values? * @param pointer_mode A bitmask of #xcb_grab_mode_t values. * @param pointer_mode \n * @param keyboard_mode A bitmask of #xcb_grab_mode_t values. * @param keyboard_mode \n * @param confine_to Specifies the window to confine the pointer in (the user will not be able to * move the pointer out of that window). * \n * The special value `XCB_NONE` means don't confine the pointer. * @param cursor Specifies the cursor that should be displayed or `XCB_NONE` to not change the * cursor. * @param time The time argument allows you to avoid certain circumstances that come up if * applications take a long time to respond or if there are long network delays. * Consider a situation where you have two applications, both of which normally * grab the pointer when clicked on. If both applications specify the timestamp * from the event, the second application may wake up faster and successfully grab * the pointer before the first application. The first application then will get * an indication that the other application grabbed the pointer before its request * was processed. * \n * The special value `XCB_CURRENT_TIME` will be replaced with the current server * time. * @return A cookie * * Actively grabs control of the pointer. Further pointer events are reported only to the grabbing client. Overrides any active pointer grab by this client. * */ xcb_grab_pointer_cookie_t xcb_grab_pointer (xcb_connection_t *c, uint8_t owner_events, xcb_window_t grab_window, uint16_t event_mask, uint8_t pointer_mode, uint8_t keyboard_mode, xcb_window_t confine_to, xcb_cursor_t cursor, xcb_timestamp_t time); /** * @brief Grab the pointer * * @param c The connection * @param owner_events If 1, the \a grab_window will still get the pointer events. If 0, events are not * reported to the \a grab_window. * @param grab_window Specifies the window on which the pointer should be grabbed. * @param event_mask Specifies which pointer events are reported to the client. * \n * TODO: which values? * @param pointer_mode A bitmask of #xcb_grab_mode_t values. * @param pointer_mode \n * @param keyboard_mode A bitmask of #xcb_grab_mode_t values. * @param keyboard_mode \n * @param confine_to Specifies the window to confine the pointer in (the user will not be able to * move the pointer out of that window). * \n * The special value `XCB_NONE` means don't confine the pointer. * @param cursor Specifies the cursor that should be displayed or `XCB_NONE` to not change the * cursor. * @param time The time argument allows you to avoid certain circumstances that come up if * applications take a long time to respond or if there are long network delays. * Consider a situation where you have two applications, both of which normally * grab the pointer when clicked on. If both applications specify the timestamp * from the event, the second application may wake up faster and successfully grab * the pointer before the first application. The first application then will get * an indication that the other application grabbed the pointer before its request * was processed. * \n * The special value `XCB_CURRENT_TIME` will be replaced with the current server * time. * @return A cookie * * Actively grabs control of the pointer. Further pointer events are reported only to the grabbing client. Overrides any active pointer grab by this client. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_grab_pointer_cookie_t xcb_grab_pointer_unchecked (xcb_connection_t *c, uint8_t owner_events, xcb_window_t grab_window, uint16_t event_mask, uint8_t pointer_mode, uint8_t keyboard_mode, xcb_window_t confine_to, xcb_cursor_t cursor, xcb_timestamp_t time); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_grab_pointer_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_grab_pointer_reply_t * xcb_grab_pointer_reply (xcb_connection_t *c, xcb_grab_pointer_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * @brief release the pointer * * @param c The connection * @param time Timestamp to avoid race conditions when running X over the network. * \n * The pointer will not be released if \a time is earlier than the * last-pointer-grab time or later than the current X server time. * @return A cookie * * Releases the pointer and any queued events if you actively grabbed the pointer * before using `xcb_grab_pointer`, `xcb_grab_button` or within a normal button * press. * * EnterNotify and LeaveNotify events are generated. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_ungrab_pointer_checked (xcb_connection_t *c, xcb_timestamp_t time); /** * @brief release the pointer * * @param c The connection * @param time Timestamp to avoid race conditions when running X over the network. * \n * The pointer will not be released if \a time is earlier than the * last-pointer-grab time or later than the current X server time. * @return A cookie * * Releases the pointer and any queued events if you actively grabbed the pointer * before using `xcb_grab_pointer`, `xcb_grab_button` or within a normal button * press. * * EnterNotify and LeaveNotify events are generated. * */ xcb_void_cookie_t xcb_ungrab_pointer (xcb_connection_t *c, xcb_timestamp_t time); /** * @brief Grab pointer button(s) * * @param c The connection * @param owner_events If 1, the \a grab_window will still get the pointer events. If 0, events are not * reported to the \a grab_window. * @param grab_window Specifies the window on which the pointer should be grabbed. * @param event_mask Specifies which pointer events are reported to the client. * \n * TODO: which values? * @param pointer_mode A bitmask of #xcb_grab_mode_t values. * @param pointer_mode \n * @param keyboard_mode A bitmask of #xcb_grab_mode_t values. * @param keyboard_mode \n * @param confine_to Specifies the window to confine the pointer in (the user will not be able to * move the pointer out of that window). * \n * The special value `XCB_NONE` means don't confine the pointer. * @param cursor Specifies the cursor that should be displayed or `XCB_NONE` to not change the * cursor. * @param button A bitmask of #xcb_button_index_t values. * @param button \n * @param modifiers The modifiers to grab. * \n * Using the special value `XCB_MOD_MASK_ANY` means grab the pointer with all * possible modifier combinations. * @return A cookie * * This request establishes a passive grab. The pointer is actively grabbed as * described in GrabPointer, the last-pointer-grab time is set to the time at * which the button was pressed (as transmitted in the ButtonPress event), and the * ButtonPress event is reported if all of the following conditions are true: * * The pointer is not grabbed and the specified button is logically pressed when * the specified modifier keys are logically down, and no other buttons or * modifier keys are logically down. * * The grab-window contains the pointer. * * The confine-to window (if any) is viewable. * * A passive grab on the same button/key combination does not exist on any * ancestor of grab-window. * * The interpretation of the remaining arguments is the same as for GrabPointer. * The active grab is terminated automatically when the logical state of the * pointer has all buttons released, independent of the logical state of modifier * keys. Note that the logical state of a device (as seen by means of the * protocol) may lag the physical state if device event processing is frozen. This * request overrides all previous passive grabs by the same client on the same * button/key combinations on the same window. A modifier of AnyModifier is * equivalent to issuing the request for all possible modifier combinations * (including the combination of no modifiers). It is not required that all * specified modifiers have currently assigned keycodes. A button of AnyButton is * equivalent to issuing the request for all possible buttons. Otherwise, it is * not required that the button specified currently be assigned to a physical * button. * * An Access error is generated if some other client has already issued a * GrabButton request with the same button/key combination on the same window. * When using AnyModifier or AnyButton, the request fails completely (no grabs are * established), and an Access error is generated if there is a conflicting grab * for any combination. The request has no effect on an active grab. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_grab_button_checked (xcb_connection_t *c, uint8_t owner_events, xcb_window_t grab_window, uint16_t event_mask, uint8_t pointer_mode, uint8_t keyboard_mode, xcb_window_t confine_to, xcb_cursor_t cursor, uint8_t button, uint16_t modifiers); /** * @brief Grab pointer button(s) * * @param c The connection * @param owner_events If 1, the \a grab_window will still get the pointer events. If 0, events are not * reported to the \a grab_window. * @param grab_window Specifies the window on which the pointer should be grabbed. * @param event_mask Specifies which pointer events are reported to the client. * \n * TODO: which values? * @param pointer_mode A bitmask of #xcb_grab_mode_t values. * @param pointer_mode \n * @param keyboard_mode A bitmask of #xcb_grab_mode_t values. * @param keyboard_mode \n * @param confine_to Specifies the window to confine the pointer in (the user will not be able to * move the pointer out of that window). * \n * The special value `XCB_NONE` means don't confine the pointer. * @param cursor Specifies the cursor that should be displayed or `XCB_NONE` to not change the * cursor. * @param button A bitmask of #xcb_button_index_t values. * @param button \n * @param modifiers The modifiers to grab. * \n * Using the special value `XCB_MOD_MASK_ANY` means grab the pointer with all * possible modifier combinations. * @return A cookie * * This request establishes a passive grab. The pointer is actively grabbed as * described in GrabPointer, the last-pointer-grab time is set to the time at * which the button was pressed (as transmitted in the ButtonPress event), and the * ButtonPress event is reported if all of the following conditions are true: * * The pointer is not grabbed and the specified button is logically pressed when * the specified modifier keys are logically down, and no other buttons or * modifier keys are logically down. * * The grab-window contains the pointer. * * The confine-to window (if any) is viewable. * * A passive grab on the same button/key combination does not exist on any * ancestor of grab-window. * * The interpretation of the remaining arguments is the same as for GrabPointer. * The active grab is terminated automatically when the logical state of the * pointer has all buttons released, independent of the logical state of modifier * keys. Note that the logical state of a device (as seen by means of the * protocol) may lag the physical state if device event processing is frozen. This * request overrides all previous passive grabs by the same client on the same * button/key combinations on the same window. A modifier of AnyModifier is * equivalent to issuing the request for all possible modifier combinations * (including the combination of no modifiers). It is not required that all * specified modifiers have currently assigned keycodes. A button of AnyButton is * equivalent to issuing the request for all possible buttons. Otherwise, it is * not required that the button specified currently be assigned to a physical * button. * * An Access error is generated if some other client has already issued a * GrabButton request with the same button/key combination on the same window. * When using AnyModifier or AnyButton, the request fails completely (no grabs are * established), and an Access error is generated if there is a conflicting grab * for any combination. The request has no effect on an active grab. * */ xcb_void_cookie_t xcb_grab_button (xcb_connection_t *c, uint8_t owner_events, xcb_window_t grab_window, uint16_t event_mask, uint8_t pointer_mode, uint8_t keyboard_mode, xcb_window_t confine_to, xcb_cursor_t cursor, uint8_t button, uint16_t modifiers); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_ungrab_button_checked (xcb_connection_t *c, uint8_t button, xcb_window_t grab_window, uint16_t modifiers); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_ungrab_button (xcb_connection_t *c, uint8_t button, xcb_window_t grab_window, uint16_t modifiers); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_change_active_pointer_grab_checked (xcb_connection_t *c, xcb_cursor_t cursor, xcb_timestamp_t time, uint16_t event_mask); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_change_active_pointer_grab (xcb_connection_t *c, xcb_cursor_t cursor, xcb_timestamp_t time, uint16_t event_mask); /** * @brief Grab the keyboard * * @param c The connection * @param owner_events If 1, the \a grab_window will still get the pointer events. If 0, events are not * reported to the \a grab_window. * @param grab_window Specifies the window on which the pointer should be grabbed. * @param time Timestamp to avoid race conditions when running X over the network. * \n * The special value `XCB_CURRENT_TIME` will be replaced with the current server * time. * @param pointer_mode A bitmask of #xcb_grab_mode_t values. * @param pointer_mode \n * @param keyboard_mode A bitmask of #xcb_grab_mode_t values. * @param keyboard_mode \n * @return A cookie * * Actively grabs control of the keyboard and generates FocusIn and FocusOut * events. Further key events are reported only to the grabbing client. * * Any active keyboard grab by this client is overridden. If the keyboard is * actively grabbed by some other client, `AlreadyGrabbed` is returned. If * \a grab_window is not viewable, `GrabNotViewable` is returned. If the keyboard * is frozen by an active grab of another client, `GrabFrozen` is returned. If the * specified \a time is earlier than the last-keyboard-grab time or later than the * current X server time, `GrabInvalidTime` is returned. Otherwise, the * last-keyboard-grab time is set to the specified time. * */ xcb_grab_keyboard_cookie_t xcb_grab_keyboard (xcb_connection_t *c, uint8_t owner_events, xcb_window_t grab_window, xcb_timestamp_t time, uint8_t pointer_mode, uint8_t keyboard_mode); /** * @brief Grab the keyboard * * @param c The connection * @param owner_events If 1, the \a grab_window will still get the pointer events. If 0, events are not * reported to the \a grab_window. * @param grab_window Specifies the window on which the pointer should be grabbed. * @param time Timestamp to avoid race conditions when running X over the network. * \n * The special value `XCB_CURRENT_TIME` will be replaced with the current server * time. * @param pointer_mode A bitmask of #xcb_grab_mode_t values. * @param pointer_mode \n * @param keyboard_mode A bitmask of #xcb_grab_mode_t values. * @param keyboard_mode \n * @return A cookie * * Actively grabs control of the keyboard and generates FocusIn and FocusOut * events. Further key events are reported only to the grabbing client. * * Any active keyboard grab by this client is overridden. If the keyboard is * actively grabbed by some other client, `AlreadyGrabbed` is returned. If * \a grab_window is not viewable, `GrabNotViewable` is returned. If the keyboard * is frozen by an active grab of another client, `GrabFrozen` is returned. If the * specified \a time is earlier than the last-keyboard-grab time or later than the * current X server time, `GrabInvalidTime` is returned. Otherwise, the * last-keyboard-grab time is set to the specified time. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_grab_keyboard_cookie_t xcb_grab_keyboard_unchecked (xcb_connection_t *c, uint8_t owner_events, xcb_window_t grab_window, xcb_timestamp_t time, uint8_t pointer_mode, uint8_t keyboard_mode); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_grab_keyboard_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_grab_keyboard_reply_t * xcb_grab_keyboard_reply (xcb_connection_t *c, xcb_grab_keyboard_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_ungrab_keyboard_checked (xcb_connection_t *c, xcb_timestamp_t time); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_ungrab_keyboard (xcb_connection_t *c, xcb_timestamp_t time); /** * @brief Grab keyboard key(s) * * @param c The connection * @param owner_events If 1, the \a grab_window will still get the pointer events. If 0, events are not * reported to the \a grab_window. * @param grab_window Specifies the window on which the pointer should be grabbed. * @param modifiers The modifiers to grab. * \n * Using the special value `XCB_MOD_MASK_ANY` means grab the pointer with all * possible modifier combinations. * @param key The keycode of the key to grab. * \n * The special value `XCB_GRAB_ANY` means grab any key. * @param pointer_mode A bitmask of #xcb_grab_mode_t values. * @param pointer_mode \n * @param keyboard_mode A bitmask of #xcb_grab_mode_t values. * @param keyboard_mode \n * @return A cookie * * Establishes a passive grab on the keyboard. In the future, the keyboard is * actively grabbed (as for `GrabKeyboard`), the last-keyboard-grab time is set to * the time at which the key was pressed (as transmitted in the KeyPress event), * and the KeyPress event is reported if all of the following conditions are true: * * The keyboard is not grabbed and the specified key (which can itself be a * modifier key) is logically pressed when the specified modifier keys are * logically down, and no other modifier keys are logically down. * * Either the grab_window is an ancestor of (or is) the focus window, or the * grab_window is a descendant of the focus window and contains the pointer. * * A passive grab on the same key combination does not exist on any ancestor of * grab_window. * * The interpretation of the remaining arguments is as for XGrabKeyboard. The active grab is terminated * automatically when the logical state of the keyboard has the specified key released (independent of the * logical state of the modifier keys), at which point a KeyRelease event is reported to the grabbing window. * * Note that the logical state of a device (as seen by client applications) may lag the physical state if * device event processing is frozen. * * A modifiers argument of AnyModifier is equivalent to issuing the request for all possible modifier combinations (including the combination of no modifiers). It is not required that all modifiers specified * have currently assigned KeyCodes. A keycode argument of AnyKey is equivalent to issuing the request for * all possible KeyCodes. Otherwise, the specified keycode must be in the range specified by min_keycode * and max_keycode in the connection setup, or a BadValue error results. * * If some other client has issued a XGrabKey with the same key combination on the same window, a BadAccess * error results. When using AnyModifier or AnyKey, the request fails completely, and a BadAccess error * results (no grabs are established) if there is a conflicting grab for any combination. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_grab_key_checked (xcb_connection_t *c, uint8_t owner_events, xcb_window_t grab_window, uint16_t modifiers, xcb_keycode_t key, uint8_t pointer_mode, uint8_t keyboard_mode); /** * @brief Grab keyboard key(s) * * @param c The connection * @param owner_events If 1, the \a grab_window will still get the pointer events. If 0, events are not * reported to the \a grab_window. * @param grab_window Specifies the window on which the pointer should be grabbed. * @param modifiers The modifiers to grab. * \n * Using the special value `XCB_MOD_MASK_ANY` means grab the pointer with all * possible modifier combinations. * @param key The keycode of the key to grab. * \n * The special value `XCB_GRAB_ANY` means grab any key. * @param pointer_mode A bitmask of #xcb_grab_mode_t values. * @param pointer_mode \n * @param keyboard_mode A bitmask of #xcb_grab_mode_t values. * @param keyboard_mode \n * @return A cookie * * Establishes a passive grab on the keyboard. In the future, the keyboard is * actively grabbed (as for `GrabKeyboard`), the last-keyboard-grab time is set to * the time at which the key was pressed (as transmitted in the KeyPress event), * and the KeyPress event is reported if all of the following conditions are true: * * The keyboard is not grabbed and the specified key (which can itself be a * modifier key) is logically pressed when the specified modifier keys are * logically down, and no other modifier keys are logically down. * * Either the grab_window is an ancestor of (or is) the focus window, or the * grab_window is a descendant of the focus window and contains the pointer. * * A passive grab on the same key combination does not exist on any ancestor of * grab_window. * * The interpretation of the remaining arguments is as for XGrabKeyboard. The active grab is terminated * automatically when the logical state of the keyboard has the specified key released (independent of the * logical state of the modifier keys), at which point a KeyRelease event is reported to the grabbing window. * * Note that the logical state of a device (as seen by client applications) may lag the physical state if * device event processing is frozen. * * A modifiers argument of AnyModifier is equivalent to issuing the request for all possible modifier combinations (including the combination of no modifiers). It is not required that all modifiers specified * have currently assigned KeyCodes. A keycode argument of AnyKey is equivalent to issuing the request for * all possible KeyCodes. Otherwise, the specified keycode must be in the range specified by min_keycode * and max_keycode in the connection setup, or a BadValue error results. * * If some other client has issued a XGrabKey with the same key combination on the same window, a BadAccess * error results. When using AnyModifier or AnyKey, the request fails completely, and a BadAccess error * results (no grabs are established) if there is a conflicting grab for any combination. * */ xcb_void_cookie_t xcb_grab_key (xcb_connection_t *c, uint8_t owner_events, xcb_window_t grab_window, uint16_t modifiers, xcb_keycode_t key, uint8_t pointer_mode, uint8_t keyboard_mode); /** * @brief release a key combination * * @param c The connection * @param key The keycode of the specified key combination. * \n * Using the special value `XCB_GRAB_ANY` means releasing all possible key codes. * @param grab_window The window on which the grabbed key combination will be released. * @param modifiers The modifiers of the specified key combination. * \n * Using the special value `XCB_MOD_MASK_ANY` means releasing the key combination * with every possible modifier combination. * @return A cookie * * Releases the key combination on \a grab_window if you grabbed it using * `xcb_grab_key` before. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_ungrab_key_checked (xcb_connection_t *c, xcb_keycode_t key, xcb_window_t grab_window, uint16_t modifiers); /** * @brief release a key combination * * @param c The connection * @param key The keycode of the specified key combination. * \n * Using the special value `XCB_GRAB_ANY` means releasing all possible key codes. * @param grab_window The window on which the grabbed key combination will be released. * @param modifiers The modifiers of the specified key combination. * \n * Using the special value `XCB_MOD_MASK_ANY` means releasing the key combination * with every possible modifier combination. * @return A cookie * * Releases the key combination on \a grab_window if you grabbed it using * `xcb_grab_key` before. * */ xcb_void_cookie_t xcb_ungrab_key (xcb_connection_t *c, xcb_keycode_t key, xcb_window_t grab_window, uint16_t modifiers); /** * @brief release queued events * * @param c The connection * @param mode A bitmask of #xcb_allow_t values. * @param mode \n * @param time Timestamp to avoid race conditions when running X over the network. * \n * The special value `XCB_CURRENT_TIME` will be replaced with the current server * time. * @return A cookie * * Releases queued events if the client has caused a device (pointer/keyboard) to * freeze due to grabbing it actively. This request has no effect if \a time is * earlier than the last-grab time of the most recent active grab for this client * or if \a time is later than the current X server time. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_allow_events_checked (xcb_connection_t *c, uint8_t mode, xcb_timestamp_t time); /** * @brief release queued events * * @param c The connection * @param mode A bitmask of #xcb_allow_t values. * @param mode \n * @param time Timestamp to avoid race conditions when running X over the network. * \n * The special value `XCB_CURRENT_TIME` will be replaced with the current server * time. * @return A cookie * * Releases queued events if the client has caused a device (pointer/keyboard) to * freeze due to grabbing it actively. This request has no effect if \a time is * earlier than the last-grab time of the most recent active grab for this client * or if \a time is later than the current X server time. * */ xcb_void_cookie_t xcb_allow_events (xcb_connection_t *c, uint8_t mode, xcb_timestamp_t time); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_grab_server_checked (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_grab_server (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_ungrab_server_checked (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_ungrab_server (xcb_connection_t *c); /** * @brief get pointer coordinates * * @param c The connection * @param window A window to check if the pointer is on the same screen as \a window (see the * `same_screen` field in the reply). * @return A cookie * * Gets the root window the pointer is logically on and the pointer coordinates * relative to the root window's origin. * */ xcb_query_pointer_cookie_t xcb_query_pointer (xcb_connection_t *c, xcb_window_t window); /** * @brief get pointer coordinates * * @param c The connection * @param window A window to check if the pointer is on the same screen as \a window (see the * `same_screen` field in the reply). * @return A cookie * * Gets the root window the pointer is logically on and the pointer coordinates * relative to the root window's origin. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_query_pointer_cookie_t xcb_query_pointer_unchecked (xcb_connection_t *c, xcb_window_t window); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_query_pointer_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_query_pointer_reply_t * xcb_query_pointer_reply (xcb_connection_t *c, xcb_query_pointer_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * Get the next element of the iterator * @param i Pointer to a xcb_timecoord_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_timecoord_t) */ void xcb_timecoord_next (xcb_timecoord_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_timecoord_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_timecoord_end (xcb_timecoord_iterator_t i); int xcb_get_motion_events_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_get_motion_events_cookie_t xcb_get_motion_events (xcb_connection_t *c, xcb_window_t window, xcb_timestamp_t start, xcb_timestamp_t stop); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_get_motion_events_cookie_t xcb_get_motion_events_unchecked (xcb_connection_t *c, xcb_window_t window, xcb_timestamp_t start, xcb_timestamp_t stop); xcb_timecoord_t * xcb_get_motion_events_events (const xcb_get_motion_events_reply_t *R); int xcb_get_motion_events_events_length (const xcb_get_motion_events_reply_t *R); xcb_timecoord_iterator_t xcb_get_motion_events_events_iterator (const xcb_get_motion_events_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_get_motion_events_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_get_motion_events_reply_t * xcb_get_motion_events_reply (xcb_connection_t *c, xcb_get_motion_events_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_translate_coordinates_cookie_t xcb_translate_coordinates (xcb_connection_t *c, xcb_window_t src_window, xcb_window_t dst_window, int16_t src_x, int16_t src_y); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_translate_coordinates_cookie_t xcb_translate_coordinates_unchecked (xcb_connection_t *c, xcb_window_t src_window, xcb_window_t dst_window, int16_t src_x, int16_t src_y); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_translate_coordinates_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_translate_coordinates_reply_t * xcb_translate_coordinates_reply (xcb_connection_t *c, xcb_translate_coordinates_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * @brief move mouse pointer * * @param c The connection * @param src_window If \a src_window is not `XCB_NONE` (TODO), the move will only take place if the * pointer is inside \a src_window and within the rectangle specified by (\a src_x, * \a src_y, \a src_width, \a src_height). The rectangle coordinates are relative to * \a src_window. * @param dst_window If \a dst_window is not `XCB_NONE` (TODO), the pointer will be moved to the * offsets (\a dst_x, \a dst_y) relative to \a dst_window. If \a dst_window is * `XCB_NONE` (TODO), the pointer will be moved by the offsets (\a dst_x, \a dst_y) * relative to the current position of the pointer. * @return A cookie * * Moves the mouse pointer to the specified position. * * If \a src_window is not `XCB_NONE` (TODO), the move will only take place if the * pointer is inside \a src_window and within the rectangle specified by (\a src_x, * \a src_y, \a src_width, \a src_height). The rectangle coordinates are relative to * \a src_window. * * If \a dst_window is not `XCB_NONE` (TODO), the pointer will be moved to the * offsets (\a dst_x, \a dst_y) relative to \a dst_window. If \a dst_window is * `XCB_NONE` (TODO), the pointer will be moved by the offsets (\a dst_x, \a dst_y) * relative to the current position of the pointer. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_warp_pointer_checked (xcb_connection_t *c, xcb_window_t src_window, xcb_window_t dst_window, int16_t src_x, int16_t src_y, uint16_t src_width, uint16_t src_height, int16_t dst_x, int16_t dst_y); /** * @brief move mouse pointer * * @param c The connection * @param src_window If \a src_window is not `XCB_NONE` (TODO), the move will only take place if the * pointer is inside \a src_window and within the rectangle specified by (\a src_x, * \a src_y, \a src_width, \a src_height). The rectangle coordinates are relative to * \a src_window. * @param dst_window If \a dst_window is not `XCB_NONE` (TODO), the pointer will be moved to the * offsets (\a dst_x, \a dst_y) relative to \a dst_window. If \a dst_window is * `XCB_NONE` (TODO), the pointer will be moved by the offsets (\a dst_x, \a dst_y) * relative to the current position of the pointer. * @return A cookie * * Moves the mouse pointer to the specified position. * * If \a src_window is not `XCB_NONE` (TODO), the move will only take place if the * pointer is inside \a src_window and within the rectangle specified by (\a src_x, * \a src_y, \a src_width, \a src_height). The rectangle coordinates are relative to * \a src_window. * * If \a dst_window is not `XCB_NONE` (TODO), the pointer will be moved to the * offsets (\a dst_x, \a dst_y) relative to \a dst_window. If \a dst_window is * `XCB_NONE` (TODO), the pointer will be moved by the offsets (\a dst_x, \a dst_y) * relative to the current position of the pointer. * */ xcb_void_cookie_t xcb_warp_pointer (xcb_connection_t *c, xcb_window_t src_window, xcb_window_t dst_window, int16_t src_x, int16_t src_y, uint16_t src_width, uint16_t src_height, int16_t dst_x, int16_t dst_y); /** * @brief Sets input focus * * @param c The connection * @param revert_to A bitmask of #xcb_input_focus_t values. * @param revert_to Specifies what happens when the \a focus window becomes unviewable (if \a focus * is neither `XCB_NONE` nor `XCB_POINTER_ROOT`). * @param focus The window to focus. All keyboard events will be reported to this window. The * window must be viewable (TODO), or a `xcb_match_error_t` occurs (TODO). * \n * If \a focus is `XCB_NONE` (TODO), all keyboard events are * discarded until a new focus window is set. * \n * If \a focus is `XCB_POINTER_ROOT` (TODO), focus is on the root window of the * screen on which the pointer is on currently. * @param time Timestamp to avoid race conditions when running X over the network. * \n * The special value `XCB_CURRENT_TIME` will be replaced with the current server * time. * @return A cookie * * Changes the input focus and the last-focus-change time. If the specified \a time * is earlier than the current last-focus-change time, the request is ignored (to * avoid race conditions when running X over the network). * * A FocusIn and FocusOut event is generated when focus is changed. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_set_input_focus_checked (xcb_connection_t *c, uint8_t revert_to, xcb_window_t focus, xcb_timestamp_t time); /** * @brief Sets input focus * * @param c The connection * @param revert_to A bitmask of #xcb_input_focus_t values. * @param revert_to Specifies what happens when the \a focus window becomes unviewable (if \a focus * is neither `XCB_NONE` nor `XCB_POINTER_ROOT`). * @param focus The window to focus. All keyboard events will be reported to this window. The * window must be viewable (TODO), or a `xcb_match_error_t` occurs (TODO). * \n * If \a focus is `XCB_NONE` (TODO), all keyboard events are * discarded until a new focus window is set. * \n * If \a focus is `XCB_POINTER_ROOT` (TODO), focus is on the root window of the * screen on which the pointer is on currently. * @param time Timestamp to avoid race conditions when running X over the network. * \n * The special value `XCB_CURRENT_TIME` will be replaced with the current server * time. * @return A cookie * * Changes the input focus and the last-focus-change time. If the specified \a time * is earlier than the current last-focus-change time, the request is ignored (to * avoid race conditions when running X over the network). * * A FocusIn and FocusOut event is generated when focus is changed. * */ xcb_void_cookie_t xcb_set_input_focus (xcb_connection_t *c, uint8_t revert_to, xcb_window_t focus, xcb_timestamp_t time); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_get_input_focus_cookie_t xcb_get_input_focus (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_get_input_focus_cookie_t xcb_get_input_focus_unchecked (xcb_connection_t *c); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_get_input_focus_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_get_input_focus_reply_t * xcb_get_input_focus_reply (xcb_connection_t *c, xcb_get_input_focus_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_query_keymap_cookie_t xcb_query_keymap (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_query_keymap_cookie_t xcb_query_keymap_unchecked (xcb_connection_t *c); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_query_keymap_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_query_keymap_reply_t * xcb_query_keymap_reply (xcb_connection_t *c, xcb_query_keymap_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_open_font_sizeof (const void *_buffer); /** * @brief opens a font * * @param c The connection * @param fid The ID with which you will refer to the font, created by `xcb_generate_id`. * @param name_len Length (in bytes) of \a name. * @param name A pattern describing an X core font. * @return A cookie * * Opens any X core font matching the given \a name (for example "-misc-fixed-*"). * * Note that X core fonts are deprecated (but still supported) in favor of * client-side rendering using Xft. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_open_font_checked (xcb_connection_t *c, xcb_font_t fid, uint16_t name_len, const char *name); /** * @brief opens a font * * @param c The connection * @param fid The ID with which you will refer to the font, created by `xcb_generate_id`. * @param name_len Length (in bytes) of \a name. * @param name A pattern describing an X core font. * @return A cookie * * Opens any X core font matching the given \a name (for example "-misc-fixed-*"). * * Note that X core fonts are deprecated (but still supported) in favor of * client-side rendering using Xft. * */ xcb_void_cookie_t xcb_open_font (xcb_connection_t *c, xcb_font_t fid, uint16_t name_len, const char *name); char * xcb_open_font_name (const xcb_open_font_request_t *R); int xcb_open_font_name_length (const xcb_open_font_request_t *R); xcb_generic_iterator_t xcb_open_font_name_end (const xcb_open_font_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_close_font_checked (xcb_connection_t *c, xcb_font_t font); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_close_font (xcb_connection_t *c, xcb_font_t font); /** * Get the next element of the iterator * @param i Pointer to a xcb_fontprop_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_fontprop_t) */ void xcb_fontprop_next (xcb_fontprop_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_fontprop_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_fontprop_end (xcb_fontprop_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_charinfo_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_charinfo_t) */ void xcb_charinfo_next (xcb_charinfo_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_charinfo_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_charinfo_end (xcb_charinfo_iterator_t i); int xcb_query_font_sizeof (const void *_buffer); /** * @brief query font metrics * * @param c The connection * @param font The fontable (Font or Graphics Context) to query. * @return A cookie * * Queries information associated with the font. * */ xcb_query_font_cookie_t xcb_query_font (xcb_connection_t *c, xcb_fontable_t font); /** * @brief query font metrics * * @param c The connection * @param font The fontable (Font or Graphics Context) to query. * @return A cookie * * Queries information associated with the font. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_query_font_cookie_t xcb_query_font_unchecked (xcb_connection_t *c, xcb_fontable_t font); xcb_fontprop_t * xcb_query_font_properties (const xcb_query_font_reply_t *R); int xcb_query_font_properties_length (const xcb_query_font_reply_t *R); xcb_fontprop_iterator_t xcb_query_font_properties_iterator (const xcb_query_font_reply_t *R); xcb_charinfo_t * xcb_query_font_char_infos (const xcb_query_font_reply_t *R); int xcb_query_font_char_infos_length (const xcb_query_font_reply_t *R); xcb_charinfo_iterator_t xcb_query_font_char_infos_iterator (const xcb_query_font_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_query_font_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_query_font_reply_t * xcb_query_font_reply (xcb_connection_t *c, xcb_query_font_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_query_text_extents_sizeof (const void *_buffer, uint32_t string_len); /** * @brief get text extents * * @param c The connection * @param font The \a font to calculate text extents in. You can also pass a graphics context. * @param string_len The number of characters in \a string. * @param string The text to get text extents for. * @return A cookie * * Query text extents from the X11 server. This request returns the bounding box * of the specified 16-bit character string in the specified \a font or the font * contained in the specified graphics context. * * `font_ascent` is set to the maximum of the ascent metrics of all characters in * the string. `font_descent` is set to the maximum of the descent metrics. * `overall_width` is set to the sum of the character-width metrics of all * characters in the string. For each character in the string, let W be the sum of * the character-width metrics of all characters preceding it in the string. Let L * be the left-side-bearing metric of the character plus W. Let R be the * right-side-bearing metric of the character plus W. The lbearing member is set * to the minimum L of all characters in the string. The rbearing member is set to * the maximum R. * * For fonts defined with linear indexing rather than 2-byte matrix indexing, each * `xcb_char2b_t` structure is interpreted as a 16-bit number with byte1 as the * most significant byte. If the font has no defined default character, undefined * characters in the string are taken to have all zero metrics. * * Characters with all zero metrics are ignored. If the font has no defined * default_char, the undefined characters in the string are also ignored. * */ xcb_query_text_extents_cookie_t xcb_query_text_extents (xcb_connection_t *c, xcb_fontable_t font, uint32_t string_len, const xcb_char2b_t *string); /** * @brief get text extents * * @param c The connection * @param font The \a font to calculate text extents in. You can also pass a graphics context. * @param string_len The number of characters in \a string. * @param string The text to get text extents for. * @return A cookie * * Query text extents from the X11 server. This request returns the bounding box * of the specified 16-bit character string in the specified \a font or the font * contained in the specified graphics context. * * `font_ascent` is set to the maximum of the ascent metrics of all characters in * the string. `font_descent` is set to the maximum of the descent metrics. * `overall_width` is set to the sum of the character-width metrics of all * characters in the string. For each character in the string, let W be the sum of * the character-width metrics of all characters preceding it in the string. Let L * be the left-side-bearing metric of the character plus W. Let R be the * right-side-bearing metric of the character plus W. The lbearing member is set * to the minimum L of all characters in the string. The rbearing member is set to * the maximum R. * * For fonts defined with linear indexing rather than 2-byte matrix indexing, each * `xcb_char2b_t` structure is interpreted as a 16-bit number with byte1 as the * most significant byte. If the font has no defined default character, undefined * characters in the string are taken to have all zero metrics. * * Characters with all zero metrics are ignored. If the font has no defined * default_char, the undefined characters in the string are also ignored. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_query_text_extents_cookie_t xcb_query_text_extents_unchecked (xcb_connection_t *c, xcb_fontable_t font, uint32_t string_len, const xcb_char2b_t *string); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_query_text_extents_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_query_text_extents_reply_t * xcb_query_text_extents_reply (xcb_connection_t *c, xcb_query_text_extents_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_str_sizeof (const void *_buffer); char * xcb_str_name (const xcb_str_t *R); int xcb_str_name_length (const xcb_str_t *R); xcb_generic_iterator_t xcb_str_name_end (const xcb_str_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_str_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_str_t) */ void xcb_str_next (xcb_str_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_str_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_str_end (xcb_str_iterator_t i); int xcb_list_fonts_sizeof (const void *_buffer); /** * @brief get matching font names * * @param c The connection * @param max_names The maximum number of fonts to be returned. * @param pattern_len The length (in bytes) of \a pattern. * @param pattern A font pattern, for example "-misc-fixed-*". * \n * The asterisk (*) is a wildcard for any number of characters. The question mark * (?) is a wildcard for a single character. Use of uppercase or lowercase does * not matter. * @return A cookie * * Gets a list of available font names which match the given \a pattern. * */ xcb_list_fonts_cookie_t xcb_list_fonts (xcb_connection_t *c, uint16_t max_names, uint16_t pattern_len, const char *pattern); /** * @brief get matching font names * * @param c The connection * @param max_names The maximum number of fonts to be returned. * @param pattern_len The length (in bytes) of \a pattern. * @param pattern A font pattern, for example "-misc-fixed-*". * \n * The asterisk (*) is a wildcard for any number of characters. The question mark * (?) is a wildcard for a single character. Use of uppercase or lowercase does * not matter. * @return A cookie * * Gets a list of available font names which match the given \a pattern. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_list_fonts_cookie_t xcb_list_fonts_unchecked (xcb_connection_t *c, uint16_t max_names, uint16_t pattern_len, const char *pattern); int xcb_list_fonts_names_length (const xcb_list_fonts_reply_t *R); xcb_str_iterator_t xcb_list_fonts_names_iterator (const xcb_list_fonts_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_list_fonts_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_list_fonts_reply_t * xcb_list_fonts_reply (xcb_connection_t *c, xcb_list_fonts_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_list_fonts_with_info_sizeof (const void *_buffer); /** * @brief get matching font names and information * * @param c The connection * @param max_names The maximum number of fonts to be returned. * @param pattern_len The length (in bytes) of \a pattern. * @param pattern A font pattern, for example "-misc-fixed-*". * \n * The asterisk (*) is a wildcard for any number of characters. The question mark * (?) is a wildcard for a single character. Use of uppercase or lowercase does * not matter. * @return A cookie * * Gets a list of available font names which match the given \a pattern. * */ xcb_list_fonts_with_info_cookie_t xcb_list_fonts_with_info (xcb_connection_t *c, uint16_t max_names, uint16_t pattern_len, const char *pattern); /** * @brief get matching font names and information * * @param c The connection * @param max_names The maximum number of fonts to be returned. * @param pattern_len The length (in bytes) of \a pattern. * @param pattern A font pattern, for example "-misc-fixed-*". * \n * The asterisk (*) is a wildcard for any number of characters. The question mark * (?) is a wildcard for a single character. Use of uppercase or lowercase does * not matter. * @return A cookie * * Gets a list of available font names which match the given \a pattern. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_list_fonts_with_info_cookie_t xcb_list_fonts_with_info_unchecked (xcb_connection_t *c, uint16_t max_names, uint16_t pattern_len, const char *pattern); xcb_fontprop_t * xcb_list_fonts_with_info_properties (const xcb_list_fonts_with_info_reply_t *R); int xcb_list_fonts_with_info_properties_length (const xcb_list_fonts_with_info_reply_t *R); xcb_fontprop_iterator_t xcb_list_fonts_with_info_properties_iterator (const xcb_list_fonts_with_info_reply_t *R); char * xcb_list_fonts_with_info_name (const xcb_list_fonts_with_info_reply_t *R); int xcb_list_fonts_with_info_name_length (const xcb_list_fonts_with_info_reply_t *R); xcb_generic_iterator_t xcb_list_fonts_with_info_name_end (const xcb_list_fonts_with_info_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_list_fonts_with_info_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_list_fonts_with_info_reply_t * xcb_list_fonts_with_info_reply (xcb_connection_t *c, xcb_list_fonts_with_info_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_set_font_path_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_set_font_path_checked (xcb_connection_t *c, uint16_t font_qty, const xcb_str_t *font); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_set_font_path (xcb_connection_t *c, uint16_t font_qty, const xcb_str_t *font); int xcb_set_font_path_font_length (const xcb_set_font_path_request_t *R); xcb_str_iterator_t xcb_set_font_path_font_iterator (const xcb_set_font_path_request_t *R); int xcb_get_font_path_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_get_font_path_cookie_t xcb_get_font_path (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_get_font_path_cookie_t xcb_get_font_path_unchecked (xcb_connection_t *c); int xcb_get_font_path_path_length (const xcb_get_font_path_reply_t *R); xcb_str_iterator_t xcb_get_font_path_path_iterator (const xcb_get_font_path_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_get_font_path_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_get_font_path_reply_t * xcb_get_font_path_reply (xcb_connection_t *c, xcb_get_font_path_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * @brief Creates a pixmap * * @param c The connection * @param depth TODO * @param pid The ID with which you will refer to the new pixmap, created by * `xcb_generate_id`. * @param drawable Drawable to get the screen from. * @param width The width of the new pixmap. * @param height The height of the new pixmap. * @return A cookie * * Creates a pixmap. The pixmap can only be used on the same screen as \a drawable * is on and only with drawables of the same \a depth. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_create_pixmap_checked (xcb_connection_t *c, uint8_t depth, xcb_pixmap_t pid, xcb_drawable_t drawable, uint16_t width, uint16_t height); /** * @brief Creates a pixmap * * @param c The connection * @param depth TODO * @param pid The ID with which you will refer to the new pixmap, created by * `xcb_generate_id`. * @param drawable Drawable to get the screen from. * @param width The width of the new pixmap. * @param height The height of the new pixmap. * @return A cookie * * Creates a pixmap. The pixmap can only be used on the same screen as \a drawable * is on and only with drawables of the same \a depth. * */ xcb_void_cookie_t xcb_create_pixmap (xcb_connection_t *c, uint8_t depth, xcb_pixmap_t pid, xcb_drawable_t drawable, uint16_t width, uint16_t height); /** * @brief Destroys a pixmap * * @param c The connection * @param pixmap The pixmap to destroy. * @return A cookie * * Deletes the association between the pixmap ID and the pixmap. The pixmap * storage will be freed when there are no more references to it. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_free_pixmap_checked (xcb_connection_t *c, xcb_pixmap_t pixmap); /** * @brief Destroys a pixmap * * @param c The connection * @param pixmap The pixmap to destroy. * @return A cookie * * Deletes the association between the pixmap ID and the pixmap. The pixmap * storage will be freed when there are no more references to it. * */ xcb_void_cookie_t xcb_free_pixmap (xcb_connection_t *c, xcb_pixmap_t pixmap); int xcb_create_gc_value_list_serialize (void **_buffer, uint32_t value_mask, const xcb_create_gc_value_list_t *_aux); int xcb_create_gc_value_list_unpack (const void *_buffer, uint32_t value_mask, xcb_create_gc_value_list_t *_aux); int xcb_create_gc_value_list_sizeof (const void *_buffer, uint32_t value_mask); int xcb_create_gc_sizeof (const void *_buffer); /** * @brief Creates a graphics context * * @param c The connection * @param cid The ID with which you will refer to the graphics context, created by * `xcb_generate_id`. * @param drawable Drawable to get the root/depth from. * @return A cookie * * Creates a graphics context. The graphics context can be used with any drawable * that has the same root and depth as the specified drawable. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_create_gc_checked (xcb_connection_t *c, xcb_gcontext_t cid, xcb_drawable_t drawable, uint32_t value_mask, const void *value_list); /** * @brief Creates a graphics context * * @param c The connection * @param cid The ID with which you will refer to the graphics context, created by * `xcb_generate_id`. * @param drawable Drawable to get the root/depth from. * @return A cookie * * Creates a graphics context. The graphics context can be used with any drawable * that has the same root and depth as the specified drawable. * */ xcb_void_cookie_t xcb_create_gc (xcb_connection_t *c, xcb_gcontext_t cid, xcb_drawable_t drawable, uint32_t value_mask, const void *value_list); /** * @brief Creates a graphics context * * @param c The connection * @param cid The ID with which you will refer to the graphics context, created by * `xcb_generate_id`. * @param drawable Drawable to get the root/depth from. * @return A cookie * * Creates a graphics context. The graphics context can be used with any drawable * that has the same root and depth as the specified drawable. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_create_gc_aux_checked (xcb_connection_t *c, xcb_gcontext_t cid, xcb_drawable_t drawable, uint32_t value_mask, const xcb_create_gc_value_list_t *value_list); /** * @brief Creates a graphics context * * @param c The connection * @param cid The ID with which you will refer to the graphics context, created by * `xcb_generate_id`. * @param drawable Drawable to get the root/depth from. * @return A cookie * * Creates a graphics context. The graphics context can be used with any drawable * that has the same root and depth as the specified drawable. * */ xcb_void_cookie_t xcb_create_gc_aux (xcb_connection_t *c, xcb_gcontext_t cid, xcb_drawable_t drawable, uint32_t value_mask, const xcb_create_gc_value_list_t *value_list); void * xcb_create_gc_value_list (const xcb_create_gc_request_t *R); int xcb_change_gc_value_list_serialize (void **_buffer, uint32_t value_mask, const xcb_change_gc_value_list_t *_aux); int xcb_change_gc_value_list_unpack (const void *_buffer, uint32_t value_mask, xcb_change_gc_value_list_t *_aux); int xcb_change_gc_value_list_sizeof (const void *_buffer, uint32_t value_mask); int xcb_change_gc_sizeof (const void *_buffer); /** * @brief change graphics context components * * @param c The connection * @param gc The graphics context to change. * @param value_mask A bitmask of #xcb_gc_t values. * @param value_mask \n * @param value_list Values for each of the components specified in the bitmask \a value_mask. The * order has to correspond to the order of possible \a value_mask bits. See the * example. * @return A cookie * * Changes the components specified by \a value_mask for the specified graphics context. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_change_gc_checked (xcb_connection_t *c, xcb_gcontext_t gc, uint32_t value_mask, const void *value_list); /** * @brief change graphics context components * * @param c The connection * @param gc The graphics context to change. * @param value_mask A bitmask of #xcb_gc_t values. * @param value_mask \n * @param value_list Values for each of the components specified in the bitmask \a value_mask. The * order has to correspond to the order of possible \a value_mask bits. See the * example. * @return A cookie * * Changes the components specified by \a value_mask for the specified graphics context. * */ xcb_void_cookie_t xcb_change_gc (xcb_connection_t *c, xcb_gcontext_t gc, uint32_t value_mask, const void *value_list); /** * @brief change graphics context components * * @param c The connection * @param gc The graphics context to change. * @param value_mask A bitmask of #xcb_gc_t values. * @param value_mask \n * @param value_list Values for each of the components specified in the bitmask \a value_mask. The * order has to correspond to the order of possible \a value_mask bits. See the * example. * @return A cookie * * Changes the components specified by \a value_mask for the specified graphics context. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_change_gc_aux_checked (xcb_connection_t *c, xcb_gcontext_t gc, uint32_t value_mask, const xcb_change_gc_value_list_t *value_list); /** * @brief change graphics context components * * @param c The connection * @param gc The graphics context to change. * @param value_mask A bitmask of #xcb_gc_t values. * @param value_mask \n * @param value_list Values for each of the components specified in the bitmask \a value_mask. The * order has to correspond to the order of possible \a value_mask bits. See the * example. * @return A cookie * * Changes the components specified by \a value_mask for the specified graphics context. * */ xcb_void_cookie_t xcb_change_gc_aux (xcb_connection_t *c, xcb_gcontext_t gc, uint32_t value_mask, const xcb_change_gc_value_list_t *value_list); void * xcb_change_gc_value_list (const xcb_change_gc_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_copy_gc_checked (xcb_connection_t *c, xcb_gcontext_t src_gc, xcb_gcontext_t dst_gc, uint32_t value_mask); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_copy_gc (xcb_connection_t *c, xcb_gcontext_t src_gc, xcb_gcontext_t dst_gc, uint32_t value_mask); int xcb_set_dashes_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_set_dashes_checked (xcb_connection_t *c, xcb_gcontext_t gc, uint16_t dash_offset, uint16_t dashes_len, const uint8_t *dashes); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_set_dashes (xcb_connection_t *c, xcb_gcontext_t gc, uint16_t dash_offset, uint16_t dashes_len, const uint8_t *dashes); uint8_t * xcb_set_dashes_dashes (const xcb_set_dashes_request_t *R); int xcb_set_dashes_dashes_length (const xcb_set_dashes_request_t *R); xcb_generic_iterator_t xcb_set_dashes_dashes_end (const xcb_set_dashes_request_t *R); int xcb_set_clip_rectangles_sizeof (const void *_buffer, uint32_t rectangles_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_set_clip_rectangles_checked (xcb_connection_t *c, uint8_t ordering, xcb_gcontext_t gc, int16_t clip_x_origin, int16_t clip_y_origin, uint32_t rectangles_len, const xcb_rectangle_t *rectangles); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_set_clip_rectangles (xcb_connection_t *c, uint8_t ordering, xcb_gcontext_t gc, int16_t clip_x_origin, int16_t clip_y_origin, uint32_t rectangles_len, const xcb_rectangle_t *rectangles); xcb_rectangle_t * xcb_set_clip_rectangles_rectangles (const xcb_set_clip_rectangles_request_t *R); int xcb_set_clip_rectangles_rectangles_length (const xcb_set_clip_rectangles_request_t *R); xcb_rectangle_iterator_t xcb_set_clip_rectangles_rectangles_iterator (const xcb_set_clip_rectangles_request_t *R); /** * @brief Destroys a graphics context * * @param c The connection * @param gc The graphics context to destroy. * @return A cookie * * Destroys the specified \a gc and all associated storage. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_free_gc_checked (xcb_connection_t *c, xcb_gcontext_t gc); /** * @brief Destroys a graphics context * * @param c The connection * @param gc The graphics context to destroy. * @return A cookie * * Destroys the specified \a gc and all associated storage. * */ xcb_void_cookie_t xcb_free_gc (xcb_connection_t *c, xcb_gcontext_t gc); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_clear_area_checked (xcb_connection_t *c, uint8_t exposures, xcb_window_t window, int16_t x, int16_t y, uint16_t width, uint16_t height); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_clear_area (xcb_connection_t *c, uint8_t exposures, xcb_window_t window, int16_t x, int16_t y, uint16_t width, uint16_t height); /** * @brief copy areas * * @param c The connection * @param src_drawable The source drawable (Window or Pixmap). * @param dst_drawable The destination drawable (Window or Pixmap). * @param gc The graphics context to use. * @param src_x The source X coordinate. * @param src_y The source Y coordinate. * @param dst_x The destination X coordinate. * @param dst_y The destination Y coordinate. * @param width The width of the area to copy (in pixels). * @param height The height of the area to copy (in pixels). * @return A cookie * * Copies the specified rectangle from \a src_drawable to \a dst_drawable. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_copy_area_checked (xcb_connection_t *c, xcb_drawable_t src_drawable, xcb_drawable_t dst_drawable, xcb_gcontext_t gc, int16_t src_x, int16_t src_y, int16_t dst_x, int16_t dst_y, uint16_t width, uint16_t height); /** * @brief copy areas * * @param c The connection * @param src_drawable The source drawable (Window or Pixmap). * @param dst_drawable The destination drawable (Window or Pixmap). * @param gc The graphics context to use. * @param src_x The source X coordinate. * @param src_y The source Y coordinate. * @param dst_x The destination X coordinate. * @param dst_y The destination Y coordinate. * @param width The width of the area to copy (in pixels). * @param height The height of the area to copy (in pixels). * @return A cookie * * Copies the specified rectangle from \a src_drawable to \a dst_drawable. * */ xcb_void_cookie_t xcb_copy_area (xcb_connection_t *c, xcb_drawable_t src_drawable, xcb_drawable_t dst_drawable, xcb_gcontext_t gc, int16_t src_x, int16_t src_y, int16_t dst_x, int16_t dst_y, uint16_t width, uint16_t height); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_copy_plane_checked (xcb_connection_t *c, xcb_drawable_t src_drawable, xcb_drawable_t dst_drawable, xcb_gcontext_t gc, int16_t src_x, int16_t src_y, int16_t dst_x, int16_t dst_y, uint16_t width, uint16_t height, uint32_t bit_plane); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_copy_plane (xcb_connection_t *c, xcb_drawable_t src_drawable, xcb_drawable_t dst_drawable, xcb_gcontext_t gc, int16_t src_x, int16_t src_y, int16_t dst_x, int16_t dst_y, uint16_t width, uint16_t height, uint32_t bit_plane); int xcb_poly_point_sizeof (const void *_buffer, uint32_t points_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_poly_point_checked (xcb_connection_t *c, uint8_t coordinate_mode, xcb_drawable_t drawable, xcb_gcontext_t gc, uint32_t points_len, const xcb_point_t *points); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_poly_point (xcb_connection_t *c, uint8_t coordinate_mode, xcb_drawable_t drawable, xcb_gcontext_t gc, uint32_t points_len, const xcb_point_t *points); xcb_point_t * xcb_poly_point_points (const xcb_poly_point_request_t *R); int xcb_poly_point_points_length (const xcb_poly_point_request_t *R); xcb_point_iterator_t xcb_poly_point_points_iterator (const xcb_poly_point_request_t *R); int xcb_poly_line_sizeof (const void *_buffer, uint32_t points_len); /** * @brief draw lines * * @param c The connection * @param coordinate_mode A bitmask of #xcb_coord_mode_t values. * @param coordinate_mode \n * @param drawable The drawable to draw the line(s) on. * @param gc The graphics context to use. * @param points_len The number of `xcb_point_t` structures in \a points. * @param points An array of points. * @return A cookie * * Draws \a points_len-1 lines between each pair of points (point[i], point[i+1]) * in the \a points array. The lines are drawn in the order listed in the array. * They join correctly at all intermediate points, and if the first and last * points coincide, the first and last lines also join correctly. For any given * line, a pixel is not drawn more than once. If thin (zero line-width) lines * intersect, the intersecting pixels are drawn multiple times. If wide lines * intersect, the intersecting pixels are drawn only once, as though the entire * request were a single, filled shape. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_poly_line_checked (xcb_connection_t *c, uint8_t coordinate_mode, xcb_drawable_t drawable, xcb_gcontext_t gc, uint32_t points_len, const xcb_point_t *points); /** * @brief draw lines * * @param c The connection * @param coordinate_mode A bitmask of #xcb_coord_mode_t values. * @param coordinate_mode \n * @param drawable The drawable to draw the line(s) on. * @param gc The graphics context to use. * @param points_len The number of `xcb_point_t` structures in \a points. * @param points An array of points. * @return A cookie * * Draws \a points_len-1 lines between each pair of points (point[i], point[i+1]) * in the \a points array. The lines are drawn in the order listed in the array. * They join correctly at all intermediate points, and if the first and last * points coincide, the first and last lines also join correctly. For any given * line, a pixel is not drawn more than once. If thin (zero line-width) lines * intersect, the intersecting pixels are drawn multiple times. If wide lines * intersect, the intersecting pixels are drawn only once, as though the entire * request were a single, filled shape. * */ xcb_void_cookie_t xcb_poly_line (xcb_connection_t *c, uint8_t coordinate_mode, xcb_drawable_t drawable, xcb_gcontext_t gc, uint32_t points_len, const xcb_point_t *points); xcb_point_t * xcb_poly_line_points (const xcb_poly_line_request_t *R); int xcb_poly_line_points_length (const xcb_poly_line_request_t *R); xcb_point_iterator_t xcb_poly_line_points_iterator (const xcb_poly_line_request_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_segment_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_segment_t) */ void xcb_segment_next (xcb_segment_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_segment_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_segment_end (xcb_segment_iterator_t i); int xcb_poly_segment_sizeof (const void *_buffer, uint32_t segments_len); /** * @brief draw lines * * @param c The connection * @param drawable A drawable (Window or Pixmap) to draw on. * @param gc The graphics context to use. * \n * TODO: document which attributes of a gc are used * @param segments_len The number of `xcb_segment_t` structures in \a segments. * @param segments An array of `xcb_segment_t` structures. * @return A cookie * * Draws multiple, unconnected lines. For each segment, a line is drawn between * (x1, y1) and (x2, y2). The lines are drawn in the order listed in the array of * `xcb_segment_t` structures and does not perform joining at coincident * endpoints. For any given line, a pixel is not drawn more than once. If lines * intersect, the intersecting pixels are drawn multiple times. * * TODO: include the xcb_segment_t data structure * * TODO: an example * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_poly_segment_checked (xcb_connection_t *c, xcb_drawable_t drawable, xcb_gcontext_t gc, uint32_t segments_len, const xcb_segment_t *segments); /** * @brief draw lines * * @param c The connection * @param drawable A drawable (Window or Pixmap) to draw on. * @param gc The graphics context to use. * \n * TODO: document which attributes of a gc are used * @param segments_len The number of `xcb_segment_t` structures in \a segments. * @param segments An array of `xcb_segment_t` structures. * @return A cookie * * Draws multiple, unconnected lines. For each segment, a line is drawn between * (x1, y1) and (x2, y2). The lines are drawn in the order listed in the array of * `xcb_segment_t` structures and does not perform joining at coincident * endpoints. For any given line, a pixel is not drawn more than once. If lines * intersect, the intersecting pixels are drawn multiple times. * * TODO: include the xcb_segment_t data structure * * TODO: an example * */ xcb_void_cookie_t xcb_poly_segment (xcb_connection_t *c, xcb_drawable_t drawable, xcb_gcontext_t gc, uint32_t segments_len, const xcb_segment_t *segments); xcb_segment_t * xcb_poly_segment_segments (const xcb_poly_segment_request_t *R); int xcb_poly_segment_segments_length (const xcb_poly_segment_request_t *R); xcb_segment_iterator_t xcb_poly_segment_segments_iterator (const xcb_poly_segment_request_t *R); int xcb_poly_rectangle_sizeof (const void *_buffer, uint32_t rectangles_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_poly_rectangle_checked (xcb_connection_t *c, xcb_drawable_t drawable, xcb_gcontext_t gc, uint32_t rectangles_len, const xcb_rectangle_t *rectangles); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_poly_rectangle (xcb_connection_t *c, xcb_drawable_t drawable, xcb_gcontext_t gc, uint32_t rectangles_len, const xcb_rectangle_t *rectangles); xcb_rectangle_t * xcb_poly_rectangle_rectangles (const xcb_poly_rectangle_request_t *R); int xcb_poly_rectangle_rectangles_length (const xcb_poly_rectangle_request_t *R); xcb_rectangle_iterator_t xcb_poly_rectangle_rectangles_iterator (const xcb_poly_rectangle_request_t *R); int xcb_poly_arc_sizeof (const void *_buffer, uint32_t arcs_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_poly_arc_checked (xcb_connection_t *c, xcb_drawable_t drawable, xcb_gcontext_t gc, uint32_t arcs_len, const xcb_arc_t *arcs); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_poly_arc (xcb_connection_t *c, xcb_drawable_t drawable, xcb_gcontext_t gc, uint32_t arcs_len, const xcb_arc_t *arcs); xcb_arc_t * xcb_poly_arc_arcs (const xcb_poly_arc_request_t *R); int xcb_poly_arc_arcs_length (const xcb_poly_arc_request_t *R); xcb_arc_iterator_t xcb_poly_arc_arcs_iterator (const xcb_poly_arc_request_t *R); int xcb_fill_poly_sizeof (const void *_buffer, uint32_t points_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_fill_poly_checked (xcb_connection_t *c, xcb_drawable_t drawable, xcb_gcontext_t gc, uint8_t shape, uint8_t coordinate_mode, uint32_t points_len, const xcb_point_t *points); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_fill_poly (xcb_connection_t *c, xcb_drawable_t drawable, xcb_gcontext_t gc, uint8_t shape, uint8_t coordinate_mode, uint32_t points_len, const xcb_point_t *points); xcb_point_t * xcb_fill_poly_points (const xcb_fill_poly_request_t *R); int xcb_fill_poly_points_length (const xcb_fill_poly_request_t *R); xcb_point_iterator_t xcb_fill_poly_points_iterator (const xcb_fill_poly_request_t *R); int xcb_poly_fill_rectangle_sizeof (const void *_buffer, uint32_t rectangles_len); /** * @brief Fills rectangles * * @param c The connection * @param drawable The drawable (Window or Pixmap) to draw on. * @param gc The graphics context to use. * \n * The following graphics context components are used: function, plane-mask, * fill-style, subwindow-mode, clip-x-origin, clip-y-origin, and clip-mask. * \n * The following graphics context mode-dependent components are used: * foreground, background, tile, stipple, tile-stipple-x-origin, and * tile-stipple-y-origin. * @param rectangles_len The number of `xcb_rectangle_t` structures in \a rectangles. * @param rectangles The rectangles to fill. * @return A cookie * * Fills the specified rectangle(s) in the order listed in the array. For any * given rectangle, each pixel is not drawn more than once. If rectangles * intersect, the intersecting pixels are drawn multiple times. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_poly_fill_rectangle_checked (xcb_connection_t *c, xcb_drawable_t drawable, xcb_gcontext_t gc, uint32_t rectangles_len, const xcb_rectangle_t *rectangles); /** * @brief Fills rectangles * * @param c The connection * @param drawable The drawable (Window or Pixmap) to draw on. * @param gc The graphics context to use. * \n * The following graphics context components are used: function, plane-mask, * fill-style, subwindow-mode, clip-x-origin, clip-y-origin, and clip-mask. * \n * The following graphics context mode-dependent components are used: * foreground, background, tile, stipple, tile-stipple-x-origin, and * tile-stipple-y-origin. * @param rectangles_len The number of `xcb_rectangle_t` structures in \a rectangles. * @param rectangles The rectangles to fill. * @return A cookie * * Fills the specified rectangle(s) in the order listed in the array. For any * given rectangle, each pixel is not drawn more than once. If rectangles * intersect, the intersecting pixels are drawn multiple times. * */ xcb_void_cookie_t xcb_poly_fill_rectangle (xcb_connection_t *c, xcb_drawable_t drawable, xcb_gcontext_t gc, uint32_t rectangles_len, const xcb_rectangle_t *rectangles); xcb_rectangle_t * xcb_poly_fill_rectangle_rectangles (const xcb_poly_fill_rectangle_request_t *R); int xcb_poly_fill_rectangle_rectangles_length (const xcb_poly_fill_rectangle_request_t *R); xcb_rectangle_iterator_t xcb_poly_fill_rectangle_rectangles_iterator (const xcb_poly_fill_rectangle_request_t *R); int xcb_poly_fill_arc_sizeof (const void *_buffer, uint32_t arcs_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_poly_fill_arc_checked (xcb_connection_t *c, xcb_drawable_t drawable, xcb_gcontext_t gc, uint32_t arcs_len, const xcb_arc_t *arcs); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_poly_fill_arc (xcb_connection_t *c, xcb_drawable_t drawable, xcb_gcontext_t gc, uint32_t arcs_len, const xcb_arc_t *arcs); xcb_arc_t * xcb_poly_fill_arc_arcs (const xcb_poly_fill_arc_request_t *R); int xcb_poly_fill_arc_arcs_length (const xcb_poly_fill_arc_request_t *R); xcb_arc_iterator_t xcb_poly_fill_arc_arcs_iterator (const xcb_poly_fill_arc_request_t *R); int xcb_put_image_sizeof (const void *_buffer, uint32_t data_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_put_image_checked (xcb_connection_t *c, uint8_t format, xcb_drawable_t drawable, xcb_gcontext_t gc, uint16_t width, uint16_t height, int16_t dst_x, int16_t dst_y, uint8_t left_pad, uint8_t depth, uint32_t data_len, const uint8_t *data); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_put_image (xcb_connection_t *c, uint8_t format, xcb_drawable_t drawable, xcb_gcontext_t gc, uint16_t width, uint16_t height, int16_t dst_x, int16_t dst_y, uint8_t left_pad, uint8_t depth, uint32_t data_len, const uint8_t *data); uint8_t * xcb_put_image_data (const xcb_put_image_request_t *R); int xcb_put_image_data_length (const xcb_put_image_request_t *R); xcb_generic_iterator_t xcb_put_image_data_end (const xcb_put_image_request_t *R); int xcb_get_image_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_get_image_cookie_t xcb_get_image (xcb_connection_t *c, uint8_t format, xcb_drawable_t drawable, int16_t x, int16_t y, uint16_t width, uint16_t height, uint32_t plane_mask); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_get_image_cookie_t xcb_get_image_unchecked (xcb_connection_t *c, uint8_t format, xcb_drawable_t drawable, int16_t x, int16_t y, uint16_t width, uint16_t height, uint32_t plane_mask); uint8_t * xcb_get_image_data (const xcb_get_image_reply_t *R); int xcb_get_image_data_length (const xcb_get_image_reply_t *R); xcb_generic_iterator_t xcb_get_image_data_end (const xcb_get_image_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_get_image_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_get_image_reply_t * xcb_get_image_reply (xcb_connection_t *c, xcb_get_image_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_poly_text_8_sizeof (const void *_buffer, uint32_t items_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_poly_text_8_checked (xcb_connection_t *c, xcb_drawable_t drawable, xcb_gcontext_t gc, int16_t x, int16_t y, uint32_t items_len, const uint8_t *items); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_poly_text_8 (xcb_connection_t *c, xcb_drawable_t drawable, xcb_gcontext_t gc, int16_t x, int16_t y, uint32_t items_len, const uint8_t *items); uint8_t * xcb_poly_text_8_items (const xcb_poly_text_8_request_t *R); int xcb_poly_text_8_items_length (const xcb_poly_text_8_request_t *R); xcb_generic_iterator_t xcb_poly_text_8_items_end (const xcb_poly_text_8_request_t *R); int xcb_poly_text_16_sizeof (const void *_buffer, uint32_t items_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_poly_text_16_checked (xcb_connection_t *c, xcb_drawable_t drawable, xcb_gcontext_t gc, int16_t x, int16_t y, uint32_t items_len, const uint8_t *items); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_poly_text_16 (xcb_connection_t *c, xcb_drawable_t drawable, xcb_gcontext_t gc, int16_t x, int16_t y, uint32_t items_len, const uint8_t *items); uint8_t * xcb_poly_text_16_items (const xcb_poly_text_16_request_t *R); int xcb_poly_text_16_items_length (const xcb_poly_text_16_request_t *R); xcb_generic_iterator_t xcb_poly_text_16_items_end (const xcb_poly_text_16_request_t *R); int xcb_image_text_8_sizeof (const void *_buffer); /** * @brief Draws text * * @param c The connection * @param string_len The length of the \a string. Note that this parameter limited by 255 due to * using 8 bits! * @param drawable The drawable (Window or Pixmap) to draw text on. * @param gc The graphics context to use. * \n * The following graphics context components are used: plane-mask, foreground, * background, font, subwindow-mode, clip-x-origin, clip-y-origin, and clip-mask. * @param x The x coordinate of the first character, relative to the origin of \a drawable. * @param y The y coordinate of the first character, relative to the origin of \a drawable. * @param string The string to draw. Only the first 255 characters are relevant due to the data * type of \a string_len. * @return A cookie * * Fills the destination rectangle with the background pixel from \a gc, then * paints the text with the foreground pixel from \a gc. The upper-left corner of * the filled rectangle is at [x, y - font-ascent]. The width is overall-width, * the height is font-ascent + font-descent. The overall-width, font-ascent and * font-descent are as returned by `xcb_query_text_extents` (TODO). * * Note that using X core fonts is deprecated (but still supported) in favor of * client-side rendering using Xft. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_image_text_8_checked (xcb_connection_t *c, uint8_t string_len, xcb_drawable_t drawable, xcb_gcontext_t gc, int16_t x, int16_t y, const char *string); /** * @brief Draws text * * @param c The connection * @param string_len The length of the \a string. Note that this parameter limited by 255 due to * using 8 bits! * @param drawable The drawable (Window or Pixmap) to draw text on. * @param gc The graphics context to use. * \n * The following graphics context components are used: plane-mask, foreground, * background, font, subwindow-mode, clip-x-origin, clip-y-origin, and clip-mask. * @param x The x coordinate of the first character, relative to the origin of \a drawable. * @param y The y coordinate of the first character, relative to the origin of \a drawable. * @param string The string to draw. Only the first 255 characters are relevant due to the data * type of \a string_len. * @return A cookie * * Fills the destination rectangle with the background pixel from \a gc, then * paints the text with the foreground pixel from \a gc. The upper-left corner of * the filled rectangle is at [x, y - font-ascent]. The width is overall-width, * the height is font-ascent + font-descent. The overall-width, font-ascent and * font-descent are as returned by `xcb_query_text_extents` (TODO). * * Note that using X core fonts is deprecated (but still supported) in favor of * client-side rendering using Xft. * */ xcb_void_cookie_t xcb_image_text_8 (xcb_connection_t *c, uint8_t string_len, xcb_drawable_t drawable, xcb_gcontext_t gc, int16_t x, int16_t y, const char *string); char * xcb_image_text_8_string (const xcb_image_text_8_request_t *R); int xcb_image_text_8_string_length (const xcb_image_text_8_request_t *R); xcb_generic_iterator_t xcb_image_text_8_string_end (const xcb_image_text_8_request_t *R); int xcb_image_text_16_sizeof (const void *_buffer); /** * @brief Draws text * * @param c The connection * @param string_len The length of the \a string in characters. Note that this parameter limited by * 255 due to using 8 bits! * @param drawable The drawable (Window or Pixmap) to draw text on. * @param gc The graphics context to use. * \n * The following graphics context components are used: plane-mask, foreground, * background, font, subwindow-mode, clip-x-origin, clip-y-origin, and clip-mask. * @param x The x coordinate of the first character, relative to the origin of \a drawable. * @param y The y coordinate of the first character, relative to the origin of \a drawable. * @param string The string to draw. Only the first 255 characters are relevant due to the data * type of \a string_len. Every character uses 2 bytes (hence the 16 in this * request's name). * @return A cookie * * Fills the destination rectangle with the background pixel from \a gc, then * paints the text with the foreground pixel from \a gc. The upper-left corner of * the filled rectangle is at [x, y - font-ascent]. The width is overall-width, * the height is font-ascent + font-descent. The overall-width, font-ascent and * font-descent are as returned by `xcb_query_text_extents` (TODO). * * Note that using X core fonts is deprecated (but still supported) in favor of * client-side rendering using Xft. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_image_text_16_checked (xcb_connection_t *c, uint8_t string_len, xcb_drawable_t drawable, xcb_gcontext_t gc, int16_t x, int16_t y, const xcb_char2b_t *string); /** * @brief Draws text * * @param c The connection * @param string_len The length of the \a string in characters. Note that this parameter limited by * 255 due to using 8 bits! * @param drawable The drawable (Window or Pixmap) to draw text on. * @param gc The graphics context to use. * \n * The following graphics context components are used: plane-mask, foreground, * background, font, subwindow-mode, clip-x-origin, clip-y-origin, and clip-mask. * @param x The x coordinate of the first character, relative to the origin of \a drawable. * @param y The y coordinate of the first character, relative to the origin of \a drawable. * @param string The string to draw. Only the first 255 characters are relevant due to the data * type of \a string_len. Every character uses 2 bytes (hence the 16 in this * request's name). * @return A cookie * * Fills the destination rectangle with the background pixel from \a gc, then * paints the text with the foreground pixel from \a gc. The upper-left corner of * the filled rectangle is at [x, y - font-ascent]. The width is overall-width, * the height is font-ascent + font-descent. The overall-width, font-ascent and * font-descent are as returned by `xcb_query_text_extents` (TODO). * * Note that using X core fonts is deprecated (but still supported) in favor of * client-side rendering using Xft. * */ xcb_void_cookie_t xcb_image_text_16 (xcb_connection_t *c, uint8_t string_len, xcb_drawable_t drawable, xcb_gcontext_t gc, int16_t x, int16_t y, const xcb_char2b_t *string); xcb_char2b_t * xcb_image_text_16_string (const xcb_image_text_16_request_t *R); int xcb_image_text_16_string_length (const xcb_image_text_16_request_t *R); xcb_char2b_iterator_t xcb_image_text_16_string_iterator (const xcb_image_text_16_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_create_colormap_checked (xcb_connection_t *c, uint8_t alloc, xcb_colormap_t mid, xcb_window_t window, xcb_visualid_t visual); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_create_colormap (xcb_connection_t *c, uint8_t alloc, xcb_colormap_t mid, xcb_window_t window, xcb_visualid_t visual); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_free_colormap_checked (xcb_connection_t *c, xcb_colormap_t cmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_free_colormap (xcb_connection_t *c, xcb_colormap_t cmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_copy_colormap_and_free_checked (xcb_connection_t *c, xcb_colormap_t mid, xcb_colormap_t src_cmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_copy_colormap_and_free (xcb_connection_t *c, xcb_colormap_t mid, xcb_colormap_t src_cmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_install_colormap_checked (xcb_connection_t *c, xcb_colormap_t cmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_install_colormap (xcb_connection_t *c, xcb_colormap_t cmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_uninstall_colormap_checked (xcb_connection_t *c, xcb_colormap_t cmap); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_uninstall_colormap (xcb_connection_t *c, xcb_colormap_t cmap); int xcb_list_installed_colormaps_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_list_installed_colormaps_cookie_t xcb_list_installed_colormaps (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_list_installed_colormaps_cookie_t xcb_list_installed_colormaps_unchecked (xcb_connection_t *c, xcb_window_t window); xcb_colormap_t * xcb_list_installed_colormaps_cmaps (const xcb_list_installed_colormaps_reply_t *R); int xcb_list_installed_colormaps_cmaps_length (const xcb_list_installed_colormaps_reply_t *R); xcb_generic_iterator_t xcb_list_installed_colormaps_cmaps_end (const xcb_list_installed_colormaps_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_list_installed_colormaps_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_list_installed_colormaps_reply_t * xcb_list_installed_colormaps_reply (xcb_connection_t *c, xcb_list_installed_colormaps_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * @brief Allocate a color * * @param c The connection * @param cmap TODO * @param red The red value of your color. * @param green The green value of your color. * @param blue The blue value of your color. * @return A cookie * * Allocates a read-only colormap entry corresponding to the closest RGB value * supported by the hardware. If you are using TrueColor, you can take a shortcut * and directly calculate the color pixel value to avoid the round trip. But, for * example, on 16-bit color setups (VNC), you can easily get the closest supported * RGB value to the RGB value you are specifying. * */ xcb_alloc_color_cookie_t xcb_alloc_color (xcb_connection_t *c, xcb_colormap_t cmap, uint16_t red, uint16_t green, uint16_t blue); /** * @brief Allocate a color * * @param c The connection * @param cmap TODO * @param red The red value of your color. * @param green The green value of your color. * @param blue The blue value of your color. * @return A cookie * * Allocates a read-only colormap entry corresponding to the closest RGB value * supported by the hardware. If you are using TrueColor, you can take a shortcut * and directly calculate the color pixel value to avoid the round trip. But, for * example, on 16-bit color setups (VNC), you can easily get the closest supported * RGB value to the RGB value you are specifying. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_alloc_color_cookie_t xcb_alloc_color_unchecked (xcb_connection_t *c, xcb_colormap_t cmap, uint16_t red, uint16_t green, uint16_t blue); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_alloc_color_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_alloc_color_reply_t * xcb_alloc_color_reply (xcb_connection_t *c, xcb_alloc_color_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_alloc_named_color_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_alloc_named_color_cookie_t xcb_alloc_named_color (xcb_connection_t *c, xcb_colormap_t cmap, uint16_t name_len, const char *name); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_alloc_named_color_cookie_t xcb_alloc_named_color_unchecked (xcb_connection_t *c, xcb_colormap_t cmap, uint16_t name_len, const char *name); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_alloc_named_color_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_alloc_named_color_reply_t * xcb_alloc_named_color_reply (xcb_connection_t *c, xcb_alloc_named_color_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_alloc_color_cells_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_alloc_color_cells_cookie_t xcb_alloc_color_cells (xcb_connection_t *c, uint8_t contiguous, xcb_colormap_t cmap, uint16_t colors, uint16_t planes); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_alloc_color_cells_cookie_t xcb_alloc_color_cells_unchecked (xcb_connection_t *c, uint8_t contiguous, xcb_colormap_t cmap, uint16_t colors, uint16_t planes); uint32_t * xcb_alloc_color_cells_pixels (const xcb_alloc_color_cells_reply_t *R); int xcb_alloc_color_cells_pixels_length (const xcb_alloc_color_cells_reply_t *R); xcb_generic_iterator_t xcb_alloc_color_cells_pixels_end (const xcb_alloc_color_cells_reply_t *R); uint32_t * xcb_alloc_color_cells_masks (const xcb_alloc_color_cells_reply_t *R); int xcb_alloc_color_cells_masks_length (const xcb_alloc_color_cells_reply_t *R); xcb_generic_iterator_t xcb_alloc_color_cells_masks_end (const xcb_alloc_color_cells_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_alloc_color_cells_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_alloc_color_cells_reply_t * xcb_alloc_color_cells_reply (xcb_connection_t *c, xcb_alloc_color_cells_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_alloc_color_planes_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_alloc_color_planes_cookie_t xcb_alloc_color_planes (xcb_connection_t *c, uint8_t contiguous, xcb_colormap_t cmap, uint16_t colors, uint16_t reds, uint16_t greens, uint16_t blues); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_alloc_color_planes_cookie_t xcb_alloc_color_planes_unchecked (xcb_connection_t *c, uint8_t contiguous, xcb_colormap_t cmap, uint16_t colors, uint16_t reds, uint16_t greens, uint16_t blues); uint32_t * xcb_alloc_color_planes_pixels (const xcb_alloc_color_planes_reply_t *R); int xcb_alloc_color_planes_pixels_length (const xcb_alloc_color_planes_reply_t *R); xcb_generic_iterator_t xcb_alloc_color_planes_pixels_end (const xcb_alloc_color_planes_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_alloc_color_planes_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_alloc_color_planes_reply_t * xcb_alloc_color_planes_reply (xcb_connection_t *c, xcb_alloc_color_planes_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_free_colors_sizeof (const void *_buffer, uint32_t pixels_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_free_colors_checked (xcb_connection_t *c, xcb_colormap_t cmap, uint32_t plane_mask, uint32_t pixels_len, const uint32_t *pixels); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_free_colors (xcb_connection_t *c, xcb_colormap_t cmap, uint32_t plane_mask, uint32_t pixels_len, const uint32_t *pixels); uint32_t * xcb_free_colors_pixels (const xcb_free_colors_request_t *R); int xcb_free_colors_pixels_length (const xcb_free_colors_request_t *R); xcb_generic_iterator_t xcb_free_colors_pixels_end (const xcb_free_colors_request_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_coloritem_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_coloritem_t) */ void xcb_coloritem_next (xcb_coloritem_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_coloritem_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_coloritem_end (xcb_coloritem_iterator_t i); int xcb_store_colors_sizeof (const void *_buffer, uint32_t items_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_store_colors_checked (xcb_connection_t *c, xcb_colormap_t cmap, uint32_t items_len, const xcb_coloritem_t *items); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_store_colors (xcb_connection_t *c, xcb_colormap_t cmap, uint32_t items_len, const xcb_coloritem_t *items); xcb_coloritem_t * xcb_store_colors_items (const xcb_store_colors_request_t *R); int xcb_store_colors_items_length (const xcb_store_colors_request_t *R); xcb_coloritem_iterator_t xcb_store_colors_items_iterator (const xcb_store_colors_request_t *R); int xcb_store_named_color_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_store_named_color_checked (xcb_connection_t *c, uint8_t flags, xcb_colormap_t cmap, uint32_t pixel, uint16_t name_len, const char *name); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_store_named_color (xcb_connection_t *c, uint8_t flags, xcb_colormap_t cmap, uint32_t pixel, uint16_t name_len, const char *name); char * xcb_store_named_color_name (const xcb_store_named_color_request_t *R); int xcb_store_named_color_name_length (const xcb_store_named_color_request_t *R); xcb_generic_iterator_t xcb_store_named_color_name_end (const xcb_store_named_color_request_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_rgb_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_rgb_t) */ void xcb_rgb_next (xcb_rgb_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_rgb_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_rgb_end (xcb_rgb_iterator_t i); int xcb_query_colors_sizeof (const void *_buffer, uint32_t pixels_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_query_colors_cookie_t xcb_query_colors (xcb_connection_t *c, xcb_colormap_t cmap, uint32_t pixels_len, const uint32_t *pixels); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_query_colors_cookie_t xcb_query_colors_unchecked (xcb_connection_t *c, xcb_colormap_t cmap, uint32_t pixels_len, const uint32_t *pixels); xcb_rgb_t * xcb_query_colors_colors (const xcb_query_colors_reply_t *R); int xcb_query_colors_colors_length (const xcb_query_colors_reply_t *R); xcb_rgb_iterator_t xcb_query_colors_colors_iterator (const xcb_query_colors_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_query_colors_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_query_colors_reply_t * xcb_query_colors_reply (xcb_connection_t *c, xcb_query_colors_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_lookup_color_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_lookup_color_cookie_t xcb_lookup_color (xcb_connection_t *c, xcb_colormap_t cmap, uint16_t name_len, const char *name); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_lookup_color_cookie_t xcb_lookup_color_unchecked (xcb_connection_t *c, xcb_colormap_t cmap, uint16_t name_len, const char *name); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_lookup_color_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_lookup_color_reply_t * xcb_lookup_color_reply (xcb_connection_t *c, xcb_lookup_color_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_create_cursor_checked (xcb_connection_t *c, xcb_cursor_t cid, xcb_pixmap_t source, xcb_pixmap_t mask, uint16_t fore_red, uint16_t fore_green, uint16_t fore_blue, uint16_t back_red, uint16_t back_green, uint16_t back_blue, uint16_t x, uint16_t y); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_create_cursor (xcb_connection_t *c, xcb_cursor_t cid, xcb_pixmap_t source, xcb_pixmap_t mask, uint16_t fore_red, uint16_t fore_green, uint16_t fore_blue, uint16_t back_red, uint16_t back_green, uint16_t back_blue, uint16_t x, uint16_t y); /** * @brief create cursor * * @param c The connection * @param cid The ID with which you will refer to the cursor, created by `xcb_generate_id`. * @param source_font In which font to look for the cursor glyph. * @param mask_font In which font to look for the mask glyph. * @param source_char The glyph of \a source_font to use. * @param mask_char The glyph of \a mask_font to use as a mask: Pixels which are set to 1 define * which source pixels are displayed. All pixels which are set to 0 are not * displayed. * @param fore_red The red value of the foreground color. * @param fore_green The green value of the foreground color. * @param fore_blue The blue value of the foreground color. * @param back_red The red value of the background color. * @param back_green The green value of the background color. * @param back_blue The blue value of the background color. * @return A cookie * * Creates a cursor from a font glyph. X provides a set of standard cursor shapes * in a special font named cursor. Applications are encouraged to use this * interface for their cursors because the font can be customized for the * individual display type. * * All pixels which are set to 1 in the source will use the foreground color (as * specified by \a fore_red, \a fore_green and \a fore_blue). All pixels set to 0 * will use the background color (as specified by \a back_red, \a back_green and * \a back_blue). * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_create_glyph_cursor_checked (xcb_connection_t *c, xcb_cursor_t cid, xcb_font_t source_font, xcb_font_t mask_font, uint16_t source_char, uint16_t mask_char, uint16_t fore_red, uint16_t fore_green, uint16_t fore_blue, uint16_t back_red, uint16_t back_green, uint16_t back_blue); /** * @brief create cursor * * @param c The connection * @param cid The ID with which you will refer to the cursor, created by `xcb_generate_id`. * @param source_font In which font to look for the cursor glyph. * @param mask_font In which font to look for the mask glyph. * @param source_char The glyph of \a source_font to use. * @param mask_char The glyph of \a mask_font to use as a mask: Pixels which are set to 1 define * which source pixels are displayed. All pixels which are set to 0 are not * displayed. * @param fore_red The red value of the foreground color. * @param fore_green The green value of the foreground color. * @param fore_blue The blue value of the foreground color. * @param back_red The red value of the background color. * @param back_green The green value of the background color. * @param back_blue The blue value of the background color. * @return A cookie * * Creates a cursor from a font glyph. X provides a set of standard cursor shapes * in a special font named cursor. Applications are encouraged to use this * interface for their cursors because the font can be customized for the * individual display type. * * All pixels which are set to 1 in the source will use the foreground color (as * specified by \a fore_red, \a fore_green and \a fore_blue). All pixels set to 0 * will use the background color (as specified by \a back_red, \a back_green and * \a back_blue). * */ xcb_void_cookie_t xcb_create_glyph_cursor (xcb_connection_t *c, xcb_cursor_t cid, xcb_font_t source_font, xcb_font_t mask_font, uint16_t source_char, uint16_t mask_char, uint16_t fore_red, uint16_t fore_green, uint16_t fore_blue, uint16_t back_red, uint16_t back_green, uint16_t back_blue); /** * @brief Deletes a cursor * * @param c The connection * @param cursor The cursor to destroy. * @return A cookie * * Deletes the association between the cursor resource ID and the specified * cursor. The cursor is freed when no other resource references it. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_free_cursor_checked (xcb_connection_t *c, xcb_cursor_t cursor); /** * @brief Deletes a cursor * * @param c The connection * @param cursor The cursor to destroy. * @return A cookie * * Deletes the association between the cursor resource ID and the specified * cursor. The cursor is freed when no other resource references it. * */ xcb_void_cookie_t xcb_free_cursor (xcb_connection_t *c, xcb_cursor_t cursor); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_recolor_cursor_checked (xcb_connection_t *c, xcb_cursor_t cursor, uint16_t fore_red, uint16_t fore_green, uint16_t fore_blue, uint16_t back_red, uint16_t back_green, uint16_t back_blue); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_recolor_cursor (xcb_connection_t *c, xcb_cursor_t cursor, uint16_t fore_red, uint16_t fore_green, uint16_t fore_blue, uint16_t back_red, uint16_t back_green, uint16_t back_blue); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_query_best_size_cookie_t xcb_query_best_size (xcb_connection_t *c, uint8_t _class, xcb_drawable_t drawable, uint16_t width, uint16_t height); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_query_best_size_cookie_t xcb_query_best_size_unchecked (xcb_connection_t *c, uint8_t _class, xcb_drawable_t drawable, uint16_t width, uint16_t height); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_query_best_size_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_query_best_size_reply_t * xcb_query_best_size_reply (xcb_connection_t *c, xcb_query_best_size_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_query_extension_sizeof (const void *_buffer); /** * @brief check if extension is present * * @param c The connection * @param name_len The length of \a name in bytes. * @param name The name of the extension to query, for example "RANDR". This is case * sensitive! * @return A cookie * * Determines if the specified extension is present on this X11 server. * * Every extension has a unique `major_opcode` to identify requests, the minor * opcodes and request formats are extension-specific. If the extension provides * events and errors, the `first_event` and `first_error` fields in the reply are * set accordingly. * * There should rarely be a need to use this request directly, XCB provides the * `xcb_get_extension_data` function instead. * */ xcb_query_extension_cookie_t xcb_query_extension (xcb_connection_t *c, uint16_t name_len, const char *name); /** * @brief check if extension is present * * @param c The connection * @param name_len The length of \a name in bytes. * @param name The name of the extension to query, for example "RANDR". This is case * sensitive! * @return A cookie * * Determines if the specified extension is present on this X11 server. * * Every extension has a unique `major_opcode` to identify requests, the minor * opcodes and request formats are extension-specific. If the extension provides * events and errors, the `first_event` and `first_error` fields in the reply are * set accordingly. * * There should rarely be a need to use this request directly, XCB provides the * `xcb_get_extension_data` function instead. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_query_extension_cookie_t xcb_query_extension_unchecked (xcb_connection_t *c, uint16_t name_len, const char *name); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_query_extension_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_query_extension_reply_t * xcb_query_extension_reply (xcb_connection_t *c, xcb_query_extension_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_list_extensions_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_list_extensions_cookie_t xcb_list_extensions (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_list_extensions_cookie_t xcb_list_extensions_unchecked (xcb_connection_t *c); int xcb_list_extensions_names_length (const xcb_list_extensions_reply_t *R); xcb_str_iterator_t xcb_list_extensions_names_iterator (const xcb_list_extensions_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_list_extensions_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_list_extensions_reply_t * xcb_list_extensions_reply (xcb_connection_t *c, xcb_list_extensions_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_change_keyboard_mapping_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_change_keyboard_mapping_checked (xcb_connection_t *c, uint8_t keycode_count, xcb_keycode_t first_keycode, uint8_t keysyms_per_keycode, const xcb_keysym_t *keysyms); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_change_keyboard_mapping (xcb_connection_t *c, uint8_t keycode_count, xcb_keycode_t first_keycode, uint8_t keysyms_per_keycode, const xcb_keysym_t *keysyms); xcb_keysym_t * xcb_change_keyboard_mapping_keysyms (const xcb_change_keyboard_mapping_request_t *R); int xcb_change_keyboard_mapping_keysyms_length (const xcb_change_keyboard_mapping_request_t *R); xcb_generic_iterator_t xcb_change_keyboard_mapping_keysyms_end (const xcb_change_keyboard_mapping_request_t *R); int xcb_get_keyboard_mapping_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_get_keyboard_mapping_cookie_t xcb_get_keyboard_mapping (xcb_connection_t *c, xcb_keycode_t first_keycode, uint8_t count); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_get_keyboard_mapping_cookie_t xcb_get_keyboard_mapping_unchecked (xcb_connection_t *c, xcb_keycode_t first_keycode, uint8_t count); xcb_keysym_t * xcb_get_keyboard_mapping_keysyms (const xcb_get_keyboard_mapping_reply_t *R); int xcb_get_keyboard_mapping_keysyms_length (const xcb_get_keyboard_mapping_reply_t *R); xcb_generic_iterator_t xcb_get_keyboard_mapping_keysyms_end (const xcb_get_keyboard_mapping_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_get_keyboard_mapping_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_get_keyboard_mapping_reply_t * xcb_get_keyboard_mapping_reply (xcb_connection_t *c, xcb_get_keyboard_mapping_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_change_keyboard_control_value_list_serialize (void **_buffer, uint32_t value_mask, const xcb_change_keyboard_control_value_list_t *_aux); int xcb_change_keyboard_control_value_list_unpack (const void *_buffer, uint32_t value_mask, xcb_change_keyboard_control_value_list_t *_aux); int xcb_change_keyboard_control_value_list_sizeof (const void *_buffer, uint32_t value_mask); int xcb_change_keyboard_control_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_change_keyboard_control_checked (xcb_connection_t *c, uint32_t value_mask, const void *value_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_change_keyboard_control (xcb_connection_t *c, uint32_t value_mask, const void *value_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_change_keyboard_control_aux_checked (xcb_connection_t *c, uint32_t value_mask, const xcb_change_keyboard_control_value_list_t *value_list); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_change_keyboard_control_aux (xcb_connection_t *c, uint32_t value_mask, const xcb_change_keyboard_control_value_list_t *value_list); void * xcb_change_keyboard_control_value_list (const xcb_change_keyboard_control_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_get_keyboard_control_cookie_t xcb_get_keyboard_control (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_get_keyboard_control_cookie_t xcb_get_keyboard_control_unchecked (xcb_connection_t *c); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_get_keyboard_control_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_get_keyboard_control_reply_t * xcb_get_keyboard_control_reply (xcb_connection_t *c, xcb_get_keyboard_control_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_bell_checked (xcb_connection_t *c, int8_t percent); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_bell (xcb_connection_t *c, int8_t percent); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_change_pointer_control_checked (xcb_connection_t *c, int16_t acceleration_numerator, int16_t acceleration_denominator, int16_t threshold, uint8_t do_acceleration, uint8_t do_threshold); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_change_pointer_control (xcb_connection_t *c, int16_t acceleration_numerator, int16_t acceleration_denominator, int16_t threshold, uint8_t do_acceleration, uint8_t do_threshold); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_get_pointer_control_cookie_t xcb_get_pointer_control (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_get_pointer_control_cookie_t xcb_get_pointer_control_unchecked (xcb_connection_t *c); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_get_pointer_control_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_get_pointer_control_reply_t * xcb_get_pointer_control_reply (xcb_connection_t *c, xcb_get_pointer_control_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_set_screen_saver_checked (xcb_connection_t *c, int16_t timeout, int16_t interval, uint8_t prefer_blanking, uint8_t allow_exposures); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_set_screen_saver (xcb_connection_t *c, int16_t timeout, int16_t interval, uint8_t prefer_blanking, uint8_t allow_exposures); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_get_screen_saver_cookie_t xcb_get_screen_saver (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_get_screen_saver_cookie_t xcb_get_screen_saver_unchecked (xcb_connection_t *c); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_get_screen_saver_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_get_screen_saver_reply_t * xcb_get_screen_saver_reply (xcb_connection_t *c, xcb_get_screen_saver_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_change_hosts_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_change_hosts_checked (xcb_connection_t *c, uint8_t mode, uint8_t family, uint16_t address_len, const uint8_t *address); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_change_hosts (xcb_connection_t *c, uint8_t mode, uint8_t family, uint16_t address_len, const uint8_t *address); uint8_t * xcb_change_hosts_address (const xcb_change_hosts_request_t *R); int xcb_change_hosts_address_length (const xcb_change_hosts_request_t *R); xcb_generic_iterator_t xcb_change_hosts_address_end (const xcb_change_hosts_request_t *R); int xcb_host_sizeof (const void *_buffer); uint8_t * xcb_host_address (const xcb_host_t *R); int xcb_host_address_length (const xcb_host_t *R); xcb_generic_iterator_t xcb_host_address_end (const xcb_host_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_host_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_host_t) */ void xcb_host_next (xcb_host_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_host_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_host_end (xcb_host_iterator_t i); int xcb_list_hosts_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_list_hosts_cookie_t xcb_list_hosts (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_list_hosts_cookie_t xcb_list_hosts_unchecked (xcb_connection_t *c); int xcb_list_hosts_hosts_length (const xcb_list_hosts_reply_t *R); xcb_host_iterator_t xcb_list_hosts_hosts_iterator (const xcb_list_hosts_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_list_hosts_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_list_hosts_reply_t * xcb_list_hosts_reply (xcb_connection_t *c, xcb_list_hosts_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_set_access_control_checked (xcb_connection_t *c, uint8_t mode); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_set_access_control (xcb_connection_t *c, uint8_t mode); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_set_close_down_mode_checked (xcb_connection_t *c, uint8_t mode); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_set_close_down_mode (xcb_connection_t *c, uint8_t mode); /** * @brief kills a client * * @param c The connection * @param resource Any resource belonging to the client (for example a Window), used to identify * the client connection. * \n * The special value of `XCB_KILL_ALL_TEMPORARY`, the resources of all clients * that have terminated in `RetainTemporary` (TODO) are destroyed. * @return A cookie * * Forces a close down of the client that created the specified \a resource. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_kill_client_checked (xcb_connection_t *c, uint32_t resource); /** * @brief kills a client * * @param c The connection * @param resource Any resource belonging to the client (for example a Window), used to identify * the client connection. * \n * The special value of `XCB_KILL_ALL_TEMPORARY`, the resources of all clients * that have terminated in `RetainTemporary` (TODO) are destroyed. * @return A cookie * * Forces a close down of the client that created the specified \a resource. * */ xcb_void_cookie_t xcb_kill_client (xcb_connection_t *c, uint32_t resource); int xcb_rotate_properties_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_rotate_properties_checked (xcb_connection_t *c, xcb_window_t window, uint16_t atoms_len, int16_t delta, const xcb_atom_t *atoms); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_rotate_properties (xcb_connection_t *c, xcb_window_t window, uint16_t atoms_len, int16_t delta, const xcb_atom_t *atoms); xcb_atom_t * xcb_rotate_properties_atoms (const xcb_rotate_properties_request_t *R); int xcb_rotate_properties_atoms_length (const xcb_rotate_properties_request_t *R); xcb_generic_iterator_t xcb_rotate_properties_atoms_end (const xcb_rotate_properties_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_force_screen_saver_checked (xcb_connection_t *c, uint8_t mode); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_force_screen_saver (xcb_connection_t *c, uint8_t mode); int xcb_set_pointer_mapping_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_set_pointer_mapping_cookie_t xcb_set_pointer_mapping (xcb_connection_t *c, uint8_t map_len, const uint8_t *map); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_set_pointer_mapping_cookie_t xcb_set_pointer_mapping_unchecked (xcb_connection_t *c, uint8_t map_len, const uint8_t *map); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_set_pointer_mapping_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_set_pointer_mapping_reply_t * xcb_set_pointer_mapping_reply (xcb_connection_t *c, xcb_set_pointer_mapping_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_get_pointer_mapping_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_get_pointer_mapping_cookie_t xcb_get_pointer_mapping (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_get_pointer_mapping_cookie_t xcb_get_pointer_mapping_unchecked (xcb_connection_t *c); uint8_t * xcb_get_pointer_mapping_map (const xcb_get_pointer_mapping_reply_t *R); int xcb_get_pointer_mapping_map_length (const xcb_get_pointer_mapping_reply_t *R); xcb_generic_iterator_t xcb_get_pointer_mapping_map_end (const xcb_get_pointer_mapping_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_get_pointer_mapping_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_get_pointer_mapping_reply_t * xcb_get_pointer_mapping_reply (xcb_connection_t *c, xcb_get_pointer_mapping_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_set_modifier_mapping_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_set_modifier_mapping_cookie_t xcb_set_modifier_mapping (xcb_connection_t *c, uint8_t keycodes_per_modifier, const xcb_keycode_t *keycodes); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_set_modifier_mapping_cookie_t xcb_set_modifier_mapping_unchecked (xcb_connection_t *c, uint8_t keycodes_per_modifier, const xcb_keycode_t *keycodes); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_set_modifier_mapping_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_set_modifier_mapping_reply_t * xcb_set_modifier_mapping_reply (xcb_connection_t *c, xcb_set_modifier_mapping_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_get_modifier_mapping_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_get_modifier_mapping_cookie_t xcb_get_modifier_mapping (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_get_modifier_mapping_cookie_t xcb_get_modifier_mapping_unchecked (xcb_connection_t *c); xcb_keycode_t * xcb_get_modifier_mapping_keycodes (const xcb_get_modifier_mapping_reply_t *R); int xcb_get_modifier_mapping_keycodes_length (const xcb_get_modifier_mapping_reply_t *R); xcb_generic_iterator_t xcb_get_modifier_mapping_keycodes_end (const xcb_get_modifier_mapping_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_get_modifier_mapping_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_get_modifier_mapping_reply_t * xcb_get_modifier_mapping_reply (xcb_connection_t *c, xcb_get_modifier_mapping_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_no_operation_checked (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_no_operation (xcb_connection_t *c); #ifdef __cplusplus } #endif #endif /** * @} */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/randr.h�����������������������������������������������������������������������������������������0000644�����������������00000420416�14763166026�0006621 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from randr.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_RandR_API XCB RandR API * @brief RandR XCB Protocol Implementation. * @{ **/ #ifndef __RANDR_H #define __RANDR_H #include "xcb.h" #include "xproto.h" #include "render.h" #ifdef __cplusplus extern "C" { #endif #define XCB_RANDR_MAJOR_VERSION 1 #define XCB_RANDR_MINOR_VERSION 6 extern xcb_extension_t xcb_randr_id; typedef uint32_t xcb_randr_mode_t; /** * @brief xcb_randr_mode_iterator_t **/ typedef struct xcb_randr_mode_iterator_t { xcb_randr_mode_t *data; int rem; int index; } xcb_randr_mode_iterator_t; typedef uint32_t xcb_randr_crtc_t; /** * @brief xcb_randr_crtc_iterator_t **/ typedef struct xcb_randr_crtc_iterator_t { xcb_randr_crtc_t *data; int rem; int index; } xcb_randr_crtc_iterator_t; typedef uint32_t xcb_randr_output_t; /** * @brief xcb_randr_output_iterator_t **/ typedef struct xcb_randr_output_iterator_t { xcb_randr_output_t *data; int rem; int index; } xcb_randr_output_iterator_t; typedef uint32_t xcb_randr_provider_t; /** * @brief xcb_randr_provider_iterator_t **/ typedef struct xcb_randr_provider_iterator_t { xcb_randr_provider_t *data; int rem; int index; } xcb_randr_provider_iterator_t; typedef uint32_t xcb_randr_lease_t; /** * @brief xcb_randr_lease_iterator_t **/ typedef struct xcb_randr_lease_iterator_t { xcb_randr_lease_t *data; int rem; int index; } xcb_randr_lease_iterator_t; /** Opcode for xcb_randr_bad_output. */ #define XCB_RANDR_BAD_OUTPUT 0 /** * @brief xcb_randr_bad_output_error_t **/ typedef struct xcb_randr_bad_output_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_randr_bad_output_error_t; /** Opcode for xcb_randr_bad_crtc. */ #define XCB_RANDR_BAD_CRTC 1 /** * @brief xcb_randr_bad_crtc_error_t **/ typedef struct xcb_randr_bad_crtc_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_randr_bad_crtc_error_t; /** Opcode for xcb_randr_bad_mode. */ #define XCB_RANDR_BAD_MODE 2 /** * @brief xcb_randr_bad_mode_error_t **/ typedef struct xcb_randr_bad_mode_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_randr_bad_mode_error_t; /** Opcode for xcb_randr_bad_provider. */ #define XCB_RANDR_BAD_PROVIDER 3 /** * @brief xcb_randr_bad_provider_error_t **/ typedef struct xcb_randr_bad_provider_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_randr_bad_provider_error_t; typedef enum xcb_randr_rotation_t { XCB_RANDR_ROTATION_ROTATE_0 = 1, XCB_RANDR_ROTATION_ROTATE_90 = 2, XCB_RANDR_ROTATION_ROTATE_180 = 4, XCB_RANDR_ROTATION_ROTATE_270 = 8, XCB_RANDR_ROTATION_REFLECT_X = 16, XCB_RANDR_ROTATION_REFLECT_Y = 32 } xcb_randr_rotation_t; /** * @brief xcb_randr_screen_size_t **/ typedef struct xcb_randr_screen_size_t { uint16_t width; uint16_t height; uint16_t mwidth; uint16_t mheight; } xcb_randr_screen_size_t; /** * @brief xcb_randr_screen_size_iterator_t **/ typedef struct xcb_randr_screen_size_iterator_t { xcb_randr_screen_size_t *data; int rem; int index; } xcb_randr_screen_size_iterator_t; /** * @brief xcb_randr_refresh_rates_t **/ typedef struct xcb_randr_refresh_rates_t { uint16_t nRates; } xcb_randr_refresh_rates_t; /** * @brief xcb_randr_refresh_rates_iterator_t **/ typedef struct xcb_randr_refresh_rates_iterator_t { xcb_randr_refresh_rates_t *data; int rem; int index; } xcb_randr_refresh_rates_iterator_t; /** * @brief xcb_randr_query_version_cookie_t **/ typedef struct xcb_randr_query_version_cookie_t { unsigned int sequence; } xcb_randr_query_version_cookie_t; /** Opcode for xcb_randr_query_version. */ #define XCB_RANDR_QUERY_VERSION 0 /** * @brief xcb_randr_query_version_request_t **/ typedef struct xcb_randr_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t major_version; uint32_t minor_version; } xcb_randr_query_version_request_t; /** * @brief xcb_randr_query_version_reply_t **/ typedef struct xcb_randr_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t major_version; uint32_t minor_version; uint8_t pad1[16]; } xcb_randr_query_version_reply_t; typedef enum xcb_randr_set_config_t { XCB_RANDR_SET_CONFIG_SUCCESS = 0, XCB_RANDR_SET_CONFIG_INVALID_CONFIG_TIME = 1, XCB_RANDR_SET_CONFIG_INVALID_TIME = 2, XCB_RANDR_SET_CONFIG_FAILED = 3 } xcb_randr_set_config_t; /** * @brief xcb_randr_set_screen_config_cookie_t **/ typedef struct xcb_randr_set_screen_config_cookie_t { unsigned int sequence; } xcb_randr_set_screen_config_cookie_t; /** Opcode for xcb_randr_set_screen_config. */ #define XCB_RANDR_SET_SCREEN_CONFIG 2 /** * @brief xcb_randr_set_screen_config_request_t **/ typedef struct xcb_randr_set_screen_config_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; xcb_timestamp_t timestamp; xcb_timestamp_t config_timestamp; uint16_t sizeID; uint16_t rotation; uint16_t rate; uint8_t pad0[2]; } xcb_randr_set_screen_config_request_t; /** * @brief xcb_randr_set_screen_config_reply_t **/ typedef struct xcb_randr_set_screen_config_reply_t { uint8_t response_type; uint8_t status; uint16_t sequence; uint32_t length; xcb_timestamp_t new_timestamp; xcb_timestamp_t config_timestamp; xcb_window_t root; uint16_t subpixel_order; uint8_t pad0[10]; } xcb_randr_set_screen_config_reply_t; typedef enum xcb_randr_notify_mask_t { XCB_RANDR_NOTIFY_MASK_SCREEN_CHANGE = 1, XCB_RANDR_NOTIFY_MASK_CRTC_CHANGE = 2, XCB_RANDR_NOTIFY_MASK_OUTPUT_CHANGE = 4, XCB_RANDR_NOTIFY_MASK_OUTPUT_PROPERTY = 8, XCB_RANDR_NOTIFY_MASK_PROVIDER_CHANGE = 16, XCB_RANDR_NOTIFY_MASK_PROVIDER_PROPERTY = 32, XCB_RANDR_NOTIFY_MASK_RESOURCE_CHANGE = 64, XCB_RANDR_NOTIFY_MASK_LEASE = 128 } xcb_randr_notify_mask_t; /** Opcode for xcb_randr_select_input. */ #define XCB_RANDR_SELECT_INPUT 4 /** * @brief xcb_randr_select_input_request_t **/ typedef struct xcb_randr_select_input_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; uint16_t enable; uint8_t pad0[2]; } xcb_randr_select_input_request_t; /** * @brief xcb_randr_get_screen_info_cookie_t **/ typedef struct xcb_randr_get_screen_info_cookie_t { unsigned int sequence; } xcb_randr_get_screen_info_cookie_t; /** Opcode for xcb_randr_get_screen_info. */ #define XCB_RANDR_GET_SCREEN_INFO 5 /** * @brief xcb_randr_get_screen_info_request_t **/ typedef struct xcb_randr_get_screen_info_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_randr_get_screen_info_request_t; /** * @brief xcb_randr_get_screen_info_reply_t **/ typedef struct xcb_randr_get_screen_info_reply_t { uint8_t response_type; uint8_t rotations; uint16_t sequence; uint32_t length; xcb_window_t root; xcb_timestamp_t timestamp; xcb_timestamp_t config_timestamp; uint16_t nSizes; uint16_t sizeID; uint16_t rotation; uint16_t rate; uint16_t nInfo; uint8_t pad0[2]; } xcb_randr_get_screen_info_reply_t; /** * @brief xcb_randr_get_screen_size_range_cookie_t **/ typedef struct xcb_randr_get_screen_size_range_cookie_t { unsigned int sequence; } xcb_randr_get_screen_size_range_cookie_t; /** Opcode for xcb_randr_get_screen_size_range. */ #define XCB_RANDR_GET_SCREEN_SIZE_RANGE 6 /** * @brief xcb_randr_get_screen_size_range_request_t **/ typedef struct xcb_randr_get_screen_size_range_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_randr_get_screen_size_range_request_t; /** * @brief xcb_randr_get_screen_size_range_reply_t **/ typedef struct xcb_randr_get_screen_size_range_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t min_width; uint16_t min_height; uint16_t max_width; uint16_t max_height; uint8_t pad1[16]; } xcb_randr_get_screen_size_range_reply_t; /** Opcode for xcb_randr_set_screen_size. */ #define XCB_RANDR_SET_SCREEN_SIZE 7 /** * @brief xcb_randr_set_screen_size_request_t **/ typedef struct xcb_randr_set_screen_size_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; uint16_t width; uint16_t height; uint32_t mm_width; uint32_t mm_height; } xcb_randr_set_screen_size_request_t; typedef enum xcb_randr_mode_flag_t { XCB_RANDR_MODE_FLAG_HSYNC_POSITIVE = 1, XCB_RANDR_MODE_FLAG_HSYNC_NEGATIVE = 2, XCB_RANDR_MODE_FLAG_VSYNC_POSITIVE = 4, XCB_RANDR_MODE_FLAG_VSYNC_NEGATIVE = 8, XCB_RANDR_MODE_FLAG_INTERLACE = 16, XCB_RANDR_MODE_FLAG_DOUBLE_SCAN = 32, XCB_RANDR_MODE_FLAG_CSYNC = 64, XCB_RANDR_MODE_FLAG_CSYNC_POSITIVE = 128, XCB_RANDR_MODE_FLAG_CSYNC_NEGATIVE = 256, XCB_RANDR_MODE_FLAG_HSKEW_PRESENT = 512, XCB_RANDR_MODE_FLAG_BCAST = 1024, XCB_RANDR_MODE_FLAG_PIXEL_MULTIPLEX = 2048, XCB_RANDR_MODE_FLAG_DOUBLE_CLOCK = 4096, XCB_RANDR_MODE_FLAG_HALVE_CLOCK = 8192 } xcb_randr_mode_flag_t; /** * @brief xcb_randr_mode_info_t **/ typedef struct xcb_randr_mode_info_t { uint32_t id; uint16_t width; uint16_t height; uint32_t dot_clock; uint16_t hsync_start; uint16_t hsync_end; uint16_t htotal; uint16_t hskew; uint16_t vsync_start; uint16_t vsync_end; uint16_t vtotal; uint16_t name_len; uint32_t mode_flags; } xcb_randr_mode_info_t; /** * @brief xcb_randr_mode_info_iterator_t **/ typedef struct xcb_randr_mode_info_iterator_t { xcb_randr_mode_info_t *data; int rem; int index; } xcb_randr_mode_info_iterator_t; /** * @brief xcb_randr_get_screen_resources_cookie_t **/ typedef struct xcb_randr_get_screen_resources_cookie_t { unsigned int sequence; } xcb_randr_get_screen_resources_cookie_t; /** Opcode for xcb_randr_get_screen_resources. */ #define XCB_RANDR_GET_SCREEN_RESOURCES 8 /** * @brief xcb_randr_get_screen_resources_request_t **/ typedef struct xcb_randr_get_screen_resources_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_randr_get_screen_resources_request_t; /** * @brief xcb_randr_get_screen_resources_reply_t **/ typedef struct xcb_randr_get_screen_resources_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_timestamp_t timestamp; xcb_timestamp_t config_timestamp; uint16_t num_crtcs; uint16_t num_outputs; uint16_t num_modes; uint16_t names_len; uint8_t pad1[8]; } xcb_randr_get_screen_resources_reply_t; typedef enum xcb_randr_connection_t { XCB_RANDR_CONNECTION_CONNECTED = 0, XCB_RANDR_CONNECTION_DISCONNECTED = 1, XCB_RANDR_CONNECTION_UNKNOWN = 2 } xcb_randr_connection_t; /** * @brief xcb_randr_get_output_info_cookie_t **/ typedef struct xcb_randr_get_output_info_cookie_t { unsigned int sequence; } xcb_randr_get_output_info_cookie_t; /** Opcode for xcb_randr_get_output_info. */ #define XCB_RANDR_GET_OUTPUT_INFO 9 /** * @brief xcb_randr_get_output_info_request_t **/ typedef struct xcb_randr_get_output_info_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_output_t output; xcb_timestamp_t config_timestamp; } xcb_randr_get_output_info_request_t; /** * @brief xcb_randr_get_output_info_reply_t **/ typedef struct xcb_randr_get_output_info_reply_t { uint8_t response_type; uint8_t status; uint16_t sequence; uint32_t length; xcb_timestamp_t timestamp; xcb_randr_crtc_t crtc; uint32_t mm_width; uint32_t mm_height; uint8_t connection; uint8_t subpixel_order; uint16_t num_crtcs; uint16_t num_modes; uint16_t num_preferred; uint16_t num_clones; uint16_t name_len; } xcb_randr_get_output_info_reply_t; /** * @brief xcb_randr_list_output_properties_cookie_t **/ typedef struct xcb_randr_list_output_properties_cookie_t { unsigned int sequence; } xcb_randr_list_output_properties_cookie_t; /** Opcode for xcb_randr_list_output_properties. */ #define XCB_RANDR_LIST_OUTPUT_PROPERTIES 10 /** * @brief xcb_randr_list_output_properties_request_t **/ typedef struct xcb_randr_list_output_properties_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_output_t output; } xcb_randr_list_output_properties_request_t; /** * @brief xcb_randr_list_output_properties_reply_t **/ typedef struct xcb_randr_list_output_properties_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t num_atoms; uint8_t pad1[22]; } xcb_randr_list_output_properties_reply_t; /** * @brief xcb_randr_query_output_property_cookie_t **/ typedef struct xcb_randr_query_output_property_cookie_t { unsigned int sequence; } xcb_randr_query_output_property_cookie_t; /** Opcode for xcb_randr_query_output_property. */ #define XCB_RANDR_QUERY_OUTPUT_PROPERTY 11 /** * @brief xcb_randr_query_output_property_request_t **/ typedef struct xcb_randr_query_output_property_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_output_t output; xcb_atom_t property; } xcb_randr_query_output_property_request_t; /** * @brief xcb_randr_query_output_property_reply_t **/ typedef struct xcb_randr_query_output_property_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pending; uint8_t range; uint8_t immutable; uint8_t pad1[21]; } xcb_randr_query_output_property_reply_t; /** Opcode for xcb_randr_configure_output_property. */ #define XCB_RANDR_CONFIGURE_OUTPUT_PROPERTY 12 /** * @brief xcb_randr_configure_output_property_request_t **/ typedef struct xcb_randr_configure_output_property_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_output_t output; xcb_atom_t property; uint8_t pending; uint8_t range; uint8_t pad0[2]; } xcb_randr_configure_output_property_request_t; /** Opcode for xcb_randr_change_output_property. */ #define XCB_RANDR_CHANGE_OUTPUT_PROPERTY 13 /** * @brief xcb_randr_change_output_property_request_t **/ typedef struct xcb_randr_change_output_property_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_output_t output; xcb_atom_t property; xcb_atom_t type; uint8_t format; uint8_t mode; uint8_t pad0[2]; uint32_t num_units; } xcb_randr_change_output_property_request_t; /** Opcode for xcb_randr_delete_output_property. */ #define XCB_RANDR_DELETE_OUTPUT_PROPERTY 14 /** * @brief xcb_randr_delete_output_property_request_t **/ typedef struct xcb_randr_delete_output_property_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_output_t output; xcb_atom_t property; } xcb_randr_delete_output_property_request_t; /** * @brief xcb_randr_get_output_property_cookie_t **/ typedef struct xcb_randr_get_output_property_cookie_t { unsigned int sequence; } xcb_randr_get_output_property_cookie_t; /** Opcode for xcb_randr_get_output_property. */ #define XCB_RANDR_GET_OUTPUT_PROPERTY 15 /** * @brief xcb_randr_get_output_property_request_t **/ typedef struct xcb_randr_get_output_property_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_output_t output; xcb_atom_t property; xcb_atom_t type; uint32_t long_offset; uint32_t long_length; uint8_t _delete; uint8_t pending; uint8_t pad0[2]; } xcb_randr_get_output_property_request_t; /** * @brief xcb_randr_get_output_property_reply_t **/ typedef struct xcb_randr_get_output_property_reply_t { uint8_t response_type; uint8_t format; uint16_t sequence; uint32_t length; xcb_atom_t type; uint32_t bytes_after; uint32_t num_items; uint8_t pad0[12]; } xcb_randr_get_output_property_reply_t; /** * @brief xcb_randr_create_mode_cookie_t **/ typedef struct xcb_randr_create_mode_cookie_t { unsigned int sequence; } xcb_randr_create_mode_cookie_t; /** Opcode for xcb_randr_create_mode. */ #define XCB_RANDR_CREATE_MODE 16 /** * @brief xcb_randr_create_mode_request_t **/ typedef struct xcb_randr_create_mode_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; xcb_randr_mode_info_t mode_info; } xcb_randr_create_mode_request_t; /** * @brief xcb_randr_create_mode_reply_t **/ typedef struct xcb_randr_create_mode_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_randr_mode_t mode; uint8_t pad1[20]; } xcb_randr_create_mode_reply_t; /** Opcode for xcb_randr_destroy_mode. */ #define XCB_RANDR_DESTROY_MODE 17 /** * @brief xcb_randr_destroy_mode_request_t **/ typedef struct xcb_randr_destroy_mode_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_mode_t mode; } xcb_randr_destroy_mode_request_t; /** Opcode for xcb_randr_add_output_mode. */ #define XCB_RANDR_ADD_OUTPUT_MODE 18 /** * @brief xcb_randr_add_output_mode_request_t **/ typedef struct xcb_randr_add_output_mode_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_output_t output; xcb_randr_mode_t mode; } xcb_randr_add_output_mode_request_t; /** Opcode for xcb_randr_delete_output_mode. */ #define XCB_RANDR_DELETE_OUTPUT_MODE 19 /** * @brief xcb_randr_delete_output_mode_request_t **/ typedef struct xcb_randr_delete_output_mode_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_output_t output; xcb_randr_mode_t mode; } xcb_randr_delete_output_mode_request_t; /** * @brief xcb_randr_get_crtc_info_cookie_t **/ typedef struct xcb_randr_get_crtc_info_cookie_t { unsigned int sequence; } xcb_randr_get_crtc_info_cookie_t; /** Opcode for xcb_randr_get_crtc_info. */ #define XCB_RANDR_GET_CRTC_INFO 20 /** * @brief xcb_randr_get_crtc_info_request_t **/ typedef struct xcb_randr_get_crtc_info_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_crtc_t crtc; xcb_timestamp_t config_timestamp; } xcb_randr_get_crtc_info_request_t; /** * @brief xcb_randr_get_crtc_info_reply_t **/ typedef struct xcb_randr_get_crtc_info_reply_t { uint8_t response_type; uint8_t status; uint16_t sequence; uint32_t length; xcb_timestamp_t timestamp; int16_t x; int16_t y; uint16_t width; uint16_t height; xcb_randr_mode_t mode; uint16_t rotation; uint16_t rotations; uint16_t num_outputs; uint16_t num_possible_outputs; } xcb_randr_get_crtc_info_reply_t; /** * @brief xcb_randr_set_crtc_config_cookie_t **/ typedef struct xcb_randr_set_crtc_config_cookie_t { unsigned int sequence; } xcb_randr_set_crtc_config_cookie_t; /** Opcode for xcb_randr_set_crtc_config. */ #define XCB_RANDR_SET_CRTC_CONFIG 21 /** * @brief xcb_randr_set_crtc_config_request_t **/ typedef struct xcb_randr_set_crtc_config_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_crtc_t crtc; xcb_timestamp_t timestamp; xcb_timestamp_t config_timestamp; int16_t x; int16_t y; xcb_randr_mode_t mode; uint16_t rotation; uint8_t pad0[2]; } xcb_randr_set_crtc_config_request_t; /** * @brief xcb_randr_set_crtc_config_reply_t **/ typedef struct xcb_randr_set_crtc_config_reply_t { uint8_t response_type; uint8_t status; uint16_t sequence; uint32_t length; xcb_timestamp_t timestamp; uint8_t pad0[20]; } xcb_randr_set_crtc_config_reply_t; /** * @brief xcb_randr_get_crtc_gamma_size_cookie_t **/ typedef struct xcb_randr_get_crtc_gamma_size_cookie_t { unsigned int sequence; } xcb_randr_get_crtc_gamma_size_cookie_t; /** Opcode for xcb_randr_get_crtc_gamma_size. */ #define XCB_RANDR_GET_CRTC_GAMMA_SIZE 22 /** * @brief xcb_randr_get_crtc_gamma_size_request_t **/ typedef struct xcb_randr_get_crtc_gamma_size_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_crtc_t crtc; } xcb_randr_get_crtc_gamma_size_request_t; /** * @brief xcb_randr_get_crtc_gamma_size_reply_t **/ typedef struct xcb_randr_get_crtc_gamma_size_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t size; uint8_t pad1[22]; } xcb_randr_get_crtc_gamma_size_reply_t; /** * @brief xcb_randr_get_crtc_gamma_cookie_t **/ typedef struct xcb_randr_get_crtc_gamma_cookie_t { unsigned int sequence; } xcb_randr_get_crtc_gamma_cookie_t; /** Opcode for xcb_randr_get_crtc_gamma. */ #define XCB_RANDR_GET_CRTC_GAMMA 23 /** * @brief xcb_randr_get_crtc_gamma_request_t **/ typedef struct xcb_randr_get_crtc_gamma_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_crtc_t crtc; } xcb_randr_get_crtc_gamma_request_t; /** * @brief xcb_randr_get_crtc_gamma_reply_t **/ typedef struct xcb_randr_get_crtc_gamma_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t size; uint8_t pad1[22]; } xcb_randr_get_crtc_gamma_reply_t; /** Opcode for xcb_randr_set_crtc_gamma. */ #define XCB_RANDR_SET_CRTC_GAMMA 24 /** * @brief xcb_randr_set_crtc_gamma_request_t **/ typedef struct xcb_randr_set_crtc_gamma_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_crtc_t crtc; uint16_t size; uint8_t pad0[2]; } xcb_randr_set_crtc_gamma_request_t; /** * @brief xcb_randr_get_screen_resources_current_cookie_t **/ typedef struct xcb_randr_get_screen_resources_current_cookie_t { unsigned int sequence; } xcb_randr_get_screen_resources_current_cookie_t; /** Opcode for xcb_randr_get_screen_resources_current. */ #define XCB_RANDR_GET_SCREEN_RESOURCES_CURRENT 25 /** * @brief xcb_randr_get_screen_resources_current_request_t **/ typedef struct xcb_randr_get_screen_resources_current_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_randr_get_screen_resources_current_request_t; /** * @brief xcb_randr_get_screen_resources_current_reply_t **/ typedef struct xcb_randr_get_screen_resources_current_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_timestamp_t timestamp; xcb_timestamp_t config_timestamp; uint16_t num_crtcs; uint16_t num_outputs; uint16_t num_modes; uint16_t names_len; uint8_t pad1[8]; } xcb_randr_get_screen_resources_current_reply_t; typedef enum xcb_randr_transform_t { XCB_RANDR_TRANSFORM_UNIT = 1, XCB_RANDR_TRANSFORM_SCALE_UP = 2, XCB_RANDR_TRANSFORM_SCALE_DOWN = 4, XCB_RANDR_TRANSFORM_PROJECTIVE = 8 } xcb_randr_transform_t; /** Opcode for xcb_randr_set_crtc_transform. */ #define XCB_RANDR_SET_CRTC_TRANSFORM 26 /** * @brief xcb_randr_set_crtc_transform_request_t **/ typedef struct xcb_randr_set_crtc_transform_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_crtc_t crtc; xcb_render_transform_t transform; uint16_t filter_len; uint8_t pad0[2]; } xcb_randr_set_crtc_transform_request_t; /** * @brief xcb_randr_get_crtc_transform_cookie_t **/ typedef struct xcb_randr_get_crtc_transform_cookie_t { unsigned int sequence; } xcb_randr_get_crtc_transform_cookie_t; /** Opcode for xcb_randr_get_crtc_transform. */ #define XCB_RANDR_GET_CRTC_TRANSFORM 27 /** * @brief xcb_randr_get_crtc_transform_request_t **/ typedef struct xcb_randr_get_crtc_transform_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_crtc_t crtc; } xcb_randr_get_crtc_transform_request_t; /** * @brief xcb_randr_get_crtc_transform_reply_t **/ typedef struct xcb_randr_get_crtc_transform_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_render_transform_t pending_transform; uint8_t has_transforms; uint8_t pad1[3]; xcb_render_transform_t current_transform; uint8_t pad2[4]; uint16_t pending_len; uint16_t pending_nparams; uint16_t current_len; uint16_t current_nparams; } xcb_randr_get_crtc_transform_reply_t; /** * @brief xcb_randr_get_panning_cookie_t **/ typedef struct xcb_randr_get_panning_cookie_t { unsigned int sequence; } xcb_randr_get_panning_cookie_t; /** Opcode for xcb_randr_get_panning. */ #define XCB_RANDR_GET_PANNING 28 /** * @brief xcb_randr_get_panning_request_t **/ typedef struct xcb_randr_get_panning_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_crtc_t crtc; } xcb_randr_get_panning_request_t; /** * @brief xcb_randr_get_panning_reply_t **/ typedef struct xcb_randr_get_panning_reply_t { uint8_t response_type; uint8_t status; uint16_t sequence; uint32_t length; xcb_timestamp_t timestamp; uint16_t left; uint16_t top; uint16_t width; uint16_t height; uint16_t track_left; uint16_t track_top; uint16_t track_width; uint16_t track_height; int16_t border_left; int16_t border_top; int16_t border_right; int16_t border_bottom; } xcb_randr_get_panning_reply_t; /** * @brief xcb_randr_set_panning_cookie_t **/ typedef struct xcb_randr_set_panning_cookie_t { unsigned int sequence; } xcb_randr_set_panning_cookie_t; /** Opcode for xcb_randr_set_panning. */ #define XCB_RANDR_SET_PANNING 29 /** * @brief xcb_randr_set_panning_request_t **/ typedef struct xcb_randr_set_panning_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_crtc_t crtc; xcb_timestamp_t timestamp; uint16_t left; uint16_t top; uint16_t width; uint16_t height; uint16_t track_left; uint16_t track_top; uint16_t track_width; uint16_t track_height; int16_t border_left; int16_t border_top; int16_t border_right; int16_t border_bottom; } xcb_randr_set_panning_request_t; /** * @brief xcb_randr_set_panning_reply_t **/ typedef struct xcb_randr_set_panning_reply_t { uint8_t response_type; uint8_t status; uint16_t sequence; uint32_t length; xcb_timestamp_t timestamp; } xcb_randr_set_panning_reply_t; /** Opcode for xcb_randr_set_output_primary. */ #define XCB_RANDR_SET_OUTPUT_PRIMARY 30 /** * @brief xcb_randr_set_output_primary_request_t **/ typedef struct xcb_randr_set_output_primary_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; xcb_randr_output_t output; } xcb_randr_set_output_primary_request_t; /** * @brief xcb_randr_get_output_primary_cookie_t **/ typedef struct xcb_randr_get_output_primary_cookie_t { unsigned int sequence; } xcb_randr_get_output_primary_cookie_t; /** Opcode for xcb_randr_get_output_primary. */ #define XCB_RANDR_GET_OUTPUT_PRIMARY 31 /** * @brief xcb_randr_get_output_primary_request_t **/ typedef struct xcb_randr_get_output_primary_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_randr_get_output_primary_request_t; /** * @brief xcb_randr_get_output_primary_reply_t **/ typedef struct xcb_randr_get_output_primary_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_randr_output_t output; } xcb_randr_get_output_primary_reply_t; /** * @brief xcb_randr_get_providers_cookie_t **/ typedef struct xcb_randr_get_providers_cookie_t { unsigned int sequence; } xcb_randr_get_providers_cookie_t; /** Opcode for xcb_randr_get_providers. */ #define XCB_RANDR_GET_PROVIDERS 32 /** * @brief xcb_randr_get_providers_request_t **/ typedef struct xcb_randr_get_providers_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_randr_get_providers_request_t; /** * @brief xcb_randr_get_providers_reply_t **/ typedef struct xcb_randr_get_providers_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_timestamp_t timestamp; uint16_t num_providers; uint8_t pad1[18]; } xcb_randr_get_providers_reply_t; typedef enum xcb_randr_provider_capability_t { XCB_RANDR_PROVIDER_CAPABILITY_SOURCE_OUTPUT = 1, XCB_RANDR_PROVIDER_CAPABILITY_SINK_OUTPUT = 2, XCB_RANDR_PROVIDER_CAPABILITY_SOURCE_OFFLOAD = 4, XCB_RANDR_PROVIDER_CAPABILITY_SINK_OFFLOAD = 8 } xcb_randr_provider_capability_t; /** * @brief xcb_randr_get_provider_info_cookie_t **/ typedef struct xcb_randr_get_provider_info_cookie_t { unsigned int sequence; } xcb_randr_get_provider_info_cookie_t; /** Opcode for xcb_randr_get_provider_info. */ #define XCB_RANDR_GET_PROVIDER_INFO 33 /** * @brief xcb_randr_get_provider_info_request_t **/ typedef struct xcb_randr_get_provider_info_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_provider_t provider; xcb_timestamp_t config_timestamp; } xcb_randr_get_provider_info_request_t; /** * @brief xcb_randr_get_provider_info_reply_t **/ typedef struct xcb_randr_get_provider_info_reply_t { uint8_t response_type; uint8_t status; uint16_t sequence; uint32_t length; xcb_timestamp_t timestamp; uint32_t capabilities; uint16_t num_crtcs; uint16_t num_outputs; uint16_t num_associated_providers; uint16_t name_len; uint8_t pad0[8]; } xcb_randr_get_provider_info_reply_t; /** Opcode for xcb_randr_set_provider_offload_sink. */ #define XCB_RANDR_SET_PROVIDER_OFFLOAD_SINK 34 /** * @brief xcb_randr_set_provider_offload_sink_request_t **/ typedef struct xcb_randr_set_provider_offload_sink_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_provider_t provider; xcb_randr_provider_t sink_provider; xcb_timestamp_t config_timestamp; } xcb_randr_set_provider_offload_sink_request_t; /** Opcode for xcb_randr_set_provider_output_source. */ #define XCB_RANDR_SET_PROVIDER_OUTPUT_SOURCE 35 /** * @brief xcb_randr_set_provider_output_source_request_t **/ typedef struct xcb_randr_set_provider_output_source_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_provider_t provider; xcb_randr_provider_t source_provider; xcb_timestamp_t config_timestamp; } xcb_randr_set_provider_output_source_request_t; /** * @brief xcb_randr_list_provider_properties_cookie_t **/ typedef struct xcb_randr_list_provider_properties_cookie_t { unsigned int sequence; } xcb_randr_list_provider_properties_cookie_t; /** Opcode for xcb_randr_list_provider_properties. */ #define XCB_RANDR_LIST_PROVIDER_PROPERTIES 36 /** * @brief xcb_randr_list_provider_properties_request_t **/ typedef struct xcb_randr_list_provider_properties_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_provider_t provider; } xcb_randr_list_provider_properties_request_t; /** * @brief xcb_randr_list_provider_properties_reply_t **/ typedef struct xcb_randr_list_provider_properties_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t num_atoms; uint8_t pad1[22]; } xcb_randr_list_provider_properties_reply_t; /** * @brief xcb_randr_query_provider_property_cookie_t **/ typedef struct xcb_randr_query_provider_property_cookie_t { unsigned int sequence; } xcb_randr_query_provider_property_cookie_t; /** Opcode for xcb_randr_query_provider_property. */ #define XCB_RANDR_QUERY_PROVIDER_PROPERTY 37 /** * @brief xcb_randr_query_provider_property_request_t **/ typedef struct xcb_randr_query_provider_property_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_provider_t provider; xcb_atom_t property; } xcb_randr_query_provider_property_request_t; /** * @brief xcb_randr_query_provider_property_reply_t **/ typedef struct xcb_randr_query_provider_property_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint8_t pending; uint8_t range; uint8_t immutable; uint8_t pad1[21]; } xcb_randr_query_provider_property_reply_t; /** Opcode for xcb_randr_configure_provider_property. */ #define XCB_RANDR_CONFIGURE_PROVIDER_PROPERTY 38 /** * @brief xcb_randr_configure_provider_property_request_t **/ typedef struct xcb_randr_configure_provider_property_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_provider_t provider; xcb_atom_t property; uint8_t pending; uint8_t range; uint8_t pad0[2]; } xcb_randr_configure_provider_property_request_t; /** Opcode for xcb_randr_change_provider_property. */ #define XCB_RANDR_CHANGE_PROVIDER_PROPERTY 39 /** * @brief xcb_randr_change_provider_property_request_t **/ typedef struct xcb_randr_change_provider_property_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_provider_t provider; xcb_atom_t property; xcb_atom_t type; uint8_t format; uint8_t mode; uint8_t pad0[2]; uint32_t num_items; } xcb_randr_change_provider_property_request_t; /** Opcode for xcb_randr_delete_provider_property. */ #define XCB_RANDR_DELETE_PROVIDER_PROPERTY 40 /** * @brief xcb_randr_delete_provider_property_request_t **/ typedef struct xcb_randr_delete_provider_property_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_provider_t provider; xcb_atom_t property; } xcb_randr_delete_provider_property_request_t; /** * @brief xcb_randr_get_provider_property_cookie_t **/ typedef struct xcb_randr_get_provider_property_cookie_t { unsigned int sequence; } xcb_randr_get_provider_property_cookie_t; /** Opcode for xcb_randr_get_provider_property. */ #define XCB_RANDR_GET_PROVIDER_PROPERTY 41 /** * @brief xcb_randr_get_provider_property_request_t **/ typedef struct xcb_randr_get_provider_property_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_provider_t provider; xcb_atom_t property; xcb_atom_t type; uint32_t long_offset; uint32_t long_length; uint8_t _delete; uint8_t pending; uint8_t pad0[2]; } xcb_randr_get_provider_property_request_t; /** * @brief xcb_randr_get_provider_property_reply_t **/ typedef struct xcb_randr_get_provider_property_reply_t { uint8_t response_type; uint8_t format; uint16_t sequence; uint32_t length; xcb_atom_t type; uint32_t bytes_after; uint32_t num_items; uint8_t pad0[12]; } xcb_randr_get_provider_property_reply_t; /** Opcode for xcb_randr_screen_change_notify. */ #define XCB_RANDR_SCREEN_CHANGE_NOTIFY 0 /** * @brief xcb_randr_screen_change_notify_event_t **/ typedef struct xcb_randr_screen_change_notify_event_t { uint8_t response_type; uint8_t rotation; uint16_t sequence; xcb_timestamp_t timestamp; xcb_timestamp_t config_timestamp; xcb_window_t root; xcb_window_t request_window; uint16_t sizeID; uint16_t subpixel_order; uint16_t width; uint16_t height; uint16_t mwidth; uint16_t mheight; } xcb_randr_screen_change_notify_event_t; typedef enum xcb_randr_notify_t { XCB_RANDR_NOTIFY_CRTC_CHANGE = 0, XCB_RANDR_NOTIFY_OUTPUT_CHANGE = 1, XCB_RANDR_NOTIFY_OUTPUT_PROPERTY = 2, XCB_RANDR_NOTIFY_PROVIDER_CHANGE = 3, XCB_RANDR_NOTIFY_PROVIDER_PROPERTY = 4, XCB_RANDR_NOTIFY_RESOURCE_CHANGE = 5, XCB_RANDR_NOTIFY_LEASE = 6 } xcb_randr_notify_t; /** * @brief xcb_randr_crtc_change_t **/ typedef struct xcb_randr_crtc_change_t { xcb_timestamp_t timestamp; xcb_window_t window; xcb_randr_crtc_t crtc; xcb_randr_mode_t mode; uint16_t rotation; uint8_t pad0[2]; int16_t x; int16_t y; uint16_t width; uint16_t height; } xcb_randr_crtc_change_t; /** * @brief xcb_randr_crtc_change_iterator_t **/ typedef struct xcb_randr_crtc_change_iterator_t { xcb_randr_crtc_change_t *data; int rem; int index; } xcb_randr_crtc_change_iterator_t; /** * @brief xcb_randr_output_change_t **/ typedef struct xcb_randr_output_change_t { xcb_timestamp_t timestamp; xcb_timestamp_t config_timestamp; xcb_window_t window; xcb_randr_output_t output; xcb_randr_crtc_t crtc; xcb_randr_mode_t mode; uint16_t rotation; uint8_t connection; uint8_t subpixel_order; } xcb_randr_output_change_t; /** * @brief xcb_randr_output_change_iterator_t **/ typedef struct xcb_randr_output_change_iterator_t { xcb_randr_output_change_t *data; int rem; int index; } xcb_randr_output_change_iterator_t; /** * @brief xcb_randr_output_property_t **/ typedef struct xcb_randr_output_property_t { xcb_window_t window; xcb_randr_output_t output; xcb_atom_t atom; xcb_timestamp_t timestamp; uint8_t status; uint8_t pad0[11]; } xcb_randr_output_property_t; /** * @brief xcb_randr_output_property_iterator_t **/ typedef struct xcb_randr_output_property_iterator_t { xcb_randr_output_property_t *data; int rem; int index; } xcb_randr_output_property_iterator_t; /** * @brief xcb_randr_provider_change_t **/ typedef struct xcb_randr_provider_change_t { xcb_timestamp_t timestamp; xcb_window_t window; xcb_randr_provider_t provider; uint8_t pad0[16]; } xcb_randr_provider_change_t; /** * @brief xcb_randr_provider_change_iterator_t **/ typedef struct xcb_randr_provider_change_iterator_t { xcb_randr_provider_change_t *data; int rem; int index; } xcb_randr_provider_change_iterator_t; /** * @brief xcb_randr_provider_property_t **/ typedef struct xcb_randr_provider_property_t { xcb_window_t window; xcb_randr_provider_t provider; xcb_atom_t atom; xcb_timestamp_t timestamp; uint8_t state; uint8_t pad0[11]; } xcb_randr_provider_property_t; /** * @brief xcb_randr_provider_property_iterator_t **/ typedef struct xcb_randr_provider_property_iterator_t { xcb_randr_provider_property_t *data; int rem; int index; } xcb_randr_provider_property_iterator_t; /** * @brief xcb_randr_resource_change_t **/ typedef struct xcb_randr_resource_change_t { xcb_timestamp_t timestamp; xcb_window_t window; uint8_t pad0[20]; } xcb_randr_resource_change_t; /** * @brief xcb_randr_resource_change_iterator_t **/ typedef struct xcb_randr_resource_change_iterator_t { xcb_randr_resource_change_t *data; int rem; int index; } xcb_randr_resource_change_iterator_t; /** * @brief xcb_randr_monitor_info_t **/ typedef struct xcb_randr_monitor_info_t { xcb_atom_t name; uint8_t primary; uint8_t automatic; uint16_t nOutput; int16_t x; int16_t y; uint16_t width; uint16_t height; uint32_t width_in_millimeters; uint32_t height_in_millimeters; } xcb_randr_monitor_info_t; /** * @brief xcb_randr_monitor_info_iterator_t **/ typedef struct xcb_randr_monitor_info_iterator_t { xcb_randr_monitor_info_t *data; int rem; int index; } xcb_randr_monitor_info_iterator_t; /** * @brief xcb_randr_get_monitors_cookie_t **/ typedef struct xcb_randr_get_monitors_cookie_t { unsigned int sequence; } xcb_randr_get_monitors_cookie_t; /** Opcode for xcb_randr_get_monitors. */ #define XCB_RANDR_GET_MONITORS 42 /** * @brief xcb_randr_get_monitors_request_t **/ typedef struct xcb_randr_get_monitors_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; uint8_t get_active; } xcb_randr_get_monitors_request_t; /** * @brief xcb_randr_get_monitors_reply_t **/ typedef struct xcb_randr_get_monitors_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_timestamp_t timestamp; uint32_t nMonitors; uint32_t nOutputs; uint8_t pad1[12]; } xcb_randr_get_monitors_reply_t; /** Opcode for xcb_randr_set_monitor. */ #define XCB_RANDR_SET_MONITOR 43 /** * @brief xcb_randr_set_monitor_request_t **/ typedef struct xcb_randr_set_monitor_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_randr_set_monitor_request_t; /** Opcode for xcb_randr_delete_monitor. */ #define XCB_RANDR_DELETE_MONITOR 44 /** * @brief xcb_randr_delete_monitor_request_t **/ typedef struct xcb_randr_delete_monitor_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; xcb_atom_t name; } xcb_randr_delete_monitor_request_t; /** * @brief xcb_randr_create_lease_cookie_t **/ typedef struct xcb_randr_create_lease_cookie_t { unsigned int sequence; } xcb_randr_create_lease_cookie_t; /** Opcode for xcb_randr_create_lease. */ #define XCB_RANDR_CREATE_LEASE 45 /** * @brief xcb_randr_create_lease_request_t **/ typedef struct xcb_randr_create_lease_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; xcb_randr_lease_t lid; uint16_t num_crtcs; uint16_t num_outputs; } xcb_randr_create_lease_request_t; /** * @brief xcb_randr_create_lease_reply_t **/ typedef struct xcb_randr_create_lease_reply_t { uint8_t response_type; uint8_t nfd; uint16_t sequence; uint32_t length; uint8_t pad0[24]; } xcb_randr_create_lease_reply_t; /** Opcode for xcb_randr_free_lease. */ #define XCB_RANDR_FREE_LEASE 46 /** * @brief xcb_randr_free_lease_request_t **/ typedef struct xcb_randr_free_lease_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_randr_lease_t lid; uint8_t terminate; } xcb_randr_free_lease_request_t; /** * @brief xcb_randr_lease_notify_t **/ typedef struct xcb_randr_lease_notify_t { xcb_timestamp_t timestamp; xcb_window_t window; xcb_randr_lease_t lease; uint8_t created; uint8_t pad0[15]; } xcb_randr_lease_notify_t; /** * @brief xcb_randr_lease_notify_iterator_t **/ typedef struct xcb_randr_lease_notify_iterator_t { xcb_randr_lease_notify_t *data; int rem; int index; } xcb_randr_lease_notify_iterator_t; /** * @brief xcb_randr_notify_data_t **/ typedef union xcb_randr_notify_data_t { xcb_randr_crtc_change_t cc; xcb_randr_output_change_t oc; xcb_randr_output_property_t op; xcb_randr_provider_change_t pc; xcb_randr_provider_property_t pp; xcb_randr_resource_change_t rc; xcb_randr_lease_notify_t lc; } xcb_randr_notify_data_t; /** * @brief xcb_randr_notify_data_iterator_t **/ typedef struct xcb_randr_notify_data_iterator_t { xcb_randr_notify_data_t *data; int rem; int index; } xcb_randr_notify_data_iterator_t; /** Opcode for xcb_randr_notify. */ #define XCB_RANDR_NOTIFY 1 /** * @brief xcb_randr_notify_event_t **/ typedef struct xcb_randr_notify_event_t { uint8_t response_type; uint8_t subCode; uint16_t sequence; xcb_randr_notify_data_t u; } xcb_randr_notify_event_t; /** * Get the next element of the iterator * @param i Pointer to a xcb_randr_mode_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_randr_mode_t) */ void xcb_randr_mode_next (xcb_randr_mode_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_randr_mode_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_randr_mode_end (xcb_randr_mode_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_randr_crtc_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_randr_crtc_t) */ void xcb_randr_crtc_next (xcb_randr_crtc_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_randr_crtc_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_randr_crtc_end (xcb_randr_crtc_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_randr_output_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_randr_output_t) */ void xcb_randr_output_next (xcb_randr_output_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_randr_output_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_randr_output_end (xcb_randr_output_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_randr_provider_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_randr_provider_t) */ void xcb_randr_provider_next (xcb_randr_provider_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_randr_provider_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_randr_provider_end (xcb_randr_provider_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_randr_lease_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_randr_lease_t) */ void xcb_randr_lease_next (xcb_randr_lease_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_randr_lease_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_randr_lease_end (xcb_randr_lease_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_randr_screen_size_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_randr_screen_size_t) */ void xcb_randr_screen_size_next (xcb_randr_screen_size_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_randr_screen_size_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_randr_screen_size_end (xcb_randr_screen_size_iterator_t i); int xcb_randr_refresh_rates_sizeof (const void *_buffer); uint16_t * xcb_randr_refresh_rates_rates (const xcb_randr_refresh_rates_t *R); int xcb_randr_refresh_rates_rates_length (const xcb_randr_refresh_rates_t *R); xcb_generic_iterator_t xcb_randr_refresh_rates_rates_end (const xcb_randr_refresh_rates_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_randr_refresh_rates_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_randr_refresh_rates_t) */ void xcb_randr_refresh_rates_next (xcb_randr_refresh_rates_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_randr_refresh_rates_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_randr_refresh_rates_end (xcb_randr_refresh_rates_iterator_t i); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_query_version_cookie_t xcb_randr_query_version (xcb_connection_t *c, uint32_t major_version, uint32_t minor_version); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_query_version_cookie_t xcb_randr_query_version_unchecked (xcb_connection_t *c, uint32_t major_version, uint32_t minor_version); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_query_version_reply_t * xcb_randr_query_version_reply (xcb_connection_t *c, xcb_randr_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_set_screen_config_cookie_t xcb_randr_set_screen_config (xcb_connection_t *c, xcb_window_t window, xcb_timestamp_t timestamp, xcb_timestamp_t config_timestamp, uint16_t sizeID, uint16_t rotation, uint16_t rate); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_set_screen_config_cookie_t xcb_randr_set_screen_config_unchecked (xcb_connection_t *c, xcb_window_t window, xcb_timestamp_t timestamp, xcb_timestamp_t config_timestamp, uint16_t sizeID, uint16_t rotation, uint16_t rate); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_set_screen_config_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_set_screen_config_reply_t * xcb_randr_set_screen_config_reply (xcb_connection_t *c, xcb_randr_set_screen_config_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_randr_select_input_checked (xcb_connection_t *c, xcb_window_t window, uint16_t enable); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_randr_select_input (xcb_connection_t *c, xcb_window_t window, uint16_t enable); int xcb_randr_get_screen_info_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_get_screen_info_cookie_t xcb_randr_get_screen_info (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_get_screen_info_cookie_t xcb_randr_get_screen_info_unchecked (xcb_connection_t *c, xcb_window_t window); xcb_randr_screen_size_t * xcb_randr_get_screen_info_sizes (const xcb_randr_get_screen_info_reply_t *R); int xcb_randr_get_screen_info_sizes_length (const xcb_randr_get_screen_info_reply_t *R); xcb_randr_screen_size_iterator_t xcb_randr_get_screen_info_sizes_iterator (const xcb_randr_get_screen_info_reply_t *R); int xcb_randr_get_screen_info_rates_length (const xcb_randr_get_screen_info_reply_t *R); xcb_randr_refresh_rates_iterator_t xcb_randr_get_screen_info_rates_iterator (const xcb_randr_get_screen_info_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_get_screen_info_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_get_screen_info_reply_t * xcb_randr_get_screen_info_reply (xcb_connection_t *c, xcb_randr_get_screen_info_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_get_screen_size_range_cookie_t xcb_randr_get_screen_size_range (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_get_screen_size_range_cookie_t xcb_randr_get_screen_size_range_unchecked (xcb_connection_t *c, xcb_window_t window); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_get_screen_size_range_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_get_screen_size_range_reply_t * xcb_randr_get_screen_size_range_reply (xcb_connection_t *c, xcb_randr_get_screen_size_range_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_randr_set_screen_size_checked (xcb_connection_t *c, xcb_window_t window, uint16_t width, uint16_t height, uint32_t mm_width, uint32_t mm_height); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_randr_set_screen_size (xcb_connection_t *c, xcb_window_t window, uint16_t width, uint16_t height, uint32_t mm_width, uint32_t mm_height); /** * Get the next element of the iterator * @param i Pointer to a xcb_randr_mode_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_randr_mode_info_t) */ void xcb_randr_mode_info_next (xcb_randr_mode_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_randr_mode_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_randr_mode_info_end (xcb_randr_mode_info_iterator_t i); int xcb_randr_get_screen_resources_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_get_screen_resources_cookie_t xcb_randr_get_screen_resources (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_get_screen_resources_cookie_t xcb_randr_get_screen_resources_unchecked (xcb_connection_t *c, xcb_window_t window); xcb_randr_crtc_t * xcb_randr_get_screen_resources_crtcs (const xcb_randr_get_screen_resources_reply_t *R); int xcb_randr_get_screen_resources_crtcs_length (const xcb_randr_get_screen_resources_reply_t *R); xcb_generic_iterator_t xcb_randr_get_screen_resources_crtcs_end (const xcb_randr_get_screen_resources_reply_t *R); xcb_randr_output_t * xcb_randr_get_screen_resources_outputs (const xcb_randr_get_screen_resources_reply_t *R); int xcb_randr_get_screen_resources_outputs_length (const xcb_randr_get_screen_resources_reply_t *R); xcb_generic_iterator_t xcb_randr_get_screen_resources_outputs_end (const xcb_randr_get_screen_resources_reply_t *R); xcb_randr_mode_info_t * xcb_randr_get_screen_resources_modes (const xcb_randr_get_screen_resources_reply_t *R); int xcb_randr_get_screen_resources_modes_length (const xcb_randr_get_screen_resources_reply_t *R); xcb_randr_mode_info_iterator_t xcb_randr_get_screen_resources_modes_iterator (const xcb_randr_get_screen_resources_reply_t *R); uint8_t * xcb_randr_get_screen_resources_names (const xcb_randr_get_screen_resources_reply_t *R); int xcb_randr_get_screen_resources_names_length (const xcb_randr_get_screen_resources_reply_t *R); xcb_generic_iterator_t xcb_randr_get_screen_resources_names_end (const xcb_randr_get_screen_resources_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_get_screen_resources_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_get_screen_resources_reply_t * xcb_randr_get_screen_resources_reply (xcb_connection_t *c, xcb_randr_get_screen_resources_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_randr_get_output_info_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_get_output_info_cookie_t xcb_randr_get_output_info (xcb_connection_t *c, xcb_randr_output_t output, xcb_timestamp_t config_timestamp); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_get_output_info_cookie_t xcb_randr_get_output_info_unchecked (xcb_connection_t *c, xcb_randr_output_t output, xcb_timestamp_t config_timestamp); xcb_randr_crtc_t * xcb_randr_get_output_info_crtcs (const xcb_randr_get_output_info_reply_t *R); int xcb_randr_get_output_info_crtcs_length (const xcb_randr_get_output_info_reply_t *R); xcb_generic_iterator_t xcb_randr_get_output_info_crtcs_end (const xcb_randr_get_output_info_reply_t *R); xcb_randr_mode_t * xcb_randr_get_output_info_modes (const xcb_randr_get_output_info_reply_t *R); int xcb_randr_get_output_info_modes_length (const xcb_randr_get_output_info_reply_t *R); xcb_generic_iterator_t xcb_randr_get_output_info_modes_end (const xcb_randr_get_output_info_reply_t *R); xcb_randr_output_t * xcb_randr_get_output_info_clones (const xcb_randr_get_output_info_reply_t *R); int xcb_randr_get_output_info_clones_length (const xcb_randr_get_output_info_reply_t *R); xcb_generic_iterator_t xcb_randr_get_output_info_clones_end (const xcb_randr_get_output_info_reply_t *R); uint8_t * xcb_randr_get_output_info_name (const xcb_randr_get_output_info_reply_t *R); int xcb_randr_get_output_info_name_length (const xcb_randr_get_output_info_reply_t *R); xcb_generic_iterator_t xcb_randr_get_output_info_name_end (const xcb_randr_get_output_info_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_get_output_info_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_get_output_info_reply_t * xcb_randr_get_output_info_reply (xcb_connection_t *c, xcb_randr_get_output_info_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_randr_list_output_properties_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_list_output_properties_cookie_t xcb_randr_list_output_properties (xcb_connection_t *c, xcb_randr_output_t output); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_list_output_properties_cookie_t xcb_randr_list_output_properties_unchecked (xcb_connection_t *c, xcb_randr_output_t output); xcb_atom_t * xcb_randr_list_output_properties_atoms (const xcb_randr_list_output_properties_reply_t *R); int xcb_randr_list_output_properties_atoms_length (const xcb_randr_list_output_properties_reply_t *R); xcb_generic_iterator_t xcb_randr_list_output_properties_atoms_end (const xcb_randr_list_output_properties_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_list_output_properties_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_list_output_properties_reply_t * xcb_randr_list_output_properties_reply (xcb_connection_t *c, xcb_randr_list_output_properties_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_randr_query_output_property_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_query_output_property_cookie_t xcb_randr_query_output_property (xcb_connection_t *c, xcb_randr_output_t output, xcb_atom_t property); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_query_output_property_cookie_t xcb_randr_query_output_property_unchecked (xcb_connection_t *c, xcb_randr_output_t output, xcb_atom_t property); int32_t * xcb_randr_query_output_property_valid_values (const xcb_randr_query_output_property_reply_t *R); int xcb_randr_query_output_property_valid_values_length (const xcb_randr_query_output_property_reply_t *R); xcb_generic_iterator_t xcb_randr_query_output_property_valid_values_end (const xcb_randr_query_output_property_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_query_output_property_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_query_output_property_reply_t * xcb_randr_query_output_property_reply (xcb_connection_t *c, xcb_randr_query_output_property_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_randr_configure_output_property_sizeof (const void *_buffer, uint32_t values_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_randr_configure_output_property_checked (xcb_connection_t *c, xcb_randr_output_t output, xcb_atom_t property, uint8_t pending, uint8_t range, uint32_t values_len, const int32_t *values); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_randr_configure_output_property (xcb_connection_t *c, xcb_randr_output_t output, xcb_atom_t property, uint8_t pending, uint8_t range, uint32_t values_len, const int32_t *values); int32_t * xcb_randr_configure_output_property_values (const xcb_randr_configure_output_property_request_t *R); int xcb_randr_configure_output_property_values_length (const xcb_randr_configure_output_property_request_t *R); xcb_generic_iterator_t xcb_randr_configure_output_property_values_end (const xcb_randr_configure_output_property_request_t *R); int xcb_randr_change_output_property_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_randr_change_output_property_checked (xcb_connection_t *c, xcb_randr_output_t output, xcb_atom_t property, xcb_atom_t type, uint8_t format, uint8_t mode, uint32_t num_units, const void *data); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_randr_change_output_property (xcb_connection_t *c, xcb_randr_output_t output, xcb_atom_t property, xcb_atom_t type, uint8_t format, uint8_t mode, uint32_t num_units, const void *data); void * xcb_randr_change_output_property_data (const xcb_randr_change_output_property_request_t *R); int xcb_randr_change_output_property_data_length (const xcb_randr_change_output_property_request_t *R); xcb_generic_iterator_t xcb_randr_change_output_property_data_end (const xcb_randr_change_output_property_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_randr_delete_output_property_checked (xcb_connection_t *c, xcb_randr_output_t output, xcb_atom_t property); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_randr_delete_output_property (xcb_connection_t *c, xcb_randr_output_t output, xcb_atom_t property); int xcb_randr_get_output_property_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_get_output_property_cookie_t xcb_randr_get_output_property (xcb_connection_t *c, xcb_randr_output_t output, xcb_atom_t property, xcb_atom_t type, uint32_t long_offset, uint32_t long_length, uint8_t _delete, uint8_t pending); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_get_output_property_cookie_t xcb_randr_get_output_property_unchecked (xcb_connection_t *c, xcb_randr_output_t output, xcb_atom_t property, xcb_atom_t type, uint32_t long_offset, uint32_t long_length, uint8_t _delete, uint8_t pending); uint8_t * xcb_randr_get_output_property_data (const xcb_randr_get_output_property_reply_t *R); int xcb_randr_get_output_property_data_length (const xcb_randr_get_output_property_reply_t *R); xcb_generic_iterator_t xcb_randr_get_output_property_data_end (const xcb_randr_get_output_property_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_get_output_property_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_get_output_property_reply_t * xcb_randr_get_output_property_reply (xcb_connection_t *c, xcb_randr_get_output_property_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_randr_create_mode_sizeof (const void *_buffer, uint32_t name_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_create_mode_cookie_t xcb_randr_create_mode (xcb_connection_t *c, xcb_window_t window, xcb_randr_mode_info_t mode_info, uint32_t name_len, const char *name); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_create_mode_cookie_t xcb_randr_create_mode_unchecked (xcb_connection_t *c, xcb_window_t window, xcb_randr_mode_info_t mode_info, uint32_t name_len, const char *name); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_create_mode_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_create_mode_reply_t * xcb_randr_create_mode_reply (xcb_connection_t *c, xcb_randr_create_mode_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_randr_destroy_mode_checked (xcb_connection_t *c, xcb_randr_mode_t mode); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_randr_destroy_mode (xcb_connection_t *c, xcb_randr_mode_t mode); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_randr_add_output_mode_checked (xcb_connection_t *c, xcb_randr_output_t output, xcb_randr_mode_t mode); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_randr_add_output_mode (xcb_connection_t *c, xcb_randr_output_t output, xcb_randr_mode_t mode); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_randr_delete_output_mode_checked (xcb_connection_t *c, xcb_randr_output_t output, xcb_randr_mode_t mode); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_randr_delete_output_mode (xcb_connection_t *c, xcb_randr_output_t output, xcb_randr_mode_t mode); int xcb_randr_get_crtc_info_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_get_crtc_info_cookie_t xcb_randr_get_crtc_info (xcb_connection_t *c, xcb_randr_crtc_t crtc, xcb_timestamp_t config_timestamp); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_get_crtc_info_cookie_t xcb_randr_get_crtc_info_unchecked (xcb_connection_t *c, xcb_randr_crtc_t crtc, xcb_timestamp_t config_timestamp); xcb_randr_output_t * xcb_randr_get_crtc_info_outputs (const xcb_randr_get_crtc_info_reply_t *R); int xcb_randr_get_crtc_info_outputs_length (const xcb_randr_get_crtc_info_reply_t *R); xcb_generic_iterator_t xcb_randr_get_crtc_info_outputs_end (const xcb_randr_get_crtc_info_reply_t *R); xcb_randr_output_t * xcb_randr_get_crtc_info_possible (const xcb_randr_get_crtc_info_reply_t *R); int xcb_randr_get_crtc_info_possible_length (const xcb_randr_get_crtc_info_reply_t *R); xcb_generic_iterator_t xcb_randr_get_crtc_info_possible_end (const xcb_randr_get_crtc_info_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_get_crtc_info_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_get_crtc_info_reply_t * xcb_randr_get_crtc_info_reply (xcb_connection_t *c, xcb_randr_get_crtc_info_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_randr_set_crtc_config_sizeof (const void *_buffer, uint32_t outputs_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_set_crtc_config_cookie_t xcb_randr_set_crtc_config (xcb_connection_t *c, xcb_randr_crtc_t crtc, xcb_timestamp_t timestamp, xcb_timestamp_t config_timestamp, int16_t x, int16_t y, xcb_randr_mode_t mode, uint16_t rotation, uint32_t outputs_len, const xcb_randr_output_t *outputs); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_set_crtc_config_cookie_t xcb_randr_set_crtc_config_unchecked (xcb_connection_t *c, xcb_randr_crtc_t crtc, xcb_timestamp_t timestamp, xcb_timestamp_t config_timestamp, int16_t x, int16_t y, xcb_randr_mode_t mode, uint16_t rotation, uint32_t outputs_len, const xcb_randr_output_t *outputs); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_set_crtc_config_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_set_crtc_config_reply_t * xcb_randr_set_crtc_config_reply (xcb_connection_t *c, xcb_randr_set_crtc_config_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_get_crtc_gamma_size_cookie_t xcb_randr_get_crtc_gamma_size (xcb_connection_t *c, xcb_randr_crtc_t crtc); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_get_crtc_gamma_size_cookie_t xcb_randr_get_crtc_gamma_size_unchecked (xcb_connection_t *c, xcb_randr_crtc_t crtc); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_get_crtc_gamma_size_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_get_crtc_gamma_size_reply_t * xcb_randr_get_crtc_gamma_size_reply (xcb_connection_t *c, xcb_randr_get_crtc_gamma_size_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_randr_get_crtc_gamma_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_get_crtc_gamma_cookie_t xcb_randr_get_crtc_gamma (xcb_connection_t *c, xcb_randr_crtc_t crtc); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_get_crtc_gamma_cookie_t xcb_randr_get_crtc_gamma_unchecked (xcb_connection_t *c, xcb_randr_crtc_t crtc); uint16_t * xcb_randr_get_crtc_gamma_red (const xcb_randr_get_crtc_gamma_reply_t *R); int xcb_randr_get_crtc_gamma_red_length (const xcb_randr_get_crtc_gamma_reply_t *R); xcb_generic_iterator_t xcb_randr_get_crtc_gamma_red_end (const xcb_randr_get_crtc_gamma_reply_t *R); uint16_t * xcb_randr_get_crtc_gamma_green (const xcb_randr_get_crtc_gamma_reply_t *R); int xcb_randr_get_crtc_gamma_green_length (const xcb_randr_get_crtc_gamma_reply_t *R); xcb_generic_iterator_t xcb_randr_get_crtc_gamma_green_end (const xcb_randr_get_crtc_gamma_reply_t *R); uint16_t * xcb_randr_get_crtc_gamma_blue (const xcb_randr_get_crtc_gamma_reply_t *R); int xcb_randr_get_crtc_gamma_blue_length (const xcb_randr_get_crtc_gamma_reply_t *R); xcb_generic_iterator_t xcb_randr_get_crtc_gamma_blue_end (const xcb_randr_get_crtc_gamma_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_get_crtc_gamma_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_get_crtc_gamma_reply_t * xcb_randr_get_crtc_gamma_reply (xcb_connection_t *c, xcb_randr_get_crtc_gamma_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_randr_set_crtc_gamma_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_randr_set_crtc_gamma_checked (xcb_connection_t *c, xcb_randr_crtc_t crtc, uint16_t size, const uint16_t *red, const uint16_t *green, const uint16_t *blue); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_randr_set_crtc_gamma (xcb_connection_t *c, xcb_randr_crtc_t crtc, uint16_t size, const uint16_t *red, const uint16_t *green, const uint16_t *blue); uint16_t * xcb_randr_set_crtc_gamma_red (const xcb_randr_set_crtc_gamma_request_t *R); int xcb_randr_set_crtc_gamma_red_length (const xcb_randr_set_crtc_gamma_request_t *R); xcb_generic_iterator_t xcb_randr_set_crtc_gamma_red_end (const xcb_randr_set_crtc_gamma_request_t *R); uint16_t * xcb_randr_set_crtc_gamma_green (const xcb_randr_set_crtc_gamma_request_t *R); int xcb_randr_set_crtc_gamma_green_length (const xcb_randr_set_crtc_gamma_request_t *R); xcb_generic_iterator_t xcb_randr_set_crtc_gamma_green_end (const xcb_randr_set_crtc_gamma_request_t *R); uint16_t * xcb_randr_set_crtc_gamma_blue (const xcb_randr_set_crtc_gamma_request_t *R); int xcb_randr_set_crtc_gamma_blue_length (const xcb_randr_set_crtc_gamma_request_t *R); xcb_generic_iterator_t xcb_randr_set_crtc_gamma_blue_end (const xcb_randr_set_crtc_gamma_request_t *R); int xcb_randr_get_screen_resources_current_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_get_screen_resources_current_cookie_t xcb_randr_get_screen_resources_current (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_get_screen_resources_current_cookie_t xcb_randr_get_screen_resources_current_unchecked (xcb_connection_t *c, xcb_window_t window); xcb_randr_crtc_t * xcb_randr_get_screen_resources_current_crtcs (const xcb_randr_get_screen_resources_current_reply_t *R); int xcb_randr_get_screen_resources_current_crtcs_length (const xcb_randr_get_screen_resources_current_reply_t *R); xcb_generic_iterator_t xcb_randr_get_screen_resources_current_crtcs_end (const xcb_randr_get_screen_resources_current_reply_t *R); xcb_randr_output_t * xcb_randr_get_screen_resources_current_outputs (const xcb_randr_get_screen_resources_current_reply_t *R); int xcb_randr_get_screen_resources_current_outputs_length (const xcb_randr_get_screen_resources_current_reply_t *R); xcb_generic_iterator_t xcb_randr_get_screen_resources_current_outputs_end (const xcb_randr_get_screen_resources_current_reply_t *R); xcb_randr_mode_info_t * xcb_randr_get_screen_resources_current_modes (const xcb_randr_get_screen_resources_current_reply_t *R); int xcb_randr_get_screen_resources_current_modes_length (const xcb_randr_get_screen_resources_current_reply_t *R); xcb_randr_mode_info_iterator_t xcb_randr_get_screen_resources_current_modes_iterator (const xcb_randr_get_screen_resources_current_reply_t *R); uint8_t * xcb_randr_get_screen_resources_current_names (const xcb_randr_get_screen_resources_current_reply_t *R); int xcb_randr_get_screen_resources_current_names_length (const xcb_randr_get_screen_resources_current_reply_t *R); xcb_generic_iterator_t xcb_randr_get_screen_resources_current_names_end (const xcb_randr_get_screen_resources_current_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_get_screen_resources_current_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_get_screen_resources_current_reply_t * xcb_randr_get_screen_resources_current_reply (xcb_connection_t *c, xcb_randr_get_screen_resources_current_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_randr_set_crtc_transform_sizeof (const void *_buffer, uint32_t filter_params_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_randr_set_crtc_transform_checked (xcb_connection_t *c, xcb_randr_crtc_t crtc, xcb_render_transform_t transform, uint16_t filter_len, const char *filter_name, uint32_t filter_params_len, const xcb_render_fixed_t *filter_params); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_randr_set_crtc_transform (xcb_connection_t *c, xcb_randr_crtc_t crtc, xcb_render_transform_t transform, uint16_t filter_len, const char *filter_name, uint32_t filter_params_len, const xcb_render_fixed_t *filter_params); char * xcb_randr_set_crtc_transform_filter_name (const xcb_randr_set_crtc_transform_request_t *R); int xcb_randr_set_crtc_transform_filter_name_length (const xcb_randr_set_crtc_transform_request_t *R); xcb_generic_iterator_t xcb_randr_set_crtc_transform_filter_name_end (const xcb_randr_set_crtc_transform_request_t *R); xcb_render_fixed_t * xcb_randr_set_crtc_transform_filter_params (const xcb_randr_set_crtc_transform_request_t *R); int xcb_randr_set_crtc_transform_filter_params_length (const xcb_randr_set_crtc_transform_request_t *R); xcb_generic_iterator_t xcb_randr_set_crtc_transform_filter_params_end (const xcb_randr_set_crtc_transform_request_t *R); int xcb_randr_get_crtc_transform_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_get_crtc_transform_cookie_t xcb_randr_get_crtc_transform (xcb_connection_t *c, xcb_randr_crtc_t crtc); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_get_crtc_transform_cookie_t xcb_randr_get_crtc_transform_unchecked (xcb_connection_t *c, xcb_randr_crtc_t crtc); char * xcb_randr_get_crtc_transform_pending_filter_name (const xcb_randr_get_crtc_transform_reply_t *R); int xcb_randr_get_crtc_transform_pending_filter_name_length (const xcb_randr_get_crtc_transform_reply_t *R); xcb_generic_iterator_t xcb_randr_get_crtc_transform_pending_filter_name_end (const xcb_randr_get_crtc_transform_reply_t *R); xcb_render_fixed_t * xcb_randr_get_crtc_transform_pending_params (const xcb_randr_get_crtc_transform_reply_t *R); int xcb_randr_get_crtc_transform_pending_params_length (const xcb_randr_get_crtc_transform_reply_t *R); xcb_generic_iterator_t xcb_randr_get_crtc_transform_pending_params_end (const xcb_randr_get_crtc_transform_reply_t *R); char * xcb_randr_get_crtc_transform_current_filter_name (const xcb_randr_get_crtc_transform_reply_t *R); int xcb_randr_get_crtc_transform_current_filter_name_length (const xcb_randr_get_crtc_transform_reply_t *R); xcb_generic_iterator_t xcb_randr_get_crtc_transform_current_filter_name_end (const xcb_randr_get_crtc_transform_reply_t *R); xcb_render_fixed_t * xcb_randr_get_crtc_transform_current_params (const xcb_randr_get_crtc_transform_reply_t *R); int xcb_randr_get_crtc_transform_current_params_length (const xcb_randr_get_crtc_transform_reply_t *R); xcb_generic_iterator_t xcb_randr_get_crtc_transform_current_params_end (const xcb_randr_get_crtc_transform_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_get_crtc_transform_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_get_crtc_transform_reply_t * xcb_randr_get_crtc_transform_reply (xcb_connection_t *c, xcb_randr_get_crtc_transform_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_get_panning_cookie_t xcb_randr_get_panning (xcb_connection_t *c, xcb_randr_crtc_t crtc); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_get_panning_cookie_t xcb_randr_get_panning_unchecked (xcb_connection_t *c, xcb_randr_crtc_t crtc); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_get_panning_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_get_panning_reply_t * xcb_randr_get_panning_reply (xcb_connection_t *c, xcb_randr_get_panning_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_set_panning_cookie_t xcb_randr_set_panning (xcb_connection_t *c, xcb_randr_crtc_t crtc, xcb_timestamp_t timestamp, uint16_t left, uint16_t top, uint16_t width, uint16_t height, uint16_t track_left, uint16_t track_top, uint16_t track_width, uint16_t track_height, int16_t border_left, int16_t border_top, int16_t border_right, int16_t border_bottom); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_set_panning_cookie_t xcb_randr_set_panning_unchecked (xcb_connection_t *c, xcb_randr_crtc_t crtc, xcb_timestamp_t timestamp, uint16_t left, uint16_t top, uint16_t width, uint16_t height, uint16_t track_left, uint16_t track_top, uint16_t track_width, uint16_t track_height, int16_t border_left, int16_t border_top, int16_t border_right, int16_t border_bottom); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_set_panning_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_set_panning_reply_t * xcb_randr_set_panning_reply (xcb_connection_t *c, xcb_randr_set_panning_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_randr_set_output_primary_checked (xcb_connection_t *c, xcb_window_t window, xcb_randr_output_t output); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_randr_set_output_primary (xcb_connection_t *c, xcb_window_t window, xcb_randr_output_t output); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_get_output_primary_cookie_t xcb_randr_get_output_primary (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_get_output_primary_cookie_t xcb_randr_get_output_primary_unchecked (xcb_connection_t *c, xcb_window_t window); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_get_output_primary_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_get_output_primary_reply_t * xcb_randr_get_output_primary_reply (xcb_connection_t *c, xcb_randr_get_output_primary_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_randr_get_providers_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_get_providers_cookie_t xcb_randr_get_providers (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_get_providers_cookie_t xcb_randr_get_providers_unchecked (xcb_connection_t *c, xcb_window_t window); xcb_randr_provider_t * xcb_randr_get_providers_providers (const xcb_randr_get_providers_reply_t *R); int xcb_randr_get_providers_providers_length (const xcb_randr_get_providers_reply_t *R); xcb_generic_iterator_t xcb_randr_get_providers_providers_end (const xcb_randr_get_providers_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_get_providers_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_get_providers_reply_t * xcb_randr_get_providers_reply (xcb_connection_t *c, xcb_randr_get_providers_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_randr_get_provider_info_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_get_provider_info_cookie_t xcb_randr_get_provider_info (xcb_connection_t *c, xcb_randr_provider_t provider, xcb_timestamp_t config_timestamp); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_get_provider_info_cookie_t xcb_randr_get_provider_info_unchecked (xcb_connection_t *c, xcb_randr_provider_t provider, xcb_timestamp_t config_timestamp); xcb_randr_crtc_t * xcb_randr_get_provider_info_crtcs (const xcb_randr_get_provider_info_reply_t *R); int xcb_randr_get_provider_info_crtcs_length (const xcb_randr_get_provider_info_reply_t *R); xcb_generic_iterator_t xcb_randr_get_provider_info_crtcs_end (const xcb_randr_get_provider_info_reply_t *R); xcb_randr_output_t * xcb_randr_get_provider_info_outputs (const xcb_randr_get_provider_info_reply_t *R); int xcb_randr_get_provider_info_outputs_length (const xcb_randr_get_provider_info_reply_t *R); xcb_generic_iterator_t xcb_randr_get_provider_info_outputs_end (const xcb_randr_get_provider_info_reply_t *R); xcb_randr_provider_t * xcb_randr_get_provider_info_associated_providers (const xcb_randr_get_provider_info_reply_t *R); int xcb_randr_get_provider_info_associated_providers_length (const xcb_randr_get_provider_info_reply_t *R); xcb_generic_iterator_t xcb_randr_get_provider_info_associated_providers_end (const xcb_randr_get_provider_info_reply_t *R); uint32_t * xcb_randr_get_provider_info_associated_capability (const xcb_randr_get_provider_info_reply_t *R); int xcb_randr_get_provider_info_associated_capability_length (const xcb_randr_get_provider_info_reply_t *R); xcb_generic_iterator_t xcb_randr_get_provider_info_associated_capability_end (const xcb_randr_get_provider_info_reply_t *R); char * xcb_randr_get_provider_info_name (const xcb_randr_get_provider_info_reply_t *R); int xcb_randr_get_provider_info_name_length (const xcb_randr_get_provider_info_reply_t *R); xcb_generic_iterator_t xcb_randr_get_provider_info_name_end (const xcb_randr_get_provider_info_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_get_provider_info_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_get_provider_info_reply_t * xcb_randr_get_provider_info_reply (xcb_connection_t *c, xcb_randr_get_provider_info_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_randr_set_provider_offload_sink_checked (xcb_connection_t *c, xcb_randr_provider_t provider, xcb_randr_provider_t sink_provider, xcb_timestamp_t config_timestamp); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_randr_set_provider_offload_sink (xcb_connection_t *c, xcb_randr_provider_t provider, xcb_randr_provider_t sink_provider, xcb_timestamp_t config_timestamp); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_randr_set_provider_output_source_checked (xcb_connection_t *c, xcb_randr_provider_t provider, xcb_randr_provider_t source_provider, xcb_timestamp_t config_timestamp); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_randr_set_provider_output_source (xcb_connection_t *c, xcb_randr_provider_t provider, xcb_randr_provider_t source_provider, xcb_timestamp_t config_timestamp); int xcb_randr_list_provider_properties_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_list_provider_properties_cookie_t xcb_randr_list_provider_properties (xcb_connection_t *c, xcb_randr_provider_t provider); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_list_provider_properties_cookie_t xcb_randr_list_provider_properties_unchecked (xcb_connection_t *c, xcb_randr_provider_t provider); xcb_atom_t * xcb_randr_list_provider_properties_atoms (const xcb_randr_list_provider_properties_reply_t *R); int xcb_randr_list_provider_properties_atoms_length (const xcb_randr_list_provider_properties_reply_t *R); xcb_generic_iterator_t xcb_randr_list_provider_properties_atoms_end (const xcb_randr_list_provider_properties_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_list_provider_properties_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_list_provider_properties_reply_t * xcb_randr_list_provider_properties_reply (xcb_connection_t *c, xcb_randr_list_provider_properties_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_randr_query_provider_property_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_query_provider_property_cookie_t xcb_randr_query_provider_property (xcb_connection_t *c, xcb_randr_provider_t provider, xcb_atom_t property); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_query_provider_property_cookie_t xcb_randr_query_provider_property_unchecked (xcb_connection_t *c, xcb_randr_provider_t provider, xcb_atom_t property); int32_t * xcb_randr_query_provider_property_valid_values (const xcb_randr_query_provider_property_reply_t *R); int xcb_randr_query_provider_property_valid_values_length (const xcb_randr_query_provider_property_reply_t *R); xcb_generic_iterator_t xcb_randr_query_provider_property_valid_values_end (const xcb_randr_query_provider_property_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_query_provider_property_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_query_provider_property_reply_t * xcb_randr_query_provider_property_reply (xcb_connection_t *c, xcb_randr_query_provider_property_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_randr_configure_provider_property_sizeof (const void *_buffer, uint32_t values_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_randr_configure_provider_property_checked (xcb_connection_t *c, xcb_randr_provider_t provider, xcb_atom_t property, uint8_t pending, uint8_t range, uint32_t values_len, const int32_t *values); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_randr_configure_provider_property (xcb_connection_t *c, xcb_randr_provider_t provider, xcb_atom_t property, uint8_t pending, uint8_t range, uint32_t values_len, const int32_t *values); int32_t * xcb_randr_configure_provider_property_values (const xcb_randr_configure_provider_property_request_t *R); int xcb_randr_configure_provider_property_values_length (const xcb_randr_configure_provider_property_request_t *R); xcb_generic_iterator_t xcb_randr_configure_provider_property_values_end (const xcb_randr_configure_provider_property_request_t *R); int xcb_randr_change_provider_property_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_randr_change_provider_property_checked (xcb_connection_t *c, xcb_randr_provider_t provider, xcb_atom_t property, xcb_atom_t type, uint8_t format, uint8_t mode, uint32_t num_items, const void *data); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_randr_change_provider_property (xcb_connection_t *c, xcb_randr_provider_t provider, xcb_atom_t property, xcb_atom_t type, uint8_t format, uint8_t mode, uint32_t num_items, const void *data); void * xcb_randr_change_provider_property_data (const xcb_randr_change_provider_property_request_t *R); int xcb_randr_change_provider_property_data_length (const xcb_randr_change_provider_property_request_t *R); xcb_generic_iterator_t xcb_randr_change_provider_property_data_end (const xcb_randr_change_provider_property_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_randr_delete_provider_property_checked (xcb_connection_t *c, xcb_randr_provider_t provider, xcb_atom_t property); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_randr_delete_provider_property (xcb_connection_t *c, xcb_randr_provider_t provider, xcb_atom_t property); int xcb_randr_get_provider_property_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_get_provider_property_cookie_t xcb_randr_get_provider_property (xcb_connection_t *c, xcb_randr_provider_t provider, xcb_atom_t property, xcb_atom_t type, uint32_t long_offset, uint32_t long_length, uint8_t _delete, uint8_t pending); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_get_provider_property_cookie_t xcb_randr_get_provider_property_unchecked (xcb_connection_t *c, xcb_randr_provider_t provider, xcb_atom_t property, xcb_atom_t type, uint32_t long_offset, uint32_t long_length, uint8_t _delete, uint8_t pending); void * xcb_randr_get_provider_property_data (const xcb_randr_get_provider_property_reply_t *R); int xcb_randr_get_provider_property_data_length (const xcb_randr_get_provider_property_reply_t *R); xcb_generic_iterator_t xcb_randr_get_provider_property_data_end (const xcb_randr_get_provider_property_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_get_provider_property_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_get_provider_property_reply_t * xcb_randr_get_provider_property_reply (xcb_connection_t *c, xcb_randr_get_provider_property_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * Get the next element of the iterator * @param i Pointer to a xcb_randr_crtc_change_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_randr_crtc_change_t) */ void xcb_randr_crtc_change_next (xcb_randr_crtc_change_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_randr_crtc_change_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_randr_crtc_change_end (xcb_randr_crtc_change_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_randr_output_change_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_randr_output_change_t) */ void xcb_randr_output_change_next (xcb_randr_output_change_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_randr_output_change_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_randr_output_change_end (xcb_randr_output_change_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_randr_output_property_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_randr_output_property_t) */ void xcb_randr_output_property_next (xcb_randr_output_property_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_randr_output_property_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_randr_output_property_end (xcb_randr_output_property_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_randr_provider_change_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_randr_provider_change_t) */ void xcb_randr_provider_change_next (xcb_randr_provider_change_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_randr_provider_change_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_randr_provider_change_end (xcb_randr_provider_change_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_randr_provider_property_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_randr_provider_property_t) */ void xcb_randr_provider_property_next (xcb_randr_provider_property_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_randr_provider_property_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_randr_provider_property_end (xcb_randr_provider_property_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_randr_resource_change_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_randr_resource_change_t) */ void xcb_randr_resource_change_next (xcb_randr_resource_change_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_randr_resource_change_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_randr_resource_change_end (xcb_randr_resource_change_iterator_t i); int xcb_randr_monitor_info_sizeof (const void *_buffer); xcb_randr_output_t * xcb_randr_monitor_info_outputs (const xcb_randr_monitor_info_t *R); int xcb_randr_monitor_info_outputs_length (const xcb_randr_monitor_info_t *R); xcb_generic_iterator_t xcb_randr_monitor_info_outputs_end (const xcb_randr_monitor_info_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_randr_monitor_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_randr_monitor_info_t) */ void xcb_randr_monitor_info_next (xcb_randr_monitor_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_randr_monitor_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_randr_monitor_info_end (xcb_randr_monitor_info_iterator_t i); int xcb_randr_get_monitors_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_get_monitors_cookie_t xcb_randr_get_monitors (xcb_connection_t *c, xcb_window_t window, uint8_t get_active); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_get_monitors_cookie_t xcb_randr_get_monitors_unchecked (xcb_connection_t *c, xcb_window_t window, uint8_t get_active); int xcb_randr_get_monitors_monitors_length (const xcb_randr_get_monitors_reply_t *R); xcb_randr_monitor_info_iterator_t xcb_randr_get_monitors_monitors_iterator (const xcb_randr_get_monitors_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_get_monitors_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_get_monitors_reply_t * xcb_randr_get_monitors_reply (xcb_connection_t *c, xcb_randr_get_monitors_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_randr_set_monitor_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_randr_set_monitor_checked (xcb_connection_t *c, xcb_window_t window, xcb_randr_monitor_info_t *monitorinfo); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_randr_set_monitor (xcb_connection_t *c, xcb_window_t window, xcb_randr_monitor_info_t *monitorinfo); xcb_randr_monitor_info_t * xcb_randr_set_monitor_monitorinfo (const xcb_randr_set_monitor_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_randr_delete_monitor_checked (xcb_connection_t *c, xcb_window_t window, xcb_atom_t name); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_randr_delete_monitor (xcb_connection_t *c, xcb_window_t window, xcb_atom_t name); int xcb_randr_create_lease_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_randr_create_lease_cookie_t xcb_randr_create_lease (xcb_connection_t *c, xcb_window_t window, xcb_randr_lease_t lid, uint16_t num_crtcs, uint16_t num_outputs, const xcb_randr_crtc_t *crtcs, const xcb_randr_output_t *outputs); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_randr_create_lease_cookie_t xcb_randr_create_lease_unchecked (xcb_connection_t *c, xcb_window_t window, xcb_randr_lease_t lid, uint16_t num_crtcs, uint16_t num_outputs, const xcb_randr_crtc_t *crtcs, const xcb_randr_output_t *outputs); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_randr_create_lease_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_randr_create_lease_reply_t * xcb_randr_create_lease_reply (xcb_connection_t *c, xcb_randr_create_lease_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * Return the reply fds * @param c The connection * @param reply The reply * * Returns the array of reply fds of the request asked by * * The returned value must be freed by the caller using free(). */ int * xcb_randr_create_lease_reply_fds (xcb_connection_t *c /**< */, xcb_randr_create_lease_reply_t *reply); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_randr_free_lease_checked (xcb_connection_t *c, xcb_randr_lease_t lid, uint8_t terminate); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_randr_free_lease (xcb_connection_t *c, xcb_randr_lease_t lid, uint8_t terminate); /** * Get the next element of the iterator * @param i Pointer to a xcb_randr_lease_notify_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_randr_lease_notify_t) */ void xcb_randr_lease_notify_next (xcb_randr_lease_notify_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_randr_lease_notify_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_randr_lease_notify_end (xcb_randr_lease_notify_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_randr_notify_data_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_randr_notify_data_t) */ void xcb_randr_notify_data_next (xcb_randr_notify_data_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_randr_notify_data_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_randr_notify_data_end (xcb_randr_notify_data_iterator_t i); #ifdef __cplusplus } #endif #endif /** * @} */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/xv.h��������������������������������������������������������������������������������������������0000644�����������������00000160674�14763166026�0006157 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from xv.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_Xv_API XCB Xv API * @brief Xv XCB Protocol Implementation. * @{ **/ #ifndef __XV_H #define __XV_H #include "xcb.h" #include "xproto.h" #include "shm.h" #ifdef __cplusplus extern "C" { #endif #define XCB_XV_MAJOR_VERSION 2 #define XCB_XV_MINOR_VERSION 2 extern xcb_extension_t xcb_xv_id; typedef uint32_t xcb_xv_port_t; /** * @brief xcb_xv_port_iterator_t **/ typedef struct xcb_xv_port_iterator_t { xcb_xv_port_t *data; int rem; int index; } xcb_xv_port_iterator_t; typedef uint32_t xcb_xv_encoding_t; /** * @brief xcb_xv_encoding_iterator_t **/ typedef struct xcb_xv_encoding_iterator_t { xcb_xv_encoding_t *data; int rem; int index; } xcb_xv_encoding_iterator_t; typedef enum xcb_xv_type_t { XCB_XV_TYPE_INPUT_MASK = 1, XCB_XV_TYPE_OUTPUT_MASK = 2, XCB_XV_TYPE_VIDEO_MASK = 4, XCB_XV_TYPE_STILL_MASK = 8, XCB_XV_TYPE_IMAGE_MASK = 16 } xcb_xv_type_t; typedef enum xcb_xv_image_format_info_type_t { XCB_XV_IMAGE_FORMAT_INFO_TYPE_RGB = 0, XCB_XV_IMAGE_FORMAT_INFO_TYPE_YUV = 1 } xcb_xv_image_format_info_type_t; typedef enum xcb_xv_image_format_info_format_t { XCB_XV_IMAGE_FORMAT_INFO_FORMAT_PACKED = 0, XCB_XV_IMAGE_FORMAT_INFO_FORMAT_PLANAR = 1 } xcb_xv_image_format_info_format_t; typedef enum xcb_xv_attribute_flag_t { XCB_XV_ATTRIBUTE_FLAG_GETTABLE = 1, XCB_XV_ATTRIBUTE_FLAG_SETTABLE = 2 } xcb_xv_attribute_flag_t; typedef enum xcb_xv_video_notify_reason_t { XCB_XV_VIDEO_NOTIFY_REASON_STARTED = 0, XCB_XV_VIDEO_NOTIFY_REASON_STOPPED = 1, XCB_XV_VIDEO_NOTIFY_REASON_BUSY = 2, XCB_XV_VIDEO_NOTIFY_REASON_PREEMPTED = 3, XCB_XV_VIDEO_NOTIFY_REASON_HARD_ERROR = 4 } xcb_xv_video_notify_reason_t; typedef enum xcb_xv_scanline_order_t { XCB_XV_SCANLINE_ORDER_TOP_TO_BOTTOM = 0, XCB_XV_SCANLINE_ORDER_BOTTOM_TO_TOP = 1 } xcb_xv_scanline_order_t; typedef enum xcb_xv_grab_port_status_t { XCB_XV_GRAB_PORT_STATUS_SUCCESS = 0, XCB_XV_GRAB_PORT_STATUS_BAD_EXTENSION = 1, XCB_XV_GRAB_PORT_STATUS_ALREADY_GRABBED = 2, XCB_XV_GRAB_PORT_STATUS_INVALID_TIME = 3, XCB_XV_GRAB_PORT_STATUS_BAD_REPLY = 4, XCB_XV_GRAB_PORT_STATUS_BAD_ALLOC = 5 } xcb_xv_grab_port_status_t; /** * @brief xcb_xv_rational_t **/ typedef struct xcb_xv_rational_t { int32_t numerator; int32_t denominator; } xcb_xv_rational_t; /** * @brief xcb_xv_rational_iterator_t **/ typedef struct xcb_xv_rational_iterator_t { xcb_xv_rational_t *data; int rem; int index; } xcb_xv_rational_iterator_t; /** * @brief xcb_xv_format_t **/ typedef struct xcb_xv_format_t { xcb_visualid_t visual; uint8_t depth; uint8_t pad0[3]; } xcb_xv_format_t; /** * @brief xcb_xv_format_iterator_t **/ typedef struct xcb_xv_format_iterator_t { xcb_xv_format_t *data; int rem; int index; } xcb_xv_format_iterator_t; /** * @brief xcb_xv_adaptor_info_t **/ typedef struct xcb_xv_adaptor_info_t { xcb_xv_port_t base_id; uint16_t name_size; uint16_t num_ports; uint16_t num_formats; uint8_t type; uint8_t pad0; } xcb_xv_adaptor_info_t; /** * @brief xcb_xv_adaptor_info_iterator_t **/ typedef struct xcb_xv_adaptor_info_iterator_t { xcb_xv_adaptor_info_t *data; int rem; int index; } xcb_xv_adaptor_info_iterator_t; /** * @brief xcb_xv_encoding_info_t **/ typedef struct xcb_xv_encoding_info_t { xcb_xv_encoding_t encoding; uint16_t name_size; uint16_t width; uint16_t height; uint8_t pad0[2]; xcb_xv_rational_t rate; } xcb_xv_encoding_info_t; /** * @brief xcb_xv_encoding_info_iterator_t **/ typedef struct xcb_xv_encoding_info_iterator_t { xcb_xv_encoding_info_t *data; int rem; int index; } xcb_xv_encoding_info_iterator_t; /** * @brief xcb_xv_image_t **/ typedef struct xcb_xv_image_t { uint32_t id; uint16_t width; uint16_t height; uint32_t data_size; uint32_t num_planes; } xcb_xv_image_t; /** * @brief xcb_xv_image_iterator_t **/ typedef struct xcb_xv_image_iterator_t { xcb_xv_image_t *data; int rem; int index; } xcb_xv_image_iterator_t; /** * @brief xcb_xv_attribute_info_t **/ typedef struct xcb_xv_attribute_info_t { uint32_t flags; int32_t min; int32_t max; uint32_t size; } xcb_xv_attribute_info_t; /** * @brief xcb_xv_attribute_info_iterator_t **/ typedef struct xcb_xv_attribute_info_iterator_t { xcb_xv_attribute_info_t *data; int rem; int index; } xcb_xv_attribute_info_iterator_t; /** * @brief xcb_xv_image_format_info_t **/ typedef struct xcb_xv_image_format_info_t { uint32_t id; uint8_t type; uint8_t byte_order; uint8_t pad0[2]; uint8_t guid[16]; uint8_t bpp; uint8_t num_planes; uint8_t pad1[2]; uint8_t depth; uint8_t pad2[3]; uint32_t red_mask; uint32_t green_mask; uint32_t blue_mask; uint8_t format; uint8_t pad3[3]; uint32_t y_sample_bits; uint32_t u_sample_bits; uint32_t v_sample_bits; uint32_t vhorz_y_period; uint32_t vhorz_u_period; uint32_t vhorz_v_period; uint32_t vvert_y_period; uint32_t vvert_u_period; uint32_t vvert_v_period; uint8_t vcomp_order[32]; uint8_t vscanline_order; uint8_t pad4[11]; } xcb_xv_image_format_info_t; /** * @brief xcb_xv_image_format_info_iterator_t **/ typedef struct xcb_xv_image_format_info_iterator_t { xcb_xv_image_format_info_t *data; int rem; int index; } xcb_xv_image_format_info_iterator_t; /** Opcode for xcb_xv_bad_port. */ #define XCB_XV_BAD_PORT 0 /** * @brief xcb_xv_bad_port_error_t **/ typedef struct xcb_xv_bad_port_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_xv_bad_port_error_t; /** Opcode for xcb_xv_bad_encoding. */ #define XCB_XV_BAD_ENCODING 1 /** * @brief xcb_xv_bad_encoding_error_t **/ typedef struct xcb_xv_bad_encoding_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_xv_bad_encoding_error_t; /** Opcode for xcb_xv_bad_control. */ #define XCB_XV_BAD_CONTROL 2 /** * @brief xcb_xv_bad_control_error_t **/ typedef struct xcb_xv_bad_control_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_xv_bad_control_error_t; /** Opcode for xcb_xv_video_notify. */ #define XCB_XV_VIDEO_NOTIFY 0 /** * @brief xcb_xv_video_notify_event_t **/ typedef struct xcb_xv_video_notify_event_t { uint8_t response_type; uint8_t reason; uint16_t sequence; xcb_timestamp_t time; xcb_drawable_t drawable; xcb_xv_port_t port; } xcb_xv_video_notify_event_t; /** Opcode for xcb_xv_port_notify. */ #define XCB_XV_PORT_NOTIFY 1 /** * @brief xcb_xv_port_notify_event_t **/ typedef struct xcb_xv_port_notify_event_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; xcb_timestamp_t time; xcb_xv_port_t port; xcb_atom_t attribute; int32_t value; } xcb_xv_port_notify_event_t; /** * @brief xcb_xv_query_extension_cookie_t **/ typedef struct xcb_xv_query_extension_cookie_t { unsigned int sequence; } xcb_xv_query_extension_cookie_t; /** Opcode for xcb_xv_query_extension. */ #define XCB_XV_QUERY_EXTENSION 0 /** * @brief xcb_xv_query_extension_request_t **/ typedef struct xcb_xv_query_extension_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_xv_query_extension_request_t; /** * @brief xcb_xv_query_extension_reply_t **/ typedef struct xcb_xv_query_extension_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t major; uint16_t minor; } xcb_xv_query_extension_reply_t; /** * @brief xcb_xv_query_adaptors_cookie_t **/ typedef struct xcb_xv_query_adaptors_cookie_t { unsigned int sequence; } xcb_xv_query_adaptors_cookie_t; /** Opcode for xcb_xv_query_adaptors. */ #define XCB_XV_QUERY_ADAPTORS 1 /** * @brief xcb_xv_query_adaptors_request_t **/ typedef struct xcb_xv_query_adaptors_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_xv_query_adaptors_request_t; /** * @brief xcb_xv_query_adaptors_reply_t **/ typedef struct xcb_xv_query_adaptors_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t num_adaptors; uint8_t pad1[22]; } xcb_xv_query_adaptors_reply_t; /** * @brief xcb_xv_query_encodings_cookie_t **/ typedef struct xcb_xv_query_encodings_cookie_t { unsigned int sequence; } xcb_xv_query_encodings_cookie_t; /** Opcode for xcb_xv_query_encodings. */ #define XCB_XV_QUERY_ENCODINGS 2 /** * @brief xcb_xv_query_encodings_request_t **/ typedef struct xcb_xv_query_encodings_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xv_port_t port; } xcb_xv_query_encodings_request_t; /** * @brief xcb_xv_query_encodings_reply_t **/ typedef struct xcb_xv_query_encodings_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t num_encodings; uint8_t pad1[22]; } xcb_xv_query_encodings_reply_t; /** * @brief xcb_xv_grab_port_cookie_t **/ typedef struct xcb_xv_grab_port_cookie_t { unsigned int sequence; } xcb_xv_grab_port_cookie_t; /** Opcode for xcb_xv_grab_port. */ #define XCB_XV_GRAB_PORT 3 /** * @brief xcb_xv_grab_port_request_t **/ typedef struct xcb_xv_grab_port_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xv_port_t port; xcb_timestamp_t time; } xcb_xv_grab_port_request_t; /** * @brief xcb_xv_grab_port_reply_t **/ typedef struct xcb_xv_grab_port_reply_t { uint8_t response_type; uint8_t result; uint16_t sequence; uint32_t length; } xcb_xv_grab_port_reply_t; /** Opcode for xcb_xv_ungrab_port. */ #define XCB_XV_UNGRAB_PORT 4 /** * @brief xcb_xv_ungrab_port_request_t **/ typedef struct xcb_xv_ungrab_port_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xv_port_t port; xcb_timestamp_t time; } xcb_xv_ungrab_port_request_t; /** Opcode for xcb_xv_put_video. */ #define XCB_XV_PUT_VIDEO 5 /** * @brief xcb_xv_put_video_request_t **/ typedef struct xcb_xv_put_video_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xv_port_t port; xcb_drawable_t drawable; xcb_gcontext_t gc; int16_t vid_x; int16_t vid_y; uint16_t vid_w; uint16_t vid_h; int16_t drw_x; int16_t drw_y; uint16_t drw_w; uint16_t drw_h; } xcb_xv_put_video_request_t; /** Opcode for xcb_xv_put_still. */ #define XCB_XV_PUT_STILL 6 /** * @brief xcb_xv_put_still_request_t **/ typedef struct xcb_xv_put_still_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xv_port_t port; xcb_drawable_t drawable; xcb_gcontext_t gc; int16_t vid_x; int16_t vid_y; uint16_t vid_w; uint16_t vid_h; int16_t drw_x; int16_t drw_y; uint16_t drw_w; uint16_t drw_h; } xcb_xv_put_still_request_t; /** Opcode for xcb_xv_get_video. */ #define XCB_XV_GET_VIDEO 7 /** * @brief xcb_xv_get_video_request_t **/ typedef struct xcb_xv_get_video_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xv_port_t port; xcb_drawable_t drawable; xcb_gcontext_t gc; int16_t vid_x; int16_t vid_y; uint16_t vid_w; uint16_t vid_h; int16_t drw_x; int16_t drw_y; uint16_t drw_w; uint16_t drw_h; } xcb_xv_get_video_request_t; /** Opcode for xcb_xv_get_still. */ #define XCB_XV_GET_STILL 8 /** * @brief xcb_xv_get_still_request_t **/ typedef struct xcb_xv_get_still_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xv_port_t port; xcb_drawable_t drawable; xcb_gcontext_t gc; int16_t vid_x; int16_t vid_y; uint16_t vid_w; uint16_t vid_h; int16_t drw_x; int16_t drw_y; uint16_t drw_w; uint16_t drw_h; } xcb_xv_get_still_request_t; /** Opcode for xcb_xv_stop_video. */ #define XCB_XV_STOP_VIDEO 9 /** * @brief xcb_xv_stop_video_request_t **/ typedef struct xcb_xv_stop_video_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xv_port_t port; xcb_drawable_t drawable; } xcb_xv_stop_video_request_t; /** Opcode for xcb_xv_select_video_notify. */ #define XCB_XV_SELECT_VIDEO_NOTIFY 10 /** * @brief xcb_xv_select_video_notify_request_t **/ typedef struct xcb_xv_select_video_notify_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; uint8_t onoff; uint8_t pad0[3]; } xcb_xv_select_video_notify_request_t; /** Opcode for xcb_xv_select_port_notify. */ #define XCB_XV_SELECT_PORT_NOTIFY 11 /** * @brief xcb_xv_select_port_notify_request_t **/ typedef struct xcb_xv_select_port_notify_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xv_port_t port; uint8_t onoff; uint8_t pad0[3]; } xcb_xv_select_port_notify_request_t; /** * @brief xcb_xv_query_best_size_cookie_t **/ typedef struct xcb_xv_query_best_size_cookie_t { unsigned int sequence; } xcb_xv_query_best_size_cookie_t; /** Opcode for xcb_xv_query_best_size. */ #define XCB_XV_QUERY_BEST_SIZE 12 /** * @brief xcb_xv_query_best_size_request_t **/ typedef struct xcb_xv_query_best_size_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xv_port_t port; uint16_t vid_w; uint16_t vid_h; uint16_t drw_w; uint16_t drw_h; uint8_t motion; uint8_t pad0[3]; } xcb_xv_query_best_size_request_t; /** * @brief xcb_xv_query_best_size_reply_t **/ typedef struct xcb_xv_query_best_size_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t actual_width; uint16_t actual_height; } xcb_xv_query_best_size_reply_t; /** Opcode for xcb_xv_set_port_attribute. */ #define XCB_XV_SET_PORT_ATTRIBUTE 13 /** * @brief xcb_xv_set_port_attribute_request_t **/ typedef struct xcb_xv_set_port_attribute_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xv_port_t port; xcb_atom_t attribute; int32_t value; } xcb_xv_set_port_attribute_request_t; /** * @brief xcb_xv_get_port_attribute_cookie_t **/ typedef struct xcb_xv_get_port_attribute_cookie_t { unsigned int sequence; } xcb_xv_get_port_attribute_cookie_t; /** Opcode for xcb_xv_get_port_attribute. */ #define XCB_XV_GET_PORT_ATTRIBUTE 14 /** * @brief xcb_xv_get_port_attribute_request_t **/ typedef struct xcb_xv_get_port_attribute_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xv_port_t port; xcb_atom_t attribute; } xcb_xv_get_port_attribute_request_t; /** * @brief xcb_xv_get_port_attribute_reply_t **/ typedef struct xcb_xv_get_port_attribute_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; int32_t value; } xcb_xv_get_port_attribute_reply_t; /** * @brief xcb_xv_query_port_attributes_cookie_t **/ typedef struct xcb_xv_query_port_attributes_cookie_t { unsigned int sequence; } xcb_xv_query_port_attributes_cookie_t; /** Opcode for xcb_xv_query_port_attributes. */ #define XCB_XV_QUERY_PORT_ATTRIBUTES 15 /** * @brief xcb_xv_query_port_attributes_request_t **/ typedef struct xcb_xv_query_port_attributes_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xv_port_t port; } xcb_xv_query_port_attributes_request_t; /** * @brief xcb_xv_query_port_attributes_reply_t **/ typedef struct xcb_xv_query_port_attributes_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t num_attributes; uint32_t text_size; uint8_t pad1[16]; } xcb_xv_query_port_attributes_reply_t; /** * @brief xcb_xv_list_image_formats_cookie_t **/ typedef struct xcb_xv_list_image_formats_cookie_t { unsigned int sequence; } xcb_xv_list_image_formats_cookie_t; /** Opcode for xcb_xv_list_image_formats. */ #define XCB_XV_LIST_IMAGE_FORMATS 16 /** * @brief xcb_xv_list_image_formats_request_t **/ typedef struct xcb_xv_list_image_formats_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xv_port_t port; } xcb_xv_list_image_formats_request_t; /** * @brief xcb_xv_list_image_formats_reply_t **/ typedef struct xcb_xv_list_image_formats_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t num_formats; uint8_t pad1[20]; } xcb_xv_list_image_formats_reply_t; /** * @brief xcb_xv_query_image_attributes_cookie_t **/ typedef struct xcb_xv_query_image_attributes_cookie_t { unsigned int sequence; } xcb_xv_query_image_attributes_cookie_t; /** Opcode for xcb_xv_query_image_attributes. */ #define XCB_XV_QUERY_IMAGE_ATTRIBUTES 17 /** * @brief xcb_xv_query_image_attributes_request_t **/ typedef struct xcb_xv_query_image_attributes_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xv_port_t port; uint32_t id; uint16_t width; uint16_t height; } xcb_xv_query_image_attributes_request_t; /** * @brief xcb_xv_query_image_attributes_reply_t **/ typedef struct xcb_xv_query_image_attributes_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t num_planes; uint32_t data_size; uint16_t width; uint16_t height; uint8_t pad1[12]; } xcb_xv_query_image_attributes_reply_t; /** Opcode for xcb_xv_put_image. */ #define XCB_XV_PUT_IMAGE 18 /** * @brief xcb_xv_put_image_request_t **/ typedef struct xcb_xv_put_image_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xv_port_t port; xcb_drawable_t drawable; xcb_gcontext_t gc; uint32_t id; int16_t src_x; int16_t src_y; uint16_t src_w; uint16_t src_h; int16_t drw_x; int16_t drw_y; uint16_t drw_w; uint16_t drw_h; uint16_t width; uint16_t height; } xcb_xv_put_image_request_t; /** Opcode for xcb_xv_shm_put_image. */ #define XCB_XV_SHM_PUT_IMAGE 19 /** * @brief xcb_xv_shm_put_image_request_t **/ typedef struct xcb_xv_shm_put_image_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_xv_port_t port; xcb_drawable_t drawable; xcb_gcontext_t gc; xcb_shm_seg_t shmseg; uint32_t id; uint32_t offset; int16_t src_x; int16_t src_y; uint16_t src_w; uint16_t src_h; int16_t drw_x; int16_t drw_y; uint16_t drw_w; uint16_t drw_h; uint16_t width; uint16_t height; uint8_t send_event; uint8_t pad0[3]; } xcb_xv_shm_put_image_request_t; /** * Get the next element of the iterator * @param i Pointer to a xcb_xv_port_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xv_port_t) */ void xcb_xv_port_next (xcb_xv_port_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xv_port_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xv_port_end (xcb_xv_port_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xv_encoding_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xv_encoding_t) */ void xcb_xv_encoding_next (xcb_xv_encoding_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xv_encoding_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xv_encoding_end (xcb_xv_encoding_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xv_rational_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xv_rational_t) */ void xcb_xv_rational_next (xcb_xv_rational_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xv_rational_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xv_rational_end (xcb_xv_rational_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xv_format_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xv_format_t) */ void xcb_xv_format_next (xcb_xv_format_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xv_format_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xv_format_end (xcb_xv_format_iterator_t i); int xcb_xv_adaptor_info_sizeof (const void *_buffer); char * xcb_xv_adaptor_info_name (const xcb_xv_adaptor_info_t *R); int xcb_xv_adaptor_info_name_length (const xcb_xv_adaptor_info_t *R); xcb_generic_iterator_t xcb_xv_adaptor_info_name_end (const xcb_xv_adaptor_info_t *R); xcb_xv_format_t * xcb_xv_adaptor_info_formats (const xcb_xv_adaptor_info_t *R); int xcb_xv_adaptor_info_formats_length (const xcb_xv_adaptor_info_t *R); xcb_xv_format_iterator_t xcb_xv_adaptor_info_formats_iterator (const xcb_xv_adaptor_info_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_xv_adaptor_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xv_adaptor_info_t) */ void xcb_xv_adaptor_info_next (xcb_xv_adaptor_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xv_adaptor_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xv_adaptor_info_end (xcb_xv_adaptor_info_iterator_t i); int xcb_xv_encoding_info_sizeof (const void *_buffer); char * xcb_xv_encoding_info_name (const xcb_xv_encoding_info_t *R); int xcb_xv_encoding_info_name_length (const xcb_xv_encoding_info_t *R); xcb_generic_iterator_t xcb_xv_encoding_info_name_end (const xcb_xv_encoding_info_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_xv_encoding_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xv_encoding_info_t) */ void xcb_xv_encoding_info_next (xcb_xv_encoding_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xv_encoding_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xv_encoding_info_end (xcb_xv_encoding_info_iterator_t i); int xcb_xv_image_sizeof (const void *_buffer); uint32_t * xcb_xv_image_pitches (const xcb_xv_image_t *R); int xcb_xv_image_pitches_length (const xcb_xv_image_t *R); xcb_generic_iterator_t xcb_xv_image_pitches_end (const xcb_xv_image_t *R); uint32_t * xcb_xv_image_offsets (const xcb_xv_image_t *R); int xcb_xv_image_offsets_length (const xcb_xv_image_t *R); xcb_generic_iterator_t xcb_xv_image_offsets_end (const xcb_xv_image_t *R); uint8_t * xcb_xv_image_data (const xcb_xv_image_t *R); int xcb_xv_image_data_length (const xcb_xv_image_t *R); xcb_generic_iterator_t xcb_xv_image_data_end (const xcb_xv_image_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_xv_image_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xv_image_t) */ void xcb_xv_image_next (xcb_xv_image_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xv_image_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xv_image_end (xcb_xv_image_iterator_t i); int xcb_xv_attribute_info_sizeof (const void *_buffer); char * xcb_xv_attribute_info_name (const xcb_xv_attribute_info_t *R); int xcb_xv_attribute_info_name_length (const xcb_xv_attribute_info_t *R); xcb_generic_iterator_t xcb_xv_attribute_info_name_end (const xcb_xv_attribute_info_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_xv_attribute_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xv_attribute_info_t) */ void xcb_xv_attribute_info_next (xcb_xv_attribute_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xv_attribute_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xv_attribute_info_end (xcb_xv_attribute_info_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_xv_image_format_info_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_xv_image_format_info_t) */ void xcb_xv_image_format_info_next (xcb_xv_image_format_info_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_xv_image_format_info_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_xv_image_format_info_end (xcb_xv_image_format_info_iterator_t i); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xv_query_extension_cookie_t xcb_xv_query_extension (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xv_query_extension_cookie_t xcb_xv_query_extension_unchecked (xcb_connection_t *c); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xv_query_extension_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xv_query_extension_reply_t * xcb_xv_query_extension_reply (xcb_connection_t *c, xcb_xv_query_extension_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xv_query_adaptors_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xv_query_adaptors_cookie_t xcb_xv_query_adaptors (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xv_query_adaptors_cookie_t xcb_xv_query_adaptors_unchecked (xcb_connection_t *c, xcb_window_t window); int xcb_xv_query_adaptors_info_length (const xcb_xv_query_adaptors_reply_t *R); xcb_xv_adaptor_info_iterator_t xcb_xv_query_adaptors_info_iterator (const xcb_xv_query_adaptors_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xv_query_adaptors_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xv_query_adaptors_reply_t * xcb_xv_query_adaptors_reply (xcb_connection_t *c, xcb_xv_query_adaptors_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xv_query_encodings_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xv_query_encodings_cookie_t xcb_xv_query_encodings (xcb_connection_t *c, xcb_xv_port_t port); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xv_query_encodings_cookie_t xcb_xv_query_encodings_unchecked (xcb_connection_t *c, xcb_xv_port_t port); int xcb_xv_query_encodings_info_length (const xcb_xv_query_encodings_reply_t *R); xcb_xv_encoding_info_iterator_t xcb_xv_query_encodings_info_iterator (const xcb_xv_query_encodings_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xv_query_encodings_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xv_query_encodings_reply_t * xcb_xv_query_encodings_reply (xcb_connection_t *c, xcb_xv_query_encodings_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xv_grab_port_cookie_t xcb_xv_grab_port (xcb_connection_t *c, xcb_xv_port_t port, xcb_timestamp_t time); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xv_grab_port_cookie_t xcb_xv_grab_port_unchecked (xcb_connection_t *c, xcb_xv_port_t port, xcb_timestamp_t time); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xv_grab_port_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xv_grab_port_reply_t * xcb_xv_grab_port_reply (xcb_connection_t *c, xcb_xv_grab_port_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xv_ungrab_port_checked (xcb_connection_t *c, xcb_xv_port_t port, xcb_timestamp_t time); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xv_ungrab_port (xcb_connection_t *c, xcb_xv_port_t port, xcb_timestamp_t time); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xv_put_video_checked (xcb_connection_t *c, xcb_xv_port_t port, xcb_drawable_t drawable, xcb_gcontext_t gc, int16_t vid_x, int16_t vid_y, uint16_t vid_w, uint16_t vid_h, int16_t drw_x, int16_t drw_y, uint16_t drw_w, uint16_t drw_h); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xv_put_video (xcb_connection_t *c, xcb_xv_port_t port, xcb_drawable_t drawable, xcb_gcontext_t gc, int16_t vid_x, int16_t vid_y, uint16_t vid_w, uint16_t vid_h, int16_t drw_x, int16_t drw_y, uint16_t drw_w, uint16_t drw_h); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xv_put_still_checked (xcb_connection_t *c, xcb_xv_port_t port, xcb_drawable_t drawable, xcb_gcontext_t gc, int16_t vid_x, int16_t vid_y, uint16_t vid_w, uint16_t vid_h, int16_t drw_x, int16_t drw_y, uint16_t drw_w, uint16_t drw_h); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xv_put_still (xcb_connection_t *c, xcb_xv_port_t port, xcb_drawable_t drawable, xcb_gcontext_t gc, int16_t vid_x, int16_t vid_y, uint16_t vid_w, uint16_t vid_h, int16_t drw_x, int16_t drw_y, uint16_t drw_w, uint16_t drw_h); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xv_get_video_checked (xcb_connection_t *c, xcb_xv_port_t port, xcb_drawable_t drawable, xcb_gcontext_t gc, int16_t vid_x, int16_t vid_y, uint16_t vid_w, uint16_t vid_h, int16_t drw_x, int16_t drw_y, uint16_t drw_w, uint16_t drw_h); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xv_get_video (xcb_connection_t *c, xcb_xv_port_t port, xcb_drawable_t drawable, xcb_gcontext_t gc, int16_t vid_x, int16_t vid_y, uint16_t vid_w, uint16_t vid_h, int16_t drw_x, int16_t drw_y, uint16_t drw_w, uint16_t drw_h); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xv_get_still_checked (xcb_connection_t *c, xcb_xv_port_t port, xcb_drawable_t drawable, xcb_gcontext_t gc, int16_t vid_x, int16_t vid_y, uint16_t vid_w, uint16_t vid_h, int16_t drw_x, int16_t drw_y, uint16_t drw_w, uint16_t drw_h); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xv_get_still (xcb_connection_t *c, xcb_xv_port_t port, xcb_drawable_t drawable, xcb_gcontext_t gc, int16_t vid_x, int16_t vid_y, uint16_t vid_w, uint16_t vid_h, int16_t drw_x, int16_t drw_y, uint16_t drw_w, uint16_t drw_h); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xv_stop_video_checked (xcb_connection_t *c, xcb_xv_port_t port, xcb_drawable_t drawable); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xv_stop_video (xcb_connection_t *c, xcb_xv_port_t port, xcb_drawable_t drawable); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xv_select_video_notify_checked (xcb_connection_t *c, xcb_drawable_t drawable, uint8_t onoff); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xv_select_video_notify (xcb_connection_t *c, xcb_drawable_t drawable, uint8_t onoff); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xv_select_port_notify_checked (xcb_connection_t *c, xcb_xv_port_t port, uint8_t onoff); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xv_select_port_notify (xcb_connection_t *c, xcb_xv_port_t port, uint8_t onoff); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xv_query_best_size_cookie_t xcb_xv_query_best_size (xcb_connection_t *c, xcb_xv_port_t port, uint16_t vid_w, uint16_t vid_h, uint16_t drw_w, uint16_t drw_h, uint8_t motion); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xv_query_best_size_cookie_t xcb_xv_query_best_size_unchecked (xcb_connection_t *c, xcb_xv_port_t port, uint16_t vid_w, uint16_t vid_h, uint16_t drw_w, uint16_t drw_h, uint8_t motion); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xv_query_best_size_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xv_query_best_size_reply_t * xcb_xv_query_best_size_reply (xcb_connection_t *c, xcb_xv_query_best_size_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xv_set_port_attribute_checked (xcb_connection_t *c, xcb_xv_port_t port, xcb_atom_t attribute, int32_t value); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xv_set_port_attribute (xcb_connection_t *c, xcb_xv_port_t port, xcb_atom_t attribute, int32_t value); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xv_get_port_attribute_cookie_t xcb_xv_get_port_attribute (xcb_connection_t *c, xcb_xv_port_t port, xcb_atom_t attribute); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xv_get_port_attribute_cookie_t xcb_xv_get_port_attribute_unchecked (xcb_connection_t *c, xcb_xv_port_t port, xcb_atom_t attribute); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xv_get_port_attribute_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xv_get_port_attribute_reply_t * xcb_xv_get_port_attribute_reply (xcb_connection_t *c, xcb_xv_get_port_attribute_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xv_query_port_attributes_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xv_query_port_attributes_cookie_t xcb_xv_query_port_attributes (xcb_connection_t *c, xcb_xv_port_t port); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xv_query_port_attributes_cookie_t xcb_xv_query_port_attributes_unchecked (xcb_connection_t *c, xcb_xv_port_t port); int xcb_xv_query_port_attributes_attributes_length (const xcb_xv_query_port_attributes_reply_t *R); xcb_xv_attribute_info_iterator_t xcb_xv_query_port_attributes_attributes_iterator (const xcb_xv_query_port_attributes_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xv_query_port_attributes_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xv_query_port_attributes_reply_t * xcb_xv_query_port_attributes_reply (xcb_connection_t *c, xcb_xv_query_port_attributes_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xv_list_image_formats_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xv_list_image_formats_cookie_t xcb_xv_list_image_formats (xcb_connection_t *c, xcb_xv_port_t port); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xv_list_image_formats_cookie_t xcb_xv_list_image_formats_unchecked (xcb_connection_t *c, xcb_xv_port_t port); xcb_xv_image_format_info_t * xcb_xv_list_image_formats_format (const xcb_xv_list_image_formats_reply_t *R); int xcb_xv_list_image_formats_format_length (const xcb_xv_list_image_formats_reply_t *R); xcb_xv_image_format_info_iterator_t xcb_xv_list_image_formats_format_iterator (const xcb_xv_list_image_formats_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xv_list_image_formats_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xv_list_image_formats_reply_t * xcb_xv_list_image_formats_reply (xcb_connection_t *c, xcb_xv_list_image_formats_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xv_query_image_attributes_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_xv_query_image_attributes_cookie_t xcb_xv_query_image_attributes (xcb_connection_t *c, xcb_xv_port_t port, uint32_t id, uint16_t width, uint16_t height); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_xv_query_image_attributes_cookie_t xcb_xv_query_image_attributes_unchecked (xcb_connection_t *c, xcb_xv_port_t port, uint32_t id, uint16_t width, uint16_t height); uint32_t * xcb_xv_query_image_attributes_pitches (const xcb_xv_query_image_attributes_reply_t *R); int xcb_xv_query_image_attributes_pitches_length (const xcb_xv_query_image_attributes_reply_t *R); xcb_generic_iterator_t xcb_xv_query_image_attributes_pitches_end (const xcb_xv_query_image_attributes_reply_t *R); uint32_t * xcb_xv_query_image_attributes_offsets (const xcb_xv_query_image_attributes_reply_t *R); int xcb_xv_query_image_attributes_offsets_length (const xcb_xv_query_image_attributes_reply_t *R); xcb_generic_iterator_t xcb_xv_query_image_attributes_offsets_end (const xcb_xv_query_image_attributes_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_xv_query_image_attributes_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_xv_query_image_attributes_reply_t * xcb_xv_query_image_attributes_reply (xcb_connection_t *c, xcb_xv_query_image_attributes_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_xv_put_image_sizeof (const void *_buffer, uint32_t data_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xv_put_image_checked (xcb_connection_t *c, xcb_xv_port_t port, xcb_drawable_t drawable, xcb_gcontext_t gc, uint32_t id, int16_t src_x, int16_t src_y, uint16_t src_w, uint16_t src_h, int16_t drw_x, int16_t drw_y, uint16_t drw_w, uint16_t drw_h, uint16_t width, uint16_t height, uint32_t data_len, const uint8_t *data); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xv_put_image (xcb_connection_t *c, xcb_xv_port_t port, xcb_drawable_t drawable, xcb_gcontext_t gc, uint32_t id, int16_t src_x, int16_t src_y, uint16_t src_w, uint16_t src_h, int16_t drw_x, int16_t drw_y, uint16_t drw_w, uint16_t drw_h, uint16_t width, uint16_t height, uint32_t data_len, const uint8_t *data); uint8_t * xcb_xv_put_image_data (const xcb_xv_put_image_request_t *R); int xcb_xv_put_image_data_length (const xcb_xv_put_image_request_t *R); xcb_generic_iterator_t xcb_xv_put_image_data_end (const xcb_xv_put_image_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_xv_shm_put_image_checked (xcb_connection_t *c, xcb_xv_port_t port, xcb_drawable_t drawable, xcb_gcontext_t gc, xcb_shm_seg_t shmseg, uint32_t id, uint32_t offset, int16_t src_x, int16_t src_y, uint16_t src_w, uint16_t src_h, int16_t drw_x, int16_t drw_y, uint16_t drw_w, uint16_t drw_h, uint16_t width, uint16_t height, uint8_t send_event); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_xv_shm_put_image (xcb_connection_t *c, xcb_xv_port_t port, xcb_drawable_t drawable, xcb_gcontext_t gc, xcb_shm_seg_t shmseg, uint32_t id, uint32_t offset, int16_t src_x, int16_t src_y, uint16_t src_w, uint16_t src_h, int16_t drw_x, int16_t drw_y, uint16_t drw_w, uint16_t drw_h, uint16_t width, uint16_t height, uint8_t send_event); #ifdef __cplusplus } #endif #endif /** * @} */ ��������������������������������������������������������������������xcb/xprint.h����������������������������������������������������������������������������������������0000644�����������������00000157543�14763166026�0007047 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from xprint.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_XPrint_API XCB XPrint API * @brief XPrint XCB Protocol Implementation. * @{ **/ #ifndef __XPRINT_H #define __XPRINT_H #include "xcb.h" #include "xproto.h" #ifdef __cplusplus extern "C" { #endif #define XCB_XPRINT_MAJOR_VERSION 1 #define XCB_XPRINT_MINOR_VERSION 0 extern xcb_extension_t xcb_x_print_id; typedef char xcb_x_print_string8_t; /** * @brief xcb_x_print_string8_iterator_t **/ typedef struct xcb_x_print_string8_iterator_t { xcb_x_print_string8_t *data; int rem; int index; } xcb_x_print_string8_iterator_t; /** * @brief xcb_x_print_printer_t **/ typedef struct xcb_x_print_printer_t { uint32_t nameLen; uint32_t descLen; } xcb_x_print_printer_t; /** * @brief xcb_x_print_printer_iterator_t **/ typedef struct xcb_x_print_printer_iterator_t { xcb_x_print_printer_t *data; int rem; int index; } xcb_x_print_printer_iterator_t; typedef uint32_t xcb_x_print_pcontext_t; /** * @brief xcb_x_print_pcontext_iterator_t **/ typedef struct xcb_x_print_pcontext_iterator_t { xcb_x_print_pcontext_t *data; int rem; int index; } xcb_x_print_pcontext_iterator_t; typedef enum xcb_x_print_get_doc_t { XCB_X_PRINT_GET_DOC_FINISHED = 0, XCB_X_PRINT_GET_DOC_SECOND_CONSUMER = 1 } xcb_x_print_get_doc_t; typedef enum xcb_x_print_ev_mask_t { XCB_X_PRINT_EV_MASK_NO_EVENT_MASK = 0, XCB_X_PRINT_EV_MASK_PRINT_MASK = 1, XCB_X_PRINT_EV_MASK_ATTRIBUTE_MASK = 2 } xcb_x_print_ev_mask_t; typedef enum xcb_x_print_detail_t { XCB_X_PRINT_DETAIL_START_JOB_NOTIFY = 1, XCB_X_PRINT_DETAIL_END_JOB_NOTIFY = 2, XCB_X_PRINT_DETAIL_START_DOC_NOTIFY = 3, XCB_X_PRINT_DETAIL_END_DOC_NOTIFY = 4, XCB_X_PRINT_DETAIL_START_PAGE_NOTIFY = 5, XCB_X_PRINT_DETAIL_END_PAGE_NOTIFY = 6 } xcb_x_print_detail_t; typedef enum xcb_x_print_attr_t { XCB_X_PRINT_ATTR_JOB_ATTR = 1, XCB_X_PRINT_ATTR_DOC_ATTR = 2, XCB_X_PRINT_ATTR_PAGE_ATTR = 3, XCB_X_PRINT_ATTR_PRINTER_ATTR = 4, XCB_X_PRINT_ATTR_SERVER_ATTR = 5, XCB_X_PRINT_ATTR_MEDIUM_ATTR = 6, XCB_X_PRINT_ATTR_SPOOLER_ATTR = 7 } xcb_x_print_attr_t; /** * @brief xcb_x_print_print_query_version_cookie_t **/ typedef struct xcb_x_print_print_query_version_cookie_t { unsigned int sequence; } xcb_x_print_print_query_version_cookie_t; /** Opcode for xcb_x_print_print_query_version. */ #define XCB_X_PRINT_PRINT_QUERY_VERSION 0 /** * @brief xcb_x_print_print_query_version_request_t **/ typedef struct xcb_x_print_print_query_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_x_print_print_query_version_request_t; /** * @brief xcb_x_print_print_query_version_reply_t **/ typedef struct xcb_x_print_print_query_version_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t major_version; uint16_t minor_version; } xcb_x_print_print_query_version_reply_t; /** * @brief xcb_x_print_print_get_printer_list_cookie_t **/ typedef struct xcb_x_print_print_get_printer_list_cookie_t { unsigned int sequence; } xcb_x_print_print_get_printer_list_cookie_t; /** Opcode for xcb_x_print_print_get_printer_list. */ #define XCB_X_PRINT_PRINT_GET_PRINTER_LIST 1 /** * @brief xcb_x_print_print_get_printer_list_request_t **/ typedef struct xcb_x_print_print_get_printer_list_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t printerNameLen; uint32_t localeLen; } xcb_x_print_print_get_printer_list_request_t; /** * @brief xcb_x_print_print_get_printer_list_reply_t **/ typedef struct xcb_x_print_print_get_printer_list_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t listCount; uint8_t pad1[20]; } xcb_x_print_print_get_printer_list_reply_t; /** Opcode for xcb_x_print_print_rehash_printer_list. */ #define XCB_X_PRINT_PRINT_REHASH_PRINTER_LIST 20 /** * @brief xcb_x_print_print_rehash_printer_list_request_t **/ typedef struct xcb_x_print_print_rehash_printer_list_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_x_print_print_rehash_printer_list_request_t; /** Opcode for xcb_x_print_create_context. */ #define XCB_X_PRINT_CREATE_CONTEXT 2 /** * @brief xcb_x_print_create_context_request_t **/ typedef struct xcb_x_print_create_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t context_id; uint32_t printerNameLen; uint32_t localeLen; } xcb_x_print_create_context_request_t; /** Opcode for xcb_x_print_print_set_context. */ #define XCB_X_PRINT_PRINT_SET_CONTEXT 3 /** * @brief xcb_x_print_print_set_context_request_t **/ typedef struct xcb_x_print_print_set_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t context; } xcb_x_print_print_set_context_request_t; /** * @brief xcb_x_print_print_get_context_cookie_t **/ typedef struct xcb_x_print_print_get_context_cookie_t { unsigned int sequence; } xcb_x_print_print_get_context_cookie_t; /** Opcode for xcb_x_print_print_get_context. */ #define XCB_X_PRINT_PRINT_GET_CONTEXT 4 /** * @brief xcb_x_print_print_get_context_request_t **/ typedef struct xcb_x_print_print_get_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_x_print_print_get_context_request_t; /** * @brief xcb_x_print_print_get_context_reply_t **/ typedef struct xcb_x_print_print_get_context_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t context; } xcb_x_print_print_get_context_reply_t; /** Opcode for xcb_x_print_print_destroy_context. */ #define XCB_X_PRINT_PRINT_DESTROY_CONTEXT 5 /** * @brief xcb_x_print_print_destroy_context_request_t **/ typedef struct xcb_x_print_print_destroy_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint32_t context; } xcb_x_print_print_destroy_context_request_t; /** * @brief xcb_x_print_print_get_screen_of_context_cookie_t **/ typedef struct xcb_x_print_print_get_screen_of_context_cookie_t { unsigned int sequence; } xcb_x_print_print_get_screen_of_context_cookie_t; /** Opcode for xcb_x_print_print_get_screen_of_context. */ #define XCB_X_PRINT_PRINT_GET_SCREEN_OF_CONTEXT 6 /** * @brief xcb_x_print_print_get_screen_of_context_request_t **/ typedef struct xcb_x_print_print_get_screen_of_context_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_x_print_print_get_screen_of_context_request_t; /** * @brief xcb_x_print_print_get_screen_of_context_reply_t **/ typedef struct xcb_x_print_print_get_screen_of_context_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; xcb_window_t root; } xcb_x_print_print_get_screen_of_context_reply_t; /** Opcode for xcb_x_print_print_start_job. */ #define XCB_X_PRINT_PRINT_START_JOB 7 /** * @brief xcb_x_print_print_start_job_request_t **/ typedef struct xcb_x_print_print_start_job_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t output_mode; } xcb_x_print_print_start_job_request_t; /** Opcode for xcb_x_print_print_end_job. */ #define XCB_X_PRINT_PRINT_END_JOB 8 /** * @brief xcb_x_print_print_end_job_request_t **/ typedef struct xcb_x_print_print_end_job_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t cancel; } xcb_x_print_print_end_job_request_t; /** Opcode for xcb_x_print_print_start_doc. */ #define XCB_X_PRINT_PRINT_START_DOC 9 /** * @brief xcb_x_print_print_start_doc_request_t **/ typedef struct xcb_x_print_print_start_doc_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t driver_mode; } xcb_x_print_print_start_doc_request_t; /** Opcode for xcb_x_print_print_end_doc. */ #define XCB_X_PRINT_PRINT_END_DOC 10 /** * @brief xcb_x_print_print_end_doc_request_t **/ typedef struct xcb_x_print_print_end_doc_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t cancel; } xcb_x_print_print_end_doc_request_t; /** Opcode for xcb_x_print_print_put_document_data. */ #define XCB_X_PRINT_PRINT_PUT_DOCUMENT_DATA 11 /** * @brief xcb_x_print_print_put_document_data_request_t **/ typedef struct xcb_x_print_print_put_document_data_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_drawable_t drawable; uint32_t len_data; uint16_t len_fmt; uint16_t len_options; } xcb_x_print_print_put_document_data_request_t; /** * @brief xcb_x_print_print_get_document_data_cookie_t **/ typedef struct xcb_x_print_print_get_document_data_cookie_t { unsigned int sequence; } xcb_x_print_print_get_document_data_cookie_t; /** Opcode for xcb_x_print_print_get_document_data. */ #define XCB_X_PRINT_PRINT_GET_DOCUMENT_DATA 12 /** * @brief xcb_x_print_print_get_document_data_request_t **/ typedef struct xcb_x_print_print_get_document_data_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_x_print_pcontext_t context; uint32_t max_bytes; } xcb_x_print_print_get_document_data_request_t; /** * @brief xcb_x_print_print_get_document_data_reply_t **/ typedef struct xcb_x_print_print_get_document_data_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t status_code; uint32_t finished_flag; uint32_t dataLen; uint8_t pad1[12]; } xcb_x_print_print_get_document_data_reply_t; /** Opcode for xcb_x_print_print_start_page. */ #define XCB_X_PRINT_PRINT_START_PAGE 13 /** * @brief xcb_x_print_print_start_page_request_t **/ typedef struct xcb_x_print_print_start_page_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; } xcb_x_print_print_start_page_request_t; /** Opcode for xcb_x_print_print_end_page. */ #define XCB_X_PRINT_PRINT_END_PAGE 14 /** * @brief xcb_x_print_print_end_page_request_t **/ typedef struct xcb_x_print_print_end_page_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t cancel; uint8_t pad0[3]; } xcb_x_print_print_end_page_request_t; /** Opcode for xcb_x_print_print_select_input. */ #define XCB_X_PRINT_PRINT_SELECT_INPUT 15 /** * @brief xcb_x_print_print_select_input_request_t **/ typedef struct xcb_x_print_print_select_input_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_x_print_pcontext_t context; uint32_t event_mask; } xcb_x_print_print_select_input_request_t; /** * @brief xcb_x_print_print_input_selected_cookie_t **/ typedef struct xcb_x_print_print_input_selected_cookie_t { unsigned int sequence; } xcb_x_print_print_input_selected_cookie_t; /** Opcode for xcb_x_print_print_input_selected. */ #define XCB_X_PRINT_PRINT_INPUT_SELECTED 16 /** * @brief xcb_x_print_print_input_selected_request_t **/ typedef struct xcb_x_print_print_input_selected_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_x_print_pcontext_t context; } xcb_x_print_print_input_selected_request_t; /** * @brief xcb_x_print_print_input_selected_reply_t **/ typedef struct xcb_x_print_print_input_selected_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t event_mask; uint32_t all_events_mask; } xcb_x_print_print_input_selected_reply_t; /** * @brief xcb_x_print_print_get_attributes_cookie_t **/ typedef struct xcb_x_print_print_get_attributes_cookie_t { unsigned int sequence; } xcb_x_print_print_get_attributes_cookie_t; /** Opcode for xcb_x_print_print_get_attributes. */ #define XCB_X_PRINT_PRINT_GET_ATTRIBUTES 17 /** * @brief xcb_x_print_print_get_attributes_request_t **/ typedef struct xcb_x_print_print_get_attributes_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_x_print_pcontext_t context; uint8_t pool; uint8_t pad0[3]; } xcb_x_print_print_get_attributes_request_t; /** * @brief xcb_x_print_print_get_attributes_reply_t **/ typedef struct xcb_x_print_print_get_attributes_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t stringLen; uint8_t pad1[20]; } xcb_x_print_print_get_attributes_reply_t; /** * @brief xcb_x_print_print_get_one_attributes_cookie_t **/ typedef struct xcb_x_print_print_get_one_attributes_cookie_t { unsigned int sequence; } xcb_x_print_print_get_one_attributes_cookie_t; /** Opcode for xcb_x_print_print_get_one_attributes. */ #define XCB_X_PRINT_PRINT_GET_ONE_ATTRIBUTES 19 /** * @brief xcb_x_print_print_get_one_attributes_request_t **/ typedef struct xcb_x_print_print_get_one_attributes_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_x_print_pcontext_t context; uint32_t nameLen; uint8_t pool; uint8_t pad0[3]; } xcb_x_print_print_get_one_attributes_request_t; /** * @brief xcb_x_print_print_get_one_attributes_reply_t **/ typedef struct xcb_x_print_print_get_one_attributes_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t valueLen; uint8_t pad1[20]; } xcb_x_print_print_get_one_attributes_reply_t; /** Opcode for xcb_x_print_print_set_attributes. */ #define XCB_X_PRINT_PRINT_SET_ATTRIBUTES 18 /** * @brief xcb_x_print_print_set_attributes_request_t **/ typedef struct xcb_x_print_print_set_attributes_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_x_print_pcontext_t context; uint32_t stringLen; uint8_t pool; uint8_t rule; uint8_t pad0[2]; } xcb_x_print_print_set_attributes_request_t; /** * @brief xcb_x_print_print_get_page_dimensions_cookie_t **/ typedef struct xcb_x_print_print_get_page_dimensions_cookie_t { unsigned int sequence; } xcb_x_print_print_get_page_dimensions_cookie_t; /** Opcode for xcb_x_print_print_get_page_dimensions. */ #define XCB_X_PRINT_PRINT_GET_PAGE_DIMENSIONS 21 /** * @brief xcb_x_print_print_get_page_dimensions_request_t **/ typedef struct xcb_x_print_print_get_page_dimensions_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_x_print_pcontext_t context; } xcb_x_print_print_get_page_dimensions_request_t; /** * @brief xcb_x_print_print_get_page_dimensions_reply_t **/ typedef struct xcb_x_print_print_get_page_dimensions_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t width; uint16_t height; uint16_t offset_x; uint16_t offset_y; uint16_t reproducible_width; uint16_t reproducible_height; } xcb_x_print_print_get_page_dimensions_reply_t; /** * @brief xcb_x_print_print_query_screens_cookie_t **/ typedef struct xcb_x_print_print_query_screens_cookie_t { unsigned int sequence; } xcb_x_print_print_query_screens_cookie_t; /** Opcode for xcb_x_print_print_query_screens. */ #define XCB_X_PRINT_PRINT_QUERY_SCREENS 22 /** * @brief xcb_x_print_print_query_screens_request_t **/ typedef struct xcb_x_print_print_query_screens_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; } xcb_x_print_print_query_screens_request_t; /** * @brief xcb_x_print_print_query_screens_reply_t **/ typedef struct xcb_x_print_print_query_screens_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint32_t listCount; uint8_t pad1[20]; } xcb_x_print_print_query_screens_reply_t; /** * @brief xcb_x_print_print_set_image_resolution_cookie_t **/ typedef struct xcb_x_print_print_set_image_resolution_cookie_t { unsigned int sequence; } xcb_x_print_print_set_image_resolution_cookie_t; /** Opcode for xcb_x_print_print_set_image_resolution. */ #define XCB_X_PRINT_PRINT_SET_IMAGE_RESOLUTION 23 /** * @brief xcb_x_print_print_set_image_resolution_request_t **/ typedef struct xcb_x_print_print_set_image_resolution_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_x_print_pcontext_t context; uint16_t image_resolution; } xcb_x_print_print_set_image_resolution_request_t; /** * @brief xcb_x_print_print_set_image_resolution_reply_t **/ typedef struct xcb_x_print_print_set_image_resolution_reply_t { uint8_t response_type; uint8_t status; uint16_t sequence; uint32_t length; uint16_t previous_resolutions; } xcb_x_print_print_set_image_resolution_reply_t; /** * @brief xcb_x_print_print_get_image_resolution_cookie_t **/ typedef struct xcb_x_print_print_get_image_resolution_cookie_t { unsigned int sequence; } xcb_x_print_print_get_image_resolution_cookie_t; /** Opcode for xcb_x_print_print_get_image_resolution. */ #define XCB_X_PRINT_PRINT_GET_IMAGE_RESOLUTION 24 /** * @brief xcb_x_print_print_get_image_resolution_request_t **/ typedef struct xcb_x_print_print_get_image_resolution_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_x_print_pcontext_t context; } xcb_x_print_print_get_image_resolution_request_t; /** * @brief xcb_x_print_print_get_image_resolution_reply_t **/ typedef struct xcb_x_print_print_get_image_resolution_reply_t { uint8_t response_type; uint8_t pad0; uint16_t sequence; uint32_t length; uint16_t image_resolution; } xcb_x_print_print_get_image_resolution_reply_t; /** Opcode for xcb_x_print_notify. */ #define XCB_X_PRINT_NOTIFY 0 /** * @brief xcb_x_print_notify_event_t **/ typedef struct xcb_x_print_notify_event_t { uint8_t response_type; uint8_t detail; uint16_t sequence; xcb_x_print_pcontext_t context; uint8_t cancel; } xcb_x_print_notify_event_t; /** Opcode for xcb_x_print_attribut_notify. */ #define XCB_X_PRINT_ATTRIBUT_NOTIFY 1 /** * @brief xcb_x_print_attribut_notify_event_t **/ typedef struct xcb_x_print_attribut_notify_event_t { uint8_t response_type; uint8_t detail; uint16_t sequence; xcb_x_print_pcontext_t context; } xcb_x_print_attribut_notify_event_t; /** Opcode for xcb_x_print_bad_context. */ #define XCB_X_PRINT_BAD_CONTEXT 0 /** * @brief xcb_x_print_bad_context_error_t **/ typedef struct xcb_x_print_bad_context_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_x_print_bad_context_error_t; /** Opcode for xcb_x_print_bad_sequence. */ #define XCB_X_PRINT_BAD_SEQUENCE 1 /** * @brief xcb_x_print_bad_sequence_error_t **/ typedef struct xcb_x_print_bad_sequence_error_t { uint8_t response_type; uint8_t error_code; uint16_t sequence; } xcb_x_print_bad_sequence_error_t; /** * Get the next element of the iterator * @param i Pointer to a xcb_x_print_string8_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_x_print_string8_t) */ void xcb_x_print_string8_next (xcb_x_print_string8_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_x_print_string8_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_x_print_string8_end (xcb_x_print_string8_iterator_t i); int xcb_x_print_printer_serialize (void **_buffer, const xcb_x_print_printer_t *_aux, const xcb_x_print_string8_t *name, const xcb_x_print_string8_t *description); int xcb_x_print_printer_unserialize (const void *_buffer, xcb_x_print_printer_t **_aux); int xcb_x_print_printer_sizeof (const void *_buffer); xcb_x_print_string8_t * xcb_x_print_printer_name (const xcb_x_print_printer_t *R); int xcb_x_print_printer_name_length (const xcb_x_print_printer_t *R); xcb_generic_iterator_t xcb_x_print_printer_name_end (const xcb_x_print_printer_t *R); xcb_x_print_string8_t * xcb_x_print_printer_description (const xcb_x_print_printer_t *R); int xcb_x_print_printer_description_length (const xcb_x_print_printer_t *R); xcb_generic_iterator_t xcb_x_print_printer_description_end (const xcb_x_print_printer_t *R); /** * Get the next element of the iterator * @param i Pointer to a xcb_x_print_printer_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_x_print_printer_t) */ void xcb_x_print_printer_next (xcb_x_print_printer_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_x_print_printer_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_x_print_printer_end (xcb_x_print_printer_iterator_t i); /** * Get the next element of the iterator * @param i Pointer to a xcb_x_print_pcontext_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next * element. The member index is increased by sizeof(xcb_x_print_pcontext_t) */ void xcb_x_print_pcontext_next (xcb_x_print_pcontext_iterator_t *i); /** * Return the iterator pointing to the last element * @param i An xcb_x_print_pcontext_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. * The member rem is set to 0. The member data points to the * last element. */ xcb_generic_iterator_t xcb_x_print_pcontext_end (xcb_x_print_pcontext_iterator_t i); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_x_print_print_query_version_cookie_t xcb_x_print_print_query_version (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_x_print_print_query_version_cookie_t xcb_x_print_print_query_version_unchecked (xcb_connection_t *c); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_x_print_print_query_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_x_print_print_query_version_reply_t * xcb_x_print_print_query_version_reply (xcb_connection_t *c, xcb_x_print_print_query_version_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_x_print_print_get_printer_list_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_x_print_print_get_printer_list_cookie_t xcb_x_print_print_get_printer_list (xcb_connection_t *c, uint32_t printerNameLen, uint32_t localeLen, const xcb_x_print_string8_t *printer_name, const xcb_x_print_string8_t *locale); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_x_print_print_get_printer_list_cookie_t xcb_x_print_print_get_printer_list_unchecked (xcb_connection_t *c, uint32_t printerNameLen, uint32_t localeLen, const xcb_x_print_string8_t *printer_name, const xcb_x_print_string8_t *locale); int xcb_x_print_print_get_printer_list_printers_length (const xcb_x_print_print_get_printer_list_reply_t *R); xcb_x_print_printer_iterator_t xcb_x_print_print_get_printer_list_printers_iterator (const xcb_x_print_print_get_printer_list_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_x_print_print_get_printer_list_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_x_print_print_get_printer_list_reply_t * xcb_x_print_print_get_printer_list_reply (xcb_connection_t *c, xcb_x_print_print_get_printer_list_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_x_print_print_rehash_printer_list_checked (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_x_print_print_rehash_printer_list (xcb_connection_t *c); int xcb_x_print_create_context_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_x_print_create_context_checked (xcb_connection_t *c, uint32_t context_id, uint32_t printerNameLen, uint32_t localeLen, const xcb_x_print_string8_t *printerName, const xcb_x_print_string8_t *locale); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_x_print_create_context (xcb_connection_t *c, uint32_t context_id, uint32_t printerNameLen, uint32_t localeLen, const xcb_x_print_string8_t *printerName, const xcb_x_print_string8_t *locale); xcb_x_print_string8_t * xcb_x_print_create_context_printer_name (const xcb_x_print_create_context_request_t *R); int xcb_x_print_create_context_printer_name_length (const xcb_x_print_create_context_request_t *R); xcb_generic_iterator_t xcb_x_print_create_context_printer_name_end (const xcb_x_print_create_context_request_t *R); xcb_x_print_string8_t * xcb_x_print_create_context_locale (const xcb_x_print_create_context_request_t *R); int xcb_x_print_create_context_locale_length (const xcb_x_print_create_context_request_t *R); xcb_generic_iterator_t xcb_x_print_create_context_locale_end (const xcb_x_print_create_context_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_x_print_print_set_context_checked (xcb_connection_t *c, uint32_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_x_print_print_set_context (xcb_connection_t *c, uint32_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_x_print_print_get_context_cookie_t xcb_x_print_print_get_context (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_x_print_print_get_context_cookie_t xcb_x_print_print_get_context_unchecked (xcb_connection_t *c); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_x_print_print_get_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_x_print_print_get_context_reply_t * xcb_x_print_print_get_context_reply (xcb_connection_t *c, xcb_x_print_print_get_context_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_x_print_print_destroy_context_checked (xcb_connection_t *c, uint32_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_x_print_print_destroy_context (xcb_connection_t *c, uint32_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_x_print_print_get_screen_of_context_cookie_t xcb_x_print_print_get_screen_of_context (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_x_print_print_get_screen_of_context_cookie_t xcb_x_print_print_get_screen_of_context_unchecked (xcb_connection_t *c); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_x_print_print_get_screen_of_context_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_x_print_print_get_screen_of_context_reply_t * xcb_x_print_print_get_screen_of_context_reply (xcb_connection_t *c, xcb_x_print_print_get_screen_of_context_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_x_print_print_start_job_checked (xcb_connection_t *c, uint8_t output_mode); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_x_print_print_start_job (xcb_connection_t *c, uint8_t output_mode); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_x_print_print_end_job_checked (xcb_connection_t *c, uint8_t cancel); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_x_print_print_end_job (xcb_connection_t *c, uint8_t cancel); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_x_print_print_start_doc_checked (xcb_connection_t *c, uint8_t driver_mode); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_x_print_print_start_doc (xcb_connection_t *c, uint8_t driver_mode); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_x_print_print_end_doc_checked (xcb_connection_t *c, uint8_t cancel); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_x_print_print_end_doc (xcb_connection_t *c, uint8_t cancel); int xcb_x_print_print_put_document_data_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_x_print_print_put_document_data_checked (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t len_data, uint16_t len_fmt, uint16_t len_options, const uint8_t *data, const xcb_x_print_string8_t *doc_format, const xcb_x_print_string8_t *options); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_x_print_print_put_document_data (xcb_connection_t *c, xcb_drawable_t drawable, uint32_t len_data, uint16_t len_fmt, uint16_t len_options, const uint8_t *data, const xcb_x_print_string8_t *doc_format, const xcb_x_print_string8_t *options); uint8_t * xcb_x_print_print_put_document_data_data (const xcb_x_print_print_put_document_data_request_t *R); int xcb_x_print_print_put_document_data_data_length (const xcb_x_print_print_put_document_data_request_t *R); xcb_generic_iterator_t xcb_x_print_print_put_document_data_data_end (const xcb_x_print_print_put_document_data_request_t *R); xcb_x_print_string8_t * xcb_x_print_print_put_document_data_doc_format (const xcb_x_print_print_put_document_data_request_t *R); int xcb_x_print_print_put_document_data_doc_format_length (const xcb_x_print_print_put_document_data_request_t *R); xcb_generic_iterator_t xcb_x_print_print_put_document_data_doc_format_end (const xcb_x_print_print_put_document_data_request_t *R); xcb_x_print_string8_t * xcb_x_print_print_put_document_data_options (const xcb_x_print_print_put_document_data_request_t *R); int xcb_x_print_print_put_document_data_options_length (const xcb_x_print_print_put_document_data_request_t *R); xcb_generic_iterator_t xcb_x_print_print_put_document_data_options_end (const xcb_x_print_print_put_document_data_request_t *R); int xcb_x_print_print_get_document_data_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_x_print_print_get_document_data_cookie_t xcb_x_print_print_get_document_data (xcb_connection_t *c, xcb_x_print_pcontext_t context, uint32_t max_bytes); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_x_print_print_get_document_data_cookie_t xcb_x_print_print_get_document_data_unchecked (xcb_connection_t *c, xcb_x_print_pcontext_t context, uint32_t max_bytes); uint8_t * xcb_x_print_print_get_document_data_data (const xcb_x_print_print_get_document_data_reply_t *R); int xcb_x_print_print_get_document_data_data_length (const xcb_x_print_print_get_document_data_reply_t *R); xcb_generic_iterator_t xcb_x_print_print_get_document_data_data_end (const xcb_x_print_print_get_document_data_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_x_print_print_get_document_data_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_x_print_print_get_document_data_reply_t * xcb_x_print_print_get_document_data_reply (xcb_connection_t *c, xcb_x_print_print_get_document_data_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_x_print_print_start_page_checked (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_x_print_print_start_page (xcb_connection_t *c, xcb_window_t window); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_x_print_print_end_page_checked (xcb_connection_t *c, uint8_t cancel); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_x_print_print_end_page (xcb_connection_t *c, uint8_t cancel); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_x_print_print_select_input_checked (xcb_connection_t *c, xcb_x_print_pcontext_t context, uint32_t event_mask); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_x_print_print_select_input (xcb_connection_t *c, xcb_x_print_pcontext_t context, uint32_t event_mask); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_x_print_print_input_selected_cookie_t xcb_x_print_print_input_selected (xcb_connection_t *c, xcb_x_print_pcontext_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_x_print_print_input_selected_cookie_t xcb_x_print_print_input_selected_unchecked (xcb_connection_t *c, xcb_x_print_pcontext_t context); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_x_print_print_input_selected_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_x_print_print_input_selected_reply_t * xcb_x_print_print_input_selected_reply (xcb_connection_t *c, xcb_x_print_print_input_selected_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_x_print_print_get_attributes_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_x_print_print_get_attributes_cookie_t xcb_x_print_print_get_attributes (xcb_connection_t *c, xcb_x_print_pcontext_t context, uint8_t pool); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_x_print_print_get_attributes_cookie_t xcb_x_print_print_get_attributes_unchecked (xcb_connection_t *c, xcb_x_print_pcontext_t context, uint8_t pool); xcb_x_print_string8_t * xcb_x_print_print_get_attributes_attributes (const xcb_x_print_print_get_attributes_reply_t *R); int xcb_x_print_print_get_attributes_attributes_length (const xcb_x_print_print_get_attributes_reply_t *R); xcb_generic_iterator_t xcb_x_print_print_get_attributes_attributes_end (const xcb_x_print_print_get_attributes_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_x_print_print_get_attributes_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_x_print_print_get_attributes_reply_t * xcb_x_print_print_get_attributes_reply (xcb_connection_t *c, xcb_x_print_print_get_attributes_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_x_print_print_get_one_attributes_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_x_print_print_get_one_attributes_cookie_t xcb_x_print_print_get_one_attributes (xcb_connection_t *c, xcb_x_print_pcontext_t context, uint32_t nameLen, uint8_t pool, const xcb_x_print_string8_t *name); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_x_print_print_get_one_attributes_cookie_t xcb_x_print_print_get_one_attributes_unchecked (xcb_connection_t *c, xcb_x_print_pcontext_t context, uint32_t nameLen, uint8_t pool, const xcb_x_print_string8_t *name); xcb_x_print_string8_t * xcb_x_print_print_get_one_attributes_value (const xcb_x_print_print_get_one_attributes_reply_t *R); int xcb_x_print_print_get_one_attributes_value_length (const xcb_x_print_print_get_one_attributes_reply_t *R); xcb_generic_iterator_t xcb_x_print_print_get_one_attributes_value_end (const xcb_x_print_print_get_one_attributes_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_x_print_print_get_one_attributes_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_x_print_print_get_one_attributes_reply_t * xcb_x_print_print_get_one_attributes_reply (xcb_connection_t *c, xcb_x_print_print_get_one_attributes_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_x_print_print_set_attributes_sizeof (const void *_buffer, uint32_t attributes_len); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_x_print_print_set_attributes_checked (xcb_connection_t *c, xcb_x_print_pcontext_t context, uint32_t stringLen, uint8_t pool, uint8_t rule, uint32_t attributes_len, const xcb_x_print_string8_t *attributes); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_x_print_print_set_attributes (xcb_connection_t *c, xcb_x_print_pcontext_t context, uint32_t stringLen, uint8_t pool, uint8_t rule, uint32_t attributes_len, const xcb_x_print_string8_t *attributes); xcb_x_print_string8_t * xcb_x_print_print_set_attributes_attributes (const xcb_x_print_print_set_attributes_request_t *R); int xcb_x_print_print_set_attributes_attributes_length (const xcb_x_print_print_set_attributes_request_t *R); xcb_generic_iterator_t xcb_x_print_print_set_attributes_attributes_end (const xcb_x_print_print_set_attributes_request_t *R); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_x_print_print_get_page_dimensions_cookie_t xcb_x_print_print_get_page_dimensions (xcb_connection_t *c, xcb_x_print_pcontext_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_x_print_print_get_page_dimensions_cookie_t xcb_x_print_print_get_page_dimensions_unchecked (xcb_connection_t *c, xcb_x_print_pcontext_t context); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_x_print_print_get_page_dimensions_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_x_print_print_get_page_dimensions_reply_t * xcb_x_print_print_get_page_dimensions_reply (xcb_connection_t *c, xcb_x_print_print_get_page_dimensions_cookie_t cookie /**< */, xcb_generic_error_t **e); int xcb_x_print_print_query_screens_sizeof (const void *_buffer); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_x_print_print_query_screens_cookie_t xcb_x_print_print_query_screens (xcb_connection_t *c); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_x_print_print_query_screens_cookie_t xcb_x_print_print_query_screens_unchecked (xcb_connection_t *c); xcb_window_t * xcb_x_print_print_query_screens_roots (const xcb_x_print_print_query_screens_reply_t *R); int xcb_x_print_print_query_screens_roots_length (const xcb_x_print_print_query_screens_reply_t *R); xcb_generic_iterator_t xcb_x_print_print_query_screens_roots_end (const xcb_x_print_print_query_screens_reply_t *R); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_x_print_print_query_screens_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_x_print_print_query_screens_reply_t * xcb_x_print_print_query_screens_reply (xcb_connection_t *c, xcb_x_print_print_query_screens_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_x_print_print_set_image_resolution_cookie_t xcb_x_print_print_set_image_resolution (xcb_connection_t *c, xcb_x_print_pcontext_t context, uint16_t image_resolution); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_x_print_print_set_image_resolution_cookie_t xcb_x_print_print_set_image_resolution_unchecked (xcb_connection_t *c, xcb_x_print_pcontext_t context, uint16_t image_resolution); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_x_print_print_set_image_resolution_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_x_print_print_set_image_resolution_reply_t * xcb_x_print_print_set_image_resolution_reply (xcb_connection_t *c, xcb_x_print_print_set_image_resolution_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_x_print_print_get_image_resolution_cookie_t xcb_x_print_print_get_image_resolution (xcb_connection_t *c, xcb_x_print_pcontext_t context); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_x_print_print_get_image_resolution_cookie_t xcb_x_print_print_get_image_resolution_unchecked (xcb_connection_t *c, xcb_x_print_pcontext_t context); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_x_print_print_get_image_resolution_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_x_print_print_get_image_resolution_reply_t * xcb_x_print_print_get_image_resolution_reply (xcb_connection_t *c, xcb_x_print_print_get_image_resolution_cookie_t cookie /**< */, xcb_generic_error_t **e); #ifdef __cplusplus } #endif #endif /** * @} */ �������������������������������������������������������������������������������������������������������������������������������������������������������������xcb/xtest.h�����������������������������������������������������������������������������������������0000644�����������������00000016645�14763166026�0006667 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file generated automatically from xtest.xml by c_client.py. * Edit at your peril. */ /** * @defgroup XCB_Test_API XCB Test API * @brief Test XCB Protocol Implementation. * @{ **/ #ifndef __XTEST_H #define __XTEST_H #include "xcb.h" #include "xproto.h" #ifdef __cplusplus extern "C" { #endif #define XCB_TEST_MAJOR_VERSION 2 #define XCB_TEST_MINOR_VERSION 2 extern xcb_extension_t xcb_test_id; /** * @brief xcb_test_get_version_cookie_t **/ typedef struct xcb_test_get_version_cookie_t { unsigned int sequence; } xcb_test_get_version_cookie_t; /** Opcode for xcb_test_get_version. */ #define XCB_TEST_GET_VERSION 0 /** * @brief xcb_test_get_version_request_t **/ typedef struct xcb_test_get_version_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t major_version; uint8_t pad0; uint16_t minor_version; } xcb_test_get_version_request_t; /** * @brief xcb_test_get_version_reply_t **/ typedef struct xcb_test_get_version_reply_t { uint8_t response_type; uint8_t major_version; uint16_t sequence; uint32_t length; uint16_t minor_version; } xcb_test_get_version_reply_t; typedef enum xcb_test_cursor_t { XCB_TEST_CURSOR_NONE = 0, XCB_TEST_CURSOR_CURRENT = 1 } xcb_test_cursor_t; /** * @brief xcb_test_compare_cursor_cookie_t **/ typedef struct xcb_test_compare_cursor_cookie_t { unsigned int sequence; } xcb_test_compare_cursor_cookie_t; /** Opcode for xcb_test_compare_cursor. */ #define XCB_TEST_COMPARE_CURSOR 1 /** * @brief xcb_test_compare_cursor_request_t **/ typedef struct xcb_test_compare_cursor_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; xcb_window_t window; xcb_cursor_t cursor; } xcb_test_compare_cursor_request_t; /** * @brief xcb_test_compare_cursor_reply_t **/ typedef struct xcb_test_compare_cursor_reply_t { uint8_t response_type; uint8_t same; uint16_t sequence; uint32_t length; } xcb_test_compare_cursor_reply_t; /** Opcode for xcb_test_fake_input. */ #define XCB_TEST_FAKE_INPUT 2 /** * @brief xcb_test_fake_input_request_t **/ typedef struct xcb_test_fake_input_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t type; uint8_t detail; uint8_t pad0[2]; uint32_t time; xcb_window_t root; uint8_t pad1[8]; int16_t rootX; int16_t rootY; uint8_t pad2[7]; uint8_t deviceid; } xcb_test_fake_input_request_t; /** Opcode for xcb_test_grab_control. */ #define XCB_TEST_GRAB_CONTROL 3 /** * @brief xcb_test_grab_control_request_t **/ typedef struct xcb_test_grab_control_request_t { uint8_t major_opcode; uint8_t minor_opcode; uint16_t length; uint8_t impervious; uint8_t pad0[3]; } xcb_test_grab_control_request_t; /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_test_get_version_cookie_t xcb_test_get_version (xcb_connection_t *c, uint8_t major_version, uint16_t minor_version); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_test_get_version_cookie_t xcb_test_get_version_unchecked (xcb_connection_t *c, uint8_t major_version, uint16_t minor_version); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_test_get_version_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_test_get_version_reply_t * xcb_test_get_version_reply (xcb_connection_t *c, xcb_test_get_version_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_test_compare_cursor_cookie_t xcb_test_compare_cursor (xcb_connection_t *c, xcb_window_t window, xcb_cursor_t cursor); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will cause * a reply to be generated. Any returned error will be * placed in the event queue. */ xcb_test_compare_cursor_cookie_t xcb_test_compare_cursor_unchecked (xcb_connection_t *c, xcb_window_t window, xcb_cursor_t cursor); /** * Return the reply * @param c The connection * @param cookie The cookie * @param e The xcb_generic_error_t supplied * * Returns the reply of the request asked by * * The parameter @p e supplied to this function must be NULL if * xcb_test_compare_cursor_unchecked(). is used. * Otherwise, it stores the error if any. * * The returned value must be freed by the caller using free(). */ xcb_test_compare_cursor_reply_t * xcb_test_compare_cursor_reply (xcb_connection_t *c, xcb_test_compare_cursor_cookie_t cookie /**< */, xcb_generic_error_t **e); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_test_fake_input_checked (xcb_connection_t *c, uint8_t type, uint8_t detail, uint32_t time, xcb_window_t root, int16_t rootX, int16_t rootY, uint8_t deviceid); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_test_fake_input (xcb_connection_t *c, uint8_t type, uint8_t detail, uint32_t time, xcb_window_t root, int16_t rootX, int16_t rootY, uint8_t deviceid); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * * This form can be used only if the request will not cause * a reply to be generated. Any returned error will be * saved for handling by xcb_request_check(). */ xcb_void_cookie_t xcb_test_grab_control_checked (xcb_connection_t *c, uint8_t impervious); /** * * @param c The connection * @return A cookie * * Delivers a request to the X server. * */ xcb_void_cookie_t xcb_test_grab_control (xcb_connection_t *c, uint8_t impervious); #ifdef __cplusplus } #endif #endif /** * @} */ �������������������������������������������������������������������������������������������gssrpc/xdr.h����������������������������������������������������������������������������������������0000644�����������������00000027003�14763166026�0007030 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* @(#)xdr.h 1.19 87/04/22 SMI */ /* * xdr.h, External Data Representation Serialization Routines. */ #ifndef GSSRPC_XDR_H #define GSSRPC_XDR_H #include <stdio.h> /* for FILE */ GSSRPC__BEGIN_DECLS /* * XDR provides a conventional way for converting between C data * types and an external bit-string representation. Library supplied * routines provide for the conversion on built-in C data types. These * routines and utility routines defined here are used to help implement * a type encode/decode routine for each user-defined type. * * Each data type provides a single procedure which takes two arguments: * * bool_t * xdrproc(xdrs, argresp) * XDR *xdrs; * <type> *argresp; * * xdrs is an instance of a XDR handle, to which or from which the data * type is to be converted. argresp is a pointer to the structure to be * converted. The XDR handle contains an operation field which indicates * which of the operations (ENCODE, DECODE * or FREE) is to be performed. * * XDR_DECODE may allocate space if the pointer argresp is null. This * data can be freed with the XDR_FREE operation. * * We write only one procedure per data type to make it easy * to keep the encode and decode procedures for a data type consistent. * In many cases the same code performs all operations on a user defined type, * because all the hard work is done in the component type routines. * decode as a series of calls on the nested data types. */ /* * Xdr operations. XDR_ENCODE causes the type to be encoded into the * stream. XDR_DECODE causes the type to be extracted from the stream. * XDR_FREE can be used to release the space allocated by an XDR_DECODE * request. */ enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 }; /* * This is the number of bytes per unit of external data. */ #define BYTES_PER_XDR_UNIT (4) #define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \ * BYTES_PER_XDR_UNIT) /* * A xdrproc_t exists for each data type which is to be encoded or decoded. * * The second argument to the xdrproc_t is a pointer to an opaque pointer. * The opaque pointer generally points to a structure of the data type * to be decoded. If this pointer is 0, then the type routines should * allocate dynamic storage of the appropriate size and return it. * bool_t (*xdrproc_t)(XDR *, caddr_t *); * * XXX can't actually prototype it, because some take three args!!! */ typedef bool_t (*xdrproc_t)(); /* * The XDR handle. * Contains operation which is being applied to the stream, * an operations vector for the paticular implementation (e.g. see xdr_mem.c), * and two private fields for the use of the particular impelementation. */ typedef struct XDR { enum xdr_op x_op; /* operation; fast additional param */ struct xdr_ops { /* get a long from underlying stream */ bool_t (*x_getlong)(struct XDR *, long *); /* put a long to underlying stream */ bool_t (*x_putlong)(struct XDR *, long *); /* get some bytes from underlying stream */ bool_t (*x_getbytes)(struct XDR *, caddr_t, u_int); /* put some bytes to underlying stream */ bool_t (*x_putbytes)(struct XDR *, caddr_t, u_int); /* returns bytes off from beginning */ u_int (*x_getpostn)(struct XDR *); /* lets you reposition the stream */ bool_t (*x_setpostn)(struct XDR *, u_int); /* buf quick ptr to buffered data */ rpc_inline_t *(*x_inline)(struct XDR *, int); /* free privates of this xdr_stream */ void (*x_destroy)(struct XDR *); } *x_ops; caddr_t x_public; /* users' data */ void * x_private; /* pointer to private data */ caddr_t x_base; /* private used for position info */ int x_handy; /* extra private word */ } XDR; /* * Operations defined on a XDR handle * * XDR *xdrs; * int32_t *longp; * caddr_t addr; * u_int len; * u_int pos; */ #define XDR_GETLONG(xdrs, longp) \ (*(xdrs)->x_ops->x_getlong)(xdrs, longp) #define xdr_getlong(xdrs, longp) \ (*(xdrs)->x_ops->x_getlong)(xdrs, longp) #define XDR_PUTLONG(xdrs, longp) \ (*(xdrs)->x_ops->x_putlong)(xdrs, longp) #define xdr_putlong(xdrs, longp) \ (*(xdrs)->x_ops->x_putlong)(xdrs, longp) #define XDR_GETBYTES(xdrs, addr, len) \ (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) #define xdr_getbytes(xdrs, addr, len) \ (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) #define XDR_PUTBYTES(xdrs, addr, len) \ (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) #define xdr_putbytes(xdrs, addr, len) \ (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) #define XDR_GETPOS(xdrs) \ (*(xdrs)->x_ops->x_getpostn)(xdrs) #define xdr_getpos(xdrs) \ (*(xdrs)->x_ops->x_getpostn)(xdrs) #define XDR_SETPOS(xdrs, pos) \ (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) #define xdr_setpos(xdrs, pos) \ (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) #define XDR_INLINE(xdrs, len) \ (*(xdrs)->x_ops->x_inline)(xdrs, len) #define xdr_inline(xdrs, len) \ (*(xdrs)->x_ops->x_inline)(xdrs, len) #define XDR_DESTROY(xdrs) \ if ((xdrs)->x_ops->x_destroy) \ (*(xdrs)->x_ops->x_destroy)(xdrs) #define xdr_destroy(xdrs) \ if ((xdrs)->x_ops->x_destroy) \ (*(xdrs)->x_ops->x_destroy)(xdrs) /* * Support struct for discriminated unions. * You create an array of xdrdiscrim structures, terminated with * a entry with a null procedure pointer. The xdr_union routine gets * the discriminant value and then searches the array of structures * for a matching value. If a match is found the associated xdr routine * is called to handle that part of the union. If there is * no match, then a default routine may be called. * If there is no match and no default routine it is an error. */ #define NULL_xdrproc_t ((xdrproc_t)0) struct xdr_discrim { int value; xdrproc_t proc; }; /* * In-line routines for fast encode/decode of primitve data types. * Caveat emptor: these use single memory cycles to get the * data from the underlying buffer, and will fail to operate * properly if the data is not aligned. The standard way to use these * is to say: * if ((buf = XDR_INLINE(xdrs, count)) == NULL) * return (FALSE); * <<< macro calls >>> * where ``count'' is the number of bytes of data occupied * by the primitive data types. * * N.B. and frozen for all time: each data type here uses 4 bytes * of external representation. */ #define IXDR_GET_INT32(buf) ((int32_t)IXDR_GET_U_INT32(buf)) #define IXDR_PUT_INT32(buf, v) IXDR_PUT_U_INT32((buf),((uint32_t)(v))) #define IXDR_GET_U_INT32(buf) (ntohl((uint32_t)*(buf)++)) #define IXDR_PUT_U_INT32(buf, v) (*(buf)++ = (int32_t)htonl((v))) #define IXDR_GET_LONG(buf) ((long)IXDR_GET_INT32(buf)) #define IXDR_PUT_LONG(buf, v) IXDR_PUT_U_INT32((buf),((uint32_t)(v))) #define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf)) #define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_INT32(buf)) #define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_U_INT32(buf)) #define IXDR_GET_SHORT(buf) ((short)IXDR_GET_INT32(buf)) #define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_U_INT32(buf)) #define IXDR_PUT_BOOL(buf, v) IXDR_PUT_INT32((buf),((int32_t)(v))) #define IXDR_PUT_ENUM(buf, v) IXDR_PUT_INT32((buf),((int32_t)(v))) #define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_U_INT32((buf),((uint32_t)(v))) #define IXDR_PUT_SHORT(buf, v) IXDR_PUT_INT32((buf),((int32_t)(v))) #define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_U_INT32((buf),((uint32_t)(v))) /* * These are the "generic" xdr routines. */ extern bool_t xdr_void(XDR *, void *); extern bool_t xdr_int(XDR *, int *); extern bool_t xdr_u_int(XDR *, u_int *); extern bool_t xdr_long(XDR *, long *); extern bool_t xdr_u_long(XDR *, u_long *); extern bool_t xdr_short(XDR *, short *); extern bool_t xdr_u_short(XDR *, u_short *); extern bool_t xdr_bool(XDR *, bool_t *); extern bool_t xdr_enum(XDR *, enum_t *); extern bool_t xdr_array(XDR *, caddr_t *, u_int *, u_int, u_int, xdrproc_t); extern bool_t xdr_bytes(XDR *, char **, u_int *, u_int); extern bool_t xdr_opaque(XDR *, caddr_t, u_int); extern bool_t xdr_string(XDR *, char **, u_int); extern bool_t xdr_union(XDR *, enum_t *, char *, struct xdr_discrim *, xdrproc_t); extern bool_t xdr_char(XDR *, char *); extern bool_t xdr_u_char(XDR *, u_char *); extern bool_t xdr_vector(XDR *, char *, u_int, u_int, xdrproc_t); extern bool_t xdr_float(XDR *, float *); extern bool_t xdr_double(XDR *, double *); extern bool_t xdr_reference(XDR *, caddr_t *, u_int, xdrproc_t); extern bool_t xdr_pointer(XDR *, char **, u_int, xdrproc_t); extern bool_t xdr_wrapstring(XDR *, char **); extern unsigned long xdr_sizeof(xdrproc_t, void *); #define xdr_rpcprog xdr_u_int32 #define xdr_rpcvers xdr_u_int32 #define xdr_rpcprot xdr_u_int32 #define xdr_rpcproc xdr_u_int32 #define xdr_rpcport xdr_u_int32 /* * Common opaque bytes objects used by many rpc protocols; * declared here due to commonality. */ #define MAX_NETOBJ_SZ 2048 struct netobj { u_int n_len; char *n_bytes; }; typedef struct netobj netobj; extern bool_t xdr_netobj(XDR *, struct netobj *); extern bool_t xdr_int32(XDR *, int32_t *); extern bool_t xdr_u_int32(XDR *, uint32_t *); /* * These are the public routines for the various implementations of * xdr streams. */ /* XDR allocating memory buffer */ extern void xdralloc_create(XDR *, enum xdr_op); /* destroy xdralloc, save buf */ extern void xdralloc_release(XDR *); /* get buffer from xdralloc */ extern caddr_t xdralloc_getdata(XDR *); /* XDR using memory buffers */ extern void xdrmem_create(XDR *, caddr_t, u_int, enum xdr_op); /* XDR using stdio library */ extern void xdrstdio_create(XDR *, FILE *, enum xdr_op); /* XDR pseudo records for tcp */ extern void xdrrec_create(XDR *xdrs, u_int, u_int, caddr_t, int (*) (caddr_t, caddr_t, int), int (*) (caddr_t, caddr_t, int)); /* make end of xdr record */ extern bool_t xdrrec_endofrecord(XDR *, bool_t); /* move to beginning of next record */ extern bool_t xdrrec_skiprecord (XDR *xdrs); /* true if no more input */ extern bool_t xdrrec_eof (XDR *xdrs); /* free memory buffers for xdr */ extern void xdr_free (xdrproc_t, void *); GSSRPC__END_DECLS #endif /* !defined(GSSRPC_XDR_H) */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gssrpc/types.h��������������������������������������������������������������������������������������0000644�����������������00000007357�14763166026�0007411 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)types.h 2.3 88/08/15 4.0 RPCSRC */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the “Oracle America, Inc.” nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* @(#)types.h 1.18 87/07/24 SMI */ /* * Rpc additions to <sys/types.h> */ #ifndef GSSRPC_TYPES_H #define GSSRPC_TYPES_H #include <sys/types.h> #include <sys/select.h> #include <sys/time.h> #include <unistd.h> /* * Try to get MAXHOSTNAMELEN from somewhere. */ #include <sys/param.h> /* #include <netdb.h> */ /* Get htonl(), ntohl(), etc. */ #include <netinet/in.h> #include <stdlib.h> #include <stdint.h> #include <limits.h> #ifndef GSSRPC__BEGIN_DECLS #ifdef __cplusplus #define GSSRPC__BEGIN_DECLS extern "C" { #define GSSRPC__END_DECLS } #else #define GSSRPC__BEGIN_DECLS #define GSSRPC__END_DECLS #endif #endif GSSRPC__BEGIN_DECLS #if defined(CHAR_BIT) && CHAR_BIT != 8 #error "Bytes must be exactly 8 bits." #endif /* Define if we need to fake up some BSD type aliases. */ #ifndef GSSRPC__BSD_TYPEALIASES /* Allow application to override. */ /* #undef GSSRPC__BSD_TYPEALIASES */ #endif #if GSSRPC__BSD_TYPEALIASES typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; #endif typedef uint32_t rpcprog_t; typedef uint32_t rpcvers_t; typedef uint32_t rpcprot_t; typedef uint32_t rpcproc_t; typedef uint32_t rpcport_t; typedef int32_t rpc_inline_t; /* This is for rpc/netdb.h */ #define STRUCT_RPCENT_IN_RPC_NETDB_H #define bool_t int #define enum_t int #ifndef FALSE # define FALSE (0) #endif #ifndef TRUE # define TRUE (1) #endif /* XXX namespace */ #define __dontcare__ -1 #ifndef NULL # define NULL 0 #endif /* * The below should probably be internal-only, but seem to be * traditionally exported in RPC implementations. */ #define mem_alloc(bsize) malloc(bsize) #define mem_free(ptr, bsize) free(ptr) #if 0 #include <netdb.h> /* XXX This should not have to be here. * I got sick of seeing the warnings for MAXHOSTNAMELEN * and the two values were different. -- shanzer */ #endif #ifndef INADDR_LOOPBACK #define INADDR_LOOPBACK (uint32_t)0x7F000001 #endif #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 64 #endif GSSRPC__END_DECLS #include <gssrpc/rename.h> #endif /* !defined(GSSRPC_TYPES_H) */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gssrpc/pmap_rmt.h�����������������������������������������������������������������������������������0000644�����������������00000004377�14763166026�0010063 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)pmap_rmt.h 2.1 88/07/29 4.0 RPCSRC; from 1.2 88/02/08 SMI */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Structures and XDR routines for parameters to and replies from * the portmapper remote-call-service. */ #ifndef GSSRPC_PMAP_RMT_H #define GSSRPC_PMAP_RMT_H GSSRPC__BEGIN_DECLS struct rmtcallargs { rpcprog_t prog; rpcvers_t vers; rpcproc_t proc; uint32_t arglen; caddr_t args_ptr; xdrproc_t xdr_args; }; bool_t xdr_rmtcall_args(XDR *, struct rmtcallargs *); struct rmtcallres { rpcport_t *port_ptr; uint32_t resultslen; caddr_t results_ptr; xdrproc_t xdr_results; }; bool_t xdr_rmtcallres(XDR *, struct rmtcallres *); GSSRPC__END_DECLS #endif /* !defined(GSSRPC_PMAP_RMT_H) */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gssrpc/rpc.h����������������������������������������������������������������������������������������0000644�����������������00000007511�14763166026�0007021 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)rpc.h 2.3 88/08/10 4.0 RPCSRC; from 1.9 88/02/08 SMI */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * rpc.h, Just includes the billions of rpc header files necessary to * do remote procedure calling. */ #ifndef GSSRPC_RPC_H #define GSSRPC_RPC_H #include <gssrpc/types.h> /* some typedefs */ #include <netinet/in.h> /* external data representation interfaces */ #include <gssrpc/xdr.h> /* generic (de)serializer */ /* Client side only authentication */ #include <gssrpc/auth.h> /* generic authenticator (client side) */ /* Client side (mostly) remote procedure call */ #include <gssrpc/clnt.h> /* generic rpc stuff */ /* semi-private protocol headers */ #include <gssrpc/rpc_msg.h> /* protocol for rpc messages */ #include <gssrpc/auth_unix.h> /* protocol for unix style cred */ #include <gssrpc/auth_gss.h> /* RPCSEC_GSS */ /* * Uncomment-out the next line if you are building the rpc library with * DES Authentication (see the README file in the secure_rpc/ directory). */ #if 0 #include <gssrpc/auth_des.h> protocol for des style cred #endif /* Server side only remote procedure callee */ #include <gssrpc/svc_auth.h> /* service side authenticator */ #include <gssrpc/svc.h> /* service manager and multiplexer */ /* * Punt the rpc/netdb.h everywhere because it just makes things much more * difficult. We don't use the *rpcent functions anyway. */ #if 0 /* * COMMENT OUT THE NEXT INCLUDE IF RUNNING ON SUN OS OR ON A VERSION * OF UNIX BASED ON NFSSRC. These systems will already have the structures * defined by <rpc/netdb.h> included in <netdb.h>. */ /* routines for parsing /etc/rpc */ #if 0 /* netdb.h already included in rpc/types.h */ #include <netdb.h> #endif #include <gssrpc/netdb.h> /* structures and routines to parse /etc/rpc */ #endif /* * get the local host's IP address without consulting * name service library functions */ GSSRPC__BEGIN_DECLS extern int get_myaddress(struct sockaddr_in *); extern int bindresvport(int, struct sockaddr_in *); extern int bindresvport_sa(int, struct sockaddr *); extern int callrpc(char *, rpcprog_t, rpcvers_t, rpcproc_t, xdrproc_t, char *, xdrproc_t , char *); extern int getrpcport(char *, rpcprog_t, rpcvers_t, rpcprot_t); extern int gssrpc__rpc_dtablesize(void); GSSRPC__END_DECLS #endif /* !defined(GSSRPC_RPC_H) */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gssrpc/rpc_msg.h������������������������������������������������������������������������������������0000644�����������������00000011762�14763166026�0007672 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* @(#)rpc_msg.h 1.7 86/07/16 SMI */ /* * rpc_msg.h * rpc message definition */ #ifndef GSSRPC_RPC_MSG_H #define GSSRPC_RPC_MSG_H GSSRPC__BEGIN_DECLS #define RPC_MSG_VERSION ((uint32_t) 2) #define RPC_SERVICE_PORT ((u_short) 2048) /* * Bottom up definition of an rpc message. * NOTE: call and reply use the same overall stuct but * different parts of unions within it. */ enum msg_type { CALL=0, REPLY=1 }; enum reply_stat { MSG_ACCEPTED=0, MSG_DENIED=1 }; enum accept_stat { SUCCESS=0, PROG_UNAVAIL=1, PROG_MISMATCH=2, PROC_UNAVAIL=3, GARBAGE_ARGS=4, SYSTEM_ERR=5 }; enum reject_stat { RPC_MISMATCH=0, AUTH_ERROR=1 }; /* * Reply part of an rpc exchange */ /* * Reply to an rpc request that was accepted by the server. * Note: there could be an error even though the request was * accepted. */ struct accepted_reply { struct opaque_auth ar_verf; enum accept_stat ar_stat; union { struct { rpcvers_t low; rpcvers_t high; } AR_versions; struct { caddr_t where; xdrproc_t proc; } AR_results; /* and many other null cases */ } ru; #define ar_results ru.AR_results #define ar_vers ru.AR_versions }; /* * Reply to an rpc request that was rejected by the server. */ struct rejected_reply { enum reject_stat rj_stat; union { struct { rpcvers_t low; rpcvers_t high; } RJ_versions; enum auth_stat RJ_why; /* why authentication did not work */ } ru; #define rj_vers ru.RJ_versions #define rj_why ru.RJ_why }; /* * Body of a reply to an rpc request. */ struct reply_body { enum reply_stat rp_stat; union { struct accepted_reply RP_ar; struct rejected_reply RP_dr; } ru; #define rp_acpt ru.RP_ar #define rp_rjct ru.RP_dr }; /* * Body of an rpc request call. */ struct call_body { rpcvers_t cb_rpcvers; /* must be equal to two */ rpcprog_t cb_prog; rpcvers_t cb_vers; rpcproc_t cb_proc; struct opaque_auth cb_cred; struct opaque_auth cb_verf; /* protocol specific - provided by client */ }; /* * The rpc message */ struct rpc_msg { uint32_t rm_xid; enum msg_type rm_direction; union { struct call_body RM_cmb; struct reply_body RM_rmb; } ru; #define rm_call ru.RM_cmb #define rm_reply ru.RM_rmb }; #define acpted_rply ru.RM_rmb.ru.RP_ar #define rjcted_rply ru.RM_rmb.ru.RP_dr /* * XDR routine to handle a rpc message. * xdr_callmsg(xdrs, cmsg) * XDR *xdrs; * struct rpc_msg *cmsg; */ extern bool_t xdr_callmsg(XDR *, struct rpc_msg *); /* * XDR routine to pre-serialize the static part of a rpc message. * xdr_callhdr(xdrs, cmsg) * XDR *xdrs; * struct rpc_msg *cmsg; */ extern bool_t xdr_callhdr(XDR *, struct rpc_msg *); /* * XDR routine to handle a rpc reply. * xdr_replymsg(xdrs, rmsg) * XDR *xdrs; * struct rpc_msg *rmsg; */ extern bool_t xdr_replymsg(XDR *, struct rpc_msg *); /* * Fills in the error part of a reply message. * _seterr_reply(msg, error) * struct rpc_msg *msg; * struct rpc_err *error; */ /* * RENAMED: should be _seterr_reply or __seterr_reply if we can use * reserved namespace. */ extern void gssrpc__seterr_reply(struct rpc_msg *, struct rpc_err *); /* XDR the MSG_ACCEPTED part of a reply message union */ extern bool_t xdr_accepted_reply(XDR *, struct accepted_reply *); /* XDR the MSG_DENIED part of a reply message union */ extern bool_t xdr_rejected_reply(XDR *, struct rejected_reply *); GSSRPC__END_DECLS #endif /* !defined(GSSRPC_RPC_MSG_H) */ ��������������gssrpc/svc_auth.h�����������������������������������������������������������������������������������0000644�����������������00000007610�14763166026�0010051 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* @(#)svc_auth.h 1.6 86/07/16 SMI */ /* * svc_auth.h, Service side of rpc authentication. */ /* * Interface to server-side authentication flavors. */ #ifndef GSSRPC_SVC_AUTH_H #define GSSRPC_SVC_AUTH_H #include <gssapi/gssapi.h> GSSRPC__BEGIN_DECLS struct svc_req; typedef struct SVCAUTH { struct svc_auth_ops { int (*svc_ah_wrap)(struct SVCAUTH *, XDR *, xdrproc_t, caddr_t); int (*svc_ah_unwrap)(struct SVCAUTH *, XDR *, xdrproc_t, caddr_t); int (*svc_ah_destroy)(struct SVCAUTH *); } *svc_ah_ops; void * svc_ah_private; } SVCAUTH; #ifdef GSSRPC__IMPL extern SVCAUTH svc_auth_none; extern struct svc_auth_ops svc_auth_none_ops; extern struct svc_auth_ops svc_auth_gssapi_ops; extern struct svc_auth_ops svc_auth_gss_ops; /* * Server side authenticator */ /* RENAMED: should be _authenticate. */ extern enum auth_stat gssrpc__authenticate(struct svc_req *rqst, struct rpc_msg *msg, bool_t *no_dispatch); #define SVCAUTH_WRAP(auth, xdrs, xfunc, xwhere) \ ((*((auth)->svc_ah_ops->svc_ah_wrap))(auth, xdrs, xfunc, xwhere)) #define SVCAUTH_UNWRAP(auth, xdrs, xfunc, xwhere) \ ((*((auth)->svc_ah_ops->svc_ah_unwrap))(auth, xdrs, xfunc, xwhere)) #define SVCAUTH_DESTROY(auth) \ ((*((auth)->svc_ah_ops->svc_ah_destroy))(auth)) /* no authentication */ /* RENAMED: should be _svcauth_none. */ enum auth_stat gssrpc__svcauth_none(struct svc_req *, struct rpc_msg *, bool_t *); /* unix style (uid, gids) */ /* RENAMED: shoudl be _svcauth_unix. */ enum auth_stat gssrpc__svcauth_unix(struct svc_req *, struct rpc_msg *, bool_t *); /* short hand unix style */ /* RENAMED: should be _svcauth_short. */ enum auth_stat gssrpc__svcauth_short(struct svc_req *, struct rpc_msg *, bool_t *); /* GSS-API style */ /* RENAMED: should be _svcauth_gssapi. */ enum auth_stat gssrpc__svcauth_gssapi(struct svc_req *, struct rpc_msg *, bool_t *); /* RPCSEC_GSS */ enum auth_stat gssrpc__svcauth_gss(struct svc_req *, struct rpc_msg *, bool_t *); #endif /* defined(GSSRPC__IMPL) */ /* * Approved way of getting principal of caller */ char *svcauth_gss_get_principal(SVCAUTH *auth); /* * Approved way of setting server principal */ bool_t svcauth_gss_set_svc_name(gss_name_t name); GSSRPC__END_DECLS #endif /* !defined(GSSRPC_SVC_AUTH_H) */ ������������������������������������������������������������������������������������������������������������������������gssrpc/auth_gssapi.h��������������������������������������������������������������������������������0000644�����������������00000010355�14763166026�0010544 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* include/gssrpc/auth_gssapi.h - GSS-API style auth parameters for RPC */ /* * Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved. */ #ifndef GSSRPC_AUTH_GSSAPI_H #define GSSRPC_AUTH_GSSAPI_H GSSRPC__BEGIN_DECLS #define AUTH_GSSAPI_EXIT 0 #define AUTH_GSSAPI_INIT 1 #define AUTH_GSSAPI_CONTINUE_INIT 2 #define AUTH_GSSAPI_MSG 3 #define AUTH_GSSAPI_DESTROY 4 /* * Yuck. Some sys/types.h files leak symbols */ #ifdef major #undef major #endif #ifdef minor #undef minor #endif typedef struct _auth_gssapi_name { char *name; gss_OID type; } auth_gssapi_name; typedef struct _auth_gssapi_creds { uint32_t version; bool_t auth_msg; gss_buffer_desc client_handle; } auth_gssapi_creds; typedef struct _auth_gssapi_init_arg { uint32_t version; gss_buffer_desc token; } auth_gssapi_init_arg; typedef struct _auth_gssapi_init_res { uint32_t version; gss_buffer_desc client_handle; OM_uint32 gss_major, gss_minor; gss_buffer_desc token; gss_buffer_desc signed_isn; } auth_gssapi_init_res; typedef void (*auth_gssapi_log_badauth_func) (OM_uint32 major, OM_uint32 minor, struct sockaddr_in *raddr, caddr_t data); /* auth_gssapi_log_badauth_func is IPv4-specific; this version gives the * transport handle so the fd can be used to get the address. */ typedef void (*auth_gssapi_log_badauth2_func) (OM_uint32 major, OM_uint32 minor, SVCXPRT *xprt, caddr_t data); typedef void (*auth_gssapi_log_badverf_func) (gss_name_t client, gss_name_t server, struct svc_req *rqst, struct rpc_msg *msg, caddr_t data); typedef void (*auth_gssapi_log_miscerr_func) (struct svc_req *rqst, struct rpc_msg *msg, char *error, caddr_t data); bool_t xdr_gss_buf(XDR *, gss_buffer_t); bool_t xdr_authgssapi_creds(XDR *, auth_gssapi_creds *); bool_t xdr_authgssapi_init_arg(XDR *, auth_gssapi_init_arg *); bool_t xdr_authgssapi_init_res(XDR *, auth_gssapi_init_res *); bool_t auth_gssapi_wrap_data (OM_uint32 *major, OM_uint32 *minor, gss_ctx_id_t context, uint32_t seq_num, XDR *out_xdrs, bool_t (*xdr_func)(), caddr_t xdr_ptr); bool_t auth_gssapi_unwrap_data (OM_uint32 *major, OM_uint32 *minor, gss_ctx_id_t context, uint32_t seq_num, XDR *in_xdrs, bool_t (*xdr_func)(), caddr_t xdr_ptr); AUTH *auth_gssapi_create (CLIENT *clnt, OM_uint32 *major_status, OM_uint32 *minor_status, gss_cred_id_t claimant_cred_handle, gss_name_t target_name, gss_OID mech_type, OM_uint32 req_flags, OM_uint32 time_req, gss_OID *actual_mech_type, OM_uint32 *ret_flags, OM_uint32 *time_rec); AUTH *auth_gssapi_create_default (CLIENT *clnt, char *service_name); void auth_gssapi_display_status (char *msg, OM_uint32 major, OM_uint32 minor); bool_t auth_gssapi_seal_seq (gss_ctx_id_t context, uint32_t seq_num, gss_buffer_t out_buf); bool_t auth_gssapi_unseal_seq (gss_ctx_id_t context, gss_buffer_t in_buf, uint32_t *seq_num); bool_t svcauth_gssapi_set_names (auth_gssapi_name *names, int num); void svcauth_gssapi_unset_names (void); void svcauth_gssapi_set_log_badauth_func (auth_gssapi_log_badauth_func func, caddr_t data); void svcauth_gssapi_set_log_badauth2_func (auth_gssapi_log_badauth2_func func, caddr_t data); void svcauth_gssapi_set_log_badverf_func (auth_gssapi_log_badverf_func func, caddr_t data); void svcauth_gssapi_set_log_miscerr_func (auth_gssapi_log_miscerr_func func, caddr_t data); void svcauth_gss_set_log_badauth_func(auth_gssapi_log_badauth_func, caddr_t); void svcauth_gss_set_log_badauth2_func(auth_gssapi_log_badauth2_func, caddr_t); void svcauth_gss_set_log_badverf_func(auth_gssapi_log_badverf_func, caddr_t); void svcauth_gss_set_log_miscerr_func(auth_gssapi_log_miscerr_func, caddr_t data); #define GSS_COPY_BUFFER(dest, src) { \ (dest).length = (src).length; \ (dest).value = (src).value; } #define GSS_DUP_BUFFER(dest, src) { \ (dest).length = (src).length; \ (dest).value = (void *) malloc((dest).length); \ memcpy((dest).value, (src).value, (dest).length); } #define GSS_BUFFERS_EQUAL(b1, b2) (((b1).length == (b2).length) && \ !memcmp((b1).value,(b2).value,(b1.length))) GSSRPC__END_DECLS #endif /* !defined(GSSRPC_AUTH_GSSAPI_H) */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gssrpc/auth.h���������������������������������������������������������������������������������������0000644�����������������00000015205�14763166026�0007175 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)auth.h 2.3 88/08/07 4.0 RPCSRC; from 1.17 88/02/08 SMI */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * auth.h, Authentication interface. * * The data structures are completely opaque to the client. The client * is required to pass a AUTH * to routines that create rpc * "sessions". */ #ifndef GSSRPC_AUTH_H #define GSSRPC_AUTH_H #include <gssrpc/xdr.h> GSSRPC__BEGIN_DECLS #define MAX_AUTH_BYTES 400 #define MAXNETNAMELEN 255 /* maximum length of network user's name */ /* * Status returned from authentication check */ enum auth_stat { AUTH_OK=0, /* * failed at remote end */ AUTH_BADCRED=1, /* bogus credentials (seal broken) */ AUTH_REJECTEDCRED=2, /* client should begin new session */ AUTH_BADVERF=3, /* bogus verifier (seal broken) */ AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */ AUTH_TOOWEAK=5, /* rejected due to security reasons */ /* * failed locally */ AUTH_INVALIDRESP=6, /* bogus response verifier */ AUTH_FAILED=7, /* some unknown reason */ /* * RPCSEC_GSS errors */ RPCSEC_GSS_CREDPROBLEM = 13, RPCSEC_GSS_CTXPROBLEM = 14 }; union des_block { #if 0 /* XXX nothing uses this, anyway */ struct { uint32_t high; uint32_t low; } key; #endif char c[8]; }; typedef union des_block des_block; extern bool_t xdr_des_block(XDR *, des_block *); /* * Authentication info. Opaque to client. */ struct opaque_auth { enum_t oa_flavor; /* flavor of auth */ caddr_t oa_base; /* address of more auth stuff */ u_int oa_length; /* not to exceed MAX_AUTH_BYTES */ }; /* * Auth handle, interface to client side authenticators. */ struct rpc_msg; typedef struct AUTH { struct opaque_auth ah_cred; struct opaque_auth ah_verf; union des_block ah_key; struct auth_ops { void (*ah_nextverf)(struct AUTH *); /* nextverf & serialize */ int (*ah_marshal)(struct AUTH *, XDR *); /* validate varifier */ int (*ah_validate)(struct AUTH *, struct opaque_auth *); /* refresh credentials */ int (*ah_refresh)(struct AUTH *, struct rpc_msg *); /* destroy this structure */ void (*ah_destroy)(struct AUTH *); /* encode data for wire */ int (*ah_wrap)(struct AUTH *, XDR *, xdrproc_t, caddr_t); /* decode data from wire */ int (*ah_unwrap)(struct AUTH *, XDR *, xdrproc_t, caddr_t); } *ah_ops; void *ah_private; } AUTH; /* * Authentication ops. * The ops and the auth handle provide the interface to the authenticators. * * AUTH *auth; * XDR *xdrs; * struct opaque_auth verf; */ #define AUTH_NEXTVERF(auth) \ ((*((auth)->ah_ops->ah_nextverf))(auth)) #define auth_nextverf(auth) \ ((*((auth)->ah_ops->ah_nextverf))(auth)) #define AUTH_MARSHALL(auth, xdrs) \ ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) #define auth_marshall(auth, xdrs) \ ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) #define AUTH_VALIDATE(auth, verfp) \ ((*((auth)->ah_ops->ah_validate))((auth), verfp)) #define auth_validate(auth, verfp) \ ((*((auth)->ah_ops->ah_validate))((auth), verfp)) #define AUTH_REFRESH(auth, msg) \ ((*((auth)->ah_ops->ah_refresh))(auth, msg)) #define auth_refresh(auth, msg) \ ((*((auth)->ah_ops->ah_refresh))(auth, msg)) #define AUTH_WRAP(auth, xdrs, xfunc, xwhere) \ ((*((auth)->ah_ops->ah_wrap))(auth, xdrs, \ xfunc, xwhere)) #define auth_wrap(auth, xdrs, xfunc, xwhere) \ ((*((auth)->ah_ops->ah_wrap))(auth, xdrs, \ xfunc, xwhere)) #define AUTH_UNWRAP(auth, xdrs, xfunc, xwhere) \ ((*((auth)->ah_ops->ah_unwrap))(auth, xdrs, \ xfunc, xwhere)) #define auth_unwrap(auth, xdrs, xfunc, xwhere) \ ((*((auth)->ah_ops->ah_unwrap))(auth, xdrs, \ xfunc, xwhere)) #define AUTH_DESTROY(auth) \ ((*((auth)->ah_ops->ah_destroy))(auth)) #define auth_destroy(auth) \ ((*((auth)->ah_ops->ah_destroy))(auth)) #ifdef GSSRPC__IMPL /* RENAMED: should be _null_auth if we can use reserved namespace. */ extern struct opaque_auth gssrpc__null_auth; #endif /* * These are the various implementations of client side authenticators. */ /* * Unix style authentication * AUTH *authunix_create(machname, uid, gid, len, aup_gids) * char *machname; * int uid; * int gid; * int len; * int *aup_gids; */ extern AUTH *authunix_create(char *machname, int uid, int gid, int len, int *aup_gids); extern AUTH *authunix_create_default(void); /* takes no parameters */ extern AUTH *authnone_create(void); /* takes no parameters */ extern AUTH *authdes_create(); extern bool_t xdr_opaque_auth(XDR *, struct opaque_auth *); #define AUTH_NONE 0 /* no authentication */ #define AUTH_NULL 0 /* backward compatibility */ #define AUTH_UNIX 1 /* unix style (uid, gids) */ #define AUTH_SHORT 2 /* short hand unix style */ #define AUTH_DES 3 /* des style (encrypted timestamps) */ #define AUTH_GSSAPI 300001 /* GSS-API style */ #define RPCSEC_GSS 6 /* RPCSEC_GSS */ #if 0 /* * BACKWARDS COMPATIBILIY! OpenV*Secure 1.0 had AUTH_GSSAPI == 4. We * need to accept this value until 1.0 is dead. */ /* This conflicts with AUTH_KERB (Solaris). */ #define AUTH_GSSAPI_COMPAT 4 #endif GSSRPC__END_DECLS #endif /* !defined(GSSRPC_AUTH_H) */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gssrpc/rename.h�������������������������������������������������������������������������������������0000644�����������������00000025241�14763166026�0007504 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* include/gssrpc/rename.h */ /* * Copyright (C) 2004 by the Massachusetts Institute of Technology. * All rights reserved. * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of M.I.T. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a * fashion that it might be confused with the original M.I.T. software. * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. */ /* * * Namespace mangling for various purposes. * * Symbols in the object code need to be renamed to not conflict with * an OS-provided RPC implementation. Without renaming, the conflicts * can cause problems with things like RPC-enabled NSS * implementations. * * Symbols in headers should not conflict with implementation-reserved * namespace (prefixes "_[A-Z_]" for any purpose; prefix "_" * for file scope identifiers and tag names), or unnecessarily impinge * on user namespace. * * The renaming of the header directory is done to avoid problems when * the OS header files include <rpc/foo.h> and might get ours instead. * OS vendors should replace all the <gssrpc/foo.h> inclusions with * <rpc/foo.h> inclusions, as appropriate. Additionally, vendors * should probably put some symbols into the implementation namespace. * * For example, inclusion protection should change from "GSSRPC_*_H" * to "_RPC_*_H", struct tags should get "__" prefixes, etc. * * This implementation reserves the object code prefix "gssrpc_". * External names in the RPC API not beginning with "_" get renamed * with the prefix "gssrpc_" via #define, e.g., "foo" -> "gssrpc_foo". * External names in the RPC API beginning with "_" get textually * rewritten, with "#if 0"-disabled #defines mapping them back to * their original forms, e.g., "_foo" is rewrittten to "gssrpc__foo" * in the original files, with an unused "#define gssrpc__foo _foo" * here. */ #ifndef GSSRPC_RENAME_H #define GSSRPC_RENAME_H /* auth.h */ #define xdr_des_block gssrpc_xdr_des_block #define authany_wrap gssrpc_authany_wrap #define authany_unwrap gssrpc_authany_unwrap #define authunix_create gssrpc_authunix_create #define authunix_create_default gssrpc_authunix_create_default #define authnone_create gssrpc_authnone_create #define authdes_create gssrpc_authdes_create #define xdr_opaque_auth gssrpc_xdr_opaque_auth #if 0 #define gssrpc__null_auth _null_auth #endif /* auth_gss.c */ #define auth_debug_gss gssrpc_auth_debug_gss #define misc_debug_gss gssrpc_misc_debug_gss /* auth_gss.h */ #define xdr_rpc_gss_buf gssrpc_xdr_rpc_gss_buf #define xdr_rpc_gss_cred gssrpc_xdr_rpc_gss_cred #define xdr_rpc_gss_init_args gssrpc_xdr_rpc_gss_init_args #define xdr_rpc_gss_init_res gssrpc_xdr_rpc_gss_init_res #define xdr_rpc_gss_data gssrpc_xdr_rpc_gss_data #define xdr_rpc_gss_wrap_data gssrpc_xdr_rpc_gss_wrap_data #define xdr_rpc_gss_unwrap_data gssrpc_xdr_rpc_gss_unwrap_data #define authgss_create gssrpc_authgss_create #define authgss_create_default gssrpc_authgss_create_default #define authgss_get_private_data gssrpc_authgss_get_private_data #define authgss_service gssrpc_authgss_service #ifdef GSSRPC__IMPL #define log_debug gssrpc_log_debug #define log_status gssrpc_log_status #define log_hexdump gssrpc_log_hexdump #endif /* auth_gssapi.c */ #define auth_debug_gssapi gssrpc_auth_debug_gssapi #define misc_debug_gssapi gssrpc_misc_debug_gssapi /* auth_gssapi.h */ #define xdr_gss_buf gssrpc_xdr_gss_buf #define xdr_authgssapi_creds gssrpc_xdr_authgssapi_creds #define xdr_authgssapi_init_arg gssrpc_xdr_authgssapi_init_arg #define xdr_authgssapi_init_res gssrpc_xdr_authgssapi_init_res #define auth_gssapi_wrap_data gssrpc_auth_gssapi_wrap_data #define auth_gssapi_unwrap_data gssrpc_auth_gssapi_unwrap_data #define auth_gssapi_create gssrpc_auth_gssapi_create #define auth_gssapi_create_default gssrpc_auth_gssapi_create_default #define auth_gssapi_display_status gssrpc_auth_gssapi_display_status #define auth_gssapi_seal_seq gssrpc_auth_gssapi_seal_seq #define auth_gssapi_unseal_seq gssrpc_auth_gssapi_unseal_seq #define svcauth_gssapi_set_names gssrpc_svcauth_gssapi_set_names #define svcauth_gssapi_unset_names gssrpc_svcauth_gssapi_unset_names #define svcauth_gssapi_set_log_badauth_func gssrpc_svcauth_gssapi_set_log_badauth_func #define svcauth_gssapi_set_log_badauth2_func gssrpc_svcauth_gssapi_set_log_badauth2_func #define svcauth_gssapi_set_log_badverf_func gssrpc_svcauth_gssapi_set_log_badverf_func #define svcauth_gssapi_set_log_miscerr_func gssrpc_svcauth_gssapi_set_log_miscerr_func #define svcauth_gss_set_log_badauth_func gssrpc_svcauth_gss_set_log_badauth_func #define svcauth_gss_set_log_badauth2_func gssrpc_svcauth_gss_set_log_badauth2_func #define svcauth_gss_set_log_badverf_func gssrpc_svcauth_gss_set_log_badverf_func #define svcauth_gss_set_log_miscerr_func gssrpc_svcauth_gss_set_log_miscerr_func /* auth_unix.h */ #define xdr_authunix_parms gssrpc_xdr_authunix_parms /* clnt.h */ #define clntraw_create gssrpc_clntraw_create #define clnt_create gssrpc_clnt_create #define clnttcp_create gssrpc_clnttcp_create #define clntudp_create gssrpc_clntudp_create #define clntudp_bufcreate gssrpc_clntudp_bufcreate #define clnt_pcreateerror gssrpc_clnt_pcreateerror #define clnt_spcreateerror gssrpc_clnt_spcreateerror #define clnt_perrno gssrpc_clnt_perrno #define clnt_perror gssrpc_clnt_perror #define clnt_sperror gssrpc_clnt_sperror /* XXX do we need to rename the struct? */ #define rpc_createerr gssrpc_rpc_createrr #define clnt_sperrno gssrpc_clnt_sperrno /* pmap_clnt.h */ #define pmap_set gssrpc_pmap_set #define pmap_unset gssrpc_pmap_unset #define pmap_getmaps gssrpc_pmap_getmaps #define pmap_rmtcall gssrpc_pmap_rmtcall #define clnt_broadcast gssrpc_clnt_broadcast #define pmap_getport gssrpc_pmap_getport /* pmap_prot.h */ #define xdr_pmap gssrpc_xdr_pmap #define xdr_pmaplist gssrpc_xdr_pmaplist /* pmap_rmt.h */ #define xdr_rmtcall_args gssrpc_xdr_rmtcall_args #define xdr_rmtcallres gssrpc_xdr_rmtcallres /* rpc.h */ #define get_myaddress gssrpc_get_myaddress #define bindresvport gssrpc_bindresvport #define bindresvport_sa gssrpc_bindresvport_sa #define callrpc gssrpc_callrpc #define getrpcport gssrpc_getrpcport #if 0 #define gssrpc__rpc_getdtablesize _rpc_getdtablesize #endif /* rpc_msg.h */ #define xdr_callmsg gssrpc_xdr_callmsg #define xdr_callhdr gssrpc_xdr_callhdr #define xdr_replymsg gssrpc_xdr_replymsg #define xdr_accepted_reply gssrpc_xdr_accepted_reply #define xdr_rejected_reply gssrpc_xdr_rejected_reply #if 0 #define gssrpc__seterr_reply _seterr_reply #endif /* svc.h */ #define svc_register gssrpc_svc_register #define registerrpc gssrpc_registerrpc #define svc_unregister gssrpc_svc_unregister #define xprt_register gssrpc_xprt_register #define xprt_unregister gssrpc_xprt_unregister #define svc_sendreply gssrpc_svc_sendreply #define svcerr_decode gssrpc_svcerr_decode #define svcerr_weakauth gssrpc_svcerr_weakauth #define svcerr_noproc gssrpc_svcerr_noproc #define svcerr_progvers gssrpc_svcerr_progvers #define svcerr_auth gssrpc_svcerr_auth #define svcerr_noprog gssrpc_svcerr_noprog #define svcerr_systemerr gssrpc_svcerr_systemerr #define svc_maxfd gssrpc_svc_maxfd #define svc_fdset gssrpc_svc_fdset #define svc_fds gssrpc_svc_fds #define rpctest_service gssrpc_rpctest_service #define svc_getreq gssrpc_svc_getreq #define svc_getreqset gssrpc_svc_getreqset #define svc_getreqset2 gssrpc_svc_getreqset2 #define svc_run gssrpc_svc_run #define svcraw_create gssrpc_svcraw_create #define svcudp_create gssrpc_svcudp_create #define svcudp_bufcreate gssrpc_svcudp_bufcreate #define svcudp_enablecache gssrpc_svcudp_enablecache #define svctcp_create gssrpc_svctcp_create #define svcfd_create gssrpc_svcfd_create /* svc_auth.h */ #define svc_auth_none_ops gssrpc_svc_auth_none_ops #define svc_auth_gssapi_ops gssrpc_svc_auth_gssapi_ops #define svc_auth_gss_ops gssrpc_svc_auth_gss_ops #define svcauth_gss_set_svc_name gssrpc_svcauth_gss_set_svc_name #define svcauth_gss_get_principal gssrpc_svcauth_gss_get_principal #if 0 #define gssrpc__authenticate _authenticate #define gssrpc__svcauth_none _svcauth_none #define gssrpc__svcauth_unix _svcauth_unix #define gssrpc__svcauth_short _svcauth_short #define gssrpc__svcauth_gssapi _svcauth_gssapi #define gssrpc__svcauth_gss _svcauth_gss #endif /* svc_auth_gss.c */ #define svc_debug_gss gssrpc_svc_debug_gss /* svc_auth_gssapi.c */ #define svc_debug_gssapi gssrpc_svc_debug_gssapi /* svc_auth_none.c */ #define svc_auth_none gssrpc_svc_auth_none /* xdr.h */ #define xdr_void gssrpc_xdr_void #define xdr_int gssrpc_xdr_int #define xdr_u_int gssrpc_xdr_u_int #define xdr_long gssrpc_xdr_long #define xdr_u_long gssrpc_xdr_u_long #define xdr_short gssrpc_xdr_short #define xdr_u_short gssrpc_xdr_u_short #define xdr_bool gssrpc_xdr_bool #define xdr_enum gssrpc_xdr_enum #define xdr_array gssrpc_xdr_array #define xdr_bytes gssrpc_xdr_bytes #define xdr_opaque gssrpc_xdr_opaque #define xdr_string gssrpc_xdr_string #define xdr_union gssrpc_xdr_union #define xdr_char gssrpc_xdr_char #define xdr_u_char gssrpc_xdr_u_char #define xdr_vector gssrpc_xdr_vector #define xdr_float gssrpc_xdr_float #define xdr_double gssrpc_xdr_double #define xdr_reference gssrpc_xdr_reference #define xdr_pointer gssrpc_xdr_pointer #define xdr_wrapstring gssrpc_xdr_wrapstring #define xdr_free gssrpc_xdr_free #define xdr_sizeof gssrpc_xdr_sizeof #define xdr_netobj gssrpc_xdr_netobj #define xdr_int32 gssrpc_xdr_int32 #define xdr_u_int32 gssrpc_xdr_u_int32 #define xdralloc_create gssrpc_xdralloc_create #define xdralloc_release gssrpc_xdralloc_release #define xdralloc_getdata gssrpc_xdralloc_getdata #define xdrmem_create gssrpc_xdrmem_create #define xdrstdio_create gssrpc_xdrstdio_create #define xdrrec_create gssrpc_xdrrec_create #define xdrrec_endofrecord gssrpc_xdrrec_endofrecord #define xdrrec_skiprecord gssrpc_xdrrec_skiprecord #define xdrrec_eof gssrpc_xdrrec_eof #endif /* !defined(GSSRPC_RENAME_H) */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gssrpc/auth_gss.h�����������������������������������������������������������������������������������0000644�����������������00000011350�14763166026�0010046 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* include/gssrpc/auth_gss.h */ /* Copyright (c) 2000 The Regents of the University of Michigan. All rights reserved. Copyright (c) 2000 Dug Song <dugsong@UMICH.EDU>. All rights reserved, all wrongs reversed. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Id: auth_gss.h,v 1.13 2002/05/08 16:54:33 andros Exp */ #ifndef GSSRPC_AUTH_GSS_H #define GSSRPC_AUTH_GSS_H #include <gssrpc/rpc.h> #include <gssrpc/clnt.h> #ifdef HAVE_HEIMDAL #include <gssapi.h> #else #include <gssapi/gssapi.h> #endif GSSRPC__BEGIN_DECLS /* RPCSEC_GSS control procedures. */ typedef enum { RPCSEC_GSS_DATA = 0, RPCSEC_GSS_INIT = 1, RPCSEC_GSS_CONTINUE_INIT = 2, RPCSEC_GSS_DESTROY = 3 } rpc_gss_proc_t; /* RPCSEC_GSS services. */ typedef enum { RPCSEC_GSS_SVC_NONE = 1, RPCSEC_GSS_SVC_INTEGRITY = 2, RPCSEC_GSS_SVC_PRIVACY = 3 } rpc_gss_svc_t; #define RPCSEC_GSS_VERSION 1 /* RPCSEC_GSS security triple. */ struct rpc_gss_sec { gss_OID mech; /* mechanism */ gss_qop_t qop; /* quality of protection */ rpc_gss_svc_t svc; /* service */ gss_cred_id_t cred; /* cred handle */ uint32_t req_flags; /* req flags for init_sec_context */ }; /* Private data required for kernel implementation */ struct authgss_private_data { gss_ctx_id_t pd_ctx; /* Session context handle */ gss_buffer_desc pd_ctx_hndl; /* Credentials context handle */ uint32_t pd_seq_win; /* Sequence window */ }; /* Krb 5 default mechanism #define KRB5OID "1.2.840.113554.1.2.2" gss_OID_desc krb5oid = { 20, KRB5OID }; */ /* struct rpc_gss_sec krb5mech = { (gss_OID)&krb5oid, GSS_QOP_DEFAULT, RPCSEC_GSS_SVC_NONE }; */ /* Credentials. */ struct rpc_gss_cred { u_int gc_v; /* version */ rpc_gss_proc_t gc_proc; /* control procedure */ uint32_t gc_seq; /* sequence number */ rpc_gss_svc_t gc_svc; /* service */ gss_buffer_desc gc_ctx; /* context handle */ }; /* Context creation response. */ struct rpc_gss_init_res { gss_buffer_desc gr_ctx; /* context handle */ uint32_t gr_major; /* major status */ uint32_t gr_minor; /* minor status */ uint32_t gr_win; /* sequence window */ gss_buffer_desc gr_token; /* token */ }; /* Maximum sequence number value. */ #define MAXSEQ 0x80000000 /* Prototypes. */ bool_t xdr_rpc_gss_buf (XDR *xdrs, gss_buffer_t, u_int maxsize); bool_t xdr_rpc_gss_cred (XDR *xdrs, struct rpc_gss_cred *p); bool_t xdr_rpc_gss_init_args (XDR *xdrs, gss_buffer_desc *p); bool_t xdr_rpc_gss_init_res (XDR *xdrs, struct rpc_gss_init_res *p); bool_t xdr_rpc_gss_data (XDR *xdrs, xdrproc_t xdr_func, caddr_t xdr_ptr, gss_ctx_id_t ctx, gss_qop_t qop, rpc_gss_svc_t svc, uint32_t seq); bool_t xdr_rpc_gss_wrap_data (XDR *xdrs, xdrproc_t xdr_func, caddr_t xdr_ptr, gss_ctx_id_t ctx, gss_qop_t qop, rpc_gss_svc_t svc, uint32_t seq); bool_t xdr_rpc_gss_unwrap_data (XDR *xdrs, xdrproc_t xdr_func, caddr_t xdr_ptr, gss_ctx_id_t ctx, gss_qop_t qop, rpc_gss_svc_t svc, uint32_t seq); AUTH *authgss_create (CLIENT *, gss_name_t, struct rpc_gss_sec *); AUTH *authgss_create_default (CLIENT *, char *, struct rpc_gss_sec *); bool_t authgss_service (AUTH *auth, int svc); bool_t authgss_get_private_data (AUTH *auth, struct authgss_private_data *); #ifdef GSSRPC__IMPL void log_debug (const char *fmt, ...); void log_status (char *m, OM_uint32 major, OM_uint32 minor); void log_hexdump (const u_char *buf, int len, int offset); #endif GSSRPC__END_DECLS #endif /* !defined(GSSRPC_AUTH_GSS_H) */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gssrpc/auth_unix.h����������������������������������������������������������������������������������0000644�����������������00000005520�14763166026�0010237 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)auth_unix.h 2.2 88/07/29 4.0 RPCSRC; from 1.8 88/02/08 SMI */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* @(#)auth_unix.h 1.5 86/07/16 SMI */ /* * auth_unix.h, Protocol for UNIX style authentication parameters for RPC */ #ifndef GSSRPC_AUTH_UNIX_H #define GSSRPC_AUTH_UNIX_H GSSRPC__BEGIN_DECLS /* * The system is very weak. The client uses no encryption for it * credentials and only sends null verifiers. The server sends backs * null verifiers or optionally a verifier that suggests a new short hand * for the credentials. */ /* The machine name is part of a credential; it may not exceed 255 bytes */ #define MAX_MACHINE_NAME 255 /* gids compose part of a credential; there may not be more than 16 of them */ #define NGRPS 16 /* * Unix style credentials. */ struct authunix_parms { uint32_t aup_time; char *aup_machname; int aup_uid; int aup_gid; u_int aup_len; int *aup_gids; }; extern bool_t xdr_authunix_parms(XDR *, struct authunix_parms *); /* * If a response verifier has flavor AUTH_SHORT, * then the body of the response verifier encapsulates the following structure; * again it is serialized in the obvious fashion. */ struct short_hand_verf { struct opaque_auth new_cred; }; GSSRPC__END_DECLS #endif /* !defined(GSSRPC_AUTH_UNIX_H) */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gssrpc/pmap_prot.h����������������������������������������������������������������������������������0000644�����������������00000007401�14763166026�0010234 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)pmap_prot.h 2.1 88/07/29 4.0 RPCSRC; from 1.14 88/02/08 SMI */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * pmap_prot.h * Protocol for the local binder service, or pmap. * * The following procedures are supported by the protocol: * * PMAPPROC_NULL() returns () * takes nothing, returns nothing * * PMAPPROC_SET(struct pmap) returns (bool_t) * TRUE is success, FALSE is failure. Registers the tuple * [prog, vers, prot, port]. * * PMAPPROC_UNSET(struct pmap) returns (bool_t) * TRUE is success, FALSE is failure. Un-registers pair * [prog, vers]. prot and port are ignored. * * PMAPPROC_GETPORT(struct pmap) returns (u_short). * 0 is failure. Otherwise returns the port number where the pair * [prog, vers] is registered. It may lie! * * PMAPPROC_DUMP() RETURNS (struct pmaplist *) * * PMAPPROC_CALLIT(rpcprog_t, rpcvers_t, rpcproc_t, string<>) * RETURNS (port, string<>); * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs); * Calls the procedure on the local machine. If it is not registered, * this procedure is quite; ie it does not return error information!!! * This procedure only is supported on rpc/udp and calls via * rpc/udp. This routine only passes null authentication parameters. * This file has no interface to xdr routines for PMAPPROC_CALLIT. * * The service supports remote procedure calls on udp/ip or tcp/ip socket 111. */ #ifndef GSSRPC_PMAP_PROT_H #define GSSRPC_PMAP_PROT_H GSSRPC__BEGIN_DECLS #define PMAPPORT ((u_short)111) #define PMAPPROG ((rpcprog_t)100000) #define PMAPVERS ((rpcvers_t)2) #define PMAPVERS_PROTO ((rpcprot_t)2) #define PMAPVERS_ORIG ((rpcvers_t)1) #define PMAPPROC_NULL ((rpcproc_t)0) #define PMAPPROC_SET ((rpcproc_t)1) #define PMAPPROC_UNSET ((rpcproc_t)2) #define PMAPPROC_GETPORT ((rpcproc_t)3) #define PMAPPROC_DUMP ((rpcproc_t)4) #define PMAPPROC_CALLIT ((rpcproc_t)5) struct pmap { rpcprog_t pm_prog; rpcvers_t pm_vers; rpcprot_t pm_prot; rpcport_t pm_port; }; extern bool_t xdr_pmap(XDR *, struct pmap *); struct pmaplist { struct pmap pml_map; struct pmaplist *pml_next; }; extern bool_t xdr_pmaplist(XDR *, struct pmaplist **); GSSRPC__END_DECLS #endif /* !defined(GSSRPC_PMAP_PROT_H) */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gssrpc/clnt.h���������������������������������������������������������������������������������������0000644�����������������00000022674�14763166026�0007204 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.31 88/02/08 SMI*/ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * clnt.h - Client side remote procedure call interface. */ #ifndef GSSRPC_CLNT_H #define GSSRPC_CLNT_H GSSRPC__BEGIN_DECLS /* * Rpc calls return an enum clnt_stat. This should be looked at more, * since each implementation is required to live with this (implementation * independent) list of errors. */ enum clnt_stat { RPC_SUCCESS=0, /* call succeeded */ /* * local errors */ RPC_CANTENCODEARGS=1, /* can't encode arguments */ RPC_CANTDECODERES=2, /* can't decode results */ RPC_CANTSEND=3, /* failure in sending call */ RPC_CANTRECV=4, /* failure in receiving result */ RPC_TIMEDOUT=5, /* call timed out */ /* * remote errors */ RPC_VERSMISMATCH=6, /* rpc versions not compatible */ RPC_AUTHERROR=7, /* authentication error */ RPC_PROGUNAVAIL=8, /* program not available */ RPC_PROGVERSMISMATCH=9, /* program version mismatched */ RPC_PROCUNAVAIL=10, /* procedure unavailable */ RPC_CANTDECODEARGS=11, /* decode arguments error */ RPC_SYSTEMERROR=12, /* generic "other problem" */ /* * callrpc & clnt_create errors */ RPC_UNKNOWNHOST=13, /* unknown host name */ RPC_UNKNOWNPROTO=17, /* unkown protocol */ /* * _ create errors */ RPC_PMAPFAILURE=14, /* the pmapper failed in its call */ RPC_PROGNOTREGISTERED=15, /* remote program is not registered */ /* * unspecified error */ RPC_FAILED=16 }; /* * Error info. */ struct rpc_err { enum clnt_stat re_status; union { int RE_errno; /* realated system error */ enum auth_stat RE_why; /* why the auth error occurred */ struct { rpcvers_t low; /* lowest verion supported */ rpcvers_t high; /* highest verion supported */ } RE_vers; struct { /* maybe meaningful if RPC_FAILED */ int32_t s1; int32_t s2; } RE_lb; /* life boot & debugging only */ } ru; #define re_errno ru.RE_errno #define re_why ru.RE_why #define re_vers ru.RE_vers #define re_lb ru.RE_lb }; /* * Client rpc handle. * Created by individual implementations, see e.g. rpc_udp.c. * Client is responsible for initializing auth, see e.g. auth_none.c. */ typedef struct CLIENT { AUTH *cl_auth; /* authenticator */ struct clnt_ops { /* call remote procedure */ enum clnt_stat (*cl_call)(struct CLIENT *, rpcproc_t, xdrproc_t, void *, xdrproc_t, void *, struct timeval); /* abort a call */ void (*cl_abort)(struct CLIENT *); /* get specific error code */ void (*cl_geterr)(struct CLIENT *, struct rpc_err *); /* frees results */ bool_t (*cl_freeres)(struct CLIENT *, xdrproc_t, void *); /* destroy this structure */ void (*cl_destroy)(struct CLIENT *); /* the ioctl() of rpc */ /* XXX CITI makes 2nd arg take u_int */ bool_t (*cl_control)(struct CLIENT *, int, void *); } *cl_ops; void *cl_private; /* private stuff */ } CLIENT; /* * client side rpc interface ops * * Parameter types are: * */ /* * enum clnt_stat * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout) * CLIENT *rh; * rpcproc_t proc; * xdrproc_t xargs; * caddr_t argsp; * xdrproc_t xres; * caddr_t resp; * struct timeval timeout; */ #define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \ ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) #define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \ ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) /* * void * CLNT_ABORT(rh); * CLIENT *rh; */ #define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh)) #define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) /* * struct rpc_err * CLNT_GETERR(rh); * CLIENT *rh; */ #define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) #define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) /* * bool_t * CLNT_FREERES(rh, xres, resp); * CLIENT *rh; * xdrproc_t xres; * caddr_t resp; */ #define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) #define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) /* * bool_t * CLNT_CONTROL(cl, request, info) * CLIENT *cl; * u_int request; * char *info; */ #define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) #define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) /* * control operations that apply to both udp and tcp transports */ #define CLSET_TIMEOUT 1 /* set timeout (timeval) */ #define CLGET_TIMEOUT 2 /* get timeout (timeval) */ #define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */ /* * udp only control operations */ #define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */ #define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ /* * new control operations */ #define CLGET_LOCAL_ADDR 6 /* get local address (sockaddr, getsockname)*/ /* * void * CLNT_DESTROY(rh); * CLIENT *rh; */ #define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) #define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) /* * RPCTEST is a test program which is accessable on every rpc * transport/port. It is used for testing, performance evaluation, * and network administration. */ #define RPCTEST_PROGRAM ((rpcprog_t)1) #define RPCTEST_VERSION ((rpcvers_t)1) #define RPCTEST_NULL_PROC ((rpcproc_t)2) #define RPCTEST_NULL_BATCH_PROC ((rpcproc_t)3) /* * By convention, procedure 0 takes null arguments and returns them */ #define NULLPROC ((rpcproc_t)0) /* * Below are the client handle creation routines for the various * implementations of client side rpc. They can return NULL if a * creation failure occurs. */ /* * Memory based rpc (for speed check and testing) * CLIENT * * clntraw_create(prog, vers) * rpcprog_t prog; * rpcvers_t vers; */ extern CLIENT *clntraw_create(rpcprog_t, rpcvers_t); /* * Generic client creation routine. Supported protocols are "udp" and "tcp" */ extern CLIENT *clnt_create(char *, rpcprog_t, rpcvers_t, char *); /* * TCP based rpc * CLIENT * * clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) * struct sockaddr_in *raddr; * rpcprog_t prog; * rpcvers_t version; * register int *sockp; * u_int sendsz; * u_int recvsz; */ extern CLIENT *clnttcp_create(struct sockaddr_in *, rpcprog_t, rpcvers_t, int *, u_int, u_int); /* * UDP based rpc. * CLIENT * * clntudp_create(raddr, program, version, wait, sockp) * struct sockaddr_in *raddr; * rpcprog_t program; * rpcvers_t version; * struct timeval wait; * int *sockp; * * Same as above, but you specify max packet sizes. * CLIENT * * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz) * struct sockaddr_in *raddr; * rpcprog_t program; * rpcvers_t version; * struct timeval wait; * int *sockp; * u_int sendsz; * u_int recvsz; */ extern CLIENT *clntudp_create(struct sockaddr_in *, rpcprog_t, rpcvers_t, struct timeval, int *); extern CLIENT *clntudp_bufcreate(struct sockaddr_in *, rpcprog_t, rpcvers_t, struct timeval, int *, u_int, u_int); /* * Print why creation failed */ void clnt_pcreateerror(char *); /* stderr */ char *clnt_spcreateerror(char *); /* string */ /* * Like clnt_perror(), but is more verbose in its output */ void clnt_perrno(enum clnt_stat); /* stderr */ /* * Print an English error message, given the client error code */ void clnt_perror(CLIENT *, char *); /* stderr */ char *clnt_sperror(CLIENT *, char *); /* string */ /* * If a creation fails, the following allows the user to figure out why. */ struct rpc_createerr { enum clnt_stat cf_stat; struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */ }; extern struct rpc_createerr rpc_createerr; /* * Copy error message to buffer. */ char *clnt_sperrno(enum clnt_stat num); /* string */ #define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */ #define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ GSSRPC__END_DECLS #endif /* !defined(GSSRPC_CLNT_H) */ ��������������������������������������������������������������������gssrpc/pmap_clnt.h����������������������������������������������������������������������������������0000644�����������������00000006545�14763166026�0010220 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)pmap_clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.11 88/02/08 SMI */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * pmap_clnt.h * Supplies C routines to get to portmap services. */ #ifndef GSSRPC_PMAP_CLNT_H #define GSSRPC_PMAP_CLNT_H /* * Usage: * success = pmap_set(program, version, protocol, port); * success = pmap_unset(program, version); * port = pmap_getport(address, program, version, protocol); * head = pmap_getmaps(address); * clnt_stat = pmap_rmtcall(address, program, version, procedure, * xdrargs, argsp, xdrres, resp, tout, port_ptr) * (works for udp only.) * clnt_stat = clnt_broadcast(program, version, procedure, * xdrargs, argsp, xdrres, resp, eachresult) * (like pmap_rmtcall, except the call is broadcasted to all * locally connected nets. For each valid response received, * the procedure eachresult is called. Its form is: * done = eachresult(resp, raddr) * bool_t done; * caddr_t resp; * struct sockaddr_in raddr; * where resp points to the results of the call and raddr is the * address if the responder to the broadcast. */ GSSRPC__BEGIN_DECLS extern bool_t pmap_set(rpcprog_t, rpcvers_t, rpcprot_t, u_int); extern bool_t pmap_unset(rpcprog_t, rpcvers_t); extern struct pmaplist *pmap_getmaps(struct sockaddr_in *); enum clnt_stat pmap_rmtcall(struct sockaddr_in *, rpcprog_t, rpcvers_t, rpcproc_t, xdrproc_t, caddr_t, xdrproc_t, caddr_t, struct timeval, rpcport_t *); typedef bool_t (*resultproc_t)(caddr_t, struct sockaddr_in *); enum clnt_stat clnt_broadcast(rpcprog_t, rpcvers_t, rpcproc_t, xdrproc_t, caddr_t, xdrproc_t, caddr_t, resultproc_t); extern u_short pmap_getport(struct sockaddr_in *, rpcprog_t, rpcvers_t, rpcprot_t); GSSRPC__END_DECLS #endif /* !defined(GSSRPC_PMAP_CLNT_H) */ �����������������������������������������������������������������������������������������������������������������������������������������������������������gssrpc/netdb.h��������������������������������������������������������������������������������������0000644�����������������00000004612�14763166026�0007330 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* include/gssrpc/netdb.h */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* @(#)netdb.h 2.1 88/07/29 3.9 RPCSRC */ /* @(#)rpc.h 1.8 87/07/24 SMI */ #ifndef RPC_NETDB_H #define RPC_NETDB_H #include <gssrpc/types.h> /* since the gssrpc library requires that any application using it be built with these header files, I am making the decision that any app which uses the rpcent routines must use this header file, or something compatible (which most <netdb.h> are) --marc */ /* Really belongs in <netdb.h> */ #ifdef STRUCT_RPCENT_IN_RPC_NETDB_H struct rpcent { char *r_name; /* name of server for this rpc program */ char **r_aliases; /* alias list */ int r_number; /* rpc program number */ }; #endif /*STRUCT_RPCENT_IN_RPC_NETDB_H*/ struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); #endif ����������������������������������������������������������������������������������������������������������������������gssrpc/svc.h����������������������������������������������������������������������������������������0000644�����������������00000026513�14763166026�0007033 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* @(#)svc.h 2.2 88/07/29 4.0 RPCSRC; from 1.20 88/02/08 SMI */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * svc.h, Server-side remote procedure call interface. */ #ifndef GSSRPC_SVC_H #define GSSRPC_SVC_H #include <gssrpc/svc_auth.h> GSSRPC__BEGIN_DECLS /* * This interface must manage two items concerning remote procedure calling: * * 1) An arbitrary number of transport connections upon which rpc requests * are received. The two most notable transports are TCP and UDP; they are * created and registered by routines in svc_tcp.c and svc_udp.c, respectively; * they in turn call xprt_register and xprt_unregister. * * 2) An arbitrary number of locally registered services. Services are * described by the following four data: program number, version number, * "service dispatch" function, a transport handle, and a boolean that * indicates whether or not the exported program should be registered with a * local binder service; if true the program's number and version and the * port number from the transport handle are registered with the binder. * These data are registered with the rpc svc system via svc_register. * * A service's dispatch function is called whenever an rpc request comes in * on a transport. The request's program and version numbers must match * those of the registered service. The dispatch function is passed two * parameters, struct svc_req * and SVCXPRT *, defined below. */ enum xprt_stat { XPRT_DIED, XPRT_MOREREQS, XPRT_IDLE }; /* * Server side transport handle */ typedef struct SVCXPRT { #ifdef _WIN32 SOCKET xp_sock; #else int xp_sock; #endif u_short xp_port; /* associated port number */ struct xp_ops { /* receive incomming requests */ bool_t (*xp_recv)(struct SVCXPRT *, struct rpc_msg *); /* get transport status */ enum xprt_stat (*xp_stat)(struct SVCXPRT *); /* get arguments */ bool_t (*xp_getargs)(struct SVCXPRT *, xdrproc_t, void *); /* send reply */ bool_t (*xp_reply)(struct SVCXPRT *, struct rpc_msg *); /* free mem allocated for args */ bool_t (*xp_freeargs)(struct SVCXPRT *, xdrproc_t, void *); /* destroy this struct */ void (*xp_destroy)(struct SVCXPRT *); } *xp_ops; int xp_addrlen; /* length of remote address */ struct sockaddr_in xp_raddr; /* remote address */ struct opaque_auth xp_verf; /* raw response verifier */ SVCAUTH *xp_auth; /* auth flavor of current req */ void *xp_p1; /* private */ void *xp_p2; /* private */ int xp_laddrlen; /* lenght of local address */ struct sockaddr_in xp_laddr; /* local address */ } SVCXPRT; /* * Approved way of getting address of caller */ #define svc_getcaller(x) (&(x)->xp_raddr) /* * Operations defined on an SVCXPRT handle * * SVCXPRT *xprt; * struct rpc_msg *msg; * xdrproc_t xargs; * caddr_t argsp; */ #define SVC_RECV(xprt, msg) \ (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) #define svc_recv(xprt, msg) \ (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) #define SVC_STAT(xprt) \ (*(xprt)->xp_ops->xp_stat)(xprt) #define svc_stat(xprt) \ (*(xprt)->xp_ops->xp_stat)(xprt) #define SVC_GETARGS(xprt, xargs, argsp) \ (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) #define svc_getargs(xprt, xargs, argsp) \ (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) #define SVC_GETARGS_REQ(xprt, req, xargs, argsp) \ (*(xprt)->xp_ops->xp_getargs_req)((xprt), (req), (xargs), (argsp)) #define svc_getargs_req(xprt, req, xargs, argsp) \ (*(xprt)->xp_ops->xp_getargs_req)((xprt), (req), (xargs), (argsp)) #define SVC_REPLY(xprt, msg) \ (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) #define svc_reply(xprt, msg) \ (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) #define SVC_REPLY_REQ(xprt, req, msg) \ (*(xprt)->xp_ops->xp_reply_req) ((xprt), (req), (msg)) #define svc_reply_req(xprt, msg) \ (*(xprt)->xp_ops->xp_reply_req) ((xprt), (req), (msg)) #define SVC_FREEARGS(xprt, xargs, argsp) \ (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) #define svc_freeargs(xprt, xargs, argsp) \ (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) #define SVC_DESTROY(xprt) \ (*(xprt)->xp_ops->xp_destroy)(xprt) #define svc_destroy(xprt) \ (*(xprt)->xp_ops->xp_destroy)(xprt) /* * Service request */ struct svc_req { rpcprog_t rq_prog; /* service program number */ rpcvers_t rq_vers; /* service protocol version */ rpcproc_t rq_proc; /* the desired procedure */ struct opaque_auth rq_cred; /* raw creds from the wire */ void * rq_clntcred; /* read only cooked client cred */ void * rq_svccred; /* read only svc cred/context */ void * rq_clntname; /* read only client name */ SVCXPRT *rq_xprt; /* associated transport */ /* The request's auth flavor *should* be here, but the svc_req */ /* isn't passed around everywhere it is necessary. The */ /* transport *is* passed around, so the auth flavor it stored */ /* there. This means that the transport must be single */ /* threaded, but other parts of SunRPC already require that. */ /*SVCAUTH *rq_auth; associated auth flavor */ }; /* * Service registration * * svc_register(xprt, prog, vers, dispatch, protocol) * SVCXPRT *xprt; * rpcprog_t prog; * rpcvers_t vers; * void (*dispatch)(); * int protocol; like IPPROTO_TCP or _UDP; zero means do not register * * registerrpc(prog, vers, proc, routine, inproc, outproc) * returns 0 upon success, -1 if error. */ extern bool_t svc_register(SVCXPRT *, rpcprog_t, rpcvers_t, void (*)(struct svc_req *, SVCXPRT *), int); extern int registerrpc(rpcprog_t, rpcvers_t, rpcproc_t, char *(*)(void *), xdrproc_t, xdrproc_t); /* * Service un-registration * * svc_unregister(prog, vers) * rpcprog_t prog; * rpcvers_t vers; */ extern void svc_unregister(rpcprog_t, rpcvers_t); /* * Transport registration. * * xprt_register(xprt) * SVCXPRT *xprt; */ extern void xprt_register(SVCXPRT *); /* * Transport un-register * * xprt_unregister(xprt) * SVCXPRT *xprt; */ extern void xprt_unregister(SVCXPRT *); /* * When the service routine is called, it must first check to see if * it knows about the procedure; if not, it should call svcerr_noproc * and return. If so, it should deserialize its arguments via * SVC_GETARGS or the new SVC_GETARGS_REQ (both defined above). If * the deserialization does not work, svcerr_decode should be called * followed by a return. Successful decoding of the arguments should * be followed the execution of the procedure's code and a call to * svc_sendreply or the new svc_sendreply_req. * * Also, if the service refuses to execute the procedure due to too- * weak authentication parameters, svcerr_weakauth should be called. * Note: do not confuse access-control failure with weak authentication! * * NB: In pure implementations of rpc, the caller always waits for a reply * msg. This message is sent when svc_sendreply is called. * Therefore pure service implementations should always call * svc_sendreply even if the function logically returns void; use * xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows * for the abuse of pure rpc via batched calling or pipelining. In the * case of a batched call, svc_sendreply should NOT be called since * this would send a return message, which is what batching tries to avoid. * It is the service/protocol writer's responsibility to know which calls are * batched and which are not. Warning: responding to batch calls may * deadlock the caller and server processes! */ extern bool_t svc_sendreply(SVCXPRT *, xdrproc_t, caddr_t); extern void svcerr_decode(SVCXPRT *); extern void svcerr_weakauth(SVCXPRT *); extern void svcerr_noproc(SVCXPRT *); extern void svcerr_progvers(SVCXPRT *, rpcvers_t, rpcvers_t); extern void svcerr_auth(SVCXPRT *, enum auth_stat); extern void svcerr_noprog(SVCXPRT *); extern void svcerr_systemerr(SVCXPRT *); /* * Lowest level dispatching -OR- who owns this process anyway. * Somebody has to wait for incoming requests and then call the correct * service routine. The routine svc_run does infinite waiting; i.e., * svc_run never returns. * Since another (co-existant) package may wish to selectively wait for * incoming calls or other events outside of the rpc architecture, the * routine svc_getreq is provided. It must be passed readfds, the * "in-place" results of a select system call (see select, section 2). */ /* * Global keeper of rpc service descriptors in use * dynamic; must be inspected before each call to select */ extern int svc_maxfd; #ifdef FD_SETSIZE extern fd_set svc_fdset; /* RENAMED */ #define gssrpc_svc_fds gsssrpc_svc_fdset.fds_bits[0] /* compatibility */ #else extern int svc_fds; #endif /* def FD_SETSIZE */ extern int svc_maxfd; /* * a small program implemented by the svc_rpc implementation itself; * also see clnt.h for protocol numbers. */ extern void rpctest_service(); extern void svc_getreq(int); #ifdef FD_SETSIZE extern void svc_getreqset(fd_set *);/* takes fdset instead of int */ extern void svc_getreqset2(fd_set *, int); #else extern void svc_getreqset(int *); #endif extern void svc_run(void); /* never returns */ /* * Socket to use on svcxxx_create call to get default socket */ #define RPC_ANYSOCK -1 /* * These are the existing service side transport implementations */ /* * Memory based rpc for testing and timing. */ extern SVCXPRT *svcraw_create(void); /* * Udp based rpc. */ extern SVCXPRT *svcudp_create(int); extern SVCXPRT *svcudp_bufcreate(int, u_int, u_int); extern int svcudp_enablecache(SVCXPRT *, uint32_t); /* * Tcp based rpc. */ extern SVCXPRT *svctcp_create(int, u_int, u_int); /* * Like svtcp_create(), except the routine takes any *open* UNIX file * descriptor as its first input. */ extern SVCXPRT *svcfd_create(int, u_int, u_int); /* XXX add auth_gsapi_log_*? */ GSSRPC__END_DECLS #endif /* !defined(GSSRPC_SVC_H) */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tiff.h����������������������������������������������������������������������������������������������0000644�����������������00000105710�14763166026�0005664 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tiff.h,v 1.68 2012-08-19 16:56:35 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _TIFF_ #define _TIFF_ #include "tiffconf.h" /* * Tag Image File Format (TIFF) * * Based on Rev 6.0 from: * Developer's Desk * Aldus Corporation * 411 First Ave. South * Suite 200 * Seattle, WA 98104 * 206-622-5500 * * (http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf) * * For BigTIFF design notes see the following links * http://www.remotesensing.org/libtiff/bigtiffdesign.html * http://www.awaresystems.be/imaging/tiff/bigtiff.html */ #define TIFF_VERSION_CLASSIC 42 #define TIFF_VERSION_BIG 43 #define TIFF_BIGENDIAN 0x4d4d #define TIFF_LITTLEENDIAN 0x4949 #define MDI_LITTLEENDIAN 0x5045 #define MDI_BIGENDIAN 0x4550 /* * Intrinsic data types required by the file format: * * 8-bit quantities int8/uint8 * 16-bit quantities int16/uint16 * 32-bit quantities int32/uint32 * 64-bit quantities int64/uint64 * strings unsigned char* */ typedef TIFF_INT8_T int8; typedef TIFF_UINT8_T uint8; typedef TIFF_INT16_T int16; typedef TIFF_UINT16_T uint16; typedef TIFF_INT32_T int32; typedef TIFF_UINT32_T uint32; typedef TIFF_INT64_T int64; typedef TIFF_UINT64_T uint64; /* * Some types as promoted in a variable argument list * We use uint16_vap rather then directly using int, because this way * we document the type we actually want to pass through, conceptually, * rather then confusing the issue by merely stating the type it gets * promoted to */ typedef int uint16_vap; /* * TIFF header. */ typedef struct { uint16 tiff_magic; /* magic number (defines byte order) */ uint16 tiff_version; /* TIFF version number */ } TIFFHeaderCommon; typedef struct { uint16 tiff_magic; /* magic number (defines byte order) */ uint16 tiff_version; /* TIFF version number */ uint32 tiff_diroff; /* byte offset to first directory */ } TIFFHeaderClassic; typedef struct { uint16 tiff_magic; /* magic number (defines byte order) */ uint16 tiff_version; /* TIFF version number */ uint16 tiff_offsetsize; /* size of offsets, should be 8 */ uint16 tiff_unused; /* unused word, should be 0 */ uint64 tiff_diroff; /* byte offset to first directory */ } TIFFHeaderBig; /* * NB: In the comments below, * - items marked with a + are obsoleted by revision 5.0, * - items marked with a ! are introduced in revision 6.0. * - items marked with a % are introduced post revision 6.0. * - items marked with a $ are obsoleted by revision 6.0. * - items marked with a & are introduced by Adobe DNG specification. */ /* * Tag data type information. * * Note: RATIONALs are the ratio of two 32-bit integer values. */ typedef enum { TIFF_NOTYPE = 0, /* placeholder */ TIFF_BYTE = 1, /* 8-bit unsigned integer */ TIFF_ASCII = 2, /* 8-bit bytes w/ last byte null */ TIFF_SHORT = 3, /* 16-bit unsigned integer */ TIFF_LONG = 4, /* 32-bit unsigned integer */ TIFF_RATIONAL = 5, /* 64-bit unsigned fraction */ TIFF_SBYTE = 6, /* !8-bit signed integer */ TIFF_UNDEFINED = 7, /* !8-bit untyped data */ TIFF_SSHORT = 8, /* !16-bit signed integer */ TIFF_SLONG = 9, /* !32-bit signed integer */ TIFF_SRATIONAL = 10, /* !64-bit signed fraction */ TIFF_FLOAT = 11, /* !32-bit IEEE floating point */ TIFF_DOUBLE = 12, /* !64-bit IEEE floating point */ TIFF_IFD = 13, /* %32-bit unsigned integer (offset) */ TIFF_LONG8 = 16, /* BigTIFF 64-bit unsigned integer */ TIFF_SLONG8 = 17, /* BigTIFF 64-bit signed integer */ TIFF_IFD8 = 18 /* BigTIFF 64-bit unsigned integer (offset) */ } TIFFDataType; /* * TIFF Tag Definitions. */ #define TIFFTAG_SUBFILETYPE 254 /* subfile data descriptor */ #define FILETYPE_REDUCEDIMAGE 0x1 /* reduced resolution version */ #define FILETYPE_PAGE 0x2 /* one page of many */ #define FILETYPE_MASK 0x4 /* transparency mask */ #define TIFFTAG_OSUBFILETYPE 255 /* +kind of data in subfile */ #define OFILETYPE_IMAGE 1 /* full resolution image data */ #define OFILETYPE_REDUCEDIMAGE 2 /* reduced size image data */ #define OFILETYPE_PAGE 3 /* one page of many */ #define TIFFTAG_IMAGEWIDTH 256 /* image width in pixels */ #define TIFFTAG_IMAGELENGTH 257 /* image height in pixels */ #define TIFFTAG_BITSPERSAMPLE 258 /* bits per channel (sample) */ #define TIFFTAG_COMPRESSION 259 /* data compression technique */ #define COMPRESSION_NONE 1 /* dump mode */ #define COMPRESSION_CCITTRLE 2 /* CCITT modified Huffman RLE */ #define COMPRESSION_CCITTFAX3 3 /* CCITT Group 3 fax encoding */ #define COMPRESSION_CCITT_T4 3 /* CCITT T.4 (TIFF 6 name) */ #define COMPRESSION_CCITTFAX4 4 /* CCITT Group 4 fax encoding */ #define COMPRESSION_CCITT_T6 4 /* CCITT T.6 (TIFF 6 name) */ #define COMPRESSION_LZW 5 /* Lempel-Ziv & Welch */ #define COMPRESSION_OJPEG 6 /* !6.0 JPEG */ #define COMPRESSION_JPEG 7 /* %JPEG DCT compression */ #define COMPRESSION_T85 9 /* !TIFF/FX T.85 JBIG compression */ #define COMPRESSION_T43 10 /* !TIFF/FX T.43 colour by layered JBIG compression */ #define COMPRESSION_NEXT 32766 /* NeXT 2-bit RLE */ #define COMPRESSION_CCITTRLEW 32771 /* #1 w/ word alignment */ #define COMPRESSION_PACKBITS 32773 /* Macintosh RLE */ #define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */ /* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */ #define COMPRESSION_IT8CTPAD 32895 /* IT8 CT w/padding */ #define COMPRESSION_IT8LW 32896 /* IT8 Linework RLE */ #define COMPRESSION_IT8MP 32897 /* IT8 Monochrome picture */ #define COMPRESSION_IT8BL 32898 /* IT8 Binary line art */ /* compression codes 32908-32911 are reserved for Pixar */ #define COMPRESSION_PIXARFILM 32908 /* Pixar companded 10bit LZW */ #define COMPRESSION_PIXARLOG 32909 /* Pixar companded 11bit ZIP */ #define COMPRESSION_DEFLATE 32946 /* Deflate compression */ #define COMPRESSION_ADOBE_DEFLATE 8 /* Deflate compression, as recognized by Adobe */ /* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> */ #define COMPRESSION_DCS 32947 /* Kodak DCS encoding */ #define COMPRESSION_JBIG 34661 /* ISO JBIG */ #define COMPRESSION_SGILOG 34676 /* SGI Log Luminance RLE */ #define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */ #define COMPRESSION_JP2000 34712 /* Leadtools JPEG2000 */ #define COMPRESSION_LZMA 34925 /* LZMA2 */ #define TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */ #define PHOTOMETRIC_MINISWHITE 0 /* min value is white */ #define PHOTOMETRIC_MINISBLACK 1 /* min value is black */ #define PHOTOMETRIC_RGB 2 /* RGB color model */ #define PHOTOMETRIC_PALETTE 3 /* color map indexed */ #define PHOTOMETRIC_MASK 4 /* $holdout mask */ #define PHOTOMETRIC_SEPARATED 5 /* !color separations */ #define PHOTOMETRIC_YCBCR 6 /* !CCIR 601 */ #define PHOTOMETRIC_CIELAB 8 /* !1976 CIE L*a*b* */ #define PHOTOMETRIC_ICCLAB 9 /* ICC L*a*b* [Adobe TIFF Technote 4] */ #define PHOTOMETRIC_ITULAB 10 /* ITU L*a*b* */ #define PHOTOMETRIC_LOGL 32844 /* CIE Log2(L) */ #define PHOTOMETRIC_LOGLUV 32845 /* CIE Log2(L) (u',v') */ #define TIFFTAG_THRESHHOLDING 263 /* +thresholding used on data */ #define THRESHHOLD_BILEVEL 1 /* b&w art scan */ #define THRESHHOLD_HALFTONE 2 /* or dithered scan */ #define THRESHHOLD_ERRORDIFFUSE 3 /* usually floyd-steinberg */ #define TIFFTAG_CELLWIDTH 264 /* +dithering matrix width */ #define TIFFTAG_CELLLENGTH 265 /* +dithering matrix height */ #define TIFFTAG_FILLORDER 266 /* data order within a byte */ #define FILLORDER_MSB2LSB 1 /* most significant -> least */ #define FILLORDER_LSB2MSB 2 /* least significant -> most */ #define TIFFTAG_DOCUMENTNAME 269 /* name of doc. image is from */ #define TIFFTAG_IMAGEDESCRIPTION 270 /* info about image */ #define TIFFTAG_MAKE 271 /* scanner manufacturer name */ #define TIFFTAG_MODEL 272 /* scanner model name/number */ #define TIFFTAG_STRIPOFFSETS 273 /* offsets to data strips */ #define TIFFTAG_ORIENTATION 274 /* +image orientation */ #define ORIENTATION_TOPLEFT 1 /* row 0 top, col 0 lhs */ #define ORIENTATION_TOPRIGHT 2 /* row 0 top, col 0 rhs */ #define ORIENTATION_BOTRIGHT 3 /* row 0 bottom, col 0 rhs */ #define ORIENTATION_BOTLEFT 4 /* row 0 bottom, col 0 lhs */ #define ORIENTATION_LEFTTOP 5 /* row 0 lhs, col 0 top */ #define ORIENTATION_RIGHTTOP 6 /* row 0 rhs, col 0 top */ #define ORIENTATION_RIGHTBOT 7 /* row 0 rhs, col 0 bottom */ #define ORIENTATION_LEFTBOT 8 /* row 0 lhs, col 0 bottom */ #define TIFFTAG_SAMPLESPERPIXEL 277 /* samples per pixel */ #define TIFFTAG_ROWSPERSTRIP 278 /* rows per strip of data */ #define TIFFTAG_STRIPBYTECOUNTS 279 /* bytes counts for strips */ #define TIFFTAG_MINSAMPLEVALUE 280 /* +minimum sample value */ #define TIFFTAG_MAXSAMPLEVALUE 281 /* +maximum sample value */ #define TIFFTAG_XRESOLUTION 282 /* pixels/resolution in x */ #define TIFFTAG_YRESOLUTION 283 /* pixels/resolution in y */ #define TIFFTAG_PLANARCONFIG 284 /* storage organization */ #define PLANARCONFIG_CONTIG 1 /* single image plane */ #define PLANARCONFIG_SEPARATE 2 /* separate planes of data */ #define TIFFTAG_PAGENAME 285 /* page name image is from */ #define TIFFTAG_XPOSITION 286 /* x page offset of image lhs */ #define TIFFTAG_YPOSITION 287 /* y page offset of image lhs */ #define TIFFTAG_FREEOFFSETS 288 /* +byte offset to free block */ #define TIFFTAG_FREEBYTECOUNTS 289 /* +sizes of free blocks */ #define TIFFTAG_GRAYRESPONSEUNIT 290 /* $gray scale curve accuracy */ #define GRAYRESPONSEUNIT_10S 1 /* tenths of a unit */ #define GRAYRESPONSEUNIT_100S 2 /* hundredths of a unit */ #define GRAYRESPONSEUNIT_1000S 3 /* thousandths of a unit */ #define GRAYRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */ #define GRAYRESPONSEUNIT_100000S 5 /* hundred-thousandths */ #define TIFFTAG_GRAYRESPONSECURVE 291 /* $gray scale response curve */ #define TIFFTAG_GROUP3OPTIONS 292 /* 32 flag bits */ #define TIFFTAG_T4OPTIONS 292 /* TIFF 6.0 proper name alias */ #define GROUP3OPT_2DENCODING 0x1 /* 2-dimensional coding */ #define GROUP3OPT_UNCOMPRESSED 0x2 /* data not compressed */ #define GROUP3OPT_FILLBITS 0x4 /* fill to byte boundary */ #define TIFFTAG_GROUP4OPTIONS 293 /* 32 flag bits */ #define TIFFTAG_T6OPTIONS 293 /* TIFF 6.0 proper name */ #define GROUP4OPT_UNCOMPRESSED 0x2 /* data not compressed */ #define TIFFTAG_RESOLUTIONUNIT 296 /* units of resolutions */ #define RESUNIT_NONE 1 /* no meaningful units */ #define RESUNIT_INCH 2 /* english */ #define RESUNIT_CENTIMETER 3 /* metric */ #define TIFFTAG_PAGENUMBER 297 /* page numbers of multi-page */ #define TIFFTAG_COLORRESPONSEUNIT 300 /* $color curve accuracy */ #define COLORRESPONSEUNIT_10S 1 /* tenths of a unit */ #define COLORRESPONSEUNIT_100S 2 /* hundredths of a unit */ #define COLORRESPONSEUNIT_1000S 3 /* thousandths of a unit */ #define COLORRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */ #define COLORRESPONSEUNIT_100000S 5 /* hundred-thousandths */ #define TIFFTAG_TRANSFERFUNCTION 301 /* !colorimetry info */ #define TIFFTAG_SOFTWARE 305 /* name & release */ #define TIFFTAG_DATETIME 306 /* creation date and time */ #define TIFFTAG_ARTIST 315 /* creator of image */ #define TIFFTAG_HOSTCOMPUTER 316 /* machine where created */ #define TIFFTAG_PREDICTOR 317 /* prediction scheme w/ LZW */ #define PREDICTOR_NONE 1 /* no prediction scheme used */ #define PREDICTOR_HORIZONTAL 2 /* horizontal differencing */ #define PREDICTOR_FLOATINGPOINT 3 /* floating point predictor */ #define TIFFTAG_WHITEPOINT 318 /* image white point */ #define TIFFTAG_PRIMARYCHROMATICITIES 319 /* !primary chromaticities */ #define TIFFTAG_COLORMAP 320 /* RGB map for pallette image */ #define TIFFTAG_HALFTONEHINTS 321 /* !highlight+shadow info */ #define TIFFTAG_TILEWIDTH 322 /* !tile width in pixels */ #define TIFFTAG_TILELENGTH 323 /* !tile height in pixels */ #define TIFFTAG_TILEOFFSETS 324 /* !offsets to data tiles */ #define TIFFTAG_TILEBYTECOUNTS 325 /* !byte counts for tiles */ #define TIFFTAG_BADFAXLINES 326 /* lines w/ wrong pixel count */ #define TIFFTAG_CLEANFAXDATA 327 /* regenerated line info */ #define CLEANFAXDATA_CLEAN 0 /* no errors detected */ #define CLEANFAXDATA_REGENERATED 1 /* receiver regenerated lines */ #define CLEANFAXDATA_UNCLEAN 2 /* uncorrected errors exist */ #define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */ #define TIFFTAG_SUBIFD 330 /* subimage descriptors */ #define TIFFTAG_INKSET 332 /* !inks in separated image */ #define INKSET_CMYK 1 /* !cyan-magenta-yellow-black color */ #define INKSET_MULTIINK 2 /* !multi-ink or hi-fi color */ #define TIFFTAG_INKNAMES 333 /* !ascii names of inks */ #define TIFFTAG_NUMBEROFINKS 334 /* !number of inks */ #define TIFFTAG_DOTRANGE 336 /* !0% and 100% dot codes */ #define TIFFTAG_TARGETPRINTER 337 /* !separation target */ #define TIFFTAG_EXTRASAMPLES 338 /* !info about extra samples */ #define EXTRASAMPLE_UNSPECIFIED 0 /* !unspecified data */ #define EXTRASAMPLE_ASSOCALPHA 1 /* !associated alpha data */ #define EXTRASAMPLE_UNASSALPHA 2 /* !unassociated alpha data */ #define TIFFTAG_SAMPLEFORMAT 339 /* !data sample format */ #define SAMPLEFORMAT_UINT 1 /* !unsigned integer data */ #define SAMPLEFORMAT_INT 2 /* !signed integer data */ #define SAMPLEFORMAT_IEEEFP 3 /* !IEEE floating point data */ #define SAMPLEFORMAT_VOID 4 /* !untyped data */ #define SAMPLEFORMAT_COMPLEXINT 5 /* !complex signed int */ #define SAMPLEFORMAT_COMPLEXIEEEFP 6 /* !complex ieee floating */ #define TIFFTAG_SMINSAMPLEVALUE 340 /* !variable MinSampleValue */ #define TIFFTAG_SMAXSAMPLEVALUE 341 /* !variable MaxSampleValue */ #define TIFFTAG_CLIPPATH 343 /* %ClipPath [Adobe TIFF technote 2] */ #define TIFFTAG_XCLIPPATHUNITS 344 /* %XClipPathUnits [Adobe TIFF technote 2] */ #define TIFFTAG_YCLIPPATHUNITS 345 /* %YClipPathUnits [Adobe TIFF technote 2] */ #define TIFFTAG_INDEXED 346 /* %Indexed [Adobe TIFF Technote 3] */ #define TIFFTAG_JPEGTABLES 347 /* %JPEG table stream */ #define TIFFTAG_OPIPROXY 351 /* %OPI Proxy [Adobe TIFF technote] */ /* Tags 400-435 are from the TIFF/FX spec */ #define TIFFTAG_GLOBALPARAMETERSIFD 400 /* ! */ #define TIFFTAG_PROFILETYPE 401 /* ! */ #define PROFILETYPE_UNSPECIFIED 0 /* ! */ #define PROFILETYPE_G3_FAX 1 /* ! */ #define TIFFTAG_FAXPROFILE 402 /* ! */ #define FAXPROFILE_S 1 /* !TIFF/FX FAX profile S */ #define FAXPROFILE_F 2 /* !TIFF/FX FAX profile F */ #define FAXPROFILE_J 3 /* !TIFF/FX FAX profile J */ #define FAXPROFILE_C 4 /* !TIFF/FX FAX profile C */ #define FAXPROFILE_L 5 /* !TIFF/FX FAX profile L */ #define FAXPROFILE_M 6 /* !TIFF/FX FAX profile LM */ #define TIFFTAG_CODINGMETHODS 403 /* !TIFF/FX coding methods */ #define CODINGMETHODS_T4_1D (1 << 1) /* !T.4 1D */ #define CODINGMETHODS_T4_2D (1 << 2) /* !T.4 2D */ #define CODINGMETHODS_T6 (1 << 3) /* !T.6 */ #define CODINGMETHODS_T85 (1 << 4) /* !T.85 JBIG */ #define CODINGMETHODS_T42 (1 << 5) /* !T.42 JPEG */ #define CODINGMETHODS_T43 (1 << 6) /* !T.43 colour by layered JBIG */ #define TIFFTAG_VERSIONYEAR 404 /* !TIFF/FX version year */ #define TIFFTAG_MODENUMBER 405 /* !TIFF/FX mode number */ #define TIFFTAG_DECODE 433 /* !TIFF/FX decode */ #define TIFFTAG_IMAGEBASECOLOR 434 /* !TIFF/FX image base colour */ #define TIFFTAG_T82OPTIONS 435 /* !TIFF/FX T.82 options */ /* * Tags 512-521 are obsoleted by Technical Note #2 which specifies a * revised JPEG-in-TIFF scheme. */ #define TIFFTAG_JPEGPROC 512 /* !JPEG processing algorithm */ #define JPEGPROC_BASELINE 1 /* !baseline sequential */ #define JPEGPROC_LOSSLESS 14 /* !Huffman coded lossless */ #define TIFFTAG_JPEGIFOFFSET 513 /* !pointer to SOI marker */ #define TIFFTAG_JPEGIFBYTECOUNT 514 /* !JFIF stream length */ #define TIFFTAG_JPEGRESTARTINTERVAL 515 /* !restart interval length */ #define TIFFTAG_JPEGLOSSLESSPREDICTORS 517 /* !lossless proc predictor */ #define TIFFTAG_JPEGPOINTTRANSFORM 518 /* !lossless point transform */ #define TIFFTAG_JPEGQTABLES 519 /* !Q matrice offsets */ #define TIFFTAG_JPEGDCTABLES 520 /* !DCT table offsets */ #define TIFFTAG_JPEGACTABLES 521 /* !AC coefficient offsets */ #define TIFFTAG_YCBCRCOEFFICIENTS 529 /* !RGB -> YCbCr transform */ #define TIFFTAG_YCBCRSUBSAMPLING 530 /* !YCbCr subsampling factors */ #define TIFFTAG_YCBCRPOSITIONING 531 /* !subsample positioning */ #define YCBCRPOSITION_CENTERED 1 /* !as in PostScript Level 2 */ #define YCBCRPOSITION_COSITED 2 /* !as in CCIR 601-1 */ #define TIFFTAG_REFERENCEBLACKWHITE 532 /* !colorimetry info */ #define TIFFTAG_STRIPROWCOUNTS 559 /* !TIFF/FX strip row counts */ #define TIFFTAG_XMLPACKET 700 /* %XML packet [Adobe XMP Specification, January 2004 */ #define TIFFTAG_OPIIMAGEID 32781 /* %OPI ImageID [Adobe TIFF technote] */ /* tags 32952-32956 are private tags registered to Island Graphics */ #define TIFFTAG_REFPTS 32953 /* image reference points */ #define TIFFTAG_REGIONTACKPOINT 32954 /* region-xform tack point */ #define TIFFTAG_REGIONWARPCORNERS 32955 /* warp quadrilateral */ #define TIFFTAG_REGIONAFFINE 32956 /* affine transformation mat */ /* tags 32995-32999 are private tags registered to SGI */ #define TIFFTAG_MATTEING 32995 /* $use ExtraSamples */ #define TIFFTAG_DATATYPE 32996 /* $use SampleFormat */ #define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */ #define TIFFTAG_TILEDEPTH 32998 /* z depth/data tile */ /* tags 33300-33309 are private tags registered to Pixar */ /* * TIFFTAG_PIXAR_IMAGEFULLWIDTH and TIFFTAG_PIXAR_IMAGEFULLLENGTH * are set when an image has been cropped out of a larger image. * They reflect the size of the original uncropped image. * The TIFFTAG_XPOSITION and TIFFTAG_YPOSITION can be used * to determine the position of the smaller image in the larger one. */ #define TIFFTAG_PIXAR_IMAGEFULLWIDTH 33300 /* full image size in x */ #define TIFFTAG_PIXAR_IMAGEFULLLENGTH 33301 /* full image size in y */ /* Tags 33302-33306 are used to identify special image modes and data * used by Pixar's texture formats. */ #define TIFFTAG_PIXAR_TEXTUREFORMAT 33302 /* texture map format */ #define TIFFTAG_PIXAR_WRAPMODES 33303 /* s & t wrap modes */ #define TIFFTAG_PIXAR_FOVCOT 33304 /* cotan(fov) for env. maps */ #define TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN 33305 #define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306 /* tag 33405 is a private tag registered to Eastman Kodak */ #define TIFFTAG_WRITERSERIALNUMBER 33405 /* device serial number */ /* tag 33432 is listed in the 6.0 spec w/ unknown ownership */ #define TIFFTAG_COPYRIGHT 33432 /* copyright string */ /* IPTC TAG from RichTIFF specifications */ #define TIFFTAG_RICHTIFFIPTC 33723 /* 34016-34029 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */ #define TIFFTAG_IT8SITE 34016 /* site name */ #define TIFFTAG_IT8COLORSEQUENCE 34017 /* color seq. [RGB,CMYK,etc] */ #define TIFFTAG_IT8HEADER 34018 /* DDES Header */ #define TIFFTAG_IT8RASTERPADDING 34019 /* raster scanline padding */ #define TIFFTAG_IT8BITSPERRUNLENGTH 34020 /* # of bits in short run */ #define TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH 34021/* # of bits in long run */ #define TIFFTAG_IT8COLORTABLE 34022 /* LW colortable */ #define TIFFTAG_IT8IMAGECOLORINDICATOR 34023 /* BP/BL image color switch */ #define TIFFTAG_IT8BKGCOLORINDICATOR 34024 /* BP/BL bg color switch */ #define TIFFTAG_IT8IMAGECOLORVALUE 34025 /* BP/BL image color value */ #define TIFFTAG_IT8BKGCOLORVALUE 34026 /* BP/BL bg color value */ #define TIFFTAG_IT8PIXELINTENSITYRANGE 34027 /* MP pixel intensity value */ #define TIFFTAG_IT8TRANSPARENCYINDICATOR 34028 /* HC transparency switch */ #define TIFFTAG_IT8COLORCHARACTERIZATION 34029 /* color character. table */ #define TIFFTAG_IT8HCUSAGE 34030 /* HC usage indicator */ #define TIFFTAG_IT8TRAPINDICATOR 34031 /* Trapping indicator (untrapped=0, trapped=1) */ #define TIFFTAG_IT8CMYKEQUIVALENT 34032 /* CMYK color equivalents */ /* tags 34232-34236 are private tags registered to Texas Instruments */ #define TIFFTAG_FRAMECOUNT 34232 /* Sequence Frame Count */ /* tag 34377 is private tag registered to Adobe for PhotoShop */ #define TIFFTAG_PHOTOSHOP 34377 /* tags 34665, 34853 and 40965 are documented in EXIF specification */ #define TIFFTAG_EXIFIFD 34665 /* Pointer to EXIF private directory */ /* tag 34750 is a private tag registered to Adobe? */ #define TIFFTAG_ICCPROFILE 34675 /* ICC profile data */ #define TIFFTAG_IMAGELAYER 34732 /* !TIFF/FX image layer information */ /* tag 34750 is a private tag registered to Pixel Magic */ #define TIFFTAG_JBIGOPTIONS 34750 /* JBIG options */ #define TIFFTAG_GPSIFD 34853 /* Pointer to GPS private directory */ /* tags 34908-34914 are private tags registered to SGI */ #define TIFFTAG_FAXRECVPARAMS 34908 /* encoded Class 2 ses. parms */ #define TIFFTAG_FAXSUBADDRESS 34909 /* received SubAddr string */ #define TIFFTAG_FAXRECVTIME 34910 /* receive time (secs) */ #define TIFFTAG_FAXDCS 34911 /* encoded fax ses. params, Table 2/T.30 */ /* tags 37439-37443 are registered to SGI <gregl@sgi.com> */ #define TIFFTAG_STONITS 37439 /* Sample value to Nits */ /* tag 34929 is a private tag registered to FedEx */ #define TIFFTAG_FEDEX_EDR 34929 /* unknown use */ #define TIFFTAG_INTEROPERABILITYIFD 40965 /* Pointer to Interoperability private directory */ /* Adobe Digital Negative (DNG) format tags */ #define TIFFTAG_DNGVERSION 50706 /* &DNG version number */ #define TIFFTAG_DNGBACKWARDVERSION 50707 /* &DNG compatibility version */ #define TIFFTAG_UNIQUECAMERAMODEL 50708 /* &name for the camera model */ #define TIFFTAG_LOCALIZEDCAMERAMODEL 50709 /* &localized camera model name */ #define TIFFTAG_CFAPLANECOLOR 50710 /* &CFAPattern->LinearRaw space mapping */ #define TIFFTAG_CFALAYOUT 50711 /* &spatial layout of the CFA */ #define TIFFTAG_LINEARIZATIONTABLE 50712 /* &lookup table description */ #define TIFFTAG_BLACKLEVELREPEATDIM 50713 /* &repeat pattern size for the BlackLevel tag */ #define TIFFTAG_BLACKLEVEL 50714 /* &zero light encoding level */ #define TIFFTAG_BLACKLEVELDELTAH 50715 /* &zero light encoding level differences (columns) */ #define TIFFTAG_BLACKLEVELDELTAV 50716 /* &zero light encoding level differences (rows) */ #define TIFFTAG_WHITELEVEL 50717 /* &fully saturated encoding level */ #define TIFFTAG_DEFAULTSCALE 50718 /* &default scale factors */ #define TIFFTAG_DEFAULTCROPORIGIN 50719 /* &origin of the final image area */ #define TIFFTAG_DEFAULTCROPSIZE 50720 /* &size of the final image area */ #define TIFFTAG_COLORMATRIX1 50721 /* &XYZ->reference color space transformation matrix 1 */ #define TIFFTAG_COLORMATRIX2 50722 /* &XYZ->reference color space transformation matrix 2 */ #define TIFFTAG_CAMERACALIBRATION1 50723 /* &calibration matrix 1 */ #define TIFFTAG_CAMERACALIBRATION2 50724 /* &calibration matrix 2 */ #define TIFFTAG_REDUCTIONMATRIX1 50725 /* &dimensionality reduction matrix 1 */ #define TIFFTAG_REDUCTIONMATRIX2 50726 /* &dimensionality reduction matrix 2 */ #define TIFFTAG_ANALOGBALANCE 50727 /* &gain applied the stored raw values*/ #define TIFFTAG_ASSHOTNEUTRAL 50728 /* &selected white balance in linear reference space */ #define TIFFTAG_ASSHOTWHITEXY 50729 /* &selected white balance in x-y chromaticity coordinates */ #define TIFFTAG_BASELINEEXPOSURE 50730 /* &how much to move the zero point */ #define TIFFTAG_BASELINENOISE 50731 /* &relative noise level */ #define TIFFTAG_BASELINESHARPNESS 50732 /* &relative amount of sharpening */ #define TIFFTAG_BAYERGREENSPLIT 50733 /* &how closely the values of the green pixels in the blue/green rows track the values of the green pixels in the red/green rows */ #define TIFFTAG_LINEARRESPONSELIMIT 50734 /* &non-linear encoding range */ #define TIFFTAG_CAMERASERIALNUMBER 50735 /* &camera's serial number */ #define TIFFTAG_LENSINFO 50736 /* info about the lens */ #define TIFFTAG_CHROMABLURRADIUS 50737 /* &chroma blur radius */ #define TIFFTAG_ANTIALIASSTRENGTH 50738 /* &relative strength of the camera's anti-alias filter */ #define TIFFTAG_SHADOWSCALE 50739 /* &used by Adobe Camera Raw */ #define TIFFTAG_DNGPRIVATEDATA 50740 /* &manufacturer's private data */ #define TIFFTAG_MAKERNOTESAFETY 50741 /* &whether the EXIF MakerNote tag is safe to preserve along with the rest of the EXIF data */ #define TIFFTAG_CALIBRATIONILLUMINANT1 50778 /* &illuminant 1 */ #define TIFFTAG_CALIBRATIONILLUMINANT2 50779 /* &illuminant 2 */ #define TIFFTAG_BESTQUALITYSCALE 50780 /* &best quality multiplier */ #define TIFFTAG_RAWDATAUNIQUEID 50781 /* &unique identifier for the raw image data */ #define TIFFTAG_ORIGINALRAWFILENAME 50827 /* &file name of the original raw file */ #define TIFFTAG_ORIGINALRAWFILEDATA 50828 /* &contents of the original raw file */ #define TIFFTAG_ACTIVEAREA 50829 /* &active (non-masked) pixels of the sensor */ #define TIFFTAG_MASKEDAREAS 50830 /* &list of coordinates of fully masked pixels */ #define TIFFTAG_ASSHOTICCPROFILE 50831 /* &these two tags used to */ #define TIFFTAG_ASSHOTPREPROFILEMATRIX 50832 /* map cameras's color space into ICC profile space */ #define TIFFTAG_CURRENTICCPROFILE 50833 /* & */ #define TIFFTAG_CURRENTPREPROFILEMATRIX 50834 /* & */ /* tag 65535 is an undefined tag used by Eastman Kodak */ #define TIFFTAG_DCSHUESHIFTVALUES 65535 /* hue shift correction data */ /* * The following are ``pseudo tags'' that can be used to control * codec-specific functionality. These tags are not written to file. * Note that these values start at 0xffff+1 so that they'll never * collide with Aldus-assigned tags. * * If you want your private pseudo tags ``registered'' (i.e. added to * this file), please post a bug report via the tracking system at * http://www.remotesensing.org/libtiff/bugs.html with the appropriate * C definitions to add. */ #define TIFFTAG_FAXMODE 65536 /* Group 3/4 format control */ #define FAXMODE_CLASSIC 0x0000 /* default, include RTC */ #define FAXMODE_NORTC 0x0001 /* no RTC at end of data */ #define FAXMODE_NOEOL 0x0002 /* no EOL code at end of row */ #define FAXMODE_BYTEALIGN 0x0004 /* byte align row */ #define FAXMODE_WORDALIGN 0x0008 /* word align row */ #define FAXMODE_CLASSF FAXMODE_NORTC /* TIFF Class F */ #define TIFFTAG_JPEGQUALITY 65537 /* Compression quality level */ /* Note: quality level is on the IJG 0-100 scale. Default value is 75 */ #define TIFFTAG_JPEGCOLORMODE 65538 /* Auto RGB<=>YCbCr convert? */ #define JPEGCOLORMODE_RAW 0x0000 /* no conversion (default) */ #define JPEGCOLORMODE_RGB 0x0001 /* do auto conversion */ #define TIFFTAG_JPEGTABLESMODE 65539 /* What to put in JPEGTables */ #define JPEGTABLESMODE_QUANT 0x0001 /* include quantization tbls */ #define JPEGTABLESMODE_HUFF 0x0002 /* include Huffman tbls */ /* Note: default is JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF */ #define TIFFTAG_FAXFILLFUNC 65540 /* G3/G4 fill function */ #define TIFFTAG_PIXARLOGDATAFMT 65549 /* PixarLogCodec I/O data sz */ #define PIXARLOGDATAFMT_8BIT 0 /* regular u_char samples */ #define PIXARLOGDATAFMT_8BITABGR 1 /* ABGR-order u_chars */ #define PIXARLOGDATAFMT_11BITLOG 2 /* 11-bit log-encoded (raw) */ #define PIXARLOGDATAFMT_12BITPICIO 3 /* as per PICIO (1.0==2048) */ #define PIXARLOGDATAFMT_16BIT 4 /* signed short samples */ #define PIXARLOGDATAFMT_FLOAT 5 /* IEEE float samples */ /* 65550-65556 are allocated to Oceana Matrix <dev@oceana.com> */ #define TIFFTAG_DCSIMAGERTYPE 65550 /* imager model & filter */ #define DCSIMAGERMODEL_M3 0 /* M3 chip (1280 x 1024) */ #define DCSIMAGERMODEL_M5 1 /* M5 chip (1536 x 1024) */ #define DCSIMAGERMODEL_M6 2 /* M6 chip (3072 x 2048) */ #define DCSIMAGERFILTER_IR 0 /* infrared filter */ #define DCSIMAGERFILTER_MONO 1 /* monochrome filter */ #define DCSIMAGERFILTER_CFA 2 /* color filter array */ #define DCSIMAGERFILTER_OTHER 3 /* other filter */ #define TIFFTAG_DCSINTERPMODE 65551 /* interpolation mode */ #define DCSINTERPMODE_NORMAL 0x0 /* whole image, default */ #define DCSINTERPMODE_PREVIEW 0x1 /* preview of image (384x256) */ #define TIFFTAG_DCSBALANCEARRAY 65552 /* color balance values */ #define TIFFTAG_DCSCORRECTMATRIX 65553 /* color correction values */ #define TIFFTAG_DCSGAMMA 65554 /* gamma value */ #define TIFFTAG_DCSTOESHOULDERPTS 65555 /* toe & shoulder points */ #define TIFFTAG_DCSCALIBRATIONFD 65556 /* calibration file desc */ /* Note: quality level is on the ZLIB 1-9 scale. Default value is -1 */ #define TIFFTAG_ZIPQUALITY 65557 /* compression quality level */ #define TIFFTAG_PIXARLOGQUALITY 65558 /* PixarLog uses same scale */ /* 65559 is allocated to Oceana Matrix <dev@oceana.com> */ #define TIFFTAG_DCSCLIPRECTANGLE 65559 /* area of image to acquire */ #define TIFFTAG_SGILOGDATAFMT 65560 /* SGILog user data format */ #define SGILOGDATAFMT_FLOAT 0 /* IEEE float samples */ #define SGILOGDATAFMT_16BIT 1 /* 16-bit samples */ #define SGILOGDATAFMT_RAW 2 /* uninterpreted data */ #define SGILOGDATAFMT_8BIT 3 /* 8-bit RGB monitor values */ #define TIFFTAG_SGILOGENCODE 65561 /* SGILog data encoding control*/ #define SGILOGENCODE_NODITHER 0 /* do not dither encoded values*/ #define SGILOGENCODE_RANDITHER 1 /* randomly dither encd values */ #define TIFFTAG_LZMAPRESET 65562 /* LZMA2 preset (compression level) */ #define TIFFTAG_PERSAMPLE 65563 /* interface for per sample tags */ #define PERSAMPLE_MERGED 0 /* present as a single value */ #define PERSAMPLE_MULTI 1 /* present as multiple values */ /* * EXIF tags */ #define EXIFTAG_EXPOSURETIME 33434 /* Exposure time */ #define EXIFTAG_FNUMBER 33437 /* F number */ #define EXIFTAG_EXPOSUREPROGRAM 34850 /* Exposure program */ #define EXIFTAG_SPECTRALSENSITIVITY 34852 /* Spectral sensitivity */ #define EXIFTAG_ISOSPEEDRATINGS 34855 /* ISO speed rating */ #define EXIFTAG_OECF 34856 /* Optoelectric conversion factor */ #define EXIFTAG_EXIFVERSION 36864 /* Exif version */ #define EXIFTAG_DATETIMEORIGINAL 36867 /* Date and time of original data generation */ #define EXIFTAG_DATETIMEDIGITIZED 36868 /* Date and time of digital data generation */ #define EXIFTAG_COMPONENTSCONFIGURATION 37121 /* Meaning of each component */ #define EXIFTAG_COMPRESSEDBITSPERPIXEL 37122 /* Image compression mode */ #define EXIFTAG_SHUTTERSPEEDVALUE 37377 /* Shutter speed */ #define EXIFTAG_APERTUREVALUE 37378 /* Aperture */ #define EXIFTAG_BRIGHTNESSVALUE 37379 /* Brightness */ #define EXIFTAG_EXPOSUREBIASVALUE 37380 /* Exposure bias */ #define EXIFTAG_MAXAPERTUREVALUE 37381 /* Maximum lens aperture */ #define EXIFTAG_SUBJECTDISTANCE 37382 /* Subject distance */ #define EXIFTAG_METERINGMODE 37383 /* Metering mode */ #define EXIFTAG_LIGHTSOURCE 37384 /* Light source */ #define EXIFTAG_FLASH 37385 /* Flash */ #define EXIFTAG_FOCALLENGTH 37386 /* Lens focal length */ #define EXIFTAG_SUBJECTAREA 37396 /* Subject area */ #define EXIFTAG_MAKERNOTE 37500 /* Manufacturer notes */ #define EXIFTAG_USERCOMMENT 37510 /* User comments */ #define EXIFTAG_SUBSECTIME 37520 /* DateTime subseconds */ #define EXIFTAG_SUBSECTIMEORIGINAL 37521 /* DateTimeOriginal subseconds */ #define EXIFTAG_SUBSECTIMEDIGITIZED 37522 /* DateTimeDigitized subseconds */ #define EXIFTAG_FLASHPIXVERSION 40960 /* Supported Flashpix version */ #define EXIFTAG_COLORSPACE 40961 /* Color space information */ #define EXIFTAG_PIXELXDIMENSION 40962 /* Valid image width */ #define EXIFTAG_PIXELYDIMENSION 40963 /* Valid image height */ #define EXIFTAG_RELATEDSOUNDFILE 40964 /* Related audio file */ #define EXIFTAG_FLASHENERGY 41483 /* Flash energy */ #define EXIFTAG_SPATIALFREQUENCYRESPONSE 41484 /* Spatial frequency response */ #define EXIFTAG_FOCALPLANEXRESOLUTION 41486 /* Focal plane X resolution */ #define EXIFTAG_FOCALPLANEYRESOLUTION 41487 /* Focal plane Y resolution */ #define EXIFTAG_FOCALPLANERESOLUTIONUNIT 41488 /* Focal plane resolution unit */ #define EXIFTAG_SUBJECTLOCATION 41492 /* Subject location */ #define EXIFTAG_EXPOSUREINDEX 41493 /* Exposure index */ #define EXIFTAG_SENSINGMETHOD 41495 /* Sensing method */ #define EXIFTAG_FILESOURCE 41728 /* File source */ #define EXIFTAG_SCENETYPE 41729 /* Scene type */ #define EXIFTAG_CFAPATTERN 41730 /* CFA pattern */ #define EXIFTAG_CUSTOMRENDERED 41985 /* Custom image processing */ #define EXIFTAG_EXPOSUREMODE 41986 /* Exposure mode */ #define EXIFTAG_WHITEBALANCE 41987 /* White balance */ #define EXIFTAG_DIGITALZOOMRATIO 41988 /* Digital zoom ratio */ #define EXIFTAG_FOCALLENGTHIN35MMFILM 41989 /* Focal length in 35 mm film */ #define EXIFTAG_SCENECAPTURETYPE 41990 /* Scene capture type */ #define EXIFTAG_GAINCONTROL 41991 /* Gain control */ #define EXIFTAG_CONTRAST 41992 /* Contrast */ #define EXIFTAG_SATURATION 41993 /* Saturation */ #define EXIFTAG_SHARPNESS 41994 /* Sharpness */ #define EXIFTAG_DEVICESETTINGDESCRIPTION 41995 /* Device settings description */ #define EXIFTAG_SUBJECTDISTANCERANGE 41996 /* Subject distance range */ #define EXIFTAG_GAINCONTROL 41991 /* Gain control */ #define EXIFTAG_GAINCONTROL 41991 /* Gain control */ #define EXIFTAG_IMAGEUNIQUEID 42016 /* Unique image ID */ #endif /* _TIFF_ */ /* vim: set ts=8 sts=8 sw=8 noet: */ /* * Local Variables: * mode: c * c-basic-offset: 8 * fill-column: 78 * End: */ ��������������������������������������������������������mysql/my_thread_local.h�����������������������������������������������������������������������������0000644�����������������00000005006�14763166026�0011224 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef MY_THREAD_LOCAL_INCLUDED #define MY_THREAD_LOCAL_INCLUDED #ifndef _WIN32 #include <pthread.h> #endif struct _db_code_state_; typedef uint32 my_thread_id; C_MODE_START #ifdef _WIN32 typedef DWORD thread_local_key_t; #else typedef pthread_key_t thread_local_key_t; #endif static inline int my_create_thread_local_key(thread_local_key_t *key, void (*destructor)(void *)) { #ifdef _WIN32 *key= TlsAlloc(); return (*key == TLS_OUT_OF_INDEXES); #else return pthread_key_create(key, destructor); #endif } static inline int my_delete_thread_local_key(thread_local_key_t key) { #ifdef _WIN32 return !TlsFree(key); #else return pthread_key_delete(key); #endif } static inline void* my_get_thread_local(thread_local_key_t key) { #ifdef _WIN32 return TlsGetValue(key); #else return pthread_getspecific(key); #endif } static inline int my_set_thread_local(thread_local_key_t key, void *value) { #ifdef _WIN32 return !TlsSetValue(key, value); #else return pthread_setspecific(key, value); #endif } /** Retrieve the MySQL thread-local storage variant of errno. */ int my_errno(); /** Set the MySQL thread-local storage variant of errno. */ void set_my_errno(int my_errno); #ifdef _WIN32 /* thr_winerr is used for returning the original OS error-code in Windows, my_osmaperr() returns EINVAL for all unknown Windows errors, hence we preserve the original Windows Error code in thr_winerr. */ int thr_winerr(); void set_thr_winerr(int winerr); #endif #ifndef DBUG_OFF /* Return pointer to DBUG for holding current state */ struct _db_code_state_ **my_thread_var_dbug(); my_thread_id my_thread_var_id(); void set_my_thread_var_id(my_thread_id id); #endif C_MODE_END #endif // MY_THREAD_LOCAL_INCLUDED ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/decimal.h�������������������������������������������������������������������������������������0000644�����������������00000012067�14763166026�0007501 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef DECIMAL_INCLUDED #define DECIMAL_INCLUDED typedef enum {TRUNCATE=0, HALF_EVEN, HALF_UP, CEILING, FLOOR} decimal_round_mode; typedef int32 decimal_digit_t; /** intg is the number of *decimal* digits (NOT number of decimal_digit_t's !) before the point frac is the number of decimal digits after the point len is the length of buf (length of allocated space) in decimal_digit_t's, not in bytes sign false means positive, true means negative buf is an array of decimal_digit_t's */ typedef struct st_decimal_t { int intg, frac, len; my_bool sign; decimal_digit_t *buf; } decimal_t; #ifndef MYSQL_ABI_CHECK int internal_str2dec(const char *from, decimal_t *to, char **end, my_bool fixed); int decimal2string(const decimal_t *from, char *to, int *to_len, int fixed_precision, int fixed_decimals, char filler); int decimal2ulonglong(decimal_t *from, ulonglong *to); int ulonglong2decimal(ulonglong from, decimal_t *to); int decimal2longlong(decimal_t *from, longlong *to); int longlong2decimal(longlong from, decimal_t *to); int decimal2double(const decimal_t *from, double *to); int double2decimal(double from, decimal_t *to); int decimal_actual_fraction(decimal_t *from); int decimal2bin(decimal_t *from, uchar *to, int precision, int scale); int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale); /** Convert decimal to lldiv_t. The integer part is stored in to->quot. The fractional part is multiplied to 10^9 and stored to to->rem. @param from Decimal value @param to lldiv_t value @retval 0 on success @retval !0 in error */ int decimal2lldiv_t(const decimal_t *from, lldiv_t *to); /** Convert doube to lldiv_t. The integer part is stored in to->quot. The fractional part is multiplied to 10^9 and stored to to->rem. @param from Decimal value @param to lldiv_t value @retval 0 on success @retval !0 in error */ int double2lldiv_t(double from, lldiv_t *to); int decimal_size(int precision, int scale); int decimal_bin_size(int precision, int scale); int decimal_result_size(decimal_t *from1, decimal_t *from2, char op, int param); int decimal_intg(const decimal_t *from); int decimal_add(const decimal_t *from1, const decimal_t *from2, decimal_t *to); int decimal_sub(const decimal_t *from1, const decimal_t *from2, decimal_t *to); int decimal_cmp(const decimal_t *from1, const decimal_t *from2); int decimal_mul(const decimal_t *from1, const decimal_t *from2, decimal_t *to); int decimal_div(const decimal_t *from1, const decimal_t *from2, decimal_t *to, int scale_incr); int decimal_mod(const decimal_t *from1, const decimal_t *from2, decimal_t *to); int decimal_round(const decimal_t *from, decimal_t *to, int new_scale, decimal_round_mode mode); int decimal_is_zero(const decimal_t *from); void max_decimal(int precision, int frac, decimal_t *to); #define string2decimal(A,B,C) internal_str2dec((A), (B), (C), 0) #define string2decimal_fixed(A,B,C) internal_str2dec((A), (B), (C), 1) /* set a decimal_t to zero */ #define decimal_make_zero(dec) do { \ (dec)->buf[0]=0; \ (dec)->intg=1; \ (dec)->frac=0; \ (dec)->sign=0; \ } while(0) /* returns the length of the buffer to hold string representation of the decimal (including decimal dot, possible sign and \0) */ #define decimal_string_size(dec) (((dec)->intg ? (dec)->intg : 1) + \ (dec)->frac + ((dec)->frac > 0) + 2) /* conventions: decimal_smth() == 0 -- everything's ok decimal_smth() <= 1 -- result is usable, but precision loss is possible decimal_smth() <= 2 -- result can be unusable, most significant digits could've been lost decimal_smth() > 2 -- no result was generated */ #define E_DEC_OK 0 #define E_DEC_TRUNCATED 1 #define E_DEC_OVERFLOW 2 #define E_DEC_DIV_ZERO 4 #define E_DEC_BAD_NUM 8 #define E_DEC_OOM 16 #define E_DEC_ERROR 31 #define E_DEC_FATAL_ERROR 30 #endif // !MYSQL_ABI_CHECK #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/my_xml.h��������������������������������������������������������������������������������������0000644�����������������00000005405�14763166026�0007406 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _my_xml_h #define _my_xml_h #ifdef __cplusplus extern "C" { #endif #define MY_XML_OK 0 #define MY_XML_ERROR 1 /* A flag whether to use absolute tag names in call-back functions, like "a", "a.b" and "a.b.c" (used in character set file parser), or relative names like "a", "b" and "c". */ #define MY_XML_FLAG_RELATIVE_NAMES 1 /* A flag whether to skip normilization of text values before calling call-back functions: i.e. skip leading/trailing spaces, \r, \n, \t characters. */ #define MY_XML_FLAG_SKIP_TEXT_NORMALIZATION 2 enum my_xml_node_type { MY_XML_NODE_TAG, /* can have TAG, ATTR and TEXT children */ MY_XML_NODE_ATTR, /* can have TEXT children */ MY_XML_NODE_TEXT /* cannot have children */ }; typedef struct xml_stack_st { int flags; enum my_xml_node_type current_node_type; char errstr[128]; struct { char static_buffer[128]; char *buffer; size_t buffer_size; char *start; char *end; } attr; const char *beg; const char *cur; const char *end; void *user_data; int (*enter)(struct xml_stack_st *st,const char *val, size_t len); int (*value)(struct xml_stack_st *st,const char *val, size_t len); int (*leave_xml)(struct xml_stack_st *st,const char *val, size_t len); } MY_XML_PARSER; void my_xml_parser_create(MY_XML_PARSER *st); void my_xml_parser_free(MY_XML_PARSER *st); int my_xml_parse(MY_XML_PARSER *st,const char *str, size_t len); void my_xml_set_value_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, const char *, size_t len)); void my_xml_set_enter_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, const char *, size_t len)); void my_xml_set_leave_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, const char *, size_t len)); void my_xml_set_user_data(MY_XML_PARSER *st, void *); size_t my_xml_error_pos(MY_XML_PARSER *st); uint my_xml_error_lineno(MY_XML_PARSER *st); const char *my_xml_error_string(MY_XML_PARSER *st); #ifdef __cplusplus } #endif #endif /* _my_xml_h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/plugin_keyring.h������������������������������������������������������������������������������0000644�����������������00000014222�14763166026�0011124 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2016, 2017 Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_PLUGIN_KEYRING_INCLUDED #define MYSQL_PLUGIN_KEYRING_INCLUDED /** API for keyring plugin. (MYSQL_KEYRING_PLUGIN) */ #include "plugin.h" #define MYSQL_KEYRING_INTERFACE_VERSION 0x0101 /** The descriptor structure for the plugin, that is referred from st_mysql_plugin. */ struct st_mysql_keyring { int interface_version; /*! Add key to the keyring. Obfuscates and adds the key to the keyring. The key is associated with key_id and user_id (unique key identifier). @param[in] key_id id of the key to store @param[in] key_type type of the key to store @param[in] user_id id of the owner of the key @param[in] key the key itself to be stored. The memory of the key is copied by the keyring, thus the key itself can be freed after it was stored in the keyring. @param[in] key_len the length of the key to be stored @return Operation status @retval 0 OK @retval 1 ERROR */ my_bool (*mysql_key_store)(const char *key_id, const char *key_type, const char* user_id, const void *key, size_t key_len); /*! Fetches key from the keyring. De-obfuscates and retrieves key associated with key_id and user_id from the keyring. @param[in] key_id id of the key to fetch @param[out] key_type type of the fetched key @param[in] user_id id of the owner of the key @param[out] key the fetched key itself. The memory for this key is allocated by the keyring and needs to be freed by the user when no longer needed. Prior to freeing the memory it needs to be obfuscated or zeroed. @param[out] key_len the length of the fetched key @return Operation status @retval 0 OK @retval 1 ERROR */ my_bool (*mysql_key_fetch)(const char *key_id, char **key_type, const char *user_id, void **key, size_t *key_len); /*! Removes key from the keyring. Removes the key associated with key_id and user_id from the keyring. @param[in] key_id id of the key to remove @param[in] user_id id of the owner of the key to remove @return Operation status @retval 0 OK @retval 1 ERROR */ my_bool (*mysql_key_remove)(const char *key_id, const char *user_id); /*! Generates and stores the key. Generates a random key of length key_len, associates it with key_id, user_id and stores it in the keyring. @param[in] key_id id of the key to generate @param[in] key_type type of the key to generate @param[in] user_id id of the owner of the generated key @param[in] key_len length of the key to generate @return Operation status @retval 0 OK @retval 1 ERROR */ my_bool (*mysql_key_generate)(const char *key_id, const char *key_type, const char *user_id, size_t key_len); /** Keys_iterator object refers to an iterator which is used to iterate on a list which refers to Key_metadata. Key_metadata hold information about individual keys keyd_id and user_id. Keys_iterator should be used in following sequence only. void* iterator_ptr; char key_id[64]= { 0 }; char user_id[64]= { 0 }; plugin_handle->mysql_key_iterator_init(&iterator_ptr); if (iterator_ptr == NULL) report error; while (!(plugin_handle->mysql_key_iterator_get_key(iterator_ptr, key_id, user_id))) { Fetch the keys. Perform operations on the fetched keys. .. } plugin_handle->mysql_key_iterator_deinit(iterator_ptr); init() method accepts a void pointer which is the made to point to Keys_iterator instance. Keys_iterator instance internal pointer points to Key_metadata list. This list holds information about all keys stored in the backed end data store of keyring plugin. After call to init() please check iterator_ptr. get_key() method accepts the above iterator_ptr as IN param and then fills the passes in key_id and user_id with valid values. This can be used to fetch actual key information. Every call to this method will change internal pointers to advance to next position, so that the next call will fetch the next key. deinit() method frees all internal pointers along with iterator_ptr. */ /** Initialize an iterator. @param[out] key_iterator Iterator used to fetch individual keys from key_container. @return VOID */ void (*mysql_key_iterator_init)(void** key_iterator); /** Deinitialize an iterator. @param[in] key_iterator Iterator used to fetch individual keys from key_container. @return VOID */ void (*mysql_key_iterator_deinit)(void* key_iterator); /** Get details of key. Every call to this service will change internal pointers to advance to next position, so that the next call will fetch the next key. In case iterator moves to the end, this service will return error. @param[in] key_iterator Iterator used to fetch individual keys from key_container. @param[out] key_id id of the key @param[out] user_id id of the owner @return Operation status @retval 0 OK @retval 1 ERROR */ bool (*mysql_key_iterator_get_key)(void* key_iterator, char *key_id, char *user_id); }; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysqlx_version.h������������������������������������������������������������������������������0000644�����������������00000002574�14763166026�0011207 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2016, 2017, Oracle and/or its affiliates. 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; version 2 of the * License. * * 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., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ /* Version numbers for X Plugin */ #ifndef _MYSQLX_VERSION_H_ #define _MYSQLX_VERSION_H_ #define MYSQLX_PLUGIN_VERSION_MAJOR 1 #define MYSQLX_PLUGIN_VERSION_MINOR 0 #define MYSQLX_PLUGIN_VERSION_PATCH 2 #define MYSQLX_PLUGIN_NAME "mysqlx" #define MYSQLX_STATUS_VARIABLE_PREFIX(NAME) "Mysqlx_" NAME #define MYSQLX_SYSTEM_VARIABLE_PREFIX(NAME) "mysqlx_" NAME #define MYSQLX_TCP_PORT 33060U #define MYSQLX_UNIX_ADDR "/var/lib/mysql/mysqlx.sock" #define MYSQLX_PLUGIN_VERSION ( (MYSQLX_PLUGIN_VERSION_MAJOR << 8) | MYSQLX_PLUGIN_VERSION_MINOR ) #define MYSQLX_PLUGIN_VERSION_STRING "1.0.2" #endif // _MYSQLX_VERSION_H_ ������������������������������������������������������������������������������������������������������������������������������������mysql/my_getopt.h�����������������������������������������������������������������������������������0000644�����������������00000016675�14763166026�0010123 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Copyright (c) 2002, 2014, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _my_getopt_h #define _my_getopt_h #include "my_sys.h" /* loglevel */ C_MODE_START #define GET_NO_ARG 1 #define GET_BOOL 2 #define GET_INT 3 #define GET_UINT 4 #define GET_LONG 5 #define GET_ULONG 6 #define GET_LL 7 #define GET_ULL 8 #define GET_STR 9 #define GET_STR_ALLOC 10 #define GET_DISABLED 11 #define GET_ENUM 12 #define GET_SET 13 #define GET_DOUBLE 14 #define GET_FLAGSET 15 #define GET_PASSWORD 16 #if SIZEOF_INT == 4 #define GET_INT32 GET_INT #define GET_UINT32 GET_UINT #elif SIZEOF_LONG == 4 #define GET_INT32 GET_LONG #define GET_UINT32 GET_ULONG #else #error Neither int or long is of 4 bytes width #endif #define GET_ASK_ADDR 128 #define GET_TYPE_MASK 127 /** Enumeration of the my_option::arg_type attributes. It should be noted that for historical reasons variables with the combination arg_type=NO_ARG, my_option::var_type=GET_BOOL still accepts arguments. This is someone counter intuitive and care should be taken if the code is refactored. */ enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG }; struct st_typelib; struct my_option { const char *name; /**< Name of the option. name=NULL marks the end of the my_option[] array. */ int id; /**< For 0<id<=255 it's means one character for a short option (like -A), if >255 no short option is created, but a long option still can be identified uniquely in the my_get_one_option() callback. If an opton needs neither special treatment in the my_get_one_option() nor one-letter short equivalent use id=0. id=-1 is a special case and is used to generate deprecation warnings for plugin options. It should not be used for anything else. */ const char *comment; /**< option comment, for autom. --help. if it's NULL the option is not visible in --help. */ void *value; /**< A pointer to the variable value */ void *u_max_value; /**< The user def. max variable value */ struct st_typelib *typelib; /**< Pointer to possible values */ ulong var_type; /**< GET_BOOL, GET_ULL, etc */ enum get_opt_arg_type arg_type; /**< e.g. REQUIRED_ARG or OPT_ARG */ longlong def_value; /**< Default value */ longlong min_value; /**< Min allowed value (for numbers) */ ulonglong max_value; /**< Max allowed value (for numbers) */ longlong sub_size; /**< Unused */ long block_size; /**< Value should be a mult. of this (for numbers) */ void *app_type; /**< To be used by an application */ }; typedef my_bool (*my_get_one_option)(int, const struct my_option *, char *); /** Used to retrieve a reference to the object (variable) that holds the value for the given option. For example, if var_type is GET_UINT, the function must return a pointer to a variable of type uint. A argument is stored in the location pointed to by the returned pointer. */ typedef void *(*my_getopt_value)(const char *, size_t, const struct my_option *, int *); extern char *disabled_my_option; extern my_bool my_getopt_print_errors; extern my_bool my_getopt_skip_unknown; extern my_error_reporter my_getopt_error_reporter; extern int handle_options (int *argc, char ***argv, const struct my_option *longopts, my_get_one_option); extern int my_handle_options (int *argc, char ***argv, const struct my_option *longopts, my_get_one_option, const char **command_list, my_bool ignore_unknown_option); extern void print_cmdline_password_warning(); extern void my_cleanup_options(const struct my_option *options); extern void my_handle_options_end(); extern void my_cleanup_options(const struct my_option *options); extern void my_print_help(const struct my_option *options); extern void my_print_variables(const struct my_option *options); extern void my_print_variables_ex(const struct my_option *options, FILE* file); extern void my_getopt_register_get_addr(my_getopt_value); ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp, my_bool *fix); longlong getopt_ll_limit_value(longlong, const struct my_option *, my_bool *fix); double getopt_double_limit_value(double num, const struct my_option *optp, my_bool *fix); my_bool getopt_compare_strings(const char *s, const char *t, uint length); ulonglong max_of_int_range(int var_type); /* Get the specific range constraint for the value named. If you do not have the name length availa ble, specify 0. Specify 0 for 'create' to simply obtain the existong value or specify a size value to have the storage allocated if it does not yet exist. */ extern const void* getopt_constraint_get_max_value(const char *name, size_t length, size_t create); extern const void* getopt_constraint_get_min_value(const char *name, size_t length, size_t create); extern const my_bool* getopt_constraint_get_hidden_value(const char *name, size_t length, my_bool create); extern const my_bool* getopt_constraint_get_readonly_value(const char *name, size_t length, my_bool create); ulonglong getopt_double2ulonglong(double); double getopt_ulonglong2double(ulonglong); C_MODE_END #endif /* _my_getopt_h */ �������������������������������������������������������������������mysql/my_dir.h��������������������������������������������������������������������������������������0000644�����������������00000006050�14763166026�0007361 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MY_DIR_H #define MY_DIR_H #include "my_global.h" #include <sys/stat.h> #ifdef __cplusplus extern "C" { #endif /* Defines for my_dir and my_stat */ #ifdef _WIN32 #define S_IROTH _S_IREAD #define S_IFIFO _S_IFIFO #endif #define MY_S_IFMT S_IFMT /* type of file */ #define MY_S_IFDIR S_IFDIR /* directory */ #define MY_S_IFCHR S_IFCHR /* character special */ #define MY_S_IFBLK S_IFBLK /* block special */ #define MY_S_IFREG S_IFREG /* regular */ #define MY_S_IFIFO S_IFIFO /* fifo */ #define MY_S_IFSOCK S_IFSOCK /* socket */ #define MY_S_ISUID S_ISUID /* set user id on execution */ #define MY_S_ISGID S_ISGID /* set group id on execution */ #define MY_S_ISVTX S_ISVTX /* save swapped text even after use */ #define MY_S_IREAD S_IREAD /* read permission, owner */ #define MY_S_IWRITE S_IWRITE /* write permission, owner */ #define MY_S_IEXEC S_IEXEC /* execute/search permission, owner */ #define MY_S_ISDIR(m) (((m) & MY_S_IFMT) == MY_S_IFDIR) #define MY_S_ISCHR(m) (((m) & MY_S_IFMT) == MY_S_IFCHR) #define MY_S_ISBLK(m) (((m) & MY_S_IFMT) == MY_S_IFBLK) #define MY_S_ISREG(m) (((m) & MY_S_IFMT) == MY_S_IFREG) #define MY_S_ISFIFO(m) (((m) & MY_S_IFMT) == MY_S_IFIFO) #define MY_S_ISSOCK(m) (((m) & MY_S_IFMT) == MY_S_IFSOCK) #define MY_DONT_SORT 512 /* my_lib; Don't sort files */ #define MY_WANT_STAT 1024 /* my_lib; stat files */ /* typedefs for my_dir & my_stat */ #if(_MSC_VER) #define MY_STAT struct _stati64 /* 64 bit file size */ #else #define MY_STAT struct stat /* Orginal struct have what we need */ #endif /* Struct describing one file returned from my_dir */ typedef struct fileinfo { char *name; MY_STAT *mystat; } FILEINFO; typedef struct st_my_dir /* Struct returned from my_dir */ { /* These members are just copies of parts of DYNAMIC_ARRAY structure, which is allocated right after the end of MY_DIR structure (MEM_ROOT for storing names is also resides there). We've left them here because we don't want to change code that uses my_dir. */ struct fileinfo *dir_entry; uint number_off_files; } MY_DIR; extern MY_DIR *my_dir(const char *path,myf MyFlags); extern void my_dirend(MY_DIR *buffer); extern MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags); extern int my_fstat(int filenr, MY_STAT *stat_area, myf MyFlags); #ifdef __cplusplus } #endif #endif /* MY_DIR_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/little_endian.h�������������������������������������������������������������������������������0000644�����������������00000006241�14763166026�0010713 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef LITTLE_ENDIAN_INCLUDED #define LITTLE_ENDIAN_INCLUDED /* Copyright (c) 2012, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Data in little-endian format. */ #include <string.h> static inline void float4get (float *V, const uchar *M) { memcpy(V, (M), sizeof(float)); } static inline void float4store(uchar *V, float M) { memcpy(V, (&M), sizeof(float)); } static inline void float8get (double *V, const uchar *M) { memcpy(V, M, sizeof(double)); } static inline void float8store(uchar *V, double M) { memcpy(V, &M, sizeof(double)); } static inline void floatget (float *V, const uchar *M) { float4get(V, M); } static inline void floatstore (uchar *V, float M) { float4store(V, M); } /* Bi-endian hardware.... */ #if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN) static inline void doublestore(uchar *T, double V) { *(((char*)T)+0)=(char) ((uchar *) &V)[4]; *(((char*)T)+1)=(char) ((uchar *) &V)[5]; *(((char*)T)+2)=(char) ((uchar *) &V)[6]; *(((char*)T)+3)=(char) ((uchar *) &V)[7]; *(((char*)T)+4)=(char) ((uchar *) &V)[0]; *(((char*)T)+5)=(char) ((uchar *) &V)[1]; *(((char*)T)+6)=(char) ((uchar *) &V)[2]; *(((char*)T)+7)=(char) ((uchar *) &V)[3]; } static inline void doubleget(double *V, const uchar *M) { double def_temp; ((uchar*) &def_temp)[0]=(M)[4]; ((uchar*) &def_temp)[1]=(M)[5]; ((uchar*) &def_temp)[2]=(M)[6]; ((uchar*) &def_temp)[3]=(M)[7]; ((uchar*) &def_temp)[4]=(M)[0]; ((uchar*) &def_temp)[5]=(M)[1]; ((uchar*) &def_temp)[6]=(M)[2]; ((uchar*) &def_temp)[7]=(M)[3]; (*V) = def_temp; } #else /* Bi-endian hardware.... */ static inline void doublestore(uchar *T, double V) { memcpy(T, &V, sizeof(double)); } static inline void doubleget (double *V, const uchar *M) { memcpy(V, M, sizeof(double)); } #endif /* Bi-endian hardware.... */ static inline void ushortget(uint16 *V, const uchar *pM) { *V= uint2korr(pM); } static inline void shortget (int16 *V, const uchar *pM) { *V= sint2korr(pM); } static inline void longget (int32 *V, const uchar *pM) { *V= sint4korr(pM); } static inline void ulongget (uint32 *V, const uchar *pM) { *V= uint4korr(pM); } static inline void shortstore(uchar *T, int16 V) { int2store(T, V); } static inline void longstore (uchar *T, int32 V) { int4store(T, V); } static inline void longlongget(longlong *V, const uchar *M) { memcpy(V, (M), sizeof(ulonglong)); } static inline void longlongstore(uchar *T, longlong V) { memcpy((T), &V, sizeof(ulonglong)); } #endif /* LITTLE_ENDIAN_INCLUDED */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/errmsg.h��������������������������������������������������������������������������������������0000644�����������������00000010474�14763166026�0007402 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef ERRMSG_INCLUDED #define ERRMSG_INCLUDED /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Error messages for MySQL clients */ /* (Error messages for the daemon are in sql/share/errmsg.txt) */ #ifdef __cplusplus extern "C" { #endif void init_client_errs(void); void finish_client_errs(void); extern const char *client_errors[]; /* Error messages */ extern const char **mysql_client_errors; /* Error messages */ #ifdef __cplusplus } #endif #define CR_MIN_ERROR 2000 /* For easier client code */ #define CR_MAX_ERROR 2999 #if !defined(ER) #define ER(X) (((X) >= CR_ERROR_FIRST && (X) <= CR_ERROR_LAST)? \ client_errors[(X)-CR_ERROR_FIRST]: client_errors[CR_UNKNOWN_ERROR]) #endif #define CLIENT_ERRMAP 2 /* Errormap used by my_error() */ /* Do not add error numbers before CR_ERROR_FIRST. */ /* If necessary to add lower numbers, change CR_ERROR_FIRST accordingly. */ #define CR_ERROR_FIRST 2000 /*Copy first error nr.*/ #define CR_UNKNOWN_ERROR 2000 #define CR_SOCKET_CREATE_ERROR 2001 #define CR_CONNECTION_ERROR 2002 #define CR_CONN_HOST_ERROR 2003 #define CR_IPSOCK_ERROR 2004 #define CR_UNKNOWN_HOST 2005 #define CR_SERVER_GONE_ERROR 2006 #define CR_VERSION_ERROR 2007 #define CR_OUT_OF_MEMORY 2008 #define CR_WRONG_HOST_INFO 2009 #define CR_LOCALHOST_CONNECTION 2010 #define CR_TCP_CONNECTION 2011 #define CR_SERVER_HANDSHAKE_ERR 2012 #define CR_SERVER_LOST 2013 #define CR_COMMANDS_OUT_OF_SYNC 2014 #define CR_NAMEDPIPE_CONNECTION 2015 #define CR_NAMEDPIPEWAIT_ERROR 2016 #define CR_NAMEDPIPEOPEN_ERROR 2017 #define CR_NAMEDPIPESETSTATE_ERROR 2018 #define CR_CANT_READ_CHARSET 2019 #define CR_NET_PACKET_TOO_LARGE 2020 #define CR_EMBEDDED_CONNECTION 2021 #define CR_PROBE_SLAVE_STATUS 2022 #define CR_PROBE_SLAVE_HOSTS 2023 #define CR_PROBE_SLAVE_CONNECT 2024 #define CR_PROBE_MASTER_CONNECT 2025 #define CR_SSL_CONNECTION_ERROR 2026 #define CR_MALFORMED_PACKET 2027 #define CR_WRONG_LICENSE 2028 /* new 4.1 error codes */ #define CR_NULL_POINTER 2029 #define CR_NO_PREPARE_STMT 2030 #define CR_PARAMS_NOT_BOUND 2031 #define CR_DATA_TRUNCATED 2032 #define CR_NO_PARAMETERS_EXISTS 2033 #define CR_INVALID_PARAMETER_NO 2034 #define CR_INVALID_BUFFER_USE 2035 #define CR_UNSUPPORTED_PARAM_TYPE 2036 #define CR_SHARED_MEMORY_CONNECTION 2037 #define CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR 2038 #define CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR 2039 #define CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR 2040 #define CR_SHARED_MEMORY_CONNECT_MAP_ERROR 2041 #define CR_SHARED_MEMORY_FILE_MAP_ERROR 2042 #define CR_SHARED_MEMORY_MAP_ERROR 2043 #define CR_SHARED_MEMORY_EVENT_ERROR 2044 #define CR_SHARED_MEMORY_CONNECT_ABANDONED_ERROR 2045 #define CR_SHARED_MEMORY_CONNECT_SET_ERROR 2046 #define CR_CONN_UNKNOW_PROTOCOL 2047 #define CR_INVALID_CONN_HANDLE 2048 #define CR_UNUSED_1 2049 #define CR_FETCH_CANCELED 2050 #define CR_NO_DATA 2051 #define CR_NO_STMT_METADATA 2052 #define CR_NO_RESULT_SET 2053 #define CR_NOT_IMPLEMENTED 2054 #define CR_SERVER_LOST_EXTENDED 2055 #define CR_STMT_CLOSED 2056 #define CR_NEW_STMT_METADATA 2057 #define CR_ALREADY_CONNECTED 2058 #define CR_AUTH_PLUGIN_CANNOT_LOAD 2059 #define CR_DUPLICATE_CONNECTION_ATTR 2060 #define CR_AUTH_PLUGIN_ERR 2061 #define CR_INSECURE_API_ERR 2062 #define CR_ERROR_LAST /*Copy last error nr:*/ 2062 /* Add error numbers before CR_ERROR_LAST and change it accordingly. */ #endif /* ERRMSG_INCLUDED */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/my_global.h�����������������������������������������������������������������������������������0000644�����������������00000054271�14763166026�0010053 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2001, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MY_GLOBAL_INCLUDED #define MY_GLOBAL_INCLUDED /* This include file should be included first in every header file. This makes sure my_config.h is included to get platform specific symbols defined and it makes sure a lot of platform/compiler differences are mitigated. */ #include "my_config.h" #define __STDC_LIMIT_MACROS /* Enable C99 limit macros */ #define __STDC_FORMAT_MACROS /* Enable C99 printf format macros */ #define _USE_MATH_DEFINES /* Get access to M_PI, M_E, etc. in math.h */ #ifdef _WIN32 /* Include common headers.*/ # include <winsock2.h> # include <ws2tcpip.h> /* SOCKET */ # include <io.h> /* access(), chmod() */ #endif #include <stdio.h> #include <stdarg.h> #include <stdlib.h> #include <stddef.h> #include <math.h> #include <limits.h> #include <float.h> #include <fcntl.h> #include <time.h> #include <errno.h> /* Recommended by debian */ #include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif #if !defined(_WIN32) #include <netdb.h> #endif #ifdef MY_MSCRT_DEBUG #include <crtdbg.h> #endif /* A lot of our programs uses asserts, so better to always include it This also fixes a problem when people uses DBUG_ASSERT without including assert.h */ #include <assert.h> /* Include standard definitions of operator new and delete. */ #ifdef __cplusplus # include <new> #endif #include "my_compiler.h" /* InnoDB depends on some MySQL internals which other plugins should not need. This is because of InnoDB's foreign key support, "safe" binlog truncation, and other similar legacy features. We define accessors for these internals unconditionally, but do not expose them in mysql/plugin.h. They are declared in ha_innodb.h for InnoDB's use. */ #define INNODB_COMPATIBILITY_HOOKS /* Macros to make switching between C and C++ mode easier */ #ifdef __cplusplus #define C_MODE_START extern "C" { #define C_MODE_END } #else #define C_MODE_START #define C_MODE_END #endif #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE #define HAVE_PSI_INTERFACE #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */ /* Make it easier to add conditional code in _expressions_ */ #ifdef _WIN32 #define IF_WIN(A,B) A #else #define IF_WIN(A,B) B #endif #if defined (_WIN32) /* off_t is 32 bit long. We do not use C runtime functions with off_t but native Win32 file IO APIs, that work with 64 bit offsets. */ #undef SIZEOF_OFF_T #define SIZEOF_OFF_T 8 static inline void sleep(unsigned long seconds) { Sleep(seconds * 1000); } /* Define missing access() modes. */ #define F_OK 0 #define W_OK 2 #define R_OK 4 /* Test for read permission. */ /* Define missing file locking constants. */ #define F_RDLCK 1 #define F_WRLCK 2 #define F_UNLCK 3 #define F_TO_EOF 0x3FFFFFFF #define O_NONBLOCK 1 /* For emulation of fcntl() */ /* SHUT_RDWR is called SD_BOTH in windows and is defined to 2 in winsock2.h #define SD_BOTH 0x02 */ #define SHUT_RDWR 0x02 /* Shared memory and named pipe connections are supported. */ #define shared_memory_buffer_length 16000 #define default_shared_memory_base_name "MYSQL" #endif /* _WIN32*/ /** Cast a member of a structure to the structure that contains it. @param ptr Pointer to the member. @param type Type of the structure that contains the member. @param member Name of the member within the structure. */ #define my_container_of(ptr, type, member) \ ((type *)((char *)ptr - offsetof(type, member))) /* an assert that works at compile-time. only for constant expression */ #define compile_time_assert(X) \ do \ { \ typedef char compile_time_assert[(X) ? 1 : -1] MY_ATTRIBUTE((unused)); \ } while(0) #define QUOTE_ARG(x) #x /* Quote argument (before cpp) */ #define STRINGIFY_ARG(x) QUOTE_ARG(x) /* Quote argument, after cpp */ #ifdef _WIN32 #define SO_EXT ".dll" #elif defined(__APPLE__) #define SO_EXT ".dylib" #else #define SO_EXT ".so" #endif #if !defined(HAVE_UINT) typedef unsigned int uint; typedef unsigned short ushort; #endif #define swap_variables(t, a, b) { t dummy; dummy= a; a= b; b= dummy; } #define MY_TEST(a) ((a) ? 1 : 0) #define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0) #define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0) #define test_all_bits(a,b) (((a) & (b)) == (b)) #define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0]))) /* Define some general constants */ #ifndef TRUE #define TRUE (1) /* Logical true */ #define FALSE (0) /* Logical false */ #endif /* Some types that is different between systems */ typedef int File; /* File descriptor */ #ifdef _WIN32 typedef SOCKET my_socket; #else typedef int my_socket; /* File descriptor for sockets */ #define INVALID_SOCKET -1 #endif C_MODE_START typedef void (*sig_return)();/* Returns type from signal */ C_MODE_END #if defined(__GNUC__) typedef char pchar; /* Mixed prototypes can take char */ typedef char pbool; /* Mixed prototypes can take char */ #else typedef int pchar; /* Mixed prototypes can't take char */ typedef int pbool; /* Mixed prototypes can't take char */ #endif C_MODE_START typedef int (*qsort_cmp)(const void *,const void *); typedef int (*qsort_cmp2)(const void*, const void *,const void *); C_MODE_END #ifdef _WIN32 typedef int socket_len_t; typedef int sigset_t; typedef int mode_t; typedef SSIZE_T ssize_t; #else typedef socklen_t socket_len_t; #endif typedef socket_len_t SOCKET_SIZE_TYPE; /* Used by NDB */ /* file create flags */ #ifndef O_SHARE /* Probably not windows */ #define O_SHARE 0 /* Flag to my_open for shared files */ #ifndef O_BINARY #define O_BINARY 0 /* Flag to my_open for binary files */ #endif #ifndef FILE_BINARY #define FILE_BINARY O_BINARY /* Flag to my_fopen for binary streams */ #endif #ifdef HAVE_FCNTL #define HAVE_FCNTL_LOCK #define F_TO_EOF 0L /* Param to lockf() to lock rest of file */ #endif #endif /* O_SHARE */ #ifndef O_TEMPORARY #define O_TEMPORARY 0 #endif #ifndef O_SHORT_LIVED #define O_SHORT_LIVED 0 #endif #ifndef O_NOFOLLOW #define O_NOFOLLOW 0 #endif /* additional file share flags for win32 */ #ifdef _WIN32 #define _SH_DENYRWD 0x110 /* deny read/write mode & delete */ #define _SH_DENYWRD 0x120 /* deny write mode & delete */ #define _SH_DENYRDD 0x130 /* deny read mode & delete */ #define _SH_DENYDEL 0x140 /* deny delete only */ #endif /* _WIN32 */ /* General constants */ #define FN_LEN 256 /* Max file name len */ #define FN_HEADLEN 253 /* Max length of filepart of file name */ #define FN_EXTLEN 20 /* Max length of extension (part of FN_LEN) */ #define FN_REFLEN 512 /* Max length of full path-name */ #define FN_REFLEN_SE 4000 /* Max length of full path-name in SE */ #define FN_EXTCHAR '.' #define FN_HOMELIB '~' /* ~/ is used as abbrev for home dir */ #define FN_CURLIB '.' /* ./ is used as abbrev for current dir */ #define FN_PARENTDIR ".." /* Parent directory; Must be a string */ #ifdef _WIN32 #define FN_LIBCHAR '\\' #define FN_LIBCHAR2 '/' #define FN_DIRSEP "/\\" /* Valid directory separators */ #define FN_EXEEXT ".exe" #define FN_SOEXT ".dll" #define FN_ROOTDIR "\\" #define FN_DEVCHAR ':' #define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */ #else #define FN_LIBCHAR '/' /* FN_LIBCHAR2 is not defined on !Windows. Use is_directory_separator(). */ #define FN_DIRSEP "/" /* Valid directory separators */ #define FN_EXEEXT "" #define FN_SOEXT ".so" #define FN_ROOTDIR "/" #endif static inline int is_directory_separator(char c) { #ifdef _WIN32 return c == FN_LIBCHAR || c == FN_LIBCHAR2; #else return c == FN_LIBCHAR; #endif } /* MY_FILE_MIN is Windows speciality and is used to quickly detect the mismatch of CRT and mysys file IO usage on Windows at runtime. CRT file descriptors can be in the range 0-2047, whereas descriptors returned by my_open() will start with 2048. If a file descriptor with value less then MY_FILE_MIN is passed to mysys IO function, chances are it stemms from open()/fileno() and not my_open()/my_fileno. For Posix, mysys functions are light wrappers around libc, and MY_FILE_MIN is logically 0. */ #ifdef _WIN32 #define MY_FILE_MIN 2048 #else #define MY_FILE_MIN 0 #endif /* MY_NFILE is the default size of my_file_info array. It is larger on Windows, because it all file handles are stored in my_file_info Default size is 16384 and this should be enough for most cases.If it is not enough, --max-open-files with larger value can be used. For Posix , my_file_info array is only used to store filenames for error reporting and its size is not a limitation for number of open files. */ #ifdef _WIN32 #define MY_NFILE (16384 + MY_FILE_MIN) #else #define MY_NFILE 64 #endif #define OS_FILE_LIMIT UINT_MAX /* Io buffer size; Must be a power of 2 and a multiple of 512. May be smaller what the disk page size. This influences the speed of the isam btree library. eg to big to slow. */ #define IO_SIZE 4096 /* How much overhead does malloc have. The code often allocates something like 1024-MALLOC_OVERHEAD bytes */ #define MALLOC_OVERHEAD 8 /* get memory in huncs */ #define ONCE_ALLOC_INIT (uint) (4096-MALLOC_OVERHEAD) /* Typical record cash */ #define RECORD_CACHE_SIZE (uint) (64*1024-MALLOC_OVERHEAD) /* Typical key cash */ #define KEY_CACHE_SIZE (uint) (8*1024*1024) /* Default size of a key cache block */ #define KEY_CACHE_BLOCK_SIZE (uint) 1024 /* Some defines of functions for portability */ #if (_WIN32) #if !defined(_WIN64) inline double my_ulonglong2double(unsigned long long value) { long long nr=(long long) value; if (nr >= 0) return (double) nr; return (18446744073709551616.0 + (double) nr); } #define ulonglong2double my_ulonglong2double #define my_off_t2double my_ulonglong2double #endif /* _WIN64 */ inline unsigned long long my_double2ulonglong(double d) { double t= d - (double) 0x8000000000000000ULL; if (t >= 0) return ((unsigned long long) t) + 0x8000000000000000ULL; return (unsigned long long) d; } #define double2ulonglong my_double2ulonglong #endif /* _WIN32 */ #ifndef ulonglong2double #define ulonglong2double(A) ((double) (ulonglong) (A)) #define my_off_t2double(A) ((double) (my_off_t) (A)) #endif #ifndef double2ulonglong #define double2ulonglong(A) ((ulonglong) (double) (A)) #endif #define INT_MIN64 (~0x7FFFFFFFFFFFFFFFLL) #define INT_MAX64 0x7FFFFFFFFFFFFFFFLL #define INT_MIN32 (~0x7FFFFFFFL) #define INT_MAX32 0x7FFFFFFFL #define UINT_MAX32 0xFFFFFFFFL #define INT_MIN24 (~0x007FFFFF) #define INT_MAX24 0x007FFFFF #define UINT_MAX24 0x00FFFFFF #define INT_MIN16 (~0x7FFF) #define INT_MAX16 0x7FFF #define UINT_MAX16 0xFFFF #define INT_MIN8 (~0x7F) #define INT_MAX8 0x7F #define UINT_MAX8 0xFF #ifndef SIZE_T_MAX #define SIZE_T_MAX (~((size_t) 0)) #endif // Our ifdef trickery for my_isfinite does not work with gcc/solaris unless we: #ifdef HAVE_IEEEFP_H #include <ieeefp.h> #endif #if (__cplusplus >= 201103L) /* For C++11 use the new std functions rather than C99 macros. */ #include <cmath> #define my_isfinite(X) std::isfinite(X) #define my_isnan(X) std::isnan(X) #define my_isinf(X) std::isinf(X) #else #ifdef HAVE_LLVM_LIBCPP /* finite is deprecated in libc++ */ #define my_isfinite(X) isfinite(X) #elif defined _WIN32 #define my_isfinite(X) _finite(X) #else #define my_isfinite(X) finite(X) #endif #define my_isnan(X) isnan(X) #ifdef HAVE_ISINF /* System-provided isinf() is available and safe to use */ #define my_isinf(X) isinf(X) #else /* !HAVE_ISINF */ #define my_isinf(X) (!my_isfinite(X) && !my_isnan(X)) #endif #endif /* __cplusplus >= 201103L */ /* Max size that must be added to a so that we know Size to make adressable obj. */ #if SIZEOF_CHARP == 4 typedef long my_ptrdiff_t; #else typedef long long my_ptrdiff_t; #endif #define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1)) #define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double)) /* Size to make adressable obj. */ #define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size) #define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B)) /* Custom version of standard offsetof() macro which can be used to get offsets of members in class for non-POD types (according to the current version of C++ standard offsetof() macro can't be used in such cases and attempt to do so causes warnings to be emitted, OTOH in many cases it is still OK to assume that all instances of the class has the same offsets for the same members). This is temporary solution which should be removed once File_parser class and related routines are refactored. */ #define my_offsetof(TYPE, MEMBER) \ ((size_t)((char *)&(((TYPE *)0x10)->MEMBER) - (char*)0x10)) #define NullS (char *) 0 #ifdef _WIN32 #define STDCALL __stdcall #else #define STDCALL #endif /* Typdefs for easyier portability */ typedef unsigned char uchar; /* Short for unsigned char */ typedef signed char int8; /* Signed integer >= 8 bits */ typedef unsigned char uint8; /* Unsigned integer >= 8 bits */ typedef short int16; typedef unsigned short uint16; #if SIZEOF_INT == 4 typedef int int32; typedef unsigned int uint32; #elif SIZEOF_LONG == 4 typedef long int32; typedef unsigned long uint32; #else #error Neither int or long is of 4 bytes width #endif #if !defined(HAVE_ULONG) typedef unsigned long ulong; /* Short for unsigned long */ #endif /* Using [unsigned] long long is preferable as [u]longlong because we use [unsigned] long long unconditionally in many places, for example in constants with [U]LL suffix. */ typedef unsigned long long int ulonglong; /* ulong or unsigned long long */ typedef long long int longlong; typedef longlong int64; typedef ulonglong uint64; #if defined (_WIN32) typedef unsigned __int64 my_ulonglong; #else typedef unsigned long long my_ulonglong; #endif #if SIZEOF_CHARP == SIZEOF_INT typedef int intptr; #elif SIZEOF_CHARP == SIZEOF_LONG typedef long intptr; #elif SIZEOF_CHARP == SIZEOF_LONG_LONG typedef long long intptr; #else #error sizeof(void *) is neither sizeof(int) nor sizeof(long) nor sizeof(long long) #endif #define MY_ERRPTR ((void*)(intptr)1) #if defined(_WIN32) typedef unsigned long long my_off_t; typedef unsigned long long os_off_t; #else typedef off_t os_off_t; #if SIZEOF_OFF_T > 4 typedef ulonglong my_off_t; #else typedef unsigned long my_off_t; #endif #endif /*_WIN32*/ #define MY_FILEPOS_ERROR (~(my_off_t) 0) /* TODO Convert these to use Bitmap class. */ typedef ulonglong table_map; /* Used for table bits in join */ typedef ulonglong nesting_map; /* Used for flags of nesting constructs */ #if defined(_WIN32) #define socket_errno WSAGetLastError() #define SOCKET_EINTR WSAEINTR #define SOCKET_EAGAIN WSAEINPROGRESS #define SOCKET_EWOULDBLOCK WSAEWOULDBLOCK #define SOCKET_EADDRINUSE WSAEADDRINUSE #define SOCKET_ETIMEDOUT WSAETIMEDOUT #define SOCKET_ECONNRESET WSAECONNRESET #define SOCKET_ENFILE ENFILE #define SOCKET_EMFILE EMFILE #else /* Unix */ #define socket_errno errno #define closesocket(A) close(A) #define SOCKET_EINTR EINTR #define SOCKET_EAGAIN EAGAIN #define SOCKET_EWOULDBLOCK EWOULDBLOCK #define SOCKET_EADDRINUSE EADDRINUSE #define SOCKET_ETIMEDOUT ETIMEDOUT #define SOCKET_ECONNRESET ECONNRESET #define SOCKET_ENFILE ENFILE #define SOCKET_EMFILE EMFILE #endif typedef int myf; /* Type of MyFlags in my_funcs */ typedef char my_bool; /* Small bool */ /* Macros for converting *constants* to the right type */ #define MYF(v) (myf) (v) /* Some helper macros */ #define YESNO(X) ((X) ? "yes" : "no") #define MY_HOW_OFTEN_TO_WRITE 1000 /* How often we want info on screen */ #include <my_byteorder.h> #ifdef HAVE_CHARSET_utf8 #define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8" #else #define MYSQL_UNIVERSAL_CLIENT_CHARSET MYSQL_DEFAULT_CHARSET_NAME #endif #if defined(_WIN32) #define dlsym(lib, name) (void*)GetProcAddress((HMODULE)lib, name) #define dlopen(libname, unused) LoadLibraryEx(libname, NULL, 0) #define dlclose(lib) FreeLibrary((HMODULE)lib) #ifndef HAVE_DLOPEN #define HAVE_DLOPEN #endif #define DLERROR_GENERATE(errmsg, error_number) \ char win_errormsg[2048]; \ if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, \ 0, error_number, 0, win_errormsg, 2048, NULL)) \ { \ char *ptr; \ for (ptr= &win_errormsg[0] + strlen(win_errormsg) - 1; \ ptr >= &win_errormsg[0] && strchr("\r\n\t\0x20", *ptr); \ ptr--) \ *ptr= 0; \ errmsg= win_errormsg; \ } \ else \ errmsg= "" #define dlerror() "" #define dlopen_errno GetLastError() #else /* _WIN32 */ #define DLERROR_GENERATE(errmsg, error_number) errmsg= dlerror() #define dlopen_errno errno #endif /* _WIN32 */ /* Length of decimal number represented by INT32. */ #define MY_INT32_NUM_DECIMAL_DIGITS 11U /* Length of decimal number represented by INT64. */ #define MY_INT64_NUM_DECIMAL_DIGITS 21U /* Define some useful general macros (should be done after all headers). */ #define MY_MAX(a, b) ((a) > (b) ? (a) : (b)) #define MY_MIN(a, b) ((a) < (b) ? (a) : (b)) #if !defined(__cplusplus) && !defined(bool) #define bool In_C_you_should_use_my_bool_instead() #endif /* MYSQL_PLUGIN_IMPORT macro is used to export mysqld data (i.e variables) for usage in storage engine loadable plugins. Outside of Windows, it is dummy. */ #if (defined(_WIN32) && defined(MYSQL_DYNAMIC_PLUGIN)) #define MYSQL_PLUGIN_IMPORT __declspec(dllimport) #else #define MYSQL_PLUGIN_IMPORT #endif #include <my_dbug.h> #ifdef EMBEDDED_LIBRARY #define NO_EMBEDDED_ACCESS_CHECKS /* Things we don't need in the embedded version of MySQL */ #undef HAVE_OPENSSL #endif /* EMBEDDED_LIBRARY */ enum loglevel { ERROR_LEVEL= 0, WARNING_LEVEL= 1, INFORMATION_LEVEL= 2 }; #ifdef _WIN32 /**************************************************************************** ** Replacements for localtime_r and gmtime_r ****************************************************************************/ static inline struct tm *localtime_r(const time_t *timep, struct tm *tmp) { localtime_s(tmp, timep); return tmp; } static inline struct tm *gmtime_r(const time_t *clock, struct tm *res) { gmtime_s(res, clock); return res; } #endif /* _WIN32 */ #ifndef HAVE_STRUCT_TIMESPEC /* Windows before VS2015 */ /* Declare a union to make sure FILETIME is properly aligned so it can be used directly as a 64 bit value. The value stored is in 100ns units. */ union ft64 { FILETIME ft; __int64 i64; }; struct timespec { union ft64 tv; /* The max timeout value in millisecond for native_cond_timedwait */ long max_timeout_msec; }; #endif /* !HAVE_STRUCT_TIMESPEC */ C_MODE_START extern ulonglong my_getsystime(void); C_MODE_END static inline void set_timespec_nsec(struct timespec *abstime, ulonglong nsec) { #ifdef HAVE_STRUCT_TIMESPEC ulonglong now= my_getsystime() + (nsec / 100); ulonglong tv_sec= now / 10000000ULL; #if SIZEOF_TIME_T < SIZEOF_LONG_LONG /* Ensure that the number of seconds don't overflow. */ tv_sec= MY_MIN(tv_sec, ((ulonglong)INT_MAX32)); #endif abstime->tv_sec= (time_t)tv_sec; abstime->tv_nsec= (now % 10000000ULL) * 100 + (nsec % 100); #else /* !HAVE_STRUCT_TIMESPEC */ ulonglong max_timeout_msec= (nsec / 1000000); union ft64 tv; GetSystemTimeAsFileTime(&tv.ft); abstime->tv.i64= tv.i64 + (__int64)(nsec / 100); #if SIZEOF_LONG < SIZEOF_LONG_LONG /* Ensure that the msec value doesn't overflow. */ max_timeout_msec= MY_MIN(max_timeout_msec, ((ulonglong)INT_MAX32)); #endif abstime->max_timeout_msec= (long)max_timeout_msec; #endif /* !HAVE_STRUCT_TIMESPEC */ } static inline void set_timespec(struct timespec *abstime, ulonglong sec) { set_timespec_nsec(abstime, sec * 1000000000ULL); } /** Compare two timespec structs. @retval 1 If ts1 ends after ts2. @retval -1 If ts1 ends before ts2. @retval 0 If ts1 is equal to ts2. */ static inline int cmp_timespec(struct timespec *ts1, struct timespec *ts2) { #ifdef HAVE_STRUCT_TIMESPEC if (ts1->tv_sec > ts2->tv_sec || (ts1->tv_sec == ts2->tv_sec && ts1->tv_nsec > ts2->tv_nsec)) return 1; if (ts1->tv_sec < ts2->tv_sec || (ts1->tv_sec == ts2->tv_sec && ts1->tv_nsec < ts2->tv_nsec)) return -1; #else if (ts1->tv.i64 > ts2->tv.i64) return 1; if (ts1->tv.i64 < ts2->tv.i64) return -1; #endif return 0; } static inline ulonglong diff_timespec(struct timespec *ts1, struct timespec *ts2) { #ifdef HAVE_STRUCT_TIMESPEC return (ts1->tv_sec - ts2->tv_sec) * 1000000000ULL + ts1->tv_nsec - ts2->tv_nsec; #else return (ts1->tv.i64 - ts2->tv.i64) * 100; #endif } #ifdef _WIN32 typedef int MY_MODE; #else typedef mode_t MY_MODE; #endif /* _WIN32 */ /* File permissions */ #define USER_READ (1L << 0) #define USER_WRITE (1L << 1) #define USER_EXECUTE (1L << 2) #define GROUP_READ (1L << 3) #define GROUP_WRITE (1L << 4) #define GROUP_EXECUTE (1L << 5) #define OTHERS_READ (1L << 6) #define OTHERS_WRITE (1L << 7) #define OTHERS_EXECUTE (1L << 8) #define USER_RWX USER_READ | USER_WRITE | USER_EXECUTE #define GROUP_RWX GROUP_READ | GROUP_WRITE | GROUP_EXECUTE #define OTHERS_RWX OTHERS_READ | OTHERS_WRITE | OTHERS_EXECUTE /* Defaults */ #define DEFAULT_SSL_CA_CERT "ca.pem" #define DEFAULT_SSL_CA_KEY "ca-key.pem" #define DEFAULT_SSL_SERVER_CERT "server-cert.pem" #define DEFAULT_SSL_SERVER_KEY "server-key.pem" #if defined(_WIN32) || defined(_WIN64) #define strcasecmp _stricmp #endif #if defined(HAVE_IPV6) && defined(__APPLE__) #define s6_addr32 __u6_addr.__u6_addr32 #endif #endif // MY_GLOBAL_INCLUDED ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql_embed.h���������������������������������������������������������������������������������0000644�����������������00000002166�14763166026�0010403 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef MYSQL_EMBED_INCLUDED #define MYSQL_EMBED_INCLUDED /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Defines that are unique to the embedded version of MySQL */ #ifdef EMBEDDED_LIBRARY /* Things we don't need in the embedded version of MySQL */ /* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */ #undef HAVE_DLOPEN /* No udf functions */ #endif /* EMBEDDED_LIBRARY */ #endif /* MYSQL_EMBED_INCLUDED */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql_com_server.h����������������������������������������������������������������������������0000644�����������������00000002441�14763166026�0011467 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2011, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Definitions private to the server, used in the networking layer to notify specific events. */ #ifndef _mysql_com_server_h #define _mysql_com_server_h struct st_net_server; typedef void (*before_header_callback_fn) (struct st_net *net, void *user_data, size_t count); typedef void (*after_header_callback_fn) (struct st_net *net, void *user_data, size_t count, my_bool rc); struct st_net_server { before_header_callback_fn m_before_header; after_header_callback_fn m_after_header; void *m_user_data; }; typedef struct st_net_server NET_SERVER; #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/my_alloc.h������������������������������������������������������������������������������������0000644�����������������00000004410�14763166026�0007673 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Data structures for mysys/my_alloc.c (root memory allocator) */ #ifndef _my_alloc_h #define _my_alloc_h #define ALLOC_MAX_BLOCK_TO_DROP 4096 #define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP 10 /* PSI_memory_key */ #include "mysql/psi/psi_memory.h" #ifdef __cplusplus extern "C" { #endif typedef struct st_used_mem { /* struct for once_alloc (block) */ struct st_used_mem *next; /* Next block in use */ unsigned int left; /* memory left in block */ unsigned int size; /* size of block */ } USED_MEM; typedef struct st_mem_root { USED_MEM *free; /* blocks with free memory in it */ USED_MEM *used; /* blocks almost without free memory */ USED_MEM *pre_alloc; /* preallocated block */ /* if block have less memory it will be put in 'used' list */ size_t min_malloc; size_t block_size; /* initial block size */ unsigned int block_num; /* allocated blocks counter */ /* first free block in queue test counter (if it exceed MAX_BLOCK_USAGE_BEFORE_DROP block will be dropped in 'used' list) */ unsigned int first_block_usage; /* Maximum amount of memory this mem_root can hold. A value of 0 implies there is no limit. */ size_t max_capacity; /* Allocated size for this mem_root */ size_t allocated_size; /* Enable this for error reporting if capacity is exceeded */ my_bool error_for_capacity_exceeded; void (*error_handler)(void); PSI_memory_key m_psi_key; } MEM_ROOT; #ifdef __cplusplus } #endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/my_sys.h��������������������������������������������������������������������������������������0000644�����������������00000117715�14763166026�0007434 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2018, Percona and/or its affiliates. All rights reserved. Copyright (c) 2010, 2017, MariaDB Corporation. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _my_sys_h #define _my_sys_h #include "my_global.h" /* C_MODE_START, C_MODE_END */ #include "m_ctype.h" /* for CHARSET_INFO */ #include "my_thread.h" /* Needed for psi.h */ #include "mysql/psi/psi.h" #include "mysql/service_mysql_alloc.h" #include "mysql/psi/mysql_memory.h" #include "mysql/psi/mysql_thread.h" #ifdef HAVE_ALLOCA_H #include <alloca.h> #endif #ifdef _WIN32 #include <malloc.h> #endif #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #include <sys/stat.h> C_MODE_START #ifdef HAVE_VALGRIND # include <valgrind/valgrind.h> # define MEM_MALLOCLIKE_BLOCK(p1, p2, p3, p4) VALGRIND_MALLOCLIKE_BLOCK(p1, p2, p3, p4) # define MEM_FREELIKE_BLOCK(p1, p2) VALGRIND_FREELIKE_BLOCK(p1, p2) # include <valgrind/memcheck.h> # define MEM_UNDEFINED(a,len) VALGRIND_MAKE_MEM_UNDEFINED(a,len) # define MEM_NOACCESS(a,len) VALGRIND_MAKE_MEM_NOACCESS(a,len) # define MEM_CHECK_ADDRESSABLE(a,len) VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,len) #else /* HAVE_VALGRIND */ # define MEM_MALLOCLIKE_BLOCK(p1, p2, p3, p4) do {} while (0) # define MEM_FREELIKE_BLOCK(p1, p2) do {} while (0) # define MEM_UNDEFINED(a,len) ((void) 0) # define MEM_NOACCESS(a,len) ((void) 0) # define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0) #endif /* HAVE_VALGRIND */ #include <typelib.h> #define MY_INIT(name) { my_progname= name; my_init(); } /** Max length of an error message generated by mysys utilities. Some mysys functions produce error messages. These mostly go to stderr. This constant defines the size of the buffer used to format the message. It should be kept in sync with MYSQL_ERRMSG_SIZE, since sometimes mysys errors are stored in the server diagnostics area, and we would like to avoid unexpected truncation. */ #define MYSYS_ERRMSG_SIZE (512) #define MYSYS_STRERROR_SIZE (128) #define MY_FILE_ERROR ((size_t) -1) /* General bitmaps for my_func's */ #define MY_FFNF 1 /* Fatal if file not found */ #define MY_FNABP 2 /* Fatal if not all bytes read/writen */ #define MY_NABP 4 /* Error if not all bytes read/writen */ #define MY_FAE 8 /* Fatal if any error */ #define MY_WME 16 /* Write message on error */ #define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */ #define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */ #define MY_SYNC_DIR 8192 /* my_create/delete/rename: sync directory */ #define MY_ENCRYPT 64 /* Encrypt IO_CACHE temporary files */ #define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */ #define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */ #define MY_LINK_WARNING 32 /* my_redel() gives warning if links */ #define MY_COPYTIME 64 /* my_redel() copys time */ #define MY_DELETE_OLD 256 /* my_create_with_symlink() */ #define MY_RESOLVE_LINK 128 /* my_realpath(); Only resolve links */ #define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */ #define MY_REDEL_MAKE_BACKUP 256 #define MY_REDEL_NO_COPY_STAT 512 /* my_redel() doesn't call my_copystat() */ #define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */ #define MY_DONT_WAIT 64 /* my_lock() don't wait if can't lock */ #define MY_ZEROFILL 32 /* my_malloc(), fill array with zero */ #define MY_ALLOW_ZERO_PTR 64 /* my_realloc() ; zero ptr -> malloc */ #define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */ #define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */ #define MY_DONT_OVERWRITE_FILE 1024 /* my_copy: Don't overwrite file */ #define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */ #define MY_SYNC 4096 /* my_copy(): sync dst file */ #define MYF_RW MYF(MY_WME+MY_NABP) /* For my_read & my_write */ #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ #define MY_GIVE_INFO 2 /* Give time info about process*/ #define MY_DONT_FREE_DBUG 4 /* Do not call DBUG_END() in my_end() */ /* Flags for my_error() */ #define ME_BELL 4 /* DEPRECATED: Ring bell then printing message */ #define ME_ERRORLOG 64 /* Write the error message to error log */ #define ME_FATALERROR 1024 /* Fatal statement error */ /* Bits in last argument to fn_format */ #define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */ #define MY_REPLACE_EXT 2 /* replace extension with 'ext' */ #define MY_UNPACK_FILENAME 4 /* Unpack name (~ -> home) */ #define MY_PACK_FILENAME 8 /* Pack name (home -> ~) */ #define MY_RESOLVE_SYMLINKS 16 /* Resolve all symbolic links */ #define MY_RETURN_REAL_PATH 32 /* return full path for file */ #define MY_SAFE_PATH 64 /* Return NULL if too long path */ #define MY_RELATIVE_PATH 128 /* name is relative to 'dir' */ #define MY_APPEND_EXT 256 /* add 'ext' as additional extension*/ /* My seek flags */ #define MY_SEEK_SET 0 #define MY_SEEK_CUR 1 #define MY_SEEK_END 2 /* Some constants */ #define MY_WAIT_FOR_USER_TO_FIX_PANIC 60 /* in seconds */ #define MY_WAIT_GIVE_USER_A_MESSAGE 10 /* Every 10 times of prev */ #define MIN_COMPRESS_LENGTH 50 /* Don't compress small bl. */ #define DFLT_INIT_HITS 3 /* root_alloc flags */ #define MY_KEEP_PREALLOC 1 #define MY_MARK_BLOCKS_FREE 2 /* move used to free list and reuse them */ /* Internal error numbers (for assembler functions) */ #define MY_ERRNO_EDOM 33 #define MY_ERRNO_ERANGE 34 /* Bits for get_date timeflag */ #define GETDATE_DATE_TIME 1 #define GETDATE_SHORT_DATE 2 #define GETDATE_HHMMSSTIME 4 #define GETDATE_GMT 8 #define GETDATE_FIXEDLENGTH 16 #define GETDATE_T_DELIMITER 32 #define GETDATE_SHORT_DATE_FULL_YEAR 64 /* defines when allocating data */ extern void *my_multi_malloc(PSI_memory_key key, myf flags, ...); /* Switch to my_malloc() if the memory block to be allocated is bigger than max_alloca_sz. */ extern PSI_memory_key key_memory_max_alloca; #define my_safe_alloca(size, max_alloca_sz) ((size <= max_alloca_sz) ? \ my_alloca(size) : \ my_malloc(key_memory_max_alloca, size, MYF(0))) #define my_safe_afree(ptr, size, max_alloca_sz) if (size > max_alloca_sz) \ my_free(ptr) #if !defined(DBUG_OFF) || defined(HAVE_VALGRIND) /** Put bad content in memory to be sure it will segfault if dereferenced. With Valgrind, verify that memory is addressable, and mark it undefined. We cache value of B because if B is expression which depends on A, memset() trashes value of B. */ #define TRASH(A,B) do { \ void *p = (A); \ const size_t l= (B); \ MEM_CHECK_ADDRESSABLE(A, l); \ memset(p, 0x8F, l); \ MEM_UNDEFINED(A, l); \ } while (0) #else #define TRASH(A,B) do {} while(0) #endif #if defined(ENABLED_DEBUG_SYNC) extern void (*debug_sync_C_callback_ptr)(const char *, size_t); #define DEBUG_SYNC_C(_sync_point_name_) do { \ if (debug_sync_C_callback_ptr != NULL) \ (*debug_sync_C_callback_ptr)(STRING_WITH_LEN(_sync_point_name_)); } \ while(0) #define DEBUG_SYNC_C_IF_THD(thd, _sync_point_name_) do { \ if (debug_sync_C_callback_ptr != NULL && thd) \ (*debug_sync_C_callback_ptr)(STRING_WITH_LEN(_sync_point_name_)); } \ while(0) #else #define DEBUG_SYNC_C(_sync_point_name_) #define DEBUG_SYNC_C_IF_THD(thd, _sync_point_name_) #endif /* defined(ENABLED_DEBUG_SYNC) */ #ifdef HAVE_LINUX_LARGE_PAGES extern uint my_get_large_page_size(void); extern uchar * my_large_malloc(PSI_memory_key key, size_t size, myf my_flags); extern void my_large_free(uchar *ptr); extern my_bool my_use_large_pages; extern uint my_large_page_size; #else #define my_get_large_page_size() (0) #define my_large_malloc(A,B,C) my_malloc((A),(B),(C)) #define my_large_free(A) my_free((A)) #endif /* HAVE_LINUX_LARGE_PAGES */ #define my_alloca(SZ) alloca((size_t) (SZ)) #include <errno.h> /* errno is a define */ extern char *home_dir; /* Home directory for user */ extern const char *my_progname; /* program-name (printed in errors) */ extern char curr_dir[]; /* Current directory for user */ extern void (*error_handler_hook)(uint my_err, const char *str,myf MyFlags); extern void (*fatal_error_handler_hook)(uint my_err, const char *str, myf MyFlags); extern void (*local_message_hook)(enum loglevel ll, const char *format, va_list args); extern uint my_file_limit; extern MYSQL_PLUGIN_IMPORT ulong my_thread_stack_size; /* Hooks for reporting execution stage information. The server implementation of these will also set THD::current_cond/current_mutex. By having hooks, we avoid direct dependencies on server code. */ extern void (*enter_cond_hook)(void *opaque_thd, mysql_cond_t *cond, mysql_mutex_t *mutex, const PSI_stage_info *stage, PSI_stage_info *old_stage, const char *src_function, const char *src_file, int src_line); extern void (*exit_cond_hook)(void *opaque_thd, const PSI_stage_info *stage, const char *src_function, const char *src_file, int src_line); /* Hook for checking if the thread has been killed. */ extern int (*is_killed_hook)(const void *opaque_thd); /* charsets */ #define MY_ALL_CHARSETS_SIZE 2048 extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *default_charset_info; extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *all_charsets[MY_ALL_CHARSETS_SIZE]; extern CHARSET_INFO compiled_charsets[]; /* statistics */ extern ulong my_file_opened,my_stream_opened, my_tmp_file_created; extern ulong my_file_total_opened; extern my_bool my_init_done; extern MYSQL_PLUGIN_IMPORT int my_umask; /* Default creation mask */ extern int my_umask_dir; extern ulong my_default_record_cache_size; extern my_bool my_disable_locking, my_enable_symlinks; extern char wild_many,wild_one,wild_prefix; extern const char *charsets_dir; enum cache_type { TYPE_NOT_SET= 0, READ_CACHE, WRITE_CACHE, SEQ_READ_APPEND /* sequential read or append */, READ_FIFO, READ_NET}; enum flush_type { FLUSH_KEEP, /* flush block and keep it in the cache */ FLUSH_RELEASE, /* flush block and remove it from the cache */ FLUSH_IGNORE_CHANGED, /* remove block from the cache */ /* As my_disable_flush_pagecache_blocks is always 0, the following option is strictly equivalent to FLUSH_KEEP */ FLUSH_FORCE_WRITE }; enum file_type { UNOPEN = 0, FILE_BY_OPEN, FILE_BY_CREATE, STREAM_BY_FOPEN, STREAM_BY_FDOPEN, FILE_BY_MKSTEMP, FILE_BY_DUP }; struct st_my_file_info { char *name; #ifdef _WIN32 HANDLE fhandle; /* win32 file handle */ int oflag; /* open flags, e.g O_APPEND */ #endif enum file_type type; }; extern struct st_my_file_info *my_file_info; /* needed for client-only build */ #ifndef PSI_FILE_KEY_DEFINED typedef unsigned int PSI_file_key; #define PSI_FILE_KEY_DEFINED #endif typedef struct st_dynamic_array { uchar *buffer; uint elements,max_element; uint alloc_increment; uint size_of_element; PSI_memory_key m_psi_key; } DYNAMIC_ARRAY; typedef struct st_my_tmpdir { char **list; uint cur, max; mysql_mutex_t mutex; } MY_TMPDIR; typedef struct st_dynamic_string { char *str; size_t length,max_length,alloc_increment; } DYNAMIC_STRING; struct st_io_cache; typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*); typedef struct st_io_cache_share { mysql_mutex_t mutex; /* To sync on reads into buffer. */ mysql_cond_t cond; /* To wait for signals. */ mysql_cond_t cond_writer; /* For a synchronized writer. */ /* Offset in file corresponding to the first byte of buffer. */ my_off_t pos_in_file; /* If a synchronized write cache is the source of the data. */ struct st_io_cache *source_cache; uchar *buffer; /* The read buffer. */ uchar *read_end; /* Behind last valid byte of buffer. */ int running_threads; /* threads not in lock. */ int total_threads; /* threads sharing the cache. */ int error; /* Last error. */ } IO_CACHE_SHARE; typedef struct st_io_cache /* Used when cacheing files */ { /* Offset in file corresponding to the first byte of uchar* buffer. */ my_off_t pos_in_file; /* The offset of end of file for READ_CACHE and WRITE_CACHE. For SEQ_READ_APPEND it the maximum of the actual end of file and the position represented by read_end. */ my_off_t end_of_file; /* Points to current read position in the buffer */ uchar *read_pos; /* the non-inclusive boundary in the buffer for the currently valid read */ uchar *read_end; uchar *buffer; /* The read buffer */ /* Used in ASYNC_IO */ uchar *request_pos; /* Only used in WRITE caches and in SEQ_READ_APPEND to buffer writes */ uchar *write_buffer; /* Only used in SEQ_READ_APPEND, and points to the current read position in the write buffer. Note that reads in SEQ_READ_APPEND caches can happen from both read buffer (uchar* buffer) and write buffer (uchar* write_buffer). */ uchar *append_read_pos; /* Points to current write position in the write buffer */ uchar *write_pos; /* The non-inclusive boundary of the valid write area */ uchar *write_end; /* Current_pos and current_end are convenience variables used by my_b_tell() and other routines that need to know the current offset current_pos points to &write_pos, and current_end to &write_end in a WRITE_CACHE, and &read_pos and &read_end respectively otherwise */ uchar **current_pos, **current_end; /* The lock is for append buffer used in SEQ_READ_APPEND cache need mutex copying from append buffer to read buffer. */ mysql_mutex_t append_buffer_lock; /* The following is used when several threads are reading the same file in parallel. They are synchronized on disk accesses reading the cached part of the file asynchronously. It should be set to NULL to disable the feature. Only READ_CACHE mode is supported. */ IO_CACHE_SHARE *share; /* A caller will use my_b_read() macro to read from the cache if the data is already in cache, it will be simply copied with memcpy() and internal variables will be accordinging updated with no functions invoked. However, if the data is not fully in the cache, my_b_read() will call read_function to fetch the data. read_function must never be invoked directly. */ int (*read_function)(struct st_io_cache *,uchar *,size_t); /* Same idea as in the case of read_function, except my_b_write() needs to be replaced with my_b_append() for a SEQ_READ_APPEND cache */ int (*write_function)(struct st_io_cache *,const uchar *,size_t); /* Specifies the type of the cache. Depending on the type of the cache certain operations might not be available and yield unpredicatable results. Details to be documented later */ enum cache_type type; /* Callbacks when the actual read I/O happens. These were added and are currently used for binary logging of LOAD DATA INFILE - when a block is read from the file, we create a block create/append event, and when IO_CACHE is closed, we create an end event. These functions could, of course be used for other things */ IO_CACHE_CALLBACK pre_read; IO_CACHE_CALLBACK post_read; IO_CACHE_CALLBACK pre_close; /* Counts the number of times, when we were forced to use disk. We use it to increase the binlog_cache_disk_use and binlog_stmt_cache_disk_use status variables. */ ulong disk_writes; void* arg; /* for use by pre/post_read */ char *file_name; /* if used with 'open_cached_file' */ char *dir,*prefix; File file; /* file descriptor */ PSI_file_key file_key; /* instrumented file key */ /* seek_not_done is set by my_b_seek() to inform the upcoming read/write operation that a seek needs to be preformed prior to the actual I/O error is 0 if the cache operation was successful, -1 if there was a "hard" error, and the actual number of I/O-ed bytes if the read/write was partial. */ int seek_not_done,error; /* buffer_length is memory size allocated for buffer or write_buffer */ size_t buffer_length; /* read_length is the same as buffer_length except when we use async io */ size_t read_length; myf myflags; /* Flags used to my_read/my_write */ /* alloced_buffer is 1 if the buffer was allocated by init_io_cache() and 0 if it was supplied by the user. Currently READ_NET is the only one that will use a buffer allocated somewhere else */ my_bool alloced_buffer; } IO_CACHE; typedef int (*qsort2_cmp)(const void *, const void *, const void *); /* Subset of struct stat fields filled by stat/lstat/fstat that uniquely identify a file */ typedef struct st_file_id { dev_t st_dev; ino_t st_ino; } ST_FILE_ID; typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...) MY_ATTRIBUTE((format(printf, 2, 3))); extern my_error_reporter my_charset_error_reporter; extern PSI_file_key key_file_io_cache; MY_NODISCARD extern int _my_b_get(IO_CACHE *info); MY_NODISCARD extern int _my_b_read(IO_CACHE *info, uchar *Buffer, size_t Count); MY_NODISCARD extern int _my_b_write(IO_CACHE *info, const uchar *Buffer, size_t Count); /* inline functions for mf_iocache */ static inline void my_b_clear(IO_CACHE *info) { info->buffer= 0; } /* Test if buffer is inited */ MY_NODISCARD static inline int my_b_inited(const IO_CACHE *info) { return MY_TEST(info->buffer); } #define my_b_EOF INT_MIN MY_NODISCARD static inline int my_b_read(IO_CACHE *info, uchar *Buffer, size_t Count) { if (info->read_pos + Count <= info->read_end) { memcpy(Buffer, info->read_pos, Count); info->read_pos+= Count; return 0; } return _my_b_read(info, Buffer, Count); } MY_NODISCARD static inline int my_b_write(IO_CACHE *info, const uchar *Buffer, size_t Count) { if (info->write_pos + Count <= info->write_end) { memcpy(info->write_pos, Buffer, Count); info->write_pos+= Count; return 0; } return _my_b_write(info, Buffer, Count); } MY_NODISCARD static inline int my_b_get(IO_CACHE *info) { if (info->read_pos != info->read_end) { info->read_pos++; return info->read_pos[-1]; } return _my_b_get(info); } MY_NODISCARD static inline my_off_t my_b_tell(const IO_CACHE *info) { return info->pos_in_file + (*info->current_pos - info->request_pos); } MY_NODISCARD static inline uchar* my_b_get_buffer_start(const IO_CACHE *info) { return info->request_pos; } MY_NODISCARD static inline size_t my_b_get_bytes_in_buffer(const IO_CACHE *info) { return info->read_end - info->request_pos; } MY_NODISCARD static inline my_off_t my_b_get_pos_in_file(const IO_CACHE *info) { return info->pos_in_file; } MY_NODISCARD static inline size_t my_b_bytes_in_cache(const IO_CACHE *info) { return *info->current_end - *info->current_pos; } /* tell write offset in the SEQ_APPEND cache */ int my_b_copy_to_file(IO_CACHE *cache, FILE *file); my_off_t my_b_append_tell(IO_CACHE* info); my_off_t my_b_safe_tell(IO_CACHE* info); /* picks the correct tell() */ MY_NODISCARD int my_b_pread(IO_CACHE *info, uchar *Buffer, size_t Count, my_off_t pos); typedef uint32 ha_checksum; #include <my_alloc.h> /* Prototypes for mysys and my_func functions */ extern int my_copy(const char *from,const char *to,myf MyFlags); extern int my_delete(const char *name,myf MyFlags); extern int my_getwd(char * buf,size_t size,myf MyFlags); extern int my_setwd(const char *dir,myf MyFlags); extern int my_lock(File fd,int op,my_off_t start, my_off_t length,myf MyFlags); extern void *my_once_alloc(size_t Size,myf MyFlags); extern void my_once_free(void); extern char *my_once_strdup(const char *src,myf myflags); extern void *my_once_memdup(const void *src, size_t len, myf myflags); extern File my_open(const char *FileName,int Flags,myf MyFlags); #ifndef __WIN__ extern File my_unix_socket_connect(const char *FileName,myf MyFlags); #endif extern File my_register_filename(File fd, const char *FileName, enum file_type type_of_file, uint error_message_number, myf MyFlags); extern File my_create(const char *FileName,int CreateFlags, int AccessFlags, myf MyFlags); extern int my_close(File Filedes,myf MyFlags); extern int my_mkdir(const char *dir, int Flags, myf MyFlags); extern int my_readlink(char *to, const char *filename, myf MyFlags); extern int my_is_symlink(const char *filename, ST_FILE_ID *file_id); extern int my_realpath(char *to, const char *filename, myf MyFlags); extern int my_is_same_file(File file, const ST_FILE_ID *file_id); extern File my_create_with_symlink(const char *linkname, const char *filename, int createflags, int access_flags, myf MyFlags); extern int my_delete_with_symlink(const char *name, myf MyFlags); extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags); extern int my_symlink(const char *content, const char *linkname, myf MyFlags); extern size_t my_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags); extern size_t my_pread(File Filedes,uchar *Buffer,size_t Count,my_off_t offset, myf MyFlags); extern int my_rename(const char *from,const char *to,myf MyFlags); extern my_off_t my_seek(File fd,my_off_t pos,int whence,myf MyFlags); extern my_off_t my_tell(File fd,myf MyFlags); extern size_t my_write(File Filedes,const uchar *Buffer,size_t Count, myf MyFlags); extern size_t my_pwrite(File Filedes,const uchar *Buffer,size_t Count, my_off_t offset,myf MyFlags); extern size_t my_fread(FILE *stream,uchar *Buffer,size_t Count,myf MyFlags); extern size_t my_fwrite(FILE *stream,const uchar *Buffer,size_t Count, myf MyFlags); extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags); extern my_off_t my_ftell(FILE *stream,myf MyFlags); #if !defined(HAVE_MEMSET_S) void memset_s(void *dest, size_t dest_max, int c, size_t n); #endif /* implemented in my_syslog.c */ // Maximum size of message that will be logged. #define MAX_SYSLOG_MESSAGE_SIZE 1024 /* Platform-independent SysLog support */ /* facilities on unixoid syslog. harmless on systemd / Win platforms. */ typedef struct st_syslog_facility { int id; const char *name; } SYSLOG_FACILITY; extern SYSLOG_FACILITY syslog_facility[]; enum my_syslog_options { MY_SYSLOG_PIDS= 1 }; int my_openlog(const char *eventSourceName, int option, int facility); int my_closelog(); int my_syslog(const CHARSET_INFO *cs, enum loglevel level, const char *msg); /* implemented in my_memmem.c */ extern void *my_memmem(const void *haystack, size_t haystacklen, const void *needle, size_t needlelen); #ifdef _WIN32 extern int my_access(const char *path, int amode); #else #define my_access access #endif extern int check_if_legal_filename(const char *path); extern int check_if_legal_tablename(const char *path); #ifdef _WIN32 extern my_bool is_filename_allowed(const char *name, size_t length, my_bool allow_current_dir); #else /* _WIN32 */ # define is_filename_allowed(name, length, allow_cwd) (TRUE) #endif /* _WIN32 */ #ifdef _WIN32 extern int nt_share_delete(const char *name,myf MyFlags); #define my_delete_allow_opened(fname,flags) nt_share_delete((fname),(flags)) #else #define my_delete_allow_opened(fname,flags) my_delete((fname),(flags)) #endif #ifdef _WIN32 /* Windows-only functions (CRT equivalents)*/ extern HANDLE my_get_osfhandle(File fd); extern void my_osmaperr(unsigned long last_error); #endif extern const char* get_global_errmsg(int nr); extern void wait_for_free_space(const char *filename, int errors); extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags); extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags); extern FILE *my_freopen(const char *path, const char *mode, FILE *stream); extern int my_fclose(FILE *fd,myf MyFlags); extern File my_fileno(FILE *fd); extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags); extern void thr_set_sync_wait_callback(void (*before_sync)(void), void (*after_sync)(void)); extern int my_sync(File fd, myf my_flags); extern int my_sync_dir(const char *dir_name, myf my_flags); extern int my_sync_dir_by_file(const char *file_name, myf my_flags); extern char *my_strerror(char *buf, size_t len, int errnum); extern const char *my_get_err_msg(int nr); extern void my_error(int nr,myf MyFlags, ...); extern void my_printf_error(uint my_err, const char *format, myf MyFlags, ...) MY_ATTRIBUTE((format(printf, 2, 4))); extern void my_printv_error(uint error, const char *format, myf MyFlags, va_list ap); extern int my_error_register(const char* (*get_errmsg) (int), int first, int last); extern my_bool my_error_unregister(int first, int last); extern void my_message(uint my_err, const char *str,myf MyFlags); extern void my_message_stderr(uint my_err, const char *str, myf MyFlags); void my_message_local_stderr(enum loglevel ll, const char *format, va_list args); extern void my_message_local(enum loglevel ll, const char *format, ...); extern my_bool my_init(void); extern void my_end(int infoflag); extern int my_redel(const char *from, const char *to, int MyFlags); extern int my_copystat(const char *from, const char *to, int MyFlags); extern char * my_filename(File fd); extern MY_MODE get_file_perm(ulong perm_flags); extern my_bool my_chmod(const char *filename, ulong perm_flags, myf my_flags); #ifdef EXTRA_DEBUG void my_print_open_files(void); #else #define my_print_open_files() #endif extern my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist); extern char *my_tmpdir(MY_TMPDIR *tmpdir); extern void free_tmpdir(MY_TMPDIR *tmpdir); extern size_t dirname_part(char * to,const char *name, size_t *to_res_length); extern size_t dirname_length(const char *name); #define base_name(A) (A+dirname_length(A)) extern int test_if_hard_path(const char *dir_name); extern my_bool has_path(const char *name); extern char *convert_dirname(char *to, const char *from, const char *from_end); extern void to_unix_path(char * name); extern char * fn_ext(const char *name); extern char * fn_same(char * toname,const char *name,int flag); extern char * fn_format(char * to,const char *name,const char *dir, const char *form, uint flag); extern size_t strlength(const char *str); extern void pack_dirname(char * to,const char *from); extern size_t normalize_dirname(char * to, const char *from); extern size_t unpack_dirname(char * to,const char *from); extern size_t cleanup_dirname(char * to,const char *from); extern size_t system_filename(char * to,const char *from); extern size_t unpack_filename(char * to,const char *from); extern char * intern_filename(char * to,const char *from); extern int pack_filename(char * to, const char *name, size_t max_length); extern char * my_path(char * to,const char *progname, const char *own_pathname_part); extern char * my_load_path(char * to, const char *path, const char *own_path_prefix); extern int wild_compare(const char *str,const char *wildstr, pbool str_is_pattern); extern my_bool array_append_string_unique(const char *str, const char **array, size_t size); extern void get_date(char * to,int timeflag,time_t use_time); extern void soundex(CHARSET_INFO *, char * out_pntr, char * in_pntr, pbool remove_garbage); extern my_bool radixsort_is_appliccable(uint n_items, size_t size_of_element); extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements, size_t size_of_element,uchar *buffer[]); extern void my_qsort(void *base_ptr, size_t total_elems, size_t size, qsort_cmp cmp); extern void my_qsort2(void *base_ptr, size_t total_elems, size_t size, qsort2_cmp cmp, const void *cmp_argument); void my_store_ptr(uchar *buff, size_t pack_length, my_off_t pos); my_off_t my_get_ptr(uchar *ptr, size_t pack_length); typedef int (*io_cache_encr_read_function)(IO_CACHE*, uchar*, size_t); typedef int (*io_cache_encr_write_function)(IO_CACHE*, const uchar*, size_t); extern void init_io_cache_encryption_ext( io_cache_encr_read_function read_function, io_cache_encr_write_function write_function, size_t encr_block_size, size_t encr_header_size); extern void init_io_cache_encryption(my_bool enable); MY_NODISCARD extern int init_io_cache_ext(IO_CACHE *info,File file,size_t cachesize, enum cache_type type,my_off_t seek_offset, my_bool use_async_io, myf cache_myflags, PSI_file_key file_key); MY_NODISCARD extern int init_io_cache(IO_CACHE *info,File file,size_t cachesize, enum cache_type type,my_off_t seek_offset, my_bool use_async_io, myf cache_myflags); MY_NODISCARD extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type, my_off_t seek_offset, my_bool use_async_io, my_bool clear_cache); extern void setup_io_cache(IO_CACHE* info); extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare, IO_CACHE *write_cache, uint num_threads); extern void remove_io_thread(IO_CACHE *info); extern int _my_b_net_read(IO_CACHE *info,uchar *Buffer,size_t Count); extern int my_b_append(IO_CACHE *info,const uchar *Buffer,size_t Count); extern int my_b_safe_write(IO_CACHE *info,const uchar *Buffer,size_t Count); extern int my_block_write(IO_CACHE *info, const uchar *Buffer, size_t Count, my_off_t pos); extern int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock); #define flush_io_cache(info) my_b_flush_io_cache((info),1) extern int end_io_cache(IO_CACHE *info); extern size_t my_b_fill(IO_CACHE *info); extern void my_b_seek(IO_CACHE *info,my_off_t pos); extern size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length); extern my_off_t my_b_filelength(IO_CACHE *info); extern size_t my_b_printf(IO_CACHE *info, const char* fmt, ...) MY_ATTRIBUTE((format(printf, 2, 3))); extern size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap); extern my_bool open_cached_file(IO_CACHE *cache,const char *dir, const char *prefix, size_t cache_size, myf cache_myflags); extern my_bool real_open_cached_file(IO_CACHE *cache); extern void close_cached_file(IO_CACHE *cache); File create_temp_file(char *to, const char *dir, const char *pfx, int mode, myf MyFlags); // Use Prealloced_array or std::vector or something similar in C++ #ifdef __cplusplus extern "C" { #endif extern my_bool my_init_dynamic_array(DYNAMIC_ARRAY *array, PSI_memory_key key, uint element_size, void *init_buffer, uint init_alloc, uint alloc_increment); /* init_dynamic_array() function is deprecated */ extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size, uint init_alloc, uint alloc_increment); #define dynamic_element(array,array_index,type) \ ((type)((array)->buffer) +(array_index)) #ifdef __cplusplus } #endif /* Some functions are still in use in C++, because HASH uses DYNAMIC_ARRAY */ extern my_bool insert_dynamic(DYNAMIC_ARRAY *array, const void *element); extern void *alloc_dynamic(DYNAMIC_ARRAY *array); extern void *pop_dynamic(DYNAMIC_ARRAY*); extern void get_dynamic(DYNAMIC_ARRAY *array, void *element, uint array_index); extern void claim_dynamic(DYNAMIC_ARRAY *array); extern void delete_dynamic(DYNAMIC_ARRAY *array); extern void freeze_size(DYNAMIC_ARRAY *array); static inline void reset_dynamic(DYNAMIC_ARRAY *array) { array->elements= 0; } extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str, size_t init_alloc,size_t alloc_increment); extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append); my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append, size_t length); extern my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, ...); extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str); extern my_bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size); extern my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n); extern void dynstr_free(DYNAMIC_STRING *str); #define alloc_root_inited(A) ((A)->min_malloc != 0) #define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8) #define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (A)->min_malloc=0;} while(0) extern void init_alloc_root(PSI_memory_key key, MEM_ROOT *mem_root, size_t block_size, size_t pre_alloc_size); extern void *alloc_root(MEM_ROOT *mem_root, size_t Size); extern void *multi_alloc_root(MEM_ROOT *mem_root, ...); extern void claim_root(MEM_ROOT *root); extern void free_root(MEM_ROOT *root, myf MyFLAGS); extern void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size, size_t prealloc_size); extern char *strdup_root(MEM_ROOT *root,const char *str); static inline char *safe_strdup_root(MEM_ROOT *root, const char *str) { return str ? strdup_root(root, str) : 0; } extern char *strmake_root(MEM_ROOT *root,const char *str,size_t len); extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len); extern void set_memroot_max_capacity(MEM_ROOT *mem_root, size_t size); extern void set_memroot_error_reporting(MEM_ROOT *mem_root, my_bool report_error); extern my_bool my_compress(uchar *, size_t *, size_t *); extern my_bool my_uncompress(uchar *, size_t , size_t *); extern uchar *my_compress_alloc(const uchar *packet, size_t *len, size_t *complen); extern int packfrm(uchar *, size_t, uchar **, size_t *); extern int unpackfrm(uchar **, size_t *, const uchar *); extern ha_checksum my_checksum(ha_checksum crc, const uchar *mem, size_t count); /* Wait a given number of microseconds */ static inline void my_sleep(time_t m_seconds) { #if defined(_WIN32) Sleep((DWORD)m_seconds/1000+1); /* Sleep() has millisecond arg */ #else struct timeval t; t.tv_sec= m_seconds / 1000000L; t.tv_usec= m_seconds % 1000000L; select(0,0,0,0,&t); /* sleep */ #endif } extern ulong crc32(ulong crc, const uchar *buf, uint len); extern uint my_set_max_open_files(uint files); void my_free_open_file_info(void); extern time_t my_time(myf flags); extern ulonglong my_getsystime(void); extern ulonglong my_micro_time(); extern my_bool my_gethwaddr(uchar *to); #define my_microsecond_getsystime() (my_getsystime()/10) #ifdef HAVE_SYS_MMAN_H #include <sys/mman.h> #ifndef MAP_NOSYNC #define MAP_NOSYNC 0 #endif /* Not defined in FreeBSD 11. Was never implemented in FreeBSD, so we just set it to 0. */ #ifndef MAP_NORESERVE #define MAP_NORESERVE 0 #endif #ifdef HAVE_MMAP64 #define my_mmap(a,b,c,d,e,f) mmap64(a,b,c,d,e,f) #else #define my_mmap(a,b,c,d,e,f) mmap(a,b,c,d,e,f) #endif #define my_munmap(a,b) munmap((a),(b)) #else /* not a complete set of mmap() flags, but only those that nesessary */ #define PROT_READ 1 #define PROT_WRITE 2 #define MAP_NORESERVE 0 #define MAP_SHARED 0x0001 #define MAP_PRIVATE 0x0002 #define MAP_NOSYNC 0x0800 #define MAP_FAILED ((void *)-1) #define MS_SYNC 0x0000 void *my_mmap(void *, size_t, int, int, int, my_off_t); int my_munmap(void *, size_t); #endif /* my_getpagesize */ static inline int my_getpagesize() { #ifndef _WIN32 return getpagesize(); #else SYSTEM_INFO si; GetSystemInfo(&si); return (int)si.dwPageSize; #endif } int my_msync(int, void *, size_t, int); /* character sets */ extern void my_charset_loader_init_mysys(MY_CHARSET_LOADER *loader); extern uint get_charset_number(const char *cs_name, uint cs_flags); extern uint get_collation_number(const char *name); extern const char *get_charset_name(uint cs_number); extern CHARSET_INFO *get_charset(uint cs_number, myf flags); extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags); extern CHARSET_INFO *my_collation_get_by_name(MY_CHARSET_LOADER *loader, const char *name, myf flags); extern CHARSET_INFO *get_charset_by_csname(const char *cs_name, uint cs_flags, myf my_flags); extern CHARSET_INFO *my_charset_get_by_name(MY_CHARSET_LOADER *loader, const char *name, uint cs_flags, myf my_flags); extern my_bool resolve_charset(const char *cs_name, const CHARSET_INFO *default_cs, const CHARSET_INFO **cs); extern my_bool resolve_collation(const char *cl_name, const CHARSET_INFO *default_cl, const CHARSET_INFO **cl); extern void free_charsets(void); extern char *get_charsets_dir(char *buf); extern my_bool my_charset_same(const CHARSET_INFO *cs1, const CHARSET_INFO *cs2); extern my_bool init_compiled_charsets(myf flags); extern void add_compiled_collation(CHARSET_INFO *cs); extern size_t escape_string_for_mysql(const CHARSET_INFO *charset_info, char *to, size_t to_length, const char *from, size_t length); #ifdef _WIN32 /* File system character set */ extern CHARSET_INFO *fs_character_set(void); #endif extern size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info, char *to, size_t to_length, const char *from, size_t length, char quote); #ifdef _WIN32 extern my_bool have_tcpip; /* Is set if tcpip is used */ /* implemented in my_windac.c */ int my_security_attr_create(SECURITY_ATTRIBUTES **psa, const char **perror, DWORD owner_rights, DWORD everybody_rights); void my_security_attr_free(SECURITY_ATTRIBUTES *sa); /* implemented in my_conio.c */ my_bool my_win_is_console(FILE *file); char *my_win_console_readline(const CHARSET_INFO *cs, char *mbbuf, size_t mbbufsize, size_t *nread); void my_win_console_write(const CHARSET_INFO *cs, const char *data, size_t datalen); void my_win_console_fputs(const CHARSET_INFO *cs, const char *data); void my_win_console_putc(const CHARSET_INFO *cs, int c); void my_win_console_vfprintf(const CHARSET_INFO *cs, const char *fmt, va_list args); int my_win_translate_command_line_args(const CHARSET_INFO *cs, int *ac, char ***av); #endif /* _WIN32 */ #ifdef HAVE_PSI_INTERFACE extern MYSQL_PLUGIN_IMPORT struct PSI_bootstrap *PSI_hook; extern void set_psi_server(PSI *psi); void my_init_mysys_psi_keys(void); #endif struct st_mysql_file; extern struct st_mysql_file *mysql_stdin; C_MODE_END #endif /* _my_sys_h */ ���������������������������������������������������mysql/my_list.h�������������������������������������������������������������������������������������0000644�����������������00000002742�14763166026�0007562 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _list_h_ #define _list_h_ #ifdef __cplusplus extern "C" { #endif typedef struct st_list { struct st_list *prev,*next; void *data; } LIST; typedef int (*list_walk_action)(void *,void *); extern LIST *list_add(LIST *root,LIST *element); extern LIST *list_delete(LIST *root,LIST *element); extern LIST *list_cons(void *data,LIST *root); extern LIST *list_reverse(LIST *root); extern void list_free(LIST *root,unsigned int free_data); extern unsigned int list_length(LIST *); extern int list_walk(LIST *,list_walk_action action,unsigned char * argument); #define list_rest(a) ((a)->next) #define list_push(a,b) (a)=list_cons((b),(a)) #define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old); my_free(old); } #ifdef __cplusplus } #endif #endif ������������������������������mysql/byte_order_generic_x86.h����������������������������������������������������������������������0000644�����������������00000004216�14763166026�0012437 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2001, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Optimized functions for the x86 architecture (_WIN32 included). x86 handles misaligned reads and writes just fine, so suppress UBSAN warnings for these functions. */ static inline int16 sint2korr(const uchar *A) SUPPRESS_UBSAN; static inline int16 sint2korr(const uchar *A) { return *((int16*) A); } static inline int32 sint4korr(const uchar *A) SUPPRESS_UBSAN; static inline int32 sint4korr(const uchar *A) { return *((int32*) A); } static inline uint16 uint2korr(const uchar *A) SUPPRESS_UBSAN; static inline uint16 uint2korr(const uchar *A) { return *((uint16*) A); } static inline uint32 uint4korr(const uchar *A) SUPPRESS_UBSAN; static inline uint32 uint4korr(const uchar *A) { return *((uint32*) A); } static inline ulonglong uint8korr(const uchar *A) SUPPRESS_UBSAN; static inline ulonglong uint8korr(const uchar *A) { return *((ulonglong*) A);} static inline longlong sint8korr(const uchar *A) SUPPRESS_UBSAN; static inline longlong sint8korr(const uchar *A) { return *((longlong*) A); } static inline void int2store(uchar *T, uint16 A) SUPPRESS_UBSAN; static inline void int2store(uchar *T, uint16 A) { *((uint16*) T)= A; } static inline void int4store(uchar *T, uint32 A) SUPPRESS_UBSAN; static inline void int4store(uchar *T, uint32 A) { *((uint32*) T)= A; } static inline void int8store(uchar *T, ulonglong A) SUPPRESS_UBSAN; static inline void int8store(uchar *T, ulonglong A) { *((ulonglong*) T)= A; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql_version.h�������������������������������������������������������������������������������0000644�����������������00000002033�14763166026�0011005 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright Abandoned 1996,1999 TCX DataKonsult AB & Monty Program KB & Detron HB, 1996, 1999-2004, 2007 MySQL AB. This file is public domain and comes with NO WARRANTY of any kind */ /* Version numbers for protocol & mysqld */ #ifndef _mysql_version_h #define _mysql_version_h #define PROTOCOL_VERSION 10 #define MYSQL_SERVER_VERSION "5.7.23-23" #define MYSQL_BASE_VERSION "mysqld-5.7" #define MYSQL_SERVER_SUFFIX_DEF "" #define FRM_VER 6 #define MYSQL_VERSION_ID 50723 #define MYSQL_PORT 3306 #define MYSQL_PORT_DEFAULT 0 #define MYSQL_UNIX_ADDR "/var/lib/mysql/mysql.sock" #define MYSQL_CONFIG_NAME "my" #define MYSQL_COMPILATION_COMMENT "Percona Server (GPL), Release 23, Revision 500fcf5" #define LIBMYSQL_VERSION "5.7.23-23" #define LIBMYSQL_VERSION_ID 50723 #define SYS_SCHEMA_VERSION "1.5.1" #ifndef LICENSE #define LICENSE GPL #endif /* LICENSE */ #endif /* _mysql_version_h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/service_rpl_transaction_ctx.h�����������������������������������������������������������0000644�����������������00000004471�14763166026�0015050 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2014, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_SERVICE_RPL_TRANSACTION_CTX_INCLUDED /** @file include/mysql/service_rpl_transaction_ctx.h This service provides a function for plugins to report if a transaction of a given THD should continue or be aborted. SYNOPSIS set_transaction_ctx() should be called during RUN_HOOK macro, on which we know that thread is on plugin context and it is before Rpl_transaction_ctx::is_transaction_rollback() check. */ #ifndef MYSQL_ABI_CHECK #include <stdlib.h> #endif #ifdef __cplusplus extern "C" { #endif struct st_transaction_termination_ctx { unsigned long m_thread_id; unsigned int m_flags; // reserved /* If the instruction is to rollback the transaction, then this flag is set to false. Note: type is char like on my_bool. */ char m_rollback_transaction; /* If the plugin has generated a GTID, then the follwoing fields MUST be set. Note: type is char like on my_bool. */ char m_generated_gtid; int m_sidno; long long int m_gno; }; typedef struct st_transaction_termination_ctx Transaction_termination_ctx; extern struct rpl_transaction_ctx_service_st { int (*set_transaction_ctx)(Transaction_termination_ctx transaction_termination_ctx); } *rpl_transaction_ctx_service; #ifdef MYSQL_DYNAMIC_PLUGIN #define set_transaction_ctx(transaction_termination_ctx) \ (rpl_transaction_ctx_service->set_transaction_ctx((transaction_termination_ctx))) #else int set_transaction_ctx(Transaction_termination_ctx transaction_termination_ctx); #endif #ifdef __cplusplus } #endif #define MYSQL_SERVICE_RPL_TRANSACTION_CTX_INCLUDED #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/client_plugin.h�������������������������������������������������������������������������0000644�����������������00000014474�14763166026�0012110 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef MYSQL_CLIENT_PLUGIN_INCLUDED /* Copyright (c) 2010, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** @file MySQL Client Plugin API This file defines the API for plugins that work on the client side */ #define MYSQL_CLIENT_PLUGIN_INCLUDED #ifndef MYSQL_ABI_CHECK #include <stdarg.h> #include <stdlib.h> #endif /* On Windows, exports from DLL need to be declared. Also, plugin needs to be declared as extern "C" because MSVC unlike other compilers, uses C++ mangling for variables not only for functions. */ #undef MYSQL_PLUGIN_EXPORT #if defined(_MSC_VER) #if defined(MYSQL_DYNAMIC_PLUGIN) #ifdef __cplusplus #define MYSQL_PLUGIN_EXPORT extern "C" __declspec(dllexport) #else #define MYSQL_PLUGIN_EXPORT __declspec(dllexport) #endif #else /* MYSQL_DYNAMIC_PLUGIN */ #ifdef __cplusplus #define MYSQL_PLUGIN_EXPORT extern "C" #else #define MYSQL_PLUGIN_EXPORT #endif #endif /*MYSQL_DYNAMIC_PLUGIN */ #else /*_MSC_VER */ #define MYSQL_PLUGIN_EXPORT #endif #ifdef __cplusplus extern "C" { #endif /* known plugin types */ #define MYSQL_CLIENT_reserved1 0 #define MYSQL_CLIENT_reserved2 1 #define MYSQL_CLIENT_AUTHENTICATION_PLUGIN 2 #define MYSQL_CLIENT_TRACE_PLUGIN 3 #define MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION 0x0100 #define MYSQL_CLIENT_TRACE_PLUGIN_INTERFACE_VERSION 0x0100 #define MYSQL_CLIENT_MAX_PLUGINS 4 #define mysql_declare_client_plugin(X) \ MYSQL_PLUGIN_EXPORT struct st_mysql_client_plugin_ ## X \ _mysql_client_plugin_declaration_ = { \ MYSQL_CLIENT_ ## X ## _PLUGIN, \ MYSQL_CLIENT_ ## X ## _PLUGIN_INTERFACE_VERSION, #define mysql_end_client_plugin } /* generic plugin header structure */ #define MYSQL_CLIENT_PLUGIN_HEADER \ int type; \ unsigned int interface_version; \ const char *name; \ const char *author; \ const char *desc; \ unsigned int version[3]; \ const char *license; \ void *mysql_api; \ int (*init)(char *, size_t, int, va_list); \ int (*deinit)(void); \ int (*options)(const char *option, const void *); struct st_mysql_client_plugin { MYSQL_CLIENT_PLUGIN_HEADER }; struct st_mysql; /******** authentication plugin specific declarations *********/ #include "plugin_auth_common.h" struct st_mysql_client_plugin_AUTHENTICATION { MYSQL_CLIENT_PLUGIN_HEADER int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct st_mysql *mysql); }; /******** using plugins ************/ /** loads a plugin and initializes it @param mysql MYSQL structure. @param name a name of the plugin to load @param type type of plugin that should be loaded, -1 to disable type check @param argc number of arguments to pass to the plugin initialization function @param ... arguments for the plugin initialization function @retval a pointer to the loaded plugin, or NULL in case of a failure */ struct st_mysql_client_plugin * mysql_load_plugin(struct st_mysql *mysql, const char *name, int type, int argc, ...); /** loads a plugin and initializes it, taking va_list as an argument This is the same as mysql_load_plugin, but take va_list instead of a list of arguments. @param mysql MYSQL structure. @param name a name of the plugin to load @param type type of plugin that should be loaded, -1 to disable type check @param argc number of arguments to pass to the plugin initialization function @param args arguments for the plugin initialization function @retval a pointer to the loaded plugin, or NULL in case of a failure */ struct st_mysql_client_plugin * mysql_load_plugin_v(struct st_mysql *mysql, const char *name, int type, int argc, va_list args); /** finds an already loaded plugin by name, or loads it, if necessary @param mysql MYSQL structure. @param name a name of the plugin to load @param type type of plugin that should be loaded @retval a pointer to the plugin, or NULL in case of a failure */ struct st_mysql_client_plugin * mysql_client_find_plugin(struct st_mysql *mysql, const char *name, int type); /** adds a plugin structure to the list of loaded plugins This is useful if an application has the necessary functionality (for example, a special load data handler) statically linked into the application binary. It can use this function to register the plugin directly, avoiding the need to factor it out into a shared object. @param mysql MYSQL structure. It is only used for error reporting @param plugin an st_mysql_client_plugin structure to register @retval a pointer to the plugin, or NULL in case of a failure */ struct st_mysql_client_plugin * mysql_client_register_plugin(struct st_mysql *mysql, struct st_mysql_client_plugin *plugin); /** set plugin options Can be used to set extra options and affect behavior for a plugin. This function may be called multiple times to set several options @param plugin an st_mysql_client_plugin structure @param option a string which specifies the option to set @param value value for the option. @retval 0 on success, 1 in case of failure **/ int mysql_plugin_options(struct st_mysql_client_plugin *plugin, const char *option, const void *value); #ifdef __cplusplus } #endif #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/plugin_audit.h.pp�����������������������������������������������������������������������0000644�����������������00000035177�14763166026�0012361 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "plugin.h" typedef void * MYSQL_PLUGIN; struct st_mysql_xid { long formatID; long gtrid_length; long bqual_length; char data[128]; }; typedef struct st_mysql_xid MYSQL_XID; enum enum_mysql_show_type { SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG, SHOW_LONGLONG, SHOW_SIGNED_INT, SHOW_SIGNED_LONG, SHOW_SIGNED_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE }; enum enum_mysql_show_scope { SHOW_SCOPE_UNDEF, SHOW_SCOPE_GLOBAL }; struct st_mysql_show_var { const char *name; char *value; enum enum_mysql_show_type type; enum enum_mysql_show_scope scope; }; typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, char *); struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(void* thd, struct st_mysql_sys_var *var, void *save, struct st_mysql_value *value); typedef void (*mysql_var_update_func)(void* thd, struct st_mysql_sys_var *var, void *var_ptr, const void *save); struct st_mysql_plugin { int type; void *info; const char *name; const char *author; const char *descr; int license; int (*init)(MYSQL_PLUGIN); int (*deinit)(MYSQL_PLUGIN); unsigned int version; struct st_mysql_show_var *status_vars; struct st_mysql_sys_var **system_vars; void * __reserved1; unsigned long flags; }; struct st_mysql_daemon { int interface_version; }; struct st_mysql_information_schema { int interface_version; }; struct st_mysql_storage_engine { int interface_version; }; struct handlerton; struct Mysql_replication { int interface_version; }; struct st_mysql_value { int (*value_type)(struct st_mysql_value *); const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length); int (*val_real)(struct st_mysql_value *, double *realbuf); int (*val_int)(struct st_mysql_value *, long long *intbuf); int (*is_unsigned)(struct st_mysql_value *); }; int thd_in_lock_tables(const void* thd); int thd_tablespace_op(const void* thd); long long thd_test_options(const void* thd, long long test_options); int thd_sql_command(const void* thd); const char *set_thd_proc_info(void* thd, const char *info, const char *calling_func, const char *calling_file, const unsigned int calling_line); void **thd_ha_data(const void* thd, const struct handlerton *hton); void thd_storage_lock_wait(void* thd, long long value); int thd_tx_isolation(const void* thd); int thd_tx_is_read_only(const void* thd); void* thd_tx_arbitrate(void* requestor, void* holder); int thd_tx_priority(const void* thd); int thd_tx_is_dd_trx(const void* thd); char *thd_security_context(void* thd, char *buffer, size_t length, size_t max_query_len); void thd_inc_row_count(void* thd); int thd_allow_batch(void* thd); void thd_mark_transaction_to_rollback(void* thd, int all); enum mysql_trx_stat_type { MYSQL_TRX_STAT_IO_READ_BYTES, MYSQL_TRX_STAT_IO_READ_WAIT_USECS, MYSQL_TRX_STAT_LOCK_WAIT_USECS, MYSQL_TRX_STAT_INNODB_QUEUE_WAIT_USECS, MYSQL_TRX_STAT_ACCESS_PAGE_ID }; void thd_report_innodb_stat(void* thd, unsigned long long trx_id, enum mysql_trx_stat_type type, unsigned long long value); unsigned long thd_log_slow_verbosity(const void* thd); int thd_opt_slow_log(); int thd_is_background_thread(const void* thd); int mysql_tmpfile(const char *prefix); int thd_killed(const void* thd); void thd_set_kill_status(const void* thd); void thd_binlog_pos(const void* thd, const char **file_var, unsigned long long *pos_var); unsigned long thd_get_thread_id(const void* thd); int64_t thd_get_query_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); void mysql_query_cache_invalidate4(void* thd, const char *key, unsigned int key_length, int using_trx); void *thd_get_ha_data(const void* thd, const struct handlerton *hton); void thd_set_ha_data(void* thd, const struct handlerton *hton, const void *ha_data); int thd_command(const void* thd); long long thd_start_time(const void* thd); void thd_kill(unsigned long id); int thd_get_ft_query_extra_word_chars(void); #include "mysql/mysql_lex_string.h" struct st_mysql_lex_string { char *str; size_t length; }; typedef struct st_mysql_lex_string MYSQL_LEX_STRING; struct st_mysql_const_lex_string { const char *str; size_t length; }; typedef struct st_mysql_const_lex_string MYSQL_LEX_CSTRING; #include "my_command.h" enum enum_server_command { COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST, COM_CREATE_DB, COM_DROP_DB, COM_REFRESH, COM_SHUTDOWN, COM_STATISTICS, COM_PROCESS_INFO, COM_CONNECT, COM_PROCESS_KILL, COM_DEBUG, COM_PING, COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP, COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE, COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE, COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON, COM_BINLOG_DUMP_GTID, COM_RESET_CONNECTION, COM_END }; #include "my_sqlcommand.h" enum enum_sql_command { SQLCOM_SELECT, SQLCOM_CREATE_TABLE, SQLCOM_CREATE_INDEX, SQLCOM_ALTER_TABLE, SQLCOM_UPDATE, SQLCOM_INSERT, SQLCOM_INSERT_SELECT, SQLCOM_DELETE, SQLCOM_TRUNCATE, SQLCOM_DROP_TABLE, SQLCOM_DROP_INDEX, SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS, SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_STATUS, SQLCOM_SHOW_ENGINE_LOGS, SQLCOM_SHOW_ENGINE_STATUS, SQLCOM_SHOW_ENGINE_MUTEX, SQLCOM_SHOW_PROCESSLIST, SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_SLAVE_STAT, SQLCOM_SHOW_GRANTS, SQLCOM_SHOW_CREATE, SQLCOM_SHOW_CHARSETS, SQLCOM_SHOW_COLLATIONS, SQLCOM_SHOW_CREATE_DB, SQLCOM_SHOW_TABLE_STATUS, SQLCOM_SHOW_TRIGGERS, SQLCOM_LOAD, SQLCOM_SET_OPTION, SQLCOM_LOCK_TABLES, SQLCOM_UNLOCK_TABLES, SQLCOM_GRANT, SQLCOM_CHANGE_DB, SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB, SQLCOM_REPAIR, SQLCOM_REPLACE, SQLCOM_REPLACE_SELECT, SQLCOM_CREATE_FUNCTION, SQLCOM_DROP_FUNCTION, SQLCOM_REVOKE, SQLCOM_OPTIMIZE, SQLCOM_CHECK, SQLCOM_ASSIGN_TO_KEYCACHE, SQLCOM_PRELOAD_KEYS, SQLCOM_FLUSH, SQLCOM_KILL, SQLCOM_ANALYZE, SQLCOM_ROLLBACK, SQLCOM_ROLLBACK_TO_SAVEPOINT, SQLCOM_COMMIT, SQLCOM_SAVEPOINT, SQLCOM_RELEASE_SAVEPOINT, SQLCOM_SLAVE_START, SQLCOM_SLAVE_STOP, SQLCOM_START_GROUP_REPLICATION, SQLCOM_STOP_GROUP_REPLICATION, SQLCOM_BEGIN, SQLCOM_CHANGE_MASTER, SQLCOM_CHANGE_REPLICATION_FILTER, SQLCOM_RENAME_TABLE, SQLCOM_RESET, SQLCOM_PURGE, SQLCOM_PURGE_BEFORE, SQLCOM_SHOW_BINLOGS, SQLCOM_SHOW_OPEN_TABLES, SQLCOM_HA_OPEN, SQLCOM_HA_CLOSE, SQLCOM_HA_READ, SQLCOM_SHOW_SLAVE_HOSTS, SQLCOM_DELETE_MULTI, SQLCOM_UPDATE_MULTI, SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_DO, SQLCOM_SHOW_WARNS, SQLCOM_EMPTY_QUERY, SQLCOM_SHOW_ERRORS, SQLCOM_SHOW_STORAGE_ENGINES, SQLCOM_SHOW_PRIVILEGES, SQLCOM_HELP, SQLCOM_CREATE_USER, SQLCOM_DROP_USER, SQLCOM_RENAME_USER, SQLCOM_REVOKE_ALL, SQLCOM_CHECKSUM, SQLCOM_CREATE_PROCEDURE, SQLCOM_CREATE_SPFUNCTION, SQLCOM_CALL, SQLCOM_DROP_PROCEDURE, SQLCOM_ALTER_PROCEDURE, SQLCOM_ALTER_FUNCTION, SQLCOM_SHOW_CREATE_PROC, SQLCOM_SHOW_CREATE_FUNC, SQLCOM_SHOW_STATUS_PROC, SQLCOM_SHOW_STATUS_FUNC, SQLCOM_PREPARE, SQLCOM_EXECUTE, SQLCOM_DEALLOCATE_PREPARE, SQLCOM_CREATE_VIEW, SQLCOM_DROP_VIEW, SQLCOM_CREATE_TRIGGER, SQLCOM_DROP_TRIGGER, SQLCOM_XA_START, SQLCOM_XA_END, SQLCOM_XA_PREPARE, SQLCOM_XA_COMMIT, SQLCOM_XA_ROLLBACK, SQLCOM_XA_RECOVER, SQLCOM_SHOW_PROC_CODE, SQLCOM_SHOW_FUNC_CODE, SQLCOM_ALTER_TABLESPACE, SQLCOM_INSTALL_PLUGIN, SQLCOM_UNINSTALL_PLUGIN, SQLCOM_BINLOG_BASE64_EVENT, SQLCOM_SHOW_PLUGINS, SQLCOM_CREATE_SERVER, SQLCOM_DROP_SERVER, SQLCOM_ALTER_SERVER, SQLCOM_CREATE_EVENT, SQLCOM_ALTER_EVENT, SQLCOM_DROP_EVENT, SQLCOM_SHOW_CREATE_EVENT, SQLCOM_SHOW_EVENTS, SQLCOM_SHOW_CREATE_TRIGGER, SQLCOM_ALTER_DB_UPGRADE, SQLCOM_SHOW_PROFILE, SQLCOM_SHOW_PROFILES, SQLCOM_SIGNAL, SQLCOM_RESIGNAL, SQLCOM_SHOW_RELAYLOG_EVENTS, SQLCOM_GET_DIAGNOSTICS, SQLCOM_ALTER_USER, SQLCOM_EXPLAIN_OTHER, SQLCOM_SHOW_CREATE_USER, SQLCOM_SHUTDOWN, SQLCOM_ALTER_INSTANCE, SQLCOM_SHOW_USER_STATS, SQLCOM_SHOW_TABLE_STATS, SQLCOM_SHOW_INDEX_STATS, SQLCOM_SHOW_CLIENT_STATS, SQLCOM_SHOW_THREAD_STATS, SQLCOM_LOCK_TABLES_FOR_BACKUP, SQLCOM_LOCK_BINLOG_FOR_BACKUP, SQLCOM_UNLOCK_BINLOG, SQLCOM_CREATE_COMPRESSION_DICTIONARY, SQLCOM_DROP_COMPRESSION_DICTIONARY, SQLCOM_END }; typedef enum { MYSQL_AUDIT_GENERAL_CLASS = 0, MYSQL_AUDIT_CONNECTION_CLASS = 1, MYSQL_AUDIT_PARSE_CLASS = 2, MYSQL_AUDIT_AUTHORIZATION_CLASS = 3, MYSQL_AUDIT_TABLE_ACCESS_CLASS = 4, MYSQL_AUDIT_GLOBAL_VARIABLE_CLASS = 5, MYSQL_AUDIT_SERVER_STARTUP_CLASS = 6, MYSQL_AUDIT_SERVER_SHUTDOWN_CLASS = 7, MYSQL_AUDIT_COMMAND_CLASS = 8, MYSQL_AUDIT_QUERY_CLASS = 9, MYSQL_AUDIT_STORED_PROGRAM_CLASS = 10, MYSQL_AUDIT_CLASS_MASK_SIZE } mysql_event_class_t; struct st_mysql_audit { int interface_version; void (*release_thd)(void*); int (*event_notify)(void*, mysql_event_class_t, const void *); unsigned long class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE]; }; typedef enum enum_sql_command enum_sql_command_t; typedef enum { MYSQL_AUDIT_GENERAL_LOG = 1 << 0, MYSQL_AUDIT_GENERAL_ERROR = 1 << 1, MYSQL_AUDIT_GENERAL_RESULT = 1 << 2, MYSQL_AUDIT_GENERAL_STATUS = 1 << 3 } mysql_event_general_subclass_t; struct mysql_event_general { mysql_event_general_subclass_t event_subclass; int general_error_code; unsigned long general_thread_id; MYSQL_LEX_CSTRING general_user; MYSQL_LEX_CSTRING general_command; MYSQL_LEX_CSTRING general_query; struct charset_info_st *general_charset; unsigned long long general_time; unsigned long long general_rows; MYSQL_LEX_CSTRING general_host; MYSQL_LEX_CSTRING general_sql_command; MYSQL_LEX_CSTRING general_external_user; MYSQL_LEX_CSTRING general_ip; }; typedef enum { MYSQL_AUDIT_CONNECTION_CONNECT = 1 << 0, MYSQL_AUDIT_CONNECTION_DISCONNECT = 1 << 1, MYSQL_AUDIT_CONNECTION_CHANGE_USER = 1 << 2, MYSQL_AUDIT_CONNECTION_PRE_AUTHENTICATE = 1 << 3 } mysql_event_connection_subclass_t; struct mysql_event_connection { mysql_event_connection_subclass_t event_subclass; int status; unsigned long connection_id; MYSQL_LEX_CSTRING user; MYSQL_LEX_CSTRING priv_user; MYSQL_LEX_CSTRING external_user; MYSQL_LEX_CSTRING proxy_user; MYSQL_LEX_CSTRING host; MYSQL_LEX_CSTRING ip; MYSQL_LEX_CSTRING database; int connection_type; }; typedef enum { MYSQL_AUDIT_PARSE_PREPARSE = 1 << 0, MYSQL_AUDIT_PARSE_POSTPARSE = 1 << 1 } mysql_event_parse_subclass_t; typedef enum { MYSQL_AUDIT_PARSE_REWRITE_PLUGIN_NONE = 0, MYSQL_AUDIT_PARSE_REWRITE_PLUGIN_QUERY_REWRITTEN = 1 << 0, MYSQL_AUDIT_PARSE_REWRITE_PLUGIN_IS_PREPARED_STATEMENT = 1 << 1 } mysql_event_parse_rewrite_plugin_flag; struct mysql_event_parse { mysql_event_parse_subclass_t event_subclass; mysql_event_parse_rewrite_plugin_flag *flags; MYSQL_LEX_CSTRING query; MYSQL_LEX_CSTRING *rewritten_query; }; typedef enum { MYSQL_AUDIT_AUTHORIZATION_USER = 1 << 0, MYSQL_AUDIT_AUTHORIZATION_DB = 1 << 1, MYSQL_AUDIT_AUTHORIZATION_TABLE = 1 << 2, MYSQL_AUDIT_AUTHORIZATION_COLUMN = 1 << 3, MYSQL_AUDIT_AUTHORIZATION_PROCEDURE = 1 << 4, MYSQL_AUDIT_AUTHORIZATION_PROXY = 1 << 5 } mysql_event_authorization_subclass_t; struct mysql_event_authorization { mysql_event_authorization_subclass_t event_subclass; int status; unsigned int connection_id; enum_sql_command_t sql_command_id; MYSQL_LEX_CSTRING query; const struct charset_info_st *query_charset; MYSQL_LEX_CSTRING database; MYSQL_LEX_CSTRING table; MYSQL_LEX_CSTRING object; unsigned long requested_privilege; unsigned long granted_privilege; }; typedef enum { MYSQL_AUDIT_TABLE_ACCESS_READ = 1 << 0, MYSQL_AUDIT_TABLE_ACCESS_INSERT = 1 << 1, MYSQL_AUDIT_TABLE_ACCESS_UPDATE = 1 << 2, MYSQL_AUDIT_TABLE_ACCESS_DELETE = 1 << 3 } mysql_event_table_access_subclass_t; struct mysql_event_table_access { mysql_event_table_access_subclass_t event_subclass; unsigned long connection_id; enum_sql_command_t sql_command_id; MYSQL_LEX_CSTRING query; const struct charset_info_st *query_charset; MYSQL_LEX_CSTRING table_database; MYSQL_LEX_CSTRING table_name; }; typedef enum { MYSQL_AUDIT_GLOBAL_VARIABLE_GET = 1 << 0, MYSQL_AUDIT_GLOBAL_VARIABLE_SET = 1 << 1 } mysql_event_global_variable_subclass_t; struct mysql_event_global_variable { mysql_event_global_variable_subclass_t event_subclass; unsigned long connection_id; enum_sql_command_t sql_command_id; MYSQL_LEX_CSTRING variable_name; MYSQL_LEX_CSTRING variable_value; }; typedef enum { MYSQL_AUDIT_SERVER_STARTUP_STARTUP = 1 << 0 } mysql_event_server_startup_subclass_t; struct mysql_event_server_startup { mysql_event_server_startup_subclass_t event_subclass; const char **argv; unsigned int argc; }; typedef enum { MYSQL_AUDIT_SERVER_SHUTDOWN_SHUTDOWN = 1 << 0 } mysql_event_server_shutdown_subclass_t; typedef enum { MYSQL_AUDIT_SERVER_SHUTDOWN_REASON_SHUTDOWN, MYSQL_AUDIT_SERVER_SHUTDOWN_REASON_ABORT } mysql_server_shutdown_reason_t; struct mysql_event_server_shutdown { mysql_event_server_shutdown_subclass_t event_subclass; int exit_code; mysql_server_shutdown_reason_t reason; }; typedef enum { MYSQL_AUDIT_COMMAND_START = 1 << 0, MYSQL_AUDIT_COMMAND_END = 1 << 1 } mysql_event_command_subclass_t; typedef enum enum_server_command enum_server_command_t; struct mysql_event_command { mysql_event_command_subclass_t event_subclass; int status; unsigned long connection_id; enum_server_command_t command_id; }; typedef enum { MYSQL_AUDIT_QUERY_START = 1 << 0, MYSQL_AUDIT_QUERY_NESTED_START = 1 << 1, MYSQL_AUDIT_QUERY_STATUS_END = 1 << 2, MYSQL_AUDIT_QUERY_NESTED_STATUS_END = 1 << 3 } mysql_event_query_subclass_t; struct mysql_event_query { mysql_event_query_subclass_t event_subclass; int status; unsigned long connection_id; enum_sql_command_t sql_command_id; MYSQL_LEX_CSTRING query; const struct charset_info_st *query_charset; }; typedef enum { MYSQL_AUDIT_STORED_PROGRAM_EXECUTE = 1 << 0 } mysql_event_stored_program_subclass_t; struct mysql_event_stored_program { mysql_event_stored_program_subclass_t event_subclass; unsigned long connection_id; enum_sql_command_t sql_command_id; MYSQL_LEX_CSTRING query; const struct charset_info_st *query_charset; MYSQL_LEX_CSTRING database; MYSQL_LEX_CSTRING name; void *parameters; }; �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/plugin_auth.h.pp������������������������������������������������������������������������0000644�����������������00000013441�14763166026�0012202 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <mysql/plugin.h> typedef void * MYSQL_PLUGIN; struct st_mysql_xid { long formatID; long gtrid_length; long bqual_length; char data[128]; }; typedef struct st_mysql_xid MYSQL_XID; enum enum_mysql_show_type { SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG, SHOW_LONGLONG, SHOW_SIGNED_INT, SHOW_SIGNED_LONG, SHOW_SIGNED_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE }; enum enum_mysql_show_scope { SHOW_SCOPE_UNDEF, SHOW_SCOPE_GLOBAL }; struct st_mysql_show_var { const char *name; char *value; enum enum_mysql_show_type type; enum enum_mysql_show_scope scope; }; typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, char *); struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(void* thd, struct st_mysql_sys_var *var, void *save, struct st_mysql_value *value); typedef void (*mysql_var_update_func)(void* thd, struct st_mysql_sys_var *var, void *var_ptr, const void *save); struct st_mysql_plugin { int type; void *info; const char *name; const char *author; const char *descr; int license; int (*init)(MYSQL_PLUGIN); int (*deinit)(MYSQL_PLUGIN); unsigned int version; struct st_mysql_show_var *status_vars; struct st_mysql_sys_var **system_vars; void * __reserved1; unsigned long flags; }; struct st_mysql_daemon { int interface_version; }; struct st_mysql_information_schema { int interface_version; }; struct st_mysql_storage_engine { int interface_version; }; struct handlerton; struct Mysql_replication { int interface_version; }; struct st_mysql_value { int (*value_type)(struct st_mysql_value *); const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length); int (*val_real)(struct st_mysql_value *, double *realbuf); int (*val_int)(struct st_mysql_value *, long long *intbuf); int (*is_unsigned)(struct st_mysql_value *); }; int thd_in_lock_tables(const void* thd); int thd_tablespace_op(const void* thd); long long thd_test_options(const void* thd, long long test_options); int thd_sql_command(const void* thd); const char *set_thd_proc_info(void* thd, const char *info, const char *calling_func, const char *calling_file, const unsigned int calling_line); void **thd_ha_data(const void* thd, const struct handlerton *hton); void thd_storage_lock_wait(void* thd, long long value); int thd_tx_isolation(const void* thd); int thd_tx_is_read_only(const void* thd); void* thd_tx_arbitrate(void* requestor, void* holder); int thd_tx_priority(const void* thd); int thd_tx_is_dd_trx(const void* thd); char *thd_security_context(void* thd, char *buffer, size_t length, size_t max_query_len); void thd_inc_row_count(void* thd); int thd_allow_batch(void* thd); void thd_mark_transaction_to_rollback(void* thd, int all); enum mysql_trx_stat_type { MYSQL_TRX_STAT_IO_READ_BYTES, MYSQL_TRX_STAT_IO_READ_WAIT_USECS, MYSQL_TRX_STAT_LOCK_WAIT_USECS, MYSQL_TRX_STAT_INNODB_QUEUE_WAIT_USECS, MYSQL_TRX_STAT_ACCESS_PAGE_ID }; void thd_report_innodb_stat(void* thd, unsigned long long trx_id, enum mysql_trx_stat_type type, unsigned long long value); unsigned long thd_log_slow_verbosity(const void* thd); int thd_opt_slow_log(); int thd_is_background_thread(const void* thd); int mysql_tmpfile(const char *prefix); int thd_killed(const void* thd); void thd_set_kill_status(const void* thd); void thd_binlog_pos(const void* thd, const char **file_var, unsigned long long *pos_var); unsigned long thd_get_thread_id(const void* thd); int64_t thd_get_query_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); void mysql_query_cache_invalidate4(void* thd, const char *key, unsigned int key_length, int using_trx); void *thd_get_ha_data(const void* thd, const struct handlerton *hton); void thd_set_ha_data(void* thd, const struct handlerton *hton, const void *ha_data); int thd_command(const void* thd); long long thd_start_time(const void* thd); void thd_kill(unsigned long id); int thd_get_ft_query_extra_word_chars(void); #include "plugin_auth_common.h" typedef struct st_plugin_vio_info { enum { MYSQL_VIO_INVALID, MYSQL_VIO_TCP, MYSQL_VIO_SOCKET, MYSQL_VIO_PIPE, MYSQL_VIO_MEMORY } protocol; int socket; } MYSQL_PLUGIN_VIO_INFO; typedef struct st_plugin_vio { int (*read_packet)(struct st_plugin_vio *vio, unsigned char **buf); int (*write_packet)(struct st_plugin_vio *vio, const unsigned char *packet, int packet_len); void (*info)(struct st_plugin_vio *vio, struct st_plugin_vio_info *info); } MYSQL_PLUGIN_VIO; typedef struct st_mysql_server_auth_info { char *user_name; unsigned int user_name_length; const char *auth_string; unsigned long auth_string_length; char authenticated_as[96 +1]; char external_user[512]; int password_used; const char *host_or_ip; unsigned int host_or_ip_length; } MYSQL_SERVER_AUTH_INFO; struct st_mysql_auth { int interface_version; const char *client_auth_plugin; int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info); int (*generate_authentication_string)(char *outbuf, unsigned int *outbuflen, const char *inbuf, unsigned int inbuflen); int (*validate_authentication_string)(char* const inbuf, unsigned int buflen); int (*set_salt)(const char *password, unsigned int password_len, unsigned char* salt, unsigned char *salt_len); const unsigned long authentication_flags; }; �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/plugin_keyring.h������������������������������������������������������������������������0000644�����������������00000014222�14763166026�0012271 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2016, 2017 Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_PLUGIN_KEYRING_INCLUDED #define MYSQL_PLUGIN_KEYRING_INCLUDED /** API for keyring plugin. (MYSQL_KEYRING_PLUGIN) */ #include "plugin.h" #define MYSQL_KEYRING_INTERFACE_VERSION 0x0101 /** The descriptor structure for the plugin, that is referred from st_mysql_plugin. */ struct st_mysql_keyring { int interface_version; /*! Add key to the keyring. Obfuscates and adds the key to the keyring. The key is associated with key_id and user_id (unique key identifier). @param[in] key_id id of the key to store @param[in] key_type type of the key to store @param[in] user_id id of the owner of the key @param[in] key the key itself to be stored. The memory of the key is copied by the keyring, thus the key itself can be freed after it was stored in the keyring. @param[in] key_len the length of the key to be stored @return Operation status @retval 0 OK @retval 1 ERROR */ my_bool (*mysql_key_store)(const char *key_id, const char *key_type, const char* user_id, const void *key, size_t key_len); /*! Fetches key from the keyring. De-obfuscates and retrieves key associated with key_id and user_id from the keyring. @param[in] key_id id of the key to fetch @param[out] key_type type of the fetched key @param[in] user_id id of the owner of the key @param[out] key the fetched key itself. The memory for this key is allocated by the keyring and needs to be freed by the user when no longer needed. Prior to freeing the memory it needs to be obfuscated or zeroed. @param[out] key_len the length of the fetched key @return Operation status @retval 0 OK @retval 1 ERROR */ my_bool (*mysql_key_fetch)(const char *key_id, char **key_type, const char *user_id, void **key, size_t *key_len); /*! Removes key from the keyring. Removes the key associated with key_id and user_id from the keyring. @param[in] key_id id of the key to remove @param[in] user_id id of the owner of the key to remove @return Operation status @retval 0 OK @retval 1 ERROR */ my_bool (*mysql_key_remove)(const char *key_id, const char *user_id); /*! Generates and stores the key. Generates a random key of length key_len, associates it with key_id, user_id and stores it in the keyring. @param[in] key_id id of the key to generate @param[in] key_type type of the key to generate @param[in] user_id id of the owner of the generated key @param[in] key_len length of the key to generate @return Operation status @retval 0 OK @retval 1 ERROR */ my_bool (*mysql_key_generate)(const char *key_id, const char *key_type, const char *user_id, size_t key_len); /** Keys_iterator object refers to an iterator which is used to iterate on a list which refers to Key_metadata. Key_metadata hold information about individual keys keyd_id and user_id. Keys_iterator should be used in following sequence only. void* iterator_ptr; char key_id[64]= { 0 }; char user_id[64]= { 0 }; plugin_handle->mysql_key_iterator_init(&iterator_ptr); if (iterator_ptr == NULL) report error; while (!(plugin_handle->mysql_key_iterator_get_key(iterator_ptr, key_id, user_id))) { Fetch the keys. Perform operations on the fetched keys. .. } plugin_handle->mysql_key_iterator_deinit(iterator_ptr); init() method accepts a void pointer which is the made to point to Keys_iterator instance. Keys_iterator instance internal pointer points to Key_metadata list. This list holds information about all keys stored in the backed end data store of keyring plugin. After call to init() please check iterator_ptr. get_key() method accepts the above iterator_ptr as IN param and then fills the passes in key_id and user_id with valid values. This can be used to fetch actual key information. Every call to this method will change internal pointers to advance to next position, so that the next call will fetch the next key. deinit() method frees all internal pointers along with iterator_ptr. */ /** Initialize an iterator. @param[out] key_iterator Iterator used to fetch individual keys from key_container. @return VOID */ void (*mysql_key_iterator_init)(void** key_iterator); /** Deinitialize an iterator. @param[in] key_iterator Iterator used to fetch individual keys from key_container. @return VOID */ void (*mysql_key_iterator_deinit)(void* key_iterator); /** Get details of key. Every call to this service will change internal pointers to advance to next position, so that the next call will fetch the next key. In case iterator moves to the end, this service will return error. @param[in] key_iterator Iterator used to fetch individual keys from key_container. @param[out] key_id id of the key @param[out] user_id id of the owner @return Operation status @retval 0 OK @retval 1 ERROR */ bool (*mysql_key_iterator_get_key)(void* key_iterator, char *key_id, char *user_id); }; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/service_srv_session_info.h��������������������������������������������������������������0000644�����������������00000012162�14763166026�0014354 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef MYSQL_SERVICE_SRV_SESSION_INFO_INCLUDED #define MYSQL_SERVICE_SRV_SESSION_INFO_INCLUDED /* Copyright (c) 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** @file Service providing setters and getters for some properties of a session */ #include "mysql/service_srv_session.h" #ifndef MYSQL_ABI_CHECK #include "my_thread.h" /* my_thread_id */ #include "m_string.h" /* LEX_CSTRING */ #include "plugin.h" /* MYSQL_THD */ #include "mysql_com.h" /* Vio for violite.h */ #include "violite.h" /* enum_vio_type */ #include <stdint.h> /* uint16_t */ #endif #ifdef __cplusplus extern "C" { #endif extern struct srv_session_info_service_st { MYSQL_THD (*get_thd)(MYSQL_SESSION session); my_thread_id (*get_session_id)(MYSQL_SESSION session); LEX_CSTRING (*get_current_db)(MYSQL_SESSION session); uint16_t (*get_client_port)(MYSQL_SESSION session); int (*set_client_port)(MYSQL_SESSION session, uint16_t port); int (*set_connection_type)(MYSQL_SESSION session, enum enum_vio_type type); int (*killed)(MYSQL_SESSION session); unsigned int (*session_count)(); unsigned int (*thread_count)(const void *plugin); } *srv_session_info_service; #ifdef MYSQL_DYNAMIC_PLUGIN #define srv_session_info_get_thd(session) srv_session_info_service->get_thd((session)) #define srv_session_info_get_session_id(sess) srv_session_info_service->get_session_id((sess)) #define srv_session_info_get_current_db(sess) srv_session_info_service->get_current_db((sess)) #define srv_session_info_get_client_port(sess) srv_session_info_service->get_client_port((sess)) #define srv_session_info_set_client_port(sess, port) srv_session_info_service->set_client_port((sess), (port)) #define srv_session_info_set_connection_type(sess, type) srv_session_info_service->set_connection_type((sess), (type)) #define srv_session_info_killed(sess) srv_session_info_service->killed((sess)) #define srv_session_info_session_count(sess) srv_session_info_service->session_count(sess) #define srv_session_info_thread_count(plugin) srv_session_info_service->thread_count(plugin) #else /** Returns the THD of a session. @param session Session @returns address of the THD */ MYSQL_THD srv_session_info_get_thd(MYSQL_SESSION session); /** Returns the ID of a session. @param session Session */ my_thread_id srv_session_info_get_session_id(MYSQL_SESSION session); /** Returns the current database of a session. @note {NULL, 0} is returned case of no current database or session is NULL @param session Session */ LEX_CSTRING srv_session_info_get_current_db(MYSQL_SESSION session); /** Returns the client port of a session. @note The client port in SHOW PROCESSLIST, INFORMATION_SCHEMA.PROCESSLIST. This port is NOT shown in PERFORMANCE_SCHEMA.THREADS. @param session Session */ uint16_t srv_session_info_get_client_port(MYSQL_SESSION session); /** Sets the client port of a session. @note The client port in SHOW PROCESSLIST, INFORMATION_SCHEMA.PROCESSLIST. This port is NOT shown in PERFORMANCE_SCHEMA.THREADS. @param session Session @param port Port number @return 0 success 1 failure */ int srv_session_info_set_client_port(MYSQL_SESSION session, uint16_t port); /** Sets the connection type of a session. @see enum_vio_type @note The type is shown in PERFORMANCE_SCHEMA.THREADS. The value is translated from the enum to a string according to @see vio_type_names array in vio/vio.c @note If NO_VIO_TYPE passed as type the call will fail. @return 0 success 1 failure */ int srv_session_info_set_connection_type(MYSQL_SESSION session, enum enum_vio_type type); /** Returns whether the session was killed @param session Session @return 0 not killed 1 killed */ int srv_session_info_killed(MYSQL_SESSION session); /** Returns the number opened sessions in thread initialized by srv_session service. */ unsigned int srv_session_info_session_count(); /** Returns the number opened sessions in thread initialized by srv_session service. @param plugin Pointer to the plugin structure, passed to the plugin over the plugin init function. */ unsigned int srv_session_info_thread_count(const void *plugin); #endif /* MYSQL_DYNAMIC_PLUGIN */ #ifdef __cplusplus } /* extern "C" */ #endif #endif /* MYSQL_SERVICE_SRV_SESSION_INFO_INCLUDED */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/service_my_snprintf.h�������������������������������������������������������������������0000644�����������������00000006521�14763166026�0013336 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef MYSQL_SERVICE_MY_SNPRINTF_INCLUDED #define MYSQL_SERVICE_MY_SNPRINTF_INCLUDED /* Copyright (c) 2009, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** @file my_snprintf service Portable and limited vsnprintf() implementation. This is a portable, limited vsnprintf() implementation, with some extra features. "Portable" means that it'll produce identical result on all platforms (for example, on Windows and Linux system printf %e formats the exponent differently, on different systems %p either prints leading 0x or not, %s may accept null pointer or crash on it). "Limited" means that it does not support all the C89 features. But it supports few extensions, not in any standard. my_vsnprintf(to, n, fmt, ap) @param[out] to A buffer to store the result in @param[in] n Store up to n-1 characters, followed by an end 0 @param[in] fmt printf-like format string @param[in] ap Arguments @return a number of bytes written to a buffer *excluding* terminating '\0' @post The syntax of a format string is generally the same: % <flag> <width> <precision> <length modifier> <format> where everithing but the format is optional. Three one-character flags are recognized: '0' has the standard zero-padding semantics; '-' is parsed, but silently ignored; '`' (backtick) is only supported for strings (%s) and means that the string will be quoted according to MySQL identifier quoting rules. Both <width> and <precision> can be specified as numbers or '*'. If an asterisk is used, an argument of type int is consumed. <length modifier> can be 'l', 'll', or 'z'. Supported formats are 's' (null pointer is accepted, printed as "(null)"), 'b' (extension, see below), 'c', 'd', 'i', 'u', 'x', 'o', 'X', 'p' (works as 0x%x). Standard syntax for positional arguments $n is supported. Extensions: Flag '`' (backtick): see above. Format 'b': binary buffer, prints exactly <precision> bytes from the argument, without stopping at '\0'. */ #ifdef __cplusplus extern "C" { #endif #ifndef MYSQL_ABI_CHECK #include <stdarg.h> #include <stdlib.h> #endif extern struct my_snprintf_service_st { size_t (*my_snprintf_type)(char*, size_t, const char*, ...); size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list); } *my_snprintf_service; #ifdef MYSQL_DYNAMIC_PLUGIN #define my_vsnprintf my_snprintf_service->my_vsnprintf_type #define my_snprintf my_snprintf_service->my_snprintf_type #else size_t my_snprintf(char* to, size_t n, const char* fmt, ...); size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap); #endif #ifdef __cplusplus } #endif #endif /* #define MYSQL_SERVICE_MY_SNPRINTF_INCLUDED */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/innodb_priv.h���������������������������������������������������������������������������0000644�����������������00000004167�14763166026�0011563 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef INNODB_PRIV_INCLUDED #define INNODB_PRIV_INCLUDED /** @file Declaring server-internal functions that are used by InnoDB. */ class THD; int get_quote_char_for_identifier(THD *thd, const char *name, size_t length); bool schema_table_store_record(THD *thd, TABLE *table); void localtime_to_TIME(MYSQL_TIME *to, struct tm *from); bool check_global_access(THD *thd, ulong want_access); size_t strconvert(CHARSET_INFO *from_cs, const char *from, CHARSET_INFO *to_cs, char *to, size_t to_length, uint *errors); void sql_print_error(const char *format, ...); /** Store record to I_S table, convert HEAP table to InnoDB table if necessary. @param[in] thd thread handler @param[in] table Information schema table to be updated @param[in] make_ondisk if true, convert heap table to on disk table. default value is true. @return 0 on success @return error code on failure. */ int schema_table_store_record2(THD *thd, TABLE *table, bool make_ondisk); /** Convert HEAP table to InnoDB table if necessary @param[in] thd thread handler @param[in] table Information schema table to be converted. @param[in] error the error code returned previously. @return false on success, true on error. */ bool convert_heap_table_to_ondisk(THD *thd, TABLE *table, int error); #endif /* INNODB_PRIV_INCLUDED */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/plugin_ftparser.h.pp��������������������������������������������������������������������0000644�����������������00000013015�14763166026�0013064 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "plugin.h" typedef void * MYSQL_PLUGIN; struct st_mysql_xid { long formatID; long gtrid_length; long bqual_length; char data[128]; }; typedef struct st_mysql_xid MYSQL_XID; enum enum_mysql_show_type { SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG, SHOW_LONGLONG, SHOW_SIGNED_INT, SHOW_SIGNED_LONG, SHOW_SIGNED_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE }; enum enum_mysql_show_scope { SHOW_SCOPE_UNDEF, SHOW_SCOPE_GLOBAL }; struct st_mysql_show_var { const char *name; char *value; enum enum_mysql_show_type type; enum enum_mysql_show_scope scope; }; typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, char *); struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(void* thd, struct st_mysql_sys_var *var, void *save, struct st_mysql_value *value); typedef void (*mysql_var_update_func)(void* thd, struct st_mysql_sys_var *var, void *var_ptr, const void *save); struct st_mysql_plugin { int type; void *info; const char *name; const char *author; const char *descr; int license; int (*init)(MYSQL_PLUGIN); int (*deinit)(MYSQL_PLUGIN); unsigned int version; struct st_mysql_show_var *status_vars; struct st_mysql_sys_var **system_vars; void * __reserved1; unsigned long flags; }; struct st_mysql_daemon { int interface_version; }; struct st_mysql_information_schema { int interface_version; }; struct st_mysql_storage_engine { int interface_version; }; struct handlerton; struct Mysql_replication { int interface_version; }; struct st_mysql_value { int (*value_type)(struct st_mysql_value *); const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length); int (*val_real)(struct st_mysql_value *, double *realbuf); int (*val_int)(struct st_mysql_value *, long long *intbuf); int (*is_unsigned)(struct st_mysql_value *); }; int thd_in_lock_tables(const void* thd); int thd_tablespace_op(const void* thd); long long thd_test_options(const void* thd, long long test_options); int thd_sql_command(const void* thd); const char *set_thd_proc_info(void* thd, const char *info, const char *calling_func, const char *calling_file, const unsigned int calling_line); void **thd_ha_data(const void* thd, const struct handlerton *hton); void thd_storage_lock_wait(void* thd, long long value); int thd_tx_isolation(const void* thd); int thd_tx_is_read_only(const void* thd); void* thd_tx_arbitrate(void* requestor, void* holder); int thd_tx_priority(const void* thd); int thd_tx_is_dd_trx(const void* thd); char *thd_security_context(void* thd, char *buffer, size_t length, size_t max_query_len); void thd_inc_row_count(void* thd); int thd_allow_batch(void* thd); void thd_mark_transaction_to_rollback(void* thd, int all); enum mysql_trx_stat_type { MYSQL_TRX_STAT_IO_READ_BYTES, MYSQL_TRX_STAT_IO_READ_WAIT_USECS, MYSQL_TRX_STAT_LOCK_WAIT_USECS, MYSQL_TRX_STAT_INNODB_QUEUE_WAIT_USECS, MYSQL_TRX_STAT_ACCESS_PAGE_ID }; void thd_report_innodb_stat(void* thd, unsigned long long trx_id, enum mysql_trx_stat_type type, unsigned long long value); unsigned long thd_log_slow_verbosity(const void* thd); int thd_opt_slow_log(); int thd_is_background_thread(const void* thd); int mysql_tmpfile(const char *prefix); int thd_killed(const void* thd); void thd_set_kill_status(const void* thd); void thd_binlog_pos(const void* thd, const char **file_var, unsigned long long *pos_var); unsigned long thd_get_thread_id(const void* thd); int64_t thd_get_query_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); void mysql_query_cache_invalidate4(void* thd, const char *key, unsigned int key_length, int using_trx); void *thd_get_ha_data(const void* thd, const struct handlerton *hton); void thd_set_ha_data(void* thd, const struct handlerton *hton, const void *ha_data); int thd_command(const void* thd); long long thd_start_time(const void* thd); void thd_kill(unsigned long id); int thd_get_ft_query_extra_word_chars(void); enum enum_ftparser_mode { MYSQL_FTPARSER_SIMPLE_MODE= 0, MYSQL_FTPARSER_WITH_STOPWORDS= 1, MYSQL_FTPARSER_FULL_BOOLEAN_INFO= 2 }; enum enum_ft_token_type { FT_TOKEN_EOF= 0, FT_TOKEN_WORD= 1, FT_TOKEN_LEFT_PAREN= 2, FT_TOKEN_RIGHT_PAREN= 3, FT_TOKEN_STOPWORD= 4 }; typedef struct st_mysql_ftparser_boolean_info { enum enum_ft_token_type type; int yesno; int weight_adjust; char wasign; char trunc; int position; char prev; char *quot; } MYSQL_FTPARSER_BOOLEAN_INFO; typedef struct st_mysql_ftparser_param { int (*mysql_parse)(struct st_mysql_ftparser_param *, char *doc, int doc_len); int (*mysql_add_word)(struct st_mysql_ftparser_param *, char *word, int word_len, MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info); void *ftparser_state; void *mysql_ftparam; const struct charset_info_st *cs; char *doc; int length; int flags; enum enum_ftparser_mode mode; } MYSQL_FTPARSER_PARAM; struct st_mysql_ftparser { int interface_version; int (*parse)(MYSQL_FTPARSER_PARAM *param); int (*init)(MYSQL_FTPARSER_PARAM *param); int (*deinit)(MYSQL_FTPARSER_PARAM *param); }; �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/service_rpl_transaction_write_set.h�����������������������������������������������������0000644�����������������00000004730�14763166026�0016255 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2014, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_SERVICE_TRANSACTION_WRITE_SET_INCLUDED /** @file include/mysql/service_rpl_transaction_write_set.h This service provides a function for plugins to get the write set of a given transaction. SYNOPSIS get_transaction_write_set() This service is used to fetch the write_set extracted for the currently executing transaction by passing the thread_id as an input parameter for the method. @param [in] - thread_id - It is the thread identifier of the currently executing thread. In the current implementation it is being called during RUN_HOOK macro, on which we know that thread is on plugin context. Cleanup : The service caller must take of the memory allocated during the service call to prevent memory leaks. */ #ifndef MYSQL_ABI_CHECK #include <stdlib.h> #endif #ifdef __cplusplus extern "C" { #endif /** This structure is used to keep the list of the hash values of the records changed in the transaction. */ struct st_trans_write_set { unsigned int m_flags; // reserved unsigned long write_set_size; // Size of the PKE set of the transaction. unsigned long long* write_set; // A pointer to the PKE set. }; typedef struct st_trans_write_set Transaction_write_set; extern struct transaction_write_set_service_st { Transaction_write_set* (*get_transaction_write_set)(unsigned long m_thread_id); } *transaction_write_set_service; #ifdef MYSQL_DYNAMIC_PLUGIN #define get_transaction_write_set(m_thread_id) \ (transaction_write_set_service->get_transaction_write_set((m_thread_id))) #else Transaction_write_set* get_transaction_write_set(unsigned long m_thread_id); #endif #ifdef __cplusplus } #endif #define MYSQL_SERVICE_TRANSACTION_WRITE_SET_INCLUDED #endif ����������������������������������������mysql/mysql/plugin_keyring.h.pp���������������������������������������������������������������������0000644�����������������00000012160�14763166026�0012706 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "plugin.h" typedef void * MYSQL_PLUGIN; struct st_mysql_xid { long formatID; long gtrid_length; long bqual_length; char data[128]; }; typedef struct st_mysql_xid MYSQL_XID; enum enum_mysql_show_type { SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG, SHOW_LONGLONG, SHOW_SIGNED_INT, SHOW_SIGNED_LONG, SHOW_SIGNED_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE }; enum enum_mysql_show_scope { SHOW_SCOPE_UNDEF, SHOW_SCOPE_GLOBAL }; struct st_mysql_show_var { const char *name; char *value; enum enum_mysql_show_type type; enum enum_mysql_show_scope scope; }; typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, char *); struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(void* thd, struct st_mysql_sys_var *var, void *save, struct st_mysql_value *value); typedef void (*mysql_var_update_func)(void* thd, struct st_mysql_sys_var *var, void *var_ptr, const void *save); struct st_mysql_plugin { int type; void *info; const char *name; const char *author; const char *descr; int license; int (*init)(MYSQL_PLUGIN); int (*deinit)(MYSQL_PLUGIN); unsigned int version; struct st_mysql_show_var *status_vars; struct st_mysql_sys_var **system_vars; void * __reserved1; unsigned long flags; }; struct st_mysql_daemon { int interface_version; }; struct st_mysql_information_schema { int interface_version; }; struct st_mysql_storage_engine { int interface_version; }; struct handlerton; struct Mysql_replication { int interface_version; }; struct st_mysql_value { int (*value_type)(struct st_mysql_value *); const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length); int (*val_real)(struct st_mysql_value *, double *realbuf); int (*val_int)(struct st_mysql_value *, long long *intbuf); int (*is_unsigned)(struct st_mysql_value *); }; int thd_in_lock_tables(const void* thd); int thd_tablespace_op(const void* thd); long long thd_test_options(const void* thd, long long test_options); int thd_sql_command(const void* thd); const char *set_thd_proc_info(void* thd, const char *info, const char *calling_func, const char *calling_file, const unsigned int calling_line); void **thd_ha_data(const void* thd, const struct handlerton *hton); void thd_storage_lock_wait(void* thd, long long value); int thd_tx_isolation(const void* thd); int thd_tx_is_read_only(const void* thd); void* thd_tx_arbitrate(void* requestor, void* holder); int thd_tx_priority(const void* thd); int thd_tx_is_dd_trx(const void* thd); char *thd_security_context(void* thd, char *buffer, size_t length, size_t max_query_len); void thd_inc_row_count(void* thd); int thd_allow_batch(void* thd); void thd_mark_transaction_to_rollback(void* thd, int all); enum mysql_trx_stat_type { MYSQL_TRX_STAT_IO_READ_BYTES, MYSQL_TRX_STAT_IO_READ_WAIT_USECS, MYSQL_TRX_STAT_LOCK_WAIT_USECS, MYSQL_TRX_STAT_INNODB_QUEUE_WAIT_USECS, MYSQL_TRX_STAT_ACCESS_PAGE_ID }; void thd_report_innodb_stat(void* thd, unsigned long long trx_id, enum mysql_trx_stat_type type, unsigned long long value); unsigned long thd_log_slow_verbosity(const void* thd); int thd_opt_slow_log(); int thd_is_background_thread(const void* thd); int mysql_tmpfile(const char *prefix); int thd_killed(const void* thd); void thd_set_kill_status(const void* thd); void thd_binlog_pos(const void* thd, const char **file_var, unsigned long long *pos_var); unsigned long thd_get_thread_id(const void* thd); int64_t thd_get_query_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); void mysql_query_cache_invalidate4(void* thd, const char *key, unsigned int key_length, int using_trx); void *thd_get_ha_data(const void* thd, const struct handlerton *hton); void thd_set_ha_data(void* thd, const struct handlerton *hton, const void *ha_data); int thd_command(const void* thd); long long thd_start_time(const void* thd); void thd_kill(unsigned long id); int thd_get_ft_query_extra_word_chars(void); struct st_mysql_keyring { int interface_version; my_bool (*mysql_key_store)(const char *key_id, const char *key_type, const char* user_id, const void *key, size_t key_len); my_bool (*mysql_key_fetch)(const char *key_id, char **key_type, const char *user_id, void **key, size_t *key_len); my_bool (*mysql_key_remove)(const char *key_id, const char *user_id); my_bool (*mysql_key_generate)(const char *key_id, const char *key_type, const char *user_id, size_t key_len); void (*mysql_key_iterator_init)(void** key_iterator); void (*mysql_key_iterator_deinit)(void* key_iterator); bool (*mysql_key_iterator_get_key)(void* key_iterator, char *key_id, char *user_id); }; ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/service_mysql_password_policy.h���������������������������������������������������������0000644�����������������00000004604�14763166026�0015434 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2014, 2015 Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_SERVICE_MYSQL_PLUGIN_AUTH_INCLUDED #define MYSQL_SERVICE_MYSQL_PLUGIN_AUTH_INCLUDED /** @file include/mysql/service_mysql_plugin_auth.h This service provides functions to validatete password, check for strength of password based on common policy. SYNOPSIS my_validate_password_policy() - function to validate password based on defined policy const char* buffer holding the password value unsigned int buffer length my_calculate_password_strength() - function to calculate strength of the password based on the policies defined. const char* buffer holding the password value unsigned int buffer length Both the service function returns 0 on SUCCESS and 1 incase input password does not match against the policy rules defined. */ #ifdef __cplusplus extern "C" { #endif extern struct mysql_password_policy_service_st { int (*my_validate_password_policy_func)(const char *, unsigned int); int (*my_calculate_password_strength_func)(const char *, unsigned int); } *mysql_password_policy_service; #ifdef MYSQL_DYNAMIC_PLUGIN #define my_validate_password_policy(buffer, length) \ mysql_password_policy_service->my_validate_password_policy_func(buffer, length) #define my_calculate_password_strength(buffer, length) \ mysql_password_policy_service->my_calculate_password_strength_func(buffer, length) #else int my_validate_password_policy(const char *, unsigned int); int my_calculate_password_strength(const char *, unsigned int); #endif #ifdef __cplusplus } #endif #endif ����������������������������������������������������������������������������������������������������������������������������mysql/mysql/plugin_trace.h��������������������������������������������������������������������������0000644�����������������00000027566�14763166026�0011736 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2012, 2013, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef PLUGIN_TRACE_INCLUDED #define PLUGIN_TRACE_INCLUDED /** @file ======================================================================== Declarations for client-side plugins of type MYSQL_CLIENT_TRACE_PLUGIN ======================================================================== See libmysql/mysql_trace.c for a brief description of the client-side protocol tracing infrastructure. */ #include <mysql/client_plugin.h> #ifdef __cplusplus extern "C" { #endif /* Lists of protocol stages and trace events ========================================= These lists are defined with PROTOCOL_STAGE_LIST() and TRACE_EVENT_LIST(), respectively. Macros accept a disposition name as an argument. For example, to process list of protocol stages using disposition "foo", define protocol_stage_foo(Stage) macro and then put PROTOCOL_STAGE_LIST(foo) in your code. This will expand to sequence of protocol_stage_foo(X) macros where X ranges over the list of protocol stages, and these macros should generate the actual code. See below how this technique is used to generate protocol_stage and trace_events enums. */ /** Protocol stages --------------- A client following the MySQL protocol goes through several stages of it. Each stage determines what packets can be expected from the server or can be send by the client. Upon receiving each trace event, trace plugin will be notified of the current protocol stage so that it can correctly interpret the event. These are the possible protocol stages and the transitions between them. .. digraph:: protocol_stages CONNECTING -> WAIT_FOR_INIT_PACKET; CONNECTING -> DISCONNECTED [ label = "failed connection" ]; WAIT_FOR_INIT_PACKET -> AUTHENTICATE; WAIT_FOR_INIT_PACKET -> SSL_NEGOTIATION -> AUTHENTICATE; AUTHENTICATE -> READY_FOR_COMMAND [ label = "accepted" ]; AUTHENTICATE -> DISCONNECTED [ label = "rejected" ]; READY_FOR_COMMAND -> DISCONNECTED [ label = "COM_QUIT" ]; READY_FOR_COMMAND -> AUTHENTICATE [ label="after change user" ]; READY_FOR_COMMAND -> WAIT_FOR_PACKET [ label="wait for a single packet after, e.g., COM_STATISTICS" ]; READY_FOR_COMMAND -> WAIT_FOR_RESULT; READY_FOR_COMMAND -> WAIT_FOR_PS_DESCRIPTION [ label="after prepare command" ]; WAIT_FOR_PACKET -> READY_FOR_COMAND; WAIT_FOR_RESULT -> READY_FOR_COMMAND [ label="simple reply" ]; WAIT_FOR_RESULT -> WAIT_FOR_FIELD_DEF; WAIT_FOR_RESULT -> FILE_REQUEST; WAIT_FOR_FIELD_DEF -> WAIT_FOR_ROW [ label="in a resultset" ]; WAIT_FOR_FIELD_DEF -> READY_FOR_COMMAND [ label="after describe table or prepare command" ]; WAIT_FOR_ROW -> READY_FOR_COMMAND; WAIT_FOR_ROW -> WAIT_FOR_RESULT [ label="multi-resultset" ]; WAIT_FOR_PS_DESCRIPTION -> WAIT_FOR_PARAM_DEF; WAIT_FOR_PS_DESCRIPTION -> READY_FOR_COMMAND [ label="no params and result" ]; WAIT_FOR_PS_DESCRIPTION -> WAIT_FOR_FIELD_DEF [ label="no params" ]; WAIT_FOR_PARAM_DEF -> WAIT_FOR_FIELD_DEF; WAIT_FOR_PARAM_DEF -> READY_FOR_COMMAND [ label="no result" ]; FILE_REQUEST -> WAIT_FOR_RESULT [label="when whole file sent"]; */ #define PROTOCOL_STAGE_LIST(X) \ protocol_stage_ ## X(CONNECTING) \ protocol_stage_ ## X(WAIT_FOR_INIT_PACKET) \ protocol_stage_ ## X(AUTHENTICATE) \ protocol_stage_ ## X(SSL_NEGOTIATION) \ protocol_stage_ ## X(READY_FOR_COMMAND) \ protocol_stage_ ## X(WAIT_FOR_PACKET) \ protocol_stage_ ## X(WAIT_FOR_RESULT) \ protocol_stage_ ## X(WAIT_FOR_FIELD_DEF) \ protocol_stage_ ## X(WAIT_FOR_ROW) \ protocol_stage_ ## X(FILE_REQUEST) \ protocol_stage_ ## X(WAIT_FOR_PS_DESCRIPTION) \ protocol_stage_ ## X(WAIT_FOR_PARAM_DEF) \ protocol_stage_ ## X(DISCONNECTED) /** Trace events ------------ The following events are generated during the various stages of the client-server conversation. ---------------------- ----------------------------------------------------- Connection events ---------------------- ----------------------------------------------------- CONNECTING Client is connecting to the server. CONNECTED Physical connection has been established. DISCONNECTED Connection with server was broken. ---------------------- ----------------------------------------------------- SSL events ---------------------- ----------------------------------------------------- SEND_SSL_REQUEST Client is sending SSL connection request. SSL_CONNECT Client is initiating SSL handshake. SSL_CONNECTED SSL connection has been established. ---------------------- ----------------------------------------------------- Authentication events ---------------------- ----------------------------------------------------- CHALLENGE_RECEIVED Client received authentication challenge. AUTH_PLUGIN Client selects an authentication plugin to be used in the following authentication exchange. SEND_AUTH_RESPONSE Client sends response to the authentication challenge. SEND_AUTH_DATA Client sends extra authentication data packet. AUTHENTICATED Server has accepted connection. ---------------------- ----------------------------------------------------- Command phase events ---------------------- ----------------------------------------------------- SEND_COMMAND Client is sending a command to the server. SEND_FILE Client is sending local file contents to the server. ---------------------- ----------------------------------------------------- General events ---------------------- ----------------------------------------------------- READ_PACKET Client starts waiting for a packet from server. PACKET_RECEIVED A packet from server has been received. PACKET_SENT After successful sending of a packet to the server. ERROR Client detected an error. ---------------------- ----------------------------------------------------- */ #define TRACE_EVENT_LIST(X) \ trace_event_ ## X(ERROR) \ trace_event_ ## X(CONNECTING) \ trace_event_ ## X(CONNECTED) \ trace_event_ ## X(DISCONNECTED) \ trace_event_ ## X(SEND_SSL_REQUEST) \ trace_event_ ## X(SSL_CONNECT) \ trace_event_ ## X(SSL_CONNECTED) \ trace_event_ ## X(INIT_PACKET_RECEIVED) \ trace_event_ ## X(AUTH_PLUGIN) \ trace_event_ ## X(SEND_AUTH_RESPONSE) \ trace_event_ ## X(SEND_AUTH_DATA) \ trace_event_ ## X(AUTHENTICATED) \ trace_event_ ## X(SEND_COMMAND) \ trace_event_ ## X(SEND_FILE) \ trace_event_ ## X(READ_PACKET) \ trace_event_ ## X(PACKET_RECEIVED) \ trace_event_ ## X(PACKET_SENT) /** Some trace events have additional arguments. These are stored in st_trace_event_args structure. Various events store their arguments in the structure as follows. Unused members are set to 0/NULL. AUTH_PLUGIN ------------- ---------------------------------- plugin_name the name of the plugin ------------- ---------------------------------- SEND_COMMAND ------------- ---------------------------------- cmd the command code hdr pointer to command packet header hdr_len length of the header pkt pointer to command arguments pkt_len length of arguments ------------- ---------------------------------- Other SEND_* and *_RECEIVED events ------------- ---------------------------------- pkt the data sent or received pkt_len length of the data ------------- ---------------------------------- PACKET_SENT ------------- ---------------------------------- pkt_len number of bytes sent ------------- ---------------------------------- */ struct st_trace_event_args { const char *plugin_name; int cmd; const unsigned char *hdr; size_t hdr_len; const unsigned char *pkt; size_t pkt_len; }; /* Definitions of protocol_stage and trace_event enums. */ #define protocol_stage_enum(X) PROTOCOL_STAGE_ ## X, enum protocol_stage { PROTOCOL_STAGE_LIST(enum) PROTOCOL_STAGE_LAST }; #define trace_event_enum(X) TRACE_EVENT_ ## X, enum trace_event { TRACE_EVENT_LIST(enum) TRACE_EVENT_LAST }; /* Trace plugin methods ==================== */ struct st_mysql_client_plugin_TRACE; struct st_mysql; /** Trace plugin tracing_start() method. Called when tracing with this plugin starts on a connection. A trace plugin might want to maintain per-connection information. It can return a pointer to memory area holding such information. It will be stored in a connection handle and passed to other plugin methods. @param self pointer to the plugin instance @param connection_handle @param stage protocol stage in which tracing has started - currently it is always CONNECTING stage. @return A pointer to plugin-specific, per-connection data if any. */ typedef void* (tracing_start_callback)(struct st_mysql_client_plugin_TRACE *self, struct st_mysql *connection_handle, enum protocol_stage stage); /** Trace plugin tracing_stop() method. Called when tracing of the connection has ended. If a plugin allocated any per-connection resources, it should de-allocate them here. @param self pointer to the plugin instance @param connection_handle @param plugin_data pointer to plugin's per-connection data. */ typedef void (tracing_stop_callback)(struct st_mysql_client_plugin_TRACE *self, struct st_mysql *connection_handle, void *plugin_data); /** Trace plugin trace_event() method. Called when a trace event occurs. Plugin can decide to stop tracing this connection by returning non-zero value. @param self pointer to the plugin instance @param plugin_data pointer to plugin's per-connection data @param connection_handle @param stage current protocol stage @param event the trace event @param args trace event arguments @return Non-zero if tracing of the connection should end here. */ typedef int (trace_event_handler)(struct st_mysql_client_plugin_TRACE *self, void *plugin_data, struct st_mysql *connection_handle, enum protocol_stage stage, enum trace_event event, struct st_trace_event_args args); struct st_mysql_client_plugin_TRACE { MYSQL_CLIENT_PLUGIN_HEADER tracing_start_callback *tracing_start; tracing_stop_callback *tracing_stop; trace_event_handler *trace_event; }; /** The global trace_plugin pointer. If it is not NULL, it points at a loaded trace plugin which should be used to trace all connections made to the server. */ extern struct st_mysql_client_plugin_TRACE *trace_plugin; #ifndef DBUG_OFF /* Functions for getting names of trace events and protocol stages for debugging purposes. */ const char* protocol_stage_name(enum protocol_stage stage); const char* trace_event_name(enum trace_event ev); #endif #ifdef __cplusplus } #endif #endif ������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/service_parser.h������������������������������������������������������������������������0000644�����������������00000022272�14763166026�0012263 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef MYSQL_SERVICE_PARSER_INCLUDED #define MYSQL_SERVICE_PARSER_INCLUDED /* Copyright (c) 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "my_md5_size.h" #include <mysql/mysql_lex_string.h> #ifndef MYSQL_ABI_CHECK #include <stdlib.h> #endif #ifdef __cplusplus class THD; class Item; #define MYSQL_THD THD* typedef Item* MYSQL_ITEM; #else #define MYSQL_THD void* typedef void* MYSQL_ITEM; #endif /* __cplusplus */ #ifdef __cplusplus extern "C" { #endif /** @file service_parser Plugin service that provides access to the parser and some operations on the parse tree. */ #define PARSER_SERVICE_DIGEST_LENGTH MD5_HASH_SIZE #define STATEMENT_TYPE_SELECT 1 #define STATEMENT_TYPE_OTHER 2 typedef int (*parse_node_visit_function)(MYSQL_ITEM item, unsigned char* arg); typedef int (*sql_condition_handler_function)(int sql_errno, const char* sqlstate, const char* msg, void *state); struct st_my_thread_handle; extern struct mysql_parser_service_st { MYSQL_THD (*mysql_current_session)(); MYSQL_THD (*mysql_open_session)(); void (*mysql_start_thread)(MYSQL_THD thd, void *(*callback_fun)(void*), void *arg, struct st_my_thread_handle *thread_handle); void (*mysql_join_thread)(struct st_my_thread_handle *thread_handle); void (*mysql_set_current_database)(MYSQL_THD thd, const MYSQL_LEX_STRING db); /** Parses the query. @param thd The session in which to parse. @param query The query to parse. @param is_prepared If non-zero, the query will be parsed as a prepared statement and won't throw errors when the query string contains '?'. @param handle_condition Callback function that is called if a condition is raised during the preparation, parsing or cleanup after parsing. If this argument is non-NULL, the diagnostics area will be cleared before this function returns. @param condition_handler_state Will be passed to handle_condition when called. Otherwise ignored. @retval 0 Success. @retval 1 Parse error. */ int (*mysql_parse)(MYSQL_THD thd, const MYSQL_LEX_STRING query, unsigned char is_prepared, sql_condition_handler_function handle_condition, void *condition_handler_state); int (*mysql_get_statement_type)(MYSQL_THD thd); /** Returns the digest of the last parsed statement in the session. @param thd The session in which the statement was parsed. @param digest[out] An area of at least size PARSER_SERVICE_DIGEST_LENGTH, where the digest is written. @retval 0 Success. @retval 1 Parse error. */ int (*mysql_get_statement_digest)(MYSQL_THD thd, unsigned char *digest); /** Returns the number of parameters ('?') in the parsed query. This works only if the last query was parsed as a prepared statement. @param thd The session in which the query was parsed. @return The number of parameter markers. */ int (*mysql_get_number_params)(MYSQL_THD thd); /** Stores in 'positions' the positions in the last parsed query of each parameter marker('?'). Positions must be an already allocated array of at least mysql_parser_service_st::mysql_get_number_params() size. This works only if the last query was parsed as a prepared statement. @param thd The session in which the query was parsed. @param positions An already allocated array of at least mysql_parser_service_st::mysql_get_number_params() size. @return The number of parameter markers and hence number of written positions. */ int (*mysql_extract_prepared_params)(MYSQL_THD thd, int *positions); /** Walks the tree depth first and applies a user defined function on each literal. @param thd The session in which the query was parsed. @param processor Will be called for each literal in the parse tree. @param arg Will be passed as argument to each call to 'processor'. */ int (*mysql_visit_tree)(MYSQL_THD thd, parse_node_visit_function processor, unsigned char* arg); /** Renders the MYSQL_ITEM as a string and returns a reference in the form of a MYSQL_LEX_STRING. The string buffer is allocated by the server and must be freed by mysql_free_string(). @param item The literal to print. @return The result of printing the literal. @see mysql_parser_service_st::mysql_free_string(). */ MYSQL_LEX_STRING (*mysql_item_string)(MYSQL_ITEM item); /** Frees a string buffer allocated by the server. @param The string whose buffer will be freed. */ void (*mysql_free_string)(MYSQL_LEX_STRING string); /** Returns the current query string. This string is managed by the server and should @b not be freed by a plugin. @param thd The session in which the query was submitted. @return The query string. */ MYSQL_LEX_STRING (*mysql_get_query)(MYSQL_THD thd); /** Returns the current query in normalized form. This string is managed by the server and should @b not be freed by a plugin. @param thd The session in which the query was submitted. @return The query string normalized. */ MYSQL_LEX_STRING (*mysql_get_normalized_query)(MYSQL_THD thd); } *mysql_parser_service; #ifdef MYSQL_DYNAMIC_PLUGIN #define mysql_parser_current_session() \ mysql_parser_service->mysql_current_session() #define mysql_parser_open_session() \ mysql_parser_service->mysql_open_session() #define mysql_parser_start_thread(thd, func, arg, thread_handle) \ mysql_parser_service->mysql_start_thread(thd, func, arg, thread_handle) #define mysql_parser_join_thread(thread_handle) \ mysql_parser_service->mysql_join_thread(thread_handle) #define mysql_parser_set_current_database(thd, db) \ mysql_parser_service->mysql_set_current_database(thd, db) #define mysql_parser_parse(thd, query, is_prepared, \ condition_handler, condition_handler_state) \ mysql_parser_service->mysql_parse(thd, query, is_prepared, \ condition_handler, \ condition_handler_state) #define mysql_parser_get_statement_type(thd) \ mysql_parser_service->mysql_get_statement_type(thd) #define mysql_parser_get_statement_digest(thd, digest) \ mysql_parser_service->mysql_get_statement_digest(thd, digest) #define mysql_parser_get_number_params(thd) \ mysql_parser_service->mysql_get_number_params(thd) #define mysql_parser_extract_prepared_params(thd, positions) \ mysql_parser_service->mysql_extract_prepared_params(thd, positions) #define mysql_parser_visit_tree(thd, processor, arg) \ mysql_parser_service->mysql_visit_tree(thd, processor, arg) #define mysql_parser_item_string(item) \ mysql_parser_service->mysql_item_string(item) #define mysql_parser_free_string(string) \ mysql_parser_service->mysql_free_string(string) #define mysql_parser_get_query(thd) \ mysql_parser_service->mysql_get_query(thd) #define mysql_parser_get_normalized_query(thd) \ mysql_parser_service->mysql_get_normalized_query(thd) #else typedef void *(*callback_function)(void*); MYSQL_THD mysql_parser_current_session(); MYSQL_THD mysql_parser_open_session(); void mysql_parser_start_thread(MYSQL_THD thd, callback_function fun, void *arg, struct st_my_thread_handle *thread_handle); void mysql_parser_join_thread(struct st_my_thread_handle *thread_handle); void mysql_parser_set_current_database(MYSQL_THD thd, const MYSQL_LEX_STRING db); int mysql_parser_parse(MYSQL_THD thd, const MYSQL_LEX_STRING query, unsigned char is_prepared, sql_condition_handler_function handle_condition, void *condition_handler_state); int mysql_parser_get_statement_type(MYSQL_THD thd); int mysql_parser_get_statement_digest(MYSQL_THD thd, unsigned char *digest); int mysql_parser_get_number_params(MYSQL_THD thd); int mysql_parser_extract_prepared_params(MYSQL_THD thd, int *positions); int mysql_parser_visit_tree(MYSQL_THD thd, parse_node_visit_function processor, unsigned char* arg); MYSQL_LEX_STRING mysql_parser_item_string(MYSQL_ITEM item); void mysql_parser_free_string(MYSQL_LEX_STRING string); MYSQL_LEX_STRING mysql_parser_get_query(MYSQL_THD thd); MYSQL_LEX_STRING mysql_parser_get_normalized_query(MYSQL_THD thd); #endif /* MYSQL_DYNAMIC_PLUGIN */ #ifdef __cplusplus } #endif #endif /* MYSQL_SERVICE_PARSER_INCLUDED */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/client_authentication.h�����������������������������������������������������������������0000644�����������������00000002347�14763166026�0013625 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2012, 2018, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CLIENT_AUTHENTICATION_H #define CLIENT_AUTHENTICATION_H #include <my_global.h> #include "mysql.h" #include "mysql/client_plugin.h" C_MODE_START int sha256_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql); int sha256_password_init(char *, size_t, int, va_list); int sha256_password_deinit(void); int caching_sha2_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql); int caching_sha2_password_init(char *, size_t, int, va_list); int caching_sha2_password_deinit(void); C_MODE_END #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/client_plugin.h.pp����������������������������������������������������������������������0000644�����������������00000003704�14763166026�0012520 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������struct st_mysql_client_plugin { int type; unsigned int interface_version; const char *name; const char *author; const char *desc; unsigned int version[3]; const char *license; void *mysql_api; int (*init)(char *, size_t, int, va_list); int (*deinit)(void); int (*options)(const char *option, const void *); }; struct st_mysql; #include "plugin_auth_common.h" typedef struct st_plugin_vio_info { enum { MYSQL_VIO_INVALID, MYSQL_VIO_TCP, MYSQL_VIO_SOCKET, MYSQL_VIO_PIPE, MYSQL_VIO_MEMORY } protocol; int socket; } MYSQL_PLUGIN_VIO_INFO; typedef struct st_plugin_vio { int (*read_packet)(struct st_plugin_vio *vio, unsigned char **buf); int (*write_packet)(struct st_plugin_vio *vio, const unsigned char *packet, int packet_len); void (*info)(struct st_plugin_vio *vio, struct st_plugin_vio_info *info); } MYSQL_PLUGIN_VIO; struct st_mysql_client_plugin_AUTHENTICATION { int type; unsigned int interface_version; const char *name; const char *author; const char *desc; unsigned int version[3]; const char *license; void *mysql_api; int (*init)(char *, size_t, int, va_list); int (*deinit)(void); int (*options)(const char *option, const void *); int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct st_mysql *mysql); }; struct st_mysql_client_plugin * mysql_load_plugin(struct st_mysql *mysql, const char *name, int type, int argc, ...); struct st_mysql_client_plugin * mysql_load_plugin_v(struct st_mysql *mysql, const char *name, int type, int argc, va_list args); struct st_mysql_client_plugin * mysql_client_find_plugin(struct st_mysql *mysql, const char *name, int type); struct st_mysql_client_plugin * mysql_client_register_plugin(struct st_mysql *mysql, struct st_mysql_client_plugin *plugin); int mysql_plugin_options(struct st_mysql_client_plugin *plugin, const char *option, const void *value); ������������������������������������������������������������mysql/mysql/service_my_plugin_log.h�����������������������������������������������������������������0000644�����������������00000003216�14763166026�0013630 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2011, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** @file This service provides functions to report error conditions and log to mysql error log. */ #ifndef MYSQL_SERVICE_MY_PLUGIN_LOG_INCLUDED #define MYSQL_SERVICE_MY_PLUGIN_LOG_INCLUDED #ifndef MYSQL_ABI_CHECK #include <stdarg.h> #endif /* keep in sync with the loglevel enum in my_sys.h */ enum plugin_log_level { MY_ERROR_LEVEL, MY_WARNING_LEVEL, MY_INFORMATION_LEVEL }; #ifdef __cplusplus extern "C" { #endif extern struct my_plugin_log_service { /** write a message to the log */ int (*my_plugin_log_message)(MYSQL_PLUGIN *, enum plugin_log_level, const char *, ...); } *my_plugin_log_service; #ifdef MYSQL_DYNAMIC_PLUGIN #define my_plugin_log_message my_plugin_log_service->my_plugin_log_message #else int my_plugin_log_message(MYSQL_PLUGIN *plugin, enum plugin_log_level level, const char *format, ...); #endif #ifdef __cplusplus } #endif #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/service_command.h�����������������������������������������������������������������������0000644�����������������00000032236�14763166026�0012406 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef MYSQL_SERVICE_COMMAND_INCLUDED #define MYSQL_SERVICE_COMMAND_INCLUDED /* Copyright (c) 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** @file Header file for the Command service. This service is to provide means of executing different commands, like COM_QUERY, COM_STMT_PREPARE, in the server. */ #include "mysql/service_srv_session.h" #include "mysql/com_data.h" #ifdef __cplusplus extern "C" { #endif #include "mysql_time.h" #include "decimal.h" #ifndef MYSQL_ABI_CHECK #include "m_ctype.h" #include <stdint.h> /* uint32_t */ #endif /* POD structure for the field metadata from the server */ struct st_send_field { const char *db_name; const char *table_name; const char *org_table_name; const char *col_name; const char *org_col_name; unsigned long length; unsigned int charsetnr; unsigned int flags; unsigned int decimals; enum_field_types type; }; struct st_command_service_cbs { /* For a statement that returns a result, the flow of called callbacks will be: start_result_metadata() field_metadata() .... end_result_metadata() (in the classic protocol this generates an EOF packet) start_row() get_xxx() ... end_row() start_row() get_xxx() ... end_row() handle_ok() (with data for an EOF packet) For a statement that does NOT return a result, but only status, like INSERT, UPDATE, DELETE, REPLACE, TRUNCATE, CREATE, DROP, ALTER, etc. only handle_ok() will be invoked, in case of success. All statements that result in an error will invoke handle_error(). For statements that return a result set, handle_error() might be invoked even after metadata was sent. This will indicate an error during the execution of the statement. */ /*** Getting metadata ***/ /** Indicates beginning of metadata for the result set @param ctx Plugin's context @param num_cols Number of fields being sent @param flags Flags to alter the metadata sending @param resultcs Charset of the result set @note resultcs is the charset in which the data should be encoded before sent to the client. This is the value of the session variable character_set_results. The implementor most probably will need to save this value in the context and use it as "to" charset in get_string(). In case of CS_BINARY_REPRESENTATION, get_string() receives as a parameter the charset of the string, as it is stored on disk. In case of CS_TEXT_REPRESENTATION, the string value might be already a stringified value or non-string data, which is in character_set_results. @returns 1 an error occured, server will abort the command 0 ok */ int (*start_result_metadata)(void *ctx, uint num_cols, uint flags, const CHARSET_INFO *resultcs); /** Field metadata is provided via this callback @param ctx Plugin's context @param field Field's metadata (see field.h) @param charset Field's charset @returns 1 an error occured, server will abort the command 0 ok */ int (*field_metadata)(void *ctx, struct st_send_field *field, const CHARSET_INFO *charset); /** Indicates end of metadata for the result set @param ctx Plugin's context @param server_status Status of server (see mysql_com.h, SERVER_STATUS_*) @param warn_count Number of warnings generated during execution to the moment when the metadata is sent. @returns 1 an error occured, server will abort the command 0 ok */ int (*end_result_metadata)(void *ctx, uint server_status, uint warn_count); /** Indicates the beginning of a new row in the result set/metadata @param ctx Plugin's context @returns 1 an error occured, server will abort the command 0 ok */ int (*start_row)(void *ctx); /** Indicates the end of the current row in the result set/metadata @param ctx Plugin's context @returns 1 an error occured, server will abort the command 0 ok */ int (*end_row)(void *ctx); /** An error occured during execution @details This callback indicates that an error occured during command execution and the partial row should be dropped. Server will raise error and return. @param ctx Plugin's context @returns true an error occured, server will abort the command false ok */ void (*abort_row)(void *ctx); /** Return client's capabilities (see mysql_com.h, CLIENT_*) @param ctx Plugin's context @return Bitmap of client's capabilities */ ulong (*get_client_capabilities)(void *ctx); /****** Getting data ******/ /** Receive NULL value from server @param ctx Plugin's context @returns 1 an error occured, server will abort the command 0 ok */ int (*get_null)(void * ctx); /** Receive TINY/SHORT/LONG value from server @param ctx Plugin's context @param value Value received @note In order to know which type exactly was received, the plugin must track the metadata that was sent just prior to the result set. @returns 1 an error occured, server will abort the command 0 ok */ int (*get_integer)(void * ctx, longlong value); /** Get LONGLONG value from server @param ctx Plugin's context @param value Value received @param is_unsigned TRUE <=> value is unsigned @returns 1 an error occured, server will abort the command 0 ok */ int (*get_longlong)(void * ctx, longlong value, uint is_unsigned); /** Receive DECIMAL value from server @param ctx Plugin's context @param value Value received @returns 1 an error occured, server will abort the command 0 ok */ int (*get_decimal)(void * ctx, const decimal_t * value); /** Receive FLOAT/DOUBLE from server @param ctx Plugin's context @param value Value received @param decimals Number of decimals @note In order to know which type exactly was received, the plugin must track the metadata that was sent just prior to the result set. @returns 1 an error occured, server will abort the command 0 ok */ int (*get_double)(void * ctx, double value, uint32_t decimals); /** Get DATE value from server @param ctx Plugin's context @param value Value received @returns 1 an error occured during storing, server will abort the command 0 ok */ int (*get_date)(void * ctx, const MYSQL_TIME * value); /** Receive TIME value from server @param ctx Plugin's context @param value Value received @param decimals Number of decimals @returns 1 an error occured during storing, server will abort the command 0 ok */ int (*get_time)(void * ctx, const MYSQL_TIME * value, uint decimals); /** Receive DATETIME value from server @param ctx Plugin's context @param value Value received @param decimals Number of decimals @returns 1 an error occured during storing, server will abort the command 0 ok */ int (*get_datetime)(void * ctx, const MYSQL_TIME * value, uint decimals); /** Get STRING value from server @param ctx Plugin's context @param value Data @param length Data length @param valuecs Data charset @note In case of CS_BINARY_REPRESENTATION, get_string() receives as a parameter the charset of the string, as it is stored on disk. In case of CS_TEXT_REPRESENTATION, the string value might be already a stringified value or non-string data, which is in character_set_results. @see start_result_metadata() @returns 1 an error occured, server will abort the command 0 ok */ int (*get_string)(void * ctx, const char * value, size_t length, const CHARSET_INFO * valuecs); /****** Getting execution status ******/ /** Command ended with success @param ctx Plugin's context @param server_status Status of server (see mysql_com.h, SERVER_STATUS_*) @param statement_warn_count Number of warnings thrown during execution @param affected_rows Number of rows affected by the command @param last_insert_id Last insert id being assigned during execution @param message A message from server */ void (*handle_ok)(void * ctx, uint server_status, uint statement_warn_count, ulonglong affected_rows, ulonglong last_insert_id, const char * message); /** Command ended with ERROR @param ctx Plugin's context @param sql_errno Error code @param err_msg Error message @param sqlstate SQL state correspongin to the error code */ void (*handle_error)(void * ctx, uint sql_errno, const char * err_msg, const char * sqlstate); /** Callback for shutdown notification from the server. @param ctx Plugin's context @param server_shutdown Whether this is a normal connection shutdown (0) or server shutdown (1). */ void (*shutdown)(void *ctx, int server_shutdown); }; enum cs_text_or_binary { CS_TEXT_REPRESENTATION= 1, /* Let the server convert everything to string */ CS_BINARY_REPRESENTATION= 2, /* Let the server use native types */ }; extern struct command_service_st { int (*run_command)(MYSQL_SESSION session, enum enum_server_command command, const union COM_DATA * data, const CHARSET_INFO * client_cs, const struct st_command_service_cbs * callbacks, enum cs_text_or_binary text_or_binary, void * service_callbacks_ctx); } *command_service; #ifdef MYSQL_DYNAMIC_PLUGIN #define command_service_run_command(t, command, data, cset, cbs, t_or_b, ctx) \ command_service->run_command((t), (command), (data), (cset), \ (cbs), (t_or_b), (ctx)) #else /** Executes a server command in a session. There are two cases. Execution in a physical thread : 1. initialized by the srv_session service 2. NOT initialized by the srv_session service In case of 1, if there is currently attached session, and it is different from the passed one, the former will be automatically detached. The session to be used for the execution will then be attached. After the command is executed, the attached session will not be detached. It will be detached by a next call to run_command() with another session as parameter. In other words, for all sessions used in a physical thread, there will be at most one in attached state. In case of 2, the current state (current_thd) will be preserved. Then the given session will move to attached state and the command will be executed. After the execution the state of the session will be changed to detached and the preserved state (current_thd) will be restored. The client charset is used for commands like COM_QUERY and COM_STMT_PREPARE to know how to threat the char* fields. This charset will be used until the next call of run_command when it may be changed again. @param session The session @param command The command to be executed. @param data The data needed for the command to be executed @param client_cs The charset for the string data input(COM_QUERY for example) @param callbacks Callbacks to be used by the server to encode data and to communicate with the client (plugin) side. @param text_or_binary Select which representation the server will use for the data passed to the callbacks. For more information @see cs_text_or_binary enum @param service_callbacks_ctx Context passed to the command service callbacks @return 0 success 1 failure */ int command_service_run_command(MYSQL_SESSION session, enum enum_server_command command, const union COM_DATA * data, const CHARSET_INFO * client_cs, const struct st_command_service_cbs * callbacks, enum cs_text_or_binary text_or_binary, void * service_callbacks_ctx); #endif /* MYSQL_DYNAMIC_PLUGIN */ #ifdef __cplusplus } #endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/thread_pool_priv.h����������������������������������������������������������������������0000644�����������������00000014020�14763166026�0012577 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2010, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef THREAD_POOL_PRIV_INCLUDED #define THREAD_POOL_PRIV_INCLUDED /* The thread pool requires access to some MySQL server error codes, this is accessed from mysqld_error.h. We need access to the struct that defines the thread pool plugin interface which is accessed through scheduler.h. All accesses to THD variables and functions are defined in this header file. A thread pool can also use DEBUG_SYNC and must thus include debug_sync.h To handle definitions of Information Schema plugins it is also required to include sql_profile.h and table.h. */ #include <mysqld_error.h> /* To get ER_ERROR_ON_READ */ #define MYSQL_SERVER 1 #include <conn_handler/channel_info.h> #include <conn_handler/connection_handler_manager.h> #include <debug_sync.h> #include <sql_profile.h> #include <table.h> #include "field.h" #include "sql_thd_internal_api.h" #include <set> #ifdef __cplusplus extern "C" { #endif /** This structure must be populated by plugins which implement connection handlers and passed as an argument to my_connection_handler_set() in order to activate the connection handler. The structure contains pointers to plugin functions which the server will call when a new client connects or when the connection handler is unloaded. It also containts the maximum number of threads the connection handler will create. */ struct Connection_handler_functions { /** The maximum number of threads this connection handler will create. */ uint max_threads; /** Called by the server when a new client connects. @param channel_info Pointer to object containing information about the new connection. @retval true failure @retval false success */ bool (*add_connection)(Channel_info *channel_info); /** Called by the server when the connection handler is destroyed. */ void (*end)(void); }; /* create thd from channel_info object */ THD* create_thd(Channel_info* channel_info); /* destroy channel_info object */ void destroy_channel_info(Channel_info* channel_info); /* Decrement connection counter */ void dec_connection_count(); /* thread_created is maintained by thread pool when activated since user threads are created by the thread pool (and also special threads to maintain the thread pool). This is done through inc_thread_created. */ void inc_thread_created(); void thd_lock_thread_count(THD *thd); void thd_unlock_thread_count(THD *thd); #ifdef __cplusplus } #endif /* Interface to global thread list iterator functions. Executes a function with signature 'void f(THD*, uint64)' for all THDs. */ typedef void (do_thd_impl_uint64)(THD*, uint64); void do_for_all_thd(do_thd_impl_uint64, uint64); /* Needed to get access to scheduler variables */ void* thd_get_scheduler_data(THD *thd); void thd_set_scheduler_data(THD *thd, void *data); PSI_thread* thd_get_psi(THD *thd); void thd_set_psi(THD *thd, PSI_thread *psi); /* Interface to THD variables and functions */ void thd_set_killed(THD *thd); void thd_clear_errors(THD *thd); void thd_close_connection(THD *thd); THD *thd_get_current_thd(); void thd_lock_data(THD *thd); void thd_unlock_data(THD *thd); bool thd_is_transaction_active(THD *thd); int thd_connection_has_data(THD *thd); void thd_set_net_read_write(THD *thd, uint val); uint thd_get_net_read_write(THD *thd); void thd_set_not_killable(THD *thd); ulong thd_get_net_wait_timeout(THD *thd); my_socket thd_get_fd(THD *thd); int thd_store_globals(THD* thd); /* Print to the MySQL error log */ void sql_print_error(const char *format, ...); void sql_print_warning(const char *format, ...); void sql_print_information(const char *format, ...); /* Store a table record */ bool schema_table_store_record(THD *thd, TABLE *table); /* The thread pool must be able to execute statements using the connection state in THD object. This is the main objective of the thread pool to schedule the start of these commands. */ bool do_command(THD *thd); /* The thread pool requires an interface to the connection logic in the MySQL Server since the thread pool will maintain the event logic on the TCP connection of the MySQL Server. Thus new connections, dropped connections will be discovered by the thread pool and it needs to ensure that the proper MySQL Server logic attached to these events is executed. */ /* Prepare connection as part of connection set-up */ bool thd_prepare_connection(THD *thd, bool extra_port_connection); /* Release auditing before executing statement */ void mysql_audit_release(THD *thd); /* Check if connection is still alive */ bool thd_connection_alive(THD *thd); /* Close connection with possible error code */ void close_connection(THD *thd, uint sql_errno, bool server_shutdown, bool generate_event); /* End the connection before closing it */ void end_connection(THD *thd); /* Reset thread globals */ void reset_thread_globals(THD *thd); /* max_connections is needed to calculate the maximum number of threads that is allowed to be started by the thread pool. The method get_max_connections() gets reference to this variable. */ ulong get_max_connections(void); /* connection_attrib is the thread attributes for connection threads, the method get_connection_attrib provides a reference to these attributes. */ my_thread_attr_t *get_connection_attrib(void); #endif // THREAD_POOL_PRIV_INCLUDED ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/service_thread_scheduler.h��������������������������������������������������������������0000644�����������������00000005172�14763166026�0014274 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef SERVICE_THREAD_SCHEDULER_INCLUDED #define SERVICE_THREAD_SCHEDULER_INCLUDED #ifdef __cplusplus extern "C" { #endif struct Connection_handler_functions; struct THD_event_functions; extern struct my_thread_scheduler_service { int (*connection_handler_set)(struct Connection_handler_functions *, struct THD_event_functions *); int (*connection_handler_reset)(); } *my_thread_scheduler_service; #ifdef MYSQL_DYNAMIC_PLUGIN #define my_connection_handler_set(F, M) \ my_thread_scheduler_service->connection_handler_set((F), (M)) #define my_connection_handler_reset() \ my_thread_scheduler_service->connection_handler_reset() #else /** Instantiates Plugin_connection_handler based on the supplied Conection_handler_functions and sets it as the current connection handler. Also sets the THD_event_functions functions which will be called by the server when e.g. begining a wait. Remembers the existing connection handler so that it can be restored later. @param chf struct with functions to be called when e.g. handling new clients. @param tef struct with functions to be called when events (e.g. lock wait) happens. @note Both pointers (i.e. not the structs themselves) will be copied, so the structs must not disappear. @note We don't support dynamically loading more than one connection handler. @retval 1 failure @retval 0 success */ int my_connection_handler_set(struct Connection_handler_functions *chf, struct THD_event_functions *tef); /** Destroys the current connection handler and restores the previous. Should only be called after calling my_connection_handler_set(). @retval 1 failure @retval 0 success */ int my_connection_handler_reset(); #endif /* MYSQL_DYNAMIC_PLUGIN */ #ifdef __cplusplus } #endif #endif /* SERVICE_THREAD_SCHEDULER_INCLUDED */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/service_srv_session.h�������������������������������������������������������������������0000644�����������������00000011430�14763166026�0013336 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_SRV_SESSION_SERVICE_INCLUDED #define MYSQL_SRV_SESSION_SERVICE_INCLUDED /** @file Header file for the Server session service. This service is to provide of creating sessions with the server. These sessions can be furtherly used together with the Command service to execute commands in the server. */ #ifdef __cplusplus class Srv_session; typedef class Srv_session* MYSQL_SESSION; #else struct Srv_session; typedef struct Srv_session* MYSQL_SESSION; #endif #ifndef MYSQL_ABI_CHECK #include "mysql/plugin.h" /* MYSQL_THD */ #endif #ifdef __cplusplus extern "C" { #endif typedef void (*srv_session_error_cb)(void *ctx, unsigned int sql_errno, const char *err_msg); extern struct srv_session_service_st { int (*init_session_thread)(const void *plugin); void (*deinit_session_thread)(); MYSQL_SESSION (*open_session)(srv_session_error_cb error_cb, void *plugix_ctx); int (*detach_session)(MYSQL_SESSION session); int (*close_session)(MYSQL_SESSION session); int (*server_is_available)(); } *srv_session_service; #ifdef MYSQL_DYNAMIC_PLUGIN #define srv_session_init_thread(plugin) \ srv_session_service->init_session_thread((plugin)) #define srv_session_deinit_thread() \ srv_session_service->deinit_session_thread() #define srv_session_open(cb, ctx) \ srv_session_service->open_session((cb), (ctx)) #define srv_session_detach(session) \ srv_session_service->detach_session((session)) #define srv_session_close(session) \ srv_session_service->close_session((session)) #define srv_session_server_is_available() \ srv_session_service->server_is_available() #else /** Initializes the current physical thread to use with session service. Call this function ONLY in physical threads which are not initialized in any way by the server. @param plugin Pointer to the plugin structure, passed to the plugin over the plugin init function. @return 0 success 1 failure */ int srv_session_init_thread(const void *plugin); /** Deinitializes the current physical thread to use with session service. Call this function ONLY in physical threads which were initialized using srv_session_init_thread(). */ void srv_session_deinit_thread(); /** Opens a server session. In a thread not initialized by the server itself, this function should be called only after srv_session_init_thread() has already been called. @param error_cb Default completion callback @param plugin_ctx Plugin's context, opaque pointer that would be provided to callbacks. Might be NULL. @return session on success NULL on failure */ MYSQL_SESSION srv_session_open(srv_session_error_cb cb, void *plugix_ctx); /** Detaches a session from current physical thread. Detaches a previously attached session. Sessions are automatically attached when they are used with the Command service (command_service_run_command()). If the session is opened in a spawned thread, then it will stay attached after command_service_run_command() until another session is used in the same physical thread. The command services will detach the previously used session and attach the one to be used for execution. This function should be called in case the session has to be used in different physical thread. It will unbound the session from the current physical thread. After that the session can be used in a different thread. @param session Session to detach @returns 0 success 1 failure */ int srv_session_detach(MYSQL_SESSION session); /** Closes a previously opened session. @param session Session to close @return 0 success 1 failure */ int srv_session_close(MYSQL_SESSION session); /** Returns if the server is available (not booting or shutting down) @return 0 not available 1 available */ int srv_session_server_is_available(); #endif #ifdef __cplusplus } #endif #endif /* MYSQL_SRV_SESSION_SERVICE_INCLUDED */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/services.h.pp���������������������������������������������������������������������������0000644�����������������00000052725�14763166026�0011516 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <mysql/service_srv_session.h> struct Srv_session; typedef struct Srv_session* MYSQL_SESSION; typedef void (*srv_session_error_cb)(void *ctx, unsigned int sql_errno, const char *err_msg); extern struct srv_session_service_st { int (*init_session_thread)(const void *plugin); void (*deinit_session_thread)(); MYSQL_SESSION (*open_session)(srv_session_error_cb error_cb, void *plugix_ctx); int (*detach_session)(MYSQL_SESSION session); int (*close_session)(MYSQL_SESSION session); int (*server_is_available)(); } *srv_session_service; int srv_session_init_thread(const void *plugin); void srv_session_deinit_thread(); MYSQL_SESSION srv_session_open(srv_session_error_cb cb, void *plugix_ctx); int srv_session_detach(MYSQL_SESSION session); int srv_session_close(MYSQL_SESSION session); int srv_session_server_is_available(); #include <mysql/service_srv_session_info.h> #include "mysql/service_srv_session.h" extern struct srv_session_info_service_st { MYSQL_THD (*get_thd)(MYSQL_SESSION session); my_thread_id (*get_session_id)(MYSQL_SESSION session); LEX_CSTRING (*get_current_db)(MYSQL_SESSION session); uint16_t (*get_client_port)(MYSQL_SESSION session); int (*set_client_port)(MYSQL_SESSION session, uint16_t port); int (*set_connection_type)(MYSQL_SESSION session, enum enum_vio_type type); int (*killed)(MYSQL_SESSION session); unsigned int (*session_count)(); unsigned int (*thread_count)(const void *plugin); } *srv_session_info_service; MYSQL_THD srv_session_info_get_thd(MYSQL_SESSION session); my_thread_id srv_session_info_get_session_id(MYSQL_SESSION session); LEX_CSTRING srv_session_info_get_current_db(MYSQL_SESSION session); uint16_t srv_session_info_get_client_port(MYSQL_SESSION session); int srv_session_info_set_client_port(MYSQL_SESSION session, uint16_t port); int srv_session_info_set_connection_type(MYSQL_SESSION session, enum enum_vio_type type); int srv_session_info_killed(MYSQL_SESSION session); unsigned int srv_session_info_session_count(); unsigned int srv_session_info_thread_count(const void *plugin); #include <mysql/service_command.h> #include "mysql/service_srv_session.h" #include "mysql/com_data.h" typedef struct st_com_init_db_data { const char *db_name; unsigned long length; } COM_INIT_DB_DATA; typedef struct st_com_refresh_data { unsigned char options; } COM_REFRESH_DATA; typedef struct st_com_shutdown_data { enum mysql_enum_shutdown_level level; } COM_SHUTDOWN_DATA; typedef struct st_com_kill_data { unsigned long id; } COM_KILL_DATA; typedef struct st_com_set_option_data { unsigned int opt_command; } COM_SET_OPTION_DATA; typedef struct st_com_stmt_execute_data { unsigned long stmt_id; unsigned long flags; unsigned char *params; unsigned long params_length; } COM_STMT_EXECUTE_DATA; typedef struct st_com_stmt_fetch_data { unsigned long stmt_id; unsigned long num_rows; } COM_STMT_FETCH_DATA; typedef struct st_com_stmt_send_long_data_data { unsigned long stmt_id; unsigned int param_number; unsigned char *longdata; unsigned long length; } COM_STMT_SEND_LONG_DATA_DATA; typedef struct st_com_stmt_prepare_data { const char *query; unsigned int length; } COM_STMT_PREPARE_DATA; typedef struct st_stmt_close_data { unsigned int stmt_id; } COM_STMT_CLOSE_DATA; typedef struct st_com_stmt_reset_data { unsigned int stmt_id; } COM_STMT_RESET_DATA; typedef struct st_com_query_data { const char *query; unsigned int length; } COM_QUERY_DATA; typedef struct st_com_field_list_data { unsigned char *table_name; unsigned int table_name_length; const unsigned char *query; unsigned int query_length; } COM_FIELD_LIST_DATA; union COM_DATA { COM_INIT_DB_DATA com_init_db; COM_REFRESH_DATA com_refresh; COM_SHUTDOWN_DATA com_shutdown; COM_KILL_DATA com_kill; COM_SET_OPTION_DATA com_set_option; COM_STMT_EXECUTE_DATA com_stmt_execute; COM_STMT_FETCH_DATA com_stmt_fetch; COM_STMT_SEND_LONG_DATA_DATA com_stmt_send_long_data; COM_STMT_PREPARE_DATA com_stmt_prepare; COM_STMT_CLOSE_DATA com_stmt_close; COM_STMT_RESET_DATA com_stmt_reset; COM_QUERY_DATA com_query; COM_FIELD_LIST_DATA com_field_list; }; #include "mysql_time.h" enum enum_mysql_timestamp_type { MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1, MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2 }; typedef struct st_mysql_time { unsigned int year, month, day, hour, minute, second; unsigned long second_part; my_bool neg; enum enum_mysql_timestamp_type time_type; } MYSQL_TIME; #include "decimal.h" typedef enum {TRUNCATE=0, HALF_EVEN, HALF_UP, CEILING, FLOOR} decimal_round_mode; typedef int32 decimal_digit_t; typedef struct st_decimal_t { int intg, frac, len; my_bool sign; decimal_digit_t *buf; } decimal_t; struct st_send_field { const char *db_name; const char *table_name; const char *org_table_name; const char *col_name; const char *org_col_name; unsigned long length; unsigned int charsetnr; unsigned int flags; unsigned int decimals; enum_field_types type; }; struct st_command_service_cbs { int (*start_result_metadata)(void *ctx, uint num_cols, uint flags, const CHARSET_INFO *resultcs); int (*field_metadata)(void *ctx, struct st_send_field *field, const CHARSET_INFO *charset); int (*end_result_metadata)(void *ctx, uint server_status, uint warn_count); int (*start_row)(void *ctx); int (*end_row)(void *ctx); void (*abort_row)(void *ctx); ulong (*get_client_capabilities)(void *ctx); int (*get_null)(void * ctx); int (*get_integer)(void * ctx, longlong value); int (*get_longlong)(void * ctx, longlong value, uint is_unsigned); int (*get_decimal)(void * ctx, const decimal_t * value); int (*get_double)(void * ctx, double value, uint32_t decimals); int (*get_date)(void * ctx, const MYSQL_TIME * value); int (*get_time)(void * ctx, const MYSQL_TIME * value, uint decimals); int (*get_datetime)(void * ctx, const MYSQL_TIME * value, uint decimals); int (*get_string)(void * ctx, const char * value, size_t length, const CHARSET_INFO * valuecs); void (*handle_ok)(void * ctx, uint server_status, uint statement_warn_count, ulonglong affected_rows, ulonglong last_insert_id, const char * message); void (*handle_error)(void * ctx, uint sql_errno, const char * err_msg, const char * sqlstate); void (*shutdown)(void *ctx, int server_shutdown); }; enum cs_text_or_binary { CS_TEXT_REPRESENTATION= 1, CS_BINARY_REPRESENTATION= 2, }; extern struct command_service_st { int (*run_command)(MYSQL_SESSION session, enum enum_server_command command, const union COM_DATA * data, const CHARSET_INFO * client_cs, const struct st_command_service_cbs * callbacks, enum cs_text_or_binary text_or_binary, void * service_callbacks_ctx); } *command_service; int command_service_run_command(MYSQL_SESSION session, enum enum_server_command command, const union COM_DATA * data, const CHARSET_INFO * client_cs, const struct st_command_service_cbs * callbacks, enum cs_text_or_binary text_or_binary, void * service_callbacks_ctx); #include <mysql/service_my_snprintf.h> extern struct my_snprintf_service_st { size_t (*my_snprintf_type)(char*, size_t, const char*, ...); size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list); } *my_snprintf_service; size_t my_snprintf(char* to, size_t n, const char* fmt, ...); size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap); #include <mysql/service_thd_alloc.h> #include <mysql/mysql_lex_string.h> struct st_mysql_lex_string { char *str; size_t length; }; typedef struct st_mysql_lex_string MYSQL_LEX_STRING; struct st_mysql_const_lex_string { const char *str; size_t length; }; typedef struct st_mysql_const_lex_string MYSQL_LEX_CSTRING; extern struct thd_alloc_service_st { void *(*thd_alloc_func)(void*, size_t); void *(*thd_calloc_func)(void*, size_t); char *(*thd_strdup_func)(void*, const char *); char *(*thd_strmake_func)(void*, const char *, size_t); void *(*thd_memdup_func)(void*, const void*, size_t); MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *, const char *, size_t, int); } *thd_alloc_service; void *thd_alloc(void* thd, size_t size); void *thd_calloc(void* thd, size_t size); char *thd_strdup(void* thd, const char *str); char *thd_strmake(void* thd, const char *str, size_t size); void *thd_memdup(void* thd, const void* str, size_t size); MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str, const char *str, size_t size, int allocate_lex_string); #include <mysql/service_thd_wait.h> typedef enum _thd_wait_type_e { THD_WAIT_SLEEP= 1, THD_WAIT_DISKIO= 2, THD_WAIT_ROW_LOCK= 3, THD_WAIT_GLOBAL_LOCK= 4, THD_WAIT_META_DATA_LOCK= 5, THD_WAIT_TABLE_LOCK= 6, THD_WAIT_USER_LOCK= 7, THD_WAIT_BINLOG= 8, THD_WAIT_GROUP_COMMIT= 9, THD_WAIT_SYNC= 10, THD_WAIT_NET= 11, THD_WAIT_LAST= 12 } thd_wait_type; extern struct thd_wait_service_st { void (*thd_wait_begin_func)(void*, int); void (*thd_wait_end_func)(void*); } *thd_wait_service; void thd_wait_begin(void* thd, int wait_type); void thd_wait_end(void* thd); #include <mysql/service_thread_scheduler.h> struct Connection_handler_functions; struct THD_event_functions; extern struct my_thread_scheduler_service { int (*connection_handler_set)(struct Connection_handler_functions *, struct THD_event_functions *); int (*connection_handler_reset)(); } *my_thread_scheduler_service; int my_connection_handler_set(struct Connection_handler_functions *chf, struct THD_event_functions *tef); int my_connection_handler_reset(); #include <mysql/service_my_plugin_log.h> enum plugin_log_level { MY_ERROR_LEVEL, MY_WARNING_LEVEL, MY_INFORMATION_LEVEL }; extern struct my_plugin_log_service { int (*my_plugin_log_message)(MYSQL_PLUGIN *, enum plugin_log_level, const char *, ...); } *my_plugin_log_service; int my_plugin_log_message(MYSQL_PLUGIN *plugin, enum plugin_log_level level, const char *format, ...); #include <mysql/service_mysql_string.h> typedef void *mysql_string_iterator_handle; typedef void *mysql_string_handle; extern struct mysql_string_service_st { int (*mysql_string_convert_to_char_ptr_type) (mysql_string_handle, const char *, char *, unsigned int, int *); mysql_string_iterator_handle (*mysql_string_get_iterator_type) (mysql_string_handle); int (*mysql_string_iterator_next_type)(mysql_string_iterator_handle); int (*mysql_string_iterator_isupper_type)(mysql_string_iterator_handle); int (*mysql_string_iterator_islower_type)(mysql_string_iterator_handle); int (*mysql_string_iterator_isdigit_type)(mysql_string_iterator_handle); mysql_string_handle (*mysql_string_to_lowercase_type)(mysql_string_handle); void (*mysql_string_free_type)(mysql_string_handle); void (*mysql_string_iterator_free_type)(mysql_string_iterator_handle); } *mysql_string_service; int mysql_string_convert_to_char_ptr(mysql_string_handle string_handle, const char *charset_name, char *buffer, unsigned int buffer_size, int *error); mysql_string_iterator_handle mysql_string_get_iterator(mysql_string_handle string_handle); int mysql_string_iterator_next(mysql_string_iterator_handle iterator_handle); int mysql_string_iterator_isupper(mysql_string_iterator_handle iterator_handle); int mysql_string_iterator_islower(mysql_string_iterator_handle iterator_handle); int mysql_string_iterator_isdigit(mysql_string_iterator_handle iterator_handle); mysql_string_handle mysql_string_to_lowercase(mysql_string_handle string_handle); void mysql_string_free(mysql_string_handle); void mysql_string_iterator_free(mysql_string_iterator_handle); #include <mysql/service_mysql_alloc.h> #include "mysql/psi/psi_memory.h" #include "psi_base.h" struct PSI_thread; typedef unsigned int PSI_memory_key; typedef int myf_t; typedef void * (*mysql_malloc_t)(PSI_memory_key key, size_t size, myf_t flags); typedef void * (*mysql_realloc_t)(PSI_memory_key key, void *ptr, size_t size, myf_t flags); typedef void (*mysql_claim_t)(void *ptr); typedef void (*mysql_free_t)(void *ptr); typedef void * (*my_memdup_t)(PSI_memory_key key, const void *from, size_t length, myf_t flags); typedef char * (*my_strdup_t)(PSI_memory_key key, const char *from, myf_t flags); typedef char * (*my_strndup_t)(PSI_memory_key key, const char *from, size_t length, myf_t flags); struct mysql_malloc_service_st { mysql_malloc_t mysql_malloc; mysql_realloc_t mysql_realloc; mysql_claim_t mysql_claim; mysql_free_t mysql_free; my_memdup_t my_memdup; my_strdup_t my_strdup; my_strndup_t my_strndup; }; extern struct mysql_malloc_service_st *mysql_malloc_service; extern void * my_malloc(PSI_memory_key key, size_t size, myf_t flags); extern void * my_realloc(PSI_memory_key key, void *ptr, size_t size, myf_t flags); extern void my_claim(void *ptr); extern void my_free(void *ptr); extern void * my_memdup(PSI_memory_key key, const void *from, size_t length, myf_t flags); extern char * my_strdup(PSI_memory_key key, const char *from, myf_t flags); extern char * my_strndup(PSI_memory_key key, const char *from, size_t length, myf_t flags); #include <mysql/service_mysql_password_policy.h> extern struct mysql_password_policy_service_st { int (*my_validate_password_policy_func)(const char *, unsigned int); int (*my_calculate_password_strength_func)(const char *, unsigned int); } *mysql_password_policy_service; int my_validate_password_policy(const char *, unsigned int); int my_calculate_password_strength(const char *, unsigned int); #include <mysql/service_parser.h> #include "my_md5_size.h" #include <mysql/mysql_lex_string.h> typedef void* MYSQL_ITEM; typedef int (*parse_node_visit_function)(MYSQL_ITEM item, unsigned char* arg); typedef int (*sql_condition_handler_function)(int sql_errno, const char* sqlstate, const char* msg, void *state); struct st_my_thread_handle; extern struct mysql_parser_service_st { void* (*mysql_current_session)(); void* (*mysql_open_session)(); void (*mysql_start_thread)(void* thd, void *(*callback_fun)(void*), void *arg, struct st_my_thread_handle *thread_handle); void (*mysql_join_thread)(struct st_my_thread_handle *thread_handle); void (*mysql_set_current_database)(void* thd, const MYSQL_LEX_STRING db); int (*mysql_parse)(void* thd, const MYSQL_LEX_STRING query, unsigned char is_prepared, sql_condition_handler_function handle_condition, void *condition_handler_state); int (*mysql_get_statement_type)(void* thd); int (*mysql_get_statement_digest)(void* thd, unsigned char *digest); int (*mysql_get_number_params)(void* thd); int (*mysql_extract_prepared_params)(void* thd, int *positions); int (*mysql_visit_tree)(void* thd, parse_node_visit_function processor, unsigned char* arg); MYSQL_LEX_STRING (*mysql_item_string)(MYSQL_ITEM item); void (*mysql_free_string)(MYSQL_LEX_STRING string); MYSQL_LEX_STRING (*mysql_get_query)(void* thd); MYSQL_LEX_STRING (*mysql_get_normalized_query)(void* thd); } *mysql_parser_service; typedef void *(*callback_function)(void*); void* mysql_parser_current_session(); void* mysql_parser_open_session(); void mysql_parser_start_thread(void* thd, callback_function fun, void *arg, struct st_my_thread_handle *thread_handle); void mysql_parser_join_thread(struct st_my_thread_handle *thread_handle); void mysql_parser_set_current_database(void* thd, const MYSQL_LEX_STRING db); int mysql_parser_parse(void* thd, const MYSQL_LEX_STRING query, unsigned char is_prepared, sql_condition_handler_function handle_condition, void *condition_handler_state); int mysql_parser_get_statement_type(void* thd); int mysql_parser_get_statement_digest(void* thd, unsigned char *digest); int mysql_parser_get_number_params(void* thd); int mysql_parser_extract_prepared_params(void* thd, int *positions); int mysql_parser_visit_tree(void* thd, parse_node_visit_function processor, unsigned char* arg); MYSQL_LEX_STRING mysql_parser_item_string(MYSQL_ITEM item); void mysql_parser_free_string(MYSQL_LEX_STRING string); MYSQL_LEX_STRING mysql_parser_get_query(void* thd); MYSQL_LEX_STRING mysql_parser_get_normalized_query(void* thd); #include <mysql/service_rpl_transaction_ctx.h> struct st_transaction_termination_ctx { unsigned long m_thread_id; unsigned int m_flags; char m_rollback_transaction; char m_generated_gtid; int m_sidno; long long int m_gno; }; typedef struct st_transaction_termination_ctx Transaction_termination_ctx; extern struct rpl_transaction_ctx_service_st { int (*set_transaction_ctx)(Transaction_termination_ctx transaction_termination_ctx); } *rpl_transaction_ctx_service; int set_transaction_ctx(Transaction_termination_ctx transaction_termination_ctx); #include <mysql/service_rpl_transaction_write_set.h> struct st_trans_write_set { unsigned int m_flags; unsigned long write_set_size; unsigned long long* write_set; }; typedef struct st_trans_write_set Transaction_write_set; extern struct transaction_write_set_service_st { Transaction_write_set* (*get_transaction_write_set)(unsigned long m_thread_id); } *transaction_write_set_service; Transaction_write_set* get_transaction_write_set(unsigned long m_thread_id); #include <mysql/service_security_context.h> typedef char my_svc_bool; extern struct security_context_service_st { my_svc_bool (*thd_get_security_context)(void*, void* *out_ctx); my_svc_bool (*thd_set_security_context)(void*, void* in_ctx); my_svc_bool (*security_context_create)(void* *out_ctx); my_svc_bool (*security_context_destroy)(void*); my_svc_bool (*security_context_copy)(void* in_ctx, void* *out_ctx); my_svc_bool (*security_context_lookup)(void* ctx, const char *user, const char *host, const char *ip, const char *db); my_svc_bool (*security_context_get_option)(void*, const char *name, void *inout_pvalue); my_svc_bool (*security_context_set_option)(void*, const char *name, void *pvalue); } *security_context_service; my_svc_bool thd_get_security_context(void*, void* *out_ctx); my_svc_bool thd_set_security_context(void*, void* in_ctx); my_svc_bool security_context_create(void* *out_ctx); my_svc_bool security_context_destroy(void* ctx); my_svc_bool security_context_copy(void* in_ctx, void* *out_ctx); my_svc_bool security_context_lookup(void* ctx, const char *user, const char *host, const char *ip, const char *db); my_svc_bool security_context_get_option(void*, const char *name, void *inout_pvalue); my_svc_bool security_context_set_option(void*, const char *name, void *pvalue); #include <mysql/service_locking.h> enum enum_locking_service_lock_type { LOCKING_SERVICE_READ, LOCKING_SERVICE_WRITE }; extern struct mysql_locking_service_st { int (*mysql_acquire_locks)(void* opaque_thd, const char* lock_namespace, const char**lock_names, size_t lock_num, enum enum_locking_service_lock_type lock_type, unsigned long lock_timeout); int (*mysql_release_locks)(void* opaque_thd, const char* lock_namespace); } *mysql_locking_service; int mysql_acquire_locking_service_locks(void* opaque_thd, const char* lock_namespace, const char**lock_names, size_t lock_num, enum enum_locking_service_lock_type lock_type, unsigned long lock_timeout); int mysql_release_locking_service_locks(void* opaque_thd, const char* lock_namespace); #include <mysql/service_mysql_keyring.h> extern struct mysql_keyring_service_st { int (*my_key_store_func)(const char *, const char *, const char *, const void *, size_t); int (*my_key_fetch_func)(const char *, char **, const char *, void **, size_t *); int (*my_key_remove_func)(const char *, const char *); int (*my_key_generate_func)(const char *, const char *, const char *, size_t); } *mysql_keyring_service; int my_key_store(const char *, const char *, const char *, const void *, size_t); int my_key_fetch(const char *, char **, const char *, void **, size_t *); int my_key_remove(const char *, const char *); int my_key_generate(const char *, const char *, const char *, size_t); �������������������������������������������mysql/mysql/service_ssl_wrapper.h�������������������������������������������������������������������0000644�����������������00000012035�14763166026�0013324 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef SSL_WRAPPER_INCLUDED #define SSL_WRAPPER_INCLUDED /* Copyright (c) 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "violite.h" namespace ssl_wrappe_service { int MY_ATTRIBUTE((visibility("default"))) dummy_function_to_ensure_we_are_linked_into_the_server(); } // ssl_wrappe_service /** Return version of SSL used in currect connection @param vio VIO connection descriptor @param buffer Character buffer in which the version is going to be placed @param buffer_size Size of the character buffer */ extern "C" void ssl_wrapper_version(Vio *vio, char *version, const size_t version_size); /** Return cipher used in current connection @param vio VIO connection descriptor @param buffer Character buffer in which the cipher name is going to be placed @param buffer_size Size of the character buffer */ extern "C" void ssl_wrapper_cipher(Vio *vio, char *cipher, const size_t cipher_size); /** Return cipher list that can be used for SSL @param vio VIO connection descriptor @param clipher_list Pointer to an array of c-strings @param maximun_num_of_elements Size of the pointer array */ extern "C" long ssl_wrapper_cipher_list(Vio *vio, const char **clipher_list, const size_t maximun_num_of_elements); /** Return the verification depth limit set in SSL @param vio VIO connection descriptor @return -1 default values should be used >0 verification depth */ extern "C" long ssl_wrapper_verify_depth(Vio *vio); /** Return the verification mode set in SSL @param vio VIO connection descriptor @return -1 default values should be used >0 verification mode */ extern "C" long ssl_wrapper_verify_mode(Vio *vio); /** Return issuer name form peers ssl certificate @param vio VIO connection descriptor @param issuer Character buffer in which the issuer name is going to be placed @param issuer_size Size of character buffer for the issuer name */ extern "C" void ssl_wrapper_get_peer_certificate_issuer(Vio *vio, char *issuer, const size_t issuer_size); /** Return subject field form peers ssl certificate @param vio VIO connection descriptor @param subject Character buffer in which the subject is going to be placed @param subject_size Size of character buffer for the subject */ extern "C" void ssl_wrapper_get_peer_certificate_subject(Vio *vio, char *subject, const size_t subject_size); /** Check is peer certificate is present and try to verify it @param vio VIO connection descriptor @return X509_V_OK verification of peer certificate succeeded -1 verification failed */ extern "C" long ssl_wrapper_get_verify_result_and_cert(Vio *vio); /** Return the verification depth limit set in SSL context @param vio_ssl VIO SSL contex descriptor @return -1 default values should be used >0 verification depth */ extern "C" long ssl_wrapper_ctx_verify_depth(struct st_VioSSLFd *vio_ssl); /** Return the verification mode set in SSL context @param vio_ssl VIO SSL contex descriptor @return -1 default values should be used >0 verification mode */ extern "C" long ssl_wrapper_ctx_verify_mode(struct st_VioSSLFd *vio_ssl); /** Return the last day the server certificate is valid @param vio_ssl VIO SSL contex descriptor @param no_after Character buffer for to be filed with the date in human readble format @param no_after_size Size of the character buffer */ extern "C" void ssl_wrapper_ctx_server_not_after(struct st_VioSSLFd *vio_ssl, char *no_after, const size_t no_after_size); /** Return the first day the server certificate is valid @param vio_ssl VIO SSL contex descriptor @param no_before Character buffer for to be filed with the date in human readble format @param no_before_size Size of the character buffer */ extern "C" void ssl_wrapper_ctx_server_not_before(struct st_VioSSLFd *vio_ssl, char *no_before, const size_t no_before_size); extern "C" void ssl_wrapper_thread_cleanup(); extern "C" long ssl_wrapper_sess_accept(struct st_VioSSLFd *vio_ssl); /** Cleanup data allocated by SSL on thread stack */ extern "C" long ssl_wrapper_sess_accept_good(struct st_VioSSLFd *vio_ssl); #endif /* SSL_WRAPPER_INCLUDED */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/mysql_lex_string.h����������������������������������������������������������������������0000644�����������������00000002110�14763166026�0012637 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_LEX_STRING_INCLUDED #define MYSQL_LEX_STRING_INCLUDED struct st_mysql_lex_string { char *str; size_t length; }; typedef struct st_mysql_lex_string MYSQL_LEX_STRING; struct st_mysql_const_lex_string { const char *str; size_t length; }; typedef struct st_mysql_const_lex_string MYSQL_LEX_CSTRING; #endif // MYSQL_LEX_STRING_INCLUDED ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/get_password.h��������������������������������������������������������������������������0000644�����������������00000002256�14763166026�0011750 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* ** Ask for a password from tty ** This is an own file to avoid conflicts with curses */ #ifndef MYSQL_GET_PASSWORD_H_INCLUDED #define MYSQL_GET_PASSWORD_H_INCLUDED #ifdef __cplusplus extern "C" { #endif typedef char *(* strdup_handler_t)(const char *, int); char *get_tty_password_ext(const char *opt_message, strdup_handler_t strdup_function); #ifdef __cplusplus } #endif #endif /* ! MYSQL_GET_PASSWORD_H_INCLUDED */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/service_locking.h�����������������������������������������������������������������������0000644�����������������00000010356�14763166026�0012415 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef SERVICE_LOCKING_INCLUDED #define SERVICE_LOCKING_INCLUDED /* This service provides support for taking read/write locks. It is intended for use with fabric, but it is still a general service. The locks are in a separate namespace from other locks in the server, and there is also no interactions with transactions (i.e. locks are not released on commit/abort). These locks are implemented using the metadata lock (MDL) subsystem and thus deadlocks involving locking service locks and other types of metadata will be detected using the MDL deadlock detector. */ #ifdef __cplusplus class THD; #define MYSQL_THD THD* #else #define MYSQL_THD void* #endif #ifdef __cplusplus extern "C" { #endif /** Types of locking service locks. LOCKING_SERVICE_READ is compatible with LOCKING_SERVICE_READ. All other combinations are incompatible. */ enum enum_locking_service_lock_type { LOCKING_SERVICE_READ, LOCKING_SERVICE_WRITE }; extern struct mysql_locking_service_st { /** Acquire locking service locks. @param opaque_thd Thread handle. If NULL, current_thd will be used. @param lock_namespace Namespace of the locks to acquire. @param lock_names Array of names of the locks to acquire. @param lock_num Number of elements in 'lock_names'. @param lock_type Lock type to acquire. LOCKING_SERVICE_READ or _WRITE. @param lock_timeout Number of seconds to wait before giving up. @retval 1 Acquisition failed, error has been reported. @retval 0 Acquisition successful, all locks acquired. @note both lock_namespace and lock_names are limited to 64 characters max. Names are compared using binary comparison. */ int (*mysql_acquire_locks)(MYSQL_THD opaque_thd, const char* lock_namespace, const char**lock_names, size_t lock_num, enum enum_locking_service_lock_type lock_type, unsigned long lock_timeout); /** Release all lock service locks taken by the given connection in the given namespace. @param opaque_thd Thread handle. If NULL, current_thd will be used. @param lock_namespace Namespace of the locks to release. @retval 1 Release failed, error has been reported. @retval 0 Release successful, all locks acquired. */ int (*mysql_release_locks)(MYSQL_THD opaque_thd, const char* lock_namespace); } *mysql_locking_service; #ifdef MYSQL_DYNAMIC_PLUGIN #define mysql_acquire_locking_service_locks(_THD, _NAMESPACE, _NAMES, _NUM, \ _TYPE, _TIMEOUT) \ mysql_locking_service->mysql_acquire_locks(_THD, _NAMESPACE, _NAMES, _NUM, \ _TYPE, _TIMEOUT) #define mysql_release_locking_service_locks(_THD, _NAMESPACE) \ mysql_locking_service->mysql_release_locks(_THD, _NAMESPACE) #else int mysql_acquire_locking_service_locks(MYSQL_THD opaque_thd, const char* lock_namespace, const char**lock_names, size_t lock_num, enum enum_locking_service_lock_type lock_type, unsigned long lock_timeout); int mysql_release_locking_service_locks(MYSQL_THD opaque_thd, const char* lock_namespace); #endif /* MYSQL_DYNAMIC_PLUGIN */ #ifdef __cplusplus } #endif #endif /* SERVICE_LOCKING_INCLUDED */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/plugin_auth_common.h��������������������������������������������������������������������0000644�����������������00000011356�14763166026�0013137 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef MYSQL_PLUGIN_AUTH_COMMON_INCLUDED /* Copyright (c) 2010, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** @file This file defines constants and data structures that are the same for both client- and server-side authentication plugins. */ #define MYSQL_PLUGIN_AUTH_COMMON_INCLUDED /** the max allowed length for a user name */ #define MYSQL_USERNAME_LENGTH 96 /** return values of the plugin authenticate_user() method. */ /** Authentication failed, plugin internal error. An error occurred in the authentication plugin itself. These errors are reported in table performance_schema.host_cache, column COUNT_AUTH_PLUGIN_ERRORS. */ #define CR_AUTH_PLUGIN_ERROR 3 /** Authentication failed, client server handshake. An error occurred during the client server handshake. These errors are reported in table performance_schema.host_cache, column COUNT_HANDSHAKE_ERRORS. */ #define CR_AUTH_HANDSHAKE 2 /** Authentication failed, user credentials. For example, wrong passwords. These errors are reported in table performance_schema.host_cache, column COUNT_AUTHENTICATION_ERRORS. */ #define CR_AUTH_USER_CREDENTIALS 1 /** Authentication failed. Additionally, all other CR_xxx values (libmysql error code) can be used too. The client plugin may set the error code and the error message directly in the MYSQL structure and return CR_ERROR. If a CR_xxx specific error code was returned, an error message in the MYSQL structure will be overwritten. If CR_ERROR is returned without setting the error in MYSQL, CR_UNKNOWN_ERROR will be user. */ #define CR_ERROR 0 /** Authentication (client part) was successful. It does not mean that the authentication as a whole was successful, usually it only means that the client was able to send the user name and the password to the server. If CR_OK is returned, the libmysql reads the next packet expecting it to be one of OK, ERROR, or CHANGE_PLUGIN packets. */ #define CR_OK -1 /** Authentication was successful. It means that the client has done its part successfully and also that a plugin has read the last packet (one of OK, ERROR, CHANGE_PLUGIN). In this case, libmysql will not read a packet from the server, but it will use the data at mysql->net.read_pos. A plugin may return this value if the number of roundtrips in the authentication protocol is not known in advance, and the client plugin needs to read one packet more to determine if the authentication is finished or not. */ #define CR_OK_HANDSHAKE_COMPLETE -2 /** Flag to be passed back to server from authentication plugins via authenticated_as when proxy mapping should be done by the server. */ #define PROXY_FLAG 0 /* We need HANDLE definition if on Windows. Define WIN32_LEAN_AND_MEAN (if not already done) to minimize amount of imported declarations. */ #ifdef _WIN32 #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #include <windows.h> #endif typedef struct st_plugin_vio_info { enum { MYSQL_VIO_INVALID, MYSQL_VIO_TCP, MYSQL_VIO_SOCKET, MYSQL_VIO_PIPE, MYSQL_VIO_MEMORY } protocol; int socket; /**< it's set, if the protocol is SOCKET or TCP */ #ifdef _WIN32 HANDLE handle; /**< it's set, if the protocol is PIPE or MEMORY */ #endif } MYSQL_PLUGIN_VIO_INFO; /** Provides plugin access to communication channel */ typedef struct st_plugin_vio { /** Plugin provides a pointer reference and this function sets it to the contents of any incoming packet. Returns the packet length, or -1 if the plugin should terminate. */ int (*read_packet)(struct st_plugin_vio *vio, unsigned char **buf); /** Plugin provides a buffer with data and the length and this function sends it as a packet. Returns 0 on success, 1 on failure. */ int (*write_packet)(struct st_plugin_vio *vio, const unsigned char *packet, int packet_len); /** Fills in a st_plugin_vio_info structure, providing the information about the connection. */ void (*info)(struct st_plugin_vio *vio, struct st_plugin_vio_info *info); } MYSQL_PLUGIN_VIO; #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/plugin_group_replication.h��������������������������������������������������������������0000644�����������������00000013045�14763166026�0014350 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2013, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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, 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef MYSQL_PLUGIN_GROUP_REPLICATION_INCLUDED #define MYSQL_PLUGIN_GROUP_REPLICATION_INCLUDED /* API for Group Peplication plugin. (MYSQL_GROUP_REPLICATION_PLUGIN) */ #include <mysql/plugin.h> #define MYSQL_GROUP_REPLICATION_INTERFACE_VERSION 0x0101 /* Callbacks for get_connection_status_info function. context field can have NULL value, plugin will always pass it through all callbacks, independent of its value. Its value will not be used by plugin. All callbacks are mandatory. */ typedef struct st_group_replication_connection_status_callbacks { void* const context; void (*set_channel_name)(void* const context, const char& value, size_t length); void (*set_group_name)(void* const context, const char& value, size_t length); void (*set_source_uuid)(void* const context, const char& value, size_t length); void (*set_service_state)(void* const context, bool state); } GROUP_REPLICATION_CONNECTION_STATUS_CALLBACKS; /* Callbacks for get_group_members_info function. context field can have NULL value, plugin will always pass it through all callbacks, independent of its value. Its value will not be used by plugin. All callbacks are mandatory. */ typedef struct st_group_replication_group_members_callbacks { void* const context; void (*set_channel_name)(void* const context, const char& value, size_t length); void (*set_member_id)(void* const context, const char& value, size_t length); void (*set_member_host)(void* const context, const char& value, size_t length); void (*set_member_port)(void* const context, unsigned int value); void (*set_member_state)(void* const context, const char& value, size_t length); } GROUP_REPLICATION_GROUP_MEMBERS_CALLBACKS; /* Callbacks for get_group_member_stats_info function. context field can have NULL value, plugin will always pass it through all callbacks, independent of its value. Its value will not be used by plugin. All callbacks are mandatory. */ typedef struct st_group_replication_member_stats_callbacks { void* const context; void (*set_channel_name)(void* const context, const char& value, size_t length); void (*set_view_id)(void* const context, const char& value, size_t length); void (*set_member_id)(void* const context, const char& value, size_t length); void (*set_transactions_committed)(void* const context, const char& value, size_t length); void (*set_last_conflict_free_transaction)(void* const context, const char& value, size_t length); void (*set_transactions_in_queue)(void* const context, unsigned long long int value); void (*set_transactions_certified)(void* const context, unsigned long long int value); void (*set_transactions_conflicts_detected)(void* const context, unsigned long long int value); void (*set_transactions_rows_in_validation)(void* const context, unsigned long long int value); } GROUP_REPLICATION_GROUP_MEMBER_STATS_CALLBACKS; struct st_mysql_group_replication { int interface_version; /* This function is used to start the group replication. */ int (*start)(); /* This function is used to stop the group replication. */ int (*stop)(); /* This function is used to get the current group replication running status. */ bool (*is_running)(); /* This function initializes conflict checking module with info received from group on this member. @param info View_change_log_event with conflict checking info. */ int (*set_retrieved_certification_info)(void* info); /* This function is used to fetch information for group replication kernel stats. @param callbacks The set of callbacks and its context used to set the information on caller. @note The caller is responsible to free memory from the info structure and from all its fields. */ bool (*get_connection_status_info) (const GROUP_REPLICATION_CONNECTION_STATUS_CALLBACKS& callbacks); /* This function is used to fetch information for group replication members. @param callbacks The set of callbacks and its context used to set the information on caller. @note The caller is responsible to free memory from the info structure and from all its fields. */ bool (*get_group_members_info) (unsigned int index, const GROUP_REPLICATION_GROUP_MEMBERS_CALLBACKS& callbacks); /* This function is used to fetch information for group replication members statistics. @param callbacks The set of callbacks and its context used to set the information on caller. @note The caller is responsible to free memory from the info structure and from all its fields. */ bool (*get_group_member_stats_info) (const GROUP_REPLICATION_GROUP_MEMBER_STATS_CALLBACKS& callbacks); /* Get number of group replication members. */ unsigned int (*get_members_number_info)(); }; #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/psi/mysql_table.h�����������������������������������������������������������������������0000644�����������������00000007711�14763166026�0012357 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2010, 2014, Oracle and/or its affiliates. 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; version 2 of the License. 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, 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef MYSQL_TABLE_H #define MYSQL_TABLE_H /** @file mysql/psi/mysql_table.h Instrumentation helpers for table io. */ #include "mysql/psi/psi.h" #ifndef PSI_TABLE_CALL #define PSI_TABLE_CALL(M) PSI_DYNAMIC_CALL(M) #endif /** @defgroup Table_instrumentation Table Instrumentation @ingroup Instrumentation_interface @{ */ /** @def MYSQL_TABLE_WAIT_VARIABLES Instrumentation helper for table waits. This instrumentation declares local variables. Do not use a ';' after this macro @param LOCKER the locker @param STATE the locker state @sa MYSQL_START_TABLE_IO_WAIT. @sa MYSQL_END_TABLE_IO_WAIT. @sa MYSQL_START_TABLE_LOCK_WAIT. @sa MYSQL_END_TABLE_LOCK_WAIT. */ #ifdef HAVE_PSI_TABLE_INTERFACE #define MYSQL_TABLE_WAIT_VARIABLES(LOCKER, STATE) \ struct PSI_table_locker* LOCKER; \ PSI_table_locker_state STATE; #else #define MYSQL_TABLE_WAIT_VARIABLES(LOCKER, STATE) #endif /** @def MYSQL_START_TABLE_LOCK_WAIT Instrumentation helper for table lock waits. This instrumentation marks the start of a wait event. @param LOCKER the locker @param STATE the locker state @param PSI the instrumented table @param OP the table operation to be performed @param FLAGS per table operation flags. @sa MYSQL_END_TABLE_LOCK_WAIT. */ #ifdef HAVE_PSI_TABLE_INTERFACE #define MYSQL_START_TABLE_LOCK_WAIT(LOCKER, STATE, PSI, OP, FLAGS) \ LOCKER= inline_mysql_start_table_lock_wait(STATE, PSI, \ OP, FLAGS, __FILE__, __LINE__) #else #define MYSQL_START_TABLE_LOCK_WAIT(LOCKER, STATE, PSI, OP, FLAGS) \ do {} while (0) #endif /** @def MYSQL_END_TABLE_LOCK_WAIT Instrumentation helper for table lock waits. This instrumentation marks the end of a wait event. @param LOCKER the locker @sa MYSQL_START_TABLE_LOCK_WAIT. */ #ifdef HAVE_PSI_TABLE_INTERFACE #define MYSQL_END_TABLE_LOCK_WAIT(LOCKER) \ inline_mysql_end_table_lock_wait(LOCKER) #else #define MYSQL_END_TABLE_LOCK_WAIT(LOCKER) \ do {} while (0) #endif #ifdef HAVE_PSI_TABLE_INTERFACE #define MYSQL_UNLOCK_TABLE(T) \ inline_mysql_unlock_table(T) #else #define MYSQL_UNLOCK_TABLE(T) \ do {} while (0) #endif #ifdef HAVE_PSI_TABLE_INTERFACE /** Instrumentation calls for MYSQL_START_TABLE_LOCK_WAIT. @sa MYSQL_END_TABLE_LOCK_WAIT. */ static inline struct PSI_table_locker * inline_mysql_start_table_lock_wait(PSI_table_locker_state *state, struct PSI_table *psi, enum PSI_table_lock_operation op, ulong flags, const char *src_file, int src_line) { if (psi != NULL) { struct PSI_table_locker *locker; locker= PSI_TABLE_CALL(start_table_lock_wait) (state, psi, op, flags, src_file, src_line); return locker; } return NULL; } /** Instrumentation calls for MYSQL_END_TABLE_LOCK_WAIT. @sa MYSQL_START_TABLE_LOCK_WAIT. */ static inline void inline_mysql_end_table_lock_wait(struct PSI_table_locker *locker) { if (locker != NULL) PSI_TABLE_CALL(end_table_lock_wait)(locker); } static inline void inline_mysql_unlock_table(struct PSI_table *table) { if (table != NULL) PSI_TABLE_CALL(unlock_table)(table); } #endif /** @} (end of group Table_instrumentation) */ #endif �������������������������������������������������������mysql/mysql/psi/mysql_mdl.h�������������������������������������������������������������������������0000644�����������������00000006355�14763166026�0012047 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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, 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef MYSQL_MDL_H #define MYSQL_MDL_H /** @file mysql/psi/mysql_mdl.h Instrumentation helpers for metadata locks. */ #include "mysql/psi/psi.h" #ifndef PSI_METADATA_CALL #define PSI_METADATA_CALL(M) PSI_DYNAMIC_CALL(M) #endif /** @defgroup Thread_instrumentation Metadata Instrumentation @ingroup Instrumentation_interface @{ */ /** @def mysql_mdl_create(K, M, A) Instrumented metadata lock creation. @param I Metadata lock identity @param K Metadata key @param T Metadata lock type @param D Metadata lock duration @param S Metadata lock status @param F request source file @param L request source line */ #ifdef HAVE_PSI_METADATA_INTERFACE #define mysql_mdl_create(I, K, T, D, S, F, L) \ inline_mysql_mdl_create(I, K, T, D, S, F, L) #else #define mysql_mdl_create(I, K, T, D, S, F, L) NULL #endif #ifdef HAVE_PSI_METADATA_INTERFACE #define mysql_mdl_set_status(L, S) \ inline_mysql_mdl_set_status(L, S) #else #define mysql_mdl_set_status(L, S) \ do {} while (0) #endif /** @def mysql_mdl_destroy(M) Instrumented metadata lock destruction. @param M Metadata lock */ #ifdef HAVE_PSI_METADATA_INTERFACE #define mysql_mdl_destroy(M) \ inline_mysql_mdl_destroy(M, __FILE__, __LINE__) #else #define mysql_mdl_destroy(M) \ do {} while (0) #endif #ifdef HAVE_PSI_METADATA_INTERFACE static inline PSI_metadata_lock * inline_mysql_mdl_create(void *identity, const MDL_key *mdl_key, enum_mdl_type mdl_type, enum_mdl_duration mdl_duration, MDL_ticket::enum_psi_status mdl_status, const char *src_file, uint src_line) { PSI_metadata_lock *result; /* static_cast: Fit a round C++ enum peg into a square C int hole ... */ result= PSI_METADATA_CALL(create_metadata_lock) (identity, mdl_key, static_cast<opaque_mdl_type> (mdl_type), static_cast<opaque_mdl_duration> (mdl_duration), static_cast<opaque_mdl_status> (mdl_status), src_file, src_line); return result; } static inline void inline_mysql_mdl_set_status( PSI_metadata_lock *psi, MDL_ticket::enum_psi_status mdl_status) { if (psi != NULL) PSI_METADATA_CALL(set_metadata_lock_status)(psi, mdl_status); } static inline void inline_mysql_mdl_destroy( PSI_metadata_lock *psi, const char *src_file, uint src_line) { if (psi != NULL) PSI_METADATA_CALL(destroy_metadata_lock)(psi); } #endif /* HAVE_PSI_METADATA_INTERFACE */ /** @} (end of group Metadata_instrumentation) */ #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/psi/mysql_stage.h�����������������������������������������������������������������������0000644�����������������00000011267�14763166026�0012374 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2010, 2014, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_STAGE_H #define MYSQL_STAGE_H /** @file mysql/psi/mysql_stage.h Instrumentation helpers for stages. */ #include "mysql/psi/psi.h" #ifndef PSI_STAGE_CALL #define PSI_STAGE_CALL(M) PSI_DYNAMIC_CALL(M) #endif /** @defgroup Stage_instrumentation Stage Instrumentation @ingroup Instrumentation_interface @{ */ /** @def mysql_stage_register(P1, P2, P3) Stage registration. */ #ifdef HAVE_PSI_STAGE_INTERFACE #define mysql_stage_register(P1, P2, P3) \ inline_mysql_stage_register(P1, P2, P3) #else #define mysql_stage_register(P1, P2, P3) \ do {} while (0) #endif /** @def MYSQL_SET_STAGE Set the current stage. Use this API when the file and line is passed from the caller. @param K the stage key @param F the source file name @param L the source file line @return the current stage progress */ #ifdef HAVE_PSI_STAGE_INTERFACE #define MYSQL_SET_STAGE(K, F, L) \ inline_mysql_set_stage(K, F, L) #else #define MYSQL_SET_STAGE(K, F, L) \ NULL #endif /** @def mysql_set_stage Set the current stage. @param K the stage key @return the current stage progress */ #ifdef HAVE_PSI_STAGE_INTERFACE #define mysql_set_stage(K) \ inline_mysql_set_stage(K, __FILE__, __LINE__) #else #define mysql_set_stage(K) \ NULL #endif /** @def mysql_end_stage End the last stage */ #ifdef HAVE_PSI_STAGE_INTERFACE #define mysql_end_stage \ inline_mysql_end_stage #else #define mysql_end_stage \ do {} while (0) #endif #ifdef HAVE_PSI_STAGE_INTERFACE static inline void inline_mysql_stage_register( const char *category, PSI_stage_info **info, int count) { PSI_STAGE_CALL(register_stage)(category, info, count); } #endif #ifdef HAVE_PSI_STAGE_INTERFACE static inline PSI_stage_progress* inline_mysql_set_stage(PSI_stage_key key, const char *src_file, int src_line) { return PSI_STAGE_CALL(start_stage)(key, src_file, src_line); } #endif #ifdef HAVE_PSI_STAGE_INTERFACE static inline void inline_mysql_end_stage() { PSI_STAGE_CALL(end_stage)(); } #endif #ifdef HAVE_PSI_STAGE_INTERFACE #define mysql_stage_set_work_completed(P1, P2) \ inline_mysql_stage_set_work_completed(P1, P2) #define mysql_stage_get_work_completed(P1) \ inline_mysql_stage_get_work_completed(P1) #else #define mysql_stage_set_work_completed(P1, P2) \ do {} while (0) #define mysql_stage_get_work_completed(P1) \ do {} while (0) #endif #ifdef HAVE_PSI_STAGE_INTERFACE #define mysql_stage_inc_work_completed(P1, P2) \ inline_mysql_stage_inc_work_completed(P1, P2) #else #define mysql_stage_inc_work_completed(P1, P2) \ do {} while (0) #endif #ifdef HAVE_PSI_STAGE_INTERFACE #define mysql_stage_set_work_estimated(P1, P2) \ inline_mysql_stage_set_work_estimated(P1, P2) #define mysql_stage_get_work_estimated(P1) \ inline_mysql_stage_get_work_estimated(P1) #else #define mysql_stage_set_work_estimated(P1, P2) \ do {} while (0) #define mysql_stage_get_work_estimated(P1) \ do {} while (0) #endif #ifdef HAVE_PSI_STAGE_INTERFACE static inline void inline_mysql_stage_set_work_completed(PSI_stage_progress *progress, ulonglong val) { if (progress != NULL) progress->m_work_completed= val; } static inline ulonglong inline_mysql_stage_get_work_completed(PSI_stage_progress *progress) { return progress->m_work_completed; } #endif #ifdef HAVE_PSI_STAGE_INTERFACE static inline void inline_mysql_stage_inc_work_completed(PSI_stage_progress *progress, ulonglong val) { if (progress != NULL) progress->m_work_completed+= val; } #endif #ifdef HAVE_PSI_STAGE_INTERFACE static inline void inline_mysql_stage_set_work_estimated(PSI_stage_progress *progress, ulonglong val) { if (progress != NULL) progress->m_work_estimated= val; } static inline ulonglong inline_mysql_stage_get_work_estimated(PSI_stage_progress *progress) { return progress->m_work_estimated; } #endif /** @} (end of group Stage_instrumentation) */ #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/psi/mysql_thread.h����������������������������������������������������������������������0000644�����������������00000101030�14763166026�0012524 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2008, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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, 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef MYSQL_THREAD_H #define MYSQL_THREAD_H /** @file mysql/psi/mysql_thread.h Instrumentation helpers for mysys threads, mutexes, read write locks and conditions. This header file provides the necessary declarations to use the mysys thread API with the performance schema instrumentation. In some compilers (SunStudio), 'static inline' functions, when declared but not used, are not optimized away (because they are unused) by default, so that including a static inline function from a header file does create unwanted dependencies, causing unresolved symbols at link time. Other compilers, like gcc, optimize these dependencies by default. Since the instrumented APIs declared here are wrapper on top of my_thread / safemutex / etc APIs, including mysql/psi/mysql_thread.h assumes that the dependency on my_thread and safemutex already exists. */ /* Note: there are several orthogonal dimensions here. Dimension 1: Instrumentation HAVE_PSI_INTERFACE is defined when the instrumentation is compiled in. This may happen both in debug or production builds. Dimension 2: Debug SAFE_MUTEX is defined when debug is compiled in. This may happen both with and without instrumentation. Dimension 3: Platform Mutexes are implemented with one of: - the pthread library - fast mutexes - window apis This is implemented by various macro definitions in my_thread.h This causes complexity with '#ifdef'-ery that can't be avoided. */ #include "my_thread.h" #include "my_thread_local.h" #include "thr_mutex.h" #include "thr_rwlock.h" #include "mysql/psi/psi.h" #ifdef MYSQL_SERVER #ifndef MYSQL_DYNAMIC_PLUGIN #include "pfs_thread_provider.h" #endif #endif #ifndef PSI_MUTEX_CALL #define PSI_MUTEX_CALL(M) PSI_DYNAMIC_CALL(M) #endif #ifndef PSI_RWLOCK_CALL #define PSI_RWLOCK_CALL(M) PSI_DYNAMIC_CALL(M) #endif #ifndef PSI_COND_CALL #define PSI_COND_CALL(M) PSI_DYNAMIC_CALL(M) #endif #ifndef PSI_THREAD_CALL #define PSI_THREAD_CALL(M) PSI_DYNAMIC_CALL(M) #endif /** @defgroup Thread_instrumentation Thread Instrumentation @ingroup Instrumentation_interface @{ */ /** An instrumented mutex structure. @sa mysql_mutex_t */ struct st_mysql_mutex { /** The real mutex. */ my_mutex_t m_mutex; /** The instrumentation hook. Note that this hook is not conditionally defined, for binary compatibility of the @c mysql_mutex_t interface. */ struct PSI_mutex *m_psi; }; /** Type of an instrumented mutex. @c mysql_mutex_t is a drop-in replacement for @c my_mutex_t. @sa mysql_mutex_assert_owner @sa mysql_mutex_assert_not_owner @sa mysql_mutex_init @sa mysql_mutex_lock @sa mysql_mutex_unlock @sa mysql_mutex_destroy */ typedef struct st_mysql_mutex mysql_mutex_t; /** An instrumented rwlock structure. @sa mysql_rwlock_t */ struct st_mysql_rwlock { /** The real rwlock */ native_rw_lock_t m_rwlock; /** The instrumentation hook. Note that this hook is not conditionally defined, for binary compatibility of the @c mysql_rwlock_t interface. */ struct PSI_rwlock *m_psi; }; /** An instrumented prlock structure. @sa mysql_prlock_t */ struct st_mysql_prlock { /** The real prlock */ rw_pr_lock_t m_prlock; /** The instrumentation hook. Note that this hook is not conditionally defined, for binary compatibility of the @c mysql_rwlock_t interface. */ struct PSI_rwlock *m_psi; }; /** Type of an instrumented rwlock. @c mysql_rwlock_t is a drop-in replacement for @c pthread_rwlock_t. @sa mysql_rwlock_init @sa mysql_rwlock_rdlock @sa mysql_rwlock_tryrdlock @sa mysql_rwlock_wrlock @sa mysql_rwlock_trywrlock @sa mysql_rwlock_unlock @sa mysql_rwlock_destroy */ typedef struct st_mysql_rwlock mysql_rwlock_t; /** Type of an instrumented prlock. A prlock is a read write lock that 'prefers readers' (pr). @c mysql_prlock_t is a drop-in replacement for @c rw_pr_lock_t. @sa mysql_prlock_init @sa mysql_prlock_rdlock @sa mysql_prlock_wrlock @sa mysql_prlock_unlock @sa mysql_prlock_destroy */ typedef struct st_mysql_prlock mysql_prlock_t; /** An instrumented cond structure. @sa mysql_cond_t */ struct st_mysql_cond { /** The real condition */ native_cond_t m_cond; /** The instrumentation hook. Note that this hook is not conditionally defined, for binary compatibility of the @c mysql_cond_t interface. */ struct PSI_cond *m_psi; }; /** Type of an instrumented condition. @c mysql_cond_t is a drop-in replacement for @c native_cond_t. @sa mysql_cond_init @sa mysql_cond_wait @sa mysql_cond_timedwait @sa mysql_cond_signal @sa mysql_cond_broadcast @sa mysql_cond_destroy */ typedef struct st_mysql_cond mysql_cond_t; /* Consider the following code: static inline void foo() { bar(); } when foo() is never called. With gcc, foo() is a local static function, so the dependencies are optimized away at compile time, and there is no dependency on bar(). With other compilers (HP, Sun Studio), the function foo() implementation is compiled, and bar() needs to be present to link. Due to the existing header dependencies in MySQL code, this header file is sometime used when it is not needed, which in turn cause link failures on some platforms. The proper fix would be to cut these extra dependencies in the calling code. DISABLE_MYSQL_THREAD_H is a work around to limit dependencies. DISABLE_MYSQL_PRLOCK_H is similar, and is used to disable specifically the prlock wrappers. */ #ifndef DISABLE_MYSQL_THREAD_H /** @def mysql_mutex_assert_owner(M) Wrapper, to use safe_mutex_assert_owner with instrumented mutexes. @c mysql_mutex_assert_owner is a drop-in replacement for @c safe_mutex_assert_owner. */ #ifdef SAFE_MUTEX #define mysql_mutex_assert_owner(M) \ safe_mutex_assert_owner(&(M)->m_mutex); #else #define mysql_mutex_assert_owner(M) { } #endif /** @def mysql_mutex_assert_not_owner(M) Wrapper, to use safe_mutex_assert_not_owner with instrumented mutexes. @c mysql_mutex_assert_not_owner is a drop-in replacement for @c safe_mutex_assert_not_owner. */ #ifdef SAFE_MUTEX #define mysql_mutex_assert_not_owner(M) \ safe_mutex_assert_not_owner(&(M)->m_mutex); #else #define mysql_mutex_assert_not_owner(M) { } #endif /** @def mysql_prlock_assert_write_owner(M) Drop-in replacement for @c rw_pr_lock_assert_write_owner. */ #define mysql_prlock_assert_write_owner(M) \ rw_pr_lock_assert_write_owner(&(M)->m_prlock) /** @def mysql_prlock_assert_not_write_owner(M) Drop-in replacement for @c rw_pr_lock_assert_not_write_owner. */ #define mysql_prlock_assert_not_write_owner(M) \ rw_pr_lock_assert_not_write_owner(&(M)->m_prlock) /** @def mysql_mutex_register(P1, P2, P3) Mutex registration. */ #define mysql_mutex_register(P1, P2, P3) \ inline_mysql_mutex_register(P1, P2, P3) /** @def mysql_mutex_init(K, M, A) Instrumented mutex_init. @c mysql_mutex_init is a replacement for @c pthread_mutex_init. @param K The PSI_mutex_key for this instrumented mutex @param M The mutex to initialize @param A Mutex attributes */ #ifdef HAVE_PSI_MUTEX_INTERFACE #ifdef SAFE_MUTEX #define mysql_mutex_init(K, M, A) \ inline_mysql_mutex_init(K, M, A, __FILE__, __LINE__) #else #define mysql_mutex_init(K, M, A) \ inline_mysql_mutex_init(K, M, A) #endif #else #ifdef SAFE_MUTEX #define mysql_mutex_init(K, M, A) \ inline_mysql_mutex_init(M, A, __FILE__, __LINE__) #else #define mysql_mutex_init(K, M, A) \ inline_mysql_mutex_init(M, A) #endif #endif /** @def mysql_mutex_destroy(M) Instrumented mutex_destroy. @c mysql_mutex_destroy is a drop-in replacement for @c pthread_mutex_destroy. */ #ifdef SAFE_MUTEX #define mysql_mutex_destroy(M) \ inline_mysql_mutex_destroy(M, __FILE__, __LINE__) #else #define mysql_mutex_destroy(M) \ inline_mysql_mutex_destroy(M) #endif /** @def mysql_mutex_lock(M) Instrumented mutex_lock. @c mysql_mutex_lock is a drop-in replacement for @c pthread_mutex_lock. @param M The mutex to lock */ #if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE) #define mysql_mutex_lock(M) \ inline_mysql_mutex_lock(M, __FILE__, __LINE__) #else #define mysql_mutex_lock(M) \ inline_mysql_mutex_lock(M) #endif /** @def mysql_mutex_trylock(M) Instrumented mutex_lock. @c mysql_mutex_trylock is a drop-in replacement for @c my_mutex_trylock. */ #if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE) #define mysql_mutex_trylock(M) \ inline_mysql_mutex_trylock(M, __FILE__, __LINE__) #else #define mysql_mutex_trylock(M) \ inline_mysql_mutex_trylock(M) #endif /** @def mysql_mutex_unlock(M) Instrumented mutex_unlock. @c mysql_mutex_unlock is a drop-in replacement for @c pthread_mutex_unlock. */ #ifdef SAFE_MUTEX #define mysql_mutex_unlock(M) \ inline_mysql_mutex_unlock(M, __FILE__, __LINE__) #else #define mysql_mutex_unlock(M) \ inline_mysql_mutex_unlock(M) #endif /** @def mysql_rwlock_register(P1, P2, P3) Rwlock registration. */ #define mysql_rwlock_register(P1, P2, P3) \ inline_mysql_rwlock_register(P1, P2, P3) /** @def mysql_rwlock_init(K, RW) Instrumented rwlock_init. @c mysql_rwlock_init is a replacement for @c pthread_rwlock_init. Note that pthread_rwlockattr_t is not supported in MySQL. @param K The PSI_rwlock_key for this instrumented rwlock @param RW The rwlock to initialize */ #ifdef HAVE_PSI_RWLOCK_INTERFACE #define mysql_rwlock_init(K, RW) inline_mysql_rwlock_init(K, RW) #else #define mysql_rwlock_init(K, RW) inline_mysql_rwlock_init(RW) #endif /** @def mysql_prlock_init(K, RW) Instrumented rw_pr_init. @c mysql_prlock_init is a replacement for @c rw_pr_init. @param K The PSI_rwlock_key for this instrumented prlock @param RW The prlock to initialize */ #ifdef HAVE_PSI_RWLOCK_INTERFACE #define mysql_prlock_init(K, RW) inline_mysql_prlock_init(K, RW) #else #define mysql_prlock_init(K, RW) inline_mysql_prlock_init(RW) #endif /** @def mysql_rwlock_destroy(RW) Instrumented rwlock_destroy. @c mysql_rwlock_destroy is a drop-in replacement for @c pthread_rwlock_destroy. */ #define mysql_rwlock_destroy(RW) inline_mysql_rwlock_destroy(RW) /** @def mysql_prlock_destroy(RW) Instrumented rw_pr_destroy. @c mysql_prlock_destroy is a drop-in replacement for @c rw_pr_destroy. */ #define mysql_prlock_destroy(RW) inline_mysql_prlock_destroy(RW) /** @def mysql_rwlock_rdlock(RW) Instrumented rwlock_rdlock. @c mysql_rwlock_rdlock is a drop-in replacement for @c pthread_rwlock_rdlock. */ #ifdef HAVE_PSI_RWLOCK_INTERFACE #define mysql_rwlock_rdlock(RW) \ inline_mysql_rwlock_rdlock(RW, __FILE__, __LINE__) #else #define mysql_rwlock_rdlock(RW) \ inline_mysql_rwlock_rdlock(RW) #endif /** @def mysql_prlock_rdlock(RW) Instrumented rw_pr_rdlock. @c mysql_prlock_rdlock is a drop-in replacement for @c rw_pr_rdlock. */ #ifdef HAVE_PSI_RWLOCK_INTERFACE #define mysql_prlock_rdlock(RW) \ inline_mysql_prlock_rdlock(RW, __FILE__, __LINE__) #else #define mysql_prlock_rdlock(RW) \ inline_mysql_prlock_rdlock(RW) #endif /** @def mysql_rwlock_wrlock(RW) Instrumented rwlock_wrlock. @c mysql_rwlock_wrlock is a drop-in replacement for @c pthread_rwlock_wrlock. */ #ifdef HAVE_PSI_RWLOCK_INTERFACE #define mysql_rwlock_wrlock(RW) \ inline_mysql_rwlock_wrlock(RW, __FILE__, __LINE__) #else #define mysql_rwlock_wrlock(RW) \ inline_mysql_rwlock_wrlock(RW) #endif /** @def mysql_prlock_wrlock(RW) Instrumented rw_pr_wrlock. @c mysql_prlock_wrlock is a drop-in replacement for @c rw_pr_wrlock. */ #ifdef HAVE_PSI_RWLOCK_INTERFACE #define mysql_prlock_wrlock(RW) \ inline_mysql_prlock_wrlock(RW, __FILE__, __LINE__) #else #define mysql_prlock_wrlock(RW) \ inline_mysql_prlock_wrlock(RW) #endif /** @def mysql_rwlock_tryrdlock(RW) Instrumented rwlock_tryrdlock. @c mysql_rwlock_tryrdlock is a drop-in replacement for @c pthread_rwlock_tryrdlock. */ #ifdef HAVE_PSI_RWLOCK_INTERFACE #define mysql_rwlock_tryrdlock(RW) \ inline_mysql_rwlock_tryrdlock(RW, __FILE__, __LINE__) #else #define mysql_rwlock_tryrdlock(RW) \ inline_mysql_rwlock_tryrdlock(RW) #endif /** @def mysql_rwlock_trywrlock(RW) Instrumented rwlock_trywrlock. @c mysql_rwlock_trywrlock is a drop-in replacement for @c pthread_rwlock_trywrlock. */ #ifdef HAVE_PSI_RWLOCK_INTERFACE #define mysql_rwlock_trywrlock(RW) \ inline_mysql_rwlock_trywrlock(RW, __FILE__, __LINE__) #else #define mysql_rwlock_trywrlock(RW) \ inline_mysql_rwlock_trywrlock(RW) #endif /** @def mysql_rwlock_unlock(RW) Instrumented rwlock_unlock. @c mysql_rwlock_unlock is a drop-in replacement for @c pthread_rwlock_unlock. */ #define mysql_rwlock_unlock(RW) inline_mysql_rwlock_unlock(RW) /** @def mysql_prlock_unlock(RW) Instrumented rw_pr_unlock. @c mysql_prlock_unlock is a drop-in replacement for @c rw_pr_unlock. */ #define mysql_prlock_unlock(RW) inline_mysql_prlock_unlock(RW) /** @def mysql_cond_register(P1, P2, P3) Cond registration. */ #define mysql_cond_register(P1, P2, P3) \ inline_mysql_cond_register(P1, P2, P3) /** @def mysql_cond_init(K, C) Instrumented cond_init. @c mysql_cond_init is a replacement for @c pthread_cond_init. Note that pthread_condattr_t is not supported in MySQL. @param C The cond to initialize @param K The PSI_cond_key for this instrumented cond */ #ifdef HAVE_PSI_COND_INTERFACE #define mysql_cond_init(K, C) inline_mysql_cond_init(K, C) #else #define mysql_cond_init(K, C) inline_mysql_cond_init(C) #endif /** @def mysql_cond_destroy(C) Instrumented cond_destroy. @c mysql_cond_destroy is a drop-in replacement for @c pthread_cond_destroy. */ #define mysql_cond_destroy(C) inline_mysql_cond_destroy(C) /** @def mysql_cond_wait(C) Instrumented cond_wait. @c mysql_cond_wait is a drop-in replacement for @c native_cond_wait. */ #if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE) #define mysql_cond_wait(C, M) \ inline_mysql_cond_wait(C, M, __FILE__, __LINE__) #else #define mysql_cond_wait(C, M) \ inline_mysql_cond_wait(C, M) #endif /** @def mysql_cond_timedwait(C, M, W) Instrumented cond_timedwait. @c mysql_cond_timedwait is a drop-in replacement for @c native_cond_timedwait. */ #if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE) #define mysql_cond_timedwait(C, M, W) \ inline_mysql_cond_timedwait(C, M, W, __FILE__, __LINE__) #else #define mysql_cond_timedwait(C, M, W) \ inline_mysql_cond_timedwait(C, M, W) #endif /** @def mysql_cond_signal(C) Instrumented cond_signal. @c mysql_cond_signal is a drop-in replacement for @c pthread_cond_signal. */ #define mysql_cond_signal(C) inline_mysql_cond_signal(C) /** @def mysql_cond_broadcast(C) Instrumented cond_broadcast. @c mysql_cond_broadcast is a drop-in replacement for @c pthread_cond_broadcast. */ #define mysql_cond_broadcast(C) inline_mysql_cond_broadcast(C) /** @def mysql_thread_register(P1, P2, P3) Thread registration. */ #define mysql_thread_register(P1, P2, P3) \ inline_mysql_thread_register(P1, P2, P3) /** @def mysql_thread_create(K, P1, P2, P3, P4) Instrumented my_thread_create. This function creates both the thread instrumentation and a thread. @c mysql_thread_create is a replacement for @c my_thread_create. The parameter P4 (or, if it is NULL, P1) will be used as the instrumented thread "indentity". Providing a P1 / P4 parameter with a different value for each call will on average improve performances, since this thread identity value is used internally to randomize access to data and prevent contention. This is optional, and the improvement is not guaranteed, only statistical. @param K The PSI_thread_key for this instrumented thread @param P1 my_thread_create parameter 1 @param P2 my_thread_create parameter 2 @param P3 my_thread_create parameter 3 @param P4 my_thread_create parameter 4 */ #ifdef HAVE_PSI_THREAD_INTERFACE #define mysql_thread_create(K, P1, P2, P3, P4) \ inline_mysql_thread_create(K, P1, P2, P3, P4) #else #define mysql_thread_create(K, P1, P2, P3, P4) \ my_thread_create(P1, P2, P3, P4) #endif /** @def mysql_thread_set_psi_id(I) Set the thread identifier for the instrumentation. @param I The thread identifier */ #ifdef HAVE_PSI_THREAD_INTERFACE #define mysql_thread_set_psi_id(I) inline_mysql_thread_set_psi_id(I) #else #define mysql_thread_set_psi_id(I) do {} while (0) #endif /** @def mysql_thread_set_psi_THD(T) Set the thread sql session for the instrumentation. @param I The thread identifier */ #ifdef HAVE_PSI_THREAD_INTERFACE #define mysql_thread_set_psi_THD(T) inline_mysql_thread_set_psi_THD(T) #else #define mysql_thread_set_psi_THD(T) do {} while (0) #endif static inline void inline_mysql_mutex_register( #ifdef HAVE_PSI_MUTEX_INTERFACE const char *category, PSI_mutex_info *info, int count #else const char *category MY_ATTRIBUTE ((unused)), void *info MY_ATTRIBUTE ((unused)), int count MY_ATTRIBUTE ((unused)) #endif ) { #ifdef HAVE_PSI_MUTEX_INTERFACE PSI_MUTEX_CALL(register_mutex)(category, info, count); #endif } static inline int inline_mysql_mutex_init( #ifdef HAVE_PSI_MUTEX_INTERFACE PSI_mutex_key key, #endif mysql_mutex_t *that, const native_mutexattr_t *attr #ifdef SAFE_MUTEX , const char *src_file, uint src_line #endif ) { #ifdef HAVE_PSI_MUTEX_INTERFACE that->m_psi= PSI_MUTEX_CALL(init_mutex)(key, &that->m_mutex); #else that->m_psi= NULL; #endif return my_mutex_init(&that->m_mutex, attr #ifdef SAFE_MUTEX , src_file, src_line #endif ); } static inline int inline_mysql_mutex_destroy( mysql_mutex_t *that #ifdef SAFE_MUTEX , const char *src_file, uint src_line #endif ) { #ifdef HAVE_PSI_MUTEX_INTERFACE if (that->m_psi != NULL) { PSI_MUTEX_CALL(destroy_mutex)(that->m_psi); that->m_psi= NULL; } #endif return my_mutex_destroy(&that->m_mutex #ifdef SAFE_MUTEX , src_file, src_line #endif ); } static inline int inline_mysql_mutex_lock( mysql_mutex_t *that #if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE) , const char *src_file, uint src_line #endif ) { int result; #ifdef HAVE_PSI_MUTEX_INTERFACE if (that->m_psi != NULL) { /* Instrumentation start */ PSI_mutex_locker *locker; PSI_mutex_locker_state state; locker= PSI_MUTEX_CALL(start_mutex_wait)(&state, that->m_psi, PSI_MUTEX_LOCK, src_file, src_line); /* Instrumented code */ result= my_mutex_lock(&that->m_mutex #ifdef SAFE_MUTEX , src_file, src_line #endif ); /* Instrumentation end */ if (locker != NULL) PSI_MUTEX_CALL(end_mutex_wait)(locker, result); return result; } #endif /* Non instrumented code */ result= my_mutex_lock(&that->m_mutex #ifdef SAFE_MUTEX , src_file, src_line #endif ); return result; } static inline int inline_mysql_mutex_trylock( mysql_mutex_t *that #if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE) , const char *src_file, uint src_line #endif ) { int result; #ifdef HAVE_PSI_MUTEX_INTERFACE if (that->m_psi != NULL) { /* Instrumentation start */ PSI_mutex_locker *locker; PSI_mutex_locker_state state; locker= PSI_MUTEX_CALL(start_mutex_wait)(&state, that->m_psi, PSI_MUTEX_TRYLOCK, src_file, src_line); /* Instrumented code */ result= my_mutex_trylock(&that->m_mutex #ifdef SAFE_MUTEX , src_file, src_line #endif ); /* Instrumentation end */ if (locker != NULL) PSI_MUTEX_CALL(end_mutex_wait)(locker, result); return result; } #endif /* Non instrumented code */ result= my_mutex_trylock(&that->m_mutex #ifdef SAFE_MUTEX , src_file, src_line #endif ); return result; } static inline int inline_mysql_mutex_unlock( mysql_mutex_t *that #ifdef SAFE_MUTEX , const char *src_file, uint src_line #endif ) { int result; #ifdef HAVE_PSI_MUTEX_INTERFACE if (that->m_psi != NULL) PSI_MUTEX_CALL(unlock_mutex)(that->m_psi); #endif result= my_mutex_unlock(&that->m_mutex #ifdef SAFE_MUTEX , src_file, src_line #endif ); return result; } static inline void inline_mysql_rwlock_register( #ifdef HAVE_PSI_RWLOCK_INTERFACE const char *category, PSI_rwlock_info *info, int count #else const char *category MY_ATTRIBUTE ((unused)), void *info MY_ATTRIBUTE ((unused)), int count MY_ATTRIBUTE ((unused)) #endif ) { #ifdef HAVE_PSI_RWLOCK_INTERFACE PSI_RWLOCK_CALL(register_rwlock)(category, info, count); #endif } static inline int inline_mysql_rwlock_init( #ifdef HAVE_PSI_RWLOCK_INTERFACE PSI_rwlock_key key, #endif mysql_rwlock_t *that) { #ifdef HAVE_PSI_RWLOCK_INTERFACE that->m_psi= PSI_RWLOCK_CALL(init_rwlock)(key, &that->m_rwlock); #else that->m_psi= NULL; #endif return native_rw_init(&that->m_rwlock); } #ifndef DISABLE_MYSQL_PRLOCK_H static inline int inline_mysql_prlock_init( #ifdef HAVE_PSI_RWLOCK_INTERFACE PSI_rwlock_key key, #endif mysql_prlock_t *that) { #ifdef HAVE_PSI_RWLOCK_INTERFACE that->m_psi= PSI_RWLOCK_CALL(init_rwlock)(key, &that->m_prlock); #else that->m_psi= NULL; #endif return rw_pr_init(&that->m_prlock); } #endif static inline int inline_mysql_rwlock_destroy( mysql_rwlock_t *that) { #ifdef HAVE_PSI_RWLOCK_INTERFACE if (that->m_psi != NULL) { PSI_RWLOCK_CALL(destroy_rwlock)(that->m_psi); that->m_psi= NULL; } #endif return native_rw_destroy(&that->m_rwlock); } #ifndef DISABLE_MYSQL_PRLOCK_H static inline int inline_mysql_prlock_destroy( mysql_prlock_t *that) { #ifdef HAVE_PSI_RWLOCK_INTERFACE if (that->m_psi != NULL) { PSI_RWLOCK_CALL(destroy_rwlock)(that->m_psi); that->m_psi= NULL; } #endif return rw_pr_destroy(&that->m_prlock); } #endif static inline int inline_mysql_rwlock_rdlock( mysql_rwlock_t *that #ifdef HAVE_PSI_RWLOCK_INTERFACE , const char *src_file, uint src_line #endif ) { int result; #ifdef HAVE_PSI_RWLOCK_INTERFACE if (that->m_psi != NULL) { /* Instrumentation start */ PSI_rwlock_locker *locker; PSI_rwlock_locker_state state; locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi, PSI_RWLOCK_READLOCK, src_file, src_line); /* Instrumented code */ result= native_rw_rdlock(&that->m_rwlock); /* Instrumentation end */ if (locker != NULL) PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result); return result; } #endif /* Non instrumented code */ result= native_rw_rdlock(&that->m_rwlock); return result; } #ifndef DISABLE_MYSQL_PRLOCK_H static inline int inline_mysql_prlock_rdlock( mysql_prlock_t *that #ifdef HAVE_PSI_RWLOCK_INTERFACE , const char *src_file, uint src_line #endif ) { int result; #ifdef HAVE_PSI_RWLOCK_INTERFACE if (that->m_psi != NULL) { /* Instrumentation start */ PSI_rwlock_locker *locker; PSI_rwlock_locker_state state; locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi, PSI_RWLOCK_READLOCK, src_file, src_line); /* Instrumented code */ result= rw_pr_rdlock(&that->m_prlock); /* Instrumentation end */ if (locker != NULL) PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result); return result; } #endif /* Non instrumented code */ result= rw_pr_rdlock(&that->m_prlock); return result; } #endif static inline int inline_mysql_rwlock_wrlock( mysql_rwlock_t *that #ifdef HAVE_PSI_RWLOCK_INTERFACE , const char *src_file, uint src_line #endif ) { int result; #ifdef HAVE_PSI_RWLOCK_INTERFACE if (that->m_psi != NULL) { /* Instrumentation start */ PSI_rwlock_locker *locker; PSI_rwlock_locker_state state; locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi, PSI_RWLOCK_WRITELOCK, src_file, src_line); /* Instrumented code */ result= native_rw_wrlock(&that->m_rwlock); /* Instrumentation end */ if (locker != NULL) PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result); return result; } #endif /* Non instrumented code */ result= native_rw_wrlock(&that->m_rwlock); return result; } #ifndef DISABLE_MYSQL_PRLOCK_H static inline int inline_mysql_prlock_wrlock( mysql_prlock_t *that #ifdef HAVE_PSI_RWLOCK_INTERFACE , const char *src_file, uint src_line #endif ) { int result; #ifdef HAVE_PSI_RWLOCK_INTERFACE if (that->m_psi != NULL) { /* Instrumentation start */ PSI_rwlock_locker *locker; PSI_rwlock_locker_state state; locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi, PSI_RWLOCK_WRITELOCK, src_file, src_line); /* Instrumented code */ result= rw_pr_wrlock(&that->m_prlock); /* Instrumentation end */ if (locker != NULL) PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result); return result; } #endif /* Non instrumented code */ result= rw_pr_wrlock(&that->m_prlock); return result; } #endif static inline int inline_mysql_rwlock_tryrdlock( mysql_rwlock_t *that #ifdef HAVE_PSI_RWLOCK_INTERFACE , const char *src_file, uint src_line #endif ) { int result; #ifdef HAVE_PSI_RWLOCK_INTERFACE if (that->m_psi != NULL) { /* Instrumentation start */ PSI_rwlock_locker *locker; PSI_rwlock_locker_state state; locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi, PSI_RWLOCK_TRYREADLOCK, src_file, src_line); /* Instrumented code */ result= native_rw_tryrdlock(&that->m_rwlock); /* Instrumentation end */ if (locker != NULL) PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result); return result; } #endif /* Non instrumented code */ result= native_rw_tryrdlock(&that->m_rwlock); return result; } static inline int inline_mysql_rwlock_trywrlock( mysql_rwlock_t *that #ifdef HAVE_PSI_RWLOCK_INTERFACE , const char *src_file, uint src_line #endif ) { int result; #ifdef HAVE_PSI_RWLOCK_INTERFACE if (that->m_psi != NULL) { /* Instrumentation start */ PSI_rwlock_locker *locker; PSI_rwlock_locker_state state; locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi, PSI_RWLOCK_TRYWRITELOCK, src_file, src_line); /* Instrumented code */ result= native_rw_trywrlock(&that->m_rwlock); /* Instrumentation end */ if (locker != NULL) PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result); return result; } #endif /* Non instrumented code */ result= native_rw_trywrlock(&that->m_rwlock); return result; } static inline int inline_mysql_rwlock_unlock( mysql_rwlock_t *that) { int result; #ifdef HAVE_PSI_RWLOCK_INTERFACE if (that->m_psi != NULL) PSI_RWLOCK_CALL(unlock_rwlock)(that->m_psi); #endif result= native_rw_unlock(&that->m_rwlock); return result; } #ifndef DISABLE_MYSQL_PRLOCK_H static inline int inline_mysql_prlock_unlock( mysql_prlock_t *that) { int result; #ifdef HAVE_PSI_RWLOCK_INTERFACE if (that->m_psi != NULL) PSI_RWLOCK_CALL(unlock_rwlock)(that->m_psi); #endif result= rw_pr_unlock(&that->m_prlock); return result; } #endif static inline void inline_mysql_cond_register( #ifdef HAVE_PSI_COND_INTERFACE const char *category, PSI_cond_info *info, int count #else const char *category MY_ATTRIBUTE ((unused)), void *info MY_ATTRIBUTE ((unused)), int count MY_ATTRIBUTE ((unused)) #endif ) { #ifdef HAVE_PSI_COND_INTERFACE PSI_COND_CALL(register_cond)(category, info, count); #endif } static inline int inline_mysql_cond_init( #ifdef HAVE_PSI_COND_INTERFACE PSI_cond_key key, #endif mysql_cond_t *that) { #ifdef HAVE_PSI_COND_INTERFACE that->m_psi= PSI_COND_CALL(init_cond)(key, &that->m_cond); #else that->m_psi= NULL; #endif return native_cond_init(&that->m_cond); } static inline int inline_mysql_cond_destroy( mysql_cond_t *that) { #ifdef HAVE_PSI_COND_INTERFACE if (that->m_psi != NULL) { PSI_COND_CALL(destroy_cond)(that->m_psi); that->m_psi= NULL; } #endif return native_cond_destroy(&that->m_cond); } static inline int inline_mysql_cond_wait( mysql_cond_t *that, mysql_mutex_t *mutex #if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE) , const char *src_file, uint src_line #endif ) { int result; #ifdef HAVE_PSI_COND_INTERFACE if (that->m_psi != NULL) { /* Instrumentation start */ PSI_cond_locker *locker; PSI_cond_locker_state state; locker= PSI_COND_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi, PSI_COND_WAIT, src_file, src_line); /* Instrumented code */ result= my_cond_wait(&that->m_cond, &mutex->m_mutex #ifdef SAFE_MUTEX , src_file, src_line #endif ); /* Instrumentation end */ if (locker != NULL) PSI_COND_CALL(end_cond_wait)(locker, result); return result; } #endif /* Non instrumented code */ result= my_cond_wait(&that->m_cond, &mutex->m_mutex #ifdef SAFE_MUTEX , src_file, src_line #endif ); return result; } static inline int inline_mysql_cond_timedwait( mysql_cond_t *that, mysql_mutex_t *mutex, const struct timespec *abstime #if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE) , const char *src_file, uint src_line #endif ) { int result; #ifdef HAVE_PSI_COND_INTERFACE if (that->m_psi != NULL) { /* Instrumentation start */ PSI_cond_locker *locker; PSI_cond_locker_state state; locker= PSI_COND_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi, PSI_COND_TIMEDWAIT, src_file, src_line); /* Instrumented code */ result= my_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime #ifdef SAFE_MUTEX , src_file, src_line #endif ); /* Instrumentation end */ if (locker != NULL) PSI_COND_CALL(end_cond_wait)(locker, result); return result; } #endif /* Non instrumented code */ result= my_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime #ifdef SAFE_MUTEX , src_file, src_line #endif ); return result; } static inline int inline_mysql_cond_signal( mysql_cond_t *that) { int result; #ifdef HAVE_PSI_COND_INTERFACE if (that->m_psi != NULL) PSI_COND_CALL(signal_cond)(that->m_psi); #endif result= native_cond_signal(&that->m_cond); return result; } static inline int inline_mysql_cond_broadcast( mysql_cond_t *that) { int result; #ifdef HAVE_PSI_COND_INTERFACE if (that->m_psi != NULL) PSI_COND_CALL(broadcast_cond)(that->m_psi); #endif result= native_cond_broadcast(&that->m_cond); return result; } static inline void inline_mysql_thread_register( #ifdef HAVE_PSI_THREAD_INTERFACE const char *category, PSI_thread_info *info, int count #else const char *category MY_ATTRIBUTE ((unused)), void *info MY_ATTRIBUTE ((unused)), int count MY_ATTRIBUTE ((unused)) #endif ) { #ifdef HAVE_PSI_THREAD_INTERFACE PSI_THREAD_CALL(register_thread)(category, info, count); #endif } #ifdef HAVE_PSI_THREAD_INTERFACE static inline int inline_mysql_thread_create( PSI_thread_key key, my_thread_handle *thread, const my_thread_attr_t *attr, my_start_routine start_routine, void *arg) { int result; result= PSI_THREAD_CALL(spawn_thread)(key, thread, attr, start_routine, arg); return result; } static inline void inline_mysql_thread_set_psi_id(my_thread_id id) { struct PSI_thread *psi= PSI_THREAD_CALL(get_thread)(); PSI_THREAD_CALL(set_thread_id)(psi, id); } #ifdef __cplusplus class THD; static inline void inline_mysql_thread_set_psi_THD(THD *thd) { struct PSI_thread *psi= PSI_THREAD_CALL(get_thread)(); PSI_THREAD_CALL(set_thread_THD)(psi, thd); } #endif /* __cplusplus */ #endif #endif /* DISABLE_MYSQL_THREAD_H */ /** @} (end of group Thread_instrumentation) */ #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/psi/mysql_file.h������������������������������������������������������������������������0000644�����������������00000117242�14763166026�0012210 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. 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; version 2 of the License. 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, 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef MYSQL_FILE_H #define MYSQL_FILE_H #include <my_global.h> /* For strlen() */ #include <string.h> /* For MY_STAT */ #include <my_dir.h> /* For my_chsize */ #include <my_sys.h> /** @file mysql/psi/mysql_file.h Instrumentation helpers for mysys file io. This header file provides the necessary declarations to use the mysys file API with the performance schema instrumentation. In some compilers (SunStudio), 'static inline' functions, when declared but not used, are not optimized away (because they are unused) by default, so that including a static inline function from a header file does create unwanted dependencies, causing unresolved symbols at link time. Other compilers, like gcc, optimize these dependencies by default. Since the instrumented APIs declared here are wrapper on top of mysys file io APIs, including mysql/psi/mysql_file.h assumes that the dependency on my_sys already exists. */ #include "mysql/psi/psi.h" #ifndef PSI_FILE_CALL #define PSI_FILE_CALL(M) PSI_DYNAMIC_CALL(M) #endif /** @defgroup File_instrumentation File Instrumentation @ingroup Instrumentation_interface @{ */ /** @def mysql_file_register(P1, P2, P3) File registration. */ #define mysql_file_register(P1, P2, P3) \ inline_mysql_file_register(P1, P2, P3) /** @def mysql_file_fgets(P1, P2, F) Instrumented fgets. @c mysql_file_fgets is a replacement for @c fgets. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_fgets(P1, P2, F) \ inline_mysql_file_fgets(__FILE__, __LINE__, P1, P2, F) #else #define mysql_file_fgets(P1, P2, F) \ inline_mysql_file_fgets(P1, P2, F) #endif /** @def mysql_file_fgetc(F) Instrumented fgetc. @c mysql_file_fgetc is a replacement for @c fgetc. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_fgetc(F) inline_mysql_file_fgetc(__FILE__, __LINE__, F) #else #define mysql_file_fgetc(F) inline_mysql_file_fgetc(F) #endif /** @def mysql_file_fputs(P1, F) Instrumented fputs. @c mysql_file_fputs is a replacement for @c fputs. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_fputs(P1, F) \ inline_mysql_file_fputs(__FILE__, __LINE__, P1, F) #else #define mysql_file_fputs(P1, F)\ inline_mysql_file_fputs(P1, F) #endif /** @def mysql_file_fputc(P1, F) Instrumented fputc. @c mysql_file_fputc is a replacement for @c fputc. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_fputc(P1, F) \ inline_mysql_file_fputc(__FILE__, __LINE__, P1, F) #else #define mysql_file_fputc(P1, F) \ inline_mysql_file_fputc(P1, F) #endif /** @def mysql_file_fprintf Instrumented fprintf. @c mysql_file_fprintf is a replacement for @c fprintf. */ #define mysql_file_fprintf inline_mysql_file_fprintf /** @def mysql_file_vfprintf(F, P1, P2) Instrumented vfprintf. @c mysql_file_vfprintf is a replacement for @c vfprintf. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_vfprintf(F, P1, P2) \ inline_mysql_file_vfprintf(__FILE__, __LINE__, F, P1, P2) #else #define mysql_file_vfprintf(F, P1, P2) \ inline_mysql_file_vfprintf(F, P1, P2) #endif /** @def mysql_file_fflush(F, P1, P2) Instrumented fflush. @c mysql_file_fflush is a replacement for @c fflush. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_fflush(F) \ inline_mysql_file_fflush(__FILE__, __LINE__, F) #else #define mysql_file_fflush(F) \ inline_mysql_file_fflush(F) #endif /** @def mysql_file_feof(F) Instrumented feof. @c mysql_file_feof is a replacement for @c feof. */ #define mysql_file_feof(F) inline_mysql_file_feof(F) /** @def mysql_file_fstat(FN, S, FL) Instrumented fstat. @c mysql_file_fstat is a replacement for @c my_fstat. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_fstat(FN, S, FL) \ inline_mysql_file_fstat(__FILE__, __LINE__, FN, S, FL) #else #define mysql_file_fstat(FN, S, FL) \ inline_mysql_file_fstat(FN, S, FL) #endif /** @def mysql_file_stat(K, FN, S, FL) Instrumented stat. @c mysql_file_stat is a replacement for @c my_stat. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_stat(K, FN, S, FL) \ inline_mysql_file_stat(K, __FILE__, __LINE__, FN, S, FL) #else #define mysql_file_stat(K, FN, S, FL) \ inline_mysql_file_stat(FN, S, FL) #endif /** @def mysql_file_chsize(F, P1, P2, P3) Instrumented chsize. @c mysql_file_chsize is a replacement for @c my_chsize. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_chsize(F, P1, P2, P3) \ inline_mysql_file_chsize(__FILE__, __LINE__, F, P1, P2, P3) #else #define mysql_file_chsize(F, P1, P2, P3) \ inline_mysql_file_chsize(F, P1, P2, P3) #endif /** @def mysql_file_fopen(K, N, F1, F2) Instrumented fopen. @c mysql_file_fopen is a replacement for @c my_fopen. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_fopen(K, N, F1, F2) \ inline_mysql_file_fopen(K, __FILE__, __LINE__, N, F1, F2) #else #define mysql_file_fopen(K, N, F1, F2) \ inline_mysql_file_fopen(N, F1, F2) #endif /** @def mysql_file_fclose(FD, FL) Instrumented fclose. @c mysql_file_fclose is a replacement for @c my_fclose. Without the instrumentation, this call will have the same behavior as the undocumented and possibly platform specific my_fclose(NULL, ...) behavior. With the instrumentation, mysql_fclose(NULL, ...) will safely return 0, which is an extension compared to my_fclose and is therefore compliant. mysql_fclose is on purpose *not* implementing @code DBUG_ASSERT(file != NULL) @endcode, since doing so could introduce regressions. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_fclose(FD, FL) \ inline_mysql_file_fclose(__FILE__, __LINE__, FD, FL) #else #define mysql_file_fclose(FD, FL) \ inline_mysql_file_fclose(FD, FL) #endif /** @def mysql_file_fread(FD, P1, P2, P3) Instrumented fread. @c mysql_file_fread is a replacement for @c my_fread. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_fread(FD, P1, P2, P3) \ inline_mysql_file_fread(__FILE__, __LINE__, FD, P1, P2, P3) #else #define mysql_file_fread(FD, P1, P2, P3) \ inline_mysql_file_fread(FD, P1, P2, P3) #endif /** @def mysql_file_fwrite(FD, P1, P2, P3) Instrumented fwrite. @c mysql_file_fwrite is a replacement for @c my_fwrite. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_fwrite(FD, P1, P2, P3) \ inline_mysql_file_fwrite(__FILE__, __LINE__, FD, P1, P2, P3) #else #define mysql_file_fwrite(FD, P1, P2, P3) \ inline_mysql_file_fwrite(FD, P1, P2, P3) #endif /** @def mysql_file_fseek(FD, P, W, F) Instrumented fseek. @c mysql_file_fseek is a replacement for @c my_fseek. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_fseek(FD, P, W, F) \ inline_mysql_file_fseek(__FILE__, __LINE__, FD, P, W, F) #else #define mysql_file_fseek(FD, P, W, F) \ inline_mysql_file_fseek(FD, P, W, F) #endif /** @def mysql_file_ftell(FD, F) Instrumented ftell. @c mysql_file_ftell is a replacement for @c my_ftell. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_ftell(FD, F) \ inline_mysql_file_ftell(__FILE__, __LINE__, FD, F) #else #define mysql_file_ftell(FD, F) \ inline_mysql_file_ftell(FD, F) #endif /** @def mysql_file_create(K, N, F1, F2, F3) Instrumented create. @c mysql_file_create is a replacement for @c my_create. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_create(K, N, F1, F2, F3) \ inline_mysql_file_create(K, __FILE__, __LINE__, N, F1, F2, F3) #else #define mysql_file_create(K, N, F1, F2, F3) \ inline_mysql_file_create(N, F1, F2, F3) #endif /** @def mysql_file_create_temp(K, T, D, P, M, F) Instrumented create_temp_file. @c mysql_file_create_temp is a replacement for @c create_temp_file. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_create_temp(K, T, D, P, M, F) \ inline_mysql_file_create_temp(K, __FILE__, __LINE__, T, D, P, M, F) #else #define mysql_file_create_temp(K, T, D, P, M, F) \ inline_mysql_file_create_temp(T, D, P, M, F) #endif /** @def mysql_file_open(K, N, F1, F2) Instrumented open. @c mysql_file_open is a replacement for @c my_open. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_open(K, N, F1, F2) \ inline_mysql_file_open(K, __FILE__, __LINE__, N, F1, F2) #else #define mysql_file_open(K, N, F1, F2) \ inline_mysql_file_open(N, F1, F2) #endif /** @def mysql_unix_socket_connect(K, N, F) Instrumented open. @c mysql_unix_socket_connect connects to the unix domain socket. */ #ifndef __WIN__ #ifdef HAVE_PSI_INTERFACE #define mysql_unix_socket_connect(K, N, F) \ inline_mysql_unix_socket_connect(K, __FILE__, __LINE__, N, F) #else #define mysql_unix_socket_connect(K, N, F) \ inline_mysql_unix_socket_connect(N, F) #endif #endif /** @def mysql_file_close(FD, F) Instrumented close. @c mysql_file_close is a replacement for @c my_close. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_close(FD, F) \ inline_mysql_file_close(__FILE__, __LINE__, FD, F) #else #define mysql_file_close(FD, F) \ inline_mysql_file_close(FD, F) #endif /** @def mysql_file_read(FD, B, S, F) Instrumented read. @c mysql_read is a replacement for @c my_read. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_read(FD, B, S, F) \ inline_mysql_file_read(__FILE__, __LINE__, FD, B, S, F) #else #define mysql_file_read(FD, B, S, F) \ inline_mysql_file_read(FD, B, S, F) #endif /** @def mysql_file_write(FD, B, S, F) Instrumented write. @c mysql_file_write is a replacement for @c my_write. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_write(FD, B, S, F) \ inline_mysql_file_write(__FILE__, __LINE__, FD, B, S, F) #else #define mysql_file_write(FD, B, S, F) \ inline_mysql_file_write(FD, B, S, F) #endif /** @def mysql_file_pread(FD, B, S, O, F) Instrumented pread. @c mysql_pread is a replacement for @c my_pread. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_pread(FD, B, S, O, F) \ inline_mysql_file_pread(__FILE__, __LINE__, FD, B, S, O, F) #else #define mysql_file_pread(FD, B, S, O, F) \ inline_mysql_file_pread(FD, B, S, O, F) #endif /** @def mysql_file_pwrite(FD, B, S, O, F) Instrumented pwrite. @c mysql_file_pwrite is a replacement for @c my_pwrite. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_pwrite(FD, B, S, O, F) \ inline_mysql_file_pwrite(__FILE__, __LINE__, FD, B, S, O, F) #else #define mysql_file_pwrite(FD, B, S, O, F) \ inline_mysql_file_pwrite(FD, B, S, O, F) #endif /** @def mysql_file_seek(FD, P, W, F) Instrumented seek. @c mysql_file_seek is a replacement for @c my_seek. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_seek(FD, P, W, F) \ inline_mysql_file_seek(__FILE__, __LINE__, FD, P, W, F) #else #define mysql_file_seek(FD, P, W, F) \ inline_mysql_file_seek(FD, P, W, F) #endif /** @def mysql_file_tell(FD, F) Instrumented tell. @c mysql_file_tell is a replacement for @c my_tell. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_tell(FD, F) \ inline_mysql_file_tell(__FILE__, __LINE__, FD, F) #else #define mysql_file_tell(FD, F) \ inline_mysql_file_tell(FD, F) #endif /** @def mysql_file_delete(K, P1, P2) Instrumented delete. @c mysql_file_delete is a replacement for @c my_delete. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_delete(K, P1, P2) \ inline_mysql_file_delete(K, __FILE__, __LINE__, P1, P2) #else #define mysql_file_delete(K, P1, P2) \ inline_mysql_file_delete(P1, P2) #endif /** @def mysql_file_rename(K, P1, P2, P3) Instrumented rename. @c mysql_file_rename is a replacement for @c my_rename. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_rename(K, P1, P2, P3) \ inline_mysql_file_rename(K, __FILE__, __LINE__, P1, P2, P3) #else #define mysql_file_rename(K, P1, P2, P3) \ inline_mysql_file_rename(P1, P2, P3) #endif /** @def mysql_file_create_with_symlink(K, P1, P2, P3, P4, P5) Instrumented create with symbolic link. @c mysql_file_create_with_symlink is a replacement for @c my_create_with_symlink. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_create_with_symlink(K, P1, P2, P3, P4, P5) \ inline_mysql_file_create_with_symlink(K, __FILE__, __LINE__, \ P1, P2, P3, P4, P5) #else #define mysql_file_create_with_symlink(K, P1, P2, P3, P4, P5) \ inline_mysql_file_create_with_symlink(P1, P2, P3, P4, P5) #endif /** @def mysql_file_delete_with_symlink(K, P1, P2) Instrumented delete with symbolic link. @c mysql_file_delete_with_symlink is a replacement for @c my_delete_with_symlink. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_delete_with_symlink(K, P1, P2) \ inline_mysql_file_delete_with_symlink(K, __FILE__, __LINE__, P1, P2) #else #define mysql_file_delete_with_symlink(K, P1, P2) \ inline_mysql_file_delete_with_symlink(P1, P2) #endif /** @def mysql_file_rename_with_symlink(K, P1, P2, P3) Instrumented rename with symbolic link. @c mysql_file_rename_with_symlink is a replacement for @c my_rename_with_symlink. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_rename_with_symlink(K, P1, P2, P3) \ inline_mysql_file_rename_with_symlink(K, __FILE__, __LINE__, P1, P2, P3) #else #define mysql_file_rename_with_symlink(K, P1, P2, P3) \ inline_mysql_file_rename_with_symlink(P1, P2, P3) #endif /** @def mysql_file_sync(P1, P2) Instrumented file sync. @c mysql_file_sync is a replacement for @c my_sync. */ #ifdef HAVE_PSI_FILE_INTERFACE #define mysql_file_sync(P1, P2) \ inline_mysql_file_sync(__FILE__, __LINE__, P1, P2) #else #define mysql_file_sync(P1, P2) \ inline_mysql_file_sync(P1, P2) #endif /** An instrumented FILE structure. @sa MYSQL_FILE */ struct st_mysql_file { /** The real file. */ FILE *m_file; /** The instrumentation hook. Note that this hook is not conditionally defined, for binary compatibility of the @c MYSQL_FILE interface. */ struct PSI_file *m_psi; }; /** Type of an instrumented file. @c MYSQL_FILE is a drop-in replacement for @c FILE. @sa mysql_file_open */ typedef struct st_mysql_file MYSQL_FILE; static inline void inline_mysql_file_register( #ifdef HAVE_PSI_FILE_INTERFACE const char *category, PSI_file_info *info, int count #else const char *category MY_ATTRIBUTE ((unused)), void *info MY_ATTRIBUTE ((unused)), int count MY_ATTRIBUTE ((unused)) #endif ) { #ifdef HAVE_PSI_FILE_INTERFACE PSI_FILE_CALL(register_file)(category, info, count); #endif } static inline char * inline_mysql_file_fgets( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif char *str, int size, MYSQL_FILE *file) { char *result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_stream_locker) (&state, file->m_psi, PSI_FILE_READ); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, (size_t) size, src_file, src_line); result= fgets(str, size, file->m_file); PSI_FILE_CALL(end_file_wait)(locker, result ? strlen(result) : 0); return result; } #endif result= fgets(str, size, file->m_file); return result; } static inline int inline_mysql_file_fgetc( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif MYSQL_FILE *file) { int result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_stream_locker) (&state, file->m_psi, PSI_FILE_READ); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line); result= fgetc(file->m_file); PSI_FILE_CALL(end_file_wait)(locker, (size_t) 1); return result; } #endif result= fgetc(file->m_file); return result; } static inline int inline_mysql_file_fputs( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif const char *str, MYSQL_FILE *file) { int result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; size_t bytes; locker= PSI_FILE_CALL(get_thread_file_stream_locker) (&state, file->m_psi, PSI_FILE_WRITE); if (likely(locker != NULL)) { bytes= str ? strlen(str) : 0; PSI_FILE_CALL(start_file_wait)(locker, bytes, src_file, src_line); result= fputs(str, file->m_file); PSI_FILE_CALL(end_file_wait)(locker, bytes); return result; } #endif result= fputs(str, file->m_file); return result; } static inline int inline_mysql_file_fputc( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif char c, MYSQL_FILE *file) { int result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_stream_locker) (&state, file->m_psi, PSI_FILE_WRITE); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line); result= fputc(c, file->m_file); PSI_FILE_CALL(end_file_wait)(locker, (size_t) 1); return result; } #endif result= fputc(c, file->m_file); return result; } static inline int inline_mysql_file_fprintf(MYSQL_FILE *file, const char *format, ...) { /* TODO: figure out how to pass src_file and src_line from the caller. */ int result; va_list args; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_stream_locker) (&state, file->m_psi, PSI_FILE_WRITE); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, __FILE__, __LINE__); va_start(args, format); result= vfprintf(file->m_file, format, args); va_end(args); PSI_FILE_CALL(end_file_wait)(locker, (size_t) result); return result; } #endif va_start(args, format); result= vfprintf(file->m_file, format, args); va_end(args); return result; } static inline int inline_mysql_file_vfprintf( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif MYSQL_FILE *file, const char *format, va_list args) { int result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_stream_locker) (&state, file->m_psi, PSI_FILE_WRITE); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); result= vfprintf(file->m_file, format, args); PSI_FILE_CALL(end_file_wait)(locker, (size_t) result); return result; } #endif result= vfprintf(file->m_file, format, args); return result; } static inline int inline_mysql_file_fflush( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif MYSQL_FILE *file) { int result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_stream_locker) (&state, file->m_psi, PSI_FILE_FLUSH); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); result= fflush(file->m_file); PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); return result; } #endif result= fflush(file->m_file); return result; } static inline int inline_mysql_file_feof(MYSQL_FILE *file) { /* Not instrumented, there is no wait involved */ return feof(file->m_file); } static inline int inline_mysql_file_fstat( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif int filenr, MY_STAT *stat_area, myf flags) { int result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) (&state, filenr, PSI_FILE_FSTAT); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); result= my_fstat(filenr, stat_area, flags); PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); return result; } #endif result= my_fstat(filenr, stat_area, flags); return result; } static inline MY_STAT * inline_mysql_file_stat( #ifdef HAVE_PSI_FILE_INTERFACE PSI_file_key key, const char *src_file, uint src_line, #endif const char *path, MY_STAT *stat_area, myf flags) { MY_STAT *result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_name_locker) (&state, key, PSI_FILE_STAT, path, &locker); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line); result= my_stat(path, stat_area, flags); PSI_FILE_CALL(end_file_open_wait)(locker, result); return result; } #endif result= my_stat(path, stat_area, flags); return result; } static inline int inline_mysql_file_chsize( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif File file, my_off_t newlength, int filler, myf flags) { int result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) (&state, file, PSI_FILE_CHSIZE); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, (size_t) newlength, src_file, src_line); result= my_chsize(file, newlength, filler, flags); PSI_FILE_CALL(end_file_wait)(locker, (size_t) newlength); return result; } #endif result= my_chsize(file, newlength, filler, flags); return result; } static inline MYSQL_FILE* inline_mysql_file_fopen( #ifdef HAVE_PSI_FILE_INTERFACE PSI_file_key key, const char *src_file, uint src_line, #endif const char *filename, int flags, myf myFlags) { MYSQL_FILE *that; that= (MYSQL_FILE*) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(MYSQL_FILE), MYF(MY_WME)); if (likely(that != NULL)) { #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_name_locker) (&state, key, PSI_FILE_STREAM_OPEN, filename, that); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_open_wait) (locker, src_file, src_line); that->m_file= my_fopen(filename, flags, myFlags); that->m_psi= PSI_FILE_CALL(end_file_open_wait)(locker, that->m_file); if (unlikely(that->m_file == NULL)) { my_free(that); return NULL; } return that; } #endif that->m_psi= NULL; that->m_file= my_fopen(filename, flags, myFlags); if (unlikely(that->m_file == NULL)) { my_free(that); return NULL; } } return that; } static inline int inline_mysql_file_fclose( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif MYSQL_FILE *file, myf flags) { int result= 0; if (likely(file != NULL)) { #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_stream_locker) (&state, file->m_psi, PSI_FILE_STREAM_CLOSE); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line); result= my_fclose(file->m_file, flags); PSI_FILE_CALL(end_file_close_wait)(locker, result); my_free(file); return result; } #endif result= my_fclose(file->m_file, flags); my_free(file); } return result; } static inline size_t inline_mysql_file_fread( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif MYSQL_FILE *file, uchar *buffer, size_t count, myf flags) { size_t result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; size_t bytes_read; locker= PSI_FILE_CALL(get_thread_file_stream_locker) (&state, file->m_psi, PSI_FILE_READ); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line); result= my_fread(file->m_file, buffer, count, flags); if (flags & (MY_NABP | MY_FNABP)) bytes_read= (result == 0) ? count : 0; else bytes_read= (result != MY_FILE_ERROR) ? result : 0; PSI_FILE_CALL(end_file_wait)(locker, bytes_read); return result; } #endif result= my_fread(file->m_file, buffer, count, flags); return result; } static inline size_t inline_mysql_file_fwrite( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif MYSQL_FILE *file, const uchar *buffer, size_t count, myf flags) { size_t result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; size_t bytes_written; locker= PSI_FILE_CALL(get_thread_file_stream_locker) (&state, file->m_psi, PSI_FILE_WRITE); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line); result= my_fwrite(file->m_file, buffer, count, flags); if (flags & (MY_NABP | MY_FNABP)) bytes_written= (result == 0) ? count : 0; else bytes_written= (result != MY_FILE_ERROR) ? result : 0; PSI_FILE_CALL(end_file_wait)(locker, bytes_written); return result; } #endif result= my_fwrite(file->m_file, buffer, count, flags); return result; } static inline my_off_t inline_mysql_file_fseek( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif MYSQL_FILE *file, my_off_t pos, int whence, myf flags) { my_off_t result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_stream_locker) (&state, file->m_psi, PSI_FILE_SEEK); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); result= my_fseek(file->m_file, pos, whence, flags); PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); return result; } #endif result= my_fseek(file->m_file, pos, whence, flags); return result; } static inline my_off_t inline_mysql_file_ftell( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif MYSQL_FILE *file, myf flags) { my_off_t result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_stream_locker) (&state, file->m_psi, PSI_FILE_TELL); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); result= my_ftell(file->m_file, flags); PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); return result; } #endif result= my_ftell(file->m_file, flags); return result; } static inline File inline_mysql_file_create( #ifdef HAVE_PSI_FILE_INTERFACE PSI_file_key key, const char *src_file, uint src_line, #endif const char *filename, int create_flags, int access_flags, myf myFlags) { File file; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_name_locker) (&state, key, PSI_FILE_CREATE, filename, &locker); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line); file= my_create(filename, create_flags, access_flags, myFlags); PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file); return file; } #endif file= my_create(filename, create_flags, access_flags, myFlags); return file; } static inline File inline_mysql_file_create_temp( #ifdef HAVE_PSI_FILE_INTERFACE PSI_file_key key, const char *src_file, uint src_line, #endif char *to, const char *dir, const char *pfx, int mode, myf myFlags) { File file; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_name_locker) (&state, key, PSI_FILE_CREATE, NULL, &locker); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line); /* The file name is generated by create_temp_file(). */ file= create_temp_file(to, dir, pfx, mode, myFlags); PSI_FILE_CALL(end_temp_file_open_wait_and_bind_to_descriptor)(locker, file, (const char*)to); return file; } #endif file= create_temp_file(to, dir, pfx, mode, myFlags); return file; } static inline File inline_mysql_file_open( #ifdef HAVE_PSI_FILE_INTERFACE PSI_file_key key, const char *src_file, uint src_line, #endif const char *filename, int flags, myf myFlags) { File file; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_name_locker) (&state, key, PSI_FILE_OPEN, filename, &locker); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line); file= my_open(filename, flags, myFlags); PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file); return file; } #endif file= my_open(filename, flags, myFlags); return file; } #ifndef __WIN__ static inline File inline_mysql_unix_socket_connect( #ifdef HAVE_PSI_INTERFACE PSI_file_key key, const char *src_file, uint src_line, #endif const char *filename, myf myFlags) { File file; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; PSI_file_locker_state state; if (likely(PSI_server != NULL)) { locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_OPEN, filename, &locker); if (likely(locker != NULL)) PSI_server->start_file_open_wait(locker, src_file, src_line); } #endif file = my_unix_socket_connect(filename, myFlags); #ifdef HAVE_PSI_INTERFACE if (likely(locker != NULL)) PSI_server->end_file_open_wait_and_bind_to_descriptor(locker, file); #endif return file; } #endif static inline int inline_mysql_file_close( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif File file, myf flags) { int result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) (&state, file, PSI_FILE_CLOSE); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line); result= my_close(file, flags); PSI_FILE_CALL(end_file_close_wait)(locker, result); return result; } #endif result= my_close(file, flags); return result; } static inline size_t inline_mysql_file_read( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif File file, uchar *buffer, size_t count, myf flags) { size_t result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; size_t bytes_read; locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) (&state, file, PSI_FILE_READ); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line); result= my_read(file, buffer, count, flags); if (flags & (MY_NABP | MY_FNABP)) bytes_read= (result == 0) ? count : 0; else bytes_read= (result != MY_FILE_ERROR) ? result : 0; PSI_FILE_CALL(end_file_wait)(locker, bytes_read); return result; } #endif result= my_read(file, buffer, count, flags); return result; } static inline size_t inline_mysql_file_write( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif File file, const uchar *buffer, size_t count, myf flags) { size_t result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; size_t bytes_written; locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) (&state, file, PSI_FILE_WRITE); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line); result= my_write(file, buffer, count, flags); if (flags & (MY_NABP | MY_FNABP)) bytes_written= (result == 0) ? count : 0; else bytes_written= (result != MY_FILE_ERROR) ? result : 0; PSI_FILE_CALL(end_file_wait)(locker, bytes_written); return result; } #endif result= my_write(file, buffer, count, flags); return result; } static inline size_t inline_mysql_file_pread( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif File file, uchar *buffer, size_t count, my_off_t offset, myf flags) { size_t result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; size_t bytes_read; locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) (&state, file, PSI_FILE_READ); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line); result= my_pread(file, buffer, count, offset, flags); if (flags & (MY_NABP | MY_FNABP)) bytes_read= (result == 0) ? count : 0; else bytes_read= (result != MY_FILE_ERROR) ? result : 0; PSI_FILE_CALL(end_file_wait)(locker, bytes_read); return result; } #endif result= my_pread(file, buffer, count, offset, flags); return result; } static inline size_t inline_mysql_file_pwrite( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif File file, const uchar *buffer, size_t count, my_off_t offset, myf flags) { size_t result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; size_t bytes_written; locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) (&state, file, PSI_FILE_WRITE); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line); result= my_pwrite(file, buffer, count, offset, flags); if (flags & (MY_NABP | MY_FNABP)) bytes_written= (result == 0) ? count : 0; else bytes_written= (result != MY_FILE_ERROR) ? result : 0; PSI_FILE_CALL(end_file_wait)(locker, bytes_written); return result; } #endif result= my_pwrite(file, buffer, count, offset, flags); return result; } static inline my_off_t inline_mysql_file_seek( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif File file, my_off_t pos, int whence, myf flags) { my_off_t result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) (&state, file, PSI_FILE_SEEK); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); result= my_seek(file, pos, whence, flags); PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); return result; } #endif result= my_seek(file, pos, whence, flags); return result; } static inline my_off_t inline_mysql_file_tell( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif File file, myf flags) { my_off_t result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) (&state, file, PSI_FILE_TELL); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); result= my_tell(file, flags); PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); return result; } #endif result= my_tell(file, flags); return result; } static inline int inline_mysql_file_delete( #ifdef HAVE_PSI_FILE_INTERFACE PSI_file_key key, const char *src_file, uint src_line, #endif const char *name, myf flags) { int result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_name_locker) (&state, key, PSI_FILE_DELETE, name, &locker); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line); result= my_delete(name, flags); PSI_FILE_CALL(end_file_close_wait)(locker, result); return result; } #endif result= my_delete(name, flags); return result; } static inline int inline_mysql_file_rename( #ifdef HAVE_PSI_FILE_INTERFACE PSI_file_key key, const char *src_file, uint src_line, #endif const char *from, const char *to, myf flags) { int result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_name_locker) (&state, key, PSI_FILE_RENAME, from, &locker); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); result= my_rename(from, to, flags); PSI_FILE_CALL(end_file_rename_wait)(locker, from, to, result); return result; } #endif result= my_rename(from, to, flags); return result; } static inline File inline_mysql_file_create_with_symlink( #ifdef HAVE_PSI_FILE_INTERFACE PSI_file_key key, const char *src_file, uint src_line, #endif const char *linkname, const char *filename, int create_flags, int access_flags, myf flags) { File file; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_name_locker) (&state, key, PSI_FILE_CREATE, filename, &locker); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line); file= my_create_with_symlink(linkname, filename, create_flags, access_flags, flags); PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file); return file; } #endif file= my_create_with_symlink(linkname, filename, create_flags, access_flags, flags); return file; } static inline int inline_mysql_file_delete_with_symlink( #ifdef HAVE_PSI_FILE_INTERFACE PSI_file_key key, const char *src_file, uint src_line, #endif const char *name, myf flags) { int result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_name_locker) (&state, key, PSI_FILE_DELETE, name, &locker); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line); result= my_delete_with_symlink(name, flags); PSI_FILE_CALL(end_file_close_wait)(locker, result); return result; } #endif result= my_delete_with_symlink(name, flags); return result; } static inline int inline_mysql_file_rename_with_symlink( #ifdef HAVE_PSI_FILE_INTERFACE PSI_file_key key, const char *src_file, uint src_line, #endif const char *from, const char *to, myf flags) { int result; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_name_locker) (&state, key, PSI_FILE_RENAME, from, &locker); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); result= my_rename_with_symlink(from, to, flags); PSI_FILE_CALL(end_file_rename_wait)(locker, from, to, result); return result; } #endif result= my_rename_with_symlink(from, to, flags); return result; } static inline int inline_mysql_file_sync( #ifdef HAVE_PSI_FILE_INTERFACE const char *src_file, uint src_line, #endif File fd, myf flags) { int result= 0; #ifdef HAVE_PSI_FILE_INTERFACE struct PSI_file_locker *locker; PSI_file_locker_state state; locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) (&state, fd, PSI_FILE_SYNC); if (likely(locker != NULL)) { PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); result= my_sync(fd, flags); PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); return result; } #endif result= my_sync(fd, flags); return result; } /** @} (end of group File_instrumentation) */ #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/psi/mysql_ps.h��������������������������������������������������������������������������0000644�����������������00000007167�14763166026�0011717 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2014, 2017, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_PS_H #define MYSQL_PS_H /** @file mysql/psi/mysql_ps.h Instrumentation helpers for prepared statements. */ #include "mysql/psi/psi.h" #ifndef PSI_PS_CALL #define PSI_PS_CALL(M) PSI_DYNAMIC_CALL(M) #endif #ifdef HAVE_PSI_PS_INTERFACE #define MYSQL_CREATE_PS(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_LENGTH) \ inline_mysql_create_prepared_stmt(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_LENGTH) #define MYSQL_EXECUTE_PS(LOCKER, PREPARED_STMT) \ inline_mysql_execute_prepared_stmt(LOCKER, PREPARED_STMT) #define MYSQL_DESTROY_PS(PREPARED_STMT) \ inline_mysql_destroy_prepared_stmt(PREPARED_STMT) #define MYSQL_REPREPARE_PS(PREPARED_STMT) \ inline_mysql_reprepare_prepared_stmt(PREPARED_STMT) #define MYSQL_SET_PS_TEXT(PREPARED_STMT, SQLTEXT, SQLTEXT_LENGTH) \ inline_mysql_set_prepared_stmt_text(PREPARED_STMT, SQLTEXT, SQLTEXT_LENGTH) #else #define MYSQL_CREATE_PS(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_LENGTH) \ NULL #define MYSQL_EXECUTE_PS(LOCKER, PREPARED_STMT) \ do {} while (0) #define MYSQL_DESTROY_PS(PREPARED_STMT) \ do {} while (0) #define MYSQL_REPREPARE_PS(PREPARED_STMT) \ do {} while (0) #define MYSQL_SET_PS_TEXT(PREPARED_STMT, SQLTEXT, SQLTEXT_LENGTH) \ do {} while (0) #endif #ifdef HAVE_PSI_PS_INTERFACE static inline struct PSI_prepared_stmt* inline_mysql_create_prepared_stmt(void *identity, uint stmt_id, PSI_statement_locker *locker, const char *stmt_name, size_t stmt_name_length, const char *sqltext, size_t sqltext_length) { if (locker == NULL) return NULL; return PSI_PS_CALL(create_prepared_stmt)(identity, stmt_id, locker, stmt_name, stmt_name_length, sqltext, sqltext_length); } static inline void inline_mysql_execute_prepared_stmt(PSI_statement_locker *locker, PSI_prepared_stmt* prepared_stmt) { if (prepared_stmt != NULL && locker != NULL) PSI_PS_CALL(execute_prepared_stmt)(locker, prepared_stmt); } static inline void inline_mysql_destroy_prepared_stmt(PSI_prepared_stmt *prepared_stmt) { if (prepared_stmt != NULL) PSI_PS_CALL(destroy_prepared_stmt)(prepared_stmt); } static inline void inline_mysql_reprepare_prepared_stmt(PSI_prepared_stmt *prepared_stmt) { if (prepared_stmt != NULL) PSI_PS_CALL(reprepare_prepared_stmt)(prepared_stmt); } static inline void inline_mysql_set_prepared_stmt_text(PSI_prepared_stmt *prepared_stmt, const char *text, uint text_len) { if (prepared_stmt != NULL) { PSI_PS_CALL(set_prepared_stmt_text)(prepared_stmt, text, text_len); } } #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/psi/mysql_statement.h�������������������������������������������������������������������0000644�����������������00000014732�14763166026�0013275 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_STATEMENT_H #define MYSQL_STATEMENT_H /** @file mysql/psi/mysql_statement.h Instrumentation helpers for statements. */ #include "mysql/psi/psi.h" class Diagnostics_area; typedef struct charset_info_st CHARSET_INFO; #ifndef PSI_STATEMENT_CALL #define PSI_STATEMENT_CALL(M) PSI_DYNAMIC_CALL(M) #endif #ifndef PSI_DIGEST_CALL #define PSI_DIGEST_CALL(M) PSI_DYNAMIC_CALL(M) #endif /** @defgroup Statement_instrumentation Statement Instrumentation @ingroup Instrumentation_interface @{ */ /** @def mysql_statement_register(P1, P2, P3) Statement registration. */ #ifdef HAVE_PSI_STATEMENT_INTERFACE #define mysql_statement_register(P1, P2, P3) \ inline_mysql_statement_register(P1, P2, P3) #else #define mysql_statement_register(P1, P2, P3) \ do {} while (0) #endif #ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE #define MYSQL_DIGEST_START(LOCKER) \ inline_mysql_digest_start(LOCKER) #else #define MYSQL_DIGEST_START(LOCKER) \ NULL #endif #ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE #define MYSQL_DIGEST_END(LOCKER, DIGEST) \ inline_mysql_digest_end(LOCKER, DIGEST) #else #define MYSQL_DIGEST_END(LOCKER, DIGEST) \ do {} while (0) #endif #ifdef HAVE_PSI_STATEMENT_INTERFACE #define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS, SPS) \ inline_mysql_start_statement(STATE, K, DB, DB_LEN, CS, SPS, __FILE__, __LINE__) #else #define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS, SPS) \ NULL #endif #ifdef HAVE_PSI_STATEMENT_INTERFACE #define MYSQL_REFINE_STATEMENT(LOCKER, K) \ inline_mysql_refine_statement(LOCKER, K) #else #define MYSQL_REFINE_STATEMENT(LOCKER, K) \ NULL #endif #ifdef HAVE_PSI_STATEMENT_INTERFACE #define MYSQL_SET_STATEMENT_TEXT(LOCKER, P1, P2) \ inline_mysql_set_statement_text(LOCKER, P1, P2) #else #define MYSQL_SET_STATEMENT_TEXT(LOCKER, P1, P2) \ do {} while (0) #endif #ifdef HAVE_PSI_STATEMENT_INTERFACE #define MYSQL_SET_STATEMENT_LOCK_TIME(LOCKER, P1) \ inline_mysql_set_statement_lock_time(LOCKER, P1) #else #define MYSQL_SET_STATEMENT_LOCK_TIME(LOCKER, P1) \ do {} while (0) #endif #ifdef HAVE_PSI_STATEMENT_INTERFACE #define MYSQL_SET_STATEMENT_ROWS_SENT(LOCKER, P1) \ inline_mysql_set_statement_rows_sent(LOCKER, P1) #else #define MYSQL_SET_STATEMENT_ROWS_SENT(LOCKER, P1) \ do {} while (0) #endif #ifdef HAVE_PSI_STATEMENT_INTERFACE #define MYSQL_SET_STATEMENT_ROWS_EXAMINED(LOCKER, P1) \ inline_mysql_set_statement_rows_examined(LOCKER, P1) #else #define MYSQL_SET_STATEMENT_ROWS_EXAMINED(LOCKER, P1) \ do {} while (0) #endif #ifdef HAVE_PSI_STATEMENT_INTERFACE #define MYSQL_END_STATEMENT(LOCKER, DA) \ inline_mysql_end_statement(LOCKER, DA) #else #define MYSQL_END_STATEMENT(LOCKER, DA) \ do {} while (0) #endif #ifdef HAVE_PSI_STATEMENT_INTERFACE static inline void inline_mysql_statement_register( const char *category, PSI_statement_info *info, int count) { PSI_STATEMENT_CALL(register_statement)(category, info, count); } #ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE static inline struct PSI_digest_locker * inline_mysql_digest_start(PSI_statement_locker *locker) { PSI_digest_locker* digest_locker= NULL; if (likely(locker != NULL)) digest_locker= PSI_DIGEST_CALL(digest_start)(locker); return digest_locker; } #endif #ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE static inline void inline_mysql_digest_end(PSI_digest_locker *locker, const sql_digest_storage *digest) { if (likely(locker != NULL)) PSI_DIGEST_CALL(digest_end)(locker, digest); } #endif static inline struct PSI_statement_locker * inline_mysql_start_statement(PSI_statement_locker_state *state, PSI_statement_key key, const char *db, uint db_len, const CHARSET_INFO *charset, PSI_sp_share *sp_share, const char *src_file, int src_line) { PSI_statement_locker *locker; locker= PSI_STATEMENT_CALL(get_thread_statement_locker)(state, key, charset, sp_share); if (likely(locker != NULL)) PSI_STATEMENT_CALL(start_statement)(locker, db, db_len, src_file, src_line); return locker; } static inline struct PSI_statement_locker * inline_mysql_refine_statement(PSI_statement_locker *locker, PSI_statement_key key) { if (likely(locker != NULL)) { locker= PSI_STATEMENT_CALL(refine_statement)(locker, key); } return locker; } static inline void inline_mysql_set_statement_text(PSI_statement_locker *locker, const char *text, uint text_len) { if (likely(locker != NULL)) { PSI_STATEMENT_CALL(set_statement_text)(locker, text, text_len); } } static inline void inline_mysql_set_statement_lock_time(PSI_statement_locker *locker, ulonglong count) { if (likely(locker != NULL)) { PSI_STATEMENT_CALL(set_statement_lock_time)(locker, count); } } static inline void inline_mysql_set_statement_rows_sent(PSI_statement_locker *locker, ulonglong count) { if (likely(locker != NULL)) { PSI_STATEMENT_CALL(set_statement_rows_sent)(locker, count); } } static inline void inline_mysql_set_statement_rows_examined(PSI_statement_locker *locker, ulonglong count) { if (likely(locker != NULL)) { PSI_STATEMENT_CALL(set_statement_rows_examined)(locker, count); } } static inline void inline_mysql_end_statement(struct PSI_statement_locker *locker, Diagnostics_area *stmt_da) { PSI_STAGE_CALL(end_stage)(); if (likely(locker != NULL)) PSI_STATEMENT_CALL(end_statement)(locker, stmt_da); } #endif /** @} (end of group Statement_instrumentation) */ #endif ��������������������������������������mysql/mysql/psi/mysql_transaction.h�����������������������������������������������������������������0000644�����������������00000015254�14763166026�0013616 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2013, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_TRANSACTION_H #define MYSQL_TRANSACTION_H /** @file mysql/psi/mysql_transaction.h Instrumentation helpers for transactions. */ #include "mysql/psi/psi.h" #ifndef PSI_TRANSACTION_CALL #define PSI_TRANSACTION_CALL(M) PSI_DYNAMIC_CALL(M) #endif /** @defgroup Transaction_instrumentation Transaction Instrumentation @ingroup Instrumentation_interface @{ */ #ifdef HAVE_PSI_TRANSACTION_INTERFACE #define MYSQL_START_TRANSACTION(STATE, XID, TRXID, ISO, RO, AC) \ inline_mysql_start_transaction(STATE, XID, TRXID, ISO, RO, AC, __FILE__, __LINE__) #else #define MYSQL_START_TRANSACTION(STATE, XID, TRXID, ISO, RO, AC) \ do {} while (0) #endif #ifdef HAVE_PSI_TRANSACTION_INTERFACE #define MYSQL_SET_TRANSACTION_GTID(LOCKER, P1, P2) \ inline_mysql_set_transaction_gtid(LOCKER, P1, P2) #else #define MYSQL_SET_TRANSACTION_GTID(LOCKER, P1, P2) \ do {} while (0) #endif #ifdef HAVE_PSI_TRANSACTION_INTERFACE #define MYSQL_SET_TRANSACTION_XID(LOCKER, P1, P2) \ inline_mysql_set_transaction_xid(LOCKER, P1, P2) #else #define MYSQL_SET_TRANSACTION_XID(LOCKER, P1, P2) \ do {} while (0) #endif #ifdef HAVE_PSI_TRANSACTION_INTERFACE #define MYSQL_SET_TRANSACTION_XA_STATE(LOCKER, P1) \ inline_mysql_set_transaction_xa_state(LOCKER, P1) #else #define MYSQL_SET_TRANSACTION_XA_STATE(LOCKER, P1) \ do {} while (0) #endif #ifdef HAVE_PSI_TRANSACTION_INTERFACE #define MYSQL_SET_TRANSACTION_TRXID(LOCKER, P1) \ inline_mysql_set_transaction_trxid(LOCKER, P1) #else #define MYSQL_SET_TRANSACTION_TRXID(LOCKER, P1) \ do {} while (0) #endif #ifdef HAVE_PSI_TRANSACTION_INTERFACE #define MYSQL_INC_TRANSACTION_SAVEPOINTS(LOCKER, P1) \ inline_mysql_inc_transaction_savepoints(LOCKER, P1) #else #define MYSQL_INC_TRANSACTION_SAVEPOINTS(LOCKER, P1) \ do {} while (0) #endif #ifdef HAVE_PSI_TRANSACTION_INTERFACE #define MYSQL_INC_TRANSACTION_ROLLBACK_TO_SAVEPOINT(LOCKER, P1) \ inline_mysql_inc_transaction_rollback_to_savepoint(LOCKER, P1) #else #define MYSQL_INC_TRANSACTION_ROLLBACK_TO_SAVEPOINT(LOCKER, P1) \ do {} while (0) #endif #ifdef HAVE_PSI_TRANSACTION_INTERFACE #define MYSQL_INC_TRANSACTION_RELEASE_SAVEPOINT(LOCKER, P1) \ inline_mysql_inc_transaction_release_savepoint(LOCKER, P1) #else #define MYSQL_INC_TRANSACTION_RELEASE_SAVEPOINT(LOCKER, P1) \ do {} while (0) #endif #ifdef HAVE_PSI_TRANSACTION_INTERFACE #define MYSQL_ROLLBACK_TRANSACTION(LOCKER) \ inline_mysql_rollback_transaction(LOCKER) #else #define MYSQL_ROLLBACK_TRANSACTION(LOCKER) \ NULL #endif #ifdef HAVE_PSI_TRANSACTION_INTERFACE #define MYSQL_COMMIT_TRANSACTION(LOCKER) \ inline_mysql_commit_transaction(LOCKER) #else #define MYSQL_COMMIT_TRANSACTION(LOCKER) \ NULL #endif #ifdef HAVE_PSI_TRANSACTION_INTERFACE static inline struct PSI_transaction_locker * inline_mysql_start_transaction(PSI_transaction_locker_state *state, const void *xid, const ulonglong *trxid, int isolation_level, my_bool read_only, my_bool autocommit, const char *src_file, int src_line) { PSI_transaction_locker *locker; locker= PSI_TRANSACTION_CALL(get_thread_transaction_locker)(state, xid, trxid, isolation_level, read_only, autocommit); if (likely(locker != NULL)) PSI_TRANSACTION_CALL(start_transaction)(locker, src_file, src_line); return locker; } static inline void inline_mysql_set_transaction_gtid(PSI_transaction_locker *locker, const void *sid, const void *gtid_spec) { if (likely(locker != NULL)) PSI_TRANSACTION_CALL(set_transaction_gtid)(locker, sid, gtid_spec); } static inline void inline_mysql_set_transaction_xid(PSI_transaction_locker *locker, const void *xid, int xa_state) { if (likely(locker != NULL)) PSI_TRANSACTION_CALL(set_transaction_xid)(locker, xid, xa_state); } static inline void inline_mysql_set_transaction_xa_state(PSI_transaction_locker *locker, int xa_state) { if (likely(locker != NULL)) PSI_TRANSACTION_CALL(set_transaction_xa_state)(locker, xa_state); } static inline void inline_mysql_set_transaction_trxid(PSI_transaction_locker *locker, const ulonglong *trxid) { if (likely(locker != NULL)) PSI_TRANSACTION_CALL(set_transaction_trxid)(locker, trxid); } static inline void inline_mysql_inc_transaction_savepoints(PSI_transaction_locker *locker, ulong count) { if (likely(locker != NULL)) PSI_TRANSACTION_CALL(inc_transaction_savepoints)(locker, count); } static inline void inline_mysql_inc_transaction_rollback_to_savepoint(PSI_transaction_locker *locker, ulong count) { if (likely(locker != NULL)) PSI_TRANSACTION_CALL(inc_transaction_rollback_to_savepoint)(locker, count); } static inline void inline_mysql_inc_transaction_release_savepoint(PSI_transaction_locker *locker, ulong count) { if (likely(locker != NULL)) PSI_TRANSACTION_CALL(inc_transaction_release_savepoint)(locker, count); } static inline void inline_mysql_rollback_transaction(struct PSI_transaction_locker *locker) { if (likely(locker != NULL)) PSI_TRANSACTION_CALL(end_transaction)(locker, false); } static inline void inline_mysql_commit_transaction(struct PSI_transaction_locker *locker) { if (likely(locker != NULL)) PSI_TRANSACTION_CALL(end_transaction)(locker, true); } #endif /** @} (end of group Transaction_instrumentation) */ #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/psi/mysql_idle.h������������������������������������������������������������������������0000644�����������������00000005036�14763166026�0012203 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. 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; version 2 of the License. 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, 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef MYSQL_IDLE_H #define MYSQL_IDLE_H /** @file mysql/psi/mysql_idle.h Instrumentation helpers for idle waits. */ #include "mysql/psi/psi.h" #ifndef PSI_IDLE_CALL #define PSI_IDLE_CALL(M) PSI_DYNAMIC_CALL(M) #endif /** @defgroup Idle_instrumentation Idle Instrumentation @ingroup Instrumentation_interface @{ */ /** @def MYSQL_START_IDLE_WAIT Instrumentation helper for table io_waits. This instrumentation marks the start of a wait event. @param LOCKER the locker @param STATE the locker state @sa MYSQL_END_IDLE_WAIT. */ #ifdef HAVE_PSI_IDLE_INTERFACE #define MYSQL_START_IDLE_WAIT(LOCKER, STATE) \ LOCKER= inline_mysql_start_idle_wait(STATE, __FILE__, __LINE__) #else #define MYSQL_START_IDLE_WAIT(LOCKER, STATE) \ do {} while (0) #endif /** @def MYSQL_END_IDLE_WAIT Instrumentation helper for idle waits. This instrumentation marks the end of a wait event. @param LOCKER the locker @sa MYSQL_START_IDLE_WAIT. */ #ifdef HAVE_PSI_IDLE_INTERFACE #define MYSQL_END_IDLE_WAIT(LOCKER) \ inline_mysql_end_idle_wait(LOCKER) #else #define MYSQL_END_IDLE_WAIT(LOCKER) \ do {} while (0) #endif #ifdef HAVE_PSI_IDLE_INTERFACE /** Instrumentation calls for MYSQL_START_IDLE_WAIT. @sa MYSQL_END_IDLE_WAIT. */ static inline struct PSI_idle_locker * inline_mysql_start_idle_wait(PSI_idle_locker_state *state, const char *src_file, int src_line) { struct PSI_idle_locker *locker; locker= PSI_IDLE_CALL(start_idle_wait)(state, src_file, src_line); return locker; } /** Instrumentation calls for MYSQL_END_IDLE_WAIT. @sa MYSQL_START_IDLE_WAIT. */ static inline void inline_mysql_end_idle_wait(struct PSI_idle_locker *locker) { if (likely(locker != NULL)) PSI_IDLE_CALL(end_idle_wait)(locker); } #endif /** @} (end of group Idle_instrumentation) */ #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/psi/psi.h�������������������������������������������������������������������������������0000644�����������������00000251404�14763166026�0010636 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. 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; version 2 of the License. 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, 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H #define MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H #ifdef EMBEDDED_LIBRARY #define DISABLE_ALL_PSI #endif /* EMBEDDED_LIBRARY */ #ifndef MY_GLOBAL_INCLUDED /* Make sure a .c or .cc file contains an include to my_global.h first. When this include is missing, all the #ifdef HAVE_XXX have no effect, and the resulting binary won't build, or won't link, or will crash at runtime since various structures will have different binary definitions. */ #error "You must include my_global.h in the code for the build to be correct." #endif #include "psi_base.h" #include "psi_memory.h" /* MAINTAINER: The following pattern: typedef struct XYZ XYZ; is not needed in C++, but required for C. */ C_MODE_START /** @sa MDL_key. */ struct MDL_key; typedef struct MDL_key MDL_key; /** @sa enum_mdl_type. */ typedef int opaque_mdl_type; /** @sa enum_mdl_duration. */ typedef int opaque_mdl_duration; /** @sa MDL_wait::enum_wait_status. */ typedef int opaque_mdl_status; /** @sa enum_vio_type. */ typedef int opaque_vio_type; struct TABLE_SHARE; struct sql_digest_storage; #ifdef __cplusplus class THD; #else /* Phony declaration when compiling C code. This is ok, because the C code will never have a THD anyway. */ struct opaque_THD { int dummy; }; typedef struct opaque_THD THD; #endif /** @file mysql/psi/psi.h Performance schema instrumentation interface. @defgroup Instrumentation_interface Instrumentation Interface @ingroup Performance_schema @{ */ /** Interface for an instrumented mutex. This is an opaque structure. */ struct PSI_mutex; typedef struct PSI_mutex PSI_mutex; /** Interface for an instrumented rwlock. This is an opaque structure. */ struct PSI_rwlock; typedef struct PSI_rwlock PSI_rwlock; /** Interface for an instrumented condition. This is an opaque structure. */ struct PSI_cond; typedef struct PSI_cond PSI_cond; /** Interface for an instrumented table share. This is an opaque structure. */ struct PSI_table_share; typedef struct PSI_table_share PSI_table_share; /** Interface for an instrumented table handle. This is an opaque structure. */ struct PSI_table; typedef struct PSI_table PSI_table; /** Interface for an instrumented thread. This is an opaque structure. */ struct PSI_thread; typedef struct PSI_thread PSI_thread; /** Interface for an instrumented file handle. This is an opaque structure. */ struct PSI_file; typedef struct PSI_file PSI_file; /** Interface for an instrumented socket descriptor. This is an opaque structure. */ struct PSI_socket; typedef struct PSI_socket PSI_socket; /** Interface for an instrumented prepared statement. This is an opaque structure. */ struct PSI_prepared_stmt; typedef struct PSI_prepared_stmt PSI_prepared_stmt; /** Interface for an instrumented table operation. This is an opaque structure. */ struct PSI_table_locker; typedef struct PSI_table_locker PSI_table_locker; /** Interface for an instrumented statement. This is an opaque structure. */ struct PSI_statement_locker; typedef struct PSI_statement_locker PSI_statement_locker; /** Interface for an instrumented transaction. This is an opaque structure. */ struct PSI_transaction_locker; typedef struct PSI_transaction_locker PSI_transaction_locker; /** Interface for an instrumented idle operation. This is an opaque structure. */ struct PSI_idle_locker; typedef struct PSI_idle_locker PSI_idle_locker; /** Interface for an instrumented statement digest operation. This is an opaque structure. */ struct PSI_digest_locker; typedef struct PSI_digest_locker PSI_digest_locker; /** Interface for an instrumented stored procedure share. This is an opaque structure. */ struct PSI_sp_share; typedef struct PSI_sp_share PSI_sp_share; /** Interface for an instrumented stored program. This is an opaque structure. */ struct PSI_sp_locker; typedef struct PSI_sp_locker PSI_sp_locker; /** Interface for an instrumented metadata lock. This is an opaque structure. */ struct PSI_metadata_lock; typedef struct PSI_metadata_lock PSI_metadata_lock; /** Interface for an instrumented stage progress. This is a public structure, for efficiency. */ struct PSI_stage_progress { ulonglong m_work_completed; ulonglong m_work_estimated; }; typedef struct PSI_stage_progress PSI_stage_progress; /** IO operation performed on an instrumented table. */ enum PSI_table_io_operation { /** Row fetch. */ PSI_TABLE_FETCH_ROW= 0, /** Row write. */ PSI_TABLE_WRITE_ROW= 1, /** Row update. */ PSI_TABLE_UPDATE_ROW= 2, /** Row delete. */ PSI_TABLE_DELETE_ROW= 3 }; typedef enum PSI_table_io_operation PSI_table_io_operation; /** State data storage for @c start_table_io_wait_v1_t, @c start_table_lock_wait_v1_t. This structure provide temporary storage to a table locker. The content of this structure is considered opaque, the fields are only hints of what an implementation of the psi interface can use. This memory is provided by the instrumented code for performance reasons. @sa start_table_io_wait_v1_t @sa start_table_lock_wait_v1_t */ struct PSI_table_locker_state { /** Internal state. */ uint m_flags; /** Current io operation. */ enum PSI_table_io_operation m_io_operation; /** Current table handle. */ struct PSI_table *m_table; /** Current table share. */ struct PSI_table_share *m_table_share; /** Current thread. */ struct PSI_thread *m_thread; /** Timer start. */ ulonglong m_timer_start; /** Timer function. */ ulonglong (*m_timer)(void); /** Internal data. */ void *m_wait; /** Implementation specific. For table io, the table io index. For table lock, the lock type. */ uint m_index; }; typedef struct PSI_table_locker_state PSI_table_locker_state; /** Entry point for the performance schema interface. */ struct PSI_bootstrap { /** ABI interface finder. Calling this method with an interface version number returns either an instance of the ABI for this version, or NULL. @param version the interface version number to find @return a versioned interface (PSI_v1, PSI_v2 or PSI) @sa PSI_VERSION_1 @sa PSI_v1 @sa PSI_VERSION_2 @sa PSI_v2 @sa PSI_CURRENT_VERSION @sa PSI */ void* (*get_interface)(int version); }; typedef struct PSI_bootstrap PSI_bootstrap; #ifdef HAVE_PSI_INTERFACE #ifdef DISABLE_ALL_PSI #ifndef DISABLE_PSI_THREAD #define DISABLE_PSI_THREAD #endif #ifndef DISABLE_PSI_MUTEX #define DISABLE_PSI_MUTEX #endif #ifndef DISABLE_PSI_RWLOCK #define DISABLE_PSI_RWLOCK #endif #ifndef DISABLE_PSI_COND #define DISABLE_PSI_COND #endif #ifndef DISABLE_PSI_FILE #define DISABLE_PSI_FILE #endif #ifndef DISABLE_PSI_TABLE #define DISABLE_PSI_TABLE #endif #ifndef DISABLE_PSI_SOCKET #define DISABLE_PSI_SOCKET #endif #ifndef DISABLE_PSI_STAGE #define DISABLE_PSI_STAGE #endif #ifndef DISABLE_PSI_STATEMENT #define DISABLE_PSI_STATEMENT #endif #ifndef DISABLE_PSI_SP #define DISABLE_PSI_SP #endif #ifndef DISABLE_PSI_IDLE #define DISABLE_PSI_IDLE #endif #ifndef DISABLE_PSI_STATEMENT_DIGEST #define DISABLE_PSI_STATEMENT_DIGEST #endif #ifndef DISABLE_PSI_METADATA #define DISABLE_PSI_METADATA #endif #ifndef DISABLE_PSI_MEMORY #define DISABLE_PSI_MEMORY #endif #ifndef DISABLE_PSI_TRANSACTION #define DISABLE_PSI_TRANSACTION #endif #ifndef DISABLE_PSI_SP #define DISABLE_PSI_SP #endif #ifndef DISABLE_PSI_PS #define DISABLE_PSI_PS #endif #endif /** @def DISABLE_PSI_MUTEX Compiling option to disable the mutex instrumentation. This option is mostly intended to be used during development, when doing special builds with only a subset of the performance schema instrumentation, for code analysis / profiling / performance tuning of a specific instrumentation alone. @sa DISABLE_PSI_RWLOCK @sa DISABLE_PSI_COND @sa DISABLE_PSI_FILE @sa DISABLE_PSI_THREAD @sa DISABLE_PSI_TABLE @sa DISABLE_PSI_STAGE @sa DISABLE_PSI_STATEMENT @sa DISABLE_PSI_SP @sa DISABLE_PSI_STATEMENT_DIGEST @sa DISABLE_PSI_SOCKET @sa DISABLE_PSI_MEMORY @sa DISABLE_PSI_IDLE @sa DISABLE_PSI_METADATA @sa DISABLE PSI_TRANSACTION */ #ifndef DISABLE_PSI_MUTEX #define HAVE_PSI_MUTEX_INTERFACE #endif /** @def DISABLE_PSI_RWLOCK Compiling option to disable the rwlock instrumentation. @sa DISABLE_PSI_MUTEX */ #ifndef DISABLE_PSI_RWLOCK #define HAVE_PSI_RWLOCK_INTERFACE #endif /** @def DISABLE_PSI_COND Compiling option to disable the cond instrumentation. @sa DISABLE_PSI_MUTEX */ #ifndef DISABLE_PSI_COND #define HAVE_PSI_COND_INTERFACE #endif /** @def DISABLE_PSI_FILE Compiling option to disable the file instrumentation. @sa DISABLE_PSI_MUTEX */ #ifndef DISABLE_PSI_FILE #define HAVE_PSI_FILE_INTERFACE #endif /** @def DISABLE_PSI_THREAD Compiling option to disable the thread instrumentation. @sa DISABLE_PSI_MUTEX */ #ifndef DISABLE_PSI_THREAD #define HAVE_PSI_THREAD_INTERFACE #endif /** @def DISABLE_PSI_TABLE Compiling option to disable the table instrumentation. @sa DISABLE_PSI_MUTEX */ #ifndef DISABLE_PSI_TABLE #define HAVE_PSI_TABLE_INTERFACE #endif /** @def DISABLE_PSI_STAGE Compiling option to disable the stage instrumentation. @sa DISABLE_PSI_MUTEX */ #ifndef DISABLE_PSI_STAGE #define HAVE_PSI_STAGE_INTERFACE #endif /** @def DISABLE_PSI_STATEMENT Compiling option to disable the statement instrumentation. @sa DISABLE_PSI_MUTEX */ #ifndef DISABLE_PSI_STATEMENT #define HAVE_PSI_STATEMENT_INTERFACE #endif /** @def DISABLE_PSI_SP Compiling option to disable the stored program instrumentation. @sa DISABLE_PSI_MUTEX */ #ifndef DISABLE_PSI_SP #define HAVE_PSI_SP_INTERFACE #endif /** @def DISABLE_PSI_PS Compiling option to disable the prepared statement instrumentation. @sa DISABLE_PSI_MUTEX */ #ifndef DISABLE_PSI_STATEMENT #ifndef DISABLE_PSI_PS #define HAVE_PSI_PS_INTERFACE #endif #endif /** @def DISABLE_PSI_STATEMENT_DIGEST Compiling option to disable the statement digest instrumentation. */ #ifndef DISABLE_PSI_STATEMENT #ifndef DISABLE_PSI_STATEMENT_DIGEST #define HAVE_PSI_STATEMENT_DIGEST_INTERFACE #endif #endif /** @def DISABLE_PSI_TRANSACTION Compiling option to disable the transaction instrumentation. @sa DISABLE_PSI_MUTEX */ #ifndef DISABLE_PSI_TRANSACTION #define HAVE_PSI_TRANSACTION_INTERFACE #endif /** @def DISABLE_PSI_SOCKET Compiling option to disable the statement instrumentation. @sa DISABLE_PSI_MUTEX */ #ifndef DISABLE_PSI_SOCKET #define HAVE_PSI_SOCKET_INTERFACE #endif /** @def DISABLE_PSI_MEMORY Compiling option to disable the memory instrumentation. @sa DISABLE_PSI_MUTEX */ #ifndef DISABLE_PSI_MEMORY #define HAVE_PSI_MEMORY_INTERFACE #endif /** @def DISABLE_PSI_IDLE Compiling option to disable the idle instrumentation. @sa DISABLE_PSI_MUTEX */ #ifndef DISABLE_PSI_IDLE #define HAVE_PSI_IDLE_INTERFACE #endif /** @def DISABLE_PSI_METADATA Compiling option to disable the metadata instrumentation. @sa DISABLE_PSI_MUTEX */ #ifndef DISABLE_PSI_METADATA #define HAVE_PSI_METADATA_INTERFACE #endif /** @def PSI_VERSION_1 Performance Schema Interface number for version 1. This version is supported. */ #define PSI_VERSION_1 1 /** @def PSI_VERSION_2 Performance Schema Interface number for version 2. This version is not implemented, it's a placeholder. */ #define PSI_VERSION_2 2 /** @def PSI_CURRENT_VERSION Performance Schema Interface number for the most recent version. The most current version is @c PSI_VERSION_1 */ #define PSI_CURRENT_VERSION 1 #ifndef USE_PSI_2 #ifndef USE_PSI_1 #define USE_PSI_1 #endif #endif /** Interface for an instrumented mutex operation. This is an opaque structure. */ struct PSI_mutex_locker; typedef struct PSI_mutex_locker PSI_mutex_locker; /** Interface for an instrumented rwlock operation. This is an opaque structure. */ struct PSI_rwlock_locker; typedef struct PSI_rwlock_locker PSI_rwlock_locker; /** Interface for an instrumented condition operation. This is an opaque structure. */ struct PSI_cond_locker; typedef struct PSI_cond_locker PSI_cond_locker; /** Interface for an instrumented file operation. This is an opaque structure. */ struct PSI_file_locker; typedef struct PSI_file_locker PSI_file_locker; /** Interface for an instrumented socket operation. This is an opaque structure. */ struct PSI_socket_locker; typedef struct PSI_socket_locker PSI_socket_locker; /** Interface for an instrumented MDL operation. This is an opaque structure. */ struct PSI_metadata_locker; typedef struct PSI_metadata_locker PSI_metadata_locker; /** Operation performed on an instrumented mutex. */ enum PSI_mutex_operation { /** Lock. */ PSI_MUTEX_LOCK= 0, /** Lock attempt. */ PSI_MUTEX_TRYLOCK= 1 }; typedef enum PSI_mutex_operation PSI_mutex_operation; /** Operation performed on an instrumented rwlock. For basic READ / WRITE lock, operations are "READ" or "WRITE". For SX-locks, operations are "SHARED", "SHARED-EXCLUSIVE" or "EXCLUSIVE". */ enum PSI_rwlock_operation { /** Read lock. */ PSI_RWLOCK_READLOCK= 0, /** Write lock. */ PSI_RWLOCK_WRITELOCK= 1, /** Read lock attempt. */ PSI_RWLOCK_TRYREADLOCK= 2, /** Write lock attempt. */ PSI_RWLOCK_TRYWRITELOCK= 3, /** Shared lock. */ PSI_RWLOCK_SHAREDLOCK= 4, /** Shared Exclusive lock. */ PSI_RWLOCK_SHAREDEXCLUSIVELOCK= 5, /** Exclusive lock. */ PSI_RWLOCK_EXCLUSIVELOCK= 6, /** Shared lock attempt. */ PSI_RWLOCK_TRYSHAREDLOCK= 7, /** Shared Exclusive lock attempt. */ PSI_RWLOCK_TRYSHAREDEXCLUSIVELOCK= 8, /** Exclusive lock attempt. */ PSI_RWLOCK_TRYEXCLUSIVELOCK= 9 }; typedef enum PSI_rwlock_operation PSI_rwlock_operation; /** Operation performed on an instrumented condition. */ enum PSI_cond_operation { /** Wait. */ PSI_COND_WAIT= 0, /** Wait, with timeout. */ PSI_COND_TIMEDWAIT= 1 }; typedef enum PSI_cond_operation PSI_cond_operation; /** Operation performed on an instrumented file. */ enum PSI_file_operation { /** File creation, as in @c create(). */ PSI_FILE_CREATE= 0, /** Temporary file creation, as in @c create_temp_file(). */ PSI_FILE_CREATE_TMP= 1, /** File open, as in @c open(). */ PSI_FILE_OPEN= 2, /** File open, as in @c fopen(). */ PSI_FILE_STREAM_OPEN= 3, /** File close, as in @c close(). */ PSI_FILE_CLOSE= 4, /** File close, as in @c fclose(). */ PSI_FILE_STREAM_CLOSE= 5, /** Generic file read, such as @c fgets(), @c fgetc(), @c fread(), @c read(), @c pread(). */ PSI_FILE_READ= 6, /** Generic file write, such as @c fputs(), @c fputc(), @c fprintf(), @c vfprintf(), @c fwrite(), @c write(), @c pwrite(). */ PSI_FILE_WRITE= 7, /** Generic file seek, such as @c fseek() or @c seek(). */ PSI_FILE_SEEK= 8, /** Generic file tell, such as @c ftell() or @c tell(). */ PSI_FILE_TELL= 9, /** File flush, as in @c fflush(). */ PSI_FILE_FLUSH= 10, /** File stat, as in @c stat(). */ PSI_FILE_STAT= 11, /** File stat, as in @c fstat(). */ PSI_FILE_FSTAT= 12, /** File chsize, as in @c my_chsize(). */ PSI_FILE_CHSIZE= 13, /** File delete, such as @c my_delete() or @c my_delete_with_symlink(). */ PSI_FILE_DELETE= 14, /** File rename, such as @c my_rename() or @c my_rename_with_symlink(). */ PSI_FILE_RENAME= 15, /** File sync, as in @c fsync() or @c my_sync(). */ PSI_FILE_SYNC= 16 }; typedef enum PSI_file_operation PSI_file_operation; /** Lock operation performed on an instrumented table. */ enum PSI_table_lock_operation { /** Table lock, in the server layer. */ PSI_TABLE_LOCK= 0, /** Table lock, in the storage engine layer. */ PSI_TABLE_EXTERNAL_LOCK= 1 }; typedef enum PSI_table_lock_operation PSI_table_lock_operation; /** State of an instrumented socket. */ enum PSI_socket_state { /** Idle, waiting for the next command. */ PSI_SOCKET_STATE_IDLE= 1, /** Active, executing a command. */ PSI_SOCKET_STATE_ACTIVE= 2 }; typedef enum PSI_socket_state PSI_socket_state; /** Operation performed on an instrumented socket. */ enum PSI_socket_operation { /** Socket creation, as in @c socket() or @c socketpair(). */ PSI_SOCKET_CREATE= 0, /** Socket connection, as in @c connect(), @c listen() and @c accept(). */ PSI_SOCKET_CONNECT= 1, /** Socket bind, as in @c bind(), @c getsockname() and @c getpeername(). */ PSI_SOCKET_BIND= 2, /** Socket close, as in @c shutdown(). */ PSI_SOCKET_CLOSE= 3, /** Socket send, @c send(). */ PSI_SOCKET_SEND= 4, /** Socket receive, @c recv(). */ PSI_SOCKET_RECV= 5, /** Socket send, @c sendto(). */ PSI_SOCKET_SENDTO= 6, /** Socket receive, @c recvfrom). */ PSI_SOCKET_RECVFROM= 7, /** Socket send, @c sendmsg(). */ PSI_SOCKET_SENDMSG= 8, /** Socket receive, @c recvmsg(). */ PSI_SOCKET_RECVMSG= 9, /** Socket seek, such as @c fseek() or @c seek(). */ PSI_SOCKET_SEEK= 10, /** Socket options, as in @c getsockopt() and @c setsockopt(). */ PSI_SOCKET_OPT= 11, /** Socket status, as in @c sockatmark() and @c isfdtype(). */ PSI_SOCKET_STAT= 12, /** Socket shutdown, as in @c shutdown(). */ PSI_SOCKET_SHUTDOWN= 13, /** Socket select, as in @c select() and @c poll(). */ PSI_SOCKET_SELECT= 14 }; typedef enum PSI_socket_operation PSI_socket_operation; /** Instrumented mutex key. To instrument a mutex, a mutex key must be obtained using @c register_mutex. Using a zero key always disable the instrumentation. */ typedef unsigned int PSI_mutex_key; /** Instrumented rwlock key. To instrument a rwlock, a rwlock key must be obtained using @c register_rwlock. Using a zero key always disable the instrumentation. */ typedef unsigned int PSI_rwlock_key; /** Instrumented cond key. To instrument a condition, a condition key must be obtained using @c register_cond. Using a zero key always disable the instrumentation. */ typedef unsigned int PSI_cond_key; /** Instrumented thread key. To instrument a thread, a thread key must be obtained using @c register_thread. Using a zero key always disable the instrumentation. */ typedef unsigned int PSI_thread_key; /** Instrumented file key. To instrument a file, a file key must be obtained using @c register_file. Using a zero key always disable the instrumentation. */ #ifndef PSI_FILE_KEY_DEFINED typedef unsigned int PSI_file_key; #define PSI_FILE_KEY_DEFINED #endif /** Instrumented stage key. To instrument a stage, a stage key must be obtained using @c register_stage. Using a zero key always disable the instrumentation. */ typedef unsigned int PSI_stage_key; /** Instrumented statement key. To instrument a statement, a statement key must be obtained using @c register_statement. Using a zero key always disable the instrumentation. */ typedef unsigned int PSI_statement_key; /** Instrumented socket key. To instrument a socket, a socket key must be obtained using @c register_socket. Using a zero key always disable the instrumentation. */ typedef unsigned int PSI_socket_key; #ifdef HAVE_PSI_1 /** @defgroup Group_PSI_v1 Application Binary Interface, version 1 @ingroup Instrumentation_interface @{ */ /** Mutex information. @since PSI_VERSION_1 This structure is used to register an instrumented mutex. */ struct PSI_mutex_info_v1 { /** Pointer to the key assigned to the registered mutex. */ PSI_mutex_key *m_key; /** The name of the mutex to register. */ const char *m_name; /** The flags of the mutex to register. @sa PSI_FLAG_GLOBAL */ int m_flags; }; typedef struct PSI_mutex_info_v1 PSI_mutex_info_v1; /** Rwlock information. @since PSI_VERSION_1 This structure is used to register an instrumented rwlock. */ struct PSI_rwlock_info_v1 { /** Pointer to the key assigned to the registered rwlock. */ PSI_rwlock_key *m_key; /** The name of the rwlock to register. */ const char *m_name; /** The flags of the rwlock to register. @sa PSI_FLAG_GLOBAL */ int m_flags; }; typedef struct PSI_rwlock_info_v1 PSI_rwlock_info_v1; /** Condition information. @since PSI_VERSION_1 This structure is used to register an instrumented cond. */ struct PSI_cond_info_v1 { /** Pointer to the key assigned to the registered cond. */ PSI_cond_key *m_key; /** The name of the cond to register. */ const char *m_name; /** The flags of the cond to register. @sa PSI_FLAG_GLOBAL */ int m_flags; }; typedef struct PSI_cond_info_v1 PSI_cond_info_v1; /** Thread instrument information. @since PSI_VERSION_1 This structure is used to register an instrumented thread. */ struct PSI_thread_info_v1 { /** Pointer to the key assigned to the registered thread. */ PSI_thread_key *m_key; /** The name of the thread instrument to register. */ const char *m_name; /** The flags of the thread to register. @sa PSI_FLAG_GLOBAL */ int m_flags; }; typedef struct PSI_thread_info_v1 PSI_thread_info_v1; /** File instrument information. @since PSI_VERSION_1 This structure is used to register an instrumented file. */ struct PSI_file_info_v1 { /** Pointer to the key assigned to the registered file. */ PSI_file_key *m_key; /** The name of the file instrument to register. */ const char *m_name; /** The flags of the file instrument to register. @sa PSI_FLAG_GLOBAL */ int m_flags; }; typedef struct PSI_file_info_v1 PSI_file_info_v1; /** Stage instrument information. @since PSI_VERSION_1 This structure is used to register an instrumented stage. */ struct PSI_stage_info_v1 { /** The registered stage key. */ PSI_stage_key m_key; /** The name of the stage instrument to register. */ const char *m_name; /** The flags of the stage instrument to register. */ int m_flags; }; typedef struct PSI_stage_info_v1 PSI_stage_info_v1; /** Statement instrument information. @since PSI_VERSION_1 This structure is used to register an instrumented statement. */ struct PSI_statement_info_v1 { /** The registered statement key. */ PSI_statement_key m_key; /** The name of the statement instrument to register. */ const char *m_name; /** The flags of the statement instrument to register. */ int m_flags; }; typedef struct PSI_statement_info_v1 PSI_statement_info_v1; /** Socket instrument information. @since PSI_VERSION_1 This structure is used to register an instrumented socket. */ struct PSI_socket_info_v1 { /** Pointer to the key assigned to the registered socket. */ PSI_socket_key *m_key; /** The name of the socket instrument to register. */ const char *m_name; /** The flags of the socket instrument to register. @sa PSI_FLAG_GLOBAL */ int m_flags; }; typedef struct PSI_socket_info_v1 PSI_socket_info_v1; /** State data storage for @c start_idle_wait_v1_t. This structure provide temporary storage to an idle locker. The content of this structure is considered opaque, the fields are only hints of what an implementation of the psi interface can use. This memory is provided by the instrumented code for performance reasons. @sa start_idle_wait_v1_t. */ struct PSI_idle_locker_state_v1 { /** Internal state. */ uint m_flags; /** Current thread. */ struct PSI_thread *m_thread; /** Timer start. */ ulonglong m_timer_start; /** Timer function. */ ulonglong (*m_timer)(void); /** Internal data. */ void *m_wait; }; typedef struct PSI_idle_locker_state_v1 PSI_idle_locker_state_v1; /** State data storage for @c start_mutex_wait_v1_t. This structure provide temporary storage to a mutex locker. The content of this structure is considered opaque, the fields are only hints of what an implementation of the psi interface can use. This memory is provided by the instrumented code for performance reasons. @sa start_mutex_wait_v1_t */ struct PSI_mutex_locker_state_v1 { /** Internal state. */ uint m_flags; /** Current operation. */ enum PSI_mutex_operation m_operation; /** Current mutex. */ struct PSI_mutex *m_mutex; /** Current thread. */ struct PSI_thread *m_thread; /** Timer start. */ ulonglong m_timer_start; /** Timer function. */ ulonglong (*m_timer)(void); /** Internal data. */ void *m_wait; }; typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state_v1; /** State data storage for @c start_rwlock_rdwait_v1_t, @c start_rwlock_wrwait_v1_t. This structure provide temporary storage to a rwlock locker. The content of this structure is considered opaque, the fields are only hints of what an implementation of the psi interface can use. This memory is provided by the instrumented code for performance reasons. @sa start_rwlock_rdwait_v1_t @sa start_rwlock_wrwait_v1_t */ struct PSI_rwlock_locker_state_v1 { /** Internal state. */ uint m_flags; /** Current operation. */ enum PSI_rwlock_operation m_operation; /** Current rwlock. */ struct PSI_rwlock *m_rwlock; /** Current thread. */ struct PSI_thread *m_thread; /** Timer start. */ ulonglong m_timer_start; /** Timer function. */ ulonglong (*m_timer)(void); /** Internal data. */ void *m_wait; }; typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state_v1; /** State data storage for @c start_cond_wait_v1_t. This structure provide temporary storage to a condition locker. The content of this structure is considered opaque, the fields are only hints of what an implementation of the psi interface can use. This memory is provided by the instrumented code for performance reasons. @sa start_cond_wait_v1_t */ struct PSI_cond_locker_state_v1 { /** Internal state. */ uint m_flags; /** Current operation. */ enum PSI_cond_operation m_operation; /** Current condition. */ struct PSI_cond *m_cond; /** Current mutex. */ struct PSI_mutex *m_mutex; /** Current thread. */ struct PSI_thread *m_thread; /** Timer start. */ ulonglong m_timer_start; /** Timer function. */ ulonglong (*m_timer)(void); /** Internal data. */ void *m_wait; }; typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state_v1; /** State data storage for @c get_thread_file_name_locker_v1_t. This structure provide temporary storage to a file locker. The content of this structure is considered opaque, the fields are only hints of what an implementation of the psi interface can use. This memory is provided by the instrumented code for performance reasons. @sa get_thread_file_name_locker_v1_t @sa get_thread_file_stream_locker_v1_t @sa get_thread_file_descriptor_locker_v1_t */ struct PSI_file_locker_state_v1 { /** Internal state. */ uint m_flags; /** Current operation. */ enum PSI_file_operation m_operation; /** Current file. */ struct PSI_file *m_file; /** Current file name. */ const char *m_name; /** Current file class. */ void *m_class; /** Current thread. */ struct PSI_thread *m_thread; /** Operation number of bytes. */ size_t m_number_of_bytes; /** Timer start. */ ulonglong m_timer_start; /** Timer function. */ ulonglong (*m_timer)(void); /** Internal data. */ void *m_wait; }; typedef struct PSI_file_locker_state_v1 PSI_file_locker_state_v1; /** State data storage for @c start_metadata_wait_v1_t. This structure provide temporary storage to a metadata locker. The content of this structure is considered opaque, the fields are only hints of what an implementation of the psi interface can use. This memory is provided by the instrumented code for performance reasons. @sa start_metadata_wait_v1_t */ struct PSI_metadata_locker_state_v1 { /** Internal state. */ uint m_flags; /** Current metadata lock. */ struct PSI_metadata_lock *m_metadata_lock; /** Current thread. */ struct PSI_thread *m_thread; /** Timer start. */ ulonglong m_timer_start; /** Timer function. */ ulonglong (*m_timer)(void); /** Internal data. */ void *m_wait; }; typedef struct PSI_metadata_locker_state_v1 PSI_metadata_locker_state_v1; /* Duplicate of NAME_LEN, to avoid dependency on mysql_com.h */ #define PSI_SCHEMA_NAME_LEN (64 * 3) /** State data storage for @c get_thread_statement_locker_v1_t, @c get_thread_statement_locker_v1_t. This structure provide temporary storage to a statement locker. The content of this structure is considered opaque, the fields are only hints of what an implementation of the psi interface can use. This memory is provided by the instrumented code for performance reasons. @sa get_thread_statement_locker_v1_t */ struct PSI_statement_locker_state_v1 { /** Discarded flag. */ my_bool m_discarded; /** In prepare flag. */ my_bool m_in_prepare; /** Metric, no index used flag. */ uchar m_no_index_used; /** Metric, no good index used flag. */ uchar m_no_good_index_used; /** Internal state. */ uint m_flags; /** Instrumentation class. */ void *m_class; /** Current thread. */ struct PSI_thread *m_thread; /** Timer start. */ ulonglong m_timer_start; /** Timer function. */ ulonglong (*m_timer)(void); /** Internal data. */ void *m_statement; /** Locked time. */ ulonglong m_lock_time; /** Rows sent. */ ulonglong m_rows_sent; /** Rows examined. */ ulonglong m_rows_examined; /** Metric, temporary tables created on disk. */ ulong m_created_tmp_disk_tables; /** Metric, temporary tables created. */ ulong m_created_tmp_tables; /** Metric, number of select full join. */ ulong m_select_full_join; /** Metric, number of select full range join. */ ulong m_select_full_range_join; /** Metric, number of select range. */ ulong m_select_range; /** Metric, number of select range check. */ ulong m_select_range_check; /** Metric, number of select scan. */ ulong m_select_scan; /** Metric, number of sort merge passes. */ ulong m_sort_merge_passes; /** Metric, number of sort merge. */ ulong m_sort_range; /** Metric, number of sort rows. */ ulong m_sort_rows; /** Metric, number of sort scans. */ ulong m_sort_scan; /** Statement digest. */ const struct sql_digest_storage *m_digest; /** Current schema name. */ char m_schema_name[PSI_SCHEMA_NAME_LEN]; /** Length in bytes of @c m_schema_name. */ uint m_schema_name_length; /** Statement character set number. */ uint m_cs_number; PSI_sp_share *m_parent_sp_share; PSI_prepared_stmt *m_parent_prepared_stmt; }; typedef struct PSI_statement_locker_state_v1 PSI_statement_locker_state_v1; /** State data storage for @c get_thread_transaction_locker_v1_t, @c get_thread_transaction_locker_v1_t. This structure provide temporary storage to a transaction locker. The content of this structure is considered opaque, the fields are only hints of what an implementation of the psi interface can use. This memory is provided by the instrumented code for performance reasons. @sa get_thread_transaction_locker_v1_t */ struct PSI_transaction_locker_state_v1 { /** Internal state. */ uint m_flags; /** Instrumentation class. */ void *m_class; /** Current thread. */ struct PSI_thread *m_thread; /** Timer start. */ ulonglong m_timer_start; /** Timer function. */ ulonglong (*m_timer)(void); /** Internal data. */ void *m_transaction; /** True if read-only transaction, false if read-write. */ my_bool m_read_only; /** True if transaction is autocommit. */ my_bool m_autocommit; /** Number of statements. */ ulong m_statement_count; /** Total number of savepoints. */ ulong m_savepoint_count; /** Number of rollback_to_savepoint. */ ulong m_rollback_to_savepoint_count; /** Number of release_savepoint. */ ulong m_release_savepoint_count; }; typedef struct PSI_transaction_locker_state_v1 PSI_transaction_locker_state_v1; /** State data storage for @c start_socket_wait_v1_t. This structure provide temporary storage to a socket locker. The content of this structure is considered opaque, the fields are only hints of what an implementation of the psi interface can use. This memory is provided by the instrumented code for performance reasons. @sa start_socket_wait_v1_t */ struct PSI_socket_locker_state_v1 { /** Internal state. */ uint m_flags; /** Current socket. */ struct PSI_socket *m_socket; /** Current thread. */ struct PSI_thread *m_thread; /** Operation number of bytes. */ size_t m_number_of_bytes; /** Timer start. */ ulonglong m_timer_start; /** Timer function. */ ulonglong (*m_timer)(void); /** Current operation. */ enum PSI_socket_operation m_operation; /** Source file. */ const char* m_src_file; /** Source line number. */ int m_src_line; /** Internal data. */ void *m_wait; }; typedef struct PSI_socket_locker_state_v1 PSI_socket_locker_state_v1; struct PSI_sp_locker_state_v1 { /** Internal state. */ uint m_flags; /** Current thread. */ struct PSI_thread *m_thread; /** Timer start. */ ulonglong m_timer_start; /** Timer function. */ ulonglong (*m_timer)(void); /** Stored Procedure share. */ PSI_sp_share* m_sp_share; }; typedef struct PSI_sp_locker_state_v1 PSI_sp_locker_state_v1; /* Using typedef to make reuse between PSI_v1 and PSI_v2 easier later. */ /** Mutex registration API. @param category a category name (typically a plugin name) @param info an array of mutex info to register @param count the size of the info array */ typedef void (*register_mutex_v1_t) (const char *category, struct PSI_mutex_info_v1 *info, int count); /** Rwlock registration API. @param category a category name (typically a plugin name) @param info an array of rwlock info to register @param count the size of the info array */ typedef void (*register_rwlock_v1_t) (const char *category, struct PSI_rwlock_info_v1 *info, int count); /** Cond registration API. @param category a category name (typically a plugin name) @param info an array of cond info to register @param count the size of the info array */ typedef void (*register_cond_v1_t) (const char *category, struct PSI_cond_info_v1 *info, int count); /** Thread registration API. @param category a category name (typically a plugin name) @param info an array of thread info to register @param count the size of the info array */ typedef void (*register_thread_v1_t) (const char *category, struct PSI_thread_info_v1 *info, int count); /** File registration API. @param category a category name (typically a plugin name) @param info an array of file info to register @param count the size of the info array */ typedef void (*register_file_v1_t) (const char *category, struct PSI_file_info_v1 *info, int count); /** Stage registration API. @param category a category name @param info an array of stage info to register @param count the size of the info array */ typedef void (*register_stage_v1_t) (const char *category, struct PSI_stage_info_v1 **info, int count); /** Statement registration API. @param category a category name @param info an array of stage info to register @param count the size of the info array */ typedef void (*register_statement_v1_t) (const char *category, struct PSI_statement_info_v1 *info, int count); /** Socket registration API. @param category a category name (typically a plugin name) @param info an array of socket info to register @param count the size of the info array */ typedef void (*register_socket_v1_t) (const char *category, struct PSI_socket_info_v1 *info, int count); /** Mutex instrumentation initialisation API. @param key the registered mutex key @param identity the address of the mutex itself @return an instrumented mutex */ typedef struct PSI_mutex* (*init_mutex_v1_t) (PSI_mutex_key key, const void *identity); /** Mutex instrumentation destruction API. @param mutex the mutex to destroy */ typedef void (*destroy_mutex_v1_t)(struct PSI_mutex *mutex); /** Rwlock instrumentation initialisation API. @param key the registered rwlock key @param identity the address of the rwlock itself @return an instrumented rwlock */ typedef struct PSI_rwlock* (*init_rwlock_v1_t) (PSI_rwlock_key key, const void *identity); /** Rwlock instrumentation destruction API. @param rwlock the rwlock to destroy */ typedef void (*destroy_rwlock_v1_t)(struct PSI_rwlock *rwlock); /** Cond instrumentation initialisation API. @param key the registered key @param identity the address of the rwlock itself @return an instrumented cond */ typedef struct PSI_cond* (*init_cond_v1_t) (PSI_cond_key key, const void *identity); /** Cond instrumentation destruction API. @param cond the rcond to destroy */ typedef void (*destroy_cond_v1_t)(struct PSI_cond *cond); /** Socket instrumentation initialisation API. @param key the registered mutex key @param socket descriptor @param addr the socket ip address @param addr_len length of socket ip address @return an instrumented socket */ typedef struct PSI_socket* (*init_socket_v1_t) (PSI_socket_key key, const my_socket *fd, const struct sockaddr *addr, socklen_t addr_len); /** socket instrumentation destruction API. @param socket the socket to destroy */ typedef void (*destroy_socket_v1_t)(struct PSI_socket *socket); /** Acquire a table share instrumentation. @param temporary True for temporary tables @param share The SQL layer table share @return a table share instrumentation, or NULL */ typedef struct PSI_table_share* (*get_table_share_v1_t) (my_bool temporary, struct TABLE_SHARE *share); /** Release a table share. @param info the table share to release */ typedef void (*release_table_share_v1_t)(struct PSI_table_share *share); /** Drop a table share. @param temporary True for temporary tables @param schema_name the table schema name @param schema_name_length the table schema name length @param table_name the table name @param table_name_length the table name length */ typedef void (*drop_table_share_v1_t) (my_bool temporary, const char *schema_name, int schema_name_length, const char *table_name, int table_name_length); /** Open an instrumentation table handle. @param share the table to open @param identity table handle identity @return a table handle, or NULL */ typedef struct PSI_table* (*open_table_v1_t) (struct PSI_table_share *share, const void *identity); /** Unbind a table handle from the current thread. This operation happens when an opened table is added to the open table cache. @param table the table to unbind */ typedef void (*unbind_table_v1_t) (struct PSI_table *table); /** Rebind a table handle to the current thread. This operation happens when a table from the open table cache is reused for a thread. @param table the table to unbind */ typedef PSI_table* (*rebind_table_v1_t) (PSI_table_share *share, const void *identity, PSI_table *table); /** Close an instrumentation table handle. Note that the table handle is invalid after this call. @param table the table handle to close */ typedef void (*close_table_v1_t)(struct TABLE_SHARE *server_share, struct PSI_table *table); /** Create a file instrumentation for a created file. This method does not create the file itself, but is used to notify the instrumentation interface that a file was just created. @param key the file instrumentation key for this file @param name the file name @param file the file handle */ typedef void (*create_file_v1_t)(PSI_file_key key, const char *name, File file); /** Spawn a thread. This method creates a new thread, with instrumentation. @param key the instrumentation key for this thread @param thread the resulting thread @param attr the thread attributes @param start_routine the thread start routine @param arg the thread start routine argument */ typedef int (*spawn_thread_v1_t)(PSI_thread_key key, my_thread_handle *thread, const my_thread_attr_t *attr, void *(*start_routine)(void*), void *arg); /** Create instrumentation for a thread. @param key the registered key @param identity an address typical of the thread @return an instrumented thread */ typedef struct PSI_thread* (*new_thread_v1_t) (PSI_thread_key key, const void *identity, ulonglong thread_id); /** Assign a THD to an instrumented thread. @param thread the instrumented thread @param THD the sql layer THD to assign */ typedef void (*set_thread_THD_v1_t)(struct PSI_thread *thread, THD *thd); /** Assign an id to an instrumented thread. @param thread the instrumented thread @param id the id to assign */ typedef void (*set_thread_id_v1_t)(struct PSI_thread *thread, ulonglong id); /** Assign the current operating system thread id to an instrumented thread. The operating system task id is obtained from @c gettid() @param thread the instrumented thread */ typedef void (*set_thread_os_id_v1_t)(struct PSI_thread *thread); /** Get the instrumentation for the running thread. For this function to return a result, the thread instrumentation must have been attached to the running thread using @c set_thread() @return the instrumentation for the running thread */ typedef struct PSI_thread* (*get_thread_v1_t)(void); /** Assign a user name to the instrumented thread. @param user the user name @param user_len the user name length */ typedef void (*set_thread_user_v1_t)(const char *user, int user_len); /** Assign a user name and host name to the instrumented thread. @param user the user name @param user_len the user name length @param host the host name @param host_len the host name length */ typedef void (*set_thread_account_v1_t)(const char *user, int user_len, const char *host, int host_len); /** Assign a current database to the instrumented thread. @param db the database name @param db_len the database name length */ typedef void (*set_thread_db_v1_t)(const char* db, int db_len); /** Assign a current command to the instrumented thread. @param command the current command */ typedef void (*set_thread_command_v1_t)(int command); /** Assign a connection type to the instrumented thread. @param conn_type the connection type */ typedef void (*set_connection_type_v1_t)(opaque_vio_type conn_type); /** Assign a start time to the instrumented thread. @param start_time the thread start time */ typedef void (*set_thread_start_time_v1_t)(time_t start_time); /** Assign a state to the instrumented thread. @param state the thread state */ typedef void (*set_thread_state_v1_t)(const char* state); /** Assign a process info to the instrumented thread. @param info the process into string @param info_len the process into string length */ typedef void (*set_thread_info_v1_t)(const char* info, uint info_len); /** Attach a thread instrumentation to the running thread. In case of thread pools, this method should be called when a worker thread picks a work item and runs it. Also, this method should be called if the instrumented code does not keep the pointer returned by @c new_thread() and relies on @c get_thread() instead. @param thread the thread instrumentation */ typedef void (*set_thread_v1_t)(struct PSI_thread *thread); /** Delete the current thread instrumentation. */ typedef void (*delete_current_thread_v1_t)(void); /** Delete a thread instrumentation. */ typedef void (*delete_thread_v1_t)(struct PSI_thread *thread); /** Get a file instrumentation locker, for opening or creating a file. @param state data storage for the locker @param key the file instrumentation key @param op the operation to perform @param name the file name @param identity a pointer representative of this file. @return a file locker, or NULL */ typedef struct PSI_file_locker* (*get_thread_file_name_locker_v1_t) (struct PSI_file_locker_state_v1 *state, PSI_file_key key, enum PSI_file_operation op, const char *name, const void *identity); /** Get a file stream instrumentation locker. @param state data storage for the locker @param file the file stream to access @param op the operation to perform @return a file locker, or NULL */ typedef struct PSI_file_locker* (*get_thread_file_stream_locker_v1_t) (struct PSI_file_locker_state_v1 *state, struct PSI_file *file, enum PSI_file_operation op); /** Get a file instrumentation locker. @param state data storage for the locker @param file the file descriptor to access @param op the operation to perform @return a file locker, or NULL */ typedef struct PSI_file_locker* (*get_thread_file_descriptor_locker_v1_t) (struct PSI_file_locker_state_v1 *state, File file, enum PSI_file_operation op); /** Record a mutex instrumentation unlock event. @param mutex the mutex instrumentation */ typedef void (*unlock_mutex_v1_t) (struct PSI_mutex *mutex); /** Record a rwlock instrumentation unlock event. @param rwlock the rwlock instrumentation */ typedef void (*unlock_rwlock_v1_t) (struct PSI_rwlock *rwlock); /** Record a condition instrumentation signal event. @param cond the cond instrumentation */ typedef void (*signal_cond_v1_t) (struct PSI_cond *cond); /** Record a condition instrumentation broadcast event. @param cond the cond instrumentation */ typedef void (*broadcast_cond_v1_t) (struct PSI_cond *cond); /** Record an idle instrumentation wait start event. @param state data storage for the locker @param file the source file name @param line the source line number @return an idle locker, or NULL */ typedef struct PSI_idle_locker* (*start_idle_wait_v1_t) (struct PSI_idle_locker_state_v1 *state, const char *src_file, uint src_line); /** Record an idle instrumentation wait end event. @param locker a thread locker for the running thread */ typedef void (*end_idle_wait_v1_t) (struct PSI_idle_locker *locker); /** Record a mutex instrumentation wait start event. @param state data storage for the locker @param mutex the instrumented mutex to lock @param op the operation to perform @param file the source file name @param line the source line number @return a mutex locker, or NULL */ typedef struct PSI_mutex_locker* (*start_mutex_wait_v1_t) (struct PSI_mutex_locker_state_v1 *state, struct PSI_mutex *mutex, enum PSI_mutex_operation op, const char *src_file, uint src_line); /** Record a mutex instrumentation wait end event. @param locker a thread locker for the running thread @param rc the wait operation return code */ typedef void (*end_mutex_wait_v1_t) (struct PSI_mutex_locker *locker, int rc); /** Record a rwlock instrumentation read wait start event. @param locker a thread locker for the running thread @param must must block: 1 for lock, 0 for trylock */ typedef struct PSI_rwlock_locker* (*start_rwlock_rdwait_v1_t) (struct PSI_rwlock_locker_state_v1 *state, struct PSI_rwlock *rwlock, enum PSI_rwlock_operation op, const char *src_file, uint src_line); /** Record a rwlock instrumentation read wait end event. @param locker a thread locker for the running thread @param rc the wait operation return code */ typedef void (*end_rwlock_rdwait_v1_t) (struct PSI_rwlock_locker *locker, int rc); /** Record a rwlock instrumentation write wait start event. @param locker a thread locker for the running thread @param must must block: 1 for lock, 0 for trylock */ typedef struct PSI_rwlock_locker* (*start_rwlock_wrwait_v1_t) (struct PSI_rwlock_locker_state_v1 *state, struct PSI_rwlock *rwlock, enum PSI_rwlock_operation op, const char *src_file, uint src_line); /** Record a rwlock instrumentation write wait end event. @param locker a thread locker for the running thread @param rc the wait operation return code */ typedef void (*end_rwlock_wrwait_v1_t) (struct PSI_rwlock_locker *locker, int rc); /** Record a condition instrumentation wait start event. @param locker a thread locker for the running thread @param must must block: 1 for wait, 0 for timedwait */ typedef struct PSI_cond_locker* (*start_cond_wait_v1_t) (struct PSI_cond_locker_state_v1 *state, struct PSI_cond *cond, struct PSI_mutex *mutex, enum PSI_cond_operation op, const char *src_file, uint src_line); /** Record a condition instrumentation wait end event. @param locker a thread locker for the running thread @param rc the wait operation return code */ typedef void (*end_cond_wait_v1_t) (struct PSI_cond_locker *locker, int rc); /** Record a table instrumentation io wait start event. @param locker a table locker for the running thread @param file the source file name @param line the source line number */ typedef struct PSI_table_locker* (*start_table_io_wait_v1_t) (struct PSI_table_locker_state *state, struct PSI_table *table, enum PSI_table_io_operation op, uint index, const char *src_file, uint src_line); /** Record a table instrumentation io wait end event. @param locker a table locker for the running thread @param numrows the number of rows involved in io */ typedef void (*end_table_io_wait_v1_t) (struct PSI_table_locker *locker, ulonglong numrows); /** Record a table instrumentation lock wait start event. @param locker a table locker for the running thread @param file the source file name @param line the source line number */ typedef struct PSI_table_locker* (*start_table_lock_wait_v1_t) (struct PSI_table_locker_state *state, struct PSI_table *table, enum PSI_table_lock_operation op, ulong flags, const char *src_file, uint src_line); /** Record a table instrumentation lock wait end event. @param locker a table locker for the running thread */ typedef void (*end_table_lock_wait_v1_t)(struct PSI_table_locker *locker); typedef void (*unlock_table_v1_t)(struct PSI_table *table); /** Start a file instrumentation open operation. @param locker the file locker @param op the operation to perform @param src_file the source file name @param src_line the source line number */ typedef void (*start_file_open_wait_v1_t) (struct PSI_file_locker *locker, const char *src_file, uint src_line); /** End a file instrumentation open operation, for file streams. @param locker the file locker. @param result the opened file (NULL indicates failure, non NULL success). @return an instrumented file handle */ typedef struct PSI_file* (*end_file_open_wait_v1_t) (struct PSI_file_locker *locker, void *result); /** End a file instrumentation open operation, for non stream files. @param locker the file locker. @param file the file number assigned by open() or create() for this file. */ typedef void (*end_file_open_wait_and_bind_to_descriptor_v1_t) (struct PSI_file_locker *locker, File file); /** End a file instrumentation open operation, for non stream temporary files. @param locker the file locker. @param file the file number assigned by open() or create() for this file. @param filename the file name generated during temporary file creation. */ typedef void (*end_temp_file_open_wait_and_bind_to_descriptor_v1_t) (struct PSI_file_locker *locker, File file, const char *filename); /** Record a file instrumentation start event. @param locker a file locker for the running thread @param op file operation to be performed @param count the number of bytes requested, or 0 if not applicable @param src_file the source file name @param src_line the source line number */ typedef void (*start_file_wait_v1_t) (struct PSI_file_locker *locker, size_t count, const char *src_file, uint src_line); /** Record a file instrumentation end event. Note that for file close operations, the instrumented file handle associated with the file (which was provided to obtain a locker) is invalid after this call. @param locker a file locker for the running thread @param count the number of bytes actually used in the operation, or 0 if not applicable, or -1 if the operation failed @sa get_thread_file_name_locker @sa get_thread_file_stream_locker @sa get_thread_file_descriptor_locker */ typedef void (*end_file_wait_v1_t) (struct PSI_file_locker *locker, size_t count); /** Start a file instrumentation close operation. @param locker the file locker @param op the operation to perform @param src_file the source file name @param src_line the source line number */ typedef void (*start_file_close_wait_v1_t) (struct PSI_file_locker *locker, const char *src_file, uint src_line); /** End a file instrumentation close operation. @param locker the file locker. @param rc the close operation return code (0 for success). @return an instrumented file handle */ typedef void (*end_file_close_wait_v1_t) (struct PSI_file_locker *locker, int rc); /** Rename a file instrumentation close operation. @param locker the file locker. @param old_name name of the file to be renamed. @param new_name name of the file after rename. @param rc the rename operation return code (0 for success). */ typedef void (*end_file_rename_wait_v1_t) (struct PSI_file_locker *locker, const char *old_name, const char *new_name, int rc); /** Start a new stage, and implicitly end the previous stage. @param key the key of the new stage @param src_file the source file name @param src_line the source line number @return the new stage progress */ typedef PSI_stage_progress* (*start_stage_v1_t) (PSI_stage_key key, const char *src_file, int src_line); typedef PSI_stage_progress* (*get_current_stage_progress_v1_t)(void); /** End the current stage. */ typedef void (*end_stage_v1_t) (void); /** Get a statement instrumentation locker. @param state data storage for the locker @param key the statement instrumentation key @param charset client character set @return a statement locker, or NULL */ typedef struct PSI_statement_locker* (*get_thread_statement_locker_v1_t) (struct PSI_statement_locker_state_v1 *state, PSI_statement_key key, const void *charset, PSI_sp_share *sp_share); /** Refine a statement locker to a more specific key. Note that only events declared mutable can be refined. @param the statement locker for the current event @param key the new key for the event @sa PSI_FLAG_MUTABLE */ typedef struct PSI_statement_locker* (*refine_statement_v1_t) (struct PSI_statement_locker *locker, PSI_statement_key key); /** Start a new statement event. @param locker the statement locker for this event @param db the active database name for this statement @param db_length the active database name length for this statement @param src_file source file name @param src_line source line number */ typedef void (*start_statement_v1_t) (struct PSI_statement_locker *locker, const char *db, uint db_length, const char *src_file, uint src_line); /** Set the statement text for a statement event. @param locker the current statement locker @param text the statement text @param text_len the statement text length */ typedef void (*set_statement_text_v1_t) (struct PSI_statement_locker *locker, const char *text, uint text_len); /** Set a statement event lock time. @param locker the statement locker @param lock_time the locked time, in microseconds */ typedef void (*set_statement_lock_time_t) (struct PSI_statement_locker *locker, ulonglong lock_time); /** Set a statement event rows sent metric. @param locker the statement locker @param count the number of rows sent */ typedef void (*set_statement_rows_sent_t) (struct PSI_statement_locker *locker, ulonglong count); /** Set a statement event rows examined metric. @param locker the statement locker @param count the number of rows examined */ typedef void (*set_statement_rows_examined_t) (struct PSI_statement_locker *locker, ulonglong count); /** Increment a statement event "created tmp disk tables" metric. @param locker the statement locker @param count the metric increment value */ typedef void (*inc_statement_created_tmp_disk_tables_t) (struct PSI_statement_locker *locker, ulong count); /** Increment a statement event "created tmp tables" metric. @param locker the statement locker @param count the metric increment value */ typedef void (*inc_statement_created_tmp_tables_t) (struct PSI_statement_locker *locker, ulong count); /** Increment a statement event "select full join" metric. @param locker the statement locker @param count the metric increment value */ typedef void (*inc_statement_select_full_join_t) (struct PSI_statement_locker *locker, ulong count); /** Increment a statement event "select full range join" metric. @param locker the statement locker @param count the metric increment value */ typedef void (*inc_statement_select_full_range_join_t) (struct PSI_statement_locker *locker, ulong count); /** Increment a statement event "select range join" metric. @param locker the statement locker @param count the metric increment value */ typedef void (*inc_statement_select_range_t) (struct PSI_statement_locker *locker, ulong count); /** Increment a statement event "select range check" metric. @param locker the statement locker @param count the metric increment value */ typedef void (*inc_statement_select_range_check_t) (struct PSI_statement_locker *locker, ulong count); /** Increment a statement event "select scan" metric. @param locker the statement locker @param count the metric increment value */ typedef void (*inc_statement_select_scan_t) (struct PSI_statement_locker *locker, ulong count); /** Increment a statement event "sort merge passes" metric. @param locker the statement locker @param count the metric increment value */ typedef void (*inc_statement_sort_merge_passes_t) (struct PSI_statement_locker *locker, ulong count); /** Increment a statement event "sort range" metric. @param locker the statement locker @param count the metric increment value */ typedef void (*inc_statement_sort_range_t) (struct PSI_statement_locker *locker, ulong count); /** Increment a statement event "sort rows" metric. @param locker the statement locker @param count the metric increment value */ typedef void (*inc_statement_sort_rows_t) (struct PSI_statement_locker *locker, ulong count); /** Increment a statement event "sort scan" metric. @param locker the statement locker @param count the metric increment value */ typedef void (*inc_statement_sort_scan_t) (struct PSI_statement_locker *locker, ulong count); /** Set a statement event "no index used" metric. @param locker the statement locker @param count the metric value */ typedef void (*set_statement_no_index_used_t) (struct PSI_statement_locker *locker); /** Set a statement event "no good index used" metric. @param locker the statement locker @param count the metric value */ typedef void (*set_statement_no_good_index_used_t) (struct PSI_statement_locker *locker); /** End a statement event. @param locker the statement locker @param stmt_da the statement diagnostics area. @sa Diagnostics_area */ typedef void (*end_statement_v1_t) (struct PSI_statement_locker *locker, void *stmt_da); /** Get a transaction instrumentation locker. @param state data storage for the locker @param xid the xid for this transaction @param trxid the InnoDB transaction id @param iso_level isolation level for this transaction @param read_only true if transaction access mode is read-only @param autocommit true if transaction is autocommit @return a transaction locker, or NULL */ typedef struct PSI_transaction_locker* (*get_thread_transaction_locker_v1_t) (struct PSI_transaction_locker_state_v1 *state, const void *xid, const ulonglong *trxid, int isolation_level, my_bool read_only, my_bool autocommit); /** Start a new transaction event. @param locker the transaction locker for this event @param src_file source file name @param src_line source line number */ typedef void (*start_transaction_v1_t) (struct PSI_transaction_locker *locker, const char *src_file, uint src_line); /** Set the transaction xid. @param locker the transaction locker for this event @param xid the id of the XA transaction #param xa_state is the state of the XA transaction */ typedef void (*set_transaction_xid_v1_t) (struct PSI_transaction_locker *locker, const void *xid, int xa_state); /** Set the state of the XA transaction. @param locker the transaction locker for this event @param xa_state the new state of the xa transaction */ typedef void (*set_transaction_xa_state_v1_t) (struct PSI_transaction_locker *locker, int xa_state); /** Set the transaction gtid. @param locker the transaction locker for this event @param sid the source id for the transaction, mapped from sidno @param gtid_spec the gtid specifier for the transaction */ typedef void (*set_transaction_gtid_v1_t) (struct PSI_transaction_locker *locker, const void *sid, const void *gtid_spec); /** Set the transaction trx_id. @param locker the transaction locker for this event @param trxid the storage engine transaction ID */ typedef void (*set_transaction_trxid_v1_t) (struct PSI_transaction_locker *locker, const ulonglong *trxid); /** Increment a transaction event savepoint count. @param locker the transaction locker @param count the increment value */ typedef void (*inc_transaction_savepoints_v1_t) (struct PSI_transaction_locker *locker, ulong count); /** Increment a transaction event rollback to savepoint count. @param locker the transaction locker @param count the increment value */ typedef void (*inc_transaction_rollback_to_savepoint_v1_t) (struct PSI_transaction_locker *locker, ulong count); /** Increment a transaction event release savepoint count. @param locker the transaction locker @param count the increment value */ typedef void (*inc_transaction_release_savepoint_v1_t) (struct PSI_transaction_locker *locker, ulong count); /** Commit or rollback the transaction. @param locker the transaction locker for this event @param commit true if transaction was committed, false if rolled back */ typedef void (*end_transaction_v1_t) (struct PSI_transaction_locker *locker, my_bool commit); /** Record a socket instrumentation start event. @param locker a socket locker for the running thread @param op socket operation to be performed @param count the number of bytes requested, or 0 if not applicable @param src_file the source file name @param src_line the source line number */ typedef struct PSI_socket_locker* (*start_socket_wait_v1_t) (struct PSI_socket_locker_state_v1 *state, struct PSI_socket *socket, enum PSI_socket_operation op, size_t count, const char *src_file, uint src_line); /** Record a socket instrumentation end event. Note that for socket close operations, the instrumented socket handle associated with the socket (which was provided to obtain a locker) is invalid after this call. @param locker a socket locker for the running thread @param count the number of bytes actually used in the operation, or 0 if not applicable, or -1 if the operation failed @sa get_thread_socket_locker */ typedef void (*end_socket_wait_v1_t) (struct PSI_socket_locker *locker, size_t count); /** Set the socket state for an instrumented socket. @param socket the instrumented socket @param state socket state */ typedef void (*set_socket_state_v1_t)(struct PSI_socket *socket, enum PSI_socket_state state); /** Set the socket info for an instrumented socket. @param socket the instrumented socket @param fd the socket descriptor @param addr the socket ip address @param addr_len length of socket ip address @param thread_id associated thread id */ typedef void (*set_socket_info_v1_t)(struct PSI_socket *socket, const my_socket *fd, const struct sockaddr *addr, socklen_t addr_len); /** Bind a socket to the thread that owns it. @param socket instrumented socket */ typedef void (*set_socket_thread_owner_v1_t)(struct PSI_socket *socket); /** Get a prepare statement. @param locker a statement locker for the running thread. */ typedef PSI_prepared_stmt* (*create_prepared_stmt_v1_t) (void *identity, uint stmt_id, PSI_statement_locker *locker, const char *stmt_name, size_t stmt_name_length, const char *name, size_t length); /** destroy a prepare statement. @param prepared_stmt prepared statement. */ typedef void (*destroy_prepared_stmt_v1_t) (PSI_prepared_stmt *prepared_stmt); /** repreare a prepare statement. @param prepared_stmt prepared statement. */ typedef void (*reprepare_prepared_stmt_v1_t) (PSI_prepared_stmt *prepared_stmt); /** Record a prepare statement instrumentation execute event. @param locker a statement locker for the running thread. @param prepared_stmt prepared statement. */ typedef void (*execute_prepared_stmt_v1_t) (PSI_statement_locker *locker, PSI_prepared_stmt* prepared_stmt); /** Set the statement text for a prepared statment event. @param prepared_stmt prepared statement. @param text the prepared statement text @param text_len the prepared statement text length */ typedef void (*set_prepared_stmt_text_v1_t)(PSI_prepared_stmt *prepared_stmt, const char *text, uint text_len); /** Get a digest locker for the current statement. @param locker a statement locker for the running thread */ typedef struct PSI_digest_locker * (*digest_start_v1_t) (struct PSI_statement_locker *locker); /** Add a token to the current digest instrumentation. @param locker a digest locker for the current statement @param token the lexical token to add @param yylval the lexical token attributes */ typedef void (*digest_end_v1_t) (struct PSI_digest_locker *locker, const struct sql_digest_storage *digest); typedef PSI_sp_locker* (*start_sp_v1_t) (struct PSI_sp_locker_state_v1 *state, struct PSI_sp_share* sp_share); typedef void (*end_sp_v1_t) (struct PSI_sp_locker *locker); typedef void (*drop_sp_v1_t) (uint object_type, const char *schema_name, uint schema_name_length, const char *object_name, uint object_name_length); /** Acquire a sp share instrumentation. @param type of stored program @param schema name of stored program @param name of stored program @return a stored program share instrumentation, or NULL */ typedef struct PSI_sp_share* (*get_sp_share_v1_t) (uint object_type, const char *schema_name, uint schema_name_length, const char *object_name, uint object_name_length); /** Release a stored program share. @param info the stored program share to release */ typedef void (*release_sp_share_v1_t)(struct PSI_sp_share *share); typedef PSI_metadata_lock* (*create_metadata_lock_v1_t) (void *identity, const MDL_key *key, opaque_mdl_type mdl_type, opaque_mdl_duration mdl_duration, opaque_mdl_status mdl_status, const char *src_file, uint src_line); typedef void (*set_metadata_lock_status_v1_t)(PSI_metadata_lock *lock, opaque_mdl_status mdl_status); typedef void (*destroy_metadata_lock_v1_t)(PSI_metadata_lock *lock); typedef struct PSI_metadata_locker* (*start_metadata_wait_v1_t) (struct PSI_metadata_locker_state_v1 *state, struct PSI_metadata_lock *mdl, const char *src_file, uint src_line); typedef void (*end_metadata_wait_v1_t) (struct PSI_metadata_locker *locker, int rc); /** Stores an array of connection attributes @param buffer char array of length encoded connection attributes in network format @param length length of the data in buffer @param from_cs charset in which @c buffer is encoded @return state @retval non_0 attributes truncated @retval 0 stored the attribute */ typedef int (*set_thread_connect_attrs_v1_t)(const char *buffer, uint length, const void *from_cs); /** Performance Schema Interface, version 1. @since PSI_VERSION_1 */ struct PSI_v1 { /** @sa register_mutex_v1_t. */ register_mutex_v1_t register_mutex; /** @sa register_rwlock_v1_t. */ register_rwlock_v1_t register_rwlock; /** @sa register_cond_v1_t. */ register_cond_v1_t register_cond; /** @sa register_thread_v1_t. */ register_thread_v1_t register_thread; /** @sa register_file_v1_t. */ register_file_v1_t register_file; /** @sa register_stage_v1_t. */ register_stage_v1_t register_stage; /** @sa register_statement_v1_t. */ register_statement_v1_t register_statement; /** @sa register_socket_v1_t. */ register_socket_v1_t register_socket; /** @sa init_mutex_v1_t. */ init_mutex_v1_t init_mutex; /** @sa destroy_mutex_v1_t. */ destroy_mutex_v1_t destroy_mutex; /** @sa init_rwlock_v1_t. */ init_rwlock_v1_t init_rwlock; /** @sa destroy_rwlock_v1_t. */ destroy_rwlock_v1_t destroy_rwlock; /** @sa init_cond_v1_t. */ init_cond_v1_t init_cond; /** @sa destroy_cond_v1_t. */ destroy_cond_v1_t destroy_cond; /** @sa init_socket_v1_t. */ init_socket_v1_t init_socket; /** @sa destroy_socket_v1_t. */ destroy_socket_v1_t destroy_socket; /** @sa get_table_share_v1_t. */ get_table_share_v1_t get_table_share; /** @sa release_table_share_v1_t. */ release_table_share_v1_t release_table_share; /** @sa drop_table_share_v1_t. */ drop_table_share_v1_t drop_table_share; /** @sa open_table_v1_t. */ open_table_v1_t open_table; /** @sa unbind_table_v1_t. */ unbind_table_v1_t unbind_table; /** @sa rebind_table_v1_t. */ rebind_table_v1_t rebind_table; /** @sa close_table_v1_t. */ close_table_v1_t close_table; /** @sa create_file_v1_t. */ create_file_v1_t create_file; /** @sa spawn_thread_v1_t. */ spawn_thread_v1_t spawn_thread; /** @sa new_thread_v1_t. */ new_thread_v1_t new_thread; /** @sa set_thread_id_v1_t. */ set_thread_id_v1_t set_thread_id; /** @sa set_thread_THD_v1_t. */ set_thread_THD_v1_t set_thread_THD; /** @sa set_thread_os_id_v1_t. */ set_thread_os_id_v1_t set_thread_os_id; /** @sa get_thread_v1_t. */ get_thread_v1_t get_thread; /** @sa set_thread_user_v1_t. */ set_thread_user_v1_t set_thread_user; /** @sa set_thread_account_v1_t. */ set_thread_account_v1_t set_thread_account; /** @sa set_thread_db_v1_t. */ set_thread_db_v1_t set_thread_db; /** @sa set_thread_command_v1_t. */ set_thread_command_v1_t set_thread_command; /** @sa set_connection_type_v1_t. */ set_connection_type_v1_t set_connection_type; /** @sa set_thread_start_time_v1_t. */ set_thread_start_time_v1_t set_thread_start_time; /** @sa set_thread_state_v1_t. */ set_thread_state_v1_t set_thread_state; /** @sa set_thread_info_v1_t. */ set_thread_info_v1_t set_thread_info; /** @sa set_thread_v1_t. */ set_thread_v1_t set_thread; /** @sa delete_current_thread_v1_t. */ delete_current_thread_v1_t delete_current_thread; /** @sa delete_thread_v1_t. */ delete_thread_v1_t delete_thread; /** @sa get_thread_file_name_locker_v1_t. */ get_thread_file_name_locker_v1_t get_thread_file_name_locker; /** @sa get_thread_file_stream_locker_v1_t. */ get_thread_file_stream_locker_v1_t get_thread_file_stream_locker; /** @sa get_thread_file_descriptor_locker_v1_t. */ get_thread_file_descriptor_locker_v1_t get_thread_file_descriptor_locker; /** @sa unlock_mutex_v1_t. */ unlock_mutex_v1_t unlock_mutex; /** @sa unlock_rwlock_v1_t. */ unlock_rwlock_v1_t unlock_rwlock; /** @sa signal_cond_v1_t. */ signal_cond_v1_t signal_cond; /** @sa broadcast_cond_v1_t. */ broadcast_cond_v1_t broadcast_cond; /** @sa start_idle_wait_v1_t. */ start_idle_wait_v1_t start_idle_wait; /** @sa end_idle_wait_v1_t. */ end_idle_wait_v1_t end_idle_wait; /** @sa start_mutex_wait_v1_t. */ start_mutex_wait_v1_t start_mutex_wait; /** @sa end_mutex_wait_v1_t. */ end_mutex_wait_v1_t end_mutex_wait; /** @sa start_rwlock_rdwait_v1_t. */ start_rwlock_rdwait_v1_t start_rwlock_rdwait; /** @sa end_rwlock_rdwait_v1_t. */ end_rwlock_rdwait_v1_t end_rwlock_rdwait; /** @sa start_rwlock_wrwait_v1_t. */ start_rwlock_wrwait_v1_t start_rwlock_wrwait; /** @sa end_rwlock_wrwait_v1_t. */ end_rwlock_wrwait_v1_t end_rwlock_wrwait; /** @sa start_cond_wait_v1_t. */ start_cond_wait_v1_t start_cond_wait; /** @sa end_cond_wait_v1_t. */ end_cond_wait_v1_t end_cond_wait; /** @sa start_table_io_wait_v1_t. */ start_table_io_wait_v1_t start_table_io_wait; /** @sa end_table_io_wait_v1_t. */ end_table_io_wait_v1_t end_table_io_wait; /** @sa start_table_lock_wait_v1_t. */ start_table_lock_wait_v1_t start_table_lock_wait; /** @sa end_table_lock_wait_v1_t. */ end_table_lock_wait_v1_t end_table_lock_wait; /** @sa start_file_open_wait_v1_t. */ start_file_open_wait_v1_t start_file_open_wait; /** @sa end_file_open_wait_v1_t. */ end_file_open_wait_v1_t end_file_open_wait; /** @sa end_file_open_wait_and_bind_to_descriptor_v1_t. */ end_file_open_wait_and_bind_to_descriptor_v1_t end_file_open_wait_and_bind_to_descriptor; /** @sa end_temp_file_open_wait_and_bind_to_descriptor_v1_t. */ end_temp_file_open_wait_and_bind_to_descriptor_v1_t end_temp_file_open_wait_and_bind_to_descriptor; /** @sa start_file_wait_v1_t. */ start_file_wait_v1_t start_file_wait; /** @sa end_file_wait_v1_t. */ end_file_wait_v1_t end_file_wait; /** @sa start_file_close_wait_v1_t. */ start_file_close_wait_v1_t start_file_close_wait; /** @sa end_file_close_wait_v1_t. */ end_file_close_wait_v1_t end_file_close_wait; /** @sa rename_file_close_wait_v1_t. */ end_file_rename_wait_v1_t end_file_rename_wait; /** @sa start_stage_v1_t. */ start_stage_v1_t start_stage; /** @sa get_current_stage_progress_v1_t. */ get_current_stage_progress_v1_t get_current_stage_progress; /** @sa end_stage_v1_t. */ end_stage_v1_t end_stage; /** @sa get_thread_statement_locker_v1_t. */ get_thread_statement_locker_v1_t get_thread_statement_locker; /** @sa refine_statement_v1_t. */ refine_statement_v1_t refine_statement; /** @sa start_statement_v1_t. */ start_statement_v1_t start_statement; /** @sa set_statement_text_v1_t. */ set_statement_text_v1_t set_statement_text; /** @sa set_statement_lock_time_t. */ set_statement_lock_time_t set_statement_lock_time; /** @sa set_statement_rows_sent_t. */ set_statement_rows_sent_t set_statement_rows_sent; /** @sa set_statement_rows_examined_t. */ set_statement_rows_examined_t set_statement_rows_examined; /** @sa inc_statement_created_tmp_disk_tables. */ inc_statement_created_tmp_disk_tables_t inc_statement_created_tmp_disk_tables; /** @sa inc_statement_created_tmp_tables. */ inc_statement_created_tmp_tables_t inc_statement_created_tmp_tables; /** @sa inc_statement_select_full_join. */ inc_statement_select_full_join_t inc_statement_select_full_join; /** @sa inc_statement_select_full_range_join. */ inc_statement_select_full_range_join_t inc_statement_select_full_range_join; /** @sa inc_statement_select_range. */ inc_statement_select_range_t inc_statement_select_range; /** @sa inc_statement_select_range_check. */ inc_statement_select_range_check_t inc_statement_select_range_check; /** @sa inc_statement_select_scan. */ inc_statement_select_scan_t inc_statement_select_scan; /** @sa inc_statement_sort_merge_passes. */ inc_statement_sort_merge_passes_t inc_statement_sort_merge_passes; /** @sa inc_statement_sort_range. */ inc_statement_sort_range_t inc_statement_sort_range; /** @sa inc_statement_sort_rows. */ inc_statement_sort_rows_t inc_statement_sort_rows; /** @sa inc_statement_sort_scan. */ inc_statement_sort_scan_t inc_statement_sort_scan; /** @sa set_statement_no_index_used. */ set_statement_no_index_used_t set_statement_no_index_used; /** @sa set_statement_no_good_index_used. */ set_statement_no_good_index_used_t set_statement_no_good_index_used; /** @sa end_statement_v1_t. */ end_statement_v1_t end_statement; /** @sa get_thread_transaction_locker_v1_t. */ get_thread_transaction_locker_v1_t get_thread_transaction_locker; /** @sa start_transaction_v1_t. */ start_transaction_v1_t start_transaction; /** @sa set_transaction_xid_v1_t. */ set_transaction_xid_v1_t set_transaction_xid; /** @sa set_transaction_xa_state_v1_t. */ set_transaction_xa_state_v1_t set_transaction_xa_state; /** @sa set_transaction_gtid_v1_t. */ set_transaction_gtid_v1_t set_transaction_gtid; /** @sa set_transaction_trxid_v1_t. */ set_transaction_trxid_v1_t set_transaction_trxid; /** @sa inc_transaction_savepoints_v1_t. */ inc_transaction_savepoints_v1_t inc_transaction_savepoints; /** @sa inc_transaction_rollback_to_savepoint_v1_t. */ inc_transaction_rollback_to_savepoint_v1_t inc_transaction_rollback_to_savepoint; /** @sa inc_transaction_release_savepoint_v1_t. */ inc_transaction_release_savepoint_v1_t inc_transaction_release_savepoint; /** @sa end_transaction_v1_t. */ end_transaction_v1_t end_transaction; /** @sa start_socket_wait_v1_t. */ start_socket_wait_v1_t start_socket_wait; /** @sa end_socket_wait_v1_t. */ end_socket_wait_v1_t end_socket_wait; /** @sa set_socket_state_v1_t. */ set_socket_state_v1_t set_socket_state; /** @sa set_socket_info_v1_t. */ set_socket_info_v1_t set_socket_info; /** @sa set_socket_thread_owner_v1_t. */ set_socket_thread_owner_v1_t set_socket_thread_owner; /** @sa create_prepared_stmt_v1_t. */ create_prepared_stmt_v1_t create_prepared_stmt; /** @sa destroy_prepared_stmt_v1_t. */ destroy_prepared_stmt_v1_t destroy_prepared_stmt; /** @sa reprepare_prepared_stmt_v1_t. */ reprepare_prepared_stmt_v1_t reprepare_prepared_stmt; /** @sa execute_prepared_stmt_v1_t. */ execute_prepared_stmt_v1_t execute_prepared_stmt; /** @sa set_prepared_stmt_text_v1_t. */ set_prepared_stmt_text_v1_t set_prepared_stmt_text; /** @sa digest_start_v1_t. */ digest_start_v1_t digest_start; /** @sa digest_end_v1_t. */ digest_end_v1_t digest_end; /** @sa set_thread_connect_attrs_v1_t. */ set_thread_connect_attrs_v1_t set_thread_connect_attrs; /** @sa start_sp_v1_t. */ start_sp_v1_t start_sp; /** @sa start_sp_v1_t. */ end_sp_v1_t end_sp; /** @sa drop_sp_v1_t. */ drop_sp_v1_t drop_sp; /** @sa get_sp_share_v1_t. */ get_sp_share_v1_t get_sp_share; /** @sa release_sp_share_v1_t. */ release_sp_share_v1_t release_sp_share; /** @sa register_memory_v1_t. */ register_memory_v1_t register_memory; /** @sa memory_alloc_v1_t. */ memory_alloc_v1_t memory_alloc; /** @sa memory_realloc_v1_t. */ memory_realloc_v1_t memory_realloc; /** @sa memory_claim_v1_t. */ memory_claim_v1_t memory_claim; /** @sa memory_free_v1_t. */ memory_free_v1_t memory_free; unlock_table_v1_t unlock_table; create_metadata_lock_v1_t create_metadata_lock; set_metadata_lock_status_v1_t set_metadata_lock_status; destroy_metadata_lock_v1_t destroy_metadata_lock; start_metadata_wait_v1_t start_metadata_wait; end_metadata_wait_v1_t end_metadata_wait; }; /** @} (end of group Group_PSI_v1) */ #endif /* HAVE_PSI_1 */ #ifdef USE_PSI_2 #define HAVE_PSI_2 #endif #ifdef HAVE_PSI_2 /** @defgroup Group_PSI_v2 Application Binary Interface, version 2 @ingroup Instrumentation_interface @{ */ /** Performance Schema Interface, version 2. This is a placeholder, this interface is not defined yet. @since PSI_VERSION_2 */ struct PSI_v2 { /** Placeholder */ int placeholder; /* ... extended interface ... */ }; /** Placeholder */ struct PSI_mutex_info_v2 { /** Placeholder */ int placeholder; }; /** Placeholder */ struct PSI_rwlock_info_v2 { /** Placeholder */ int placeholder; }; /** Placeholder */ struct PSI_cond_info_v2 { /** Placeholder */ int placeholder; }; /** Placeholder */ struct PSI_thread_info_v2 { /** Placeholder */ int placeholder; }; /** Placeholder */ struct PSI_file_info_v2 { /** Placeholder */ int placeholder; }; /** Placeholder */ struct PSI_stage_info_v2 { /** Placeholder */ int placeholder; }; /** Placeholder */ struct PSI_statement_info_v2 { /** Placeholder */ int placeholder; }; /** Placeholder */ struct PSI_transaction_info_v2 { /** Placeholder */ int placeholder; }; /** Placeholder */ struct PSI_idle_locker_state_v2 { /** Placeholder */ int placeholder; }; /** Placeholder */ struct PSI_mutex_locker_state_v2 { /** Placeholder */ int placeholder; }; /** Placeholder */ struct PSI_rwlock_locker_state_v2 { /** Placeholder */ int placeholder; }; /** Placeholder */ struct PSI_cond_locker_state_v2 { /** Placeholder */ int placeholder; }; /** Placeholder */ struct PSI_file_locker_state_v2 { /** Placeholder */ int placeholder; }; /** Placeholder */ struct PSI_statement_locker_state_v2 { /** Placeholder */ int placeholder; }; /** Placeholder */ struct PSI_transaction_locker_state_v2 { /** Placeholder */ int placeholder; }; /** Placeholder */ struct PSI_socket_locker_state_v2 { /** Placeholder */ int placeholder; }; struct PSI_metadata_locker_state_v2 { int placeholder; }; /** @} (end of group Group_PSI_v2) */ #endif /* HAVE_PSI_2 */ /** @typedef PSI The instrumentation interface for the current version. @sa PSI_CURRENT_VERSION */ /** @typedef PSI_mutex_info The mutex information structure for the current version. */ /** @typedef PSI_rwlock_info The rwlock information structure for the current version. */ /** @typedef PSI_cond_info The cond information structure for the current version. */ /** @typedef PSI_thread_info The thread information structure for the current version. */ /** @typedef PSI_file_info The file information structure for the current version. */ /* Export the required version */ #ifdef USE_PSI_1 typedef struct PSI_v1 PSI; typedef struct PSI_mutex_info_v1 PSI_mutex_info; typedef struct PSI_rwlock_info_v1 PSI_rwlock_info; typedef struct PSI_cond_info_v1 PSI_cond_info; typedef struct PSI_thread_info_v1 PSI_thread_info; typedef struct PSI_file_info_v1 PSI_file_info; typedef struct PSI_stage_info_v1 PSI_stage_info; typedef struct PSI_statement_info_v1 PSI_statement_info; typedef struct PSI_transaction_info_v1 PSI_transaction_info; typedef struct PSI_socket_info_v1 PSI_socket_info; typedef struct PSI_idle_locker_state_v1 PSI_idle_locker_state; typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state; typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state; typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state; typedef struct PSI_file_locker_state_v1 PSI_file_locker_state; typedef struct PSI_statement_locker_state_v1 PSI_statement_locker_state; typedef struct PSI_transaction_locker_state_v1 PSI_transaction_locker_state; typedef struct PSI_socket_locker_state_v1 PSI_socket_locker_state; typedef struct PSI_sp_locker_state_v1 PSI_sp_locker_state; typedef struct PSI_metadata_locker_state_v1 PSI_metadata_locker_state; #endif #ifdef USE_PSI_2 typedef struct PSI_v2 PSI; typedef struct PSI_mutex_info_v2 PSI_mutex_info; typedef struct PSI_rwlock_info_v2 PSI_rwlock_info; typedef struct PSI_cond_info_v2 PSI_cond_info; typedef struct PSI_thread_info_v2 PSI_thread_info; typedef struct PSI_file_info_v2 PSI_file_info; typedef struct PSI_stage_info_v2 PSI_stage_info; typedef struct PSI_statement_info_v2 PSI_statement_info; typedef struct PSI_transaction_info_v2 PSI_transaction_info; typedef struct PSI_socket_info_v2 PSI_socket_info; typedef struct PSI_idle_locker_state_v2 PSI_idle_locker_state; typedef struct PSI_mutex_locker_state_v2 PSI_mutex_locker_state; typedef struct PSI_rwlock_locker_state_v2 PSI_rwlock_locker_state; typedef struct PSI_cond_locker_state_v2 PSI_cond_locker_state; typedef struct PSI_file_locker_state_v2 PSI_file_locker_state; typedef struct PSI_statement_locker_state_v2 PSI_statement_locker_state; typedef struct PSI_transaction_locker_state_v2 PSI_transaction_locker_state; typedef struct PSI_socket_locker_state_v2 PSI_socket_locker_state; typedef struct PSI_sp_locker_state_v2 PSI_sp_locker_state; typedef struct PSI_metadata_locker_state_v2 PSI_metadata_locker_state; #endif #else /* HAVE_PSI_INTERFACE */ /** Dummy structure, used to declare PSI_server when no instrumentation is available. The content does not matter, since PSI_server will be NULL. */ struct PSI_none { int opaque; }; typedef struct PSI_none PSI; /** Stage instrument information. @since PSI_VERSION_1 This structure is used to register an instrumented stage. */ struct PSI_stage_info_none { /** Unused stage key. */ unsigned int m_key; /** The name of the stage instrument. */ const char *m_name; /** Unused stage flags. */ int m_flags; }; /** The stage instrumentation has to co exist with the legacy THD::set_proc_info instrumentation. To avoid duplication of the instrumentation in the server, the common PSI_stage_info structure is used, so we export it here, even when not building with HAVE_PSI_INTERFACE. */ typedef struct PSI_stage_info_none PSI_stage_info; #endif /* HAVE_PSI_INTERFACE */ extern MYSQL_PLUGIN_IMPORT PSI *PSI_server; /* Allow to override PSI_XXX_CALL at compile time with more efficient implementations, if available. If nothing better is available, make a dynamic call using the PSI_server function pointer. */ #define PSI_DYNAMIC_CALL(M) PSI_server->M /** @} */ C_MODE_END #endif /* MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/psi/mysql_socket.h����������������������������������������������������������������������0000644�����������������00000100704�14763166026�0012554 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2010, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_SOCKET_H #define MYSQL_SOCKET_H /* For strlen() */ #include <string.h> /* For MY_STAT */ #include <my_dir.h> /* For my_chsize */ #include <my_sys.h> /* For socket api */ #ifdef _WIN32 #include <ws2def.h> #include <winsock2.h> #include <MSWSock.h> #define SOCKBUF_T char #else #include <netinet/in.h> #define SOCKBUF_T void #endif /** @file mysql/psi/mysql_socket.h [...] */ #include "mysql/psi/psi.h" #ifndef PSI_SOCKET_CALL #define PSI_SOCKET_CALL(M) PSI_DYNAMIC_CALL(M) #endif /** @defgroup Socket_instrumentation Socket Instrumentation @ingroup Instrumentation_interface @{ */ /** @def mysql_socket_register(P1, P2, P3) Socket registration. */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define mysql_socket_register(P1, P2, P3) \ inline_mysql_socket_register(P1, P2, P3) #else #define mysql_socket_register(P1, P2, P3) \ do {} while (0) #endif /** An instrumented socket. */ struct st_mysql_socket { /** The real socket descriptor. */ my_socket fd; /** The instrumentation hook. Note that this hook is not conditionally defined, for binary compatibility of the @c MYSQL_SOCKET interface. */ struct PSI_socket *m_psi; }; /** An instrumented socket. @c MYSQL_SOCKET is a replacement for @c my_socket. */ typedef struct st_mysql_socket MYSQL_SOCKET; /** @def MYSQL_INVALID_SOCKET MYSQL_SOCKET initial value. */ //MYSQL_SOCKET MYSQL_INVALID_SOCKET= {INVALID_SOCKET, NULL}; #define MYSQL_INVALID_SOCKET mysql_socket_invalid() /** MYSQL_SOCKET helper. Initialize instrumented socket. @sa mysql_socket_getfd @sa mysql_socket_setfd */ static inline MYSQL_SOCKET mysql_socket_invalid() { MYSQL_SOCKET mysql_socket= {INVALID_SOCKET, NULL}; return mysql_socket; } /** Set socket descriptor and address. @param socket nstrumented socket @param addr unformatted socket address @param addr_len length of socket addres */ static inline void mysql_socket_set_address( #ifdef HAVE_PSI_SOCKET_INTERFACE MYSQL_SOCKET socket, const struct sockaddr *addr, socklen_t addr_len #else MYSQL_SOCKET socket MY_ATTRIBUTE ((unused)), const struct sockaddr *addr MY_ATTRIBUTE ((unused)), socklen_t addr_len MY_ATTRIBUTE ((unused)) #endif ) { #ifdef HAVE_PSI_SOCKET_INTERFACE if (socket.m_psi != NULL) PSI_SOCKET_CALL(set_socket_info)(socket.m_psi, NULL, addr, addr_len); #endif } /** Set socket descriptor and address. @param socket instrumented socket */ static inline void mysql_socket_set_thread_owner( #ifdef HAVE_PSI_SOCKET_INTERFACE MYSQL_SOCKET socket #else MYSQL_SOCKET socket MY_ATTRIBUTE ((unused)) #endif ) { #ifdef HAVE_PSI_SOCKET_INTERFACE if (socket.m_psi != NULL) PSI_SOCKET_CALL(set_socket_thread_owner)(socket.m_psi); #endif } /** MYSQL_SOCKET helper. Get socket descriptor. @param mysql_socket Instrumented socket @sa mysql_socket_setfd */ static inline my_socket mysql_socket_getfd(MYSQL_SOCKET mysql_socket) { return mysql_socket.fd; } /** MYSQL_SOCKET helper. Set socket descriptor. @param mysql_socket Instrumented socket @param fd Socket descriptor @sa mysql_socket_getfd */ static inline void mysql_socket_setfd(MYSQL_SOCKET *mysql_socket, my_socket fd) { if (likely(mysql_socket != NULL)) mysql_socket->fd= fd; } /** @def MYSQL_SOCKET_WAIT_VARIABLES Instrumentation helper for socket waits. This instrumentation declares local variables. Do not use a ';' after this macro @param LOCKER locker @param STATE locker state @sa MYSQL_START_SOCKET_WAIT. @sa MYSQL_END_SOCKET_WAIT. */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define MYSQL_SOCKET_WAIT_VARIABLES(LOCKER, STATE) \ struct PSI_socket_locker* LOCKER; \ PSI_socket_locker_state STATE; #else #define MYSQL_SOCKET_WAIT_VARIABLES(LOCKER, STATE) #endif /** @def MYSQL_START_SOCKET_WAIT Instrumentation helper for socket waits. This instrumentation marks the start of a wait event. @param LOCKER locker @param STATE locker state @param SOCKET instrumented socket @param OP The socket operation to be performed @param COUNT bytes to be written/read @sa MYSQL_END_SOCKET_WAIT. */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define MYSQL_START_SOCKET_WAIT(LOCKER, STATE, SOCKET, OP, COUNT) \ LOCKER= inline_mysql_start_socket_wait(STATE, SOCKET, OP, COUNT,\ __FILE__, __LINE__) #else #define MYSQL_START_SOCKET_WAIT(LOCKER, STATE, SOCKET, OP, COUNT) \ do {} while (0) #endif /** @def MYSQL_END_SOCKET_WAIT Instrumentation helper for socket waits. This instrumentation marks the end of a wait event. @param LOCKER locker @param COUNT actual bytes written/read, or -1 @sa MYSQL_START_SOCKET_WAIT. */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define MYSQL_END_SOCKET_WAIT(LOCKER, COUNT) \ inline_mysql_end_socket_wait(LOCKER, COUNT) #else #define MYSQL_END_SOCKET_WAIT(LOCKER, COUNT) \ do {} while (0) #endif /** @def MYSQL_SOCKET_SET_STATE Set the state (IDLE, ACTIVE) of an instrumented socket. @param SOCKET the instrumented socket @param STATE the new state @sa PSI_socket_state */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define MYSQL_SOCKET_SET_STATE(SOCKET, STATE) \ inline_mysql_socket_set_state(SOCKET, STATE) #else #define MYSQL_SOCKET_SET_STATE(SOCKET, STATE) \ do {} while (0) #endif #ifdef HAVE_PSI_SOCKET_INTERFACE /** Instrumentation calls for MYSQL_START_SOCKET_WAIT. @sa MYSQL_START_SOCKET_WAIT. */ static inline struct PSI_socket_locker* inline_mysql_start_socket_wait(PSI_socket_locker_state *state, MYSQL_SOCKET mysql_socket, enum PSI_socket_operation op, size_t byte_count, const char *src_file, int src_line) { struct PSI_socket_locker *locker; if (mysql_socket.m_psi != NULL) { locker= PSI_SOCKET_CALL(start_socket_wait) (state, mysql_socket.m_psi, op, byte_count, src_file, src_line); } else locker= NULL; return locker; } /** Instrumentation calls for MYSQL_END_SOCKET_WAIT. @sa MYSQL_END_SOCKET_WAIT. */ static inline void inline_mysql_end_socket_wait(struct PSI_socket_locker *locker, size_t byte_count) { if (locker != NULL) PSI_SOCKET_CALL(end_socket_wait)(locker, byte_count); } /** Set the state (IDLE, ACTIVE) of an instrumented socket. @param socket the instrumented socket @param state the new state @sa PSI_socket_state */ static inline void inline_mysql_socket_set_state(MYSQL_SOCKET socket, enum PSI_socket_state state) { if (socket.m_psi != NULL) PSI_SOCKET_CALL(set_socket_state)(socket.m_psi, state); } #endif /* HAVE_PSI_SOCKET_INTERFACE */ /** @def mysql_socket_socket(K, D, T, P) Create a socket. @c mysql_socket_socket is a replacement for @c socket. @param K PSI_socket_key for this instrumented socket @param D Socket domain @param T Protocol type @param P Transport protocol */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define mysql_socket_socket(K, D, T, P) \ inline_mysql_socket_socket(K, D, T, P) #else #define mysql_socket_socket(K, D, T, P) \ inline_mysql_socket_socket(D, T, P) #endif /** @def mysql_socket_bind(FD, AP, L) Bind a socket to a local port number and IP address @c mysql_socket_bind is a replacement for @c bind. @param FD Instrumented socket descriptor returned by socket() @param AP Pointer to local port number and IP address in sockaddr structure @param L Length of sockaddr structure */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define mysql_socket_bind(FD, AP, L) \ inline_mysql_socket_bind(__FILE__, __LINE__, FD, AP, L) #else #define mysql_socket_bind(FD, AP, L) \ inline_mysql_socket_bind(FD, AP, L) #endif /** @def mysql_socket_getsockname(FD, AP, LP) Return port number and IP address of the local host @c mysql_socket_getsockname is a replacement for @c getsockname. @param FD Instrumented socket descriptor returned by socket() @param AP Pointer to returned address of local host in @c sockaddr structure @param LP Pointer to length of @c sockaddr structure */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define mysql_socket_getsockname(FD, AP, LP) \ inline_mysql_socket_getsockname(__FILE__, __LINE__, FD, AP, LP) #else #define mysql_socket_getsockname(FD, AP, LP) \ inline_mysql_socket_getsockname(FD, AP, LP) #endif /** @def mysql_socket_connect(FD, AP, L) Establish a connection to a remote host. @c mysql_socket_connect is a replacement for @c connect. @param FD Instrumented socket descriptor returned by socket() @param AP Pointer to target address in sockaddr structure @param L Length of sockaddr structure */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define mysql_socket_connect(FD, AP, L) \ inline_mysql_socket_connect(__FILE__, __LINE__, FD, AP, L) #else #define mysql_socket_connect(FD, AP, L) \ inline_mysql_socket_connect(FD, AP, L) #endif /** @def mysql_socket_getpeername(FD, AP, LP) Get port number and IP address of remote host that a socket is connected to. @c mysql_socket_getpeername is a replacement for @c getpeername. @param FD Instrumented socket descriptor returned by socket() or accept() @param AP Pointer to returned address of remote host in sockaddr structure @param LP Pointer to length of sockaddr structure */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define mysql_socket_getpeername(FD, AP, LP) \ inline_mysql_socket_getpeername(__FILE__, __LINE__, FD, AP, LP) #else #define mysql_socket_getpeername(FD, AP, LP) \ inline_mysql_socket_getpeername(FD, AP, LP) #endif /** @def mysql_socket_send(FD, B, N, FL) Send data from the buffer, B, to a connected socket. @c mysql_socket_send is a replacement for @c send. @param FD Instrumented socket descriptor returned by socket() or accept() @param B Buffer to send @param N Number of bytes to send @param FL Control flags */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define mysql_socket_send(FD, B, N, FL) \ inline_mysql_socket_send(__FILE__, __LINE__, FD, B, N, FL) #else #define mysql_socket_send(FD, B, N, FL) \ inline_mysql_socket_send(FD, B, N, FL) #endif /** @def mysql_socket_recv(FD, B, N, FL) Receive data from a connected socket. @c mysql_socket_recv is a replacement for @c recv. @param FD Instrumented socket descriptor returned by socket() or accept() @param B Buffer to receive to @param N Maximum bytes to receive @param FL Control flags */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define mysql_socket_recv(FD, B, N, FL) \ inline_mysql_socket_recv(__FILE__, __LINE__, FD, B, N, FL) #else #define mysql_socket_recv(FD, B, N, FL) \ inline_mysql_socket_recv(FD, B, N, FL) #endif /** @def mysql_socket_sendto(FD, B, N, FL, AP, L) Send data to a socket at the specified address. @c mysql_socket_sendto is a replacement for @c sendto. @param FD Instrumented socket descriptor returned by socket() @param B Buffer to send @param N Number of bytes to send @param FL Control flags @param AP Pointer to destination sockaddr structure @param L Size of sockaddr structure */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define mysql_socket_sendto(FD, B, N, FL, AP, L) \ inline_mysql_socket_sendto(__FILE__, __LINE__, FD, B, N, FL, AP, L) #else #define mysql_socket_sendto(FD, B, N, FL, AP, L) \ inline_mysql_socket_sendto(FD, B, N, FL, AP, L) #endif /** @def mysql_socket_recvfrom(FD, B, N, FL, AP, L) Receive data from a socket and return source address information @c mysql_socket_recvfrom is a replacement for @c recvfrom. @param FD Instrumented socket descriptor returned by socket() @param B Buffer to receive to @param N Maximum bytes to receive @param FL Control flags @param AP Pointer to source address in sockaddr_storage structure @param LP Size of sockaddr_storage structure */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define mysql_socket_recvfrom(FD, B, N, FL, AP, LP) \ inline_mysql_socket_recvfrom(__FILE__, __LINE__, FD, B, N, FL, AP, LP) #else #define mysql_socket_recvfrom(FD, B, N, FL, AP, LP) \ inline_mysql_socket_recvfrom(FD, B, N, FL, AP, LP) #endif /** @def mysql_socket_getsockopt(FD, LV, ON, OP, OL) Get a socket option for the specified socket. @c mysql_socket_getsockopt is a replacement for @c getsockopt. @param FD Instrumented socket descriptor returned by socket() @param LV Protocol level @param ON Option to query @param OP Buffer which will contain the value for the requested option @param OL Pointer to length of OP */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define mysql_socket_getsockopt(FD, LV, ON, OP, OL) \ inline_mysql_socket_getsockopt(__FILE__, __LINE__, FD, LV, ON, OP, OL) #else #define mysql_socket_getsockopt(FD, LV, ON, OP, OL) \ inline_mysql_socket_getsockopt(FD, LV, ON, OP, OL) #endif /** @def mysql_socket_setsockopt(FD, LV, ON, OP, OL) Set a socket option for the specified socket. @c mysql_socket_setsockopt is a replacement for @c setsockopt. @param FD Instrumented socket descriptor returned by socket() @param LV Protocol level @param ON Option to modify @param OP Buffer containing the value for the specified option @param OL Pointer to length of OP */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define mysql_socket_setsockopt(FD, LV, ON, OP, OL) \ inline_mysql_socket_setsockopt(__FILE__, __LINE__, FD, LV, ON, OP, OL) #else #define mysql_socket_setsockopt(FD, LV, ON, OP, OL) \ inline_mysql_socket_setsockopt(FD, LV, ON, OP, OL) #endif /** @def mysql_sock_set_nonblocking Set socket to non-blocking. @param FD instrumented socket descriptor */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define mysql_sock_set_nonblocking(FD) \ inline_mysql_sock_set_nonblocking(__FILE__, __LINE__, FD) #else #define mysql_sock_set_nonblocking(FD) \ inline_mysql_sock_set_nonblocking(FD) #endif /** @def mysql_socket_listen(FD, N) Set socket state to listen for an incoming connection. @c mysql_socket_listen is a replacement for @c listen. @param FD Instrumented socket descriptor, bound and connected @param N Maximum number of pending connections allowed. */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define mysql_socket_listen(FD, N) \ inline_mysql_socket_listen(__FILE__, __LINE__, FD, N) #else #define mysql_socket_listen(FD, N) \ inline_mysql_socket_listen(FD, N) #endif /** @def mysql_socket_accept(K, FD, AP, LP) Accept a connection from any remote host; TCP only. @c mysql_socket_accept is a replacement for @c accept. @param K PSI_socket_key for this instrumented socket @param FD Instrumented socket descriptor, bound and placed in a listen state @param AP Pointer to sockaddr structure with returned IP address and port of connected host @param LP Pointer to length of valid information in AP */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define mysql_socket_accept(K, FD, AP, LP) \ inline_mysql_socket_accept(__FILE__, __LINE__, K, FD, AP, LP) #else #define mysql_socket_accept(K, FD, AP, LP) \ inline_mysql_socket_accept(FD, AP, LP) #endif /** @def mysql_socket_close(FD) Close a socket and sever any connections. @c mysql_socket_close is a replacement for @c close. @param FD Instrumented socket descriptor returned by socket() or accept() */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define mysql_socket_close(FD) \ inline_mysql_socket_close(__FILE__, __LINE__, FD) #else #define mysql_socket_close(FD) \ inline_mysql_socket_close(FD) #endif /** @def mysql_socket_shutdown(FD, H) Disable receives and/or sends on a socket. @c mysql_socket_shutdown is a replacement for @c shutdown. @param FD Instrumented socket descriptor returned by socket() or accept() @param H Specifies which operations to shutdown */ #ifdef HAVE_PSI_SOCKET_INTERFACE #define mysql_socket_shutdown(FD, H) \ inline_mysql_socket_shutdown(__FILE__, __LINE__, FD, H) #else #define mysql_socket_shutdown(FD, H) \ inline_mysql_socket_shutdown(FD, H) #endif #ifdef HAVE_PSI_SOCKET_INTERFACE static inline void inline_mysql_socket_register( const char *category, PSI_socket_info *info, int count) { PSI_SOCKET_CALL(register_socket)(category, info, count); } #endif /** mysql_socket_socket */ static inline MYSQL_SOCKET inline_mysql_socket_socket ( #ifdef HAVE_PSI_SOCKET_INTERFACE PSI_socket_key key, #endif int domain, int type, int protocol) { MYSQL_SOCKET mysql_socket= MYSQL_INVALID_SOCKET; mysql_socket.fd= socket(domain, type, protocol); #ifdef HAVE_PSI_SOCKET_INTERFACE if (likely(mysql_socket.fd != INVALID_SOCKET)) { mysql_socket.m_psi= PSI_SOCKET_CALL(init_socket) (key, (const my_socket*)&mysql_socket.fd, NULL, 0); } #endif return mysql_socket; } /** mysql_socket_bind */ static inline int inline_mysql_socket_bind ( #ifdef HAVE_PSI_SOCKET_INTERFACE const char *src_file, uint src_line, #endif MYSQL_SOCKET mysql_socket, const struct sockaddr *addr, socklen_t len) { int result; #ifdef HAVE_PSI_SOCKET_INTERFACE if (mysql_socket.m_psi != NULL) { /* Instrumentation start */ PSI_socket_locker_state state; PSI_socket_locker *locker; locker= PSI_SOCKET_CALL(start_socket_wait) (&state, mysql_socket.m_psi, PSI_SOCKET_BIND, (size_t)0, src_file, src_line); /* Instrumented code */ result= bind(mysql_socket.fd, addr, len); /* Instrumentation end */ if (result == 0) PSI_SOCKET_CALL(set_socket_info)(mysql_socket.m_psi, NULL, addr, len); if (locker != NULL) PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); return result; } #endif /* Non instrumented code */ result= bind(mysql_socket.fd, addr, len); return result; } /** mysql_socket_getsockname */ static inline int inline_mysql_socket_getsockname ( #ifdef HAVE_PSI_SOCKET_INTERFACE const char *src_file, uint src_line, #endif MYSQL_SOCKET mysql_socket, struct sockaddr *addr, socklen_t *len) { int result; #ifdef HAVE_PSI_SOCKET_INTERFACE if (mysql_socket.m_psi != NULL) { /* Instrumentation start */ PSI_socket_locker *locker; PSI_socket_locker_state state; locker= PSI_SOCKET_CALL(start_socket_wait) (&state, mysql_socket.m_psi, PSI_SOCKET_BIND, (size_t)0, src_file, src_line); /* Instrumented code */ result= getsockname(mysql_socket.fd, addr, len); /* Instrumentation end */ if (locker != NULL) PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); return result; } #endif /* Non instrumented code */ result= getsockname(mysql_socket.fd, addr, len); return result; } /** mysql_socket_connect */ static inline int inline_mysql_socket_connect ( #ifdef HAVE_PSI_SOCKET_INTERFACE const char *src_file, uint src_line, #endif MYSQL_SOCKET mysql_socket, const struct sockaddr *addr, socklen_t len) { int result; #ifdef HAVE_PSI_SOCKET_INTERFACE if (mysql_socket.m_psi != NULL) { /* Instrumentation start */ PSI_socket_locker *locker; PSI_socket_locker_state state; locker= PSI_SOCKET_CALL(start_socket_wait) (&state, mysql_socket.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line); /* Instrumented code */ result= connect(mysql_socket.fd, addr, len); /* Instrumentation end */ if (locker != NULL) PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); return result; } #endif /* Non instrumented code */ result= connect(mysql_socket.fd, addr, len); return result; } /** mysql_socket_getpeername */ static inline int inline_mysql_socket_getpeername ( #ifdef HAVE_PSI_SOCKET_INTERFACE const char *src_file, uint src_line, #endif MYSQL_SOCKET mysql_socket, struct sockaddr *addr, socklen_t *len) { int result; #ifdef HAVE_PSI_SOCKET_INTERFACE if (mysql_socket.m_psi != NULL) { /* Instrumentation start */ PSI_socket_locker *locker; PSI_socket_locker_state state; locker= PSI_SOCKET_CALL(start_socket_wait) (&state, mysql_socket.m_psi, PSI_SOCKET_BIND, (size_t)0, src_file, src_line); /* Instrumented code */ result= getpeername(mysql_socket.fd, addr, len); /* Instrumentation end */ if (locker != NULL) PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); return result; } #endif /* Non instrumented code */ result= getpeername(mysql_socket.fd, addr, len); return result; } /** mysql_socket_send */ static inline ssize_t inline_mysql_socket_send ( #ifdef HAVE_PSI_SOCKET_INTERFACE const char *src_file, uint src_line, #endif MYSQL_SOCKET mysql_socket, const SOCKBUF_T *buf, size_t n, int flags) { ssize_t result; #ifdef HAVE_PSI_SOCKET_INTERFACE if (mysql_socket.m_psi != NULL) { /* Instrumentation start */ PSI_socket_locker *locker; PSI_socket_locker_state state; locker= PSI_SOCKET_CALL(start_socket_wait) (&state, mysql_socket.m_psi, PSI_SOCKET_SEND, n, src_file, src_line); /* Instrumented code */ result= send(mysql_socket.fd, buf, IF_WIN((int),) n, flags); /* Instrumentation end */ if (locker != NULL) { size_t bytes_written; bytes_written= (result > -1) ? result : 0; PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_written); } return result; } #endif /* Non instrumented code */ result= send(mysql_socket.fd, buf, IF_WIN((int),) n, flags); return result; } /** mysql_socket_recv */ static inline ssize_t inline_mysql_socket_recv ( #ifdef HAVE_PSI_SOCKET_INTERFACE const char *src_file, uint src_line, #endif MYSQL_SOCKET mysql_socket, SOCKBUF_T *buf, size_t n, int flags) { ssize_t result; #ifdef HAVE_PSI_SOCKET_INTERFACE if (mysql_socket.m_psi != NULL) { /* Instrumentation start */ PSI_socket_locker *locker; PSI_socket_locker_state state; locker= PSI_SOCKET_CALL(start_socket_wait) (&state, mysql_socket.m_psi, PSI_SOCKET_RECV, (size_t)0, src_file, src_line); /* Instrumented code */ result= recv(mysql_socket.fd, buf, IF_WIN((int),) n, flags); /* Instrumentation end */ if (locker != NULL) { size_t bytes_read; bytes_read= (result > -1) ? result : 0; PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_read); } return result; } #endif /* Non instrumented code */ result= recv(mysql_socket.fd, buf, IF_WIN((int),) n, flags); return result; } /** mysql_socket_sendto */ static inline ssize_t inline_mysql_socket_sendto ( #ifdef HAVE_PSI_SOCKET_INTERFACE const char *src_file, uint src_line, #endif MYSQL_SOCKET mysql_socket, const SOCKBUF_T *buf, size_t n, int flags, const struct sockaddr *addr, socklen_t addr_len) { ssize_t result; #ifdef HAVE_PSI_SOCKET_INTERFACE if (mysql_socket.m_psi != NULL) { /* Instrumentation start */ PSI_socket_locker *locker; PSI_socket_locker_state state; locker= PSI_SOCKET_CALL(start_socket_wait) (&state, mysql_socket.m_psi, PSI_SOCKET_SEND, n, src_file, src_line); /* Instrumented code */ result= sendto(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len); /* Instrumentation end */ if (locker != NULL) { size_t bytes_written; bytes_written = (result > -1) ? result : 0; PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_written); } return result; } #endif /* Non instrumented code */ result= sendto(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len); return result; } /** mysql_socket_recvfrom */ static inline ssize_t inline_mysql_socket_recvfrom ( #ifdef HAVE_PSI_SOCKET_INTERFACE const char *src_file, uint src_line, #endif MYSQL_SOCKET mysql_socket, SOCKBUF_T *buf, size_t n, int flags, struct sockaddr *addr, socklen_t *addr_len) { ssize_t result; #ifdef HAVE_PSI_SOCKET_INTERFACE if (mysql_socket.m_psi != NULL) { /* Instrumentation start */ PSI_socket_locker *locker; PSI_socket_locker_state state; locker= PSI_SOCKET_CALL(start_socket_wait) (&state, mysql_socket.m_psi, PSI_SOCKET_RECV, (size_t)0, src_file, src_line); /* Instrumented code */ result= recvfrom(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len); /* Instrumentation end */ if (locker != NULL) { size_t bytes_read; bytes_read = (result > -1) ? result : 0; PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_read); } return result; } #endif /* Non instrumented code */ result= recvfrom(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len); return result; } /** mysql_socket_getsockopt */ static inline int inline_mysql_socket_getsockopt ( #ifdef HAVE_PSI_SOCKET_INTERFACE const char *src_file, uint src_line, #endif MYSQL_SOCKET mysql_socket, int level, int optname, SOCKBUF_T *optval, socklen_t *optlen) { int result; #ifdef HAVE_PSI_SOCKET_INTERFACE if (mysql_socket.m_psi != NULL) { /* Instrumentation start */ PSI_socket_locker *locker; PSI_socket_locker_state state; locker= PSI_SOCKET_CALL(start_socket_wait) (&state, mysql_socket.m_psi, PSI_SOCKET_OPT, (size_t)0, src_file, src_line); /* Instrumented code */ result= getsockopt(mysql_socket.fd, level, optname, optval, optlen); /* Instrumentation end */ if (locker != NULL) PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); return result; } #endif /* Non instrumented code */ result= getsockopt(mysql_socket.fd, level, optname, optval, optlen); return result; } /** mysql_socket_setsockopt */ static inline int inline_mysql_socket_setsockopt ( #ifdef HAVE_PSI_SOCKET_INTERFACE const char *src_file, uint src_line, #endif MYSQL_SOCKET mysql_socket, int level, int optname, const SOCKBUF_T *optval, socklen_t optlen) { int result; #ifdef HAVE_PSI_SOCKET_INTERFACE if (mysql_socket.m_psi) { /* Instrumentation start */ PSI_socket_locker *locker; PSI_socket_locker_state state; locker= PSI_SOCKET_CALL(start_socket_wait) (&state, mysql_socket.m_psi, PSI_SOCKET_OPT, (size_t)0, src_file, src_line); /* Instrumented code */ result= setsockopt(mysql_socket.fd, level, optname, optval, optlen); /* Instrumentation end */ if (locker != NULL) PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); return result; } #endif /* Non instrumented code */ result= setsockopt(mysql_socket.fd, level, optname, optval, optlen); return result; } /** set_socket_nonblock */ static inline int set_socket_nonblock(my_socket fd) { int ret= 0; #ifdef _WIN32 { u_long nonblocking= 1; ret= ioctlsocket(fd, FIONBIO, &nonblocking); } #else { int fd_flags; fd_flags= fcntl(fd, F_GETFL, 0); if (fd_flags < 0) return errno; #if defined(O_NONBLOCK) fd_flags |= O_NONBLOCK; #elif defined(O_NDELAY) fd_flags |= O_NDELAY; #elif defined(O_FNDELAY) fd_flags |= O_FNDELAY; #else #error "No definition of non-blocking flag found." #endif /* O_NONBLOCK */ if (fcntl(fd, F_SETFL, fd_flags) == -1) ret= errno; } #endif /* _WIN32 */ return ret; } /** mysql_socket_set_nonblocking */ static inline int inline_mysql_sock_set_nonblocking ( #ifdef HAVE_PSI_SOCKET_INTERFACE const char *src_file, uint src_line, #endif MYSQL_SOCKET mysql_socket ) { int result= 0; #ifdef HAVE_PSI_SOCKET_INTERFACE if (mysql_socket.m_psi) { /* Instrumentation start */ PSI_socket_locker *locker; PSI_socket_locker_state state; locker= PSI_SOCKET_CALL(start_socket_wait) (&state, mysql_socket.m_psi, PSI_SOCKET_OPT, (size_t)0, src_file, src_line); /* Instrumented code */ result= set_socket_nonblock(mysql_socket.fd); /* Instrumentation end */ if (locker != NULL) PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); return result; } #endif /* Non instrumented code */ result= set_socket_nonblock(mysql_socket.fd); return result; } /** mysql_socket_listen */ static inline int inline_mysql_socket_listen ( #ifdef HAVE_PSI_SOCKET_INTERFACE const char *src_file, uint src_line, #endif MYSQL_SOCKET mysql_socket, int backlog) { int result; #ifdef HAVE_PSI_SOCKET_INTERFACE if (mysql_socket.m_psi != NULL) { /* Instrumentation start */ PSI_socket_locker *locker; PSI_socket_locker_state state; locker= PSI_SOCKET_CALL(start_socket_wait) (&state, mysql_socket.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line); /* Instrumented code */ result= listen(mysql_socket.fd, backlog); /* Instrumentation end */ if (locker != NULL) PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); return result; } #endif /* Non instrumented code */ result= listen(mysql_socket.fd, backlog); return result; } /** mysql_socket_accept */ static inline MYSQL_SOCKET inline_mysql_socket_accept ( #ifdef HAVE_PSI_SOCKET_INTERFACE const char *src_file, uint src_line, PSI_socket_key key, #endif MYSQL_SOCKET socket_listen, struct sockaddr *addr, socklen_t *addr_len) { MYSQL_SOCKET socket_accept= MYSQL_INVALID_SOCKET; socklen_t addr_length= (addr_len != NULL) ? *addr_len : 0; #ifdef HAVE_PSI_SOCKET_INTERFACE if (socket_listen.m_psi != NULL) { /* Instrumentation start */ PSI_socket_locker *locker; PSI_socket_locker_state state; locker= PSI_SOCKET_CALL(start_socket_wait) (&state, socket_listen.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line); /* Instrumented code */ socket_accept.fd= accept(socket_listen.fd, addr, &addr_length); /* Instrumentation end */ if (locker != NULL) PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); } else #endif { /* Non instrumented code */ socket_accept.fd= accept(socket_listen.fd, addr, &addr_length); } #ifdef HAVE_PSI_SOCKET_INTERFACE if (likely(socket_accept.fd != INVALID_SOCKET)) { /* Initialize the instrument with the new socket descriptor and address */ socket_accept.m_psi= PSI_SOCKET_CALL(init_socket) (key, (const my_socket*)&socket_accept.fd, addr, addr_length); } #endif return socket_accept; } /** mysql_socket_close */ static inline int inline_mysql_socket_close ( #ifdef HAVE_PSI_SOCKET_INTERFACE const char *src_file, uint src_line, #endif MYSQL_SOCKET mysql_socket) { int result; #ifdef HAVE_PSI_SOCKET_INTERFACE if (mysql_socket.m_psi != NULL) { /* Instrumentation start */ PSI_socket_locker *locker; PSI_socket_locker_state state; locker= PSI_SOCKET_CALL(start_socket_wait) (&state, mysql_socket.m_psi, PSI_SOCKET_CLOSE, (size_t)0, src_file, src_line); /* Instrumented code */ result= closesocket(mysql_socket.fd); /* Instrumentation end */ if (locker != NULL) PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); /* Remove the instrumentation for this socket. */ if (mysql_socket.m_psi != NULL) PSI_SOCKET_CALL(destroy_socket)(mysql_socket.m_psi); return result; } #endif /* Non instrumented code */ result= closesocket(mysql_socket.fd); return result; } /** mysql_socket_shutdown */ static inline int inline_mysql_socket_shutdown ( #ifdef HAVE_PSI_SOCKET_INTERFACE const char *src_file, uint src_line, #endif MYSQL_SOCKET mysql_socket, int how) { int result; #ifdef _WIN32 static LPFN_DISCONNECTEX DisconnectEx = NULL; if (DisconnectEx == NULL) { DWORD dwBytesReturned; GUID guidDisconnectEx = WSAID_DISCONNECTEX; WSAIoctl(mysql_socket.fd, SIO_GET_EXTENSION_FUNCTION_POINTER, &guidDisconnectEx, sizeof(GUID), &DisconnectEx, sizeof(DisconnectEx), &dwBytesReturned, NULL, NULL); } #endif /* Instrumentation start */ #ifdef HAVE_PSI_SOCKET_INTERFACE if (mysql_socket.m_psi != NULL) { PSI_socket_locker *locker; PSI_socket_locker_state state; locker= PSI_SOCKET_CALL(start_socket_wait) (&state, mysql_socket.m_psi, PSI_SOCKET_SHUTDOWN, (size_t)0, src_file, src_line); /* Instrumented code */ #ifdef _WIN32 if (DisconnectEx) result= (DisconnectEx(mysql_socket.fd, (LPOVERLAPPED) NULL, (DWORD) 0, (DWORD) 0) == TRUE) ? 0 : -1; else #endif result= shutdown(mysql_socket.fd, how); /* Instrumentation end */ if (locker != NULL) PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); return result; } #endif /* Non instrumented code */ #ifdef _WIN32 if (DisconnectEx) result= (DisconnectEx(mysql_socket.fd, (LPOVERLAPPED) NULL, (DWORD) 0, (DWORD) 0) == TRUE) ? 0 : -1; else #endif result= shutdown(mysql_socket.fd, how); return result; } /** @} (end of group Socket_instrumentation) */ #endif ������������������������������������������������������������mysql/mysql/psi/psi_memory.h������������������������������������������������������������������������0000644�����������������00000007754�14763166026�0012235 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2013, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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, 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef MYSQL_PSI_MEMORY_H #define MYSQL_PSI_MEMORY_H #include "psi_base.h" #ifdef __cplusplus extern "C" { #endif /** @file mysql/psi/psi_memory.h Performance schema instrumentation interface. @defgroup Instrumentation_interface Instrumentation Interface @ingroup Performance_schema @{ */ #ifdef HAVE_PSI_INTERFACE #ifndef DISABLE_ALL_PSI #ifndef DISABLE_PSI_MEMORY #define HAVE_PSI_MEMORY_INTERFACE #endif /* DISABLE_PSI_MEMORY */ #endif /* DISABLE_ALL_PSI */ #endif /* HAVE_PSI_INTERFACE */ struct PSI_thread; /** Instrumented memory key. To instrument memory, a memory key must be obtained using @c register_memory. Using a zero key always disable the instrumentation. */ typedef unsigned int PSI_memory_key; #ifdef HAVE_PSI_1 /** @defgroup Group_PSI_v1 Application Binary Interface, version 1 @ingroup Instrumentation_interface @{ */ /** Memory instrument information. @since PSI_VERSION_1 This structure is used to register instrumented memory. */ struct PSI_memory_info_v1 { /** Pointer to the key assigned to the registered memory. */ PSI_memory_key *m_key; /** The name of the memory instrument to register. */ const char *m_name; /** The flags of the socket instrument to register. @sa PSI_FLAG_GLOBAL */ int m_flags; }; typedef struct PSI_memory_info_v1 PSI_memory_info_v1; /** Memory registration API. @param category a category name (typically a plugin name) @param info an array of memory info to register @param count the size of the info array */ typedef void (*register_memory_v1_t) (const char *category, struct PSI_memory_info_v1 *info, int count); /** Instrument memory allocation. @param key the memory instrument key @param size the size of memory allocated @param[out] owner the memory owner @return the effective memory instrument key */ typedef PSI_memory_key (*memory_alloc_v1_t) (PSI_memory_key key, size_t size, struct PSI_thread ** owner); /** Instrument memory re allocation. @param key the memory instrument key @param old_size the size of memory previously allocated @param new_size the size of memory re allocated @param[in, out] owner the memory owner @return the effective memory instrument key */ typedef PSI_memory_key (*memory_realloc_v1_t) (PSI_memory_key key, size_t old_size, size_t new_size, struct PSI_thread ** owner); /** Instrument memory claim. @param key the memory instrument key @param size the size of memory allocated @param[in, out] owner the memory owner @return the effective memory instrument key */ typedef PSI_memory_key (*memory_claim_v1_t) (PSI_memory_key key, size_t size, struct PSI_thread ** owner); /** Instrument memory free. @param key the memory instrument key @param size the size of memory allocated @param owner the memory owner */ typedef void (*memory_free_v1_t) (PSI_memory_key key, size_t size, struct PSI_thread * owner); /** @} (end of group Group_PSI_v1) */ #endif /* HAVE_PSI_1 */ #ifdef HAVE_PSI_2 struct PSI_memory_info_v2 { int placeholder; }; #endif /* HAVE_PSI_2 */ #ifdef USE_PSI_1 typedef struct PSI_memory_info_v1 PSI_memory_info; #endif #ifdef USE_PSI_2 typedef struct PSI_memory_info_v2 PSI_memory_info; #endif /** @} (end of group Instrumentation_interface) */ #ifdef __cplusplus } #endif #endif /* MYSQL_PSI_MEMORY_H */ ��������������������mysql/mysql/psi/mysql_sp.h��������������������������������������������������������������������������0000644�����������������00000005425�14763166026�0011712 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2013, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_SP_H #define MYSQL_SP_H /** @file mysql/psi/mysql_sp.h Instrumentation helpers for stored programs. */ #include "mysql/psi/psi.h" #ifndef PSI_SP_CALL #define PSI_SP_CALL(M) PSI_DYNAMIC_CALL(M) #endif #ifdef HAVE_PSI_SP_INTERFACE #define MYSQL_START_SP(STATE, SP_SHARE) \ inline_mysql_start_sp(STATE, SP_SHARE) #else #define MYSQL_START_SP(STATE, SP_SHARE) \ NULL #endif #ifdef HAVE_PSI_SP_INTERFACE #define MYSQL_END_SP(LOCKER) \ inline_mysql_end_sp(LOCKER) #else #define MYSQL_END_SP(LOCKER) \ do {} while (0) #endif #ifdef HAVE_PSI_SP_INTERFACE #define MYSQL_DROP_SP(OT, SN, SNL, ON, ONL) \ inline_mysql_drop_sp(OT, SN, SNL, ON, ONL) #else #define MYSQL_DROP_SP(OT, SN, SNL, ON, ONL) \ do {} while (0) #endif #ifdef HAVE_PSI_SP_INTERFACE #define MYSQL_GET_SP_SHARE(OT, SN, SNL, ON, ONL) \ inline_mysql_get_sp_share(OT, SN, SNL, ON, ONL) #else #define MYSQL_GET_SP_SHARE(OT, SN, SNL, ON, ONL) \ NULL #endif #ifdef HAVE_PSI_SP_INTERFACE static inline struct PSI_sp_locker* inline_mysql_start_sp(PSI_sp_locker_state *state, PSI_sp_share *sp_share) { return PSI_SP_CALL(start_sp)(state, sp_share); } static inline void inline_mysql_end_sp(PSI_sp_locker *locker) { if (likely(locker != NULL)) PSI_SP_CALL(end_sp)(locker); } static inline void inline_mysql_drop_sp(uint sp_type, const char* schema_name, uint shcema_name_length, const char* object_name, uint object_name_length) { PSI_SP_CALL(drop_sp)(sp_type, schema_name, shcema_name_length, object_name, object_name_length); } static inline PSI_sp_share* inline_mysql_get_sp_share(uint sp_type, const char* schema_name, uint shcema_name_length, const char* object_name, uint object_name_length) { return PSI_SP_CALL(get_sp_share)(sp_type, schema_name, shcema_name_length, object_name, object_name_length); } #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/psi/mysql_memory.h����������������������������������������������������������������������0000644�����������������00000003217�14763166026�0012575 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2012, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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, 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef MYSQL_MEMORY_H #define MYSQL_MEMORY_H /** @file mysql/psi/mysql_memory.h Instrumentation helpers for memory allocation. */ #include "mysql/psi/psi.h" #ifndef PSI_MEMORY_CALL #define PSI_MEMORY_CALL(M) PSI_DYNAMIC_CALL(M) #endif /** @defgroup Memory_instrumentation Memory Instrumentation @ingroup Instrumentation_interface @{ */ /** @def mysql_memory_register(P1, P2, P3) Memory registration. */ #define mysql_memory_register(P1, P2, P3) \ inline_mysql_memory_register(P1, P2, P3) static inline void inline_mysql_memory_register( #ifdef HAVE_PSI_MEMORY_INTERFACE const char *category, PSI_memory_info *info, int count) #else const char *category MY_ATTRIBUTE((unused)), void *info MY_ATTRIBUTE((unused)), int count MY_ATTRIBUTE((unused))) #endif { #ifdef HAVE_PSI_MEMORY_INTERFACE PSI_MEMORY_CALL(register_memory)(category, info, count); #endif } /** @} (end of group Memory_instrumentation) */ #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/psi/psi_base.h��������������������������������������������������������������������������0000644�����������������00000006635�14763166026�0011634 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2008, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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, 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef MYSQL_PSI_BASE_H #define MYSQL_PSI_BASE_H #ifdef __cplusplus extern "C" { #endif /** @file mysql/psi/psi_base.h Performance schema instrumentation interface. @defgroup Instrumentation_interface Instrumentation Interface @ingroup Performance_schema @{ */ #define PSI_INSTRUMENT_ME 0 #define PSI_NOT_INSTRUMENTED 0 /** Global flag. This flag indicate that an instrumentation point is a global variable, or a singleton. */ #define PSI_FLAG_GLOBAL (1 << 0) /** Mutable flag. This flag indicate that an instrumentation point is a general placeholder, that can mutate into a more specific instrumentation point. */ #define PSI_FLAG_MUTABLE (1 << 1) #define PSI_FLAG_THREAD (1 << 2) /** Stage progress flag. This flag apply to the stage instruments only. It indicates the instrumentation provides progress data. */ #define PSI_FLAG_STAGE_PROGRESS (1 << 3) /** Shared Exclusive flag. Indicates that rwlock support the shared exclusive state. */ #define PSI_RWLOCK_FLAG_SX (1 << 4) /** Transferable flag. This flag indicate that an instrumented object can be created by a thread and destroyed by another thread. */ #define PSI_FLAG_TRANSFER (1 << 5) /** Volatility flag. This flag indicate that an instrumented object has a volatility (life cycle) comparable to the volatility of a session. */ #define PSI_FLAG_VOLATILITY_SESSION (1 << 6) #ifdef HAVE_PSI_INTERFACE /** @def PSI_VERSION_1 Performance Schema Interface number for version 1. This version is supported. */ #define PSI_VERSION_1 1 /** @def PSI_VERSION_2 Performance Schema Interface number for version 2. This version is not implemented, it's a placeholder. */ #define PSI_VERSION_2 2 /** @def PSI_CURRENT_VERSION Performance Schema Interface number for the most recent version. The most current version is @c PSI_VERSION_1 */ #define PSI_CURRENT_VERSION 1 /** @def USE_PSI_1 Define USE_PSI_1 to use the interface version 1. */ /** @def USE_PSI_2 Define USE_PSI_2 to use the interface version 2. */ /** @def HAVE_PSI_1 Define HAVE_PSI_1 if the interface version 1 needs to be compiled in. */ /** @def HAVE_PSI_2 Define HAVE_PSI_2 if the interface version 2 needs to be compiled in. */ #ifndef USE_PSI_2 #ifndef USE_PSI_1 #define USE_PSI_1 #endif #endif #ifdef USE_PSI_1 #define HAVE_PSI_1 #endif #ifdef USE_PSI_2 #define HAVE_PSI_2 #endif /* Allow to override PSI_XXX_CALL at compile time with more efficient implementations, if available. If nothing better is available, make a dynamic call using the PSI_server function pointer. */ #define PSI_DYNAMIC_CALL(M) PSI_server->M #endif /* HAVE_PSI_INTERFACE */ /** @} */ #ifdef __cplusplus } #endif #endif /* MYSQL_PSI_BASE_H */ ���������������������������������������������������������������������������������������������������mysql/mysql/thread_type.h���������������������������������������������������������������������������0000644�����������������00000002550�14763166026�0011554 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ /* Defines to make different thread packages compatible */ #ifndef THREAD_TYPE_INCLUDED #define THREAD_TYPE_INCLUDED #ifdef __cplusplus extern "C"{ #endif /* Flags for the THD::system_thread variable */ enum enum_thread_type { NON_SYSTEM_THREAD= 0, SYSTEM_THREAD_SLAVE_IO= 1, SYSTEM_THREAD_SLAVE_SQL= 2, SYSTEM_THREAD_NDBCLUSTER_BINLOG= 4, SYSTEM_THREAD_EVENT_SCHEDULER= 8, SYSTEM_THREAD_EVENT_WORKER= 16, SYSTEM_THREAD_INFO_REPOSITORY= 32, SYSTEM_THREAD_SLAVE_WORKER= 64, SYSTEM_THREAD_COMPRESS_GTID_TABLE= 128, SYSTEM_THREAD_BACKGROUND= 256 }; #ifdef __cplusplus } #endif #endif /* THREAD_TYPE_INCLUDED */ ��������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/service_rules_table.h�������������������������������������������������������������������0000644�����������������00000011737�14763166026�0013274 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifdef __cplusplus #ifndef SERVICE_RULES_TABLE_INCLUDED #define SERVICE_RULES_TABLE_INCLUDED /* Copyright (c) 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <my_global.h> #include <my_dbug.h> #include <string> #ifndef MYSQL_ABI_CHECK #include <stdlib.h> #endif /** @file service_rules_table.h Plugin service that provides access to the rewrite rules table that is used by the Rewriter plugin. No other use intended. */ class THD; struct TABLE_LIST; class Field; namespace rules_table_service { /** There must be one function of this kind in order for the symbols in the server's dynamic library to be visible to plugins. */ int dummy_function_to_ensure_we_are_linked_into_the_server(); /** Frees a const char pointer allocated in the server's dynamic library using new[]. */ void free_string(const char *str); /** Writable cursor that allows reading and updating of rows in a persistent table. */ class Cursor { public: typedef int column_id; static const column_id ILLEGAL_COLUMN_ID= -1; /** Creates a cursor to an already-opened table. The constructor is kept explicit because of implicit conversions from void*. */ explicit Cursor(THD *thd); /// Creates a past-the-end cursor. Cursor() : m_thd(NULL), m_table_list(NULL), m_is_finished(true) {} column_id pattern_column() const { return m_pattern_column; } column_id pattern_database_column() const { return m_pattern_database_column; } column_id replacement_column() const { return m_replacement_column; } column_id enabled_column() const { return m_enabled_column; } column_id message_column() const { return m_message_column; } column_id pattern_digest_column() const { return m_pattern_digest_column; } column_id normalized_pattern_column() const { return m_normalized_pattern_column; } /** True if the table does not contain columns named 'pattern', 'replacement', 'enabled' and 'message'. In this case the cursor is equal to any past-the-end Cursor. */ bool table_is_malformed() { return m_table_is_malformed; } /** Fetches the value of the column with the given number as a C string. This interface is meant for crossing dynamic library boundaries, hence the use of C-style const char*. The function casts a column value to a C string and returns a copy, allocated in the callee's DL. The pointer must be freed using free_string(). @param fieldno One of PATTERN_COLUMN, REPLACEMENT_COLUMN, ENABLED_COLUMN or MESSAGE_COLUMN. */ const char *fetch_string(int fieldno); /** Equality operator. The only cursors that are equal are past-the-end cursors. */ bool operator== (const Cursor &other) { return (m_is_finished == other.m_is_finished); } /** Inequality operator. All cursors are considered different except past-the-end cursors. */ bool operator!= (const Cursor &other) { return !(*this == other); } /** Advances this Cursor. Read errors are kept, and had_serious_read_error() will tell if there was an unexpected error (e.g. not EOF) while reading. */ Cursor &operator++ () { if (!m_is_finished) read(); return *this; } /// Prepares the write buffer for updating the current row. void make_writeable(); /** Sets the value of column colno to a string value. @param colno The column number. @param str The string. @param length The string's length. */ void set(int colno, const char* str, size_t length); /// Writes the row in the write buffer to the table at the current row. int write(); /// True if there was an unexpected error while reading, e.g. other than EOF. bool had_serious_read_error() const; /// Closes the table scan if initiated and commits the transaction. ~Cursor(); private: int field_index(const char *field_name); int m_pattern_column; int m_pattern_database_column; int m_replacement_column; int m_enabled_column; int m_message_column; int m_pattern_digest_column; int m_normalized_pattern_column; THD *m_thd; TABLE_LIST *m_table_list; bool m_is_finished; bool m_table_is_malformed; int m_last_read_status; int read(); }; /** A past-the-end Cursor. All past-the-end cursors are considered equal when compared with operator ==. */ Cursor end(); } #endif // SERVICE_RULES_TABLE_INCLUDED #endif // __cplusplus ���������������������������������mysql/mysql/services.h������������������������������������������������������������������������������0000644�����������������00000003634�14763166026�0011073 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef MYSQL_SERVICES_INCLUDED /* Copyright (c) 2009, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Out of extern because of inclusion of files which include my_compiler.h which in turn complains about C-linkage of templates. service_srv_session.h and service_command.h use proper extern "C" for their exported symbols. */ #ifndef EMBEDDED_LIBRARY #include <mysql/service_srv_session.h> #include <mysql/service_srv_session_info.h> #include <mysql/service_command.h> #endif #ifdef __cplusplus extern "C" { #endif #include <mysql/service_my_snprintf.h> #include <mysql/service_thd_alloc.h> #include <mysql/service_thd_wait.h> #include <mysql/service_thread_scheduler.h> #include <mysql/service_my_plugin_log.h> #include <mysql/service_mysql_string.h> #include <mysql/service_mysql_alloc.h> #include <mysql/service_mysql_password_policy.h> #include <mysql/service_parser.h> #include <mysql/service_rpl_transaction_ctx.h> #include <mysql/service_rpl_transaction_write_set.h> #include <mysql/service_security_context.h> #include <mysql/service_locking.h> #include <mysql/service_mysql_keyring.h> #ifdef __cplusplus } #endif #ifdef __cplusplus #include <mysql/service_rules_table.h> #endif #define MYSQL_SERVICES_INCLUDED #endif /* MYSQL_SERVICES_INCLUDED */ ����������������������������������������������������������������������������������������������������mysql/mysql/plugin_ftparser.h�����������������������������������������������������������������������0000644�����������������00000016734�14763166026�0012461 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2005, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _my_plugin_ftparser_h #define _my_plugin_ftparser_h #include "plugin.h" /************************************************************************* API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN) */ /* Parsing modes. Set in MYSQL_FTPARSER_PARAM::mode */ enum enum_ftparser_mode { /* Fast and simple mode. This mode is used for indexing, and natural language queries. The parser is expected to return only those words that go into the index. Stopwords or too short/long words should not be returned. The 'boolean_info' argument of mysql_add_word() does not have to be set. */ MYSQL_FTPARSER_SIMPLE_MODE= 0, /* Parse with stopwords mode. This mode is used in boolean searches for "phrase matching." The parser is not allowed to ignore words in this mode. Every word should be returned, including stopwords and words that are too short or long. The 'boolean_info' argument of mysql_add_word() does not have to be set. */ MYSQL_FTPARSER_WITH_STOPWORDS= 1, /* Parse in boolean mode. This mode is used to parse a boolean query string. The parser should provide a valid MYSQL_FTPARSER_BOOLEAN_INFO structure in the 'boolean_info' argument to mysql_add_word(). Usually that means that the parser should recognize boolean operators in the parsing stream and set appropriate fields in MYSQL_FTPARSER_BOOLEAN_INFO structure accordingly. As for MYSQL_FTPARSER_WITH_STOPWORDS mode, no word should be ignored. Instead, use FT_TOKEN_STOPWORD for the token type of such a word. */ MYSQL_FTPARSER_FULL_BOOLEAN_INFO= 2 }; /* Token types for boolean mode searching (used for the type member of MYSQL_FTPARSER_BOOLEAN_INFO struct) FT_TOKEN_EOF: End of data. FT_TOKEN_WORD: Regular word. FT_TOKEN_LEFT_PAREN: Left parenthesis (start of group/sub-expression). FT_TOKEN_RIGHT_PAREN: Right parenthesis (end of group/sub-expression). FT_TOKEN_STOPWORD: Stopword. */ enum enum_ft_token_type { FT_TOKEN_EOF= 0, FT_TOKEN_WORD= 1, FT_TOKEN_LEFT_PAREN= 2, FT_TOKEN_RIGHT_PAREN= 3, FT_TOKEN_STOPWORD= 4 }; /* This structure is used in boolean search mode only. It conveys boolean-mode metadata to the MySQL search engine for every word in the search query. A valid instance of this structure must be filled in by the plugin parser and passed as an argument in the call to mysql_add_word (the callback function in the MYSQL_FTPARSER_PARAM structure) when a query is parsed in boolean mode. type: The token type. Should be one of the enum_ft_token_type values. yesno: Whether the word must be present for a match to occur: >0 Must be present <0 Must not be present 0 Neither; the word is optional but its presence increases the relevance With the default settings of the ft_boolean_syntax system variable, >0 corresponds to the '+' operator, <0 corrresponds to the '-' operator, and 0 means neither operator was used. weight_adjust: A weighting factor that determines how much a match for the word counts. Positive values increase, negative - decrease the relative word's importance in the query. wasign: The sign of the word's weight in the query. If it's non-negative the match for the word will increase document relevance, if it's negative - decrease (the word becomes a "noise word", the less of it the better). trunc: Corresponds to the '*' operator in the default setting of the ft_boolean_syntax system variable. position: Start position in bytes of the word in the document, used by InnoDB FTS. */ typedef struct st_mysql_ftparser_boolean_info { enum enum_ft_token_type type; int yesno; int weight_adjust; char wasign; char trunc; int position; /* These are parser state and must be removed. */ char prev; char *quot; } MYSQL_FTPARSER_BOOLEAN_INFO; /* The following flag means that buffer with a string (document, word) may be overwritten by the caller before the end of the parsing (that is before st_mysql_ftparser::deinit() call). If one needs the string to survive between two successive calls of the parsing function, she needs to save a copy of it. The flag may be set by MySQL before calling st_mysql_ftparser::parse(), or it may be set by a plugin before calling st_mysql_ftparser_param::mysql_parse() or st_mysql_ftparser_param::mysql_add_word(). */ #define MYSQL_FTFLAGS_NEED_COPY 1 /* An argument of the full-text parser plugin. This structure is filled in by MySQL server and passed to the parsing function of the plugin as an in/out parameter. mysql_parse: A pointer to the built-in parser implementation of the server. It's set by the server and can be used by the parser plugin to invoke the MySQL default parser. If plugin's role is to extract textual data from .doc, .pdf or .xml content, it might extract plaintext from the content, and then pass the text to the default MySQL parser to be parsed. mysql_add_word: A server callback to add a new word. When parsing a document, the server sets this to point at a function that adds the word to MySQL full-text index. When parsing a search query, this function will add the new word to the list of words to search for. The boolean_info argument can be NULL for all cases except when mode is MYSQL_FTPARSER_FULL_BOOLEAN_INFO. ftparser_state: A generic pointer. The plugin can set it to point to information to be used internally for its own purposes. mysql_ftparam: This is set by the server. It is used by MySQL functions called via mysql_parse() and mysql_add_word() callback. The plugin should not modify it. cs: Information about the character set of the document or query string. doc: A pointer to the document or query string to be parsed. length: Length of the document or query string, in bytes. flags: See MYSQL_FTFLAGS_* constants above. mode: The parsing mode. With boolean operators, with stopwords, or nothing. See enum_ftparser_mode above. */ typedef struct st_mysql_ftparser_param { int (*mysql_parse)(struct st_mysql_ftparser_param *, char *doc, int doc_len); int (*mysql_add_word)(struct st_mysql_ftparser_param *, char *word, int word_len, MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info); void *ftparser_state; void *mysql_ftparam; const struct charset_info_st *cs; char *doc; int length; int flags; enum enum_ftparser_mode mode; } MYSQL_FTPARSER_PARAM; /* Full-text parser descriptor. interface_version is, e.g., MYSQL_FTPARSER_INTERFACE_VERSION. The parsing, initialization, and deinitialization functions are invoked per SQL statement for which the parser is used. */ struct st_mysql_ftparser { int interface_version; int (*parse)(MYSQL_FTPARSER_PARAM *param); int (*init)(MYSQL_FTPARSER_PARAM *param); int (*deinit)(MYSQL_FTPARSER_PARAM *param); }; #endif ������������������������������������mysql/mysql/plugin_auth.h���������������������������������������������������������������������������0000644�����������������00000012363�14763166026�0011566 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef MYSQL_PLUGIN_AUTH_INCLUDED /* Copyright (c) 2010, 2016 Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** @file Authentication Plugin API. This file defines the API for server authentication plugins. */ #define MYSQL_PLUGIN_AUTH_INCLUDED #include <mysql/plugin.h> #define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0101 #include "plugin_auth_common.h" /* defines for MYSQL_SERVER_AUTH_INFO.password_used */ #define PASSWORD_USED_NO 0 #define PASSWORD_USED_YES 1 #define PASSWORD_USED_NO_MENTION 2 /* Authentication flags */ #define AUTH_FLAG_PRIVILEGED_USER_FOR_PASSWORD_CHANGE (1L << 0) #define AUTH_FLAG_USES_INTERNAL_STORAGE (1L << 1) /** Provides server plugin access to authentication information */ typedef struct st_mysql_server_auth_info { /** User name as sent by the client and shown in USER(). NULL if the client packet with the user name was not received yet. */ char *user_name; /** Length of user_name */ unsigned int user_name_length; /** A corresponding column value from the mysql.user table for the matching account name */ const char *auth_string; /** Length of auth_string */ unsigned long auth_string_length; /** Matching account name as found in the mysql.user table. A plugin can override it with another name that will be used by MySQL for authorization, and shown in CURRENT_USER() */ char authenticated_as[MYSQL_USERNAME_LENGTH+1]; /** The unique user name that was used by the plugin to authenticate. Plugins should put null-terminated UTF-8 here. Available through the @@EXTERNAL_USER variable. */ char external_user[512]; /** This only affects the "Authentication failed. Password used: %s" error message. has the following values : 0 : %s will be NO. 1 : %s will be YES. 2 : there will be no %s. Set it as appropriate or ignore at will. */ int password_used; /** Set to the name of the connected client host, if it can be resolved, or to its IP address otherwise. */ const char *host_or_ip; /** Length of host_or_ip */ unsigned int host_or_ip_length; } MYSQL_SERVER_AUTH_INFO; /** Server authentication plugin descriptor */ struct st_mysql_auth { int interface_version; /** version plugin uses */ /** A plugin that a client must use for authentication with this server plugin. Can be NULL to mean "any plugin". */ const char *client_auth_plugin; /** Function provided by the plugin which should perform authentication (using the vio functions if necessary) and return 0 if successful. The plugin can also fill the info.authenticated_as field if a different username should be used for authorization. */ int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info); /** New plugin API to generate password digest out of authentication string. This function will first invoke a service to check for validity of the password based on the policies defined and then generate encrypted hash @param[OUT] outbuf A buffer provided by server which will hold the authentication string generated by plugin. @param[INOUT] outbuflen Length of server provided buffer as IN param and length of plugin generated string as OUT param. @param[IN] inbuf auth string provided by user. @param[IN] inbuflen auth string length. @retval 0 OK 1 ERROR */ int (*generate_authentication_string)(char *outbuf, unsigned int *outbuflen, const char *inbuf, unsigned int inbuflen); /** Plugin API to validate password digest. @param[IN] inbuf hash string to be validated. @param[IN] buflen hash string length. @retval 0 OK 1 ERROR */ int (*validate_authentication_string)(char* const inbuf, unsigned int buflen); /** Plugin API to convert scrambled password to binary form based on scramble type. @param[IN] password The password hash containing the salt. @param[IN] password_len The length of the password hash. @param[INOUT] salt Used as password hash based on the authentication plugin. @param[INOUT] salt_len The length of salt. @retval 0 OK 1 ERROR */ int (*set_salt)(const char *password, unsigned int password_len, unsigned char* salt, unsigned char *salt_len); /** Authentication plugin capabilities */ const unsigned long authentication_flags; }; #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/service_mysql_string.h������������������������������������������������������������������0000644�����������������00000012353�14763166026�0013521 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2012, 2014, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* This service provides functions to parse mysql String */ #ifndef MYSQL_SERVICE_MYSQL_STRING_INCLUDED #define MYSQL_SERVICE_MYSQL_STRING_INCLUDED #ifndef MYSQL_ABI_CHECK #include <stdlib.h> #endif #ifdef __cplusplus extern "C" { #endif typedef void *mysql_string_iterator_handle; typedef void *mysql_string_handle; extern struct mysql_string_service_st { int (*mysql_string_convert_to_char_ptr_type) (mysql_string_handle, const char *, char *, unsigned int, int *); mysql_string_iterator_handle (*mysql_string_get_iterator_type) (mysql_string_handle); int (*mysql_string_iterator_next_type)(mysql_string_iterator_handle); int (*mysql_string_iterator_isupper_type)(mysql_string_iterator_handle); int (*mysql_string_iterator_islower_type)(mysql_string_iterator_handle); int (*mysql_string_iterator_isdigit_type)(mysql_string_iterator_handle); mysql_string_handle (*mysql_string_to_lowercase_type)(mysql_string_handle); void (*mysql_string_free_type)(mysql_string_handle); void (*mysql_string_iterator_free_type)(mysql_string_iterator_handle); } *mysql_string_service; #ifdef MYSQL_DYNAMIC_PLUGIN #define mysql_string_convert_to_char_ptr(string_handle, charset_name, \ buffer, buffer_size, error) \ mysql_string_service->mysql_string_convert_to_char_ptr_type \ (string_handle, charset_name, buffer, \ buffer_size, error) #define mysql_string_get_iterator(string_handle) \ mysql_string_service->mysql_string_get_iterator_type(string_handle) #define mysql_string_iterator_next(iterator_handle) \ mysql_string_service->mysql_string_iterator_next_type(iterator_handle) #define mysql_string_iterator_isupper(iterator_handle) \ mysql_string_service->mysql_string_iterator_isupper_type \ (iterator_handle) #define mysql_string_iterator_islower(iterator_handle) \ mysql_string_service->mysql_string_iterator_islower_type \ (iterator_handle) #define mysql_string_iterator_isdigit(iterator_handle) \ mysql_string_service->mysql_string_iterator_isdigit_type \ (iterator_handle) #define mysql_string_to_lowercase(string_handle) \ mysql_string_service->mysql_string_to_lowercase_type(string_handle) #define mysql_string_free(mysql_string_handle) \ mysql_string_service->mysql_string_free_type(mysql_string_handle) #define mysql_string_iterator_free(mysql_string_iterator_handle) \ mysql_string_service->mysql_string_iterator_free_type \ (mysql_string_iterator_handle) #else /* This service function convert string into given character set */ int mysql_string_convert_to_char_ptr(mysql_string_handle string_handle, const char *charset_name, char *buffer, unsigned int buffer_size, int *error); /* This service function returns the beginning of the iterator handle */ mysql_string_iterator_handle mysql_string_get_iterator(mysql_string_handle string_handle); /* This service function gets the next iterator handle returns 0 if reached the end else return 1 */ int mysql_string_iterator_next(mysql_string_iterator_handle iterator_handle); /* This service function return 1 if current iterator handle points to a uppercase character else return 0 for client character set. */ int mysql_string_iterator_isupper(mysql_string_iterator_handle iterator_handle); /* This service function return 1 if current iterator handle points to a lowercase character else return 0 for client character set. */ int mysql_string_iterator_islower(mysql_string_iterator_handle iterator_handle); /* This service function return 1 if current iterator handle points to a digit else return 0 for client character sets. */ int mysql_string_iterator_isdigit(mysql_string_iterator_handle iterator_handle); /* convert string_handle into lowercase */ mysql_string_handle mysql_string_to_lowercase(mysql_string_handle string_handle); /* It deallocates the string created on server side during plugin operations */ void mysql_string_free(mysql_string_handle); /* It deallocates the string iterator created on server side during plugin operations */ void mysql_string_iterator_free(mysql_string_iterator_handle); #endif #ifdef __cplusplus } #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/service_thd_engine_lock.h���������������������������������������������������������������0000644�����������������00000002721�14763166026�0014100 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_SERVICE_THD_EGINE_LOCK_INCLUDED #define MYSQL_SERVICE_THD_EGINE_LOCK_INCLUDED /** @file include/mysql/service_thd_engine_lock.h This service provides functions for storage engines to report lock related activities. SYNOPSIS thd_row_lock_wait() - call it just when the engine find a transaction should wait another transaction to realease a row lock thd The session which is waiting for the row lock to release. thd_wait_for The session which is holding the row lock. */ #ifdef __cplusplus class THD; #else #define THD void #endif #ifdef __cplusplus extern "C" { #endif void thd_report_row_lock_wait(THD* self, THD *wait_for); #ifdef __cplusplus } #endif #endif �����������������������������������������������mysql/mysql/service_mysql_alloc.h�������������������������������������������������������������������0000644�����������������00000005310�14763166026�0013300 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_SERVICE_MYSQL_ALLOC_INCLUDED #define MYSQL_SERVICE_MYSQL_ALLOC_INCLUDED #ifndef MYSQL_ABI_CHECK #include <stdlib.h> #endif /* PSI_memory_key */ #include "mysql/psi/psi_memory.h" #ifdef __cplusplus extern "C" { #endif /* myf */ typedef int myf_t; typedef void * (*mysql_malloc_t)(PSI_memory_key key, size_t size, myf_t flags); typedef void * (*mysql_realloc_t)(PSI_memory_key key, void *ptr, size_t size, myf_t flags); typedef void (*mysql_claim_t)(void *ptr); typedef void (*mysql_free_t)(void *ptr); typedef void * (*my_memdup_t)(PSI_memory_key key, const void *from, size_t length, myf_t flags); typedef char * (*my_strdup_t)(PSI_memory_key key, const char *from, myf_t flags); typedef char * (*my_strndup_t)(PSI_memory_key key, const char *from, size_t length, myf_t flags); struct mysql_malloc_service_st { mysql_malloc_t mysql_malloc; mysql_realloc_t mysql_realloc; mysql_claim_t mysql_claim; mysql_free_t mysql_free; my_memdup_t my_memdup; my_strdup_t my_strdup; my_strndup_t my_strndup; }; extern struct mysql_malloc_service_st *mysql_malloc_service; #ifdef MYSQL_DYNAMIC_PLUGIN #define my_malloc mysql_malloc_service->mysql_malloc #define my_realloc mysql_malloc_service->mysql_realloc #define my_claim mysql_malloc_service->mysql_claim #define my_free mysql_malloc_service->mysql_free #define my_memdup mysql_malloc_service->my_memdup #define my_strdup mysql_malloc_service->my_strdup #define my_strndup mysql_malloc_service->my_strndup #else extern void * my_malloc(PSI_memory_key key, size_t size, myf_t flags); extern void * my_realloc(PSI_memory_key key, void *ptr, size_t size, myf_t flags); extern void my_claim(void *ptr); extern void my_free(void *ptr); extern void * my_memdup(PSI_memory_key key, const void *from, size_t length, myf_t flags); extern char * my_strdup(PSI_memory_key key, const char *from, myf_t flags); extern char * my_strndup(PSI_memory_key key, const char *from, size_t length, myf_t flags); #endif #ifdef __cplusplus } #endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/group_replication_priv.h����������������������������������������������������������������0000644�����������������00000011167�14763166026�0014035 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2015, 2017, Oracle and/or its affiliates. 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; version 2 of the License. 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, 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef GROUP_REPLICATION_PRIV_INCLUDE #define GROUP_REPLICATION_PRIV_INCLUDE #ifndef MYSQL_SERVER #define MYSQL_SERVER #endif #ifndef HAVE_REPLICATION #define HAVE_REPLICATION #endif #include <my_global.h> #include <my_thread.h> #include <my_sys.h> #include <debug_sync.h> #include <log_event.h> #include <replication.h> #include <rpl_channel_service_interface.h> #include <rpl_gtid.h> #include <rpl_write_set_handler.h> /** Server side initializations and cleanup. */ int group_replication_init(const char* plugin_name); int group_replication_cleanup(); int group_replication_start(); int group_replication_stop(); /** Returns the server connection attribute @Note This method implementation is on sql_class.cc @return the pthread for the connection attribute. */ my_thread_attr_t *get_connection_attrib(); /** Returns the server hostname, port and uuid. @param[out] hostname @param[out] port @param[out] uuid @param[out] server_version @param[out] server_ssl_variables */ void get_server_parameters(char **hostname, uint *port, char **uuid, unsigned int *server_version, st_server_ssl_variables* server_ssl_variables); /** Returns the server_id. @return server_id */ ulong get_server_id(); /** Returns the server auto_increment_increment @return auto_increment_increment */ ulong get_auto_increment_increment(); /** Returns the server auto_increment_offset @return auto_increment_offset */ ulong get_auto_increment_offset(); /** Set server auto_increment_increment @param[in] auto_increment_increment */ void set_auto_increment_increment(ulong auto_increment_increment); /** Set server auto_increment_offset @param[in] auto_increment_offset */ void set_auto_increment_offset(ulong auto_increment_offset); /** Returns a struct containing all server startup information needed to evaluate if one has conditions to proceed executing master-master replication. @param[out] requirements @param[in] has_lock Caller should set this to true if the calling thread holds gtid_mode_lock; otherwise set it to false. */ void get_server_startup_prerequirements(Trans_context_info& requirements, bool has_lock); /** Returns the server GTID_EXECUTED encoded as a binary string. @note Memory allocated to encoded_gtid_executed must be release by caller. @param[out] encoded_gtid_executed binary string @param[out] length binary string length */ bool get_server_encoded_gtid_executed(uchar **encoded_gtid_executed, size_t *length); #if !defined(DBUG_OFF) /** Returns a text representation of a encoded GTID set. @note Memory allocated to returned pointer must be release by caller. @param[in] encoded_gtid_set binary string @param[in] length binary string length @return a pointer to text representation of the encoded set */ char* encoded_gtid_set_to_string(uchar *encoded_gtid_set, size_t length); #endif /** Return last gno for a given sidno, see Gtid_state::get_last_executed_gno() for details. */ rpl_gno get_last_executed_gno(rpl_sidno sidno); /** Return sidno for a given sid, see Sid_map::add_sid() for details. */ rpl_sidno get_sidno_from_global_sid_map(rpl_sid sid); /** Set slave thread default options. @param[in] thd The thread */ void set_slave_thread_options(THD* thd); /** Add thread to Global_THD_manager singleton. @param[in] thd The thread */ void global_thd_manager_add_thd(THD *thd); /** Remove thread from Global_THD_manager singleton. @param[in] thd The thread */ void global_thd_manager_remove_thd(THD *thd); /** Function that returns the write set extraction algorithm name. @param[in] algorithm The algorithm value @return the algorithm name */ const char* get_write_set_algorithm_string(unsigned int algorithm); #endif /* GROUP_REPLICATION_PRIV_INCLUDE */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/service_security_context.h��������������������������������������������������������������0000644�����������������00000007732�14763166026�0014406 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_SERVICE_SECURITY_CONTEXT #define MYSQL_SERVICE_SECURITY_CONTEXT /** @file include/mysql/service_security_context.h This service provides functions for plugins and storage engines to manipulate the thread's security context. */ #ifdef __cplusplus class Security_context; #define MYSQL_SECURITY_CONTEXT Security_context* #else #define MYSQL_SECURITY_CONTEXT void* #endif typedef char my_svc_bool; #ifdef __cplusplus extern "C" { #endif extern struct security_context_service_st { my_svc_bool (*thd_get_security_context)(MYSQL_THD, MYSQL_SECURITY_CONTEXT *out_ctx); my_svc_bool (*thd_set_security_context)(MYSQL_THD, MYSQL_SECURITY_CONTEXT in_ctx); my_svc_bool (*security_context_create)(MYSQL_SECURITY_CONTEXT *out_ctx); my_svc_bool (*security_context_destroy)(MYSQL_SECURITY_CONTEXT); my_svc_bool (*security_context_copy)(MYSQL_SECURITY_CONTEXT in_ctx, MYSQL_SECURITY_CONTEXT *out_ctx); my_svc_bool (*security_context_lookup)(MYSQL_SECURITY_CONTEXT ctx, const char *user, const char *host, const char *ip, const char *db); my_svc_bool (*security_context_get_option)(MYSQL_SECURITY_CONTEXT, const char *name, void *inout_pvalue); my_svc_bool (*security_context_set_option)(MYSQL_SECURITY_CONTEXT, const char *name, void *pvalue); } *security_context_service; #ifdef MYSQL_DYNAMIC_PLUGIN #define thd_get_security_context(_THD, _CTX) \ security_context_service->thd_get_security_context(_THD, _CTX) #define thd_set_security_context(_THD, _CTX) \ security_context_service->thd_set_security_context(_THD, _CTX) #define security_context_create(_CTX) \ security_context_service->security_context_create(_CTX) #define security_context_destroy(_CTX) \ security_context_service->security_context_destroy(_CTX) #define security_context_copy(_CTX1, _CTX2) \ security_context_service->security_context_copy(_CTX1,_CTX2) #define security_context_lookup(_CTX, _U, _H, _IP, _DB) \ security_context_service->security_context_lookup(_CTX, _U, _H, _IP, _DB) #define security_context_get_option(_SEC_CTX, _NAME, _VALUE) \ security_context_service->security_context_get_option(_SEC_CTX, _NAME, _VALUE) #define security_context_set_option(_SEC_CTX, _NAME, _VALUE) \ security_context_service->security_context_set_option(_SEC_CTX, _NAME, _VALUE) #else my_svc_bool thd_get_security_context(MYSQL_THD, MYSQL_SECURITY_CONTEXT *out_ctx); my_svc_bool thd_set_security_context(MYSQL_THD, MYSQL_SECURITY_CONTEXT in_ctx); my_svc_bool security_context_create(MYSQL_SECURITY_CONTEXT *out_ctx); my_svc_bool security_context_destroy(MYSQL_SECURITY_CONTEXT ctx); my_svc_bool security_context_copy(MYSQL_SECURITY_CONTEXT in_ctx, MYSQL_SECURITY_CONTEXT *out_ctx); my_svc_bool security_context_lookup(MYSQL_SECURITY_CONTEXT ctx, const char *user, const char *host, const char *ip, const char *db); my_svc_bool security_context_get_option(MYSQL_SECURITY_CONTEXT, const char *name, void *inout_pvalue); my_svc_bool security_context_set_option(MYSQL_SECURITY_CONTEXT, const char *name, void *pvalue); #endif /* !MYSQL_DYNAMIC_PLUGIN */ #ifdef __cplusplus } #endif /* _cplusplus */ #endif /* !MYSQL_SERVICE_SECURITY_CONTEXT */ ��������������������������������������mysql/mysql/plugin.h��������������������������������������������������������������������������������0000644�����������������00000067621�14763166026�0010554 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2005, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _my_plugin_h #define _my_plugin_h #ifndef MYSQL_ABI_CHECK #include <stddef.h> #include "mysql_version.h" /* MYSQL_VERSION_ID */ #endif /* On Windows, exports from DLL need to be declared. Also, plugin needs to be declared as extern "C" because MSVC unlike other compilers, uses C++ mangling for variables not only for functions. */ #if defined(_MSC_VER) #if defined(MYSQL_DYNAMIC_PLUGIN) #ifdef __cplusplus #define MYSQL_PLUGIN_EXPORT extern "C" __declspec(dllexport) #else #define MYSQL_PLUGIN_EXPORT __declspec(dllexport) #endif #else /* MYSQL_DYNAMIC_PLUGIN */ #ifdef __cplusplus #define MYSQL_PLUGIN_EXPORT extern "C" #else #define MYSQL_PLUGIN_EXPORT #endif #endif /*MYSQL_DYNAMIC_PLUGIN */ #else /*_MSC_VER */ #define MYSQL_PLUGIN_EXPORT #endif #ifdef __cplusplus class THD; class Item; #define MYSQL_THD THD* #else #define MYSQL_THD void* #endif typedef void * MYSQL_PLUGIN; #ifndef MYSQL_ABI_CHECK #include <mysql/services.h> #ifndef __WIN__ #ifndef __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS /* Enable C99 printf format macros */ #endif /* !__STDC_FORMAT_MACROS */ #include <inttypes.h> #endif /* !__WIN__ */ #endif /* !MYSQL_ABI_CHECK */ #define MYSQL_XIDDATASIZE 128 /** struct st_mysql_xid is binary compatible with the XID structure as in the X/Open CAE Specification, Distributed Transaction Processing: The XA Specification, X/Open Company Ltd., 1991. http://www.opengroup.org/bookstore/catalog/c193.htm @see XID in sql/handler.h */ struct st_mysql_xid { long formatID; long gtrid_length; long bqual_length; char data[MYSQL_XIDDATASIZE]; /* Not \0-terminated */ }; typedef struct st_mysql_xid MYSQL_XID; /************************************************************************* Plugin API. Common for all plugin types. */ #define MYSQL_PLUGIN_INTERFACE_VERSION 0x0107 /* The allowable types of plugins */ #define MYSQL_UDF_PLUGIN 0 /* User-defined function */ #define MYSQL_STORAGE_ENGINE_PLUGIN 1 /* Storage Engine */ #define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */ #define MYSQL_DAEMON_PLUGIN 3 /* The daemon/raw plugin type */ #define MYSQL_INFORMATION_SCHEMA_PLUGIN 4 /* The I_S plugin type */ #define MYSQL_AUDIT_PLUGIN 5 /* The Audit plugin type */ #define MYSQL_REPLICATION_PLUGIN 6 /* The replication plugin type */ #define MYSQL_AUTHENTICATION_PLUGIN 7 /* The authentication plugin type */ #define MYSQL_VALIDATE_PASSWORD_PLUGIN 8 /* validate password plugin type */ #define MYSQL_GROUP_REPLICATION_PLUGIN 9 /* The Group Replication plugin */ #define MYSQL_KEYRING_PLUGIN 10 /* The Keyring plugin type */ #define MYSQL_MAX_PLUGIN_TYPE_NUM 11 /* The number of plugin types */ /* We use the following strings to define licenses for plugins */ #define PLUGIN_LICENSE_PROPRIETARY 0 #define PLUGIN_LICENSE_GPL 1 #define PLUGIN_LICENSE_BSD 2 #define PLUGIN_LICENSE_PROPRIETARY_STRING "PROPRIETARY" #define PLUGIN_LICENSE_GPL_STRING "GPL" #define PLUGIN_LICENSE_BSD_STRING "BSD" /* Macros for beginning and ending plugin declarations. Between mysql_declare_plugin and mysql_declare_plugin_end there should be a st_mysql_plugin struct for each plugin to be declared. */ #ifndef MYSQL_DYNAMIC_PLUGIN #define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \ MYSQL_PLUGIN_EXPORT int VERSION= MYSQL_PLUGIN_INTERFACE_VERSION; \ MYSQL_PLUGIN_EXPORT int PSIZE= sizeof(struct st_mysql_plugin); \ MYSQL_PLUGIN_EXPORT struct st_mysql_plugin DECLS[]= { #else #define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \ MYSQL_PLUGIN_EXPORT int _mysql_plugin_interface_version_= MYSQL_PLUGIN_INTERFACE_VERSION; \ MYSQL_PLUGIN_EXPORT int _mysql_sizeof_struct_st_plugin_= sizeof(struct st_mysql_plugin); \ MYSQL_PLUGIN_EXPORT struct st_mysql_plugin _mysql_plugin_declarations_[]= { #endif #define mysql_declare_plugin(NAME) \ __MYSQL_DECLARE_PLUGIN(NAME, \ builtin_ ## NAME ## _plugin_interface_version, \ builtin_ ## NAME ## _sizeof_struct_st_plugin, \ builtin_ ## NAME ## _plugin) #define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0,0,0}} /** Declarations for SHOW STATUS support in plugins */ enum enum_mysql_show_type { SHOW_UNDEF, SHOW_BOOL, SHOW_INT, ///< shown as _unsigned_ int SHOW_LONG, ///< shown as _unsigned_ long SHOW_LONGLONG, ///< shown as _unsigned_ longlong SHOW_SIGNED_INT, SHOW_SIGNED_LONG, SHOW_SIGNED_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE #ifdef MYSQL_SERVER /* This include defines server-only values of the enum. Using them in plugins is not supported. */ #include "sql_plugin_enum.h" #endif }; /** Status variable scope. Only GLOBAL status variable scope is available in plugins. */ enum enum_mysql_show_scope { SHOW_SCOPE_UNDEF, SHOW_SCOPE_GLOBAL #ifdef MYSQL_SERVER /* Server-only values. Not supported in plugins. */ , SHOW_SCOPE_SESSION, SHOW_SCOPE_ALL #endif }; /** SHOW STATUS Server status variable */ struct st_mysql_show_var { const char *name; char *value; enum enum_mysql_show_type type; enum enum_mysql_show_scope scope; }; #define SHOW_VAR_MAX_NAME_LEN 64 #define SHOW_VAR_FUNC_BUFF_SIZE 1024 typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, char *); /* Constants for plugin flags. */ #define PLUGIN_OPT_NO_INSTALL 1UL /* Not dynamically loadable */ #define PLUGIN_OPT_NO_UNINSTALL 2UL /* Not dynamically unloadable */ /* declarations for server variables and command line options */ #define PLUGIN_VAR_BOOL 0x0001 #define PLUGIN_VAR_INT 0x0002 #define PLUGIN_VAR_LONG 0x0003 #define PLUGIN_VAR_LONGLONG 0x0004 #define PLUGIN_VAR_STR 0x0005 #define PLUGIN_VAR_ENUM 0x0006 #define PLUGIN_VAR_SET 0x0007 #define PLUGIN_VAR_DOUBLE 0x0008 #define PLUGIN_VAR_UNSIGNED 0x0080 #define PLUGIN_VAR_THDLOCAL 0x0100 /* Variable is per-connection */ #define PLUGIN_VAR_READONLY 0x0200 /* Server variable is read only */ #define PLUGIN_VAR_NOSYSVAR 0x0400 /* Not a server variable */ #define PLUGIN_VAR_NOCMDOPT 0x0800 /* Not a command line option */ #define PLUGIN_VAR_NOCMDARG 0x1000 /* No argument for cmd line */ #define PLUGIN_VAR_RQCMDARG 0x0000 /* Argument required for cmd line */ #define PLUGIN_VAR_OPCMDARG 0x2000 /* Argument optional for cmd line */ #define PLUGIN_VAR_NODEFAULT 0x4000 /* SET DEFAULT is prohibited */ #define PLUGIN_VAR_MEMALLOC 0x8000 /* String needs memory allocated */ struct st_mysql_sys_var; struct st_mysql_value; /* SYNOPSIS (*mysql_var_check_func)() thd thread handle var dynamic variable being altered save pointer to temporary storage value user provided value RETURN 0 user provided value is OK and the update func may be called. any other value indicates error. This function should parse the user provided value and store in the provided temporary storage any data as required by the update func. There is sufficient space in the temporary storage to store a double. Note that the update func may not be called if any other error occurs so any memory allocated should be thread-local so that it may be freed automatically at the end of the statement. */ typedef int (*mysql_var_check_func)(MYSQL_THD thd, struct st_mysql_sys_var *var, void *save, struct st_mysql_value *value); /* SYNOPSIS (*mysql_var_update_func)() thd thread handle var dynamic variable being altered var_ptr pointer to dynamic variable save pointer to temporary storage RETURN NONE This function should use the validated value stored in the temporary store and persist it in the provided pointer to the dynamic variable. For example, strings may require memory to be allocated. */ typedef void (*mysql_var_update_func)(MYSQL_THD thd, struct st_mysql_sys_var *var, void *var_ptr, const void *save); /* the following declarations are for internal use only */ #define PLUGIN_VAR_MASK \ (PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | \ PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_NOCMDARG | \ PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC | \ PLUGIN_VAR_NODEFAULT) #define MYSQL_PLUGIN_VAR_HEADER \ int flags; \ const char *name; \ const char *comment; \ mysql_var_check_func check; \ mysql_var_update_func update #define MYSQL_SYSVAR_NAME(name) mysql_sysvar_ ## name #define MYSQL_SYSVAR(name) \ ((struct st_mysql_sys_var *)&(MYSQL_SYSVAR_NAME(name))) /* for global variables, the value pointer is the first element after the header, the default value is the second. for thread variables, the value offset is the first element after the header, the default value is the second. */ #define DECLARE_MYSQL_SYSVAR_BASIC(name, type) struct { \ MYSQL_PLUGIN_VAR_HEADER; \ type *value; \ const type def_val; \ } MYSQL_SYSVAR_NAME(name) #define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) struct { \ MYSQL_PLUGIN_VAR_HEADER; \ type *value; type def_val; \ type min_val; type max_val; \ type blk_sz; \ } MYSQL_SYSVAR_NAME(name) #define DECLARE_MYSQL_SYSVAR_TYPELIB(name, type) struct { \ MYSQL_PLUGIN_VAR_HEADER; \ type *value; type def_val; \ TYPELIB *typelib; \ } MYSQL_SYSVAR_NAME(name) #define DECLARE_THDVAR_FUNC(type) \ type *(*resolve)(MYSQL_THD thd, int offset) #define DECLARE_MYSQL_THDVAR_BASIC(name, type) struct { \ MYSQL_PLUGIN_VAR_HEADER; \ int offset; \ const type def_val; \ DECLARE_THDVAR_FUNC(type); \ } MYSQL_SYSVAR_NAME(name) #define DECLARE_MYSQL_THDVAR_SIMPLE(name, type) struct { \ MYSQL_PLUGIN_VAR_HEADER; \ int offset; \ type def_val; type min_val; \ type max_val; type blk_sz; \ DECLARE_THDVAR_FUNC(type); \ } MYSQL_SYSVAR_NAME(name) #define DECLARE_MYSQL_THDVAR_TYPELIB(name, type) struct { \ MYSQL_PLUGIN_VAR_HEADER; \ int offset; \ type def_val; \ DECLARE_THDVAR_FUNC(type); \ TYPELIB *typelib; \ } MYSQL_SYSVAR_NAME(name) /* the following declarations are for use by plugin implementors */ #define MYSQL_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \ DECLARE_MYSQL_SYSVAR_BASIC(name, char) = { \ PLUGIN_VAR_BOOL | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def} #define MYSQL_SYSVAR_STR(name, varname, opt, comment, check, update, def) \ DECLARE_MYSQL_SYSVAR_BASIC(name, char *) = { \ PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def} #define MYSQL_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_SYSVAR_SIMPLE(name, int) = { \ PLUGIN_VAR_INT | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, min, max, blk } #define MYSQL_SYSVAR_UINT(name, varname, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned int) = { \ PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, min, max, blk } #define MYSQL_SYSVAR_LONG(name, varname, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_SYSVAR_SIMPLE(name, long) = { \ PLUGIN_VAR_LONG | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, min, max, blk } #define MYSQL_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long) = { \ PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, min, max, blk } #define MYSQL_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_SYSVAR_SIMPLE(name, long long) = { \ PLUGIN_VAR_LONGLONG | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, min, max, blk } #define MYSQL_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long long) = { \ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, min, max, blk } #define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \ DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long) = { \ PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, typelib } #define MYSQL_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \ DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long long) = { \ PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, typelib } #define MYSQL_SYSVAR_DOUBLE(name, varname, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_SYSVAR_SIMPLE(name, double) = { \ PLUGIN_VAR_DOUBLE | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, min, max, blk } #define MYSQL_THDVAR_BOOL(name, opt, comment, check, update, def) \ DECLARE_MYSQL_THDVAR_BASIC(name, char) = { \ PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, NULL} #define MYSQL_THDVAR_STR(name, opt, comment, check, update, def) \ DECLARE_MYSQL_THDVAR_BASIC(name, char *) = { \ PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, NULL} #define MYSQL_THDVAR_INT(name, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_THDVAR_SIMPLE(name, int) = { \ PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, min, max, blk, NULL } #define MYSQL_THDVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned int) = { \ PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, min, max, blk, NULL } #define MYSQL_THDVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_THDVAR_SIMPLE(name, long) = { \ PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, min, max, blk, NULL } #define MYSQL_THDVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long) = { \ PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, min, max, blk, NULL } #define MYSQL_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_THDVAR_SIMPLE(name, long long) = { \ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, min, max, blk, NULL } #define MYSQL_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long long) = { \ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, min, max, blk, NULL } #define MYSQL_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \ DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long) = { \ PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, NULL, typelib } #define MYSQL_THDVAR_SET(name, opt, comment, check, update, def, typelib) \ DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long long) = { \ PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, NULL, typelib } #define MYSQL_THDVAR_DOUBLE(name, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_THDVAR_SIMPLE(name, double) = { \ PLUGIN_VAR_DOUBLE | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, min, max, blk, NULL } /* accessor macros */ #define SYSVAR(name) \ (*(MYSQL_SYSVAR_NAME(name).value)) /* when thd == null, result points to global value */ #define THDVAR(thd, name) \ (*(MYSQL_SYSVAR_NAME(name).resolve(thd, MYSQL_SYSVAR_NAME(name).offset))) #define THDVAR_SET(thd, name, value) \ plugin_thdvar_safe_update(thd, MYSQL_SYSVAR(name), \ (char **) &THDVAR(thd, name), \ (const char *) value); /* Plugin description structure. */ struct st_mysql_plugin { int type; /* the plugin type (a MYSQL_XXX_PLUGIN value) */ void *info; /* pointer to type-specific plugin descriptor */ const char *name; /* plugin name */ const char *author; /* plugin author (for I_S.PLUGINS) */ const char *descr; /* general descriptive text (for I_S.PLUGINS) */ int license; /* the plugin license (PLUGIN_LICENSE_XXX) */ int (*init)(MYSQL_PLUGIN); /* the function to invoke when plugin is loaded */ int (*deinit)(MYSQL_PLUGIN);/* the function to invoke when plugin is unloaded */ unsigned int version; /* plugin version (for I_S.PLUGINS) */ struct st_mysql_show_var *status_vars; struct st_mysql_sys_var **system_vars; void * __reserved1; /* reserved for dependency checking */ unsigned long flags; /* flags for plugin */ }; /************************************************************************* API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN) */ #define MYSQL_FTPARSER_INTERFACE_VERSION 0x0101 /************************************************************************* API for Query Rewrite plugin. (MYSQL_QUERY_REWRITE_PLUGIN) */ #define MYSQL_REWRITE_PRE_PARSE_INTERFACE_VERSION 0x0010 #define MYSQL_REWRITE_POST_PARSE_INTERFACE_VERSION 0x0010 /************************************************************************* API for Storage Engine plugin. (MYSQL_DAEMON_PLUGIN) */ /* handlertons of different MySQL releases are incompatible */ #define MYSQL_DAEMON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8) /* Here we define only the descriptor structure, that is referred from st_mysql_plugin. */ struct st_mysql_daemon { int interface_version; }; /************************************************************************* API for I_S plugin. (MYSQL_INFORMATION_SCHEMA_PLUGIN) */ /* handlertons of different MySQL releases are incompatible */ #define MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION (MYSQL_VERSION_ID << 8) /* Here we define only the descriptor structure, that is referred from st_mysql_plugin. */ struct st_mysql_information_schema { int interface_version; }; /************************************************************************* API for Storage Engine plugin. (MYSQL_STORAGE_ENGINE_PLUGIN) */ /* handlertons of different MySQL releases are incompatible */ #define MYSQL_HANDLERTON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8) /* The real API is in the sql/handler.h Here we define only the descriptor structure, that is referred from st_mysql_plugin. */ struct st_mysql_storage_engine { int interface_version; }; struct handlerton; /* API for Replication plugin. (MYSQL_REPLICATION_PLUGIN) */ #define MYSQL_REPLICATION_INTERFACE_VERSION 0x0400 /** Replication plugin descriptor */ struct Mysql_replication { int interface_version; }; /************************************************************************* st_mysql_value struct for reading values from mysqld. Used by server variables framework to parse user-provided values. Will be used for arguments when implementing UDFs. Note that val_str() returns a string in temporary memory that will be freed at the end of statement. Copy the string if you need it to persist. */ #define MYSQL_VALUE_TYPE_STRING 0 #define MYSQL_VALUE_TYPE_REAL 1 #define MYSQL_VALUE_TYPE_INT 2 struct st_mysql_value { int (*value_type)(struct st_mysql_value *); const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length); int (*val_real)(struct st_mysql_value *, double *realbuf); int (*val_int)(struct st_mysql_value *, long long *intbuf); int (*is_unsigned)(struct st_mysql_value *); }; /************************************************************************* Miscellaneous functions for plugin implementors */ #ifdef __cplusplus extern "C" { #endif int thd_in_lock_tables(const MYSQL_THD thd); int thd_tablespace_op(const MYSQL_THD thd); long long thd_test_options(const MYSQL_THD thd, long long test_options); int thd_sql_command(const MYSQL_THD thd); const char *set_thd_proc_info(MYSQL_THD thd, const char *info, const char *calling_func, const char *calling_file, const unsigned int calling_line); void **thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton); void thd_storage_lock_wait(MYSQL_THD thd, long long value); int thd_tx_isolation(const MYSQL_THD thd); int thd_tx_is_read_only(const MYSQL_THD thd); MYSQL_THD thd_tx_arbitrate(MYSQL_THD requestor, MYSQL_THD holder); int thd_tx_priority(const MYSQL_THD thd); int thd_tx_is_dd_trx(const MYSQL_THD thd); char *thd_security_context(MYSQL_THD thd, char *buffer, size_t length, size_t max_query_len); /* Increments the row counter, see THD::row_count */ void thd_inc_row_count(MYSQL_THD thd); int thd_allow_batch(MYSQL_THD thd); /** Mark transaction to rollback and mark error as fatal to a sub-statement if in sub statement mode. @param thd user thread connection handle @param all if all != 0, rollback the main transaction */ void thd_mark_transaction_to_rollback(MYSQL_THD thd, int all); /** Types of statistics that can be passed to thd_report_innodb_stat */ enum mysql_trx_stat_type { /** Volume of I/O read requests in bytes */ MYSQL_TRX_STAT_IO_READ_BYTES, /** Time in microseconds spent waiting for I/O reads to complete */ MYSQL_TRX_STAT_IO_READ_WAIT_USECS, /** Time in microseconds spent waiting for row locks */ MYSQL_TRX_STAT_LOCK_WAIT_USECS, /** Time in microseconds spent waiting to enter InnoDB */ MYSQL_TRX_STAT_INNODB_QUEUE_WAIT_USECS, /** A logical data page accessed */ MYSQL_TRX_STAT_ACCESS_PAGE_ID }; /** Report various InnoDB statistics for the slow query log extensions @param[in] thd user thread connection handle @param[in] trx_id InnoDB tranaction ID @param[in] type type of statistics being reported @param[in] value the value of statistics */ void thd_report_innodb_stat(MYSQL_THD thd, unsigned long long trx_id, enum mysql_trx_stat_type type, unsigned long long value); unsigned long thd_log_slow_verbosity(const MYSQL_THD thd); int thd_opt_slow_log(); /** Check whether given connection handle is associated with a background thread. @param thd connection handle @retval non-zero the connection handle belongs to a background thread @retval 0 the connection handle belongs to a different thread type */ int thd_is_background_thread(const MYSQL_THD thd); /** Create a temporary file. @details The temporary file is created in a location specified by the mysql server configuration (--tmpdir option). The caller does not need to delete the file, it will be deleted automatically. @param prefix prefix for temporary file name @retval -1 error @retval >= 0 a file handle that can be passed to dup or my_close */ int mysql_tmpfile(const char *prefix); /** Check the killed state of a connection @details In MySQL support for the KILL statement is cooperative. The KILL statement only sets a "killed" flag. This function returns the value of that flag. A thread should check it often, especially inside time-consuming loops, and gracefully abort the operation if it is non-zero. @param thd user thread connection handle @retval 0 the connection is active @retval 1 the connection has been killed */ int thd_killed(const MYSQL_THD thd); /** Set the killed status of the current statement. @param thd user thread connection handle */ void thd_set_kill_status(const MYSQL_THD thd); /** Get binary log position for latest written entry. @note The file variable will be set to a buffer holding the name of the file name currently, but this can change if a rotation occur. Copy the string if you want to retain it. @param thd Use thread connection handle @param file_var Pointer to variable that will hold the file name. @param pos_var Pointer to variable that will hold the file position. */ void thd_binlog_pos(const MYSQL_THD thd, const char **file_var, unsigned long long *pos_var); /** Return the thread id of a user thread @param thd user thread connection handle @return thread id */ unsigned long thd_get_thread_id(const MYSQL_THD thd); /** Return the query id of a thread @param thd user thread @return query id */ int64_t thd_get_query_id(const MYSQL_THD thd); /** Get the XID for this connection's transaction @param thd user thread connection handle @param xid location where identifier is stored */ void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid); /** Invalidate the query cache for a given table. @param thd user thread connection handle @param key databasename/tablename in the canonical format. @param key_length length of key in bytes, including the PATH separator @param using_trx flag: TRUE if using transactions, FALSE otherwise */ void mysql_query_cache_invalidate4(MYSQL_THD thd, const char *key, unsigned int key_length, int using_trx); /** Provide a handler data getter to simplify coding */ void *thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton); /** Provide a handler data setter to simplify coding @details Set ha_data pointer (storage engine per-connection information). To avoid unclean deactivation (uninstall) of storage engine plugin in the middle of transaction, additional storage engine plugin lock is acquired. If ha_data is not null and storage engine plugin was not locked by thd_set_ha_data() in this connection before, storage engine plugin gets locked. If ha_data is null and storage engine plugin was locked by thd_set_ha_data() in this connection before, storage engine plugin lock gets released. If handlerton::close_connection() didn't reset ha_data, server does it immediately after calling handlerton::close_connection(). */ void thd_set_ha_data(MYSQL_THD thd, const struct handlerton *hton, const void *ha_data); int thd_command(const MYSQL_THD thd); long long thd_start_time(const MYSQL_THD thd); void thd_kill(unsigned long id); /** Check whether ft_query_extra_word_chars server variable is enabled for the current session @return ft_query_extra_word_chars value */ int thd_get_ft_query_extra_word_chars(void); #ifdef __cplusplus } #endif #endif /* _my_plugin_h */ ���������������������������������������������������������������������������������������������������������������mysql/mysql/plugin_validate_password.h��������������������������������������������������������������0000644�����������������00000003057�14763166026�0014340 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2012, 2014, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_PLUGIN_VALIDATE_PASSWORD_INCLUDED #define MYSQL_PLUGIN_VALIDATE_PASSWORD_INCLUDED /* API for validate_password plugin. (MYSQL_VALIDATE_PASSWORD_PLUGIN) */ #include <mysql/plugin.h> #define MYSQL_VALIDATE_PASSWORD_INTERFACE_VERSION 0x0100 /* The descriptor structure for the plugin, that is referred from st_mysql_plugin. */ typedef void* mysql_string_handle; struct st_mysql_validate_password { int interface_version; /* This function retuns TRUE for passwords which satisfy the password policy (as choosen by plugin variable) and FALSE for all other password */ int (*validate_password)(mysql_string_handle password); /* This function returns the password strength (0-100) depending upon the policies */ int (*get_password_strength)(mysql_string_handle password); }; #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/com_data.h������������������������������������������������������������������������������0000644�����������������00000006041�14763166026�0011012 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef PLUGIN_PROTOCOL_INCLUDED #define PLUGIN_PROTOCOL_INCLUDED #ifndef MYSQL_ABI_CHECK #include "my_global.h" /* Needed for my_bool in mysql_com.h */ #include "mysql_com.h" /* mysql_enum_shutdown_level */ #endif /** @file Definition of COM_DATA to be used with the Command service as data input structure. */ typedef struct st_com_init_db_data { const char *db_name; unsigned long length; } COM_INIT_DB_DATA; typedef struct st_com_refresh_data { unsigned char options; } COM_REFRESH_DATA; typedef struct st_com_shutdown_data { enum mysql_enum_shutdown_level level; } COM_SHUTDOWN_DATA; typedef struct st_com_kill_data { unsigned long id; } COM_KILL_DATA; typedef struct st_com_set_option_data { unsigned int opt_command; } COM_SET_OPTION_DATA; typedef struct st_com_stmt_execute_data { unsigned long stmt_id; unsigned long flags; unsigned char *params; unsigned long params_length; } COM_STMT_EXECUTE_DATA; typedef struct st_com_stmt_fetch_data { unsigned long stmt_id; unsigned long num_rows; } COM_STMT_FETCH_DATA; typedef struct st_com_stmt_send_long_data_data { unsigned long stmt_id; unsigned int param_number; unsigned char *longdata; unsigned long length; } COM_STMT_SEND_LONG_DATA_DATA; typedef struct st_com_stmt_prepare_data { const char *query; unsigned int length; } COM_STMT_PREPARE_DATA; typedef struct st_stmt_close_data { unsigned int stmt_id; } COM_STMT_CLOSE_DATA; typedef struct st_com_stmt_reset_data { unsigned int stmt_id; } COM_STMT_RESET_DATA; typedef struct st_com_query_data { const char *query; unsigned int length; } COM_QUERY_DATA; typedef struct st_com_field_list_data { unsigned char *table_name; unsigned int table_name_length; const unsigned char *query; unsigned int query_length; } COM_FIELD_LIST_DATA; union COM_DATA { COM_INIT_DB_DATA com_init_db; COM_REFRESH_DATA com_refresh; COM_SHUTDOWN_DATA com_shutdown; COM_KILL_DATA com_kill; COM_SET_OPTION_DATA com_set_option; COM_STMT_EXECUTE_DATA com_stmt_execute; COM_STMT_FETCH_DATA com_stmt_fetch; COM_STMT_SEND_LONG_DATA_DATA com_stmt_send_long_data; COM_STMT_PREPARE_DATA com_stmt_prepare; COM_STMT_CLOSE_DATA com_stmt_close; COM_STMT_RESET_DATA com_stmt_reset; COM_QUERY_DATA com_query; COM_FIELD_LIST_DATA com_field_list; }; #endif /* PLUGIN_PROTOCOL_INCLUDED */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/service_mysql_keyring.h�����������������������������������������������������������������0000644�����������������00000004626�14763166026�0013667 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2014, 2016 Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_SERVICE_MYSQL_PLUGIN_KEYRING_INCLUDED #define MYSQL_SERVICE_MYSQL_PLUGIN_KEYRING_INCLUDED #ifdef __cplusplus extern "C" { #endif extern struct mysql_keyring_service_st { int (*my_key_store_func)(const char *, const char *, const char *, const void *, size_t); int (*my_key_fetch_func)(const char *, char **, const char *, void **, size_t *); int (*my_key_remove_func)(const char *, const char *); int (*my_key_generate_func)(const char *, const char *, const char *, size_t); } *mysql_keyring_service; #ifdef MYSQL_DYNAMIC_PLUGIN #define my_key_store(key_id, key_type, user_id, key, key_len) \ mysql_keyring_service->my_key_store_func(key_id, key_type, user_id, key, \ key_len) #define my_key_fetch(key_id, key_type, user_id, key, key_len) \ mysql_keyring_service->my_key_fetch_func(key_id, key_type, user_id, key, \ key_len) #define my_key_remove(key_id, user_id) \ mysql_keyring_service->my_key_remove_func(key_id, user_id) #define my_key_generate(key_id, key_type, user_id, key_len) \ mysql_keyring_service->my_key_generate_func(key_id, key_type, user_id, \ key_len) #else int my_key_store(const char *, const char *, const char *, const void *, size_t); int my_key_fetch(const char *, char **, const char *, void **, size_t *); int my_key_remove(const char *, const char *); int my_key_generate(const char *, const char *, const char *, size_t); #endif #ifdef __cplusplus } #endif #endif //MYSQL_SERVICE_MYSQL_PLUGIN_KEYRING_INCLUDED ����������������������������������������������������������������������������������������������������������mysql/mysql/service_thd_wait.h����������������������������������������������������������������������0000644�����������������00000007575�14763166026�0012603 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_SERVICE_THD_WAIT_INCLUDED #define MYSQL_SERVICE_THD_WAIT_INCLUDED /** @file include/mysql/service_thd_wait.h This service provides functions for plugins and storage engines to report when they are going to sleep/stall. SYNOPSIS thd_wait_begin() - call just before a wait begins thd Thread object Use NULL if the thd is NOT known. wait_type Type of wait 1 -- short wait (e.g. for mutex) 2 -- medium wait (e.g. for disk io) 3 -- large wait (e.g. for locked row/table) NOTES This is used by the threadpool to have better knowledge of which threads that currently are actively running on CPUs. When a thread reports that it's going to sleep/stall, the threadpool scheduler is free to start another thread in the pool most likely. The expected wait time is simply an indication of how long the wait is expected to become, the real wait time could be very different. thd_wait_end() called immediately after the wait is complete thd_wait_end() MUST be called if thd_wait_begin() was called. Using thd_wait_...() service is optional but recommended. Using it will improve performance as the thread pool will be more active at managing the thread workload. */ #ifdef __cplusplus class THD; #define MYSQL_THD THD* #else #define MYSQL_THD void* #endif #ifdef __cplusplus extern "C" { #endif /* One should only report wait events that could potentially block for a long time. A mutex wait is too short of an event to report. The reason is that an event which is reported leads to a new thread starts executing a query and this has a negative impact of usage of CPU caches and thus the expected gain of starting a new thread must be higher than the expected cost of lost performance due to starting a new thread. Good examples of events that should be reported are waiting for row locks that could easily be for many milliseconds or even seconds and the same holds true for global read locks, table locks and other meta data locks. Another event of interest is going to sleep for an extended time. Note that user-level locks no longer use THD_WAIT_USER_LOCK wait type. Since their implementation relies on metadata locks manager it uses THD_WAIT_META_DATA_LOCK instead. */ typedef enum _thd_wait_type_e { THD_WAIT_SLEEP= 1, THD_WAIT_DISKIO= 2, THD_WAIT_ROW_LOCK= 3, THD_WAIT_GLOBAL_LOCK= 4, THD_WAIT_META_DATA_LOCK= 5, THD_WAIT_TABLE_LOCK= 6, THD_WAIT_USER_LOCK= 7, THD_WAIT_BINLOG= 8, THD_WAIT_GROUP_COMMIT= 9, THD_WAIT_SYNC= 10, THD_WAIT_NET= 11, THD_WAIT_LAST= 12 } thd_wait_type; extern struct thd_wait_service_st { void (*thd_wait_begin_func)(MYSQL_THD, int); void (*thd_wait_end_func)(MYSQL_THD); } *thd_wait_service; #ifdef MYSQL_DYNAMIC_PLUGIN #define thd_wait_begin(_THD, _WAIT_TYPE) \ thd_wait_service->thd_wait_begin_func(_THD, _WAIT_TYPE) #define thd_wait_end(_THD) thd_wait_service->thd_wait_end_func(_THD) #else void thd_wait_begin(MYSQL_THD thd, int wait_type); void thd_wait_end(MYSQL_THD thd); #endif #ifdef __cplusplus } #endif #endif �����������������������������������������������������������������������������������������������������������������������������������mysql/mysql/plugin_audit.h��������������������������������������������������������������������������0000644�����������������00000042207�14763166026�0011733 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2007, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _my_audit_h #define _my_audit_h #include "plugin.h" #include "mysql/mysql_lex_string.h" #ifndef MYSQL_ABI_CHECK #include "m_string.h" #endif #include "my_command.h" #include "my_sqlcommand.h" #define MYSQL_AUDIT_INTERFACE_VERSION 0x0401 /** @enum mysql_event_class_t Audit event classes. */ typedef enum { MYSQL_AUDIT_GENERAL_CLASS = 0, MYSQL_AUDIT_CONNECTION_CLASS = 1, MYSQL_AUDIT_PARSE_CLASS = 2, MYSQL_AUDIT_AUTHORIZATION_CLASS = 3, MYSQL_AUDIT_TABLE_ACCESS_CLASS = 4, MYSQL_AUDIT_GLOBAL_VARIABLE_CLASS = 5, MYSQL_AUDIT_SERVER_STARTUP_CLASS = 6, MYSQL_AUDIT_SERVER_SHUTDOWN_CLASS = 7, MYSQL_AUDIT_COMMAND_CLASS = 8, MYSQL_AUDIT_QUERY_CLASS = 9, MYSQL_AUDIT_STORED_PROGRAM_CLASS = 10, /* This item must be last in the list. */ MYSQL_AUDIT_CLASS_MASK_SIZE } mysql_event_class_t; /** @struct st_mysql_audit The descriptor structure that is referred from st_mysql_plugin. */ struct st_mysql_audit { /** Interface version. */ int interface_version; /** Event occurs when the event class consumer is to be disassociated from the specified THD.This would typically occur before some operation which may require sleeping - such as when waiting for the next query from the client. */ void (*release_thd)(MYSQL_THD); /** Invoked whenever an event occurs which is of any class for which the plugin has interest.The second argument indicates the specific event class and the third argument is data as required for that class. */ int (*event_notify)(MYSQL_THD, mysql_event_class_t, const void *); /** An array of bits used to indicate what event classes that this plugin wants to receive. */ unsigned long class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE]; }; /** @typedef enum_sql_command_t SQL command type definition. */ typedef enum enum_sql_command enum_sql_command_t; /** @enum mysql_event_general_subclass_t Events for the MYSQL_AUDIT_GENERAL_CLASS event class. */ typedef enum { /** occurs before emitting to the general query log. */ MYSQL_AUDIT_GENERAL_LOG = 1 << 0, /** occurs before transmitting errors to the user. */ MYSQL_AUDIT_GENERAL_ERROR = 1 << 1, /** occurs after transmitting a resultset to the user. */ MYSQL_AUDIT_GENERAL_RESULT = 1 << 2, /** occurs after transmitting a resultset or errors */ MYSQL_AUDIT_GENERAL_STATUS = 1 << 3 } mysql_event_general_subclass_t; #define MYSQL_AUDIT_GENERAL_ALL (MYSQL_AUDIT_GENERAL_LOG | \ MYSQL_AUDIT_GENERAL_ERROR | \ MYSQL_AUDIT_GENERAL_RESULT | \ MYSQL_AUDIT_GENERAL_STATUS) /** @struct mysql_event_general Structure for the MYSQL_AUDIT_GENERAL_CLASS event class. */ struct mysql_event_general { mysql_event_general_subclass_t event_subclass; int general_error_code; unsigned long general_thread_id; MYSQL_LEX_CSTRING general_user; MYSQL_LEX_CSTRING general_command; MYSQL_LEX_CSTRING general_query; struct charset_info_st *general_charset; unsigned long long general_time; unsigned long long general_rows; MYSQL_LEX_CSTRING general_host; MYSQL_LEX_CSTRING general_sql_command; MYSQL_LEX_CSTRING general_external_user; MYSQL_LEX_CSTRING general_ip; }; /** @enum mysql_event_connection_subclass_t Events for MYSQL_AUDIT_CONNECTION_CLASS event class. */ typedef enum { /** occurs after authentication phase is completed. */ MYSQL_AUDIT_CONNECTION_CONNECT = 1 << 0, /** occurs after connection is terminated. */ MYSQL_AUDIT_CONNECTION_DISCONNECT = 1 << 1, /** occurs after COM_CHANGE_USER RPC is completed. */ MYSQL_AUDIT_CONNECTION_CHANGE_USER = 1 << 2, /** occurs before authentication. */ MYSQL_AUDIT_CONNECTION_PRE_AUTHENTICATE = 1 << 3 } mysql_event_connection_subclass_t; #define MYSQL_AUDIT_CONNECTION_ALL (MYSQL_AUDIT_CONNECTION_CONNECT | \ MYSQL_AUDIT_CONNECTION_DISCONNECT | \ MYSQL_AUDIT_CONNECTION_CHANGE_USER | \ MYSQL_AUDIT_CONNECTION_PRE_AUTHENTICATE) /** @struct mysql_event_connection Structure for the MYSQL_AUDIT_CONNECTION_CLASS event class. */ struct mysql_event_connection { /** Event subclass. */ mysql_event_connection_subclass_t event_subclass; /** Current status of the connection. */ int status; /** Connection id. */ unsigned long connection_id; /** User name of this connection. */ MYSQL_LEX_CSTRING user; /** Priv user name. */ MYSQL_LEX_CSTRING priv_user; /** External user name. */ MYSQL_LEX_CSTRING external_user; /** Proxy user used for this connection. */ MYSQL_LEX_CSTRING proxy_user; /** Connection host. */ MYSQL_LEX_CSTRING host; /** IP of the connection. */ MYSQL_LEX_CSTRING ip; /** Database name specified at connection time. */ MYSQL_LEX_CSTRING database; /** Connection type: - 0 Undefined - 1 TCP/IP - 2 Socket - 3 Named pipe - 4 SSL - 5 Shared memory */ int connection_type; }; /** @enum mysql_event_parse_subclass_t Events for MYSQL_AUDIT_PARSE_CLASS event class. */ typedef enum { /** occurs before the query parsing. */ MYSQL_AUDIT_PARSE_PREPARSE = 1 << 0, /** occurs after the query parsing. */ MYSQL_AUDIT_PARSE_POSTPARSE = 1 << 1 } mysql_event_parse_subclass_t; #define MYSQL_AUDIT_PARSE_ALL (MYSQL_AUDIT_PARSE_PREPARSE | \ MYSQL_AUDIT_PARSE_POSTPARSE) typedef enum { MYSQL_AUDIT_PARSE_REWRITE_PLUGIN_NONE = 0, /// mysql_event_parse::flags Must be set by a plugin if the query is rewritten. MYSQL_AUDIT_PARSE_REWRITE_PLUGIN_QUERY_REWRITTEN = 1 << 0, /// mysql_event_parse::flags Is set by the server if the query is prepared statement. MYSQL_AUDIT_PARSE_REWRITE_PLUGIN_IS_PREPARED_STATEMENT = 1 << 1 } mysql_event_parse_rewrite_plugin_flag; /** Data for the MYSQL_AUDIT_PARSE events */ struct mysql_event_parse { /** MYSQL_AUDIT_[PRE|POST]_PARSE event id */ mysql_event_parse_subclass_t event_subclass; /** one of FLAG_REWRITE_PLUGIN_* */ mysql_event_parse_rewrite_plugin_flag *flags; /** input: the original query text */ MYSQL_LEX_CSTRING query; /** output: returns the null-terminated rewriten query allocated by my_malloc() */ MYSQL_LEX_CSTRING *rewritten_query; }; /** @enum mysql_event_authorization_subclass_t Events for MYSQL_AUDIT_AUTHORIZATION_CLASS event class. */ typedef enum { MYSQL_AUDIT_AUTHORIZATION_USER = 1 << 0, /** Occurs when database privilege is checked. */ MYSQL_AUDIT_AUTHORIZATION_DB = 1 << 1, /** Occurs when table privilege is checked. */ MYSQL_AUDIT_AUTHORIZATION_TABLE = 1 << 2, /** Occurs when column privilege is checked. */ MYSQL_AUDIT_AUTHORIZATION_COLUMN = 1 << 3, /** Occurs when procedure privilege is checked. */ MYSQL_AUDIT_AUTHORIZATION_PROCEDURE = 1 << 4, /** Occurs when proxy privilege is checked. */ MYSQL_AUDIT_AUTHORIZATION_PROXY = 1 << 5 } mysql_event_authorization_subclass_t; #define MYSQL_AUDIT_AUTHORIZATION_ALL (MYSQL_AUDIT_AUTHORIZATION_USER | \ MYSQL_AUDIT_AUTHORIZATION_DB | \ MYSQL_AUDIT_AUTHORIZATION_TABLE | \ MYSQL_AUDIT_AUTHORIZATION_COLUMN | \ MYSQL_AUDIT_AUTHORIZATION_PROCEDURE | \ MYSQL_AUDIT_AUTHORIZATION_PROXY) /** @struct mysql_event_authorization Structure for MYSQL_AUDIT_AUTHORIZATION_CLASS event class. */ struct mysql_event_authorization { /** Event subclass. */ mysql_event_authorization_subclass_t event_subclass; /** Event status. */ int status; /** Connection id. */ unsigned int connection_id; /** SQL command id. */ enum_sql_command_t sql_command_id; /** SQL query text. */ MYSQL_LEX_CSTRING query; /** SQL query charset. */ const struct charset_info_st *query_charset; /** Database name. */ MYSQL_LEX_CSTRING database; /** Table name. */ MYSQL_LEX_CSTRING table; /** Other name associated with the event. */ MYSQL_LEX_CSTRING object; /** Requested authorization privileges. */ unsigned long requested_privilege; /** Currently granted authorization privileges. */ unsigned long granted_privilege; }; /** @enum mysql_event_table_row_access_subclass_t Events for MYSQL_AUDIT_TABLE_ACCES_CLASS event class. */ typedef enum { /** Occurs when table data are read. */ MYSQL_AUDIT_TABLE_ACCESS_READ = 1 << 0, /** Occurs when table data are inserted. */ MYSQL_AUDIT_TABLE_ACCESS_INSERT = 1 << 1, /** Occurs when table data are updated. */ MYSQL_AUDIT_TABLE_ACCESS_UPDATE = 1 << 2, /** Occurs when table data are deleted. */ MYSQL_AUDIT_TABLE_ACCESS_DELETE = 1 << 3 } mysql_event_table_access_subclass_t; #define MYSQL_AUDIT_TABLE_ACCESS_ALL (MYSQL_AUDIT_TABLE_ACCESS_READ | \ MYSQL_AUDIT_TABLE_ACCESS_INSERT | \ MYSQL_AUDIT_TABLE_ACCESS_UPDATE | \ MYSQL_AUDIT_TABLE_ACCESS_DELETE) /** @struct mysql_event_table_row_access Structure for MYSQL_AUDIT_TABLE_ACCES_CLASS event class. */ struct mysql_event_table_access { /** Event subclass. */ mysql_event_table_access_subclass_t event_subclass; /** Connection id. */ unsigned long connection_id; /** SQL command id. */ enum_sql_command_t sql_command_id; /** SQL query. */ MYSQL_LEX_CSTRING query; /** SQL query charset. */ const struct charset_info_st *query_charset; /** Database name. */ MYSQL_LEX_CSTRING table_database; /** Table name. */ MYSQL_LEX_CSTRING table_name; }; /** @enum mysql_event_global_variable_subclass_t Events for MYSQL_AUDIT_GLOBAL_VARIABLE_CLASS event class. */ typedef enum { /** Occurs when global variable is retrieved. */ MYSQL_AUDIT_GLOBAL_VARIABLE_GET = 1 << 0, /** Occurs when global variable is set. */ MYSQL_AUDIT_GLOBAL_VARIABLE_SET = 1 << 1 } mysql_event_global_variable_subclass_t; #define MYSQL_AUDIT_GLOBAL_VARIABLE_ALL (MYSQL_AUDIT_GLOBAL_VARIABLE_GET | \ MYSQL_AUDIT_GLOBAL_VARIABLE_SET) /** Events for MYSQL_AUDIT_GLOBAL_VARIABLE_CLASS event class. */ struct mysql_event_global_variable { /** Event subclass. */ mysql_event_global_variable_subclass_t event_subclass; /** Connection id. */ unsigned long connection_id; /** SQL command id. */ enum_sql_command_t sql_command_id; /** Variable name. */ MYSQL_LEX_CSTRING variable_name; /** Variable value. */ MYSQL_LEX_CSTRING variable_value; }; /** @enum mysql_event_server_startup_subclass_t Events for MYSQL_AUDIT_SERVER_STARTUP_CLASS event class. */ typedef enum { /** Occurs after all subsystem are initialized during system start. */ MYSQL_AUDIT_SERVER_STARTUP_STARTUP = 1 << 0 } mysql_event_server_startup_subclass_t; #define MYSQL_AUDIT_SERVER_STARTUP_ALL (MYSQL_AUDIT_SERVER_STARTUP_STARTUP) /** @struct mysql_event_server_startup Structure for MYSQL_AUDIT_SERVER_STARTUP_CLASS event class. */ struct mysql_event_server_startup { /** Event subclass. */ mysql_event_server_startup_subclass_t event_subclass; /** Command line arguments. */ const char **argv; /** Command line arguments count. */ unsigned int argc; }; /** @enum mysql_event_server_shutdown_subclass_t Events for MYSQL_AUDIT_SERVER_SHUTDOWN_CLASS event class. */ typedef enum { /** Occurs when global variable is set. */ MYSQL_AUDIT_SERVER_SHUTDOWN_SHUTDOWN = 1 << 0 } mysql_event_server_shutdown_subclass_t; #define MYSQL_AUDIT_SERVER_SHUTDOWN_ALL (MYSQL_AUDIT_SERVER_SHUTDOWN_SHUTDOWN) /** @enum mysql_server_shutdown_reason_t Server shutdown reason. */ typedef enum { /** User requested shut down. */ MYSQL_AUDIT_SERVER_SHUTDOWN_REASON_SHUTDOWN, /** The server aborts. */ MYSQL_AUDIT_SERVER_SHUTDOWN_REASON_ABORT } mysql_server_shutdown_reason_t; /** @struct mysql_event_server_shutdown Structure for MYSQL_AUDIT_SERVER_SHUTDOWN_CLASS event class. */ struct mysql_event_server_shutdown { /** Shutdown event. */ mysql_event_server_shutdown_subclass_t event_subclass; /** Exit code associated with the shutdown event. */ int exit_code; /** Shutdown reason. */ mysql_server_shutdown_reason_t reason; }; /** @enum mysql_event_command_subclass_t Events for MYSQL_AUDIT_COMMAND_CLASS event class. */ typedef enum { /** Command start event. */ MYSQL_AUDIT_COMMAND_START = 1 << 0, /** Command end event. */ MYSQL_AUDIT_COMMAND_END = 1 << 1 } mysql_event_command_subclass_t; #define MYSQL_AUDIT_COMMAND_ALL (MYSQL_AUDIT_COMMAND_START | \ MYSQL_AUDIT_COMMAND_END) /** @typedef enum_server_command_t Server command type definition. */ typedef enum enum_server_command enum_server_command_t; /** @struct mysql_event_command Event for MYSQL_AUDIT_COMMAND_CLASS event class. Events generated as a result of RPC command requests. */ struct mysql_event_command { /** Command event subclass. */ mysql_event_command_subclass_t event_subclass; /** Command event status. */ int status; /** Connection id. */ unsigned long connection_id; /** Command id. */ enum_server_command_t command_id; }; /** @enum mysql_event_query_subclass_t Events for MYSQL_AUDIT_QUERY_CLASS event class. */ typedef enum { /** Query start event. */ MYSQL_AUDIT_QUERY_START = 1 << 0, /** Nested query start event. */ MYSQL_AUDIT_QUERY_NESTED_START = 1 << 1, /** Query post parse event. */ MYSQL_AUDIT_QUERY_STATUS_END = 1 << 2, /** Nested query status end event. */ MYSQL_AUDIT_QUERY_NESTED_STATUS_END = 1 << 3 } mysql_event_query_subclass_t; #define MYSQL_AUDIT_QUERY_ALL (MYSQL_AUDIT_QUERY_START | \ MYSQL_AUDIT_QUERY_NESTED_START | \ MYSQL_AUDIT_QUERY_STATUS_END | \ MYSQL_AUDIT_QUERY_NESTED_STATUS_END) /** @struct mysql_event_command Event for MYSQL_AUDIT_COMMAND_CLASS event class. */ struct mysql_event_query { /** Event subclass. */ mysql_event_query_subclass_t event_subclass; /** Event status. */ int status; /** Connection id. */ unsigned long connection_id; /** SQL command id. */ enum_sql_command_t sql_command_id; /** SQL query. */ MYSQL_LEX_CSTRING query; /** SQL query charset. */ const struct charset_info_st *query_charset; }; /** @enum mysql_event_stored_program_subclass_t Events for MYSQL_AUDIT_STORED_PROGRAM_CLASS event class. */ typedef enum { /** Stored program execution event. */ MYSQL_AUDIT_STORED_PROGRAM_EXECUTE = 1 << 0 } mysql_event_stored_program_subclass_t; #define MYSQL_AUDIT_STORED_PROGRAM_ALL (MYSQL_AUDIT_STORED_PROGRAM_EXECUTE) /** @struct mysql_event_command Event for MYSQL_AUDIT_COMMAND_CLASS event class. */ struct mysql_event_stored_program { /** Event subclass. */ mysql_event_stored_program_subclass_t event_subclass; /** Connection id. */ unsigned long connection_id; /** SQL command id. */ enum_sql_command_t sql_command_id; /** SQL query text. */ MYSQL_LEX_CSTRING query; /** SQL query charset. */ const struct charset_info_st *query_charset; /** The Database the procedure is defined in. */ MYSQL_LEX_CSTRING database; /** Name of the stored program. */ MYSQL_LEX_CSTRING name; /** Stored program parameters. */ void *parameters; }; #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql/service_thd_alloc.h���������������������������������������������������������������������0000644�����������������00000010353�14763166026�0012715 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef MYSQL_SERVICE_THD_ALLOC_INCLUDED /* Copyright (c) 2009, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** @file This service provdes functions to allocate memory in a connection local memory pool. The memory allocated there will be automatically freed at the end of the statement, don't use it for allocations that should live longer than that. For short living allocations this is more efficient than using my_malloc and friends, and automatic "garbage collection" allows not to think about memory leaks. The pool is best for small to medium objects, don't use it for large allocations - they are better served with my_malloc. */ #ifndef MYSQL_ABI_CHECK #include <stdlib.h> #endif #ifdef __cplusplus class THD; #define MYSQL_THD THD* #else #define MYSQL_THD void* #endif #ifdef __cplusplus extern "C" { #endif #include <mysql/mysql_lex_string.h> extern struct thd_alloc_service_st { void *(*thd_alloc_func)(MYSQL_THD, size_t); void *(*thd_calloc_func)(MYSQL_THD, size_t); char *(*thd_strdup_func)(MYSQL_THD, const char *); char *(*thd_strmake_func)(MYSQL_THD, const char *, size_t); void *(*thd_memdup_func)(MYSQL_THD, const void*, size_t); MYSQL_LEX_STRING *(*thd_make_lex_string_func)(MYSQL_THD, MYSQL_LEX_STRING *, const char *, size_t, int); } *thd_alloc_service; #ifdef MYSQL_DYNAMIC_PLUGIN #define thd_alloc(thd,size) (thd_alloc_service->thd_alloc_func((thd), (size))) #define thd_calloc(thd,size) (thd_alloc_service->thd_calloc_func((thd), (size))) #define thd_strdup(thd,str) (thd_alloc_service->thd_strdup_func((thd), (str))) #define thd_strmake(thd,str,size) \ (thd_alloc_service->thd_strmake_func((thd), (str), (size))) #define thd_memdup(thd,str,size) \ (thd_alloc_service->thd_memdup_func((thd), (str), (size))) #define thd_make_lex_string(thd, lex_str, str, size, allocate_lex_string) \ (thd_alloc_service->thd_make_lex_string_func((thd), (lex_str), (str), \ (size), (allocate_lex_string))) #else /** Allocate memory in the connection's local memory pool @details When properly used in place of @c my_malloc(), this can significantly improve concurrency. Don't use this or related functions to allocate large chunks of memory. Use for temporary storage only. The memory will be freed automatically at the end of the statement; no explicit code is required to prevent memory leaks. @see alloc_root() */ void *thd_alloc(MYSQL_THD thd, size_t size); /** @see thd_alloc() */ void *thd_calloc(MYSQL_THD thd, size_t size); /** @see thd_alloc() */ char *thd_strdup(MYSQL_THD thd, const char *str); /** @see thd_alloc() */ char *thd_strmake(MYSQL_THD thd, const char *str, size_t size); /** @see thd_alloc() */ void *thd_memdup(MYSQL_THD thd, const void* str, size_t size); /** Create a LEX_STRING in this connection's local memory pool @param thd user thread connection handle @param lex_str pointer to LEX_STRING object to be initialized @param str initializer to be copied into lex_str @param size length of str, in bytes @param allocate_lex_string flag: if TRUE, allocate new LEX_STRING object, instead of using lex_str value @return NULL on failure, or pointer to the LEX_STRING object @see thd_alloc() */ MYSQL_LEX_STRING *thd_make_lex_string(MYSQL_THD thd, MYSQL_LEX_STRING *lex_str, const char *str, size_t size, int allocate_lex_string); #endif #ifdef __cplusplus } #endif #define MYSQL_SERVICE_THD_ALLOC_INCLUDED #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/my_byteorder.h��������������������������������������������������������������������������������0000644�����������������00000012560�14763166026�0010605 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef MY_BYTEORDER_INCLUDED #define MY_BYTEORDER_INCLUDED /* Copyright (c) 2001, 2014, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Functions for reading and storing in machine independent format (low byte first). There are 'korr' (assume 'corrector') variants for integer types, but 'get' (assume 'getter') for floating point types. */ #if defined(__i386__) || defined(_WIN32) || defined(__x86_64__) #include "byte_order_generic_x86.h" #else #include "byte_order_generic.h" #endif static inline int32 sint3korr(const uchar *A) { return ((int32) (((A[2]) & 128) ? (((uint32) 255L << 24) | (((uint32) A[2]) << 16) | (((uint32) A[1]) << 8) | ((uint32) A[0])) : (((uint32) A[2]) << 16) | (((uint32) A[1]) << 8) | ((uint32) A[0]))) ; } static inline uint32 uint3korr(const uchar *A) { return (uint32) (((uint32) (A[0])) + (((uint32) (A[1])) << 8) + (((uint32) (A[2])) << 16)) ; } static inline ulonglong uint5korr(const uchar *A) { return ((ulonglong)(((uint32) (A[0])) + (((uint32) (A[1])) << 8) + (((uint32) (A[2])) << 16) + (((uint32) (A[3])) << 24)) + (((ulonglong) (A[4])) << 32)) ; } static inline ulonglong uint6korr(const uchar *A) { return ((ulonglong)(((uint32) (A[0])) + (((uint32) (A[1])) << 8) + (((uint32) (A[2])) << 16) + (((uint32) (A[3])) << 24)) + (((ulonglong) (A[4])) << 32) + (((ulonglong) (A[5])) << 40)) ; } static inline void int3store(uchar *T, uint A) { *(T)= (uchar) (A); *(T+1)= (uchar) (A >> 8); *(T+2)= (uchar) (A >> 16); } static inline void int5store(uchar *T, ulonglong A) { *(T)= (uchar) (A); *(T+1)= (uchar) (A >> 8); *(T+2)= (uchar) (A >> 16); *(T+3)= (uchar) (A >> 24); *(T+4)= (uchar) (A >> 32); } static inline void int6store(uchar *T, ulonglong A) { *(T)= (uchar) (A); *(T+1)= (uchar) (A >> 8); *(T+2)= (uchar) (A >> 16); *(T+3)= (uchar) (A >> 24); *(T+4)= (uchar) (A >> 32); *(T+5)= (uchar) (A >> 40); } #ifdef __cplusplus static inline int16 sint2korr(const char *pT) { return sint2korr(static_cast<const uchar*>(static_cast<const void*>(pT))); } static inline uint16 uint2korr(const char *pT) { return uint2korr(static_cast<const uchar*>(static_cast<const void*>(pT))); } static inline uint32 uint3korr(const char *pT) { return uint3korr(static_cast<const uchar*>(static_cast<const void*>(pT))); } static inline int32 sint3korr(const char *pT) { return sint3korr(static_cast<const uchar*>(static_cast<const void*>(pT))); } static inline uint32 uint4korr(const char *pT) { return uint4korr(static_cast<const uchar*>(static_cast<const void*>(pT))); } static inline int32 sint4korr(const char *pT) { return sint4korr(static_cast<const uchar*>(static_cast<const void*>(pT))); } static inline ulonglong uint6korr(const char *pT) { return uint6korr(static_cast<const uchar*>(static_cast<const void*>(pT))); } static inline ulonglong uint8korr(const char *pT) { return uint8korr(static_cast<const uchar*>(static_cast<const void*>(pT))); } static inline longlong sint8korr(const char *pT) { return sint8korr(static_cast<const uchar*>(static_cast<const void*>(pT))); } static inline void int2store(char *pT, uint16 A) { int2store(static_cast<uchar*>(static_cast<void*>(pT)), A); } static inline void int3store(char *pT, uint A) { int3store(static_cast<uchar*>(static_cast<void*>(pT)), A); } static inline void int4store(char *pT, uint32 A) { int4store(static_cast<uchar*>(static_cast<void*>(pT)), A); } static inline void int5store(char *pT, ulonglong A) { int5store(static_cast<uchar*>(static_cast<void*>(pT)), A); } static inline void int6store(char *pT, ulonglong A) { int6store(static_cast<uchar*>(static_cast<void*>(pT)), A); } static inline void int8store(char *pT, ulonglong A) { int8store(static_cast<uchar*>(static_cast<void*>(pT)), A); } #endif /* __cplusplus */ /* Functions for reading and storing in machine format from/to short/long to/from some place in memory V should be a variable and M a pointer to byte. */ #ifdef WORDS_BIGENDIAN #include "big_endian.h" #else #include "little_endian.h" #endif #ifdef __cplusplus static inline void float4store(char *V, float M) { float4store(static_cast<uchar*>(static_cast<void*>(V)), M); } static inline void float8get(double *V, const char *M) { float8get(V, static_cast<const uchar*>(static_cast<const void*>(M))); } static inline void float8store(char *V, double M) { float8store(static_cast<uchar*>(static_cast<void*>(V)), M); } #endif /* __cplusplus */ #endif /* MY_BYTEORDER_INCLUDED */ ������������������������������������������������������������������������������������������������������������������������������������������������mysql/my_config.h�����������������������������������������������������������������������������������0000644�����������������00000001627�14763166026�0010055 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Fedora supports multi arch: having 32 and 64 versions of MySQL * installed at the same time. my_config.h will differ due arch * dependent defs creating a file conflict. We move arch specific * headers to arch specific file names and include the correct arch * specific file by installing this generic file. * */ #if defined(__i386__) #include "my_config_i386.h" #elif defined(__ia64__) #include "my_config_ia64.h" #elif defined(__powerpc__) #include "my_config_ppc.h" #elif defined(__powerpc64__) #include "my_config_ppc64.h" #elif defined(__s390x__) #include "my_config_s390x.h" #elif defined(__s390__) #include "my_config_s390.h" #elif defined(__sparc__) && defined(__arch64__) #include "my_config_sparc64.h" #elif defined(__sparc__) #include "my_config_sparc.h" #elif defined(__x86_64__) #include "my_config_x86_64.h" #else #error "This MySQL devel package does not work your architecture?" #endif ���������������������������������������������������������������������������������������������������������mysql/sql_common.h����������������������������������������������������������������������������������0000644�����������������00000017165�14763166026�0010256 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef SQL_COMMON_INCLUDED #define SQL_COMMON_INCLUDED /* Copyright (c) 2003, 2018, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #define SQL_COMMON_INCLUDED #ifdef __cplusplus extern "C" { #endif #include <mysql.h> #include <hash.h> extern const char *unknown_sqlstate; extern const char *cant_connect_sqlstate; extern const char *not_error_sqlstate; /* Free all memory allocated in MYSQL handle except the current options. */ void mysql_close_free(MYSQL *mysql); /* Clear connection options stored in MYSQL handle and free memory used by them. */ void mysql_close_free_options(MYSQL *mysql); /** The structure is used to hold the state change information received from the server. LIST functions are used for manipulation of the members of the structure. */ typedef struct st_session_track_info_node { /** head_node->data is a LEX_STRING which contains the variable name. */ LIST *head_node; LIST *current_node; } STATE_INFO_NODE; /** Store the change info received from the server in an array of linked lists with STATE_INFO_NODE elements (one per state type). */ typedef struct st_session_track_info { /** Array of STATE_NODE_INFO elements (one per state type). */ struct st_session_track_info_node info_list[SESSION_TRACK_END + 1]; } STATE_INFO; /* Access to MYSQL::extension member. Note: functions mysql_extension_{init,free}() are defined in client.c. */ struct st_mysql_trace_info; typedef struct st_mysql_extension { struct st_mysql_trace_info *trace_data; struct st_session_track_info state_change; } MYSQL_EXTENSION; /* "Constructor/destructor" for MYSQL extension structure. */ struct st_mysql_extension* mysql_extension_init(struct st_mysql*); void mysql_extension_free(struct st_mysql_extension*); /* Note: Allocated extension structure is freed in mysql_close_free() called by mysql_close(). */ #define MYSQL_EXTENSION_PTR(H) \ ( \ (struct st_mysql_extension*) \ ( (H)->extension ? \ (H)->extension : ((H)->extension= mysql_extension_init(H)) \ ) \ ) struct st_mysql_options_extention { char *plugin_dir; char *default_auth; char *ssl_crl; /* PEM CRL file */ char *ssl_crlpath; /* PEM directory of CRL-s? */ HASH connection_attributes; char *server_public_key_path; size_t connection_attributes_length; my_bool enable_cleartext_plugin; my_bool get_server_public_key; char *tls_version; /* TLS version option */ long ssl_ctx_flags; /* SSL ctx options flag */ unsigned int ssl_mode; }; typedef struct st_mysql_methods { my_bool (*read_query_result)(MYSQL *mysql); my_bool (*advanced_command)(MYSQL *mysql, enum enum_server_command command, const unsigned char *header, size_t header_length, const unsigned char *arg, size_t arg_length, my_bool skip_check, MYSQL_STMT *stmt); MYSQL_DATA *(*read_rows)(MYSQL *mysql,MYSQL_FIELD *mysql_fields, unsigned int fields); MYSQL_RES * (*use_result)(MYSQL *mysql); void (*fetch_lengths)(unsigned long *to, MYSQL_ROW column, unsigned int field_count); void (*flush_use_result)(MYSQL *mysql, my_bool flush_all_results); int (*read_change_user_result)(MYSQL *mysql); #if !defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY) MYSQL_FIELD * (*list_fields)(MYSQL *mysql); my_bool (*read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt); int (*stmt_execute)(MYSQL_STMT *stmt); int (*read_binary_rows)(MYSQL_STMT *stmt); int (*unbuffered_fetch)(MYSQL *mysql, char **row); void (*free_embedded_thd)(MYSQL *mysql); const char *(*read_statistics)(MYSQL *mysql); my_bool (*next_result)(MYSQL *mysql); int (*read_rows_from_cursor)(MYSQL_STMT *stmt); void (*free_rows)(MYSQL_DATA *cur); #endif } MYSQL_METHODS; #define simple_command(mysql, command, arg, length, skip_check) \ ((mysql)->methods \ ? (*(mysql)->methods->advanced_command)(mysql, command, 0, \ 0, arg, length, skip_check, NULL) \ : (set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate), 1)) #define stmt_command(mysql, command, arg, length, stmt) \ ((mysql)->methods \ ? (*(mysql)->methods->advanced_command)(mysql, command, 0, \ 0, arg, length, 1, stmt) \ : (set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate), 1)) extern CHARSET_INFO *default_client_charset_info; MYSQL_FIELD *unpack_fields(MYSQL *mysql, MYSQL_ROWS *data,MEM_ROOT *alloc, uint fields, my_bool default_value, uint server_capabilities); MYSQL_FIELD * cli_read_metadata_ex(MYSQL *mysql, MEM_ROOT *alloc, unsigned long field_count, unsigned int fields); MYSQL_FIELD * cli_read_metadata(MYSQL *mysql, unsigned long field_count, unsigned int fields); void free_rows(MYSQL_DATA *cur); void free_old_query(MYSQL *mysql); void end_server(MYSQL *mysql); my_bool mysql_reconnect(MYSQL *mysql); void mysql_read_default_options(struct st_mysql_options *options, const char *filename,const char *group); my_bool cli_advanced_command(MYSQL *mysql, enum enum_server_command command, const unsigned char *header, size_t header_length, const unsigned char *arg, size_t arg_length, my_bool skip_check, MYSQL_STMT *stmt); unsigned long cli_safe_read(MYSQL *mysql, my_bool *is_data_packet); unsigned long cli_safe_read_with_ok(MYSQL *mysql, my_bool parse_ok, my_bool *is_data_packet); void net_clear_error(NET *net); void set_stmt_errmsg(MYSQL_STMT *stmt, NET *net); void set_stmt_error(MYSQL_STMT *stmt, int errcode, const char *sqlstate, const char *err); void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate); void set_mysql_extended_error(MYSQL *mysql, int errcode, const char *sqlstate, const char *format, ...); #ifdef EMBEDDED_LIBRARY int embedded_ssl_check(MYSQL *mysql); #endif /* client side of the pluggable authentication */ struct st_plugin_vio_info; void mpvio_info(Vio *vio, struct st_plugin_vio_info *info); int run_plugin_auth(MYSQL *mysql, char *data, uint data_len, const char *data_plugin, const char *db); int mysql_client_plugin_init(); void mysql_client_plugin_deinit(); struct st_mysql_client_plugin; extern struct st_mysql_client_plugin *mysql_client_builtins[]; uchar * send_client_connect_attrs(MYSQL *mysql, uchar *buf); extern my_bool libmysql_cleartext_plugin_enabled; int is_file_or_dir_world_writable(const char *filepath); void read_ok_ex(MYSQL *mysql, unsigned long len); #ifdef __cplusplus } #endif #define protocol_41(A) ((A)->server_capabilities & CLIENT_PROTOCOL_41) #endif /* SQL_COMMON_INCLUDED */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysqld_ername.h�������������������������������������������������������������������������������0000644�����������������00000367403�14763166026�0010752 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Autogenerated file, please don't edit */ { "ER_HASHCHK", 1000, "hashchk" }, { "ER_NISAMCHK", 1001, "isamchk" }, { "ER_NO", 1002, "NO" }, { "ER_YES", 1003, "YES" }, { "ER_CANT_CREATE_FILE", 1004, "Can\'t create file \'%-.200s\' (errno: %d - %s)" }, { "ER_CANT_CREATE_TABLE", 1005, "Can\'t create table \'%-.200s\' (errno: %d)" }, { "ER_CANT_CREATE_DB", 1006, "Can\'t create database \'%-.192s\' (errno: %d)" }, { "ER_DB_CREATE_EXISTS", 1007, "Can\'t create database \'%-.192s\'; database exists" }, { "ER_DB_DROP_EXISTS", 1008, "Can\'t drop database \'%-.192s\'; database doesn\'t exist" }, { "ER_DB_DROP_DELETE", 1009, "Error dropping database (can\'t delete \'%-.192s\', errno: %d)" }, { "ER_DB_DROP_RMDIR", 1010, "Error dropping database (can\'t rmdir \'%-.192s\', errno: %d)" }, { "ER_CANT_DELETE_FILE", 1011, "Error on delete of \'%-.192s\' (errno: %d - %s)" }, { "ER_CANT_FIND_SYSTEM_REC", 1012, "Can\'t read record in system table" }, { "ER_CANT_GET_STAT", 1013, "Can\'t get status of \'%-.200s\' (errno: %d - %s)" }, { "ER_CANT_GET_WD", 1014, "Can\'t get working directory (errno: %d - %s)" }, { "ER_CANT_LOCK", 1015, "Can\'t lock file (errno: %d - %s)" }, { "ER_CANT_OPEN_FILE", 1016, "Can\'t open file: \'%-.200s\' (errno: %d - %s)" }, { "ER_FILE_NOT_FOUND", 1017, "Can\'t find file: \'%-.200s\' (errno: %d - %s)" }, { "ER_CANT_READ_DIR", 1018, "Can\'t read dir of \'%-.192s\' (errno: %d - %s)" }, { "ER_CANT_SET_WD", 1019, "Can\'t change dir to \'%-.192s\' (errno: %d - %s)" }, { "ER_CHECKREAD", 1020, "Record has changed since last read in table \'%-.192s\'" }, { "ER_DISK_FULL", 1021, "Disk full (%s); waiting for someone to free some space... (errno: %d - %s)" }, { "ER_DUP_KEY", 1022, "Can\'t write; duplicate key in table \'%-.192s\'" }, { "ER_ERROR_ON_CLOSE", 1023, "Error on close of \'%-.192s\' (errno: %d - %s)" }, { "ER_ERROR_ON_READ", 1024, "Error reading file \'%-.200s\' (errno: %d - %s)" }, { "ER_ERROR_ON_RENAME", 1025, "Error on rename of \'%-.210s\' to \'%-.210s\' (errno: %d - %s)" }, { "ER_ERROR_ON_WRITE", 1026, "Error writing file \'%-.200s\' (errno: %d - %s)" }, { "ER_FILE_USED", 1027, "\'%-.192s\' is locked against change" }, { "ER_FILSORT_ABORT", 1028, "Sort aborted" }, { "ER_FORM_NOT_FOUND", 1029, "View \'%-.192s\' doesn\'t exist for \'%-.192s\'" }, { "ER_GET_ERRNO", 1030, "Got error %d from storage engine" }, { "ER_ILLEGAL_HA", 1031, "Table storage engine for \'%-.192s\' doesn\'t have this option" }, { "ER_KEY_NOT_FOUND", 1032, "Can\'t find record in \'%-.192s\'" }, { "ER_NOT_FORM_FILE", 1033, "Incorrect information in file: \'%-.200s\'" }, { "ER_NOT_KEYFILE", 1034, "Incorrect key file for table \'%-.200s\'; try to repair it" }, { "ER_OLD_KEYFILE", 1035, "Old key file for table \'%-.192s\'; repair it!" }, { "ER_OPEN_AS_READONLY", 1036, "Table \'%-.192s\' is read only" }, { "ER_OUTOFMEMORY", 1037, "Out of memory; restart server and try again (needed %d bytes)" }, { "ER_OUT_OF_SORTMEMORY", 1038, "Out of sort memory, consider increasing server sort buffer size" }, { "ER_UNEXPECTED_EOF", 1039, "Unexpected EOF found when reading file \'%-.192s\' (errno: %d - %s)" }, { "ER_CON_COUNT_ERROR", 1040, "Too many connections" }, { "ER_OUT_OF_RESOURCES", 1041, "Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use \'ulimit\' to allow mysqld to use more memory or you can add more swap space" }, { "ER_BAD_HOST_ERROR", 1042, "Can\'t get hostname for your address" }, { "ER_HANDSHAKE_ERROR", 1043, "Bad handshake" }, { "ER_DBACCESS_DENIED_ERROR", 1044, "Access denied for user \'%-.48s\'@\'%-.64s\' to database \'%-.192s\'" }, { "ER_ACCESS_DENIED_ERROR", 1045, "Access denied for user \'%-.48s\'@\'%-.64s\' (using password: %s)" }, { "ER_NO_DB_ERROR", 1046, "No database selected" }, { "ER_UNKNOWN_COM_ERROR", 1047, "Unknown command" }, { "ER_BAD_NULL_ERROR", 1048, "Column \'%-.192s\' cannot be null" }, { "ER_BAD_DB_ERROR", 1049, "Unknown database \'%-.192s\'" }, { "ER_TABLE_EXISTS_ERROR", 1050, "Table \'%-.192s\' already exists" }, { "ER_BAD_TABLE_ERROR", 1051, "Unknown table \'%-.100s\'" }, { "ER_NON_UNIQ_ERROR", 1052, "Column \'%-.192s\' in %-.192s is ambiguous" }, { "ER_SERVER_SHUTDOWN", 1053, "Server shutdown in progress" }, { "ER_BAD_FIELD_ERROR", 1054, "Unknown column \'%-.192s\' in \'%-.192s\'" }, { "ER_WRONG_FIELD_WITH_GROUP", 1055, "\'%-.192s\' isn\'t in GROUP BY" }, { "ER_WRONG_GROUP_FIELD", 1056, "Can\'t group on \'%-.192s\'" }, { "ER_WRONG_SUM_SELECT", 1057, "Statement has sum functions and columns in same statement" }, { "ER_WRONG_VALUE_COUNT", 1058, "Column count doesn\'t match value count" }, { "ER_TOO_LONG_IDENT", 1059, "Identifier name \'%-.100s\' is too long" }, { "ER_DUP_FIELDNAME", 1060, "Duplicate column name \'%-.192s\'" }, { "ER_DUP_KEYNAME", 1061, "Duplicate key name \'%-.192s\'" }, { "ER_DUP_ENTRY", 1062, "Duplicate entry \'%-.192s\' for key %d" }, { "ER_WRONG_FIELD_SPEC", 1063, "Incorrect column specifier for column \'%-.192s\'" }, { "ER_PARSE_ERROR", 1064, "%s near \'%-.80s\' at line %d" }, { "ER_EMPTY_QUERY", 1065, "Query was empty" }, { "ER_NONUNIQ_TABLE", 1066, "Not unique table/alias: \'%-.192s\'" }, { "ER_INVALID_DEFAULT", 1067, "Invalid default value for \'%-.192s\'" }, { "ER_MULTIPLE_PRI_KEY", 1068, "Multiple primary key defined" }, { "ER_TOO_MANY_KEYS", 1069, "Too many keys specified; max %d keys allowed" }, { "ER_TOO_MANY_KEY_PARTS", 1070, "Too many key parts specified; max %d parts allowed" }, { "ER_TOO_LONG_KEY", 1071, "Specified key was too long; max key length is %d bytes" }, { "ER_KEY_COLUMN_DOES_NOT_EXITS", 1072, "Key column \'%-.192s\' doesn\'t exist in table" }, { "ER_BLOB_USED_AS_KEY", 1073, "BLOB column \'%-.192s\' can\'t be used in key specification with the used table type" }, { "ER_TOO_BIG_FIELDLENGTH", 1074, "Column length too big for column \'%-.192s\' (max = %lu); use BLOB or TEXT instead" }, { "ER_WRONG_AUTO_KEY", 1075, "Incorrect table definition; there can be only one auto column and it must be defined as a key" }, { "ER_READY", 1076, "%s: ready for connections.\nVersion: \'%s\' socket: \'%s\' port: %d" }, { "ER_NORMAL_SHUTDOWN", 1077, "%s: Normal shutdown\n" }, { "ER_GOT_SIGNAL", 1078, "%s: Got signal %d. Aborting!\n" }, { "ER_SHUTDOWN_COMPLETE", 1079, "%s: Shutdown complete\n" }, { "ER_FORCING_CLOSE", 1080, "%s: Forcing close of thread %ld user: \'%-.48s\'\n" }, { "ER_IPSOCK_ERROR", 1081, "Can\'t create IP socket" }, { "ER_NO_SUCH_INDEX", 1082, "Table \'%-.192s\' has no index like the one used in CREATE INDEX; recreate the table" }, { "ER_WRONG_FIELD_TERMINATORS", 1083, "Field separator argument is not what is expected; check the manual" }, { "ER_BLOBS_AND_NO_TERMINATED", 1084, "You can\'t use fixed rowlength with BLOBs; please use \'fields terminated by\'" }, { "ER_TEXTFILE_NOT_READABLE", 1085, "The file \'%-.128s\' must be in the database directory or be readable by all" }, { "ER_FILE_EXISTS_ERROR", 1086, "File \'%-.200s\' already exists" }, { "ER_LOAD_INFO", 1087, "Records: %ld Deleted: %ld Skipped: %ld Warnings: %ld" }, { "ER_ALTER_INFO", 1088, "Records: %ld Duplicates: %ld" }, { "ER_WRONG_SUB_KEY", 1089, "Incorrect prefix key; the used key part isn\'t a string, the used length is longer than the key part, or the storage engine doesn\'t support unique prefix keys" }, { "ER_CANT_REMOVE_ALL_FIELDS", 1090, "You can\'t delete all columns with ALTER TABLE; use DROP TABLE instead" }, { "ER_CANT_DROP_FIELD_OR_KEY", 1091, "Can\'t DROP \'%-.192s\'; check that column/key exists" }, { "ER_INSERT_INFO", 1092, "Records: %ld Duplicates: %ld Warnings: %ld" }, { "ER_UPDATE_TABLE_USED", 1093, "You can\'t specify target table \'%-.192s\' for update in FROM clause" }, { "ER_NO_SUCH_THREAD", 1094, "Unknown thread id: %lu" }, { "ER_KILL_DENIED_ERROR", 1095, "You are not owner of thread %lu" }, { "ER_NO_TABLES_USED", 1096, "No tables used" }, { "ER_TOO_BIG_SET", 1097, "Too many strings for column %-.192s and SET" }, { "ER_NO_UNIQUE_LOGFILE", 1098, "Can\'t generate a unique log-filename %-.200s.(1-999)\n" }, { "ER_TABLE_NOT_LOCKED_FOR_WRITE", 1099, "Table \'%-.192s\' was locked with a READ lock and can\'t be updated" }, { "ER_TABLE_NOT_LOCKED", 1100, "Table \'%-.192s\' was not locked with LOCK TABLES" }, { "ER_BLOB_CANT_HAVE_DEFAULT", 1101, "BLOB, TEXT, GEOMETRY or JSON column \'%-.192s\' can\'t have a default value" }, { "ER_WRONG_DB_NAME", 1102, "Incorrect database name \'%-.100s\'" }, { "ER_WRONG_TABLE_NAME", 1103, "Incorrect table name \'%-.100s\'" }, { "ER_TOO_BIG_SELECT", 1104, "The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay" }, { "ER_UNKNOWN_ERROR", 1105, "Unknown error" }, { "ER_UNKNOWN_PROCEDURE", 1106, "Unknown procedure \'%-.192s\'" }, { "ER_WRONG_PARAMCOUNT_TO_PROCEDURE", 1107, "Incorrect parameter count to procedure \'%-.192s\'" }, { "ER_WRONG_PARAMETERS_TO_PROCEDURE", 1108, "Incorrect parameters to procedure \'%-.192s\'" }, { "ER_UNKNOWN_TABLE", 1109, "Unknown table \'%-.192s\' in %-.32s" }, { "ER_FIELD_SPECIFIED_TWICE", 1110, "Column \'%-.192s\' specified twice" }, { "ER_INVALID_GROUP_FUNC_USE", 1111, "Invalid use of group function" }, { "ER_UNSUPPORTED_EXTENSION", 1112, "Table \'%-.192s\' uses an extension that doesn\'t exist in this MySQL version" }, { "ER_TABLE_MUST_HAVE_COLUMNS", 1113, "A table must have at least 1 column" }, { "ER_RECORD_FILE_FULL", 1114, "The table \'%-.192s\' is full" }, { "ER_UNKNOWN_CHARACTER_SET", 1115, "Unknown character set: \'%-.64s\'" }, { "ER_TOO_MANY_TABLES", 1116, "Too many tables; MySQL can only use %d tables in a join" }, { "ER_TOO_MANY_FIELDS", 1117, "Too many columns" }, { "ER_TOO_BIG_ROWSIZE", 1118, "Row size too large. The maximum row size for the used table type, not counting BLOBs, is %ld. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs" }, { "ER_STACK_OVERRUN", 1119, "Thread stack overrun: Used: %ld of a %ld stack. Use \'mysqld --thread_stack=#\' to specify a bigger stack if needed" }, { "ER_WRONG_OUTER_JOIN", 1120, "Cross dependency found in OUTER JOIN; examine your ON conditions" }, { "ER_NULL_COLUMN_IN_INDEX", 1121, "Table handler doesn\'t support NULL in given index. Please change column \'%-.192s\' to be NOT NULL or use another handler" }, { "ER_CANT_FIND_UDF", 1122, "Can\'t load function \'%-.192s\'" }, { "ER_CANT_INITIALIZE_UDF", 1123, "Can\'t initialize function \'%-.192s\'; %-.80s" }, { "ER_UDF_NO_PATHS", 1124, "No paths allowed for shared library" }, { "ER_UDF_EXISTS", 1125, "Function \'%-.192s\' already exists" }, { "ER_CANT_OPEN_LIBRARY", 1126, "Can\'t open shared library \'%-.192s\' (errno: %d %-.128s)" }, { "ER_CANT_FIND_DL_ENTRY", 1127, "Can\'t find symbol \'%-.128s\' in library" }, { "ER_FUNCTION_NOT_DEFINED", 1128, "Function \'%-.192s\' is not defined" }, { "ER_HOST_IS_BLOCKED", 1129, "Host \'%-.64s\' is blocked because of many connection errors; unblock with \'mysqladmin flush-hosts\'" }, { "ER_HOST_NOT_PRIVILEGED", 1130, "Host \'%-.64s\' is not allowed to connect to this MySQL server" }, { "ER_PASSWORD_ANONYMOUS_USER", 1131, "You are using MySQL as an anonymous user and anonymous users are not allowed to change passwords" }, { "ER_PASSWORD_NOT_ALLOWED", 1132, "You must have privileges to update tables in the mysql database to be able to change passwords for others" }, { "ER_PASSWORD_NO_MATCH", 1133, "Can\'t find any matching row in the user table" }, { "ER_UPDATE_INFO", 1134, "Rows matched: %ld Changed: %ld Warnings: %ld" }, { "ER_CANT_CREATE_THREAD", 1135, "Can\'t create a new thread (errno %d); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug" }, { "ER_WRONG_VALUE_COUNT_ON_ROW", 1136, "Column count doesn\'t match value count at row %ld" }, { "ER_CANT_REOPEN_TABLE", 1137, "Can\'t reopen table: \'%-.192s\'" }, { "ER_INVALID_USE_OF_NULL", 1138, "Invalid use of NULL value" }, { "ER_REGEXP_ERROR", 1139, "Got error \'%-.64s\' from regexp" }, { "ER_MIX_OF_GROUP_FUNC_AND_FIELDS", 1140, "Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause" }, { "ER_NONEXISTING_GRANT", 1141, "There is no such grant defined for user \'%-.48s\' on host \'%-.64s\'" }, { "ER_TABLEACCESS_DENIED_ERROR", 1142, "%-.128s command denied to user \'%-.48s\'@\'%-.64s\' for table \'%-.64s\'" }, { "ER_COLUMNACCESS_DENIED_ERROR", 1143, "%-.16s command denied to user \'%-.48s\'@\'%-.64s\' for column \'%-.192s\' in table \'%-.192s\'" }, { "ER_ILLEGAL_GRANT_FOR_TABLE", 1144, "Illegal GRANT/REVOKE command; please consult the manual to see which privileges can be used" }, { "ER_GRANT_WRONG_HOST_OR_USER", 1145, "The host or user argument to GRANT is too long" }, { "ER_NO_SUCH_TABLE", 1146, "Table \'%-.192s.%-.192s\' doesn\'t exist" }, { "ER_NONEXISTING_TABLE_GRANT", 1147, "There is no such grant defined for user \'%-.48s\' on host \'%-.64s\' on table \'%-.192s\'" }, { "ER_NOT_ALLOWED_COMMAND", 1148, "The used command is not allowed with this MySQL version" }, { "ER_SYNTAX_ERROR", 1149, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use" }, { "ER_UNUSED1", 1150, "Delayed insert thread couldn\'t get requested lock for table %-.192s" }, { "ER_UNUSED2", 1151, "Too many delayed threads in use" }, { "ER_ABORTING_CONNECTION", 1152, "Aborted connection %ld to db: \'%-.192s\' user: \'%-.48s\' (%-.64s)" }, { "ER_NET_PACKET_TOO_LARGE", 1153, "Got a packet bigger than \'max_allowed_packet\' bytes" }, { "ER_NET_READ_ERROR_FROM_PIPE", 1154, "Got a read error from the connection pipe" }, { "ER_NET_FCNTL_ERROR", 1155, "Got an error from fcntl()" }, { "ER_NET_PACKETS_OUT_OF_ORDER", 1156, "Got packets out of order" }, { "ER_NET_UNCOMPRESS_ERROR", 1157, "Couldn\'t uncompress communication packet" }, { "ER_NET_READ_ERROR", 1158, "Got an error reading communication packets" }, { "ER_NET_READ_INTERRUPTED", 1159, "Got timeout reading communication packets" }, { "ER_NET_ERROR_ON_WRITE", 1160, "Got an error writing communication packets" }, { "ER_NET_WRITE_INTERRUPTED", 1161, "Got timeout writing communication packets" }, { "ER_TOO_LONG_STRING", 1162, "Result string is longer than \'max_allowed_packet\' bytes" }, { "ER_TABLE_CANT_HANDLE_BLOB", 1163, "The used table type doesn\'t support BLOB/TEXT columns" }, { "ER_TABLE_CANT_HANDLE_AUTO_INCREMENT", 1164, "The used table type doesn\'t support AUTO_INCREMENT columns" }, { "ER_UNUSED3", 1165, "INSERT DELAYED can\'t be used with table \'%-.192s\' because it is locked with LOCK TABLES" }, { "ER_WRONG_COLUMN_NAME", 1166, "Incorrect column name \'%-.100s\'" }, { "ER_WRONG_KEY_COLUMN", 1167, "The used storage engine can\'t index column \'%-.192s\'" }, { "ER_WRONG_MRG_TABLE", 1168, "Unable to open underlying table which is differently defined or of non-MyISAM type or doesn\'t exist" }, { "ER_DUP_UNIQUE", 1169, "Can\'t write, because of unique constraint, to table \'%-.192s\'" }, { "ER_BLOB_KEY_WITHOUT_LENGTH", 1170, "BLOB/TEXT column \'%-.192s\' used in key specification without a key length" }, { "ER_PRIMARY_CANT_HAVE_NULL", 1171, "All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead" }, { "ER_TOO_MANY_ROWS", 1172, "Result consisted of more than one row" }, { "ER_REQUIRES_PRIMARY_KEY", 1173, "This table type requires a primary key" }, { "ER_NO_RAID_COMPILED", 1174, "This version of MySQL is not compiled with RAID support" }, { "ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE", 1175, "You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column" }, { "ER_KEY_DOES_NOT_EXITS", 1176, "Key \'%-.192s\' doesn\'t exist in table \'%-.192s\'" }, { "ER_CHECK_NO_SUCH_TABLE", 1177, "Can\'t open table" }, { "ER_CHECK_NOT_IMPLEMENTED", 1178, "The storage engine for the table doesn\'t support %s" }, { "ER_CANT_DO_THIS_DURING_AN_TRANSACTION", 1179, "You are not allowed to execute this command in a transaction" }, { "ER_ERROR_DURING_COMMIT", 1180, "Got error %d during COMMIT" }, { "ER_ERROR_DURING_ROLLBACK", 1181, "Got error %d during ROLLBACK" }, { "ER_ERROR_DURING_FLUSH_LOGS", 1182, "Got error %d during FLUSH_LOGS" }, { "ER_ERROR_DURING_CHECKPOINT", 1183, "Got error %d during CHECKPOINT" }, { "ER_NEW_ABORTING_CONNECTION", 1184, "Aborted connection %u to db: \'%-.192s\' user: \'%-.48s\' host: \'%-.64s\' (%-.64s)" }, { "ER_DUMP_NOT_IMPLEMENTED", 1185, "The storage engine for the table does not support binary table dump" }, { "ER_FLUSH_MASTER_BINLOG_CLOSED", 1186, "Binlog closed, cannot RESET MASTER" }, { "ER_INDEX_REBUILD", 1187, "Failed rebuilding the index of dumped table \'%-.192s\'" }, { "ER_MASTER", 1188, "Error from master: \'%-.64s\'" }, { "ER_MASTER_NET_READ", 1189, "Net error reading from master" }, { "ER_MASTER_NET_WRITE", 1190, "Net error writing to master" }, { "ER_FT_MATCHING_KEY_NOT_FOUND", 1191, "Can\'t find FULLTEXT index matching the column list" }, { "ER_LOCK_OR_ACTIVE_TRANSACTION", 1192, "Can\'t execute the given command because you have active locked tables or an active transaction" }, { "ER_UNKNOWN_SYSTEM_VARIABLE", 1193, "Unknown system variable \'%-.64s\'" }, { "ER_CRASHED_ON_USAGE", 1194, "Table \'%-.192s\' is marked as crashed and should be repaired" }, { "ER_CRASHED_ON_REPAIR", 1195, "Table \'%-.192s\' is marked as crashed and last (automatic?) repair failed" }, { "ER_WARNING_NOT_COMPLETE_ROLLBACK", 1196, "Some non-transactional changed tables couldn\'t be rolled back" }, { "ER_TRANS_CACHE_FULL", 1197, "Multi-statement transaction required more than \'max_binlog_cache_size\' bytes of storage; increase this mysqld variable and try again" }, { "ER_SLAVE_MUST_STOP", 1198, "This operation cannot be performed with a running slave; run STOP SLAVE first" }, { "ER_SLAVE_NOT_RUNNING", 1199, "This operation requires a running slave; configure slave and do START SLAVE" }, { "ER_BAD_SLAVE", 1200, "The server is not configured as slave; fix in config file or with CHANGE MASTER TO" }, { "ER_MASTER_INFO", 1201, "Could not initialize master info structure; more error messages can be found in the MySQL error log" }, { "ER_SLAVE_THREAD", 1202, "Could not create slave thread; check system resources" }, { "ER_TOO_MANY_USER_CONNECTIONS", 1203, "User %-.64s already has more than \'max_user_connections\' active connections" }, { "ER_SET_CONSTANTS_ONLY", 1204, "You may only use constant expressions with SET" }, { "ER_LOCK_WAIT_TIMEOUT", 1205, "Lock wait timeout exceeded; try restarting transaction" }, { "ER_LOCK_TABLE_FULL", 1206, "The total number of locks exceeds the lock table size" }, { "ER_READ_ONLY_TRANSACTION", 1207, "Update locks cannot be acquired during a READ UNCOMMITTED transaction" }, { "ER_DROP_DB_WITH_READ_LOCK", 1208, "DROP DATABASE not allowed while thread is holding global read lock" }, { "ER_CREATE_DB_WITH_READ_LOCK", 1209, "CREATE DATABASE not allowed while thread is holding global read lock" }, { "ER_WRONG_ARGUMENTS", 1210, "Incorrect arguments to %s" }, { "ER_NO_PERMISSION_TO_CREATE_USER", 1211, "\'%-.48s\'@\'%-.64s\' is not allowed to create new users" }, { "ER_UNION_TABLES_IN_DIFFERENT_DIR", 1212, "Incorrect table definition; all MERGE tables must be in the same database" }, { "ER_LOCK_DEADLOCK", 1213, "Deadlock found when trying to get lock; try restarting transaction" }, { "ER_TABLE_CANT_HANDLE_FT", 1214, "The used table type doesn\'t support FULLTEXT indexes" }, { "ER_CANNOT_ADD_FOREIGN", 1215, "Cannot add foreign key constraint" }, { "ER_NO_REFERENCED_ROW", 1216, "Cannot add or update a child row: a foreign key constraint fails" }, { "ER_ROW_IS_REFERENCED", 1217, "Cannot delete or update a parent row: a foreign key constraint fails" }, { "ER_CONNECT_TO_MASTER", 1218, "Error connecting to master: %-.128s" }, { "ER_QUERY_ON_MASTER", 1219, "Error running query on master: %-.128s" }, { "ER_ERROR_WHEN_EXECUTING_COMMAND", 1220, "Error when executing command %s: %-.128s" }, { "ER_WRONG_USAGE", 1221, "Incorrect usage of %s and %s" }, { "ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT", 1222, "The used SELECT statements have a different number of columns" }, { "ER_CANT_UPDATE_WITH_READLOCK", 1223, "Can\'t execute the query because you have a conflicting read lock" }, { "ER_MIXING_NOT_ALLOWED", 1224, "Mixing of transactional and non-transactional tables is disabled" }, { "ER_DUP_ARGUMENT", 1225, "Option \'%s\' used twice in statement" }, { "ER_USER_LIMIT_REACHED", 1226, "User \'%-.64s\' has exceeded the \'%s\' resource (current value: %ld)" }, { "ER_SPECIFIC_ACCESS_DENIED_ERROR", 1227, "Access denied; you need (at least one of) the %-.128s privilege(s) for this operation" }, { "ER_LOCAL_VARIABLE", 1228, "Variable \'%-.64s\' is a SESSION variable and can\'t be used with SET GLOBAL" }, { "ER_GLOBAL_VARIABLE", 1229, "Variable \'%-.64s\' is a GLOBAL variable and should be set with SET GLOBAL" }, { "ER_NO_DEFAULT", 1230, "Variable \'%-.64s\' doesn\'t have a default value" }, { "ER_WRONG_VALUE_FOR_VAR", 1231, "Variable \'%-.64s\' can\'t be set to the value of \'%-.200s\'" }, { "ER_WRONG_TYPE_FOR_VAR", 1232, "Incorrect argument type to variable \'%-.64s\'" }, { "ER_VAR_CANT_BE_READ", 1233, "Variable \'%-.64s\' can only be set, not read" }, { "ER_CANT_USE_OPTION_HERE", 1234, "Incorrect usage/placement of \'%s\'" }, { "ER_NOT_SUPPORTED_YET", 1235, "This version of MySQL doesn\'t yet support \'%s\'" }, { "ER_MASTER_FATAL_ERROR_READING_BINLOG", 1236, "Got fatal error %d from master when reading data from binary log: \'%-.320s\'" }, { "ER_SLAVE_IGNORED_TABLE", 1237, "Slave SQL thread ignored the query because of replicate-*-table rules" }, { "ER_INCORRECT_GLOBAL_LOCAL_VAR", 1238, "Variable \'%-.192s\' is a %s variable" }, { "ER_WRONG_FK_DEF", 1239, "Incorrect foreign key definition for \'%-.192s\': %s" }, { "ER_KEY_REF_DO_NOT_MATCH_TABLE_REF", 1240, "Key reference and table reference don\'t match" }, { "ER_OPERAND_COLUMNS", 1241, "Operand should contain %d column(s)" }, { "ER_SUBQUERY_NO_1_ROW", 1242, "Subquery returns more than 1 row" }, { "ER_UNKNOWN_STMT_HANDLER", 1243, "Unknown prepared statement handler (%.*s) given to %s" }, { "ER_CORRUPT_HELP_DB", 1244, "Help database is corrupt or does not exist" }, { "ER_CYCLIC_REFERENCE", 1245, "Cyclic reference on subqueries" }, { "ER_AUTO_CONVERT", 1246, "Converting column \'%s\' from %s to %s" }, { "ER_ILLEGAL_REFERENCE", 1247, "Reference \'%-.64s\' not supported (%s)" }, { "ER_DERIVED_MUST_HAVE_ALIAS", 1248, "Every derived table must have its own alias" }, { "ER_SELECT_REDUCED", 1249, "Select %u was reduced during optimization" }, { "ER_TABLENAME_NOT_ALLOWED_HERE", 1250, "Table \'%-.192s\' from one of the SELECTs cannot be used in %-.32s" }, { "ER_NOT_SUPPORTED_AUTH_MODE", 1251, "Client does not support authentication protocol requested by server; consider upgrading MySQL client" }, { "ER_SPATIAL_CANT_HAVE_NULL", 1252, "All parts of a SPATIAL index must be NOT NULL" }, { "ER_COLLATION_CHARSET_MISMATCH", 1253, "COLLATION \'%s\' is not valid for CHARACTER SET \'%s\'" }, { "ER_SLAVE_WAS_RUNNING", 1254, "Slave is already running" }, { "ER_SLAVE_WAS_NOT_RUNNING", 1255, "Slave already has been stopped" }, { "ER_TOO_BIG_FOR_UNCOMPRESS", 1256, "Uncompressed data size too large; the maximum size is %d (probably, length of uncompressed data was corrupted)" }, { "ER_ZLIB_Z_MEM_ERROR", 1257, "ZLIB: Not enough memory" }, { "ER_ZLIB_Z_BUF_ERROR", 1258, "ZLIB: Not enough room in the output buffer (probably, length of uncompressed data was corrupted)" }, { "ER_ZLIB_Z_DATA_ERROR", 1259, "ZLIB: Input data corrupted" }, { "ER_CUT_VALUE_GROUP_CONCAT", 1260, "Row %u was cut by GROUP_CONCAT()" }, { "ER_WARN_TOO_FEW_RECORDS", 1261, "Row %ld doesn\'t contain data for all columns" }, { "ER_WARN_TOO_MANY_RECORDS", 1262, "Row %ld was truncated; it contained more data than there were input columns" }, { "ER_WARN_NULL_TO_NOTNULL", 1263, "Column set to default value; NULL supplied to NOT NULL column \'%s\' at row %ld" }, { "ER_WARN_DATA_OUT_OF_RANGE", 1264, "Out of range value for column \'%s\' at row %ld" }, { "WARN_DATA_TRUNCATED", 1265, "Data truncated for column \'%s\' at row %ld" }, { "ER_WARN_USING_OTHER_HANDLER", 1266, "Using storage engine %s for table \'%s\'" }, { "ER_CANT_AGGREGATE_2COLLATIONS", 1267, "Illegal mix of collations (%s,%s) and (%s,%s) for operation \'%s\'" }, { "ER_DROP_USER", 1268, "Cannot drop one or more of the requested users" }, { "ER_REVOKE_GRANTS", 1269, "Can\'t revoke all privileges for one or more of the requested users" }, { "ER_CANT_AGGREGATE_3COLLATIONS", 1270, "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation \'%s\'" }, { "ER_CANT_AGGREGATE_NCOLLATIONS", 1271, "Illegal mix of collations for operation \'%s\'" }, { "ER_VARIABLE_IS_NOT_STRUCT", 1272, "Variable \'%-.64s\' is not a variable component (can\'t be used as XXXX.variable_name)" }, { "ER_UNKNOWN_COLLATION", 1273, "Unknown collation: \'%-.64s\'" }, { "ER_SLAVE_IGNORED_SSL_PARAMS", 1274, "SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later if MySQL slave with SSL is started" }, { "ER_SERVER_IS_IN_SECURE_AUTH_MODE", 1275, "Server is running in --secure-auth mode, but \'%s\'@\'%s\' has a password in the old format; please change the password to the new format" }, { "ER_WARN_FIELD_RESOLVED", 1276, "Field or reference \'%-.192s%s%-.192s%s%-.192s\' of SELECT #%d was resolved in SELECT #%d" }, { "ER_BAD_SLAVE_UNTIL_COND", 1277, "Incorrect parameter or combination of parameters for START SLAVE UNTIL" }, { "ER_MISSING_SKIP_SLAVE", 1278, "It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave\'s mysqld restart" }, { "ER_UNTIL_COND_IGNORED", 1279, "SQL thread is not to be started so UNTIL options are ignored" }, { "ER_WRONG_NAME_FOR_INDEX", 1280, "Incorrect index name \'%-.100s\'" }, { "ER_WRONG_NAME_FOR_CATALOG", 1281, "Incorrect catalog name \'%-.100s\'" }, { "ER_WARN_QC_RESIZE", 1282, "Query cache failed to set size %lu; new query cache size is %lu" }, { "ER_BAD_FT_COLUMN", 1283, "Column \'%-.192s\' cannot be part of FULLTEXT index" }, { "ER_UNKNOWN_KEY_CACHE", 1284, "Unknown key cache \'%-.100s\'" }, { "ER_WARN_HOSTNAME_WONT_WORK", 1285, "MySQL is started in --skip-name-resolve mode; you must restart it without this switch for this grant to work" }, { "ER_UNKNOWN_STORAGE_ENGINE", 1286, "Unknown storage engine \'%s\'" }, { "ER_WARN_DEPRECATED_SYNTAX", 1287, "\'%s\' is deprecated and will be removed in a future release. Please use %s instead" }, { "ER_NON_UPDATABLE_TABLE", 1288, "The target table %-.100s of the %s is not updatable" }, { "ER_FEATURE_DISABLED", 1289, "The \'%s\' feature is disabled; you need MySQL built with \'%s\' to have it working" }, { "ER_OPTION_PREVENTS_STATEMENT", 1290, "The MySQL server is running with the %s option so it cannot execute this statement" }, { "ER_DUPLICATED_VALUE_IN_TYPE", 1291, "Column \'%-.100s\' has duplicated value \'%-.64s\' in %s" }, { "ER_TRUNCATED_WRONG_VALUE", 1292, "Truncated incorrect %-.32s value: \'%-.128s\'" }, { "ER_TOO_MUCH_AUTO_TIMESTAMP_COLS", 1293, "Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause" }, { "ER_INVALID_ON_UPDATE", 1294, "Invalid ON UPDATE clause for \'%-.192s\' column" }, { "ER_UNSUPPORTED_PS", 1295, "This command is not supported in the prepared statement protocol yet" }, { "ER_GET_ERRMSG", 1296, "Got error %d \'%-.100s\' from %s" }, { "ER_GET_TEMPORARY_ERRMSG", 1297, "Got temporary error %d \'%-.100s\' from %s" }, { "ER_UNKNOWN_TIME_ZONE", 1298, "Unknown or incorrect time zone: \'%-.64s\'" }, { "ER_WARN_INVALID_TIMESTAMP", 1299, "Invalid TIMESTAMP value in column \'%s\' at row %ld" }, { "ER_INVALID_CHARACTER_STRING", 1300, "Invalid %s character string: \'%.64s\'" }, { "ER_WARN_ALLOWED_PACKET_OVERFLOWED", 1301, "Result of %s() was larger than max_allowed_packet (%ld) - truncated" }, { "ER_CONFLICTING_DECLARATIONS", 1302, "Conflicting declarations: \'%s%s\' and \'%s%s\'" }, { "ER_SP_NO_RECURSIVE_CREATE", 1303, "Can\'t create a %s from within another stored routine" }, { "ER_SP_ALREADY_EXISTS", 1304, "%s %s already exists" }, { "ER_SP_DOES_NOT_EXIST", 1305, "%s %s does not exist" }, { "ER_SP_DROP_FAILED", 1306, "Failed to DROP %s %s" }, { "ER_SP_STORE_FAILED", 1307, "Failed to CREATE %s %s" }, { "ER_SP_LILABEL_MISMATCH", 1308, "%s with no matching label: %s" }, { "ER_SP_LABEL_REDEFINE", 1309, "Redefining label %s" }, { "ER_SP_LABEL_MISMATCH", 1310, "End-label %s without match" }, { "ER_SP_UNINIT_VAR", 1311, "Referring to uninitialized variable %s" }, { "ER_SP_BADSELECT", 1312, "PROCEDURE %s can\'t return a result set in the given context" }, { "ER_SP_BADRETURN", 1313, "RETURN is only allowed in a FUNCTION" }, { "ER_SP_BADSTATEMENT", 1314, "%s is not allowed in stored procedures" }, { "ER_UPDATE_LOG_DEPRECATED_IGNORED", 1315, "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored." }, { "ER_UPDATE_LOG_DEPRECATED_TRANSLATED", 1316, "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." }, { "ER_QUERY_INTERRUPTED", 1317, "Query execution was interrupted" }, { "ER_SP_WRONG_NO_OF_ARGS", 1318, "Incorrect number of arguments for %s %s; expected %u, got %u" }, { "ER_SP_COND_MISMATCH", 1319, "Undefined CONDITION: %s" }, { "ER_SP_NORETURN", 1320, "No RETURN found in FUNCTION %s" }, { "ER_SP_NORETURNEND", 1321, "FUNCTION %s ended without RETURN" }, { "ER_SP_BAD_CURSOR_QUERY", 1322, "Cursor statement must be a SELECT" }, { "ER_SP_BAD_CURSOR_SELECT", 1323, "Cursor SELECT must not have INTO" }, { "ER_SP_CURSOR_MISMATCH", 1324, "Undefined CURSOR: %s" }, { "ER_SP_CURSOR_ALREADY_OPEN", 1325, "Cursor is already open" }, { "ER_SP_CURSOR_NOT_OPEN", 1326, "Cursor is not open" }, { "ER_SP_UNDECLARED_VAR", 1327, "Undeclared variable: %s" }, { "ER_SP_WRONG_NO_OF_FETCH_ARGS", 1328, "Incorrect number of FETCH variables" }, { "ER_SP_FETCH_NO_DATA", 1329, "No data - zero rows fetched, selected, or processed" }, { "ER_SP_DUP_PARAM", 1330, "Duplicate parameter: %s" }, { "ER_SP_DUP_VAR", 1331, "Duplicate variable: %s" }, { "ER_SP_DUP_COND", 1332, "Duplicate condition: %s" }, { "ER_SP_DUP_CURS", 1333, "Duplicate cursor: %s" }, { "ER_SP_CANT_ALTER", 1334, "Failed to ALTER %s %s" }, { "ER_SP_SUBSELECT_NYI", 1335, "Subquery value not supported" }, { "ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG", 1336, "%s is not allowed in stored function or trigger" }, { "ER_SP_VARCOND_AFTER_CURSHNDLR", 1337, "Variable or condition declaration after cursor or handler declaration" }, { "ER_SP_CURSOR_AFTER_HANDLER", 1338, "Cursor declaration after handler declaration" }, { "ER_SP_CASE_NOT_FOUND", 1339, "Case not found for CASE statement" }, { "ER_FPARSER_TOO_BIG_FILE", 1340, "Configuration file \'%-.192s\' is too big" }, { "ER_FPARSER_BAD_HEADER", 1341, "Malformed file type header in file \'%-.192s\'" }, { "ER_FPARSER_EOF_IN_COMMENT", 1342, "Unexpected end of file while parsing comment \'%-.200s\'" }, { "ER_FPARSER_ERROR_IN_PARAMETER", 1343, "Error while parsing parameter \'%-.192s\' (line: \'%-.192s\')" }, { "ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER", 1344, "Unexpected end of file while skipping unknown parameter \'%-.192s\'" }, { "ER_VIEW_NO_EXPLAIN", 1345, "EXPLAIN/SHOW can not be issued; lacking privileges for underlying table" }, { "ER_FRM_UNKNOWN_TYPE", 1346, "File \'%-.192s\' has unknown type \'%-.64s\' in its header" }, { "ER_WRONG_OBJECT", 1347, "\'%-.192s.%-.192s\' is not %s" }, { "ER_NONUPDATEABLE_COLUMN", 1348, "Column \'%-.192s\' is not updatable" }, { "ER_VIEW_SELECT_DERIVED_UNUSED", 1349, "View\'s SELECT contains a subquery in the FROM clause" }, { "ER_VIEW_SELECT_CLAUSE", 1350, "View\'s SELECT contains a \'%s\' clause" }, { "ER_VIEW_SELECT_VARIABLE", 1351, "View\'s SELECT contains a variable or parameter" }, { "ER_VIEW_SELECT_TMPTABLE", 1352, "View\'s SELECT refers to a temporary table \'%-.192s\'" }, { "ER_VIEW_WRONG_LIST", 1353, "View\'s SELECT and view\'s field list have different column counts" }, { "ER_WARN_VIEW_MERGE", 1354, "View merge algorithm can\'t be used here for now (assumed undefined algorithm)" }, { "ER_WARN_VIEW_WITHOUT_KEY", 1355, "View being updated does not have complete key of underlying table in it" }, { "ER_VIEW_INVALID", 1356, "View \'%-.192s.%-.192s\' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them" }, { "ER_SP_NO_DROP_SP", 1357, "Can\'t drop or alter a %s from within another stored routine" }, { "ER_SP_GOTO_IN_HNDLR", 1358, "GOTO is not allowed in a stored procedure handler" }, { "ER_TRG_ALREADY_EXISTS", 1359, "Trigger already exists" }, { "ER_TRG_DOES_NOT_EXIST", 1360, "Trigger does not exist" }, { "ER_TRG_ON_VIEW_OR_TEMP_TABLE", 1361, "Trigger\'s \'%-.192s\' is view or temporary table" }, { "ER_TRG_CANT_CHANGE_ROW", 1362, "Updating of %s row is not allowed in %strigger" }, { "ER_TRG_NO_SUCH_ROW_IN_TRG", 1363, "There is no %s row in %s trigger" }, { "ER_NO_DEFAULT_FOR_FIELD", 1364, "Field \'%-.192s\' doesn\'t have a default value" }, { "ER_DIVISION_BY_ZERO", 1365, "Division by 0" }, { "ER_TRUNCATED_WRONG_VALUE_FOR_FIELD", 1366, "Incorrect %-.32s value: \'%-.128s\' for column \'%.192s\' at row %ld" }, { "ER_ILLEGAL_VALUE_FOR_TYPE", 1367, "Illegal %s \'%-.192s\' value found during parsing" }, { "ER_VIEW_NONUPD_CHECK", 1368, "CHECK OPTION on non-updatable view \'%-.192s.%-.192s\'" }, { "ER_VIEW_CHECK_FAILED", 1369, "CHECK OPTION failed \'%-.192s.%-.192s\'" }, { "ER_PROCACCESS_DENIED_ERROR", 1370, "%-.16s command denied to user \'%-.48s\'@\'%-.64s\' for routine \'%-.192s\'" }, { "ER_RELAY_LOG_FAIL", 1371, "Failed purging old relay logs: %s" }, { "ER_PASSWD_LENGTH", 1372, "Password hash should be a %d-digit hexadecimal number" }, { "ER_UNKNOWN_TARGET_BINLOG", 1373, "Target log not found in binlog index" }, { "ER_IO_ERR_LOG_INDEX_READ", 1374, "I/O error reading log index file" }, { "ER_BINLOG_PURGE_PROHIBITED", 1375, "Server configuration does not permit binlog purge" }, { "ER_FSEEK_FAIL", 1376, "Failed on fseek()" }, { "ER_BINLOG_PURGE_FATAL_ERR", 1377, "Fatal error during log purge" }, { "ER_LOG_IN_USE", 1378, "A purgeable log is in use, will not purge" }, { "ER_LOG_PURGE_UNKNOWN_ERR", 1379, "Unknown error during log purge" }, { "ER_RELAY_LOG_INIT", 1380, "Failed initializing relay log position: %s" }, { "ER_NO_BINARY_LOGGING", 1381, "You are not using binary logging" }, { "ER_RESERVED_SYNTAX", 1382, "The \'%-.64s\' syntax is reserved for purposes internal to the MySQL server" }, { "ER_WSAS_FAILED", 1383, "WSAStartup Failed" }, { "ER_DIFF_GROUPS_PROC", 1384, "Can\'t handle procedures with different groups yet" }, { "ER_NO_GROUP_FOR_PROC", 1385, "Select must have a group with this procedure" }, { "ER_ORDER_WITH_PROC", 1386, "Can\'t use ORDER clause with this procedure" }, { "ER_LOGGING_PROHIBIT_CHANGING_OF", 1387, "Binary logging and replication forbid changing the global server %s" }, { "ER_NO_FILE_MAPPING", 1388, "Can\'t map file: %-.200s, errno: %d" }, { "ER_WRONG_MAGIC", 1389, "Wrong magic in %-.64s" }, { "ER_PS_MANY_PARAM", 1390, "Prepared statement contains too many placeholders" }, { "ER_KEY_PART_0", 1391, "Key part \'%-.192s\' length cannot be 0" }, { "ER_VIEW_CHECKSUM", 1392, "View text checksum failed" }, { "ER_VIEW_MULTIUPDATE", 1393, "Can not modify more than one base table through a join view \'%-.192s.%-.192s\'" }, { "ER_VIEW_NO_INSERT_FIELD_LIST", 1394, "Can not insert into join view \'%-.192s.%-.192s\' without fields list" }, { "ER_VIEW_DELETE_MERGE_VIEW", 1395, "Can not delete from join view \'%-.192s.%-.192s\'" }, { "ER_CANNOT_USER", 1396, "Operation %s failed for %.256s" }, { "ER_XAER_NOTA", 1397, "XAER_NOTA: Unknown XID" }, { "ER_XAER_INVAL", 1398, "XAER_INVAL: Invalid arguments (or unsupported command)" }, { "ER_XAER_RMFAIL", 1399, "XAER_RMFAIL: The command cannot be executed when global transaction is in the %.64s state" }, { "ER_XAER_OUTSIDE", 1400, "XAER_OUTSIDE: Some work is done outside global transaction" }, { "ER_XAER_RMERR", 1401, "XAER_RMERR: Fatal error occurred in the transaction branch - check your data for consistency" }, { "ER_XA_RBROLLBACK", 1402, "XA_RBROLLBACK: Transaction branch was rolled back" }, { "ER_NONEXISTING_PROC_GRANT", 1403, "There is no such grant defined for user \'%-.48s\' on host \'%-.64s\' on routine \'%-.192s\'" }, { "ER_PROC_AUTO_GRANT_FAIL", 1404, "Failed to grant EXECUTE and ALTER ROUTINE privileges" }, { "ER_PROC_AUTO_REVOKE_FAIL", 1405, "Failed to revoke all privileges to dropped routine" }, { "ER_DATA_TOO_LONG", 1406, "Data too long for column \'%s\' at row %ld" }, { "ER_SP_BAD_SQLSTATE", 1407, "Bad SQLSTATE: \'%s\'" }, { "ER_STARTUP", 1408, "%s: ready for connections.\nVersion: \'%s\' socket: \'%s\' port: %d %s" }, { "ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR", 1409, "Can\'t load value from file with fixed size rows to variable" }, { "ER_CANT_CREATE_USER_WITH_GRANT", 1410, "You are not allowed to create a user with GRANT" }, { "ER_WRONG_VALUE_FOR_TYPE", 1411, "Incorrect %-.32s value: \'%-.128s\' for function %-.32s" }, { "ER_TABLE_DEF_CHANGED", 1412, "Table definition has changed, please retry transaction" }, { "ER_SP_DUP_HANDLER", 1413, "Duplicate handler declared in the same block" }, { "ER_SP_NOT_VAR_ARG", 1414, "OUT or INOUT argument %d for routine %s is not a variable or NEW pseudo-variable in BEFORE trigger" }, { "ER_SP_NO_RETSET", 1415, "Not allowed to return a result set from a %s" }, { "ER_CANT_CREATE_GEOMETRY_OBJECT", 1416, "Cannot get geometry object from data you send to the GEOMETRY field" }, { "ER_FAILED_ROUTINE_BREAK_BINLOG", 1417, "A routine failed and has neither NO SQL nor READS SQL DATA in its declaration and binary logging is enabled; if non-transactional tables were updated, the binary log will miss their changes" }, { "ER_BINLOG_UNSAFE_ROUTINE", 1418, "This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)" }, { "ER_BINLOG_CREATE_ROUTINE_NEED_SUPER", 1419, "You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)" }, { "ER_EXEC_STMT_WITH_OPEN_CURSOR", 1420, "You can\'t execute a prepared statement which has an open cursor associated with it. Reset the statement to re-execute it." }, { "ER_STMT_HAS_NO_OPEN_CURSOR", 1421, "The statement (%lu) has no open cursor." }, { "ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG", 1422, "Explicit or implicit commit is not allowed in stored function or trigger." }, { "ER_NO_DEFAULT_FOR_VIEW_FIELD", 1423, "Field of view \'%-.192s.%-.192s\' underlying table doesn\'t have a default value" }, { "ER_SP_NO_RECURSION", 1424, "Recursive stored functions and triggers are not allowed." }, { "ER_TOO_BIG_SCALE", 1425, "Too big scale %d specified for column \'%-.192s\'. Maximum is %lu." }, { "ER_TOO_BIG_PRECISION", 1426, "Too-big precision %d specified for \'%-.192s\'. Maximum is %lu." }, { "ER_M_BIGGER_THAN_D", 1427, "For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column \'%-.192s\')." }, { "ER_WRONG_LOCK_OF_SYSTEM_TABLE", 1428, "You can\'t combine write-locking of system tables with other tables or lock types" }, { "ER_CONNECT_TO_FOREIGN_DATA_SOURCE", 1429, "Unable to connect to foreign data source: %.64s" }, { "ER_QUERY_ON_FOREIGN_DATA_SOURCE", 1430, "There was a problem processing the query on the foreign data source. Data source error: %-.64s" }, { "ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST", 1431, "The foreign data source you are trying to reference does not exist. Data source error: %-.64s" }, { "ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE", 1432, "Can\'t create federated table. The data source connection string \'%-.64s\' is not in the correct format" }, { "ER_FOREIGN_DATA_STRING_INVALID", 1433, "The data source connection string \'%-.64s\' is not in the correct format" }, { "ER_CANT_CREATE_FEDERATED_TABLE", 1434, "Can\'t create federated table. Foreign data src error: %-.64s" }, { "ER_TRG_IN_WRONG_SCHEMA", 1435, "Trigger in wrong schema" }, { "ER_STACK_OVERRUN_NEED_MORE", 1436, "Thread stack overrun: %ld bytes used of a %ld byte stack, and %ld bytes needed. Use \'mysqld --thread_stack=#\' to specify a bigger stack." }, { "ER_TOO_LONG_BODY", 1437, "Routine body for \'%-.100s\' is too long" }, { "ER_WARN_CANT_DROP_DEFAULT_KEYCACHE", 1438, "Cannot drop default keycache" }, { "ER_TOO_BIG_DISPLAYWIDTH", 1439, "Display width out of range for column \'%-.192s\' (max = %lu)" }, { "ER_XAER_DUPID", 1440, "XAER_DUPID: The XID already exists" }, { "ER_DATETIME_FUNCTION_OVERFLOW", 1441, "Datetime function: %-.32s field overflow" }, { "ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG", 1442, "Can\'t update table \'%-.192s\' in stored function/trigger because it is already used by statement which invoked this stored function/trigger." }, { "ER_VIEW_PREVENT_UPDATE", 1443, "The definition of table \'%-.192s\' prevents operation %.192s on table \'%-.192s\'." }, { "ER_PS_NO_RECURSION", 1444, "The prepared statement contains a stored routine call that refers to that same statement. It\'s not allowed to execute a prepared statement in such a recursive manner" }, { "ER_SP_CANT_SET_AUTOCOMMIT", 1445, "Not allowed to set autocommit from a stored function or trigger" }, { "ER_MALFORMED_DEFINER", 1446, "Definer is not fully qualified" }, { "ER_VIEW_FRM_NO_USER", 1447, "View \'%-.192s\'.\'%-.192s\' has no definer information (old table format). Current user is used as definer. Please recreate the view!" }, { "ER_VIEW_OTHER_USER", 1448, "You need the SUPER privilege for creation view with \'%-.192s\'@\'%-.192s\' definer" }, { "ER_NO_SUCH_USER", 1449, "The user specified as a definer (\'%-.64s\'@\'%-.64s\') does not exist" }, { "ER_FORBID_SCHEMA_CHANGE", 1450, "Changing schema from \'%-.192s\' to \'%-.192s\' is not allowed." }, { "ER_ROW_IS_REFERENCED_2", 1451, "Cannot delete or update a parent row: a foreign key constraint fails (%.192s)" }, { "ER_NO_REFERENCED_ROW_2", 1452, "Cannot add or update a child row: a foreign key constraint fails (%.192s)" }, { "ER_SP_BAD_VAR_SHADOW", 1453, "Variable \'%-.64s\' must be quoted with `...`, or renamed" }, { "ER_TRG_NO_DEFINER", 1454, "No definer attribute for trigger \'%-.192s\'.\'%-.192s\'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger." }, { "ER_OLD_FILE_FORMAT", 1455, "\'%-.192s\' has an old format, you should re-create the \'%s\' object(s)" }, { "ER_SP_RECURSION_LIMIT", 1456, "Recursive limit %d (as set by the max_sp_recursion_depth variable) was exceeded for routine %.192s" }, { "ER_SP_PROC_TABLE_CORRUPT", 1457, "Failed to load routine %-.192s. The table mysql.proc is missing, corrupt, or contains bad data (internal code %d)" }, { "ER_SP_WRONG_NAME", 1458, "Incorrect routine name \'%-.192s\'" }, { "ER_TABLE_NEEDS_UPGRADE", 1459, "Table upgrade required. Please do \"REPAIR TABLE `%-.64s`\" or dump/reload to fix it!" }, { "ER_SP_NO_AGGREGATE", 1460, "AGGREGATE is not supported for stored functions" }, { "ER_MAX_PREPARED_STMT_COUNT_REACHED", 1461, "Can\'t create more than max_prepared_stmt_count statements (current value: %lu)" }, { "ER_VIEW_RECURSIVE", 1462, "`%-.192s`.`%-.192s` contains view recursion" }, { "ER_NON_GROUPING_FIELD_USED", 1463, "Non-grouping field \'%-.192s\' is used in %-.64s clause" }, { "ER_TABLE_CANT_HANDLE_SPKEYS", 1464, "The used table type doesn\'t support SPATIAL indexes" }, { "ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA", 1465, "Triggers can not be created on system tables" }, { "ER_REMOVED_SPACES", 1466, "Leading spaces are removed from name \'%s\'" }, { "ER_AUTOINC_READ_FAILED", 1467, "Failed to read auto-increment value from storage engine" }, { "ER_USERNAME", 1468, "user name" }, { "ER_HOSTNAME", 1469, "host name" }, { "ER_WRONG_STRING_LENGTH", 1470, "String \'%-.70s\' is too long for %s (should be no longer than %d)" }, { "ER_NON_INSERTABLE_TABLE", 1471, "The target table %-.100s of the %s is not insertable-into" }, { "ER_ADMIN_WRONG_MRG_TABLE", 1472, "Table \'%-.64s\' is differently defined or of non-MyISAM type or doesn\'t exist" }, { "ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT", 1473, "Too high level of nesting for select" }, { "ER_NAME_BECOMES_EMPTY", 1474, "Name \'%-.64s\' has become \'\'" }, { "ER_AMBIGUOUS_FIELD_TERM", 1475, "First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY" }, { "ER_FOREIGN_SERVER_EXISTS", 1476, "The foreign server, %s, you are trying to create already exists." }, { "ER_FOREIGN_SERVER_DOESNT_EXIST", 1477, "The foreign server name you are trying to reference does not exist. Data source error: %-.64s" }, { "ER_ILLEGAL_HA_CREATE_OPTION", 1478, "Table storage engine \'%-.64s\' does not support the create option \'%.64s\'" }, { "ER_PARTITION_REQUIRES_VALUES_ERROR", 1479, "Syntax error: %-.64s PARTITIONING requires definition of VALUES %-.64s for each partition" }, { "ER_PARTITION_WRONG_VALUES_ERROR", 1480, "Only %-.64s PARTITIONING can use VALUES %-.64s in partition definition" }, { "ER_PARTITION_MAXVALUE_ERROR", 1481, "MAXVALUE can only be used in last partition definition" }, { "ER_PARTITION_SUBPARTITION_ERROR", 1482, "Subpartitions can only be hash partitions and by key" }, { "ER_PARTITION_SUBPART_MIX_ERROR", 1483, "Must define subpartitions on all partitions if on one partition" }, { "ER_PARTITION_WRONG_NO_PART_ERROR", 1484, "Wrong number of partitions defined, mismatch with previous setting" }, { "ER_PARTITION_WRONG_NO_SUBPART_ERROR", 1485, "Wrong number of subpartitions defined, mismatch with previous setting" }, { "ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR", 1486, "Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed" }, { "ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR", 1487, "Expression in RANGE/LIST VALUES must be constant" }, { "ER_FIELD_NOT_FOUND_PART_ERROR", 1488, "Field in list of fields for partition function not found in table" }, { "ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR", 1489, "List of fields is only allowed in KEY partitions" }, { "ER_INCONSISTENT_PARTITION_INFO_ERROR", 1490, "The partition info in the frm file is not consistent with what can be written into the frm file" }, { "ER_PARTITION_FUNC_NOT_ALLOWED_ERROR", 1491, "The %-.192s function returns the wrong type" }, { "ER_PARTITIONS_MUST_BE_DEFINED_ERROR", 1492, "For %-.64s partitions each partition must be defined" }, { "ER_RANGE_NOT_INCREASING_ERROR", 1493, "VALUES LESS THAN value must be strictly increasing for each partition" }, { "ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR", 1494, "VALUES value must be of same type as partition function" }, { "ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR", 1495, "Multiple definition of same constant in list partitioning" }, { "ER_PARTITION_ENTRY_ERROR", 1496, "Partitioning can not be used stand-alone in query" }, { "ER_MIX_HANDLER_ERROR", 1497, "The mix of handlers in the partitions is not allowed in this version of MySQL" }, { "ER_PARTITION_NOT_DEFINED_ERROR", 1498, "For the partitioned engine it is necessary to define all %-.64s" }, { "ER_TOO_MANY_PARTITIONS_ERROR", 1499, "Too many partitions (including subpartitions) were defined" }, { "ER_SUBPARTITION_ERROR", 1500, "It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning" }, { "ER_CANT_CREATE_HANDLER_FILE", 1501, "Failed to create specific handler file" }, { "ER_BLOB_FIELD_IN_PART_FUNC_ERROR", 1502, "A BLOB field is not allowed in partition function" }, { "ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF", 1503, "A %-.192s must include all columns in the table\'s partitioning function" }, { "ER_NO_PARTS_ERROR", 1504, "Number of %-.64s = 0 is not an allowed value" }, { "ER_PARTITION_MGMT_ON_NONPARTITIONED", 1505, "Partition management on a not partitioned table is not possible" }, { "ER_FOREIGN_KEY_ON_PARTITIONED", 1506, "Foreign keys are not yet supported in conjunction with partitioning" }, { "ER_DROP_PARTITION_NON_EXISTENT", 1507, "Error in list of partitions to %-.64s" }, { "ER_DROP_LAST_PARTITION", 1508, "Cannot remove all partitions, use DROP TABLE instead" }, { "ER_COALESCE_ONLY_ON_HASH_PARTITION", 1509, "COALESCE PARTITION can only be used on HASH/KEY partitions" }, { "ER_REORG_HASH_ONLY_ON_SAME_NO", 1510, "REORGANIZE PARTITION can only be used to reorganize partitions not to change their numbers" }, { "ER_REORG_NO_PARAM_ERROR", 1511, "REORGANIZE PARTITION without parameters can only be used on auto-partitioned tables using HASH PARTITIONs" }, { "ER_ONLY_ON_RANGE_LIST_PARTITION", 1512, "%-.64s PARTITION can only be used on RANGE/LIST partitions" }, { "ER_ADD_PARTITION_SUBPART_ERROR", 1513, "Trying to Add partition(s) with wrong number of subpartitions" }, { "ER_ADD_PARTITION_NO_NEW_PARTITION", 1514, "At least one partition must be added" }, { "ER_COALESCE_PARTITION_NO_PARTITION", 1515, "At least one partition must be coalesced" }, { "ER_REORG_PARTITION_NOT_EXIST", 1516, "More partitions to reorganize than there are partitions" }, { "ER_SAME_NAME_PARTITION", 1517, "Duplicate partition name %-.192s" }, { "ER_NO_BINLOG_ERROR", 1518, "It is not allowed to shut off binlog on this command" }, { "ER_CONSECUTIVE_REORG_PARTITIONS", 1519, "When reorganizing a set of partitions they must be in consecutive order" }, { "ER_REORG_OUTSIDE_RANGE", 1520, "Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range" }, { "ER_PARTITION_FUNCTION_FAILURE", 1521, "Partition function not supported in this version for this handler" }, { "ER_PART_STATE_ERROR", 1522, "Partition state cannot be defined from CREATE/ALTER TABLE" }, { "ER_LIMITED_PART_RANGE", 1523, "The %-.64s handler only supports 32 bit integers in VALUES" }, { "ER_PLUGIN_IS_NOT_LOADED", 1524, "Plugin \'%-.192s\' is not loaded" }, { "ER_WRONG_VALUE", 1525, "Incorrect %-.32s value: \'%-.128s\'" }, { "ER_NO_PARTITION_FOR_GIVEN_VALUE", 1526, "Table has no partition for value %-.64s" }, { "ER_FILEGROUP_OPTION_ONLY_ONCE", 1527, "It is not allowed to specify %s more than once" }, { "ER_CREATE_FILEGROUP_FAILED", 1528, "Failed to create %s" }, { "ER_DROP_FILEGROUP_FAILED", 1529, "Failed to drop %s" }, { "ER_TABLESPACE_AUTO_EXTEND_ERROR", 1530, "The handler doesn\'t support autoextend of tablespaces" }, { "ER_WRONG_SIZE_NUMBER", 1531, "A size parameter was incorrectly specified, either number or on the form 10M" }, { "ER_SIZE_OVERFLOW_ERROR", 1532, "The size number was correct but we don\'t allow the digit part to be more than 2 billion" }, { "ER_ALTER_FILEGROUP_FAILED", 1533, "Failed to alter: %s" }, { "ER_BINLOG_ROW_LOGGING_FAILED", 1534, "Writing one row to the row-based binary log failed" }, { "ER_BINLOG_ROW_WRONG_TABLE_DEF", 1535, "Table definition on master and slave does not match: %s" }, { "ER_BINLOG_ROW_RBR_TO_SBR", 1536, "Slave running with --log-slave-updates must use row-based binary logging to be able to replicate row-based binary log events" }, { "ER_EVENT_ALREADY_EXISTS", 1537, "Event \'%-.192s\' already exists" }, { "ER_EVENT_STORE_FAILED", 1538, "Failed to store event %s. Error code %d from storage engine." }, { "ER_EVENT_DOES_NOT_EXIST", 1539, "Unknown event \'%-.192s\'" }, { "ER_EVENT_CANT_ALTER", 1540, "Failed to alter event \'%-.192s\'" }, { "ER_EVENT_DROP_FAILED", 1541, "Failed to drop %s" }, { "ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG", 1542, "INTERVAL is either not positive or too big" }, { "ER_EVENT_ENDS_BEFORE_STARTS", 1543, "ENDS is either invalid or before STARTS" }, { "ER_EVENT_EXEC_TIME_IN_THE_PAST", 1544, "Event execution time is in the past. Event has been disabled" }, { "ER_EVENT_OPEN_TABLE_FAILED", 1545, "Failed to open mysql.event" }, { "ER_EVENT_NEITHER_M_EXPR_NOR_M_AT", 1546, "No datetime expression provided" }, { "ER_OBSOLETE_COL_COUNT_DOESNT_MATCH_CORRUPTED", 1547, "Column count of mysql.%s is wrong. Expected %d, found %d. The table is probably corrupted" }, { "ER_OBSOLETE_CANNOT_LOAD_FROM_TABLE", 1548, "Cannot load from mysql.%s. The table is probably corrupted" }, { "ER_EVENT_CANNOT_DELETE", 1549, "Failed to delete the event from mysql.event" }, { "ER_EVENT_COMPILE_ERROR", 1550, "Error during compilation of event\'s body" }, { "ER_EVENT_SAME_NAME", 1551, "Same old and new event name" }, { "ER_EVENT_DATA_TOO_LONG", 1552, "Data for column \'%s\' too long" }, { "ER_DROP_INDEX_FK", 1553, "Cannot drop index \'%-.192s\': needed in a foreign key constraint" }, { "ER_WARN_DEPRECATED_SYNTAX_WITH_VER", 1554, "The syntax \'%s\' is deprecated and will be removed in MySQL %s. Please use %s instead" }, { "ER_CANT_WRITE_LOCK_LOG_TABLE", 1555, "You can\'t write-lock a log table. Only read access is possible" }, { "ER_CANT_LOCK_LOG_TABLE", 1556, "You can\'t use locks with log tables." }, { "ER_FOREIGN_DUPLICATE_KEY_OLD_UNUSED", 1557, "Upholding foreign key constraints for table \'%.192s\', entry \'%-.192s\', key %d would lead to a duplicate entry" }, { "ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE", 1558, "Column count of mysql.%s is wrong. Expected %d, found %d. Created with MySQL %d, now running %d. Please use mysql_upgrade to fix this error." }, { "ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR", 1559, "Cannot switch out of the row-based binary log format when the session has open temporary tables" }, { "ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT", 1560, "Cannot change the binary logging format inside a stored function or trigger" }, { "ER_NDB_CANT_SWITCH_BINLOG_FORMAT", 1561, "The NDB cluster engine does not support changing the binlog format on the fly yet" }, { "ER_PARTITION_NO_TEMPORARY", 1562, "Cannot create temporary table with partitions" }, { "ER_PARTITION_CONST_DOMAIN_ERROR", 1563, "Partition constant is out of partition function domain" }, { "ER_PARTITION_FUNCTION_IS_NOT_ALLOWED", 1564, "This partition function is not allowed" }, { "ER_DDL_LOG_ERROR", 1565, "Error in DDL log" }, { "ER_NULL_IN_VALUES_LESS_THAN", 1566, "Not allowed to use NULL value in VALUES LESS THAN" }, { "ER_WRONG_PARTITION_NAME", 1567, "Incorrect partition name" }, { "ER_CANT_CHANGE_TX_CHARACTERISTICS", 1568, "Transaction characteristics can\'t be changed while a transaction is in progress" }, { "ER_DUP_ENTRY_AUTOINCREMENT_CASE", 1569, "ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry \'%-.192s\' for key \'%-.192s\'" }, { "ER_EVENT_MODIFY_QUEUE_ERROR", 1570, "Internal scheduler error %d" }, { "ER_EVENT_SET_VAR_ERROR", 1571, "Error during starting/stopping of the scheduler. Error code %u" }, { "ER_PARTITION_MERGE_ERROR", 1572, "Engine cannot be used in partitioned tables" }, { "ER_CANT_ACTIVATE_LOG", 1573, "Cannot activate \'%-.64s\' log" }, { "ER_RBR_NOT_AVAILABLE", 1574, "The server was not built with row-based replication" }, { "ER_BASE64_DECODE_ERROR", 1575, "Decoding of base64 string failed" }, { "ER_EVENT_RECURSION_FORBIDDEN", 1576, "Recursion of EVENT DDL statements is forbidden when body is present" }, { "ER_EVENTS_DB_ERROR", 1577, "Cannot proceed because system tables used by Event Scheduler were found damaged at server start" }, { "ER_ONLY_INTEGERS_ALLOWED", 1578, "Only integers allowed as number here" }, { "ER_UNSUPORTED_LOG_ENGINE", 1579, "This storage engine cannot be used for log tables\"" }, { "ER_BAD_LOG_STATEMENT", 1580, "You cannot \'%s\' a log table if logging is enabled" }, { "ER_CANT_RENAME_LOG_TABLE", 1581, "Cannot rename \'%s\'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to \'%s\'" }, { "ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT", 1582, "Incorrect parameter count in the call to native function \'%-.192s\'" }, { "ER_WRONG_PARAMETERS_TO_NATIVE_FCT", 1583, "Incorrect parameters in the call to native function \'%-.192s\'" }, { "ER_WRONG_PARAMETERS_TO_STORED_FCT", 1584, "Incorrect parameters in the call to stored function %-.192s" }, { "ER_NATIVE_FCT_NAME_COLLISION", 1585, "This function \'%-.192s\' has the same name as a native function" }, { "ER_DUP_ENTRY_WITH_KEY_NAME", 1586, "Duplicate entry \'%-.64s\' for key \'%-.192s\'" }, { "ER_BINLOG_PURGE_EMFILE", 1587, "Too many files opened, please execute the command again" }, { "ER_EVENT_CANNOT_CREATE_IN_THE_PAST", 1588, "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation." }, { "ER_EVENT_CANNOT_ALTER_IN_THE_PAST", 1589, "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future." }, { "ER_SLAVE_INCIDENT", 1590, "The incident %s occured on the master. Message: %s" }, { "ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT", 1591, "Table has no partition for some existing values" }, { "ER_BINLOG_UNSAFE_STATEMENT", 1592, "Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. %s" }, { "ER_SLAVE_FATAL_ERROR", 1593, "Fatal error: %s" }, { "ER_SLAVE_RELAY_LOG_READ_FAILURE", 1594, "Relay log read failure: %s" }, { "ER_SLAVE_RELAY_LOG_WRITE_FAILURE", 1595, "Relay log write failure: %s" }, { "ER_SLAVE_CREATE_EVENT_FAILURE", 1596, "Failed to create %s" }, { "ER_SLAVE_MASTER_COM_FAILURE", 1597, "Master command %s failed: %s" }, { "ER_BINLOG_LOGGING_IMPOSSIBLE", 1598, "Binary logging not possible. Message: %s" }, { "ER_VIEW_NO_CREATION_CTX", 1599, "View `%-.64s`.`%-.64s` has no creation context" }, { "ER_VIEW_INVALID_CREATION_CTX", 1600, "Creation context of view `%-.64s`.`%-.64s\' is invalid" }, { "ER_SR_INVALID_CREATION_CTX", 1601, "Creation context of stored routine `%-.64s`.`%-.64s` is invalid" }, { "ER_TRG_CORRUPTED_FILE", 1602, "Corrupted TRG file for table `%-.64s`.`%-.64s`" }, { "ER_TRG_NO_CREATION_CTX", 1603, "Triggers for table `%-.64s`.`%-.64s` have no creation context" }, { "ER_TRG_INVALID_CREATION_CTX", 1604, "Trigger creation context of table `%-.64s`.`%-.64s` is invalid" }, { "ER_EVENT_INVALID_CREATION_CTX", 1605, "Creation context of event `%-.64s`.`%-.64s` is invalid" }, { "ER_TRG_CANT_OPEN_TABLE", 1606, "Cannot open table for trigger `%-.64s`.`%-.64s`" }, { "ER_CANT_CREATE_SROUTINE", 1607, "Cannot create stored routine `%-.64s`. Check warnings" }, { "ER_NEVER_USED", 1608, "Ambiguous slave modes combination. %s" }, { "ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT", 1609, "The BINLOG statement of type `%s` was not preceded by a format description BINLOG statement." }, { "ER_SLAVE_CORRUPT_EVENT", 1610, "Corrupted replication event was detected" }, { "ER_LOAD_DATA_INVALID_COLUMN_UNUSED", 1611, "Invalid column reference (%-.64s) in LOAD DATA" }, { "ER_LOG_PURGE_NO_FILE", 1612, "Being purged log %s was not found" }, { "ER_XA_RBTIMEOUT", 1613, "XA_RBTIMEOUT: Transaction branch was rolled back: took too long" }, { "ER_XA_RBDEADLOCK", 1614, "XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected" }, { "ER_NEED_REPREPARE", 1615, "Prepared statement needs to be re-prepared" }, { "ER_DELAYED_NOT_SUPPORTED", 1616, "DELAYED option not supported for table \'%-.192s\'" }, { "WARN_NO_MASTER_INFO", 1617, "The master info structure does not exist" }, { "WARN_OPTION_IGNORED", 1618, "<%-.64s> option ignored" }, { "ER_PLUGIN_DELETE_BUILTIN", 1619, "Built-in plugins cannot be deleted" }, { "WARN_PLUGIN_BUSY", 1620, "Plugin is busy and will be uninstalled on shutdown" }, { "ER_VARIABLE_IS_READONLY", 1621, "%s variable \'%s\' is read-only. Use SET %s to assign the value" }, { "ER_WARN_ENGINE_TRANSACTION_ROLLBACK", 1622, "Storage engine %s does not support rollback for this statement. Transaction rolled back and must be restarted" }, { "ER_SLAVE_HEARTBEAT_FAILURE", 1623, "Unexpected master\'s heartbeat data: %s" }, { "ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE", 1624, "The requested value for the heartbeat period is either negative or exceeds the maximum allowed (%s seconds)." }, { "ER_NDB_REPLICATION_SCHEMA_ERROR", 1625, "Bad schema for mysql.ndb_replication table. Message: %-.64s" }, { "ER_CONFLICT_FN_PARSE_ERROR", 1626, "Error in parsing conflict function. Message: %-.64s" }, { "ER_EXCEPTIONS_WRITE_ERROR", 1627, "Write to exceptions table failed. Message: %-.128s\"" }, { "ER_TOO_LONG_TABLE_COMMENT", 1628, "Comment for table \'%-.64s\' is too long (max = %lu)" }, { "ER_TOO_LONG_FIELD_COMMENT", 1629, "Comment for field \'%-.64s\' is too long (max = %lu)" }, { "ER_FUNC_INEXISTENT_NAME_COLLISION", 1630, "FUNCTION %s does not exist. Check the \'Function Name Parsing and Resolution\' section in the Reference Manual" }, { "ER_DATABASE_NAME", 1631, "Database" }, { "ER_TABLE_NAME", 1632, "Table" }, { "ER_PARTITION_NAME", 1633, "Partition" }, { "ER_SUBPARTITION_NAME", 1634, "Subpartition" }, { "ER_TEMPORARY_NAME", 1635, "Temporary" }, { "ER_RENAMED_NAME", 1636, "Renamed" }, { "ER_TOO_MANY_CONCURRENT_TRXS", 1637, "Too many active concurrent transactions" }, { "WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED", 1638, "Non-ASCII separator arguments are not fully supported" }, { "ER_DEBUG_SYNC_TIMEOUT", 1639, "debug sync point wait timed out" }, { "ER_DEBUG_SYNC_HIT_LIMIT", 1640, "debug sync point hit limit reached" }, { "ER_DUP_SIGNAL_SET", 1641, "Duplicate condition information item \'%s\'" }, { "ER_SIGNAL_WARN", 1642, "Unhandled user-defined warning condition" }, { "ER_SIGNAL_NOT_FOUND", 1643, "Unhandled user-defined not found condition" }, { "ER_SIGNAL_EXCEPTION", 1644, "Unhandled user-defined exception condition" }, { "ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER", 1645, "RESIGNAL when handler not active" }, { "ER_SIGNAL_BAD_CONDITION_TYPE", 1646, "SIGNAL/RESIGNAL can only use a CONDITION defined with SQLSTATE" }, { "WARN_COND_ITEM_TRUNCATED", 1647, "Data truncated for condition item \'%s\'" }, { "ER_COND_ITEM_TOO_LONG", 1648, "Data too long for condition item \'%s\'" }, { "ER_UNKNOWN_LOCALE", 1649, "Unknown locale: \'%-.64s\'" }, { "ER_SLAVE_IGNORE_SERVER_IDS", 1650, "The requested server id %d clashes with the slave startup option --replicate-same-server-id" }, { "ER_QUERY_CACHE_DISABLED", 1651, "Query cache is disabled; restart the server with query_cache_type=1 to enable it" }, { "ER_SAME_NAME_PARTITION_FIELD", 1652, "Duplicate partition field name \'%-.192s\'" }, { "ER_PARTITION_COLUMN_LIST_ERROR", 1653, "Inconsistency in usage of column lists for partitioning" }, { "ER_WRONG_TYPE_COLUMN_VALUE_ERROR", 1654, "Partition column values of incorrect type" }, { "ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR", 1655, "Too many fields in \'%-.192s\'" }, { "ER_MAXVALUE_IN_VALUES_IN", 1656, "Cannot use MAXVALUE as value in VALUES IN" }, { "ER_TOO_MANY_VALUES_ERROR", 1657, "Cannot have more than one value for this type of %-.64s partitioning" }, { "ER_ROW_SINGLE_PARTITION_FIELD_ERROR", 1658, "Row expressions in VALUES IN only allowed for multi-field column partitioning" }, { "ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD", 1659, "Field \'%-.192s\' is of a not allowed type for this type of partitioning" }, { "ER_PARTITION_FIELDS_TOO_LONG", 1660, "The total length of the partitioning fields is too large" }, { "ER_BINLOG_ROW_ENGINE_AND_STMT_ENGINE", 1661, "Cannot execute statement: impossible to write to binary log since both row-incapable engines and statement-incapable engines are involved." }, { "ER_BINLOG_ROW_MODE_AND_STMT_ENGINE", 1662, "Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = ROW and at least one table uses a storage engine limited to statement-based logging." }, { "ER_BINLOG_UNSAFE_AND_STMT_ENGINE", 1663, "Cannot execute statement: impossible to write to binary log since statement is unsafe, storage engine is limited to statement-based logging, and BINLOG_FORMAT = MIXED. %s" }, { "ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE", 1664, "Cannot execute statement: impossible to write to binary log since statement is in row format and at least one table uses a storage engine limited to statement-based logging." }, { "ER_BINLOG_STMT_MODE_AND_ROW_ENGINE", 1665, "Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging.%s" }, { "ER_BINLOG_ROW_INJECTION_AND_STMT_MODE", 1666, "Cannot execute statement: impossible to write to binary log since statement is in row format and BINLOG_FORMAT = STATEMENT." }, { "ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE", 1667, "Cannot execute statement: impossible to write to binary log since more than one engine is involved and at least one engine is self-logging." }, { "ER_BINLOG_UNSAFE_LIMIT", 1668, "The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted." }, { "ER_UNUSED4", 1669, "The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted." }, { "ER_BINLOG_UNSAFE_SYSTEM_TABLE", 1670, "The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves." }, { "ER_BINLOG_UNSAFE_AUTOINC_COLUMNS", 1671, "Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly." }, { "ER_BINLOG_UNSAFE_UDF", 1672, "Statement is unsafe because it uses a UDF which may not return the same value on the slave." }, { "ER_BINLOG_UNSAFE_SYSTEM_VARIABLE", 1673, "Statement is unsafe because it uses a system variable that may have a different value on the slave." }, { "ER_BINLOG_UNSAFE_SYSTEM_FUNCTION", 1674, "Statement is unsafe because it uses a system function that may return a different value on the slave." }, { "ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS", 1675, "Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction." }, { "ER_MESSAGE_AND_STATEMENT", 1676, "%s Statement: %s" }, { "ER_SLAVE_CONVERSION_FAILED", 1677, "Column %d of table \'%-.192s.%-.192s\' cannot be converted from type \'%-.32s\' to type \'%-.32s\'" }, { "ER_SLAVE_CANT_CREATE_CONVERSION", 1678, "Can\'t create conversion table for table \'%-.192s.%-.192s\'" }, { "ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT", 1679, "Cannot modify @@session.binlog_format inside a transaction" }, { "ER_PATH_LENGTH", 1680, "The path specified for %.64s is too long." }, { "ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT", 1681, "\'%s\' is deprecated and will be removed in a future release." }, { "ER_WRONG_NATIVE_TABLE_STRUCTURE", 1682, "Native table \'%-.64s\'.\'%-.64s\' has the wrong structure" }, { "ER_WRONG_PERFSCHEMA_USAGE", 1683, "Invalid performance_schema usage." }, { "ER_WARN_I_S_SKIPPED_TABLE", 1684, "Table \'%s\'.\'%s\' was skipped since its definition is being modified by concurrent DDL statement" }, { "ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT", 1685, "Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction" }, { "ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT", 1686, "Cannot change the binlog direct flag inside a stored function or trigger" }, { "ER_SPATIAL_MUST_HAVE_GEOM_COL", 1687, "A SPATIAL index may only contain a geometrical type column" }, { "ER_TOO_LONG_INDEX_COMMENT", 1688, "Comment for index \'%-.64s\' is too long (max = %lu)" }, { "ER_LOCK_ABORTED", 1689, "Wait on a lock was aborted due to a pending exclusive lock" }, { "ER_DATA_OUT_OF_RANGE", 1690, "%s value is out of range in \'%s\'" }, { "ER_WRONG_SPVAR_TYPE_IN_LIMIT", 1691, "A variable of a non-integer based type in LIMIT clause" }, { "ER_BINLOG_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE", 1692, "Mixing self-logging and non-self-logging engines in a statement is unsafe." }, { "ER_BINLOG_UNSAFE_MIXED_STATEMENT", 1693, "Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them." }, { "ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN", 1694, "Cannot modify @@session.sql_log_bin inside a transaction" }, { "ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN", 1695, "Cannot change the sql_log_bin inside a stored function or trigger" }, { "ER_FAILED_READ_FROM_PAR_FILE", 1696, "Failed to read from the .par file" }, { "ER_VALUES_IS_NOT_INT_TYPE_ERROR", 1697, "VALUES value for partition \'%-.64s\' must have type INT" }, { "ER_ACCESS_DENIED_NO_PASSWORD_ERROR", 1698, "Access denied for user \'%-.48s\'@\'%-.64s\'" }, { "ER_SET_PASSWORD_AUTH_PLUGIN", 1699, "SET PASSWORD has no significance for users authenticating via plugins" }, { "ER_GRANT_PLUGIN_USER_EXISTS", 1700, "GRANT with IDENTIFIED WITH is illegal because the user %-.*s already exists" }, { "ER_TRUNCATE_ILLEGAL_FK", 1701, "Cannot truncate a table referenced in a foreign key constraint (%.192s)" }, { "ER_PLUGIN_IS_PERMANENT", 1702, "Plugin \'%s\' is force_plus_permanent and can not be unloaded" }, { "ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN", 1703, "The requested value for the heartbeat period is less than 1 millisecond. The value is reset to 0, meaning that heartbeating will effectively be disabled." }, { "ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX", 1704, "The requested value for the heartbeat period exceeds the value of `slave_net_timeout\' seconds. A sensible value for the period should be less than the timeout." }, { "ER_STMT_CACHE_FULL", 1705, "Multi-row statements required more than \'max_binlog_stmt_cache_size\' bytes of storage; increase this mysqld variable and try again" }, { "ER_MULTI_UPDATE_KEY_CONFLICT", 1706, "Primary key/partition key update is not allowed since the table is updated both as \'%-.192s\' and \'%-.192s\'." }, { "ER_TABLE_NEEDS_REBUILD", 1707, "Table rebuild required. Please do \"ALTER TABLE `%-.64s` FORCE\" or dump/reload to fix it!" }, { "WARN_OPTION_BELOW_LIMIT", 1708, "The value of \'%s\' should be no less than the value of \'%s\'" }, { "ER_INDEX_COLUMN_TOO_LONG", 1709, "Index column size too large. The maximum column size is %lu bytes." }, { "ER_ERROR_IN_TRIGGER_BODY", 1710, "Trigger \'%-.64s\' has an error in its body: \'%-.256s\'" }, { "ER_ERROR_IN_UNKNOWN_TRIGGER_BODY", 1711, "Unknown trigger has an error in its body: \'%-.256s\'" }, { "ER_INDEX_CORRUPT", 1712, "Index %s is corrupted" }, { "ER_UNDO_RECORD_TOO_BIG", 1713, "Undo log record is too big." }, { "ER_BINLOG_UNSAFE_INSERT_IGNORE_SELECT", 1714, "INSERT IGNORE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave." }, { "ER_BINLOG_UNSAFE_INSERT_SELECT_UPDATE", 1715, "INSERT... SELECT... ON DUPLICATE KEY UPDATE is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are updated. This order cannot be predicted and may differ on master and the slave." }, { "ER_BINLOG_UNSAFE_REPLACE_SELECT", 1716, "REPLACE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave." }, { "ER_BINLOG_UNSAFE_CREATE_IGNORE_SELECT", 1717, "CREATE... IGNORE SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave." }, { "ER_BINLOG_UNSAFE_CREATE_REPLACE_SELECT", 1718, "CREATE... REPLACE SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave." }, { "ER_BINLOG_UNSAFE_UPDATE_IGNORE", 1719, "UPDATE IGNORE is unsafe because the order in which rows are updated determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave." }, { "ER_PLUGIN_NO_UNINSTALL", 1720, "Plugin \'%s\' is marked as not dynamically uninstallable. You have to stop the server to uninstall it." }, { "ER_PLUGIN_NO_INSTALL", 1721, "Plugin \'%s\' is marked as not dynamically installable. You have to stop the server to install it." }, { "ER_BINLOG_UNSAFE_WRITE_AUTOINC_SELECT", 1722, "Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave." }, { "ER_BINLOG_UNSAFE_CREATE_SELECT_AUTOINC", 1723, "CREATE TABLE... SELECT... on a table with an auto-increment column is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are inserted. This order cannot be predicted and may differ on master and the slave." }, { "ER_BINLOG_UNSAFE_INSERT_TWO_KEYS", 1724, "INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe" }, { "ER_TABLE_IN_FK_CHECK", 1725, "Table is being used in foreign key check." }, { "ER_UNSUPPORTED_ENGINE", 1726, "Storage engine \'%s\' does not support system tables. [%s.%s]" }, { "ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST", 1727, "INSERT into autoincrement field which is not the first part in the composed primary key is unsafe." }, { "ER_CANNOT_LOAD_FROM_TABLE_V2", 1728, "Cannot load from %s.%s. The table is probably corrupted" }, { "ER_MASTER_DELAY_VALUE_OUT_OF_RANGE", 1729, "The requested value %s for the master delay exceeds the maximum %u" }, { "ER_ONLY_FD_AND_RBR_EVENTS_ALLOWED_IN_BINLOG_STATEMENT", 1730, "Only Format_description_log_event and row events are allowed in BINLOG statements (but %s was provided)" }, { "ER_PARTITION_EXCHANGE_DIFFERENT_OPTION", 1731, "Non matching attribute \'%-.64s\' between partition and table" }, { "ER_PARTITION_EXCHANGE_PART_TABLE", 1732, "Table to exchange with partition is partitioned: \'%-.64s\'" }, { "ER_PARTITION_EXCHANGE_TEMP_TABLE", 1733, "Table to exchange with partition is temporary: \'%-.64s\'" }, { "ER_PARTITION_INSTEAD_OF_SUBPARTITION", 1734, "Subpartitioned table, use subpartition instead of partition" }, { "ER_UNKNOWN_PARTITION", 1735, "Unknown partition \'%-.64s\' in table \'%-.64s\'" }, { "ER_TABLES_DIFFERENT_METADATA", 1736, "Tables have different definitions" }, { "ER_ROW_DOES_NOT_MATCH_PARTITION", 1737, "Found a row that does not match the partition" }, { "ER_BINLOG_CACHE_SIZE_GREATER_THAN_MAX", 1738, "Option binlog_cache_size (%lu) is greater than max_binlog_cache_size (%lu); setting binlog_cache_size equal to max_binlog_cache_size." }, { "ER_WARN_INDEX_NOT_APPLICABLE", 1739, "Cannot use %-.64s access on index \'%-.64s\' due to type or collation conversion on field \'%-.64s\'" }, { "ER_PARTITION_EXCHANGE_FOREIGN_KEY", 1740, "Table to exchange with partition has foreign key references: \'%-.64s\'" }, { "ER_NO_SUCH_KEY_VALUE", 1741, "Key value \'%-.192s\' was not found in table \'%-.192s.%-.192s\'" }, { "ER_RPL_INFO_DATA_TOO_LONG", 1742, "Data for column \'%s\' too long" }, { "ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE", 1743, "Replication event checksum verification failed while reading from network." }, { "ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE", 1744, "Replication event checksum verification failed while reading from a log file." }, { "ER_BINLOG_STMT_CACHE_SIZE_GREATER_THAN_MAX", 1745, "Option binlog_stmt_cache_size (%lu) is greater than max_binlog_stmt_cache_size (%lu); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size." }, { "ER_CANT_UPDATE_TABLE_IN_CREATE_TABLE_SELECT", 1746, "Can\'t update table \'%-.192s\' while \'%-.192s\' is being created." }, { "ER_PARTITION_CLAUSE_ON_NONPARTITIONED", 1747, "PARTITION () clause on non partitioned table" }, { "ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET", 1748, "Found a row not matching the given partition set" }, { "ER_NO_SUCH_PARTITION__UNUSED", 1749, "partition \'%-.64s\' doesn\'t exist" }, { "ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE", 1750, "Failure while changing the type of replication repository: %s." }, { "ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_CREATED_TEMP_TABLE", 1751, "The creation of some temporary tables could not be rolled back." }, { "ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_DROPPED_TEMP_TABLE", 1752, "Some temporary tables were dropped, but these operations could not be rolled back." }, { "ER_MTS_FEATURE_IS_NOT_SUPPORTED", 1753, "%s is not supported in multi-threaded slave mode. %s" }, { "ER_MTS_UPDATED_DBS_GREATER_MAX", 1754, "The number of modified databases exceeds the maximum %d; the database names will not be included in the replication event metadata." }, { "ER_MTS_CANT_PARALLEL", 1755, "Cannot execute the current event group in the parallel mode. Encountered event %s, relay-log name %s, position %s which prevents execution of this event group in parallel mode. Reason: %s." }, { "ER_MTS_INCONSISTENT_DATA", 1756, "%s" }, { "ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING", 1757, "FULLTEXT index is not supported for partitioned tables." }, { "ER_DA_INVALID_CONDITION_NUMBER", 1758, "Invalid condition number" }, { "ER_INSECURE_PLAIN_TEXT", 1759, "Sending passwords in plain text without SSL/TLS is extremely insecure." }, { "ER_INSECURE_CHANGE_MASTER", 1760, "Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the \'START SLAVE Syntax\' in the MySQL Manual for more information." }, { "ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO", 1761, "Foreign key constraint for table \'%.192s\', record \'%-.192s\' would lead to a duplicate entry in table \'%.192s\', key \'%.192s\'" }, { "ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO", 1762, "Foreign key constraint for table \'%.192s\', record \'%-.192s\' would lead to a duplicate entry in a child table" }, { "ER_SQLTHREAD_WITH_SECURE_SLAVE", 1763, "Setting authentication options is not possible when only the Slave SQL Thread is being started." }, { "ER_TABLE_HAS_NO_FT", 1764, "The table does not have FULLTEXT index to support this query" }, { "ER_VARIABLE_NOT_SETTABLE_IN_SF_OR_TRIGGER", 1765, "The system variable %.200s cannot be set in stored functions or triggers." }, { "ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION", 1766, "The system variable %.200s cannot be set when there is an ongoing transaction." }, { "ER_GTID_NEXT_IS_NOT_IN_GTID_NEXT_LIST", 1767, "The system variable @@SESSION.GTID_NEXT has the value %.200s, which is not listed in @@SESSION.GTID_NEXT_LIST." }, { "ER_CANT_CHANGE_GTID_NEXT_IN_TRANSACTION", 1768, "The system variable @@SESSION.GTID_NEXT cannot change inside a transaction." }, { "ER_SET_STATEMENT_CANNOT_INVOKE_FUNCTION", 1769, "The statement \'SET %.200s\' cannot invoke a stored function." }, { "ER_GTID_NEXT_CANT_BE_AUTOMATIC_IF_GTID_NEXT_LIST_IS_NON_NULL", 1770, "The system variable @@SESSION.GTID_NEXT cannot be \'AUTOMATIC\' when @@SESSION.GTID_NEXT_LIST is non-NULL." }, { "ER_SKIPPING_LOGGED_TRANSACTION", 1771, "Skipping transaction %.200s because it has already been executed and logged." }, { "ER_MALFORMED_GTID_SET_SPECIFICATION", 1772, "Malformed GTID set specification \'%.200s\'." }, { "ER_MALFORMED_GTID_SET_ENCODING", 1773, "Malformed GTID set encoding." }, { "ER_MALFORMED_GTID_SPECIFICATION", 1774, "Malformed GTID specification \'%.200s\'." }, { "ER_GNO_EXHAUSTED", 1775, "Impossible to generate Global Transaction Identifier: the integer component reached the maximal value. Restart the server with a new server_uuid." }, { "ER_BAD_SLAVE_AUTO_POSITION", 1776, "Parameters MASTER_LOG_FILE, MASTER_LOG_POS, RELAY_LOG_FILE and RELAY_LOG_POS cannot be set when MASTER_AUTO_POSITION is active." }, { "ER_AUTO_POSITION_REQUIRES_GTID_MODE_NOT_OFF", 1777, "CHANGE MASTER TO MASTER_AUTO_POSITION = 1 cannot be executed because @@GLOBAL.GTID_MODE = OFF." }, { "ER_CANT_DO_IMPLICIT_COMMIT_IN_TRX_WHEN_GTID_NEXT_IS_SET", 1778, "Cannot execute statements with implicit commit inside a transaction when @@SESSION.GTID_NEXT == \'UUID:NUMBER\'." }, { "ER_GTID_MODE_ON_REQUIRES_ENFORCE_GTID_CONSISTENCY_ON", 1779, "GTID_MODE = ON requires ENFORCE_GTID_CONSISTENCY = ON." }, { "ER_GTID_MODE_REQUIRES_BINLOG", 1780, "@@GLOBAL.GTID_MODE = ON or ON_PERMISSIVE or OFF_PERMISSIVE requires --log-bin and --log-slave-updates." }, { "ER_CANT_SET_GTID_NEXT_TO_GTID_WHEN_GTID_MODE_IS_OFF", 1781, "@@SESSION.GTID_NEXT cannot be set to UUID:NUMBER when @@GLOBAL.GTID_MODE = OFF." }, { "ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON", 1782, "@@SESSION.GTID_NEXT cannot be set to ANONYMOUS when @@GLOBAL.GTID_MODE = ON." }, { "ER_CANT_SET_GTID_NEXT_LIST_TO_NON_NULL_WHEN_GTID_MODE_IS_OFF", 1783, "@@SESSION.GTID_NEXT_LIST cannot be set to a non-NULL value when @@GLOBAL.GTID_MODE = OFF." }, { "ER_FOUND_GTID_EVENT_WHEN_GTID_MODE_IS_OFF__UNUSED", 1784, "Found a Gtid_log_event when @@GLOBAL.GTID_MODE = OFF." }, { "ER_GTID_UNSAFE_NON_TRANSACTIONAL_TABLE", 1785, "Statement violates GTID consistency: Updates to non-transactional tables can only be done in either autocommitted statements or single-statement transactions, and never in the same statement as updates to transactional tables." }, { "ER_GTID_UNSAFE_CREATE_SELECT", 1786, "Statement violates GTID consistency: CREATE TABLE ... SELECT." }, { "ER_GTID_UNSAFE_CREATE_DROP_TEMPORARY_TABLE_IN_TRANSACTION", 1787, "Statement violates GTID consistency: Under statement binary log mode CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE can only be executed outside transactional context. These statements are also not allowed in a function or trigger because functions and triggers are also considered to be multi-statement transactions." }, { "ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME", 1788, "The value of @@GLOBAL.GTID_MODE can only be changed one step at a time: OFF <-> OFF_PERMISSIVE <-> ON_PERMISSIVE <-> ON. Also note that this value must be stepped up or down simultaneously on all servers. See the Manual for instructions." }, { "ER_MASTER_HAS_PURGED_REQUIRED_GTIDS", 1789, "The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires." }, { "ER_CANT_SET_GTID_NEXT_WHEN_OWNING_GTID", 1790, "@@SESSION.GTID_NEXT cannot be changed by a client that owns a GTID. The client owns %s. Ownership is released on COMMIT or ROLLBACK." }, { "ER_UNKNOWN_EXPLAIN_FORMAT", 1791, "Unknown EXPLAIN format name: \'%s\'" }, { "ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION", 1792, "Cannot execute statement in a READ ONLY transaction." }, { "ER_TOO_LONG_TABLE_PARTITION_COMMENT", 1793, "Comment for table partition \'%-.64s\' is too long (max = %lu)" }, { "ER_SLAVE_CONFIGURATION", 1794, "Slave is not configured or failed to initialize properly. You must at least set --server-id to enable either a master or a slave. Additional error messages can be found in the MySQL error log." }, { "ER_INNODB_FT_LIMIT", 1795, "InnoDB presently supports one FULLTEXT index creation at a time" }, { "ER_INNODB_NO_FT_TEMP_TABLE", 1796, "Cannot create FULLTEXT index on temporary InnoDB table" }, { "ER_INNODB_FT_WRONG_DOCID_COLUMN", 1797, "Column \'%-.192s\' is of wrong type for an InnoDB FULLTEXT index" }, { "ER_INNODB_FT_WRONG_DOCID_INDEX", 1798, "Index \'%-.192s\' is of wrong type for an InnoDB FULLTEXT index" }, { "ER_INNODB_ONLINE_LOG_TOO_BIG", 1799, "Creating index \'%-.192s\' required more than \'innodb_online_alter_log_max_size\' bytes of modification log. Please try again." }, { "ER_UNKNOWN_ALTER_ALGORITHM", 1800, "Unknown ALGORITHM \'%s\'" }, { "ER_UNKNOWN_ALTER_LOCK", 1801, "Unknown LOCK type \'%s\'" }, { "ER_MTS_CHANGE_MASTER_CANT_RUN_WITH_GAPS", 1802, "CHANGE MASTER cannot be executed when the slave was stopped with an error or killed in MTS mode. Consider using RESET SLAVE or START SLAVE UNTIL." }, { "ER_MTS_RECOVERY_FAILURE", 1803, "Cannot recover after SLAVE errored out in parallel execution mode. Additional error messages can be found in the MySQL error log." }, { "ER_MTS_RESET_WORKERS", 1804, "Cannot clean up worker info tables. Additional error messages can be found in the MySQL error log." }, { "ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2", 1805, "Column count of %s.%s is wrong. Expected %d, found %d. The table is probably corrupted" }, { "ER_SLAVE_SILENT_RETRY_TRANSACTION", 1806, "Slave must silently retry current transaction" }, { "ER_DISCARD_FK_CHECKS_RUNNING", 1807, "There is a foreign key check running on table \'%-.192s\'. Cannot discard the table." }, { "ER_TABLE_SCHEMA_MISMATCH", 1808, "Schema mismatch (%s)" }, { "ER_TABLE_IN_SYSTEM_TABLESPACE", 1809, "Table \'%-.192s\' in system tablespace" }, { "ER_IO_READ_ERROR", 1810, "IO Read error: (%lu, %s) %s" }, { "ER_IO_WRITE_ERROR", 1811, "IO Write error: (%lu, %s) %s" }, { "ER_TABLESPACE_MISSING", 1812, "Tablespace is missing for table %s." }, { "ER_TABLESPACE_EXISTS", 1813, "Tablespace \'%-.192s\' exists." }, { "ER_TABLESPACE_DISCARDED", 1814, "Tablespace has been discarded for table \'%-.192s\'" }, { "ER_INTERNAL_ERROR", 1815, "Internal error: %s" }, { "ER_INNODB_IMPORT_ERROR", 1816, "ALTER TABLE %-.192s IMPORT TABLESPACE failed with error %lu : \'%s\'" }, { "ER_INNODB_INDEX_CORRUPT", 1817, "Index corrupt: %s" }, { "ER_INVALID_YEAR_COLUMN_LENGTH", 1818, "Supports only YEAR or YEAR(4) column." }, { "ER_NOT_VALID_PASSWORD", 1819, "Your password does not satisfy the current policy requirements" }, { "ER_MUST_CHANGE_PASSWORD", 1820, "You must reset your password using ALTER USER statement before executing this statement." }, { "ER_FK_NO_INDEX_CHILD", 1821, "Failed to add the foreign key constaint. Missing index for constraint \'%s\' in the foreign table \'%s\'" }, { "ER_FK_NO_INDEX_PARENT", 1822, "Failed to add the foreign key constaint. Missing index for constraint \'%s\' in the referenced table \'%s\'" }, { "ER_FK_FAIL_ADD_SYSTEM", 1823, "Failed to add the foreign key constraint \'%s\' to system tables" }, { "ER_FK_CANNOT_OPEN_PARENT", 1824, "Failed to open the referenced table \'%s\'" }, { "ER_FK_INCORRECT_OPTION", 1825, "Failed to add the foreign key constraint on table \'%s\'. Incorrect options in FOREIGN KEY constraint \'%s\'" }, { "ER_FK_DUP_NAME", 1826, "Duplicate foreign key constraint name \'%s\'" }, { "ER_PASSWORD_FORMAT", 1827, "The password hash doesn\'t have the expected format. Check if the correct password algorithm is being used with the PASSWORD() function." }, { "ER_FK_COLUMN_CANNOT_DROP", 1828, "Cannot drop column \'%-.192s\': needed in a foreign key constraint \'%-.192s\'" }, { "ER_FK_COLUMN_CANNOT_DROP_CHILD", 1829, "Cannot drop column \'%-.192s\': needed in a foreign key constraint \'%-.192s\' of table \'%-.192s\'" }, { "ER_FK_COLUMN_NOT_NULL", 1830, "Column \'%-.192s\' cannot be NOT NULL: needed in a foreign key constraint \'%-.192s\' SET NULL" }, { "ER_DUP_INDEX", 1831, "Duplicate index \'%-.64s\' defined on the table \'%-.64s.%-.64s\'. This is deprecated and will be disallowed in a future release." }, { "ER_FK_COLUMN_CANNOT_CHANGE", 1832, "Cannot change column \'%-.192s\': used in a foreign key constraint \'%-.192s\'" }, { "ER_FK_COLUMN_CANNOT_CHANGE_CHILD", 1833, "Cannot change column \'%-.192s\': used in a foreign key constraint \'%-.192s\' of table \'%-.192s\'" }, { "ER_UNUSED5", 1834, "Cannot delete rows from table which is parent in a foreign key constraint \'%-.192s\' of table \'%-.192s\'" }, { "ER_MALFORMED_PACKET", 1835, "Malformed communication packet." }, { "ER_READ_ONLY_MODE", 1836, "Running in read-only mode" }, { "ER_GTID_NEXT_TYPE_UNDEFINED_GROUP", 1837, "When @@SESSION.GTID_NEXT is set to a GTID, you must explicitly set it to a different value after a COMMIT or ROLLBACK. Please check GTID_NEXT variable manual page for detailed explanation. Current @@SESSION.GTID_NEXT is \'%s\'." }, { "ER_VARIABLE_NOT_SETTABLE_IN_SP", 1838, "The system variable %.200s cannot be set in stored procedures." }, { "ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF", 1839, "@@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_MODE = ON." }, { "ER_CANT_SET_GTID_PURGED_WHEN_GTID_EXECUTED_IS_NOT_EMPTY", 1840, "@@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is empty." }, { "ER_CANT_SET_GTID_PURGED_WHEN_OWNED_GTIDS_IS_NOT_EMPTY", 1841, "@@GLOBAL.GTID_PURGED can only be set when there are no ongoing transactions (not even in other clients)." }, { "ER_GTID_PURGED_WAS_CHANGED", 1842, "@@GLOBAL.GTID_PURGED was changed from \'%s\' to \'%s\'." }, { "ER_GTID_EXECUTED_WAS_CHANGED", 1843, "@@GLOBAL.GTID_EXECUTED was changed from \'%s\' to \'%s\'." }, { "ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES", 1844, "Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT, and both replicated and non replicated tables are written to." }, { "ER_ALTER_OPERATION_NOT_SUPPORTED", 1845, "%s is not supported for this operation. Try %s." }, { "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON", 1846, "%s is not supported. Reason: %s. Try %s." }, { "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COPY", 1847, "COPY algorithm requires a lock" }, { "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_PARTITION", 1848, "Partition specific operations do not yet support LOCK/ALGORITHM" }, { "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME", 1849, "Columns participating in a foreign key are renamed" }, { "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COLUMN_TYPE", 1850, "Cannot change column type INPLACE" }, { "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_CHECK", 1851, "Adding foreign keys needs foreign_key_checks=OFF" }, { "ER_UNUSED6", 1852, "Creating unique indexes with IGNORE requires COPY algorithm to remove duplicate rows" }, { "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOPK", 1853, "Dropping a primary key is not allowed without also adding a new primary key" }, { "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_AUTOINC", 1854, "Adding an auto-increment column requires a lock" }, { "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_HIDDEN_FTS", 1855, "Cannot replace hidden FTS_DOC_ID with a user-visible one" }, { "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_CHANGE_FTS", 1856, "Cannot drop or rename FTS_DOC_ID" }, { "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS", 1857, "Fulltext index creation requires a lock" }, { "ER_SQL_SLAVE_SKIP_COUNTER_NOT_SETTABLE_IN_GTID_MODE", 1858, "sql_slave_skip_counter can not be set when the server is running with @@GLOBAL.GTID_MODE = ON. Instead, for each transaction that you want to skip, generate an empty transaction with the same GTID as the transaction" }, { "ER_DUP_UNKNOWN_IN_INDEX", 1859, "Duplicate entry for key \'%-.192s\'" }, { "ER_IDENT_CAUSES_TOO_LONG_PATH", 1860, "Long database name and identifier for object resulted in path length exceeding %d characters. Path: \'%s\'." }, { "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL", 1861, "cannot silently convert NULL values, as required in this SQL_MODE" }, { "ER_MUST_CHANGE_PASSWORD_LOGIN", 1862, "Your password has expired. To log in you must change it using a client that supports expired passwords." }, { "ER_ROW_IN_WRONG_PARTITION", 1863, "Found a row in wrong partition %s" }, { "ER_MTS_EVENT_BIGGER_PENDING_JOBS_SIZE_MAX", 1864, "Cannot schedule event %s, relay-log name %s, position %s to Worker thread because its size %lu exceeds %lu of slave_pending_jobs_size_max." }, { "ER_INNODB_NO_FT_USES_PARSER", 1865, "Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table" }, { "ER_BINLOG_LOGICAL_CORRUPTION", 1866, "The binary log file \'%s\' is logically corrupted: %s" }, { "ER_WARN_PURGE_LOG_IN_USE", 1867, "file %s was not purged because it was being read by %d thread(s), purged only %d out of %d files." }, { "ER_WARN_PURGE_LOG_IS_ACTIVE", 1868, "file %s was not purged because it is the active log file." }, { "ER_AUTO_INCREMENT_CONFLICT", 1869, "Auto-increment value in UPDATE conflicts with internally generated values" }, { "WARN_ON_BLOCKHOLE_IN_RBR", 1870, "Row events are not logged for %s statements that modify BLACKHOLE tables in row format. Table(s): \'%-.192s\'" }, { "ER_SLAVE_MI_INIT_REPOSITORY", 1871, "Slave failed to initialize master info structure from the repository" }, { "ER_SLAVE_RLI_INIT_REPOSITORY", 1872, "Slave failed to initialize relay log info structure from the repository" }, { "ER_ACCESS_DENIED_CHANGE_USER_ERROR", 1873, "Access denied trying to change to user \'%-.48s\'@\'%-.64s\' (using password: %s). Disconnecting." }, { "ER_INNODB_READ_ONLY", 1874, "InnoDB is in read only mode." }, { "ER_STOP_SLAVE_SQL_THREAD_TIMEOUT", 1875, "STOP SLAVE command execution is incomplete: Slave SQL thread got the stop signal, thread is busy, SQL thread will stop once the current task is complete." }, { "ER_STOP_SLAVE_IO_THREAD_TIMEOUT", 1876, "STOP SLAVE command execution is incomplete: Slave IO thread got the stop signal, thread is busy, IO thread will stop once the current task is complete." }, { "ER_TABLE_CORRUPT", 1877, "Operation cannot be performed. The table \'%-.64s.%-.64s\' is missing, corrupt or contains bad data." }, { "ER_TEMP_FILE_WRITE_FAILURE", 1878, "Temporary file write failure." }, { "ER_INNODB_FT_AUX_NOT_HEX_ID", 1879, "Upgrade index name failed, please use create index(alter table) algorithm copy to rebuild index." }, { "ER_OLD_TEMPORALS_UPGRADED", 1880, "TIME/TIMESTAMP/DATETIME columns of old format have been upgraded to the new format." }, { "ER_INNODB_FORCED_RECOVERY", 1881, "Operation not allowed when innodb_forced_recovery > 0." }, { "ER_AES_INVALID_IV", 1882, "The initialization vector supplied to %s is too short. Must be at least %d bytes long" }, { "ER_PLUGIN_CANNOT_BE_UNINSTALLED", 1883, "Plugin \'%s\' cannot be uninstalled now. %s" }, { "ER_GTID_UNSAFE_BINLOG_SPLITTABLE_STATEMENT_AND_GTID_GROUP", 1884, "Cannot execute statement because it needs to be written to the binary log as multiple statements, and this is not allowed when @@SESSION.GTID_NEXT == \'UUID:NUMBER\'." }, { "ER_SLAVE_HAS_MORE_GTIDS_THAN_MASTER", 1885, "Slave has more GTIDs than the master has, using the master\'s SERVER_UUID. This may indicate that the end of the binary log was truncated or that the last binary log file was lost, e.g., after a power or disk failure when sync_binlog != 1. The master may or may not have rolled back transactions that were already replicated to the slave. Suggest to replicate any transactions that master has rolled back from slave to master, and/or commit empty transactions on master to account for transactions that have been committed on master but are not included in GTID_EXECUTED." }, { "ER_MISSING_KEY", 1886, "The table \'%s.%s\' does not have the necessary key(s) defined on it. Please check the table definition and create index(s) accordingly." }, { "ER_FILE_CORRUPT", 3000, "File %s is corrupted" }, { "ER_ERROR_ON_MASTER", 3001, "Query partially completed on the master (error on master: %d) and was aborted. There is a chance that your master is inconsistent at this point. If you are sure that your master is ok, run this query manually on the slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE;. Query:\'%s\'" }, { "ER_INCONSISTENT_ERROR", 3002, "Query caused different errors on master and slave. Error on master: message (format)=\'%s\' error code=%d; Error on slave:actual message=\'%s\', error code=%d. Default database:\'%s\'. Query:\'%s\'" }, { "ER_STORAGE_ENGINE_NOT_LOADED", 3003, "Storage engine for table \'%s\'.\'%s\' is not loaded." }, { "ER_GET_STACKED_DA_WITHOUT_ACTIVE_HANDLER", 3004, "GET STACKED DIAGNOSTICS when handler not active" }, { "ER_WARN_LEGACY_SYNTAX_CONVERTED", 3005, "%s is no longer supported. The statement was converted to %s." }, { "ER_BINLOG_UNSAFE_FULLTEXT_PLUGIN", 3006, "Statement is unsafe because it uses a fulltext parser plugin which may not return the same value on the slave." }, { "ER_CANNOT_DISCARD_TEMPORARY_TABLE", 3007, "Cannot DISCARD/IMPORT tablespace associated with temporary table" }, { "ER_FK_DEPTH_EXCEEDED", 3008, "Foreign key cascade delete/update exceeds max depth of %d." }, { "ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE_V2", 3009, "Column count of %s.%s is wrong. Expected %d, found %d. Created with MySQL %d, now running %d. Please use mysql_upgrade to fix this error." }, { "ER_WARN_TRIGGER_DOESNT_HAVE_CREATED", 3010, "Trigger %s.%s.%s does not have CREATED attribute." }, { "ER_REFERENCED_TRG_DOES_NOT_EXIST", 3011, "Referenced trigger \'%s\' for the given action time and event type does not exist." }, { "ER_EXPLAIN_NOT_SUPPORTED", 3012, "EXPLAIN FOR CONNECTION command is supported only for SELECT/UPDATE/INSERT/DELETE/REPLACE" }, { "ER_INVALID_FIELD_SIZE", 3013, "Invalid size for column \'%-.192s\'." }, { "ER_MISSING_HA_CREATE_OPTION", 3014, "Table storage engine \'%-.64s\' found required create option missing" }, { "ER_ENGINE_OUT_OF_MEMORY", 3015, "Out of memory in storage engine \'%-.64s\'." }, { "ER_PASSWORD_EXPIRE_ANONYMOUS_USER", 3016, "The password for anonymous user cannot be expired." }, { "ER_SLAVE_SQL_THREAD_MUST_STOP", 3017, "This operation cannot be performed with a running slave sql thread; run STOP SLAVE SQL_THREAD first" }, { "ER_NO_FT_MATERIALIZED_SUBQUERY", 3018, "Cannot create FULLTEXT index on materialized subquery" }, { "ER_INNODB_UNDO_LOG_FULL", 3019, "Undo Log error: %s" }, { "ER_INVALID_ARGUMENT_FOR_LOGARITHM", 3020, "Invalid argument for logarithm" }, { "ER_SLAVE_CHANNEL_IO_THREAD_MUST_STOP", 3021, "This operation cannot be performed with a running slave io thread; run STOP SLAVE IO_THREAD FOR CHANNEL \'%s\' first." }, { "ER_WARN_OPEN_TEMP_TABLES_MUST_BE_ZERO", 3022, "This operation may not be safe when the slave has temporary tables. The tables will be kept open until the server restarts or until the tables are deleted by any replicated DROP statement. Suggest to wait until slave_open_temp_tables = 0." }, { "ER_WARN_ONLY_MASTER_LOG_FILE_NO_POS", 3023, "CHANGE MASTER TO with a MASTER_LOG_FILE clause but no MASTER_LOG_POS clause may not be safe. The old position value may not be valid for the new binary log file." }, { "ER_QUERY_TIMEOUT", 3024, "Query execution was interrupted, maximum statement execution time exceeded" }, { "ER_NON_RO_SELECT_DISABLE_TIMER", 3025, "Select is not a read only statement, disabling timer" }, { "ER_DUP_LIST_ENTRY", 3026, "Duplicate entry \'%-.192s\'." }, { "ER_SQL_MODE_NO_EFFECT", 3027, "\'%s\' mode no longer has any effect. Use STRICT_ALL_TABLES or STRICT_TRANS_TABLES instead." }, { "ER_AGGREGATE_ORDER_FOR_UNION", 3028, "Expression #%u of ORDER BY contains aggregate function and applies to a UNION" }, { "ER_AGGREGATE_ORDER_NON_AGG_QUERY", 3029, "Expression #%u of ORDER BY contains aggregate function and applies to the result of a non-aggregated query" }, { "ER_SLAVE_WORKER_STOPPED_PREVIOUS_THD_ERROR", 3030, "Slave worker has stopped after at least one previous worker encountered an error when slave-preserve-commit-order was enabled. To preserve commit order, the last transaction executed by this thread has not been committed. When restarting the slave after fixing any failed threads, you should fix this worker as well." }, { "ER_DONT_SUPPORT_SLAVE_PRESERVE_COMMIT_ORDER", 3031, "slave_preserve_commit_order is not supported %s." }, { "ER_SERVER_OFFLINE_MODE", 3032, "The server is currently in offline mode" }, { "ER_GIS_DIFFERENT_SRIDS", 3033, "Binary geometry function %s given two geometries of different srids: %u and %u, which should have been identical." }, { "ER_GIS_UNSUPPORTED_ARGUMENT", 3034, "Calling geometry function %s with unsupported types of arguments." }, { "ER_GIS_UNKNOWN_ERROR", 3035, "Unknown GIS error occured in function %s." }, { "ER_GIS_UNKNOWN_EXCEPTION", 3036, "Unknown exception caught in GIS function %s." }, { "ER_GIS_INVALID_DATA", 3037, "Invalid GIS data provided to function %s." }, { "ER_BOOST_GEOMETRY_EMPTY_INPUT_EXCEPTION", 3038, "The geometry has no data in function %s." }, { "ER_BOOST_GEOMETRY_CENTROID_EXCEPTION", 3039, "Unable to calculate centroid because geometry is empty in function %s." }, { "ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION", 3040, "Geometry overlay calculation error: geometry data is invalid in function %s." }, { "ER_BOOST_GEOMETRY_TURN_INFO_EXCEPTION", 3041, "Geometry turn info calculation error: geometry data is invalid in function %s." }, { "ER_BOOST_GEOMETRY_SELF_INTERSECTION_POINT_EXCEPTION", 3042, "Analysis procedures of intersection points interrupted unexpectedly in function %s." }, { "ER_BOOST_GEOMETRY_UNKNOWN_EXCEPTION", 3043, "Unknown exception thrown in function %s." }, { "ER_STD_BAD_ALLOC_ERROR", 3044, "Memory allocation error: %-.256s in function %s." }, { "ER_STD_DOMAIN_ERROR", 3045, "Domain error: %-.256s in function %s." }, { "ER_STD_LENGTH_ERROR", 3046, "Length error: %-.256s in function %s." }, { "ER_STD_INVALID_ARGUMENT", 3047, "Invalid argument error: %-.256s in function %s." }, { "ER_STD_OUT_OF_RANGE_ERROR", 3048, "Out of range error: %-.256s in function %s." }, { "ER_STD_OVERFLOW_ERROR", 3049, "Overflow error error: %-.256s in function %s." }, { "ER_STD_RANGE_ERROR", 3050, "Range error: %-.256s in function %s." }, { "ER_STD_UNDERFLOW_ERROR", 3051, "Underflow error: %-.256s in function %s." }, { "ER_STD_LOGIC_ERROR", 3052, "Logic error: %-.256s in function %s." }, { "ER_STD_RUNTIME_ERROR", 3053, "Runtime error: %-.256s in function %s." }, { "ER_STD_UNKNOWN_EXCEPTION", 3054, "Unknown exception: %-.384s in function %s." }, { "ER_GIS_DATA_WRONG_ENDIANESS", 3055, "Geometry byte string must be little endian." }, { "ER_CHANGE_MASTER_PASSWORD_LENGTH", 3056, "The password provided for the replication user exceeds the maximum length of 32 characters" }, { "ER_USER_LOCK_WRONG_NAME", 3057, "Incorrect user-level lock name \'%-.192s\'." }, { "ER_USER_LOCK_DEADLOCK", 3058, "Deadlock found when trying to get user-level lock; try rolling back transaction/releasing locks and restarting lock acquisition." }, { "ER_REPLACE_INACCESSIBLE_ROWS", 3059, "REPLACE cannot be executed as it requires deleting rows that are not in the view" }, { "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS", 3060, "Do not support online operation on table with GIS index" }, { "ER_ILLEGAL_USER_VAR", 3061, "User variable name \'%-.100s\' is illegal" }, { "ER_GTID_MODE_OFF", 3062, "Cannot %s when GTID_MODE = OFF." }, { "ER_UNSUPPORTED_BY_REPLICATION_THREAD", 3063, "Cannot %s from a replication slave thread." }, { "ER_INCORRECT_TYPE", 3064, "Incorrect type for argument %s in function %s." }, { "ER_FIELD_IN_ORDER_NOT_SELECT", 3065, "Expression #%u of ORDER BY clause is not in SELECT list, references column \'%-.192s\' which is not in SELECT list; this is incompatible with %s" }, { "ER_AGGREGATE_IN_ORDER_NOT_SELECT", 3066, "Expression #%u of ORDER BY clause is not in SELECT list, contains aggregate function; this is incompatible with %s" }, { "ER_INVALID_RPL_WILD_TABLE_FILTER_PATTERN", 3067, "Supplied filter list contains a value which is not in the required format \'db_pattern.table_pattern\'" }, { "ER_NET_OK_PACKET_TOO_LARGE", 3068, "OK packet too large" }, { "ER_INVALID_JSON_DATA", 3069, "Invalid JSON data provided to function %s: %s" }, { "ER_INVALID_GEOJSON_MISSING_MEMBER", 3070, "Invalid GeoJSON data provided to function %s: Missing required member \'%s\'" }, { "ER_INVALID_GEOJSON_WRONG_TYPE", 3071, "Invalid GeoJSON data provided to function %s: Member \'%s\' must be of type \'%s\'" }, { "ER_INVALID_GEOJSON_UNSPECIFIED", 3072, "Invalid GeoJSON data provided to function %s" }, { "ER_DIMENSION_UNSUPPORTED", 3073, "Unsupported number of coordinate dimensions in function %s: Found %u, expected %u" }, { "ER_SLAVE_CHANNEL_DOES_NOT_EXIST", 3074, "Slave channel \'%s\' does not exist." }, { "ER_SLAVE_MULTIPLE_CHANNELS_HOST_PORT", 3075, "A slave channel \'%s\' already exists for the given host and port combination." }, { "ER_SLAVE_CHANNEL_NAME_INVALID_OR_TOO_LONG", 3076, "Couldn\'t create channel: Channel name is either invalid or too long." }, { "ER_SLAVE_NEW_CHANNEL_WRONG_REPOSITORY", 3077, "To have multiple channels, repository cannot be of type FILE; Please check the repository configuration and convert them to TABLE." }, { "ER_SLAVE_CHANNEL_DELETE", 3078, "Cannot delete slave info objects for channel \'%s\'." }, { "ER_SLAVE_MULTIPLE_CHANNELS_CMD", 3079, "Multiple channels exist on the slave. Please provide channel name as an argument." }, { "ER_SLAVE_MAX_CHANNELS_EXCEEDED", 3080, "Maximum number of replication channels allowed exceeded." }, { "ER_SLAVE_CHANNEL_MUST_STOP", 3081, "This operation cannot be performed with running replication threads; run STOP SLAVE FOR CHANNEL \'%s\' first" }, { "ER_SLAVE_CHANNEL_NOT_RUNNING", 3082, "This operation requires running replication threads; configure slave and run START SLAVE FOR CHANNEL \'%s\'" }, { "ER_SLAVE_CHANNEL_WAS_RUNNING", 3083, "Replication thread(s) for channel \'%s\' are already runnning." }, { "ER_SLAVE_CHANNEL_WAS_NOT_RUNNING", 3084, "Replication thread(s) for channel \'%s\' are already stopped." }, { "ER_SLAVE_CHANNEL_SQL_THREAD_MUST_STOP", 3085, "This operation cannot be performed with a running slave sql thread; run STOP SLAVE SQL_THREAD FOR CHANNEL \'%s\' first." }, { "ER_SLAVE_CHANNEL_SQL_SKIP_COUNTER", 3086, "When sql_slave_skip_counter > 0, it is not allowed to start more than one SQL thread by using \'START SLAVE [SQL_THREAD]\'. Value of sql_slave_skip_counter can only be used by one SQL thread at a time. Please use \'START SLAVE [SQL_THREAD] FOR CHANNEL\' to start the SQL thread which will use the value of sql_slave_skip_counter." }, { "ER_WRONG_FIELD_WITH_GROUP_V2", 3087, "Expression #%u of %s is not in GROUP BY clause and contains nonaggregated column \'%-.192s\' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by" }, { "ER_MIX_OF_GROUP_FUNC_AND_FIELDS_V2", 3088, "In aggregated query without GROUP BY, expression #%u of %s contains nonaggregated column \'%-.192s\'; this is incompatible with sql_mode=only_full_group_by" }, { "ER_WARN_DEPRECATED_SYSVAR_UPDATE", 3089, "Updating \'%s\' is deprecated. It will be made read-only in a future release." }, { "ER_WARN_DEPRECATED_SQLMODE", 3090, "Changing sql mode \'%s\' is deprecated. It will be removed in a future release." }, { "ER_CANNOT_LOG_PARTIAL_DROP_DATABASE_WITH_GTID", 3091, "DROP DATABASE failed; some tables may have been dropped but the database directory remains. The GTID has not been added to GTID_EXECUTED and the statement was not written to the binary log. Fix this as follows: (1) remove all files from the database directory %-.192s; (2) SET GTID_NEXT=\'%-.192s\'; (3) DROP DATABASE `%-.192s`." }, { "ER_GROUP_REPLICATION_CONFIGURATION", 3092, "The server is not configured properly to be an active member of the group. Please see more details on error log." }, { "ER_GROUP_REPLICATION_RUNNING", 3093, "The START GROUP_REPLICATION command failed since the group is already running." }, { "ER_GROUP_REPLICATION_APPLIER_INIT_ERROR", 3094, "The START GROUP_REPLICATION command failed as the applier module failed to start." }, { "ER_GROUP_REPLICATION_STOP_APPLIER_THREAD_TIMEOUT", 3095, "The STOP GROUP_REPLICATION command execution is incomplete: The applier thread got the stop signal while it was busy. The applier thread will stop once the current task is complete." }, { "ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR", 3096, "The START GROUP_REPLICATION command failed as there was an error when initializing the group communication layer." }, { "ER_GROUP_REPLICATION_COMMUNICATION_LAYER_JOIN_ERROR", 3097, "The START GROUP_REPLICATION command failed as there was an error when joining the communication group." }, { "ER_BEFORE_DML_VALIDATION_ERROR", 3098, "The table does not comply with the requirements by an external plugin." }, { "ER_PREVENTS_VARIABLE_WITHOUT_RBR", 3099, "Cannot change the value of variable %s without binary log format as ROW." }, { "ER_RUN_HOOK_ERROR", 3100, "Error on observer while running replication hook \'%s\'." }, { "ER_TRANSACTION_ROLLBACK_DURING_COMMIT", 3101, "Plugin instructed the server to rollback the current transaction." }, { "ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED", 3102, "Expression of generated column \'%s\' contains a disallowed function." }, { "ER_UNSUPPORTED_ALTER_INPLACE_ON_VIRTUAL_COLUMN", 3103, "INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions" }, { "ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN", 3104, "Cannot define foreign key with %s clause on a generated column." }, { "ER_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN", 3105, "The value specified for generated column \'%s\' in table \'%s\' is not allowed." }, { "ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN", 3106, "\'%s\' is not supported for generated columns." }, { "ER_GENERATED_COLUMN_NON_PRIOR", 3107, "Generated column can refer only to generated columns defined prior to it." }, { "ER_DEPENDENT_BY_GENERATED_COLUMN", 3108, "Column \'%s\' has a generated column dependency." }, { "ER_GENERATED_COLUMN_REF_AUTO_INC", 3109, "Generated column \'%s\' cannot refer to auto-increment column." }, { "ER_FEATURE_NOT_AVAILABLE", 3110, "The \'%-.64s\' feature is not available; you need to remove \'%-.64s\' or use MySQL built with \'%-.64s\'" }, { "ER_CANT_SET_GTID_MODE", 3111, "SET @@GLOBAL.GTID_MODE = %-.64s is not allowed because %-.384s." }, { "ER_CANT_USE_AUTO_POSITION_WITH_GTID_MODE_OFF", 3112, "The replication receiver thread%-.192s cannot start in AUTO_POSITION mode: this server uses @@GLOBAL.GTID_MODE = OFF." }, { "ER_CANT_REPLICATE_ANONYMOUS_WITH_AUTO_POSITION", 3113, "Cannot replicate anonymous transaction when AUTO_POSITION = 1, at file %.512s, position %lld." }, { "ER_CANT_REPLICATE_ANONYMOUS_WITH_GTID_MODE_ON", 3114, "Cannot replicate anonymous transaction when @@GLOBAL.GTID_MODE = ON, at file %.512s, position %lld." }, { "ER_CANT_REPLICATE_GTID_WITH_GTID_MODE_OFF", 3115, "Cannot replicate GTID-transaction when @@GLOBAL.GTID_MODE = OFF, at file %.512s, position %lld." }, { "ER_CANT_SET_ENFORCE_GTID_CONSISTENCY_ON_WITH_ONGOING_GTID_VIOLATING_TRANSACTIONS", 3116, "Cannot set ENFORCE_GTID_CONSISTENCY = ON because there are ongoing transactions that violate GTID consistency." }, { "ER_SET_ENFORCE_GTID_CONSISTENCY_WARN_WITH_ONGOING_GTID_VIOLATING_TRANSACTIONS", 3117, "There are ongoing transactions that violate GTID consistency." }, { "ER_ACCOUNT_HAS_BEEN_LOCKED", 3118, "Access denied for user \'%-.48s\'@\'%-.64s\'. Account is locked." }, { "ER_WRONG_TABLESPACE_NAME", 3119, "Incorrect tablespace name `%-.192s`" }, { "ER_TABLESPACE_IS_NOT_EMPTY", 3120, "Tablespace `%-.192s` is not empty." }, { "ER_WRONG_FILE_NAME", 3121, "Incorrect File Name \'%s\'." }, { "ER_BOOST_GEOMETRY_INCONSISTENT_TURNS_EXCEPTION", 3122, "Inconsistent intersection points." }, { "ER_WARN_OPTIMIZER_HINT_SYNTAX_ERROR", 3123, "Optimizer hint syntax error" }, { "ER_WARN_BAD_MAX_EXECUTION_TIME", 3124, "Unsupported MAX_EXECUTION_TIME" }, { "ER_WARN_UNSUPPORTED_MAX_EXECUTION_TIME", 3125, "MAX_EXECUTION_TIME hint is supported by top-level standalone SELECT statements only" }, { "ER_WARN_CONFLICTING_HINT", 3126, "Hint %s is ignored as conflicting/duplicated" }, { "ER_WARN_UNKNOWN_QB_NAME", 3127, "Query block name %s is not found for %s hint" }, { "ER_UNRESOLVED_HINT_NAME", 3128, "Unresolved name %s for %s hint" }, { "ER_WARN_ON_MODIFYING_GTID_EXECUTED_TABLE", 3129, "Please do not modify the %s table. This is a mysql internal system table to store GTIDs for committed transactions. Modifying it can lead to an inconsistent GTID state." }, { "ER_PLUGGABLE_PROTOCOL_COMMAND_NOT_SUPPORTED", 3130, "Command not supported by pluggable protocols" }, { "ER_LOCKING_SERVICE_WRONG_NAME", 3131, "Incorrect locking service lock name \'%-.192s\'." }, { "ER_LOCKING_SERVICE_DEADLOCK", 3132, "Deadlock found when trying to get locking service lock; try releasing locks and restarting lock acquisition." }, { "ER_LOCKING_SERVICE_TIMEOUT", 3133, "Service lock wait timeout exceeded." }, { "ER_GIS_MAX_POINTS_IN_GEOMETRY_OVERFLOWED", 3134, "Parameter %s exceeds the maximum number of points in a geometry (%lu) in function %s." }, { "ER_SQL_MODE_MERGED", 3135, "\'NO_ZERO_DATE\', \'NO_ZERO_IN_DATE\' and \'ERROR_FOR_DIVISION_BY_ZERO\' sql modes should be used with strict mode. They will be merged with strict mode in a future release." }, { "ER_VTOKEN_PLUGIN_TOKEN_MISMATCH", 3136, "Version token mismatch for %.*s. Correct value %.*s" }, { "ER_VTOKEN_PLUGIN_TOKEN_NOT_FOUND", 3137, "Version token %.*s not found." }, { "ER_CANT_SET_VARIABLE_WHEN_OWNING_GTID", 3138, "Variable %-.192s cannot be changed by a client that owns a GTID. The client owns %s. Ownership is released on COMMIT or ROLLBACK." }, { "ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED", 3139, "%-.192s cannot be performed on channel \'%-.192s\'." }, { "ER_INVALID_JSON_TEXT", 3140, "Invalid JSON text: \"%s\" at position %u in value for column \'%-.200s\'." }, { "ER_INVALID_JSON_TEXT_IN_PARAM", 3141, "Invalid JSON text in argument %u to function %s: \"%s\" at position %u.%-.0s" }, { "ER_INVALID_JSON_BINARY_DATA", 3142, "The JSON binary value contains invalid data." }, { "ER_INVALID_JSON_PATH", 3143, "Invalid JSON path expression. The error is around character position %u.%-.200s" }, { "ER_INVALID_JSON_CHARSET", 3144, "Cannot create a JSON value from a string with CHARACTER SET \'%s\'." }, { "ER_INVALID_JSON_CHARSET_IN_FUNCTION", 3145, "Invalid JSON character data provided to function %s: \'%s\'; utf8 is required." }, { "ER_INVALID_TYPE_FOR_JSON", 3146, "Invalid data type for JSON data in argument %u to function %s; a JSON string or JSON type is required." }, { "ER_INVALID_CAST_TO_JSON", 3147, "Cannot CAST value to JSON." }, { "ER_INVALID_JSON_PATH_CHARSET", 3148, "A path expression must be encoded in the utf8 character set. The path expression \'%-.200s\' is encoded in character set \'%-.200s\'." }, { "ER_INVALID_JSON_PATH_WILDCARD", 3149, "In this situation, path expressions may not contain the * and ** tokens." }, { "ER_JSON_VALUE_TOO_BIG", 3150, "The JSON value is too big to be stored in a JSON column." }, { "ER_JSON_KEY_TOO_BIG", 3151, "The JSON object contains a key name that is too long." }, { "ER_JSON_USED_AS_KEY", 3152, "JSON column \'%-.192s\' cannot be used in key specification." }, { "ER_JSON_VACUOUS_PATH", 3153, "The path expression \'$\' is not allowed in this context." }, { "ER_JSON_BAD_ONE_OR_ALL_ARG", 3154, "The oneOrAll argument to %s may take these values: \'one\' or \'all\'." }, { "ER_NUMERIC_JSON_VALUE_OUT_OF_RANGE", 3155, "Out of range JSON value for CAST to %s%-.0s from column %s at row %ld" }, { "ER_INVALID_JSON_VALUE_FOR_CAST", 3156, "Invalid JSON value for CAST to %s%-.0s from column %s at row %ld" }, { "ER_JSON_DOCUMENT_TOO_DEEP", 3157, "The JSON document exceeds the maximum depth." }, { "ER_JSON_DOCUMENT_NULL_KEY", 3158, "JSON documents may not contain NULL member names." }, { "ER_SECURE_TRANSPORT_REQUIRED", 3159, "Connections using insecure transport are prohibited while --require_secure_transport=ON." }, { "ER_NO_SECURE_TRANSPORTS_CONFIGURED", 3160, "No secure transports (SSL or Shared Memory) are configured, unable to set --require_secure_transport=ON." }, { "ER_DISABLED_STORAGE_ENGINE", 3161, "Storage engine %s is disabled (Table creation is disallowed)." }, { "ER_USER_DOES_NOT_EXIST", 3162, "User %s does not exist." }, { "ER_USER_ALREADY_EXISTS", 3163, "User %s already exists." }, { "ER_AUDIT_API_ABORT", 3164, "Aborted by Audit API (\'%-.48s\';%d)." }, { "ER_INVALID_JSON_PATH_ARRAY_CELL", 3165, "A path expression is not a path to a cell in an array." }, { "ER_BUFPOOL_RESIZE_INPROGRESS", 3166, "Another buffer pool resize is already in progress." }, { "ER_FEATURE_DISABLED_SEE_DOC", 3167, "The \'%s\' feature is disabled; see the documentation for \'%s\'" }, { "ER_SERVER_ISNT_AVAILABLE", 3168, "Server isn\'t available" }, { "ER_SESSION_WAS_KILLED", 3169, "Session was killed" }, { "ER_CAPACITY_EXCEEDED", 3170, "Memory capacity of %llu bytes for \'%s\' exceeded. %s" }, { "ER_CAPACITY_EXCEEDED_IN_RANGE_OPTIMIZER", 3171, "Range optimization was not done for this query." }, { "ER_TABLE_NEEDS_UPG_PART", 3172, "Partitioning upgrade required. Please dump/reload to fix it or do: ALTER TABLE `%-.192s`.`%-.192s` UPGRADE PARTITIONING" }, { "ER_CANT_WAIT_FOR_EXECUTED_GTID_SET_WHILE_OWNING_A_GTID", 3173, "The client holds ownership of the GTID %s. Therefore, WAIT_FOR_EXECUTED_GTID_SET cannot wait for this GTID." }, { "ER_CANNOT_ADD_FOREIGN_BASE_COL_VIRTUAL", 3174, "Cannot add foreign key on the base column of indexed virtual column." }, { "ER_CANNOT_CREATE_VIRTUAL_INDEX_CONSTRAINT", 3175, "Cannot create index on virtual column whose base column has foreign constraint." }, { "ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE", 3176, "Please do not modify the %s table with an XA transaction. This is an internal system table used to store GTIDs for committed transactions. Although modifying it can lead to an inconsistent GTID state, if neccessary you can modify it with a non-XA transaction." }, { "ER_LOCK_REFUSED_BY_ENGINE", 3177, "Lock acquisition refused by storage engine." }, { "ER_UNSUPPORTED_ALTER_ONLINE_ON_VIRTUAL_COLUMN", 3178, "ADD COLUMN col...VIRTUAL, ADD INDEX(col)" }, { "ER_MASTER_KEY_ROTATION_NOT_SUPPORTED_BY_SE", 3179, "Master key rotation is not supported by storage engine." }, { "ER_MASTER_KEY_ROTATION_ERROR_BY_SE", 3180, "Encryption key rotation error reported by SE: %s" }, { "ER_MASTER_KEY_ROTATION_BINLOG_FAILED", 3181, "Write to binlog failed. However, master key rotation has been completed successfully." }, { "ER_MASTER_KEY_ROTATION_SE_UNAVAILABLE", 3182, "Storage engine is not available." }, { "ER_TABLESPACE_CANNOT_ENCRYPT", 3183, "This tablespace can\'t be encrypted." }, { "ER_INVALID_ENCRYPTION_OPTION", 3184, "Invalid encryption option." }, { "ER_CANNOT_FIND_KEY_IN_KEYRING", 3185, "Can\'t find master key from keyring, please check in the server log if a keyring plugin is loaded and initialized successfully." }, { "ER_CAPACITY_EXCEEDED_IN_PARSER", 3186, "Parser bailed out for this query." }, { "ER_UNSUPPORTED_ALTER_ENCRYPTION_INPLACE", 3187, "Cannot alter encryption attribute by inplace algorithm." }, { "ER_KEYRING_UDF_KEYRING_SERVICE_ERROR", 3188, "Function \'%s\' failed because underlying keyring service returned an error. Please check if a keyring plugin is installed and that provided arguments are valid for the keyring you are using." }, { "ER_USER_COLUMN_OLD_LENGTH", 3189, "It seems that your db schema is old. The %s column is 77 characters long and should be 93 characters long. Please run mysql_upgrade." }, { "ER_CANT_RESET_MASTER", 3190, "RESET MASTER is not allowed because %-.384s." }, { "ER_GROUP_REPLICATION_MAX_GROUP_SIZE", 3191, "The START GROUP_REPLICATION command failed since the group already has 9 members." }, { "ER_CANNOT_ADD_FOREIGN_BASE_COL_STORED", 3192, "Cannot add foreign key on the base column of stored column. " }, { "ER_TABLE_REFERENCED", 3193, "Cannot complete the operation because table is referenced by another connection." }, { "ER_PARTITION_ENGINE_DEPRECATED_FOR_TABLE", 3194, "The partition engine, used by table \'%-.192s.%-.192s\', is deprecated and will be removed in a future release. Please use native partitioning instead." }, { "ER_WARN_USING_GEOMFROMWKB_TO_SET_SRID_ZERO", 3195, "%.192s(geometry) is deprecated and will be replaced by st_srid(geometry, 0) in a future version. Use %.192s(st_aswkb(geometry), 0) instead." }, { "ER_WARN_USING_GEOMFROMWKB_TO_SET_SRID", 3196, "%.192s(geometry, srid) is deprecated and will be replaced by st_srid(geometry, srid) in a future version. Use %.192s(st_aswkb(geometry), srid) instead." }, { "ER_XA_RETRY", 3197, "The resource manager is not able to commit the transaction branch at this time. Please retry later." }, { "ER_KEYRING_AWS_UDF_AWS_KMS_ERROR", 3198, "Function %s failed due to: %s." }, { "ER_BINLOG_UNSAFE_XA", 3199, "Statement is unsafe because it is being used inside a XA transaction. Concurrent XA transactions may deadlock on slaves when replicated using statements." }, { "ER_UDF_ERROR", 3200, "%s UDF failed; %s" }, { "ER_KEYRING_MIGRATION_FAILURE", 3201, "Can not perform keyring migration : %s" }, { "ER_KEYRING_ACCESS_DENIED_ERROR", 3202, "Access denied; you need %-.128s privileges for this operation" }, { "ER_KEYRING_MIGRATION_STATUS", 3203, "Keyring migration %s." }, { "ER_PLUGIN_FAILED_TO_OPEN_TABLES", 3204, "Failed to open the %s filter tables." }, { "ER_PLUGIN_FAILED_TO_OPEN_TABLE", 3205, "Failed to open \'%s.%s\' %s table." }, { "ER_AUDIT_LOG_NO_KEYRING_PLUGIN_INSTALLED", 3206, "No keyring plugin installed." }, { "ER_AUDIT_LOG_ENCRYPTION_PASSWORD_HAS_NOT_BEEN_SET", 3207, "Audit log encryption password has not been set; it will be generated automatically. Use audit_log_encryption_password_get to obtain the password or audit_log_encryption_password_set to set a new one." }, { "ER_AUDIT_LOG_COULD_NOT_CREATE_AES_KEY", 3208, "Could not create AES key. OpenSSL\'s EVP_BytesToKey function failed." }, { "ER_AUDIT_LOG_ENCRYPTION_PASSWORD_CANNOT_BE_FETCHED", 3209, "Audit log encryption password cannot be fetched from the keyring. Password used so far is used for encryption." }, { "ER_AUDIT_LOG_JSON_FILTERING_NOT_ENABLED", 3210, "Audit Log filtering has not been installed." }, { "ER_AUDIT_LOG_UDF_INSUFFICIENT_PRIVILEGE", 3211, "Request ignored for \'%s\'@\'%s\'. SUPER_ACL needed to perform operation" }, { "ER_AUDIT_LOG_SUPER_PRIVILEGE_REQUIRED", 3212, "SUPER privilege required for \'%s\'@\'%s\' user." }, { "ER_COULD_NOT_REINITIALIZE_AUDIT_LOG_FILTERS", 3213, "Could not reinitialize audit log filters." }, { "ER_AUDIT_LOG_UDF_INVALID_ARGUMENT_TYPE", 3214, "Invalid argument type" }, { "ER_AUDIT_LOG_UDF_INVALID_ARGUMENT_COUNT", 3215, "Invalid argument count" }, { "ER_AUDIT_LOG_HAS_NOT_BEEN_INSTALLED", 3216, "audit_log plugin has not been installed using INSTALL PLUGIN syntax." }, { "ER_AUDIT_LOG_UDF_READ_INVALID_MAX_ARRAY_LENGTH_ARG_TYPE", 3217, "Invalid \"max_array_length\" argument type." }, { "ER_AUDIT_LOG_UDF_READ_INVALID_MAX_ARRAY_LENGTH_ARG_VALUE", 3218, "Invalid \"max_array_length\" argument value." }, { "ER_AUDIT_LOG_JSON_FILTER_PARSING_ERROR", 3219, "%s" }, { "ER_AUDIT_LOG_JSON_FILTER_NAME_CANNOT_BE_EMPTY", 3220, "Filter name cannot be empty." }, { "ER_AUDIT_LOG_JSON_USER_NAME_CANNOT_BE_EMPTY", 3221, "User cannot be empty." }, { "ER_AUDIT_LOG_JSON_FILTER_DOES_NOT_EXISTS", 3222, "Specified filter has not been found." }, { "ER_AUDIT_LOG_USER_FIRST_CHARACTER_MUST_BE_ALPHANUMERIC", 3223, "First character of the user name must be alphanumeric." }, { "ER_AUDIT_LOG_USER_NAME_INVALID_CHARACTER", 3224, "Invalid character in the user name." }, { "ER_AUDIT_LOG_HOST_NAME_INVALID_CHARACTER", 3225, "Invalid character in the host name." }, { "WARN_DEPRECATED_MAXDB_SQL_MODE_FOR_TIMESTAMP", 3226, "With the MAXDB SQL mode enabled, TIMESTAMP is identical with DATETIME. The MAXDB SQL mode is deprecated and will be removed in a future release. Please disable the MAXDB SQL mode and use DATETIME instead." }, { "ER_XA_REPLICATION_FILTERS", 3227, "The use of replication filters with XA transactions is not supported, and can lead to an undefined state in the replication slave." }, { "ER_COMPRESSED_COLUMN_USED_AS_KEY", 3228, "Compressed column \'%-.192s\' is not allowed in the key list" }, { "ER_UNSUPPORTED_COMPRESSED_COLUMN_TYPE", 3229, "Can not define column \'%-.192s\' in compressed format" }, { "ER_COMPRESSION_DICTIONARY_EXISTS", 3230, "Compression dictionary \'%-.192s\' already exists" }, { "ER_COMPRESSION_DICTIONARY_DOES_NOT_EXIST", 3231, "Compression dictionary \'%-.192s\' does not exist" }, { "ER_COMPRESSION_DICTIONARY_NAME_TOO_LONG", 3232, "Compression dictionary name \'%-.192s\' is too long (max length = %lu)" }, { "ER_COMPRESSION_DICTIONARY_DATA_TOO_LONG", 3233, "Data for compression dictionary \'%-.192s\' is too long (max length = %lu)" }, { "ER_COMPRESSION_DICTIONARY_IS_REFERENCED", 3234, "Compression dictionary \'%-.192s\' is in use" }, { "ER_CANT_EXECUTE_WITH_BACKUP_LOCK", 3235, "Can\'t execute the query because you have a conflicting backup lock" }, { "ER_KEYS_OUT_OF_ORDER", 12000, "Keys are out order during bulk load" }, { "ER_OVERLAPPING_KEYS", 12001, "Bulk load rows overlap existing rows" }, { "ER_REQUIRE_ROW_BINLOG_FORMAT", 12002, "Can\'t execute updates on master with binlog_format != ROW." }, { "ER_ISOLATION_MODE_NOT_SUPPORTED", 12003, "MyRocks supports only READ COMMITTED and REPEATABLE READ isolation levels. Please change from current isolation level %s" }, { "ER_ON_DUPLICATE_DISABLED", 12004, "When unique checking is disabled in MyRocks, INSERT,UPDATE,LOAD statements with clauses that update or replace the key (i.e. INSERT ON DUPLICATE KEY UPDATE, REPLACE) are not allowed. Query: %s" }, { "ER_UPDATES_WITH_CONSISTENT_SNAPSHOT", 12005, "Can\'t execute updates when you started a transaction with START TRANSACTION WITH CONSISTENT [ROCKSDB] SNAPSHOT." }, { "ER_ROLLBACK_ONLY", 12006, "This transaction was rolled back and cannot be committed. Only supported operation is to roll it back, so all pending changes will be discarded. Please restart another transaction." }, { "ER_ROLLBACK_TO_SAVEPOINT", 12007, "MyRocks currently does not support ROLLBACK TO SAVEPOINT if modifying rows." }, { "ER_ISOLATION_LEVEL_WITH_CONSISTENT_SNAPSHOT", 12008, "Only REPEATABLE READ isolation level is supported for START TRANSACTION WITH CONSISTENT SNAPSHOT in RocksDB Storage Engine." }, { "ER_UNSUPPORTED_COLLATION", 12009, "Unsupported collation on string indexed column %s.%s Use binary collation (%s)." }, { "ER_METADATA_INCONSISTENCY", 12010, "Table \'%s\' does not exist, but metadata information exists inside MyRocks. This is a sign of data inconsistency. Please check if \'%s.frm\' exists, and try to restore it if it does not exist." }, { "ER_KEY_CREATE_DURING_ALTER", 12011, "MyRocks failed creating new key definitions during alter." }, { "ER_SK_POPULATE_DURING_ALTER", 12012, "MyRocks failed populating secondary key during alter." }, { "ER_CF_DIFFERENT", 12013, "Column family (\'%s\') flag (%d) is different from an existing flag (%d). Assign a new CF flag, or do not change existing CF flag." }, { "ER_RDB_TTL_UNSUPPORTED", 12014, "TTL support is currently disabled when table has a hidden PK." }, { "ER_RDB_TTL_COL_FORMAT", 12015, "TTL column (%s) in MyRocks must be an unsigned non-null 64-bit integer, exist inside the table, and have an accompanying ttl duration." }, { "ER_RDB_TTL_DURATION_FORMAT", 12016, "TTL duration (%s) in MyRocks must be an unsigned non-null 64-bit integer." }, { "ER_PER_INDEX_CF_DEPRECATED", 12017, "The per-index column family option has been deprecated." }, �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysqlx_error.h��������������������������������������������������������������������������������0000644�����������������00000005347�14763166026�0010654 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2015, 2016 Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _MYSQLX_ERROR_H_ #define _MYSQLX_ERROR_H_ #define ER_X_BAD_MESSAGE 5000 #define ER_X_CAPABILITIES_PREPARE_FAILED 5001 #define ER_X_CAPABILITY_NOT_FOUND 5002 #define ER_X_INVALID_PROTOCOL_DATA 5003 #define ER_X_SERVICE_ERROR 5010 #define ER_X_SESSION 5011 #define ER_X_INVALID_ARGUMENT 5012 #define ER_X_MISSING_ARGUMENT 5013 #define ER_X_BAD_INSERT_DATA 5014 #define ER_X_CMD_NUM_ARGUMENTS 5015 #define ER_X_CMD_ARGUMENT_TYPE 5016 #define ER_X_CMD_ARGUMENT_VALUE 5017 #define ER_X_BAD_UPDATE_DATA 5050 #define ER_X_BAD_TYPE_OF_UPDATE 5051 #define ER_X_BAD_COLUMN_TO_UPDATE 5052 #define ER_X_BAD_MEMBER_TO_UPDATE 5053 #define ER_X_BAD_STATEMENT_ID 5110 #define ER_X_BAD_CURSOR_ID 5111 #define ER_X_BAD_SCHEMA 5112 #define ER_X_BAD_TABLE 5113 #define ER_X_BAD_PROJECTION 5114 #define ER_X_DOC_ID_MISSING 5115 #define ER_X_DOC_ID_DUPLICATE 5116 #define ER_X_DOC_REQUIRED_FIELD_MISSING 5117 #define ER_X_PROJ_BAD_KEY_NAME 5120 #define ER_X_BAD_DOC_PATH 5121 #define ER_X_CURSOR_EXISTS 5122 #define ER_X_EXPR_BAD_OPERATOR 5150 #define ER_X_EXPR_BAD_NUM_ARGS 5151 #define ER_X_EXPR_MISSING_ARG 5152 #define ER_X_EXPR_BAD_TYPE_VALUE 5153 #define ER_X_EXPR_BAD_VALUE 5154 #define ER_X_INVALID_COLLECTION 5156 #define ER_X_INVALID_ADMIN_COMMAND 5157 #define ER_X_EXPECT_NOT_OPEN 5158 #define ER_X_EXPECT_FAILED 5159 #define ER_X_EXPECT_BAD_CONDITION 5160 #define ER_X_EXPECT_BAD_CONDITION_VALUE 5161 #define ER_X_INVALID_NAMESPACE 5162 #define ER_X_BAD_NOTICE 5163 #define ER_X_CANNOT_DISABLE_NOTICE 5164 #define ER_X_BAD_CONFIGURATION 5165 #define ER_X_MYSQLX_ACCOUNT_MISSING_PERMISSIONS 5167 #endif // _MYSQLX_ERROR_H_ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/thr_mutex.h�����������������������������������������������������������������������������������0000644�����������������00000013057�14763166026�0010122 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef THR_MUTEX_INCLUDED #define THR_MUTEX_INCLUDED /* Copyright (c) 2014, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** MySQL mutex implementation. There are three "layers": 1) native_mutex_*() Functions that map directly down to OS primitives. Windows - CriticalSection Other OSes - pthread 2) my_mutex_*() Functions that implement SAFE_MUTEX (default for debug), Otherwise native_mutex_*() is used. 3) mysql_mutex_*() Functions that include Performance Schema instrumentation. See include/mysql/psi/mysql_thread.h */ #include <my_global.h> #include "my_thread.h" C_MODE_START #ifdef _WIN32 typedef CRITICAL_SECTION native_mutex_t; typedef int native_mutexattr_t; #else typedef pthread_mutex_t native_mutex_t; typedef pthread_mutexattr_t native_mutexattr_t; #endif /* Define mutex types, see my_thr_init.c */ #define MY_MUTEX_INIT_SLOW NULL /* Can be set in /usr/include/pthread.h */ #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP extern native_mutexattr_t my_fast_mutexattr; #define MY_MUTEX_INIT_FAST &my_fast_mutexattr #else #define MY_MUTEX_INIT_FAST NULL #endif /* Can be set in /usr/include/pthread.h */ #ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP extern native_mutexattr_t my_errorcheck_mutexattr; #define MY_MUTEX_INIT_ERRCHK &my_errorcheck_mutexattr #else #define MY_MUTEX_INIT_ERRCHK NULL #endif static inline int native_mutex_init(native_mutex_t *mutex, const native_mutexattr_t *attr) { #ifdef _WIN32 InitializeCriticalSection(mutex); return 0; #else return pthread_mutex_init(mutex, attr); #endif } static inline int native_mutex_lock(native_mutex_t *mutex) { #ifdef _WIN32 EnterCriticalSection(mutex); return 0; #else return pthread_mutex_lock(mutex); #endif } static inline int native_mutex_trylock(native_mutex_t *mutex) { #ifdef _WIN32 if (TryEnterCriticalSection(mutex)) { /* Don't allow recursive lock */ if (mutex->RecursionCount > 1){ LeaveCriticalSection(mutex); return EBUSY; } return 0; } return EBUSY; #else return pthread_mutex_trylock(mutex); #endif } static inline int native_mutex_unlock(native_mutex_t *mutex) { #ifdef _WIN32 LeaveCriticalSection(mutex); return 0; #else return pthread_mutex_unlock(mutex); #endif } static inline int native_mutex_destroy(native_mutex_t *mutex) { #ifdef _WIN32 DeleteCriticalSection(mutex); return 0; #else return pthread_mutex_destroy(mutex); #endif } #ifdef SAFE_MUTEX /* safe_mutex adds checking to mutex for easier debugging */ typedef struct st_safe_mutex_t { native_mutex_t global, mutex; const char *file; uint line, count; my_thread_t thread; } my_mutex_t; void safe_mutex_global_init(); int safe_mutex_init(my_mutex_t *mp, const native_mutexattr_t *attr, const char *file, uint line); int safe_mutex_lock(my_mutex_t *mp, my_bool try_lock, const char *file, uint line); int safe_mutex_unlock(my_mutex_t *mp, const char *file, uint line); int safe_mutex_destroy(my_mutex_t *mp, const char *file, uint line); static inline void safe_mutex_assert_owner(const my_mutex_t *mp) { DBUG_ASSERT(mp->count > 0 && my_thread_equal(my_thread_self(), mp->thread)); } static inline void safe_mutex_assert_not_owner(const my_mutex_t *mp) { DBUG_ASSERT(!mp->count || !my_thread_equal(my_thread_self(), mp->thread)); } #else typedef native_mutex_t my_mutex_t; #endif static inline int my_mutex_init(my_mutex_t *mp, const native_mutexattr_t *attr #ifdef SAFE_MUTEX , const char *file, uint line #endif ) { #ifdef SAFE_MUTEX return safe_mutex_init(mp, attr, file, line); #else return native_mutex_init(mp, attr); #endif } static inline int my_mutex_lock(my_mutex_t *mp #ifdef SAFE_MUTEX , const char *file, uint line #endif ) { #ifdef SAFE_MUTEX return safe_mutex_lock(mp, FALSE, file, line); #else return native_mutex_lock(mp); #endif } static inline int my_mutex_trylock(my_mutex_t *mp #ifdef SAFE_MUTEX , const char *file, uint line #endif ) { #ifdef SAFE_MUTEX return safe_mutex_lock(mp, TRUE, file, line); #else return native_mutex_trylock(mp); #endif } static inline int my_mutex_unlock(my_mutex_t *mp #ifdef SAFE_MUTEX , const char *file, uint line #endif ) { #ifdef SAFE_MUTEX return safe_mutex_unlock(mp, file, line); #else return native_mutex_unlock(mp); #endif } static inline int my_mutex_destroy(my_mutex_t *mp #ifdef SAFE_MUTEX , const char *file, uint line #endif ) { #ifdef SAFE_MUTEX return safe_mutex_destroy(mp, file, line); #else return native_mutex_destroy(mp); #endif } C_MODE_END #endif /* THR_MUTEX_INCLUDED */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysqld_error.h��������������������������������������������������������������������������������0000644�����������������00000132273�14763166026�0010627 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Autogenerated file, please don't edit */ #ifndef MYSQLD_ERROR_INCLUDED #define MYSQLD_ERROR_INCLUDED static const int errmsg_section_start[] = { 1000, 3000, 12000 }; static const int errmsg_section_size[] = { 887, 236, 18 }; #define ER_HASHCHK 1000 #define ER_NISAMCHK 1001 #define ER_NO 1002 #define ER_YES 1003 #define ER_CANT_CREATE_FILE 1004 #define ER_CANT_CREATE_TABLE 1005 #define ER_CANT_CREATE_DB 1006 #define ER_DB_CREATE_EXISTS 1007 #define ER_DB_DROP_EXISTS 1008 #define ER_DB_DROP_DELETE 1009 #define ER_DB_DROP_RMDIR 1010 #define ER_CANT_DELETE_FILE 1011 #define ER_CANT_FIND_SYSTEM_REC 1012 #define ER_CANT_GET_STAT 1013 #define ER_CANT_GET_WD 1014 #define ER_CANT_LOCK 1015 #define ER_CANT_OPEN_FILE 1016 #define ER_FILE_NOT_FOUND 1017 #define ER_CANT_READ_DIR 1018 #define ER_CANT_SET_WD 1019 #define ER_CHECKREAD 1020 #define ER_DISK_FULL 1021 #define ER_DUP_KEY 1022 #define ER_ERROR_ON_CLOSE 1023 #define ER_ERROR_ON_READ 1024 #define ER_ERROR_ON_RENAME 1025 #define ER_ERROR_ON_WRITE 1026 #define ER_FILE_USED 1027 #define ER_FILSORT_ABORT 1028 #define ER_FORM_NOT_FOUND 1029 #define ER_GET_ERRNO 1030 #define ER_ILLEGAL_HA 1031 #define ER_KEY_NOT_FOUND 1032 #define ER_NOT_FORM_FILE 1033 #define ER_NOT_KEYFILE 1034 #define ER_OLD_KEYFILE 1035 #define ER_OPEN_AS_READONLY 1036 #define ER_OUTOFMEMORY 1037 #define ER_OUT_OF_SORTMEMORY 1038 #define ER_UNEXPECTED_EOF 1039 #define ER_CON_COUNT_ERROR 1040 #define ER_OUT_OF_RESOURCES 1041 #define ER_BAD_HOST_ERROR 1042 #define ER_HANDSHAKE_ERROR 1043 #define ER_DBACCESS_DENIED_ERROR 1044 #define ER_ACCESS_DENIED_ERROR 1045 #define ER_NO_DB_ERROR 1046 #define ER_UNKNOWN_COM_ERROR 1047 #define ER_BAD_NULL_ERROR 1048 #define ER_BAD_DB_ERROR 1049 #define ER_TABLE_EXISTS_ERROR 1050 #define ER_BAD_TABLE_ERROR 1051 #define ER_NON_UNIQ_ERROR 1052 #define ER_SERVER_SHUTDOWN 1053 #define ER_BAD_FIELD_ERROR 1054 #define ER_WRONG_FIELD_WITH_GROUP 1055 #define ER_WRONG_GROUP_FIELD 1056 #define ER_WRONG_SUM_SELECT 1057 #define ER_WRONG_VALUE_COUNT 1058 #define ER_TOO_LONG_IDENT 1059 #define ER_DUP_FIELDNAME 1060 #define ER_DUP_KEYNAME 1061 #define ER_DUP_ENTRY 1062 #define ER_WRONG_FIELD_SPEC 1063 #define ER_PARSE_ERROR 1064 #define ER_EMPTY_QUERY 1065 #define ER_NONUNIQ_TABLE 1066 #define ER_INVALID_DEFAULT 1067 #define ER_MULTIPLE_PRI_KEY 1068 #define ER_TOO_MANY_KEYS 1069 #define ER_TOO_MANY_KEY_PARTS 1070 #define ER_TOO_LONG_KEY 1071 #define ER_KEY_COLUMN_DOES_NOT_EXITS 1072 #define ER_BLOB_USED_AS_KEY 1073 #define ER_TOO_BIG_FIELDLENGTH 1074 #define ER_WRONG_AUTO_KEY 1075 #define ER_READY 1076 #define ER_NORMAL_SHUTDOWN 1077 #define ER_GOT_SIGNAL 1078 #define ER_SHUTDOWN_COMPLETE 1079 #define ER_FORCING_CLOSE 1080 #define ER_IPSOCK_ERROR 1081 #define ER_NO_SUCH_INDEX 1082 #define ER_WRONG_FIELD_TERMINATORS 1083 #define ER_BLOBS_AND_NO_TERMINATED 1084 #define ER_TEXTFILE_NOT_READABLE 1085 #define ER_FILE_EXISTS_ERROR 1086 #define ER_LOAD_INFO 1087 #define ER_ALTER_INFO 1088 #define ER_WRONG_SUB_KEY 1089 #define ER_CANT_REMOVE_ALL_FIELDS 1090 #define ER_CANT_DROP_FIELD_OR_KEY 1091 #define ER_INSERT_INFO 1092 #define ER_UPDATE_TABLE_USED 1093 #define ER_NO_SUCH_THREAD 1094 #define ER_KILL_DENIED_ERROR 1095 #define ER_NO_TABLES_USED 1096 #define ER_TOO_BIG_SET 1097 #define ER_NO_UNIQUE_LOGFILE 1098 #define ER_TABLE_NOT_LOCKED_FOR_WRITE 1099 #define ER_TABLE_NOT_LOCKED 1100 #define ER_BLOB_CANT_HAVE_DEFAULT 1101 #define ER_WRONG_DB_NAME 1102 #define ER_WRONG_TABLE_NAME 1103 #define ER_TOO_BIG_SELECT 1104 #define ER_UNKNOWN_ERROR 1105 #define ER_UNKNOWN_PROCEDURE 1106 #define ER_WRONG_PARAMCOUNT_TO_PROCEDURE 1107 #define ER_WRONG_PARAMETERS_TO_PROCEDURE 1108 #define ER_UNKNOWN_TABLE 1109 #define ER_FIELD_SPECIFIED_TWICE 1110 #define ER_INVALID_GROUP_FUNC_USE 1111 #define ER_UNSUPPORTED_EXTENSION 1112 #define ER_TABLE_MUST_HAVE_COLUMNS 1113 #define ER_RECORD_FILE_FULL 1114 #define ER_UNKNOWN_CHARACTER_SET 1115 #define ER_TOO_MANY_TABLES 1116 #define ER_TOO_MANY_FIELDS 1117 #define ER_TOO_BIG_ROWSIZE 1118 #define ER_STACK_OVERRUN 1119 #define ER_WRONG_OUTER_JOIN 1120 #define ER_NULL_COLUMN_IN_INDEX 1121 #define ER_CANT_FIND_UDF 1122 #define ER_CANT_INITIALIZE_UDF 1123 #define ER_UDF_NO_PATHS 1124 #define ER_UDF_EXISTS 1125 #define ER_CANT_OPEN_LIBRARY 1126 #define ER_CANT_FIND_DL_ENTRY 1127 #define ER_FUNCTION_NOT_DEFINED 1128 #define ER_HOST_IS_BLOCKED 1129 #define ER_HOST_NOT_PRIVILEGED 1130 #define ER_PASSWORD_ANONYMOUS_USER 1131 #define ER_PASSWORD_NOT_ALLOWED 1132 #define ER_PASSWORD_NO_MATCH 1133 #define ER_UPDATE_INFO 1134 #define ER_CANT_CREATE_THREAD 1135 #define ER_WRONG_VALUE_COUNT_ON_ROW 1136 #define ER_CANT_REOPEN_TABLE 1137 #define ER_INVALID_USE_OF_NULL 1138 #define ER_REGEXP_ERROR 1139 #define ER_MIX_OF_GROUP_FUNC_AND_FIELDS 1140 #define ER_NONEXISTING_GRANT 1141 #define ER_TABLEACCESS_DENIED_ERROR 1142 #define ER_COLUMNACCESS_DENIED_ERROR 1143 #define ER_ILLEGAL_GRANT_FOR_TABLE 1144 #define ER_GRANT_WRONG_HOST_OR_USER 1145 #define ER_NO_SUCH_TABLE 1146 #define ER_NONEXISTING_TABLE_GRANT 1147 #define ER_NOT_ALLOWED_COMMAND 1148 #define ER_SYNTAX_ERROR 1149 #define ER_UNUSED1 1150 #define ER_UNUSED2 1151 #define ER_ABORTING_CONNECTION 1152 #define ER_NET_PACKET_TOO_LARGE 1153 #define ER_NET_READ_ERROR_FROM_PIPE 1154 #define ER_NET_FCNTL_ERROR 1155 #define ER_NET_PACKETS_OUT_OF_ORDER 1156 #define ER_NET_UNCOMPRESS_ERROR 1157 #define ER_NET_READ_ERROR 1158 #define ER_NET_READ_INTERRUPTED 1159 #define ER_NET_ERROR_ON_WRITE 1160 #define ER_NET_WRITE_INTERRUPTED 1161 #define ER_TOO_LONG_STRING 1162 #define ER_TABLE_CANT_HANDLE_BLOB 1163 #define ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 1164 #define ER_UNUSED3 1165 #define ER_WRONG_COLUMN_NAME 1166 #define ER_WRONG_KEY_COLUMN 1167 #define ER_WRONG_MRG_TABLE 1168 #define ER_DUP_UNIQUE 1169 #define ER_BLOB_KEY_WITHOUT_LENGTH 1170 #define ER_PRIMARY_CANT_HAVE_NULL 1171 #define ER_TOO_MANY_ROWS 1172 #define ER_REQUIRES_PRIMARY_KEY 1173 #define ER_NO_RAID_COMPILED 1174 #define ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE 1175 #define ER_KEY_DOES_NOT_EXITS 1176 #define ER_CHECK_NO_SUCH_TABLE 1177 #define ER_CHECK_NOT_IMPLEMENTED 1178 #define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179 #define ER_ERROR_DURING_COMMIT 1180 #define ER_ERROR_DURING_ROLLBACK 1181 #define ER_ERROR_DURING_FLUSH_LOGS 1182 #define ER_ERROR_DURING_CHECKPOINT 1183 #define ER_NEW_ABORTING_CONNECTION 1184 #define ER_DUMP_NOT_IMPLEMENTED 1185 #define ER_FLUSH_MASTER_BINLOG_CLOSED 1186 #define ER_INDEX_REBUILD 1187 #define ER_MASTER 1188 #define ER_MASTER_NET_READ 1189 #define ER_MASTER_NET_WRITE 1190 #define ER_FT_MATCHING_KEY_NOT_FOUND 1191 #define ER_LOCK_OR_ACTIVE_TRANSACTION 1192 #define ER_UNKNOWN_SYSTEM_VARIABLE 1193 #define ER_CRASHED_ON_USAGE 1194 #define ER_CRASHED_ON_REPAIR 1195 #define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196 #define ER_TRANS_CACHE_FULL 1197 #define ER_SLAVE_MUST_STOP 1198 #define ER_SLAVE_NOT_RUNNING 1199 #define ER_BAD_SLAVE 1200 #define ER_MASTER_INFO 1201 #define ER_SLAVE_THREAD 1202 #define ER_TOO_MANY_USER_CONNECTIONS 1203 #define ER_SET_CONSTANTS_ONLY 1204 #define ER_LOCK_WAIT_TIMEOUT 1205 #define ER_LOCK_TABLE_FULL 1206 #define ER_READ_ONLY_TRANSACTION 1207 #define ER_DROP_DB_WITH_READ_LOCK 1208 #define ER_CREATE_DB_WITH_READ_LOCK 1209 #define ER_WRONG_ARGUMENTS 1210 #define ER_NO_PERMISSION_TO_CREATE_USER 1211 #define ER_UNION_TABLES_IN_DIFFERENT_DIR 1212 #define ER_LOCK_DEADLOCK 1213 #define ER_TABLE_CANT_HANDLE_FT 1214 #define ER_CANNOT_ADD_FOREIGN 1215 #define ER_NO_REFERENCED_ROW 1216 #define ER_ROW_IS_REFERENCED 1217 #define ER_CONNECT_TO_MASTER 1218 #define ER_QUERY_ON_MASTER 1219 #define ER_ERROR_WHEN_EXECUTING_COMMAND 1220 #define ER_WRONG_USAGE 1221 #define ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 1222 #define ER_CANT_UPDATE_WITH_READLOCK 1223 #define ER_MIXING_NOT_ALLOWED 1224 #define ER_DUP_ARGUMENT 1225 #define ER_USER_LIMIT_REACHED 1226 #define ER_SPECIFIC_ACCESS_DENIED_ERROR 1227 #define ER_LOCAL_VARIABLE 1228 #define ER_GLOBAL_VARIABLE 1229 #define ER_NO_DEFAULT 1230 #define ER_WRONG_VALUE_FOR_VAR 1231 #define ER_WRONG_TYPE_FOR_VAR 1232 #define ER_VAR_CANT_BE_READ 1233 #define ER_CANT_USE_OPTION_HERE 1234 #define ER_NOT_SUPPORTED_YET 1235 #define ER_MASTER_FATAL_ERROR_READING_BINLOG 1236 #define ER_SLAVE_IGNORED_TABLE 1237 #define ER_INCORRECT_GLOBAL_LOCAL_VAR 1238 #define ER_WRONG_FK_DEF 1239 #define ER_KEY_REF_DO_NOT_MATCH_TABLE_REF 1240 #define ER_OPERAND_COLUMNS 1241 #define ER_SUBQUERY_NO_1_ROW 1242 #define ER_UNKNOWN_STMT_HANDLER 1243 #define ER_CORRUPT_HELP_DB 1244 #define ER_CYCLIC_REFERENCE 1245 #define ER_AUTO_CONVERT 1246 #define ER_ILLEGAL_REFERENCE 1247 #define ER_DERIVED_MUST_HAVE_ALIAS 1248 #define ER_SELECT_REDUCED 1249 #define ER_TABLENAME_NOT_ALLOWED_HERE 1250 #define ER_NOT_SUPPORTED_AUTH_MODE 1251 #define ER_SPATIAL_CANT_HAVE_NULL 1252 #define ER_COLLATION_CHARSET_MISMATCH 1253 #define ER_SLAVE_WAS_RUNNING 1254 #define ER_SLAVE_WAS_NOT_RUNNING 1255 #define ER_TOO_BIG_FOR_UNCOMPRESS 1256 #define ER_ZLIB_Z_MEM_ERROR 1257 #define ER_ZLIB_Z_BUF_ERROR 1258 #define ER_ZLIB_Z_DATA_ERROR 1259 #define ER_CUT_VALUE_GROUP_CONCAT 1260 #define ER_WARN_TOO_FEW_RECORDS 1261 #define ER_WARN_TOO_MANY_RECORDS 1262 #define ER_WARN_NULL_TO_NOTNULL 1263 #define ER_WARN_DATA_OUT_OF_RANGE 1264 #define WARN_DATA_TRUNCATED 1265 #define ER_WARN_USING_OTHER_HANDLER 1266 #define ER_CANT_AGGREGATE_2COLLATIONS 1267 #define ER_DROP_USER 1268 #define ER_REVOKE_GRANTS 1269 #define ER_CANT_AGGREGATE_3COLLATIONS 1270 #define ER_CANT_AGGREGATE_NCOLLATIONS 1271 #define ER_VARIABLE_IS_NOT_STRUCT 1272 #define ER_UNKNOWN_COLLATION 1273 #define ER_SLAVE_IGNORED_SSL_PARAMS 1274 #define ER_SERVER_IS_IN_SECURE_AUTH_MODE 1275 #define ER_WARN_FIELD_RESOLVED 1276 #define ER_BAD_SLAVE_UNTIL_COND 1277 #define ER_MISSING_SKIP_SLAVE 1278 #define ER_UNTIL_COND_IGNORED 1279 #define ER_WRONG_NAME_FOR_INDEX 1280 #define ER_WRONG_NAME_FOR_CATALOG 1281 #define ER_WARN_QC_RESIZE 1282 #define ER_BAD_FT_COLUMN 1283 #define ER_UNKNOWN_KEY_CACHE 1284 #define ER_WARN_HOSTNAME_WONT_WORK 1285 #define ER_UNKNOWN_STORAGE_ENGINE 1286 #define ER_WARN_DEPRECATED_SYNTAX 1287 #define ER_NON_UPDATABLE_TABLE 1288 #define ER_FEATURE_DISABLED 1289 #define ER_OPTION_PREVENTS_STATEMENT 1290 #define ER_DUPLICATED_VALUE_IN_TYPE 1291 #define ER_TRUNCATED_WRONG_VALUE 1292 #define ER_TOO_MUCH_AUTO_TIMESTAMP_COLS 1293 #define ER_INVALID_ON_UPDATE 1294 #define ER_UNSUPPORTED_PS 1295 #define ER_GET_ERRMSG 1296 #define ER_GET_TEMPORARY_ERRMSG 1297 #define ER_UNKNOWN_TIME_ZONE 1298 #define ER_WARN_INVALID_TIMESTAMP 1299 #define ER_INVALID_CHARACTER_STRING 1300 #define ER_WARN_ALLOWED_PACKET_OVERFLOWED 1301 #define ER_CONFLICTING_DECLARATIONS 1302 #define ER_SP_NO_RECURSIVE_CREATE 1303 #define ER_SP_ALREADY_EXISTS 1304 #define ER_SP_DOES_NOT_EXIST 1305 #define ER_SP_DROP_FAILED 1306 #define ER_SP_STORE_FAILED 1307 #define ER_SP_LILABEL_MISMATCH 1308 #define ER_SP_LABEL_REDEFINE 1309 #define ER_SP_LABEL_MISMATCH 1310 #define ER_SP_UNINIT_VAR 1311 #define ER_SP_BADSELECT 1312 #define ER_SP_BADRETURN 1313 #define ER_SP_BADSTATEMENT 1314 #define ER_UPDATE_LOG_DEPRECATED_IGNORED 1315 #define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1316 #define ER_QUERY_INTERRUPTED 1317 #define ER_SP_WRONG_NO_OF_ARGS 1318 #define ER_SP_COND_MISMATCH 1319 #define ER_SP_NORETURN 1320 #define ER_SP_NORETURNEND 1321 #define ER_SP_BAD_CURSOR_QUERY 1322 #define ER_SP_BAD_CURSOR_SELECT 1323 #define ER_SP_CURSOR_MISMATCH 1324 #define ER_SP_CURSOR_ALREADY_OPEN 1325 #define ER_SP_CURSOR_NOT_OPEN 1326 #define ER_SP_UNDECLARED_VAR 1327 #define ER_SP_WRONG_NO_OF_FETCH_ARGS 1328 #define ER_SP_FETCH_NO_DATA 1329 #define ER_SP_DUP_PARAM 1330 #define ER_SP_DUP_VAR 1331 #define ER_SP_DUP_COND 1332 #define ER_SP_DUP_CURS 1333 #define ER_SP_CANT_ALTER 1334 #define ER_SP_SUBSELECT_NYI 1335 #define ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG 1336 #define ER_SP_VARCOND_AFTER_CURSHNDLR 1337 #define ER_SP_CURSOR_AFTER_HANDLER 1338 #define ER_SP_CASE_NOT_FOUND 1339 #define ER_FPARSER_TOO_BIG_FILE 1340 #define ER_FPARSER_BAD_HEADER 1341 #define ER_FPARSER_EOF_IN_COMMENT 1342 #define ER_FPARSER_ERROR_IN_PARAMETER 1343 #define ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER 1344 #define ER_VIEW_NO_EXPLAIN 1345 #define ER_FRM_UNKNOWN_TYPE 1346 #define ER_WRONG_OBJECT 1347 #define ER_NONUPDATEABLE_COLUMN 1348 #define ER_VIEW_SELECT_DERIVED_UNUSED 1349 #define ER_VIEW_SELECT_CLAUSE 1350 #define ER_VIEW_SELECT_VARIABLE 1351 #define ER_VIEW_SELECT_TMPTABLE 1352 #define ER_VIEW_WRONG_LIST 1353 #define ER_WARN_VIEW_MERGE 1354 #define ER_WARN_VIEW_WITHOUT_KEY 1355 #define ER_VIEW_INVALID 1356 #define ER_SP_NO_DROP_SP 1357 #define ER_SP_GOTO_IN_HNDLR 1358 #define ER_TRG_ALREADY_EXISTS 1359 #define ER_TRG_DOES_NOT_EXIST 1360 #define ER_TRG_ON_VIEW_OR_TEMP_TABLE 1361 #define ER_TRG_CANT_CHANGE_ROW 1362 #define ER_TRG_NO_SUCH_ROW_IN_TRG 1363 #define ER_NO_DEFAULT_FOR_FIELD 1364 #define ER_DIVISION_BY_ZERO 1365 #define ER_TRUNCATED_WRONG_VALUE_FOR_FIELD 1366 #define ER_ILLEGAL_VALUE_FOR_TYPE 1367 #define ER_VIEW_NONUPD_CHECK 1368 #define ER_VIEW_CHECK_FAILED 1369 #define ER_PROCACCESS_DENIED_ERROR 1370 #define ER_RELAY_LOG_FAIL 1371 #define ER_PASSWD_LENGTH 1372 #define ER_UNKNOWN_TARGET_BINLOG 1373 #define ER_IO_ERR_LOG_INDEX_READ 1374 #define ER_BINLOG_PURGE_PROHIBITED 1375 #define ER_FSEEK_FAIL 1376 #define ER_BINLOG_PURGE_FATAL_ERR 1377 #define ER_LOG_IN_USE 1378 #define ER_LOG_PURGE_UNKNOWN_ERR 1379 #define ER_RELAY_LOG_INIT 1380 #define ER_NO_BINARY_LOGGING 1381 #define ER_RESERVED_SYNTAX 1382 #define ER_WSAS_FAILED 1383 #define ER_DIFF_GROUPS_PROC 1384 #define ER_NO_GROUP_FOR_PROC 1385 #define ER_ORDER_WITH_PROC 1386 #define ER_LOGGING_PROHIBIT_CHANGING_OF 1387 #define ER_NO_FILE_MAPPING 1388 #define ER_WRONG_MAGIC 1389 #define ER_PS_MANY_PARAM 1390 #define ER_KEY_PART_0 1391 #define ER_VIEW_CHECKSUM 1392 #define ER_VIEW_MULTIUPDATE 1393 #define ER_VIEW_NO_INSERT_FIELD_LIST 1394 #define ER_VIEW_DELETE_MERGE_VIEW 1395 #define ER_CANNOT_USER 1396 #define ER_XAER_NOTA 1397 #define ER_XAER_INVAL 1398 #define ER_XAER_RMFAIL 1399 #define ER_XAER_OUTSIDE 1400 #define ER_XAER_RMERR 1401 #define ER_XA_RBROLLBACK 1402 #define ER_NONEXISTING_PROC_GRANT 1403 #define ER_PROC_AUTO_GRANT_FAIL 1404 #define ER_PROC_AUTO_REVOKE_FAIL 1405 #define ER_DATA_TOO_LONG 1406 #define ER_SP_BAD_SQLSTATE 1407 #define ER_STARTUP 1408 #define ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR 1409 #define ER_CANT_CREATE_USER_WITH_GRANT 1410 #define ER_WRONG_VALUE_FOR_TYPE 1411 #define ER_TABLE_DEF_CHANGED 1412 #define ER_SP_DUP_HANDLER 1413 #define ER_SP_NOT_VAR_ARG 1414 #define ER_SP_NO_RETSET 1415 #define ER_CANT_CREATE_GEOMETRY_OBJECT 1416 #define ER_FAILED_ROUTINE_BREAK_BINLOG 1417 #define ER_BINLOG_UNSAFE_ROUTINE 1418 #define ER_BINLOG_CREATE_ROUTINE_NEED_SUPER 1419 #define ER_EXEC_STMT_WITH_OPEN_CURSOR 1420 #define ER_STMT_HAS_NO_OPEN_CURSOR 1421 #define ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG 1422 #define ER_NO_DEFAULT_FOR_VIEW_FIELD 1423 #define ER_SP_NO_RECURSION 1424 #define ER_TOO_BIG_SCALE 1425 #define ER_TOO_BIG_PRECISION 1426 #define ER_M_BIGGER_THAN_D 1427 #define ER_WRONG_LOCK_OF_SYSTEM_TABLE 1428 #define ER_CONNECT_TO_FOREIGN_DATA_SOURCE 1429 #define ER_QUERY_ON_FOREIGN_DATA_SOURCE 1430 #define ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST 1431 #define ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE 1432 #define ER_FOREIGN_DATA_STRING_INVALID 1433 #define ER_CANT_CREATE_FEDERATED_TABLE 1434 #define ER_TRG_IN_WRONG_SCHEMA 1435 #define ER_STACK_OVERRUN_NEED_MORE 1436 #define ER_TOO_LONG_BODY 1437 #define ER_WARN_CANT_DROP_DEFAULT_KEYCACHE 1438 #define ER_TOO_BIG_DISPLAYWIDTH 1439 #define ER_XAER_DUPID 1440 #define ER_DATETIME_FUNCTION_OVERFLOW 1441 #define ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG 1442 #define ER_VIEW_PREVENT_UPDATE 1443 #define ER_PS_NO_RECURSION 1444 #define ER_SP_CANT_SET_AUTOCOMMIT 1445 #define ER_MALFORMED_DEFINER 1446 #define ER_VIEW_FRM_NO_USER 1447 #define ER_VIEW_OTHER_USER 1448 #define ER_NO_SUCH_USER 1449 #define ER_FORBID_SCHEMA_CHANGE 1450 #define ER_ROW_IS_REFERENCED_2 1451 #define ER_NO_REFERENCED_ROW_2 1452 #define ER_SP_BAD_VAR_SHADOW 1453 #define ER_TRG_NO_DEFINER 1454 #define ER_OLD_FILE_FORMAT 1455 #define ER_SP_RECURSION_LIMIT 1456 #define ER_SP_PROC_TABLE_CORRUPT 1457 #define ER_SP_WRONG_NAME 1458 #define ER_TABLE_NEEDS_UPGRADE 1459 #define ER_SP_NO_AGGREGATE 1460 #define ER_MAX_PREPARED_STMT_COUNT_REACHED 1461 #define ER_VIEW_RECURSIVE 1462 #define ER_NON_GROUPING_FIELD_USED 1463 #define ER_TABLE_CANT_HANDLE_SPKEYS 1464 #define ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA 1465 #define ER_REMOVED_SPACES 1466 #define ER_AUTOINC_READ_FAILED 1467 #define ER_USERNAME 1468 #define ER_HOSTNAME 1469 #define ER_WRONG_STRING_LENGTH 1470 #define ER_NON_INSERTABLE_TABLE 1471 #define ER_ADMIN_WRONG_MRG_TABLE 1472 #define ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT 1473 #define ER_NAME_BECOMES_EMPTY 1474 #define ER_AMBIGUOUS_FIELD_TERM 1475 #define ER_FOREIGN_SERVER_EXISTS 1476 #define ER_FOREIGN_SERVER_DOESNT_EXIST 1477 #define ER_ILLEGAL_HA_CREATE_OPTION 1478 #define ER_PARTITION_REQUIRES_VALUES_ERROR 1479 #define ER_PARTITION_WRONG_VALUES_ERROR 1480 #define ER_PARTITION_MAXVALUE_ERROR 1481 #define ER_PARTITION_SUBPARTITION_ERROR 1482 #define ER_PARTITION_SUBPART_MIX_ERROR 1483 #define ER_PARTITION_WRONG_NO_PART_ERROR 1484 #define ER_PARTITION_WRONG_NO_SUBPART_ERROR 1485 #define ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR 1486 #define ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR 1487 #define ER_FIELD_NOT_FOUND_PART_ERROR 1488 #define ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR 1489 #define ER_INCONSISTENT_PARTITION_INFO_ERROR 1490 #define ER_PARTITION_FUNC_NOT_ALLOWED_ERROR 1491 #define ER_PARTITIONS_MUST_BE_DEFINED_ERROR 1492 #define ER_RANGE_NOT_INCREASING_ERROR 1493 #define ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR 1494 #define ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR 1495 #define ER_PARTITION_ENTRY_ERROR 1496 #define ER_MIX_HANDLER_ERROR 1497 #define ER_PARTITION_NOT_DEFINED_ERROR 1498 #define ER_TOO_MANY_PARTITIONS_ERROR 1499 #define ER_SUBPARTITION_ERROR 1500 #define ER_CANT_CREATE_HANDLER_FILE 1501 #define ER_BLOB_FIELD_IN_PART_FUNC_ERROR 1502 #define ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF 1503 #define ER_NO_PARTS_ERROR 1504 #define ER_PARTITION_MGMT_ON_NONPARTITIONED 1505 #define ER_FOREIGN_KEY_ON_PARTITIONED 1506 #define ER_DROP_PARTITION_NON_EXISTENT 1507 #define ER_DROP_LAST_PARTITION 1508 #define ER_COALESCE_ONLY_ON_HASH_PARTITION 1509 #define ER_REORG_HASH_ONLY_ON_SAME_NO 1510 #define ER_REORG_NO_PARAM_ERROR 1511 #define ER_ONLY_ON_RANGE_LIST_PARTITION 1512 #define ER_ADD_PARTITION_SUBPART_ERROR 1513 #define ER_ADD_PARTITION_NO_NEW_PARTITION 1514 #define ER_COALESCE_PARTITION_NO_PARTITION 1515 #define ER_REORG_PARTITION_NOT_EXIST 1516 #define ER_SAME_NAME_PARTITION 1517 #define ER_NO_BINLOG_ERROR 1518 #define ER_CONSECUTIVE_REORG_PARTITIONS 1519 #define ER_REORG_OUTSIDE_RANGE 1520 #define ER_PARTITION_FUNCTION_FAILURE 1521 #define ER_PART_STATE_ERROR 1522 #define ER_LIMITED_PART_RANGE 1523 #define ER_PLUGIN_IS_NOT_LOADED 1524 #define ER_WRONG_VALUE 1525 #define ER_NO_PARTITION_FOR_GIVEN_VALUE 1526 #define ER_FILEGROUP_OPTION_ONLY_ONCE 1527 #define ER_CREATE_FILEGROUP_FAILED 1528 #define ER_DROP_FILEGROUP_FAILED 1529 #define ER_TABLESPACE_AUTO_EXTEND_ERROR 1530 #define ER_WRONG_SIZE_NUMBER 1531 #define ER_SIZE_OVERFLOW_ERROR 1532 #define ER_ALTER_FILEGROUP_FAILED 1533 #define ER_BINLOG_ROW_LOGGING_FAILED 1534 #define ER_BINLOG_ROW_WRONG_TABLE_DEF 1535 #define ER_BINLOG_ROW_RBR_TO_SBR 1536 #define ER_EVENT_ALREADY_EXISTS 1537 #define ER_EVENT_STORE_FAILED 1538 #define ER_EVENT_DOES_NOT_EXIST 1539 #define ER_EVENT_CANT_ALTER 1540 #define ER_EVENT_DROP_FAILED 1541 #define ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG 1542 #define ER_EVENT_ENDS_BEFORE_STARTS 1543 #define ER_EVENT_EXEC_TIME_IN_THE_PAST 1544 #define ER_EVENT_OPEN_TABLE_FAILED 1545 #define ER_EVENT_NEITHER_M_EXPR_NOR_M_AT 1546 #define ER_OBSOLETE_COL_COUNT_DOESNT_MATCH_CORRUPTED 1547 #define ER_OBSOLETE_CANNOT_LOAD_FROM_TABLE 1548 #define ER_EVENT_CANNOT_DELETE 1549 #define ER_EVENT_COMPILE_ERROR 1550 #define ER_EVENT_SAME_NAME 1551 #define ER_EVENT_DATA_TOO_LONG 1552 #define ER_DROP_INDEX_FK 1553 #define ER_WARN_DEPRECATED_SYNTAX_WITH_VER 1554 #define ER_CANT_WRITE_LOCK_LOG_TABLE 1555 #define ER_CANT_LOCK_LOG_TABLE 1556 #define ER_FOREIGN_DUPLICATE_KEY_OLD_UNUSED 1557 #define ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE 1558 #define ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR 1559 #define ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT 1560 #define ER_NDB_CANT_SWITCH_BINLOG_FORMAT 1561 #define ER_PARTITION_NO_TEMPORARY 1562 #define ER_PARTITION_CONST_DOMAIN_ERROR 1563 #define ER_PARTITION_FUNCTION_IS_NOT_ALLOWED 1564 #define ER_DDL_LOG_ERROR 1565 #define ER_NULL_IN_VALUES_LESS_THAN 1566 #define ER_WRONG_PARTITION_NAME 1567 #define ER_CANT_CHANGE_TX_CHARACTERISTICS 1568 #define ER_DUP_ENTRY_AUTOINCREMENT_CASE 1569 #define ER_EVENT_MODIFY_QUEUE_ERROR 1570 #define ER_EVENT_SET_VAR_ERROR 1571 #define ER_PARTITION_MERGE_ERROR 1572 #define ER_CANT_ACTIVATE_LOG 1573 #define ER_RBR_NOT_AVAILABLE 1574 #define ER_BASE64_DECODE_ERROR 1575 #define ER_EVENT_RECURSION_FORBIDDEN 1576 #define ER_EVENTS_DB_ERROR 1577 #define ER_ONLY_INTEGERS_ALLOWED 1578 #define ER_UNSUPORTED_LOG_ENGINE 1579 #define ER_BAD_LOG_STATEMENT 1580 #define ER_CANT_RENAME_LOG_TABLE 1581 #define ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT 1582 #define ER_WRONG_PARAMETERS_TO_NATIVE_FCT 1583 #define ER_WRONG_PARAMETERS_TO_STORED_FCT 1584 #define ER_NATIVE_FCT_NAME_COLLISION 1585 #define ER_DUP_ENTRY_WITH_KEY_NAME 1586 #define ER_BINLOG_PURGE_EMFILE 1587 #define ER_EVENT_CANNOT_CREATE_IN_THE_PAST 1588 #define ER_EVENT_CANNOT_ALTER_IN_THE_PAST 1589 #define ER_SLAVE_INCIDENT 1590 #define ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT 1591 #define ER_BINLOG_UNSAFE_STATEMENT 1592 #define ER_SLAVE_FATAL_ERROR 1593 #define ER_SLAVE_RELAY_LOG_READ_FAILURE 1594 #define ER_SLAVE_RELAY_LOG_WRITE_FAILURE 1595 #define ER_SLAVE_CREATE_EVENT_FAILURE 1596 #define ER_SLAVE_MASTER_COM_FAILURE 1597 #define ER_BINLOG_LOGGING_IMPOSSIBLE 1598 #define ER_VIEW_NO_CREATION_CTX 1599 #define ER_VIEW_INVALID_CREATION_CTX 1600 #define ER_SR_INVALID_CREATION_CTX 1601 #define ER_TRG_CORRUPTED_FILE 1602 #define ER_TRG_NO_CREATION_CTX 1603 #define ER_TRG_INVALID_CREATION_CTX 1604 #define ER_EVENT_INVALID_CREATION_CTX 1605 #define ER_TRG_CANT_OPEN_TABLE 1606 #define ER_CANT_CREATE_SROUTINE 1607 #define ER_NEVER_USED 1608 #define ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT 1609 #define ER_SLAVE_CORRUPT_EVENT 1610 #define ER_LOAD_DATA_INVALID_COLUMN_UNUSED 1611 #define ER_LOG_PURGE_NO_FILE 1612 #define ER_XA_RBTIMEOUT 1613 #define ER_XA_RBDEADLOCK 1614 #define ER_NEED_REPREPARE 1615 #define ER_DELAYED_NOT_SUPPORTED 1616 #define WARN_NO_MASTER_INFO 1617 #define WARN_OPTION_IGNORED 1618 #define ER_PLUGIN_DELETE_BUILTIN 1619 #define WARN_PLUGIN_BUSY 1620 #define ER_VARIABLE_IS_READONLY 1621 #define ER_WARN_ENGINE_TRANSACTION_ROLLBACK 1622 #define ER_SLAVE_HEARTBEAT_FAILURE 1623 #define ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE 1624 #define ER_NDB_REPLICATION_SCHEMA_ERROR 1625 #define ER_CONFLICT_FN_PARSE_ERROR 1626 #define ER_EXCEPTIONS_WRITE_ERROR 1627 #define ER_TOO_LONG_TABLE_COMMENT 1628 #define ER_TOO_LONG_FIELD_COMMENT 1629 #define ER_FUNC_INEXISTENT_NAME_COLLISION 1630 #define ER_DATABASE_NAME 1631 #define ER_TABLE_NAME 1632 #define ER_PARTITION_NAME 1633 #define ER_SUBPARTITION_NAME 1634 #define ER_TEMPORARY_NAME 1635 #define ER_RENAMED_NAME 1636 #define ER_TOO_MANY_CONCURRENT_TRXS 1637 #define WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED 1638 #define ER_DEBUG_SYNC_TIMEOUT 1639 #define ER_DEBUG_SYNC_HIT_LIMIT 1640 #define ER_DUP_SIGNAL_SET 1641 #define ER_SIGNAL_WARN 1642 #define ER_SIGNAL_NOT_FOUND 1643 #define ER_SIGNAL_EXCEPTION 1644 #define ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER 1645 #define ER_SIGNAL_BAD_CONDITION_TYPE 1646 #define WARN_COND_ITEM_TRUNCATED 1647 #define ER_COND_ITEM_TOO_LONG 1648 #define ER_UNKNOWN_LOCALE 1649 #define ER_SLAVE_IGNORE_SERVER_IDS 1650 #define ER_QUERY_CACHE_DISABLED 1651 #define ER_SAME_NAME_PARTITION_FIELD 1652 #define ER_PARTITION_COLUMN_LIST_ERROR 1653 #define ER_WRONG_TYPE_COLUMN_VALUE_ERROR 1654 #define ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR 1655 #define ER_MAXVALUE_IN_VALUES_IN 1656 #define ER_TOO_MANY_VALUES_ERROR 1657 #define ER_ROW_SINGLE_PARTITION_FIELD_ERROR 1658 #define ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD 1659 #define ER_PARTITION_FIELDS_TOO_LONG 1660 #define ER_BINLOG_ROW_ENGINE_AND_STMT_ENGINE 1661 #define ER_BINLOG_ROW_MODE_AND_STMT_ENGINE 1662 #define ER_BINLOG_UNSAFE_AND_STMT_ENGINE 1663 #define ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE 1664 #define ER_BINLOG_STMT_MODE_AND_ROW_ENGINE 1665 #define ER_BINLOG_ROW_INJECTION_AND_STMT_MODE 1666 #define ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE 1667 #define ER_BINLOG_UNSAFE_LIMIT 1668 #define ER_UNUSED4 1669 #define ER_BINLOG_UNSAFE_SYSTEM_TABLE 1670 #define ER_BINLOG_UNSAFE_AUTOINC_COLUMNS 1671 #define ER_BINLOG_UNSAFE_UDF 1672 #define ER_BINLOG_UNSAFE_SYSTEM_VARIABLE 1673 #define ER_BINLOG_UNSAFE_SYSTEM_FUNCTION 1674 #define ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS 1675 #define ER_MESSAGE_AND_STATEMENT 1676 #define ER_SLAVE_CONVERSION_FAILED 1677 #define ER_SLAVE_CANT_CREATE_CONVERSION 1678 #define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT 1679 #define ER_PATH_LENGTH 1680 #define ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT 1681 #define ER_WRONG_NATIVE_TABLE_STRUCTURE 1682 #define ER_WRONG_PERFSCHEMA_USAGE 1683 #define ER_WARN_I_S_SKIPPED_TABLE 1684 #define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT 1685 #define ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT 1686 #define ER_SPATIAL_MUST_HAVE_GEOM_COL 1687 #define ER_TOO_LONG_INDEX_COMMENT 1688 #define ER_LOCK_ABORTED 1689 #define ER_DATA_OUT_OF_RANGE 1690 #define ER_WRONG_SPVAR_TYPE_IN_LIMIT 1691 #define ER_BINLOG_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE 1692 #define ER_BINLOG_UNSAFE_MIXED_STATEMENT 1693 #define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN 1694 #define ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN 1695 #define ER_FAILED_READ_FROM_PAR_FILE 1696 #define ER_VALUES_IS_NOT_INT_TYPE_ERROR 1697 #define ER_ACCESS_DENIED_NO_PASSWORD_ERROR 1698 #define ER_SET_PASSWORD_AUTH_PLUGIN 1699 #define ER_GRANT_PLUGIN_USER_EXISTS 1700 #define ER_TRUNCATE_ILLEGAL_FK 1701 #define ER_PLUGIN_IS_PERMANENT 1702 #define ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN 1703 #define ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX 1704 #define ER_STMT_CACHE_FULL 1705 #define ER_MULTI_UPDATE_KEY_CONFLICT 1706 #define ER_TABLE_NEEDS_REBUILD 1707 #define WARN_OPTION_BELOW_LIMIT 1708 #define ER_INDEX_COLUMN_TOO_LONG 1709 #define ER_ERROR_IN_TRIGGER_BODY 1710 #define ER_ERROR_IN_UNKNOWN_TRIGGER_BODY 1711 #define ER_INDEX_CORRUPT 1712 #define ER_UNDO_RECORD_TOO_BIG 1713 #define ER_BINLOG_UNSAFE_INSERT_IGNORE_SELECT 1714 #define ER_BINLOG_UNSAFE_INSERT_SELECT_UPDATE 1715 #define ER_BINLOG_UNSAFE_REPLACE_SELECT 1716 #define ER_BINLOG_UNSAFE_CREATE_IGNORE_SELECT 1717 #define ER_BINLOG_UNSAFE_CREATE_REPLACE_SELECT 1718 #define ER_BINLOG_UNSAFE_UPDATE_IGNORE 1719 #define ER_PLUGIN_NO_UNINSTALL 1720 #define ER_PLUGIN_NO_INSTALL 1721 #define ER_BINLOG_UNSAFE_WRITE_AUTOINC_SELECT 1722 #define ER_BINLOG_UNSAFE_CREATE_SELECT_AUTOINC 1723 #define ER_BINLOG_UNSAFE_INSERT_TWO_KEYS 1724 #define ER_TABLE_IN_FK_CHECK 1725 #define ER_UNSUPPORTED_ENGINE 1726 #define ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST 1727 #define ER_CANNOT_LOAD_FROM_TABLE_V2 1728 #define ER_MASTER_DELAY_VALUE_OUT_OF_RANGE 1729 #define ER_ONLY_FD_AND_RBR_EVENTS_ALLOWED_IN_BINLOG_STATEMENT 1730 #define ER_PARTITION_EXCHANGE_DIFFERENT_OPTION 1731 #define ER_PARTITION_EXCHANGE_PART_TABLE 1732 #define ER_PARTITION_EXCHANGE_TEMP_TABLE 1733 #define ER_PARTITION_INSTEAD_OF_SUBPARTITION 1734 #define ER_UNKNOWN_PARTITION 1735 #define ER_TABLES_DIFFERENT_METADATA 1736 #define ER_ROW_DOES_NOT_MATCH_PARTITION 1737 #define ER_BINLOG_CACHE_SIZE_GREATER_THAN_MAX 1738 #define ER_WARN_INDEX_NOT_APPLICABLE 1739 #define ER_PARTITION_EXCHANGE_FOREIGN_KEY 1740 #define ER_NO_SUCH_KEY_VALUE 1741 #define ER_RPL_INFO_DATA_TOO_LONG 1742 #define ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE 1743 #define ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE 1744 #define ER_BINLOG_STMT_CACHE_SIZE_GREATER_THAN_MAX 1745 #define ER_CANT_UPDATE_TABLE_IN_CREATE_TABLE_SELECT 1746 #define ER_PARTITION_CLAUSE_ON_NONPARTITIONED 1747 #define ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET 1748 #define ER_NO_SUCH_PARTITION__UNUSED 1749 #define ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE 1750 #define ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_CREATED_TEMP_TABLE 1751 #define ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_DROPPED_TEMP_TABLE 1752 #define ER_MTS_FEATURE_IS_NOT_SUPPORTED 1753 #define ER_MTS_UPDATED_DBS_GREATER_MAX 1754 #define ER_MTS_CANT_PARALLEL 1755 #define ER_MTS_INCONSISTENT_DATA 1756 #define ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING 1757 #define ER_DA_INVALID_CONDITION_NUMBER 1758 #define ER_INSECURE_PLAIN_TEXT 1759 #define ER_INSECURE_CHANGE_MASTER 1760 #define ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO 1761 #define ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO 1762 #define ER_SQLTHREAD_WITH_SECURE_SLAVE 1763 #define ER_TABLE_HAS_NO_FT 1764 #define ER_VARIABLE_NOT_SETTABLE_IN_SF_OR_TRIGGER 1765 #define ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION 1766 #define ER_GTID_NEXT_IS_NOT_IN_GTID_NEXT_LIST 1767 #define ER_CANT_CHANGE_GTID_NEXT_IN_TRANSACTION 1768 #define ER_SET_STATEMENT_CANNOT_INVOKE_FUNCTION 1769 #define ER_GTID_NEXT_CANT_BE_AUTOMATIC_IF_GTID_NEXT_LIST_IS_NON_NULL 1770 #define ER_SKIPPING_LOGGED_TRANSACTION 1771 #define ER_MALFORMED_GTID_SET_SPECIFICATION 1772 #define ER_MALFORMED_GTID_SET_ENCODING 1773 #define ER_MALFORMED_GTID_SPECIFICATION 1774 #define ER_GNO_EXHAUSTED 1775 #define ER_BAD_SLAVE_AUTO_POSITION 1776 #define ER_AUTO_POSITION_REQUIRES_GTID_MODE_NOT_OFF 1777 #define ER_CANT_DO_IMPLICIT_COMMIT_IN_TRX_WHEN_GTID_NEXT_IS_SET 1778 #define ER_GTID_MODE_ON_REQUIRES_ENFORCE_GTID_CONSISTENCY_ON 1779 #define ER_GTID_MODE_REQUIRES_BINLOG 1780 #define ER_CANT_SET_GTID_NEXT_TO_GTID_WHEN_GTID_MODE_IS_OFF 1781 #define ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON 1782 #define ER_CANT_SET_GTID_NEXT_LIST_TO_NON_NULL_WHEN_GTID_MODE_IS_OFF 1783 #define ER_FOUND_GTID_EVENT_WHEN_GTID_MODE_IS_OFF__UNUSED 1784 #define ER_GTID_UNSAFE_NON_TRANSACTIONAL_TABLE 1785 #define ER_GTID_UNSAFE_CREATE_SELECT 1786 #define ER_GTID_UNSAFE_CREATE_DROP_TEMPORARY_TABLE_IN_TRANSACTION 1787 #define ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME 1788 #define ER_MASTER_HAS_PURGED_REQUIRED_GTIDS 1789 #define ER_CANT_SET_GTID_NEXT_WHEN_OWNING_GTID 1790 #define ER_UNKNOWN_EXPLAIN_FORMAT 1791 #define ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION 1792 #define ER_TOO_LONG_TABLE_PARTITION_COMMENT 1793 #define ER_SLAVE_CONFIGURATION 1794 #define ER_INNODB_FT_LIMIT 1795 #define ER_INNODB_NO_FT_TEMP_TABLE 1796 #define ER_INNODB_FT_WRONG_DOCID_COLUMN 1797 #define ER_INNODB_FT_WRONG_DOCID_INDEX 1798 #define ER_INNODB_ONLINE_LOG_TOO_BIG 1799 #define ER_UNKNOWN_ALTER_ALGORITHM 1800 #define ER_UNKNOWN_ALTER_LOCK 1801 #define ER_MTS_CHANGE_MASTER_CANT_RUN_WITH_GAPS 1802 #define ER_MTS_RECOVERY_FAILURE 1803 #define ER_MTS_RESET_WORKERS 1804 #define ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2 1805 #define ER_SLAVE_SILENT_RETRY_TRANSACTION 1806 #define ER_DISCARD_FK_CHECKS_RUNNING 1807 #define ER_TABLE_SCHEMA_MISMATCH 1808 #define ER_TABLE_IN_SYSTEM_TABLESPACE 1809 #define ER_IO_READ_ERROR 1810 #define ER_IO_WRITE_ERROR 1811 #define ER_TABLESPACE_MISSING 1812 #define ER_TABLESPACE_EXISTS 1813 #define ER_TABLESPACE_DISCARDED 1814 #define ER_INTERNAL_ERROR 1815 #define ER_INNODB_IMPORT_ERROR 1816 #define ER_INNODB_INDEX_CORRUPT 1817 #define ER_INVALID_YEAR_COLUMN_LENGTH 1818 #define ER_NOT_VALID_PASSWORD 1819 #define ER_MUST_CHANGE_PASSWORD 1820 #define ER_FK_NO_INDEX_CHILD 1821 #define ER_FK_NO_INDEX_PARENT 1822 #define ER_FK_FAIL_ADD_SYSTEM 1823 #define ER_FK_CANNOT_OPEN_PARENT 1824 #define ER_FK_INCORRECT_OPTION 1825 #define ER_FK_DUP_NAME 1826 #define ER_PASSWORD_FORMAT 1827 #define ER_FK_COLUMN_CANNOT_DROP 1828 #define ER_FK_COLUMN_CANNOT_DROP_CHILD 1829 #define ER_FK_COLUMN_NOT_NULL 1830 #define ER_DUP_INDEX 1831 #define ER_FK_COLUMN_CANNOT_CHANGE 1832 #define ER_FK_COLUMN_CANNOT_CHANGE_CHILD 1833 #define ER_UNUSED5 1834 #define ER_MALFORMED_PACKET 1835 #define ER_READ_ONLY_MODE 1836 #define ER_GTID_NEXT_TYPE_UNDEFINED_GROUP 1837 #define ER_VARIABLE_NOT_SETTABLE_IN_SP 1838 #define ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF 1839 #define ER_CANT_SET_GTID_PURGED_WHEN_GTID_EXECUTED_IS_NOT_EMPTY 1840 #define ER_CANT_SET_GTID_PURGED_WHEN_OWNED_GTIDS_IS_NOT_EMPTY 1841 #define ER_GTID_PURGED_WAS_CHANGED 1842 #define ER_GTID_EXECUTED_WAS_CHANGED 1843 #define ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES 1844 #define ER_ALTER_OPERATION_NOT_SUPPORTED 1845 #define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON 1846 #define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COPY 1847 #define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_PARTITION 1848 #define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME 1849 #define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COLUMN_TYPE 1850 #define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_CHECK 1851 #define ER_UNUSED6 1852 #define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOPK 1853 #define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_AUTOINC 1854 #define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_HIDDEN_FTS 1855 #define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_CHANGE_FTS 1856 #define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS 1857 #define ER_SQL_SLAVE_SKIP_COUNTER_NOT_SETTABLE_IN_GTID_MODE 1858 #define ER_DUP_UNKNOWN_IN_INDEX 1859 #define ER_IDENT_CAUSES_TOO_LONG_PATH 1860 #define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL 1861 #define ER_MUST_CHANGE_PASSWORD_LOGIN 1862 #define ER_ROW_IN_WRONG_PARTITION 1863 #define ER_MTS_EVENT_BIGGER_PENDING_JOBS_SIZE_MAX 1864 #define ER_INNODB_NO_FT_USES_PARSER 1865 #define ER_BINLOG_LOGICAL_CORRUPTION 1866 #define ER_WARN_PURGE_LOG_IN_USE 1867 #define ER_WARN_PURGE_LOG_IS_ACTIVE 1868 #define ER_AUTO_INCREMENT_CONFLICT 1869 #define WARN_ON_BLOCKHOLE_IN_RBR 1870 #define ER_SLAVE_MI_INIT_REPOSITORY 1871 #define ER_SLAVE_RLI_INIT_REPOSITORY 1872 #define ER_ACCESS_DENIED_CHANGE_USER_ERROR 1873 #define ER_INNODB_READ_ONLY 1874 #define ER_STOP_SLAVE_SQL_THREAD_TIMEOUT 1875 #define ER_STOP_SLAVE_IO_THREAD_TIMEOUT 1876 #define ER_TABLE_CORRUPT 1877 #define ER_TEMP_FILE_WRITE_FAILURE 1878 #define ER_INNODB_FT_AUX_NOT_HEX_ID 1879 #define ER_OLD_TEMPORALS_UPGRADED 1880 #define ER_INNODB_FORCED_RECOVERY 1881 #define ER_AES_INVALID_IV 1882 #define ER_PLUGIN_CANNOT_BE_UNINSTALLED 1883 #define ER_GTID_UNSAFE_BINLOG_SPLITTABLE_STATEMENT_AND_GTID_GROUP 1884 #define ER_SLAVE_HAS_MORE_GTIDS_THAN_MASTER 1885 #define ER_MISSING_KEY 1886 #define ER_FILE_CORRUPT 3000 #define ER_ERROR_ON_MASTER 3001 #define ER_INCONSISTENT_ERROR 3002 #define ER_STORAGE_ENGINE_NOT_LOADED 3003 #define ER_GET_STACKED_DA_WITHOUT_ACTIVE_HANDLER 3004 #define ER_WARN_LEGACY_SYNTAX_CONVERTED 3005 #define ER_BINLOG_UNSAFE_FULLTEXT_PLUGIN 3006 #define ER_CANNOT_DISCARD_TEMPORARY_TABLE 3007 #define ER_FK_DEPTH_EXCEEDED 3008 #define ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE_V2 3009 #define ER_WARN_TRIGGER_DOESNT_HAVE_CREATED 3010 #define ER_REFERENCED_TRG_DOES_NOT_EXIST 3011 #define ER_EXPLAIN_NOT_SUPPORTED 3012 #define ER_INVALID_FIELD_SIZE 3013 #define ER_MISSING_HA_CREATE_OPTION 3014 #define ER_ENGINE_OUT_OF_MEMORY 3015 #define ER_PASSWORD_EXPIRE_ANONYMOUS_USER 3016 #define ER_SLAVE_SQL_THREAD_MUST_STOP 3017 #define ER_NO_FT_MATERIALIZED_SUBQUERY 3018 #define ER_INNODB_UNDO_LOG_FULL 3019 #define ER_INVALID_ARGUMENT_FOR_LOGARITHM 3020 #define ER_SLAVE_CHANNEL_IO_THREAD_MUST_STOP 3021 #define ER_WARN_OPEN_TEMP_TABLES_MUST_BE_ZERO 3022 #define ER_WARN_ONLY_MASTER_LOG_FILE_NO_POS 3023 #define ER_QUERY_TIMEOUT 3024 #define ER_NON_RO_SELECT_DISABLE_TIMER 3025 #define ER_DUP_LIST_ENTRY 3026 #define ER_SQL_MODE_NO_EFFECT 3027 #define ER_AGGREGATE_ORDER_FOR_UNION 3028 #define ER_AGGREGATE_ORDER_NON_AGG_QUERY 3029 #define ER_SLAVE_WORKER_STOPPED_PREVIOUS_THD_ERROR 3030 #define ER_DONT_SUPPORT_SLAVE_PRESERVE_COMMIT_ORDER 3031 #define ER_SERVER_OFFLINE_MODE 3032 #define ER_GIS_DIFFERENT_SRIDS 3033 #define ER_GIS_UNSUPPORTED_ARGUMENT 3034 #define ER_GIS_UNKNOWN_ERROR 3035 #define ER_GIS_UNKNOWN_EXCEPTION 3036 #define ER_GIS_INVALID_DATA 3037 #define ER_BOOST_GEOMETRY_EMPTY_INPUT_EXCEPTION 3038 #define ER_BOOST_GEOMETRY_CENTROID_EXCEPTION 3039 #define ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION 3040 #define ER_BOOST_GEOMETRY_TURN_INFO_EXCEPTION 3041 #define ER_BOOST_GEOMETRY_SELF_INTERSECTION_POINT_EXCEPTION 3042 #define ER_BOOST_GEOMETRY_UNKNOWN_EXCEPTION 3043 #define ER_STD_BAD_ALLOC_ERROR 3044 #define ER_STD_DOMAIN_ERROR 3045 #define ER_STD_LENGTH_ERROR 3046 #define ER_STD_INVALID_ARGUMENT 3047 #define ER_STD_OUT_OF_RANGE_ERROR 3048 #define ER_STD_OVERFLOW_ERROR 3049 #define ER_STD_RANGE_ERROR 3050 #define ER_STD_UNDERFLOW_ERROR 3051 #define ER_STD_LOGIC_ERROR 3052 #define ER_STD_RUNTIME_ERROR 3053 #define ER_STD_UNKNOWN_EXCEPTION 3054 #define ER_GIS_DATA_WRONG_ENDIANESS 3055 #define ER_CHANGE_MASTER_PASSWORD_LENGTH 3056 #define ER_USER_LOCK_WRONG_NAME 3057 #define ER_USER_LOCK_DEADLOCK 3058 #define ER_REPLACE_INACCESSIBLE_ROWS 3059 #define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS 3060 #define ER_ILLEGAL_USER_VAR 3061 #define ER_GTID_MODE_OFF 3062 #define ER_UNSUPPORTED_BY_REPLICATION_THREAD 3063 #define ER_INCORRECT_TYPE 3064 #define ER_FIELD_IN_ORDER_NOT_SELECT 3065 #define ER_AGGREGATE_IN_ORDER_NOT_SELECT 3066 #define ER_INVALID_RPL_WILD_TABLE_FILTER_PATTERN 3067 #define ER_NET_OK_PACKET_TOO_LARGE 3068 #define ER_INVALID_JSON_DATA 3069 #define ER_INVALID_GEOJSON_MISSING_MEMBER 3070 #define ER_INVALID_GEOJSON_WRONG_TYPE 3071 #define ER_INVALID_GEOJSON_UNSPECIFIED 3072 #define ER_DIMENSION_UNSUPPORTED 3073 #define ER_SLAVE_CHANNEL_DOES_NOT_EXIST 3074 #define ER_SLAVE_MULTIPLE_CHANNELS_HOST_PORT 3075 #define ER_SLAVE_CHANNEL_NAME_INVALID_OR_TOO_LONG 3076 #define ER_SLAVE_NEW_CHANNEL_WRONG_REPOSITORY 3077 #define ER_SLAVE_CHANNEL_DELETE 3078 #define ER_SLAVE_MULTIPLE_CHANNELS_CMD 3079 #define ER_SLAVE_MAX_CHANNELS_EXCEEDED 3080 #define ER_SLAVE_CHANNEL_MUST_STOP 3081 #define ER_SLAVE_CHANNEL_NOT_RUNNING 3082 #define ER_SLAVE_CHANNEL_WAS_RUNNING 3083 #define ER_SLAVE_CHANNEL_WAS_NOT_RUNNING 3084 #define ER_SLAVE_CHANNEL_SQL_THREAD_MUST_STOP 3085 #define ER_SLAVE_CHANNEL_SQL_SKIP_COUNTER 3086 #define ER_WRONG_FIELD_WITH_GROUP_V2 3087 #define ER_MIX_OF_GROUP_FUNC_AND_FIELDS_V2 3088 #define ER_WARN_DEPRECATED_SYSVAR_UPDATE 3089 #define ER_WARN_DEPRECATED_SQLMODE 3090 #define ER_CANNOT_LOG_PARTIAL_DROP_DATABASE_WITH_GTID 3091 #define ER_GROUP_REPLICATION_CONFIGURATION 3092 #define ER_GROUP_REPLICATION_RUNNING 3093 #define ER_GROUP_REPLICATION_APPLIER_INIT_ERROR 3094 #define ER_GROUP_REPLICATION_STOP_APPLIER_THREAD_TIMEOUT 3095 #define ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR 3096 #define ER_GROUP_REPLICATION_COMMUNICATION_LAYER_JOIN_ERROR 3097 #define ER_BEFORE_DML_VALIDATION_ERROR 3098 #define ER_PREVENTS_VARIABLE_WITHOUT_RBR 3099 #define ER_RUN_HOOK_ERROR 3100 #define ER_TRANSACTION_ROLLBACK_DURING_COMMIT 3101 #define ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED 3102 #define ER_UNSUPPORTED_ALTER_INPLACE_ON_VIRTUAL_COLUMN 3103 #define ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN 3104 #define ER_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN 3105 #define ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN 3106 #define ER_GENERATED_COLUMN_NON_PRIOR 3107 #define ER_DEPENDENT_BY_GENERATED_COLUMN 3108 #define ER_GENERATED_COLUMN_REF_AUTO_INC 3109 #define ER_FEATURE_NOT_AVAILABLE 3110 #define ER_CANT_SET_GTID_MODE 3111 #define ER_CANT_USE_AUTO_POSITION_WITH_GTID_MODE_OFF 3112 #define ER_CANT_REPLICATE_ANONYMOUS_WITH_AUTO_POSITION 3113 #define ER_CANT_REPLICATE_ANONYMOUS_WITH_GTID_MODE_ON 3114 #define ER_CANT_REPLICATE_GTID_WITH_GTID_MODE_OFF 3115 #define ER_CANT_SET_ENFORCE_GTID_CONSISTENCY_ON_WITH_ONGOING_GTID_VIOLATING_TRANSACTIONS 3116 #define ER_SET_ENFORCE_GTID_CONSISTENCY_WARN_WITH_ONGOING_GTID_VIOLATING_TRANSACTIONS 3117 #define ER_ACCOUNT_HAS_BEEN_LOCKED 3118 #define ER_WRONG_TABLESPACE_NAME 3119 #define ER_TABLESPACE_IS_NOT_EMPTY 3120 #define ER_WRONG_FILE_NAME 3121 #define ER_BOOST_GEOMETRY_INCONSISTENT_TURNS_EXCEPTION 3122 #define ER_WARN_OPTIMIZER_HINT_SYNTAX_ERROR 3123 #define ER_WARN_BAD_MAX_EXECUTION_TIME 3124 #define ER_WARN_UNSUPPORTED_MAX_EXECUTION_TIME 3125 #define ER_WARN_CONFLICTING_HINT 3126 #define ER_WARN_UNKNOWN_QB_NAME 3127 #define ER_UNRESOLVED_HINT_NAME 3128 #define ER_WARN_ON_MODIFYING_GTID_EXECUTED_TABLE 3129 #define ER_PLUGGABLE_PROTOCOL_COMMAND_NOT_SUPPORTED 3130 #define ER_LOCKING_SERVICE_WRONG_NAME 3131 #define ER_LOCKING_SERVICE_DEADLOCK 3132 #define ER_LOCKING_SERVICE_TIMEOUT 3133 #define ER_GIS_MAX_POINTS_IN_GEOMETRY_OVERFLOWED 3134 #define ER_SQL_MODE_MERGED 3135 #define ER_VTOKEN_PLUGIN_TOKEN_MISMATCH 3136 #define ER_VTOKEN_PLUGIN_TOKEN_NOT_FOUND 3137 #define ER_CANT_SET_VARIABLE_WHEN_OWNING_GTID 3138 #define ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED 3139 #define ER_INVALID_JSON_TEXT 3140 #define ER_INVALID_JSON_TEXT_IN_PARAM 3141 #define ER_INVALID_JSON_BINARY_DATA 3142 #define ER_INVALID_JSON_PATH 3143 #define ER_INVALID_JSON_CHARSET 3144 #define ER_INVALID_JSON_CHARSET_IN_FUNCTION 3145 #define ER_INVALID_TYPE_FOR_JSON 3146 #define ER_INVALID_CAST_TO_JSON 3147 #define ER_INVALID_JSON_PATH_CHARSET 3148 #define ER_INVALID_JSON_PATH_WILDCARD 3149 #define ER_JSON_VALUE_TOO_BIG 3150 #define ER_JSON_KEY_TOO_BIG 3151 #define ER_JSON_USED_AS_KEY 3152 #define ER_JSON_VACUOUS_PATH 3153 #define ER_JSON_BAD_ONE_OR_ALL_ARG 3154 #define ER_NUMERIC_JSON_VALUE_OUT_OF_RANGE 3155 #define ER_INVALID_JSON_VALUE_FOR_CAST 3156 #define ER_JSON_DOCUMENT_TOO_DEEP 3157 #define ER_JSON_DOCUMENT_NULL_KEY 3158 #define ER_SECURE_TRANSPORT_REQUIRED 3159 #define ER_NO_SECURE_TRANSPORTS_CONFIGURED 3160 #define ER_DISABLED_STORAGE_ENGINE 3161 #define ER_USER_DOES_NOT_EXIST 3162 #define ER_USER_ALREADY_EXISTS 3163 #define ER_AUDIT_API_ABORT 3164 #define ER_INVALID_JSON_PATH_ARRAY_CELL 3165 #define ER_BUFPOOL_RESIZE_INPROGRESS 3166 #define ER_FEATURE_DISABLED_SEE_DOC 3167 #define ER_SERVER_ISNT_AVAILABLE 3168 #define ER_SESSION_WAS_KILLED 3169 #define ER_CAPACITY_EXCEEDED 3170 #define ER_CAPACITY_EXCEEDED_IN_RANGE_OPTIMIZER 3171 #define ER_TABLE_NEEDS_UPG_PART 3172 #define ER_CANT_WAIT_FOR_EXECUTED_GTID_SET_WHILE_OWNING_A_GTID 3173 #define ER_CANNOT_ADD_FOREIGN_BASE_COL_VIRTUAL 3174 #define ER_CANNOT_CREATE_VIRTUAL_INDEX_CONSTRAINT 3175 #define ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE 3176 #define ER_LOCK_REFUSED_BY_ENGINE 3177 #define ER_UNSUPPORTED_ALTER_ONLINE_ON_VIRTUAL_COLUMN 3178 #define ER_MASTER_KEY_ROTATION_NOT_SUPPORTED_BY_SE 3179 #define ER_MASTER_KEY_ROTATION_ERROR_BY_SE 3180 #define ER_MASTER_KEY_ROTATION_BINLOG_FAILED 3181 #define ER_MASTER_KEY_ROTATION_SE_UNAVAILABLE 3182 #define ER_TABLESPACE_CANNOT_ENCRYPT 3183 #define ER_INVALID_ENCRYPTION_OPTION 3184 #define ER_CANNOT_FIND_KEY_IN_KEYRING 3185 #define ER_CAPACITY_EXCEEDED_IN_PARSER 3186 #define ER_UNSUPPORTED_ALTER_ENCRYPTION_INPLACE 3187 #define ER_KEYRING_UDF_KEYRING_SERVICE_ERROR 3188 #define ER_USER_COLUMN_OLD_LENGTH 3189 #define ER_CANT_RESET_MASTER 3190 #define ER_GROUP_REPLICATION_MAX_GROUP_SIZE 3191 #define ER_CANNOT_ADD_FOREIGN_BASE_COL_STORED 3192 #define ER_TABLE_REFERENCED 3193 #define ER_PARTITION_ENGINE_DEPRECATED_FOR_TABLE 3194 #define ER_WARN_USING_GEOMFROMWKB_TO_SET_SRID_ZERO 3195 #define ER_WARN_USING_GEOMFROMWKB_TO_SET_SRID 3196 #define ER_XA_RETRY 3197 #define ER_KEYRING_AWS_UDF_AWS_KMS_ERROR 3198 #define ER_BINLOG_UNSAFE_XA 3199 #define ER_UDF_ERROR 3200 #define ER_KEYRING_MIGRATION_FAILURE 3201 #define ER_KEYRING_ACCESS_DENIED_ERROR 3202 #define ER_KEYRING_MIGRATION_STATUS 3203 #define ER_PLUGIN_FAILED_TO_OPEN_TABLES 3204 #define ER_PLUGIN_FAILED_TO_OPEN_TABLE 3205 #define ER_AUDIT_LOG_NO_KEYRING_PLUGIN_INSTALLED 3206 #define ER_AUDIT_LOG_ENCRYPTION_PASSWORD_HAS_NOT_BEEN_SET 3207 #define ER_AUDIT_LOG_COULD_NOT_CREATE_AES_KEY 3208 #define ER_AUDIT_LOG_ENCRYPTION_PASSWORD_CANNOT_BE_FETCHED 3209 #define ER_AUDIT_LOG_JSON_FILTERING_NOT_ENABLED 3210 #define ER_AUDIT_LOG_UDF_INSUFFICIENT_PRIVILEGE 3211 #define ER_AUDIT_LOG_SUPER_PRIVILEGE_REQUIRED 3212 #define ER_COULD_NOT_REINITIALIZE_AUDIT_LOG_FILTERS 3213 #define ER_AUDIT_LOG_UDF_INVALID_ARGUMENT_TYPE 3214 #define ER_AUDIT_LOG_UDF_INVALID_ARGUMENT_COUNT 3215 #define ER_AUDIT_LOG_HAS_NOT_BEEN_INSTALLED 3216 #define ER_AUDIT_LOG_UDF_READ_INVALID_MAX_ARRAY_LENGTH_ARG_TYPE 3217 #define ER_AUDIT_LOG_UDF_READ_INVALID_MAX_ARRAY_LENGTH_ARG_VALUE 3218 #define ER_AUDIT_LOG_JSON_FILTER_PARSING_ERROR 3219 #define ER_AUDIT_LOG_JSON_FILTER_NAME_CANNOT_BE_EMPTY 3220 #define ER_AUDIT_LOG_JSON_USER_NAME_CANNOT_BE_EMPTY 3221 #define ER_AUDIT_LOG_JSON_FILTER_DOES_NOT_EXISTS 3222 #define ER_AUDIT_LOG_USER_FIRST_CHARACTER_MUST_BE_ALPHANUMERIC 3223 #define ER_AUDIT_LOG_USER_NAME_INVALID_CHARACTER 3224 #define ER_AUDIT_LOG_HOST_NAME_INVALID_CHARACTER 3225 #define WARN_DEPRECATED_MAXDB_SQL_MODE_FOR_TIMESTAMP 3226 #define ER_XA_REPLICATION_FILTERS 3227 #define ER_COMPRESSED_COLUMN_USED_AS_KEY 3228 #define ER_UNSUPPORTED_COMPRESSED_COLUMN_TYPE 3229 #define ER_COMPRESSION_DICTIONARY_EXISTS 3230 #define ER_COMPRESSION_DICTIONARY_DOES_NOT_EXIST 3231 #define ER_COMPRESSION_DICTIONARY_NAME_TOO_LONG 3232 #define ER_COMPRESSION_DICTIONARY_DATA_TOO_LONG 3233 #define ER_COMPRESSION_DICTIONARY_IS_REFERENCED 3234 #define ER_CANT_EXECUTE_WITH_BACKUP_LOCK 3235 #define ER_KEYS_OUT_OF_ORDER 12000 #define ER_OVERLAPPING_KEYS 12001 #define ER_REQUIRE_ROW_BINLOG_FORMAT 12002 #define ER_ISOLATION_MODE_NOT_SUPPORTED 12003 #define ER_ON_DUPLICATE_DISABLED 12004 #define ER_UPDATES_WITH_CONSISTENT_SNAPSHOT 12005 #define ER_ROLLBACK_ONLY 12006 #define ER_ROLLBACK_TO_SAVEPOINT 12007 #define ER_ISOLATION_LEVEL_WITH_CONSISTENT_SNAPSHOT 12008 #define ER_UNSUPPORTED_COLLATION 12009 #define ER_METADATA_INCONSISTENCY 12010 #define ER_KEY_CREATE_DURING_ALTER 12011 #define ER_SK_POPULATE_DURING_ALTER 12012 #define ER_CF_DIFFERENT 12013 #define ER_RDB_TTL_UNSUPPORTED 12014 #define ER_RDB_TTL_COL_FORMAT 12015 #define ER_RDB_TTL_DURATION_FORMAT 12016 #define ER_PER_INDEX_CF_DEPRECATED 12017 #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/sql_state.h�����������������������������������������������������������������������������������0000644�����������������00000035346�14763166026�0010107 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Autogenerated file, please don't edit */ { ER_DUP_KEY ,"23000", "" }, { ER_OUTOFMEMORY ,"HY001", "S1001" }, { ER_OUT_OF_SORTMEMORY ,"HY001", "S1001" }, { ER_CON_COUNT_ERROR ,"08004", "" }, { ER_BAD_HOST_ERROR ,"08S01", "" }, { ER_HANDSHAKE_ERROR ,"08S01", "" }, { ER_DBACCESS_DENIED_ERROR ,"42000", "" }, { ER_ACCESS_DENIED_ERROR ,"28000", "" }, { ER_NO_DB_ERROR ,"3D000", "" }, { ER_UNKNOWN_COM_ERROR ,"08S01", "" }, { ER_BAD_NULL_ERROR ,"23000", "" }, { ER_BAD_DB_ERROR ,"42000", "" }, { ER_TABLE_EXISTS_ERROR ,"42S01", "" }, { ER_BAD_TABLE_ERROR ,"42S02", "" }, { ER_NON_UNIQ_ERROR ,"23000", "" }, { ER_SERVER_SHUTDOWN ,"08S01", "" }, { ER_BAD_FIELD_ERROR ,"42S22", "S0022" }, { ER_WRONG_FIELD_WITH_GROUP ,"42000", "S1009" }, { ER_WRONG_GROUP_FIELD ,"42000", "S1009" }, { ER_WRONG_SUM_SELECT ,"42000", "S1009" }, { ER_WRONG_VALUE_COUNT ,"21S01", "" }, { ER_TOO_LONG_IDENT ,"42000", "S1009" }, { ER_DUP_FIELDNAME ,"42S21", "S1009" }, { ER_DUP_KEYNAME ,"42000", "S1009" }, { ER_DUP_ENTRY ,"23000", "S1009" }, { ER_WRONG_FIELD_SPEC ,"42000", "S1009" }, { ER_PARSE_ERROR ,"42000", "s1009" }, { ER_EMPTY_QUERY ,"42000", "" }, { ER_NONUNIQ_TABLE ,"42000", "S1009" }, { ER_INVALID_DEFAULT ,"42000", "S1009" }, { ER_MULTIPLE_PRI_KEY ,"42000", "S1009" }, { ER_TOO_MANY_KEYS ,"42000", "S1009" }, { ER_TOO_MANY_KEY_PARTS ,"42000", "S1009" }, { ER_TOO_LONG_KEY ,"42000", "S1009" }, { ER_KEY_COLUMN_DOES_NOT_EXITS ,"42000", "S1009" }, { ER_BLOB_USED_AS_KEY ,"42000", "S1009" }, { ER_TOO_BIG_FIELDLENGTH ,"42000", "S1009" }, { ER_WRONG_AUTO_KEY ,"42000", "S1009" }, { ER_FORCING_CLOSE ,"08S01", "" }, { ER_IPSOCK_ERROR ,"08S01", "" }, { ER_NO_SUCH_INDEX ,"42S12", "S1009" }, { ER_WRONG_FIELD_TERMINATORS ,"42000", "S1009" }, { ER_BLOBS_AND_NO_TERMINATED ,"42000", "S1009" }, { ER_CANT_REMOVE_ALL_FIELDS ,"42000", "" }, { ER_CANT_DROP_FIELD_OR_KEY ,"42000", "" }, { ER_BLOB_CANT_HAVE_DEFAULT ,"42000", "" }, { ER_WRONG_DB_NAME ,"42000", "" }, { ER_WRONG_TABLE_NAME ,"42000", "" }, { ER_TOO_BIG_SELECT ,"42000", "" }, { ER_UNKNOWN_PROCEDURE ,"42000", "" }, { ER_WRONG_PARAMCOUNT_TO_PROCEDURE ,"42000", "" }, { ER_UNKNOWN_TABLE ,"42S02", "" }, { ER_FIELD_SPECIFIED_TWICE ,"42000", "" }, { ER_UNSUPPORTED_EXTENSION ,"42000", "" }, { ER_TABLE_MUST_HAVE_COLUMNS ,"42000", "" }, { ER_UNKNOWN_CHARACTER_SET ,"42000", "" }, { ER_TOO_BIG_ROWSIZE ,"42000", "" }, { ER_WRONG_OUTER_JOIN ,"42000", "" }, { ER_NULL_COLUMN_IN_INDEX ,"42000", "" }, { ER_PASSWORD_ANONYMOUS_USER ,"42000", "" }, { ER_PASSWORD_NOT_ALLOWED ,"42000", "" }, { ER_PASSWORD_NO_MATCH ,"42000", "" }, { ER_WRONG_VALUE_COUNT_ON_ROW ,"21S01", "" }, { ER_INVALID_USE_OF_NULL ,"22004", "" }, { ER_REGEXP_ERROR ,"42000", "" }, { ER_MIX_OF_GROUP_FUNC_AND_FIELDS ,"42000", "" }, { ER_NONEXISTING_GRANT ,"42000", "" }, { ER_TABLEACCESS_DENIED_ERROR ,"42000", "" }, { ER_COLUMNACCESS_DENIED_ERROR ,"42000", "" }, { ER_ILLEGAL_GRANT_FOR_TABLE ,"42000", "" }, { ER_GRANT_WRONG_HOST_OR_USER ,"42000", "" }, { ER_NO_SUCH_TABLE ,"42S02", "" }, { ER_NONEXISTING_TABLE_GRANT ,"42000", "" }, { ER_NOT_ALLOWED_COMMAND ,"42000", "" }, { ER_SYNTAX_ERROR ,"42000", "" }, { ER_ABORTING_CONNECTION ,"08S01", "" }, { ER_NET_PACKET_TOO_LARGE ,"08S01", "" }, { ER_NET_READ_ERROR_FROM_PIPE ,"08S01", "" }, { ER_NET_FCNTL_ERROR ,"08S01", "" }, { ER_NET_PACKETS_OUT_OF_ORDER ,"08S01", "" }, { ER_NET_UNCOMPRESS_ERROR ,"08S01", "" }, { ER_NET_READ_ERROR ,"08S01", "" }, { ER_NET_READ_INTERRUPTED ,"08S01", "" }, { ER_NET_ERROR_ON_WRITE ,"08S01", "" }, { ER_NET_WRITE_INTERRUPTED ,"08S01", "" }, { ER_TOO_LONG_STRING ,"42000", "" }, { ER_TABLE_CANT_HANDLE_BLOB ,"42000", "" }, { ER_TABLE_CANT_HANDLE_AUTO_INCREMENT ,"42000", "" }, { ER_WRONG_COLUMN_NAME ,"42000", "" }, { ER_WRONG_KEY_COLUMN ,"42000", "" }, { ER_DUP_UNIQUE ,"23000", "" }, { ER_BLOB_KEY_WITHOUT_LENGTH ,"42000", "" }, { ER_PRIMARY_CANT_HAVE_NULL ,"42000", "" }, { ER_TOO_MANY_ROWS ,"42000", "" }, { ER_REQUIRES_PRIMARY_KEY ,"42000", "" }, { ER_KEY_DOES_NOT_EXITS ,"42000", "S1009" }, { ER_CHECK_NO_SUCH_TABLE ,"42000", "" }, { ER_CHECK_NOT_IMPLEMENTED ,"42000", "" }, { ER_CANT_DO_THIS_DURING_AN_TRANSACTION ,"25000", "" }, { ER_NEW_ABORTING_CONNECTION ,"08S01", "" }, { ER_MASTER_NET_READ ,"08S01", "" }, { ER_MASTER_NET_WRITE ,"08S01", "" }, { ER_TOO_MANY_USER_CONNECTIONS ,"42000", "" }, { ER_READ_ONLY_TRANSACTION ,"25000", "" }, { ER_NO_PERMISSION_TO_CREATE_USER ,"42000", "" }, { ER_LOCK_DEADLOCK ,"40001", "" }, { ER_NO_REFERENCED_ROW ,"23000", "" }, { ER_ROW_IS_REFERENCED ,"23000", "" }, { ER_CONNECT_TO_MASTER ,"08S01", "" }, { ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT ,"21000", "" }, { ER_USER_LIMIT_REACHED ,"42000", "" }, { ER_SPECIFIC_ACCESS_DENIED_ERROR ,"42000", "" }, { ER_NO_DEFAULT ,"42000", "" }, { ER_WRONG_VALUE_FOR_VAR ,"42000", "" }, { ER_WRONG_TYPE_FOR_VAR ,"42000", "" }, { ER_CANT_USE_OPTION_HERE ,"42000", "" }, { ER_NOT_SUPPORTED_YET ,"42000", "" }, { ER_WRONG_FK_DEF ,"42000", "" }, { ER_OPERAND_COLUMNS ,"21000", "" }, { ER_SUBQUERY_NO_1_ROW ,"21000", "" }, { ER_ILLEGAL_REFERENCE ,"42S22", "" }, { ER_DERIVED_MUST_HAVE_ALIAS ,"42000", "" }, { ER_SELECT_REDUCED ,"01000", "" }, { ER_TABLENAME_NOT_ALLOWED_HERE ,"42000", "" }, { ER_NOT_SUPPORTED_AUTH_MODE ,"08004", "" }, { ER_SPATIAL_CANT_HAVE_NULL ,"42000", "" }, { ER_COLLATION_CHARSET_MISMATCH ,"42000", "" }, { ER_WARN_TOO_FEW_RECORDS ,"01000", "" }, { ER_WARN_TOO_MANY_RECORDS ,"01000", "" }, { ER_WARN_NULL_TO_NOTNULL ,"22004", "" }, { ER_WARN_DATA_OUT_OF_RANGE ,"22003", "" }, { WARN_DATA_TRUNCATED ,"01000", "" }, { ER_WRONG_NAME_FOR_INDEX ,"42000", "" }, { ER_WRONG_NAME_FOR_CATALOG ,"42000", "" }, { ER_UNKNOWN_STORAGE_ENGINE ,"42000", "" }, { ER_TRUNCATED_WRONG_VALUE ,"22007", "" }, { ER_SP_NO_RECURSIVE_CREATE ,"2F003", "" }, { ER_SP_ALREADY_EXISTS ,"42000", "" }, { ER_SP_DOES_NOT_EXIST ,"42000", "" }, { ER_SP_LILABEL_MISMATCH ,"42000", "" }, { ER_SP_LABEL_REDEFINE ,"42000", "" }, { ER_SP_LABEL_MISMATCH ,"42000", "" }, { ER_SP_UNINIT_VAR ,"01000", "" }, { ER_SP_BADSELECT ,"0A000", "" }, { ER_SP_BADRETURN ,"42000", "" }, { ER_SP_BADSTATEMENT ,"0A000", "" }, { ER_UPDATE_LOG_DEPRECATED_IGNORED ,"42000", "" }, { ER_UPDATE_LOG_DEPRECATED_TRANSLATED ,"42000", "" }, { ER_QUERY_INTERRUPTED ,"70100", "" }, { ER_SP_WRONG_NO_OF_ARGS ,"42000", "" }, { ER_SP_COND_MISMATCH ,"42000", "" }, { ER_SP_NORETURN ,"42000", "" }, { ER_SP_NORETURNEND ,"2F005", "" }, { ER_SP_BAD_CURSOR_QUERY ,"42000", "" }, { ER_SP_BAD_CURSOR_SELECT ,"42000", "" }, { ER_SP_CURSOR_MISMATCH ,"42000", "" }, { ER_SP_CURSOR_ALREADY_OPEN ,"24000", "" }, { ER_SP_CURSOR_NOT_OPEN ,"24000", "" }, { ER_SP_UNDECLARED_VAR ,"42000", "" }, { ER_SP_FETCH_NO_DATA ,"02000", "" }, { ER_SP_DUP_PARAM ,"42000", "" }, { ER_SP_DUP_VAR ,"42000", "" }, { ER_SP_DUP_COND ,"42000", "" }, { ER_SP_DUP_CURS ,"42000", "" }, { ER_SP_SUBSELECT_NYI ,"0A000", "" }, { ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG ,"0A000", "" }, { ER_SP_VARCOND_AFTER_CURSHNDLR ,"42000", "" }, { ER_SP_CURSOR_AFTER_HANDLER ,"42000", "" }, { ER_SP_CASE_NOT_FOUND ,"20000", "" }, { ER_DIVISION_BY_ZERO ,"22012", "" }, { ER_ILLEGAL_VALUE_FOR_TYPE ,"22007", "" }, { ER_PROCACCESS_DENIED_ERROR ,"42000", "" }, { ER_XAER_NOTA ,"XAE04", "" }, { ER_XAER_INVAL ,"XAE05", "" }, { ER_XAER_RMFAIL ,"XAE07", "" }, { ER_XAER_OUTSIDE ,"XAE09", "" }, { ER_XAER_RMERR ,"XAE03", "" }, { ER_XA_RBROLLBACK ,"XA100", "" }, { ER_NONEXISTING_PROC_GRANT ,"42000", "" }, { ER_DATA_TOO_LONG ,"22001", "" }, { ER_SP_BAD_SQLSTATE ,"42000", "" }, { ER_CANT_CREATE_USER_WITH_GRANT ,"42000", "" }, { ER_SP_DUP_HANDLER ,"42000", "" }, { ER_SP_NOT_VAR_ARG ,"42000", "" }, { ER_SP_NO_RETSET ,"0A000", "" }, { ER_CANT_CREATE_GEOMETRY_OBJECT ,"22003", "" }, { ER_TOO_BIG_SCALE ,"42000", "S1009" }, { ER_TOO_BIG_PRECISION ,"42000", "S1009" }, { ER_M_BIGGER_THAN_D ,"42000", "S1009" }, { ER_TOO_LONG_BODY ,"42000", "S1009" }, { ER_TOO_BIG_DISPLAYWIDTH ,"42000", "S1009" }, { ER_XAER_DUPID ,"XAE08", "" }, { ER_DATETIME_FUNCTION_OVERFLOW ,"22008", "" }, { ER_ROW_IS_REFERENCED_2 ,"23000", "" }, { ER_NO_REFERENCED_ROW_2 ,"23000", "" }, { ER_SP_BAD_VAR_SHADOW ,"42000", "" }, { ER_SP_WRONG_NAME ,"42000", "" }, { ER_SP_NO_AGGREGATE ,"42000", "" }, { ER_MAX_PREPARED_STMT_COUNT_REACHED ,"42000", "" }, { ER_NON_GROUPING_FIELD_USED ,"42000", "" }, { ER_FOREIGN_DUPLICATE_KEY_OLD_UNUSED ,"23000", "S1009" }, { ER_CANT_CHANGE_TX_CHARACTERISTICS ,"25001", "" }, { ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT ,"42000", "" }, { ER_WRONG_PARAMETERS_TO_NATIVE_FCT ,"42000", "" }, { ER_WRONG_PARAMETERS_TO_STORED_FCT ,"42000", "" }, { ER_DUP_ENTRY_WITH_KEY_NAME ,"23000", "S1009" }, { ER_XA_RBTIMEOUT ,"XA106", "" }, { ER_XA_RBDEADLOCK ,"XA102", "" }, { ER_FUNC_INEXISTENT_NAME_COLLISION ,"42000", "" }, { ER_DUP_SIGNAL_SET ,"42000", "" }, { ER_SIGNAL_WARN ,"01000", "" }, { ER_SIGNAL_NOT_FOUND ,"02000", "" }, { ER_SIGNAL_EXCEPTION ,"HY000", "" }, { ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER ,"0K000", "" }, { ER_SPATIAL_MUST_HAVE_GEOM_COL ,"42000", "" }, { ER_DATA_OUT_OF_RANGE ,"22003", "" }, { ER_ACCESS_DENIED_NO_PASSWORD_ERROR ,"28000", "" }, { ER_TRUNCATE_ILLEGAL_FK ,"42000", "" }, { ER_DA_INVALID_CONDITION_NUMBER ,"35000", "" }, { ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO,"23000", "S1009" }, { ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO,"23000", "S1009" }, { ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION,"25006", "" }, { ER_ALTER_OPERATION_NOT_SUPPORTED ,"0A000", "" }, { ER_ALTER_OPERATION_NOT_SUPPORTED_REASON ,"0A000", "" }, { ER_DUP_UNKNOWN_IN_INDEX ,"23000", "" }, { ER_ACCESS_DENIED_CHANGE_USER_ERROR ,"28000", "" }, { ER_GET_STACKED_DA_WITHOUT_ACTIVE_HANDLER,"0Z002", "" }, { ER_INVALID_ARGUMENT_FOR_LOGARITHM ,"2201E", "" }, { ER_GIS_INVALID_DATA ,"22023", "" }, { ER_USER_LOCK_WRONG_NAME ,"42000", "" }, { ER_ILLEGAL_USER_VAR ,"42000", "S1009" }, { ER_NET_OK_PACKET_TOO_LARGE ,"08S01", "" }, { ER_WRONG_TABLESPACE_NAME ,"42000", "" }, { ER_LOCKING_SERVICE_WRONG_NAME ,"42000", "" }, { ER_INVALID_JSON_TEXT ,"22032", "" }, { ER_INVALID_JSON_TEXT_IN_PARAM ,"22032", "" }, { ER_INVALID_JSON_PATH ,"42000", "" }, { ER_INVALID_JSON_CHARSET ,"22032", "" }, { ER_INVALID_JSON_CHARSET_IN_FUNCTION ,"22032", "" }, { ER_INVALID_TYPE_FOR_JSON ,"22032", "" }, { ER_INVALID_CAST_TO_JSON ,"22032", "" }, { ER_INVALID_JSON_PATH_CHARSET ,"42000", "" }, { ER_INVALID_JSON_PATH_WILDCARD ,"42000", "" }, { ER_JSON_VALUE_TOO_BIG ,"22032", "" }, { ER_JSON_KEY_TOO_BIG ,"22032", "" }, { ER_JSON_USED_AS_KEY ,"42000", "" }, { ER_JSON_VACUOUS_PATH ,"42000", "" }, { ER_JSON_BAD_ONE_OR_ALL_ARG ,"42000", "" }, { ER_NUMERIC_JSON_VALUE_OUT_OF_RANGE ,"22003", "" }, { ER_INVALID_JSON_VALUE_FOR_CAST ,"22018", "" }, { ER_JSON_DOCUMENT_TOO_DEEP ,"22032", "" }, { ER_JSON_DOCUMENT_NULL_KEY ,"22032", "" }, { ER_INVALID_JSON_PATH_ARRAY_CELL ,"42000", "" }, { ER_WARN_USING_GEOMFROMWKB_TO_SET_SRID_ZERO,"01000", "" }, { ER_WARN_USING_GEOMFROMWKB_TO_SET_SRID ,"01000", "" }, { ER_KEYRING_ACCESS_DENIED_ERROR ,"42000", "" }, ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/binary_log_types.h����������������������������������������������������������������������������0000644�����������������00000003657�14763166026�0011461 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2014, 2015 Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** @file binary_log_types.h @brief This file contains the field type. @note This file can be imported both from C and C++ code, so the definitions have to be constructed to support this. */ #ifndef BINARY_LOG_TYPES_INCLUDED #define BINARY_LOG_TYPES_INCLUDED #ifdef __cplusplus extern "C" { #endif /* * Constants exported from this package. */ typedef enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY, MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG, MYSQL_TYPE_FLOAT, MYSQL_TYPE_DOUBLE, MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP, MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24, MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR, MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR, MYSQL_TYPE_BIT, MYSQL_TYPE_TIMESTAMP2, MYSQL_TYPE_DATETIME2, MYSQL_TYPE_TIME2, MYSQL_TYPE_JSON=245, MYSQL_TYPE_NEWDECIMAL=246, MYSQL_TYPE_ENUM=247, MYSQL_TYPE_SET=248, MYSQL_TYPE_TINY_BLOB=249, MYSQL_TYPE_MEDIUM_BLOB=250, MYSQL_TYPE_LONG_BLOB=251, MYSQL_TYPE_BLOB=252, MYSQL_TYPE_VAR_STRING=253, MYSQL_TYPE_STRING=254, MYSQL_TYPE_GEOMETRY=255 } enum_field_types; #define DATETIME_MAX_DECIMALS 6 #ifdef __cplusplus } #endif // __cplusplus #endif /* BINARY_LOG_TYPES_INCLUDED */ ���������������������������������������������������������������������������������mysql/thr_rwlock.h����������������������������������������������������������������������������������0000644�����������������00000013634�14763166026�0010262 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef THR_RWLOCK_INCLUDED #define THR_RWLOCK_INCLUDED /* Copyright (c) 2014, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** MySQL rwlock implementation. There are two "layers": 1) native_rw_*() Functions that map directly down to OS primitives. Windows - SRWLock Other OSes - pthread 2) mysql_rw*() Functions that include Performance Schema instrumentation. See include/mysql/psi/mysql_thread.h This file also includes rw_pr_*(), which implements a special version of rwlocks that prefer readers. The P_S version of these are mysql_prlock_*() - see include/mysql/psi/mysql_thread.h */ #include "my_global.h" #include "my_thread.h" #include "thr_cond.h" C_MODE_START #ifdef _WIN32 typedef struct st_my_rw_lock_t { SRWLOCK srwlock; /* native reader writer lock */ BOOL have_exclusive_srwlock; /* used for unlock */ } native_rw_lock_t; #else typedef pthread_rwlock_t native_rw_lock_t; #endif static inline int native_rw_init(native_rw_lock_t *rwp) { #ifdef _WIN32 InitializeSRWLock(&rwp->srwlock); rwp->have_exclusive_srwlock = FALSE; return 0; #else /* pthread_rwlockattr_t is not used in MySQL */ return pthread_rwlock_init(rwp, NULL); #endif } static inline int native_rw_destroy(native_rw_lock_t *rwp) { #ifdef _WIN32 return 0; /* no destroy function */ #else return pthread_rwlock_destroy(rwp); #endif } static inline int native_rw_rdlock(native_rw_lock_t *rwp) { #ifdef _WIN32 AcquireSRWLockShared(&rwp->srwlock); return 0; #else return pthread_rwlock_rdlock(rwp); #endif } static inline int native_rw_tryrdlock(native_rw_lock_t *rwp) { #ifdef _WIN32 if (!TryAcquireSRWLockShared(&rwp->srwlock)) return EBUSY; return 0; #else return pthread_rwlock_tryrdlock(rwp); #endif } static inline int native_rw_wrlock(native_rw_lock_t *rwp) { #ifdef _WIN32 AcquireSRWLockExclusive(&rwp->srwlock); rwp->have_exclusive_srwlock= TRUE; return 0; #else return pthread_rwlock_wrlock(rwp); #endif } static inline int native_rw_trywrlock(native_rw_lock_t *rwp) { #ifdef _WIN32 if (!TryAcquireSRWLockExclusive(&rwp->srwlock)) return EBUSY; rwp->have_exclusive_srwlock= TRUE; return 0; #else return pthread_rwlock_trywrlock(rwp); #endif } static inline int native_rw_unlock(native_rw_lock_t *rwp) { #ifdef _WIN32 if (rwp->have_exclusive_srwlock) { rwp->have_exclusive_srwlock= FALSE; ReleaseSRWLockExclusive(&rwp->srwlock); } else ReleaseSRWLockShared(&rwp->srwlock); return 0; #else return pthread_rwlock_unlock(rwp); #endif } /** Portable implementation of special type of read-write locks. These locks have two properties which are unusual for rwlocks: 1) They "prefer readers" in the sense that they do not allow situations in which rwlock is rd-locked and there is a pending rd-lock which is blocked (e.g. due to pending request for wr-lock). This is a stronger guarantee than one which is provided for PTHREAD_RWLOCK_PREFER_READER_NP rwlocks in Linux. MDL subsystem deadlock detector relies on this property for its correctness. 2) They are optimized for uncontended wr-lock/unlock case. This is scenario in which they are most oftenly used within MDL subsystem. Optimizing for it gives significant performance improvements in some of tests involving many connections. Another important requirement imposed on this type of rwlock by the MDL subsystem is that it should be OK to destroy rwlock object which is in unlocked state even though some threads might have not yet fully left unlock operation for it (of course there is an external guarantee that no thread will try to lock rwlock which is destroyed). Putting it another way the unlock operation should not access rwlock data after changing its state to unlocked. TODO/FIXME: We should consider alleviating this requirement as it blocks us from doing certain performance optimizations. */ typedef struct st_rw_pr_lock_t { /** Lock which protects the structure. Also held for the duration of wr-lock. */ native_mutex_t lock; /** Condition variable which is used to wake-up writers waiting for readers to go away. */ native_cond_t no_active_readers; /** Number of active readers. */ uint active_readers; /** Number of writers waiting for readers to go away. */ uint writers_waiting_readers; /** Indicates whether there is an active writer. */ my_bool active_writer; #ifdef SAFE_MUTEX /** Thread holding wr-lock (for debug purposes only). */ my_thread_t writer_thread; #endif } rw_pr_lock_t; extern int rw_pr_init(rw_pr_lock_t *); extern int rw_pr_rdlock(rw_pr_lock_t *); extern int rw_pr_wrlock(rw_pr_lock_t *); extern int rw_pr_unlock(rw_pr_lock_t *); extern int rw_pr_destroy(rw_pr_lock_t *); static inline void rw_pr_lock_assert_write_owner(const rw_pr_lock_t *rwlock MY_ATTRIBUTE((unused))) { #ifdef SAFE_MUTEX DBUG_ASSERT(rwlock->active_writer && my_thread_equal(my_thread_self(), rwlock->writer_thread)); #endif } static inline void rw_pr_lock_assert_not_write_owner(const rw_pr_lock_t *rwlock MY_ATTRIBUTE((unused))) { #ifdef SAFE_MUTEX DBUG_ASSERT(!rwlock->active_writer || !my_thread_equal(my_thread_self(), rwlock->writer_thread)); #endif } C_MODE_END #endif /* THR_RWLOCK_INCLUDED */ ����������������������������������������������������������������������������������������������������mysql/my_config_x86_64.h����������������������������������������������������������������������������0000644�����������������00000030127�14763166026�0011070 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2009, 2018, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MY_CONFIG_H #define MY_CONFIG_H /* * From configure.cmake, in order of appearance */ /* #undef HAVE_LLVM_LIBCPP */ #define _LARGEFILE_SOURCE 1 /* Libraries */ #define HAVE_LIBM 1 /* #undef HAVE_LIBNSL */ #define HAVE_LIBCRYPT 1 /* #undef HAVE_LIBSOCKET */ #define HAVE_LIBDL 1 #define HAVE_LIBRT 1 /* #undef HAVE_LIBWRAP */ /* #undef HAVE_LIBWRAP_PROTOTYPES */ /* Header files */ #define HAVE_ALLOCA_H 1 #define HAVE_ARPA_INET_H 1 #define HAVE_CRYPT_H 1 #define HAVE_DLFCN_H 1 #define HAVE_EXECINFO_H 1 #define HAVE_FPU_CONTROL_H 1 #define HAVE_GRP_H 1 /* #undef HAVE_IEEEFP_H */ #define HAVE_LANGINFO_H 1 #define HAVE_MALLOC_H 1 #define HAVE_NETINET_IN_H 1 #define HAVE_POLL_H 1 #define HAVE_PWD_H 1 #define HAVE_STRINGS_H 1 #define HAVE_SYS_CDEFS_H 1 #define HAVE_SYS_IOCTL_H 1 #define HAVE_SYS_MMAN_H 1 #define HAVE_SYS_RESOURCE_H 1 #define HAVE_SYS_SELECT_H 1 #define HAVE_SYS_SOCKET_H 1 #define HAVE_TERM_H 1 #define HAVE_TERMIOS_H 1 #define HAVE_TERMIO_H 1 #define HAVE_UNISTD_H 1 #define HAVE_SYS_WAIT_H 1 #define HAVE_SYS_PARAM_H 1 #define HAVE_FNMATCH_H 1 #define HAVE_SYS_UN_H 1 /* #undef HAVE_VIS_H */ #define HAVE_SASL_SASL_H 1 /* Libevent */ /* #undef HAVE_DEVPOLL */ /* #undef HAVE_SYS_DEVPOLL_H */ #define HAVE_SYS_EPOLL_H 1 #define HAVE_TAILQFOREACH 1 /* Functions */ /* #undef HAVE_ALIGNED_MALLOC */ #define HAVE_BACKTRACE 1 /* #undef HAVE_PRINTSTACK */ #define HAVE_INDEX 1 #define HAVE_CLOCK_GETTIME 1 #define HAVE_CUSERID 1 /* #undef HAVE_DIRECTIO */ #define HAVE_FTRUNCATE 1 #define HAVE_COMPRESS 1 #define HAVE_CRYPT 1 #define HAVE_DLOPEN 1 #define HAVE_FCHMOD 1 #define HAVE_FCNTL 1 #define HAVE_FDATASYNC 1 #define HAVE_DECL_FDATASYNC 1 #define HAVE_FEDISABLEEXCEPT 1 #define HAVE_FSEEKO 1 #define HAVE_FSYNC 1 #define HAVE_GETHOSTBYADDR_R 1 /* #undef HAVE_GETHRTIME */ #define HAVE_GETNAMEINFO 1 #define HAVE_GETPASS 1 /* #undef HAVE_GETPASSPHRASE */ #define HAVE_GETPWNAM 1 #define HAVE_GETPWUID 1 #define HAVE_GETRLIMIT 1 #define HAVE_GETRUSAGE 1 #define HAVE_INITGROUPS 1 /* #undef HAVE_ISSETUGID */ #define HAVE_GETUID 1 #define HAVE_GETEUID 1 #define HAVE_GETGID 1 #define HAVE_GETEGID 1 #define HAVE_LSTAT 1 #define HAVE_MADVISE 1 #define HAVE_MALLOC_INFO 1 #define HAVE_MEMRCHR 1 #define HAVE_MLOCK 1 #define HAVE_MLOCKALL 1 #define HAVE_MMAP64 1 #define HAVE_POLL 1 #define HAVE_POSIX_FALLOCATE 1 #define HAVE_POSIX_MEMALIGN 1 #define HAVE_PREAD 1 #define HAVE_PTHREAD_CONDATTR_SETCLOCK 1 #define HAVE_PTHREAD_SIGMASK 1 #define HAVE_READLINK 1 #define HAVE_REALPATH 1 /* #undef HAVE_SETFD */ #define HAVE_SIGACTION 1 #define HAVE_SLEEP 1 #define HAVE_STPCPY 1 #define HAVE_STPNCPY 1 /* #undef HAVE_STRLCPY */ #define HAVE_STRNLEN 1 /* #undef HAVE_STRLCAT */ #define HAVE_STRSIGNAL 1 /* #undef HAVE_FGETLN */ #define HAVE_STRSEP 1 /* #undef HAVE_TELL */ #define HAVE_VASPRINTF 1 #define HAVE_MEMALIGN 1 #define HAVE_NL_LANGINFO 1 /* #undef HAVE_HTONLL */ /* #undef HAVE_MEMSET_S */ #define DNS_USE_CPU_CLOCK_FOR_ID 1 #define HAVE_EPOLL 1 /* #undef HAVE_EVENT_PORTS */ #define HAVE_INET_NTOP 1 /* #undef HAVE_WORKING_KQUEUE */ #define HAVE_TIMERADD 1 #define HAVE_TIMERCLEAR 1 #define HAVE_TIMERCMP 1 #define HAVE_TIMERISSET 1 /* WL2373 */ #define HAVE_SYS_TIME_H 1 #define HAVE_SYS_TIMES_H 1 #define HAVE_TIMES 1 #define HAVE_GETTIMEOFDAY 1 /* Symbols */ #define HAVE_LRAND48 1 #define GWINSZ_IN_SYS_IOCTL 1 #define FIONREAD_IN_SYS_IOCTL 1 /* #undef FIONREAD_IN_SYS_FILIO */ #define HAVE_SIGEV_THREAD_ID 1 /* #undef HAVE_SIGEV_PORT */ #define HAVE_LOG2 1 #define HAVE_ISINF 1 /* #undef HAVE_KQUEUE_TIMERS */ #define HAVE_POSIX_TIMERS 1 /* Endianess */ /* #undef WORDS_BIGENDIAN */ /* Type sizes */ #define SIZEOF_VOIDP 8 #define SIZEOF_CHARP 8 #define SIZEOF_LONG 8 #define SIZEOF_SHORT 2 #define SIZEOF_INT 4 #define SIZEOF_LONG_LONG 8 #define SIZEOF_OFF_T 8 #define SIZEOF_TIME_T 8 #define HAVE_UINT 1 #define HAVE_ULONG 1 #define HAVE_U_INT32_T 1 #define HAVE_STRUCT_TIMESPEC /* Support for tagging symbols with __attribute__((visibility("hidden"))) */ #define HAVE_VISIBILITY_HIDDEN 1 /* Code tests*/ #define STACK_DIRECTION -1 #define TIME_WITH_SYS_TIME 1 /* #undef NO_FCNTL_NONBLOCK */ #define HAVE_PAUSE_INSTRUCTION 1 /* #undef HAVE_FAKE_PAUSE_INSTRUCTION */ /* #undef HAVE_HMT_PRIORITY_INSTRUCTION */ /* #undef HAVE_ABI_CXA_DEMANGLE */ #define HAVE_BUILTIN_UNREACHABLE 1 #define HAVE_BUILTIN_EXPECT 1 #define HAVE_BUILTIN_STPCPY 1 #define HAVE_GCC_ATOMIC_BUILTINS 1 #define HAVE_GCC_SYNC_BUILTINS 1 /* #undef HAVE_VALGRIND */ /* #undef HAVE_PTHREAD_THREADID_NP */ /* IPV6 */ /* #undef HAVE_NETINET_IN6_H */ #define HAVE_STRUCT_SOCKADDR_IN6 1 #define HAVE_STRUCT_IN6_ADDR 1 #define HAVE_IPV6 1 /* #undef ss_family */ /* #undef HAVE_SOCKADDR_IN_SIN_LEN */ /* #undef HAVE_SOCKADDR_IN6_SIN6_LEN */ /* * Platform specific CMake files */ #define MACHINE_TYPE "x86_64" #define HAVE_LINUX_LARGE_PAGES 1 /* #undef HAVE_SOLARIS_LARGE_PAGES */ /* #undef HAVE_SOLARIS_ATOMIC */ /* #undef HAVE_SOLARIS_STYLE_GETHOST */ #define SYSTEM_TYPE "Linux" /* Windows stuff, mostly functions, that have Posix analogs but named differently */ /* #undef IPPROTO_IPV6 */ /* #undef IPV6_V6ONLY */ /* This should mean case insensitive file system */ /* #undef FN_NO_CASE_SENSE */ /* * From main CMakeLists.txt */ #define MAX_INDEXES 64U #define WITH_INNODB_MEMCACHED 1 /* #undef ENABLE_MEMCACHED_SASL */ /* #undef ENABLE_MEMCACHED_SASL_PWDB */ #define ENABLED_PROFILING 1 /* #undef HAVE_ASAN */ #define ENABLED_LOCAL_INFILE 1 #define OPTIMIZER_TRACE 1 #define DEFAULT_MYSQL_HOME "/usr" #define SHAREDIR "/usr/share/percona-server" #define DEFAULT_BASEDIR "/usr" #define MYSQL_DATADIR "/var/lib/mysql" #define MYSQL_KEYRINGDIR "/var/lib/mysql-keyring" #define DEFAULT_CHARSET_HOME "/usr" #define PLUGINDIR "/usr/lib64/mysql/plugin" #define DEFAULT_SYSCONFDIR "/usr/etc" #define DEFAULT_TMPDIR P_tmpdir #define INSTALL_SBINDIR "/usr/sbin" #define INSTALL_BINDIR "/usr/bin" #define INSTALL_MYSQLSHAREDIR "/usr/share/percona-server" #define INSTALL_SHAREDIR "/usr/share" #define INSTALL_PLUGINDIR "/usr/lib64/mysql/plugin" #define INSTALL_INCLUDEDIR "/usr/include/mysql" #define INSTALL_SCRIPTDIR "/usr/bin" #define INSTALL_MYSQLDATADIR "/usr//var/lib/mysql" #define INSTALL_MYSQLKEYRINGDIR "/usr//var/lib/mysql-keyring" #define INSTALL_PLUGINTESTDIR "/builddir/build/BUILD/percona-server-5.7.23-23/percona-server-5.7.23-23/plugin/audit_log//tests;/builddir/build/BUILD/percona-server-5.7.23-23/percona-server-5.7.23-23/plugin/scalability_metrics//tests;/builddir/build/BUILD/percona-server-5.7.23-23/percona-server-5.7.23-23/plugin/keyring_vault//tests;/builddir/build/BUILD/percona-server-5.7.23-23/percona-server-5.7.23-23/plugin/query_response_time//tests" #define INSTALL_INFODIR "/usr/share/info" #define INSTALL_MYSQLTESTDIR "/usr/share/mysql-test" /* #undef INSTALL_DOCREADMEDIR */ /* #undef INSTALL_DOCDIR */ #define INSTALL_MANDIR "/usr/share/man" #define INSTALL_SUPPORTFILESDIR "/usr/share/percona-server" #define INSTALL_LIBDIR "/usr/lib64/mysql" /* * Readline */ #define HAVE_MBSTATE_T #define HAVE_LANGINFO_CODESET #define HAVE_WCSDUP #define HAVE_WCHAR_T 1 #define HAVE_WINT_T 1 #define HAVE_CURSES_H 1 /* #undef HAVE_NCURSES_H */ #define USE_LIBEDIT_INTERFACE 1 #define HAVE_HIST_ENTRY 1 #define USE_NEW_XLINE_INTERFACE 1 #define HAVE_READLINE_HISTORY_H 1 /* * Libedit */ /* #undef HAVE_DECL_TGOTO */ /* * DTrace */ /* #undef HAVE_DTRACE */ /* * Character sets */ #define MYSQL_DEFAULT_CHARSET_NAME "latin1" #define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci" #define HAVE_CHARSET_armscii8 1 #define HAVE_CHARSET_ascii 1 #define HAVE_CHARSET_big5 1 #define HAVE_CHARSET_cp1250 1 #define HAVE_CHARSET_cp1251 1 #define HAVE_CHARSET_cp1256 1 #define HAVE_CHARSET_cp1257 1 #define HAVE_CHARSET_cp850 1 #define HAVE_CHARSET_cp852 1 #define HAVE_CHARSET_cp866 1 #define HAVE_CHARSET_cp932 1 #define HAVE_CHARSET_dec8 1 #define HAVE_CHARSET_eucjpms 1 #define HAVE_CHARSET_euckr 1 #define HAVE_CHARSET_gb2312 1 #define HAVE_CHARSET_gbk 1 #define HAVE_CHARSET_gb18030 1 #define HAVE_CHARSET_geostd8 1 #define HAVE_CHARSET_greek 1 #define HAVE_CHARSET_hebrew 1 #define HAVE_CHARSET_hp8 1 #define HAVE_CHARSET_keybcs2 1 #define HAVE_CHARSET_koi8r 1 #define HAVE_CHARSET_koi8u 1 #define HAVE_CHARSET_latin1 1 #define HAVE_CHARSET_latin2 1 #define HAVE_CHARSET_latin5 1 #define HAVE_CHARSET_latin7 1 #define HAVE_CHARSET_macce 1 #define HAVE_CHARSET_macroman 1 #define HAVE_CHARSET_sjis 1 #define HAVE_CHARSET_swe7 1 #define HAVE_CHARSET_tis620 1 #define HAVE_CHARSET_ucs2 1 #define HAVE_CHARSET_ujis 1 #define HAVE_CHARSET_utf8mb4 1 /* #undef HAVE_CHARSET_utf8mb3 */ #define HAVE_CHARSET_utf8 1 #define HAVE_CHARSET_utf16 1 #define HAVE_CHARSET_utf32 1 #define HAVE_UCA_COLLATIONS 1 #define HAVE_X509_CHECK_HOST 1 #define HAVE_X509_CHECK_IP 1 /* * Feature set */ #define WITH_PARTITION_STORAGE_ENGINE 1 /* * Performance schema */ #define WITH_PERFSCHEMA_STORAGE_ENGINE 1 /* #undef DISABLE_PSI_THREAD */ /* #undef DISABLE_PSI_MUTEX */ /* #undef DISABLE_PSI_RWLOCK */ /* #undef DISABLE_PSI_COND */ /* #undef DISABLE_PSI_FILE */ /* #undef DISABLE_PSI_TABLE */ /* #undef DISABLE_PSI_SOCKET */ /* #undef DISABLE_PSI_STAGE */ /* #undef DISABLE_PSI_STATEMENT */ /* #undef DISABLE_PSI_SP */ /* #undef DISABLE_PSI_PS */ /* #undef DISABLE_PSI_IDLE */ /* #undef DISABLE_PSI_STATEMENT_DIGEST */ /* #undef DISABLE_PSI_METADATA */ /* #undef DISABLE_PSI_MEMORY */ /* #undef DISABLE_PSI_TRANSACTION */ /* * syscall */ /* #undef HAVE_SYS_THREAD_SELFID */ #define HAVE_SYS_GETTID 1 /* #undef HAVE_PTHREAD_GETTHREADID_NP */ /* #undef HAVE_PTHREAD_SETNAME_NP */ #define HAVE_INTEGER_PTHREAD_SELF 1 /* Platform-specific C++ compiler behaviors we rely upon */ /* This macro defines whether the compiler in use needs a 'typename' keyword to access the types defined inside a class template, such types are called dependent types. Some compilers require it, some others forbid it, and some others may work with or without it. For example, GCC requires the 'typename' keyword whenever needing to access a type inside a template, but msvc forbids it. */ /* #undef HAVE_IMPLICIT_DEPENDENT_NAME_TYPING */ /* * MySQL version */ #define DOT_FRM_VERSION 6 #define MYSQL_VERSION_MAJOR 5 #define MYSQL_VERSION_MINOR 7 #define MYSQL_VERSION_PATCH 23 #define MYSQL_VERSION_EXTRA "-23" #define PACKAGE "mysql" #define PACKAGE_BUGREPORT "" #define PACKAGE_NAME "MySQL Server" #define PACKAGE_STRING "MySQL Server 5.7.23-23" #define PACKAGE_TARNAME "mysql" #define PACKAGE_VERSION "5.7.23-23" #define VERSION "5.7.23-23" #define PROTOCOL_VERSION 10 /* * CPU info */ #define CPU_LEVEL1_DCACHE_LINESIZE 64 /* * NDB */ /* #undef WITH_NDBCLUSTER_STORAGE_ENGINE */ /* #undef HAVE_PTHREAD_SETSCHEDPARAM */ /* * Other */ /* #undef EXTRA_DEBUG */ #define HAVE_CHOWN 1 /* * Hardcoded values needed by libevent/NDB/memcached */ #define HAVE_FCNTL_H 1 #define HAVE_GETADDRINFO 1 #define HAVE_INTTYPES_H 1 /* libevent's select.c is not Windows compatible */ #ifndef _WIN32 #define HAVE_SELECT 1 #endif #define HAVE_SIGNAL_H 1 #define HAVE_STDARG_H 1 #define HAVE_STDINT_H 1 #define HAVE_STDLIB_H 1 #define HAVE_STRDUP 1 #define HAVE_STRTOK_R 1 #define HAVE_STRTOLL 1 #define HAVE_SYS_STAT_H 1 #define HAVE_SYS_TYPES_H 1 #define SIZEOF_CHAR 1 /* * Needed by libevent */ /* #undef HAVE_SOCKLEN_T */ /* For --secure-file-priv */ #define DEFAULT_SECURE_FILE_PRIV_DIR "/var/lib/mysql-files" #define DEFAULT_SECURE_FILE_PRIV_EMBEDDED_DIR "NULL" #define HAVE_LIBNUMA 1 /* For default value of --early_plugin_load */ /* #undef DEFAULT_EARLY_PLUGIN_LOAD */ #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/typelib.h�������������������������������������������������������������������������������������0000644�����������������00000004352�14763166026�0007551 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _typelib_h #define _typelib_h #include "my_alloc.h" typedef struct st_typelib { /* Different types saved here */ unsigned int count; /* How many types */ const char *name; /* Name of typelib */ const char **type_names; unsigned int *type_lengths; } TYPELIB; extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position); extern int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option); #define FIND_TYPE_BASIC 0 /** makes @c find_type() require the whole name, no prefix */ #define FIND_TYPE_NO_PREFIX (1 << 0) /** always implicitely on, so unused, but old code may pass it */ #define FIND_TYPE_NO_OVERWRITE (1 << 1) /** makes @c find_type() accept a number */ #define FIND_TYPE_ALLOW_NUMBER (1 << 2) /** makes @c find_type() treat ',' as terminator */ #define FIND_TYPE_COMMA_TERM (1 << 3) extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags); extern void make_type(char *to,unsigned int nr,TYPELIB *typelib); extern const char *get_type(TYPELIB *typelib,unsigned int nr); extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from); extern TYPELIB sql_protocol_typelib; my_ulonglong find_set_from_flags(const TYPELIB *lib, unsigned int default_name, my_ulonglong cur_set, my_ulonglong default_set, const char *str, unsigned int length, char **err_pos, unsigned int *err_len); #endif /* _typelib_h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/my_dbug.h�������������������������������������������������������������������������������������0000644�����������������00000022257�14763166026�0007533 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MY_DBUG_INCLUDED #define MY_DBUG_INCLUDED #include "my_global.h" /* MYSQL_PLUGIN_IMPORT */ #ifdef __cplusplus extern "C" { #endif #if !defined(DBUG_OFF) struct _db_stack_frame_ { const char *func; /* function name of the previous stack frame */ const char *file; /* filename of the function of previous frame */ uint level; /* this nesting level, highest bit enables tracing */ struct _db_stack_frame_ *prev; /* pointer to the previous frame */ }; struct _db_code_state_; extern MYSQL_PLUGIN_IMPORT my_bool _dbug_on_; extern my_bool _db_keyword_(struct _db_code_state_ *, const char *, int); extern int _db_explain_(struct _db_code_state_ *cs, char *buf, size_t len); extern int _db_explain_init_(char *buf, size_t len); extern int _db_is_pushed_(void); extern void _db_setjmp_(void); extern void _db_longjmp_(void); extern void _db_process_(const char *name); extern void _db_push_(const char *control); extern void _db_pop_(void); extern void _db_set_(const char *control); extern void _db_set_init_(const char *control); extern void _db_enter_(const char *_func_, const char *_file_, uint _line_, struct _db_stack_frame_ *_stack_frame_); extern void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_); extern void _db_pargs_(uint _line_,const char *keyword); extern int _db_enabled_(); extern void _db_doprnt_(const char *format,...) MY_ATTRIBUTE((format(printf, 1, 2))); extern void _db_doputs_(const char *log); extern void _db_dump_(uint _line_,const char *keyword, const unsigned char *memory, size_t length); extern void _db_end_(void); extern void _db_lock_file_(void); extern void _db_unlock_file_(void); extern FILE *_db_fp_(void); extern void _db_flush_(); extern const char* _db_get_func_(void); #define DBUG_ENTER(a) struct _db_stack_frame_ _db_stack_frame_; \ _db_enter_ (a,__FILE__,__LINE__,&_db_stack_frame_) #define DBUG_LEAVE _db_return_ (__LINE__, &_db_stack_frame_) #define DBUG_RETURN(a1) do {DBUG_LEAVE; return(a1);} while(0) #define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0) #define DBUG_EXECUTE(keyword,a1) \ do {if (_db_keyword_(0, (keyword), 0)) { a1 }} while(0) #define DBUG_EXECUTE_IF(keyword,a1) \ do {if (_db_keyword_(0, (keyword), 1)) { a1 }} while(0) #define DBUG_EVALUATE(keyword,a1,a2) \ (_db_keyword_(0,(keyword), 0) ? (a1) : (a2)) #define DBUG_EVALUATE_IF(keyword,a1,a2) \ (_db_keyword_(0,(keyword), 1) ? (a1) : (a2)) #define DBUG_PRINT(keyword,arglist) \ do \ { \ if (_dbug_on_) \ { \ _db_pargs_(__LINE__,keyword); \ if (_db_enabled_()) \ { \ _db_doprnt_ arglist; \ } \ } \ } while(0) /* An alternate to DBUG_PRINT() macro, which takes a single string as the second argument. */ #define DBUG_PUTS(keyword,arg) \ do \ { \ if (_dbug_on_) \ { \ _db_pargs_(__LINE__,keyword); \ if (_db_enabled_()) \ { \ _db_doputs_(arg); \ } \ } \ } while(0) #define DBUG_PUSH(a1) _db_push_ (a1) #define DBUG_POP() _db_pop_ () #define DBUG_SET(a1) _db_set_ (a1) #define DBUG_SET_INITIAL(a1) _db_set_init_ (a1) #define DBUG_PROCESS(a1) _db_process_(a1) #define DBUG_FILE _db_fp_() #define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1)) #define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2)) #define DBUG_DUMP(keyword,a1,a2) _db_dump_(__LINE__,keyword,a1,a2) #define DBUG_END() _db_end_ () #define DBUG_LOCK_FILE _db_lock_file_() #define DBUG_UNLOCK_FILE _db_unlock_file_() #define DBUG_ASSERT(A) assert(A) #define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len)) #define DBUG_EXPLAIN_INITIAL(buf,len) _db_explain_init_((buf),(len)) #define DEBUGGER_OFF do { _dbug_on_= 0; } while(0) #define DEBUGGER_ON do { _dbug_on_= 1; } while(0) #ifndef _WIN32 #define DBUG_ABORT() (_db_flush_(), abort()) #else /* Avoid popup with abort/retry/ignore buttons. When BUG#31745 is fixed we can call abort() instead of _exit(2) (now it would cause a "test signal" popup). */ #include <crtdbg.h> #define DBUG_ABORT() (_db_flush_(),\ (void)_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE),\ (void)_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR),\ _exit(2)) #endif #define DBUG_CHECK_CRASH(func, op) \ do { char _dbuf_[255]; strxnmov(_dbuf_, sizeof(_dbuf_)-1, (func), (op)); \ DBUG_EXECUTE_IF(_dbuf_, DBUG_ABORT()); } while(0) #define DBUG_CRASH_ENTER(func) \ DBUG_ENTER(func); DBUG_CHECK_CRASH(func, "_crash_enter") #define DBUG_CRASH_RETURN(val) \ DBUG_CHECK_CRASH(_db_get_func_(), "_crash_return") #define DBUG_CRASH_VOID_RETURN \ DBUG_CHECK_CRASH (_db_get_func_(), "_crash_return") /* Make the program fail, without creating a core file. abort() will send SIGABRT which (most likely) generates core. Use SIGKILL instead, which cannot be caught. We also pause the current thread, until the signal is actually delivered. An alternative would be to use _exit(EXIT_FAILURE), but then valgrind would report lots of memory leaks. */ #ifdef _WIN32 #define DBUG_SUICIDE() DBUG_ABORT() #else extern void _db_suicide_(); extern void _db_flush_gcov_(); #define DBUG_SUICIDE() (_db_flush_(), _db_suicide_()) #endif #else /* No debugger */ #define DBUG_ENTER(a1) #define DBUG_LEAVE #define DBUG_RETURN(a1) do { return(a1); } while(0) #define DBUG_VOID_RETURN do { return; } while(0) #define DBUG_EXECUTE(keyword,a1) do { } while(0) #define DBUG_EXECUTE_IF(keyword,a1) do { } while(0) #define DBUG_EVALUATE(keyword,a1,a2) (a2) #define DBUG_EVALUATE_IF(keyword,a1,a2) (a2) #define DBUG_PRINT(keyword,arglist) do { } while(0) #define DBUG_PUTS(keyword,arg) do { } while(0) #define DBUG_LOG(keyword,arglist) do { } while(0) #define DBUG_PUSH(a1) do { } while(0) #define DBUG_SET(a1) do { } while(0) #define DBUG_SET_INITIAL(a1) do { } while(0) #define DBUG_POP() do { } while(0) #define DBUG_PROCESS(a1) do { } while(0) #define DBUG_SETJMP(a1) setjmp(a1) #define DBUG_LONGJMP(a1) longjmp(a1) #define DBUG_DUMP(keyword,a1,a2) do { } while(0) #define DBUG_END() do { } while(0) #define DBUG_ASSERT(A) do { } while(0) #define DBUG_LOCK_FILE do { } while(0) #define DBUG_FILE (stderr) #define DBUG_UNLOCK_FILE do { } while(0) #define DBUG_EXPLAIN(buf,len) #define DBUG_EXPLAIN_INITIAL(buf,len) #define DEBUGGER_OFF do { } while(0) #define DEBUGGER_ON do { } while(0) #define DBUG_ABORT() do { } while(0) #define DBUG_CRASH_ENTER(func) #define DBUG_CRASH_RETURN(val) do { return(val); } while(0) #define DBUG_CRASH_VOID_RETURN do { return; } while(0) #define DBUG_SUICIDE() do { } while(0) #endif #ifdef EXTRA_DEBUG /** Sync points allow us to force the server to reach a certain line of code and block there until the client tells the server it is ok to go on. The client tells the server to block with SELECT GET_LOCK() and unblocks it with SELECT RELEASE_LOCK(). Used for debugging difficult concurrency problems */ #define DBUG_SYNC_POINT(lock_name,lock_timeout) \ debug_sync_point(lock_name,lock_timeout) void debug_sync_point(const char* lock_name, uint lock_timeout); #else #define DBUG_SYNC_POINT(lock_name,lock_timeout) #endif /* EXTRA_DEBUG */ #ifdef __cplusplus } #endif #ifdef __cplusplus #if !defined(DBUG_OFF) #include <sstream> /* A C++ interface to the DBUG_PUTS macro. The DBUG_LOG macro also takes two arguments. The first argument is the keyword, as that of the DBUG_PRINT. The 2nd argument 'v' will be passed to a C++ output stream. This enables the use of C++ style output stream operator. In the code, it will be used as follows: DBUG_LOG("blob", "space: " << space_id); Note: DBUG_PRINT() has a limitation of 1024 bytes for a single print out. This limitation is not there for DBUG_PUTS and DBUG_LOG macros. */ #define DBUG_LOG(keyword, v) do { \ std::ostringstream sout; \ sout << v; \ DBUG_PUTS(keyword, sout.str().c_str()); \ } while(0) #endif /* DBUG_OFF */ #endif /* __cplusplus */ #endif /* MY_DBUG_INCLUDED */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/sslopt-vars.h���������������������������������������������������������������������������������0000644�����������������00000005526�14763166026�0010402 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef SSLOPT_VARS_INCLUDED #define SSLOPT_VARS_INCLUDED #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) #ifndef MYSQL_CLIENT #error This header is supposed to be used only in the client #endif const char *ssl_mode_names_lib[] = {"DISABLED", "PREFERRED", "REQUIRED", "VERIFY_CA", "VERIFY_IDENTITY", NullS }; TYPELIB ssl_mode_typelib = {array_elements(ssl_mode_names_lib) - 1, "", ssl_mode_names_lib, NULL}; static uint opt_ssl_mode = SSL_MODE_PREFERRED; static char *opt_ssl_ca = 0; static char *opt_ssl_capath = 0; static char *opt_ssl_cert = 0; static char *opt_ssl_cipher = 0; static char *opt_ssl_key = 0; static char *opt_ssl_crl = 0; static char *opt_ssl_crlpath = 0; static char *opt_tls_version = 0; static my_bool ssl_mode_set_explicitly= FALSE; static my_bool opt_use_ssl_arg= TRUE; static my_bool opt_ssl_verify_server_cert_arg= FALSE; static void set_client_ssl_options(MYSQL *mysql) { /* Print a warning if explicitly defined combination of --ssl-mode other than VERIFY_CA or VERIFY_IDENTITY with explicit --ssl-ca or --ssl-capath values. */ if (ssl_mode_set_explicitly && opt_ssl_mode < SSL_MODE_VERIFY_CA && (opt_ssl_ca || opt_ssl_capath)) { fprintf(stderr, "WARNING: no verification of server certificate will be done. " "Use --ssl-mode=VERIFY_CA or VERIFY_IDENTITY.\n"); } /* Set SSL parameters: key, cert, ca, capath, cipher, clr, clrpath. */ if (opt_ssl_mode >= SSL_MODE_VERIFY_CA) mysql_ssl_set(mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, opt_ssl_capath, opt_ssl_cipher); else mysql_ssl_set(mysql, opt_ssl_key, opt_ssl_cert, NULL, NULL, opt_ssl_cipher); mysql_options(mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); mysql_options(mysql, MYSQL_OPT_TLS_VERSION, opt_tls_version); mysql_options(mysql, MYSQL_OPT_SSL_MODE, &opt_ssl_mode); } #define SSL_SET_OPTIONS(mysql) set_client_ssl_options(mysql); #else #define SSL_SET_OPTIONS(mysql) do { } while(0) #endif #endif /* SSLOPT_VARS_INCLUDED */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/my_thread.h�����������������������������������������������������������������������������������0000644�����������������00000011415�14763166026�0010053 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ /* Defines to make different thread packages compatible */ #ifndef MY_THREAD_INCLUDED #define MY_THREAD_INCLUDED #include "my_global.h" /* my_bool */ #if !defined(_WIN32) #include <pthread.h> #endif #ifndef ETIME #define ETIME ETIMEDOUT /* For FreeBSD */ #endif #ifndef ETIMEDOUT #define ETIMEDOUT 145 /* Win32 doesn't have this */ #endif /* MySQL can survive with 32K, but some glibc libraries require > 128K stack To resolve hostnames. Also recursive stored procedures needs stack. */ #if defined(__sparc) && (defined(__SUNPRO_CC) || defined(__SUNPRO_C)) #define STACK_MULTIPLIER 2UL #else #define STACK_MULTIPLIER 1UL #endif #if SIZEOF_CHARP > 4 #define DEFAULT_THREAD_STACK (STACK_MULTIPLIER * 256UL * 1024UL) #else #define DEFAULT_THREAD_STACK (STACK_MULTIPLIER * 192UL * 1024UL) #endif #ifdef __cplusplus #define EXTERNC extern "C" #else #define EXTERNC #endif C_MODE_START #ifdef _WIN32 typedef volatile LONG my_thread_once_t; typedef DWORD my_thread_t; typedef struct thread_attr { DWORD dwStackSize; int detachstate; } my_thread_attr_t; #define MY_THREAD_CREATE_JOINABLE 0 #define MY_THREAD_CREATE_DETACHED 1 typedef void * (__cdecl *my_start_routine)(void *); #define MY_THREAD_ONCE_INIT 0 #define MY_THREAD_ONCE_INPROGRESS 1 #define MY_THREAD_ONCE_DONE 2 #else typedef pthread_once_t my_thread_once_t; typedef pthread_t my_thread_t; typedef pthread_attr_t my_thread_attr_t; #define MY_THREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE #define MY_THREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED typedef void *(* my_start_routine)(void *); #define MY_THREAD_ONCE_INIT PTHREAD_ONCE_INIT #endif typedef struct st_my_thread_handle { my_thread_t thread; #ifdef _WIN32 HANDLE handle; #endif } my_thread_handle; int my_thread_once(my_thread_once_t *once_control, void (*init_routine)(void)); static inline my_thread_t my_thread_self() { #ifdef _WIN32 return GetCurrentThreadId(); #else return pthread_self(); #endif } static inline int my_thread_equal(my_thread_t t1, my_thread_t t2) { #ifdef _WIN32 return t1 == t2; #else return pthread_equal(t1, t2); #endif } static inline int my_thread_attr_init(my_thread_attr_t *attr) { #ifdef _WIN32 attr->dwStackSize= 0; /* Set to joinable by default to match Linux */ attr->detachstate= MY_THREAD_CREATE_JOINABLE; return 0; #else return pthread_attr_init(attr); #endif } static inline int my_thread_attr_destroy(my_thread_attr_t *attr) { #ifdef _WIN32 attr->dwStackSize= 0; /* Set to joinable by default to match Linux */ attr->detachstate= MY_THREAD_CREATE_JOINABLE; return 0; #else return pthread_attr_destroy(attr); #endif } static inline int my_thread_attr_setstacksize(my_thread_attr_t *attr, size_t stacksize) { #ifdef _WIN32 attr->dwStackSize= (DWORD)stacksize; return 0; #else return pthread_attr_setstacksize(attr, stacksize); #endif } static inline int my_thread_attr_setdetachstate(my_thread_attr_t *attr, int detachstate) { #ifdef _WIN32 attr->detachstate= detachstate; return 0; #else return pthread_attr_setdetachstate(attr, detachstate); #endif } static inline int my_thread_attr_getstacksize(my_thread_attr_t *attr, size_t *stacksize) { #ifdef _WIN32 *stacksize= (size_t)attr->dwStackSize; return 0; #else return pthread_attr_getstacksize(attr, stacksize); #endif } static inline void my_thread_yield() { #ifdef _WIN32 SwitchToThread(); #else sched_yield(); #endif } int my_thread_create(my_thread_handle *thread, const my_thread_attr_t *attr, my_start_routine func, void *arg); int my_thread_join(my_thread_handle *thread, void **value_ptr); int my_thread_cancel(my_thread_handle *thread); void my_thread_exit(void *value_ptr); extern my_bool my_thread_global_init(); extern void my_thread_global_reinit(); extern void my_thread_global_end(); extern my_bool my_thread_init(); extern void my_thread_end(); C_MODE_END #endif /* MY_THREAD_INCLUDED */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/plugin_group_replication.h��������������������������������������������������������������������0000644�����������������00000013045�14763166026�0013203 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2013, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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, 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef MYSQL_PLUGIN_GROUP_REPLICATION_INCLUDED #define MYSQL_PLUGIN_GROUP_REPLICATION_INCLUDED /* API for Group Peplication plugin. (MYSQL_GROUP_REPLICATION_PLUGIN) */ #include <mysql/plugin.h> #define MYSQL_GROUP_REPLICATION_INTERFACE_VERSION 0x0101 /* Callbacks for get_connection_status_info function. context field can have NULL value, plugin will always pass it through all callbacks, independent of its value. Its value will not be used by plugin. All callbacks are mandatory. */ typedef struct st_group_replication_connection_status_callbacks { void* const context; void (*set_channel_name)(void* const context, const char& value, size_t length); void (*set_group_name)(void* const context, const char& value, size_t length); void (*set_source_uuid)(void* const context, const char& value, size_t length); void (*set_service_state)(void* const context, bool state); } GROUP_REPLICATION_CONNECTION_STATUS_CALLBACKS; /* Callbacks for get_group_members_info function. context field can have NULL value, plugin will always pass it through all callbacks, independent of its value. Its value will not be used by plugin. All callbacks are mandatory. */ typedef struct st_group_replication_group_members_callbacks { void* const context; void (*set_channel_name)(void* const context, const char& value, size_t length); void (*set_member_id)(void* const context, const char& value, size_t length); void (*set_member_host)(void* const context, const char& value, size_t length); void (*set_member_port)(void* const context, unsigned int value); void (*set_member_state)(void* const context, const char& value, size_t length); } GROUP_REPLICATION_GROUP_MEMBERS_CALLBACKS; /* Callbacks for get_group_member_stats_info function. context field can have NULL value, plugin will always pass it through all callbacks, independent of its value. Its value will not be used by plugin. All callbacks are mandatory. */ typedef struct st_group_replication_member_stats_callbacks { void* const context; void (*set_channel_name)(void* const context, const char& value, size_t length); void (*set_view_id)(void* const context, const char& value, size_t length); void (*set_member_id)(void* const context, const char& value, size_t length); void (*set_transactions_committed)(void* const context, const char& value, size_t length); void (*set_last_conflict_free_transaction)(void* const context, const char& value, size_t length); void (*set_transactions_in_queue)(void* const context, unsigned long long int value); void (*set_transactions_certified)(void* const context, unsigned long long int value); void (*set_transactions_conflicts_detected)(void* const context, unsigned long long int value); void (*set_transactions_rows_in_validation)(void* const context, unsigned long long int value); } GROUP_REPLICATION_GROUP_MEMBER_STATS_CALLBACKS; struct st_mysql_group_replication { int interface_version; /* This function is used to start the group replication. */ int (*start)(); /* This function is used to stop the group replication. */ int (*stop)(); /* This function is used to get the current group replication running status. */ bool (*is_running)(); /* This function initializes conflict checking module with info received from group on this member. @param info View_change_log_event with conflict checking info. */ int (*set_retrieved_certification_info)(void* info); /* This function is used to fetch information for group replication kernel stats. @param callbacks The set of callbacks and its context used to set the information on caller. @note The caller is responsible to free memory from the info structure and from all its fields. */ bool (*get_connection_status_info) (const GROUP_REPLICATION_CONNECTION_STATUS_CALLBACKS& callbacks); /* This function is used to fetch information for group replication members. @param callbacks The set of callbacks and its context used to set the information on caller. @note The caller is responsible to free memory from the info structure and from all its fields. */ bool (*get_group_members_info) (unsigned int index, const GROUP_REPLICATION_GROUP_MEMBERS_CALLBACKS& callbacks); /* This function is used to fetch information for group replication members statistics. @param callbacks The set of callbacks and its context used to set the information on caller. @note The caller is responsible to free memory from the info structure and from all its fields. */ bool (*get_group_member_stats_info) (const GROUP_REPLICATION_GROUP_MEMBER_STATS_CALLBACKS& callbacks); /* Get number of group replication members. */ unsigned int (*get_members_number_info)(); }; #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysqlx_ername.h�������������������������������������������������������������������������������0000644�����������������00000006356�14763166026�0010773 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2016 Oracle and/or its affiliates. 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; version 2 of the * License. * * 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., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ /* Autogenerated file, please don't edit */ #include "mysqlx_error.h" {"ER_X_BAD_MESSAGE", ER_X_BAD_MESSAGE, ""}, {"ER_X_CAPABILITIES_PREPARE_FAILED", ER_X_CAPABILITIES_PREPARE_FAILED, ""}, {"ER_X_CAPABILITY_NOT_FOUND", ER_X_CAPABILITY_NOT_FOUND, ""}, {"ER_X_INVALID_PROTOCOL_DATA", ER_X_INVALID_PROTOCOL_DATA, ""}, {"ER_X_SERVICE_ERROR", ER_X_SERVICE_ERROR, ""}, {"ER_X_SESSION", ER_X_SESSION, ""}, {"ER_X_INVALID_ARGUMENT", ER_X_INVALID_ARGUMENT, ""}, {"ER_X_MISSING_ARGUMENT", ER_X_MISSING_ARGUMENT, ""}, {"ER_X_BAD_INSERT_DATA", ER_X_BAD_INSERT_DATA, ""}, {"ER_X_CMD_NUM_ARGUMENTS", ER_X_CMD_NUM_ARGUMENTS, ""}, {"ER_X_CMD_ARGUMENT_TYPE", ER_X_CMD_ARGUMENT_TYPE, ""}, {"ER_X_CMD_ARGUMENT_VALUE", ER_X_CMD_ARGUMENT_VALUE, ""}, {"ER_X_BAD_UPDATE_DATA", ER_X_BAD_UPDATE_DATA, ""}, {"ER_X_BAD_TYPE_OF_UPDATE", ER_X_BAD_TYPE_OF_UPDATE, ""}, {"ER_X_BAD_COLUMN_TO_UPDATE", ER_X_BAD_COLUMN_TO_UPDATE, ""}, {"ER_X_BAD_MEMBER_TO_UPDATE", ER_X_BAD_MEMBER_TO_UPDATE, ""}, {"ER_X_BAD_STATEMENT_ID", ER_X_BAD_STATEMENT_ID, ""}, {"ER_X_BAD_CURSOR_ID", ER_X_BAD_CURSOR_ID, ""}, {"ER_X_BAD_SCHEMA", ER_X_BAD_SCHEMA, ""}, {"ER_X_BAD_TABLE", ER_X_BAD_TABLE, ""}, {"ER_X_BAD_PROJECTION", ER_X_BAD_PROJECTION, ""}, {"ER_X_DOC_ID_MISSING", ER_X_DOC_ID_MISSING, ""}, {"ER_X_DOC_ID_DUPLICATE", ER_X_DOC_ID_DUPLICATE, ""}, {"ER_X_DOC_REQUIRED_FIELD_MISSING", ER_X_DOC_REQUIRED_FIELD_MISSING, ""}, {"ER_X_PROJ_BAD_KEY_NAME", ER_X_PROJ_BAD_KEY_NAME, ""}, {"ER_X_BAD_DOC_PATH", ER_X_BAD_DOC_PATH, ""}, {"ER_X_CURSOR_EXISTS", ER_X_CURSOR_EXISTS, ""}, {"ER_X_EXPR_BAD_OPERATOR", ER_X_EXPR_BAD_OPERATOR, ""}, {"ER_X_EXPR_BAD_NUM_ARGS", ER_X_EXPR_BAD_NUM_ARGS, ""}, {"ER_X_EXPR_MISSING_ARG", ER_X_EXPR_MISSING_ARG, ""}, {"ER_X_EXPR_BAD_TYPE_VALUE", ER_X_EXPR_BAD_TYPE_VALUE, ""}, {"ER_X_EXPR_BAD_VALUE", ER_X_EXPR_BAD_VALUE, ""}, {"ER_X_INVALID_COLLECTION", ER_X_INVALID_COLLECTION, ""}, {"ER_X_INVALID_ADMIN_COMMAND", ER_X_INVALID_ADMIN_COMMAND, ""}, {"ER_X_EXPECT_NOT_OPEN", ER_X_EXPECT_NOT_OPEN, ""}, {"ER_X_EXPECT_FAILED", ER_X_EXPECT_FAILED, ""}, {"ER_X_EXPECT_BAD_CONDITION", ER_X_EXPECT_BAD_CONDITION, ""}, {"ER_X_EXPECT_BAD_CONDITION_VALUE", ER_X_EXPECT_BAD_CONDITION_VALUE, ""}, {"ER_X_INVALID_NAMESPACE", ER_X_INVALID_NAMESPACE, ""}, {"ER_X_BAD_NOTICE", ER_X_BAD_NOTICE, ""}, {"ER_X_CANNOT_DISABLE_NOTICE", ER_X_CANNOT_DISABLE_NOTICE, ""}, {"ER_X_BAD_CONFIGURATION", ER_X_BAD_CONFIGURATION, ""}, {"ER_X_MYSQLX_ACCOUNT_MISSING_PERMISSIONS", ER_X_MYSQLX_ACCOUNT_MISSING_PERMISSIONS, ""}, ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/sslopt-longopts.h�����������������������������������������������������������������������������0000644�����������������00000005476�14763166026�0011300 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) #ifdef MYSQL_CLIENT {"ssl-mode", OPT_SSL_MODE, "SSL connection mode.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ssl", OPT_SSL_SSL, "Deprecated. Use --ssl-mode instead.", &opt_use_ssl_arg, &opt_use_ssl_arg, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, {"ssl-verify-server-cert", OPT_SSL_VERIFY_SERVER_CERT, "Deprecated. Use --ssl-mode=VERIFY_IDENTITY instead.", &opt_ssl_verify_server_cert_arg, &opt_ssl_verify_server_cert_arg, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, #else {"ssl", OPT_SSL_SSL, "If set to ON, this option enforces that SSL is established before client " "attempts to authenticate to the server. To disable client SSL capabilities " "use --ssl=OFF.", &opt_use_ssl, &opt_use_ssl, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, #endif {"ssl-ca", OPT_SSL_CA, "CA file in PEM format.", &opt_ssl_ca, &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ssl-capath", OPT_SSL_CAPATH, "CA directory.", &opt_ssl_capath, &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ssl-cert", OPT_SSL_CERT, "X509 cert in PEM format.", &opt_ssl_cert, &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ssl-cipher", OPT_SSL_CIPHER, "SSL cipher to use.", &opt_ssl_cipher, &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ssl-key", OPT_SSL_KEY, "X509 key in PEM format.", &opt_ssl_key, &opt_ssl_key, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ssl-crl", OPT_SSL_CRL, "Certificate revocation list.", &opt_ssl_crl, &opt_ssl_crl, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ssl-crlpath", OPT_SSL_CRLPATH, "Certificate revocation list path.", &opt_ssl_crlpath, &opt_ssl_crlpath, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"tls-version", OPT_TLS_VERSION, "TLS version to use, " #ifndef HAVE_YASSL "permitted values are: TLSv1, TLSv1.1, TLSv1.2", #else "permitted values are: TLSv1, TLSv1.1", #endif &opt_tls_version, &opt_tls_version, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif /* HAVE_OPENSSL */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/big_endian.h����������������������������������������������������������������������������������0000644�����������������00000007106�14763166026�0010160 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2012, 2014, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <string.h> /* Data in big-endian format. */ static inline void float4store(uchar *T, float A) { *(T)= ((uchar *) &A)[3]; *((T)+1)=(char) ((uchar *) &A)[2]; *((T)+2)=(char) ((uchar *) &A)[1]; *((T)+3)=(char) ((uchar *) &A)[0]; } static inline void float4get (float *V, const uchar *M) { float def_temp; ((uchar*) &def_temp)[0]=(M)[3]; ((uchar*) &def_temp)[1]=(M)[2]; ((uchar*) &def_temp)[2]=(M)[1]; ((uchar*) &def_temp)[3]=(M)[0]; (*V)=def_temp; } static inline void float8store(uchar *T, double V) { *(T)= ((uchar *) &V)[7]; *((T)+1)=(char) ((uchar *) &V)[6]; *((T)+2)=(char) ((uchar *) &V)[5]; *((T)+3)=(char) ((uchar *) &V)[4]; *((T)+4)=(char) ((uchar *) &V)[3]; *((T)+5)=(char) ((uchar *) &V)[2]; *((T)+6)=(char) ((uchar *) &V)[1]; *((T)+7)=(char) ((uchar *) &V)[0]; } static inline void float8get (double *V, const uchar *M) { double def_temp; ((uchar*) &def_temp)[0]=(M)[7]; ((uchar*) &def_temp)[1]=(M)[6]; ((uchar*) &def_temp)[2]=(M)[5]; ((uchar*) &def_temp)[3]=(M)[4]; ((uchar*) &def_temp)[4]=(M)[3]; ((uchar*) &def_temp)[5]=(M)[2]; ((uchar*) &def_temp)[6]=(M)[1]; ((uchar*) &def_temp)[7]=(M)[0]; (*V) = def_temp; } static inline void ushortget(uint16 *V, const uchar *pM) { *V = (uint16) (((uint16) ((uchar) (pM)[1]))+ ((uint16) ((uint16) (pM)[0]) << 8)); } static inline void shortget (int16 *V, const uchar *pM) { *V = (short) (((short) ((uchar) (pM)[1]))+ ((short) ((short) (pM)[0]) << 8)); } static inline void longget (int32 *V, const uchar *pM) { int32 def_temp; ((uchar*) &def_temp)[0]=(pM)[0]; ((uchar*) &def_temp)[1]=(pM)[1]; ((uchar*) &def_temp)[2]=(pM)[2]; ((uchar*) &def_temp)[3]=(pM)[3]; (*V)=def_temp; } static inline void ulongget (uint32 *V, const uchar *pM) { uint32 def_temp; ((uchar*) &def_temp)[0]=(pM)[0]; ((uchar*) &def_temp)[1]=(pM)[1]; ((uchar*) &def_temp)[2]=(pM)[2]; ((uchar*) &def_temp)[3]=(pM)[3]; (*V)=def_temp; } static inline void shortstore(uchar *T, int16 A) { uint def_temp=(uint) (A) ; *(((char*)T)+1)=(char)(def_temp); *(((char*)T)+0)=(char)(def_temp >> 8); } static inline void longstore (uchar *T, int32 A) { *(((char*)T)+3)=((A)); *(((char*)T)+2)=(((A) >> 8)); *(((char*)T)+1)=(((A) >> 16)); *(((char*)T)+0)=(((A) >> 24)); } static inline void floatget(float *V, const uchar *M) { memcpy(V, (M), sizeof(float)); } static inline void floatstore(uchar *T, float V) { memcpy((T), (&V), sizeof(float)); } static inline void doubleget(double *V, const uchar *M) { memcpy(V, (M), sizeof(double)); } static inline void doublestore(uchar *T, double V) { memcpy((T), &V, sizeof(double)); } static inline void longlongget(longlong *V, const uchar *M) { memcpy(V, (M), sizeof(ulonglong)); } static inline void longlongstore(uchar *T, longlong V) { memcpy((T), &V, sizeof(ulonglong)); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/plugin_ftparser.h�����������������������������������������������������������������������������0000644�����������������00000016734�14763166026�0011314 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2005, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _my_plugin_ftparser_h #define _my_plugin_ftparser_h #include "plugin.h" /************************************************************************* API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN) */ /* Parsing modes. Set in MYSQL_FTPARSER_PARAM::mode */ enum enum_ftparser_mode { /* Fast and simple mode. This mode is used for indexing, and natural language queries. The parser is expected to return only those words that go into the index. Stopwords or too short/long words should not be returned. The 'boolean_info' argument of mysql_add_word() does not have to be set. */ MYSQL_FTPARSER_SIMPLE_MODE= 0, /* Parse with stopwords mode. This mode is used in boolean searches for "phrase matching." The parser is not allowed to ignore words in this mode. Every word should be returned, including stopwords and words that are too short or long. The 'boolean_info' argument of mysql_add_word() does not have to be set. */ MYSQL_FTPARSER_WITH_STOPWORDS= 1, /* Parse in boolean mode. This mode is used to parse a boolean query string. The parser should provide a valid MYSQL_FTPARSER_BOOLEAN_INFO structure in the 'boolean_info' argument to mysql_add_word(). Usually that means that the parser should recognize boolean operators in the parsing stream and set appropriate fields in MYSQL_FTPARSER_BOOLEAN_INFO structure accordingly. As for MYSQL_FTPARSER_WITH_STOPWORDS mode, no word should be ignored. Instead, use FT_TOKEN_STOPWORD for the token type of such a word. */ MYSQL_FTPARSER_FULL_BOOLEAN_INFO= 2 }; /* Token types for boolean mode searching (used for the type member of MYSQL_FTPARSER_BOOLEAN_INFO struct) FT_TOKEN_EOF: End of data. FT_TOKEN_WORD: Regular word. FT_TOKEN_LEFT_PAREN: Left parenthesis (start of group/sub-expression). FT_TOKEN_RIGHT_PAREN: Right parenthesis (end of group/sub-expression). FT_TOKEN_STOPWORD: Stopword. */ enum enum_ft_token_type { FT_TOKEN_EOF= 0, FT_TOKEN_WORD= 1, FT_TOKEN_LEFT_PAREN= 2, FT_TOKEN_RIGHT_PAREN= 3, FT_TOKEN_STOPWORD= 4 }; /* This structure is used in boolean search mode only. It conveys boolean-mode metadata to the MySQL search engine for every word in the search query. A valid instance of this structure must be filled in by the plugin parser and passed as an argument in the call to mysql_add_word (the callback function in the MYSQL_FTPARSER_PARAM structure) when a query is parsed in boolean mode. type: The token type. Should be one of the enum_ft_token_type values. yesno: Whether the word must be present for a match to occur: >0 Must be present <0 Must not be present 0 Neither; the word is optional but its presence increases the relevance With the default settings of the ft_boolean_syntax system variable, >0 corresponds to the '+' operator, <0 corrresponds to the '-' operator, and 0 means neither operator was used. weight_adjust: A weighting factor that determines how much a match for the word counts. Positive values increase, negative - decrease the relative word's importance in the query. wasign: The sign of the word's weight in the query. If it's non-negative the match for the word will increase document relevance, if it's negative - decrease (the word becomes a "noise word", the less of it the better). trunc: Corresponds to the '*' operator in the default setting of the ft_boolean_syntax system variable. position: Start position in bytes of the word in the document, used by InnoDB FTS. */ typedef struct st_mysql_ftparser_boolean_info { enum enum_ft_token_type type; int yesno; int weight_adjust; char wasign; char trunc; int position; /* These are parser state and must be removed. */ char prev; char *quot; } MYSQL_FTPARSER_BOOLEAN_INFO; /* The following flag means that buffer with a string (document, word) may be overwritten by the caller before the end of the parsing (that is before st_mysql_ftparser::deinit() call). If one needs the string to survive between two successive calls of the parsing function, she needs to save a copy of it. The flag may be set by MySQL before calling st_mysql_ftparser::parse(), or it may be set by a plugin before calling st_mysql_ftparser_param::mysql_parse() or st_mysql_ftparser_param::mysql_add_word(). */ #define MYSQL_FTFLAGS_NEED_COPY 1 /* An argument of the full-text parser plugin. This structure is filled in by MySQL server and passed to the parsing function of the plugin as an in/out parameter. mysql_parse: A pointer to the built-in parser implementation of the server. It's set by the server and can be used by the parser plugin to invoke the MySQL default parser. If plugin's role is to extract textual data from .doc, .pdf or .xml content, it might extract plaintext from the content, and then pass the text to the default MySQL parser to be parsed. mysql_add_word: A server callback to add a new word. When parsing a document, the server sets this to point at a function that adds the word to MySQL full-text index. When parsing a search query, this function will add the new word to the list of words to search for. The boolean_info argument can be NULL for all cases except when mode is MYSQL_FTPARSER_FULL_BOOLEAN_INFO. ftparser_state: A generic pointer. The plugin can set it to point to information to be used internally for its own purposes. mysql_ftparam: This is set by the server. It is used by MySQL functions called via mysql_parse() and mysql_add_word() callback. The plugin should not modify it. cs: Information about the character set of the document or query string. doc: A pointer to the document or query string to be parsed. length: Length of the document or query string, in bytes. flags: See MYSQL_FTFLAGS_* constants above. mode: The parsing mode. With boolean operators, with stopwords, or nothing. See enum_ftparser_mode above. */ typedef struct st_mysql_ftparser_param { int (*mysql_parse)(struct st_mysql_ftparser_param *, char *doc, int doc_len); int (*mysql_add_word)(struct st_mysql_ftparser_param *, char *word, int word_len, MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info); void *ftparser_state; void *mysql_ftparam; const struct charset_info_st *cs; char *doc; int length; int flags; enum enum_ftparser_mode mode; } MYSQL_FTPARSER_PARAM; /* Full-text parser descriptor. interface_version is, e.g., MYSQL_FTPARSER_INTERFACE_VERSION. The parsing, initialization, and deinitialization functions are invoked per SQL statement for which the parser is used. */ struct st_mysql_ftparser { int interface_version; int (*parse)(MYSQL_FTPARSER_PARAM *param); int (*init)(MYSQL_FTPARSER_PARAM *param); int (*deinit)(MYSQL_FTPARSER_PARAM *param); }; #endif ������������������������������������mysql/mysql_time.h����������������������������������������������������������������������������������0000644�����������������00000004174�14763166026�0010266 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2004, 2011, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _mysql_time_h_ #define _mysql_time_h_ /* Time declarations shared between the server and client API: you should not add anything to this header unless it's used (and hence should be visible) in mysql.h. If you're looking for a place to add new time-related declaration, it's most likely my_time.h. See also "C API Handling of Date and Time Values" chapter in documentation. */ enum enum_mysql_timestamp_type { MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1, MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2 }; /* Structure which is used to represent datetime values inside MySQL. We assume that values in this structure are normalized, i.e. year <= 9999, month <= 12, day <= 31, hour <= 23, hour <= 59, hour <= 59. Many functions in server such as my_system_gmt_sec() or make_time() family of functions rely on this (actually now usage of make_*() family relies on a bit weaker restriction). Also functions that produce MYSQL_TIME as result ensure this. There is one exception to this rule though if this structure holds time value (time_type == MYSQL_TIMESTAMP_TIME) days and hour member can hold bigger values. */ typedef struct st_mysql_time { unsigned int year, month, day, hour, minute, second; unsigned long second_part; /**< microseconds */ my_bool neg; enum enum_mysql_timestamp_type time_type; } MYSQL_TIME; #endif /* _mysql_time_h_ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/m_string.h������������������������������������������������������������������������������������0000644�����������������00000024742�14763166026�0007730 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _m_string_h #define _m_string_h #include "my_global.h" /* HAVE_* */ #include <string.h> #define bfill please_use_memset_rather_than_bfill #define bzero please_use_memset_rather_than_bzero #define bmove please_use_memmove_rather_than_bmove #define strmov please_use_my_stpcpy_or_my_stpmov_rather_than_strmov #define strnmov please_use_my_stpncpy_or_my_stpnmov_rather_than_strnmov #include "mysql/service_my_snprintf.h" #if defined(__cplusplus) extern "C" { #endif /* my_str_malloc(), my_str_realloc() and my_str_free() are assigned to implementations in strings/alloc.c, but can be overridden in the calling program. */ extern void *(*my_str_malloc)(size_t); extern void *(*my_str_realloc)(void *, size_t); extern void (*my_str_free)(void *); /* Declared in int2str() */ extern char _dig_vec_upper[]; extern char _dig_vec_lower[]; /* Prototypes for string functions */ extern void bchange(uchar *dst,size_t old_len,const uchar *src, size_t new_len,size_t tot_len); extern void strappend(char *s,size_t len,pchar fill); extern char *strend(const char *s); extern char *strcend(const char *, pchar); extern char *strfill(char * s,size_t len,pchar fill); extern char *strmake(char *dst,const char *src,size_t length); extern char *my_stpmov(char *dst,const char *src); extern char *my_stpnmov(char *dst, const char *src, size_t n); extern char *strcont(const char *src, const char *set); extern char *strxmov(char *dst, const char *src, ...); extern char *strxnmov(char *dst, size_t len, const char *src, ...); /** Copy a string from src to dst until (and including) terminating null byte. @param dst Destination @param src Source @note src and dst cannot overlap. Use my_stpmov() if src and dst overlaps. @note Unsafe, consider using my_stpnpy() instead. @return pointer to terminating null byte. */ static inline char *my_stpcpy(char *dst, const char *src) { #if defined(HAVE_BUILTIN_STPCPY) return __builtin_stpcpy(dst, src); #elif defined(HAVE_STPCPY) return stpcpy(dst, src); #else /* Fallback to implementation supporting overlap. */ return my_stpmov(dst, src); #endif } /** Copy fixed-size string from src to dst. @param dst Destination @param src Source @param n Maximum number of characters to copy. @note src and dst cannot overlap Use my_stpnmov() if src and dst overlaps. @return pointer to terminating null byte. */ static inline char *my_stpncpy(char *dst, const char *src, size_t n) { #if defined(HAVE_STPNCPY) return stpncpy(dst, src, n); #else /* Fallback to implementation supporting overlap. */ return my_stpnmov(dst, src, n); #endif } static inline longlong my_strtoll(const char *nptr, char **endptr, int base) { #if defined _WIN32 return _strtoi64(nptr, endptr, base); #else return strtoll(nptr, endptr, base); #endif } static inline ulonglong my_strtoull(const char *nptr, char **endptr, int base) { #if defined _WIN32 return _strtoui64(nptr, endptr, base); #else return strtoull(nptr, endptr, base); #endif } static inline char *my_strtok_r(char *str, const char *delim, char **saveptr) { #if defined _WIN32 return strtok_s(str, delim, saveptr); #else return strtok_r(str, delim, saveptr); #endif } /* native_ rather than my_ since my_strcasecmp already exists */ static inline int native_strcasecmp(const char *s1, const char *s2) { #if defined _WIN32 return _stricmp(s1, s2); #else return strcasecmp(s1, s2); #endif } /* native_ rather than my_ for consistency with native_strcasecmp */ static inline int native_strncasecmp(const char *s1, const char *s2, size_t n) { #if defined _WIN32 return _strnicmp(s1, s2, n); #else return strncasecmp(s1, s2, n); #endif } /* Prototypes of normal stringfunctions (with may ours) */ #ifndef HAVE_STRNLEN extern size_t strnlen(const char *s, size_t n); #endif extern int is_prefix(const char *, const char *); /* Conversion routines */ typedef enum { MY_GCVT_ARG_FLOAT, MY_GCVT_ARG_DOUBLE } my_gcvt_arg_type; double my_strtod(const char *str, char **end, int *error); double my_atof(const char *nptr); size_t my_fcvt(double x, int precision, char *to, my_bool *error); size_t my_gcvt(double x, my_gcvt_arg_type type, int width, char *to, my_bool *error); #define NOT_FIXED_DEC 31 /* The longest string my_fcvt can return is 311 + "precision" bytes. Here we assume that we never cal my_fcvt() with precision >= NOT_FIXED_DEC (+ 1 byte for the terminating '\0'). */ #define FLOATING_POINT_BUFFER (311 + NOT_FIXED_DEC) /* We want to use the 'e' format in some cases even if we have enough space for the 'f' one just to mimic sprintf("%.15g") behavior for large integers, and to improve it for numbers < 10^(-4). That is, for |x| < 1 we require |x| >= 10^(-15), and for |x| > 1 we require it to be integer and be <= 10^DBL_DIG for the 'f' format to be used. We don't lose precision, but make cases like "1e200" or "0.00001" look nicer. */ #define MAX_DECPT_FOR_F_FORMAT DBL_DIG /* The maximum possible field width for my_gcvt() conversion. (DBL_DIG + 2) significant digits + sign + "." + ("e-NNN" or MAX_DECPT_FOR_F_FORMAT zeros for cases when |x|<1 and the 'f' format is used). */ #define MY_GCVT_MAX_FIELD_WIDTH (DBL_DIG + 4 + MY_MAX(5, MAX_DECPT_FOR_F_FORMAT)) \ extern char *llstr(longlong value,char *buff); extern char *ullstr(longlong value,char *buff); extern char *int2str(long val, char *dst, int radix, int upcase); extern char *int10_to_str(long val,char *dst,int radix); extern char *str2int(const char *src,int radix,long lower,long upper, long *val); longlong my_strtoll10(const char *nptr, char **endptr, int *error); #if SIZEOF_LONG == SIZEOF_LONG_LONG #define ll2str(A,B,C,D) int2str((A),(B),(C),(D)) #define longlong10_to_str(A,B,C) int10_to_str((A),(B),(C)) #undef strtoll #define strtoll(A,B,C) strtol((A),(B),(C)) #define strtoull(A,B,C) strtoul((A),(B),(C)) #else extern char *ll2str(longlong val,char *dst,int radix, int upcase); extern char *longlong10_to_str(longlong val,char *dst,int radix); #endif #define longlong2str(A,B,C) ll2str((A),(B),(C),1) #if defined(__cplusplus) } #endif /* LEX_STRING -- a pair of a C-string and its length. (it's part of the plugin API as a MYSQL_LEX_STRING) Ditto LEX_CSTRING/MYSQL_LEX_CSTRING. */ #include <mysql/mysql_lex_string.h> typedef struct st_mysql_lex_string LEX_STRING; typedef struct st_mysql_const_lex_string LEX_CSTRING; #define STRING_WITH_LEN(X) (X), ((sizeof(X) - 1)) #define USTRING_WITH_LEN(X) ((uchar*) X), ((sizeof(X) - 1)) #define C_STRING_WITH_LEN(X) ((char *) (X)), ((sizeof(X) - 1)) /** Skip trailing space. On most systems reading memory in larger chunks (ideally equal to the size of the chunks that the machine physically reads from memory) causes fewer memory access loops and hence increased performance. This is why the 'int' type is used : it's closest to that (according to how it's defined in C). So when we determine the amount of whitespace at the end of a string we do the following : 1. We divide the string into 3 zones : a) from the start of the string (__start) to the first multiple of sizeof(int) (__start_words) b) from the end of the string (__end) to the last multiple of sizeof(int) (__end_words) c) a zone that is aligned to sizeof(int) and can be safely accessed through an int * 2. We start comparing backwards from (c) char-by-char. If all we find is space then we continue 3. If there are elements in zone (b) we compare them as unsigned ints to a int mask (SPACE_INT) consisting of all spaces 4. Finally we compare the remaining part (a) of the string char by char. This covers for the last non-space unsigned int from 3. (if any) This algorithm works well for relatively larger strings, but it will slow the things down for smaller strings (because of the additional calculations and checks compared to the naive method). Thus the barrier of length 20 is added. @param ptr pointer to the input string @param len the length of the string @return the last non-space character */ #if defined(__sparc) || defined(__sparcv9) static inline const uchar *skip_trailing_space(const uchar *ptr,size_t len) { /* SPACE_INT is a word that contains only spaces */ #if SIZEOF_INT == 4 const unsigned SPACE_INT= 0x20202020U; #elif SIZEOF_INT == 8 const unsigned SPACE_INT= 0x2020202020202020ULL; #else #error define the appropriate constant for a word full of spaces #endif const uchar *end= ptr + len; if (len > 20) { const uchar *end_words= (const uchar *)(intptr) (((ulonglong)(intptr)end) / SIZEOF_INT * SIZEOF_INT); const uchar *start_words= (const uchar *)(intptr) ((((ulonglong)(intptr)ptr) + SIZEOF_INT - 1) / SIZEOF_INT * SIZEOF_INT); DBUG_ASSERT(end_words > ptr); while (end > end_words && end[-1] == 0x20) end--; if (end[-1] == 0x20 && start_words < end_words) while (end > start_words && ((unsigned *)end)[-1] == SPACE_INT) end -= SIZEOF_INT; } while (end > ptr && end[-1] == 0x20) end--; return (end); } #else /* Reads 8 bytes at a time, ignoring alignment. We use uint8korr, which is fast (it simply reads a *ulonglong) on all platforms, except sparc. */ static inline const uchar *skip_trailing_space(const uchar *ptr, size_t len) { const uchar *end= ptr + len; while (end - ptr >= 8) { if (uint8korr(end-8) != 0x2020202020202020ULL) break; end-= 8; } while (end > ptr && end[-1] == 0x20) end--; return (end); } #endif static inline void lex_string_set(LEX_STRING *lex_str, const char *c_str) { lex_str->str= (char *) c_str; lex_str->length= strlen(c_str); } static inline void lex_cstring_set(LEX_CSTRING *lex_str, const char *c_str) { lex_str->str= c_str; lex_str->length= strlen(c_str); } #endif ������������������������������mysql/keycache.h������������������������������������������������������������������������������������0000644�����������������00000016501�14763166026�0007654 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2003, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Key cache variable structures */ #ifndef _keycache_h #define _keycache_h #include "my_sys.h" /* flush_type */ C_MODE_START /* declare structures that is used by st_key_cache */ struct st_block_link; typedef struct st_block_link BLOCK_LINK; struct st_hash_link; typedef struct st_hash_link HASH_LINK; /* Thread specific variables */ typedef struct st_keycache_thread_var { mysql_cond_t suspend; struct st_keycache_thread_var *next,**prev; void *opt_info; } st_keycache_thread_var; /* info about requests in a waiting queue */ typedef struct st_keycache_wqueue { st_keycache_thread_var *last_thread; /* circular list of waiting threads */ } KEYCACHE_WQUEUE; #define CHANGED_BLOCKS_HASH 128 /* must be power of 2 */ /* The key cache structure It also contains read-only statistics parameters. */ typedef struct st_key_cache { my_bool key_cache_inited; my_bool in_resize; /* true during resize operation */ my_bool resize_in_flush; /* true during flush of resize operation */ my_bool can_be_used; /* usage of cache for read/write is allowed */ size_t key_cache_mem_size; /* specified size of the cache memory */ uint key_cache_block_size; /* size of the page buffer of a cache block */ ulonglong min_warm_blocks; /* min number of warm blocks; */ ulonglong age_threshold; /* age threshold for hot blocks */ ulonglong keycache_time; /* total number of block link operations */ uint hash_entries; /* max number of entries in the hash table */ int hash_links; /* max number of hash links */ int hash_links_used; /* number of hash links currently used */ int disk_blocks; /* max number of blocks in the cache */ ulong blocks_used; /* maximum number of concurrently used blocks */ ulong blocks_unused; /* number of currently unused blocks */ ulong blocks_changed; /* number of currently dirty blocks */ ulong warm_blocks; /* number of blocks in warm sub-chain */ ulong cnt_for_resize_op; /* counter to block resize operation */ long blocks_available; /* number of blocks available in the LRU chain */ HASH_LINK **hash_root; /* arr. of entries into hash table buckets */ HASH_LINK *hash_link_root; /* memory for hash table links */ HASH_LINK *free_hash_list; /* list of free hash links */ BLOCK_LINK *free_block_list; /* list of free blocks */ BLOCK_LINK *block_root; /* memory for block links */ uchar *block_mem; /* memory for block buffers */ BLOCK_LINK *used_last; /* ptr to the last block of the LRU chain */ BLOCK_LINK *used_ins; /* ptr to the insertion block in LRU chain */ mysql_mutex_t cache_lock; /* to lock access to the cache structure */ KEYCACHE_WQUEUE resize_queue; /* threads waiting during resize operation */ /* Waiting for a zero resize count. Using a queue for symmetry though only one thread can wait here. */ KEYCACHE_WQUEUE waiting_for_resize_cnt; KEYCACHE_WQUEUE waiting_for_hash_link; /* waiting for a free hash link */ KEYCACHE_WQUEUE waiting_for_block; /* requests waiting for a free block */ BLOCK_LINK *changed_blocks[CHANGED_BLOCKS_HASH]; /* hash for dirty file bl.*/ BLOCK_LINK *file_blocks[CHANGED_BLOCKS_HASH]; /* hash for other file bl.*/ /* The following variables are and variables used to hold parameters for initializing the key cache. */ ulonglong param_buff_size; /* size the memory allocated for the cache */ ulonglong param_block_size; /* size of the blocks in the key cache */ ulonglong param_division_limit; /* min. percentage of warm blocks */ ulonglong param_age_threshold; /* determines when hot block is downgraded */ /* Statistics variables. These are reset in reset_key_cache_counters(). */ ulong global_blocks_changed; /* number of currently dirty blocks */ ulonglong global_cache_w_requests;/* number of write requests (write hits) */ ulonglong global_cache_write; /* number of writes from cache to files */ ulonglong global_cache_r_requests;/* number of read requests (read hits) */ ulonglong global_cache_read; /* number of reads from files to cache */ int blocks; /* max number of blocks in the cache */ my_bool in_init; /* Set to 1 in MySQL during init/resize */ } KEY_CACHE; /* The default key cache */ extern KEY_CACHE dflt_key_cache_var, *dflt_key_cache; extern int init_key_cache(KEY_CACHE *keycache, ulonglong key_cache_block_size, size_t use_mem, ulonglong division_limit, ulonglong age_threshold); extern int resize_key_cache(KEY_CACHE *keycache, st_keycache_thread_var *thread_var, ulonglong key_cache_block_size, size_t use_mem, ulonglong division_limit, ulonglong age_threshold); extern uchar *key_cache_read(KEY_CACHE *keycache, st_keycache_thread_var *thread_var, File file, my_off_t filepos, int level, uchar *buff, uint length, uint block_length,int return_buffer); extern int key_cache_insert(KEY_CACHE *keycache, st_keycache_thread_var *thread_var, File file, my_off_t filepos, int level, uchar *buff, uint length); extern int key_cache_write(KEY_CACHE *keycache, st_keycache_thread_var *thread_var, File file, my_off_t filepos, int level, uchar *buff, uint length, uint block_length,int force_write); extern int flush_key_blocks(KEY_CACHE *keycache, st_keycache_thread_var *thread_var, int file, enum flush_type type); extern void end_key_cache(KEY_CACHE *keycache, my_bool cleanup); /* Functions to handle multiple key caches */ extern my_bool multi_keycache_init(void); extern void multi_keycache_free(void); extern KEY_CACHE *multi_key_cache_search(uchar *key, uint length); extern my_bool multi_key_cache_set(const uchar *key, uint length, KEY_CACHE *key_cache); extern void multi_key_cache_change(KEY_CACHE *old_data, KEY_CACHE *new_data); extern int reset_key_cache_counters(const char *name, KEY_CACHE *key_cache); C_MODE_END #endif /* _keycache_h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/plugin.h��������������������������������������������������������������������������������������0000644�����������������00000067621�14763166026�0007407 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2005, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _my_plugin_h #define _my_plugin_h #ifndef MYSQL_ABI_CHECK #include <stddef.h> #include "mysql_version.h" /* MYSQL_VERSION_ID */ #endif /* On Windows, exports from DLL need to be declared. Also, plugin needs to be declared as extern "C" because MSVC unlike other compilers, uses C++ mangling for variables not only for functions. */ #if defined(_MSC_VER) #if defined(MYSQL_DYNAMIC_PLUGIN) #ifdef __cplusplus #define MYSQL_PLUGIN_EXPORT extern "C" __declspec(dllexport) #else #define MYSQL_PLUGIN_EXPORT __declspec(dllexport) #endif #else /* MYSQL_DYNAMIC_PLUGIN */ #ifdef __cplusplus #define MYSQL_PLUGIN_EXPORT extern "C" #else #define MYSQL_PLUGIN_EXPORT #endif #endif /*MYSQL_DYNAMIC_PLUGIN */ #else /*_MSC_VER */ #define MYSQL_PLUGIN_EXPORT #endif #ifdef __cplusplus class THD; class Item; #define MYSQL_THD THD* #else #define MYSQL_THD void* #endif typedef void * MYSQL_PLUGIN; #ifndef MYSQL_ABI_CHECK #include <mysql/services.h> #ifndef __WIN__ #ifndef __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS /* Enable C99 printf format macros */ #endif /* !__STDC_FORMAT_MACROS */ #include <inttypes.h> #endif /* !__WIN__ */ #endif /* !MYSQL_ABI_CHECK */ #define MYSQL_XIDDATASIZE 128 /** struct st_mysql_xid is binary compatible with the XID structure as in the X/Open CAE Specification, Distributed Transaction Processing: The XA Specification, X/Open Company Ltd., 1991. http://www.opengroup.org/bookstore/catalog/c193.htm @see XID in sql/handler.h */ struct st_mysql_xid { long formatID; long gtrid_length; long bqual_length; char data[MYSQL_XIDDATASIZE]; /* Not \0-terminated */ }; typedef struct st_mysql_xid MYSQL_XID; /************************************************************************* Plugin API. Common for all plugin types. */ #define MYSQL_PLUGIN_INTERFACE_VERSION 0x0107 /* The allowable types of plugins */ #define MYSQL_UDF_PLUGIN 0 /* User-defined function */ #define MYSQL_STORAGE_ENGINE_PLUGIN 1 /* Storage Engine */ #define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */ #define MYSQL_DAEMON_PLUGIN 3 /* The daemon/raw plugin type */ #define MYSQL_INFORMATION_SCHEMA_PLUGIN 4 /* The I_S plugin type */ #define MYSQL_AUDIT_PLUGIN 5 /* The Audit plugin type */ #define MYSQL_REPLICATION_PLUGIN 6 /* The replication plugin type */ #define MYSQL_AUTHENTICATION_PLUGIN 7 /* The authentication plugin type */ #define MYSQL_VALIDATE_PASSWORD_PLUGIN 8 /* validate password plugin type */ #define MYSQL_GROUP_REPLICATION_PLUGIN 9 /* The Group Replication plugin */ #define MYSQL_KEYRING_PLUGIN 10 /* The Keyring plugin type */ #define MYSQL_MAX_PLUGIN_TYPE_NUM 11 /* The number of plugin types */ /* We use the following strings to define licenses for plugins */ #define PLUGIN_LICENSE_PROPRIETARY 0 #define PLUGIN_LICENSE_GPL 1 #define PLUGIN_LICENSE_BSD 2 #define PLUGIN_LICENSE_PROPRIETARY_STRING "PROPRIETARY" #define PLUGIN_LICENSE_GPL_STRING "GPL" #define PLUGIN_LICENSE_BSD_STRING "BSD" /* Macros for beginning and ending plugin declarations. Between mysql_declare_plugin and mysql_declare_plugin_end there should be a st_mysql_plugin struct for each plugin to be declared. */ #ifndef MYSQL_DYNAMIC_PLUGIN #define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \ MYSQL_PLUGIN_EXPORT int VERSION= MYSQL_PLUGIN_INTERFACE_VERSION; \ MYSQL_PLUGIN_EXPORT int PSIZE= sizeof(struct st_mysql_plugin); \ MYSQL_PLUGIN_EXPORT struct st_mysql_plugin DECLS[]= { #else #define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \ MYSQL_PLUGIN_EXPORT int _mysql_plugin_interface_version_= MYSQL_PLUGIN_INTERFACE_VERSION; \ MYSQL_PLUGIN_EXPORT int _mysql_sizeof_struct_st_plugin_= sizeof(struct st_mysql_plugin); \ MYSQL_PLUGIN_EXPORT struct st_mysql_plugin _mysql_plugin_declarations_[]= { #endif #define mysql_declare_plugin(NAME) \ __MYSQL_DECLARE_PLUGIN(NAME, \ builtin_ ## NAME ## _plugin_interface_version, \ builtin_ ## NAME ## _sizeof_struct_st_plugin, \ builtin_ ## NAME ## _plugin) #define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0,0,0}} /** Declarations for SHOW STATUS support in plugins */ enum enum_mysql_show_type { SHOW_UNDEF, SHOW_BOOL, SHOW_INT, ///< shown as _unsigned_ int SHOW_LONG, ///< shown as _unsigned_ long SHOW_LONGLONG, ///< shown as _unsigned_ longlong SHOW_SIGNED_INT, SHOW_SIGNED_LONG, SHOW_SIGNED_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE #ifdef MYSQL_SERVER /* This include defines server-only values of the enum. Using them in plugins is not supported. */ #include "sql_plugin_enum.h" #endif }; /** Status variable scope. Only GLOBAL status variable scope is available in plugins. */ enum enum_mysql_show_scope { SHOW_SCOPE_UNDEF, SHOW_SCOPE_GLOBAL #ifdef MYSQL_SERVER /* Server-only values. Not supported in plugins. */ , SHOW_SCOPE_SESSION, SHOW_SCOPE_ALL #endif }; /** SHOW STATUS Server status variable */ struct st_mysql_show_var { const char *name; char *value; enum enum_mysql_show_type type; enum enum_mysql_show_scope scope; }; #define SHOW_VAR_MAX_NAME_LEN 64 #define SHOW_VAR_FUNC_BUFF_SIZE 1024 typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, char *); /* Constants for plugin flags. */ #define PLUGIN_OPT_NO_INSTALL 1UL /* Not dynamically loadable */ #define PLUGIN_OPT_NO_UNINSTALL 2UL /* Not dynamically unloadable */ /* declarations for server variables and command line options */ #define PLUGIN_VAR_BOOL 0x0001 #define PLUGIN_VAR_INT 0x0002 #define PLUGIN_VAR_LONG 0x0003 #define PLUGIN_VAR_LONGLONG 0x0004 #define PLUGIN_VAR_STR 0x0005 #define PLUGIN_VAR_ENUM 0x0006 #define PLUGIN_VAR_SET 0x0007 #define PLUGIN_VAR_DOUBLE 0x0008 #define PLUGIN_VAR_UNSIGNED 0x0080 #define PLUGIN_VAR_THDLOCAL 0x0100 /* Variable is per-connection */ #define PLUGIN_VAR_READONLY 0x0200 /* Server variable is read only */ #define PLUGIN_VAR_NOSYSVAR 0x0400 /* Not a server variable */ #define PLUGIN_VAR_NOCMDOPT 0x0800 /* Not a command line option */ #define PLUGIN_VAR_NOCMDARG 0x1000 /* No argument for cmd line */ #define PLUGIN_VAR_RQCMDARG 0x0000 /* Argument required for cmd line */ #define PLUGIN_VAR_OPCMDARG 0x2000 /* Argument optional for cmd line */ #define PLUGIN_VAR_NODEFAULT 0x4000 /* SET DEFAULT is prohibited */ #define PLUGIN_VAR_MEMALLOC 0x8000 /* String needs memory allocated */ struct st_mysql_sys_var; struct st_mysql_value; /* SYNOPSIS (*mysql_var_check_func)() thd thread handle var dynamic variable being altered save pointer to temporary storage value user provided value RETURN 0 user provided value is OK and the update func may be called. any other value indicates error. This function should parse the user provided value and store in the provided temporary storage any data as required by the update func. There is sufficient space in the temporary storage to store a double. Note that the update func may not be called if any other error occurs so any memory allocated should be thread-local so that it may be freed automatically at the end of the statement. */ typedef int (*mysql_var_check_func)(MYSQL_THD thd, struct st_mysql_sys_var *var, void *save, struct st_mysql_value *value); /* SYNOPSIS (*mysql_var_update_func)() thd thread handle var dynamic variable being altered var_ptr pointer to dynamic variable save pointer to temporary storage RETURN NONE This function should use the validated value stored in the temporary store and persist it in the provided pointer to the dynamic variable. For example, strings may require memory to be allocated. */ typedef void (*mysql_var_update_func)(MYSQL_THD thd, struct st_mysql_sys_var *var, void *var_ptr, const void *save); /* the following declarations are for internal use only */ #define PLUGIN_VAR_MASK \ (PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | \ PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_NOCMDARG | \ PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC | \ PLUGIN_VAR_NODEFAULT) #define MYSQL_PLUGIN_VAR_HEADER \ int flags; \ const char *name; \ const char *comment; \ mysql_var_check_func check; \ mysql_var_update_func update #define MYSQL_SYSVAR_NAME(name) mysql_sysvar_ ## name #define MYSQL_SYSVAR(name) \ ((struct st_mysql_sys_var *)&(MYSQL_SYSVAR_NAME(name))) /* for global variables, the value pointer is the first element after the header, the default value is the second. for thread variables, the value offset is the first element after the header, the default value is the second. */ #define DECLARE_MYSQL_SYSVAR_BASIC(name, type) struct { \ MYSQL_PLUGIN_VAR_HEADER; \ type *value; \ const type def_val; \ } MYSQL_SYSVAR_NAME(name) #define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) struct { \ MYSQL_PLUGIN_VAR_HEADER; \ type *value; type def_val; \ type min_val; type max_val; \ type blk_sz; \ } MYSQL_SYSVAR_NAME(name) #define DECLARE_MYSQL_SYSVAR_TYPELIB(name, type) struct { \ MYSQL_PLUGIN_VAR_HEADER; \ type *value; type def_val; \ TYPELIB *typelib; \ } MYSQL_SYSVAR_NAME(name) #define DECLARE_THDVAR_FUNC(type) \ type *(*resolve)(MYSQL_THD thd, int offset) #define DECLARE_MYSQL_THDVAR_BASIC(name, type) struct { \ MYSQL_PLUGIN_VAR_HEADER; \ int offset; \ const type def_val; \ DECLARE_THDVAR_FUNC(type); \ } MYSQL_SYSVAR_NAME(name) #define DECLARE_MYSQL_THDVAR_SIMPLE(name, type) struct { \ MYSQL_PLUGIN_VAR_HEADER; \ int offset; \ type def_val; type min_val; \ type max_val; type blk_sz; \ DECLARE_THDVAR_FUNC(type); \ } MYSQL_SYSVAR_NAME(name) #define DECLARE_MYSQL_THDVAR_TYPELIB(name, type) struct { \ MYSQL_PLUGIN_VAR_HEADER; \ int offset; \ type def_val; \ DECLARE_THDVAR_FUNC(type); \ TYPELIB *typelib; \ } MYSQL_SYSVAR_NAME(name) /* the following declarations are for use by plugin implementors */ #define MYSQL_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \ DECLARE_MYSQL_SYSVAR_BASIC(name, char) = { \ PLUGIN_VAR_BOOL | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def} #define MYSQL_SYSVAR_STR(name, varname, opt, comment, check, update, def) \ DECLARE_MYSQL_SYSVAR_BASIC(name, char *) = { \ PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def} #define MYSQL_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_SYSVAR_SIMPLE(name, int) = { \ PLUGIN_VAR_INT | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, min, max, blk } #define MYSQL_SYSVAR_UINT(name, varname, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned int) = { \ PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, min, max, blk } #define MYSQL_SYSVAR_LONG(name, varname, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_SYSVAR_SIMPLE(name, long) = { \ PLUGIN_VAR_LONG | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, min, max, blk } #define MYSQL_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long) = { \ PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, min, max, blk } #define MYSQL_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_SYSVAR_SIMPLE(name, long long) = { \ PLUGIN_VAR_LONGLONG | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, min, max, blk } #define MYSQL_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long long) = { \ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, min, max, blk } #define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \ DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long) = { \ PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, typelib } #define MYSQL_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \ DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long long) = { \ PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, typelib } #define MYSQL_SYSVAR_DOUBLE(name, varname, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_SYSVAR_SIMPLE(name, double) = { \ PLUGIN_VAR_DOUBLE | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, min, max, blk } #define MYSQL_THDVAR_BOOL(name, opt, comment, check, update, def) \ DECLARE_MYSQL_THDVAR_BASIC(name, char) = { \ PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, NULL} #define MYSQL_THDVAR_STR(name, opt, comment, check, update, def) \ DECLARE_MYSQL_THDVAR_BASIC(name, char *) = { \ PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, NULL} #define MYSQL_THDVAR_INT(name, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_THDVAR_SIMPLE(name, int) = { \ PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, min, max, blk, NULL } #define MYSQL_THDVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned int) = { \ PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, min, max, blk, NULL } #define MYSQL_THDVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_THDVAR_SIMPLE(name, long) = { \ PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, min, max, blk, NULL } #define MYSQL_THDVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long) = { \ PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, min, max, blk, NULL } #define MYSQL_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_THDVAR_SIMPLE(name, long long) = { \ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, min, max, blk, NULL } #define MYSQL_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long long) = { \ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, min, max, blk, NULL } #define MYSQL_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \ DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long) = { \ PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, NULL, typelib } #define MYSQL_THDVAR_SET(name, opt, comment, check, update, def, typelib) \ DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long long) = { \ PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, NULL, typelib } #define MYSQL_THDVAR_DOUBLE(name, opt, comment, check, update, def, min, max, blk) \ DECLARE_MYSQL_THDVAR_SIMPLE(name, double) = { \ PLUGIN_VAR_DOUBLE | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, min, max, blk, NULL } /* accessor macros */ #define SYSVAR(name) \ (*(MYSQL_SYSVAR_NAME(name).value)) /* when thd == null, result points to global value */ #define THDVAR(thd, name) \ (*(MYSQL_SYSVAR_NAME(name).resolve(thd, MYSQL_SYSVAR_NAME(name).offset))) #define THDVAR_SET(thd, name, value) \ plugin_thdvar_safe_update(thd, MYSQL_SYSVAR(name), \ (char **) &THDVAR(thd, name), \ (const char *) value); /* Plugin description structure. */ struct st_mysql_plugin { int type; /* the plugin type (a MYSQL_XXX_PLUGIN value) */ void *info; /* pointer to type-specific plugin descriptor */ const char *name; /* plugin name */ const char *author; /* plugin author (for I_S.PLUGINS) */ const char *descr; /* general descriptive text (for I_S.PLUGINS) */ int license; /* the plugin license (PLUGIN_LICENSE_XXX) */ int (*init)(MYSQL_PLUGIN); /* the function to invoke when plugin is loaded */ int (*deinit)(MYSQL_PLUGIN);/* the function to invoke when plugin is unloaded */ unsigned int version; /* plugin version (for I_S.PLUGINS) */ struct st_mysql_show_var *status_vars; struct st_mysql_sys_var **system_vars; void * __reserved1; /* reserved for dependency checking */ unsigned long flags; /* flags for plugin */ }; /************************************************************************* API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN) */ #define MYSQL_FTPARSER_INTERFACE_VERSION 0x0101 /************************************************************************* API for Query Rewrite plugin. (MYSQL_QUERY_REWRITE_PLUGIN) */ #define MYSQL_REWRITE_PRE_PARSE_INTERFACE_VERSION 0x0010 #define MYSQL_REWRITE_POST_PARSE_INTERFACE_VERSION 0x0010 /************************************************************************* API for Storage Engine plugin. (MYSQL_DAEMON_PLUGIN) */ /* handlertons of different MySQL releases are incompatible */ #define MYSQL_DAEMON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8) /* Here we define only the descriptor structure, that is referred from st_mysql_plugin. */ struct st_mysql_daemon { int interface_version; }; /************************************************************************* API for I_S plugin. (MYSQL_INFORMATION_SCHEMA_PLUGIN) */ /* handlertons of different MySQL releases are incompatible */ #define MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION (MYSQL_VERSION_ID << 8) /* Here we define only the descriptor structure, that is referred from st_mysql_plugin. */ struct st_mysql_information_schema { int interface_version; }; /************************************************************************* API for Storage Engine plugin. (MYSQL_STORAGE_ENGINE_PLUGIN) */ /* handlertons of different MySQL releases are incompatible */ #define MYSQL_HANDLERTON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8) /* The real API is in the sql/handler.h Here we define only the descriptor structure, that is referred from st_mysql_plugin. */ struct st_mysql_storage_engine { int interface_version; }; struct handlerton; /* API for Replication plugin. (MYSQL_REPLICATION_PLUGIN) */ #define MYSQL_REPLICATION_INTERFACE_VERSION 0x0400 /** Replication plugin descriptor */ struct Mysql_replication { int interface_version; }; /************************************************************************* st_mysql_value struct for reading values from mysqld. Used by server variables framework to parse user-provided values. Will be used for arguments when implementing UDFs. Note that val_str() returns a string in temporary memory that will be freed at the end of statement. Copy the string if you need it to persist. */ #define MYSQL_VALUE_TYPE_STRING 0 #define MYSQL_VALUE_TYPE_REAL 1 #define MYSQL_VALUE_TYPE_INT 2 struct st_mysql_value { int (*value_type)(struct st_mysql_value *); const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length); int (*val_real)(struct st_mysql_value *, double *realbuf); int (*val_int)(struct st_mysql_value *, long long *intbuf); int (*is_unsigned)(struct st_mysql_value *); }; /************************************************************************* Miscellaneous functions for plugin implementors */ #ifdef __cplusplus extern "C" { #endif int thd_in_lock_tables(const MYSQL_THD thd); int thd_tablespace_op(const MYSQL_THD thd); long long thd_test_options(const MYSQL_THD thd, long long test_options); int thd_sql_command(const MYSQL_THD thd); const char *set_thd_proc_info(MYSQL_THD thd, const char *info, const char *calling_func, const char *calling_file, const unsigned int calling_line); void **thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton); void thd_storage_lock_wait(MYSQL_THD thd, long long value); int thd_tx_isolation(const MYSQL_THD thd); int thd_tx_is_read_only(const MYSQL_THD thd); MYSQL_THD thd_tx_arbitrate(MYSQL_THD requestor, MYSQL_THD holder); int thd_tx_priority(const MYSQL_THD thd); int thd_tx_is_dd_trx(const MYSQL_THD thd); char *thd_security_context(MYSQL_THD thd, char *buffer, size_t length, size_t max_query_len); /* Increments the row counter, see THD::row_count */ void thd_inc_row_count(MYSQL_THD thd); int thd_allow_batch(MYSQL_THD thd); /** Mark transaction to rollback and mark error as fatal to a sub-statement if in sub statement mode. @param thd user thread connection handle @param all if all != 0, rollback the main transaction */ void thd_mark_transaction_to_rollback(MYSQL_THD thd, int all); /** Types of statistics that can be passed to thd_report_innodb_stat */ enum mysql_trx_stat_type { /** Volume of I/O read requests in bytes */ MYSQL_TRX_STAT_IO_READ_BYTES, /** Time in microseconds spent waiting for I/O reads to complete */ MYSQL_TRX_STAT_IO_READ_WAIT_USECS, /** Time in microseconds spent waiting for row locks */ MYSQL_TRX_STAT_LOCK_WAIT_USECS, /** Time in microseconds spent waiting to enter InnoDB */ MYSQL_TRX_STAT_INNODB_QUEUE_WAIT_USECS, /** A logical data page accessed */ MYSQL_TRX_STAT_ACCESS_PAGE_ID }; /** Report various InnoDB statistics for the slow query log extensions @param[in] thd user thread connection handle @param[in] trx_id InnoDB tranaction ID @param[in] type type of statistics being reported @param[in] value the value of statistics */ void thd_report_innodb_stat(MYSQL_THD thd, unsigned long long trx_id, enum mysql_trx_stat_type type, unsigned long long value); unsigned long thd_log_slow_verbosity(const MYSQL_THD thd); int thd_opt_slow_log(); /** Check whether given connection handle is associated with a background thread. @param thd connection handle @retval non-zero the connection handle belongs to a background thread @retval 0 the connection handle belongs to a different thread type */ int thd_is_background_thread(const MYSQL_THD thd); /** Create a temporary file. @details The temporary file is created in a location specified by the mysql server configuration (--tmpdir option). The caller does not need to delete the file, it will be deleted automatically. @param prefix prefix for temporary file name @retval -1 error @retval >= 0 a file handle that can be passed to dup or my_close */ int mysql_tmpfile(const char *prefix); /** Check the killed state of a connection @details In MySQL support for the KILL statement is cooperative. The KILL statement only sets a "killed" flag. This function returns the value of that flag. A thread should check it often, especially inside time-consuming loops, and gracefully abort the operation if it is non-zero. @param thd user thread connection handle @retval 0 the connection is active @retval 1 the connection has been killed */ int thd_killed(const MYSQL_THD thd); /** Set the killed status of the current statement. @param thd user thread connection handle */ void thd_set_kill_status(const MYSQL_THD thd); /** Get binary log position for latest written entry. @note The file variable will be set to a buffer holding the name of the file name currently, but this can change if a rotation occur. Copy the string if you want to retain it. @param thd Use thread connection handle @param file_var Pointer to variable that will hold the file name. @param pos_var Pointer to variable that will hold the file position. */ void thd_binlog_pos(const MYSQL_THD thd, const char **file_var, unsigned long long *pos_var); /** Return the thread id of a user thread @param thd user thread connection handle @return thread id */ unsigned long thd_get_thread_id(const MYSQL_THD thd); /** Return the query id of a thread @param thd user thread @return query id */ int64_t thd_get_query_id(const MYSQL_THD thd); /** Get the XID for this connection's transaction @param thd user thread connection handle @param xid location where identifier is stored */ void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid); /** Invalidate the query cache for a given table. @param thd user thread connection handle @param key databasename/tablename in the canonical format. @param key_length length of key in bytes, including the PATH separator @param using_trx flag: TRUE if using transactions, FALSE otherwise */ void mysql_query_cache_invalidate4(MYSQL_THD thd, const char *key, unsigned int key_length, int using_trx); /** Provide a handler data getter to simplify coding */ void *thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton); /** Provide a handler data setter to simplify coding @details Set ha_data pointer (storage engine per-connection information). To avoid unclean deactivation (uninstall) of storage engine plugin in the middle of transaction, additional storage engine plugin lock is acquired. If ha_data is not null and storage engine plugin was not locked by thd_set_ha_data() in this connection before, storage engine plugin gets locked. If ha_data is null and storage engine plugin was locked by thd_set_ha_data() in this connection before, storage engine plugin lock gets released. If handlerton::close_connection() didn't reset ha_data, server does it immediately after calling handlerton::close_connection(). */ void thd_set_ha_data(MYSQL_THD thd, const struct handlerton *hton, const void *ha_data); int thd_command(const MYSQL_THD thd); long long thd_start_time(const MYSQL_THD thd); void thd_kill(unsigned long id); /** Check whether ft_query_extra_word_chars server variable is enabled for the current session @return ft_query_extra_word_chars value */ int thd_get_ft_query_extra_word_chars(void); #ifdef __cplusplus } #endif #endif /* _my_plugin_h */ ���������������������������������������������������������������������������������������������������������������mysql/plugin_validate_password.h��������������������������������������������������������������������0000644�����������������00000003057�14763166026�0013173 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2012, 2014, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_PLUGIN_VALIDATE_PASSWORD_INCLUDED #define MYSQL_PLUGIN_VALIDATE_PASSWORD_INCLUDED /* API for validate_password plugin. (MYSQL_VALIDATE_PASSWORD_PLUGIN) */ #include <mysql/plugin.h> #define MYSQL_VALIDATE_PASSWORD_INTERFACE_VERSION 0x0100 /* The descriptor structure for the plugin, that is referred from st_mysql_plugin. */ typedef void* mysql_string_handle; struct st_mysql_validate_password { int interface_version; /* This function retuns TRUE for passwords which satisfy the password policy (as choosen by plugin variable) and FALSE for all other password */ int (*validate_password)(mysql_string_handle password); /* This function returns the password strength (0-100) depending upon the policies */ int (*get_password_strength)(mysql_string_handle password); }; #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql.h���������������������������������������������������������������������������������������0000644�����������������00000071031�14763166026�0007244 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* This file defines the client API to MySQL and also the ABI of the dynamically linked libmysqlclient. The ABI should never be changed in a released product of MySQL, thus you need to take great care when changing the file. In case the file is changed so the ABI is broken, you must also update the SHARED_LIB_MAJOR_VERSION in cmake/mysql_version.cmake */ #ifndef _mysql_h #define _mysql_h #ifdef __cplusplus extern "C" { #endif #ifndef MY_GLOBAL_INCLUDED /* If not standard header */ #ifndef MYSQL_ABI_CHECK #include <sys/types.h> #endif typedef char my_bool; #if !defined(_WIN32) #define STDCALL #else #define STDCALL __stdcall #endif #ifndef my_socket_defined #ifdef _WIN32 #include <windows.h> #ifdef WIN32_LEAN_AND_MEAN #include <winsock2.h> #endif #define my_socket SOCKET #else typedef int my_socket; #endif /* _WIN32 */ #endif /* my_socket_defined */ #endif /* MY_GLOBAL_INCLUDED */ #include "mysql_version.h" #include "mysql_com.h" #include "mysql_time.h" #include "my_list.h" /* for LISTs used in 'MYSQL' and 'MYSQL_STMT' */ /* Include declarations of plug-in API */ #include "mysql/client_plugin.h" extern unsigned int mysql_port; extern char *mysql_unix_port; #define CLIENT_NET_READ_TIMEOUT 365*24*3600 /* Timeout on read */ #define CLIENT_NET_WRITE_TIMEOUT 365*24*3600 /* Timeout on write */ #define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG) #define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG) #define IS_BLOB(n) ((n) & BLOB_FLAG) /** Returns true if the value is a number which does not need quotes for the sql_lex.cc parser to parse correctly. */ #define IS_NUM(t) (((t) <= MYSQL_TYPE_INT24 && (t) != MYSQL_TYPE_TIMESTAMP) || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL) #define IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_STRING) typedef struct st_mysql_field { char *name; /* Name of column */ char *org_name; /* Original column name, if an alias */ char *table; /* Table of column if column was a field */ char *org_table; /* Org table name, if table was an alias */ char *db; /* Database for table */ char *catalog; /* Catalog for table */ char *def; /* Default value (set by mysql_list_fields) */ unsigned long length; /* Width of column (create length) */ unsigned long max_length; /* Max width for selected set */ unsigned int name_length; unsigned int org_name_length; unsigned int table_length; unsigned int org_table_length; unsigned int db_length; unsigned int catalog_length; unsigned int def_length; unsigned int flags; /* Div flags */ unsigned int decimals; /* Number of decimals in field */ unsigned int charsetnr; /* Character set */ enum enum_field_types type; /* Type of field. See mysql_com.h for types */ void *extension; } MYSQL_FIELD; typedef char **MYSQL_ROW; /* return data as array of strings */ typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */ #ifndef MY_GLOBAL_INCLUDED #if defined (_WIN32) typedef unsigned __int64 my_ulonglong; #else typedef unsigned long long my_ulonglong; #endif #endif #include "typelib.h" #define MYSQL_COUNT_ERROR (~(my_ulonglong) 0) /* backward compatibility define - to be removed eventually */ #define ER_WARN_DATA_TRUNCATED WARN_DATA_TRUNCATED typedef struct st_mysql_rows { struct st_mysql_rows *next; /* list of rows */ MYSQL_ROW data; unsigned long length; } MYSQL_ROWS; typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */ #include "my_alloc.h" typedef struct embedded_query_result EMBEDDED_QUERY_RESULT; typedef struct st_mysql_data { MYSQL_ROWS *data; struct embedded_query_result *embedded_info; MEM_ROOT alloc; my_ulonglong rows; unsigned int fields; /* extra info for embedded library */ void *extension; } MYSQL_DATA; enum mysql_option { MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE, MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP, MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE, MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT, MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT, MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION, MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH, MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, MYSQL_PLUGIN_DIR, MYSQL_DEFAULT_AUTH, MYSQL_OPT_BIND, MYSQL_OPT_SSL_KEY, MYSQL_OPT_SSL_CERT, MYSQL_OPT_SSL_CA, MYSQL_OPT_SSL_CAPATH, MYSQL_OPT_SSL_CIPHER, MYSQL_OPT_SSL_CRL, MYSQL_OPT_SSL_CRLPATH, MYSQL_OPT_CONNECT_ATTR_RESET, MYSQL_OPT_CONNECT_ATTR_ADD, MYSQL_OPT_CONNECT_ATTR_DELETE, MYSQL_SERVER_PUBLIC_KEY, MYSQL_ENABLE_CLEARTEXT_PLUGIN, MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, MYSQL_OPT_SSL_ENFORCE, MYSQL_OPT_MAX_ALLOWED_PACKET, MYSQL_OPT_NET_BUFFER_LENGTH, MYSQL_OPT_TLS_VERSION, MYSQL_OPT_SSL_MODE, MYSQL_OPT_GET_SERVER_PUBLIC_KEY }; /** @todo remove the "extension", move st_mysql_options completely out of mysql.h */ struct st_mysql_options_extention; struct st_mysql_options { unsigned int connect_timeout, read_timeout, write_timeout; unsigned int port, protocol; unsigned long client_flag; char *host,*user,*password,*unix_socket,*db; struct st_dynamic_array *init_commands; char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name; char *ssl_key; /* PEM key file */ char *ssl_cert; /* PEM cert file */ char *ssl_ca; /* PEM CA file */ char *ssl_capath; /* PEM directory of CA-s? */ char *ssl_cipher; /* cipher to use */ char *shared_memory_base_name; unsigned long max_allowed_packet; my_bool use_ssl; /* Deprecated ! Former use_ssl */ my_bool compress,named_pipe; my_bool unused1; my_bool unused2; my_bool unused3; my_bool unused4; enum mysql_option methods_to_use; union { /* The ip/hostname to use when authenticating client against embedded server built with grant tables - only used in embedded server */ char *client_ip; /* The local address to bind when connecting to remote server - not used in embedded server */ char *bind_address; } ci; my_bool unused5; /* 0 - never report, 1 - always report (default) */ my_bool report_data_truncation; /* function pointers for local infile support */ int (*local_infile_init)(void **, const char *, void *); int (*local_infile_read)(void *, char *, unsigned int); void (*local_infile_end)(void *); int (*local_infile_error)(void *, char *, unsigned int); void *local_infile_userdata; struct st_mysql_options_extention *extension; }; enum mysql_status { MYSQL_STATUS_READY, MYSQL_STATUS_GET_RESULT, MYSQL_STATUS_USE_RESULT, MYSQL_STATUS_STATEMENT_GET_RESULT }; enum mysql_protocol_type { MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET, MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY }; enum mysql_ssl_mode { SSL_MODE_DISABLED= 1, SSL_MODE_PREFERRED, SSL_MODE_REQUIRED, SSL_MODE_VERIFY_CA, SSL_MODE_VERIFY_IDENTITY }; typedef struct character_set { unsigned int number; /* character set number */ unsigned int state; /* character set state */ const char *csname; /* collation name */ const char *name; /* character set name */ const char *comment; /* comment */ const char *dir; /* character set directory */ unsigned int mbminlen; /* min. length for multibyte strings */ unsigned int mbmaxlen; /* max. length for multibyte strings */ } MY_CHARSET_INFO; struct st_mysql_methods; struct st_mysql_stmt; typedef struct st_mysql { NET net; /* Communication parameters */ unsigned char *connector_fd; /* ConnectorFd for SSL */ char *host,*user,*passwd,*unix_socket,*server_version,*host_info; char *info, *db; struct charset_info_st *charset; MYSQL_FIELD *fields; MEM_ROOT field_alloc; my_ulonglong affected_rows; my_ulonglong insert_id; /* id if insert on table with NEXTNR */ my_ulonglong extra_info; /* Not used */ unsigned long thread_id; /* Id for connection in server */ unsigned long packet_length; unsigned int port; unsigned long client_flag,server_capabilities; unsigned int protocol_version; unsigned int field_count; unsigned int server_status; unsigned int server_language; unsigned int warning_count; struct st_mysql_options options; enum mysql_status status; my_bool free_me; /* If free in mysql_close */ my_bool reconnect; /* set to 1 if automatic reconnect */ /* session-wide random string */ char scramble[SCRAMBLE_LENGTH+1]; my_bool unused1; void *unused2, *unused3, *unused4, *unused5; LIST *stmts; /* list of all statements */ const struct st_mysql_methods *methods; void *thd; /* Points to boolean flag in MYSQL_RES or MYSQL_STMT. We set this flag from mysql_stmt_close if close had to cancel result set of this object. */ my_bool *unbuffered_fetch_owner; /* needed for embedded server - no net buffer to store the 'info' */ char *info_buffer; void *extension; } MYSQL; typedef struct st_mysql_res { my_ulonglong row_count; MYSQL_FIELD *fields; MYSQL_DATA *data; MYSQL_ROWS *data_cursor; unsigned long *lengths; /* column lengths of current row */ MYSQL *handle; /* for unbuffered reads */ const struct st_mysql_methods *methods; MYSQL_ROW row; /* If unbuffered read */ MYSQL_ROW current_row; /* buffer to current row */ MEM_ROOT field_alloc; unsigned int field_count, current_field; my_bool eof; /* Used by mysql_fetch_row */ /* mysql_stmt_close() had to cancel this result */ my_bool unbuffered_fetch_cancelled; void *extension; } MYSQL_RES; #if !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT) #define MYSQL_CLIENT #endif /* Set up and bring down the server; to ensure that applications will work when linked against either the standard client library or the embedded server library, these functions should be called. */ int STDCALL mysql_server_init(int argc, char **argv, char **groups); void STDCALL mysql_server_end(void); /* mysql_server_init/end need to be called when using libmysqld or libmysqlclient (exactly, mysql_server_init() is called by mysql_init() so you don't need to call it explicitely; but you need to call mysql_server_end() to free memory). The names are a bit misleading (mysql_SERVER* to be used when using libmysqlCLIENT). So we add more general names which suit well whether you're using libmysqld or libmysqlclient. We intend to promote these aliases over the mysql_server* ones. */ #define mysql_library_init mysql_server_init #define mysql_library_end mysql_server_end /* Set up and bring down a thread; these function should be called for each thread in an application which opens at least one MySQL connection. All uses of the connection(s) should be between these function calls. */ my_bool STDCALL mysql_thread_init(void); void STDCALL mysql_thread_end(void); /* Functions to get information from the MYSQL and MYSQL_RES structures Should definitely be used if one uses shared libraries. */ my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res); unsigned int STDCALL mysql_num_fields(MYSQL_RES *res); my_bool STDCALL mysql_eof(MYSQL_RES *res); MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res, unsigned int fieldnr); MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res); MYSQL_ROW_OFFSET STDCALL mysql_row_tell(MYSQL_RES *res); MYSQL_FIELD_OFFSET STDCALL mysql_field_tell(MYSQL_RES *res); unsigned int STDCALL mysql_field_count(MYSQL *mysql); my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql); my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql); unsigned int STDCALL mysql_errno(MYSQL *mysql); const char * STDCALL mysql_error(MYSQL *mysql); const char *STDCALL mysql_sqlstate(MYSQL *mysql); unsigned int STDCALL mysql_warning_count(MYSQL *mysql); const char * STDCALL mysql_info(MYSQL *mysql); unsigned long STDCALL mysql_thread_id(MYSQL *mysql); const char * STDCALL mysql_character_set_name(MYSQL *mysql); int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname); MYSQL * STDCALL mysql_init(MYSQL *mysql); my_bool STDCALL mysql_ssl_set(MYSQL *mysql, const char *key, const char *cert, const char *ca, const char *capath, const char *cipher); const char * STDCALL mysql_get_ssl_cipher(MYSQL *mysql); my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, const char *passwd, const char *db); MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag); int STDCALL mysql_select_db(MYSQL *mysql, const char *db); int STDCALL mysql_query(MYSQL *mysql, const char *q); int STDCALL mysql_send_query(MYSQL *mysql, const char *q, unsigned long length); int STDCALL mysql_real_query(MYSQL *mysql, const char *q, unsigned long length); MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql); void STDCALL mysql_get_character_set_info(MYSQL *mysql, MY_CHARSET_INFO *charset); int STDCALL mysql_session_track_get_first(MYSQL *mysql, enum enum_session_state_type type, const char **data, size_t *length); int STDCALL mysql_session_track_get_next(MYSQL *mysql, enum enum_session_state_type type, const char **data, size_t *length); /* local infile support */ #define LOCAL_INFILE_ERROR_LEN 512 void mysql_set_local_infile_handler(MYSQL *mysql, int (*local_infile_init)(void **, const char *, void *), int (*local_infile_read)(void *, char *, unsigned int), void (*local_infile_end)(void *), int (*local_infile_error)(void *, char*, unsigned int), void *); void mysql_set_local_infile_default(MYSQL *mysql); int STDCALL mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level); int STDCALL mysql_dump_debug_info(MYSQL *mysql); int STDCALL mysql_refresh(MYSQL *mysql, unsigned int refresh_options); int STDCALL mysql_kill(MYSQL *mysql,unsigned long pid); int STDCALL mysql_set_server_option(MYSQL *mysql, enum enum_mysql_set_option option); int STDCALL mysql_ping(MYSQL *mysql); const char * STDCALL mysql_stat(MYSQL *mysql); const char * STDCALL mysql_get_server_info(MYSQL *mysql); const char * STDCALL mysql_get_client_info(void); unsigned long STDCALL mysql_get_client_version(void); const char * STDCALL mysql_get_host_info(MYSQL *mysql); unsigned long STDCALL mysql_get_server_version(MYSQL *mysql); unsigned int STDCALL mysql_get_proto_info(MYSQL *mysql); MYSQL_RES * STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild); MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild); MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql); int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg); int STDCALL mysql_options4(MYSQL *mysql,enum mysql_option option, const void *arg1, const void *arg2); int STDCALL mysql_get_option(MYSQL *mysql, enum mysql_option option, const void *arg); void STDCALL mysql_free_result(MYSQL_RES *result); void STDCALL mysql_data_seek(MYSQL_RES *result, my_ulonglong offset); MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET offset); MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result, MYSQL_FIELD_OFFSET offset); MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result); unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result); MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result); MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table, const char *wild); unsigned long STDCALL mysql_escape_string(char *to,const char *from, unsigned long from_length); unsigned long STDCALL mysql_hex_string(char *to,const char *from, unsigned long from_length); unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql, char *to,const char *from, unsigned long length); unsigned long STDCALL mysql_real_escape_string_quote(MYSQL *mysql, char *to, const char *from, unsigned long length, char quote); void STDCALL mysql_debug(const char *debug); void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name); unsigned int STDCALL mysql_thread_safe(void); my_bool STDCALL mysql_embedded(void); my_bool STDCALL mysql_read_query_result(MYSQL *mysql); int STDCALL mysql_reset_connection(MYSQL *mysql); /* The following definitions are added for the enhanced client-server protocol */ /* statement state */ enum enum_mysql_stmt_state { MYSQL_STMT_INIT_DONE= 1, MYSQL_STMT_PREPARE_DONE, MYSQL_STMT_EXECUTE_DONE, MYSQL_STMT_FETCH_DONE }; /* This structure is used to define bind information, and internally by the client library. Public members with their descriptions are listed below (conventionally `On input' refers to the binds given to mysql_stmt_bind_param, `On output' refers to the binds given to mysql_stmt_bind_result): buffer_type - One of the MYSQL_* types, used to describe the host language type of buffer. On output: if column type is different from buffer_type, column value is automatically converted to buffer_type before it is stored in the buffer. buffer - On input: points to the buffer with input data. On output: points to the buffer capable to store output data. The type of memory pointed by buffer must correspond to buffer_type. See the correspondence table in the comment to mysql_stmt_bind_param. The two above members are mandatory for any kind of bind. buffer_length - the length of the buffer. You don't have to set it for any fixed length buffer: float, double, int, etc. It must be set however for variable-length types, such as BLOBs or STRINGs. length - On input: in case when lengths of input values are different for each execute, you can set this to point at a variable containining value length. This way the value length can be different in each execute. If length is not NULL, buffer_length is not used. Note, length can even point at buffer_length if you keep bind structures around while fetching: this way you can change buffer_length before each execution, everything will work ok. On output: if length is set, mysql_stmt_fetch will write column length into it. is_null - On input: points to a boolean variable that should be set to TRUE for NULL values. This member is useful only if your data may be NULL in some but not all cases. If your data is never NULL, is_null should be set to 0. If your data is always NULL, set buffer_type to MYSQL_TYPE_NULL, and is_null will not be used. is_unsigned - On input: used to signify that values provided for one of numeric types are unsigned. On output describes signedness of the output buffer. If, taking into account is_unsigned flag, column data is out of range of the output buffer, data for this column is regarded truncated. Note that this has no correspondence to the sign of result set column, if you need to find it out use mysql_stmt_result_metadata. error - where to write a truncation error if it is present. possible error value is: 0 no truncation 1 value is out of range or buffer is too small Please note that MYSQL_BIND also has internals members. */ typedef struct st_mysql_bind { unsigned long *length; /* output length pointer */ my_bool *is_null; /* Pointer to null indicator */ void *buffer; /* buffer to get/put data */ /* set this if you want to track data truncations happened during fetch */ my_bool *error; unsigned char *row_ptr; /* for the current data position */ void (*store_param_func)(NET *net, struct st_mysql_bind *param); void (*fetch_result)(struct st_mysql_bind *, MYSQL_FIELD *, unsigned char **row); void (*skip_result)(struct st_mysql_bind *, MYSQL_FIELD *, unsigned char **row); /* output buffer length, must be set when fetching str/binary */ unsigned long buffer_length; unsigned long offset; /* offset position for char/binary fetch */ unsigned long length_value; /* Used if length is 0 */ unsigned int param_number; /* For null count and error messages */ unsigned int pack_length; /* Internal length for packed data */ enum enum_field_types buffer_type; /* buffer type */ my_bool error_value; /* used if error is 0 */ my_bool is_unsigned; /* set if integer type is unsigned */ my_bool long_data_used; /* If used with mysql_send_long_data */ my_bool is_null_value; /* Used if is_null is 0 */ void *extension; } MYSQL_BIND; struct st_mysql_stmt_extension; /* statement handler */ typedef struct st_mysql_stmt { MEM_ROOT mem_root; /* root allocations */ LIST list; /* list to keep track of all stmts */ MYSQL *mysql; /* connection handle */ MYSQL_BIND *params; /* input parameters */ MYSQL_BIND *bind; /* output parameters */ MYSQL_FIELD *fields; /* result set metadata */ MYSQL_DATA result; /* cached result set */ MYSQL_ROWS *data_cursor; /* current row in cached result */ /* mysql_stmt_fetch() calls this function to fetch one row (it's different for buffered, unbuffered and cursor fetch). */ int (*read_row_func)(struct st_mysql_stmt *stmt, unsigned char **row); /* copy of mysql->affected_rows after statement execution */ my_ulonglong affected_rows; my_ulonglong insert_id; /* copy of mysql->insert_id */ unsigned long stmt_id; /* Id for prepared statement */ unsigned long flags; /* i.e. type of cursor to open */ unsigned long prefetch_rows; /* number of rows per one COM_FETCH */ /* Copied from mysql->server_status after execute/fetch to know server-side cursor status for this statement. */ unsigned int server_status; unsigned int last_errno; /* error code */ unsigned int param_count; /* input parameter count */ unsigned int field_count; /* number of columns in result set */ enum enum_mysql_stmt_state state; /* statement state */ char last_error[MYSQL_ERRMSG_SIZE]; /* error message */ char sqlstate[SQLSTATE_LENGTH+1]; /* Types of input parameters should be sent to server */ my_bool send_types_to_server; my_bool bind_param_done; /* input buffers were supplied */ unsigned char bind_result_done; /* output buffers were supplied */ /* mysql_stmt_close() had to cancel this result */ my_bool unbuffered_fetch_cancelled; /* Is set to true if we need to calculate field->max_length for metadata fields when doing mysql_stmt_store_result. */ my_bool update_max_length; struct st_mysql_stmt_extension *extension; } MYSQL_STMT; enum enum_stmt_attr_type { /* When doing mysql_stmt_store_result calculate max_length attribute of statement metadata. This is to be consistent with the old API, where this was done automatically. In the new API we do that only by request because it slows down mysql_stmt_store_result sufficiently. */ STMT_ATTR_UPDATE_MAX_LENGTH, /* unsigned long with combination of cursor flags (read only, for update, etc) */ STMT_ATTR_CURSOR_TYPE, /* Amount of rows to retrieve from server per one fetch if using cursors. Accepts unsigned long attribute in the range 1 - ulong_max */ STMT_ATTR_PREFETCH_ROWS }; MYSQL_STMT * STDCALL mysql_stmt_init(MYSQL *mysql); int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, unsigned long length); int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt); int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt); int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg, unsigned int column, unsigned long offset); int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt); unsigned long STDCALL mysql_stmt_param_count(MYSQL_STMT * stmt); my_bool STDCALL mysql_stmt_attr_set(MYSQL_STMT *stmt, enum enum_stmt_attr_type attr_type, const void *attr); my_bool STDCALL mysql_stmt_attr_get(MYSQL_STMT *stmt, enum enum_stmt_attr_type attr_type, void *attr); my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd); my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd); my_bool STDCALL mysql_stmt_close(MYSQL_STMT * stmt); my_bool STDCALL mysql_stmt_reset(MYSQL_STMT * stmt); my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt); my_bool STDCALL mysql_stmt_send_long_data(MYSQL_STMT *stmt, unsigned int param_number, const char *data, unsigned long length); MYSQL_RES *STDCALL mysql_stmt_result_metadata(MYSQL_STMT *stmt); MYSQL_RES *STDCALL mysql_stmt_param_metadata(MYSQL_STMT *stmt); unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT * stmt); const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt); const char *STDCALL mysql_stmt_sqlstate(MYSQL_STMT * stmt); MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_seek(MYSQL_STMT *stmt, MYSQL_ROW_OFFSET offset); MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_tell(MYSQL_STMT *stmt); void STDCALL mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong offset); my_ulonglong STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt); my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt); my_ulonglong STDCALL mysql_stmt_insert_id(MYSQL_STMT *stmt); unsigned int STDCALL mysql_stmt_field_count(MYSQL_STMT *stmt); my_bool STDCALL mysql_commit(MYSQL * mysql); my_bool STDCALL mysql_rollback(MYSQL * mysql); my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode); my_bool STDCALL mysql_more_results(MYSQL *mysql); int STDCALL mysql_next_result(MYSQL *mysql); int STDCALL mysql_stmt_next_result(MYSQL_STMT *stmt); void STDCALL mysql_close(MYSQL *sock); /* status return codes */ #define MYSQL_NO_DATA 100 #define MYSQL_DATA_TRUNCATED 101 #define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) #define HAVE_MYSQL_REAL_CONNECT #ifdef __cplusplus } #endif #endif /* _mysql_h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/sslopt-case.h���������������������������������������������������������������������������������0000644�����������������00000004256�14763166026�0010341 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) #ifndef MYSQL_CLIENT #error This header is supposed to be used only in the client #endif case OPT_SSL_MODE: opt_ssl_mode= find_type_or_exit(argument, &ssl_mode_typelib, opt->name); ssl_mode_set_explicitly= TRUE; break; case OPT_SSL_SSL: CLIENT_WARN_DEPRECATED("--ssl", "--ssl-mode"); if (!opt_use_ssl_arg) opt_ssl_mode= SSL_MODE_DISABLED; else if (opt_ssl_mode < SSL_MODE_REQUIRED) opt_ssl_mode= SSL_MODE_REQUIRED; break; case OPT_SSL_VERIFY_SERVER_CERT: CLIENT_WARN_DEPRECATED("--ssl-verify-server-cert", "--ssl-mode=VERIFY_IDENTITY"); if (!opt_ssl_verify_server_cert_arg) { if (opt_ssl_mode >= SSL_MODE_VERIFY_IDENTITY) opt_ssl_mode= SSL_MODE_VERIFY_CA; } else opt_ssl_mode= SSL_MODE_VERIFY_IDENTITY; break; case OPT_SSL_CA: case OPT_SSL_CAPATH: /* Don't change ssl-mode if set explicitly. */ if (!ssl_mode_set_explicitly) opt_ssl_mode= SSL_MODE_VERIFY_CA; break; case OPT_SSL_KEY: case OPT_SSL_CERT: case OPT_SSL_CIPHER: case OPT_SSL_CRL: case OPT_SSL_CRLPATH: case OPT_TLS_VERSION: #ifdef HAVE_YASSL /* crl has no effect in yaSSL. */ opt_ssl_crl= NULL; opt_ssl_crlpath= NULL; #endif /* HAVE_YASSL */ break; #endif /* HAVE_OPENSSL */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/mysql_com.h�����������������������������������������������������������������������������������0000644�����������������00000062147�14763166026�0010112 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* ** Common definition between mysql server & client */ #ifndef _mysql_com_h #define _mysql_com_h #include "binary_log_types.h" #include "my_command.h" #define HOSTNAME_LENGTH 60 #define SYSTEM_CHARSET_MBMAXLEN 3 #define FILENAME_CHARSET_MBMAXLEN 5 #define NAME_CHAR_LEN 64 /* Field/table name length */ #define USERNAME_CHAR_LENGTH 32 #define USERNAME_CHAR_LENGTH_STR "32" #ifndef NAME_LEN #define NAME_LEN (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN) #endif #define USERNAME_LENGTH (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN) #define CONNECT_STRING_MAXLEN 1024 #define MYSQL_AUTODETECT_CHARSET_NAME "auto" #define SERVER_VERSION_LENGTH 60 #define SQLSTATE_LENGTH 5 #define LIST_PROCESS_HOST_LEN 64 /* Maximum length of comments */ #define TABLE_COMMENT_INLINE_MAXLEN 180 /* pre 6.0: 60 characters */ #define TABLE_COMMENT_MAXLEN 2048 #define COLUMN_COMMENT_MAXLEN 1024 #define INDEX_COMMENT_MAXLEN 1024 #define TABLE_PARTITION_COMMENT_MAXLEN 1024 /* Maximum length of protocol packet. OK packet length limit also restricted to this value as any length greater than this value will have first byte of OK packet to be 254 thus does not provide a means to identify if this is OK or EOF packet. */ #define MAX_PACKET_LENGTH (256L*256L*256L-1) /* USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain username and hostname parts of the user identifier with trailing zero in MySQL standard format: user_name_part@host_name_part\0 */ #define USER_HOST_BUFF_SIZE HOSTNAME_LENGTH + USERNAME_LENGTH + 2 #define LOCAL_HOST "localhost" #define LOCAL_HOST_NAMEDPIPE "." #if defined(_WIN32) #define MYSQL_NAMEDPIPE "MySQL" #define MYSQL_SERVICENAME "MySQL" #endif /* _WIN32 */ /* The length of the header part for each generated column in the .frm file. */ #define FRM_GCOL_HEADER_SIZE 4 /* Maximum length of the expression statement defined for generated columns. */ #define GENERATED_COLUMN_EXPRESSION_MAXLEN 65535 - FRM_GCOL_HEADER_SIZE /* Length of random string sent by server on handshake; this is also length of obfuscated password, received from client */ #define SCRAMBLE_LENGTH 20 #define AUTH_PLUGIN_DATA_PART_1_LENGTH 8 /* length of password stored in the db: new passwords are preceeded with '*' */ #define SCRAMBLED_PASSWORD_CHAR_LENGTH (SCRAMBLE_LENGTH*2+1) #define NOT_NULL_FLAG 1 /* Field can't be NULL */ #define PRI_KEY_FLAG 2 /* Field is part of a primary key */ #define UNIQUE_KEY_FLAG 4 /* Field is part of a unique key */ #define MULTIPLE_KEY_FLAG 8 /* Field is part of a key */ #define BLOB_FLAG 16 /* Field is a blob */ #define UNSIGNED_FLAG 32 /* Field is unsigned */ #define ZEROFILL_FLAG 64 /* Field is zerofill */ #define BINARY_FLAG 128 /* Field is binary */ /* The following are only sent to new clients */ #define ENUM_FLAG 256 /* field is an enum */ #define AUTO_INCREMENT_FLAG 512 /* field is a autoincrement field */ #define TIMESTAMP_FLAG 1024 /* Field is a timestamp */ #define SET_FLAG 2048 /* field is a set */ #define NO_DEFAULT_VALUE_FLAG 4096 /* Field doesn't have default value */ #define ON_UPDATE_NOW_FLAG 8192 /* Field is set to NOW on UPDATE */ #define NUM_FLAG 32768 /* Field is num (for clients) */ #define PART_KEY_FLAG 16384 /* Intern; Part of some key */ #define GROUP_FLAG 32768 /* Intern: Group field */ #define UNIQUE_FLAG 65536 /* Intern: Used by sql_yacc */ #define BINCMP_FLAG 131072 /* Intern: Used by sql_yacc */ #define GET_FIXED_FIELDS_FLAG (1 << 18) /* Used to get fields in item tree */ #define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */ /** Intern: Field in TABLE object for new version of altered table, which participates in a newly added index. */ #define FIELD_IN_ADD_INDEX (1 << 20) #define FIELD_IS_RENAMED (1<< 21) /* Intern: Field is being renamed */ #define FIELD_FLAGS_STORAGE_MEDIA 22 /* Field storage media, bit 22-23 */ #define FIELD_FLAGS_STORAGE_MEDIA_MASK (3 << FIELD_FLAGS_STORAGE_MEDIA) #define FIELD_FLAGS_COLUMN_FORMAT 24 /* Field column format, bit 24-25 */ #define FIELD_FLAGS_COLUMN_FORMAT_MASK (3 << FIELD_FLAGS_COLUMN_FORMAT) #define FIELD_IS_DROPPED (1<< 26) /* Intern: Field is being dropped */ #define EXPLICIT_NULL_FLAG (1<< 27) /* Field is explicitly specified as NULL by the user */ #define CLUSTERING_FLAG (1 << 28) /* Field has a secondary clustering key */ #define REFRESH_GRANT 1 /* Refresh grant tables */ #define REFRESH_LOG 2 /* Start on new log file */ #define REFRESH_TABLES 4 /* close all tables */ #define REFRESH_HOSTS 8 /* Flush host cache */ #define REFRESH_STATUS 16 /* Flush status variables */ #define REFRESH_THREADS 32 /* Flush thread cache */ #define REFRESH_SLAVE 64 /* Reset master info and restart slave thread */ #define REFRESH_MASTER 128 /* Remove all bin logs in the index and truncate the index */ #define REFRESH_ERROR_LOG 256 /* Rotate only the erorr log */ #define REFRESH_ENGINE_LOG 512 /* Flush all storage engine logs */ #define REFRESH_BINARY_LOG 1024 /* Flush the binary log */ #define REFRESH_RELAY_LOG 2048 /* Flush the relay log */ #define REFRESH_GENERAL_LOG 4096 /* Flush the general log */ #define REFRESH_SLOW_LOG 8192 /* Flush the slow query log */ /* The following can't be set with mysql_refresh() */ #define REFRESH_READ_LOCK 16384 /* Lock tables for read */ #define REFRESH_FAST 32768 /* Intern flag */ /* RESET (remove all queries) from query cache */ #define REFRESH_QUERY_CACHE 65536 #define REFRESH_QUERY_CACHE_FREE 0x20000L /* pack query cache */ #define REFRESH_DES_KEY_FILE 0x40000L #define REFRESH_USER_RESOURCES 0x80000L #define REFRESH_FOR_EXPORT 0x100000L /* FLUSH TABLES ... FOR EXPORT */ #define REFRESH_OPTIMIZER_COSTS 0x200000L /* FLUSH OPTIMIZER_COSTS */ #define REFRESH_TABLE_STATS 0x400000L /* Refresh table stats my_hash table */ #define REFRESH_INDEX_STATS 0x800000L /* Refresh index stats my_hash table */ #define REFRESH_USER_STATS 0x1000000L /* Refresh user stats my_hash table */ #define REFRESH_CLIENT_STATS 0x2000000L /* Refresh client stats my_hash table */ #define REFRESH_THREAD_STATS 0x4000000L /* Refresh thread stats my_hash table */ #define REFRESH_FLUSH_PAGE_BITMAPS 0x8000000L #define REFRESH_RESET_PAGE_BITMAPS 0x10000000L #define PURGE_BITMAPS_TO_LSN 1 #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */ #define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */ #define CLIENT_LONG_FLAG 4 /* Get all column flags */ #define CLIENT_CONNECT_WITH_DB 8 /* One can specify db on connect */ #define CLIENT_NO_SCHEMA 16 /* Don't allow database.table.column */ #define CLIENT_COMPRESS 32 /* Can use compression protocol */ #define CLIENT_ODBC 64 /* Odbc client */ #define CLIENT_LOCAL_FILES 128 /* Can use LOAD DATA LOCAL */ #define CLIENT_IGNORE_SPACE 256 /* Ignore spaces before '(' */ #define CLIENT_PROTOCOL_41 512 /* New 4.1 protocol */ #define CLIENT_INTERACTIVE 1024 /* This is an interactive client */ #define CLIENT_SSL 2048 /* Switch to SSL after handshake */ #define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */ #define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */ #define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */ #define CLIENT_RESERVED2 32768 /* Old flag for 4.1 authentication */ #define CLIENT_MULTI_STATEMENTS (1UL << 16) /* Enable/disable multi-stmt support */ #define CLIENT_MULTI_RESULTS (1UL << 17) /* Enable/disable multi-results */ #define CLIENT_PS_MULTI_RESULTS (1UL << 18) /* Multi-results in PS-protocol */ #define CLIENT_PLUGIN_AUTH (1UL << 19) /* Client supports plugin authentication */ #define CLIENT_CONNECT_ATTRS (1UL << 20) /* Client supports connection attributes */ /* Enable authentication response packet to be larger than 255 bytes. */ #define CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA (1UL << 21) /* Don't close the connection for a connection with expired password. */ #define CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS (1UL << 22) /** Capable of handling server state change information. Its a hint to the server to include the state change information in Ok packet. */ #define CLIENT_SESSION_TRACK (1UL << 23) /* Client no longer needs EOF packet */ #define CLIENT_DEPRECATE_EOF (1UL << 24) #define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30) #define CLIENT_REMEMBER_OPTIONS (1UL << 31) #ifdef HAVE_COMPRESS #define CAN_CLIENT_COMPRESS CLIENT_COMPRESS #else #define CAN_CLIENT_COMPRESS 0 #endif /* Gather all possible capabilites (flags) supported by the server */ #define CLIENT_ALL_FLAGS (CLIENT_LONG_PASSWORD \ | CLIENT_FOUND_ROWS \ | CLIENT_LONG_FLAG \ | CLIENT_CONNECT_WITH_DB \ | CLIENT_NO_SCHEMA \ | CLIENT_COMPRESS \ | CLIENT_ODBC \ | CLIENT_LOCAL_FILES \ | CLIENT_IGNORE_SPACE \ | CLIENT_PROTOCOL_41 \ | CLIENT_INTERACTIVE \ | CLIENT_SSL \ | CLIENT_IGNORE_SIGPIPE \ | CLIENT_TRANSACTIONS \ | CLIENT_RESERVED \ | CLIENT_RESERVED2 \ | CLIENT_MULTI_STATEMENTS \ | CLIENT_MULTI_RESULTS \ | CLIENT_PS_MULTI_RESULTS \ | CLIENT_SSL_VERIFY_SERVER_CERT \ | CLIENT_REMEMBER_OPTIONS \ | CLIENT_PLUGIN_AUTH \ | CLIENT_CONNECT_ATTRS \ | CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA \ | CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS \ | CLIENT_SESSION_TRACK \ | CLIENT_DEPRECATE_EOF \ ) /* Switch off the flags that are optional and depending on build flags If any of the optional flags is supported by the build it will be switched on before sending to the client during the connection handshake. */ #define CLIENT_BASIC_FLAGS (((CLIENT_ALL_FLAGS & ~CLIENT_SSL) \ & ~CLIENT_COMPRESS) \ & ~CLIENT_SSL_VERIFY_SERVER_CERT) /** Is raised when a multi-statement transaction has been started, either explicitly, by means of BEGIN or COMMIT AND CHAIN, or implicitly, by the first transactional statement, when autocommit=off. */ #define SERVER_STATUS_IN_TRANS 1 #define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */ #define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */ #define SERVER_QUERY_NO_GOOD_INDEX_USED 16 #define SERVER_QUERY_NO_INDEX_USED 32 /** The server was able to fulfill the clients request and opened a read-only non-scrollable cursor for a query. This flag comes in reply to COM_STMT_EXECUTE and COM_STMT_FETCH commands. */ #define SERVER_STATUS_CURSOR_EXISTS 64 /** This flag is sent when a read-only cursor is exhausted, in reply to COM_STMT_FETCH command. */ #define SERVER_STATUS_LAST_ROW_SENT 128 #define SERVER_STATUS_DB_DROPPED 256 /* A database was dropped */ #define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512 /** Sent to the client if after a prepared statement reprepare we discovered that the new statement returns a different number of result set columns. */ #define SERVER_STATUS_METADATA_CHANGED 1024 #define SERVER_QUERY_WAS_SLOW 2048 /** To mark ResultSet containing output parameter values. */ #define SERVER_PS_OUT_PARAMS 4096 /** Set at the same time as SERVER_STATUS_IN_TRANS if the started multi-statement transaction is a read-only transaction. Cleared when the transaction commits or aborts. Since this flag is sent to clients in OK and EOF packets, the flag indicates the transaction status at the end of command execution. */ #define SERVER_STATUS_IN_TRANS_READONLY 8192 /** This status flag, when on, implies that one of the state information has changed on the server because of the execution of the last statement. */ #define SERVER_SESSION_STATE_CHANGED (1UL << 14) /** Server status flags that must be cleared when starting execution of a new SQL statement. Flags from this set are only added to the current server status by the execution engine, but never removed -- the execution engine expects them to disappear automagically by the next command. */ #define SERVER_STATUS_CLEAR_SET (SERVER_QUERY_NO_GOOD_INDEX_USED| \ SERVER_QUERY_NO_INDEX_USED|\ SERVER_MORE_RESULTS_EXISTS|\ SERVER_STATUS_METADATA_CHANGED |\ SERVER_QUERY_WAS_SLOW |\ SERVER_STATUS_DB_DROPPED |\ SERVER_STATUS_CURSOR_EXISTS|\ SERVER_STATUS_LAST_ROW_SENT|\ SERVER_SESSION_STATE_CHANGED) #define MYSQL_ERRMSG_SIZE 512 #define NET_READ_TIMEOUT 30 /* Timeout on read */ #define NET_WRITE_TIMEOUT 60 /* Timeout on write */ #define NET_WAIT_TIMEOUT 8*60*60 /* Wait for new query */ #define ONLY_KILL_QUERY 1 struct st_vio; /* Only C */ typedef struct st_vio Vio; #define MAX_TINYINT_WIDTH 3 /* Max width for a TINY w.o. sign */ #define MAX_SMALLINT_WIDTH 5 /* Max width for a SHORT w.o. sign */ #define MAX_MEDIUMINT_WIDTH 8 /* Max width for a INT24 w.o. sign */ #define MAX_INT_WIDTH 10 /* Max width for a LONG w.o. sign */ #define MAX_BIGINT_WIDTH 20 /* Max width for a LONGLONG */ #define MAX_CHAR_WIDTH 255 /* Max length for a CHAR colum */ #define MAX_BLOB_WIDTH 16777216 /* Default width for blob */ typedef struct st_net { Vio *vio; unsigned char *buff,*buff_end,*write_pos,*read_pos; my_socket fd; /* For Perl DBI/dbd */ /* The following variable is set if we are doing several queries in one command ( as in LOAD TABLE ... FROM MASTER ), and do not want to confuse the client with OK at the wrong time */ unsigned long remain_in_buf,length, buf_length, where_b; unsigned long max_packet,max_packet_size; unsigned int pkt_nr,compress_pkt_nr; unsigned int write_timeout, read_timeout, retry_count; int fcntl; unsigned int *return_status; unsigned char reading_or_writing; char save_char; my_bool unused1; /* Please remove with the next incompatible ABI change */ my_bool unused2; /* Please remove with the next incompatible ABI change */ my_bool compress; my_bool unused3; /* Please remove with the next incompatible ABI change. */ /* Pointer to query object in query cache, do not equal NULL (0) for queries in cache that have not stored its results yet */ /* Unused, please remove with the next incompatible ABI change. */ unsigned char *unused; unsigned int last_errno; unsigned char error; my_bool unused4; /* Please remove with the next incompatible ABI change. */ my_bool unused5; /* Please remove with the next incompatible ABI change. */ /** Client library error message buffer. Actually belongs to struct MYSQL. */ char last_error[MYSQL_ERRMSG_SIZE]; /** Client library sqlstate buffer. Set along with the error message. */ char sqlstate[SQLSTATE_LENGTH+1]; /** Extension pointer, for the caller private use. Any program linking with the networking library can use this pointer, which is handy when private connection specific data needs to be maintained. The mysqld server process uses this pointer internally, to maintain the server internal instrumentation for the connection. */ void *extension; } NET; #define packet_error (~(unsigned long) 0) /* For backward compatibility */ #define CLIENT_MULTI_QUERIES CLIENT_MULTI_STATEMENTS #define FIELD_TYPE_DECIMAL MYSQL_TYPE_DECIMAL #define FIELD_TYPE_NEWDECIMAL MYSQL_TYPE_NEWDECIMAL #define FIELD_TYPE_TINY MYSQL_TYPE_TINY #define FIELD_TYPE_SHORT MYSQL_TYPE_SHORT #define FIELD_TYPE_LONG MYSQL_TYPE_LONG #define FIELD_TYPE_FLOAT MYSQL_TYPE_FLOAT #define FIELD_TYPE_DOUBLE MYSQL_TYPE_DOUBLE #define FIELD_TYPE_NULL MYSQL_TYPE_NULL #define FIELD_TYPE_TIMESTAMP MYSQL_TYPE_TIMESTAMP #define FIELD_TYPE_LONGLONG MYSQL_TYPE_LONGLONG #define FIELD_TYPE_INT24 MYSQL_TYPE_INT24 #define FIELD_TYPE_DATE MYSQL_TYPE_DATE #define FIELD_TYPE_TIME MYSQL_TYPE_TIME #define FIELD_TYPE_DATETIME MYSQL_TYPE_DATETIME #define FIELD_TYPE_YEAR MYSQL_TYPE_YEAR #define FIELD_TYPE_NEWDATE MYSQL_TYPE_NEWDATE #define FIELD_TYPE_ENUM MYSQL_TYPE_ENUM #define FIELD_TYPE_SET MYSQL_TYPE_SET #define FIELD_TYPE_TINY_BLOB MYSQL_TYPE_TINY_BLOB #define FIELD_TYPE_MEDIUM_BLOB MYSQL_TYPE_MEDIUM_BLOB #define FIELD_TYPE_LONG_BLOB MYSQL_TYPE_LONG_BLOB #define FIELD_TYPE_BLOB MYSQL_TYPE_BLOB #define FIELD_TYPE_VAR_STRING MYSQL_TYPE_VAR_STRING #define FIELD_TYPE_STRING MYSQL_TYPE_STRING #define FIELD_TYPE_CHAR MYSQL_TYPE_TINY #define FIELD_TYPE_INTERVAL MYSQL_TYPE_ENUM #define FIELD_TYPE_GEOMETRY MYSQL_TYPE_GEOMETRY #define FIELD_TYPE_BIT MYSQL_TYPE_BIT /* Shutdown/kill enums and constants */ /* Bits for THD::killable. */ #define MYSQL_SHUTDOWN_KILLABLE_CONNECT (unsigned char)(1 << 0) #define MYSQL_SHUTDOWN_KILLABLE_TRANS (unsigned char)(1 << 1) #define MYSQL_SHUTDOWN_KILLABLE_LOCK_TABLE (unsigned char)(1 << 2) #define MYSQL_SHUTDOWN_KILLABLE_UPDATE (unsigned char)(1 << 3) enum mysql_enum_shutdown_level { /* We want levels to be in growing order of hardness (because we use number comparisons). Note that DEFAULT does not respect the growing property, but it's ok. */ SHUTDOWN_DEFAULT = 0, /* wait for existing connections to finish */ SHUTDOWN_WAIT_CONNECTIONS= MYSQL_SHUTDOWN_KILLABLE_CONNECT, /* wait for existing trans to finish */ SHUTDOWN_WAIT_TRANSACTIONS= MYSQL_SHUTDOWN_KILLABLE_TRANS, /* wait for existing updates to finish (=> no partial MyISAM update) */ SHUTDOWN_WAIT_UPDATES= MYSQL_SHUTDOWN_KILLABLE_UPDATE, /* flush InnoDB buffers and other storage engines' buffers*/ SHUTDOWN_WAIT_ALL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1), /* don't flush InnoDB buffers, flush other storage engines' buffers*/ SHUTDOWN_WAIT_CRITICAL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1) + 1, /* Now the 2 levels of the KILL command */ KILL_QUERY= 254, KILL_CONNECTION= 255 }; enum enum_cursor_type { CURSOR_TYPE_NO_CURSOR= 0, CURSOR_TYPE_READ_ONLY= 1, CURSOR_TYPE_FOR_UPDATE= 2, CURSOR_TYPE_SCROLLABLE= 4 }; /* options for mysql_set_option */ enum enum_mysql_set_option { MYSQL_OPTION_MULTI_STATEMENTS_ON, MYSQL_OPTION_MULTI_STATEMENTS_OFF }; /* Type of state change information that the server can include in the Ok packet. Note : 1) session_state_type shouldn't go past 255 (i.e. 1-byte boundary). 2) Modify the definition of SESSION_TRACK_END when a new member is added. */ enum enum_session_state_type { SESSION_TRACK_SYSTEM_VARIABLES, /* Session system variables */ SESSION_TRACK_SCHEMA, /* Current schema */ SESSION_TRACK_STATE_CHANGE, /* track session state changes */ SESSION_TRACK_GTIDS, SESSION_TRACK_TRANSACTION_CHARACTERISTICS, /* Transaction chistics */ SESSION_TRACK_TRANSACTION_STATE /* Transaction state */ }; #define SESSION_TRACK_BEGIN SESSION_TRACK_SYSTEM_VARIABLES #define SESSION_TRACK_END SESSION_TRACK_TRANSACTION_STATE #define IS_SESSION_STATE_TYPE(T) \ (((int)(T) >= SESSION_TRACK_BEGIN) && ((T) <= SESSION_TRACK_END)) #define net_new_transaction(net) ((net)->pkt_nr=0) #ifdef __cplusplus extern "C" { #endif my_bool my_net_init(NET *net, Vio* vio); void my_net_local_init(NET *net); void net_end(NET *net); void net_clear(NET *net, my_bool check_buffer); void net_claim_memory_ownership(NET *net); my_bool net_realloc(NET *net, size_t length); my_bool net_flush(NET *net); my_bool my_net_write(NET *net,const unsigned char *packet, size_t len); my_bool net_write_command(NET *net,unsigned char command, const unsigned char *header, size_t head_len, const unsigned char *packet, size_t len); my_bool net_write_packet(NET *net, const unsigned char *packet, size_t length); unsigned long my_net_read(NET *net); #ifdef MY_GLOBAL_INCLUDED void my_net_set_write_timeout(NET *net, uint timeout); void my_net_set_read_timeout(NET *net, uint timeout); #endif struct rand_struct { unsigned long seed1,seed2,max_value; double max_value_dbl; }; #ifdef __cplusplus } #endif /* The following is for user defined functions */ enum Item_result {STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT, DECIMAL_RESULT}; typedef struct st_udf_args { unsigned int arg_count; /* Number of arguments */ enum Item_result *arg_type; /* Pointer to item_results */ char **args; /* Pointer to argument */ unsigned long *lengths; /* Length of string arguments */ char *maybe_null; /* Set to 1 for all maybe_null args */ char **attributes; /* Pointer to attribute name */ unsigned long *attribute_lengths; /* Length of attribute arguments */ void *extension; } UDF_ARGS; /* This holds information about the result */ typedef struct st_udf_init { my_bool maybe_null; /* 1 if function can return NULL */ unsigned int decimals; /* for real functions */ unsigned long max_length; /* For string functions */ char *ptr; /* free pointer for function data */ my_bool const_item; /* 1 if function always returns the same value */ void *extension; } UDF_INIT; /* TODO: add a notion for determinism of the UDF. See Item_udf_func::update_used_tables () */ /* Constants when using compression */ #define NET_HEADER_SIZE 4 /* standard header size */ #define COMP_HEADER_SIZE 3 /* compression header extra size */ /* Prototypes to password functions */ #ifdef __cplusplus extern "C" { #endif /* These functions are used for authentication by client and server and implemented in sql/password.c */ void randominit(struct rand_struct *, unsigned long seed1, unsigned long seed2); double my_rnd(struct rand_struct *); void create_random_string(char *to, unsigned int length, struct rand_struct *rand_st); void hash_password(unsigned long *to, const char *password, unsigned int password_len); void make_scrambled_password_323(char *to, const char *password); void scramble_323(char *to, const char *message, const char *password); my_bool check_scramble_323(const unsigned char *reply, const char *message, unsigned long *salt); void get_salt_from_password_323(unsigned long *res, const char *password); void make_password_from_salt_323(char *to, const unsigned long *salt); void make_scrambled_password(char *to, const char *password); void scramble(char *to, const char *message, const char *password); my_bool check_scramble(const unsigned char *reply, const char *message, const unsigned char *hash_stage2); void get_salt_from_password(unsigned char *res, const char *password); void make_password_from_salt(char *to, const unsigned char *hash_stage2); char *octet2hex(char *to, const char *str, unsigned int len); /* end of password.c */ my_bool generate_sha256_scramble(unsigned char *dst, size_t dst_size, const char *src, size_t src_size, const char *rnd, size_t rnd_size); char *get_tty_password(const char *opt_message); const char *mysql_errno_to_sqlstate(unsigned int mysql_errno); /* Some other useful functions */ my_bool my_thread_init(void); void my_thread_end(void); #ifdef MY_GLOBAL_INCLUDED ulong STDCALL net_field_length(uchar **packet); ulong STDCALL net_field_length_checked(uchar **packet, ulong max_length); my_ulonglong net_field_length_ll(uchar **packet); uchar *net_store_length(uchar *pkg, ulonglong length); unsigned int net_length_size(ulonglong num); #endif #ifdef __cplusplus } #endif #define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */ #define MYSQL_STMT_HEADER 4 #define MYSQL_LONG_DATA_HEADER 6 #define NOT_FIXED_DEC 31 #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/thr_cond.h������������������������������������������������������������������������������������0000644�����������������00000012034�14763166026�0007675 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef THR_COND_INCLUDED #define THR_COND_INCLUDED /* Copyright (c) 2014, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** MySQL condition variable implementation. There are three "layers": 1) native_cond_*() Functions that map directly down to OS primitives. Windows - ConditionVariable Other OSes - pthread 2) my_cond_*() Functions that use SAFE_MUTEX (default for debug). Otherwise native_cond_*() is used. 3) mysql_cond*() Functions that include Performance Schema instrumentation. See include/mysql/psi/mysql_thread.h */ #include "my_thread.h" #include "thr_mutex.h" C_MODE_START #ifdef _WIN32 typedef CONDITION_VARIABLE native_cond_t; #else typedef pthread_cond_t native_cond_t; #endif #ifdef _WIN32 /** Convert abstime to milliseconds */ static DWORD get_milliseconds(const struct timespec *abstime) { #ifndef HAVE_STRUCT_TIMESPEC long long millis; union ft64 now; if (abstime == NULL) return INFINITE; GetSystemTimeAsFileTime(&now.ft); /* Calculate time left to abstime - subtract start time from current time(values are in 100ns units) - convert to millisec by dividing with 10000 */ millis= (abstime->tv.i64 - now.i64) / 10000; /* Don't allow the timeout to be negative */ if (millis < 0) return 0; /* Make sure the calculated timeout does not exceed original timeout value which could cause "wait for ever" if system time changes */ if (millis > abstime->max_timeout_msec) millis= abstime->max_timeout_msec; if (millis > UINT_MAX) millis= UINT_MAX; return (DWORD)millis; #else /* Convert timespec to millis and subtract current time. my_getsystime() returns time in 100 ns units. */ ulonglong future= abstime->tv_sec * 1000 + abstime->tv_nsec / 1000000; ulonglong now= my_getsystime() / 10000; /* Don't allow the timeout to be negative. */ if (future < now) return 0; return (DWORD)(future - now); #endif } #endif /* _WIN32 */ static inline int native_cond_init(native_cond_t *cond) { #ifdef _WIN32 InitializeConditionVariable(cond); return 0; #else /* pthread_condattr_t is not used in MySQL */ return pthread_cond_init(cond, NULL); #endif } static inline int native_cond_destroy(native_cond_t *cond) { #ifdef _WIN32 return 0; /* no destroy function */ #else return pthread_cond_destroy(cond); #endif } static inline int native_cond_timedwait(native_cond_t *cond, native_mutex_t *mutex, const struct timespec *abstime) { #ifdef _WIN32 DWORD timeout= get_milliseconds(abstime); if (!SleepConditionVariableCS(cond, mutex, timeout)) return ETIMEDOUT; return 0; #else return pthread_cond_timedwait(cond, mutex, abstime); #endif } static inline int native_cond_wait(native_cond_t *cond, native_mutex_t *mutex) { #ifdef _WIN32 if (!SleepConditionVariableCS(cond, mutex, INFINITE)) return ETIMEDOUT; return 0; #else return pthread_cond_wait(cond, mutex); #endif } static inline int native_cond_signal(native_cond_t *cond) { #ifdef _WIN32 WakeConditionVariable(cond); return 0; #else return pthread_cond_signal(cond); #endif } static inline int native_cond_broadcast(native_cond_t *cond) { #ifdef _WIN32 WakeAllConditionVariable(cond); return 0; #else return pthread_cond_broadcast(cond); #endif } #ifdef SAFE_MUTEX int safe_cond_wait(native_cond_t *cond, my_mutex_t *mp, const char *file, uint line); int safe_cond_timedwait(native_cond_t *cond, my_mutex_t *mp, const struct timespec *abstime, const char *file, uint line); #endif static inline int my_cond_timedwait(native_cond_t *cond, my_mutex_t *mp, const struct timespec *abstime #ifdef SAFE_MUTEX , const char *file, uint line #endif ) { #ifdef SAFE_MUTEX return safe_cond_timedwait(cond, mp, abstime, file, line); #else return native_cond_timedwait(cond, mp, abstime); #endif } static inline int my_cond_wait(native_cond_t *cond, my_mutex_t *mp #ifdef SAFE_MUTEX , const char *file, uint line #endif ) { #ifdef SAFE_MUTEX return safe_cond_wait(cond, mp, file, line); #else return native_cond_wait(cond, mp); #endif } C_MODE_END #endif /* THR_COND_INCLUDED */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/my_compiler.h���������������������������������������������������������������������������������0000644�����������������00000012712�14763166026�0010417 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef MY_COMPILER_INCLUDED #define MY_COMPILER_INCLUDED /* Copyright (c) 2010, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** Header for compiler-dependent features. Intended to contain a set of reusable wrappers for preprocessor macros, attributes, pragmas, and any other features that are specific to a target compiler. */ #include <stddef.h> /* size_t */ #if defined __GNUC__ /* Convenience macro to test the minimum required GCC version. These should be used with care as Clang also sets __GNUC__ and __GNUC_MINOR__ (currently to 4.2). Prefer using feature specific CMake checks in configure.cmake instead. */ # define MY_GNUC_PREREQ(maj, min) \ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) # define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) #else # define MY_GNUC_PREREQ(maj, min) (0) #endif /* The macros below are borrowed from include/linux/compiler.h in the Linux kernel. Use them to indicate the likelyhood of the truthfulness of a condition. This serves two purposes - newer versions of gcc will be able to optimize for branch predication, which could yield siginficant performance gains in frequently executed sections of the code, and the other reason to use them is for documentation */ #ifdef HAVE_BUILTIN_EXPECT // likely/unlikely are likely to clash with other symbols, do not #define #if defined(__cplusplus) inline bool likely(bool expr) { return __builtin_expect(expr, true); } inline bool unlikely(bool expr) { return __builtin_expect(expr, false); } #else # define likely(x) __builtin_expect((x),1) # define unlikely(x) __builtin_expect((x),0) #endif #else /* HAVE_BUILTIN_EXPECT */ #if defined(__cplusplus) inline bool likely(bool expr) { return expr; } inline bool unlikely(bool expr) { return expr; } #else # define likely(x) (x) # define unlikely(x) (x) #endif #endif /* HAVE_BUILTIN_EXPECT */ /* Comunicate to the compiler the unreachability of the code. */ #ifdef HAVE_BUILTIN_UNREACHABLE # define MY_ASSERT_UNREACHABLE() __builtin_unreachable() #else # define MY_ASSERT_UNREACHABLE() do { assert(0); } while (0) #endif #if defined __GNUC__ || defined __SUNPRO_C || defined __SUNPRO_CC /* Specifies the minimum alignment of a type. */ # define MY_ALIGNOF(type) __alignof__(type) /* Determine the alignment requirement of a type. */ # define MY_ALIGNED(n) __attribute__((__aligned__((n)))) /* Microsoft Visual C++ */ #elif defined _MSC_VER # define MY_ALIGNOF(type) __alignof(type) # define MY_ALIGNED(n) __declspec(align(n)) #else /* Make sure they are defined for other compilers. */ # define MY_ALIGNOF(type) # define MY_ALIGNED(size) #endif /* Visual Studio requires '__inline' for C code */ #if !defined(__cplusplus) && defined(_MSC_VER) # define inline __inline #endif /* Provide __func__ macro definition for Visual Studio. */ #if defined(_MSC_VER) # define __func__ __FUNCTION__ #endif /** C++ Type Traits */ #ifdef __cplusplus /** Opaque storage with a particular alignment. Partial specialization used due to MSVC++. */ template<size_t alignment> struct my_alignment_imp; template<> struct MY_ALIGNED(1) my_alignment_imp<1> {}; template<> struct MY_ALIGNED(2) my_alignment_imp<2> {}; template<> struct MY_ALIGNED(4) my_alignment_imp<4> {}; template<> struct MY_ALIGNED(8) my_alignment_imp<8> {}; template<> struct MY_ALIGNED(16) my_alignment_imp<16> {}; /** A POD type with a given size and alignment. @remark If the compiler does not support a alignment attribute (MY_ALIGN macro), the default alignment of a double is used instead. @tparam size The minimum size. @tparam alignment The desired alignment: 1, 2, 4, 8 or 16. */ template <size_t size, size_t alignment> struct my_aligned_storage { union { char data[size]; my_alignment_imp<alignment> align; }; }; #if __cpp_attributes && defined(__has_cpp_attribute) #if __has_cpp_attribute(nodiscard) #define MY_NODISCARD [[nodiscard]] #elif __has_cpp_attribute(gnu::warn_unused_result) #define MY_NODISCARD [[gnu::warn_unused_result]] #endif /* __has_cpp_attribute(gnu::warn_unused_result) */ #endif /* __cpp_attributes && defined(__has_cpp_attribute) */ #endif /* __cplusplus */ /* Disable MY_ATTRIBUTE for Sun Studio and Visual Studio. Note that Sun Studio supports some __attribute__ variants, but not format or unused which we use quite a lot. */ #ifndef MY_ATTRIBUTE #if defined(__GNUC__) # define MY_ATTRIBUTE(A) __attribute__(A) #else # define MY_ATTRIBUTE(A) #endif #endif #ifndef __has_attribute # define __has_attribute(x) 0 #endif #ifndef MY_NODISCARD #define MY_NODISCARD MY_ATTRIBUTE((warn_unused_result)) #endif /* MY_NODISCARD */ #if __has_attribute(no_sanitize_undefined) # define SUPPRESS_UBSAN __attribute__((no_sanitize_undefined)) #else # define SUPPRESS_UBSAN #endif #endif /* MY_COMPILER_INCLUDED */ ������������������������������������������������������mysql/byte_order_generic.h��������������������������������������������������������������������������0000644�����������������00000004773�14763166026�0011742 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2001, 2014, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Endianness-independent definitions for architectures other than the x86 architecture. */ static inline int16 sint2korr(const uchar *A) { return (int16) (((int16) (A[0])) + ((int16) (A[1]) << 8)) ; } static inline int32 sint4korr(const uchar *A) { return (int32) (((int32) (A[0])) + (((int32) (A[1]) << 8)) + (((int32) (A[2]) << 16)) + (((int32) (A[3]) << 24))) ; } static inline uint16 uint2korr(const uchar *A) { return (uint16) (((uint16) (A[0])) + ((uint16) (A[1]) << 8)) ; } static inline uint32 uint4korr(const uchar *A) { return (uint32) (((uint32) (A[0])) + (((uint32) (A[1])) << 8) + (((uint32) (A[2])) << 16) + (((uint32) (A[3])) << 24)) ; } static inline ulonglong uint8korr(const uchar *A) { return ((ulonglong)(((uint32) (A[0])) + (((uint32) (A[1])) << 8) + (((uint32) (A[2])) << 16) + (((uint32) (A[3])) << 24)) + (((ulonglong) (((uint32) (A[4])) + (((uint32) (A[5])) << 8) + (((uint32) (A[6])) << 16) + (((uint32) (A[7])) << 24))) << 32)) ; } static inline longlong sint8korr(const uchar *A) { return (longlong) uint8korr(A); } static inline void int2store(uchar *T, uint16 A) { uint def_temp= A ; *(T)= (uchar)(def_temp); *(T+1)= (uchar)(def_temp >> 8); } static inline void int4store(uchar *T, uint32 A) { *(T)= (uchar) (A); *(T+1)=(uchar) (A >> 8); *(T+2)=(uchar) (A >> 16); *(T+3)=(uchar) (A >> 24); } static inline void int8store(uchar *T, ulonglong A) { uint def_temp= (uint) A, def_temp2= (uint) (A >> 32); int4store(T, def_temp); int4store(T+4,def_temp2); } �����mysql/m_ctype.h�������������������������������������������������������������������������������������0000644�����������������00000102752�14763166026�0007544 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* A better inplementation of the UNIX ctype(3) library. */ #ifndef _m_ctype_h #define _m_ctype_h #include "my_global.h" /* uint16, uchar */ #ifdef __cplusplus extern "C" { #endif #define MY_CS_NAME_SIZE 32 #define MY_CS_CTYPE_TABLE_SIZE 257 #define MY_CS_TO_LOWER_TABLE_SIZE 256 #define MY_CS_TO_UPPER_TABLE_SIZE 256 #define MY_CS_SORT_ORDER_TABLE_SIZE 256 #define MY_CS_TO_UNI_TABLE_SIZE 256 #define CHARSET_DIR "charsets/" #define my_wc_t ulong #define MY_CS_REPLACEMENT_CHARACTER 0xFFFD /* On i386 we store Unicode->CS conversion tables for some character sets using Big-endian order, to copy two bytes at onces. This gives some performance improvement. */ #ifdef __i386__ #define MB2(x) (((x) >> 8) + (((x) & 0xFF) << 8)) #define MY_PUT_MB2(s, code) { *((uint16*)(s))= (code); } #else #define MB2(x) (x) #define MY_PUT_MB2(s, code) { (s)[0]= code >> 8; (s)[1]= code & 0xFF; } #endif typedef struct unicase_info_char_st { uint32 toupper; uint32 tolower; uint32 sort; } MY_UNICASE_CHARACTER; typedef struct unicase_info_st { my_wc_t maxchar; const MY_UNICASE_CHARACTER **page; } MY_UNICASE_INFO; extern MY_UNICASE_INFO my_unicase_default; extern MY_UNICASE_INFO my_unicase_turkish; extern MY_UNICASE_INFO my_unicase_mysql500; extern MY_UNICASE_INFO my_unicase_unicode520; #define MY_UCA_MAX_CONTRACTION 6 #define MY_UCA_MAX_WEIGHT_SIZE 8 #define MY_UCA_WEIGHT_LEVELS 1 typedef struct my_contraction_t { my_wc_t ch[MY_UCA_MAX_CONTRACTION]; /* Character sequence */ uint16 weight[MY_UCA_MAX_WEIGHT_SIZE];/* Its weight string, 0-terminated */ my_bool with_context; } MY_CONTRACTION; typedef struct my_contraction_list_t { size_t nitems; /* Number of items in the list */ MY_CONTRACTION *item; /* List of contractions */ char *flags; /* Character flags, e.g. "is contraction head") */ } MY_CONTRACTIONS; my_bool my_uca_can_be_contraction_head(const MY_CONTRACTIONS *c, my_wc_t wc); my_bool my_uca_can_be_contraction_tail(const MY_CONTRACTIONS *c, my_wc_t wc); uint16 *my_uca_contraction2_weight(const MY_CONTRACTIONS *c, my_wc_t wc1, my_wc_t wc2); /* Collation weights on a single level (e.g. primary, secondary, tertiarty) */ typedef struct my_uca_level_info_st { my_wc_t maxchar; uchar *lengths; uint16 **weights; MY_CONTRACTIONS contractions; } MY_UCA_WEIGHT_LEVEL; typedef struct uca_info_st { MY_UCA_WEIGHT_LEVEL level[MY_UCA_WEIGHT_LEVELS]; /* Logical positions */ my_wc_t first_non_ignorable; my_wc_t last_non_ignorable; my_wc_t first_primary_ignorable; my_wc_t last_primary_ignorable; my_wc_t first_secondary_ignorable; my_wc_t last_secondary_ignorable; my_wc_t first_tertiary_ignorable; my_wc_t last_tertiary_ignorable; my_wc_t first_trailing; my_wc_t last_trailing; my_wc_t first_variable; my_wc_t last_variable; } MY_UCA_INFO; extern MY_UCA_INFO my_uca_v400; typedef struct uni_ctype_st { uchar pctype; uchar *ctype; } MY_UNI_CTYPE; extern MY_UNI_CTYPE my_uni_ctype[256]; /* wm_wc and wc_mb return codes */ #define MY_CS_ILSEQ 0 /* Wrong by sequence: wb_wc */ #define MY_CS_ILUNI 0 /* Cannot encode Unicode to charset: wc_mb */ #define MY_CS_TOOSMALL -101 /* Need at least one byte: wc_mb and mb_wc */ #define MY_CS_TOOSMALL2 -102 /* Need at least two bytes: wc_mb and mb_wc */ #define MY_CS_TOOSMALL3 -103 /* Need at least three bytes: wc_mb and mb_wc */ /* These following three are currently not really used */ #define MY_CS_TOOSMALL4 -104 /* Need at least 4 bytes: wc_mb and mb_wc */ #define MY_CS_TOOSMALL5 -105 /* Need at least 5 bytes: wc_mb and mb_wc */ #define MY_CS_TOOSMALL6 -106 /* Need at least 6 bytes: wc_mb and mb_wc */ /* A helper macros for "need at least n bytes" */ #define MY_CS_TOOSMALLN(n) (-100-(n)) #define MY_SEQ_INTTAIL 1 #define MY_SEQ_SPACES 2 /* My charsets_list flags */ #define MY_CS_COMPILED 1 /* compiled-in sets */ #define MY_CS_CONFIG 2 /* sets that have a *.conf file */ #define MY_CS_INDEX 4 /* sets listed in the Index file */ #define MY_CS_LOADED 8 /* sets that are currently loaded */ #define MY_CS_BINSORT 16 /* if binary sort order */ #define MY_CS_PRIMARY 32 /* if primary collation */ #define MY_CS_STRNXFRM 64 /* if strnxfrm is used for sort */ #define MY_CS_UNICODE 128 /* is a charset is BMP Unicode */ #define MY_CS_READY 256 /* if a charset is initialized */ #define MY_CS_AVAILABLE 512 /* If either compiled-in or loaded*/ #define MY_CS_CSSORT 1024 /* if case sensitive sort order */ #define MY_CS_HIDDEN 2048 /* don't display in SHOW */ #define MY_CS_PUREASCII 4096 /* if a charset is pure ascii */ #define MY_CS_NONASCII 8192 /* if not ASCII-compatible */ #define MY_CS_UNICODE_SUPPLEMENT 16384 /* Non-BMP Unicode characters */ #define MY_CS_LOWER_SORT 32768 /* If use lower case as weight */ #define MY_CHARSET_UNDEFINED 0 /* Character repertoire flags */ #define MY_REPERTOIRE_ASCII 1 /* Pure ASCII U+0000..U+007F */ #define MY_REPERTOIRE_EXTENDED 2 /* Extended characters: U+0080..U+FFFF */ #define MY_REPERTOIRE_UNICODE30 3 /* ASCII | EXTENDED: U+0000..U+FFFF */ /* Flags for strxfrm */ #define MY_STRXFRM_LEVEL1 0x00000001 /* for primary weights */ #define MY_STRXFRM_LEVEL2 0x00000002 /* for secondary weights */ #define MY_STRXFRM_LEVEL3 0x00000004 /* for tertiary weights */ #define MY_STRXFRM_LEVEL4 0x00000008 /* fourth level weights */ #define MY_STRXFRM_LEVEL5 0x00000010 /* fifth level weights */ #define MY_STRXFRM_LEVEL6 0x00000020 /* sixth level weights */ #define MY_STRXFRM_LEVEL_ALL 0x0000003F /* Bit OR for the above six */ #define MY_STRXFRM_NLEVELS 6 /* Number of possible levels*/ #define MY_STRXFRM_PAD_WITH_SPACE 0x00000040 /* if pad result with spaces */ #define MY_STRXFRM_PAD_TO_MAXLEN 0x00000080 /* if pad tail(for filesort) */ #define MY_STRXFRM_DESC_LEVEL1 0x00000100 /* if desc order for level1 */ #define MY_STRXFRM_DESC_LEVEL2 0x00000200 /* if desc order for level2 */ #define MY_STRXFRM_DESC_LEVEL3 0x00000300 /* if desc order for level3 */ #define MY_STRXFRM_DESC_LEVEL4 0x00000800 /* if desc order for level4 */ #define MY_STRXFRM_DESC_LEVEL5 0x00001000 /* if desc order for level5 */ #define MY_STRXFRM_DESC_LEVEL6 0x00002000 /* if desc order for level6 */ #define MY_STRXFRM_DESC_SHIFT 8 #define MY_STRXFRM_UNUSED_00004000 0x00004000 /* for future extensions */ #define MY_STRXFRM_UNUSED_00008000 0x00008000 /* for future extensions */ #define MY_STRXFRM_REVERSE_LEVEL1 0x00010000 /* if reverse order for level1 */ #define MY_STRXFRM_REVERSE_LEVEL2 0x00020000 /* if reverse order for level2 */ #define MY_STRXFRM_REVERSE_LEVEL3 0x00040000 /* if reverse order for level3 */ #define MY_STRXFRM_REVERSE_LEVEL4 0x00080000 /* if reverse order for level4 */ #define MY_STRXFRM_REVERSE_LEVEL5 0x00100000 /* if reverse order for level5 */ #define MY_STRXFRM_REVERSE_LEVEL6 0x00200000 /* if reverse order for level6 */ #define MY_STRXFRM_REVERSE_SHIFT 16 typedef struct my_uni_idx_st { uint16 from; uint16 to; const uchar *tab; } MY_UNI_IDX; typedef struct { uint beg; uint end; uint mb_len; } my_match_t; struct charset_info_st; typedef struct my_charset_loader_st { char error[128]; void *(*once_alloc)(size_t); void *(*mem_malloc)(size_t); void *(*mem_realloc)(void *, size_t); void (*mem_free)(void *); void (*reporter)(enum loglevel, const char *format, ...); int (*add_collation)(struct charset_info_st *cs); } MY_CHARSET_LOADER; extern int (*my_string_stack_guard)(int); /* See strings/CHARSET_INFO.txt for information about this structure */ typedef struct my_collation_handler_st { my_bool (*init)(struct charset_info_st *, MY_CHARSET_LOADER *); /* Collation routines */ int (*strnncoll)(const struct charset_info_st *, const uchar *, size_t, const uchar *, size_t, my_bool); int (*strnncollsp)(const struct charset_info_st *, const uchar *, size_t, const uchar *, size_t, my_bool diff_if_only_endspace_difference); size_t (*strnxfrm)(const struct charset_info_st *, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags); size_t (*strnxfrmlen)(const struct charset_info_st *, size_t); my_bool (*like_range)(const struct charset_info_st *, const char *s, size_t s_length, pchar w_prefix, pchar w_one, pchar w_many, size_t res_length, char *min_str, char *max_str, size_t *min_len, size_t *max_len); int (*wildcmp)(const struct charset_info_st *, const char *str,const char *str_end, const char *wildstr,const char *wildend, int escape,int w_one, int w_many); int (*strcasecmp)(const struct charset_info_st *, const char *, const char *); uint (*instr)(const struct charset_info_st *, const char *b, size_t b_length, const char *s, size_t s_length, my_match_t *match, uint nmatch); /* Hash calculation */ void (*hash_sort)(const struct charset_info_st *cs, const uchar *key, size_t len, ulong *nr1, ulong *nr2); my_bool (*propagate)(const struct charset_info_st *cs, const uchar *str, size_t len); } MY_COLLATION_HANDLER; extern MY_COLLATION_HANDLER my_collation_mb_bin_handler; extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler; extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler; extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler; /* Some typedef to make it easy for C++ to make function pointers */ typedef int (*my_charset_conv_mb_wc)(const struct charset_info_st *, my_wc_t *, const uchar *, const uchar *); typedef int (*my_charset_conv_wc_mb)(const struct charset_info_st *, my_wc_t, uchar *, uchar *); typedef size_t (*my_charset_conv_case)(const struct charset_info_st *, char *, size_t, char *, size_t); /* See strings/CHARSET_INFO.txt about information on this structure */ typedef struct my_charset_handler_st { my_bool (*init)(struct charset_info_st *, MY_CHARSET_LOADER *loader); /* Multibyte routines */ uint (*ismbchar)(const struct charset_info_st *, const char *, const char *); uint (*mbcharlen)(const struct charset_info_st *, uint c); size_t (*numchars)(const struct charset_info_st *, const char *b, const char *e); size_t (*charpos)(const struct charset_info_st *, const char *b, const char *e, size_t pos); size_t (*well_formed_len)(const struct charset_info_st *, const char *b,const char *e, size_t nchars, int *error); size_t (*lengthsp)(const struct charset_info_st *, const char *ptr, size_t length); size_t (*numcells)(const struct charset_info_st *, const char *b, const char *e); /* Unicode conversion */ my_charset_conv_mb_wc mb_wc; my_charset_conv_wc_mb wc_mb; /* CTYPE scanner */ int (*ctype)(const struct charset_info_st *cs, int *ctype, const uchar *s, const uchar *e); /* Functions for case and sort conversion */ size_t (*caseup_str)(const struct charset_info_st *, char *); size_t (*casedn_str)(const struct charset_info_st *, char *); my_charset_conv_case caseup; my_charset_conv_case casedn; /* Charset dependant snprintf() */ size_t (*snprintf)(const struct charset_info_st *, char *to, size_t n, const char *fmt, ...) MY_ATTRIBUTE((format(printf, 4, 5))); size_t (*long10_to_str)(const struct charset_info_st *, char *to, size_t n, int radix, long int val); size_t (*longlong10_to_str)(const struct charset_info_st *, char *to, size_t n, int radix, longlong val); void (*fill)(const struct charset_info_st *, char *to, size_t len, int fill); /* String-to-number conversion routines */ long (*strntol)(const struct charset_info_st *, const char *s, size_t l, int base, char **e, int *err); ulong (*strntoul)(const struct charset_info_st *, const char *s, size_t l, int base, char **e, int *err); longlong (*strntoll)(const struct charset_info_st *, const char *s, size_t l, int base, char **e, int *err); ulonglong (*strntoull)(const struct charset_info_st *, const char *s, size_t l, int base, char **e, int *err); double (*strntod)(const struct charset_info_st *, char *s, size_t l, char **e, int *err); longlong (*strtoll10)(const struct charset_info_st *cs, const char *nptr, char **endptr, int *error); ulonglong (*strntoull10rnd)(const struct charset_info_st *cs, const char *str, size_t length, int unsigned_fl, char **endptr, int *error); size_t (*scan)(const struct charset_info_st *, const char *b, const char *e, int sq); } MY_CHARSET_HANDLER; extern MY_CHARSET_HANDLER my_charset_8bit_handler; extern MY_CHARSET_HANDLER my_charset_ascii_handler; extern MY_CHARSET_HANDLER my_charset_ucs2_handler; /* We define this CHARSET_INFO_DEFINED here to prevent a repeat of the typedef in hash.c, which will cause a compiler error. */ #define CHARSET_INFO_DEFINED /* See strings/CHARSET_INFO.txt about information on this structure */ typedef struct charset_info_st { uint number; uint primary_number; uint binary_number; uint state; const char *csname; const char *name; const char *comment; const char *tailoring; const uchar *ctype; const uchar *to_lower; const uchar *to_upper; const uchar *sort_order; MY_UCA_INFO *uca; /* This can be changed in apply_one_rule() */ const uint16 *tab_to_uni; const MY_UNI_IDX *tab_from_uni; const MY_UNICASE_INFO *caseinfo; const struct lex_state_maps_st *state_maps; /* parser internal data */ const uchar *ident_map; /* parser internal data */ uint strxfrm_multiply; uchar caseup_multiply; uchar casedn_multiply; uint mbminlen; uint mbmaxlen; uint mbmaxlenlen; my_wc_t min_sort_char; my_wc_t max_sort_char; /* For LIKE optimization */ uchar pad_char; my_bool escape_with_backslash_is_dangerous; uchar levels_for_compare; uchar levels_for_order; MY_CHARSET_HANDLER *cset; MY_COLLATION_HANDLER *coll; } CHARSET_INFO; #define ILLEGAL_CHARSET_INFO_NUMBER (~0U) extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_bin; extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_latin1; extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_filename; extern CHARSET_INFO my_charset_big5_chinese_ci; extern CHARSET_INFO my_charset_big5_bin; extern CHARSET_INFO my_charset_cp932_japanese_ci; extern CHARSET_INFO my_charset_cp932_bin; extern CHARSET_INFO my_charset_cp1250_czech_ci; extern CHARSET_INFO my_charset_eucjpms_japanese_ci; extern CHARSET_INFO my_charset_eucjpms_bin; extern CHARSET_INFO my_charset_euckr_korean_ci; extern CHARSET_INFO my_charset_euckr_bin; extern CHARSET_INFO my_charset_gb2312_chinese_ci; extern CHARSET_INFO my_charset_gb2312_bin; extern CHARSET_INFO my_charset_gbk_chinese_ci; extern CHARSET_INFO my_charset_gbk_bin; extern CHARSET_INFO my_charset_gb18030_chinese_ci; extern CHARSET_INFO my_charset_gb18030_bin; extern CHARSET_INFO my_charset_latin1_german2_ci; extern CHARSET_INFO my_charset_latin1_bin; extern CHARSET_INFO my_charset_latin2_czech_ci; extern CHARSET_INFO my_charset_sjis_japanese_ci; extern CHARSET_INFO my_charset_sjis_bin; extern CHARSET_INFO my_charset_tis620_thai_ci; extern CHARSET_INFO my_charset_tis620_bin; extern CHARSET_INFO my_charset_ucs2_general_ci; extern CHARSET_INFO my_charset_ucs2_bin; extern CHARSET_INFO my_charset_ucs2_unicode_ci; extern CHARSET_INFO my_charset_ucs2_general_mysql500_ci; extern CHARSET_INFO my_charset_ujis_japanese_ci; extern CHARSET_INFO my_charset_ujis_bin; extern CHARSET_INFO my_charset_utf16_bin; extern CHARSET_INFO my_charset_utf16_general_ci; extern CHARSET_INFO my_charset_utf16_unicode_ci; extern CHARSET_INFO my_charset_utf16le_bin; extern CHARSET_INFO my_charset_utf16le_general_ci; extern CHARSET_INFO my_charset_utf32_bin; extern CHARSET_INFO my_charset_utf32_general_ci; extern CHARSET_INFO my_charset_utf32_unicode_ci; extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_utf8_general_ci; extern CHARSET_INFO my_charset_utf8_tolower_ci; extern CHARSET_INFO my_charset_utf8_unicode_ci; extern CHARSET_INFO my_charset_utf8_bin; extern CHARSET_INFO my_charset_utf8_general_mysql500_ci; extern CHARSET_INFO my_charset_utf8mb4_bin; extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_utf8mb4_general_ci; extern CHARSET_INFO my_charset_utf8mb4_unicode_ci; #define MY_UTF8MB3 "utf8" #define MY_UTF8MB4 "utf8mb4" /* declarations for simple charsets */ extern size_t my_strnxfrm_simple(const CHARSET_INFO *, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags); size_t my_strnxfrmlen_simple(const CHARSET_INFO *, size_t); extern int my_strnncoll_simple(const CHARSET_INFO *, const uchar *, size_t, const uchar *, size_t, my_bool); extern int my_strnncollsp_simple(const CHARSET_INFO *, const uchar *, size_t, const uchar *, size_t, my_bool diff_if_only_endspace_difference); extern void my_hash_sort_simple(const CHARSET_INFO *cs, const uchar *key, size_t len, ulong *nr1, ulong *nr2); extern size_t my_lengthsp_8bit(const CHARSET_INFO *cs, const char *ptr, size_t length); extern uint my_instr_simple(const struct charset_info_st *, const char *b, size_t b_length, const char *s, size_t s_length, my_match_t *match, uint nmatch); /* Functions for 8bit */ extern size_t my_caseup_str_8bit(const CHARSET_INFO *, char *); extern size_t my_casedn_str_8bit(const CHARSET_INFO *, char *); extern size_t my_caseup_8bit(const CHARSET_INFO *, char *src, size_t srclen, char *dst, size_t dstlen); extern size_t my_casedn_8bit(const CHARSET_INFO *, char *src, size_t srclen, char *dst, size_t dstlen); extern int my_strcasecmp_8bit(const CHARSET_INFO * cs, const char *, const char *); int my_mb_wc_8bit(const CHARSET_INFO *cs,my_wc_t *wc, const uchar *s, const uchar *e); int my_wc_mb_8bit(const CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e); int my_mb_ctype_8bit(const CHARSET_INFO *,int *, const uchar *,const uchar *); int my_mb_ctype_mb(const CHARSET_INFO *,int *, const uchar *,const uchar *); size_t my_scan_8bit(const CHARSET_INFO *cs, const char *b, const char *e, int sq); size_t my_snprintf_8bit(const struct charset_info_st *, char *to, size_t n, const char *fmt, ...) MY_ATTRIBUTE((format(printf, 4, 5))); long my_strntol_8bit(const CHARSET_INFO *, const char *s, size_t l, int base, char **e, int *err); ulong my_strntoul_8bit(const CHARSET_INFO *, const char *s, size_t l, int base, char **e, int *err); longlong my_strntoll_8bit(const CHARSET_INFO *, const char *s, size_t l, int base, char **e, int *err); ulonglong my_strntoull_8bit(const CHARSET_INFO *, const char *s, size_t l, int base, char **e, int *err); double my_strntod_8bit(const CHARSET_INFO *, char *s, size_t l, char **e, int *err); size_t my_long10_to_str_8bit(const CHARSET_INFO *, char *to, size_t l, int radix, long int val); size_t my_longlong10_to_str_8bit(const CHARSET_INFO *, char *to, size_t l, int radix, longlong val); longlong my_strtoll10_8bit(const CHARSET_INFO *cs, const char *nptr, char **endptr, int *error); longlong my_strtoll10_ucs2(const CHARSET_INFO *cs, const char *nptr, char **endptr, int *error); ulonglong my_strntoull10rnd_8bit(const CHARSET_INFO *cs, const char *str, size_t length, int unsigned_fl, char **endptr, int *error); ulonglong my_strntoull10rnd_ucs2(const CHARSET_INFO *cs, const char *str, size_t length, int unsigned_fl, char **endptr, int *error); void my_fill_8bit(const CHARSET_INFO *cs, char* to, size_t l, int fill); /* For 8-bit character set */ my_bool my_like_range_simple(const CHARSET_INFO *cs, const char *ptr, size_t ptr_length, pbool escape, pbool w_one, pbool w_many, size_t res_length, char *min_str, char *max_str, size_t *min_length, size_t *max_length); /* For ASCII-based multi-byte character sets with mbminlen=1 */ my_bool my_like_range_mb(const CHARSET_INFO *cs, const char *ptr, size_t ptr_length, pbool escape, pbool w_one, pbool w_many, size_t res_length, char *min_str, char *max_str, size_t *min_length, size_t *max_length); /* For other character sets, with arbitrary mbminlen and mbmaxlen numbers */ my_bool my_like_range_generic(const CHARSET_INFO *cs, const char *ptr, size_t ptr_length, pbool escape, pbool w_one, pbool w_many, size_t res_length, char *min_str, char *max_str, size_t *min_length, size_t *max_length); int my_wildcmp_8bit(const CHARSET_INFO *, const char *str,const char *str_end, const char *wildstr,const char *wildend, int escape, int w_one, int w_many); int my_wildcmp_bin(const CHARSET_INFO *, const char *str,const char *str_end, const char *wildstr,const char *wildend, int escape, int w_one, int w_many); size_t my_numchars_8bit(const CHARSET_INFO *, const char *b, const char *e); size_t my_numcells_8bit(const CHARSET_INFO *, const char *b, const char *e); size_t my_charpos_8bit(const CHARSET_INFO *, const char *b, const char *e, size_t pos); size_t my_well_formed_len_8bit(const CHARSET_INFO *, const char *b, const char *e, size_t pos, int *error); uint my_mbcharlen_8bit(const CHARSET_INFO *, uint c); /* Functions for multibyte charsets */ extern size_t my_caseup_str_mb(const CHARSET_INFO *, char *); extern size_t my_casedn_str_mb(const CHARSET_INFO *, char *); extern size_t my_caseup_mb(const CHARSET_INFO *, char *src, size_t srclen, char *dst, size_t dstlen); extern size_t my_casedn_mb(const CHARSET_INFO *, char *src, size_t srclen, char *dst, size_t dstlen); extern size_t my_caseup_mb_varlen(const CHARSET_INFO *, char *src, size_t srclen, char *dst, size_t dstlen); extern size_t my_casedn_mb_varlen(const CHARSET_INFO *, char *src, size_t srclen, char *dst, size_t dstlen); extern size_t my_caseup_ujis(const CHARSET_INFO *, char *src, size_t srclen, char *dst, size_t dstlen); extern size_t my_casedn_ujis(const CHARSET_INFO *, char *src, size_t srclen, char *dst, size_t dstlen); extern int my_strcasecmp_mb(const CHARSET_INFO * cs,const char *, const char *); int my_wildcmp_mb(const CHARSET_INFO *, const char *str,const char *str_end, const char *wildstr,const char *wildend, int escape, int w_one, int w_many); size_t my_numchars_mb(const CHARSET_INFO *, const char *b, const char *e); size_t my_numcells_mb(const CHARSET_INFO *, const char *b, const char *e); size_t my_charpos_mb(const CHARSET_INFO *, const char *b, const char *e, size_t pos); size_t my_well_formed_len_mb(const CHARSET_INFO *, const char *b, const char *e, size_t pos, int *error); uint my_instr_mb(const struct charset_info_st *, const char *b, size_t b_length, const char *s, size_t s_length, my_match_t *match, uint nmatch); int my_strnncoll_mb_bin(const CHARSET_INFO * cs, const uchar *s, size_t slen, const uchar *t, size_t tlen, my_bool t_is_prefix); int my_strnncollsp_mb_bin(const CHARSET_INFO *cs, const uchar *a, size_t a_length, const uchar *b, size_t b_length, my_bool diff_if_only_endspace_difference); int my_wildcmp_mb_bin(const CHARSET_INFO *cs, const char *str,const char *str_end, const char *wildstr,const char *wildend, int escape, int w_one, int w_many); int my_strcasecmp_mb_bin(const CHARSET_INFO * cs MY_ATTRIBUTE((unused)), const char *s, const char *t); void my_hash_sort_mb_bin(const CHARSET_INFO *cs MY_ATTRIBUTE((unused)), const uchar *key, size_t len,ulong *nr1, ulong *nr2); size_t my_strnxfrm_mb(const CHARSET_INFO *, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags); size_t my_strnxfrm_unicode(const CHARSET_INFO *, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags); size_t my_strnxfrm_unicode_full_bin(const CHARSET_INFO *, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags); size_t my_strnxfrmlen_unicode_full_bin(const CHARSET_INFO *, size_t); int my_wildcmp_unicode(const CHARSET_INFO *cs, const char *str, const char *str_end, const char *wildstr, const char *wildend, int escape, int w_one, int w_many, const MY_UNICASE_INFO *weights); extern my_bool my_parse_charset_xml(MY_CHARSET_LOADER *loader, const char *buf, size_t buflen); extern char *my_strchr(const CHARSET_INFO *cs, const char *str, const char *end, pchar c); extern size_t my_strcspn(const CHARSET_INFO *cs, const char *str, const char *end, const char *reject, size_t reject_length); my_bool my_propagate_simple(const CHARSET_INFO *cs, const uchar *str, size_t len); my_bool my_propagate_complex(const CHARSET_INFO *cs, const uchar *str, size_t len); uint my_string_repertoire(const CHARSET_INFO *cs, const char *str, size_t len); my_bool my_charset_is_ascii_based(const CHARSET_INFO *cs); my_bool my_charset_is_8bit_pure_ascii(const CHARSET_INFO *cs); uint my_charset_repertoire(const CHARSET_INFO *cs); uint my_strxfrm_flag_normalize(uint flags, uint nlevels); void my_strxfrm_desc_and_reverse(uchar *str, uchar *strend, uint flags, uint level); size_t my_strxfrm_pad_desc_and_reverse(const CHARSET_INFO *cs, uchar *str, uchar *frmend, uchar *strend, uint nweights, uint flags, uint level); my_bool my_charset_is_ascii_compatible(const CHARSET_INFO *cs); const MY_CONTRACTIONS *my_charset_get_contractions(const CHARSET_INFO *cs, int level); extern size_t my_vsnprintf_ex(const CHARSET_INFO *cs, char *to, size_t n, const char* fmt, va_list ap); size_t my_convert(char *to, size_t to_length, const CHARSET_INFO *to_cs, const char *from, size_t from_length, const CHARSET_INFO *from_cs, uint *errors); uint my_mbcharlen_ptr(const CHARSET_INFO *cs, const char *s, const char *e); #define _MY_U 01 /* Upper case */ #define _MY_L 02 /* Lower case */ #define _MY_NMR 04 /* Numeral (digit) */ #define _MY_SPC 010 /* Spacing character */ #define _MY_PNT 020 /* Punctuation */ #define _MY_CTR 040 /* Control character */ #define _MY_B 0100 /* Blank */ #define _MY_X 0200 /* heXadecimal digit */ #define my_isascii(c) (!((c) & ~0177)) #define my_toascii(c) ((c) & 0177) #define my_tocntrl(c) ((c) & 31) #define my_toprint(c) ((c) | 64) #define my_toupper(s,c) (char) ((s)->to_upper[(uchar) (c)]) #define my_tolower(s,c) (char) ((s)->to_lower[(uchar) (c)]) #define my_isalpha(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_U | _MY_L)) #define my_isupper(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_U) #define my_islower(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_L) #define my_isdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_NMR) #define my_isxdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_X) #define my_isalnum(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_U | _MY_L | _MY_NMR)) #define my_isspace(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_SPC) #define my_ispunct(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_PNT) #define my_isprint(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR | _MY_B)) #define my_isgraph(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR)) #define my_iscntrl(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_CTR) /* Some macros that should be cleaned up a little */ #define my_isvar(s,c) (my_isalnum(s,c) || (c) == '_') #define my_isvar_start(s,c) (my_isalpha(s,c) || (c) == '_') #define my_binary_compare(s) ((s)->state & MY_CS_BINSORT) #define use_strnxfrm(s) ((s)->state & MY_CS_STRNXFRM) #define my_strnxfrm(cs, d, dl, s, sl) \ ((cs)->coll->strnxfrm((cs), (d), (dl), (dl), (s), (sl), MY_STRXFRM_PAD_WITH_SPACE)) #define my_strnncoll(s, a, b, c, d) ((s)->coll->strnncoll((s), (a), (b), (c), (d), 0)) #define my_like_range(s, a, b, c, d, e, f, g, h, i, j) \ ((s)->coll->like_range((s), (a), (b), (c), (d), (e), (f), (g), (h), (i), (j))) #define my_wildcmp(cs,s,se,w,we,e,o,m) ((cs)->coll->wildcmp((cs),(s),(se),(w),(we),(e),(o),(m))) #define my_strcasecmp(s, a, b) ((s)->coll->strcasecmp((s), (a), (b))) #define my_charpos(cs, b, e, num) (cs)->cset->charpos((cs), (const char*) (b), (const char *)(e), (num)) #define use_mb(s) ((s)->cset->ismbchar != NULL) #define my_ismbchar(s, a, b) ((s)->cset->ismbchar((s), (a), (b))) #define my_mbcharlen(s, a) ((s)->cset->mbcharlen((s),(a))) /** Get the length of gb18030 code by the given two leading bytes @param[in] s charset_info @param[in] a first byte of gb18030 code @param[in] b second byte of gb18030 code @return the length of gb18030 code starting with given two bytes, the length would be 2 or 4 for valid gb18030 code, or 0 for invalid gb18030 code */ #define my_mbcharlen_2(s, a, b) ((s)->cset->mbcharlen((s),((((a) & 0xFF) << 8) + ((b) & 0xFF)))) /** Get the maximum length of leading bytes needed to determine the length of a multi-byte gb18030 code @param[in] s charset_info @return number of leading bytes we need, would be 2 for gb18030 and 1 for all other charsets */ #define my_mbmaxlenlen(s) ((s)->mbmaxlenlen) /** Judge if the given byte is a possible leading byte for a charset. For gb18030 whose mbmaxlenlen is 2, we can't determine the length of a multi-byte character by looking at the first byte only @param[in] s charset_info @param[in] i possible leading byte @return true if it is, otherwise false */ #define my_ismb1st(s, i) \ (my_mbcharlen((s), (i)) > 1 || \ (my_mbmaxlenlen((s)) == 2 && my_mbcharlen((s), (i)) == 0)) #define my_caseup_str(s, a) ((s)->cset->caseup_str((s), (a))) #define my_casedn_str(s, a) ((s)->cset->casedn_str((s), (a))) #define my_strntol(s, a, b, c, d, e) ((s)->cset->strntol((s),(a),(b),(c),(d),(e))) #define my_strntoul(s, a, b, c, d, e) ((s)->cset->strntoul((s),(a),(b),(c),(d),(e))) #define my_strntoll(s, a, b, c, d, e) ((s)->cset->strntoll((s),(a),(b),(c),(d),(e))) #define my_strntoull(s, a, b, c,d, e) ((s)->cset->strntoull((s),(a),(b),(c),(d),(e))) #define my_strntod(s, a, b, c, d) ((s)->cset->strntod((s),(a),(b),(c),(d))) #ifdef __cplusplus } #endif #endif /* _m_ctype_h */ ����������������������mysql/plugin_audit.h��������������������������������������������������������������������������������0000644�����������������00000042207�14763166026�0010566 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2007, 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _my_audit_h #define _my_audit_h #include "plugin.h" #include "mysql/mysql_lex_string.h" #ifndef MYSQL_ABI_CHECK #include "m_string.h" #endif #include "my_command.h" #include "my_sqlcommand.h" #define MYSQL_AUDIT_INTERFACE_VERSION 0x0401 /** @enum mysql_event_class_t Audit event classes. */ typedef enum { MYSQL_AUDIT_GENERAL_CLASS = 0, MYSQL_AUDIT_CONNECTION_CLASS = 1, MYSQL_AUDIT_PARSE_CLASS = 2, MYSQL_AUDIT_AUTHORIZATION_CLASS = 3, MYSQL_AUDIT_TABLE_ACCESS_CLASS = 4, MYSQL_AUDIT_GLOBAL_VARIABLE_CLASS = 5, MYSQL_AUDIT_SERVER_STARTUP_CLASS = 6, MYSQL_AUDIT_SERVER_SHUTDOWN_CLASS = 7, MYSQL_AUDIT_COMMAND_CLASS = 8, MYSQL_AUDIT_QUERY_CLASS = 9, MYSQL_AUDIT_STORED_PROGRAM_CLASS = 10, /* This item must be last in the list. */ MYSQL_AUDIT_CLASS_MASK_SIZE } mysql_event_class_t; /** @struct st_mysql_audit The descriptor structure that is referred from st_mysql_plugin. */ struct st_mysql_audit { /** Interface version. */ int interface_version; /** Event occurs when the event class consumer is to be disassociated from the specified THD.This would typically occur before some operation which may require sleeping - such as when waiting for the next query from the client. */ void (*release_thd)(MYSQL_THD); /** Invoked whenever an event occurs which is of any class for which the plugin has interest.The second argument indicates the specific event class and the third argument is data as required for that class. */ int (*event_notify)(MYSQL_THD, mysql_event_class_t, const void *); /** An array of bits used to indicate what event classes that this plugin wants to receive. */ unsigned long class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE]; }; /** @typedef enum_sql_command_t SQL command type definition. */ typedef enum enum_sql_command enum_sql_command_t; /** @enum mysql_event_general_subclass_t Events for the MYSQL_AUDIT_GENERAL_CLASS event class. */ typedef enum { /** occurs before emitting to the general query log. */ MYSQL_AUDIT_GENERAL_LOG = 1 << 0, /** occurs before transmitting errors to the user. */ MYSQL_AUDIT_GENERAL_ERROR = 1 << 1, /** occurs after transmitting a resultset to the user. */ MYSQL_AUDIT_GENERAL_RESULT = 1 << 2, /** occurs after transmitting a resultset or errors */ MYSQL_AUDIT_GENERAL_STATUS = 1 << 3 } mysql_event_general_subclass_t; #define MYSQL_AUDIT_GENERAL_ALL (MYSQL_AUDIT_GENERAL_LOG | \ MYSQL_AUDIT_GENERAL_ERROR | \ MYSQL_AUDIT_GENERAL_RESULT | \ MYSQL_AUDIT_GENERAL_STATUS) /** @struct mysql_event_general Structure for the MYSQL_AUDIT_GENERAL_CLASS event class. */ struct mysql_event_general { mysql_event_general_subclass_t event_subclass; int general_error_code; unsigned long general_thread_id; MYSQL_LEX_CSTRING general_user; MYSQL_LEX_CSTRING general_command; MYSQL_LEX_CSTRING general_query; struct charset_info_st *general_charset; unsigned long long general_time; unsigned long long general_rows; MYSQL_LEX_CSTRING general_host; MYSQL_LEX_CSTRING general_sql_command; MYSQL_LEX_CSTRING general_external_user; MYSQL_LEX_CSTRING general_ip; }; /** @enum mysql_event_connection_subclass_t Events for MYSQL_AUDIT_CONNECTION_CLASS event class. */ typedef enum { /** occurs after authentication phase is completed. */ MYSQL_AUDIT_CONNECTION_CONNECT = 1 << 0, /** occurs after connection is terminated. */ MYSQL_AUDIT_CONNECTION_DISCONNECT = 1 << 1, /** occurs after COM_CHANGE_USER RPC is completed. */ MYSQL_AUDIT_CONNECTION_CHANGE_USER = 1 << 2, /** occurs before authentication. */ MYSQL_AUDIT_CONNECTION_PRE_AUTHENTICATE = 1 << 3 } mysql_event_connection_subclass_t; #define MYSQL_AUDIT_CONNECTION_ALL (MYSQL_AUDIT_CONNECTION_CONNECT | \ MYSQL_AUDIT_CONNECTION_DISCONNECT | \ MYSQL_AUDIT_CONNECTION_CHANGE_USER | \ MYSQL_AUDIT_CONNECTION_PRE_AUTHENTICATE) /** @struct mysql_event_connection Structure for the MYSQL_AUDIT_CONNECTION_CLASS event class. */ struct mysql_event_connection { /** Event subclass. */ mysql_event_connection_subclass_t event_subclass; /** Current status of the connection. */ int status; /** Connection id. */ unsigned long connection_id; /** User name of this connection. */ MYSQL_LEX_CSTRING user; /** Priv user name. */ MYSQL_LEX_CSTRING priv_user; /** External user name. */ MYSQL_LEX_CSTRING external_user; /** Proxy user used for this connection. */ MYSQL_LEX_CSTRING proxy_user; /** Connection host. */ MYSQL_LEX_CSTRING host; /** IP of the connection. */ MYSQL_LEX_CSTRING ip; /** Database name specified at connection time. */ MYSQL_LEX_CSTRING database; /** Connection type: - 0 Undefined - 1 TCP/IP - 2 Socket - 3 Named pipe - 4 SSL - 5 Shared memory */ int connection_type; }; /** @enum mysql_event_parse_subclass_t Events for MYSQL_AUDIT_PARSE_CLASS event class. */ typedef enum { /** occurs before the query parsing. */ MYSQL_AUDIT_PARSE_PREPARSE = 1 << 0, /** occurs after the query parsing. */ MYSQL_AUDIT_PARSE_POSTPARSE = 1 << 1 } mysql_event_parse_subclass_t; #define MYSQL_AUDIT_PARSE_ALL (MYSQL_AUDIT_PARSE_PREPARSE | \ MYSQL_AUDIT_PARSE_POSTPARSE) typedef enum { MYSQL_AUDIT_PARSE_REWRITE_PLUGIN_NONE = 0, /// mysql_event_parse::flags Must be set by a plugin if the query is rewritten. MYSQL_AUDIT_PARSE_REWRITE_PLUGIN_QUERY_REWRITTEN = 1 << 0, /// mysql_event_parse::flags Is set by the server if the query is prepared statement. MYSQL_AUDIT_PARSE_REWRITE_PLUGIN_IS_PREPARED_STATEMENT = 1 << 1 } mysql_event_parse_rewrite_plugin_flag; /** Data for the MYSQL_AUDIT_PARSE events */ struct mysql_event_parse { /** MYSQL_AUDIT_[PRE|POST]_PARSE event id */ mysql_event_parse_subclass_t event_subclass; /** one of FLAG_REWRITE_PLUGIN_* */ mysql_event_parse_rewrite_plugin_flag *flags; /** input: the original query text */ MYSQL_LEX_CSTRING query; /** output: returns the null-terminated rewriten query allocated by my_malloc() */ MYSQL_LEX_CSTRING *rewritten_query; }; /** @enum mysql_event_authorization_subclass_t Events for MYSQL_AUDIT_AUTHORIZATION_CLASS event class. */ typedef enum { MYSQL_AUDIT_AUTHORIZATION_USER = 1 << 0, /** Occurs when database privilege is checked. */ MYSQL_AUDIT_AUTHORIZATION_DB = 1 << 1, /** Occurs when table privilege is checked. */ MYSQL_AUDIT_AUTHORIZATION_TABLE = 1 << 2, /** Occurs when column privilege is checked. */ MYSQL_AUDIT_AUTHORIZATION_COLUMN = 1 << 3, /** Occurs when procedure privilege is checked. */ MYSQL_AUDIT_AUTHORIZATION_PROCEDURE = 1 << 4, /** Occurs when proxy privilege is checked. */ MYSQL_AUDIT_AUTHORIZATION_PROXY = 1 << 5 } mysql_event_authorization_subclass_t; #define MYSQL_AUDIT_AUTHORIZATION_ALL (MYSQL_AUDIT_AUTHORIZATION_USER | \ MYSQL_AUDIT_AUTHORIZATION_DB | \ MYSQL_AUDIT_AUTHORIZATION_TABLE | \ MYSQL_AUDIT_AUTHORIZATION_COLUMN | \ MYSQL_AUDIT_AUTHORIZATION_PROCEDURE | \ MYSQL_AUDIT_AUTHORIZATION_PROXY) /** @struct mysql_event_authorization Structure for MYSQL_AUDIT_AUTHORIZATION_CLASS event class. */ struct mysql_event_authorization { /** Event subclass. */ mysql_event_authorization_subclass_t event_subclass; /** Event status. */ int status; /** Connection id. */ unsigned int connection_id; /** SQL command id. */ enum_sql_command_t sql_command_id; /** SQL query text. */ MYSQL_LEX_CSTRING query; /** SQL query charset. */ const struct charset_info_st *query_charset; /** Database name. */ MYSQL_LEX_CSTRING database; /** Table name. */ MYSQL_LEX_CSTRING table; /** Other name associated with the event. */ MYSQL_LEX_CSTRING object; /** Requested authorization privileges. */ unsigned long requested_privilege; /** Currently granted authorization privileges. */ unsigned long granted_privilege; }; /** @enum mysql_event_table_row_access_subclass_t Events for MYSQL_AUDIT_TABLE_ACCES_CLASS event class. */ typedef enum { /** Occurs when table data are read. */ MYSQL_AUDIT_TABLE_ACCESS_READ = 1 << 0, /** Occurs when table data are inserted. */ MYSQL_AUDIT_TABLE_ACCESS_INSERT = 1 << 1, /** Occurs when table data are updated. */ MYSQL_AUDIT_TABLE_ACCESS_UPDATE = 1 << 2, /** Occurs when table data are deleted. */ MYSQL_AUDIT_TABLE_ACCESS_DELETE = 1 << 3 } mysql_event_table_access_subclass_t; #define MYSQL_AUDIT_TABLE_ACCESS_ALL (MYSQL_AUDIT_TABLE_ACCESS_READ | \ MYSQL_AUDIT_TABLE_ACCESS_INSERT | \ MYSQL_AUDIT_TABLE_ACCESS_UPDATE | \ MYSQL_AUDIT_TABLE_ACCESS_DELETE) /** @struct mysql_event_table_row_access Structure for MYSQL_AUDIT_TABLE_ACCES_CLASS event class. */ struct mysql_event_table_access { /** Event subclass. */ mysql_event_table_access_subclass_t event_subclass; /** Connection id. */ unsigned long connection_id; /** SQL command id. */ enum_sql_command_t sql_command_id; /** SQL query. */ MYSQL_LEX_CSTRING query; /** SQL query charset. */ const struct charset_info_st *query_charset; /** Database name. */ MYSQL_LEX_CSTRING table_database; /** Table name. */ MYSQL_LEX_CSTRING table_name; }; /** @enum mysql_event_global_variable_subclass_t Events for MYSQL_AUDIT_GLOBAL_VARIABLE_CLASS event class. */ typedef enum { /** Occurs when global variable is retrieved. */ MYSQL_AUDIT_GLOBAL_VARIABLE_GET = 1 << 0, /** Occurs when global variable is set. */ MYSQL_AUDIT_GLOBAL_VARIABLE_SET = 1 << 1 } mysql_event_global_variable_subclass_t; #define MYSQL_AUDIT_GLOBAL_VARIABLE_ALL (MYSQL_AUDIT_GLOBAL_VARIABLE_GET | \ MYSQL_AUDIT_GLOBAL_VARIABLE_SET) /** Events for MYSQL_AUDIT_GLOBAL_VARIABLE_CLASS event class. */ struct mysql_event_global_variable { /** Event subclass. */ mysql_event_global_variable_subclass_t event_subclass; /** Connection id. */ unsigned long connection_id; /** SQL command id. */ enum_sql_command_t sql_command_id; /** Variable name. */ MYSQL_LEX_CSTRING variable_name; /** Variable value. */ MYSQL_LEX_CSTRING variable_value; }; /** @enum mysql_event_server_startup_subclass_t Events for MYSQL_AUDIT_SERVER_STARTUP_CLASS event class. */ typedef enum { /** Occurs after all subsystem are initialized during system start. */ MYSQL_AUDIT_SERVER_STARTUP_STARTUP = 1 << 0 } mysql_event_server_startup_subclass_t; #define MYSQL_AUDIT_SERVER_STARTUP_ALL (MYSQL_AUDIT_SERVER_STARTUP_STARTUP) /** @struct mysql_event_server_startup Structure for MYSQL_AUDIT_SERVER_STARTUP_CLASS event class. */ struct mysql_event_server_startup { /** Event subclass. */ mysql_event_server_startup_subclass_t event_subclass; /** Command line arguments. */ const char **argv; /** Command line arguments count. */ unsigned int argc; }; /** @enum mysql_event_server_shutdown_subclass_t Events for MYSQL_AUDIT_SERVER_SHUTDOWN_CLASS event class. */ typedef enum { /** Occurs when global variable is set. */ MYSQL_AUDIT_SERVER_SHUTDOWN_SHUTDOWN = 1 << 0 } mysql_event_server_shutdown_subclass_t; #define MYSQL_AUDIT_SERVER_SHUTDOWN_ALL (MYSQL_AUDIT_SERVER_SHUTDOWN_SHUTDOWN) /** @enum mysql_server_shutdown_reason_t Server shutdown reason. */ typedef enum { /** User requested shut down. */ MYSQL_AUDIT_SERVER_SHUTDOWN_REASON_SHUTDOWN, /** The server aborts. */ MYSQL_AUDIT_SERVER_SHUTDOWN_REASON_ABORT } mysql_server_shutdown_reason_t; /** @struct mysql_event_server_shutdown Structure for MYSQL_AUDIT_SERVER_SHUTDOWN_CLASS event class. */ struct mysql_event_server_shutdown { /** Shutdown event. */ mysql_event_server_shutdown_subclass_t event_subclass; /** Exit code associated with the shutdown event. */ int exit_code; /** Shutdown reason. */ mysql_server_shutdown_reason_t reason; }; /** @enum mysql_event_command_subclass_t Events for MYSQL_AUDIT_COMMAND_CLASS event class. */ typedef enum { /** Command start event. */ MYSQL_AUDIT_COMMAND_START = 1 << 0, /** Command end event. */ MYSQL_AUDIT_COMMAND_END = 1 << 1 } mysql_event_command_subclass_t; #define MYSQL_AUDIT_COMMAND_ALL (MYSQL_AUDIT_COMMAND_START | \ MYSQL_AUDIT_COMMAND_END) /** @typedef enum_server_command_t Server command type definition. */ typedef enum enum_server_command enum_server_command_t; /** @struct mysql_event_command Event for MYSQL_AUDIT_COMMAND_CLASS event class. Events generated as a result of RPC command requests. */ struct mysql_event_command { /** Command event subclass. */ mysql_event_command_subclass_t event_subclass; /** Command event status. */ int status; /** Connection id. */ unsigned long connection_id; /** Command id. */ enum_server_command_t command_id; }; /** @enum mysql_event_query_subclass_t Events for MYSQL_AUDIT_QUERY_CLASS event class. */ typedef enum { /** Query start event. */ MYSQL_AUDIT_QUERY_START = 1 << 0, /** Nested query start event. */ MYSQL_AUDIT_QUERY_NESTED_START = 1 << 1, /** Query post parse event. */ MYSQL_AUDIT_QUERY_STATUS_END = 1 << 2, /** Nested query status end event. */ MYSQL_AUDIT_QUERY_NESTED_STATUS_END = 1 << 3 } mysql_event_query_subclass_t; #define MYSQL_AUDIT_QUERY_ALL (MYSQL_AUDIT_QUERY_START | \ MYSQL_AUDIT_QUERY_NESTED_START | \ MYSQL_AUDIT_QUERY_STATUS_END | \ MYSQL_AUDIT_QUERY_NESTED_STATUS_END) /** @struct mysql_event_command Event for MYSQL_AUDIT_COMMAND_CLASS event class. */ struct mysql_event_query { /** Event subclass. */ mysql_event_query_subclass_t event_subclass; /** Event status. */ int status; /** Connection id. */ unsigned long connection_id; /** SQL command id. */ enum_sql_command_t sql_command_id; /** SQL query. */ MYSQL_LEX_CSTRING query; /** SQL query charset. */ const struct charset_info_st *query_charset; }; /** @enum mysql_event_stored_program_subclass_t Events for MYSQL_AUDIT_STORED_PROGRAM_CLASS event class. */ typedef enum { /** Stored program execution event. */ MYSQL_AUDIT_STORED_PROGRAM_EXECUTE = 1 << 0 } mysql_event_stored_program_subclass_t; #define MYSQL_AUDIT_STORED_PROGRAM_ALL (MYSQL_AUDIT_STORED_PROGRAM_EXECUTE) /** @struct mysql_event_command Event for MYSQL_AUDIT_COMMAND_CLASS event class. */ struct mysql_event_stored_program { /** Event subclass. */ mysql_event_stored_program_subclass_t event_subclass; /** Connection id. */ unsigned long connection_id; /** SQL command id. */ enum_sql_command_t sql_command_id; /** SQL query text. */ MYSQL_LEX_CSTRING query; /** SQL query charset. */ const struct charset_info_st *query_charset; /** The Database the procedure is defined in. */ MYSQL_LEX_CSTRING database; /** Name of the stored program. */ MYSQL_LEX_CSTRING name; /** Stored program parameters. */ void *parameters; }; #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mysql/my_command.h����������������������������������������������������������������������������������0000644�����������������00000003203�14763166026�0010216 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 2015, Oracle and/or its affiliates. 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; version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _mysql_command_h #define _mysql_command_h /** @enum enum_server_command @brief You should add new commands to the end of this list, otherwise old servers won't be able to handle them as 'unsupported'. */ enum enum_server_command { COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST, COM_CREATE_DB, COM_DROP_DB, COM_REFRESH, COM_SHUTDOWN, COM_STATISTICS, COM_PROCESS_INFO, COM_CONNECT, COM_PROCESS_KILL, COM_DEBUG, COM_PING, COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP, COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE, COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE, COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON, COM_BINLOG_DUMP_GTID, COM_RESET_CONNECTION, /* don't forget to update const char *command_name[] in sql_parse.cc */ /* Must be last */ COM_END }; #endif /* _mysql_command_h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������byteswap.h������������������������������������������������������������������������������������������0000644�����������������00000002640�14763166026�0006570 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BYTESWAP_H #define _BYTESWAP_H 1 #include <features.h> /* Get the machine specific, optimized definitions. */ #include <bits/byteswap.h> /* The following definitions must all be macros since otherwise some of the possible optimizations are not possible. */ /* Return a value with all bytes in the 16 bit argument swapped. */ #define bswap_16(x) __bswap_16 (x) /* Return a value with all bytes in the 32 bit argument swapped. */ #define bswap_32(x) __bswap_32 (x) #if __GLIBC_HAVE_LONG_LONG /* Return a value with all bytes in the 64 bit argument swapped. */ # define bswap_64(x) __bswap_64 (x) #endif #endif /* byteswap.h */ ������������������������������������������������������������������������������������������������pgsql/internal/port.h�������������������������������������������������������������������������������0000644�����������������00000033710�14763166026�0010662 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * port.h * Header for src/port/ compatibility functions. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/port.h * *------------------------------------------------------------------------- */ #ifndef PG_PORT_H #define PG_PORT_H #include <ctype.h> #include <netdb.h> #include <pwd.h> /* socket has a different definition on WIN32 */ #ifndef WIN32 typedef int pgsocket; #define PGINVALID_SOCKET (-1) #else typedef SOCKET pgsocket; #define PGINVALID_SOCKET INVALID_SOCKET #endif /* non-blocking */ extern bool pg_set_noblock(pgsocket sock); extern bool pg_set_block(pgsocket sock); /* Portable path handling for Unix/Win32 (in path.c) */ extern bool has_drive_prefix(const char *filename); extern char *first_dir_separator(const char *filename); extern char *last_dir_separator(const char *filename); extern char *first_path_var_separator(const char *pathlist); extern void join_path_components(char *ret_path, const char *head, const char *tail); extern void canonicalize_path(char *path); extern void make_native_path(char *path); extern bool path_contains_parent_reference(const char *path); extern bool path_is_relative_and_below_cwd(const char *path); extern bool path_is_prefix_of_path(const char *path1, const char *path2); extern const char *get_progname(const char *argv0); extern void get_share_path(const char *my_exec_path, char *ret_path); extern void get_etc_path(const char *my_exec_path, char *ret_path); extern void get_include_path(const char *my_exec_path, char *ret_path); extern void get_pkginclude_path(const char *my_exec_path, char *ret_path); extern void get_includeserver_path(const char *my_exec_path, char *ret_path); extern void get_lib_path(const char *my_exec_path, char *ret_path); extern void get_pkglib_path(const char *my_exec_path, char *ret_path); extern void get_locale_path(const char *my_exec_path, char *ret_path); extern void get_doc_path(const char *my_exec_path, char *ret_path); extern void get_html_path(const char *my_exec_path, char *ret_path); extern void get_man_path(const char *my_exec_path, char *ret_path); extern bool get_home_path(char *ret_path); extern void get_parent_directory(char *path); /* port/dirmod.c */ extern char **pgfnames(const char *path); extern void pgfnames_cleanup(char **filenames); /* * is_absolute_path * * By making this a macro we avoid needing to include path.c in libpq. */ #ifndef WIN32 #define IS_DIR_SEP(ch) ((ch) == '/') #define is_absolute_path(filename) \ ( \ IS_DIR_SEP((filename)[0]) \ ) #else #define IS_DIR_SEP(ch) ((ch) == '/' || (ch) == '\\') /* See path_is_relative_and_below_cwd() for how we handle 'E:abc'. */ #define is_absolute_path(filename) \ ( \ IS_DIR_SEP((filename)[0]) || \ (isalpha((unsigned char) ((filename)[0])) && (filename)[1] == ':' && \ IS_DIR_SEP((filename)[2])) \ ) #endif /* Portable locale initialization (in exec.c) */ extern void set_pglocale_pgservice(const char *argv0, const char *app); /* Portable way to find binaries (in exec.c) */ extern int find_my_exec(const char *argv0, char *retpath); extern int find_other_exec(const char *argv0, const char *target, const char *versionstr, char *retpath); /* Windows security token manipulation (in exec.c) */ #ifdef WIN32 extern BOOL AddUserToTokenDacl(HANDLE hToken); #endif #if defined(WIN32) || defined(__CYGWIN__) #define EXE ".exe" #else #define EXE "" #endif #if defined(WIN32) && !defined(__CYGWIN__) #define DEVNULL "nul" #else #define DEVNULL "/dev/null" #endif /* * Win32 needs double quotes at the beginning and end of system() * strings. If not, it gets confused with multiple quoted strings. * It also requires double-quotes around the executable name and * any files used for redirection. Other args can use single-quotes. * * Generated using Win32 "CMD /?": * * 1. If all of the following conditions are met, then quote characters * on the command line are preserved: * * - no /S switch * - exactly two quote characters * - no special characters between the two quote characters, where special * is one of: &<>()@^| * - there are one or more whitespace characters between the two quote * characters * - the string between the two quote characters is the name of an * executable file. * * 2. Otherwise, old behavior is to see if the first character is a quote * character and if so, strip the leading character and remove the last * quote character on the command line, preserving any text after the last * quote character. */ #if defined(WIN32) && !defined(__CYGWIN__) #define SYSTEMQUOTE "\"" #else #define SYSTEMQUOTE "" #endif /* Portable delay handling */ extern void pg_usleep(long microsec); /* Portable SQL-like case-independent comparisons and conversions */ extern int pg_strcasecmp(const char *s1, const char *s2); extern int pg_strncasecmp(const char *s1, const char *s2, size_t n); extern unsigned char pg_toupper(unsigned char ch); extern unsigned char pg_tolower(unsigned char ch); extern unsigned char pg_ascii_toupper(unsigned char ch); extern unsigned char pg_ascii_tolower(unsigned char ch); #ifdef USE_REPL_SNPRINTF /* * Versions of libintl >= 0.13 try to replace printf() and friends with * macros to their own versions that understand the %$ format. We do the * same, so disable their macros, if they exist. */ #ifdef vsnprintf #undef vsnprintf #endif #ifdef snprintf #undef snprintf #endif #ifdef sprintf #undef sprintf #endif #ifdef vfprintf #undef vfprintf #endif #ifdef fprintf #undef fprintf #endif #ifdef printf #undef printf #endif extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args); extern int pg_snprintf(char *str, size_t count, const char *fmt,...) /* This extension allows gcc to check the format string */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 4))); extern int pg_sprintf(char *str, const char *fmt,...) /* This extension allows gcc to check the format string */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3))); extern int pg_vfprintf(FILE *stream, const char *fmt, va_list args); extern int pg_fprintf(FILE *stream, const char *fmt,...) /* This extension allows gcc to check the format string */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3))); extern int pg_printf(const char *fmt,...) /* This extension allows gcc to check the format string */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2))); /* * The GCC-specific code below prevents the __attribute__(... 'printf') * above from being replaced, and this is required because gcc doesn't * know anything about pg_printf. */ #ifdef __GNUC__ #define vsnprintf(...) pg_vsnprintf(__VA_ARGS__) #define snprintf(...) pg_snprintf(__VA_ARGS__) #define sprintf(...) pg_sprintf(__VA_ARGS__) #define vfprintf(...) pg_vfprintf(__VA_ARGS__) #define fprintf(...) pg_fprintf(__VA_ARGS__) #define printf(...) pg_printf(__VA_ARGS__) #else #define vsnprintf pg_vsnprintf #define snprintf pg_snprintf #define sprintf pg_sprintf #define vfprintf pg_vfprintf #define fprintf pg_fprintf #define printf pg_printf #endif #endif /* USE_REPL_SNPRINTF */ #if defined(WIN32) /* * Versions of libintl >= 0.18? try to replace setlocale() with a macro * to their own versions. Remove the macro, if it exists, because it * ends up calling the wrong version when the backend and libintl use * different versions of msvcrt. */ #if defined(setlocale) #undef setlocale #endif /* * Define our own wrapper macro around setlocale() to work around bugs in * Windows' native setlocale() function. */ extern char *pgwin32_setlocale(int category, const char *locale); #define setlocale(a,b) pgwin32_setlocale(a,b) #endif /* WIN32 */ /* Portable prompt handling */ extern char *simple_prompt(const char *prompt, int maxlen, bool echo); #ifdef WIN32 #define PG_SIGNAL_COUNT 32 #define kill(pid,sig) pgkill(pid,sig) extern int pgkill(int pid, int sig); #endif extern int pclose_check(FILE *stream); /* Global variable holding time zone information. */ #ifndef __CYGWIN__ #define TIMEZONE_GLOBAL timezone #define TZNAME_GLOBAL tzname #else #define TIMEZONE_GLOBAL _timezone #define TZNAME_GLOBAL _tzname #endif #if defined(WIN32) || defined(__CYGWIN__) /* * Win32 doesn't have reliable rename/unlink during concurrent access. */ extern int pgrename(const char *from, const char *to); extern int pgunlink(const char *path); /* Include this first so later includes don't see these defines */ #ifdef WIN32_ONLY_COMPILER #include <io.h> #endif #define rename(from, to) pgrename(from, to) #define unlink(path) pgunlink(path) #endif /* defined(WIN32) || defined(__CYGWIN__) */ /* * Win32 also doesn't have symlinks, but we can emulate them with * junction points on newer Win32 versions. * * Cygwin has its own symlinks which work on Win95/98/ME where * junction points don't, so use those instead. We have no way of * knowing what type of system Cygwin binaries will be run on. * Note: Some CYGWIN includes might #define WIN32. */ #if defined(WIN32) && !defined(__CYGWIN__) extern int pgsymlink(const char *oldpath, const char *newpath); extern int pgreadlink(const char *path, char *buf, size_t size); extern bool pgwin32_is_junction(char *path); #define symlink(oldpath, newpath) pgsymlink(oldpath, newpath) #define readlink(path, buf, size) pgreadlink(path, buf, size) #endif extern bool rmtree(const char *path, bool rmtopdir); /* * stat() is not guaranteed to set the st_size field on win32, so we * redefine it to our own implementation that is. * * We must pull in sys/stat.h here so the system header definition * goes in first, and we redefine that, and not the other way around. * * Some frontends don't need the size from stat, so if UNSAFE_STAT_OK * is defined we don't bother with this. */ #if defined(WIN32) && !defined(__CYGWIN__) && !defined(UNSAFE_STAT_OK) #include <sys/stat.h> extern int pgwin32_safestat(const char *path, struct stat * buf); #define stat(a,b) pgwin32_safestat(a,b) #endif #if defined(WIN32) && !defined(__CYGWIN__) /* * open() and fopen() replacements to allow deletion of open files and * passing of other special options. */ #define O_DIRECT 0x80000000 extern int pgwin32_open(const char *, int,...); extern FILE *pgwin32_fopen(const char *, const char *); #ifndef FRONTEND #define open(a,b,c) pgwin32_open(a,b,c) #define fopen(a,b) pgwin32_fopen(a,b) #endif #ifndef popen #define popen(a,b) _popen(a,b) #endif #ifndef pclose #define pclose(a) _pclose(a) #endif /* New versions of MingW have gettimeofday, old mingw and msvc don't */ #ifndef HAVE_GETTIMEOFDAY /* Last parameter not used */ extern int gettimeofday(struct timeval * tp, struct timezone * tzp); #endif #else /* !WIN32 */ /* * Win32 requires a special close for sockets and pipes, while on Unix * close() does them all. */ #define closesocket close #endif /* WIN32 */ /* * On Windows, setvbuf() does not support _IOLBF mode, and interprets that * as _IOFBF. To add insult to injury, setvbuf(file, NULL, _IOFBF, 0) * crashes outright if "parameter validation" is enabled. Therefore, in * places where we'd like to select line-buffered mode, we fall back to * unbuffered mode instead on Windows. Always use PG_IOLBF not _IOLBF * directly in order to implement this behavior. */ #ifndef WIN32 #define PG_IOLBF _IOLBF #else #define PG_IOLBF _IONBF #endif /* * Default "extern" declarations or macro substitutes for library routines. * When necessary, these routines are provided by files in src/port/. */ #ifndef HAVE_CRYPT extern char *crypt(const char *key, const char *setting); #endif /* WIN32 handled in port/win32.h */ #ifndef WIN32 #define pgoff_t off_t #ifdef __NetBSD__ extern int fseeko(FILE *stream, off_t offset, int whence); extern off_t ftello(FILE *stream); #endif #endif extern double pg_erand48(unsigned short xseed[3]); extern long pg_lrand48(void); extern void pg_srand48(long seed); #ifndef HAVE_FLS extern int fls(int mask); #endif #ifndef HAVE_FSEEKO #define fseeko(a, b, c) fseek(a, b, c) #define ftello(a) ftell(a) #endif #ifndef HAVE_GETOPT extern int getopt(int nargc, char *const * nargv, const char *ostr); #endif #if !defined(HAVE_GETPEEREID) && !defined(WIN32) extern int getpeereid(int sock, uid_t *uid, gid_t *gid); #endif #ifndef HAVE_ISINF extern int isinf(double x); #endif #ifndef HAVE_MKDTEMP extern char *mkdtemp(char *path); #endif #ifndef HAVE_RINT extern double rint(double x); #endif #ifndef HAVE_INET_ATON #include <netinet/in.h> #include <arpa/inet.h> extern int inet_aton(const char *cp, struct in_addr * addr); #endif #if !HAVE_DECL_STRLCAT extern size_t strlcat(char *dst, const char *src, size_t siz); #endif #if !HAVE_DECL_STRLCPY extern size_t strlcpy(char *dst, const char *src, size_t siz); #endif #if !defined(HAVE_RANDOM) && !defined(__BORLANDC__) extern long random(void); #endif #ifndef HAVE_UNSETENV extern void unsetenv(const char *name); #endif #ifndef HAVE_SRANDOM extern void srandom(unsigned int seed); #endif /* thread.h */ extern char *pqStrerror(int errnum, char *strerrbuf, size_t buflen); #if !defined(WIN32) || defined(__CYGWIN__) extern int pqGetpwuid(uid_t uid, struct passwd * resultbuf, char *buffer, size_t buflen, struct passwd ** result); #endif extern int pqGethostbyname(const char *name, struct hostent * resultbuf, char *buffer, size_t buflen, struct hostent ** result, int *herrno); extern void pg_qsort(void *base, size_t nel, size_t elsize, int (*cmp) (const void *, const void *)); #define qsort(a,b,c,d) pg_qsort(a,b,c,d) typedef int (*qsort_arg_comparator) (const void *a, const void *b, void *arg); extern void qsort_arg(void *base, size_t nel, size_t elsize, qsort_arg_comparator cmp, void *arg); /* port/chklocale.c */ extern int pg_get_encoding_from_locale(const char *ctype, bool write_message); /* port/inet_net_ntop.c */ extern char *inet_net_ntop(int af, const void *src, int bits, char *dst, size_t size); /* port/pgcheckdir.c */ extern int pg_check_dir(const char *dir); /* port/pgmkdirp.c */ extern int pg_mkdir_p(char *path, int omode); #endif /* PG_PORT_H */ ��������������������������������������������������������pgsql/internal/pqexpbuffer.h������������������������������������������������������������������������0000644�����������������00000014603�14763166026�0012225 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pqexpbuffer.h * Declarations/definitions for "PQExpBuffer" functions. * * PQExpBuffer provides an indefinitely-extensible string data type. * It can be used to buffer either ordinary C strings (null-terminated text) * or arbitrary binary data. All storage is allocated with malloc(). * * This module is essentially the same as the backend's StringInfo data type, * but it is intended for use in frontend libpq and client applications. * Thus, it does not rely on palloc() nor elog(). * * It does rely on vsnprintf(); if configure finds that libc doesn't provide * a usable vsnprintf(), then a copy of our own implementation of it will * be linked into libpq. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/interfaces/libpq/pqexpbuffer.h * *------------------------------------------------------------------------- */ #ifndef PQEXPBUFFER_H #define PQEXPBUFFER_H /*------------------------- * PQExpBufferData holds information about an extensible string. * data is the current buffer for the string (allocated with malloc). * len is the current string length. There is guaranteed to be * a terminating '\0' at data[len], although this is not very * useful when the string holds binary data rather than text. * maxlen is the allocated size in bytes of 'data', i.e. the maximum * string size (including the terminating '\0' char) that we can * currently store in 'data' without having to reallocate * more space. We must always have maxlen > len. * * An exception occurs if we failed to allocate enough memory for the string * buffer. In that case data points to a statically allocated empty string, * and len = maxlen = 0. *------------------------- */ typedef struct PQExpBufferData { char *data; size_t len; size_t maxlen; } PQExpBufferData; typedef PQExpBufferData *PQExpBuffer; /*------------------------ * Test for a broken (out of memory) PQExpBuffer. * When a buffer is "broken", all operations except resetting or deleting it * are no-ops. *------------------------ */ #define PQExpBufferBroken(str) \ ((str) == NULL || (str)->maxlen == 0) /*------------------------ * Same, but for use when using a static or local PQExpBufferData struct. * For that, a null-pointer test is useless and may draw compiler warnings. *------------------------ */ #define PQExpBufferDataBroken(buf) \ ((buf).maxlen == 0) /*------------------------ * Initial size of the data buffer in a PQExpBuffer. * NB: this must be large enough to hold error messages that might * be returned by PQrequestCancel(). *------------------------ */ #define INITIAL_EXPBUFFER_SIZE 256 /*------------------------ * There are two ways to create a PQExpBuffer object initially: * * PQExpBuffer stringptr = createPQExpBuffer(); * Both the PQExpBufferData and the data buffer are malloc'd. * * PQExpBufferData string; * initPQExpBuffer(&string); * The data buffer is malloc'd but the PQExpBufferData is presupplied. * This is appropriate if the PQExpBufferData is a field of another * struct. *------------------------- */ /*------------------------ * createPQExpBuffer * Create an empty 'PQExpBufferData' & return a pointer to it. */ extern PQExpBuffer createPQExpBuffer(void); /*------------------------ * initPQExpBuffer * Initialize a PQExpBufferData struct (with previously undefined contents) * to describe an empty string. */ extern void initPQExpBuffer(PQExpBuffer str); /*------------------------ * To destroy a PQExpBuffer, use either: * * destroyPQExpBuffer(str); * free()s both the data buffer and the PQExpBufferData. * This is the inverse of createPQExpBuffer(). * * termPQExpBuffer(str) * free()s the data buffer but not the PQExpBufferData itself. * This is the inverse of initPQExpBuffer(). * * NOTE: some routines build up a string using PQExpBuffer, and then * release the PQExpBufferData but return the data string itself to their * caller. At that point the data string looks like a plain malloc'd * string. */ extern void destroyPQExpBuffer(PQExpBuffer str); extern void termPQExpBuffer(PQExpBuffer str); /*------------------------ * resetPQExpBuffer * Reset a PQExpBuffer to empty * * Note: if possible, a "broken" PQExpBuffer is returned to normal. */ extern void resetPQExpBuffer(PQExpBuffer str); /*------------------------ * enlargePQExpBuffer * Make sure there is enough space for 'needed' more bytes in the buffer * ('needed' does not include the terminating null). * * Returns 1 if OK, 0 if failed to enlarge buffer. (In the latter case * the buffer is left in "broken" state.) */ extern int enlargePQExpBuffer(PQExpBuffer str, size_t needed); /*------------------------ * printfPQExpBuffer * Format text data under the control of fmt (an sprintf-like format string) * and insert it into str. More space is allocated to str if necessary. * This is a convenience routine that does the same thing as * resetPQExpBuffer() followed by appendPQExpBuffer(). */ extern void printfPQExpBuffer(PQExpBuffer str, const char *fmt,...) /* This extension allows gcc to check the format string */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3))); /*------------------------ * appendPQExpBuffer * Format text data under the control of fmt (an sprintf-like format string) * and append it to whatever is already in str. More space is allocated * to str if necessary. This is sort of like a combination of sprintf and * strcat. */ extern void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...) /* This extension allows gcc to check the format string */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3))); /*------------------------ * appendPQExpBufferStr * Append the given string to a PQExpBuffer, allocating more space * if necessary. */ extern void appendPQExpBufferStr(PQExpBuffer str, const char *data); /*------------------------ * appendPQExpBufferChar * Append a single byte to str. * Like appendPQExpBuffer(str, "%c", ch) but much faster. */ extern void appendPQExpBufferChar(PQExpBuffer str, char ch); /*------------------------ * appendBinaryPQExpBuffer * Append arbitrary binary data to a PQExpBuffer, allocating more space * if necessary. */ extern void appendBinaryPQExpBuffer(PQExpBuffer str, const char *data, size_t datalen); #endif /* PQEXPBUFFER_H */ �����������������������������������������������������������������������������������������������������������������������������pgsql/internal/c.h����������������������������������������������������������������������������������0000644�����������������00000062501�14763166026�0010120 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * c.h * Fundamental C definitions. This is included by every .c file in * PostgreSQL (via either postgres.h or postgres_fe.h, as appropriate). * * Note that the definitions here are not intended to be exposed to clients * of the frontend interface libraries --- so we don't worry much about * polluting the namespace with lots of stuff... * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/c.h * *------------------------------------------------------------------------- */ /* *---------------------------------------------------------------- * TABLE OF CONTENTS * * When adding stuff to this file, please try to put stuff * into the relevant section, or add new sections as appropriate. * * section description * ------- ------------------------------------------------ * 0) pg_config.h and standard system headers * 1) hacks to cope with non-ANSI C compilers * 2) bool, true, false, TRUE, FALSE, NULL * 3) standard system types * 4) IsValid macros for system types * 5) offsetof, lengthof, endof, alignment * 6) widely useful macros * 7) random stuff * 8) system-specific hacks * * NOTE: since this file is included by both frontend and backend modules, it's * almost certainly wrong to put an "extern" declaration here. typedefs and * macros are the kind of thing that might go here. * *---------------------------------------------------------------- */ #ifndef C_H #define C_H /* * We have to include stdlib.h here because it defines many of these macros * on some platforms, and we only want our definitions used if stdlib.h doesn't * have its own. The same goes for stddef and stdarg if present. */ #include "pg_config.h" #include "pg_config_manual.h" /* must be after pg_config.h */ #if !defined(WIN32) && !defined(__CYGWIN__) /* win32 will include further * down */ #include "pg_config_os.h" /* must be before any system header files */ #endif #include "postgres_ext.h" #if _MSC_VER >= 1400 || defined(HAVE_CRTDEFS_H) #define errcode __msvc_errcode #include <crtdefs.h> #undef errcode #endif #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stddef.h> #include <stdarg.h> #ifdef HAVE_STRINGS_H #include <strings.h> #endif #ifdef HAVE_STDINT_H #include <stdint.h> #endif #include <sys/types.h> #include <errno.h> #if defined(WIN32) || defined(__CYGWIN__) #include <fcntl.h> /* ensure O_BINARY is available */ #endif #if defined(WIN32) || defined(__CYGWIN__) /* We have to redefine some system functions after they are included above. */ #include "pg_config_os.h" #endif /* Must be before gettext() games below */ #include <locale.h> #define _(x) gettext(x) #ifdef ENABLE_NLS #include <libintl.h> #else #define gettext(x) (x) #define dgettext(d,x) (x) #define ngettext(s,p,n) ((n) == 1 ? (s) : (p)) #define dngettext(d,s,p,n) ((n) == 1 ? (s) : (p)) #endif /* * Use this to mark string constants as needing translation at some later * time, rather than immediately. This is useful for cases where you need * access to the original string and translated string, and for cases where * immediate translation is not possible, like when initializing global * variables. * http://www.gnu.org/software/autoconf/manual/gettext/Special-cases.html */ #define gettext_noop(x) (x) /* ---------------------------------------------------------------- * Section 1: hacks to cope with non-ANSI C compilers * * type prefixes (const, signed, volatile, inline) are handled in pg_config.h. * ---------------------------------------------------------------- */ /* * Hints to the compiler about the likelihood of a branch. Both likely() and * unlikely() return the boolean value of the contained expression. * * These should only be used sparingly, in very hot code paths. It's very easy * to mis-estimate likelihoods. */ #if __GNUC__ >= 3 #define likely(x) __builtin_expect((x) != 0, 1) #define unlikely(x) __builtin_expect((x) != 0, 0) #else #define likely(x) ((x) != 0) #define unlikely(x) ((x) != 0) #endif /* * CppAsString * Convert the argument to a string, using the C preprocessor. * CppConcat * Concatenate two arguments together, using the C preprocessor. * * Note: the standard Autoconf macro AC_C_STRINGIZE actually only checks * whether #identifier works, but if we have that we likely have ## too. */ #if defined(HAVE_STRINGIZE) #define CppAsString(identifier) #identifier #define CppConcat(x, y) x##y #else /* !HAVE_STRINGIZE */ #define CppAsString(identifier) "identifier" /* * CppIdentity -- On Reiser based cpp's this is used to concatenate * two tokens. That is * CppIdentity(A)B ==> AB * We renamed it to _private_CppIdentity because it should not * be referenced outside this file. On other cpp's it * produces A B. */ #define _priv_CppIdentity(x)x #define CppConcat(x, y) _priv_CppIdentity(x)y #endif /* !HAVE_STRINGIZE */ /* * dummyret is used to set return values in macros that use ?: to make * assignments. gcc wants these to be void, other compilers like char */ #ifdef __GNUC__ /* GNU cc */ #define dummyret void #else #define dummyret char #endif #ifndef __GNUC__ #define __attribute__(_arg_) #endif /* ---------------------------------------------------------------- * Section 2: bool, true, false, TRUE, FALSE, NULL * ---------------------------------------------------------------- */ /* * bool * Boolean value, either true or false. * * XXX for C++ compilers, we assume the compiler has a compatible * built-in definition of bool. */ #ifndef __cplusplus #ifndef bool typedef char bool; #endif #ifndef true #define true ((bool) 1) #endif #ifndef false #define false ((bool) 0) #endif #endif /* not C++ */ typedef bool *BoolPtr; #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif /* * NULL * Null pointer. */ #ifndef NULL #define NULL ((void *) 0) #endif /* ---------------------------------------------------------------- * Section 3: standard system types * ---------------------------------------------------------------- */ /* * stdint.h limits aren't guaranteed to be present and aren't guaranteed to * have compatible types with our fixed width types. So just define our own. */ #define PG_INT8_MIN (-0x7F-1) #define PG_INT8_MAX (0x7F) #define PG_UINT8_MAX (0xFF) #define PG_INT16_MIN (-0x7FFF-1) #define PG_INT16_MAX (0x7FFF) #define PG_UINT16_MAX (0xFFFF) #define PG_INT32_MIN (-0x7FFFFFFF-1) #define PG_INT32_MAX (0x7FFFFFFF) #define PG_UINT32_MAX (0xFFFFFFFFU) #define PG_INT64_MIN (-INT64CONST(0x7FFFFFFFFFFFFFFF) - 1) #define PG_INT64_MAX INT64CONST(0x7FFFFFFFFFFFFFFF) #define PG_UINT64_MAX UINT64CONST(0xFFFFFFFFFFFFFFFF) /* * Pointer * Variable holding address of any memory resident object. * * XXX Pointer arithmetic is done with this, so it can't be void * * under "true" ANSI compilers. */ typedef char *Pointer; /* * intN * Signed integer, EXACTLY N BITS IN SIZE, * used for numerical computations and the * frontend/backend protocol. */ #ifndef HAVE_INT8 typedef signed char int8; /* == 8 bits */ typedef signed short int16; /* == 16 bits */ typedef signed int int32; /* == 32 bits */ #endif /* not HAVE_INT8 */ /* * uintN * Unsigned integer, EXACTLY N BITS IN SIZE, * used for numerical computations and the * frontend/backend protocol. */ #ifndef HAVE_UINT8 typedef unsigned char uint8; /* == 8 bits */ typedef unsigned short uint16; /* == 16 bits */ typedef unsigned int uint32; /* == 32 bits */ #endif /* not HAVE_UINT8 */ /* * bitsN * Unit of bitwise operation, AT LEAST N BITS IN SIZE. */ typedef uint8 bits8; /* >= 8 bits */ typedef uint16 bits16; /* >= 16 bits */ typedef uint32 bits32; /* >= 32 bits */ /* * 64-bit integers */ #ifdef HAVE_LONG_INT_64 /* Plain "long int" fits, use it */ #ifndef HAVE_INT64 typedef long int int64; #endif #ifndef HAVE_UINT64 typedef unsigned long int uint64; #endif #define INT64CONST(x) (x##L) #define UINT64CONST(x) (x##UL) #elif defined(HAVE_LONG_LONG_INT_64) /* We have working support for "long long int", use that */ #ifndef HAVE_INT64 typedef long long int int64; #endif #ifndef HAVE_UINT64 typedef unsigned long long int uint64; #endif #define INT64CONST(x) (x##LL) #define UINT64CONST(x) (x##ULL) #else /* neither HAVE_LONG_INT_64 nor HAVE_LONG_LONG_INT_64 */ #error must have a working 64-bit integer datatype #endif /* Max value of size_t might be missing if we don't have stdint.h */ #ifndef SIZE_MAX #if SIZEOF_SIZE_T == 8 #define SIZE_MAX UINT64CONST(0xFFFFFFFFFFFFFFFF) #else #define SIZE_MAX (0xFFFFFFFFU) #endif #endif /* Select timestamp representation (float8 or int64) */ #ifdef USE_INTEGER_DATETIMES #define HAVE_INT64_TIMESTAMP #endif /* sig_atomic_t is required by ANSI C, but may be missing on old platforms */ #ifndef HAVE_SIG_ATOMIC_T typedef int sig_atomic_t; #endif /* * Size * Size of any memory resident object, as returned by sizeof. */ typedef size_t Size; /* * Index * Index into any memory resident array. * * Note: * Indices are non negative. */ typedef unsigned int Index; /* * Offset * Offset into any memory resident array. * * Note: * This differs from an Index in that an Index is always * non negative, whereas Offset may be negative. */ typedef signed int Offset; /* * Common Postgres datatype names (as used in the catalogs) */ typedef int16 int2; typedef int32 int4; typedef float float4; typedef double float8; /* * Oid, RegProcedure, TransactionId, SubTransactionId, MultiXactId, * CommandId */ /* typedef Oid is in postgres_ext.h */ /* * regproc is the type name used in the include/catalog headers, but * RegProcedure is the preferred name in C code. */ typedef Oid regproc; typedef regproc RegProcedure; typedef uint32 TransactionId; typedef uint32 LocalTransactionId; typedef uint32 SubTransactionId; #define InvalidSubTransactionId ((SubTransactionId) 0) #define TopSubTransactionId ((SubTransactionId) 1) /* MultiXactId must be equivalent to TransactionId, to fit in t_xmax */ typedef TransactionId MultiXactId; typedef uint32 MultiXactOffset; typedef uint32 CommandId; #define FirstCommandId ((CommandId) 0) /* * Array indexing support */ #define MAXDIM 6 typedef struct { int indx[MAXDIM]; } IntArray; /* ---------------- * Variable-length datatypes all share the 'struct varlena' header. * * NOTE: for TOASTable types, this is an oversimplification, since the value * may be compressed or moved out-of-line. However datatype-specific routines * are mostly content to deal with de-TOASTed values only, and of course * client-side routines should never see a TOASTed value. But even in a * de-TOASTed value, beware of touching vl_len_ directly, as its representation * is no longer convenient. It's recommended that code always use the VARDATA, * VARSIZE, and SET_VARSIZE macros instead of relying on direct mentions of * the struct fields. See postgres.h for details of the TOASTed form. * ---------------- */ struct varlena { char vl_len_[4]; /* Do not touch this field directly! */ char vl_dat[1]; }; #define VARHDRSZ ((int32) sizeof(int32)) /* * These widely-used datatypes are just a varlena header and the data bytes. * There is no terminating null or anything like that --- the data length is * always VARSIZE(ptr) - VARHDRSZ. */ typedef struct varlena bytea; typedef struct varlena text; typedef struct varlena BpChar; /* blank-padded char, ie SQL char(n) */ typedef struct varlena VarChar; /* var-length char, ie SQL varchar(n) */ /* * Specialized array types. These are physically laid out just the same * as regular arrays (so that the regular array subscripting code works * with them). They exist as distinct types mostly for historical reasons: * they have nonstandard I/O behavior which we don't want to change for fear * of breaking applications that look at the system catalogs. There is also * an implementation issue for oidvector: it's part of the primary key for * pg_proc, and we can't use the normal btree array support routines for that * without circularity. */ typedef struct { int32 vl_len_; /* these fields must match ArrayType! */ int ndim; /* always 1 for int2vector */ int32 dataoffset; /* always 0 for int2vector */ Oid elemtype; int dim1; int lbound1; int2 values[1]; /* VARIABLE LENGTH ARRAY */ } int2vector; /* VARIABLE LENGTH STRUCT */ typedef struct { int32 vl_len_; /* these fields must match ArrayType! */ int ndim; /* always 1 for oidvector */ int32 dataoffset; /* always 0 for oidvector */ Oid elemtype; int dim1; int lbound1; Oid values[1]; /* VARIABLE LENGTH ARRAY */ } oidvector; /* VARIABLE LENGTH STRUCT */ /* * Representation of a Name: effectively just a C string, but null-padded to * exactly NAMEDATALEN bytes. The use of a struct is historical. */ typedef struct nameData { char data[NAMEDATALEN]; } NameData; typedef NameData *Name; #define NameStr(name) ((name).data) /* * Support macros for escaping strings. escape_backslash should be TRUE * if generating a non-standard-conforming string. Prefixing a string * with ESCAPE_STRING_SYNTAX guarantees it is non-standard-conforming. * Beware of multiple evaluation of the "ch" argument! */ #define SQL_STR_DOUBLE(ch, escape_backslash) \ ((ch) == '\'' || ((ch) == '\\' && (escape_backslash))) #define ESCAPE_STRING_SYNTAX 'E' /* ---------------------------------------------------------------- * Section 4: IsValid macros for system types * ---------------------------------------------------------------- */ /* * BoolIsValid * True iff bool is valid. */ #define BoolIsValid(boolean) ((boolean) == false || (boolean) == true) /* * PointerIsValid * True iff pointer is valid. */ #define PointerIsValid(pointer) ((const void*)(pointer) != NULL) /* * PointerIsAligned * True iff pointer is properly aligned to point to the given type. */ #define PointerIsAligned(pointer, type) \ (((intptr_t)(pointer) % (sizeof (type))) == 0) #define OidIsValid(objectId) ((bool) ((objectId) != InvalidOid)) #define RegProcedureIsValid(p) OidIsValid(p) /* ---------------------------------------------------------------- * Section 5: offsetof, lengthof, endof, alignment * ---------------------------------------------------------------- */ /* * offsetof * Offset of a structure/union field within that structure/union. * * XXX This is supposed to be part of stddef.h, but isn't on * some systems (like SunOS 4). */ #ifndef offsetof #define offsetof(type, field) ((long) &((type *)0)->field) #endif /* offsetof */ /* * lengthof * Number of elements in an array. */ #define lengthof(array) (sizeof (array) / sizeof ((array)[0])) /* * endof * Address of the element one past the last in an array. */ #define endof(array) (&(array)[lengthof(array)]) /* ---------------- * Alignment macros: align a length or address appropriately for a given type. * The fooALIGN() macros round up to a multiple of the required alignment, * while the fooALIGN_DOWN() macros round down. The latter are more useful * for problems like "how many X-sized structures will fit in a page?". * * NOTE: TYPEALIGN[_DOWN] will not work if ALIGNVAL is not a power of 2. * That case seems extremely unlikely to be needed in practice, however. * ---------------- */ #define TYPEALIGN(ALIGNVAL,LEN) \ (((intptr_t) (LEN) + ((ALIGNVAL) - 1)) & ~((intptr_t) ((ALIGNVAL) - 1))) #define SHORTALIGN(LEN) TYPEALIGN(ALIGNOF_SHORT, (LEN)) #define INTALIGN(LEN) TYPEALIGN(ALIGNOF_INT, (LEN)) #define LONGALIGN(LEN) TYPEALIGN(ALIGNOF_LONG, (LEN)) #define DOUBLEALIGN(LEN) TYPEALIGN(ALIGNOF_DOUBLE, (LEN)) #define MAXALIGN(LEN) TYPEALIGN(MAXIMUM_ALIGNOF, (LEN)) /* MAXALIGN covers only built-in types, not buffers */ #define BUFFERALIGN(LEN) TYPEALIGN(ALIGNOF_BUFFER, (LEN)) #define TYPEALIGN_DOWN(ALIGNVAL,LEN) \ (((intptr_t) (LEN)) & ~((intptr_t) ((ALIGNVAL) - 1))) #define SHORTALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_SHORT, (LEN)) #define INTALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_INT, (LEN)) #define LONGALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_LONG, (LEN)) #define DOUBLEALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_DOUBLE, (LEN)) #define MAXALIGN_DOWN(LEN) TYPEALIGN_DOWN(MAXIMUM_ALIGNOF, (LEN)) /* ---------------------------------------------------------------- * Section 6: widely useful macros * ---------------------------------------------------------------- */ /* * Max * Return the maximum of two numbers. */ #define Max(x, y) ((x) > (y) ? (x) : (y)) /* * Min * Return the minimum of two numbers. */ #define Min(x, y) ((x) < (y) ? (x) : (y)) /* * Abs * Return the absolute value of the argument. */ #define Abs(x) ((x) >= 0 ? (x) : -(x)) /* * StrNCpy * Like standard library function strncpy(), except that result string * is guaranteed to be null-terminated --- that is, at most N-1 bytes * of the source string will be kept. * Also, the macro returns no result (too hard to do that without * evaluating the arguments multiple times, which seems worse). * * BTW: when you need to copy a non-null-terminated string (like a text * datum) and add a null, do not do it with StrNCpy(..., len+1). That * might seem to work, but it fetches one byte more than there is in the * text object. One fine day you'll have a SIGSEGV because there isn't * another byte before the end of memory. Don't laugh, we've had real * live bug reports from real live users over exactly this mistake. * Do it honestly with "memcpy(dst,src,len); dst[len] = '\0';", instead. */ #define StrNCpy(dst,src,len) \ do \ { \ char * _dst = (dst); \ Size _len = (len); \ \ if (_len > 0) \ { \ strncpy(_dst, (src), _len); \ _dst[_len-1] = '\0'; \ } \ } while (0) /* Get a bit mask of the bits set in non-long aligned addresses */ #define LONG_ALIGN_MASK (sizeof(long) - 1) /* * MemSet * Exactly the same as standard library function memset(), but considerably * faster for zeroing small word-aligned structures (such as parsetree nodes). * This has to be a macro because the main point is to avoid function-call * overhead. However, we have also found that the loop is faster than * native libc memset() on some platforms, even those with assembler * memset() functions. More research needs to be done, perhaps with * MEMSET_LOOP_LIMIT tests in configure. */ #define MemSet(start, val, len) \ do \ { \ /* must be void* because we don't know if it is integer aligned yet */ \ void *_vstart = (void *) (start); \ int _val = (val); \ Size _len = (len); \ \ if ((((intptr_t) _vstart) & LONG_ALIGN_MASK) == 0 && \ (_len & LONG_ALIGN_MASK) == 0 && \ _val == 0 && \ _len <= MEMSET_LOOP_LIMIT && \ /* \ * If MEMSET_LOOP_LIMIT == 0, optimizer should find \ * the whole "if" false at compile time. \ */ \ MEMSET_LOOP_LIMIT != 0) \ { \ long *_start = (long *) _vstart; \ long *_stop = (long *) ((char *) _start + _len); \ while (_start < _stop) \ *_start++ = 0; \ } \ else \ memset(_vstart, _val, _len); \ } while (0) /* * MemSetAligned is the same as MemSet except it omits the test to see if * "start" is word-aligned. This is okay to use if the caller knows a-priori * that the pointer is suitably aligned (typically, because he just got it * from palloc(), which always delivers a max-aligned pointer). */ #define MemSetAligned(start, val, len) \ do \ { \ long *_start = (long *) (start); \ int _val = (val); \ Size _len = (len); \ \ if ((_len & LONG_ALIGN_MASK) == 0 && \ _val == 0 && \ _len <= MEMSET_LOOP_LIMIT && \ MEMSET_LOOP_LIMIT != 0) \ { \ long *_stop = (long *) ((char *) _start + _len); \ while (_start < _stop) \ *_start++ = 0; \ } \ else \ memset(_start, _val, _len); \ } while (0) /* * MemSetTest/MemSetLoop are a variant version that allow all the tests in * MemSet to be done at compile time in cases where "val" and "len" are * constants *and* we know the "start" pointer must be word-aligned. * If MemSetTest succeeds, then it is okay to use MemSetLoop, otherwise use * MemSetAligned. Beware of multiple evaluations of the arguments when using * this approach. */ #define MemSetTest(val, len) \ ( ((len) & LONG_ALIGN_MASK) == 0 && \ (len) <= MEMSET_LOOP_LIMIT && \ MEMSET_LOOP_LIMIT != 0 && \ (val) == 0 ) #define MemSetLoop(start, val, len) \ do \ { \ long * _start = (long *) (start); \ long * _stop = (long *) ((char *) _start + (Size) (len)); \ \ while (_start < _stop) \ *_start++ = 0; \ } while (0) /* ---------------------------------------------------------------- * Section 7: random stuff * ---------------------------------------------------------------- */ /* msb for char */ #define HIGHBIT (0x80) #define IS_HIGHBIT_SET(ch) ((unsigned char)(ch) & HIGHBIT) #define STATUS_OK (0) #define STATUS_ERROR (-1) #define STATUS_EOF (-2) #define STATUS_FOUND (1) #define STATUS_WAITING (2) /* * Append PG_USED_FOR_ASSERTS_ONLY to definitions of variables that are only * used in assert-enabled builds, to avoid compiler warnings about unused * variables in assert-disabled builds. */ #ifdef USE_ASSERT_CHECKING #define PG_USED_FOR_ASSERTS_ONLY #else #define PG_USED_FOR_ASSERTS_ONLY __attribute__((unused)) #endif /* gettext domain name mangling */ /* * To better support parallel installations of major PostgreSQL * versions as well as parallel installations of major library soname * versions, we mangle the gettext domain name by appending those * version numbers. The coding rule ought to be that whereever the * domain name is mentioned as a literal, it must be wrapped into * PG_TEXTDOMAIN(). The macros below do not work on non-literals; but * that is somewhat intentional because it avoids having to worry * about multiple states of premangling and postmangling as the values * are being passed around. * * Make sure this matches the installation rules in nls-global.mk. */ /* need a second indirection because we want to stringize the macro value, not the name */ #define CppAsString2(x) CppAsString(x) #ifdef SO_MAJOR_VERSION #define PG_TEXTDOMAIN(domain) (domain CppAsString2(SO_MAJOR_VERSION) "-" PG_MAJORVERSION) #else #define PG_TEXTDOMAIN(domain) (domain "-" PG_MAJORVERSION) #endif /* ---------------------------------------------------------------- * Section 8: system-specific hacks * * This should be limited to things that absolutely have to be * included in every source file. The port-specific header file * is usually a better place for this sort of thing. * ---------------------------------------------------------------- */ /* * NOTE: this is also used for opening text files. * WIN32 treats Control-Z as EOF in files opened in text mode. * Therefore, we open files in binary mode on Win32 so we can read * literal control-Z. The other affect is that we see CRLF, but * that is OK because we can already handle those cleanly. */ #if defined(WIN32) || defined(__CYGWIN__) #define PG_BINARY O_BINARY #define PG_BINARY_A "ab" #define PG_BINARY_R "rb" #define PG_BINARY_W "wb" #else #define PG_BINARY 0 #define PG_BINARY_A "a" #define PG_BINARY_R "r" #define PG_BINARY_W "w" #endif /* * Provide prototypes for routines not present in a particular machine's * standard C library. */ #if !HAVE_DECL_SNPRINTF extern int snprintf(char *str, size_t count, const char *fmt,...) /* This extension allows gcc to check the format string */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 4))); #endif #if !HAVE_DECL_VSNPRINTF extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args); #endif #if !defined(HAVE_MEMMOVE) && !defined(memmove) #define memmove(d, s, c) bcopy(s, d, c) #endif /* no special DLL markers on most ports */ #ifndef PGDLLIMPORT #define PGDLLIMPORT #endif #ifndef PGDLLEXPORT #define PGDLLEXPORT #endif /* * The following is used as the arg list for signal handlers. Any ports * that take something other than an int argument should override this in * their pg_config_os.h file. Note that variable names are required * because it is used in both the prototypes as well as the definitions. * Note also the long name. We expect that this won't collide with * other names causing compiler warnings. */ #ifndef SIGNAL_ARGS #define SIGNAL_ARGS int postgres_signal_arg #endif /* * When there is no sigsetjmp, its functionality is provided by plain * setjmp. Incidentally, nothing provides setjmp's functionality in * that case. */ #ifndef HAVE_SIGSETJMP #define sigjmp_buf jmp_buf #define sigsetjmp(x,y) setjmp(x) #define siglongjmp longjmp #endif #if defined(HAVE_FDATASYNC) && !HAVE_DECL_FDATASYNC extern int fdatasync(int fildes); #endif /* If strtoq() exists, rename it to the more standard strtoll() */ #if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOLL) && defined(HAVE_STRTOQ) #define strtoll strtoq #define HAVE_STRTOLL 1 #endif /* If strtouq() exists, rename it to the more standard strtoull() */ #if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOULL) && defined(HAVE_STRTOUQ) #define strtoull strtouq #define HAVE_STRTOULL 1 #endif /* * We assume if we have these two functions, we have their friends too, and * can use the wide-character functions. */ #if defined(HAVE_WCSTOMBS) && defined(HAVE_TOWLOWER) #define USE_WIDE_UPPER_LOWER #endif /* EXEC_BACKEND defines */ #ifdef EXEC_BACKEND #define NON_EXEC_STATIC #else #define NON_EXEC_STATIC static #endif /* /port compatibility functions */ #include "port.h" #endif /* C_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/internal/postgres_fe.h������������������������������������������������������������������������0000644�����������������00000001332�14763166026�0012211 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * postgres_fe.h * Primary include file for PostgreSQL client-side .c files * * This should be the first file included by PostgreSQL client libraries and * application programs --- but not by backend modules, which should include * postgres.h. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1995, Regents of the University of California * * src/include/postgres_fe.h * *------------------------------------------------------------------------- */ #ifndef POSTGRES_FE_H #define POSTGRES_FE_H #ifndef FRONTEND #define FRONTEND 1 #endif #include "c.h" #endif /* POSTGRES_FE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/internal/libpq-int.h��������������������������������������������������������������������������0000644�����������������00000055036�14763166026�0011602 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * libpq-int.h * This file contains internal definitions meant to be used only by * the frontend libpq library, not by applications that call it. * * An application can include this file if it wants to bypass the * official API defined by libpq-fe.h, but code that does so is much * more likely to break across PostgreSQL releases than code that uses * only the official API. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/interfaces/libpq/libpq-int.h * *------------------------------------------------------------------------- */ #ifndef LIBPQ_INT_H #define LIBPQ_INT_H /* We assume libpq-fe.h has already been included. */ #include "postgres_fe.h" #include "libpq-events.h" #include <time.h> #include <sys/types.h> #ifndef WIN32 #include <sys/time.h> #endif #ifdef ENABLE_THREAD_SAFETY #ifdef WIN32 #include "pthread-win32.h" #else #include <pthread.h> #endif #include <signal.h> #endif /* include stuff common to fe and be */ #include "getaddrinfo.h" #include "libpq/pqcomm.h" /* include stuff found in fe only */ #include "pqexpbuffer.h" #ifdef ENABLE_GSS #if defined(HAVE_GSSAPI_H) #include <gssapi.h> #else #include <gssapi/gssapi.h> #endif #endif #ifdef ENABLE_SSPI #define SECURITY_WIN32 #if defined(WIN32) && !defined(WIN32_ONLY_COMPILER) #include <ntsecapi.h> #endif #include <security.h> #undef SECURITY_WIN32 #ifndef ENABLE_GSS /* * Define a fake structure compatible with GSSAPI on Unix. */ typedef struct { void *value; int length; } gss_buffer_desc; #endif #endif /* ENABLE_SSPI */ #ifdef USE_SSL #include <openssl/ssl.h> #include <openssl/err.h> #if (OPENSSL_VERSION_NUMBER >= 0x00907000L) && !defined(OPENSSL_NO_ENGINE) #define USE_SSL_ENGINE #endif #endif /* USE_SSL */ /* * POSTGRES backend dependent Constants. */ #define CMDSTATUS_LEN 64 /* should match COMPLETION_TAG_BUFSIZE */ /* * PGresult and the subsidiary types PGresAttDesc, PGresAttValue * represent the result of a query (or more precisely, of a single SQL * command --- a query string given to PQexec can contain multiple commands). * Note we assume that a single command can return at most one tuple group, * hence there is no need for multiple descriptor sets. */ /* Subsidiary-storage management structure for PGresult. * See space management routines in fe-exec.c for details. * Note that space[k] refers to the k'th byte starting from the physical * head of the block --- it's a union, not a struct! */ typedef union pgresult_data PGresult_data; union pgresult_data { PGresult_data *next; /* link to next block, or NULL */ char space[1]; /* dummy for accessing block as bytes */ }; /* Data about a single parameter of a prepared statement */ typedef struct pgresParamDesc { Oid typid; /* type id */ } PGresParamDesc; /* * Data for a single attribute of a single tuple * * We use char* for Attribute values. * * The value pointer always points to a null-terminated area; we add a * null (zero) byte after whatever the backend sends us. This is only * particularly useful for text values ... with a binary value, the * value might have embedded nulls, so the application can't use C string * operators on it. But we add a null anyway for consistency. * Note that the value itself does not contain a length word. * * A NULL attribute is a special case in two ways: its len field is NULL_LEN * and its value field points to null_field in the owning PGresult. All the * NULL attributes in a query result point to the same place (there's no need * to store a null string separately for each one). */ #define NULL_LEN (-1) /* pg_result len for NULL value */ typedef struct pgresAttValue { int len; /* length in bytes of the value */ char *value; /* actual value, plus terminating zero byte */ } PGresAttValue; /* Typedef for message-field list entries */ typedef struct pgMessageField { struct pgMessageField *next; /* list link */ char code; /* field code */ char contents[1]; /* field value (VARIABLE LENGTH) */ } PGMessageField; /* Fields needed for notice handling */ typedef struct { PQnoticeReceiver noticeRec; /* notice message receiver */ void *noticeRecArg; PQnoticeProcessor noticeProc; /* notice message processor */ void *noticeProcArg; } PGNoticeHooks; typedef struct PGEvent { PGEventProc proc; /* the function to call on events */ char *name; /* used only for error messages */ void *passThrough; /* pointer supplied at registration time */ void *data; /* optional state (instance) data */ bool resultInitialized; /* T if RESULTCREATE/COPY succeeded */ } PGEvent; struct pg_result { int ntups; int numAttributes; PGresAttDesc *attDescs; PGresAttValue **tuples; /* each PGresTuple is an array of * PGresAttValue's */ int tupArrSize; /* allocated size of tuples array */ int numParameters; PGresParamDesc *paramDescs; ExecStatusType resultStatus; char cmdStatus[CMDSTATUS_LEN]; /* cmd status from the query */ int binary; /* binary tuple values if binary == 1, * otherwise text */ /* * These fields are copied from the originating PGconn, so that operations * on the PGresult don't have to reference the PGconn. */ PGNoticeHooks noticeHooks; PGEvent *events; int nEvents; int client_encoding; /* encoding id */ /* * Error information (all NULL if not an error result). errMsg is the * "overall" error message returned by PQresultErrorMessage. If we have * per-field info then it is stored in a linked list. */ char *errMsg; /* error message, or NULL if no error */ PGMessageField *errFields; /* message broken into fields */ /* All NULL attributes in the query result point to this null string */ char null_field[1]; /* * Space management information. Note that attDescs and error stuff, if * not null, point into allocated blocks. But tuples points to a * separately malloc'd block, so that we can realloc it. */ PGresult_data *curBlock; /* most recently allocated block */ int curOffset; /* start offset of free space in block */ int spaceLeft; /* number of free bytes remaining in block */ }; /* PGAsyncStatusType defines the state of the query-execution state machine */ typedef enum { PGASYNC_IDLE, /* nothing's happening, dude */ PGASYNC_BUSY, /* query in progress */ PGASYNC_READY, /* result ready for PQgetResult */ PGASYNC_COPY_IN, /* Copy In data transfer in progress */ PGASYNC_COPY_OUT, /* Copy Out data transfer in progress */ PGASYNC_COPY_BOTH /* Copy In/Out data transfer in progress */ } PGAsyncStatusType; /* PGQueryClass tracks which query protocol we are now executing */ typedef enum { PGQUERY_SIMPLE, /* simple Query protocol (PQexec) */ PGQUERY_EXTENDED, /* full Extended protocol (PQexecParams) */ PGQUERY_PREPARE, /* Parse only (PQprepare) */ PGQUERY_DESCRIBE /* Describe Statement or Portal */ } PGQueryClass; /* PGSetenvStatusType defines the state of the PQSetenv state machine */ /* (this is used only for 2.0-protocol connections) */ typedef enum { SETENV_STATE_CLIENT_ENCODING_SEND, /* About to send an Environment Option */ SETENV_STATE_CLIENT_ENCODING_WAIT, /* Waiting for above send to complete */ SETENV_STATE_OPTION_SEND, /* About to send an Environment Option */ SETENV_STATE_OPTION_WAIT, /* Waiting for above send to complete */ SETENV_STATE_QUERY1_SEND, /* About to send a status query */ SETENV_STATE_QUERY1_WAIT, /* Waiting for query to complete */ SETENV_STATE_QUERY2_SEND, /* About to send a status query */ SETENV_STATE_QUERY2_WAIT, /* Waiting for query to complete */ SETENV_STATE_IDLE } PGSetenvStatusType; /* Typedef for the EnvironmentOptions[] array */ typedef struct PQEnvironmentOption { const char *envName, /* name of an environment variable */ *pgName; /* name of corresponding SET variable */ } PQEnvironmentOption; /* Typedef for parameter-status list entries */ typedef struct pgParameterStatus { struct pgParameterStatus *next; /* list link */ char *name; /* parameter name */ char *value; /* parameter value */ /* Note: name and value are stored in same malloc block as struct is */ } pgParameterStatus; /* large-object-access data ... allocated only if large-object code is used. */ typedef struct pgLobjfuncs { Oid fn_lo_open; /* OID of backend function lo_open */ Oid fn_lo_close; /* OID of backend function lo_close */ Oid fn_lo_creat; /* OID of backend function lo_creat */ Oid fn_lo_create; /* OID of backend function lo_create */ Oid fn_lo_unlink; /* OID of backend function lo_unlink */ Oid fn_lo_lseek; /* OID of backend function lo_lseek */ Oid fn_lo_tell; /* OID of backend function lo_tell */ Oid fn_lo_truncate; /* OID of backend function lo_truncate */ Oid fn_lo_read; /* OID of backend function LOread */ Oid fn_lo_write; /* OID of backend function LOwrite */ } PGlobjfuncs; /* PGdataValue represents a data field value being passed to a row processor. * It could be either text or binary data; text data is not zero-terminated. * A SQL NULL is represented by len < 0; then value is still valid but there * are no data bytes there. */ typedef struct pgDataValue { int len; /* data length in bytes, or <0 if NULL */ const char *value; /* data value, without zero-termination */ } PGdataValue; /* * PGconn stores all the state data associated with a single connection * to a backend. */ struct pg_conn { /* Saved values of connection options */ char *pghost; /* the machine on which the server is running */ char *pghostaddr; /* the numeric IP address of the machine on * which the server is running. Takes * precedence over above. */ char *pgport; /* the server's communication port */ char *pgunixsocket; /* the Unix-domain socket that the server is * listening on; if NULL, uses a default * constructed from pgport */ char *pgtty; /* tty on which the backend messages is * displayed (OBSOLETE, NOT USED) */ char *connect_timeout; /* connection timeout (numeric string) */ char *client_encoding_initial; /* encoding to use */ char *pgoptions; /* options to start the backend with */ char *appname; /* application name */ char *fbappname; /* fallback application name */ char *dbName; /* database name */ char *replication; /* connect as the replication standby? */ char *pguser; /* Postgres username and password, if any */ char *pgpass; char *keepalives; /* use TCP keepalives? */ char *keepalives_idle; /* time between TCP keepalives */ char *keepalives_interval; /* time between TCP keepalive * retransmits */ char *keepalives_count; /* maximum number of TCP keepalive * retransmits */ char *sslmode; /* SSL mode (require,prefer,allow,disable) */ char *sslcompression; /* SSL compression (0 or 1) */ char *sslkey; /* client key filename */ char *sslcert; /* client certificate filename */ char *sslrootcert; /* root certificate filename */ char *sslcrl; /* certificate revocation list filename */ char *requirepeer; /* required peer credentials for local sockets */ #if defined(KRB5) || defined(ENABLE_GSS) || defined(ENABLE_SSPI) char *krbsrvname; /* Kerberos service name */ #endif /* Optional file to write trace info to */ FILE *Pfdebug; /* Callback procedures for notice message processing */ PGNoticeHooks noticeHooks; /* Event procs registered via PQregisterEventProc */ PGEvent *events; /* expandable array of event data */ int nEvents; /* number of active events */ int eventArraySize; /* allocated array size */ /* Status indicators */ ConnStatusType status; PGAsyncStatusType asyncStatus; PGTransactionStatusType xactStatus; /* never changes to ACTIVE */ PGQueryClass queryclass; char *last_query; /* last SQL command, or NULL if unknown */ char last_sqlstate[6]; /* last reported SQLSTATE */ bool options_valid; /* true if OK to attempt connection */ bool nonblocking; /* whether this connection is using nonblock * sending semantics */ bool singleRowMode; /* return current query result row-by-row? */ char copy_is_binary; /* 1 = copy binary, 0 = copy text */ int copy_already_done; /* # bytes already returned in COPY * OUT */ PGnotify *notifyHead; /* oldest unreported Notify msg */ PGnotify *notifyTail; /* newest unreported Notify msg */ /* Connection data */ /* See PQconnectPoll() for how we use 'int' and not 'pgsocket'. */ int sock; /* Unix FD for socket, -1 if not connected */ SockAddr laddr; /* Local address */ SockAddr raddr; /* Remote address */ ProtocolVersion pversion; /* FE/BE protocol version in use */ int sversion; /* server version, e.g. 70401 for 7.4.1 */ bool auth_req_received; /* true if any type of auth req * received */ bool password_needed; /* true if server demanded a password */ bool dot_pgpass_used; /* true if used .pgpass */ bool sigpipe_so; /* have we masked SIGPIPE via SO_NOSIGPIPE? */ bool sigpipe_flag; /* can we mask SIGPIPE via MSG_NOSIGNAL? */ /* Transient state needed while establishing connection */ bool try_next_addr; /* time to advance to next address? */ bool is_new_addr; /* need to (re)initialize for new address? */ struct addrinfo *addrlist; /* list of possible backend addresses */ struct addrinfo *addr_cur; /* the one currently being tried */ int addrlist_family; /* needed to know how to free addrlist */ PGSetenvStatusType setenv_state; /* for 2.0 protocol only */ const PQEnvironmentOption *next_eo; bool send_appname; /* okay to send application_name? */ /* Miscellaneous stuff */ int be_pid; /* PID of backend --- needed for cancels */ int be_key; /* key of backend --- needed for cancels */ char md5Salt[4]; /* password salt received from backend */ pgParameterStatus *pstatus; /* ParameterStatus data */ int client_encoding; /* encoding id */ bool std_strings; /* standard_conforming_strings */ PGVerbosity verbosity; /* error/notice message verbosity */ PGlobjfuncs *lobjfuncs; /* private state for large-object access fns */ /* Buffer for data received from backend and not yet processed */ char *inBuffer; /* currently allocated buffer */ int inBufSize; /* allocated size of buffer */ int inStart; /* offset to first unconsumed data in buffer */ int inCursor; /* next byte to tentatively consume */ int inEnd; /* offset to first position after avail data */ /* Buffer for data not yet sent to backend */ char *outBuffer; /* currently allocated buffer */ int outBufSize; /* allocated size of buffer */ int outCount; /* number of chars waiting in buffer */ /* State for constructing messages in outBuffer */ int outMsgStart; /* offset to msg start (length word); if -1, * msg has no length word */ int outMsgEnd; /* offset to msg end (so far) */ /* Row processor interface workspace */ PGdataValue *rowBuf; /* array for passing values to rowProcessor */ int rowBufLen; /* number of entries allocated in rowBuf */ /* Status for asynchronous result construction */ PGresult *result; /* result being constructed */ PGresult *next_result; /* next result (used in single-row mode) */ /* Assorted state for SSL, GSS, etc */ #ifdef USE_SSL bool allow_ssl_try; /* Allowed to try SSL negotiation */ bool wait_ssl_try; /* Delay SSL negotiation until after * attempting normal connection */ SSL *ssl; /* SSL status, if have SSL connection */ X509 *peer; /* X509 cert of server */ #ifdef USE_SSL_ENGINE ENGINE *engine; /* SSL engine, if any */ #else void *engine; /* dummy field to keep struct the same if * OpenSSL version changes */ #endif #endif /* USE_SSL */ #ifdef ENABLE_GSS gss_ctx_id_t gctx; /* GSS context */ gss_name_t gtarg_nam; /* GSS target name */ gss_buffer_desc ginbuf; /* GSS input token */ gss_buffer_desc goutbuf; /* GSS output token */ #endif #ifdef ENABLE_SSPI #ifndef ENABLE_GSS gss_buffer_desc ginbuf; /* GSS input token */ #else char *gsslib; /* What GSS librart to use ("gssapi" or * "sspi") */ #endif CredHandle *sspicred; /* SSPI credentials handle */ CtxtHandle *sspictx; /* SSPI context */ char *sspitarget; /* SSPI target name */ int usesspi; /* Indicate if SSPI is in use on the * connection */ #endif /* Buffer for current error message */ PQExpBufferData errorMessage; /* expansible string */ /* Buffer for receiving various parts of messages */ PQExpBufferData workBuffer; /* expansible string */ }; /* PGcancel stores all data necessary to cancel a connection. A copy of this * data is required to safely cancel a connection running on a different * thread. */ struct pg_cancel { SockAddr raddr; /* Remote address */ int be_pid; /* PID of backend --- needed for cancels */ int be_key; /* key of backend --- needed for cancels */ }; /* String descriptions of the ExecStatusTypes. * direct use of this array is deprecated; call PQresStatus() instead. */ extern char *const pgresStatus[]; /* ---------------- * Internal functions of libpq * Functions declared here need to be visible across files of libpq, * but are not intended to be called by applications. We use the * convention "pqXXX" for internal functions, vs. the "PQxxx" names * used for application-visible routines. * ---------------- */ /* === in fe-connect.c === */ extern void pqDropConnection(PGconn *conn, bool flushInput); extern int pqPacketSend(PGconn *conn, char pack_type, const void *buf, size_t buf_len); extern bool pqGetHomeDirectory(char *buf, int bufsize); #ifdef ENABLE_THREAD_SAFETY extern pgthreadlock_t pg_g_threadlock; #define PGTHREAD_ERROR(msg) \ do { \ fprintf(stderr, "%s\n", msg); \ abort(); \ } while (0) #define pglock_thread() pg_g_threadlock(true) #define pgunlock_thread() pg_g_threadlock(false) #else #define pglock_thread() ((void) 0) #define pgunlock_thread() ((void) 0) #endif /* === in fe-exec.c === */ extern void pqSetResultError(PGresult *res, const char *msg); extern void pqCatenateResultError(PGresult *res, const char *msg); extern void *pqResultAlloc(PGresult *res, size_t nBytes, bool isBinary); extern char *pqResultStrdup(PGresult *res, const char *str); extern void pqClearAsyncResult(PGconn *conn); extern void pqSaveErrorResult(PGconn *conn); extern PGresult *pqPrepareAsyncResult(PGconn *conn); extern void pqInternalNotice(const PGNoticeHooks *hooks, const char *fmt,...) /* This lets gcc check the format string for consistency. */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3))); extern void pqSaveMessageField(PGresult *res, char code, const char *value); extern void pqSaveParameterStatus(PGconn *conn, const char *name, const char *value); extern int pqRowProcessor(PGconn *conn, const char **errmsgp); extern void pqHandleSendFailure(PGconn *conn); /* === in fe-protocol2.c === */ extern PostgresPollingStatusType pqSetenvPoll(PGconn *conn); extern char *pqBuildStartupPacket2(PGconn *conn, int *packetlen, const PQEnvironmentOption *options); extern void pqParseInput2(PGconn *conn); extern int pqGetCopyData2(PGconn *conn, char **buffer, int async); extern int pqGetline2(PGconn *conn, char *s, int maxlen); extern int pqGetlineAsync2(PGconn *conn, char *buffer, int bufsize); extern int pqEndcopy2(PGconn *conn); extern PGresult *pqFunctionCall2(PGconn *conn, Oid fnid, int *result_buf, int *actual_result_len, int result_is_int, const PQArgBlock *args, int nargs); /* === in fe-protocol3.c === */ extern char *pqBuildStartupPacket3(PGconn *conn, int *packetlen, const PQEnvironmentOption *options); extern void pqParseInput3(PGconn *conn); extern int pqGetErrorNotice3(PGconn *conn, bool isError); extern int pqGetCopyData3(PGconn *conn, char **buffer, int async); extern int pqGetline3(PGconn *conn, char *s, int maxlen); extern int pqGetlineAsync3(PGconn *conn, char *buffer, int bufsize); extern int pqEndcopy3(PGconn *conn); extern PGresult *pqFunctionCall3(PGconn *conn, Oid fnid, int *result_buf, int *actual_result_len, int result_is_int, const PQArgBlock *args, int nargs); /* === in fe-misc.c === */ /* * "Get" and "Put" routines return 0 if successful, EOF if not. Note that for * Get, EOF merely means the buffer is exhausted, not that there is * necessarily any error. */ extern int pqCheckOutBufferSpace(size_t bytes_needed, PGconn *conn); extern int pqCheckInBufferSpace(size_t bytes_needed, PGconn *conn); extern int pqGetc(char *result, PGconn *conn); extern int pqPutc(char c, PGconn *conn); extern int pqGets(PQExpBuffer buf, PGconn *conn); extern int pqGets_append(PQExpBuffer buf, PGconn *conn); extern int pqPuts(const char *s, PGconn *conn); extern int pqGetnchar(char *s, size_t len, PGconn *conn); extern int pqSkipnchar(size_t len, PGconn *conn); extern int pqPutnchar(const char *s, size_t len, PGconn *conn); extern int pqGetInt(int *result, size_t bytes, PGconn *conn); extern int pqPutInt(int value, size_t bytes, PGconn *conn); extern int pqPutMsgStart(char msg_type, bool force_len, PGconn *conn); extern int pqPutMsgEnd(PGconn *conn); extern int pqReadData(PGconn *conn); extern int pqFlush(PGconn *conn); extern int pqWait(int forRead, int forWrite, PGconn *conn); extern int pqWaitTimed(int forRead, int forWrite, PGconn *conn, time_t finish_time); extern int pqReadReady(PGconn *conn); extern int pqWriteReady(PGconn *conn); /* === in fe-secure.c === */ extern int pqsecure_initialize(PGconn *); extern void pqsecure_destroy(void); extern PostgresPollingStatusType pqsecure_open_client(PGconn *); extern void pqsecure_close(PGconn *); extern ssize_t pqsecure_read(PGconn *, void *ptr, size_t len); extern ssize_t pqsecure_write(PGconn *, const void *ptr, size_t len); #if defined(ENABLE_THREAD_SAFETY) && !defined(WIN32) extern int pq_block_sigpipe(sigset_t *osigset, bool *sigpipe_pending); extern void pq_reset_sigpipe(sigset_t *osigset, bool sigpipe_pending, bool got_epipe); #endif /* * this is so that we can check if a connection is non-blocking internally * without the overhead of a function call */ #define pqIsnonblocking(conn) ((conn)->nonblocking) #ifdef ENABLE_NLS extern char * libpq_gettext(const char *msgid) __attribute__((format_arg(1))); #else #define libpq_gettext(x) (x) #endif /* * These macros are needed to let error-handling code be portable between * Unix and Windows. (ugh) */ #ifdef WIN32 #define SOCK_ERRNO (WSAGetLastError()) #define SOCK_STRERROR winsock_strerror #define SOCK_ERRNO_SET(e) WSASetLastError(e) #else #define SOCK_ERRNO errno #define SOCK_STRERROR pqStrerror #define SOCK_ERRNO_SET(e) (errno = (e)) #endif #endif /* LIBPQ_INT_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/internal/libpq/pqcomm.h�����������������������������������������������������������������������0000644�����������������00000014557�14763166026�0012311 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pqcomm.h * Definitions common to frontends and backends. * * NOTE: for historical reasons, this does not correspond to pqcomm.c. * pqcomm.c's routines are declared in libpq.h. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/libpq/pqcomm.h * *------------------------------------------------------------------------- */ #ifndef PQCOMM_H #define PQCOMM_H #include <sys/socket.h> #include <netdb.h> #ifdef HAVE_SYS_UN_H #include <sys/un.h> #endif #include <netinet/in.h> #ifdef HAVE_STRUCT_SOCKADDR_STORAGE #ifndef HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY #ifdef HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY #define ss_family __ss_family #else #error struct sockaddr_storage does not provide an ss_family member #endif #endif #ifdef HAVE_STRUCT_SOCKADDR_STORAGE___SS_LEN #define ss_len __ss_len #define HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN 1 #endif #else /* !HAVE_STRUCT_SOCKADDR_STORAGE */ /* Define a struct sockaddr_storage if we don't have one. */ struct sockaddr_storage { union { struct sockaddr sa; /* get the system-dependent fields */ int64 ss_align; /* ensures struct is properly aligned */ char ss_pad[128]; /* ensures struct has desired size */ } ss_stuff; }; #define ss_family ss_stuff.sa.sa_family /* It should have an ss_len field if sockaddr has sa_len. */ #ifdef HAVE_STRUCT_SOCKADDR_SA_LEN #define ss_len ss_stuff.sa.sa_len #define HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN 1 #endif #endif /* HAVE_STRUCT_SOCKADDR_STORAGE */ typedef struct { struct sockaddr_storage addr; ACCEPT_TYPE_ARG3 salen; } SockAddr; /* Configure the UNIX socket location for the well known port. */ #define UNIXSOCK_PATH(path, port, sockdir) \ snprintf(path, sizeof(path), "%s/.s.PGSQL.%d", \ ((sockdir) && *(sockdir) != '\0') ? (sockdir) : \ DEFAULT_PGSOCKET_DIR, \ (port)) /* * The maximum workable length of a socket path is what will fit into * struct sockaddr_un. This is usually only 100 or so bytes :-(. * * For consistency, always pass a MAXPGPATH-sized buffer to UNIXSOCK_PATH(), * then complain if the resulting string is >= UNIXSOCK_PATH_BUFLEN bytes. * (Because the standard API for getaddrinfo doesn't allow it to complain in * a useful way when the socket pathname is too long, we have to test for * this explicitly, instead of just letting the subroutine return an error.) */ #define UNIXSOCK_PATH_BUFLEN sizeof(((struct sockaddr_un *) NULL)->sun_path) /* * These manipulate the frontend/backend protocol version number. * * The major number should be incremented for incompatible changes. The minor * number should be incremented for compatible changes (eg. additional * functionality). * * If a backend supports version m.n of the protocol it must actually support * versions m.[0..n]. Backend support for version m-1 can be dropped after a * `reasonable' length of time. * * A frontend isn't required to support anything other than the current * version. */ #define PG_PROTOCOL_MAJOR(v) ((v) >> 16) #define PG_PROTOCOL_MINOR(v) ((v) & 0x0000ffff) #define PG_PROTOCOL(m,n) (((m) << 16) | (n)) /* The earliest and latest frontend/backend protocol version supported. */ #define PG_PROTOCOL_EARLIEST PG_PROTOCOL(1,0) #define PG_PROTOCOL_LATEST PG_PROTOCOL(3,0) typedef uint32 ProtocolVersion; /* FE/BE protocol version number */ typedef ProtocolVersion MsgType; /* * Packet lengths are 4 bytes in network byte order. * * The initial length is omitted from the packet layouts appearing below. */ typedef uint32 PacketLen; /* * Old-style startup packet layout with fixed-width fields. This is used in * protocol 1.0 and 2.0, but not in later versions. Note that the fields * in this layout are '\0' terminated only if there is room. */ #define SM_DATABASE 64 #define SM_USER 32 /* We append database name if db_user_namespace true. */ #define SM_DATABASE_USER (SM_DATABASE+SM_USER+1) /* +1 for @ */ #define SM_OPTIONS 64 #define SM_UNUSED 64 #define SM_TTY 64 typedef struct StartupPacket { ProtocolVersion protoVersion; /* Protocol version */ char database[SM_DATABASE]; /* Database name */ /* Db_user_namespace appends dbname */ char user[SM_USER]; /* User name */ char options[SM_OPTIONS]; /* Optional additional args */ char unused[SM_UNUSED]; /* Unused */ char tty[SM_TTY]; /* Tty for debug output */ } StartupPacket; extern bool Db_user_namespace; /* * In protocol 3.0 and later, the startup packet length is not fixed, but * we set an arbitrary limit on it anyway. This is just to prevent simple * denial-of-service attacks via sending enough data to run the server * out of memory. */ #define MAX_STARTUP_PACKET_LENGTH 10000 /* These are the authentication request codes sent by the backend. */ #define AUTH_REQ_OK 0 /* User is authenticated */ #define AUTH_REQ_KRB4 1 /* Kerberos V4. Not supported any more. */ #define AUTH_REQ_KRB5 2 /* Kerberos V5 */ #define AUTH_REQ_PASSWORD 3 /* Password */ #define AUTH_REQ_CRYPT 4 /* crypt password. Not supported any more. */ #define AUTH_REQ_MD5 5 /* md5 password */ #define AUTH_REQ_SCM_CREDS 6 /* transfer SCM credentials */ #define AUTH_REQ_GSS 7 /* GSSAPI without wrap() */ #define AUTH_REQ_GSS_CONT 8 /* Continue GSS exchanges */ #define AUTH_REQ_SSPI 9 /* SSPI negotiate without wrap() */ #define AUTH_REQ_SASL 10 /* SASL authentication. Not supported before * libpq version 10. */ typedef uint32 AuthRequest; /* * A client can also send a cancel-current-operation request to the postmaster. * This is uglier than sending it directly to the client's backend, but it * avoids depending on out-of-band communication facilities. * * The cancel request code must not match any protocol version number * we're ever likely to use. This random choice should do. */ #define CANCEL_REQUEST_CODE PG_PROTOCOL(1234,5678) typedef struct CancelRequestPacket { /* Note that each field is stored in network byte order! */ MsgType cancelRequestCode; /* code to identify a cancel request */ uint32 backendPID; /* PID of client's backend */ uint32 cancelAuthCode; /* secret key to authorize cancel */ } CancelRequestPacket; /* * A client can also start by sending a SSL negotiation request, to get a * secure channel. */ #define NEGOTIATE_SSL_CODE PG_PROTOCOL(1234,5679) #endif /* PQCOMM_H */ �������������������������������������������������������������������������������������������������������������������������������������������������pgsql/informix/esql/decimal.h�����������������������������������������������������������������������0000644�����������������00000000430�14763166026�0012250 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/interfaces/ecpg/include/decimal.h */ #ifndef _ECPG_DECIMAL_H #define _ECPG_DECIMAL_H #include <ecpg_informix.h> /* source created by ecpg which defines this */ #ifndef _ECPGLIB_H typedef decimal dec_t; #endif /* ndef _ECPGLIB_H */ #endif /* ndef _ECPG_DECIMAL_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/informix/esql/sqltypes.h����������������������������������������������������������������������0000644�����������������00000002633�14763166026�0012545 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef ECPG_SQLTYPES_H #define ECPG_SQLTYPES_H #include <limits.h> #define CCHARTYPE ECPGt_char #define CSHORTTYPE ECPGt_short #define CINTTYPE ECPGt_int #define CLONGTYPE ECPGt_long #define CFLOATTYPE ECPGt_float #define CDOUBLETYPE ECPGt_double #define CDECIMALTYPE ECPGt_decimal #define CFIXCHARTYPE 108 #define CSTRINGTYPE ECPGt_char #define CDATETYPE ECPGt_date #define CMONEYTYPE 111 #define CDTIMETYPE ECPGt_timestamp #define CLOCATORTYPE 113 #define CVCHARTYPE ECPGt_varchar #define CINVTYPE 115 #define CFILETYPE 116 #define CINT8TYPE ECPGt_long_long #define CCOLLTYPE 118 #define CLVCHARTYPE 119 #define CFIXBINTYPE 120 #define CVARBINTYPE 121 #define CBOOLTYPE ECPGt_bool #define CROWTYPE 123 #define CLVCHARPTRTYPE 124 #define CTYPEMAX 25 /* * Values used in sqlda->sqlvar[i]->sqltype */ #define SQLCHAR ECPGt_char #define SQLSMINT ECPGt_short #define SQLINT ECPGt_int #define SQLFLOAT ECPGt_double #define SQLSMFLOAT ECPGt_float #define SQLDECIMAL ECPGt_decimal #define SQLSERIAL ECPGt_int #define SQLDATE ECPGt_date #define SQLDTIME ECPGt_timestamp #define SQLTEXT ECPGt_char #define SQLVCHAR ECPGt_char #define SQLINTERVAL ECPGt_interval #define SQLNCHAR ECPGt_char #define SQLNVCHAR ECPGt_char #ifdef HAVE_LONG_LONG_INT_64 #define SQLINT8 ECPGt_long_long #define SQLSERIAL8 ECPGt_long_long #else #define SQLINT8 ECPGt_long #define SQLSERIAL8 ECPGt_long #endif #endif /* ndef ECPG_SQLTYPES_H */ �����������������������������������������������������������������������������������������������������pgsql/informix/esql/datetime.h����������������������������������������������������������������������0000644�����������������00000000504�14763166026�0012450 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/interfaces/ecpg/include/datetime.h */ #ifndef _ECPG_DATETIME_H #define _ECPG_DATETIME_H #include <ecpg_informix.h> /* source created by ecpg which defines these symbols */ #ifndef _ECPGLIB_H typedef timestamp dtime_t; typedef interval intrvl_t; #endif /* ndef _ECPGLIB_H */ #endif /* ndef _ECPG_DATETIME_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/pgtar.h��������������������������������������������������������������������������������0000644�����������������00000001252�14763166026�0010501 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pgtar.h * Functions for manipulating tarfile datastructures (src/port/tar.c) * * * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/pgtar.h * *------------------------------------------------------------------------- */ extern void tarCreateHeader(char *h, const char *filename, const char *linktarget, pgoff_t size, mode_t mode, uid_t uid, gid_t gid, time_t mtime, bool bogus); extern uint64 read_tar_number(const char *s, int len); extern int tarChecksum(char *header); ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port.h���������������������������������������������������������������������������������0000644�����������������00000033710�14763166026�0010354 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * port.h * Header for src/port/ compatibility functions. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/port.h * *------------------------------------------------------------------------- */ #ifndef PG_PORT_H #define PG_PORT_H #include <ctype.h> #include <netdb.h> #include <pwd.h> /* socket has a different definition on WIN32 */ #ifndef WIN32 typedef int pgsocket; #define PGINVALID_SOCKET (-1) #else typedef SOCKET pgsocket; #define PGINVALID_SOCKET INVALID_SOCKET #endif /* non-blocking */ extern bool pg_set_noblock(pgsocket sock); extern bool pg_set_block(pgsocket sock); /* Portable path handling for Unix/Win32 (in path.c) */ extern bool has_drive_prefix(const char *filename); extern char *first_dir_separator(const char *filename); extern char *last_dir_separator(const char *filename); extern char *first_path_var_separator(const char *pathlist); extern void join_path_components(char *ret_path, const char *head, const char *tail); extern void canonicalize_path(char *path); extern void make_native_path(char *path); extern bool path_contains_parent_reference(const char *path); extern bool path_is_relative_and_below_cwd(const char *path); extern bool path_is_prefix_of_path(const char *path1, const char *path2); extern const char *get_progname(const char *argv0); extern void get_share_path(const char *my_exec_path, char *ret_path); extern void get_etc_path(const char *my_exec_path, char *ret_path); extern void get_include_path(const char *my_exec_path, char *ret_path); extern void get_pkginclude_path(const char *my_exec_path, char *ret_path); extern void get_includeserver_path(const char *my_exec_path, char *ret_path); extern void get_lib_path(const char *my_exec_path, char *ret_path); extern void get_pkglib_path(const char *my_exec_path, char *ret_path); extern void get_locale_path(const char *my_exec_path, char *ret_path); extern void get_doc_path(const char *my_exec_path, char *ret_path); extern void get_html_path(const char *my_exec_path, char *ret_path); extern void get_man_path(const char *my_exec_path, char *ret_path); extern bool get_home_path(char *ret_path); extern void get_parent_directory(char *path); /* port/dirmod.c */ extern char **pgfnames(const char *path); extern void pgfnames_cleanup(char **filenames); /* * is_absolute_path * * By making this a macro we avoid needing to include path.c in libpq. */ #ifndef WIN32 #define IS_DIR_SEP(ch) ((ch) == '/') #define is_absolute_path(filename) \ ( \ IS_DIR_SEP((filename)[0]) \ ) #else #define IS_DIR_SEP(ch) ((ch) == '/' || (ch) == '\\') /* See path_is_relative_and_below_cwd() for how we handle 'E:abc'. */ #define is_absolute_path(filename) \ ( \ IS_DIR_SEP((filename)[0]) || \ (isalpha((unsigned char) ((filename)[0])) && (filename)[1] == ':' && \ IS_DIR_SEP((filename)[2])) \ ) #endif /* Portable locale initialization (in exec.c) */ extern void set_pglocale_pgservice(const char *argv0, const char *app); /* Portable way to find binaries (in exec.c) */ extern int find_my_exec(const char *argv0, char *retpath); extern int find_other_exec(const char *argv0, const char *target, const char *versionstr, char *retpath); /* Windows security token manipulation (in exec.c) */ #ifdef WIN32 extern BOOL AddUserToTokenDacl(HANDLE hToken); #endif #if defined(WIN32) || defined(__CYGWIN__) #define EXE ".exe" #else #define EXE "" #endif #if defined(WIN32) && !defined(__CYGWIN__) #define DEVNULL "nul" #else #define DEVNULL "/dev/null" #endif /* * Win32 needs double quotes at the beginning and end of system() * strings. If not, it gets confused with multiple quoted strings. * It also requires double-quotes around the executable name and * any files used for redirection. Other args can use single-quotes. * * Generated using Win32 "CMD /?": * * 1. If all of the following conditions are met, then quote characters * on the command line are preserved: * * - no /S switch * - exactly two quote characters * - no special characters between the two quote characters, where special * is one of: &<>()@^| * - there are one or more whitespace characters between the two quote * characters * - the string between the two quote characters is the name of an * executable file. * * 2. Otherwise, old behavior is to see if the first character is a quote * character and if so, strip the leading character and remove the last * quote character on the command line, preserving any text after the last * quote character. */ #if defined(WIN32) && !defined(__CYGWIN__) #define SYSTEMQUOTE "\"" #else #define SYSTEMQUOTE "" #endif /* Portable delay handling */ extern void pg_usleep(long microsec); /* Portable SQL-like case-independent comparisons and conversions */ extern int pg_strcasecmp(const char *s1, const char *s2); extern int pg_strncasecmp(const char *s1, const char *s2, size_t n); extern unsigned char pg_toupper(unsigned char ch); extern unsigned char pg_tolower(unsigned char ch); extern unsigned char pg_ascii_toupper(unsigned char ch); extern unsigned char pg_ascii_tolower(unsigned char ch); #ifdef USE_REPL_SNPRINTF /* * Versions of libintl >= 0.13 try to replace printf() and friends with * macros to their own versions that understand the %$ format. We do the * same, so disable their macros, if they exist. */ #ifdef vsnprintf #undef vsnprintf #endif #ifdef snprintf #undef snprintf #endif #ifdef sprintf #undef sprintf #endif #ifdef vfprintf #undef vfprintf #endif #ifdef fprintf #undef fprintf #endif #ifdef printf #undef printf #endif extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args); extern int pg_snprintf(char *str, size_t count, const char *fmt,...) /* This extension allows gcc to check the format string */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 4))); extern int pg_sprintf(char *str, const char *fmt,...) /* This extension allows gcc to check the format string */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3))); extern int pg_vfprintf(FILE *stream, const char *fmt, va_list args); extern int pg_fprintf(FILE *stream, const char *fmt,...) /* This extension allows gcc to check the format string */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3))); extern int pg_printf(const char *fmt,...) /* This extension allows gcc to check the format string */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2))); /* * The GCC-specific code below prevents the __attribute__(... 'printf') * above from being replaced, and this is required because gcc doesn't * know anything about pg_printf. */ #ifdef __GNUC__ #define vsnprintf(...) pg_vsnprintf(__VA_ARGS__) #define snprintf(...) pg_snprintf(__VA_ARGS__) #define sprintf(...) pg_sprintf(__VA_ARGS__) #define vfprintf(...) pg_vfprintf(__VA_ARGS__) #define fprintf(...) pg_fprintf(__VA_ARGS__) #define printf(...) pg_printf(__VA_ARGS__) #else #define vsnprintf pg_vsnprintf #define snprintf pg_snprintf #define sprintf pg_sprintf #define vfprintf pg_vfprintf #define fprintf pg_fprintf #define printf pg_printf #endif #endif /* USE_REPL_SNPRINTF */ #if defined(WIN32) /* * Versions of libintl >= 0.18? try to replace setlocale() with a macro * to their own versions. Remove the macro, if it exists, because it * ends up calling the wrong version when the backend and libintl use * different versions of msvcrt. */ #if defined(setlocale) #undef setlocale #endif /* * Define our own wrapper macro around setlocale() to work around bugs in * Windows' native setlocale() function. */ extern char *pgwin32_setlocale(int category, const char *locale); #define setlocale(a,b) pgwin32_setlocale(a,b) #endif /* WIN32 */ /* Portable prompt handling */ extern char *simple_prompt(const char *prompt, int maxlen, bool echo); #ifdef WIN32 #define PG_SIGNAL_COUNT 32 #define kill(pid,sig) pgkill(pid,sig) extern int pgkill(int pid, int sig); #endif extern int pclose_check(FILE *stream); /* Global variable holding time zone information. */ #ifndef __CYGWIN__ #define TIMEZONE_GLOBAL timezone #define TZNAME_GLOBAL tzname #else #define TIMEZONE_GLOBAL _timezone #define TZNAME_GLOBAL _tzname #endif #if defined(WIN32) || defined(__CYGWIN__) /* * Win32 doesn't have reliable rename/unlink during concurrent access. */ extern int pgrename(const char *from, const char *to); extern int pgunlink(const char *path); /* Include this first so later includes don't see these defines */ #ifdef WIN32_ONLY_COMPILER #include <io.h> #endif #define rename(from, to) pgrename(from, to) #define unlink(path) pgunlink(path) #endif /* defined(WIN32) || defined(__CYGWIN__) */ /* * Win32 also doesn't have symlinks, but we can emulate them with * junction points on newer Win32 versions. * * Cygwin has its own symlinks which work on Win95/98/ME where * junction points don't, so use those instead. We have no way of * knowing what type of system Cygwin binaries will be run on. * Note: Some CYGWIN includes might #define WIN32. */ #if defined(WIN32) && !defined(__CYGWIN__) extern int pgsymlink(const char *oldpath, const char *newpath); extern int pgreadlink(const char *path, char *buf, size_t size); extern bool pgwin32_is_junction(char *path); #define symlink(oldpath, newpath) pgsymlink(oldpath, newpath) #define readlink(path, buf, size) pgreadlink(path, buf, size) #endif extern bool rmtree(const char *path, bool rmtopdir); /* * stat() is not guaranteed to set the st_size field on win32, so we * redefine it to our own implementation that is. * * We must pull in sys/stat.h here so the system header definition * goes in first, and we redefine that, and not the other way around. * * Some frontends don't need the size from stat, so if UNSAFE_STAT_OK * is defined we don't bother with this. */ #if defined(WIN32) && !defined(__CYGWIN__) && !defined(UNSAFE_STAT_OK) #include <sys/stat.h> extern int pgwin32_safestat(const char *path, struct stat * buf); #define stat(a,b) pgwin32_safestat(a,b) #endif #if defined(WIN32) && !defined(__CYGWIN__) /* * open() and fopen() replacements to allow deletion of open files and * passing of other special options. */ #define O_DIRECT 0x80000000 extern int pgwin32_open(const char *, int,...); extern FILE *pgwin32_fopen(const char *, const char *); #ifndef FRONTEND #define open(a,b,c) pgwin32_open(a,b,c) #define fopen(a,b) pgwin32_fopen(a,b) #endif #ifndef popen #define popen(a,b) _popen(a,b) #endif #ifndef pclose #define pclose(a) _pclose(a) #endif /* New versions of MingW have gettimeofday, old mingw and msvc don't */ #ifndef HAVE_GETTIMEOFDAY /* Last parameter not used */ extern int gettimeofday(struct timeval * tp, struct timezone * tzp); #endif #else /* !WIN32 */ /* * Win32 requires a special close for sockets and pipes, while on Unix * close() does them all. */ #define closesocket close #endif /* WIN32 */ /* * On Windows, setvbuf() does not support _IOLBF mode, and interprets that * as _IOFBF. To add insult to injury, setvbuf(file, NULL, _IOFBF, 0) * crashes outright if "parameter validation" is enabled. Therefore, in * places where we'd like to select line-buffered mode, we fall back to * unbuffered mode instead on Windows. Always use PG_IOLBF not _IOLBF * directly in order to implement this behavior. */ #ifndef WIN32 #define PG_IOLBF _IOLBF #else #define PG_IOLBF _IONBF #endif /* * Default "extern" declarations or macro substitutes for library routines. * When necessary, these routines are provided by files in src/port/. */ #ifndef HAVE_CRYPT extern char *crypt(const char *key, const char *setting); #endif /* WIN32 handled in port/win32.h */ #ifndef WIN32 #define pgoff_t off_t #ifdef __NetBSD__ extern int fseeko(FILE *stream, off_t offset, int whence); extern off_t ftello(FILE *stream); #endif #endif extern double pg_erand48(unsigned short xseed[3]); extern long pg_lrand48(void); extern void pg_srand48(long seed); #ifndef HAVE_FLS extern int fls(int mask); #endif #ifndef HAVE_FSEEKO #define fseeko(a, b, c) fseek(a, b, c) #define ftello(a) ftell(a) #endif #ifndef HAVE_GETOPT extern int getopt(int nargc, char *const * nargv, const char *ostr); #endif #if !defined(HAVE_GETPEEREID) && !defined(WIN32) extern int getpeereid(int sock, uid_t *uid, gid_t *gid); #endif #ifndef HAVE_ISINF extern int isinf(double x); #endif #ifndef HAVE_MKDTEMP extern char *mkdtemp(char *path); #endif #ifndef HAVE_RINT extern double rint(double x); #endif #ifndef HAVE_INET_ATON #include <netinet/in.h> #include <arpa/inet.h> extern int inet_aton(const char *cp, struct in_addr * addr); #endif #if !HAVE_DECL_STRLCAT extern size_t strlcat(char *dst, const char *src, size_t siz); #endif #if !HAVE_DECL_STRLCPY extern size_t strlcpy(char *dst, const char *src, size_t siz); #endif #if !defined(HAVE_RANDOM) && !defined(__BORLANDC__) extern long random(void); #endif #ifndef HAVE_UNSETENV extern void unsetenv(const char *name); #endif #ifndef HAVE_SRANDOM extern void srandom(unsigned int seed); #endif /* thread.h */ extern char *pqStrerror(int errnum, char *strerrbuf, size_t buflen); #if !defined(WIN32) || defined(__CYGWIN__) extern int pqGetpwuid(uid_t uid, struct passwd * resultbuf, char *buffer, size_t buflen, struct passwd ** result); #endif extern int pqGethostbyname(const char *name, struct hostent * resultbuf, char *buffer, size_t buflen, struct hostent ** result, int *herrno); extern void pg_qsort(void *base, size_t nel, size_t elsize, int (*cmp) (const void *, const void *)); #define qsort(a,b,c,d) pg_qsort(a,b,c,d) typedef int (*qsort_arg_comparator) (const void *a, const void *b, void *arg); extern void qsort_arg(void *base, size_t nel, size_t elsize, qsort_arg_comparator cmp, void *arg); /* port/chklocale.c */ extern int pg_get_encoding_from_locale(const char *ctype, bool write_message); /* port/inet_net_ntop.c */ extern char *inet_net_ntop(int af, const void *src, int bits, char *dst, size_t size); /* port/pgcheckdir.c */ extern int pg_check_dir(const char *dir); /* port/pgmkdirp.c */ extern int pg_mkdir_p(char *path, int omode); #endif /* PG_PORT_H */ ��������������������������������������������������������pgsql/server/regex/regcustom.h����������������������������������������������������������������������0000644�����������������00000006642�14763166026�0012516 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. * * Development of this software was funded, in part, by Cray Research Inc., * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics * Corporation, none of whom are responsible for the results. The author * thanks all of them. * * Redistribution and use in source and binary forms -- with or without * modification -- are permitted for any purpose, provided that * redistributions in source form retain this entire copyright notice and * indicate the origin and nature of any modifications. * * I'd appreciate being given credit for this package in the documentation * of software which uses it, but that is not a requirement. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * src/include/regex/regcustom.h */ /* headers if any */ #include "postgres.h" #include <ctype.h> #include <limits.h> /* * towlower() and friends should be in <wctype.h>, but some pre-C99 systems * declare them in <wchar.h>. */ #ifdef HAVE_WCHAR_H #include <wchar.h> #endif #ifdef HAVE_WCTYPE_H #include <wctype.h> #endif #include "mb/pg_wchar.h" /* overrides for regguts.h definitions, if any */ #define FUNCPTR(name, args) (*name) args #define MALLOC(n) malloc(n) #define FREE(p) free(VS(p)) #define REALLOC(p,n) realloc(VS(p),n) #define assert(x) Assert(x) /* internal character type and related */ typedef pg_wchar chr; /* the type itself */ typedef unsigned uchr; /* unsigned type that will hold a chr */ typedef int celt; /* type to hold chr, or NOCELT */ #define NOCELT (-1) /* celt value which is not valid chr */ #define CHR(c) ((unsigned char) (c)) /* turn char literal into chr literal */ #define DIGITVAL(c) ((c)-'0') /* turn chr digit into its value */ #define CHRBITS 32 /* bits in a chr; must not use sizeof */ #define CHR_MIN 0x00000000 /* smallest and largest chr; the value */ #define CHR_MAX 0x7ffffffe /* CHR_MAX-CHR_MIN+1 must fit in an int, and * CHR_MAX+1 must fit in both chr and celt */ /* * Check if a chr value is in range. Ideally we'd just write this as * ((c) >= CHR_MIN && (c) <= CHR_MAX) * However, if chr is unsigned and CHR_MIN is zero, the first part of that * is a no-op, and certain overly-nannyish compilers give warnings about it. * So we leave that out here. If you want to make chr signed and/or CHR_MIN * not zero, redefine this macro as above. Callers should assume that the * macro may multiply evaluate its argument, even though it does not today. */ #define CHR_IS_IN_RANGE(c) ((c) <= CHR_MAX) /* functions operating on chr */ #define iscalnum(x) pg_wc_isalnum(x) #define iscalpha(x) pg_wc_isalpha(x) #define iscdigit(x) pg_wc_isdigit(x) #define iscspace(x) pg_wc_isspace(x) /* and pick up the standard header */ #include "regex.h" ����������������������������������������������������������������������������������������������pgsql/server/regex/regguts.h������������������������������������������������������������������������0000644�����������������00000037425�14763166026�0012171 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Internal interface definitions, etc., for the reg package * * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. * * Development of this software was funded, in part, by Cray Research Inc., * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics * Corporation, none of whom are responsible for the results. The author * thanks all of them. * * Redistribution and use in source and binary forms -- with or without * modification -- are permitted for any purpose, provided that * redistributions in source form retain this entire copyright notice and * indicate the origin and nature of any modifications. * * I'd appreciate being given credit for this package in the documentation * of software which uses it, but that is not a requirement. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * src/include/regex/regguts.h */ /* * Environmental customization. It should not (I hope) be necessary to * alter the file you are now reading -- regcustom.h should handle it all, * given care here and elsewhere. */ #include "regcustom.h" /* * Things that regcustom.h might override. */ /* assertions */ #ifndef assert #ifndef REG_DEBUG #define NDEBUG /* no assertions */ #endif #include <assert.h> #endif /* voids */ #ifndef DISCARD #define DISCARD void /* for throwing values away */ #endif #ifndef VS #define VS(x) ((void *)(x)) /* cast something to generic ptr */ #endif /* function-pointer declarator */ #ifndef FUNCPTR #define FUNCPTR(name, args) (*(name)) args #endif /* memory allocation */ #ifndef MALLOC #define MALLOC(n) malloc(n) #endif #ifndef REALLOC #define REALLOC(p, n) realloc(VS(p), n) #endif #ifndef FREE #define FREE(p) free(VS(p)) #endif /* want size of a char in bits, and max value in bounded quantifiers */ #ifndef CHAR_BIT #include <limits.h> #endif #ifndef _POSIX2_RE_DUP_MAX #define _POSIX2_RE_DUP_MAX 255 /* normally from <limits.h> */ #endif /* * misc */ #define NOTREACHED 0 #define xxx 1 #define DUPMAX _POSIX2_RE_DUP_MAX #define INFINITY (DUPMAX+1) #define REMAGIC 0xfed7 /* magic number for main struct */ /* * debugging facilities */ #ifdef REG_DEBUG /* FDEBUG does finite-state tracing */ #define FDEBUG(arglist) { if (v->eflags®_FTRACE) printf arglist; } /* MDEBUG does higher-level tracing */ #define MDEBUG(arglist) { if (v->eflags®_MTRACE) printf arglist; } #else #define FDEBUG(arglist) {} #define MDEBUG(arglist) {} #endif /* * bitmap manipulation */ #define UBITS (CHAR_BIT * sizeof(unsigned)) #define BSET(uv, sn) ((uv)[(sn)/UBITS] |= (unsigned)1 << ((sn)%UBITS)) #define ISBSET(uv, sn) ((uv)[(sn)/UBITS] & ((unsigned)1 << ((sn)%UBITS))) /* * We dissect a chr into byts for colormap table indexing. Here we define * a byt, which will be the same as a byte on most machines... The exact * size of a byt is not critical, but about 8 bits is good, and extraction * of 8-bit chunks is sometimes especially fast. */ #ifndef BYTBITS #define BYTBITS 8 /* bits in a byt */ #endif #define BYTTAB (1<<BYTBITS) /* size of table with one entry per byt value */ #define BYTMASK (BYTTAB-1) /* bit mask for byt */ #define NBYTS ((CHRBITS+BYTBITS-1)/BYTBITS) /* the definition of GETCOLOR(), below, assumes NBYTS <= 4 */ /* * As soon as possible, we map chrs into equivalence classes -- "colors" -- * which are of much more manageable number. */ typedef short color; /* colors of characters */ typedef int pcolor; /* what color promotes to */ #define MAX_COLOR 32767 /* max color (must fit in 'color' datatype) */ #define COLORLESS (-1) /* impossible color */ #define WHITE 0 /* default color, parent of all others */ /* * A colormap is a tree -- more precisely, a DAG -- indexed at each level * by a byt of the chr, to map the chr to a color efficiently. Because * lower sections of the tree can be shared, it can exploit the usual * sparseness of such a mapping table. The tree is always NBYTS levels * deep (in the past it was shallower during construction but was "filled" * to full depth at the end of that); areas that are unaltered as yet point * to "fill blocks" which are entirely WHITE in color. */ /* the tree itself */ struct colors { color ccolor[BYTTAB]; }; struct ptrs { union tree *pptr[BYTTAB]; }; union tree { struct colors colors; struct ptrs ptrs; }; #define tcolor colors.ccolor #define tptr ptrs.pptr /* * Per-color data structure for the compile-time color machinery * * If "sub" is not NOSUB then it is the number of the color's current * subcolor, i.e. we are in process of dividing this color (character * equivalence class) into two colors. See src/backend/regex/README for * discussion of subcolors. * * Currently-unused colors have the FREECOL bit set and are linked into a * freelist using their "sub" fields, but only if their color numbers are * less than colormap.max. Any array entries beyond "max" are just garbage. */ struct colordesc { uchr nchrs; /* number of chars of this color */ color sub; /* open subcolor, if any; or free-chain ptr */ #define NOSUB COLORLESS /* value of "sub" when no open subcolor */ struct arc *arcs; /* chain of all arcs of this color */ chr firstchr; /* char first assigned to this color */ int flags; /* bit values defined next */ #define FREECOL 01 /* currently free */ #define PSEUDO 02 /* pseudocolor, no real chars */ #define UNUSEDCOLOR(cd) ((cd)->flags & FREECOL) union tree *block; /* block of solid color, if any */ }; /* * The color map itself * * Much of the data in the colormap struct is only used at compile time. * However, the bulk of the space usage is in the "tree" structure, so it's * not clear that there's much point in converting the rest to a more compact * form when compilation is finished. */ struct colormap { int magic; #define CMMAGIC 0x876 struct vars *v; /* for compile error reporting */ size_t ncds; /* allocated length of colordescs array */ size_t max; /* highest color number currently in use */ color free; /* beginning of free chain (if non-0) */ struct colordesc *cd; /* pointer to array of colordescs */ #define CDEND(cm) (&(cm)->cd[(cm)->max + 1]) /* If we need up to NINLINECDS, we store them here to save a malloc */ #define NINLINECDS ((size_t)10) struct colordesc cdspace[NINLINECDS]; union tree tree[NBYTS]; /* tree top, plus lower-level fill blocks */ }; /* optimization magic to do fast chr->color mapping */ #define B0(c) ((c) & BYTMASK) #define B1(c) (((c)>>BYTBITS) & BYTMASK) #define B2(c) (((c)>>(2*BYTBITS)) & BYTMASK) #define B3(c) (((c)>>(3*BYTBITS)) & BYTMASK) #if NBYTS == 1 #define GETCOLOR(cm, c) ((cm)->tree->tcolor[B0(c)]) #endif /* beware, for NBYTS>1, GETCOLOR() is unsafe -- 2nd arg used repeatedly */ #if NBYTS == 2 #define GETCOLOR(cm, c) ((cm)->tree->tptr[B1(c)]->tcolor[B0(c)]) #endif #if NBYTS == 4 #define GETCOLOR(cm, c) ((cm)->tree->tptr[B3(c)]->tptr[B2(c)]->tptr[B1(c)]->tcolor[B0(c)]) #endif /* * Interface definitions for locale-interface functions in regc_locale.c. */ /* * Representation of a set of characters. chrs[] represents individual * code points, ranges[] represents ranges in the form min..max inclusive. * * Note that in cvecs gotten from newcvec() and intended to be freed by * freecvec(), both arrays of chrs are after the end of the struct, not * separately malloc'd; so chrspace and rangespace are effectively immutable. */ struct cvec { int nchrs; /* number of chrs */ int chrspace; /* number of chrs allocated in chrs[] */ chr *chrs; /* pointer to vector of chrs */ int nranges; /* number of ranges (chr pairs) */ int rangespace; /* number of ranges allocated in ranges[] */ chr *ranges; /* pointer to vector of chr pairs */ }; /* * definitions for NFA internal representation * * Having a "from" pointer within each arc may seem redundant, but it * saves a lot of hassle. */ struct state; struct arc { int type; /* 0 if free, else an NFA arc type code */ color co; struct state *from; /* where it's from (and contained within) */ struct state *to; /* where it's to */ struct arc *outchain; /* link in *from's outs chain or free chain */ struct arc *outchainRev; /* back-link in *from's outs chain */ #define freechain outchain /* we do not maintain "freechainRev" */ struct arc *inchain; /* link in *to's ins chain */ struct arc *inchainRev; /* back-link in *to's ins chain */ struct arc *colorchain; /* link in color's arc chain */ struct arc *colorchainRev; /* back-link in color's arc chain */ }; struct arcbatch { /* for bulk allocation of arcs */ struct arcbatch *next; #define ABSIZE 10 struct arc a[ABSIZE]; }; struct state { int no; #define FREESTATE (-1) char flag; /* marks special states */ int nins; /* number of inarcs */ struct arc *ins; /* chain of inarcs */ int nouts; /* number of outarcs */ struct arc *outs; /* chain of outarcs */ struct arc *free; /* chain of free arcs */ struct state *tmp; /* temporary for traversal algorithms */ struct state *next; /* chain for traversing all */ struct state *prev; /* back chain */ struct arcbatch oas; /* first arcbatch, avoid malloc in easy case */ int noas; /* number of arcs used in first arcbatch */ }; struct nfa { struct state *pre; /* pre-initial state */ struct state *init; /* initial state */ struct state *final; /* final state */ struct state *post; /* post-final state */ int nstates; /* for numbering states */ struct state *states; /* state-chain header */ struct state *slast; /* tail of the chain */ struct state *free; /* free list */ struct colormap *cm; /* the color map */ color bos[2]; /* colors, if any, assigned to BOS and BOL */ color eos[2]; /* colors, if any, assigned to EOS and EOL */ struct vars *v; /* simplifies compile error reporting */ struct nfa *parent; /* parent NFA, if any */ }; /* * definitions for compacted NFA * * The main space savings in a compacted NFA is from making the arcs as small * as possible. We store only the transition color and next-state number for * each arc. The list of out arcs for each state is an array beginning at * cnfa.states[statenumber], and terminated by a dummy carc struct with * co == COLORLESS. * * The non-dummy carc structs are of two types: plain arcs and LACON arcs. * Plain arcs just store the transition color number as "co". LACON arcs * store the lookahead constraint number plus cnfa.ncolors as "co". LACON * arcs can be distinguished from plain by testing for co >= cnfa.ncolors. */ struct carc { color co; /* COLORLESS is list terminator */ int to; /* next-state number */ }; struct cnfa { int nstates; /* number of states */ int ncolors; /* number of colors (max color in use + 1) */ int flags; #define HASLACONS 01 /* uses lookahead constraints */ int pre; /* setup state number */ int post; /* teardown state number */ color bos[2]; /* colors, if any, assigned to BOS and BOL */ color eos[2]; /* colors, if any, assigned to EOS and EOL */ char *stflags; /* vector of per-state flags bytes */ #define CNFA_NOPROGRESS 01 /* flag bit for a no-progress state */ struct carc **states; /* vector of pointers to outarc lists */ /* states[n] are pointers into a single malloc'd array of arcs */ struct carc *arcs; /* the area for the lists */ }; #define ZAPCNFA(cnfa) ((cnfa).nstates = 0) #define NULLCNFA(cnfa) ((cnfa).nstates == 0) /* * This symbol limits the transient heap space used by the regex compiler, * and thereby also the maximum complexity of NFAs that we'll deal with. * Currently we only count NFA states and arcs against this; the other * transient data is generally not large enough to notice compared to those. * Note that we do not charge anything for the final output data structures * (the compacted NFA and the colormap). */ #ifndef REG_MAX_COMPILE_SPACE #define REG_MAX_COMPILE_SPACE \ (100000 * sizeof(struct state) + 100000 * sizeof(struct arcbatch)) #endif /* * subexpression tree * * "op" is one of: * '=' plain regex without interesting substructure (implemented as DFA) * 'b' back-reference (has no substructure either) * '(' capture node: captures the match of its single child * '.' concatenation: matches a match for left, then a match for right * '|' alternation: matches a match for left or a match for right * '*' iteration: matches some number of matches of its single child * * Note: the right child of an alternation must be another alternation or * NULL; hence, an N-way branch requires N alternation nodes, not N-1 as you * might expect. This could stand to be changed. Actually I'd rather see * a single alternation node with N children, but that will take revising * the representation of struct subre. * * Note: when a backref is directly quantified, we stick the min/max counts * into the backref rather than plastering an iteration node on top. This is * for efficiency: there is no need to search for possible division points. */ struct subre { char op; /* see type codes above */ char flags; #define LONGER 01 /* prefers longer match */ #define SHORTER 02 /* prefers shorter match */ #define MIXED 04 /* mixed preference below */ #define CAP 010 /* capturing parens below */ #define BACKR 020 /* back reference below */ #define INUSE 0100 /* in use in final tree */ #define LOCAL 03 /* bits which may not propagate up */ #define LMIX(f) ((f)<<2) /* LONGER -> MIXED */ #define SMIX(f) ((f)<<1) /* SHORTER -> MIXED */ #define UP(f) (((f)&~LOCAL) | (LMIX(f) & SMIX(f) & MIXED)) #define MESSY(f) ((f)&(MIXED|CAP|BACKR)) #define PREF(f) ((f)&LOCAL) #define PREF2(f1, f2) ((PREF(f1) != 0) ? PREF(f1) : PREF(f2)) #define COMBINE(f1, f2) (UP((f1)|(f2)) | PREF2(f1, f2)) short id; /* ID of subre (1..ntree-1) */ int subno; /* subexpression number (for 'b' and '(') */ short min; /* min repetitions for iteration or backref */ short max; /* max repetitions for iteration or backref */ struct subre *left; /* left child, if any (also freelist chain) */ struct subre *right; /* right child, if any */ struct state *begin; /* outarcs from here... */ struct state *end; /* ...ending in inarcs here */ struct cnfa cnfa; /* compacted NFA, if any */ struct subre *chain; /* for bookkeeping and error cleanup */ }; /* * table of function pointers for generic manipulation functions * A regex_t's re_fns points to one of these. */ struct fns { void FUNCPTR(free, (regex_t *)); int FUNCPTR(cancel_requested, (void)); int FUNCPTR(stack_too_deep, (void)); }; #define CANCEL_REQUESTED(re) \ ((*((struct fns *) (re)->re_fns)->cancel_requested) ()) #define STACK_TOO_DEEP(re) \ ((*((struct fns *) (re)->re_fns)->stack_too_deep) ()) /* * the insides of a regex_t, hidden behind a void * */ struct guts { int magic; #define GUTSMAGIC 0xfed9 int cflags; /* copy of compile flags */ long info; /* copy of re_info */ size_t nsub; /* copy of re_nsub */ struct subre *tree; struct cnfa search; /* for fast preliminary search */ int ntree; /* number of subre's, plus one */ struct colormap cmap; int FUNCPTR(compare, (const chr *, const chr *, size_t)); struct subre *lacons; /* lookahead-constraint vector */ int nlacons; /* size of lacons */ }; �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/regex/regerrs.h������������������������������������������������������������������������0000644�����������������00000002464�14763166026�0012155 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * src/include/regex/regerrs.h */ { REG_OKAY, "REG_OKAY", "no errors detected" }, { REG_NOMATCH, "REG_NOMATCH", "failed to match" }, { REG_BADPAT, "REG_BADPAT", "invalid regexp (reg version 0.8)" }, { REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element" }, { REG_ECTYPE, "REG_ECTYPE", "invalid character class" }, { REG_EESCAPE, "REG_EESCAPE", "invalid escape \\ sequence" }, { REG_ESUBREG, "REG_ESUBREG", "invalid backreference number" }, { REG_EBRACK, "REG_EBRACK", "brackets [] not balanced" }, { REG_EPAREN, "REG_EPAREN", "parentheses () not balanced" }, { REG_EBRACE, "REG_EBRACE", "braces {} not balanced" }, { REG_BADBR, "REG_BADBR", "invalid repetition count(s)" }, { REG_ERANGE, "REG_ERANGE", "invalid character range" }, { REG_ESPACE, "REG_ESPACE", "out of memory" }, { REG_BADRPT, "REG_BADRPT", "quantifier operand invalid" }, { REG_ASSERT, "REG_ASSERT", "\"cannot happen\" -- you found a bug" }, { REG_INVARG, "REG_INVARG", "invalid argument to regex function" }, { REG_MIXED, "REG_MIXED", "character widths of regex and string differ" }, { REG_BADOPT, "REG_BADOPT", "invalid embedded option" }, { REG_ETOOBIG, "REG_ETOOBIG", "regular expression is too complex" }, { REG_ECOLORS, "REG_ECOLORS", "too many colors" }, { REG_CANCEL, "REG_CANCEL", "operation cancelled" }, ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/regex/regex.h��������������������������������������������������������������������������0000644�����������������00000015057�14763166026�0011620 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _REGEX_H_ #define _REGEX_H_ /* never again */ /* * regular expressions * * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. * * Development of this software was funded, in part, by Cray Research Inc., * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics * Corporation, none of whom are responsible for the results. The author * thanks all of them. * * Redistribution and use in source and binary forms -- with or without * modification -- are permitted for any purpose, provided that * redistributions in source form retain this entire copyright notice and * indicate the origin and nature of any modifications. * * I'd appreciate being given credit for this package in the documentation * of software which uses it, but that is not a requirement. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * src/include/regex/regex.h */ /* * Add your own defines, if needed, here. */ #include "mb/pg_wchar.h" /* * interface types etc. */ /* * regoff_t has to be large enough to hold either off_t or ssize_t, * and must be signed; it's only a guess that long is suitable. */ typedef long regoff_t; /* * other interface types */ /* the biggie, a compiled RE (or rather, a front end to same) */ typedef struct { int re_magic; /* magic number */ size_t re_nsub; /* number of subexpressions */ long re_info; /* information about RE */ #define REG_UBACKREF 000001 #define REG_ULOOKAHEAD 000002 #define REG_UBOUNDS 000004 #define REG_UBRACES 000010 #define REG_UBSALNUM 000020 #define REG_UPBOTCH 000040 #define REG_UBBS 000100 #define REG_UNONPOSIX 000200 #define REG_UUNSPEC 000400 #define REG_UUNPORT 001000 #define REG_ULOCALE 002000 #define REG_UEMPTYMATCH 004000 #define REG_UIMPOSSIBLE 010000 #define REG_USHORTEST 020000 int re_csize; /* sizeof(character) */ char *re_endp; /* backward compatibility kludge */ Oid re_collation; /* Collation that defines LC_CTYPE behavior */ /* the rest is opaque pointers to hidden innards */ char *re_guts; /* `char *' is more portable than `void *' */ char *re_fns; } regex_t; /* result reporting (may acquire more fields later) */ typedef struct { regoff_t rm_so; /* start of substring */ regoff_t rm_eo; /* end of substring */ } regmatch_t; /* supplementary control and reporting */ typedef struct { regmatch_t rm_extend; /* see REG_EXPECT */ } rm_detail_t; /* * regex compilation flags */ #define REG_BASIC 000000 /* BREs (convenience) */ #define REG_EXTENDED 000001 /* EREs */ #define REG_ADVF 000002 /* advanced features in EREs */ #define REG_ADVANCED 000003 /* AREs (which are also EREs) */ #define REG_QUOTE 000004 /* no special characters, none */ #define REG_NOSPEC REG_QUOTE /* historical synonym */ #define REG_ICASE 000010 /* ignore case */ #define REG_NOSUB 000020 /* don't care about subexpressions */ #define REG_EXPANDED 000040 /* expanded format, white space & comments */ #define REG_NLSTOP 000100 /* \n doesn't match . or [^ ] */ #define REG_NLANCH 000200 /* ^ matches after \n, $ before */ #define REG_NEWLINE 000300 /* newlines are line terminators */ #define REG_PEND 000400 /* ugh -- backward-compatibility hack */ #define REG_EXPECT 001000 /* report details on partial/limited matches */ #define REG_BOSONLY 002000 /* temporary kludge for BOS-only matches */ #define REG_DUMP 004000 /* none of your business :-) */ #define REG_FAKE 010000 /* none of your business :-) */ #define REG_PROGRESS 020000 /* none of your business :-) */ /* * regex execution flags */ #define REG_NOTBOL 0001 /* BOS is not BOL */ #define REG_NOTEOL 0002 /* EOS is not EOL */ #define REG_STARTEND 0004 /* backward compatibility kludge */ #define REG_FTRACE 0010 /* none of your business */ #define REG_MTRACE 0020 /* none of your business */ #define REG_SMALL 0040 /* none of your business */ /* * error reporting * Be careful if modifying the list of error codes -- the table used by * regerror() is generated automatically from this file! */ #define REG_OKAY 0 /* no errors detected */ #define REG_NOMATCH 1 /* failed to match */ #define REG_BADPAT 2 /* invalid regexp */ #define REG_ECOLLATE 3 /* invalid collating element */ #define REG_ECTYPE 4 /* invalid character class */ #define REG_EESCAPE 5 /* invalid escape \ sequence */ #define REG_ESUBREG 6 /* invalid backreference number */ #define REG_EBRACK 7 /* brackets [] not balanced */ #define REG_EPAREN 8 /* parentheses () not balanced */ #define REG_EBRACE 9 /* braces {} not balanced */ #define REG_BADBR 10 /* invalid repetition count(s) */ #define REG_ERANGE 11 /* invalid character range */ #define REG_ESPACE 12 /* out of memory */ #define REG_BADRPT 13 /* quantifier operand invalid */ #define REG_ASSERT 15 /* "can't happen" -- you found a bug */ #define REG_INVARG 16 /* invalid argument to regex function */ #define REG_MIXED 17 /* character widths of regex and string differ */ #define REG_BADOPT 18 /* invalid embedded option */ #define REG_ETOOBIG 19 /* regular expression is too complex */ #define REG_ECOLORS 20 /* too many colors */ #define REG_CANCEL 21 /* operation cancelled */ /* two specials for debugging and testing */ #define REG_ATOI 101 /* convert error-code name to number */ #define REG_ITOA 102 /* convert error-code number to name */ /* non-error result codes for pg_regprefix */ #define REG_PREFIX (-1) /* identified a common prefix */ #define REG_EXACT (-2) /* identified an exact match */ /* * the prototypes for exported functions */ extern int pg_regcomp(regex_t *, const pg_wchar *, size_t, int, Oid); extern int pg_regexec(regex_t *, const pg_wchar *, size_t, size_t, rm_detail_t *, size_t, regmatch_t[], int); extern int pg_regprefix(regex_t *, pg_wchar **, size_t *); extern void pg_regfree(regex_t *); extern size_t pg_regerror(int, const regex_t *, char *, size_t); extern void pg_set_regex_collation(Oid collation); #endif /* _REGEX_H_ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/mb/pg_wchar.h��������������������������������������������������������������������������0000644�����������������00000041543�14763166026�0011563 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_wchar.h * multibyte-character support * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/mb/pg_wchar.h * * NOTES * This is used both by the backend and by libpq, but should not be * included by libpq client programs. In particular, a libpq client * should not assume that the encoding IDs used by the version of libpq * it's linked to match up with the IDs declared here. * *------------------------------------------------------------------------- */ #ifndef PG_WCHAR_H #define PG_WCHAR_H /* * The pg_wchar type */ typedef unsigned int pg_wchar; /* * various definitions for EUC */ #define SS2 0x8e /* single shift 2 (JIS0201) */ #define SS3 0x8f /* single shift 3 (JIS0212) */ /* * SJIS validation macros */ #define ISSJISHEAD(c) (((c) >= 0x81 && (c) <= 0x9f) || ((c) >= 0xe0 && (c) <= 0xfc)) #define ISSJISTAIL(c) (((c) >= 0x40 && (c) <= 0x7e) || ((c) >= 0x80 && (c) <= 0xfc)) /* * Leading byte types or leading prefix byte for MULE internal code. * See http://www.xemacs.org for more details. (there is a doc titled * "XEmacs Internals Manual", "MULE Character Sets and Encodings" * section.) */ /* * Is a leading byte for "official" single byte encodings? */ #define IS_LC1(c) ((unsigned char)(c) >= 0x81 && (unsigned char)(c) <= 0x8d) /* * Is a prefix byte for "private" single byte encodings? */ #define LCPRV1_A 0x9a #define LCPRV1_B 0x9b #define IS_LCPRV1(c) ((unsigned char)(c) == LCPRV1_A || (unsigned char)(c) == LCPRV1_B) #define IS_LCPRV1_A_RANGE(c) \ ((unsigned char)(c) >= 0xa0 && (unsigned char)(c) <= 0xdf) #define IS_LCPRV1_B_RANGE(c) \ ((unsigned char)(c) >= 0xe0 && (unsigned char)(c) <= 0xef) /* * Is a leading byte for "official" multibyte encodings? */ #define IS_LC2(c) ((unsigned char)(c) >= 0x90 && (unsigned char)(c) <= 0x99) /* * Is a prefix byte for "private" multibyte encodings? */ #define LCPRV2_A 0x9c #define LCPRV2_B 0x9d #define IS_LCPRV2(c) ((unsigned char)(c) == LCPRV2_A || (unsigned char)(c) == LCPRV2_B) #define IS_LCPRV2_A_RANGE(c) \ ((unsigned char)(c) >= 0xf0 && (unsigned char)(c) <= 0xf4) #define IS_LCPRV2_B_RANGE(c) \ ((unsigned char)(c) >= 0xf5 && (unsigned char)(c) <= 0xfe) /*---------------------------------------------------- * leading characters *---------------------------------------------------- */ /* * Official single byte encodings (0x81-0x8e) */ #define LC_ISO8859_1 0x81 /* ISO8859 Latin 1 */ #define LC_ISO8859_2 0x82 /* ISO8859 Latin 2 */ #define LC_ISO8859_3 0x83 /* ISO8859 Latin 3 */ #define LC_ISO8859_4 0x84 /* ISO8859 Latin 4 */ #define LC_TIS620 0x85 /* Thai (not supported yet) */ #define LC_ISO8859_7 0x86 /* Greek (not supported yet) */ #define LC_ISO8859_6 0x87 /* Arabic (not supported yet) */ #define LC_ISO8859_8 0x88 /* Hebrew (not supported yet) */ #define LC_JISX0201K 0x89 /* Japanese 1 byte kana */ #define LC_JISX0201R 0x8a /* Japanese 1 byte Roman */ /* Note that 0x8b seems to be unused as of Emacs 20.7. * However, there might be a chance that 0x8b could be used * in later version of Emacs. */ #define LC_KOI8_R 0x8b /* Cyrillic KOI8-R */ #define LC_KOI8_U 0x8b /* Cyrillic KOI8-U */ #define LC_ISO8859_5 0x8c /* ISO8859 Cyrillic */ #define LC_ISO8859_9 0x8d /* ISO8859 Latin 5 (not supported yet) */ /* #define FREE 0x8e free (unused) */ /* * Unused */ #define CONTROL_1 0x8f /* control characters (unused) */ /* * Official multibyte byte encodings (0x90-0x99) * 0x9a-0x9d are free. 0x9e and 0x9f are reserved. */ #define LC_JISX0208_1978 0x90 /* Japanese Kanji, old JIS (not supported) */ /* #define FREE 0x90 free (unused) */ #define LC_GB2312_80 0x91 /* Chinese */ #define LC_JISX0208 0x92 /* Japanese Kanji (JIS X 0208) */ #define LC_KS5601 0x93 /* Korean */ #define LC_JISX0212 0x94 /* Japanese Kanji (JIS X 0212) */ #define LC_CNS11643_1 0x95 /* CNS 11643-1992 Plane 1 */ #define LC_CNS11643_2 0x96 /* CNS 11643-1992 Plane 2 */ /* #define FREE 0x97 free (unused) */ #define LC_BIG5_1 0x98 /* Plane 1 Chinese traditional (not supported) */ #define LC_BIG5_2 0x99 /* Plane 1 Chinese traditional (not supported) */ /* * Private single byte encodings (0xa0-0xef) */ #define LC_SISHENG 0xa0/* Chinese SiSheng characters for * PinYin/ZhuYin (not supported) */ #define LC_IPA 0xa1/* IPA (International Phonetic Association) * (not supported) */ #define LC_VISCII_LOWER 0xa2/* Vietnamese VISCII1.1 lower-case (not * supported) */ #define LC_VISCII_UPPER 0xa3/* Vietnamese VISCII1.1 upper-case (not * supported) */ #define LC_ARABIC_DIGIT 0xa4 /* Arabic digit (not supported) */ #define LC_ARABIC_1_COLUMN 0xa5 /* Arabic 1-column (not supported) */ #define LC_ASCII_RIGHT_TO_LEFT 0xa6 /* ASCII (left half of ISO8859-1) with * right-to-left direction (not * supported) */ #define LC_LAO 0xa7/* Lao characters (ISO10646 0E80..0EDF) (not * supported) */ #define LC_ARABIC_2_COLUMN 0xa8 /* Arabic 1-column (not supported) */ /* * Private multibyte encodings (0xf0-0xff) */ #define LC_INDIAN_1_COLUMN 0xf0/* Indian charset for 1-column width glypps * (not supported) */ #define LC_TIBETAN_1_COLUMN 0xf1 /* Tibetan 1 column glyph (not supported) */ #define LC_ETHIOPIC 0xf5 /* Ethiopic characters (not supported) */ #define LC_CNS11643_3 0xf6 /* CNS 11643-1992 Plane 3 */ #define LC_CNS11643_4 0xf7 /* CNS 11643-1992 Plane 4 */ #define LC_CNS11643_5 0xf8 /* CNS 11643-1992 Plane 5 */ #define LC_CNS11643_6 0xf9 /* CNS 11643-1992 Plane 6 */ #define LC_CNS11643_7 0xfa /* CNS 11643-1992 Plane 7 */ #define LC_INDIAN_2_COLUMN 0xfb/* Indian charset for 2-column width glypps * (not supported) */ #define LC_TIBETAN 0xfc /* Tibetan (not supported) */ /* #define FREE 0xfd free (unused) */ /* #define FREE 0xfe free (unused) */ /* #define FREE 0xff free (unused) */ /* * PostgreSQL encoding identifiers * * WARNING: the order of this enum must be same as order of entries * in the pg_enc2name_tbl[] array (in mb/encnames.c), and * in the pg_wchar_table[] array (in mb/wchar.c)! * * If you add some encoding don't forget to check * PG_ENCODING_BE_LAST macro. * * PG_SQL_ASCII is default encoding and must be = 0. * * XXX We must avoid renumbering any backend encoding until libpq's major * version number is increased beyond 5; it turns out that the backend * encoding IDs are effectively part of libpq's ABI as far as 8.2 initdb and * psql are concerned. */ typedef enum pg_enc { PG_SQL_ASCII = 0, /* SQL/ASCII */ PG_EUC_JP, /* EUC for Japanese */ PG_EUC_CN, /* EUC for Chinese */ PG_EUC_KR, /* EUC for Korean */ PG_EUC_TW, /* EUC for Taiwan */ PG_EUC_JIS_2004, /* EUC-JIS-2004 */ PG_UTF8, /* Unicode UTF8 */ PG_MULE_INTERNAL, /* Mule internal code */ PG_LATIN1, /* ISO-8859-1 Latin 1 */ PG_LATIN2, /* ISO-8859-2 Latin 2 */ PG_LATIN3, /* ISO-8859-3 Latin 3 */ PG_LATIN4, /* ISO-8859-4 Latin 4 */ PG_LATIN5, /* ISO-8859-9 Latin 5 */ PG_LATIN6, /* ISO-8859-10 Latin6 */ PG_LATIN7, /* ISO-8859-13 Latin7 */ PG_LATIN8, /* ISO-8859-14 Latin8 */ PG_LATIN9, /* ISO-8859-15 Latin9 */ PG_LATIN10, /* ISO-8859-16 Latin10 */ PG_WIN1256, /* windows-1256 */ PG_WIN1258, /* Windows-1258 */ PG_WIN866, /* (MS-DOS CP866) */ PG_WIN874, /* windows-874 */ PG_KOI8R, /* KOI8-R */ PG_WIN1251, /* windows-1251 */ PG_WIN1252, /* windows-1252 */ PG_ISO_8859_5, /* ISO-8859-5 */ PG_ISO_8859_6, /* ISO-8859-6 */ PG_ISO_8859_7, /* ISO-8859-7 */ PG_ISO_8859_8, /* ISO-8859-8 */ PG_WIN1250, /* windows-1250 */ PG_WIN1253, /* windows-1253 */ PG_WIN1254, /* windows-1254 */ PG_WIN1255, /* windows-1255 */ PG_WIN1257, /* windows-1257 */ PG_KOI8U, /* KOI8-U */ /* PG_ENCODING_BE_LAST points to the above entry */ /* followings are for client encoding only */ PG_SJIS, /* Shift JIS (Winindows-932) */ PG_BIG5, /* Big5 (Windows-950) */ PG_GBK, /* GBK (Windows-936) */ PG_UHC, /* UHC (Windows-949) */ PG_GB18030, /* GB18030 */ PG_JOHAB, /* EUC for Korean JOHAB */ PG_SHIFT_JIS_2004, /* Shift-JIS-2004 */ _PG_LAST_ENCODING_ /* mark only */ } pg_enc; #define PG_ENCODING_BE_LAST PG_KOI8U /* * Please use these tests before access to pg_encconv_tbl[] * or to other places... */ #define PG_VALID_BE_ENCODING(_enc) \ ((_enc) >= 0 && (_enc) <= PG_ENCODING_BE_LAST) #define PG_ENCODING_IS_CLIENT_ONLY(_enc) \ ((_enc) > PG_ENCODING_BE_LAST && (_enc) < _PG_LAST_ENCODING_) #define PG_VALID_ENCODING(_enc) \ ((_enc) >= 0 && (_enc) < _PG_LAST_ENCODING_) /* On FE are possible all encodings */ #define PG_VALID_FE_ENCODING(_enc) PG_VALID_ENCODING(_enc) /* * Encoding names with all aliases */ typedef struct pg_encname { char *name; pg_enc encoding; } pg_encname; extern pg_encname pg_encname_tbl[]; extern unsigned int pg_encname_tbl_sz; /* * Careful: * * if (PG_VALID_ENCODING(encoding)) * pg_enc2name_tbl[ encoding ]; */ typedef struct pg_enc2name { char *name; pg_enc encoding; #ifdef WIN32 unsigned codepage; /* codepage for WIN32 */ #endif } pg_enc2name; extern pg_enc2name pg_enc2name_tbl[]; /* * Encoding names for gettext */ typedef struct pg_enc2gettext { pg_enc encoding; const char *name; } pg_enc2gettext; extern pg_enc2gettext pg_enc2gettext_tbl[]; /* * pg_wchar stuff */ typedef int (*mb2wchar_with_len_converter) (const unsigned char *from, pg_wchar *to, int len); typedef int (*wchar2mb_with_len_converter) (const pg_wchar *from, unsigned char *to, int len); typedef int (*mblen_converter) (const unsigned char *mbstr); typedef int (*mbdisplaylen_converter) (const unsigned char *mbstr); typedef bool (*mbcharacter_incrementer) (unsigned char *mbstr, int len); typedef int (*mbverifier) (const unsigned char *mbstr, int len); typedef struct { mb2wchar_with_len_converter mb2wchar_with_len; /* convert a multibyte * string to a wchar */ wchar2mb_with_len_converter wchar2mb_with_len; /* convert a wchar * string to a multibyte */ mblen_converter mblen; /* get byte length of a char */ mbdisplaylen_converter dsplen; /* get display width of a char */ mbverifier mbverify; /* verify multibyte sequence */ int maxmblen; /* max bytes for a char in this encoding */ } pg_wchar_tbl; extern pg_wchar_tbl pg_wchar_table[]; /* * UTF-8 to local code conversion map * Note that we limit the max length of UTF-8 to 4 bytes, * which is UCS-4 00010000-001FFFFF range. */ typedef struct { uint32 utf; /* UTF-8 */ uint32 code; /* local code */ } pg_utf_to_local; /* * local code to UTF-8 conversion map */ typedef struct { uint32 code; /* local code */ uint32 utf; /* UTF-8 */ } pg_local_to_utf; /* * UTF-8 to local code conversion map(combined characters) */ typedef struct { uint32 utf1; /* UTF-8 code 1 */ uint32 utf2; /* UTF-8 code 2 */ uint32 code; /* local code */ } pg_utf_to_local_combined; /* * local code to UTF-8 conversion map(combined characters) */ typedef struct { uint32 code; /* local code */ uint32 utf1; /* UTF-8 code 1 */ uint32 utf2; /* UTF-8 code 2 */ } pg_local_to_utf_combined; /* * Support macro for encoding conversion functions to validate their * arguments. (This could be made more compact if we included fmgr.h * here, but we don't want to do that because this header file is also * used by frontends.) */ #define CHECK_ENCODING_CONVERSION_ARGS(srcencoding,destencoding) \ check_encoding_conversion_args(PG_GETARG_INT32(0), \ PG_GETARG_INT32(1), \ PG_GETARG_INT32(4), \ (srcencoding), \ (destencoding)) /* * These functions are considered part of libpq's exported API and * are also declared in libpq-fe.h. */ extern int pg_char_to_encoding(const char *name); extern const char *pg_encoding_to_char(int encoding); extern int pg_valid_server_encoding_id(int encoding); /* * Remaining functions are not considered part of libpq's API, though many * of them do exist inside libpq. */ extern pg_encname *pg_char_to_encname_struct(const char *name); extern int pg_mb2wchar(const char *from, pg_wchar *to); extern int pg_mb2wchar_with_len(const char *from, pg_wchar *to, int len); extern int pg_encoding_mb2wchar_with_len(int encoding, const char *from, pg_wchar *to, int len); extern int pg_wchar2mb(const pg_wchar *from, char *to); extern int pg_wchar2mb_with_len(const pg_wchar *from, char *to, int len); extern int pg_encoding_wchar2mb_with_len(int encoding, const pg_wchar *from, char *to, int len); extern int pg_char_and_wchar_strcmp(const char *s1, const pg_wchar *s2); extern int pg_wchar_strncmp(const pg_wchar *s1, const pg_wchar *s2, size_t n); extern int pg_char_and_wchar_strncmp(const char *s1, const pg_wchar *s2, size_t n); extern size_t pg_wchar_strlen(const pg_wchar *wstr); extern int pg_mblen(const char *mbstr); extern int pg_dsplen(const char *mbstr); extern int pg_encoding_mblen(int encoding, const char *mbstr); extern int pg_encoding_dsplen(int encoding, const char *mbstr); extern int pg_encoding_verifymb(int encoding, const char *mbstr, int len); extern int pg_mule_mblen(const unsigned char *mbstr); extern int pg_mic_mblen(const unsigned char *mbstr); extern int pg_mbstrlen(const char *mbstr); extern int pg_mbstrlen_with_len(const char *mbstr, int len); extern int pg_mbcliplen(const char *mbstr, int len, int limit); extern int pg_encoding_mbcliplen(int encoding, const char *mbstr, int len, int limit); extern int pg_mbcharcliplen(const char *mbstr, int len, int imit); extern int pg_encoding_max_length(int encoding); extern int pg_database_encoding_max_length(void); extern mbcharacter_incrementer pg_database_encoding_character_incrementer(void); extern int PrepareClientEncoding(int encoding); extern int SetClientEncoding(int encoding); extern void InitializeClientEncoding(void); extern int pg_get_client_encoding(void); extern const char *pg_get_client_encoding_name(void); extern void SetDatabaseEncoding(int encoding); extern int GetDatabaseEncoding(void); extern const char *GetDatabaseEncodingName(void); extern int GetPlatformEncoding(void); extern void pg_bind_textdomain_codeset(const char *domainname); extern int pg_valid_client_encoding(const char *name); extern int pg_valid_server_encoding(const char *name); extern unsigned char *unicode_to_utf8(pg_wchar c, unsigned char *utf8string); extern pg_wchar utf8_to_unicode(const unsigned char *c); extern int pg_utf_mblen(const unsigned char *); extern unsigned char *pg_do_encoding_conversion(unsigned char *src, int len, int src_encoding, int dest_encoding); extern char *pg_client_to_server(const char *s, int len); extern char *pg_server_to_client(const char *s, int len); extern char *pg_any_to_server(const char *s, int len, int encoding); extern char *pg_server_to_any(const char *s, int len, int encoding); extern unsigned short BIG5toCNS(unsigned short big5, unsigned char *lc); extern unsigned short CNStoBIG5(unsigned short cns, unsigned char lc); extern void LocalToUtf(const unsigned char *iso, unsigned char *utf, const pg_local_to_utf *map, const pg_local_to_utf_combined *cmap, int size1, int size2, int encoding, int len); extern void UtfToLocal(const unsigned char *utf, unsigned char *iso, const pg_utf_to_local *map, const pg_utf_to_local_combined *cmap, int size1, int size2, int encoding, int len); extern bool pg_verifymbstr(const char *mbstr, int len, bool noError); extern bool pg_verify_mbstr(int encoding, const char *mbstr, int len, bool noError); extern int pg_verify_mbstr_len(int encoding, const char *mbstr, int len, bool noError); extern void check_encoding_conversion_args(int src_encoding, int dest_encoding, int len, int expected_src_encoding, int expected_dest_encoding); extern void report_invalid_encoding(int encoding, const char *mbstr, int len); extern void report_untranslatable_char(int src_encoding, int dest_encoding, const char *mbstr, int len); extern void pg_ascii2mic(const unsigned char *l, unsigned char *p, int len); extern void pg_mic2ascii(const unsigned char *mic, unsigned char *p, int len); extern void latin2mic(const unsigned char *l, unsigned char *p, int len, int lc, int encoding); extern void mic2latin(const unsigned char *mic, unsigned char *p, int len, int lc, int encoding); extern void latin2mic_with_table(const unsigned char *l, unsigned char *p, int len, int lc, int encoding, const unsigned char *tab); extern void mic2latin_with_table(const unsigned char *mic, unsigned char *p, int len, int lc, int encoding, const unsigned char *tab); extern bool pg_utf8_islegal(const unsigned char *source, int length); #ifdef WIN32 extern WCHAR *pgwin32_toUTF16(const char *str, int len, int *utf16len); #endif #endif /* PG_WCHAR_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/tcop/utility.h�������������������������������������������������������������������������0000644�����������������00000002645�14763166026�0012043 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * utility.h * prototypes for utility.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/tcop/utility.h * *------------------------------------------------------------------------- */ #ifndef UTILITY_H #define UTILITY_H #include "tcop/tcopprot.h" /* Hook for plugins to get control in ProcessUtility() */ typedef void (*ProcessUtility_hook_type) (Node *parsetree, const char *queryString, ParamListInfo params, bool isTopLevel, DestReceiver *dest, char *completionTag); extern PGDLLIMPORT ProcessUtility_hook_type ProcessUtility_hook; extern void ProcessUtility(Node *parsetree, const char *queryString, ParamListInfo params, bool isTopLevel, DestReceiver *dest, char *completionTag); extern void standard_ProcessUtility(Node *parsetree, const char *queryString, ParamListInfo params, bool isTopLevel, DestReceiver *dest, char *completionTag); extern bool UtilityReturnsTuples(Node *parsetree); extern TupleDesc UtilityTupleDescriptor(Node *parsetree); extern Query *UtilityContainsQuery(Node *parsetree); extern const char *CreateCommandTag(Node *parsetree); extern LogStmtLevel GetCommandLogLevel(Node *parsetree); extern bool CommandIsReadOnly(Node *parsetree); #endif /* UTILITY_H */ �������������������������������������������������������������������������������������������pgsql/server/tcop/dest.h����������������������������������������������������������������������������0000644�����������������00000013055�14763166026�0011274 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * dest.h * support for communication destinations * * Whenever the backend executes a query that returns tuples, the results * have to go someplace. For example: * * - stdout is the destination only when we are running a * standalone backend (no postmaster) and are returning results * back to an interactive user. * * - a remote process is the destination when we are * running a backend with a frontend and the frontend executes * PQexec() or PQfn(). In this case, the results are sent * to the frontend via the functions in backend/libpq. * * - DestNone is the destination when the system executes * a query internally. The results are discarded. * * dest.c defines three functions that implement destination management: * * BeginCommand: initialize the destination at start of command. * CreateDestReceiver: return a pointer to a struct of destination-specific * receiver functions. * EndCommand: clean up the destination at end of command. * * BeginCommand/EndCommand are executed once per received SQL query. * * CreateDestReceiver returns a receiver object appropriate to the specified * destination. The executor, as well as utility statements that can return * tuples, are passed the resulting DestReceiver* pointer. Each executor run * or utility execution calls the receiver's rStartup method, then the * receiveSlot method (zero or more times), then the rShutdown method. * The same receiver object may be re-used multiple times; eventually it is * destroyed by calling its rDestroy method. * * In some cases, receiver objects require additional parameters that must * be passed to them after calling CreateDestReceiver. Since the set of * parameters varies for different receiver types, this is not handled by * this module, but by direct calls from the calling code to receiver type * specific functions. * * The DestReceiver object returned by CreateDestReceiver may be a statically * allocated object (for destination types that require no local state), * in which case rDestroy is a no-op. Alternatively it can be a palloc'd * object that has DestReceiver as its first field and contains additional * fields (see printtup.c for an example). These additional fields are then * accessible to the DestReceiver functions by casting the DestReceiver* * pointer passed to them. The palloc'd object is pfree'd by the rDestroy * method. Note that the caller of CreateDestReceiver should take care to * do so in a memory context that is long-lived enough for the receiver * object not to disappear while still needed. * * Special provision: None_Receiver is a permanently available receiver * object for the DestNone destination. This avoids useless creation/destroy * calls in portal and cursor manipulations. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/tcop/dest.h * *------------------------------------------------------------------------- */ #ifndef DEST_H #define DEST_H #include "executor/tuptable.h" /* buffer size to use for command completion tags */ #define COMPLETION_TAG_BUFSIZE 64 /* ---------------- * CommandDest is a simplistic means of identifying the desired * destination. Someday this will probably need to be improved. * * Note: only the values DestNone, DestDebug, DestRemote are legal for the * global variable whereToSendOutput. The other values may be used * as the destination for individual commands. * ---------------- */ typedef enum { DestNone, /* results are discarded */ DestDebug, /* results go to debugging output */ DestRemote, /* results sent to frontend process */ DestRemoteExecute, /* sent to frontend, in Execute command */ DestSPI, /* results sent to SPI manager */ DestTuplestore, /* results sent to Tuplestore */ DestIntoRel, /* results sent to relation (SELECT INTO) */ DestCopyOut, /* results sent to COPY TO code */ DestSQLFunction /* results sent to SQL-language func mgr */ } CommandDest; /* ---------------- * DestReceiver is a base type for destination-specific local state. * In the simplest cases, there is no state info, just the function * pointers that the executor must call. * * Note: the receiveSlot routine must be passed a slot containing a TupleDesc * identical to the one given to the rStartup routine. * ---------------- */ typedef struct _DestReceiver DestReceiver; struct _DestReceiver { /* Called for each tuple to be output: */ void (*receiveSlot) (TupleTableSlot *slot, DestReceiver *self); /* Per-executor-run initialization and shutdown: */ void (*rStartup) (DestReceiver *self, int operation, TupleDesc typeinfo); void (*rShutdown) (DestReceiver *self); /* Destroy the receiver object itself (if dynamically allocated) */ void (*rDestroy) (DestReceiver *self); /* CommandDest code for this receiver */ CommandDest mydest; /* Private fields might appear beyond this point... */ }; extern DestReceiver *None_Receiver; /* permanent receiver for DestNone */ /* The primary destination management functions */ extern void BeginCommand(const char *commandTag, CommandDest dest); extern DestReceiver *CreateDestReceiver(CommandDest dest); extern void EndCommand(const char *commandTag, CommandDest dest); /* Additional functions that go with destination management, more or less. */ extern void NullCommand(CommandDest dest); extern void ReadyForQuery(CommandDest dest); #endif /* DEST_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/tcop/tcopprot.h������������������������������������������������������������������������0000644�����������������00000006550�14763166026�0012211 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * tcopprot.h * prototypes for postgres.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/tcop/tcopprot.h * * OLD COMMENTS * This file was created so that other c files could get the two * function prototypes without having to include tcop.h which single * handedly includes the whole f*cking tree -- mer 5 Nov. 1991 * *------------------------------------------------------------------------- */ #ifndef TCOPPROT_H #define TCOPPROT_H #include "executor/execdesc.h" #include "nodes/parsenodes.h" #include "storage/procsignal.h" #include "utils/guc.h" /* Required daylight between max_stack_depth and the kernel limit, in bytes */ #define STACK_DEPTH_SLOP (512 * 1024L) extern CommandDest whereToSendOutput; extern PGDLLIMPORT const char *debug_query_string; extern int max_stack_depth; extern int PostAuthDelay; /* GUC-configurable parameters */ typedef enum { LOGSTMT_NONE, /* log no statements */ LOGSTMT_DDL, /* log data definition statements */ LOGSTMT_MOD, /* log modification statements, plus DDL */ LOGSTMT_ALL /* log all statements */ } LogStmtLevel; extern int log_statement; /* Flags for restrict_nonsystem_relation_kind value */ #define RESTRICT_RELKIND_VIEW 0x01 #define RESTRICT_RELKIND_FOREIGN_TABLE 0x02 extern PGDLLIMPORT int restrict_nonsystem_relation_kind; extern List *pg_parse_query(const char *query_string); extern List *pg_analyze_and_rewrite(Node *parsetree, const char *query_string, Oid *paramTypes, int numParams); extern List *pg_analyze_and_rewrite_params(Node *parsetree, const char *query_string, ParserSetupHook parserSetup, void *parserSetupArg); extern PlannedStmt *pg_plan_query(Query *querytree, int cursorOptions, ParamListInfo boundParams); extern List *pg_plan_queries(List *querytrees, int cursorOptions, ParamListInfo boundParams); extern bool check_max_stack_depth(int *newval, void **extra, GucSource source); extern void assign_max_stack_depth(int newval, void *extra); extern bool check_restrict_nonsystem_relation_kind(char **newval, void **extra, GucSource source); extern void assign_restrict_nonsystem_relation_kind(const char *newval, void *extra); extern void die(SIGNAL_ARGS); extern void quickdie(SIGNAL_ARGS); extern void StatementCancelHandler(SIGNAL_ARGS); extern void FloatExceptionHandler(SIGNAL_ARGS); extern void RecoveryConflictInterrupt(ProcSignalReason reason); /* called from SIGUSR1 * handler */ extern void prepare_for_client_read(void); extern void client_read_ended(void); extern void process_postgres_switches(int argc, char *argv[], GucContext ctx, const char **dbname); extern int PostgresMain(int argc, char *argv[], const char *dbname, const char *username); extern long get_stack_depth_rlimit(void); extern void ResetUsage(void); extern void ShowUsage(const char *title); extern int check_log_duration(char *msec_str, bool was_logged); extern void set_debug_options(int debug_flag, GucContext context, GucSource source); extern bool set_plan_disabling_options(const char *arg, GucContext context, GucSource source); extern const char *get_stats_option_name(const char *arg); #endif /* TCOPPROT_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/tcop/tcopdebug.h�����������������������������������������������������������������������0000644�����������������00000002445�14763166026�0012312 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * tcopdebug.h * #defines governing debugging behaviour in the traffic cop * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/tcop/tcopdebug.h * *------------------------------------------------------------------------- */ #ifndef TCOPDEBUG_H #define TCOPDEBUG_H /* ---------------------------------------------------------------- * debugging defines. * * If you want certain debugging behaviour, then #define * the variable to 1, else #undef it. -cim 10/26/89 * ---------------------------------------------------------------- */ /* ---------------- * TCOP_SHOWSTATS controls whether or not buffer and * access method statistics are shown for each query. -cim 2/9/89 * ---------------- */ #undef TCOP_SHOWSTATS /* ---------------- * TCOP_DONTUSENEWLINE controls the default setting of * the UseNewLine variable in postgres.c * ---------------- */ #undef TCOP_DONTUSENEWLINE /* ---------------------------------------------------------------- * #defines controlled by above definitions * ---------------------------------------------------------------- */ #endif /* TCOPDEBUG_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/tcop/fastpath.h������������������������������������������������������������������������0000644�����������������00000001060�14763166026�0012140 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * fastpath.h * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/tcop/fastpath.h * *------------------------------------------------------------------------- */ #ifndef FASTPATH_H #define FASTPATH_H #include "lib/stringinfo.h" extern int GetOldFunctionMessage(StringInfo buf); extern void HandleFunctionRequest(StringInfo msgBuf); #endif /* FASTPATH_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/tcop/pquery.h��������������������������������������������������������������������������0000644�����������������00000002202�14763166026�0011652 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pquery.h * prototypes for pquery.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/tcop/pquery.h * *------------------------------------------------------------------------- */ #ifndef PQUERY_H #define PQUERY_H #include "nodes/parsenodes.h" #include "utils/portal.h" extern PGDLLIMPORT Portal ActivePortal; extern PortalStrategy ChoosePortalStrategy(List *stmts); extern List *FetchPortalTargetList(Portal portal); extern List *FetchStatementTargetList(Node *stmt); extern void PortalStart(Portal portal, ParamListInfo params, int eflags, Snapshot snapshot); extern void PortalSetResultFormat(Portal portal, int nFormats, int16 *formats); extern bool PortalRun(Portal portal, long count, bool isTopLevel, DestReceiver *dest, DestReceiver *altdest, char *completionTag); extern long PortalRunFetch(Portal portal, FetchDirection fdirection, long count, DestReceiver *dest); #endif /* PQUERY_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/rewrite/prs2lock.h���������������������������������������������������������������������0000644�����������������00000002056�14763166026�0012607 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * prs2lock.h * data structures for POSTGRES Rule System II (rewrite rules only) * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/rewrite/prs2lock.h * *------------------------------------------------------------------------- */ #ifndef PRS2LOCK_H #define PRS2LOCK_H #include "access/attnum.h" #include "nodes/pg_list.h" /* * RewriteRule - * holds a info for a rewrite rule * */ typedef struct RewriteRule { Oid ruleId; CmdType event; AttrNumber attrno; Node *qual; List *actions; char enabled; bool isInstead; } RewriteRule; /* * RuleLock - * all rules that apply to a particular relation. Even though we only * have the rewrite rule system left and these are not really "locks", * the name is kept for historical reasons. */ typedef struct RuleLock { int numLocks; RewriteRule **rules; } RuleLock; #endif /* REWRITE_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/rewrite/rewriteSupport.h���������������������������������������������������������������0000644�����������������00000001617�14763166026�0014130 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * rewriteSupport.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/rewrite/rewriteSupport.h * *------------------------------------------------------------------------- */ #ifndef REWRITESUPPORT_H #define REWRITESUPPORT_H /* The ON SELECT rule of a view is always named this: */ #define ViewSelectRuleName "_RETURN" extern bool IsDefinedRewriteRule(Oid owningRel, const char *ruleName); extern void SetRelationRuleStatus(Oid relationId, bool relHasRules, bool relIsBecomingView); extern Oid get_rewrite_oid(Oid relid, const char *rulename, bool missing_ok); extern Oid get_rewrite_oid_without_relid(const char *rulename, Oid *relid, bool missing_ok); #endif /* REWRITESUPPORT_H */ �����������������������������������������������������������������������������������������������������������������pgsql/server/rewrite/rewriteDefine.h����������������������������������������������������������������0000644�����������������00000002167�14763166026�0013647 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * rewriteDefine.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/rewrite/rewriteDefine.h * *------------------------------------------------------------------------- */ #ifndef REWRITEDEFINE_H #define REWRITEDEFINE_H #include "nodes/parsenodes.h" #include "utils/relcache.h" #define RULE_FIRES_ON_ORIGIN 'O' #define RULE_FIRES_ALWAYS 'A' #define RULE_FIRES_ON_REPLICA 'R' #define RULE_DISABLED 'D' extern void DefineRule(RuleStmt *stmt, const char *queryString); extern void DefineQueryRewrite(char *rulename, Oid event_relid, Node *event_qual, CmdType event_type, bool is_instead, bool replace, List *action); extern void RenameRewriteRule(Oid owningRel, const char *oldName, const char *newName); extern void setRuleCheckAsUser(Node *node, Oid userid); extern void EnableDisableRule(Relation rel, const char *rulename, char fires_when); #endif /* REWRITEDEFINE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/rewrite/rewriteRemove.h����������������������������������������������������������������0000644�����������������00000001031�14763166026�0013677 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * rewriteRemove.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/rewrite/rewriteRemove.h * *------------------------------------------------------------------------- */ #ifndef REWRITEREMOVE_H #define REWRITEREMOVE_H #include "nodes/parsenodes.h" extern void RemoveRewriteRuleById(Oid ruleOid); #endif /* REWRITEREMOVE_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/rewrite/rewriteHandler.h���������������������������������������������������������������0000644�����������������00000001403�14763166026�0014022 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * rewriteHandler.h * External interface to query rewriter. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/rewrite/rewriteHandler.h * *------------------------------------------------------------------------- */ #ifndef REWRITEHANDLER_H #define REWRITEHANDLER_H #include "utils/relcache.h" #include "nodes/parsenodes.h" extern List *QueryRewrite(Query *parsetree); extern void AcquireRewriteLocks(Query *parsetree, bool forExecute, bool forUpdatePushedDown); extern Node *build_column_default(Relation rel, int attrno); #endif /* REWRITEHANDLER_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/rewrite/rewriteManip.h�����������������������������������������������������������������0000644�����������������00000005314�14763166026�0013516 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * rewriteManip.h * Querytree manipulation subroutines for query rewriter. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/rewrite/rewriteManip.h * *------------------------------------------------------------------------- */ #ifndef REWRITEMANIP_H #define REWRITEMANIP_H #include "nodes/parsenodes.h" typedef struct replace_rte_variables_context replace_rte_variables_context; typedef Node *(*replace_rte_variables_callback) (Var *var, replace_rte_variables_context *context); struct replace_rte_variables_context { replace_rte_variables_callback callback; /* callback function */ void *callback_arg; /* context data for callback function */ int target_varno; /* RTE index to search for */ int sublevels_up; /* (current) nesting depth */ bool inserted_sublink; /* have we inserted a SubLink? */ }; extern void OffsetVarNodes(Node *node, int offset, int sublevels_up); extern void ChangeVarNodes(Node *node, int old_varno, int new_varno, int sublevels_up); extern void IncrementVarSublevelsUp(Node *node, int delta_sublevels_up, int min_sublevels_up); extern void IncrementVarSublevelsUp_rtable(List *rtable, int delta_sublevels_up, int min_sublevels_up); extern bool rangeTableEntry_used(Node *node, int rt_index, int sublevels_up); extern bool attribute_used(Node *node, int rt_index, int attno, int sublevels_up); extern Query *getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr); extern void AddQual(Query *parsetree, Node *qual); extern void AddInvertedQual(Query *parsetree, Node *qual); extern bool contain_aggs_of_level(Node *node, int levelsup); extern int locate_agg_of_level(Node *node, int levelsup); extern int locate_windowfunc(Node *node); extern bool checkExprHasAggs(Node *node); extern bool checkExprHasWindowFuncs(Node *node); extern bool checkExprHasSubLink(Node *node); extern Node *replace_rte_variables(Node *node, int target_varno, int sublevels_up, replace_rte_variables_callback callback, void *callback_arg, bool *outer_hasSubLinks); extern Node *replace_rte_variables_mutator(Node *node, replace_rte_variables_context *context); extern Node *map_variable_attnos(Node *node, int target_varno, int sublevels_up, const AttrNumber *attno_map, int map_length, bool *found_whole_row); extern Node *ResolveNew(Node *node, int target_varno, int sublevels_up, RangeTblEntry *target_rte, List *targetlist, int event, int update_varno, bool *outer_hasSubLinks); #endif /* REWRITEMANIP_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_index.h���������������������������������������������������������������������0000644�����������������00000007417�14763166026�0012604 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_index.h * definition of the system "index" relation (pg_index) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_index.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_INDEX_H #define PG_INDEX_H #include "catalog/genbki.h" /* ---------------- * pg_index definition. cpp turns this into * typedef struct FormData_pg_index. * ---------------- */ #define IndexRelationId 2610 CATALOG(pg_index,2610) BKI_WITHOUT_OIDS BKI_SCHEMA_MACRO { Oid indexrelid; /* OID of the index */ Oid indrelid; /* OID of the relation it indexes */ int2 indnatts; /* number of columns in index */ bool indisunique; /* is this a unique index? */ bool indisprimary; /* is this index for primary key? */ bool indisexclusion; /* is this index for exclusion constraint? */ bool indimmediate; /* is uniqueness enforced immediately? */ bool indisclustered; /* is this the index last clustered by? */ bool indisvalid; /* is this index valid for use by queries? */ bool indcheckxmin; /* must we wait for xmin to be old? */ bool indisready; /* is this index ready for inserts? */ /* variable-length fields start here, but we allow direct access to indkey */ int2vector indkey; /* column numbers of indexed cols, or 0 */ #ifdef CATALOG_VARLEN oidvector indcollation; /* collation identifiers */ oidvector indclass; /* opclass identifiers */ int2vector indoption; /* per-column flags (AM-specific meanings) */ pg_node_tree indexprs; /* expression trees for index attributes that * are not simple column references; one for * each zero entry in indkey[] */ pg_node_tree indpred; /* expression tree for predicate, if a partial * index; else NULL */ #endif } FormData_pg_index; /* ---------------- * Form_pg_index corresponds to a pointer to a tuple with * the format of pg_index relation. * ---------------- */ typedef FormData_pg_index *Form_pg_index; /* ---------------- * compiler constants for pg_index * ---------------- */ #define Natts_pg_index 17 #define Anum_pg_index_indexrelid 1 #define Anum_pg_index_indrelid 2 #define Anum_pg_index_indnatts 3 #define Anum_pg_index_indisunique 4 #define Anum_pg_index_indisprimary 5 #define Anum_pg_index_indisexclusion 6 #define Anum_pg_index_indimmediate 7 #define Anum_pg_index_indisclustered 8 #define Anum_pg_index_indisvalid 9 #define Anum_pg_index_indcheckxmin 10 #define Anum_pg_index_indisready 11 #define Anum_pg_index_indkey 12 #define Anum_pg_index_indcollation 13 #define Anum_pg_index_indclass 14 #define Anum_pg_index_indoption 15 #define Anum_pg_index_indexprs 16 #define Anum_pg_index_indpred 17 /* * Index AMs that support ordered scans must support these two indoption * bits. Otherwise, the content of the per-column indoption fields is * open for future definition. */ #define INDOPTION_DESC 0x0001 /* values are in reverse order */ #define INDOPTION_NULLS_FIRST 0x0002 /* NULLs are first instead of last */ /* * Use of these macros is recommended over direct examination of the state * flag columns where possible; this allows source code compatibility with * the less ugly representation used after 9.2. */ #define IndexIsValid(indexForm) ((indexForm)->indisvalid && (indexForm)->indisready) #define IndexIsReady(indexForm) ((indexForm)->indisready) #define IndexIsLive(indexForm) ((indexForm)->indisready || !(indexForm)->indisvalid) #endif /* PG_INDEX_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_operator.h������������������������������������������������������������������0000644�����������������00000277357�14763166026�0013344 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_operator.h * definition of the system "operator" relation (pg_operator) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_operator.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * * XXX do NOT break up DATA() statements into multiple lines! * the scripts are not as smart as you might think... * *------------------------------------------------------------------------- */ #ifndef PG_OPERATOR_H #define PG_OPERATOR_H #include "catalog/genbki.h" #include "nodes/pg_list.h" /* ---------------- * pg_operator definition. cpp turns this into * typedef struct FormData_pg_operator * ---------------- */ #define OperatorRelationId 2617 CATALOG(pg_operator,2617) { NameData oprname; /* name of operator */ Oid oprnamespace; /* OID of namespace containing this oper */ Oid oprowner; /* operator owner */ char oprkind; /* 'l', 'r', or 'b' */ bool oprcanmerge; /* can be used in merge join? */ bool oprcanhash; /* can be used in hash join? */ Oid oprleft; /* left arg type, or 0 if 'l' oprkind */ Oid oprright; /* right arg type, or 0 if 'r' oprkind */ Oid oprresult; /* result datatype */ Oid oprcom; /* OID of commutator oper, or 0 if none */ Oid oprnegate; /* OID of negator oper, or 0 if none */ regproc oprcode; /* OID of underlying function */ regproc oprrest; /* OID of restriction estimator, or 0 */ regproc oprjoin; /* OID of join estimator, or 0 */ } FormData_pg_operator; /* ---------------- * Form_pg_operator corresponds to a pointer to a tuple with * the format of pg_operator relation. * ---------------- */ typedef FormData_pg_operator *Form_pg_operator; /* ---------------- * compiler constants for pg_operator * ---------------- */ #define Natts_pg_operator 14 #define Anum_pg_operator_oprname 1 #define Anum_pg_operator_oprnamespace 2 #define Anum_pg_operator_oprowner 3 #define Anum_pg_operator_oprkind 4 #define Anum_pg_operator_oprcanmerge 5 #define Anum_pg_operator_oprcanhash 6 #define Anum_pg_operator_oprleft 7 #define Anum_pg_operator_oprright 8 #define Anum_pg_operator_oprresult 9 #define Anum_pg_operator_oprcom 10 #define Anum_pg_operator_oprnegate 11 #define Anum_pg_operator_oprcode 12 #define Anum_pg_operator_oprrest 13 #define Anum_pg_operator_oprjoin 14 /* ---------------- * initial contents of pg_operator * ---------------- */ /* * Note: every entry in pg_operator.h is expected to have a DESCR() comment. * If the operator is a deprecated equivalent of some other entry, be sure * to comment it as such so that initdb doesn't think it's a preferred name * for the underlying function. */ DATA(insert OID = 15 ( "=" PGNSP PGUID b t t 23 20 16 416 36 int48eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 36 ( "<>" PGNSP PGUID b f f 23 20 16 417 15 int48ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 37 ( "<" PGNSP PGUID b f f 23 20 16 419 82 int48lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 76 ( ">" PGNSP PGUID b f f 23 20 16 418 80 int48gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 80 ( "<=" PGNSP PGUID b f f 23 20 16 430 76 int48le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 82 ( ">=" PGNSP PGUID b f f 23 20 16 420 37 int48ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 58 ( "<" PGNSP PGUID b f f 16 16 16 59 1695 boollt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 59 ( ">" PGNSP PGUID b f f 16 16 16 58 1694 boolgt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 85 ( "<>" PGNSP PGUID b f f 16 16 16 85 91 boolne neqsel neqjoinsel )); DESCR("not equal"); #define BooleanNotEqualOperator 85 DATA(insert OID = 91 ( "=" PGNSP PGUID b t t 16 16 16 91 85 booleq eqsel eqjoinsel )); DESCR("equal"); #define BooleanEqualOperator 91 DATA(insert OID = 1694 ( "<=" PGNSP PGUID b f f 16 16 16 1695 59 boolle scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 1695 ( ">=" PGNSP PGUID b f f 16 16 16 1694 58 boolge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 92 ( "=" PGNSP PGUID b t t 18 18 16 92 630 chareq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 93 ( "=" PGNSP PGUID b t t 19 19 16 93 643 nameeq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 94 ( "=" PGNSP PGUID b t t 21 21 16 94 519 int2eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 95 ( "<" PGNSP PGUID b f f 21 21 16 520 524 int2lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 96 ( "=" PGNSP PGUID b t t 23 23 16 96 518 int4eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 97 ( "<" PGNSP PGUID b f f 23 23 16 521 525 int4lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 98 ( "=" PGNSP PGUID b t t 25 25 16 98 531 texteq eqsel eqjoinsel )); DESCR("equal"); #define TextEqualOperator 98 DATA(insert OID = 349 ( "||" PGNSP PGUID b f f 2277 2283 2277 0 0 array_append - - )); DESCR("append element onto end of array"); DATA(insert OID = 374 ( "||" PGNSP PGUID b f f 2283 2277 2277 0 0 array_prepend - - )); DESCR("prepend element onto front of array"); DATA(insert OID = 375 ( "||" PGNSP PGUID b f f 2277 2277 2277 0 0 array_cat - - )); DESCR("concatenate"); DATA(insert OID = 352 ( "=" PGNSP PGUID b f t 28 28 16 352 0 xideq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 353 ( "=" PGNSP PGUID b f f 28 23 16 0 0 xideqint4 eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 388 ( "!" PGNSP PGUID r f f 20 0 1700 0 0 numeric_fac - - )); DESCR("factorial"); DATA(insert OID = 389 ( "!!" PGNSP PGUID l f f 0 20 1700 0 0 numeric_fac - - )); DESCR("deprecated, use ! instead"); DATA(insert OID = 385 ( "=" PGNSP PGUID b f t 29 29 16 385 0 cideq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 386 ( "=" PGNSP PGUID b f t 22 22 16 386 0 int2vectoreq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 387 ( "=" PGNSP PGUID b t f 27 27 16 387 402 tideq eqsel eqjoinsel )); DESCR("equal"); #define TIDEqualOperator 387 DATA(insert OID = 402 ( "<>" PGNSP PGUID b f f 27 27 16 402 387 tidne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 2799 ( "<" PGNSP PGUID b f f 27 27 16 2800 2802 tidlt scalarltsel scalarltjoinsel )); DESCR("less than"); #define TIDLessOperator 2799 DATA(insert OID = 2800 ( ">" PGNSP PGUID b f f 27 27 16 2799 2801 tidgt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 2801 ( "<=" PGNSP PGUID b f f 27 27 16 2802 2800 tidle scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 2802 ( ">=" PGNSP PGUID b f f 27 27 16 2801 2799 tidge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 410 ( "=" PGNSP PGUID b t t 20 20 16 410 411 int8eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 411 ( "<>" PGNSP PGUID b f f 20 20 16 411 410 int8ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 412 ( "<" PGNSP PGUID b f f 20 20 16 413 415 int8lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 413 ( ">" PGNSP PGUID b f f 20 20 16 412 414 int8gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 414 ( "<=" PGNSP PGUID b f f 20 20 16 415 413 int8le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 415 ( ">=" PGNSP PGUID b f f 20 20 16 414 412 int8ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 416 ( "=" PGNSP PGUID b t t 20 23 16 15 417 int84eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 417 ( "<>" PGNSP PGUID b f f 20 23 16 36 416 int84ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 418 ( "<" PGNSP PGUID b f f 20 23 16 76 430 int84lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 419 ( ">" PGNSP PGUID b f f 20 23 16 37 420 int84gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 420 ( "<=" PGNSP PGUID b f f 20 23 16 82 419 int84le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 430 ( ">=" PGNSP PGUID b f f 20 23 16 80 418 int84ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 439 ( "%" PGNSP PGUID b f f 20 20 20 0 0 int8mod - - )); DESCR("modulus"); DATA(insert OID = 473 ( "@" PGNSP PGUID l f f 0 20 20 0 0 int8abs - - )); DESCR("absolute value"); DATA(insert OID = 484 ( "-" PGNSP PGUID l f f 0 20 20 0 0 int8um - - )); DESCR("negate"); DATA(insert OID = 485 ( "<<" PGNSP PGUID b f f 604 604 16 0 0 poly_left positionsel positionjoinsel )); DESCR("is left of"); DATA(insert OID = 486 ( "&<" PGNSP PGUID b f f 604 604 16 0 0 poly_overleft positionsel positionjoinsel )); DESCR("overlaps or is left of"); DATA(insert OID = 487 ( "&>" PGNSP PGUID b f f 604 604 16 0 0 poly_overright positionsel positionjoinsel )); DESCR("overlaps or is right of"); DATA(insert OID = 488 ( ">>" PGNSP PGUID b f f 604 604 16 0 0 poly_right positionsel positionjoinsel )); DESCR("is right of"); DATA(insert OID = 489 ( "<@" PGNSP PGUID b f f 604 604 16 490 0 poly_contained contsel contjoinsel )); DESCR("is contained by"); DATA(insert OID = 490 ( "@>" PGNSP PGUID b f f 604 604 16 489 0 poly_contain contsel contjoinsel )); DESCR("contains"); DATA(insert OID = 491 ( "~=" PGNSP PGUID b f f 604 604 16 491 0 poly_same eqsel eqjoinsel )); DESCR("same as"); DATA(insert OID = 492 ( "&&" PGNSP PGUID b f f 604 604 16 492 0 poly_overlap areasel areajoinsel )); DESCR("overlaps"); DATA(insert OID = 493 ( "<<" PGNSP PGUID b f f 603 603 16 0 0 box_left positionsel positionjoinsel )); DESCR("is left of"); DATA(insert OID = 494 ( "&<" PGNSP PGUID b f f 603 603 16 0 0 box_overleft positionsel positionjoinsel )); DESCR("overlaps or is left of"); DATA(insert OID = 495 ( "&>" PGNSP PGUID b f f 603 603 16 0 0 box_overright positionsel positionjoinsel )); DESCR("overlaps or is right of"); DATA(insert OID = 496 ( ">>" PGNSP PGUID b f f 603 603 16 0 0 box_right positionsel positionjoinsel )); DESCR("is right of"); DATA(insert OID = 497 ( "<@" PGNSP PGUID b f f 603 603 16 498 0 box_contained contsel contjoinsel )); DESCR("is contained by"); DATA(insert OID = 498 ( "@>" PGNSP PGUID b f f 603 603 16 497 0 box_contain contsel contjoinsel )); DESCR("contains"); DATA(insert OID = 499 ( "~=" PGNSP PGUID b f f 603 603 16 499 0 box_same eqsel eqjoinsel )); DESCR("same as"); DATA(insert OID = 500 ( "&&" PGNSP PGUID b f f 603 603 16 500 0 box_overlap areasel areajoinsel )); DESCR("overlaps"); DATA(insert OID = 501 ( ">=" PGNSP PGUID b f f 603 603 16 505 504 box_ge areasel areajoinsel )); DESCR("greater than or equal by area"); DATA(insert OID = 502 ( ">" PGNSP PGUID b f f 603 603 16 504 505 box_gt areasel areajoinsel )); DESCR("greater than by area"); DATA(insert OID = 503 ( "=" PGNSP PGUID b f f 603 603 16 503 0 box_eq eqsel eqjoinsel )); DESCR("equal by area"); DATA(insert OID = 504 ( "<" PGNSP PGUID b f f 603 603 16 502 501 box_lt areasel areajoinsel )); DESCR("less than by area"); DATA(insert OID = 505 ( "<=" PGNSP PGUID b f f 603 603 16 501 502 box_le areasel areajoinsel )); DESCR("less than or equal by area"); DATA(insert OID = 506 ( ">^" PGNSP PGUID b f f 600 600 16 0 0 point_above positionsel positionjoinsel )); DESCR("is above"); DATA(insert OID = 507 ( "<<" PGNSP PGUID b f f 600 600 16 0 0 point_left positionsel positionjoinsel )); DESCR("is left of"); DATA(insert OID = 508 ( ">>" PGNSP PGUID b f f 600 600 16 0 0 point_right positionsel positionjoinsel )); DESCR("is right of"); DATA(insert OID = 509 ( "<^" PGNSP PGUID b f f 600 600 16 0 0 point_below positionsel positionjoinsel )); DESCR("is below"); DATA(insert OID = 510 ( "~=" PGNSP PGUID b f f 600 600 16 510 713 point_eq eqsel eqjoinsel )); DESCR("same as"); DATA(insert OID = 511 ( "<@" PGNSP PGUID b f f 600 603 16 433 0 on_pb contsel contjoinsel )); DESCR("point inside box"); DATA(insert OID = 433 ( "@>" PGNSP PGUID b f f 603 600 16 511 0 box_contain_pt contsel contjoinsel )); DESCR("contains"); DATA(insert OID = 512 ( "<@" PGNSP PGUID b f f 600 602 16 755 0 on_ppath - - )); DESCR("point within closed path, or point on open path"); DATA(insert OID = 513 ( "@@" PGNSP PGUID l f f 0 603 600 0 0 box_center - - )); DESCR("center of"); DATA(insert OID = 514 ( "*" PGNSP PGUID b f f 23 23 23 514 0 int4mul - - )); DESCR("multiply"); DATA(insert OID = 517 ( "<->" PGNSP PGUID b f f 600 600 701 517 0 point_distance - - )); DESCR("distance between"); DATA(insert OID = 518 ( "<>" PGNSP PGUID b f f 23 23 16 518 96 int4ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 519 ( "<>" PGNSP PGUID b f f 21 21 16 519 94 int2ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 520 ( ">" PGNSP PGUID b f f 21 21 16 95 522 int2gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 521 ( ">" PGNSP PGUID b f f 23 23 16 97 523 int4gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 522 ( "<=" PGNSP PGUID b f f 21 21 16 524 520 int2le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 523 ( "<=" PGNSP PGUID b f f 23 23 16 525 521 int4le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 524 ( ">=" PGNSP PGUID b f f 21 21 16 522 95 int2ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 525 ( ">=" PGNSP PGUID b f f 23 23 16 523 97 int4ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 526 ( "*" PGNSP PGUID b f f 21 21 21 526 0 int2mul - - )); DESCR("multiply"); DATA(insert OID = 527 ( "/" PGNSP PGUID b f f 21 21 21 0 0 int2div - - )); DESCR("divide"); DATA(insert OID = 528 ( "/" PGNSP PGUID b f f 23 23 23 0 0 int4div - - )); DESCR("divide"); DATA(insert OID = 529 ( "%" PGNSP PGUID b f f 21 21 21 0 0 int2mod - - )); DESCR("modulus"); DATA(insert OID = 530 ( "%" PGNSP PGUID b f f 23 23 23 0 0 int4mod - - )); DESCR("modulus"); DATA(insert OID = 531 ( "<>" PGNSP PGUID b f f 25 25 16 531 98 textne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 532 ( "=" PGNSP PGUID b t t 21 23 16 533 538 int24eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 533 ( "=" PGNSP PGUID b t t 23 21 16 532 539 int42eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 534 ( "<" PGNSP PGUID b f f 21 23 16 537 542 int24lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 535 ( "<" PGNSP PGUID b f f 23 21 16 536 543 int42lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 536 ( ">" PGNSP PGUID b f f 21 23 16 535 540 int24gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 537 ( ">" PGNSP PGUID b f f 23 21 16 534 541 int42gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 538 ( "<>" PGNSP PGUID b f f 21 23 16 539 532 int24ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 539 ( "<>" PGNSP PGUID b f f 23 21 16 538 533 int42ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 540 ( "<=" PGNSP PGUID b f f 21 23 16 543 536 int24le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 541 ( "<=" PGNSP PGUID b f f 23 21 16 542 537 int42le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 542 ( ">=" PGNSP PGUID b f f 21 23 16 541 534 int24ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 543 ( ">=" PGNSP PGUID b f f 23 21 16 540 535 int42ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 544 ( "*" PGNSP PGUID b f f 21 23 23 545 0 int24mul - - )); DESCR("multiply"); DATA(insert OID = 545 ( "*" PGNSP PGUID b f f 23 21 23 544 0 int42mul - - )); DESCR("multiply"); DATA(insert OID = 546 ( "/" PGNSP PGUID b f f 21 23 23 0 0 int24div - - )); DESCR("divide"); DATA(insert OID = 547 ( "/" PGNSP PGUID b f f 23 21 23 0 0 int42div - - )); DESCR("divide"); DATA(insert OID = 550 ( "+" PGNSP PGUID b f f 21 21 21 550 0 int2pl - - )); DESCR("add"); DATA(insert OID = 551 ( "+" PGNSP PGUID b f f 23 23 23 551 0 int4pl - - )); DESCR("add"); DATA(insert OID = 552 ( "+" PGNSP PGUID b f f 21 23 23 553 0 int24pl - - )); DESCR("add"); DATA(insert OID = 553 ( "+" PGNSP PGUID b f f 23 21 23 552 0 int42pl - - )); DESCR("add"); DATA(insert OID = 554 ( "-" PGNSP PGUID b f f 21 21 21 0 0 int2mi - - )); DESCR("subtract"); DATA(insert OID = 555 ( "-" PGNSP PGUID b f f 23 23 23 0 0 int4mi - - )); DESCR("subtract"); DATA(insert OID = 556 ( "-" PGNSP PGUID b f f 21 23 23 0 0 int24mi - - )); DESCR("subtract"); DATA(insert OID = 557 ( "-" PGNSP PGUID b f f 23 21 23 0 0 int42mi - - )); DESCR("subtract"); DATA(insert OID = 558 ( "-" PGNSP PGUID l f f 0 23 23 0 0 int4um - - )); DESCR("negate"); DATA(insert OID = 559 ( "-" PGNSP PGUID l f f 0 21 21 0 0 int2um - - )); DESCR("negate"); DATA(insert OID = 560 ( "=" PGNSP PGUID b t t 702 702 16 560 561 abstimeeq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 561 ( "<>" PGNSP PGUID b f f 702 702 16 561 560 abstimene neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 562 ( "<" PGNSP PGUID b f f 702 702 16 563 565 abstimelt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 563 ( ">" PGNSP PGUID b f f 702 702 16 562 564 abstimegt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 564 ( "<=" PGNSP PGUID b f f 702 702 16 565 563 abstimele scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 565 ( ">=" PGNSP PGUID b f f 702 702 16 564 562 abstimege scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 566 ( "=" PGNSP PGUID b t t 703 703 16 566 567 reltimeeq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 567 ( "<>" PGNSP PGUID b f f 703 703 16 567 566 reltimene neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 568 ( "<" PGNSP PGUID b f f 703 703 16 569 571 reltimelt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 569 ( ">" PGNSP PGUID b f f 703 703 16 568 570 reltimegt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 570 ( "<=" PGNSP PGUID b f f 703 703 16 571 569 reltimele scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 571 ( ">=" PGNSP PGUID b f f 703 703 16 570 568 reltimege scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 572 ( "~=" PGNSP PGUID b f f 704 704 16 572 0 tintervalsame eqsel eqjoinsel )); DESCR("same as"); DATA(insert OID = 573 ( "<<" PGNSP PGUID b f f 704 704 16 0 0 tintervalct - - )); DESCR("contains"); DATA(insert OID = 574 ( "&&" PGNSP PGUID b f f 704 704 16 574 0 tintervalov - - )); DESCR("overlaps"); DATA(insert OID = 575 ( "#=" PGNSP PGUID b f f 704 703 16 0 576 tintervalleneq - - )); DESCR("equal by length"); DATA(insert OID = 576 ( "#<>" PGNSP PGUID b f f 704 703 16 0 575 tintervallenne - - )); DESCR("not equal by length"); DATA(insert OID = 577 ( "#<" PGNSP PGUID b f f 704 703 16 0 580 tintervallenlt - - )); DESCR("less than by length"); DATA(insert OID = 578 ( "#>" PGNSP PGUID b f f 704 703 16 0 579 tintervallengt - - )); DESCR("greater than by length"); DATA(insert OID = 579 ( "#<=" PGNSP PGUID b f f 704 703 16 0 578 tintervallenle - - )); DESCR("less than or equal by length"); DATA(insert OID = 580 ( "#>=" PGNSP PGUID b f f 704 703 16 0 577 tintervallenge - - )); DESCR("greater than or equal by length"); DATA(insert OID = 581 ( "+" PGNSP PGUID b f f 702 703 702 0 0 timepl - - )); DESCR("add"); DATA(insert OID = 582 ( "-" PGNSP PGUID b f f 702 703 702 0 0 timemi - - )); DESCR("subtract"); DATA(insert OID = 583 ( "<?>" PGNSP PGUID b f f 702 704 16 0 0 intinterval - - )); DESCR("is contained by"); DATA(insert OID = 584 ( "-" PGNSP PGUID l f f 0 700 700 0 0 float4um - - )); DESCR("negate"); DATA(insert OID = 585 ( "-" PGNSP PGUID l f f 0 701 701 0 0 float8um - - )); DESCR("negate"); DATA(insert OID = 586 ( "+" PGNSP PGUID b f f 700 700 700 586 0 float4pl - - )); DESCR("add"); DATA(insert OID = 587 ( "-" PGNSP PGUID b f f 700 700 700 0 0 float4mi - - )); DESCR("subtract"); DATA(insert OID = 588 ( "/" PGNSP PGUID b f f 700 700 700 0 0 float4div - - )); DESCR("divide"); DATA(insert OID = 589 ( "*" PGNSP PGUID b f f 700 700 700 589 0 float4mul - - )); DESCR("multiply"); DATA(insert OID = 590 ( "@" PGNSP PGUID l f f 0 700 700 0 0 float4abs - - )); DESCR("absolute value"); DATA(insert OID = 591 ( "+" PGNSP PGUID b f f 701 701 701 591 0 float8pl - - )); DESCR("add"); DATA(insert OID = 592 ( "-" PGNSP PGUID b f f 701 701 701 0 0 float8mi - - )); DESCR("subtract"); DATA(insert OID = 593 ( "/" PGNSP PGUID b f f 701 701 701 0 0 float8div - - )); DESCR("divide"); DATA(insert OID = 594 ( "*" PGNSP PGUID b f f 701 701 701 594 0 float8mul - - )); DESCR("multiply"); DATA(insert OID = 595 ( "@" PGNSP PGUID l f f 0 701 701 0 0 float8abs - - )); DESCR("absolute value"); DATA(insert OID = 596 ( "|/" PGNSP PGUID l f f 0 701 701 0 0 dsqrt - - )); DESCR("square root"); DATA(insert OID = 597 ( "||/" PGNSP PGUID l f f 0 701 701 0 0 dcbrt - - )); DESCR("cube root"); DATA(insert OID = 1284 ( "|" PGNSP PGUID l f f 0 704 702 0 0 tintervalstart - - )); DESCR("start of interval"); DATA(insert OID = 606 ( "<#>" PGNSP PGUID b f f 702 702 704 0 0 mktinterval - - )); DESCR("convert to tinterval"); DATA(insert OID = 607 ( "=" PGNSP PGUID b t t 26 26 16 607 608 oideq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 608 ( "<>" PGNSP PGUID b f f 26 26 16 608 607 oidne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 609 ( "<" PGNSP PGUID b f f 26 26 16 610 612 oidlt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 610 ( ">" PGNSP PGUID b f f 26 26 16 609 611 oidgt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 611 ( "<=" PGNSP PGUID b f f 26 26 16 612 610 oidle scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 612 ( ">=" PGNSP PGUID b f f 26 26 16 611 609 oidge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 644 ( "<>" PGNSP PGUID b f f 30 30 16 644 649 oidvectorne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 645 ( "<" PGNSP PGUID b f f 30 30 16 646 648 oidvectorlt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 646 ( ">" PGNSP PGUID b f f 30 30 16 645 647 oidvectorgt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 647 ( "<=" PGNSP PGUID b f f 30 30 16 648 646 oidvectorle scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 648 ( ">=" PGNSP PGUID b f f 30 30 16 647 645 oidvectorge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 649 ( "=" PGNSP PGUID b t t 30 30 16 649 644 oidvectoreq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 613 ( "<->" PGNSP PGUID b f f 600 628 701 0 0 dist_pl - - )); DESCR("distance between"); DATA(insert OID = 614 ( "<->" PGNSP PGUID b f f 600 601 701 0 0 dist_ps - - )); DESCR("distance between"); DATA(insert OID = 615 ( "<->" PGNSP PGUID b f f 600 603 701 0 0 dist_pb - - )); DESCR("distance between"); DATA(insert OID = 616 ( "<->" PGNSP PGUID b f f 601 628 701 0 0 dist_sl - - )); DESCR("distance between"); DATA(insert OID = 617 ( "<->" PGNSP PGUID b f f 601 603 701 0 0 dist_sb - - )); DESCR("distance between"); DATA(insert OID = 618 ( "<->" PGNSP PGUID b f f 600 602 701 0 0 dist_ppath - - )); DESCR("distance between"); DATA(insert OID = 620 ( "=" PGNSP PGUID b t t 700 700 16 620 621 float4eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 621 ( "<>" PGNSP PGUID b f f 700 700 16 621 620 float4ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 622 ( "<" PGNSP PGUID b f f 700 700 16 623 625 float4lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 623 ( ">" PGNSP PGUID b f f 700 700 16 622 624 float4gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 624 ( "<=" PGNSP PGUID b f f 700 700 16 625 623 float4le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 625 ( ">=" PGNSP PGUID b f f 700 700 16 624 622 float4ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 630 ( "<>" PGNSP PGUID b f f 18 18 16 630 92 charne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 631 ( "<" PGNSP PGUID b f f 18 18 16 633 634 charlt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 632 ( "<=" PGNSP PGUID b f f 18 18 16 634 633 charle scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 633 ( ">" PGNSP PGUID b f f 18 18 16 631 632 chargt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 634 ( ">=" PGNSP PGUID b f f 18 18 16 632 631 charge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 639 ( "~" PGNSP PGUID b f f 19 25 16 0 640 nameregexeq regexeqsel regexeqjoinsel )); DESCR("matches regular expression, case-sensitive"); #define OID_NAME_REGEXEQ_OP 639 DATA(insert OID = 640 ( "!~" PGNSP PGUID b f f 19 25 16 0 639 nameregexne regexnesel regexnejoinsel )); DESCR("does not match regular expression, case-sensitive"); DATA(insert OID = 641 ( "~" PGNSP PGUID b f f 25 25 16 0 642 textregexeq regexeqsel regexeqjoinsel )); DESCR("matches regular expression, case-sensitive"); #define OID_TEXT_REGEXEQ_OP 641 DATA(insert OID = 642 ( "!~" PGNSP PGUID b f f 25 25 16 0 641 textregexne regexnesel regexnejoinsel )); DESCR("does not match regular expression, case-sensitive"); DATA(insert OID = 643 ( "<>" PGNSP PGUID b f f 19 19 16 643 93 namene neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 654 ( "||" PGNSP PGUID b f f 25 25 25 0 0 textcat - - )); DESCR("concatenate"); DATA(insert OID = 660 ( "<" PGNSP PGUID b f f 19 19 16 662 663 namelt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 661 ( "<=" PGNSP PGUID b f f 19 19 16 663 662 namele scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 662 ( ">" PGNSP PGUID b f f 19 19 16 660 661 namegt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 663 ( ">=" PGNSP PGUID b f f 19 19 16 661 660 namege scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 664 ( "<" PGNSP PGUID b f f 25 25 16 666 667 text_lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 665 ( "<=" PGNSP PGUID b f f 25 25 16 667 666 text_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 666 ( ">" PGNSP PGUID b f f 25 25 16 664 665 text_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 667 ( ">=" PGNSP PGUID b f f 25 25 16 665 664 text_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 670 ( "=" PGNSP PGUID b t t 701 701 16 670 671 float8eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 671 ( "<>" PGNSP PGUID b f f 701 701 16 671 670 float8ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 672 ( "<" PGNSP PGUID b f f 701 701 16 674 675 float8lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 673 ( "<=" PGNSP PGUID b f f 701 701 16 675 674 float8le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 674 ( ">" PGNSP PGUID b f f 701 701 16 672 673 float8gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 675 ( ">=" PGNSP PGUID b f f 701 701 16 673 672 float8ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 682 ( "@" PGNSP PGUID l f f 0 21 21 0 0 int2abs - - )); DESCR("absolute value"); DATA(insert OID = 684 ( "+" PGNSP PGUID b f f 20 20 20 684 0 int8pl - - )); DESCR("add"); DATA(insert OID = 685 ( "-" PGNSP PGUID b f f 20 20 20 0 0 int8mi - - )); DESCR("subtract"); DATA(insert OID = 686 ( "*" PGNSP PGUID b f f 20 20 20 686 0 int8mul - - )); DESCR("multiply"); DATA(insert OID = 687 ( "/" PGNSP PGUID b f f 20 20 20 0 0 int8div - - )); DESCR("divide"); DATA(insert OID = 688 ( "+" PGNSP PGUID b f f 20 23 20 692 0 int84pl - - )); DESCR("add"); DATA(insert OID = 689 ( "-" PGNSP PGUID b f f 20 23 20 0 0 int84mi - - )); DESCR("subtract"); DATA(insert OID = 690 ( "*" PGNSP PGUID b f f 20 23 20 694 0 int84mul - - )); DESCR("multiply"); DATA(insert OID = 691 ( "/" PGNSP PGUID b f f 20 23 20 0 0 int84div - - )); DESCR("divide"); DATA(insert OID = 692 ( "+" PGNSP PGUID b f f 23 20 20 688 0 int48pl - - )); DESCR("add"); DATA(insert OID = 693 ( "-" PGNSP PGUID b f f 23 20 20 0 0 int48mi - - )); DESCR("subtract"); DATA(insert OID = 694 ( "*" PGNSP PGUID b f f 23 20 20 690 0 int48mul - - )); DESCR("multiply"); DATA(insert OID = 695 ( "/" PGNSP PGUID b f f 23 20 20 0 0 int48div - - )); DESCR("divide"); DATA(insert OID = 818 ( "+" PGNSP PGUID b f f 20 21 20 822 0 int82pl - - )); DESCR("add"); DATA(insert OID = 819 ( "-" PGNSP PGUID b f f 20 21 20 0 0 int82mi - - )); DESCR("subtract"); DATA(insert OID = 820 ( "*" PGNSP PGUID b f f 20 21 20 824 0 int82mul - - )); DESCR("multiply"); DATA(insert OID = 821 ( "/" PGNSP PGUID b f f 20 21 20 0 0 int82div - - )); DESCR("divide"); DATA(insert OID = 822 ( "+" PGNSP PGUID b f f 21 20 20 818 0 int28pl - - )); DESCR("add"); DATA(insert OID = 823 ( "-" PGNSP PGUID b f f 21 20 20 0 0 int28mi - - )); DESCR("subtract"); DATA(insert OID = 824 ( "*" PGNSP PGUID b f f 21 20 20 820 0 int28mul - - )); DESCR("multiply"); DATA(insert OID = 825 ( "/" PGNSP PGUID b f f 21 20 20 0 0 int28div - - )); DESCR("divide"); DATA(insert OID = 706 ( "<->" PGNSP PGUID b f f 603 603 701 706 0 box_distance - - )); DESCR("distance between"); DATA(insert OID = 707 ( "<->" PGNSP PGUID b f f 602 602 701 707 0 path_distance - - )); DESCR("distance between"); DATA(insert OID = 708 ( "<->" PGNSP PGUID b f f 628 628 701 708 0 line_distance - - )); DESCR("distance between"); DATA(insert OID = 709 ( "<->" PGNSP PGUID b f f 601 601 701 709 0 lseg_distance - - )); DESCR("distance between"); DATA(insert OID = 712 ( "<->" PGNSP PGUID b f f 604 604 701 712 0 poly_distance - - )); DESCR("distance between"); DATA(insert OID = 713 ( "<>" PGNSP PGUID b f f 600 600 16 713 510 point_ne neqsel neqjoinsel )); DESCR("not equal"); /* add translation/rotation/scaling operators for geometric types. - thomas 97/05/10 */ DATA(insert OID = 731 ( "+" PGNSP PGUID b f f 600 600 600 731 0 point_add - - )); DESCR("add points (translate)"); DATA(insert OID = 732 ( "-" PGNSP PGUID b f f 600 600 600 0 0 point_sub - - )); DESCR("subtract points (translate)"); DATA(insert OID = 733 ( "*" PGNSP PGUID b f f 600 600 600 733 0 point_mul - - )); DESCR("multiply points (scale/rotate)"); DATA(insert OID = 734 ( "/" PGNSP PGUID b f f 600 600 600 0 0 point_div - - )); DESCR("divide points (scale/rotate)"); DATA(insert OID = 735 ( "+" PGNSP PGUID b f f 602 602 602 735 0 path_add - - )); DESCR("concatenate"); DATA(insert OID = 736 ( "+" PGNSP PGUID b f f 602 600 602 0 0 path_add_pt - - )); DESCR("add (translate path)"); DATA(insert OID = 737 ( "-" PGNSP PGUID b f f 602 600 602 0 0 path_sub_pt - - )); DESCR("subtract (translate path)"); DATA(insert OID = 738 ( "*" PGNSP PGUID b f f 602 600 602 0 0 path_mul_pt - - )); DESCR("multiply (rotate/scale path)"); DATA(insert OID = 739 ( "/" PGNSP PGUID b f f 602 600 602 0 0 path_div_pt - - )); DESCR("divide (rotate/scale path)"); DATA(insert OID = 755 ( "@>" PGNSP PGUID b f f 602 600 16 512 0 path_contain_pt - - )); DESCR("contains"); DATA(insert OID = 756 ( "<@" PGNSP PGUID b f f 600 604 16 757 0 pt_contained_poly contsel contjoinsel )); DESCR("is contained by"); DATA(insert OID = 757 ( "@>" PGNSP PGUID b f f 604 600 16 756 0 poly_contain_pt contsel contjoinsel )); DESCR("contains"); DATA(insert OID = 758 ( "<@" PGNSP PGUID b f f 600 718 16 759 0 pt_contained_circle contsel contjoinsel )); DESCR("is contained by"); DATA(insert OID = 759 ( "@>" PGNSP PGUID b f f 718 600 16 758 0 circle_contain_pt contsel contjoinsel )); DESCR("contains"); DATA(insert OID = 773 ( "@" PGNSP PGUID l f f 0 23 23 0 0 int4abs - - )); DESCR("absolute value"); /* additional operators for geometric types - thomas 1997-07-09 */ DATA(insert OID = 792 ( "=" PGNSP PGUID b f f 602 602 16 792 0 path_n_eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 793 ( "<" PGNSP PGUID b f f 602 602 16 794 0 path_n_lt - - )); DESCR("less than"); DATA(insert OID = 794 ( ">" PGNSP PGUID b f f 602 602 16 793 0 path_n_gt - - )); DESCR("greater than"); DATA(insert OID = 795 ( "<=" PGNSP PGUID b f f 602 602 16 796 0 path_n_le - - )); DESCR("less than or equal"); DATA(insert OID = 796 ( ">=" PGNSP PGUID b f f 602 602 16 795 0 path_n_ge - - )); DESCR("greater than or equal"); DATA(insert OID = 797 ( "#" PGNSP PGUID l f f 0 602 23 0 0 path_npoints - - )); DESCR("number of points"); DATA(insert OID = 798 ( "?#" PGNSP PGUID b f f 602 602 16 0 0 path_inter - - )); DESCR("intersect"); DATA(insert OID = 799 ( "@-@" PGNSP PGUID l f f 0 602 701 0 0 path_length - - )); DESCR("sum of path segment lengths"); DATA(insert OID = 800 ( ">^" PGNSP PGUID b f f 603 603 16 0 0 box_above_eq positionsel positionjoinsel )); DESCR("is above (allows touching)"); DATA(insert OID = 801 ( "<^" PGNSP PGUID b f f 603 603 16 0 0 box_below_eq positionsel positionjoinsel )); DESCR("is below (allows touching)"); DATA(insert OID = 802 ( "?#" PGNSP PGUID b f f 603 603 16 0 0 box_overlap areasel areajoinsel )); DESCR("deprecated, use && instead"); DATA(insert OID = 803 ( "#" PGNSP PGUID b f f 603 603 603 0 0 box_intersect - - )); DESCR("box intersection"); DATA(insert OID = 804 ( "+" PGNSP PGUID b f f 603 600 603 0 0 box_add - - )); DESCR("add point to box (translate)"); DATA(insert OID = 805 ( "-" PGNSP PGUID b f f 603 600 603 0 0 box_sub - - )); DESCR("subtract point from box (translate)"); DATA(insert OID = 806 ( "*" PGNSP PGUID b f f 603 600 603 0 0 box_mul - - )); DESCR("multiply box by point (scale)"); DATA(insert OID = 807 ( "/" PGNSP PGUID b f f 603 600 603 0 0 box_div - - )); DESCR("divide box by point (scale)"); DATA(insert OID = 808 ( "?-" PGNSP PGUID b f f 600 600 16 808 0 point_horiz - - )); DESCR("horizontally aligned"); DATA(insert OID = 809 ( "?|" PGNSP PGUID b f f 600 600 16 809 0 point_vert - - )); DESCR("vertically aligned"); DATA(insert OID = 811 ( "=" PGNSP PGUID b t f 704 704 16 811 812 tintervaleq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 812 ( "<>" PGNSP PGUID b f f 704 704 16 812 811 tintervalne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 813 ( "<" PGNSP PGUID b f f 704 704 16 814 816 tintervallt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 814 ( ">" PGNSP PGUID b f f 704 704 16 813 815 tintervalgt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 815 ( "<=" PGNSP PGUID b f f 704 704 16 816 814 tintervalle scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 816 ( ">=" PGNSP PGUID b f f 704 704 16 815 813 tintervalge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 843 ( "*" PGNSP PGUID b f f 790 700 790 845 0 cash_mul_flt4 - - )); DESCR("multiply"); DATA(insert OID = 844 ( "/" PGNSP PGUID b f f 790 700 790 0 0 cash_div_flt4 - - )); DESCR("divide"); DATA(insert OID = 845 ( "*" PGNSP PGUID b f f 700 790 790 843 0 flt4_mul_cash - - )); DESCR("multiply"); DATA(insert OID = 900 ( "=" PGNSP PGUID b t f 790 790 16 900 901 cash_eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 901 ( "<>" PGNSP PGUID b f f 790 790 16 901 900 cash_ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 902 ( "<" PGNSP PGUID b f f 790 790 16 903 905 cash_lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 903 ( ">" PGNSP PGUID b f f 790 790 16 902 904 cash_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 904 ( "<=" PGNSP PGUID b f f 790 790 16 905 903 cash_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 905 ( ">=" PGNSP PGUID b f f 790 790 16 904 902 cash_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 906 ( "+" PGNSP PGUID b f f 790 790 790 906 0 cash_pl - - )); DESCR("add"); DATA(insert OID = 907 ( "-" PGNSP PGUID b f f 790 790 790 0 0 cash_mi - - )); DESCR("subtract"); DATA(insert OID = 908 ( "*" PGNSP PGUID b f f 790 701 790 916 0 cash_mul_flt8 - - )); DESCR("multiply"); DATA(insert OID = 909 ( "/" PGNSP PGUID b f f 790 701 790 0 0 cash_div_flt8 - - )); DESCR("divide"); DATA(insert OID = 912 ( "*" PGNSP PGUID b f f 790 23 790 917 0 cash_mul_int4 - - )); DESCR("multiply"); DATA(insert OID = 913 ( "/" PGNSP PGUID b f f 790 23 790 0 0 cash_div_int4 - - )); DESCR("divide"); DATA(insert OID = 914 ( "*" PGNSP PGUID b f f 790 21 790 918 0 cash_mul_int2 - - )); DESCR("multiply"); DATA(insert OID = 915 ( "/" PGNSP PGUID b f f 790 21 790 0 0 cash_div_int2 - - )); DESCR("divide"); DATA(insert OID = 916 ( "*" PGNSP PGUID b f f 701 790 790 908 0 flt8_mul_cash - - )); DESCR("multiply"); DATA(insert OID = 917 ( "*" PGNSP PGUID b f f 23 790 790 912 0 int4_mul_cash - - )); DESCR("multiply"); DATA(insert OID = 918 ( "*" PGNSP PGUID b f f 21 790 790 914 0 int2_mul_cash - - )); DESCR("multiply"); DATA(insert OID = 3825 ( "/" PGNSP PGUID b f f 790 790 701 0 0 cash_div_cash - - )); DESCR("divide"); DATA(insert OID = 965 ( "^" PGNSP PGUID b f f 701 701 701 0 0 dpow - - )); DESCR("exponentiation"); DATA(insert OID = 966 ( "+" PGNSP PGUID b f f 1034 1033 1034 0 0 aclinsert - - )); DESCR("add/update ACL item"); DATA(insert OID = 967 ( "-" PGNSP PGUID b f f 1034 1033 1034 0 0 aclremove - - )); DESCR("remove ACL item"); DATA(insert OID = 968 ( "@>" PGNSP PGUID b f f 1034 1033 16 0 0 aclcontains - - )); DESCR("contains"); DATA(insert OID = 974 ( "=" PGNSP PGUID b f t 1033 1033 16 974 0 aclitemeq eqsel eqjoinsel )); DESCR("equal"); /* additional geometric operators - thomas 1997-07-09 */ DATA(insert OID = 969 ( "@@" PGNSP PGUID l f f 0 601 600 0 0 lseg_center - - )); DESCR("center of"); DATA(insert OID = 970 ( "@@" PGNSP PGUID l f f 0 602 600 0 0 path_center - - )); DESCR("center of"); DATA(insert OID = 971 ( "@@" PGNSP PGUID l f f 0 604 600 0 0 poly_center - - )); DESCR("center of"); DATA(insert OID = 1054 ( "=" PGNSP PGUID b t t 1042 1042 16 1054 1057 bpchareq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 1055 ( "~" PGNSP PGUID b f f 1042 25 16 0 1056 bpcharregexeq regexeqsel regexeqjoinsel )); DESCR("matches regular expression, case-sensitive"); #define OID_BPCHAR_REGEXEQ_OP 1055 DATA(insert OID = 1056 ( "!~" PGNSP PGUID b f f 1042 25 16 0 1055 bpcharregexne regexnesel regexnejoinsel )); DESCR("does not match regular expression, case-sensitive"); DATA(insert OID = 1057 ( "<>" PGNSP PGUID b f f 1042 1042 16 1057 1054 bpcharne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 1058 ( "<" PGNSP PGUID b f f 1042 1042 16 1060 1061 bpcharlt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 1059 ( "<=" PGNSP PGUID b f f 1042 1042 16 1061 1060 bpcharle scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 1060 ( ">" PGNSP PGUID b f f 1042 1042 16 1058 1059 bpchargt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 1061 ( ">=" PGNSP PGUID b f f 1042 1042 16 1059 1058 bpcharge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); /* generic array comparison operators */ DATA(insert OID = 1070 ( "=" PGNSP PGUID b t t 2277 2277 16 1070 1071 array_eq eqsel eqjoinsel )); DESCR("equal"); #define ARRAY_EQ_OP 1070 DATA(insert OID = 1071 ( "<>" PGNSP PGUID b f f 2277 2277 16 1071 1070 array_ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 1072 ( "<" PGNSP PGUID b f f 2277 2277 16 1073 1075 array_lt scalarltsel scalarltjoinsel )); DESCR("less than"); #define ARRAY_LT_OP 1072 DATA(insert OID = 1073 ( ">" PGNSP PGUID b f f 2277 2277 16 1072 1074 array_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); #define ARRAY_GT_OP 1073 DATA(insert OID = 1074 ( "<=" PGNSP PGUID b f f 2277 2277 16 1075 1073 array_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 1075 ( ">=" PGNSP PGUID b f f 2277 2277 16 1074 1072 array_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); /* date operators */ DATA(insert OID = 1076 ( "+" PGNSP PGUID b f f 1082 1186 1114 2551 0 date_pl_interval - - )); DESCR("add"); DATA(insert OID = 1077 ( "-" PGNSP PGUID b f f 1082 1186 1114 0 0 date_mi_interval - - )); DESCR("subtract"); DATA(insert OID = 1093 ( "=" PGNSP PGUID b t t 1082 1082 16 1093 1094 date_eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 1094 ( "<>" PGNSP PGUID b f f 1082 1082 16 1094 1093 date_ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 1095 ( "<" PGNSP PGUID b f f 1082 1082 16 1097 1098 date_lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 1096 ( "<=" PGNSP PGUID b f f 1082 1082 16 1098 1097 date_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 1097 ( ">" PGNSP PGUID b f f 1082 1082 16 1095 1096 date_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 1098 ( ">=" PGNSP PGUID b f f 1082 1082 16 1096 1095 date_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 1099 ( "-" PGNSP PGUID b f f 1082 1082 23 0 0 date_mi - - )); DESCR("subtract"); DATA(insert OID = 1100 ( "+" PGNSP PGUID b f f 1082 23 1082 2555 0 date_pli - - )); DESCR("add"); DATA(insert OID = 1101 ( "-" PGNSP PGUID b f f 1082 23 1082 0 0 date_mii - - )); DESCR("subtract"); /* time operators */ DATA(insert OID = 1108 ( "=" PGNSP PGUID b t t 1083 1083 16 1108 1109 time_eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 1109 ( "<>" PGNSP PGUID b f f 1083 1083 16 1109 1108 time_ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 1110 ( "<" PGNSP PGUID b f f 1083 1083 16 1112 1113 time_lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 1111 ( "<=" PGNSP PGUID b f f 1083 1083 16 1113 1112 time_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 1112 ( ">" PGNSP PGUID b f f 1083 1083 16 1110 1111 time_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 1113 ( ">=" PGNSP PGUID b f f 1083 1083 16 1111 1110 time_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); /* timetz operators */ DATA(insert OID = 1550 ( "=" PGNSP PGUID b t t 1266 1266 16 1550 1551 timetz_eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 1551 ( "<>" PGNSP PGUID b f f 1266 1266 16 1551 1550 timetz_ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 1552 ( "<" PGNSP PGUID b f f 1266 1266 16 1554 1555 timetz_lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 1553 ( "<=" PGNSP PGUID b f f 1266 1266 16 1555 1554 timetz_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 1554 ( ">" PGNSP PGUID b f f 1266 1266 16 1552 1553 timetz_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 1555 ( ">=" PGNSP PGUID b f f 1266 1266 16 1553 1552 timetz_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); /* float48 operators */ DATA(insert OID = 1116 ( "+" PGNSP PGUID b f f 700 701 701 1126 0 float48pl - - )); DESCR("add"); DATA(insert OID = 1117 ( "-" PGNSP PGUID b f f 700 701 701 0 0 float48mi - - )); DESCR("subtract"); DATA(insert OID = 1118 ( "/" PGNSP PGUID b f f 700 701 701 0 0 float48div - - )); DESCR("divide"); DATA(insert OID = 1119 ( "*" PGNSP PGUID b f f 700 701 701 1129 0 float48mul - - )); DESCR("multiply"); DATA(insert OID = 1120 ( "=" PGNSP PGUID b t t 700 701 16 1130 1121 float48eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 1121 ( "<>" PGNSP PGUID b f f 700 701 16 1131 1120 float48ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 1122 ( "<" PGNSP PGUID b f f 700 701 16 1133 1125 float48lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 1123 ( ">" PGNSP PGUID b f f 700 701 16 1132 1124 float48gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 1124 ( "<=" PGNSP PGUID b f f 700 701 16 1135 1123 float48le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 1125 ( ">=" PGNSP PGUID b f f 700 701 16 1134 1122 float48ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); /* float84 operators */ DATA(insert OID = 1126 ( "+" PGNSP PGUID b f f 701 700 701 1116 0 float84pl - - )); DESCR("add"); DATA(insert OID = 1127 ( "-" PGNSP PGUID b f f 701 700 701 0 0 float84mi - - )); DESCR("subtract"); DATA(insert OID = 1128 ( "/" PGNSP PGUID b f f 701 700 701 0 0 float84div - - )); DESCR("divide"); DATA(insert OID = 1129 ( "*" PGNSP PGUID b f f 701 700 701 1119 0 float84mul - - )); DESCR("multiply"); DATA(insert OID = 1130 ( "=" PGNSP PGUID b t t 701 700 16 1120 1131 float84eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 1131 ( "<>" PGNSP PGUID b f f 701 700 16 1121 1130 float84ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 1132 ( "<" PGNSP PGUID b f f 701 700 16 1123 1135 float84lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 1133 ( ">" PGNSP PGUID b f f 701 700 16 1122 1134 float84gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 1134 ( "<=" PGNSP PGUID b f f 701 700 16 1125 1133 float84le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 1135 ( ">=" PGNSP PGUID b f f 701 700 16 1124 1132 float84ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); /* LIKE hacks by Keith Parks. */ DATA(insert OID = 1207 ( "~~" PGNSP PGUID b f f 19 25 16 0 1208 namelike likesel likejoinsel )); DESCR("matches LIKE expression"); #define OID_NAME_LIKE_OP 1207 DATA(insert OID = 1208 ( "!~~" PGNSP PGUID b f f 19 25 16 0 1207 namenlike nlikesel nlikejoinsel )); DESCR("does not match LIKE expression"); DATA(insert OID = 1209 ( "~~" PGNSP PGUID b f f 25 25 16 0 1210 textlike likesel likejoinsel )); DESCR("matches LIKE expression"); #define OID_TEXT_LIKE_OP 1209 DATA(insert OID = 1210 ( "!~~" PGNSP PGUID b f f 25 25 16 0 1209 textnlike nlikesel nlikejoinsel )); DESCR("does not match LIKE expression"); DATA(insert OID = 1211 ( "~~" PGNSP PGUID b f f 1042 25 16 0 1212 bpcharlike likesel likejoinsel )); DESCR("matches LIKE expression"); #define OID_BPCHAR_LIKE_OP 1211 DATA(insert OID = 1212 ( "!~~" PGNSP PGUID b f f 1042 25 16 0 1211 bpcharnlike nlikesel nlikejoinsel )); DESCR("does not match LIKE expression"); /* case-insensitive regex hacks */ DATA(insert OID = 1226 ( "~*" PGNSP PGUID b f f 19 25 16 0 1227 nameicregexeq icregexeqsel icregexeqjoinsel )); DESCR("matches regular expression, case-insensitive"); #define OID_NAME_ICREGEXEQ_OP 1226 DATA(insert OID = 1227 ( "!~*" PGNSP PGUID b f f 19 25 16 0 1226 nameicregexne icregexnesel icregexnejoinsel )); DESCR("does not match regular expression, case-insensitive"); DATA(insert OID = 1228 ( "~*" PGNSP PGUID b f f 25 25 16 0 1229 texticregexeq icregexeqsel icregexeqjoinsel )); DESCR("matches regular expression, case-insensitive"); #define OID_TEXT_ICREGEXEQ_OP 1228 DATA(insert OID = 1229 ( "!~*" PGNSP PGUID b f f 25 25 16 0 1228 texticregexne icregexnesel icregexnejoinsel )); DESCR("does not match regular expression, case-insensitive"); DATA(insert OID = 1234 ( "~*" PGNSP PGUID b f f 1042 25 16 0 1235 bpcharicregexeq icregexeqsel icregexeqjoinsel )); DESCR("matches regular expression, case-insensitive"); #define OID_BPCHAR_ICREGEXEQ_OP 1234 DATA(insert OID = 1235 ( "!~*" PGNSP PGUID b f f 1042 25 16 0 1234 bpcharicregexne icregexnesel icregexnejoinsel )); DESCR("does not match regular expression, case-insensitive"); /* timestamptz operators */ DATA(insert OID = 1320 ( "=" PGNSP PGUID b t t 1184 1184 16 1320 1321 timestamptz_eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 1321 ( "<>" PGNSP PGUID b f f 1184 1184 16 1321 1320 timestamptz_ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 1322 ( "<" PGNSP PGUID b f f 1184 1184 16 1324 1325 timestamptz_lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 1323 ( "<=" PGNSP PGUID b f f 1184 1184 16 1325 1324 timestamptz_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 1324 ( ">" PGNSP PGUID b f f 1184 1184 16 1322 1323 timestamptz_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 1325 ( ">=" PGNSP PGUID b f f 1184 1184 16 1323 1322 timestamptz_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 1327 ( "+" PGNSP PGUID b f f 1184 1186 1184 2554 0 timestamptz_pl_interval - - )); DESCR("add"); DATA(insert OID = 1328 ( "-" PGNSP PGUID b f f 1184 1184 1186 0 0 timestamptz_mi - - )); DESCR("subtract"); DATA(insert OID = 1329 ( "-" PGNSP PGUID b f f 1184 1186 1184 0 0 timestamptz_mi_interval - - )); DESCR("subtract"); /* interval operators */ DATA(insert OID = 1330 ( "=" PGNSP PGUID b t t 1186 1186 16 1330 1331 interval_eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 1331 ( "<>" PGNSP PGUID b f f 1186 1186 16 1331 1330 interval_ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 1332 ( "<" PGNSP PGUID b f f 1186 1186 16 1334 1335 interval_lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 1333 ( "<=" PGNSP PGUID b f f 1186 1186 16 1335 1334 interval_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 1334 ( ">" PGNSP PGUID b f f 1186 1186 16 1332 1333 interval_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 1335 ( ">=" PGNSP PGUID b f f 1186 1186 16 1333 1332 interval_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 1336 ( "-" PGNSP PGUID l f f 0 1186 1186 0 0 interval_um - - )); DESCR("negate"); DATA(insert OID = 1337 ( "+" PGNSP PGUID b f f 1186 1186 1186 1337 0 interval_pl - - )); DESCR("add"); DATA(insert OID = 1338 ( "-" PGNSP PGUID b f f 1186 1186 1186 0 0 interval_mi - - )); DESCR("subtract"); DATA(insert OID = 1360 ( "+" PGNSP PGUID b f f 1082 1083 1114 1363 0 datetime_pl - - )); DESCR("convert date and time to timestamp"); DATA(insert OID = 1361 ( "+" PGNSP PGUID b f f 1082 1266 1184 1366 0 datetimetz_pl - - )); DESCR("convert date and time with time zone to timestamp with time zone"); DATA(insert OID = 1363 ( "+" PGNSP PGUID b f f 1083 1082 1114 1360 0 timedate_pl - - )); DESCR("convert time and date to timestamp"); DATA(insert OID = 1366 ( "+" PGNSP PGUID b f f 1266 1082 1184 1361 0 timetzdate_pl - - )); DESCR("convert time with time zone and date to timestamp with time zone"); DATA(insert OID = 1399 ( "-" PGNSP PGUID b f f 1083 1083 1186 0 0 time_mi_time - - )); DESCR("subtract"); /* additional geometric operators - thomas 97/04/18 */ DATA(insert OID = 1420 ( "@@" PGNSP PGUID l f f 0 718 600 0 0 circle_center - - )); DESCR("center of"); DATA(insert OID = 1500 ( "=" PGNSP PGUID b f f 718 718 16 1500 1501 circle_eq eqsel eqjoinsel )); DESCR("equal by area"); DATA(insert OID = 1501 ( "<>" PGNSP PGUID b f f 718 718 16 1501 1500 circle_ne neqsel neqjoinsel )); DESCR("not equal by area"); DATA(insert OID = 1502 ( "<" PGNSP PGUID b f f 718 718 16 1503 1505 circle_lt areasel areajoinsel )); DESCR("less than by area"); DATA(insert OID = 1503 ( ">" PGNSP PGUID b f f 718 718 16 1502 1504 circle_gt areasel areajoinsel )); DESCR("greater than by area"); DATA(insert OID = 1504 ( "<=" PGNSP PGUID b f f 718 718 16 1505 1503 circle_le areasel areajoinsel )); DESCR("less than or equal by area"); DATA(insert OID = 1505 ( ">=" PGNSP PGUID b f f 718 718 16 1504 1502 circle_ge areasel areajoinsel )); DESCR("greater than or equal by area"); DATA(insert OID = 1506 ( "<<" PGNSP PGUID b f f 718 718 16 0 0 circle_left positionsel positionjoinsel )); DESCR("is left of"); DATA(insert OID = 1507 ( "&<" PGNSP PGUID b f f 718 718 16 0 0 circle_overleft positionsel positionjoinsel )); DESCR("overlaps or is left of"); DATA(insert OID = 1508 ( "&>" PGNSP PGUID b f f 718 718 16 0 0 circle_overright positionsel positionjoinsel )); DESCR("overlaps or is right of"); DATA(insert OID = 1509 ( ">>" PGNSP PGUID b f f 718 718 16 0 0 circle_right positionsel positionjoinsel )); DESCR("is right of"); DATA(insert OID = 1510 ( "<@" PGNSP PGUID b f f 718 718 16 1511 0 circle_contained contsel contjoinsel )); DESCR("is contained by"); DATA(insert OID = 1511 ( "@>" PGNSP PGUID b f f 718 718 16 1510 0 circle_contain contsel contjoinsel )); DESCR("contains"); DATA(insert OID = 1512 ( "~=" PGNSP PGUID b f f 718 718 16 1512 0 circle_same eqsel eqjoinsel )); DESCR("same as"); DATA(insert OID = 1513 ( "&&" PGNSP PGUID b f f 718 718 16 1513 0 circle_overlap areasel areajoinsel )); DESCR("overlaps"); DATA(insert OID = 1514 ( "|>>" PGNSP PGUID b f f 718 718 16 0 0 circle_above positionsel positionjoinsel )); DESCR("is above"); DATA(insert OID = 1515 ( "<<|" PGNSP PGUID b f f 718 718 16 0 0 circle_below positionsel positionjoinsel )); DESCR("is below"); DATA(insert OID = 1516 ( "+" PGNSP PGUID b f f 718 600 718 0 0 circle_add_pt - - )); DESCR("add"); DATA(insert OID = 1517 ( "-" PGNSP PGUID b f f 718 600 718 0 0 circle_sub_pt - - )); DESCR("subtract"); DATA(insert OID = 1518 ( "*" PGNSP PGUID b f f 718 600 718 0 0 circle_mul_pt - - )); DESCR("multiply"); DATA(insert OID = 1519 ( "/" PGNSP PGUID b f f 718 600 718 0 0 circle_div_pt - - )); DESCR("divide"); DATA(insert OID = 1520 ( "<->" PGNSP PGUID b f f 718 718 701 1520 0 circle_distance - - )); DESCR("distance between"); DATA(insert OID = 1521 ( "#" PGNSP PGUID l f f 0 604 23 0 0 poly_npoints - - )); DESCR("number of points"); DATA(insert OID = 1522 ( "<->" PGNSP PGUID b f f 600 718 701 0 0 dist_pc - - )); DESCR("distance between"); DATA(insert OID = 1523 ( "<->" PGNSP PGUID b f f 718 604 701 0 0 dist_cpoly - - )); DESCR("distance between"); /* additional geometric operators - thomas 1997-07-09 */ DATA(insert OID = 1524 ( "<->" PGNSP PGUID b f f 628 603 701 0 0 dist_lb - - )); DESCR("distance between"); DATA(insert OID = 1525 ( "?#" PGNSP PGUID b f f 601 601 16 1525 0 lseg_intersect - - )); DESCR("intersect"); DATA(insert OID = 1526 ( "?||" PGNSP PGUID b f f 601 601 16 1526 0 lseg_parallel - - )); DESCR("parallel"); DATA(insert OID = 1527 ( "?-|" PGNSP PGUID b f f 601 601 16 1527 0 lseg_perp - - )); DESCR("perpendicular"); DATA(insert OID = 1528 ( "?-" PGNSP PGUID l f f 0 601 16 0 0 lseg_horizontal - - )); DESCR("horizontal"); DATA(insert OID = 1529 ( "?|" PGNSP PGUID l f f 0 601 16 0 0 lseg_vertical - - )); DESCR("vertical"); DATA(insert OID = 1535 ( "=" PGNSP PGUID b f f 601 601 16 1535 1586 lseg_eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 1536 ( "#" PGNSP PGUID b f f 601 601 600 1536 0 lseg_interpt - - )); DESCR("intersection point"); DATA(insert OID = 1537 ( "?#" PGNSP PGUID b f f 601 628 16 0 0 inter_sl - - )); DESCR("intersect"); DATA(insert OID = 1538 ( "?#" PGNSP PGUID b f f 601 603 16 0 0 inter_sb - - )); DESCR("intersect"); DATA(insert OID = 1539 ( "?#" PGNSP PGUID b f f 628 603 16 0 0 inter_lb - - )); DESCR("intersect"); DATA(insert OID = 1546 ( "<@" PGNSP PGUID b f f 600 628 16 0 0 on_pl - - )); DESCR("point on line"); DATA(insert OID = 1547 ( "<@" PGNSP PGUID b f f 600 601 16 0 0 on_ps - - )); DESCR("is contained by"); DATA(insert OID = 1548 ( "<@" PGNSP PGUID b f f 601 628 16 0 0 on_sl - - )); DESCR("lseg on line"); DATA(insert OID = 1549 ( "<@" PGNSP PGUID b f f 601 603 16 0 0 on_sb - - )); DESCR("is contained by"); DATA(insert OID = 1557 ( "##" PGNSP PGUID b f f 600 628 600 0 0 close_pl - - )); DESCR("closest point to A on B"); DATA(insert OID = 1558 ( "##" PGNSP PGUID b f f 600 601 600 0 0 close_ps - - )); DESCR("closest point to A on B"); DATA(insert OID = 1559 ( "##" PGNSP PGUID b f f 600 603 600 0 0 close_pb - - )); DESCR("closest point to A on B"); DATA(insert OID = 1566 ( "##" PGNSP PGUID b f f 601 628 600 0 0 close_sl - - )); DESCR("closest point to A on B"); DATA(insert OID = 1567 ( "##" PGNSP PGUID b f f 601 603 600 0 0 close_sb - - )); DESCR("closest point to A on B"); DATA(insert OID = 1568 ( "##" PGNSP PGUID b f f 628 603 600 0 0 close_lb - - )); DESCR("closest point to A on B"); DATA(insert OID = 1577 ( "##" PGNSP PGUID b f f 628 601 600 0 0 close_ls - - )); DESCR("closest point to A on B"); DATA(insert OID = 1578 ( "##" PGNSP PGUID b f f 601 601 600 0 0 close_lseg - - )); DESCR("closest point to A on B"); DATA(insert OID = 1583 ( "*" PGNSP PGUID b f f 1186 701 1186 1584 0 interval_mul - - )); DESCR("multiply"); DATA(insert OID = 1584 ( "*" PGNSP PGUID b f f 701 1186 1186 1583 0 mul_d_interval - - )); DESCR("multiply"); DATA(insert OID = 1585 ( "/" PGNSP PGUID b f f 1186 701 1186 0 0 interval_div - - )); DESCR("divide"); DATA(insert OID = 1586 ( "<>" PGNSP PGUID b f f 601 601 16 1586 1535 lseg_ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 1587 ( "<" PGNSP PGUID b f f 601 601 16 1589 1590 lseg_lt - - )); DESCR("less than by length"); DATA(insert OID = 1588 ( "<=" PGNSP PGUID b f f 601 601 16 1590 1589 lseg_le - - )); DESCR("less than or equal by length"); DATA(insert OID = 1589 ( ">" PGNSP PGUID b f f 601 601 16 1587 1588 lseg_gt - - )); DESCR("greater than by length"); DATA(insert OID = 1590 ( ">=" PGNSP PGUID b f f 601 601 16 1588 1587 lseg_ge - - )); DESCR("greater than or equal by length"); DATA(insert OID = 1591 ( "@-@" PGNSP PGUID l f f 0 601 701 0 0 lseg_length - - )); DESCR("distance between endpoints"); DATA(insert OID = 1611 ( "?#" PGNSP PGUID b f f 628 628 16 1611 0 line_intersect - - )); DESCR("intersect"); DATA(insert OID = 1612 ( "?||" PGNSP PGUID b f f 628 628 16 1612 0 line_parallel - - )); DESCR("parallel"); DATA(insert OID = 1613 ( "?-|" PGNSP PGUID b f f 628 628 16 1613 0 line_perp - - )); DESCR("perpendicular"); DATA(insert OID = 1614 ( "?-" PGNSP PGUID l f f 0 628 16 0 0 line_horizontal - - )); DESCR("horizontal"); DATA(insert OID = 1615 ( "?|" PGNSP PGUID l f f 0 628 16 0 0 line_vertical - - )); DESCR("vertical"); DATA(insert OID = 1616 ( "=" PGNSP PGUID b f f 628 628 16 1616 0 line_eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 1617 ( "#" PGNSP PGUID b f f 628 628 600 1617 0 line_interpt - - )); DESCR("intersection point"); /* MAC type */ DATA(insert OID = 1220 ( "=" PGNSP PGUID b t t 829 829 16 1220 1221 macaddr_eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 1221 ( "<>" PGNSP PGUID b f f 829 829 16 1221 1220 macaddr_ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 1222 ( "<" PGNSP PGUID b f f 829 829 16 1224 1225 macaddr_lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 1223 ( "<=" PGNSP PGUID b f f 829 829 16 1225 1224 macaddr_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 1224 ( ">" PGNSP PGUID b f f 829 829 16 1222 1223 macaddr_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 1225 ( ">=" PGNSP PGUID b f f 829 829 16 1223 1222 macaddr_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 3147 ( "~" PGNSP PGUID l f f 0 829 829 0 0 macaddr_not - - )); DESCR("bitwise not"); DATA(insert OID = 3148 ( "&" PGNSP PGUID b f f 829 829 829 0 0 macaddr_and - - )); DESCR("bitwise and"); DATA(insert OID = 3149 ( "|" PGNSP PGUID b f f 829 829 829 0 0 macaddr_or - - )); DESCR("bitwise or"); /* INET type (these also support CIDR via implicit cast) */ DATA(insert OID = 1201 ( "=" PGNSP PGUID b t t 869 869 16 1201 1202 network_eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 1202 ( "<>" PGNSP PGUID b f f 869 869 16 1202 1201 network_ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 1203 ( "<" PGNSP PGUID b f f 869 869 16 1205 1206 network_lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 1204 ( "<=" PGNSP PGUID b f f 869 869 16 1206 1205 network_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 1205 ( ">" PGNSP PGUID b f f 869 869 16 1203 1204 network_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 1206 ( ">=" PGNSP PGUID b f f 869 869 16 1204 1203 network_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 931 ( "<<" PGNSP PGUID b f f 869 869 16 933 0 network_sub - - )); DESCR("is subnet"); #define OID_INET_SUB_OP 931 DATA(insert OID = 932 ( "<<=" PGNSP PGUID b f f 869 869 16 934 0 network_subeq - - )); DESCR("is subnet or equal"); #define OID_INET_SUBEQ_OP 932 DATA(insert OID = 933 ( ">>" PGNSP PGUID b f f 869 869 16 931 0 network_sup - - )); DESCR("is supernet"); #define OID_INET_SUP_OP 933 DATA(insert OID = 934 ( ">>=" PGNSP PGUID b f f 869 869 16 932 0 network_supeq - - )); DESCR("is supernet or equal"); #define OID_INET_SUPEQ_OP 934 DATA(insert OID = 2634 ( "~" PGNSP PGUID l f f 0 869 869 0 0 inetnot - - )); DESCR("bitwise not"); DATA(insert OID = 2635 ( "&" PGNSP PGUID b f f 869 869 869 0 0 inetand - - )); DESCR("bitwise and"); DATA(insert OID = 2636 ( "|" PGNSP PGUID b f f 869 869 869 0 0 inetor - - )); DESCR("bitwise or"); DATA(insert OID = 2637 ( "+" PGNSP PGUID b f f 869 20 869 2638 0 inetpl - - )); DESCR("add"); DATA(insert OID = 2638 ( "+" PGNSP PGUID b f f 20 869 869 2637 0 int8pl_inet - - )); DESCR("add"); DATA(insert OID = 2639 ( "-" PGNSP PGUID b f f 869 20 869 0 0 inetmi_int8 - - )); DESCR("subtract"); DATA(insert OID = 2640 ( "-" PGNSP PGUID b f f 869 869 20 0 0 inetmi - - )); DESCR("subtract"); /* case-insensitive LIKE hacks */ DATA(insert OID = 1625 ( "~~*" PGNSP PGUID b f f 19 25 16 0 1626 nameiclike iclikesel iclikejoinsel )); DESCR("matches LIKE expression, case-insensitive"); #define OID_NAME_ICLIKE_OP 1625 DATA(insert OID = 1626 ( "!~~*" PGNSP PGUID b f f 19 25 16 0 1625 nameicnlike icnlikesel icnlikejoinsel )); DESCR("does not match LIKE expression, case-insensitive"); DATA(insert OID = 1627 ( "~~*" PGNSP PGUID b f f 25 25 16 0 1628 texticlike iclikesel iclikejoinsel )); DESCR("matches LIKE expression, case-insensitive"); #define OID_TEXT_ICLIKE_OP 1627 DATA(insert OID = 1628 ( "!~~*" PGNSP PGUID b f f 25 25 16 0 1627 texticnlike icnlikesel icnlikejoinsel )); DESCR("does not match LIKE expression, case-insensitive"); DATA(insert OID = 1629 ( "~~*" PGNSP PGUID b f f 1042 25 16 0 1630 bpchariclike iclikesel iclikejoinsel )); DESCR("matches LIKE expression, case-insensitive"); #define OID_BPCHAR_ICLIKE_OP 1629 DATA(insert OID = 1630 ( "!~~*" PGNSP PGUID b f f 1042 25 16 0 1629 bpcharicnlike icnlikesel icnlikejoinsel )); DESCR("does not match LIKE expression, case-insensitive"); /* NUMERIC type - OID's 1700-1799 */ DATA(insert OID = 1751 ( "-" PGNSP PGUID l f f 0 1700 1700 0 0 numeric_uminus - - )); DESCR("negate"); DATA(insert OID = 1752 ( "=" PGNSP PGUID b t t 1700 1700 16 1752 1753 numeric_eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 1753 ( "<>" PGNSP PGUID b f f 1700 1700 16 1753 1752 numeric_ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 1754 ( "<" PGNSP PGUID b f f 1700 1700 16 1756 1757 numeric_lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 1755 ( "<=" PGNSP PGUID b f f 1700 1700 16 1757 1756 numeric_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 1756 ( ">" PGNSP PGUID b f f 1700 1700 16 1754 1755 numeric_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 1757 ( ">=" PGNSP PGUID b f f 1700 1700 16 1755 1754 numeric_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 1758 ( "+" PGNSP PGUID b f f 1700 1700 1700 1758 0 numeric_add - - )); DESCR("add"); DATA(insert OID = 1759 ( "-" PGNSP PGUID b f f 1700 1700 1700 0 0 numeric_sub - - )); DESCR("subtract"); DATA(insert OID = 1760 ( "*" PGNSP PGUID b f f 1700 1700 1700 1760 0 numeric_mul - - )); DESCR("multiply"); DATA(insert OID = 1761 ( "/" PGNSP PGUID b f f 1700 1700 1700 0 0 numeric_div - - )); DESCR("divide"); DATA(insert OID = 1762 ( "%" PGNSP PGUID b f f 1700 1700 1700 0 0 numeric_mod - - )); DESCR("modulus"); DATA(insert OID = 1038 ( "^" PGNSP PGUID b f f 1700 1700 1700 0 0 numeric_power - - )); DESCR("exponentiation"); DATA(insert OID = 1763 ( "@" PGNSP PGUID l f f 0 1700 1700 0 0 numeric_abs - - )); DESCR("absolute value"); DATA(insert OID = 1784 ( "=" PGNSP PGUID b t f 1560 1560 16 1784 1785 biteq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 1785 ( "<>" PGNSP PGUID b f f 1560 1560 16 1785 1784 bitne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 1786 ( "<" PGNSP PGUID b f f 1560 1560 16 1787 1789 bitlt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 1787 ( ">" PGNSP PGUID b f f 1560 1560 16 1786 1788 bitgt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 1788 ( "<=" PGNSP PGUID b f f 1560 1560 16 1789 1787 bitle scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 1789 ( ">=" PGNSP PGUID b f f 1560 1560 16 1788 1786 bitge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 1791 ( "&" PGNSP PGUID b f f 1560 1560 1560 1791 0 bitand - - )); DESCR("bitwise and"); DATA(insert OID = 1792 ( "|" PGNSP PGUID b f f 1560 1560 1560 1792 0 bitor - - )); DESCR("bitwise or"); DATA(insert OID = 1793 ( "#" PGNSP PGUID b f f 1560 1560 1560 1793 0 bitxor - - )); DESCR("bitwise exclusive or"); DATA(insert OID = 1794 ( "~" PGNSP PGUID l f f 0 1560 1560 0 0 bitnot - - )); DESCR("bitwise not"); DATA(insert OID = 1795 ( "<<" PGNSP PGUID b f f 1560 23 1560 0 0 bitshiftleft - - )); DESCR("bitwise shift left"); DATA(insert OID = 1796 ( ">>" PGNSP PGUID b f f 1560 23 1560 0 0 bitshiftright - - )); DESCR("bitwise shift right"); DATA(insert OID = 1797 ( "||" PGNSP PGUID b f f 1562 1562 1562 0 0 bitcat - - )); DESCR("concatenate"); DATA(insert OID = 1800 ( "+" PGNSP PGUID b f f 1083 1186 1083 1849 0 time_pl_interval - - )); DESCR("add"); DATA(insert OID = 1801 ( "-" PGNSP PGUID b f f 1083 1186 1083 0 0 time_mi_interval - - )); DESCR("subtract"); DATA(insert OID = 1802 ( "+" PGNSP PGUID b f f 1266 1186 1266 2552 0 timetz_pl_interval - - )); DESCR("add"); DATA(insert OID = 1803 ( "-" PGNSP PGUID b f f 1266 1186 1266 0 0 timetz_mi_interval - - )); DESCR("subtract"); DATA(insert OID = 1804 ( "=" PGNSP PGUID b t f 1562 1562 16 1804 1805 varbiteq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 1805 ( "<>" PGNSP PGUID b f f 1562 1562 16 1805 1804 varbitne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 1806 ( "<" PGNSP PGUID b f f 1562 1562 16 1807 1809 varbitlt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 1807 ( ">" PGNSP PGUID b f f 1562 1562 16 1806 1808 varbitgt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 1808 ( "<=" PGNSP PGUID b f f 1562 1562 16 1809 1807 varbitle scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 1809 ( ">=" PGNSP PGUID b f f 1562 1562 16 1808 1806 varbitge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 1849 ( "+" PGNSP PGUID b f f 1186 1083 1083 1800 0 interval_pl_time - - )); DESCR("add"); DATA(insert OID = 1862 ( "=" PGNSP PGUID b t t 21 20 16 1868 1863 int28eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 1863 ( "<>" PGNSP PGUID b f f 21 20 16 1869 1862 int28ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 1864 ( "<" PGNSP PGUID b f f 21 20 16 1871 1867 int28lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 1865 ( ">" PGNSP PGUID b f f 21 20 16 1870 1866 int28gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 1866 ( "<=" PGNSP PGUID b f f 21 20 16 1873 1865 int28le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 1867 ( ">=" PGNSP PGUID b f f 21 20 16 1872 1864 int28ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 1868 ( "=" PGNSP PGUID b t t 20 21 16 1862 1869 int82eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 1869 ( "<>" PGNSP PGUID b f f 20 21 16 1863 1868 int82ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 1870 ( "<" PGNSP PGUID b f f 20 21 16 1865 1873 int82lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 1871 ( ">" PGNSP PGUID b f f 20 21 16 1864 1872 int82gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 1872 ( "<=" PGNSP PGUID b f f 20 21 16 1867 1871 int82le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 1873 ( ">=" PGNSP PGUID b f f 20 21 16 1866 1870 int82ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 1874 ( "&" PGNSP PGUID b f f 21 21 21 1874 0 int2and - - )); DESCR("bitwise and"); DATA(insert OID = 1875 ( "|" PGNSP PGUID b f f 21 21 21 1875 0 int2or - - )); DESCR("bitwise or"); DATA(insert OID = 1876 ( "#" PGNSP PGUID b f f 21 21 21 1876 0 int2xor - - )); DESCR("bitwise exclusive or"); DATA(insert OID = 1877 ( "~" PGNSP PGUID l f f 0 21 21 0 0 int2not - - )); DESCR("bitwise not"); DATA(insert OID = 1878 ( "<<" PGNSP PGUID b f f 21 23 21 0 0 int2shl - - )); DESCR("bitwise shift left"); DATA(insert OID = 1879 ( ">>" PGNSP PGUID b f f 21 23 21 0 0 int2shr - - )); DESCR("bitwise shift right"); DATA(insert OID = 1880 ( "&" PGNSP PGUID b f f 23 23 23 1880 0 int4and - - )); DESCR("bitwise and"); DATA(insert OID = 1881 ( "|" PGNSP PGUID b f f 23 23 23 1881 0 int4or - - )); DESCR("bitwise or"); DATA(insert OID = 1882 ( "#" PGNSP PGUID b f f 23 23 23 1882 0 int4xor - - )); DESCR("bitwise exclusive or"); DATA(insert OID = 1883 ( "~" PGNSP PGUID l f f 0 23 23 0 0 int4not - - )); DESCR("bitwise not"); DATA(insert OID = 1884 ( "<<" PGNSP PGUID b f f 23 23 23 0 0 int4shl - - )); DESCR("bitwise shift left"); DATA(insert OID = 1885 ( ">>" PGNSP PGUID b f f 23 23 23 0 0 int4shr - - )); DESCR("bitwise shift right"); DATA(insert OID = 1886 ( "&" PGNSP PGUID b f f 20 20 20 1886 0 int8and - - )); DESCR("bitwise and"); DATA(insert OID = 1887 ( "|" PGNSP PGUID b f f 20 20 20 1887 0 int8or - - )); DESCR("bitwise or"); DATA(insert OID = 1888 ( "#" PGNSP PGUID b f f 20 20 20 1888 0 int8xor - - )); DESCR("bitwise exclusive or"); DATA(insert OID = 1889 ( "~" PGNSP PGUID l f f 0 20 20 0 0 int8not - - )); DESCR("bitwise not"); DATA(insert OID = 1890 ( "<<" PGNSP PGUID b f f 20 23 20 0 0 int8shl - - )); DESCR("bitwise shift left"); DATA(insert OID = 1891 ( ">>" PGNSP PGUID b f f 20 23 20 0 0 int8shr - - )); DESCR("bitwise shift right"); DATA(insert OID = 1916 ( "+" PGNSP PGUID l f f 0 20 20 0 0 int8up - - )); DESCR("unary plus"); DATA(insert OID = 1917 ( "+" PGNSP PGUID l f f 0 21 21 0 0 int2up - - )); DESCR("unary plus"); DATA(insert OID = 1918 ( "+" PGNSP PGUID l f f 0 23 23 0 0 int4up - - )); DESCR("unary plus"); DATA(insert OID = 1919 ( "+" PGNSP PGUID l f f 0 700 700 0 0 float4up - - )); DESCR("unary plus"); DATA(insert OID = 1920 ( "+" PGNSP PGUID l f f 0 701 701 0 0 float8up - - )); DESCR("unary plus"); DATA(insert OID = 1921 ( "+" PGNSP PGUID l f f 0 1700 1700 0 0 numeric_uplus - - )); DESCR("unary plus"); /* bytea operators */ DATA(insert OID = 1955 ( "=" PGNSP PGUID b t t 17 17 16 1955 1956 byteaeq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 1956 ( "<>" PGNSP PGUID b f f 17 17 16 1956 1955 byteane neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 1957 ( "<" PGNSP PGUID b f f 17 17 16 1959 1960 bytealt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 1958 ( "<=" PGNSP PGUID b f f 17 17 16 1960 1959 byteale scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 1959 ( ">" PGNSP PGUID b f f 17 17 16 1957 1958 byteagt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 1960 ( ">=" PGNSP PGUID b f f 17 17 16 1958 1957 byteage scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 2016 ( "~~" PGNSP PGUID b f f 17 17 16 0 2017 bytealike likesel likejoinsel )); DESCR("matches LIKE expression"); #define OID_BYTEA_LIKE_OP 2016 DATA(insert OID = 2017 ( "!~~" PGNSP PGUID b f f 17 17 16 0 2016 byteanlike nlikesel nlikejoinsel )); DESCR("does not match LIKE expression"); DATA(insert OID = 2018 ( "||" PGNSP PGUID b f f 17 17 17 0 0 byteacat - - )); DESCR("concatenate"); /* timestamp operators */ DATA(insert OID = 2060 ( "=" PGNSP PGUID b t t 1114 1114 16 2060 2061 timestamp_eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 2061 ( "<>" PGNSP PGUID b f f 1114 1114 16 2061 2060 timestamp_ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 2062 ( "<" PGNSP PGUID b f f 1114 1114 16 2064 2065 timestamp_lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 2063 ( "<=" PGNSP PGUID b f f 1114 1114 16 2065 2064 timestamp_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 2064 ( ">" PGNSP PGUID b f f 1114 1114 16 2062 2063 timestamp_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 2065 ( ">=" PGNSP PGUID b f f 1114 1114 16 2063 2062 timestamp_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 2066 ( "+" PGNSP PGUID b f f 1114 1186 1114 2553 0 timestamp_pl_interval - - )); DESCR("add"); DATA(insert OID = 2067 ( "-" PGNSP PGUID b f f 1114 1114 1186 0 0 timestamp_mi - - )); DESCR("subtract"); DATA(insert OID = 2068 ( "-" PGNSP PGUID b f f 1114 1186 1114 0 0 timestamp_mi_interval - - )); DESCR("subtract"); /* character-by-character (not collation order) comparison operators for character types */ DATA(insert OID = 2314 ( "~<~" PGNSP PGUID b f f 25 25 16 2318 2317 text_pattern_lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 2315 ( "~<=~" PGNSP PGUID b f f 25 25 16 2317 2318 text_pattern_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 2317 ( "~>=~" PGNSP PGUID b f f 25 25 16 2315 2314 text_pattern_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 2318 ( "~>~" PGNSP PGUID b f f 25 25 16 2314 2315 text_pattern_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 2326 ( "~<~" PGNSP PGUID b f f 1042 1042 16 2330 2329 bpchar_pattern_lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 2327 ( "~<=~" PGNSP PGUID b f f 1042 1042 16 2329 2330 bpchar_pattern_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 2329 ( "~>=~" PGNSP PGUID b f f 1042 1042 16 2327 2326 bpchar_pattern_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 2330 ( "~>~" PGNSP PGUID b f f 1042 1042 16 2326 2327 bpchar_pattern_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); /* crosstype operations for date vs. timestamp and timestamptz */ DATA(insert OID = 2345 ( "<" PGNSP PGUID b f f 1082 1114 16 2375 2348 date_lt_timestamp scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 2346 ( "<=" PGNSP PGUID b f f 1082 1114 16 2374 2349 date_le_timestamp scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 2347 ( "=" PGNSP PGUID b t f 1082 1114 16 2373 2350 date_eq_timestamp eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 2348 ( ">=" PGNSP PGUID b f f 1082 1114 16 2372 2345 date_ge_timestamp scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 2349 ( ">" PGNSP PGUID b f f 1082 1114 16 2371 2346 date_gt_timestamp scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 2350 ( "<>" PGNSP PGUID b f f 1082 1114 16 2376 2347 date_ne_timestamp neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 2358 ( "<" PGNSP PGUID b f f 1082 1184 16 2388 2361 date_lt_timestamptz scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 2359 ( "<=" PGNSP PGUID b f f 1082 1184 16 2387 2362 date_le_timestamptz scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 2360 ( "=" PGNSP PGUID b t f 1082 1184 16 2386 2363 date_eq_timestamptz eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 2361 ( ">=" PGNSP PGUID b f f 1082 1184 16 2385 2358 date_ge_timestamptz scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 2362 ( ">" PGNSP PGUID b f f 1082 1184 16 2384 2359 date_gt_timestamptz scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 2363 ( "<>" PGNSP PGUID b f f 1082 1184 16 2389 2360 date_ne_timestamptz neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 2371 ( "<" PGNSP PGUID b f f 1114 1082 16 2349 2374 timestamp_lt_date scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 2372 ( "<=" PGNSP PGUID b f f 1114 1082 16 2348 2375 timestamp_le_date scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 2373 ( "=" PGNSP PGUID b t f 1114 1082 16 2347 2376 timestamp_eq_date eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 2374 ( ">=" PGNSP PGUID b f f 1114 1082 16 2346 2371 timestamp_ge_date scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 2375 ( ">" PGNSP PGUID b f f 1114 1082 16 2345 2372 timestamp_gt_date scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 2376 ( "<>" PGNSP PGUID b f f 1114 1082 16 2350 2373 timestamp_ne_date neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 2384 ( "<" PGNSP PGUID b f f 1184 1082 16 2362 2387 timestamptz_lt_date scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 2385 ( "<=" PGNSP PGUID b f f 1184 1082 16 2361 2388 timestamptz_le_date scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 2386 ( "=" PGNSP PGUID b t f 1184 1082 16 2360 2389 timestamptz_eq_date eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 2387 ( ">=" PGNSP PGUID b f f 1184 1082 16 2359 2384 timestamptz_ge_date scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 2388 ( ">" PGNSP PGUID b f f 1184 1082 16 2358 2385 timestamptz_gt_date scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 2389 ( "<>" PGNSP PGUID b f f 1184 1082 16 2363 2386 timestamptz_ne_date neqsel neqjoinsel )); DESCR("not equal"); /* crosstype operations for timestamp vs. timestamptz */ DATA(insert OID = 2534 ( "<" PGNSP PGUID b f f 1114 1184 16 2544 2537 timestamp_lt_timestamptz scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 2535 ( "<=" PGNSP PGUID b f f 1114 1184 16 2543 2538 timestamp_le_timestamptz scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 2536 ( "=" PGNSP PGUID b t f 1114 1184 16 2542 2539 timestamp_eq_timestamptz eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 2537 ( ">=" PGNSP PGUID b f f 1114 1184 16 2541 2534 timestamp_ge_timestamptz scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 2538 ( ">" PGNSP PGUID b f f 1114 1184 16 2540 2535 timestamp_gt_timestamptz scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 2539 ( "<>" PGNSP PGUID b f f 1114 1184 16 2545 2536 timestamp_ne_timestamptz neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 2540 ( "<" PGNSP PGUID b f f 1184 1114 16 2538 2543 timestamptz_lt_timestamp scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 2541 ( "<=" PGNSP PGUID b f f 1184 1114 16 2537 2544 timestamptz_le_timestamp scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 2542 ( "=" PGNSP PGUID b t f 1184 1114 16 2536 2545 timestamptz_eq_timestamp eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 2543 ( ">=" PGNSP PGUID b f f 1184 1114 16 2535 2540 timestamptz_ge_timestamp scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 2544 ( ">" PGNSP PGUID b f f 1184 1114 16 2534 2541 timestamptz_gt_timestamp scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 2545 ( "<>" PGNSP PGUID b f f 1184 1114 16 2539 2542 timestamptz_ne_timestamp neqsel neqjoinsel )); DESCR("not equal"); /* formerly-missing interval + datetime operators */ DATA(insert OID = 2551 ( "+" PGNSP PGUID b f f 1186 1082 1114 1076 0 interval_pl_date - - )); DESCR("add"); DATA(insert OID = 2552 ( "+" PGNSP PGUID b f f 1186 1266 1266 1802 0 interval_pl_timetz - - )); DESCR("add"); DATA(insert OID = 2553 ( "+" PGNSP PGUID b f f 1186 1114 1114 2066 0 interval_pl_timestamp - - )); DESCR("add"); DATA(insert OID = 2554 ( "+" PGNSP PGUID b f f 1186 1184 1184 1327 0 interval_pl_timestamptz - - )); DESCR("add"); DATA(insert OID = 2555 ( "+" PGNSP PGUID b f f 23 1082 1082 1100 0 integer_pl_date - - )); DESCR("add"); /* new operators for Y-direction rtree opfamilies */ DATA(insert OID = 2570 ( "<<|" PGNSP PGUID b f f 603 603 16 0 0 box_below positionsel positionjoinsel )); DESCR("is below"); DATA(insert OID = 2571 ( "&<|" PGNSP PGUID b f f 603 603 16 0 0 box_overbelow positionsel positionjoinsel )); DESCR("overlaps or is below"); DATA(insert OID = 2572 ( "|&>" PGNSP PGUID b f f 603 603 16 0 0 box_overabove positionsel positionjoinsel )); DESCR("overlaps or is above"); DATA(insert OID = 2573 ( "|>>" PGNSP PGUID b f f 603 603 16 0 0 box_above positionsel positionjoinsel )); DESCR("is above"); DATA(insert OID = 2574 ( "<<|" PGNSP PGUID b f f 604 604 16 0 0 poly_below positionsel positionjoinsel )); DESCR("is below"); DATA(insert OID = 2575 ( "&<|" PGNSP PGUID b f f 604 604 16 0 0 poly_overbelow positionsel positionjoinsel )); DESCR("overlaps or is below"); DATA(insert OID = 2576 ( "|&>" PGNSP PGUID b f f 604 604 16 0 0 poly_overabove positionsel positionjoinsel )); DESCR("overlaps or is above"); DATA(insert OID = 2577 ( "|>>" PGNSP PGUID b f f 604 604 16 0 0 poly_above positionsel positionjoinsel )); DESCR("is above"); DATA(insert OID = 2589 ( "&<|" PGNSP PGUID b f f 718 718 16 0 0 circle_overbelow positionsel positionjoinsel )); DESCR("overlaps or is below"); DATA(insert OID = 2590 ( "|&>" PGNSP PGUID b f f 718 718 16 0 0 circle_overabove positionsel positionjoinsel )); DESCR("overlaps or is above"); /* overlap/contains/contained for arrays */ DATA(insert OID = 2750 ( "&&" PGNSP PGUID b f f 2277 2277 16 2750 0 arrayoverlap arraycontsel arraycontjoinsel )); DESCR("overlaps"); #define OID_ARRAY_OVERLAP_OP 2750 DATA(insert OID = 2751 ( "@>" PGNSP PGUID b f f 2277 2277 16 2752 0 arraycontains arraycontsel arraycontjoinsel )); DESCR("contains"); #define OID_ARRAY_CONTAINS_OP 2751 DATA(insert OID = 2752 ( "<@" PGNSP PGUID b f f 2277 2277 16 2751 0 arraycontained arraycontsel arraycontjoinsel )); DESCR("is contained by"); #define OID_ARRAY_CONTAINED_OP 2752 /* capturing operators to preserve pre-8.3 behavior of text concatenation */ DATA(insert OID = 2779 ( "||" PGNSP PGUID b f f 25 2776 25 0 0 textanycat - - )); DESCR("concatenate"); DATA(insert OID = 2780 ( "||" PGNSP PGUID b f f 2776 25 25 0 0 anytextcat - - )); DESCR("concatenate"); /* obsolete names for contains/contained-by operators; remove these someday */ DATA(insert OID = 2860 ( "@" PGNSP PGUID b f f 604 604 16 2861 0 poly_contained contsel contjoinsel )); DESCR("deprecated, use <@ instead"); DATA(insert OID = 2861 ( "~" PGNSP PGUID b f f 604 604 16 2860 0 poly_contain contsel contjoinsel )); DESCR("deprecated, use @> instead"); DATA(insert OID = 2862 ( "@" PGNSP PGUID b f f 603 603 16 2863 0 box_contained contsel contjoinsel )); DESCR("deprecated, use <@ instead"); DATA(insert OID = 2863 ( "~" PGNSP PGUID b f f 603 603 16 2862 0 box_contain contsel contjoinsel )); DESCR("deprecated, use @> instead"); DATA(insert OID = 2864 ( "@" PGNSP PGUID b f f 718 718 16 2865 0 circle_contained contsel contjoinsel )); DESCR("deprecated, use <@ instead"); DATA(insert OID = 2865 ( "~" PGNSP PGUID b f f 718 718 16 2864 0 circle_contain contsel contjoinsel )); DESCR("deprecated, use @> instead"); DATA(insert OID = 2866 ( "@" PGNSP PGUID b f f 600 603 16 0 0 on_pb - - )); DESCR("deprecated, use <@ instead"); DATA(insert OID = 2867 ( "@" PGNSP PGUID b f f 600 602 16 2868 0 on_ppath - - )); DESCR("deprecated, use <@ instead"); DATA(insert OID = 2868 ( "~" PGNSP PGUID b f f 602 600 16 2867 0 path_contain_pt - - )); DESCR("deprecated, use @> instead"); DATA(insert OID = 2869 ( "@" PGNSP PGUID b f f 600 604 16 2870 0 pt_contained_poly - - )); DESCR("deprecated, use <@ instead"); DATA(insert OID = 2870 ( "~" PGNSP PGUID b f f 604 600 16 2869 0 poly_contain_pt - - )); DESCR("deprecated, use @> instead"); DATA(insert OID = 2871 ( "@" PGNSP PGUID b f f 600 718 16 2872 0 pt_contained_circle - - )); DESCR("deprecated, use <@ instead"); DATA(insert OID = 2872 ( "~" PGNSP PGUID b f f 718 600 16 2871 0 circle_contain_pt - - )); DESCR("deprecated, use @> instead"); DATA(insert OID = 2873 ( "@" PGNSP PGUID b f f 600 628 16 0 0 on_pl - - )); DESCR("deprecated, use <@ instead"); DATA(insert OID = 2874 ( "@" PGNSP PGUID b f f 600 601 16 0 0 on_ps - - )); DESCR("deprecated, use <@ instead"); DATA(insert OID = 2875 ( "@" PGNSP PGUID b f f 601 628 16 0 0 on_sl - - )); DESCR("deprecated, use <@ instead"); DATA(insert OID = 2876 ( "@" PGNSP PGUID b f f 601 603 16 0 0 on_sb - - )); DESCR("deprecated, use <@ instead"); DATA(insert OID = 2877 ( "~" PGNSP PGUID b f f 1034 1033 16 0 0 aclcontains - - )); DESCR("deprecated, use @> instead"); /* uuid operators */ DATA(insert OID = 2972 ( "=" PGNSP PGUID b t t 2950 2950 16 2972 2973 uuid_eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 2973 ( "<>" PGNSP PGUID b f f 2950 2950 16 2973 2972 uuid_ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 2974 ( "<" PGNSP PGUID b f f 2950 2950 16 2975 2977 uuid_lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 2975 ( ">" PGNSP PGUID b f f 2950 2950 16 2974 2976 uuid_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 2976 ( "<=" PGNSP PGUID b f f 2950 2950 16 2977 2975 uuid_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 2977 ( ">=" PGNSP PGUID b f f 2950 2950 16 2976 2974 uuid_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); /* enum operators */ DATA(insert OID = 3516 ( "=" PGNSP PGUID b t t 3500 3500 16 3516 3517 enum_eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 3517 ( "<>" PGNSP PGUID b f f 3500 3500 16 3517 3516 enum_ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 3518 ( "<" PGNSP PGUID b f f 3500 3500 16 3519 3521 enum_lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 3519 ( ">" PGNSP PGUID b f f 3500 3500 16 3518 3520 enum_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 3520 ( "<=" PGNSP PGUID b f f 3500 3500 16 3521 3519 enum_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 3521 ( ">=" PGNSP PGUID b f f 3500 3500 16 3520 3518 enum_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); /* * tsearch operations */ DATA(insert OID = 3627 ( "<" PGNSP PGUID b f f 3614 3614 16 3632 3631 tsvector_lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 3628 ( "<=" PGNSP PGUID b f f 3614 3614 16 3631 3632 tsvector_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 3629 ( "=" PGNSP PGUID b t f 3614 3614 16 3629 3630 tsvector_eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 3630 ( "<>" PGNSP PGUID b f f 3614 3614 16 3630 3629 tsvector_ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 3631 ( ">=" PGNSP PGUID b f f 3614 3614 16 3628 3627 tsvector_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 3632 ( ">" PGNSP PGUID b f f 3614 3614 16 3627 3628 tsvector_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 3633 ( "||" PGNSP PGUID b f f 3614 3614 3614 0 0 tsvector_concat - - )); DESCR("concatenate"); DATA(insert OID = 3636 ( "@@" PGNSP PGUID b f f 3614 3615 16 3637 0 ts_match_vq tsmatchsel tsmatchjoinsel )); DESCR("text search match"); DATA(insert OID = 3637 ( "@@" PGNSP PGUID b f f 3615 3614 16 3636 0 ts_match_qv tsmatchsel tsmatchjoinsel )); DESCR("text search match"); DATA(insert OID = 3660 ( "@@@" PGNSP PGUID b f f 3614 3615 16 3661 0 ts_match_vq tsmatchsel tsmatchjoinsel )); DESCR("deprecated, use @@ instead"); DATA(insert OID = 3661 ( "@@@" PGNSP PGUID b f f 3615 3614 16 3660 0 ts_match_qv tsmatchsel tsmatchjoinsel )); DESCR("deprecated, use @@ instead"); DATA(insert OID = 3674 ( "<" PGNSP PGUID b f f 3615 3615 16 3679 3678 tsquery_lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 3675 ( "<=" PGNSP PGUID b f f 3615 3615 16 3678 3679 tsquery_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 3676 ( "=" PGNSP PGUID b t f 3615 3615 16 3676 3677 tsquery_eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 3677 ( "<>" PGNSP PGUID b f f 3615 3615 16 3677 3676 tsquery_ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 3678 ( ">=" PGNSP PGUID b f f 3615 3615 16 3675 3674 tsquery_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 3679 ( ">" PGNSP PGUID b f f 3615 3615 16 3674 3675 tsquery_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 3680 ( "&&" PGNSP PGUID b f f 3615 3615 3615 0 0 tsquery_and - - )); DESCR("AND-concatenate"); DATA(insert OID = 3681 ( "||" PGNSP PGUID b f f 3615 3615 3615 0 0 tsquery_or - - )); DESCR("OR-concatenate"); DATA(insert OID = 3682 ( "!!" PGNSP PGUID l f f 0 3615 3615 0 0 tsquery_not - - )); DESCR("NOT tsquery"); DATA(insert OID = 3693 ( "@>" PGNSP PGUID b f f 3615 3615 16 3694 0 tsq_mcontains contsel contjoinsel )); DESCR("contains"); DATA(insert OID = 3694 ( "<@" PGNSP PGUID b f f 3615 3615 16 3693 0 tsq_mcontained contsel contjoinsel )); DESCR("is contained by"); DATA(insert OID = 3762 ( "@@" PGNSP PGUID b f f 25 25 16 0 0 ts_match_tt contsel contjoinsel )); DESCR("text search match"); DATA(insert OID = 3763 ( "@@" PGNSP PGUID b f f 25 3615 16 0 0 ts_match_tq contsel contjoinsel )); DESCR("text search match"); /* generic record comparison operators */ DATA(insert OID = 2988 ( "=" PGNSP PGUID b t f 2249 2249 16 2988 2989 record_eq eqsel eqjoinsel )); DESCR("equal"); #define RECORD_EQ_OP 2988 DATA(insert OID = 2989 ( "<>" PGNSP PGUID b f f 2249 2249 16 2989 2988 record_ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 2990 ( "<" PGNSP PGUID b f f 2249 2249 16 2991 2993 record_lt scalarltsel scalarltjoinsel )); DESCR("less than"); #define RECORD_LT_OP 2990 DATA(insert OID = 2991 ( ">" PGNSP PGUID b f f 2249 2249 16 2990 2992 record_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); #define RECORD_GT_OP 2991 DATA(insert OID = 2992 ( "<=" PGNSP PGUID b f f 2249 2249 16 2993 2991 record_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 2993 ( ">=" PGNSP PGUID b f f 2249 2249 16 2992 2990 record_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); /* generic range type operators */ DATA(insert OID = 3882 ( "=" PGNSP PGUID b t t 3831 3831 16 3882 3883 range_eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 3883 ( "<>" PGNSP PGUID b f f 3831 3831 16 3883 3882 range_ne neqsel neqjoinsel )); DESCR("not equal"); DATA(insert OID = 3884 ( "<" PGNSP PGUID b f f 3831 3831 16 3887 3886 range_lt scalarltsel scalarltjoinsel )); DESCR("less than"); DATA(insert OID = 3885 ( "<=" PGNSP PGUID b f f 3831 3831 16 3886 3887 range_le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 3886 ( ">=" PGNSP PGUID b f f 3831 3831 16 3885 3884 range_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); DATA(insert OID = 3887 ( ">" PGNSP PGUID b f f 3831 3831 16 3884 3885 range_gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 3888 ( "&&" PGNSP PGUID b f f 3831 3831 16 3888 0 range_overlaps areasel areajoinsel )); DESCR("overlaps"); DATA(insert OID = 3889 ( "@>" PGNSP PGUID b f f 3831 2283 16 3891 0 range_contains_elem contsel contjoinsel )); DESCR("contains"); DATA(insert OID = 3890 ( "@>" PGNSP PGUID b f f 3831 3831 16 3892 0 range_contains contsel contjoinsel )); DESCR("contains"); DATA(insert OID = 3891 ( "<@" PGNSP PGUID b f f 2283 3831 16 3889 0 elem_contained_by_range contsel contjoinsel )); DESCR("is contained by"); DATA(insert OID = 3892 ( "<@" PGNSP PGUID b f f 3831 3831 16 3890 0 range_contained_by contsel contjoinsel )); DESCR("is contained by"); DATA(insert OID = 3893 ( "<<" PGNSP PGUID b f f 3831 3831 16 3894 0 range_before scalarltsel scalarltjoinsel )); DESCR("is left of"); DATA(insert OID = 3894 ( ">>" PGNSP PGUID b f f 3831 3831 16 3893 0 range_after scalargtsel scalargtjoinsel )); DESCR("is right of"); DATA(insert OID = 3895 ( "&<" PGNSP PGUID b f f 3831 3831 16 0 0 range_overleft scalarltsel scalarltjoinsel )); DESCR("overlaps or is left of"); DATA(insert OID = 3896 ( "&>" PGNSP PGUID b f f 3831 3831 16 0 0 range_overright scalargtsel scalargtjoinsel )); DESCR("overlaps or is right of"); DATA(insert OID = 3897 ( "-|-" PGNSP PGUID b f f 3831 3831 16 3897 0 range_adjacent contsel contjoinsel )); DESCR("is adjacent to"); DATA(insert OID = 3898 ( "+" PGNSP PGUID b f f 3831 3831 3831 3898 0 range_union - - )); DESCR("range union"); DATA(insert OID = 3899 ( "-" PGNSP PGUID b f f 3831 3831 3831 0 0 range_minus - - )); DESCR("range difference"); DATA(insert OID = 3900 ( "*" PGNSP PGUID b f f 3831 3831 3831 3900 0 range_intersect - - )); DESCR("range intersection"); /* * function prototypes */ extern void OperatorCreate(const char *operatorName, Oid operatorNamespace, Oid leftTypeId, Oid rightTypeId, Oid procedureId, List *commutatorName, List *negatorName, Oid restrictionId, Oid joinId, bool canMerge, bool canHash); #endif /* PG_OPERATOR_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/schemapg.h���������������������������������������������������������������������0000644�����������������00000037432�14763166026�0012576 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * schemapg.h * Schema_pg_xxx macros for use by relcache.c * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * NOTES * ****************************** * *** DO NOT EDIT THIS FILE! *** * ****************************** * * It has been GENERATED by genbki.pl * *------------------------------------------------------------------------- */ #ifndef SCHEMAPG_H #define SCHEMAPG_H #define Schema_pg_proc \ { 1255, {"proname"}, 19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1255, {"pronamespace"}, 26, -1, 4, 2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1255, {"proowner"}, 26, -1, 4, 3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1255, {"prolang"}, 26, -1, 4, 4, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1255, {"procost"}, 700, -1, 4, 5, 0, -1, -1, FLOAT4PASSBYVAL, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1255, {"prorows"}, 700, -1, 4, 6, 0, -1, -1, FLOAT4PASSBYVAL, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1255, {"provariadic"}, 26, -1, 4, 7, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1255, {"protransform"}, 24, -1, 4, 8, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1255, {"proisagg"}, 16, -1, 1, 9, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1255, {"proiswindow"}, 16, -1, 1, 10, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1255, {"prosecdef"}, 16, -1, 1, 11, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1255, {"proleakproof"}, 16, -1, 1, 12, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1255, {"proisstrict"}, 16, -1, 1, 13, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1255, {"proretset"}, 16, -1, 1, 14, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1255, {"provolatile"}, 18, -1, 1, 15, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1255, {"pronargs"}, 21, -1, 2, 16, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, 0 }, \ { 1255, {"pronargdefaults"}, 21, -1, 2, 17, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, 0 }, \ { 1255, {"prorettype"}, 26, -1, 4, 18, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1255, {"proargtypes"}, 30, -1, -1, 19, 1, -1, -1, false, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1255, {"proallargtypes"}, 1028, -1, -1, 20, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, 0 }, \ { 1255, {"proargmodes"}, 1002, -1, -1, 21, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, 0 }, \ { 1255, {"proargnames"}, 1009, -1, -1, 22, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, 100 }, \ { 1255, {"proargdefaults"}, 194, -1, -1, 23, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, 100 }, \ { 1255, {"prosrc"}, 25, -1, -1, 24, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, 100 }, \ { 1255, {"probin"}, 25, -1, -1, 25, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, 100 }, \ { 1255, {"proconfig"}, 1009, -1, -1, 26, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, 100 }, \ { 1255, {"proacl"}, 1034, -1, -1, 27, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, 0 } #define Schema_pg_type \ { 1247, {"typname"}, 19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1247, {"typnamespace"}, 26, -1, 4, 2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1247, {"typowner"}, 26, -1, 4, 3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1247, {"typlen"}, 21, -1, 2, 4, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, 0 }, \ { 1247, {"typbyval"}, 16, -1, 1, 5, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1247, {"typtype"}, 18, -1, 1, 6, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1247, {"typcategory"}, 18, -1, 1, 7, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1247, {"typispreferred"}, 16, -1, 1, 8, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1247, {"typisdefined"}, 16, -1, 1, 9, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1247, {"typdelim"}, 18, -1, 1, 10, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1247, {"typrelid"}, 26, -1, 4, 11, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1247, {"typelem"}, 26, -1, 4, 12, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1247, {"typarray"}, 26, -1, 4, 13, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1247, {"typinput"}, 24, -1, 4, 14, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1247, {"typoutput"}, 24, -1, 4, 15, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1247, {"typreceive"}, 24, -1, 4, 16, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1247, {"typsend"}, 24, -1, 4, 17, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1247, {"typmodin"}, 24, -1, 4, 18, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1247, {"typmodout"}, 24, -1, 4, 19, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1247, {"typanalyze"}, 24, -1, 4, 20, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1247, {"typalign"}, 18, -1, 1, 21, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1247, {"typstorage"}, 18, -1, 1, 22, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1247, {"typnotnull"}, 16, -1, 1, 23, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1247, {"typbasetype"}, 26, -1, 4, 24, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1247, {"typtypmod"}, 23, -1, 4, 25, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1247, {"typndims"}, 23, -1, 4, 26, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1247, {"typcollation"}, 26, -1, 4, 27, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1247, {"typdefaultbin"}, 194, -1, -1, 28, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, 100 }, \ { 1247, {"typdefault"}, 25, -1, -1, 29, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, 100 }, \ { 1247, {"typacl"}, 1034, -1, -1, 30, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, 0 } #define Schema_pg_attribute \ { 1249, {"attrelid"}, 26, -1, 4, 1, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1249, {"attname"}, 19, -1, NAMEDATALEN, 2, 0, -1, -1, false, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1249, {"atttypid"}, 26, -1, 4, 3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1249, {"attstattarget"}, 23, -1, 4, 4, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1249, {"attlen"}, 21, -1, 2, 5, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, 0 }, \ { 1249, {"attnum"}, 21, -1, 2, 6, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, 0 }, \ { 1249, {"attndims"}, 23, -1, 4, 7, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1249, {"attcacheoff"}, 23, -1, 4, 8, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1249, {"atttypmod"}, 23, -1, 4, 9, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1249, {"attbyval"}, 16, -1, 1, 10, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1249, {"attstorage"}, 18, -1, 1, 11, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1249, {"attalign"}, 18, -1, 1, 12, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1249, {"attnotnull"}, 16, -1, 1, 13, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1249, {"atthasdef"}, 16, -1, 1, 14, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1249, {"attisdropped"}, 16, -1, 1, 15, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1249, {"attislocal"}, 16, -1, 1, 16, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1249, {"attinhcount"}, 23, -1, 4, 17, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1249, {"attcollation"}, 26, -1, 4, 18, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1249, {"attacl"}, 1034, -1, -1, 19, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, 0 }, \ { 1249, {"attoptions"}, 1009, -1, -1, 20, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, 100 }, \ { 1249, {"attfdwoptions"}, 1009, -1, -1, 21, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, 100 } #define Schema_pg_class \ { 1259, {"relname"}, 19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1259, {"relnamespace"}, 26, -1, 4, 2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1259, {"reltype"}, 26, -1, 4, 3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1259, {"reloftype"}, 26, -1, 4, 4, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1259, {"relowner"}, 26, -1, 4, 5, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1259, {"relam"}, 26, -1, 4, 6, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1259, {"relfilenode"}, 26, -1, 4, 7, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1259, {"reltablespace"}, 26, -1, 4, 8, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1259, {"relpages"}, 23, -1, 4, 9, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1259, {"reltuples"}, 700, -1, 4, 10, 0, -1, -1, FLOAT4PASSBYVAL, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1259, {"relallvisible"}, 23, -1, 4, 11, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1259, {"reltoastrelid"}, 26, -1, 4, 12, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1259, {"reltoastidxid"}, 26, -1, 4, 13, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1259, {"relhasindex"}, 16, -1, 1, 14, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1259, {"relisshared"}, 16, -1, 1, 15, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1259, {"relpersistence"}, 18, -1, 1, 16, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1259, {"relkind"}, 18, -1, 1, 17, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1259, {"relnatts"}, 21, -1, 2, 18, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, 0 }, \ { 1259, {"relchecks"}, 21, -1, 2, 19, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, 0 }, \ { 1259, {"relhasoids"}, 16, -1, 1, 20, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1259, {"relhaspkey"}, 16, -1, 1, 21, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1259, {"relhasrules"}, 16, -1, 1, 22, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1259, {"relhastriggers"}, 16, -1, 1, 23, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1259, {"relhassubclass"}, 16, -1, 1, 24, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1259, {"relfrozenxid"}, 28, -1, 4, 25, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1259, {"relacl"}, 1034, -1, -1, 26, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, 0 }, \ { 1259, {"reloptions"}, 1009, -1, -1, 27, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, 100 } #define Schema_pg_index \ { 2610, {"indexrelid"}, 26, -1, 4, 1, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 2610, {"indrelid"}, 26, -1, 4, 2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 2610, {"indnatts"}, 21, -1, 2, 3, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, 0 }, \ { 2610, {"indisunique"}, 16, -1, 1, 4, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 2610, {"indisprimary"}, 16, -1, 1, 5, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 2610, {"indisexclusion"}, 16, -1, 1, 6, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 2610, {"indimmediate"}, 16, -1, 1, 7, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 2610, {"indisclustered"}, 16, -1, 1, 8, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 2610, {"indisvalid"}, 16, -1, 1, 9, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 2610, {"indcheckxmin"}, 16, -1, 1, 10, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 2610, {"indisready"}, 16, -1, 1, 11, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 2610, {"indkey"}, 22, -1, -1, 12, 1, -1, -1, false, 'p', 'i', true, false, false, true, 0, 0 }, \ { 2610, {"indcollation"}, 30, -1, -1, 13, 1, -1, -1, false, 'p', 'i', true, false, false, true, 0, 0 }, \ { 2610, {"indclass"}, 30, -1, -1, 14, 1, -1, -1, false, 'p', 'i', true, false, false, true, 0, 0 }, \ { 2610, {"indoption"}, 22, -1, -1, 15, 1, -1, -1, false, 'p', 'i', true, false, false, true, 0, 0 }, \ { 2610, {"indexprs"}, 194, -1, -1, 16, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, 100 }, \ { 2610, {"indpred"}, 194, -1, -1, 17, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, 100 } #define Schema_pg_database \ { 1262, {"datname"}, 19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1262, {"datdba"}, 26, -1, 4, 2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1262, {"encoding"}, 23, -1, 4, 3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1262, {"datcollate"}, 19, -1, NAMEDATALEN, 4, 0, -1, -1, false, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1262, {"datctype"}, 19, -1, NAMEDATALEN, 5, 0, -1, -1, false, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1262, {"datistemplate"}, 16, -1, 1, 6, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1262, {"datallowconn"}, 16, -1, 1, 7, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1262, {"datconnlimit"}, 23, -1, 4, 8, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1262, {"datlastsysoid"}, 26, -1, 4, 9, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1262, {"datfrozenxid"}, 28, -1, 4, 10, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1262, {"dattablespace"}, 26, -1, 4, 11, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1262, {"datacl"}, 1034, -1, -1, 12, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, 0 } #define Schema_pg_authid \ { 1260, {"rolname"}, 19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1260, {"rolsuper"}, 16, -1, 1, 2, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1260, {"rolinherit"}, 16, -1, 1, 3, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1260, {"rolcreaterole"}, 16, -1, 1, 4, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1260, {"rolcreatedb"}, 16, -1, 1, 5, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1260, {"rolcatupdate"}, 16, -1, 1, 6, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1260, {"rolcanlogin"}, 16, -1, 1, 7, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1260, {"rolreplication"}, 16, -1, 1, 8, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 }, \ { 1260, {"rolconnlimit"}, 23, -1, 4, 9, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1260, {"rolpassword"}, 25, -1, -1, 10, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, 100 }, \ { 1260, {"rolvaliduntil"}, 1184, -1, 8, 11, 0, -1, -1, FLOAT8PASSBYVAL, 'p', 'd', false, false, false, true, 0, 0 } #define Schema_pg_auth_members \ { 1261, {"roleid"}, 26, -1, 4, 1, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1261, {"member"}, 26, -1, 4, 2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1261, {"grantor"}, 26, -1, 4, 3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, 0 }, \ { 1261, {"admin_option"}, 16, -1, 1, 4, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, 0 } #endif /* SCHEMAPG_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/dependency.h�������������������������������������������������������������������0000644�����������������00000022706�14763166026�0013123 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * dependency.h * Routines to support inter-object dependencies. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/dependency.h * *------------------------------------------------------------------------- */ #ifndef DEPENDENCY_H #define DEPENDENCY_H #include "catalog/objectaddress.h" /* * Precise semantics of a dependency relationship are specified by the * DependencyType code (which is stored in a "char" field in pg_depend, * so we assign ASCII-code values to the enumeration members). * * In all cases, a dependency relationship indicates that the referenced * object may not be dropped without also dropping the dependent object. * However, there are several subflavors: * * DEPENDENCY_NORMAL ('n'): normal relationship between separately-created * objects. The dependent object may be dropped without affecting the * referenced object. The referenced object may only be dropped by * specifying CASCADE, in which case the dependent object is dropped too. * Example: a table column has a normal dependency on its datatype. * * DEPENDENCY_AUTO ('a'): the dependent object can be dropped separately * from the referenced object, and should be automatically dropped * (regardless of RESTRICT or CASCADE mode) if the referenced object * is dropped. * Example: a named constraint on a table is made auto-dependent on * the table, so that it will go away if the table is dropped. * * DEPENDENCY_INTERNAL ('i'): the dependent object was created as part * of creation of the referenced object, and is really just a part of * its internal implementation. A DROP of the dependent object will be * disallowed outright (we'll tell the user to issue a DROP against the * referenced object, instead). A DROP of the referenced object will be * propagated through to drop the dependent object whether CASCADE is * specified or not. * Example: a trigger that's created to enforce a foreign-key constraint * is made internally dependent on the constraint's pg_constraint entry. * * DEPENDENCY_EXTENSION ('e'): the dependent object is a member of the * extension that is the referenced object. The dependent object can be * dropped only via DROP EXTENSION on the referenced object. Functionally * this dependency type acts the same as an internal dependency, but it's * kept separate for clarity and to simplify pg_dump. * * DEPENDENCY_PIN ('p'): there is no dependent object; this type of entry * is a signal that the system itself depends on the referenced object, * and so that object must never be deleted. Entries of this type are * created only during initdb. The fields for the dependent object * contain zeroes. * * Other dependency flavors may be needed in future. */ typedef enum DependencyType { DEPENDENCY_NORMAL = 'n', DEPENDENCY_AUTO = 'a', DEPENDENCY_INTERNAL = 'i', DEPENDENCY_EXTENSION = 'e', DEPENDENCY_PIN = 'p' } DependencyType; /* * There is also a SharedDependencyType enum type that determines the exact * semantics of an entry in pg_shdepend. Just like regular dependency entries, * any pg_shdepend entry means that the referenced object cannot be dropped * unless the dependent object is dropped at the same time. There are some * additional rules however: * * (a) For a SHARED_DEPENDENCY_PIN entry, there is no dependent object -- * rather, the referenced object is an essential part of the system. This * applies to the initdb-created superuser. Entries of this type are only * created by initdb; objects in this category don't need further pg_shdepend * entries if more objects come to depend on them. * * (b) a SHARED_DEPENDENCY_OWNER entry means that the referenced object is * the role owning the dependent object. The referenced object must be * a pg_authid entry. * * (c) a SHARED_DEPENDENCY_ACL entry means that the referenced object is * a role mentioned in the ACL field of the dependent object. The referenced * object must be a pg_authid entry. (SHARED_DEPENDENCY_ACL entries are not * created for the owner of an object; hence two objects may be linked by * one or the other, but not both, of these dependency types.) * * SHARED_DEPENDENCY_INVALID is a value used as a parameter in internal * routines, and is not valid in the catalog itself. */ typedef enum SharedDependencyType { SHARED_DEPENDENCY_PIN = 'p', SHARED_DEPENDENCY_OWNER = 'o', SHARED_DEPENDENCY_ACL = 'a', SHARED_DEPENDENCY_INVALID = 0 } SharedDependencyType; /* expansible list of ObjectAddresses (private in dependency.c) */ typedef struct ObjectAddresses ObjectAddresses; /* * This enum covers all system catalogs whose OIDs can appear in * pg_depend.classId or pg_shdepend.classId. */ typedef enum ObjectClass { OCLASS_CLASS, /* pg_class */ OCLASS_PROC, /* pg_proc */ OCLASS_TYPE, /* pg_type */ OCLASS_CAST, /* pg_cast */ OCLASS_COLLATION, /* pg_collation */ OCLASS_CONSTRAINT, /* pg_constraint */ OCLASS_CONVERSION, /* pg_conversion */ OCLASS_DEFAULT, /* pg_attrdef */ OCLASS_LANGUAGE, /* pg_language */ OCLASS_LARGEOBJECT, /* pg_largeobject */ OCLASS_OPERATOR, /* pg_operator */ OCLASS_OPCLASS, /* pg_opclass */ OCLASS_OPFAMILY, /* pg_opfamily */ OCLASS_AMOP, /* pg_amop */ OCLASS_AMPROC, /* pg_amproc */ OCLASS_REWRITE, /* pg_rewrite */ OCLASS_TRIGGER, /* pg_trigger */ OCLASS_SCHEMA, /* pg_namespace */ OCLASS_TSPARSER, /* pg_ts_parser */ OCLASS_TSDICT, /* pg_ts_dict */ OCLASS_TSTEMPLATE, /* pg_ts_template */ OCLASS_TSCONFIG, /* pg_ts_config */ OCLASS_ROLE, /* pg_authid */ OCLASS_DATABASE, /* pg_database */ OCLASS_TBLSPACE, /* pg_tablespace */ OCLASS_FDW, /* pg_foreign_data_wrapper */ OCLASS_FOREIGN_SERVER, /* pg_foreign_server */ OCLASS_USER_MAPPING, /* pg_user_mapping */ OCLASS_DEFACL, /* pg_default_acl */ OCLASS_EXTENSION, /* pg_extension */ MAX_OCLASS /* MUST BE LAST */ } ObjectClass; /* in dependency.c */ #define PERFORM_DELETION_INTERNAL 0x0001 #define PERFORM_DELETION_CONCURRENTLY 0x0002 extern void performDeletion(const ObjectAddress *object, DropBehavior behavior, int flags); extern void performMultipleDeletions(const ObjectAddresses *objects, DropBehavior behavior, int flags); extern void deleteWhatDependsOn(const ObjectAddress *object, bool showNotices); extern void recordDependencyOnExpr(const ObjectAddress *depender, Node *expr, List *rtable, DependencyType behavior); extern void recordDependencyOnSingleRelExpr(const ObjectAddress *depender, Node *expr, Oid relId, DependencyType behavior, DependencyType self_behavior); extern ObjectClass getObjectClass(const ObjectAddress *object); extern char *getObjectDescription(const ObjectAddress *object); extern char *getObjectDescriptionOids(Oid classid, Oid objid); extern ObjectAddresses *new_object_addresses(void); extern void add_exact_object_address(const ObjectAddress *object, ObjectAddresses *addrs); extern bool object_address_present(const ObjectAddress *object, const ObjectAddresses *addrs); extern void record_object_address_dependencies(const ObjectAddress *depender, ObjectAddresses *referenced, DependencyType behavior); extern void free_object_addresses(ObjectAddresses *addrs); /* in pg_depend.c */ extern void recordDependencyOn(const ObjectAddress *depender, const ObjectAddress *referenced, DependencyType behavior); extern void recordMultipleDependencies(const ObjectAddress *depender, const ObjectAddress *referenced, int nreferenced, DependencyType behavior); extern void recordDependencyOnCurrentExtension(const ObjectAddress *object, bool isReplace); extern long deleteDependencyRecordsFor(Oid classId, Oid objectId, bool skipExtensionDeps); extern long deleteDependencyRecordsForClass(Oid classId, Oid objectId, Oid refclassId, char deptype); extern long changeDependencyFor(Oid classId, Oid objectId, Oid refClassId, Oid oldRefObjectId, Oid newRefObjectId); extern Oid getExtensionOfObject(Oid classId, Oid objectId); extern bool sequenceIsOwned(Oid seqId, Oid *tableId, int32 *colId); extern void markSequenceUnowned(Oid seqId); extern List *getOwnedSequences(Oid relid); extern Oid get_constraint_index(Oid constraintId); extern Oid get_index_constraint(Oid indexId); /* in pg_shdepend.c */ extern void recordSharedDependencyOn(ObjectAddress *depender, ObjectAddress *referenced, SharedDependencyType deptype); extern void deleteSharedDependencyRecordsFor(Oid classId, Oid objectId, int32 objectSubId); extern void recordDependencyOnOwner(Oid classId, Oid objectId, Oid owner); extern void changeDependencyOnOwner(Oid classId, Oid objectId, Oid newOwnerId); extern void updateAclDependencies(Oid classId, Oid objectId, int32 objectSubId, Oid ownerId, int noldmembers, Oid *oldmembers, int nnewmembers, Oid *newmembers); extern bool checkSharedDependencies(Oid classId, Oid objectId, char **detail_msg, char **detail_log_msg); extern void shdepLockAndCheckObject(Oid classId, Oid objectId); extern void copyTemplateDependencies(Oid templateDbId, Oid newDbId); extern void dropDatabaseDependencies(Oid databaseId); extern void shdepDropOwned(List *relids, DropBehavior behavior); extern void shdepReassignOwned(List *relids, Oid newrole); #endif /* DEPENDENCY_H */ ����������������������������������������������������������pgsql/server/catalog/pg_amproc.h��������������������������������������������������������������������0000644�����������������00000034011�14763166026�0012744 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_amproc.h * definition of the system "amproc" relation (pg_amproc) * along with the relation's initial contents. * * The amproc table identifies support procedures associated with index * operator families and classes. These procedures can't be listed in pg_amop * since they are not the implementation of any indexable operator. * * The primary key for this table is <amprocfamily, amproclefttype, * amprocrighttype, amprocnum>. The "default" support functions for a * particular opclass within the family are those with amproclefttype = * amprocrighttype = opclass's opcintype. These are the ones loaded into the * relcache for an index and typically used for internal index operations. * Other support functions are typically used to handle cross-type indexable * operators with oprleft/oprright matching the entry's amproclefttype and * amprocrighttype. The exact behavior depends on the index AM, however, and * some don't pay attention to non-default functions at all. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_amproc.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_AMPROC_H #define PG_AMPROC_H #include "catalog/genbki.h" /* ---------------- * pg_amproc definition. cpp turns this into * typedef struct FormData_pg_amproc * ---------------- */ #define AccessMethodProcedureRelationId 2603 CATALOG(pg_amproc,2603) { Oid amprocfamily; /* the index opfamily this entry is for */ Oid amproclefttype; /* procedure's left input data type */ Oid amprocrighttype; /* procedure's right input data type */ int2 amprocnum; /* support procedure index */ regproc amproc; /* OID of the proc */ } FormData_pg_amproc; /* ---------------- * Form_pg_amproc corresponds to a pointer to a tuple with * the format of pg_amproc relation. * ---------------- */ typedef FormData_pg_amproc *Form_pg_amproc; /* ---------------- * compiler constants for pg_amproc * ---------------- */ #define Natts_pg_amproc 5 #define Anum_pg_amproc_amprocfamily 1 #define Anum_pg_amproc_amproclefttype 2 #define Anum_pg_amproc_amprocrighttype 3 #define Anum_pg_amproc_amprocnum 4 #define Anum_pg_amproc_amproc 5 /* ---------------- * initial contents of pg_amproc * ---------------- */ /* btree */ DATA(insert ( 397 2277 2277 1 382 )); DATA(insert ( 421 702 702 1 357 )); DATA(insert ( 423 1560 1560 1 1596 )); DATA(insert ( 424 16 16 1 1693 )); DATA(insert ( 426 1042 1042 1 1078 )); DATA(insert ( 428 17 17 1 1954 )); DATA(insert ( 429 18 18 1 358 )); DATA(insert ( 434 1082 1082 1 1092 )); DATA(insert ( 434 1082 1082 2 3136 )); DATA(insert ( 434 1082 1114 1 2344 )); DATA(insert ( 434 1082 1184 1 2357 )); DATA(insert ( 434 1114 1114 1 2045 )); DATA(insert ( 434 1114 1114 2 3137 )); DATA(insert ( 434 1114 1082 1 2370 )); DATA(insert ( 434 1114 1184 1 2526 )); DATA(insert ( 434 1184 1184 1 1314 )); DATA(insert ( 434 1184 1184 2 3137 )); DATA(insert ( 434 1184 1082 1 2383 )); DATA(insert ( 434 1184 1114 1 2533 )); DATA(insert ( 1970 700 700 1 354 )); DATA(insert ( 1970 700 700 2 3132 )); DATA(insert ( 1970 700 701 1 2194 )); DATA(insert ( 1970 701 701 1 355 )); DATA(insert ( 1970 701 701 2 3133 )); DATA(insert ( 1970 701 700 1 2195 )); DATA(insert ( 1974 869 869 1 926 )); DATA(insert ( 1976 21 21 1 350 )); DATA(insert ( 1976 21 21 2 3129 )); DATA(insert ( 1976 21 23 1 2190 )); DATA(insert ( 1976 21 20 1 2192 )); DATA(insert ( 1976 23 23 1 351 )); DATA(insert ( 1976 23 23 2 3130 )); DATA(insert ( 1976 23 20 1 2188 )); DATA(insert ( 1976 23 21 1 2191 )); DATA(insert ( 1976 20 20 1 842 )); DATA(insert ( 1976 20 20 2 3131 )); DATA(insert ( 1976 20 23 1 2189 )); DATA(insert ( 1976 20 21 1 2193 )); DATA(insert ( 1982 1186 1186 1 1315 )); DATA(insert ( 1984 829 829 1 836 )); DATA(insert ( 1986 19 19 1 359 )); DATA(insert ( 1986 19 19 2 3135 )); DATA(insert ( 1988 1700 1700 1 1769 )); DATA(insert ( 1989 26 26 1 356 )); DATA(insert ( 1989 26 26 2 3134 )); DATA(insert ( 1991 30 30 1 404 )); DATA(insert ( 2994 2249 2249 1 2987 )); DATA(insert ( 1994 25 25 1 360 )); DATA(insert ( 1996 1083 1083 1 1107 )); DATA(insert ( 2000 1266 1266 1 1358 )); DATA(insert ( 2002 1562 1562 1 1672 )); DATA(insert ( 2095 25 25 1 2166 )); DATA(insert ( 2097 1042 1042 1 2180 )); DATA(insert ( 2099 790 790 1 377 )); DATA(insert ( 2233 703 703 1 380 )); DATA(insert ( 2234 704 704 1 381 )); DATA(insert ( 2789 27 27 1 2794 )); DATA(insert ( 2968 2950 2950 1 2960 )); DATA(insert ( 3522 3500 3500 1 3514 )); /* hash */ DATA(insert ( 427 1042 1042 1 1080 )); DATA(insert ( 431 18 18 1 454 )); DATA(insert ( 435 1082 1082 1 450 )); DATA(insert ( 627 2277 2277 1 626 )); DATA(insert ( 1971 700 700 1 451 )); DATA(insert ( 1971 701 701 1 452 )); DATA(insert ( 1975 869 869 1 422 )); DATA(insert ( 1977 21 21 1 449 )); DATA(insert ( 1977 23 23 1 450 )); DATA(insert ( 1977 20 20 1 949 )); DATA(insert ( 1983 1186 1186 1 1697 )); DATA(insert ( 1985 829 829 1 399 )); DATA(insert ( 1987 19 19 1 455 )); DATA(insert ( 1990 26 26 1 453 )); DATA(insert ( 1992 30 30 1 457 )); DATA(insert ( 1995 25 25 1 400 )); DATA(insert ( 1997 1083 1083 1 1688 )); DATA(insert ( 1998 1700 1700 1 432 )); DATA(insert ( 1999 1184 1184 1 2039 )); DATA(insert ( 2001 1266 1266 1 1696 )); DATA(insert ( 2040 1114 1114 1 2039 )); DATA(insert ( 2222 16 16 1 454 )); DATA(insert ( 2223 17 17 1 456 )); DATA(insert ( 2224 22 22 1 398 )); DATA(insert ( 2225 28 28 1 450 )); DATA(insert ( 2226 29 29 1 450 )); DATA(insert ( 2227 702 702 1 450 )); DATA(insert ( 2228 703 703 1 450 )); DATA(insert ( 2229 25 25 1 400 )); DATA(insert ( 2231 1042 1042 1 1080 )); DATA(insert ( 2235 1033 1033 1 329 )); DATA(insert ( 2969 2950 2950 1 2963 )); DATA(insert ( 3523 3500 3500 1 3515 )); /* gist */ DATA(insert ( 2593 603 603 1 2578 )); DATA(insert ( 2593 603 603 2 2583 )); DATA(insert ( 2593 603 603 3 2579 )); DATA(insert ( 2593 603 603 4 2580 )); DATA(insert ( 2593 603 603 5 2581 )); DATA(insert ( 2593 603 603 6 2582 )); DATA(insert ( 2593 603 603 7 2584 )); DATA(insert ( 2594 604 604 1 2585 )); DATA(insert ( 2594 604 604 2 2583 )); DATA(insert ( 2594 604 604 3 2586 )); DATA(insert ( 2594 604 604 4 2580 )); DATA(insert ( 2594 604 604 5 2581 )); DATA(insert ( 2594 604 604 6 2582 )); DATA(insert ( 2594 604 604 7 2584 )); DATA(insert ( 2595 718 718 1 2591 )); DATA(insert ( 2595 718 718 2 2583 )); DATA(insert ( 2595 718 718 3 2592 )); DATA(insert ( 2595 718 718 4 2580 )); DATA(insert ( 2595 718 718 5 2581 )); DATA(insert ( 2595 718 718 6 2582 )); DATA(insert ( 2595 718 718 7 2584 )); DATA(insert ( 3655 3614 3614 1 3654 )); DATA(insert ( 3655 3614 3614 2 3651 )); DATA(insert ( 3655 3614 3614 3 3648 )); DATA(insert ( 3655 3614 3614 4 3649 )); DATA(insert ( 3655 3614 3614 5 3653 )); DATA(insert ( 3655 3614 3614 6 3650 )); DATA(insert ( 3655 3614 3614 7 3652 )); DATA(insert ( 3702 3615 3615 1 3701 )); DATA(insert ( 3702 3615 3615 2 3698 )); DATA(insert ( 3702 3615 3615 3 3695 )); DATA(insert ( 3702 3615 3615 4 3696 )); DATA(insert ( 3702 3615 3615 5 3700 )); DATA(insert ( 3702 3615 3615 6 3697 )); DATA(insert ( 3702 3615 3615 7 3699 )); DATA(insert ( 1029 600 600 1 2179 )); DATA(insert ( 1029 600 600 2 2583 )); DATA(insert ( 1029 600 600 3 1030 )); DATA(insert ( 1029 600 600 4 2580 )); DATA(insert ( 1029 600 600 5 2581 )); DATA(insert ( 1029 600 600 6 2582 )); DATA(insert ( 1029 600 600 7 2584 )); DATA(insert ( 1029 600 600 8 3064 )); /* gin */ DATA(insert ( 2745 1007 1007 1 351 )); DATA(insert ( 2745 1007 1007 2 2743 )); DATA(insert ( 2745 1007 1007 3 2774 )); DATA(insert ( 2745 1007 1007 4 2744 )); DATA(insert ( 2745 1009 1009 1 360 )); DATA(insert ( 2745 1009 1009 2 2743 )); DATA(insert ( 2745 1009 1009 3 2774 )); DATA(insert ( 2745 1009 1009 4 2744 )); DATA(insert ( 2745 1015 1015 1 360 )); DATA(insert ( 2745 1015 1015 2 2743 )); DATA(insert ( 2745 1015 1015 3 2774 )); DATA(insert ( 2745 1015 1015 4 2744 )); DATA(insert ( 2745 1023 1023 1 357 )); DATA(insert ( 2745 1023 1023 2 2743 )); DATA(insert ( 2745 1023 1023 3 2774 )); DATA(insert ( 2745 1023 1023 4 2744 )); DATA(insert ( 2745 1561 1561 1 1596 )); DATA(insert ( 2745 1561 1561 2 2743 )); DATA(insert ( 2745 1561 1561 3 2774 )); DATA(insert ( 2745 1561 1561 4 2744 )); DATA(insert ( 2745 1000 1000 1 1693 )); DATA(insert ( 2745 1000 1000 2 2743 )); DATA(insert ( 2745 1000 1000 3 2774 )); DATA(insert ( 2745 1000 1000 4 2744 )); DATA(insert ( 2745 1014 1014 1 1078 )); DATA(insert ( 2745 1014 1014 2 2743 )); DATA(insert ( 2745 1014 1014 3 2774 )); DATA(insert ( 2745 1014 1014 4 2744 )); DATA(insert ( 2745 1001 1001 1 1954 )); DATA(insert ( 2745 1001 1001 2 2743 )); DATA(insert ( 2745 1001 1001 3 2774 )); DATA(insert ( 2745 1001 1001 4 2744 )); DATA(insert ( 2745 1002 1002 1 358 )); DATA(insert ( 2745 1002 1002 2 2743 )); DATA(insert ( 2745 1002 1002 3 2774 )); DATA(insert ( 2745 1002 1002 4 2744 )); DATA(insert ( 2745 1182 1182 1 1092 )); DATA(insert ( 2745 1182 1182 2 2743 )); DATA(insert ( 2745 1182 1182 3 2774 )); DATA(insert ( 2745 1182 1182 4 2744 )); DATA(insert ( 2745 1021 1021 1 354 )); DATA(insert ( 2745 1021 1021 2 2743 )); DATA(insert ( 2745 1021 1021 3 2774 )); DATA(insert ( 2745 1021 1021 4 2744 )); DATA(insert ( 2745 1022 1022 1 355 )); DATA(insert ( 2745 1022 1022 2 2743 )); DATA(insert ( 2745 1022 1022 3 2774 )); DATA(insert ( 2745 1022 1022 4 2744 )); DATA(insert ( 2745 1041 1041 1 926 )); DATA(insert ( 2745 1041 1041 2 2743 )); DATA(insert ( 2745 1041 1041 3 2774 )); DATA(insert ( 2745 1041 1041 4 2744 )); DATA(insert ( 2745 651 651 1 926 )); DATA(insert ( 2745 651 651 2 2743 )); DATA(insert ( 2745 651 651 3 2774 )); DATA(insert ( 2745 651 651 4 2744 )); DATA(insert ( 2745 1005 1005 1 350 )); DATA(insert ( 2745 1005 1005 2 2743 )); DATA(insert ( 2745 1005 1005 3 2774 )); DATA(insert ( 2745 1005 1005 4 2744 )); DATA(insert ( 2745 1016 1016 1 842 )); DATA(insert ( 2745 1016 1016 2 2743 )); DATA(insert ( 2745 1016 1016 3 2774 )); DATA(insert ( 2745 1016 1016 4 2744 )); DATA(insert ( 2745 1187 1187 1 1315 )); DATA(insert ( 2745 1187 1187 2 2743 )); DATA(insert ( 2745 1187 1187 3 2774 )); DATA(insert ( 2745 1187 1187 4 2744 )); DATA(insert ( 2745 1040 1040 1 836 )); DATA(insert ( 2745 1040 1040 2 2743 )); DATA(insert ( 2745 1040 1040 3 2774 )); DATA(insert ( 2745 1040 1040 4 2744 )); DATA(insert ( 2745 1003 1003 1 359 )); DATA(insert ( 2745 1003 1003 2 2743 )); DATA(insert ( 2745 1003 1003 3 2774 )); DATA(insert ( 2745 1003 1003 4 2744 )); DATA(insert ( 2745 1231 1231 1 1769 )); DATA(insert ( 2745 1231 1231 2 2743 )); DATA(insert ( 2745 1231 1231 3 2774 )); DATA(insert ( 2745 1231 1231 4 2744 )); DATA(insert ( 2745 1028 1028 1 356 )); DATA(insert ( 2745 1028 1028 2 2743 )); DATA(insert ( 2745 1028 1028 3 2774 )); DATA(insert ( 2745 1028 1028 4 2744 )); DATA(insert ( 2745 1013 1013 1 404 )); DATA(insert ( 2745 1013 1013 2 2743 )); DATA(insert ( 2745 1013 1013 3 2774 )); DATA(insert ( 2745 1013 1013 4 2744 )); DATA(insert ( 2745 1183 1183 1 1107 )); DATA(insert ( 2745 1183 1183 2 2743 )); DATA(insert ( 2745 1183 1183 3 2774 )); DATA(insert ( 2745 1183 1183 4 2744 )); DATA(insert ( 2745 1185 1185 1 1314 )); DATA(insert ( 2745 1185 1185 2 2743 )); DATA(insert ( 2745 1185 1185 3 2774 )); DATA(insert ( 2745 1185 1185 4 2744 )); DATA(insert ( 2745 1270 1270 1 1358 )); DATA(insert ( 2745 1270 1270 2 2743 )); DATA(insert ( 2745 1270 1270 3 2774 )); DATA(insert ( 2745 1270 1270 4 2744 )); DATA(insert ( 2745 1563 1563 1 1672 )); DATA(insert ( 2745 1563 1563 2 2743 )); DATA(insert ( 2745 1563 1563 3 2774 )); DATA(insert ( 2745 1563 1563 4 2744 )); DATA(insert ( 2745 1115 1115 1 2045 )); DATA(insert ( 2745 1115 1115 2 2743 )); DATA(insert ( 2745 1115 1115 3 2774 )); DATA(insert ( 2745 1115 1115 4 2744 )); DATA(insert ( 2745 791 791 1 377 )); DATA(insert ( 2745 791 791 2 2743 )); DATA(insert ( 2745 791 791 3 2774 )); DATA(insert ( 2745 791 791 4 2744 )); DATA(insert ( 2745 1024 1024 1 380 )); DATA(insert ( 2745 1024 1024 2 2743 )); DATA(insert ( 2745 1024 1024 3 2774 )); DATA(insert ( 2745 1024 1024 4 2744 )); DATA(insert ( 2745 1025 1025 1 381 )); DATA(insert ( 2745 1025 1025 2 2743 )); DATA(insert ( 2745 1025 1025 3 2774 )); DATA(insert ( 2745 1025 1025 4 2744 )); DATA(insert ( 3659 3614 3614 1 3724 )); DATA(insert ( 3659 3614 3614 2 3656 )); DATA(insert ( 3659 3614 3614 3 3657 )); DATA(insert ( 3659 3614 3614 4 3658 )); DATA(insert ( 3659 3614 3614 5 2700 )); DATA(insert ( 3626 3614 3614 1 3622 )); DATA(insert ( 3683 3615 3615 1 3668 )); DATA(insert ( 3901 3831 3831 1 3870 )); DATA(insert ( 3903 3831 3831 1 3902 )); DATA(insert ( 3919 3831 3831 1 3875 )); DATA(insert ( 3919 3831 3831 2 3876 )); DATA(insert ( 3919 3831 3831 3 3877 )); DATA(insert ( 3919 3831 3831 4 3878 )); DATA(insert ( 3919 3831 3831 5 3879 )); DATA(insert ( 3919 3831 3831 6 3880 )); DATA(insert ( 3919 3831 3831 7 3881 )); /* sp-gist */ DATA(insert ( 4015 600 600 1 4018 )); DATA(insert ( 4015 600 600 2 4019 )); DATA(insert ( 4015 600 600 3 4020 )); DATA(insert ( 4015 600 600 4 4021 )); DATA(insert ( 4015 600 600 5 4022 )); DATA(insert ( 4016 600 600 1 4023 )); DATA(insert ( 4016 600 600 2 4024 )); DATA(insert ( 4016 600 600 3 4025 )); DATA(insert ( 4016 600 600 4 4026 )); DATA(insert ( 4016 600 600 5 4022 )); DATA(insert ( 4017 25 25 1 4027 )); DATA(insert ( 4017 25 25 2 4028 )); DATA(insert ( 4017 25 25 3 4029 )); DATA(insert ( 4017 25 25 4 4030 )); DATA(insert ( 4017 25 25 5 4031 )); #endif /* PG_AMPROC_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_aggregate.h�����������������������������������������������������������������0000644�����������������00000024561�14763166026�0013422 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_aggregate.h * definition of the system "aggregate" relation (pg_aggregate) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_aggregate.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_AGGREGATE_H #define PG_AGGREGATE_H #include "catalog/genbki.h" #include "nodes/pg_list.h" /* ---------------------------------------------------------------- * pg_aggregate definition. * * cpp turns this into typedef struct FormData_pg_aggregate * * aggfnoid pg_proc OID of the aggregate itself * aggtransfn transition function * aggfinalfn final function (0 if none) * aggsortop associated sort operator (0 if none) * aggtranstype type of aggregate's transition (state) data * agginitval initial value for transition state (can be NULL) * ---------------------------------------------------------------- */ #define AggregateRelationId 2600 CATALOG(pg_aggregate,2600) BKI_WITHOUT_OIDS { regproc aggfnoid; regproc aggtransfn; regproc aggfinalfn; Oid aggsortop; Oid aggtranstype; #ifdef CATALOG_VARLEN /* variable-length fields start here */ text agginitval; #endif } FormData_pg_aggregate; /* ---------------- * Form_pg_aggregate corresponds to a pointer to a tuple with * the format of pg_aggregate relation. * ---------------- */ typedef FormData_pg_aggregate *Form_pg_aggregate; /* ---------------- * compiler constants for pg_aggregate * ---------------- */ #define Natts_pg_aggregate 6 #define Anum_pg_aggregate_aggfnoid 1 #define Anum_pg_aggregate_aggtransfn 2 #define Anum_pg_aggregate_aggfinalfn 3 #define Anum_pg_aggregate_aggsortop 4 #define Anum_pg_aggregate_aggtranstype 5 #define Anum_pg_aggregate_agginitval 6 /* ---------------- * initial contents of pg_aggregate * --------------- */ /* avg */ DATA(insert ( 2100 int8_avg_accum numeric_avg 0 1231 "{0,0}" )); DATA(insert ( 2101 int4_avg_accum int8_avg 0 1016 "{0,0}" )); DATA(insert ( 2102 int2_avg_accum int8_avg 0 1016 "{0,0}" )); DATA(insert ( 2103 numeric_avg_accum numeric_avg 0 1231 "{0,0}" )); DATA(insert ( 2104 float4_accum float8_avg 0 1022 "{0,0,0}" )); DATA(insert ( 2105 float8_accum float8_avg 0 1022 "{0,0,0}" )); DATA(insert ( 2106 interval_accum interval_avg 0 1187 "{0 second,0 second}" )); /* sum */ DATA(insert ( 2107 int8_sum - 0 1700 _null_ )); DATA(insert ( 2108 int4_sum - 0 20 _null_ )); DATA(insert ( 2109 int2_sum - 0 20 _null_ )); DATA(insert ( 2110 float4pl - 0 700 _null_ )); DATA(insert ( 2111 float8pl - 0 701 _null_ )); DATA(insert ( 2112 cash_pl - 0 790 _null_ )); DATA(insert ( 2113 interval_pl - 0 1186 _null_ )); DATA(insert ( 2114 numeric_add - 0 1700 _null_ )); /* max */ DATA(insert ( 2115 int8larger - 413 20 _null_ )); DATA(insert ( 2116 int4larger - 521 23 _null_ )); DATA(insert ( 2117 int2larger - 520 21 _null_ )); DATA(insert ( 2118 oidlarger - 610 26 _null_ )); DATA(insert ( 2119 float4larger - 623 700 _null_ )); DATA(insert ( 2120 float8larger - 674 701 _null_ )); DATA(insert ( 2121 int4larger - 563 702 _null_ )); DATA(insert ( 2122 date_larger - 1097 1082 _null_ )); DATA(insert ( 2123 time_larger - 1112 1083 _null_ )); DATA(insert ( 2124 timetz_larger - 1554 1266 _null_ )); DATA(insert ( 2125 cashlarger - 903 790 _null_ )); DATA(insert ( 2126 timestamp_larger - 2064 1114 _null_ )); DATA(insert ( 2127 timestamptz_larger - 1324 1184 _null_ )); DATA(insert ( 2128 interval_larger - 1334 1186 _null_ )); DATA(insert ( 2129 text_larger - 666 25 _null_ )); DATA(insert ( 2130 numeric_larger - 1756 1700 _null_ )); DATA(insert ( 2050 array_larger - 1073 2277 _null_ )); DATA(insert ( 2244 bpchar_larger - 1060 1042 _null_ )); DATA(insert ( 2797 tidlarger - 2800 27 _null_ )); DATA(insert ( 3526 enum_larger - 3519 3500 _null_ )); /* min */ DATA(insert ( 2131 int8smaller - 412 20 _null_ )); DATA(insert ( 2132 int4smaller - 97 23 _null_ )); DATA(insert ( 2133 int2smaller - 95 21 _null_ )); DATA(insert ( 2134 oidsmaller - 609 26 _null_ )); DATA(insert ( 2135 float4smaller - 622 700 _null_ )); DATA(insert ( 2136 float8smaller - 672 701 _null_ )); DATA(insert ( 2137 int4smaller - 562 702 _null_ )); DATA(insert ( 2138 date_smaller - 1095 1082 _null_ )); DATA(insert ( 2139 time_smaller - 1110 1083 _null_ )); DATA(insert ( 2140 timetz_smaller - 1552 1266 _null_ )); DATA(insert ( 2141 cashsmaller - 902 790 _null_ )); DATA(insert ( 2142 timestamp_smaller - 2062 1114 _null_ )); DATA(insert ( 2143 timestamptz_smaller - 1322 1184 _null_ )); DATA(insert ( 2144 interval_smaller - 1332 1186 _null_ )); DATA(insert ( 2145 text_smaller - 664 25 _null_ )); DATA(insert ( 2146 numeric_smaller - 1754 1700 _null_ )); DATA(insert ( 2051 array_smaller - 1072 2277 _null_ )); DATA(insert ( 2245 bpchar_smaller - 1058 1042 _null_ )); DATA(insert ( 2798 tidsmaller - 2799 27 _null_ )); DATA(insert ( 3527 enum_smaller - 3518 3500 _null_ )); /* count */ DATA(insert ( 2147 int8inc_any - 0 20 "0" )); DATA(insert ( 2803 int8inc - 0 20 "0" )); /* var_pop */ DATA(insert ( 2718 int8_accum numeric_var_pop 0 1231 "{0,0,0}" )); DATA(insert ( 2719 int4_accum numeric_var_pop 0 1231 "{0,0,0}" )); DATA(insert ( 2720 int2_accum numeric_var_pop 0 1231 "{0,0,0}" )); DATA(insert ( 2721 float4_accum float8_var_pop 0 1022 "{0,0,0}" )); DATA(insert ( 2722 float8_accum float8_var_pop 0 1022 "{0,0,0}" )); DATA(insert ( 2723 numeric_accum numeric_var_pop 0 1231 "{0,0,0}" )); /* var_samp */ DATA(insert ( 2641 int8_accum numeric_var_samp 0 1231 "{0,0,0}" )); DATA(insert ( 2642 int4_accum numeric_var_samp 0 1231 "{0,0,0}" )); DATA(insert ( 2643 int2_accum numeric_var_samp 0 1231 "{0,0,0}" )); DATA(insert ( 2644 float4_accum float8_var_samp 0 1022 "{0,0,0}" )); DATA(insert ( 2645 float8_accum float8_var_samp 0 1022 "{0,0,0}" )); DATA(insert ( 2646 numeric_accum numeric_var_samp 0 1231 "{0,0,0}" )); /* variance: historical Postgres syntax for var_samp */ DATA(insert ( 2148 int8_accum numeric_var_samp 0 1231 "{0,0,0}" )); DATA(insert ( 2149 int4_accum numeric_var_samp 0 1231 "{0,0,0}" )); DATA(insert ( 2150 int2_accum numeric_var_samp 0 1231 "{0,0,0}" )); DATA(insert ( 2151 float4_accum float8_var_samp 0 1022 "{0,0,0}" )); DATA(insert ( 2152 float8_accum float8_var_samp 0 1022 "{0,0,0}" )); DATA(insert ( 2153 numeric_accum numeric_var_samp 0 1231 "{0,0,0}" )); /* stddev_pop */ DATA(insert ( 2724 int8_accum numeric_stddev_pop 0 1231 "{0,0,0}" )); DATA(insert ( 2725 int4_accum numeric_stddev_pop 0 1231 "{0,0,0}" )); DATA(insert ( 2726 int2_accum numeric_stddev_pop 0 1231 "{0,0,0}" )); DATA(insert ( 2727 float4_accum float8_stddev_pop 0 1022 "{0,0,0}" )); DATA(insert ( 2728 float8_accum float8_stddev_pop 0 1022 "{0,0,0}" )); DATA(insert ( 2729 numeric_accum numeric_stddev_pop 0 1231 "{0,0,0}" )); /* stddev_samp */ DATA(insert ( 2712 int8_accum numeric_stddev_samp 0 1231 "{0,0,0}" )); DATA(insert ( 2713 int4_accum numeric_stddev_samp 0 1231 "{0,0,0}" )); DATA(insert ( 2714 int2_accum numeric_stddev_samp 0 1231 "{0,0,0}" )); DATA(insert ( 2715 float4_accum float8_stddev_samp 0 1022 "{0,0,0}" )); DATA(insert ( 2716 float8_accum float8_stddev_samp 0 1022 "{0,0,0}" )); DATA(insert ( 2717 numeric_accum numeric_stddev_samp 0 1231 "{0,0,0}" )); /* stddev: historical Postgres syntax for stddev_samp */ DATA(insert ( 2154 int8_accum numeric_stddev_samp 0 1231 "{0,0,0}" )); DATA(insert ( 2155 int4_accum numeric_stddev_samp 0 1231 "{0,0,0}" )); DATA(insert ( 2156 int2_accum numeric_stddev_samp 0 1231 "{0,0,0}" )); DATA(insert ( 2157 float4_accum float8_stddev_samp 0 1022 "{0,0,0}" )); DATA(insert ( 2158 float8_accum float8_stddev_samp 0 1022 "{0,0,0}" )); DATA(insert ( 2159 numeric_accum numeric_stddev_samp 0 1231 "{0,0,0}" )); /* SQL2003 binary regression aggregates */ DATA(insert ( 2818 int8inc_float8_float8 - 0 20 "0" )); DATA(insert ( 2819 float8_regr_accum float8_regr_sxx 0 1022 "{0,0,0,0,0,0}" )); DATA(insert ( 2820 float8_regr_accum float8_regr_syy 0 1022 "{0,0,0,0,0,0}" )); DATA(insert ( 2821 float8_regr_accum float8_regr_sxy 0 1022 "{0,0,0,0,0,0}" )); DATA(insert ( 2822 float8_regr_accum float8_regr_avgx 0 1022 "{0,0,0,0,0,0}" )); DATA(insert ( 2823 float8_regr_accum float8_regr_avgy 0 1022 "{0,0,0,0,0,0}" )); DATA(insert ( 2824 float8_regr_accum float8_regr_r2 0 1022 "{0,0,0,0,0,0}" )); DATA(insert ( 2825 float8_regr_accum float8_regr_slope 0 1022 "{0,0,0,0,0,0}" )); DATA(insert ( 2826 float8_regr_accum float8_regr_intercept 0 1022 "{0,0,0,0,0,0}" )); DATA(insert ( 2827 float8_regr_accum float8_covar_pop 0 1022 "{0,0,0,0,0,0}" )); DATA(insert ( 2828 float8_regr_accum float8_covar_samp 0 1022 "{0,0,0,0,0,0}" )); DATA(insert ( 2829 float8_regr_accum float8_corr 0 1022 "{0,0,0,0,0,0}" )); /* boolean-and and boolean-or */ DATA(insert ( 2517 booland_statefunc - 58 16 _null_ )); DATA(insert ( 2518 boolor_statefunc - 59 16 _null_ )); DATA(insert ( 2519 booland_statefunc - 58 16 _null_ )); /* bitwise integer */ DATA(insert ( 2236 int2and - 0 21 _null_ )); DATA(insert ( 2237 int2or - 0 21 _null_ )); DATA(insert ( 2238 int4and - 0 23 _null_ )); DATA(insert ( 2239 int4or - 0 23 _null_ )); DATA(insert ( 2240 int8and - 0 20 _null_ )); DATA(insert ( 2241 int8or - 0 20 _null_ )); DATA(insert ( 2242 bitand - 0 1560 _null_ )); DATA(insert ( 2243 bitor - 0 1560 _null_ )); /* xml */ DATA(insert ( 2901 xmlconcat2 - 0 142 _null_ )); /* array */ DATA(insert ( 2335 array_agg_transfn array_agg_finalfn 0 2281 _null_ )); /* text */ DATA(insert ( 3538 string_agg_transfn string_agg_finalfn 0 2281 _null_ )); /* bytea */ DATA(insert ( 3545 bytea_string_agg_transfn bytea_string_agg_finalfn 0 2281 _null_ )); /* * prototypes for functions in pg_aggregate.c */ extern void AggregateCreate(const char *aggName, Oid aggNamespace, Oid *aggArgTypes, int numArgs, List *aggtransfnName, List *aggfinalfnName, List *aggsortopName, Oid aggTransType, const char *agginitval); #endif /* PG_AGGREGATE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_shdepend.h������������������������������������������������������������������0000644�����������������00000005400�14763166026�0013255 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_shdepend.h * definition of the system "shared dependency" relation (pg_shdepend) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_shdepend.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_SHDEPEND_H #define PG_SHDEPEND_H #include "catalog/genbki.h" /* ---------------- * pg_shdepend definition. cpp turns this into * typedef struct FormData_pg_shdepend * ---------------- */ #define SharedDependRelationId 1214 CATALOG(pg_shdepend,1214) BKI_SHARED_RELATION BKI_WITHOUT_OIDS { /* * Identification of the dependent (referencing) object. * * These fields are all zeroes for a DEPENDENCY_PIN entry. Also, dbid can * be zero to denote a shared object. */ Oid dbid; /* OID of database containing object */ Oid classid; /* OID of table containing object */ Oid objid; /* OID of object itself */ int4 objsubid; /* column number, or 0 if not used */ /* * Identification of the independent (referenced) object. This is always * a shared object, so we need no database ID field. We don't bother with * a sub-object ID either. */ Oid refclassid; /* OID of table containing object */ Oid refobjid; /* OID of object itself */ /* * Precise semantics of the relationship are specified by the deptype * field. See SharedDependencyType in catalog/dependency.h. */ char deptype; /* see codes in dependency.h */ } FormData_pg_shdepend; /* ---------------- * Form_pg_shdepend corresponds to a pointer to a row with * the format of pg_shdepend relation. * ---------------- */ typedef FormData_pg_shdepend *Form_pg_shdepend; /* ---------------- * compiler constants for pg_shdepend * ---------------- */ #define Natts_pg_shdepend 7 #define Anum_pg_shdepend_dbid 1 #define Anum_pg_shdepend_classid 2 #define Anum_pg_shdepend_objid 3 #define Anum_pg_shdepend_objsubid 4 #define Anum_pg_shdepend_refclassid 5 #define Anum_pg_shdepend_refobjid 6 #define Anum_pg_shdepend_deptype 7 /* * pg_shdepend has no preloaded contents; system-defined dependencies are * loaded into it during a late stage of the initdb process. * * NOTE: we do not represent all possible dependency pairs in pg_shdepend; * for example, there's not much value in creating an explicit dependency * from a relation to its database. Currently, only dependencies on roles * are explicitly stored in pg_shdepend. */ #endif /* PG_SHDEPEND_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_collation_fn.h��������������������������������������������������������������0000644�����������������00000001337�14763166026�0014137 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_collation_fn.h * prototypes for functions in catalog/pg_collation.c * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_collation_fn.h * *------------------------------------------------------------------------- */ #ifndef PG_COLLATION_FN_H #define PG_COLLATION_FN_H extern Oid CollationCreate(const char *collname, Oid collnamespace, Oid collowner, int32 collencoding, const char *collcollate, const char *collctype); extern void RemoveCollationById(Oid collationOid); #endif /* PG_COLLATION_FN_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_ts_config.h�����������������������������������������������������������������0000644�����������������00000003155�14763166026�0013443 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_ts_config.h * definition of configuration of tsearch * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_ts_config.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * * XXX do NOT break up DATA() statements into multiple lines! * the scripts are not as smart as you might think... * *------------------------------------------------------------------------- */ #ifndef PG_TS_CONFIG_H #define PG_TS_CONFIG_H #include "catalog/genbki.h" /* ---------------- * pg_ts_config definition. cpp turns this into * typedef struct FormData_pg_ts_config * ---------------- */ #define TSConfigRelationId 3602 CATALOG(pg_ts_config,3602) { NameData cfgname; /* name of configuration */ Oid cfgnamespace; /* name space */ Oid cfgowner; /* owner */ Oid cfgparser; /* OID of parser (in pg_ts_parser) */ } FormData_pg_ts_config; typedef FormData_pg_ts_config *Form_pg_ts_config; /* ---------------- * compiler constants for pg_ts_config * ---------------- */ #define Natts_pg_ts_config 4 #define Anum_pg_ts_config_cfgname 1 #define Anum_pg_ts_config_cfgnamespace 2 #define Anum_pg_ts_config_cfgowner 3 #define Anum_pg_ts_config_cfgparser 4 /* ---------------- * initial contents of pg_ts_config * ---------------- */ DATA(insert OID = 3748 ( "simple" PGNSP PGUID 3722 )); DESCR("simple configuration"); #endif /* PG_TS_CONFIG_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_ts_parser.h�����������������������������������������������������������������0000644�����������������00000003711�14763166026�0013470 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_ts_parser.h * definition of parsers for tsearch * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_ts_parser.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * * XXX do NOT break up DATA() statements into multiple lines! * the scripts are not as smart as you might think... * *------------------------------------------------------------------------- */ #ifndef PG_TS_PARSER_H #define PG_TS_PARSER_H #include "catalog/genbki.h" /* ---------------- * pg_ts_parser definition. cpp turns this into * typedef struct FormData_pg_ts_parser * ---------------- */ #define TSParserRelationId 3601 CATALOG(pg_ts_parser,3601) { NameData prsname; /* parser's name */ Oid prsnamespace; /* name space */ regproc prsstart; /* init parsing session */ regproc prstoken; /* return next token */ regproc prsend; /* finalize parsing session */ regproc prsheadline; /* return data for headline creation */ regproc prslextype; /* return descriptions of lexeme's types */ } FormData_pg_ts_parser; typedef FormData_pg_ts_parser *Form_pg_ts_parser; /* ---------------- * compiler constants for pg_ts_parser * ---------------- */ #define Natts_pg_ts_parser 7 #define Anum_pg_ts_parser_prsname 1 #define Anum_pg_ts_parser_prsnamespace 2 #define Anum_pg_ts_parser_prsstart 3 #define Anum_pg_ts_parser_prstoken 4 #define Anum_pg_ts_parser_prsend 5 #define Anum_pg_ts_parser_prsheadline 6 #define Anum_pg_ts_parser_prslextype 7 /* ---------------- * initial contents of pg_ts_parser * ---------------- */ DATA(insert OID = 3722 ( "default" PGNSP prsd_start prsd_nexttoken prsd_end prsd_headline prsd_lextype )); DESCR("default word parser"); #endif /* PG_TS_PARSER_H */ �������������������������������������������������������pgsql/server/catalog/pg_collation.h�����������������������������������������������������������������0000644�����������������00000004354�14763166026�0013456 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_collation.h * definition of the system "collation" relation (pg_collation) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION * src/include/catalog/pg_collation.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_COLLATION_H #define PG_COLLATION_H #include "catalog/genbki.h" /* ---------------- * pg_collation definition. cpp turns this into * typedef struct FormData_pg_collation * ---------------- */ #define CollationRelationId 3456 CATALOG(pg_collation,3456) { NameData collname; /* collation name */ Oid collnamespace; /* OID of namespace containing collation */ Oid collowner; /* owner of collation */ int4 collencoding; /* encoding for this collation; -1 = "all" */ NameData collcollate; /* LC_COLLATE setting */ NameData collctype; /* LC_CTYPE setting */ } FormData_pg_collation; /* ---------------- * Form_pg_collation corresponds to a pointer to a row with * the format of pg_collation relation. * ---------------- */ typedef FormData_pg_collation *Form_pg_collation; /* ---------------- * compiler constants for pg_collation * ---------------- */ #define Natts_pg_collation 6 #define Anum_pg_collation_collname 1 #define Anum_pg_collation_collnamespace 2 #define Anum_pg_collation_collowner 3 #define Anum_pg_collation_collencoding 4 #define Anum_pg_collation_collcollate 5 #define Anum_pg_collation_collctype 6 /* ---------------- * initial contents of pg_collation * ---------------- */ DATA(insert OID = 100 ( default PGNSP PGUID -1 "" "" )); DESCR("database's default collation"); #define DEFAULT_COLLATION_OID 100 DATA(insert OID = 950 ( C PGNSP PGUID -1 "C" "C" )); DESCR("standard C collation"); #define C_COLLATION_OID 950 DATA(insert OID = 951 ( POSIX PGNSP PGUID -1 "POSIX" "POSIX" )); DESCR("standard POSIX collation"); #define POSIX_COLLATION_OID 951 #endif /* PG_COLLATION_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/indexing.h���������������������������������������������������������������������0000644�����������������00000040456�14763166026�0012614 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * indexing.h * This file provides some definitions to support indexing * on system catalogs * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/indexing.h * *------------------------------------------------------------------------- */ #ifndef INDEXING_H #define INDEXING_H #include "access/htup.h" #include "utils/relcache.h" /* * The state object used by CatalogOpenIndexes and friends is actually the * same as the executor's ResultRelInfo, but we give it another type name * to decouple callers from that fact. */ typedef struct ResultRelInfo *CatalogIndexState; /* * indexing.c prototypes */ extern CatalogIndexState CatalogOpenIndexes(Relation heapRel); extern void CatalogCloseIndexes(CatalogIndexState indstate); extern void CatalogIndexInsert(CatalogIndexState indstate, HeapTuple heapTuple); extern void CatalogUpdateIndexes(Relation heapRel, HeapTuple heapTuple); /* * These macros are just to keep the C compiler from spitting up on the * upcoming commands for genbki.pl. */ #define DECLARE_INDEX(name,oid,decl) extern int no_such_variable #define DECLARE_UNIQUE_INDEX(name,oid,decl) extern int no_such_variable #define BUILD_INDICES /* * What follows are lines processed by genbki.pl to create the statements * the bootstrap parser will turn into DefineIndex commands. * * The keyword is DECLARE_INDEX or DECLARE_UNIQUE_INDEX. The first two * arguments are the index name and OID, the rest is much like a standard * 'create index' SQL command. * * For each index, we also provide a #define for its OID. References to * the index in the C code should always use these #defines, not the actual * index name (much less the numeric OID). */ DECLARE_UNIQUE_INDEX(pg_aggregate_fnoid_index, 2650, on pg_aggregate using btree(aggfnoid oid_ops)); #define AggregateFnoidIndexId 2650 DECLARE_UNIQUE_INDEX(pg_am_name_index, 2651, on pg_am using btree(amname name_ops)); #define AmNameIndexId 2651 DECLARE_UNIQUE_INDEX(pg_am_oid_index, 2652, on pg_am using btree(oid oid_ops)); #define AmOidIndexId 2652 DECLARE_UNIQUE_INDEX(pg_amop_fam_strat_index, 2653, on pg_amop using btree(amopfamily oid_ops, amoplefttype oid_ops, amoprighttype oid_ops, amopstrategy int2_ops)); #define AccessMethodStrategyIndexId 2653 DECLARE_UNIQUE_INDEX(pg_amop_opr_fam_index, 2654, on pg_amop using btree(amopopr oid_ops, amoppurpose char_ops, amopfamily oid_ops)); #define AccessMethodOperatorIndexId 2654 DECLARE_UNIQUE_INDEX(pg_amop_oid_index, 2756, on pg_amop using btree(oid oid_ops)); #define AccessMethodOperatorOidIndexId 2756 DECLARE_UNIQUE_INDEX(pg_amproc_fam_proc_index, 2655, on pg_amproc using btree(amprocfamily oid_ops, amproclefttype oid_ops, amprocrighttype oid_ops, amprocnum int2_ops)); #define AccessMethodProcedureIndexId 2655 DECLARE_UNIQUE_INDEX(pg_amproc_oid_index, 2757, on pg_amproc using btree(oid oid_ops)); #define AccessMethodProcedureOidIndexId 2757 DECLARE_UNIQUE_INDEX(pg_attrdef_adrelid_adnum_index, 2656, on pg_attrdef using btree(adrelid oid_ops, adnum int2_ops)); #define AttrDefaultIndexId 2656 DECLARE_UNIQUE_INDEX(pg_attrdef_oid_index, 2657, on pg_attrdef using btree(oid oid_ops)); #define AttrDefaultOidIndexId 2657 DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnam_index, 2658, on pg_attribute using btree(attrelid oid_ops, attname name_ops)); #define AttributeRelidNameIndexId 2658 DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnum_index, 2659, on pg_attribute using btree(attrelid oid_ops, attnum int2_ops)); #define AttributeRelidNumIndexId 2659 DECLARE_UNIQUE_INDEX(pg_authid_rolname_index, 2676, on pg_authid using btree(rolname name_ops)); #define AuthIdRolnameIndexId 2676 DECLARE_UNIQUE_INDEX(pg_authid_oid_index, 2677, on pg_authid using btree(oid oid_ops)); #define AuthIdOidIndexId 2677 DECLARE_UNIQUE_INDEX(pg_auth_members_role_member_index, 2694, on pg_auth_members using btree(roleid oid_ops, member oid_ops)); #define AuthMemRoleMemIndexId 2694 DECLARE_UNIQUE_INDEX(pg_auth_members_member_role_index, 2695, on pg_auth_members using btree(member oid_ops, roleid oid_ops)); #define AuthMemMemRoleIndexId 2695 DECLARE_UNIQUE_INDEX(pg_cast_oid_index, 2660, on pg_cast using btree(oid oid_ops)); #define CastOidIndexId 2660 DECLARE_UNIQUE_INDEX(pg_cast_source_target_index, 2661, on pg_cast using btree(castsource oid_ops, casttarget oid_ops)); #define CastSourceTargetIndexId 2661 DECLARE_UNIQUE_INDEX(pg_class_oid_index, 2662, on pg_class using btree(oid oid_ops)); #define ClassOidIndexId 2662 DECLARE_UNIQUE_INDEX(pg_class_relname_nsp_index, 2663, on pg_class using btree(relname name_ops, relnamespace oid_ops)); #define ClassNameNspIndexId 2663 DECLARE_UNIQUE_INDEX(pg_collation_name_enc_nsp_index, 3164, on pg_collation using btree(collname name_ops, collencoding int4_ops, collnamespace oid_ops)); #define CollationNameEncNspIndexId 3164 DECLARE_UNIQUE_INDEX(pg_collation_oid_index, 3085, on pg_collation using btree(oid oid_ops)); #define CollationOidIndexId 3085 /* This following index is not used for a cache and is not unique */ DECLARE_INDEX(pg_constraint_conname_nsp_index, 2664, on pg_constraint using btree(conname name_ops, connamespace oid_ops)); #define ConstraintNameNspIndexId 2664 /* This following index is not used for a cache and is not unique */ DECLARE_INDEX(pg_constraint_conrelid_index, 2665, on pg_constraint using btree(conrelid oid_ops)); #define ConstraintRelidIndexId 2665 /* This following index is not used for a cache and is not unique */ DECLARE_INDEX(pg_constraint_contypid_index, 2666, on pg_constraint using btree(contypid oid_ops)); #define ConstraintTypidIndexId 2666 DECLARE_UNIQUE_INDEX(pg_constraint_oid_index, 2667, on pg_constraint using btree(oid oid_ops)); #define ConstraintOidIndexId 2667 DECLARE_UNIQUE_INDEX(pg_conversion_default_index, 2668, on pg_conversion using btree(connamespace oid_ops, conforencoding int4_ops, contoencoding int4_ops, oid oid_ops)); #define ConversionDefaultIndexId 2668 DECLARE_UNIQUE_INDEX(pg_conversion_name_nsp_index, 2669, on pg_conversion using btree(conname name_ops, connamespace oid_ops)); #define ConversionNameNspIndexId 2669 DECLARE_UNIQUE_INDEX(pg_conversion_oid_index, 2670, on pg_conversion using btree(oid oid_ops)); #define ConversionOidIndexId 2670 DECLARE_UNIQUE_INDEX(pg_database_datname_index, 2671, on pg_database using btree(datname name_ops)); #define DatabaseNameIndexId 2671 DECLARE_UNIQUE_INDEX(pg_database_oid_index, 2672, on pg_database using btree(oid oid_ops)); #define DatabaseOidIndexId 2672 /* This following index is not used for a cache and is not unique */ DECLARE_INDEX(pg_depend_depender_index, 2673, on pg_depend using btree(classid oid_ops, objid oid_ops, objsubid int4_ops)); #define DependDependerIndexId 2673 /* This following index is not used for a cache and is not unique */ DECLARE_INDEX(pg_depend_reference_index, 2674, on pg_depend using btree(refclassid oid_ops, refobjid oid_ops, refobjsubid int4_ops)); #define DependReferenceIndexId 2674 DECLARE_UNIQUE_INDEX(pg_description_o_c_o_index, 2675, on pg_description using btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops)); #define DescriptionObjIndexId 2675 DECLARE_UNIQUE_INDEX(pg_shdescription_o_c_index, 2397, on pg_shdescription using btree(objoid oid_ops, classoid oid_ops)); #define SharedDescriptionObjIndexId 2397 DECLARE_UNIQUE_INDEX(pg_enum_oid_index, 3502, on pg_enum using btree(oid oid_ops)); #define EnumOidIndexId 3502 DECLARE_UNIQUE_INDEX(pg_enum_typid_label_index, 3503, on pg_enum using btree(enumtypid oid_ops, enumlabel name_ops)); #define EnumTypIdLabelIndexId 3503 DECLARE_UNIQUE_INDEX(pg_enum_typid_sortorder_index, 3534, on pg_enum using btree(enumtypid oid_ops, enumsortorder float4_ops)); #define EnumTypIdSortOrderIndexId 3534 /* This following index is not used for a cache and is not unique */ DECLARE_INDEX(pg_index_indrelid_index, 2678, on pg_index using btree(indrelid oid_ops)); #define IndexIndrelidIndexId 2678 DECLARE_UNIQUE_INDEX(pg_index_indexrelid_index, 2679, on pg_index using btree(indexrelid oid_ops)); #define IndexRelidIndexId 2679 DECLARE_UNIQUE_INDEX(pg_inherits_relid_seqno_index, 2680, on pg_inherits using btree(inhrelid oid_ops, inhseqno int4_ops)); #define InheritsRelidSeqnoIndexId 2680 /* This following index is not used for a cache and is not unique */ DECLARE_INDEX(pg_inherits_parent_index, 2187, on pg_inherits using btree(inhparent oid_ops)); #define InheritsParentIndexId 2187 DECLARE_UNIQUE_INDEX(pg_language_name_index, 2681, on pg_language using btree(lanname name_ops)); #define LanguageNameIndexId 2681 DECLARE_UNIQUE_INDEX(pg_language_oid_index, 2682, on pg_language using btree(oid oid_ops)); #define LanguageOidIndexId 2682 DECLARE_UNIQUE_INDEX(pg_largeobject_loid_pn_index, 2683, on pg_largeobject using btree(loid oid_ops, pageno int4_ops)); #define LargeObjectLOidPNIndexId 2683 DECLARE_UNIQUE_INDEX(pg_largeobject_metadata_oid_index, 2996, on pg_largeobject_metadata using btree(oid oid_ops)); #define LargeObjectMetadataOidIndexId 2996 DECLARE_UNIQUE_INDEX(pg_namespace_nspname_index, 2684, on pg_namespace using btree(nspname name_ops)); #define NamespaceNameIndexId 2684 DECLARE_UNIQUE_INDEX(pg_namespace_oid_index, 2685, on pg_namespace using btree(oid oid_ops)); #define NamespaceOidIndexId 2685 DECLARE_UNIQUE_INDEX(pg_opclass_am_name_nsp_index, 2686, on pg_opclass using btree(opcmethod oid_ops, opcname name_ops, opcnamespace oid_ops)); #define OpclassAmNameNspIndexId 2686 DECLARE_UNIQUE_INDEX(pg_opclass_oid_index, 2687, on pg_opclass using btree(oid oid_ops)); #define OpclassOidIndexId 2687 DECLARE_UNIQUE_INDEX(pg_operator_oid_index, 2688, on pg_operator using btree(oid oid_ops)); #define OperatorOidIndexId 2688 DECLARE_UNIQUE_INDEX(pg_operator_oprname_l_r_n_index, 2689, on pg_operator using btree(oprname name_ops, oprleft oid_ops, oprright oid_ops, oprnamespace oid_ops)); #define OperatorNameNspIndexId 2689 DECLARE_UNIQUE_INDEX(pg_opfamily_am_name_nsp_index, 2754, on pg_opfamily using btree(opfmethod oid_ops, opfname name_ops, opfnamespace oid_ops)); #define OpfamilyAmNameNspIndexId 2754 DECLARE_UNIQUE_INDEX(pg_opfamily_oid_index, 2755, on pg_opfamily using btree(oid oid_ops)); #define OpfamilyOidIndexId 2755 DECLARE_UNIQUE_INDEX(pg_pltemplate_name_index, 1137, on pg_pltemplate using btree(tmplname name_ops)); #define PLTemplateNameIndexId 1137 DECLARE_UNIQUE_INDEX(pg_proc_oid_index, 2690, on pg_proc using btree(oid oid_ops)); #define ProcedureOidIndexId 2690 DECLARE_UNIQUE_INDEX(pg_proc_proname_args_nsp_index, 2691, on pg_proc using btree(proname name_ops, proargtypes oidvector_ops, pronamespace oid_ops)); #define ProcedureNameArgsNspIndexId 2691 DECLARE_UNIQUE_INDEX(pg_rewrite_oid_index, 2692, on pg_rewrite using btree(oid oid_ops)); #define RewriteOidIndexId 2692 DECLARE_UNIQUE_INDEX(pg_rewrite_rel_rulename_index, 2693, on pg_rewrite using btree(ev_class oid_ops, rulename name_ops)); #define RewriteRelRulenameIndexId 2693 /* This following index is not used for a cache and is not unique */ DECLARE_INDEX(pg_shdepend_depender_index, 1232, on pg_shdepend using btree(dbid oid_ops, classid oid_ops, objid oid_ops, objsubid int4_ops)); #define SharedDependDependerIndexId 1232 /* This following index is not used for a cache and is not unique */ DECLARE_INDEX(pg_shdepend_reference_index, 1233, on pg_shdepend using btree(refclassid oid_ops, refobjid oid_ops)); #define SharedDependReferenceIndexId 1233 DECLARE_UNIQUE_INDEX(pg_statistic_relid_att_inh_index, 2696, on pg_statistic using btree(starelid oid_ops, staattnum int2_ops, stainherit bool_ops)); #define StatisticRelidAttnumInhIndexId 2696 DECLARE_UNIQUE_INDEX(pg_tablespace_oid_index, 2697, on pg_tablespace using btree(oid oid_ops)); #define TablespaceOidIndexId 2697 DECLARE_UNIQUE_INDEX(pg_tablespace_spcname_index, 2698, on pg_tablespace using btree(spcname name_ops)); #define TablespaceNameIndexId 2698 /* This following index is not used for a cache and is not unique */ DECLARE_INDEX(pg_trigger_tgconstraint_index, 2699, on pg_trigger using btree(tgconstraint oid_ops)); #define TriggerConstraintIndexId 2699 DECLARE_UNIQUE_INDEX(pg_trigger_tgrelid_tgname_index, 2701, on pg_trigger using btree(tgrelid oid_ops, tgname name_ops)); #define TriggerRelidNameIndexId 2701 DECLARE_UNIQUE_INDEX(pg_trigger_oid_index, 2702, on pg_trigger using btree(oid oid_ops)); #define TriggerOidIndexId 2702 DECLARE_UNIQUE_INDEX(pg_ts_config_cfgname_index, 3608, on pg_ts_config using btree(cfgname name_ops, cfgnamespace oid_ops)); #define TSConfigNameNspIndexId 3608 DECLARE_UNIQUE_INDEX(pg_ts_config_oid_index, 3712, on pg_ts_config using btree(oid oid_ops)); #define TSConfigOidIndexId 3712 DECLARE_UNIQUE_INDEX(pg_ts_config_map_index, 3609, on pg_ts_config_map using btree(mapcfg oid_ops, maptokentype int4_ops, mapseqno int4_ops)); #define TSConfigMapIndexId 3609 DECLARE_UNIQUE_INDEX(pg_ts_dict_dictname_index, 3604, on pg_ts_dict using btree(dictname name_ops, dictnamespace oid_ops)); #define TSDictionaryNameNspIndexId 3604 DECLARE_UNIQUE_INDEX(pg_ts_dict_oid_index, 3605, on pg_ts_dict using btree(oid oid_ops)); #define TSDictionaryOidIndexId 3605 DECLARE_UNIQUE_INDEX(pg_ts_parser_prsname_index, 3606, on pg_ts_parser using btree(prsname name_ops, prsnamespace oid_ops)); #define TSParserNameNspIndexId 3606 DECLARE_UNIQUE_INDEX(pg_ts_parser_oid_index, 3607, on pg_ts_parser using btree(oid oid_ops)); #define TSParserOidIndexId 3607 DECLARE_UNIQUE_INDEX(pg_ts_template_tmplname_index, 3766, on pg_ts_template using btree(tmplname name_ops, tmplnamespace oid_ops)); #define TSTemplateNameNspIndexId 3766 DECLARE_UNIQUE_INDEX(pg_ts_template_oid_index, 3767, on pg_ts_template using btree(oid oid_ops)); #define TSTemplateOidIndexId 3767 DECLARE_UNIQUE_INDEX(pg_type_oid_index, 2703, on pg_type using btree(oid oid_ops)); #define TypeOidIndexId 2703 DECLARE_UNIQUE_INDEX(pg_type_typname_nsp_index, 2704, on pg_type using btree(typname name_ops, typnamespace oid_ops)); #define TypeNameNspIndexId 2704 DECLARE_UNIQUE_INDEX(pg_foreign_data_wrapper_oid_index, 112, on pg_foreign_data_wrapper using btree(oid oid_ops)); #define ForeignDataWrapperOidIndexId 112 DECLARE_UNIQUE_INDEX(pg_foreign_data_wrapper_name_index, 548, on pg_foreign_data_wrapper using btree(fdwname name_ops)); #define ForeignDataWrapperNameIndexId 548 DECLARE_UNIQUE_INDEX(pg_foreign_server_oid_index, 113, on pg_foreign_server using btree(oid oid_ops)); #define ForeignServerOidIndexId 113 DECLARE_UNIQUE_INDEX(pg_foreign_server_name_index, 549, on pg_foreign_server using btree(srvname name_ops)); #define ForeignServerNameIndexId 549 DECLARE_UNIQUE_INDEX(pg_user_mapping_oid_index, 174, on pg_user_mapping using btree(oid oid_ops)); #define UserMappingOidIndexId 174 DECLARE_UNIQUE_INDEX(pg_user_mapping_user_server_index, 175, on pg_user_mapping using btree(umuser oid_ops, umserver oid_ops)); #define UserMappingUserServerIndexId 175 DECLARE_UNIQUE_INDEX(pg_foreign_table_relid_index, 3119, on pg_foreign_table using btree(ftrelid oid_ops)); #define ForeignTableRelidIndexId 3119 DECLARE_UNIQUE_INDEX(pg_default_acl_role_nsp_obj_index, 827, on pg_default_acl using btree(defaclrole oid_ops, defaclnamespace oid_ops, defaclobjtype char_ops)); #define DefaultAclRoleNspObjIndexId 827 DECLARE_UNIQUE_INDEX(pg_default_acl_oid_index, 828, on pg_default_acl using btree(oid oid_ops)); #define DefaultAclOidIndexId 828 DECLARE_UNIQUE_INDEX(pg_db_role_setting_databaseid_rol_index, 2965, on pg_db_role_setting using btree(setdatabase oid_ops, setrole oid_ops)); #define DbRoleSettingDatidRolidIndexId 2965 DECLARE_UNIQUE_INDEX(pg_seclabel_object_index, 3597, on pg_seclabel using btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops, provider text_ops)); #define SecLabelObjectIndexId 3597 DECLARE_UNIQUE_INDEX(pg_shseclabel_object_index, 3593, on pg_shseclabel using btree(objoid oid_ops, classoid oid_ops, provider text_ops)); #define SharedSecLabelObjectIndexId 3593 DECLARE_UNIQUE_INDEX(pg_extension_oid_index, 3080, on pg_extension using btree(oid oid_ops)); #define ExtensionOidIndexId 3080 DECLARE_UNIQUE_INDEX(pg_extension_name_index, 3081, on pg_extension using btree(extname name_ops)); #define ExtensionNameIndexId 3081 DECLARE_UNIQUE_INDEX(pg_range_rngtypid_index, 3542, on pg_range using btree(rngtypid oid_ops)); #define RangeTypidIndexId 3542 /* last step of initialization script: build the indexes declared above */ BUILD_INDICES #endif /* INDEXING_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/index.h������������������������������������������������������������������������0000644�����������������00000006041�14763166026�0012106 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * index.h * prototypes for catalog/index.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/index.h * *------------------------------------------------------------------------- */ #ifndef INDEX_H #define INDEX_H #include "nodes/execnodes.h" #define DEFAULT_INDEX_TYPE "btree" /* Typedef for callback function for IndexBuildHeapScan */ typedef void (*IndexBuildCallback) (Relation index, HeapTuple htup, Datum *values, bool *isnull, bool tupleIsAlive, void *state); /* Action code for index_set_state_flags */ typedef enum { INDEX_CREATE_SET_READY, INDEX_CREATE_SET_VALID, INDEX_DROP_CLEAR_VALID, INDEX_DROP_SET_DEAD } IndexStateFlagsAction; extern void index_check_primary_key(Relation heapRel, IndexInfo *indexInfo, bool is_alter_table); extern Oid index_create(Relation heapRelation, const char *indexRelationName, Oid indexRelationId, Oid relFileNode, IndexInfo *indexInfo, List *indexColNames, Oid accessMethodObjectId, Oid tableSpaceId, Oid *collationObjectId, Oid *classObjectId, int16 *coloptions, Datum reloptions, bool isprimary, bool isconstraint, bool deferrable, bool initdeferred, bool allow_system_table_mods, bool skip_build, bool concurrent); extern void index_constraint_create(Relation heapRelation, Oid indexRelationId, IndexInfo *indexInfo, const char *constraintName, char constraintType, bool deferrable, bool initdeferred, bool mark_as_primary, bool update_pgindex, bool remove_old_dependencies, bool allow_system_table_mods); extern void index_drop(Oid indexId, bool concurrent); extern IndexInfo *BuildIndexInfo(Relation index); extern void FormIndexDatum(IndexInfo *indexInfo, TupleTableSlot *slot, EState *estate, Datum *values, bool *isnull); extern void index_build(Relation heapRelation, Relation indexRelation, IndexInfo *indexInfo, bool isprimary, bool isreindex); extern double IndexBuildHeapScan(Relation heapRelation, Relation indexRelation, IndexInfo *indexInfo, bool allow_sync, IndexBuildCallback callback, void *callback_state); extern void validate_index(Oid heapId, Oid indexId, Snapshot snapshot); extern void index_set_state_flags(Oid indexId, IndexStateFlagsAction action); extern void reindex_index(Oid indexId, bool skip_constraint_checks); /* Flag bits for reindex_relation(): */ #define REINDEX_REL_PROCESS_TOAST 0x01 #define REINDEX_REL_SUPPRESS_INDEX_USE 0x02 #define REINDEX_REL_CHECK_CONSTRAINTS 0x04 extern bool reindex_relation(Oid relid, int flags); extern bool ReindexIsProcessingHeap(Oid heapOid); extern bool ReindexIsProcessingIndex(Oid indexOid); extern Oid IndexGetRelation(Oid indexId, bool missing_ok); #endif /* INDEX_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_conversion.h����������������������������������������������������������������0000644�����������������00000004177�14763166026�0013662 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_conversion.h * definition of the system "conversion" relation (pg_conversion) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_conversion.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_CONVERSION_H #define PG_CONVERSION_H #include "catalog/genbki.h" /* ---------------------------------------------------------------- * pg_conversion definition. * * cpp turns this into typedef struct FormData_pg_namespace * * conname name of the conversion * connamespace name space which the conversion belongs to * conowner owner of the conversion * conforencoding FOR encoding id * contoencoding TO encoding id * conproc OID of the conversion proc * condefault TRUE if this is a default conversion * ---------------------------------------------------------------- */ #define ConversionRelationId 2607 CATALOG(pg_conversion,2607) { NameData conname; Oid connamespace; Oid conowner; int4 conforencoding; int4 contoencoding; regproc conproc; bool condefault; } FormData_pg_conversion; /* ---------------- * Form_pg_conversion corresponds to a pointer to a tuple with * the format of pg_conversion relation. * ---------------- */ typedef FormData_pg_conversion *Form_pg_conversion; /* ---------------- * compiler constants for pg_conversion * ---------------- */ #define Natts_pg_conversion 7 #define Anum_pg_conversion_conname 1 #define Anum_pg_conversion_connamespace 2 #define Anum_pg_conversion_conowner 3 #define Anum_pg_conversion_conforencoding 4 #define Anum_pg_conversion_contoencoding 5 #define Anum_pg_conversion_conproc 6 #define Anum_pg_conversion_condefault 7 /* ---------------- * initial contents of pg_conversion * --------------- */ #endif /* PG_CONVERSION_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_conversion_fn.h�������������������������������������������������������������0000644�����������������00000001501�14763166026�0014331 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_conversion_fn.h * prototypes for functions in catalog/pg_conversion.c * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_conversion_fn.h * *------------------------------------------------------------------------- */ #ifndef PG_CONVERSION_FN_H #define PG_CONVERSION_FN_H extern Oid ConversionCreate(const char *conname, Oid connamespace, Oid conowner, int32 conforencoding, int32 contoencoding, Oid conproc, bool def); extern void RemoveConversionById(Oid conversionOid); extern Oid FindDefaultConversion(Oid connamespace, int32 for_encoding, int32 to_encoding); #endif /* PG_CONVERSION_FN_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_ts_config_map.h�������������������������������������������������������������0000644�����������������00000004436�14763166026�0014303 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_ts_config_map.h * definition of token mappings for configurations of tsearch * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_ts_config_map.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * * XXX do NOT break up DATA() statements into multiple lines! * the scripts are not as smart as you might think... * *------------------------------------------------------------------------- */ #ifndef PG_TS_CONFIG_MAP_H #define PG_TS_CONFIG_MAP_H #include "catalog/genbki.h" /* ---------------- * pg_ts_config_map definition. cpp turns this into * typedef struct FormData_pg_ts_config_map * ---------------- */ #define TSConfigMapRelationId 3603 CATALOG(pg_ts_config_map,3603) BKI_WITHOUT_OIDS { Oid mapcfg; /* OID of configuration owning this entry */ int4 maptokentype; /* token type from parser */ int4 mapseqno; /* order in which to consult dictionaries */ Oid mapdict; /* dictionary to consult */ } FormData_pg_ts_config_map; typedef FormData_pg_ts_config_map *Form_pg_ts_config_map; /* ---------------- * compiler constants for pg_ts_config_map * ---------------- */ #define Natts_pg_ts_config_map 4 #define Anum_pg_ts_config_map_mapcfg 1 #define Anum_pg_ts_config_map_maptokentype 2 #define Anum_pg_ts_config_map_mapseqno 3 #define Anum_pg_ts_config_map_mapdict 4 /* ---------------- * initial contents of pg_ts_config_map * ---------------- */ DATA(insert ( 3748 1 1 3765 )); DATA(insert ( 3748 2 1 3765 )); DATA(insert ( 3748 3 1 3765 )); DATA(insert ( 3748 4 1 3765 )); DATA(insert ( 3748 5 1 3765 )); DATA(insert ( 3748 6 1 3765 )); DATA(insert ( 3748 7 1 3765 )); DATA(insert ( 3748 8 1 3765 )); DATA(insert ( 3748 9 1 3765 )); DATA(insert ( 3748 10 1 3765 )); DATA(insert ( 3748 11 1 3765 )); DATA(insert ( 3748 15 1 3765 )); DATA(insert ( 3748 16 1 3765 )); DATA(insert ( 3748 17 1 3765 )); DATA(insert ( 3748 18 1 3765 )); DATA(insert ( 3748 19 1 3765 )); DATA(insert ( 3748 20 1 3765 )); DATA(insert ( 3748 21 1 3765 )); DATA(insert ( 3748 22 1 3765 )); #endif /* PG_TS_CONFIG_MAP_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_shseclabel.h����������������������������������������������������������������0000644�����������������00000002477�14763166026�0013603 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ------------------------------------------------------------------------- * * pg_shseclabel.h * definition of the system "security label" relation (pg_shseclabel) * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * ------------------------------------------------------------------------- */ #ifndef PG_SHSECLABEL_H #define PG_SHSECLABEL_H #include "catalog/genbki.h" /* ---------------- * pg_shseclabel definition. cpp turns this into * typedef struct FormData_pg_shseclabel * ---------------- */ #define SharedSecLabelRelationId 3592 CATALOG(pg_shseclabel,3592) BKI_SHARED_RELATION BKI_WITHOUT_OIDS { Oid objoid; /* OID of the shared object itself */ Oid classoid; /* OID of table containing the shared object */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ text provider; /* name of label provider */ text label; /* security label of the object */ #endif } FormData_pg_shseclabel; /* ---------------- * compiler constants for pg_shseclabel * ---------------- */ #define Natts_pg_shseclabel 4 #define Anum_pg_shseclabel_objoid 1 #define Anum_pg_shseclabel_classoid 2 #define Anum_pg_shseclabel_provider 3 #define Anum_pg_shseclabel_label 4 #endif /* PG_SHSECLABEL_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_type_fn.h�������������������������������������������������������������������0000644�����������������00000004116�14763166026�0013132 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_type_fn.h * prototypes for functions in catalog/pg_type.c * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_type_fn.h * *------------------------------------------------------------------------- */ #ifndef PG_TYPE_FN_H #define PG_TYPE_FN_H #include "nodes/nodes.h" extern Oid TypeShellMake(const char *typeName, Oid typeNamespace, Oid ownerId); extern Oid TypeCreate(Oid newTypeOid, const char *typeName, Oid typeNamespace, Oid relationOid, char relationKind, Oid ownerId, int16 internalSize, char typeType, char typeCategory, bool typePreferred, char typDelim, Oid inputProcedure, Oid outputProcedure, Oid receiveProcedure, Oid sendProcedure, Oid typmodinProcedure, Oid typmodoutProcedure, Oid analyzeProcedure, Oid elementType, bool isImplicitArray, Oid arrayType, Oid baseType, const char *defaultTypeValue, char *defaultTypeBin, bool passedByValue, char alignment, char storage, int32 typeMod, int32 typNDims, bool typeNotNull, Oid typeCollation); extern void GenerateTypeDependencies(Oid typeNamespace, Oid typeObjectId, Oid relationOid, char relationKind, Oid owner, Oid inputProcedure, Oid outputProcedure, Oid receiveProcedure, Oid sendProcedure, Oid typmodinProcedure, Oid typmodoutProcedure, Oid analyzeProcedure, Oid elementType, bool isImplicitArray, Oid baseType, Oid typeCollation, Node *defaultExpr, bool rebuild); extern void RenameTypeInternal(Oid typeOid, const char *newTypeName, Oid typeNamespace); extern char *makeArrayTypeName(const char *typeName, Oid typeNamespace); extern bool moveArrayTypeName(Oid typeOid, const char *typeName, Oid typeNamespace); #endif /* PG_TYPE_FN_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_foreign_data_wrapper.h������������������������������������������������������0000644�����������������00000004022�14763166026�0015644 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_foreign_data_wrapper.h * definition of the system "foreign-data wrapper" relation (pg_foreign_data_wrapper) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_foreign_data_wrapper.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_FOREIGN_DATA_WRAPPER_H #define PG_FOREIGN_DATA_WRAPPER_H #include "catalog/genbki.h" /* ---------------- * pg_foreign_data_wrapper definition. cpp turns this into * typedef struct FormData_pg_foreign_data_wrapper * ---------------- */ #define ForeignDataWrapperRelationId 2328 CATALOG(pg_foreign_data_wrapper,2328) { NameData fdwname; /* foreign-data wrapper name */ Oid fdwowner; /* FDW owner */ Oid fdwhandler; /* handler function, or 0 if none */ Oid fdwvalidator; /* option validation function, or 0 if none */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ aclitem fdwacl[1]; /* access permissions */ text fdwoptions[1]; /* FDW options */ #endif } FormData_pg_foreign_data_wrapper; /* ---------------- * Form_pg_fdw corresponds to a pointer to a tuple with * the format of pg_fdw relation. * ---------------- */ typedef FormData_pg_foreign_data_wrapper *Form_pg_foreign_data_wrapper; /* ---------------- * compiler constants for pg_fdw * ---------------- */ #define Natts_pg_foreign_data_wrapper 6 #define Anum_pg_foreign_data_wrapper_fdwname 1 #define Anum_pg_foreign_data_wrapper_fdwowner 2 #define Anum_pg_foreign_data_wrapper_fdwhandler 3 #define Anum_pg_foreign_data_wrapper_fdwvalidator 4 #define Anum_pg_foreign_data_wrapper_fdwacl 5 #define Anum_pg_foreign_data_wrapper_fdwoptions 6 #endif /* PG_FOREIGN_DATA_WRAPPER_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_constraint.h����������������������������������������������������������������0000644�����������������00000020164�14763166026�0013653 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_constraint.h * definition of the system "constraint" relation (pg_constraint) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_constraint.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_CONSTRAINT_H #define PG_CONSTRAINT_H #include "catalog/genbki.h" #include "catalog/dependency.h" #include "nodes/pg_list.h" /* ---------------- * pg_constraint definition. cpp turns this into * typedef struct FormData_pg_constraint * ---------------- */ #define ConstraintRelationId 2606 CATALOG(pg_constraint,2606) { /* * conname + connamespace is deliberately not unique; we allow, for * example, the same name to be used for constraints of different * relations. This is partly for backwards compatibility with past * Postgres practice, and partly because we don't want to have to obtain a * global lock to generate a globally unique name for a nameless * constraint. We associate a namespace with constraint names only for * SQL-spec compatibility. */ NameData conname; /* name of this constraint */ Oid connamespace; /* OID of namespace containing constraint */ char contype; /* constraint type; see codes below */ bool condeferrable; /* deferrable constraint? */ bool condeferred; /* deferred by default? */ bool convalidated; /* constraint has been validated? */ /* * conrelid and conkey are only meaningful if the constraint applies to a * specific relation (this excludes domain constraints and assertions). * Otherwise conrelid is 0 and conkey is NULL. */ Oid conrelid; /* relation this constraint constrains */ /* * contypid links to the pg_type row for a domain if this is a domain * constraint. Otherwise it's 0. * * For SQL-style global ASSERTIONs, both conrelid and contypid would be * zero. This is not presently supported, however. */ Oid contypid; /* domain this constraint constrains */ /* * conindid links to the index supporting the constraint, if any; * otherwise it's 0. This is used for unique, primary-key, and exclusion * constraints, and less obviously for foreign-key constraints (where the * index is a unique index on the referenced relation's referenced * columns). Notice that the index is on conrelid in the first case but * confrelid in the second. */ Oid conindid; /* index supporting this constraint */ /* * These fields, plus confkey, are only meaningful for a foreign-key * constraint. Otherwise confrelid is 0 and the char fields are spaces. */ Oid confrelid; /* relation referenced by foreign key */ char confupdtype; /* foreign key's ON UPDATE action */ char confdeltype; /* foreign key's ON DELETE action */ char confmatchtype; /* foreign key's match type */ /* Has a local definition (hence, do not drop when coninhcount is 0) */ bool conislocal; /* Number of times inherited from direct parent relation(s) */ int4 coninhcount; /* Has a local definition and cannot be inherited */ bool connoinherit; #ifdef CATALOG_VARLEN /* variable-length fields start here */ /* * Columns of conrelid that the constraint applies to, if known (this is * NULL for trigger constraints) */ int2 conkey[1]; /* * If a foreign key, the referenced columns of confrelid */ int2 confkey[1]; /* * If a foreign key, the OIDs of the PK = FK equality operators for each * column of the constraint */ Oid conpfeqop[1]; /* * If a foreign key, the OIDs of the PK = PK equality operators for each * column of the constraint (i.e., equality for the referenced columns) */ Oid conppeqop[1]; /* * If a foreign key, the OIDs of the FK = FK equality operators for each * column of the constraint (i.e., equality for the referencing columns) */ Oid conffeqop[1]; /* * If an exclusion constraint, the OIDs of the exclusion operators for * each column of the constraint */ Oid conexclop[1]; /* * If a check constraint, nodeToString representation of expression */ pg_node_tree conbin; /* * If a check constraint, source-text representation of expression */ text consrc; #endif } FormData_pg_constraint; /* ---------------- * Form_pg_constraint corresponds to a pointer to a tuple with * the format of pg_constraint relation. * ---------------- */ typedef FormData_pg_constraint *Form_pg_constraint; /* ---------------- * compiler constants for pg_constraint * ---------------- */ #define Natts_pg_constraint 24 #define Anum_pg_constraint_conname 1 #define Anum_pg_constraint_connamespace 2 #define Anum_pg_constraint_contype 3 #define Anum_pg_constraint_condeferrable 4 #define Anum_pg_constraint_condeferred 5 #define Anum_pg_constraint_convalidated 6 #define Anum_pg_constraint_conrelid 7 #define Anum_pg_constraint_contypid 8 #define Anum_pg_constraint_conindid 9 #define Anum_pg_constraint_confrelid 10 #define Anum_pg_constraint_confupdtype 11 #define Anum_pg_constraint_confdeltype 12 #define Anum_pg_constraint_confmatchtype 13 #define Anum_pg_constraint_conislocal 14 #define Anum_pg_constraint_coninhcount 15 #define Anum_pg_constraint_connoinherit 16 #define Anum_pg_constraint_conkey 17 #define Anum_pg_constraint_confkey 18 #define Anum_pg_constraint_conpfeqop 19 #define Anum_pg_constraint_conppeqop 20 #define Anum_pg_constraint_conffeqop 21 #define Anum_pg_constraint_conexclop 22 #define Anum_pg_constraint_conbin 23 #define Anum_pg_constraint_consrc 24 /* Valid values for contype */ #define CONSTRAINT_CHECK 'c' #define CONSTRAINT_FOREIGN 'f' #define CONSTRAINT_PRIMARY 'p' #define CONSTRAINT_UNIQUE 'u' #define CONSTRAINT_TRIGGER 't' #define CONSTRAINT_EXCLUSION 'x' /* * Valid values for confupdtype and confdeltype are the FKCONSTR_ACTION_xxx * constants defined in parsenodes.h. Valid values for confmatchtype are * the FKCONSTR_MATCH_xxx constants defined in parsenodes.h. */ /* * Identify constraint type for lookup purposes */ typedef enum ConstraintCategory { CONSTRAINT_RELATION, CONSTRAINT_DOMAIN, CONSTRAINT_ASSERTION /* for future expansion */ } ConstraintCategory; /* * prototypes for functions in pg_constraint.c */ extern Oid CreateConstraintEntry(const char *constraintName, Oid constraintNamespace, char constraintType, bool isDeferrable, bool isDeferred, bool isValidated, Oid relId, const int16 *constraintKey, int constraintNKeys, Oid domainId, Oid indexRelId, Oid foreignRelId, const int16 *foreignKey, const Oid *pfEqOp, const Oid *ppEqOp, const Oid *ffEqOp, int foreignNKeys, char foreignUpdateType, char foreignDeleteType, char foreignMatchType, const Oid *exclOp, Node *conExpr, const char *conBin, const char *conSrc, bool conIsLocal, int conInhCount, bool conNoInherit); extern void RemoveConstraintById(Oid conId); extern void RenameConstraintById(Oid conId, const char *newname); extern void SetValidatedConstraintById(Oid conId); extern bool ConstraintNameIsUsed(ConstraintCategory conCat, Oid objId, Oid objNamespace, const char *conname); extern char *ChooseConstraintName(const char *name1, const char *name2, const char *label, Oid namespaceid, List *others); extern void AlterConstraintNamespaces(Oid ownerId, Oid oldNspId, Oid newNspId, bool isType, ObjectAddresses *objsMoved); extern void get_constraint_relation_oids(Oid constraint_oid, Oid *conrelid, Oid *confrelid); extern Oid get_relation_constraint_oid(Oid relid, const char *conname, bool missing_ok); extern Oid get_domain_constraint_oid(Oid typid, const char *conname, bool missing_ok); extern bool check_functional_grouping(Oid relid, Index varno, Index varlevelsup, List *grouping_columns, List **constraintDeps); #endif /* PG_CONSTRAINT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_range.h���������������������������������������������������������������������0000644�����������������00000005043�14763166026�0012562 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_range.h * definition of the system "range" relation (pg_range) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_range.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * * XXX do NOT break up DATA() statements into multiple lines! * the scripts are not as smart as you might think... * *------------------------------------------------------------------------- */ #ifndef PG_RANGE_H #define PG_RANGE_H #include "catalog/genbki.h" /* ---------------- * pg_range definition. cpp turns this into * typedef struct FormData_pg_range * ---------------- */ #define RangeRelationId 3541 CATALOG(pg_range,3541) BKI_WITHOUT_OIDS { Oid rngtypid; /* OID of owning range type */ Oid rngsubtype; /* OID of range's element type (subtype) */ Oid rngcollation; /* collation for this range type, or 0 */ Oid rngsubopc; /* subtype's btree opclass */ regproc rngcanonical; /* canonicalize range, or 0 */ regproc rngsubdiff; /* subtype difference as a float8, or 0 */ } FormData_pg_range; /* ---------------- * Form_pg_range corresponds to a pointer to a tuple with * the format of pg_range relation. * ---------------- */ typedef FormData_pg_range *Form_pg_range; /* ---------------- * compiler constants for pg_range * ---------------- */ #define Natts_pg_range 6 #define Anum_pg_range_rngtypid 1 #define Anum_pg_range_rngsubtype 2 #define Anum_pg_range_rngcollation 3 #define Anum_pg_range_rngsubopc 4 #define Anum_pg_range_rngcanonical 5 #define Anum_pg_range_rngsubdiff 6 /* ---------------- * initial contents of pg_range * ---------------- */ DATA(insert ( 3904 23 0 1978 int4range_canonical int4range_subdiff)); DATA(insert ( 3906 1700 0 3125 - numrange_subdiff)); DATA(insert ( 3908 1114 0 3128 - tsrange_subdiff)); DATA(insert ( 3910 1184 0 3127 - tstzrange_subdiff)); DATA(insert ( 3912 1082 0 3122 daterange_canonical daterange_subdiff)); DATA(insert ( 3926 20 0 3124 int8range_canonical int8range_subdiff)); /* * prototypes for functions in pg_range.c */ extern void RangeCreate(Oid rangeTypeOid, Oid rangeSubType, Oid rangeCollation, Oid rangeSubOpclass, RegProcedure rangeCanonical, RegProcedure rangeSubDiff); extern void RangeDelete(Oid rangeTypeOid); #endif /* PG_RANGE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/objectaddress.h����������������������������������������������������������������0000644�����������������00000002324�14763166026�0013613 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * objectaddress.h * functions for working with object addresses * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/objectaddress.h * *------------------------------------------------------------------------- */ #ifndef OBJECTADDRESS_H #define OBJECTADDRESS_H #include "nodes/parsenodes.h" #include "storage/lock.h" #include "utils/relcache.h" /* * An ObjectAddress represents a database object of any type. */ typedef struct ObjectAddress { Oid classId; /* Class Id from pg_class */ Oid objectId; /* OID of the object */ int32 objectSubId; /* Subitem within object (eg column), or 0 */ } ObjectAddress; extern ObjectAddress get_object_address(ObjectType objtype, List *objname, List *objargs, Relation *relp, LOCKMODE lockmode, bool missing_ok); extern void check_object_ownership(Oid roleid, ObjectType objtype, ObjectAddress address, List *objname, List *objargs, Relation relation); extern Oid get_object_namespace(const ObjectAddress *address); #endif /* PARSE_OBJECT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_rewrite.h�������������������������������������������������������������������0000644�����������������00000003546�14763166026�0013155 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_rewrite.h * definition of the system "rewrite-rule" relation (pg_rewrite) * along with the relation's initial contents. * * As of Postgres 7.3, the primary key for this table is <ev_class, rulename> * --- ie, rule names are only unique among the rules of a given table. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_rewrite.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_REWRITE_H #define PG_REWRITE_H #include "catalog/genbki.h" /* ---------------- * pg_rewrite definition. cpp turns this into * typedef struct FormData_pg_rewrite * ---------------- */ #define RewriteRelationId 2618 CATALOG(pg_rewrite,2618) { NameData rulename; Oid ev_class; int2 ev_attr; char ev_type; char ev_enabled; bool is_instead; #ifdef CATALOG_VARLEN /* variable-length fields start here */ pg_node_tree ev_qual; pg_node_tree ev_action; #endif } FormData_pg_rewrite; /* ---------------- * Form_pg_rewrite corresponds to a pointer to a tuple with * the format of pg_rewrite relation. * ---------------- */ typedef FormData_pg_rewrite *Form_pg_rewrite; /* ---------------- * compiler constants for pg_rewrite * ---------------- */ #define Natts_pg_rewrite 8 #define Anum_pg_rewrite_rulename 1 #define Anum_pg_rewrite_ev_class 2 #define Anum_pg_rewrite_ev_attr 3 #define Anum_pg_rewrite_ev_type 4 #define Anum_pg_rewrite_ev_enabled 5 #define Anum_pg_rewrite_is_instead 6 #define Anum_pg_rewrite_ev_qual 7 #define Anum_pg_rewrite_ev_action 8 #endif /* PG_REWRITE_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/catversion.h�������������������������������������������������������������������0000644�����������������00000005033�14763166026�0013154 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * catversion.h * "Catalog version number" for PostgreSQL. * * The catalog version number is used to flag incompatible changes in * the PostgreSQL system catalogs. Whenever anyone changes the format of * a system catalog relation, or adds, deletes, or modifies standard * catalog entries in such a way that an updated backend wouldn't work * with an old database (or vice versa), the catalog version number * should be changed. The version number stored in pg_control by initdb * is checked against the version number compiled into the backend at * startup time, so that a backend can refuse to run in an incompatible * database. * * The point of this feature is to provide a finer grain of compatibility * checking than is possible from looking at the major version number * stored in PG_VERSION. It shouldn't matter to end users, but during * development cycles we usually make quite a few incompatible changes * to the contents of the system catalogs, and we don't want to bump the * major version number for each one. What we can do instead is bump * this internal version number. This should save some grief for * developers who might otherwise waste time tracking down "bugs" that * are really just code-vs-database incompatibilities. * * The rule for developers is: if you commit a change that requires * an initdb, you should update the catalog version number (as well as * notifying the pghackers mailing list, which has been the informal * practice for a long time). * * The catalog version number is placed here since modifying files in * include/catalog is the most common kind of initdb-forcing change. * But it could be used to protect any kind of incompatible change in * database contents or layout, such as altering tuple headers. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/catversion.h * *------------------------------------------------------------------------- */ #ifndef CATVERSION_H #define CATVERSION_H /* * We could use anything we wanted for version numbers, but I recommend * following the "YYYYMMDDN" style often used for DNS zone serial numbers. * YYYYMMDD are the date of the change, and N is the number of the change * on that day. (Hopefully we'll never commit ten independent sets of * catalog changes on the same day...) */ /* yyyymmddN */ #define CATALOG_VERSION_NO 201204301 #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_language.h������������������������������������������������������������������0000644�����������������00000004612�14763166026�0013252 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_language.h * definition of the system "language" relation (pg_language) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_language.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_LANGUAGE_H #define PG_LANGUAGE_H #include "catalog/genbki.h" /* ---------------- * pg_language definition. cpp turns this into * typedef struct FormData_pg_language * ---------------- */ #define LanguageRelationId 2612 CATALOG(pg_language,2612) { NameData lanname; /* Language name */ Oid lanowner; /* Language's owner */ bool lanispl; /* Is a procedural language */ bool lanpltrusted; /* PL is trusted */ Oid lanplcallfoid; /* Call handler for PL */ Oid laninline; /* Optional anonymous-block handler function */ Oid lanvalidator; /* Optional validation function */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ aclitem lanacl[1]; /* Access privileges */ #endif } FormData_pg_language; /* ---------------- * Form_pg_language corresponds to a pointer to a tuple with * the format of pg_language relation. * ---------------- */ typedef FormData_pg_language *Form_pg_language; /* ---------------- * compiler constants for pg_language * ---------------- */ #define Natts_pg_language 8 #define Anum_pg_language_lanname 1 #define Anum_pg_language_lanowner 2 #define Anum_pg_language_lanispl 3 #define Anum_pg_language_lanpltrusted 4 #define Anum_pg_language_lanplcallfoid 5 #define Anum_pg_language_laninline 6 #define Anum_pg_language_lanvalidator 7 #define Anum_pg_language_lanacl 8 /* ---------------- * initial contents of pg_language * ---------------- */ DATA(insert OID = 12 ( "internal" PGUID f f 0 0 2246 _null_ )); DESCR("built-in functions"); #define INTERNALlanguageId 12 DATA(insert OID = 13 ( "c" PGUID f f 0 0 2247 _null_ )); DESCR("dynamically-loaded C functions"); #define ClanguageId 13 DATA(insert OID = 14 ( "sql" PGUID f t 0 0 2248 _null_ )); DESCR("SQL-language functions"); #define SQLlanguageId 14 #endif /* PG_LANGUAGE_H */ ����������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_description.h���������������������������������������������������������������0000644�����������������00000005654�14763166026�0014021 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_description.h * definition of the system "description" relation (pg_description) * * NOTE: an object is identified by the OID of the row that primarily * defines the object, plus the OID of the table that that row appears in. * For example, a function is identified by the OID of its pg_proc row * plus the pg_class OID of table pg_proc. This allows unique identification * of objects without assuming that OIDs are unique across tables. * * Since attributes don't have OIDs of their own, we identify an attribute * comment by the objoid+classoid of its parent table, plus an "objsubid" * giving the attribute column number. "objsubid" must be zero in a comment * for a table itself, so that it is distinct from any column comment. * Currently, objsubid is unused and zero for all other kinds of objects, * but perhaps it might be useful someday to associate comments with * constituent elements of other kinds of objects (arguments of a function, * for example). * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_description.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * * XXX do NOT break up DATA() statements into multiple lines! * the scripts are not as smart as you might think... * *------------------------------------------------------------------------- */ #ifndef PG_DESCRIPTION_H #define PG_DESCRIPTION_H #include "catalog/genbki.h" /* ---------------- * pg_description definition. cpp turns this into * typedef struct FormData_pg_description * ---------------- */ #define DescriptionRelationId 2609 CATALOG(pg_description,2609) BKI_WITHOUT_OIDS { Oid objoid; /* OID of object itself */ Oid classoid; /* OID of table containing object */ int4 objsubid; /* column number, or 0 if not used */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ text description; /* description of object */ #endif } FormData_pg_description; /* ---------------- * Form_pg_description corresponds to a pointer to a tuple with * the format of pg_description relation. * ---------------- */ typedef FormData_pg_description *Form_pg_description; /* ---------------- * compiler constants for pg_description * ---------------- */ #define Natts_pg_description 4 #define Anum_pg_description_objoid 1 #define Anum_pg_description_classoid 2 #define Anum_pg_description_objsubid 3 #define Anum_pg_description_description 4 /* ---------------- * initial contents of pg_description * ---------------- */ /* * Because the contents of this table are taken from the other *.h files, * there is no initialization here. The initial contents are extracted * by genbki.pl and loaded during initdb. */ #endif /* PG_DESCRIPTION_H */ ������������������������������������������������������������������������������������pgsql/server/catalog/pg_opclass.h�������������������������������������������������������������������0000644�����������������00000026666�14763166026�0013150 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_opclass.h * definition of the system "opclass" relation (pg_opclass) * along with the relation's initial contents. * * The primary key for this table is <opcmethod, opcname, opcnamespace> --- * that is, there is a row for each valid combination of opclass name and * index access method type. This row specifies the expected input data type * for the opclass (the type of the heap column, or the expression output type * in the case of an index expression). Note that types binary-coercible to * the specified type will be accepted too. * * For a given <opcmethod, opcintype> pair, there can be at most one row that * has opcdefault = true; this row is the default opclass for such data in * such an index. (This is not currently enforced by an index, because we * don't support partial indexes on system catalogs.) * * Normally opckeytype = InvalidOid (zero), indicating that the data stored * in the index is the same as the data in the indexed column. If opckeytype * is nonzero then it indicates that a conversion step is needed to produce * the stored index data, which will be of type opckeytype (which might be * the same or different from the input datatype). Performing such a * conversion is the responsibility of the index access method --- not all * AMs support this. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_opclass.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_OPCLASS_H #define PG_OPCLASS_H #include "catalog/genbki.h" /* ---------------- * pg_opclass definition. cpp turns this into * typedef struct FormData_pg_opclass * ---------------- */ #define OperatorClassRelationId 2616 CATALOG(pg_opclass,2616) { Oid opcmethod; /* index access method opclass is for */ NameData opcname; /* name of this opclass */ Oid opcnamespace; /* namespace of this opclass */ Oid opcowner; /* opclass owner */ Oid opcfamily; /* containing operator family */ Oid opcintype; /* type of data indexed by opclass */ bool opcdefault; /* T if opclass is default for opcintype */ Oid opckeytype; /* type of data in index, or InvalidOid */ } FormData_pg_opclass; /* ---------------- * Form_pg_opclass corresponds to a pointer to a tuple with * the format of pg_opclass relation. * ---------------- */ typedef FormData_pg_opclass *Form_pg_opclass; /* ---------------- * compiler constants for pg_opclass * ---------------- */ #define Natts_pg_opclass 8 #define Anum_pg_opclass_opcmethod 1 #define Anum_pg_opclass_opcname 2 #define Anum_pg_opclass_opcnamespace 3 #define Anum_pg_opclass_opcowner 4 #define Anum_pg_opclass_opcfamily 5 #define Anum_pg_opclass_opcintype 6 #define Anum_pg_opclass_opcdefault 7 #define Anum_pg_opclass_opckeytype 8 /* ---------------- * initial contents of pg_opclass * * Note: we hard-wire an OID only for a few entries that have to be explicitly * referenced in the C code or in built-in catalog entries. The rest get OIDs * assigned on-the-fly during initdb. * ---------------- */ DATA(insert ( 403 abstime_ops PGNSP PGUID 421 702 t 0 )); DATA(insert ( 403 array_ops PGNSP PGUID 397 2277 t 0 )); DATA(insert ( 405 array_ops PGNSP PGUID 627 2277 t 0 )); DATA(insert ( 403 bit_ops PGNSP PGUID 423 1560 t 0 )); DATA(insert ( 403 bool_ops PGNSP PGUID 424 16 t 0 )); DATA(insert ( 403 bpchar_ops PGNSP PGUID 426 1042 t 0 )); DATA(insert ( 405 bpchar_ops PGNSP PGUID 427 1042 t 0 )); DATA(insert ( 403 bytea_ops PGNSP PGUID 428 17 t 0 )); DATA(insert ( 403 char_ops PGNSP PGUID 429 18 t 0 )); DATA(insert ( 405 char_ops PGNSP PGUID 431 18 t 0 )); DATA(insert ( 403 cidr_ops PGNSP PGUID 1974 869 f 0 )); DATA(insert ( 405 cidr_ops PGNSP PGUID 1975 869 f 0 )); DATA(insert OID = 3122 ( 403 date_ops PGNSP PGUID 434 1082 t 0 )); #define DATE_BTREE_OPS_OID 3122 DATA(insert ( 405 date_ops PGNSP PGUID 435 1082 t 0 )); DATA(insert ( 403 float4_ops PGNSP PGUID 1970 700 t 0 )); DATA(insert ( 405 float4_ops PGNSP PGUID 1971 700 t 0 )); DATA(insert OID = 3123 ( 403 float8_ops PGNSP PGUID 1970 701 t 0 )); #define FLOAT8_BTREE_OPS_OID 3123 DATA(insert ( 405 float8_ops PGNSP PGUID 1971 701 t 0 )); DATA(insert ( 403 inet_ops PGNSP PGUID 1974 869 t 0 )); DATA(insert ( 405 inet_ops PGNSP PGUID 1975 869 t 0 )); DATA(insert OID = 1979 ( 403 int2_ops PGNSP PGUID 1976 21 t 0 )); #define INT2_BTREE_OPS_OID 1979 DATA(insert ( 405 int2_ops PGNSP PGUID 1977 21 t 0 )); DATA(insert OID = 1978 ( 403 int4_ops PGNSP PGUID 1976 23 t 0 )); #define INT4_BTREE_OPS_OID 1978 DATA(insert ( 405 int4_ops PGNSP PGUID 1977 23 t 0 )); DATA(insert OID = 3124 ( 403 int8_ops PGNSP PGUID 1976 20 t 0 )); #define INT8_BTREE_OPS_OID 3124 DATA(insert ( 405 int8_ops PGNSP PGUID 1977 20 t 0 )); DATA(insert ( 403 interval_ops PGNSP PGUID 1982 1186 t 0 )); DATA(insert ( 405 interval_ops PGNSP PGUID 1983 1186 t 0 )); DATA(insert ( 403 macaddr_ops PGNSP PGUID 1984 829 t 0 )); DATA(insert ( 405 macaddr_ops PGNSP PGUID 1985 829 t 0 )); /* * Here's an ugly little hack to save space in the system catalog indexes. * btree doesn't ordinarily allow a storage type different from input type; * but cstring and name are the same thing except for trailing padding, * and we can safely omit that within an index entry. So we declare the * btree opclass for name as using cstring storage type. */ DATA(insert ( 403 name_ops PGNSP PGUID 1986 19 t 2275 )); DATA(insert ( 405 name_ops PGNSP PGUID 1987 19 t 0 )); DATA(insert OID = 3125 ( 403 numeric_ops PGNSP PGUID 1988 1700 t 0 )); #define NUMERIC_BTREE_OPS_OID 3125 DATA(insert ( 405 numeric_ops PGNSP PGUID 1998 1700 t 0 )); DATA(insert OID = 1981 ( 403 oid_ops PGNSP PGUID 1989 26 t 0 )); #define OID_BTREE_OPS_OID 1981 DATA(insert ( 405 oid_ops PGNSP PGUID 1990 26 t 0 )); DATA(insert ( 403 oidvector_ops PGNSP PGUID 1991 30 t 0 )); DATA(insert ( 405 oidvector_ops PGNSP PGUID 1992 30 t 0 )); DATA(insert ( 403 record_ops PGNSP PGUID 2994 2249 t 0 )); DATA(insert OID = 3126 ( 403 text_ops PGNSP PGUID 1994 25 t 0 )); #define TEXT_BTREE_OPS_OID 3126 DATA(insert ( 405 text_ops PGNSP PGUID 1995 25 t 0 )); DATA(insert ( 403 time_ops PGNSP PGUID 1996 1083 t 0 )); DATA(insert ( 405 time_ops PGNSP PGUID 1997 1083 t 0 )); DATA(insert OID = 3127 ( 403 timestamptz_ops PGNSP PGUID 434 1184 t 0 )); #define TIMESTAMPTZ_BTREE_OPS_OID 3127 DATA(insert ( 405 timestamptz_ops PGNSP PGUID 1999 1184 t 0 )); DATA(insert ( 403 timetz_ops PGNSP PGUID 2000 1266 t 0 )); DATA(insert ( 405 timetz_ops PGNSP PGUID 2001 1266 t 0 )); DATA(insert ( 403 varbit_ops PGNSP PGUID 2002 1562 t 0 )); DATA(insert ( 403 varchar_ops PGNSP PGUID 1994 25 f 0 )); DATA(insert ( 405 varchar_ops PGNSP PGUID 1995 25 f 0 )); DATA(insert OID = 3128 ( 403 timestamp_ops PGNSP PGUID 434 1114 t 0 )); #define TIMESTAMP_BTREE_OPS_OID 3128 DATA(insert ( 405 timestamp_ops PGNSP PGUID 2040 1114 t 0 )); DATA(insert ( 403 text_pattern_ops PGNSP PGUID 2095 25 f 0 )); DATA(insert ( 403 varchar_pattern_ops PGNSP PGUID 2095 25 f 0 )); DATA(insert ( 403 bpchar_pattern_ops PGNSP PGUID 2097 1042 f 0 )); DATA(insert ( 403 money_ops PGNSP PGUID 2099 790 t 0 )); DATA(insert ( 405 bool_ops PGNSP PGUID 2222 16 t 0 )); DATA(insert ( 405 bytea_ops PGNSP PGUID 2223 17 t 0 )); DATA(insert ( 405 int2vector_ops PGNSP PGUID 2224 22 t 0 )); DATA(insert ( 403 tid_ops PGNSP PGUID 2789 27 t 0 )); DATA(insert ( 405 xid_ops PGNSP PGUID 2225 28 t 0 )); DATA(insert ( 405 cid_ops PGNSP PGUID 2226 29 t 0 )); DATA(insert ( 405 abstime_ops PGNSP PGUID 2227 702 t 0 )); DATA(insert ( 405 reltime_ops PGNSP PGUID 2228 703 t 0 )); DATA(insert ( 405 text_pattern_ops PGNSP PGUID 2229 25 f 0 )); DATA(insert ( 405 varchar_pattern_ops PGNSP PGUID 2229 25 f 0 )); DATA(insert ( 405 bpchar_pattern_ops PGNSP PGUID 2231 1042 f 0 )); DATA(insert ( 403 reltime_ops PGNSP PGUID 2233 703 t 0 )); DATA(insert ( 403 tinterval_ops PGNSP PGUID 2234 704 t 0 )); DATA(insert ( 405 aclitem_ops PGNSP PGUID 2235 1033 t 0 )); DATA(insert ( 783 box_ops PGNSP PGUID 2593 603 t 0 )); DATA(insert ( 783 point_ops PGNSP PGUID 1029 600 t 603 )); DATA(insert ( 783 poly_ops PGNSP PGUID 2594 604 t 603 )); DATA(insert ( 783 circle_ops PGNSP PGUID 2595 718 t 603 )); DATA(insert ( 2742 _int4_ops PGNSP PGUID 2745 1007 t 23 )); DATA(insert ( 2742 _text_ops PGNSP PGUID 2745 1009 t 25 )); DATA(insert ( 2742 _abstime_ops PGNSP PGUID 2745 1023 t 702 )); DATA(insert ( 2742 _bit_ops PGNSP PGUID 2745 1561 t 1560 )); DATA(insert ( 2742 _bool_ops PGNSP PGUID 2745 1000 t 16 )); DATA(insert ( 2742 _bpchar_ops PGNSP PGUID 2745 1014 t 1042 )); DATA(insert ( 2742 _bytea_ops PGNSP PGUID 2745 1001 t 17 )); DATA(insert ( 2742 _char_ops PGNSP PGUID 2745 1002 t 18 )); DATA(insert ( 2742 _cidr_ops PGNSP PGUID 2745 651 t 650 )); DATA(insert ( 2742 _date_ops PGNSP PGUID 2745 1182 t 1082 )); DATA(insert ( 2742 _float4_ops PGNSP PGUID 2745 1021 t 700 )); DATA(insert ( 2742 _float8_ops PGNSP PGUID 2745 1022 t 701 )); DATA(insert ( 2742 _inet_ops PGNSP PGUID 2745 1041 t 869 )); DATA(insert ( 2742 _int2_ops PGNSP PGUID 2745 1005 t 21 )); DATA(insert ( 2742 _int8_ops PGNSP PGUID 2745 1016 t 20 )); DATA(insert ( 2742 _interval_ops PGNSP PGUID 2745 1187 t 1186 )); DATA(insert ( 2742 _macaddr_ops PGNSP PGUID 2745 1040 t 829 )); DATA(insert ( 2742 _name_ops PGNSP PGUID 2745 1003 t 19 )); DATA(insert ( 2742 _numeric_ops PGNSP PGUID 2745 1231 t 1700 )); DATA(insert ( 2742 _oid_ops PGNSP PGUID 2745 1028 t 26 )); DATA(insert ( 2742 _oidvector_ops PGNSP PGUID 2745 1013 t 30 )); DATA(insert ( 2742 _time_ops PGNSP PGUID 2745 1183 t 1083 )); DATA(insert ( 2742 _timestamptz_ops PGNSP PGUID 2745 1185 t 1184 )); DATA(insert ( 2742 _timetz_ops PGNSP PGUID 2745 1270 t 1266 )); DATA(insert ( 2742 _varbit_ops PGNSP PGUID 2745 1563 t 1562 )); DATA(insert ( 2742 _varchar_ops PGNSP PGUID 2745 1015 t 1043 )); DATA(insert ( 2742 _timestamp_ops PGNSP PGUID 2745 1115 t 1114 )); DATA(insert ( 2742 _money_ops PGNSP PGUID 2745 791 t 790 )); DATA(insert ( 2742 _reltime_ops PGNSP PGUID 2745 1024 t 703 )); DATA(insert ( 2742 _tinterval_ops PGNSP PGUID 2745 1025 t 704 )); DATA(insert ( 403 uuid_ops PGNSP PGUID 2968 2950 t 0 )); DATA(insert ( 405 uuid_ops PGNSP PGUID 2969 2950 t 0 )); DATA(insert ( 403 enum_ops PGNSP PGUID 3522 3500 t 0 )); DATA(insert ( 405 enum_ops PGNSP PGUID 3523 3500 t 0 )); DATA(insert ( 403 tsvector_ops PGNSP PGUID 3626 3614 t 0 )); DATA(insert ( 783 tsvector_ops PGNSP PGUID 3655 3614 t 3642 )); DATA(insert ( 2742 tsvector_ops PGNSP PGUID 3659 3614 t 25 )); DATA(insert ( 403 tsquery_ops PGNSP PGUID 3683 3615 t 0 )); DATA(insert ( 783 tsquery_ops PGNSP PGUID 3702 3615 t 20 )); DATA(insert ( 403 range_ops PGNSP PGUID 3901 3831 t 0 )); DATA(insert ( 405 range_ops PGNSP PGUID 3903 3831 t 0 )); DATA(insert ( 783 range_ops PGNSP PGUID 3919 3831 t 0 )); DATA(insert ( 4000 quad_point_ops PGNSP PGUID 4015 600 t 0 )); DATA(insert ( 4000 kd_point_ops PGNSP PGUID 4016 600 f 0 )); DATA(insert ( 4000 text_ops PGNSP PGUID 4017 25 t 0 )); #endif /* PG_OPCLASS_H */ ��������������������������������������������������������������������������pgsql/server/catalog/pg_database.h������������������������������������������������������������������0000644�����������������00000005201�14763166026�0013226 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_database.h * definition of the system "database" relation (pg_database) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_database.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_DATABASE_H #define PG_DATABASE_H #include "catalog/genbki.h" /* ---------------- * pg_database definition. cpp turns this into * typedef struct FormData_pg_database * ---------------- */ #define DatabaseRelationId 1262 #define DatabaseRelation_Rowtype_Id 1248 CATALOG(pg_database,1262) BKI_SHARED_RELATION BKI_ROWTYPE_OID(1248) BKI_SCHEMA_MACRO { NameData datname; /* database name */ Oid datdba; /* owner of database */ int4 encoding; /* character encoding */ NameData datcollate; /* LC_COLLATE setting */ NameData datctype; /* LC_CTYPE setting */ bool datistemplate; /* allowed as CREATE DATABASE template? */ bool datallowconn; /* new connections allowed? */ int4 datconnlimit; /* max connections allowed (-1=no limit) */ Oid datlastsysoid; /* highest OID to consider a system OID */ TransactionId datfrozenxid; /* all Xids < this are frozen in this DB */ Oid dattablespace; /* default table space for this DB */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ aclitem datacl[1]; /* access permissions */ #endif } FormData_pg_database; /* ---------------- * Form_pg_database corresponds to a pointer to a tuple with * the format of pg_database relation. * ---------------- */ typedef FormData_pg_database *Form_pg_database; /* ---------------- * compiler constants for pg_database * ---------------- */ #define Natts_pg_database 12 #define Anum_pg_database_datname 1 #define Anum_pg_database_datdba 2 #define Anum_pg_database_encoding 3 #define Anum_pg_database_datcollate 4 #define Anum_pg_database_datctype 5 #define Anum_pg_database_datistemplate 6 #define Anum_pg_database_datallowconn 7 #define Anum_pg_database_datconnlimit 8 #define Anum_pg_database_datlastsysoid 9 #define Anum_pg_database_datfrozenxid 10 #define Anum_pg_database_dattablespace 11 #define Anum_pg_database_datacl 12 DATA(insert OID = 1 ( template1 PGUID ENCODING "LC_COLLATE" "LC_CTYPE" t t -1 0 0 1663 _null_)); SHDESCR("default template for new databases"); #define TemplateDbOid 1 #endif /* PG_DATABASE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_default_acl.h���������������������������������������������������������������0000644�����������������00000004150�14763166026�0013727 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_default_acl.h * definition of default ACLs for new objects. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_default_acl.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_DEFAULT_ACL_H #define PG_DEFAULT_ACL_H #include "catalog/genbki.h" /* ---------------- * pg_default_acl definition. cpp turns this into * typedef struct FormData_pg_default_acl * ---------------- */ #define DefaultAclRelationId 826 CATALOG(pg_default_acl,826) { Oid defaclrole; /* OID of role owning this ACL */ Oid defaclnamespace; /* OID of namespace, or 0 for all */ char defaclobjtype; /* see DEFACLOBJ_xxx constants below */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ aclitem defaclacl[1]; /* permissions to add at CREATE time */ #endif } FormData_pg_default_acl; /* ---------------- * Form_pg_default_acl corresponds to a pointer to a tuple with * the format of pg_default_acl relation. * ---------------- */ typedef FormData_pg_default_acl *Form_pg_default_acl; /* ---------------- * compiler constants for pg_default_acl * ---------------- */ #define Natts_pg_default_acl 4 #define Anum_pg_default_acl_defaclrole 1 #define Anum_pg_default_acl_defaclnamespace 2 #define Anum_pg_default_acl_defaclobjtype 3 #define Anum_pg_default_acl_defaclacl 4 /* ---------------- * pg_default_acl has no initial contents * ---------------- */ /* * Types of objects for which the user is allowed to specify default * permissions through pg_default_acl. These codes are used in the * defaclobjtype column. */ #define DEFACLOBJ_RELATION 'r' /* table, view */ #define DEFACLOBJ_SEQUENCE 'S' /* sequence */ #define DEFACLOBJ_FUNCTION 'f' /* function */ #define DEFACLOBJ_TYPE 'T' /* type */ #endif /* PG_DEFAULT_ACL_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_ts_dict.h�������������������������������������������������������������������0000644�����������������00000003437�14763166026�0013124 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_ts_dict.h * definition of dictionaries for tsearch * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_ts_dict.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * * XXX do NOT break up DATA() statements into multiple lines! * the scripts are not as smart as you might think... * *------------------------------------------------------------------------- */ #ifndef PG_TS_DICT_H #define PG_TS_DICT_H #include "catalog/genbki.h" /* ---------------- * pg_ts_dict definition. cpp turns this into * typedef struct FormData_pg_ts_dict * ---------------- */ #define TSDictionaryRelationId 3600 CATALOG(pg_ts_dict,3600) { NameData dictname; /* dictionary name */ Oid dictnamespace; /* name space */ Oid dictowner; /* owner */ Oid dicttemplate; /* dictionary's template */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ text dictinitoption; /* options passed to dict_init() */ #endif } FormData_pg_ts_dict; typedef FormData_pg_ts_dict *Form_pg_ts_dict; /* ---------------- * compiler constants for pg_ts_dict * ---------------- */ #define Natts_pg_ts_dict 5 #define Anum_pg_ts_dict_dictname 1 #define Anum_pg_ts_dict_dictnamespace 2 #define Anum_pg_ts_dict_dictowner 3 #define Anum_pg_ts_dict_dicttemplate 4 #define Anum_pg_ts_dict_dictinitoption 5 /* ---------------- * initial contents of pg_ts_dict * ---------------- */ DATA(insert OID = 3765 ( "simple" PGNSP PGUID 3727 _null_)); DESCR("simple dictionary: just lower case and check for stopword"); #endif /* PG_TS_DICT_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_seclabel.h������������������������������������������������������������������0000644�����������������00000002523�14763166026�0013240 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ------------------------------------------------------------------------- * * pg_seclabel.h * definition of the system "security label" relation (pg_seclabel) * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * ------------------------------------------------------------------------- */ #ifndef PG_SECLABEL_H #define PG_SECLABEL_H #include "catalog/genbki.h" /* ---------------- * pg_seclabel definition. cpp turns this into * typedef struct FormData_pg_seclabel * ---------------- */ #define SecLabelRelationId 3596 CATALOG(pg_seclabel,3596) BKI_WITHOUT_OIDS { Oid objoid; /* OID of the object itself */ Oid classoid; /* OID of table containing the object */ int4 objsubid; /* column number, or 0 if not used */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ text provider; /* name of label provider */ text label; /* security label of the object */ #endif } FormData_pg_seclabel; /* ---------------- * compiler constants for pg_seclabel * ---------------- */ #define Natts_pg_seclabel 5 #define Anum_pg_seclabel_objoid 1 #define Anum_pg_seclabel_classoid 2 #define Anum_pg_seclabel_objsubid 3 #define Anum_pg_seclabel_provider 4 #define Anum_pg_seclabel_label 5 #endif /* PG_SECLABEL_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/toasting.h���������������������������������������������������������������������0000644�����������������00000003642�14763166026�0012633 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * toasting.h * This file provides some definitions to support creation of toast tables * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/toasting.h * *------------------------------------------------------------------------- */ #ifndef TOASTING_H #define TOASTING_H /* * toasting.c prototypes */ extern void AlterTableCreateToastTable(Oid relOid, Datum reloptions); extern void BootstrapToastTable(char *relName, Oid toastOid, Oid toastIndexOid); /* * This macro is just to keep the C compiler from spitting up on the * upcoming commands for genbki.pl. */ #define DECLARE_TOAST(name,toastoid,indexoid) extern int no_such_variable /* * What follows are lines processed by genbki.pl to create the statements * the bootstrap parser will turn into BootstrapToastTable commands. * Each line specifies the system catalog that needs a toast table, * the OID to assign to the toast table, and the OID to assign to the * toast table's index. The reason we hard-wire these OIDs is that we * need stable OIDs for shared relations, and that includes toast tables * of shared relations. */ /* normal catalogs */ DECLARE_TOAST(pg_attrdef, 2830, 2831); DECLARE_TOAST(pg_constraint, 2832, 2833); DECLARE_TOAST(pg_description, 2834, 2835); DECLARE_TOAST(pg_proc, 2836, 2837); DECLARE_TOAST(pg_rewrite, 2838, 2839); DECLARE_TOAST(pg_seclabel, 3598, 3599); DECLARE_TOAST(pg_statistic, 2840, 2841); DECLARE_TOAST(pg_trigger, 2336, 2337); /* shared catalogs */ DECLARE_TOAST(pg_shdescription, 2846, 2847); #define PgShdescriptionToastTable 2846 #define PgShdescriptionToastIndex 2847 DECLARE_TOAST(pg_db_role_setting, 2966, 2967); #define PgDbRoleSettingToastTable 2966 #define PgDbRoleSettingToastIndex 2967 #endif /* TOASTING_H */ ����������������������������������������������������������������������������������������������pgsql/server/catalog/pg_auth_members.h��������������������������������������������������������������0000644�����������������00000003377�14763166026�0014151 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_auth_members.h * definition of the system "authorization identifier members" relation * (pg_auth_members) along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_auth_members.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_AUTH_MEMBERS_H #define PG_AUTH_MEMBERS_H #include "catalog/genbki.h" /* ---------------- * pg_auth_members definition. cpp turns this into * typedef struct FormData_pg_auth_members * ---------------- */ #define AuthMemRelationId 1261 #define AuthMemRelation_Rowtype_Id 2843 CATALOG(pg_auth_members,1261) BKI_SHARED_RELATION BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(2843) BKI_SCHEMA_MACRO { Oid roleid; /* ID of a role */ Oid member; /* ID of a member of that role */ Oid grantor; /* who granted the membership */ bool admin_option; /* granted with admin option? */ } FormData_pg_auth_members; /* ---------------- * Form_pg_auth_members corresponds to a pointer to a tuple with * the format of pg_auth_members relation. * ---------------- */ typedef FormData_pg_auth_members *Form_pg_auth_members; /* ---------------- * compiler constants for pg_auth_members * ---------------- */ #define Natts_pg_auth_members 4 #define Anum_pg_auth_members_roleid 1 #define Anum_pg_auth_members_member 2 #define Anum_pg_auth_members_grantor 3 #define Anum_pg_auth_members_admin_option 4 #endif /* PG_AUTH_MEMBERS_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_largeobject.h���������������������������������������������������������������0000644�����������������00000003446�14763166026�0013754 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_largeobject.h * definition of the system "largeobject" relation (pg_largeobject) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_largeobject.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_LARGEOBJECT_H #define PG_LARGEOBJECT_H #include "catalog/genbki.h" /* ---------------- * pg_largeobject definition. cpp turns this into * typedef struct FormData_pg_largeobject * ---------------- */ #define LargeObjectRelationId 2613 CATALOG(pg_largeobject,2613) BKI_WITHOUT_OIDS { Oid loid; /* Identifier of large object */ int4 pageno; /* Page number (starting from 0) */ /* data has variable length, but we allow direct access; see inv_api.c */ bytea data; /* Data for page (may be zero-length) */ } FormData_pg_largeobject; /* ---------------- * Form_pg_largeobject corresponds to a pointer to a tuple with * the format of pg_largeobject relation. * ---------------- */ typedef FormData_pg_largeobject *Form_pg_largeobject; /* ---------------- * compiler constants for pg_largeobject * ---------------- */ #define Natts_pg_largeobject 3 #define Anum_pg_largeobject_loid 1 #define Anum_pg_largeobject_pageno 2 #define Anum_pg_largeobject_data 3 extern Oid LargeObjectCreate(Oid loid); extern void LargeObjectDrop(Oid loid); extern void LargeObjectAlterOwner(Oid loid, Oid newOwnerId); extern bool LargeObjectExists(Oid loid); #endif /* PG_LARGEOBJECT_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_trigger.h�������������������������������������������������������������������0000644�����������������00000013163�14763166026�0013133 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_trigger.h * definition of the system "trigger" relation (pg_trigger) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_trigger.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_TRIGGER_H #define PG_TRIGGER_H #include "catalog/genbki.h" /* ---------------- * pg_trigger definition. cpp turns this into * typedef struct FormData_pg_trigger * * Note: when tgconstraint is nonzero, tgconstrrelid, tgconstrindid, * tgdeferrable, and tginitdeferred are largely redundant with the referenced * pg_constraint entry. However, it is possible for a non-deferrable trigger * to be associated with a deferrable constraint. * ---------------- */ #define TriggerRelationId 2620 CATALOG(pg_trigger,2620) { Oid tgrelid; /* relation trigger is attached to */ NameData tgname; /* trigger's name */ Oid tgfoid; /* OID of function to be called */ int2 tgtype; /* BEFORE/AFTER/INSTEAD, UPDATE/DELETE/INSERT, * ROW/STATEMENT; see below */ char tgenabled; /* trigger's firing configuration WRT * session_replication_role */ bool tgisinternal; /* trigger is system-generated */ Oid tgconstrrelid; /* constraint's FROM table, if any */ Oid tgconstrindid; /* constraint's supporting index, if any */ Oid tgconstraint; /* associated pg_constraint entry, if any */ bool tgdeferrable; /* constraint trigger is deferrable */ bool tginitdeferred; /* constraint trigger is deferred initially */ int2 tgnargs; /* # of extra arguments in tgargs */ /* * Variable-length fields start here, but we allow direct access to * tgattr. Note: tgattr and tgargs must not be null. */ int2vector tgattr; /* column numbers, if trigger is on columns */ #ifdef CATALOG_VARLEN bytea tgargs; /* first\000second\000tgnargs\000 */ pg_node_tree tgqual; /* WHEN expression, or NULL if none */ #endif } FormData_pg_trigger; /* ---------------- * Form_pg_trigger corresponds to a pointer to a tuple with * the format of pg_trigger relation. * ---------------- */ typedef FormData_pg_trigger *Form_pg_trigger; /* ---------------- * compiler constants for pg_trigger * ---------------- */ #define Natts_pg_trigger 15 #define Anum_pg_trigger_tgrelid 1 #define Anum_pg_trigger_tgname 2 #define Anum_pg_trigger_tgfoid 3 #define Anum_pg_trigger_tgtype 4 #define Anum_pg_trigger_tgenabled 5 #define Anum_pg_trigger_tgisinternal 6 #define Anum_pg_trigger_tgconstrrelid 7 #define Anum_pg_trigger_tgconstrindid 8 #define Anum_pg_trigger_tgconstraint 9 #define Anum_pg_trigger_tgdeferrable 10 #define Anum_pg_trigger_tginitdeferred 11 #define Anum_pg_trigger_tgnargs 12 #define Anum_pg_trigger_tgattr 13 #define Anum_pg_trigger_tgargs 14 #define Anum_pg_trigger_tgqual 15 /* Bits within tgtype */ #define TRIGGER_TYPE_ROW (1 << 0) #define TRIGGER_TYPE_BEFORE (1 << 1) #define TRIGGER_TYPE_INSERT (1 << 2) #define TRIGGER_TYPE_DELETE (1 << 3) #define TRIGGER_TYPE_UPDATE (1 << 4) #define TRIGGER_TYPE_TRUNCATE (1 << 5) #define TRIGGER_TYPE_INSTEAD (1 << 6) #define TRIGGER_TYPE_LEVEL_MASK (TRIGGER_TYPE_ROW) #define TRIGGER_TYPE_STATEMENT 0 /* Note bits within TRIGGER_TYPE_TIMING_MASK aren't adjacent */ #define TRIGGER_TYPE_TIMING_MASK \ (TRIGGER_TYPE_BEFORE | TRIGGER_TYPE_INSTEAD) #define TRIGGER_TYPE_AFTER 0 #define TRIGGER_TYPE_EVENT_MASK \ (TRIGGER_TYPE_INSERT | TRIGGER_TYPE_DELETE | TRIGGER_TYPE_UPDATE | TRIGGER_TYPE_TRUNCATE) /* Macros for manipulating tgtype */ #define TRIGGER_CLEAR_TYPE(type) ((type) = 0) #define TRIGGER_SETT_ROW(type) ((type) |= TRIGGER_TYPE_ROW) #define TRIGGER_SETT_STATEMENT(type) ((type) |= TRIGGER_TYPE_STATEMENT) #define TRIGGER_SETT_BEFORE(type) ((type) |= TRIGGER_TYPE_BEFORE) #define TRIGGER_SETT_AFTER(type) ((type) |= TRIGGER_TYPE_AFTER) #define TRIGGER_SETT_INSTEAD(type) ((type) |= TRIGGER_TYPE_INSTEAD) #define TRIGGER_SETT_INSERT(type) ((type) |= TRIGGER_TYPE_INSERT) #define TRIGGER_SETT_DELETE(type) ((type) |= TRIGGER_TYPE_DELETE) #define TRIGGER_SETT_UPDATE(type) ((type) |= TRIGGER_TYPE_UPDATE) #define TRIGGER_SETT_TRUNCATE(type) ((type) |= TRIGGER_TYPE_TRUNCATE) #define TRIGGER_FOR_ROW(type) ((type) & TRIGGER_TYPE_ROW) #define TRIGGER_FOR_BEFORE(type) (((type) & TRIGGER_TYPE_TIMING_MASK) == TRIGGER_TYPE_BEFORE) #define TRIGGER_FOR_AFTER(type) (((type) & TRIGGER_TYPE_TIMING_MASK) == TRIGGER_TYPE_AFTER) #define TRIGGER_FOR_INSTEAD(type) (((type) & TRIGGER_TYPE_TIMING_MASK) == TRIGGER_TYPE_INSTEAD) #define TRIGGER_FOR_INSERT(type) ((type) & TRIGGER_TYPE_INSERT) #define TRIGGER_FOR_DELETE(type) ((type) & TRIGGER_TYPE_DELETE) #define TRIGGER_FOR_UPDATE(type) ((type) & TRIGGER_TYPE_UPDATE) #define TRIGGER_FOR_TRUNCATE(type) ((type) & TRIGGER_TYPE_TRUNCATE) /* * Efficient macro for checking if tgtype matches a particular level * (TRIGGER_TYPE_ROW or TRIGGER_TYPE_STATEMENT), timing (TRIGGER_TYPE_BEFORE, * TRIGGER_TYPE_AFTER or TRIGGER_TYPE_INSTEAD), and event (TRIGGER_TYPE_INSERT, * TRIGGER_TYPE_DELETE, TRIGGER_TYPE_UPDATE, or TRIGGER_TYPE_TRUNCATE). Note * that a tgtype can match more than one event, but only one level or timing. */ #define TRIGGER_TYPE_MATCHES(type, level, timing, event) \ (((type) & (TRIGGER_TYPE_LEVEL_MASK | TRIGGER_TYPE_TIMING_MASK | (event))) == ((level) | (timing) | (event))) #endif /* PG_TRIGGER_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_authid.h��������������������������������������������������������������������0000644�����������������00000006307�14763166026�0012750 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_authid.h * definition of the system "authorization identifier" relation (pg_authid) * along with the relation's initial contents. * * pg_shadow and pg_group are now publicly accessible views on pg_authid. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_authid.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_AUTHID_H #define PG_AUTHID_H #include "catalog/genbki.h" /* * The CATALOG definition has to refer to the type of rolvaliduntil as * "timestamptz" (lower case) so that bootstrap mode recognizes it. But * the C header files define this type as TimestampTz. Since the field is * potentially-null and therefore can't be accessed directly from C code, * there is no particular need for the C struct definition to show the * field type as TimestampTz --- instead we just make it int. */ #define timestamptz int /* ---------------- * pg_authid definition. cpp turns this into * typedef struct FormData_pg_authid * ---------------- */ #define AuthIdRelationId 1260 #define AuthIdRelation_Rowtype_Id 2842 CATALOG(pg_authid,1260) BKI_SHARED_RELATION BKI_ROWTYPE_OID(2842) BKI_SCHEMA_MACRO { NameData rolname; /* name of role */ bool rolsuper; /* read this field via superuser() only! */ bool rolinherit; /* inherit privileges from other roles? */ bool rolcreaterole; /* allowed to create more roles? */ bool rolcreatedb; /* allowed to create databases? */ bool rolcatupdate; /* allowed to alter catalogs manually? */ bool rolcanlogin; /* allowed to log in as session user? */ bool rolreplication; /* role used for streaming replication */ int4 rolconnlimit; /* max connections allowed (-1=no limit) */ /* remaining fields may be null; use heap_getattr to read them! */ text rolpassword; /* password, if any */ timestamptz rolvaliduntil; /* password expiration time, if any */ } FormData_pg_authid; #undef timestamptz /* ---------------- * Form_pg_authid corresponds to a pointer to a tuple with * the format of pg_authid relation. * ---------------- */ typedef FormData_pg_authid *Form_pg_authid; /* ---------------- * compiler constants for pg_authid * ---------------- */ #define Natts_pg_authid 11 #define Anum_pg_authid_rolname 1 #define Anum_pg_authid_rolsuper 2 #define Anum_pg_authid_rolinherit 3 #define Anum_pg_authid_rolcreaterole 4 #define Anum_pg_authid_rolcreatedb 5 #define Anum_pg_authid_rolcatupdate 6 #define Anum_pg_authid_rolcanlogin 7 #define Anum_pg_authid_rolreplication 8 #define Anum_pg_authid_rolconnlimit 9 #define Anum_pg_authid_rolpassword 10 #define Anum_pg_authid_rolvaliduntil 11 /* ---------------- * initial contents of pg_authid * * The uppercase quantities will be replaced at initdb time with * user choices. * ---------------- */ DATA(insert OID = 10 ( "POSTGRES" t t t t t t t -1 _null_ _null_ )); #define BOOTSTRAP_SUPERUSERID 10 #endif /* PG_AUTHID_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_inherits_fn.h���������������������������������������������������������������0000644�����������������00000001522�14763166026�0013774 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_inherits_fn.h * prototypes for functions in catalog/pg_inherits.c * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_inherits_fn.h * *------------------------------------------------------------------------- */ #ifndef PG_INHERITS_FN_H #define PG_INHERITS_FN_H #include "nodes/pg_list.h" #include "storage/lock.h" extern List *find_inheritance_children(Oid parentrelId, LOCKMODE lockmode); extern List *find_all_inheritors(Oid parentrelId, LOCKMODE lockmode, List **parents); extern bool has_subclass(Oid relationId); extern bool typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId); #endif /* PG_INHERITS_FN_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/catalog.h����������������������������������������������������������������������0000644�����������������00000004063�14763166026�0012413 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * catalog.h * prototypes for functions in backend/catalog/catalog.c * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/catalog.h * *------------------------------------------------------------------------- */ #ifndef CATALOG_H #define CATALOG_H /* * 'pgrminclude ignore' needed here because CppAsString2() does not throw * an error if the symbol is not defined. */ #include "catalog/catversion.h" /* pgrminclude ignore */ #include "catalog/pg_class.h" #include "storage/relfilenode.h" #include "utils/relcache.h" #define OIDCHARS 10 /* max chars printed by %u */ #define TABLESPACE_VERSION_DIRECTORY "PG_" PG_MAJORVERSION "_" \ CppAsString2(CATALOG_VERSION_NO) extern const char *forkNames[]; extern ForkNumber forkname_to_number(char *forkName); extern int forkname_chars(const char *str, ForkNumber *); extern char *relpathbackend(RelFileNode rnode, BackendId backend, ForkNumber forknum); extern char *GetDatabasePath(Oid dbNode, Oid spcNode); /* First argument is a RelFileNodeBackend */ #define relpath(rnode, forknum) \ relpathbackend((rnode).node, (rnode).backend, (forknum)) /* First argument is a RelFileNode */ #define relpathperm(rnode, forknum) \ relpathbackend((rnode), InvalidBackendId, (forknum)) extern bool IsSystemRelation(Relation relation); extern bool IsToastRelation(Relation relation); extern bool IsSystemClass(Form_pg_class reltuple); extern bool IsToastClass(Form_pg_class reltuple); extern bool IsSystemNamespace(Oid namespaceId); extern bool IsToastNamespace(Oid namespaceId); extern bool IsReservedName(const char *name); extern bool IsSharedRelation(Oid relationId); extern Oid GetNewOid(Relation relation); extern Oid GetNewOidWithIndex(Relation relation, Oid indexId, AttrNumber oidcolumn); extern Oid GetNewRelFileNode(Oid reltablespace, Relation pg_class, char relpersistence); #endif /* CATALOG_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_type.h����������������������������������������������������������������������0000644�����������������00000122605�14763166026�0012453 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_type.h * definition of the system "type" relation (pg_type) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_type.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_TYPE_H #define PG_TYPE_H #include "catalog/genbki.h" /* ---------------- * pg_type definition. cpp turns this into * typedef struct FormData_pg_type * * Some of the values in a pg_type instance are copied into * pg_attribute instances. Some parts of Postgres use the pg_type copy, * while others use the pg_attribute copy, so they must match. * See struct FormData_pg_attribute for details. * ---------------- */ #define TypeRelationId 1247 #define TypeRelation_Rowtype_Id 71 CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO { NameData typname; /* type name */ Oid typnamespace; /* OID of namespace containing this type */ Oid typowner; /* type owner */ /* * For a fixed-size type, typlen is the number of bytes we use to * represent a value of this type, e.g. 4 for an int4. But for a * variable-length type, typlen is negative. We use -1 to indicate a * "varlena" type (one that has a length word), -2 to indicate a * null-terminated C string. */ int2 typlen; /* * typbyval determines whether internal Postgres routines pass a value of * this type by value or by reference. typbyval had better be FALSE if * the length is not 1, 2, or 4 (or 8 on 8-byte-Datum machines). * Variable-length types are always passed by reference. Note that * typbyval can be false even if the length would allow pass-by-value; * this is currently true for type float4, for example. */ bool typbyval; /* * typtype is 'b' for a base type, 'c' for a composite type (e.g., a * table's rowtype), 'd' for a domain, 'e' for an enum type, 'p' for a * pseudo-type, or 'r' for a range type. (Use the TYPTYPE macros below.) * * If typtype is 'c', typrelid is the OID of the class' entry in pg_class. */ char typtype; /* * typcategory and typispreferred help the parser distinguish preferred * and non-preferred coercions. The category can be any single ASCII * character (but not \0). The categories used for built-in types are * identified by the TYPCATEGORY macros below. */ char typcategory; /* arbitrary type classification */ bool typispreferred; /* is type "preferred" within its category? */ /* * If typisdefined is false, the entry is only a placeholder (forward * reference). We know the type name, but not yet anything else about it. */ bool typisdefined; char typdelim; /* delimiter for arrays of this type */ Oid typrelid; /* 0 if not a composite type */ /* * If typelem is not 0 then it identifies another row in pg_type. The * current type can then be subscripted like an array yielding values of * type typelem. A non-zero typelem does not guarantee this type to be a * "real" array type; some ordinary fixed-length types can also be * subscripted (e.g., name, point). Variable-length types can *not* be * turned into pseudo-arrays like that. Hence, the way to determine * whether a type is a "true" array type is if: * * typelem != 0 and typlen == -1. */ Oid typelem; /* * If there is a "true" array type having this type as element type, * typarray links to it. Zero if no associated "true" array type. */ Oid typarray; /* * I/O conversion procedures for the datatype. */ regproc typinput; /* text format (required) */ regproc typoutput; regproc typreceive; /* binary format (optional) */ regproc typsend; /* * I/O functions for optional type modifiers. */ regproc typmodin; regproc typmodout; /* * Custom ANALYZE procedure for the datatype (0 selects the default). */ regproc typanalyze; /* ---------------- * typalign is the alignment required when storing a value of this * type. It applies to storage on disk as well as most * representations of the value inside Postgres. When multiple values * are stored consecutively, such as in the representation of a * complete row on disk, padding is inserted before a datum of this * type so that it begins on the specified boundary. The alignment * reference is the beginning of the first datum in the sequence. * * 'c' = CHAR alignment, ie no alignment needed. * 's' = SHORT alignment (2 bytes on most machines). * 'i' = INT alignment (4 bytes on most machines). * 'd' = DOUBLE alignment (8 bytes on many machines, but by no means all). * * See include/access/tupmacs.h for the macros that compute these * alignment requirements. Note also that we allow the nominal alignment * to be violated when storing "packed" varlenas; the TOAST mechanism * takes care of hiding that from most code. * * NOTE: for types used in system tables, it is critical that the * size and alignment defined in pg_type agree with the way that the * compiler will lay out the field in a struct representing a table row. * ---------------- */ char typalign; /* ---------------- * typstorage tells if the type is prepared for toasting and what * the default strategy for attributes of this type should be. * * 'p' PLAIN type not prepared for toasting * 'e' EXTERNAL external storage possible, don't try to compress * 'x' EXTENDED try to compress and store external if required * 'm' MAIN like 'x' but try to keep in main tuple * ---------------- */ char typstorage; /* * This flag represents a "NOT NULL" constraint against this datatype. * * If true, the attnotnull column for a corresponding table column using * this datatype will always enforce the NOT NULL constraint. * * Used primarily for domain types. */ bool typnotnull; /* * Domains use typbasetype to show the base (or domain) type that the * domain is based on. Zero if the type is not a domain. */ Oid typbasetype; /* * Domains use typtypmod to record the typmod to be applied to their base * type (-1 if base type does not use a typmod). -1 if this type is not a * domain. */ int4 typtypmod; /* * typndims is the declared number of dimensions for an array domain type * (i.e., typbasetype is an array type). Otherwise zero. */ int4 typndims; /* * Collation: 0 if type cannot use collations, DEFAULT_COLLATION_OID for * collatable base types, possibly other OID for domains */ Oid typcollation; #ifdef CATALOG_VARLEN /* variable-length fields start here */ /* * If typdefaultbin is not NULL, it is the nodeToString representation of * a default expression for the type. Currently this is only used for * domains. */ pg_node_tree typdefaultbin; /* * typdefault is NULL if the type has no associated default value. If * typdefaultbin is not NULL, typdefault must contain a human-readable * version of the default expression represented by typdefaultbin. If * typdefaultbin is NULL and typdefault is not, then typdefault is the * external representation of the type's default value, which may be fed * to the type's input converter to produce a constant. */ text typdefault; /* * Access permissions */ aclitem typacl[1]; #endif } FormData_pg_type; /* ---------------- * Form_pg_type corresponds to a pointer to a row with * the format of pg_type relation. * ---------------- */ typedef FormData_pg_type *Form_pg_type; /* ---------------- * compiler constants for pg_type * ---------------- */ #define Natts_pg_type 30 #define Anum_pg_type_typname 1 #define Anum_pg_type_typnamespace 2 #define Anum_pg_type_typowner 3 #define Anum_pg_type_typlen 4 #define Anum_pg_type_typbyval 5 #define Anum_pg_type_typtype 6 #define Anum_pg_type_typcategory 7 #define Anum_pg_type_typispreferred 8 #define Anum_pg_type_typisdefined 9 #define Anum_pg_type_typdelim 10 #define Anum_pg_type_typrelid 11 #define Anum_pg_type_typelem 12 #define Anum_pg_type_typarray 13 #define Anum_pg_type_typinput 14 #define Anum_pg_type_typoutput 15 #define Anum_pg_type_typreceive 16 #define Anum_pg_type_typsend 17 #define Anum_pg_type_typmodin 18 #define Anum_pg_type_typmodout 19 #define Anum_pg_type_typanalyze 20 #define Anum_pg_type_typalign 21 #define Anum_pg_type_typstorage 22 #define Anum_pg_type_typnotnull 23 #define Anum_pg_type_typbasetype 24 #define Anum_pg_type_typtypmod 25 #define Anum_pg_type_typndims 26 #define Anum_pg_type_typcollation 27 #define Anum_pg_type_typdefaultbin 28 #define Anum_pg_type_typdefault 29 #define Anum_pg_type_typacl 30 /* ---------------- * initial contents of pg_type * ---------------- */ /* * Keep the following ordered by OID so that later changes can be made more * easily. * * For types used in the system catalogs, make sure the values here match * TypInfo[] in bootstrap.c. */ /* OIDS 1 - 99 */ DATA(insert OID = 16 ( bool PGNSP PGUID 1 t b B t t \054 0 0 1000 boolin boolout boolrecv boolsend - - - c p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("boolean, 'true'/'false'"); #define BOOLOID 16 DATA(insert OID = 17 ( bytea PGNSP PGUID -1 f b U f t \054 0 0 1001 byteain byteaout bytearecv byteasend - - - i x f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("variable-length string, binary values escaped"); #define BYTEAOID 17 DATA(insert OID = 18 ( char PGNSP PGUID 1 t b S f t \054 0 0 1002 charin charout charrecv charsend - - - c p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("single character"); #define CHAROID 18 DATA(insert OID = 19 ( name PGNSP PGUID NAMEDATALEN f b S f t \054 0 18 1003 namein nameout namerecv namesend - - - c p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("63-byte type for storing system identifiers"); #define NAMEOID 19 DATA(insert OID = 20 ( int8 PGNSP PGUID 8 FLOAT8PASSBYVAL b N f t \054 0 0 1016 int8in int8out int8recv int8send - - - d p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("~18 digit integer, 8-byte storage"); #define INT8OID 20 DATA(insert OID = 21 ( int2 PGNSP PGUID 2 t b N f t \054 0 0 1005 int2in int2out int2recv int2send - - - s p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("-32 thousand to 32 thousand, 2-byte storage"); #define INT2OID 21 DATA(insert OID = 22 ( int2vector PGNSP PGUID -1 f b A f t \054 0 21 1006 int2vectorin int2vectorout int2vectorrecv int2vectorsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("array of int2, used in system tables"); #define INT2VECTOROID 22 DATA(insert OID = 23 ( int4 PGNSP PGUID 4 t b N f t \054 0 0 1007 int4in int4out int4recv int4send - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("-2 billion to 2 billion integer, 4-byte storage"); #define INT4OID 23 DATA(insert OID = 24 ( regproc PGNSP PGUID 4 t b N f t \054 0 0 1008 regprocin regprocout regprocrecv regprocsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("registered procedure"); #define REGPROCOID 24 DATA(insert OID = 25 ( text PGNSP PGUID -1 f b S t t \054 0 0 1009 textin textout textrecv textsend - - - i x f 0 -1 0 100 _null_ _null_ _null_ )); DESCR("variable-length string, no limit specified"); #define TEXTOID 25 DATA(insert OID = 26 ( oid PGNSP PGUID 4 t b N t t \054 0 0 1028 oidin oidout oidrecv oidsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("object identifier(oid), maximum 4 billion"); #define OIDOID 26 DATA(insert OID = 27 ( tid PGNSP PGUID 6 f b U f t \054 0 0 1010 tidin tidout tidrecv tidsend - - - s p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("(block, offset), physical location of tuple"); #define TIDOID 27 DATA(insert OID = 28 ( xid PGNSP PGUID 4 t b U f t \054 0 0 1011 xidin xidout xidrecv xidsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("transaction id"); #define XIDOID 28 DATA(insert OID = 29 ( cid PGNSP PGUID 4 t b U f t \054 0 0 1012 cidin cidout cidrecv cidsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("command identifier type, sequence in transaction id"); #define CIDOID 29 DATA(insert OID = 30 ( oidvector PGNSP PGUID -1 f b A f t \054 0 26 1013 oidvectorin oidvectorout oidvectorrecv oidvectorsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("array of oids, used in system tables"); #define OIDVECTOROID 30 /* hand-built rowtype entries for bootstrapped catalogs */ /* NB: OIDs assigned here must match the BKI_ROWTYPE_OID declarations */ DATA(insert OID = 71 ( pg_type PGNSP PGUID -1 f c C f t \054 1247 0 0 record_in record_out record_recv record_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 75 ( pg_attribute PGNSP PGUID -1 f c C f t \054 1249 0 0 record_in record_out record_recv record_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 81 ( pg_proc PGNSP PGUID -1 f c C f t \054 1255 0 0 record_in record_out record_recv record_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 83 ( pg_class PGNSP PGUID -1 f c C f t \054 1259 0 0 record_in record_out record_recv record_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ )); /* OIDS 100 - 199 */ DATA(insert OID = 114 ( json PGNSP PGUID -1 f b U f t \054 0 0 199 json_in json_out json_recv json_send - - - i x f 0 -1 0 0 _null_ _null_ _null_ )); #define JSONOID 114 DATA(insert OID = 142 ( xml PGNSP PGUID -1 f b U f t \054 0 0 143 xml_in xml_out xml_recv xml_send - - - i x f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("XML content"); #define XMLOID 142 DATA(insert OID = 143 ( _xml PGNSP PGUID -1 f b A f t \054 0 142 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 199 ( _json PGNSP PGUID -1 f b A f t \054 0 114 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 194 ( pg_node_tree PGNSP PGUID -1 f b S f t \054 0 0 0 pg_node_tree_in pg_node_tree_out pg_node_tree_recv pg_node_tree_send - - - i x f 0 -1 0 100 _null_ _null_ _null_ )); DESCR("string representing an internal node tree"); #define PGNODETREEOID 194 /* OIDS 200 - 299 */ DATA(insert OID = 210 ( smgr PGNSP PGUID 2 t b U f t \054 0 0 0 smgrin smgrout - - - - - s p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("storage manager"); /* OIDS 300 - 399 */ /* OIDS 400 - 499 */ /* OIDS 500 - 599 */ /* OIDS 600 - 699 */ DATA(insert OID = 600 ( point PGNSP PGUID 16 f b G f t \054 0 701 1017 point_in point_out point_recv point_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("geometric point '(x, y)'"); #define POINTOID 600 DATA(insert OID = 601 ( lseg PGNSP PGUID 32 f b G f t \054 0 600 1018 lseg_in lseg_out lseg_recv lseg_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("geometric line segment '(pt1,pt2)'"); #define LSEGOID 601 DATA(insert OID = 602 ( path PGNSP PGUID -1 f b G f t \054 0 0 1019 path_in path_out path_recv path_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("geometric path '(pt1,...)'"); #define PATHOID 602 DATA(insert OID = 603 ( box PGNSP PGUID 32 f b G f t \073 0 600 1020 box_in box_out box_recv box_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("geometric box '(lower left,upper right)'"); #define BOXOID 603 DATA(insert OID = 604 ( polygon PGNSP PGUID -1 f b G f t \054 0 0 1027 poly_in poly_out poly_recv poly_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("geometric polygon '(pt1,...)'"); #define POLYGONOID 604 DATA(insert OID = 628 ( line PGNSP PGUID 32 f b G f t \054 0 701 629 line_in line_out line_recv line_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("geometric line (not implemented)"); #define LINEOID 628 DATA(insert OID = 629 ( _line PGNSP PGUID -1 f b A f t \054 0 628 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); DESCR(""); /* OIDS 700 - 799 */ DATA(insert OID = 700 ( float4 PGNSP PGUID 4 FLOAT4PASSBYVAL b N f t \054 0 0 1021 float4in float4out float4recv float4send - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("single-precision floating point number, 4-byte storage"); #define FLOAT4OID 700 DATA(insert OID = 701 ( float8 PGNSP PGUID 8 FLOAT8PASSBYVAL b N t t \054 0 0 1022 float8in float8out float8recv float8send - - - d p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("double-precision floating point number, 8-byte storage"); #define FLOAT8OID 701 DATA(insert OID = 702 ( abstime PGNSP PGUID 4 t b D f t \054 0 0 1023 abstimein abstimeout abstimerecv abstimesend - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("absolute, limited-range date and time (Unix system time)"); #define ABSTIMEOID 702 DATA(insert OID = 703 ( reltime PGNSP PGUID 4 t b T f t \054 0 0 1024 reltimein reltimeout reltimerecv reltimesend - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("relative, limited-range time interval (Unix delta time)"); #define RELTIMEOID 703 DATA(insert OID = 704 ( tinterval PGNSP PGUID 12 f b T f t \054 0 0 1025 tintervalin tintervalout tintervalrecv tintervalsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("(abstime,abstime), time interval"); #define TINTERVALOID 704 DATA(insert OID = 705 ( unknown PGNSP PGUID -2 f b X f t \054 0 0 0 unknownin unknownout unknownrecv unknownsend - - - c p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR(""); #define UNKNOWNOID 705 DATA(insert OID = 718 ( circle PGNSP PGUID 24 f b G f t \054 0 0 719 circle_in circle_out circle_recv circle_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("geometric circle '(center,radius)'"); #define CIRCLEOID 718 DATA(insert OID = 719 ( _circle PGNSP PGUID -1 f b A f t \054 0 718 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 790 ( money PGNSP PGUID 8 FLOAT8PASSBYVAL b N f t \054 0 0 791 cash_in cash_out cash_recv cash_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("monetary amounts, $d,ddd.cc"); #define CASHOID 790 DATA(insert OID = 791 ( _money PGNSP PGUID -1 f b A f t \054 0 790 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); /* OIDS 800 - 899 */ DATA(insert OID = 829 ( macaddr PGNSP PGUID 6 f b U f t \054 0 0 1040 macaddr_in macaddr_out macaddr_recv macaddr_send - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("XX:XX:XX:XX:XX:XX, MAC address"); #define MACADDROID 829 DATA(insert OID = 869 ( inet PGNSP PGUID -1 f b I t t \054 0 0 1041 inet_in inet_out inet_recv inet_send - - - i m f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("IP address/netmask, host address, netmask optional"); #define INETOID 869 DATA(insert OID = 650 ( cidr PGNSP PGUID -1 f b I f t \054 0 0 651 cidr_in cidr_out cidr_recv cidr_send - - - i m f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("network IP address/netmask, network address"); #define CIDROID 650 /* OIDS 900 - 999 */ /* OIDS 1000 - 1099 */ DATA(insert OID = 1000 ( _bool PGNSP PGUID -1 f b A f t \054 0 16 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1001 ( _bytea PGNSP PGUID -1 f b A f t \054 0 17 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1002 ( _char PGNSP PGUID -1 f b A f t \054 0 18 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1003 ( _name PGNSP PGUID -1 f b A f t \054 0 19 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1005 ( _int2 PGNSP PGUID -1 f b A f t \054 0 21 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); #define INT2ARRAYOID 1005 DATA(insert OID = 1006 ( _int2vector PGNSP PGUID -1 f b A f t \054 0 22 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1007 ( _int4 PGNSP PGUID -1 f b A f t \054 0 23 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); #define INT4ARRAYOID 1007 DATA(insert OID = 1008 ( _regproc PGNSP PGUID -1 f b A f t \054 0 24 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1009 ( _text PGNSP PGUID -1 f b A f t \054 0 25 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 100 _null_ _null_ _null_ )); #define TEXTARRAYOID 1009 DATA(insert OID = 1028 ( _oid PGNSP PGUID -1 f b A f t \054 0 26 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); #define OIDARRAYOID 1028 DATA(insert OID = 1010 ( _tid PGNSP PGUID -1 f b A f t \054 0 27 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1011 ( _xid PGNSP PGUID -1 f b A f t \054 0 28 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1012 ( _cid PGNSP PGUID -1 f b A f t \054 0 29 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1013 ( _oidvector PGNSP PGUID -1 f b A f t \054 0 30 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1014 ( _bpchar PGNSP PGUID -1 f b A f t \054 0 1042 0 array_in array_out array_recv array_send bpchartypmodin bpchartypmodout array_typanalyze i x f 0 -1 0 100 _null_ _null_ _null_ )); DATA(insert OID = 1015 ( _varchar PGNSP PGUID -1 f b A f t \054 0 1043 0 array_in array_out array_recv array_send varchartypmodin varchartypmodout array_typanalyze i x f 0 -1 0 100 _null_ _null_ _null_ )); DATA(insert OID = 1016 ( _int8 PGNSP PGUID -1 f b A f t \054 0 20 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1017 ( _point PGNSP PGUID -1 f b A f t \054 0 600 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1018 ( _lseg PGNSP PGUID -1 f b A f t \054 0 601 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1019 ( _path PGNSP PGUID -1 f b A f t \054 0 602 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1020 ( _box PGNSP PGUID -1 f b A f t \073 0 603 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1021 ( _float4 PGNSP PGUID -1 f b A f t \054 0 700 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); #define FLOAT4ARRAYOID 1021 DATA(insert OID = 1022 ( _float8 PGNSP PGUID -1 f b A f t \054 0 701 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1023 ( _abstime PGNSP PGUID -1 f b A f t \054 0 702 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1024 ( _reltime PGNSP PGUID -1 f b A f t \054 0 703 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1025 ( _tinterval PGNSP PGUID -1 f b A f t \054 0 704 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1027 ( _polygon PGNSP PGUID -1 f b A f t \054 0 604 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1033 ( aclitem PGNSP PGUID 12 f b U f t \054 0 0 1034 aclitemin aclitemout - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("access control list"); #define ACLITEMOID 1033 DATA(insert OID = 1034 ( _aclitem PGNSP PGUID -1 f b A f t \054 0 1033 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1040 ( _macaddr PGNSP PGUID -1 f b A f t \054 0 829 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1041 ( _inet PGNSP PGUID -1 f b A f t \054 0 869 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 651 ( _cidr PGNSP PGUID -1 f b A f t \054 0 650 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1263 ( _cstring PGNSP PGUID -1 f b A f t \054 0 2275 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); #define CSTRINGARRAYOID 1263 DATA(insert OID = 1042 ( bpchar PGNSP PGUID -1 f b S f t \054 0 0 1014 bpcharin bpcharout bpcharrecv bpcharsend bpchartypmodin bpchartypmodout - i x f 0 -1 0 100 _null_ _null_ _null_ )); DESCR("char(length), blank-padded string, fixed storage length"); #define BPCHAROID 1042 DATA(insert OID = 1043 ( varchar PGNSP PGUID -1 f b S f t \054 0 0 1015 varcharin varcharout varcharrecv varcharsend varchartypmodin varchartypmodout - i x f 0 -1 0 100 _null_ _null_ _null_ )); DESCR("varchar(length), non-blank-padded string, variable storage length"); #define VARCHAROID 1043 DATA(insert OID = 1082 ( date PGNSP PGUID 4 t b D f t \054 0 0 1182 date_in date_out date_recv date_send - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("date"); #define DATEOID 1082 DATA(insert OID = 1083 ( time PGNSP PGUID 8 FLOAT8PASSBYVAL b D f t \054 0 0 1183 time_in time_out time_recv time_send timetypmodin timetypmodout - d p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("time of day"); #define TIMEOID 1083 /* OIDS 1100 - 1199 */ DATA(insert OID = 1114 ( timestamp PGNSP PGUID 8 FLOAT8PASSBYVAL b D f t \054 0 0 1115 timestamp_in timestamp_out timestamp_recv timestamp_send timestamptypmodin timestamptypmodout - d p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("date and time"); #define TIMESTAMPOID 1114 DATA(insert OID = 1115 ( _timestamp PGNSP PGUID -1 f b A f t \054 0 1114 0 array_in array_out array_recv array_send timestamptypmodin timestamptypmodout array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1182 ( _date PGNSP PGUID -1 f b A f t \054 0 1082 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1183 ( _time PGNSP PGUID -1 f b A f t \054 0 1083 0 array_in array_out array_recv array_send timetypmodin timetypmodout array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1184 ( timestamptz PGNSP PGUID 8 FLOAT8PASSBYVAL b D t t \054 0 0 1185 timestamptz_in timestamptz_out timestamptz_recv timestamptz_send timestamptztypmodin timestamptztypmodout - d p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("date and time with time zone"); #define TIMESTAMPTZOID 1184 DATA(insert OID = 1185 ( _timestamptz PGNSP PGUID -1 f b A f t \054 0 1184 0 array_in array_out array_recv array_send timestamptztypmodin timestamptztypmodout array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1186 ( interval PGNSP PGUID 16 f b T t t \054 0 0 1187 interval_in interval_out interval_recv interval_send intervaltypmodin intervaltypmodout - d p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("@ <number> <units>, time interval"); #define INTERVALOID 1186 DATA(insert OID = 1187 ( _interval PGNSP PGUID -1 f b A f t \054 0 1186 0 array_in array_out array_recv array_send intervaltypmodin intervaltypmodout array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); /* OIDS 1200 - 1299 */ DATA(insert OID = 1231 ( _numeric PGNSP PGUID -1 f b A f t \054 0 1700 0 array_in array_out array_recv array_send numerictypmodin numerictypmodout array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1266 ( timetz PGNSP PGUID 12 f b D f t \054 0 0 1270 timetz_in timetz_out timetz_recv timetz_send timetztypmodin timetztypmodout - d p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("time of day with time zone"); #define TIMETZOID 1266 DATA(insert OID = 1270 ( _timetz PGNSP PGUID -1 f b A f t \054 0 1266 0 array_in array_out array_recv array_send timetztypmodin timetztypmodout array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); /* OIDS 1500 - 1599 */ DATA(insert OID = 1560 ( bit PGNSP PGUID -1 f b V f t \054 0 0 1561 bit_in bit_out bit_recv bit_send bittypmodin bittypmodout - i x f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("fixed-length bit string"); #define BITOID 1560 DATA(insert OID = 1561 ( _bit PGNSP PGUID -1 f b A f t \054 0 1560 0 array_in array_out array_recv array_send bittypmodin bittypmodout array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1562 ( varbit PGNSP PGUID -1 f b V t t \054 0 0 1563 varbit_in varbit_out varbit_recv varbit_send varbittypmodin varbittypmodout - i x f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("variable-length bit string"); #define VARBITOID 1562 DATA(insert OID = 1563 ( _varbit PGNSP PGUID -1 f b A f t \054 0 1562 0 array_in array_out array_recv array_send varbittypmodin varbittypmodout array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); /* OIDS 1600 - 1699 */ /* OIDS 1700 - 1799 */ DATA(insert OID = 1700 ( numeric PGNSP PGUID -1 f b N f t \054 0 0 1231 numeric_in numeric_out numeric_recv numeric_send numerictypmodin numerictypmodout - i m f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("numeric(precision, decimal), arbitrary precision number"); #define NUMERICOID 1700 DATA(insert OID = 1790 ( refcursor PGNSP PGUID -1 f b U f t \054 0 0 2201 textin textout textrecv textsend - - - i x f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("reference to cursor (portal name)"); #define REFCURSOROID 1790 /* OIDS 2200 - 2299 */ DATA(insert OID = 2201 ( _refcursor PGNSP PGUID -1 f b A f t \054 0 1790 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 2202 ( regprocedure PGNSP PGUID 4 t b N f t \054 0 0 2207 regprocedurein regprocedureout regprocedurerecv regproceduresend - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("registered procedure (with args)"); #define REGPROCEDUREOID 2202 DATA(insert OID = 2203 ( regoper PGNSP PGUID 4 t b N f t \054 0 0 2208 regoperin regoperout regoperrecv regopersend - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("registered operator"); #define REGOPEROID 2203 DATA(insert OID = 2204 ( regoperator PGNSP PGUID 4 t b N f t \054 0 0 2209 regoperatorin regoperatorout regoperatorrecv regoperatorsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("registered operator (with args)"); #define REGOPERATOROID 2204 DATA(insert OID = 2205 ( regclass PGNSP PGUID 4 t b N f t \054 0 0 2210 regclassin regclassout regclassrecv regclasssend - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("registered class"); #define REGCLASSOID 2205 DATA(insert OID = 2206 ( regtype PGNSP PGUID 4 t b N f t \054 0 0 2211 regtypein regtypeout regtyperecv regtypesend - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("registered type"); #define REGTYPEOID 2206 DATA(insert OID = 2207 ( _regprocedure PGNSP PGUID -1 f b A f t \054 0 2202 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 2208 ( _regoper PGNSP PGUID -1 f b A f t \054 0 2203 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 2209 ( _regoperator PGNSP PGUID -1 f b A f t \054 0 2204 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 2210 ( _regclass PGNSP PGUID -1 f b A f t \054 0 2205 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 2211 ( _regtype PGNSP PGUID -1 f b A f t \054 0 2206 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); #define REGTYPEARRAYOID 2211 /* uuid */ DATA(insert OID = 2950 ( uuid PGNSP PGUID 16 f b U f t \054 0 0 2951 uuid_in uuid_out uuid_recv uuid_send - - - c p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("UUID datatype"); DATA(insert OID = 2951 ( _uuid PGNSP PGUID -1 f b A f t \054 0 2950 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); /* text search */ DATA(insert OID = 3614 ( tsvector PGNSP PGUID -1 f b U f t \054 0 0 3643 tsvectorin tsvectorout tsvectorrecv tsvectorsend - - ts_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("text representation for text search"); #define TSVECTOROID 3614 DATA(insert OID = 3642 ( gtsvector PGNSP PGUID -1 f b U f t \054 0 0 3644 gtsvectorin gtsvectorout - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("GiST index internal text representation for text search"); #define GTSVECTOROID 3642 DATA(insert OID = 3615 ( tsquery PGNSP PGUID -1 f b U f t \054 0 0 3645 tsqueryin tsqueryout tsqueryrecv tsquerysend - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("query representation for text search"); #define TSQUERYOID 3615 DATA(insert OID = 3734 ( regconfig PGNSP PGUID 4 t b N f t \054 0 0 3735 regconfigin regconfigout regconfigrecv regconfigsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("registered text search configuration"); #define REGCONFIGOID 3734 DATA(insert OID = 3769 ( regdictionary PGNSP PGUID 4 t b N f t \054 0 0 3770 regdictionaryin regdictionaryout regdictionaryrecv regdictionarysend - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("registered text search dictionary"); #define REGDICTIONARYOID 3769 DATA(insert OID = 3643 ( _tsvector PGNSP PGUID -1 f b A f t \054 0 3614 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 3644 ( _gtsvector PGNSP PGUID -1 f b A f t \054 0 3642 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 3645 ( _tsquery PGNSP PGUID -1 f b A f t \054 0 3615 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 3735 ( _regconfig PGNSP PGUID -1 f b A f t \054 0 3734 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 3770 ( _regdictionary PGNSP PGUID -1 f b A f t \054 0 3769 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 2970 ( txid_snapshot PGNSP PGUID -1 f b U f t \054 0 0 2949 txid_snapshot_in txid_snapshot_out txid_snapshot_recv txid_snapshot_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("txid snapshot"); DATA(insert OID = 2949 ( _txid_snapshot PGNSP PGUID -1 f b A f t \054 0 2970 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); /* range types */ DATA(insert OID = 3904 ( int4range PGNSP PGUID -1 f r R f t \054 0 0 3905 range_in range_out range_recv range_send - - range_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("range of integers"); #define INT4RANGEOID 3904 DATA(insert OID = 3905 ( _int4range PGNSP PGUID -1 f b A f t \054 0 3904 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 3906 ( numrange PGNSP PGUID -1 f r R f t \054 0 0 3907 range_in range_out range_recv range_send - - range_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("range of numerics"); DATA(insert OID = 3907 ( _numrange PGNSP PGUID -1 f b A f t \054 0 3906 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 3908 ( tsrange PGNSP PGUID -1 f r R f t \054 0 0 3909 range_in range_out range_recv range_send - - range_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("range of timestamps without time zone"); DATA(insert OID = 3909 ( _tsrange PGNSP PGUID -1 f b A f t \054 0 3908 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 3910 ( tstzrange PGNSP PGUID -1 f r R f t \054 0 0 3911 range_in range_out range_recv range_send - - range_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("range of timestamps with time zone"); DATA(insert OID = 3911 ( _tstzrange PGNSP PGUID -1 f b A f t \054 0 3910 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 3912 ( daterange PGNSP PGUID -1 f r R f t \054 0 0 3913 range_in range_out range_recv range_send - - range_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("range of dates"); DATA(insert OID = 3913 ( _daterange PGNSP PGUID -1 f b A f t \054 0 3912 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 3926 ( int8range PGNSP PGUID -1 f r R f t \054 0 0 3927 range_in range_out range_recv range_send - - range_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("range of bigints"); DATA(insert OID = 3927 ( _int8range PGNSP PGUID -1 f b A f t \054 0 3926 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); /* * pseudo-types * * types with typtype='p' represent various special cases in the type system. * * These cannot be used to define table columns, but are valid as function * argument and result types (if supported by the function's implementation * language). * * Note: cstring is a borderline case; it is still considered a pseudo-type, * but there is now support for it in records and arrays. Perhaps we should * just treat it as a regular base type? */ DATA(insert OID = 2249 ( record PGNSP PGUID -1 f p P f t \054 0 0 2287 record_in record_out record_recv record_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ )); #define RECORDOID 2249 DATA(insert OID = 2287 ( _record PGNSP PGUID -1 f p P f t \054 0 2249 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); #define RECORDARRAYOID 2287 DATA(insert OID = 2275 ( cstring PGNSP PGUID -2 f p P f t \054 0 0 1263 cstring_in cstring_out cstring_recv cstring_send - - - c p f 0 -1 0 0 _null_ _null_ _null_ )); #define CSTRINGOID 2275 DATA(insert OID = 2276 ( any PGNSP PGUID 4 t p P f t \054 0 0 0 any_in any_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); #define ANYOID 2276 DATA(insert OID = 2277 ( anyarray PGNSP PGUID -1 f p P f t \054 0 0 0 anyarray_in anyarray_out anyarray_recv anyarray_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ )); #define ANYARRAYOID 2277 DATA(insert OID = 2278 ( void PGNSP PGUID 4 t p P f t \054 0 0 0 void_in void_out void_recv void_send - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); #define VOIDOID 2278 DATA(insert OID = 2279 ( trigger PGNSP PGUID 4 t p P f t \054 0 0 0 trigger_in trigger_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); #define TRIGGEROID 2279 DATA(insert OID = 2280 ( language_handler PGNSP PGUID 4 t p P f t \054 0 0 0 language_handler_in language_handler_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); #define LANGUAGE_HANDLEROID 2280 DATA(insert OID = 2281 ( internal PGNSP PGUID SIZEOF_POINTER t p P f t \054 0 0 0 internal_in internal_out - - - - - ALIGNOF_POINTER p f 0 -1 0 0 _null_ _null_ _null_ )); #define INTERNALOID 2281 DATA(insert OID = 2282 ( opaque PGNSP PGUID 4 t p P f t \054 0 0 0 opaque_in opaque_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); #define OPAQUEOID 2282 DATA(insert OID = 2283 ( anyelement PGNSP PGUID 4 t p P f t \054 0 0 0 anyelement_in anyelement_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); #define ANYELEMENTOID 2283 DATA(insert OID = 2776 ( anynonarray PGNSP PGUID 4 t p P f t \054 0 0 0 anynonarray_in anynonarray_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); #define ANYNONARRAYOID 2776 DATA(insert OID = 3500 ( anyenum PGNSP PGUID 4 t p P f t \054 0 0 0 anyenum_in anyenum_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); #define ANYENUMOID 3500 DATA(insert OID = 3115 ( fdw_handler PGNSP PGUID 4 t p P f t \054 0 0 0 fdw_handler_in fdw_handler_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); #define FDW_HANDLEROID 3115 DATA(insert OID = 3831 ( anyrange PGNSP PGUID -1 f p P f t \054 0 0 0 anyrange_in anyrange_out - - - - - d x f 0 -1 0 0 _null_ _null_ _null_ )); #define ANYRANGEOID 3831 /* * macros */ #define TYPTYPE_BASE 'b' /* base type (ordinary scalar type) */ #define TYPTYPE_COMPOSITE 'c' /* composite (e.g., table's rowtype) */ #define TYPTYPE_DOMAIN 'd' /* domain over another type */ #define TYPTYPE_ENUM 'e' /* enumerated type */ #define TYPTYPE_PSEUDO 'p' /* pseudo-type */ #define TYPTYPE_RANGE 'r' /* range type */ #define TYPCATEGORY_INVALID '\0' /* not an allowed category */ #define TYPCATEGORY_ARRAY 'A' #define TYPCATEGORY_BOOLEAN 'B' #define TYPCATEGORY_COMPOSITE 'C' #define TYPCATEGORY_DATETIME 'D' #define TYPCATEGORY_ENUM 'E' #define TYPCATEGORY_GEOMETRIC 'G' #define TYPCATEGORY_NETWORK 'I' /* think INET */ #define TYPCATEGORY_NUMERIC 'N' #define TYPCATEGORY_PSEUDOTYPE 'P' #define TYPCATEGORY_RANGE 'R' #define TYPCATEGORY_STRING 'S' #define TYPCATEGORY_TIMESPAN 'T' #define TYPCATEGORY_USER 'U' #define TYPCATEGORY_BITSTRING 'V' /* er ... "varbit"? */ #define TYPCATEGORY_UNKNOWN 'X' /* Is a type OID a polymorphic pseudotype? (Beware of multiple evaluation) */ #define IsPolymorphicType(typid) \ ((typid) == ANYELEMENTOID || \ (typid) == ANYARRAYOID || \ (typid) == ANYNONARRAYOID || \ (typid) == ANYENUMOID || \ (typid) == ANYRANGEOID) #endif /* PG_TYPE_H */ ���������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_inherits.h������������������������������������������������������������������0000644�����������������00000002733�14763166026�0013316 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_inherits.h * definition of the system "inherits" relation (pg_inherits) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_inherits.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_INHERITS_H #define PG_INHERITS_H #include "catalog/genbki.h" /* ---------------- * pg_inherits definition. cpp turns this into * typedef struct FormData_pg_inherits * ---------------- */ #define InheritsRelationId 2611 CATALOG(pg_inherits,2611) BKI_WITHOUT_OIDS { Oid inhrelid; Oid inhparent; int4 inhseqno; } FormData_pg_inherits; /* ---------------- * Form_pg_inherits corresponds to a pointer to a tuple with * the format of pg_inherits relation. * ---------------- */ typedef FormData_pg_inherits *Form_pg_inherits; /* ---------------- * compiler constants for pg_inherits * ---------------- */ #define Natts_pg_inherits 3 #define Anum_pg_inherits_inhrelid 1 #define Anum_pg_inherits_inhparent 2 #define Anum_pg_inherits_inhseqno 3 /* ---------------- * pg_inherits has no initial contents * ---------------- */ #endif /* PG_INHERITS_H */ �������������������������������������pgsql/server/catalog/namespace.h��������������������������������������������������������������������0000644�����������������00000013322�14763166026�0012733 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * namespace.h * prototypes for functions in backend/catalog/namespace.c * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/namespace.h * *------------------------------------------------------------------------- */ #ifndef NAMESPACE_H #define NAMESPACE_H #include "nodes/primnodes.h" #include "storage/lock.h" /* * This structure holds a list of possible functions or operators * found by namespace lookup. Each function/operator is identified * by OID and by argument types; the list must be pruned by type * resolution rules that are embodied in the parser, not here. * See FuncnameGetCandidates's comments for more info. */ typedef struct _FuncCandidateList { struct _FuncCandidateList *next; int pathpos; /* for internal use of namespace lookup */ Oid oid; /* the function or operator's OID */ int nargs; /* number of arg types returned */ int nvargs; /* number of args to become variadic array */ int ndargs; /* number of defaulted args */ int *argnumbers; /* args' positional indexes, if named call */ Oid args[1]; /* arg types --- VARIABLE LENGTH ARRAY */ } *FuncCandidateList; /* VARIABLE LENGTH STRUCT */ /* * Structure for xxxOverrideSearchPath functions */ typedef struct OverrideSearchPath { List *schemas; /* OIDs of explicitly named schemas */ bool addCatalog; /* implicitly prepend pg_catalog? */ bool addTemp; /* implicitly prepend temp schema? */ } OverrideSearchPath; typedef void (*RangeVarGetRelidCallback) (const RangeVar *relation, Oid relId, Oid oldRelId, void *callback_arg); #define RangeVarGetRelid(relation, lockmode, missing_ok) \ RangeVarGetRelidExtended(relation, lockmode, missing_ok, false, NULL, NULL) extern Oid RangeVarGetRelidExtended(const RangeVar *relation, LOCKMODE lockmode, bool missing_ok, bool nowait, RangeVarGetRelidCallback callback, void *callback_arg); extern Oid RangeVarGetCreationNamespace(const RangeVar *newRelation); extern Oid RangeVarGetAndCheckCreationNamespace(RangeVar *newRelation, LOCKMODE lockmode, Oid *existing_relation_id); extern void RangeVarAdjustRelationPersistence(RangeVar *newRelation, Oid nspid); extern Oid RelnameGetRelid(const char *relname); extern bool RelationIsVisible(Oid relid); extern Oid TypenameGetTypid(const char *typname); extern Oid TypenameGetTypidExtended(const char *typname, bool temp_ok); extern bool TypeIsVisible(Oid typid); extern FuncCandidateList FuncnameGetCandidates(List *names, int nargs, List *argnames, bool expand_variadic, bool expand_defaults); extern bool FunctionIsVisible(Oid funcid); extern Oid OpernameGetOprid(List *names, Oid oprleft, Oid oprright); extern FuncCandidateList OpernameGetCandidates(List *names, char oprkind); extern bool OperatorIsVisible(Oid oprid); extern Oid OpclassnameGetOpcid(Oid amid, const char *opcname); extern bool OpclassIsVisible(Oid opcid); extern Oid OpfamilynameGetOpfid(Oid amid, const char *opfname); extern bool OpfamilyIsVisible(Oid opfid); extern Oid CollationGetCollid(const char *collname); extern bool CollationIsVisible(Oid collid); extern Oid ConversionGetConid(const char *conname); extern bool ConversionIsVisible(Oid conid); extern Oid get_ts_parser_oid(List *names, bool missing_ok); extern bool TSParserIsVisible(Oid prsId); extern Oid get_ts_dict_oid(List *names, bool missing_ok); extern bool TSDictionaryIsVisible(Oid dictId); extern Oid get_ts_template_oid(List *names, bool missing_ok); extern bool TSTemplateIsVisible(Oid tmplId); extern Oid get_ts_config_oid(List *names, bool missing_ok); extern bool TSConfigIsVisible(Oid cfgid); extern void DeconstructQualifiedName(List *names, char **nspname_p, char **objname_p); extern Oid LookupNamespaceNoError(const char *nspname); extern Oid LookupExplicitNamespace(const char *nspname); extern Oid get_namespace_oid(const char *nspname, bool missing_ok); extern Oid LookupCreationNamespace(const char *nspname); extern void CheckSetNamespace(Oid oldNspOid, Oid nspOid, Oid classid, Oid objid); extern Oid QualifiedNameGetCreationNamespace(List *names, char **objname_p); extern RangeVar *makeRangeVarFromNameList(List *names); extern char *NameListToString(List *names); extern char *NameListToQuotedString(List *names); extern bool isTempNamespace(Oid namespaceId); extern bool isTempToastNamespace(Oid namespaceId); extern bool isTempOrToastNamespace(Oid namespaceId); extern bool isAnyTempNamespace(Oid namespaceId); extern bool isOtherTempNamespace(Oid namespaceId); extern int GetTempNamespaceBackendId(Oid namespaceId); extern Oid GetTempToastNamespace(void); extern void ResetTempTableNamespace(void); extern OverrideSearchPath *GetOverrideSearchPath(MemoryContext context); extern OverrideSearchPath *CopyOverrideSearchPath(OverrideSearchPath *path); extern void PushOverrideSearchPath(OverrideSearchPath *newpath); extern void PopOverrideSearchPath(void); extern Oid get_collation_oid(List *collname, bool missing_ok); extern Oid get_conversion_oid(List *conname, bool missing_ok); extern Oid FindDefaultConversionProc(int4 for_encoding, int4 to_encoding); /* initialization & transaction cleanup code */ extern void InitializeSearchPath(void); extern void AtEOXact_Namespace(bool isCommit); extern void AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid); /* stuff for search_path GUC variable */ extern char *namespace_search_path; extern List *fetch_search_path(bool includeImplicit); extern int fetch_search_path_array(Oid *sarray, int sarray_len); #endif /* NAMESPACE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_attribute.h�����������������������������������������������������������������0000644�����������������00000015446�14763166026�0013501 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_attribute.h * definition of the system "attribute" relation (pg_attribute) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_attribute.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_ATTRIBUTE_H #define PG_ATTRIBUTE_H #include "catalog/genbki.h" /* ---------------- * pg_attribute definition. cpp turns this into * typedef struct FormData_pg_attribute * * If you change the following, make sure you change the structs for * system attributes in catalog/heap.c also. * You may need to change catalog/genbki.pl as well. * ---------------- */ #define AttributeRelationId 1249 #define AttributeRelation_Rowtype_Id 75 CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BKI_SCHEMA_MACRO { Oid attrelid; /* OID of relation containing this attribute */ NameData attname; /* name of attribute */ /* * atttypid is the OID of the instance in Catalog Class pg_type that * defines the data type of this attribute (e.g. int4). Information in * that instance is redundant with the attlen, attbyval, and attalign * attributes of this instance, so they had better match or Postgres will * fail. */ Oid atttypid; /* * attstattarget is the target number of statistics datapoints to collect * during VACUUM ANALYZE of this column. A zero here indicates that we do * not wish to collect any stats about this column. A "-1" here indicates * that no value has been explicitly set for this column, so ANALYZE * should use the default setting. */ int4 attstattarget; /* * attlen is a copy of the typlen field from pg_type for this attribute. * See atttypid comments above. */ int2 attlen; /* * attnum is the "attribute number" for the attribute: A value that * uniquely identifies this attribute within its class. For user * attributes, Attribute numbers are greater than 0 and not greater than * the number of attributes in the class. I.e. if the Class pg_class says * that Class XYZ has 10 attributes, then the user attribute numbers in * Class pg_attribute must be 1-10. * * System attributes have attribute numbers less than 0 that are unique * within the class, but not constrained to any particular range. * * Note that (attnum - 1) is often used as the index to an array. */ int2 attnum; /* * attndims is the declared number of dimensions, if an array type, * otherwise zero. */ int4 attndims; /* * fastgetattr() uses attcacheoff to cache byte offsets of attributes in * heap tuples. The value actually stored in pg_attribute (-1) indicates * no cached value. But when we copy these tuples into a tuple * descriptor, we may then update attcacheoff in the copies. This speeds * up the attribute walking process. */ int4 attcacheoff; /* * atttypmod records type-specific data supplied at table creation time * (for example, the max length of a varchar field). It is passed to * type-specific input and output functions as the third argument. The * value will generally be -1 for types that do not need typmod. */ int4 atttypmod; /* * attbyval is a copy of the typbyval field from pg_type for this * attribute. See atttypid comments above. */ bool attbyval; /*---------- * attstorage tells for VARLENA attributes, what the heap access * methods can do to it if a given tuple doesn't fit into a page. * Possible values are * 'p': Value must be stored plain always * 'e': Value can be stored in "secondary" relation (if relation * has one, see pg_class.reltoastrelid) * 'm': Value can be stored compressed inline * 'x': Value can be stored compressed inline or in "secondary" * Note that 'm' fields can also be moved out to secondary storage, * but only as a last resort ('e' and 'x' fields are moved first). *---------- */ char attstorage; /* * attalign is a copy of the typalign field from pg_type for this * attribute. See atttypid comments above. */ char attalign; /* This flag represents the "NOT NULL" constraint */ bool attnotnull; /* Has DEFAULT value or not */ bool atthasdef; /* Is dropped (ie, logically invisible) or not */ bool attisdropped; /* Has a local definition (hence, do not drop when attinhcount is 0) */ bool attislocal; /* Number of times inherited from direct parent relation(s) */ int4 attinhcount; /* attribute's collation */ Oid attcollation; #ifdef CATALOG_VARLEN /* variable-length fields start here */ /* NOTE: The following fields are not present in tuple descriptors. */ /* Column-level access permissions */ aclitem attacl[1]; /* Column-level options */ text attoptions[1]; /* Column-level FDW options */ text attfdwoptions[1]; #endif } FormData_pg_attribute; /* * ATTRIBUTE_FIXED_PART_SIZE is the size of the fixed-layout, * guaranteed-not-null part of a pg_attribute row. This is in fact as much * of the row as gets copied into tuple descriptors, so don't expect you * can access fields beyond attcollation except in a real tuple! */ #define ATTRIBUTE_FIXED_PART_SIZE \ (offsetof(FormData_pg_attribute,attcollation) + sizeof(Oid)) /* ---------------- * Form_pg_attribute corresponds to a pointer to a tuple with * the format of pg_attribute relation. * ---------------- */ typedef FormData_pg_attribute *Form_pg_attribute; /* ---------------- * compiler constants for pg_attribute * ---------------- */ #define Natts_pg_attribute 21 #define Anum_pg_attribute_attrelid 1 #define Anum_pg_attribute_attname 2 #define Anum_pg_attribute_atttypid 3 #define Anum_pg_attribute_attstattarget 4 #define Anum_pg_attribute_attlen 5 #define Anum_pg_attribute_attnum 6 #define Anum_pg_attribute_attndims 7 #define Anum_pg_attribute_attcacheoff 8 #define Anum_pg_attribute_atttypmod 9 #define Anum_pg_attribute_attbyval 10 #define Anum_pg_attribute_attstorage 11 #define Anum_pg_attribute_attalign 12 #define Anum_pg_attribute_attnotnull 13 #define Anum_pg_attribute_atthasdef 14 #define Anum_pg_attribute_attisdropped 15 #define Anum_pg_attribute_attislocal 16 #define Anum_pg_attribute_attinhcount 17 #define Anum_pg_attribute_attcollation 18 #define Anum_pg_attribute_attacl 19 #define Anum_pg_attribute_attoptions 20 #define Anum_pg_attribute_attfdwoptions 21 /* ---------------- * initial contents of pg_attribute * * The initial contents of pg_attribute are generated at compile time by * genbki.pl. Only "bootstrapped" relations need be included. * ---------------- */ #endif /* PG_ATTRIBUTE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_foreign_server.h������������������������������������������������������������0000644�����������������00000003572�14763166026�0014512 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_foreign_server.h * definition of the system "foreign server" relation (pg_foreign_server) * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_foreign_server.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_FOREIGN_SERVER_H #define PG_FOREIGN_SERVER_H #include "catalog/genbki.h" /* ---------------- * pg_foreign_server definition. cpp turns this into * typedef struct FormData_pg_foreign_server * ---------------- */ #define ForeignServerRelationId 1417 CATALOG(pg_foreign_server,1417) { NameData srvname; /* foreign server name */ Oid srvowner; /* server owner */ Oid srvfdw; /* server FDW */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ text srvtype; text srvversion; aclitem srvacl[1]; /* access permissions */ text srvoptions[1]; /* FDW-specific options */ #endif } FormData_pg_foreign_server; /* ---------------- * Form_pg_foreign_server corresponds to a pointer to a tuple with * the format of pg_foreign_server relation. * ---------------- */ typedef FormData_pg_foreign_server *Form_pg_foreign_server; /* ---------------- * compiler constants for pg_foreign_server * ---------------- */ #define Natts_pg_foreign_server 7 #define Anum_pg_foreign_server_srvname 1 #define Anum_pg_foreign_server_srvowner 2 #define Anum_pg_foreign_server_srvfdw 3 #define Anum_pg_foreign_server_srvtype 4 #define Anum_pg_foreign_server_srvversion 5 #define Anum_pg_foreign_server_srvacl 6 #define Anum_pg_foreign_server_srvoptions 7 #endif /* PG_FOREIGN_SERVER_H */ ��������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_user_mapping.h��������������������������������������������������������������0000644�����������������00000003130�14763166026�0014152 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_user_mapping.h * definition of the system "user mapping" relation (pg_user_mapping) * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_user_mapping.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_USER_MAPPING_H #define PG_USER_MAPPING_H #include "catalog/genbki.h" /* ---------------- * pg_user_mapping definition. cpp turns this into * typedef struct FormData_pg_user_mapping * ---------------- */ #define UserMappingRelationId 1418 CATALOG(pg_user_mapping,1418) { Oid umuser; /* Id of the user, InvalidOid if PUBLIC is * wanted */ Oid umserver; /* server of this mapping */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ text umoptions[1]; /* user mapping options */ #endif } FormData_pg_user_mapping; /* ---------------- * Form_pg_user_mapping corresponds to a pointer to a tuple with * the format of pg_user_mapping relation. * ---------------- */ typedef FormData_pg_user_mapping *Form_pg_user_mapping; /* ---------------- * compiler constants for pg_user_mapping * ---------------- */ #define Natts_pg_user_mapping 3 #define Anum_pg_user_mapping_umuser 1 #define Anum_pg_user_mapping_umserver 2 #define Anum_pg_user_mapping_umoptions 3 #endif /* PG_USER_MAPPING_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_shdescription.h�������������������������������������������������������������0000644�����������������00000004620�14763166026�0014344 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_shdescription.h * definition of the system "shared description" relation * (pg_shdescription) * * NOTE: an object is identified by the OID of the row that primarily * defines the object, plus the OID of the table that that row appears in. * For example, a database is identified by the OID of its pg_database row * plus the pg_class OID of table pg_database. This allows unique * identification of objects without assuming that OIDs are unique * across tables. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_shdescription.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * * XXX do NOT break up DATA() statements into multiple lines! * the scripts are not as smart as you might think... * *------------------------------------------------------------------------- */ #ifndef PG_SHDESCRIPTION_H #define PG_SHDESCRIPTION_H #include "catalog/genbki.h" /* ---------------- * pg_shdescription definition. cpp turns this into * typedef struct FormData_pg_shdescription * ---------------- */ #define SharedDescriptionRelationId 2396 CATALOG(pg_shdescription,2396) BKI_SHARED_RELATION BKI_WITHOUT_OIDS { Oid objoid; /* OID of object itself */ Oid classoid; /* OID of table containing object */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ text description; /* description of object */ #endif } FormData_pg_shdescription; /* ---------------- * Form_pg_shdescription corresponds to a pointer to a tuple with * the format of pg_shdescription relation. * ---------------- */ typedef FormData_pg_shdescription *Form_pg_shdescription; /* ---------------- * compiler constants for pg_shdescription * ---------------- */ #define Natts_pg_shdescription 3 #define Anum_pg_shdescription_objoid 1 #define Anum_pg_shdescription_classoid 2 #define Anum_pg_shdescription_description 3 /* ---------------- * initial contents of pg_shdescription * ---------------- */ /* * Because the contents of this table are taken from the other *.h files, * there is no initialization here. The initial contents are extracted * by genbki.pl and loaded during initdb. */ #endif /* PG_SHDESCRIPTION_H */ ����������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_largeobject_metadata.h������������������������������������������������������0000644�����������������00000003262�14763166026�0015610 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_largeobject_metadata.h * definition of the system "largeobject_metadata" relation (pg_largeobject_metadata) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_largeobject_metadata.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_LARGEOBJECT_METADATA_H #define PG_LARGEOBJECT_METADATA_H #include "catalog/genbki.h" /* ---------------- * pg_largeobject_metadata definition. cpp turns this into * typedef struct FormData_pg_largeobject_metadata * ---------------- */ #define LargeObjectMetadataRelationId 2995 CATALOG(pg_largeobject_metadata,2995) { Oid lomowner; /* OID of the largeobject owner */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ aclitem lomacl[1]; /* access permissions */ #endif } FormData_pg_largeobject_metadata; /* ---------------- * Form_pg_largeobject_metadata corresponds to a pointer to a tuple * with the format of pg_largeobject_metadata relation. * ---------------- */ typedef FormData_pg_largeobject_metadata *Form_pg_largeobject_metadata; /* ---------------- * compiler constants for pg_largeobject_metadata * ---------------- */ #define Natts_pg_largeobject_metadata 2 #define Anum_pg_largeobject_metadata_lomowner 1 #define Anum_pg_largeobject_metadata_lomacl 2 #endif /* PG_LARGEOBJECT_METADATA_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_extension.h�����������������������������������������������������������������0000644�����������������00000004130�14763166026�0013476 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_extension.h * definition of the system "extension" relation (pg_extension) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_extension.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_EXTENSION_H #define PG_EXTENSION_H #include "catalog/genbki.h" /* ---------------- * pg_extension definition. cpp turns this into * typedef struct FormData_pg_extension * ---------------- */ #define ExtensionRelationId 3079 CATALOG(pg_extension,3079) { NameData extname; /* extension name */ Oid extowner; /* extension owner */ Oid extnamespace; /* namespace of contained objects */ bool extrelocatable; /* if true, allow ALTER EXTENSION SET SCHEMA */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ /* extversion should never be null, but the others can be. */ text extversion; /* extension version name */ Oid extconfig[1]; /* dumpable configuration tables */ text extcondition[1]; /* WHERE clauses for config tables */ #endif } FormData_pg_extension; /* ---------------- * Form_pg_extension corresponds to a pointer to a tuple with * the format of pg_extension relation. * ---------------- */ typedef FormData_pg_extension *Form_pg_extension; /* ---------------- * compiler constants for pg_extension * ---------------- */ #define Natts_pg_extension 7 #define Anum_pg_extension_extname 1 #define Anum_pg_extension_extowner 2 #define Anum_pg_extension_extnamespace 3 #define Anum_pg_extension_extrelocatable 4 #define Anum_pg_extension_extversion 5 #define Anum_pg_extension_extconfig 6 #define Anum_pg_extension_extcondition 7 /* ---------------- * pg_extension has no initial contents * ---------------- */ #endif /* PG_EXTENSION_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_statistic.h�����������������������������������������������������������������0000644�����������������00000026305�14763166026�0013501 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_statistic.h * definition of the system "statistic" relation (pg_statistic) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_statistic.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_STATISTIC_H #define PG_STATISTIC_H #include "catalog/genbki.h" /* ---------------- * pg_statistic definition. cpp turns this into * typedef struct FormData_pg_statistic * ---------------- */ #define StatisticRelationId 2619 CATALOG(pg_statistic,2619) BKI_WITHOUT_OIDS { /* These fields form the unique key for the entry: */ Oid starelid; /* relation containing attribute */ int2 staattnum; /* attribute (column) stats are for */ bool stainherit; /* true if inheritance children are included */ /* the fraction of the column's entries that are NULL: */ float4 stanullfrac; /* * stawidth is the average width in bytes of non-null entries. For * fixed-width datatypes this is of course the same as the typlen, but for * var-width types it is more useful. Note that this is the average width * of the data as actually stored, post-TOASTing (eg, for a * moved-out-of-line value, only the size of the pointer object is * counted). This is the appropriate definition for the primary use of * the statistic, which is to estimate sizes of in-memory hash tables of * tuples. */ int4 stawidth; /* ---------------- * stadistinct indicates the (approximate) number of distinct non-null * data values in the column. The interpretation is: * 0 unknown or not computed * > 0 actual number of distinct values * < 0 negative of multiplier for number of rows * The special negative case allows us to cope with columns that are * unique (stadistinct = -1) or nearly so (for example, a column in which * non-null values appear about twice on the average could be represented * by stadistinct = -0.5 if there are no nulls, or -0.4 if 20% of the * column is nulls). Because the number-of-rows statistic in pg_class may * be updated more frequently than pg_statistic is, it's important to be * able to describe such situations as a multiple of the number of rows, * rather than a fixed number of distinct values. But in other cases a * fixed number is correct (eg, a boolean column). * ---------------- */ float4 stadistinct; /* ---------------- * To allow keeping statistics on different kinds of datatypes, * we do not hard-wire any particular meaning for the remaining * statistical fields. Instead, we provide several "slots" in which * statistical data can be placed. Each slot includes: * kind integer code identifying kind of data (see below) * op OID of associated operator, if needed * numbers float4 array (for statistical values) * values anyarray (for representations of data values) * The ID and operator fields are never NULL; they are zeroes in an * unused slot. The numbers and values fields are NULL in an unused * slot, and might also be NULL in a used slot if the slot kind has * no need for one or the other. * ---------------- */ int2 stakind1; int2 stakind2; int2 stakind3; int2 stakind4; int2 stakind5; Oid staop1; Oid staop2; Oid staop3; Oid staop4; Oid staop5; #ifdef CATALOG_VARLEN /* variable-length fields start here */ float4 stanumbers1[1]; float4 stanumbers2[1]; float4 stanumbers3[1]; float4 stanumbers4[1]; float4 stanumbers5[1]; /* * Values in these arrays are values of the column's data type, or of some * related type such as an array element type. We presently have to cheat * quite a bit to allow polymorphic arrays of this kind, but perhaps * someday it'll be a less bogus facility. */ anyarray stavalues1; anyarray stavalues2; anyarray stavalues3; anyarray stavalues4; anyarray stavalues5; #endif } FormData_pg_statistic; #define STATISTIC_NUM_SLOTS 5 /* ---------------- * Form_pg_statistic corresponds to a pointer to a tuple with * the format of pg_statistic relation. * ---------------- */ typedef FormData_pg_statistic *Form_pg_statistic; /* ---------------- * compiler constants for pg_statistic * ---------------- */ #define Natts_pg_statistic 26 #define Anum_pg_statistic_starelid 1 #define Anum_pg_statistic_staattnum 2 #define Anum_pg_statistic_stainherit 3 #define Anum_pg_statistic_stanullfrac 4 #define Anum_pg_statistic_stawidth 5 #define Anum_pg_statistic_stadistinct 6 #define Anum_pg_statistic_stakind1 7 #define Anum_pg_statistic_stakind2 8 #define Anum_pg_statistic_stakind3 9 #define Anum_pg_statistic_stakind4 10 #define Anum_pg_statistic_stakind5 11 #define Anum_pg_statistic_staop1 12 #define Anum_pg_statistic_staop2 13 #define Anum_pg_statistic_staop3 14 #define Anum_pg_statistic_staop4 15 #define Anum_pg_statistic_staop5 16 #define Anum_pg_statistic_stanumbers1 17 #define Anum_pg_statistic_stanumbers2 18 #define Anum_pg_statistic_stanumbers3 19 #define Anum_pg_statistic_stanumbers4 20 #define Anum_pg_statistic_stanumbers5 21 #define Anum_pg_statistic_stavalues1 22 #define Anum_pg_statistic_stavalues2 23 #define Anum_pg_statistic_stavalues3 24 #define Anum_pg_statistic_stavalues4 25 #define Anum_pg_statistic_stavalues5 26 /* * Currently, five statistical slot "kinds" are defined by core PostgreSQL, * as documented below. Additional "kinds" will probably appear in * future to help cope with non-scalar datatypes. Also, custom data types * can define their own "kind" codes by mutual agreement between a custom * typanalyze routine and the selectivity estimation functions of the type's * operators. * * Code reading the pg_statistic relation should not assume that a particular * data "kind" will appear in any particular slot. Instead, search the * stakind fields to see if the desired data is available. (The standard * function get_attstatsslot() may be used for this.) */ /* * The present allocation of "kind" codes is: * * 1-99: reserved for assignment by the core PostgreSQL project * (values in this range will be documented in this file) * 100-199: reserved for assignment by the PostGIS project * (values to be documented in PostGIS documentation) * 200-299: reserved for assignment by the ESRI ST_Geometry project * (values to be documented in ESRI ST_Geometry documentation) * 300-9999: reserved for future public assignments * * For private use you may choose a "kind" code at random in the range * 10000-30000. However, for code that is to be widely disseminated it is * better to obtain a publicly defined "kind" code by request from the * PostgreSQL Global Development Group. */ /* * In a "most common values" slot, staop is the OID of the "=" operator * used to decide whether values are the same or not. stavalues contains * the K most common non-null values appearing in the column, and stanumbers * contains their frequencies (fractions of total row count). The values * shall be ordered in decreasing frequency. Note that since the arrays are * variable-size, K may be chosen by the statistics collector. Values should * not appear in MCV unless they have been observed to occur more than once; * a unique column will have no MCV slot. */ #define STATISTIC_KIND_MCV 1 /* * A "histogram" slot describes the distribution of scalar data. staop is * the OID of the "<" operator that describes the sort ordering. (In theory, * more than one histogram could appear, if a datatype has more than one * useful sort operator.) stavalues contains M (>=2) non-null values that * divide the non-null column data values into M-1 bins of approximately equal * population. The first stavalues item is the MIN and the last is the MAX. * stanumbers is not used and should be NULL. IMPORTANT POINT: if an MCV * slot is also provided, then the histogram describes the data distribution * *after removing the values listed in MCV* (thus, it's a "compressed * histogram" in the technical parlance). This allows a more accurate * representation of the distribution of a column with some very-common * values. In a column with only a few distinct values, it's possible that * the MCV list describes the entire data population; in this case the * histogram reduces to empty and should be omitted. */ #define STATISTIC_KIND_HISTOGRAM 2 /* * A "correlation" slot describes the correlation between the physical order * of table tuples and the ordering of data values of this column, as seen * by the "<" operator identified by staop. (As with the histogram, more * than one entry could theoretically appear.) stavalues is not used and * should be NULL. stanumbers contains a single entry, the correlation * coefficient between the sequence of data values and the sequence of * their actual tuple positions. The coefficient ranges from +1 to -1. */ #define STATISTIC_KIND_CORRELATION 3 /* * A "most common elements" slot is similar to a "most common values" slot, * except that it stores the most common non-null *elements* of the column * values. This is useful when the column datatype is an array or some other * type with identifiable elements (for instance, tsvector). staop contains * the equality operator appropriate to the element type. stavalues contains * the most common element values, and stanumbers their frequencies. Unlike * MCV slots, frequencies are measured as the fraction of non-null rows the * element value appears in, not the frequency of all rows. Also unlike * MCV slots, the values are sorted into the element type's default order * (to support binary search for a particular value). Since this puts the * minimum and maximum frequencies at unpredictable spots in stanumbers, * there are two extra members of stanumbers, holding copies of the minimum * and maximum frequencies. Optionally, there can be a third extra member, * which holds the frequency of null elements (expressed in the same terms: * the fraction of non-null rows that contain at least one null element). If * this member is omitted, the column is presumed to contain no null elements. * * Note: in current usage for tsvector columns, the stavalues elements are of * type text, even though their representation within tsvector is not * exactly text. */ #define STATISTIC_KIND_MCELEM 4 /* * A "distinct elements count histogram" slot describes the distribution of * the number of distinct element values present in each row of an array-type * column. Only non-null rows are considered, and only non-null elements. * staop contains the equality operator appropriate to the element type. * stavalues is not used and should be NULL. The last member of stanumbers is * the average count of distinct element values over all non-null rows. The * preceding M (>=2) members form a histogram that divides the population of * distinct-elements counts into M-1 bins of approximately equal population. * The first of these is the minimum observed count, and the last the maximum. */ #define STATISTIC_KIND_DECHIST 5 #endif /* PG_STATISTIC_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/storage.h����������������������������������������������������������������������0000644�����������������00000002526�14763166026�0012447 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * storage.h * prototypes for functions in backend/catalog/storage.c * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/storage.h * *------------------------------------------------------------------------- */ #ifndef STORAGE_H #define STORAGE_H #include "access/xlog.h" #include "storage/block.h" #include "storage/relfilenode.h" #include "utils/relcache.h" extern void RelationCreateStorage(RelFileNode rnode, char relpersistence); extern void RelationDropStorage(Relation rel); extern void RelationPreserveStorage(RelFileNode rnode, bool atCommit); extern void RelationTruncate(Relation rel, BlockNumber nblocks); /* * These functions used to be in storage/smgr/smgr.c, which explains the * naming */ extern void smgrDoPendingDeletes(bool isCommit); extern int smgrGetPendingDeletes(bool forCommit, RelFileNode **ptr); extern void AtSubCommit_smgr(void); extern void AtSubAbort_smgr(void); extern void PostPrepare_smgr(void); extern void log_smgrcreate(RelFileNode *rnode, ForkNumber forkNum); extern void smgr_redo(XLogRecPtr lsn, XLogRecord *record); extern void smgr_desc(StringInfo buf, uint8 xl_info, char *rec); #endif /* STORAGE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_db_role_setting.h�����������������������������������������������������������0000644�����������������00000003731�14763166026�0014633 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_db_role_setting.h * definition of configuration settings * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_db_role_setting.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * * XXX do NOT break up DATA() statements into multiple lines! * the scripts are not as smart as you might think... * *------------------------------------------------------------------------- */ #ifndef PG_DB_ROLE_SETTING_H #define PG_DB_ROLE_SETTING_H #include "utils/guc.h" #include "utils/relcache.h" /* ---------------- * pg_db_role_setting definition. cpp turns this into * typedef struct FormData_pg_db_role_setting * ---------------- */ #define DbRoleSettingRelationId 2964 CATALOG(pg_db_role_setting,2964) BKI_SHARED_RELATION BKI_WITHOUT_OIDS { Oid setdatabase; /* database */ Oid setrole; /* role */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ text setconfig[1]; /* GUC settings to apply at login */ #endif } FormData_pg_db_role_setting; typedef FormData_pg_db_role_setting *Form_pg_db_role_setting; /* ---------------- * compiler constants for pg_db_role_setting * ---------------- */ #define Natts_pg_db_role_setting 3 #define Anum_pg_db_role_setting_setdatabase 1 #define Anum_pg_db_role_setting_setrole 2 #define Anum_pg_db_role_setting_setconfig 3 /* ---------------- * initial contents of pg_db_role_setting are NOTHING * ---------------- */ /* * prototypes for functions in pg_db_role_setting.h */ extern void AlterSetting(Oid databaseid, Oid roleid, VariableSetStmt *setstmt); extern void DropSetting(Oid databaseid, Oid roleid); extern void ApplySetting(Oid databaseid, Oid roleid, Relation relsetting, GucSource source); #endif /* PG_DB_ROLE_SETTING_H */ ���������������������������������������pgsql/server/catalog/pg_enum.h����������������������������������������������������������������������0000644�����������������00000003503�14763166026�0012431 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_enum.h * definition of the system "enum" relation (pg_enum) * along with the relation's initial contents. * * * Copyright (c) 2006-2012, PostgreSQL Global Development Group * * src/include/catalog/pg_enum.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * * XXX do NOT break up DATA() statements into multiple lines! * the scripts are not as smart as you might think... * *------------------------------------------------------------------------- */ #ifndef PG_ENUM_H #define PG_ENUM_H #include "catalog/genbki.h" #include "nodes/pg_list.h" /* ---------------- * pg_enum definition. cpp turns this into * typedef struct FormData_pg_enum * ---------------- */ #define EnumRelationId 3501 CATALOG(pg_enum,3501) { Oid enumtypid; /* OID of owning enum type */ float4 enumsortorder; /* sort position of this enum value */ NameData enumlabel; /* text representation of enum value */ } FormData_pg_enum; /* ---------------- * Form_pg_enum corresponds to a pointer to a tuple with * the format of pg_enum relation. * ---------------- */ typedef FormData_pg_enum *Form_pg_enum; /* ---------------- * compiler constants for pg_enum * ---------------- */ #define Natts_pg_enum 3 #define Anum_pg_enum_enumtypid 1 #define Anum_pg_enum_enumsortorder 2 #define Anum_pg_enum_enumlabel 3 /* ---------------- * pg_enum has no initial contents * ---------------- */ /* * prototypes for functions in pg_enum.c */ extern void EnumValuesCreate(Oid enumTypeOid, List *vals); extern void EnumValuesDelete(Oid enumTypeOid); extern void AddEnumLabel(Oid enumTypeOid, const char *newVal, const char *neighbor, bool newValIsAfter); #endif /* PG_ENUM_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/objectaccess.h�����������������������������������������������������������������0000644�����������������00000003166�14763166026�0013434 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * objectaccess.h * * Object access hooks. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California */ #ifndef OBJECTACCESS_H #define OBJECTACCESS_H /* * Object access hooks are intended to be called just before or just after * performing certain actions on a SQL object. This is intended as * infrastructure for security or logging pluggins. * * OAT_POST_CREATE should be invoked just after the object is created. * Typically, this is done after inserting the primary catalog records and * associated dependencies. * * OAT_DROP should be invoked just before deletion of objects; typically * deleteOneObject(). Its arguments are packed within ObjectAccessDrop. * * Other types may be added in the future. */ typedef enum ObjectAccessType { OAT_POST_CREATE, OAT_DROP } ObjectAccessType; /* * Arguments of OAT_DROP event */ typedef struct { /* * Flags to inform extensions the context of this deletion. Also see * PERFORM_DELETION_* in dependency.h */ int dropflags; } ObjectAccessDrop; /* * Hook, and a macro to invoke it. */ typedef void (*object_access_hook_type) (ObjectAccessType access, Oid classId, Oid objectId, int subId, void *arg); extern PGDLLIMPORT object_access_hook_type object_access_hook; #define InvokeObjectAccessHook(access,classId,objectId,subId,arg) \ do { \ if (object_access_hook) \ (*object_access_hook)((access),(classId), \ (objectId),(subId),(arg)); \ } while(0) #endif /* OBJECTACCESS_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_proc_fn.h�������������������������������������������������������������������0000644�����������������00000002221�14763166026�0013107 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_proc_fn.h * prototypes for functions in catalog/pg_proc.c * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_proc_fn.h * *------------------------------------------------------------------------- */ #ifndef PG_PROC_FN_H #define PG_PROC_FN_H #include "nodes/pg_list.h" extern Oid ProcedureCreate(const char *procedureName, Oid procNamespace, bool replace, bool returnsSet, Oid returnType, Oid proowner, Oid languageObjectId, Oid languageValidator, const char *prosrc, const char *probin, bool isAgg, bool isWindowFunc, bool security_definer, bool isLeakProof, bool isStrict, char volatility, oidvector *parameterTypes, Datum allParameterTypes, Datum parameterModes, Datum parameterNames, List *parameterDefaults, Datum proconfig, float4 procost, float4 prorows); extern bool function_parse_error_transpose(const char *prosrc); #endif /* PG_PROC_FN_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_tablespace.h����������������������������������������������������������������0000644�����������������00000003543�14763166026�0013574 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_tablespace.h * definition of the system "tablespace" relation (pg_tablespace) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_tablespace.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_TABLESPACE_H #define PG_TABLESPACE_H #include "catalog/genbki.h" /* ---------------- * pg_tablespace definition. cpp turns this into * typedef struct FormData_pg_tablespace * ---------------- */ #define TableSpaceRelationId 1213 CATALOG(pg_tablespace,1213) BKI_SHARED_RELATION { NameData spcname; /* tablespace name */ Oid spcowner; /* owner of tablespace */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ aclitem spcacl[1]; /* access permissions */ text spcoptions[1]; /* per-tablespace options */ #endif } FormData_pg_tablespace; /* ---------------- * Form_pg_tablespace corresponds to a pointer to a tuple with * the format of pg_tablespace relation. * ---------------- */ typedef FormData_pg_tablespace *Form_pg_tablespace; /* ---------------- * compiler constants for pg_tablespace * ---------------- */ #define Natts_pg_tablespace 4 #define Anum_pg_tablespace_spcname 1 #define Anum_pg_tablespace_spcowner 2 #define Anum_pg_tablespace_spcacl 3 #define Anum_pg_tablespace_spcoptions 4 DATA(insert OID = 1663 ( pg_default PGUID _null_ _null_ )); DATA(insert OID = 1664 ( pg_global PGUID _null_ _null_ )); #define DEFAULTTABLESPACE_OID 1663 #define GLOBALTABLESPACE_OID 1664 #endif /* PG_TABLESPACE_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_depend.h��������������������������������������������������������������������0000644�����������������00000005354�14763166026�0012732 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_depend.h * definition of the system "dependency" relation (pg_depend) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_depend.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_DEPEND_H #define PG_DEPEND_H #include "catalog/genbki.h" /* ---------------- * pg_depend definition. cpp turns this into * typedef struct FormData_pg_depend * ---------------- */ #define DependRelationId 2608 CATALOG(pg_depend,2608) BKI_WITHOUT_OIDS { /* * Identification of the dependent (referencing) object. * * These fields are all zeroes for a DEPENDENCY_PIN entry. */ Oid classid; /* OID of table containing object */ Oid objid; /* OID of object itself */ int4 objsubid; /* column number, or 0 if not used */ /* * Identification of the independent (referenced) object. */ Oid refclassid; /* OID of table containing object */ Oid refobjid; /* OID of object itself */ int4 refobjsubid; /* column number, or 0 if not used */ /* * Precise semantics of the relationship are specified by the deptype * field. See DependencyType in catalog/dependency.h. */ char deptype; /* see codes in dependency.h */ } FormData_pg_depend; /* ---------------- * Form_pg_depend corresponds to a pointer to a row with * the format of pg_depend relation. * ---------------- */ typedef FormData_pg_depend *Form_pg_depend; /* ---------------- * compiler constants for pg_depend * ---------------- */ #define Natts_pg_depend 7 #define Anum_pg_depend_classid 1 #define Anum_pg_depend_objid 2 #define Anum_pg_depend_objsubid 3 #define Anum_pg_depend_refclassid 4 #define Anum_pg_depend_refobjid 5 #define Anum_pg_depend_refobjsubid 6 #define Anum_pg_depend_deptype 7 /* * pg_depend has no preloaded contents; system-defined dependencies are * loaded into it during a late stage of the initdb process. * * NOTE: we do not represent all possible dependency pairs in pg_depend; * for example, there's not much value in creating an explicit dependency * from an attribute to its relation. Usually we make a dependency for * cases where the relationship is conditional rather than essential * (for example, not all triggers are dependent on constraints, but all * attributes are dependent on relations) or where the dependency is not * convenient to find from the contents of other catalogs. */ #endif /* PG_DEPEND_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_opfamily.h������������������������������������������������������������������0000644�����������������00000014535�14763166026�0013314 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_opfamily.h * definition of the system "opfamily" relation (pg_opfamily) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_opfamily.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_OPFAMILY_H #define PG_OPFAMILY_H #include "catalog/genbki.h" /* ---------------- * pg_opfamily definition. cpp turns this into * typedef struct FormData_pg_opfamily * ---------------- */ #define OperatorFamilyRelationId 2753 CATALOG(pg_opfamily,2753) { Oid opfmethod; /* index access method opfamily is for */ NameData opfname; /* name of this opfamily */ Oid opfnamespace; /* namespace of this opfamily */ Oid opfowner; /* opfamily owner */ } FormData_pg_opfamily; /* ---------------- * Form_pg_opfamily corresponds to a pointer to a tuple with * the format of pg_opfamily relation. * ---------------- */ typedef FormData_pg_opfamily *Form_pg_opfamily; /* ---------------- * compiler constants for pg_opfamily * ---------------- */ #define Natts_pg_opfamily 4 #define Anum_pg_opfamily_opfmethod 1 #define Anum_pg_opfamily_opfname 2 #define Anum_pg_opfamily_opfnamespace 3 #define Anum_pg_opfamily_opfowner 4 /* ---------------- * initial contents of pg_opfamily * ---------------- */ DATA(insert OID = 421 ( 403 abstime_ops PGNSP PGUID )); DATA(insert OID = 397 ( 403 array_ops PGNSP PGUID )); DATA(insert OID = 627 ( 405 array_ops PGNSP PGUID )); DATA(insert OID = 423 ( 403 bit_ops PGNSP PGUID )); DATA(insert OID = 424 ( 403 bool_ops PGNSP PGUID )); #define BOOL_BTREE_FAM_OID 424 DATA(insert OID = 426 ( 403 bpchar_ops PGNSP PGUID )); #define BPCHAR_BTREE_FAM_OID 426 DATA(insert OID = 427 ( 405 bpchar_ops PGNSP PGUID )); DATA(insert OID = 428 ( 403 bytea_ops PGNSP PGUID )); #define BYTEA_BTREE_FAM_OID 428 DATA(insert OID = 429 ( 403 char_ops PGNSP PGUID )); DATA(insert OID = 431 ( 405 char_ops PGNSP PGUID )); DATA(insert OID = 434 ( 403 datetime_ops PGNSP PGUID )); DATA(insert OID = 435 ( 405 date_ops PGNSP PGUID )); DATA(insert OID = 1970 ( 403 float_ops PGNSP PGUID )); DATA(insert OID = 1971 ( 405 float_ops PGNSP PGUID )); DATA(insert OID = 1974 ( 403 network_ops PGNSP PGUID )); #define NETWORK_BTREE_FAM_OID 1974 DATA(insert OID = 1975 ( 405 network_ops PGNSP PGUID )); DATA(insert OID = 1976 ( 403 integer_ops PGNSP PGUID )); #define INTEGER_BTREE_FAM_OID 1976 DATA(insert OID = 1977 ( 405 integer_ops PGNSP PGUID )); DATA(insert OID = 1982 ( 403 interval_ops PGNSP PGUID )); DATA(insert OID = 1983 ( 405 interval_ops PGNSP PGUID )); DATA(insert OID = 1984 ( 403 macaddr_ops PGNSP PGUID )); DATA(insert OID = 1985 ( 405 macaddr_ops PGNSP PGUID )); DATA(insert OID = 1986 ( 403 name_ops PGNSP PGUID )); #define NAME_BTREE_FAM_OID 1986 DATA(insert OID = 1987 ( 405 name_ops PGNSP PGUID )); DATA(insert OID = 1988 ( 403 numeric_ops PGNSP PGUID )); DATA(insert OID = 1998 ( 405 numeric_ops PGNSP PGUID )); DATA(insert OID = 1989 ( 403 oid_ops PGNSP PGUID )); #define OID_BTREE_FAM_OID 1989 DATA(insert OID = 1990 ( 405 oid_ops PGNSP PGUID )); DATA(insert OID = 1991 ( 403 oidvector_ops PGNSP PGUID )); DATA(insert OID = 1992 ( 405 oidvector_ops PGNSP PGUID )); DATA(insert OID = 2994 ( 403 record_ops PGNSP PGUID )); DATA(insert OID = 1994 ( 403 text_ops PGNSP PGUID )); #define TEXT_BTREE_FAM_OID 1994 DATA(insert OID = 1995 ( 405 text_ops PGNSP PGUID )); DATA(insert OID = 1996 ( 403 time_ops PGNSP PGUID )); DATA(insert OID = 1997 ( 405 time_ops PGNSP PGUID )); DATA(insert OID = 1999 ( 405 timestamptz_ops PGNSP PGUID )); DATA(insert OID = 2000 ( 403 timetz_ops PGNSP PGUID )); DATA(insert OID = 2001 ( 405 timetz_ops PGNSP PGUID )); DATA(insert OID = 2002 ( 403 varbit_ops PGNSP PGUID )); DATA(insert OID = 2040 ( 405 timestamp_ops PGNSP PGUID )); DATA(insert OID = 2095 ( 403 text_pattern_ops PGNSP PGUID )); #define TEXT_PATTERN_BTREE_FAM_OID 2095 DATA(insert OID = 2097 ( 403 bpchar_pattern_ops PGNSP PGUID )); #define BPCHAR_PATTERN_BTREE_FAM_OID 2097 DATA(insert OID = 2099 ( 403 money_ops PGNSP PGUID )); DATA(insert OID = 2222 ( 405 bool_ops PGNSP PGUID )); #define BOOL_HASH_FAM_OID 2222 DATA(insert OID = 2223 ( 405 bytea_ops PGNSP PGUID )); DATA(insert OID = 2224 ( 405 int2vector_ops PGNSP PGUID )); DATA(insert OID = 2789 ( 403 tid_ops PGNSP PGUID )); DATA(insert OID = 2225 ( 405 xid_ops PGNSP PGUID )); DATA(insert OID = 2226 ( 405 cid_ops PGNSP PGUID )); DATA(insert OID = 2227 ( 405 abstime_ops PGNSP PGUID )); DATA(insert OID = 2228 ( 405 reltime_ops PGNSP PGUID )); DATA(insert OID = 2229 ( 405 text_pattern_ops PGNSP PGUID )); DATA(insert OID = 2231 ( 405 bpchar_pattern_ops PGNSP PGUID )); DATA(insert OID = 2233 ( 403 reltime_ops PGNSP PGUID )); DATA(insert OID = 2234 ( 403 tinterval_ops PGNSP PGUID )); DATA(insert OID = 2235 ( 405 aclitem_ops PGNSP PGUID )); DATA(insert OID = 2593 ( 783 box_ops PGNSP PGUID )); DATA(insert OID = 2594 ( 783 poly_ops PGNSP PGUID )); DATA(insert OID = 2595 ( 783 circle_ops PGNSP PGUID )); DATA(insert OID = 1029 ( 783 point_ops PGNSP PGUID )); DATA(insert OID = 2745 ( 2742 array_ops PGNSP PGUID )); DATA(insert OID = 2968 ( 403 uuid_ops PGNSP PGUID )); DATA(insert OID = 2969 ( 405 uuid_ops PGNSP PGUID )); DATA(insert OID = 3522 ( 403 enum_ops PGNSP PGUID )); DATA(insert OID = 3523 ( 405 enum_ops PGNSP PGUID )); DATA(insert OID = 3626 ( 403 tsvector_ops PGNSP PGUID )); DATA(insert OID = 3655 ( 783 tsvector_ops PGNSP PGUID )); DATA(insert OID = 3659 ( 2742 tsvector_ops PGNSP PGUID )); DATA(insert OID = 3683 ( 403 tsquery_ops PGNSP PGUID )); DATA(insert OID = 3702 ( 783 tsquery_ops PGNSP PGUID )); DATA(insert OID = 3901 ( 403 range_ops PGNSP PGUID )); DATA(insert OID = 3903 ( 405 range_ops PGNSP PGUID )); DATA(insert OID = 3919 ( 783 range_ops PGNSP PGUID )); DATA(insert OID = 4015 ( 4000 quad_point_ops PGNSP PGUID )); DATA(insert OID = 4016 ( 4000 kd_point_ops PGNSP PGUID )); DATA(insert OID = 4017 ( 4000 text_ops PGNSP PGUID )); #define TEXT_SPGIST_FAM_OID 4017 #endif /* PG_OPFAMILY_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_namespace.h�����������������������������������������������������������������0000644�����������������00000004352�14763166026�0013424 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_namespace.h * definition of the system "namespace" relation (pg_namespace) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_namespace.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_NAMESPACE_H #define PG_NAMESPACE_H #include "catalog/genbki.h" /* ---------------------------------------------------------------- * pg_namespace definition. * * cpp turns this into typedef struct FormData_pg_namespace * * nspname name of the namespace * nspowner owner (creator) of the namespace * nspacl access privilege list * ---------------------------------------------------------------- */ #define NamespaceRelationId 2615 CATALOG(pg_namespace,2615) { NameData nspname; Oid nspowner; #ifdef CATALOG_VARLEN /* variable-length fields start here */ aclitem nspacl[1]; #endif } FormData_pg_namespace; /* ---------------- * Form_pg_namespace corresponds to a pointer to a tuple with * the format of pg_namespace relation. * ---------------- */ typedef FormData_pg_namespace *Form_pg_namespace; /* ---------------- * compiler constants for pg_namespace * ---------------- */ #define Natts_pg_namespace 3 #define Anum_pg_namespace_nspname 1 #define Anum_pg_namespace_nspowner 2 #define Anum_pg_namespace_nspacl 3 /* ---------------- * initial contents of pg_namespace * --------------- */ DATA(insert OID = 11 ( "pg_catalog" PGUID _null_ )); DESCR("system catalog schema"); #define PG_CATALOG_NAMESPACE 11 DATA(insert OID = 99 ( "pg_toast" PGUID _null_ )); DESCR("reserved schema for TOAST tables"); #define PG_TOAST_NAMESPACE 99 DATA(insert OID = 2200 ( "public" PGUID _null_ )); DESCR("standard public schema"); #define PG_PUBLIC_NAMESPACE 2200 /* * prototypes for functions in pg_namespace.c */ extern Oid NamespaceCreate(const char *nspName, Oid ownerId, bool isTemp); #endif /* PG_NAMESPACE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_attrdef.h�������������������������������������������������������������������0000644�����������������00000003207�14763166026�0013117 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_attrdef.h * definition of the system "attribute defaults" relation (pg_attrdef) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_attrdef.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_ATTRDEF_H #define PG_ATTRDEF_H #include "catalog/genbki.h" /* ---------------- * pg_attrdef definition. cpp turns this into * typedef struct FormData_pg_attrdef * ---------------- */ #define AttrDefaultRelationId 2604 CATALOG(pg_attrdef,2604) { Oid adrelid; /* OID of table containing attribute */ int2 adnum; /* attnum of attribute */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ pg_node_tree adbin; /* nodeToString representation of default */ text adsrc; /* human-readable representation of default */ #endif } FormData_pg_attrdef; /* ---------------- * Form_pg_attrdef corresponds to a pointer to a tuple with * the format of pg_attrdef relation. * ---------------- */ typedef FormData_pg_attrdef *Form_pg_attrdef; /* ---------------- * compiler constants for pg_attrdef * ---------------- */ #define Natts_pg_attrdef 4 #define Anum_pg_attrdef_adrelid 1 #define Anum_pg_attrdef_adnum 2 #define Anum_pg_attrdef_adbin 3 #define Anum_pg_attrdef_adsrc 4 #endif /* PG_ATTRDEF_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_amop.h����������������������������������������������������������������������0000644�����������������00000061024�14763166026�0012423 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_amop.h * definition of the system "amop" relation (pg_amop) * along with the relation's initial contents. * * The amop table identifies the operators associated with each index operator * family and operator class (classes are subsets of families). An associated * operator can be either a search operator or an ordering operator, as * identified by amoppurpose. * * The primary key for this table is <amopfamily, amoplefttype, amoprighttype, * amopstrategy>. amoplefttype and amoprighttype are just copies of the * operator's oprleft/oprright, ie its declared input data types. The * "default" operators for a particular opclass within the family are those * with amoplefttype = amoprighttype = opclass's opcintype. An opfamily may * also contain other operators, typically cross-data-type operators. All the * operators within a family are supposed to be compatible, in a way that is * defined by each individual index AM. * * We also keep a unique index on <amopopr, amoppurpose, amopfamily>, so that * we can use a syscache to quickly answer questions of the form "is this * operator in this opfamily, and if so what are its semantics with respect to * the family?" This implies that the same operator cannot be listed for * multiple strategy numbers within a single opfamily, with the exception that * it's possible to list it for both search and ordering purposes (with * different strategy numbers for the two purposes). * * amopmethod is a copy of the owning opfamily's opfmethod field. This is an * intentional denormalization of the catalogs to buy lookup speed. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_amop.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_AMOP_H #define PG_AMOP_H #include "catalog/genbki.h" /* ---------------- * pg_amop definition. cpp turns this into * typedef struct FormData_pg_amop * ---------------- */ #define AccessMethodOperatorRelationId 2602 CATALOG(pg_amop,2602) { Oid amopfamily; /* the index opfamily this entry is for */ Oid amoplefttype; /* operator's left input data type */ Oid amoprighttype; /* operator's right input data type */ int2 amopstrategy; /* operator strategy number */ char amoppurpose; /* is operator for 's'earch or 'o'rdering? */ Oid amopopr; /* the operator's pg_operator OID */ Oid amopmethod; /* the index access method this entry is for */ Oid amopsortfamily; /* ordering opfamily OID, or 0 if search op */ } FormData_pg_amop; /* allowed values of amoppurpose: */ #define AMOP_SEARCH 's' /* operator is for search */ #define AMOP_ORDER 'o' /* operator is for ordering */ /* ---------------- * Form_pg_amop corresponds to a pointer to a tuple with * the format of pg_amop relation. * ---------------- */ typedef FormData_pg_amop *Form_pg_amop; /* ---------------- * compiler constants for pg_amop * ---------------- */ #define Natts_pg_amop 8 #define Anum_pg_amop_amopfamily 1 #define Anum_pg_amop_amoplefttype 2 #define Anum_pg_amop_amoprighttype 3 #define Anum_pg_amop_amopstrategy 4 #define Anum_pg_amop_amoppurpose 5 #define Anum_pg_amop_amopopr 6 #define Anum_pg_amop_amopmethod 7 #define Anum_pg_amop_amopsortfamily 8 /* ---------------- * initial contents of pg_amop * ---------------- */ /* * btree integer_ops */ /* default operators int2 */ DATA(insert ( 1976 21 21 1 s 95 403 0 )); DATA(insert ( 1976 21 21 2 s 522 403 0 )); DATA(insert ( 1976 21 21 3 s 94 403 0 )); DATA(insert ( 1976 21 21 4 s 524 403 0 )); DATA(insert ( 1976 21 21 5 s 520 403 0 )); /* crosstype operators int24 */ DATA(insert ( 1976 21 23 1 s 534 403 0 )); DATA(insert ( 1976 21 23 2 s 540 403 0 )); DATA(insert ( 1976 21 23 3 s 532 403 0 )); DATA(insert ( 1976 21 23 4 s 542 403 0 )); DATA(insert ( 1976 21 23 5 s 536 403 0 )); /* crosstype operators int28 */ DATA(insert ( 1976 21 20 1 s 1864 403 0 )); DATA(insert ( 1976 21 20 2 s 1866 403 0 )); DATA(insert ( 1976 21 20 3 s 1862 403 0 )); DATA(insert ( 1976 21 20 4 s 1867 403 0 )); DATA(insert ( 1976 21 20 5 s 1865 403 0 )); /* default operators int4 */ DATA(insert ( 1976 23 23 1 s 97 403 0 )); DATA(insert ( 1976 23 23 2 s 523 403 0 )); DATA(insert ( 1976 23 23 3 s 96 403 0 )); DATA(insert ( 1976 23 23 4 s 525 403 0 )); DATA(insert ( 1976 23 23 5 s 521 403 0 )); /* crosstype operators int42 */ DATA(insert ( 1976 23 21 1 s 535 403 0 )); DATA(insert ( 1976 23 21 2 s 541 403 0 )); DATA(insert ( 1976 23 21 3 s 533 403 0 )); DATA(insert ( 1976 23 21 4 s 543 403 0 )); DATA(insert ( 1976 23 21 5 s 537 403 0 )); /* crosstype operators int48 */ DATA(insert ( 1976 23 20 1 s 37 403 0 )); DATA(insert ( 1976 23 20 2 s 80 403 0 )); DATA(insert ( 1976 23 20 3 s 15 403 0 )); DATA(insert ( 1976 23 20 4 s 82 403 0 )); DATA(insert ( 1976 23 20 5 s 76 403 0 )); /* default operators int8 */ DATA(insert ( 1976 20 20 1 s 412 403 0 )); DATA(insert ( 1976 20 20 2 s 414 403 0 )); DATA(insert ( 1976 20 20 3 s 410 403 0 )); DATA(insert ( 1976 20 20 4 s 415 403 0 )); DATA(insert ( 1976 20 20 5 s 413 403 0 )); /* crosstype operators int82 */ DATA(insert ( 1976 20 21 1 s 1870 403 0 )); DATA(insert ( 1976 20 21 2 s 1872 403 0 )); DATA(insert ( 1976 20 21 3 s 1868 403 0 )); DATA(insert ( 1976 20 21 4 s 1873 403 0 )); DATA(insert ( 1976 20 21 5 s 1871 403 0 )); /* crosstype operators int84 */ DATA(insert ( 1976 20 23 1 s 418 403 0 )); DATA(insert ( 1976 20 23 2 s 420 403 0 )); DATA(insert ( 1976 20 23 3 s 416 403 0 )); DATA(insert ( 1976 20 23 4 s 430 403 0 )); DATA(insert ( 1976 20 23 5 s 419 403 0 )); /* * btree oid_ops */ DATA(insert ( 1989 26 26 1 s 609 403 0 )); DATA(insert ( 1989 26 26 2 s 611 403 0 )); DATA(insert ( 1989 26 26 3 s 607 403 0 )); DATA(insert ( 1989 26 26 4 s 612 403 0 )); DATA(insert ( 1989 26 26 5 s 610 403 0 )); /* * btree tid_ops */ DATA(insert ( 2789 27 27 1 s 2799 403 0 )); DATA(insert ( 2789 27 27 2 s 2801 403 0 )); DATA(insert ( 2789 27 27 3 s 387 403 0 )); DATA(insert ( 2789 27 27 4 s 2802 403 0 )); DATA(insert ( 2789 27 27 5 s 2800 403 0 )); /* * btree oidvector_ops */ DATA(insert ( 1991 30 30 1 s 645 403 0 )); DATA(insert ( 1991 30 30 2 s 647 403 0 )); DATA(insert ( 1991 30 30 3 s 649 403 0 )); DATA(insert ( 1991 30 30 4 s 648 403 0 )); DATA(insert ( 1991 30 30 5 s 646 403 0 )); /* * btree float_ops */ /* default operators float4 */ DATA(insert ( 1970 700 700 1 s 622 403 0 )); DATA(insert ( 1970 700 700 2 s 624 403 0 )); DATA(insert ( 1970 700 700 3 s 620 403 0 )); DATA(insert ( 1970 700 700 4 s 625 403 0 )); DATA(insert ( 1970 700 700 5 s 623 403 0 )); /* crosstype operators float48 */ DATA(insert ( 1970 700 701 1 s 1122 403 0 )); DATA(insert ( 1970 700 701 2 s 1124 403 0 )); DATA(insert ( 1970 700 701 3 s 1120 403 0 )); DATA(insert ( 1970 700 701 4 s 1125 403 0 )); DATA(insert ( 1970 700 701 5 s 1123 403 0 )); /* default operators float8 */ DATA(insert ( 1970 701 701 1 s 672 403 0 )); DATA(insert ( 1970 701 701 2 s 673 403 0 )); DATA(insert ( 1970 701 701 3 s 670 403 0 )); DATA(insert ( 1970 701 701 4 s 675 403 0 )); DATA(insert ( 1970 701 701 5 s 674 403 0 )); /* crosstype operators float84 */ DATA(insert ( 1970 701 700 1 s 1132 403 0 )); DATA(insert ( 1970 701 700 2 s 1134 403 0 )); DATA(insert ( 1970 701 700 3 s 1130 403 0 )); DATA(insert ( 1970 701 700 4 s 1135 403 0 )); DATA(insert ( 1970 701 700 5 s 1133 403 0 )); /* * btree char_ops */ DATA(insert ( 429 18 18 1 s 631 403 0 )); DATA(insert ( 429 18 18 2 s 632 403 0 )); DATA(insert ( 429 18 18 3 s 92 403 0 )); DATA(insert ( 429 18 18 4 s 634 403 0 )); DATA(insert ( 429 18 18 5 s 633 403 0 )); /* * btree name_ops */ DATA(insert ( 1986 19 19 1 s 660 403 0 )); DATA(insert ( 1986 19 19 2 s 661 403 0 )); DATA(insert ( 1986 19 19 3 s 93 403 0 )); DATA(insert ( 1986 19 19 4 s 663 403 0 )); DATA(insert ( 1986 19 19 5 s 662 403 0 )); /* * btree text_ops */ DATA(insert ( 1994 25 25 1 s 664 403 0 )); DATA(insert ( 1994 25 25 2 s 665 403 0 )); DATA(insert ( 1994 25 25 3 s 98 403 0 )); DATA(insert ( 1994 25 25 4 s 667 403 0 )); DATA(insert ( 1994 25 25 5 s 666 403 0 )); /* * btree bpchar_ops */ DATA(insert ( 426 1042 1042 1 s 1058 403 0 )); DATA(insert ( 426 1042 1042 2 s 1059 403 0 )); DATA(insert ( 426 1042 1042 3 s 1054 403 0 )); DATA(insert ( 426 1042 1042 4 s 1061 403 0 )); DATA(insert ( 426 1042 1042 5 s 1060 403 0 )); /* * btree bytea_ops */ DATA(insert ( 428 17 17 1 s 1957 403 0 )); DATA(insert ( 428 17 17 2 s 1958 403 0 )); DATA(insert ( 428 17 17 3 s 1955 403 0 )); DATA(insert ( 428 17 17 4 s 1960 403 0 )); DATA(insert ( 428 17 17 5 s 1959 403 0 )); /* * btree abstime_ops */ DATA(insert ( 421 702 702 1 s 562 403 0 )); DATA(insert ( 421 702 702 2 s 564 403 0 )); DATA(insert ( 421 702 702 3 s 560 403 0 )); DATA(insert ( 421 702 702 4 s 565 403 0 )); DATA(insert ( 421 702 702 5 s 563 403 0 )); /* * btree datetime_ops */ /* default operators date */ DATA(insert ( 434 1082 1082 1 s 1095 403 0 )); DATA(insert ( 434 1082 1082 2 s 1096 403 0 )); DATA(insert ( 434 1082 1082 3 s 1093 403 0 )); DATA(insert ( 434 1082 1082 4 s 1098 403 0 )); DATA(insert ( 434 1082 1082 5 s 1097 403 0 )); /* crosstype operators vs timestamp */ DATA(insert ( 434 1082 1114 1 s 2345 403 0 )); DATA(insert ( 434 1082 1114 2 s 2346 403 0 )); DATA(insert ( 434 1082 1114 3 s 2347 403 0 )); DATA(insert ( 434 1082 1114 4 s 2348 403 0 )); DATA(insert ( 434 1082 1114 5 s 2349 403 0 )); /* crosstype operators vs timestamptz */ DATA(insert ( 434 1082 1184 1 s 2358 403 0 )); DATA(insert ( 434 1082 1184 2 s 2359 403 0 )); DATA(insert ( 434 1082 1184 3 s 2360 403 0 )); DATA(insert ( 434 1082 1184 4 s 2361 403 0 )); DATA(insert ( 434 1082 1184 5 s 2362 403 0 )); /* default operators timestamp */ DATA(insert ( 434 1114 1114 1 s 2062 403 0 )); DATA(insert ( 434 1114 1114 2 s 2063 403 0 )); DATA(insert ( 434 1114 1114 3 s 2060 403 0 )); DATA(insert ( 434 1114 1114 4 s 2065 403 0 )); DATA(insert ( 434 1114 1114 5 s 2064 403 0 )); /* crosstype operators vs date */ DATA(insert ( 434 1114 1082 1 s 2371 403 0 )); DATA(insert ( 434 1114 1082 2 s 2372 403 0 )); DATA(insert ( 434 1114 1082 3 s 2373 403 0 )); DATA(insert ( 434 1114 1082 4 s 2374 403 0 )); DATA(insert ( 434 1114 1082 5 s 2375 403 0 )); /* crosstype operators vs timestamptz */ DATA(insert ( 434 1114 1184 1 s 2534 403 0 )); DATA(insert ( 434 1114 1184 2 s 2535 403 0 )); DATA(insert ( 434 1114 1184 3 s 2536 403 0 )); DATA(insert ( 434 1114 1184 4 s 2537 403 0 )); DATA(insert ( 434 1114 1184 5 s 2538 403 0 )); /* default operators timestamptz */ DATA(insert ( 434 1184 1184 1 s 1322 403 0 )); DATA(insert ( 434 1184 1184 2 s 1323 403 0 )); DATA(insert ( 434 1184 1184 3 s 1320 403 0 )); DATA(insert ( 434 1184 1184 4 s 1325 403 0 )); DATA(insert ( 434 1184 1184 5 s 1324 403 0 )); /* crosstype operators vs date */ DATA(insert ( 434 1184 1082 1 s 2384 403 0 )); DATA(insert ( 434 1184 1082 2 s 2385 403 0 )); DATA(insert ( 434 1184 1082 3 s 2386 403 0 )); DATA(insert ( 434 1184 1082 4 s 2387 403 0 )); DATA(insert ( 434 1184 1082 5 s 2388 403 0 )); /* crosstype operators vs timestamp */ DATA(insert ( 434 1184 1114 1 s 2540 403 0 )); DATA(insert ( 434 1184 1114 2 s 2541 403 0 )); DATA(insert ( 434 1184 1114 3 s 2542 403 0 )); DATA(insert ( 434 1184 1114 4 s 2543 403 0 )); DATA(insert ( 434 1184 1114 5 s 2544 403 0 )); /* * btree time_ops */ DATA(insert ( 1996 1083 1083 1 s 1110 403 0 )); DATA(insert ( 1996 1083 1083 2 s 1111 403 0 )); DATA(insert ( 1996 1083 1083 3 s 1108 403 0 )); DATA(insert ( 1996 1083 1083 4 s 1113 403 0 )); DATA(insert ( 1996 1083 1083 5 s 1112 403 0 )); /* * btree timetz_ops */ DATA(insert ( 2000 1266 1266 1 s 1552 403 0 )); DATA(insert ( 2000 1266 1266 2 s 1553 403 0 )); DATA(insert ( 2000 1266 1266 3 s 1550 403 0 )); DATA(insert ( 2000 1266 1266 4 s 1555 403 0 )); DATA(insert ( 2000 1266 1266 5 s 1554 403 0 )); /* * btree interval_ops */ DATA(insert ( 1982 1186 1186 1 s 1332 403 0 )); DATA(insert ( 1982 1186 1186 2 s 1333 403 0 )); DATA(insert ( 1982 1186 1186 3 s 1330 403 0 )); DATA(insert ( 1982 1186 1186 4 s 1335 403 0 )); DATA(insert ( 1982 1186 1186 5 s 1334 403 0 )); /* * btree macaddr */ DATA(insert ( 1984 829 829 1 s 1222 403 0 )); DATA(insert ( 1984 829 829 2 s 1223 403 0 )); DATA(insert ( 1984 829 829 3 s 1220 403 0 )); DATA(insert ( 1984 829 829 4 s 1225 403 0 )); DATA(insert ( 1984 829 829 5 s 1224 403 0 )); /* * btree network */ DATA(insert ( 1974 869 869 1 s 1203 403 0 )); DATA(insert ( 1974 869 869 2 s 1204 403 0 )); DATA(insert ( 1974 869 869 3 s 1201 403 0 )); DATA(insert ( 1974 869 869 4 s 1206 403 0 )); DATA(insert ( 1974 869 869 5 s 1205 403 0 )); /* * btree numeric */ DATA(insert ( 1988 1700 1700 1 s 1754 403 0 )); DATA(insert ( 1988 1700 1700 2 s 1755 403 0 )); DATA(insert ( 1988 1700 1700 3 s 1752 403 0 )); DATA(insert ( 1988 1700 1700 4 s 1757 403 0 )); DATA(insert ( 1988 1700 1700 5 s 1756 403 0 )); /* * btree bool */ DATA(insert ( 424 16 16 1 s 58 403 0 )); DATA(insert ( 424 16 16 2 s 1694 403 0 )); DATA(insert ( 424 16 16 3 s 91 403 0 )); DATA(insert ( 424 16 16 4 s 1695 403 0 )); DATA(insert ( 424 16 16 5 s 59 403 0 )); /* * btree bit */ DATA(insert ( 423 1560 1560 1 s 1786 403 0 )); DATA(insert ( 423 1560 1560 2 s 1788 403 0 )); DATA(insert ( 423 1560 1560 3 s 1784 403 0 )); DATA(insert ( 423 1560 1560 4 s 1789 403 0 )); DATA(insert ( 423 1560 1560 5 s 1787 403 0 )); /* * btree varbit */ DATA(insert ( 2002 1562 1562 1 s 1806 403 0 )); DATA(insert ( 2002 1562 1562 2 s 1808 403 0 )); DATA(insert ( 2002 1562 1562 3 s 1804 403 0 )); DATA(insert ( 2002 1562 1562 4 s 1809 403 0 )); DATA(insert ( 2002 1562 1562 5 s 1807 403 0 )); /* * btree text pattern */ DATA(insert ( 2095 25 25 1 s 2314 403 0 )); DATA(insert ( 2095 25 25 2 s 2315 403 0 )); DATA(insert ( 2095 25 25 3 s 98 403 0 )); DATA(insert ( 2095 25 25 4 s 2317 403 0 )); DATA(insert ( 2095 25 25 5 s 2318 403 0 )); /* * btree bpchar pattern */ DATA(insert ( 2097 1042 1042 1 s 2326 403 0 )); DATA(insert ( 2097 1042 1042 2 s 2327 403 0 )); DATA(insert ( 2097 1042 1042 3 s 1054 403 0 )); DATA(insert ( 2097 1042 1042 4 s 2329 403 0 )); DATA(insert ( 2097 1042 1042 5 s 2330 403 0 )); /* * btree money_ops */ DATA(insert ( 2099 790 790 1 s 902 403 0 )); DATA(insert ( 2099 790 790 2 s 904 403 0 )); DATA(insert ( 2099 790 790 3 s 900 403 0 )); DATA(insert ( 2099 790 790 4 s 905 403 0 )); DATA(insert ( 2099 790 790 5 s 903 403 0 )); /* * btree reltime_ops */ DATA(insert ( 2233 703 703 1 s 568 403 0 )); DATA(insert ( 2233 703 703 2 s 570 403 0 )); DATA(insert ( 2233 703 703 3 s 566 403 0 )); DATA(insert ( 2233 703 703 4 s 571 403 0 )); DATA(insert ( 2233 703 703 5 s 569 403 0 )); /* * btree tinterval_ops */ DATA(insert ( 2234 704 704 1 s 813 403 0 )); DATA(insert ( 2234 704 704 2 s 815 403 0 )); DATA(insert ( 2234 704 704 3 s 811 403 0 )); DATA(insert ( 2234 704 704 4 s 816 403 0 )); DATA(insert ( 2234 704 704 5 s 814 403 0 )); /* * btree array_ops */ DATA(insert ( 397 2277 2277 1 s 1072 403 0 )); DATA(insert ( 397 2277 2277 2 s 1074 403 0 )); DATA(insert ( 397 2277 2277 3 s 1070 403 0 )); DATA(insert ( 397 2277 2277 4 s 1075 403 0 )); DATA(insert ( 397 2277 2277 5 s 1073 403 0 )); /* * btree record_ops */ DATA(insert ( 2994 2249 2249 1 s 2990 403 0 )); DATA(insert ( 2994 2249 2249 2 s 2992 403 0 )); DATA(insert ( 2994 2249 2249 3 s 2988 403 0 )); DATA(insert ( 2994 2249 2249 4 s 2993 403 0 )); DATA(insert ( 2994 2249 2249 5 s 2991 403 0 )); /* * btree uuid_ops */ DATA(insert ( 2968 2950 2950 1 s 2974 403 0 )); DATA(insert ( 2968 2950 2950 2 s 2976 403 0 )); DATA(insert ( 2968 2950 2950 3 s 2972 403 0 )); DATA(insert ( 2968 2950 2950 4 s 2977 403 0 )); DATA(insert ( 2968 2950 2950 5 s 2975 403 0 )); /* * hash index _ops */ /* bpchar_ops */ DATA(insert ( 427 1042 1042 1 s 1054 405 0 )); /* char_ops */ DATA(insert ( 431 18 18 1 s 92 405 0 )); /* date_ops */ DATA(insert ( 435 1082 1082 1 s 1093 405 0 )); /* float_ops */ DATA(insert ( 1971 700 700 1 s 620 405 0 )); DATA(insert ( 1971 701 701 1 s 670 405 0 )); DATA(insert ( 1971 700 701 1 s 1120 405 0 )); DATA(insert ( 1971 701 700 1 s 1130 405 0 )); /* network_ops */ DATA(insert ( 1975 869 869 1 s 1201 405 0 )); /* integer_ops */ DATA(insert ( 1977 21 21 1 s 94 405 0 )); DATA(insert ( 1977 23 23 1 s 96 405 0 )); DATA(insert ( 1977 20 20 1 s 410 405 0 )); DATA(insert ( 1977 21 23 1 s 532 405 0 )); DATA(insert ( 1977 21 20 1 s 1862 405 0 )); DATA(insert ( 1977 23 21 1 s 533 405 0 )); DATA(insert ( 1977 23 20 1 s 15 405 0 )); DATA(insert ( 1977 20 21 1 s 1868 405 0 )); DATA(insert ( 1977 20 23 1 s 416 405 0 )); /* interval_ops */ DATA(insert ( 1983 1186 1186 1 s 1330 405 0 )); /* macaddr_ops */ DATA(insert ( 1985 829 829 1 s 1220 405 0 )); /* name_ops */ DATA(insert ( 1987 19 19 1 s 93 405 0 )); /* oid_ops */ DATA(insert ( 1990 26 26 1 s 607 405 0 )); /* oidvector_ops */ DATA(insert ( 1992 30 30 1 s 649 405 0 )); /* text_ops */ DATA(insert ( 1995 25 25 1 s 98 405 0 )); /* time_ops */ DATA(insert ( 1997 1083 1083 1 s 1108 405 0 )); /* timestamptz_ops */ DATA(insert ( 1999 1184 1184 1 s 1320 405 0 )); /* timetz_ops */ DATA(insert ( 2001 1266 1266 1 s 1550 405 0 )); /* timestamp_ops */ DATA(insert ( 2040 1114 1114 1 s 2060 405 0 )); /* bool_ops */ DATA(insert ( 2222 16 16 1 s 91 405 0 )); /* bytea_ops */ DATA(insert ( 2223 17 17 1 s 1955 405 0 )); /* int2vector_ops */ DATA(insert ( 2224 22 22 1 s 386 405 0 )); /* xid_ops */ DATA(insert ( 2225 28 28 1 s 352 405 0 )); /* cid_ops */ DATA(insert ( 2226 29 29 1 s 385 405 0 )); /* abstime_ops */ DATA(insert ( 2227 702 702 1 s 560 405 0 )); /* reltime_ops */ DATA(insert ( 2228 703 703 1 s 566 405 0 )); /* text_pattern_ops */ DATA(insert ( 2229 25 25 1 s 98 405 0 )); /* bpchar_pattern_ops */ DATA(insert ( 2231 1042 1042 1 s 1054 405 0 )); /* aclitem_ops */ DATA(insert ( 2235 1033 1033 1 s 974 405 0 )); /* uuid_ops */ DATA(insert ( 2969 2950 2950 1 s 2972 405 0 )); /* numeric_ops */ DATA(insert ( 1998 1700 1700 1 s 1752 405 0 )); /* array_ops */ DATA(insert ( 627 2277 2277 1 s 1070 405 0 )); /* * gist box_ops */ DATA(insert ( 2593 603 603 1 s 493 783 0 )); DATA(insert ( 2593 603 603 2 s 494 783 0 )); DATA(insert ( 2593 603 603 3 s 500 783 0 )); DATA(insert ( 2593 603 603 4 s 495 783 0 )); DATA(insert ( 2593 603 603 5 s 496 783 0 )); DATA(insert ( 2593 603 603 6 s 499 783 0 )); DATA(insert ( 2593 603 603 7 s 498 783 0 )); DATA(insert ( 2593 603 603 8 s 497 783 0 )); DATA(insert ( 2593 603 603 9 s 2571 783 0 )); DATA(insert ( 2593 603 603 10 s 2570 783 0 )); DATA(insert ( 2593 603 603 11 s 2573 783 0 )); DATA(insert ( 2593 603 603 12 s 2572 783 0 )); DATA(insert ( 2593 603 603 13 s 2863 783 0 )); DATA(insert ( 2593 603 603 14 s 2862 783 0 )); /* * gist point_ops */ DATA(insert ( 1029 600 600 11 s 506 783 0 )); DATA(insert ( 1029 600 600 1 s 507 783 0 )); DATA(insert ( 1029 600 600 5 s 508 783 0 )); DATA(insert ( 1029 600 600 10 s 509 783 0 )); DATA(insert ( 1029 600 600 6 s 510 783 0 )); DATA(insert ( 1029 600 600 15 o 517 783 1970 )); DATA(insert ( 1029 600 603 28 s 511 783 0 )); DATA(insert ( 1029 600 604 48 s 756 783 0 )); DATA(insert ( 1029 600 718 68 s 758 783 0 )); /* * gist poly_ops (supports polygons) */ DATA(insert ( 2594 604 604 1 s 485 783 0 )); DATA(insert ( 2594 604 604 2 s 486 783 0 )); DATA(insert ( 2594 604 604 3 s 492 783 0 )); DATA(insert ( 2594 604 604 4 s 487 783 0 )); DATA(insert ( 2594 604 604 5 s 488 783 0 )); DATA(insert ( 2594 604 604 6 s 491 783 0 )); DATA(insert ( 2594 604 604 7 s 490 783 0 )); DATA(insert ( 2594 604 604 8 s 489 783 0 )); DATA(insert ( 2594 604 604 9 s 2575 783 0 )); DATA(insert ( 2594 604 604 10 s 2574 783 0 )); DATA(insert ( 2594 604 604 11 s 2577 783 0 )); DATA(insert ( 2594 604 604 12 s 2576 783 0 )); DATA(insert ( 2594 604 604 13 s 2861 783 0 )); DATA(insert ( 2594 604 604 14 s 2860 783 0 )); /* * gist circle_ops */ DATA(insert ( 2595 718 718 1 s 1506 783 0 )); DATA(insert ( 2595 718 718 2 s 1507 783 0 )); DATA(insert ( 2595 718 718 3 s 1513 783 0 )); DATA(insert ( 2595 718 718 4 s 1508 783 0 )); DATA(insert ( 2595 718 718 5 s 1509 783 0 )); DATA(insert ( 2595 718 718 6 s 1512 783 0 )); DATA(insert ( 2595 718 718 7 s 1511 783 0 )); DATA(insert ( 2595 718 718 8 s 1510 783 0 )); DATA(insert ( 2595 718 718 9 s 2589 783 0 )); DATA(insert ( 2595 718 718 10 s 1515 783 0 )); DATA(insert ( 2595 718 718 11 s 1514 783 0 )); DATA(insert ( 2595 718 718 12 s 2590 783 0 )); DATA(insert ( 2595 718 718 13 s 2865 783 0 )); DATA(insert ( 2595 718 718 14 s 2864 783 0 )); /* * gin array_ops (these anyarray operators are used with all the opclasses * of the family) */ DATA(insert ( 2745 2277 2277 1 s 2750 2742 0 )); DATA(insert ( 2745 2277 2277 2 s 2751 2742 0 )); DATA(insert ( 2745 2277 2277 3 s 2752 2742 0 )); DATA(insert ( 2745 2277 2277 4 s 1070 2742 0 )); /* * btree enum_ops */ DATA(insert ( 3522 3500 3500 1 s 3518 403 0 )); DATA(insert ( 3522 3500 3500 2 s 3520 403 0 )); DATA(insert ( 3522 3500 3500 3 s 3516 403 0 )); DATA(insert ( 3522 3500 3500 4 s 3521 403 0 )); DATA(insert ( 3522 3500 3500 5 s 3519 403 0 )); /* * hash enum_ops */ DATA(insert ( 3523 3500 3500 1 s 3516 405 0 )); /* * btree tsvector_ops */ DATA(insert ( 3626 3614 3614 1 s 3627 403 0 )); DATA(insert ( 3626 3614 3614 2 s 3628 403 0 )); DATA(insert ( 3626 3614 3614 3 s 3629 403 0 )); DATA(insert ( 3626 3614 3614 4 s 3631 403 0 )); DATA(insert ( 3626 3614 3614 5 s 3632 403 0 )); /* * GiST tsvector_ops */ DATA(insert ( 3655 3614 3615 1 s 3636 783 0 )); /* * GIN tsvector_ops */ DATA(insert ( 3659 3614 3615 1 s 3636 2742 0 )); DATA(insert ( 3659 3614 3615 2 s 3660 2742 0 )); /* * btree tsquery_ops */ DATA(insert ( 3683 3615 3615 1 s 3674 403 0 )); DATA(insert ( 3683 3615 3615 2 s 3675 403 0 )); DATA(insert ( 3683 3615 3615 3 s 3676 403 0 )); DATA(insert ( 3683 3615 3615 4 s 3678 403 0 )); DATA(insert ( 3683 3615 3615 5 s 3679 403 0 )); /* * GiST tsquery_ops */ DATA(insert ( 3702 3615 3615 7 s 3693 783 0 )); DATA(insert ( 3702 3615 3615 8 s 3694 783 0 )); /* * btree range_ops */ DATA(insert ( 3901 3831 3831 1 s 3884 403 0 )); DATA(insert ( 3901 3831 3831 2 s 3885 403 0 )); DATA(insert ( 3901 3831 3831 3 s 3882 403 0 )); DATA(insert ( 3901 3831 3831 4 s 3886 403 0 )); DATA(insert ( 3901 3831 3831 5 s 3887 403 0 )); /* * hash range_ops */ DATA(insert ( 3903 3831 3831 1 s 3882 405 0 )); /* * GiST range_ops */ DATA(insert ( 3919 3831 3831 1 s 3893 783 0 )); DATA(insert ( 3919 3831 3831 2 s 3895 783 0 )); DATA(insert ( 3919 3831 3831 3 s 3888 783 0 )); DATA(insert ( 3919 3831 3831 4 s 3896 783 0 )); DATA(insert ( 3919 3831 3831 5 s 3894 783 0 )); DATA(insert ( 3919 3831 3831 6 s 3897 783 0 )); DATA(insert ( 3919 3831 3831 7 s 3890 783 0 )); DATA(insert ( 3919 3831 3831 8 s 3892 783 0 )); DATA(insert ( 3919 3831 2283 16 s 3889 783 0 )); DATA(insert ( 3919 3831 3831 18 s 3882 783 0 )); /* * SP-GiST quad_point_ops */ DATA(insert ( 4015 600 600 11 s 506 4000 0 )); DATA(insert ( 4015 600 600 1 s 507 4000 0 )); DATA(insert ( 4015 600 600 5 s 508 4000 0 )); DATA(insert ( 4015 600 600 10 s 509 4000 0 )); DATA(insert ( 4015 600 600 6 s 510 4000 0 )); DATA(insert ( 4015 600 603 8 s 511 4000 0 )); /* * SP-GiST kd_point_ops */ DATA(insert ( 4016 600 600 11 s 506 4000 0 )); DATA(insert ( 4016 600 600 1 s 507 4000 0 )); DATA(insert ( 4016 600 600 5 s 508 4000 0 )); DATA(insert ( 4016 600 600 10 s 509 4000 0 )); DATA(insert ( 4016 600 600 6 s 510 4000 0 )); DATA(insert ( 4016 600 603 8 s 511 4000 0 )); /* * SP-GiST text_ops */ DATA(insert ( 4017 25 25 1 s 2314 4000 0 )); DATA(insert ( 4017 25 25 2 s 2315 4000 0 )); DATA(insert ( 4017 25 25 3 s 98 4000 0 )); DATA(insert ( 4017 25 25 4 s 2317 4000 0 )); DATA(insert ( 4017 25 25 5 s 2318 4000 0 )); DATA(insert ( 4017 25 25 11 s 664 4000 0 )); DATA(insert ( 4017 25 25 12 s 665 4000 0 )); DATA(insert ( 4017 25 25 14 s 667 4000 0 )); DATA(insert ( 4017 25 25 15 s 666 4000 0 )); #endif /* PG_AMOP_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_pltemplate.h����������������������������������������������������������������0000644�����������������00000006161�14763166026�0013637 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_pltemplate.h * definition of the system "PL template" relation (pg_pltemplate) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_pltemplate.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_PLTEMPLATE_H #define PG_PLTEMPLATE_H #include "catalog/genbki.h" /* ---------------- * pg_pltemplate definition. cpp turns this into * typedef struct FormData_pg_pltemplate * ---------------- */ #define PLTemplateRelationId 1136 CATALOG(pg_pltemplate,1136) BKI_SHARED_RELATION BKI_WITHOUT_OIDS { NameData tmplname; /* name of PL */ bool tmpltrusted; /* PL is trusted? */ bool tmpldbacreate; /* PL is installable by db owner? */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ text tmplhandler; /* name of call handler function */ text tmplinline; /* name of anonymous-block handler, or NULL */ text tmplvalidator; /* name of validator function, or NULL */ text tmpllibrary; /* path of shared library */ aclitem tmplacl[1]; /* access privileges for template */ #endif } FormData_pg_pltemplate; /* ---------------- * Form_pg_pltemplate corresponds to a pointer to a row with * the format of pg_pltemplate relation. * ---------------- */ typedef FormData_pg_pltemplate *Form_pg_pltemplate; /* ---------------- * compiler constants for pg_pltemplate * ---------------- */ #define Natts_pg_pltemplate 8 #define Anum_pg_pltemplate_tmplname 1 #define Anum_pg_pltemplate_tmpltrusted 2 #define Anum_pg_pltemplate_tmpldbacreate 3 #define Anum_pg_pltemplate_tmplhandler 4 #define Anum_pg_pltemplate_tmplinline 5 #define Anum_pg_pltemplate_tmplvalidator 6 #define Anum_pg_pltemplate_tmpllibrary 7 #define Anum_pg_pltemplate_tmplacl 8 /* ---------------- * initial contents of pg_pltemplate * ---------------- */ DATA(insert ( "plpgsql" t t "plpgsql_call_handler" "plpgsql_inline_handler" "plpgsql_validator" "$libdir/plpgsql" _null_ )); DATA(insert ( "pltcl" t t "pltcl_call_handler" _null_ _null_ "$libdir/pltcl" _null_ )); DATA(insert ( "pltclu" f f "pltclu_call_handler" _null_ _null_ "$libdir/pltcl" _null_ )); DATA(insert ( "plperl" t t "plperl_call_handler" "plperl_inline_handler" "plperl_validator" "$libdir/plperl" _null_ )); DATA(insert ( "plperlu" f f "plperlu_call_handler" "plperlu_inline_handler" "plperlu_validator" "$libdir/plperl" _null_ )); DATA(insert ( "plpythonu" f f "plpython_call_handler" "plpython_inline_handler" "plpython_validator" "$libdir/plpython2" _null_ )); DATA(insert ( "plpython2u" f f "plpython2_call_handler" "plpython2_inline_handler" "plpython2_validator" "$libdir/plpython2" _null_ )); DATA(insert ( "plpython3u" f f "plpython3_call_handler" "plpython3_inline_handler" "plpython3_validator" "$libdir/plpython3" _null_ )); #endif /* PG_PLTEMPLATE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_control.h�������������������������������������������������������������������0000644�����������������00000017750�14763166026�0013156 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_control.h * The system control file "pg_control" is not a heap relation. * However, we define it here so that the format is documented. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_control.h * *------------------------------------------------------------------------- */ #ifndef PG_CONTROL_H #define PG_CONTROL_H #include "access/xlogdefs.h" #include "pgtime.h" /* for pg_time_t */ #include "utils/pg_crc.h" /* Version identifier for this pg_control format */ #define PG_CONTROL_VERSION 922 /* * Body of CheckPoint XLOG records. This is declared here because we keep * a copy of the latest one in pg_control for possible disaster recovery. * Changing this struct requires a PG_CONTROL_VERSION bump. */ typedef struct CheckPoint { XLogRecPtr redo; /* next RecPtr available when we began to * create CheckPoint (i.e. REDO start point) */ TimeLineID ThisTimeLineID; /* current TLI */ bool fullPageWrites; /* current full_page_writes */ uint32 nextXidEpoch; /* higher-order bits of nextXid */ TransactionId nextXid; /* next free XID */ Oid nextOid; /* next free OID */ MultiXactId nextMulti; /* next free MultiXactId */ MultiXactOffset nextMultiOffset; /* next free MultiXact offset */ TransactionId oldestXid; /* cluster-wide minimum datfrozenxid */ Oid oldestXidDB; /* database with minimum datfrozenxid */ pg_time_t time; /* time stamp of checkpoint */ /* * Oldest XID still running. This is only needed to initialize hot standby * mode from an online checkpoint, so we only bother calculating this for * online checkpoints and only when wal_level is hot_standby. Otherwise * it's set to InvalidTransactionId. */ TransactionId oldestActiveXid; } CheckPoint; /* XLOG info values for XLOG rmgr */ #define XLOG_CHECKPOINT_SHUTDOWN 0x00 #define XLOG_CHECKPOINT_ONLINE 0x10 #define XLOG_NOOP 0x20 #define XLOG_NEXTOID 0x30 #define XLOG_SWITCH 0x40 #define XLOG_BACKUP_END 0x50 #define XLOG_PARAMETER_CHANGE 0x60 #define XLOG_RESTORE_POINT 0x70 #define XLOG_FPW_CHANGE 0x80 /* * System status indicator. Note this is stored in pg_control; if you change * it, you must bump PG_CONTROL_VERSION */ typedef enum DBState { DB_STARTUP = 0, DB_SHUTDOWNED, DB_SHUTDOWNED_IN_RECOVERY, DB_SHUTDOWNING, DB_IN_CRASH_RECOVERY, DB_IN_ARCHIVE_RECOVERY, DB_IN_PRODUCTION } DBState; /* * Contents of pg_control. * * NOTE: try to keep this under 512 bytes so that it will fit on one physical * sector of typical disk drives. This reduces the odds of corruption due to * power failure midway through a write. */ typedef struct ControlFileData { /* * Unique system identifier --- to ensure we match up xlog files with the * installation that produced them. */ uint64 system_identifier; /* * Version identifier information. Keep these fields at the same offset, * especially pg_control_version; they won't be real useful if they move * around. (For historical reasons they must be 8 bytes into the file * rather than immediately at the front.) * * pg_control_version identifies the format of pg_control itself. * catalog_version_no identifies the format of the system catalogs. * * There are additional version identifiers in individual files; for * example, WAL logs contain per-page magic numbers that can serve as * version cues for the WAL log. */ uint32 pg_control_version; /* PG_CONTROL_VERSION */ uint32 catalog_version_no; /* see catversion.h */ /* * System status data */ DBState state; /* see enum above */ pg_time_t time; /* time stamp of last pg_control update */ XLogRecPtr checkPoint; /* last check point record ptr */ XLogRecPtr prevCheckPoint; /* previous check point record ptr */ CheckPoint checkPointCopy; /* copy of last check point record */ /* * These two values determine the minimum point we must recover up to * before starting up: * * minRecoveryPoint is updated to the latest replayed LSN whenever we * flush a data change during archive recovery. That guards against * starting archive recovery, aborting it, and restarting with an earlier * stop location. If we've already flushed data changes from WAL record X * to disk, we mustn't start up until we reach X again. Zero when not * doing archive recovery. * * backupStartPoint is the redo pointer of the backup start checkpoint, if * we are recovering from an online backup and haven't reached the end of * backup yet. It is reset to zero when the end of backup is reached, and * we mustn't start up before that. A boolean would suffice otherwise, but * we use the redo pointer as a cross-check when we see an end-of-backup * record, to make sure the end-of-backup record corresponds the base * backup we're recovering from. * * backupEndPoint is the backup end location, if we are recovering from an * online backup which was taken from the standby and haven't reached the * end of backup yet. It is initialized to the minimum recovery point in * pg_control which was backed up last. It is reset to zero when the end * of backup is reached, and we mustn't start up before that. * * If backupEndRequired is true, we know for sure that we're restoring * from a backup, and must see a backup-end record before we can safely * start up. If it's false, but backupStartPoint is set, a backup_label * file was found at startup but it may have been a leftover from a stray * pg_start_backup() call, not accompanied by pg_stop_backup(). */ XLogRecPtr minRecoveryPoint; XLogRecPtr backupStartPoint; XLogRecPtr backupEndPoint; bool backupEndRequired; /* * Parameter settings that determine if the WAL can be used for archival * or hot standby. */ int wal_level; int MaxConnections; int max_prepared_xacts; int max_locks_per_xact; /* * This data is used to check for hardware-architecture compatibility of * the database and the backend executable. We need not check endianness * explicitly, since the pg_control version will surely look wrong to a * machine of different endianness, but we do need to worry about MAXALIGN * and floating-point format. (Note: storage layout nominally also * depends on SHORTALIGN and INTALIGN, but in practice these are the same * on all architectures of interest.) * * Testing just one double value is not a very bulletproof test for * floating-point compatibility, but it will catch most cases. */ uint32 maxAlign; /* alignment requirement for tuples */ double floatFormat; /* constant 1234567.0 */ #define FLOATFORMAT_VALUE 1234567.0 /* * This data is used to make sure that configuration of this database is * compatible with the backend executable. */ uint32 blcksz; /* data block size for this DB */ uint32 relseg_size; /* blocks per segment of large relation */ uint32 xlog_blcksz; /* block size within WAL files */ uint32 xlog_seg_size; /* size of each WAL segment */ uint32 nameDataLen; /* catalog name field width */ uint32 indexMaxKeys; /* max number of columns in an index */ uint32 toast_max_chunk_size; /* chunk size in TOAST tables */ /* flag indicating internal format of timestamp, interval, time */ bool enableIntTimes; /* int64 storage enabled? */ /* flags indicating pass-by-value status of various types */ bool float4ByVal; /* float4 pass-by-value? */ bool float8ByVal; /* float8, int8, etc pass-by-value? */ /* CRC of all above ... MUST BE LAST! */ pg_crc32 crc; } ControlFileData; /* * Physical size of the pg_control file. Note that this is considerably * bigger than the actually used size (ie, sizeof(ControlFileData)). * The idea is to keep the physical size constant independent of format * changes, so that ReadControlFile will deliver a suitable wrong-version * message instead of a read error if it's looking at an incompatible file. */ #define PG_CONTROL_SIZE 8192 #endif /* PG_CONTROL_H */ ������������������������pgsql/server/catalog/pg_foreign_table.h�������������������������������������������������������������0000644�����������������00000003134�14763166026�0014265 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_foreign_table.h * definition of the system "foreign table" relation (pg_foreign_table) * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_foreign_table.h * * NOTES * the genbki.sh script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_FOREIGN_TABLE_H #define PG_FOREIGN_TABLE_H #include "catalog/genbki.h" /* ---------------- * pg_foreign_table definition. cpp turns this into * typedef struct FormData_pg_foreign_table * ---------------- */ #define ForeignTableRelationId 3118 CATALOG(pg_foreign_table,3118) BKI_WITHOUT_OIDS { Oid ftrelid; /* OID of foreign table */ Oid ftserver; /* OID of foreign server */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ text ftoptions[1]; /* FDW-specific options */ #endif } FormData_pg_foreign_table; /* ---------------- * Form_pg_foreign_table corresponds to a pointer to a tuple with * the format of pg_foreign_table relation. * ---------------- */ typedef FormData_pg_foreign_table *Form_pg_foreign_table; /* ---------------- * compiler constants for pg_foreign_table * ---------------- */ #define Natts_pg_foreign_table 3 #define Anum_pg_foreign_table_ftrelid 1 #define Anum_pg_foreign_table_ftserver 2 #define Anum_pg_foreign_table_ftoptions 3 #endif /* PG_FOREIGN_TABLE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/heap.h�������������������������������������������������������������������������0000644�����������������00000007473�14763166026�0011726 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * heap.h * prototypes for functions in backend/catalog/heap.c * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/heap.h * *------------------------------------------------------------------------- */ #ifndef HEAP_H #define HEAP_H #include "parser/parse_node.h" #include "catalog/indexing.h" typedef struct RawColumnDefault { AttrNumber attnum; /* attribute to attach default to */ Node *raw_default; /* default value (untransformed parse tree) */ } RawColumnDefault; typedef struct CookedConstraint { ConstrType contype; /* CONSTR_DEFAULT or CONSTR_CHECK */ char *name; /* name, or NULL if none */ AttrNumber attnum; /* which attr (only for DEFAULT) */ Node *expr; /* transformed default or check expr */ bool skip_validation; /* skip validation? (only for CHECK) */ bool is_local; /* constraint has local (non-inherited) def */ int inhcount; /* number of times constraint is inherited */ bool is_no_inherit; /* constraint has local def and cannot be * inherited */ } CookedConstraint; extern Relation heap_create(const char *relname, Oid relnamespace, Oid reltablespace, Oid relid, Oid relfilenode, TupleDesc tupDesc, char relkind, char relpersistence, bool shared_relation, bool mapped_relation, bool allow_system_table_mods); extern Oid heap_create_with_catalog(const char *relname, Oid relnamespace, Oid reltablespace, Oid relid, Oid reltypeid, Oid reloftypeid, Oid ownerid, TupleDesc tupdesc, List *cooked_constraints, char relkind, char relpersistence, bool shared_relation, bool mapped_relation, bool oidislocal, int oidinhcount, OnCommitAction oncommit, Datum reloptions, bool use_user_acl, bool allow_system_table_mods); extern void heap_create_init_fork(Relation rel); extern void heap_drop_with_catalog(Oid relid); extern void heap_truncate(List *relids); extern void heap_truncate_one_rel(Relation rel); extern void heap_truncate_check_FKs(List *relations, bool tempTables); extern List *heap_truncate_find_FKs(List *relationIds); extern void InsertPgAttributeTuple(Relation pg_attribute_rel, Form_pg_attribute new_attribute, CatalogIndexState indstate); extern void InsertPgClassTuple(Relation pg_class_desc, Relation new_rel_desc, Oid new_rel_oid, Datum relacl, Datum reloptions); extern List *AddRelationNewConstraints(Relation rel, List *newColDefaults, List *newConstraints, bool allow_merge, bool is_local); extern void StoreAttrDefault(Relation rel, AttrNumber attnum, Node *expr); extern Node *cookDefault(ParseState *pstate, Node *raw_default, Oid atttypid, int32 atttypmod, char *attname); extern void DeleteRelationTuple(Oid relid); extern void DeleteAttributeTuples(Oid relid); extern void RemoveAttributeById(Oid relid, AttrNumber attnum); extern void RemoveAttrDefault(Oid relid, AttrNumber attnum, DropBehavior behavior, bool complain, bool internal); extern void RemoveAttrDefaultById(Oid attrdefId); extern void RemoveStatistics(Oid relid, AttrNumber attnum); extern Form_pg_attribute SystemAttributeDefinition(AttrNumber attno, bool relhasoids); extern Form_pg_attribute SystemAttributeByName(const char *attname, bool relhasoids); extern void CheckAttributeNamesTypes(TupleDesc tupdesc, char relkind, bool allow_system_table_mods); extern void CheckAttributeType(const char *attname, Oid atttypid, Oid attcollation, List *containing_rowtypes, bool allow_system_table_mods); #endif /* HEAP_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_am.h������������������������������������������������������������������������0000644�����������������00000013465�14763166026�0012072 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_am.h * definition of the system "access method" relation (pg_am) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_am.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * * XXX do NOT break up DATA() statements into multiple lines! * the scripts are not as smart as you might think... * *------------------------------------------------------------------------- */ #ifndef PG_AM_H #define PG_AM_H #include "catalog/genbki.h" /* ---------------- * pg_am definition. cpp turns this into * typedef struct FormData_pg_am * ---------------- */ #define AccessMethodRelationId 2601 CATALOG(pg_am,2601) { NameData amname; /* access method name */ int2 amstrategies; /* total number of strategies (operators) by * which we can traverse/search this AM. Zero * if AM does not have a fixed set of strategy * assignments. */ int2 amsupport; /* total number of support functions that this * AM uses */ bool amcanorder; /* does AM support order by column value? */ bool amcanorderbyop; /* does AM support order by operator result? */ bool amcanbackward; /* does AM support backward scan? */ bool amcanunique; /* does AM support UNIQUE indexes? */ bool amcanmulticol; /* does AM support multi-column indexes? */ bool amoptionalkey; /* can query omit key for the first column? */ bool amsearcharray; /* can AM handle ScalarArrayOpExpr quals? */ bool amsearchnulls; /* can AM search for NULL/NOT NULL entries? */ bool amstorage; /* can storage type differ from column type? */ bool amclusterable; /* does AM support cluster command? */ bool ampredlocks; /* does AM handle predicate locks? */ Oid amkeytype; /* type of data in index, or InvalidOid */ regproc aminsert; /* "insert this tuple" function */ regproc ambeginscan; /* "prepare for index scan" function */ regproc amgettuple; /* "next valid tuple" function, or 0 */ regproc amgetbitmap; /* "fetch all valid tuples" function, or 0 */ regproc amrescan; /* "(re)start index scan" function */ regproc amendscan; /* "end index scan" function */ regproc ammarkpos; /* "mark current scan position" function */ regproc amrestrpos; /* "restore marked scan position" function */ regproc ambuild; /* "build new index" function */ regproc ambuildempty; /* "build empty index" function */ regproc ambulkdelete; /* bulk-delete function */ regproc amvacuumcleanup; /* post-VACUUM cleanup function */ regproc amcanreturn; /* can indexscan return IndexTuples? */ regproc amcostestimate; /* estimate cost of an indexscan */ regproc amoptions; /* parse AM-specific parameters */ } FormData_pg_am; /* ---------------- * Form_pg_am corresponds to a pointer to a tuple with * the format of pg_am relation. * ---------------- */ typedef FormData_pg_am *Form_pg_am; /* ---------------- * compiler constants for pg_am * ---------------- */ #define Natts_pg_am 30 #define Anum_pg_am_amname 1 #define Anum_pg_am_amstrategies 2 #define Anum_pg_am_amsupport 3 #define Anum_pg_am_amcanorder 4 #define Anum_pg_am_amcanorderbyop 5 #define Anum_pg_am_amcanbackward 6 #define Anum_pg_am_amcanunique 7 #define Anum_pg_am_amcanmulticol 8 #define Anum_pg_am_amoptionalkey 9 #define Anum_pg_am_amsearcharray 10 #define Anum_pg_am_amsearchnulls 11 #define Anum_pg_am_amstorage 12 #define Anum_pg_am_amclusterable 13 #define Anum_pg_am_ampredlocks 14 #define Anum_pg_am_amkeytype 15 #define Anum_pg_am_aminsert 16 #define Anum_pg_am_ambeginscan 17 #define Anum_pg_am_amgettuple 18 #define Anum_pg_am_amgetbitmap 19 #define Anum_pg_am_amrescan 20 #define Anum_pg_am_amendscan 21 #define Anum_pg_am_ammarkpos 22 #define Anum_pg_am_amrestrpos 23 #define Anum_pg_am_ambuild 24 #define Anum_pg_am_ambuildempty 25 #define Anum_pg_am_ambulkdelete 26 #define Anum_pg_am_amvacuumcleanup 27 #define Anum_pg_am_amcanreturn 28 #define Anum_pg_am_amcostestimate 29 #define Anum_pg_am_amoptions 30 /* ---------------- * initial contents of pg_am * ---------------- */ DATA(insert OID = 403 ( btree 5 2 t f t t t t t t f t t 0 btinsert btbeginscan btgettuple btgetbitmap btrescan btendscan btmarkpos btrestrpos btbuild btbuildempty btbulkdelete btvacuumcleanup btcanreturn btcostestimate btoptions )); DESCR("b-tree index access method"); #define BTREE_AM_OID 403 DATA(insert OID = 405 ( hash 1 1 f f t f f f f f f f f 23 hashinsert hashbeginscan hashgettuple hashgetbitmap hashrescan hashendscan hashmarkpos hashrestrpos hashbuild hashbuildempty hashbulkdelete hashvacuumcleanup - hashcostestimate hashoptions )); DESCR("hash index access method"); #define HASH_AM_OID 405 DATA(insert OID = 783 ( gist 0 8 f t f f t t f t t t f 0 gistinsert gistbeginscan gistgettuple gistgetbitmap gistrescan gistendscan gistmarkpos gistrestrpos gistbuild gistbuildempty gistbulkdelete gistvacuumcleanup - gistcostestimate gistoptions )); DESCR("GiST index access method"); #define GIST_AM_OID 783 DATA(insert OID = 2742 ( gin 0 5 f f f f t t f f t f f 0 gininsert ginbeginscan - gingetbitmap ginrescan ginendscan ginmarkpos ginrestrpos ginbuild ginbuildempty ginbulkdelete ginvacuumcleanup - gincostestimate ginoptions )); DESCR("GIN index access method"); #define GIN_AM_OID 2742 DATA(insert OID = 4000 ( spgist 0 5 f f f f f t f t f f f 0 spginsert spgbeginscan spggettuple spggetbitmap spgrescan spgendscan spgmarkpos spgrestrpos spgbuild spgbuildempty spgbulkdelete spgvacuumcleanup spgcanreturn spgcostestimate spgoptions )); DESCR("SP-GiST index access method"); #define SPGIST_AM_OID 4000 #endif /* PG_AM_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_proc.h����������������������������������������������������������������������0000644�����������������00001605276�14763166026�0012450 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_proc.h * definition of the system "procedure" relation (pg_proc) * along with the relation's initial contents. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_proc.h * * NOTES * The script catalog/genbki.pl reads this file and generates .bki * information from the DATA() statements. utils/Gen_fmgrtab.pl * generates fmgroids.h and fmgrtab.c the same way. * * XXX do NOT break up DATA() statements into multiple lines! * the scripts are not as smart as you might think... * XXX (eg. #if 0 #endif won't do what you think) * *------------------------------------------------------------------------- */ #ifndef PG_PROC_H #define PG_PROC_H #include "catalog/genbki.h" /* ---------------- * pg_proc definition. cpp turns this into * typedef struct FormData_pg_proc * ---------------- */ #define ProcedureRelationId 1255 #define ProcedureRelation_Rowtype_Id 81 CATALOG(pg_proc,1255) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81) BKI_SCHEMA_MACRO { NameData proname; /* procedure name */ Oid pronamespace; /* OID of namespace containing this proc */ Oid proowner; /* procedure owner */ Oid prolang; /* OID of pg_language entry */ float4 procost; /* estimated execution cost */ float4 prorows; /* estimated # of rows out (if proretset) */ Oid provariadic; /* element type of variadic array, or 0 */ regproc protransform; /* transforms calls to it during planning */ bool proisagg; /* is it an aggregate? */ bool proiswindow; /* is it a window function? */ bool prosecdef; /* security definer */ bool proleakproof; /* is it a leak-proof function? */ bool proisstrict; /* strict with respect to NULLs? */ bool proretset; /* returns a set? */ char provolatile; /* see PROVOLATILE_ categories below */ int2 pronargs; /* number of arguments */ int2 pronargdefaults; /* number of arguments with defaults */ Oid prorettype; /* OID of result type */ /* * variable-length fields start here, but we allow direct access to * proargtypes */ oidvector proargtypes; /* parameter types (excludes OUT params) */ #ifdef CATALOG_VARLEN Oid proallargtypes[1]; /* all param types (NULL if IN only) */ char proargmodes[1]; /* parameter modes (NULL if IN only) */ text proargnames[1]; /* parameter names (NULL if no names) */ pg_node_tree proargdefaults;/* list of expression trees for argument * defaults (NULL if none) */ text prosrc; /* procedure source text */ text probin; /* secondary procedure info (can be NULL) */ text proconfig[1]; /* procedure-local GUC settings */ aclitem proacl[1]; /* access permissions */ #endif } FormData_pg_proc; /* ---------------- * Form_pg_proc corresponds to a pointer to a tuple with * the format of pg_proc relation. * ---------------- */ typedef FormData_pg_proc *Form_pg_proc; /* ---------------- * compiler constants for pg_proc * ---------------- */ #define Natts_pg_proc 27 #define Anum_pg_proc_proname 1 #define Anum_pg_proc_pronamespace 2 #define Anum_pg_proc_proowner 3 #define Anum_pg_proc_prolang 4 #define Anum_pg_proc_procost 5 #define Anum_pg_proc_prorows 6 #define Anum_pg_proc_provariadic 7 #define Anum_pg_proc_protransform 8 #define Anum_pg_proc_proisagg 9 #define Anum_pg_proc_proiswindow 10 #define Anum_pg_proc_prosecdef 11 #define Anum_pg_proc_proleakproof 12 #define Anum_pg_proc_proisstrict 13 #define Anum_pg_proc_proretset 14 #define Anum_pg_proc_provolatile 15 #define Anum_pg_proc_pronargs 16 #define Anum_pg_proc_pronargdefaults 17 #define Anum_pg_proc_prorettype 18 #define Anum_pg_proc_proargtypes 19 #define Anum_pg_proc_proallargtypes 20 #define Anum_pg_proc_proargmodes 21 #define Anum_pg_proc_proargnames 22 #define Anum_pg_proc_proargdefaults 23 #define Anum_pg_proc_prosrc 24 #define Anum_pg_proc_probin 25 #define Anum_pg_proc_proconfig 26 #define Anum_pg_proc_proacl 27 /* ---------------- * initial contents of pg_proc * ---------------- */ /* * Note: every entry in pg_proc.h is expected to have a DESCR() comment, * except for functions that implement pg_operator.h operators and don't * have a good reason to be called directly rather than via the operator. * (If you do expect such a function to be used directly, you should * duplicate the operator's comment.) initdb will supply suitable default * comments for functions referenced by pg_operator. * * Try to follow the style of existing functions' comments. * Some recommended conventions: * "I/O" for typinput, typoutput, typreceive, typsend functions * "I/O typmod" for typmodin, typmodout functions * "aggregate transition function" for aggtransfn functions, unless * they are reasonably useful in their own right * "aggregate final function" for aggfinalfn functions (likewise) * "convert srctypename to desttypename" for cast functions * "less-equal-greater" for B-tree comparison functions */ /* keep the following ordered by OID so that later changes can be made easier */ /* OIDS 1 - 99 */ DATA(insert OID = 1242 ( boolin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "2275" _null_ _null_ _null_ _null_ boolin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1243 ( boolout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "16" _null_ _null_ _null_ _null_ boolout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1244 ( byteain PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "2275" _null_ _null_ _null_ _null_ byteain _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 31 ( byteaout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "17" _null_ _null_ _null_ _null_ byteaout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1245 ( charin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 18 "2275" _null_ _null_ _null_ _null_ charin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 33 ( charout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "18" _null_ _null_ _null_ _null_ charout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 34 ( namein PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 19 "2275" _null_ _null_ _null_ _null_ namein _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 35 ( nameout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "19" _null_ _null_ _null_ _null_ nameout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 38 ( int2in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "2275" _null_ _null_ _null_ _null_ int2in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 39 ( int2out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "21" _null_ _null_ _null_ _null_ int2out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 40 ( int2vectorin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 22 "2275" _null_ _null_ _null_ _null_ int2vectorin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 41 ( int2vectorout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "22" _null_ _null_ _null_ _null_ int2vectorout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 42 ( int4in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "2275" _null_ _null_ _null_ _null_ int4in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 43 ( int4out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ int4out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 44 ( regprocin PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 24 "2275" _null_ _null_ _null_ _null_ regprocin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 45 ( regprocout PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "24" _null_ _null_ _null_ _null_ regprocout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 46 ( textin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "2275" _null_ _null_ _null_ _null_ textin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 47 ( textout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "25" _null_ _null_ _null_ _null_ textout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 48 ( tidin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 27 "2275" _null_ _null_ _null_ _null_ tidin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 49 ( tidout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "27" _null_ _null_ _null_ _null_ tidout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 50 ( xidin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 28 "2275" _null_ _null_ _null_ _null_ xidin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 51 ( xidout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "28" _null_ _null_ _null_ _null_ xidout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 52 ( cidin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 29 "2275" _null_ _null_ _null_ _null_ cidin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 53 ( cidout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "29" _null_ _null_ _null_ _null_ cidout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 54 ( oidvectorin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 30 "2275" _null_ _null_ _null_ _null_ oidvectorin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 55 ( oidvectorout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "30" _null_ _null_ _null_ _null_ oidvectorout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 56 ( boollt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ boollt _null_ _null_ _null_ )); DATA(insert OID = 57 ( boolgt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ boolgt _null_ _null_ _null_ )); DATA(insert OID = 60 ( booleq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ booleq _null_ _null_ _null_ )); DATA(insert OID = 61 ( chareq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "18 18" _null_ _null_ _null_ _null_ chareq _null_ _null_ _null_ )); DATA(insert OID = 62 ( nameeq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "19 19" _null_ _null_ _null_ _null_ nameeq _null_ _null_ _null_ )); DATA(insert OID = 63 ( int2eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 21" _null_ _null_ _null_ _null_ int2eq _null_ _null_ _null_ )); DATA(insert OID = 64 ( int2lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 21" _null_ _null_ _null_ _null_ int2lt _null_ _null_ _null_ )); DATA(insert OID = 65 ( int4eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 23" _null_ _null_ _null_ _null_ int4eq _null_ _null_ _null_ )); DATA(insert OID = 66 ( int4lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 23" _null_ _null_ _null_ _null_ int4lt _null_ _null_ _null_ )); DATA(insert OID = 67 ( texteq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ texteq _null_ _null_ _null_ )); DATA(insert OID = 68 ( xideq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "28 28" _null_ _null_ _null_ _null_ xideq _null_ _null_ _null_ )); DATA(insert OID = 69 ( cideq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "29 29" _null_ _null_ _null_ _null_ cideq _null_ _null_ _null_ )); DATA(insert OID = 70 ( charne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "18 18" _null_ _null_ _null_ _null_ charne _null_ _null_ _null_ )); DATA(insert OID = 1246 ( charlt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "18 18" _null_ _null_ _null_ _null_ charlt _null_ _null_ _null_ )); DATA(insert OID = 72 ( charle PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "18 18" _null_ _null_ _null_ _null_ charle _null_ _null_ _null_ )); DATA(insert OID = 73 ( chargt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "18 18" _null_ _null_ _null_ _null_ chargt _null_ _null_ _null_ )); DATA(insert OID = 74 ( charge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "18 18" _null_ _null_ _null_ _null_ charge _null_ _null_ _null_ )); DATA(insert OID = 77 ( int4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "18" _null_ _null_ _null_ _null_ chartoi4 _null_ _null_ _null_ )); DESCR("convert char to int4"); DATA(insert OID = 78 ( char PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 18 "23" _null_ _null_ _null_ _null_ i4tochar _null_ _null_ _null_ )); DESCR("convert int4 to char"); DATA(insert OID = 79 ( nameregexeq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ nameregexeq _null_ _null_ _null_ )); DATA(insert OID = 1252 ( nameregexne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ nameregexne _null_ _null_ _null_ )); DATA(insert OID = 1254 ( textregexeq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ textregexeq _null_ _null_ _null_ )); DATA(insert OID = 1256 ( textregexne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ textregexne _null_ _null_ _null_ )); DATA(insert OID = 1257 ( textlen PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ textlen _null_ _null_ _null_ )); DESCR("length"); DATA(insert OID = 1258 ( textcat PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ textcat _null_ _null_ _null_ )); DATA(insert OID = 84 ( boolne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ boolne _null_ _null_ _null_ )); DATA(insert OID = 89 ( version PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 25 "" _null_ _null_ _null_ _null_ pgsql_version _null_ _null_ _null_ )); DESCR("PostgreSQL version string"); /* OIDS 100 - 199 */ DATA(insert OID = 101 ( eqsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ eqsel _null_ _null_ _null_ )); DESCR("restriction selectivity of = and related operators"); DATA(insert OID = 102 ( neqsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ neqsel _null_ _null_ _null_ )); DESCR("restriction selectivity of <> and related operators"); DATA(insert OID = 103 ( scalarltsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ scalarltsel _null_ _null_ _null_ )); DESCR("restriction selectivity of < and related operators on scalar datatypes"); DATA(insert OID = 104 ( scalargtsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ scalargtsel _null_ _null_ _null_ )); DESCR("restriction selectivity of > and related operators on scalar datatypes"); DATA(insert OID = 105 ( eqjoinsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ eqjoinsel _null_ _null_ _null_ )); DESCR("join selectivity of = and related operators"); DATA(insert OID = 106 ( neqjoinsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ neqjoinsel _null_ _null_ _null_ )); DESCR("join selectivity of <> and related operators"); DATA(insert OID = 107 ( scalarltjoinsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ scalarltjoinsel _null_ _null_ _null_ )); DESCR("join selectivity of < and related operators on scalar datatypes"); DATA(insert OID = 108 ( scalargtjoinsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ scalargtjoinsel _null_ _null_ _null_ )); DESCR("join selectivity of > and related operators on scalar datatypes"); DATA(insert OID = 109 ( unknownin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 705 "2275" _null_ _null_ _null_ _null_ unknownin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 110 ( unknownout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "705" _null_ _null_ _null_ _null_ unknownout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 111 ( numeric_fac PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "20" _null_ _null_ _null_ _null_ numeric_fac _null_ _null_ _null_ )); DATA(insert OID = 115 ( box_above_eq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_above_eq _null_ _null_ _null_ )); DATA(insert OID = 116 ( box_below_eq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_below_eq _null_ _null_ _null_ )); DATA(insert OID = 117 ( point_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "2275" _null_ _null_ _null_ _null_ point_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 118 ( point_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "600" _null_ _null_ _null_ _null_ point_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 119 ( lseg_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 601 "2275" _null_ _null_ _null_ _null_ lseg_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 120 ( lseg_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "601" _null_ _null_ _null_ _null_ lseg_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 121 ( path_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 602 "2275" _null_ _null_ _null_ _null_ path_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 122 ( path_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "602" _null_ _null_ _null_ _null_ path_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 123 ( box_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 603 "2275" _null_ _null_ _null_ _null_ box_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 124 ( box_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "603" _null_ _null_ _null_ _null_ box_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 125 ( box_overlap PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_overlap _null_ _null_ _null_ )); DATA(insert OID = 126 ( box_ge PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_ge _null_ _null_ _null_ )); DATA(insert OID = 127 ( box_gt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_gt _null_ _null_ _null_ )); DATA(insert OID = 128 ( box_eq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_eq _null_ _null_ _null_ )); DATA(insert OID = 129 ( box_lt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_lt _null_ _null_ _null_ )); DATA(insert OID = 130 ( box_le PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_le _null_ _null_ _null_ )); DATA(insert OID = 131 ( point_above PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_ point_above _null_ _null_ _null_ )); DATA(insert OID = 132 ( point_left PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_ point_left _null_ _null_ _null_ )); DATA(insert OID = 133 ( point_right PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_ point_right _null_ _null_ _null_ )); DATA(insert OID = 134 ( point_below PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_ point_below _null_ _null_ _null_ )); DATA(insert OID = 135 ( point_eq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_ point_eq _null_ _null_ _null_ )); DATA(insert OID = 136 ( on_pb PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 603" _null_ _null_ _null_ _null_ on_pb _null_ _null_ _null_ )); DATA(insert OID = 137 ( on_ppath PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 602" _null_ _null_ _null_ _null_ on_ppath _null_ _null_ _null_ )); DATA(insert OID = 138 ( box_center PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "603" _null_ _null_ _null_ _null_ box_center _null_ _null_ _null_ )); DATA(insert OID = 139 ( areasel PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ areasel _null_ _null_ _null_ )); DESCR("restriction selectivity for area-comparison operators"); DATA(insert OID = 140 ( areajoinsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ areajoinsel _null_ _null_ _null_ )); DESCR("join selectivity for area-comparison operators"); DATA(insert OID = 141 ( int4mul PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ int4mul _null_ _null_ _null_ )); DATA(insert OID = 144 ( int4ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 23" _null_ _null_ _null_ _null_ int4ne _null_ _null_ _null_ )); DATA(insert OID = 145 ( int2ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 21" _null_ _null_ _null_ _null_ int2ne _null_ _null_ _null_ )); DATA(insert OID = 146 ( int2gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 21" _null_ _null_ _null_ _null_ int2gt _null_ _null_ _null_ )); DATA(insert OID = 147 ( int4gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 23" _null_ _null_ _null_ _null_ int4gt _null_ _null_ _null_ )); DATA(insert OID = 148 ( int2le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 21" _null_ _null_ _null_ _null_ int2le _null_ _null_ _null_ )); DATA(insert OID = 149 ( int4le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 23" _null_ _null_ _null_ _null_ int4le _null_ _null_ _null_ )); DATA(insert OID = 150 ( int4ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 23" _null_ _null_ _null_ _null_ int4ge _null_ _null_ _null_ )); DATA(insert OID = 151 ( int2ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 21" _null_ _null_ _null_ _null_ int2ge _null_ _null_ _null_ )); DATA(insert OID = 152 ( int2mul PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ int2mul _null_ _null_ _null_ )); DATA(insert OID = 153 ( int2div PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ int2div _null_ _null_ _null_ )); DATA(insert OID = 154 ( int4div PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ int4div _null_ _null_ _null_ )); DATA(insert OID = 155 ( int2mod PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ int2mod _null_ _null_ _null_ )); DATA(insert OID = 156 ( int4mod PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ int4mod _null_ _null_ _null_ )); DATA(insert OID = 157 ( textne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ textne _null_ _null_ _null_ )); DATA(insert OID = 158 ( int24eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 23" _null_ _null_ _null_ _null_ int24eq _null_ _null_ _null_ )); DATA(insert OID = 159 ( int42eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 21" _null_ _null_ _null_ _null_ int42eq _null_ _null_ _null_ )); DATA(insert OID = 160 ( int24lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 23" _null_ _null_ _null_ _null_ int24lt _null_ _null_ _null_ )); DATA(insert OID = 161 ( int42lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 21" _null_ _null_ _null_ _null_ int42lt _null_ _null_ _null_ )); DATA(insert OID = 162 ( int24gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 23" _null_ _null_ _null_ _null_ int24gt _null_ _null_ _null_ )); DATA(insert OID = 163 ( int42gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 21" _null_ _null_ _null_ _null_ int42gt _null_ _null_ _null_ )); DATA(insert OID = 164 ( int24ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 23" _null_ _null_ _null_ _null_ int24ne _null_ _null_ _null_ )); DATA(insert OID = 165 ( int42ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 21" _null_ _null_ _null_ _null_ int42ne _null_ _null_ _null_ )); DATA(insert OID = 166 ( int24le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 23" _null_ _null_ _null_ _null_ int24le _null_ _null_ _null_ )); DATA(insert OID = 167 ( int42le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 21" _null_ _null_ _null_ _null_ int42le _null_ _null_ _null_ )); DATA(insert OID = 168 ( int24ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 23" _null_ _null_ _null_ _null_ int24ge _null_ _null_ _null_ )); DATA(insert OID = 169 ( int42ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 21" _null_ _null_ _null_ _null_ int42ge _null_ _null_ _null_ )); DATA(insert OID = 170 ( int24mul PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "21 23" _null_ _null_ _null_ _null_ int24mul _null_ _null_ _null_ )); DATA(insert OID = 171 ( int42mul PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 21" _null_ _null_ _null_ _null_ int42mul _null_ _null_ _null_ )); DATA(insert OID = 172 ( int24div PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "21 23" _null_ _null_ _null_ _null_ int24div _null_ _null_ _null_ )); DATA(insert OID = 173 ( int42div PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 21" _null_ _null_ _null_ _null_ int42div _null_ _null_ _null_ )); DATA(insert OID = 176 ( int2pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ int2pl _null_ _null_ _null_ )); DATA(insert OID = 177 ( int4pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ int4pl _null_ _null_ _null_ )); DATA(insert OID = 178 ( int24pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "21 23" _null_ _null_ _null_ _null_ int24pl _null_ _null_ _null_ )); DATA(insert OID = 179 ( int42pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 21" _null_ _null_ _null_ _null_ int42pl _null_ _null_ _null_ )); DATA(insert OID = 180 ( int2mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ int2mi _null_ _null_ _null_ )); DATA(insert OID = 181 ( int4mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ int4mi _null_ _null_ _null_ )); DATA(insert OID = 182 ( int24mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "21 23" _null_ _null_ _null_ _null_ int24mi _null_ _null_ _null_ )); DATA(insert OID = 183 ( int42mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 21" _null_ _null_ _null_ _null_ int42mi _null_ _null_ _null_ )); DATA(insert OID = 184 ( oideq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "26 26" _null_ _null_ _null_ _null_ oideq _null_ _null_ _null_ )); DATA(insert OID = 185 ( oidne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "26 26" _null_ _null_ _null_ _null_ oidne _null_ _null_ _null_ )); DATA(insert OID = 186 ( box_same PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_same _null_ _null_ _null_ )); DATA(insert OID = 187 ( box_contain PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_contain _null_ _null_ _null_ )); DATA(insert OID = 188 ( box_left PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_left _null_ _null_ _null_ )); DATA(insert OID = 189 ( box_overleft PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_overleft _null_ _null_ _null_ )); DATA(insert OID = 190 ( box_overright PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_overright _null_ _null_ _null_ )); DATA(insert OID = 191 ( box_right PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_right _null_ _null_ _null_ )); DATA(insert OID = 192 ( box_contained PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_contained _null_ _null_ _null_ )); DATA(insert OID = 193 ( box_contain_pt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 600" _null_ _null_ _null_ _null_ box_contain_pt _null_ _null_ _null_ )); DATA(insert OID = 195 ( pg_node_tree_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 194 "2275" _null_ _null_ _null_ _null_ pg_node_tree_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 196 ( pg_node_tree_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "194" _null_ _null_ _null_ _null_ pg_node_tree_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 197 ( pg_node_tree_recv PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 194 "2281" _null_ _null_ _null_ _null_ pg_node_tree_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 198 ( pg_node_tree_send PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "194" _null_ _null_ _null_ _null_ pg_node_tree_send _null_ _null_ _null_ )); DESCR("I/O"); /* OIDS 200 - 299 */ DATA(insert OID = 200 ( float4in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "2275" _null_ _null_ _null_ _null_ float4in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 201 ( float4out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "700" _null_ _null_ _null_ _null_ float4out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 202 ( float4mul PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 700 "700 700" _null_ _null_ _null_ _null_ float4mul _null_ _null_ _null_ )); DATA(insert OID = 203 ( float4div PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 700 "700 700" _null_ _null_ _null_ _null_ float4div _null_ _null_ _null_ )); DATA(insert OID = 204 ( float4pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 700 "700 700" _null_ _null_ _null_ _null_ float4pl _null_ _null_ _null_ )); DATA(insert OID = 205 ( float4mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 700 "700 700" _null_ _null_ _null_ _null_ float4mi _null_ _null_ _null_ )); DATA(insert OID = 206 ( float4um PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "700" _null_ _null_ _null_ _null_ float4um _null_ _null_ _null_ )); DATA(insert OID = 207 ( float4abs PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "700" _null_ _null_ _null_ _null_ float4abs _null_ _null_ _null_ )); DATA(insert OID = 208 ( float4_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1022 "1022 700" _null_ _null_ _null_ _null_ float4_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 209 ( float4larger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 700 "700 700" _null_ _null_ _null_ _null_ float4larger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 211 ( float4smaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 700 "700 700" _null_ _null_ _null_ _null_ float4smaller _null_ _null_ _null_ )); DESCR("smaller of two"); DATA(insert OID = 212 ( int4um PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ int4um _null_ _null_ _null_ )); DATA(insert OID = 213 ( int2um PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "21" _null_ _null_ _null_ _null_ int2um _null_ _null_ _null_ )); DATA(insert OID = 214 ( float8in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "2275" _null_ _null_ _null_ _null_ float8in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 215 ( float8out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "701" _null_ _null_ _null_ _null_ float8out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 216 ( float8mul PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ float8mul _null_ _null_ _null_ )); DATA(insert OID = 217 ( float8div PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ float8div _null_ _null_ _null_ )); DATA(insert OID = 218 ( float8pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ float8pl _null_ _null_ _null_ )); DATA(insert OID = 219 ( float8mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ float8mi _null_ _null_ _null_ )); DATA(insert OID = 220 ( float8um PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ float8um _null_ _null_ _null_ )); DATA(insert OID = 221 ( float8abs PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ float8abs _null_ _null_ _null_ )); DATA(insert OID = 222 ( float8_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1022 "1022 701" _null_ _null_ _null_ _null_ float8_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 223 ( float8larger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ float8larger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 224 ( float8smaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ float8smaller _null_ _null_ _null_ )); DESCR("smaller of two"); DATA(insert OID = 225 ( lseg_center PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "601" _null_ _null_ _null_ _null_ lseg_center _null_ _null_ _null_ )); DATA(insert OID = 226 ( path_center PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "602" _null_ _null_ _null_ _null_ path_center _null_ _null_ _null_ )); DATA(insert OID = 227 ( poly_center PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "604" _null_ _null_ _null_ _null_ poly_center _null_ _null_ _null_ )); DATA(insert OID = 228 ( dround PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dround _null_ _null_ _null_ )); DESCR("round to nearest integer"); DATA(insert OID = 229 ( dtrunc PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dtrunc _null_ _null_ _null_ )); DESCR("truncate to integer"); DATA(insert OID = 2308 ( ceil PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dceil _null_ _null_ _null_ )); DESCR("nearest integer >= value"); DATA(insert OID = 2320 ( ceiling PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dceil _null_ _null_ _null_ )); DESCR("nearest integer >= value"); DATA(insert OID = 2309 ( floor PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dfloor _null_ _null_ _null_ )); DESCR("nearest integer <= value"); DATA(insert OID = 2310 ( sign PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dsign _null_ _null_ _null_ )); DESCR("sign of value"); DATA(insert OID = 230 ( dsqrt PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dsqrt _null_ _null_ _null_ )); DATA(insert OID = 231 ( dcbrt PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dcbrt _null_ _null_ _null_ )); DATA(insert OID = 232 ( dpow PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ dpow _null_ _null_ _null_ )); DATA(insert OID = 233 ( dexp PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dexp _null_ _null_ _null_ )); DESCR("natural exponential (e^x)"); DATA(insert OID = 234 ( dlog1 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dlog1 _null_ _null_ _null_ )); DESCR("natural logarithm"); DATA(insert OID = 235 ( float8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "21" _null_ _null_ _null_ _null_ i2tod _null_ _null_ _null_ )); DESCR("convert int2 to float8"); DATA(insert OID = 236 ( float4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "21" _null_ _null_ _null_ _null_ i2tof _null_ _null_ _null_ )); DESCR("convert int2 to float4"); DATA(insert OID = 237 ( int2 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "701" _null_ _null_ _null_ _null_ dtoi2 _null_ _null_ _null_ )); DESCR("convert float8 to int2"); DATA(insert OID = 238 ( int2 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "700" _null_ _null_ _null_ _null_ ftoi2 _null_ _null_ _null_ )); DESCR("convert float4 to int2"); DATA(insert OID = 239 ( line_distance PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "628 628" _null_ _null_ _null_ _null_ line_distance _null_ _null_ _null_ )); DATA(insert OID = 240 ( abstimein PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 702 "2275" _null_ _null_ _null_ _null_ abstimein _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 241 ( abstimeout PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "702" _null_ _null_ _null_ _null_ abstimeout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 242 ( reltimein PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 703 "2275" _null_ _null_ _null_ _null_ reltimein _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 243 ( reltimeout PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "703" _null_ _null_ _null_ _null_ reltimeout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 244 ( timepl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 702 "702 703" _null_ _null_ _null_ _null_ timepl _null_ _null_ _null_ )); DATA(insert OID = 245 ( timemi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 702 "702 703" _null_ _null_ _null_ _null_ timemi _null_ _null_ _null_ )); DATA(insert OID = 246 ( tintervalin PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 704 "2275" _null_ _null_ _null_ _null_ tintervalin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 247 ( tintervalout PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "704" _null_ _null_ _null_ _null_ tintervalout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 248 ( intinterval PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "702 704" _null_ _null_ _null_ _null_ intinterval _null_ _null_ _null_ )); DATA(insert OID = 249 ( tintervalrel PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 703 "704" _null_ _null_ _null_ _null_ tintervalrel _null_ _null_ _null_ )); DESCR("tinterval to reltime"); DATA(insert OID = 250 ( timenow PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 702 "" _null_ _null_ _null_ _null_ timenow _null_ _null_ _null_ )); DESCR("current date and time (abstime)"); DATA(insert OID = 251 ( abstimeeq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "702 702" _null_ _null_ _null_ _null_ abstimeeq _null_ _null_ _null_ )); DATA(insert OID = 252 ( abstimene PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "702 702" _null_ _null_ _null_ _null_ abstimene _null_ _null_ _null_ )); DATA(insert OID = 253 ( abstimelt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "702 702" _null_ _null_ _null_ _null_ abstimelt _null_ _null_ _null_ )); DATA(insert OID = 254 ( abstimegt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "702 702" _null_ _null_ _null_ _null_ abstimegt _null_ _null_ _null_ )); DATA(insert OID = 255 ( abstimele PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "702 702" _null_ _null_ _null_ _null_ abstimele _null_ _null_ _null_ )); DATA(insert OID = 256 ( abstimege PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "702 702" _null_ _null_ _null_ _null_ abstimege _null_ _null_ _null_ )); DATA(insert OID = 257 ( reltimeeq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "703 703" _null_ _null_ _null_ _null_ reltimeeq _null_ _null_ _null_ )); DATA(insert OID = 258 ( reltimene PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "703 703" _null_ _null_ _null_ _null_ reltimene _null_ _null_ _null_ )); DATA(insert OID = 259 ( reltimelt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "703 703" _null_ _null_ _null_ _null_ reltimelt _null_ _null_ _null_ )); DATA(insert OID = 260 ( reltimegt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "703 703" _null_ _null_ _null_ _null_ reltimegt _null_ _null_ _null_ )); DATA(insert OID = 261 ( reltimele PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "703 703" _null_ _null_ _null_ _null_ reltimele _null_ _null_ _null_ )); DATA(insert OID = 262 ( reltimege PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "703 703" _null_ _null_ _null_ _null_ reltimege _null_ _null_ _null_ )); DATA(insert OID = 263 ( tintervalsame PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "704 704" _null_ _null_ _null_ _null_ tintervalsame _null_ _null_ _null_ )); DATA(insert OID = 264 ( tintervalct PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "704 704" _null_ _null_ _null_ _null_ tintervalct _null_ _null_ _null_ )); DATA(insert OID = 265 ( tintervalov PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "704 704" _null_ _null_ _null_ _null_ tintervalov _null_ _null_ _null_ )); DATA(insert OID = 266 ( tintervalleneq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 703" _null_ _null_ _null_ _null_ tintervalleneq _null_ _null_ _null_ )); DATA(insert OID = 267 ( tintervallenne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 703" _null_ _null_ _null_ _null_ tintervallenne _null_ _null_ _null_ )); DATA(insert OID = 268 ( tintervallenlt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 703" _null_ _null_ _null_ _null_ tintervallenlt _null_ _null_ _null_ )); DATA(insert OID = 269 ( tintervallengt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 703" _null_ _null_ _null_ _null_ tintervallengt _null_ _null_ _null_ )); DATA(insert OID = 270 ( tintervallenle PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 703" _null_ _null_ _null_ _null_ tintervallenle _null_ _null_ _null_ )); DATA(insert OID = 271 ( tintervallenge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 703" _null_ _null_ _null_ _null_ tintervallenge _null_ _null_ _null_ )); DATA(insert OID = 272 ( tintervalstart PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 702 "704" _null_ _null_ _null_ _null_ tintervalstart _null_ _null_ _null_ )); DATA(insert OID = 273 ( tintervalend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 702 "704" _null_ _null_ _null_ _null_ tintervalend _null_ _null_ _null_ )); DESCR("end of interval"); DATA(insert OID = 274 ( timeofday PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ timeofday _null_ _null_ _null_ )); DESCR("current date and time - increments during transactions"); DATA(insert OID = 275 ( isfinite PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "702" _null_ _null_ _null_ _null_ abstime_finite _null_ _null_ _null_ )); DESCR("finite abstime?"); DATA(insert OID = 277 ( inter_sl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "601 628" _null_ _null_ _null_ _null_ inter_sl _null_ _null_ _null_ )); DATA(insert OID = 278 ( inter_lb PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "628 603" _null_ _null_ _null_ _null_ inter_lb _null_ _null_ _null_ )); DATA(insert OID = 279 ( float48mul PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "700 701" _null_ _null_ _null_ _null_ float48mul _null_ _null_ _null_ )); DATA(insert OID = 280 ( float48div PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "700 701" _null_ _null_ _null_ _null_ float48div _null_ _null_ _null_ )); DATA(insert OID = 281 ( float48pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "700 701" _null_ _null_ _null_ _null_ float48pl _null_ _null_ _null_ )); DATA(insert OID = 282 ( float48mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "700 701" _null_ _null_ _null_ _null_ float48mi _null_ _null_ _null_ )); DATA(insert OID = 283 ( float84mul PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 700" _null_ _null_ _null_ _null_ float84mul _null_ _null_ _null_ )); DATA(insert OID = 284 ( float84div PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 700" _null_ _null_ _null_ _null_ float84div _null_ _null_ _null_ )); DATA(insert OID = 285 ( float84pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 700" _null_ _null_ _null_ _null_ float84pl _null_ _null_ _null_ )); DATA(insert OID = 286 ( float84mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 700" _null_ _null_ _null_ _null_ float84mi _null_ _null_ _null_ )); DATA(insert OID = 287 ( float4eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 700" _null_ _null_ _null_ _null_ float4eq _null_ _null_ _null_ )); DATA(insert OID = 288 ( float4ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 700" _null_ _null_ _null_ _null_ float4ne _null_ _null_ _null_ )); DATA(insert OID = 289 ( float4lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 700" _null_ _null_ _null_ _null_ float4lt _null_ _null_ _null_ )); DATA(insert OID = 290 ( float4le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 700" _null_ _null_ _null_ _null_ float4le _null_ _null_ _null_ )); DATA(insert OID = 291 ( float4gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 700" _null_ _null_ _null_ _null_ float4gt _null_ _null_ _null_ )); DATA(insert OID = 292 ( float4ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 700" _null_ _null_ _null_ _null_ float4ge _null_ _null_ _null_ )); DATA(insert OID = 293 ( float8eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 701" _null_ _null_ _null_ _null_ float8eq _null_ _null_ _null_ )); DATA(insert OID = 294 ( float8ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 701" _null_ _null_ _null_ _null_ float8ne _null_ _null_ _null_ )); DATA(insert OID = 295 ( float8lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 701" _null_ _null_ _null_ _null_ float8lt _null_ _null_ _null_ )); DATA(insert OID = 296 ( float8le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 701" _null_ _null_ _null_ _null_ float8le _null_ _null_ _null_ )); DATA(insert OID = 297 ( float8gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 701" _null_ _null_ _null_ _null_ float8gt _null_ _null_ _null_ )); DATA(insert OID = 298 ( float8ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 701" _null_ _null_ _null_ _null_ float8ge _null_ _null_ _null_ )); DATA(insert OID = 299 ( float48eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 701" _null_ _null_ _null_ _null_ float48eq _null_ _null_ _null_ )); /* OIDS 300 - 399 */ DATA(insert OID = 300 ( float48ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 701" _null_ _null_ _null_ _null_ float48ne _null_ _null_ _null_ )); DATA(insert OID = 301 ( float48lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 701" _null_ _null_ _null_ _null_ float48lt _null_ _null_ _null_ )); DATA(insert OID = 302 ( float48le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 701" _null_ _null_ _null_ _null_ float48le _null_ _null_ _null_ )); DATA(insert OID = 303 ( float48gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 701" _null_ _null_ _null_ _null_ float48gt _null_ _null_ _null_ )); DATA(insert OID = 304 ( float48ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "700 701" _null_ _null_ _null_ _null_ float48ge _null_ _null_ _null_ )); DATA(insert OID = 305 ( float84eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 700" _null_ _null_ _null_ _null_ float84eq _null_ _null_ _null_ )); DATA(insert OID = 306 ( float84ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 700" _null_ _null_ _null_ _null_ float84ne _null_ _null_ _null_ )); DATA(insert OID = 307 ( float84lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 700" _null_ _null_ _null_ _null_ float84lt _null_ _null_ _null_ )); DATA(insert OID = 308 ( float84le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 700" _null_ _null_ _null_ _null_ float84le _null_ _null_ _null_ )); DATA(insert OID = 309 ( float84gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 700" _null_ _null_ _null_ _null_ float84gt _null_ _null_ _null_ )); DATA(insert OID = 310 ( float84ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "701 700" _null_ _null_ _null_ _null_ float84ge _null_ _null_ _null_ )); DATA(insert OID = 320 ( width_bucket PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 23 "701 701 701 23" _null_ _null_ _null_ _null_ width_bucket_float8 _null_ _null_ _null_ )); DESCR("bucket number of operand in equidepth histogram"); DATA(insert OID = 311 ( float8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "700" _null_ _null_ _null_ _null_ ftod _null_ _null_ _null_ )); DESCR("convert float4 to float8"); DATA(insert OID = 312 ( float4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "701" _null_ _null_ _null_ _null_ dtof _null_ _null_ _null_ )); DESCR("convert float8 to float4"); DATA(insert OID = 313 ( int4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "21" _null_ _null_ _null_ _null_ i2toi4 _null_ _null_ _null_ )); DESCR("convert int2 to int4"); DATA(insert OID = 314 ( int2 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "23" _null_ _null_ _null_ _null_ i4toi2 _null_ _null_ _null_ )); DESCR("convert int4 to int2"); DATA(insert OID = 315 ( int2vectoreq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "22 22" _null_ _null_ _null_ _null_ int2vectoreq _null_ _null_ _null_ )); DATA(insert OID = 316 ( float8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "23" _null_ _null_ _null_ _null_ i4tod _null_ _null_ _null_ )); DESCR("convert int4 to float8"); DATA(insert OID = 317 ( int4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "701" _null_ _null_ _null_ _null_ dtoi4 _null_ _null_ _null_ )); DESCR("convert float8 to int4"); DATA(insert OID = 318 ( float4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "23" _null_ _null_ _null_ _null_ i4tof _null_ _null_ _null_ )); DESCR("convert int4 to float4"); DATA(insert OID = 319 ( int4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "700" _null_ _null_ _null_ _null_ ftoi4 _null_ _null_ _null_ )); DESCR("convert float4 to int4"); DATA(insert OID = 330 ( btgettuple PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ btgettuple _null_ _null_ _null_ )); DESCR("btree(internal)"); DATA(insert OID = 636 ( btgetbitmap PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ btgetbitmap _null_ _null_ _null_ )); DESCR("btree(internal)"); DATA(insert OID = 331 ( btinsert PGNSP PGUID 12 1 0 0 0 f f f f t f v 6 0 16 "2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ btinsert _null_ _null_ _null_ )); DESCR("btree(internal)"); DATA(insert OID = 333 ( btbeginscan PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ btbeginscan _null_ _null_ _null_ )); DESCR("btree(internal)"); DATA(insert OID = 334 ( btrescan PGNSP PGUID 12 1 0 0 0 f f f f t f v 5 0 2278 "2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ btrescan _null_ _null_ _null_ )); DESCR("btree(internal)"); DATA(insert OID = 335 ( btendscan PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ btendscan _null_ _null_ _null_ )); DESCR("btree(internal)"); DATA(insert OID = 336 ( btmarkpos PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ btmarkpos _null_ _null_ _null_ )); DESCR("btree(internal)"); DATA(insert OID = 337 ( btrestrpos PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ btrestrpos _null_ _null_ _null_ )); DESCR("btree(internal)"); DATA(insert OID = 338 ( btbuild PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ btbuild _null_ _null_ _null_ )); DESCR("btree(internal)"); DATA(insert OID = 328 ( btbuildempty PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ btbuildempty _null_ _null_ _null_ )); DESCR("btree(internal)"); DATA(insert OID = 332 ( btbulkdelete PGNSP PGUID 12 1 0 0 0 f f f f t f v 4 0 2281 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ btbulkdelete _null_ _null_ _null_ )); DESCR("btree(internal)"); DATA(insert OID = 972 ( btvacuumcleanup PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ btvacuumcleanup _null_ _null_ _null_ )); DESCR("btree(internal)"); DATA(insert OID = 276 ( btcanreturn PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "2281" _null_ _null_ _null_ _null_ btcanreturn _null_ _null_ _null_ )); DESCR("btree(internal)"); DATA(insert OID = 1268 ( btcostestimate PGNSP PGUID 12 1 0 0 0 f f f f t f v 7 0 2278 "2281 2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ btcostestimate _null_ _null_ _null_ )); DESCR("btree(internal)"); DATA(insert OID = 2785 ( btoptions PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 17 "1009 16" _null_ _null_ _null_ _null_ btoptions _null_ _null_ _null_ )); DESCR("btree(internal)"); DATA(insert OID = 339 ( poly_same PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ poly_same _null_ _null_ _null_ )); DATA(insert OID = 340 ( poly_contain PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ poly_contain _null_ _null_ _null_ )); DATA(insert OID = 341 ( poly_left PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ poly_left _null_ _null_ _null_ )); DATA(insert OID = 342 ( poly_overleft PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ poly_overleft _null_ _null_ _null_ )); DATA(insert OID = 343 ( poly_overright PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ poly_overright _null_ _null_ _null_ )); DATA(insert OID = 344 ( poly_right PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ poly_right _null_ _null_ _null_ )); DATA(insert OID = 345 ( poly_contained PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ poly_contained _null_ _null_ _null_ )); DATA(insert OID = 346 ( poly_overlap PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ poly_overlap _null_ _null_ _null_ )); DATA(insert OID = 347 ( poly_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 604 "2275" _null_ _null_ _null_ _null_ poly_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 348 ( poly_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "604" _null_ _null_ _null_ _null_ poly_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 350 ( btint2cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "21 21" _null_ _null_ _null_ _null_ btint2cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 3129 ( btint2sortsupport PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ btint2sortsupport _null_ _null_ _null_ )); DESCR("sort support"); DATA(insert OID = 351 ( btint4cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ btint4cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 3130 ( btint4sortsupport PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ btint4sortsupport _null_ _null_ _null_ )); DESCR("sort support"); DATA(insert OID = 842 ( btint8cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "20 20" _null_ _null_ _null_ _null_ btint8cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 3131 ( btint8sortsupport PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ btint8sortsupport _null_ _null_ _null_ )); DESCR("sort support"); DATA(insert OID = 354 ( btfloat4cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "700 700" _null_ _null_ _null_ _null_ btfloat4cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 3132 ( btfloat4sortsupport PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ btfloat4sortsupport _null_ _null_ _null_ )); DESCR("sort support"); DATA(insert OID = 355 ( btfloat8cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "701 701" _null_ _null_ _null_ _null_ btfloat8cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 3133 ( btfloat8sortsupport PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ btfloat8sortsupport _null_ _null_ _null_ )); DESCR("sort support"); DATA(insert OID = 356 ( btoidcmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "26 26" _null_ _null_ _null_ _null_ btoidcmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 3134 ( btoidsortsupport PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ btoidsortsupport _null_ _null_ _null_ )); DESCR("sort support"); DATA(insert OID = 404 ( btoidvectorcmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "30 30" _null_ _null_ _null_ _null_ btoidvectorcmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 357 ( btabstimecmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "702 702" _null_ _null_ _null_ _null_ btabstimecmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 358 ( btcharcmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "18 18" _null_ _null_ _null_ _null_ btcharcmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 359 ( btnamecmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "19 19" _null_ _null_ _null_ _null_ btnamecmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 3135 ( btnamesortsupport PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ btnamesortsupport _null_ _null_ _null_ )); DESCR("sort support"); DATA(insert OID = 360 ( bttextcmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "25 25" _null_ _null_ _null_ _null_ bttextcmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 377 ( cash_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "790 790" _null_ _null_ _null_ _null_ cash_cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 380 ( btreltimecmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "703 703" _null_ _null_ _null_ _null_ btreltimecmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 381 ( bttintervalcmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "704 704" _null_ _null_ _null_ _null_ bttintervalcmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 382 ( btarraycmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "2277 2277" _null_ _null_ _null_ _null_ btarraycmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 361 ( lseg_distance PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "601 601" _null_ _null_ _null_ _null_ lseg_distance _null_ _null_ _null_ )); DATA(insert OID = 362 ( lseg_interpt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "601 601" _null_ _null_ _null_ _null_ lseg_interpt _null_ _null_ _null_ )); DATA(insert OID = 363 ( dist_ps PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "600 601" _null_ _null_ _null_ _null_ dist_ps _null_ _null_ _null_ )); DATA(insert OID = 364 ( dist_pb PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "600 603" _null_ _null_ _null_ _null_ dist_pb _null_ _null_ _null_ )); DATA(insert OID = 365 ( dist_sb PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "601 603" _null_ _null_ _null_ _null_ dist_sb _null_ _null_ _null_ )); DATA(insert OID = 366 ( close_ps PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "600 601" _null_ _null_ _null_ _null_ close_ps _null_ _null_ _null_ )); DATA(insert OID = 367 ( close_pb PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "600 603" _null_ _null_ _null_ _null_ close_pb _null_ _null_ _null_ )); DATA(insert OID = 368 ( close_sb PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "601 603" _null_ _null_ _null_ _null_ close_sb _null_ _null_ _null_ )); DATA(insert OID = 369 ( on_ps PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 601" _null_ _null_ _null_ _null_ on_ps _null_ _null_ _null_ )); DATA(insert OID = 370 ( path_distance PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "602 602" _null_ _null_ _null_ _null_ path_distance _null_ _null_ _null_ )); DATA(insert OID = 371 ( dist_ppath PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "600 602" _null_ _null_ _null_ _null_ dist_ppath _null_ _null_ _null_ )); DATA(insert OID = 372 ( on_sb PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "601 603" _null_ _null_ _null_ _null_ on_sb _null_ _null_ _null_ )); DATA(insert OID = 373 ( inter_sb PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "601 603" _null_ _null_ _null_ _null_ inter_sb _null_ _null_ _null_ )); /* OIDS 400 - 499 */ DATA(insert OID = 401 ( text PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "1042" _null_ _null_ _null_ _null_ rtrim1 _null_ _null_ _null_ )); DESCR("convert char(n) to text"); DATA(insert OID = 406 ( text PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "19" _null_ _null_ _null_ _null_ name_text _null_ _null_ _null_ )); DESCR("convert name to text"); DATA(insert OID = 407 ( name PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 19 "25" _null_ _null_ _null_ _null_ text_name _null_ _null_ _null_ )); DESCR("convert text to name"); DATA(insert OID = 408 ( bpchar PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1042 "19" _null_ _null_ _null_ _null_ name_bpchar _null_ _null_ _null_ )); DESCR("convert name to char(n)"); DATA(insert OID = 409 ( name PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 19 "1042" _null_ _null_ _null_ _null_ bpchar_name _null_ _null_ _null_ )); DESCR("convert char(n) to name"); DATA(insert OID = 440 ( hashgettuple PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ hashgettuple _null_ _null_ _null_ )); DESCR("hash(internal)"); DATA(insert OID = 637 ( hashgetbitmap PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ hashgetbitmap _null_ _null_ _null_ )); DESCR("hash(internal)"); DATA(insert OID = 441 ( hashinsert PGNSP PGUID 12 1 0 0 0 f f f f t f v 6 0 16 "2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ hashinsert _null_ _null_ _null_ )); DESCR("hash(internal)"); DATA(insert OID = 443 ( hashbeginscan PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ hashbeginscan _null_ _null_ _null_ )); DESCR("hash(internal)"); DATA(insert OID = 444 ( hashrescan PGNSP PGUID 12 1 0 0 0 f f f f t f v 5 0 2278 "2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ hashrescan _null_ _null_ _null_ )); DESCR("hash(internal)"); DATA(insert OID = 445 ( hashendscan PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ hashendscan _null_ _null_ _null_ )); DESCR("hash(internal)"); DATA(insert OID = 446 ( hashmarkpos PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ hashmarkpos _null_ _null_ _null_ )); DESCR("hash(internal)"); DATA(insert OID = 447 ( hashrestrpos PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ hashrestrpos _null_ _null_ _null_ )); DESCR("hash(internal)"); DATA(insert OID = 448 ( hashbuild PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ hashbuild _null_ _null_ _null_ )); DESCR("hash(internal)"); DATA(insert OID = 327 ( hashbuildempty PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ hashbuildempty _null_ _null_ _null_ )); DESCR("hash(internal)"); DATA(insert OID = 442 ( hashbulkdelete PGNSP PGUID 12 1 0 0 0 f f f f t f v 4 0 2281 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ hashbulkdelete _null_ _null_ _null_ )); DESCR("hash(internal)"); DATA(insert OID = 425 ( hashvacuumcleanup PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ hashvacuumcleanup _null_ _null_ _null_ )); DESCR("hash(internal)"); DATA(insert OID = 438 ( hashcostestimate PGNSP PGUID 12 1 0 0 0 f f f f t f v 7 0 2278 "2281 2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ hashcostestimate _null_ _null_ _null_ )); DESCR("hash(internal)"); DATA(insert OID = 2786 ( hashoptions PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 17 "1009 16" _null_ _null_ _null_ _null_ hashoptions _null_ _null_ _null_ )); DESCR("hash(internal)"); DATA(insert OID = 449 ( hashint2 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "21" _null_ _null_ _null_ _null_ hashint2 _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 450 ( hashint4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ hashint4 _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 949 ( hashint8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "20" _null_ _null_ _null_ _null_ hashint8 _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 451 ( hashfloat4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "700" _null_ _null_ _null_ _null_ hashfloat4 _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 452 ( hashfloat8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "701" _null_ _null_ _null_ _null_ hashfloat8 _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 453 ( hashoid PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "26" _null_ _null_ _null_ _null_ hashoid _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 454 ( hashchar PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "18" _null_ _null_ _null_ _null_ hashchar _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 455 ( hashname PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "19" _null_ _null_ _null_ _null_ hashname _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 400 ( hashtext PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ hashtext _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 456 ( hashvarlena PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "2281" _null_ _null_ _null_ _null_ hashvarlena _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 457 ( hashoidvector PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "30" _null_ _null_ _null_ _null_ hashoidvector _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 329 ( hash_aclitem PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1033" _null_ _null_ _null_ _null_ hash_aclitem _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 398 ( hashint2vector PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "22" _null_ _null_ _null_ _null_ hashint2vector _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 399 ( hashmacaddr PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "829" _null_ _null_ _null_ _null_ hashmacaddr _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 422 ( hashinet PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "869" _null_ _null_ _null_ _null_ hashinet _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 432 ( hash_numeric PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1700" _null_ _null_ _null_ _null_ hash_numeric _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 458 ( text_larger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ text_larger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 459 ( text_smaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ text_smaller _null_ _null_ _null_ )); DESCR("smaller of two"); DATA(insert OID = 460 ( int8in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "2275" _null_ _null_ _null_ _null_ int8in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 461 ( int8out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "20" _null_ _null_ _null_ _null_ int8out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 462 ( int8um PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ int8um _null_ _null_ _null_ )); DATA(insert OID = 463 ( int8pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ int8pl _null_ _null_ _null_ )); DATA(insert OID = 464 ( int8mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ int8mi _null_ _null_ _null_ )); DATA(insert OID = 465 ( int8mul PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ int8mul _null_ _null_ _null_ )); DATA(insert OID = 466 ( int8div PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ int8div _null_ _null_ _null_ )); DATA(insert OID = 467 ( int8eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 20" _null_ _null_ _null_ _null_ int8eq _null_ _null_ _null_ )); DATA(insert OID = 468 ( int8ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 20" _null_ _null_ _null_ _null_ int8ne _null_ _null_ _null_ )); DATA(insert OID = 469 ( int8lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 20" _null_ _null_ _null_ _null_ int8lt _null_ _null_ _null_ )); DATA(insert OID = 470 ( int8gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 20" _null_ _null_ _null_ _null_ int8gt _null_ _null_ _null_ )); DATA(insert OID = 471 ( int8le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 20" _null_ _null_ _null_ _null_ int8le _null_ _null_ _null_ )); DATA(insert OID = 472 ( int8ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 20" _null_ _null_ _null_ _null_ int8ge _null_ _null_ _null_ )); DATA(insert OID = 474 ( int84eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 23" _null_ _null_ _null_ _null_ int84eq _null_ _null_ _null_ )); DATA(insert OID = 475 ( int84ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 23" _null_ _null_ _null_ _null_ int84ne _null_ _null_ _null_ )); DATA(insert OID = 476 ( int84lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 23" _null_ _null_ _null_ _null_ int84lt _null_ _null_ _null_ )); DATA(insert OID = 477 ( int84gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 23" _null_ _null_ _null_ _null_ int84gt _null_ _null_ _null_ )); DATA(insert OID = 478 ( int84le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 23" _null_ _null_ _null_ _null_ int84le _null_ _null_ _null_ )); DATA(insert OID = 479 ( int84ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 23" _null_ _null_ _null_ _null_ int84ge _null_ _null_ _null_ )); DATA(insert OID = 480 ( int4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "20" _null_ _null_ _null_ _null_ int84 _null_ _null_ _null_ )); DESCR("convert int8 to int4"); DATA(insert OID = 481 ( int8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "23" _null_ _null_ _null_ _null_ int48 _null_ _null_ _null_ )); DESCR("convert int4 to int8"); DATA(insert OID = 482 ( float8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "20" _null_ _null_ _null_ _null_ i8tod _null_ _null_ _null_ )); DESCR("convert int8 to float8"); DATA(insert OID = 483 ( int8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "701" _null_ _null_ _null_ _null_ dtoi8 _null_ _null_ _null_ )); DESCR("convert float8 to int8"); /* OIDS 500 - 599 */ /* OIDS 600 - 699 */ DATA(insert OID = 626 ( hash_array PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "2277" _null_ _null_ _null_ _null_ hash_array _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 652 ( float4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "20" _null_ _null_ _null_ _null_ i8tof _null_ _null_ _null_ )); DESCR("convert int8 to float4"); DATA(insert OID = 653 ( int8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "700" _null_ _null_ _null_ _null_ ftoi8 _null_ _null_ _null_ )); DESCR("convert float4 to int8"); DATA(insert OID = 714 ( int2 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "20" _null_ _null_ _null_ _null_ int82 _null_ _null_ _null_ )); DESCR("convert int8 to int2"); DATA(insert OID = 754 ( int8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "21" _null_ _null_ _null_ _null_ int28 _null_ _null_ _null_ )); DESCR("convert int2 to int8"); DATA(insert OID = 655 ( namelt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "19 19" _null_ _null_ _null_ _null_ namelt _null_ _null_ _null_ )); DATA(insert OID = 656 ( namele PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "19 19" _null_ _null_ _null_ _null_ namele _null_ _null_ _null_ )); DATA(insert OID = 657 ( namegt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "19 19" _null_ _null_ _null_ _null_ namegt _null_ _null_ _null_ )); DATA(insert OID = 658 ( namege PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "19 19" _null_ _null_ _null_ _null_ namege _null_ _null_ _null_ )); DATA(insert OID = 659 ( namene PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "19 19" _null_ _null_ _null_ _null_ namene _null_ _null_ _null_ )); DATA(insert OID = 668 ( bpchar PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1042 "1042 23 16" _null_ _null_ _null_ _null_ bpchar _null_ _null_ _null_ )); DESCR("adjust char() to typmod length"); DATA(insert OID = 3097 ( varchar_transform PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ varchar_transform _null_ _null_ _null_ )); DESCR("transform a varchar length coercion"); DATA(insert OID = 669 ( varchar PGNSP PGUID 12 1 0 0 varchar_transform f f f f t f i 3 0 1043 "1043 23 16" _null_ _null_ _null_ _null_ varchar _null_ _null_ _null_ )); DESCR("adjust varchar() to typmod length"); DATA(insert OID = 676 ( mktinterval PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 704 "702 702" _null_ _null_ _null_ _null_ mktinterval _null_ _null_ _null_ )); DATA(insert OID = 619 ( oidvectorne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "30 30" _null_ _null_ _null_ _null_ oidvectorne _null_ _null_ _null_ )); DATA(insert OID = 677 ( oidvectorlt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "30 30" _null_ _null_ _null_ _null_ oidvectorlt _null_ _null_ _null_ )); DATA(insert OID = 678 ( oidvectorle PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "30 30" _null_ _null_ _null_ _null_ oidvectorle _null_ _null_ _null_ )); DATA(insert OID = 679 ( oidvectoreq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "30 30" _null_ _null_ _null_ _null_ oidvectoreq _null_ _null_ _null_ )); DATA(insert OID = 680 ( oidvectorge PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "30 30" _null_ _null_ _null_ _null_ oidvectorge _null_ _null_ _null_ )); DATA(insert OID = 681 ( oidvectorgt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "30 30" _null_ _null_ _null_ _null_ oidvectorgt _null_ _null_ _null_ )); /* OIDS 700 - 799 */ DATA(insert OID = 710 ( getpgusername PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 19 "" _null_ _null_ _null_ _null_ current_user _null_ _null_ _null_ )); DESCR("deprecated, use current_user instead"); DATA(insert OID = 716 ( oidlt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "26 26" _null_ _null_ _null_ _null_ oidlt _null_ _null_ _null_ )); DATA(insert OID = 717 ( oidle PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "26 26" _null_ _null_ _null_ _null_ oidle _null_ _null_ _null_ )); DATA(insert OID = 720 ( octet_length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "17" _null_ _null_ _null_ _null_ byteaoctetlen _null_ _null_ _null_ )); DESCR("octet length"); DATA(insert OID = 721 ( get_byte PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "17 23" _null_ _null_ _null_ _null_ byteaGetByte _null_ _null_ _null_ )); DESCR("get byte"); DATA(insert OID = 722 ( set_byte PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 17 "17 23 23" _null_ _null_ _null_ _null_ byteaSetByte _null_ _null_ _null_ )); DESCR("set byte"); DATA(insert OID = 723 ( get_bit PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "17 23" _null_ _null_ _null_ _null_ byteaGetBit _null_ _null_ _null_ )); DESCR("get bit"); DATA(insert OID = 724 ( set_bit PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 17 "17 23 23" _null_ _null_ _null_ _null_ byteaSetBit _null_ _null_ _null_ )); DESCR("set bit"); DATA(insert OID = 749 ( overlay PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 17 "17 17 23 23" _null_ _null_ _null_ _null_ byteaoverlay _null_ _null_ _null_ )); DESCR("substitute portion of string"); DATA(insert OID = 752 ( overlay PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 17 "17 17 23" _null_ _null_ _null_ _null_ byteaoverlay_no_len _null_ _null_ _null_ )); DESCR("substitute portion of string"); DATA(insert OID = 725 ( dist_pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "600 628" _null_ _null_ _null_ _null_ dist_pl _null_ _null_ _null_ )); DATA(insert OID = 726 ( dist_lb PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "628 603" _null_ _null_ _null_ _null_ dist_lb _null_ _null_ _null_ )); DATA(insert OID = 727 ( dist_sl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "601 628" _null_ _null_ _null_ _null_ dist_sl _null_ _null_ _null_ )); DATA(insert OID = 728 ( dist_cpoly PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "718 604" _null_ _null_ _null_ _null_ dist_cpoly _null_ _null_ _null_ )); DATA(insert OID = 729 ( poly_distance PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "604 604" _null_ _null_ _null_ _null_ poly_distance _null_ _null_ _null_ )); DATA(insert OID = 740 ( text_lt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ text_lt _null_ _null_ _null_ )); DATA(insert OID = 741 ( text_le PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ text_le _null_ _null_ _null_ )); DATA(insert OID = 742 ( text_gt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ text_gt _null_ _null_ _null_ )); DATA(insert OID = 743 ( text_ge PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ text_ge _null_ _null_ _null_ )); DATA(insert OID = 745 ( current_user PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 19 "" _null_ _null_ _null_ _null_ current_user _null_ _null_ _null_ )); DESCR("current user name"); DATA(insert OID = 746 ( session_user PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 19 "" _null_ _null_ _null_ _null_ session_user _null_ _null_ _null_ )); DESCR("session user name"); DATA(insert OID = 744 ( array_eq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2277 2277" _null_ _null_ _null_ _null_ array_eq _null_ _null_ _null_ )); DATA(insert OID = 390 ( array_ne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2277 2277" _null_ _null_ _null_ _null_ array_ne _null_ _null_ _null_ )); DATA(insert OID = 391 ( array_lt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2277 2277" _null_ _null_ _null_ _null_ array_lt _null_ _null_ _null_ )); DATA(insert OID = 392 ( array_gt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2277 2277" _null_ _null_ _null_ _null_ array_gt _null_ _null_ _null_ )); DATA(insert OID = 393 ( array_le PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2277 2277" _null_ _null_ _null_ _null_ array_le _null_ _null_ _null_ )); DATA(insert OID = 396 ( array_ge PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2277 2277" _null_ _null_ _null_ _null_ array_ge _null_ _null_ _null_ )); DATA(insert OID = 747 ( array_dims PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "2277" _null_ _null_ _null_ _null_ array_dims _null_ _null_ _null_ )); DESCR("array dimensions"); DATA(insert OID = 748 ( array_ndims PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "2277" _null_ _null_ _null_ _null_ array_ndims _null_ _null_ _null_ )); DESCR("number of array dimensions"); DATA(insert OID = 750 ( array_in PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 2277 "2275 26 23" _null_ _null_ _null_ _null_ array_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 751 ( array_out PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2277" _null_ _null_ _null_ _null_ array_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2091 ( array_lower PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "2277 23" _null_ _null_ _null_ _null_ array_lower _null_ _null_ _null_ )); DESCR("array lower dimension"); DATA(insert OID = 2092 ( array_upper PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "2277 23" _null_ _null_ _null_ _null_ array_upper _null_ _null_ _null_ )); DESCR("array upper dimension"); DATA(insert OID = 2176 ( array_length PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "2277 23" _null_ _null_ _null_ _null_ array_length _null_ _null_ _null_ )); DESCR("array length"); DATA(insert OID = 378 ( array_append PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2277 "2277 2283" _null_ _null_ _null_ _null_ array_push _null_ _null_ _null_ )); DESCR("append element onto end of array"); DATA(insert OID = 379 ( array_prepend PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2277 "2283 2277" _null_ _null_ _null_ _null_ array_push _null_ _null_ _null_ )); DESCR("prepend element onto front of array"); DATA(insert OID = 383 ( array_cat PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2277 "2277 2277" _null_ _null_ _null_ _null_ array_cat _null_ _null_ _null_ )); DATA(insert OID = 394 ( string_to_array PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 1009 "25 25" _null_ _null_ _null_ _null_ text_to_array _null_ _null_ _null_ )); DESCR("split delimited text into text[]"); DATA(insert OID = 395 ( array_to_string PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "2277 25" _null_ _null_ _null_ _null_ array_to_text _null_ _null_ _null_ )); DESCR("concatenate array elements, using delimiter, into text"); DATA(insert OID = 376 ( string_to_array PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 1009 "25 25 25" _null_ _null_ _null_ _null_ text_to_array_null _null_ _null_ _null_ )); DESCR("split delimited text into text[], with null string"); DATA(insert OID = 384 ( array_to_string PGNSP PGUID 12 1 0 0 0 f f f f f f s 3 0 25 "2277 25 25" _null_ _null_ _null_ _null_ array_to_text_null _null_ _null_ _null_ )); DESCR("concatenate array elements, using delimiter and null string, into text"); DATA(insert OID = 515 ( array_larger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2277 "2277 2277" _null_ _null_ _null_ _null_ array_larger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 516 ( array_smaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2277 "2277 2277" _null_ _null_ _null_ _null_ array_smaller _null_ _null_ _null_ )); DESCR("smaller of two"); DATA(insert OID = 1191 ( generate_subscripts PGNSP PGUID 12 1 1000 0 0 f f f f t t i 3 0 23 "2277 23 16" _null_ _null_ _null_ _null_ generate_subscripts _null_ _null_ _null_ )); DESCR("array subscripts generator"); DATA(insert OID = 1192 ( generate_subscripts PGNSP PGUID 12 1 1000 0 0 f f f f t t i 2 0 23 "2277 23" _null_ _null_ _null_ _null_ generate_subscripts_nodir _null_ _null_ _null_ )); DESCR("array subscripts generator"); DATA(insert OID = 1193 ( array_fill PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2277 "2283 1007" _null_ _null_ _null_ _null_ array_fill _null_ _null_ _null_ )); DESCR("array constructor with value"); DATA(insert OID = 1286 ( array_fill PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 2277 "2283 1007 1007" _null_ _null_ _null_ _null_ array_fill_with_lower_bounds _null_ _null_ _null_ )); DESCR("array constructor with value"); DATA(insert OID = 2331 ( unnest PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 2283 "2277" _null_ _null_ _null_ _null_ array_unnest _null_ _null_ _null_ )); DESCR("expand array to set of rows"); DATA(insert OID = 2333 ( array_agg_transfn PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 2283" _null_ _null_ _null_ _null_ array_agg_transfn _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 2334 ( array_agg_finalfn PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 2277 "2281" _null_ _null_ _null_ _null_ array_agg_finalfn _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 2335 ( array_agg PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 2277 "2283" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("concatenate aggregate input into an array"); DATA(insert OID = 3816 ( array_typanalyze PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "2281" _null_ _null_ _null_ _null_ array_typanalyze _null_ _null_ _null_ )); DESCR("array typanalyze"); DATA(insert OID = 3817 ( arraycontsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ arraycontsel _null_ _null_ _null_ )); DESCR("restriction selectivity for array-containment operators"); DATA(insert OID = 3818 ( arraycontjoinsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ arraycontjoinsel _null_ _null_ _null_ )); DESCR("join selectivity for array-containment operators"); DATA(insert OID = 760 ( smgrin PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 210 "2275" _null_ _null_ _null_ _null_ smgrin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 761 ( smgrout PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "210" _null_ _null_ _null_ _null_ smgrout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 762 ( smgreq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "210 210" _null_ _null_ _null_ _null_ smgreq _null_ _null_ _null_ )); DESCR("storage manager"); DATA(insert OID = 763 ( smgrne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "210 210" _null_ _null_ _null_ _null_ smgrne _null_ _null_ _null_ )); DESCR("storage manager"); DATA(insert OID = 764 ( lo_import PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 26 "25" _null_ _null_ _null_ _null_ lo_import _null_ _null_ _null_ )); DESCR("large object import"); DATA(insert OID = 767 ( lo_import PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 26 "25 26" _null_ _null_ _null_ _null_ lo_import_with_oid _null_ _null_ _null_ )); DESCR("large object import"); DATA(insert OID = 765 ( lo_export PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 23 "26 25" _null_ _null_ _null_ _null_ lo_export _null_ _null_ _null_ )); DESCR("large object export"); DATA(insert OID = 766 ( int4inc PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ int4inc _null_ _null_ _null_ )); DESCR("increment"); DATA(insert OID = 768 ( int4larger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ int4larger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 769 ( int4smaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ int4smaller _null_ _null_ _null_ )); DESCR("smaller of two"); DATA(insert OID = 770 ( int2larger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ int2larger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 771 ( int2smaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ int2smaller _null_ _null_ _null_ )); DESCR("smaller of two"); DATA(insert OID = 774 ( gistgettuple PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ gistgettuple _null_ _null_ _null_ )); DESCR("gist(internal)"); DATA(insert OID = 638 ( gistgetbitmap PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ gistgetbitmap _null_ _null_ _null_ )); DESCR("gist(internal)"); DATA(insert OID = 775 ( gistinsert PGNSP PGUID 12 1 0 0 0 f f f f t f v 6 0 16 "2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ gistinsert _null_ _null_ _null_ )); DESCR("gist(internal)"); DATA(insert OID = 777 ( gistbeginscan PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ gistbeginscan _null_ _null_ _null_ )); DESCR("gist(internal)"); DATA(insert OID = 778 ( gistrescan PGNSP PGUID 12 1 0 0 0 f f f f t f v 5 0 2278 "2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ gistrescan _null_ _null_ _null_ )); DESCR("gist(internal)"); DATA(insert OID = 779 ( gistendscan PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ gistendscan _null_ _null_ _null_ )); DESCR("gist(internal)"); DATA(insert OID = 780 ( gistmarkpos PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ gistmarkpos _null_ _null_ _null_ )); DESCR("gist(internal)"); DATA(insert OID = 781 ( gistrestrpos PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ gistrestrpos _null_ _null_ _null_ )); DESCR("gist(internal)"); DATA(insert OID = 782 ( gistbuild PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ gistbuild _null_ _null_ _null_ )); DESCR("gist(internal)"); DATA(insert OID = 326 ( gistbuildempty PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ gistbuildempty _null_ _null_ _null_ )); DESCR("gist(internal)"); DATA(insert OID = 776 ( gistbulkdelete PGNSP PGUID 12 1 0 0 0 f f f f t f v 4 0 2281 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ gistbulkdelete _null_ _null_ _null_ )); DESCR("gist(internal)"); DATA(insert OID = 2561 ( gistvacuumcleanup PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ gistvacuumcleanup _null_ _null_ _null_ )); DESCR("gist(internal)"); DATA(insert OID = 772 ( gistcostestimate PGNSP PGUID 12 1 0 0 0 f f f f t f v 7 0 2278 "2281 2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ gistcostestimate _null_ _null_ _null_ )); DESCR("gist(internal)"); DATA(insert OID = 2787 ( gistoptions PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 17 "1009 16" _null_ _null_ _null_ _null_ gistoptions _null_ _null_ _null_ )); DESCR("gist(internal)"); DATA(insert OID = 784 ( tintervaleq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 704" _null_ _null_ _null_ _null_ tintervaleq _null_ _null_ _null_ )); DATA(insert OID = 785 ( tintervalne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 704" _null_ _null_ _null_ _null_ tintervalne _null_ _null_ _null_ )); DATA(insert OID = 786 ( tintervallt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 704" _null_ _null_ _null_ _null_ tintervallt _null_ _null_ _null_ )); DATA(insert OID = 787 ( tintervalgt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 704" _null_ _null_ _null_ _null_ tintervalgt _null_ _null_ _null_ )); DATA(insert OID = 788 ( tintervalle PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 704" _null_ _null_ _null_ _null_ tintervalle _null_ _null_ _null_ )); DATA(insert OID = 789 ( tintervalge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "704 704" _null_ _null_ _null_ _null_ tintervalge _null_ _null_ _null_ )); /* OIDS 800 - 899 */ DATA(insert OID = 846 ( cash_mul_flt4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 700" _null_ _null_ _null_ _null_ cash_mul_flt4 _null_ _null_ _null_ )); DATA(insert OID = 847 ( cash_div_flt4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 700" _null_ _null_ _null_ _null_ cash_div_flt4 _null_ _null_ _null_ )); DATA(insert OID = 848 ( flt4_mul_cash PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "700 790" _null_ _null_ _null_ _null_ flt4_mul_cash _null_ _null_ _null_ )); DATA(insert OID = 849 ( position PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "25 25" _null_ _null_ _null_ _null_ textpos _null_ _null_ _null_ )); DESCR("position of substring"); DATA(insert OID = 850 ( textlike PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ textlike _null_ _null_ _null_ )); DATA(insert OID = 851 ( textnlike PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ textnlike _null_ _null_ _null_ )); DATA(insert OID = 852 ( int48eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 20" _null_ _null_ _null_ _null_ int48eq _null_ _null_ _null_ )); DATA(insert OID = 853 ( int48ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 20" _null_ _null_ _null_ _null_ int48ne _null_ _null_ _null_ )); DATA(insert OID = 854 ( int48lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 20" _null_ _null_ _null_ _null_ int48lt _null_ _null_ _null_ )); DATA(insert OID = 855 ( int48gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 20" _null_ _null_ _null_ _null_ int48gt _null_ _null_ _null_ )); DATA(insert OID = 856 ( int48le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 20" _null_ _null_ _null_ _null_ int48le _null_ _null_ _null_ )); DATA(insert OID = 857 ( int48ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "23 20" _null_ _null_ _null_ _null_ int48ge _null_ _null_ _null_ )); DATA(insert OID = 858 ( namelike PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ namelike _null_ _null_ _null_ )); DATA(insert OID = 859 ( namenlike PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ namenlike _null_ _null_ _null_ )); DATA(insert OID = 860 ( bpchar PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1042 "18" _null_ _null_ _null_ _null_ char_bpchar _null_ _null_ _null_ )); DESCR("convert char to char(n)"); DATA(insert OID = 861 ( current_database PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 19 "" _null_ _null_ _null_ _null_ current_database _null_ _null_ _null_ )); DESCR("name of the current database"); DATA(insert OID = 817 ( current_query PGNSP PGUID 12 1 0 0 0 f f f f f f v 0 0 25 "" _null_ _null_ _null_ _null_ current_query _null_ _null_ _null_ )); DESCR("get the currently executing query"); DATA(insert OID = 862 ( int4_mul_cash PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "23 790" _null_ _null_ _null_ _null_ int4_mul_cash _null_ _null_ _null_ )); DATA(insert OID = 863 ( int2_mul_cash PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "21 790" _null_ _null_ _null_ _null_ int2_mul_cash _null_ _null_ _null_ )); DATA(insert OID = 864 ( cash_mul_int4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 23" _null_ _null_ _null_ _null_ cash_mul_int4 _null_ _null_ _null_ )); DATA(insert OID = 865 ( cash_div_int4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 23" _null_ _null_ _null_ _null_ cash_div_int4 _null_ _null_ _null_ )); DATA(insert OID = 866 ( cash_mul_int2 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 21" _null_ _null_ _null_ _null_ cash_mul_int2 _null_ _null_ _null_ )); DATA(insert OID = 867 ( cash_div_int2 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 21" _null_ _null_ _null_ _null_ cash_div_int2 _null_ _null_ _null_ )); DATA(insert OID = 886 ( cash_in PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 790 "2275" _null_ _null_ _null_ _null_ cash_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 887 ( cash_out PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "790" _null_ _null_ _null_ _null_ cash_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 888 ( cash_eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "790 790" _null_ _null_ _null_ _null_ cash_eq _null_ _null_ _null_ )); DATA(insert OID = 889 ( cash_ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "790 790" _null_ _null_ _null_ _null_ cash_ne _null_ _null_ _null_ )); DATA(insert OID = 890 ( cash_lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "790 790" _null_ _null_ _null_ _null_ cash_lt _null_ _null_ _null_ )); DATA(insert OID = 891 ( cash_le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "790 790" _null_ _null_ _null_ _null_ cash_le _null_ _null_ _null_ )); DATA(insert OID = 892 ( cash_gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "790 790" _null_ _null_ _null_ _null_ cash_gt _null_ _null_ _null_ )); DATA(insert OID = 893 ( cash_ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "790 790" _null_ _null_ _null_ _null_ cash_ge _null_ _null_ _null_ )); DATA(insert OID = 894 ( cash_pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 790" _null_ _null_ _null_ _null_ cash_pl _null_ _null_ _null_ )); DATA(insert OID = 895 ( cash_mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 790" _null_ _null_ _null_ _null_ cash_mi _null_ _null_ _null_ )); DATA(insert OID = 896 ( cash_mul_flt8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 701" _null_ _null_ _null_ _null_ cash_mul_flt8 _null_ _null_ _null_ )); DATA(insert OID = 897 ( cash_div_flt8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 701" _null_ _null_ _null_ _null_ cash_div_flt8 _null_ _null_ _null_ )); DATA(insert OID = 898 ( cashlarger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 790" _null_ _null_ _null_ _null_ cashlarger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 899 ( cashsmaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "790 790" _null_ _null_ _null_ _null_ cashsmaller _null_ _null_ _null_ )); DESCR("smaller of two"); DATA(insert OID = 919 ( flt8_mul_cash PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 790 "701 790" _null_ _null_ _null_ _null_ flt8_mul_cash _null_ _null_ _null_ )); DATA(insert OID = 935 ( cash_words PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "790" _null_ _null_ _null_ _null_ cash_words _null_ _null_ _null_ )); DESCR("output money amount as words"); DATA(insert OID = 3822 ( cash_div_cash PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "790 790" _null_ _null_ _null_ _null_ cash_div_cash _null_ _null_ _null_ )); DATA(insert OID = 3823 ( numeric PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1700 "790" _null_ _null_ _null_ _null_ cash_numeric _null_ _null_ _null_ )); DESCR("convert money to numeric"); DATA(insert OID = 3824 ( money PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 790 "1700" _null_ _null_ _null_ _null_ numeric_cash _null_ _null_ _null_ )); DESCR("convert numeric to money"); DATA(insert OID = 3811 ( money PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 790 "23" _null_ _null_ _null_ _null_ int4_cash _null_ _null_ _null_ )); DESCR("convert int4 to money"); DATA(insert OID = 3812 ( money PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 790 "20" _null_ _null_ _null_ _null_ int8_cash _null_ _null_ _null_ )); DESCR("convert int8 to money"); /* OIDS 900 - 999 */ DATA(insert OID = 940 ( mod PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ int2mod _null_ _null_ _null_ )); DESCR("modulus"); DATA(insert OID = 941 ( mod PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ int4mod _null_ _null_ _null_ )); DESCR("modulus"); DATA(insert OID = 945 ( int8mod PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ int8mod _null_ _null_ _null_ )); DATA(insert OID = 947 ( mod PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ int8mod _null_ _null_ _null_ )); DESCR("modulus"); DATA(insert OID = 944 ( char PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 18 "25" _null_ _null_ _null_ _null_ text_char _null_ _null_ _null_ )); DESCR("convert text to char"); DATA(insert OID = 946 ( text PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "18" _null_ _null_ _null_ _null_ char_text _null_ _null_ _null_ )); DESCR("convert char to text"); DATA(insert OID = 952 ( lo_open PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 23 "26 23" _null_ _null_ _null_ _null_ lo_open _null_ _null_ _null_ )); DESCR("large object open"); DATA(insert OID = 953 ( lo_close PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 23 "23" _null_ _null_ _null_ _null_ lo_close _null_ _null_ _null_ )); DESCR("large object close"); DATA(insert OID = 954 ( loread PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 17 "23 23" _null_ _null_ _null_ _null_ loread _null_ _null_ _null_ )); DESCR("large object read"); DATA(insert OID = 955 ( lowrite PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 23 "23 17" _null_ _null_ _null_ _null_ lowrite _null_ _null_ _null_ )); DESCR("large object write"); DATA(insert OID = 956 ( lo_lseek PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 23 "23 23 23" _null_ _null_ _null_ _null_ lo_lseek _null_ _null_ _null_ )); DESCR("large object seek"); DATA(insert OID = 957 ( lo_creat PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 26 "23" _null_ _null_ _null_ _null_ lo_creat _null_ _null_ _null_ )); DESCR("large object create"); DATA(insert OID = 715 ( lo_create PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 26 "26" _null_ _null_ _null_ _null_ lo_create _null_ _null_ _null_ )); DESCR("large object create"); DATA(insert OID = 958 ( lo_tell PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 23 "23" _null_ _null_ _null_ _null_ lo_tell _null_ _null_ _null_ )); DESCR("large object position"); DATA(insert OID = 1004 ( lo_truncate PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 23 "23 23" _null_ _null_ _null_ _null_ lo_truncate _null_ _null_ _null_ )); DESCR("truncate large object"); DATA(insert OID = 959 ( on_pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 628" _null_ _null_ _null_ _null_ on_pl _null_ _null_ _null_ )); DATA(insert OID = 960 ( on_sl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "601 628" _null_ _null_ _null_ _null_ on_sl _null_ _null_ _null_ )); DATA(insert OID = 961 ( close_pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "600 628" _null_ _null_ _null_ _null_ close_pl _null_ _null_ _null_ )); DATA(insert OID = 962 ( close_sl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "601 628" _null_ _null_ _null_ _null_ close_sl _null_ _null_ _null_ )); DATA(insert OID = 963 ( close_lb PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "628 603" _null_ _null_ _null_ _null_ close_lb _null_ _null_ _null_ )); DATA(insert OID = 964 ( lo_unlink PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 23 "26" _null_ _null_ _null_ _null_ lo_unlink _null_ _null_ _null_ )); DESCR("large object unlink (delete)"); DATA(insert OID = 973 ( path_inter PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "602 602" _null_ _null_ _null_ _null_ path_inter _null_ _null_ _null_ )); DATA(insert OID = 975 ( area PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "603" _null_ _null_ _null_ _null_ box_area _null_ _null_ _null_ )); DESCR("box area"); DATA(insert OID = 976 ( width PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "603" _null_ _null_ _null_ _null_ box_width _null_ _null_ _null_ )); DESCR("box width"); DATA(insert OID = 977 ( height PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "603" _null_ _null_ _null_ _null_ box_height _null_ _null_ _null_ )); DESCR("box height"); DATA(insert OID = 978 ( box_distance PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "603 603" _null_ _null_ _null_ _null_ box_distance _null_ _null_ _null_ )); DATA(insert OID = 979 ( area PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "602" _null_ _null_ _null_ _null_ path_area _null_ _null_ _null_ )); DESCR("area of a closed path"); DATA(insert OID = 980 ( box_intersect PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 603 "603 603" _null_ _null_ _null_ _null_ box_intersect _null_ _null_ _null_ )); DATA(insert OID = 981 ( diagonal PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 601 "603" _null_ _null_ _null_ _null_ box_diagonal _null_ _null_ _null_ )); DESCR("box diagonal"); DATA(insert OID = 982 ( path_n_lt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "602 602" _null_ _null_ _null_ _null_ path_n_lt _null_ _null_ _null_ )); DATA(insert OID = 983 ( path_n_gt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "602 602" _null_ _null_ _null_ _null_ path_n_gt _null_ _null_ _null_ )); DATA(insert OID = 984 ( path_n_eq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "602 602" _null_ _null_ _null_ _null_ path_n_eq _null_ _null_ _null_ )); DATA(insert OID = 985 ( path_n_le PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "602 602" _null_ _null_ _null_ _null_ path_n_le _null_ _null_ _null_ )); DATA(insert OID = 986 ( path_n_ge PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "602 602" _null_ _null_ _null_ _null_ path_n_ge _null_ _null_ _null_ )); DATA(insert OID = 987 ( path_length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "602" _null_ _null_ _null_ _null_ path_length _null_ _null_ _null_ )); DATA(insert OID = 988 ( point_ne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_ point_ne _null_ _null_ _null_ )); DATA(insert OID = 989 ( point_vert PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_ point_vert _null_ _null_ _null_ )); DATA(insert OID = 990 ( point_horiz PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_ point_horiz _null_ _null_ _null_ )); DATA(insert OID = 991 ( point_distance PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "600 600" _null_ _null_ _null_ _null_ point_distance _null_ _null_ _null_ )); DATA(insert OID = 992 ( slope PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "600 600" _null_ _null_ _null_ _null_ point_slope _null_ _null_ _null_ )); DESCR("slope between points"); DATA(insert OID = 993 ( lseg PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 601 "600 600" _null_ _null_ _null_ _null_ lseg_construct _null_ _null_ _null_ )); DESCR("convert points to line segment"); DATA(insert OID = 994 ( lseg_intersect PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_ lseg_intersect _null_ _null_ _null_ )); DATA(insert OID = 995 ( lseg_parallel PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_ lseg_parallel _null_ _null_ _null_ )); DATA(insert OID = 996 ( lseg_perp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_ lseg_perp _null_ _null_ _null_ )); DATA(insert OID = 997 ( lseg_vertical PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "601" _null_ _null_ _null_ _null_ lseg_vertical _null_ _null_ _null_ )); DATA(insert OID = 998 ( lseg_horizontal PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "601" _null_ _null_ _null_ _null_ lseg_horizontal _null_ _null_ _null_ )); DATA(insert OID = 999 ( lseg_eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_ lseg_eq _null_ _null_ _null_ )); /* OIDS 1000 - 1999 */ DATA(insert OID = 1026 ( timezone PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "1186 1184" _null_ _null_ _null_ _null_ timestamptz_izone _null_ _null_ _null_ )); DESCR("adjust timestamp to new time zone"); DATA(insert OID = 1031 ( aclitemin PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1033 "2275" _null_ _null_ _null_ _null_ aclitemin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1032 ( aclitemout PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "1033" _null_ _null_ _null_ _null_ aclitemout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1035 ( aclinsert PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1034 "1034 1033" _null_ _null_ _null_ _null_ aclinsert _null_ _null_ _null_ )); DESCR("add/update ACL item"); DATA(insert OID = 1036 ( aclremove PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1034 "1034 1033" _null_ _null_ _null_ _null_ aclremove _null_ _null_ _null_ )); DESCR("remove ACL item"); DATA(insert OID = 1037 ( aclcontains PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1034 1033" _null_ _null_ _null_ _null_ aclcontains _null_ _null_ _null_ )); DESCR("contains"); DATA(insert OID = 1062 ( aclitemeq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1033 1033" _null_ _null_ _null_ _null_ aclitem_eq _null_ _null_ _null_ )); DATA(insert OID = 1365 ( makeaclitem PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 1033 "26 26 25 16" _null_ _null_ _null_ _null_ makeaclitem _null_ _null_ _null_ )); DESCR("make ACL item"); DATA(insert OID = 3943 ( acldefault PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1034 "18 26" _null_ _null_ _null_ _null_ acldefault_sql _null_ _null_ _null_ )); DESCR("TODO"); DATA(insert OID = 1689 ( aclexplode PGNSP PGUID 12 1 10 0 0 f f f f t t s 1 0 2249 "1034" "{1034,26,26,25,16}" "{i,o,o,o,o}" "{acl,grantor,grantee,privilege_type,is_grantable}" _null_ aclexplode _null_ _null_ _null_ )); DESCR("convert ACL item array to table, for use by information schema"); DATA(insert OID = 1044 ( bpcharin PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1042 "2275 26 23" _null_ _null_ _null_ _null_ bpcharin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1045 ( bpcharout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "1042" _null_ _null_ _null_ _null_ bpcharout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2913 ( bpchartypmodin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ bpchartypmodin _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 2914 ( bpchartypmodout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ bpchartypmodout _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 1046 ( varcharin PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1043 "2275 26 23" _null_ _null_ _null_ _null_ varcharin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1047 ( varcharout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "1043" _null_ _null_ _null_ _null_ varcharout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2915 ( varchartypmodin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ varchartypmodin _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 2916 ( varchartypmodout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ varchartypmodout _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 1048 ( bpchareq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ bpchareq _null_ _null_ _null_ )); DATA(insert OID = 1049 ( bpcharlt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ bpcharlt _null_ _null_ _null_ )); DATA(insert OID = 1050 ( bpcharle PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ bpcharle _null_ _null_ _null_ )); DATA(insert OID = 1051 ( bpchargt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ bpchargt _null_ _null_ _null_ )); DATA(insert OID = 1052 ( bpcharge PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ bpcharge _null_ _null_ _null_ )); DATA(insert OID = 1053 ( bpcharne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ bpcharne _null_ _null_ _null_ )); DATA(insert OID = 1063 ( bpchar_larger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1042 "1042 1042" _null_ _null_ _null_ _null_ bpchar_larger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 1064 ( bpchar_smaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1042 "1042 1042" _null_ _null_ _null_ _null_ bpchar_smaller _null_ _null_ _null_ )); DESCR("smaller of two"); DATA(insert OID = 1078 ( bpcharcmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1042 1042" _null_ _null_ _null_ _null_ bpcharcmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 1080 ( hashbpchar PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1042" _null_ _null_ _null_ _null_ hashbpchar _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 1081 ( format_type PGNSP PGUID 12 1 0 0 0 f f f f f f s 2 0 25 "26 23" _null_ _null_ _null_ _null_ format_type _null_ _null_ _null_ )); DESCR("format a type oid and atttypmod to canonical SQL"); DATA(insert OID = 1084 ( date_in PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1082 "2275" _null_ _null_ _null_ _null_ date_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1085 ( date_out PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "1082" _null_ _null_ _null_ _null_ date_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1086 ( date_eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1082 1082" _null_ _null_ _null_ _null_ date_eq _null_ _null_ _null_ )); DATA(insert OID = 1087 ( date_lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1082 1082" _null_ _null_ _null_ _null_ date_lt _null_ _null_ _null_ )); DATA(insert OID = 1088 ( date_le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1082 1082" _null_ _null_ _null_ _null_ date_le _null_ _null_ _null_ )); DATA(insert OID = 1089 ( date_gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1082 1082" _null_ _null_ _null_ _null_ date_gt _null_ _null_ _null_ )); DATA(insert OID = 1090 ( date_ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1082 1082" _null_ _null_ _null_ _null_ date_ge _null_ _null_ _null_ )); DATA(insert OID = 1091 ( date_ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1082 1082" _null_ _null_ _null_ _null_ date_ne _null_ _null_ _null_ )); DATA(insert OID = 1092 ( date_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1082 1082" _null_ _null_ _null_ _null_ date_cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 3136 ( date_sortsupport PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ date_sortsupport _null_ _null_ _null_ )); DESCR("sort support"); /* OIDS 1100 - 1199 */ DATA(insert OID = 1102 ( time_lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1083 1083" _null_ _null_ _null_ _null_ time_lt _null_ _null_ _null_ )); DATA(insert OID = 1103 ( time_le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1083 1083" _null_ _null_ _null_ _null_ time_le _null_ _null_ _null_ )); DATA(insert OID = 1104 ( time_gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1083 1083" _null_ _null_ _null_ _null_ time_gt _null_ _null_ _null_ )); DATA(insert OID = 1105 ( time_ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1083 1083" _null_ _null_ _null_ _null_ time_ge _null_ _null_ _null_ )); DATA(insert OID = 1106 ( time_ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1083 1083" _null_ _null_ _null_ _null_ time_ne _null_ _null_ _null_ )); DATA(insert OID = 1107 ( time_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1083 1083" _null_ _null_ _null_ _null_ time_cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 1138 ( date_larger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1082 "1082 1082" _null_ _null_ _null_ _null_ date_larger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 1139 ( date_smaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1082 "1082 1082" _null_ _null_ _null_ _null_ date_smaller _null_ _null_ _null_ )); DESCR("smaller of two"); DATA(insert OID = 1140 ( date_mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1082 1082" _null_ _null_ _null_ _null_ date_mi _null_ _null_ _null_ )); DATA(insert OID = 1141 ( date_pli PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1082 "1082 23" _null_ _null_ _null_ _null_ date_pli _null_ _null_ _null_ )); DATA(insert OID = 1142 ( date_mii PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1082 "1082 23" _null_ _null_ _null_ _null_ date_mii _null_ _null_ _null_ )); DATA(insert OID = 1143 ( time_in PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 1083 "2275 26 23" _null_ _null_ _null_ _null_ time_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1144 ( time_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "1083" _null_ _null_ _null_ _null_ time_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2909 ( timetypmodin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ timetypmodin _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 2910 ( timetypmodout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ timetypmodout _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 1145 ( time_eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1083 1083" _null_ _null_ _null_ _null_ time_eq _null_ _null_ _null_ )); DATA(insert OID = 1146 ( circle_add_pt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 718 "718 600" _null_ _null_ _null_ _null_ circle_add_pt _null_ _null_ _null_ )); DATA(insert OID = 1147 ( circle_sub_pt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 718 "718 600" _null_ _null_ _null_ _null_ circle_sub_pt _null_ _null_ _null_ )); DATA(insert OID = 1148 ( circle_mul_pt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 718 "718 600" _null_ _null_ _null_ _null_ circle_mul_pt _null_ _null_ _null_ )); DATA(insert OID = 1149 ( circle_div_pt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 718 "718 600" _null_ _null_ _null_ _null_ circle_div_pt _null_ _null_ _null_ )); DATA(insert OID = 1150 ( timestamptz_in PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 1184 "2275 26 23" _null_ _null_ _null_ _null_ timestamptz_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1151 ( timestamptz_out PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "1184" _null_ _null_ _null_ _null_ timestamptz_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2907 ( timestamptztypmodin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ timestamptztypmodin _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 2908 ( timestamptztypmodout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ timestamptztypmodout _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 1152 ( timestamptz_eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1184 1184" _null_ _null_ _null_ _null_ timestamp_eq _null_ _null_ _null_ )); DATA(insert OID = 1153 ( timestamptz_ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1184 1184" _null_ _null_ _null_ _null_ timestamp_ne _null_ _null_ _null_ )); DATA(insert OID = 1154 ( timestamptz_lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1184 1184" _null_ _null_ _null_ _null_ timestamp_lt _null_ _null_ _null_ )); DATA(insert OID = 1155 ( timestamptz_le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1184 1184" _null_ _null_ _null_ _null_ timestamp_le _null_ _null_ _null_ )); DATA(insert OID = 1156 ( timestamptz_ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1184 1184" _null_ _null_ _null_ _null_ timestamp_ge _null_ _null_ _null_ )); DATA(insert OID = 1157 ( timestamptz_gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1184 1184" _null_ _null_ _null_ _null_ timestamp_gt _null_ _null_ _null_ )); DATA(insert OID = 1158 ( to_timestamp PGNSP PGUID 14 1 0 0 0 f f f f t f i 1 0 1184 "701" _null_ _null_ _null_ _null_ "select (''epoch''::pg_catalog.timestamptz + $1 * ''1 second''::pg_catalog.interval)" _null_ _null_ _null_ )); DESCR("convert UNIX epoch to timestamptz"); DATA(insert OID = 1159 ( timezone PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "25 1184" _null_ _null_ _null_ _null_ timestamptz_zone _null_ _null_ _null_ )); DESCR("adjust timestamp to new time zone"); DATA(insert OID = 1160 ( interval_in PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 1186 "2275 26 23" _null_ _null_ _null_ _null_ interval_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1161 ( interval_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "1186" _null_ _null_ _null_ _null_ interval_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2903 ( intervaltypmodin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ intervaltypmodin _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 2904 ( intervaltypmodout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ intervaltypmodout _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 1162 ( interval_eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1186 1186" _null_ _null_ _null_ _null_ interval_eq _null_ _null_ _null_ )); DATA(insert OID = 1163 ( interval_ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1186 1186" _null_ _null_ _null_ _null_ interval_ne _null_ _null_ _null_ )); DATA(insert OID = 1164 ( interval_lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1186 1186" _null_ _null_ _null_ _null_ interval_lt _null_ _null_ _null_ )); DATA(insert OID = 1165 ( interval_le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1186 1186" _null_ _null_ _null_ _null_ interval_le _null_ _null_ _null_ )); DATA(insert OID = 1166 ( interval_ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1186 1186" _null_ _null_ _null_ _null_ interval_ge _null_ _null_ _null_ )); DATA(insert OID = 1167 ( interval_gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1186 1186" _null_ _null_ _null_ _null_ interval_gt _null_ _null_ _null_ )); DATA(insert OID = 1168 ( interval_um PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ interval_um _null_ _null_ _null_ )); DATA(insert OID = 1169 ( interval_pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1186 1186" _null_ _null_ _null_ _null_ interval_pl _null_ _null_ _null_ )); DATA(insert OID = 1170 ( interval_mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1186 1186" _null_ _null_ _null_ _null_ interval_mi _null_ _null_ _null_ )); DATA(insert OID = 1171 ( date_part PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 701 "25 1184" _null_ _null_ _null_ _null_ timestamptz_part _null_ _null_ _null_ )); DESCR("extract field from timestamp with time zone"); DATA(insert OID = 1172 ( date_part PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "25 1186" _null_ _null_ _null_ _null_ interval_part _null_ _null_ _null_ )); DESCR("extract field from interval"); DATA(insert OID = 1173 ( timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1184 "702" _null_ _null_ _null_ _null_ abstime_timestamptz _null_ _null_ _null_ )); DESCR("convert abstime to timestamp with time zone"); DATA(insert OID = 1174 ( timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "1082" _null_ _null_ _null_ _null_ date_timestamptz _null_ _null_ _null_ )); DESCR("convert date to timestamp with time zone"); DATA(insert OID = 2711 ( justify_interval PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ interval_justify_interval _null_ _null_ _null_ )); DESCR("promote groups of 24 hours to numbers of days and promote groups of 30 days to numbers of months"); DATA(insert OID = 1175 ( justify_hours PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ interval_justify_hours _null_ _null_ _null_ )); DESCR("promote groups of 24 hours to numbers of days"); DATA(insert OID = 1295 ( justify_days PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ interval_justify_days _null_ _null_ _null_ )); DESCR("promote groups of 30 days to numbers of months"); DATA(insert OID = 1176 ( timestamptz PGNSP PGUID 14 1 0 0 0 f f f f t f s 2 0 1184 "1082 1083" _null_ _null_ _null_ _null_ "select cast(($1 + $2) as timestamp with time zone)" _null_ _null_ _null_ )); DESCR("convert date and time to timestamp with time zone"); DATA(insert OID = 1177 ( interval PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1186 "703" _null_ _null_ _null_ _null_ reltime_interval _null_ _null_ _null_ )); DESCR("convert reltime to interval"); DATA(insert OID = 1178 ( date PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1082 "1184" _null_ _null_ _null_ _null_ timestamptz_date _null_ _null_ _null_ )); DESCR("convert timestamp with time zone to date"); DATA(insert OID = 1179 ( date PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1082 "702" _null_ _null_ _null_ _null_ abstime_date _null_ _null_ _null_ )); DESCR("convert abstime to date"); DATA(insert OID = 1180 ( abstime PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 702 "1184" _null_ _null_ _null_ _null_ timestamptz_abstime _null_ _null_ _null_ )); DESCR("convert timestamp with time zone to abstime"); DATA(insert OID = 1181 ( age PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 23 "28" _null_ _null_ _null_ _null_ xid_age _null_ _null_ _null_ )); DESCR("age of a transaction ID, in transactions before current transaction"); DATA(insert OID = 1188 ( timestamptz_mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1184 1184" _null_ _null_ _null_ _null_ timestamp_mi _null_ _null_ _null_ )); DATA(insert OID = 1189 ( timestamptz_pl_interval PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 1184 "1184 1186" _null_ _null_ _null_ _null_ timestamptz_pl_interval _null_ _null_ _null_ )); DATA(insert OID = 1190 ( timestamptz_mi_interval PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 1184 "1184 1186" _null_ _null_ _null_ _null_ timestamptz_mi_interval _null_ _null_ _null_ )); DATA(insert OID = 1194 ( reltime PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 703 "1186" _null_ _null_ _null_ _null_ interval_reltime _null_ _null_ _null_ )); DESCR("convert interval to reltime"); DATA(insert OID = 1195 ( timestamptz_smaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1184 "1184 1184" _null_ _null_ _null_ _null_ timestamp_smaller _null_ _null_ _null_ )); DESCR("smaller of two"); DATA(insert OID = 1196 ( timestamptz_larger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1184 "1184 1184" _null_ _null_ _null_ _null_ timestamp_larger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 1197 ( interval_smaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1186 1186" _null_ _null_ _null_ _null_ interval_smaller _null_ _null_ _null_ )); DESCR("smaller of two"); DATA(insert OID = 1198 ( interval_larger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1186 1186" _null_ _null_ _null_ _null_ interval_larger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 1199 ( age PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1184 1184" _null_ _null_ _null_ _null_ timestamptz_age _null_ _null_ _null_ )); DESCR("date difference preserving months and years"); /* OIDS 1200 - 1299 */ DATA(insert OID = 3918 ( interval_transform PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ interval_transform _null_ _null_ _null_ )); DESCR("transform an interval length coercion"); DATA(insert OID = 1200 ( interval PGNSP PGUID 12 1 0 0 interval_transform f f f f t f i 2 0 1186 "1186 23" _null_ _null_ _null_ _null_ interval_scale _null_ _null_ _null_ )); DESCR("adjust interval precision"); DATA(insert OID = 1215 ( obj_description PGNSP PGUID 14 100 0 0 0 f f f f t f s 2 0 25 "26 19" _null_ _null_ _null_ _null_ "select description from pg_catalog.pg_description where objoid = $1 and classoid = (select oid from pg_catalog.pg_class where relname = $2 and relnamespace = PGNSP) and objsubid = 0" _null_ _null_ _null_ )); DESCR("get description for object id and catalog name"); DATA(insert OID = 1216 ( col_description PGNSP PGUID 14 100 0 0 0 f f f f t f s 2 0 25 "26 23" _null_ _null_ _null_ _null_ "select description from pg_catalog.pg_description where objoid = $1 and classoid = ''pg_catalog.pg_class''::pg_catalog.regclass and objsubid = $2" _null_ _null_ _null_ )); DESCR("get description for table column"); DATA(insert OID = 1993 ( shobj_description PGNSP PGUID 14 100 0 0 0 f f f f t f s 2 0 25 "26 19" _null_ _null_ _null_ _null_ "select description from pg_catalog.pg_shdescription where objoid = $1 and classoid = (select oid from pg_catalog.pg_class where relname = $2 and relnamespace = PGNSP)" _null_ _null_ _null_ )); DESCR("get description for object id and shared catalog name"); DATA(insert OID = 1217 ( date_trunc PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 1184 "25 1184" _null_ _null_ _null_ _null_ timestamptz_trunc _null_ _null_ _null_ )); DESCR("truncate timestamp with time zone to specified units"); DATA(insert OID = 1218 ( date_trunc PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "25 1186" _null_ _null_ _null_ _null_ interval_trunc _null_ _null_ _null_ )); DESCR("truncate interval to specified units"); DATA(insert OID = 1219 ( int8inc PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ int8inc _null_ _null_ _null_ )); DESCR("increment"); DATA(insert OID = 2804 ( int8inc_any PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 2276" _null_ _null_ _null_ _null_ int8inc_any _null_ _null_ _null_ )); DESCR("increment, ignores second argument"); DATA(insert OID = 1230 ( int8abs PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ int8abs _null_ _null_ _null_ )); DATA(insert OID = 1236 ( int8larger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ int8larger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 1237 ( int8smaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ int8smaller _null_ _null_ _null_ )); DESCR("smaller of two"); DATA(insert OID = 1238 ( texticregexeq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ texticregexeq _null_ _null_ _null_ )); DATA(insert OID = 1239 ( texticregexne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ texticregexne _null_ _null_ _null_ )); DATA(insert OID = 1240 ( nameicregexeq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ nameicregexeq _null_ _null_ _null_ )); DATA(insert OID = 1241 ( nameicregexne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ nameicregexne _null_ _null_ _null_ )); DATA(insert OID = 1251 ( int4abs PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ int4abs _null_ _null_ _null_ )); DATA(insert OID = 1253 ( int2abs PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "21" _null_ _null_ _null_ _null_ int2abs _null_ _null_ _null_ )); DATA(insert OID = 1271 ( overlaps PGNSP PGUID 12 1 0 0 0 f f f f f f i 4 0 16 "1266 1266 1266 1266" _null_ _null_ _null_ _null_ overlaps_timetz _null_ _null_ _null_ )); DESCR("intervals overlap?"); DATA(insert OID = 1272 ( datetime_pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "1082 1083" _null_ _null_ _null_ _null_ datetime_timestamp _null_ _null_ _null_ )); DATA(insert OID = 1273 ( date_part PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "25 1266" _null_ _null_ _null_ _null_ timetz_part _null_ _null_ _null_ )); DESCR("extract field from time with time zone"); DATA(insert OID = 1274 ( int84pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 23" _null_ _null_ _null_ _null_ int84pl _null_ _null_ _null_ )); DATA(insert OID = 1275 ( int84mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 23" _null_ _null_ _null_ _null_ int84mi _null_ _null_ _null_ )); DATA(insert OID = 1276 ( int84mul PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 23" _null_ _null_ _null_ _null_ int84mul _null_ _null_ _null_ )); DATA(insert OID = 1277 ( int84div PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 23" _null_ _null_ _null_ _null_ int84div _null_ _null_ _null_ )); DATA(insert OID = 1278 ( int48pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "23 20" _null_ _null_ _null_ _null_ int48pl _null_ _null_ _null_ )); DATA(insert OID = 1279 ( int48mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "23 20" _null_ _null_ _null_ _null_ int48mi _null_ _null_ _null_ )); DATA(insert OID = 1280 ( int48mul PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "23 20" _null_ _null_ _null_ _null_ int48mul _null_ _null_ _null_ )); DATA(insert OID = 1281 ( int48div PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "23 20" _null_ _null_ _null_ _null_ int48div _null_ _null_ _null_ )); DATA(insert OID = 837 ( int82pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 21" _null_ _null_ _null_ _null_ int82pl _null_ _null_ _null_ )); DATA(insert OID = 838 ( int82mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 21" _null_ _null_ _null_ _null_ int82mi _null_ _null_ _null_ )); DATA(insert OID = 839 ( int82mul PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 21" _null_ _null_ _null_ _null_ int82mul _null_ _null_ _null_ )); DATA(insert OID = 840 ( int82div PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 21" _null_ _null_ _null_ _null_ int82div _null_ _null_ _null_ )); DATA(insert OID = 841 ( int28pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "21 20" _null_ _null_ _null_ _null_ int28pl _null_ _null_ _null_ )); DATA(insert OID = 942 ( int28mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "21 20" _null_ _null_ _null_ _null_ int28mi _null_ _null_ _null_ )); DATA(insert OID = 943 ( int28mul PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "21 20" _null_ _null_ _null_ _null_ int28mul _null_ _null_ _null_ )); DATA(insert OID = 948 ( int28div PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "21 20" _null_ _null_ _null_ _null_ int28div _null_ _null_ _null_ )); DATA(insert OID = 1287 ( oid PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 26 "20" _null_ _null_ _null_ _null_ i8tooid _null_ _null_ _null_ )); DESCR("convert int8 to oid"); DATA(insert OID = 1288 ( int8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "26" _null_ _null_ _null_ _null_ oidtoi8 _null_ _null_ _null_ )); DESCR("convert oid to int8"); DATA(insert OID = 1291 ( suppress_redundant_updates_trigger PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ suppress_redundant_updates_trigger _null_ _null_ _null_ )); DESCR("trigger to suppress updates when new and old records match"); DATA(insert OID = 1292 ( tideq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "27 27" _null_ _null_ _null_ _null_ tideq _null_ _null_ _null_ )); DATA(insert OID = 1293 ( currtid PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 27 "26 27" _null_ _null_ _null_ _null_ currtid_byreloid _null_ _null_ _null_ )); DESCR("latest tid of a tuple"); DATA(insert OID = 1294 ( currtid2 PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 27 "25 27" _null_ _null_ _null_ _null_ currtid_byrelname _null_ _null_ _null_ )); DESCR("latest tid of a tuple"); DATA(insert OID = 1265 ( tidne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "27 27" _null_ _null_ _null_ _null_ tidne _null_ _null_ _null_ )); DATA(insert OID = 2790 ( tidgt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "27 27" _null_ _null_ _null_ _null_ tidgt _null_ _null_ _null_ )); DATA(insert OID = 2791 ( tidlt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "27 27" _null_ _null_ _null_ _null_ tidlt _null_ _null_ _null_ )); DATA(insert OID = 2792 ( tidge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "27 27" _null_ _null_ _null_ _null_ tidge _null_ _null_ _null_ )); DATA(insert OID = 2793 ( tidle PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "27 27" _null_ _null_ _null_ _null_ tidle _null_ _null_ _null_ )); DATA(insert OID = 2794 ( bttidcmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "27 27" _null_ _null_ _null_ _null_ bttidcmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 2795 ( tidlarger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 27 "27 27" _null_ _null_ _null_ _null_ tidlarger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 2796 ( tidsmaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 27 "27 27" _null_ _null_ _null_ _null_ tidsmaller _null_ _null_ _null_ )); DESCR("smaller of two"); DATA(insert OID = 1296 ( timedate_pl PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 1114 "1083 1082" _null_ _null_ _null_ _null_ "select ($2 + $1)" _null_ _null_ _null_ )); DATA(insert OID = 1297 ( datetimetz_pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1184 "1082 1266" _null_ _null_ _null_ _null_ datetimetz_timestamptz _null_ _null_ _null_ )); DATA(insert OID = 1298 ( timetzdate_pl PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 1184 "1266 1082" _null_ _null_ _null_ _null_ "select ($2 + $1)" _null_ _null_ _null_ )); DATA(insert OID = 1299 ( now PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ now _null_ _null_ _null_ )); DESCR("current transaction time"); DATA(insert OID = 2647 ( transaction_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ now _null_ _null_ _null_ )); DESCR("current transaction time"); DATA(insert OID = 2648 ( statement_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ statement_timestamp _null_ _null_ _null_ )); DESCR("current statement time"); DATA(insert OID = 2649 ( clock_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 1184 "" _null_ _null_ _null_ _null_ clock_timestamp _null_ _null_ _null_ )); DESCR("current clock time"); /* OIDS 1300 - 1399 */ DATA(insert OID = 1300 ( positionsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ positionsel _null_ _null_ _null_ )); DESCR("restriction selectivity for position-comparison operators"); DATA(insert OID = 1301 ( positionjoinsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ positionjoinsel _null_ _null_ _null_ )); DESCR("join selectivity for position-comparison operators"); DATA(insert OID = 1302 ( contsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ contsel _null_ _null_ _null_ )); DESCR("restriction selectivity for containment comparison operators"); DATA(insert OID = 1303 ( contjoinsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ contjoinsel _null_ _null_ _null_ )); DESCR("join selectivity for containment comparison operators"); DATA(insert OID = 1304 ( overlaps PGNSP PGUID 12 1 0 0 0 f f f f f f i 4 0 16 "1184 1184 1184 1184" _null_ _null_ _null_ _null_ overlaps_timestamp _null_ _null_ _null_ )); DESCR("intervals overlap?"); DATA(insert OID = 1305 ( overlaps PGNSP PGUID 14 1 0 0 0 f f f f f f s 4 0 16 "1184 1186 1184 1186" _null_ _null_ _null_ _null_ "select ($1, ($1 + $2)) overlaps ($3, ($3 + $4))" _null_ _null_ _null_ )); DESCR("intervals overlap?"); DATA(insert OID = 1306 ( overlaps PGNSP PGUID 14 1 0 0 0 f f f f f f s 4 0 16 "1184 1184 1184 1186" _null_ _null_ _null_ _null_ "select ($1, $2) overlaps ($3, ($3 + $4))" _null_ _null_ _null_ )); DESCR("intervals overlap?"); DATA(insert OID = 1307 ( overlaps PGNSP PGUID 14 1 0 0 0 f f f f f f s 4 0 16 "1184 1186 1184 1184" _null_ _null_ _null_ _null_ "select ($1, ($1 + $2)) overlaps ($3, $4)" _null_ _null_ _null_ )); DESCR("intervals overlap?"); DATA(insert OID = 1308 ( overlaps PGNSP PGUID 12 1 0 0 0 f f f f f f i 4 0 16 "1083 1083 1083 1083" _null_ _null_ _null_ _null_ overlaps_time _null_ _null_ _null_ )); DESCR("intervals overlap?"); DATA(insert OID = 1309 ( overlaps PGNSP PGUID 14 1 0 0 0 f f f f f f i 4 0 16 "1083 1186 1083 1186" _null_ _null_ _null_ _null_ "select ($1, ($1 + $2)) overlaps ($3, ($3 + $4))" _null_ _null_ _null_ )); DESCR("intervals overlap?"); DATA(insert OID = 1310 ( overlaps PGNSP PGUID 14 1 0 0 0 f f f f f f i 4 0 16 "1083 1083 1083 1186" _null_ _null_ _null_ _null_ "select ($1, $2) overlaps ($3, ($3 + $4))" _null_ _null_ _null_ )); DESCR("intervals overlap?"); DATA(insert OID = 1311 ( overlaps PGNSP PGUID 14 1 0 0 0 f f f f f f i 4 0 16 "1083 1186 1083 1083" _null_ _null_ _null_ _null_ "select ($1, ($1 + $2)) overlaps ($3, $4)" _null_ _null_ _null_ )); DESCR("intervals overlap?"); DATA(insert OID = 1312 ( timestamp_in PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 1114 "2275 26 23" _null_ _null_ _null_ _null_ timestamp_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1313 ( timestamp_out PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "1114" _null_ _null_ _null_ _null_ timestamp_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2905 ( timestamptypmodin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ timestamptypmodin _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 2906 ( timestamptypmodout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ timestamptypmodout _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 1314 ( timestamptz_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1184 1184" _null_ _null_ _null_ _null_ timestamp_cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 1315 ( interval_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1186 1186" _null_ _null_ _null_ _null_ interval_cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 1316 ( time PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1083 "1114" _null_ _null_ _null_ _null_ timestamp_time _null_ _null_ _null_ )); DESCR("convert timestamp to time"); DATA(insert OID = 1317 ( length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ textlen _null_ _null_ _null_ )); DESCR("length"); DATA(insert OID = 1318 ( length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1042" _null_ _null_ _null_ _null_ bpcharlen _null_ _null_ _null_ )); DESCR("character length"); DATA(insert OID = 1319 ( xideqint4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "28 23" _null_ _null_ _null_ _null_ xideq _null_ _null_ _null_ )); DATA(insert OID = 1326 ( interval_div PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1186 701" _null_ _null_ _null_ _null_ interval_div _null_ _null_ _null_ )); DATA(insert OID = 1339 ( dlog10 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dlog10 _null_ _null_ _null_ )); DESCR("base 10 logarithm"); DATA(insert OID = 1340 ( log PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dlog10 _null_ _null_ _null_ )); DESCR("base 10 logarithm"); DATA(insert OID = 1341 ( ln PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dlog1 _null_ _null_ _null_ )); DESCR("natural logarithm"); DATA(insert OID = 1342 ( round PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dround _null_ _null_ _null_ )); DESCR("round to nearest integer"); DATA(insert OID = 1343 ( trunc PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dtrunc _null_ _null_ _null_ )); DESCR("truncate to integer"); DATA(insert OID = 1344 ( sqrt PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dsqrt _null_ _null_ _null_ )); DESCR("square root"); DATA(insert OID = 1345 ( cbrt PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dcbrt _null_ _null_ _null_ )); DESCR("cube root"); DATA(insert OID = 1346 ( pow PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ dpow _null_ _null_ _null_ )); DESCR("exponentiation"); DATA(insert OID = 1368 ( power PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ dpow _null_ _null_ _null_ )); DESCR("exponentiation"); DATA(insert OID = 1347 ( exp PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dexp _null_ _null_ _null_ )); DESCR("natural exponential (e^x)"); /* * This form of obj_description is now deprecated, since it will fail if * OIDs are not unique across system catalogs. Use the other form instead. */ DATA(insert OID = 1348 ( obj_description PGNSP PGUID 14 100 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ "select description from pg_catalog.pg_description where objoid = $1 and objsubid = 0" _null_ _null_ _null_ )); DESCR("deprecated, use two-argument form instead"); DATA(insert OID = 1349 ( oidvectortypes PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "30" _null_ _null_ _null_ _null_ oidvectortypes _null_ _null_ _null_ )); DESCR("print type names of oidvector field"); DATA(insert OID = 1350 ( timetz_in PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 1266 "2275 26 23" _null_ _null_ _null_ _null_ timetz_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1351 ( timetz_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "1266" _null_ _null_ _null_ _null_ timetz_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2911 ( timetztypmodin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ timetztypmodin _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 2912 ( timetztypmodout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ timetztypmodout _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 1352 ( timetz_eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1266 1266" _null_ _null_ _null_ _null_ timetz_eq _null_ _null_ _null_ )); DATA(insert OID = 1353 ( timetz_ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1266 1266" _null_ _null_ _null_ _null_ timetz_ne _null_ _null_ _null_ )); DATA(insert OID = 1354 ( timetz_lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1266 1266" _null_ _null_ _null_ _null_ timetz_lt _null_ _null_ _null_ )); DATA(insert OID = 1355 ( timetz_le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1266 1266" _null_ _null_ _null_ _null_ timetz_le _null_ _null_ _null_ )); DATA(insert OID = 1356 ( timetz_ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1266 1266" _null_ _null_ _null_ _null_ timetz_ge _null_ _null_ _null_ )); DATA(insert OID = 1357 ( timetz_gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1266 1266" _null_ _null_ _null_ _null_ timetz_gt _null_ _null_ _null_ )); DATA(insert OID = 1358 ( timetz_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1266 1266" _null_ _null_ _null_ _null_ timetz_cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 1359 ( timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1184 "1082 1266" _null_ _null_ _null_ _null_ datetimetz_timestamptz _null_ _null_ _null_ )); DESCR("convert date and time with time zone to timestamp with time zone"); DATA(insert OID = 1364 ( time PGNSP PGUID 14 1 0 0 0 f f f f t f s 1 0 1083 "702" _null_ _null_ _null_ _null_ "select cast(cast($1 as timestamp without time zone) as pg_catalog.time)" _null_ _null_ _null_ )); DESCR("convert abstime to time"); DATA(insert OID = 1367 ( character_length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1042" _null_ _null_ _null_ _null_ bpcharlen _null_ _null_ _null_ )); DESCR("character length"); DATA(insert OID = 1369 ( character_length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ textlen _null_ _null_ _null_ )); DESCR("character length"); DATA(insert OID = 1370 ( interval PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1186 "1083" _null_ _null_ _null_ _null_ time_interval _null_ _null_ _null_ )); DESCR("convert time to interval"); DATA(insert OID = 1372 ( char_length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1042" _null_ _null_ _null_ _null_ bpcharlen _null_ _null_ _null_ )); DESCR("character length"); DATA(insert OID = 1374 ( octet_length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ textoctetlen _null_ _null_ _null_ )); DESCR("octet length"); DATA(insert OID = 1375 ( octet_length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1042" _null_ _null_ _null_ _null_ bpcharoctetlen _null_ _null_ _null_ )); DESCR("octet length"); DATA(insert OID = 1377 ( time_larger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1083 "1083 1083" _null_ _null_ _null_ _null_ time_larger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 1378 ( time_smaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1083 "1083 1083" _null_ _null_ _null_ _null_ time_smaller _null_ _null_ _null_ )); DESCR("smaller of two"); DATA(insert OID = 1379 ( timetz_larger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1266 "1266 1266" _null_ _null_ _null_ _null_ timetz_larger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 1380 ( timetz_smaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1266 "1266 1266" _null_ _null_ _null_ _null_ timetz_smaller _null_ _null_ _null_ )); DESCR("smaller of two"); DATA(insert OID = 1381 ( char_length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ textlen _null_ _null_ _null_ )); DESCR("character length"); DATA(insert OID = 1382 ( date_part PGNSP PGUID 14 1 0 0 0 f f f f t f s 2 0 701 "25 702" _null_ _null_ _null_ _null_ "select pg_catalog.date_part($1, cast($2 as timestamp with time zone))" _null_ _null_ _null_ )); DESCR("extract field from abstime"); DATA(insert OID = 1383 ( date_part PGNSP PGUID 14 1 0 0 0 f f f f t f s 2 0 701 "25 703" _null_ _null_ _null_ _null_ "select pg_catalog.date_part($1, cast($2 as pg_catalog.interval))" _null_ _null_ _null_ )); DESCR("extract field from reltime"); DATA(insert OID = 1384 ( date_part PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 701 "25 1082" _null_ _null_ _null_ _null_ "select pg_catalog.date_part($1, cast($2 as timestamp without time zone))" _null_ _null_ _null_ )); DESCR("extract field from date"); DATA(insert OID = 1385 ( date_part PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "25 1083" _null_ _null_ _null_ _null_ time_part _null_ _null_ _null_ )); DESCR("extract field from time"); DATA(insert OID = 1386 ( age PGNSP PGUID 14 1 0 0 0 f f f f t f s 1 0 1186 "1184" _null_ _null_ _null_ _null_ "select pg_catalog.age(cast(current_date as timestamp with time zone), $1)" _null_ _null_ _null_ )); DESCR("date difference from today preserving months and years"); DATA(insert OID = 1388 ( timetz PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1266 "1184" _null_ _null_ _null_ _null_ timestamptz_timetz _null_ _null_ _null_ )); DESCR("convert timestamp with time zone to time with time zone"); DATA(insert OID = 1373 ( isfinite PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "1082" _null_ _null_ _null_ _null_ date_finite _null_ _null_ _null_ )); DESCR("finite date?"); DATA(insert OID = 1389 ( isfinite PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "1184" _null_ _null_ _null_ _null_ timestamp_finite _null_ _null_ _null_ )); DESCR("finite timestamp?"); DATA(insert OID = 1390 ( isfinite PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "1186" _null_ _null_ _null_ _null_ interval_finite _null_ _null_ _null_ )); DESCR("finite interval?"); DATA(insert OID = 1376 ( factorial PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "20" _null_ _null_ _null_ _null_ numeric_fac _null_ _null_ _null_ )); DESCR("factorial"); DATA(insert OID = 1394 ( abs PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "700" _null_ _null_ _null_ _null_ float4abs _null_ _null_ _null_ )); DESCR("absolute value"); DATA(insert OID = 1395 ( abs PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ float8abs _null_ _null_ _null_ )); DESCR("absolute value"); DATA(insert OID = 1396 ( abs PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ int8abs _null_ _null_ _null_ )); DESCR("absolute value"); DATA(insert OID = 1397 ( abs PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ int4abs _null_ _null_ _null_ )); DESCR("absolute value"); DATA(insert OID = 1398 ( abs PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "21" _null_ _null_ _null_ _null_ int2abs _null_ _null_ _null_ )); DESCR("absolute value"); /* OIDS 1400 - 1499 */ DATA(insert OID = 1400 ( name PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 19 "1043" _null_ _null_ _null_ _null_ text_name _null_ _null_ _null_ )); DESCR("convert varchar to name"); DATA(insert OID = 1401 ( varchar PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1043 "19" _null_ _null_ _null_ _null_ name_text _null_ _null_ _null_ )); DESCR("convert name to varchar"); DATA(insert OID = 1402 ( current_schema PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 19 "" _null_ _null_ _null_ _null_ current_schema _null_ _null_ _null_ )); DESCR("current schema name"); DATA(insert OID = 1403 ( current_schemas PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1003 "16" _null_ _null_ _null_ _null_ current_schemas _null_ _null_ _null_ )); DESCR("current schema search list"); DATA(insert OID = 1404 ( overlay PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 25 "25 25 23 23" _null_ _null_ _null_ _null_ textoverlay _null_ _null_ _null_ )); DESCR("substitute portion of string"); DATA(insert OID = 1405 ( overlay PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 25 "25 25 23" _null_ _null_ _null_ _null_ textoverlay_no_len _null_ _null_ _null_ )); DESCR("substitute portion of string"); DATA(insert OID = 1406 ( isvertical PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_ point_vert _null_ _null_ _null_ )); DESCR("vertically aligned"); DATA(insert OID = 1407 ( ishorizontal PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_ point_horiz _null_ _null_ _null_ )); DESCR("horizontally aligned"); DATA(insert OID = 1408 ( isparallel PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_ lseg_parallel _null_ _null_ _null_ )); DESCR("parallel"); DATA(insert OID = 1409 ( isperp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_ lseg_perp _null_ _null_ _null_ )); DESCR("perpendicular"); DATA(insert OID = 1410 ( isvertical PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "601" _null_ _null_ _null_ _null_ lseg_vertical _null_ _null_ _null_ )); DESCR("vertical"); DATA(insert OID = 1411 ( ishorizontal PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "601" _null_ _null_ _null_ _null_ lseg_horizontal _null_ _null_ _null_ )); DESCR("horizontal"); DATA(insert OID = 1412 ( isparallel PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "628 628" _null_ _null_ _null_ _null_ line_parallel _null_ _null_ _null_ )); DESCR("parallel"); DATA(insert OID = 1413 ( isperp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "628 628" _null_ _null_ _null_ _null_ line_perp _null_ _null_ _null_ )); DESCR("perpendicular"); DATA(insert OID = 1414 ( isvertical PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "628" _null_ _null_ _null_ _null_ line_vertical _null_ _null_ _null_ )); DESCR("vertical"); DATA(insert OID = 1415 ( ishorizontal PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "628" _null_ _null_ _null_ _null_ line_horizontal _null_ _null_ _null_ )); DESCR("horizontal"); DATA(insert OID = 1416 ( point PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "718" _null_ _null_ _null_ _null_ circle_center _null_ _null_ _null_ )); DESCR("center of"); DATA(insert OID = 1419 ( time PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1083 "1186" _null_ _null_ _null_ _null_ interval_time _null_ _null_ _null_ )); DESCR("convert interval to time"); DATA(insert OID = 1421 ( box PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 603 "600 600" _null_ _null_ _null_ _null_ points_box _null_ _null_ _null_ )); DESCR("convert points to box"); DATA(insert OID = 1422 ( box_add PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 603 "603 600" _null_ _null_ _null_ _null_ box_add _null_ _null_ _null_ )); DATA(insert OID = 1423 ( box_sub PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 603 "603 600" _null_ _null_ _null_ _null_ box_sub _null_ _null_ _null_ )); DATA(insert OID = 1424 ( box_mul PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 603 "603 600" _null_ _null_ _null_ _null_ box_mul _null_ _null_ _null_ )); DATA(insert OID = 1425 ( box_div PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 603 "603 600" _null_ _null_ _null_ _null_ box_div _null_ _null_ _null_ )); DATA(insert OID = 1426 ( path_contain_pt PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 16 "602 600" _null_ _null_ _null_ _null_ "select pg_catalog.on_ppath($2, $1)" _null_ _null_ _null_ )); DATA(insert OID = 1428 ( poly_contain_pt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 600" _null_ _null_ _null_ _null_ poly_contain_pt _null_ _null_ _null_ )); DATA(insert OID = 1429 ( pt_contained_poly PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 604" _null_ _null_ _null_ _null_ pt_contained_poly _null_ _null_ _null_ )); DATA(insert OID = 1430 ( isclosed PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "602" _null_ _null_ _null_ _null_ path_isclosed _null_ _null_ _null_ )); DESCR("path closed?"); DATA(insert OID = 1431 ( isopen PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "602" _null_ _null_ _null_ _null_ path_isopen _null_ _null_ _null_ )); DESCR("path open?"); DATA(insert OID = 1432 ( path_npoints PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "602" _null_ _null_ _null_ _null_ path_npoints _null_ _null_ _null_ )); /* pclose and popen might better be named close and open, but that crashes initdb. * - thomas 97/04/20 */ DATA(insert OID = 1433 ( pclose PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 602 "602" _null_ _null_ _null_ _null_ path_close _null_ _null_ _null_ )); DESCR("close path"); DATA(insert OID = 1434 ( popen PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 602 "602" _null_ _null_ _null_ _null_ path_open _null_ _null_ _null_ )); DESCR("open path"); DATA(insert OID = 1435 ( path_add PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 602 "602 602" _null_ _null_ _null_ _null_ path_add _null_ _null_ _null_ )); DATA(insert OID = 1436 ( path_add_pt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 602 "602 600" _null_ _null_ _null_ _null_ path_add_pt _null_ _null_ _null_ )); DATA(insert OID = 1437 ( path_sub_pt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 602 "602 600" _null_ _null_ _null_ _null_ path_sub_pt _null_ _null_ _null_ )); DATA(insert OID = 1438 ( path_mul_pt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 602 "602 600" _null_ _null_ _null_ _null_ path_mul_pt _null_ _null_ _null_ )); DATA(insert OID = 1439 ( path_div_pt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 602 "602 600" _null_ _null_ _null_ _null_ path_div_pt _null_ _null_ _null_ )); DATA(insert OID = 1440 ( point PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "701 701" _null_ _null_ _null_ _null_ construct_point _null_ _null_ _null_ )); DESCR("convert x, y to point"); DATA(insert OID = 1441 ( point_add PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "600 600" _null_ _null_ _null_ _null_ point_add _null_ _null_ _null_ )); DATA(insert OID = 1442 ( point_sub PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "600 600" _null_ _null_ _null_ _null_ point_sub _null_ _null_ _null_ )); DATA(insert OID = 1443 ( point_mul PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "600 600" _null_ _null_ _null_ _null_ point_mul _null_ _null_ _null_ )); DATA(insert OID = 1444 ( point_div PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "600 600" _null_ _null_ _null_ _null_ point_div _null_ _null_ _null_ )); DATA(insert OID = 1445 ( poly_npoints PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "604" _null_ _null_ _null_ _null_ poly_npoints _null_ _null_ _null_ )); DATA(insert OID = 1446 ( box PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 603 "604" _null_ _null_ _null_ _null_ poly_box _null_ _null_ _null_ )); DESCR("convert polygon to bounding box"); DATA(insert OID = 1447 ( path PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 602 "604" _null_ _null_ _null_ _null_ poly_path _null_ _null_ _null_ )); DESCR("convert polygon to path"); DATA(insert OID = 1448 ( polygon PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 604 "603" _null_ _null_ _null_ _null_ box_poly _null_ _null_ _null_ )); DESCR("convert box to polygon"); DATA(insert OID = 1449 ( polygon PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 604 "602" _null_ _null_ _null_ _null_ path_poly _null_ _null_ _null_ )); DESCR("convert path to polygon"); DATA(insert OID = 1450 ( circle_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 718 "2275" _null_ _null_ _null_ _null_ circle_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1451 ( circle_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "718" _null_ _null_ _null_ _null_ circle_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1452 ( circle_same PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_ circle_same _null_ _null_ _null_ )); DATA(insert OID = 1453 ( circle_contain PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_ circle_contain _null_ _null_ _null_ )); DATA(insert OID = 1454 ( circle_left PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_ circle_left _null_ _null_ _null_ )); DATA(insert OID = 1455 ( circle_overleft PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_ circle_overleft _null_ _null_ _null_ )); DATA(insert OID = 1456 ( circle_overright PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_ circle_overright _null_ _null_ _null_ )); DATA(insert OID = 1457 ( circle_right PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_ circle_right _null_ _null_ _null_ )); DATA(insert OID = 1458 ( circle_contained PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_ circle_contained _null_ _null_ _null_ )); DATA(insert OID = 1459 ( circle_overlap PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_ circle_overlap _null_ _null_ _null_ )); DATA(insert OID = 1460 ( circle_below PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_ circle_below _null_ _null_ _null_ )); DATA(insert OID = 1461 ( circle_above PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_ circle_above _null_ _null_ _null_ )); DATA(insert OID = 1462 ( circle_eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_ circle_eq _null_ _null_ _null_ )); DATA(insert OID = 1463 ( circle_ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_ circle_ne _null_ _null_ _null_ )); DATA(insert OID = 1464 ( circle_lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_ circle_lt _null_ _null_ _null_ )); DATA(insert OID = 1465 ( circle_gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_ circle_gt _null_ _null_ _null_ )); DATA(insert OID = 1466 ( circle_le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_ circle_le _null_ _null_ _null_ )); DATA(insert OID = 1467 ( circle_ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_ circle_ge _null_ _null_ _null_ )); DATA(insert OID = 1468 ( area PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "718" _null_ _null_ _null_ _null_ circle_area _null_ _null_ _null_ )); DESCR("area of circle"); DATA(insert OID = 1469 ( diameter PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "718" _null_ _null_ _null_ _null_ circle_diameter _null_ _null_ _null_ )); DESCR("diameter of circle"); DATA(insert OID = 1470 ( radius PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "718" _null_ _null_ _null_ _null_ circle_radius _null_ _null_ _null_ )); DESCR("radius of circle"); DATA(insert OID = 1471 ( circle_distance PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "718 718" _null_ _null_ _null_ _null_ circle_distance _null_ _null_ _null_ )); DATA(insert OID = 1472 ( circle_center PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "718" _null_ _null_ _null_ _null_ circle_center _null_ _null_ _null_ )); DATA(insert OID = 1473 ( circle PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 718 "600 701" _null_ _null_ _null_ _null_ cr_circle _null_ _null_ _null_ )); DESCR("convert point and radius to circle"); DATA(insert OID = 1474 ( circle PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 718 "604" _null_ _null_ _null_ _null_ poly_circle _null_ _null_ _null_ )); DESCR("convert polygon to circle"); DATA(insert OID = 1475 ( polygon PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 604 "23 718" _null_ _null_ _null_ _null_ circle_poly _null_ _null_ _null_ )); DESCR("convert vertex count and circle to polygon"); DATA(insert OID = 1476 ( dist_pc PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "600 718" _null_ _null_ _null_ _null_ dist_pc _null_ _null_ _null_ )); DATA(insert OID = 1477 ( circle_contain_pt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 600" _null_ _null_ _null_ _null_ circle_contain_pt _null_ _null_ _null_ )); DATA(insert OID = 1478 ( pt_contained_circle PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 718" _null_ _null_ _null_ _null_ pt_contained_circle _null_ _null_ _null_ )); DATA(insert OID = 1479 ( circle PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 718 "603" _null_ _null_ _null_ _null_ box_circle _null_ _null_ _null_ )); DESCR("convert box to circle"); DATA(insert OID = 1480 ( box PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 603 "718" _null_ _null_ _null_ _null_ circle_box _null_ _null_ _null_ )); DESCR("convert circle to box"); DATA(insert OID = 1481 ( tinterval PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 704 "702 702" _null_ _null_ _null_ _null_ mktinterval _null_ _null_ _null_ )); DESCR("convert to tinterval"); DATA(insert OID = 1482 ( lseg_ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_ lseg_ne _null_ _null_ _null_ )); DATA(insert OID = 1483 ( lseg_lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_ lseg_lt _null_ _null_ _null_ )); DATA(insert OID = 1484 ( lseg_le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_ lseg_le _null_ _null_ _null_ )); DATA(insert OID = 1485 ( lseg_gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_ lseg_gt _null_ _null_ _null_ )); DATA(insert OID = 1486 ( lseg_ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "601 601" _null_ _null_ _null_ _null_ lseg_ge _null_ _null_ _null_ )); DATA(insert OID = 1487 ( lseg_length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "601" _null_ _null_ _null_ _null_ lseg_length _null_ _null_ _null_ )); DATA(insert OID = 1488 ( close_ls PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "628 601" _null_ _null_ _null_ _null_ close_ls _null_ _null_ _null_ )); DATA(insert OID = 1489 ( close_lseg PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "601 601" _null_ _null_ _null_ _null_ close_lseg _null_ _null_ _null_ )); DATA(insert OID = 1490 ( line_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 628 "2275" _null_ _null_ _null_ _null_ line_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1491 ( line_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "628" _null_ _null_ _null_ _null_ line_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1492 ( line_eq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "628 628" _null_ _null_ _null_ _null_ line_eq _null_ _null_ _null_ )); DATA(insert OID = 1493 ( line PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 628 "600 600" _null_ _null_ _null_ _null_ line_construct_pp _null_ _null_ _null_ )); DESCR("construct line from points"); DATA(insert OID = 1494 ( line_interpt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 600 "628 628" _null_ _null_ _null_ _null_ line_interpt _null_ _null_ _null_ )); DATA(insert OID = 1495 ( line_intersect PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "628 628" _null_ _null_ _null_ _null_ line_intersect _null_ _null_ _null_ )); DATA(insert OID = 1496 ( line_parallel PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "628 628" _null_ _null_ _null_ _null_ line_parallel _null_ _null_ _null_ )); DATA(insert OID = 1497 ( line_perp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "628 628" _null_ _null_ _null_ _null_ line_perp _null_ _null_ _null_ )); DATA(insert OID = 1498 ( line_vertical PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "628" _null_ _null_ _null_ _null_ line_vertical _null_ _null_ _null_ )); DATA(insert OID = 1499 ( line_horizontal PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "628" _null_ _null_ _null_ _null_ line_horizontal _null_ _null_ _null_ )); /* OIDS 1500 - 1599 */ DATA(insert OID = 1530 ( length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "601" _null_ _null_ _null_ _null_ lseg_length _null_ _null_ _null_ )); DESCR("distance between endpoints"); DATA(insert OID = 1531 ( length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "602" _null_ _null_ _null_ _null_ path_length _null_ _null_ _null_ )); DESCR("sum of path segments"); DATA(insert OID = 1532 ( point PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "601" _null_ _null_ _null_ _null_ lseg_center _null_ _null_ _null_ )); DESCR("center of"); DATA(insert OID = 1533 ( point PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "602" _null_ _null_ _null_ _null_ path_center _null_ _null_ _null_ )); DESCR("center of"); DATA(insert OID = 1534 ( point PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "603" _null_ _null_ _null_ _null_ box_center _null_ _null_ _null_ )); DESCR("center of"); DATA(insert OID = 1540 ( point PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "604" _null_ _null_ _null_ _null_ poly_center _null_ _null_ _null_ )); DESCR("center of"); DATA(insert OID = 1541 ( lseg PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 601 "603" _null_ _null_ _null_ _null_ box_diagonal _null_ _null_ _null_ )); DESCR("diagonal of"); DATA(insert OID = 1542 ( center PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "603" _null_ _null_ _null_ _null_ box_center _null_ _null_ _null_ )); DESCR("center of"); DATA(insert OID = 1543 ( center PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "718" _null_ _null_ _null_ _null_ circle_center _null_ _null_ _null_ )); DESCR("center of"); DATA(insert OID = 1544 ( polygon PGNSP PGUID 14 1 0 0 0 f f f f t f i 1 0 604 "718" _null_ _null_ _null_ _null_ "select pg_catalog.polygon(12, $1)" _null_ _null_ _null_ )); DESCR("convert circle to 12-vertex polygon"); DATA(insert OID = 1545 ( npoints PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "602" _null_ _null_ _null_ _null_ path_npoints _null_ _null_ _null_ )); DESCR("number of points"); DATA(insert OID = 1556 ( npoints PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "604" _null_ _null_ _null_ _null_ poly_npoints _null_ _null_ _null_ )); DESCR("number of points"); DATA(insert OID = 1564 ( bit_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1560 "2275 26 23" _null_ _null_ _null_ _null_ bit_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1565 ( bit_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "1560" _null_ _null_ _null_ _null_ bit_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2919 ( bittypmodin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ bittypmodin _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 2920 ( bittypmodout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ bittypmodout _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 1569 ( like PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ textlike _null_ _null_ _null_ )); DESCR("matches LIKE expression"); DATA(insert OID = 1570 ( notlike PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ textnlike _null_ _null_ _null_ )); DESCR("does not match LIKE expression"); DATA(insert OID = 1571 ( like PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ namelike _null_ _null_ _null_ )); DESCR("matches LIKE expression"); DATA(insert OID = 1572 ( notlike PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ namenlike _null_ _null_ _null_ )); DESCR("does not match LIKE expression"); /* SEQUENCE functions */ DATA(insert OID = 1574 ( nextval PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "2205" _null_ _null_ _null_ _null_ nextval_oid _null_ _null_ _null_ )); DESCR("sequence next value"); DATA(insert OID = 1575 ( currval PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "2205" _null_ _null_ _null_ _null_ currval_oid _null_ _null_ _null_ )); DESCR("sequence current value"); DATA(insert OID = 1576 ( setval PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 20 "2205 20" _null_ _null_ _null_ _null_ setval_oid _null_ _null_ _null_ )); DESCR("set sequence value"); DATA(insert OID = 1765 ( setval PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 20 "2205 20 16" _null_ _null_ _null_ _null_ setval3_oid _null_ _null_ _null_ )); DESCR("set sequence value and is_called status"); DATA(insert OID = 3078 ( pg_sequence_parameters PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2249 "26" "{26,20,20,20,20,16}" "{i,o,o,o,o,o}" "{sequence_oid,start_value,minimum_value,maximum_value,increment,cycle_option}" _null_ pg_sequence_parameters _null_ _null_ _null_)); DESCR("sequence parameters, for use by information schema"); DATA(insert OID = 1579 ( varbit_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1562 "2275 26 23" _null_ _null_ _null_ _null_ varbit_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1580 ( varbit_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "1562" _null_ _null_ _null_ _null_ varbit_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2902 ( varbittypmodin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ varbittypmodin _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 2921 ( varbittypmodout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ varbittypmodout _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 1581 ( biteq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ biteq _null_ _null_ _null_ )); DATA(insert OID = 1582 ( bitne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ bitne _null_ _null_ _null_ )); DATA(insert OID = 1592 ( bitge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ bitge _null_ _null_ _null_ )); DATA(insert OID = 1593 ( bitgt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ bitgt _null_ _null_ _null_ )); DATA(insert OID = 1594 ( bitle PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ bitle _null_ _null_ _null_ )); DATA(insert OID = 1595 ( bitlt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ bitlt _null_ _null_ _null_ )); DATA(insert OID = 1596 ( bitcmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1560 1560" _null_ _null_ _null_ _null_ bitcmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 1598 ( random PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 701 "" _null_ _null_ _null_ _null_ drandom _null_ _null_ _null_ )); DESCR("random value"); DATA(insert OID = 1599 ( setseed PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "701" _null_ _null_ _null_ _null_ setseed _null_ _null_ _null_ )); DESCR("set random seed"); /* OIDS 1600 - 1699 */ DATA(insert OID = 1600 ( asin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dasin _null_ _null_ _null_ )); DESCR("arcsine"); DATA(insert OID = 1601 ( acos PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dacos _null_ _null_ _null_ )); DESCR("arccosine"); DATA(insert OID = 1602 ( atan PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ datan _null_ _null_ _null_ )); DESCR("arctangent"); DATA(insert OID = 1603 ( atan2 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ datan2 _null_ _null_ _null_ )); DESCR("arctangent, two arguments"); DATA(insert OID = 1604 ( sin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dsin _null_ _null_ _null_ )); DESCR("sine"); DATA(insert OID = 1605 ( cos PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dcos _null_ _null_ _null_ )); DESCR("cosine"); DATA(insert OID = 1606 ( tan PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dtan _null_ _null_ _null_ )); DESCR("tangent"); DATA(insert OID = 1607 ( cot PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dcot _null_ _null_ _null_ )); DESCR("cotangent"); DATA(insert OID = 1608 ( degrees PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ degrees _null_ _null_ _null_ )); DESCR("radians to degrees"); DATA(insert OID = 1609 ( radians PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ radians _null_ _null_ _null_ )); DESCR("degrees to radians"); DATA(insert OID = 1610 ( pi PGNSP PGUID 12 1 0 0 0 f f f f t f i 0 0 701 "" _null_ _null_ _null_ _null_ dpi _null_ _null_ _null_ )); DESCR("PI"); DATA(insert OID = 1618 ( interval_mul PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1186 701" _null_ _null_ _null_ _null_ interval_mul _null_ _null_ _null_ )); DATA(insert OID = 1620 ( ascii PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ ascii _null_ _null_ _null_ )); DESCR("convert first char to int4"); DATA(insert OID = 1621 ( chr PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "23" _null_ _null_ _null_ _null_ chr _null_ _null_ _null_ )); DESCR("convert int4 to char"); DATA(insert OID = 1622 ( repeat PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_ repeat _null_ _null_ _null_ )); DESCR("replicate string n times"); DATA(insert OID = 1623 ( similar_escape PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ similar_escape _null_ _null_ _null_ )); DESCR("convert SQL99 regexp pattern to POSIX style"); DATA(insert OID = 1624 ( mul_d_interval PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "701 1186" _null_ _null_ _null_ _null_ mul_d_interval _null_ _null_ _null_ )); DATA(insert OID = 1631 ( bpcharlike PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 25" _null_ _null_ _null_ _null_ textlike _null_ _null_ _null_ )); DATA(insert OID = 1632 ( bpcharnlike PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 25" _null_ _null_ _null_ _null_ textnlike _null_ _null_ _null_ )); DATA(insert OID = 1633 ( texticlike PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ texticlike _null_ _null_ _null_ )); DATA(insert OID = 1634 ( texticnlike PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ texticnlike _null_ _null_ _null_ )); DATA(insert OID = 1635 ( nameiclike PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ nameiclike _null_ _null_ _null_ )); DATA(insert OID = 1636 ( nameicnlike PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ nameicnlike _null_ _null_ _null_ )); DATA(insert OID = 1637 ( like_escape PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ like_escape _null_ _null_ _null_ )); DESCR("convert LIKE pattern to use backslash escapes"); DATA(insert OID = 1656 ( bpcharicregexeq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 25" _null_ _null_ _null_ _null_ texticregexeq _null_ _null_ _null_ )); DATA(insert OID = 1657 ( bpcharicregexne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 25" _null_ _null_ _null_ _null_ texticregexne _null_ _null_ _null_ )); DATA(insert OID = 1658 ( bpcharregexeq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 25" _null_ _null_ _null_ _null_ textregexeq _null_ _null_ _null_ )); DATA(insert OID = 1659 ( bpcharregexne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 25" _null_ _null_ _null_ _null_ textregexne _null_ _null_ _null_ )); DATA(insert OID = 1660 ( bpchariclike PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 25" _null_ _null_ _null_ _null_ texticlike _null_ _null_ _null_ )); DATA(insert OID = 1661 ( bpcharicnlike PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 25" _null_ _null_ _null_ _null_ texticnlike _null_ _null_ _null_ )); /* Oracle Compatibility Related Functions - By Edmund Mergl <E.Mergl@bawue.de> */ DATA(insert OID = 868 ( strpos PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "25 25" _null_ _null_ _null_ _null_ textpos _null_ _null_ _null_ )); DESCR("position of substring"); DATA(insert OID = 870 ( lower PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ lower _null_ _null_ _null_ )); DESCR("lowercase"); DATA(insert OID = 871 ( upper PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ upper _null_ _null_ _null_ )); DESCR("uppercase"); DATA(insert OID = 872 ( initcap PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ initcap _null_ _null_ _null_ )); DESCR("capitalize each word"); DATA(insert OID = 873 ( lpad PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 25 "25 23 25" _null_ _null_ _null_ _null_ lpad _null_ _null_ _null_ )); DESCR("left-pad string to length"); DATA(insert OID = 874 ( rpad PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 25 "25 23 25" _null_ _null_ _null_ _null_ rpad _null_ _null_ _null_ )); DESCR("right-pad string to length"); DATA(insert OID = 875 ( ltrim PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ ltrim _null_ _null_ _null_ )); DESCR("trim selected characters from left end of string"); DATA(insert OID = 876 ( rtrim PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ rtrim _null_ _null_ _null_ )); DESCR("trim selected characters from right end of string"); DATA(insert OID = 877 ( substr PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 25 "25 23 23" _null_ _null_ _null_ _null_ text_substr _null_ _null_ _null_ )); DESCR("extract portion of string"); DATA(insert OID = 878 ( translate PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 25 "25 25 25" _null_ _null_ _null_ _null_ translate _null_ _null_ _null_ )); DESCR("map a set of characters appearing in string"); DATA(insert OID = 879 ( lpad PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_ "select pg_catalog.lpad($1, $2, '' '')" _null_ _null_ _null_ )); DESCR("left-pad string to length"); DATA(insert OID = 880 ( rpad PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_ "select pg_catalog.rpad($1, $2, '' '')" _null_ _null_ _null_ )); DESCR("right-pad string to length"); DATA(insert OID = 881 ( ltrim PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ ltrim1 _null_ _null_ _null_ )); DESCR("trim spaces from left end of string"); DATA(insert OID = 882 ( rtrim PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ rtrim1 _null_ _null_ _null_ )); DESCR("trim spaces from right end of string"); DATA(insert OID = 883 ( substr PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_ text_substr_no_len _null_ _null_ _null_ )); DESCR("extract portion of string"); DATA(insert OID = 884 ( btrim PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ btrim _null_ _null_ _null_ )); DESCR("trim selected characters from both ends of string"); DATA(insert OID = 885 ( btrim PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ btrim1 _null_ _null_ _null_ )); DESCR("trim spaces from both ends of string"); DATA(insert OID = 936 ( substring PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 25 "25 23 23" _null_ _null_ _null_ _null_ text_substr _null_ _null_ _null_ )); DESCR("extract portion of string"); DATA(insert OID = 937 ( substring PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_ text_substr_no_len _null_ _null_ _null_ )); DESCR("extract portion of string"); DATA(insert OID = 2087 ( replace PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 25 "25 25 25" _null_ _null_ _null_ _null_ replace_text _null_ _null_ _null_ )); DESCR("replace all occurrences in string of old_substr with new_substr"); DATA(insert OID = 2284 ( regexp_replace PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 25 "25 25 25" _null_ _null_ _null_ _null_ textregexreplace_noopt _null_ _null_ _null_ )); DESCR("replace text using regexp"); DATA(insert OID = 2285 ( regexp_replace PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 25 "25 25 25 25" _null_ _null_ _null_ _null_ textregexreplace _null_ _null_ _null_ )); DESCR("replace text using regexp"); DATA(insert OID = 2763 ( regexp_matches PGNSP PGUID 12 1 1 0 0 f f f f t t i 2 0 1009 "25 25" _null_ _null_ _null_ _null_ regexp_matches_no_flags _null_ _null_ _null_ )); DESCR("find all match groups for regexp"); DATA(insert OID = 2764 ( regexp_matches PGNSP PGUID 12 1 10 0 0 f f f f t t i 3 0 1009 "25 25 25" _null_ _null_ _null_ _null_ regexp_matches _null_ _null_ _null_ )); DESCR("find all match groups for regexp"); DATA(insert OID = 2088 ( split_part PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 25 "25 25 23" _null_ _null_ _null_ _null_ split_text _null_ _null_ _null_ )); DESCR("split string by field_sep and return field_num"); DATA(insert OID = 2765 ( regexp_split_to_table PGNSP PGUID 12 1 1000 0 0 f f f f t t i 2 0 25 "25 25" _null_ _null_ _null_ _null_ regexp_split_to_table_no_flags _null_ _null_ _null_ )); DESCR("split string by pattern"); DATA(insert OID = 2766 ( regexp_split_to_table PGNSP PGUID 12 1 1000 0 0 f f f f t t i 3 0 25 "25 25 25" _null_ _null_ _null_ _null_ regexp_split_to_table _null_ _null_ _null_ )); DESCR("split string by pattern"); DATA(insert OID = 2767 ( regexp_split_to_array PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1009 "25 25" _null_ _null_ _null_ _null_ regexp_split_to_array_no_flags _null_ _null_ _null_ )); DESCR("split string by pattern"); DATA(insert OID = 2768 ( regexp_split_to_array PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1009 "25 25 25" _null_ _null_ _null_ _null_ regexp_split_to_array _null_ _null_ _null_ )); DESCR("split string by pattern"); DATA(insert OID = 2089 ( to_hex PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "23" _null_ _null_ _null_ _null_ to_hex32 _null_ _null_ _null_ )); DESCR("convert int4 number to hex"); DATA(insert OID = 2090 ( to_hex PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "20" _null_ _null_ _null_ _null_ to_hex64 _null_ _null_ _null_ )); DESCR("convert int8 number to hex"); /* for character set encoding support */ /* return database encoding name */ DATA(insert OID = 1039 ( getdatabaseencoding PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 19 "" _null_ _null_ _null_ _null_ getdatabaseencoding _null_ _null_ _null_ )); DESCR("encoding name of current database"); /* return client encoding name i.e. session encoding */ DATA(insert OID = 810 ( pg_client_encoding PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 19 "" _null_ _null_ _null_ _null_ pg_client_encoding _null_ _null_ _null_ )); DESCR("encoding name of current database"); DATA(insert OID = 1713 ( length PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 23 "17 19" _null_ _null_ _null_ _null_ length_in_encoding _null_ _null_ _null_ )); DESCR("length of string in specified encoding"); DATA(insert OID = 1714 ( convert_from PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "17 19" _null_ _null_ _null_ _null_ pg_convert_from _null_ _null_ _null_ )); DESCR("convert string with specified source encoding name"); DATA(insert OID = 1717 ( convert_to PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 17 "25 19" _null_ _null_ _null_ _null_ pg_convert_to _null_ _null_ _null_ )); DESCR("convert string with specified destination encoding name"); DATA(insert OID = 1813 ( convert PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 17 "17 19 19" _null_ _null_ _null_ _null_ pg_convert _null_ _null_ _null_ )); DESCR("convert string with specified encoding names"); DATA(insert OID = 1264 ( pg_char_to_encoding PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 23 "19" _null_ _null_ _null_ _null_ PG_char_to_encoding _null_ _null_ _null_ )); DESCR("convert encoding name to encoding id"); DATA(insert OID = 1597 ( pg_encoding_to_char PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 19 "23" _null_ _null_ _null_ _null_ PG_encoding_to_char _null_ _null_ _null_ )); DESCR("convert encoding id to encoding name"); DATA(insert OID = 2319 ( pg_encoding_max_length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ pg_encoding_max_length_sql _null_ _null_ _null_ )); DESCR("maximum octet length of a character in given encoding"); DATA(insert OID = 1638 ( oidgt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "26 26" _null_ _null_ _null_ _null_ oidgt _null_ _null_ _null_ )); DATA(insert OID = 1639 ( oidge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "26 26" _null_ _null_ _null_ _null_ oidge _null_ _null_ _null_ )); /* System-view support functions */ DATA(insert OID = 1573 ( pg_get_ruledef PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_ruledef _null_ _null_ _null_ )); DESCR("source text of a rule"); DATA(insert OID = 1640 ( pg_get_viewdef PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "25" _null_ _null_ _null_ _null_ pg_get_viewdef_name _null_ _null_ _null_ )); DESCR("select statement of a view"); DATA(insert OID = 1641 ( pg_get_viewdef PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_viewdef _null_ _null_ _null_ )); DESCR("select statement of a view"); DATA(insert OID = 1642 ( pg_get_userbyid PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 19 "26" _null_ _null_ _null_ _null_ pg_get_userbyid _null_ _null_ _null_ )); DESCR("role name by OID (with fallback)"); DATA(insert OID = 1643 ( pg_get_indexdef PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_indexdef _null_ _null_ _null_ )); DESCR("index description"); DATA(insert OID = 1662 ( pg_get_triggerdef PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_triggerdef _null_ _null_ _null_ )); DESCR("trigger description"); DATA(insert OID = 1387 ( pg_get_constraintdef PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_constraintdef _null_ _null_ _null_ )); DESCR("constraint description"); DATA(insert OID = 1716 ( pg_get_expr PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "194 26" _null_ _null_ _null_ _null_ pg_get_expr _null_ _null_ _null_ )); DESCR("deparse an encoded expression"); DATA(insert OID = 1665 ( pg_get_serial_sequence PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "25 25" _null_ _null_ _null_ _null_ pg_get_serial_sequence _null_ _null_ _null_ )); DESCR("name of sequence for a serial column"); DATA(insert OID = 2098 ( pg_get_functiondef PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_functiondef _null_ _null_ _null_ )); DESCR("definition of a function"); DATA(insert OID = 2162 ( pg_get_function_arguments PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_function_arguments _null_ _null_ _null_ )); DESCR("argument list of a function"); DATA(insert OID = 2232 ( pg_get_function_identity_arguments PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_function_identity_arguments _null_ _null_ _null_ )); DESCR("identity argument list of a function"); DATA(insert OID = 2165 ( pg_get_function_result PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_function_result _null_ _null_ _null_ )); DESCR("result type of a function"); DATA(insert OID = 1686 ( pg_get_keywords PGNSP PGUID 12 10 400 0 0 f f f f t t s 0 0 2249 "" "{25,18,25}" "{o,o,o}" "{word,catcode,catdesc}" _null_ pg_get_keywords _null_ _null_ _null_ )); DESCR("list of SQL keywords"); DATA(insert OID = 2289 ( pg_options_to_table PGNSP PGUID 12 1 3 0 0 f f f f t t s 1 0 2249 "1009" "{1009,25,25}" "{i,o,o}" "{options_array,option_name,option_value}" _null_ pg_options_to_table _null_ _null_ _null_ )); DESCR("convert generic options array to name/value table"); DATA(insert OID = 1619 ( pg_typeof PGNSP PGUID 12 1 0 0 0 f f f f f f s 1 0 2206 "2276" _null_ _null_ _null_ _null_ pg_typeof _null_ _null_ _null_ )); DESCR("type of the argument"); DATA(insert OID = 3162 ( pg_collation_for PGNSP PGUID 12 1 0 0 0 f f f f f f s 1 0 25 "2276" _null_ _null_ _null_ _null_ pg_collation_for _null_ _null_ _null_ )); DESCR("collation of the argument; implementation of the COLLATION FOR expression"); /* Deferrable unique constraint trigger */ DATA(insert OID = 1250 ( unique_key_recheck PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ unique_key_recheck _null_ _null_ _null_ )); DESCR("deferred UNIQUE constraint check"); /* Generic referential integrity constraint triggers */ DATA(insert OID = 1644 ( RI_FKey_check_ins PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ RI_FKey_check_ins _null_ _null_ _null_ )); DESCR("referential integrity FOREIGN KEY ... REFERENCES"); DATA(insert OID = 1645 ( RI_FKey_check_upd PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ RI_FKey_check_upd _null_ _null_ _null_ )); DESCR("referential integrity FOREIGN KEY ... REFERENCES"); DATA(insert OID = 1646 ( RI_FKey_cascade_del PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ RI_FKey_cascade_del _null_ _null_ _null_ )); DESCR("referential integrity ON DELETE CASCADE"); DATA(insert OID = 1647 ( RI_FKey_cascade_upd PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ RI_FKey_cascade_upd _null_ _null_ _null_ )); DESCR("referential integrity ON UPDATE CASCADE"); DATA(insert OID = 1648 ( RI_FKey_restrict_del PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ RI_FKey_restrict_del _null_ _null_ _null_ )); DESCR("referential integrity ON DELETE RESTRICT"); DATA(insert OID = 1649 ( RI_FKey_restrict_upd PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ RI_FKey_restrict_upd _null_ _null_ _null_ )); DESCR("referential integrity ON UPDATE RESTRICT"); DATA(insert OID = 1650 ( RI_FKey_setnull_del PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ RI_FKey_setnull_del _null_ _null_ _null_ )); DESCR("referential integrity ON DELETE SET NULL"); DATA(insert OID = 1651 ( RI_FKey_setnull_upd PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ RI_FKey_setnull_upd _null_ _null_ _null_ )); DESCR("referential integrity ON UPDATE SET NULL"); DATA(insert OID = 1652 ( RI_FKey_setdefault_del PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ RI_FKey_setdefault_del _null_ _null_ _null_ )); DESCR("referential integrity ON DELETE SET DEFAULT"); DATA(insert OID = 1653 ( RI_FKey_setdefault_upd PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ RI_FKey_setdefault_upd _null_ _null_ _null_ )); DESCR("referential integrity ON UPDATE SET DEFAULT"); DATA(insert OID = 1654 ( RI_FKey_noaction_del PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ RI_FKey_noaction_del _null_ _null_ _null_ )); DESCR("referential integrity ON DELETE NO ACTION"); DATA(insert OID = 1655 ( RI_FKey_noaction_upd PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ RI_FKey_noaction_upd _null_ _null_ _null_ )); DESCR("referential integrity ON UPDATE NO ACTION"); DATA(insert OID = 1666 ( varbiteq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ biteq _null_ _null_ _null_ )); DATA(insert OID = 1667 ( varbitne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ bitne _null_ _null_ _null_ )); DATA(insert OID = 1668 ( varbitge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ bitge _null_ _null_ _null_ )); DATA(insert OID = 1669 ( varbitgt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ bitgt _null_ _null_ _null_ )); DATA(insert OID = 1670 ( varbitle PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ bitle _null_ _null_ _null_ )); DATA(insert OID = 1671 ( varbitlt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ bitlt _null_ _null_ _null_ )); DATA(insert OID = 1672 ( varbitcmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1562 1562" _null_ _null_ _null_ _null_ bitcmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 1673 ( bitand PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1560 "1560 1560" _null_ _null_ _null_ _null_ bit_and _null_ _null_ _null_ )); DATA(insert OID = 1674 ( bitor PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1560 "1560 1560" _null_ _null_ _null_ _null_ bit_or _null_ _null_ _null_ )); DATA(insert OID = 1675 ( bitxor PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1560 "1560 1560" _null_ _null_ _null_ _null_ bitxor _null_ _null_ _null_ )); DATA(insert OID = 1676 ( bitnot PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1560 "1560" _null_ _null_ _null_ _null_ bitnot _null_ _null_ _null_ )); DATA(insert OID = 1677 ( bitshiftleft PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1560 "1560 23" _null_ _null_ _null_ _null_ bitshiftleft _null_ _null_ _null_ )); DATA(insert OID = 1678 ( bitshiftright PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1560 "1560 23" _null_ _null_ _null_ _null_ bitshiftright _null_ _null_ _null_ )); DATA(insert OID = 1679 ( bitcat PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1562 "1562 1562" _null_ _null_ _null_ _null_ bitcat _null_ _null_ _null_ )); DATA(insert OID = 1680 ( substring PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1560 "1560 23 23" _null_ _null_ _null_ _null_ bitsubstr _null_ _null_ _null_ )); DESCR("extract portion of bitstring"); DATA(insert OID = 1681 ( length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1560" _null_ _null_ _null_ _null_ bitlength _null_ _null_ _null_ )); DESCR("bitstring length"); DATA(insert OID = 1682 ( octet_length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1560" _null_ _null_ _null_ _null_ bitoctetlength _null_ _null_ _null_ )); DESCR("octet length"); DATA(insert OID = 1683 ( bit PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1560 "23 23" _null_ _null_ _null_ _null_ bitfromint4 _null_ _null_ _null_ )); DESCR("convert int4 to bitstring"); DATA(insert OID = 1684 ( int4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1560" _null_ _null_ _null_ _null_ bittoint4 _null_ _null_ _null_ )); DESCR("convert bitstring to int4"); DATA(insert OID = 1685 ( bit PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1560 "1560 23 16" _null_ _null_ _null_ _null_ bit _null_ _null_ _null_ )); DESCR("adjust bit() to typmod length"); DATA(insert OID = 3158 ( varbit_transform PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ varbit_transform _null_ _null_ _null_ )); DESCR("transform a varbit length coercion"); DATA(insert OID = 1687 ( varbit PGNSP PGUID 12 1 0 0 varbit_transform f f f f t f i 3 0 1562 "1562 23 16" _null_ _null_ _null_ _null_ varbit _null_ _null_ _null_ )); DESCR("adjust varbit() to typmod length"); DATA(insert OID = 1698 ( position PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1560 1560" _null_ _null_ _null_ _null_ bitposition _null_ _null_ _null_ )); DESCR("position of sub-bitstring"); DATA(insert OID = 1699 ( substring PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1560 "1560 23" _null_ _null_ _null_ _null_ bitsubstr_no_len _null_ _null_ _null_ )); DESCR("extract portion of bitstring"); DATA(insert OID = 3030 ( overlay PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 1560 "1560 1560 23 23" _null_ _null_ _null_ _null_ bitoverlay _null_ _null_ _null_ )); DESCR("substitute portion of bitstring"); DATA(insert OID = 3031 ( overlay PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1560 "1560 1560 23" _null_ _null_ _null_ _null_ bitoverlay_no_len _null_ _null_ _null_ )); DESCR("substitute portion of bitstring"); DATA(insert OID = 3032 ( get_bit PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1560 23" _null_ _null_ _null_ _null_ bitgetbit _null_ _null_ _null_ )); DESCR("get bit"); DATA(insert OID = 3033 ( set_bit PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1560 "1560 23 23" _null_ _null_ _null_ _null_ bitsetbit _null_ _null_ _null_ )); DESCR("set bit"); /* for mac type support */ DATA(insert OID = 436 ( macaddr_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 829 "2275" _null_ _null_ _null_ _null_ macaddr_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 437 ( macaddr_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "829" _null_ _null_ _null_ _null_ macaddr_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 753 ( trunc PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 829 "829" _null_ _null_ _null_ _null_ macaddr_trunc _null_ _null_ _null_ )); DESCR("MAC manufacturer fields"); DATA(insert OID = 830 ( macaddr_eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "829 829" _null_ _null_ _null_ _null_ macaddr_eq _null_ _null_ _null_ )); DATA(insert OID = 831 ( macaddr_lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "829 829" _null_ _null_ _null_ _null_ macaddr_lt _null_ _null_ _null_ )); DATA(insert OID = 832 ( macaddr_le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "829 829" _null_ _null_ _null_ _null_ macaddr_le _null_ _null_ _null_ )); DATA(insert OID = 833 ( macaddr_gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "829 829" _null_ _null_ _null_ _null_ macaddr_gt _null_ _null_ _null_ )); DATA(insert OID = 834 ( macaddr_ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "829 829" _null_ _null_ _null_ _null_ macaddr_ge _null_ _null_ _null_ )); DATA(insert OID = 835 ( macaddr_ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "829 829" _null_ _null_ _null_ _null_ macaddr_ne _null_ _null_ _null_ )); DATA(insert OID = 836 ( macaddr_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "829 829" _null_ _null_ _null_ _null_ macaddr_cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 3144 ( macaddr_not PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 829 "829" _null_ _null_ _null_ _null_ macaddr_not _null_ _null_ _null_ )); DATA(insert OID = 3145 ( macaddr_and PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 829 "829 829" _null_ _null_ _null_ _null_ macaddr_and _null_ _null_ _null_ )); DATA(insert OID = 3146 ( macaddr_or PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 829 "829 829" _null_ _null_ _null_ _null_ macaddr_or _null_ _null_ _null_ )); /* for inet type support */ DATA(insert OID = 910 ( inet_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 869 "2275" _null_ _null_ _null_ _null_ inet_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 911 ( inet_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "869" _null_ _null_ _null_ _null_ inet_out _null_ _null_ _null_ )); DESCR("I/O"); /* for cidr type support */ DATA(insert OID = 1267 ( cidr_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 650 "2275" _null_ _null_ _null_ _null_ cidr_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1427 ( cidr_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "650" _null_ _null_ _null_ _null_ cidr_out _null_ _null_ _null_ )); DESCR("I/O"); /* these are used for both inet and cidr */ DATA(insert OID = 920 ( network_eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ network_eq _null_ _null_ _null_ )); DATA(insert OID = 921 ( network_lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ network_lt _null_ _null_ _null_ )); DATA(insert OID = 922 ( network_le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ network_le _null_ _null_ _null_ )); DATA(insert OID = 923 ( network_gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ network_gt _null_ _null_ _null_ )); DATA(insert OID = 924 ( network_ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ network_ge _null_ _null_ _null_ )); DATA(insert OID = 925 ( network_ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ network_ne _null_ _null_ _null_ )); DATA(insert OID = 926 ( network_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "869 869" _null_ _null_ _null_ _null_ network_cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 927 ( network_sub PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ network_sub _null_ _null_ _null_ )); DATA(insert OID = 928 ( network_subeq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ network_subeq _null_ _null_ _null_ )); DATA(insert OID = 929 ( network_sup PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ network_sup _null_ _null_ _null_ )); DATA(insert OID = 930 ( network_supeq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ network_supeq _null_ _null_ _null_ )); /* inet/cidr functions */ DATA(insert OID = 598 ( abbrev PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "869" _null_ _null_ _null_ _null_ inet_abbrev _null_ _null_ _null_ )); DESCR("abbreviated display of inet value"); DATA(insert OID = 599 ( abbrev PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "650" _null_ _null_ _null_ _null_ cidr_abbrev _null_ _null_ _null_ )); DESCR("abbreviated display of cidr value"); DATA(insert OID = 605 ( set_masklen PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 869 "869 23" _null_ _null_ _null_ _null_ inet_set_masklen _null_ _null_ _null_ )); DESCR("change netmask of inet"); DATA(insert OID = 635 ( set_masklen PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 650 "650 23" _null_ _null_ _null_ _null_ cidr_set_masklen _null_ _null_ _null_ )); DESCR("change netmask of cidr"); DATA(insert OID = 711 ( family PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "869" _null_ _null_ _null_ _null_ network_family _null_ _null_ _null_ )); DESCR("address family (4 for IPv4, 6 for IPv6)"); DATA(insert OID = 683 ( network PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 650 "869" _null_ _null_ _null_ _null_ network_network _null_ _null_ _null_ )); DESCR("network part of address"); DATA(insert OID = 696 ( netmask PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 869 "869" _null_ _null_ _null_ _null_ network_netmask _null_ _null_ _null_ )); DESCR("netmask of address"); DATA(insert OID = 697 ( masklen PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "869" _null_ _null_ _null_ _null_ network_masklen _null_ _null_ _null_ )); DESCR("netmask length"); DATA(insert OID = 698 ( broadcast PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 869 "869" _null_ _null_ _null_ _null_ network_broadcast _null_ _null_ _null_ )); DESCR("broadcast address of network"); DATA(insert OID = 699 ( host PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "869" _null_ _null_ _null_ _null_ network_host _null_ _null_ _null_ )); DESCR("show address octets only"); DATA(insert OID = 730 ( text PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "869" _null_ _null_ _null_ _null_ network_show _null_ _null_ _null_ )); DESCR("show all parts of inet/cidr value"); DATA(insert OID = 1362 ( hostmask PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 869 "869" _null_ _null_ _null_ _null_ network_hostmask _null_ _null_ _null_ )); DESCR("hostmask of address"); DATA(insert OID = 1715 ( cidr PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 650 "869" _null_ _null_ _null_ _null_ inet_to_cidr _null_ _null_ _null_ )); DESCR("convert inet to cidr"); DATA(insert OID = 2196 ( inet_client_addr PGNSP PGUID 12 1 0 0 0 f f f f f f s 0 0 869 "" _null_ _null_ _null_ _null_ inet_client_addr _null_ _null_ _null_ )); DESCR("inet address of the client"); DATA(insert OID = 2197 ( inet_client_port PGNSP PGUID 12 1 0 0 0 f f f f f f s 0 0 23 "" _null_ _null_ _null_ _null_ inet_client_port _null_ _null_ _null_ )); DESCR("client's port number for this connection"); DATA(insert OID = 2198 ( inet_server_addr PGNSP PGUID 12 1 0 0 0 f f f f f f s 0 0 869 "" _null_ _null_ _null_ _null_ inet_server_addr _null_ _null_ _null_ )); DESCR("inet address of the server"); DATA(insert OID = 2199 ( inet_server_port PGNSP PGUID 12 1 0 0 0 f f f f f f s 0 0 23 "" _null_ _null_ _null_ _null_ inet_server_port _null_ _null_ _null_ )); DESCR("server's port number for this connection"); DATA(insert OID = 2627 ( inetnot PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 869 "869" _null_ _null_ _null_ _null_ inetnot _null_ _null_ _null_ )); DATA(insert OID = 2628 ( inetand PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 869 "869 869" _null_ _null_ _null_ _null_ inetand _null_ _null_ _null_ )); DATA(insert OID = 2629 ( inetor PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 869 "869 869" _null_ _null_ _null_ _null_ inetor _null_ _null_ _null_ )); DATA(insert OID = 2630 ( inetpl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 869 "869 20" _null_ _null_ _null_ _null_ inetpl _null_ _null_ _null_ )); DATA(insert OID = 2631 ( int8pl_inet PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 869 "20 869" _null_ _null_ _null_ _null_ "select $2 + $1" _null_ _null_ _null_ )); DATA(insert OID = 2632 ( inetmi_int8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 869 "869 20" _null_ _null_ _null_ _null_ inetmi_int8 _null_ _null_ _null_ )); DATA(insert OID = 2633 ( inetmi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "869 869" _null_ _null_ _null_ _null_ inetmi _null_ _null_ _null_ )); DATA(insert OID = 1690 ( time_mi_time PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1083 1083" _null_ _null_ _null_ _null_ time_mi_time _null_ _null_ _null_ )); DATA(insert OID = 1691 ( boolle PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ boolle _null_ _null_ _null_ )); DATA(insert OID = 1692 ( boolge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ boolge _null_ _null_ _null_ )); DATA(insert OID = 1693 ( btboolcmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "16 16" _null_ _null_ _null_ _null_ btboolcmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 1688 ( time_hash PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1083" _null_ _null_ _null_ _null_ time_hash _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 1696 ( timetz_hash PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1266" _null_ _null_ _null_ _null_ timetz_hash _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 1697 ( interval_hash PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1186" _null_ _null_ _null_ _null_ interval_hash _null_ _null_ _null_ )); DESCR("hash"); /* OID's 1700 - 1799 NUMERIC data type */ DATA(insert OID = 1701 ( numeric_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1700 "2275 26 23" _null_ _null_ _null_ _null_ numeric_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1702 ( numeric_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "1700" _null_ _null_ _null_ _null_ numeric_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2917 ( numerictypmodin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ numerictypmodin _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 2918 ( numerictypmodout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ numerictypmodout _null_ _null_ _null_ )); DESCR("I/O typmod"); DATA(insert OID = 3157 ( numeric_transform PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ numeric_transform _null_ _null_ _null_ )); DESCR("transform a numeric length coercion"); DATA(insert OID = 1703 ( numeric PGNSP PGUID 12 1 0 0 numeric_transform f f f f t f i 2 0 1700 "1700 23" _null_ _null_ _null_ _null_ numeric _null_ _null_ _null_ )); DESCR("adjust numeric to typmod precision/scale"); DATA(insert OID = 1704 ( numeric_abs PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ numeric_abs _null_ _null_ _null_ )); DATA(insert OID = 1705 ( abs PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ numeric_abs _null_ _null_ _null_ )); DESCR("absolute value"); DATA(insert OID = 1706 ( sign PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ numeric_sign _null_ _null_ _null_ )); DESCR("sign of value"); DATA(insert OID = 1707 ( round PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 23" _null_ _null_ _null_ _null_ numeric_round _null_ _null_ _null_ )); DESCR("value rounded to 'scale'"); DATA(insert OID = 1708 ( round PGNSP PGUID 14 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ "select pg_catalog.round($1,0)" _null_ _null_ _null_ )); DESCR("value rounded to 'scale' of zero"); DATA(insert OID = 1709 ( trunc PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 23" _null_ _null_ _null_ _null_ numeric_trunc _null_ _null_ _null_ )); DESCR("value truncated to 'scale'"); DATA(insert OID = 1710 ( trunc PGNSP PGUID 14 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ "select pg_catalog.trunc($1,0)" _null_ _null_ _null_ )); DESCR("value truncated to 'scale' of zero"); DATA(insert OID = 1711 ( ceil PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ numeric_ceil _null_ _null_ _null_ )); DESCR("nearest integer >= value"); DATA(insert OID = 2167 ( ceiling PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ numeric_ceil _null_ _null_ _null_ )); DESCR("nearest integer >= value"); DATA(insert OID = 1712 ( floor PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ numeric_floor _null_ _null_ _null_ )); DESCR("nearest integer <= value"); DATA(insert OID = 1718 ( numeric_eq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ numeric_eq _null_ _null_ _null_ )); DATA(insert OID = 1719 ( numeric_ne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ numeric_ne _null_ _null_ _null_ )); DATA(insert OID = 1720 ( numeric_gt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ numeric_gt _null_ _null_ _null_ )); DATA(insert OID = 1721 ( numeric_ge PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ numeric_ge _null_ _null_ _null_ )); DATA(insert OID = 1722 ( numeric_lt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ numeric_lt _null_ _null_ _null_ )); DATA(insert OID = 1723 ( numeric_le PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ numeric_le _null_ _null_ _null_ )); DATA(insert OID = 1724 ( numeric_add PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ numeric_add _null_ _null_ _null_ )); DATA(insert OID = 1725 ( numeric_sub PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ numeric_sub _null_ _null_ _null_ )); DATA(insert OID = 1726 ( numeric_mul PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ numeric_mul _null_ _null_ _null_ )); DATA(insert OID = 1727 ( numeric_div PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ numeric_div _null_ _null_ _null_ )); DATA(insert OID = 1728 ( mod PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ numeric_mod _null_ _null_ _null_ )); DESCR("modulus"); DATA(insert OID = 1729 ( numeric_mod PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ numeric_mod _null_ _null_ _null_ )); DATA(insert OID = 1730 ( sqrt PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ numeric_sqrt _null_ _null_ _null_ )); DESCR("square root"); DATA(insert OID = 1731 ( numeric_sqrt PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ numeric_sqrt _null_ _null_ _null_ )); DESCR("square root"); DATA(insert OID = 1732 ( exp PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ numeric_exp _null_ _null_ _null_ )); DESCR("natural exponential (e^x)"); DATA(insert OID = 1733 ( numeric_exp PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ numeric_exp _null_ _null_ _null_ )); DESCR("natural exponential (e^x)"); DATA(insert OID = 1734 ( ln PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ numeric_ln _null_ _null_ _null_ )); DESCR("natural logarithm"); DATA(insert OID = 1735 ( numeric_ln PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ numeric_ln _null_ _null_ _null_ )); DESCR("natural logarithm"); DATA(insert OID = 1736 ( log PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ numeric_log _null_ _null_ _null_ )); DESCR("logarithm base m of n"); DATA(insert OID = 1737 ( numeric_log PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ numeric_log _null_ _null_ _null_ )); DESCR("logarithm base m of n"); DATA(insert OID = 1738 ( pow PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ numeric_power _null_ _null_ _null_ )); DESCR("exponentiation"); DATA(insert OID = 2169 ( power PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ numeric_power _null_ _null_ _null_ )); DESCR("exponentiation"); DATA(insert OID = 1739 ( numeric_power PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ numeric_power _null_ _null_ _null_ )); DATA(insert OID = 1740 ( numeric PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "23" _null_ _null_ _null_ _null_ int4_numeric _null_ _null_ _null_ )); DESCR("convert int4 to numeric"); DATA(insert OID = 1741 ( log PGNSP PGUID 14 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ "select pg_catalog.log(10, $1)" _null_ _null_ _null_ )); DESCR("base 10 logarithm"); DATA(insert OID = 1742 ( numeric PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "700" _null_ _null_ _null_ _null_ float4_numeric _null_ _null_ _null_ )); DESCR("convert float4 to numeric"); DATA(insert OID = 1743 ( numeric PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "701" _null_ _null_ _null_ _null_ float8_numeric _null_ _null_ _null_ )); DESCR("convert float8 to numeric"); DATA(insert OID = 1744 ( int4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1700" _null_ _null_ _null_ _null_ numeric_int4 _null_ _null_ _null_ )); DESCR("convert numeric to int4"); DATA(insert OID = 1745 ( float4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "1700" _null_ _null_ _null_ _null_ numeric_float4 _null_ _null_ _null_ )); DESCR("convert numeric to float4"); DATA(insert OID = 1746 ( float8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1700" _null_ _null_ _null_ _null_ numeric_float8 _null_ _null_ _null_ )); DESCR("convert numeric to float8"); DATA(insert OID = 1973 ( div PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ numeric_div_trunc _null_ _null_ _null_ )); DESCR("trunc(x/y)"); DATA(insert OID = 1980 ( numeric_div_trunc PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ numeric_div_trunc _null_ _null_ _null_ )); DESCR("trunc(x/y)"); DATA(insert OID = 2170 ( width_bucket PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 23 "1700 1700 1700 23" _null_ _null_ _null_ _null_ width_bucket_numeric _null_ _null_ _null_ )); DESCR("bucket number of operand in equidepth histogram"); DATA(insert OID = 1747 ( time_pl_interval PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1083 "1083 1186" _null_ _null_ _null_ _null_ time_pl_interval _null_ _null_ _null_ )); DATA(insert OID = 1748 ( time_mi_interval PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1083 "1083 1186" _null_ _null_ _null_ _null_ time_mi_interval _null_ _null_ _null_ )); DATA(insert OID = 1749 ( timetz_pl_interval PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1266 "1266 1186" _null_ _null_ _null_ _null_ timetz_pl_interval _null_ _null_ _null_ )); DATA(insert OID = 1750 ( timetz_mi_interval PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1266 "1266 1186" _null_ _null_ _null_ _null_ timetz_mi_interval _null_ _null_ _null_ )); DATA(insert OID = 1764 ( numeric_inc PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ numeric_inc _null_ _null_ _null_ )); DESCR("increment by one"); DATA(insert OID = 1766 ( numeric_smaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ numeric_smaller _null_ _null_ _null_ )); DESCR("smaller of two"); DATA(insert OID = 1767 ( numeric_larger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ numeric_larger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 1769 ( numeric_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1700 1700" _null_ _null_ _null_ _null_ numeric_cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 1771 ( numeric_uminus PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ numeric_uminus _null_ _null_ _null_ )); DATA(insert OID = 1779 ( int8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "1700" _null_ _null_ _null_ _null_ numeric_int8 _null_ _null_ _null_ )); DESCR("convert numeric to int8"); DATA(insert OID = 1781 ( numeric PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "20" _null_ _null_ _null_ _null_ int8_numeric _null_ _null_ _null_ )); DESCR("convert int8 to numeric"); DATA(insert OID = 1782 ( numeric PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "21" _null_ _null_ _null_ _null_ int2_numeric _null_ _null_ _null_ )); DESCR("convert int2 to numeric"); DATA(insert OID = 1783 ( int2 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "1700" _null_ _null_ _null_ _null_ numeric_int2 _null_ _null_ _null_ )); DESCR("convert numeric to int2"); /* formatting */ DATA(insert OID = 1770 ( to_char PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "1184 25" _null_ _null_ _null_ _null_ timestamptz_to_char _null_ _null_ _null_ )); DESCR("format timestamp with time zone to text"); DATA(insert OID = 1772 ( to_char PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "1700 25" _null_ _null_ _null_ _null_ numeric_to_char _null_ _null_ _null_ )); DESCR("format numeric to text"); DATA(insert OID = 1773 ( to_char PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "23 25" _null_ _null_ _null_ _null_ int4_to_char _null_ _null_ _null_ )); DESCR("format int4 to text"); DATA(insert OID = 1774 ( to_char PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "20 25" _null_ _null_ _null_ _null_ int8_to_char _null_ _null_ _null_ )); DESCR("format int8 to text"); DATA(insert OID = 1775 ( to_char PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "700 25" _null_ _null_ _null_ _null_ float4_to_char _null_ _null_ _null_ )); DESCR("format float4 to text"); DATA(insert OID = 1776 ( to_char PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "701 25" _null_ _null_ _null_ _null_ float8_to_char _null_ _null_ _null_ )); DESCR("format float8 to text"); DATA(insert OID = 1777 ( to_number PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 1700 "25 25" _null_ _null_ _null_ _null_ numeric_to_number _null_ _null_ _null_ )); DESCR("convert text to numeric"); DATA(insert OID = 1778 ( to_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 1184 "25 25" _null_ _null_ _null_ _null_ to_timestamp _null_ _null_ _null_ )); DESCR("convert text to timestamp with time zone"); DATA(insert OID = 1780 ( to_date PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 1082 "25 25" _null_ _null_ _null_ _null_ to_date _null_ _null_ _null_ )); DESCR("convert text to date"); DATA(insert OID = 1768 ( to_char PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "1186 25" _null_ _null_ _null_ _null_ interval_to_char _null_ _null_ _null_ )); DESCR("format interval to text"); DATA(insert OID = 1282 ( quote_ident PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ quote_ident _null_ _null_ _null_ )); DESCR("quote an identifier for usage in a querystring"); DATA(insert OID = 1283 ( quote_literal PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ quote_literal _null_ _null_ _null_ )); DESCR("quote a literal for usage in a querystring"); DATA(insert OID = 1285 ( quote_literal PGNSP PGUID 14 1 0 0 0 f f f f t f s 1 0 25 "2283" _null_ _null_ _null_ _null_ "select pg_catalog.quote_literal($1::pg_catalog.text)" _null_ _null_ _null_ )); DESCR("quote a data value for usage in a querystring"); DATA(insert OID = 1289 ( quote_nullable PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 25 "25" _null_ _null_ _null_ _null_ quote_nullable _null_ _null_ _null_ )); DESCR("quote a possibly-null literal for usage in a querystring"); DATA(insert OID = 1290 ( quote_nullable PGNSP PGUID 14 1 0 0 0 f f f f f f s 1 0 25 "2283" _null_ _null_ _null_ _null_ "select pg_catalog.quote_nullable($1::pg_catalog.text)" _null_ _null_ _null_ )); DESCR("quote a possibly-null data value for usage in a querystring"); DATA(insert OID = 1798 ( oidin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 26 "2275" _null_ _null_ _null_ _null_ oidin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1799 ( oidout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "26" _null_ _null_ _null_ _null_ oidout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3058 ( concat PGNSP PGUID 12 1 0 2276 0 f f f f f f s 1 0 25 "2276" "{2276}" "{v}" _null_ _null_ text_concat _null_ _null_ _null_ )); DESCR("concatenate values"); DATA(insert OID = 3059 ( concat_ws PGNSP PGUID 12 1 0 2276 0 f f f f f f s 2 0 25 "25 2276" "{25,2276}" "{i,v}" _null_ _null_ text_concat_ws _null_ _null_ _null_ )); DESCR("concatenate values with separators"); DATA(insert OID = 3060 ( left PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_ text_left _null_ _null_ _null_ )); DESCR("extract the first n characters"); DATA(insert OID = 3061 ( right PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_ text_right _null_ _null_ _null_ )); DESCR("extract the last n characters"); DATA(insert OID = 3062 ( reverse PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ text_reverse _null_ _null_ _null_ )); DESCR("reverse text"); DATA(insert OID = 3539 ( format PGNSP PGUID 12 1 0 2276 0 f f f f f f s 2 0 25 "25 2276" "{25,2276}" "{i,v}" _null_ _null_ text_format _null_ _null_ _null_ )); DESCR("format text message"); DATA(insert OID = 3540 ( format PGNSP PGUID 12 1 0 0 0 f f f f f f s 1 0 25 "25" _null_ _null_ _null_ _null_ text_format_nv _null_ _null_ _null_ )); DESCR("format text message"); DATA(insert OID = 1810 ( bit_length PGNSP PGUID 14 1 0 0 0 f f f f t f i 1 0 23 "17" _null_ _null_ _null_ _null_ "select pg_catalog.octet_length($1) * 8" _null_ _null_ _null_ )); DESCR("length in bits"); DATA(insert OID = 1811 ( bit_length PGNSP PGUID 14 1 0 0 0 f f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ "select pg_catalog.octet_length($1) * 8" _null_ _null_ _null_ )); DESCR("length in bits"); DATA(insert OID = 1812 ( bit_length PGNSP PGUID 14 1 0 0 0 f f f f t f i 1 0 23 "1560" _null_ _null_ _null_ _null_ "select pg_catalog.length($1)" _null_ _null_ _null_ )); DESCR("length in bits"); /* Selectivity estimators for LIKE and related operators */ DATA(insert OID = 1814 ( iclikesel PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ iclikesel _null_ _null_ _null_ )); DESCR("restriction selectivity of ILIKE"); DATA(insert OID = 1815 ( icnlikesel PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ icnlikesel _null_ _null_ _null_ )); DESCR("restriction selectivity of NOT ILIKE"); DATA(insert OID = 1816 ( iclikejoinsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ iclikejoinsel _null_ _null_ _null_ )); DESCR("join selectivity of ILIKE"); DATA(insert OID = 1817 ( icnlikejoinsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ icnlikejoinsel _null_ _null_ _null_ )); DESCR("join selectivity of NOT ILIKE"); DATA(insert OID = 1818 ( regexeqsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ regexeqsel _null_ _null_ _null_ )); DESCR("restriction selectivity of regex match"); DATA(insert OID = 1819 ( likesel PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ likesel _null_ _null_ _null_ )); DESCR("restriction selectivity of LIKE"); DATA(insert OID = 1820 ( icregexeqsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ icregexeqsel _null_ _null_ _null_ )); DESCR("restriction selectivity of case-insensitive regex match"); DATA(insert OID = 1821 ( regexnesel PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ regexnesel _null_ _null_ _null_ )); DESCR("restriction selectivity of regex non-match"); DATA(insert OID = 1822 ( nlikesel PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ nlikesel _null_ _null_ _null_ )); DESCR("restriction selectivity of NOT LIKE"); DATA(insert OID = 1823 ( icregexnesel PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ icregexnesel _null_ _null_ _null_ )); DESCR("restriction selectivity of case-insensitive regex non-match"); DATA(insert OID = 1824 ( regexeqjoinsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ regexeqjoinsel _null_ _null_ _null_ )); DESCR("join selectivity of regex match"); DATA(insert OID = 1825 ( likejoinsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ likejoinsel _null_ _null_ _null_ )); DESCR("join selectivity of LIKE"); DATA(insert OID = 1826 ( icregexeqjoinsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ icregexeqjoinsel _null_ _null_ _null_ )); DESCR("join selectivity of case-insensitive regex match"); DATA(insert OID = 1827 ( regexnejoinsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ regexnejoinsel _null_ _null_ _null_ )); DESCR("join selectivity of regex non-match"); DATA(insert OID = 1828 ( nlikejoinsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ nlikejoinsel _null_ _null_ _null_ )); DESCR("join selectivity of NOT LIKE"); DATA(insert OID = 1829 ( icregexnejoinsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ icregexnejoinsel _null_ _null_ _null_ )); DESCR("join selectivity of case-insensitive regex non-match"); /* Aggregate-related functions */ DATA(insert OID = 1830 ( float8_avg PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ float8_avg _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 2512 ( float8_var_pop PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ float8_var_pop _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 1831 ( float8_var_samp PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ float8_var_samp _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 2513 ( float8_stddev_pop PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ float8_stddev_pop _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 1832 ( float8_stddev_samp PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ float8_stddev_samp _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 1833 ( numeric_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1231 "1231 1700" _null_ _null_ _null_ _null_ numeric_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 2858 ( numeric_avg_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1231 "1231 1700" _null_ _null_ _null_ _null_ numeric_avg_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 1834 ( int2_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1231 "1231 21" _null_ _null_ _null_ _null_ int2_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 1835 ( int4_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1231 "1231 23" _null_ _null_ _null_ _null_ int4_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 1836 ( int8_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1231 "1231 20" _null_ _null_ _null_ _null_ int8_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 2746 ( int8_avg_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1231 "1231 20" _null_ _null_ _null_ _null_ int8_avg_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 1837 ( numeric_avg PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1231" _null_ _null_ _null_ _null_ numeric_avg _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 2514 ( numeric_var_pop PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1231" _null_ _null_ _null_ _null_ numeric_var_pop _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 1838 ( numeric_var_samp PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1231" _null_ _null_ _null_ _null_ numeric_var_samp _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 2596 ( numeric_stddev_pop PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1231" _null_ _null_ _null_ _null_ numeric_stddev_pop _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 1839 ( numeric_stddev_samp PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1231" _null_ _null_ _null_ _null_ numeric_stddev_samp _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 1840 ( int2_sum PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 20 "20 21" _null_ _null_ _null_ _null_ int2_sum _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 1841 ( int4_sum PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 20 "20 23" _null_ _null_ _null_ _null_ int4_sum _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 1842 ( int8_sum PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 1700 "1700 20" _null_ _null_ _null_ _null_ int8_sum _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 1843 ( interval_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1187 "1187 1186" _null_ _null_ _null_ _null_ interval_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 1844 ( interval_avg PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1186 "1187" _null_ _null_ _null_ _null_ interval_avg _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 1962 ( int2_avg_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1016 "1016 21" _null_ _null_ _null_ _null_ int2_avg_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 1963 ( int4_avg_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1016 "1016 23" _null_ _null_ _null_ _null_ int4_avg_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 1964 ( int8_avg PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1016" _null_ _null_ _null_ _null_ int8_avg _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 2805 ( int8inc_float8_float8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 20 "20 701 701" _null_ _null_ _null_ _null_ int8inc_float8_float8 _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 2806 ( float8_regr_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1022 "1022 701 701" _null_ _null_ _null_ _null_ float8_regr_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 2807 ( float8_regr_sxx PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ float8_regr_sxx _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 2808 ( float8_regr_syy PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ float8_regr_syy _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 2809 ( float8_regr_sxy PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ float8_regr_sxy _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 2810 ( float8_regr_avgx PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ float8_regr_avgx _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 2811 ( float8_regr_avgy PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ float8_regr_avgy _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 2812 ( float8_regr_r2 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ float8_regr_r2 _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 2813 ( float8_regr_slope PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ float8_regr_slope _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 2814 ( float8_regr_intercept PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ float8_regr_intercept _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 2815 ( float8_covar_pop PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ float8_covar_pop _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 2816 ( float8_covar_samp PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ float8_covar_samp _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 2817 ( float8_corr PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ float8_corr _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 3535 ( string_agg_transfn PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 2281 "2281 25 25" _null_ _null_ _null_ _null_ string_agg_transfn _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 3536 ( string_agg_finalfn PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 25 "2281" _null_ _null_ _null_ _null_ string_agg_finalfn _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 3538 ( string_agg PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("concatenate aggregate input into a string"); DATA(insert OID = 3543 ( bytea_string_agg_transfn PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 2281 "2281 17 17" _null_ _null_ _null_ _null_ bytea_string_agg_transfn _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 3544 ( bytea_string_agg_finalfn PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 17 "2281" _null_ _null_ _null_ _null_ bytea_string_agg_finalfn _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 3545 ( string_agg PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 17 "17 17" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("concatenate aggregate input into a bytea"); /* To ASCII conversion */ DATA(insert OID = 1845 ( to_ascii PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ to_ascii_default _null_ _null_ _null_ )); DESCR("encode text from DB encoding to ASCII text"); DATA(insert OID = 1846 ( to_ascii PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_ to_ascii_enc _null_ _null_ _null_ )); DESCR("encode text from encoding to ASCII text"); DATA(insert OID = 1847 ( to_ascii PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 19" _null_ _null_ _null_ _null_ to_ascii_encname _null_ _null_ _null_ )); DESCR("encode text from encoding to ASCII text"); DATA(insert OID = 1848 ( interval_pl_time PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 1083 "1186 1083" _null_ _null_ _null_ _null_ "select $2 + $1" _null_ _null_ _null_ )); DATA(insert OID = 1850 ( int28eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 20" _null_ _null_ _null_ _null_ int28eq _null_ _null_ _null_ )); DATA(insert OID = 1851 ( int28ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 20" _null_ _null_ _null_ _null_ int28ne _null_ _null_ _null_ )); DATA(insert OID = 1852 ( int28lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 20" _null_ _null_ _null_ _null_ int28lt _null_ _null_ _null_ )); DATA(insert OID = 1853 ( int28gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 20" _null_ _null_ _null_ _null_ int28gt _null_ _null_ _null_ )); DATA(insert OID = 1854 ( int28le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 20" _null_ _null_ _null_ _null_ int28le _null_ _null_ _null_ )); DATA(insert OID = 1855 ( int28ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "21 20" _null_ _null_ _null_ _null_ int28ge _null_ _null_ _null_ )); DATA(insert OID = 1856 ( int82eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 21" _null_ _null_ _null_ _null_ int82eq _null_ _null_ _null_ )); DATA(insert OID = 1857 ( int82ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 21" _null_ _null_ _null_ _null_ int82ne _null_ _null_ _null_ )); DATA(insert OID = 1858 ( int82lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 21" _null_ _null_ _null_ _null_ int82lt _null_ _null_ _null_ )); DATA(insert OID = 1859 ( int82gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 21" _null_ _null_ _null_ _null_ int82gt _null_ _null_ _null_ )); DATA(insert OID = 1860 ( int82le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 21" _null_ _null_ _null_ _null_ int82le _null_ _null_ _null_ )); DATA(insert OID = 1861 ( int82ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "20 21" _null_ _null_ _null_ _null_ int82ge _null_ _null_ _null_ )); DATA(insert OID = 1892 ( int2and PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ int2and _null_ _null_ _null_ )); DATA(insert OID = 1893 ( int2or PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ int2or _null_ _null_ _null_ )); DATA(insert OID = 1894 ( int2xor PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ int2xor _null_ _null_ _null_ )); DATA(insert OID = 1895 ( int2not PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "21" _null_ _null_ _null_ _null_ int2not _null_ _null_ _null_ )); DATA(insert OID = 1896 ( int2shl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 23" _null_ _null_ _null_ _null_ int2shl _null_ _null_ _null_ )); DATA(insert OID = 1897 ( int2shr PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 21 "21 23" _null_ _null_ _null_ _null_ int2shr _null_ _null_ _null_ )); DATA(insert OID = 1898 ( int4and PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ int4and _null_ _null_ _null_ )); DATA(insert OID = 1899 ( int4or PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ int4or _null_ _null_ _null_ )); DATA(insert OID = 1900 ( int4xor PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ int4xor _null_ _null_ _null_ )); DATA(insert OID = 1901 ( int4not PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ int4not _null_ _null_ _null_ )); DATA(insert OID = 1902 ( int4shl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ int4shl _null_ _null_ _null_ )); DATA(insert OID = 1903 ( int4shr PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ int4shr _null_ _null_ _null_ )); DATA(insert OID = 1904 ( int8and PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ int8and _null_ _null_ _null_ )); DATA(insert OID = 1905 ( int8or PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ int8or _null_ _null_ _null_ )); DATA(insert OID = 1906 ( int8xor PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ int8xor _null_ _null_ _null_ )); DATA(insert OID = 1907 ( int8not PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ int8not _null_ _null_ _null_ )); DATA(insert OID = 1908 ( int8shl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 23" _null_ _null_ _null_ _null_ int8shl _null_ _null_ _null_ )); DATA(insert OID = 1909 ( int8shr PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 23" _null_ _null_ _null_ _null_ int8shr _null_ _null_ _null_ )); DATA(insert OID = 1910 ( int8up PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ int8up _null_ _null_ _null_ )); DATA(insert OID = 1911 ( int2up PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "21" _null_ _null_ _null_ _null_ int2up _null_ _null_ _null_ )); DATA(insert OID = 1912 ( int4up PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ int4up _null_ _null_ _null_ )); DATA(insert OID = 1913 ( float4up PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "700" _null_ _null_ _null_ _null_ float4up _null_ _null_ _null_ )); DATA(insert OID = 1914 ( float8up PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ float8up _null_ _null_ _null_ )); DATA(insert OID = 1915 ( numeric_uplus PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ numeric_uplus _null_ _null_ _null_ )); DATA(insert OID = 1922 ( has_table_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ has_table_privilege_name_name _null_ _null_ _null_ )); DESCR("user privilege on relation by username, rel name"); DATA(insert OID = 1923 ( has_table_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ has_table_privilege_name_id _null_ _null_ _null_ )); DESCR("user privilege on relation by username, rel oid"); DATA(insert OID = 1924 ( has_table_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ has_table_privilege_id_name _null_ _null_ _null_ )); DESCR("user privilege on relation by user oid, rel name"); DATA(insert OID = 1925 ( has_table_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ has_table_privilege_id_id _null_ _null_ _null_ )); DESCR("user privilege on relation by user oid, rel oid"); DATA(insert OID = 1926 ( has_table_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ has_table_privilege_name _null_ _null_ _null_ )); DESCR("current user privilege on relation by rel name"); DATA(insert OID = 1927 ( has_table_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ has_table_privilege_id _null_ _null_ _null_ )); DESCR("current user privilege on relation by rel oid"); DATA(insert OID = 2181 ( has_sequence_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ has_sequence_privilege_name_name _null_ _null_ _null_ )); DESCR("user privilege on sequence by username, seq name"); DATA(insert OID = 2182 ( has_sequence_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ has_sequence_privilege_name_id _null_ _null_ _null_ )); DESCR("user privilege on sequence by username, seq oid"); DATA(insert OID = 2183 ( has_sequence_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ has_sequence_privilege_id_name _null_ _null_ _null_ )); DESCR("user privilege on sequence by user oid, seq name"); DATA(insert OID = 2184 ( has_sequence_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ has_sequence_privilege_id_id _null_ _null_ _null_ )); DESCR("user privilege on sequence by user oid, seq oid"); DATA(insert OID = 2185 ( has_sequence_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ has_sequence_privilege_name _null_ _null_ _null_ )); DESCR("current user privilege on sequence by seq name"); DATA(insert OID = 2186 ( has_sequence_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ has_sequence_privilege_id _null_ _null_ _null_ )); DESCR("current user privilege on sequence by seq oid"); DATA(insert OID = 3012 ( has_column_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 16 "19 25 25 25" _null_ _null_ _null_ _null_ has_column_privilege_name_name_name _null_ _null_ _null_ )); DESCR("user privilege on column by username, rel name, col name"); DATA(insert OID = 3013 ( has_column_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 16 "19 25 21 25" _null_ _null_ _null_ _null_ has_column_privilege_name_name_attnum _null_ _null_ _null_ )); DESCR("user privilege on column by username, rel name, col attnum"); DATA(insert OID = 3014 ( has_column_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 16 "19 26 25 25" _null_ _null_ _null_ _null_ has_column_privilege_name_id_name _null_ _null_ _null_ )); DESCR("user privilege on column by username, rel oid, col name"); DATA(insert OID = 3015 ( has_column_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 16 "19 26 21 25" _null_ _null_ _null_ _null_ has_column_privilege_name_id_attnum _null_ _null_ _null_ )); DESCR("user privilege on column by username, rel oid, col attnum"); DATA(insert OID = 3016 ( has_column_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 16 "26 25 25 25" _null_ _null_ _null_ _null_ has_column_privilege_id_name_name _null_ _null_ _null_ )); DESCR("user privilege on column by user oid, rel name, col name"); DATA(insert OID = 3017 ( has_column_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 16 "26 25 21 25" _null_ _null_ _null_ _null_ has_column_privilege_id_name_attnum _null_ _null_ _null_ )); DESCR("user privilege on column by user oid, rel name, col attnum"); DATA(insert OID = 3018 ( has_column_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 16 "26 26 25 25" _null_ _null_ _null_ _null_ has_column_privilege_id_id_name _null_ _null_ _null_ )); DESCR("user privilege on column by user oid, rel oid, col name"); DATA(insert OID = 3019 ( has_column_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 16 "26 26 21 25" _null_ _null_ _null_ _null_ has_column_privilege_id_id_attnum _null_ _null_ _null_ )); DESCR("user privilege on column by user oid, rel oid, col attnum"); DATA(insert OID = 3020 ( has_column_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "25 25 25" _null_ _null_ _null_ _null_ has_column_privilege_name_name _null_ _null_ _null_ )); DESCR("current user privilege on column by rel name, col name"); DATA(insert OID = 3021 ( has_column_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "25 21 25" _null_ _null_ _null_ _null_ has_column_privilege_name_attnum _null_ _null_ _null_ )); DESCR("current user privilege on column by rel name, col attnum"); DATA(insert OID = 3022 ( has_column_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ has_column_privilege_id_name _null_ _null_ _null_ )); DESCR("current user privilege on column by rel oid, col name"); DATA(insert OID = 3023 ( has_column_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 21 25" _null_ _null_ _null_ _null_ has_column_privilege_id_attnum _null_ _null_ _null_ )); DESCR("current user privilege on column by rel oid, col attnum"); DATA(insert OID = 3024 ( has_any_column_privilege PGNSP PGUID 12 10 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ has_any_column_privilege_name_name _null_ _null_ _null_ )); DESCR("user privilege on any column by username, rel name"); DATA(insert OID = 3025 ( has_any_column_privilege PGNSP PGUID 12 10 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ has_any_column_privilege_name_id _null_ _null_ _null_ )); DESCR("user privilege on any column by username, rel oid"); DATA(insert OID = 3026 ( has_any_column_privilege PGNSP PGUID 12 10 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ has_any_column_privilege_id_name _null_ _null_ _null_ )); DESCR("user privilege on any column by user oid, rel name"); DATA(insert OID = 3027 ( has_any_column_privilege PGNSP PGUID 12 10 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ has_any_column_privilege_id_id _null_ _null_ _null_ )); DESCR("user privilege on any column by user oid, rel oid"); DATA(insert OID = 3028 ( has_any_column_privilege PGNSP PGUID 12 10 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ has_any_column_privilege_name _null_ _null_ _null_ )); DESCR("current user privilege on any column by rel name"); DATA(insert OID = 3029 ( has_any_column_privilege PGNSP PGUID 12 10 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ has_any_column_privilege_id _null_ _null_ _null_ )); DESCR("current user privilege on any column by rel oid"); DATA(insert OID = 1928 ( pg_stat_get_numscans PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_numscans _null_ _null_ _null_ )); DESCR("statistics: number of scans done for table/index"); DATA(insert OID = 1929 ( pg_stat_get_tuples_returned PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_tuples_returned _null_ _null_ _null_ )); DESCR("statistics: number of tuples read by seqscan"); DATA(insert OID = 1930 ( pg_stat_get_tuples_fetched PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_tuples_fetched _null_ _null_ _null_ )); DESCR("statistics: number of tuples fetched by idxscan"); DATA(insert OID = 1931 ( pg_stat_get_tuples_inserted PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_tuples_inserted _null_ _null_ _null_ )); DESCR("statistics: number of tuples inserted"); DATA(insert OID = 1932 ( pg_stat_get_tuples_updated PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_tuples_updated _null_ _null_ _null_ )); DESCR("statistics: number of tuples updated"); DATA(insert OID = 1933 ( pg_stat_get_tuples_deleted PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_tuples_deleted _null_ _null_ _null_ )); DESCR("statistics: number of tuples deleted"); DATA(insert OID = 1972 ( pg_stat_get_tuples_hot_updated PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_tuples_hot_updated _null_ _null_ _null_ )); DESCR("statistics: number of tuples hot updated"); DATA(insert OID = 2878 ( pg_stat_get_live_tuples PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_live_tuples _null_ _null_ _null_ )); DESCR("statistics: number of live tuples"); DATA(insert OID = 2879 ( pg_stat_get_dead_tuples PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_dead_tuples _null_ _null_ _null_ )); DESCR("statistics: number of dead tuples"); DATA(insert OID = 1934 ( pg_stat_get_blocks_fetched PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_blocks_fetched _null_ _null_ _null_ )); DESCR("statistics: number of blocks fetched"); DATA(insert OID = 1935 ( pg_stat_get_blocks_hit PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_blocks_hit _null_ _null_ _null_ )); DESCR("statistics: number of blocks found in cache"); DATA(insert OID = 2781 ( pg_stat_get_last_vacuum_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "26" _null_ _null_ _null_ _null_ pg_stat_get_last_vacuum_time _null_ _null_ _null_ )); DESCR("statistics: last manual vacuum time for a table"); DATA(insert OID = 2782 ( pg_stat_get_last_autovacuum_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "26" _null_ _null_ _null_ _null_ pg_stat_get_last_autovacuum_time _null_ _null_ _null_ )); DESCR("statistics: last auto vacuum time for a table"); DATA(insert OID = 2783 ( pg_stat_get_last_analyze_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "26" _null_ _null_ _null_ _null_ pg_stat_get_last_analyze_time _null_ _null_ _null_ )); DESCR("statistics: last manual analyze time for a table"); DATA(insert OID = 2784 ( pg_stat_get_last_autoanalyze_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "26" _null_ _null_ _null_ _null_ pg_stat_get_last_autoanalyze_time _null_ _null_ _null_ )); DESCR("statistics: last auto analyze time for a table"); DATA(insert OID = 3054 ( pg_stat_get_vacuum_count PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_vacuum_count _null_ _null_ _null_ )); DESCR("statistics: number of manual vacuums for a table"); DATA(insert OID = 3055 ( pg_stat_get_autovacuum_count PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_autovacuum_count _null_ _null_ _null_ )); DESCR("statistics: number of auto vacuums for a table"); DATA(insert OID = 3056 ( pg_stat_get_analyze_count PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_analyze_count _null_ _null_ _null_ )); DESCR("statistics: number of manual analyzes for a table"); DATA(insert OID = 3057 ( pg_stat_get_autoanalyze_count PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_autoanalyze_count _null_ _null_ _null_ )); DESCR("statistics: number of auto analyzes for a table"); DATA(insert OID = 1936 ( pg_stat_get_backend_idset PGNSP PGUID 12 1 100 0 0 f f f f t t s 0 0 23 "" _null_ _null_ _null_ _null_ pg_stat_get_backend_idset _null_ _null_ _null_ )); DESCR("statistics: currently active backend IDs"); DATA(insert OID = 2022 ( pg_stat_get_activity PGNSP PGUID 12 1 100 0 0 f f f f f t s 1 0 2249 "23" "{23,26,23,26,25,25,25,16,1184,1184,1184,1184,869,25,23}" "{i,o,o,o,o,o,o,o,o,o,o,o,o,o,o}" "{pid,datid,pid,usesysid,application_name,state,query,waiting,xact_start,query_start,backend_start,state_change,client_addr,client_hostname,client_port}" _null_ pg_stat_get_activity _null_ _null_ _null_ )); DESCR("statistics: information about currently active backends"); DATA(insert OID = 3099 ( pg_stat_get_wal_senders PGNSP PGUID 12 1 10 0 0 f f f f f t s 0 0 2249 "" "{23,25,25,25,25,25,23,25}" "{o,o,o,o,o,o,o,o}" "{pid,state,sent_location,write_location,flush_location,replay_location,sync_priority,sync_state}" _null_ pg_stat_get_wal_senders _null_ _null_ _null_ )); DESCR("statistics: information about currently active replication"); DATA(insert OID = 2026 ( pg_backend_pid PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 23 "" _null_ _null_ _null_ _null_ pg_backend_pid _null_ _null_ _null_ )); DESCR("statistics: current backend PID"); DATA(insert OID = 1937 ( pg_stat_get_backend_pid PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 23 "23" _null_ _null_ _null_ _null_ pg_stat_get_backend_pid _null_ _null_ _null_ )); DESCR("statistics: PID of backend"); DATA(insert OID = 1938 ( pg_stat_get_backend_dbid PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 26 "23" _null_ _null_ _null_ _null_ pg_stat_get_backend_dbid _null_ _null_ _null_ )); DESCR("statistics: database ID of backend"); DATA(insert OID = 1939 ( pg_stat_get_backend_userid PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 26 "23" _null_ _null_ _null_ _null_ pg_stat_get_backend_userid _null_ _null_ _null_ )); DESCR("statistics: user ID of backend"); DATA(insert OID = 1940 ( pg_stat_get_backend_activity PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "23" _null_ _null_ _null_ _null_ pg_stat_get_backend_activity _null_ _null_ _null_ )); DESCR("statistics: current query of backend"); DATA(insert OID = 2853 ( pg_stat_get_backend_waiting PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "23" _null_ _null_ _null_ _null_ pg_stat_get_backend_waiting _null_ _null_ _null_ )); DESCR("statistics: is backend currently waiting for a lock"); DATA(insert OID = 2094 ( pg_stat_get_backend_activity_start PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "23" _null_ _null_ _null_ _null_ pg_stat_get_backend_activity_start _null_ _null_ _null_ )); DESCR("statistics: start time for current query of backend"); DATA(insert OID = 2857 ( pg_stat_get_backend_xact_start PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "23" _null_ _null_ _null_ _null_ pg_stat_get_backend_xact_start _null_ _null_ _null_ )); DESCR("statistics: start time for backend's current transaction"); DATA(insert OID = 1391 ( pg_stat_get_backend_start PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "23" _null_ _null_ _null_ _null_ pg_stat_get_backend_start _null_ _null_ _null_ )); DESCR("statistics: start time for current backend session"); DATA(insert OID = 1392 ( pg_stat_get_backend_client_addr PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 869 "23" _null_ _null_ _null_ _null_ pg_stat_get_backend_client_addr _null_ _null_ _null_ )); DESCR("statistics: address of client connected to backend"); DATA(insert OID = 1393 ( pg_stat_get_backend_client_port PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 23 "23" _null_ _null_ _null_ _null_ pg_stat_get_backend_client_port _null_ _null_ _null_ )); DESCR("statistics: port number of client connected to backend"); DATA(insert OID = 1941 ( pg_stat_get_db_numbackends PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 23 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_numbackends _null_ _null_ _null_ )); DESCR("statistics: number of backends in database"); DATA(insert OID = 1942 ( pg_stat_get_db_xact_commit PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_xact_commit _null_ _null_ _null_ )); DESCR("statistics: transactions committed"); DATA(insert OID = 1943 ( pg_stat_get_db_xact_rollback PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_xact_rollback _null_ _null_ _null_ )); DESCR("statistics: transactions rolled back"); DATA(insert OID = 1944 ( pg_stat_get_db_blocks_fetched PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_blocks_fetched _null_ _null_ _null_ )); DESCR("statistics: blocks fetched for database"); DATA(insert OID = 1945 ( pg_stat_get_db_blocks_hit PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_blocks_hit _null_ _null_ _null_ )); DESCR("statistics: blocks found in cache for database"); DATA(insert OID = 2758 ( pg_stat_get_db_tuples_returned PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_tuples_returned _null_ _null_ _null_ )); DESCR("statistics: tuples returned for database"); DATA(insert OID = 2759 ( pg_stat_get_db_tuples_fetched PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_tuples_fetched _null_ _null_ _null_ )); DESCR("statistics: tuples fetched for database"); DATA(insert OID = 2760 ( pg_stat_get_db_tuples_inserted PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_tuples_inserted _null_ _null_ _null_ )); DESCR("statistics: tuples inserted in database"); DATA(insert OID = 2761 ( pg_stat_get_db_tuples_updated PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_tuples_updated _null_ _null_ _null_ )); DESCR("statistics: tuples updated in database"); DATA(insert OID = 2762 ( pg_stat_get_db_tuples_deleted PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_tuples_deleted _null_ _null_ _null_ )); DESCR("statistics: tuples deleted in database"); DATA(insert OID = 3065 ( pg_stat_get_db_conflict_tablespace PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_conflict_tablespace _null_ _null_ _null_ )); DESCR("statistics: recovery conflicts in database caused by drop tablespace"); DATA(insert OID = 3066 ( pg_stat_get_db_conflict_lock PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_conflict_lock _null_ _null_ _null_ )); DESCR("statistics: recovery conflicts in database caused by relation lock"); DATA(insert OID = 3067 ( pg_stat_get_db_conflict_snapshot PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_conflict_snapshot _null_ _null_ _null_ )); DESCR("statistics: recovery conflicts in database caused by snapshot expiry"); DATA(insert OID = 3068 ( pg_stat_get_db_conflict_bufferpin PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_conflict_bufferpin _null_ _null_ _null_ )); DESCR("statistics: recovery conflicts in database caused by shared buffer pin"); DATA(insert OID = 3069 ( pg_stat_get_db_conflict_startup_deadlock PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_conflict_startup_deadlock _null_ _null_ _null_ )); DESCR("statistics: recovery conflicts in database caused by buffer deadlock"); DATA(insert OID = 3070 ( pg_stat_get_db_conflict_all PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_conflict_all _null_ _null_ _null_ )); DESCR("statistics: recovery conflicts in database"); DATA(insert OID = 3152 ( pg_stat_get_db_deadlocks PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_deadlocks _null_ _null_ _null_ )); DESCR("statistics: deadlocks detected in database"); DATA(insert OID = 3074 ( pg_stat_get_db_stat_reset_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_stat_reset_time _null_ _null_ _null_ )); DESCR("statistics: last reset for a database"); DATA(insert OID = 3150 ( pg_stat_get_db_temp_files PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_temp_files _null_ _null_ _null_ )); DESCR("statistics: number of temporary files written"); DATA(insert OID = 3151 ( pg_stat_get_db_temp_bytes PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_temp_bytes _null_ _null_ _null_ )); DESCR("statistics: number of bytes in temporary files written"); DATA(insert OID = 2844 ( pg_stat_get_db_blk_read_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 701 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_blk_read_time _null_ _null_ _null_ )); DESCR("statistics: block read time, in msec"); DATA(insert OID = 2845 ( pg_stat_get_db_blk_write_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 701 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_blk_write_time _null_ _null_ _null_ )); DESCR("statistics: block write time, in msec"); DATA(insert OID = 2769 ( pg_stat_get_bgwriter_timed_checkpoints PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ pg_stat_get_bgwriter_timed_checkpoints _null_ _null_ _null_ )); DESCR("statistics: number of timed checkpoints started by the bgwriter"); DATA(insert OID = 2770 ( pg_stat_get_bgwriter_requested_checkpoints PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ pg_stat_get_bgwriter_requested_checkpoints _null_ _null_ _null_ )); DESCR("statistics: number of backend requested checkpoints started by the bgwriter"); DATA(insert OID = 2771 ( pg_stat_get_bgwriter_buf_written_checkpoints PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ pg_stat_get_bgwriter_buf_written_checkpoints _null_ _null_ _null_ )); DESCR("statistics: number of buffers written by the bgwriter during checkpoints"); DATA(insert OID = 2772 ( pg_stat_get_bgwriter_buf_written_clean PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ pg_stat_get_bgwriter_buf_written_clean _null_ _null_ _null_ )); DESCR("statistics: number of buffers written by the bgwriter for cleaning dirty buffers"); DATA(insert OID = 2773 ( pg_stat_get_bgwriter_maxwritten_clean PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ pg_stat_get_bgwriter_maxwritten_clean _null_ _null_ _null_ )); DESCR("statistics: number of times the bgwriter stopped processing when it had written too many buffers while cleaning"); DATA(insert OID = 3075 ( pg_stat_get_bgwriter_stat_reset_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ pg_stat_get_bgwriter_stat_reset_time _null_ _null_ _null_ )); DESCR("statistics: last reset for the bgwriter"); DATA(insert OID = 3160 ( pg_stat_get_checkpoint_write_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 701 "" _null_ _null_ _null_ _null_ pg_stat_get_checkpoint_write_time _null_ _null_ _null_ )); DESCR("statistics: checkpoint time spent writing buffers to disk, in msec"); DATA(insert OID = 3161 ( pg_stat_get_checkpoint_sync_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 701 "" _null_ _null_ _null_ _null_ pg_stat_get_checkpoint_sync_time _null_ _null_ _null_ )); DESCR("statistics: checkpoint time spent synchronizing buffers to disk, in msec"); DATA(insert OID = 2775 ( pg_stat_get_buf_written_backend PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ pg_stat_get_buf_written_backend _null_ _null_ _null_ )); DESCR("statistics: number of buffers written by backends"); DATA(insert OID = 3063 ( pg_stat_get_buf_fsync_backend PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ pg_stat_get_buf_fsync_backend _null_ _null_ _null_ )); DESCR("statistics: number of backend buffer writes that did their own fsync"); DATA(insert OID = 2859 ( pg_stat_get_buf_alloc PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ pg_stat_get_buf_alloc _null_ _null_ _null_ )); DESCR("statistics: number of buffer allocations"); DATA(insert OID = 2978 ( pg_stat_get_function_calls PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_function_calls _null_ _null_ _null_ )); DESCR("statistics: number of function calls"); DATA(insert OID = 2979 ( pg_stat_get_function_total_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 701 "26" _null_ _null_ _null_ _null_ pg_stat_get_function_total_time _null_ _null_ _null_ )); DESCR("statistics: total execution time of function, in msec"); DATA(insert OID = 2980 ( pg_stat_get_function_self_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 701 "26" _null_ _null_ _null_ _null_ pg_stat_get_function_self_time _null_ _null_ _null_ )); DESCR("statistics: self execution time of function, in msec"); DATA(insert OID = 3037 ( pg_stat_get_xact_numscans PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_numscans _null_ _null_ _null_ )); DESCR("statistics: number of scans done for table/index in current transaction"); DATA(insert OID = 3038 ( pg_stat_get_xact_tuples_returned PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_tuples_returned _null_ _null_ _null_ )); DESCR("statistics: number of tuples read by seqscan in current transaction"); DATA(insert OID = 3039 ( pg_stat_get_xact_tuples_fetched PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_tuples_fetched _null_ _null_ _null_ )); DESCR("statistics: number of tuples fetched by idxscan in current transaction"); DATA(insert OID = 3040 ( pg_stat_get_xact_tuples_inserted PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_tuples_inserted _null_ _null_ _null_ )); DESCR("statistics: number of tuples inserted in current transaction"); DATA(insert OID = 3041 ( pg_stat_get_xact_tuples_updated PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_tuples_updated _null_ _null_ _null_ )); DESCR("statistics: number of tuples updated in current transaction"); DATA(insert OID = 3042 ( pg_stat_get_xact_tuples_deleted PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_tuples_deleted _null_ _null_ _null_ )); DESCR("statistics: number of tuples deleted in current transaction"); DATA(insert OID = 3043 ( pg_stat_get_xact_tuples_hot_updated PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_tuples_hot_updated _null_ _null_ _null_ )); DESCR("statistics: number of tuples hot updated in current transaction"); DATA(insert OID = 3044 ( pg_stat_get_xact_blocks_fetched PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_blocks_fetched _null_ _null_ _null_ )); DESCR("statistics: number of blocks fetched in current transaction"); DATA(insert OID = 3045 ( pg_stat_get_xact_blocks_hit PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_blocks_hit _null_ _null_ _null_ )); DESCR("statistics: number of blocks found in cache in current transaction"); DATA(insert OID = 3046 ( pg_stat_get_xact_function_calls PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_function_calls _null_ _null_ _null_ )); DESCR("statistics: number of function calls in current transaction"); DATA(insert OID = 3047 ( pg_stat_get_xact_function_total_time PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 701 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_function_total_time _null_ _null_ _null_ )); DESCR("statistics: total execution time of function in current transaction, in msec"); DATA(insert OID = 3048 ( pg_stat_get_xact_function_self_time PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 701 "26" _null_ _null_ _null_ _null_ pg_stat_get_xact_function_self_time _null_ _null_ _null_ )); DESCR("statistics: self execution time of function in current transaction, in msec"); DATA(insert OID = 2230 ( pg_stat_clear_snapshot PGNSP PGUID 12 1 0 0 0 f f f f f f v 0 0 2278 "" _null_ _null_ _null_ _null_ pg_stat_clear_snapshot _null_ _null_ _null_ )); DESCR("statistics: discard current transaction's statistics snapshot"); DATA(insert OID = 2274 ( pg_stat_reset PGNSP PGUID 12 1 0 0 0 f f f f f f v 0 0 2278 "" _null_ _null_ _null_ _null_ pg_stat_reset _null_ _null_ _null_ )); DESCR("statistics: reset collected statistics for current database"); DATA(insert OID = 3775 ( pg_stat_reset_shared PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "25" _null_ _null_ _null_ _null_ pg_stat_reset_shared _null_ _null_ _null_ )); DESCR("statistics: reset collected statistics shared across the cluster"); DATA(insert OID = 3776 ( pg_stat_reset_single_table_counters PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "26" _null_ _null_ _null_ _null_ pg_stat_reset_single_table_counters _null_ _null_ _null_ )); DESCR("statistics: reset collected statistics for a single table or index in the current database"); DATA(insert OID = 3777 ( pg_stat_reset_single_function_counters PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "26" _null_ _null_ _null_ _null_ pg_stat_reset_single_function_counters _null_ _null_ _null_ )); DESCR("statistics: reset collected statistics for a single function in the current database"); DATA(insert OID = 3163 ( pg_trigger_depth PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 23 "" _null_ _null_ _null_ _null_ pg_trigger_depth _null_ _null_ _null_ )); DESCR("current trigger depth"); DATA(insert OID = 3778 ( pg_tablespace_location PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_tablespace_location _null_ _null_ _null_ )); DESCR("tablespace location"); DATA(insert OID = 1946 ( encode PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "17 25" _null_ _null_ _null_ _null_ binary_encode _null_ _null_ _null_ )); DESCR("convert bytea value into some ascii-only text string"); DATA(insert OID = 1947 ( decode PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 17 "25 25" _null_ _null_ _null_ _null_ binary_decode _null_ _null_ _null_ )); DESCR("convert ascii-encoded text string into bytea value"); DATA(insert OID = 1948 ( byteaeq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ byteaeq _null_ _null_ _null_ )); DATA(insert OID = 1949 ( bytealt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ bytealt _null_ _null_ _null_ )); DATA(insert OID = 1950 ( byteale PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ byteale _null_ _null_ _null_ )); DATA(insert OID = 1951 ( byteagt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ byteagt _null_ _null_ _null_ )); DATA(insert OID = 1952 ( byteage PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ byteage _null_ _null_ _null_ )); DATA(insert OID = 1953 ( byteane PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ byteane _null_ _null_ _null_ )); DATA(insert OID = 1954 ( byteacmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "17 17" _null_ _null_ _null_ _null_ byteacmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 3917 ( timestamp_transform PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ timestamp_transform _null_ _null_ _null_ )); DESCR("transform a timestamp length coercion"); DATA(insert OID = 3944 ( time_transform PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ time_transform _null_ _null_ _null_ )); DESCR("transform a time length coercion"); DATA(insert OID = 1961 ( timestamp PGNSP PGUID 12 1 0 0 timestamp_transform f f f f t f i 2 0 1114 "1114 23" _null_ _null_ _null_ _null_ timestamp_scale _null_ _null_ _null_ )); DESCR("adjust timestamp precision"); DATA(insert OID = 1965 ( oidlarger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 26 "26 26" _null_ _null_ _null_ _null_ oidlarger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 1966 ( oidsmaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 26 "26 26" _null_ _null_ _null_ _null_ oidsmaller _null_ _null_ _null_ )); DESCR("smaller of two"); DATA(insert OID = 1967 ( timestamptz PGNSP PGUID 12 1 0 0 timestamp_transform f f f f t f i 2 0 1184 "1184 23" _null_ _null_ _null_ _null_ timestamptz_scale _null_ _null_ _null_ )); DESCR("adjust timestamptz precision"); DATA(insert OID = 1968 ( time PGNSP PGUID 12 1 0 0 time_transform f f f f t f i 2 0 1083 "1083 23" _null_ _null_ _null_ _null_ time_scale _null_ _null_ _null_ )); DESCR("adjust time precision"); DATA(insert OID = 1969 ( timetz PGNSP PGUID 12 1 0 0 time_transform f f f f t f i 2 0 1266 "1266 23" _null_ _null_ _null_ _null_ timetz_scale _null_ _null_ _null_ )); DESCR("adjust time with time zone precision"); DATA(insert OID = 2003 ( textanycat PGNSP PGUID 14 1 0 0 0 f f f f t f s 2 0 25 "25 2776" _null_ _null_ _null_ _null_ "select $1 || $2::pg_catalog.text" _null_ _null_ _null_ )); DATA(insert OID = 2004 ( anytextcat PGNSP PGUID 14 1 0 0 0 f f f f t f s 2 0 25 "2776 25" _null_ _null_ _null_ _null_ "select $1::pg_catalog.text || $2" _null_ _null_ _null_ )); DATA(insert OID = 2005 ( bytealike PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ bytealike _null_ _null_ _null_ )); DATA(insert OID = 2006 ( byteanlike PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ byteanlike _null_ _null_ _null_ )); DATA(insert OID = 2007 ( like PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ bytealike _null_ _null_ _null_ )); DESCR("matches LIKE expression"); DATA(insert OID = 2008 ( notlike PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ byteanlike _null_ _null_ _null_ )); DESCR("does not match LIKE expression"); DATA(insert OID = 2009 ( like_escape PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 17 "17 17" _null_ _null_ _null_ _null_ like_escape_bytea _null_ _null_ _null_ )); DESCR("convert LIKE pattern to use backslash escapes"); DATA(insert OID = 2010 ( length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "17" _null_ _null_ _null_ _null_ byteaoctetlen _null_ _null_ _null_ )); DESCR("octet length"); DATA(insert OID = 2011 ( byteacat PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 17 "17 17" _null_ _null_ _null_ _null_ byteacat _null_ _null_ _null_ )); DATA(insert OID = 2012 ( substring PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 17 "17 23 23" _null_ _null_ _null_ _null_ bytea_substr _null_ _null_ _null_ )); DESCR("extract portion of string"); DATA(insert OID = 2013 ( substring PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 17 "17 23" _null_ _null_ _null_ _null_ bytea_substr_no_len _null_ _null_ _null_ )); DESCR("extract portion of string"); DATA(insert OID = 2085 ( substr PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 17 "17 23 23" _null_ _null_ _null_ _null_ bytea_substr _null_ _null_ _null_ )); DESCR("extract portion of string"); DATA(insert OID = 2086 ( substr PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 17 "17 23" _null_ _null_ _null_ _null_ bytea_substr_no_len _null_ _null_ _null_ )); DESCR("extract portion of string"); DATA(insert OID = 2014 ( position PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "17 17" _null_ _null_ _null_ _null_ byteapos _null_ _null_ _null_ )); DESCR("position of substring"); DATA(insert OID = 2015 ( btrim PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 17 "17 17" _null_ _null_ _null_ _null_ byteatrim _null_ _null_ _null_ )); DESCR("trim both ends of string"); DATA(insert OID = 2019 ( time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1083 "1184" _null_ _null_ _null_ _null_ timestamptz_time _null_ _null_ _null_ )); DESCR("convert timestamp with time zone to time"); DATA(insert OID = 2020 ( date_trunc PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "25 1114" _null_ _null_ _null_ _null_ timestamp_trunc _null_ _null_ _null_ )); DESCR("truncate timestamp to specified units"); DATA(insert OID = 2021 ( date_part PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "25 1114" _null_ _null_ _null_ _null_ timestamp_part _null_ _null_ _null_ )); DESCR("extract field from timestamp"); DATA(insert OID = 2023 ( timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1114 "702" _null_ _null_ _null_ _null_ abstime_timestamp _null_ _null_ _null_ )); DESCR("convert abstime to timestamp"); DATA(insert OID = 2024 ( timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1114 "1082" _null_ _null_ _null_ _null_ date_timestamp _null_ _null_ _null_ )); DESCR("convert date to timestamp"); DATA(insert OID = 2025 ( timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "1082 1083" _null_ _null_ _null_ _null_ datetime_timestamp _null_ _null_ _null_ )); DESCR("convert date and time to timestamp"); DATA(insert OID = 2027 ( timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1114 "1184" _null_ _null_ _null_ _null_ timestamptz_timestamp _null_ _null_ _null_ )); DESCR("convert timestamp with time zone to timestamp"); DATA(insert OID = 2028 ( timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1184 "1114" _null_ _null_ _null_ _null_ timestamp_timestamptz _null_ _null_ _null_ )); DESCR("convert timestamp to timestamp with time zone"); DATA(insert OID = 2029 ( date PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1082 "1114" _null_ _null_ _null_ _null_ timestamp_date _null_ _null_ _null_ )); DESCR("convert timestamp to date"); DATA(insert OID = 2030 ( abstime PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 702 "1114" _null_ _null_ _null_ _null_ timestamp_abstime _null_ _null_ _null_ )); DESCR("convert timestamp to abstime"); DATA(insert OID = 2031 ( timestamp_mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1114 1114" _null_ _null_ _null_ _null_ timestamp_mi _null_ _null_ _null_ )); DATA(insert OID = 2032 ( timestamp_pl_interval PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "1114 1186" _null_ _null_ _null_ _null_ timestamp_pl_interval _null_ _null_ _null_ )); DATA(insert OID = 2033 ( timestamp_mi_interval PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "1114 1186" _null_ _null_ _null_ _null_ timestamp_mi_interval _null_ _null_ _null_ )); DATA(insert OID = 2035 ( timestamp_smaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "1114 1114" _null_ _null_ _null_ _null_ timestamp_smaller _null_ _null_ _null_ )); DESCR("smaller of two"); DATA(insert OID = 2036 ( timestamp_larger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "1114 1114" _null_ _null_ _null_ _null_ timestamp_larger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 2037 ( timezone PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 1266 "25 1266" _null_ _null_ _null_ _null_ timetz_zone _null_ _null_ _null_ )); DESCR("adjust time with time zone to new zone"); DATA(insert OID = 2038 ( timezone PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1266 "1186 1266" _null_ _null_ _null_ _null_ timetz_izone _null_ _null_ _null_ )); DESCR("adjust time with time zone to new zone"); DATA(insert OID = 2039 ( timestamp_hash PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "1114" _null_ _null_ _null_ _null_ timestamp_hash _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 2041 ( overlaps PGNSP PGUID 12 1 0 0 0 f f f f f f i 4 0 16 "1114 1114 1114 1114" _null_ _null_ _null_ _null_ overlaps_timestamp _null_ _null_ _null_ )); DESCR("intervals overlap?"); DATA(insert OID = 2042 ( overlaps PGNSP PGUID 14 1 0 0 0 f f f f f f i 4 0 16 "1114 1186 1114 1186" _null_ _null_ _null_ _null_ "select ($1, ($1 + $2)) overlaps ($3, ($3 + $4))" _null_ _null_ _null_ )); DESCR("intervals overlap?"); DATA(insert OID = 2043 ( overlaps PGNSP PGUID 14 1 0 0 0 f f f f f f i 4 0 16 "1114 1114 1114 1186" _null_ _null_ _null_ _null_ "select ($1, $2) overlaps ($3, ($3 + $4))" _null_ _null_ _null_ )); DESCR("intervals overlap?"); DATA(insert OID = 2044 ( overlaps PGNSP PGUID 14 1 0 0 0 f f f f f f i 4 0 16 "1114 1186 1114 1114" _null_ _null_ _null_ _null_ "select ($1, ($1 + $2)) overlaps ($3, $4)" _null_ _null_ _null_ )); DESCR("intervals overlap?"); DATA(insert OID = 2045 ( timestamp_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1114 1114" _null_ _null_ _null_ _null_ timestamp_cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 3137 ( timestamp_sortsupport PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ timestamp_sortsupport _null_ _null_ _null_ )); DESCR("sort support"); DATA(insert OID = 2046 ( time PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1083 "1266" _null_ _null_ _null_ _null_ timetz_time _null_ _null_ _null_ )); DESCR("convert time with time zone to time"); DATA(insert OID = 2047 ( timetz PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 1266 "1083" _null_ _null_ _null_ _null_ time_timetz _null_ _null_ _null_ )); DESCR("convert time to time with time zone"); DATA(insert OID = 2048 ( isfinite PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "1114" _null_ _null_ _null_ _null_ timestamp_finite _null_ _null_ _null_ )); DESCR("finite timestamp?"); DATA(insert OID = 2049 ( to_char PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "1114 25" _null_ _null_ _null_ _null_ timestamp_to_char _null_ _null_ _null_ )); DESCR("format timestamp to text"); DATA(insert OID = 2052 ( timestamp_eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ timestamp_eq _null_ _null_ _null_ )); DATA(insert OID = 2053 ( timestamp_ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ timestamp_ne _null_ _null_ _null_ )); DATA(insert OID = 2054 ( timestamp_lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ timestamp_lt _null_ _null_ _null_ )); DATA(insert OID = 2055 ( timestamp_le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ timestamp_le _null_ _null_ _null_ )); DATA(insert OID = 2056 ( timestamp_ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ timestamp_ge _null_ _null_ _null_ )); DATA(insert OID = 2057 ( timestamp_gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ timestamp_gt _null_ _null_ _null_ )); DATA(insert OID = 2058 ( age PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1114 1114" _null_ _null_ _null_ _null_ timestamp_age _null_ _null_ _null_ )); DESCR("date difference preserving months and years"); DATA(insert OID = 2059 ( age PGNSP PGUID 14 1 0 0 0 f f f f t f s 1 0 1186 "1114" _null_ _null_ _null_ _null_ "select pg_catalog.age(cast(current_date as timestamp without time zone), $1)" _null_ _null_ _null_ )); DESCR("date difference from today preserving months and years"); DATA(insert OID = 2069 ( timezone PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1184 "25 1114" _null_ _null_ _null_ _null_ timestamp_zone _null_ _null_ _null_ )); DESCR("adjust timestamp to new time zone"); DATA(insert OID = 2070 ( timezone PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1184 "1186 1114" _null_ _null_ _null_ _null_ timestamp_izone _null_ _null_ _null_ )); DESCR("adjust timestamp to new time zone"); DATA(insert OID = 2071 ( date_pl_interval PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "1082 1186" _null_ _null_ _null_ _null_ date_pl_interval _null_ _null_ _null_ )); DATA(insert OID = 2072 ( date_mi_interval PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1114 "1082 1186" _null_ _null_ _null_ _null_ date_mi_interval _null_ _null_ _null_ )); DATA(insert OID = 2073 ( substring PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ textregexsubstr _null_ _null_ _null_ )); DESCR("extract text matching regular expression"); DATA(insert OID = 2074 ( substring PGNSP PGUID 14 1 0 0 0 f f f f t f i 3 0 25 "25 25 25" _null_ _null_ _null_ _null_ "select pg_catalog.substring($1, pg_catalog.similar_escape($2, $3))" _null_ _null_ _null_ )); DESCR("extract text matching SQL99 regular expression"); DATA(insert OID = 2075 ( bit PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1560 "20 23" _null_ _null_ _null_ _null_ bitfromint8 _null_ _null_ _null_ )); DESCR("convert int8 to bitstring"); DATA(insert OID = 2076 ( int8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "1560" _null_ _null_ _null_ _null_ bittoint8 _null_ _null_ _null_ )); DESCR("convert bitstring to int8"); DATA(insert OID = 2077 ( current_setting PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "25" _null_ _null_ _null_ _null_ show_config_by_name _null_ _null_ _null_ )); DESCR("SHOW X as a function"); DATA(insert OID = 2078 ( set_config PGNSP PGUID 12 1 0 0 0 f f f f f f v 3 0 25 "25 25 16" _null_ _null_ _null_ _null_ set_config_by_name _null_ _null_ _null_ )); DESCR("SET X as a function"); DATA(insert OID = 2084 ( pg_show_all_settings PGNSP PGUID 12 1 1000 0 0 f f f f t t s 0 0 2249 "" "{25,25,25,25,25,25,25,25,25,25,25,1009,25,25,25,23}" "{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}" "{name,setting,unit,category,short_desc,extra_desc,context,vartype,source,min_val,max_val,enumvals,boot_val,reset_val,sourcefile,sourceline}" _null_ show_all_settings _null_ _null_ _null_ )); DESCR("SHOW ALL as a function"); DATA(insert OID = 1371 ( pg_lock_status PGNSP PGUID 12 1 1000 0 0 f f f f t t v 0 0 2249 "" "{25,26,26,23,21,25,28,26,26,21,25,23,25,16,16}" "{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}" "{locktype,database,relation,page,tuple,virtualxid,transactionid,classid,objid,objsubid,virtualtransaction,pid,mode,granted,fastpath}" _null_ pg_lock_status _null_ _null_ _null_ )); DESCR("view system lock information"); DATA(insert OID = 1065 ( pg_prepared_xact PGNSP PGUID 12 1 1000 0 0 f f f f t t v 0 0 2249 "" "{28,25,1184,26,26}" "{o,o,o,o,o}" "{transaction,gid,prepared,ownerid,dbid}" _null_ pg_prepared_xact _null_ _null_ _null_ )); DESCR("view two-phase transactions"); DATA(insert OID = 3537 ( pg_describe_object PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 25 "26 26 23" _null_ _null_ _null_ _null_ pg_describe_object _null_ _null_ _null_ )); DESCR("get identification of SQL object"); DATA(insert OID = 2079 ( pg_table_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_table_is_visible _null_ _null_ _null_ )); DESCR("is table visible in search path?"); DATA(insert OID = 2080 ( pg_type_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_type_is_visible _null_ _null_ _null_ )); DESCR("is type visible in search path?"); DATA(insert OID = 2081 ( pg_function_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_function_is_visible _null_ _null_ _null_ )); DESCR("is function visible in search path?"); DATA(insert OID = 2082 ( pg_operator_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_operator_is_visible _null_ _null_ _null_ )); DESCR("is operator visible in search path?"); DATA(insert OID = 2083 ( pg_opclass_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_opclass_is_visible _null_ _null_ _null_ )); DESCR("is opclass visible in search path?"); DATA(insert OID = 3829 ( pg_opfamily_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_opfamily_is_visible _null_ _null_ _null_ )); DESCR("is opfamily visible in search path?"); DATA(insert OID = 2093 ( pg_conversion_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_conversion_is_visible _null_ _null_ _null_ )); DESCR("is conversion visible in search path?"); DATA(insert OID = 3756 ( pg_ts_parser_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_ts_parser_is_visible _null_ _null_ _null_ )); DESCR("is text search parser visible in search path?"); DATA(insert OID = 3757 ( pg_ts_dict_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_ts_dict_is_visible _null_ _null_ _null_ )); DESCR("is text search dictionary visible in search path?"); DATA(insert OID = 3768 ( pg_ts_template_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_ts_template_is_visible _null_ _null_ _null_ )); DESCR("is text search template visible in search path?"); DATA(insert OID = 3758 ( pg_ts_config_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_ts_config_is_visible _null_ _null_ _null_ )); DESCR("is text search configuration visible in search path?"); DATA(insert OID = 3815 ( pg_collation_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_collation_is_visible _null_ _null_ _null_ )); DESCR("is collation visible in search path?"); DATA(insert OID = 2854 ( pg_my_temp_schema PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 26 "" _null_ _null_ _null_ _null_ pg_my_temp_schema _null_ _null_ _null_ )); DESCR("get OID of current session's temp schema, if any"); DATA(insert OID = 2855 ( pg_is_other_temp_schema PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_is_other_temp_schema _null_ _null_ _null_ )); DESCR("is schema another session's temp schema?"); DATA(insert OID = 2171 ( pg_cancel_backend PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 16 "23" _null_ _null_ _null_ _null_ pg_cancel_backend _null_ _null_ _null_ )); DESCR("cancel a server process' current query"); DATA(insert OID = 2096 ( pg_terminate_backend PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 16 "23" _null_ _null_ _null_ _null_ pg_terminate_backend _null_ _null_ _null_ )); DESCR("terminate a server process"); DATA(insert OID = 2172 ( pg_start_backup PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 25 "25 16" _null_ _null_ _null_ _null_ pg_start_backup _null_ _null_ _null_ )); DESCR("prepare for taking an online backup"); DATA(insert OID = 2173 ( pg_stop_backup PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_stop_backup _null_ _null_ _null_ )); DESCR("finish taking an online backup"); DATA(insert OID = 2848 ( pg_switch_xlog PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_switch_xlog _null_ _null_ _null_ )); DESCR("switch to new xlog file"); DATA(insert OID = 3098 ( pg_create_restore_point PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 25 "25" _null_ _null_ _null_ _null_ pg_create_restore_point _null_ _null_ _null_ )); DESCR("create a named restore point"); DATA(insert OID = 2849 ( pg_current_xlog_location PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_current_xlog_location _null_ _null_ _null_ )); DESCR("current xlog write location"); DATA(insert OID = 2852 ( pg_current_xlog_insert_location PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_current_xlog_insert_location _null_ _null_ _null_ )); DESCR("current xlog insert location"); DATA(insert OID = 2850 ( pg_xlogfile_name_offset PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2249 "25" "{25,25,23}" "{i,o,o}" "{wal_location,file_name,file_offset}" _null_ pg_xlogfile_name_offset _null_ _null_ _null_ )); DESCR("xlog filename and byte offset, given an xlog location"); DATA(insert OID = 2851 ( pg_xlogfile_name PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ pg_xlogfile_name _null_ _null_ _null_ )); DESCR("xlog filename, given an xlog location"); DATA(insert OID = 3165 ( pg_xlog_location_diff PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "25 25" _null_ _null_ _null_ _null_ pg_xlog_location_diff _null_ _null_ _null_ )); DESCR("difference in bytes, given two xlog locations"); DATA(insert OID = 3809 ( pg_export_snapshot PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_export_snapshot _null_ _null_ _null_ )); DESCR("export a snapshot"); DATA(insert OID = 3810 ( pg_is_in_recovery PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ pg_is_in_recovery _null_ _null_ _null_ )); DESCR("true if server is in recovery"); DATA(insert OID = 3820 ( pg_last_xlog_receive_location PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_last_xlog_receive_location _null_ _null_ _null_ )); DESCR("current xlog flush location"); DATA(insert OID = 3821 ( pg_last_xlog_replay_location PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_last_xlog_replay_location _null_ _null_ _null_ )); DESCR("last xlog replay location"); DATA(insert OID = 3830 ( pg_last_xact_replay_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 1184 "" _null_ _null_ _null_ _null_ pg_last_xact_replay_timestamp _null_ _null_ _null_ )); DESCR("timestamp of last replay xact"); DATA(insert OID = 3071 ( pg_xlog_replay_pause PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2278 "" _null_ _null_ _null_ _null_ pg_xlog_replay_pause _null_ _null_ _null_ )); DESCR("pause xlog replay"); DATA(insert OID = 3072 ( pg_xlog_replay_resume PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2278 "" _null_ _null_ _null_ _null_ pg_xlog_replay_resume _null_ _null_ _null_ )); DESCR("resume xlog replay, if it was paused"); DATA(insert OID = 3073 ( pg_is_xlog_replay_paused PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ pg_is_xlog_replay_paused _null_ _null_ _null_ )); DESCR("true if xlog replay is paused"); DATA(insert OID = 2621 ( pg_reload_conf PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ pg_reload_conf _null_ _null_ _null_ )); DESCR("reload configuration files"); DATA(insert OID = 2622 ( pg_rotate_logfile PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ pg_rotate_logfile _null_ _null_ _null_ )); DESCR("rotate log file"); DATA(insert OID = 2623 ( pg_stat_file PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2249 "25" "{25,20,1184,1184,1184,1184,16}" "{i,o,o,o,o,o,o}" "{filename,size,access,modification,change,creation,isdir}" _null_ pg_stat_file _null_ _null_ _null_ )); DESCR("get information about file"); DATA(insert OID = 2624 ( pg_read_file PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 25 "25 20 20" _null_ _null_ _null_ _null_ pg_read_file _null_ _null_ _null_ )); DESCR("read text from a file"); DATA(insert OID = 3826 ( pg_read_file PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 25 "25" _null_ _null_ _null_ _null_ pg_read_file_all _null_ _null_ _null_ )); DESCR("read text from a file"); DATA(insert OID = 3827 ( pg_read_binary_file PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 17 "25 20 20" _null_ _null_ _null_ _null_ pg_read_binary_file _null_ _null_ _null_ )); DESCR("read bytea from a file"); DATA(insert OID = 3828 ( pg_read_binary_file PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 17 "25" _null_ _null_ _null_ _null_ pg_read_binary_file_all _null_ _null_ _null_ )); DESCR("read bytea from a file"); DATA(insert OID = 2625 ( pg_ls_dir PGNSP PGUID 12 1 1000 0 0 f f f f t t v 1 0 25 "25" _null_ _null_ _null_ _null_ pg_ls_dir _null_ _null_ _null_ )); DESCR("list all files in a directory"); DATA(insert OID = 2626 ( pg_sleep PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "701" _null_ _null_ _null_ _null_ pg_sleep _null_ _null_ _null_ )); DESCR("sleep for the specified time in seconds"); DATA(insert OID = 2971 ( text PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "16" _null_ _null_ _null_ _null_ booltext _null_ _null_ _null_ )); DESCR("convert boolean to text"); /* Aggregates (moved here from pg_aggregate for 7.3) */ DATA(insert OID = 2100 ( avg PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("the average (arithmetic mean) as numeric of all bigint values"); DATA(insert OID = 2101 ( avg PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("the average (arithmetic mean) as numeric of all integer values"); DATA(insert OID = 2102 ( avg PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("the average (arithmetic mean) as numeric of all smallint values"); DATA(insert OID = 2103 ( avg PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("the average (arithmetic mean) as numeric of all numeric values"); DATA(insert OID = 2104 ( avg PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("the average (arithmetic mean) as float8 of all float4 values"); DATA(insert OID = 2105 ( avg PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("the average (arithmetic mean) as float8 of all float8 values"); DATA(insert OID = 2106 ( avg PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("the average (arithmetic mean) as interval of all interval values"); DATA(insert OID = 2107 ( sum PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum as numeric across all bigint input values"); DATA(insert OID = 2108 ( sum PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 20 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum as bigint across all integer input values"); DATA(insert OID = 2109 ( sum PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 20 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum as bigint across all smallint input values"); DATA(insert OID = 2110 ( sum PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 700 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum as float4 across all float4 input values"); DATA(insert OID = 2111 ( sum PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum as float8 across all float8 input values"); DATA(insert OID = 2112 ( sum PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 790 "790" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum as money across all money input values"); DATA(insert OID = 2113 ( sum PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum as interval across all interval input values"); DATA(insert OID = 2114 ( sum PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum as numeric across all numeric input values"); DATA(insert OID = 2115 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 20 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all bigint input values"); DATA(insert OID = 2116 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 23 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all integer input values"); DATA(insert OID = 2117 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 21 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all smallint input values"); DATA(insert OID = 2118 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 26 "26" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all oid input values"); DATA(insert OID = 2119 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 700 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all float4 input values"); DATA(insert OID = 2120 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all float8 input values"); DATA(insert OID = 2121 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 702 "702" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all abstime input values"); DATA(insert OID = 2122 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1082 "1082" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all date input values"); DATA(insert OID = 2123 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1083 "1083" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all time input values"); DATA(insert OID = 2124 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1266 "1266" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all time with time zone input values"); DATA(insert OID = 2125 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 790 "790" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all money input values"); DATA(insert OID = 2126 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1114 "1114" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all timestamp input values"); DATA(insert OID = 2127 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1184 "1184" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all timestamp with time zone input values"); DATA(insert OID = 2128 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all interval input values"); DATA(insert OID = 2129 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 25 "25" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all text input values"); DATA(insert OID = 2130 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all numeric input values"); DATA(insert OID = 2050 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 2277 "2277" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all anyarray input values"); DATA(insert OID = 2244 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1042 "1042" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all bpchar input values"); DATA(insert OID = 2797 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 27 "27" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all tid input values"); DATA(insert OID = 2131 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 20 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all bigint input values"); DATA(insert OID = 2132 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 23 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all integer input values"); DATA(insert OID = 2133 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 21 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all smallint input values"); DATA(insert OID = 2134 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 26 "26" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all oid input values"); DATA(insert OID = 2135 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 700 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all float4 input values"); DATA(insert OID = 2136 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all float8 input values"); DATA(insert OID = 2137 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 702 "702" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all abstime input values"); DATA(insert OID = 2138 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1082 "1082" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all date input values"); DATA(insert OID = 2139 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1083 "1083" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all time input values"); DATA(insert OID = 2140 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1266 "1266" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all time with time zone input values"); DATA(insert OID = 2141 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 790 "790" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all money input values"); DATA(insert OID = 2142 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1114 "1114" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all timestamp input values"); DATA(insert OID = 2143 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1184 "1184" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all timestamp with time zone input values"); DATA(insert OID = 2144 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all interval input values"); DATA(insert OID = 2145 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 25 "25" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all text values"); DATA(insert OID = 2146 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all numeric input values"); DATA(insert OID = 2051 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 2277 "2277" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all anyarray input values"); DATA(insert OID = 2245 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1042 "1042" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all bpchar input values"); DATA(insert OID = 2798 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 27 "27" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all tid input values"); /* count has two forms: count(any) and count(*) */ DATA(insert OID = 2147 ( count PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 20 "2276" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("number of input rows for which the input expression is not null"); DATA(insert OID = 2803 ( count PGNSP PGUID 12 1 0 0 0 t f f f f f i 0 0 20 "" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("number of input rows"); DATA(insert OID = 2718 ( var_pop PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population variance of bigint input values (square of the population standard deviation)"); DATA(insert OID = 2719 ( var_pop PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population variance of integer input values (square of the population standard deviation)"); DATA(insert OID = 2720 ( var_pop PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population variance of smallint input values (square of the population standard deviation)"); DATA(insert OID = 2721 ( var_pop PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population variance of float4 input values (square of the population standard deviation)"); DATA(insert OID = 2722 ( var_pop PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population variance of float8 input values (square of the population standard deviation)"); DATA(insert OID = 2723 ( var_pop PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population variance of numeric input values (square of the population standard deviation)"); DATA(insert OID = 2641 ( var_samp PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample variance of bigint input values (square of the sample standard deviation)"); DATA(insert OID = 2642 ( var_samp PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample variance of integer input values (square of the sample standard deviation)"); DATA(insert OID = 2643 ( var_samp PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample variance of smallint input values (square of the sample standard deviation)"); DATA(insert OID = 2644 ( var_samp PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample variance of float4 input values (square of the sample standard deviation)"); DATA(insert OID = 2645 ( var_samp PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample variance of float8 input values (square of the sample standard deviation)"); DATA(insert OID = 2646 ( var_samp PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample variance of numeric input values (square of the sample standard deviation)"); DATA(insert OID = 2148 ( variance PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for var_samp"); DATA(insert OID = 2149 ( variance PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for var_samp"); DATA(insert OID = 2150 ( variance PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for var_samp"); DATA(insert OID = 2151 ( variance PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for var_samp"); DATA(insert OID = 2152 ( variance PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for var_samp"); DATA(insert OID = 2153 ( variance PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for var_samp"); DATA(insert OID = 2724 ( stddev_pop PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population standard deviation of bigint input values"); DATA(insert OID = 2725 ( stddev_pop PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population standard deviation of integer input values"); DATA(insert OID = 2726 ( stddev_pop PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population standard deviation of smallint input values"); DATA(insert OID = 2727 ( stddev_pop PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population standard deviation of float4 input values"); DATA(insert OID = 2728 ( stddev_pop PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population standard deviation of float8 input values"); DATA(insert OID = 2729 ( stddev_pop PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population standard deviation of numeric input values"); DATA(insert OID = 2712 ( stddev_samp PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample standard deviation of bigint input values"); DATA(insert OID = 2713 ( stddev_samp PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample standard deviation of integer input values"); DATA(insert OID = 2714 ( stddev_samp PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample standard deviation of smallint input values"); DATA(insert OID = 2715 ( stddev_samp PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample standard deviation of float4 input values"); DATA(insert OID = 2716 ( stddev_samp PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample standard deviation of float8 input values"); DATA(insert OID = 2717 ( stddev_samp PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample standard deviation of numeric input values"); DATA(insert OID = 2154 ( stddev PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for stddev_samp"); DATA(insert OID = 2155 ( stddev PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for stddev_samp"); DATA(insert OID = 2156 ( stddev PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for stddev_samp"); DATA(insert OID = 2157 ( stddev PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for stddev_samp"); DATA(insert OID = 2158 ( stddev PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for stddev_samp"); DATA(insert OID = 2159 ( stddev PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for stddev_samp"); DATA(insert OID = 2818 ( regr_count PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 20 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("number of input rows in which both expressions are not null"); DATA(insert OID = 2819 ( regr_sxx PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum of squares of the independent variable (sum(X^2) - sum(X)^2/N)"); DATA(insert OID = 2820 ( regr_syy PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum of squares of the dependent variable (sum(Y^2) - sum(Y)^2/N)"); DATA(insert OID = 2821 ( regr_sxy PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum of products of independent times dependent variable (sum(X*Y) - sum(X) * sum(Y)/N)"); DATA(insert OID = 2822 ( regr_avgx PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("average of the independent variable (sum(X)/N)"); DATA(insert OID = 2823 ( regr_avgy PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("average of the dependent variable (sum(Y)/N)"); DATA(insert OID = 2824 ( regr_r2 PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("square of the correlation coefficient"); DATA(insert OID = 2825 ( regr_slope PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("slope of the least-squares-fit linear equation determined by the (X, Y) pairs"); DATA(insert OID = 2826 ( regr_intercept PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("y-intercept of the least-squares-fit linear equation determined by the (X, Y) pairs"); DATA(insert OID = 2827 ( covar_pop PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population covariance"); DATA(insert OID = 2828 ( covar_samp PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample covariance"); DATA(insert OID = 2829 ( corr PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("correlation coefficient"); DATA(insert OID = 2160 ( text_pattern_lt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ text_pattern_lt _null_ _null_ _null_ )); DATA(insert OID = 2161 ( text_pattern_le PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ text_pattern_le _null_ _null_ _null_ )); DATA(insert OID = 2163 ( text_pattern_ge PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ text_pattern_ge _null_ _null_ _null_ )); DATA(insert OID = 2164 ( text_pattern_gt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ text_pattern_gt _null_ _null_ _null_ )); DATA(insert OID = 2166 ( bttext_pattern_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "25 25" _null_ _null_ _null_ _null_ bttext_pattern_cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 2174 ( bpchar_pattern_lt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ bpchar_pattern_lt _null_ _null_ _null_ )); DATA(insert OID = 2175 ( bpchar_pattern_le PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ bpchar_pattern_le _null_ _null_ _null_ )); DATA(insert OID = 2177 ( bpchar_pattern_ge PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ bpchar_pattern_ge _null_ _null_ _null_ )); DATA(insert OID = 2178 ( bpchar_pattern_gt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1042 1042" _null_ _null_ _null_ _null_ bpchar_pattern_gt _null_ _null_ _null_ )); DATA(insert OID = 2180 ( btbpchar_pattern_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1042 1042" _null_ _null_ _null_ _null_ btbpchar_pattern_cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 2188 ( btint48cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 20" _null_ _null_ _null_ _null_ btint48cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 2189 ( btint84cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "20 23" _null_ _null_ _null_ _null_ btint84cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 2190 ( btint24cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "21 23" _null_ _null_ _null_ _null_ btint24cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 2191 ( btint42cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "23 21" _null_ _null_ _null_ _null_ btint42cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 2192 ( btint28cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "21 20" _null_ _null_ _null_ _null_ btint28cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 2193 ( btint82cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "20 21" _null_ _null_ _null_ _null_ btint82cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 2194 ( btfloat48cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "700 701" _null_ _null_ _null_ _null_ btfloat48cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 2195 ( btfloat84cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "701 700" _null_ _null_ _null_ _null_ btfloat84cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 2212 ( regprocedurein PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2202 "2275" _null_ _null_ _null_ _null_ regprocedurein _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2213 ( regprocedureout PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2202" _null_ _null_ _null_ _null_ regprocedureout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2214 ( regoperin PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2203 "2275" _null_ _null_ _null_ _null_ regoperin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2215 ( regoperout PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2203" _null_ _null_ _null_ _null_ regoperout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2216 ( regoperatorin PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2204 "2275" _null_ _null_ _null_ _null_ regoperatorin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2217 ( regoperatorout PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2204" _null_ _null_ _null_ _null_ regoperatorout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2218 ( regclassin PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2205 "2275" _null_ _null_ _null_ _null_ regclassin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2219 ( regclassout PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2205" _null_ _null_ _null_ _null_ regclassout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2220 ( regtypein PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2206 "2275" _null_ _null_ _null_ _null_ regtypein _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2221 ( regtypeout PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2206" _null_ _null_ _null_ _null_ regtypeout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1079 ( regclass PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2205 "25" _null_ _null_ _null_ _null_ text_regclass _null_ _null_ _null_ )); DESCR("convert text to regclass"); DATA(insert OID = 2246 ( fmgr_internal_validator PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2278 "26" _null_ _null_ _null_ _null_ fmgr_internal_validator _null_ _null_ _null_ )); DESCR("(internal)"); DATA(insert OID = 2247 ( fmgr_c_validator PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2278 "26" _null_ _null_ _null_ _null_ fmgr_c_validator _null_ _null_ _null_ )); DESCR("(internal)"); DATA(insert OID = 2248 ( fmgr_sql_validator PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2278 "26" _null_ _null_ _null_ _null_ fmgr_sql_validator _null_ _null_ _null_ )); DESCR("(internal)"); DATA(insert OID = 2250 ( has_database_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ has_database_privilege_name_name _null_ _null_ _null_ )); DESCR("user privilege on database by username, database name"); DATA(insert OID = 2251 ( has_database_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ has_database_privilege_name_id _null_ _null_ _null_ )); DESCR("user privilege on database by username, database oid"); DATA(insert OID = 2252 ( has_database_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ has_database_privilege_id_name _null_ _null_ _null_ )); DESCR("user privilege on database by user oid, database name"); DATA(insert OID = 2253 ( has_database_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ has_database_privilege_id_id _null_ _null_ _null_ )); DESCR("user privilege on database by user oid, database oid"); DATA(insert OID = 2254 ( has_database_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ has_database_privilege_name _null_ _null_ _null_ )); DESCR("current user privilege on database by database name"); DATA(insert OID = 2255 ( has_database_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ has_database_privilege_id _null_ _null_ _null_ )); DESCR("current user privilege on database by database oid"); DATA(insert OID = 2256 ( has_function_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ has_function_privilege_name_name _null_ _null_ _null_ )); DESCR("user privilege on function by username, function name"); DATA(insert OID = 2257 ( has_function_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ has_function_privilege_name_id _null_ _null_ _null_ )); DESCR("user privilege on function by username, function oid"); DATA(insert OID = 2258 ( has_function_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ has_function_privilege_id_name _null_ _null_ _null_ )); DESCR("user privilege on function by user oid, function name"); DATA(insert OID = 2259 ( has_function_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ has_function_privilege_id_id _null_ _null_ _null_ )); DESCR("user privilege on function by user oid, function oid"); DATA(insert OID = 2260 ( has_function_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ has_function_privilege_name _null_ _null_ _null_ )); DESCR("current user privilege on function by function name"); DATA(insert OID = 2261 ( has_function_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ has_function_privilege_id _null_ _null_ _null_ )); DESCR("current user privilege on function by function oid"); DATA(insert OID = 2262 ( has_language_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ has_language_privilege_name_name _null_ _null_ _null_ )); DESCR("user privilege on language by username, language name"); DATA(insert OID = 2263 ( has_language_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ has_language_privilege_name_id _null_ _null_ _null_ )); DESCR("user privilege on language by username, language oid"); DATA(insert OID = 2264 ( has_language_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ has_language_privilege_id_name _null_ _null_ _null_ )); DESCR("user privilege on language by user oid, language name"); DATA(insert OID = 2265 ( has_language_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ has_language_privilege_id_id _null_ _null_ _null_ )); DESCR("user privilege on language by user oid, language oid"); DATA(insert OID = 2266 ( has_language_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ has_language_privilege_name _null_ _null_ _null_ )); DESCR("current user privilege on language by language name"); DATA(insert OID = 2267 ( has_language_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ has_language_privilege_id _null_ _null_ _null_ )); DESCR("current user privilege on language by language oid"); DATA(insert OID = 2268 ( has_schema_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ has_schema_privilege_name_name _null_ _null_ _null_ )); DESCR("user privilege on schema by username, schema name"); DATA(insert OID = 2269 ( has_schema_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ has_schema_privilege_name_id _null_ _null_ _null_ )); DESCR("user privilege on schema by username, schema oid"); DATA(insert OID = 2270 ( has_schema_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ has_schema_privilege_id_name _null_ _null_ _null_ )); DESCR("user privilege on schema by user oid, schema name"); DATA(insert OID = 2271 ( has_schema_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ has_schema_privilege_id_id _null_ _null_ _null_ )); DESCR("user privilege on schema by user oid, schema oid"); DATA(insert OID = 2272 ( has_schema_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ has_schema_privilege_name _null_ _null_ _null_ )); DESCR("current user privilege on schema by schema name"); DATA(insert OID = 2273 ( has_schema_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ has_schema_privilege_id _null_ _null_ _null_ )); DESCR("current user privilege on schema by schema oid"); DATA(insert OID = 2390 ( has_tablespace_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ has_tablespace_privilege_name_name _null_ _null_ _null_ )); DESCR("user privilege on tablespace by username, tablespace name"); DATA(insert OID = 2391 ( has_tablespace_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ has_tablespace_privilege_name_id _null_ _null_ _null_ )); DESCR("user privilege on tablespace by username, tablespace oid"); DATA(insert OID = 2392 ( has_tablespace_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ has_tablespace_privilege_id_name _null_ _null_ _null_ )); DESCR("user privilege on tablespace by user oid, tablespace name"); DATA(insert OID = 2393 ( has_tablespace_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ has_tablespace_privilege_id_id _null_ _null_ _null_ )); DESCR("user privilege on tablespace by user oid, tablespace oid"); DATA(insert OID = 2394 ( has_tablespace_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ has_tablespace_privilege_name _null_ _null_ _null_ )); DESCR("current user privilege on tablespace by tablespace name"); DATA(insert OID = 2395 ( has_tablespace_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ has_tablespace_privilege_id _null_ _null_ _null_ )); DESCR("current user privilege on tablespace by tablespace oid"); DATA(insert OID = 3000 ( has_foreign_data_wrapper_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ has_foreign_data_wrapper_privilege_name_name _null_ _null_ _null_ )); DESCR("user privilege on foreign data wrapper by username, foreign data wrapper name"); DATA(insert OID = 3001 ( has_foreign_data_wrapper_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ has_foreign_data_wrapper_privilege_name_id _null_ _null_ _null_ )); DESCR("user privilege on foreign data wrapper by username, foreign data wrapper oid"); DATA(insert OID = 3002 ( has_foreign_data_wrapper_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ has_foreign_data_wrapper_privilege_id_name _null_ _null_ _null_ )); DESCR("user privilege on foreign data wrapper by user oid, foreign data wrapper name"); DATA(insert OID = 3003 ( has_foreign_data_wrapper_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ has_foreign_data_wrapper_privilege_id_id _null_ _null_ _null_ )); DESCR("user privilege on foreign data wrapper by user oid, foreign data wrapper oid"); DATA(insert OID = 3004 ( has_foreign_data_wrapper_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ has_foreign_data_wrapper_privilege_name _null_ _null_ _null_ )); DESCR("current user privilege on foreign data wrapper by foreign data wrapper name"); DATA(insert OID = 3005 ( has_foreign_data_wrapper_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ has_foreign_data_wrapper_privilege_id _null_ _null_ _null_ )); DESCR("current user privilege on foreign data wrapper by foreign data wrapper oid"); DATA(insert OID = 3006 ( has_server_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ has_server_privilege_name_name _null_ _null_ _null_ )); DESCR("user privilege on server by username, server name"); DATA(insert OID = 3007 ( has_server_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ has_server_privilege_name_id _null_ _null_ _null_ )); DESCR("user privilege on server by username, server oid"); DATA(insert OID = 3008 ( has_server_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ has_server_privilege_id_name _null_ _null_ _null_ )); DESCR("user privilege on server by user oid, server name"); DATA(insert OID = 3009 ( has_server_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ has_server_privilege_id_id _null_ _null_ _null_ )); DESCR("user privilege on server by user oid, server oid"); DATA(insert OID = 3010 ( has_server_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ has_server_privilege_name _null_ _null_ _null_ )); DESCR("current user privilege on server by server name"); DATA(insert OID = 3011 ( has_server_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ has_server_privilege_id _null_ _null_ _null_ )); DESCR("current user privilege on server by server oid"); DATA(insert OID = 3138 ( has_type_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 25 25" _null_ _null_ _null_ _null_ has_type_privilege_name_name _null_ _null_ _null_ )); DESCR("user privilege on type by username, type name"); DATA(insert OID = 3139 ( has_type_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ has_type_privilege_name_id _null_ _null_ _null_ )); DESCR("user privilege on type by username, type oid"); DATA(insert OID = 3140 ( has_type_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 25 25" _null_ _null_ _null_ _null_ has_type_privilege_id_name _null_ _null_ _null_ )); DESCR("user privilege on type by user oid, type name"); DATA(insert OID = 3141 ( has_type_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ has_type_privilege_id_id _null_ _null_ _null_ )); DESCR("user privilege on type by user oid, type oid"); DATA(insert OID = 3142 ( has_type_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ has_type_privilege_name _null_ _null_ _null_ )); DESCR("current user privilege on type by type name"); DATA(insert OID = 3143 ( has_type_privilege PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ has_type_privilege_id _null_ _null_ _null_ )); DESCR("current user privilege on type by type oid"); DATA(insert OID = 2705 ( pg_has_role PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 19 25" _null_ _null_ _null_ _null_ pg_has_role_name_name _null_ _null_ _null_ )); DESCR("user privilege on role by username, role name"); DATA(insert OID = 2706 ( pg_has_role PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "19 26 25" _null_ _null_ _null_ _null_ pg_has_role_name_id _null_ _null_ _null_ )); DESCR("user privilege on role by username, role oid"); DATA(insert OID = 2707 ( pg_has_role PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 19 25" _null_ _null_ _null_ _null_ pg_has_role_id_name _null_ _null_ _null_ )); DESCR("user privilege on role by user oid, role name"); DATA(insert OID = 2708 ( pg_has_role PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 16 "26 26 25" _null_ _null_ _null_ _null_ pg_has_role_id_id _null_ _null_ _null_ )); DESCR("user privilege on role by user oid, role oid"); DATA(insert OID = 2709 ( pg_has_role PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "19 25" _null_ _null_ _null_ _null_ pg_has_role_name _null_ _null_ _null_ )); DESCR("current user privilege on role by role name"); DATA(insert OID = 2710 ( pg_has_role PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ pg_has_role_id _null_ _null_ _null_ )); DESCR("current user privilege on role by role oid"); DATA(insert OID = 1269 ( pg_column_size PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 23 "2276" _null_ _null_ _null_ _null_ pg_column_size _null_ _null_ _null_ )); DESCR("bytes required to store the value, perhaps with compression"); DATA(insert OID = 2322 ( pg_tablespace_size PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_tablespace_size_oid _null_ _null_ _null_ )); DESCR("total disk space usage for the specified tablespace"); DATA(insert OID = 2323 ( pg_tablespace_size PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "19" _null_ _null_ _null_ _null_ pg_tablespace_size_name _null_ _null_ _null_ )); DESCR("total disk space usage for the specified tablespace"); DATA(insert OID = 2324 ( pg_database_size PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_database_size_oid _null_ _null_ _null_ )); DESCR("total disk space usage for the specified database"); DATA(insert OID = 2168 ( pg_database_size PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "19" _null_ _null_ _null_ _null_ pg_database_size_name _null_ _null_ _null_ )); DESCR("total disk space usage for the specified database"); DATA(insert OID = 2325 ( pg_relation_size PGNSP PGUID 14 1 0 0 0 f f f f t f v 1 0 20 "2205" _null_ _null_ _null_ _null_ "select pg_catalog.pg_relation_size($1, ''main'')" _null_ _null_ _null_ )); DESCR("disk space usage for the main fork of the specified table or index"); DATA(insert OID = 2332 ( pg_relation_size PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 20 "2205 25" _null_ _null_ _null_ _null_ pg_relation_size _null_ _null_ _null_ )); DESCR("disk space usage for the specified fork of a table or index"); DATA(insert OID = 2286 ( pg_total_relation_size PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "2205" _null_ _null_ _null_ _null_ pg_total_relation_size _null_ _null_ _null_ )); DESCR("total disk space usage for the specified table and associated indexes"); DATA(insert OID = 2288 ( pg_size_pretty PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 25 "20" _null_ _null_ _null_ _null_ pg_size_pretty _null_ _null_ _null_ )); DESCR("convert a long int to a human readable text using size units"); DATA(insert OID = 3166 ( pg_size_pretty PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 25 "1700" _null_ _null_ _null_ _null_ pg_size_pretty_numeric _null_ _null_ _null_ )); DESCR("convert a numeric to a human readable text using size units"); DATA(insert OID = 2997 ( pg_table_size PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "2205" _null_ _null_ _null_ _null_ pg_table_size _null_ _null_ _null_ )); DESCR("disk space usage for the specified table, including TOAST, free space and visibility map"); DATA(insert OID = 2998 ( pg_indexes_size PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "2205" _null_ _null_ _null_ _null_ pg_indexes_size _null_ _null_ _null_ )); DESCR("disk space usage for all indexes attached to the specified table"); DATA(insert OID = 2999 ( pg_relation_filenode PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 26 "2205" _null_ _null_ _null_ _null_ pg_relation_filenode _null_ _null_ _null_ )); DESCR("filenode identifier of relation"); DATA(insert OID = 3034 ( pg_relation_filepath PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "2205" _null_ _null_ _null_ _null_ pg_relation_filepath _null_ _null_ _null_ )); DESCR("file path of relation"); DATA(insert OID = 2316 ( postgresql_fdw_validator PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1009 26" _null_ _null_ _null_ _null_ postgresql_fdw_validator _null_ _null_ _null_)); DESCR("(internal)"); DATA(insert OID = 2290 ( record_in PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 2249 "2275 26 23" _null_ _null_ _null_ _null_ record_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2291 ( record_out PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2249" _null_ _null_ _null_ _null_ record_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2292 ( cstring_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2275" _null_ _null_ _null_ _null_ cstring_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2293 ( cstring_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2275" _null_ _null_ _null_ _null_ cstring_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2294 ( any_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2276 "2275" _null_ _null_ _null_ _null_ any_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2295 ( any_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2276" _null_ _null_ _null_ _null_ any_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2296 ( anyarray_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2277 "2275" _null_ _null_ _null_ _null_ anyarray_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2297 ( anyarray_out PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2277" _null_ _null_ _null_ _null_ anyarray_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2298 ( void_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2275" _null_ _null_ _null_ _null_ void_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2299 ( void_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2278" _null_ _null_ _null_ _null_ void_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2300 ( trigger_in PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 2279 "2275" _null_ _null_ _null_ _null_ trigger_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2301 ( trigger_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2279" _null_ _null_ _null_ _null_ trigger_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2302 ( language_handler_in PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 2280 "2275" _null_ _null_ _null_ _null_ language_handler_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2303 ( language_handler_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2280" _null_ _null_ _null_ _null_ language_handler_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2304 ( internal_in PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 2281 "2275" _null_ _null_ _null_ _null_ internal_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2305 ( internal_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2281" _null_ _null_ _null_ _null_ internal_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2306 ( opaque_in PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 2282 "2275" _null_ _null_ _null_ _null_ opaque_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2307 ( opaque_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2282" _null_ _null_ _null_ _null_ opaque_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2312 ( anyelement_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2283 "2275" _null_ _null_ _null_ _null_ anyelement_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2313 ( anyelement_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2283" _null_ _null_ _null_ _null_ anyelement_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2398 ( shell_in PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 2282 "2275" _null_ _null_ _null_ _null_ shell_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2399 ( shell_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2282" _null_ _null_ _null_ _null_ shell_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2597 ( domain_in PGNSP PGUID 12 1 0 0 0 f f f f f f s 3 0 2276 "2275 26 23" _null_ _null_ _null_ _null_ domain_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2598 ( domain_recv PGNSP PGUID 12 1 0 0 0 f f f f f f s 3 0 2276 "2281 26 23" _null_ _null_ _null_ _null_ domain_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2777 ( anynonarray_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2776 "2275" _null_ _null_ _null_ _null_ anynonarray_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2778 ( anynonarray_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2776" _null_ _null_ _null_ _null_ anynonarray_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3116 ( fdw_handler_in PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 3115 "2275" _null_ _null_ _null_ _null_ fdw_handler_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3117 ( fdw_handler_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "3115" _null_ _null_ _null_ _null_ fdw_handler_out _null_ _null_ _null_ )); DESCR("I/O"); /* cryptographic */ DATA(insert OID = 2311 ( md5 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ md5_text _null_ _null_ _null_ )); DESCR("MD5 hash"); DATA(insert OID = 2321 ( md5 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "17" _null_ _null_ _null_ _null_ md5_bytea _null_ _null_ _null_ )); DESCR("MD5 hash"); /* crosstype operations for date vs. timestamp and timestamptz */ DATA(insert OID = 2338 ( date_lt_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1082 1114" _null_ _null_ _null_ _null_ date_lt_timestamp _null_ _null_ _null_ )); DATA(insert OID = 2339 ( date_le_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1082 1114" _null_ _null_ _null_ _null_ date_le_timestamp _null_ _null_ _null_ )); DATA(insert OID = 2340 ( date_eq_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1082 1114" _null_ _null_ _null_ _null_ date_eq_timestamp _null_ _null_ _null_ )); DATA(insert OID = 2341 ( date_gt_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1082 1114" _null_ _null_ _null_ _null_ date_gt_timestamp _null_ _null_ _null_ )); DATA(insert OID = 2342 ( date_ge_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1082 1114" _null_ _null_ _null_ _null_ date_ge_timestamp _null_ _null_ _null_ )); DATA(insert OID = 2343 ( date_ne_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1082 1114" _null_ _null_ _null_ _null_ date_ne_timestamp _null_ _null_ _null_ )); DATA(insert OID = 2344 ( date_cmp_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1082 1114" _null_ _null_ _null_ _null_ date_cmp_timestamp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 2351 ( date_lt_timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1082 1184" _null_ _null_ _null_ _null_ date_lt_timestamptz _null_ _null_ _null_ )); DATA(insert OID = 2352 ( date_le_timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1082 1184" _null_ _null_ _null_ _null_ date_le_timestamptz _null_ _null_ _null_ )); DATA(insert OID = 2353 ( date_eq_timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1082 1184" _null_ _null_ _null_ _null_ date_eq_timestamptz _null_ _null_ _null_ )); DATA(insert OID = 2354 ( date_gt_timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1082 1184" _null_ _null_ _null_ _null_ date_gt_timestamptz _null_ _null_ _null_ )); DATA(insert OID = 2355 ( date_ge_timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1082 1184" _null_ _null_ _null_ _null_ date_ge_timestamptz _null_ _null_ _null_ )); DATA(insert OID = 2356 ( date_ne_timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1082 1184" _null_ _null_ _null_ _null_ date_ne_timestamptz _null_ _null_ _null_ )); DATA(insert OID = 2357 ( date_cmp_timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 23 "1082 1184" _null_ _null_ _null_ _null_ date_cmp_timestamptz _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 2364 ( timestamp_lt_date PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1114 1082" _null_ _null_ _null_ _null_ timestamp_lt_date _null_ _null_ _null_ )); DATA(insert OID = 2365 ( timestamp_le_date PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1114 1082" _null_ _null_ _null_ _null_ timestamp_le_date _null_ _null_ _null_ )); DATA(insert OID = 2366 ( timestamp_eq_date PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1114 1082" _null_ _null_ _null_ _null_ timestamp_eq_date _null_ _null_ _null_ )); DATA(insert OID = 2367 ( timestamp_gt_date PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1114 1082" _null_ _null_ _null_ _null_ timestamp_gt_date _null_ _null_ _null_ )); DATA(insert OID = 2368 ( timestamp_ge_date PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1114 1082" _null_ _null_ _null_ _null_ timestamp_ge_date _null_ _null_ _null_ )); DATA(insert OID = 2369 ( timestamp_ne_date PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1114 1082" _null_ _null_ _null_ _null_ timestamp_ne_date _null_ _null_ _null_ )); DATA(insert OID = 2370 ( timestamp_cmp_date PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "1114 1082" _null_ _null_ _null_ _null_ timestamp_cmp_date _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 2377 ( timestamptz_lt_date PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1082" _null_ _null_ _null_ _null_ timestamptz_lt_date _null_ _null_ _null_ )); DATA(insert OID = 2378 ( timestamptz_le_date PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1082" _null_ _null_ _null_ _null_ timestamptz_le_date _null_ _null_ _null_ )); DATA(insert OID = 2379 ( timestamptz_eq_date PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1082" _null_ _null_ _null_ _null_ timestamptz_eq_date _null_ _null_ _null_ )); DATA(insert OID = 2380 ( timestamptz_gt_date PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1082" _null_ _null_ _null_ _null_ timestamptz_gt_date _null_ _null_ _null_ )); DATA(insert OID = 2381 ( timestamptz_ge_date PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1082" _null_ _null_ _null_ _null_ timestamptz_ge_date _null_ _null_ _null_ )); DATA(insert OID = 2382 ( timestamptz_ne_date PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1082" _null_ _null_ _null_ _null_ timestamptz_ne_date _null_ _null_ _null_ )); DATA(insert OID = 2383 ( timestamptz_cmp_date PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 23 "1184 1082" _null_ _null_ _null_ _null_ timestamptz_cmp_date _null_ _null_ _null_ )); DESCR("less-equal-greater"); /* crosstype operations for timestamp vs. timestamptz */ DATA(insert OID = 2520 ( timestamp_lt_timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ timestamp_lt_timestamptz _null_ _null_ _null_ )); DATA(insert OID = 2521 ( timestamp_le_timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ timestamp_le_timestamptz _null_ _null_ _null_ )); DATA(insert OID = 2522 ( timestamp_eq_timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ timestamp_eq_timestamptz _null_ _null_ _null_ )); DATA(insert OID = 2523 ( timestamp_gt_timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ timestamp_gt_timestamptz _null_ _null_ _null_ )); DATA(insert OID = 2524 ( timestamp_ge_timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ timestamp_ge_timestamptz _null_ _null_ _null_ )); DATA(insert OID = 2525 ( timestamp_ne_timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ timestamp_ne_timestamptz _null_ _null_ _null_ )); DATA(insert OID = 2526 ( timestamp_cmp_timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 23 "1114 1184" _null_ _null_ _null_ _null_ timestamp_cmp_timestamptz _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 2527 ( timestamptz_lt_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_lt_timestamp _null_ _null_ _null_ )); DATA(insert OID = 2528 ( timestamptz_le_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_le_timestamp _null_ _null_ _null_ )); DATA(insert OID = 2529 ( timestamptz_eq_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_eq_timestamp _null_ _null_ _null_ )); DATA(insert OID = 2530 ( timestamptz_gt_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_gt_timestamp _null_ _null_ _null_ )); DATA(insert OID = 2531 ( timestamptz_ge_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_ge_timestamp _null_ _null_ _null_ )); DATA(insert OID = 2532 ( timestamptz_ne_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_ne_timestamp _null_ _null_ _null_ )); DATA(insert OID = 2533 ( timestamptz_cmp_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 23 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_cmp_timestamp _null_ _null_ _null_ )); DESCR("less-equal-greater"); /* send/receive functions */ DATA(insert OID = 2400 ( array_recv PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 2277 "2281 26 23" _null_ _null_ _null_ _null_ array_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2401 ( array_send PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "2277" _null_ _null_ _null_ _null_ array_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2402 ( record_recv PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 2249 "2281 26 23" _null_ _null_ _null_ _null_ record_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2403 ( record_send PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "2249" _null_ _null_ _null_ _null_ record_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2404 ( int2recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 21 "2281" _null_ _null_ _null_ _null_ int2recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2405 ( int2send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "21" _null_ _null_ _null_ _null_ int2send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2406 ( int4recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "2281" _null_ _null_ _null_ _null_ int4recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2407 ( int4send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "23" _null_ _null_ _null_ _null_ int4send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2408 ( int8recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "2281" _null_ _null_ _null_ _null_ int8recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2409 ( int8send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "20" _null_ _null_ _null_ _null_ int8send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2410 ( int2vectorrecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 22 "2281" _null_ _null_ _null_ _null_ int2vectorrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2411 ( int2vectorsend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "22" _null_ _null_ _null_ _null_ int2vectorsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2412 ( bytearecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "2281" _null_ _null_ _null_ _null_ bytearecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2413 ( byteasend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "17" _null_ _null_ _null_ _null_ byteasend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2414 ( textrecv PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "2281" _null_ _null_ _null_ _null_ textrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2415 ( textsend PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "25" _null_ _null_ _null_ _null_ textsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2416 ( unknownrecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 705 "2281" _null_ _null_ _null_ _null_ unknownrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2417 ( unknownsend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "705" _null_ _null_ _null_ _null_ unknownsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2418 ( oidrecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 26 "2281" _null_ _null_ _null_ _null_ oidrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2419 ( oidsend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "26" _null_ _null_ _null_ _null_ oidsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2420 ( oidvectorrecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 30 "2281" _null_ _null_ _null_ _null_ oidvectorrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2421 ( oidvectorsend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "30" _null_ _null_ _null_ _null_ oidvectorsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2422 ( namerecv PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 19 "2281" _null_ _null_ _null_ _null_ namerecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2423 ( namesend PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "19" _null_ _null_ _null_ _null_ namesend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2424 ( float4recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 700 "2281" _null_ _null_ _null_ _null_ float4recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2425 ( float4send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "700" _null_ _null_ _null_ _null_ float4send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2426 ( float8recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "2281" _null_ _null_ _null_ _null_ float8recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2427 ( float8send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "701" _null_ _null_ _null_ _null_ float8send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2428 ( point_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 600 "2281" _null_ _null_ _null_ _null_ point_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2429 ( point_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "600" _null_ _null_ _null_ _null_ point_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2430 ( bpcharrecv PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 1042 "2281 26 23" _null_ _null_ _null_ _null_ bpcharrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2431 ( bpcharsend PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "1042" _null_ _null_ _null_ _null_ bpcharsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2432 ( varcharrecv PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 1043 "2281 26 23" _null_ _null_ _null_ _null_ varcharrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2433 ( varcharsend PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "1043" _null_ _null_ _null_ _null_ varcharsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2434 ( charrecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 18 "2281" _null_ _null_ _null_ _null_ charrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2435 ( charsend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "18" _null_ _null_ _null_ _null_ charsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2436 ( boolrecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "2281" _null_ _null_ _null_ _null_ boolrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2437 ( boolsend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "16" _null_ _null_ _null_ _null_ boolsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2438 ( tidrecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 27 "2281" _null_ _null_ _null_ _null_ tidrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2439 ( tidsend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "27" _null_ _null_ _null_ _null_ tidsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2440 ( xidrecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 28 "2281" _null_ _null_ _null_ _null_ xidrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2441 ( xidsend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "28" _null_ _null_ _null_ _null_ xidsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2442 ( cidrecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 29 "2281" _null_ _null_ _null_ _null_ cidrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2443 ( cidsend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "29" _null_ _null_ _null_ _null_ cidsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2444 ( regprocrecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 24 "2281" _null_ _null_ _null_ _null_ regprocrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2445 ( regprocsend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "24" _null_ _null_ _null_ _null_ regprocsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2446 ( regprocedurerecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2202 "2281" _null_ _null_ _null_ _null_ regprocedurerecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2447 ( regproceduresend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "2202" _null_ _null_ _null_ _null_ regproceduresend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2448 ( regoperrecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2203 "2281" _null_ _null_ _null_ _null_ regoperrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2449 ( regopersend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "2203" _null_ _null_ _null_ _null_ regopersend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2450 ( regoperatorrecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2204 "2281" _null_ _null_ _null_ _null_ regoperatorrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2451 ( regoperatorsend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "2204" _null_ _null_ _null_ _null_ regoperatorsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2452 ( regclassrecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2205 "2281" _null_ _null_ _null_ _null_ regclassrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2453 ( regclasssend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "2205" _null_ _null_ _null_ _null_ regclasssend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2454 ( regtyperecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2206 "2281" _null_ _null_ _null_ _null_ regtyperecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2455 ( regtypesend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "2206" _null_ _null_ _null_ _null_ regtypesend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2456 ( bit_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1560 "2281 26 23" _null_ _null_ _null_ _null_ bit_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2457 ( bit_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "1560" _null_ _null_ _null_ _null_ bit_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2458 ( varbit_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1562 "2281 26 23" _null_ _null_ _null_ _null_ varbit_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2459 ( varbit_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "1562" _null_ _null_ _null_ _null_ varbit_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2460 ( numeric_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1700 "2281 26 23" _null_ _null_ _null_ _null_ numeric_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2461 ( numeric_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "1700" _null_ _null_ _null_ _null_ numeric_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2462 ( abstimerecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 702 "2281" _null_ _null_ _null_ _null_ abstimerecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2463 ( abstimesend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "702" _null_ _null_ _null_ _null_ abstimesend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2464 ( reltimerecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 703 "2281" _null_ _null_ _null_ _null_ reltimerecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2465 ( reltimesend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "703" _null_ _null_ _null_ _null_ reltimesend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2466 ( tintervalrecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 704 "2281" _null_ _null_ _null_ _null_ tintervalrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2467 ( tintervalsend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "704" _null_ _null_ _null_ _null_ tintervalsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2468 ( date_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1082 "2281" _null_ _null_ _null_ _null_ date_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2469 ( date_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "1082" _null_ _null_ _null_ _null_ date_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2470 ( time_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1083 "2281 26 23" _null_ _null_ _null_ _null_ time_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2471 ( time_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "1083" _null_ _null_ _null_ _null_ time_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2472 ( timetz_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1266 "2281 26 23" _null_ _null_ _null_ _null_ timetz_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2473 ( timetz_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "1266" _null_ _null_ _null_ _null_ timetz_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2474 ( timestamp_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1114 "2281 26 23" _null_ _null_ _null_ _null_ timestamp_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2475 ( timestamp_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "1114" _null_ _null_ _null_ _null_ timestamp_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2476 ( timestamptz_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1184 "2281 26 23" _null_ _null_ _null_ _null_ timestamptz_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2477 ( timestamptz_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "1184" _null_ _null_ _null_ _null_ timestamptz_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2478 ( interval_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1186 "2281 26 23" _null_ _null_ _null_ _null_ interval_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2479 ( interval_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "1186" _null_ _null_ _null_ _null_ interval_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2480 ( lseg_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 601 "2281" _null_ _null_ _null_ _null_ lseg_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2481 ( lseg_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "601" _null_ _null_ _null_ _null_ lseg_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2482 ( path_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 602 "2281" _null_ _null_ _null_ _null_ path_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2483 ( path_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "602" _null_ _null_ _null_ _null_ path_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2484 ( box_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 603 "2281" _null_ _null_ _null_ _null_ box_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2485 ( box_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "603" _null_ _null_ _null_ _null_ box_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2486 ( poly_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 604 "2281" _null_ _null_ _null_ _null_ poly_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2487 ( poly_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "604" _null_ _null_ _null_ _null_ poly_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2488 ( line_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 628 "2281" _null_ _null_ _null_ _null_ line_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2489 ( line_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "628" _null_ _null_ _null_ _null_ line_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2490 ( circle_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 718 "2281" _null_ _null_ _null_ _null_ circle_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2491 ( circle_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "718" _null_ _null_ _null_ _null_ circle_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2492 ( cash_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 790 "2281" _null_ _null_ _null_ _null_ cash_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2493 ( cash_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "790" _null_ _null_ _null_ _null_ cash_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2494 ( macaddr_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 829 "2281" _null_ _null_ _null_ _null_ macaddr_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2495 ( macaddr_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "829" _null_ _null_ _null_ _null_ macaddr_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2496 ( inet_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 869 "2281" _null_ _null_ _null_ _null_ inet_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2497 ( inet_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "869" _null_ _null_ _null_ _null_ inet_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2498 ( cidr_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 650 "2281" _null_ _null_ _null_ _null_ cidr_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2499 ( cidr_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "650" _null_ _null_ _null_ _null_ cidr_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2500 ( cstring_recv PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2281" _null_ _null_ _null_ _null_ cstring_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2501 ( cstring_send PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "2275" _null_ _null_ _null_ _null_ cstring_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2502 ( anyarray_recv PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2277 "2281" _null_ _null_ _null_ _null_ anyarray_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2503 ( anyarray_send PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "2277" _null_ _null_ _null_ _null_ anyarray_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3120 ( void_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ void_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3121 ( void_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "2278" _null_ _null_ _null_ _null_ void_send _null_ _null_ _null_ )); DESCR("I/O"); /* System-view support functions with pretty-print option */ DATA(insert OID = 2504 ( pg_get_ruledef PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "26 16" _null_ _null_ _null_ _null_ pg_get_ruledef_ext _null_ _null_ _null_ )); DESCR("source text of a rule with pretty-print option"); DATA(insert OID = 2505 ( pg_get_viewdef PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "25 16" _null_ _null_ _null_ _null_ pg_get_viewdef_name_ext _null_ _null_ _null_ )); DESCR("select statement of a view with pretty-print option"); DATA(insert OID = 2506 ( pg_get_viewdef PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "26 16" _null_ _null_ _null_ _null_ pg_get_viewdef_ext _null_ _null_ _null_ )); DESCR("select statement of a view with pretty-print option"); DATA(insert OID = 3159 ( pg_get_viewdef PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "26 23" _null_ _null_ _null_ _null_ pg_get_viewdef_wrap _null_ _null_ _null_ )); DESCR("select statement of a view with pretty-printing and specified line wrapping"); DATA(insert OID = 2507 ( pg_get_indexdef PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 25 "26 23 16" _null_ _null_ _null_ _null_ pg_get_indexdef_ext _null_ _null_ _null_ )); DESCR("index description (full create statement or single expression) with pretty-print option"); DATA(insert OID = 2508 ( pg_get_constraintdef PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "26 16" _null_ _null_ _null_ _null_ pg_get_constraintdef_ext _null_ _null_ _null_ )); DESCR("constraint description with pretty-print option"); DATA(insert OID = 2509 ( pg_get_expr PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 25 "194 26 16" _null_ _null_ _null_ _null_ pg_get_expr_ext _null_ _null_ _null_ )); DESCR("deparse an encoded expression with pretty-print option"); DATA(insert OID = 2510 ( pg_prepared_statement PGNSP PGUID 12 1 1000 0 0 f f f f t t s 0 0 2249 "" "{25,25,1184,2211,16}" "{o,o,o,o,o}" "{name,statement,prepare_time,parameter_types,from_sql}" _null_ pg_prepared_statement _null_ _null_ _null_ )); DESCR("get the prepared statements for this session"); DATA(insert OID = 2511 ( pg_cursor PGNSP PGUID 12 1 1000 0 0 f f f f t t s 0 0 2249 "" "{25,25,16,16,16,1184}" "{o,o,o,o,o,o}" "{name,statement,is_holdable,is_binary,is_scrollable,creation_time}" _null_ pg_cursor _null_ _null_ _null_ )); DESCR("get the open cursors for this session"); DATA(insert OID = 2599 ( pg_timezone_abbrevs PGNSP PGUID 12 1 1000 0 0 f f f f t t s 0 0 2249 "" "{25,1186,16}" "{o,o,o}" "{abbrev,utc_offset,is_dst}" _null_ pg_timezone_abbrevs _null_ _null_ _null_ )); DESCR("get the available time zone abbreviations"); DATA(insert OID = 2856 ( pg_timezone_names PGNSP PGUID 12 1 1000 0 0 f f f f t t s 0 0 2249 "" "{25,25,1186,16}" "{o,o,o,o}" "{name,abbrev,utc_offset,is_dst}" _null_ pg_timezone_names _null_ _null_ _null_ )); DESCR("get the available time zone names"); DATA(insert OID = 2730 ( pg_get_triggerdef PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "26 16" _null_ _null_ _null_ _null_ pg_get_triggerdef_ext _null_ _null_ _null_ )); DESCR("trigger description with pretty-print option"); DATA(insert OID = 3035 ( pg_listening_channels PGNSP PGUID 12 1 10 0 0 f f f f t t s 0 0 25 "" _null_ _null_ _null_ _null_ pg_listening_channels _null_ _null_ _null_ )); DESCR("get the channels that the current backend listens to"); DATA(insert OID = 3036 ( pg_notify PGNSP PGUID 12 1 0 0 0 f f f f f f v 2 0 2278 "25 25" _null_ _null_ _null_ _null_ pg_notify _null_ _null_ _null_ )); DESCR("send a notification event"); /* non-persistent series generator */ DATA(insert OID = 1066 ( generate_series PGNSP PGUID 12 1 1000 0 0 f f f f t t i 3 0 23 "23 23 23" _null_ _null_ _null_ _null_ generate_series_step_int4 _null_ _null_ _null_ )); DESCR("non-persistent series generator"); DATA(insert OID = 1067 ( generate_series PGNSP PGUID 12 1 1000 0 0 f f f f t t i 2 0 23 "23 23" _null_ _null_ _null_ _null_ generate_series_int4 _null_ _null_ _null_ )); DESCR("non-persistent series generator"); DATA(insert OID = 1068 ( generate_series PGNSP PGUID 12 1 1000 0 0 f f f f t t i 3 0 20 "20 20 20" _null_ _null_ _null_ _null_ generate_series_step_int8 _null_ _null_ _null_ )); DESCR("non-persistent series generator"); DATA(insert OID = 1069 ( generate_series PGNSP PGUID 12 1 1000 0 0 f f f f t t i 2 0 20 "20 20" _null_ _null_ _null_ _null_ generate_series_int8 _null_ _null_ _null_ )); DESCR("non-persistent series generator"); DATA(insert OID = 938 ( generate_series PGNSP PGUID 12 1 1000 0 0 f f f f t t i 3 0 1114 "1114 1114 1186" _null_ _null_ _null_ _null_ generate_series_timestamp _null_ _null_ _null_ )); DESCR("non-persistent series generator"); DATA(insert OID = 939 ( generate_series PGNSP PGUID 12 1 1000 0 0 f f f f t t s 3 0 1184 "1184 1184 1186" _null_ _null_ _null_ _null_ generate_series_timestamptz _null_ _null_ _null_ )); DESCR("non-persistent series generator"); /* boolean aggregates */ DATA(insert OID = 2515 ( booland_statefunc PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ booland_statefunc _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 2516 ( boolor_statefunc PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ boolor_statefunc _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 2517 ( bool_and PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 16 "16" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("boolean-and aggregate"); /* ANY, SOME? These names conflict with subquery operators. See doc. */ DATA(insert OID = 2518 ( bool_or PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 16 "16" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("boolean-or aggregate"); DATA(insert OID = 2519 ( every PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 16 "16" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("boolean-and aggregate"); /* bitwise integer aggregates */ DATA(insert OID = 2236 ( bit_and PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 21 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("bitwise-and smallint aggregate"); DATA(insert OID = 2237 ( bit_or PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 21 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("bitwise-or smallint aggregate"); DATA(insert OID = 2238 ( bit_and PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 23 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("bitwise-and integer aggregate"); DATA(insert OID = 2239 ( bit_or PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 23 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("bitwise-or integer aggregate"); DATA(insert OID = 2240 ( bit_and PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 20 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("bitwise-and bigint aggregate"); DATA(insert OID = 2241 ( bit_or PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 20 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("bitwise-or bigint aggregate"); DATA(insert OID = 2242 ( bit_and PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1560 "1560" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("bitwise-and bit aggregate"); DATA(insert OID = 2243 ( bit_or PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1560 "1560" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("bitwise-or bit aggregate"); /* formerly-missing interval + datetime operators */ DATA(insert OID = 2546 ( interval_pl_date PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 1114 "1186 1082" _null_ _null_ _null_ _null_ "select $2 + $1" _null_ _null_ _null_ )); DATA(insert OID = 2547 ( interval_pl_timetz PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 1266 "1186 1266" _null_ _null_ _null_ _null_ "select $2 + $1" _null_ _null_ _null_ )); DATA(insert OID = 2548 ( interval_pl_timestamp PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 1114 "1186 1114" _null_ _null_ _null_ _null_ "select $2 + $1" _null_ _null_ _null_ )); DATA(insert OID = 2549 ( interval_pl_timestamptz PGNSP PGUID 14 1 0 0 0 f f f f t f s 2 0 1184 "1186 1184" _null_ _null_ _null_ _null_ "select $2 + $1" _null_ _null_ _null_ )); DATA(insert OID = 2550 ( integer_pl_date PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 1082 "23 1082" _null_ _null_ _null_ _null_ "select $2 + $1" _null_ _null_ _null_ )); DATA(insert OID = 2556 ( pg_tablespace_databases PGNSP PGUID 12 1 1000 0 0 f f f f t t s 1 0 26 "26" _null_ _null_ _null_ _null_ pg_tablespace_databases _null_ _null_ _null_ )); DESCR("get OIDs of databases in a tablespace"); DATA(insert OID = 2557 ( bool PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "23" _null_ _null_ _null_ _null_ int4_bool _null_ _null_ _null_ )); DESCR("convert int4 to boolean"); DATA(insert OID = 2558 ( int4 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "16" _null_ _null_ _null_ _null_ bool_int4 _null_ _null_ _null_ )); DESCR("convert boolean to int4"); DATA(insert OID = 2559 ( lastval PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 20 "" _null_ _null_ _null_ _null_ lastval _null_ _null_ _null_ )); DESCR("current value from last used sequence"); /* start time function */ DATA(insert OID = 2560 ( pg_postmaster_start_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ pg_postmaster_start_time _null_ _null_ _null_ )); DESCR("postmaster start time"); /* config reload time function */ DATA(insert OID = 2034 ( pg_conf_load_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ pg_conf_load_time _null_ _null_ _null_ )); DESCR("configuration load time"); /* new functions for Y-direction rtree opclasses */ DATA(insert OID = 2562 ( box_below PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_below _null_ _null_ _null_ )); DATA(insert OID = 2563 ( box_overbelow PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_overbelow _null_ _null_ _null_ )); DATA(insert OID = 2564 ( box_overabove PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_overabove _null_ _null_ _null_ )); DATA(insert OID = 2565 ( box_above PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_above _null_ _null_ _null_ )); DATA(insert OID = 2566 ( poly_below PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ poly_below _null_ _null_ _null_ )); DATA(insert OID = 2567 ( poly_overbelow PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ poly_overbelow _null_ _null_ _null_ )); DATA(insert OID = 2568 ( poly_overabove PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ poly_overabove _null_ _null_ _null_ )); DATA(insert OID = 2569 ( poly_above PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ poly_above _null_ _null_ _null_ )); DATA(insert OID = 2587 ( circle_overbelow PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_ circle_overbelow _null_ _null_ _null_ )); DATA(insert OID = 2588 ( circle_overabove PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_ circle_overabove _null_ _null_ _null_ )); /* support functions for GiST r-tree emulation */ DATA(insert OID = 2578 ( gist_box_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 5 0 16 "2281 603 23 26 2281" _null_ _null_ _null_ _null_ gist_box_consistent _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 2579 ( gist_box_compress PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ gist_box_compress _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 2580 ( gist_box_decompress PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ gist_box_decompress _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 2581 ( gist_box_penalty PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ gist_box_penalty _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 2582 ( gist_box_picksplit PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ gist_box_picksplit _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 2583 ( gist_box_union PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 603 "2281 2281" _null_ _null_ _null_ _null_ gist_box_union _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 2584 ( gist_box_same PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "603 603 2281" _null_ _null_ _null_ _null_ gist_box_same _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 2585 ( gist_poly_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 5 0 16 "2281 604 23 26 2281" _null_ _null_ _null_ _null_ gist_poly_consistent _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 2586 ( gist_poly_compress PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ gist_poly_compress _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 2591 ( gist_circle_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 5 0 16 "2281 718 23 26 2281" _null_ _null_ _null_ _null_ gist_circle_consistent _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 2592 ( gist_circle_compress PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ gist_circle_compress _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 1030 ( gist_point_compress PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ gist_point_compress _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 2179 ( gist_point_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 5 0 16 "2281 600 23 26 2281" _null_ _null_ _null_ _null_ gist_point_consistent _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 3064 ( gist_point_distance PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 701 "2281 600 23 26" _null_ _null_ _null_ _null_ gist_point_distance _null_ _null_ _null_ )); DESCR("GiST support"); /* GIN */ DATA(insert OID = 2731 ( gingetbitmap PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ gingetbitmap _null_ _null_ _null_ )); DESCR("gin(internal)"); DATA(insert OID = 2732 ( gininsert PGNSP PGUID 12 1 0 0 0 f f f f t f v 6 0 16 "2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ gininsert _null_ _null_ _null_ )); DESCR("gin(internal)"); DATA(insert OID = 2733 ( ginbeginscan PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ ginbeginscan _null_ _null_ _null_ )); DESCR("gin(internal)"); DATA(insert OID = 2734 ( ginrescan PGNSP PGUID 12 1 0 0 0 f f f f t f v 5 0 2278 "2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ ginrescan _null_ _null_ _null_ )); DESCR("gin(internal)"); DATA(insert OID = 2735 ( ginendscan PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ ginendscan _null_ _null_ _null_ )); DESCR("gin(internal)"); DATA(insert OID = 2736 ( ginmarkpos PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ ginmarkpos _null_ _null_ _null_ )); DESCR("gin(internal)"); DATA(insert OID = 2737 ( ginrestrpos PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ ginrestrpos _null_ _null_ _null_ )); DESCR("gin(internal)"); DATA(insert OID = 2738 ( ginbuild PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ ginbuild _null_ _null_ _null_ )); DESCR("gin(internal)"); DATA(insert OID = 325 ( ginbuildempty PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ ginbuildempty _null_ _null_ _null_ )); DESCR("gin(internal)"); DATA(insert OID = 2739 ( ginbulkdelete PGNSP PGUID 12 1 0 0 0 f f f f t f v 4 0 2281 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ ginbulkdelete _null_ _null_ _null_ )); DESCR("gin(internal)"); DATA(insert OID = 2740 ( ginvacuumcleanup PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ ginvacuumcleanup _null_ _null_ _null_ )); DESCR("gin(internal)"); DATA(insert OID = 2741 ( gincostestimate PGNSP PGUID 12 1 0 0 0 f f f f t f v 7 0 2278 "2281 2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ gincostestimate _null_ _null_ _null_ )); DESCR("gin(internal)"); DATA(insert OID = 2788 ( ginoptions PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 17 "1009 16" _null_ _null_ _null_ _null_ ginoptions _null_ _null_ _null_ )); DESCR("gin(internal)"); /* GIN array support */ DATA(insert OID = 2743 ( ginarrayextract PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2277 2281 2281" _null_ _null_ _null_ _null_ ginarrayextract _null_ _null_ _null_ )); DESCR("GIN array support"); DATA(insert OID = 2774 ( ginqueryarrayextract PGNSP PGUID 12 1 0 0 0 f f f f t f i 7 0 2281 "2277 2281 21 2281 2281 2281 2281" _null_ _null_ _null_ _null_ ginqueryarrayextract _null_ _null_ _null_ )); DESCR("GIN array support"); DATA(insert OID = 2744 ( ginarrayconsistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 8 0 16 "2281 21 2277 23 2281 2281 2281 2281" _null_ _null_ _null_ _null_ ginarrayconsistent _null_ _null_ _null_ )); DESCR("GIN array support"); DATA(insert OID = 3076 ( ginarrayextract PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2277 2281" _null_ _null_ _null_ _null_ ginarrayextract_2args _null_ _null_ _null_ )); DESCR("GIN array support (obsolete)"); /* overlap/contains/contained */ DATA(insert OID = 2747 ( arrayoverlap PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2277 2277" _null_ _null_ _null_ _null_ arrayoverlap _null_ _null_ _null_ )); DATA(insert OID = 2748 ( arraycontains PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2277 2277" _null_ _null_ _null_ _null_ arraycontains _null_ _null_ _null_ )); DATA(insert OID = 2749 ( arraycontained PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2277 2277" _null_ _null_ _null_ _null_ arraycontained _null_ _null_ _null_ )); /* userlock replacements */ DATA(insert OID = 2880 ( pg_advisory_lock PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "20" _null_ _null_ _null_ _null_ pg_advisory_lock_int8 _null_ _null_ _null_ )); DESCR("obtain exclusive advisory lock"); DATA(insert OID = 3089 ( pg_advisory_xact_lock PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "20" _null_ _null_ _null_ _null_ pg_advisory_xact_lock_int8 _null_ _null_ _null_ )); DESCR("obtain exclusive advisory lock"); DATA(insert OID = 2881 ( pg_advisory_lock_shared PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "20" _null_ _null_ _null_ _null_ pg_advisory_lock_shared_int8 _null_ _null_ _null_ )); DESCR("obtain shared advisory lock"); DATA(insert OID = 3090 ( pg_advisory_xact_lock_shared PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "20" _null_ _null_ _null_ _null_ pg_advisory_xact_lock_shared_int8 _null_ _null_ _null_ )); DESCR("obtain shared advisory lock"); DATA(insert OID = 2882 ( pg_try_advisory_lock PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 16 "20" _null_ _null_ _null_ _null_ pg_try_advisory_lock_int8 _null_ _null_ _null_ )); DESCR("obtain exclusive advisory lock if available"); DATA(insert OID = 3091 ( pg_try_advisory_xact_lock PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 16 "20" _null_ _null_ _null_ _null_ pg_try_advisory_xact_lock_int8 _null_ _null_ _null_ )); DESCR("obtain exclusive advisory lock if available"); DATA(insert OID = 2883 ( pg_try_advisory_lock_shared PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 16 "20" _null_ _null_ _null_ _null_ pg_try_advisory_lock_shared_int8 _null_ _null_ _null_ )); DESCR("obtain shared advisory lock if available"); DATA(insert OID = 3092 ( pg_try_advisory_xact_lock_shared PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 16 "20" _null_ _null_ _null_ _null_ pg_try_advisory_xact_lock_shared_int8 _null_ _null_ _null_ )); DESCR("obtain shared advisory lock if available"); DATA(insert OID = 2884 ( pg_advisory_unlock PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 16 "20" _null_ _null_ _null_ _null_ pg_advisory_unlock_int8 _null_ _null_ _null_ )); DESCR("release exclusive advisory lock"); DATA(insert OID = 2885 ( pg_advisory_unlock_shared PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 16 "20" _null_ _null_ _null_ _null_ pg_advisory_unlock_shared_int8 _null_ _null_ _null_ )); DESCR("release shared advisory lock"); DATA(insert OID = 2886 ( pg_advisory_lock PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2278 "23 23" _null_ _null_ _null_ _null_ pg_advisory_lock_int4 _null_ _null_ _null_ )); DESCR("obtain exclusive advisory lock"); DATA(insert OID = 3093 ( pg_advisory_xact_lock PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2278 "23 23" _null_ _null_ _null_ _null_ pg_advisory_xact_lock_int4 _null_ _null_ _null_ )); DESCR("obtain exclusive advisory lock"); DATA(insert OID = 2887 ( pg_advisory_lock_shared PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2278 "23 23" _null_ _null_ _null_ _null_ pg_advisory_lock_shared_int4 _null_ _null_ _null_ )); DESCR("obtain shared advisory lock"); DATA(insert OID = 3094 ( pg_advisory_xact_lock_shared PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2278 "23 23" _null_ _null_ _null_ _null_ pg_advisory_xact_lock_shared_int4 _null_ _null_ _null_ )); DESCR("obtain shared advisory lock"); DATA(insert OID = 2888 ( pg_try_advisory_lock PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "23 23" _null_ _null_ _null_ _null_ pg_try_advisory_lock_int4 _null_ _null_ _null_ )); DESCR("obtain exclusive advisory lock if available"); DATA(insert OID = 3095 ( pg_try_advisory_xact_lock PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "23 23" _null_ _null_ _null_ _null_ pg_try_advisory_xact_lock_int4 _null_ _null_ _null_ )); DESCR("obtain exclusive advisory lock if available"); DATA(insert OID = 2889 ( pg_try_advisory_lock_shared PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "23 23" _null_ _null_ _null_ _null_ pg_try_advisory_lock_shared_int4 _null_ _null_ _null_ )); DESCR("obtain shared advisory lock if available"); DATA(insert OID = 3096 ( pg_try_advisory_xact_lock_shared PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "23 23" _null_ _null_ _null_ _null_ pg_try_advisory_xact_lock_shared_int4 _null_ _null_ _null_ )); DESCR("obtain shared advisory lock if available"); DATA(insert OID = 2890 ( pg_advisory_unlock PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "23 23" _null_ _null_ _null_ _null_ pg_advisory_unlock_int4 _null_ _null_ _null_ )); DESCR("release exclusive advisory lock"); DATA(insert OID = 2891 ( pg_advisory_unlock_shared PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "23 23" _null_ _null_ _null_ _null_ pg_advisory_unlock_shared_int4 _null_ _null_ _null_ )); DESCR("release shared advisory lock"); DATA(insert OID = 2892 ( pg_advisory_unlock_all PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2278 "" _null_ _null_ _null_ _null_ pg_advisory_unlock_all _null_ _null_ _null_ )); DESCR("release all advisory locks"); /* XML support */ DATA(insert OID = 2893 ( xml_in PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 142 "2275" _null_ _null_ _null_ _null_ xml_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2894 ( xml_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "142" _null_ _null_ _null_ _null_ xml_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2895 ( xmlcomment PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 142 "25" _null_ _null_ _null_ _null_ xmlcomment _null_ _null_ _null_ )); DESCR("generate XML comment"); DATA(insert OID = 2896 ( xml PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 142 "25" _null_ _null_ _null_ _null_ texttoxml _null_ _null_ _null_ )); DESCR("perform a non-validating parse of a character string to produce an XML value"); DATA(insert OID = 2897 ( xmlvalidate PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "142 25" _null_ _null_ _null_ _null_ xmlvalidate _null_ _null_ _null_ )); DESCR("validate an XML value"); DATA(insert OID = 2898 ( xml_recv PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 142 "2281" _null_ _null_ _null_ _null_ xml_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2899 ( xml_send PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "142" _null_ _null_ _null_ _null_ xml_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2900 ( xmlconcat2 PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 142 "142 142" _null_ _null_ _null_ _null_ xmlconcat2 _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 2901 ( xmlagg PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 142 "142" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("concatenate XML values"); DATA(insert OID = 2922 ( text PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "142" _null_ _null_ _null_ _null_ xmltotext _null_ _null_ _null_ )); DESCR("serialize an XML value to a character string"); DATA(insert OID = 2923 ( table_to_xml PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "2205 16 16 25" _null_ _null_ "{tbl,nulls,tableforest,targetns}" _null_ table_to_xml _null_ _null_ _null_ )); DESCR("map table contents to XML"); DATA(insert OID = 2924 ( query_to_xml PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "25 16 16 25" _null_ _null_ "{query,nulls,tableforest,targetns}" _null_ query_to_xml _null_ _null_ _null_ )); DESCR("map query result to XML"); DATA(insert OID = 2925 ( cursor_to_xml PGNSP PGUID 12 100 0 0 0 f f f f t f s 5 0 142 "1790 23 16 16 25" _null_ _null_ "{cursor,count,nulls,tableforest,targetns}" _null_ cursor_to_xml _null_ _null_ _null_ )); DESCR("map rows from cursor to XML"); DATA(insert OID = 2926 ( table_to_xmlschema PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "2205 16 16 25" _null_ _null_ "{tbl,nulls,tableforest,targetns}" _null_ table_to_xmlschema _null_ _null_ _null_ )); DESCR("map table structure to XML Schema"); DATA(insert OID = 2927 ( query_to_xmlschema PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "25 16 16 25" _null_ _null_ "{query,nulls,tableforest,targetns}" _null_ query_to_xmlschema _null_ _null_ _null_ )); DESCR("map query result structure to XML Schema"); DATA(insert OID = 2928 ( cursor_to_xmlschema PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "1790 16 16 25" _null_ _null_ "{cursor,nulls,tableforest,targetns}" _null_ cursor_to_xmlschema _null_ _null_ _null_ )); DESCR("map cursor structure to XML Schema"); DATA(insert OID = 2929 ( table_to_xml_and_xmlschema PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "2205 16 16 25" _null_ _null_ "{tbl,nulls,tableforest,targetns}" _null_ table_to_xml_and_xmlschema _null_ _null_ _null_ )); DESCR("map table contents and structure to XML and XML Schema"); DATA(insert OID = 2930 ( query_to_xml_and_xmlschema PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "25 16 16 25" _null_ _null_ "{query,nulls,tableforest,targetns}" _null_ query_to_xml_and_xmlschema _null_ _null_ _null_ )); DESCR("map query result and structure to XML and XML Schema"); DATA(insert OID = 2933 ( schema_to_xml PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "19 16 16 25" _null_ _null_ "{schema,nulls,tableforest,targetns}" _null_ schema_to_xml _null_ _null_ _null_ )); DESCR("map schema contents to XML"); DATA(insert OID = 2934 ( schema_to_xmlschema PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "19 16 16 25" _null_ _null_ "{schema,nulls,tableforest,targetns}" _null_ schema_to_xmlschema _null_ _null_ _null_ )); DESCR("map schema structure to XML Schema"); DATA(insert OID = 2935 ( schema_to_xml_and_xmlschema PGNSP PGUID 12 100 0 0 0 f f f f t f s 4 0 142 "19 16 16 25" _null_ _null_ "{schema,nulls,tableforest,targetns}" _null_ schema_to_xml_and_xmlschema _null_ _null_ _null_ )); DESCR("map schema contents and structure to XML and XML Schema"); DATA(insert OID = 2936 ( database_to_xml PGNSP PGUID 12 100 0 0 0 f f f f t f s 3 0 142 "16 16 25" _null_ _null_ "{nulls,tableforest,targetns}" _null_ database_to_xml _null_ _null_ _null_ )); DESCR("map database contents to XML"); DATA(insert OID = 2937 ( database_to_xmlschema PGNSP PGUID 12 100 0 0 0 f f f f t f s 3 0 142 "16 16 25" _null_ _null_ "{nulls,tableforest,targetns}" _null_ database_to_xmlschema _null_ _null_ _null_ )); DESCR("map database structure to XML Schema"); DATA(insert OID = 2938 ( database_to_xml_and_xmlschema PGNSP PGUID 12 100 0 0 0 f f f f t f s 3 0 142 "16 16 25" _null_ _null_ "{nulls,tableforest,targetns}" _null_ database_to_xml_and_xmlschema _null_ _null_ _null_ )); DESCR("map database contents and structure to XML and XML Schema"); DATA(insert OID = 2931 ( xpath PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 143 "25 142 1009" _null_ _null_ _null_ _null_ xpath _null_ _null_ _null_ )); DESCR("evaluate XPath expression, with namespaces support"); DATA(insert OID = 2932 ( xpath PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 143 "25 142" _null_ _null_ _null_ _null_ "select pg_catalog.xpath($1, $2, ''{}''::pg_catalog.text[])" _null_ _null_ _null_ )); DESCR("evaluate XPath expression"); DATA(insert OID = 2614 ( xmlexists PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "25 142" _null_ _null_ _null_ _null_ xmlexists _null_ _null_ _null_ )); DESCR("test XML value against XPath expression"); DATA(insert OID = 3049 ( xpath_exists PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 16 "25 142 1009" _null_ _null_ _null_ _null_ xpath_exists _null_ _null_ _null_ )); DESCR("test XML value against XPath expression, with namespace support"); DATA(insert OID = 3050 ( xpath_exists PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 16 "25 142" _null_ _null_ _null_ _null_ "select pg_catalog.xpath_exists($1, $2, ''{}''::pg_catalog.text[])" _null_ _null_ _null_ )); DESCR("test XML value against XPath expression"); DATA(insert OID = 3051 ( xml_is_well_formed PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "25" _null_ _null_ _null_ _null_ xml_is_well_formed _null_ _null_ _null_ )); DESCR("determine if a string is well formed XML"); DATA(insert OID = 3052 ( xml_is_well_formed_document PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "25" _null_ _null_ _null_ _null_ xml_is_well_formed_document _null_ _null_ _null_ )); DESCR("determine if a string is well formed XML document"); DATA(insert OID = 3053 ( xml_is_well_formed_content PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "25" _null_ _null_ _null_ _null_ xml_is_well_formed_content _null_ _null_ _null_ )); DESCR("determine if a string is well formed XML content"); /* json */ DATA(insert OID = 321 ( json_in PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 114 "2275" _null_ _null_ _null_ _null_ json_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 322 ( json_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "114" _null_ _null_ _null_ _null_ json_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 323 ( json_recv PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 114 "2281" _null_ _null_ _null_ _null_ json_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 324 ( json_send PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "114" _null_ _null_ _null_ _null_ json_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3153 ( array_to_json PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 114 "2277" _null_ _null_ _null_ _null_ array_to_json _null_ _null_ _null_ )); DESCR("map array to json"); DATA(insert OID = 3154 ( array_to_json PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 114 "2277 16" _null_ _null_ _null_ _null_ array_to_json_pretty _null_ _null_ _null_ )); DESCR("map array to json with optional pretty printing"); DATA(insert OID = 3155 ( row_to_json PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 114 "2249" _null_ _null_ _null_ _null_ row_to_json _null_ _null_ _null_ )); DESCR("map row to json"); DATA(insert OID = 3156 ( row_to_json PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 114 "2249 16" _null_ _null_ _null_ _null_ row_to_json_pretty _null_ _null_ _null_ )); DESCR("map row to json with optional pretty printing"); /* uuid */ DATA(insert OID = 2952 ( uuid_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2950 "2275" _null_ _null_ _null_ _null_ uuid_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2953 ( uuid_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2950" _null_ _null_ _null_ _null_ uuid_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2954 ( uuid_lt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "2950 2950" _null_ _null_ _null_ _null_ uuid_lt _null_ _null_ _null_ )); DATA(insert OID = 2955 ( uuid_le PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "2950 2950" _null_ _null_ _null_ _null_ uuid_le _null_ _null_ _null_ )); DATA(insert OID = 2956 ( uuid_eq PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "2950 2950" _null_ _null_ _null_ _null_ uuid_eq _null_ _null_ _null_ )); DATA(insert OID = 2957 ( uuid_ge PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "2950 2950" _null_ _null_ _null_ _null_ uuid_ge _null_ _null_ _null_ )); DATA(insert OID = 2958 ( uuid_gt PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "2950 2950" _null_ _null_ _null_ _null_ uuid_gt _null_ _null_ _null_ )); DATA(insert OID = 2959 ( uuid_ne PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "2950 2950" _null_ _null_ _null_ _null_ uuid_ne _null_ _null_ _null_ )); DATA(insert OID = 2960 ( uuid_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "2950 2950" _null_ _null_ _null_ _null_ uuid_cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 2961 ( uuid_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2950 "2281" _null_ _null_ _null_ _null_ uuid_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2962 ( uuid_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "2950" _null_ _null_ _null_ _null_ uuid_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2963 ( uuid_hash PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "2950" _null_ _null_ _null_ _null_ uuid_hash _null_ _null_ _null_ )); DESCR("hash"); /* enum related procs */ DATA(insert OID = 3504 ( anyenum_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3500 "2275" _null_ _null_ _null_ _null_ anyenum_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3505 ( anyenum_out PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "3500" _null_ _null_ _null_ _null_ anyenum_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3506 ( enum_in PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 3500 "2275 26" _null_ _null_ _null_ _null_ enum_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3507 ( enum_out PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "3500" _null_ _null_ _null_ _null_ enum_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3508 ( enum_eq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3500 3500" _null_ _null_ _null_ _null_ enum_eq _null_ _null_ _null_ )); DATA(insert OID = 3509 ( enum_ne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3500 3500" _null_ _null_ _null_ _null_ enum_ne _null_ _null_ _null_ )); DATA(insert OID = 3510 ( enum_lt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3500 3500" _null_ _null_ _null_ _null_ enum_lt _null_ _null_ _null_ )); DATA(insert OID = 3511 ( enum_gt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3500 3500" _null_ _null_ _null_ _null_ enum_gt _null_ _null_ _null_ )); DATA(insert OID = 3512 ( enum_le PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3500 3500" _null_ _null_ _null_ _null_ enum_le _null_ _null_ _null_ )); DATA(insert OID = 3513 ( enum_ge PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3500 3500" _null_ _null_ _null_ _null_ enum_ge _null_ _null_ _null_ )); DATA(insert OID = 3514 ( enum_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "3500 3500" _null_ _null_ _null_ _null_ enum_cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 3515 ( hashenum PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "3500" _null_ _null_ _null_ _null_ hashenum _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 3524 ( enum_smaller PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3500 "3500 3500" _null_ _null_ _null_ _null_ enum_smaller _null_ _null_ _null_ )); DESCR("smaller of two"); DATA(insert OID = 3525 ( enum_larger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3500 "3500 3500" _null_ _null_ _null_ _null_ enum_larger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 3526 ( max PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 3500 "3500" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all enum input values"); DATA(insert OID = 3527 ( min PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 3500 "3500" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all enum input values"); DATA(insert OID = 3528 ( enum_first PGNSP PGUID 12 1 0 0 0 f f f f f f s 1 0 3500 "3500" _null_ _null_ _null_ _null_ enum_first _null_ _null_ _null_ )); DESCR("first value of the input enum type"); DATA(insert OID = 3529 ( enum_last PGNSP PGUID 12 1 0 0 0 f f f f f f s 1 0 3500 "3500" _null_ _null_ _null_ _null_ enum_last _null_ _null_ _null_ )); DESCR("last value of the input enum type"); DATA(insert OID = 3530 ( enum_range PGNSP PGUID 12 1 0 0 0 f f f f f f s 2 0 2277 "3500 3500" _null_ _null_ _null_ _null_ enum_range_bounds _null_ _null_ _null_ )); DESCR("range between the two given enum values, as an ordered array"); DATA(insert OID = 3531 ( enum_range PGNSP PGUID 12 1 0 0 0 f f f f f f s 1 0 2277 "3500" _null_ _null_ _null_ _null_ enum_range_all _null_ _null_ _null_ )); DESCR("range of the given enum type, as an ordered array"); DATA(insert OID = 3532 ( enum_recv PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 3500 "2275 26" _null_ _null_ _null_ _null_ enum_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3533 ( enum_send PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "3500" _null_ _null_ _null_ _null_ enum_send _null_ _null_ _null_ )); DESCR("I/O"); /* text search stuff */ DATA(insert OID = 3610 ( tsvectorin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3614 "2275" _null_ _null_ _null_ _null_ tsvectorin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3639 ( tsvectorrecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3614 "2281" _null_ _null_ _null_ _null_ tsvectorrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3611 ( tsvectorout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "3614" _null_ _null_ _null_ _null_ tsvectorout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3638 ( tsvectorsend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "3614" _null_ _null_ _null_ _null_ tsvectorsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3612 ( tsqueryin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3615 "2275" _null_ _null_ _null_ _null_ tsqueryin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3641 ( tsqueryrecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3615 "2281" _null_ _null_ _null_ _null_ tsqueryrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3613 ( tsqueryout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "3615" _null_ _null_ _null_ _null_ tsqueryout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3640 ( tsquerysend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "3615" _null_ _null_ _null_ _null_ tsquerysend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3646 ( gtsvectorin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3642 "2275" _null_ _null_ _null_ _null_ gtsvectorin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3647 ( gtsvectorout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "3642" _null_ _null_ _null_ _null_ gtsvectorout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3616 ( tsvector_lt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3614 3614" _null_ _null_ _null_ _null_ tsvector_lt _null_ _null_ _null_ )); DATA(insert OID = 3617 ( tsvector_le PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3614 3614" _null_ _null_ _null_ _null_ tsvector_le _null_ _null_ _null_ )); DATA(insert OID = 3618 ( tsvector_eq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3614 3614" _null_ _null_ _null_ _null_ tsvector_eq _null_ _null_ _null_ )); DATA(insert OID = 3619 ( tsvector_ne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3614 3614" _null_ _null_ _null_ _null_ tsvector_ne _null_ _null_ _null_ )); DATA(insert OID = 3620 ( tsvector_ge PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3614 3614" _null_ _null_ _null_ _null_ tsvector_ge _null_ _null_ _null_ )); DATA(insert OID = 3621 ( tsvector_gt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3614 3614" _null_ _null_ _null_ _null_ tsvector_gt _null_ _null_ _null_ )); DATA(insert OID = 3622 ( tsvector_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "3614 3614" _null_ _null_ _null_ _null_ tsvector_cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 3711 ( length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "3614" _null_ _null_ _null_ _null_ tsvector_length _null_ _null_ _null_ )); DESCR("number of lexemes"); DATA(insert OID = 3623 ( strip PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3614 "3614" _null_ _null_ _null_ _null_ tsvector_strip _null_ _null_ _null_ )); DESCR("strip position information"); DATA(insert OID = 3624 ( setweight PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3614 "3614 18" _null_ _null_ _null_ _null_ tsvector_setweight _null_ _null_ _null_ )); DESCR("set weight of lexeme's entries"); DATA(insert OID = 3625 ( tsvector_concat PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3614 "3614 3614" _null_ _null_ _null_ _null_ tsvector_concat _null_ _null_ _null_ )); DATA(insert OID = 3634 ( ts_match_vq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3614 3615" _null_ _null_ _null_ _null_ ts_match_vq _null_ _null_ _null_ )); DATA(insert OID = 3635 ( ts_match_qv PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3615 3614" _null_ _null_ _null_ _null_ ts_match_qv _null_ _null_ _null_ )); DATA(insert OID = 3760 ( ts_match_tt PGNSP PGUID 12 3 0 0 0 f f f f t f s 2 0 16 "25 25" _null_ _null_ _null_ _null_ ts_match_tt _null_ _null_ _null_ )); DATA(insert OID = 3761 ( ts_match_tq PGNSP PGUID 12 2 0 0 0 f f f f t f s 2 0 16 "25 3615" _null_ _null_ _null_ _null_ ts_match_tq _null_ _null_ _null_ )); DATA(insert OID = 3648 ( gtsvector_compress PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ gtsvector_compress _null_ _null_ _null_ )); DESCR("GiST tsvector support"); DATA(insert OID = 3649 ( gtsvector_decompress PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ gtsvector_decompress _null_ _null_ _null_ )); DESCR("GiST tsvector support"); DATA(insert OID = 3650 ( gtsvector_picksplit PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ gtsvector_picksplit _null_ _null_ _null_ )); DESCR("GiST tsvector support"); DATA(insert OID = 3651 ( gtsvector_union PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ gtsvector_union _null_ _null_ _null_ )); DESCR("GiST tsvector support"); DATA(insert OID = 3652 ( gtsvector_same PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "3642 3642 2281" _null_ _null_ _null_ _null_ gtsvector_same _null_ _null_ _null_ )); DESCR("GiST tsvector support"); DATA(insert OID = 3653 ( gtsvector_penalty PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ gtsvector_penalty _null_ _null_ _null_ )); DESCR("GiST tsvector support"); DATA(insert OID = 3654 ( gtsvector_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 5 0 16 "2281 3642 23 26 2281" _null_ _null_ _null_ _null_ gtsvector_consistent _null_ _null_ _null_ )); DESCR("GiST tsvector support"); DATA(insert OID = 3656 ( gin_extract_tsvector PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "3614 2281 2281" _null_ _null_ _null_ _null_ gin_extract_tsvector _null_ _null_ _null_ )); DESCR("GIN tsvector support"); DATA(insert OID = 3657 ( gin_extract_tsquery PGNSP PGUID 12 1 0 0 0 f f f f t f i 7 0 2281 "3615 2281 21 2281 2281 2281 2281" _null_ _null_ _null_ _null_ gin_extract_tsquery _null_ _null_ _null_ )); DESCR("GIN tsvector support"); DATA(insert OID = 3658 ( gin_tsquery_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 8 0 16 "2281 21 3615 23 2281 2281 2281 2281" _null_ _null_ _null_ _null_ gin_tsquery_consistent _null_ _null_ _null_ )); DESCR("GIN tsvector support"); DATA(insert OID = 3724 ( gin_cmp_tslexeme PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "25 25" _null_ _null_ _null_ _null_ gin_cmp_tslexeme _null_ _null_ _null_ )); DESCR("GIN tsvector support"); DATA(insert OID = 2700 ( gin_cmp_prefix PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 23 "25 25 21 2281" _null_ _null_ _null_ _null_ gin_cmp_prefix _null_ _null_ _null_ )); DESCR("GIN tsvector support"); DATA(insert OID = 3077 ( gin_extract_tsvector PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "3614 2281" _null_ _null_ _null_ _null_ gin_extract_tsvector_2args _null_ _null_ _null_ )); DESCR("GIN tsvector support (obsolete)"); DATA(insert OID = 3087 ( gin_extract_tsquery PGNSP PGUID 12 1 0 0 0 f f f f t f i 5 0 2281 "3615 2281 21 2281 2281" _null_ _null_ _null_ _null_ gin_extract_tsquery_5args _null_ _null_ _null_ )); DESCR("GIN tsvector support (obsolete)"); DATA(insert OID = 3088 ( gin_tsquery_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 6 0 16 "2281 21 3615 23 2281 2281" _null_ _null_ _null_ _null_ gin_tsquery_consistent_6args _null_ _null_ _null_ )); DESCR("GIN tsvector support (obsolete)"); DATA(insert OID = 3662 ( tsquery_lt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3615 3615" _null_ _null_ _null_ _null_ tsquery_lt _null_ _null_ _null_ )); DATA(insert OID = 3663 ( tsquery_le PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3615 3615" _null_ _null_ _null_ _null_ tsquery_le _null_ _null_ _null_ )); DATA(insert OID = 3664 ( tsquery_eq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3615 3615" _null_ _null_ _null_ _null_ tsquery_eq _null_ _null_ _null_ )); DATA(insert OID = 3665 ( tsquery_ne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3615 3615" _null_ _null_ _null_ _null_ tsquery_ne _null_ _null_ _null_ )); DATA(insert OID = 3666 ( tsquery_ge PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3615 3615" _null_ _null_ _null_ _null_ tsquery_ge _null_ _null_ _null_ )); DATA(insert OID = 3667 ( tsquery_gt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3615 3615" _null_ _null_ _null_ _null_ tsquery_gt _null_ _null_ _null_ )); DATA(insert OID = 3668 ( tsquery_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "3615 3615" _null_ _null_ _null_ _null_ tsquery_cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 3669 ( tsquery_and PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3615 "3615 3615" _null_ _null_ _null_ _null_ tsquery_and _null_ _null_ _null_ )); DATA(insert OID = 3670 ( tsquery_or PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3615 "3615 3615" _null_ _null_ _null_ _null_ tsquery_or _null_ _null_ _null_ )); DATA(insert OID = 3671 ( tsquery_not PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3615 "3615" _null_ _null_ _null_ _null_ tsquery_not _null_ _null_ _null_ )); DATA(insert OID = 3691 ( tsq_mcontains PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3615 3615" _null_ _null_ _null_ _null_ tsq_mcontains _null_ _null_ _null_ )); DATA(insert OID = 3692 ( tsq_mcontained PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3615 3615" _null_ _null_ _null_ _null_ tsq_mcontained _null_ _null_ _null_ )); DATA(insert OID = 3672 ( numnode PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "3615" _null_ _null_ _null_ _null_ tsquery_numnode _null_ _null_ _null_ )); DESCR("number of nodes"); DATA(insert OID = 3673 ( querytree PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "3615" _null_ _null_ _null_ _null_ tsquerytree _null_ _null_ _null_ )); DESCR("show real useful query for GiST index"); DATA(insert OID = 3684 ( ts_rewrite PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 3615 "3615 3615 3615" _null_ _null_ _null_ _null_ tsquery_rewrite _null_ _null_ _null_ )); DESCR("rewrite tsquery"); DATA(insert OID = 3685 ( ts_rewrite PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 3615 "3615 25" _null_ _null_ _null_ _null_ tsquery_rewrite_query _null_ _null_ _null_ )); DESCR("rewrite tsquery"); DATA(insert OID = 3695 ( gtsquery_compress PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ gtsquery_compress _null_ _null_ _null_ )); DESCR("GiST tsquery support"); DATA(insert OID = 3696 ( gtsquery_decompress PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ gtsquery_decompress _null_ _null_ _null_ )); DESCR("GiST tsquery support"); DATA(insert OID = 3697 ( gtsquery_picksplit PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ gtsquery_picksplit _null_ _null_ _null_ )); DESCR("GiST tsquery support"); DATA(insert OID = 3698 ( gtsquery_union PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ gtsquery_union _null_ _null_ _null_ )); DESCR("GiST tsquery support"); DATA(insert OID = 3699 ( gtsquery_same PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "20 20 2281" _null_ _null_ _null_ _null_ gtsquery_same _null_ _null_ _null_ )); DESCR("GiST tsquery support"); DATA(insert OID = 3700 ( gtsquery_penalty PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ gtsquery_penalty _null_ _null_ _null_ )); DESCR("GiST tsquery support"); DATA(insert OID = 3701 ( gtsquery_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 5 0 16 "2281 2281 23 26 2281" _null_ _null_ _null_ _null_ gtsquery_consistent _null_ _null_ _null_ )); DESCR("GiST tsquery support"); DATA(insert OID = 3686 ( tsmatchsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ tsmatchsel _null_ _null_ _null_ )); DESCR("restriction selectivity of tsvector @@ tsquery"); DATA(insert OID = 3687 ( tsmatchjoinsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ tsmatchjoinsel _null_ _null_ _null_ )); DESCR("join selectivity of tsvector @@ tsquery"); DATA(insert OID = 3688 ( ts_typanalyze PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "2281" _null_ _null_ _null_ _null_ ts_typanalyze _null_ _null_ _null_ )); DESCR("tsvector typanalyze"); DATA(insert OID = 3689 ( ts_stat PGNSP PGUID 12 10 10000 0 0 f f f f t t v 1 0 2249 "25" "{25,25,23,23}" "{i,o,o,o}" "{query,word,ndoc,nentry}" _null_ ts_stat1 _null_ _null_ _null_ )); DESCR("statistics of tsvector column"); DATA(insert OID = 3690 ( ts_stat PGNSP PGUID 12 10 10000 0 0 f f f f t t v 2 0 2249 "25 25" "{25,25,25,23,23}" "{i,i,o,o,o}" "{query,weights,word,ndoc,nentry}" _null_ ts_stat2 _null_ _null_ _null_ )); DESCR("statistics of tsvector column"); DATA(insert OID = 3703 ( ts_rank PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 700 "1021 3614 3615 23" _null_ _null_ _null_ _null_ ts_rank_wttf _null_ _null_ _null_ )); DESCR("relevance"); DATA(insert OID = 3704 ( ts_rank PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 700 "1021 3614 3615" _null_ _null_ _null_ _null_ ts_rank_wtt _null_ _null_ _null_ )); DESCR("relevance"); DATA(insert OID = 3705 ( ts_rank PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 700 "3614 3615 23" _null_ _null_ _null_ _null_ ts_rank_ttf _null_ _null_ _null_ )); DESCR("relevance"); DATA(insert OID = 3706 ( ts_rank PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 700 "3614 3615" _null_ _null_ _null_ _null_ ts_rank_tt _null_ _null_ _null_ )); DESCR("relevance"); DATA(insert OID = 3707 ( ts_rank_cd PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 700 "1021 3614 3615 23" _null_ _null_ _null_ _null_ ts_rankcd_wttf _null_ _null_ _null_ )); DESCR("relevance"); DATA(insert OID = 3708 ( ts_rank_cd PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 700 "1021 3614 3615" _null_ _null_ _null_ _null_ ts_rankcd_wtt _null_ _null_ _null_ )); DESCR("relevance"); DATA(insert OID = 3709 ( ts_rank_cd PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 700 "3614 3615 23" _null_ _null_ _null_ _null_ ts_rankcd_ttf _null_ _null_ _null_ )); DESCR("relevance"); DATA(insert OID = 3710 ( ts_rank_cd PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 700 "3614 3615" _null_ _null_ _null_ _null_ ts_rankcd_tt _null_ _null_ _null_ )); DESCR("relevance"); DATA(insert OID = 3713 ( ts_token_type PGNSP PGUID 12 1 16 0 0 f f f f t t i 1 0 2249 "26" "{26,23,25,25}" "{i,o,o,o}" "{parser_oid,tokid,alias,description}" _null_ ts_token_type_byid _null_ _null_ _null_ )); DESCR("get parser's token types"); DATA(insert OID = 3714 ( ts_token_type PGNSP PGUID 12 1 16 0 0 f f f f t t s 1 0 2249 "25" "{25,23,25,25}" "{i,o,o,o}" "{parser_name,tokid,alias,description}" _null_ ts_token_type_byname _null_ _null_ _null_ )); DESCR("get parser's token types"); DATA(insert OID = 3715 ( ts_parse PGNSP PGUID 12 1 1000 0 0 f f f f t t i 2 0 2249 "26 25" "{26,25,23,25}" "{i,i,o,o}" "{parser_oid,txt,tokid,token}" _null_ ts_parse_byid _null_ _null_ _null_ )); DESCR("parse text to tokens"); DATA(insert OID = 3716 ( ts_parse PGNSP PGUID 12 1 1000 0 0 f f f f t t s 2 0 2249 "25 25" "{25,25,23,25}" "{i,i,o,o}" "{parser_name,txt,tokid,token}" _null_ ts_parse_byname _null_ _null_ _null_ )); DESCR("parse text to tokens"); DATA(insert OID = 3717 ( prsd_start PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 23" _null_ _null_ _null_ _null_ prsd_start _null_ _null_ _null_ )); DESCR("(internal)"); DATA(insert OID = 3718 ( prsd_nexttoken PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ prsd_nexttoken _null_ _null_ _null_ )); DESCR("(internal)"); DATA(insert OID = 3719 ( prsd_end PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2278 "2281" _null_ _null_ _null_ _null_ prsd_end _null_ _null_ _null_ )); DESCR("(internal)"); DATA(insert OID = 3720 ( prsd_headline PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2281 2281 3615" _null_ _null_ _null_ _null_ prsd_headline _null_ _null_ _null_ )); DESCR("(internal)"); DATA(insert OID = 3721 ( prsd_lextype PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ prsd_lextype _null_ _null_ _null_ )); DESCR("(internal)"); DATA(insert OID = 3723 ( ts_lexize PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1009 "3769 25" _null_ _null_ _null_ _null_ ts_lexize _null_ _null_ _null_ )); DESCR("normalize one word by dictionary"); DATA(insert OID = 3725 ( dsimple_init PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ dsimple_init _null_ _null_ _null_ )); DESCR("(internal)"); DATA(insert OID = 3726 ( dsimple_lexize PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 2281 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ dsimple_lexize _null_ _null_ _null_ )); DESCR("(internal)"); DATA(insert OID = 3728 ( dsynonym_init PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ dsynonym_init _null_ _null_ _null_ )); DESCR("(internal)"); DATA(insert OID = 3729 ( dsynonym_lexize PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 2281 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ dsynonym_lexize _null_ _null_ _null_ )); DESCR("(internal)"); DATA(insert OID = 3731 ( dispell_init PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ dispell_init _null_ _null_ _null_ )); DESCR("(internal)"); DATA(insert OID = 3732 ( dispell_lexize PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 2281 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ dispell_lexize _null_ _null_ _null_ )); DESCR("(internal)"); DATA(insert OID = 3740 ( thesaurus_init PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ thesaurus_init _null_ _null_ _null_ )); DESCR("(internal)"); DATA(insert OID = 3741 ( thesaurus_lexize PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 2281 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ thesaurus_lexize _null_ _null_ _null_ )); DESCR("(internal)"); DATA(insert OID = 3743 ( ts_headline PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 25 "3734 25 3615 25" _null_ _null_ _null_ _null_ ts_headline_byid_opt _null_ _null_ _null_ )); DESCR("generate headline"); DATA(insert OID = 3744 ( ts_headline PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 25 "3734 25 3615" _null_ _null_ _null_ _null_ ts_headline_byid _null_ _null_ _null_ )); DESCR("generate headline"); DATA(insert OID = 3754 ( ts_headline PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 25 "25 3615 25" _null_ _null_ _null_ _null_ ts_headline_opt _null_ _null_ _null_ )); DESCR("generate headline"); DATA(insert OID = 3755 ( ts_headline PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "25 3615" _null_ _null_ _null_ _null_ ts_headline _null_ _null_ _null_ )); DESCR("generate headline"); DATA(insert OID = 3745 ( to_tsvector PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3614 "3734 25" _null_ _null_ _null_ _null_ to_tsvector_byid _null_ _null_ _null_ )); DESCR("transform to tsvector"); DATA(insert OID = 3746 ( to_tsquery PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3615 "3734 25" _null_ _null_ _null_ _null_ to_tsquery_byid _null_ _null_ _null_ )); DESCR("make tsquery"); DATA(insert OID = 3747 ( plainto_tsquery PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3615 "3734 25" _null_ _null_ _null_ _null_ plainto_tsquery_byid _null_ _null_ _null_ )); DESCR("transform to tsquery"); DATA(insert OID = 3749 ( to_tsvector PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 3614 "25" _null_ _null_ _null_ _null_ to_tsvector _null_ _null_ _null_ )); DESCR("transform to tsvector"); DATA(insert OID = 3750 ( to_tsquery PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 3615 "25" _null_ _null_ _null_ _null_ to_tsquery _null_ _null_ _null_ )); DESCR("make tsquery"); DATA(insert OID = 3751 ( plainto_tsquery PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 3615 "25" _null_ _null_ _null_ _null_ plainto_tsquery _null_ _null_ _null_ )); DESCR("transform to tsquery"); DATA(insert OID = 3752 ( tsvector_update_trigger PGNSP PGUID 12 1 0 0 0 f f f f f f v 0 0 2279 "" _null_ _null_ _null_ _null_ tsvector_update_trigger_byid _null_ _null_ _null_ )); DESCR("trigger for automatic update of tsvector column"); DATA(insert OID = 3753 ( tsvector_update_trigger_column PGNSP PGUID 12 1 0 0 0 f f f f f f v 0 0 2279 "" _null_ _null_ _null_ _null_ tsvector_update_trigger_bycolumn _null_ _null_ _null_ )); DESCR("trigger for automatic update of tsvector column"); DATA(insert OID = 3759 ( get_current_ts_config PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 3734 "" _null_ _null_ _null_ _null_ get_current_ts_config _null_ _null_ _null_ )); DESCR("get current tsearch configuration"); DATA(insert OID = 3736 ( regconfigin PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 3734 "2275" _null_ _null_ _null_ _null_ regconfigin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3737 ( regconfigout PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "3734" _null_ _null_ _null_ _null_ regconfigout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3738 ( regconfigrecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3734 "2281" _null_ _null_ _null_ _null_ regconfigrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3739 ( regconfigsend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "3734" _null_ _null_ _null_ _null_ regconfigsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3771 ( regdictionaryin PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 3769 "2275" _null_ _null_ _null_ _null_ regdictionaryin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3772 ( regdictionaryout PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "3769" _null_ _null_ _null_ _null_ regdictionaryout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3773 ( regdictionaryrecv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3769 "2281" _null_ _null_ _null_ _null_ regdictionaryrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3774 ( regdictionarysend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "3769" _null_ _null_ _null_ _null_ regdictionarysend _null_ _null_ _null_ )); DESCR("I/O"); /* txid */ DATA(insert OID = 2939 ( txid_snapshot_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2970 "2275" _null_ _null_ _null_ _null_ txid_snapshot_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2940 ( txid_snapshot_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2970" _null_ _null_ _null_ _null_ txid_snapshot_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2941 ( txid_snapshot_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2970 "2281" _null_ _null_ _null_ _null_ txid_snapshot_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2942 ( txid_snapshot_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "2970" _null_ _null_ _null_ _null_ txid_snapshot_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2943 ( txid_current PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ txid_current _null_ _null_ _null_ )); DESCR("get current transaction ID"); DATA(insert OID = 2944 ( txid_current_snapshot PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 2970 "" _null_ _null_ _null_ _null_ txid_current_snapshot _null_ _null_ _null_ )); DESCR("get current snapshot"); DATA(insert OID = 2945 ( txid_snapshot_xmin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "2970" _null_ _null_ _null_ _null_ txid_snapshot_xmin _null_ _null_ _null_ )); DESCR("get xmin of snapshot"); DATA(insert OID = 2946 ( txid_snapshot_xmax PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "2970" _null_ _null_ _null_ _null_ txid_snapshot_xmax _null_ _null_ _null_ )); DESCR("get xmax of snapshot"); DATA(insert OID = 2947 ( txid_snapshot_xip PGNSP PGUID 12 1 50 0 0 f f f f t t i 1 0 20 "2970" _null_ _null_ _null_ _null_ txid_snapshot_xip _null_ _null_ _null_ )); DESCR("get set of in-progress txids in snapshot"); DATA(insert OID = 2948 ( txid_visible_in_snapshot PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "20 2970" _null_ _null_ _null_ _null_ txid_visible_in_snapshot _null_ _null_ _null_ )); DESCR("is txid visible in snapshot?"); /* record comparison */ DATA(insert OID = 2981 ( record_eq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ record_eq _null_ _null_ _null_ )); DATA(insert OID = 2982 ( record_ne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ record_ne _null_ _null_ _null_ )); DATA(insert OID = 2983 ( record_lt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ record_lt _null_ _null_ _null_ )); DATA(insert OID = 2984 ( record_gt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ record_gt _null_ _null_ _null_ )); DATA(insert OID = 2985 ( record_le PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ record_le _null_ _null_ _null_ )); DATA(insert OID = 2986 ( record_ge PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ record_ge _null_ _null_ _null_ )); DATA(insert OID = 2987 ( btrecordcmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "2249 2249" _null_ _null_ _null_ _null_ btrecordcmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); /* Extensions */ DATA(insert OID = 3082 ( pg_available_extensions PGNSP PGUID 12 10 100 0 0 f f f f t t s 0 0 2249 "" "{19,25,25}" "{o,o,o}" "{name,default_version,comment}" _null_ pg_available_extensions _null_ _null_ _null_ )); DESCR("list available extensions"); DATA(insert OID = 3083 ( pg_available_extension_versions PGNSP PGUID 12 10 100 0 0 f f f f t t s 0 0 2249 "" "{19,25,16,16,19,1003,25}" "{o,o,o,o,o,o,o}" "{name,version,superuser,relocatable,schema,requires,comment}" _null_ pg_available_extension_versions _null_ _null_ _null_ )); DESCR("list available extension versions"); DATA(insert OID = 3084 ( pg_extension_update_paths PGNSP PGUID 12 10 100 0 0 f f f f t t s 1 0 2249 "19" "{19,25,25,25}" "{i,o,o,o}" "{name,source,target,path}" _null_ pg_extension_update_paths _null_ _null_ _null_ )); DESCR("list an extension's version update paths"); DATA(insert OID = 3086 ( pg_extension_config_dump PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2278 "2205 25" _null_ _null_ _null_ _null_ pg_extension_config_dump _null_ _null_ _null_ )); DESCR("flag an extension's table contents to be emitted by pg_dump"); /* SQL-spec window functions */ DATA(insert OID = 3100 ( row_number PGNSP PGUID 12 1 0 0 0 f t f f f f i 0 0 20 "" _null_ _null_ _null_ _null_ window_row_number _null_ _null_ _null_ )); DESCR("row number within partition"); DATA(insert OID = 3101 ( rank PGNSP PGUID 12 1 0 0 0 f t f f f f i 0 0 20 "" _null_ _null_ _null_ _null_ window_rank _null_ _null_ _null_ )); DESCR("integer rank with gaps"); DATA(insert OID = 3102 ( dense_rank PGNSP PGUID 12 1 0 0 0 f t f f f f i 0 0 20 "" _null_ _null_ _null_ _null_ window_dense_rank _null_ _null_ _null_ )); DESCR("integer rank without gaps"); DATA(insert OID = 3103 ( percent_rank PGNSP PGUID 12 1 0 0 0 f t f f f f i 0 0 701 "" _null_ _null_ _null_ _null_ window_percent_rank _null_ _null_ _null_ )); DESCR("fractional rank within partition"); DATA(insert OID = 3104 ( cume_dist PGNSP PGUID 12 1 0 0 0 f t f f f f i 0 0 701 "" _null_ _null_ _null_ _null_ window_cume_dist _null_ _null_ _null_ )); DESCR("fractional row number within partition"); DATA(insert OID = 3105 ( ntile PGNSP PGUID 12 1 0 0 0 f t f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ window_ntile _null_ _null_ _null_ )); DESCR("split rows into N groups"); DATA(insert OID = 3106 ( lag PGNSP PGUID 12 1 0 0 0 f t f f t f i 1 0 2283 "2283" _null_ _null_ _null_ _null_ window_lag _null_ _null_ _null_ )); DESCR("fetch the preceding row value"); DATA(insert OID = 3107 ( lag PGNSP PGUID 12 1 0 0 0 f t f f t f i 2 0 2283 "2283 23" _null_ _null_ _null_ _null_ window_lag_with_offset _null_ _null_ _null_ )); DESCR("fetch the Nth preceding row value"); DATA(insert OID = 3108 ( lag PGNSP PGUID 12 1 0 0 0 f t f f t f i 3 0 2283 "2283 23 2283" _null_ _null_ _null_ _null_ window_lag_with_offset_and_default _null_ _null_ _null_ )); DESCR("fetch the Nth preceding row value with default"); DATA(insert OID = 3109 ( lead PGNSP PGUID 12 1 0 0 0 f t f f t f i 1 0 2283 "2283" _null_ _null_ _null_ _null_ window_lead _null_ _null_ _null_ )); DESCR("fetch the following row value"); DATA(insert OID = 3110 ( lead PGNSP PGUID 12 1 0 0 0 f t f f t f i 2 0 2283 "2283 23" _null_ _null_ _null_ _null_ window_lead_with_offset _null_ _null_ _null_ )); DESCR("fetch the Nth following row value"); DATA(insert OID = 3111 ( lead PGNSP PGUID 12 1 0 0 0 f t f f t f i 3 0 2283 "2283 23 2283" _null_ _null_ _null_ _null_ window_lead_with_offset_and_default _null_ _null_ _null_ )); DESCR("fetch the Nth following row value with default"); DATA(insert OID = 3112 ( first_value PGNSP PGUID 12 1 0 0 0 f t f f t f i 1 0 2283 "2283" _null_ _null_ _null_ _null_ window_first_value _null_ _null_ _null_ )); DESCR("fetch the first row value"); DATA(insert OID = 3113 ( last_value PGNSP PGUID 12 1 0 0 0 f t f f t f i 1 0 2283 "2283" _null_ _null_ _null_ _null_ window_last_value _null_ _null_ _null_ )); DESCR("fetch the last row value"); DATA(insert OID = 3114 ( nth_value PGNSP PGUID 12 1 0 0 0 f t f f t f i 2 0 2283 "2283 23" _null_ _null_ _null_ _null_ window_nth_value _null_ _null_ _null_ )); DESCR("fetch the Nth row value"); /* functions for range types */ DATA(insert OID = 3832 ( anyrange_in PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 3831 "2275 26 23" _null_ _null_ _null_ _null_ anyrange_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3833 ( anyrange_out PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "3831" _null_ _null_ _null_ _null_ anyrange_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3834 ( range_in PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 3831 "2275 26 23" _null_ _null_ _null_ _null_ range_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3835 ( range_out PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "3831" _null_ _null_ _null_ _null_ range_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3836 ( range_recv PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 3831 "2281 26 23" _null_ _null_ _null_ _null_ range_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3837 ( range_send PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "3831" _null_ _null_ _null_ _null_ range_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3848 ( lower PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2283 "3831" _null_ _null_ _null_ _null_ range_lower _null_ _null_ _null_ )); DESCR("lower bound of range"); DATA(insert OID = 3849 ( upper PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2283 "3831" _null_ _null_ _null_ _null_ range_upper _null_ _null_ _null_ )); DESCR("upper bound of range"); DATA(insert OID = 3850 ( isempty PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "3831" _null_ _null_ _null_ _null_ range_empty _null_ _null_ _null_ )); DESCR("is the range empty?"); DATA(insert OID = 3851 ( lower_inc PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "3831" _null_ _null_ _null_ _null_ range_lower_inc _null_ _null_ _null_ )); DESCR("is the range's lower bound inclusive?"); DATA(insert OID = 3852 ( upper_inc PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "3831" _null_ _null_ _null_ _null_ range_upper_inc _null_ _null_ _null_ )); DESCR("is the range's upper bound inclusive?"); DATA(insert OID = 3853 ( lower_inf PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "3831" _null_ _null_ _null_ _null_ range_lower_inf _null_ _null_ _null_ )); DESCR("is the range's lower bound infinite?"); DATA(insert OID = 3854 ( upper_inf PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "3831" _null_ _null_ _null_ _null_ range_upper_inf _null_ _null_ _null_ )); DESCR("is the range's upper bound infinite?"); DATA(insert OID = 3855 ( range_eq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ range_eq _null_ _null_ _null_ )); DESCR("implementation of = operator"); DATA(insert OID = 3856 ( range_ne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ range_ne _null_ _null_ _null_ )); DESCR("implementation of <> operator"); DATA(insert OID = 3857 ( range_overlaps PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ range_overlaps _null_ _null_ _null_ )); DESCR("implementation of && operator"); DATA(insert OID = 3858 ( range_contains_elem PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 2283" _null_ _null_ _null_ _null_ range_contains_elem _null_ _null_ _null_ )); DESCR("implementation of @> operator"); DATA(insert OID = 3859 ( range_contains PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ range_contains _null_ _null_ _null_ )); DESCR("implementation of @> operator"); DATA(insert OID = 3860 ( elem_contained_by_range PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2283 3831" _null_ _null_ _null_ _null_ elem_contained_by_range _null_ _null_ _null_ )); DESCR("implementation of <@ operator"); DATA(insert OID = 3861 ( range_contained_by PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ range_contained_by _null_ _null_ _null_ )); DESCR("implementation of <@ operator"); DATA(insert OID = 3862 ( range_adjacent PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ range_adjacent _null_ _null_ _null_ )); DESCR("implementation of -|- operator"); DATA(insert OID = 3863 ( range_before PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ range_before _null_ _null_ _null_ )); DESCR("implementation of << operator"); DATA(insert OID = 3864 ( range_after PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ range_after _null_ _null_ _null_ )); DESCR("implementation of >> operator"); DATA(insert OID = 3865 ( range_overleft PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ range_overleft _null_ _null_ _null_ )); DESCR("implementation of &< operator"); DATA(insert OID = 3866 ( range_overright PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ range_overright _null_ _null_ _null_ )); DESCR("implementation of &> operator"); DATA(insert OID = 3867 ( range_union PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3831 "3831 3831" _null_ _null_ _null_ _null_ range_union _null_ _null_ _null_ )); DESCR("implementation of + operator"); DATA(insert OID = 3868 ( range_intersect PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3831 "3831 3831" _null_ _null_ _null_ _null_ range_intersect _null_ _null_ _null_ )); DESCR("implementation of * operator"); DATA(insert OID = 3869 ( range_minus PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3831 "3831 3831" _null_ _null_ _null_ _null_ range_minus _null_ _null_ _null_ )); DESCR("implementation of - operator"); DATA(insert OID = 3870 ( range_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "3831 3831" _null_ _null_ _null_ _null_ range_cmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); DATA(insert OID = 3871 ( range_lt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ range_lt _null_ _null_ _null_ )); DATA(insert OID = 3872 ( range_le PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ range_le _null_ _null_ _null_ )); DATA(insert OID = 3873 ( range_ge PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ range_ge _null_ _null_ _null_ )); DATA(insert OID = 3874 ( range_gt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ range_gt _null_ _null_ _null_ )); DATA(insert OID = 3875 ( range_gist_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 5 0 16 "2281 3831 23 26 2281" _null_ _null_ _null_ _null_ range_gist_consistent _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 3876 ( range_gist_union PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ range_gist_union _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 3877 ( range_gist_compress PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ range_gist_compress _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 3878 ( range_gist_decompress PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ range_gist_decompress _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 3879 ( range_gist_penalty PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ range_gist_penalty _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 3880 ( range_gist_picksplit PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ range_gist_picksplit _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 3881 ( range_gist_same PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "3831 3831 2281" _null_ _null_ _null_ _null_ range_gist_same _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 3902 ( hash_range PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "3831" _null_ _null_ _null_ _null_ hash_range _null_ _null_ _null_ )); DESCR("hash a range"); DATA(insert OID = 3916 ( range_typanalyze PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "2281" _null_ _null_ _null_ _null_ range_typanalyze _null_ _null_ _null_ )); DESCR("range typanalyze"); DATA(insert OID = 3914 ( int4range_canonical PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3904 "3904" _null_ _null_ _null_ _null_ int4range_canonical _null_ _null_ _null_ )); DESCR("convert an int4 range to canonical form"); DATA(insert OID = 3928 ( int8range_canonical PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3926 "3926" _null_ _null_ _null_ _null_ int8range_canonical _null_ _null_ _null_ )); DESCR("convert an int8 range to canonical form"); DATA(insert OID = 3915 ( daterange_canonical PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3912 "3912" _null_ _null_ _null_ _null_ daterange_canonical _null_ _null_ _null_ )); DESCR("convert a date range to canonical form"); DATA(insert OID = 3922 ( int4range_subdiff PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "23 23" _null_ _null_ _null_ _null_ int4range_subdiff _null_ _null_ _null_ )); DESCR("float8 difference of two int4 values"); DATA(insert OID = 3923 ( int8range_subdiff PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "20 20" _null_ _null_ _null_ _null_ int8range_subdiff _null_ _null_ _null_ )); DESCR("float8 difference of two int8 values"); DATA(insert OID = 3924 ( numrange_subdiff PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "1700 1700" _null_ _null_ _null_ _null_ numrange_subdiff _null_ _null_ _null_ )); DESCR("float8 difference of two numeric values"); DATA(insert OID = 3925 ( daterange_subdiff PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "1082 1082" _null_ _null_ _null_ _null_ daterange_subdiff _null_ _null_ _null_ )); DESCR("float8 difference of two date values"); DATA(insert OID = 3929 ( tsrange_subdiff PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "1114 1114" _null_ _null_ _null_ _null_ tsrange_subdiff _null_ _null_ _null_ )); DESCR("float8 difference of two timestamp values"); DATA(insert OID = 3930 ( tstzrange_subdiff PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 701 "1184 1184" _null_ _null_ _null_ _null_ tstzrange_subdiff _null_ _null_ _null_ )); DESCR("float8 difference of two timestamp with time zone values"); DATA(insert OID = 3840 ( int4range PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 3904 "23 23" _null_ _null_ _null_ _null_ range_constructor2 _null_ _null_ _null_ )); DESCR("int4range constructor"); DATA(insert OID = 3841 ( int4range PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 3904 "23 23 25" _null_ _null_ _null_ _null_ range_constructor3 _null_ _null_ _null_ )); DESCR("int4range constructor"); DATA(insert OID = 3844 ( numrange PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 3906 "1700 1700" _null_ _null_ _null_ _null_ range_constructor2 _null_ _null_ _null_ )); DESCR("numrange constructor"); DATA(insert OID = 3845 ( numrange PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 3906 "1700 1700 25" _null_ _null_ _null_ _null_ range_constructor3 _null_ _null_ _null_ )); DESCR("numrange constructor"); DATA(insert OID = 3933 ( tsrange PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 3908 "1114 1114" _null_ _null_ _null_ _null_ range_constructor2 _null_ _null_ _null_ )); DESCR("tsrange constructor"); DATA(insert OID = 3934 ( tsrange PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 3908 "1114 1114 25" _null_ _null_ _null_ _null_ range_constructor3 _null_ _null_ _null_ )); DESCR("tsrange constructor"); DATA(insert OID = 3937 ( tstzrange PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 3910 "1184 1184" _null_ _null_ _null_ _null_ range_constructor2 _null_ _null_ _null_ )); DESCR("tstzrange constructor"); DATA(insert OID = 3938 ( tstzrange PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 3910 "1184 1184 25" _null_ _null_ _null_ _null_ range_constructor3 _null_ _null_ _null_ )); DESCR("tstzrange constructor"); DATA(insert OID = 3941 ( daterange PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 3912 "1082 1082" _null_ _null_ _null_ _null_ range_constructor2 _null_ _null_ _null_ )); DESCR("daterange constructor"); DATA(insert OID = 3942 ( daterange PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 3912 "1082 1082 25" _null_ _null_ _null_ _null_ range_constructor3 _null_ _null_ _null_ )); DESCR("daterange constructor"); DATA(insert OID = 3945 ( int8range PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 3926 "20 20" _null_ _null_ _null_ _null_ range_constructor2 _null_ _null_ _null_ )); DESCR("int8range constructor"); DATA(insert OID = 3946 ( int8range PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 3926 "20 20 25" _null_ _null_ _null_ _null_ range_constructor3 _null_ _null_ _null_ )); DESCR("int8range constructor"); /* spgist support functions */ DATA(insert OID = 4001 ( spggettuple PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ spggettuple _null_ _null_ _null_ )); DESCR("spgist(internal)"); DATA(insert OID = 4002 ( spggetbitmap PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ spggetbitmap _null_ _null_ _null_ )); DESCR("spgist(internal)"); DATA(insert OID = 4003 ( spginsert PGNSP PGUID 12 1 0 0 0 f f f f t f v 6 0 16 "2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ spginsert _null_ _null_ _null_ )); DESCR("spgist(internal)"); DATA(insert OID = 4004 ( spgbeginscan PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ spgbeginscan _null_ _null_ _null_ )); DESCR("spgist(internal)"); DATA(insert OID = 4005 ( spgrescan PGNSP PGUID 12 1 0 0 0 f f f f t f v 5 0 2278 "2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ spgrescan _null_ _null_ _null_ )); DESCR("spgist(internal)"); DATA(insert OID = 4006 ( spgendscan PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ spgendscan _null_ _null_ _null_ )); DESCR("spgist(internal)"); DATA(insert OID = 4007 ( spgmarkpos PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ spgmarkpos _null_ _null_ _null_ )); DESCR("spgist(internal)"); DATA(insert OID = 4008 ( spgrestrpos PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ spgrestrpos _null_ _null_ _null_ )); DESCR("spgist(internal)"); DATA(insert OID = 4009 ( spgbuild PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ spgbuild _null_ _null_ _null_ )); DESCR("spgist(internal)"); DATA(insert OID = 4010 ( spgbuildempty PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ spgbuildempty _null_ _null_ _null_ )); DESCR("spgist(internal)"); DATA(insert OID = 4011 ( spgbulkdelete PGNSP PGUID 12 1 0 0 0 f f f f t f v 4 0 2281 "2281 2281 2281 2281" _null_ _null_ _null_ _null_ spgbulkdelete _null_ _null_ _null_ )); DESCR("spgist(internal)"); DATA(insert OID = 4012 ( spgvacuumcleanup PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ spgvacuumcleanup _null_ _null_ _null_ )); DESCR("spgist(internal)"); DATA(insert OID = 4032 ( spgcanreturn PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "2281" _null_ _null_ _null_ _null_ spgcanreturn _null_ _null_ _null_ )); DESCR("spgist(internal)"); DATA(insert OID = 4013 ( spgcostestimate PGNSP PGUID 12 1 0 0 0 f f f f t f v 7 0 2278 "2281 2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ spgcostestimate _null_ _null_ _null_ )); DESCR("spgist(internal)"); DATA(insert OID = 4014 ( spgoptions PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 17 "1009 16" _null_ _null_ _null_ _null_ spgoptions _null_ _null_ _null_ )); DESCR("spgist(internal)"); /* spgist opclasses */ DATA(insert OID = 4018 ( spg_quad_config PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_quad_config _null_ _null_ _null_ )); DESCR("SP-GiST support for quad tree over point"); DATA(insert OID = 4019 ( spg_quad_choose PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_quad_choose _null_ _null_ _null_ )); DESCR("SP-GiST support for quad tree over point"); DATA(insert OID = 4020 ( spg_quad_picksplit PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_quad_picksplit _null_ _null_ _null_ )); DESCR("SP-GiST support for quad tree over point"); DATA(insert OID = 4021 ( spg_quad_inner_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_quad_inner_consistent _null_ _null_ _null_ )); DESCR("SP-GiST support for quad tree over point"); DATA(insert OID = 4022 ( spg_quad_leaf_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ spg_quad_leaf_consistent _null_ _null_ _null_ )); DESCR("SP-GiST support for quad tree and k-d tree over point"); DATA(insert OID = 4023 ( spg_kd_config PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_kd_config _null_ _null_ _null_ )); DESCR("SP-GiST support for k-d tree over point"); DATA(insert OID = 4024 ( spg_kd_choose PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_kd_choose _null_ _null_ _null_ )); DESCR("SP-GiST support for k-d tree over point"); DATA(insert OID = 4025 ( spg_kd_picksplit PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_kd_picksplit _null_ _null_ _null_ )); DESCR("SP-GiST support for k-d tree over point"); DATA(insert OID = 4026 ( spg_kd_inner_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_kd_inner_consistent _null_ _null_ _null_ )); DESCR("SP-GiST support for k-d tree over point"); DATA(insert OID = 4027 ( spg_text_config PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_text_config _null_ _null_ _null_ )); DESCR("SP-GiST support for suffix tree over text"); DATA(insert OID = 4028 ( spg_text_choose PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_text_choose _null_ _null_ _null_ )); DESCR("SP-GiST support for suffix tree over text"); DATA(insert OID = 4029 ( spg_text_picksplit PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_text_picksplit _null_ _null_ _null_ )); DESCR("SP-GiST support for suffix tree over text"); DATA(insert OID = 4030 ( spg_text_inner_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_text_inner_consistent _null_ _null_ _null_ )); DESCR("SP-GiST support for suffix tree over text"); DATA(insert OID = 4031 ( spg_text_leaf_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ spg_text_leaf_consistent _null_ _null_ _null_ )); DESCR("SP-GiST support for suffix tree over text"); /* * Symbolic values for provolatile column: these indicate whether the result * of a function is dependent *only* on the values of its explicit arguments, * or can change due to outside factors (such as parameter variables or * table contents). NOTE: functions having side-effects, such as setval(), * must be labeled volatile to ensure they will not get optimized away, * even if the actual return value is not changeable. */ #define PROVOLATILE_IMMUTABLE 'i' /* never changes for given input */ #define PROVOLATILE_STABLE 's' /* does not change within a scan */ #define PROVOLATILE_VOLATILE 'v' /* can change even within a scan */ /* * Symbolic values for proargmodes column. Note that these must agree with * the FunctionParameterMode enum in parsenodes.h; we declare them here to * be accessible from either header. */ #define PROARGMODE_IN 'i' #define PROARGMODE_OUT 'o' #define PROARGMODE_INOUT 'b' #define PROARGMODE_VARIADIC 'v' #define PROARGMODE_TABLE 't' #endif /* PG_PROC_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_class.h���������������������������������������������������������������������0000644�����������������00000013666�14763166026�0012605 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_class.h * definition of the system "relation" relation (pg_class) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_class.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_CLASS_H #define PG_CLASS_H #include "catalog/genbki.h" /* ---------------- * pg_class definition. cpp turns this into * typedef struct FormData_pg_class * ---------------- */ #define RelationRelationId 1259 #define RelationRelation_Rowtype_Id 83 CATALOG(pg_class,1259) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83) BKI_SCHEMA_MACRO { NameData relname; /* class name */ Oid relnamespace; /* OID of namespace containing this class */ Oid reltype; /* OID of entry in pg_type for table's * implicit row type */ Oid reloftype; /* OID of entry in pg_type for underlying * composite type */ Oid relowner; /* class owner */ Oid relam; /* index access method; 0 if not an index */ Oid relfilenode; /* identifier of physical storage file */ /* relfilenode == 0 means it is a "mapped" relation, see relmapper.c */ Oid reltablespace; /* identifier of table space for relation */ int4 relpages; /* # of blocks (not always up-to-date) */ float4 reltuples; /* # of tuples (not always up-to-date) */ int4 relallvisible; /* # of all-visible blocks (not always * up-to-date) */ Oid reltoastrelid; /* OID of toast table; 0 if none */ Oid reltoastidxid; /* if toast table, OID of chunk_id index */ bool relhasindex; /* T if has (or has had) any indexes */ bool relisshared; /* T if shared across databases */ char relpersistence; /* see RELPERSISTENCE_xxx constants below */ char relkind; /* see RELKIND_xxx constants below */ int2 relnatts; /* number of user attributes */ /* * Class pg_attribute must contain exactly "relnatts" user attributes * (with attnums ranging from 1 to relnatts) for this class. It may also * contain entries with negative attnums for system attributes. */ int2 relchecks; /* # of CHECK constraints for class */ bool relhasoids; /* T if we generate OIDs for rows of rel */ bool relhaspkey; /* has (or has had) PRIMARY KEY index */ bool relhasrules; /* has (or has had) any rules */ bool relhastriggers; /* has (or has had) any TRIGGERs */ bool relhassubclass; /* has (or has had) derived classes */ TransactionId relfrozenxid; /* all Xids < this are frozen in this rel */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ /* NOTE: These fields are not present in a relcache entry's rd_rel field. */ aclitem relacl[1]; /* access permissions */ text reloptions[1]; /* access-method-specific options */ #endif } FormData_pg_class; /* Size of fixed part of pg_class tuples, not counting var-length fields */ #define CLASS_TUPLE_SIZE \ (offsetof(FormData_pg_class,relfrozenxid) + sizeof(TransactionId)) /* ---------------- * Form_pg_class corresponds to a pointer to a tuple with * the format of pg_class relation. * ---------------- */ typedef FormData_pg_class *Form_pg_class; /* ---------------- * compiler constants for pg_class * ---------------- */ #define Natts_pg_class 27 #define Anum_pg_class_relname 1 #define Anum_pg_class_relnamespace 2 #define Anum_pg_class_reltype 3 #define Anum_pg_class_reloftype 4 #define Anum_pg_class_relowner 5 #define Anum_pg_class_relam 6 #define Anum_pg_class_relfilenode 7 #define Anum_pg_class_reltablespace 8 #define Anum_pg_class_relpages 9 #define Anum_pg_class_reltuples 10 #define Anum_pg_class_relallvisible 11 #define Anum_pg_class_reltoastrelid 12 #define Anum_pg_class_reltoastidxid 13 #define Anum_pg_class_relhasindex 14 #define Anum_pg_class_relisshared 15 #define Anum_pg_class_relpersistence 16 #define Anum_pg_class_relkind 17 #define Anum_pg_class_relnatts 18 #define Anum_pg_class_relchecks 19 #define Anum_pg_class_relhasoids 20 #define Anum_pg_class_relhaspkey 21 #define Anum_pg_class_relhasrules 22 #define Anum_pg_class_relhastriggers 23 #define Anum_pg_class_relhassubclass 24 #define Anum_pg_class_relfrozenxid 25 #define Anum_pg_class_relacl 26 #define Anum_pg_class_reloptions 27 /* ---------------- * initial contents of pg_class * * NOTE: only "bootstrapped" relations need to be declared here. Be sure that * the OIDs listed here match those given in their CATALOG macros, and that * the relnatts values are correct. * ---------------- */ /* Note: "3" in the relfrozenxid column stands for FirstNormalTransactionId */ DATA(insert OID = 1247 ( pg_type PGNSP 71 0 PGUID 0 0 0 0 0 0 0 0 f f p r 30 0 t f f f f 3 _null_ _null_ )); DESCR(""); DATA(insert OID = 1249 ( pg_attribute PGNSP 75 0 PGUID 0 0 0 0 0 0 0 0 f f p r 21 0 f f f f f 3 _null_ _null_ )); DESCR(""); DATA(insert OID = 1255 ( pg_proc PGNSP 81 0 PGUID 0 0 0 0 0 0 0 0 f f p r 27 0 t f f f f 3 _null_ _null_ )); DESCR(""); DATA(insert OID = 1259 ( pg_class PGNSP 83 0 PGUID 0 0 0 0 0 0 0 0 f f p r 27 0 t f f f f 3 _null_ _null_ )); DESCR(""); #define RELKIND_RELATION 'r' /* ordinary table */ #define RELKIND_INDEX 'i' /* secondary index */ #define RELKIND_SEQUENCE 'S' /* sequence object */ #define RELKIND_TOASTVALUE 't' /* for out-of-line values */ #define RELKIND_VIEW 'v' /* view */ #define RELKIND_COMPOSITE_TYPE 'c' /* composite type */ #define RELKIND_FOREIGN_TABLE 'f' /* foreign table */ #define RELKIND_UNCATALOGED 'u' /* not yet cataloged */ #define RELPERSISTENCE_PERMANENT 'p' /* regular table */ #define RELPERSISTENCE_UNLOGGED 'u' /* unlogged permanent table */ #define RELPERSISTENCE_TEMP 't' /* temporary table */ #endif /* PG_CLASS_H */ ��������������������������������������������������������������������������pgsql/server/catalog/pg_ts_template.h���������������������������������������������������������������0000644�����������������00000004151�14763166026�0014006 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_ts_template.h * definition of dictionary templates for tsearch * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_ts_template.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * * XXX do NOT break up DATA() statements into multiple lines! * the scripts are not as smart as you might think... * *------------------------------------------------------------------------- */ #ifndef PG_TS_TEMPLATE_H #define PG_TS_TEMPLATE_H #include "catalog/genbki.h" /* ---------------- * pg_ts_template definition. cpp turns this into * typedef struct FormData_pg_ts_template * ---------------- */ #define TSTemplateRelationId 3764 CATALOG(pg_ts_template,3764) { NameData tmplname; /* template name */ Oid tmplnamespace; /* name space */ regproc tmplinit; /* initialization method of dict (may be 0) */ regproc tmpllexize; /* base method of dictionary */ } FormData_pg_ts_template; typedef FormData_pg_ts_template *Form_pg_ts_template; /* ---------------- * compiler constants for pg_ts_template * ---------------- */ #define Natts_pg_ts_template 4 #define Anum_pg_ts_template_tmplname 1 #define Anum_pg_ts_template_tmplnamespace 2 #define Anum_pg_ts_template_tmplinit 3 #define Anum_pg_ts_template_tmpllexize 4 /* ---------------- * initial contents of pg_ts_template * ---------------- */ DATA(insert OID = 3727 ( "simple" PGNSP dsimple_init dsimple_lexize )); DESCR("simple dictionary: just lower case and check for stopword"); DATA(insert OID = 3730 ( "synonym" PGNSP dsynonym_init dsynonym_lexize )); DESCR("synonym dictionary: replace word by its synonym"); DATA(insert OID = 3733 ( "ispell" PGNSP dispell_init dispell_lexize )); DESCR("ispell dictionary"); DATA(insert OID = 3742 ( "thesaurus" PGNSP thesaurus_init thesaurus_lexize )); DESCR("thesaurus dictionary: phrase by phrase substitution"); #endif /* PG_TS_TEMPLATE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/catalog/pg_cast.h����������������������������������������������������������������������0000644�����������������00000026756�14763166026�0012436 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_cast.h * definition of the system "type casts" relation (pg_cast) * along with the relation's initial contents. * * As of Postgres 8.0, pg_cast describes not only type coercion functions * but also length coercion functions. * * * Copyright (c) 2002-2012, PostgreSQL Global Development Group * * src/include/catalog/pg_cast.h * * NOTES * the genbki.pl script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_CAST_H #define PG_CAST_H #include "catalog/genbki.h" /* ---------------- * pg_cast definition. cpp turns this into * typedef struct FormData_pg_cast * ---------------- */ #define CastRelationId 2605 CATALOG(pg_cast,2605) { Oid castsource; /* source datatype for cast */ Oid casttarget; /* destination datatype for cast */ Oid castfunc; /* cast function; 0 = binary coercible */ char castcontext; /* contexts in which cast can be used */ char castmethod; /* cast method */ } FormData_pg_cast; typedef FormData_pg_cast *Form_pg_cast; /* * The allowable values for pg_cast.castcontext are specified by this enum. * Since castcontext is stored as a "char", we use ASCII codes for human * convenience in reading the table. Note that internally to the backend, * these values are converted to the CoercionContext enum (see primnodes.h), * which is defined to sort in a convenient order; the ASCII codes don't * have to sort in any special order. */ typedef enum CoercionCodes { COERCION_CODE_IMPLICIT = 'i', /* coercion in context of expression */ COERCION_CODE_ASSIGNMENT = 'a', /* coercion in context of assignment */ COERCION_CODE_EXPLICIT = 'e' /* explicit cast operation */ } CoercionCodes; /* * The allowable values for pg_cast.castmethod are specified by this enum. * Since castmethod is stored as a "char", we use ASCII codes for human * convenience in reading the table. */ typedef enum CoercionMethod { COERCION_METHOD_FUNCTION = 'f', /* use a function */ COERCION_METHOD_BINARY = 'b', /* types are binary-compatible */ COERCION_METHOD_INOUT = 'i' /* use input/output functions */ } CoercionMethod; /* ---------------- * compiler constants for pg_cast * ---------------- */ #define Natts_pg_cast 5 #define Anum_pg_cast_castsource 1 #define Anum_pg_cast_casttarget 2 #define Anum_pg_cast_castfunc 3 #define Anum_pg_cast_castcontext 4 #define Anum_pg_cast_castmethod 5 /* ---------------- * initial contents of pg_cast * * Note: this table has OIDs, but we don't bother to assign them manually, * since nothing needs to know the specific OID of any built-in cast. * ---------------- */ /* * Numeric category: implicit casts are allowed in the direction * int2->int4->int8->numeric->float4->float8, while casts in the * reverse direction are assignment-only. */ DATA(insert ( 20 21 714 a f )); DATA(insert ( 20 23 480 a f )); DATA(insert ( 20 700 652 i f )); DATA(insert ( 20 701 482 i f )); DATA(insert ( 20 1700 1781 i f )); DATA(insert ( 21 20 754 i f )); DATA(insert ( 21 23 313 i f )); DATA(insert ( 21 700 236 i f )); DATA(insert ( 21 701 235 i f )); DATA(insert ( 21 1700 1782 i f )); DATA(insert ( 23 20 481 i f )); DATA(insert ( 23 21 314 a f )); DATA(insert ( 23 700 318 i f )); DATA(insert ( 23 701 316 i f )); DATA(insert ( 23 1700 1740 i f )); DATA(insert ( 700 20 653 a f )); DATA(insert ( 700 21 238 a f )); DATA(insert ( 700 23 319 a f )); DATA(insert ( 700 701 311 i f )); DATA(insert ( 700 1700 1742 a f )); DATA(insert ( 701 20 483 a f )); DATA(insert ( 701 21 237 a f )); DATA(insert ( 701 23 317 a f )); DATA(insert ( 701 700 312 a f )); DATA(insert ( 701 1700 1743 a f )); DATA(insert ( 1700 20 1779 a f )); DATA(insert ( 1700 21 1783 a f )); DATA(insert ( 1700 23 1744 a f )); DATA(insert ( 1700 700 1745 i f )); DATA(insert ( 1700 701 1746 i f )); DATA(insert ( 790 1700 3823 a f )); DATA(insert ( 1700 790 3824 a f )); DATA(insert ( 23 790 3811 a f )); DATA(insert ( 20 790 3812 a f )); /* Allow explicit coercions between int4 and bool */ DATA(insert ( 23 16 2557 e f )); DATA(insert ( 16 23 2558 e f )); /* * OID category: allow implicit conversion from any integral type (including * int8, to support OID literals > 2G) to OID, as well as assignment coercion * from OID to int4 or int8. Similarly for each OID-alias type. Also allow * implicit coercions between OID and each OID-alias type, as well as * regproc<->regprocedure and regoper<->regoperator. (Other coercions * between alias types must pass through OID.) Lastly, there are implicit * casts from text and varchar to regclass, which exist mainly to support * legacy forms of nextval() and related functions. */ DATA(insert ( 20 26 1287 i f )); DATA(insert ( 21 26 313 i f )); DATA(insert ( 23 26 0 i b )); DATA(insert ( 26 20 1288 a f )); DATA(insert ( 26 23 0 a b )); DATA(insert ( 26 24 0 i b )); DATA(insert ( 24 26 0 i b )); DATA(insert ( 20 24 1287 i f )); DATA(insert ( 21 24 313 i f )); DATA(insert ( 23 24 0 i b )); DATA(insert ( 24 20 1288 a f )); DATA(insert ( 24 23 0 a b )); DATA(insert ( 24 2202 0 i b )); DATA(insert ( 2202 24 0 i b )); DATA(insert ( 26 2202 0 i b )); DATA(insert ( 2202 26 0 i b )); DATA(insert ( 20 2202 1287 i f )); DATA(insert ( 21 2202 313 i f )); DATA(insert ( 23 2202 0 i b )); DATA(insert ( 2202 20 1288 a f )); DATA(insert ( 2202 23 0 a b )); DATA(insert ( 26 2203 0 i b )); DATA(insert ( 2203 26 0 i b )); DATA(insert ( 20 2203 1287 i f )); DATA(insert ( 21 2203 313 i f )); DATA(insert ( 23 2203 0 i b )); DATA(insert ( 2203 20 1288 a f )); DATA(insert ( 2203 23 0 a b )); DATA(insert ( 2203 2204 0 i b )); DATA(insert ( 2204 2203 0 i b )); DATA(insert ( 26 2204 0 i b )); DATA(insert ( 2204 26 0 i b )); DATA(insert ( 20 2204 1287 i f )); DATA(insert ( 21 2204 313 i f )); DATA(insert ( 23 2204 0 i b )); DATA(insert ( 2204 20 1288 a f )); DATA(insert ( 2204 23 0 a b )); DATA(insert ( 26 2205 0 i b )); DATA(insert ( 2205 26 0 i b )); DATA(insert ( 20 2205 1287 i f )); DATA(insert ( 21 2205 313 i f )); DATA(insert ( 23 2205 0 i b )); DATA(insert ( 2205 20 1288 a f )); DATA(insert ( 2205 23 0 a b )); DATA(insert ( 26 2206 0 i b )); DATA(insert ( 2206 26 0 i b )); DATA(insert ( 20 2206 1287 i f )); DATA(insert ( 21 2206 313 i f )); DATA(insert ( 23 2206 0 i b )); DATA(insert ( 2206 20 1288 a f )); DATA(insert ( 2206 23 0 a b )); DATA(insert ( 26 3734 0 i b )); DATA(insert ( 3734 26 0 i b )); DATA(insert ( 20 3734 1287 i f )); DATA(insert ( 21 3734 313 i f )); DATA(insert ( 23 3734 0 i b )); DATA(insert ( 3734 20 1288 a f )); DATA(insert ( 3734 23 0 a b )); DATA(insert ( 26 3769 0 i b )); DATA(insert ( 3769 26 0 i b )); DATA(insert ( 20 3769 1287 i f )); DATA(insert ( 21 3769 313 i f )); DATA(insert ( 23 3769 0 i b )); DATA(insert ( 3769 20 1288 a f )); DATA(insert ( 3769 23 0 a b )); DATA(insert ( 25 2205 1079 i f )); DATA(insert ( 1043 2205 1079 i f )); /* * String category */ DATA(insert ( 25 1042 0 i b )); DATA(insert ( 25 1043 0 i b )); DATA(insert ( 1042 25 401 i f )); DATA(insert ( 1042 1043 401 i f )); DATA(insert ( 1043 25 0 i b )); DATA(insert ( 1043 1042 0 i b )); DATA(insert ( 18 25 946 i f )); DATA(insert ( 18 1042 860 a f )); DATA(insert ( 18 1043 946 a f )); DATA(insert ( 19 25 406 i f )); DATA(insert ( 19 1042 408 a f )); DATA(insert ( 19 1043 1401 a f )); DATA(insert ( 25 18 944 a f )); DATA(insert ( 1042 18 944 a f )); DATA(insert ( 1043 18 944 a f )); DATA(insert ( 25 19 407 i f )); DATA(insert ( 1042 19 409 i f )); DATA(insert ( 1043 19 1400 i f )); /* Allow explicit coercions between int4 and "char" */ DATA(insert ( 18 23 77 e f )); DATA(insert ( 23 18 78 e f )); /* pg_node_tree can be coerced to, but not from, text */ DATA(insert ( 194 25 0 i b )); /* * Datetime category */ DATA(insert ( 702 1082 1179 a f )); DATA(insert ( 702 1083 1364 a f )); DATA(insert ( 702 1114 2023 i f )); DATA(insert ( 702 1184 1173 i f )); DATA(insert ( 703 1186 1177 i f )); DATA(insert ( 1082 1114 2024 i f )); DATA(insert ( 1082 1184 1174 i f )); DATA(insert ( 1083 1186 1370 i f )); DATA(insert ( 1083 1266 2047 i f )); DATA(insert ( 1114 702 2030 a f )); DATA(insert ( 1114 1082 2029 a f )); DATA(insert ( 1114 1083 1316 a f )); DATA(insert ( 1114 1184 2028 i f )); DATA(insert ( 1184 702 1180 a f )); DATA(insert ( 1184 1082 1178 a f )); DATA(insert ( 1184 1083 2019 a f )); DATA(insert ( 1184 1114 2027 a f )); DATA(insert ( 1184 1266 1388 a f )); DATA(insert ( 1186 703 1194 a f )); DATA(insert ( 1186 1083 1419 a f )); DATA(insert ( 1266 1083 2046 a f )); /* Cross-category casts between int4 and abstime, reltime */ DATA(insert ( 23 702 0 e b )); DATA(insert ( 702 23 0 e b )); DATA(insert ( 23 703 0 e b )); DATA(insert ( 703 23 0 e b )); /* * Geometric category */ DATA(insert ( 601 600 1532 e f )); DATA(insert ( 602 600 1533 e f )); DATA(insert ( 602 604 1449 a f )); DATA(insert ( 603 600 1534 e f )); DATA(insert ( 603 601 1541 e f )); DATA(insert ( 603 604 1448 a f )); DATA(insert ( 603 718 1479 e f )); DATA(insert ( 604 600 1540 e f )); DATA(insert ( 604 602 1447 a f )); DATA(insert ( 604 603 1446 e f )); DATA(insert ( 604 718 1474 e f )); DATA(insert ( 718 600 1416 e f )); DATA(insert ( 718 603 1480 e f )); DATA(insert ( 718 604 1544 e f )); /* * INET category */ DATA(insert ( 650 869 0 i b )); DATA(insert ( 869 650 1715 a f )); /* * BitString category */ DATA(insert ( 1560 1562 0 i b )); DATA(insert ( 1562 1560 0 i b )); /* Cross-category casts between bit and int4, int8 */ DATA(insert ( 20 1560 2075 e f )); DATA(insert ( 23 1560 1683 e f )); DATA(insert ( 1560 20 2076 e f )); DATA(insert ( 1560 23 1684 e f )); /* * Cross-category casts to and from TEXT * * We need entries here only for a few specialized cases where the behavior * of the cast function differs from the datatype's I/O functions. Otherwise, * parse_coerce.c will generate CoerceViaIO operations without any prompting. * * Note that the castcontext values specified here should be no stronger than * parse_coerce.c's automatic casts ('a' to text, 'e' from text) else odd * behavior will ensue when the automatic cast is applied instead of the * pg_cast entry! */ DATA(insert ( 650 25 730 a f )); DATA(insert ( 869 25 730 a f )); DATA(insert ( 16 25 2971 a f )); DATA(insert ( 142 25 0 a b )); DATA(insert ( 25 142 2896 e f )); /* * Cross-category casts to and from VARCHAR * * We support all the same casts as for TEXT. */ DATA(insert ( 650 1043 730 a f )); DATA(insert ( 869 1043 730 a f )); DATA(insert ( 16 1043 2971 a f )); DATA(insert ( 142 1043 0 a b )); DATA(insert ( 1043 142 2896 e f )); /* * Cross-category casts to and from BPCHAR * * We support all the same casts as for TEXT. */ DATA(insert ( 650 1042 730 a f )); DATA(insert ( 869 1042 730 a f )); DATA(insert ( 16 1042 2971 a f )); DATA(insert ( 142 1042 0 a b )); DATA(insert ( 1042 142 2896 e f )); /* * Length-coercion functions */ DATA(insert ( 1042 1042 668 i f )); DATA(insert ( 1043 1043 669 i f )); DATA(insert ( 1083 1083 1968 i f )); DATA(insert ( 1114 1114 1961 i f )); DATA(insert ( 1184 1184 1967 i f )); DATA(insert ( 1186 1186 1200 i f )); DATA(insert ( 1266 1266 1969 i f )); DATA(insert ( 1560 1560 1685 i f )); DATA(insert ( 1562 1562 1687 i f )); DATA(insert ( 1700 1700 1703 i f )); #endif /* PG_CAST_H */ ������������������pgsql/server/catalog/genbki.h�����������������������������������������������������������������������0000644�����������������00000003403�14763166026�0012235 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * genbki.h * Required include file for all POSTGRES catalog header files * * genbki.h defines CATALOG(), DATA(), BKI_BOOTSTRAP and related macros * so that the catalog header files can be read by the C compiler. * (These same words are recognized by genbki.pl to build the BKI * bootstrap file from these header files.) * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/genbki.h * *------------------------------------------------------------------------- */ #ifndef GENBKI_H #define GENBKI_H /* Introduces a catalog's structure definition */ #define CATALOG(name,oid) typedef struct CppConcat(FormData_,name) /* * This is never defined; it's here only for documentation. * * Variable-length catalog fields (except possibly the first not nullable one) * should not be visible in C structures, so they are made invisible by #ifdefs * of an undefined symbol. See also MARKNOTNULL in bootstrap.c for how this is * handled. */ #undef CATALOG_VARLEN /* Options that may appear after CATALOG (on the same line) */ #define BKI_BOOTSTRAP #define BKI_SHARED_RELATION #define BKI_WITHOUT_OIDS #define BKI_ROWTYPE_OID(oid) #define BKI_SCHEMA_MACRO /* Declarations that provide the initial content of a catalog */ /* In C, these need to expand into some harmless, repeatable declaration */ #define DATA(x) extern int no_such_variable #define DESCR(x) extern int no_such_variable #define SHDESCR(x) extern int no_such_variable /* PHONY type definitions for use in catalog structure definitions only */ typedef int aclitem; typedef int pg_node_tree; #endif /* GENBKI_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/funcapi.h������������������������������������������������������������������������������0000644�����������������00000024364�14763166026�0011022 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * funcapi.h * Definitions for functions which return composite type and/or sets * * This file must be included by all Postgres modules that either define * or call FUNCAPI-callable functions or macros. * * * Copyright (c) 2002-2012, PostgreSQL Global Development Group * * src/include/funcapi.h * *------------------------------------------------------------------------- */ #ifndef FUNCAPI_H #define FUNCAPI_H #include "fmgr.h" #include "access/tupdesc.h" #include "executor/executor.h" #include "executor/tuptable.h" /*------------------------------------------------------------------------- * Support to ease writing Functions returning composite types *------------------------------------------------------------------------- * * This struct holds arrays of individual attribute information * needed to create a tuple from raw C strings. It also requires * a copy of the TupleDesc. The information carried here * is derived from the TupleDesc, but it is stored here to * avoid redundant cpu cycles on each call to an SRF. */ typedef struct AttInMetadata { /* full TupleDesc */ TupleDesc tupdesc; /* array of attribute type input function finfo */ FmgrInfo *attinfuncs; /* array of attribute type i/o parameter OIDs */ Oid *attioparams; /* array of attribute typmod */ int32 *atttypmods; } AttInMetadata; /*------------------------------------------------------------------------- * Support struct to ease writing Set Returning Functions (SRFs) *------------------------------------------------------------------------- * * This struct holds function context for Set Returning Functions. * Use fn_extra to hold a pointer to it across calls */ typedef struct FuncCallContext { /* * Number of times we've been called before * * call_cntr is initialized to 0 for you by SRF_FIRSTCALL_INIT(), and * incremented for you every time SRF_RETURN_NEXT() is called. */ uint32 call_cntr; /* * OPTIONAL maximum number of calls * * max_calls is here for convenience only and setting it is optional. If * not set, you must provide alternative means to know when the function * is done. */ uint32 max_calls; /* * OPTIONAL pointer to result slot * * This is obsolete and only present for backwards compatibility, viz, * user-defined SRFs that use the deprecated TupleDescGetSlot(). */ TupleTableSlot *slot; /* * OPTIONAL pointer to miscellaneous user-provided context information * * user_fctx is for use as a pointer to your own struct to retain * arbitrary context information between calls of your function. */ void *user_fctx; /* * OPTIONAL pointer to struct containing attribute type input metadata * * attinmeta is for use when returning tuples (i.e. composite data types) * and is not used when returning base data types. It is only needed if * you intend to use BuildTupleFromCStrings() to create the return tuple. */ AttInMetadata *attinmeta; /* * memory context used for structures that must live for multiple calls * * multi_call_memory_ctx is set by SRF_FIRSTCALL_INIT() for you, and used * by SRF_RETURN_DONE() for cleanup. It is the most appropriate memory * context for any memory that is to be reused across multiple calls of * the SRF. */ MemoryContext multi_call_memory_ctx; /* * OPTIONAL pointer to struct containing tuple description * * tuple_desc is for use when returning tuples (i.e. composite data types) * and is only needed if you are going to build the tuples with * heap_form_tuple() rather than with BuildTupleFromCStrings(). Note that * the TupleDesc pointer stored here should usually have been run through * BlessTupleDesc() first. */ TupleDesc tuple_desc; } FuncCallContext; /*---------- * Support to ease writing functions returning composite types * * External declarations: * get_call_result_type: * Given a function's call info record, determine the kind of datatype * it is supposed to return. If resultTypeId isn't NULL, *resultTypeId * receives the actual datatype OID (this is mainly useful for scalar * result types). If resultTupleDesc isn't NULL, *resultTupleDesc * receives a pointer to a TupleDesc when the result is of a composite * type, or NULL when it's a scalar result or the rowtype could not be * determined. NB: the tupledesc should be copied if it is to be * accessed over a long period. * get_expr_result_type: * Given an expression node, return the same info as for * get_call_result_type. Note: the cases in which rowtypes cannot be * determined are different from the cases for get_call_result_type. * get_func_result_type: * Given only a function's OID, return the same info as for * get_call_result_type. Note: the cases in which rowtypes cannot be * determined are different from the cases for get_call_result_type. * Do *not* use this if you can use one of the others. *---------- */ /* Type categories for get_call_result_type and siblings */ typedef enum TypeFuncClass { TYPEFUNC_SCALAR, /* scalar result type */ TYPEFUNC_COMPOSITE, /* determinable rowtype result */ TYPEFUNC_RECORD, /* indeterminate rowtype result */ TYPEFUNC_OTHER /* bogus type, eg pseudotype */ } TypeFuncClass; extern TypeFuncClass get_call_result_type(FunctionCallInfo fcinfo, Oid *resultTypeId, TupleDesc *resultTupleDesc); extern TypeFuncClass get_expr_result_type(Node *expr, Oid *resultTypeId, TupleDesc *resultTupleDesc); extern TypeFuncClass get_func_result_type(Oid functionId, Oid *resultTypeId, TupleDesc *resultTupleDesc); extern bool resolve_polymorphic_argtypes(int numargs, Oid *argtypes, char *argmodes, Node *call_expr); extern int get_func_arg_info(HeapTuple procTup, Oid **p_argtypes, char ***p_argnames, char **p_argmodes); extern int get_func_input_arg_names(Datum proargnames, Datum proargmodes, char ***arg_names); extern char *get_func_result_name(Oid functionId); extern TupleDesc build_function_result_tupdesc_d(Datum proallargtypes, Datum proargmodes, Datum proargnames); extern TupleDesc build_function_result_tupdesc_t(HeapTuple procTuple); /*---------- * Support to ease writing functions returning composite types * * External declarations: * TupleDesc BlessTupleDesc(TupleDesc tupdesc) - "Bless" a completed tuple * descriptor so that it can be used to return properly labeled tuples. * You need to call this if you are going to use heap_form_tuple directly. * TupleDescGetAttInMetadata does it for you, however, so no need to call * it if you call TupleDescGetAttInMetadata. * AttInMetadata *TupleDescGetAttInMetadata(TupleDesc tupdesc) - Build an * AttInMetadata struct based on the given TupleDesc. AttInMetadata can * be used in conjunction with C strings to produce a properly formed * tuple. * HeapTuple BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values) - * build a HeapTuple given user data in C string form. values is an array * of C strings, one for each attribute of the return tuple. * Datum HeapTupleHeaderGetDatum(HeapTupleHeader tuple) - convert a * HeapTupleHeader to a Datum. * * Macro declarations: * HeapTupleGetDatum(HeapTuple tuple) - convert a HeapTuple to a Datum. * * Obsolete routines and macros: * TupleDesc RelationNameGetTupleDesc(const char *relname) - Use to get a * TupleDesc based on a named relation. * TupleDesc TypeGetTupleDesc(Oid typeoid, List *colaliases) - Use to get a * TupleDesc based on a type OID. * TupleTableSlot *TupleDescGetSlot(TupleDesc tupdesc) - Builds a * TupleTableSlot, which is not needed anymore. * TupleGetDatum(TupleTableSlot *slot, HeapTuple tuple) - get a Datum * given a tuple and a slot. *---------- */ #define HeapTupleGetDatum(tuple) HeapTupleHeaderGetDatum((tuple)->t_data) /* obsolete version of above */ #define TupleGetDatum(_slot, _tuple) HeapTupleGetDatum(_tuple) extern TupleDesc RelationNameGetTupleDesc(const char *relname); extern TupleDesc TypeGetTupleDesc(Oid typeoid, List *colaliases); /* from execTuples.c */ extern TupleDesc BlessTupleDesc(TupleDesc tupdesc); extern AttInMetadata *TupleDescGetAttInMetadata(TupleDesc tupdesc); extern HeapTuple BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values); extern Datum HeapTupleHeaderGetDatum(HeapTupleHeader tuple); extern TupleTableSlot *TupleDescGetSlot(TupleDesc tupdesc); /*---------- * Support for Set Returning Functions (SRFs) * * The basic API for SRFs looks something like: * * Datum * my_Set_Returning_Function(PG_FUNCTION_ARGS) * { * FuncCallContext *funcctx; * Datum result; * MemoryContext oldcontext; * <user defined declarations> * * if (SRF_IS_FIRSTCALL()) * { * funcctx = SRF_FIRSTCALL_INIT(); * // switch context when allocating stuff to be used in later calls * oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx); * <user defined code> * <if returning composite> * <build TupleDesc, and perhaps AttInMetaData> * <endif returning composite> * <user defined code> * // return to original context when allocating transient memory * MemoryContextSwitchTo(oldcontext); * } * <user defined code> * funcctx = SRF_PERCALL_SETUP(); * <user defined code> * * if (funcctx->call_cntr < funcctx->max_calls) * { * <user defined code> * <obtain result Datum> * SRF_RETURN_NEXT(funcctx, result); * } * else * SRF_RETURN_DONE(funcctx); * } * *---------- */ /* from funcapi.c */ extern FuncCallContext *init_MultiFuncCall(PG_FUNCTION_ARGS); extern FuncCallContext *per_MultiFuncCall(PG_FUNCTION_ARGS); extern void end_MultiFuncCall(PG_FUNCTION_ARGS, FuncCallContext *funcctx); #define SRF_IS_FIRSTCALL() (fcinfo->flinfo->fn_extra == NULL) #define SRF_FIRSTCALL_INIT() init_MultiFuncCall(fcinfo) #define SRF_PERCALL_SETUP() per_MultiFuncCall(fcinfo) #define SRF_RETURN_NEXT(_funcctx, _result) \ do { \ ReturnSetInfo *rsi; \ (_funcctx)->call_cntr++; \ rsi = (ReturnSetInfo *) fcinfo->resultinfo; \ rsi->isDone = ExprMultipleResult; \ PG_RETURN_DATUM(_result); \ } while (0) #define SRF_RETURN_DONE(_funcctx) \ do { \ ReturnSetInfo *rsi; \ end_MultiFuncCall(fcinfo, _funcctx); \ rsi = (ReturnSetInfo *) fcinfo->resultinfo; \ rsi->isDone = ExprEndResult; \ PG_RETURN_NULL(); \ } while (0) #endif /* FUNCAPI_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/miscadmin.h����������������������������������������������������������������������������0000644�����������������00000036733�14763166026�0011344 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * miscadmin.h * This file contains general postgres administration and initialization * stuff that used to be spread out between the following files: * globals.h global variables * pdir.h directory path crud * pinit.h postgres initialization * pmod.h processing modes * Over time, this has also become the preferred place for widely known * resource-limitation stuff, such as work_mem and check_stack_depth(). * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/miscadmin.h * * NOTES * some of the information in this file should be moved to other files. * *------------------------------------------------------------------------- */ #ifndef MISCADMIN_H #define MISCADMIN_H #include <signal.h> #include "pgtime.h" /* for pg_time_t */ #define PG_BACKEND_VERSIONSTR "postgres (PostgreSQL) " PG_VERSION "\n" /***************************************************************************** * System interrupt and critical section handling * * There are two types of interrupts that a running backend needs to accept * without messing up its state: QueryCancel (SIGINT) and ProcDie (SIGTERM). * In both cases, we need to be able to clean up the current transaction * gracefully, so we can't respond to the interrupt instantaneously --- * there's no guarantee that internal data structures would be self-consistent * if the code is interrupted at an arbitrary instant. Instead, the signal * handlers set flags that are checked periodically during execution. * * The CHECK_FOR_INTERRUPTS() macro is called at strategically located spots * where it is normally safe to accept a cancel or die interrupt. In some * cases, we invoke CHECK_FOR_INTERRUPTS() inside low-level subroutines that * might sometimes be called in contexts that do *not* want to allow a cancel * or die interrupt. The HOLD_INTERRUPTS() and RESUME_INTERRUPTS() macros * allow code to ensure that no cancel or die interrupt will be accepted, * even if CHECK_FOR_INTERRUPTS() gets called in a subroutine. The interrupt * will be held off until CHECK_FOR_INTERRUPTS() is done outside any * HOLD_INTERRUPTS() ... RESUME_INTERRUPTS() section. * * There is also a mechanism to prevent query cancel interrupts, while still * allowing die interrupts: HOLD_CANCEL_INTERRUPTS() and * RESUME_CANCEL_INTERRUPTS(). * * Special mechanisms are used to let an interrupt be accepted when we are * waiting for a lock or when we are waiting for command input (but, of * course, only if the interrupt holdoff counter is zero). See the * related code for details. * * A lost connection is handled similarly, although the loss of connection * does not raise a signal, but is detected when we fail to write to the * socket. If there was a signal for a broken connection, we could make use of * it by setting ClientConnectionLost in the signal handler. * * A related, but conceptually distinct, mechanism is the "critical section" * mechanism. A critical section not only holds off cancel/die interrupts, * but causes any ereport(ERROR) or ereport(FATAL) to become ereport(PANIC) * --- that is, a system-wide reset is forced. Needless to say, only really * *critical* code should be marked as a critical section! Currently, this * mechanism is only used for XLOG-related code. * *****************************************************************************/ /* in globals.c */ /* these are marked volatile because they are set by signal handlers: */ extern PGDLLIMPORT volatile bool InterruptPending; extern volatile bool QueryCancelPending; extern volatile bool ProcDiePending; extern PGDLLIMPORT volatile sig_atomic_t ConfigReloadPending; extern volatile bool ClientConnectionLost; /* these are marked volatile because they are examined by signal handlers: */ extern volatile bool ImmediateInterruptOK; extern PGDLLIMPORT volatile uint32 InterruptHoldoffCount; extern PGDLLIMPORT volatile uint32 QueryCancelHoldoffCount; extern PGDLLIMPORT volatile uint32 CritSectionCount; /* in tcop/postgres.c */ extern void ProcessInterrupts(void); #ifndef WIN32 #define CHECK_FOR_INTERRUPTS() \ do { \ if (InterruptPending) \ ProcessInterrupts(); \ } while(0) #else /* WIN32 */ #define CHECK_FOR_INTERRUPTS() \ do { \ if (UNBLOCKED_SIGNAL_QUEUE()) \ pgwin32_dispatch_queued_signals(); \ if (InterruptPending) \ ProcessInterrupts(); \ } while(0) #endif /* WIN32 */ #define HOLD_INTERRUPTS() (InterruptHoldoffCount++) #define RESUME_INTERRUPTS() \ do { \ Assert(InterruptHoldoffCount > 0); \ InterruptHoldoffCount--; \ } while(0) #define HOLD_CANCEL_INTERRUPTS() (QueryCancelHoldoffCount++) #define RESUME_CANCEL_INTERRUPTS() \ do { \ Assert(QueryCancelHoldoffCount > 0); \ QueryCancelHoldoffCount--; \ } while(0) #define START_CRIT_SECTION() (CritSectionCount++) #define END_CRIT_SECTION() \ do { \ Assert(CritSectionCount > 0); \ CritSectionCount--; \ } while(0) /***************************************************************************** * globals.h -- * *****************************************************************************/ /* * from utils/init/globals.c */ extern pid_t PostmasterPid; extern bool IsPostmasterEnvironment; extern PGDLLIMPORT bool IsUnderPostmaster; extern bool IsBinaryUpgrade; extern bool ExitOnAnyError; extern PGDLLIMPORT char *DataDir; extern PGDLLIMPORT int NBuffers; extern int MaxBackends; extern int MaxConnections; extern PGDLLIMPORT int MyProcPid; extern PGDLLIMPORT pg_time_t MyStartTime; extern PGDLLIMPORT struct Port *MyProcPort; extern long MyCancelKey; extern int MyPMChildSlot; extern char OutputFileName[]; extern PGDLLIMPORT char my_exec_path[]; extern char pkglib_path[]; #ifdef EXEC_BACKEND extern char postgres_exec_path[]; #endif /* * done in storage/backendid.h for now. * * extern BackendId MyBackendId; */ extern PGDLLIMPORT Oid MyDatabaseId; extern PGDLLIMPORT Oid MyDatabaseTableSpace; /* * Date/Time Configuration * * DateStyle defines the output formatting choice for date/time types: * USE_POSTGRES_DATES specifies traditional Postgres format * USE_ISO_DATES specifies ISO-compliant format * USE_SQL_DATES specifies Oracle/Ingres-compliant format * USE_GERMAN_DATES specifies German-style dd.mm/yyyy * * DateOrder defines the field order to be assumed when reading an * ambiguous date (anything not in YYYY-MM-DD format, with a four-digit * year field first, is taken to be ambiguous): * DATEORDER_YMD specifies field order yy-mm-dd * DATEORDER_DMY specifies field order dd-mm-yy ("European" convention) * DATEORDER_MDY specifies field order mm-dd-yy ("US" convention) * * In the Postgres and SQL DateStyles, DateOrder also selects output field * order: day comes before month in DMY style, else month comes before day. * * The user-visible "DateStyle" run-time parameter subsumes both of these. */ /* valid DateStyle values */ #define USE_POSTGRES_DATES 0 #define USE_ISO_DATES 1 #define USE_SQL_DATES 2 #define USE_GERMAN_DATES 3 #define USE_XSD_DATES 4 /* valid DateOrder values */ #define DATEORDER_YMD 0 #define DATEORDER_DMY 1 #define DATEORDER_MDY 2 extern int DateStyle; extern int DateOrder; /* * IntervalStyles * INTSTYLE_POSTGRES Like Postgres < 8.4 when DateStyle = 'iso' * INTSTYLE_POSTGRES_VERBOSE Like Postgres < 8.4 when DateStyle != 'iso' * INTSTYLE_SQL_STANDARD SQL standard interval literals * INTSTYLE_ISO_8601 ISO-8601-basic formatted intervals */ #define INTSTYLE_POSTGRES 0 #define INTSTYLE_POSTGRES_VERBOSE 1 #define INTSTYLE_SQL_STANDARD 2 #define INTSTYLE_ISO_8601 3 extern int IntervalStyle; /* * HasCTZSet is true if user has set timezone as a numeric offset from UTC. * If so, CTimeZone is the timezone offset in seconds (using the Unix-ish * sign convention, ie, positive offset is west of UTC, rather than the * SQL-ish convention that positive is east of UTC). */ extern bool HasCTZSet; extern int CTimeZone; #define MAXTZLEN 10 /* max TZ name len, not counting tr. null */ extern bool enableFsync; extern bool allowSystemTableMods; extern PGDLLIMPORT int work_mem; extern PGDLLIMPORT int maintenance_work_mem; extern int VacuumCostPageHit; extern int VacuumCostPageMiss; extern int VacuumCostPageDirty; extern int VacuumCostLimit; extern int VacuumCostDelay; extern int VacuumPageHit; extern int VacuumPageMiss; extern int VacuumPageDirty; extern int VacuumCostBalance; extern bool VacuumCostActive; /* in tcop/postgres.c */ #if defined(__ia64__) || defined(__ia64) typedef struct { char *stack_base_ptr; char *register_stack_base_ptr; } pg_stack_base_t; #else typedef char *pg_stack_base_t; #endif extern pg_stack_base_t set_stack_base(void); extern void restore_stack_base(pg_stack_base_t base); extern void check_stack_depth(void); extern bool stack_is_too_deep(void); extern void PostgresSigHupHandler(SIGNAL_ARGS); /* in tcop/utility.c */ extern void PreventCommandIfReadOnly(const char *cmdname); extern void PreventCommandDuringRecovery(const char *cmdname); /* in utils/misc/guc.c */ extern int trace_recovery_messages; extern int trace_recovery(int trace_level); /***************************************************************************** * pdir.h -- * * POSTGRES directory path definitions. * *****************************************************************************/ /* flags to be OR'd to form sec_context */ #define SECURITY_LOCAL_USERID_CHANGE 0x0001 #define SECURITY_RESTRICTED_OPERATION 0x0002 extern char *DatabasePath; /* now in utils/init/miscinit.c */ extern void SetDatabasePath(const char *path); extern char *GetUserNameFromId(Oid roleid); extern Oid GetUserId(void); extern Oid GetOuterUserId(void); extern Oid GetSessionUserId(void); extern void GetUserIdAndSecContext(Oid *userid, int *sec_context); extern void SetUserIdAndSecContext(Oid userid, int sec_context); extern bool InLocalUserIdChange(void); extern bool InSecurityRestrictedOperation(void); extern void GetUserIdAndContext(Oid *userid, bool *sec_def_context); extern void SetUserIdAndContext(Oid userid, bool sec_def_context); extern void InitializeSessionUserId(const char *rolename); extern void InitializeSessionUserIdStandalone(void); extern void SetSessionAuthorization(Oid userid, bool is_superuser); extern Oid GetCurrentRoleId(void); extern void SetCurrentRoleId(Oid roleid, bool is_superuser); extern void SetDataDir(const char *dir); extern void ChangeToDataDir(void); extern char *make_absolute_path(const char *path); /* in utils/misc/superuser.c */ extern bool superuser(void); /* current user is superuser */ extern bool superuser_arg(Oid roleid); /* given user is superuser */ /***************************************************************************** * pmod.h -- * * POSTGRES processing mode definitions. * *****************************************************************************/ /* * Description: * There are three processing modes in POSTGRES. They are * BootstrapProcessing or "bootstrap," InitProcessing or * "initialization," and NormalProcessing or "normal." * * The first two processing modes are used during special times. When the * system state indicates bootstrap processing, transactions are all given * transaction id "one" and are consequently guaranteed to commit. This mode * is used during the initial generation of template databases. * * Initialization mode: used while starting a backend, until all normal * initialization is complete. Some code behaves differently when executed * in this mode to enable system bootstrapping. * * If a POSTGRES backend process is in normal mode, then all code may be * executed normally. */ typedef enum ProcessingMode { BootstrapProcessing, /* bootstrap creation of template database */ InitProcessing, /* initializing system */ NormalProcessing /* normal processing */ } ProcessingMode; extern ProcessingMode Mode; #define IsBootstrapProcessingMode() (Mode == BootstrapProcessing) #define IsInitProcessingMode() (Mode == InitProcessing) #define IsNormalProcessingMode() (Mode == NormalProcessing) #define GetProcessingMode() Mode #define SetProcessingMode(mode) \ do { \ AssertArg((mode) == BootstrapProcessing || \ (mode) == InitProcessing || \ (mode) == NormalProcessing); \ Mode = (mode); \ } while(0) /* * Auxiliary-process type identifiers. These used to be in bootstrap.h * but it seems saner to have them here, with the ProcessingMode stuff. * The MyAuxProcType global is defined and set in bootstrap.c. */ typedef enum { NotAnAuxProcess = -1, CheckerProcess = 0, BootstrapProcess, StartupProcess, BgWriterProcess, CheckpointerProcess, WalWriterProcess, WalReceiverProcess, NUM_AUXPROCTYPES /* Must be last! */ } AuxProcType; extern AuxProcType MyAuxProcType; #define AmBootstrapProcess() (MyAuxProcType == BootstrapProcess) #define AmStartupProcess() (MyAuxProcType == StartupProcess) #define AmBackgroundWriterProcess() (MyAuxProcType == BgWriterProcess) #define AmCheckpointerProcess() (MyAuxProcType == CheckpointerProcess) #define AmWalWriterProcess() (MyAuxProcType == WalWriterProcess) #define AmWalReceiverProcess() (MyAuxProcType == WalReceiverProcess) /***************************************************************************** * pinit.h -- * * POSTGRES initialization and cleanup definitions. * *****************************************************************************/ /* in utils/init/postinit.c */ extern void pg_split_opts(char **argv, int *argcp, char *optstr); extern void InitPostgres(const char *in_dbname, Oid dboid, const char *username, char *out_dbname); extern void BaseInit(void); /* in utils/init/miscinit.c */ extern bool IgnoreSystemIndexes; extern PGDLLIMPORT bool process_shared_preload_libraries_in_progress; extern char *shared_preload_libraries_string; extern char *local_preload_libraries_string; /* * As of 9.1, the contents of the data-directory lock file are: * * line # * 1 postmaster PID (or negative of a standalone backend's PID) * 2 data directory path * 3 postmaster start timestamp (time_t representation) * 4 port number * 5 first Unix socket directory path (empty if none) * 6 first listen_address (IP address or "*"; empty if no TCP port) * 7 shared memory key (not present on Windows) * * Lines 6 and up are added via AddToDataDirLockFile() after initial file * creation; they have to be ordered according to time of addition. * * The socket lock file, if used, has the same contents as lines 1-5. */ #define LOCK_FILE_LINE_PID 1 #define LOCK_FILE_LINE_DATA_DIR 2 #define LOCK_FILE_LINE_START_TIME 3 #define LOCK_FILE_LINE_PORT 4 #define LOCK_FILE_LINE_SOCKET_DIR 5 #define LOCK_FILE_LINE_LISTEN_ADDR 6 #define LOCK_FILE_LINE_SHMEM_KEY 7 extern void CreateDataDirLockFile(bool amPostmaster); extern void CreateSocketLockFile(const char *socketfile, bool amPostmaster, const char *socketDir); extern void TouchSocketLockFiles(void); extern void AddToDataDirLockFile(int target_line, const char *str); extern bool RecheckDataDirLockFile(void); extern void ValidatePgVersion(const char *path); extern void process_shared_preload_libraries(void); extern void process_local_preload_libraries(void); extern void pg_bindtextdomain(const char *domain); extern bool has_rolreplication(Oid roleid); /* in access/transam/xlog.c */ extern bool BackupInProgress(void); extern void CancelBackup(void); #endif /* MISCADMIN_H */ �������������������������������������pgsql/server/port/netbsd.h��������������������������������������������������������������������������0000644�����������������00000000040�14763166026�0011621 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/netbsd.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/freebsd.h�������������������������������������������������������������������������0000644�����������������00000000041�14763166026�0011755 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/freebsd.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/hpux.h����������������������������������������������������������������������������0000644�����������������00000000064�14763166026�0011334 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/hpux.h */ /* nothing needed */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/aix.h�����������������������������������������������������������������������������0000644�����������������00000000122�14763166026�0011124 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * src/include/port/aix.h */ #define CLASS_CONFLICT #define DISABLE_XOPEN_NLS ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/unixware.h������������������������������������������������������������������������0000644�����������������00000000427�14763166026�0012215 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * src/include/port/unixware.h * * see src/backend/libpq/pqcomm.c */ #define SCO_ACCEPT_BUG /*************************************** * Define this if you are compiling with * the native UNIXWARE C compiler. ***************************************/ #define USE_UNIVEL_CC �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/irix.h����������������������������������������������������������������������������0000644�����������������00000000277�14763166026�0011331 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/irix.h */ /* * IRIX 6.5.26f and 6.5.22f (at least) have a strtod() that accepts * "infinity", but leaves endptr pointing to "inity". */ #define HAVE_BUGGY_IRIX_STRTOD ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/solaris.h�������������������������������������������������������������������������0000644�����������������00000002021�14763166026�0012017 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/solaris.h */ /* * Sort this out for all operating systems some time. The __xxx * symbols are defined on both GCC and Solaris CC, although GCC * doesn't document them. The __xxx__ symbols are only on GCC. */ #if defined(__i386) && !defined(__i386__) #define __i386__ #endif #if defined(__amd64) && !defined(__amd64__) #define __amd64__ #endif #if defined(__x86_64) && !defined(__x86_64__) #define __x86_64__ #endif #if defined(__sparc) && !defined(__sparc__) #define __sparc__ #endif #if defined(__i386__) #include <sys/isa_defs.h> #endif /* * Many versions of Solaris have broken strtod() --- see bug #4751182. * This has been fixed in current versions of Solaris: * * http://sunsolve.sun.com/search/document.do?assetkey=1-21-108993-62-1&searchclause=108993-62 * http://sunsolve.sun.com/search/document.do?assetkey=1-21-112874-34-1&searchclause=112874-34 * * However, many people might not have patched versions, so * still use our own fix for the buggy version. */ #define HAVE_BUGGY_SOLARIS_STRTOD ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/win32_msvc/sys/time.h�������������������������������������������������������������0000644�����������������00000000055�14763166026�0014116 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/win32_msvc/sys/time.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/win32_msvc/sys/file.h�������������������������������������������������������������0000644�����������������00000000055�14763166026�0014077 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/win32_msvc/sys/file.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/win32_msvc/sys/param.h������������������������������������������������������������0000644�����������������00000000056�14763166026�0014261 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/win32_msvc/sys/param.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/win32_msvc/dirent.h���������������������������������������������������������������0000644�����������������00000000633�14763166026�0013631 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Headers for port/dirent.c, win32 native implementation of dirent functions * * src/include/port/win32_msvc/dirent.h */ #ifndef _WIN32VC_DIRENT_H #define _WIN32VC_DIRENT_H struct dirent { long d_ino; unsigned short d_reclen; unsigned short d_namlen; char d_name[MAX_PATH]; }; typedef struct DIR DIR; DIR *opendir(const char *); struct dirent *readdir(DIR *); int closedir(DIR *); #endif �����������������������������������������������������������������������������������������������������pgsql/server/port/win32_msvc/utime.h����������������������������������������������������������������0000644�����������������00000000052�14763166026�0013462 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/win32_msvc/utime.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/win32_msvc/unistd.h���������������������������������������������������������������0000644�����������������00000000053�14763166026�0013646 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/win32_msvc/unistd.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/linux.h���������������������������������������������������������������������������0000644�����������������00000002034�14763166026�0011506 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/linux.h */ /* * As of July 2007, all known versions of the Linux kernel will sometimes * return EIDRM for a shmctl() operation when EINVAL is correct (it happens * when the low-order 15 bits of the supplied shm ID match the slot number * assigned to a newer shmem segment). We deal with this by assuming that * EIDRM means EINVAL in PGSharedMemoryIsInUse(). This is reasonably safe * since in fact Linux has no excuse for ever returning EIDRM; it doesn't * track removed segments in a way that would allow distinguishing them from * private ones. But someday that code might get upgraded, and we'd have * to have a kernel version test here. */ #define HAVE_LINUX_EIDRM_BUG /* * Set the default wal_sync_method to fdatasync. With recent Linux versions, * xlogdefs.h's normal rules will prefer open_datasync, which (a) doesn't * perform better and (b) causes outright failures on ext4 data=journal * filesystems, because those don't support O_DIRECT. */ #define PLATFORM_DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/cygwin.h��������������������������������������������������������������������������0000644�����������������00000000664�14763166026�0011656 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/cygwin.h */ #include <cygwin/version.h> /* * Check for b20.1 and disable AF_UNIX family socket support. */ #if CYGWIN_VERSION_DLL_MAJOR < 1001 #undef HAVE_UNIX_SOCKETS #endif #if __GNUC__ && ! defined (__declspec) #error You need egcs 1.1 or newer for compiling! #endif #ifdef BUILDING_DLL #define PGDLLIMPORT __declspec (dllexport) #else #define PGDLLIMPORT __declspec (dllimport) #endif #define PGDLLEXPORT ����������������������������������������������������������������������������pgsql/server/port/sco.h�����������������������������������������������������������������������������0000644�����������������00000000163�14763166026�0011134 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * src/include/port/sco.h * * see src/backend/libpq/pqcomm.c */ #define SCO_ACCEPT_BUG #define USE_UNIVEL_CC �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/openbsd.h�������������������������������������������������������������������������0000644�����������������00000000041�14763166026�0011775 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/openbsd.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/win32/dlfcn.h���������������������������������������������������������������������0000644�����������������00000000045�14763166026�0012377 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/win32/dlfcn.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/win32/pwd.h�����������������������������������������������������������������������0000644�����������������00000000047�14763166026�0012105 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * src/include/port/win32/pwd.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/win32/grp.h�����������������������������������������������������������������������0000644�����������������00000000043�14763166026�0012077 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/win32/grp.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/win32/sys/wait.h������������������������������������������������������������������0000644�����������������00000000054�14763166026�0013073 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * src/include/port/win32/sys/wait.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/win32/sys/socket.h����������������������������������������������������������������0000644�����������������00000001270�14763166026�0013420 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * src/include/port/win32/sys/socket.h */ #ifndef WIN32_SYS_SOCKET_H #define WIN32_SYS_SOCKET_H /* * Unfortunately, <wingdi.h> of VC++ also defines ERROR. * To avoid the conflict, we include <windows.h> here and undefine ERROR * immediately. * * Note: Don't include <wingdi.h> directly. It causes compile errors. */ #include <winsock2.h> #include <ws2tcpip.h> #include <windows.h> #undef ERROR #undef small /* Restore old ERROR value */ #ifdef PGERROR #define ERROR PGERROR #endif /* * we can't use the windows gai_strerror{AW} functions because * they are defined inline in the MS header files. So we'll use our * own */ #undef gai_strerror #endif /* WIN32_SYS_SOCKET_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/win32/netdb.h���������������������������������������������������������������������0000644�����������������00000000045�14763166026�0012405 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/win32/netdb.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/win32/netinet/in.h����������������������������������������������������������������0000644�����������������00000000103�14763166026�0013360 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/win32/netinet/in.h */ #include <sys/socket.h> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/win32/arpa/inet.h�����������������������������������������������������������������0000644�����������������00000000102�14763166026�0013165 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/win32/arpa/inet.h */ #include <sys/socket.h> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/win32.h���������������������������������������������������������������������������0000644�����������������00000031525�14763166026�0011320 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/win32.h */ #if defined(_MSC_VER) || defined(__BORLANDC__) #define WIN32_ONLY_COMPILER #endif /* * Make sure _WIN32_WINNT has the minimum required value. * Leave a higher value in place. */ #if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0501 #undef _WIN32_WINNT #endif #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0501 #endif /* * Always build with SSPI support. Keep it as a #define in case * we want a switch to disable it sometime in the future. */ #ifndef __BORLANDC__ #define ENABLE_SSPI 1 #endif /* undefine and redefine after #include */ #undef mkdir #undef ERROR /* * The Mingw64 headers choke if this is already defined - they * define it themselves. */ #if !defined(__MINGW64_VERSION_MAJOR) || defined(WIN32_ONLY_COMPILER) #define _WINSOCKAPI_ #endif #include <winsock2.h> #include <ws2tcpip.h> #include <windows.h> #undef small #include <process.h> #include <signal.h> #include <errno.h> #include <direct.h> #ifndef __BORLANDC__ #include <sys/utime.h> /* for non-unicode version */ #endif #undef near /* Must be here to avoid conflicting with prototype in windows.h */ #define mkdir(a,b) mkdir(a) #define ftruncate(a,b) chsize(a,b) /* Windows doesn't have fsync() as such, use _commit() */ #define fsync(fd) _commit(fd) /* * For historical reasons, we allow setting wal_sync_method to * fsync_writethrough on Windows, even though it's really identical to fsync * (both code paths wind up at _commit()). */ #define HAVE_FSYNC_WRITETHROUGH #define FSYNC_WRITETHROUGH_IS_FSYNC #define USES_WINSOCK /* defines for dynamic linking on Win32 platform */ #if defined(WIN32) || defined(__CYGWIN__) #if __GNUC__ && ! defined (__declspec) #error You need egcs 1.1 or newer for compiling! #endif #ifdef BUILDING_DLL #define PGDLLIMPORT __declspec (dllexport) #else /* not BUILDING_DLL */ #define PGDLLIMPORT __declspec (dllimport) #endif #ifdef _MSC_VER #define PGDLLEXPORT __declspec (dllexport) #else #define PGDLLEXPORT #endif #else /* not CYGWIN, not MSVC, not MingW */ #define PGDLLIMPORT #define PGDLLEXPORT #endif /* * IPC defines */ #undef HAVE_UNION_SEMUN #define HAVE_UNION_SEMUN 1 #define IPC_RMID 256 #define IPC_CREAT 512 #define IPC_EXCL 1024 #define IPC_PRIVATE 234564 #define IPC_NOWAIT 2048 #define IPC_STAT 4096 #define EACCESS 2048 #ifndef EIDRM #define EIDRM 4096 #endif #define SETALL 8192 #define GETNCNT 16384 #define GETVAL 65536 #define SETVAL 131072 #define GETPID 262144 /* * Signal stuff * * For WIN32, there is no wait() call so there are no wait() macros * to interpret the return value of system(). Instead, system() * return values < 0x100 are used for exit() termination, and higher * values are used to indicated non-exit() termination, which is * similar to a unix-style signal exit (think SIGSEGV == * STATUS_ACCESS_VIOLATION). Return values are broken up into groups: * * http://msdn2.microsoft.com/en-gb/library/aa489609.aspx * * NT_SUCCESS 0 - 0x3FFFFFFF * NT_INFORMATION 0x40000000 - 0x7FFFFFFF * NT_WARNING 0x80000000 - 0xBFFFFFFF * NT_ERROR 0xC0000000 - 0xFFFFFFFF * * Effectively, we don't care on the severity of the return value from * system(), we just need to know if it was because of exit() or generated * by the system, and it seems values >= 0x100 are system-generated. * See this URL for a list of WIN32 STATUS_* values: * * Wine (URL used in our error messages) - * http://source.winehq.org/source/include/ntstatus.h * Descriptions - http://www.comp.nus.edu.sg/~wuyongzh/my_doc/ntstatus.txt * MS SDK - http://www.nologs.com/ntstatus.html * * It seems the exception lists are in both ntstatus.h and winnt.h, but * ntstatus.h has a more comprehensive list, and it only contains * exception values, rather than winnt, which contains lots of other * things: * * http://www.microsoft.com/msj/0197/exception/exception.aspx * * The ExceptionCode parameter is the number that the operating system * assigned to the exception. You can see a list of various exception codes * in WINNT.H by searching for #defines that start with "STATUS_". For * example, the code for the all-too-familiar STATUS_ACCESS_VIOLATION is * 0xC0000005. A more complete set of exception codes can be found in * NTSTATUS.H from the Windows NT DDK. * * Some day we might want to print descriptions for the most common * exceptions, rather than printing an include file name. We could use * RtlNtStatusToDosError() and pass to FormatMessage(), which can print * the text of error values, but MinGW does not support * RtlNtStatusToDosError(). */ #define WIFEXITED(w) (((w) & 0XFFFFFF00) == 0) #define WIFSIGNALED(w) (!WIFEXITED(w)) #define WEXITSTATUS(w) (w) #define WTERMSIG(w) (w) #define sigmask(sig) ( 1 << ((sig)-1) ) /* Signal function return values */ #undef SIG_DFL #undef SIG_ERR #undef SIG_IGN #define SIG_DFL ((pqsigfunc)0) #define SIG_ERR ((pqsigfunc)-1) #define SIG_IGN ((pqsigfunc)1) /* Some extra signals */ #define SIGHUP 1 #define SIGQUIT 3 #define SIGTRAP 5 #define SIGABRT 22 /* Set to match W32 value -- not UNIX value */ #define SIGKILL 9 #define SIGPIPE 13 #define SIGALRM 14 #define SIGSTOP 17 #define SIGTSTP 18 #define SIGCONT 19 #define SIGCHLD 20 #define SIGTTIN 21 #define SIGTTOU 22 /* Same as SIGABRT -- no problem, I hope */ #define SIGWINCH 28 #ifndef __BORLANDC__ #define SIGUSR1 30 #define SIGUSR2 31 #endif /* * New versions of mingw have gettimeofday() and also declare * struct timezone to support it. */ #ifndef HAVE_GETTIMEOFDAY struct timezone { int tz_minuteswest; /* Minutes west of GMT. */ int tz_dsttime; /* Nonzero if DST is ever in effect. */ }; #endif /* for setitimer in backend/port/win32/timer.c */ #define ITIMER_REAL 0 struct itimerval { struct timeval it_interval; struct timeval it_value; }; int setitimer(int which, const struct itimerval * value, struct itimerval * ovalue); /* * WIN32 does not provide 64-bit off_t, but does provide the functions operating * with 64-bit offsets. */ #define pgoff_t __int64 #ifdef WIN32_ONLY_COMPILER #define fseeko(stream, offset, origin) _fseeki64(stream, offset, origin) #define ftello(stream) _ftelli64(stream) #else #ifndef fseeko #define fseeko(stream, offset, origin) fseeko64(stream, offset, origin) #endif #ifndef ftello #define ftello(stream) ftello64(stream) #endif #endif /* * Supplement to <sys/types.h>. * * Perl already has typedefs for uid_t and gid_t. */ #ifndef PLPERL_HAVE_UID_GID typedef int uid_t; typedef int gid_t; #endif typedef long key_t; #ifdef WIN32_ONLY_COMPILER typedef int pid_t; #endif /* * Supplement to <sys/stat.h>. */ #define lstat(path, sb) stat((path), (sb)) /* * Supplement to <fcntl.h>. * This is the same value as _O_NOINHERIT in the MS header file. This is * to ensure that we don't collide with a future definition. It means * we cannot use _O_NOINHERIT ourselves. */ #define O_DSYNC 0x0080 /* * Supplement to <errno.h>. * * We redefine network-related Berkeley error symbols as the corresponding WSA * constants. This allows elog.c to recognize them as being in the Winsock * error code range and pass them off to pgwin32_socket_strerror(), since * Windows' version of plain strerror() won't cope. Note that this will break * if these names are used for anything else besides Windows Sockets errors. * See TranslateSocketError() when changing this list. */ #undef EAGAIN #define EAGAIN WSAEWOULDBLOCK #undef EINTR #define EINTR WSAEINTR #undef EMSGSIZE #define EMSGSIZE WSAEMSGSIZE #undef EAFNOSUPPORT #define EAFNOSUPPORT WSAEAFNOSUPPORT #undef EWOULDBLOCK #define EWOULDBLOCK WSAEWOULDBLOCK #undef ECONNABORTED #define ECONNABORTED WSAECONNABORTED #undef ECONNRESET #define ECONNRESET WSAECONNRESET #undef EINPROGRESS #define EINPROGRESS WSAEINPROGRESS #undef EISCONN #define EISCONN WSAEISCONN #undef ENOBUFS #define ENOBUFS WSAENOBUFS #undef EPROTONOSUPPORT #define EPROTONOSUPPORT WSAEPROTONOSUPPORT #undef ECONNREFUSED #define ECONNREFUSED WSAECONNREFUSED #undef ENOTSOCK #define ENOTSOCK WSAENOTSOCK #undef EOPNOTSUPP #define EOPNOTSUPP WSAEOPNOTSUPP #undef EADDRINUSE #define EADDRINUSE WSAEADDRINUSE #undef EADDRNOTAVAIL #define EADDRNOTAVAIL WSAEADDRNOTAVAIL #undef EHOSTUNREACH #define EHOSTUNREACH WSAEHOSTUNREACH #undef ENOTCONN #define ENOTCONN WSAENOTCONN /* * Extended locale functions with gratuitous underscore prefixes. * (These APIs are nevertheless fully documented by Microsoft.) */ #define locale_t _locale_t #define tolower_l _tolower_l #define toupper_l _toupper_l #define towlower_l _towlower_l #define towupper_l _towupper_l #define isdigit_l _isdigit_l #define iswdigit_l _iswdigit_l #define isalpha_l _isalpha_l #define iswalpha_l _iswalpha_l #define isalnum_l _isalnum_l #define iswalnum_l _iswalnum_l #define isupper_l _isupper_l #define iswupper_l _iswupper_l #define islower_l _islower_l #define iswlower_l _iswlower_l #define isgraph_l _isgraph_l #define iswgraph_l _iswgraph_l #define isprint_l _isprint_l #define iswprint_l _iswprint_l #define ispunct_l _ispunct_l #define iswpunct_l _iswpunct_l #define isspace_l _isspace_l #define iswspace_l _iswspace_l #define strcoll_l _strcoll_l #define wcscoll_l _wcscoll_l #define wcstombs_l _wcstombs_l #define mbstowcs_l _mbstowcs_l /* In backend/port/win32/signal.c */ extern PGDLLIMPORT volatile int pg_signal_queue; extern PGDLLIMPORT int pg_signal_mask; extern HANDLE pgwin32_signal_event; extern HANDLE pgwin32_initial_signal_pipe; #define UNBLOCKED_SIGNAL_QUEUE() (pg_signal_queue & ~pg_signal_mask) void pgwin32_signal_initialize(void); HANDLE pgwin32_create_signal_listener(pid_t pid); void pgwin32_dispatch_queued_signals(void); void pg_queue_signal(int signum); /* In backend/port/win32/socket.c */ #ifndef FRONTEND #define socket(af, type, protocol) pgwin32_socket(af, type, protocol) #define bind(s, addr, addrlen) pgwin32_bind(s, addr, addrlen) #define listen(s, backlog) pgwin32_listen(s, backlog) #define accept(s, addr, addrlen) pgwin32_accept(s, addr, addrlen) #define connect(s, name, namelen) pgwin32_connect(s, name, namelen) #define select(n, r, w, e, timeout) pgwin32_select(n, r, w, e, timeout) #define recv(s, buf, len, flags) pgwin32_recv(s, buf, len, flags) #define send(s, buf, len, flags) pgwin32_send(s, buf, len, flags) SOCKET pgwin32_socket(int af, int type, int protocol); int pgwin32_bind(SOCKET s, struct sockaddr * addr, int addrlen); int pgwin32_listen(SOCKET s, int backlog); SOCKET pgwin32_accept(SOCKET s, struct sockaddr * addr, int *addrlen); int pgwin32_connect(SOCKET s, const struct sockaddr * name, int namelen); int pgwin32_select(int nfds, fd_set *readfs, fd_set *writefds, fd_set *exceptfds, const struct timeval * timeout); int pgwin32_recv(SOCKET s, char *buf, int len, int flags); int pgwin32_send(SOCKET s, const void *buf, int len, int flags); const char *pgwin32_socket_strerror(int err); int pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout); extern int pgwin32_noblock; /* in backend/port/win32/security.c */ extern int pgwin32_is_admin(void); extern int pgwin32_is_service(void); #endif /* in backend/port/win32_shmem.c */ extern int pgwin32_ReserveSharedMemoryRegion(HANDLE); /* in backend/port/win32/crashdump.c */ extern void pgwin32_install_crashdump_handler(void); /* in port/win32error.c */ extern void _dosmaperr(unsigned long); /* in port/win32env.c */ extern int pgwin32_putenv(const char *); extern void pgwin32_unsetenv(const char *); #define putenv(x) pgwin32_putenv(x) #define unsetenv(x) pgwin32_unsetenv(x) /* Things that exist in MingW headers, but need to be added to MSVC & BCC */ #ifdef WIN32_ONLY_COMPILER #ifndef _WIN64 typedef long ssize_t; #else typedef __int64 ssize_t; #endif #ifndef __BORLANDC__ typedef unsigned short mode_t; #define S_IRUSR _S_IREAD #define S_IWUSR _S_IWRITE #define S_IXUSR _S_IEXEC #define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) /* see also S_IRGRP etc below */ #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif /* __BORLANDC__ */ #define F_OK 0 #define W_OK 2 #define R_OK 4 #define isinf(x) ((_fpclass(x) == _FPCLASS_PINF) || (_fpclass(x) == _FPCLASS_NINF)) #define isnan(x) _isnan(x) /* Pulled from Makefile.port in mingw */ #define DLSUFFIX ".dll" #ifdef __BORLANDC__ /* for port/dirent.c */ #ifndef INVALID_FILE_ATTRIBUTES #define INVALID_FILE_ATTRIBUTES ((DWORD) -1) #endif /* for port/open.c */ #ifndef O_RANDOM #define O_RANDOM 0x0010 /* File access is primarily random */ #define O_SEQUENTIAL 0x0020 /* File access is primarily sequential */ #define O_TEMPORARY 0x0040 /* Temporary file bit */ #define O_SHORT_LIVED 0x1000 /* Temporary storage file, try not to flush */ #define _O_SHORT_LIVED O_SHORT_LIVED #endif /* ifndef O_RANDOM */ #endif /* __BORLANDC__ */ #endif /* WIN32_ONLY_COMPILER */ /* These aren't provided by either MingW or MSVC */ #ifndef __BORLANDC__ #define S_IRGRP 0 #define S_IWGRP 0 #define S_IXGRP 0 #define S_IRWXG 0 #define S_IROTH 0 #define S_IWOTH 0 #define S_IXOTH 0 #define S_IRWXO 0 #endif /* __BORLANDC__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/osf.h�����������������������������������������������������������������������������0000644�����������������00000000111�14763166026�0011130 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/osf.h */ #define NOFIXADE #define DISABLE_XOPEN_NLS �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/port/darwin.h��������������������������������������������������������������������������0000644�����������������00000000235�14763166026�0011634 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/darwin.h */ #define __darwin__ 1 #if HAVE_DECL_F_FULLFSYNC /* not present before OS X 10.3 */ #define HAVE_FSYNC_WRITETHROUGH #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/rusagestub.h���������������������������������������������������������������������������0000644�����������������00000001513�14763166026�0011550 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * rusagestub.h * Stubs for getrusage(3). * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/rusagestub.h * *------------------------------------------------------------------------- */ #ifndef RUSAGESTUB_H #define RUSAGESTUB_H #include <sys/time.h> /* for struct timeval */ #ifndef WIN32 #include <sys/times.h> /* for struct tms */ #endif #include <limits.h> /* for CLK_TCK */ #define RUSAGE_SELF 0 #define RUSAGE_CHILDREN (-1) struct rusage { struct timeval ru_utime; /* user time used */ struct timeval ru_stime; /* system time used */ }; extern int getrusage(int who, struct rusage * rusage); #endif /* RUSAGESTUB_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/pg_config_manual.h���������������������������������������������������������������������0000644�����������������00000022555�14763166026�0012665 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------ * PostgreSQL manual configuration settings * * This file contains various configuration symbols and limits. In * all cases, changing them is only useful in very rare situations or * for developers. If you edit any of these, be sure to do a *full* * rebuild (and an initdb if noted). * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/pg_config_manual.h *------------------------------------------------------------------------ */ /* * Maximum length for identifiers (e.g. table names, column names, * function names). Names actually are limited to one less byte than this, * because the length must include a trailing zero byte. * * Changing this requires an initdb. */ #define NAMEDATALEN 64 /* * Maximum number of arguments to a function. * * The minimum value is 8 (GIN indexes use 8-argument support functions). * The maximum possible value is around 600 (limited by index tuple size in * pg_proc's index; BLCKSZ larger than 8K would allow more). Values larger * than needed will waste memory and processing time, but do not directly * cost disk space. * * Changing this does not require an initdb, but it does require a full * backend recompile (including any user-defined C functions). */ #define FUNC_MAX_ARGS 100 /* * Maximum number of columns in an index. There is little point in making * this anything but a multiple of 32, because the main cost is associated * with index tuple header size (see access/itup.h). * * Changing this requires an initdb. */ #define INDEX_MAX_KEYS 32 /* * Set the upper and lower bounds of sequence values. */ #define SEQ_MAXVALUE INT64CONST(0x7FFFFFFFFFFFFFFF) #define SEQ_MINVALUE (-SEQ_MAXVALUE) /* * Number of spare LWLocks to allocate for user-defined add-on code. */ #define NUM_USER_DEFINED_LWLOCKS 4 /* * When we don't have native spinlocks, we use semaphores to simulate them. * Decreasing this value reduces consumption of OS resources; increasing it * may improve performance, but supplying a real spinlock implementation is * probably far better. */ #define NUM_SPINLOCK_SEMAPHORES 128 /* * Define this if you want to allow the lo_import and lo_export SQL * functions to be executed by ordinary users. By default these * functions are only available to the Postgres superuser. CAUTION: * These functions are SECURITY HOLES since they can read and write * any file that the PostgreSQL server has permission to access. If * you turn this on, don't say we didn't warn you. */ /* #define ALLOW_DANGEROUS_LO_FUNCTIONS */ /* * MAXPGPATH: standard size of a pathname buffer in PostgreSQL (hence, * maximum usable pathname length is one less). * * We'd use a standard system header symbol for this, if there weren't * so many to choose from: MAXPATHLEN, MAX_PATH, PATH_MAX are all * defined by different "standards", and often have different values * on the same platform! So we just punt and use a reasonably * generous setting here. */ #define MAXPGPATH 1024 /* * PG_SOMAXCONN: maximum accept-queue length limit passed to * listen(2). You'd think we should use SOMAXCONN from * <sys/socket.h>, but on many systems that symbol is much smaller * than the kernel's actual limit. In any case, this symbol need be * twiddled only if you have a kernel that refuses large limit values, * rather than silently reducing the value to what it can handle * (which is what most if not all Unixen do). */ #define PG_SOMAXCONN 10000 /* * You can try changing this if you have a machine with bytes of * another size, but no guarantee... */ #define BITS_PER_BYTE 8 /* * Preferred alignment for disk I/O buffers. On some CPUs, copies between * user space and kernel space are significantly faster if the user buffer * is aligned on a larger-than-MAXALIGN boundary. Ideally this should be * a platform-dependent value, but for now we just hard-wire it. */ #define ALIGNOF_BUFFER 32 /* * Disable UNIX sockets for certain operating systems. */ #if defined(WIN32) #undef HAVE_UNIX_SOCKETS #endif /* * Define this if your operating system supports link() */ #if !defined(WIN32) && !defined(__CYGWIN__) #define HAVE_WORKING_LINK 1 #endif /* * USE_POSIX_FADVISE controls whether Postgres will attempt to use the * posix_fadvise() kernel call. Usually the automatic configure tests are * sufficient, but some older Linux distributions had broken versions of * posix_fadvise(). If necessary you can remove the #define here. */ #if HAVE_DECL_POSIX_FADVISE && defined(HAVE_POSIX_FADVISE) #define USE_POSIX_FADVISE #endif /* * USE_PREFETCH code should be compiled only if we have a way to implement * prefetching. (This is decoupled from USE_POSIX_FADVISE because there * might in future be support for alternative low-level prefetch APIs.) */ #ifdef USE_POSIX_FADVISE #define USE_PREFETCH #endif /* * This is the default directory in which AF_UNIX socket files are * placed. Caution: changing this risks breaking your existing client * applications, which are likely to continue to look in the old * directory. But if you just hate the idea of sockets in /tmp, * here's where to twiddle it. You can also override this at runtime * with the postmaster's -k switch. */ #define DEFAULT_PGSOCKET_DIR "/var/run/postgresql" /* * The random() function is expected to yield values between 0 and * MAX_RANDOM_VALUE. Currently, all known implementations yield * 0..2^31-1, so we just hardwire this constant. We could do a * configure test if it proves to be necessary. CAUTION: Think not to * replace this with RAND_MAX. RAND_MAX defines the maximum value of * the older rand() function, which is often different from --- and * considerably inferior to --- random(). */ #define MAX_RANDOM_VALUE (0x7FFFFFFF) /* * Set the format style used by gcc to check printf type functions. We really * want the "gnu_printf" style set, which includes what glibc uses, such * as %m for error strings and %lld for 64 bit long longs. But not all gcc * compilers are known to support it, so we just use "printf" which all * gcc versions alive are known to support, except on Windows where * using "gnu_printf" style makes a dramatic difference. Maybe someday * we'll have a configure test for this, if we ever discover use of more * variants to be necessary. */ #ifdef WIN32 #define PG_PRINTF_ATTRIBUTE gnu_printf #else #define PG_PRINTF_ATTRIBUTE printf #endif /* * On PPC machines, decide whether to use the mutex hint bit in LWARX * instructions. Setting the hint bit will slightly improve spinlock * performance on POWER6 and later machines, but does nothing before that, * and will result in illegal-instruction failures on some pre-POWER4 * machines. By default we use the hint bit when building for 64-bit PPC, * which should be safe in nearly all cases. You might want to override * this if you are building 32-bit code for a known-recent PPC machine. */ #ifdef HAVE_PPC_LWARX_MUTEX_HINT /* must have assembler support in any case */ #if defined(__ppc64__) || defined(__powerpc64__) #define USE_PPC_LWARX_MUTEX_HINT #endif #endif /* * On PPC machines, decide whether to use LWSYNC instructions in place of * ISYNC and SYNC. This provides slightly better performance, but will * result in illegal-instruction failures on some pre-POWER4 machines. * By default we use LWSYNC when building for 64-bit PPC, which should be * safe in nearly all cases. */ #if defined(__ppc64__) || defined(__powerpc64__) #define USE_PPC_LWSYNC #endif /* *------------------------------------------------------------------------ * The following symbols are for enabling debugging code, not for * controlling user-visible features or resource limits. *------------------------------------------------------------------------ */ /* * Define this to cause pfree()'d memory to be cleared immediately, to * facilitate catching bugs that refer to already-freed values. * Right now, this gets defined automatically if --enable-cassert. */ #ifdef USE_ASSERT_CHECKING #define CLOBBER_FREED_MEMORY #endif /* * Define this to check memory allocation errors (scribbling on more * bytes than were allocated). Right now, this gets defined * automatically if --enable-cassert. */ #ifdef USE_ASSERT_CHECKING #define MEMORY_CONTEXT_CHECKING #endif /* * Define this to cause palloc()'d memory to be filled with random data, to * facilitate catching code that depends on the contents of uninitialized * memory. Caution: this is horrendously expensive. */ /* #define RANDOMIZE_ALLOCATED_MEMORY */ /* * Define this to force all parse and plan trees to be passed through * copyObject(), to facilitate catching errors and omissions in * copyObject(). */ /* #define COPY_PARSE_PLAN_TREES */ /* * Enable debugging print statements for lock-related operations. */ /* #define LOCK_DEBUG */ /* * Enable debugging print statements for WAL-related operations; see * also the wal_debug GUC var. */ /* #define WAL_DEBUG */ /* * Enable tracing of resource consumption during sort operations; * see also the trace_sort GUC var. For 8.1 this is enabled by default. */ #define TRACE_SORT 1 /* * Enable tracing of syncscan operations (see also the trace_syncscan GUC var). */ /* #define TRACE_SYNCSCAN */ /* * Other debug #defines (documentation, anyone?) */ /* #define HEAPDEBUGALL */ /* #define ACLDEBUG */ /* #define RTDEBUG */ ���������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/postgres.h�����������������������������������������������������������������������������0000644�����������������00000050112�14763166026�0011231 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * postgres.h * Primary include file for PostgreSQL server .c files * * This should be the first file included by PostgreSQL backend modules. * Client-side code should include postgres_fe.h instead. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1995, Regents of the University of California * * src/include/postgres.h * *------------------------------------------------------------------------- */ /* *---------------------------------------------------------------- * TABLE OF CONTENTS * * When adding stuff to this file, please try to put stuff * into the relevant section, or add new sections as appropriate. * * section description * ------- ------------------------------------------------ * 1) variable-length datatypes (TOAST support) * 2) datum type + support macros * 3) exception handling definitions * * NOTES * * In general, this file should contain declarations that are widely needed * in the backend environment, but are of no interest outside the backend. * * Simple type definitions live in c.h, where they are shared with * postgres_fe.h. We do that since those type definitions are needed by * frontend modules that want to deal with binary data transmission to or * from the backend. Type definitions in this file should be for * representations that never escape the backend, such as Datum or * TOASTed varlena objects. * *---------------------------------------------------------------- */ #ifndef POSTGRES_H #define POSTGRES_H #include "c.h" #include "utils/elog.h" #include "utils/palloc.h" /* ---------------------------------------------------------------- * Section 1: variable-length datatypes (TOAST support) * ---------------------------------------------------------------- */ /* * struct varatt_external is a "TOAST pointer", that is, the information * needed to fetch a stored-out-of-line Datum. The data is compressed * if and only if va_extsize < va_rawsize - VARHDRSZ. This struct must not * contain any padding, because we sometimes compare pointers using memcmp. * * Note that this information is stored unaligned within actual tuples, so * you need to memcpy from the tuple into a local struct variable before * you can look at these fields! (The reason we use memcmp is to avoid * having to do that just to detect equality of two TOAST pointers...) */ struct varatt_external { int32 va_rawsize; /* Original data size (includes header) */ int32 va_extsize; /* External saved size (doesn't) */ Oid va_valueid; /* Unique ID of value within TOAST table */ Oid va_toastrelid; /* RelID of TOAST table containing it */ }; /* * These structs describe the header of a varlena object that may have been * TOASTed. Generally, don't reference these structs directly, but use the * macros below. * * We use separate structs for the aligned and unaligned cases because the * compiler might otherwise think it could generate code that assumes * alignment while touching fields of a 1-byte-header varlena. */ typedef union { struct /* Normal varlena (4-byte length) */ { uint32 va_header; char va_data[1]; } va_4byte; struct /* Compressed-in-line format */ { uint32 va_header; uint32 va_rawsize; /* Original data size (excludes header) */ char va_data[1]; /* Compressed data */ } va_compressed; } varattrib_4b; typedef struct { uint8 va_header; char va_data[1]; /* Data begins here */ } varattrib_1b; typedef struct { uint8 va_header; /* Always 0x80 or 0x01 */ uint8 va_len_1be; /* Physical length of datum */ char va_data[1]; /* Data (for now always a TOAST pointer) */ } varattrib_1b_e; /* * Bit layouts for varlena headers on big-endian machines: * * 00xxxxxx 4-byte length word, aligned, uncompressed data (up to 1G) * 01xxxxxx 4-byte length word, aligned, *compressed* data (up to 1G) * 10000000 1-byte length word, unaligned, TOAST pointer * 1xxxxxxx 1-byte length word, unaligned, uncompressed data (up to 126b) * * Bit layouts for varlena headers on little-endian machines: * * xxxxxx00 4-byte length word, aligned, uncompressed data (up to 1G) * xxxxxx10 4-byte length word, aligned, *compressed* data (up to 1G) * 00000001 1-byte length word, unaligned, TOAST pointer * xxxxxxx1 1-byte length word, unaligned, uncompressed data (up to 126b) * * The "xxx" bits are the length field (which includes itself in all cases). * In the big-endian case we mask to extract the length, in the little-endian * case we shift. Note that in both cases the flag bits are in the physically * first byte. Also, it is not possible for a 1-byte length word to be zero; * this lets us disambiguate alignment padding bytes from the start of an * unaligned datum. (We now *require* pad bytes to be filled with zero!) */ /* * Endian-dependent macros. These are considered internal --- use the * external macros below instead of using these directly. * * Note: IS_1B is true for external toast records but VARSIZE_1B will return 0 * for such records. Hence you should usually check for IS_EXTERNAL before * checking for IS_1B. */ #ifdef WORDS_BIGENDIAN #define VARATT_IS_4B(PTR) \ ((((varattrib_1b *) (PTR))->va_header & 0x80) == 0x00) #define VARATT_IS_4B_U(PTR) \ ((((varattrib_1b *) (PTR))->va_header & 0xC0) == 0x00) #define VARATT_IS_4B_C(PTR) \ ((((varattrib_1b *) (PTR))->va_header & 0xC0) == 0x40) #define VARATT_IS_1B(PTR) \ ((((varattrib_1b *) (PTR))->va_header & 0x80) == 0x80) #define VARATT_IS_1B_E(PTR) \ ((((varattrib_1b *) (PTR))->va_header) == 0x80) #define VARATT_NOT_PAD_BYTE(PTR) \ (*((uint8 *) (PTR)) != 0) /* VARSIZE_4B() should only be used on known-aligned data */ #define VARSIZE_4B(PTR) \ (((varattrib_4b *) (PTR))->va_4byte.va_header & 0x3FFFFFFF) #define VARSIZE_1B(PTR) \ (((varattrib_1b *) (PTR))->va_header & 0x7F) #define VARSIZE_1B_E(PTR) \ (((varattrib_1b_e *) (PTR))->va_len_1be) #define SET_VARSIZE_4B(PTR,len) \ (((varattrib_4b *) (PTR))->va_4byte.va_header = (len) & 0x3FFFFFFF) #define SET_VARSIZE_4B_C(PTR,len) \ (((varattrib_4b *) (PTR))->va_4byte.va_header = ((len) & 0x3FFFFFFF) | 0x40000000) #define SET_VARSIZE_1B(PTR,len) \ (((varattrib_1b *) (PTR))->va_header = (len) | 0x80) #define SET_VARSIZE_1B_E(PTR,len) \ (((varattrib_1b_e *) (PTR))->va_header = 0x80, \ ((varattrib_1b_e *) (PTR))->va_len_1be = (len)) #else /* !WORDS_BIGENDIAN */ #define VARATT_IS_4B(PTR) \ ((((varattrib_1b *) (PTR))->va_header & 0x01) == 0x00) #define VARATT_IS_4B_U(PTR) \ ((((varattrib_1b *) (PTR))->va_header & 0x03) == 0x00) #define VARATT_IS_4B_C(PTR) \ ((((varattrib_1b *) (PTR))->va_header & 0x03) == 0x02) #define VARATT_IS_1B(PTR) \ ((((varattrib_1b *) (PTR))->va_header & 0x01) == 0x01) #define VARATT_IS_1B_E(PTR) \ ((((varattrib_1b *) (PTR))->va_header) == 0x01) #define VARATT_NOT_PAD_BYTE(PTR) \ (*((uint8 *) (PTR)) != 0) /* VARSIZE_4B() should only be used on known-aligned data */ #define VARSIZE_4B(PTR) \ ((((varattrib_4b *) (PTR))->va_4byte.va_header >> 2) & 0x3FFFFFFF) #define VARSIZE_1B(PTR) \ ((((varattrib_1b *) (PTR))->va_header >> 1) & 0x7F) #define VARSIZE_1B_E(PTR) \ (((varattrib_1b_e *) (PTR))->va_len_1be) #define SET_VARSIZE_4B(PTR,len) \ (((varattrib_4b *) (PTR))->va_4byte.va_header = (((uint32) (len)) << 2)) #define SET_VARSIZE_4B_C(PTR,len) \ (((varattrib_4b *) (PTR))->va_4byte.va_header = (((uint32) (len)) << 2) | 0x02) #define SET_VARSIZE_1B(PTR,len) \ (((varattrib_1b *) (PTR))->va_header = (((uint8) (len)) << 1) | 0x01) #define SET_VARSIZE_1B_E(PTR,len) \ (((varattrib_1b_e *) (PTR))->va_header = 0x01, \ ((varattrib_1b_e *) (PTR))->va_len_1be = (len)) #endif /* WORDS_BIGENDIAN */ #define VARHDRSZ_SHORT 1 #define VARATT_SHORT_MAX 0x7F #define VARATT_CAN_MAKE_SHORT(PTR) \ (VARATT_IS_4B_U(PTR) && \ (VARSIZE(PTR) - VARHDRSZ + VARHDRSZ_SHORT) <= VARATT_SHORT_MAX) #define VARATT_CONVERTED_SHORT_SIZE(PTR) \ (VARSIZE(PTR) - VARHDRSZ + VARHDRSZ_SHORT) #define VARHDRSZ_EXTERNAL 2 #define VARDATA_4B(PTR) (((varattrib_4b *) (PTR))->va_4byte.va_data) #define VARDATA_4B_C(PTR) (((varattrib_4b *) (PTR))->va_compressed.va_data) #define VARDATA_1B(PTR) (((varattrib_1b *) (PTR))->va_data) #define VARDATA_1B_E(PTR) (((varattrib_1b_e *) (PTR))->va_data) #define VARRAWSIZE_4B_C(PTR) \ (((varattrib_4b *) (PTR))->va_compressed.va_rawsize) /* Externally visible macros */ /* * VARDATA, VARSIZE, and SET_VARSIZE are the recommended API for most code * for varlena datatypes. Note that they only work on untoasted, * 4-byte-header Datums! * * Code that wants to use 1-byte-header values without detoasting should * use VARSIZE_ANY/VARSIZE_ANY_EXHDR/VARDATA_ANY. The other macros here * should usually be used only by tuple assembly/disassembly code and * code that specifically wants to work with still-toasted Datums. * * WARNING: It is only safe to use VARDATA_ANY() -- typically with * PG_DETOAST_DATUM_PACKED() -- if you really don't care about the alignment. * Either because you're working with something like text where the alignment * doesn't matter or because you're not going to access its constituent parts * and just use things like memcpy on it anyways. */ #define VARDATA(PTR) VARDATA_4B(PTR) #define VARSIZE(PTR) VARSIZE_4B(PTR) #define VARSIZE_SHORT(PTR) VARSIZE_1B(PTR) #define VARDATA_SHORT(PTR) VARDATA_1B(PTR) #define VARSIZE_EXTERNAL(PTR) VARSIZE_1B_E(PTR) #define VARDATA_EXTERNAL(PTR) VARDATA_1B_E(PTR) #define VARATT_IS_COMPRESSED(PTR) VARATT_IS_4B_C(PTR) #define VARATT_IS_EXTERNAL(PTR) VARATT_IS_1B_E(PTR) #define VARATT_IS_SHORT(PTR) VARATT_IS_1B(PTR) #define VARATT_IS_EXTENDED(PTR) (!VARATT_IS_4B_U(PTR)) #define SET_VARSIZE(PTR, len) SET_VARSIZE_4B(PTR, len) #define SET_VARSIZE_SHORT(PTR, len) SET_VARSIZE_1B(PTR, len) #define SET_VARSIZE_COMPRESSED(PTR, len) SET_VARSIZE_4B_C(PTR, len) #define SET_VARSIZE_EXTERNAL(PTR, len) SET_VARSIZE_1B_E(PTR, len) #define VARSIZE_ANY(PTR) \ (VARATT_IS_1B_E(PTR) ? VARSIZE_1B_E(PTR) : \ (VARATT_IS_1B(PTR) ? VARSIZE_1B(PTR) : \ VARSIZE_4B(PTR))) #define VARSIZE_ANY_EXHDR(PTR) \ (VARATT_IS_1B_E(PTR) ? VARSIZE_1B_E(PTR)-VARHDRSZ_EXTERNAL : \ (VARATT_IS_1B(PTR) ? VARSIZE_1B(PTR)-VARHDRSZ_SHORT : \ VARSIZE_4B(PTR)-VARHDRSZ)) /* caution: this will not work on an external or compressed-in-line Datum */ /* caution: this will return a possibly unaligned pointer */ #define VARDATA_ANY(PTR) \ (VARATT_IS_1B(PTR) ? VARDATA_1B(PTR) : VARDATA_4B(PTR)) /* ---------------------------------------------------------------- * Section 2: datum type + support macros * ---------------------------------------------------------------- */ /* * Port Notes: * Postgres makes the following assumptions about datatype sizes: * * sizeof(Datum) == sizeof(void *) == 4 or 8 * sizeof(char) == 1 * sizeof(short) == 2 * * When a type narrower than Datum is stored in a Datum, we place it in the * low-order bits and are careful that the DatumGetXXX macro for it discards * the unused high-order bits (as opposed to, say, assuming they are zero). * This is needed to support old-style user-defined functions, since depending * on architecture and compiler, the return value of a function returning char * or short may contain garbage when called as if it returned Datum. */ typedef uintptr_t Datum; #define SIZEOF_DATUM SIZEOF_VOID_P typedef Datum *DatumPtr; #define GET_1_BYTE(datum) (((Datum) (datum)) & 0x000000ff) #define GET_2_BYTES(datum) (((Datum) (datum)) & 0x0000ffff) #define GET_4_BYTES(datum) (((Datum) (datum)) & 0xffffffff) #if SIZEOF_DATUM == 8 #define GET_8_BYTES(datum) ((Datum) (datum)) #endif #define SET_1_BYTE(value) (((Datum) (value)) & 0x000000ff) #define SET_2_BYTES(value) (((Datum) (value)) & 0x0000ffff) #define SET_4_BYTES(value) (((Datum) (value)) & 0xffffffff) #if SIZEOF_DATUM == 8 #define SET_8_BYTES(value) ((Datum) (value)) #endif /* * DatumGetBool * Returns boolean value of a datum. * * Note: any nonzero value will be considered TRUE, but we ignore bits to * the left of the width of bool, per comment above. */ #define DatumGetBool(X) ((bool) (GET_1_BYTE(X) != 0)) /* * BoolGetDatum * Returns datum representation for a boolean. * * Note: any nonzero value will be considered TRUE. */ #define BoolGetDatum(X) ((Datum) ((X) ? 1 : 0)) /* * DatumGetChar * Returns character value of a datum. */ #define DatumGetChar(X) ((char) GET_1_BYTE(X)) /* * CharGetDatum * Returns datum representation for a character. */ #define CharGetDatum(X) ((Datum) SET_1_BYTE(X)) /* * Int8GetDatum * Returns datum representation for an 8-bit integer. */ #define Int8GetDatum(X) ((Datum) SET_1_BYTE(X)) /* * DatumGetUInt8 * Returns 8-bit unsigned integer value of a datum. */ #define DatumGetUInt8(X) ((uint8) GET_1_BYTE(X)) /* * UInt8GetDatum * Returns datum representation for an 8-bit unsigned integer. */ #define UInt8GetDatum(X) ((Datum) SET_1_BYTE(X)) /* * DatumGetInt16 * Returns 16-bit integer value of a datum. */ #define DatumGetInt16(X) ((int16) GET_2_BYTES(X)) /* * Int16GetDatum * Returns datum representation for a 16-bit integer. */ #define Int16GetDatum(X) ((Datum) SET_2_BYTES(X)) /* * DatumGetUInt16 * Returns 16-bit unsigned integer value of a datum. */ #define DatumGetUInt16(X) ((uint16) GET_2_BYTES(X)) /* * UInt16GetDatum * Returns datum representation for a 16-bit unsigned integer. */ #define UInt16GetDatum(X) ((Datum) SET_2_BYTES(X)) /* * DatumGetInt32 * Returns 32-bit integer value of a datum. */ #define DatumGetInt32(X) ((int32) GET_4_BYTES(X)) /* * Int32GetDatum * Returns datum representation for a 32-bit integer. */ #define Int32GetDatum(X) ((Datum) SET_4_BYTES(X)) /* * DatumGetUInt32 * Returns 32-bit unsigned integer value of a datum. */ #define DatumGetUInt32(X) ((uint32) GET_4_BYTES(X)) /* * UInt32GetDatum * Returns datum representation for a 32-bit unsigned integer. */ #define UInt32GetDatum(X) ((Datum) SET_4_BYTES(X)) /* * DatumGetObjectId * Returns object identifier value of a datum. */ #define DatumGetObjectId(X) ((Oid) GET_4_BYTES(X)) /* * ObjectIdGetDatum * Returns datum representation for an object identifier. */ #define ObjectIdGetDatum(X) ((Datum) SET_4_BYTES(X)) /* * DatumGetTransactionId * Returns transaction identifier value of a datum. */ #define DatumGetTransactionId(X) ((TransactionId) GET_4_BYTES(X)) /* * TransactionIdGetDatum * Returns datum representation for a transaction identifier. */ #define TransactionIdGetDatum(X) ((Datum) SET_4_BYTES((X))) /* * DatumGetCommandId * Returns command identifier value of a datum. */ #define DatumGetCommandId(X) ((CommandId) GET_4_BYTES(X)) /* * CommandIdGetDatum * Returns datum representation for a command identifier. */ #define CommandIdGetDatum(X) ((Datum) SET_4_BYTES(X)) /* * DatumGetPointer * Returns pointer value of a datum. */ #define DatumGetPointer(X) ((Pointer) (X)) /* * PointerGetDatum * Returns datum representation for a pointer. */ #define PointerGetDatum(X) ((Datum) (X)) /* * DatumGetCString * Returns C string (null-terminated string) value of a datum. * * Note: C string is not a full-fledged Postgres type at present, * but type input functions use this conversion for their inputs. */ #define DatumGetCString(X) ((char *) DatumGetPointer(X)) /* * CStringGetDatum * Returns datum representation for a C string (null-terminated string). * * Note: C string is not a full-fledged Postgres type at present, * but type output functions use this conversion for their outputs. * Note: CString is pass-by-reference; caller must ensure the pointed-to * value has adequate lifetime. */ #define CStringGetDatum(X) PointerGetDatum(X) /* * DatumGetName * Returns name value of a datum. */ #define DatumGetName(X) ((Name) DatumGetPointer(X)) /* * NameGetDatum * Returns datum representation for a name. * * Note: Name is pass-by-reference; caller must ensure the pointed-to * value has adequate lifetime. */ #define NameGetDatum(X) PointerGetDatum(X) /* * DatumGetInt64 * Returns 64-bit integer value of a datum. * * Note: this macro hides whether int64 is pass by value or by reference. */ #ifdef USE_FLOAT8_BYVAL #define DatumGetInt64(X) ((int64) GET_8_BYTES(X)) #else #define DatumGetInt64(X) (* ((int64 *) DatumGetPointer(X))) #endif /* * Int64GetDatum * Returns datum representation for a 64-bit integer. * * Note: if int64 is pass by reference, this function returns a reference * to palloc'd space. */ #ifdef USE_FLOAT8_BYVAL #define Int64GetDatum(X) ((Datum) SET_8_BYTES(X)) #else extern Datum Int64GetDatum(int64 X); #endif /* * DatumGetFloat4 * Returns 4-byte floating point value of a datum. * * Note: this macro hides whether float4 is pass by value or by reference. */ #ifdef USE_FLOAT4_BYVAL extern float4 DatumGetFloat4(Datum X); #else #define DatumGetFloat4(X) (* ((float4 *) DatumGetPointer(X))) #endif /* * Float4GetDatum * Returns datum representation for a 4-byte floating point number. * * Note: if float4 is pass by reference, this function returns a reference * to palloc'd space. */ extern Datum Float4GetDatum(float4 X); /* * DatumGetFloat8 * Returns 8-byte floating point value of a datum. * * Note: this macro hides whether float8 is pass by value or by reference. */ #ifdef USE_FLOAT8_BYVAL extern float8 DatumGetFloat8(Datum X); #else #define DatumGetFloat8(X) (* ((float8 *) DatumGetPointer(X))) #endif /* * Float8GetDatum * Returns datum representation for an 8-byte floating point number. * * Note: if float8 is pass by reference, this function returns a reference * to palloc'd space. */ extern Datum Float8GetDatum(float8 X); /* * Int64GetDatumFast * Float8GetDatumFast * Float4GetDatumFast * * These macros are intended to allow writing code that does not depend on * whether int64, float8, float4 are pass-by-reference types, while not * sacrificing performance when they are. The argument must be a variable * that will exist and have the same value for as long as the Datum is needed. * In the pass-by-ref case, the address of the variable is taken to use as * the Datum. In the pass-by-val case, these will be the same as the non-Fast * macros. */ #ifdef USE_FLOAT8_BYVAL #define Int64GetDatumFast(X) Int64GetDatum(X) #define Float8GetDatumFast(X) Float8GetDatum(X) #else #define Int64GetDatumFast(X) PointerGetDatum(&(X)) #define Float8GetDatumFast(X) PointerGetDatum(&(X)) #endif #ifdef USE_FLOAT4_BYVAL #define Float4GetDatumFast(X) Float4GetDatum(X) #else #define Float4GetDatumFast(X) PointerGetDatum(&(X)) #endif /* ---------------------------------------------------------------- * Section 3: exception handling definitions * Assert, Trap, etc macros * ---------------------------------------------------------------- */ extern PGDLLIMPORT bool assert_enabled; /* * USE_ASSERT_CHECKING, if defined, turns on all the assertions. * - plai 9/5/90 * * It should _NOT_ be defined in releases or in benchmark copies */ /* * Trap * Generates an exception if the given condition is true. */ #define Trap(condition, errorType) \ do { \ if ((assert_enabled) && (condition)) \ ExceptionalCondition(CppAsString(condition), (errorType), \ __FILE__, __LINE__); \ } while (0) /* * TrapMacro is the same as Trap but it's intended for use in macros: * * #define foo(x) (AssertMacro(x != 0), bar(x)) * * Isn't CPP fun? */ #define TrapMacro(condition, errorType) \ ((bool) ((! assert_enabled) || ! (condition) || \ (ExceptionalCondition(CppAsString(condition), (errorType), \ __FILE__, __LINE__), 0))) #ifndef USE_ASSERT_CHECKING #define Assert(condition) #define AssertMacro(condition) ((void)true) #define AssertArg(condition) #define AssertState(condition) #else #define Assert(condition) \ Trap(!(condition), "FailedAssertion") #define AssertMacro(condition) \ ((void) TrapMacro(!(condition), "FailedAssertion")) #define AssertArg(condition) \ Trap(!(condition), "BadArgument") #define AssertState(condition) \ Trap(!(condition), "BadState") #endif /* USE_ASSERT_CHECKING */ extern void ExceptionalCondition(const char *conditionName, const char *errorType, const char *fileName, int lineNumber) __attribute__((noreturn)); #endif /* POSTGRES_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/getaddrinfo.h��������������������������������������������������������������������������0000644�����������������00000007622�14763166026�0011661 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * getaddrinfo.h * Support getaddrinfo() on platforms that don't have it. * * Note: we use our own routines on platforms that don't HAVE_STRUCT_ADDRINFO, * whether or not the library routine getaddrinfo() can be found. This * policy is needed because on some platforms a manually installed libbind.a * may provide getaddrinfo(), yet the system headers may not provide the * struct definitions needed to call it. To avoid conflict with the libbind * definition in such cases, we rename our routines to pg_xxx() via macros. * * This code will also work on platforms where struct addrinfo is defined * in the system headers but no getaddrinfo() can be located. * * Copyright (c) 2003-2012, PostgreSQL Global Development Group * * src/include/getaddrinfo.h * *------------------------------------------------------------------------- */ #ifndef GETADDRINFO_H #define GETADDRINFO_H #include <sys/socket.h> #include <netdb.h> /* Various macros that ought to be in <netdb.h>, but might not be */ #ifndef EAI_FAIL #ifndef WIN32 #define EAI_BADFLAGS (-1) #define EAI_NONAME (-2) #define EAI_AGAIN (-3) #define EAI_FAIL (-4) #define EAI_FAMILY (-6) #define EAI_SOCKTYPE (-7) #define EAI_SERVICE (-8) #define EAI_MEMORY (-10) #define EAI_SYSTEM (-11) #else /* WIN32 */ #ifdef WIN32_ONLY_COMPILER #ifndef WSA_NOT_ENOUGH_MEMORY #define WSA_NOT_ENOUGH_MEMORY (WSAENOBUFS) #endif #ifndef __BORLANDC__ #define WSATYPE_NOT_FOUND (WSABASEERR+109) #endif #endif #define EAI_AGAIN WSATRY_AGAIN #define EAI_BADFLAGS WSAEINVAL #define EAI_FAIL WSANO_RECOVERY #define EAI_FAMILY WSAEAFNOSUPPORT #define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY #define EAI_NODATA WSANO_DATA #define EAI_NONAME WSAHOST_NOT_FOUND #define EAI_SERVICE WSATYPE_NOT_FOUND #define EAI_SOCKTYPE WSAESOCKTNOSUPPORT #endif /* !WIN32 */ #endif /* !EAI_FAIL */ #ifndef AI_PASSIVE #define AI_PASSIVE 0x0001 #endif #ifndef AI_NUMERICHOST /* * some platforms don't support AI_NUMERICHOST; define as zero if using * the system version of getaddrinfo... */ #if defined(HAVE_STRUCT_ADDRINFO) && defined(HAVE_GETADDRINFO) #define AI_NUMERICHOST 0 #else #define AI_NUMERICHOST 0x0004 #endif #endif #ifndef NI_NUMERICHOST #define NI_NUMERICHOST 1 #endif #ifndef NI_NUMERICSERV #define NI_NUMERICSERV 2 #endif #ifndef NI_NAMEREQD #define NI_NAMEREQD 4 #endif #ifndef NI_MAXHOST #define NI_MAXHOST 1025 #endif #ifndef NI_MAXSERV #define NI_MAXSERV 32 #endif #ifndef HAVE_STRUCT_ADDRINFO #ifndef WIN32 struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; size_t ai_addrlen; struct sockaddr *ai_addr; char *ai_canonname; struct addrinfo *ai_next; }; #else /* * The order of the structure elements on Win32 doesn't match the * order specified in the standard, but we have to match it for * IPv6 to work. */ struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; size_t ai_addrlen; char *ai_canonname; struct sockaddr *ai_addr; struct addrinfo *ai_next; }; #endif #endif /* HAVE_STRUCT_ADDRINFO */ #ifndef HAVE_GETADDRINFO /* Rename private copies per comments above */ #ifdef getaddrinfo #undef getaddrinfo #endif #define getaddrinfo pg_getaddrinfo #ifdef freeaddrinfo #undef freeaddrinfo #endif #define freeaddrinfo pg_freeaddrinfo #ifdef gai_strerror #undef gai_strerror #endif #define gai_strerror pg_gai_strerror #ifdef getnameinfo #undef getnameinfo #endif #define getnameinfo pg_getnameinfo extern int getaddrinfo(const char *node, const char *service, const struct addrinfo * hints, struct addrinfo ** res); extern void freeaddrinfo(struct addrinfo * res); extern const char *gai_strerror(int errcode); extern int getnameinfo(const struct sockaddr * sa, int salen, char *node, int nodelen, char *service, int servicelen, int flags); #endif /* HAVE_GETADDRINFO */ #endif /* GETADDRINFO_H */ ��������������������������������������������������������������������������������������������������������������pgsql/server/utils/varbit.h�������������������������������������������������������������������������0000644�����������������00000010430�14763166026�0012011 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * varbit.h * Functions for the SQL datatypes BIT() and BIT VARYING(). * * Code originally contributed by Adriaan Joubert. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/varbit.h * *------------------------------------------------------------------------- */ #ifndef VARBIT_H #define VARBIT_H #include <limits.h> #include "fmgr.h" /* * Modeled on struct varlena from postgres.h, but data type is bits8. */ typedef struct { int32 vl_len_; /* varlena header (do not touch directly!) */ int32 bit_len; /* number of valid bits */ bits8 bit_dat[1]; /* bit string, most sig. byte first */ } VarBit; /* * fmgr interface macros * * BIT and BIT VARYING are toastable varlena types. They are the same * as far as representation goes, so we just have one set of macros. */ #define DatumGetVarBitP(X) ((VarBit *) PG_DETOAST_DATUM(X)) #define DatumGetVarBitPCopy(X) ((VarBit *) PG_DETOAST_DATUM_COPY(X)) #define VarBitPGetDatum(X) PointerGetDatum(X) #define PG_GETARG_VARBIT_P(n) DatumGetVarBitP(PG_GETARG_DATUM(n)) #define PG_GETARG_VARBIT_P_COPY(n) DatumGetVarBitPCopy(PG_GETARG_DATUM(n)) #define PG_RETURN_VARBIT_P(x) return VarBitPGetDatum(x) /* Header overhead *in addition to* VARHDRSZ */ #define VARBITHDRSZ sizeof(int32) /* Number of bits in this bit string */ #define VARBITLEN(PTR) (((VarBit *) (PTR))->bit_len) /* Pointer to the first byte containing bit string data */ #define VARBITS(PTR) (((VarBit *) (PTR))->bit_dat) /* Number of bytes in the data section of a bit string */ #define VARBITBYTES(PTR) (VARSIZE(PTR) - VARHDRSZ - VARBITHDRSZ) /* Padding of the bit string at the end (in bits) */ #define VARBITPAD(PTR) (VARBITBYTES(PTR)*BITS_PER_BYTE - VARBITLEN(PTR)) /* Number of bytes needed to store a bit string of a given length */ #define VARBITTOTALLEN(BITLEN) (((BITLEN) + BITS_PER_BYTE-1)/BITS_PER_BYTE + \ VARHDRSZ + VARBITHDRSZ) /* * Maximum number of bits. Several code sites assume no overflow from * computing bitlen + X; VARBITTOTALLEN() has the largest such X. */ #define VARBITMAXLEN (INT_MAX - BITS_PER_BYTE + 1) /* pointer beyond the end of the bit string (like end() in STL containers) */ #define VARBITEND(PTR) (((bits8 *) (PTR)) + VARSIZE(PTR)) /* Mask that will cover exactly one byte, i.e. BITS_PER_BYTE bits */ #define BITMASK 0xFF extern Datum bit_in(PG_FUNCTION_ARGS); extern Datum bit_out(PG_FUNCTION_ARGS); extern Datum bit_recv(PG_FUNCTION_ARGS); extern Datum bit_send(PG_FUNCTION_ARGS); extern Datum bittypmodin(PG_FUNCTION_ARGS); extern Datum bittypmodout(PG_FUNCTION_ARGS); extern Datum varbit_in(PG_FUNCTION_ARGS); extern Datum varbit_out(PG_FUNCTION_ARGS); extern Datum varbit_recv(PG_FUNCTION_ARGS); extern Datum varbit_send(PG_FUNCTION_ARGS); extern Datum varbittypmodin(PG_FUNCTION_ARGS); extern Datum varbittypmodout(PG_FUNCTION_ARGS); extern Datum bit(PG_FUNCTION_ARGS); extern Datum varbit_transform(PG_FUNCTION_ARGS); extern Datum varbit(PG_FUNCTION_ARGS); extern Datum biteq(PG_FUNCTION_ARGS); extern Datum bitne(PG_FUNCTION_ARGS); extern Datum bitlt(PG_FUNCTION_ARGS); extern Datum bitle(PG_FUNCTION_ARGS); extern Datum bitgt(PG_FUNCTION_ARGS); extern Datum bitge(PG_FUNCTION_ARGS); extern Datum bitcmp(PG_FUNCTION_ARGS); /* avoid the names bitand and bitor, since they are C++ keywords */ extern Datum bit_and(PG_FUNCTION_ARGS); extern Datum bit_or(PG_FUNCTION_ARGS); extern Datum bitxor(PG_FUNCTION_ARGS); extern Datum bitnot(PG_FUNCTION_ARGS); extern Datum bitshiftleft(PG_FUNCTION_ARGS); extern Datum bitshiftright(PG_FUNCTION_ARGS); extern Datum bitcat(PG_FUNCTION_ARGS); extern Datum bitsubstr(PG_FUNCTION_ARGS); extern Datum bitsubstr_no_len(PG_FUNCTION_ARGS); extern Datum bitoverlay(PG_FUNCTION_ARGS); extern Datum bitoverlay_no_len(PG_FUNCTION_ARGS); extern Datum bitlength(PG_FUNCTION_ARGS); extern Datum bitoctetlength(PG_FUNCTION_ARGS); extern Datum bitfromint4(PG_FUNCTION_ARGS); extern Datum bittoint4(PG_FUNCTION_ARGS); extern Datum bitfromint8(PG_FUNCTION_ARGS); extern Datum bittoint8(PG_FUNCTION_ARGS); extern Datum bitposition(PG_FUNCTION_ARGS); extern Datum bitsetbit(PG_FUNCTION_ARGS); extern Datum bitgetbit(PG_FUNCTION_ARGS); #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/datum.h��������������������������������������������������������������������������0000644�����������������00000002760�14763166026�0011643 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * datum.h * POSTGRES Datum (abstract data type) manipulation routines. * * These routines are driven by the 'typbyval' and 'typlen' information, * which must previously have been obtained by the caller for the datatype * of the Datum. (We do it this way because in most situations the caller * can look up the info just once and use it for many per-datum operations.) * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/datum.h * *------------------------------------------------------------------------- */ #ifndef DATUM_H #define DATUM_H /* * datumGetSize - find the "real" length of a datum */ extern Size datumGetSize(Datum value, bool typByVal, int typLen); /* * datumCopy - make a copy of a datum. * * If the datatype is pass-by-reference, memory is obtained with palloc(). */ extern Datum datumCopy(Datum value, bool typByVal, int typLen); /* * datumFree - free a datum previously allocated by datumCopy, if any. * * Does nothing if datatype is pass-by-value. */ extern void datumFree(Datum value, bool typByVal, int typLen); /* * datumIsEqual * return true if two datums of the same type are equal, false otherwise. * * XXX : See comments in the code for restrictions! */ extern bool datumIsEqual(Datum value1, Datum value2, bool typByVal, int typLen); #endif /* DATUM_H */ ����������������pgsql/server/utils/elog.h���������������������������������������������������������������������������0000644�����������������00000031073�14763166026�0011456 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * elog.h * POSTGRES error reporting/logging definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/elog.h * *------------------------------------------------------------------------- */ #ifndef ELOG_H #define ELOG_H #include <setjmp.h> /* Error level codes */ #define DEBUG5 10 /* Debugging messages, in categories of * decreasing detail. */ #define DEBUG4 11 #define DEBUG3 12 #define DEBUG2 13 #define DEBUG1 14 /* used by GUC debug_* variables */ #define LOG 15 /* Server operational messages; sent only to * server log by default. */ #define COMMERROR 16 /* Client communication problems; same as LOG * for server reporting, but never sent to * client. */ #define INFO 17 /* Messages specifically requested by user (eg * VACUUM VERBOSE output); always sent to * client regardless of client_min_messages, * but by default not sent to server log. */ #define NOTICE 18 /* Helpful messages to users about query * operation; sent to client and server log by * default. */ #define WARNING 19 /* Warnings. NOTICE is for expected messages * like implicit sequence creation by SERIAL. * WARNING is for unexpected messages. */ #define ERROR 20 /* user error - abort transaction; return to * known state */ /* Save ERROR value in PGERROR so it can be restored when Win32 includes * modify it. We have to use a constant rather than ERROR because macros * are expanded only when referenced outside macros. */ #ifdef WIN32 #define PGERROR 20 #endif #define FATAL 21 /* fatal error - abort process */ #define PANIC 22 /* take down the other backends with me */ /* #define DEBUG DEBUG1 */ /* Backward compatibility with pre-7.3 */ /* macros for representing SQLSTATE strings compactly */ #define PGSIXBIT(ch) (((ch) - '0') & 0x3F) #define PGUNSIXBIT(val) (((val) & 0x3F) + '0') #define MAKE_SQLSTATE(ch1,ch2,ch3,ch4,ch5) \ (PGSIXBIT(ch1) + (PGSIXBIT(ch2) << 6) + (PGSIXBIT(ch3) << 12) + \ (PGSIXBIT(ch4) << 18) + (PGSIXBIT(ch5) << 24)) /* These macros depend on the fact that '0' becomes a zero in SIXBIT */ #define ERRCODE_TO_CATEGORY(ec) ((ec) & ((1 << 12) - 1)) #define ERRCODE_IS_CATEGORY(ec) (((ec) & ~((1 << 12) - 1)) == 0) /* SQLSTATE codes for errors are defined in a separate file */ #include "utils/errcodes.h" /* Which __func__ symbol do we have, if any? */ #ifdef HAVE_FUNCNAME__FUNC #define PG_FUNCNAME_MACRO __func__ #else #ifdef HAVE_FUNCNAME__FUNCTION #define PG_FUNCNAME_MACRO __FUNCTION__ #else #define PG_FUNCNAME_MACRO NULL #endif #endif /*---------- * New-style error reporting API: to be used in this way: * ereport(ERROR, * (errcode(ERRCODE_UNDEFINED_CURSOR), * errmsg("portal \"%s\" not found", stmt->portalname), * ... other errxxx() fields as needed ...)); * * The error level is required, and so is a primary error message (errmsg * or errmsg_internal). All else is optional. errcode() defaults to * ERRCODE_INTERNAL_ERROR if elevel is ERROR or more, ERRCODE_WARNING * if elevel is WARNING, or ERRCODE_SUCCESSFUL_COMPLETION if elevel is * NOTICE or below. * * ereport_domain() allows a message domain to be specified, for modules that * wish to use a different message catalog from the backend's. To avoid having * one copy of the default text domain per .o file, we define it as NULL here * and have errstart insert the default text domain. Modules can either use * ereport_domain() directly, or preferably they can override the TEXTDOMAIN * macro. *---------- */ #define ereport_domain(elevel, domain, rest) \ (errstart(elevel, __FILE__, __LINE__, PG_FUNCNAME_MACRO, domain) ? \ (errfinish rest) : (void) 0) #define ereport(elevel, rest) \ ereport_domain(elevel, TEXTDOMAIN, rest) #define TEXTDOMAIN NULL extern bool errstart(int elevel, const char *filename, int lineno, const char *funcname, const char *domain); extern void errfinish(int dummy,...); extern int errcode(int sqlerrcode); extern int errcode_for_file_access(void); extern int errcode_for_socket_access(void); extern int errmsg(const char *fmt,...) /* This extension allows gcc to check the format string for consistency with the supplied arguments. */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2))); extern int errmsg_internal(const char *fmt,...) /* This extension allows gcc to check the format string for consistency with the supplied arguments. */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2))); extern int errmsg_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...) /* This extension allows gcc to check the format string for consistency with the supplied arguments. */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 4))) __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 4))); extern int errdetail(const char *fmt,...) /* This extension allows gcc to check the format string for consistency with the supplied arguments. */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2))); extern int errdetail_internal(const char *fmt,...) /* This extension allows gcc to check the format string for consistency with the supplied arguments. */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2))); extern int errdetail_log(const char *fmt,...) /* This extension allows gcc to check the format string for consistency with the supplied arguments. */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2))); extern int errdetail_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...) /* This extension allows gcc to check the format string for consistency with the supplied arguments. */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 4))) __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 4))); extern int errhint(const char *fmt,...) /* This extension allows gcc to check the format string for consistency with the supplied arguments. */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2))); extern int errcontext(const char *fmt,...) /* This extension allows gcc to check the format string for consistency with the supplied arguments. */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2))); extern int errhidestmt(bool hide_stmt); extern int errfunction(const char *funcname); extern int errposition(int cursorpos); extern int internalerrposition(int cursorpos); extern int internalerrquery(const char *query); extern int geterrcode(void); extern int geterrposition(void); extern int getinternalerrposition(void); /*---------- * Old-style error reporting API: to be used in this way: * elog(ERROR, "portal \"%s\" not found", stmt->portalname); *---------- */ #define elog elog_start(__FILE__, __LINE__, PG_FUNCNAME_MACRO), elog_finish extern void elog_start(const char *filename, int lineno, const char *funcname); extern void elog_finish(int elevel, const char *fmt,...) /* This extension allows gcc to check the format string for consistency with the supplied arguments. */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3))); /* Support for constructing error strings separately from ereport() calls */ extern void pre_format_elog_string(int errnumber, const char *domain); extern char * format_elog_string(const char *fmt,...) /* This extension allows gcc to check the format string for consistency with the supplied arguments. */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2))); /* Support for attaching context information to error reports */ typedef struct ErrorContextCallback { struct ErrorContextCallback *previous; void (*callback) (void *arg); void *arg; } ErrorContextCallback; extern PGDLLIMPORT ErrorContextCallback *error_context_stack; /*---------- * API for catching ereport(ERROR) exits. Use these macros like so: * * PG_TRY(); * { * ... code that might throw ereport(ERROR) ... * } * PG_CATCH(); * { * ... error recovery code ... * } * PG_END_TRY(); * * (The braces are not actually necessary, but are recommended so that * pg_indent will indent the construct nicely.) The error recovery code * can optionally do PG_RE_THROW() to propagate the same error outwards. * * Note: while the system will correctly propagate any new ereport(ERROR) * occurring in the recovery section, there is a small limit on the number * of levels this will work for. It's best to keep the error recovery * section simple enough that it can't generate any new errors, at least * not before popping the error stack. * * Note: an ereport(FATAL) will not be caught by this construct; control will * exit straight through proc_exit(). Therefore, do NOT put any cleanup * of non-process-local resources into the error recovery section, at least * not without taking thought for what will happen during ereport(FATAL). * The PG_ENSURE_ERROR_CLEANUP macros provided by storage/ipc.h may be * helpful in such cases. *---------- */ #define PG_TRY() \ do { \ sigjmp_buf *save_exception_stack = PG_exception_stack; \ ErrorContextCallback *save_context_stack = error_context_stack; \ sigjmp_buf local_sigjmp_buf; \ if (sigsetjmp(local_sigjmp_buf, 0) == 0) \ { \ PG_exception_stack = &local_sigjmp_buf #define PG_CATCH() \ } \ else \ { \ PG_exception_stack = save_exception_stack; \ error_context_stack = save_context_stack #define PG_END_TRY() \ } \ PG_exception_stack = save_exception_stack; \ error_context_stack = save_context_stack; \ } while (0) /* * gcc understands __attribute__((noreturn)); for other compilers, insert * a useless exit() call so that the compiler gets the point. */ #ifdef __GNUC__ #define PG_RE_THROW() \ pg_re_throw() #else #define PG_RE_THROW() \ (pg_re_throw(), exit(1)) #endif extern PGDLLIMPORT sigjmp_buf *PG_exception_stack; /* Stuff that error handlers might want to use */ /* * ErrorData holds the data accumulated during any one ereport() cycle. * Any non-NULL pointers must point to palloc'd data. * (The const pointers are an exception; we assume they point at non-freeable * constant strings.) */ typedef struct ErrorData { int elevel; /* error level */ bool output_to_server; /* will report to server log? */ bool output_to_client; /* will report to client? */ bool show_funcname; /* true to force funcname inclusion */ bool hide_stmt; /* true to prevent STATEMENT: inclusion */ const char *filename; /* __FILE__ of ereport() call */ int lineno; /* __LINE__ of ereport() call */ const char *funcname; /* __func__ of ereport() call */ const char *domain; /* message domain */ int sqlerrcode; /* encoded ERRSTATE */ char *message; /* primary error message */ char *detail; /* detail error message */ char *detail_log; /* detail error message for server log only */ char *hint; /* hint message */ char *context; /* context message */ int cursorpos; /* cursor index into query string */ int internalpos; /* cursor index into internalquery */ char *internalquery; /* text of internally-generated query */ int saved_errno; /* errno at entry */ } ErrorData; extern void EmitErrorReport(void); extern ErrorData *CopyErrorData(void); extern void FreeErrorData(ErrorData *edata); extern void FlushErrorState(void); extern void ReThrowError(ErrorData *edata) __attribute__((noreturn)); extern void pg_re_throw(void) __attribute__((noreturn)); /* Hook for intercepting messages before they are sent to the server log */ typedef void (*emit_log_hook_type) (ErrorData *edata); extern PGDLLIMPORT emit_log_hook_type emit_log_hook; /* GUC-configurable parameters */ typedef enum { PGERROR_TERSE, /* single-line error messages */ PGERROR_DEFAULT, /* recommended style */ PGERROR_VERBOSE /* all the facts, ma'am */ } PGErrorVerbosity; extern int Log_error_verbosity; extern char *Log_line_prefix; extern int Log_destination; /* Log destination bitmap */ #define LOG_DESTINATION_STDERR 1 #define LOG_DESTINATION_SYSLOG 2 #define LOG_DESTINATION_EVENTLOG 4 #define LOG_DESTINATION_CSVLOG 8 /* Other exported functions */ extern void DebugFileOpen(void); extern char *unpack_sql_state(int sql_state); extern bool in_error_recursion_trouble(void); #ifdef HAVE_SYSLOG extern void set_syslog_parameters(const char *ident, int facility); #endif /* * Write errors to stderr (or by equal means when stderr is * not available). Used before ereport/elog can be used * safely (memory context, GUC load etc) */ extern void write_stderr(const char *fmt,...) /* This extension allows gcc to check the format string for consistency with the supplied arguments. */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2))); #endif /* ELOG_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/ascii.h��������������������������������������������������������������������������0000644�����������������00000001103�14763166026�0011607 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*----------------------------------------------------------------------- * ascii.h * * Portions Copyright (c) 1999-2012, PostgreSQL Global Development Group * * src/include/utils/ascii.h * *----------------------------------------------------------------------- */ #ifndef _ASCII_H_ #define _ASCII_H_ #include "fmgr.h" extern Datum to_ascii_encname(PG_FUNCTION_ARGS); extern Datum to_ascii_enc(PG_FUNCTION_ARGS); extern Datum to_ascii_default(PG_FUNCTION_ARGS); extern void ascii_safe_strlcpy(char *dest, const char *src, size_t destsiz); #endif /* _ASCII_H_ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/rbtree.h�������������������������������������������������������������������������0000644�����������������00000004410�14763166026�0012006 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * rbtree.h * interface for PostgreSQL generic Red-Black binary tree package * * Copyright (c) 2009-2012, PostgreSQL Global Development Group * * IDENTIFICATION * src/include/utils/rbtree.h * *------------------------------------------------------------------------- */ #ifndef RBTREE_H #define RBTREE_H /* * RBNode is intended to be used as the first field of a larger struct, * whose additional fields carry whatever payload data the caller needs * for a tree entry. (The total size of that larger struct is passed to * rb_create.) RBNode is declared here to support this usage, but * callers must treat it as an opaque struct. */ typedef struct RBNode { char iteratorState; /* workspace for iterating through tree */ char color; /* node's current color, red or black */ struct RBNode *left; /* left child, or RBNIL if none */ struct RBNode *right; /* right child, or RBNIL if none */ struct RBNode *parent; /* parent, or NULL (not RBNIL!) if none */ } RBNode; /* Opaque struct representing a whole tree */ typedef struct RBTree RBTree; /* Available tree iteration orderings */ typedef enum RBOrderControl { LeftRightWalk, /* inorder: left child, node, right child */ RightLeftWalk, /* reverse inorder: right, node, left */ DirectWalk, /* preorder: node, left child, right child */ InvertedWalk /* postorder: left child, right child, node */ } RBOrderControl; /* Support functions to be provided by caller */ typedef int (*rb_comparator) (const RBNode *a, const RBNode *b, void *arg); typedef void (*rb_combiner) (RBNode *existing, const RBNode *newdata, void *arg); typedef RBNode *(*rb_allocfunc) (void *arg); typedef void (*rb_freefunc) (RBNode *x, void *arg); extern RBTree *rb_create(Size node_size, rb_comparator comparator, rb_combiner combiner, rb_allocfunc allocfunc, rb_freefunc freefunc, void *arg); extern RBNode *rb_find(RBTree *rb, const RBNode *data); extern RBNode *rb_leftmost(RBTree *rb); extern RBNode *rb_insert(RBTree *rb, const RBNode *data, bool *isNew); extern void rb_delete(RBTree *rb, RBNode *node); extern void rb_begin_iterate(RBTree *rb, RBOrderControl ctrl); extern RBNode *rb_iterate(RBTree *rb); #endif /* RBTREE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/tzparser.h�����������������������������������������������������������������������0000644�����������������00000002203�14763166026�0012373 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * tzparser.h * Timezone offset file parsing definitions. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/tzparser.h * *------------------------------------------------------------------------- */ #ifndef TZPARSER_H #define TZPARSER_H #include "utils/datetime.h" /* * The result of parsing a timezone configuration file is an array of * these structs, in order by abbrev. We export this because datetime.c * needs it. */ typedef struct tzEntry { /* the actual data */ char *abbrev; /* TZ abbreviation (downcased) */ char *zone; /* zone name if dynamic abbrev, else NULL */ /* for a dynamic abbreviation, offset/is_dst are not used */ int offset; /* offset in seconds from UTC */ bool is_dst; /* true if a DST abbreviation */ /* source information (for error messages) */ int lineno; const char *filename; } tzEntry; extern TimeZoneAbbrevTable *load_tzoffsets(const char *filename); #endif /* TZPARSER_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/relmapper.h����������������������������������������������������������������������0000644�����������������00000003267�14763166026�0012523 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * relmapper.h * Catalog-to-filenode mapping * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/relmapper.h * *------------------------------------------------------------------------- */ #ifndef RELMAPPER_H #define RELMAPPER_H #include "access/xlog.h" /* ---------------- * relmap-related XLOG entries * ---------------- */ #define XLOG_RELMAP_UPDATE 0x00 typedef struct xl_relmap_update { Oid dbid; /* database ID, or 0 for shared map */ Oid tsid; /* database's tablespace, or pg_global */ int32 nbytes; /* size of relmap data */ char data[1]; /* VARIABLE LENGTH ARRAY */ } xl_relmap_update; #define MinSizeOfRelmapUpdate offsetof(xl_relmap_update, data) extern Oid RelationMapOidToFilenode(Oid relationId, bool shared); extern void RelationMapUpdateMap(Oid relationId, Oid fileNode, bool shared, bool immediate); extern void RelationMapRemoveMapping(Oid relationId); extern void RelationMapInvalidate(bool shared); extern void RelationMapInvalidateAll(void); extern void AtCCI_RelationMap(void); extern void AtEOXact_RelationMap(bool isCommit); extern void AtPrepare_RelationMap(void); extern void CheckPointRelationMap(void); extern void RelationMapFinishBootstrap(void); extern void RelationMapInitialize(void); extern void RelationMapInitializePhase2(void); extern void RelationMapInitializePhase3(void); extern void relmap_redo(XLogRecPtr lsn, XLogRecord *record); extern void relmap_desc(StringInfo buf, uint8 xl_info, char *rec); #endif /* RELMAPPER_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/bytea.h��������������������������������������������������������������������������0000644�����������������00000003117�14763166026�0011632 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * bytea.h * Declarations for BYTEA data type support. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/bytea.h * *------------------------------------------------------------------------- */ #ifndef BYTEA_H #define BYTEA_H #include "fmgr.h" typedef enum { BYTEA_OUTPUT_ESCAPE, BYTEA_OUTPUT_HEX } ByteaOutputType; extern int bytea_output; /* ByteaOutputType, but int for GUC enum */ /* functions are in utils/adt/varlena.c */ extern Datum byteain(PG_FUNCTION_ARGS); extern Datum byteaout(PG_FUNCTION_ARGS); extern Datum bytearecv(PG_FUNCTION_ARGS); extern Datum byteasend(PG_FUNCTION_ARGS); extern Datum byteaoctetlen(PG_FUNCTION_ARGS); extern Datum byteaGetByte(PG_FUNCTION_ARGS); extern Datum byteaGetBit(PG_FUNCTION_ARGS); extern Datum byteaSetByte(PG_FUNCTION_ARGS); extern Datum byteaSetBit(PG_FUNCTION_ARGS); extern Datum byteaeq(PG_FUNCTION_ARGS); extern Datum byteane(PG_FUNCTION_ARGS); extern Datum bytealt(PG_FUNCTION_ARGS); extern Datum byteale(PG_FUNCTION_ARGS); extern Datum byteagt(PG_FUNCTION_ARGS); extern Datum byteage(PG_FUNCTION_ARGS); extern Datum byteacmp(PG_FUNCTION_ARGS); extern Datum byteacat(PG_FUNCTION_ARGS); extern Datum byteapos(PG_FUNCTION_ARGS); extern Datum bytea_substr(PG_FUNCTION_ARGS); extern Datum bytea_substr_no_len(PG_FUNCTION_ARGS); extern Datum byteaoverlay(PG_FUNCTION_ARGS); extern Datum byteaoverlay_no_len(PG_FUNCTION_ARGS); #endif /* BYTEA_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/attoptcache.h��������������������������������������������������������������������0000644�����������������00000001325�14763166026�0013024 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * attoptcache.h * Attribute options cache. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/attoptcache.h * *------------------------------------------------------------------------- */ #ifndef ATTOPTCACHE_H #define ATTOPTCACHE_H /* * Attribute options. */ typedef struct AttributeOpts { int32 vl_len_; /* varlena header (do not touch directly!) */ float8 n_distinct; float8 n_distinct_inherited; } AttributeOpts; AttributeOpts *get_attribute_options(Oid spcid, int attnum); #endif /* ATTOPTCACHE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/timestamp.h����������������������������������������������������������������������0000644�����������������00000023003�14763166026�0012525 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * timestamp.h * Definitions for the SQL92 "timestamp" and "interval" types. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/timestamp.h * *------------------------------------------------------------------------- */ #ifndef TIMESTAMP_H #define TIMESTAMP_H #include "datatype/timestamp.h" #include "fmgr.h" #include "pgtime.h" /* * Macros for fmgr-callable functions. * * For Timestamp, we make use of the same support routines as for int64 * or float8. Therefore Timestamp is pass-by-reference if and only if * int64 or float8 is! */ #ifdef HAVE_INT64_TIMESTAMP #define DatumGetTimestamp(X) ((Timestamp) DatumGetInt64(X)) #define DatumGetTimestampTz(X) ((TimestampTz) DatumGetInt64(X)) #define DatumGetIntervalP(X) ((Interval *) DatumGetPointer(X)) #define TimestampGetDatum(X) Int64GetDatum(X) #define TimestampTzGetDatum(X) Int64GetDatum(X) #define IntervalPGetDatum(X) PointerGetDatum(X) #define PG_GETARG_TIMESTAMP(n) DatumGetTimestamp(PG_GETARG_DATUM(n)) #define PG_GETARG_TIMESTAMPTZ(n) DatumGetTimestampTz(PG_GETARG_DATUM(n)) #define PG_GETARG_INTERVAL_P(n) DatumGetIntervalP(PG_GETARG_DATUM(n)) #define PG_RETURN_TIMESTAMP(x) return TimestampGetDatum(x) #define PG_RETURN_TIMESTAMPTZ(x) return TimestampTzGetDatum(x) #define PG_RETURN_INTERVAL_P(x) return IntervalPGetDatum(x) #else /* !HAVE_INT64_TIMESTAMP */ #define DatumGetTimestamp(X) ((Timestamp) DatumGetFloat8(X)) #define DatumGetTimestampTz(X) ((TimestampTz) DatumGetFloat8(X)) #define DatumGetIntervalP(X) ((Interval *) DatumGetPointer(X)) #define TimestampGetDatum(X) Float8GetDatum(X) #define TimestampTzGetDatum(X) Float8GetDatum(X) #define IntervalPGetDatum(X) PointerGetDatum(X) #define PG_GETARG_TIMESTAMP(n) DatumGetTimestamp(PG_GETARG_DATUM(n)) #define PG_GETARG_TIMESTAMPTZ(n) DatumGetTimestampTz(PG_GETARG_DATUM(n)) #define PG_GETARG_INTERVAL_P(n) DatumGetIntervalP(PG_GETARG_DATUM(n)) #define PG_RETURN_TIMESTAMP(x) return TimestampGetDatum(x) #define PG_RETURN_TIMESTAMPTZ(x) return TimestampTzGetDatum(x) #define PG_RETURN_INTERVAL_P(x) return IntervalPGetDatum(x) #endif /* HAVE_INT64_TIMESTAMP */ #define TIMESTAMP_MASK(b) (1 << (b)) #define INTERVAL_MASK(b) (1 << (b)) /* Macros to handle packing and unpacking the typmod field for intervals */ #define INTERVAL_FULL_RANGE (0x7FFF) #define INTERVAL_RANGE_MASK (0x7FFF) #define INTERVAL_FULL_PRECISION (0xFFFF) #define INTERVAL_PRECISION_MASK (0xFFFF) #define INTERVAL_TYPMOD(p,r) ((((r) & INTERVAL_RANGE_MASK) << 16) | ((p) & INTERVAL_PRECISION_MASK)) #define INTERVAL_PRECISION(t) ((t) & INTERVAL_PRECISION_MASK) #define INTERVAL_RANGE(t) (((t) >> 16) & INTERVAL_RANGE_MASK) #ifdef HAVE_INT64_TIMESTAMP #define TimestampTzPlusMilliseconds(tz,ms) ((tz) + ((ms) * (int64) 1000)) #else #define TimestampTzPlusMilliseconds(tz,ms) ((tz) + ((ms) / 1000.0)) #endif /* Set at postmaster start */ extern TimestampTz PgStartTime; /* Set at configuration reload */ extern TimestampTz PgReloadTime; /* * timestamp.c prototypes */ extern Datum timestamp_in(PG_FUNCTION_ARGS); extern Datum timestamp_out(PG_FUNCTION_ARGS); extern Datum timestamp_recv(PG_FUNCTION_ARGS); extern Datum timestamp_send(PG_FUNCTION_ARGS); extern Datum timestamptypmodin(PG_FUNCTION_ARGS); extern Datum timestamptypmodout(PG_FUNCTION_ARGS); extern Datum timestamp_transform(PG_FUNCTION_ARGS); extern Datum timestamp_scale(PG_FUNCTION_ARGS); extern Datum timestamp_eq(PG_FUNCTION_ARGS); extern Datum timestamp_ne(PG_FUNCTION_ARGS); extern Datum timestamp_lt(PG_FUNCTION_ARGS); extern Datum timestamp_le(PG_FUNCTION_ARGS); extern Datum timestamp_ge(PG_FUNCTION_ARGS); extern Datum timestamp_gt(PG_FUNCTION_ARGS); extern Datum timestamp_finite(PG_FUNCTION_ARGS); extern Datum timestamp_cmp(PG_FUNCTION_ARGS); extern Datum timestamp_sortsupport(PG_FUNCTION_ARGS); extern Datum timestamp_hash(PG_FUNCTION_ARGS); extern Datum timestamp_smaller(PG_FUNCTION_ARGS); extern Datum timestamp_larger(PG_FUNCTION_ARGS); extern Datum timestamp_eq_timestamptz(PG_FUNCTION_ARGS); extern Datum timestamp_ne_timestamptz(PG_FUNCTION_ARGS); extern Datum timestamp_lt_timestamptz(PG_FUNCTION_ARGS); extern Datum timestamp_le_timestamptz(PG_FUNCTION_ARGS); extern Datum timestamp_gt_timestamptz(PG_FUNCTION_ARGS); extern Datum timestamp_ge_timestamptz(PG_FUNCTION_ARGS); extern Datum timestamp_cmp_timestamptz(PG_FUNCTION_ARGS); extern Datum timestamptz_eq_timestamp(PG_FUNCTION_ARGS); extern Datum timestamptz_ne_timestamp(PG_FUNCTION_ARGS); extern Datum timestamptz_lt_timestamp(PG_FUNCTION_ARGS); extern Datum timestamptz_le_timestamp(PG_FUNCTION_ARGS); extern Datum timestamptz_gt_timestamp(PG_FUNCTION_ARGS); extern Datum timestamptz_ge_timestamp(PG_FUNCTION_ARGS); extern Datum timestamptz_cmp_timestamp(PG_FUNCTION_ARGS); extern Datum interval_in(PG_FUNCTION_ARGS); extern Datum interval_out(PG_FUNCTION_ARGS); extern Datum interval_recv(PG_FUNCTION_ARGS); extern Datum interval_send(PG_FUNCTION_ARGS); extern Datum intervaltypmodin(PG_FUNCTION_ARGS); extern Datum intervaltypmodout(PG_FUNCTION_ARGS); extern Datum interval_transform(PG_FUNCTION_ARGS); extern Datum interval_scale(PG_FUNCTION_ARGS); extern Datum interval_eq(PG_FUNCTION_ARGS); extern Datum interval_ne(PG_FUNCTION_ARGS); extern Datum interval_lt(PG_FUNCTION_ARGS); extern Datum interval_le(PG_FUNCTION_ARGS); extern Datum interval_ge(PG_FUNCTION_ARGS); extern Datum interval_gt(PG_FUNCTION_ARGS); extern Datum interval_finite(PG_FUNCTION_ARGS); extern Datum interval_cmp(PG_FUNCTION_ARGS); extern Datum interval_hash(PG_FUNCTION_ARGS); extern Datum interval_smaller(PG_FUNCTION_ARGS); extern Datum interval_larger(PG_FUNCTION_ARGS); extern Datum interval_justify_interval(PG_FUNCTION_ARGS); extern Datum interval_justify_hours(PG_FUNCTION_ARGS); extern Datum interval_justify_days(PG_FUNCTION_ARGS); extern Datum timestamp_trunc(PG_FUNCTION_ARGS); extern Datum interval_trunc(PG_FUNCTION_ARGS); extern Datum timestamp_part(PG_FUNCTION_ARGS); extern Datum interval_part(PG_FUNCTION_ARGS); extern Datum timestamp_zone(PG_FUNCTION_ARGS); extern Datum timestamp_izone(PG_FUNCTION_ARGS); extern Datum timestamp_timestamptz(PG_FUNCTION_ARGS); extern Datum timestamptz_in(PG_FUNCTION_ARGS); extern Datum timestamptz_out(PG_FUNCTION_ARGS); extern Datum timestamptz_recv(PG_FUNCTION_ARGS); extern Datum timestamptz_send(PG_FUNCTION_ARGS); extern Datum timestamptztypmodin(PG_FUNCTION_ARGS); extern Datum timestamptztypmodout(PG_FUNCTION_ARGS); extern Datum timestamptz_scale(PG_FUNCTION_ARGS); extern Datum timestamptz_timestamp(PG_FUNCTION_ARGS); extern Datum timestamptz_zone(PG_FUNCTION_ARGS); extern Datum timestamptz_izone(PG_FUNCTION_ARGS); extern Datum timestamptz_timestamptz(PG_FUNCTION_ARGS); extern Datum interval_um(PG_FUNCTION_ARGS); extern Datum interval_pl(PG_FUNCTION_ARGS); extern Datum interval_mi(PG_FUNCTION_ARGS); extern Datum interval_mul(PG_FUNCTION_ARGS); extern Datum mul_d_interval(PG_FUNCTION_ARGS); extern Datum interval_div(PG_FUNCTION_ARGS); extern Datum interval_accum(PG_FUNCTION_ARGS); extern Datum interval_avg(PG_FUNCTION_ARGS); extern Datum timestamp_mi(PG_FUNCTION_ARGS); extern Datum timestamp_pl_interval(PG_FUNCTION_ARGS); extern Datum timestamp_mi_interval(PG_FUNCTION_ARGS); extern Datum timestamp_age(PG_FUNCTION_ARGS); extern Datum overlaps_timestamp(PG_FUNCTION_ARGS); extern Datum timestamptz_pl_interval(PG_FUNCTION_ARGS); extern Datum timestamptz_mi_interval(PG_FUNCTION_ARGS); extern Datum timestamptz_age(PG_FUNCTION_ARGS); extern Datum timestamptz_trunc(PG_FUNCTION_ARGS); extern Datum timestamptz_part(PG_FUNCTION_ARGS); extern Datum now(PG_FUNCTION_ARGS); extern Datum statement_timestamp(PG_FUNCTION_ARGS); extern Datum clock_timestamp(PG_FUNCTION_ARGS); extern Datum pg_postmaster_start_time(PG_FUNCTION_ARGS); extern Datum pg_conf_load_time(PG_FUNCTION_ARGS); extern Datum generate_series_timestamp(PG_FUNCTION_ARGS); extern Datum generate_series_timestamptz(PG_FUNCTION_ARGS); /* Internal routines (not fmgr-callable) */ extern TimestampTz GetCurrentTimestamp(void); extern void TimestampDifference(TimestampTz start_time, TimestampTz stop_time, long *secs, int *microsecs); extern bool TimestampDifferenceExceeds(TimestampTz start_time, TimestampTz stop_time, int msec); extern TimestampTz time_t_to_timestamptz(pg_time_t tm); extern pg_time_t timestamptz_to_time_t(TimestampTz t); extern const char *timestamptz_to_str(TimestampTz t); extern int tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *dt); extern int timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm, fsec_t *fsec, const char **tzn, pg_tz *attimezone); extern void dt2time(Timestamp dt, int *hour, int *min, int *sec, fsec_t *fsec); extern int interval2tm(Interval span, struct pg_tm * tm, fsec_t *fsec); extern int tm2interval(struct pg_tm * tm, fsec_t fsec, Interval *span); extern Timestamp SetEpochTimestamp(void); extern void GetEpochTime(struct pg_tm * tm); extern int timestamp_cmp_internal(Timestamp dt1, Timestamp dt2); /* timestamp comparison works for timestamptz also */ #define timestamptz_cmp_internal(dt1,dt2) timestamp_cmp_internal(dt1, dt2) extern int isoweek2j(int year, int week); extern void isoweek2date(int woy, int *year, int *mon, int *mday); extern void isoweekdate2date(int isoweek, int isowday, int *year, int *mon, int *mday); extern int date2isoweek(int year, int mon, int mday); extern int date2isoyear(int year, int mon, int mday); extern int date2isoyearday(int year, int mon, int mday); #endif /* TIMESTAMP_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/pg_crc.h�������������������������������������������������������������������������0000644�����������������00000010562�14763166026�0011765 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * pg_crc.h * * PostgreSQL CRC support * * See Ross Williams' excellent introduction * A PAINLESS GUIDE TO CRC ERROR DETECTION ALGORITHMS, available from * http://www.ross.net/crc/ or several other net sites. * * We use a normal (not "reflected", in Williams' terms) CRC, using initial * all-ones register contents and a final bit inversion. * * The 64-bit variant is not used as of PostgreSQL 8.1, but we retain the * code for possible future use. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/pg_crc.h */ #ifndef PG_CRC_H #define PG_CRC_H /* ugly hack to let this be used in frontend and backend code on Cygwin */ #ifdef FRONTEND #define CRCDLLIMPORT #else #define CRCDLLIMPORT PGDLLIMPORT #endif typedef uint32 pg_crc32; /* Initialize a CRC accumulator */ #define INIT_CRC32(crc) ((crc) = 0xFFFFFFFF) /* Finish a CRC calculation */ #define FIN_CRC32(crc) ((crc) ^= 0xFFFFFFFF) /* Accumulate some (more) bytes into a CRC */ #define COMP_CRC32(crc, data, len) \ do { \ const unsigned char *__data = (const unsigned char *) (data); \ uint32 __len = (len); \ \ while (__len-- > 0) \ { \ int __tab_index = ((int) ((crc) >> 24) ^ *__data++) & 0xFF; \ (crc) = pg_crc32_table[__tab_index] ^ ((crc) << 8); \ } \ } while (0) /* Check for equality of two CRCs */ #define EQ_CRC32(c1,c2) ((c1) == (c2)) /* Constant table for CRC calculation */ extern CRCDLLIMPORT const uint32 pg_crc32_table[]; #ifdef PROVIDE_64BIT_CRC /* * If we use a 64-bit integer type, then a 64-bit CRC looks just like the * usual sort of implementation. However, we can also fake it with two * 32-bit registers. Experience has shown that the two-32-bit-registers code * is as fast as, or even much faster than, the 64-bit code on all but true * 64-bit machines. We use SIZEOF_VOID_P to check the native word width. */ #if SIZEOF_VOID_P < 8 /* * crc0 represents the LSBs of the 64-bit value, crc1 the MSBs. Note that * with crc0 placed first, the output of 32-bit and 64-bit implementations * will be bit-compatible only on little-endian architectures. If it were * important to make the two possible implementations bit-compatible on * all machines, we could do a configure test to decide how to order the * two fields, but it seems not worth the trouble. */ typedef struct pg_crc64 { uint32 crc0; uint32 crc1; } pg_crc64; /* Initialize a CRC accumulator */ #define INIT_CRC64(crc) ((crc).crc0 = 0xffffffff, (crc).crc1 = 0xffffffff) /* Finish a CRC calculation */ #define FIN_CRC64(crc) ((crc).crc0 ^= 0xffffffff, (crc).crc1 ^= 0xffffffff) /* Accumulate some (more) bytes into a CRC */ #define COMP_CRC64(crc, data, len) \ do { \ uint32 __crc0 = (crc).crc0; \ uint32 __crc1 = (crc).crc1; \ unsigned char *__data = (unsigned char *) (data); \ uint32 __len = (len); \ \ while (__len-- > 0) \ { \ int __tab_index = ((int) (__crc1 >> 24) ^ *__data++) & 0xFF; \ __crc1 = pg_crc64_table1[__tab_index] ^ ((__crc1 << 8) | (__crc0 >> 24)); \ __crc0 = pg_crc64_table0[__tab_index] ^ (__crc0 << 8); \ } \ (crc).crc0 = __crc0; \ (crc).crc1 = __crc1; \ } while (0) /* Check for equality of two CRCs */ #define EQ_CRC64(c1,c2) ((c1).crc0 == (c2).crc0 && (c1).crc1 == (c2).crc1) /* Constant table for CRC calculation */ extern CRCDLLIMPORT const uint32 pg_crc64_table0[]; extern CRCDLLIMPORT const uint32 pg_crc64_table1[]; #else /* use int64 implementation */ typedef struct pg_crc64 { uint64 crc0; } pg_crc64; /* Initialize a CRC accumulator */ #define INIT_CRC64(crc) ((crc).crc0 = UINT64CONST(0xffffffffffffffff)) /* Finish a CRC calculation */ #define FIN_CRC64(crc) ((crc).crc0 ^= UINT64CONST(0xffffffffffffffff)) /* Accumulate some (more) bytes into a CRC */ #define COMP_CRC64(crc, data, len) \ do { \ uint64 __crc0 = (crc).crc0; \ unsigned char *__data = (unsigned char *) (data); \ uint32 __len = (len); \ \ while (__len-- > 0) \ { \ int __tab_index = ((int) (__crc0 >> 56) ^ *__data++) & 0xFF; \ __crc0 = pg_crc64_table[__tab_index] ^ (__crc0 << 8); \ } \ (crc).crc0 = __crc0; \ } while (0) /* Check for equality of two CRCs */ #define EQ_CRC64(c1,c2) ((c1).crc0 == (c2).crc0) /* Constant table for CRC calculation */ extern CRCDLLIMPORT const uint64 pg_crc64_table[]; #endif /* SIZEOF_VOID_P < 8 */ #endif /* PROVIDE_64BIT_CRC */ #endif /* PG_CRC_H */ ����������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/lsyscache.h����������������������������������������������������������������������0000644�����������������00000015007�14763166026�0012505 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * lsyscache.h * Convenience routines for common queries in the system catalog cache. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/lsyscache.h * *------------------------------------------------------------------------- */ #ifndef LSYSCACHE_H #define LSYSCACHE_H #include "access/htup.h" /* Result list element for get_op_btree_interpretation */ typedef struct OpBtreeInterpretation { Oid opfamily_id; /* btree opfamily containing operator */ int strategy; /* its strategy number */ Oid oplefttype; /* declared left input datatype */ Oid oprighttype; /* declared right input datatype */ } OpBtreeInterpretation; /* I/O function selector for get_type_io_data */ typedef enum IOFuncSelector { IOFunc_input, IOFunc_output, IOFunc_receive, IOFunc_send } IOFuncSelector; /* Hook for plugins to get control in get_attavgwidth() */ typedef int32 (*get_attavgwidth_hook_type) (Oid relid, AttrNumber attnum); extern PGDLLIMPORT get_attavgwidth_hook_type get_attavgwidth_hook; extern bool op_in_opfamily(Oid opno, Oid opfamily); extern int get_op_opfamily_strategy(Oid opno, Oid opfamily); extern Oid get_op_opfamily_sortfamily(Oid opno, Oid opfamily); extern void get_op_opfamily_properties(Oid opno, Oid opfamily, bool ordering_op, int *strategy, Oid *lefttype, Oid *righttype); extern Oid get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype, int16 strategy); extern bool get_ordering_op_properties(Oid opno, Oid *opfamily, Oid *opcintype, int16 *strategy); extern bool get_sort_function_for_ordering_op(Oid opno, Oid *sortfunc, bool *issupport, bool *reverse); extern Oid get_equality_op_for_ordering_op(Oid opno, bool *reverse); extern Oid get_ordering_op_for_equality_op(Oid opno, bool use_lhs_type); extern List *get_mergejoin_opfamilies(Oid opno); extern bool get_compatible_hash_operators(Oid opno, Oid *lhs_opno, Oid *rhs_opno); extern bool get_op_hash_functions(Oid opno, RegProcedure *lhs_procno, RegProcedure *rhs_procno); extern List *get_op_btree_interpretation(Oid opno); extern bool equality_ops_are_compatible(Oid opno1, Oid opno2); extern Oid get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype, int16 procnum); extern char *get_attname(Oid relid, AttrNumber attnum); extern char *get_relid_attribute_name(Oid relid, AttrNumber attnum); extern AttrNumber get_attnum(Oid relid, const char *attname); extern Oid get_atttype(Oid relid, AttrNumber attnum); extern int32 get_atttypmod(Oid relid, AttrNumber attnum); extern void get_atttypetypmodcoll(Oid relid, AttrNumber attnum, Oid *typid, int32 *typmod, Oid *collid); extern char *get_collation_name(Oid colloid); extern char *get_constraint_name(Oid conoid); extern Oid get_opclass_family(Oid opclass); extern Oid get_opclass_input_type(Oid opclass); extern RegProcedure get_opcode(Oid opno); extern char *get_opname(Oid opno); extern void op_input_types(Oid opno, Oid *lefttype, Oid *righttype); extern bool op_mergejoinable(Oid opno, Oid inputtype); extern bool op_hashjoinable(Oid opno, Oid inputtype); extern bool op_strict(Oid opno); extern char op_volatile(Oid opno); extern Oid get_commutator(Oid opno); extern Oid get_negator(Oid opno); extern RegProcedure get_oprrest(Oid opno); extern RegProcedure get_oprjoin(Oid opno); extern char *get_func_name(Oid funcid); extern Oid get_func_namespace(Oid funcid); extern Oid get_func_rettype(Oid funcid); extern int get_func_nargs(Oid funcid); extern Oid get_func_signature(Oid funcid, Oid **argtypes, int *nargs); extern bool get_func_retset(Oid funcid); extern bool func_strict(Oid funcid); extern char func_volatile(Oid funcid); extern bool get_func_leakproof(Oid funcid); extern float4 get_func_cost(Oid funcid); extern float4 get_func_rows(Oid funcid); extern Oid get_relname_relid(const char *relname, Oid relnamespace); extern char *get_rel_name(Oid relid); extern Oid get_rel_namespace(Oid relid); extern Oid get_rel_type_id(Oid relid); extern char get_rel_relkind(Oid relid); extern Oid get_rel_tablespace(Oid relid); extern bool get_typisdefined(Oid typid); extern int16 get_typlen(Oid typid); extern bool get_typbyval(Oid typid); extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval); extern void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval, char *typalign); extern Oid getTypeIOParam(HeapTuple typeTuple); extern void get_type_io_data(Oid typid, IOFuncSelector which_func, int16 *typlen, bool *typbyval, char *typalign, char *typdelim, Oid *typioparam, Oid *func); extern char get_typstorage(Oid typid); extern Node *get_typdefault(Oid typid); extern char get_typtype(Oid typid); extern bool type_is_rowtype(Oid typid); extern bool type_is_enum(Oid typid); extern bool type_is_range(Oid typid); extern void get_type_category_preferred(Oid typid, char *typcategory, bool *typispreferred); extern Oid get_typ_typrelid(Oid typid); extern Oid get_element_type(Oid typid); extern Oid get_array_type(Oid typid); extern Oid get_base_element_type(Oid typid); extern void getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam); extern void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena); extern void getTypeBinaryInputInfo(Oid type, Oid *typReceive, Oid *typIOParam); extern void getTypeBinaryOutputInfo(Oid type, Oid *typSend, bool *typIsVarlena); extern Oid get_typmodin(Oid typid); extern Oid get_typcollation(Oid typid); extern bool type_is_collatable(Oid typid); extern Oid getBaseType(Oid typid); extern Oid getBaseTypeAndTypmod(Oid typid, int32 *typmod); extern int32 get_typavgwidth(Oid typid, int32 typmod); extern int32 get_attavgwidth(Oid relid, AttrNumber attnum); extern bool get_attstatsslot(HeapTuple statstuple, Oid atttype, int32 atttypmod, int reqkind, Oid reqop, Oid *actualop, Datum **values, int *nvalues, float4 **numbers, int *nnumbers); extern void free_attstatsslot(Oid atttype, Datum *values, int nvalues, float4 *numbers, int nnumbers); extern char *get_namespace_name(Oid nspid); extern Oid get_range_subtype(Oid rangeOid); #define type_is_array(typid) (get_element_type(typid) != InvalidOid) /* type_is_array_domain accepts both plain arrays and domains over arrays */ #define type_is_array_domain(typid) (get_base_element_type(typid) != InvalidOid) #define TypeIsToastable(typid) (get_typstorage(typid) != 'p') #endif /* LSYSCACHE_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/inet.h���������������������������������������������������������������������������0000644�����������������00000005243�14763166026�0011467 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * inet.h * Declarations for operations on INET datatypes. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/inet.h * *------------------------------------------------------------------------- */ #ifndef INET_H #define INET_H #include "fmgr.h" /* * This is the internal storage format for IP addresses * (both INET and CIDR datatypes): */ typedef struct { unsigned char family; /* PGSQL_AF_INET or PGSQL_AF_INET6 */ unsigned char bits; /* number of bits in netmask */ unsigned char ipaddr[16]; /* up to 128 bits of address */ } inet_struct; /* * Referencing all of the non-AF_INET types to AF_INET lets us work on * machines which may not have the appropriate address family (like * inet6 addresses when AF_INET6 isn't present) but doesn't cause a * dump/reload requirement. Existing databases used AF_INET for the family * type on disk. */ #define PGSQL_AF_INET (AF_INET + 0) #define PGSQL_AF_INET6 (AF_INET + 1) /* * Both INET and CIDR addresses are represented within Postgres as varlena * objects, ie, there is a varlena header in front of the struct type * depicted above. This struct depicts what we actually have in memory * in "uncompressed" cases. Note that since the maximum data size is only * 18 bytes, INET/CIDR will invariably be stored into tuples using the * 1-byte-header varlena format. However, we have to be prepared to cope * with the 4-byte-header format too, because various code may helpfully * try to "decompress" 1-byte-header datums. */ typedef struct { char vl_len_[4]; /* Do not touch this field directly! */ inet_struct inet_data; } inet; /* * This is the internal storage format for MAC addresses: */ typedef struct macaddr { unsigned char a; unsigned char b; unsigned char c; unsigned char d; unsigned char e; unsigned char f; } macaddr; /* * fmgr interface macros */ #define DatumGetInetP(X) ((inet *) PG_DETOAST_DATUM(X)) #define DatumGetInetPP(X) ((inet *) PG_DETOAST_DATUM_PACKED(X)) #define InetPGetDatum(X) PointerGetDatum(X) #define PG_GETARG_INET_P(n) DatumGetInetP(PG_GETARG_DATUM(n)) #define PG_GETARG_INET_PP(n) DatumGetInetPP(PG_GETARG_DATUM(n)) #define PG_RETURN_INET_P(x) return InetPGetDatum(x) /* macaddr is a fixed-length pass-by-reference datatype */ #define DatumGetMacaddrP(X) ((macaddr *) DatumGetPointer(X)) #define MacaddrPGetDatum(X) PointerGetDatum(X) #define PG_GETARG_MACADDR_P(n) DatumGetMacaddrP(PG_GETARG_DATUM(n)) #define PG_RETURN_MACADDR_P(x) return MacaddrPGetDatum(x) #endif /* INET_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/tuplesort.h����������������������������������������������������������������������0000644�����������������00000011172�14763166026�0012567 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * tuplesort.h * Generalized tuple sorting routines. * * This module handles sorting of heap tuples, index tuples, or single * Datums (and could easily support other kinds of sortable objects, * if necessary). It works efficiently for both small and large amounts * of data. Small amounts are sorted in-memory using qsort(). Large * amounts are sorted using temporary files and a standard external sort * algorithm. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/tuplesort.h * *------------------------------------------------------------------------- */ #ifndef TUPLESORT_H #define TUPLESORT_H #include "access/itup.h" #include "executor/tuptable.h" #include "fmgr.h" #include "utils/relcache.h" /* Tuplesortstate is an opaque type whose details are not known outside * tuplesort.c. */ typedef struct Tuplesortstate Tuplesortstate; /* * We provide multiple interfaces to what is essentially the same code, * since different callers have different data to be sorted and want to * specify the sort key information differently. There are two APIs for * sorting HeapTuples and two more for sorting IndexTuples. Yet another * API supports sorting bare Datums. * * The "heap" API actually stores/sorts MinimalTuples, which means it doesn't * preserve the system columns (tuple identity and transaction visibility * info). The sort keys are specified by column numbers within the tuples * and sort operator OIDs. We save some cycles by passing and returning the * tuples in TupleTableSlots, rather than forming actual HeapTuples (which'd * have to be converted to MinimalTuples). This API works well for sorts * executed as parts of plan trees. * * The "cluster" API stores/sorts full HeapTuples including all visibility * info. The sort keys are specified by reference to a btree index that is * defined on the relation to be sorted. Note that putheaptuple/getheaptuple * go with this API, not the "begin_heap" one! * * The "index_btree" API stores/sorts IndexTuples (preserving all their * header fields). The sort keys are specified by a btree index definition. * * The "index_hash" API is similar to index_btree, but the tuples are * actually sorted by their hash codes not the raw data. */ extern Tuplesortstate *tuplesort_begin_heap(TupleDesc tupDesc, int nkeys, AttrNumber *attNums, Oid *sortOperators, Oid *sortCollations, bool *nullsFirstFlags, int workMem, bool randomAccess); extern Tuplesortstate *tuplesort_begin_cluster(TupleDesc tupDesc, Relation indexRel, int workMem, bool randomAccess); extern Tuplesortstate *tuplesort_begin_index_btree(Relation indexRel, bool enforceUnique, int workMem, bool randomAccess); extern Tuplesortstate *tuplesort_begin_index_hash(Relation indexRel, uint32 hash_mask, int workMem, bool randomAccess); extern Tuplesortstate *tuplesort_begin_datum(Oid datumType, Oid sortOperator, Oid sortCollation, bool nullsFirstFlag, int workMem, bool randomAccess); extern void tuplesort_set_bound(Tuplesortstate *state, int64 bound); extern void tuplesort_puttupleslot(Tuplesortstate *state, TupleTableSlot *slot); extern void tuplesort_putheaptuple(Tuplesortstate *state, HeapTuple tup); extern void tuplesort_putindextuple(Tuplesortstate *state, IndexTuple tuple); extern void tuplesort_putdatum(Tuplesortstate *state, Datum val, bool isNull); extern void tuplesort_performsort(Tuplesortstate *state); extern bool tuplesort_gettupleslot(Tuplesortstate *state, bool forward, TupleTableSlot *slot); extern HeapTuple tuplesort_getheaptuple(Tuplesortstate *state, bool forward, bool *should_free); extern IndexTuple tuplesort_getindextuple(Tuplesortstate *state, bool forward, bool *should_free); extern bool tuplesort_getdatum(Tuplesortstate *state, bool forward, Datum *val, bool *isNull); extern void tuplesort_end(Tuplesortstate *state); extern void tuplesort_get_stats(Tuplesortstate *state, const char **sortMethod, const char **spaceType, long *spaceUsed); extern int tuplesort_merge_order(long allowedMem); /* * These routines may only be called if randomAccess was specified 'true'. * Likewise, backwards scan in gettuple/getdatum is only allowed if * randomAccess was specified. */ extern void tuplesort_rescan(Tuplesortstate *state); extern void tuplesort_markpos(Tuplesortstate *state); extern void tuplesort_restorepos(Tuplesortstate *state); #endif /* TUPLESORT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/ps_status.h����������������������������������������������������������������������0000644�����������������00000001234�14763166026�0012551 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * ps_status.h * * Declarations for backend/utils/misc/ps_status.c * * src/include/utils/ps_status.h * *------------------------------------------------------------------------- */ #ifndef PS_STATUS_H #define PS_STATUS_H extern bool update_process_title; extern char **save_ps_display_args(int argc, char **argv); extern void init_ps_display(const char *username, const char *dbname, const char *host_info, const char *initial_str); extern void set_ps_display(const char *activity, bool force); extern const char *get_ps_display(int *displen); #endif /* PS_STATUS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/memutils.h�����������������������������������������������������������������������0000644�����������������00000012320�14763166026�0012361 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * memutils.h * This file contains declarations for memory allocation utility * functions. These are functions that are not quite widely used * enough to justify going in utils/palloc.h, but are still part * of the API of the memory management subsystem. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/memutils.h * *------------------------------------------------------------------------- */ #ifndef MEMUTILS_H #define MEMUTILS_H #include "nodes/memnodes.h" /* * MaxAllocSize * Quasi-arbitrary limit on size of allocations. * * Note: * There is no guarantee that allocations smaller than MaxAllocSize * will succeed. Allocation requests larger than MaxAllocSize will * be summarily denied. * * XXX This is deliberately chosen to correspond to the limiting size * of varlena objects under TOAST. See VARSIZE_4B() and related macros * in postgres.h. Many datatypes assume that any allocatable size can * be represented in a varlena header. * * XXX Also, various places in aset.c assume they can compute twice an * allocation's size without overflow, so beware of raising this. */ #define MaxAllocSize ((Size) 0x3fffffff) /* 1 gigabyte - 1 */ #define AllocSizeIsValid(size) ((Size) (size) <= MaxAllocSize) /* * All chunks allocated by any memory context manager are required to be * preceded by a StandardChunkHeader at a spacing of STANDARDCHUNKHEADERSIZE. * A currently-allocated chunk must contain a backpointer to its owning * context as well as the allocated size of the chunk. The backpointer is * used by pfree() and repalloc() to find the context to call. The allocated * size is not absolutely essential, but it's expected to be needed by any * reasonable implementation. */ typedef struct StandardChunkHeader { MemoryContext context; /* owning context */ Size size; /* size of data space allocated in chunk */ #ifdef MEMORY_CONTEXT_CHECKING /* when debugging memory usage, also store actual requested size */ Size requested_size; #endif } StandardChunkHeader; #define STANDARDCHUNKHEADERSIZE MAXALIGN(sizeof(StandardChunkHeader)) /* * Standard top-level memory contexts. * * Only TopMemoryContext and ErrorContext are initialized by * MemoryContextInit() itself. */ extern PGDLLIMPORT MemoryContext TopMemoryContext; extern PGDLLIMPORT MemoryContext ErrorContext; extern PGDLLIMPORT MemoryContext PostmasterContext; extern PGDLLIMPORT MemoryContext CacheMemoryContext; extern PGDLLIMPORT MemoryContext MessageContext; extern PGDLLIMPORT MemoryContext TopTransactionContext; extern PGDLLIMPORT MemoryContext CurTransactionContext; /* This is a transient link to the active portal's memory context: */ extern PGDLLIMPORT MemoryContext PortalContext; /* * Memory-context-type-independent functions in mcxt.c */ extern void MemoryContextInit(void); extern void MemoryContextReset(MemoryContext context); extern void MemoryContextDelete(MemoryContext context); extern void MemoryContextResetChildren(MemoryContext context); extern void MemoryContextDeleteChildren(MemoryContext context); extern void MemoryContextResetAndDeleteChildren(MemoryContext context); extern void MemoryContextSetParent(MemoryContext context, MemoryContext new_parent); extern Size GetMemoryChunkSpace(void *pointer); extern MemoryContext GetMemoryChunkContext(void *pointer); extern MemoryContext MemoryContextGetParent(MemoryContext context); extern bool MemoryContextIsEmpty(MemoryContext context); extern void MemoryContextStats(MemoryContext context); #ifdef MEMORY_CONTEXT_CHECKING extern void MemoryContextCheck(MemoryContext context); #endif extern bool MemoryContextContains(MemoryContext context, void *pointer); /* * This routine handles the context-type-independent part of memory * context creation. It's intended to be called from context-type- * specific creation routines, and noplace else. */ extern MemoryContext MemoryContextCreate(NodeTag tag, Size size, MemoryContextMethods *methods, MemoryContext parent, const char *name); /* * Memory-context-type-specific functions */ /* aset.c */ extern MemoryContext AllocSetContextCreate(MemoryContext parent, const char *name, Size minContextSize, Size initBlockSize, Size maxBlockSize); /* * Recommended default alloc parameters, suitable for "ordinary" contexts * that might hold quite a lot of data. */ #define ALLOCSET_DEFAULT_MINSIZE 0 #define ALLOCSET_DEFAULT_INITSIZE (8 * 1024) #define ALLOCSET_DEFAULT_MAXSIZE (8 * 1024 * 1024) /* * Recommended alloc parameters for "small" contexts that are not expected * to contain much data (for example, a context to contain a query plan). */ #define ALLOCSET_SMALL_MINSIZE 0 #define ALLOCSET_SMALL_INITSIZE (1 * 1024) #define ALLOCSET_SMALL_MAXSIZE (8 * 1024) /* * Threshold above which a request in an AllocSet context is certain to be * allocated separately (and thereby have constant allocation overhead). * Few callers should be interested in this, but tuplesort/tuplestore need * to know it. */ #define ALLOCSET_SEPARATE_THRESHOLD 8192 #endif /* MEMUTILS_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/builtins.h�����������������������������������������������������������������������0000644�����������������00000137426�14763166026�0012372 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * builtins.h * Declarations for operations on built-in types. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/builtins.h * *------------------------------------------------------------------------- */ #ifndef BUILTINS_H #define BUILTINS_H #include "fmgr.h" #include "nodes/parsenodes.h" /* * Defined in adt/ */ /* acl.c */ extern Datum has_any_column_privilege_name_name(PG_FUNCTION_ARGS); extern Datum has_any_column_privilege_name_id(PG_FUNCTION_ARGS); extern Datum has_any_column_privilege_id_name(PG_FUNCTION_ARGS); extern Datum has_any_column_privilege_id_id(PG_FUNCTION_ARGS); extern Datum has_any_column_privilege_name(PG_FUNCTION_ARGS); extern Datum has_any_column_privilege_id(PG_FUNCTION_ARGS); extern Datum has_column_privilege_name_name_name(PG_FUNCTION_ARGS); extern Datum has_column_privilege_name_name_attnum(PG_FUNCTION_ARGS); extern Datum has_column_privilege_name_id_name(PG_FUNCTION_ARGS); extern Datum has_column_privilege_name_id_attnum(PG_FUNCTION_ARGS); extern Datum has_column_privilege_id_name_name(PG_FUNCTION_ARGS); extern Datum has_column_privilege_id_name_attnum(PG_FUNCTION_ARGS); extern Datum has_column_privilege_id_id_name(PG_FUNCTION_ARGS); extern Datum has_column_privilege_id_id_attnum(PG_FUNCTION_ARGS); extern Datum has_column_privilege_name_name(PG_FUNCTION_ARGS); extern Datum has_column_privilege_name_attnum(PG_FUNCTION_ARGS); extern Datum has_column_privilege_id_name(PG_FUNCTION_ARGS); extern Datum has_column_privilege_id_attnum(PG_FUNCTION_ARGS); extern Datum has_table_privilege_name_name(PG_FUNCTION_ARGS); extern Datum has_table_privilege_name_id(PG_FUNCTION_ARGS); extern Datum has_table_privilege_id_name(PG_FUNCTION_ARGS); extern Datum has_table_privilege_id_id(PG_FUNCTION_ARGS); extern Datum has_table_privilege_name(PG_FUNCTION_ARGS); extern Datum has_table_privilege_id(PG_FUNCTION_ARGS); extern Datum has_sequence_privilege_name_name(PG_FUNCTION_ARGS); extern Datum has_sequence_privilege_name_id(PG_FUNCTION_ARGS); extern Datum has_sequence_privilege_id_name(PG_FUNCTION_ARGS); extern Datum has_sequence_privilege_id_id(PG_FUNCTION_ARGS); extern Datum has_sequence_privilege_name(PG_FUNCTION_ARGS); extern Datum has_sequence_privilege_id(PG_FUNCTION_ARGS); extern Datum has_database_privilege_name_name(PG_FUNCTION_ARGS); extern Datum has_database_privilege_name_id(PG_FUNCTION_ARGS); extern Datum has_database_privilege_id_name(PG_FUNCTION_ARGS); extern Datum has_database_privilege_id_id(PG_FUNCTION_ARGS); extern Datum has_database_privilege_name(PG_FUNCTION_ARGS); extern Datum has_database_privilege_id(PG_FUNCTION_ARGS); extern Datum has_foreign_data_wrapper_privilege_name_name(PG_FUNCTION_ARGS); extern Datum has_foreign_data_wrapper_privilege_name_id(PG_FUNCTION_ARGS); extern Datum has_foreign_data_wrapper_privilege_id_name(PG_FUNCTION_ARGS); extern Datum has_foreign_data_wrapper_privilege_id_id(PG_FUNCTION_ARGS); extern Datum has_foreign_data_wrapper_privilege_name(PG_FUNCTION_ARGS); extern Datum has_foreign_data_wrapper_privilege_id(PG_FUNCTION_ARGS); extern Datum has_function_privilege_name_name(PG_FUNCTION_ARGS); extern Datum has_function_privilege_name_id(PG_FUNCTION_ARGS); extern Datum has_function_privilege_id_name(PG_FUNCTION_ARGS); extern Datum has_function_privilege_id_id(PG_FUNCTION_ARGS); extern Datum has_function_privilege_name(PG_FUNCTION_ARGS); extern Datum has_function_privilege_id(PG_FUNCTION_ARGS); extern Datum has_language_privilege_name_name(PG_FUNCTION_ARGS); extern Datum has_language_privilege_name_id(PG_FUNCTION_ARGS); extern Datum has_language_privilege_id_name(PG_FUNCTION_ARGS); extern Datum has_language_privilege_id_id(PG_FUNCTION_ARGS); extern Datum has_language_privilege_name(PG_FUNCTION_ARGS); extern Datum has_language_privilege_id(PG_FUNCTION_ARGS); extern Datum has_schema_privilege_name_name(PG_FUNCTION_ARGS); extern Datum has_schema_privilege_name_id(PG_FUNCTION_ARGS); extern Datum has_schema_privilege_id_name(PG_FUNCTION_ARGS); extern Datum has_schema_privilege_id_id(PG_FUNCTION_ARGS); extern Datum has_schema_privilege_name(PG_FUNCTION_ARGS); extern Datum has_schema_privilege_id(PG_FUNCTION_ARGS); extern Datum has_server_privilege_name_name(PG_FUNCTION_ARGS); extern Datum has_server_privilege_name_id(PG_FUNCTION_ARGS); extern Datum has_server_privilege_id_name(PG_FUNCTION_ARGS); extern Datum has_server_privilege_id_id(PG_FUNCTION_ARGS); extern Datum has_server_privilege_name(PG_FUNCTION_ARGS); extern Datum has_server_privilege_id(PG_FUNCTION_ARGS); extern Datum has_tablespace_privilege_name_name(PG_FUNCTION_ARGS); extern Datum has_tablespace_privilege_name_id(PG_FUNCTION_ARGS); extern Datum has_tablespace_privilege_id_name(PG_FUNCTION_ARGS); extern Datum has_tablespace_privilege_id_id(PG_FUNCTION_ARGS); extern Datum has_tablespace_privilege_name(PG_FUNCTION_ARGS); extern Datum has_tablespace_privilege_id(PG_FUNCTION_ARGS); extern Datum has_type_privilege_name_name(PG_FUNCTION_ARGS); extern Datum has_type_privilege_name_id(PG_FUNCTION_ARGS); extern Datum has_type_privilege_id_name(PG_FUNCTION_ARGS); extern Datum has_type_privilege_id_id(PG_FUNCTION_ARGS); extern Datum has_type_privilege_name(PG_FUNCTION_ARGS); extern Datum has_type_privilege_id(PG_FUNCTION_ARGS); extern Datum pg_has_role_name_name(PG_FUNCTION_ARGS); extern Datum pg_has_role_name_id(PG_FUNCTION_ARGS); extern Datum pg_has_role_id_name(PG_FUNCTION_ARGS); extern Datum pg_has_role_id_id(PG_FUNCTION_ARGS); extern Datum pg_has_role_name(PG_FUNCTION_ARGS); extern Datum pg_has_role_id(PG_FUNCTION_ARGS); /* bool.c */ extern Datum boolin(PG_FUNCTION_ARGS); extern Datum boolout(PG_FUNCTION_ARGS); extern Datum boolrecv(PG_FUNCTION_ARGS); extern Datum boolsend(PG_FUNCTION_ARGS); extern Datum booltext(PG_FUNCTION_ARGS); extern Datum booleq(PG_FUNCTION_ARGS); extern Datum boolne(PG_FUNCTION_ARGS); extern Datum boollt(PG_FUNCTION_ARGS); extern Datum boolgt(PG_FUNCTION_ARGS); extern Datum boolle(PG_FUNCTION_ARGS); extern Datum boolge(PG_FUNCTION_ARGS); extern Datum booland_statefunc(PG_FUNCTION_ARGS); extern Datum boolor_statefunc(PG_FUNCTION_ARGS); extern bool parse_bool(const char *value, bool *result); extern bool parse_bool_with_len(const char *value, size_t len, bool *result); /* char.c */ extern Datum charin(PG_FUNCTION_ARGS); extern Datum charout(PG_FUNCTION_ARGS); extern Datum charrecv(PG_FUNCTION_ARGS); extern Datum charsend(PG_FUNCTION_ARGS); extern Datum chareq(PG_FUNCTION_ARGS); extern Datum charne(PG_FUNCTION_ARGS); extern Datum charlt(PG_FUNCTION_ARGS); extern Datum charle(PG_FUNCTION_ARGS); extern Datum chargt(PG_FUNCTION_ARGS); extern Datum charge(PG_FUNCTION_ARGS); extern Datum chartoi4(PG_FUNCTION_ARGS); extern Datum i4tochar(PG_FUNCTION_ARGS); extern Datum text_char(PG_FUNCTION_ARGS); extern Datum char_text(PG_FUNCTION_ARGS); /* domains.c */ extern Datum domain_in(PG_FUNCTION_ARGS); extern Datum domain_recv(PG_FUNCTION_ARGS); extern void domain_check(Datum value, bool isnull, Oid domainType, void **extra, MemoryContext mcxt); /* encode.c */ extern Datum binary_encode(PG_FUNCTION_ARGS); extern Datum binary_decode(PG_FUNCTION_ARGS); extern unsigned hex_encode(const char *src, unsigned len, char *dst); extern unsigned hex_decode(const char *src, unsigned len, char *dst); /* enum.c */ extern Datum enum_in(PG_FUNCTION_ARGS); extern Datum enum_out(PG_FUNCTION_ARGS); extern Datum enum_recv(PG_FUNCTION_ARGS); extern Datum enum_send(PG_FUNCTION_ARGS); extern Datum enum_lt(PG_FUNCTION_ARGS); extern Datum enum_le(PG_FUNCTION_ARGS); extern Datum enum_eq(PG_FUNCTION_ARGS); extern Datum enum_ne(PG_FUNCTION_ARGS); extern Datum enum_ge(PG_FUNCTION_ARGS); extern Datum enum_gt(PG_FUNCTION_ARGS); extern Datum enum_cmp(PG_FUNCTION_ARGS); extern Datum enum_smaller(PG_FUNCTION_ARGS); extern Datum enum_larger(PG_FUNCTION_ARGS); extern Datum enum_first(PG_FUNCTION_ARGS); extern Datum enum_last(PG_FUNCTION_ARGS); extern Datum enum_range_bounds(PG_FUNCTION_ARGS); extern Datum enum_range_all(PG_FUNCTION_ARGS); /* int.c */ extern Datum int2in(PG_FUNCTION_ARGS); extern Datum int2out(PG_FUNCTION_ARGS); extern Datum int2recv(PG_FUNCTION_ARGS); extern Datum int2send(PG_FUNCTION_ARGS); extern Datum int2vectorin(PG_FUNCTION_ARGS); extern Datum int2vectorout(PG_FUNCTION_ARGS); extern Datum int2vectorrecv(PG_FUNCTION_ARGS); extern Datum int2vectorsend(PG_FUNCTION_ARGS); extern Datum int2vectoreq(PG_FUNCTION_ARGS); extern Datum int4in(PG_FUNCTION_ARGS); extern Datum int4out(PG_FUNCTION_ARGS); extern Datum int4recv(PG_FUNCTION_ARGS); extern Datum int4send(PG_FUNCTION_ARGS); extern Datum i2toi4(PG_FUNCTION_ARGS); extern Datum i4toi2(PG_FUNCTION_ARGS); extern Datum int4_bool(PG_FUNCTION_ARGS); extern Datum bool_int4(PG_FUNCTION_ARGS); extern Datum int4eq(PG_FUNCTION_ARGS); extern Datum int4ne(PG_FUNCTION_ARGS); extern Datum int4lt(PG_FUNCTION_ARGS); extern Datum int4le(PG_FUNCTION_ARGS); extern Datum int4gt(PG_FUNCTION_ARGS); extern Datum int4ge(PG_FUNCTION_ARGS); extern Datum int2eq(PG_FUNCTION_ARGS); extern Datum int2ne(PG_FUNCTION_ARGS); extern Datum int2lt(PG_FUNCTION_ARGS); extern Datum int2le(PG_FUNCTION_ARGS); extern Datum int2gt(PG_FUNCTION_ARGS); extern Datum int2ge(PG_FUNCTION_ARGS); extern Datum int24eq(PG_FUNCTION_ARGS); extern Datum int24ne(PG_FUNCTION_ARGS); extern Datum int24lt(PG_FUNCTION_ARGS); extern Datum int24le(PG_FUNCTION_ARGS); extern Datum int24gt(PG_FUNCTION_ARGS); extern Datum int24ge(PG_FUNCTION_ARGS); extern Datum int42eq(PG_FUNCTION_ARGS); extern Datum int42ne(PG_FUNCTION_ARGS); extern Datum int42lt(PG_FUNCTION_ARGS); extern Datum int42le(PG_FUNCTION_ARGS); extern Datum int42gt(PG_FUNCTION_ARGS); extern Datum int42ge(PG_FUNCTION_ARGS); extern Datum int4um(PG_FUNCTION_ARGS); extern Datum int4up(PG_FUNCTION_ARGS); extern Datum int4pl(PG_FUNCTION_ARGS); extern Datum int4mi(PG_FUNCTION_ARGS); extern Datum int4mul(PG_FUNCTION_ARGS); extern Datum int4div(PG_FUNCTION_ARGS); extern Datum int4abs(PG_FUNCTION_ARGS); extern Datum int4inc(PG_FUNCTION_ARGS); extern Datum int2um(PG_FUNCTION_ARGS); extern Datum int2up(PG_FUNCTION_ARGS); extern Datum int2pl(PG_FUNCTION_ARGS); extern Datum int2mi(PG_FUNCTION_ARGS); extern Datum int2mul(PG_FUNCTION_ARGS); extern Datum int2div(PG_FUNCTION_ARGS); extern Datum int2abs(PG_FUNCTION_ARGS); extern Datum int24pl(PG_FUNCTION_ARGS); extern Datum int24mi(PG_FUNCTION_ARGS); extern Datum int24mul(PG_FUNCTION_ARGS); extern Datum int24div(PG_FUNCTION_ARGS); extern Datum int42pl(PG_FUNCTION_ARGS); extern Datum int42mi(PG_FUNCTION_ARGS); extern Datum int42mul(PG_FUNCTION_ARGS); extern Datum int42div(PG_FUNCTION_ARGS); extern Datum int4mod(PG_FUNCTION_ARGS); extern Datum int2mod(PG_FUNCTION_ARGS); extern Datum int2larger(PG_FUNCTION_ARGS); extern Datum int2smaller(PG_FUNCTION_ARGS); extern Datum int4larger(PG_FUNCTION_ARGS); extern Datum int4smaller(PG_FUNCTION_ARGS); extern Datum int4and(PG_FUNCTION_ARGS); extern Datum int4or(PG_FUNCTION_ARGS); extern Datum int4xor(PG_FUNCTION_ARGS); extern Datum int4not(PG_FUNCTION_ARGS); extern Datum int4shl(PG_FUNCTION_ARGS); extern Datum int4shr(PG_FUNCTION_ARGS); extern Datum int2and(PG_FUNCTION_ARGS); extern Datum int2or(PG_FUNCTION_ARGS); extern Datum int2xor(PG_FUNCTION_ARGS); extern Datum int2not(PG_FUNCTION_ARGS); extern Datum int2shl(PG_FUNCTION_ARGS); extern Datum int2shr(PG_FUNCTION_ARGS); extern Datum generate_series_int4(PG_FUNCTION_ARGS); extern Datum generate_series_step_int4(PG_FUNCTION_ARGS); extern int2vector *buildint2vector(const int2 *int2s, int n); /* name.c */ extern Datum namein(PG_FUNCTION_ARGS); extern Datum nameout(PG_FUNCTION_ARGS); extern Datum namerecv(PG_FUNCTION_ARGS); extern Datum namesend(PG_FUNCTION_ARGS); extern Datum nameeq(PG_FUNCTION_ARGS); extern Datum namene(PG_FUNCTION_ARGS); extern Datum namelt(PG_FUNCTION_ARGS); extern Datum namele(PG_FUNCTION_ARGS); extern Datum namegt(PG_FUNCTION_ARGS); extern Datum namege(PG_FUNCTION_ARGS); extern int namecpy(Name n1, Name n2); extern int namestrcpy(Name name, const char *str); extern int namestrcmp(Name name, const char *str); extern Datum current_user(PG_FUNCTION_ARGS); extern Datum session_user(PG_FUNCTION_ARGS); extern Datum current_schema(PG_FUNCTION_ARGS); extern Datum current_schemas(PG_FUNCTION_ARGS); /* numutils.c */ extern int32 pg_atoi(char *s, int size, int c); extern void pg_itoa(int16 i, char *a); extern void pg_ltoa(int32 l, char *a); extern void pg_lltoa(int64 ll, char *a); /* * Per-opclass comparison functions for new btrees. These are * stored in pg_amproc; most are defined in access/nbtree/nbtcompare.c */ extern Datum btboolcmp(PG_FUNCTION_ARGS); extern Datum btint2cmp(PG_FUNCTION_ARGS); extern Datum btint4cmp(PG_FUNCTION_ARGS); extern Datum btint8cmp(PG_FUNCTION_ARGS); extern Datum btfloat4cmp(PG_FUNCTION_ARGS); extern Datum btfloat8cmp(PG_FUNCTION_ARGS); extern Datum btint48cmp(PG_FUNCTION_ARGS); extern Datum btint84cmp(PG_FUNCTION_ARGS); extern Datum btint24cmp(PG_FUNCTION_ARGS); extern Datum btint42cmp(PG_FUNCTION_ARGS); extern Datum btint28cmp(PG_FUNCTION_ARGS); extern Datum btint82cmp(PG_FUNCTION_ARGS); extern Datum btfloat48cmp(PG_FUNCTION_ARGS); extern Datum btfloat84cmp(PG_FUNCTION_ARGS); extern Datum btoidcmp(PG_FUNCTION_ARGS); extern Datum btoidvectorcmp(PG_FUNCTION_ARGS); extern Datum btabstimecmp(PG_FUNCTION_ARGS); extern Datum btreltimecmp(PG_FUNCTION_ARGS); extern Datum bttintervalcmp(PG_FUNCTION_ARGS); extern Datum btcharcmp(PG_FUNCTION_ARGS); extern Datum btnamecmp(PG_FUNCTION_ARGS); extern Datum bttextcmp(PG_FUNCTION_ARGS); /* * Per-opclass sort support functions for new btrees. Like the * functions above, these are stored in pg_amproc; most are defined in * access/nbtree/nbtcompare.c */ extern Datum btint2sortsupport(PG_FUNCTION_ARGS); extern Datum btint4sortsupport(PG_FUNCTION_ARGS); extern Datum btint8sortsupport(PG_FUNCTION_ARGS); extern Datum btfloat4sortsupport(PG_FUNCTION_ARGS); extern Datum btfloat8sortsupport(PG_FUNCTION_ARGS); extern Datum btoidsortsupport(PG_FUNCTION_ARGS); extern Datum btnamesortsupport(PG_FUNCTION_ARGS); /* float.c */ extern PGDLLIMPORT int extra_float_digits; extern double get_float8_infinity(void); extern float get_float4_infinity(void); extern double get_float8_nan(void); extern float get_float4_nan(void); extern int is_infinite(double val); extern int float4_cmp_internal(float4 a, float4 b); extern int float8_cmp_internal(float8 a, float8 b); extern Datum float4in(PG_FUNCTION_ARGS); extern Datum float4out(PG_FUNCTION_ARGS); extern Datum float4recv(PG_FUNCTION_ARGS); extern Datum float4send(PG_FUNCTION_ARGS); extern Datum float8in(PG_FUNCTION_ARGS); extern Datum float8out(PG_FUNCTION_ARGS); extern Datum float8recv(PG_FUNCTION_ARGS); extern Datum float8send(PG_FUNCTION_ARGS); extern Datum float4abs(PG_FUNCTION_ARGS); extern Datum float4um(PG_FUNCTION_ARGS); extern Datum float4up(PG_FUNCTION_ARGS); extern Datum float4larger(PG_FUNCTION_ARGS); extern Datum float4smaller(PG_FUNCTION_ARGS); extern Datum float8abs(PG_FUNCTION_ARGS); extern Datum float8um(PG_FUNCTION_ARGS); extern Datum float8up(PG_FUNCTION_ARGS); extern Datum float8larger(PG_FUNCTION_ARGS); extern Datum float8smaller(PG_FUNCTION_ARGS); extern Datum float4pl(PG_FUNCTION_ARGS); extern Datum float4mi(PG_FUNCTION_ARGS); extern Datum float4mul(PG_FUNCTION_ARGS); extern Datum float4div(PG_FUNCTION_ARGS); extern Datum float8pl(PG_FUNCTION_ARGS); extern Datum float8mi(PG_FUNCTION_ARGS); extern Datum float8mul(PG_FUNCTION_ARGS); extern Datum float8div(PG_FUNCTION_ARGS); extern Datum float4eq(PG_FUNCTION_ARGS); extern Datum float4ne(PG_FUNCTION_ARGS); extern Datum float4lt(PG_FUNCTION_ARGS); extern Datum float4le(PG_FUNCTION_ARGS); extern Datum float4gt(PG_FUNCTION_ARGS); extern Datum float4ge(PG_FUNCTION_ARGS); extern Datum float8eq(PG_FUNCTION_ARGS); extern Datum float8ne(PG_FUNCTION_ARGS); extern Datum float8lt(PG_FUNCTION_ARGS); extern Datum float8le(PG_FUNCTION_ARGS); extern Datum float8gt(PG_FUNCTION_ARGS); extern Datum float8ge(PG_FUNCTION_ARGS); extern Datum ftod(PG_FUNCTION_ARGS); extern Datum i4tod(PG_FUNCTION_ARGS); extern Datum i2tod(PG_FUNCTION_ARGS); extern Datum dtof(PG_FUNCTION_ARGS); extern Datum dtoi4(PG_FUNCTION_ARGS); extern Datum dtoi2(PG_FUNCTION_ARGS); extern Datum i4tof(PG_FUNCTION_ARGS); extern Datum i2tof(PG_FUNCTION_ARGS); extern Datum ftoi4(PG_FUNCTION_ARGS); extern Datum ftoi2(PG_FUNCTION_ARGS); extern Datum dround(PG_FUNCTION_ARGS); extern Datum dceil(PG_FUNCTION_ARGS); extern Datum dfloor(PG_FUNCTION_ARGS); extern Datum dsign(PG_FUNCTION_ARGS); extern Datum dtrunc(PG_FUNCTION_ARGS); extern Datum dsqrt(PG_FUNCTION_ARGS); extern Datum dcbrt(PG_FUNCTION_ARGS); extern Datum dpow(PG_FUNCTION_ARGS); extern Datum dexp(PG_FUNCTION_ARGS); extern Datum dlog1(PG_FUNCTION_ARGS); extern Datum dlog10(PG_FUNCTION_ARGS); extern Datum dacos(PG_FUNCTION_ARGS); extern Datum dasin(PG_FUNCTION_ARGS); extern Datum datan(PG_FUNCTION_ARGS); extern Datum datan2(PG_FUNCTION_ARGS); extern Datum dcos(PG_FUNCTION_ARGS); extern Datum dcot(PG_FUNCTION_ARGS); extern Datum dsin(PG_FUNCTION_ARGS); extern Datum dtan(PG_FUNCTION_ARGS); extern Datum degrees(PG_FUNCTION_ARGS); extern Datum dpi(PG_FUNCTION_ARGS); extern Datum radians(PG_FUNCTION_ARGS); extern Datum drandom(PG_FUNCTION_ARGS); extern Datum setseed(PG_FUNCTION_ARGS); extern Datum float8_accum(PG_FUNCTION_ARGS); extern Datum float4_accum(PG_FUNCTION_ARGS); extern Datum float8_avg(PG_FUNCTION_ARGS); extern Datum float8_var_pop(PG_FUNCTION_ARGS); extern Datum float8_var_samp(PG_FUNCTION_ARGS); extern Datum float8_stddev_pop(PG_FUNCTION_ARGS); extern Datum float8_stddev_samp(PG_FUNCTION_ARGS); extern Datum float8_regr_accum(PG_FUNCTION_ARGS); extern Datum float8_regr_sxx(PG_FUNCTION_ARGS); extern Datum float8_regr_syy(PG_FUNCTION_ARGS); extern Datum float8_regr_sxy(PG_FUNCTION_ARGS); extern Datum float8_regr_avgx(PG_FUNCTION_ARGS); extern Datum float8_regr_avgy(PG_FUNCTION_ARGS); extern Datum float8_covar_pop(PG_FUNCTION_ARGS); extern Datum float8_covar_samp(PG_FUNCTION_ARGS); extern Datum float8_corr(PG_FUNCTION_ARGS); extern Datum float8_regr_r2(PG_FUNCTION_ARGS); extern Datum float8_regr_slope(PG_FUNCTION_ARGS); extern Datum float8_regr_intercept(PG_FUNCTION_ARGS); extern Datum float48pl(PG_FUNCTION_ARGS); extern Datum float48mi(PG_FUNCTION_ARGS); extern Datum float48mul(PG_FUNCTION_ARGS); extern Datum float48div(PG_FUNCTION_ARGS); extern Datum float84pl(PG_FUNCTION_ARGS); extern Datum float84mi(PG_FUNCTION_ARGS); extern Datum float84mul(PG_FUNCTION_ARGS); extern Datum float84div(PG_FUNCTION_ARGS); extern Datum float48eq(PG_FUNCTION_ARGS); extern Datum float48ne(PG_FUNCTION_ARGS); extern Datum float48lt(PG_FUNCTION_ARGS); extern Datum float48le(PG_FUNCTION_ARGS); extern Datum float48gt(PG_FUNCTION_ARGS); extern Datum float48ge(PG_FUNCTION_ARGS); extern Datum float84eq(PG_FUNCTION_ARGS); extern Datum float84ne(PG_FUNCTION_ARGS); extern Datum float84lt(PG_FUNCTION_ARGS); extern Datum float84le(PG_FUNCTION_ARGS); extern Datum float84gt(PG_FUNCTION_ARGS); extern Datum float84ge(PG_FUNCTION_ARGS); extern Datum width_bucket_float8(PG_FUNCTION_ARGS); /* dbsize.c */ extern Datum pg_tablespace_size_oid(PG_FUNCTION_ARGS); extern Datum pg_tablespace_size_name(PG_FUNCTION_ARGS); extern Datum pg_database_size_oid(PG_FUNCTION_ARGS); extern Datum pg_database_size_name(PG_FUNCTION_ARGS); extern Datum pg_relation_size(PG_FUNCTION_ARGS); extern Datum pg_total_relation_size(PG_FUNCTION_ARGS); extern Datum pg_size_pretty(PG_FUNCTION_ARGS); extern Datum pg_size_pretty_numeric(PG_FUNCTION_ARGS); extern Datum pg_table_size(PG_FUNCTION_ARGS); extern Datum pg_indexes_size(PG_FUNCTION_ARGS); extern Datum pg_relation_filenode(PG_FUNCTION_ARGS); extern Datum pg_relation_filepath(PG_FUNCTION_ARGS); /* genfile.c */ extern bytea *read_binary_file(const char *filename, int64 seek_offset, int64 bytes_to_read); extern Datum pg_stat_file(PG_FUNCTION_ARGS); extern Datum pg_read_file(PG_FUNCTION_ARGS); extern Datum pg_read_file_all(PG_FUNCTION_ARGS); extern Datum pg_read_binary_file(PG_FUNCTION_ARGS); extern Datum pg_read_binary_file_all(PG_FUNCTION_ARGS); extern Datum pg_ls_dir(PG_FUNCTION_ARGS); /* misc.c */ extern Datum current_database(PG_FUNCTION_ARGS); extern Datum current_query(PG_FUNCTION_ARGS); extern Datum pg_cancel_backend(PG_FUNCTION_ARGS); extern Datum pg_terminate_backend(PG_FUNCTION_ARGS); extern Datum pg_reload_conf(PG_FUNCTION_ARGS); extern Datum pg_tablespace_databases(PG_FUNCTION_ARGS); extern Datum pg_tablespace_location(PG_FUNCTION_ARGS); extern Datum pg_rotate_logfile(PG_FUNCTION_ARGS); extern Datum pg_sleep(PG_FUNCTION_ARGS); extern Datum pg_get_keywords(PG_FUNCTION_ARGS); extern Datum pg_typeof(PG_FUNCTION_ARGS); extern Datum pg_collation_for(PG_FUNCTION_ARGS); /* oid.c */ extern Datum oidin(PG_FUNCTION_ARGS); extern Datum oidout(PG_FUNCTION_ARGS); extern Datum oidrecv(PG_FUNCTION_ARGS); extern Datum oidsend(PG_FUNCTION_ARGS); extern Datum oideq(PG_FUNCTION_ARGS); extern Datum oidne(PG_FUNCTION_ARGS); extern Datum oidlt(PG_FUNCTION_ARGS); extern Datum oidle(PG_FUNCTION_ARGS); extern Datum oidge(PG_FUNCTION_ARGS); extern Datum oidgt(PG_FUNCTION_ARGS); extern Datum oidlarger(PG_FUNCTION_ARGS); extern Datum oidsmaller(PG_FUNCTION_ARGS); extern Datum oidvectorin(PG_FUNCTION_ARGS); extern Datum oidvectorout(PG_FUNCTION_ARGS); extern Datum oidvectorrecv(PG_FUNCTION_ARGS); extern Datum oidvectorsend(PG_FUNCTION_ARGS); extern Datum oidvectoreq(PG_FUNCTION_ARGS); extern Datum oidvectorne(PG_FUNCTION_ARGS); extern Datum oidvectorlt(PG_FUNCTION_ARGS); extern Datum oidvectorle(PG_FUNCTION_ARGS); extern Datum oidvectorge(PG_FUNCTION_ARGS); extern Datum oidvectorgt(PG_FUNCTION_ARGS); extern oidvector *buildoidvector(const Oid *oids, int n); extern Oid oidparse(Node *node); /* pseudotypes.c */ extern Datum cstring_in(PG_FUNCTION_ARGS); extern Datum cstring_out(PG_FUNCTION_ARGS); extern Datum cstring_recv(PG_FUNCTION_ARGS); extern Datum cstring_send(PG_FUNCTION_ARGS); extern Datum any_in(PG_FUNCTION_ARGS); extern Datum any_out(PG_FUNCTION_ARGS); extern Datum anyarray_in(PG_FUNCTION_ARGS); extern Datum anyarray_out(PG_FUNCTION_ARGS); extern Datum anyarray_recv(PG_FUNCTION_ARGS); extern Datum anyarray_send(PG_FUNCTION_ARGS); extern Datum anynonarray_in(PG_FUNCTION_ARGS); extern Datum anynonarray_out(PG_FUNCTION_ARGS); extern Datum anyenum_in(PG_FUNCTION_ARGS); extern Datum anyenum_out(PG_FUNCTION_ARGS); extern Datum anyrange_in(PG_FUNCTION_ARGS); extern Datum anyrange_out(PG_FUNCTION_ARGS); extern Datum void_in(PG_FUNCTION_ARGS); extern Datum void_out(PG_FUNCTION_ARGS); extern Datum void_recv(PG_FUNCTION_ARGS); extern Datum void_send(PG_FUNCTION_ARGS); extern Datum trigger_in(PG_FUNCTION_ARGS); extern Datum trigger_out(PG_FUNCTION_ARGS); extern Datum language_handler_in(PG_FUNCTION_ARGS); extern Datum language_handler_out(PG_FUNCTION_ARGS); extern Datum fdw_handler_in(PG_FUNCTION_ARGS); extern Datum fdw_handler_out(PG_FUNCTION_ARGS); extern Datum internal_in(PG_FUNCTION_ARGS); extern Datum internal_out(PG_FUNCTION_ARGS); extern Datum opaque_in(PG_FUNCTION_ARGS); extern Datum opaque_out(PG_FUNCTION_ARGS); extern Datum anyelement_in(PG_FUNCTION_ARGS); extern Datum anyelement_out(PG_FUNCTION_ARGS); extern Datum shell_in(PG_FUNCTION_ARGS); extern Datum shell_out(PG_FUNCTION_ARGS); extern Datum pg_node_tree_in(PG_FUNCTION_ARGS); extern Datum pg_node_tree_out(PG_FUNCTION_ARGS); extern Datum pg_node_tree_recv(PG_FUNCTION_ARGS); extern Datum pg_node_tree_send(PG_FUNCTION_ARGS); /* regexp.c */ extern Datum nameregexeq(PG_FUNCTION_ARGS); extern Datum nameregexne(PG_FUNCTION_ARGS); extern Datum textregexeq(PG_FUNCTION_ARGS); extern Datum textregexne(PG_FUNCTION_ARGS); extern Datum nameicregexeq(PG_FUNCTION_ARGS); extern Datum nameicregexne(PG_FUNCTION_ARGS); extern Datum texticregexeq(PG_FUNCTION_ARGS); extern Datum texticregexne(PG_FUNCTION_ARGS); extern Datum textregexsubstr(PG_FUNCTION_ARGS); extern Datum textregexreplace_noopt(PG_FUNCTION_ARGS); extern Datum textregexreplace(PG_FUNCTION_ARGS); extern Datum similar_escape(PG_FUNCTION_ARGS); extern Datum regexp_matches(PG_FUNCTION_ARGS); extern Datum regexp_matches_no_flags(PG_FUNCTION_ARGS); extern Datum regexp_split_to_table(PG_FUNCTION_ARGS); extern Datum regexp_split_to_table_no_flags(PG_FUNCTION_ARGS); extern Datum regexp_split_to_array(PG_FUNCTION_ARGS); extern Datum regexp_split_to_array_no_flags(PG_FUNCTION_ARGS); extern char *regexp_fixed_prefix(text *text_re, bool case_insensitive, Oid collation, bool *exact); /* regproc.c */ extern Datum regprocin(PG_FUNCTION_ARGS); extern Datum regprocout(PG_FUNCTION_ARGS); extern Datum regprocrecv(PG_FUNCTION_ARGS); extern Datum regprocsend(PG_FUNCTION_ARGS); extern Datum regprocedurein(PG_FUNCTION_ARGS); extern Datum regprocedureout(PG_FUNCTION_ARGS); extern Datum regprocedurerecv(PG_FUNCTION_ARGS); extern Datum regproceduresend(PG_FUNCTION_ARGS); extern Datum regoperin(PG_FUNCTION_ARGS); extern Datum regoperout(PG_FUNCTION_ARGS); extern Datum regoperrecv(PG_FUNCTION_ARGS); extern Datum regopersend(PG_FUNCTION_ARGS); extern Datum regoperatorin(PG_FUNCTION_ARGS); extern Datum regoperatorout(PG_FUNCTION_ARGS); extern Datum regoperatorrecv(PG_FUNCTION_ARGS); extern Datum regoperatorsend(PG_FUNCTION_ARGS); extern Datum regclassin(PG_FUNCTION_ARGS); extern Datum regclassout(PG_FUNCTION_ARGS); extern Datum regclassrecv(PG_FUNCTION_ARGS); extern Datum regclasssend(PG_FUNCTION_ARGS); extern Datum regtypein(PG_FUNCTION_ARGS); extern Datum regtypeout(PG_FUNCTION_ARGS); extern Datum regtyperecv(PG_FUNCTION_ARGS); extern Datum regtypesend(PG_FUNCTION_ARGS); extern Datum regconfigin(PG_FUNCTION_ARGS); extern Datum regconfigout(PG_FUNCTION_ARGS); extern Datum regconfigrecv(PG_FUNCTION_ARGS); extern Datum regconfigsend(PG_FUNCTION_ARGS); extern Datum regdictionaryin(PG_FUNCTION_ARGS); extern Datum regdictionaryout(PG_FUNCTION_ARGS); extern Datum regdictionaryrecv(PG_FUNCTION_ARGS); extern Datum regdictionarysend(PG_FUNCTION_ARGS); extern Datum text_regclass(PG_FUNCTION_ARGS); extern List *stringToQualifiedNameList(const char *string); extern char *format_procedure(Oid procedure_oid); extern char *format_operator(Oid operator_oid); /* rowtypes.c */ extern Datum record_in(PG_FUNCTION_ARGS); extern Datum record_out(PG_FUNCTION_ARGS); extern Datum record_recv(PG_FUNCTION_ARGS); extern Datum record_send(PG_FUNCTION_ARGS); extern Datum record_eq(PG_FUNCTION_ARGS); extern Datum record_ne(PG_FUNCTION_ARGS); extern Datum record_lt(PG_FUNCTION_ARGS); extern Datum record_gt(PG_FUNCTION_ARGS); extern Datum record_le(PG_FUNCTION_ARGS); extern Datum record_ge(PG_FUNCTION_ARGS); extern Datum btrecordcmp(PG_FUNCTION_ARGS); /* ruleutils.c */ extern bool quote_all_identifiers; extern Datum pg_get_ruledef(PG_FUNCTION_ARGS); extern Datum pg_get_ruledef_ext(PG_FUNCTION_ARGS); extern Datum pg_get_viewdef(PG_FUNCTION_ARGS); extern Datum pg_get_viewdef_ext(PG_FUNCTION_ARGS); extern Datum pg_get_viewdef_wrap(PG_FUNCTION_ARGS); extern Datum pg_get_viewdef_name(PG_FUNCTION_ARGS); extern Datum pg_get_viewdef_name_ext(PG_FUNCTION_ARGS); extern Datum pg_get_indexdef(PG_FUNCTION_ARGS); extern Datum pg_get_indexdef_ext(PG_FUNCTION_ARGS); extern char *pg_get_indexdef_string(Oid indexrelid); extern char *pg_get_indexdef_columns(Oid indexrelid, bool pretty); extern Datum pg_get_triggerdef(PG_FUNCTION_ARGS); extern Datum pg_get_triggerdef_ext(PG_FUNCTION_ARGS); extern Datum pg_get_constraintdef(PG_FUNCTION_ARGS); extern Datum pg_get_constraintdef_ext(PG_FUNCTION_ARGS); extern char *pg_get_constraintdef_string(Oid constraintId); extern Datum pg_get_expr(PG_FUNCTION_ARGS); extern Datum pg_get_expr_ext(PG_FUNCTION_ARGS); extern Datum pg_get_userbyid(PG_FUNCTION_ARGS); extern Datum pg_get_serial_sequence(PG_FUNCTION_ARGS); extern Datum pg_get_functiondef(PG_FUNCTION_ARGS); extern Datum pg_get_function_arguments(PG_FUNCTION_ARGS); extern Datum pg_get_function_identity_arguments(PG_FUNCTION_ARGS); extern Datum pg_get_function_result(PG_FUNCTION_ARGS); extern char *deparse_expression(Node *expr, List *dpcontext, bool forceprefix, bool showimplicit); extern List *deparse_context_for(const char *aliasname, Oid relid); extern List *deparse_context_for_planstate(Node *planstate, List *ancestors, List *rtable); extern const char *quote_identifier(const char *ident); extern char *quote_qualified_identifier(const char *qualifier, const char *ident); extern char *generate_collation_name(Oid collid); /* tid.c */ extern Datum tidin(PG_FUNCTION_ARGS); extern Datum tidout(PG_FUNCTION_ARGS); extern Datum tidrecv(PG_FUNCTION_ARGS); extern Datum tidsend(PG_FUNCTION_ARGS); extern Datum tideq(PG_FUNCTION_ARGS); extern Datum tidne(PG_FUNCTION_ARGS); extern Datum tidlt(PG_FUNCTION_ARGS); extern Datum tidle(PG_FUNCTION_ARGS); extern Datum tidgt(PG_FUNCTION_ARGS); extern Datum tidge(PG_FUNCTION_ARGS); extern Datum bttidcmp(PG_FUNCTION_ARGS); extern Datum tidlarger(PG_FUNCTION_ARGS); extern Datum tidsmaller(PG_FUNCTION_ARGS); extern Datum currtid_byreloid(PG_FUNCTION_ARGS); extern Datum currtid_byrelname(PG_FUNCTION_ARGS); /* varchar.c */ extern Datum bpcharin(PG_FUNCTION_ARGS); extern Datum bpcharout(PG_FUNCTION_ARGS); extern Datum bpcharrecv(PG_FUNCTION_ARGS); extern Datum bpcharsend(PG_FUNCTION_ARGS); extern Datum bpchartypmodin(PG_FUNCTION_ARGS); extern Datum bpchartypmodout(PG_FUNCTION_ARGS); extern Datum bpchar(PG_FUNCTION_ARGS); extern Datum char_bpchar(PG_FUNCTION_ARGS); extern Datum name_bpchar(PG_FUNCTION_ARGS); extern Datum bpchar_name(PG_FUNCTION_ARGS); extern Datum bpchareq(PG_FUNCTION_ARGS); extern Datum bpcharne(PG_FUNCTION_ARGS); extern Datum bpcharlt(PG_FUNCTION_ARGS); extern Datum bpcharle(PG_FUNCTION_ARGS); extern Datum bpchargt(PG_FUNCTION_ARGS); extern Datum bpcharge(PG_FUNCTION_ARGS); extern Datum bpcharcmp(PG_FUNCTION_ARGS); extern Datum bpchar_larger(PG_FUNCTION_ARGS); extern Datum bpchar_smaller(PG_FUNCTION_ARGS); extern Datum bpcharlen(PG_FUNCTION_ARGS); extern Datum bpcharoctetlen(PG_FUNCTION_ARGS); extern Datum hashbpchar(PG_FUNCTION_ARGS); extern Datum bpchar_pattern_lt(PG_FUNCTION_ARGS); extern Datum bpchar_pattern_le(PG_FUNCTION_ARGS); extern Datum bpchar_pattern_gt(PG_FUNCTION_ARGS); extern Datum bpchar_pattern_ge(PG_FUNCTION_ARGS); extern Datum btbpchar_pattern_cmp(PG_FUNCTION_ARGS); extern Datum varcharin(PG_FUNCTION_ARGS); extern Datum varcharout(PG_FUNCTION_ARGS); extern Datum varcharrecv(PG_FUNCTION_ARGS); extern Datum varcharsend(PG_FUNCTION_ARGS); extern Datum varchartypmodin(PG_FUNCTION_ARGS); extern Datum varchartypmodout(PG_FUNCTION_ARGS); extern Datum varchar_transform(PG_FUNCTION_ARGS); extern Datum varchar(PG_FUNCTION_ARGS); /* varlena.c */ extern text *cstring_to_text(const char *s); extern text *cstring_to_text_with_len(const char *s, int len); extern char *text_to_cstring(const text *t); extern void text_to_cstring_buffer(const text *src, char *dst, size_t dst_len); #define CStringGetTextDatum(s) PointerGetDatum(cstring_to_text(s)) #define TextDatumGetCString(d) text_to_cstring((text *) DatumGetPointer(d)) extern Datum textin(PG_FUNCTION_ARGS); extern Datum textout(PG_FUNCTION_ARGS); extern Datum textrecv(PG_FUNCTION_ARGS); extern Datum textsend(PG_FUNCTION_ARGS); extern Datum textcat(PG_FUNCTION_ARGS); extern Datum texteq(PG_FUNCTION_ARGS); extern Datum textne(PG_FUNCTION_ARGS); extern Datum text_lt(PG_FUNCTION_ARGS); extern Datum text_le(PG_FUNCTION_ARGS); extern Datum text_gt(PG_FUNCTION_ARGS); extern Datum text_ge(PG_FUNCTION_ARGS); extern Datum text_larger(PG_FUNCTION_ARGS); extern Datum text_smaller(PG_FUNCTION_ARGS); extern Datum text_pattern_lt(PG_FUNCTION_ARGS); extern Datum text_pattern_le(PG_FUNCTION_ARGS); extern Datum text_pattern_gt(PG_FUNCTION_ARGS); extern Datum text_pattern_ge(PG_FUNCTION_ARGS); extern Datum bttext_pattern_cmp(PG_FUNCTION_ARGS); extern Datum textlen(PG_FUNCTION_ARGS); extern Datum textoctetlen(PG_FUNCTION_ARGS); extern Datum textpos(PG_FUNCTION_ARGS); extern Datum text_substr(PG_FUNCTION_ARGS); extern Datum text_substr_no_len(PG_FUNCTION_ARGS); extern Datum textoverlay(PG_FUNCTION_ARGS); extern Datum textoverlay_no_len(PG_FUNCTION_ARGS); extern Datum name_text(PG_FUNCTION_ARGS); extern Datum text_name(PG_FUNCTION_ARGS); extern int varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid); extern List *textToQualifiedNameList(text *textval); extern bool SplitIdentifierString(char *rawstring, char separator, List **namelist); extern bool SplitDirectoriesString(char *rawstring, char separator, List **namelist); extern Datum replace_text(PG_FUNCTION_ARGS); extern text *replace_text_regexp(text *src_text, void *regexp, text *replace_text, bool glob); extern Datum split_text(PG_FUNCTION_ARGS); extern Datum text_to_array(PG_FUNCTION_ARGS); extern Datum array_to_text(PG_FUNCTION_ARGS); extern Datum text_to_array_null(PG_FUNCTION_ARGS); extern Datum array_to_text_null(PG_FUNCTION_ARGS); extern Datum to_hex32(PG_FUNCTION_ARGS); extern Datum to_hex64(PG_FUNCTION_ARGS); extern Datum md5_text(PG_FUNCTION_ARGS); extern Datum md5_bytea(PG_FUNCTION_ARGS); extern Datum unknownin(PG_FUNCTION_ARGS); extern Datum unknownout(PG_FUNCTION_ARGS); extern Datum unknownrecv(PG_FUNCTION_ARGS); extern Datum unknownsend(PG_FUNCTION_ARGS); extern Datum pg_column_size(PG_FUNCTION_ARGS); extern Datum bytea_string_agg_transfn(PG_FUNCTION_ARGS); extern Datum bytea_string_agg_finalfn(PG_FUNCTION_ARGS); extern Datum string_agg_transfn(PG_FUNCTION_ARGS); extern Datum string_agg_finalfn(PG_FUNCTION_ARGS); extern Datum text_concat(PG_FUNCTION_ARGS); extern Datum text_concat_ws(PG_FUNCTION_ARGS); extern Datum text_left(PG_FUNCTION_ARGS); extern Datum text_right(PG_FUNCTION_ARGS); extern Datum text_reverse(PG_FUNCTION_ARGS); extern Datum text_format(PG_FUNCTION_ARGS); extern Datum text_format_nv(PG_FUNCTION_ARGS); /* version.c */ extern Datum pgsql_version(PG_FUNCTION_ARGS); /* xid.c */ extern Datum xidin(PG_FUNCTION_ARGS); extern Datum xidout(PG_FUNCTION_ARGS); extern Datum xidrecv(PG_FUNCTION_ARGS); extern Datum xidsend(PG_FUNCTION_ARGS); extern Datum xideq(PG_FUNCTION_ARGS); extern Datum xid_age(PG_FUNCTION_ARGS); extern int xidComparator(const void *arg1, const void *arg2); extern Datum cidin(PG_FUNCTION_ARGS); extern Datum cidout(PG_FUNCTION_ARGS); extern Datum cidrecv(PG_FUNCTION_ARGS); extern Datum cidsend(PG_FUNCTION_ARGS); extern Datum cideq(PG_FUNCTION_ARGS); /* like.c */ extern Datum namelike(PG_FUNCTION_ARGS); extern Datum namenlike(PG_FUNCTION_ARGS); extern Datum nameiclike(PG_FUNCTION_ARGS); extern Datum nameicnlike(PG_FUNCTION_ARGS); extern Datum textlike(PG_FUNCTION_ARGS); extern Datum textnlike(PG_FUNCTION_ARGS); extern Datum texticlike(PG_FUNCTION_ARGS); extern Datum texticnlike(PG_FUNCTION_ARGS); extern Datum bytealike(PG_FUNCTION_ARGS); extern Datum byteanlike(PG_FUNCTION_ARGS); extern Datum like_escape(PG_FUNCTION_ARGS); extern Datum like_escape_bytea(PG_FUNCTION_ARGS); /* oracle_compat.c */ extern Datum lower(PG_FUNCTION_ARGS); extern Datum upper(PG_FUNCTION_ARGS); extern Datum initcap(PG_FUNCTION_ARGS); extern Datum lpad(PG_FUNCTION_ARGS); extern Datum rpad(PG_FUNCTION_ARGS); extern Datum btrim(PG_FUNCTION_ARGS); extern Datum btrim1(PG_FUNCTION_ARGS); extern Datum byteatrim(PG_FUNCTION_ARGS); extern Datum ltrim(PG_FUNCTION_ARGS); extern Datum ltrim1(PG_FUNCTION_ARGS); extern Datum rtrim(PG_FUNCTION_ARGS); extern Datum rtrim1(PG_FUNCTION_ARGS); extern Datum translate(PG_FUNCTION_ARGS); extern Datum chr (PG_FUNCTION_ARGS); extern Datum repeat(PG_FUNCTION_ARGS); extern Datum ascii(PG_FUNCTION_ARGS); /* inet_cidr_ntop.c */ extern char *inet_cidr_ntop(int af, const void *src, int bits, char *dst, size_t size); /* inet_net_pton.c */ extern int inet_net_pton(int af, const char *src, void *dst, size_t size); /* network.c */ extern Datum inet_in(PG_FUNCTION_ARGS); extern Datum inet_out(PG_FUNCTION_ARGS); extern Datum inet_recv(PG_FUNCTION_ARGS); extern Datum inet_send(PG_FUNCTION_ARGS); extern Datum cidr_in(PG_FUNCTION_ARGS); extern Datum cidr_out(PG_FUNCTION_ARGS); extern Datum cidr_recv(PG_FUNCTION_ARGS); extern Datum cidr_send(PG_FUNCTION_ARGS); extern Datum network_cmp(PG_FUNCTION_ARGS); extern Datum network_lt(PG_FUNCTION_ARGS); extern Datum network_le(PG_FUNCTION_ARGS); extern Datum network_eq(PG_FUNCTION_ARGS); extern Datum network_ge(PG_FUNCTION_ARGS); extern Datum network_gt(PG_FUNCTION_ARGS); extern Datum network_ne(PG_FUNCTION_ARGS); extern Datum hashinet(PG_FUNCTION_ARGS); extern Datum network_sub(PG_FUNCTION_ARGS); extern Datum network_subeq(PG_FUNCTION_ARGS); extern Datum network_sup(PG_FUNCTION_ARGS); extern Datum network_supeq(PG_FUNCTION_ARGS); extern Datum network_network(PG_FUNCTION_ARGS); extern Datum network_netmask(PG_FUNCTION_ARGS); extern Datum network_hostmask(PG_FUNCTION_ARGS); extern Datum network_masklen(PG_FUNCTION_ARGS); extern Datum network_family(PG_FUNCTION_ARGS); extern Datum network_broadcast(PG_FUNCTION_ARGS); extern Datum network_host(PG_FUNCTION_ARGS); extern Datum network_show(PG_FUNCTION_ARGS); extern Datum inet_abbrev(PG_FUNCTION_ARGS); extern Datum cidr_abbrev(PG_FUNCTION_ARGS); extern double convert_network_to_scalar(Datum value, Oid typid); extern Datum inet_to_cidr(PG_FUNCTION_ARGS); extern Datum inet_set_masklen(PG_FUNCTION_ARGS); extern Datum cidr_set_masklen(PG_FUNCTION_ARGS); extern Datum network_scan_first(Datum in); extern Datum network_scan_last(Datum in); extern Datum inet_client_addr(PG_FUNCTION_ARGS); extern Datum inet_client_port(PG_FUNCTION_ARGS); extern Datum inet_server_addr(PG_FUNCTION_ARGS); extern Datum inet_server_port(PG_FUNCTION_ARGS); extern Datum inetnot(PG_FUNCTION_ARGS); extern Datum inetand(PG_FUNCTION_ARGS); extern Datum inetor(PG_FUNCTION_ARGS); extern Datum inetpl(PG_FUNCTION_ARGS); extern Datum inetmi_int8(PG_FUNCTION_ARGS); extern Datum inetmi(PG_FUNCTION_ARGS); extern void clean_ipv6_addr(int addr_family, char *addr); /* mac.c */ extern Datum macaddr_in(PG_FUNCTION_ARGS); extern Datum macaddr_out(PG_FUNCTION_ARGS); extern Datum macaddr_recv(PG_FUNCTION_ARGS); extern Datum macaddr_send(PG_FUNCTION_ARGS); extern Datum macaddr_cmp(PG_FUNCTION_ARGS); extern Datum macaddr_lt(PG_FUNCTION_ARGS); extern Datum macaddr_le(PG_FUNCTION_ARGS); extern Datum macaddr_eq(PG_FUNCTION_ARGS); extern Datum macaddr_ge(PG_FUNCTION_ARGS); extern Datum macaddr_gt(PG_FUNCTION_ARGS); extern Datum macaddr_ne(PG_FUNCTION_ARGS); extern Datum macaddr_not(PG_FUNCTION_ARGS); extern Datum macaddr_and(PG_FUNCTION_ARGS); extern Datum macaddr_or(PG_FUNCTION_ARGS); extern Datum macaddr_trunc(PG_FUNCTION_ARGS); extern Datum hashmacaddr(PG_FUNCTION_ARGS); /* numeric.c */ extern Datum numeric_in(PG_FUNCTION_ARGS); extern Datum numeric_out(PG_FUNCTION_ARGS); extern Datum numeric_recv(PG_FUNCTION_ARGS); extern Datum numeric_send(PG_FUNCTION_ARGS); extern Datum numerictypmodin(PG_FUNCTION_ARGS); extern Datum numerictypmodout(PG_FUNCTION_ARGS); extern Datum numeric_transform(PG_FUNCTION_ARGS); extern Datum numeric (PG_FUNCTION_ARGS); extern Datum numeric_abs(PG_FUNCTION_ARGS); extern Datum numeric_uminus(PG_FUNCTION_ARGS); extern Datum numeric_uplus(PG_FUNCTION_ARGS); extern Datum numeric_sign(PG_FUNCTION_ARGS); extern Datum numeric_round(PG_FUNCTION_ARGS); extern Datum numeric_trunc(PG_FUNCTION_ARGS); extern Datum numeric_ceil(PG_FUNCTION_ARGS); extern Datum numeric_floor(PG_FUNCTION_ARGS); extern Datum numeric_cmp(PG_FUNCTION_ARGS); extern Datum numeric_eq(PG_FUNCTION_ARGS); extern Datum numeric_ne(PG_FUNCTION_ARGS); extern Datum numeric_gt(PG_FUNCTION_ARGS); extern Datum numeric_ge(PG_FUNCTION_ARGS); extern Datum numeric_lt(PG_FUNCTION_ARGS); extern Datum numeric_le(PG_FUNCTION_ARGS); extern Datum numeric_add(PG_FUNCTION_ARGS); extern Datum numeric_sub(PG_FUNCTION_ARGS); extern Datum numeric_mul(PG_FUNCTION_ARGS); extern Datum numeric_div(PG_FUNCTION_ARGS); extern Datum numeric_div_trunc(PG_FUNCTION_ARGS); extern Datum numeric_mod(PG_FUNCTION_ARGS); extern Datum numeric_inc(PG_FUNCTION_ARGS); extern Datum numeric_smaller(PG_FUNCTION_ARGS); extern Datum numeric_larger(PG_FUNCTION_ARGS); extern Datum numeric_fac(PG_FUNCTION_ARGS); extern Datum numeric_sqrt(PG_FUNCTION_ARGS); extern Datum numeric_exp(PG_FUNCTION_ARGS); extern Datum numeric_ln(PG_FUNCTION_ARGS); extern Datum numeric_log(PG_FUNCTION_ARGS); extern Datum numeric_power(PG_FUNCTION_ARGS); extern Datum int4_numeric(PG_FUNCTION_ARGS); extern Datum numeric_int4(PG_FUNCTION_ARGS); extern Datum int8_numeric(PG_FUNCTION_ARGS); extern Datum numeric_int8(PG_FUNCTION_ARGS); extern Datum int2_numeric(PG_FUNCTION_ARGS); extern Datum numeric_int2(PG_FUNCTION_ARGS); extern Datum float8_numeric(PG_FUNCTION_ARGS); extern Datum numeric_float8(PG_FUNCTION_ARGS); extern Datum numeric_float8_no_overflow(PG_FUNCTION_ARGS); extern Datum float4_numeric(PG_FUNCTION_ARGS); extern Datum numeric_float4(PG_FUNCTION_ARGS); extern Datum numeric_accum(PG_FUNCTION_ARGS); extern Datum numeric_avg_accum(PG_FUNCTION_ARGS); extern Datum int2_accum(PG_FUNCTION_ARGS); extern Datum int4_accum(PG_FUNCTION_ARGS); extern Datum int8_accum(PG_FUNCTION_ARGS); extern Datum int8_avg_accum(PG_FUNCTION_ARGS); extern Datum numeric_avg(PG_FUNCTION_ARGS); extern Datum numeric_var_pop(PG_FUNCTION_ARGS); extern Datum numeric_var_samp(PG_FUNCTION_ARGS); extern Datum numeric_stddev_pop(PG_FUNCTION_ARGS); extern Datum numeric_stddev_samp(PG_FUNCTION_ARGS); extern Datum int2_sum(PG_FUNCTION_ARGS); extern Datum int4_sum(PG_FUNCTION_ARGS); extern Datum int8_sum(PG_FUNCTION_ARGS); extern Datum int2_avg_accum(PG_FUNCTION_ARGS); extern Datum int4_avg_accum(PG_FUNCTION_ARGS); extern Datum int8_avg(PG_FUNCTION_ARGS); extern Datum width_bucket_numeric(PG_FUNCTION_ARGS); extern Datum hash_numeric(PG_FUNCTION_ARGS); /* ri_triggers.c */ extern Datum RI_FKey_check_ins(PG_FUNCTION_ARGS); extern Datum RI_FKey_check_upd(PG_FUNCTION_ARGS); extern Datum RI_FKey_noaction_del(PG_FUNCTION_ARGS); extern Datum RI_FKey_noaction_upd(PG_FUNCTION_ARGS); extern Datum RI_FKey_cascade_del(PG_FUNCTION_ARGS); extern Datum RI_FKey_cascade_upd(PG_FUNCTION_ARGS); extern Datum RI_FKey_restrict_del(PG_FUNCTION_ARGS); extern Datum RI_FKey_restrict_upd(PG_FUNCTION_ARGS); extern Datum RI_FKey_setnull_del(PG_FUNCTION_ARGS); extern Datum RI_FKey_setnull_upd(PG_FUNCTION_ARGS); extern Datum RI_FKey_setdefault_del(PG_FUNCTION_ARGS); extern Datum RI_FKey_setdefault_upd(PG_FUNCTION_ARGS); /* trigfuncs.c */ extern Datum suppress_redundant_updates_trigger(PG_FUNCTION_ARGS); /* encoding support functions */ extern Datum getdatabaseencoding(PG_FUNCTION_ARGS); extern Datum database_character_set(PG_FUNCTION_ARGS); extern Datum pg_client_encoding(PG_FUNCTION_ARGS); extern Datum PG_encoding_to_char(PG_FUNCTION_ARGS); extern Datum PG_char_to_encoding(PG_FUNCTION_ARGS); extern Datum PG_character_set_name(PG_FUNCTION_ARGS); extern Datum PG_character_set_id(PG_FUNCTION_ARGS); extern Datum pg_convert(PG_FUNCTION_ARGS); extern Datum pg_convert_to(PG_FUNCTION_ARGS); extern Datum pg_convert_from(PG_FUNCTION_ARGS); extern Datum length_in_encoding(PG_FUNCTION_ARGS); extern Datum pg_encoding_max_length_sql(PG_FUNCTION_ARGS); /* format_type.c */ extern Datum format_type(PG_FUNCTION_ARGS); extern char *format_type_be(Oid type_oid); extern char *format_type_with_typemod(Oid type_oid, int32 typemod); extern Datum oidvectortypes(PG_FUNCTION_ARGS); extern int32 type_maximum_size(Oid type_oid, int32 typemod); /* quote.c */ extern Datum quote_ident(PG_FUNCTION_ARGS); extern Datum quote_literal(PG_FUNCTION_ARGS); extern char *quote_literal_cstr(const char *rawstr); extern Datum quote_nullable(PG_FUNCTION_ARGS); /* guc.c */ extern Datum show_config_by_name(PG_FUNCTION_ARGS); extern Datum set_config_by_name(PG_FUNCTION_ARGS); extern Datum show_all_settings(PG_FUNCTION_ARGS); /* lockfuncs.c */ extern Datum pg_lock_status(PG_FUNCTION_ARGS); extern Datum pg_advisory_lock_int8(PG_FUNCTION_ARGS); extern Datum pg_advisory_xact_lock_int8(PG_FUNCTION_ARGS); extern Datum pg_advisory_lock_shared_int8(PG_FUNCTION_ARGS); extern Datum pg_advisory_xact_lock_shared_int8(PG_FUNCTION_ARGS); extern Datum pg_try_advisory_lock_int8(PG_FUNCTION_ARGS); extern Datum pg_try_advisory_xact_lock_int8(PG_FUNCTION_ARGS); extern Datum pg_try_advisory_lock_shared_int8(PG_FUNCTION_ARGS); extern Datum pg_try_advisory_xact_lock_shared_int8(PG_FUNCTION_ARGS); extern Datum pg_advisory_unlock_int8(PG_FUNCTION_ARGS); extern Datum pg_advisory_unlock_shared_int8(PG_FUNCTION_ARGS); extern Datum pg_advisory_lock_int4(PG_FUNCTION_ARGS); extern Datum pg_advisory_xact_lock_int4(PG_FUNCTION_ARGS); extern Datum pg_advisory_lock_shared_int4(PG_FUNCTION_ARGS); extern Datum pg_advisory_xact_lock_shared_int4(PG_FUNCTION_ARGS); extern Datum pg_try_advisory_lock_int4(PG_FUNCTION_ARGS); extern Datum pg_try_advisory_xact_lock_int4(PG_FUNCTION_ARGS); extern Datum pg_try_advisory_lock_shared_int4(PG_FUNCTION_ARGS); extern Datum pg_try_advisory_xact_lock_shared_int4(PG_FUNCTION_ARGS); extern Datum pg_advisory_unlock_int4(PG_FUNCTION_ARGS); extern Datum pg_advisory_unlock_shared_int4(PG_FUNCTION_ARGS); extern Datum pg_advisory_unlock_all(PG_FUNCTION_ARGS); /* txid.c */ extern Datum txid_snapshot_in(PG_FUNCTION_ARGS); extern Datum txid_snapshot_out(PG_FUNCTION_ARGS); extern Datum txid_snapshot_recv(PG_FUNCTION_ARGS); extern Datum txid_snapshot_send(PG_FUNCTION_ARGS); extern Datum txid_current(PG_FUNCTION_ARGS); extern Datum txid_current_snapshot(PG_FUNCTION_ARGS); extern Datum txid_snapshot_xmin(PG_FUNCTION_ARGS); extern Datum txid_snapshot_xmax(PG_FUNCTION_ARGS); extern Datum txid_snapshot_xip(PG_FUNCTION_ARGS); extern Datum txid_visible_in_snapshot(PG_FUNCTION_ARGS); /* uuid.c */ extern Datum uuid_in(PG_FUNCTION_ARGS); extern Datum uuid_out(PG_FUNCTION_ARGS); extern Datum uuid_send(PG_FUNCTION_ARGS); extern Datum uuid_recv(PG_FUNCTION_ARGS); extern Datum uuid_lt(PG_FUNCTION_ARGS); extern Datum uuid_le(PG_FUNCTION_ARGS); extern Datum uuid_eq(PG_FUNCTION_ARGS); extern Datum uuid_ge(PG_FUNCTION_ARGS); extern Datum uuid_gt(PG_FUNCTION_ARGS); extern Datum uuid_ne(PG_FUNCTION_ARGS); extern Datum uuid_cmp(PG_FUNCTION_ARGS); extern Datum uuid_hash(PG_FUNCTION_ARGS); /* windowfuncs.c */ extern Datum window_row_number(PG_FUNCTION_ARGS); extern Datum window_rank(PG_FUNCTION_ARGS); extern Datum window_dense_rank(PG_FUNCTION_ARGS); extern Datum window_percent_rank(PG_FUNCTION_ARGS); extern Datum window_cume_dist(PG_FUNCTION_ARGS); extern Datum window_ntile(PG_FUNCTION_ARGS); extern Datum window_lag(PG_FUNCTION_ARGS); extern Datum window_lag_with_offset(PG_FUNCTION_ARGS); extern Datum window_lag_with_offset_and_default(PG_FUNCTION_ARGS); extern Datum window_lead(PG_FUNCTION_ARGS); extern Datum window_lead_with_offset(PG_FUNCTION_ARGS); extern Datum window_lead_with_offset_and_default(PG_FUNCTION_ARGS); extern Datum window_first_value(PG_FUNCTION_ARGS); extern Datum window_last_value(PG_FUNCTION_ARGS); extern Datum window_nth_value(PG_FUNCTION_ARGS); /* access/spgist/spgquadtreeproc.c */ extern Datum spg_quad_config(PG_FUNCTION_ARGS); extern Datum spg_quad_choose(PG_FUNCTION_ARGS); extern Datum spg_quad_picksplit(PG_FUNCTION_ARGS); extern Datum spg_quad_inner_consistent(PG_FUNCTION_ARGS); extern Datum spg_quad_leaf_consistent(PG_FUNCTION_ARGS); /* access/spgist/spgkdtreeproc.c */ extern Datum spg_kd_config(PG_FUNCTION_ARGS); extern Datum spg_kd_choose(PG_FUNCTION_ARGS); extern Datum spg_kd_picksplit(PG_FUNCTION_ARGS); extern Datum spg_kd_inner_consistent(PG_FUNCTION_ARGS); /* access/spgist/spgtextproc.c */ extern Datum spg_text_config(PG_FUNCTION_ARGS); extern Datum spg_text_choose(PG_FUNCTION_ARGS); extern Datum spg_text_picksplit(PG_FUNCTION_ARGS); extern Datum spg_text_inner_consistent(PG_FUNCTION_ARGS); extern Datum spg_text_leaf_consistent(PG_FUNCTION_ARGS); /* access/gin/ginarrayproc.c */ extern Datum ginarrayextract(PG_FUNCTION_ARGS); extern Datum ginarrayextract_2args(PG_FUNCTION_ARGS); extern Datum ginqueryarrayextract(PG_FUNCTION_ARGS); extern Datum ginarrayconsistent(PG_FUNCTION_ARGS); /* access/transam/twophase.c */ extern Datum pg_prepared_xact(PG_FUNCTION_ARGS); /* catalogs/dependency.c */ extern Datum pg_describe_object(PG_FUNCTION_ARGS); /* commands/constraint.c */ extern Datum unique_key_recheck(PG_FUNCTION_ARGS); /* commands/extension.c */ extern Datum pg_available_extensions(PG_FUNCTION_ARGS); extern Datum pg_available_extension_versions(PG_FUNCTION_ARGS); extern Datum pg_extension_update_paths(PG_FUNCTION_ARGS); extern Datum pg_extension_config_dump(PG_FUNCTION_ARGS); /* commands/prepare.c */ extern Datum pg_prepared_statement(PG_FUNCTION_ARGS); /* utils/mmgr/portalmem.c */ extern Datum pg_cursor(PG_FUNCTION_ARGS); #endif /* BUILTINS_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/snapmgr.h������������������������������������������������������������������������0000644�����������������00000003131�14763166026�0012171 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * snapmgr.h * POSTGRES snapshot manager * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/snapmgr.h * *------------------------------------------------------------------------- */ #ifndef SNAPMGR_H #define SNAPMGR_H #include "utils/resowner.h" extern bool FirstSnapshotSet; extern TransactionId TransactionXmin; extern TransactionId RecentXmin; extern TransactionId RecentGlobalXmin; extern Snapshot GetTransactionSnapshot(void); extern Snapshot GetLatestSnapshot(void); extern void SnapshotSetCommandId(CommandId curcid); extern void PushActiveSnapshot(Snapshot snapshot); extern void PushCopiedSnapshot(Snapshot snapshot); extern void UpdateActiveSnapshotCommandId(void); extern void PopActiveSnapshot(void); extern Snapshot GetActiveSnapshot(void); extern bool ActiveSnapshotSet(void); extern Snapshot RegisterSnapshot(Snapshot snapshot); extern void UnregisterSnapshot(Snapshot snapshot); extern Snapshot RegisterSnapshotOnOwner(Snapshot snapshot, ResourceOwner owner); extern void UnregisterSnapshotFromOwner(Snapshot snapshot, ResourceOwner owner); extern void AtSubCommit_Snapshot(int level); extern void AtSubAbort_Snapshot(int level); extern void AtEOXact_Snapshot(bool isCommit); extern Datum pg_export_snapshot(PG_FUNCTION_ARGS); extern void ImportSnapshot(const char *idstr); extern bool XactHasExportedSnapshots(void); extern void DeleteAllExportedSnapshotFiles(void); #endif /* SNAPMGR_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/cash.h���������������������������������������������������������������������������0000644�����������������00000004106�14763166026�0011443 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * src/include/utils/cash.h * * * cash.h * Written by D'Arcy J.M. Cain * * Functions to allow input and output of money normally but store * and handle it as 64 bit integer. */ #ifndef CASH_H #define CASH_H #include "fmgr.h" typedef int64 Cash; /* Cash is pass-by-reference if and only if int64 is */ #define DatumGetCash(X) ((Cash) DatumGetInt64(X)) #define CashGetDatum(X) Int64GetDatum(X) #define PG_GETARG_CASH(n) DatumGetCash(PG_GETARG_DATUM(n)) #define PG_RETURN_CASH(x) return CashGetDatum(x) extern Datum cash_in(PG_FUNCTION_ARGS); extern Datum cash_out(PG_FUNCTION_ARGS); extern Datum cash_recv(PG_FUNCTION_ARGS); extern Datum cash_send(PG_FUNCTION_ARGS); extern Datum cash_eq(PG_FUNCTION_ARGS); extern Datum cash_ne(PG_FUNCTION_ARGS); extern Datum cash_lt(PG_FUNCTION_ARGS); extern Datum cash_le(PG_FUNCTION_ARGS); extern Datum cash_gt(PG_FUNCTION_ARGS); extern Datum cash_ge(PG_FUNCTION_ARGS); extern Datum cash_cmp(PG_FUNCTION_ARGS); extern Datum cash_pl(PG_FUNCTION_ARGS); extern Datum cash_mi(PG_FUNCTION_ARGS); extern Datum cash_div_cash(PG_FUNCTION_ARGS); extern Datum cash_mul_flt8(PG_FUNCTION_ARGS); extern Datum flt8_mul_cash(PG_FUNCTION_ARGS); extern Datum cash_div_flt8(PG_FUNCTION_ARGS); extern Datum cash_mul_flt4(PG_FUNCTION_ARGS); extern Datum flt4_mul_cash(PG_FUNCTION_ARGS); extern Datum cash_div_flt4(PG_FUNCTION_ARGS); extern Datum cash_mul_int8(PG_FUNCTION_ARGS); extern Datum int8_mul_cash(PG_FUNCTION_ARGS); extern Datum cash_div_int8(PG_FUNCTION_ARGS); extern Datum cash_mul_int4(PG_FUNCTION_ARGS); extern Datum int4_mul_cash(PG_FUNCTION_ARGS); extern Datum cash_div_int4(PG_FUNCTION_ARGS); extern Datum cash_mul_int2(PG_FUNCTION_ARGS); extern Datum int2_mul_cash(PG_FUNCTION_ARGS); extern Datum cash_div_int2(PG_FUNCTION_ARGS); extern Datum cashlarger(PG_FUNCTION_ARGS); extern Datum cashsmaller(PG_FUNCTION_ARGS); extern Datum cash_words(PG_FUNCTION_ARGS); extern Datum cash_numeric(PG_FUNCTION_ARGS); extern Datum numeric_cash(PG_FUNCTION_ARGS); extern Datum int4_cash(PG_FUNCTION_ARGS); extern Datum int8_cash(PG_FUNCTION_ARGS); #endif /* CASH_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/inval.h��������������������������������������������������������������������������0000644�����������������00000003471�14763166026�0011642 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * inval.h * POSTGRES cache invalidation dispatcher definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/inval.h * *------------------------------------------------------------------------- */ #ifndef INVAL_H #define INVAL_H #include "access/htup.h" #include "utils/relcache.h" typedef void (*SyscacheCallbackFunction) (Datum arg, int cacheid, uint32 hashvalue); typedef void (*RelcacheCallbackFunction) (Datum arg, Oid relid); extern void AcceptInvalidationMessages(void); extern void AtStart_Inval(void); extern void AtSubStart_Inval(void); extern void AtEOXact_Inval(bool isCommit); extern void AtEOSubXact_Inval(bool isCommit); extern void AtPrepare_Inval(void); extern void PostPrepare_Inval(void); extern void CommandEndInvalidationMessages(void); extern void CacheInvalidateHeapTuple(Relation relation, HeapTuple tuple, HeapTuple newtuple); extern void CacheInvalidateCatalog(Oid catalogId); extern void CacheInvalidateRelcache(Relation relation); extern void CacheInvalidateRelcacheByTuple(HeapTuple classTuple); extern void CacheInvalidateRelcacheByRelid(Oid relid); extern void CacheInvalidateSmgr(RelFileNodeBackend rnode); extern void CacheInvalidateRelmap(Oid databaseId); extern void CacheRegisterSyscacheCallback(int cacheid, SyscacheCallbackFunction func, Datum arg); extern void CacheRegisterRelcacheCallback(RelcacheCallbackFunction func, Datum arg); extern void CallSyscacheCallbacks(int cacheid, uint32 hashvalue); extern void inval_twophase_postcommit(TransactionId xid, uint16 info, void *recdata, uint32 len); #endif /* INVAL_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/tuplestore.h���������������������������������������������������������������������0000644�����������������00000006216�14763166026�0012737 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * tuplestore.h * Generalized routines for temporary tuple storage. * * This module handles temporary storage of tuples for purposes such * as Materialize nodes, hashjoin batch files, etc. It is essentially * a dumbed-down version of tuplesort.c; it does no sorting of tuples * but can only store and regurgitate a sequence of tuples. However, * because no sort is required, it is allowed to start reading the sequence * before it has all been written. This is particularly useful for cursors, * because it allows random access within the already-scanned portion of * a query without having to process the underlying scan to completion. * Also, it is possible to support multiple independent read pointers. * * A temporary file is used to handle the data if it exceeds the * space limit specified by the caller. * * Beginning in Postgres 8.2, what is stored is just MinimalTuples; * callers cannot expect valid system columns in regurgitated tuples. * Also, we have changed the API to return tuples in TupleTableSlots, * so that there is a check to prevent attempted access to system columns. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/tuplestore.h * *------------------------------------------------------------------------- */ #ifndef TUPLESTORE_H #define TUPLESTORE_H #include "executor/tuptable.h" /* Tuplestorestate is an opaque type whose details are not known outside * tuplestore.c. */ typedef struct Tuplestorestate Tuplestorestate; /* * Currently we only need to store MinimalTuples, but it would be easy * to support the same behavior for IndexTuples and/or bare Datums. */ extern Tuplestorestate *tuplestore_begin_heap(bool randomAccess, bool interXact, int maxKBytes); extern void tuplestore_set_eflags(Tuplestorestate *state, int eflags); extern void tuplestore_puttupleslot(Tuplestorestate *state, TupleTableSlot *slot); extern void tuplestore_puttuple(Tuplestorestate *state, HeapTuple tuple); extern void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, Datum *values, bool *isnull); /* tuplestore_donestoring() used to be required, but is no longer used */ #define tuplestore_donestoring(state) ((void) 0) extern int tuplestore_alloc_read_pointer(Tuplestorestate *state, int eflags); extern void tuplestore_select_read_pointer(Tuplestorestate *state, int ptr); extern void tuplestore_copy_read_pointer(Tuplestorestate *state, int srcptr, int destptr); extern void tuplestore_trim(Tuplestorestate *state); extern bool tuplestore_in_memory(Tuplestorestate *state); extern bool tuplestore_gettupleslot(Tuplestorestate *state, bool forward, bool copy, TupleTableSlot *slot); extern bool tuplestore_advance(Tuplestorestate *state, bool forward); extern bool tuplestore_ateof(Tuplestorestate *state); extern void tuplestore_rescan(Tuplestorestate *state); extern void tuplestore_clear(Tuplestorestate *state); extern void tuplestore_end(Tuplestorestate *state); #endif /* TUPLESTORE_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/errcodes.h�����������������������������������������������������������������������0000644�����������������00000047157�14763166026�0012350 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* autogenerated from src/backend/utils/errcodes.txt, do not edit */ /* there is deliberately not an #ifndef ERRCODES_H here */ /* Class 00 - Successful Completion */ #define ERRCODE_SUCCESSFUL_COMPLETION MAKE_SQLSTATE('0','0','0','0','0') /* Class 01 - Warning */ #define ERRCODE_WARNING MAKE_SQLSTATE('0','1','0','0','0') #define ERRCODE_WARNING_DYNAMIC_RESULT_SETS_RETURNED MAKE_SQLSTATE('0','1','0','0','C') #define ERRCODE_WARNING_IMPLICIT_ZERO_BIT_PADDING MAKE_SQLSTATE('0','1','0','0','8') #define ERRCODE_WARNING_NULL_VALUE_ELIMINATED_IN_SET_FUNCTION MAKE_SQLSTATE('0','1','0','0','3') #define ERRCODE_WARNING_PRIVILEGE_NOT_GRANTED MAKE_SQLSTATE('0','1','0','0','7') #define ERRCODE_WARNING_PRIVILEGE_NOT_REVOKED MAKE_SQLSTATE('0','1','0','0','6') #define ERRCODE_WARNING_STRING_DATA_RIGHT_TRUNCATION MAKE_SQLSTATE('0','1','0','0','4') #define ERRCODE_WARNING_DEPRECATED_FEATURE MAKE_SQLSTATE('0','1','P','0','1') /* Class 02 - No Data (this is also a warning class per the SQL standard) */ #define ERRCODE_NO_DATA MAKE_SQLSTATE('0','2','0','0','0') #define ERRCODE_NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED MAKE_SQLSTATE('0','2','0','0','1') /* Class 03 - SQL Statement Not Yet Complete */ #define ERRCODE_SQL_STATEMENT_NOT_YET_COMPLETE MAKE_SQLSTATE('0','3','0','0','0') /* Class 08 - Connection Exception */ #define ERRCODE_CONNECTION_EXCEPTION MAKE_SQLSTATE('0','8','0','0','0') #define ERRCODE_CONNECTION_DOES_NOT_EXIST MAKE_SQLSTATE('0','8','0','0','3') #define ERRCODE_CONNECTION_FAILURE MAKE_SQLSTATE('0','8','0','0','6') #define ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION MAKE_SQLSTATE('0','8','0','0','1') #define ERRCODE_SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION MAKE_SQLSTATE('0','8','0','0','4') #define ERRCODE_TRANSACTION_RESOLUTION_UNKNOWN MAKE_SQLSTATE('0','8','0','0','7') #define ERRCODE_PROTOCOL_VIOLATION MAKE_SQLSTATE('0','8','P','0','1') /* Class 09 - Triggered Action Exception */ #define ERRCODE_TRIGGERED_ACTION_EXCEPTION MAKE_SQLSTATE('0','9','0','0','0') /* Class 0A - Feature Not Supported */ #define ERRCODE_FEATURE_NOT_SUPPORTED MAKE_SQLSTATE('0','A','0','0','0') /* Class 0B - Invalid Transaction Initiation */ #define ERRCODE_INVALID_TRANSACTION_INITIATION MAKE_SQLSTATE('0','B','0','0','0') /* Class 0F - Locator Exception */ #define ERRCODE_LOCATOR_EXCEPTION MAKE_SQLSTATE('0','F','0','0','0') #define ERRCODE_L_E_INVALID_SPECIFICATION MAKE_SQLSTATE('0','F','0','0','1') /* Class 0L - Invalid Grantor */ #define ERRCODE_INVALID_GRANTOR MAKE_SQLSTATE('0','L','0','0','0') #define ERRCODE_INVALID_GRANT_OPERATION MAKE_SQLSTATE('0','L','P','0','1') /* Class 0P - Invalid Role Specification */ #define ERRCODE_INVALID_ROLE_SPECIFICATION MAKE_SQLSTATE('0','P','0','0','0') /* Class 0Z - Diagnostics Exception */ #define ERRCODE_DIAGNOSTICS_EXCEPTION MAKE_SQLSTATE('0','Z','0','0','0') #define ERRCODE_STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER MAKE_SQLSTATE('0','Z','0','0','2') /* Class 20 - Case Not Found */ #define ERRCODE_CASE_NOT_FOUND MAKE_SQLSTATE('2','0','0','0','0') /* Class 21 - Cardinality Violation */ #define ERRCODE_CARDINALITY_VIOLATION MAKE_SQLSTATE('2','1','0','0','0') /* Class 22 - Data Exception */ #define ERRCODE_DATA_EXCEPTION MAKE_SQLSTATE('2','2','0','0','0') #define ERRCODE_ARRAY_ELEMENT_ERROR MAKE_SQLSTATE('2','2','0','2','E') #define ERRCODE_ARRAY_SUBSCRIPT_ERROR MAKE_SQLSTATE('2','2','0','2','E') #define ERRCODE_CHARACTER_NOT_IN_REPERTOIRE MAKE_SQLSTATE('2','2','0','2','1') #define ERRCODE_DATETIME_FIELD_OVERFLOW MAKE_SQLSTATE('2','2','0','0','8') #define ERRCODE_DATETIME_VALUE_OUT_OF_RANGE MAKE_SQLSTATE('2','2','0','0','8') #define ERRCODE_DIVISION_BY_ZERO MAKE_SQLSTATE('2','2','0','1','2') #define ERRCODE_ERROR_IN_ASSIGNMENT MAKE_SQLSTATE('2','2','0','0','5') #define ERRCODE_ESCAPE_CHARACTER_CONFLICT MAKE_SQLSTATE('2','2','0','0','B') #define ERRCODE_INDICATOR_OVERFLOW MAKE_SQLSTATE('2','2','0','2','2') #define ERRCODE_INTERVAL_FIELD_OVERFLOW MAKE_SQLSTATE('2','2','0','1','5') #define ERRCODE_INVALID_ARGUMENT_FOR_LOG MAKE_SQLSTATE('2','2','0','1','E') #define ERRCODE_INVALID_ARGUMENT_FOR_NTILE MAKE_SQLSTATE('2','2','0','1','4') #define ERRCODE_INVALID_ARGUMENT_FOR_NTH_VALUE MAKE_SQLSTATE('2','2','0','1','6') #define ERRCODE_INVALID_ARGUMENT_FOR_POWER_FUNCTION MAKE_SQLSTATE('2','2','0','1','F') #define ERRCODE_INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION MAKE_SQLSTATE('2','2','0','1','G') #define ERRCODE_INVALID_CHARACTER_VALUE_FOR_CAST MAKE_SQLSTATE('2','2','0','1','8') #define ERRCODE_INVALID_DATETIME_FORMAT MAKE_SQLSTATE('2','2','0','0','7') #define ERRCODE_INVALID_ESCAPE_CHARACTER MAKE_SQLSTATE('2','2','0','1','9') #define ERRCODE_INVALID_ESCAPE_OCTET MAKE_SQLSTATE('2','2','0','0','D') #define ERRCODE_INVALID_ESCAPE_SEQUENCE MAKE_SQLSTATE('2','2','0','2','5') #define ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER MAKE_SQLSTATE('2','2','P','0','6') #define ERRCODE_INVALID_INDICATOR_PARAMETER_VALUE MAKE_SQLSTATE('2','2','0','1','0') #define ERRCODE_INVALID_PARAMETER_VALUE MAKE_SQLSTATE('2','2','0','2','3') #define ERRCODE_INVALID_REGULAR_EXPRESSION MAKE_SQLSTATE('2','2','0','1','B') #define ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE MAKE_SQLSTATE('2','2','0','1','W') #define ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE MAKE_SQLSTATE('2','2','0','1','X') #define ERRCODE_INVALID_TIME_ZONE_DISPLACEMENT_VALUE MAKE_SQLSTATE('2','2','0','0','9') #define ERRCODE_INVALID_USE_OF_ESCAPE_CHARACTER MAKE_SQLSTATE('2','2','0','0','C') #define ERRCODE_MOST_SPECIFIC_TYPE_MISMATCH MAKE_SQLSTATE('2','2','0','0','G') #define ERRCODE_NULL_VALUE_NOT_ALLOWED MAKE_SQLSTATE('2','2','0','0','4') #define ERRCODE_NULL_VALUE_NO_INDICATOR_PARAMETER MAKE_SQLSTATE('2','2','0','0','2') #define ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE MAKE_SQLSTATE('2','2','0','0','3') #define ERRCODE_STRING_DATA_LENGTH_MISMATCH MAKE_SQLSTATE('2','2','0','2','6') #define ERRCODE_STRING_DATA_RIGHT_TRUNCATION MAKE_SQLSTATE('2','2','0','0','1') #define ERRCODE_SUBSTRING_ERROR MAKE_SQLSTATE('2','2','0','1','1') #define ERRCODE_TRIM_ERROR MAKE_SQLSTATE('2','2','0','2','7') #define ERRCODE_UNTERMINATED_C_STRING MAKE_SQLSTATE('2','2','0','2','4') #define ERRCODE_ZERO_LENGTH_CHARACTER_STRING MAKE_SQLSTATE('2','2','0','0','F') #define ERRCODE_FLOATING_POINT_EXCEPTION MAKE_SQLSTATE('2','2','P','0','1') #define ERRCODE_INVALID_TEXT_REPRESENTATION MAKE_SQLSTATE('2','2','P','0','2') #define ERRCODE_INVALID_BINARY_REPRESENTATION MAKE_SQLSTATE('2','2','P','0','3') #define ERRCODE_BAD_COPY_FILE_FORMAT MAKE_SQLSTATE('2','2','P','0','4') #define ERRCODE_UNTRANSLATABLE_CHARACTER MAKE_SQLSTATE('2','2','P','0','5') #define ERRCODE_NOT_AN_XML_DOCUMENT MAKE_SQLSTATE('2','2','0','0','L') #define ERRCODE_INVALID_XML_DOCUMENT MAKE_SQLSTATE('2','2','0','0','M') #define ERRCODE_INVALID_XML_CONTENT MAKE_SQLSTATE('2','2','0','0','N') #define ERRCODE_INVALID_XML_COMMENT MAKE_SQLSTATE('2','2','0','0','S') #define ERRCODE_INVALID_XML_PROCESSING_INSTRUCTION MAKE_SQLSTATE('2','2','0','0','T') /* Class 23 - Integrity Constraint Violation */ #define ERRCODE_INTEGRITY_CONSTRAINT_VIOLATION MAKE_SQLSTATE('2','3','0','0','0') #define ERRCODE_RESTRICT_VIOLATION MAKE_SQLSTATE('2','3','0','0','1') #define ERRCODE_NOT_NULL_VIOLATION MAKE_SQLSTATE('2','3','5','0','2') #define ERRCODE_FOREIGN_KEY_VIOLATION MAKE_SQLSTATE('2','3','5','0','3') #define ERRCODE_UNIQUE_VIOLATION MAKE_SQLSTATE('2','3','5','0','5') #define ERRCODE_CHECK_VIOLATION MAKE_SQLSTATE('2','3','5','1','4') #define ERRCODE_EXCLUSION_VIOLATION MAKE_SQLSTATE('2','3','P','0','1') /* Class 24 - Invalid Cursor State */ #define ERRCODE_INVALID_CURSOR_STATE MAKE_SQLSTATE('2','4','0','0','0') /* Class 25 - Invalid Transaction State */ #define ERRCODE_INVALID_TRANSACTION_STATE MAKE_SQLSTATE('2','5','0','0','0') #define ERRCODE_ACTIVE_SQL_TRANSACTION MAKE_SQLSTATE('2','5','0','0','1') #define ERRCODE_BRANCH_TRANSACTION_ALREADY_ACTIVE MAKE_SQLSTATE('2','5','0','0','2') #define ERRCODE_HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL MAKE_SQLSTATE('2','5','0','0','8') #define ERRCODE_INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION MAKE_SQLSTATE('2','5','0','0','3') #define ERRCODE_INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION MAKE_SQLSTATE('2','5','0','0','4') #define ERRCODE_NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION MAKE_SQLSTATE('2','5','0','0','5') #define ERRCODE_READ_ONLY_SQL_TRANSACTION MAKE_SQLSTATE('2','5','0','0','6') #define ERRCODE_SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED MAKE_SQLSTATE('2','5','0','0','7') #define ERRCODE_NO_ACTIVE_SQL_TRANSACTION MAKE_SQLSTATE('2','5','P','0','1') #define ERRCODE_IN_FAILED_SQL_TRANSACTION MAKE_SQLSTATE('2','5','P','0','2') /* Class 26 - Invalid SQL Statement Name */ #define ERRCODE_INVALID_SQL_STATEMENT_NAME MAKE_SQLSTATE('2','6','0','0','0') /* Class 27 - Triggered Data Change Violation */ #define ERRCODE_TRIGGERED_DATA_CHANGE_VIOLATION MAKE_SQLSTATE('2','7','0','0','0') /* Class 28 - Invalid Authorization Specification */ #define ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION MAKE_SQLSTATE('2','8','0','0','0') #define ERRCODE_INVALID_PASSWORD MAKE_SQLSTATE('2','8','P','0','1') /* Class 2B - Dependent Privilege Descriptors Still Exist */ #define ERRCODE_DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST MAKE_SQLSTATE('2','B','0','0','0') #define ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST MAKE_SQLSTATE('2','B','P','0','1') /* Class 2D - Invalid Transaction Termination */ #define ERRCODE_INVALID_TRANSACTION_TERMINATION MAKE_SQLSTATE('2','D','0','0','0') /* Class 2F - SQL Routine Exception */ #define ERRCODE_SQL_ROUTINE_EXCEPTION MAKE_SQLSTATE('2','F','0','0','0') #define ERRCODE_S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT MAKE_SQLSTATE('2','F','0','0','5') #define ERRCODE_S_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('2','F','0','0','2') #define ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED MAKE_SQLSTATE('2','F','0','0','3') #define ERRCODE_S_R_E_READING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('2','F','0','0','4') /* Class 34 - Invalid Cursor Name */ #define ERRCODE_INVALID_CURSOR_NAME MAKE_SQLSTATE('3','4','0','0','0') /* Class 38 - External Routine Exception */ #define ERRCODE_EXTERNAL_ROUTINE_EXCEPTION MAKE_SQLSTATE('3','8','0','0','0') #define ERRCODE_E_R_E_CONTAINING_SQL_NOT_PERMITTED MAKE_SQLSTATE('3','8','0','0','1') #define ERRCODE_E_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('3','8','0','0','2') #define ERRCODE_E_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED MAKE_SQLSTATE('3','8','0','0','3') #define ERRCODE_E_R_E_READING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('3','8','0','0','4') /* Class 39 - External Routine Invocation Exception */ #define ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION MAKE_SQLSTATE('3','9','0','0','0') #define ERRCODE_E_R_I_E_INVALID_SQLSTATE_RETURNED MAKE_SQLSTATE('3','9','0','0','1') #define ERRCODE_E_R_I_E_NULL_VALUE_NOT_ALLOWED MAKE_SQLSTATE('3','9','0','0','4') #define ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED MAKE_SQLSTATE('3','9','P','0','1') #define ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED MAKE_SQLSTATE('3','9','P','0','2') /* Class 3B - Savepoint Exception */ #define ERRCODE_SAVEPOINT_EXCEPTION MAKE_SQLSTATE('3','B','0','0','0') #define ERRCODE_S_E_INVALID_SPECIFICATION MAKE_SQLSTATE('3','B','0','0','1') /* Class 3D - Invalid Catalog Name */ #define ERRCODE_INVALID_CATALOG_NAME MAKE_SQLSTATE('3','D','0','0','0') /* Class 3F - Invalid Schema Name */ #define ERRCODE_INVALID_SCHEMA_NAME MAKE_SQLSTATE('3','F','0','0','0') /* Class 40 - Transaction Rollback */ #define ERRCODE_TRANSACTION_ROLLBACK MAKE_SQLSTATE('4','0','0','0','0') #define ERRCODE_T_R_INTEGRITY_CONSTRAINT_VIOLATION MAKE_SQLSTATE('4','0','0','0','2') #define ERRCODE_T_R_SERIALIZATION_FAILURE MAKE_SQLSTATE('4','0','0','0','1') #define ERRCODE_T_R_STATEMENT_COMPLETION_UNKNOWN MAKE_SQLSTATE('4','0','0','0','3') #define ERRCODE_T_R_DEADLOCK_DETECTED MAKE_SQLSTATE('4','0','P','0','1') /* Class 42 - Syntax Error or Access Rule Violation */ #define ERRCODE_SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION MAKE_SQLSTATE('4','2','0','0','0') #define ERRCODE_SYNTAX_ERROR MAKE_SQLSTATE('4','2','6','0','1') #define ERRCODE_INSUFFICIENT_PRIVILEGE MAKE_SQLSTATE('4','2','5','0','1') #define ERRCODE_CANNOT_COERCE MAKE_SQLSTATE('4','2','8','4','6') #define ERRCODE_GROUPING_ERROR MAKE_SQLSTATE('4','2','8','0','3') #define ERRCODE_WINDOWING_ERROR MAKE_SQLSTATE('4','2','P','2','0') #define ERRCODE_INVALID_RECURSION MAKE_SQLSTATE('4','2','P','1','9') #define ERRCODE_INVALID_FOREIGN_KEY MAKE_SQLSTATE('4','2','8','3','0') #define ERRCODE_INVALID_NAME MAKE_SQLSTATE('4','2','6','0','2') #define ERRCODE_NAME_TOO_LONG MAKE_SQLSTATE('4','2','6','2','2') #define ERRCODE_RESERVED_NAME MAKE_SQLSTATE('4','2','9','3','9') #define ERRCODE_DATATYPE_MISMATCH MAKE_SQLSTATE('4','2','8','0','4') #define ERRCODE_INDETERMINATE_DATATYPE MAKE_SQLSTATE('4','2','P','1','8') #define ERRCODE_COLLATION_MISMATCH MAKE_SQLSTATE('4','2','P','2','1') #define ERRCODE_INDETERMINATE_COLLATION MAKE_SQLSTATE('4','2','P','2','2') #define ERRCODE_WRONG_OBJECT_TYPE MAKE_SQLSTATE('4','2','8','0','9') #define ERRCODE_UNDEFINED_COLUMN MAKE_SQLSTATE('4','2','7','0','3') #define ERRCODE_UNDEFINED_CURSOR MAKE_SQLSTATE('3','4','0','0','0') #define ERRCODE_UNDEFINED_DATABASE MAKE_SQLSTATE('3','D','0','0','0') #define ERRCODE_UNDEFINED_FUNCTION MAKE_SQLSTATE('4','2','8','8','3') #define ERRCODE_UNDEFINED_PSTATEMENT MAKE_SQLSTATE('2','6','0','0','0') #define ERRCODE_UNDEFINED_SCHEMA MAKE_SQLSTATE('3','F','0','0','0') #define ERRCODE_UNDEFINED_TABLE MAKE_SQLSTATE('4','2','P','0','1') #define ERRCODE_UNDEFINED_PARAMETER MAKE_SQLSTATE('4','2','P','0','2') #define ERRCODE_UNDEFINED_OBJECT MAKE_SQLSTATE('4','2','7','0','4') #define ERRCODE_DUPLICATE_COLUMN MAKE_SQLSTATE('4','2','7','0','1') #define ERRCODE_DUPLICATE_CURSOR MAKE_SQLSTATE('4','2','P','0','3') #define ERRCODE_DUPLICATE_DATABASE MAKE_SQLSTATE('4','2','P','0','4') #define ERRCODE_DUPLICATE_FUNCTION MAKE_SQLSTATE('4','2','7','2','3') #define ERRCODE_DUPLICATE_PSTATEMENT MAKE_SQLSTATE('4','2','P','0','5') #define ERRCODE_DUPLICATE_SCHEMA MAKE_SQLSTATE('4','2','P','0','6') #define ERRCODE_DUPLICATE_TABLE MAKE_SQLSTATE('4','2','P','0','7') #define ERRCODE_DUPLICATE_ALIAS MAKE_SQLSTATE('4','2','7','1','2') #define ERRCODE_DUPLICATE_OBJECT MAKE_SQLSTATE('4','2','7','1','0') #define ERRCODE_AMBIGUOUS_COLUMN MAKE_SQLSTATE('4','2','7','0','2') #define ERRCODE_AMBIGUOUS_FUNCTION MAKE_SQLSTATE('4','2','7','2','5') #define ERRCODE_AMBIGUOUS_PARAMETER MAKE_SQLSTATE('4','2','P','0','8') #define ERRCODE_AMBIGUOUS_ALIAS MAKE_SQLSTATE('4','2','P','0','9') #define ERRCODE_INVALID_COLUMN_REFERENCE MAKE_SQLSTATE('4','2','P','1','0') #define ERRCODE_INVALID_COLUMN_DEFINITION MAKE_SQLSTATE('4','2','6','1','1') #define ERRCODE_INVALID_CURSOR_DEFINITION MAKE_SQLSTATE('4','2','P','1','1') #define ERRCODE_INVALID_DATABASE_DEFINITION MAKE_SQLSTATE('4','2','P','1','2') #define ERRCODE_INVALID_FUNCTION_DEFINITION MAKE_SQLSTATE('4','2','P','1','3') #define ERRCODE_INVALID_PSTATEMENT_DEFINITION MAKE_SQLSTATE('4','2','P','1','4') #define ERRCODE_INVALID_SCHEMA_DEFINITION MAKE_SQLSTATE('4','2','P','1','5') #define ERRCODE_INVALID_TABLE_DEFINITION MAKE_SQLSTATE('4','2','P','1','6') #define ERRCODE_INVALID_OBJECT_DEFINITION MAKE_SQLSTATE('4','2','P','1','7') /* Class 44 - WITH CHECK OPTION Violation */ #define ERRCODE_WITH_CHECK_OPTION_VIOLATION MAKE_SQLSTATE('4','4','0','0','0') /* Class 53 - Insufficient Resources */ #define ERRCODE_INSUFFICIENT_RESOURCES MAKE_SQLSTATE('5','3','0','0','0') #define ERRCODE_DISK_FULL MAKE_SQLSTATE('5','3','1','0','0') #define ERRCODE_OUT_OF_MEMORY MAKE_SQLSTATE('5','3','2','0','0') #define ERRCODE_TOO_MANY_CONNECTIONS MAKE_SQLSTATE('5','3','3','0','0') #define ERRCODE_CONFIGURATION_LIMIT_EXCEEDED MAKE_SQLSTATE('5','3','4','0','0') /* Class 54 - Program Limit Exceeded */ #define ERRCODE_PROGRAM_LIMIT_EXCEEDED MAKE_SQLSTATE('5','4','0','0','0') #define ERRCODE_STATEMENT_TOO_COMPLEX MAKE_SQLSTATE('5','4','0','0','1') #define ERRCODE_TOO_MANY_COLUMNS MAKE_SQLSTATE('5','4','0','1','1') #define ERRCODE_TOO_MANY_ARGUMENTS MAKE_SQLSTATE('5','4','0','2','3') /* Class 55 - Object Not In Prerequisite State */ #define ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE MAKE_SQLSTATE('5','5','0','0','0') #define ERRCODE_OBJECT_IN_USE MAKE_SQLSTATE('5','5','0','0','6') #define ERRCODE_CANT_CHANGE_RUNTIME_PARAM MAKE_SQLSTATE('5','5','P','0','2') #define ERRCODE_LOCK_NOT_AVAILABLE MAKE_SQLSTATE('5','5','P','0','3') /* Class 57 - Operator Intervention */ #define ERRCODE_OPERATOR_INTERVENTION MAKE_SQLSTATE('5','7','0','0','0') #define ERRCODE_QUERY_CANCELED MAKE_SQLSTATE('5','7','0','1','4') #define ERRCODE_ADMIN_SHUTDOWN MAKE_SQLSTATE('5','7','P','0','1') #define ERRCODE_CRASH_SHUTDOWN MAKE_SQLSTATE('5','7','P','0','2') #define ERRCODE_CANNOT_CONNECT_NOW MAKE_SQLSTATE('5','7','P','0','3') #define ERRCODE_DATABASE_DROPPED MAKE_SQLSTATE('5','7','P','0','4') /* Class 58 - System Error (errors external to PostgreSQL itself) */ #define ERRCODE_SYSTEM_ERROR MAKE_SQLSTATE('5','8','0','0','0') #define ERRCODE_IO_ERROR MAKE_SQLSTATE('5','8','0','3','0') #define ERRCODE_UNDEFINED_FILE MAKE_SQLSTATE('5','8','P','0','1') #define ERRCODE_DUPLICATE_FILE MAKE_SQLSTATE('5','8','P','0','2') /* Class F0 - Configuration File Error */ #define ERRCODE_CONFIG_FILE_ERROR MAKE_SQLSTATE('F','0','0','0','0') #define ERRCODE_LOCK_FILE_EXISTS MAKE_SQLSTATE('F','0','0','0','1') /* Class HV - Foreign Data Wrapper Error (SQL/MED) */ #define ERRCODE_FDW_ERROR MAKE_SQLSTATE('H','V','0','0','0') #define ERRCODE_FDW_COLUMN_NAME_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','5') #define ERRCODE_FDW_DYNAMIC_PARAMETER_VALUE_NEEDED MAKE_SQLSTATE('H','V','0','0','2') #define ERRCODE_FDW_FUNCTION_SEQUENCE_ERROR MAKE_SQLSTATE('H','V','0','1','0') #define ERRCODE_FDW_INCONSISTENT_DESCRIPTOR_INFORMATION MAKE_SQLSTATE('H','V','0','2','1') #define ERRCODE_FDW_INVALID_ATTRIBUTE_VALUE MAKE_SQLSTATE('H','V','0','2','4') #define ERRCODE_FDW_INVALID_COLUMN_NAME MAKE_SQLSTATE('H','V','0','0','7') #define ERRCODE_FDW_INVALID_COLUMN_NUMBER MAKE_SQLSTATE('H','V','0','0','8') #define ERRCODE_FDW_INVALID_DATA_TYPE MAKE_SQLSTATE('H','V','0','0','4') #define ERRCODE_FDW_INVALID_DATA_TYPE_DESCRIPTORS MAKE_SQLSTATE('H','V','0','0','6') #define ERRCODE_FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER MAKE_SQLSTATE('H','V','0','9','1') #define ERRCODE_FDW_INVALID_HANDLE MAKE_SQLSTATE('H','V','0','0','B') #define ERRCODE_FDW_INVALID_OPTION_INDEX MAKE_SQLSTATE('H','V','0','0','C') #define ERRCODE_FDW_INVALID_OPTION_NAME MAKE_SQLSTATE('H','V','0','0','D') #define ERRCODE_FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH MAKE_SQLSTATE('H','V','0','9','0') #define ERRCODE_FDW_INVALID_STRING_FORMAT MAKE_SQLSTATE('H','V','0','0','A') #define ERRCODE_FDW_INVALID_USE_OF_NULL_POINTER MAKE_SQLSTATE('H','V','0','0','9') #define ERRCODE_FDW_TOO_MANY_HANDLES MAKE_SQLSTATE('H','V','0','1','4') #define ERRCODE_FDW_OUT_OF_MEMORY MAKE_SQLSTATE('H','V','0','0','1') #define ERRCODE_FDW_NO_SCHEMAS MAKE_SQLSTATE('H','V','0','0','P') #define ERRCODE_FDW_OPTION_NAME_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','J') #define ERRCODE_FDW_REPLY_HANDLE MAKE_SQLSTATE('H','V','0','0','K') #define ERRCODE_FDW_SCHEMA_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','Q') #define ERRCODE_FDW_TABLE_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','R') #define ERRCODE_FDW_UNABLE_TO_CREATE_EXECUTION MAKE_SQLSTATE('H','V','0','0','L') #define ERRCODE_FDW_UNABLE_TO_CREATE_REPLY MAKE_SQLSTATE('H','V','0','0','M') #define ERRCODE_FDW_UNABLE_TO_ESTABLISH_CONNECTION MAKE_SQLSTATE('H','V','0','0','N') /* Class P0 - PL/pgSQL Error */ #define ERRCODE_PLPGSQL_ERROR MAKE_SQLSTATE('P','0','0','0','0') #define ERRCODE_RAISE_EXCEPTION MAKE_SQLSTATE('P','0','0','0','1') #define ERRCODE_NO_DATA_FOUND MAKE_SQLSTATE('P','0','0','0','2') #define ERRCODE_TOO_MANY_ROWS MAKE_SQLSTATE('P','0','0','0','3') /* Class XX - Internal Error */ #define ERRCODE_INTERNAL_ERROR MAKE_SQLSTATE('X','X','0','0','0') #define ERRCODE_DATA_CORRUPTED MAKE_SQLSTATE('X','X','0','0','1') #define ERRCODE_INDEX_CORRUPTED MAKE_SQLSTATE('X','X','0','0','2') �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/plancache.h����������������������������������������������������������������������0000644�����������������00000020024�14763166026�0012440 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * plancache.h * Plan cache definitions. * * See plancache.c for comments. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/plancache.h * *------------------------------------------------------------------------- */ #ifndef PLANCACHE_H #define PLANCACHE_H #include "access/tupdesc.h" #include "nodes/params.h" #define CACHEDPLANSOURCE_MAGIC 195726186 #define CACHEDPLAN_MAGIC 953717834 /* * CachedPlanSource (which might better have been called CachedQuery) * represents a SQL query that we expect to use multiple times. It stores * the query source text, the raw parse tree, and the analyzed-and-rewritten * query tree, as well as adjunct data. Cache invalidation can happen as a * result of DDL affecting objects used by the query. In that case we discard * the analyzed-and-rewritten query tree, and rebuild it when next needed. * * An actual execution plan, represented by CachedPlan, is derived from the * CachedPlanSource when we need to execute the query. The plan could be * either generic (usable with any set of plan parameters) or custom (for a * specific set of parameters). plancache.c contains the logic that decides * which way to do it for any particular execution. If we are using a generic * cached plan then it is meant to be re-used across multiple executions, so * callers must always treat CachedPlans as read-only. * * Once successfully built and "saved", CachedPlanSources typically live * for the life of the backend, although they can be dropped explicitly. * CachedPlans are reference-counted and go away automatically when the last * reference is dropped. A CachedPlan can outlive the CachedPlanSource it * was created from. * * An "unsaved" CachedPlanSource can be used for generating plans, but it * lives in transient storage and will not be updated in response to sinval * events. * * CachedPlans made from saved CachedPlanSources are likewise in permanent * storage, so to avoid memory leaks, the reference-counted references to them * must be held in permanent data structures or ResourceOwners. CachedPlans * made from unsaved CachedPlanSources are in children of the caller's * memory context, so references to them should not be longer-lived than * that context. (Reference counting is somewhat pro forma in that case, * though it may be useful if the CachedPlan can be discarded early.) * * A CachedPlanSource has two associated memory contexts: one that holds the * struct itself, the query source text and the raw parse tree, and another * context that holds the rewritten query tree and associated data. This * allows the query tree to be discarded easily when it is invalidated. * * Some callers wish to use the CachedPlan API even with one-shot queries * that have no reason to be saved at all. We therefore support a "oneshot" * variant that does no data copying or invalidation checking. In this case * there are no separate memory contexts: the CachedPlanSource struct and * all subsidiary data live in the caller's CurrentMemoryContext, and there * is no way to free memory short of clearing that entire context. A oneshot * plan is always treated as unsaved. * * Note: the string referenced by commandTag is not subsidiary storage; * it is assumed to be a compile-time-constant string. As with portals, * commandTag shall be NULL if and only if the original query string (before * rewriting) was an empty string. */ typedef struct CachedPlanSource { int magic; /* should equal CACHEDPLANSOURCE_MAGIC */ Node *raw_parse_tree; /* output of raw_parser(), or NULL */ const char *query_string; /* source text of query */ const char *commandTag; /* command tag (a constant!), or NULL */ Oid *param_types; /* array of parameter type OIDs, or NULL */ int num_params; /* length of param_types array */ ParserSetupHook parserSetup; /* alternative parameter spec method */ void *parserSetupArg; int cursor_options; /* cursor options used for planning */ bool fixed_result; /* disallow change in result tupdesc? */ TupleDesc resultDesc; /* result type; NULL = doesn't return tuples */ struct OverrideSearchPath *search_path; /* saved search_path */ MemoryContext context; /* memory context holding all above */ /* These fields describe the current analyzed-and-rewritten query tree: */ List *query_list; /* list of Query nodes, or NIL if not valid */ List *relationOids; /* OIDs of relations the queries depend on */ List *invalItems; /* other dependencies, as PlanInvalItems */ MemoryContext query_context; /* context holding the above, or NULL */ /* If we have a generic plan, this is a reference-counted link to it: */ struct CachedPlan *gplan; /* generic plan, or NULL if not valid */ /* Some state flags: */ bool is_complete; /* has CompleteCachedPlan been done? */ bool is_saved; /* has CachedPlanSource been "saved"? */ bool is_valid; /* is the query_list currently valid? */ bool is_oneshot; /* is it a "oneshot" plan? */ int generation; /* increments each time we create a plan */ /* If CachedPlanSource has been saved, it is a member of a global list */ struct CachedPlanSource *next_saved; /* list link, if so */ /* State kept to help decide whether to use custom or generic plans: */ double generic_cost; /* cost of generic plan, or -1 if not known */ double total_custom_cost; /* total cost of custom plans so far */ int num_custom_plans; /* number of plans included in total */ } CachedPlanSource; /* * CachedPlan represents an execution plan derived from a CachedPlanSource. * The reference count includes both the link from the parent CachedPlanSource * (if any), and any active plan executions, so the plan can be discarded * exactly when refcount goes to zero. Both the struct itself and the * subsidiary data live in the context denoted by the context field. * This makes it easy to free a no-longer-needed cached plan. (However, * if is_oneshot is true, the context does not belong solely to the CachedPlan * so no freeing is possible.) */ typedef struct CachedPlan { int magic; /* should equal CACHEDPLAN_MAGIC */ List *stmt_list; /* list of statement nodes (PlannedStmts and * bare utility statements) */ bool is_saved; /* is CachedPlan in a long-lived context? */ bool is_valid; /* is the stmt_list currently valid? */ bool is_oneshot; /* is it a "oneshot" plan? */ TransactionId saved_xmin; /* if valid, replan when TransactionXmin * changes from this value */ int generation; /* parent's generation number for this plan */ int refcount; /* count of live references to this struct */ MemoryContext context; /* context containing this CachedPlan */ } CachedPlan; extern void InitPlanCache(void); extern void ResetPlanCache(void); extern CachedPlanSource *CreateCachedPlan(Node *raw_parse_tree, const char *query_string, const char *commandTag); extern CachedPlanSource *CreateOneShotCachedPlan(Node *raw_parse_tree, const char *query_string, const char *commandTag); extern void CompleteCachedPlan(CachedPlanSource *plansource, List *querytree_list, MemoryContext querytree_context, Oid *param_types, int num_params, ParserSetupHook parserSetup, void *parserSetupArg, int cursor_options, bool fixed_result); extern void SaveCachedPlan(CachedPlanSource *plansource); extern void DropCachedPlan(CachedPlanSource *plansource); extern void CachedPlanSetParentContext(CachedPlanSource *plansource, MemoryContext newcontext); extern CachedPlanSource *CopyCachedPlan(CachedPlanSource *plansource); extern bool CachedPlanIsValid(CachedPlanSource *plansource); extern List *CachedPlanGetTargetList(CachedPlanSource *plansource); extern CachedPlan *GetCachedPlan(CachedPlanSource *plansource, ParamListInfo boundParams, bool useResOwner); extern void ReleaseCachedPlan(CachedPlan *plan, bool useResOwner); #endif /* PLANCACHE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/int8.h���������������������������������������������������������������������������0000644�����������������00000010042�14763166026�0011403 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * int8.h * Declarations for operations on 64-bit integers. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/int8.h * * NOTES * These data types are supported on all 64-bit architectures, and may * be supported through libraries on some 32-bit machines. If your machine * is not currently supported, then please try to make it so, then post * patches to the postgresql.org hackers mailing list. * *------------------------------------------------------------------------- */ #ifndef INT8_H #define INT8_H #include "fmgr.h" extern bool scanint8(const char *str, bool errorOK, int64 *result); extern Datum int8in(PG_FUNCTION_ARGS); extern Datum int8out(PG_FUNCTION_ARGS); extern Datum int8recv(PG_FUNCTION_ARGS); extern Datum int8send(PG_FUNCTION_ARGS); extern Datum int8eq(PG_FUNCTION_ARGS); extern Datum int8ne(PG_FUNCTION_ARGS); extern Datum int8lt(PG_FUNCTION_ARGS); extern Datum int8gt(PG_FUNCTION_ARGS); extern Datum int8le(PG_FUNCTION_ARGS); extern Datum int8ge(PG_FUNCTION_ARGS); extern Datum int84eq(PG_FUNCTION_ARGS); extern Datum int84ne(PG_FUNCTION_ARGS); extern Datum int84lt(PG_FUNCTION_ARGS); extern Datum int84gt(PG_FUNCTION_ARGS); extern Datum int84le(PG_FUNCTION_ARGS); extern Datum int84ge(PG_FUNCTION_ARGS); extern Datum int48eq(PG_FUNCTION_ARGS); extern Datum int48ne(PG_FUNCTION_ARGS); extern Datum int48lt(PG_FUNCTION_ARGS); extern Datum int48gt(PG_FUNCTION_ARGS); extern Datum int48le(PG_FUNCTION_ARGS); extern Datum int48ge(PG_FUNCTION_ARGS); extern Datum int82eq(PG_FUNCTION_ARGS); extern Datum int82ne(PG_FUNCTION_ARGS); extern Datum int82lt(PG_FUNCTION_ARGS); extern Datum int82gt(PG_FUNCTION_ARGS); extern Datum int82le(PG_FUNCTION_ARGS); extern Datum int82ge(PG_FUNCTION_ARGS); extern Datum int28eq(PG_FUNCTION_ARGS); extern Datum int28ne(PG_FUNCTION_ARGS); extern Datum int28lt(PG_FUNCTION_ARGS); extern Datum int28gt(PG_FUNCTION_ARGS); extern Datum int28le(PG_FUNCTION_ARGS); extern Datum int28ge(PG_FUNCTION_ARGS); extern Datum int8um(PG_FUNCTION_ARGS); extern Datum int8up(PG_FUNCTION_ARGS); extern Datum int8pl(PG_FUNCTION_ARGS); extern Datum int8mi(PG_FUNCTION_ARGS); extern Datum int8mul(PG_FUNCTION_ARGS); extern Datum int8div(PG_FUNCTION_ARGS); extern Datum int8abs(PG_FUNCTION_ARGS); extern Datum int8mod(PG_FUNCTION_ARGS); extern Datum int8inc(PG_FUNCTION_ARGS); extern Datum int8inc_any(PG_FUNCTION_ARGS); extern Datum int8inc_float8_float8(PG_FUNCTION_ARGS); extern Datum int8larger(PG_FUNCTION_ARGS); extern Datum int8smaller(PG_FUNCTION_ARGS); extern Datum int8and(PG_FUNCTION_ARGS); extern Datum int8or(PG_FUNCTION_ARGS); extern Datum int8xor(PG_FUNCTION_ARGS); extern Datum int8not(PG_FUNCTION_ARGS); extern Datum int8shl(PG_FUNCTION_ARGS); extern Datum int8shr(PG_FUNCTION_ARGS); extern Datum int84pl(PG_FUNCTION_ARGS); extern Datum int84mi(PG_FUNCTION_ARGS); extern Datum int84mul(PG_FUNCTION_ARGS); extern Datum int84div(PG_FUNCTION_ARGS); extern Datum int48pl(PG_FUNCTION_ARGS); extern Datum int48mi(PG_FUNCTION_ARGS); extern Datum int48mul(PG_FUNCTION_ARGS); extern Datum int48div(PG_FUNCTION_ARGS); extern Datum int82pl(PG_FUNCTION_ARGS); extern Datum int82mi(PG_FUNCTION_ARGS); extern Datum int82mul(PG_FUNCTION_ARGS); extern Datum int82div(PG_FUNCTION_ARGS); extern Datum int28pl(PG_FUNCTION_ARGS); extern Datum int28mi(PG_FUNCTION_ARGS); extern Datum int28mul(PG_FUNCTION_ARGS); extern Datum int28div(PG_FUNCTION_ARGS); extern Datum int48(PG_FUNCTION_ARGS); extern Datum int84(PG_FUNCTION_ARGS); extern Datum int28(PG_FUNCTION_ARGS); extern Datum int82(PG_FUNCTION_ARGS); extern Datum i8tod(PG_FUNCTION_ARGS); extern Datum dtoi8(PG_FUNCTION_ARGS); extern Datum i8tof(PG_FUNCTION_ARGS); extern Datum ftoi8(PG_FUNCTION_ARGS); extern Datum i8tooid(PG_FUNCTION_ARGS); extern Datum oidtoi8(PG_FUNCTION_ARGS); extern Datum generate_series_int8(PG_FUNCTION_ARGS); extern Datum generate_series_step_int8(PG_FUNCTION_ARGS); #endif /* INT8_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/dynamic_loader.h�����������������������������������������������������������������0000644�����������������00000001210�14763166026�0013470 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * dynamic_loader.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/dynamic_loader.h * *------------------------------------------------------------------------- */ #ifndef DYNAMIC_LOADER_H #define DYNAMIC_LOADER_H #include "fmgr.h" extern void *pg_dlopen(char *filename); extern PGFunction pg_dlsym(void *handle, char *funcname); extern void pg_dlclose(void *handle); extern char *pg_dlerror(void); #endif /* DYNAMIC_LOADER_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/resowner.h�����������������������������������������������������������������������0000644�����������������00000012106�14763166026�0012370 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * resowner.h * POSTGRES resource owner definitions. * * Query-lifespan resources are tracked by associating them with * ResourceOwner objects. This provides a simple mechanism for ensuring * that such resources are freed at the right time. * See utils/resowner/README for more info. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/resowner.h * *------------------------------------------------------------------------- */ #ifndef RESOWNER_H #define RESOWNER_H #include "storage/fd.h" #include "storage/lock.h" #include "utils/catcache.h" #include "utils/plancache.h" #include "utils/snapshot.h" /* * ResourceOwner objects are an opaque data structure known only within * resowner.c. */ typedef struct ResourceOwnerData *ResourceOwner; /* * Globally known ResourceOwners */ extern PGDLLIMPORT ResourceOwner CurrentResourceOwner; extern PGDLLIMPORT ResourceOwner CurTransactionResourceOwner; extern PGDLLIMPORT ResourceOwner TopTransactionResourceOwner; /* * Resource releasing is done in three phases: pre-locks, locks, and * post-locks. The pre-lock phase must release any resources that are * visible to other backends (such as pinned buffers); this ensures that * when we release a lock that another backend may be waiting on, it will * see us as being fully out of our transaction. The post-lock phase * should be used for backend-internal cleanup. */ typedef enum { RESOURCE_RELEASE_BEFORE_LOCKS, RESOURCE_RELEASE_LOCKS, RESOURCE_RELEASE_AFTER_LOCKS } ResourceReleasePhase; /* * Dynamically loaded modules can get control during ResourceOwnerRelease * by providing a callback of this form. */ typedef void (*ResourceReleaseCallback) (ResourceReleasePhase phase, bool isCommit, bool isTopLevel, void *arg); /* * Functions in resowner.c */ /* generic routines */ extern ResourceOwner ResourceOwnerCreate(ResourceOwner parent, const char *name); extern void ResourceOwnerRelease(ResourceOwner owner, ResourceReleasePhase phase, bool isCommit, bool isTopLevel); extern void ResourceOwnerDelete(ResourceOwner owner); extern ResourceOwner ResourceOwnerGetParent(ResourceOwner owner); extern void ResourceOwnerNewParent(ResourceOwner owner, ResourceOwner newparent); extern void RegisterResourceReleaseCallback(ResourceReleaseCallback callback, void *arg); extern void UnregisterResourceReleaseCallback(ResourceReleaseCallback callback, void *arg); /* support for buffer refcount management */ extern void ResourceOwnerEnlargeBuffers(ResourceOwner owner); extern void ResourceOwnerRememberBuffer(ResourceOwner owner, Buffer buffer); extern void ResourceOwnerForgetBuffer(ResourceOwner owner, Buffer buffer); /* support for local lock management */ extern void ResourceOwnerRememberLock(ResourceOwner owner, LOCALLOCK *locallock); extern void ResourceOwnerForgetLock(ResourceOwner owner, LOCALLOCK *locallock); /* support for catcache refcount management */ extern void ResourceOwnerEnlargeCatCacheRefs(ResourceOwner owner); extern void ResourceOwnerRememberCatCacheRef(ResourceOwner owner, HeapTuple tuple); extern void ResourceOwnerForgetCatCacheRef(ResourceOwner owner, HeapTuple tuple); extern void ResourceOwnerEnlargeCatCacheListRefs(ResourceOwner owner); extern void ResourceOwnerRememberCatCacheListRef(ResourceOwner owner, CatCList *list); extern void ResourceOwnerForgetCatCacheListRef(ResourceOwner owner, CatCList *list); /* support for relcache refcount management */ extern void ResourceOwnerEnlargeRelationRefs(ResourceOwner owner); extern void ResourceOwnerRememberRelationRef(ResourceOwner owner, Relation rel); extern void ResourceOwnerForgetRelationRef(ResourceOwner owner, Relation rel); /* support for plancache refcount management */ extern void ResourceOwnerEnlargePlanCacheRefs(ResourceOwner owner); extern void ResourceOwnerRememberPlanCacheRef(ResourceOwner owner, CachedPlan *plan); extern void ResourceOwnerForgetPlanCacheRef(ResourceOwner owner, CachedPlan *plan); /* support for tupledesc refcount management */ extern void ResourceOwnerEnlargeTupleDescs(ResourceOwner owner); extern void ResourceOwnerRememberTupleDesc(ResourceOwner owner, TupleDesc tupdesc); extern void ResourceOwnerForgetTupleDesc(ResourceOwner owner, TupleDesc tupdesc); /* support for snapshot refcount management */ extern void ResourceOwnerEnlargeSnapshots(ResourceOwner owner); extern void ResourceOwnerRememberSnapshot(ResourceOwner owner, Snapshot snapshot); extern void ResourceOwnerForgetSnapshot(ResourceOwner owner, Snapshot snapshot); /* support for temporary file management */ extern void ResourceOwnerEnlargeFiles(ResourceOwner owner); extern void ResourceOwnerRememberFile(ResourceOwner owner, File file); extern void ResourceOwnerForgetFile(ResourceOwner owner, File file); #endif /* RESOWNER_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/typcache.h�����������������������������������������������������������������������0000644�����������������00000010414�14763166026�0012324 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * typcache.h * Type cache definitions. * * The type cache exists to speed lookup of certain information about data * types that is not directly available from a type's pg_type row. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/typcache.h * *------------------------------------------------------------------------- */ #ifndef TYPCACHE_H #define TYPCACHE_H #include "access/tupdesc.h" #include "fmgr.h" /* TypeCacheEnumData is an opaque struct known only within typcache.c */ struct TypeCacheEnumData; typedef struct TypeCacheEntry { /* typeId is the hash lookup key and MUST BE FIRST */ Oid type_id; /* OID of the data type */ /* some subsidiary information copied from the pg_type row */ int16 typlen; bool typbyval; char typalign; char typstorage; char typtype; Oid typrelid; /* * Information obtained from opfamily entries * * These will be InvalidOid if no match could be found, or if the * information hasn't yet been requested. Also note that for array and * composite types, typcache.c checks that the contained types are * comparable or hashable before allowing eq_opr etc to become set. */ Oid btree_opf; /* the default btree opclass' family */ Oid btree_opintype; /* the default btree opclass' opcintype */ Oid hash_opf; /* the default hash opclass' family */ Oid hash_opintype; /* the default hash opclass' opcintype */ Oid eq_opr; /* the equality operator */ Oid lt_opr; /* the less-than operator */ Oid gt_opr; /* the greater-than operator */ Oid cmp_proc; /* the btree comparison function */ Oid hash_proc; /* the hash calculation function */ /* * Pre-set-up fmgr call info for the equality operator, the btree * comparison function, and the hash calculation function. These are kept * in the type cache to avoid problems with memory leaks in repeated calls * to functions such as array_eq, array_cmp, hash_array. There is not * currently a need to maintain call info for the lt_opr or gt_opr. */ FmgrInfo eq_opr_finfo; FmgrInfo cmp_proc_finfo; FmgrInfo hash_proc_finfo; /* * Tuple descriptor if it's a composite type (row type). NULL if not * composite or information hasn't yet been requested. (NOTE: this is a * reference-counted tupledesc.) */ TupleDesc tupDesc; /* * Fields computed when TYPECACHE_RANGE_INFO is requested. Zeroes if not * a range type or information hasn't yet been requested. Note that * rng_cmp_proc_finfo could be different from the element type's default * btree comparison function. */ struct TypeCacheEntry *rngelemtype; /* range's element type */ Oid rng_collation; /* collation for comparisons, if any */ FmgrInfo rng_cmp_proc_finfo; /* comparison function */ FmgrInfo rng_canonical_finfo; /* canonicalization function, if any */ FmgrInfo rng_subdiff_finfo; /* difference function, if any */ /* Private data, for internal use of typcache.c only */ int flags; /* flags about what we've computed */ /* * Private information about an enum type. NULL if not enum or * information hasn't been requested. */ struct TypeCacheEnumData *enumData; } TypeCacheEntry; /* Bit flags to indicate which fields a given caller needs to have set */ #define TYPECACHE_EQ_OPR 0x0001 #define TYPECACHE_LT_OPR 0x0002 #define TYPECACHE_GT_OPR 0x0004 #define TYPECACHE_CMP_PROC 0x0008 #define TYPECACHE_HASH_PROC 0x0010 #define TYPECACHE_EQ_OPR_FINFO 0x0020 #define TYPECACHE_CMP_PROC_FINFO 0x0040 #define TYPECACHE_HASH_PROC_FINFO 0x0080 #define TYPECACHE_TUPDESC 0x0100 #define TYPECACHE_BTREE_OPFAMILY 0x0200 #define TYPECACHE_HASH_OPFAMILY 0x0400 #define TYPECACHE_RANGE_INFO 0x0800 extern TypeCacheEntry *lookup_type_cache(Oid type_id, int flags); extern TupleDesc lookup_rowtype_tupdesc(Oid type_id, int32 typmod); extern TupleDesc lookup_rowtype_tupdesc_noerror(Oid type_id, int32 typmod, bool noError); extern TupleDesc lookup_rowtype_tupdesc_copy(Oid type_id, int32 typmod); extern void assign_record_type_typmod(TupleDesc tupDesc); extern int compare_values_of_enum(TypeCacheEntry *tcache, Oid arg1, Oid arg2); #endif /* TYPCACHE_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/dynahash.h�����������������������������������������������������������������������0000644�����������������00000000762�14763166026�0012330 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * dynahash * POSTGRES dynahash.h file definitions * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/dynahash.h * *------------------------------------------------------------------------- */ #ifndef DYNAHASH_H #define DYNAHASH_H extern int my_log2(long num); #endif /* DYNAHASH_H */ ��������������pgsql/server/utils/rangetypes.h���������������������������������������������������������������������0000644�����������������00000016631�14763166026�0012714 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * rangetypes.h * Declarations for Postgres range types. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/rangetypes.h * *------------------------------------------------------------------------- */ #ifndef RANGETYPES_H #define RANGETYPES_H #include "utils/typcache.h" /* * Ranges are varlena objects, so must meet the varlena convention that * the first int32 of the object contains the total object size in bytes. * Be sure to use VARSIZE() and SET_VARSIZE() to access it, though! */ typedef struct { int32 vl_len_; /* varlena header (do not touch directly!) */ Oid rangetypid; /* range type's own OID */ /* Following the OID are zero to two bound values, then a flags byte */ } RangeType; /* Use this macro in preference to fetching rangetypid field directly */ #define RangeTypeGetOid(r) ((r)->rangetypid) /* A range's flags byte contains these bits: */ #define RANGE_EMPTY 0x01 /* range is empty */ #define RANGE_LB_INC 0x02 /* lower bound is inclusive */ #define RANGE_UB_INC 0x04 /* upper bound is inclusive */ #define RANGE_LB_INF 0x08 /* lower bound is -infinity */ #define RANGE_UB_INF 0x10 /* upper bound is +infinity */ #define RANGE_LB_NULL 0x20 /* lower bound is null (NOT USED) */ #define RANGE_UB_NULL 0x40 /* upper bound is null (NOT USED) */ #define RANGE_CONTAIN_EMPTY 0x80/* marks a GiST internal-page entry whose * subtree contains some empty ranges */ #define RANGE_HAS_LBOUND(flags) (!((flags) & (RANGE_EMPTY | \ RANGE_LB_NULL | \ RANGE_LB_INF))) #define RANGE_HAS_UBOUND(flags) (!((flags) & (RANGE_EMPTY | \ RANGE_UB_NULL | \ RANGE_UB_INF))) #define RangeIsEmpty(r) ((range_get_flags(r) & RANGE_EMPTY) != 0) #define RangeIsOrContainsEmpty(r) \ ((range_get_flags(r) & (RANGE_EMPTY | RANGE_CONTAIN_EMPTY)) != 0) /* Internal representation of either bound of a range (not what's on disk) */ typedef struct { Datum val; /* the bound value, if any */ bool infinite; /* bound is +/- infinity */ bool inclusive; /* bound is inclusive (vs exclusive) */ bool lower; /* this is the lower (vs upper) bound */ } RangeBound; /* * fmgr macros for range type objects */ #define DatumGetRangeType(X) ((RangeType *) PG_DETOAST_DATUM(X)) #define DatumGetRangeTypeCopy(X) ((RangeType *) PG_DETOAST_DATUM_COPY(X)) #define RangeTypeGetDatum(X) PointerGetDatum(X) #define PG_GETARG_RANGE(n) DatumGetRangeType(PG_GETARG_DATUM(n)) #define PG_GETARG_RANGE_COPY(n) DatumGetRangeTypeCopy(PG_GETARG_DATUM(n)) #define PG_RETURN_RANGE(x) return RangeTypeGetDatum(x) /* * prototypes for functions defined in rangetypes.c */ /* I/O */ extern Datum range_in(PG_FUNCTION_ARGS); extern Datum range_out(PG_FUNCTION_ARGS); extern Datum range_recv(PG_FUNCTION_ARGS); extern Datum range_send(PG_FUNCTION_ARGS); /* constructors */ extern Datum range_constructor2(PG_FUNCTION_ARGS); extern Datum range_constructor3(PG_FUNCTION_ARGS); /* range -> subtype */ extern Datum range_lower(PG_FUNCTION_ARGS); extern Datum range_upper(PG_FUNCTION_ARGS); /* range -> bool */ extern Datum range_empty(PG_FUNCTION_ARGS); extern Datum range_lower_inc(PG_FUNCTION_ARGS); extern Datum range_upper_inc(PG_FUNCTION_ARGS); extern Datum range_lower_inf(PG_FUNCTION_ARGS); extern Datum range_upper_inf(PG_FUNCTION_ARGS); /* range, element -> bool */ extern Datum range_contains_elem(PG_FUNCTION_ARGS); extern Datum elem_contained_by_range(PG_FUNCTION_ARGS); extern bool range_contains_elem_internal(TypeCacheEntry *typcache, RangeType *r, Datum val); /* range, range -> bool */ extern Datum range_eq(PG_FUNCTION_ARGS); extern Datum range_ne(PG_FUNCTION_ARGS); extern Datum range_contains(PG_FUNCTION_ARGS); extern Datum range_contained_by(PG_FUNCTION_ARGS); extern Datum range_before(PG_FUNCTION_ARGS); extern Datum range_after(PG_FUNCTION_ARGS); extern Datum range_adjacent(PG_FUNCTION_ARGS); extern Datum range_overlaps(PG_FUNCTION_ARGS); extern Datum range_overleft(PG_FUNCTION_ARGS); extern Datum range_overright(PG_FUNCTION_ARGS); /* internal versions of the above */ extern bool range_eq_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2); extern bool range_ne_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2); extern bool range_contains_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2); extern bool range_contained_by_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2); extern bool range_before_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2); extern bool range_after_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2); extern bool range_adjacent_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2); extern bool range_overlaps_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2); extern bool range_overleft_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2); extern bool range_overright_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2); /* range, range -> range */ extern Datum range_minus(PG_FUNCTION_ARGS); extern Datum range_union(PG_FUNCTION_ARGS); extern Datum range_intersect(PG_FUNCTION_ARGS); /* BTree support */ extern Datum range_cmp(PG_FUNCTION_ARGS); extern Datum range_lt(PG_FUNCTION_ARGS); extern Datum range_le(PG_FUNCTION_ARGS); extern Datum range_ge(PG_FUNCTION_ARGS); extern Datum range_gt(PG_FUNCTION_ARGS); /* Hash support */ extern Datum hash_range(PG_FUNCTION_ARGS); /* ANALYZE support */ extern Datum range_typanalyze(PG_FUNCTION_ARGS); /* Canonical functions */ extern Datum int4range_canonical(PG_FUNCTION_ARGS); extern Datum int8range_canonical(PG_FUNCTION_ARGS); extern Datum daterange_canonical(PG_FUNCTION_ARGS); /* Subtype Difference functions */ extern Datum int4range_subdiff(PG_FUNCTION_ARGS); extern Datum int8range_subdiff(PG_FUNCTION_ARGS); extern Datum numrange_subdiff(PG_FUNCTION_ARGS); extern Datum daterange_subdiff(PG_FUNCTION_ARGS); extern Datum tsrange_subdiff(PG_FUNCTION_ARGS); extern Datum tstzrange_subdiff(PG_FUNCTION_ARGS); /* assorted support functions */ extern TypeCacheEntry *range_get_typcache(FunctionCallInfo fcinfo, Oid rngtypid); extern RangeType *range_serialize(TypeCacheEntry *typcache, RangeBound *lower, RangeBound *upper, bool empty); extern void range_deserialize(TypeCacheEntry *typcache, RangeType *range, RangeBound *lower, RangeBound *upper, bool *empty); extern char range_get_flags(RangeType *range); extern void range_set_contain_empty(RangeType *range); extern RangeType *make_range(TypeCacheEntry *typcache, RangeBound *lower, RangeBound *upper, bool empty); extern int range_cmp_bounds(TypeCacheEntry *typcache, RangeBound *b1, RangeBound *b2); extern int range_cmp_bound_values(TypeCacheEntry *typcache, RangeBound *b1, RangeBound *b2); extern RangeType *make_empty_range(TypeCacheEntry *typcache); /* GiST support (in rangetypes_gist.c) */ extern Datum range_gist_consistent(PG_FUNCTION_ARGS); extern Datum range_gist_compress(PG_FUNCTION_ARGS); extern Datum range_gist_decompress(PG_FUNCTION_ARGS); extern Datum range_gist_union(PG_FUNCTION_ARGS); extern Datum range_gist_penalty(PG_FUNCTION_ARGS); extern Datum range_gist_picksplit(PG_FUNCTION_ARGS); extern Datum range_gist_same(PG_FUNCTION_ARGS); #endif /* RANGETYPES_H */ �������������������������������������������������������������������������������������������������������pgsql/server/utils/tqual.h��������������������������������������������������������������������������0000644�����������������00000006773�14763166026�0011667 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * tqual.h * POSTGRES "time qualification" definitions, ie, tuple visibility rules. * * Should be moved/renamed... - vadim 07/28/98 * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/tqual.h * *------------------------------------------------------------------------- */ #ifndef TQUAL_H #define TQUAL_H #include "utils/snapshot.h" /* Static variables representing various special snapshot semantics */ extern PGDLLIMPORT SnapshotData SnapshotNowData; extern PGDLLIMPORT SnapshotData SnapshotSelfData; extern PGDLLIMPORT SnapshotData SnapshotAnyData; extern PGDLLIMPORT SnapshotData SnapshotToastData; #define SnapshotNow (&SnapshotNowData) #define SnapshotSelf (&SnapshotSelfData) #define SnapshotAny (&SnapshotAnyData) #define SnapshotToast (&SnapshotToastData) /* * We don't provide a static SnapshotDirty variable because it would be * non-reentrant. Instead, users of that snapshot type should declare a * local variable of type SnapshotData, and initialize it with this macro. */ #define InitDirtySnapshot(snapshotdata) \ ((snapshotdata).satisfies = HeapTupleSatisfiesDirty) /* This macro encodes the knowledge of which snapshots are MVCC-safe */ #define IsMVCCSnapshot(snapshot) \ ((snapshot)->satisfies == HeapTupleSatisfiesMVCC) /* * HeapTupleSatisfiesVisibility * True iff heap tuple satisfies a time qual. * * Notes: * Assumes heap tuple is valid. * Beware of multiple evaluations of snapshot argument. * Hint bits in the HeapTuple's t_infomask may be updated as a side effect; * if so, the indicated buffer is marked dirty. */ #define HeapTupleSatisfiesVisibility(tuple, snapshot, buffer) \ ((*(snapshot)->satisfies) ((tuple)->t_data, snapshot, buffer)) /* Result codes for HeapTupleSatisfiesVacuum */ typedef enum { HEAPTUPLE_DEAD, /* tuple is dead and deletable */ HEAPTUPLE_LIVE, /* tuple is live (committed, no deleter) */ HEAPTUPLE_RECENTLY_DEAD, /* tuple is dead, but not deletable yet */ HEAPTUPLE_INSERT_IN_PROGRESS, /* inserting xact is still in progress */ HEAPTUPLE_DELETE_IN_PROGRESS /* deleting xact is still in progress */ } HTSV_Result; /* These are the "satisfies" test routines for the various snapshot types */ extern bool HeapTupleSatisfiesMVCC(HeapTupleHeader tuple, Snapshot snapshot, Buffer buffer); extern bool HeapTupleSatisfiesNow(HeapTupleHeader tuple, Snapshot snapshot, Buffer buffer); extern bool HeapTupleSatisfiesSelf(HeapTupleHeader tuple, Snapshot snapshot, Buffer buffer); extern bool HeapTupleSatisfiesAny(HeapTupleHeader tuple, Snapshot snapshot, Buffer buffer); extern bool HeapTupleSatisfiesToast(HeapTupleHeader tuple, Snapshot snapshot, Buffer buffer); extern bool HeapTupleSatisfiesDirty(HeapTupleHeader tuple, Snapshot snapshot, Buffer buffer); /* Special "satisfies" routines with different APIs */ extern HTSU_Result HeapTupleSatisfiesUpdate(HeapTupleHeader tuple, CommandId curcid, Buffer buffer); extern HTSV_Result HeapTupleSatisfiesVacuum(HeapTupleHeader tuple, TransactionId OldestXmin, Buffer buffer); extern bool HeapTupleIsSurelyDead(HeapTupleHeader tuple, TransactionId OldestXmin); extern bool XidInMVCCSnapshot(TransactionId xid, Snapshot snapshot); extern void HeapTupleSetHintBits(HeapTupleHeader tuple, Buffer buffer, uint16 infomask, TransactionId xid); #endif /* TQUAL_H */ �����pgsql/server/utils/pg_crc_tables.h������������������������������������������������������������������0000644�����������������00000047353�14763166026�0013327 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_crc_tables.h * Polynomial lookup tables for CRC macros * * We make these tables available as a .h file so that programs not linked * with libpgport can still use the macros in pg_crc.h. They just need * to #include this header as well. * * See Ross Williams' excellent introduction * A PAINLESS GUIDE TO CRC ERROR DETECTION ALGORITHMS, available from * http://www.ross.net/crc/download/crc_v3.txt or several other net sites. * * We use a normal (not "reflected", in Williams' terms) CRC, using initial * all-ones register contents and a final bit inversion. * * The 64-bit variant is not used as of PostgreSQL 8.1, but we retain the * code for possible future use. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/pg_crc_tables.h * *------------------------------------------------------------------------- */ #ifndef PG_CRC_TABLES_H #define PG_CRC_TABLES_H /* * This table is based on the polynomial * x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. * (This is the same polynomial used in Ethernet checksums, for instance.) */ const uint32 pg_crc32_table[256] = { 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D }; #ifdef PROVIDE_64BIT_CRC /* * This table is based on the polynomial * * x^64 + x^62 + x^57 + x^55 + x^54 + x^53 + x^52 + x^47 + x^46 + x^45 + * x^40 + x^39 + x^38 + x^37 + x^35 + x^33 + x^32 + x^31 + x^29 + x^27 + * x^24 + x^23 + x^22 + x^21 + x^19 + x^17 + x^13 + x^12 + x^10 + x^9 + * x^7 + x^4 + x + 1 * * which is borrowed from the DLT1 spec * (ECMA-182, available from http://www.ecma.ch/ecma1/STAND/ECMA-182.HTM) */ #if SIZEOF_VOID_P < 8 /* this test must match the one in pg_crc.h */ const uint32 pg_crc64_table0[256] = { 0x00000000, 0xA9EA3693, 0x53D46D26, 0xFA3E5BB5, 0x0E42ECDF, 0xA7A8DA4C, 0x5D9681F9, 0xF47CB76A, 0x1C85D9BE, 0xB56FEF2D, 0x4F51B498, 0xE6BB820B, 0x12C73561, 0xBB2D03F2, 0x41135847, 0xE8F96ED4, 0x90E185EF, 0x390BB37C, 0xC335E8C9, 0x6ADFDE5A, 0x9EA36930, 0x37495FA3, 0xCD770416, 0x649D3285, 0x8C645C51, 0x258E6AC2, 0xDFB03177, 0x765A07E4, 0x8226B08E, 0x2BCC861D, 0xD1F2DDA8, 0x7818EB3B, 0x21C30BDE, 0x88293D4D, 0x721766F8, 0xDBFD506B, 0x2F81E701, 0x866BD192, 0x7C558A27, 0xD5BFBCB4, 0x3D46D260, 0x94ACE4F3, 0x6E92BF46, 0xC77889D5, 0x33043EBF, 0x9AEE082C, 0x60D05399, 0xC93A650A, 0xB1228E31, 0x18C8B8A2, 0xE2F6E317, 0x4B1CD584, 0xBF6062EE, 0x168A547D, 0xECB40FC8, 0x455E395B, 0xADA7578F, 0x044D611C, 0xFE733AA9, 0x57990C3A, 0xA3E5BB50, 0x0A0F8DC3, 0xF031D676, 0x59DBE0E5, 0xEA6C212F, 0x438617BC, 0xB9B84C09, 0x10527A9A, 0xE42ECDF0, 0x4DC4FB63, 0xB7FAA0D6, 0x1E109645, 0xF6E9F891, 0x5F03CE02, 0xA53D95B7, 0x0CD7A324, 0xF8AB144E, 0x514122DD, 0xAB7F7968, 0x02954FFB, 0x7A8DA4C0, 0xD3679253, 0x2959C9E6, 0x80B3FF75, 0x74CF481F, 0xDD257E8C, 0x271B2539, 0x8EF113AA, 0x66087D7E, 0xCFE24BED, 0x35DC1058, 0x9C3626CB, 0x684A91A1, 0xC1A0A732, 0x3B9EFC87, 0x9274CA14, 0xCBAF2AF1, 0x62451C62, 0x987B47D7, 0x31917144, 0xC5EDC62E, 0x6C07F0BD, 0x9639AB08, 0x3FD39D9B, 0xD72AF34F, 0x7EC0C5DC, 0x84FE9E69, 0x2D14A8FA, 0xD9681F90, 0x70822903, 0x8ABC72B6, 0x23564425, 0x5B4EAF1E, 0xF2A4998D, 0x089AC238, 0xA170F4AB, 0x550C43C1, 0xFCE67552, 0x06D82EE7, 0xAF321874, 0x47CB76A0, 0xEE214033, 0x141F1B86, 0xBDF52D15, 0x49899A7F, 0xE063ACEC, 0x1A5DF759, 0xB3B7C1CA, 0x7D3274CD, 0xD4D8425E, 0x2EE619EB, 0x870C2F78, 0x73709812, 0xDA9AAE81, 0x20A4F534, 0x894EC3A7, 0x61B7AD73, 0xC85D9BE0, 0x3263C055, 0x9B89F6C6, 0x6FF541AC, 0xC61F773F, 0x3C212C8A, 0x95CB1A19, 0xEDD3F122, 0x4439C7B1, 0xBE079C04, 0x17EDAA97, 0xE3911DFD, 0x4A7B2B6E, 0xB04570DB, 0x19AF4648, 0xF156289C, 0x58BC1E0F, 0xA28245BA, 0x0B687329, 0xFF14C443, 0x56FEF2D0, 0xACC0A965, 0x052A9FF6, 0x5CF17F13, 0xF51B4980, 0x0F251235, 0xA6CF24A6, 0x52B393CC, 0xFB59A55F, 0x0167FEEA, 0xA88DC879, 0x4074A6AD, 0xE99E903E, 0x13A0CB8B, 0xBA4AFD18, 0x4E364A72, 0xE7DC7CE1, 0x1DE22754, 0xB40811C7, 0xCC10FAFC, 0x65FACC6F, 0x9FC497DA, 0x362EA149, 0xC2521623, 0x6BB820B0, 0x91867B05, 0x386C4D96, 0xD0952342, 0x797F15D1, 0x83414E64, 0x2AAB78F7, 0xDED7CF9D, 0x773DF90E, 0x8D03A2BB, 0x24E99428, 0x975E55E2, 0x3EB46371, 0xC48A38C4, 0x6D600E57, 0x991CB93D, 0x30F68FAE, 0xCAC8D41B, 0x6322E288, 0x8BDB8C5C, 0x2231BACF, 0xD80FE17A, 0x71E5D7E9, 0x85996083, 0x2C735610, 0xD64D0DA5, 0x7FA73B36, 0x07BFD00D, 0xAE55E69E, 0x546BBD2B, 0xFD818BB8, 0x09FD3CD2, 0xA0170A41, 0x5A2951F4, 0xF3C36767, 0x1B3A09B3, 0xB2D03F20, 0x48EE6495, 0xE1045206, 0x1578E56C, 0xBC92D3FF, 0x46AC884A, 0xEF46BED9, 0xB69D5E3C, 0x1F7768AF, 0xE549331A, 0x4CA30589, 0xB8DFB2E3, 0x11358470, 0xEB0BDFC5, 0x42E1E956, 0xAA188782, 0x03F2B111, 0xF9CCEAA4, 0x5026DC37, 0xA45A6B5D, 0x0DB05DCE, 0xF78E067B, 0x5E6430E8, 0x267CDBD3, 0x8F96ED40, 0x75A8B6F5, 0xDC428066, 0x283E370C, 0x81D4019F, 0x7BEA5A2A, 0xD2006CB9, 0x3AF9026D, 0x931334FE, 0x692D6F4B, 0xC0C759D8, 0x34BBEEB2, 0x9D51D821, 0x676F8394, 0xCE85B507 }; const uint32 pg_crc64_table1[256] = { 0x00000000, 0x42F0E1EB, 0x85E1C3D7, 0xC711223C, 0x49336645, 0x0BC387AE, 0xCCD2A592, 0x8E224479, 0x9266CC8A, 0xD0962D61, 0x17870F5D, 0x5577EEB6, 0xDB55AACF, 0x99A54B24, 0x5EB46918, 0x1C4488F3, 0x663D78FF, 0x24CD9914, 0xE3DCBB28, 0xA12C5AC3, 0x2F0E1EBA, 0x6DFEFF51, 0xAAEFDD6D, 0xE81F3C86, 0xF45BB475, 0xB6AB559E, 0x71BA77A2, 0x334A9649, 0xBD68D230, 0xFF9833DB, 0x388911E7, 0x7A79F00C, 0xCC7AF1FF, 0x8E8A1014, 0x499B3228, 0x0B6BD3C3, 0x854997BA, 0xC7B97651, 0x00A8546D, 0x4258B586, 0x5E1C3D75, 0x1CECDC9E, 0xDBFDFEA2, 0x990D1F49, 0x172F5B30, 0x55DFBADB, 0x92CE98E7, 0xD03E790C, 0xAA478900, 0xE8B768EB, 0x2FA64AD7, 0x6D56AB3C, 0xE374EF45, 0xA1840EAE, 0x66952C92, 0x2465CD79, 0x3821458A, 0x7AD1A461, 0xBDC0865D, 0xFF3067B6, 0x711223CF, 0x33E2C224, 0xF4F3E018, 0xB60301F3, 0xDA050215, 0x98F5E3FE, 0x5FE4C1C2, 0x1D142029, 0x93366450, 0xD1C685BB, 0x16D7A787, 0x5427466C, 0x4863CE9F, 0x0A932F74, 0xCD820D48, 0x8F72ECA3, 0x0150A8DA, 0x43A04931, 0x84B16B0D, 0xC6418AE6, 0xBC387AEA, 0xFEC89B01, 0x39D9B93D, 0x7B2958D6, 0xF50B1CAF, 0xB7FBFD44, 0x70EADF78, 0x321A3E93, 0x2E5EB660, 0x6CAE578B, 0xABBF75B7, 0xE94F945C, 0x676DD025, 0x259D31CE, 0xE28C13F2, 0xA07CF219, 0x167FF3EA, 0x548F1201, 0x939E303D, 0xD16ED1D6, 0x5F4C95AF, 0x1DBC7444, 0xDAAD5678, 0x985DB793, 0x84193F60, 0xC6E9DE8B, 0x01F8FCB7, 0x43081D5C, 0xCD2A5925, 0x8FDAB8CE, 0x48CB9AF2, 0x0A3B7B19, 0x70428B15, 0x32B26AFE, 0xF5A348C2, 0xB753A929, 0x3971ED50, 0x7B810CBB, 0xBC902E87, 0xFE60CF6C, 0xE224479F, 0xA0D4A674, 0x67C58448, 0x253565A3, 0xAB1721DA, 0xE9E7C031, 0x2EF6E20D, 0x6C0603E6, 0xF6FAE5C0, 0xB40A042B, 0x731B2617, 0x31EBC7FC, 0xBFC98385, 0xFD39626E, 0x3A284052, 0x78D8A1B9, 0x649C294A, 0x266CC8A1, 0xE17DEA9D, 0xA38D0B76, 0x2DAF4F0F, 0x6F5FAEE4, 0xA84E8CD8, 0xEABE6D33, 0x90C79D3F, 0xD2377CD4, 0x15265EE8, 0x57D6BF03, 0xD9F4FB7A, 0x9B041A91, 0x5C1538AD, 0x1EE5D946, 0x02A151B5, 0x4051B05E, 0x87409262, 0xC5B07389, 0x4B9237F0, 0x0962D61B, 0xCE73F427, 0x8C8315CC, 0x3A80143F, 0x7870F5D4, 0xBF61D7E8, 0xFD913603, 0x73B3727A, 0x31439391, 0xF652B1AD, 0xB4A25046, 0xA8E6D8B5, 0xEA16395E, 0x2D071B62, 0x6FF7FA89, 0xE1D5BEF0, 0xA3255F1B, 0x64347D27, 0x26C49CCC, 0x5CBD6CC0, 0x1E4D8D2B, 0xD95CAF17, 0x9BAC4EFC, 0x158E0A85, 0x577EEB6E, 0x906FC952, 0xD29F28B9, 0xCEDBA04A, 0x8C2B41A1, 0x4B3A639D, 0x09CA8276, 0x87E8C60F, 0xC51827E4, 0x020905D8, 0x40F9E433, 0x2CFFE7D5, 0x6E0F063E, 0xA91E2402, 0xEBEEC5E9, 0x65CC8190, 0x273C607B, 0xE02D4247, 0xA2DDA3AC, 0xBE992B5F, 0xFC69CAB4, 0x3B78E888, 0x79880963, 0xF7AA4D1A, 0xB55AACF1, 0x724B8ECD, 0x30BB6F26, 0x4AC29F2A, 0x08327EC1, 0xCF235CFD, 0x8DD3BD16, 0x03F1F96F, 0x41011884, 0x86103AB8, 0xC4E0DB53, 0xD8A453A0, 0x9A54B24B, 0x5D459077, 0x1FB5719C, 0x919735E5, 0xD367D40E, 0x1476F632, 0x568617D9, 0xE085162A, 0xA275F7C1, 0x6564D5FD, 0x27943416, 0xA9B6706F, 0xEB469184, 0x2C57B3B8, 0x6EA75253, 0x72E3DAA0, 0x30133B4B, 0xF7021977, 0xB5F2F89C, 0x3BD0BCE5, 0x79205D0E, 0xBE317F32, 0xFCC19ED9, 0x86B86ED5, 0xC4488F3E, 0x0359AD02, 0x41A94CE9, 0xCF8B0890, 0x8D7BE97B, 0x4A6ACB47, 0x089A2AAC, 0x14DEA25F, 0x562E43B4, 0x913F6188, 0xD3CF8063, 0x5DEDC41A, 0x1F1D25F1, 0xD80C07CD, 0x9AFCE626 }; #else /* use int64 implementation */ const uint64 pg_crc64_table[256] = { UINT64CONST(0x0000000000000000), UINT64CONST(0x42F0E1EBA9EA3693), UINT64CONST(0x85E1C3D753D46D26), UINT64CONST(0xC711223CFA3E5BB5), UINT64CONST(0x493366450E42ECDF), UINT64CONST(0x0BC387AEA7A8DA4C), UINT64CONST(0xCCD2A5925D9681F9), UINT64CONST(0x8E224479F47CB76A), UINT64CONST(0x9266CC8A1C85D9BE), UINT64CONST(0xD0962D61B56FEF2D), UINT64CONST(0x17870F5D4F51B498), UINT64CONST(0x5577EEB6E6BB820B), UINT64CONST(0xDB55AACF12C73561), UINT64CONST(0x99A54B24BB2D03F2), UINT64CONST(0x5EB4691841135847), UINT64CONST(0x1C4488F3E8F96ED4), UINT64CONST(0x663D78FF90E185EF), UINT64CONST(0x24CD9914390BB37C), UINT64CONST(0xE3DCBB28C335E8C9), UINT64CONST(0xA12C5AC36ADFDE5A), UINT64CONST(0x2F0E1EBA9EA36930), UINT64CONST(0x6DFEFF5137495FA3), UINT64CONST(0xAAEFDD6DCD770416), UINT64CONST(0xE81F3C86649D3285), UINT64CONST(0xF45BB4758C645C51), UINT64CONST(0xB6AB559E258E6AC2), UINT64CONST(0x71BA77A2DFB03177), UINT64CONST(0x334A9649765A07E4), UINT64CONST(0xBD68D2308226B08E), UINT64CONST(0xFF9833DB2BCC861D), UINT64CONST(0x388911E7D1F2DDA8), UINT64CONST(0x7A79F00C7818EB3B), UINT64CONST(0xCC7AF1FF21C30BDE), UINT64CONST(0x8E8A101488293D4D), UINT64CONST(0x499B3228721766F8), UINT64CONST(0x0B6BD3C3DBFD506B), UINT64CONST(0x854997BA2F81E701), UINT64CONST(0xC7B97651866BD192), UINT64CONST(0x00A8546D7C558A27), UINT64CONST(0x4258B586D5BFBCB4), UINT64CONST(0x5E1C3D753D46D260), UINT64CONST(0x1CECDC9E94ACE4F3), UINT64CONST(0xDBFDFEA26E92BF46), UINT64CONST(0x990D1F49C77889D5), UINT64CONST(0x172F5B3033043EBF), UINT64CONST(0x55DFBADB9AEE082C), UINT64CONST(0x92CE98E760D05399), UINT64CONST(0xD03E790CC93A650A), UINT64CONST(0xAA478900B1228E31), UINT64CONST(0xE8B768EB18C8B8A2), UINT64CONST(0x2FA64AD7E2F6E317), UINT64CONST(0x6D56AB3C4B1CD584), UINT64CONST(0xE374EF45BF6062EE), UINT64CONST(0xA1840EAE168A547D), UINT64CONST(0x66952C92ECB40FC8), UINT64CONST(0x2465CD79455E395B), UINT64CONST(0x3821458AADA7578F), UINT64CONST(0x7AD1A461044D611C), UINT64CONST(0xBDC0865DFE733AA9), UINT64CONST(0xFF3067B657990C3A), UINT64CONST(0x711223CFA3E5BB50), UINT64CONST(0x33E2C2240A0F8DC3), UINT64CONST(0xF4F3E018F031D676), UINT64CONST(0xB60301F359DBE0E5), UINT64CONST(0xDA050215EA6C212F), UINT64CONST(0x98F5E3FE438617BC), UINT64CONST(0x5FE4C1C2B9B84C09), UINT64CONST(0x1D14202910527A9A), UINT64CONST(0x93366450E42ECDF0), UINT64CONST(0xD1C685BB4DC4FB63), UINT64CONST(0x16D7A787B7FAA0D6), UINT64CONST(0x5427466C1E109645), UINT64CONST(0x4863CE9FF6E9F891), UINT64CONST(0x0A932F745F03CE02), UINT64CONST(0xCD820D48A53D95B7), UINT64CONST(0x8F72ECA30CD7A324), UINT64CONST(0x0150A8DAF8AB144E), UINT64CONST(0x43A04931514122DD), UINT64CONST(0x84B16B0DAB7F7968), UINT64CONST(0xC6418AE602954FFB), UINT64CONST(0xBC387AEA7A8DA4C0), UINT64CONST(0xFEC89B01D3679253), UINT64CONST(0x39D9B93D2959C9E6), UINT64CONST(0x7B2958D680B3FF75), UINT64CONST(0xF50B1CAF74CF481F), UINT64CONST(0xB7FBFD44DD257E8C), UINT64CONST(0x70EADF78271B2539), UINT64CONST(0x321A3E938EF113AA), UINT64CONST(0x2E5EB66066087D7E), UINT64CONST(0x6CAE578BCFE24BED), UINT64CONST(0xABBF75B735DC1058), UINT64CONST(0xE94F945C9C3626CB), UINT64CONST(0x676DD025684A91A1), UINT64CONST(0x259D31CEC1A0A732), UINT64CONST(0xE28C13F23B9EFC87), UINT64CONST(0xA07CF2199274CA14), UINT64CONST(0x167FF3EACBAF2AF1), UINT64CONST(0x548F120162451C62), UINT64CONST(0x939E303D987B47D7), UINT64CONST(0xD16ED1D631917144), UINT64CONST(0x5F4C95AFC5EDC62E), UINT64CONST(0x1DBC74446C07F0BD), UINT64CONST(0xDAAD56789639AB08), UINT64CONST(0x985DB7933FD39D9B), UINT64CONST(0x84193F60D72AF34F), UINT64CONST(0xC6E9DE8B7EC0C5DC), UINT64CONST(0x01F8FCB784FE9E69), UINT64CONST(0x43081D5C2D14A8FA), UINT64CONST(0xCD2A5925D9681F90), UINT64CONST(0x8FDAB8CE70822903), UINT64CONST(0x48CB9AF28ABC72B6), UINT64CONST(0x0A3B7B1923564425), UINT64CONST(0x70428B155B4EAF1E), UINT64CONST(0x32B26AFEF2A4998D), UINT64CONST(0xF5A348C2089AC238), UINT64CONST(0xB753A929A170F4AB), UINT64CONST(0x3971ED50550C43C1), UINT64CONST(0x7B810CBBFCE67552), UINT64CONST(0xBC902E8706D82EE7), UINT64CONST(0xFE60CF6CAF321874), UINT64CONST(0xE224479F47CB76A0), UINT64CONST(0xA0D4A674EE214033), UINT64CONST(0x67C58448141F1B86), UINT64CONST(0x253565A3BDF52D15), UINT64CONST(0xAB1721DA49899A7F), UINT64CONST(0xE9E7C031E063ACEC), UINT64CONST(0x2EF6E20D1A5DF759), UINT64CONST(0x6C0603E6B3B7C1CA), UINT64CONST(0xF6FAE5C07D3274CD), UINT64CONST(0xB40A042BD4D8425E), UINT64CONST(0x731B26172EE619EB), UINT64CONST(0x31EBC7FC870C2F78), UINT64CONST(0xBFC9838573709812), UINT64CONST(0xFD39626EDA9AAE81), UINT64CONST(0x3A28405220A4F534), UINT64CONST(0x78D8A1B9894EC3A7), UINT64CONST(0x649C294A61B7AD73), UINT64CONST(0x266CC8A1C85D9BE0), UINT64CONST(0xE17DEA9D3263C055), UINT64CONST(0xA38D0B769B89F6C6), UINT64CONST(0x2DAF4F0F6FF541AC), UINT64CONST(0x6F5FAEE4C61F773F), UINT64CONST(0xA84E8CD83C212C8A), UINT64CONST(0xEABE6D3395CB1A19), UINT64CONST(0x90C79D3FEDD3F122), UINT64CONST(0xD2377CD44439C7B1), UINT64CONST(0x15265EE8BE079C04), UINT64CONST(0x57D6BF0317EDAA97), UINT64CONST(0xD9F4FB7AE3911DFD), UINT64CONST(0x9B041A914A7B2B6E), UINT64CONST(0x5C1538ADB04570DB), UINT64CONST(0x1EE5D94619AF4648), UINT64CONST(0x02A151B5F156289C), UINT64CONST(0x4051B05E58BC1E0F), UINT64CONST(0x87409262A28245BA), UINT64CONST(0xC5B073890B687329), UINT64CONST(0x4B9237F0FF14C443), UINT64CONST(0x0962D61B56FEF2D0), UINT64CONST(0xCE73F427ACC0A965), UINT64CONST(0x8C8315CC052A9FF6), UINT64CONST(0x3A80143F5CF17F13), UINT64CONST(0x7870F5D4F51B4980), UINT64CONST(0xBF61D7E80F251235), UINT64CONST(0xFD913603A6CF24A6), UINT64CONST(0x73B3727A52B393CC), UINT64CONST(0x31439391FB59A55F), UINT64CONST(0xF652B1AD0167FEEA), UINT64CONST(0xB4A25046A88DC879), UINT64CONST(0xA8E6D8B54074A6AD), UINT64CONST(0xEA16395EE99E903E), UINT64CONST(0x2D071B6213A0CB8B), UINT64CONST(0x6FF7FA89BA4AFD18), UINT64CONST(0xE1D5BEF04E364A72), UINT64CONST(0xA3255F1BE7DC7CE1), UINT64CONST(0x64347D271DE22754), UINT64CONST(0x26C49CCCB40811C7), UINT64CONST(0x5CBD6CC0CC10FAFC), UINT64CONST(0x1E4D8D2B65FACC6F), UINT64CONST(0xD95CAF179FC497DA), UINT64CONST(0x9BAC4EFC362EA149), UINT64CONST(0x158E0A85C2521623), UINT64CONST(0x577EEB6E6BB820B0), UINT64CONST(0x906FC95291867B05), UINT64CONST(0xD29F28B9386C4D96), UINT64CONST(0xCEDBA04AD0952342), UINT64CONST(0x8C2B41A1797F15D1), UINT64CONST(0x4B3A639D83414E64), UINT64CONST(0x09CA82762AAB78F7), UINT64CONST(0x87E8C60FDED7CF9D), UINT64CONST(0xC51827E4773DF90E), UINT64CONST(0x020905D88D03A2BB), UINT64CONST(0x40F9E43324E99428), UINT64CONST(0x2CFFE7D5975E55E2), UINT64CONST(0x6E0F063E3EB46371), UINT64CONST(0xA91E2402C48A38C4), UINT64CONST(0xEBEEC5E96D600E57), UINT64CONST(0x65CC8190991CB93D), UINT64CONST(0x273C607B30F68FAE), UINT64CONST(0xE02D4247CAC8D41B), UINT64CONST(0xA2DDA3AC6322E288), UINT64CONST(0xBE992B5F8BDB8C5C), UINT64CONST(0xFC69CAB42231BACF), UINT64CONST(0x3B78E888D80FE17A), UINT64CONST(0x7988096371E5D7E9), UINT64CONST(0xF7AA4D1A85996083), UINT64CONST(0xB55AACF12C735610), UINT64CONST(0x724B8ECDD64D0DA5), UINT64CONST(0x30BB6F267FA73B36), UINT64CONST(0x4AC29F2A07BFD00D), UINT64CONST(0x08327EC1AE55E69E), UINT64CONST(0xCF235CFD546BBD2B), UINT64CONST(0x8DD3BD16FD818BB8), UINT64CONST(0x03F1F96F09FD3CD2), UINT64CONST(0x41011884A0170A41), UINT64CONST(0x86103AB85A2951F4), UINT64CONST(0xC4E0DB53F3C36767), UINT64CONST(0xD8A453A01B3A09B3), UINT64CONST(0x9A54B24BB2D03F20), UINT64CONST(0x5D45907748EE6495), UINT64CONST(0x1FB5719CE1045206), UINT64CONST(0x919735E51578E56C), UINT64CONST(0xD367D40EBC92D3FF), UINT64CONST(0x1476F63246AC884A), UINT64CONST(0x568617D9EF46BED9), UINT64CONST(0xE085162AB69D5E3C), UINT64CONST(0xA275F7C11F7768AF), UINT64CONST(0x6564D5FDE549331A), UINT64CONST(0x279434164CA30589), UINT64CONST(0xA9B6706FB8DFB2E3), UINT64CONST(0xEB46918411358470), UINT64CONST(0x2C57B3B8EB0BDFC5), UINT64CONST(0x6EA7525342E1E956), UINT64CONST(0x72E3DAA0AA188782), UINT64CONST(0x30133B4B03F2B111), UINT64CONST(0xF7021977F9CCEAA4), UINT64CONST(0xB5F2F89C5026DC37), UINT64CONST(0x3BD0BCE5A45A6B5D), UINT64CONST(0x79205D0E0DB05DCE), UINT64CONST(0xBE317F32F78E067B), UINT64CONST(0xFCC19ED95E6430E8), UINT64CONST(0x86B86ED5267CDBD3), UINT64CONST(0xC4488F3E8F96ED40), UINT64CONST(0x0359AD0275A8B6F5), UINT64CONST(0x41A94CE9DC428066), UINT64CONST(0xCF8B0890283E370C), UINT64CONST(0x8D7BE97B81D4019F), UINT64CONST(0x4A6ACB477BEA5A2A), UINT64CONST(0x089A2AACD2006CB9), UINT64CONST(0x14DEA25F3AF9026D), UINT64CONST(0x562E43B4931334FE), UINT64CONST(0x913F6188692D6F4B), UINT64CONST(0xD3CF8063C0C759D8), UINT64CONST(0x5DEDC41A34BBEEB2), UINT64CONST(0x1F1D25F19D51D821), UINT64CONST(0xD80C07CD676F8394), UINT64CONST(0x9AFCE626CE85B507) }; #endif /* SIZEOF_VOID_P < 8 */ #endif /* PROVIDE_64BIT_CRC */ #endif /* PG_CRC_TABLES_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/reltrigger.h���������������������������������������������������������������������0000644�����������������00000003717�14763166026�0012702 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * reltrigger.h * POSTGRES relation trigger definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/reltrigger.h * *------------------------------------------------------------------------- */ #ifndef RELTRIGGER_H #define RELTRIGGER_H /* * These struct really belongs to trigger.h, but we put it separately so that * it can be cleanly included in rel.h and other places. */ typedef struct Trigger { Oid tgoid; /* OID of trigger (pg_trigger row) */ /* Remaining fields are copied from pg_trigger, see pg_trigger.h */ char *tgname; Oid tgfoid; int16 tgtype; char tgenabled; bool tgisinternal; Oid tgconstrrelid; Oid tgconstrindid; Oid tgconstraint; bool tgdeferrable; bool tginitdeferred; int16 tgnargs; int16 tgnattr; int16 *tgattr; char **tgargs; char *tgqual; } Trigger; typedef struct TriggerDesc { Trigger *triggers; /* array of Trigger structs */ int numtriggers; /* number of array entries */ /* * These flags indicate whether the array contains at least one of each * type of trigger. We use these to skip searching the array if not. */ bool trig_insert_before_row; bool trig_insert_after_row; bool trig_insert_instead_row; bool trig_insert_before_statement; bool trig_insert_after_statement; bool trig_update_before_row; bool trig_update_after_row; bool trig_update_instead_row; bool trig_update_before_statement; bool trig_update_after_statement; bool trig_delete_before_row; bool trig_delete_after_row; bool trig_delete_instead_row; bool trig_delete_before_statement; bool trig_delete_after_statement; /* there are no row-level truncate triggers */ bool trig_truncate_before_statement; bool trig_truncate_after_statement; } TriggerDesc; #endif /* RELTRIGGER_H */ �������������������������������������������������pgsql/server/utils/relcache.h�����������������������������������������������������������������������0000644�����������������00000006252�14763166026�0012277 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * relcache.h * Relation descriptor cache definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/relcache.h * *------------------------------------------------------------------------- */ #ifndef RELCACHE_H #define RELCACHE_H #include "access/tupdesc.h" #include "nodes/bitmapset.h" typedef struct RelationData *Relation; /* ---------------- * RelationPtr is used in the executor to support index scans * where we have to keep track of several index relations in an * array. -cim 9/10/89 * ---------------- */ typedef Relation *RelationPtr; /* * Routines to open (lookup) and close a relcache entry */ extern Relation RelationIdGetRelation(Oid relationId); extern void RelationClose(Relation relation); /* * Routines to compute/retrieve additional cached information */ extern List *RelationGetIndexList(Relation relation); extern Oid RelationGetOidIndex(Relation relation); extern List *RelationGetIndexExpressions(Relation relation); extern List *RelationGetIndexPredicate(Relation relation); extern Bitmapset *RelationGetIndexAttrBitmap(Relation relation); extern void RelationGetExclusionInfo(Relation indexRelation, Oid **operators, Oid **procs, uint16 **strategies); extern void RelationSetIndexList(Relation relation, List *indexIds, Oid oidIndex); extern void RelationInitIndexAccessInfo(Relation relation); /* * Routines for backend startup */ extern void RelationCacheInitialize(void); extern void RelationCacheInitializePhase2(void); extern void RelationCacheInitializePhase3(void); /* * Routine to create a relcache entry for an about-to-be-created relation */ extern Relation RelationBuildLocalRelation(const char *relname, Oid relnamespace, TupleDesc tupDesc, Oid relid, Oid relfilenode, Oid reltablespace, bool shared_relation, bool mapped_relation, char relpersistence); /* * Routine to manage assignment of new relfilenode to a relation */ extern void RelationSetNewRelfilenode(Relation relation, TransactionId freezeXid); /* * Routines for flushing/rebuilding relcache entries in various scenarios */ extern void RelationForgetRelation(Oid rid); extern void RelationCacheInvalidateEntry(Oid relationId); extern void RelationCacheInvalidate(void); extern void RelationCloseSmgrByOid(Oid relationId); extern void AtEOXact_RelationCache(bool isCommit); extern void AtEOSubXact_RelationCache(bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid); /* * Routines to help manage rebuilding of relcache init files */ extern bool RelationIdIsInInitFile(Oid relationId); extern void RelationCacheInitFilePreInvalidate(void); extern void RelationCacheInitFilePostInvalidate(void); extern void RelationCacheInitFileRemove(void); /* should be used only by relcache.c and catcache.c */ extern bool criticalRelcachesBuilt; /* should be used only by relcache.c and postinit.c */ extern bool criticalSharedRelcachesBuilt; #endif /* RELCACHE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/guc_tables.h���������������������������������������������������������������������0000644�����������������00000016227�14763166026�0012644 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * guc_tables.h * Declarations of tables used by GUC. * * See src/backend/utils/misc/README for design notes. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * * src/include/utils/guc_tables.h * *------------------------------------------------------------------------- */ #ifndef GUC_TABLES_H #define GUC_TABLES_H 1 #include "utils/guc.h" /* * GUC supports these types of variables: */ enum config_type { PGC_BOOL, PGC_INT, PGC_REAL, PGC_STRING, PGC_ENUM }; union config_var_val { bool boolval; int intval; double realval; char *stringval; int enumval; }; /* * The actual value of a GUC variable can include a malloc'd opaque struct * "extra", which is created by its check_hook and used by its assign_hook. */ typedef struct config_var_value { union config_var_val val; void *extra; } config_var_value; /* * Groupings to help organize all the run-time options for display */ enum config_group { UNGROUPED, FILE_LOCATIONS, CONN_AUTH, CONN_AUTH_SETTINGS, CONN_AUTH_SECURITY, RESOURCES, RESOURCES_MEM, RESOURCES_DISK, RESOURCES_KERNEL, RESOURCES_VACUUM_DELAY, RESOURCES_BGWRITER, RESOURCES_ASYNCHRONOUS, WAL, WAL_SETTINGS, WAL_CHECKPOINTS, WAL_ARCHIVING, REPLICATION, REPLICATION_SENDING, REPLICATION_MASTER, REPLICATION_STANDBY, QUERY_TUNING, QUERY_TUNING_METHOD, QUERY_TUNING_COST, QUERY_TUNING_GEQO, QUERY_TUNING_OTHER, LOGGING, LOGGING_WHERE, LOGGING_WHEN, LOGGING_WHAT, STATS, STATS_MONITORING, STATS_COLLECTOR, AUTOVACUUM, CLIENT_CONN, CLIENT_CONN_STATEMENT, CLIENT_CONN_LOCALE, CLIENT_CONN_OTHER, LOCK_MANAGEMENT, COMPAT_OPTIONS, COMPAT_OPTIONS_PREVIOUS, COMPAT_OPTIONS_CLIENT, ERROR_HANDLING_OPTIONS, PRESET_OPTIONS, CUSTOM_OPTIONS, DEVELOPER_OPTIONS }; /* * Stack entry for saving the state a variable had prior to an uncommitted * transactional change */ typedef enum { /* This is almost GucAction, but we need a fourth state for SET+LOCAL */ GUC_SAVE, /* entry caused by function SET option */ GUC_SET, /* entry caused by plain SET command */ GUC_LOCAL, /* entry caused by SET LOCAL command */ GUC_SET_LOCAL /* entry caused by SET then SET LOCAL */ } GucStackState; typedef struct guc_stack { struct guc_stack *prev; /* previous stack item, if any */ int nest_level; /* nesting depth at which we made entry */ GucStackState state; /* see enum above */ GucSource source; /* source of the prior value */ /* masked value's source must be PGC_S_SESSION, so no need to store it */ GucContext scontext; /* context that set the prior value */ GucContext masked_scontext; /* context that set the masked value */ config_var_value prior; /* previous value of variable */ config_var_value masked; /* SET value in a GUC_SET_LOCAL entry */ } GucStack; /* * Generic fields applicable to all types of variables * * The short description should be less than 80 chars in length. Some * applications may use the long description as well, and will append * it to the short description. (separated by a newline or '. ') * * Note that sourcefile/sourceline are kept here, and not pushed into stacked * values, although in principle they belong with some stacked value if the * active value is session- or transaction-local. This is to avoid bloating * stack entries. We know they are only relevant when source == PGC_S_FILE. */ struct config_generic { /* constant fields, must be set correctly in initial value: */ const char *name; /* name of variable - MUST BE FIRST */ GucContext context; /* context required to set the variable */ enum config_group group; /* to help organize variables by function */ const char *short_desc; /* short desc. of this variable's purpose */ const char *long_desc; /* long desc. of this variable's purpose */ int flags; /* flag bits, see guc.h */ /* variable fields, initialized at runtime: */ enum config_type vartype; /* type of variable (set only at startup) */ int status; /* status bits, see below */ GucSource source; /* source of the current actual value */ GucSource reset_source; /* source of the reset_value */ GucContext scontext; /* context that set the current value */ GucContext reset_scontext; /* context that set the reset value */ GucStack *stack; /* stacked prior values */ void *extra; /* "extra" pointer for current actual value */ char *sourcefile; /* file current setting is from (NULL if not * set in config file) */ int sourceline; /* line in source file */ }; /* bit values in status field */ #define GUC_IS_IN_FILE 0x0001 /* found it in config file */ /* * Caution: the GUC_IS_IN_FILE bit is transient state for ProcessConfigFile. * Do not assume that its value represents useful information elsewhere. */ /* GUC records for specific variable types */ struct config_bool { struct config_generic gen; /* constant fields, must be set correctly in initial value: */ bool *variable; bool boot_val; GucBoolCheckHook check_hook; GucBoolAssignHook assign_hook; GucShowHook show_hook; /* variable fields, initialized at runtime: */ bool reset_val; void *reset_extra; }; struct config_int { struct config_generic gen; /* constant fields, must be set correctly in initial value: */ int *variable; int boot_val; int min; int max; GucIntCheckHook check_hook; GucIntAssignHook assign_hook; GucShowHook show_hook; /* variable fields, initialized at runtime: */ int reset_val; void *reset_extra; }; struct config_real { struct config_generic gen; /* constant fields, must be set correctly in initial value: */ double *variable; double boot_val; double min; double max; GucRealCheckHook check_hook; GucRealAssignHook assign_hook; GucShowHook show_hook; /* variable fields, initialized at runtime: */ double reset_val; void *reset_extra; }; struct config_string { struct config_generic gen; /* constant fields, must be set correctly in initial value: */ char **variable; const char *boot_val; GucStringCheckHook check_hook; GucStringAssignHook assign_hook; GucShowHook show_hook; /* variable fields, initialized at runtime: */ char *reset_val; void *reset_extra; }; struct config_enum { struct config_generic gen; /* constant fields, must be set correctly in initial value: */ int *variable; int boot_val; const struct config_enum_entry *options; GucEnumCheckHook check_hook; GucEnumAssignHook assign_hook; GucShowHook show_hook; /* variable fields, initialized at runtime: */ int reset_val; void *reset_extra; }; /* constant tables corresponding to enums above and in guc.h */ extern const char *const config_group_names[]; extern const char *const config_type_names[]; extern const char *const GucContext_Names[]; extern const char *const GucSource_Names[]; /* get the current set of variables */ extern struct config_generic **get_guc_variables(void); extern void build_guc_variables(void); /* search in enum options */ extern const char *config_enum_lookup_by_value(struct config_enum * record, int val); extern bool config_enum_lookup_by_name(struct config_enum * record, const char *value, int *retval); #endif /* GUC_TABLES_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/uuid.h���������������������������������������������������������������������������0000644�����������������00000001535�14763166026�0011476 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * uuid.h * Header file for the "uuid" ADT. In C, we use the name pg_uuid_t, * to avoid conflicts with any uuid_t type that might be defined by * the system headers. * * Copyright (c) 2007-2012, PostgreSQL Global Development Group * * src/include/utils/uuid.h * *------------------------------------------------------------------------- */ #ifndef UUID_H #define UUID_H /* guid size in bytes */ #define UUID_LEN 16 /* opaque struct; defined in uuid.c */ typedef struct pg_uuid_t pg_uuid_t; /* fmgr interface macros */ #define UUIDPGetDatum(X) PointerGetDatum(X) #define PG_RETURN_UUID_P(X) return UUIDPGetDatum(X) #define DatumGetUUIDP(X) ((pg_uuid_t *) DatumGetPointer(X)) #define PG_GETARG_UUID_P(X) DatumGetUUIDP(PG_GETARG_DATUM(X)) #endif /* UUID_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/xml.h����������������������������������������������������������������������������0000644�����������������00000007622�14763166026�0011333 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * xml.h * Declarations for XML data type support. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/xml.h * *------------------------------------------------------------------------- */ #ifndef XML_H #define XML_H #include "fmgr.h" #include "nodes/execnodes.h" #include "nodes/primnodes.h" typedef struct varlena xmltype; typedef enum { XML_STANDALONE_YES, XML_STANDALONE_NO, XML_STANDALONE_NO_VALUE, XML_STANDALONE_OMITTED } XmlStandaloneType; typedef enum { XMLBINARY_BASE64, XMLBINARY_HEX } XmlBinaryType; typedef enum { PG_XML_STRICTNESS_LEGACY, /* ignore errors unless function result * indicates error condition */ PG_XML_STRICTNESS_WELLFORMED, /* ignore non-parser messages */ PG_XML_STRICTNESS_ALL /* report all notices/warnings/errors */ } PgXmlStrictness; /* struct PgXmlErrorContext is private to xml.c */ typedef struct PgXmlErrorContext PgXmlErrorContext; #define DatumGetXmlP(X) ((xmltype *) PG_DETOAST_DATUM(X)) #define XmlPGetDatum(X) PointerGetDatum(X) #define PG_GETARG_XML_P(n) DatumGetXmlP(PG_GETARG_DATUM(n)) #define PG_RETURN_XML_P(x) PG_RETURN_POINTER(x) extern Datum xml_in(PG_FUNCTION_ARGS); extern Datum xml_out(PG_FUNCTION_ARGS); extern Datum xml_recv(PG_FUNCTION_ARGS); extern Datum xml_send(PG_FUNCTION_ARGS); extern Datum xmlcomment(PG_FUNCTION_ARGS); extern Datum xmlconcat2(PG_FUNCTION_ARGS); extern Datum texttoxml(PG_FUNCTION_ARGS); extern Datum xmltotext(PG_FUNCTION_ARGS); extern Datum xmlvalidate(PG_FUNCTION_ARGS); extern Datum xpath(PG_FUNCTION_ARGS); extern Datum xpath_exists(PG_FUNCTION_ARGS); extern Datum xmlexists(PG_FUNCTION_ARGS); extern Datum xml_is_well_formed(PG_FUNCTION_ARGS); extern Datum xml_is_well_formed_document(PG_FUNCTION_ARGS); extern Datum xml_is_well_formed_content(PG_FUNCTION_ARGS); extern Datum table_to_xml(PG_FUNCTION_ARGS); extern Datum query_to_xml(PG_FUNCTION_ARGS); extern Datum cursor_to_xml(PG_FUNCTION_ARGS); extern Datum table_to_xmlschema(PG_FUNCTION_ARGS); extern Datum query_to_xmlschema(PG_FUNCTION_ARGS); extern Datum cursor_to_xmlschema(PG_FUNCTION_ARGS); extern Datum table_to_xml_and_xmlschema(PG_FUNCTION_ARGS); extern Datum query_to_xml_and_xmlschema(PG_FUNCTION_ARGS); extern Datum schema_to_xml(PG_FUNCTION_ARGS); extern Datum schema_to_xmlschema(PG_FUNCTION_ARGS); extern Datum schema_to_xml_and_xmlschema(PG_FUNCTION_ARGS); extern Datum database_to_xml(PG_FUNCTION_ARGS); extern Datum database_to_xmlschema(PG_FUNCTION_ARGS); extern Datum database_to_xml_and_xmlschema(PG_FUNCTION_ARGS); extern void pg_xml_init_library(void); extern PgXmlErrorContext *pg_xml_init(PgXmlStrictness strictness); extern void pg_xml_done(PgXmlErrorContext *errcxt, bool isError); extern bool pg_xml_error_occurred(PgXmlErrorContext *errcxt); extern void xml_ereport(PgXmlErrorContext *errcxt, int level, int sqlcode, const char *msg); extern xmltype *xmlconcat(List *args); extern xmltype *xmlelement(XmlExprState *xmlExpr, ExprContext *econtext); extern xmltype *xmlparse(text *data, XmlOptionType xmloption, bool preserve_whitespace); extern xmltype *xmlpi(char *target, text *arg, bool arg_is_null, bool *result_is_null); extern xmltype *xmlroot(xmltype *data, text *version, int standalone); extern bool xml_is_document(xmltype *arg); extern text *xmltotext_with_xmloption(xmltype *data, XmlOptionType xmloption_arg); extern char *escape_xml(const char *str); extern char *map_sql_identifier_to_xml_name(char *ident, bool fully_escaped, bool escape_period); extern char *map_xml_name_to_sql_identifier(char *name); extern char *map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings); extern int xmlbinary; /* XmlBinaryType, but int for guc enum */ extern int xmloption; /* XmlOptionType, but int for guc enum */ #endif /* XML_H */ ��������������������������������������������������������������������������������������������������������������pgsql/server/utils/guc.h����������������������������������������������������������������������������0000644�����������������00000032301�14763166026�0011301 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*-------------------------------------------------------------------- * guc.h * * External declarations pertaining to backend/utils/misc/guc.c and * backend/utils/misc/guc-file.l * * Copyright (c) 2000-2012, PostgreSQL Global Development Group * Written by Peter Eisentraut <peter_e@gmx.net>. * * src/include/utils/guc.h *-------------------------------------------------------------------- */ #ifndef GUC_H #define GUC_H #include "nodes/parsenodes.h" #include "tcop/dest.h" #include "utils/array.h" /* * Certain options can only be set at certain times. The rules are * like this: * * INTERNAL options cannot be set by the user at all, but only through * internal processes ("server_version" is an example). These are GUC * variables only so they can be shown by SHOW, etc. * * POSTMASTER options can only be set when the postmaster starts, * either from the configuration file or the command line. * * SIGHUP options can only be set at postmaster startup or by changing * the configuration file and sending the HUP signal to the postmaster * or a backend process. (Notice that the signal receipt will not be * evaluated immediately. The postmaster and the backend check it at a * certain point in their main loop. It's safer to wait than to read a * file asynchronously.) * * BACKEND options can only be set at postmaster startup, from the * configuration file, or by client request in the connection startup * packet (e.g., from libpq's PGOPTIONS variable). Furthermore, an * already-started backend will ignore changes to such an option in the * configuration file. The idea is that these options are fixed for a * given backend once it's started, but they can vary across backends. * * SUSET options can be set at postmaster startup, with the SIGHUP * mechanism, or from SQL if you're a superuser. * * USERSET options can be set by anyone any time. */ typedef enum { PGC_INTERNAL, PGC_POSTMASTER, PGC_SIGHUP, PGC_BACKEND, PGC_SUSET, PGC_USERSET } GucContext; /* * The following type records the source of the current setting. A * new setting can only take effect if the previous setting had the * same or lower level. (E.g, changing the config file doesn't * override the postmaster command line.) Tracking the source allows us * to process sources in any convenient order without affecting results. * Sources <= PGC_S_OVERRIDE will set the default used by RESET, as well * as the current value. Note that source == PGC_S_OVERRIDE should be * used when setting a PGC_INTERNAL option. * * PGC_S_INTERACTIVE isn't actually a source value, but is the * dividing line between "interactive" and "non-interactive" sources for * error reporting purposes. * * PGC_S_TEST is used when testing values to be stored as per-database or * per-user defaults ("doit" will always be false, so this never gets stored * as the actual source of any value). This is an interactive case, but * it needs its own source value because some assign hooks need to make * different validity checks in this case. * * NB: see GucSource_Names in guc.c if you change this. */ typedef enum { PGC_S_DEFAULT, /* hard-wired default ("boot_val") */ PGC_S_DYNAMIC_DEFAULT, /* default computed during initialization */ PGC_S_ENV_VAR, /* postmaster environment variable */ PGC_S_FILE, /* postgresql.conf */ PGC_S_ARGV, /* postmaster command line */ PGC_S_DATABASE, /* per-database setting */ PGC_S_USER, /* per-user setting */ PGC_S_DATABASE_USER, /* per-user-and-database setting */ PGC_S_CLIENT, /* from client connection request */ PGC_S_OVERRIDE, /* special case to forcibly set default */ PGC_S_INTERACTIVE, /* dividing line for error reporting */ PGC_S_TEST, /* test per-database or per-user setting */ PGC_S_SESSION /* SET command */ } GucSource; /* * Parsing the configuration file will return a list of name-value pairs * with source location info. */ typedef struct ConfigVariable { char *name; char *value; char *filename; int sourceline; struct ConfigVariable *next; } ConfigVariable; extern bool ParseConfigFile(const char *config_file, const char *calling_file, bool strict, int depth, int elevel, ConfigVariable **head_p, ConfigVariable **tail_p); extern bool ParseConfigFp(FILE *fp, const char *config_file, int depth, int elevel, ConfigVariable **head_p, ConfigVariable **tail_p); extern void FreeConfigVariables(ConfigVariable *list); /* * The possible values of an enum variable are specified by an array of * name-value pairs. The "hidden" flag means the value is accepted but * won't be displayed when guc.c is asked for a list of acceptable values. */ struct config_enum_entry { const char *name; int val; bool hidden; }; /* * Signatures for per-variable check/assign/show hook functions */ typedef bool (*GucBoolCheckHook) (bool *newval, void **extra, GucSource source); typedef bool (*GucIntCheckHook) (int *newval, void **extra, GucSource source); typedef bool (*GucRealCheckHook) (double *newval, void **extra, GucSource source); typedef bool (*GucStringCheckHook) (char **newval, void **extra, GucSource source); typedef bool (*GucEnumCheckHook) (int *newval, void **extra, GucSource source); typedef void (*GucBoolAssignHook) (bool newval, void *extra); typedef void (*GucIntAssignHook) (int newval, void *extra); typedef void (*GucRealAssignHook) (double newval, void *extra); typedef void (*GucStringAssignHook) (const char *newval, void *extra); typedef void (*GucEnumAssignHook) (int newval, void *extra); typedef const char *(*GucShowHook) (void); /* * Miscellaneous */ typedef enum { /* Types of set_config_option actions */ GUC_ACTION_SET, /* regular SET command */ GUC_ACTION_LOCAL, /* SET LOCAL command */ GUC_ACTION_SAVE /* function SET option, or temp assignment */ } GucAction; #define GUC_QUALIFIER_SEPARATOR '.' /* * bit values in "flags" of a GUC variable */ #define GUC_LIST_INPUT 0x0001 /* input can be list format */ #define GUC_LIST_QUOTE 0x0002 /* double-quote list elements */ #define GUC_NO_SHOW_ALL 0x0004 /* exclude from SHOW ALL */ #define GUC_NO_RESET_ALL 0x0008 /* exclude from RESET ALL */ #define GUC_REPORT 0x0010 /* auto-report changes to client */ #define GUC_NOT_IN_SAMPLE 0x0020 /* not in postgresql.conf.sample */ #define GUC_DISALLOW_IN_FILE 0x0040 /* can't set in postgresql.conf */ #define GUC_CUSTOM_PLACEHOLDER 0x0080 /* placeholder for custom variable */ #define GUC_SUPERUSER_ONLY 0x0100 /* show only to superusers */ #define GUC_IS_NAME 0x0200 /* limit string to NAMEDATALEN-1 */ #define GUC_UNIT_KB 0x0400 /* value is in kilobytes */ #define GUC_UNIT_BLOCKS 0x0800 /* value is in blocks */ #define GUC_UNIT_XBLOCKS 0x0C00 /* value is in xlog blocks */ #define GUC_UNIT_MEMORY 0x0C00 /* mask for KB, BLOCKS, XBLOCKS */ #define GUC_UNIT_MS 0x1000 /* value is in milliseconds */ #define GUC_UNIT_S 0x2000 /* value is in seconds */ #define GUC_UNIT_MIN 0x4000 /* value is in minutes */ #define GUC_UNIT_TIME 0x7000 /* mask for MS, S, MIN */ #define GUC_NOT_WHILE_SEC_REST 0x8000 /* can't set if security restricted */ /* GUC vars that are actually declared in guc.c, rather than elsewhere */ extern bool log_duration; extern bool Debug_print_plan; extern bool Debug_print_parse; extern bool Debug_print_rewritten; extern bool Debug_pretty_print; extern bool log_parser_stats; extern bool log_planner_stats; extern bool log_executor_stats; extern bool log_statement_stats; extern bool log_btree_build_stats; extern PGDLLIMPORT bool check_function_bodies; extern bool default_with_oids; extern bool SQL_inheritance; extern int log_min_error_statement; extern int log_min_messages; extern int client_min_messages; extern int log_min_duration_statement; extern int log_temp_files; extern int temp_file_limit; extern int num_temp_buffers; extern char *data_directory; extern char *ConfigFileName; extern char *HbaFileName; extern char *IdentFileName; extern char *external_pid_file; extern char *application_name; extern int tcp_keepalives_idle; extern int tcp_keepalives_interval; extern int tcp_keepalives_count; /* * Functions exported by guc.c */ extern void SetConfigOption(const char *name, const char *value, GucContext context, GucSource source); extern void DefineCustomBoolVariable( const char *name, const char *short_desc, const char *long_desc, bool *valueAddr, bool bootValue, GucContext context, int flags, GucBoolCheckHook check_hook, GucBoolAssignHook assign_hook, GucShowHook show_hook); extern void DefineCustomIntVariable( const char *name, const char *short_desc, const char *long_desc, int *valueAddr, int bootValue, int minValue, int maxValue, GucContext context, int flags, GucIntCheckHook check_hook, GucIntAssignHook assign_hook, GucShowHook show_hook); extern void DefineCustomRealVariable( const char *name, const char *short_desc, const char *long_desc, double *valueAddr, double bootValue, double minValue, double maxValue, GucContext context, int flags, GucRealCheckHook check_hook, GucRealAssignHook assign_hook, GucShowHook show_hook); extern void DefineCustomStringVariable( const char *name, const char *short_desc, const char *long_desc, char **valueAddr, const char *bootValue, GucContext context, int flags, GucStringCheckHook check_hook, GucStringAssignHook assign_hook, GucShowHook show_hook); extern void DefineCustomEnumVariable( const char *name, const char *short_desc, const char *long_desc, int *valueAddr, int bootValue, const struct config_enum_entry * options, GucContext context, int flags, GucEnumCheckHook check_hook, GucEnumAssignHook assign_hook, GucShowHook show_hook); extern void EmitWarningsOnPlaceholders(const char *className); extern const char *GetConfigOption(const char *name, bool missing_ok, bool restrict_superuser); extern const char *GetConfigOptionResetString(const char *name); extern void ProcessConfigFile(GucContext context); extern void InitializeGUCOptions(void); extern bool SelectConfigFiles(const char *userDoption, const char *progname); extern void ResetAllOptions(void); extern void AtStart_GUC(void); extern int NewGUCNestLevel(void); extern void AtEOXact_GUC(bool isCommit, int nestLevel); extern void BeginReportingGUCOptions(void); extern void ParseLongOption(const char *string, char **name, char **value); extern bool parse_int(const char *value, int *result, int flags, const char **hintmsg); extern bool parse_real(const char *value, double *result); extern int set_config_option(const char *name, const char *value, GucContext context, GucSource source, GucAction action, bool changeVal, int elevel); extern char *GetConfigOptionByName(const char *name, const char **varname); extern void GetConfigOptionByNum(int varnum, const char **values, bool *noshow); extern int GetNumConfigOptions(void); extern void SetPGVariable(const char *name, List *args, bool is_local); extern void GetPGVariable(const char *name, DestReceiver *dest); extern TupleDesc GetPGVariableResultDesc(const char *name); extern void ExecSetVariableStmt(VariableSetStmt *stmt); extern char *ExtractSetVariableArgs(VariableSetStmt *stmt); extern void ProcessGUCArray(ArrayType *array, GucContext context, GucSource source, GucAction action); extern ArrayType *GUCArrayAdd(ArrayType *array, const char *name, const char *value); extern ArrayType *GUCArrayDelete(ArrayType *array, const char *name); extern ArrayType *GUCArrayReset(ArrayType *array); #ifdef EXEC_BACKEND extern void write_nondefault_variables(GucContext context); extern void read_nondefault_variables(void); #endif /* Support for messages reported from GUC check hooks */ extern PGDLLIMPORT char *GUC_check_errmsg_string; extern PGDLLIMPORT char *GUC_check_errdetail_string; extern PGDLLIMPORT char *GUC_check_errhint_string; extern void GUC_check_errcode(int sqlerrcode); #define GUC_check_errmsg \ pre_format_elog_string(errno, TEXTDOMAIN), \ GUC_check_errmsg_string = format_elog_string #define GUC_check_errdetail \ pre_format_elog_string(errno, TEXTDOMAIN), \ GUC_check_errdetail_string = format_elog_string #define GUC_check_errhint \ pre_format_elog_string(errno, TEXTDOMAIN), \ GUC_check_errhint_string = format_elog_string /* * The following functions are not in guc.c, but are declared here to avoid * having to include guc.h in some widely used headers that it really doesn't * belong in. */ /* in commands/tablespace.c */ extern bool check_default_tablespace(char **newval, void **extra, GucSource source); extern bool check_temp_tablespaces(char **newval, void **extra, GucSource source); extern void assign_temp_tablespaces(const char *newval, void *extra); /* in catalog/namespace.c */ extern bool check_search_path(char **newval, void **extra, GucSource source); extern void assign_search_path(const char *newval, void *extra); /* in access/transam/xlog.c */ extern bool check_wal_buffers(int *newval, void **extra, GucSource source); extern void assign_xlog_sync_method(int new_sync_method, void *extra); #endif /* GUC_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/sortsupport.h��������������������������������������������������������������������0000644�����������������00000012464�14763166026�0013157 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * sortsupport.h * Framework for accelerated sorting. * * Traditionally, PostgreSQL has implemented sorting by repeatedly invoking * an SQL-callable comparison function "cmp(x, y) returns int" on pairs of * values to be compared, where the comparison function is the BTORDER_PROC * pg_amproc support function of the appropriate btree index opclass. * * This file defines alternative APIs that allow sorting to be performed with * reduced overhead. To support lower-overhead sorting, a btree opclass may * provide a BTSORTSUPPORT_PROC pg_amproc entry, which must take a single * argument of type internal and return void. The argument is actually a * pointer to a SortSupportData struct, which is defined below. * * If provided, the BTSORTSUPPORT function will be called during sort setup, * and it must initialize the provided struct with pointers to function(s) * that can be called to perform sorting. This API is defined to allow * multiple acceleration mechanisms to be supported, but no opclass is * required to provide all of them. The BTSORTSUPPORT function should * simply not set any function pointers for mechanisms it doesn't support. * (However, all opclasses that provide BTSORTSUPPORT are required to provide * the comparator function.) * * All sort support functions will be passed the address of the * SortSupportData struct when called, so they can use it to store * additional private data as needed. In particular, for collation-aware * datatypes, the ssup_collation field is set before calling BTSORTSUPPORT * and is available to all support functions. Additional opclass-dependent * data can be stored using the ssup_extra field. Any such data * should be allocated in the ssup_cxt memory context. * * Note: since pg_amproc functions are indexed by (lefttype, righttype) * it is possible to associate a BTSORTSUPPORT function with a cross-type * comparison. This could sensibly be used to provide a fast comparator * function for such cases, but probably not any other acceleration method. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/sortsupport.h * *------------------------------------------------------------------------- */ #ifndef SORTSUPPORT_H #define SORTSUPPORT_H #include "access/attnum.h" typedef struct SortSupportData *SortSupport; typedef struct SortSupportData { /* * These fields are initialized before calling the BTSORTSUPPORT function * and should not be changed later. */ MemoryContext ssup_cxt; /* Context containing sort info */ Oid ssup_collation; /* Collation to use, or InvalidOid */ /* * Additional sorting parameters; but unlike ssup_collation, these can be * changed after BTSORTSUPPORT is called, so don't use them in selecting * sort support functions. */ bool ssup_reverse; /* descending-order sort? */ bool ssup_nulls_first; /* sort nulls first? */ /* * These fields are workspace for callers, and should not be touched by * opclass-specific functions. */ AttrNumber ssup_attno; /* column number to sort */ /* * ssup_extra is zeroed before calling the BTSORTSUPPORT function, and is * not touched subsequently by callers. */ void *ssup_extra; /* Workspace for opclass functions */ /* * Function pointers are zeroed before calling the BTSORTSUPPORT function, * and must be set by it for any acceleration methods it wants to supply. * The comparator pointer must be set, others are optional. */ /* * Comparator function has the same API as the traditional btree * comparison function, ie, return <0, 0, or >0 according as x is less * than, equal to, or greater than y. Note that x and y are guaranteed * not null, and there is no way to return null either. Do not return * INT_MIN, as callers are allowed to negate the result before using it. */ int (*comparator) (Datum x, Datum y, SortSupport ssup); /* * Additional sort-acceleration functions might be added here later. */ } SortSupportData; /* ApplySortComparator should be inlined if possible */ #ifdef USE_INLINE /* * Apply a sort comparator function and return a 3-way comparison result. * This takes care of handling reverse-sort and NULLs-ordering properly. */ static inline int ApplySortComparator(Datum datum1, bool isNull1, Datum datum2, bool isNull2, SortSupport ssup) { int compare; if (isNull1) { if (isNull2) compare = 0; /* NULL "=" NULL */ else if (ssup->ssup_nulls_first) compare = -1; /* NULL "<" NOT_NULL */ else compare = 1; /* NULL ">" NOT_NULL */ } else if (isNull2) { if (ssup->ssup_nulls_first) compare = 1; /* NOT_NULL ">" NULL */ else compare = -1; /* NOT_NULL "<" NULL */ } else { compare = (*ssup->comparator) (datum1, datum2, ssup); if (ssup->ssup_reverse) compare = -compare; } return compare; } #else extern int ApplySortComparator(Datum datum1, bool isNull1, Datum datum2, bool isNull2, SortSupport ssup); #endif /* USE_INLINE */ /* Other functions in utils/sort/sortsupport.c */ extern void PrepareSortSupportComparisonShim(Oid cmpFunc, SortSupport ssup); extern void PrepareSortSupportFromOrderingOp(Oid orderingOp, SortSupport ssup); #endif /* SORTSUPPORT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/formatting.h���������������������������������������������������������������������0000644�����������������00000002637�14763166026�0012706 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ----------------------------------------------------------------------- * formatting.h * * src/include/utils/formatting.h * * * Portions Copyright (c) 1999-2012, PostgreSQL Global Development Group * * The PostgreSQL routines for a DateTime/int/float/numeric formatting, * inspire with Oracle TO_CHAR() / TO_DATE() / TO_NUMBER() routines. * * Karel Zak * * ----------------------------------------------------------------------- */ #ifndef _FORMATTING_H_ #define _FORMATTING_H_ #include "fmgr.h" extern char *str_tolower(const char *buff, size_t nbytes, Oid collid); extern char *str_toupper(const char *buff, size_t nbytes, Oid collid); extern char *str_initcap(const char *buff, size_t nbytes, Oid collid); extern char *asc_tolower(const char *buff, size_t nbytes); extern char *asc_toupper(const char *buff, size_t nbytes); extern char *asc_initcap(const char *buff, size_t nbytes); extern Datum timestamp_to_char(PG_FUNCTION_ARGS); extern Datum timestamptz_to_char(PG_FUNCTION_ARGS); extern Datum interval_to_char(PG_FUNCTION_ARGS); extern Datum to_timestamp(PG_FUNCTION_ARGS); extern Datum to_date(PG_FUNCTION_ARGS); extern Datum numeric_to_number(PG_FUNCTION_ARGS); extern Datum numeric_to_char(PG_FUNCTION_ARGS); extern Datum int4_to_char(PG_FUNCTION_ARGS); extern Datum int8_to_char(PG_FUNCTION_ARGS); extern Datum float4_to_char(PG_FUNCTION_ARGS); extern Datum float8_to_char(PG_FUNCTION_ARGS); #endif �������������������������������������������������������������������������������������������������pgsql/server/utils/nabstime.h�����������������������������������������������������������������������0000644�����������������00000013447�14763166026�0012337 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nabstime.h * Definitions for the "new" abstime code. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/nabstime.h * *------------------------------------------------------------------------- */ #ifndef NABSTIME_H #define NABSTIME_H #include <limits.h> #include "fmgr.h" #include "pgtime.h" /* ---------------------------------------------------------------- * * time types + support macros * * ---------------------------------------------------------------- */ /* * Although time_t generally is a long int on 64 bit systems, these two * types must be 4 bytes, because that's what pg_type.h assumes. They * should be yanked (long) before 2038 and be replaced by timestamp and * interval. */ typedef int32 AbsoluteTime; typedef int32 RelativeTime; typedef struct { int32 status; AbsoluteTime data[2]; } TimeIntervalData; typedef TimeIntervalData *TimeInterval; /* * Macros for fmgr-callable functions. */ #define DatumGetAbsoluteTime(X) ((AbsoluteTime) DatumGetInt32(X)) #define DatumGetRelativeTime(X) ((RelativeTime) DatumGetInt32(X)) #define DatumGetTimeInterval(X) ((TimeInterval) DatumGetPointer(X)) #define AbsoluteTimeGetDatum(X) Int32GetDatum(X) #define RelativeTimeGetDatum(X) Int32GetDatum(X) #define TimeIntervalGetDatum(X) PointerGetDatum(X) #define PG_GETARG_ABSOLUTETIME(n) DatumGetAbsoluteTime(PG_GETARG_DATUM(n)) #define PG_GETARG_RELATIVETIME(n) DatumGetRelativeTime(PG_GETARG_DATUM(n)) #define PG_GETARG_TIMEINTERVAL(n) DatumGetTimeInterval(PG_GETARG_DATUM(n)) #define PG_RETURN_ABSOLUTETIME(x) return AbsoluteTimeGetDatum(x) #define PG_RETURN_RELATIVETIME(x) return RelativeTimeGetDatum(x) #define PG_RETURN_TIMEINTERVAL(x) return TimeIntervalGetDatum(x) /* * Reserved values * Epoch is Unix system time zero, but needs to be kept as a reserved * value rather than converting to time since timezone calculations * might move it away from 1970-01-01 00:00:00Z - tgl 97/02/20 * * Pre-v6.1 code had large decimal numbers for reserved values. * These were chosen as special 32-bit bit patterns, * so redefine them explicitly using these bit patterns. - tgl 97/02/24 */ #define INVALID_ABSTIME ((AbsoluteTime) 0x7FFFFFFE) /* 2147483647 (2^31 - 1) */ #define NOEND_ABSTIME ((AbsoluteTime) 0x7FFFFFFC) /* 2147483645 (2^31 - 3) */ #define NOSTART_ABSTIME ((AbsoluteTime) INT_MIN) /* -2147483648 */ #define INVALID_RELTIME ((RelativeTime) 0x7FFFFFFE) /* 2147483647 (2^31 - 1) */ #define AbsoluteTimeIsValid(time) \ ((bool) ((time) != INVALID_ABSTIME)) /* * Because NOSTART_ABSTIME is defined as INT_MIN, there can't be any * AbsoluteTime values less than it. Therefore, we can code the test * "time > NOSTART_ABSTIME" as "time != NOSTART_ABSTIME", which avoids * compiler bugs on some platforms. --- tgl & az, 11/2000 */ #define AbsoluteTimeIsReal(time) \ ((bool) (((AbsoluteTime) (time)) < NOEND_ABSTIME && \ ((AbsoluteTime) (time)) != NOSTART_ABSTIME)) #define RelativeTimeIsValid(time) \ ((bool) (((RelativeTime) (time)) != INVALID_RELTIME)) /* * nabstime.c prototypes */ extern Datum abstimein(PG_FUNCTION_ARGS); extern Datum abstimeout(PG_FUNCTION_ARGS); extern Datum abstimerecv(PG_FUNCTION_ARGS); extern Datum abstimesend(PG_FUNCTION_ARGS); extern Datum abstimeeq(PG_FUNCTION_ARGS); extern Datum abstimene(PG_FUNCTION_ARGS); extern Datum abstimelt(PG_FUNCTION_ARGS); extern Datum abstimegt(PG_FUNCTION_ARGS); extern Datum abstimele(PG_FUNCTION_ARGS); extern Datum abstimege(PG_FUNCTION_ARGS); extern Datum abstime_finite(PG_FUNCTION_ARGS); extern Datum timestamp_abstime(PG_FUNCTION_ARGS); extern Datum abstime_timestamp(PG_FUNCTION_ARGS); extern Datum timestamptz_abstime(PG_FUNCTION_ARGS); extern Datum abstime_timestamptz(PG_FUNCTION_ARGS); extern Datum reltimein(PG_FUNCTION_ARGS); extern Datum reltimeout(PG_FUNCTION_ARGS); extern Datum reltimerecv(PG_FUNCTION_ARGS); extern Datum reltimesend(PG_FUNCTION_ARGS); extern Datum tintervalin(PG_FUNCTION_ARGS); extern Datum tintervalout(PG_FUNCTION_ARGS); extern Datum tintervalrecv(PG_FUNCTION_ARGS); extern Datum tintervalsend(PG_FUNCTION_ARGS); extern Datum interval_reltime(PG_FUNCTION_ARGS); extern Datum reltime_interval(PG_FUNCTION_ARGS); extern Datum mktinterval(PG_FUNCTION_ARGS); extern Datum timepl(PG_FUNCTION_ARGS); extern Datum timemi(PG_FUNCTION_ARGS); extern Datum intinterval(PG_FUNCTION_ARGS); extern Datum tintervalrel(PG_FUNCTION_ARGS); extern Datum timenow(PG_FUNCTION_ARGS); extern Datum reltimeeq(PG_FUNCTION_ARGS); extern Datum reltimene(PG_FUNCTION_ARGS); extern Datum reltimelt(PG_FUNCTION_ARGS); extern Datum reltimegt(PG_FUNCTION_ARGS); extern Datum reltimele(PG_FUNCTION_ARGS); extern Datum reltimege(PG_FUNCTION_ARGS); extern Datum tintervalsame(PG_FUNCTION_ARGS); extern Datum tintervaleq(PG_FUNCTION_ARGS); extern Datum tintervalne(PG_FUNCTION_ARGS); extern Datum tintervallt(PG_FUNCTION_ARGS); extern Datum tintervalgt(PG_FUNCTION_ARGS); extern Datum tintervalle(PG_FUNCTION_ARGS); extern Datum tintervalge(PG_FUNCTION_ARGS); extern Datum tintervalleneq(PG_FUNCTION_ARGS); extern Datum tintervallenne(PG_FUNCTION_ARGS); extern Datum tintervallenlt(PG_FUNCTION_ARGS); extern Datum tintervallengt(PG_FUNCTION_ARGS); extern Datum tintervallenle(PG_FUNCTION_ARGS); extern Datum tintervallenge(PG_FUNCTION_ARGS); extern Datum tintervalct(PG_FUNCTION_ARGS); extern Datum tintervalov(PG_FUNCTION_ARGS); extern Datum tintervalstart(PG_FUNCTION_ARGS); extern Datum tintervalend(PG_FUNCTION_ARGS); extern Datum timeofday(PG_FUNCTION_ARGS); /* non-fmgr-callable support routines */ extern AbsoluteTime GetCurrentAbsoluteTime(void); extern void abstime2tm(AbsoluteTime time, int *tzp, struct pg_tm * tm, char **tzn); #endif /* NABSTIME_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/catcache.h�����������������������������������������������������������������������0000644�����������������00000017014�14763166026�0012262 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * catcache.h * Low-level catalog cache definitions. * * NOTE: every catalog cache must have a corresponding unique index on * the system table that it caches --- ie, the index must match the keys * used to do lookups in this cache. All cache fetches are done with * indexscans (under normal conditions). The index should be unique to * guarantee that there can only be one matching row for a key combination. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/catcache.h * *------------------------------------------------------------------------- */ #ifndef CATCACHE_H #define CATCACHE_H #include "access/htup.h" #include "access/skey.h" #include "lib/dllist.h" #include "utils/relcache.h" /* * struct catctup: individual tuple in the cache. * struct catclist: list of tuples matching a partial key. * struct catcache: information for managing a cache. * struct catcacheheader: information for managing all the caches. */ #define CATCACHE_MAXKEYS 4 typedef struct catcache { int id; /* cache identifier --- see syscache.h */ struct catcache *cc_next; /* link to next catcache */ const char *cc_relname; /* name of relation the tuples come from */ Oid cc_reloid; /* OID of relation the tuples come from */ Oid cc_indexoid; /* OID of index matching cache keys */ bool cc_relisshared; /* is relation shared across databases? */ TupleDesc cc_tupdesc; /* tuple descriptor (copied from reldesc) */ int cc_ntup; /* # of tuples currently in this cache */ int cc_nbuckets; /* # of hash buckets in this cache */ int cc_nkeys; /* # of keys (1..CATCACHE_MAXKEYS) */ int cc_key[CATCACHE_MAXKEYS]; /* AttrNumber of each key */ PGFunction cc_hashfunc[CATCACHE_MAXKEYS]; /* hash function for each key */ ScanKeyData cc_skey[CATCACHE_MAXKEYS]; /* precomputed key info for * heap scans */ bool cc_isname[CATCACHE_MAXKEYS]; /* flag "name" key columns */ Dllist cc_lists; /* list of CatCList structs */ #ifdef CATCACHE_STATS long cc_searches; /* total # searches against this cache */ long cc_hits; /* # of matches against existing entry */ long cc_neg_hits; /* # of matches against negative entry */ long cc_newloads; /* # of successful loads of new entry */ /* * cc_searches - (cc_hits + cc_neg_hits + cc_newloads) is number of failed * searches, each of which will result in loading a negative entry */ long cc_invals; /* # of entries invalidated from cache */ long cc_lsearches; /* total # list-searches */ long cc_lhits; /* # of matches against existing lists */ #endif Dllist cc_bucket[1]; /* hash buckets --- VARIABLE LENGTH ARRAY */ } CatCache; /* VARIABLE LENGTH STRUCT */ typedef struct catctup { int ct_magic; /* for identifying CatCTup entries */ #define CT_MAGIC 0x57261502 CatCache *my_cache; /* link to owning catcache */ /* * Each tuple in a cache is a member of a Dllist that stores the elements * of its hash bucket. We keep each Dllist in LRU order to speed repeated * lookups. */ Dlelem cache_elem; /* list member of per-bucket list */ /* * The tuple may also be a member of at most one CatCList. (If a single * catcache is list-searched with varying numbers of keys, we may have to * make multiple entries for the same tuple because of this restriction. * Currently, that's not expected to be common, so we accept the potential * inefficiency.) */ struct catclist *c_list; /* containing CatCList, or NULL if none */ /* * A tuple marked "dead" must not be returned by subsequent searches. * However, it won't be physically deleted from the cache until its * refcount goes to zero. (If it's a member of a CatCList, the list's * refcount must go to zero, too; also, remember to mark the list dead at * the same time the tuple is marked.) * * A negative cache entry is an assertion that there is no tuple matching * a particular key. This is just as useful as a normal entry so far as * avoiding catalog searches is concerned. Management of positive and * negative entries is identical. */ int refcount; /* number of active references */ bool dead; /* dead but not yet removed? */ bool negative; /* negative cache entry? */ uint32 hash_value; /* hash value for this tuple's keys */ HeapTupleData tuple; /* tuple management header */ } CatCTup; typedef struct catclist { int cl_magic; /* for identifying CatCList entries */ #define CL_MAGIC 0x52765103 CatCache *my_cache; /* link to owning catcache */ /* * A CatCList describes the result of a partial search, ie, a search using * only the first K key columns of an N-key cache. We form the keys used * into a tuple (with other attributes NULL) to represent the stored key * set. The CatCList object contains links to cache entries for all the * table rows satisfying the partial key. (Note: none of these will be * negative cache entries.) * * A CatCList is only a member of a per-cache list; we do not currently * divide them into hash buckets. * * A list marked "dead" must not be returned by subsequent searches. * However, it won't be physically deleted from the cache until its * refcount goes to zero. (A list should be marked dead if any of its * member entries are dead.) * * If "ordered" is true then the member tuples appear in the order of the * cache's underlying index. This will be true in normal operation, but * might not be true during bootstrap or recovery operations. (namespace.c * is able to save some cycles when it is true.) */ Dlelem cache_elem; /* list member of per-catcache list */ int refcount; /* number of active references */ bool dead; /* dead but not yet removed? */ bool ordered; /* members listed in index order? */ short nkeys; /* number of lookup keys specified */ uint32 hash_value; /* hash value for lookup keys */ HeapTupleData tuple; /* header for tuple holding keys */ int n_members; /* number of member tuples */ CatCTup *members[1]; /* members --- VARIABLE LENGTH ARRAY */ } CatCList; /* VARIABLE LENGTH STRUCT */ typedef struct catcacheheader { CatCache *ch_caches; /* head of list of CatCache structs */ int ch_ntup; /* # of tuples in all caches */ } CatCacheHeader; /* this extern duplicates utils/memutils.h... */ extern PGDLLIMPORT MemoryContext CacheMemoryContext; extern void CreateCacheMemoryContext(void); extern CatCache *InitCatCache(int id, Oid reloid, Oid indexoid, int nkeys, const int *key, int nbuckets); extern void InitCatCachePhase2(CatCache *cache, bool touch_index); extern HeapTuple SearchCatCache(CatCache *cache, Datum v1, Datum v2, Datum v3, Datum v4); extern void ReleaseCatCache(HeapTuple tuple); extern uint32 GetCatCacheHashValue(CatCache *cache, Datum v1, Datum v2, Datum v3, Datum v4); extern CatCList *SearchCatCacheList(CatCache *cache, int nkeys, Datum v1, Datum v2, Datum v3, Datum v4); extern void ReleaseCatCacheList(CatCList *list); extern void ResetCatalogCaches(void); extern void CatalogCacheFlushCatalog(Oid catId); extern void CatalogCacheIdInvalidate(int cacheId, uint32 hashValue); extern void PrepareToInvalidateCacheTuple(Relation relation, HeapTuple tuple, HeapTuple newtuple, void (*function) (int, uint32, Oid)); extern void PrintCatCacheLeakWarning(HeapTuple tuple); extern void PrintCatCacheListLeakWarning(CatCList *list); #endif /* CATCACHE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/fmgroids.h�����������������������������������������������������������������������0000644�����������������00000172140�14763166026�0012343 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * fmgroids.h * Macros that define the OIDs of built-in functions. * * These macros can be used to avoid a catalog lookup when a specific * fmgr-callable function needs to be referenced. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * NOTES * ****************************** * *** DO NOT EDIT THIS FILE! *** * ****************************** * * It has been GENERATED by Gen_fmgrtab.pl * from ../../../src/include/catalog/pg_proc.h * *------------------------------------------------------------------------- */ #ifndef FMGROIDS_H #define FMGROIDS_H /* * Constant macros for the OIDs of entries in pg_proc. * * NOTE: macros are named after the prosrc value, ie the actual C name * of the implementing function, not the proname which may be overloaded. * For example, we want to be able to assign different macro names to both * char_text() and name_text() even though these both appear with proname * 'text'. If the same C function appears in more than one pg_proc entry, * its equivalent macro will be defined with the lowest OID among those * entries. */ #define F_BYTEAOUT 31 #define F_CHAROUT 33 #define F_NAMEIN 34 #define F_NAMEOUT 35 #define F_INT2IN 38 #define F_INT2OUT 39 #define F_INT2VECTORIN 40 #define F_INT2VECTOROUT 41 #define F_INT4IN 42 #define F_INT4OUT 43 #define F_REGPROCIN 44 #define F_REGPROCOUT 45 #define F_TEXTIN 46 #define F_TEXTOUT 47 #define F_TIDIN 48 #define F_TIDOUT 49 #define F_XIDIN 50 #define F_XIDOUT 51 #define F_CIDIN 52 #define F_CIDOUT 53 #define F_OIDVECTORIN 54 #define F_OIDVECTOROUT 55 #define F_BOOLLT 56 #define F_BOOLGT 57 #define F_BOOLEQ 60 #define F_CHAREQ 61 #define F_NAMEEQ 62 #define F_INT2EQ 63 #define F_INT2LT 64 #define F_INT4EQ 65 #define F_INT4LT 66 #define F_TEXTEQ 67 #define F_XIDEQ 68 #define F_CIDEQ 69 #define F_CHARNE 70 #define F_CHARLE 72 #define F_CHARGT 73 #define F_CHARGE 74 #define F_CHARTOI4 77 #define F_I4TOCHAR 78 #define F_NAMEREGEXEQ 79 #define F_BOOLNE 84 #define F_PGSQL_VERSION 89 #define F_EQSEL 101 #define F_NEQSEL 102 #define F_SCALARLTSEL 103 #define F_SCALARGTSEL 104 #define F_EQJOINSEL 105 #define F_NEQJOINSEL 106 #define F_SCALARLTJOINSEL 107 #define F_SCALARGTJOINSEL 108 #define F_UNKNOWNIN 109 #define F_UNKNOWNOUT 110 #define F_NUMERIC_FAC 111 #define F_BOX_ABOVE_EQ 115 #define F_BOX_BELOW_EQ 116 #define F_POINT_IN 117 #define F_POINT_OUT 118 #define F_LSEG_IN 119 #define F_LSEG_OUT 120 #define F_PATH_IN 121 #define F_PATH_OUT 122 #define F_BOX_IN 123 #define F_BOX_OUT 124 #define F_BOX_OVERLAP 125 #define F_BOX_GE 126 #define F_BOX_GT 127 #define F_BOX_EQ 128 #define F_BOX_LT 129 #define F_BOX_LE 130 #define F_POINT_ABOVE 131 #define F_POINT_LEFT 132 #define F_POINT_RIGHT 133 #define F_POINT_BELOW 134 #define F_POINT_EQ 135 #define F_ON_PB 136 #define F_ON_PPATH 137 #define F_BOX_CENTER 138 #define F_AREASEL 139 #define F_AREAJOINSEL 140 #define F_INT4MUL 141 #define F_INT4NE 144 #define F_INT2NE 145 #define F_INT2GT 146 #define F_INT4GT 147 #define F_INT2LE 148 #define F_INT4LE 149 #define F_INT4GE 150 #define F_INT2GE 151 #define F_INT2MUL 152 #define F_INT2DIV 153 #define F_INT4DIV 154 #define F_INT2MOD 155 #define F_INT4MOD 156 #define F_TEXTNE 157 #define F_INT24EQ 158 #define F_INT42EQ 159 #define F_INT24LT 160 #define F_INT42LT 161 #define F_INT24GT 162 #define F_INT42GT 163 #define F_INT24NE 164 #define F_INT42NE 165 #define F_INT24LE 166 #define F_INT42LE 167 #define F_INT24GE 168 #define F_INT42GE 169 #define F_INT24MUL 170 #define F_INT42MUL 171 #define F_INT24DIV 172 #define F_INT42DIV 173 #define F_INT2PL 176 #define F_INT4PL 177 #define F_INT24PL 178 #define F_INT42PL 179 #define F_INT2MI 180 #define F_INT4MI 181 #define F_INT24MI 182 #define F_INT42MI 183 #define F_OIDEQ 184 #define F_OIDNE 185 #define F_BOX_SAME 186 #define F_BOX_CONTAIN 187 #define F_BOX_LEFT 188 #define F_BOX_OVERLEFT 189 #define F_BOX_OVERRIGHT 190 #define F_BOX_RIGHT 191 #define F_BOX_CONTAINED 192 #define F_BOX_CONTAIN_PT 193 #define F_PG_NODE_TREE_IN 195 #define F_PG_NODE_TREE_OUT 196 #define F_PG_NODE_TREE_RECV 197 #define F_PG_NODE_TREE_SEND 198 #define F_FLOAT4IN 200 #define F_FLOAT4OUT 201 #define F_FLOAT4MUL 202 #define F_FLOAT4DIV 203 #define F_FLOAT4PL 204 #define F_FLOAT4MI 205 #define F_FLOAT4UM 206 #define F_FLOAT4ABS 207 #define F_FLOAT4_ACCUM 208 #define F_FLOAT4LARGER 209 #define F_FLOAT4SMALLER 211 #define F_INT4UM 212 #define F_INT2UM 213 #define F_FLOAT8IN 214 #define F_FLOAT8OUT 215 #define F_FLOAT8MUL 216 #define F_FLOAT8DIV 217 #define F_FLOAT8PL 218 #define F_FLOAT8MI 219 #define F_FLOAT8UM 220 #define F_FLOAT8ABS 221 #define F_FLOAT8_ACCUM 222 #define F_FLOAT8LARGER 223 #define F_FLOAT8SMALLER 224 #define F_LSEG_CENTER 225 #define F_PATH_CENTER 226 #define F_POLY_CENTER 227 #define F_DROUND 228 #define F_DTRUNC 229 #define F_DSQRT 230 #define F_DCBRT 231 #define F_DPOW 232 #define F_DEXP 233 #define F_DLOG1 234 #define F_I2TOD 235 #define F_I2TOF 236 #define F_DTOI2 237 #define F_FTOI2 238 #define F_LINE_DISTANCE 239 #define F_ABSTIMEIN 240 #define F_ABSTIMEOUT 241 #define F_RELTIMEIN 242 #define F_RELTIMEOUT 243 #define F_TIMEPL 244 #define F_TIMEMI 245 #define F_TINTERVALIN 246 #define F_TINTERVALOUT 247 #define F_INTINTERVAL 248 #define F_TINTERVALREL 249 #define F_TIMENOW 250 #define F_ABSTIMEEQ 251 #define F_ABSTIMENE 252 #define F_ABSTIMELT 253 #define F_ABSTIMEGT 254 #define F_ABSTIMELE 255 #define F_ABSTIMEGE 256 #define F_RELTIMEEQ 257 #define F_RELTIMENE 258 #define F_RELTIMELT 259 #define F_RELTIMEGT 260 #define F_RELTIMELE 261 #define F_RELTIMEGE 262 #define F_TINTERVALSAME 263 #define F_TINTERVALCT 264 #define F_TINTERVALOV 265 #define F_TINTERVALLENEQ 266 #define F_TINTERVALLENNE 267 #define F_TINTERVALLENLT 268 #define F_TINTERVALLENGT 269 #define F_TINTERVALLENLE 270 #define F_TINTERVALLENGE 271 #define F_TINTERVALSTART 272 #define F_TINTERVALEND 273 #define F_TIMEOFDAY 274 #define F_ABSTIME_FINITE 275 #define F_BTCANRETURN 276 #define F_INTER_SL 277 #define F_INTER_LB 278 #define F_FLOAT48MUL 279 #define F_FLOAT48DIV 280 #define F_FLOAT48PL 281 #define F_FLOAT48MI 282 #define F_FLOAT84MUL 283 #define F_FLOAT84DIV 284 #define F_FLOAT84PL 285 #define F_FLOAT84MI 286 #define F_FLOAT4EQ 287 #define F_FLOAT4NE 288 #define F_FLOAT4LT 289 #define F_FLOAT4LE 290 #define F_FLOAT4GT 291 #define F_FLOAT4GE 292 #define F_FLOAT8EQ 293 #define F_FLOAT8NE 294 #define F_FLOAT8LT 295 #define F_FLOAT8LE 296 #define F_FLOAT8GT 297 #define F_FLOAT8GE 298 #define F_FLOAT48EQ 299 #define F_FLOAT48NE 300 #define F_FLOAT48LT 301 #define F_FLOAT48LE 302 #define F_FLOAT48GT 303 #define F_FLOAT48GE 304 #define F_FLOAT84EQ 305 #define F_FLOAT84NE 306 #define F_FLOAT84LT 307 #define F_FLOAT84LE 308 #define F_FLOAT84GT 309 #define F_FLOAT84GE 310 #define F_FTOD 311 #define F_DTOF 312 #define F_I2TOI4 313 #define F_I4TOI2 314 #define F_INT2VECTOREQ 315 #define F_I4TOD 316 #define F_DTOI4 317 #define F_I4TOF 318 #define F_FTOI4 319 #define F_WIDTH_BUCKET_FLOAT8 320 #define F_JSON_IN 321 #define F_JSON_OUT 322 #define F_JSON_RECV 323 #define F_JSON_SEND 324 #define F_GINBUILDEMPTY 325 #define F_GISTBUILDEMPTY 326 #define F_HASHBUILDEMPTY 327 #define F_BTBUILDEMPTY 328 #define F_HASH_ACLITEM 329 #define F_BTGETTUPLE 330 #define F_BTINSERT 331 #define F_BTBULKDELETE 332 #define F_BTBEGINSCAN 333 #define F_BTRESCAN 334 #define F_BTENDSCAN 335 #define F_BTMARKPOS 336 #define F_BTRESTRPOS 337 #define F_BTBUILD 338 #define F_POLY_SAME 339 #define F_POLY_CONTAIN 340 #define F_POLY_LEFT 341 #define F_POLY_OVERLEFT 342 #define F_POLY_OVERRIGHT 343 #define F_POLY_RIGHT 344 #define F_POLY_CONTAINED 345 #define F_POLY_OVERLAP 346 #define F_POLY_IN 347 #define F_POLY_OUT 348 #define F_BTINT2CMP 350 #define F_BTINT4CMP 351 #define F_BTFLOAT4CMP 354 #define F_BTFLOAT8CMP 355 #define F_BTOIDCMP 356 #define F_BTABSTIMECMP 357 #define F_BTCHARCMP 358 #define F_BTNAMECMP 359 #define F_BTTEXTCMP 360 #define F_LSEG_DISTANCE 361 #define F_LSEG_INTERPT 362 #define F_DIST_PS 363 #define F_DIST_PB 364 #define F_DIST_SB 365 #define F_CLOSE_PS 366 #define F_CLOSE_PB 367 #define F_CLOSE_SB 368 #define F_ON_PS 369 #define F_PATH_DISTANCE 370 #define F_DIST_PPATH 371 #define F_ON_SB 372 #define F_INTER_SB 373 #define F_TEXT_TO_ARRAY_NULL 376 #define F_CASH_CMP 377 #define F_ARRAY_PUSH 378 #define F_BTRELTIMECMP 380 #define F_BTTINTERVALCMP 381 #define F_BTARRAYCMP 382 #define F_ARRAY_CAT 383 #define F_ARRAY_TO_TEXT_NULL 384 #define F_ARRAY_NE 390 #define F_ARRAY_LT 391 #define F_ARRAY_GT 392 #define F_ARRAY_LE 393 #define F_TEXT_TO_ARRAY 394 #define F_ARRAY_TO_TEXT 395 #define F_ARRAY_GE 396 #define F_HASHINT2VECTOR 398 #define F_HASHMACADDR 399 #define F_HASHTEXT 400 #define F_RTRIM1 401 #define F_BTOIDVECTORCMP 404 #define F_NAME_TEXT 406 #define F_TEXT_NAME 407 #define F_NAME_BPCHAR 408 #define F_BPCHAR_NAME 409 #define F_HASHINET 422 #define F_HASHVACUUMCLEANUP 425 #define F_HASH_NUMERIC 432 #define F_MACADDR_IN 436 #define F_MACADDR_OUT 437 #define F_HASHCOSTESTIMATE 438 #define F_HASHGETTUPLE 440 #define F_HASHINSERT 441 #define F_HASHBULKDELETE 442 #define F_HASHBEGINSCAN 443 #define F_HASHRESCAN 444 #define F_HASHENDSCAN 445 #define F_HASHMARKPOS 446 #define F_HASHRESTRPOS 447 #define F_HASHBUILD 448 #define F_HASHINT2 449 #define F_HASHINT4 450 #define F_HASHFLOAT4 451 #define F_HASHFLOAT8 452 #define F_HASHOID 453 #define F_HASHCHAR 454 #define F_HASHNAME 455 #define F_HASHVARLENA 456 #define F_HASHOIDVECTOR 457 #define F_TEXT_LARGER 458 #define F_TEXT_SMALLER 459 #define F_INT8IN 460 #define F_INT8OUT 461 #define F_INT8UM 462 #define F_INT8PL 463 #define F_INT8MI 464 #define F_INT8MUL 465 #define F_INT8DIV 466 #define F_INT8EQ 467 #define F_INT8NE 468 #define F_INT8LT 469 #define F_INT8GT 470 #define F_INT8LE 471 #define F_INT8GE 472 #define F_INT84EQ 474 #define F_INT84NE 475 #define F_INT84LT 476 #define F_INT84GT 477 #define F_INT84LE 478 #define F_INT84GE 479 #define F_INT84 480 #define F_INT48 481 #define F_I8TOD 482 #define F_DTOI8 483 #define F_ARRAY_LARGER 515 #define F_ARRAY_SMALLER 516 #define F_INET_ABBREV 598 #define F_CIDR_ABBREV 599 #define F_INET_SET_MASKLEN 605 #define F_OIDVECTORNE 619 #define F_HASH_ARRAY 626 #define F_CIDR_SET_MASKLEN 635 #define F_BTGETBITMAP 636 #define F_HASHGETBITMAP 637 #define F_GISTGETBITMAP 638 #define F_I8TOF 652 #define F_FTOI8 653 #define F_NAMELT 655 #define F_NAMELE 656 #define F_NAMEGT 657 #define F_NAMEGE 658 #define F_NAMENE 659 #define F_BPCHAR 668 #define F_VARCHAR 669 #define F_MKTINTERVAL 676 #define F_OIDVECTORLT 677 #define F_OIDVECTORLE 678 #define F_OIDVECTOREQ 679 #define F_OIDVECTORGE 680 #define F_OIDVECTORGT 681 #define F_NETWORK_NETWORK 683 #define F_NETWORK_NETMASK 696 #define F_NETWORK_MASKLEN 697 #define F_NETWORK_BROADCAST 698 #define F_NETWORK_HOST 699 #define F_CURRENT_USER 710 #define F_NETWORK_FAMILY 711 #define F_INT82 714 #define F_LO_CREATE 715 #define F_OIDLT 716 #define F_OIDLE 717 #define F_BYTEAOCTETLEN 720 #define F_BYTEAGETBYTE 721 #define F_BYTEASETBYTE 722 #define F_BYTEAGETBIT 723 #define F_BYTEASETBIT 724 #define F_DIST_PL 725 #define F_DIST_LB 726 #define F_DIST_SL 727 #define F_DIST_CPOLY 728 #define F_POLY_DISTANCE 729 #define F_NETWORK_SHOW 730 #define F_TEXT_LT 740 #define F_TEXT_LE 741 #define F_TEXT_GT 742 #define F_TEXT_GE 743 #define F_ARRAY_EQ 744 #define F_SESSION_USER 746 #define F_ARRAY_DIMS 747 #define F_ARRAY_NDIMS 748 #define F_BYTEAOVERLAY 749 #define F_ARRAY_IN 750 #define F_ARRAY_OUT 751 #define F_BYTEAOVERLAY_NO_LEN 752 #define F_MACADDR_TRUNC 753 #define F_INT28 754 #define F_SMGRIN 760 #define F_SMGROUT 761 #define F_SMGREQ 762 #define F_SMGRNE 763 #define F_LO_IMPORT 764 #define F_LO_EXPORT 765 #define F_INT4INC 766 #define F_LO_IMPORT_WITH_OID 767 #define F_INT4LARGER 768 #define F_INT4SMALLER 769 #define F_INT2LARGER 770 #define F_INT2SMALLER 771 #define F_GISTCOSTESTIMATE 772 #define F_GISTGETTUPLE 774 #define F_GISTINSERT 775 #define F_GISTBULKDELETE 776 #define F_GISTBEGINSCAN 777 #define F_GISTRESCAN 778 #define F_GISTENDSCAN 779 #define F_GISTMARKPOS 780 #define F_GISTRESTRPOS 781 #define F_GISTBUILD 782 #define F_TINTERVALEQ 784 #define F_TINTERVALNE 785 #define F_TINTERVALLT 786 #define F_TINTERVALGT 787 #define F_TINTERVALLE 788 #define F_TINTERVALGE 789 #define F_PG_CLIENT_ENCODING 810 #define F_CURRENT_QUERY 817 #define F_MACADDR_EQ 830 #define F_MACADDR_LT 831 #define F_MACADDR_LE 832 #define F_MACADDR_GT 833 #define F_MACADDR_GE 834 #define F_MACADDR_NE 835 #define F_MACADDR_CMP 836 #define F_INT82PL 837 #define F_INT82MI 838 #define F_INT82MUL 839 #define F_INT82DIV 840 #define F_INT28PL 841 #define F_BTINT8CMP 842 #define F_CASH_MUL_FLT4 846 #define F_CASH_DIV_FLT4 847 #define F_FLT4_MUL_CASH 848 #define F_TEXTPOS 849 #define F_TEXTLIKE 850 #define F_TEXTNLIKE 851 #define F_INT48EQ 852 #define F_INT48NE 853 #define F_INT48LT 854 #define F_INT48GT 855 #define F_INT48LE 856 #define F_INT48GE 857 #define F_NAMELIKE 858 #define F_NAMENLIKE 859 #define F_CHAR_BPCHAR 860 #define F_CURRENT_DATABASE 861 #define F_INT4_MUL_CASH 862 #define F_INT2_MUL_CASH 863 #define F_CASH_MUL_INT4 864 #define F_CASH_DIV_INT4 865 #define F_CASH_MUL_INT2 866 #define F_CASH_DIV_INT2 867 #define F_LOWER 870 #define F_UPPER 871 #define F_INITCAP 872 #define F_LPAD 873 #define F_RPAD 874 #define F_LTRIM 875 #define F_RTRIM 876 #define F_TEXT_SUBSTR 877 #define F_TRANSLATE 878 #define F_LTRIM1 881 #define F_TEXT_SUBSTR_NO_LEN 883 #define F_BTRIM 884 #define F_BTRIM1 885 #define F_CASH_IN 886 #define F_CASH_OUT 887 #define F_CASH_EQ 888 #define F_CASH_NE 889 #define F_CASH_LT 890 #define F_CASH_LE 891 #define F_CASH_GT 892 #define F_CASH_GE 893 #define F_CASH_PL 894 #define F_CASH_MI 895 #define F_CASH_MUL_FLT8 896 #define F_CASH_DIV_FLT8 897 #define F_CASHLARGER 898 #define F_CASHSMALLER 899 #define F_INET_IN 910 #define F_INET_OUT 911 #define F_FLT8_MUL_CASH 919 #define F_NETWORK_EQ 920 #define F_NETWORK_LT 921 #define F_NETWORK_LE 922 #define F_NETWORK_GT 923 #define F_NETWORK_GE 924 #define F_NETWORK_NE 925 #define F_NETWORK_CMP 926 #define F_NETWORK_SUB 927 #define F_NETWORK_SUBEQ 928 #define F_NETWORK_SUP 929 #define F_NETWORK_SUPEQ 930 #define F_CASH_WORDS 935 #define F_GENERATE_SERIES_TIMESTAMP 938 #define F_GENERATE_SERIES_TIMESTAMPTZ 939 #define F_INT28MI 942 #define F_INT28MUL 943 #define F_TEXT_CHAR 944 #define F_INT8MOD 945 #define F_CHAR_TEXT 946 #define F_INT28DIV 948 #define F_HASHINT8 949 #define F_LO_OPEN 952 #define F_LO_CLOSE 953 #define F_LOREAD 954 #define F_LOWRITE 955 #define F_LO_LSEEK 956 #define F_LO_CREAT 957 #define F_LO_TELL 958 #define F_ON_PL 959 #define F_ON_SL 960 #define F_CLOSE_PL 961 #define F_CLOSE_SL 962 #define F_CLOSE_LB 963 #define F_LO_UNLINK 964 #define F_BTVACUUMCLEANUP 972 #define F_PATH_INTER 973 #define F_BOX_AREA 975 #define F_BOX_WIDTH 976 #define F_BOX_HEIGHT 977 #define F_BOX_DISTANCE 978 #define F_PATH_AREA 979 #define F_BOX_INTERSECT 980 #define F_BOX_DIAGONAL 981 #define F_PATH_N_LT 982 #define F_PATH_N_GT 983 #define F_PATH_N_EQ 984 #define F_PATH_N_LE 985 #define F_PATH_N_GE 986 #define F_PATH_LENGTH 987 #define F_POINT_NE 988 #define F_POINT_VERT 989 #define F_POINT_HORIZ 990 #define F_POINT_DISTANCE 991 #define F_POINT_SLOPE 992 #define F_LSEG_CONSTRUCT 993 #define F_LSEG_INTERSECT 994 #define F_LSEG_PARALLEL 995 #define F_LSEG_PERP 996 #define F_LSEG_VERTICAL 997 #define F_LSEG_HORIZONTAL 998 #define F_LSEG_EQ 999 #define F_LO_TRUNCATE 1004 #define F_TIMESTAMPTZ_IZONE 1026 #define F_GIST_POINT_COMPRESS 1030 #define F_ACLITEMIN 1031 #define F_ACLITEMOUT 1032 #define F_ACLINSERT 1035 #define F_ACLREMOVE 1036 #define F_ACLCONTAINS 1037 #define F_GETDATABASEENCODING 1039 #define F_BPCHARIN 1044 #define F_BPCHAROUT 1045 #define F_VARCHARIN 1046 #define F_VARCHAROUT 1047 #define F_BPCHAREQ 1048 #define F_BPCHARLT 1049 #define F_BPCHARLE 1050 #define F_BPCHARGT 1051 #define F_BPCHARGE 1052 #define F_BPCHARNE 1053 #define F_ACLITEM_EQ 1062 #define F_BPCHAR_LARGER 1063 #define F_BPCHAR_SMALLER 1064 #define F_PG_PREPARED_XACT 1065 #define F_GENERATE_SERIES_STEP_INT4 1066 #define F_GENERATE_SERIES_INT4 1067 #define F_GENERATE_SERIES_STEP_INT8 1068 #define F_GENERATE_SERIES_INT8 1069 #define F_BPCHARCMP 1078 #define F_TEXT_REGCLASS 1079 #define F_HASHBPCHAR 1080 #define F_FORMAT_TYPE 1081 #define F_DATE_IN 1084 #define F_DATE_OUT 1085 #define F_DATE_EQ 1086 #define F_DATE_LT 1087 #define F_DATE_LE 1088 #define F_DATE_GT 1089 #define F_DATE_GE 1090 #define F_DATE_NE 1091 #define F_DATE_CMP 1092 #define F_TIME_LT 1102 #define F_TIME_LE 1103 #define F_TIME_GT 1104 #define F_TIME_GE 1105 #define F_TIME_NE 1106 #define F_TIME_CMP 1107 #define F_DATE_LARGER 1138 #define F_DATE_SMALLER 1139 #define F_DATE_MI 1140 #define F_DATE_PLI 1141 #define F_DATE_MII 1142 #define F_TIME_IN 1143 #define F_TIME_OUT 1144 #define F_TIME_EQ 1145 #define F_CIRCLE_ADD_PT 1146 #define F_CIRCLE_SUB_PT 1147 #define F_CIRCLE_MUL_PT 1148 #define F_CIRCLE_DIV_PT 1149 #define F_TIMESTAMPTZ_IN 1150 #define F_TIMESTAMPTZ_OUT 1151 #define F_TIMESTAMP_EQ 1152 #define F_TIMESTAMP_NE 1153 #define F_TIMESTAMP_LT 1154 #define F_TIMESTAMP_LE 1155 #define F_TIMESTAMP_GE 1156 #define F_TIMESTAMP_GT 1157 #define F_TIMESTAMPTZ_ZONE 1159 #define F_INTERVAL_IN 1160 #define F_INTERVAL_OUT 1161 #define F_INTERVAL_EQ 1162 #define F_INTERVAL_NE 1163 #define F_INTERVAL_LT 1164 #define F_INTERVAL_LE 1165 #define F_INTERVAL_GE 1166 #define F_INTERVAL_GT 1167 #define F_INTERVAL_UM 1168 #define F_INTERVAL_PL 1169 #define F_INTERVAL_MI 1170 #define F_TIMESTAMPTZ_PART 1171 #define F_INTERVAL_PART 1172 #define F_ABSTIME_TIMESTAMPTZ 1173 #define F_DATE_TIMESTAMPTZ 1174 #define F_INTERVAL_JUSTIFY_HOURS 1175 #define F_RELTIME_INTERVAL 1177 #define F_TIMESTAMPTZ_DATE 1178 #define F_ABSTIME_DATE 1179 #define F_TIMESTAMPTZ_ABSTIME 1180 #define F_XID_AGE 1181 #define F_TIMESTAMP_MI 1188 #define F_TIMESTAMPTZ_PL_INTERVAL 1189 #define F_TIMESTAMPTZ_MI_INTERVAL 1190 #define F_GENERATE_SUBSCRIPTS 1191 #define F_GENERATE_SUBSCRIPTS_NODIR 1192 #define F_ARRAY_FILL 1193 #define F_INTERVAL_RELTIME 1194 #define F_TIMESTAMP_SMALLER 1195 #define F_TIMESTAMP_LARGER 1196 #define F_INTERVAL_SMALLER 1197 #define F_INTERVAL_LARGER 1198 #define F_TIMESTAMPTZ_AGE 1199 #define F_INTERVAL_SCALE 1200 #define F_TIMESTAMPTZ_TRUNC 1217 #define F_INTERVAL_TRUNC 1218 #define F_INT8INC 1219 #define F_INT8ABS 1230 #define F_INT8LARGER 1236 #define F_INT8SMALLER 1237 #define F_TEXTICREGEXEQ 1238 #define F_TEXTICREGEXNE 1239 #define F_NAMEICREGEXEQ 1240 #define F_NAMEICREGEXNE 1241 #define F_BOOLIN 1242 #define F_BOOLOUT 1243 #define F_BYTEAIN 1244 #define F_CHARIN 1245 #define F_CHARLT 1246 #define F_UNIQUE_KEY_RECHECK 1250 #define F_INT4ABS 1251 #define F_NAMEREGEXNE 1252 #define F_INT2ABS 1253 #define F_TEXTREGEXEQ 1254 #define F_TEXTREGEXNE 1256 #define F_TEXTLEN 1257 #define F_TEXTCAT 1258 #define F_PG_CHAR_TO_ENCODING 1264 #define F_TIDNE 1265 #define F_CIDR_IN 1267 #define F_BTCOSTESTIMATE 1268 #define F_PG_COLUMN_SIZE 1269 #define F_OVERLAPS_TIMETZ 1271 #define F_DATETIME_TIMESTAMP 1272 #define F_TIMETZ_PART 1273 #define F_INT84PL 1274 #define F_INT84MI 1275 #define F_INT84MUL 1276 #define F_INT84DIV 1277 #define F_INT48PL 1278 #define F_INT48MI 1279 #define F_INT48MUL 1280 #define F_INT48DIV 1281 #define F_QUOTE_IDENT 1282 #define F_QUOTE_LITERAL 1283 #define F_ARRAY_FILL_WITH_LOWER_BOUNDS 1286 #define F_I8TOOID 1287 #define F_OIDTOI8 1288 #define F_QUOTE_NULLABLE 1289 #define F_SUPPRESS_REDUNDANT_UPDATES_TRIGGER 1291 #define F_TIDEQ 1292 #define F_CURRTID_BYRELOID 1293 #define F_CURRTID_BYRELNAME 1294 #define F_INTERVAL_JUSTIFY_DAYS 1295 #define F_DATETIMETZ_TIMESTAMPTZ 1297 #define F_NOW 1299 #define F_POSITIONSEL 1300 #define F_POSITIONJOINSEL 1301 #define F_CONTSEL 1302 #define F_CONTJOINSEL 1303 #define F_OVERLAPS_TIMESTAMP 1304 #define F_OVERLAPS_TIME 1308 #define F_TIMESTAMP_IN 1312 #define F_TIMESTAMP_OUT 1313 #define F_TIMESTAMP_CMP 1314 #define F_INTERVAL_CMP 1315 #define F_TIMESTAMP_TIME 1316 #define F_BPCHARLEN 1318 #define F_INTERVAL_DIV 1326 #define F_DLOG10 1339 #define F_OIDVECTORTYPES 1349 #define F_TIMETZ_IN 1350 #define F_TIMETZ_OUT 1351 #define F_TIMETZ_EQ 1352 #define F_TIMETZ_NE 1353 #define F_TIMETZ_LT 1354 #define F_TIMETZ_LE 1355 #define F_TIMETZ_GE 1356 #define F_TIMETZ_GT 1357 #define F_TIMETZ_CMP 1358 #define F_NETWORK_HOSTMASK 1362 #define F_MAKEACLITEM 1365 #define F_TIME_INTERVAL 1370 #define F_PG_LOCK_STATUS 1371 #define F_DATE_FINITE 1373 #define F_TEXTOCTETLEN 1374 #define F_BPCHAROCTETLEN 1375 #define F_TIME_LARGER 1377 #define F_TIME_SMALLER 1378 #define F_TIMETZ_LARGER 1379 #define F_TIMETZ_SMALLER 1380 #define F_TIME_PART 1385 #define F_PG_GET_CONSTRAINTDEF 1387 #define F_TIMESTAMPTZ_TIMETZ 1388 #define F_TIMESTAMP_FINITE 1389 #define F_INTERVAL_FINITE 1390 #define F_PG_STAT_GET_BACKEND_START 1391 #define F_PG_STAT_GET_BACKEND_CLIENT_ADDR 1392 #define F_PG_STAT_GET_BACKEND_CLIENT_PORT 1393 #define F_CURRENT_SCHEMA 1402 #define F_CURRENT_SCHEMAS 1403 #define F_TEXTOVERLAY 1404 #define F_TEXTOVERLAY_NO_LEN 1405 #define F_LINE_PARALLEL 1412 #define F_LINE_PERP 1413 #define F_LINE_VERTICAL 1414 #define F_LINE_HORIZONTAL 1415 #define F_CIRCLE_CENTER 1416 #define F_INTERVAL_TIME 1419 #define F_POINTS_BOX 1421 #define F_BOX_ADD 1422 #define F_BOX_SUB 1423 #define F_BOX_MUL 1424 #define F_BOX_DIV 1425 #define F_CIDR_OUT 1427 #define F_POLY_CONTAIN_PT 1428 #define F_PT_CONTAINED_POLY 1429 #define F_PATH_ISCLOSED 1430 #define F_PATH_ISOPEN 1431 #define F_PATH_NPOINTS 1432 #define F_PATH_CLOSE 1433 #define F_PATH_OPEN 1434 #define F_PATH_ADD 1435 #define F_PATH_ADD_PT 1436 #define F_PATH_SUB_PT 1437 #define F_PATH_MUL_PT 1438 #define F_PATH_DIV_PT 1439 #define F_CONSTRUCT_POINT 1440 #define F_POINT_ADD 1441 #define F_POINT_SUB 1442 #define F_POINT_MUL 1443 #define F_POINT_DIV 1444 #define F_POLY_NPOINTS 1445 #define F_POLY_BOX 1446 #define F_POLY_PATH 1447 #define F_BOX_POLY 1448 #define F_PATH_POLY 1449 #define F_CIRCLE_IN 1450 #define F_CIRCLE_OUT 1451 #define F_CIRCLE_SAME 1452 #define F_CIRCLE_CONTAIN 1453 #define F_CIRCLE_LEFT 1454 #define F_CIRCLE_OVERLEFT 1455 #define F_CIRCLE_OVERRIGHT 1456 #define F_CIRCLE_RIGHT 1457 #define F_CIRCLE_CONTAINED 1458 #define F_CIRCLE_OVERLAP 1459 #define F_CIRCLE_BELOW 1460 #define F_CIRCLE_ABOVE 1461 #define F_CIRCLE_EQ 1462 #define F_CIRCLE_NE 1463 #define F_CIRCLE_LT 1464 #define F_CIRCLE_GT 1465 #define F_CIRCLE_LE 1466 #define F_CIRCLE_GE 1467 #define F_CIRCLE_AREA 1468 #define F_CIRCLE_DIAMETER 1469 #define F_CIRCLE_RADIUS 1470 #define F_CIRCLE_DISTANCE 1471 #define F_CR_CIRCLE 1473 #define F_POLY_CIRCLE 1474 #define F_CIRCLE_POLY 1475 #define F_DIST_PC 1476 #define F_CIRCLE_CONTAIN_PT 1477 #define F_PT_CONTAINED_CIRCLE 1478 #define F_BOX_CIRCLE 1479 #define F_CIRCLE_BOX 1480 #define F_LSEG_NE 1482 #define F_LSEG_LT 1483 #define F_LSEG_LE 1484 #define F_LSEG_GT 1485 #define F_LSEG_GE 1486 #define F_LSEG_LENGTH 1487 #define F_CLOSE_LS 1488 #define F_CLOSE_LSEG 1489 #define F_LINE_IN 1490 #define F_LINE_OUT 1491 #define F_LINE_EQ 1492 #define F_LINE_CONSTRUCT_PP 1493 #define F_LINE_INTERPT 1494 #define F_LINE_INTERSECT 1495 #define F_BIT_IN 1564 #define F_BIT_OUT 1565 #define F_PG_GET_RULEDEF 1573 #define F_NEXTVAL_OID 1574 #define F_CURRVAL_OID 1575 #define F_SETVAL_OID 1576 #define F_VARBIT_IN 1579 #define F_VARBIT_OUT 1580 #define F_BITEQ 1581 #define F_BITNE 1582 #define F_BITGE 1592 #define F_BITGT 1593 #define F_BITLE 1594 #define F_BITLT 1595 #define F_BITCMP 1596 #define F_PG_ENCODING_TO_CHAR 1597 #define F_DRANDOM 1598 #define F_SETSEED 1599 #define F_DASIN 1600 #define F_DACOS 1601 #define F_DATAN 1602 #define F_DATAN2 1603 #define F_DSIN 1604 #define F_DCOS 1605 #define F_DTAN 1606 #define F_DCOT 1607 #define F_DEGREES 1608 #define F_RADIANS 1609 #define F_DPI 1610 #define F_INTERVAL_MUL 1618 #define F_PG_TYPEOF 1619 #define F_ASCII 1620 #define F_CHR 1621 #define F_REPEAT 1622 #define F_SIMILAR_ESCAPE 1623 #define F_MUL_D_INTERVAL 1624 #define F_TEXTICLIKE 1633 #define F_TEXTICNLIKE 1634 #define F_NAMEICLIKE 1635 #define F_NAMEICNLIKE 1636 #define F_LIKE_ESCAPE 1637 #define F_OIDGT 1638 #define F_OIDGE 1639 #define F_PG_GET_VIEWDEF_NAME 1640 #define F_PG_GET_VIEWDEF 1641 #define F_PG_GET_USERBYID 1642 #define F_PG_GET_INDEXDEF 1643 #define F_RI_FKEY_CHECK_INS 1644 #define F_RI_FKEY_CHECK_UPD 1645 #define F_RI_FKEY_CASCADE_DEL 1646 #define F_RI_FKEY_CASCADE_UPD 1647 #define F_RI_FKEY_RESTRICT_DEL 1648 #define F_RI_FKEY_RESTRICT_UPD 1649 #define F_RI_FKEY_SETNULL_DEL 1650 #define F_RI_FKEY_SETNULL_UPD 1651 #define F_RI_FKEY_SETDEFAULT_DEL 1652 #define F_RI_FKEY_SETDEFAULT_UPD 1653 #define F_RI_FKEY_NOACTION_DEL 1654 #define F_RI_FKEY_NOACTION_UPD 1655 #define F_PG_GET_TRIGGERDEF 1662 #define F_PG_GET_SERIAL_SEQUENCE 1665 #define F_BIT_AND 1673 #define F_BIT_OR 1674 #define F_BITXOR 1675 #define F_BITNOT 1676 #define F_BITSHIFTLEFT 1677 #define F_BITSHIFTRIGHT 1678 #define F_BITCAT 1679 #define F_BITSUBSTR 1680 #define F_BITLENGTH 1681 #define F_BITOCTETLENGTH 1682 #define F_BITFROMINT4 1683 #define F_BITTOINT4 1684 #define F_BIT 1685 #define F_PG_GET_KEYWORDS 1686 #define F_VARBIT 1687 #define F_TIME_HASH 1688 #define F_ACLEXPLODE 1689 #define F_TIME_MI_TIME 1690 #define F_BOOLLE 1691 #define F_BOOLGE 1692 #define F_BTBOOLCMP 1693 #define F_TIMETZ_HASH 1696 #define F_INTERVAL_HASH 1697 #define F_BITPOSITION 1698 #define F_BITSUBSTR_NO_LEN 1699 #define F_NUMERIC_IN 1701 #define F_NUMERIC_OUT 1702 #define F_NUMERIC 1703 #define F_NUMERIC_ABS 1704 #define F_NUMERIC_SIGN 1706 #define F_NUMERIC_ROUND 1707 #define F_NUMERIC_TRUNC 1709 #define F_NUMERIC_CEIL 1711 #define F_NUMERIC_FLOOR 1712 #define F_LENGTH_IN_ENCODING 1713 #define F_PG_CONVERT_FROM 1714 #define F_INET_TO_CIDR 1715 #define F_PG_GET_EXPR 1716 #define F_PG_CONVERT_TO 1717 #define F_NUMERIC_EQ 1718 #define F_NUMERIC_NE 1719 #define F_NUMERIC_GT 1720 #define F_NUMERIC_GE 1721 #define F_NUMERIC_LT 1722 #define F_NUMERIC_LE 1723 #define F_NUMERIC_ADD 1724 #define F_NUMERIC_SUB 1725 #define F_NUMERIC_MUL 1726 #define F_NUMERIC_DIV 1727 #define F_NUMERIC_MOD 1728 #define F_NUMERIC_SQRT 1730 #define F_NUMERIC_EXP 1732 #define F_NUMERIC_LN 1734 #define F_NUMERIC_LOG 1736 #define F_NUMERIC_POWER 1738 #define F_INT4_NUMERIC 1740 #define F_FLOAT4_NUMERIC 1742 #define F_FLOAT8_NUMERIC 1743 #define F_NUMERIC_INT4 1744 #define F_NUMERIC_FLOAT4 1745 #define F_NUMERIC_FLOAT8 1746 #define F_TIME_PL_INTERVAL 1747 #define F_TIME_MI_INTERVAL 1748 #define F_TIMETZ_PL_INTERVAL 1749 #define F_TIMETZ_MI_INTERVAL 1750 #define F_NUMERIC_INC 1764 #define F_SETVAL3_OID 1765 #define F_NUMERIC_SMALLER 1766 #define F_NUMERIC_LARGER 1767 #define F_INTERVAL_TO_CHAR 1768 #define F_NUMERIC_CMP 1769 #define F_TIMESTAMPTZ_TO_CHAR 1770 #define F_NUMERIC_UMINUS 1771 #define F_NUMERIC_TO_CHAR 1772 #define F_INT4_TO_CHAR 1773 #define F_INT8_TO_CHAR 1774 #define F_FLOAT4_TO_CHAR 1775 #define F_FLOAT8_TO_CHAR 1776 #define F_NUMERIC_TO_NUMBER 1777 #define F_TO_TIMESTAMP 1778 #define F_NUMERIC_INT8 1779 #define F_TO_DATE 1780 #define F_INT8_NUMERIC 1781 #define F_INT2_NUMERIC 1782 #define F_NUMERIC_INT2 1783 #define F_OIDIN 1798 #define F_OIDOUT 1799 #define F_PG_CONVERT 1813 #define F_ICLIKESEL 1814 #define F_ICNLIKESEL 1815 #define F_ICLIKEJOINSEL 1816 #define F_ICNLIKEJOINSEL 1817 #define F_REGEXEQSEL 1818 #define F_LIKESEL 1819 #define F_ICREGEXEQSEL 1820 #define F_REGEXNESEL 1821 #define F_NLIKESEL 1822 #define F_ICREGEXNESEL 1823 #define F_REGEXEQJOINSEL 1824 #define F_LIKEJOINSEL 1825 #define F_ICREGEXEQJOINSEL 1826 #define F_REGEXNEJOINSEL 1827 #define F_NLIKEJOINSEL 1828 #define F_ICREGEXNEJOINSEL 1829 #define F_FLOAT8_AVG 1830 #define F_FLOAT8_VAR_SAMP 1831 #define F_FLOAT8_STDDEV_SAMP 1832 #define F_NUMERIC_ACCUM 1833 #define F_INT2_ACCUM 1834 #define F_INT4_ACCUM 1835 #define F_INT8_ACCUM 1836 #define F_NUMERIC_AVG 1837 #define F_NUMERIC_VAR_SAMP 1838 #define F_NUMERIC_STDDEV_SAMP 1839 #define F_INT2_SUM 1840 #define F_INT4_SUM 1841 #define F_INT8_SUM 1842 #define F_INTERVAL_ACCUM 1843 #define F_INTERVAL_AVG 1844 #define F_TO_ASCII_DEFAULT 1845 #define F_TO_ASCII_ENC 1846 #define F_TO_ASCII_ENCNAME 1847 #define F_INT28EQ 1850 #define F_INT28NE 1851 #define F_INT28LT 1852 #define F_INT28GT 1853 #define F_INT28LE 1854 #define F_INT28GE 1855 #define F_INT82EQ 1856 #define F_INT82NE 1857 #define F_INT82LT 1858 #define F_INT82GT 1859 #define F_INT82LE 1860 #define F_INT82GE 1861 #define F_INT2AND 1892 #define F_INT2OR 1893 #define F_INT2XOR 1894 #define F_INT2NOT 1895 #define F_INT2SHL 1896 #define F_INT2SHR 1897 #define F_INT4AND 1898 #define F_INT4OR 1899 #define F_INT4XOR 1900 #define F_INT4NOT 1901 #define F_INT4SHL 1902 #define F_INT4SHR 1903 #define F_INT8AND 1904 #define F_INT8OR 1905 #define F_INT8XOR 1906 #define F_INT8NOT 1907 #define F_INT8SHL 1908 #define F_INT8SHR 1909 #define F_INT8UP 1910 #define F_INT2UP 1911 #define F_INT4UP 1912 #define F_FLOAT4UP 1913 #define F_FLOAT8UP 1914 #define F_NUMERIC_UPLUS 1915 #define F_HAS_TABLE_PRIVILEGE_NAME_NAME 1922 #define F_HAS_TABLE_PRIVILEGE_NAME_ID 1923 #define F_HAS_TABLE_PRIVILEGE_ID_NAME 1924 #define F_HAS_TABLE_PRIVILEGE_ID_ID 1925 #define F_HAS_TABLE_PRIVILEGE_NAME 1926 #define F_HAS_TABLE_PRIVILEGE_ID 1927 #define F_PG_STAT_GET_NUMSCANS 1928 #define F_PG_STAT_GET_TUPLES_RETURNED 1929 #define F_PG_STAT_GET_TUPLES_FETCHED 1930 #define F_PG_STAT_GET_TUPLES_INSERTED 1931 #define F_PG_STAT_GET_TUPLES_UPDATED 1932 #define F_PG_STAT_GET_TUPLES_DELETED 1933 #define F_PG_STAT_GET_BLOCKS_FETCHED 1934 #define F_PG_STAT_GET_BLOCKS_HIT 1935 #define F_PG_STAT_GET_BACKEND_IDSET 1936 #define F_PG_STAT_GET_BACKEND_PID 1937 #define F_PG_STAT_GET_BACKEND_DBID 1938 #define F_PG_STAT_GET_BACKEND_USERID 1939 #define F_PG_STAT_GET_BACKEND_ACTIVITY 1940 #define F_PG_STAT_GET_DB_NUMBACKENDS 1941 #define F_PG_STAT_GET_DB_XACT_COMMIT 1942 #define F_PG_STAT_GET_DB_XACT_ROLLBACK 1943 #define F_PG_STAT_GET_DB_BLOCKS_FETCHED 1944 #define F_PG_STAT_GET_DB_BLOCKS_HIT 1945 #define F_BINARY_ENCODE 1946 #define F_BINARY_DECODE 1947 #define F_BYTEAEQ 1948 #define F_BYTEALT 1949 #define F_BYTEALE 1950 #define F_BYTEAGT 1951 #define F_BYTEAGE 1952 #define F_BYTEANE 1953 #define F_BYTEACMP 1954 #define F_TIMESTAMP_SCALE 1961 #define F_INT2_AVG_ACCUM 1962 #define F_INT4_AVG_ACCUM 1963 #define F_INT8_AVG 1964 #define F_OIDLARGER 1965 #define F_OIDSMALLER 1966 #define F_TIMESTAMPTZ_SCALE 1967 #define F_TIME_SCALE 1968 #define F_TIMETZ_SCALE 1969 #define F_PG_STAT_GET_TUPLES_HOT_UPDATED 1972 #define F_NUMERIC_DIV_TRUNC 1973 #define F_BYTEALIKE 2005 #define F_BYTEANLIKE 2006 #define F_LIKE_ESCAPE_BYTEA 2009 #define F_BYTEACAT 2011 #define F_BYTEA_SUBSTR 2012 #define F_BYTEA_SUBSTR_NO_LEN 2013 #define F_BYTEAPOS 2014 #define F_BYTEATRIM 2015 #define F_TIMESTAMPTZ_TIME 2019 #define F_TIMESTAMP_TRUNC 2020 #define F_TIMESTAMP_PART 2021 #define F_PG_STAT_GET_ACTIVITY 2022 #define F_ABSTIME_TIMESTAMP 2023 #define F_DATE_TIMESTAMP 2024 #define F_PG_BACKEND_PID 2026 #define F_TIMESTAMPTZ_TIMESTAMP 2027 #define F_TIMESTAMP_TIMESTAMPTZ 2028 #define F_TIMESTAMP_DATE 2029 #define F_TIMESTAMP_ABSTIME 2030 #define F_TIMESTAMP_PL_INTERVAL 2032 #define F_TIMESTAMP_MI_INTERVAL 2033 #define F_PG_CONF_LOAD_TIME 2034 #define F_TIMETZ_ZONE 2037 #define F_TIMETZ_IZONE 2038 #define F_TIMESTAMP_HASH 2039 #define F_TIMETZ_TIME 2046 #define F_TIME_TIMETZ 2047 #define F_TIMESTAMP_TO_CHAR 2049 #define F_AGGREGATE_DUMMY 2050 #define F_TIMESTAMP_AGE 2058 #define F_TIMESTAMP_ZONE 2069 #define F_TIMESTAMP_IZONE 2070 #define F_DATE_PL_INTERVAL 2071 #define F_DATE_MI_INTERVAL 2072 #define F_TEXTREGEXSUBSTR 2073 #define F_BITFROMINT8 2075 #define F_BITTOINT8 2076 #define F_SHOW_CONFIG_BY_NAME 2077 #define F_SET_CONFIG_BY_NAME 2078 #define F_PG_TABLE_IS_VISIBLE 2079 #define F_PG_TYPE_IS_VISIBLE 2080 #define F_PG_FUNCTION_IS_VISIBLE 2081 #define F_PG_OPERATOR_IS_VISIBLE 2082 #define F_PG_OPCLASS_IS_VISIBLE 2083 #define F_SHOW_ALL_SETTINGS 2084 #define F_REPLACE_TEXT 2087 #define F_SPLIT_TEXT 2088 #define F_TO_HEX32 2089 #define F_TO_HEX64 2090 #define F_ARRAY_LOWER 2091 #define F_ARRAY_UPPER 2092 #define F_PG_CONVERSION_IS_VISIBLE 2093 #define F_PG_STAT_GET_BACKEND_ACTIVITY_START 2094 #define F_PG_TERMINATE_BACKEND 2096 #define F_PG_GET_FUNCTIONDEF 2098 #define F_TEXT_PATTERN_LT 2160 #define F_TEXT_PATTERN_LE 2161 #define F_PG_GET_FUNCTION_ARGUMENTS 2162 #define F_TEXT_PATTERN_GE 2163 #define F_TEXT_PATTERN_GT 2164 #define F_PG_GET_FUNCTION_RESULT 2165 #define F_BTTEXT_PATTERN_CMP 2166 #define F_PG_DATABASE_SIZE_NAME 2168 #define F_WIDTH_BUCKET_NUMERIC 2170 #define F_PG_CANCEL_BACKEND 2171 #define F_PG_START_BACKUP 2172 #define F_PG_STOP_BACKUP 2173 #define F_BPCHAR_PATTERN_LT 2174 #define F_BPCHAR_PATTERN_LE 2175 #define F_ARRAY_LENGTH 2176 #define F_BPCHAR_PATTERN_GE 2177 #define F_BPCHAR_PATTERN_GT 2178 #define F_GIST_POINT_CONSISTENT 2179 #define F_BTBPCHAR_PATTERN_CMP 2180 #define F_HAS_SEQUENCE_PRIVILEGE_NAME_NAME 2181 #define F_HAS_SEQUENCE_PRIVILEGE_NAME_ID 2182 #define F_HAS_SEQUENCE_PRIVILEGE_ID_NAME 2183 #define F_HAS_SEQUENCE_PRIVILEGE_ID_ID 2184 #define F_HAS_SEQUENCE_PRIVILEGE_NAME 2185 #define F_HAS_SEQUENCE_PRIVILEGE_ID 2186 #define F_BTINT48CMP 2188 #define F_BTINT84CMP 2189 #define F_BTINT24CMP 2190 #define F_BTINT42CMP 2191 #define F_BTINT28CMP 2192 #define F_BTINT82CMP 2193 #define F_BTFLOAT48CMP 2194 #define F_BTFLOAT84CMP 2195 #define F_INET_CLIENT_ADDR 2196 #define F_INET_CLIENT_PORT 2197 #define F_INET_SERVER_ADDR 2198 #define F_INET_SERVER_PORT 2199 #define F_REGPROCEDUREIN 2212 #define F_REGPROCEDUREOUT 2213 #define F_REGOPERIN 2214 #define F_REGOPEROUT 2215 #define F_REGOPERATORIN 2216 #define F_REGOPERATOROUT 2217 #define F_REGCLASSIN 2218 #define F_REGCLASSOUT 2219 #define F_REGTYPEIN 2220 #define F_REGTYPEOUT 2221 #define F_PG_STAT_CLEAR_SNAPSHOT 2230 #define F_PG_GET_FUNCTION_IDENTITY_ARGUMENTS 2232 #define F_FMGR_INTERNAL_VALIDATOR 2246 #define F_FMGR_C_VALIDATOR 2247 #define F_FMGR_SQL_VALIDATOR 2248 #define F_HAS_DATABASE_PRIVILEGE_NAME_NAME 2250 #define F_HAS_DATABASE_PRIVILEGE_NAME_ID 2251 #define F_HAS_DATABASE_PRIVILEGE_ID_NAME 2252 #define F_HAS_DATABASE_PRIVILEGE_ID_ID 2253 #define F_HAS_DATABASE_PRIVILEGE_NAME 2254 #define F_HAS_DATABASE_PRIVILEGE_ID 2255 #define F_HAS_FUNCTION_PRIVILEGE_NAME_NAME 2256 #define F_HAS_FUNCTION_PRIVILEGE_NAME_ID 2257 #define F_HAS_FUNCTION_PRIVILEGE_ID_NAME 2258 #define F_HAS_FUNCTION_PRIVILEGE_ID_ID 2259 #define F_HAS_FUNCTION_PRIVILEGE_NAME 2260 #define F_HAS_FUNCTION_PRIVILEGE_ID 2261 #define F_HAS_LANGUAGE_PRIVILEGE_NAME_NAME 2262 #define F_HAS_LANGUAGE_PRIVILEGE_NAME_ID 2263 #define F_HAS_LANGUAGE_PRIVILEGE_ID_NAME 2264 #define F_HAS_LANGUAGE_PRIVILEGE_ID_ID 2265 #define F_HAS_LANGUAGE_PRIVILEGE_NAME 2266 #define F_HAS_LANGUAGE_PRIVILEGE_ID 2267 #define F_HAS_SCHEMA_PRIVILEGE_NAME_NAME 2268 #define F_HAS_SCHEMA_PRIVILEGE_NAME_ID 2269 #define F_HAS_SCHEMA_PRIVILEGE_ID_NAME 2270 #define F_HAS_SCHEMA_PRIVILEGE_ID_ID 2271 #define F_HAS_SCHEMA_PRIVILEGE_NAME 2272 #define F_HAS_SCHEMA_PRIVILEGE_ID 2273 #define F_PG_STAT_RESET 2274 #define F_TEXTREGEXREPLACE_NOOPT 2284 #define F_TEXTREGEXREPLACE 2285 #define F_PG_TOTAL_RELATION_SIZE 2286 #define F_PG_SIZE_PRETTY 2288 #define F_PG_OPTIONS_TO_TABLE 2289 #define F_RECORD_IN 2290 #define F_RECORD_OUT 2291 #define F_CSTRING_IN 2292 #define F_CSTRING_OUT 2293 #define F_ANY_IN 2294 #define F_ANY_OUT 2295 #define F_ANYARRAY_IN 2296 #define F_ANYARRAY_OUT 2297 #define F_VOID_IN 2298 #define F_VOID_OUT 2299 #define F_TRIGGER_IN 2300 #define F_TRIGGER_OUT 2301 #define F_LANGUAGE_HANDLER_IN 2302 #define F_LANGUAGE_HANDLER_OUT 2303 #define F_INTERNAL_IN 2304 #define F_INTERNAL_OUT 2305 #define F_OPAQUE_IN 2306 #define F_OPAQUE_OUT 2307 #define F_DCEIL 2308 #define F_DFLOOR 2309 #define F_DSIGN 2310 #define F_MD5_TEXT 2311 #define F_ANYELEMENT_IN 2312 #define F_ANYELEMENT_OUT 2313 #define F_POSTGRESQL_FDW_VALIDATOR 2316 #define F_PG_ENCODING_MAX_LENGTH_SQL 2319 #define F_MD5_BYTEA 2321 #define F_PG_TABLESPACE_SIZE_OID 2322 #define F_PG_TABLESPACE_SIZE_NAME 2323 #define F_PG_DATABASE_SIZE_OID 2324 #define F_ARRAY_UNNEST 2331 #define F_PG_RELATION_SIZE 2332 #define F_ARRAY_AGG_TRANSFN 2333 #define F_ARRAY_AGG_FINALFN 2334 #define F_DATE_LT_TIMESTAMP 2338 #define F_DATE_LE_TIMESTAMP 2339 #define F_DATE_EQ_TIMESTAMP 2340 #define F_DATE_GT_TIMESTAMP 2341 #define F_DATE_GE_TIMESTAMP 2342 #define F_DATE_NE_TIMESTAMP 2343 #define F_DATE_CMP_TIMESTAMP 2344 #define F_DATE_LT_TIMESTAMPTZ 2351 #define F_DATE_LE_TIMESTAMPTZ 2352 #define F_DATE_EQ_TIMESTAMPTZ 2353 #define F_DATE_GT_TIMESTAMPTZ 2354 #define F_DATE_GE_TIMESTAMPTZ 2355 #define F_DATE_NE_TIMESTAMPTZ 2356 #define F_DATE_CMP_TIMESTAMPTZ 2357 #define F_TIMESTAMP_LT_DATE 2364 #define F_TIMESTAMP_LE_DATE 2365 #define F_TIMESTAMP_EQ_DATE 2366 #define F_TIMESTAMP_GT_DATE 2367 #define F_TIMESTAMP_GE_DATE 2368 #define F_TIMESTAMP_NE_DATE 2369 #define F_TIMESTAMP_CMP_DATE 2370 #define F_TIMESTAMPTZ_LT_DATE 2377 #define F_TIMESTAMPTZ_LE_DATE 2378 #define F_TIMESTAMPTZ_EQ_DATE 2379 #define F_TIMESTAMPTZ_GT_DATE 2380 #define F_TIMESTAMPTZ_GE_DATE 2381 #define F_TIMESTAMPTZ_NE_DATE 2382 #define F_TIMESTAMPTZ_CMP_DATE 2383 #define F_HAS_TABLESPACE_PRIVILEGE_NAME_NAME 2390 #define F_HAS_TABLESPACE_PRIVILEGE_NAME_ID 2391 #define F_HAS_TABLESPACE_PRIVILEGE_ID_NAME 2392 #define F_HAS_TABLESPACE_PRIVILEGE_ID_ID 2393 #define F_HAS_TABLESPACE_PRIVILEGE_NAME 2394 #define F_HAS_TABLESPACE_PRIVILEGE_ID 2395 #define F_SHELL_IN 2398 #define F_SHELL_OUT 2399 #define F_ARRAY_RECV 2400 #define F_ARRAY_SEND 2401 #define F_RECORD_RECV 2402 #define F_RECORD_SEND 2403 #define F_INT2RECV 2404 #define F_INT2SEND 2405 #define F_INT4RECV 2406 #define F_INT4SEND 2407 #define F_INT8RECV 2408 #define F_INT8SEND 2409 #define F_INT2VECTORRECV 2410 #define F_INT2VECTORSEND 2411 #define F_BYTEARECV 2412 #define F_BYTEASEND 2413 #define F_TEXTRECV 2414 #define F_TEXTSEND 2415 #define F_UNKNOWNRECV 2416 #define F_UNKNOWNSEND 2417 #define F_OIDRECV 2418 #define F_OIDSEND 2419 #define F_OIDVECTORRECV 2420 #define F_OIDVECTORSEND 2421 #define F_NAMERECV 2422 #define F_NAMESEND 2423 #define F_FLOAT4RECV 2424 #define F_FLOAT4SEND 2425 #define F_FLOAT8RECV 2426 #define F_FLOAT8SEND 2427 #define F_POINT_RECV 2428 #define F_POINT_SEND 2429 #define F_BPCHARRECV 2430 #define F_BPCHARSEND 2431 #define F_VARCHARRECV 2432 #define F_VARCHARSEND 2433 #define F_CHARRECV 2434 #define F_CHARSEND 2435 #define F_BOOLRECV 2436 #define F_BOOLSEND 2437 #define F_TIDRECV 2438 #define F_TIDSEND 2439 #define F_XIDRECV 2440 #define F_XIDSEND 2441 #define F_CIDRECV 2442 #define F_CIDSEND 2443 #define F_REGPROCRECV 2444 #define F_REGPROCSEND 2445 #define F_REGPROCEDURERECV 2446 #define F_REGPROCEDURESEND 2447 #define F_REGOPERRECV 2448 #define F_REGOPERSEND 2449 #define F_REGOPERATORRECV 2450 #define F_REGOPERATORSEND 2451 #define F_REGCLASSRECV 2452 #define F_REGCLASSSEND 2453 #define F_REGTYPERECV 2454 #define F_REGTYPESEND 2455 #define F_BIT_RECV 2456 #define F_BIT_SEND 2457 #define F_VARBIT_RECV 2458 #define F_VARBIT_SEND 2459 #define F_NUMERIC_RECV 2460 #define F_NUMERIC_SEND 2461 #define F_ABSTIMERECV 2462 #define F_ABSTIMESEND 2463 #define F_RELTIMERECV 2464 #define F_RELTIMESEND 2465 #define F_TINTERVALRECV 2466 #define F_TINTERVALSEND 2467 #define F_DATE_RECV 2468 #define F_DATE_SEND 2469 #define F_TIME_RECV 2470 #define F_TIME_SEND 2471 #define F_TIMETZ_RECV 2472 #define F_TIMETZ_SEND 2473 #define F_TIMESTAMP_RECV 2474 #define F_TIMESTAMP_SEND 2475 #define F_TIMESTAMPTZ_RECV 2476 #define F_TIMESTAMPTZ_SEND 2477 #define F_INTERVAL_RECV 2478 #define F_INTERVAL_SEND 2479 #define F_LSEG_RECV 2480 #define F_LSEG_SEND 2481 #define F_PATH_RECV 2482 #define F_PATH_SEND 2483 #define F_BOX_RECV 2484 #define F_BOX_SEND 2485 #define F_POLY_RECV 2486 #define F_POLY_SEND 2487 #define F_LINE_RECV 2488 #define F_LINE_SEND 2489 #define F_CIRCLE_RECV 2490 #define F_CIRCLE_SEND 2491 #define F_CASH_RECV 2492 #define F_CASH_SEND 2493 #define F_MACADDR_RECV 2494 #define F_MACADDR_SEND 2495 #define F_INET_RECV 2496 #define F_INET_SEND 2497 #define F_CIDR_RECV 2498 #define F_CIDR_SEND 2499 #define F_CSTRING_RECV 2500 #define F_CSTRING_SEND 2501 #define F_ANYARRAY_RECV 2502 #define F_ANYARRAY_SEND 2503 #define F_PG_GET_RULEDEF_EXT 2504 #define F_PG_GET_VIEWDEF_NAME_EXT 2505 #define F_PG_GET_VIEWDEF_EXT 2506 #define F_PG_GET_INDEXDEF_EXT 2507 #define F_PG_GET_CONSTRAINTDEF_EXT 2508 #define F_PG_GET_EXPR_EXT 2509 #define F_PG_PREPARED_STATEMENT 2510 #define F_PG_CURSOR 2511 #define F_FLOAT8_VAR_POP 2512 #define F_FLOAT8_STDDEV_POP 2513 #define F_NUMERIC_VAR_POP 2514 #define F_BOOLAND_STATEFUNC 2515 #define F_BOOLOR_STATEFUNC 2516 #define F_TIMESTAMP_LT_TIMESTAMPTZ 2520 #define F_TIMESTAMP_LE_TIMESTAMPTZ 2521 #define F_TIMESTAMP_EQ_TIMESTAMPTZ 2522 #define F_TIMESTAMP_GT_TIMESTAMPTZ 2523 #define F_TIMESTAMP_GE_TIMESTAMPTZ 2524 #define F_TIMESTAMP_NE_TIMESTAMPTZ 2525 #define F_TIMESTAMP_CMP_TIMESTAMPTZ 2526 #define F_TIMESTAMPTZ_LT_TIMESTAMP 2527 #define F_TIMESTAMPTZ_LE_TIMESTAMP 2528 #define F_TIMESTAMPTZ_EQ_TIMESTAMP 2529 #define F_TIMESTAMPTZ_GT_TIMESTAMP 2530 #define F_TIMESTAMPTZ_GE_TIMESTAMP 2531 #define F_TIMESTAMPTZ_NE_TIMESTAMP 2532 #define F_TIMESTAMPTZ_CMP_TIMESTAMP 2533 #define F_PG_TABLESPACE_DATABASES 2556 #define F_INT4_BOOL 2557 #define F_BOOL_INT4 2558 #define F_LASTVAL 2559 #define F_PG_POSTMASTER_START_TIME 2560 #define F_GISTVACUUMCLEANUP 2561 #define F_BOX_BELOW 2562 #define F_BOX_OVERBELOW 2563 #define F_BOX_OVERABOVE 2564 #define F_BOX_ABOVE 2565 #define F_POLY_BELOW 2566 #define F_POLY_OVERBELOW 2567 #define F_POLY_OVERABOVE 2568 #define F_POLY_ABOVE 2569 #define F_GIST_BOX_CONSISTENT 2578 #define F_GIST_BOX_COMPRESS 2579 #define F_GIST_BOX_DECOMPRESS 2580 #define F_GIST_BOX_PENALTY 2581 #define F_GIST_BOX_PICKSPLIT 2582 #define F_GIST_BOX_UNION 2583 #define F_GIST_BOX_SAME 2584 #define F_GIST_POLY_CONSISTENT 2585 #define F_GIST_POLY_COMPRESS 2586 #define F_CIRCLE_OVERBELOW 2587 #define F_CIRCLE_OVERABOVE 2588 #define F_GIST_CIRCLE_CONSISTENT 2591 #define F_GIST_CIRCLE_COMPRESS 2592 #define F_NUMERIC_STDDEV_POP 2596 #define F_DOMAIN_IN 2597 #define F_DOMAIN_RECV 2598 #define F_PG_TIMEZONE_ABBREVS 2599 #define F_XMLEXISTS 2614 #define F_PG_RELOAD_CONF 2621 #define F_PG_ROTATE_LOGFILE 2622 #define F_PG_STAT_FILE 2623 #define F_PG_READ_FILE 2624 #define F_PG_LS_DIR 2625 #define F_PG_SLEEP 2626 #define F_INETNOT 2627 #define F_INETAND 2628 #define F_INETOR 2629 #define F_INETPL 2630 #define F_INETMI_INT8 2632 #define F_INETMI 2633 #define F_STATEMENT_TIMESTAMP 2648 #define F_CLOCK_TIMESTAMP 2649 #define F_GIN_CMP_PREFIX 2700 #define F_PG_HAS_ROLE_NAME_NAME 2705 #define F_PG_HAS_ROLE_NAME_ID 2706 #define F_PG_HAS_ROLE_ID_NAME 2707 #define F_PG_HAS_ROLE_ID_ID 2708 #define F_PG_HAS_ROLE_NAME 2709 #define F_PG_HAS_ROLE_ID 2710 #define F_INTERVAL_JUSTIFY_INTERVAL 2711 #define F_PG_GET_TRIGGERDEF_EXT 2730 #define F_GINGETBITMAP 2731 #define F_GININSERT 2732 #define F_GINBEGINSCAN 2733 #define F_GINRESCAN 2734 #define F_GINENDSCAN 2735 #define F_GINMARKPOS 2736 #define F_GINRESTRPOS 2737 #define F_GINBUILD 2738 #define F_GINBULKDELETE 2739 #define F_GINVACUUMCLEANUP 2740 #define F_GINCOSTESTIMATE 2741 #define F_GINARRAYEXTRACT 2743 #define F_GINARRAYCONSISTENT 2744 #define F_INT8_AVG_ACCUM 2746 #define F_ARRAYOVERLAP 2747 #define F_ARRAYCONTAINS 2748 #define F_ARRAYCONTAINED 2749 #define F_PG_STAT_GET_DB_TUPLES_RETURNED 2758 #define F_PG_STAT_GET_DB_TUPLES_FETCHED 2759 #define F_PG_STAT_GET_DB_TUPLES_INSERTED 2760 #define F_PG_STAT_GET_DB_TUPLES_UPDATED 2761 #define F_PG_STAT_GET_DB_TUPLES_DELETED 2762 #define F_REGEXP_MATCHES_NO_FLAGS 2763 #define F_REGEXP_MATCHES 2764 #define F_REGEXP_SPLIT_TO_TABLE_NO_FLAGS 2765 #define F_REGEXP_SPLIT_TO_TABLE 2766 #define F_REGEXP_SPLIT_TO_ARRAY_NO_FLAGS 2767 #define F_REGEXP_SPLIT_TO_ARRAY 2768 #define F_PG_STAT_GET_BGWRITER_TIMED_CHECKPOINTS 2769 #define F_PG_STAT_GET_BGWRITER_REQUESTED_CHECKPOINTS 2770 #define F_PG_STAT_GET_BGWRITER_BUF_WRITTEN_CHECKPOINTS 2771 #define F_PG_STAT_GET_BGWRITER_BUF_WRITTEN_CLEAN 2772 #define F_PG_STAT_GET_BGWRITER_MAXWRITTEN_CLEAN 2773 #define F_GINQUERYARRAYEXTRACT 2774 #define F_PG_STAT_GET_BUF_WRITTEN_BACKEND 2775 #define F_ANYNONARRAY_IN 2777 #define F_ANYNONARRAY_OUT 2778 #define F_PG_STAT_GET_LAST_VACUUM_TIME 2781 #define F_PG_STAT_GET_LAST_AUTOVACUUM_TIME 2782 #define F_PG_STAT_GET_LAST_ANALYZE_TIME 2783 #define F_PG_STAT_GET_LAST_AUTOANALYZE_TIME 2784 #define F_BTOPTIONS 2785 #define F_HASHOPTIONS 2786 #define F_GISTOPTIONS 2787 #define F_GINOPTIONS 2788 #define F_TIDGT 2790 #define F_TIDLT 2791 #define F_TIDGE 2792 #define F_TIDLE 2793 #define F_BTTIDCMP 2794 #define F_TIDLARGER 2795 #define F_TIDSMALLER 2796 #define F_INT8INC_ANY 2804 #define F_INT8INC_FLOAT8_FLOAT8 2805 #define F_FLOAT8_REGR_ACCUM 2806 #define F_FLOAT8_REGR_SXX 2807 #define F_FLOAT8_REGR_SYY 2808 #define F_FLOAT8_REGR_SXY 2809 #define F_FLOAT8_REGR_AVGX 2810 #define F_FLOAT8_REGR_AVGY 2811 #define F_FLOAT8_REGR_R2 2812 #define F_FLOAT8_REGR_SLOPE 2813 #define F_FLOAT8_REGR_INTERCEPT 2814 #define F_FLOAT8_COVAR_POP 2815 #define F_FLOAT8_COVAR_SAMP 2816 #define F_FLOAT8_CORR 2817 #define F_PG_STAT_GET_DB_BLK_READ_TIME 2844 #define F_PG_STAT_GET_DB_BLK_WRITE_TIME 2845 #define F_PG_SWITCH_XLOG 2848 #define F_PG_CURRENT_XLOG_LOCATION 2849 #define F_PG_XLOGFILE_NAME_OFFSET 2850 #define F_PG_XLOGFILE_NAME 2851 #define F_PG_CURRENT_XLOG_INSERT_LOCATION 2852 #define F_PG_STAT_GET_BACKEND_WAITING 2853 #define F_PG_MY_TEMP_SCHEMA 2854 #define F_PG_IS_OTHER_TEMP_SCHEMA 2855 #define F_PG_TIMEZONE_NAMES 2856 #define F_PG_STAT_GET_BACKEND_XACT_START 2857 #define F_NUMERIC_AVG_ACCUM 2858 #define F_PG_STAT_GET_BUF_ALLOC 2859 #define F_PG_STAT_GET_LIVE_TUPLES 2878 #define F_PG_STAT_GET_DEAD_TUPLES 2879 #define F_PG_ADVISORY_LOCK_INT8 2880 #define F_PG_ADVISORY_LOCK_SHARED_INT8 2881 #define F_PG_TRY_ADVISORY_LOCK_INT8 2882 #define F_PG_TRY_ADVISORY_LOCK_SHARED_INT8 2883 #define F_PG_ADVISORY_UNLOCK_INT8 2884 #define F_PG_ADVISORY_UNLOCK_SHARED_INT8 2885 #define F_PG_ADVISORY_LOCK_INT4 2886 #define F_PG_ADVISORY_LOCK_SHARED_INT4 2887 #define F_PG_TRY_ADVISORY_LOCK_INT4 2888 #define F_PG_TRY_ADVISORY_LOCK_SHARED_INT4 2889 #define F_PG_ADVISORY_UNLOCK_INT4 2890 #define F_PG_ADVISORY_UNLOCK_SHARED_INT4 2891 #define F_PG_ADVISORY_UNLOCK_ALL 2892 #define F_XML_IN 2893 #define F_XML_OUT 2894 #define F_XMLCOMMENT 2895 #define F_TEXTTOXML 2896 #define F_XMLVALIDATE 2897 #define F_XML_RECV 2898 #define F_XML_SEND 2899 #define F_XMLCONCAT2 2900 #define F_VARBITTYPMODIN 2902 #define F_INTERVALTYPMODIN 2903 #define F_INTERVALTYPMODOUT 2904 #define F_TIMESTAMPTYPMODIN 2905 #define F_TIMESTAMPTYPMODOUT 2906 #define F_TIMESTAMPTZTYPMODIN 2907 #define F_TIMESTAMPTZTYPMODOUT 2908 #define F_TIMETYPMODIN 2909 #define F_TIMETYPMODOUT 2910 #define F_TIMETZTYPMODIN 2911 #define F_TIMETZTYPMODOUT 2912 #define F_BPCHARTYPMODIN 2913 #define F_BPCHARTYPMODOUT 2914 #define F_VARCHARTYPMODIN 2915 #define F_VARCHARTYPMODOUT 2916 #define F_NUMERICTYPMODIN 2917 #define F_NUMERICTYPMODOUT 2918 #define F_BITTYPMODIN 2919 #define F_BITTYPMODOUT 2920 #define F_VARBITTYPMODOUT 2921 #define F_XMLTOTEXT 2922 #define F_TABLE_TO_XML 2923 #define F_QUERY_TO_XML 2924 #define F_CURSOR_TO_XML 2925 #define F_TABLE_TO_XMLSCHEMA 2926 #define F_QUERY_TO_XMLSCHEMA 2927 #define F_CURSOR_TO_XMLSCHEMA 2928 #define F_TABLE_TO_XML_AND_XMLSCHEMA 2929 #define F_QUERY_TO_XML_AND_XMLSCHEMA 2930 #define F_XPATH 2931 #define F_SCHEMA_TO_XML 2933 #define F_SCHEMA_TO_XMLSCHEMA 2934 #define F_SCHEMA_TO_XML_AND_XMLSCHEMA 2935 #define F_DATABASE_TO_XML 2936 #define F_DATABASE_TO_XMLSCHEMA 2937 #define F_DATABASE_TO_XML_AND_XMLSCHEMA 2938 #define F_TXID_SNAPSHOT_IN 2939 #define F_TXID_SNAPSHOT_OUT 2940 #define F_TXID_SNAPSHOT_RECV 2941 #define F_TXID_SNAPSHOT_SEND 2942 #define F_TXID_CURRENT 2943 #define F_TXID_CURRENT_SNAPSHOT 2944 #define F_TXID_SNAPSHOT_XMIN 2945 #define F_TXID_SNAPSHOT_XMAX 2946 #define F_TXID_SNAPSHOT_XIP 2947 #define F_TXID_VISIBLE_IN_SNAPSHOT 2948 #define F_UUID_IN 2952 #define F_UUID_OUT 2953 #define F_UUID_LT 2954 #define F_UUID_LE 2955 #define F_UUID_EQ 2956 #define F_UUID_GE 2957 #define F_UUID_GT 2958 #define F_UUID_NE 2959 #define F_UUID_CMP 2960 #define F_UUID_RECV 2961 #define F_UUID_SEND 2962 #define F_UUID_HASH 2963 #define F_BOOLTEXT 2971 #define F_PG_STAT_GET_FUNCTION_CALLS 2978 #define F_PG_STAT_GET_FUNCTION_TOTAL_TIME 2979 #define F_PG_STAT_GET_FUNCTION_SELF_TIME 2980 #define F_RECORD_EQ 2981 #define F_RECORD_NE 2982 #define F_RECORD_LT 2983 #define F_RECORD_GT 2984 #define F_RECORD_LE 2985 #define F_RECORD_GE 2986 #define F_BTRECORDCMP 2987 #define F_PG_TABLE_SIZE 2997 #define F_PG_INDEXES_SIZE 2998 #define F_PG_RELATION_FILENODE 2999 #define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_NAME_NAME 3000 #define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_NAME_ID 3001 #define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_ID_NAME 3002 #define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_ID_ID 3003 #define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_NAME 3004 #define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_ID 3005 #define F_HAS_SERVER_PRIVILEGE_NAME_NAME 3006 #define F_HAS_SERVER_PRIVILEGE_NAME_ID 3007 #define F_HAS_SERVER_PRIVILEGE_ID_NAME 3008 #define F_HAS_SERVER_PRIVILEGE_ID_ID 3009 #define F_HAS_SERVER_PRIVILEGE_NAME 3010 #define F_HAS_SERVER_PRIVILEGE_ID 3011 #define F_HAS_COLUMN_PRIVILEGE_NAME_NAME_NAME 3012 #define F_HAS_COLUMN_PRIVILEGE_NAME_NAME_ATTNUM 3013 #define F_HAS_COLUMN_PRIVILEGE_NAME_ID_NAME 3014 #define F_HAS_COLUMN_PRIVILEGE_NAME_ID_ATTNUM 3015 #define F_HAS_COLUMN_PRIVILEGE_ID_NAME_NAME 3016 #define F_HAS_COLUMN_PRIVILEGE_ID_NAME_ATTNUM 3017 #define F_HAS_COLUMN_PRIVILEGE_ID_ID_NAME 3018 #define F_HAS_COLUMN_PRIVILEGE_ID_ID_ATTNUM 3019 #define F_HAS_COLUMN_PRIVILEGE_NAME_NAME 3020 #define F_HAS_COLUMN_PRIVILEGE_NAME_ATTNUM 3021 #define F_HAS_COLUMN_PRIVILEGE_ID_NAME 3022 #define F_HAS_COLUMN_PRIVILEGE_ID_ATTNUM 3023 #define F_HAS_ANY_COLUMN_PRIVILEGE_NAME_NAME 3024 #define F_HAS_ANY_COLUMN_PRIVILEGE_NAME_ID 3025 #define F_HAS_ANY_COLUMN_PRIVILEGE_ID_NAME 3026 #define F_HAS_ANY_COLUMN_PRIVILEGE_ID_ID 3027 #define F_HAS_ANY_COLUMN_PRIVILEGE_NAME 3028 #define F_HAS_ANY_COLUMN_PRIVILEGE_ID 3029 #define F_BITOVERLAY 3030 #define F_BITOVERLAY_NO_LEN 3031 #define F_BITGETBIT 3032 #define F_BITSETBIT 3033 #define F_PG_RELATION_FILEPATH 3034 #define F_PG_LISTENING_CHANNELS 3035 #define F_PG_NOTIFY 3036 #define F_PG_STAT_GET_XACT_NUMSCANS 3037 #define F_PG_STAT_GET_XACT_TUPLES_RETURNED 3038 #define F_PG_STAT_GET_XACT_TUPLES_FETCHED 3039 #define F_PG_STAT_GET_XACT_TUPLES_INSERTED 3040 #define F_PG_STAT_GET_XACT_TUPLES_UPDATED 3041 #define F_PG_STAT_GET_XACT_TUPLES_DELETED 3042 #define F_PG_STAT_GET_XACT_TUPLES_HOT_UPDATED 3043 #define F_PG_STAT_GET_XACT_BLOCKS_FETCHED 3044 #define F_PG_STAT_GET_XACT_BLOCKS_HIT 3045 #define F_PG_STAT_GET_XACT_FUNCTION_CALLS 3046 #define F_PG_STAT_GET_XACT_FUNCTION_TOTAL_TIME 3047 #define F_PG_STAT_GET_XACT_FUNCTION_SELF_TIME 3048 #define F_XPATH_EXISTS 3049 #define F_XML_IS_WELL_FORMED 3051 #define F_XML_IS_WELL_FORMED_DOCUMENT 3052 #define F_XML_IS_WELL_FORMED_CONTENT 3053 #define F_PG_STAT_GET_VACUUM_COUNT 3054 #define F_PG_STAT_GET_AUTOVACUUM_COUNT 3055 #define F_PG_STAT_GET_ANALYZE_COUNT 3056 #define F_PG_STAT_GET_AUTOANALYZE_COUNT 3057 #define F_TEXT_CONCAT 3058 #define F_TEXT_CONCAT_WS 3059 #define F_TEXT_LEFT 3060 #define F_TEXT_RIGHT 3061 #define F_TEXT_REVERSE 3062 #define F_PG_STAT_GET_BUF_FSYNC_BACKEND 3063 #define F_GIST_POINT_DISTANCE 3064 #define F_PG_STAT_GET_DB_CONFLICT_TABLESPACE 3065 #define F_PG_STAT_GET_DB_CONFLICT_LOCK 3066 #define F_PG_STAT_GET_DB_CONFLICT_SNAPSHOT 3067 #define F_PG_STAT_GET_DB_CONFLICT_BUFFERPIN 3068 #define F_PG_STAT_GET_DB_CONFLICT_STARTUP_DEADLOCK 3069 #define F_PG_STAT_GET_DB_CONFLICT_ALL 3070 #define F_PG_XLOG_REPLAY_PAUSE 3071 #define F_PG_XLOG_REPLAY_RESUME 3072 #define F_PG_IS_XLOG_REPLAY_PAUSED 3073 #define F_PG_STAT_GET_DB_STAT_RESET_TIME 3074 #define F_PG_STAT_GET_BGWRITER_STAT_RESET_TIME 3075 #define F_GINARRAYEXTRACT_2ARGS 3076 #define F_GIN_EXTRACT_TSVECTOR_2ARGS 3077 #define F_PG_SEQUENCE_PARAMETERS 3078 #define F_PG_AVAILABLE_EXTENSIONS 3082 #define F_PG_AVAILABLE_EXTENSION_VERSIONS 3083 #define F_PG_EXTENSION_UPDATE_PATHS 3084 #define F_PG_EXTENSION_CONFIG_DUMP 3086 #define F_GIN_EXTRACT_TSQUERY_5ARGS 3087 #define F_GIN_TSQUERY_CONSISTENT_6ARGS 3088 #define F_PG_ADVISORY_XACT_LOCK_INT8 3089 #define F_PG_ADVISORY_XACT_LOCK_SHARED_INT8 3090 #define F_PG_TRY_ADVISORY_XACT_LOCK_INT8 3091 #define F_PG_TRY_ADVISORY_XACT_LOCK_SHARED_INT8 3092 #define F_PG_ADVISORY_XACT_LOCK_INT4 3093 #define F_PG_ADVISORY_XACT_LOCK_SHARED_INT4 3094 #define F_PG_TRY_ADVISORY_XACT_LOCK_INT4 3095 #define F_PG_TRY_ADVISORY_XACT_LOCK_SHARED_INT4 3096 #define F_VARCHAR_TRANSFORM 3097 #define F_PG_CREATE_RESTORE_POINT 3098 #define F_PG_STAT_GET_WAL_SENDERS 3099 #define F_WINDOW_ROW_NUMBER 3100 #define F_WINDOW_RANK 3101 #define F_WINDOW_DENSE_RANK 3102 #define F_WINDOW_PERCENT_RANK 3103 #define F_WINDOW_CUME_DIST 3104 #define F_WINDOW_NTILE 3105 #define F_WINDOW_LAG 3106 #define F_WINDOW_LAG_WITH_OFFSET 3107 #define F_WINDOW_LAG_WITH_OFFSET_AND_DEFAULT 3108 #define F_WINDOW_LEAD 3109 #define F_WINDOW_LEAD_WITH_OFFSET 3110 #define F_WINDOW_LEAD_WITH_OFFSET_AND_DEFAULT 3111 #define F_WINDOW_FIRST_VALUE 3112 #define F_WINDOW_LAST_VALUE 3113 #define F_WINDOW_NTH_VALUE 3114 #define F_FDW_HANDLER_IN 3116 #define F_FDW_HANDLER_OUT 3117 #define F_VOID_RECV 3120 #define F_VOID_SEND 3121 #define F_BTINT2SORTSUPPORT 3129 #define F_BTINT4SORTSUPPORT 3130 #define F_BTINT8SORTSUPPORT 3131 #define F_BTFLOAT4SORTSUPPORT 3132 #define F_BTFLOAT8SORTSUPPORT 3133 #define F_BTOIDSORTSUPPORT 3134 #define F_BTNAMESORTSUPPORT 3135 #define F_DATE_SORTSUPPORT 3136 #define F_TIMESTAMP_SORTSUPPORT 3137 #define F_HAS_TYPE_PRIVILEGE_NAME_NAME 3138 #define F_HAS_TYPE_PRIVILEGE_NAME_ID 3139 #define F_HAS_TYPE_PRIVILEGE_ID_NAME 3140 #define F_HAS_TYPE_PRIVILEGE_ID_ID 3141 #define F_HAS_TYPE_PRIVILEGE_NAME 3142 #define F_HAS_TYPE_PRIVILEGE_ID 3143 #define F_MACADDR_NOT 3144 #define F_MACADDR_AND 3145 #define F_MACADDR_OR 3146 #define F_PG_STAT_GET_DB_TEMP_FILES 3150 #define F_PG_STAT_GET_DB_TEMP_BYTES 3151 #define F_PG_STAT_GET_DB_DEADLOCKS 3152 #define F_ARRAY_TO_JSON 3153 #define F_ARRAY_TO_JSON_PRETTY 3154 #define F_ROW_TO_JSON 3155 #define F_ROW_TO_JSON_PRETTY 3156 #define F_NUMERIC_TRANSFORM 3157 #define F_VARBIT_TRANSFORM 3158 #define F_PG_GET_VIEWDEF_WRAP 3159 #define F_PG_STAT_GET_CHECKPOINT_WRITE_TIME 3160 #define F_PG_STAT_GET_CHECKPOINT_SYNC_TIME 3161 #define F_PG_COLLATION_FOR 3162 #define F_PG_TRIGGER_DEPTH 3163 #define F_PG_XLOG_LOCATION_DIFF 3165 #define F_PG_SIZE_PRETTY_NUMERIC 3166 #define F_ANYENUM_IN 3504 #define F_ANYENUM_OUT 3505 #define F_ENUM_IN 3506 #define F_ENUM_OUT 3507 #define F_ENUM_EQ 3508 #define F_ENUM_NE 3509 #define F_ENUM_LT 3510 #define F_ENUM_GT 3511 #define F_ENUM_LE 3512 #define F_ENUM_GE 3513 #define F_ENUM_CMP 3514 #define F_HASHENUM 3515 #define F_ENUM_SMALLER 3524 #define F_ENUM_LARGER 3525 #define F_ENUM_FIRST 3528 #define F_ENUM_LAST 3529 #define F_ENUM_RANGE_BOUNDS 3530 #define F_ENUM_RANGE_ALL 3531 #define F_ENUM_RECV 3532 #define F_ENUM_SEND 3533 #define F_STRING_AGG_TRANSFN 3535 #define F_STRING_AGG_FINALFN 3536 #define F_PG_DESCRIBE_OBJECT 3537 #define F_TEXT_FORMAT 3539 #define F_TEXT_FORMAT_NV 3540 #define F_BYTEA_STRING_AGG_TRANSFN 3543 #define F_BYTEA_STRING_AGG_FINALFN 3544 #define F_TSVECTORIN 3610 #define F_TSVECTOROUT 3611 #define F_TSQUERYIN 3612 #define F_TSQUERYOUT 3613 #define F_TSVECTOR_LT 3616 #define F_TSVECTOR_LE 3617 #define F_TSVECTOR_EQ 3618 #define F_TSVECTOR_NE 3619 #define F_TSVECTOR_GE 3620 #define F_TSVECTOR_GT 3621 #define F_TSVECTOR_CMP 3622 #define F_TSVECTOR_STRIP 3623 #define F_TSVECTOR_SETWEIGHT 3624 #define F_TSVECTOR_CONCAT 3625 #define F_TS_MATCH_VQ 3634 #define F_TS_MATCH_QV 3635 #define F_TSVECTORSEND 3638 #define F_TSVECTORRECV 3639 #define F_TSQUERYSEND 3640 #define F_TSQUERYRECV 3641 #define F_GTSVECTORIN 3646 #define F_GTSVECTOROUT 3647 #define F_GTSVECTOR_COMPRESS 3648 #define F_GTSVECTOR_DECOMPRESS 3649 #define F_GTSVECTOR_PICKSPLIT 3650 #define F_GTSVECTOR_UNION 3651 #define F_GTSVECTOR_SAME 3652 #define F_GTSVECTOR_PENALTY 3653 #define F_GTSVECTOR_CONSISTENT 3654 #define F_GIN_EXTRACT_TSVECTOR 3656 #define F_GIN_EXTRACT_TSQUERY 3657 #define F_GIN_TSQUERY_CONSISTENT 3658 #define F_TSQUERY_LT 3662 #define F_TSQUERY_LE 3663 #define F_TSQUERY_EQ 3664 #define F_TSQUERY_NE 3665 #define F_TSQUERY_GE 3666 #define F_TSQUERY_GT 3667 #define F_TSQUERY_CMP 3668 #define F_TSQUERY_AND 3669 #define F_TSQUERY_OR 3670 #define F_TSQUERY_NOT 3671 #define F_TSQUERY_NUMNODE 3672 #define F_TSQUERYTREE 3673 #define F_TSQUERY_REWRITE 3684 #define F_TSQUERY_REWRITE_QUERY 3685 #define F_TSMATCHSEL 3686 #define F_TSMATCHJOINSEL 3687 #define F_TS_TYPANALYZE 3688 #define F_TS_STAT1 3689 #define F_TS_STAT2 3690 #define F_TSQ_MCONTAINS 3691 #define F_TSQ_MCONTAINED 3692 #define F_GTSQUERY_COMPRESS 3695 #define F_GTSQUERY_DECOMPRESS 3696 #define F_GTSQUERY_PICKSPLIT 3697 #define F_GTSQUERY_UNION 3698 #define F_GTSQUERY_SAME 3699 #define F_GTSQUERY_PENALTY 3700 #define F_GTSQUERY_CONSISTENT 3701 #define F_TS_RANK_WTTF 3703 #define F_TS_RANK_WTT 3704 #define F_TS_RANK_TTF 3705 #define F_TS_RANK_TT 3706 #define F_TS_RANKCD_WTTF 3707 #define F_TS_RANKCD_WTT 3708 #define F_TS_RANKCD_TTF 3709 #define F_TS_RANKCD_TT 3710 #define F_TSVECTOR_LENGTH 3711 #define F_TS_TOKEN_TYPE_BYID 3713 #define F_TS_TOKEN_TYPE_BYNAME 3714 #define F_TS_PARSE_BYID 3715 #define F_TS_PARSE_BYNAME 3716 #define F_PRSD_START 3717 #define F_PRSD_NEXTTOKEN 3718 #define F_PRSD_END 3719 #define F_PRSD_HEADLINE 3720 #define F_PRSD_LEXTYPE 3721 #define F_TS_LEXIZE 3723 #define F_GIN_CMP_TSLEXEME 3724 #define F_DSIMPLE_INIT 3725 #define F_DSIMPLE_LEXIZE 3726 #define F_DSYNONYM_INIT 3728 #define F_DSYNONYM_LEXIZE 3729 #define F_DISPELL_INIT 3731 #define F_DISPELL_LEXIZE 3732 #define F_REGCONFIGIN 3736 #define F_REGCONFIGOUT 3737 #define F_REGCONFIGRECV 3738 #define F_REGCONFIGSEND 3739 #define F_THESAURUS_INIT 3740 #define F_THESAURUS_LEXIZE 3741 #define F_TS_HEADLINE_BYID_OPT 3743 #define F_TS_HEADLINE_BYID 3744 #define F_TO_TSVECTOR_BYID 3745 #define F_TO_TSQUERY_BYID 3746 #define F_PLAINTO_TSQUERY_BYID 3747 #define F_TO_TSVECTOR 3749 #define F_TO_TSQUERY 3750 #define F_PLAINTO_TSQUERY 3751 #define F_TSVECTOR_UPDATE_TRIGGER_BYID 3752 #define F_TSVECTOR_UPDATE_TRIGGER_BYCOLUMN 3753 #define F_TS_HEADLINE_OPT 3754 #define F_TS_HEADLINE 3755 #define F_PG_TS_PARSER_IS_VISIBLE 3756 #define F_PG_TS_DICT_IS_VISIBLE 3757 #define F_PG_TS_CONFIG_IS_VISIBLE 3758 #define F_GET_CURRENT_TS_CONFIG 3759 #define F_TS_MATCH_TT 3760 #define F_TS_MATCH_TQ 3761 #define F_PG_TS_TEMPLATE_IS_VISIBLE 3768 #define F_REGDICTIONARYIN 3771 #define F_REGDICTIONARYOUT 3772 #define F_REGDICTIONARYRECV 3773 #define F_REGDICTIONARYSEND 3774 #define F_PG_STAT_RESET_SHARED 3775 #define F_PG_STAT_RESET_SINGLE_TABLE_COUNTERS 3776 #define F_PG_STAT_RESET_SINGLE_FUNCTION_COUNTERS 3777 #define F_PG_TABLESPACE_LOCATION 3778 #define F_PG_EXPORT_SNAPSHOT 3809 #define F_PG_IS_IN_RECOVERY 3810 #define F_INT4_CASH 3811 #define F_INT8_CASH 3812 #define F_PG_COLLATION_IS_VISIBLE 3815 #define F_ARRAY_TYPANALYZE 3816 #define F_ARRAYCONTSEL 3817 #define F_ARRAYCONTJOINSEL 3818 #define F_PG_LAST_XLOG_RECEIVE_LOCATION 3820 #define F_PG_LAST_XLOG_REPLAY_LOCATION 3821 #define F_CASH_DIV_CASH 3822 #define F_CASH_NUMERIC 3823 #define F_NUMERIC_CASH 3824 #define F_PG_READ_FILE_ALL 3826 #define F_PG_READ_BINARY_FILE 3827 #define F_PG_READ_BINARY_FILE_ALL 3828 #define F_PG_OPFAMILY_IS_VISIBLE 3829 #define F_PG_LAST_XACT_REPLAY_TIMESTAMP 3830 #define F_ANYRANGE_IN 3832 #define F_ANYRANGE_OUT 3833 #define F_RANGE_IN 3834 #define F_RANGE_OUT 3835 #define F_RANGE_RECV 3836 #define F_RANGE_SEND 3837 #define F_RANGE_CONSTRUCTOR2 3840 #define F_RANGE_CONSTRUCTOR3 3841 #define F_RANGE_LOWER 3848 #define F_RANGE_UPPER 3849 #define F_RANGE_EMPTY 3850 #define F_RANGE_LOWER_INC 3851 #define F_RANGE_UPPER_INC 3852 #define F_RANGE_LOWER_INF 3853 #define F_RANGE_UPPER_INF 3854 #define F_RANGE_EQ 3855 #define F_RANGE_NE 3856 #define F_RANGE_OVERLAPS 3857 #define F_RANGE_CONTAINS_ELEM 3858 #define F_RANGE_CONTAINS 3859 #define F_ELEM_CONTAINED_BY_RANGE 3860 #define F_RANGE_CONTAINED_BY 3861 #define F_RANGE_ADJACENT 3862 #define F_RANGE_BEFORE 3863 #define F_RANGE_AFTER 3864 #define F_RANGE_OVERLEFT 3865 #define F_RANGE_OVERRIGHT 3866 #define F_RANGE_UNION 3867 #define F_RANGE_INTERSECT 3868 #define F_RANGE_MINUS 3869 #define F_RANGE_CMP 3870 #define F_RANGE_LT 3871 #define F_RANGE_LE 3872 #define F_RANGE_GE 3873 #define F_RANGE_GT 3874 #define F_RANGE_GIST_CONSISTENT 3875 #define F_RANGE_GIST_UNION 3876 #define F_RANGE_GIST_COMPRESS 3877 #define F_RANGE_GIST_DECOMPRESS 3878 #define F_RANGE_GIST_PENALTY 3879 #define F_RANGE_GIST_PICKSPLIT 3880 #define F_RANGE_GIST_SAME 3881 #define F_HASH_RANGE 3902 #define F_INT4RANGE_CANONICAL 3914 #define F_DATERANGE_CANONICAL 3915 #define F_RANGE_TYPANALYZE 3916 #define F_TIMESTAMP_TRANSFORM 3917 #define F_INTERVAL_TRANSFORM 3918 #define F_INT4RANGE_SUBDIFF 3922 #define F_INT8RANGE_SUBDIFF 3923 #define F_NUMRANGE_SUBDIFF 3924 #define F_DATERANGE_SUBDIFF 3925 #define F_INT8RANGE_CANONICAL 3928 #define F_TSRANGE_SUBDIFF 3929 #define F_TSTZRANGE_SUBDIFF 3930 #define F_ACLDEFAULT_SQL 3943 #define F_TIME_TRANSFORM 3944 #define F_SPGGETTUPLE 4001 #define F_SPGGETBITMAP 4002 #define F_SPGINSERT 4003 #define F_SPGBEGINSCAN 4004 #define F_SPGRESCAN 4005 #define F_SPGENDSCAN 4006 #define F_SPGMARKPOS 4007 #define F_SPGRESTRPOS 4008 #define F_SPGBUILD 4009 #define F_SPGBUILDEMPTY 4010 #define F_SPGBULKDELETE 4011 #define F_SPGVACUUMCLEANUP 4012 #define F_SPGCOSTESTIMATE 4013 #define F_SPGOPTIONS 4014 #define F_SPG_QUAD_CONFIG 4018 #define F_SPG_QUAD_CHOOSE 4019 #define F_SPG_QUAD_PICKSPLIT 4020 #define F_SPG_QUAD_INNER_CONSISTENT 4021 #define F_SPG_QUAD_LEAF_CONSISTENT 4022 #define F_SPG_KD_CONFIG 4023 #define F_SPG_KD_CHOOSE 4024 #define F_SPG_KD_PICKSPLIT 4025 #define F_SPG_KD_INNER_CONSISTENT 4026 #define F_SPG_TEXT_CONFIG 4027 #define F_SPG_TEXT_CHOOSE 4028 #define F_SPG_TEXT_PICKSPLIT 4029 #define F_SPG_TEXT_INNER_CONSISTENT 4030 #define F_SPG_TEXT_LEAF_CONSISTENT 4031 #define F_SPGCANRETURN 4032 #endif /* FMGROIDS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/array.h��������������������������������������������������������������������������0000644�����������������00000025735�14763166026�0011656 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * array.h * Declarations for Postgres arrays. * * A standard varlena array has the following internal structure: * <vl_len_> - standard varlena header word * <ndim> - number of dimensions of the array * <dataoffset> - offset to stored data, or 0 if no nulls bitmap * <elemtype> - element type OID * <dimensions> - length of each array axis (C array of int) * <lower bnds> - lower boundary of each dimension (C array of int) * <null bitmap> - bitmap showing locations of nulls (OPTIONAL) * <actual data> - whatever is the stored data * * The <dimensions> and <lower bnds> arrays each have ndim elements. * * The <null bitmap> may be omitted if the array contains no NULL elements. * If it is absent, the <dataoffset> field is zero and the offset to the * stored data must be computed on-the-fly. If the bitmap is present, * <dataoffset> is nonzero and is equal to the offset from the array start * to the first data element (including any alignment padding). The bitmap * follows the same conventions as tuple null bitmaps, ie, a 1 indicates * a non-null entry and the LSB of each bitmap byte is used first. * * The actual data starts on a MAXALIGN boundary. Individual items in the * array are aligned as specified by the array element type. They are * stored in row-major order (last subscript varies most rapidly). * * NOTE: it is important that array elements of toastable datatypes NOT be * toasted, since the tupletoaster won't know they are there. (We could * support compressed toasted items; only out-of-line items are dangerous. * However, it seems preferable to store such items uncompressed and allow * the toaster to compress the whole array as one input.) * * * The OIDVECTOR and INT2VECTOR datatypes are storage-compatible with * generic arrays, but they support only one-dimensional arrays with no * nulls (and no null bitmap). * * There are also some "fixed-length array" datatypes, such as NAME and * POINT. These are simply a sequence of a fixed number of items each * of a fixed-length datatype, with no overhead; the item size must be * a multiple of its alignment requirement, because we do no padding. * We support subscripting on these types, but array_in() and array_out() * only work with varlena arrays. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/array.h * *------------------------------------------------------------------------- */ #ifndef ARRAY_H #define ARRAY_H #include "fmgr.h" /* * Maximum number of elements in an array. We limit this to at most about a * quarter billion elements, so that it's not necessary to check for overflow * in quite so many places --- for instance when palloc'ing Datum arrays. */ #define MaxArraySize ((Size) (MaxAllocSize / sizeof(Datum))) /* * Arrays are varlena objects, so must meet the varlena convention that * the first int32 of the object contains the total object size in bytes. * Be sure to use VARSIZE() and SET_VARSIZE() to access it, though! * * CAUTION: if you change the header for ordinary arrays you will also * need to change the headers for oidvector and int2vector! */ typedef struct { int32 vl_len_; /* varlena header (do not touch directly!) */ int ndim; /* # of dimensions */ int32 dataoffset; /* offset to data, or 0 if no bitmap */ Oid elemtype; /* element type OID */ } ArrayType; /* * working state for accumArrayResult() and friends */ typedef struct ArrayBuildState { MemoryContext mcontext; /* where all the temp stuff is kept */ Datum *dvalues; /* array of accumulated Datums */ bool *dnulls; /* array of is-null flags for Datums */ int alen; /* allocated length of above arrays */ int nelems; /* number of valid entries in above arrays */ Oid element_type; /* data type of the Datums */ int16 typlen; /* needed info about datatype */ bool typbyval; char typalign; } ArrayBuildState; /* * structure to cache type metadata needed for array manipulation */ typedef struct ArrayMetaState { Oid element_type; int16 typlen; bool typbyval; char typalign; char typdelim; Oid typioparam; Oid typiofunc; FmgrInfo proc; } ArrayMetaState; /* * private state needed by array_map (here because caller must provide it) */ typedef struct ArrayMapState { ArrayMetaState inp_extra; ArrayMetaState ret_extra; } ArrayMapState; /* ArrayIteratorData is private in arrayfuncs.c */ typedef struct ArrayIteratorData *ArrayIterator; /* * fmgr macros for array objects */ #define DatumGetArrayTypeP(X) ((ArrayType *) PG_DETOAST_DATUM(X)) #define DatumGetArrayTypePCopy(X) ((ArrayType *) PG_DETOAST_DATUM_COPY(X)) #define PG_GETARG_ARRAYTYPE_P(n) DatumGetArrayTypeP(PG_GETARG_DATUM(n)) #define PG_GETARG_ARRAYTYPE_P_COPY(n) DatumGetArrayTypePCopy(PG_GETARG_DATUM(n)) #define PG_RETURN_ARRAYTYPE_P(x) PG_RETURN_POINTER(x) /* * Access macros for array header fields. * * ARR_DIMS returns a pointer to an array of array dimensions (number of * elements along the various array axes). * * ARR_LBOUND returns a pointer to an array of array lower bounds. * * That is: if the third axis of an array has elements 5 through 8, then * ARR_DIMS(a)[2] == 4 and ARR_LBOUND(a)[2] == 5. * * Unlike C, the default lower bound is 1. */ #define ARR_SIZE(a) VARSIZE(a) #define ARR_NDIM(a) ((a)->ndim) #define ARR_HASNULL(a) ((a)->dataoffset != 0) #define ARR_ELEMTYPE(a) ((a)->elemtype) #define ARR_DIMS(a) \ ((int *) (((char *) (a)) + sizeof(ArrayType))) #define ARR_LBOUND(a) \ ((int *) (((char *) (a)) + sizeof(ArrayType) + \ sizeof(int) * ARR_NDIM(a))) #define ARR_NULLBITMAP(a) \ (ARR_HASNULL(a) ? \ (bits8 *) (((char *) (a)) + sizeof(ArrayType) + \ 2 * sizeof(int) * ARR_NDIM(a)) \ : (bits8 *) NULL) /* * The total array header size (in bytes) for an array with the specified * number of dimensions and total number of items. */ #define ARR_OVERHEAD_NONULLS(ndims) \ MAXALIGN(sizeof(ArrayType) + 2 * sizeof(int) * (ndims)) #define ARR_OVERHEAD_WITHNULLS(ndims, nitems) \ MAXALIGN(sizeof(ArrayType) + 2 * sizeof(int) * (ndims) + \ ((nitems) + 7) / 8) #define ARR_DATA_OFFSET(a) \ (ARR_HASNULL(a) ? (a)->dataoffset : ARR_OVERHEAD_NONULLS(ARR_NDIM(a))) /* * Returns a pointer to the actual array data. */ #define ARR_DATA_PTR(a) \ (((char *) (a)) + ARR_DATA_OFFSET(a)) /* * GUC parameter */ extern bool Array_nulls; /* * prototypes for functions defined in arrayfuncs.c */ extern Datum array_in(PG_FUNCTION_ARGS); extern Datum array_out(PG_FUNCTION_ARGS); extern Datum array_recv(PG_FUNCTION_ARGS); extern Datum array_send(PG_FUNCTION_ARGS); extern Datum array_eq(PG_FUNCTION_ARGS); extern Datum array_ne(PG_FUNCTION_ARGS); extern Datum array_lt(PG_FUNCTION_ARGS); extern Datum array_gt(PG_FUNCTION_ARGS); extern Datum array_le(PG_FUNCTION_ARGS); extern Datum array_ge(PG_FUNCTION_ARGS); extern Datum btarraycmp(PG_FUNCTION_ARGS); extern Datum hash_array(PG_FUNCTION_ARGS); extern Datum arrayoverlap(PG_FUNCTION_ARGS); extern Datum arraycontains(PG_FUNCTION_ARGS); extern Datum arraycontained(PG_FUNCTION_ARGS); extern Datum array_ndims(PG_FUNCTION_ARGS); extern Datum array_dims(PG_FUNCTION_ARGS); extern Datum array_lower(PG_FUNCTION_ARGS); extern Datum array_upper(PG_FUNCTION_ARGS); extern Datum array_length(PG_FUNCTION_ARGS); extern Datum array_larger(PG_FUNCTION_ARGS); extern Datum array_smaller(PG_FUNCTION_ARGS); extern Datum generate_subscripts(PG_FUNCTION_ARGS); extern Datum generate_subscripts_nodir(PG_FUNCTION_ARGS); extern Datum array_fill(PG_FUNCTION_ARGS); extern Datum array_fill_with_lower_bounds(PG_FUNCTION_ARGS); extern Datum array_unnest(PG_FUNCTION_ARGS); extern Datum array_ref(ArrayType *array, int nSubscripts, int *indx, int arraytyplen, int elmlen, bool elmbyval, char elmalign, bool *isNull); extern ArrayType *array_set(ArrayType *array, int nSubscripts, int *indx, Datum dataValue, bool isNull, int arraytyplen, int elmlen, bool elmbyval, char elmalign); extern ArrayType *array_get_slice(ArrayType *array, int nSubscripts, int *upperIndx, int *lowerIndx, int arraytyplen, int elmlen, bool elmbyval, char elmalign); extern ArrayType *array_set_slice(ArrayType *array, int nSubscripts, int *upperIndx, int *lowerIndx, ArrayType *srcArray, bool isNull, int arraytyplen, int elmlen, bool elmbyval, char elmalign); extern Datum array_map(FunctionCallInfo fcinfo, Oid inpType, Oid retType, ArrayMapState *amstate); extern void array_bitmap_copy(bits8 *destbitmap, int destoffset, const bits8 *srcbitmap, int srcoffset, int nitems); extern ArrayType *construct_array(Datum *elems, int nelems, Oid elmtype, int elmlen, bool elmbyval, char elmalign); extern ArrayType *construct_md_array(Datum *elems, bool *nulls, int ndims, int *dims, int *lbs, Oid elmtype, int elmlen, bool elmbyval, char elmalign); extern ArrayType *construct_empty_array(Oid elmtype); extern void deconstruct_array(ArrayType *array, Oid elmtype, int elmlen, bool elmbyval, char elmalign, Datum **elemsp, bool **nullsp, int *nelemsp); extern bool array_contains_nulls(ArrayType *array); extern ArrayBuildState *accumArrayResult(ArrayBuildState *astate, Datum dvalue, bool disnull, Oid element_type, MemoryContext rcontext); extern Datum makeArrayResult(ArrayBuildState *astate, MemoryContext rcontext); extern Datum makeMdArrayResult(ArrayBuildState *astate, int ndims, int *dims, int *lbs, MemoryContext rcontext, bool release); extern ArrayIterator array_create_iterator(ArrayType *arr, int slice_ndim); extern bool array_iterate(ArrayIterator iterator, Datum *value, bool *isnull); extern void array_free_iterator(ArrayIterator iterator); /* * prototypes for functions defined in arrayutils.c */ extern int ArrayGetOffset(int n, const int *dim, const int *lb, const int *indx); extern int ArrayGetOffset0(int n, const int *tup, const int *scale); extern int ArrayGetNItems(int ndim, const int *dims); extern void mda_get_range(int n, int *span, const int *st, const int *endp); extern void mda_get_prod(int n, const int *range, int *prod); extern void mda_get_offset_values(int n, int *dist, const int *prod, const int *span); extern int mda_next_tuple(int n, int *curr, const int *span); extern int32 *ArrayGetIntegerTypmods(ArrayType *arr, int *n); extern void ArrayCheckBounds(int ndim, const int *dims, const int *lb); /* * prototypes for functions defined in array_userfuncs.c */ extern Datum array_push(PG_FUNCTION_ARGS); extern Datum array_cat(PG_FUNCTION_ARGS); extern ArrayType *create_singleton_array(FunctionCallInfo fcinfo, Oid element_type, Datum element, bool isNull, int ndims); extern Datum array_agg_transfn(PG_FUNCTION_ARGS); extern Datum array_agg_finalfn(PG_FUNCTION_ARGS); /* * prototypes for functions defined in array_typanalyze.c */ extern Datum array_typanalyze(PG_FUNCTION_ARGS); #endif /* ARRAY_H */ �����������������������������������pgsql/server/utils/geo_decls.h����������������������������������������������������������������������0000644�����������������00000037562�14763166026�0012465 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * geo_decls.h - Declarations for various 2D constructs. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/geo_decls.h * * NOTE * These routines do *not* use the float types from adt/. * * XXX These routines were not written by a numerical analyst. * * XXX I have made some attempt to flesh out the operators * and data types. There are still some more to do. - tgl 97/04/19 * *------------------------------------------------------------------------- */ #ifndef GEO_DECLS_H #define GEO_DECLS_H #include <math.h> #include "fmgr.h" /*-------------------------------------------------------------------- * Useful floating point utilities and constants. *-------------------------------------------------------------------*/ #define EPSILON 1.0E-06 #ifdef EPSILON #define FPzero(A) (fabs(A) <= EPSILON) #define FPeq(A,B) (fabs((A) - (B)) <= EPSILON) #define FPne(A,B) (fabs((A) - (B)) > EPSILON) #define FPlt(A,B) ((B) - (A) > EPSILON) #define FPle(A,B) ((A) - (B) <= EPSILON) #define FPgt(A,B) ((A) - (B) > EPSILON) #define FPge(A,B) ((B) - (A) <= EPSILON) #else #define FPzero(A) ((A) == 0) #define FPeq(A,B) ((A) == (B)) #define FPne(A,B) ((A) != (B)) #define FPlt(A,B) ((A) < (B)) #define FPle(A,B) ((A) <= (B)) #define FPgt(A,B) ((A) > (B)) #define FPge(A,B) ((A) >= (B)) #endif #define HYPOT(A, B) pg_hypot(A, B) /*--------------------------------------------------------------------- * Point - (x,y) *-------------------------------------------------------------------*/ typedef struct { double x, y; } Point; /*--------------------------------------------------------------------- * LSEG - A straight line, specified by endpoints. *-------------------------------------------------------------------*/ typedef struct { Point p[2]; double m; /* precomputed to save time, not in tuple */ } LSEG; /*--------------------------------------------------------------------- * PATH - Specified by vertex points. *-------------------------------------------------------------------*/ typedef struct { int32 vl_len_; /* varlena header (do not touch directly!) */ int32 npts; int32 closed; /* is this a closed polygon? */ int32 dummy; /* padding to make it double align */ Point p[1]; /* variable length array of POINTs */ } PATH; /*--------------------------------------------------------------------- * LINE - Specified by its general equation (Ax+By+C=0). * If there is a y-intercept, it is C, which * incidentally gives a freebie point on the line * (if B=0, then C is the x-intercept). * Slope m is precalculated to save time; if * the line is not vertical, m == A. *-------------------------------------------------------------------*/ typedef struct { double A, B, C; double m; } LINE; /*--------------------------------------------------------------------- * BOX - Specified by two corner points, which are * sorted to save calculation time later. *-------------------------------------------------------------------*/ typedef struct { Point high, low; /* corner POINTs */ } BOX; /*--------------------------------------------------------------------- * POLYGON - Specified by an array of doubles defining the points, * keeping the number of points and the bounding box for * speed purposes. *-------------------------------------------------------------------*/ typedef struct { int32 vl_len_; /* varlena header (do not touch directly!) */ int32 npts; BOX boundbox; Point p[1]; /* variable length array of POINTs */ } POLYGON; /*--------------------------------------------------------------------- * CIRCLE - Specified by a center point and radius. *-------------------------------------------------------------------*/ typedef struct { Point center; double radius; } CIRCLE; /* * fmgr interface macros * * Path and Polygon are toastable varlena types, the others are just * fixed-size pass-by-reference types. */ #define DatumGetPointP(X) ((Point *) DatumGetPointer(X)) #define PointPGetDatum(X) PointerGetDatum(X) #define PG_GETARG_POINT_P(n) DatumGetPointP(PG_GETARG_DATUM(n)) #define PG_RETURN_POINT_P(x) return PointPGetDatum(x) #define DatumGetLsegP(X) ((LSEG *) DatumGetPointer(X)) #define LsegPGetDatum(X) PointerGetDatum(X) #define PG_GETARG_LSEG_P(n) DatumGetLsegP(PG_GETARG_DATUM(n)) #define PG_RETURN_LSEG_P(x) return LsegPGetDatum(x) #define DatumGetPathP(X) ((PATH *) PG_DETOAST_DATUM(X)) #define DatumGetPathPCopy(X) ((PATH *) PG_DETOAST_DATUM_COPY(X)) #define PathPGetDatum(X) PointerGetDatum(X) #define PG_GETARG_PATH_P(n) DatumGetPathP(PG_GETARG_DATUM(n)) #define PG_GETARG_PATH_P_COPY(n) DatumGetPathPCopy(PG_GETARG_DATUM(n)) #define PG_RETURN_PATH_P(x) return PathPGetDatum(x) #define DatumGetLineP(X) ((LINE *) DatumGetPointer(X)) #define LinePGetDatum(X) PointerGetDatum(X) #define PG_GETARG_LINE_P(n) DatumGetLineP(PG_GETARG_DATUM(n)) #define PG_RETURN_LINE_P(x) return LinePGetDatum(x) #define DatumGetBoxP(X) ((BOX *) DatumGetPointer(X)) #define BoxPGetDatum(X) PointerGetDatum(X) #define PG_GETARG_BOX_P(n) DatumGetBoxP(PG_GETARG_DATUM(n)) #define PG_RETURN_BOX_P(x) return BoxPGetDatum(x) #define DatumGetPolygonP(X) ((POLYGON *) PG_DETOAST_DATUM(X)) #define DatumGetPolygonPCopy(X) ((POLYGON *) PG_DETOAST_DATUM_COPY(X)) #define PolygonPGetDatum(X) PointerGetDatum(X) #define PG_GETARG_POLYGON_P(n) DatumGetPolygonP(PG_GETARG_DATUM(n)) #define PG_GETARG_POLYGON_P_COPY(n) DatumGetPolygonPCopy(PG_GETARG_DATUM(n)) #define PG_RETURN_POLYGON_P(x) return PolygonPGetDatum(x) #define DatumGetCircleP(X) ((CIRCLE *) DatumGetPointer(X)) #define CirclePGetDatum(X) PointerGetDatum(X) #define PG_GETARG_CIRCLE_P(n) DatumGetCircleP(PG_GETARG_DATUM(n)) #define PG_RETURN_CIRCLE_P(x) return CirclePGetDatum(x) /* * in geo_ops.h */ /* public point routines */ extern Datum point_in(PG_FUNCTION_ARGS); extern Datum point_out(PG_FUNCTION_ARGS); extern Datum point_recv(PG_FUNCTION_ARGS); extern Datum point_send(PG_FUNCTION_ARGS); extern Datum construct_point(PG_FUNCTION_ARGS); extern Datum point_left(PG_FUNCTION_ARGS); extern Datum point_right(PG_FUNCTION_ARGS); extern Datum point_above(PG_FUNCTION_ARGS); extern Datum point_below(PG_FUNCTION_ARGS); extern Datum point_vert(PG_FUNCTION_ARGS); extern Datum point_horiz(PG_FUNCTION_ARGS); extern Datum point_eq(PG_FUNCTION_ARGS); extern Datum point_ne(PG_FUNCTION_ARGS); extern Datum point_distance(PG_FUNCTION_ARGS); extern Datum point_slope(PG_FUNCTION_ARGS); extern Datum point_add(PG_FUNCTION_ARGS); extern Datum point_sub(PG_FUNCTION_ARGS); extern Datum point_mul(PG_FUNCTION_ARGS); extern Datum point_div(PG_FUNCTION_ARGS); /* private routines */ extern double point_dt(Point *pt1, Point *pt2); extern double point_sl(Point *pt1, Point *pt2); extern double pg_hypot(double x, double y); /* public lseg routines */ extern Datum lseg_in(PG_FUNCTION_ARGS); extern Datum lseg_out(PG_FUNCTION_ARGS); extern Datum lseg_recv(PG_FUNCTION_ARGS); extern Datum lseg_send(PG_FUNCTION_ARGS); extern Datum lseg_intersect(PG_FUNCTION_ARGS); extern Datum lseg_parallel(PG_FUNCTION_ARGS); extern Datum lseg_perp(PG_FUNCTION_ARGS); extern Datum lseg_vertical(PG_FUNCTION_ARGS); extern Datum lseg_horizontal(PG_FUNCTION_ARGS); extern Datum lseg_eq(PG_FUNCTION_ARGS); extern Datum lseg_ne(PG_FUNCTION_ARGS); extern Datum lseg_lt(PG_FUNCTION_ARGS); extern Datum lseg_le(PG_FUNCTION_ARGS); extern Datum lseg_gt(PG_FUNCTION_ARGS); extern Datum lseg_ge(PG_FUNCTION_ARGS); extern Datum lseg_construct(PG_FUNCTION_ARGS); extern Datum lseg_length(PG_FUNCTION_ARGS); extern Datum lseg_distance(PG_FUNCTION_ARGS); extern Datum lseg_center(PG_FUNCTION_ARGS); extern Datum lseg_interpt(PG_FUNCTION_ARGS); extern Datum dist_pl(PG_FUNCTION_ARGS); extern Datum dist_ps(PG_FUNCTION_ARGS); extern Datum dist_ppath(PG_FUNCTION_ARGS); extern Datum dist_pb(PG_FUNCTION_ARGS); extern Datum dist_sl(PG_FUNCTION_ARGS); extern Datum dist_sb(PG_FUNCTION_ARGS); extern Datum dist_lb(PG_FUNCTION_ARGS); extern Datum close_lseg(PG_FUNCTION_ARGS); extern Datum close_pl(PG_FUNCTION_ARGS); extern Datum close_ps(PG_FUNCTION_ARGS); extern Datum close_pb(PG_FUNCTION_ARGS); extern Datum close_sl(PG_FUNCTION_ARGS); extern Datum close_sb(PG_FUNCTION_ARGS); extern Datum close_ls(PG_FUNCTION_ARGS); extern Datum close_lb(PG_FUNCTION_ARGS); extern Datum on_pl(PG_FUNCTION_ARGS); extern Datum on_ps(PG_FUNCTION_ARGS); extern Datum on_pb(PG_FUNCTION_ARGS); extern Datum on_ppath(PG_FUNCTION_ARGS); extern Datum on_sl(PG_FUNCTION_ARGS); extern Datum on_sb(PG_FUNCTION_ARGS); extern Datum inter_sl(PG_FUNCTION_ARGS); extern Datum inter_sb(PG_FUNCTION_ARGS); extern Datum inter_lb(PG_FUNCTION_ARGS); /* public line routines */ extern Datum line_in(PG_FUNCTION_ARGS); extern Datum line_out(PG_FUNCTION_ARGS); extern Datum line_recv(PG_FUNCTION_ARGS); extern Datum line_send(PG_FUNCTION_ARGS); extern Datum line_interpt(PG_FUNCTION_ARGS); extern Datum line_distance(PG_FUNCTION_ARGS); extern Datum line_construct_pp(PG_FUNCTION_ARGS); extern Datum line_intersect(PG_FUNCTION_ARGS); extern Datum line_parallel(PG_FUNCTION_ARGS); extern Datum line_perp(PG_FUNCTION_ARGS); extern Datum line_vertical(PG_FUNCTION_ARGS); extern Datum line_horizontal(PG_FUNCTION_ARGS); extern Datum line_eq(PG_FUNCTION_ARGS); /* public box routines */ extern Datum box_in(PG_FUNCTION_ARGS); extern Datum box_out(PG_FUNCTION_ARGS); extern Datum box_recv(PG_FUNCTION_ARGS); extern Datum box_send(PG_FUNCTION_ARGS); extern Datum box_same(PG_FUNCTION_ARGS); extern Datum box_overlap(PG_FUNCTION_ARGS); extern Datum box_left(PG_FUNCTION_ARGS); extern Datum box_overleft(PG_FUNCTION_ARGS); extern Datum box_right(PG_FUNCTION_ARGS); extern Datum box_overright(PG_FUNCTION_ARGS); extern Datum box_below(PG_FUNCTION_ARGS); extern Datum box_overbelow(PG_FUNCTION_ARGS); extern Datum box_above(PG_FUNCTION_ARGS); extern Datum box_overabove(PG_FUNCTION_ARGS); extern Datum box_contained(PG_FUNCTION_ARGS); extern Datum box_contain(PG_FUNCTION_ARGS); extern Datum box_contain_pt(PG_FUNCTION_ARGS); extern Datum box_below_eq(PG_FUNCTION_ARGS); extern Datum box_above_eq(PG_FUNCTION_ARGS); extern Datum box_lt(PG_FUNCTION_ARGS); extern Datum box_gt(PG_FUNCTION_ARGS); extern Datum box_eq(PG_FUNCTION_ARGS); extern Datum box_le(PG_FUNCTION_ARGS); extern Datum box_ge(PG_FUNCTION_ARGS); extern Datum box_area(PG_FUNCTION_ARGS); extern Datum box_width(PG_FUNCTION_ARGS); extern Datum box_height(PG_FUNCTION_ARGS); extern Datum box_distance(PG_FUNCTION_ARGS); extern Datum box_center(PG_FUNCTION_ARGS); extern Datum box_intersect(PG_FUNCTION_ARGS); extern Datum box_diagonal(PG_FUNCTION_ARGS); extern Datum points_box(PG_FUNCTION_ARGS); extern Datum box_add(PG_FUNCTION_ARGS); extern Datum box_sub(PG_FUNCTION_ARGS); extern Datum box_mul(PG_FUNCTION_ARGS); extern Datum box_div(PG_FUNCTION_ARGS); /* public path routines */ extern Datum path_area(PG_FUNCTION_ARGS); extern Datum path_in(PG_FUNCTION_ARGS); extern Datum path_out(PG_FUNCTION_ARGS); extern Datum path_recv(PG_FUNCTION_ARGS); extern Datum path_send(PG_FUNCTION_ARGS); extern Datum path_n_lt(PG_FUNCTION_ARGS); extern Datum path_n_gt(PG_FUNCTION_ARGS); extern Datum path_n_eq(PG_FUNCTION_ARGS); extern Datum path_n_le(PG_FUNCTION_ARGS); extern Datum path_n_ge(PG_FUNCTION_ARGS); extern Datum path_inter(PG_FUNCTION_ARGS); extern Datum path_distance(PG_FUNCTION_ARGS); extern Datum path_length(PG_FUNCTION_ARGS); extern Datum path_isclosed(PG_FUNCTION_ARGS); extern Datum path_isopen(PG_FUNCTION_ARGS); extern Datum path_npoints(PG_FUNCTION_ARGS); extern Datum path_close(PG_FUNCTION_ARGS); extern Datum path_open(PG_FUNCTION_ARGS); extern Datum path_add(PG_FUNCTION_ARGS); extern Datum path_add_pt(PG_FUNCTION_ARGS); extern Datum path_sub_pt(PG_FUNCTION_ARGS); extern Datum path_mul_pt(PG_FUNCTION_ARGS); extern Datum path_div_pt(PG_FUNCTION_ARGS); extern Datum path_center(PG_FUNCTION_ARGS); extern Datum path_poly(PG_FUNCTION_ARGS); /* public polygon routines */ extern Datum poly_in(PG_FUNCTION_ARGS); extern Datum poly_out(PG_FUNCTION_ARGS); extern Datum poly_recv(PG_FUNCTION_ARGS); extern Datum poly_send(PG_FUNCTION_ARGS); extern Datum poly_left(PG_FUNCTION_ARGS); extern Datum poly_overleft(PG_FUNCTION_ARGS); extern Datum poly_right(PG_FUNCTION_ARGS); extern Datum poly_overright(PG_FUNCTION_ARGS); extern Datum poly_below(PG_FUNCTION_ARGS); extern Datum poly_overbelow(PG_FUNCTION_ARGS); extern Datum poly_above(PG_FUNCTION_ARGS); extern Datum poly_overabove(PG_FUNCTION_ARGS); extern Datum poly_same(PG_FUNCTION_ARGS); extern Datum poly_overlap(PG_FUNCTION_ARGS); extern Datum poly_contain(PG_FUNCTION_ARGS); extern Datum poly_contained(PG_FUNCTION_ARGS); extern Datum poly_contain_pt(PG_FUNCTION_ARGS); extern Datum pt_contained_poly(PG_FUNCTION_ARGS); extern Datum poly_distance(PG_FUNCTION_ARGS); extern Datum poly_npoints(PG_FUNCTION_ARGS); extern Datum poly_center(PG_FUNCTION_ARGS); extern Datum poly_box(PG_FUNCTION_ARGS); extern Datum poly_path(PG_FUNCTION_ARGS); extern Datum box_poly(PG_FUNCTION_ARGS); /* public circle routines */ extern Datum circle_in(PG_FUNCTION_ARGS); extern Datum circle_out(PG_FUNCTION_ARGS); extern Datum circle_recv(PG_FUNCTION_ARGS); extern Datum circle_send(PG_FUNCTION_ARGS); extern Datum circle_same(PG_FUNCTION_ARGS); extern Datum circle_overlap(PG_FUNCTION_ARGS); extern Datum circle_overleft(PG_FUNCTION_ARGS); extern Datum circle_left(PG_FUNCTION_ARGS); extern Datum circle_right(PG_FUNCTION_ARGS); extern Datum circle_overright(PG_FUNCTION_ARGS); extern Datum circle_contained(PG_FUNCTION_ARGS); extern Datum circle_contain(PG_FUNCTION_ARGS); extern Datum circle_below(PG_FUNCTION_ARGS); extern Datum circle_above(PG_FUNCTION_ARGS); extern Datum circle_overbelow(PG_FUNCTION_ARGS); extern Datum circle_overabove(PG_FUNCTION_ARGS); extern Datum circle_eq(PG_FUNCTION_ARGS); extern Datum circle_ne(PG_FUNCTION_ARGS); extern Datum circle_lt(PG_FUNCTION_ARGS); extern Datum circle_gt(PG_FUNCTION_ARGS); extern Datum circle_le(PG_FUNCTION_ARGS); extern Datum circle_ge(PG_FUNCTION_ARGS); extern Datum circle_contain_pt(PG_FUNCTION_ARGS); extern Datum pt_contained_circle(PG_FUNCTION_ARGS); extern Datum circle_add_pt(PG_FUNCTION_ARGS); extern Datum circle_sub_pt(PG_FUNCTION_ARGS); extern Datum circle_mul_pt(PG_FUNCTION_ARGS); extern Datum circle_div_pt(PG_FUNCTION_ARGS); extern Datum circle_diameter(PG_FUNCTION_ARGS); extern Datum circle_radius(PG_FUNCTION_ARGS); extern Datum circle_distance(PG_FUNCTION_ARGS); extern Datum dist_pc(PG_FUNCTION_ARGS); extern Datum dist_cpoly(PG_FUNCTION_ARGS); extern Datum circle_center(PG_FUNCTION_ARGS); extern Datum cr_circle(PG_FUNCTION_ARGS); extern Datum box_circle(PG_FUNCTION_ARGS); extern Datum circle_box(PG_FUNCTION_ARGS); extern Datum poly_circle(PG_FUNCTION_ARGS); extern Datum circle_poly(PG_FUNCTION_ARGS); extern Datum circle_area(PG_FUNCTION_ARGS); /* support routines for the GiST access method (access/gist/gistproc.c) */ extern Datum gist_box_compress(PG_FUNCTION_ARGS); extern Datum gist_box_decompress(PG_FUNCTION_ARGS); extern Datum gist_box_union(PG_FUNCTION_ARGS); extern Datum gist_box_picksplit(PG_FUNCTION_ARGS); extern Datum gist_box_consistent(PG_FUNCTION_ARGS); extern Datum gist_box_penalty(PG_FUNCTION_ARGS); extern Datum gist_box_same(PG_FUNCTION_ARGS); extern Datum gist_poly_compress(PG_FUNCTION_ARGS); extern Datum gist_poly_consistent(PG_FUNCTION_ARGS); extern Datum gist_circle_compress(PG_FUNCTION_ARGS); extern Datum gist_circle_consistent(PG_FUNCTION_ARGS); extern Datum gist_point_compress(PG_FUNCTION_ARGS); extern Datum gist_point_consistent(PG_FUNCTION_ARGS); extern Datum gist_point_distance(PG_FUNCTION_ARGS); /* geo_selfuncs.c */ extern Datum areasel(PG_FUNCTION_ARGS); extern Datum areajoinsel(PG_FUNCTION_ARGS); extern Datum positionsel(PG_FUNCTION_ARGS); extern Datum positionjoinsel(PG_FUNCTION_ARGS); extern Datum contsel(PG_FUNCTION_ARGS); extern Datum contjoinsel(PG_FUNCTION_ARGS); #endif /* GEO_DECLS_H */ ����������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/palloc.h�������������������������������������������������������������������������0000644�����������������00000007652�14763166026�0012010 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * palloc.h * POSTGRES memory allocator definitions. * * This file contains the basic memory allocation interface that is * needed by almost every backend module. It is included directly by * postgres.h, so the definitions here are automatically available * everywhere. Keep it lean! * * Memory allocation occurs within "contexts". Every chunk obtained from * palloc()/MemoryContextAlloc() is allocated within a specific context. * The entire contents of a context can be freed easily and quickly by * resetting or deleting the context --- this is both faster and less * prone to memory-leakage bugs than releasing chunks individually. * We organize contexts into context trees to allow fine-grain control * over chunk lifetime while preserving the certainty that we will free * everything that should be freed. See utils/mmgr/README for more info. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/palloc.h * *------------------------------------------------------------------------- */ #ifndef PALLOC_H #define PALLOC_H /* * Type MemoryContextData is declared in nodes/memnodes.h. Most users * of memory allocation should just treat it as an abstract type, so we * do not provide the struct contents here. */ typedef struct MemoryContextData *MemoryContext; /* * CurrentMemoryContext is the default allocation context for palloc(). * We declare it here so that palloc() can be a macro. Avoid accessing it * directly! Instead, use MemoryContextSwitchTo() to change the setting. */ extern PGDLLIMPORT MemoryContext CurrentMemoryContext; /* * Fundamental memory-allocation operations (more are in utils/memutils.h) */ extern void *MemoryContextAlloc(MemoryContext context, Size size); extern void *MemoryContextAllocZero(MemoryContext context, Size size); extern void *MemoryContextAllocZeroAligned(MemoryContext context, Size size); #define palloc(sz) MemoryContextAlloc(CurrentMemoryContext, (sz)) #define palloc0(sz) MemoryContextAllocZero(CurrentMemoryContext, (sz)) /* * The result of palloc() is always word-aligned, so we can skip testing * alignment of the pointer when deciding which MemSet variant to use. * Note that this variant does not offer any advantage, and should not be * used, unless its "sz" argument is a compile-time constant; therefore, the * issue that it evaluates the argument multiple times isn't a problem in * practice. */ #define palloc0fast(sz) \ ( MemSetTest(0, sz) ? \ MemoryContextAllocZeroAligned(CurrentMemoryContext, sz) : \ MemoryContextAllocZero(CurrentMemoryContext, sz) ) extern void pfree(void *pointer); extern void *repalloc(void *pointer, Size size); /* * MemoryContextSwitchTo can't be a macro in standard C compilers. * But we can make it an inline function if the compiler supports it. * * This file has to be includable by some non-backend code such as * pg_resetxlog, so don't expose the CurrentMemoryContext reference * if FRONTEND is defined. */ #if defined(USE_INLINE) && !defined(FRONTEND) static inline MemoryContext MemoryContextSwitchTo(MemoryContext context) { MemoryContext old = CurrentMemoryContext; CurrentMemoryContext = context; return old; } #else extern MemoryContext MemoryContextSwitchTo(MemoryContext context); #endif /* USE_INLINE && !FRONTEND */ /* * These are like standard strdup() except the copied string is * allocated in a context, not with malloc(). */ extern char *MemoryContextStrdup(MemoryContext context, const char *string); #define pstrdup(str) MemoryContextStrdup(CurrentMemoryContext, (str)) extern char *pnstrdup(const char *in, Size len); #if defined(WIN32) || defined(__CYGWIN__) extern void *pgport_palloc(Size sz); extern char *pgport_pstrdup(const char *str); extern void pgport_pfree(void *pointer); #endif #endif /* PALLOC_H */ ��������������������������������������������������������������������������������������pgsql/server/utils/fmgrtab.h������������������������������������������������������������������������0000644�����������������00000002235�14763166026�0012150 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * fmgrtab.h * The function manager's table of internal functions. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/fmgrtab.h * *------------------------------------------------------------------------- */ #ifndef FMGRTAB_H #define FMGRTAB_H #include "fmgr.h" /* * This table stores info about all the built-in functions (ie, functions * that are compiled into the Postgres executable). The table entries are * required to appear in Oid order, so that binary search can be used. */ typedef struct { Oid foid; /* OID of the function */ const char *funcName; /* C name of the function */ short nargs; /* 0..FUNC_MAX_ARGS, or -1 if variable count */ bool strict; /* T if function is "strict" */ bool retset; /* T if function returns a set */ PGFunction func; /* pointer to compiled function */ } FmgrBuiltin; extern const FmgrBuiltin fmgr_builtins[]; extern const int fmgr_nbuiltins; /* number of entries in table */ #endif /* FMGRTAB_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/pg_rusage.h����������������������������������������������������������������������0000644�����������������00000001517�14763166026�0012504 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_rusage.h * header file for resource usage measurement support routines * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/pg_rusage.h * *------------------------------------------------------------------------- */ #ifndef PG_RUSAGE_H #define PG_RUSAGE_H #include <sys/time.h> #ifdef HAVE_SYS_RESOURCE_H #include <sys/resource.h> #else #include "rusagestub.h" #endif /* State structure for pg_rusage_init/pg_rusage_show */ typedef struct PGRUsage { struct timeval tv; struct rusage ru; } PGRUsage; extern void pg_rusage_init(PGRUsage *ru0); extern const char *pg_rusage_show(const PGRUsage *ru0); #endif /* PG_RUSAGE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/pg_lzcompress.h������������������������������������������������������������������0000644�����������������00000005745�14763166026�0013426 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ---------- * pg_lzcompress.h - * * Definitions for the builtin LZ compressor * * src/include/utils/pg_lzcompress.h * ---------- */ #ifndef _PG_LZCOMPRESS_H_ #define _PG_LZCOMPRESS_H_ /* ---------- * PGLZ_Header - * * The information at the start of the compressed data. * ---------- */ typedef struct PGLZ_Header { int32 vl_len_; /* varlena header (do not touch directly!) */ int32 rawsize; } PGLZ_Header; /* ---------- * PGLZ_MAX_OUTPUT - * * Macro to compute the buffer size required by pglz_compress(). * We allow 4 bytes for overrun before detecting compression failure. * ---------- */ #define PGLZ_MAX_OUTPUT(_dlen) ((_dlen) + 4 + sizeof(PGLZ_Header)) /* ---------- * PGLZ_RAW_SIZE - * * Macro to determine the uncompressed data size contained * in the entry. * ---------- */ #define PGLZ_RAW_SIZE(_lzdata) ((_lzdata)->rawsize) /* ---------- * PGLZ_Strategy - * * Some values that control the compression algorithm. * * min_input_size Minimum input data size to consider compression. * * max_input_size Maximum input data size to consider compression. * * min_comp_rate Minimum compression rate (0-99%) to require. * Regardless of min_comp_rate, the output must be * smaller than the input, else we don't store * compressed. * * first_success_by Abandon compression if we find no compressible * data within the first this-many bytes. * * match_size_good The initial GOOD match size when starting history * lookup. When looking up the history to find a * match that could be expressed as a tag, the * algorithm does not always walk back entirely. * A good match fast is usually better than the * best possible one very late. For each iteration * in the lookup, this value is lowered so the * longer the lookup takes, the smaller matches * are considered good. * * match_size_drop The percentage by which match_size_good is lowered * after each history check. Allowed values are * 0 (no change until end) to 100 (only check * latest history entry at all). * ---------- */ typedef struct PGLZ_Strategy { int32 min_input_size; int32 max_input_size; int32 min_comp_rate; int32 first_success_by; int32 match_size_good; int32 match_size_drop; } PGLZ_Strategy; /* ---------- * The standard strategies * * PGLZ_strategy_default Recommended default strategy for TOAST. * * PGLZ_strategy_always Try to compress inputs of any length. * Fallback to uncompressed storage only if * output would be larger than input. * ---------- */ extern const PGLZ_Strategy *const PGLZ_strategy_default; extern const PGLZ_Strategy *const PGLZ_strategy_always; /* ---------- * Global function declarations * ---------- */ extern bool pglz_compress(const char *source, int32 slen, PGLZ_Header *dest, const PGLZ_Strategy *strategy); extern void pglz_decompress(const PGLZ_Header *source, char *dest); #endif /* _PG_LZCOMPRESS_H_ */ ���������������������������pgsql/server/utils/combocid.h�����������������������������������������������������������������������0000644�����������������00000001272�14763166026�0012305 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * combocid.h * Combo command ID support routines * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/combocid.h * *------------------------------------------------------------------------- */ #ifndef COMBOCID_H #define COMBOCID_H /* * HeapTupleHeaderGetCmin and HeapTupleHeaderGetCmax function prototypes * are in access/htup.h, because that's where the macro definitions that * those functions replaced used to be. */ extern void AtEOXact_ComboCid(void); #endif /* COMBOCID_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/acl.h����������������������������������������������������������������������������0000644�����������������00000031454�14763166026�0011272 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * acl.h * Definition of (and support for) access control list data structures. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/acl.h * * NOTES * An ACL array is simply an array of AclItems, representing the union * of the privileges represented by the individual items. A zero-length * array represents "no privileges". There are no assumptions about the * ordering of the items, but we do expect that there are no two entries * in the array with the same grantor and grantee. * * For backward-compatibility purposes we have to allow null ACL entries * in system catalogs. A null ACL will be treated as meaning "default * protection" (i.e., whatever acldefault() returns). *------------------------------------------------------------------------- */ #ifndef ACL_H #define ACL_H #include "nodes/parsenodes.h" #include "utils/array.h" #include "utils/snapshot.h" /* * typedef AclMode is declared in parsenodes.h, also the individual privilege * bit meanings are defined there */ #define ACL_ID_PUBLIC 0 /* placeholder for id in a PUBLIC acl item */ /* * AclItem * * Note: must be same size on all platforms, because the size is hardcoded * in the pg_type.h entry for aclitem. */ typedef struct AclItem { Oid ai_grantee; /* ID that this item grants privs to */ Oid ai_grantor; /* grantor of privs */ AclMode ai_privs; /* privilege bits */ } AclItem; /* * The upper 16 bits of the ai_privs field of an AclItem are the grant option * bits, and the lower 16 bits are the actual privileges. We use "rights" * to mean the combined grant option and privilege bits fields. */ #define ACLITEM_GET_PRIVS(item) ((item).ai_privs & 0xFFFF) #define ACLITEM_GET_GOPTIONS(item) (((item).ai_privs >> 16) & 0xFFFF) #define ACLITEM_GET_RIGHTS(item) ((item).ai_privs) #define ACL_GRANT_OPTION_FOR(privs) (((AclMode) (privs) & 0xFFFF) << 16) #define ACL_OPTION_TO_PRIVS(privs) (((AclMode) (privs) >> 16) & 0xFFFF) #define ACLITEM_SET_PRIVS(item,privs) \ ((item).ai_privs = ((item).ai_privs & ~((AclMode) 0xFFFF)) | \ ((AclMode) (privs) & 0xFFFF)) #define ACLITEM_SET_GOPTIONS(item,goptions) \ ((item).ai_privs = ((item).ai_privs & ~(((AclMode) 0xFFFF) << 16)) | \ (((AclMode) (goptions) & 0xFFFF) << 16)) #define ACLITEM_SET_RIGHTS(item,rights) \ ((item).ai_privs = (AclMode) (rights)) #define ACLITEM_SET_PRIVS_GOPTIONS(item,privs,goptions) \ ((item).ai_privs = ((AclMode) (privs) & 0xFFFF) | \ (((AclMode) (goptions) & 0xFFFF) << 16)) #define ACLITEM_ALL_PRIV_BITS ((AclMode) 0xFFFF) #define ACLITEM_ALL_GOPTION_BITS ((AclMode) 0xFFFF << 16) /* * Definitions for convenient access to Acl (array of AclItem). * These are standard PostgreSQL arrays, but are restricted to have one * dimension and no nulls. We also ignore the lower bound when reading, * and set it to one when writing. * * CAUTION: as of PostgreSQL 7.1, these arrays are toastable (just like all * other array types). Therefore, be careful to detoast them with the * macros provided, unless you know for certain that a particular array * can't have been toasted. */ /* * Acl a one-dimensional array of AclItem */ typedef ArrayType Acl; #define ACL_NUM(ACL) (ARR_DIMS(ACL)[0]) #define ACL_DAT(ACL) ((AclItem *) ARR_DATA_PTR(ACL)) #define ACL_N_SIZE(N) (ARR_OVERHEAD_NONULLS(1) + ((N) * sizeof(AclItem))) #define ACL_SIZE(ACL) ARR_SIZE(ACL) /* * fmgr macros for these types */ #define DatumGetAclItemP(X) ((AclItem *) DatumGetPointer(X)) #define PG_GETARG_ACLITEM_P(n) DatumGetAclItemP(PG_GETARG_DATUM(n)) #define PG_RETURN_ACLITEM_P(x) PG_RETURN_POINTER(x) #define DatumGetAclP(X) ((Acl *) PG_DETOAST_DATUM(X)) #define DatumGetAclPCopy(X) ((Acl *) PG_DETOAST_DATUM_COPY(X)) #define PG_GETARG_ACL_P(n) DatumGetAclP(PG_GETARG_DATUM(n)) #define PG_GETARG_ACL_P_COPY(n) DatumGetAclPCopy(PG_GETARG_DATUM(n)) #define PG_RETURN_ACL_P(x) PG_RETURN_POINTER(x) /* * ACL modification opcodes for aclupdate */ #define ACL_MODECHG_ADD 1 #define ACL_MODECHG_DEL 2 #define ACL_MODECHG_EQL 3 /* * External representations of the privilege bits --- aclitemin/aclitemout * represent each possible privilege bit with a distinct 1-character code */ #define ACL_INSERT_CHR 'a' /* formerly known as "append" */ #define ACL_SELECT_CHR 'r' /* formerly known as "read" */ #define ACL_UPDATE_CHR 'w' /* formerly known as "write" */ #define ACL_DELETE_CHR 'd' #define ACL_TRUNCATE_CHR 'D' /* super-delete, as it were */ #define ACL_REFERENCES_CHR 'x' #define ACL_TRIGGER_CHR 't' #define ACL_EXECUTE_CHR 'X' #define ACL_USAGE_CHR 'U' #define ACL_CREATE_CHR 'C' #define ACL_CREATE_TEMP_CHR 'T' #define ACL_CONNECT_CHR 'c' /* string holding all privilege code chars, in order by bitmask position */ #define ACL_ALL_RIGHTS_STR "arwdDxtXUCTc" /* * Bitmasks defining "all rights" for each supported object type */ #define ACL_ALL_RIGHTS_COLUMN (ACL_INSERT|ACL_SELECT|ACL_UPDATE|ACL_REFERENCES) #define ACL_ALL_RIGHTS_RELATION (ACL_INSERT|ACL_SELECT|ACL_UPDATE|ACL_DELETE|ACL_TRUNCATE|ACL_REFERENCES|ACL_TRIGGER) #define ACL_ALL_RIGHTS_SEQUENCE (ACL_USAGE|ACL_SELECT|ACL_UPDATE) #define ACL_ALL_RIGHTS_DATABASE (ACL_CREATE|ACL_CREATE_TEMP|ACL_CONNECT) #define ACL_ALL_RIGHTS_FDW (ACL_USAGE) #define ACL_ALL_RIGHTS_FOREIGN_SERVER (ACL_USAGE) #define ACL_ALL_RIGHTS_FUNCTION (ACL_EXECUTE) #define ACL_ALL_RIGHTS_LANGUAGE (ACL_USAGE) #define ACL_ALL_RIGHTS_LARGEOBJECT (ACL_SELECT|ACL_UPDATE) #define ACL_ALL_RIGHTS_NAMESPACE (ACL_USAGE|ACL_CREATE) #define ACL_ALL_RIGHTS_TABLESPACE (ACL_CREATE) #define ACL_ALL_RIGHTS_TYPE (ACL_USAGE) /* operation codes for pg_*_aclmask */ typedef enum { ACLMASK_ALL, /* normal case: compute all bits */ ACLMASK_ANY /* return when result is known nonzero */ } AclMaskHow; /* result codes for pg_*_aclcheck */ typedef enum { ACLCHECK_OK = 0, ACLCHECK_NO_PRIV, ACLCHECK_NOT_OWNER } AclResult; /* this enum covers all object types that can have privilege errors */ /* currently it's only used to tell aclcheck_error what to say */ typedef enum AclObjectKind { ACL_KIND_COLUMN, /* pg_attribute */ ACL_KIND_CLASS, /* pg_class */ ACL_KIND_SEQUENCE, /* pg_sequence */ ACL_KIND_DATABASE, /* pg_database */ ACL_KIND_PROC, /* pg_proc */ ACL_KIND_OPER, /* pg_operator */ ACL_KIND_TYPE, /* pg_type */ ACL_KIND_LANGUAGE, /* pg_language */ ACL_KIND_LARGEOBJECT, /* pg_largeobject */ ACL_KIND_NAMESPACE, /* pg_namespace */ ACL_KIND_OPCLASS, /* pg_opclass */ ACL_KIND_OPFAMILY, /* pg_opfamily */ ACL_KIND_COLLATION, /* pg_collation */ ACL_KIND_CONVERSION, /* pg_conversion */ ACL_KIND_TABLESPACE, /* pg_tablespace */ ACL_KIND_TSDICTIONARY, /* pg_ts_dict */ ACL_KIND_TSCONFIGURATION, /* pg_ts_config */ ACL_KIND_FDW, /* pg_foreign_data_wrapper */ ACL_KIND_FOREIGN_SERVER, /* pg_foreign_server */ ACL_KIND_EXTENSION, /* pg_extension */ MAX_ACL_KIND /* MUST BE LAST */ } AclObjectKind; /* * routines used internally */ extern Acl *acldefault(GrantObjectType objtype, Oid ownerId); extern Acl *get_user_default_acl(GrantObjectType objtype, Oid ownerId, Oid nsp_oid); extern Acl *aclupdate(const Acl *old_acl, const AclItem *mod_aip, int modechg, Oid ownerId, DropBehavior behavior); extern Acl *aclnewowner(const Acl *old_acl, Oid oldOwnerId, Oid newOwnerId); extern Acl *make_empty_acl(void); extern Acl *aclcopy(const Acl *orig_acl); extern Acl *aclconcat(const Acl *left_acl, const Acl *right_acl); extern Acl *aclmerge(const Acl *left_acl, const Acl *right_acl, Oid ownerId); extern void aclitemsort(Acl *acl); extern bool aclequal(const Acl *left_acl, const Acl *right_acl); extern AclMode aclmask(const Acl *acl, Oid roleid, Oid ownerId, AclMode mask, AclMaskHow how); extern int aclmembers(const Acl *acl, Oid **roleids); extern bool has_privs_of_role(Oid member, Oid role); extern bool is_member_of_role(Oid member, Oid role); extern bool is_member_of_role_nosuper(Oid member, Oid role); extern bool is_admin_of_role(Oid member, Oid role); extern void check_is_member_of_role(Oid member, Oid role); extern Oid get_role_oid(const char *rolname, bool missing_ok); extern void select_best_grantor(Oid roleId, AclMode privileges, const Acl *acl, Oid ownerId, Oid *grantorId, AclMode *grantOptions); extern void initialize_acl(void); /* * SQL functions (from acl.c) */ extern Datum aclitemin(PG_FUNCTION_ARGS); extern Datum aclitemout(PG_FUNCTION_ARGS); extern Datum aclinsert(PG_FUNCTION_ARGS); extern Datum aclremove(PG_FUNCTION_ARGS); extern Datum aclcontains(PG_FUNCTION_ARGS); extern Datum makeaclitem(PG_FUNCTION_ARGS); extern Datum aclitem_eq(PG_FUNCTION_ARGS); extern Datum hash_aclitem(PG_FUNCTION_ARGS); extern Datum acldefault_sql(PG_FUNCTION_ARGS); extern Datum aclexplode(PG_FUNCTION_ARGS); /* * prototypes for functions in aclchk.c */ extern void ExecuteGrantStmt(GrantStmt *stmt); extern void ExecAlterDefaultPrivilegesStmt(AlterDefaultPrivilegesStmt *stmt); extern void RemoveRoleFromObjectACL(Oid roleid, Oid classid, Oid objid); extern void RemoveDefaultACLById(Oid defaclOid); extern AclMode pg_attribute_aclmask(Oid table_oid, AttrNumber attnum, Oid roleid, AclMode mask, AclMaskHow how); extern AclMode pg_class_aclmask(Oid table_oid, Oid roleid, AclMode mask, AclMaskHow how); extern AclMode pg_database_aclmask(Oid db_oid, Oid roleid, AclMode mask, AclMaskHow how); extern AclMode pg_proc_aclmask(Oid proc_oid, Oid roleid, AclMode mask, AclMaskHow how); extern AclMode pg_language_aclmask(Oid lang_oid, Oid roleid, AclMode mask, AclMaskHow how); extern AclMode pg_largeobject_aclmask_snapshot(Oid lobj_oid, Oid roleid, AclMode mask, AclMaskHow how, Snapshot snapshot); extern AclMode pg_namespace_aclmask(Oid nsp_oid, Oid roleid, AclMode mask, AclMaskHow how); extern AclMode pg_tablespace_aclmask(Oid spc_oid, Oid roleid, AclMode mask, AclMaskHow how); extern AclMode pg_foreign_data_wrapper_aclmask(Oid fdw_oid, Oid roleid, AclMode mask, AclMaskHow how); extern AclMode pg_foreign_server_aclmask(Oid srv_oid, Oid roleid, AclMode mask, AclMaskHow how); extern AclMode pg_type_aclmask(Oid type_oid, Oid roleid, AclMode mask, AclMaskHow how); extern AclResult pg_attribute_aclcheck(Oid table_oid, AttrNumber attnum, Oid roleid, AclMode mode); extern AclResult pg_attribute_aclcheck_all(Oid table_oid, Oid roleid, AclMode mode, AclMaskHow how); extern AclResult pg_class_aclcheck(Oid table_oid, Oid roleid, AclMode mode); extern AclResult pg_database_aclcheck(Oid db_oid, Oid roleid, AclMode mode); extern AclResult pg_proc_aclcheck(Oid proc_oid, Oid roleid, AclMode mode); extern AclResult pg_language_aclcheck(Oid lang_oid, Oid roleid, AclMode mode); extern AclResult pg_largeobject_aclcheck_snapshot(Oid lang_oid, Oid roleid, AclMode mode, Snapshot snapshot); extern AclResult pg_namespace_aclcheck(Oid nsp_oid, Oid roleid, AclMode mode); extern AclResult pg_tablespace_aclcheck(Oid spc_oid, Oid roleid, AclMode mode); extern AclResult pg_foreign_data_wrapper_aclcheck(Oid fdw_oid, Oid roleid, AclMode mode); extern AclResult pg_foreign_server_aclcheck(Oid srv_oid, Oid roleid, AclMode mode); extern AclResult pg_type_aclcheck(Oid type_oid, Oid roleid, AclMode mode); extern void aclcheck_error(AclResult aclerr, AclObjectKind objectkind, const char *objectname); extern void aclcheck_error_col(AclResult aclerr, AclObjectKind objectkind, const char *objectname, const char *colname); extern void aclcheck_error_type(AclResult aclerr, Oid typeOid); /* ownercheck routines just return true (owner) or false (not) */ extern bool pg_class_ownercheck(Oid class_oid, Oid roleid); extern bool pg_type_ownercheck(Oid type_oid, Oid roleid); extern bool pg_oper_ownercheck(Oid oper_oid, Oid roleid); extern bool pg_proc_ownercheck(Oid proc_oid, Oid roleid); extern bool pg_language_ownercheck(Oid lan_oid, Oid roleid); extern bool pg_largeobject_ownercheck(Oid lobj_oid, Oid roleid); extern bool pg_namespace_ownercheck(Oid nsp_oid, Oid roleid); extern bool pg_tablespace_ownercheck(Oid spc_oid, Oid roleid); extern bool pg_opclass_ownercheck(Oid opc_oid, Oid roleid); extern bool pg_opfamily_ownercheck(Oid opf_oid, Oid roleid); extern bool pg_database_ownercheck(Oid db_oid, Oid roleid); extern bool pg_collation_ownercheck(Oid coll_oid, Oid roleid); extern bool pg_conversion_ownercheck(Oid conv_oid, Oid roleid); extern bool pg_ts_dict_ownercheck(Oid dict_oid, Oid roleid); extern bool pg_ts_config_ownercheck(Oid cfg_oid, Oid roleid); extern bool pg_foreign_data_wrapper_ownercheck(Oid srv_oid, Oid roleid); extern bool pg_foreign_server_ownercheck(Oid srv_oid, Oid roleid); extern bool pg_extension_ownercheck(Oid ext_oid, Oid roleid); extern bool has_createrole_privilege(Oid roleid); #endif /* ACL_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/portal.h�������������������������������������������������������������������������0000644�����������������00000022343�14763166026�0012031 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * portal.h * POSTGRES portal definitions. * * A portal is an abstraction which represents the execution state of * a running or runnable query. Portals support both SQL-level CURSORs * and protocol-level portals. * * Scrolling (nonsequential access) and suspension of execution are allowed * only for portals that contain a single SELECT-type query. We do not want * to let the client suspend an update-type query partway through! Because * the query rewriter does not allow arbitrary ON SELECT rewrite rules, * only queries that were originally update-type could produce multiple * plan trees; so the restriction to a single query is not a problem * in practice. * * For SQL cursors, we support three kinds of scroll behavior: * * (1) Neither NO SCROLL nor SCROLL was specified: to remain backward * compatible, we allow backward fetches here, unless it would * impose additional runtime overhead to do so. * * (2) NO SCROLL was specified: don't allow any backward fetches. * * (3) SCROLL was specified: allow all kinds of backward fetches, even * if we need to take a performance hit to do so. (The planner sticks * a Materialize node atop the query plan if needed.) * * Case #1 is converted to #2 or #3 by looking at the query itself and * determining if scrollability can be supported without additional * overhead. * * Protocol-level portals have no nonsequential-fetch API and so the * distinction doesn't matter for them. They are always initialized * to look like NO SCROLL cursors. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/portal.h * *------------------------------------------------------------------------- */ #ifndef PORTAL_H #define PORTAL_H #include "datatype/timestamp.h" #include "executor/execdesc.h" #include "utils/resowner.h" /* * We have several execution strategies for Portals, depending on what * query or queries are to be executed. (Note: in all cases, a Portal * executes just a single source-SQL query, and thus produces just a * single result from the user's viewpoint. However, the rule rewriter * may expand the single source query to zero or many actual queries.) * * PORTAL_ONE_SELECT: the portal contains one single SELECT query. We run * the Executor incrementally as results are demanded. This strategy also * supports holdable cursors (the Executor results can be dumped into a * tuplestore for access after transaction completion). * * PORTAL_ONE_RETURNING: the portal contains a single INSERT/UPDATE/DELETE * query with a RETURNING clause (plus possibly auxiliary queries added by * rule rewriting). On first execution, we run the portal to completion * and dump the primary query's results into the portal tuplestore; the * results are then returned to the client as demanded. (We can't support * suspension of the query partway through, because the AFTER TRIGGER code * can't cope, and also because we don't want to risk failing to execute * all the auxiliary queries.) * * PORTAL_ONE_MOD_WITH: the portal contains one single SELECT query, but * it has data-modifying CTEs. This is currently treated the same as the * PORTAL_ONE_RETURNING case because of the possibility of needing to fire * triggers. It may act more like PORTAL_ONE_SELECT in future. * * PORTAL_UTIL_SELECT: the portal contains a utility statement that returns * a SELECT-like result (for example, EXPLAIN or SHOW). On first execution, * we run the statement and dump its results into the portal tuplestore; * the results are then returned to the client as demanded. * * PORTAL_MULTI_QUERY: all other cases. Here, we do not support partial * execution: the portal's queries will be run to completion on first call. */ typedef enum PortalStrategy { PORTAL_ONE_SELECT, PORTAL_ONE_RETURNING, PORTAL_ONE_MOD_WITH, PORTAL_UTIL_SELECT, PORTAL_MULTI_QUERY } PortalStrategy; /* * A portal is always in one of these states. It is possible to transit * from ACTIVE back to READY if the query is not run to completion; * otherwise we never back up in status. */ typedef enum PortalStatus { PORTAL_NEW, /* freshly created */ PORTAL_DEFINED, /* PortalDefineQuery done */ PORTAL_READY, /* PortalStart complete, can run it */ PORTAL_ACTIVE, /* portal is running (can't delete it) */ PORTAL_DONE, /* portal is finished (don't re-run it) */ PORTAL_FAILED /* portal got error (can't re-run it) */ } PortalStatus; typedef struct PortalData *Portal; typedef struct PortalData { /* Bookkeeping data */ const char *name; /* portal's name */ const char *prepStmtName; /* source prepared statement (NULL if none) */ MemoryContext heap; /* subsidiary memory for portal */ ResourceOwner resowner; /* resources owned by portal */ void (*cleanup) (Portal portal); /* cleanup hook */ /* * State data for remembering which subtransaction(s) the portal was * created or used in. If the portal is held over from a previous * transaction, both subxids are InvalidSubTransactionId. Otherwise, * createSubid is the creating subxact and activeSubid is the last subxact * in which we ran the portal. */ SubTransactionId createSubid; /* the creating subxact */ /* The query or queries the portal will execute */ const char *sourceText; /* text of query (as of 8.4, never NULL) */ const char *commandTag; /* command tag for original query */ List *stmts; /* PlannedStmts and/or utility statements */ CachedPlan *cplan; /* CachedPlan, if stmts are from one */ ParamListInfo portalParams; /* params to pass to query */ /* Features/options */ PortalStrategy strategy; /* see above */ int cursorOptions; /* DECLARE CURSOR option bits */ /* Status data */ PortalStatus status; /* see above */ bool portalPinned; /* a pinned portal can't be dropped */ /* If not NULL, Executor is active; call ExecutorEnd eventually: */ QueryDesc *queryDesc; /* info needed for executor invocation */ /* If portal returns tuples, this is their tupdesc: */ TupleDesc tupDesc; /* descriptor for result tuples */ /* and these are the format codes to use for the columns: */ int16 *formats; /* a format code for each column */ /* * Where we store tuples for a held cursor or a PORTAL_ONE_RETURNING or * PORTAL_UTIL_SELECT query. (A cursor held past the end of its * transaction no longer has any active executor state.) */ Tuplestorestate *holdStore; /* store for holdable cursors */ MemoryContext holdContext; /* memory containing holdStore */ /* * atStart, atEnd and portalPos indicate the current cursor position. * portalPos is zero before the first row, N after fetching N'th row of * query. After we run off the end, portalPos = # of rows in query, and * atEnd is true. If portalPos overflows, set posOverflow (this causes us * to stop relying on its value for navigation). Note that atStart * implies portalPos == 0, but not the reverse (portalPos could have * overflowed). */ bool atStart; bool atEnd; bool posOverflow; long portalPos; /* Presentation data, primarily used by the pg_cursors system view */ TimestampTz creation_time; /* time at which this portal was defined */ bool visible; /* include this portal in pg_cursors? */ /* * This field belongs with createSubid, but in pre-9.5 branches, add it * at the end to avoid creating an ABI break for extensions that examine * Portal structs. */ SubTransactionId activeSubid; /* the last subxact with activity */ } PortalData; /* * PortalIsValid * True iff portal is valid. */ #define PortalIsValid(p) PointerIsValid(p) /* * Access macros for Portal ... use these in preference to field access. */ #define PortalGetQueryDesc(portal) ((portal)->queryDesc) #define PortalGetHeapMemory(portal) ((portal)->heap) #define PortalGetPrimaryStmt(portal) PortalListGetPrimaryStmt((portal)->stmts) /* Prototypes for functions in utils/mmgr/portalmem.c */ extern void EnablePortalManager(void); extern bool PreCommit_Portals(bool isPrepare); extern void AtAbort_Portals(void); extern void AtCleanup_Portals(void); extern void AtSubCommit_Portals(SubTransactionId mySubid, SubTransactionId parentSubid, ResourceOwner parentXactOwner); extern void AtSubAbort_Portals(SubTransactionId mySubid, SubTransactionId parentSubid, ResourceOwner myXactOwner, ResourceOwner parentXactOwner); extern void AtSubCleanup_Portals(SubTransactionId mySubid); extern Portal CreatePortal(const char *name, bool allowDup, bool dupSilent); extern Portal CreateNewPortal(void); extern void PinPortal(Portal portal); extern void UnpinPortal(Portal portal); extern void MarkPortalActive(Portal portal); extern void MarkPortalDone(Portal portal); extern void MarkPortalFailed(Portal portal); extern void PortalDrop(Portal portal, bool isTopCommit); extern Portal GetPortalByName(const char *name); extern void PortalDefineQuery(Portal portal, const char *prepStmtName, const char *sourceText, const char *commandTag, List *stmts, CachedPlan *cplan); extern Node *PortalListGetPrimaryStmt(List *stmts); extern void PortalCreateHoldStore(Portal portal); extern void PortalHashTableDeleteAll(void); #endif /* PORTAL_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/syscache.h�����������������������������������������������������������������������0000644�����������������00000013013�14763166026�0012324 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * syscache.h * System catalog cache definitions. * * See also lsyscache.h, which provides convenience routines for * common cache-lookup operations. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/syscache.h * *------------------------------------------------------------------------- */ #ifndef SYSCACHE_H #define SYSCACHE_H #include "utils/catcache.h" /* * SysCache identifiers. * * The order of these identifiers must match the order * of the entries in the array cacheinfo[] in syscache.c. * Keep them in alphabetical order (renumbering only costs a * backend rebuild). */ enum SysCacheIdentifier { AGGFNOID = 0, AMNAME, AMOID, AMOPOPID, AMOPSTRATEGY, AMPROCNUM, ATTNAME, ATTNUM, AUTHMEMMEMROLE, AUTHMEMROLEMEM, AUTHNAME, AUTHOID, CASTSOURCETARGET, CLAAMNAMENSP, CLAOID, COLLNAMEENCNSP, COLLOID, CONDEFAULT, CONNAMENSP, CONSTROID, CONVOID, DATABASEOID, DEFACLROLENSPOBJ, ENUMOID, ENUMTYPOIDNAME, FOREIGNDATAWRAPPERNAME, FOREIGNDATAWRAPPEROID, FOREIGNSERVERNAME, FOREIGNSERVEROID, FOREIGNTABLEREL, INDEXRELID, LANGNAME, LANGOID, NAMESPACENAME, NAMESPACEOID, OPERNAMENSP, OPEROID, OPFAMILYAMNAMENSP, OPFAMILYOID, PROCNAMEARGSNSP, PROCOID, RANGETYPE, RELNAMENSP, RELOID, RULERELNAME, STATRELATTINH, TABLESPACEOID, TSCONFIGMAP, TSCONFIGNAMENSP, TSCONFIGOID, TSDICTNAMENSP, TSDICTOID, TSPARSERNAMENSP, TSPARSEROID, TSTEMPLATENAMENSP, TSTEMPLATEOID, TYPENAMENSP, TYPEOID, USERMAPPINGOID, USERMAPPINGUSERSERVER }; extern void InitCatalogCache(void); extern void InitCatalogCachePhase2(void); extern HeapTuple SearchSysCache(int cacheId, Datum key1, Datum key2, Datum key3, Datum key4); extern void ReleaseSysCache(HeapTuple tuple); /* convenience routines */ extern HeapTuple SearchSysCacheCopy(int cacheId, Datum key1, Datum key2, Datum key3, Datum key4); extern bool SearchSysCacheExists(int cacheId, Datum key1, Datum key2, Datum key3, Datum key4); extern Oid GetSysCacheOid(int cacheId, Datum key1, Datum key2, Datum key3, Datum key4); extern HeapTuple SearchSysCacheAttName(Oid relid, const char *attname); extern HeapTuple SearchSysCacheCopyAttName(Oid relid, const char *attname); extern bool SearchSysCacheExistsAttName(Oid relid, const char *attname); extern Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull); extern uint32 GetSysCacheHashValue(int cacheId, Datum key1, Datum key2, Datum key3, Datum key4); /* list-search interface. Users of this must import catcache.h too */ extern struct catclist *SearchSysCacheList(int cacheId, int nkeys, Datum key1, Datum key2, Datum key3, Datum key4); extern bool RelationSupportsSysCache(Oid relid); /* * The use of the macros below rather than direct calls to the corresponding * functions is encouraged, as it insulates the caller from changes in the * maximum number of keys. */ #define SearchSysCache1(cacheId, key1) \ SearchSysCache(cacheId, key1, 0, 0, 0) #define SearchSysCache2(cacheId, key1, key2) \ SearchSysCache(cacheId, key1, key2, 0, 0) #define SearchSysCache3(cacheId, key1, key2, key3) \ SearchSysCache(cacheId, key1, key2, key3, 0) #define SearchSysCache4(cacheId, key1, key2, key3, key4) \ SearchSysCache(cacheId, key1, key2, key3, key4) #define SearchSysCacheCopy1(cacheId, key1) \ SearchSysCacheCopy(cacheId, key1, 0, 0, 0) #define SearchSysCacheCopy2(cacheId, key1, key2) \ SearchSysCacheCopy(cacheId, key1, key2, 0, 0) #define SearchSysCacheCopy3(cacheId, key1, key2, key3) \ SearchSysCacheCopy(cacheId, key1, key2, key3, 0) #define SearchSysCacheCopy4(cacheId, key1, key2, key3, key4) \ SearchSysCacheCopy(cacheId, key1, key2, key3, key4) #define SearchSysCacheExists1(cacheId, key1) \ SearchSysCacheExists(cacheId, key1, 0, 0, 0) #define SearchSysCacheExists2(cacheId, key1, key2) \ SearchSysCacheExists(cacheId, key1, key2, 0, 0) #define SearchSysCacheExists3(cacheId, key1, key2, key3) \ SearchSysCacheExists(cacheId, key1, key2, key3, 0) #define SearchSysCacheExists4(cacheId, key1, key2, key3, key4) \ SearchSysCacheExists(cacheId, key1, key2, key3, key4) #define GetSysCacheOid1(cacheId, key1) \ GetSysCacheOid(cacheId, key1, 0, 0, 0) #define GetSysCacheOid2(cacheId, key1, key2) \ GetSysCacheOid(cacheId, key1, key2, 0, 0) #define GetSysCacheOid3(cacheId, key1, key2, key3) \ GetSysCacheOid(cacheId, key1, key2, key3, 0) #define GetSysCacheOid4(cacheId, key1, key2, key3, key4) \ GetSysCacheOid(cacheId, key1, key2, key3, key4) #define GetSysCacheHashValue1(cacheId, key1) \ GetSysCacheHashValue(cacheId, key1, 0, 0, 0) #define GetSysCacheHashValue2(cacheId, key1, key2) \ GetSysCacheHashValue(cacheId, key1, key2, 0, 0) #define GetSysCacheHashValue3(cacheId, key1, key2, key3) \ GetSysCacheHashValue(cacheId, key1, key2, key3, 0) #define GetSysCacheHashValue4(cacheId, key1, key2, key3, key4) \ GetSysCacheHashValue(cacheId, key1, key2, key3, key4) #define SearchSysCacheList1(cacheId, key1) \ SearchSysCacheList(cacheId, 1, key1, 0, 0, 0) #define SearchSysCacheList2(cacheId, key1, key2) \ SearchSysCacheList(cacheId, 2, key1, key2, 0, 0) #define SearchSysCacheList3(cacheId, key1, key2, key3) \ SearchSysCacheList(cacheId, 3, key1, key2, key3, 0) #define SearchSysCacheList4(cacheId, key1, key2, key3, key4) \ SearchSysCacheList(cacheId, 4, key1, key2, key3, key4) #define ReleaseSysCacheList(x) ReleaseCatCacheList(x) #endif /* SYSCACHE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/rel.h����������������������������������������������������������������������������0000644�����������������00000030425�14763166026�0011312 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * rel.h * POSTGRES relation descriptor (a/k/a relcache entry) definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/rel.h * *------------------------------------------------------------------------- */ #ifndef REL_H #define REL_H #include "access/tupdesc.h" #include "catalog/pg_am.h" #include "catalog/pg_class.h" #include "catalog/pg_index.h" #include "fmgr.h" #include "nodes/bitmapset.h" #include "rewrite/prs2lock.h" #include "storage/block.h" #include "storage/relfilenode.h" #include "utils/relcache.h" #include "utils/reltrigger.h" /* * LockRelId and LockInfo really belong to lmgr.h, but it's more convenient * to declare them here so we can have a LockInfoData field in a Relation. */ typedef struct LockRelId { Oid relId; /* a relation identifier */ Oid dbId; /* a database identifier */ } LockRelId; typedef struct LockInfoData { LockRelId lockRelId; } LockInfoData; typedef LockInfoData *LockInfo; /* * Cached lookup information for the index access method functions defined * by the pg_am row associated with an index relation. */ typedef struct RelationAmInfo { FmgrInfo aminsert; FmgrInfo ambeginscan; FmgrInfo amgettuple; FmgrInfo amgetbitmap; FmgrInfo amrescan; FmgrInfo amendscan; FmgrInfo ammarkpos; FmgrInfo amrestrpos; FmgrInfo ambuild; FmgrInfo ambuildempty; FmgrInfo ambulkdelete; FmgrInfo amvacuumcleanup; FmgrInfo amcanreturn; FmgrInfo amcostestimate; FmgrInfo amoptions; } RelationAmInfo; /* * Here are the contents of a relation cache entry. */ typedef struct RelationData { RelFileNode rd_node; /* relation physical identifier */ /* use "struct" here to avoid needing to include smgr.h: */ struct SMgrRelationData *rd_smgr; /* cached file handle, or NULL */ int rd_refcnt; /* reference count */ BackendId rd_backend; /* owning backend id, if temporary relation */ bool rd_isnailed; /* rel is nailed in cache */ bool rd_isvalid; /* relcache entry is valid */ char rd_indexvalid; /* state of rd_indexlist: 0 = not valid, 1 = * valid, 2 = temporarily forced */ bool rd_islocaltemp; /* rel is a temp rel of this session */ /* * rd_createSubid is the ID of the highest subtransaction the rel has * survived into; or zero if the rel was not created in the current top * transaction. This should be relied on only for optimization purposes; * it is possible for new-ness to be "forgotten" (eg, after CLUSTER). * Likewise, rd_newRelfilenodeSubid is the ID of the highest * subtransaction the relfilenode change has survived into, or zero if not * changed in the current transaction (or we have forgotten changing it). */ SubTransactionId rd_createSubid; /* rel was created in current xact */ SubTransactionId rd_newRelfilenodeSubid; /* new relfilenode assigned in * current xact */ Form_pg_class rd_rel; /* RELATION tuple */ TupleDesc rd_att; /* tuple descriptor */ Oid rd_id; /* relation's object id */ List *rd_indexlist; /* list of OIDs of indexes on relation */ Bitmapset *rd_indexattr; /* identifies columns used in indexes */ Oid rd_oidindex; /* OID of unique index on OID, if any */ LockInfoData rd_lockInfo; /* lock mgr's info for locking relation */ RuleLock *rd_rules; /* rewrite rules */ MemoryContext rd_rulescxt; /* private memory cxt for rd_rules, if any */ TriggerDesc *trigdesc; /* Trigger info, or NULL if rel has none */ /* * rd_options is set whenever rd_rel is loaded into the relcache entry. * Note that you can NOT look into rd_rel for this data. NULL means "use * defaults". */ bytea *rd_options; /* parsed pg_class.reloptions */ /* These are non-NULL only for an index relation: */ Form_pg_index rd_index; /* pg_index tuple describing this index */ /* use "struct" here to avoid needing to include htup.h: */ struct HeapTupleData *rd_indextuple; /* all of pg_index tuple */ Form_pg_am rd_am; /* pg_am tuple for index's AM */ /* * index access support info (used only for an index relation) * * Note: only default support procs for each opclass are cached, namely * those with lefttype and righttype equal to the opclass's opcintype. The * arrays are indexed by support function number, which is a sufficient * identifier given that restriction. * * Note: rd_amcache is available for index AMs to cache private data about * an index. This must be just a cache since it may get reset at any time * (in particular, it will get reset by a relcache inval message for the * index). If used, it must point to a single memory chunk palloc'd in * rd_indexcxt. A relcache reset will include freeing that chunk and * setting rd_amcache = NULL. */ MemoryContext rd_indexcxt; /* private memory cxt for this stuff */ RelationAmInfo *rd_aminfo; /* lookup info for funcs found in pg_am */ Oid *rd_opfamily; /* OIDs of op families for each index col */ Oid *rd_opcintype; /* OIDs of opclass declared input data types */ RegProcedure *rd_support; /* OIDs of support procedures */ FmgrInfo *rd_supportinfo; /* lookup info for support procedures */ int16 *rd_indoption; /* per-column AM-specific flags */ List *rd_indexprs; /* index expression trees, if any */ List *rd_indpred; /* index predicate tree, if any */ Oid *rd_exclops; /* OIDs of exclusion operators, if any */ Oid *rd_exclprocs; /* OIDs of exclusion ops' procs, if any */ uint16 *rd_exclstrats; /* exclusion ops' strategy numbers, if any */ void *rd_amcache; /* available for use by index AM */ Oid *rd_indcollation; /* OIDs of index collations */ /* * Hack for CLUSTER, rewriting ALTER TABLE, etc: when writing a new * version of a table, we need to make any toast pointers inserted into it * have the existing toast table's OID, not the OID of the transient toast * table. If rd_toastoid isn't InvalidOid, it is the OID to place in * toast pointers inserted into this rel. (Note it's set on the new * version of the main heap, not the toast table itself.) This also * causes toast_save_datum() to try to preserve toast value OIDs. */ Oid rd_toastoid; /* Real TOAST table's OID, or InvalidOid */ /* use "struct" here to avoid needing to include pgstat.h: */ struct PgStat_TableStatus *pgstat_info; /* statistics collection area */ } RelationData; /* * StdRdOptions * Standard contents of rd_options for heaps and generic indexes. * * RelationGetFillFactor() and RelationGetTargetPageFreeSpace() can only * be applied to relations that use this format or a superset for * private options data. */ /* autovacuum-related reloptions. */ typedef struct AutoVacOpts { bool enabled; int vacuum_threshold; int analyze_threshold; int vacuum_cost_delay; int vacuum_cost_limit; int freeze_min_age; int freeze_max_age; int freeze_table_age; float8 vacuum_scale_factor; float8 analyze_scale_factor; } AutoVacOpts; typedef struct StdRdOptions { int32 vl_len_; /* varlena header (do not touch directly!) */ int fillfactor; /* page fill factor in percent (0..100) */ AutoVacOpts autovacuum; /* autovacuum-related options */ bool security_barrier; /* for views */ } StdRdOptions; #define HEAP_MIN_FILLFACTOR 10 #define HEAP_DEFAULT_FILLFACTOR 100 /* * RelationGetFillFactor * Returns the relation's fillfactor. Note multiple eval of argument! */ #define RelationGetFillFactor(relation, defaultff) \ ((relation)->rd_options ? \ ((StdRdOptions *) (relation)->rd_options)->fillfactor : (defaultff)) /* * RelationGetTargetPageUsage * Returns the relation's desired space usage per page in bytes. */ #define RelationGetTargetPageUsage(relation, defaultff) \ (BLCKSZ * RelationGetFillFactor(relation, defaultff) / 100) /* * RelationGetTargetPageFreeSpace * Returns the relation's desired freespace per page in bytes. */ #define RelationGetTargetPageFreeSpace(relation, defaultff) \ (BLCKSZ * (100 - RelationGetFillFactor(relation, defaultff)) / 100) /* * RelationIsSecurityView * Returns whether the relation is security view, or not */ #define RelationIsSecurityView(relation) \ ((relation)->rd_options ? \ ((StdRdOptions *) (relation)->rd_options)->security_barrier : false) /* * RelationIsValid * True iff relation descriptor is valid. */ #define RelationIsValid(relation) PointerIsValid(relation) #define InvalidRelation ((Relation) NULL) /* * RelationHasReferenceCountZero * True iff relation reference count is zero. * * Note: * Assumes relation descriptor is valid. */ #define RelationHasReferenceCountZero(relation) \ ((bool)((relation)->rd_refcnt == 0)) /* * RelationGetForm * Returns pg_class tuple for a relation. * * Note: * Assumes relation descriptor is valid. */ #define RelationGetForm(relation) ((relation)->rd_rel) /* * RelationGetRelid * Returns the OID of the relation */ #define RelationGetRelid(relation) ((relation)->rd_id) /* * RelationGetNumberOfAttributes * Returns the number of attributes in a relation. */ #define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts) /* * RelationGetDescr * Returns tuple descriptor for a relation. */ #define RelationGetDescr(relation) ((relation)->rd_att) /* * RelationGetRelationName * Returns the rel's name. * * Note that the name is only unique within the containing namespace. */ #define RelationGetRelationName(relation) \ (NameStr((relation)->rd_rel->relname)) /* * RelationGetNamespace * Returns the rel's namespace OID. */ #define RelationGetNamespace(relation) \ ((relation)->rd_rel->relnamespace) /* * RelationIsMapped * True if the relation uses the relfilenode map. * * NB: this is only meaningful for relkinds that have storage, else it * will misleadingly say "true". */ #define RelationIsMapped(relation) \ ((relation)->rd_rel->relfilenode == InvalidOid) /* * RelationOpenSmgr * Open the relation at the smgr level, if not already done. */ #define RelationOpenSmgr(relation) \ do { \ if ((relation)->rd_smgr == NULL) \ smgrsetowner(&((relation)->rd_smgr), smgropen((relation)->rd_node, (relation)->rd_backend)); \ } while (0) /* * RelationCloseSmgr * Close the relation at the smgr level, if not already done. * * Note: smgrclose should unhook from owner pointer, hence the Assert. */ #define RelationCloseSmgr(relation) \ do { \ if ((relation)->rd_smgr != NULL) \ { \ smgrclose((relation)->rd_smgr); \ Assert((relation)->rd_smgr == NULL); \ } \ } while (0) /* * RelationGetTargetBlock * Fetch relation's current insertion target block. * * Returns InvalidBlockNumber if there is no current target block. Note * that the target block status is discarded on any smgr-level invalidation. */ #define RelationGetTargetBlock(relation) \ ( (relation)->rd_smgr != NULL ? (relation)->rd_smgr->smgr_targblock : InvalidBlockNumber ) /* * RelationSetTargetBlock * Set relation's current insertion target block. */ #define RelationSetTargetBlock(relation, targblock) \ do { \ RelationOpenSmgr(relation); \ (relation)->rd_smgr->smgr_targblock = (targblock); \ } while (0) /* * RelationNeedsWAL * True if relation needs WAL. */ #define RelationNeedsWAL(relation) \ ((relation)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT) /* * RelationUsesLocalBuffers * True if relation's pages are stored in local buffers. */ #define RelationUsesLocalBuffers(relation) \ ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP) /* * RELATION_IS_LOCAL * If a rel is either temp or newly created in the current transaction, * it can be assumed to be accessible only to the current backend. * This is typically used to decide that we can skip acquiring locks. * * Beware of multiple eval of argument */ #define RELATION_IS_LOCAL(relation) \ ((relation)->rd_islocaltemp || \ (relation)->rd_createSubid != InvalidSubTransactionId) /* * RELATION_IS_OTHER_TEMP * Test for a temporary relation that belongs to some other session. * * Beware of multiple eval of argument */ #define RELATION_IS_OTHER_TEMP(relation) \ ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP && \ !(relation)->rd_islocaltemp) /* routines in utils/cache/relcache.c */ extern void RelationIncrementReferenceCount(Relation rel); extern void RelationDecrementReferenceCount(Relation rel); #endif /* REL_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/date.h���������������������������������������������������������������������������0000644�����������������00000017357�14763166026�0011456 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * date.h * Definitions for the SQL92 "date" and "time" types. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/date.h * *------------------------------------------------------------------------- */ #ifndef DATE_H #define DATE_H #include <math.h> #include "fmgr.h" typedef int32 DateADT; #ifdef HAVE_INT64_TIMESTAMP typedef int64 TimeADT; #else typedef float8 TimeADT; #endif typedef struct { TimeADT time; /* all time units other than months and years */ int32 zone; /* numeric time zone, in seconds */ } TimeTzADT; /* * Infinity and minus infinity must be the max and min values of DateADT. * We could use INT_MIN and INT_MAX here, but seems better to not assume that * int32 == int. */ #define DATEVAL_NOBEGIN ((DateADT) (-0x7fffffff - 1)) #define DATEVAL_NOEND ((DateADT) 0x7fffffff) #define DATE_NOBEGIN(j) ((j) = DATEVAL_NOBEGIN) #define DATE_IS_NOBEGIN(j) ((j) == DATEVAL_NOBEGIN) #define DATE_NOEND(j) ((j) = DATEVAL_NOEND) #define DATE_IS_NOEND(j) ((j) == DATEVAL_NOEND) #define DATE_NOT_FINITE(j) (DATE_IS_NOBEGIN(j) || DATE_IS_NOEND(j)) /* * Macros for fmgr-callable functions. * * For TimeADT, we make use of the same support routines as for float8 or int64. * Therefore TimeADT is pass-by-reference if and only if float8 or int64 is! */ #ifdef HAVE_INT64_TIMESTAMP #define MAX_TIME_PRECISION 6 #define DatumGetDateADT(X) ((DateADT) DatumGetInt32(X)) #define DatumGetTimeADT(X) ((TimeADT) DatumGetInt64(X)) #define DatumGetTimeTzADTP(X) ((TimeTzADT *) DatumGetPointer(X)) #define DateADTGetDatum(X) Int32GetDatum(X) #define TimeADTGetDatum(X) Int64GetDatum(X) #define TimeTzADTPGetDatum(X) PointerGetDatum(X) #else /* !HAVE_INT64_TIMESTAMP */ #define MAX_TIME_PRECISION 10 /* round off to MAX_TIME_PRECISION decimal places */ #define TIME_PREC_INV 10000000000.0 #define TIMEROUND(j) (rint(((double) (j)) * TIME_PREC_INV) / TIME_PREC_INV) #define DatumGetDateADT(X) ((DateADT) DatumGetInt32(X)) #define DatumGetTimeADT(X) ((TimeADT) DatumGetFloat8(X)) #define DatumGetTimeTzADTP(X) ((TimeTzADT *) DatumGetPointer(X)) #define DateADTGetDatum(X) Int32GetDatum(X) #define TimeADTGetDatum(X) Float8GetDatum(X) #define TimeTzADTPGetDatum(X) PointerGetDatum(X) #endif /* HAVE_INT64_TIMESTAMP */ #define PG_GETARG_DATEADT(n) DatumGetDateADT(PG_GETARG_DATUM(n)) #define PG_GETARG_TIMEADT(n) DatumGetTimeADT(PG_GETARG_DATUM(n)) #define PG_GETARG_TIMETZADT_P(n) DatumGetTimeTzADTP(PG_GETARG_DATUM(n)) #define PG_RETURN_DATEADT(x) return DateADTGetDatum(x) #define PG_RETURN_TIMEADT(x) return TimeADTGetDatum(x) #define PG_RETURN_TIMETZADT_P(x) return TimeTzADTPGetDatum(x) /* date.c */ extern double date2timestamp_no_overflow(DateADT dateVal); extern Datum date_in(PG_FUNCTION_ARGS); extern Datum date_out(PG_FUNCTION_ARGS); extern Datum date_recv(PG_FUNCTION_ARGS); extern Datum date_send(PG_FUNCTION_ARGS); extern Datum date_eq(PG_FUNCTION_ARGS); extern Datum date_ne(PG_FUNCTION_ARGS); extern Datum date_lt(PG_FUNCTION_ARGS); extern Datum date_le(PG_FUNCTION_ARGS); extern Datum date_gt(PG_FUNCTION_ARGS); extern Datum date_ge(PG_FUNCTION_ARGS); extern Datum date_cmp(PG_FUNCTION_ARGS); extern Datum date_sortsupport(PG_FUNCTION_ARGS); extern Datum date_finite(PG_FUNCTION_ARGS); extern Datum date_larger(PG_FUNCTION_ARGS); extern Datum date_smaller(PG_FUNCTION_ARGS); extern Datum date_mi(PG_FUNCTION_ARGS); extern Datum date_pli(PG_FUNCTION_ARGS); extern Datum date_mii(PG_FUNCTION_ARGS); extern Datum date_eq_timestamp(PG_FUNCTION_ARGS); extern Datum date_ne_timestamp(PG_FUNCTION_ARGS); extern Datum date_lt_timestamp(PG_FUNCTION_ARGS); extern Datum date_le_timestamp(PG_FUNCTION_ARGS); extern Datum date_gt_timestamp(PG_FUNCTION_ARGS); extern Datum date_ge_timestamp(PG_FUNCTION_ARGS); extern Datum date_cmp_timestamp(PG_FUNCTION_ARGS); extern Datum date_eq_timestamptz(PG_FUNCTION_ARGS); extern Datum date_ne_timestamptz(PG_FUNCTION_ARGS); extern Datum date_lt_timestamptz(PG_FUNCTION_ARGS); extern Datum date_le_timestamptz(PG_FUNCTION_ARGS); extern Datum date_gt_timestamptz(PG_FUNCTION_ARGS); extern Datum date_ge_timestamptz(PG_FUNCTION_ARGS); extern Datum date_cmp_timestamptz(PG_FUNCTION_ARGS); extern Datum timestamp_eq_date(PG_FUNCTION_ARGS); extern Datum timestamp_ne_date(PG_FUNCTION_ARGS); extern Datum timestamp_lt_date(PG_FUNCTION_ARGS); extern Datum timestamp_le_date(PG_FUNCTION_ARGS); extern Datum timestamp_gt_date(PG_FUNCTION_ARGS); extern Datum timestamp_ge_date(PG_FUNCTION_ARGS); extern Datum timestamp_cmp_date(PG_FUNCTION_ARGS); extern Datum timestamptz_eq_date(PG_FUNCTION_ARGS); extern Datum timestamptz_ne_date(PG_FUNCTION_ARGS); extern Datum timestamptz_lt_date(PG_FUNCTION_ARGS); extern Datum timestamptz_le_date(PG_FUNCTION_ARGS); extern Datum timestamptz_gt_date(PG_FUNCTION_ARGS); extern Datum timestamptz_ge_date(PG_FUNCTION_ARGS); extern Datum timestamptz_cmp_date(PG_FUNCTION_ARGS); extern Datum date_pl_interval(PG_FUNCTION_ARGS); extern Datum date_mi_interval(PG_FUNCTION_ARGS); extern Datum date_timestamp(PG_FUNCTION_ARGS); extern Datum timestamp_date(PG_FUNCTION_ARGS); extern Datum date_timestamptz(PG_FUNCTION_ARGS); extern Datum timestamptz_date(PG_FUNCTION_ARGS); extern Datum datetime_timestamp(PG_FUNCTION_ARGS); extern Datum abstime_date(PG_FUNCTION_ARGS); extern Datum time_in(PG_FUNCTION_ARGS); extern Datum time_out(PG_FUNCTION_ARGS); extern Datum time_recv(PG_FUNCTION_ARGS); extern Datum time_send(PG_FUNCTION_ARGS); extern Datum timetypmodin(PG_FUNCTION_ARGS); extern Datum timetypmodout(PG_FUNCTION_ARGS); extern Datum time_transform(PG_FUNCTION_ARGS); extern Datum time_scale(PG_FUNCTION_ARGS); extern Datum time_eq(PG_FUNCTION_ARGS); extern Datum time_ne(PG_FUNCTION_ARGS); extern Datum time_lt(PG_FUNCTION_ARGS); extern Datum time_le(PG_FUNCTION_ARGS); extern Datum time_gt(PG_FUNCTION_ARGS); extern Datum time_ge(PG_FUNCTION_ARGS); extern Datum time_cmp(PG_FUNCTION_ARGS); extern Datum time_hash(PG_FUNCTION_ARGS); extern Datum overlaps_time(PG_FUNCTION_ARGS); extern Datum time_larger(PG_FUNCTION_ARGS); extern Datum time_smaller(PG_FUNCTION_ARGS); extern Datum time_mi_time(PG_FUNCTION_ARGS); extern Datum timestamp_time(PG_FUNCTION_ARGS); extern Datum timestamptz_time(PG_FUNCTION_ARGS); extern Datum time_interval(PG_FUNCTION_ARGS); extern Datum interval_time(PG_FUNCTION_ARGS); extern Datum time_pl_interval(PG_FUNCTION_ARGS); extern Datum time_mi_interval(PG_FUNCTION_ARGS); extern Datum time_part(PG_FUNCTION_ARGS); extern Datum timetz_in(PG_FUNCTION_ARGS); extern Datum timetz_out(PG_FUNCTION_ARGS); extern Datum timetz_recv(PG_FUNCTION_ARGS); extern Datum timetz_send(PG_FUNCTION_ARGS); extern Datum timetztypmodin(PG_FUNCTION_ARGS); extern Datum timetztypmodout(PG_FUNCTION_ARGS); extern Datum timetz_scale(PG_FUNCTION_ARGS); extern Datum timetz_eq(PG_FUNCTION_ARGS); extern Datum timetz_ne(PG_FUNCTION_ARGS); extern Datum timetz_lt(PG_FUNCTION_ARGS); extern Datum timetz_le(PG_FUNCTION_ARGS); extern Datum timetz_gt(PG_FUNCTION_ARGS); extern Datum timetz_ge(PG_FUNCTION_ARGS); extern Datum timetz_cmp(PG_FUNCTION_ARGS); extern Datum timetz_hash(PG_FUNCTION_ARGS); extern Datum overlaps_timetz(PG_FUNCTION_ARGS); extern Datum timetz_larger(PG_FUNCTION_ARGS); extern Datum timetz_smaller(PG_FUNCTION_ARGS); extern Datum timetz_time(PG_FUNCTION_ARGS); extern Datum time_timetz(PG_FUNCTION_ARGS); extern Datum timestamptz_timetz(PG_FUNCTION_ARGS); extern Datum datetimetz_timestamptz(PG_FUNCTION_ARGS); extern Datum timetz_part(PG_FUNCTION_ARGS); extern Datum timetz_zone(PG_FUNCTION_ARGS); extern Datum timetz_izone(PG_FUNCTION_ARGS); extern Datum timetz_pl_interval(PG_FUNCTION_ARGS); extern Datum timetz_mi_interval(PG_FUNCTION_ARGS); #endif /* DATE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/help_config.h��������������������������������������������������������������������0000644�����������������00000000660�14763166026�0013003 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * help_config.h * Interface to the --help-config option of main.c * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * * src/include/utils/help_config.h * *------------------------------------------------------------------------- */ #ifndef HELP_CONFIG_H #define HELP_CONFIG_H 1 extern int GucInfoMain(void); #endif ��������������������������������������������������������������������������������pgsql/server/utils/selfuncs.h�����������������������������������������������������������������������0000644�����������������00000017000�14763166026�0012344 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * selfuncs.h * Selectivity functions and index cost estimation functions for * standard operators and index access methods. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/selfuncs.h * *------------------------------------------------------------------------- */ #ifndef SELFUNCS_H #define SELFUNCS_H #include "fmgr.h" #include "access/htup.h" #include "nodes/relation.h" /* * Note: the default selectivity estimates are not chosen entirely at random. * We want them to be small enough to ensure that indexscans will be used if * available, for typical table densities of ~100 tuples/page. Thus, for * example, 0.01 is not quite small enough, since that makes it appear that * nearly all pages will be hit anyway. Also, since we sometimes estimate * eqsel as 1/num_distinct, we probably want DEFAULT_NUM_DISTINCT to equal * 1/DEFAULT_EQ_SEL. */ /* default selectivity estimate for equalities such as "A = b" */ #define DEFAULT_EQ_SEL 0.005 /* default selectivity estimate for inequalities such as "A < b" */ #define DEFAULT_INEQ_SEL 0.3333333333333333 /* default selectivity estimate for range inequalities "A > b AND A < c" */ #define DEFAULT_RANGE_INEQ_SEL 0.005 /* default selectivity estimate for pattern-match operators such as LIKE */ #define DEFAULT_MATCH_SEL 0.005 /* default number of distinct values in a table */ #define DEFAULT_NUM_DISTINCT 200 /* default selectivity estimate for boolean and null test nodes */ #define DEFAULT_UNK_SEL 0.005 #define DEFAULT_NOT_UNK_SEL (1.0 - DEFAULT_UNK_SEL) /* * Clamp a computed probability estimate (which may suffer from roundoff or * estimation errors) to valid range. Argument must be a float variable. */ #define CLAMP_PROBABILITY(p) \ do { \ if (p < 0.0) \ p = 0.0; \ else if (p > 1.0) \ p = 1.0; \ } while (0) /* Return data from examine_variable and friends */ typedef struct VariableStatData { Node *var; /* the Var or expression tree */ RelOptInfo *rel; /* Relation, or NULL if not identifiable */ HeapTuple statsTuple; /* pg_statistic tuple, or NULL if none */ /* NB: if statsTuple!=NULL, it must be freed when caller is done */ void (*freefunc) (HeapTuple tuple); /* how to free statsTuple */ Oid vartype; /* exposed type of expression */ Oid atttype; /* type to pass to get_attstatsslot */ int32 atttypmod; /* typmod to pass to get_attstatsslot */ bool isunique; /* matches unique index or DISTINCT clause */ bool acl_ok; /* result of ACL check on table or column */ } VariableStatData; #define ReleaseVariableStats(vardata) \ do { \ if (HeapTupleIsValid((vardata).statsTuple)) \ (* (vardata).freefunc) ((vardata).statsTuple); \ } while(0) typedef enum { Pattern_Type_Like, Pattern_Type_Like_IC, Pattern_Type_Regex, Pattern_Type_Regex_IC } Pattern_Type; typedef enum { Pattern_Prefix_None, Pattern_Prefix_Partial, Pattern_Prefix_Exact } Pattern_Prefix_Status; /* Hooks for plugins to get control when we ask for stats */ typedef bool (*get_relation_stats_hook_type) (PlannerInfo *root, RangeTblEntry *rte, AttrNumber attnum, VariableStatData *vardata); extern PGDLLIMPORT get_relation_stats_hook_type get_relation_stats_hook; typedef bool (*get_index_stats_hook_type) (PlannerInfo *root, Oid indexOid, AttrNumber indexattnum, VariableStatData *vardata); extern PGDLLIMPORT get_index_stats_hook_type get_index_stats_hook; /* Functions in selfuncs.c */ extern void examine_variable(PlannerInfo *root, Node *node, int varRelid, VariableStatData *vardata); extern bool statistic_proc_security_check(VariableStatData *vardata, Oid func_oid); extern bool get_restriction_variable(PlannerInfo *root, List *args, int varRelid, VariableStatData *vardata, Node **other, bool *varonleft); extern void get_join_variables(PlannerInfo *root, List *args, SpecialJoinInfo *sjinfo, VariableStatData *vardata1, VariableStatData *vardata2, bool *join_is_reversed); extern double get_variable_numdistinct(VariableStatData *vardata, bool *isdefault); extern double mcv_selectivity(VariableStatData *vardata, FmgrInfo *opproc, Datum constval, bool varonleft, double *sumcommonp); extern double histogram_selectivity(VariableStatData *vardata, FmgrInfo *opproc, Datum constval, bool varonleft, int min_hist_size, int n_skip, int *hist_size); extern Pattern_Prefix_Status pattern_fixed_prefix(Const *patt, Pattern_Type ptype, Oid collation, Const **prefix, Selectivity *rest_selec); extern Const *make_greater_string(const Const *str_const, FmgrInfo *ltproc, Oid collation); extern Datum eqsel(PG_FUNCTION_ARGS); extern Datum neqsel(PG_FUNCTION_ARGS); extern Datum scalarltsel(PG_FUNCTION_ARGS); extern Datum scalargtsel(PG_FUNCTION_ARGS); extern Datum regexeqsel(PG_FUNCTION_ARGS); extern Datum icregexeqsel(PG_FUNCTION_ARGS); extern Datum likesel(PG_FUNCTION_ARGS); extern Datum iclikesel(PG_FUNCTION_ARGS); extern Datum regexnesel(PG_FUNCTION_ARGS); extern Datum icregexnesel(PG_FUNCTION_ARGS); extern Datum nlikesel(PG_FUNCTION_ARGS); extern Datum icnlikesel(PG_FUNCTION_ARGS); extern Datum eqjoinsel(PG_FUNCTION_ARGS); extern Datum neqjoinsel(PG_FUNCTION_ARGS); extern Datum scalarltjoinsel(PG_FUNCTION_ARGS); extern Datum scalargtjoinsel(PG_FUNCTION_ARGS); extern Datum regexeqjoinsel(PG_FUNCTION_ARGS); extern Datum icregexeqjoinsel(PG_FUNCTION_ARGS); extern Datum likejoinsel(PG_FUNCTION_ARGS); extern Datum iclikejoinsel(PG_FUNCTION_ARGS); extern Datum regexnejoinsel(PG_FUNCTION_ARGS); extern Datum icregexnejoinsel(PG_FUNCTION_ARGS); extern Datum nlikejoinsel(PG_FUNCTION_ARGS); extern Datum icnlikejoinsel(PG_FUNCTION_ARGS); extern Selectivity booltestsel(PlannerInfo *root, BoolTestType booltesttype, Node *arg, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo); extern Selectivity nulltestsel(PlannerInfo *root, NullTestType nulltesttype, Node *arg, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo); extern Selectivity scalararraysel(PlannerInfo *root, ScalarArrayOpExpr *clause, bool is_join_clause, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo); extern int estimate_array_length(Node *arrayexpr); extern Selectivity rowcomparesel(PlannerInfo *root, RowCompareExpr *clause, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo); extern void mergejoinscansel(PlannerInfo *root, Node *clause, Oid opfamily, int strategy, bool nulls_first, Selectivity *leftstart, Selectivity *leftend, Selectivity *rightstart, Selectivity *rightend); extern double estimate_num_groups(PlannerInfo *root, List *groupExprs, double input_rows); extern Selectivity estimate_hash_bucketsize(PlannerInfo *root, Node *hashkey, double nbuckets); extern Datum btcostestimate(PG_FUNCTION_ARGS); extern Datum hashcostestimate(PG_FUNCTION_ARGS); extern Datum gistcostestimate(PG_FUNCTION_ARGS); extern Datum spgcostestimate(PG_FUNCTION_ARGS); extern Datum gincostestimate(PG_FUNCTION_ARGS); /* Functions in array_selfuncs.c */ extern Selectivity scalararraysel_containment(PlannerInfo *root, Node *leftop, Node *rightop, Oid elemtype, bool isEquality, bool useOr, int varRelid); extern Datum arraycontsel(PG_FUNCTION_ARGS); extern Datum arraycontjoinsel(PG_FUNCTION_ARGS); #endif /* SELFUNCS_H */ pgsql/server/utils/logtape.h������������������������������������������������������������������������0000644�����������������00000003003�14763166026�0012153 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * logtape.h * Management of "logical tapes" within temporary files. * * See logtape.c for explanations. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/logtape.h * *------------------------------------------------------------------------- */ #ifndef LOGTAPE_H #define LOGTAPE_H /* LogicalTapeSet is an opaque type whose details are not known outside logtape.c. */ typedef struct LogicalTapeSet LogicalTapeSet; /* * prototypes for functions in logtape.c */ extern LogicalTapeSet *LogicalTapeSetCreate(int ntapes); extern void LogicalTapeSetClose(LogicalTapeSet *lts); extern void LogicalTapeSetForgetFreeSpace(LogicalTapeSet *lts); extern size_t LogicalTapeRead(LogicalTapeSet *lts, int tapenum, void *ptr, size_t size); extern void LogicalTapeWrite(LogicalTapeSet *lts, int tapenum, void *ptr, size_t size); extern void LogicalTapeRewind(LogicalTapeSet *lts, int tapenum, bool forWrite); extern void LogicalTapeFreeze(LogicalTapeSet *lts, int tapenum); extern bool LogicalTapeBackspace(LogicalTapeSet *lts, int tapenum, size_t size); extern bool LogicalTapeSeek(LogicalTapeSet *lts, int tapenum, long blocknum, int offset); extern void LogicalTapeTell(LogicalTapeSet *lts, int tapenum, long *blocknum, int *offset); extern long LogicalTapeSetBlocks(LogicalTapeSet *lts); #endif /* LOGTAPE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/json.h���������������������������������������������������������������������������0000644�����������������00000001624�14763166026�0011500 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * json.h * Declarations for JSON data type support. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/json.h * *------------------------------------------------------------------------- */ #ifndef JSON_H #define JSON_H #include "fmgr.h" #include "lib/stringinfo.h" extern Datum json_in(PG_FUNCTION_ARGS); extern Datum json_out(PG_FUNCTION_ARGS); extern Datum json_recv(PG_FUNCTION_ARGS); extern Datum json_send(PG_FUNCTION_ARGS); extern Datum array_to_json(PG_FUNCTION_ARGS); extern Datum array_to_json_pretty(PG_FUNCTION_ARGS); extern Datum row_to_json(PG_FUNCTION_ARGS); extern Datum row_to_json_pretty(PG_FUNCTION_ARGS); extern void escape_json(StringInfo buf, const char *str); #endif /* JSON_H */ ������������������������������������������������������������������������������������������������������������pgsql/server/utils/datetime.h�����������������������������������������������������������������������0000644�����������������00000023654�14763166026�0012332 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * datetime.h * Definitions for date/time support code. * The support code is shared with other date data types, * including abstime, reltime, date, and time. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/datetime.h * *------------------------------------------------------------------------- */ #ifndef DATETIME_H #define DATETIME_H #include "nodes/nodes.h" #include "utils/timestamp.h" /* this struct is declared in utils/tzparser.h: */ struct tzEntry; /* ---------------------------------------------------------------- * time types + support macros * * String definitions for standard time quantities. * * These strings are the defaults used to form output time strings. * Other alternative forms are hardcoded into token tables in datetime.c. * ---------------------------------------------------------------- */ #define DAGO "ago" #define DCURRENT "current" #define EPOCH "epoch" #define INVALID "invalid" #define EARLY "-infinity" #define LATE "infinity" #define NOW "now" #define TODAY "today" #define TOMORROW "tomorrow" #define YESTERDAY "yesterday" #define ZULU "zulu" #define DMICROSEC "usecond" #define DMILLISEC "msecond" #define DSECOND "second" #define DMINUTE "minute" #define DHOUR "hour" #define DDAY "day" #define DWEEK "week" #define DMONTH "month" #define DQUARTER "quarter" #define DYEAR "year" #define DDECADE "decade" #define DCENTURY "century" #define DMILLENNIUM "millennium" #define DA_D "ad" #define DB_C "bc" #define DTIMEZONE "timezone" /* * Fundamental time field definitions for parsing. * * Meridian: am, pm, or 24-hour style. * Millennium: ad, bc */ #define AM 0 #define PM 1 #define HR24 2 #define AD 0 #define BC 1 /* * Field types for time decoding. * * Can't have more of these than there are bits in an unsigned int * since these are turned into bit masks during parsing and decoding. * * Furthermore, the values for YEAR, MONTH, DAY, HOUR, MINUTE, SECOND * must be in the range 0..14 so that the associated bitmasks can fit * into the left half of an INTERVAL's typmod value. Since those bits * are stored in typmods, you can't change them without initdb! */ #define RESERV 0 #define MONTH 1 #define YEAR 2 #define DAY 3 #define JULIAN 4 #define TZ 5 /* fixed-offset timezone abbreviation */ #define DTZ 6 /* fixed-offset timezone abbrev, DST */ #define DYNTZ 7 /* dynamic timezone abbreviation */ #define IGNORE_DTF 8 #define AMPM 9 #define HOUR 10 #define MINUTE 11 #define SECOND 12 #define MILLISECOND 13 #define MICROSECOND 14 #define DOY 15 #define DOW 16 #define UNITS 17 #define ADBC 18 /* these are only for relative dates */ #define AGO 19 #define ABS_BEFORE 20 #define ABS_AFTER 21 /* generic fields to help with parsing */ #define ISODATE 22 #define ISOTIME 23 /* these are only for parsing intervals */ #define WEEK 24 #define DECADE 25 #define CENTURY 26 #define MILLENNIUM 27 /* hack for parsing two-word timezone specs "MET DST" etc */ #define DTZMOD 28 /* "DST" as a separate word */ /* reserved for unrecognized string values */ #define UNKNOWN_FIELD 31 /* * Token field definitions for time parsing and decoding. * * Some field type codes (see above) use these as the "value" in datetktbl[]. * These are also used for bit masks in DecodeDateTime and friends * so actually restrict them to within [0,31] for now. * - thomas 97/06/19 * Not all of these fields are used for masks in DecodeDateTime * so allow some larger than 31. - thomas 1997-11-17 * * Caution: there are undocumented assumptions in the code that most of these * values are not equal to IGNORE_DTF nor RESERV. Be very careful when * renumbering values in either of these apparently-independent lists :-( */ #define DTK_NUMBER 0 #define DTK_STRING 1 #define DTK_DATE 2 #define DTK_TIME 3 #define DTK_TZ 4 #define DTK_AGO 5 #define DTK_SPECIAL 6 #define DTK_INVALID 7 #define DTK_CURRENT 8 #define DTK_EARLY 9 #define DTK_LATE 10 #define DTK_EPOCH 11 #define DTK_NOW 12 #define DTK_YESTERDAY 13 #define DTK_TODAY 14 #define DTK_TOMORROW 15 #define DTK_ZULU 16 #define DTK_DELTA 17 #define DTK_SECOND 18 #define DTK_MINUTE 19 #define DTK_HOUR 20 #define DTK_DAY 21 #define DTK_WEEK 22 #define DTK_MONTH 23 #define DTK_QUARTER 24 #define DTK_YEAR 25 #define DTK_DECADE 26 #define DTK_CENTURY 27 #define DTK_MILLENNIUM 28 #define DTK_MILLISEC 29 #define DTK_MICROSEC 30 #define DTK_JULIAN 31 #define DTK_DOW 32 #define DTK_DOY 33 #define DTK_TZ_HOUR 34 #define DTK_TZ_MINUTE 35 #define DTK_ISOYEAR 36 #define DTK_ISODOW 37 /* * Bit mask definitions for time parsing. */ #define DTK_M(t) (0x01 << (t)) /* Convenience: a second, plus any fractional component */ #define DTK_ALL_SECS_M (DTK_M(SECOND) | DTK_M(MILLISECOND) | DTK_M(MICROSECOND)) #define DTK_DATE_M (DTK_M(YEAR) | DTK_M(MONTH) | DTK_M(DAY)) #define DTK_TIME_M (DTK_M(HOUR) | DTK_M(MINUTE) | DTK_ALL_SECS_M) /* * Working buffer size for input and output of interval, timestamp, etc. * Inputs that need more working space will be rejected early. Longer outputs * will overrun buffers, so this must suffice for all possible output. As of * this writing, interval_out() needs the most space at ~90 bytes. */ #define MAXDATELEN 128 /* maximum possible number of fields in a date string */ #define MAXDATEFIELDS 25 /* only this many chars are stored in datetktbl */ #define TOKMAXLEN 10 /* keep this struct small; it gets used a lot */ typedef struct { char token[TOKMAXLEN + 1]; /* always NUL-terminated */ char type; /* see field type codes above */ int32 value; /* meaning depends on type */ } datetkn; /* one of its uses is in tables of time zone abbreviations */ typedef struct TimeZoneAbbrevTable { Size tblsize; /* size in bytes of TimeZoneAbbrevTable */ int numabbrevs; /* number of entries in abbrevs[] array */ datetkn abbrevs[1]; /* VARIABLE LENGTH ARRAY */ /* DynamicZoneAbbrev(s) may follow the abbrevs[] array */ } TimeZoneAbbrevTable; /* auxiliary data for a dynamic time zone abbreviation (non-fixed-offset) */ typedef struct DynamicZoneAbbrev { pg_tz *tz; /* NULL if not yet looked up */ char zone[1]; /* zone name (var length, NUL-terminated) */ } DynamicZoneAbbrev; /* FMODULO() * Macro to replace modf(), which is broken on some platforms. * t = input and remainder * q = integer part * u = divisor */ #define FMODULO(t,q,u) \ do { \ (q) = (((t) < 0) ? ceil((t) / (u)) : floor((t) / (u))); \ if ((q) != 0) (t) -= rint((q) * (u)); \ } while(0) /* TMODULO() * Like FMODULO(), but work on the timestamp datatype (either int64 or float8). * We assume that int64 follows the C99 semantics for division (negative * quotients truncate towards zero). */ #ifdef HAVE_INT64_TIMESTAMP #define TMODULO(t,q,u) \ do { \ (q) = ((t) / (u)); \ if ((q) != 0) (t) -= ((q) * (u)); \ } while(0) #else #define TMODULO(t,q,u) \ do { \ (q) = (((t) < 0) ? ceil((t) / (u)) : floor((t) / (u))); \ if ((q) != 0) (t) -= rint((q) * (u)); \ } while(0) #endif /* * Date/time validation * Include check for leap year. */ extern const int day_tab[2][13]; #define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) /* * Datetime input parsing routines (ParseDateTime, DecodeDateTime, etc) * return zero or a positive value on success. On failure, they return * one of these negative code values. DateTimeParseError may be used to * produce a correct ereport. */ #define DTERR_BAD_FORMAT (-1) #define DTERR_FIELD_OVERFLOW (-2) #define DTERR_MD_FIELD_OVERFLOW (-3) /* triggers hint about DateStyle */ #define DTERR_INTERVAL_OVERFLOW (-4) #define DTERR_TZDISP_OVERFLOW (-5) extern void GetCurrentDateTime(struct pg_tm * tm); extern void GetCurrentTimeUsec(struct pg_tm * tm, fsec_t *fsec, int *tzp); extern void j2date(int jd, int *year, int *month, int *day); extern int date2j(int year, int month, int day); extern int ParseDateTime(const char *timestr, char *workbuf, size_t buflen, char **field, int *ftype, int maxfields, int *numfields); extern int DecodeDateTime(char **field, int *ftype, int nf, int *dtype, struct pg_tm * tm, fsec_t *fsec, int *tzp); extern int DecodeTimeOnly(char **field, int *ftype, int nf, int *dtype, struct pg_tm * tm, fsec_t *fsec, int *tzp); extern int DecodeInterval(char **field, int *ftype, int nf, int range, int *dtype, struct pg_tm * tm, fsec_t *fsec); extern int DecodeISO8601Interval(char *str, int *dtype, struct pg_tm * tm, fsec_t *fsec); extern void DateTimeParseError(int dterr, const char *str, const char *datatype); extern int DetermineTimeZoneOffset(struct pg_tm * tm, pg_tz *tzp); extern int DetermineTimeZoneAbbrevOffset(struct pg_tm * tm, const char *abbr, pg_tz *tzp); extern int DetermineTimeZoneAbbrevOffsetTS(TimestampTz ts, const char *abbr, pg_tz *tzp, int *isdst); extern void EncodeDateOnly(struct pg_tm * tm, int style, char *str); extern void EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, int style, char *str); extern void EncodeDateTime(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str); extern void EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str); extern int DecodeTimezoneAbbrev(int field, char *lowtoken, int *offset, pg_tz **tz); extern int DecodeSpecial(int field, char *lowtoken, int *val); extern int DecodeUnits(int field, char *lowtoken, int *val); extern int j2day(int jd); extern Node *TemporalTransform(int32 max_precis, Node *node); extern bool CheckDateTokenTables(void); extern TimeZoneAbbrevTable *ConvertTimeZoneAbbrevs(struct tzEntry *abbrevs, int n); extern void InstallTimeZoneAbbrevs(TimeZoneAbbrevTable *tbl); extern Datum pg_timezone_abbrevs(PG_FUNCTION_ARGS); extern Datum pg_timezone_names(PG_FUNCTION_ARGS); #endif /* DATETIME_H */ ������������������������������������������������������������������������������������pgsql/server/utils/numeric.h������������������������������������������������������������������������0000644�����������������00000003606�14763166026�0012173 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * numeric.h * Definitions for the exact numeric data type of Postgres * * Original coding 1998, Jan Wieck. Heavily revised 2003, Tom Lane. * * Copyright (c) 1998-2012, PostgreSQL Global Development Group * * src/include/utils/numeric.h * *------------------------------------------------------------------------- */ #ifndef _PG_NUMERIC_H_ #define _PG_NUMERIC_H_ #include "fmgr.h" /* * Limit on the precision (and hence scale) specifiable in a NUMERIC typmod. * Note that the implementation limit on the length of a numeric value is * much larger --- beware of what you use this for! */ #define NUMERIC_MAX_PRECISION 1000 /* * Internal limits on the scales chosen for calculation results */ #define NUMERIC_MAX_DISPLAY_SCALE NUMERIC_MAX_PRECISION #define NUMERIC_MIN_DISPLAY_SCALE 0 #define NUMERIC_MAX_RESULT_SCALE (NUMERIC_MAX_PRECISION * 2) /* * For inherently inexact calculations such as division and square root, * we try to get at least this many significant digits; the idea is to * deliver a result no worse than float8 would. */ #define NUMERIC_MIN_SIG_DIGITS 16 /* The actual contents of Numeric are private to numeric.c */ struct NumericData; typedef struct NumericData *Numeric; /* * fmgr interface macros */ #define DatumGetNumeric(X) ((Numeric) PG_DETOAST_DATUM(X)) #define DatumGetNumericCopy(X) ((Numeric) PG_DETOAST_DATUM_COPY(X)) #define NumericGetDatum(X) PointerGetDatum(X) #define PG_GETARG_NUMERIC(n) DatumGetNumeric(PG_GETARG_DATUM(n)) #define PG_GETARG_NUMERIC_COPY(n) DatumGetNumericCopy(PG_GETARG_DATUM(n)) #define PG_RETURN_NUMERIC(x) return NumericGetDatum(x) /* * Utility functions in numeric.c */ extern bool numeric_is_nan(Numeric num); int32 numeric_maximum_size(int32 typmod); extern char *numeric_out_sci(Numeric num, int scale); #endif /* _PG_NUMERIC_H_ */ ��������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/probes.h�������������������������������������������������������������������������0000644�����������������00000113664�14763166026�0012031 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Generated by the Systemtap dtrace wrapper */ #define _SDT_HAS_SEMAPHORES 1 #define STAP_HAS_SEMAPHORES 1 /* deprecated */ #include <sys/sdt.h> /* TRACE_POSTGRESQL_TRANSACTION_START ( unsigned int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_TRANSACTION_START_ENABLED() __builtin_expect (transaction__start_semaphore, 0) #define postgresql_transaction__start_semaphore transaction__start_semaphore #else #define TRACE_POSTGRESQL_TRANSACTION_START_ENABLED() __builtin_expect (postgresql_transaction__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_transaction__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_TRANSACTION_START(arg1) \ DTRACE_PROBE1 (postgresql, transaction__start, arg1) /* TRACE_POSTGRESQL_TRANSACTION_COMMIT ( unsigned int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_TRANSACTION_COMMIT_ENABLED() __builtin_expect (transaction__commit_semaphore, 0) #define postgresql_transaction__commit_semaphore transaction__commit_semaphore #else #define TRACE_POSTGRESQL_TRANSACTION_COMMIT_ENABLED() __builtin_expect (postgresql_transaction__commit_semaphore, 0) #endif __extension__ extern unsigned short postgresql_transaction__commit_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_TRANSACTION_COMMIT(arg1) \ DTRACE_PROBE1 (postgresql, transaction__commit, arg1) /* TRACE_POSTGRESQL_TRANSACTION_ABORT ( unsigned int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_TRANSACTION_ABORT_ENABLED() __builtin_expect (transaction__abort_semaphore, 0) #define postgresql_transaction__abort_semaphore transaction__abort_semaphore #else #define TRACE_POSTGRESQL_TRANSACTION_ABORT_ENABLED() __builtin_expect (postgresql_transaction__abort_semaphore, 0) #endif __extension__ extern unsigned short postgresql_transaction__abort_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_TRANSACTION_ABORT(arg1) \ DTRACE_PROBE1 (postgresql, transaction__abort, arg1) /* TRACE_POSTGRESQL_LWLOCK_ACQUIRE ( int, int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_LWLOCK_ACQUIRE_ENABLED() __builtin_expect (lwlock__acquire_semaphore, 0) #define postgresql_lwlock__acquire_semaphore lwlock__acquire_semaphore #else #define TRACE_POSTGRESQL_LWLOCK_ACQUIRE_ENABLED() __builtin_expect (postgresql_lwlock__acquire_semaphore, 0) #endif __extension__ extern unsigned short postgresql_lwlock__acquire_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_LWLOCK_ACQUIRE(arg1, arg2) \ DTRACE_PROBE2 (postgresql, lwlock__acquire, arg1, arg2) /* TRACE_POSTGRESQL_LWLOCK_RELEASE ( int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_LWLOCK_RELEASE_ENABLED() __builtin_expect (lwlock__release_semaphore, 0) #define postgresql_lwlock__release_semaphore lwlock__release_semaphore #else #define TRACE_POSTGRESQL_LWLOCK_RELEASE_ENABLED() __builtin_expect (postgresql_lwlock__release_semaphore, 0) #endif __extension__ extern unsigned short postgresql_lwlock__release_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_LWLOCK_RELEASE(arg1) \ DTRACE_PROBE1 (postgresql, lwlock__release, arg1) /* TRACE_POSTGRESQL_LWLOCK_WAIT_START ( int, int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_LWLOCK_WAIT_START_ENABLED() __builtin_expect (lwlock__wait__start_semaphore, 0) #define postgresql_lwlock__wait__start_semaphore lwlock__wait__start_semaphore #else #define TRACE_POSTGRESQL_LWLOCK_WAIT_START_ENABLED() __builtin_expect (postgresql_lwlock__wait__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_lwlock__wait__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_LWLOCK_WAIT_START(arg1, arg2) \ DTRACE_PROBE2 (postgresql, lwlock__wait__start, arg1, arg2) /* TRACE_POSTGRESQL_LWLOCK_WAIT_DONE ( int, int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_LWLOCK_WAIT_DONE_ENABLED() __builtin_expect (lwlock__wait__done_semaphore, 0) #define postgresql_lwlock__wait__done_semaphore lwlock__wait__done_semaphore #else #define TRACE_POSTGRESQL_LWLOCK_WAIT_DONE_ENABLED() __builtin_expect (postgresql_lwlock__wait__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_lwlock__wait__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_LWLOCK_WAIT_DONE(arg1, arg2) \ DTRACE_PROBE2 (postgresql, lwlock__wait__done, arg1, arg2) /* TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE ( int, int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_ENABLED() __builtin_expect (lwlock__condacquire_semaphore, 0) #define postgresql_lwlock__condacquire_semaphore lwlock__condacquire_semaphore #else #define TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_ENABLED() __builtin_expect (postgresql_lwlock__condacquire_semaphore, 0) #endif __extension__ extern unsigned short postgresql_lwlock__condacquire_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE(arg1, arg2) \ DTRACE_PROBE2 (postgresql, lwlock__condacquire, arg1, arg2) /* TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL ( int, int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL_ENABLED() __builtin_expect (lwlock__condacquire__fail_semaphore, 0) #define postgresql_lwlock__condacquire__fail_semaphore lwlock__condacquire__fail_semaphore #else #define TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL_ENABLED() __builtin_expect (postgresql_lwlock__condacquire__fail_semaphore, 0) #endif __extension__ extern unsigned short postgresql_lwlock__condacquire__fail_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL(arg1, arg2) \ DTRACE_PROBE2 (postgresql, lwlock__condacquire__fail, arg1, arg2) /* TRACE_POSTGRESQL_LWLOCK_WAIT_UNTIL_FREE ( int, int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_LWLOCK_WAIT_UNTIL_FREE_ENABLED() __builtin_expect (lwlock__wait__until__free_semaphore, 0) #define postgresql_lwlock__wait__until__free_semaphore lwlock__wait__until__free_semaphore #else #define TRACE_POSTGRESQL_LWLOCK_WAIT_UNTIL_FREE_ENABLED() __builtin_expect (postgresql_lwlock__wait__until__free_semaphore, 0) #endif __extension__ extern unsigned short postgresql_lwlock__wait__until__free_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_LWLOCK_WAIT_UNTIL_FREE(arg1, arg2) \ DTRACE_PROBE2 (postgresql, lwlock__wait__until__free, arg1, arg2) /* TRACE_POSTGRESQL_LWLOCK_WAIT_UNTIL_FREE_FAIL ( int, int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_LWLOCK_WAIT_UNTIL_FREE_FAIL_ENABLED() __builtin_expect (lwlock__wait__until__free__fail_semaphore, 0) #define postgresql_lwlock__wait__until__free__fail_semaphore lwlock__wait__until__free__fail_semaphore #else #define TRACE_POSTGRESQL_LWLOCK_WAIT_UNTIL_FREE_FAIL_ENABLED() __builtin_expect (postgresql_lwlock__wait__until__free__fail_semaphore, 0) #endif __extension__ extern unsigned short postgresql_lwlock__wait__until__free__fail_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_LWLOCK_WAIT_UNTIL_FREE_FAIL(arg1, arg2) \ DTRACE_PROBE2 (postgresql, lwlock__wait__until__free__fail, arg1, arg2) /* TRACE_POSTGRESQL_LOCK_WAIT_START ( unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_LOCK_WAIT_START_ENABLED() __builtin_expect (lock__wait__start_semaphore, 0) #define postgresql_lock__wait__start_semaphore lock__wait__start_semaphore #else #define TRACE_POSTGRESQL_LOCK_WAIT_START_ENABLED() __builtin_expect (postgresql_lock__wait__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_lock__wait__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_LOCK_WAIT_START(arg1, arg2, arg3, arg4, arg5, arg6) \ DTRACE_PROBE6 (postgresql, lock__wait__start, arg1, arg2, arg3, arg4, arg5, arg6) /* TRACE_POSTGRESQL_LOCK_WAIT_DONE ( unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_LOCK_WAIT_DONE_ENABLED() __builtin_expect (lock__wait__done_semaphore, 0) #define postgresql_lock__wait__done_semaphore lock__wait__done_semaphore #else #define TRACE_POSTGRESQL_LOCK_WAIT_DONE_ENABLED() __builtin_expect (postgresql_lock__wait__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_lock__wait__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_LOCK_WAIT_DONE(arg1, arg2, arg3, arg4, arg5, arg6) \ DTRACE_PROBE6 (postgresql, lock__wait__done, arg1, arg2, arg3, arg4, arg5, arg6) /* TRACE_POSTGRESQL_QUERY_PARSE_START ( const char * ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_QUERY_PARSE_START_ENABLED() __builtin_expect (query__parse__start_semaphore, 0) #define postgresql_query__parse__start_semaphore query__parse__start_semaphore #else #define TRACE_POSTGRESQL_QUERY_PARSE_START_ENABLED() __builtin_expect (postgresql_query__parse__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_query__parse__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_QUERY_PARSE_START(arg1) \ DTRACE_PROBE1 (postgresql, query__parse__start, arg1) /* TRACE_POSTGRESQL_QUERY_PARSE_DONE ( const char * ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_QUERY_PARSE_DONE_ENABLED() __builtin_expect (query__parse__done_semaphore, 0) #define postgresql_query__parse__done_semaphore query__parse__done_semaphore #else #define TRACE_POSTGRESQL_QUERY_PARSE_DONE_ENABLED() __builtin_expect (postgresql_query__parse__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_query__parse__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_QUERY_PARSE_DONE(arg1) \ DTRACE_PROBE1 (postgresql, query__parse__done, arg1) /* TRACE_POSTGRESQL_QUERY_REWRITE_START ( const char * ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_QUERY_REWRITE_START_ENABLED() __builtin_expect (query__rewrite__start_semaphore, 0) #define postgresql_query__rewrite__start_semaphore query__rewrite__start_semaphore #else #define TRACE_POSTGRESQL_QUERY_REWRITE_START_ENABLED() __builtin_expect (postgresql_query__rewrite__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_query__rewrite__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_QUERY_REWRITE_START(arg1) \ DTRACE_PROBE1 (postgresql, query__rewrite__start, arg1) /* TRACE_POSTGRESQL_QUERY_REWRITE_DONE ( const char * ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_QUERY_REWRITE_DONE_ENABLED() __builtin_expect (query__rewrite__done_semaphore, 0) #define postgresql_query__rewrite__done_semaphore query__rewrite__done_semaphore #else #define TRACE_POSTGRESQL_QUERY_REWRITE_DONE_ENABLED() __builtin_expect (postgresql_query__rewrite__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_query__rewrite__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_QUERY_REWRITE_DONE(arg1) \ DTRACE_PROBE1 (postgresql, query__rewrite__done, arg1) /* TRACE_POSTGRESQL_QUERY_PLAN_START ( ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_QUERY_PLAN_START_ENABLED() __builtin_expect (query__plan__start_semaphore, 0) #define postgresql_query__plan__start_semaphore query__plan__start_semaphore #else #define TRACE_POSTGRESQL_QUERY_PLAN_START_ENABLED() __builtin_expect (postgresql_query__plan__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_query__plan__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_QUERY_PLAN_START() \ DTRACE_PROBE (postgresql, query__plan__start) /* TRACE_POSTGRESQL_QUERY_PLAN_DONE ( ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_QUERY_PLAN_DONE_ENABLED() __builtin_expect (query__plan__done_semaphore, 0) #define postgresql_query__plan__done_semaphore query__plan__done_semaphore #else #define TRACE_POSTGRESQL_QUERY_PLAN_DONE_ENABLED() __builtin_expect (postgresql_query__plan__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_query__plan__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_QUERY_PLAN_DONE() \ DTRACE_PROBE (postgresql, query__plan__done) /* TRACE_POSTGRESQL_QUERY_EXECUTE_START ( ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_QUERY_EXECUTE_START_ENABLED() __builtin_expect (query__execute__start_semaphore, 0) #define postgresql_query__execute__start_semaphore query__execute__start_semaphore #else #define TRACE_POSTGRESQL_QUERY_EXECUTE_START_ENABLED() __builtin_expect (postgresql_query__execute__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_query__execute__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_QUERY_EXECUTE_START() \ DTRACE_PROBE (postgresql, query__execute__start) /* TRACE_POSTGRESQL_QUERY_EXECUTE_DONE ( ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_QUERY_EXECUTE_DONE_ENABLED() __builtin_expect (query__execute__done_semaphore, 0) #define postgresql_query__execute__done_semaphore query__execute__done_semaphore #else #define TRACE_POSTGRESQL_QUERY_EXECUTE_DONE_ENABLED() __builtin_expect (postgresql_query__execute__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_query__execute__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_QUERY_EXECUTE_DONE() \ DTRACE_PROBE (postgresql, query__execute__done) /* TRACE_POSTGRESQL_QUERY_START ( const char * ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_QUERY_START_ENABLED() __builtin_expect (query__start_semaphore, 0) #define postgresql_query__start_semaphore query__start_semaphore #else #define TRACE_POSTGRESQL_QUERY_START_ENABLED() __builtin_expect (postgresql_query__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_query__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_QUERY_START(arg1) \ DTRACE_PROBE1 (postgresql, query__start, arg1) /* TRACE_POSTGRESQL_QUERY_DONE ( const char * ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_QUERY_DONE_ENABLED() __builtin_expect (query__done_semaphore, 0) #define postgresql_query__done_semaphore query__done_semaphore #else #define TRACE_POSTGRESQL_QUERY_DONE_ENABLED() __builtin_expect (postgresql_query__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_query__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_QUERY_DONE(arg1) \ DTRACE_PROBE1 (postgresql, query__done, arg1) /* TRACE_POSTGRESQL_STATEMENT_STATUS ( const char * ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_STATEMENT_STATUS_ENABLED() __builtin_expect (statement__status_semaphore, 0) #define postgresql_statement__status_semaphore statement__status_semaphore #else #define TRACE_POSTGRESQL_STATEMENT_STATUS_ENABLED() __builtin_expect (postgresql_statement__status_semaphore, 0) #endif __extension__ extern unsigned short postgresql_statement__status_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_STATEMENT_STATUS(arg1) \ DTRACE_PROBE1 (postgresql, statement__status, arg1) /* TRACE_POSTGRESQL_SORT_START ( int, char, int, int, char ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_SORT_START_ENABLED() __builtin_expect (sort__start_semaphore, 0) #define postgresql_sort__start_semaphore sort__start_semaphore #else #define TRACE_POSTGRESQL_SORT_START_ENABLED() __builtin_expect (postgresql_sort__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_sort__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_SORT_START(arg1, arg2, arg3, arg4, arg5) \ DTRACE_PROBE5 (postgresql, sort__start, arg1, arg2, arg3, arg4, arg5) /* TRACE_POSTGRESQL_SORT_DONE ( char, long ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_SORT_DONE_ENABLED() __builtin_expect (sort__done_semaphore, 0) #define postgresql_sort__done_semaphore sort__done_semaphore #else #define TRACE_POSTGRESQL_SORT_DONE_ENABLED() __builtin_expect (postgresql_sort__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_sort__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_SORT_DONE(arg1, arg2) \ DTRACE_PROBE2 (postgresql, sort__done, arg1, arg2) /* TRACE_POSTGRESQL_BUFFER_READ_START ( int, unsigned int, unsigned int, unsigned int, unsigned int, int, char ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_BUFFER_READ_START_ENABLED() __builtin_expect (buffer__read__start_semaphore, 0) #define postgresql_buffer__read__start_semaphore buffer__read__start_semaphore #else #define TRACE_POSTGRESQL_BUFFER_READ_START_ENABLED() __builtin_expect (postgresql_buffer__read__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_buffer__read__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_BUFFER_READ_START(arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ DTRACE_PROBE7 (postgresql, buffer__read__start, arg1, arg2, arg3, arg4, arg5, arg6, arg7) /* TRACE_POSTGRESQL_BUFFER_READ_DONE ( int, unsigned int, unsigned int, unsigned int, unsigned int, int, char, char ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_BUFFER_READ_DONE_ENABLED() __builtin_expect (buffer__read__done_semaphore, 0) #define postgresql_buffer__read__done_semaphore buffer__read__done_semaphore #else #define TRACE_POSTGRESQL_BUFFER_READ_DONE_ENABLED() __builtin_expect (postgresql_buffer__read__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_buffer__read__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_BUFFER_READ_DONE(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ DTRACE_PROBE8 (postgresql, buffer__read__done, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) /* TRACE_POSTGRESQL_BUFFER_FLUSH_START ( int, unsigned int, unsigned int, unsigned int, unsigned int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_BUFFER_FLUSH_START_ENABLED() __builtin_expect (buffer__flush__start_semaphore, 0) #define postgresql_buffer__flush__start_semaphore buffer__flush__start_semaphore #else #define TRACE_POSTGRESQL_BUFFER_FLUSH_START_ENABLED() __builtin_expect (postgresql_buffer__flush__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_buffer__flush__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_BUFFER_FLUSH_START(arg1, arg2, arg3, arg4, arg5) \ DTRACE_PROBE5 (postgresql, buffer__flush__start, arg1, arg2, arg3, arg4, arg5) /* TRACE_POSTGRESQL_BUFFER_FLUSH_DONE ( int, unsigned int, unsigned int, unsigned int, unsigned int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_BUFFER_FLUSH_DONE_ENABLED() __builtin_expect (buffer__flush__done_semaphore, 0) #define postgresql_buffer__flush__done_semaphore buffer__flush__done_semaphore #else #define TRACE_POSTGRESQL_BUFFER_FLUSH_DONE_ENABLED() __builtin_expect (postgresql_buffer__flush__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_buffer__flush__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_BUFFER_FLUSH_DONE(arg1, arg2, arg3, arg4, arg5) \ DTRACE_PROBE5 (postgresql, buffer__flush__done, arg1, arg2, arg3, arg4, arg5) /* TRACE_POSTGRESQL_BUFFER_CHECKPOINT_START ( int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_START_ENABLED() __builtin_expect (buffer__checkpoint__start_semaphore, 0) #define postgresql_buffer__checkpoint__start_semaphore buffer__checkpoint__start_semaphore #else #define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_START_ENABLED() __builtin_expect (postgresql_buffer__checkpoint__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_buffer__checkpoint__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_START(arg1) \ DTRACE_PROBE1 (postgresql, buffer__checkpoint__start, arg1) /* TRACE_POSTGRESQL_BUFFER_CHECKPOINT_SYNC_START ( ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_SYNC_START_ENABLED() __builtin_expect (buffer__checkpoint__sync__start_semaphore, 0) #define postgresql_buffer__checkpoint__sync__start_semaphore buffer__checkpoint__sync__start_semaphore #else #define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_SYNC_START_ENABLED() __builtin_expect (postgresql_buffer__checkpoint__sync__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_buffer__checkpoint__sync__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_SYNC_START() \ DTRACE_PROBE (postgresql, buffer__checkpoint__sync__start) /* TRACE_POSTGRESQL_BUFFER_CHECKPOINT_DONE ( ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_DONE_ENABLED() __builtin_expect (buffer__checkpoint__done_semaphore, 0) #define postgresql_buffer__checkpoint__done_semaphore buffer__checkpoint__done_semaphore #else #define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_DONE_ENABLED() __builtin_expect (postgresql_buffer__checkpoint__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_buffer__checkpoint__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_DONE() \ DTRACE_PROBE (postgresql, buffer__checkpoint__done) /* TRACE_POSTGRESQL_BUFFER_SYNC_START ( int, int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_BUFFER_SYNC_START_ENABLED() __builtin_expect (buffer__sync__start_semaphore, 0) #define postgresql_buffer__sync__start_semaphore buffer__sync__start_semaphore #else #define TRACE_POSTGRESQL_BUFFER_SYNC_START_ENABLED() __builtin_expect (postgresql_buffer__sync__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_buffer__sync__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_BUFFER_SYNC_START(arg1, arg2) \ DTRACE_PROBE2 (postgresql, buffer__sync__start, arg1, arg2) /* TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN ( int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN_ENABLED() __builtin_expect (buffer__sync__written_semaphore, 0) #define postgresql_buffer__sync__written_semaphore buffer__sync__written_semaphore #else #define TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN_ENABLED() __builtin_expect (postgresql_buffer__sync__written_semaphore, 0) #endif __extension__ extern unsigned short postgresql_buffer__sync__written_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN(arg1) \ DTRACE_PROBE1 (postgresql, buffer__sync__written, arg1) /* TRACE_POSTGRESQL_BUFFER_SYNC_DONE ( int, int, int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_BUFFER_SYNC_DONE_ENABLED() __builtin_expect (buffer__sync__done_semaphore, 0) #define postgresql_buffer__sync__done_semaphore buffer__sync__done_semaphore #else #define TRACE_POSTGRESQL_BUFFER_SYNC_DONE_ENABLED() __builtin_expect (postgresql_buffer__sync__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_buffer__sync__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_BUFFER_SYNC_DONE(arg1, arg2, arg3) \ DTRACE_PROBE3 (postgresql, buffer__sync__done, arg1, arg2, arg3) /* TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_START ( int, unsigned int, unsigned int, unsigned int, unsigned int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_START_ENABLED() __builtin_expect (buffer__write__dirty__start_semaphore, 0) #define postgresql_buffer__write__dirty__start_semaphore buffer__write__dirty__start_semaphore #else #define TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_START_ENABLED() __builtin_expect (postgresql_buffer__write__dirty__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_buffer__write__dirty__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_START(arg1, arg2, arg3, arg4, arg5) \ DTRACE_PROBE5 (postgresql, buffer__write__dirty__start, arg1, arg2, arg3, arg4, arg5) /* TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_DONE ( int, unsigned int, unsigned int, unsigned int, unsigned int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_DONE_ENABLED() __builtin_expect (buffer__write__dirty__done_semaphore, 0) #define postgresql_buffer__write__dirty__done_semaphore buffer__write__dirty__done_semaphore #else #define TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_DONE_ENABLED() __builtin_expect (postgresql_buffer__write__dirty__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_buffer__write__dirty__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_DONE(arg1, arg2, arg3, arg4, arg5) \ DTRACE_PROBE5 (postgresql, buffer__write__dirty__done, arg1, arg2, arg3, arg4, arg5) /* TRACE_POSTGRESQL_DEADLOCK_FOUND ( ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_DEADLOCK_FOUND_ENABLED() __builtin_expect (deadlock__found_semaphore, 0) #define postgresql_deadlock__found_semaphore deadlock__found_semaphore #else #define TRACE_POSTGRESQL_DEADLOCK_FOUND_ENABLED() __builtin_expect (postgresql_deadlock__found_semaphore, 0) #endif __extension__ extern unsigned short postgresql_deadlock__found_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_DEADLOCK_FOUND() \ DTRACE_PROBE (postgresql, deadlock__found) /* TRACE_POSTGRESQL_CHECKPOINT_START ( int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_CHECKPOINT_START_ENABLED() __builtin_expect (checkpoint__start_semaphore, 0) #define postgresql_checkpoint__start_semaphore checkpoint__start_semaphore #else #define TRACE_POSTGRESQL_CHECKPOINT_START_ENABLED() __builtin_expect (postgresql_checkpoint__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_checkpoint__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_CHECKPOINT_START(arg1) \ DTRACE_PROBE1 (postgresql, checkpoint__start, arg1) /* TRACE_POSTGRESQL_CHECKPOINT_DONE ( int, int, int, int, int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_CHECKPOINT_DONE_ENABLED() __builtin_expect (checkpoint__done_semaphore, 0) #define postgresql_checkpoint__done_semaphore checkpoint__done_semaphore #else #define TRACE_POSTGRESQL_CHECKPOINT_DONE_ENABLED() __builtin_expect (postgresql_checkpoint__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_checkpoint__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_CHECKPOINT_DONE(arg1, arg2, arg3, arg4, arg5) \ DTRACE_PROBE5 (postgresql, checkpoint__done, arg1, arg2, arg3, arg4, arg5) /* TRACE_POSTGRESQL_CLOG_CHECKPOINT_START ( char ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_CLOG_CHECKPOINT_START_ENABLED() __builtin_expect (clog__checkpoint__start_semaphore, 0) #define postgresql_clog__checkpoint__start_semaphore clog__checkpoint__start_semaphore #else #define TRACE_POSTGRESQL_CLOG_CHECKPOINT_START_ENABLED() __builtin_expect (postgresql_clog__checkpoint__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_clog__checkpoint__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_CLOG_CHECKPOINT_START(arg1) \ DTRACE_PROBE1 (postgresql, clog__checkpoint__start, arg1) /* TRACE_POSTGRESQL_CLOG_CHECKPOINT_DONE ( char ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_CLOG_CHECKPOINT_DONE_ENABLED() __builtin_expect (clog__checkpoint__done_semaphore, 0) #define postgresql_clog__checkpoint__done_semaphore clog__checkpoint__done_semaphore #else #define TRACE_POSTGRESQL_CLOG_CHECKPOINT_DONE_ENABLED() __builtin_expect (postgresql_clog__checkpoint__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_clog__checkpoint__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_CLOG_CHECKPOINT_DONE(arg1) \ DTRACE_PROBE1 (postgresql, clog__checkpoint__done, arg1) /* TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_START ( char ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_START_ENABLED() __builtin_expect (subtrans__checkpoint__start_semaphore, 0) #define postgresql_subtrans__checkpoint__start_semaphore subtrans__checkpoint__start_semaphore #else #define TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_START_ENABLED() __builtin_expect (postgresql_subtrans__checkpoint__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_subtrans__checkpoint__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_START(arg1) \ DTRACE_PROBE1 (postgresql, subtrans__checkpoint__start, arg1) /* TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_DONE ( char ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_DONE_ENABLED() __builtin_expect (subtrans__checkpoint__done_semaphore, 0) #define postgresql_subtrans__checkpoint__done_semaphore subtrans__checkpoint__done_semaphore #else #define TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_DONE_ENABLED() __builtin_expect (postgresql_subtrans__checkpoint__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_subtrans__checkpoint__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_DONE(arg1) \ DTRACE_PROBE1 (postgresql, subtrans__checkpoint__done, arg1) /* TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_START ( char ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_START_ENABLED() __builtin_expect (multixact__checkpoint__start_semaphore, 0) #define postgresql_multixact__checkpoint__start_semaphore multixact__checkpoint__start_semaphore #else #define TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_START_ENABLED() __builtin_expect (postgresql_multixact__checkpoint__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_multixact__checkpoint__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_START(arg1) \ DTRACE_PROBE1 (postgresql, multixact__checkpoint__start, arg1) /* TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_DONE ( char ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_DONE_ENABLED() __builtin_expect (multixact__checkpoint__done_semaphore, 0) #define postgresql_multixact__checkpoint__done_semaphore multixact__checkpoint__done_semaphore #else #define TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_DONE_ENABLED() __builtin_expect (postgresql_multixact__checkpoint__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_multixact__checkpoint__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_DONE(arg1) \ DTRACE_PROBE1 (postgresql, multixact__checkpoint__done, arg1) /* TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_START ( ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_START_ENABLED() __builtin_expect (twophase__checkpoint__start_semaphore, 0) #define postgresql_twophase__checkpoint__start_semaphore twophase__checkpoint__start_semaphore #else #define TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_START_ENABLED() __builtin_expect (postgresql_twophase__checkpoint__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_twophase__checkpoint__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_START() \ DTRACE_PROBE (postgresql, twophase__checkpoint__start) /* TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_DONE ( ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_DONE_ENABLED() __builtin_expect (twophase__checkpoint__done_semaphore, 0) #define postgresql_twophase__checkpoint__done_semaphore twophase__checkpoint__done_semaphore #else #define TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_DONE_ENABLED() __builtin_expect (postgresql_twophase__checkpoint__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_twophase__checkpoint__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_DONE() \ DTRACE_PROBE (postgresql, twophase__checkpoint__done) /* TRACE_POSTGRESQL_SMGR_MD_READ_START ( int, unsigned int, unsigned int, unsigned int, unsigned int, int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_SMGR_MD_READ_START_ENABLED() __builtin_expect (smgr__md__read__start_semaphore, 0) #define postgresql_smgr__md__read__start_semaphore smgr__md__read__start_semaphore #else #define TRACE_POSTGRESQL_SMGR_MD_READ_START_ENABLED() __builtin_expect (postgresql_smgr__md__read__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_smgr__md__read__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_SMGR_MD_READ_START(arg1, arg2, arg3, arg4, arg5, arg6) \ DTRACE_PROBE6 (postgresql, smgr__md__read__start, arg1, arg2, arg3, arg4, arg5, arg6) /* TRACE_POSTGRESQL_SMGR_MD_READ_DONE ( int, unsigned int, unsigned int, unsigned int, unsigned int, int, int, int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_SMGR_MD_READ_DONE_ENABLED() __builtin_expect (smgr__md__read__done_semaphore, 0) #define postgresql_smgr__md__read__done_semaphore smgr__md__read__done_semaphore #else #define TRACE_POSTGRESQL_SMGR_MD_READ_DONE_ENABLED() __builtin_expect (postgresql_smgr__md__read__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_smgr__md__read__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_SMGR_MD_READ_DONE(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ DTRACE_PROBE8 (postgresql, smgr__md__read__done, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) /* TRACE_POSTGRESQL_SMGR_MD_WRITE_START ( int, unsigned int, unsigned int, unsigned int, unsigned int, int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_SMGR_MD_WRITE_START_ENABLED() __builtin_expect (smgr__md__write__start_semaphore, 0) #define postgresql_smgr__md__write__start_semaphore smgr__md__write__start_semaphore #else #define TRACE_POSTGRESQL_SMGR_MD_WRITE_START_ENABLED() __builtin_expect (postgresql_smgr__md__write__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_smgr__md__write__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_SMGR_MD_WRITE_START(arg1, arg2, arg3, arg4, arg5, arg6) \ DTRACE_PROBE6 (postgresql, smgr__md__write__start, arg1, arg2, arg3, arg4, arg5, arg6) /* TRACE_POSTGRESQL_SMGR_MD_WRITE_DONE ( int, unsigned int, unsigned int, unsigned int, unsigned int, int, int, int ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_SMGR_MD_WRITE_DONE_ENABLED() __builtin_expect (smgr__md__write__done_semaphore, 0) #define postgresql_smgr__md__write__done_semaphore smgr__md__write__done_semaphore #else #define TRACE_POSTGRESQL_SMGR_MD_WRITE_DONE_ENABLED() __builtin_expect (postgresql_smgr__md__write__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_smgr__md__write__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_SMGR_MD_WRITE_DONE(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ DTRACE_PROBE8 (postgresql, smgr__md__write__done, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) /* TRACE_POSTGRESQL_XLOG_INSERT ( unsigned char, unsigned char ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_XLOG_INSERT_ENABLED() __builtin_expect (xlog__insert_semaphore, 0) #define postgresql_xlog__insert_semaphore xlog__insert_semaphore #else #define TRACE_POSTGRESQL_XLOG_INSERT_ENABLED() __builtin_expect (postgresql_xlog__insert_semaphore, 0) #endif __extension__ extern unsigned short postgresql_xlog__insert_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_XLOG_INSERT(arg1, arg2) \ DTRACE_PROBE2 (postgresql, xlog__insert, arg1, arg2) /* TRACE_POSTGRESQL_XLOG_SWITCH ( ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_XLOG_SWITCH_ENABLED() __builtin_expect (xlog__switch_semaphore, 0) #define postgresql_xlog__switch_semaphore xlog__switch_semaphore #else #define TRACE_POSTGRESQL_XLOG_SWITCH_ENABLED() __builtin_expect (postgresql_xlog__switch_semaphore, 0) #endif __extension__ extern unsigned short postgresql_xlog__switch_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_XLOG_SWITCH() \ DTRACE_PROBE (postgresql, xlog__switch) /* TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_START ( ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_START_ENABLED() __builtin_expect (wal__buffer__write__dirty__start_semaphore, 0) #define postgresql_wal__buffer__write__dirty__start_semaphore wal__buffer__write__dirty__start_semaphore #else #define TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_START_ENABLED() __builtin_expect (postgresql_wal__buffer__write__dirty__start_semaphore, 0) #endif __extension__ extern unsigned short postgresql_wal__buffer__write__dirty__start_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_START() \ DTRACE_PROBE (postgresql, wal__buffer__write__dirty__start) /* TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_DONE ( ) */ #if defined STAP_SDT_V1 #define TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_DONE_ENABLED() __builtin_expect (wal__buffer__write__dirty__done_semaphore, 0) #define postgresql_wal__buffer__write__dirty__done_semaphore wal__buffer__write__dirty__done_semaphore #else #define TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_DONE_ENABLED() __builtin_expect (postgresql_wal__buffer__write__dirty__done_semaphore, 0) #endif __extension__ extern unsigned short postgresql_wal__buffer__write__dirty__done_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); #define TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_DONE() \ DTRACE_PROBE (postgresql, wal__buffer__write__dirty__done) ����������������������������������������������������������������������������pgsql/server/utils/pg_locale.h����������������������������������������������������������������������0000644�����������������00000005136�14763166026�0012456 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*----------------------------------------------------------------------- * * PostgreSQL locale utilities * * src/include/utils/pg_locale.h * * Copyright (c) 2002-2012, PostgreSQL Global Development Group * *----------------------------------------------------------------------- */ #ifndef _PG_LOCALE_ #define _PG_LOCALE_ #include <locale.h> #if defined(LOCALE_T_IN_XLOCALE) || defined(WCSTOMBS_L_IN_XLOCALE) #include <xlocale.h> #endif #include "utils/guc.h" /* GUC settings */ extern char *locale_messages; extern char *locale_monetary; extern char *locale_numeric; extern char *locale_time; /* lc_time localization cache */ extern char *localized_abbrev_days[]; extern char *localized_full_days[]; extern char *localized_abbrev_months[]; extern char *localized_full_months[]; extern bool check_locale_messages(char **newval, void **extra, GucSource source); extern void assign_locale_messages(const char *newval, void *extra); extern bool check_locale_monetary(char **newval, void **extra, GucSource source); extern void assign_locale_monetary(const char *newval, void *extra); extern bool check_locale_numeric(char **newval, void **extra, GucSource source); extern void assign_locale_numeric(const char *newval, void *extra); extern bool check_locale_time(char **newval, void **extra, GucSource source); extern void assign_locale_time(const char *newval, void *extra); extern bool check_locale(int category, const char *locale, char **canonname); extern char *pg_perm_setlocale(int category, const char *locale); extern bool lc_collate_is_c(Oid collation); extern bool lc_ctype_is_c(Oid collation); /* * Return the POSIX lconv struct (contains number/money formatting * information) with locale information for all categories. */ extern struct lconv *PGLC_localeconv(void); extern void cache_locale_time(void); /* * We define our own wrapper around locale_t so we can keep the same * function signatures for all builds, while not having to create a * fake version of the standard type locale_t in the global namespace. * The fake version of pg_locale_t can be checked for truth; that's * about all it will be needed for. */ #ifdef HAVE_LOCALE_T typedef locale_t pg_locale_t; #else typedef int pg_locale_t; #endif extern pg_locale_t pg_newlocale_from_collation(Oid collid); /* These functions convert from/to libc's wchar_t, *not* pg_wchar_t */ #ifdef USE_WIDE_UPPER_LOWER extern size_t wchar2char(char *to, const wchar_t *from, size_t tolen, pg_locale_t locale); extern size_t char2wchar(wchar_t *to, size_t tolen, const char *from, size_t fromlen, pg_locale_t locale); #endif #endif /* _PG_LOCALE_ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/spccache.h�����������������������������������������������������������������������0000644�����������������00000001054�14763166026�0012275 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * spccache.h * Tablespace cache. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/spccache.h * *------------------------------------------------------------------------- */ #ifndef SPCCACHE_H #define SPCCACHE_H void get_tablespace_page_costs(Oid spcid, float8 *spc_random_page_cost, float8 *spc_seq_page_cost); #endif /* SPCCACHE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/hsearch.h������������������������������������������������������������������������0000644�����������������00000013010�14763166026�0012134 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * hsearch.h * exported definitions for utils/hash/dynahash.c; see notes therein * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/hsearch.h * *------------------------------------------------------------------------- */ #ifndef HSEARCH_H #define HSEARCH_H /* * Hash functions must have this signature. */ typedef uint32 (*HashValueFunc) (const void *key, Size keysize); /* * Key comparison functions must have this signature. Comparison functions * return zero for match, nonzero for no match. (The comparison function * definition is designed to allow memcmp() and strncmp() to be used directly * as key comparison functions.) */ typedef int (*HashCompareFunc) (const void *key1, const void *key2, Size keysize); /* * Key copying functions must have this signature. The return value is not * used. (The definition is set up to allow memcpy() and strncpy() to be * used directly.) */ typedef void *(*HashCopyFunc) (void *dest, const void *src, Size keysize); /* * Space allocation function for a hashtable --- designed to match malloc(). * Note: there is no free function API; can't destroy a hashtable unless you * use the default allocator. */ typedef void *(*HashAllocFunc) (Size request); /* * HASHELEMENT is the private part of a hashtable entry. The caller's data * follows the HASHELEMENT structure (on a MAXALIGN'd boundary). The hash key * is expected to be at the start of the caller's hash entry data structure. */ typedef struct HASHELEMENT { struct HASHELEMENT *link; /* link to next entry in same bucket */ uint32 hashvalue; /* hash function result for this entry */ } HASHELEMENT; /* Hash table header struct is an opaque type known only within dynahash.c */ typedef struct HASHHDR HASHHDR; /* Hash table control struct is an opaque type known only within dynahash.c */ typedef struct HTAB HTAB; /* Parameter data structure for hash_create */ /* Only those fields indicated by hash_flags need be set */ typedef struct HASHCTL { long num_partitions; /* # partitions (must be power of 2) */ long ssize; /* segment size */ long dsize; /* (initial) directory size */ long max_dsize; /* limit to dsize if dir size is limited */ long ffactor; /* fill factor */ Size keysize; /* hash key length in bytes */ Size entrysize; /* total user element size in bytes */ HashValueFunc hash; /* hash function */ HashCompareFunc match; /* key comparison function */ HashCopyFunc keycopy; /* key copying function */ HashAllocFunc alloc; /* memory allocator */ MemoryContext hcxt; /* memory context to use for allocations */ HASHHDR *hctl; /* location of header in shared mem */ } HASHCTL; /* Flags to indicate which parameters are supplied */ #define HASH_PARTITION 0x001 /* Hashtable is used w/partitioned locking */ #define HASH_SEGMENT 0x002 /* Set segment size */ #define HASH_DIRSIZE 0x004 /* Set directory size (initial and max) */ #define HASH_FFACTOR 0x008 /* Set fill factor */ #define HASH_FUNCTION 0x010 /* Set user defined hash function */ #define HASH_ELEM 0x020 /* Set keysize and entrysize */ #define HASH_SHARED_MEM 0x040 /* Hashtable is in shared memory */ #define HASH_ATTACH 0x080 /* Do not initialize hctl */ #define HASH_ALLOC 0x100 /* Set memory allocator */ #define HASH_CONTEXT 0x200 /* Set memory allocation context */ #define HASH_COMPARE 0x400 /* Set user defined comparison function */ #define HASH_KEYCOPY 0x800 /* Set user defined key-copying function */ #define HASH_FIXED_SIZE 0x1000 /* Initial size is a hard limit */ /* max_dsize value to indicate expansible directory */ #define NO_MAX_DSIZE (-1) /* hash_search operations */ typedef enum { HASH_FIND, HASH_ENTER, HASH_REMOVE, HASH_ENTER_NULL } HASHACTION; /* hash_seq status (should be considered an opaque type by callers) */ typedef struct { HTAB *hashp; uint32 curBucket; /* index of current bucket */ HASHELEMENT *curEntry; /* current entry in bucket */ } HASH_SEQ_STATUS; /* * prototypes for functions in dynahash.c */ extern HTAB *hash_create(const char *tabname, long nelem, HASHCTL *info, int flags); extern void hash_destroy(HTAB *hashp); extern void hash_stats(const char *where, HTAB *hashp); extern void *hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr); extern uint32 get_hash_value(HTAB *hashp, const void *keyPtr); extern void *hash_search_with_hash_value(HTAB *hashp, const void *keyPtr, uint32 hashvalue, HASHACTION action, bool *foundPtr); extern long hash_get_num_entries(HTAB *hashp); extern void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp); extern void *hash_seq_search(HASH_SEQ_STATUS *status); extern void hash_seq_term(HASH_SEQ_STATUS *status); extern void hash_freeze(HTAB *hashp); extern Size hash_estimate_size(long num_entries, Size entrysize); extern long hash_select_dirsize(long num_entries); extern Size hash_get_shared_size(HASHCTL *info, int flags); extern void AtEOXact_HashTables(bool isCommit); extern void AtEOSubXact_HashTables(bool isCommit, int nestDepth); /* * prototypes for functions in hashfn.c */ extern uint32 string_hash(const void *key, Size keysize); extern uint32 tag_hash(const void *key, Size keysize); extern uint32 oid_hash(const void *key, Size keysize); extern uint32 bitmap_hash(const void *key, Size keysize); extern int bitmap_match(const void *key1, const void *key2, Size keysize); #endif /* HSEARCH_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/utils/snapshot.h�����������������������������������������������������������������������0000644�����������������00000005135�14763166026�0012367 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * snapshot.h * POSTGRES snapshot definition * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/utils/snapshot.h * *------------------------------------------------------------------------- */ #ifndef SNAPSHOT_H #define SNAPSHOT_H #include "access/htup.h" #include "storage/buf.h" typedef struct SnapshotData *Snapshot; #define InvalidSnapshot ((Snapshot) NULL) /* * We use SnapshotData structures to represent both "regular" (MVCC) * snapshots and "special" snapshots that have non-MVCC semantics. * The specific semantics of a snapshot are encoded by the "satisfies" * function. */ typedef bool (*SnapshotSatisfiesFunc) (HeapTupleHeader tuple, Snapshot snapshot, Buffer buffer); typedef struct SnapshotData { SnapshotSatisfiesFunc satisfies; /* tuple test function */ /* * The remaining fields are used only for MVCC snapshots, and are normally * just zeroes in special snapshots. (But xmin and xmax are used * specially by HeapTupleSatisfiesDirty.) * * An MVCC snapshot can never see the effects of XIDs >= xmax. It can see * the effects of all older XIDs except those listed in the snapshot. xmin * is stored as an optimization to avoid needing to search the XID arrays * for most tuples. */ TransactionId xmin; /* all XID < xmin are visible to me */ TransactionId xmax; /* all XID >= xmax are invisible to me */ TransactionId *xip; /* array of xact IDs in progress */ uint32 xcnt; /* # of xact ids in xip[] */ /* note: all ids in xip[] satisfy xmin <= xip[i] < xmax */ int32 subxcnt; /* # of xact ids in subxip[] */ TransactionId *subxip; /* array of subxact IDs in progress */ bool suboverflowed; /* has the subxip array overflowed? */ bool takenDuringRecovery; /* recovery-shaped snapshot? */ bool copied; /* false if it's a static snapshot */ /* * note: all ids in subxip[] are >= xmin, but we don't bother filtering * out any that are >= xmax */ CommandId curcid; /* in my xact, CID < curcid are visible */ uint32 active_count; /* refcount on ActiveSnapshot stack */ uint32 regd_count; /* refcount on RegisteredSnapshotList */ } SnapshotData; /* * Result codes for HeapTupleSatisfiesUpdate. This should really be in * tqual.h, but we want to avoid including that file elsewhere. */ typedef enum { HeapTupleMayBeUpdated, HeapTupleInvisible, HeapTupleSelfUpdated, HeapTupleUpdated, HeapTupleBeingUpdated } HTSU_Result; #endif /* SNAPSHOT_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/pg_config.h����������������������������������������������������������������������������0000644�����������������00000002006�14763166026�0011315 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Kluge to support multilib installation of both 32- and 64-bit RPMS: * we need to arrange that header files that appear in both RPMs are * identical. Hence, this file is architecture-independent and calls * in an arch-dependent file that will appear in just one RPM. * * To avoid breaking arches not explicitly supported by Red Hat, we * use this indirection file *only* on known multilib arches. * * Note: this may well fail if user tries to use gcc's -I- option. * But that option is deprecated anyway. */ #if defined(__x86_64__) #include "pg_config_x86_64.h" #elif defined(__i386__) #include "pg_config_i386.h" #elif defined(__ppc64__) || defined(__powerpc64__) #include "pg_config_ppc64.h" #elif defined(__ppc__) || defined(__powerpc__) #include "pg_config_ppc.h" #elif defined(__s390x__) #include "pg_config_s390x.h" #elif defined(__s390__) #include "pg_config_s390.h" #elif defined(__sparc__) && defined(__arch64__) #include "pg_config_sparc64.h" #elif defined(__sparc__) #include "pg_config_sparc.h" #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/datatype/timestamp.h�������������������������������������������������������������������0000644�����������������00000012777�14763166026�0013220 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * timestamp.h * Timestamp and Interval typedefs and related macros. * * Note: this file must be includable in both frontend and backend contexts. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/datatype/timestamp.h * *------------------------------------------------------------------------- */ #ifndef DATATYPE_TIMESTAMP_H #define DATATYPE_TIMESTAMP_H #include <math.h> #include <limits.h> #include <float.h> /* * Timestamp represents absolute time. * * Interval represents delta time. Keep track of months (and years), days, * and hours/minutes/seconds separately since the elapsed time spanned is * unknown until instantiated relative to an absolute time. * * Note that Postgres uses "time interval" to mean a bounded interval, * consisting of a beginning and ending time, not a time span - thomas 97/03/20 * * We have two implementations, one that uses int64 values with units of * microseconds, and one that uses double values with units of seconds. * * TimeOffset and fsec_t are convenience typedefs for temporary variables * that are of different types in the two cases. Do not use fsec_t in values * stored on-disk, since it is not the same size in both implementations. * Also, fsec_t is only meant for *fractional* seconds; beware of overflow * if the value you need to store could be many seconds. */ #ifdef HAVE_INT64_TIMESTAMP typedef int64 Timestamp; typedef int64 TimestampTz; typedef int64 TimeOffset; typedef int32 fsec_t; /* fractional seconds (in microseconds) */ #else typedef double Timestamp; typedef double TimestampTz; typedef double TimeOffset; typedef double fsec_t; /* fractional seconds (in seconds) */ #endif typedef struct { TimeOffset time; /* all time units other than days, months and * years */ int32 day; /* days, after time for alignment */ int32 month; /* months and years, after time for alignment */ } Interval; #define MAX_TIMESTAMP_PRECISION 6 #define MAX_INTERVAL_PRECISION 6 /* * Round off to MAX_TIMESTAMP_PRECISION decimal places. * Note: this is also used for rounding off intervals. */ #define TS_PREC_INV 1000000.0 #define TSROUND(j) (rint(((double) (j)) * TS_PREC_INV) / TS_PREC_INV) /* * Assorted constants for datetime-related calculations */ #define DAYS_PER_YEAR 365.25 /* assumes leap year every four years */ #define MONTHS_PER_YEAR 12 /* * DAYS_PER_MONTH is very imprecise. The more accurate value is * 365.2425/12 = 30.436875, or '30 days 10:29:06'. Right now we only * return an integral number of days, but someday perhaps we should * also return a 'time' value to be used as well. ISO 8601 suggests * 30 days. */ #define DAYS_PER_MONTH 30 /* assumes exactly 30 days per month */ #define HOURS_PER_DAY 24 /* assume no daylight savings time changes */ /* * This doesn't adjust for uneven daylight savings time intervals or leap * seconds, and it crudely estimates leap years. A more accurate value * for days per years is 365.2422. */ #define SECS_PER_YEAR (36525 * 864) /* avoid floating-point computation */ #define SECS_PER_DAY 86400 #define SECS_PER_HOUR 3600 #define SECS_PER_MINUTE 60 #define MINS_PER_HOUR 60 #define USECS_PER_DAY INT64CONST(86400000000) #define USECS_PER_HOUR INT64CONST(3600000000) #define USECS_PER_MINUTE INT64CONST(60000000) #define USECS_PER_SEC INT64CONST(1000000) /* * We allow numeric timezone offsets up to 15:59:59 either way from Greenwich. * Currently, the record holders for wackiest offsets in actual use are zones * Asia/Manila, at -15:56:00 until 1844, and America/Metlakatla, at +15:13:42 * until 1867. If we were to reject such values we would fail to dump and * restore old timestamptz values with these zone settings. */ #define MAX_TZDISP_HOUR 15 /* maximum allowed hour part */ #define TZDISP_LIMIT ((MAX_TZDISP_HOUR + 1) * SECS_PER_HOUR) /* * DT_NOBEGIN represents timestamp -infinity; DT_NOEND represents +infinity */ #ifdef HAVE_INT64_TIMESTAMP #define DT_NOBEGIN (-INT64CONST(0x7fffffffffffffff) - 1) #define DT_NOEND (INT64CONST(0x7fffffffffffffff)) #else /* !HAVE_INT64_TIMESTAMP */ #ifdef HUGE_VAL #define DT_NOBEGIN (-HUGE_VAL) #define DT_NOEND (HUGE_VAL) #else #define DT_NOBEGIN (-DBL_MAX) #define DT_NOEND (DBL_MAX) #endif #endif /* HAVE_INT64_TIMESTAMP */ #define TIMESTAMP_NOBEGIN(j) \ do {(j) = DT_NOBEGIN;} while (0) #define TIMESTAMP_IS_NOBEGIN(j) ((j) == DT_NOBEGIN) #define TIMESTAMP_NOEND(j) \ do {(j) = DT_NOEND;} while (0) #define TIMESTAMP_IS_NOEND(j) ((j) == DT_NOEND) #define TIMESTAMP_NOT_FINITE(j) (TIMESTAMP_IS_NOBEGIN(j) || TIMESTAMP_IS_NOEND(j)) /* * Julian date support. * * IS_VALID_JULIAN checks the minimum date exactly, but is a bit sloppy * about the maximum, since it's far enough out to not be especially * interesting. */ #define JULIAN_MINYEAR (-4713) #define JULIAN_MINMONTH (11) #define JULIAN_MINDAY (24) #define JULIAN_MAXYEAR (5874898) #define IS_VALID_JULIAN(y,m,d) \ (((y) > JULIAN_MINYEAR \ || ((y) == JULIAN_MINYEAR && \ ((m) > JULIAN_MINMONTH \ || ((m) == JULIAN_MINMONTH && (d) >= JULIAN_MINDAY)))) \ && (y) < JULIAN_MAXYEAR) #define JULIAN_MAX (2147483494) /* == date2j(JULIAN_MAXYEAR, 1, 1) */ /* Julian-date equivalents of Day 0 in Unix and Postgres reckoning */ #define UNIX_EPOCH_JDATE 2440588 /* == date2j(1970, 1, 1) */ #define POSTGRES_EPOCH_JDATE 2451545 /* == date2j(2000, 1, 1) */ #endif /* DATATYPE_TIMESTAMP_H */ �pgsql/server/pgtime.h�������������������������������������������������������������������������������0000644�����������������00000004405�14763166026�0010654 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pgtime.h * PostgreSQL internal timezone library * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * * IDENTIFICATION * src/include/pgtime.h * *------------------------------------------------------------------------- */ #ifndef _PGTIME_H #define _PGTIME_H /* * The API of this library is generally similar to the corresponding * C library functions, except that we use pg_time_t which (we hope) is * 64 bits wide, and which is most definitely signed not unsigned. */ typedef int64 pg_time_t; struct pg_tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; /* origin 0, not 1 */ int tm_year; /* relative to 1900 */ int tm_wday; int tm_yday; int tm_isdst; long int tm_gmtoff; const char *tm_zone; }; typedef struct pg_tz pg_tz; typedef struct pg_tzenum pg_tzenum; /* Maximum length of a timezone name (not including trailing null) */ #define TZ_STRLEN_MAX 255 /* these functions are in localtime.c */ extern struct pg_tm *pg_localtime(const pg_time_t *timep, const pg_tz *tz); extern struct pg_tm *pg_gmtime(const pg_time_t *timep); extern int pg_next_dst_boundary(const pg_time_t *timep, long int *before_gmtoff, int *before_isdst, pg_time_t *boundary, long int *after_gmtoff, int *after_isdst, const pg_tz *tz); extern bool pg_interpret_timezone_abbrev(const char *abbrev, const pg_time_t *timep, long int *gmtoff, int *isdst, const pg_tz *tz); extern bool pg_get_timezone_offset(const pg_tz *tz, long int *gmtoff); extern const char *pg_get_timezone_name(pg_tz *tz); extern bool pg_tz_acceptable(pg_tz *tz); /* these functions are in strftime.c */ extern size_t pg_strftime(char *s, size_t max, const char *format, const struct pg_tm * tm); /* these functions and variables are in pgtz.c */ extern pg_tz *session_timezone; extern pg_tz *log_timezone; extern void pg_timezone_initialize(void); extern pg_tz *pg_tzset(const char *tzname); extern pg_tz *pg_tzset_offset(long gmtoffset); extern pg_tzenum *pg_tzenumerate_start(void); extern pg_tz *pg_tzenumerate_next(pg_tzenum *dir); extern void pg_tzenumerate_end(pg_tzenum *dir); #endif /* _PGTIME_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/tsearch/ts_type.h����������������������������������������������������������������������0000644�����������������00000021402�14763166026�0012503 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * ts_type.h * Definitions for the tsvector and tsquery types * * Copyright (c) 1998-2012, PostgreSQL Global Development Group * * src/include/tsearch/ts_type.h * *------------------------------------------------------------------------- */ #ifndef _PG_TSTYPE_H_ #define _PG_TSTYPE_H_ #include "fmgr.h" #include "utils/memutils.h" #include "utils/pg_crc.h" /* * TSVector type. * * Structure of tsvector datatype: * 1) standard varlena header * 2) int4 size - number of lexemes (WordEntry array entries) * 3) Array of WordEntry - one per lexeme; must be sorted according to * tsCompareString() (ie, memcmp of lexeme strings). * WordEntry->pos gives the number of bytes from end of WordEntry * array to start of lexeme's string, which is of length len. * 4) Per-lexeme data storage: * lexeme string (not null-terminated) * if haspos is true: * padding byte if necessary to make the position data 2-byte aligned * uint16 number of positions that follow * WordEntryPos[] positions * * The positions for each lexeme must be sorted. * * Note, tsvectorsend/recv believe that sizeof(WordEntry) == 4 */ typedef struct { uint32 haspos:1, len:11, /* MAX 2Kb */ pos:20; /* MAX 1Mb */ } WordEntry; #define MAXSTRLEN ( (1<<11) - 1) #define MAXSTRPOS ( (1<<20) - 1) /* * Equivalent to * typedef struct { * uint16 * weight:2, * pos:14; * } */ typedef uint16 WordEntryPos; typedef struct { uint16 npos; WordEntryPos pos[1]; /* variable length */ } WordEntryPosVector; #define WEP_GETWEIGHT(x) ( (x) >> 14 ) #define WEP_GETPOS(x) ( (x) & 0x3fff ) #define WEP_SETWEIGHT(x,v) ( (x) = ( (v) << 14 ) | ( (x) & 0x3fff ) ) #define WEP_SETPOS(x,v) ( (x) = ( (x) & 0xc000 ) | ( (v) & 0x3fff ) ) #define MAXENTRYPOS (1<<14) #define MAXNUMPOS (256) #define LIMITPOS(x) ( ( (x) >= MAXENTRYPOS ) ? (MAXENTRYPOS-1) : (x) ) /* This struct represents a complete tsvector datum */ typedef struct { int32 vl_len_; /* varlena header (do not touch directly!) */ int32 size; WordEntry entries[1]; /* variable length */ /* lexemes follow the entries[] array */ } TSVectorData; typedef TSVectorData *TSVector; #define DATAHDRSIZE (offsetof(TSVectorData, entries)) #define CALCDATASIZE(nentries, lenstr) (DATAHDRSIZE + (nentries) * sizeof(WordEntry) + (lenstr) ) /* pointer to start of a tsvector's WordEntry array */ #define ARRPTR(x) ( (x)->entries ) /* pointer to start of a tsvector's lexeme storage */ #define STRPTR(x) ( (char *) &(x)->entries[(x)->size] ) #define _POSVECPTR(x, e) ((WordEntryPosVector *)(STRPTR(x) + SHORTALIGN((e)->pos + (e)->len))) #define POSDATALEN(x,e) ( ( (e)->haspos ) ? (_POSVECPTR(x,e)->npos) : 0 ) #define POSDATAPTR(x,e) (_POSVECPTR(x,e)->pos) /* * fmgr interface macros */ #define DatumGetTSVector(X) ((TSVector) PG_DETOAST_DATUM(X)) #define DatumGetTSVectorCopy(X) ((TSVector) PG_DETOAST_DATUM_COPY(X)) #define TSVectorGetDatum(X) PointerGetDatum(X) #define PG_GETARG_TSVECTOR(n) DatumGetTSVector(PG_GETARG_DATUM(n)) #define PG_GETARG_TSVECTOR_COPY(n) DatumGetTSVectorCopy(PG_GETARG_DATUM(n)) #define PG_RETURN_TSVECTOR(x) return TSVectorGetDatum(x) /* * I/O */ extern Datum tsvectorin(PG_FUNCTION_ARGS); extern Datum tsvectorout(PG_FUNCTION_ARGS); extern Datum tsvectorsend(PG_FUNCTION_ARGS); extern Datum tsvectorrecv(PG_FUNCTION_ARGS); /* * operations with tsvector */ extern Datum tsvector_lt(PG_FUNCTION_ARGS); extern Datum tsvector_le(PG_FUNCTION_ARGS); extern Datum tsvector_eq(PG_FUNCTION_ARGS); extern Datum tsvector_ne(PG_FUNCTION_ARGS); extern Datum tsvector_ge(PG_FUNCTION_ARGS); extern Datum tsvector_gt(PG_FUNCTION_ARGS); extern Datum tsvector_cmp(PG_FUNCTION_ARGS); extern Datum tsvector_length(PG_FUNCTION_ARGS); extern Datum tsvector_strip(PG_FUNCTION_ARGS); extern Datum tsvector_setweight(PG_FUNCTION_ARGS); extern Datum tsvector_concat(PG_FUNCTION_ARGS); extern Datum tsvector_update_trigger_byid(PG_FUNCTION_ARGS); extern Datum tsvector_update_trigger_bycolumn(PG_FUNCTION_ARGS); extern Datum ts_match_vq(PG_FUNCTION_ARGS); extern Datum ts_match_qv(PG_FUNCTION_ARGS); extern Datum ts_match_tt(PG_FUNCTION_ARGS); extern Datum ts_match_tq(PG_FUNCTION_ARGS); extern Datum ts_stat1(PG_FUNCTION_ARGS); extern Datum ts_stat2(PG_FUNCTION_ARGS); extern Datum ts_rank_tt(PG_FUNCTION_ARGS); extern Datum ts_rank_wtt(PG_FUNCTION_ARGS); extern Datum ts_rank_ttf(PG_FUNCTION_ARGS); extern Datum ts_rank_wttf(PG_FUNCTION_ARGS); extern Datum ts_rankcd_tt(PG_FUNCTION_ARGS); extern Datum ts_rankcd_wtt(PG_FUNCTION_ARGS); extern Datum ts_rankcd_ttf(PG_FUNCTION_ARGS); extern Datum ts_rankcd_wttf(PG_FUNCTION_ARGS); extern Datum tsmatchsel(PG_FUNCTION_ARGS); extern Datum tsmatchjoinsel(PG_FUNCTION_ARGS); extern Datum ts_typanalyze(PG_FUNCTION_ARGS); /* * TSQuery * * */ typedef int8 QueryItemType; /* Valid values for QueryItemType: */ #define QI_VAL 1 #define QI_OPR 2 #define QI_VALSTOP 3 /* This is only used in an intermediate stack * representation in parse_tsquery. It's not a * legal type elsewhere. */ /* * QueryItem is one node in tsquery - operator or operand. */ typedef struct { QueryItemType type; /* operand or kind of operator (ts_tokentype) */ uint8 weight; /* weights of operand to search. It's a * bitmask of allowed weights. if it =0 then * any weight are allowed. Weights and bit * map: A: 1<<3 B: 1<<2 C: 1<<1 D: 1<<0 */ bool prefix; /* true if it's a prefix search */ int32 valcrc; /* XXX: pg_crc32 would be a more appropriate * data type, but we use comparisons to signed * integers in the code. They would need to be * changed as well. */ /* pointer to text value of operand, must correlate with WordEntry */ uint32 length:12, distance:20; } QueryOperand; /* Legal values for QueryOperator.operator */ #define OP_NOT 1 #define OP_AND 2 #define OP_OR 3 typedef struct { QueryItemType type; int8 oper; /* see above */ uint32 left; /* pointer to left operand. Right operand is * item + 1, left operand is placed * item+item->left */ } QueryOperator; /* * Note: TSQuery is 4-bytes aligned, so make sure there's no fields * inside QueryItem requiring 8-byte alignment, like int64. */ typedef union { QueryItemType type; QueryOperator qoperator; QueryOperand qoperand; } QueryItem; /* * Storage: * (len)(size)(array of QueryItem)(operands as '\0'-terminated c-strings) */ typedef struct { int32 vl_len_; /* varlena header (do not touch directly!) */ int4 size; /* number of QueryItems */ char data[1]; /* data starts here */ } TSQueryData; typedef TSQueryData *TSQuery; #define HDRSIZETQ ( VARHDRSZ + sizeof(int4) ) /* Computes the size of header and all QueryItems. size is the number of * QueryItems, and lenofoperand is the total length of all operands */ #define COMPUTESIZE(size, lenofoperand) ( HDRSIZETQ + (size) * sizeof(QueryItem) + (lenofoperand) ) #define TSQUERY_TOO_BIG(size, lenofoperand) \ ((size) > (MaxAllocSize - HDRSIZETQ - (lenofoperand)) / sizeof(QueryItem)) /* Returns a pointer to the first QueryItem in a TSQuery */ #define GETQUERY(x) ((QueryItem*)( (char*)(x)+HDRSIZETQ )) /* Returns a pointer to the beginning of operands in a TSQuery */ #define GETOPERAND(x) ( (char*)GETQUERY(x) + ((TSQuery)(x))->size * sizeof(QueryItem) ) /* * fmgr interface macros * Note, TSQuery type marked as plain storage, so it can't be toasted * but PG_DETOAST_DATUM_COPY is used for simplicity */ #define DatumGetTSQuery(X) ((TSQuery) DatumGetPointer(X)) #define DatumGetTSQueryCopy(X) ((TSQuery) PG_DETOAST_DATUM_COPY(X)) #define TSQueryGetDatum(X) PointerGetDatum(X) #define PG_GETARG_TSQUERY(n) DatumGetTSQuery(PG_GETARG_DATUM(n)) #define PG_GETARG_TSQUERY_COPY(n) DatumGetTSQueryCopy(PG_GETARG_DATUM(n)) #define PG_RETURN_TSQUERY(x) return TSQueryGetDatum(x) /* * I/O */ extern Datum tsqueryin(PG_FUNCTION_ARGS); extern Datum tsqueryout(PG_FUNCTION_ARGS); extern Datum tsquerysend(PG_FUNCTION_ARGS); extern Datum tsqueryrecv(PG_FUNCTION_ARGS); /* * operations with tsquery */ extern Datum tsquery_lt(PG_FUNCTION_ARGS); extern Datum tsquery_le(PG_FUNCTION_ARGS); extern Datum tsquery_eq(PG_FUNCTION_ARGS); extern Datum tsquery_ne(PG_FUNCTION_ARGS); extern Datum tsquery_ge(PG_FUNCTION_ARGS); extern Datum tsquery_gt(PG_FUNCTION_ARGS); extern Datum tsquery_cmp(PG_FUNCTION_ARGS); extern Datum tsquerytree(PG_FUNCTION_ARGS); extern Datum tsquery_numnode(PG_FUNCTION_ARGS); extern Datum tsquery_and(PG_FUNCTION_ARGS); extern Datum tsquery_or(PG_FUNCTION_ARGS); extern Datum tsquery_not(PG_FUNCTION_ARGS); extern Datum tsquery_rewrite(PG_FUNCTION_ARGS); extern Datum tsquery_rewrite_query(PG_FUNCTION_ARGS); extern Datum tsq_mcontains(PG_FUNCTION_ARGS); extern Datum tsq_mcontained(PG_FUNCTION_ARGS); #endif /* _PG_TSTYPE_H_ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/tsearch/ts_locale.h��������������������������������������������������������������������0000644�����������������00000004007�14763166026�0012763 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * ts_locale.h * locale compatibility layer for tsearch * * Copyright (c) 1998-2012, PostgreSQL Global Development Group * * src/include/tsearch/ts_locale.h * *------------------------------------------------------------------------- */ #ifndef __TSLOCALE_H__ #define __TSLOCALE_H__ #include <ctype.h> #include <limits.h> #include "utils/pg_locale.h" #include "mb/pg_wchar.h" /* * towlower() and friends should be in <wctype.h>, but some pre-C99 systems * declare them in <wchar.h>. */ #ifdef HAVE_WCHAR_H #include <wchar.h> #endif #ifdef HAVE_WCTYPE_H #include <wctype.h> #endif /* working state for tsearch_readline (should be a local var in caller) */ typedef struct { FILE *fp; const char *filename; int lineno; char *curline; ErrorContextCallback cb; } tsearch_readline_state; #define TOUCHAR(x) (*((const unsigned char *) (x))) #ifdef USE_WIDE_UPPER_LOWER extern int t_isdigit(const char *ptr); extern int t_isspace(const char *ptr); extern int t_isalpha(const char *ptr); extern int t_isprint(const char *ptr); /* The second argument of t_iseq() must be a plain ASCII character */ #define t_iseq(x,c) (TOUCHAR(x) == (unsigned char) (c)) #define COPYCHAR(d,s) memcpy(d, s, pg_mblen(s)) #else /* not USE_WIDE_UPPER_LOWER */ #define t_isdigit(x) isdigit(TOUCHAR(x)) #define t_isspace(x) isspace(TOUCHAR(x)) #define t_isalpha(x) isalpha(TOUCHAR(x)) #define t_isprint(x) isprint(TOUCHAR(x)) #define t_iseq(x,c) (TOUCHAR(x) == (unsigned char) (c)) #define COPYCHAR(d,s) (*((unsigned char *) (d)) = TOUCHAR(s)) #endif /* USE_WIDE_UPPER_LOWER */ extern char *lowerstr(const char *str); extern char *lowerstr_with_len(const char *str, int len); extern bool tsearch_readline_begin(tsearch_readline_state *stp, const char *filename); extern char *tsearch_readline(tsearch_readline_state *stp); extern void tsearch_readline_end(tsearch_readline_state *stp); extern char *t_readline(FILE *fp); #endif /* __TSLOCALE_H__ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/tsearch/ts_cache.h���������������������������������������������������������������������0000644�����������������00000004075�14763166026�0012574 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * ts_cache.h * Tsearch related object caches. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/tsearch/ts_cache.h * *------------------------------------------------------------------------- */ #ifndef TS_CACHE_H #define TS_CACHE_H #include "utils/guc.h" /* * All TS*CacheEntry structs must share this common header * (see InvalidateTSCacheCallBack) */ typedef struct TSAnyCacheEntry { Oid objId; bool isvalid; } TSAnyCacheEntry; typedef struct TSParserCacheEntry { /* prsId is the hash lookup key and MUST BE FIRST */ Oid prsId; /* OID of the parser */ bool isvalid; Oid startOid; Oid tokenOid; Oid endOid; Oid headlineOid; Oid lextypeOid; /* * Pre-set-up fmgr call of most needed parser's methods */ FmgrInfo prsstart; FmgrInfo prstoken; FmgrInfo prsend; FmgrInfo prsheadline; } TSParserCacheEntry; typedef struct TSDictionaryCacheEntry { /* dictId is the hash lookup key and MUST BE FIRST */ Oid dictId; bool isvalid; /* most frequent fmgr call */ Oid lexizeOid; FmgrInfo lexize; MemoryContext dictCtx; /* memory context to store private data */ void *dictData; } TSDictionaryCacheEntry; typedef struct { int len; Oid *dictIds; } ListDictionary; typedef struct { /* cfgId is the hash lookup key and MUST BE FIRST */ Oid cfgId; bool isvalid; Oid prsId; int lenmap; ListDictionary *map; } TSConfigCacheEntry; /* * GUC variable for current configuration */ extern char *TSCurrentConfig; extern TSParserCacheEntry *lookup_ts_parser_cache(Oid prsId); extern TSDictionaryCacheEntry *lookup_ts_dictionary_cache(Oid dictId); extern TSConfigCacheEntry *lookup_ts_config_cache(Oid cfgId); extern Oid getTSCurrentConfig(bool emitError); extern bool check_TSCurrentConfig(char **newval, void **extra, GucSource source); extern void assign_TSCurrentConfig(const char *newval, void *extra); #endif /* TS_CACHE_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/tsearch/ts_public.h��������������������������������������������������������������������0000644�����������������00000005371�14763166026�0013007 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * ts_public.h * Public interface to various tsearch modules, such as * parsers and dictionaries. * * Copyright (c) 1998-2012, PostgreSQL Global Development Group * * src/include/tsearch/ts_public.h * *------------------------------------------------------------------------- */ #ifndef _PG_TS_PUBLIC_H_ #define _PG_TS_PUBLIC_H_ #include "tsearch/ts_type.h" /* * Parser's framework */ /* * returning type for prslextype method of parser */ typedef struct { int lexid; char *alias; char *descr; } LexDescr; /* * Interface to headline generator */ typedef struct { uint32 selected:1, in:1, replace:1, repeated:1, skip:1, unused:3, type:8, len:16; char *word; QueryOperand *item; } HeadlineWordEntry; typedef struct { HeadlineWordEntry *words; int4 lenwords; int4 curwords; char *startsel; char *stopsel; char *fragdelim; int2 startsellen; int2 stopsellen; int2 fragdelimlen; } HeadlineParsedText; /* * Common useful things for tsearch subsystem */ extern char *get_tsearch_config_filename(const char *basename, const char *extension); /* * Often useful stopword list management */ typedef struct { int len; char **stop; } StopList; extern void readstoplist(const char *fname, StopList *s, char *(*wordop) (const char *)); extern bool searchstoplist(StopList *s, char *key); /* * Interface with dictionaries */ /* return struct for any lexize function */ typedef struct { /*---------- * Number of current variant of split word. For example the Norwegian * word 'fotballklubber' has two variants to split: ( fotball, klubb ) * and ( fot, ball, klubb ). So, dictionary should return: * * nvariant lexeme * 1 fotball * 1 klubb * 2 fot * 2 ball * 2 klubb * * In general, a TSLexeme will be considered to belong to the same split * variant as the previous one if they have the same nvariant value. * The exact values don't matter, only changes from one lexeme to next. *---------- */ uint16 nvariant; uint16 flags; /* See flag bits below */ char *lexeme; /* C string */ } TSLexeme; /* Flag bits that can appear in TSLexeme.flags */ #define TSL_ADDPOS 0x01 #define TSL_PREFIX 0x02 #define TSL_FILTER 0x04 /* * Struct for supporting complex dictionaries like thesaurus. * 4th argument for dictlexize method is a pointer to this */ typedef struct { bool isend; /* in: marks for lexize_info about text end is * reached */ bool getnext; /* out: dict wants next lexeme */ void *private_state; /* internal dict state between calls with * getnext == true */ } DictSubState; #endif /* _PG_TS_PUBLIC_H_ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/tsearch/ts_utils.h���������������������������������������������������������������������0000644�����������������00000017225�14763166026�0012672 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * ts_utils.h * helper utilities for tsearch * * Copyright (c) 1998-2012, PostgreSQL Global Development Group * * src/include/tsearch/ts_utils.h * *------------------------------------------------------------------------- */ #ifndef _PG_TS_UTILS_H_ #define _PG_TS_UTILS_H_ #include "tsearch/ts_type.h" #include "tsearch/ts_public.h" #include "nodes/pg_list.h" /* * Common parse definitions for tsvector and tsquery */ /* tsvector parser support. */ struct TSVectorParseStateData; /* opaque struct in tsvector_parser.c */ typedef struct TSVectorParseStateData *TSVectorParseState; extern TSVectorParseState init_tsvector_parser(char *input, bool oprisdelim, bool is_tsquery); extern void reset_tsvector_parser(TSVectorParseState state, char *input); extern bool gettoken_tsvector(TSVectorParseState state, char **token, int *len, WordEntryPos **pos, int *poslen, char **endptr); extern void close_tsvector_parser(TSVectorParseState state); /* parse_tsquery */ struct TSQueryParserStateData; /* private in backend/utils/adt/tsquery.c */ typedef struct TSQueryParserStateData *TSQueryParserState; typedef void (*PushFunction) (Datum opaque, TSQueryParserState state, char *token, int tokenlen, int2 tokenweights, /* bitmap as described * in QueryOperand * struct */ bool prefix); extern TSQuery parse_tsquery(char *buf, PushFunction pushval, Datum opaque, bool isplain); /* Functions for use by PushFunction implementations */ extern void pushValue(TSQueryParserState state, char *strval, int lenval, int2 weight, bool prefix); extern void pushStop(TSQueryParserState state); extern void pushOperator(TSQueryParserState state, int8 oper); /* * parse plain text and lexize words */ typedef struct { uint16 len; uint16 nvariant; union { uint16 pos; /* * When apos array is used, apos[0] is the number of elements in the * array (excluding apos[0]), and alen is the allocated size of the * array. */ uint16 *apos; } pos; uint16 flags; /* currently, only TSL_PREFIX */ char *word; uint32 alen; } ParsedWord; typedef struct { ParsedWord *words; int4 lenwords; int4 curwords; int4 pos; } ParsedText; extern void parsetext(Oid cfgId, ParsedText *prs, char *buf, int4 buflen); /* * headline framework, flow in common to generate: * 1 parse text with hlparsetext * 2 parser-specific function to find part * 3 generateHeadline to generate result text */ extern void hlparsetext(Oid cfgId, HeadlineParsedText *prs, TSQuery query, char *buf, int4 buflen); extern text *generateHeadline(HeadlineParsedText *prs); /* * Common check function for tsvector @@ tsquery */ extern bool TS_execute(QueryItem *curitem, void *checkval, bool calcnot, bool (*chkcond) (void *checkval, QueryOperand *val)); extern bool tsquery_requires_match(QueryItem *curitem); /* * to_ts* - text transformation to tsvector, tsquery */ extern TSVector make_tsvector(ParsedText *prs); extern int32 tsCompareString(char *a, int lena, char *b, int lenb, bool prefix); extern Datum to_tsvector_byid(PG_FUNCTION_ARGS); extern Datum to_tsvector(PG_FUNCTION_ARGS); extern Datum to_tsquery_byid(PG_FUNCTION_ARGS); extern Datum to_tsquery(PG_FUNCTION_ARGS); extern Datum plainto_tsquery_byid(PG_FUNCTION_ARGS); extern Datum plainto_tsquery(PG_FUNCTION_ARGS); /* * GiST support function */ extern Datum gtsvector_compress(PG_FUNCTION_ARGS); extern Datum gtsvector_decompress(PG_FUNCTION_ARGS); extern Datum gtsvector_consistent(PG_FUNCTION_ARGS); extern Datum gtsvector_union(PG_FUNCTION_ARGS); extern Datum gtsvector_same(PG_FUNCTION_ARGS); extern Datum gtsvector_penalty(PG_FUNCTION_ARGS); extern Datum gtsvector_picksplit(PG_FUNCTION_ARGS); /* * IO functions for pseudotype gtsvector * used internally in tsvector GiST opclass */ extern Datum gtsvectorin(PG_FUNCTION_ARGS); extern Datum gtsvectorout(PG_FUNCTION_ARGS); /* * GIN support function */ extern Datum gin_extract_tsvector(PG_FUNCTION_ARGS); extern Datum gin_cmp_tslexeme(PG_FUNCTION_ARGS); extern Datum gin_cmp_prefix(PG_FUNCTION_ARGS); extern Datum gin_extract_tsquery(PG_FUNCTION_ARGS); extern Datum gin_tsquery_consistent(PG_FUNCTION_ARGS); extern Datum gin_extract_tsvector_2args(PG_FUNCTION_ARGS); extern Datum gin_extract_tsquery_5args(PG_FUNCTION_ARGS); extern Datum gin_tsquery_consistent_6args(PG_FUNCTION_ARGS); /* * Possible strategy numbers for indexes * TSearchStrategyNumber - (tsvector|text) @@ tsquery * TSearchWithClassStrategyNumber - tsvector @@@ tsquery */ #define TSearchStrategyNumber 1 #define TSearchWithClassStrategyNumber 2 /* * TSQuery Utilities */ extern QueryItem *clean_NOT(QueryItem *ptr, int4 *len); extern QueryItem *clean_fakeval(QueryItem *ptr, int4 *len); typedef struct QTNode { QueryItem *valnode; uint32 flags; int4 nchild; char *word; uint32 sign; struct QTNode **child; } QTNode; /* bits in QTNode.flags */ #define QTN_NEEDFREE 0x01 #define QTN_NOCHANGE 0x02 #define QTN_WORDFREE 0x04 typedef uint64 TSQuerySign; #define TSQS_SIGLEN (sizeof(TSQuerySign)*BITS_PER_BYTE) #define TSQuerySignGetDatum(X) Int64GetDatum((int64) (X)) #define DatumGetTSQuerySign(X) ((TSQuerySign) DatumGetInt64(X)) #define PG_RETURN_TSQUERYSIGN(X) return TSQuerySignGetDatum(X) #define PG_GETARG_TSQUERYSIGN(n) DatumGetTSQuerySign(PG_GETARG_DATUM(n)) extern QTNode *QT2QTN(QueryItem *in, char *operand); extern TSQuery QTN2QT(QTNode *in); extern void QTNFree(QTNode *in); extern void QTNSort(QTNode *in); extern void QTNTernary(QTNode *in); extern void QTNBinary(QTNode *in); extern int QTNodeCompare(QTNode *an, QTNode *bn); extern QTNode *QTNCopy(QTNode *in); extern void QTNClearFlags(QTNode *in, uint32 flags); extern bool QTNEq(QTNode *a, QTNode *b); extern TSQuerySign makeTSQuerySign(TSQuery a); extern QTNode *findsubquery(QTNode *root, QTNode *ex, QTNode *subs, bool *isfind); /* * TSQuery GiST support */ extern Datum gtsquery_compress(PG_FUNCTION_ARGS); extern Datum gtsquery_decompress(PG_FUNCTION_ARGS); extern Datum gtsquery_consistent(PG_FUNCTION_ARGS); extern Datum gtsquery_union(PG_FUNCTION_ARGS); extern Datum gtsquery_same(PG_FUNCTION_ARGS); extern Datum gtsquery_penalty(PG_FUNCTION_ARGS); extern Datum gtsquery_picksplit(PG_FUNCTION_ARGS); /* * Parser interface to SQL */ extern Datum ts_token_type_byid(PG_FUNCTION_ARGS); extern Datum ts_token_type_byname(PG_FUNCTION_ARGS); extern Datum ts_parse_byid(PG_FUNCTION_ARGS); extern Datum ts_parse_byname(PG_FUNCTION_ARGS); /* * Default word parser */ extern Datum prsd_start(PG_FUNCTION_ARGS); extern Datum prsd_nexttoken(PG_FUNCTION_ARGS); extern Datum prsd_end(PG_FUNCTION_ARGS); extern Datum prsd_headline(PG_FUNCTION_ARGS); extern Datum prsd_lextype(PG_FUNCTION_ARGS); /* * Dictionary interface to SQL */ extern Datum ts_lexize(PG_FUNCTION_ARGS); /* * Simple built-in dictionary */ extern Datum dsimple_init(PG_FUNCTION_ARGS); extern Datum dsimple_lexize(PG_FUNCTION_ARGS); /* * Synonym built-in dictionary */ extern Datum dsynonym_init(PG_FUNCTION_ARGS); extern Datum dsynonym_lexize(PG_FUNCTION_ARGS); /* * ISpell dictionary */ extern Datum dispell_init(PG_FUNCTION_ARGS); extern Datum dispell_lexize(PG_FUNCTION_ARGS); /* * Thesaurus */ extern Datum thesaurus_init(PG_FUNCTION_ARGS); extern Datum thesaurus_lexize(PG_FUNCTION_ARGS); /* * headline */ extern Datum ts_headline_byid_opt(PG_FUNCTION_ARGS); extern Datum ts_headline_byid(PG_FUNCTION_ARGS); extern Datum ts_headline(PG_FUNCTION_ARGS); extern Datum ts_headline_opt(PG_FUNCTION_ARGS); /* * current cfg */ extern Datum get_current_ts_config(PG_FUNCTION_ARGS); #endif /* _PG_TS_UTILS_H_ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/tsearch/dicts/regis.h������������������������������������������������������������������0000644�����������������00000001623�14763166026�0013236 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * regis.h * * Declarations for fast regex subset, used by ISpell * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * * src/include/tsearch/dicts/regis.h * *------------------------------------------------------------------------- */ #ifndef __REGIS_H__ #define __REGIS_H__ typedef struct RegisNode { uint32 type:2, len:16, unused:14; struct RegisNode *next; unsigned char data[1]; } RegisNode; #define RNHDRSZ (offsetof(RegisNode,data)) #define RSF_ONEOF 1 #define RSF_NONEOF 2 typedef struct Regis { RegisNode *node; uint32 issuffix:1, nchar:16, unused:15; } Regis; bool RS_isRegis(const char *str); void RS_compile(Regis *r, bool issuffix, const char *str); void RS_free(Regis *r); /*returns true if matches */ bool RS_execute(Regis *r, char *str); #endif �������������������������������������������������������������������������������������������������������������pgsql/server/tsearch/dicts/spell.h������������������������������������������������������������������0000644�����������������00000007161�14763166026�0013247 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * spell.h * * Declarations for ISpell dictionary * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * * src/include/tsearch/dicts/spell.h * *------------------------------------------------------------------------- */ #ifndef __SPELL_H__ #define __SPELL_H__ #include "regex/regex.h" #include "tsearch/dicts/regis.h" #include "tsearch/ts_public.h" /* * Max length of a flag name. Names longer than this will be truncated * to the maximum. */ #define MAXFLAGLEN 16 struct SPNode; typedef struct { uint32 val:8, isword:1, compoundflag:4, affix:19; struct SPNode *node; } SPNodeData; /* * Names of FF_ are correlated with Hunspell options in affix file * http://hunspell.sourceforge.net/ */ #define FF_COMPOUNDONLY 0x01 #define FF_COMPOUNDBEGIN 0x02 #define FF_COMPOUNDMIDDLE 0x04 #define FF_COMPOUNDLAST 0x08 #define FF_COMPOUNDFLAG ( FF_COMPOUNDBEGIN | FF_COMPOUNDMIDDLE | FF_COMPOUNDLAST ) #define FF_DICTFLAGMASK 0x0f typedef struct SPNode { uint32 length; SPNodeData data[1]; } SPNode; #define SPNHDRSZ (offsetof(SPNode,data)) typedef struct spell_struct { union { /* * flag is filled in by NIImportDictionary. After NISortDictionary, d * is valid and flag is invalid. */ char flag[MAXFLAGLEN]; struct { int affix; int len; } d; } p; char word[1]; /* variable length, null-terminated */ } SPELL; #define SPELLHDRSZ (offsetof(SPELL, word)) typedef struct aff_struct { uint32 flag:8, type:1, flagflags:7, issimple:1, isregis:1, replen:14; char *find; char *repl; union { regex_t regex; Regis regis; } reg; } AFFIX; /* * affixes use dictionary flags too */ #define FF_COMPOUNDPERMITFLAG 0x10 #define FF_COMPOUNDFORBIDFLAG 0x20 #define FF_CROSSPRODUCT 0x40 /* * Don't change the order of these. Initialization sorts by these, * and expects prefixes to come first after sorting. */ #define FF_SUFFIX 1 #define FF_PREFIX 0 struct AffixNode; typedef struct { uint32 val:8, naff:24; AFFIX **aff; struct AffixNode *node; } AffixNodeData; typedef struct AffixNode { uint32 isvoid:1, length:31; AffixNodeData data[1]; } AffixNode; #define ANHRDSZ (offsetof(AffixNode, data)) typedef struct { char *affix; int len; bool issuffix; } CMPDAffix; typedef struct { int maffixes; int naffixes; AFFIX *Affix; AffixNode *Suffix; AffixNode *Prefix; SPNode *Dictionary; char **AffixData; int lenAffixData; int nAffixData; CMPDAffix *CompoundAffix; unsigned char flagval[256]; bool usecompound; /* * Remaining fields are only used during dictionary construction; they are * set up by NIStartBuild and cleared by NIFinishBuild. */ MemoryContext buildCxt; /* temp context for construction */ /* Temporary array of all words in the dict file */ SPELL **Spell; int nspell; /* number of valid entries in Spell array */ int mspell; /* allocated length of Spell array */ /* These are used to allocate "compact" data without palloc overhead */ char *firstfree; /* first free address (always maxaligned) */ size_t avail; /* free space remaining at firstfree */ } IspellDict; extern TSLexeme *NINormalizeWord(IspellDict *Conf, char *word); extern void NIStartBuild(IspellDict *Conf); extern void NIImportAffixes(IspellDict *Conf, const char *filename); extern void NIImportDictionary(IspellDict *Conf, const char *filename); extern void NISortDictionary(IspellDict *Conf); extern void NISortAffixes(IspellDict *Conf); extern void NIFinishBuild(IspellDict *Conf); #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/postgres_ext.h�������������������������������������������������������������������������0000644�����������������00000003363�14763166026�0012117 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * postgres_ext.h * * This file contains declarations of things that are visible everywhere * in PostgreSQL *and* are visible to clients of frontend interface libraries. * For example, the Oid type is part of the API of libpq and other libraries. * * Declarations which are specific to a particular interface should * go in the header file for that interface (such as libpq-fe.h). This * file is only for fundamental Postgres declarations. * * User-written C functions don't count as "external to Postgres." * Those function much as local modifications to the backend itself, and * use header files that are otherwise internal to Postgres to interface * with the backend. * * src/include/postgres_ext.h * *------------------------------------------------------------------------- */ #ifndef POSTGRES_EXT_H #define POSTGRES_EXT_H /* * Object ID is a fundamental type in Postgres. */ typedef unsigned int Oid; #ifdef __cplusplus #define InvalidOid (Oid(0)) #else #define InvalidOid ((Oid) 0) #endif #define OID_MAX UINT_MAX /* you will need to include <limits.h> to use the above #define */ /* * Identifiers of error message fields. Kept here to keep common * between frontend and backend, and also to export them to libpq * applications. */ #define PG_DIAG_SEVERITY 'S' #define PG_DIAG_SQLSTATE 'C' #define PG_DIAG_MESSAGE_PRIMARY 'M' #define PG_DIAG_MESSAGE_DETAIL 'D' #define PG_DIAG_MESSAGE_HINT 'H' #define PG_DIAG_STATEMENT_POSITION 'P' #define PG_DIAG_INTERNAL_POSITION 'p' #define PG_DIAG_INTERNAL_QUERY 'q' #define PG_DIAG_CONTEXT 'W' #define PG_DIAG_SOURCE_FILE 'F' #define PG_DIAG_SOURCE_LINE 'L' #define PG_DIAG_SOURCE_FUNCTION 'R' #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/bootstrap/bootstrap.h������������������������������������������������������������������0000644�����������������00000003053�14763166026�0013417 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * bootstrap.h * include file for the bootstrapping code * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/bootstrap/bootstrap.h * *------------------------------------------------------------------------- */ #ifndef BOOTSTRAP_H #define BOOTSTRAP_H #include "nodes/execnodes.h" /* * MAXATTR is the maximum number of attributes in a relation supported * at bootstrap time (i.e., the max possible in a system table). */ #define MAXATTR 40 extern Relation boot_reldesc; extern Form_pg_attribute attrtypes[MAXATTR]; extern int numattr; extern void AuxiliaryProcessMain(int argc, char *argv[]); extern void err_out(void); extern void closerel(char *name); extern void boot_openrel(char *name); extern void DefineAttr(char *name, char *type, int attnum); extern void InsertOneTuple(Oid objectid); extern void InsertOneValue(char *value, int i); extern void InsertOneNull(int i); extern char *MapArrayTypeName(const char *s); extern void index_register(Oid heap, Oid ind, IndexInfo *indexInfo); extern void build_indices(void); extern void boot_get_type_io_data(Oid typid, int16 *typlen, bool *typbyval, char *typalign, char *typdelim, Oid *typioparam, Oid *typinput, Oid *typoutput); extern int boot_yyparse(void); extern int boot_yylex(void); extern void boot_yyerror(const char *str); #endif /* BOOTSTRAP_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/dynloader.h����������������������������������������������������������������������������0000644�����������������00000002140�14763166026�0011342 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * linux.h * Port-specific prototypes for Linux * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/backend/port/dynloader/linux.h * *------------------------------------------------------------------------- */ #ifndef PORT_PROTOS_H #define PORT_PROTOS_H #include "utils/dynamic_loader.h" /* pgrminclude ignore */ #ifdef HAVE_DLOPEN #include <dlfcn.h> #endif #ifdef HAVE_DLOPEN /* * In some older systems, the RTLD_NOW flag isn't defined and the mode * argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted * if available, but it doesn't exist everywhere. * If it doesn't exist, set it to 0 so it has no effect. */ #ifndef RTLD_NOW #define RTLD_NOW 1 #endif #ifndef RTLD_GLOBAL #define RTLD_GLOBAL 0 #endif #define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL) #define pg_dlsym dlsym #define pg_dlclose dlclose #define pg_dlerror dlerror #endif /* HAVE_DLOPEN */ #endif /* PORT_PROTOS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/header.h����������������������������������������������������������������������0000644�����������������00000003233�14763166026�0012436 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * header.h * Replacement header file for Snowball stemmer modules * * The Snowball stemmer modules do #include "header.h", and think they * are including snowball/libstemmer/header.h. We adjust the CPPFLAGS * so that this file is found instead, and thereby we can modify the * headers they see. The main point here is to ensure that pg_config.h * is included before any system headers such as <stdio.h>; without that, * we have portability issues on some platforms due to variation in * largefile options across different modules in the backend. * * NOTE: this file should not be included into any non-snowball sources! * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * * src/include/snowball/header.h * *------------------------------------------------------------------------- */ #ifndef SNOWBALL_HEADR_H #define SNOWBALL_HEADR_H #include "postgres.h" /* Some platforms define MAXINT and/or MININT, causing conflicts */ #ifdef MAXINT #undef MAXINT #endif #ifdef MININT #undef MININT #endif /* Now we can include the original Snowball header.h */ #include "snowball/libstemmer/header.h" /* pgrminclude ignore */ /* * Redefine standard memory allocation interface to pgsql's one. * This allows us to control where the Snowball code allocates stuff. */ #ifdef malloc #undef malloc #endif #define malloc(a) palloc(a) #ifdef calloc #undef calloc #endif #define calloc(a,b) palloc0((a) * (b)) #ifdef realloc #undef realloc #endif #define realloc(a,b) repalloc(a,b) #ifdef free #undef free #endif #define free(a) pfree(a) #endif /* SNOWBALL_HEADR_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_ISO_8859_1_dutch.h��������������������������������������������0000644�����������������00000000502�14763166026�0017133 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * dutch_ISO_8859_1_create_env(void); extern void dutch_ISO_8859_1_close_env(struct SN_env * z); extern int dutch_ISO_8859_1_stem(struct SN_env * z); #ifdef __cplusplus } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_ISO_8859_1_german.h�������������������������������������������0000644�����������������00000000505�14763166026�0017300 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * german_ISO_8859_1_create_env(void); extern void german_ISO_8859_1_close_env(struct SN_env * z); extern int german_ISO_8859_1_stem(struct SN_env * z); #ifdef __cplusplus } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_UTF_8_russian.h�����������������������������������������������0000644�����������������00000000471�14763166026�0017033 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * russian_UTF_8_create_env(void); extern void russian_UTF_8_close_env(struct SN_env * z); extern int russian_UTF_8_stem(struct SN_env * z); #ifdef __cplusplus } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_ISO_8859_1_porter.h�������������������������������������������0000644�����������������00000000505�14763166026�0017342 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * porter_ISO_8859_1_create_env(void); extern void porter_ISO_8859_1_close_env(struct SN_env * z); extern int porter_ISO_8859_1_stem(struct SN_env * z); #ifdef __cplusplus } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/header.h�����������������������������������������������������������0000644�����������������00000004667�14763166026�0014615 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� #include <limits.h> #include "api.h" #define MAXINT INT_MAX #define MININT INT_MIN #define HEAD 2*sizeof(int) #define SIZE(p) ((int *)(p))[-1] #define SET_SIZE(p, n) ((int *)(p))[-1] = n #define CAPACITY(p) ((int *)(p))[-2] struct among { int s_size; /* number of chars in string */ const symbol * s; /* search string */ int substring_i;/* index to longest matching substring */ int result; /* result of the lookup */ int (* function)(struct SN_env *); }; extern symbol * create_s(void); extern void lose_s(symbol * p); extern int skip_utf8(const symbol * p, int c, int lb, int l, int n); extern int in_grouping_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); extern int in_grouping_b_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); extern int out_grouping_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); extern int out_grouping_b_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); extern int in_grouping(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); extern int in_grouping_b(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); extern int out_grouping(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); extern int out_grouping_b(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); extern int eq_s(struct SN_env * z, int s_size, const symbol * s); extern int eq_s_b(struct SN_env * z, int s_size, const symbol * s); extern int eq_v(struct SN_env * z, const symbol * p); extern int eq_v_b(struct SN_env * z, const symbol * p); extern int find_among(struct SN_env * z, const struct among * v, int v_size); extern int find_among_b(struct SN_env * z, const struct among * v, int v_size); extern int replace_s(struct SN_env * z, int c_bra, int c_ket, int s_size, const symbol * s, int * adjustment); extern int slice_from_s(struct SN_env * z, int s_size, const symbol * s); extern int slice_from_v(struct SN_env * z, const symbol * p); extern int slice_del(struct SN_env * z); extern int insert_s(struct SN_env * z, int bra, int ket, int s_size, const symbol * s); extern int insert_v(struct SN_env * z, int bra, int ket, const symbol * p); extern symbol * slice_to(struct SN_env * z, symbol * p); extern symbol * assign_to(struct SN_env * z, symbol * p); extern void debug(struct SN_env * z, int number, int line_count); �������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_ISO_8859_1_norwegian.h����������������������������������������0000644�����������������00000000516�14763166026�0020022 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * norwegian_ISO_8859_1_create_env(void); extern void norwegian_ISO_8859_1_close_env(struct SN_env * z); extern int norwegian_ISO_8859_1_stem(struct SN_env * z); #ifdef __cplusplus } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_UTF_8_romanian.h����������������������������������������������0000644�����������������00000000474�14763166026�0017156 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * romanian_UTF_8_create_env(void); extern void romanian_UTF_8_close_env(struct SN_env * z); extern int romanian_UTF_8_stem(struct SN_env * z); #ifdef __cplusplus } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_UTF_8_spanish.h�����������������������������������������������0000644�����������������00000000471�14763166026�0017014 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * spanish_UTF_8_create_env(void); extern void spanish_UTF_8_close_env(struct SN_env * z); extern int spanish_UTF_8_stem(struct SN_env * z); #ifdef __cplusplus } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_UTF_8_english.h�����������������������������������������������0000644�����������������00000000471�14763166026�0017000 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * english_UTF_8_create_env(void); extern void english_UTF_8_close_env(struct SN_env * z); extern int english_UTF_8_stem(struct SN_env * z); #ifdef __cplusplus } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_UTF_8_turkish.h�����������������������������������������������0000644�����������������00000000471�14763166026�0017040 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * turkish_UTF_8_create_env(void); extern void turkish_UTF_8_close_env(struct SN_env * z); extern int turkish_UTF_8_stem(struct SN_env * z); #ifdef __cplusplus } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_ISO_8859_1_italian.h������������������������������������������0000644�����������������00000000510�14763166026�0017444 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * italian_ISO_8859_1_create_env(void); extern void italian_ISO_8859_1_close_env(struct SN_env * z); extern int italian_ISO_8859_1_stem(struct SN_env * z); #ifdef __cplusplus } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_ISO_8859_1_spanish.h������������������������������������������0000644�����������������00000000510�14763166026�0017470 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * spanish_ISO_8859_1_create_env(void); extern void spanish_ISO_8859_1_close_env(struct SN_env * z); extern int spanish_ISO_8859_1_stem(struct SN_env * z); #ifdef __cplusplus } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_UTF_8_danish.h������������������������������������������������0000644�����������������00000000466�14763166026�0016621 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * danish_UTF_8_create_env(void); extern void danish_UTF_8_close_env(struct SN_env * z); extern int danish_UTF_8_stem(struct SN_env * z); #ifdef __cplusplus } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_UTF_8_swedish.h�����������������������������������������������0000644�����������������00000000471�14763166026�0017015 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * swedish_UTF_8_create_env(void); extern void swedish_UTF_8_close_env(struct SN_env * z); extern int swedish_UTF_8_stem(struct SN_env * z); #ifdef __cplusplus } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_UTF_8_italian.h�����������������������������������������������0000644�����������������00000000471�14763166026�0016770 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * italian_UTF_8_create_env(void); extern void italian_UTF_8_close_env(struct SN_env * z); extern int italian_UTF_8_stem(struct SN_env * z); #ifdef __cplusplus } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_ISO_8859_1_portuguese.h���������������������������������������0000644�����������������00000000521�14763166026�0020227 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * portuguese_ISO_8859_1_create_env(void); extern void portuguese_ISO_8859_1_close_env(struct SN_env * z); extern int portuguese_ISO_8859_1_stem(struct SN_env * z); #ifdef __cplusplus } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_ISO_8859_2_romanian.h�����������������������������������������0000644�����������������00000000513�14763166026�0017633 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * romanian_ISO_8859_2_create_env(void); extern void romanian_ISO_8859_2_close_env(struct SN_env * z); extern int romanian_ISO_8859_2_stem(struct SN_env * z); #ifdef __cplusplus } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_UTF_8_portuguese.h��������������������������������������������0000644�����������������00000000502�14763166026�0017544 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * portuguese_UTF_8_create_env(void); extern void portuguese_UTF_8_close_env(struct SN_env * z); extern int portuguese_UTF_8_stem(struct SN_env * z); #ifdef __cplusplus } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_UTF_8_finnish.h�����������������������������������������������0000644�����������������00000000471�14763166026�0017005 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * finnish_UTF_8_create_env(void); extern void finnish_UTF_8_close_env(struct SN_env * z); extern int finnish_UTF_8_stem(struct SN_env * z); #ifdef __cplusplus } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_UTF_8_german.h������������������������������������������������0000644�����������������00000000466�14763166026�0016624 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * german_UTF_8_create_env(void); extern void german_UTF_8_close_env(struct SN_env * z); extern int german_UTF_8_stem(struct SN_env * z); #ifdef __cplusplus } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_UTF_8_dutch.h�������������������������������������������������0000644�����������������00000000463�14763166026�0016457 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * dutch_UTF_8_create_env(void); extern void dutch_UTF_8_close_env(struct SN_env * z); extern int dutch_UTF_8_stem(struct SN_env * z); #ifdef __cplusplus } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_ISO_8859_1_finnish.h������������������������������������������0000644�����������������00000000510�14763166026�0017461 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * finnish_ISO_8859_1_create_env(void); extern void finnish_ISO_8859_1_close_env(struct SN_env * z); extern int finnish_ISO_8859_1_stem(struct SN_env * z); #ifdef __cplusplus } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_KOI8_R_russian.h����������������������������������������������0000644�����������������00000000474�14763166026�0017144 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * russian_KOI8_R_create_env(void); extern void russian_KOI8_R_close_env(struct SN_env * z); extern int russian_KOI8_R_stem(struct SN_env * z); #ifdef __cplusplus } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_UTF_8_porter.h������������������������������������������������0000644�����������������00000000466�14763166026�0016666 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * porter_UTF_8_create_env(void); extern void porter_UTF_8_close_env(struct SN_env * z); extern int porter_UTF_8_stem(struct SN_env * z); #ifdef __cplusplus } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_ISO_8859_1_english.h������������������������������������������0000644�����������������00000000510�14763166026�0017454 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * english_ISO_8859_1_create_env(void); extern void english_ISO_8859_1_close_env(struct SN_env * z); extern int english_ISO_8859_1_stem(struct SN_env * z); #ifdef __cplusplus } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_ISO_8859_1_danish.h�������������������������������������������0000644�����������������00000000505�14763166026�0017275 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * danish_ISO_8859_1_create_env(void); extern void danish_ISO_8859_1_close_env(struct SN_env * z); extern int danish_ISO_8859_1_stem(struct SN_env * z); #ifdef __cplusplus } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_UTF_8_norwegian.h���������������������������������������������0000644�����������������00000000477�14763166026�0017346 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * norwegian_UTF_8_create_env(void); extern void norwegian_UTF_8_close_env(struct SN_env * z); extern int norwegian_UTF_8_stem(struct SN_env * z); #ifdef __cplusplus } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_ISO_8859_1_hungarian.h����������������������������������������0000644�����������������00000000516�14763166026�0020005 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * hungarian_ISO_8859_1_create_env(void); extern void hungarian_ISO_8859_1_close_env(struct SN_env * z); extern int hungarian_ISO_8859_1_stem(struct SN_env * z); #ifdef __cplusplus } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_ISO_8859_1_swedish.h������������������������������������������0000644�����������������00000000510�14763166026�0017471 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * swedish_ISO_8859_1_create_env(void); extern void swedish_ISO_8859_1_close_env(struct SN_env * z); extern int swedish_ISO_8859_1_stem(struct SN_env * z); #ifdef __cplusplus } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/api.h��������������������������������������������������������������0000644�����������������00000001373�14763166026�0014125 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� typedef unsigned char symbol; /* Or replace 'char' above with 'short' for 16 bit characters. More precisely, replace 'char' with whatever type guarantees the character width you need. Note however that sizeof(symbol) should divide HEAD, defined in header.h as 2*sizeof(int), without remainder, otherwise there is an alignment problem. In the unlikely event of a problem here, consult Martin Porter. */ struct SN_env { symbol * p; int c; int l; int lb; int bra; int ket; symbol * * S; int * I; unsigned char * B; }; extern struct SN_env * SN_create_env(int S_size, int I_size, int B_size); extern void SN_close_env(struct SN_env * z, int S_size); extern int SN_set_current(struct SN_env * z, int size, const symbol * s); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_UTF_8_hungarian.h���������������������������������������������0000644�����������������00000000477�14763166026�0017331 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * hungarian_UTF_8_create_env(void); extern void hungarian_UTF_8_close_env(struct SN_env * z); extern int hungarian_UTF_8_stem(struct SN_env * z); #ifdef __cplusplus } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_ISO_8859_1_french.h�������������������������������������������0000644�����������������00000000505�14763166026�0017274 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * french_ISO_8859_1_create_env(void); extern void french_ISO_8859_1_close_env(struct SN_env * z); extern int french_ISO_8859_1_stem(struct SN_env * z); #ifdef __cplusplus } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/snowball/libstemmer/stem_UTF_8_french.h������������������������������������������������0000644�����������������00000000466�14763166026�0016620 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* This file was generated automatically by the Snowball to ANSI C compiler */ #ifdef __cplusplus extern "C" { #endif extern struct SN_env * french_UTF_8_create_env(void); extern void french_UTF_8_close_env(struct SN_env * z); extern int french_UTF_8_stem(struct SN_env * z); #ifdef __cplusplus } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/plpgsql.h������������������������������������������������������������������������������0000644�����������������00000063364�14763166026�0011062 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * plpgsql.h - Definitions for the PL/pgSQL * procedural language * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION * src/pl/plpgsql/src/plpgsql.h * *------------------------------------------------------------------------- */ #ifndef PLPGSQL_H #define PLPGSQL_H #include "postgres.h" #include "access/xact.h" #include "commands/trigger.h" #include "executor/spi.h" /********************************************************************** * Definitions **********************************************************************/ /* define our text domain for translations */ #undef TEXTDOMAIN #define TEXTDOMAIN PG_TEXTDOMAIN("plpgsql") #undef _ #define _(x) dgettext(TEXTDOMAIN, x) /* ---------- * Compiler's namespace item types * ---------- */ enum { PLPGSQL_NSTYPE_LABEL, PLPGSQL_NSTYPE_VAR, PLPGSQL_NSTYPE_ROW, PLPGSQL_NSTYPE_REC }; /* ---------- * Datum array node types * ---------- */ enum { PLPGSQL_DTYPE_VAR, PLPGSQL_DTYPE_ROW, PLPGSQL_DTYPE_REC, PLPGSQL_DTYPE_RECFIELD, PLPGSQL_DTYPE_ARRAYELEM, PLPGSQL_DTYPE_EXPR }; /* ---------- * Variants distinguished in PLpgSQL_type structs * ---------- */ enum { PLPGSQL_TTYPE_SCALAR, /* scalar types and domains */ PLPGSQL_TTYPE_ROW, /* composite types */ PLPGSQL_TTYPE_REC, /* RECORD pseudotype */ PLPGSQL_TTYPE_PSEUDO /* other pseudotypes */ }; /* ---------- * Execution tree node types * ---------- */ enum PLpgSQL_stmt_types { PLPGSQL_STMT_BLOCK, PLPGSQL_STMT_ASSIGN, PLPGSQL_STMT_IF, PLPGSQL_STMT_CASE, PLPGSQL_STMT_LOOP, PLPGSQL_STMT_WHILE, PLPGSQL_STMT_FORI, PLPGSQL_STMT_FORS, PLPGSQL_STMT_FORC, PLPGSQL_STMT_FOREACH_A, PLPGSQL_STMT_EXIT, PLPGSQL_STMT_RETURN, PLPGSQL_STMT_RETURN_NEXT, PLPGSQL_STMT_RETURN_QUERY, PLPGSQL_STMT_RAISE, PLPGSQL_STMT_EXECSQL, PLPGSQL_STMT_DYNEXECUTE, PLPGSQL_STMT_DYNFORS, PLPGSQL_STMT_GETDIAG, PLPGSQL_STMT_OPEN, PLPGSQL_STMT_FETCH, PLPGSQL_STMT_CLOSE, PLPGSQL_STMT_PERFORM }; /* ---------- * Execution node return codes * ---------- */ enum { PLPGSQL_RC_OK, PLPGSQL_RC_EXIT, PLPGSQL_RC_RETURN, PLPGSQL_RC_CONTINUE }; /* ---------- * GET DIAGNOSTICS information items * ---------- */ enum { PLPGSQL_GETDIAG_ROW_COUNT, PLPGSQL_GETDIAG_RESULT_OID, PLPGSQL_GETDIAG_ERROR_CONTEXT, PLPGSQL_GETDIAG_ERROR_DETAIL, PLPGSQL_GETDIAG_ERROR_HINT, PLPGSQL_GETDIAG_RETURNED_SQLSTATE, PLPGSQL_GETDIAG_MESSAGE_TEXT }; /* -------- * RAISE statement options * -------- */ enum { PLPGSQL_RAISEOPTION_ERRCODE, PLPGSQL_RAISEOPTION_MESSAGE, PLPGSQL_RAISEOPTION_DETAIL, PLPGSQL_RAISEOPTION_HINT }; /* -------- * Behavioral modes for plpgsql variable resolution * -------- */ typedef enum { PLPGSQL_RESOLVE_ERROR, /* throw error if ambiguous */ PLPGSQL_RESOLVE_VARIABLE, /* prefer plpgsql var to table column */ PLPGSQL_RESOLVE_COLUMN /* prefer table column to plpgsql var */ } PLpgSQL_resolve_option; /********************************************************************** * Node and structure definitions **********************************************************************/ typedef struct { /* Postgres data type */ char *typname; /* (simple) name of the type */ Oid typoid; /* OID of the data type */ int ttype; /* PLPGSQL_TTYPE_ code */ int16 typlen; /* stuff copied from its pg_type entry */ bool typbyval; Oid typrelid; Oid typioparam; Oid collation; /* from pg_type, but can be overridden */ FmgrInfo typinput; /* lookup info for typinput function */ int32 atttypmod; /* typmod (taken from someplace else) */ } PLpgSQL_type; /* * PLpgSQL_datum is the common supertype for PLpgSQL_expr, PLpgSQL_var, * PLpgSQL_row, PLpgSQL_rec, PLpgSQL_recfield, and PLpgSQL_arrayelem */ typedef struct { /* Generic datum array item */ int dtype; int dno; } PLpgSQL_datum; /* * The variants PLpgSQL_var, PLpgSQL_row, and PLpgSQL_rec share these * fields */ typedef struct { /* Scalar or composite variable */ int dtype; int dno; char *refname; int lineno; } PLpgSQL_variable; typedef struct PLpgSQL_expr { /* SQL Query to plan and execute */ int dtype; int dno; char *query; SPIPlanPtr plan; Bitmapset *paramnos; /* all dnos referenced by this query */ /* function containing this expr (not set until we first parse query) */ struct PLpgSQL_function *func; /* namespace chain visible to this expr */ struct PLpgSQL_nsitem *ns; /* fields for "simple expression" fast-path execution: */ Expr *expr_simple_expr; /* NULL means not a simple expr */ int expr_simple_generation; /* plancache generation we checked */ Oid expr_simple_type; /* result type Oid, if simple */ /* * if expr is simple AND prepared in current transaction, * expr_simple_state and expr_simple_in_use are valid. Test validity by * seeing if expr_simple_lxid matches current LXID. (If not, * expr_simple_state probably points at garbage!) */ ExprState *expr_simple_state; /* eval tree for expr_simple_expr */ bool expr_simple_in_use; /* true if eval tree is active */ LocalTransactionId expr_simple_lxid; } PLpgSQL_expr; typedef struct { /* Scalar variable */ int dtype; int dno; char *refname; int lineno; PLpgSQL_type *datatype; int isconst; int notnull; PLpgSQL_expr *default_val; PLpgSQL_expr *cursor_explicit_expr; int cursor_explicit_argrow; int cursor_options; Datum value; bool isnull; bool freeval; } PLpgSQL_var; typedef struct { /* Row variable */ int dtype; int dno; char *refname; int lineno; TupleDesc rowtupdesc; /* * Note: TupleDesc is only set up for named rowtypes, else it is NULL. * * Note: if the underlying rowtype contains a dropped column, the * corresponding fieldnames[] entry will be NULL, and there is no * corresponding var (varnos[] will be -1). */ int nfields; char **fieldnames; int *varnos; } PLpgSQL_row; typedef struct { /* Record variable (non-fixed structure) */ int dtype; int dno; char *refname; int lineno; HeapTuple tup; TupleDesc tupdesc; bool freetup; bool freetupdesc; } PLpgSQL_rec; typedef struct { /* Field in record */ int dtype; int dno; char *fieldname; int recparentno; /* dno of parent record */ } PLpgSQL_recfield; typedef struct { /* Element of array variable */ int dtype; int dno; PLpgSQL_expr *subscript; int arrayparentno; /* dno of parent array variable */ /* Remaining fields are cached info about the array variable's type */ Oid parenttypoid; /* type of array variable; 0 if not yet set */ int32 parenttypmod; /* typmod of array variable */ Oid arraytypoid; /* OID of actual array type */ int32 arraytypmod; /* typmod of array (and its elements too) */ int16 arraytyplen; /* typlen of array type */ Oid elemtypoid; /* OID of array element type */ int16 elemtyplen; /* typlen of element type */ bool elemtypbyval; /* element type is pass-by-value? */ char elemtypalign; /* typalign of element type */ } PLpgSQL_arrayelem; typedef struct PLpgSQL_nsitem { /* Item in the compilers namespace tree */ int itemtype; int itemno; struct PLpgSQL_nsitem *prev; char name[1]; /* actually, as long as needed */ } PLpgSQL_nsitem; typedef struct { /* Generic execution node */ int cmd_type; int lineno; } PLpgSQL_stmt; typedef struct PLpgSQL_condition { /* One EXCEPTION condition name */ int sqlerrstate; /* SQLSTATE code */ char *condname; /* condition name (for debugging) */ struct PLpgSQL_condition *next; } PLpgSQL_condition; typedef struct { int sqlstate_varno; int sqlerrm_varno; List *exc_list; /* List of WHEN clauses */ } PLpgSQL_exception_block; typedef struct { /* One EXCEPTION ... WHEN clause */ int lineno; PLpgSQL_condition *conditions; List *action; /* List of statements */ } PLpgSQL_exception; typedef struct { /* Block of statements */ int cmd_type; int lineno; char *label; List *body; /* List of statements */ int n_initvars; int *initvarnos; PLpgSQL_exception_block *exceptions; } PLpgSQL_stmt_block; typedef struct { /* Assign statement */ int cmd_type; int lineno; int varno; PLpgSQL_expr *expr; } PLpgSQL_stmt_assign; typedef struct { /* PERFORM statement */ int cmd_type; int lineno; PLpgSQL_expr *expr; } PLpgSQL_stmt_perform; typedef struct { /* Get Diagnostics item */ int kind; /* id for diagnostic value desired */ int target; /* where to assign it */ } PLpgSQL_diag_item; typedef struct { /* Get Diagnostics statement */ int cmd_type; int lineno; bool is_stacked; /* STACKED or CURRENT diagnostics area? */ List *diag_items; /* List of PLpgSQL_diag_item */ } PLpgSQL_stmt_getdiag; typedef struct { /* IF statement */ int cmd_type; int lineno; PLpgSQL_expr *cond; /* boolean expression for THEN */ List *then_body; /* List of statements */ List *elsif_list; /* List of PLpgSQL_if_elsif structs */ List *else_body; /* List of statements */ } PLpgSQL_stmt_if; typedef struct /* one ELSIF arm of IF statement */ { int lineno; PLpgSQL_expr *cond; /* boolean expression for this case */ List *stmts; /* List of statements */ } PLpgSQL_if_elsif; typedef struct /* CASE statement */ { int cmd_type; int lineno; PLpgSQL_expr *t_expr; /* test expression, or NULL if none */ int t_varno; /* var to store test expression value into */ List *case_when_list; /* List of PLpgSQL_case_when structs */ bool have_else; /* flag needed because list could be empty */ List *else_stmts; /* List of statements */ } PLpgSQL_stmt_case; typedef struct /* one arm of CASE statement */ { int lineno; PLpgSQL_expr *expr; /* boolean expression for this case */ List *stmts; /* List of statements */ } PLpgSQL_case_when; typedef struct { /* Unconditional LOOP statement */ int cmd_type; int lineno; char *label; List *body; /* List of statements */ } PLpgSQL_stmt_loop; typedef struct { /* WHILE cond LOOP statement */ int cmd_type; int lineno; char *label; PLpgSQL_expr *cond; List *body; /* List of statements */ } PLpgSQL_stmt_while; typedef struct { /* FOR statement with integer loopvar */ int cmd_type; int lineno; char *label; PLpgSQL_var *var; PLpgSQL_expr *lower; PLpgSQL_expr *upper; PLpgSQL_expr *step; /* NULL means default (ie, BY 1) */ int reverse; List *body; /* List of statements */ } PLpgSQL_stmt_fori; /* * PLpgSQL_stmt_forq represents a FOR statement running over a SQL query. * It is the common supertype of PLpgSQL_stmt_fors, PLpgSQL_stmt_forc * and PLpgSQL_dynfors. */ typedef struct { int cmd_type; int lineno; char *label; PLpgSQL_rec *rec; PLpgSQL_row *row; List *body; /* List of statements */ } PLpgSQL_stmt_forq; typedef struct { /* FOR statement running over SELECT */ int cmd_type; int lineno; char *label; PLpgSQL_rec *rec; PLpgSQL_row *row; List *body; /* List of statements */ /* end of fields that must match PLpgSQL_stmt_forq */ PLpgSQL_expr *query; } PLpgSQL_stmt_fors; typedef struct { /* FOR statement running over cursor */ int cmd_type; int lineno; char *label; PLpgSQL_rec *rec; PLpgSQL_row *row; List *body; /* List of statements */ /* end of fields that must match PLpgSQL_stmt_forq */ int curvar; PLpgSQL_expr *argquery; /* cursor arguments if any */ } PLpgSQL_stmt_forc; typedef struct { /* FOR statement running over EXECUTE */ int cmd_type; int lineno; char *label; PLpgSQL_rec *rec; PLpgSQL_row *row; List *body; /* List of statements */ /* end of fields that must match PLpgSQL_stmt_forq */ PLpgSQL_expr *query; List *params; /* USING expressions */ } PLpgSQL_stmt_dynfors; typedef struct { /* FOREACH item in array loop */ int cmd_type; int lineno; char *label; int varno; /* loop target variable */ int slice; /* slice dimension, or 0 */ PLpgSQL_expr *expr; /* array expression */ List *body; /* List of statements */ } PLpgSQL_stmt_foreach_a; typedef struct { /* OPEN a curvar */ int cmd_type; int lineno; int curvar; int cursor_options; PLpgSQL_row *returntype; PLpgSQL_expr *argquery; PLpgSQL_expr *query; PLpgSQL_expr *dynquery; List *params; /* USING expressions */ } PLpgSQL_stmt_open; typedef struct { /* FETCH or MOVE statement */ int cmd_type; int lineno; PLpgSQL_rec *rec; /* target, as record or row */ PLpgSQL_row *row; int curvar; /* cursor variable to fetch from */ FetchDirection direction; /* fetch direction */ long how_many; /* count, if constant (expr is NULL) */ PLpgSQL_expr *expr; /* count, if expression */ bool is_move; /* is this a fetch or move? */ bool returns_multiple_rows; /* can return more than one row? */ } PLpgSQL_stmt_fetch; typedef struct { /* CLOSE curvar */ int cmd_type; int lineno; int curvar; } PLpgSQL_stmt_close; typedef struct { /* EXIT or CONTINUE statement */ int cmd_type; int lineno; bool is_exit; /* Is this an exit or a continue? */ char *label; /* NULL if it's an unlabelled EXIT/CONTINUE */ PLpgSQL_expr *cond; } PLpgSQL_stmt_exit; typedef struct { /* RETURN statement */ int cmd_type; int lineno; PLpgSQL_expr *expr; int retvarno; } PLpgSQL_stmt_return; typedef struct { /* RETURN NEXT statement */ int cmd_type; int lineno; PLpgSQL_expr *expr; int retvarno; } PLpgSQL_stmt_return_next; typedef struct { /* RETURN QUERY statement */ int cmd_type; int lineno; PLpgSQL_expr *query; /* if static query */ PLpgSQL_expr *dynquery; /* if dynamic query (RETURN QUERY EXECUTE) */ List *params; /* USING arguments for dynamic query */ } PLpgSQL_stmt_return_query; typedef struct { /* RAISE statement */ int cmd_type; int lineno; int elog_level; char *condname; /* condition name, SQLSTATE, or NULL */ char *message; /* old-style message format literal, or NULL */ List *params; /* list of expressions for old-style message */ List *options; /* list of PLpgSQL_raise_option */ } PLpgSQL_stmt_raise; typedef struct { /* RAISE statement option */ int opt_type; PLpgSQL_expr *expr; } PLpgSQL_raise_option; typedef struct { /* Generic SQL statement to execute */ int cmd_type; int lineno; PLpgSQL_expr *sqlstmt; bool mod_stmt; /* is the stmt INSERT/UPDATE/DELETE? */ /* note: mod_stmt is set when we plan the query */ bool into; /* INTO supplied? */ bool strict; /* INTO STRICT flag */ PLpgSQL_rec *rec; /* INTO target, if record */ PLpgSQL_row *row; /* INTO target, if row */ } PLpgSQL_stmt_execsql; typedef struct { /* Dynamic SQL string to execute */ int cmd_type; int lineno; PLpgSQL_expr *query; /* string expression */ bool into; /* INTO supplied? */ bool strict; /* INTO STRICT flag */ PLpgSQL_rec *rec; /* INTO target, if record */ PLpgSQL_row *row; /* INTO target, if row */ List *params; /* USING expressions */ } PLpgSQL_stmt_dynexecute; typedef struct PLpgSQL_func_hashkey { /* Hash lookup key for functions */ Oid funcOid; bool isTrigger; /* true if called as a trigger */ /* be careful that pad bytes in this struct get zeroed! */ /* * For a trigger function, the OID of the relation triggered on is part of * the hash key --- we want to compile the trigger separately for each * relation it is used with, in case the rowtype is different. Zero if * not called as a trigger. */ Oid trigrelOid; /* * We must include the input collation as part of the hash key too, * because we have to generate different plans (with different Param * collations) for different collation settings. */ Oid inputCollation; /* * We include actual argument types in the hash key to support polymorphic * PLpgSQL functions. Be careful that extra positions are zeroed! */ Oid argtypes[FUNC_MAX_ARGS]; } PLpgSQL_func_hashkey; typedef struct PLpgSQL_function { /* Complete compiled function */ char *fn_signature; Oid fn_oid; TransactionId fn_xmin; ItemPointerData fn_tid; bool fn_is_trigger; Oid fn_input_collation; PLpgSQL_func_hashkey *fn_hashkey; /* back-link to hashtable key */ MemoryContext fn_cxt; Oid fn_rettype; int fn_rettyplen; bool fn_retbyval; FmgrInfo fn_retinput; Oid fn_rettypioparam; bool fn_retistuple; bool fn_retset; bool fn_readonly; int fn_nargs; int fn_argvarnos[FUNC_MAX_ARGS]; int out_param_varno; int found_varno; int new_varno; int old_varno; int tg_name_varno; int tg_when_varno; int tg_level_varno; int tg_op_varno; int tg_relid_varno; int tg_relname_varno; int tg_table_name_varno; int tg_table_schema_varno; int tg_nargs_varno; int tg_argv_varno; PLpgSQL_resolve_option resolve_option; int ndatums; PLpgSQL_datum **datums; PLpgSQL_stmt_block *action; /* these fields change when the function is used */ struct PLpgSQL_execstate *cur_estate; unsigned long use_count; } PLpgSQL_function; typedef struct PLpgSQL_execstate { /* Runtime execution data */ PLpgSQL_function *func; /* function being executed */ Datum retval; bool retisnull; Oid rettype; /* type of current retval */ Oid fn_rettype; /* info about declared function rettype */ bool retistuple; bool retisset; bool readonly_func; TupleDesc rettupdesc; char *exitlabel; /* the "target" label of the current EXIT or * CONTINUE stmt, if any */ ErrorData *cur_error; /* current exception handler's error */ Tuplestorestate *tuple_store; /* SRFs accumulate results here */ MemoryContext tuple_store_cxt; ResourceOwner tuple_store_owner; ReturnSetInfo *rsi; int found_varno; int ndatums; PLpgSQL_datum **datums; /* temporary state for results from evaluation of query or expr */ SPITupleTable *eval_tuptable; uint32 eval_processed; Oid eval_lastoid; ExprContext *eval_econtext; /* for executing simple expressions */ PLpgSQL_expr *cur_expr; /* current query/expr being evaluated */ /* status information for error context reporting */ PLpgSQL_stmt *err_stmt; /* current stmt */ const char *err_text; /* additional state info */ void *plugin_info; /* reserved for use by optional plugin */ } PLpgSQL_execstate; /* * A PLpgSQL_plugin structure represents an instrumentation plugin. * To instrument PL/pgSQL, a plugin library must access the rendezvous * variable "PLpgSQL_plugin" and set it to point to a PLpgSQL_plugin struct. * Typically the struct could just be static data in the plugin library. * We expect that a plugin would do this at library load time (_PG_init()). * It must also be careful to set the rendezvous variable back to NULL * if it is unloaded (_PG_fini()). * * This structure is basically a collection of function pointers --- at * various interesting points in pl_exec.c, we call these functions * (if the pointers are non-NULL) to give the plugin a chance to watch * what we are doing. * * func_setup is called when we start a function, before we've initialized * the local variables defined by the function. * * func_beg is called when we start a function, after we've initialized * the local variables. * * func_end is called at the end of a function. * * stmt_beg and stmt_end are called before and after (respectively) each * statement. * * Also, immediately before any call to func_setup, PL/pgSQL fills in the * error_callback and assign_expr fields with pointers to its own * plpgsql_exec_error_callback and exec_assign_expr functions. This is * a somewhat ad-hoc expedient to simplify life for debugger plugins. */ typedef struct { /* Function pointers set up by the plugin */ void (*func_setup) (PLpgSQL_execstate *estate, PLpgSQL_function *func); void (*func_beg) (PLpgSQL_execstate *estate, PLpgSQL_function *func); void (*func_end) (PLpgSQL_execstate *estate, PLpgSQL_function *func); void (*stmt_beg) (PLpgSQL_execstate *estate, PLpgSQL_stmt *stmt); void (*stmt_end) (PLpgSQL_execstate *estate, PLpgSQL_stmt *stmt); /* Function pointers set by PL/pgSQL itself */ void (*error_callback) (void *arg); void (*assign_expr) (PLpgSQL_execstate *estate, PLpgSQL_datum *target, PLpgSQL_expr *expr); } PLpgSQL_plugin; /* Struct types used during parsing */ typedef struct { char *ident; /* palloc'd converted identifier */ bool quoted; /* Was it double-quoted? */ } PLword; typedef struct { List *idents; /* composite identifiers (list of String) */ } PLcword; typedef struct { PLpgSQL_datum *datum; /* referenced variable */ char *ident; /* valid if simple name */ bool quoted; List *idents; /* valid if composite name */ } PLwdatum; /********************************************************************** * Global variable declarations **********************************************************************/ typedef enum { IDENTIFIER_LOOKUP_NORMAL, /* normal processing of var names */ IDENTIFIER_LOOKUP_DECLARE, /* In DECLARE --- don't look up names */ IDENTIFIER_LOOKUP_EXPR /* In SQL expression --- special case */ } IdentifierLookup; extern IdentifierLookup plpgsql_IdentifierLookup; extern int plpgsql_variable_conflict; extern bool plpgsql_check_syntax; extern bool plpgsql_DumpExecTree; extern PLpgSQL_stmt_block *plpgsql_parse_result; extern int plpgsql_nDatums; extern PLpgSQL_datum **plpgsql_Datums; extern char *plpgsql_error_funcname; extern PLpgSQL_function *plpgsql_curr_compile; extern MemoryContext compile_tmp_cxt; extern PLpgSQL_plugin **plugin_ptr; /********************************************************************** * Function declarations **********************************************************************/ /* ---------- * Functions in pl_comp.c * ---------- */ extern PLpgSQL_function *plpgsql_compile(FunctionCallInfo fcinfo, bool forValidator); extern PLpgSQL_function *plpgsql_compile_inline(char *proc_source); extern void plpgsql_parser_setup(struct ParseState *pstate, PLpgSQL_expr *expr); extern bool plpgsql_parse_word(char *word1, const char *yytxt, PLwdatum *wdatum, PLword *word); extern bool plpgsql_parse_dblword(char *word1, char *word2, PLwdatum *wdatum, PLcword *cword); extern bool plpgsql_parse_tripword(char *word1, char *word2, char *word3, PLwdatum *wdatum, PLcword *cword); extern PLpgSQL_type *plpgsql_parse_wordtype(char *ident); extern PLpgSQL_type *plpgsql_parse_cwordtype(List *idents); extern PLpgSQL_type *plpgsql_parse_wordrowtype(char *ident); extern PLpgSQL_type *plpgsql_parse_cwordrowtype(List *idents); extern PLpgSQL_type *plpgsql_build_datatype(Oid typeOid, int32 typmod, Oid collation); extern PLpgSQL_variable *plpgsql_build_variable(const char *refname, int lineno, PLpgSQL_type *dtype, bool add2namespace); extern PLpgSQL_rec *plpgsql_build_record(const char *refname, int lineno, bool add2namespace); extern int plpgsql_recognize_err_condition(const char *condname, bool allow_sqlstate); extern PLpgSQL_condition *plpgsql_parse_err_condition(char *condname); extern void plpgsql_adddatum(PLpgSQL_datum *new); extern int plpgsql_add_initdatums(int **varnos); extern void plpgsql_HashTableInit(void); /* ---------- * Functions in pl_handler.c * ---------- */ extern void _PG_init(void); extern Datum plpgsql_call_handler(PG_FUNCTION_ARGS); extern Datum plpgsql_inline_handler(PG_FUNCTION_ARGS); extern Datum plpgsql_validator(PG_FUNCTION_ARGS); /* ---------- * Functions in pl_exec.c * ---------- */ extern Datum plpgsql_exec_function(PLpgSQL_function *func, FunctionCallInfo fcinfo); extern HeapTuple plpgsql_exec_trigger(PLpgSQL_function *func, TriggerData *trigdata); extern void plpgsql_xact_cb(XactEvent event, void *arg); extern void plpgsql_subxact_cb(SubXactEvent event, SubTransactionId mySubid, SubTransactionId parentSubid, void *arg); extern Oid exec_get_datum_type(PLpgSQL_execstate *estate, PLpgSQL_datum *datum); extern void exec_get_datum_type_info(PLpgSQL_execstate *estate, PLpgSQL_datum *datum, Oid *typeid, int32 *typmod, Oid *collation); /* ---------- * Functions for namespace handling in pl_funcs.c * ---------- */ extern void plpgsql_ns_init(void); extern void plpgsql_ns_push(const char *label); extern void plpgsql_ns_pop(void); extern PLpgSQL_nsitem *plpgsql_ns_top(void); extern void plpgsql_ns_additem(int itemtype, int itemno, const char *name); extern PLpgSQL_nsitem *plpgsql_ns_lookup(PLpgSQL_nsitem *ns_cur, bool localmode, const char *name1, const char *name2, const char *name3, int *names_used); extern PLpgSQL_nsitem *plpgsql_ns_lookup_label(PLpgSQL_nsitem *ns_cur, const char *name); /* ---------- * Other functions in pl_funcs.c * ---------- */ extern const char *plpgsql_stmt_typename(PLpgSQL_stmt *stmt); extern const char *plpgsql_getdiag_kindname(int kind); extern void plpgsql_free_function_memory(PLpgSQL_function *func); extern void plpgsql_dumptree(PLpgSQL_function *func); /* ---------- * Scanner functions in pl_scanner.c * ---------- */ extern int plpgsql_base_yylex(void); extern int plpgsql_yylex(void); extern void plpgsql_push_back_token(int token); extern void plpgsql_append_source_text(StringInfo buf, int startlocation, int endlocation); extern void plpgsql_peek2(int *tok1_p, int *tok2_p, int *tok1_loc, int *tok2_loc); extern int plpgsql_scanner_errposition(int location); extern void plpgsql_yyerror(const char *message); extern int plpgsql_location_to_lineno(int location); extern int plpgsql_latest_lineno(void); extern void plpgsql_scanner_init(const char *str); extern void plpgsql_scanner_finish(void); /* ---------- * Externs in gram.y * ---------- */ extern int plpgsql_yyparse(void); #endif /* PLPGSQL_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/fmgr.h���������������������������������������������������������������������������������0000644�����������������00000072724�14763166026�0010333 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * fmgr.h * Definitions for the Postgres function manager and function-call * interface. * * This file must be included by all Postgres modules that either define * or call fmgr-callable functions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/fmgr.h * *------------------------------------------------------------------------- */ #ifndef FMGR_H #define FMGR_H /* We don't want to include primnodes.h here, so make a stub reference */ typedef struct Node *fmNodePtr; /* Likewise, avoid including stringinfo.h here */ typedef struct StringInfoData *fmStringInfo; /* * All functions that can be called directly by fmgr must have this signature. * (Other functions can be called by using a handler that does have this * signature.) */ typedef struct FunctionCallInfoData *FunctionCallInfo; typedef Datum (*PGFunction) (FunctionCallInfo fcinfo); /* * This struct holds the system-catalog information that must be looked up * before a function can be called through fmgr. If the same function is * to be called multiple times, the lookup need be done only once and the * info struct saved for re-use. * * Note that fn_expr really is parse-time-determined information about the * arguments, rather than about the function itself. But it's convenient * to store it here rather than in FunctionCallInfoData, where it might more * logically belong. */ typedef struct FmgrInfo { PGFunction fn_addr; /* pointer to function or handler to be called */ Oid fn_oid; /* OID of function (NOT of handler, if any) */ short fn_nargs; /* 0..FUNC_MAX_ARGS, or -1 if variable arg * count */ bool fn_strict; /* function is "strict" (NULL in => NULL out) */ bool fn_retset; /* function returns a set */ unsigned char fn_stats; /* collect stats if track_functions > this */ void *fn_extra; /* extra space for use by handler */ MemoryContext fn_mcxt; /* memory context to store fn_extra in */ fmNodePtr fn_expr; /* expression parse tree for call, or NULL */ } FmgrInfo; /* * This struct is the data actually passed to an fmgr-called function. */ typedef struct FunctionCallInfoData { FmgrInfo *flinfo; /* ptr to lookup info used for this call */ fmNodePtr context; /* pass info about context of call */ fmNodePtr resultinfo; /* pass or return extra info about result */ Oid fncollation; /* collation for function to use */ bool isnull; /* function must set true if result is NULL */ short nargs; /* # arguments actually passed */ Datum arg[FUNC_MAX_ARGS]; /* Arguments passed to function */ bool argnull[FUNC_MAX_ARGS]; /* T if arg[i] is actually NULL */ } FunctionCallInfoData; /* * This routine fills a FmgrInfo struct, given the OID * of the function to be called. */ extern void fmgr_info(Oid functionId, FmgrInfo *finfo); /* * Same, when the FmgrInfo struct is in a memory context longer-lived than * CurrentMemoryContext. The specified context will be set as fn_mcxt * and used to hold all subsidiary data of finfo. */ extern void fmgr_info_cxt(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt); /* Convenience macro for setting the fn_expr field */ #define fmgr_info_set_expr(expr, finfo) \ ((finfo)->fn_expr = (expr)) /* * Copy an FmgrInfo struct */ extern void fmgr_info_copy(FmgrInfo *dstinfo, FmgrInfo *srcinfo, MemoryContext destcxt); /* * This macro initializes all the fields of a FunctionCallInfoData except * for the arg[] and argnull[] arrays. Performance testing has shown that * the fastest way to set up argnull[] for small numbers of arguments is to * explicitly set each required element to false, so we don't try to zero * out the argnull[] array in the macro. */ #define InitFunctionCallInfoData(Fcinfo, Flinfo, Nargs, Collation, Context, Resultinfo) \ do { \ (Fcinfo).flinfo = (Flinfo); \ (Fcinfo).context = (Context); \ (Fcinfo).resultinfo = (Resultinfo); \ (Fcinfo).fncollation = (Collation); \ (Fcinfo).isnull = false; \ (Fcinfo).nargs = (Nargs); \ } while (0) /* * This macro invokes a function given a filled-in FunctionCallInfoData * struct. The macro result is the returned Datum --- but note that * caller must still check fcinfo->isnull! Also, if function is strict, * it is caller's responsibility to verify that no null arguments are present * before calling. */ #define FunctionCallInvoke(fcinfo) ((* (fcinfo)->flinfo->fn_addr) (fcinfo)) /*------------------------------------------------------------------------- * Support macros to ease writing fmgr-compatible functions * * A C-coded fmgr-compatible function should be declared as * * Datum * function_name(PG_FUNCTION_ARGS) * { * ... * } * * It should access its arguments using appropriate PG_GETARG_xxx macros * and should return its result using PG_RETURN_xxx. * *------------------------------------------------------------------------- */ /* Standard parameter list for fmgr-compatible functions */ #define PG_FUNCTION_ARGS FunctionCallInfo fcinfo /* * Get collation function should use. */ #define PG_GET_COLLATION() (fcinfo->fncollation) /* * Get number of arguments passed to function. */ #define PG_NARGS() (fcinfo->nargs) /* * If function is not marked "proisstrict" in pg_proc, it must check for * null arguments using this macro. Do not try to GETARG a null argument! */ #define PG_ARGISNULL(n) (fcinfo->argnull[n]) /* * Support for fetching detoasted copies of toastable datatypes (all of * which are varlena types). pg_detoast_datum() gives you either the input * datum (if not toasted) or a detoasted copy allocated with palloc(). * pg_detoast_datum_copy() always gives you a palloc'd copy --- use it * if you need a modifiable copy of the input. Caller is expected to have * checked for null inputs first, if necessary. * * pg_detoast_datum_packed() will return packed (1-byte header) datums * unmodified. It will still expand an externally toasted or compressed datum. * The resulting datum can be accessed using VARSIZE_ANY() and VARDATA_ANY() * (beware of multiple evaluations in those macros!) * * WARNING: It is only safe to use pg_detoast_datum_packed() and * VARDATA_ANY() if you really don't care about the alignment. Either because * you're working with something like text where the alignment doesn't matter * or because you're not going to access its constituent parts and just use * things like memcpy on it anyways. * * Note: it'd be nice if these could be macros, but I see no way to do that * without evaluating the arguments multiple times, which is NOT acceptable. */ extern struct varlena *pg_detoast_datum(struct varlena * datum); extern struct varlena *pg_detoast_datum_copy(struct varlena * datum); extern struct varlena *pg_detoast_datum_slice(struct varlena * datum, int32 first, int32 count); extern struct varlena *pg_detoast_datum_packed(struct varlena * datum); #define PG_DETOAST_DATUM(datum) \ pg_detoast_datum((struct varlena *) DatumGetPointer(datum)) #define PG_DETOAST_DATUM_COPY(datum) \ pg_detoast_datum_copy((struct varlena *) DatumGetPointer(datum)) #define PG_DETOAST_DATUM_SLICE(datum,f,c) \ pg_detoast_datum_slice((struct varlena *) DatumGetPointer(datum), \ (int32) (f), (int32) (c)) /* WARNING -- unaligned pointer */ #define PG_DETOAST_DATUM_PACKED(datum) \ pg_detoast_datum_packed((struct varlena *) DatumGetPointer(datum)) /* * Support for cleaning up detoasted copies of inputs. This must only * be used for pass-by-ref datatypes, and normally would only be used * for toastable types. If the given pointer is different from the * original argument, assume it's a palloc'd detoasted copy, and pfree it. * NOTE: most functions on toastable types do not have to worry about this, * but we currently require that support functions for indexes not leak * memory. */ #define PG_FREE_IF_COPY(ptr,n) \ do { \ if ((Pointer) (ptr) != PG_GETARG_POINTER(n)) \ pfree(ptr); \ } while (0) /* Macros for fetching arguments of standard types */ #define PG_GETARG_DATUM(n) (fcinfo->arg[n]) #define PG_GETARG_INT32(n) DatumGetInt32(PG_GETARG_DATUM(n)) #define PG_GETARG_UINT32(n) DatumGetUInt32(PG_GETARG_DATUM(n)) #define PG_GETARG_INT16(n) DatumGetInt16(PG_GETARG_DATUM(n)) #define PG_GETARG_UINT16(n) DatumGetUInt16(PG_GETARG_DATUM(n)) #define PG_GETARG_CHAR(n) DatumGetChar(PG_GETARG_DATUM(n)) #define PG_GETARG_BOOL(n) DatumGetBool(PG_GETARG_DATUM(n)) #define PG_GETARG_OID(n) DatumGetObjectId(PG_GETARG_DATUM(n)) #define PG_GETARG_POINTER(n) DatumGetPointer(PG_GETARG_DATUM(n)) #define PG_GETARG_CSTRING(n) DatumGetCString(PG_GETARG_DATUM(n)) #define PG_GETARG_NAME(n) DatumGetName(PG_GETARG_DATUM(n)) /* these macros hide the pass-by-reference-ness of the datatype: */ #define PG_GETARG_FLOAT4(n) DatumGetFloat4(PG_GETARG_DATUM(n)) #define PG_GETARG_FLOAT8(n) DatumGetFloat8(PG_GETARG_DATUM(n)) #define PG_GETARG_INT64(n) DatumGetInt64(PG_GETARG_DATUM(n)) /* use this if you want the raw, possibly-toasted input datum: */ #define PG_GETARG_RAW_VARLENA_P(n) ((struct varlena *) PG_GETARG_POINTER(n)) /* use this if you want the input datum de-toasted: */ #define PG_GETARG_VARLENA_P(n) PG_DETOAST_DATUM(PG_GETARG_DATUM(n)) /* and this if you can handle 1-byte-header datums: */ #define PG_GETARG_VARLENA_PP(n) PG_DETOAST_DATUM_PACKED(PG_GETARG_DATUM(n)) /* DatumGetFoo macros for varlena types will typically look like this: */ #define DatumGetByteaP(X) ((bytea *) PG_DETOAST_DATUM(X)) #define DatumGetByteaPP(X) ((bytea *) PG_DETOAST_DATUM_PACKED(X)) #define DatumGetTextP(X) ((text *) PG_DETOAST_DATUM(X)) #define DatumGetTextPP(X) ((text *) PG_DETOAST_DATUM_PACKED(X)) #define DatumGetBpCharP(X) ((BpChar *) PG_DETOAST_DATUM(X)) #define DatumGetBpCharPP(X) ((BpChar *) PG_DETOAST_DATUM_PACKED(X)) #define DatumGetVarCharP(X) ((VarChar *) PG_DETOAST_DATUM(X)) #define DatumGetVarCharPP(X) ((VarChar *) PG_DETOAST_DATUM_PACKED(X)) #define DatumGetHeapTupleHeader(X) ((HeapTupleHeader) PG_DETOAST_DATUM(X)) /* And we also offer variants that return an OK-to-write copy */ #define DatumGetByteaPCopy(X) ((bytea *) PG_DETOAST_DATUM_COPY(X)) #define DatumGetTextPCopy(X) ((text *) PG_DETOAST_DATUM_COPY(X)) #define DatumGetBpCharPCopy(X) ((BpChar *) PG_DETOAST_DATUM_COPY(X)) #define DatumGetVarCharPCopy(X) ((VarChar *) PG_DETOAST_DATUM_COPY(X)) #define DatumGetHeapTupleHeaderCopy(X) ((HeapTupleHeader) PG_DETOAST_DATUM_COPY(X)) /* Variants which return n bytes starting at pos. m */ #define DatumGetByteaPSlice(X,m,n) ((bytea *) PG_DETOAST_DATUM_SLICE(X,m,n)) #define DatumGetTextPSlice(X,m,n) ((text *) PG_DETOAST_DATUM_SLICE(X,m,n)) #define DatumGetBpCharPSlice(X,m,n) ((BpChar *) PG_DETOAST_DATUM_SLICE(X,m,n)) #define DatumGetVarCharPSlice(X,m,n) ((VarChar *) PG_DETOAST_DATUM_SLICE(X,m,n)) /* GETARG macros for varlena types will typically look like this: */ #define PG_GETARG_BYTEA_P(n) DatumGetByteaP(PG_GETARG_DATUM(n)) #define PG_GETARG_BYTEA_PP(n) DatumGetByteaPP(PG_GETARG_DATUM(n)) #define PG_GETARG_TEXT_P(n) DatumGetTextP(PG_GETARG_DATUM(n)) #define PG_GETARG_TEXT_PP(n) DatumGetTextPP(PG_GETARG_DATUM(n)) #define PG_GETARG_BPCHAR_P(n) DatumGetBpCharP(PG_GETARG_DATUM(n)) #define PG_GETARG_BPCHAR_PP(n) DatumGetBpCharPP(PG_GETARG_DATUM(n)) #define PG_GETARG_VARCHAR_P(n) DatumGetVarCharP(PG_GETARG_DATUM(n)) #define PG_GETARG_VARCHAR_PP(n) DatumGetVarCharPP(PG_GETARG_DATUM(n)) #define PG_GETARG_HEAPTUPLEHEADER(n) DatumGetHeapTupleHeader(PG_GETARG_DATUM(n)) /* And we also offer variants that return an OK-to-write copy */ #define PG_GETARG_BYTEA_P_COPY(n) DatumGetByteaPCopy(PG_GETARG_DATUM(n)) #define PG_GETARG_TEXT_P_COPY(n) DatumGetTextPCopy(PG_GETARG_DATUM(n)) #define PG_GETARG_BPCHAR_P_COPY(n) DatumGetBpCharPCopy(PG_GETARG_DATUM(n)) #define PG_GETARG_VARCHAR_P_COPY(n) DatumGetVarCharPCopy(PG_GETARG_DATUM(n)) #define PG_GETARG_HEAPTUPLEHEADER_COPY(n) DatumGetHeapTupleHeaderCopy(PG_GETARG_DATUM(n)) /* And a b-byte slice from position a -also OK to write */ #define PG_GETARG_BYTEA_P_SLICE(n,a,b) DatumGetByteaPSlice(PG_GETARG_DATUM(n),a,b) #define PG_GETARG_TEXT_P_SLICE(n,a,b) DatumGetTextPSlice(PG_GETARG_DATUM(n),a,b) #define PG_GETARG_BPCHAR_P_SLICE(n,a,b) DatumGetBpCharPSlice(PG_GETARG_DATUM(n),a,b) #define PG_GETARG_VARCHAR_P_SLICE(n,a,b) DatumGetVarCharPSlice(PG_GETARG_DATUM(n),a,b) /* To return a NULL do this: */ #define PG_RETURN_NULL() \ do { fcinfo->isnull = true; return (Datum) 0; } while (0) /* A few internal functions return void (which is not the same as NULL!) */ #define PG_RETURN_VOID() return (Datum) 0 /* Macros for returning results of standard types */ #define PG_RETURN_DATUM(x) return (x) #define PG_RETURN_INT32(x) return Int32GetDatum(x) #define PG_RETURN_UINT32(x) return UInt32GetDatum(x) #define PG_RETURN_INT16(x) return Int16GetDatum(x) #define PG_RETURN_CHAR(x) return CharGetDatum(x) #define PG_RETURN_BOOL(x) return BoolGetDatum(x) #define PG_RETURN_OID(x) return ObjectIdGetDatum(x) #define PG_RETURN_POINTER(x) return PointerGetDatum(x) #define PG_RETURN_CSTRING(x) return CStringGetDatum(x) #define PG_RETURN_NAME(x) return NameGetDatum(x) /* these macros hide the pass-by-reference-ness of the datatype: */ #define PG_RETURN_FLOAT4(x) return Float4GetDatum(x) #define PG_RETURN_FLOAT8(x) return Float8GetDatum(x) #define PG_RETURN_INT64(x) return Int64GetDatum(x) /* RETURN macros for other pass-by-ref types will typically look like this: */ #define PG_RETURN_BYTEA_P(x) PG_RETURN_POINTER(x) #define PG_RETURN_TEXT_P(x) PG_RETURN_POINTER(x) #define PG_RETURN_BPCHAR_P(x) PG_RETURN_POINTER(x) #define PG_RETURN_VARCHAR_P(x) PG_RETURN_POINTER(x) #define PG_RETURN_HEAPTUPLEHEADER(x) return HeapTupleHeaderGetDatum(x) /*------------------------------------------------------------------------- * Support for detecting call convention of dynamically-loaded functions * * Dynamically loaded functions may use either the version-1 ("new style") * or version-0 ("old style") calling convention. Version 1 is the call * convention defined in this header file; version 0 is the old "plain C" * convention. A version-1 function must be accompanied by the macro call * * PG_FUNCTION_INFO_V1(function_name); * * Note that internal functions do not need this decoration since they are * assumed to be version-1. * *------------------------------------------------------------------------- */ typedef struct { int api_version; /* specifies call convention version number */ /* More fields may be added later, for version numbers > 1. */ } Pg_finfo_record; /* Expected signature of an info function */ typedef const Pg_finfo_record *(*PGFInfoFunction) (void); /* * Macro to build an info function associated with the given function name. * Win32 loadable functions usually link with 'dlltool --export-all', but it * doesn't hurt to add PGDLLIMPORT in case they don't. */ #define PG_FUNCTION_INFO_V1(funcname) \ extern PGDLLEXPORT const Pg_finfo_record * CppConcat(pg_finfo_,funcname)(void); \ const Pg_finfo_record * \ CppConcat(pg_finfo_,funcname) (void) \ { \ static const Pg_finfo_record my_finfo = { 1 }; \ return &my_finfo; \ } \ extern int no_such_variable /*------------------------------------------------------------------------- * Support for verifying backend compatibility of loaded modules * * We require dynamically-loaded modules to include the macro call * PG_MODULE_MAGIC; * so that we can check for obvious incompatibility, such as being compiled * for a different major PostgreSQL version. * * To compile with versions of PostgreSQL that do not support this, * you may put an #ifdef/#endif test around it. Note that in a multiple- * source-file module, the macro call should only appear once. * * The specific items included in the magic block are intended to be ones that * are custom-configurable and especially likely to break dynamically loaded * modules if they were compiled with other values. Also, the length field * can be used to detect definition changes. * * Note: we compare magic blocks with memcmp(), so there had better not be * any alignment pad bytes in them. * * Note: when changing the contents of magic blocks, be sure to adjust the * incompatible_module_error() function in dfmgr.c. *------------------------------------------------------------------------- */ /* Definition of the magic block structure */ typedef struct { int len; /* sizeof(this struct) */ int version; /* PostgreSQL major version */ int funcmaxargs; /* FUNC_MAX_ARGS */ int indexmaxkeys; /* INDEX_MAX_KEYS */ int namedatalen; /* NAMEDATALEN */ int float4byval; /* FLOAT4PASSBYVAL */ int float8byval; /* FLOAT8PASSBYVAL */ } Pg_magic_struct; /* The actual data block contents */ #define PG_MODULE_MAGIC_DATA \ { \ sizeof(Pg_magic_struct), \ PG_VERSION_NUM / 100, \ FUNC_MAX_ARGS, \ INDEX_MAX_KEYS, \ NAMEDATALEN, \ FLOAT4PASSBYVAL, \ FLOAT8PASSBYVAL \ } /* * Declare the module magic function. It needs to be a function as the dlsym * in the backend is only guaranteed to work on functions, not data */ typedef const Pg_magic_struct *(*PGModuleMagicFunction) (void); #define PG_MAGIC_FUNCTION_NAME Pg_magic_func #define PG_MAGIC_FUNCTION_NAME_STRING "Pg_magic_func" #define PG_MODULE_MAGIC \ extern PGDLLEXPORT const Pg_magic_struct *PG_MAGIC_FUNCTION_NAME(void); \ const Pg_magic_struct * \ PG_MAGIC_FUNCTION_NAME(void) \ { \ static const Pg_magic_struct Pg_magic_data = PG_MODULE_MAGIC_DATA; \ return &Pg_magic_data; \ } \ extern int no_such_variable /*------------------------------------------------------------------------- * Support routines and macros for callers of fmgr-compatible functions *------------------------------------------------------------------------- */ /* These are for invocation of a specifically named function with a * directly-computed parameter list. Note that neither arguments nor result * are allowed to be NULL. */ extern Datum DirectFunctionCall1Coll(PGFunction func, Oid collation, Datum arg1); extern Datum DirectFunctionCall2Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2); extern Datum DirectFunctionCall3Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3); extern Datum DirectFunctionCall4Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4); extern Datum DirectFunctionCall5Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5); extern Datum DirectFunctionCall6Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6); extern Datum DirectFunctionCall7Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7); extern Datum DirectFunctionCall8Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7, Datum arg8); extern Datum DirectFunctionCall9Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7, Datum arg8, Datum arg9); /* These are for invocation of a previously-looked-up function with a * directly-computed parameter list. Note that neither arguments nor result * are allowed to be NULL. */ extern Datum FunctionCall1Coll(FmgrInfo *flinfo, Oid collation, Datum arg1); extern Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2); extern Datum FunctionCall3Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3); extern Datum FunctionCall4Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4); extern Datum FunctionCall5Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5); extern Datum FunctionCall6Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6); extern Datum FunctionCall7Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7); extern Datum FunctionCall8Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7, Datum arg8); extern Datum FunctionCall9Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7, Datum arg8, Datum arg9); /* These are for invocation of a function identified by OID with a * directly-computed parameter list. Note that neither arguments nor result * are allowed to be NULL. These are essentially FunctionLookup() followed * by FunctionCallN(). If the same function is to be invoked repeatedly, * do the FunctionLookup() once and then use FunctionCallN(). */ extern Datum OidFunctionCall0Coll(Oid functionId, Oid collation); extern Datum OidFunctionCall1Coll(Oid functionId, Oid collation, Datum arg1); extern Datum OidFunctionCall2Coll(Oid functionId, Oid collation, Datum arg1, Datum arg2); extern Datum OidFunctionCall3Coll(Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3); extern Datum OidFunctionCall4Coll(Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4); extern Datum OidFunctionCall5Coll(Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5); extern Datum OidFunctionCall6Coll(Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6); extern Datum OidFunctionCall7Coll(Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7); extern Datum OidFunctionCall8Coll(Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7, Datum arg8); extern Datum OidFunctionCall9Coll(Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7, Datum arg8, Datum arg9); /* These macros allow the collation argument to be omitted (with a default of * InvalidOid, ie, no collation). They exist mostly for backwards * compatibility of source code. */ #define DirectFunctionCall1(func, arg1) \ DirectFunctionCall1Coll(func, InvalidOid, arg1) #define DirectFunctionCall2(func, arg1, arg2) \ DirectFunctionCall2Coll(func, InvalidOid, arg1, arg2) #define DirectFunctionCall3(func, arg1, arg2, arg3) \ DirectFunctionCall3Coll(func, InvalidOid, arg1, arg2, arg3) #define DirectFunctionCall4(func, arg1, arg2, arg3, arg4) \ DirectFunctionCall4Coll(func, InvalidOid, arg1, arg2, arg3, arg4) #define DirectFunctionCall5(func, arg1, arg2, arg3, arg4, arg5) \ DirectFunctionCall5Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5) #define DirectFunctionCall6(func, arg1, arg2, arg3, arg4, arg5, arg6) \ DirectFunctionCall6Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6) #define DirectFunctionCall7(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ DirectFunctionCall7Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7) #define DirectFunctionCall8(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ DirectFunctionCall8Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) #define DirectFunctionCall9(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \ DirectFunctionCall9Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) #define FunctionCall1(flinfo, arg1) \ FunctionCall1Coll(flinfo, InvalidOid, arg1) #define FunctionCall2(flinfo, arg1, arg2) \ FunctionCall2Coll(flinfo, InvalidOid, arg1, arg2) #define FunctionCall3(flinfo, arg1, arg2, arg3) \ FunctionCall3Coll(flinfo, InvalidOid, arg1, arg2, arg3) #define FunctionCall4(flinfo, arg1, arg2, arg3, arg4) \ FunctionCall4Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4) #define FunctionCall5(flinfo, arg1, arg2, arg3, arg4, arg5) \ FunctionCall5Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5) #define FunctionCall6(flinfo, arg1, arg2, arg3, arg4, arg5, arg6) \ FunctionCall6Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6) #define FunctionCall7(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ FunctionCall7Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7) #define FunctionCall8(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ FunctionCall8Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) #define FunctionCall9(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \ FunctionCall9Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) #define OidFunctionCall0(functionId) \ OidFunctionCall0Coll(functionId, InvalidOid) #define OidFunctionCall1(functionId, arg1) \ OidFunctionCall1Coll(functionId, InvalidOid, arg1) #define OidFunctionCall2(functionId, arg1, arg2) \ OidFunctionCall2Coll(functionId, InvalidOid, arg1, arg2) #define OidFunctionCall3(functionId, arg1, arg2, arg3) \ OidFunctionCall3Coll(functionId, InvalidOid, arg1, arg2, arg3) #define OidFunctionCall4(functionId, arg1, arg2, arg3, arg4) \ OidFunctionCall4Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4) #define OidFunctionCall5(functionId, arg1, arg2, arg3, arg4, arg5) \ OidFunctionCall5Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5) #define OidFunctionCall6(functionId, arg1, arg2, arg3, arg4, arg5, arg6) \ OidFunctionCall6Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6) #define OidFunctionCall7(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ OidFunctionCall7Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7) #define OidFunctionCall8(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ OidFunctionCall8Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) #define OidFunctionCall9(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \ OidFunctionCall9Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) /* Special cases for convenient invocation of datatype I/O functions. */ extern Datum InputFunctionCall(FmgrInfo *flinfo, char *str, Oid typioparam, int32 typmod); extern Datum OidInputFunctionCall(Oid functionId, char *str, Oid typioparam, int32 typmod); extern char *OutputFunctionCall(FmgrInfo *flinfo, Datum val); extern char *OidOutputFunctionCall(Oid functionId, Datum val); extern Datum ReceiveFunctionCall(FmgrInfo *flinfo, fmStringInfo buf, Oid typioparam, int32 typmod); extern Datum OidReceiveFunctionCall(Oid functionId, fmStringInfo buf, Oid typioparam, int32 typmod); extern bytea *SendFunctionCall(FmgrInfo *flinfo, Datum val); extern bytea *OidSendFunctionCall(Oid functionId, Datum val); /* * Routines in fmgr.c */ extern const Pg_finfo_record *fetch_finfo_record(void *filehandle, char *funcname); extern void clear_external_function_hash(void *filehandle); extern Oid fmgr_internal_function(const char *proname); extern Oid get_fn_expr_rettype(FmgrInfo *flinfo); extern Oid get_fn_expr_argtype(FmgrInfo *flinfo, int argnum); extern Oid get_call_expr_argtype(fmNodePtr expr, int argnum); extern bool get_fn_expr_arg_stable(FmgrInfo *flinfo, int argnum); extern bool get_call_expr_arg_stable(fmNodePtr expr, int argnum); extern bool CheckFunctionValidatorAccess(Oid validatorOid, Oid functionOid); /* * Routines in dfmgr.c */ extern char *Dynamic_library_path; extern PGFunction load_external_function(char *filename, char *funcname, bool signalNotFound, void **filehandle); extern PGFunction lookup_external_function(void *filehandle, char *funcname); extern void load_file(const char *filename, bool restricted); extern void **find_rendezvous_variable(const char *varName); /* * Support for aggregate functions * * This is actually in executor/nodeAgg.c, but we declare it here since the * whole point is for callers of it to not be overly friendly with nodeAgg. */ /* AggCheckCallContext can return one of the following codes, or 0: */ #define AGG_CONTEXT_AGGREGATE 1 /* regular aggregate */ #define AGG_CONTEXT_WINDOW 2 /* window function */ extern int AggCheckCallContext(FunctionCallInfo fcinfo, MemoryContext *aggcontext); /* * We allow plugin modules to hook function entry/exit. This is intended * as support for loadable security policy modules, which may want to * perform additional privilege checks on function entry or exit, or to do * other internal bookkeeping. To make this possible, such modules must be * able not only to support normal function entry and exit, but also to trap * the case where we bail out due to an error; and they must also be able to * prevent inlining. */ typedef enum FmgrHookEventType { FHET_START, FHET_END, FHET_ABORT } FmgrHookEventType; typedef bool (*needs_fmgr_hook_type) (Oid fn_oid); typedef void (*fmgr_hook_type) (FmgrHookEventType event, FmgrInfo *flinfo, Datum *arg); extern PGDLLIMPORT needs_fmgr_hook_type needs_fmgr_hook; extern PGDLLIMPORT fmgr_hook_type fmgr_hook; #define FmgrHookIsNeeded(fn_oid) \ (!needs_fmgr_hook ? false : (*needs_fmgr_hook)(fn_oid)) /* * !!! OLD INTERFACE !!! * * fmgr() is the only remaining vestige of the old-style caller support * functions. It's no longer used anywhere in the Postgres distribution, * but we should leave it around for a release or two to ease the transition * for user-supplied C functions. OidFunctionCallN() replaces it for new * code. */ /* * DEPRECATED, DO NOT USE IN NEW CODE */ extern char *fmgr(Oid procedureId,...); #endif /* FMGR_H */ ��������������������������������������������pgsql/server/access/xact.h��������������������������������������������������������������������������0000644�����������������00000020701�14763166026�0011564 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * xact.h * postgres transaction system definitions * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/xact.h * *------------------------------------------------------------------------- */ #ifndef XACT_H #define XACT_H #include "access/xlog.h" #include "nodes/pg_list.h" #include "storage/relfilenode.h" /* * Xact isolation levels */ #define XACT_READ_UNCOMMITTED 0 #define XACT_READ_COMMITTED 1 #define XACT_REPEATABLE_READ 2 #define XACT_SERIALIZABLE 3 extern int DefaultXactIsoLevel; extern int XactIsoLevel; /* * We implement three isolation levels internally. * The two stronger ones use one snapshot per database transaction; * the others use one snapshot per statement. * Serializable uses predicate locks in addition to snapshots. * These macros should be used to check which isolation level is selected. */ #define IsolationUsesXactSnapshot() (XactIsoLevel >= XACT_REPEATABLE_READ) #define IsolationIsSerializable() (XactIsoLevel == XACT_SERIALIZABLE) /* Xact read-only state */ extern bool DefaultXactReadOnly; extern bool XactReadOnly; /* * Xact is deferrable -- only meaningful (currently) for read only * SERIALIZABLE transactions */ extern bool DefaultXactDeferrable; extern bool XactDeferrable; typedef enum { SYNCHRONOUS_COMMIT_OFF, /* asynchronous commit */ SYNCHRONOUS_COMMIT_LOCAL_FLUSH, /* wait for local flush only */ SYNCHRONOUS_COMMIT_REMOTE_WRITE, /* wait for local flush and remote * write */ SYNCHRONOUS_COMMIT_REMOTE_FLUSH /* wait for local and remote flush */ } SyncCommitLevel; /* Define the default setting for synchronous_commit */ #define SYNCHRONOUS_COMMIT_ON SYNCHRONOUS_COMMIT_REMOTE_FLUSH /* Synchronous commit level */ extern int synchronous_commit; /* Kluge for 2PC support */ extern bool MyXactAccessedTempRel; /* * start- and end-of-transaction callbacks for dynamically loaded modules */ typedef enum { XACT_EVENT_COMMIT, XACT_EVENT_ABORT, XACT_EVENT_PREPARE } XactEvent; typedef void (*XactCallback) (XactEvent event, void *arg); typedef enum { SUBXACT_EVENT_START_SUB, SUBXACT_EVENT_COMMIT_SUB, SUBXACT_EVENT_ABORT_SUB } SubXactEvent; typedef void (*SubXactCallback) (SubXactEvent event, SubTransactionId mySubid, SubTransactionId parentSubid, void *arg); /* ---------------- * transaction-related XLOG entries * ---------------- */ /* * XLOG allows to store some information in high 4 bits of log * record xl_info field */ #define XLOG_XACT_COMMIT 0x00 #define XLOG_XACT_PREPARE 0x10 #define XLOG_XACT_ABORT 0x20 #define XLOG_XACT_COMMIT_PREPARED 0x30 #define XLOG_XACT_ABORT_PREPARED 0x40 #define XLOG_XACT_ASSIGNMENT 0x50 #define XLOG_XACT_COMMIT_COMPACT 0x60 typedef struct xl_xact_assignment { TransactionId xtop; /* assigned XID's top-level XID */ int nsubxacts; /* number of subtransaction XIDs */ TransactionId xsub[1]; /* assigned subxids */ } xl_xact_assignment; #define MinSizeOfXactAssignment offsetof(xl_xact_assignment, xsub) typedef struct xl_xact_commit_compact { TimestampTz xact_time; /* time of commit */ int nsubxacts; /* number of subtransaction XIDs */ /* ARRAY OF COMMITTED SUBTRANSACTION XIDs FOLLOWS */ TransactionId subxacts[1]; /* VARIABLE LENGTH ARRAY */ } xl_xact_commit_compact; #define MinSizeOfXactCommitCompact offsetof(xl_xact_commit_compact, subxacts) typedef struct xl_xact_commit { TimestampTz xact_time; /* time of commit */ uint32 xinfo; /* info flags */ int nrels; /* number of RelFileNodes */ int nsubxacts; /* number of subtransaction XIDs */ int nmsgs; /* number of shared inval msgs */ Oid dbId; /* MyDatabaseId */ Oid tsId; /* MyDatabaseTableSpace */ /* Array of RelFileNode(s) to drop at commit */ RelFileNode xnodes[1]; /* VARIABLE LENGTH ARRAY */ /* ARRAY OF COMMITTED SUBTRANSACTION XIDs FOLLOWS */ /* ARRAY OF SHARED INVALIDATION MESSAGES FOLLOWS */ } xl_xact_commit; #define MinSizeOfXactCommit offsetof(xl_xact_commit, xnodes) /* * These flags are set in the xinfo fields of WAL commit records, * indicating a variety of additional actions that need to occur * when emulating transaction effects during recovery. * They are named XactCompletion... to differentiate them from * EOXact... routines which run at the end of the original * transaction completion. */ #define XACT_COMPLETION_UPDATE_RELCACHE_FILE 0x01 #define XACT_COMPLETION_FORCE_SYNC_COMMIT 0x02 /* Access macros for above flags */ #define XactCompletionRelcacheInitFileInval(xinfo) (xinfo & XACT_COMPLETION_UPDATE_RELCACHE_FILE) #define XactCompletionForceSyncCommit(xinfo) (xinfo & XACT_COMPLETION_FORCE_SYNC_COMMIT) typedef struct xl_xact_abort { TimestampTz xact_time; /* time of abort */ int nrels; /* number of RelFileNodes */ int nsubxacts; /* number of subtransaction XIDs */ /* Array of RelFileNode(s) to drop at abort */ RelFileNode xnodes[1]; /* VARIABLE LENGTH ARRAY */ /* ARRAY OF ABORTED SUBTRANSACTION XIDs FOLLOWS */ } xl_xact_abort; /* Note the intentional lack of an invalidation message array c.f. commit */ #define MinSizeOfXactAbort offsetof(xl_xact_abort, xnodes) /* * COMMIT_PREPARED and ABORT_PREPARED are identical to COMMIT/ABORT records * except that we have to store the XID of the prepared transaction explicitly * --- the XID in the record header will be invalid. */ typedef struct xl_xact_commit_prepared { TransactionId xid; /* XID of prepared xact */ xl_xact_commit crec; /* COMMIT record */ /* MORE DATA FOLLOWS AT END OF STRUCT */ } xl_xact_commit_prepared; #define MinSizeOfXactCommitPrepared offsetof(xl_xact_commit_prepared, crec.xnodes) typedef struct xl_xact_abort_prepared { TransactionId xid; /* XID of prepared xact */ xl_xact_abort arec; /* ABORT record */ /* MORE DATA FOLLOWS AT END OF STRUCT */ } xl_xact_abort_prepared; #define MinSizeOfXactAbortPrepared offsetof(xl_xact_abort_prepared, arec.xnodes) /* ---------------- * extern definitions * ---------------- */ extern bool IsTransactionState(void); extern bool IsAbortedTransactionBlockState(void); extern TransactionId GetTopTransactionId(void); extern TransactionId GetTopTransactionIdIfAny(void); extern TransactionId GetCurrentTransactionId(void); extern TransactionId GetCurrentTransactionIdIfAny(void); extern TransactionId GetStableLatestTransactionId(void); extern SubTransactionId GetCurrentSubTransactionId(void); extern bool SubTransactionIsActive(SubTransactionId subxid); extern CommandId GetCurrentCommandId(bool used); extern TimestampTz GetCurrentTransactionStartTimestamp(void); extern TimestampTz GetCurrentStatementStartTimestamp(void); extern TimestampTz GetCurrentTransactionStopTimestamp(void); extern void SetCurrentStatementStartTimestamp(void); extern int GetCurrentTransactionNestLevel(void); extern bool TransactionIdIsCurrentTransactionId(TransactionId xid); extern void CommandCounterIncrement(void); extern void ForceSyncCommit(void); extern void StartTransactionCommand(void); extern void CommitTransactionCommand(void); extern void AbortCurrentTransaction(void); extern void BeginTransactionBlock(void); extern bool EndTransactionBlock(void); extern bool PrepareTransactionBlock(char *gid); extern void UserAbortTransactionBlock(void); extern void ReleaseSavepoint(List *options); extern void DefineSavepoint(char *name); extern void RollbackToSavepoint(List *options); extern void BeginInternalSubTransaction(char *name); extern void ReleaseCurrentSubTransaction(void); extern void RollbackAndReleaseCurrentSubTransaction(void); extern bool IsSubTransaction(void); extern bool IsTransactionBlock(void); extern bool IsTransactionOrTransactionBlock(void); extern char TransactionBlockStatusCode(void); extern void AbortOutOfAnyTransaction(void); extern void PreventTransactionChain(bool isTopLevel, const char *stmtType); extern void RequireTransactionChain(bool isTopLevel, const char *stmtType); extern bool IsInTransactionChain(bool isTopLevel); extern void RegisterXactCallback(XactCallback callback, void *arg); extern void UnregisterXactCallback(XactCallback callback, void *arg); extern void RegisterSubXactCallback(SubXactCallback callback, void *arg); extern void UnregisterSubXactCallback(SubXactCallback callback, void *arg); extern int xactGetCommittedChildren(TransactionId **ptr); extern void xact_redo(XLogRecPtr lsn, XLogRecord *record); extern void xact_desc(StringInfo buf, uint8 xl_info, char *rec); #endif /* XACT_H */ ���������������������������������������������������������������pgsql/server/access/twophase.h����������������������������������������������������������������������0000644�����������������00000003401�14763166026�0012455 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * twophase.h * Two-phase-commit related declarations. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/twophase.h * *------------------------------------------------------------------------- */ #ifndef TWOPHASE_H #define TWOPHASE_H #include "storage/proc.h" /* * GlobalTransactionData is defined in twophase.c; other places have no * business knowing the internal definition. */ typedef struct GlobalTransactionData *GlobalTransaction; /* GUC variable */ extern int max_prepared_xacts; extern Size TwoPhaseShmemSize(void); extern void TwoPhaseShmemInit(void); extern void AtAbort_Twophase(void); extern void PostPrepare_Twophase(void); extern PGPROC *TwoPhaseGetDummyProc(TransactionId xid); extern BackendId TwoPhaseGetDummyBackendId(TransactionId xid); extern GlobalTransaction MarkAsPreparing(TransactionId xid, const char *gid, TimestampTz prepared_at, Oid owner, Oid databaseid); extern void StartPrepare(GlobalTransaction gxact); extern void EndPrepare(GlobalTransaction gxact); extern bool StandbyTransactionIdIsPrepared(TransactionId xid); extern TransactionId PrescanPreparedTransactions(TransactionId **xids_p, int *nxids_p); extern void StandbyRecoverPreparedTransactions(bool overwriteOK); extern void RecoverPreparedTransactions(void); extern void RecreateTwoPhaseFile(TransactionId xid, void *content, int len); extern void RemoveTwoPhaseFile(TransactionId xid, bool giveWarning); extern void CheckPointTwoPhase(XLogRecPtr redo_horizon); extern void FinishPreparedTransaction(const char *gid, bool isCommit); #endif /* TWOPHASE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/rewriteheap.h�������������������������������������������������������������������0000644�����������������00000001770�14763166026�0013151 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * rewriteheap.h * Declarations for heap rewrite support functions * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994-5, Regents of the University of California * * src/include/access/rewriteheap.h * *------------------------------------------------------------------------- */ #ifndef REWRITE_HEAP_H #define REWRITE_HEAP_H #include "access/htup.h" #include "utils/relcache.h" /* struct definition is private to rewriteheap.c */ typedef struct RewriteStateData *RewriteState; extern RewriteState begin_heap_rewrite(Relation NewHeap, TransactionId OldestXmin, TransactionId FreezeXid, bool use_wal); extern void end_heap_rewrite(RewriteState state); extern void rewrite_heap_tuple(RewriteState state, HeapTuple oldTuple, HeapTuple newTuple); extern bool rewrite_heap_dead_tuple(RewriteState state, HeapTuple oldTuple); #endif /* REWRITE_HEAP_H */ ��������pgsql/server/access/subtrans.h����������������������������������������������������������������������0000644�����������������00000001715�14763166026�0012472 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * subtrans.h * * PostgreSQL subtransaction-log manager * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/subtrans.h */ #ifndef SUBTRANS_H #define SUBTRANS_H /* Number of SLRU buffers to use for subtrans */ #define NUM_SUBTRANS_BUFFERS 32 extern void SubTransSetParent(TransactionId xid, TransactionId parent, bool overwriteOK); extern TransactionId SubTransGetParent(TransactionId xid); extern TransactionId SubTransGetTopmostTransaction(TransactionId xid); extern Size SUBTRANSShmemSize(void); extern void SUBTRANSShmemInit(void); extern void BootStrapSUBTRANS(void); extern void StartupSUBTRANS(TransactionId oldestActiveXID); extern void ShutdownSUBTRANS(void); extern void CheckPointSUBTRANS(void); extern void ExtendSUBTRANS(TransactionId newestXact); extern void TruncateSUBTRANS(TransactionId oldestXact); #endif /* SUBTRANS_H */ ���������������������������������������������������pgsql/server/access/tupconvert.h��������������������������������������������������������������������0000644�����������������00000002407�14763166026�0013041 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * tupconvert.h * Tuple conversion support. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/tupconvert.h * *------------------------------------------------------------------------- */ #ifndef TUPCONVERT_H #define TUPCONVERT_H #include "access/htup.h" typedef struct TupleConversionMap { TupleDesc indesc; /* tupdesc for source rowtype */ TupleDesc outdesc; /* tupdesc for result rowtype */ AttrNumber *attrMap; /* indexes of input fields, or 0 for null */ Datum *invalues; /* workspace for deconstructing source */ bool *inisnull; Datum *outvalues; /* workspace for constructing result */ bool *outisnull; } TupleConversionMap; extern TupleConversionMap *convert_tuples_by_position(TupleDesc indesc, TupleDesc outdesc, const char *msg); extern TupleConversionMap *convert_tuples_by_name(TupleDesc indesc, TupleDesc outdesc, const char *msg); extern HeapTuple do_convert_tuple(HeapTuple tuple, TupleConversionMap *map); extern void free_conversion_map(TupleConversionMap *map); #endif /* TUPCONVERT_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/nbtree.h������������������������������������������������������������������������0000644�����������������00000066675�14763166026�0012130 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nbtree.h * header file for postgres btree access method implementation. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/nbtree.h * *------------------------------------------------------------------------- */ #ifndef NBTREE_H #define NBTREE_H #include "access/genam.h" #include "access/itup.h" #include "access/sdir.h" #include "access/xlog.h" #include "access/xlogutils.h" #include "catalog/pg_index.h" /* There's room for a 16-bit vacuum cycle ID in BTPageOpaqueData */ typedef uint16 BTCycleId; /* * BTPageOpaqueData -- At the end of every page, we store a pointer * to both siblings in the tree. This is used to do forward/backward * index scans. The next-page link is also critical for recovery when * a search has navigated to the wrong page due to concurrent page splits * or deletions; see src/backend/access/nbtree/README for more info. * * In addition, we store the page's btree level (counting upwards from * zero at a leaf page) as well as some flag bits indicating the page type * and status. If the page is deleted, we replace the level with the * next-transaction-ID value indicating when it is safe to reclaim the page. * * We also store a "vacuum cycle ID". When a page is split while VACUUM is * processing the index, a nonzero value associated with the VACUUM run is * stored into both halves of the split page. (If VACUUM is not running, * both pages receive zero cycleids.) This allows VACUUM to detect whether * a page was split since it started, with a small probability of false match * if the page was last split some exact multiple of MAX_BT_CYCLE_ID VACUUMs * ago. Also, during a split, the BTP_SPLIT_END flag is cleared in the left * (original) page, and set in the right page, but only if the next page * to its right has a different cycleid. * * NOTE: the BTP_LEAF flag bit is redundant since level==0 could be tested * instead. */ typedef struct BTPageOpaqueData { BlockNumber btpo_prev; /* left sibling, or P_NONE if leftmost */ BlockNumber btpo_next; /* right sibling, or P_NONE if rightmost */ union { uint32 level; /* tree level --- zero for leaf pages */ TransactionId xact; /* next transaction ID, if deleted */ } btpo; uint16 btpo_flags; /* flag bits, see below */ BTCycleId btpo_cycleid; /* vacuum cycle ID of latest split */ } BTPageOpaqueData; typedef BTPageOpaqueData *BTPageOpaque; /* Bits defined in btpo_flags */ #define BTP_LEAF (1 << 0) /* leaf page, i.e. not internal page */ #define BTP_ROOT (1 << 1) /* root page (has no parent) */ #define BTP_DELETED (1 << 2) /* page has been deleted from tree */ #define BTP_META (1 << 3) /* meta-page */ #define BTP_HALF_DEAD (1 << 4) /* empty, but still in tree */ #define BTP_SPLIT_END (1 << 5) /* rightmost page of split group */ #define BTP_HAS_GARBAGE (1 << 6) /* page has LP_DEAD tuples */ /* * The max allowed value of a cycle ID is a bit less than 64K. This is * for convenience of pg_filedump and similar utilities: we want to use * the last 2 bytes of special space as an index type indicator, and * restricting cycle ID lets btree use that space for vacuum cycle IDs * while still allowing index type to be identified. */ #define MAX_BT_CYCLE_ID 0xFF7F /* * The Meta page is always the first page in the btree index. * Its primary purpose is to point to the location of the btree root page. * We also point to the "fast" root, which is the current effective root; * see README for discussion. */ typedef struct BTMetaPageData { uint32 btm_magic; /* should contain BTREE_MAGIC */ uint32 btm_version; /* should contain BTREE_VERSION */ BlockNumber btm_root; /* current root location */ uint32 btm_level; /* tree level of the root page */ BlockNumber btm_fastroot; /* current "fast" root location */ uint32 btm_fastlevel; /* tree level of the "fast" root page */ } BTMetaPageData; #define BTPageGetMeta(p) \ ((BTMetaPageData *) PageGetContents(p)) #define BTREE_METAPAGE 0 /* first page is meta */ #define BTREE_MAGIC 0x053162 /* magic number of btree pages */ #define BTREE_VERSION 2 /* current version number */ /* * Maximum size of a btree index entry, including its tuple header. * * We actually need to be able to fit three items on every page, * so restrict any one item to 1/3 the per-page available space. */ #define BTMaxItemSize(page) \ MAXALIGN_DOWN((PageGetPageSize(page) - \ MAXALIGN(SizeOfPageHeaderData + 3*sizeof(ItemIdData)) - \ MAXALIGN(sizeof(BTPageOpaqueData))) / 3) /* * The leaf-page fillfactor defaults to 90% but is user-adjustable. * For pages above the leaf level, we use a fixed 70% fillfactor. * The fillfactor is applied during index build and when splitting * a rightmost page; when splitting non-rightmost pages we try to * divide the data equally. */ #define BTREE_MIN_FILLFACTOR 10 #define BTREE_DEFAULT_FILLFACTOR 90 #define BTREE_NONLEAF_FILLFACTOR 70 /* * Test whether two btree entries are "the same". * * Old comments: * In addition, we must guarantee that all tuples in the index are unique, * in order to satisfy some assumptions in Lehman and Yao. The way that we * do this is by generating a new OID for every insertion that we do in the * tree. This adds eight bytes to the size of btree index tuples. Note * that we do not use the OID as part of a composite key; the OID only * serves as a unique identifier for a given index tuple (logical position * within a page). * * New comments: * actually, we must guarantee that all tuples in A LEVEL * are unique, not in ALL INDEX. So, we can use the t_tid * as unique identifier for a given index tuple (logical position * within a level). - vadim 04/09/97 */ #define BTTidSame(i1, i2) \ ( (i1).ip_blkid.bi_hi == (i2).ip_blkid.bi_hi && \ (i1).ip_blkid.bi_lo == (i2).ip_blkid.bi_lo && \ (i1).ip_posid == (i2).ip_posid ) #define BTEntrySame(i1, i2) \ BTTidSame((i1)->t_tid, (i2)->t_tid) /* * In general, the btree code tries to localize its knowledge about * page layout to a couple of routines. However, we need a special * value to indicate "no page number" in those places where we expect * page numbers. We can use zero for this because we never need to * make a pointer to the metadata page. */ #define P_NONE 0 /* * Macros to test whether a page is leftmost or rightmost on its tree level, * as well as other state info kept in the opaque data. */ #define P_LEFTMOST(opaque) ((opaque)->btpo_prev == P_NONE) #define P_RIGHTMOST(opaque) ((opaque)->btpo_next == P_NONE) #define P_ISLEAF(opaque) ((opaque)->btpo_flags & BTP_LEAF) #define P_ISROOT(opaque) ((opaque)->btpo_flags & BTP_ROOT) #define P_ISDELETED(opaque) ((opaque)->btpo_flags & BTP_DELETED) #define P_ISHALFDEAD(opaque) ((opaque)->btpo_flags & BTP_HALF_DEAD) #define P_IGNORE(opaque) ((opaque)->btpo_flags & (BTP_DELETED|BTP_HALF_DEAD)) #define P_HAS_GARBAGE(opaque) ((opaque)->btpo_flags & BTP_HAS_GARBAGE) /* * Lehman and Yao's algorithm requires a ``high key'' on every non-rightmost * page. The high key is not a data key, but gives info about what range of * keys is supposed to be on this page. The high key on a page is required * to be greater than or equal to any data key that appears on the page. * If we find ourselves trying to insert a key > high key, we know we need * to move right (this should only happen if the page was split since we * examined the parent page). * * Our insertion algorithm guarantees that we can use the initial least key * on our right sibling as the high key. Once a page is created, its high * key changes only if the page is split. * * On a non-rightmost page, the high key lives in item 1 and data items * start in item 2. Rightmost pages have no high key, so we store data * items beginning in item 1. */ #define P_HIKEY ((OffsetNumber) 1) #define P_FIRSTKEY ((OffsetNumber) 2) #define P_FIRSTDATAKEY(opaque) (P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY) /* * XLOG records for btree operations * * XLOG allows to store some information in high 4 bits of log * record xl_info field */ #define XLOG_BTREE_INSERT_LEAF 0x00 /* add index tuple without split */ #define XLOG_BTREE_INSERT_UPPER 0x10 /* same, on a non-leaf page */ #define XLOG_BTREE_INSERT_META 0x20 /* same, plus update metapage */ #define XLOG_BTREE_SPLIT_L 0x30 /* add index tuple with split */ #define XLOG_BTREE_SPLIT_R 0x40 /* as above, new item on right */ #define XLOG_BTREE_SPLIT_L_ROOT 0x50 /* add tuple with split of root */ #define XLOG_BTREE_SPLIT_R_ROOT 0x60 /* as above, new item on right */ #define XLOG_BTREE_DELETE 0x70 /* delete leaf index tuples for a page */ #define XLOG_BTREE_DELETE_PAGE 0x80 /* delete an entire page */ #define XLOG_BTREE_DELETE_PAGE_META 0x90 /* same, and update metapage */ #define XLOG_BTREE_NEWROOT 0xA0 /* new root page */ #define XLOG_BTREE_DELETE_PAGE_HALF 0xB0 /* page deletion that makes * parent half-dead */ #define XLOG_BTREE_VACUUM 0xC0 /* delete entries on a page during * vacuum */ #define XLOG_BTREE_REUSE_PAGE 0xD0 /* old page is about to be reused from * FSM */ /* * All that we need to find changed index tuple */ typedef struct xl_btreetid { RelFileNode node; ItemPointerData tid; /* changed tuple id */ } xl_btreetid; /* * All that we need to regenerate the meta-data page */ typedef struct xl_btree_metadata { BlockNumber root; uint32 level; BlockNumber fastroot; uint32 fastlevel; } xl_btree_metadata; /* * This is what we need to know about simple (without split) insert. * * This data record is used for INSERT_LEAF, INSERT_UPPER, INSERT_META. * Note that INSERT_META implies it's not a leaf page. */ typedef struct xl_btree_insert { xl_btreetid target; /* inserted tuple id */ /* BlockNumber downlink field FOLLOWS IF NOT XLOG_BTREE_INSERT_LEAF */ /* xl_btree_metadata FOLLOWS IF XLOG_BTREE_INSERT_META */ /* INDEX TUPLE FOLLOWS AT END OF STRUCT */ } xl_btree_insert; #define SizeOfBtreeInsert (offsetof(xl_btreetid, tid) + SizeOfIptrData) /* * On insert with split, we save all the items going into the right sibling * so that we can restore it completely from the log record. This way takes * less xlog space than the normal approach, because if we did it standardly, * XLogInsert would almost always think the right page is new and store its * whole page image. The left page, however, is handled in the normal * incremental-update fashion. * * Note: the four XLOG_BTREE_SPLIT xl_info codes all use this data record. * The _L and _R variants indicate whether the inserted tuple went into the * left or right split page (and thus, whether newitemoff and the new item * are stored or not). The _ROOT variants indicate that we are splitting * the root page, and thus that a newroot record rather than an insert or * split record should follow. Note that a split record never carries a * metapage update --- we'll do that in the parent-level update. */ typedef struct xl_btree_split { RelFileNode node; BlockNumber leftsib; /* orig page / new left page */ BlockNumber rightsib; /* new right page */ BlockNumber rnext; /* next block (orig page's rightlink) */ uint32 level; /* tree level of page being split */ OffsetNumber firstright; /* first item moved to right page */ /* * If level > 0, BlockIdData downlink follows. (We use BlockIdData rather * than BlockNumber for alignment reasons: SizeOfBtreeSplit is only 16-bit * aligned.) * * If level > 0, an IndexTuple representing the HIKEY of the left page * follows. We don't need this on leaf pages, because it's the same as * the leftmost key in the new right page. Also, it's suppressed if * XLogInsert chooses to store the left page's whole page image. * * In the _L variants, next are OffsetNumber newitemoff and the new item. * (In the _R variants, the new item is one of the right page's tuples.) * The new item, but not newitemoff, is suppressed if XLogInsert chooses * to store the left page's whole page image. * * Last are the right page's tuples in the form used by _bt_restore_page. */ } xl_btree_split; #define SizeOfBtreeSplit (offsetof(xl_btree_split, firstright) + sizeof(OffsetNumber)) /* * This is what we need to know about delete of individual leaf index tuples. * The WAL record can represent deletion of any number of index tuples on a * single index page when *not* executed by VACUUM. */ typedef struct xl_btree_delete { RelFileNode node; /* RelFileNode of the index */ BlockNumber block; RelFileNode hnode; /* RelFileNode of the heap the index currently * points at */ int nitems; /* TARGET OFFSET NUMBERS FOLLOW AT THE END */ } xl_btree_delete; #define SizeOfBtreeDelete (offsetof(xl_btree_delete, nitems) + sizeof(int)) /* * This is what we need to know about page reuse within btree. */ typedef struct xl_btree_reuse_page { RelFileNode node; BlockNumber block; TransactionId latestRemovedXid; } xl_btree_reuse_page; #define SizeOfBtreeReusePage (sizeof(xl_btree_reuse_page)) /* * This is what we need to know about vacuum of individual leaf index tuples. * The WAL record can represent deletion of any number of index tuples on a * single index page when executed by VACUUM. * * The correctness requirement for applying these changes during recovery is * that we must do one of these two things for every block in the index: * * lock the block for cleanup and apply any required changes * * EnsureBlockUnpinned() * The purpose of this is to ensure that no index scans started before we * finish scanning the index are still running by the time we begin to remove * heap tuples. * * Any changes to any one block are registered on just one WAL record. All * blocks that we need to run EnsureBlockUnpinned() are listed as a block range * starting from the last block vacuumed through until this one. Individual * block numbers aren't given. * * Note that the *last* WAL record in any vacuum of an index is allowed to * have a zero length array of offsets. Earlier records must have at least one. */ typedef struct xl_btree_vacuum { RelFileNode node; BlockNumber block; BlockNumber lastBlockVacuumed; /* TARGET OFFSET NUMBERS FOLLOW */ } xl_btree_vacuum; #define SizeOfBtreeVacuum (offsetof(xl_btree_vacuum, lastBlockVacuumed) + sizeof(BlockNumber)) /* * This is what we need to know about deletion of a btree page. The target * identifies the tuple removed from the parent page (note that we remove * this tuple's downlink and the *following* tuple's key). Note we do not * store any content for the deleted page --- it is just rewritten as empty * during recovery, apart from resetting the btpo.xact. */ typedef struct xl_btree_delete_page { xl_btreetid target; /* deleted tuple id in parent page */ BlockNumber deadblk; /* child block being deleted */ BlockNumber leftblk; /* child block's left sibling, if any */ BlockNumber rightblk; /* child block's right sibling */ TransactionId btpo_xact; /* value of btpo.xact for use in recovery */ /* xl_btree_metadata FOLLOWS IF XLOG_BTREE_DELETE_PAGE_META */ } xl_btree_delete_page; #define SizeOfBtreeDeletePage (offsetof(xl_btree_delete_page, btpo_xact) + sizeof(TransactionId)) /* * New root log record. There are zero tuples if this is to establish an * empty root, or two if it is the result of splitting an old root. * * Note that although this implies rewriting the metadata page, we don't need * an xl_btree_metadata record --- the rootblk and level are sufficient. */ typedef struct xl_btree_newroot { RelFileNode node; BlockNumber rootblk; /* location of new root */ uint32 level; /* its tree level */ /* 0 or 2 INDEX TUPLES FOLLOW AT END OF STRUCT */ } xl_btree_newroot; #define SizeOfBtreeNewroot (offsetof(xl_btree_newroot, level) + sizeof(uint32)) /* * Operator strategy numbers for B-tree have been moved to access/skey.h, * because many places need to use them in ScanKeyInit() calls. * * The strategy numbers are chosen so that we can commute them by * subtraction, thus: */ #define BTCommuteStrategyNumber(strat) (BTMaxStrategyNumber + 1 - (strat)) /* * When a new operator class is declared, we require that the user * supply us with an amproc procedure (BTORDER_PROC) for determining * whether, for two keys a and b, a < b, a = b, or a > b. This routine * must return < 0, 0, > 0, respectively, in these three cases. (It must * not return INT_MIN, since we may negate the result before using it.) * * To facilitate accelerated sorting, an operator class may choose to * offer a second procedure (BTSORTSUPPORT_PROC). For full details, see * src/include/utils/sortsupport.h. */ #define BTORDER_PROC 1 #define BTSORTSUPPORT_PROC 2 /* * We need to be able to tell the difference between read and write * requests for pages, in order to do locking correctly. */ #define BT_READ BUFFER_LOCK_SHARE #define BT_WRITE BUFFER_LOCK_EXCLUSIVE /* * BTStackData -- As we descend a tree, we push the (location, downlink) * pairs from internal pages onto a private stack. If we split a * leaf, we use this stack to walk back up the tree and insert data * into parent pages (and possibly to split them, too). Lehman and * Yao's update algorithm guarantees that under no circumstances can * our private stack give us an irredeemably bad picture up the tree. * Again, see the paper for details. */ typedef struct BTStackData { BlockNumber bts_blkno; OffsetNumber bts_offset; IndexTupleData bts_btentry; struct BTStackData *bts_parent; } BTStackData; typedef BTStackData *BTStack; /* * BTScanOpaqueData is the btree-private state needed for an indexscan. * This consists of preprocessed scan keys (see _bt_preprocess_keys() for * details of the preprocessing), information about the current location * of the scan, and information about the marked location, if any. (We use * BTScanPosData to represent the data needed for each of current and marked * locations.) In addition we can remember some known-killed index entries * that must be marked before we can move off the current page. * * Index scans work a page at a time: we pin and read-lock the page, identify * all the matching items on the page and save them in BTScanPosData, then * release the read-lock while returning the items to the caller for * processing. This approach minimizes lock/unlock traffic. Note that we * keep the pin on the index page until the caller is done with all the items * (this is needed for VACUUM synchronization, see nbtree/README). When we * are ready to step to the next page, if the caller has told us any of the * items were killed, we re-lock the page to mark them killed, then unlock. * Finally we drop the pin and step to the next page in the appropriate * direction. * * If we are doing an index-only scan, we save the entire IndexTuple for each * matched item, otherwise only its heap TID and offset. The IndexTuples go * into a separate workspace array; each BTScanPosItem stores its tuple's * offset within that array. */ typedef struct BTScanPosItem /* what we remember about each match */ { ItemPointerData heapTid; /* TID of referenced heap item */ OffsetNumber indexOffset; /* index item's location within page */ LocationIndex tupleOffset; /* IndexTuple's offset in workspace, if any */ } BTScanPosItem; typedef struct BTScanPosData { Buffer buf; /* if valid, the buffer is pinned */ BlockNumber nextPage; /* page's right link when we scanned it */ /* * moreLeft and moreRight track whether we think there may be matching * index entries to the left and right of the current page, respectively. * We can clear the appropriate one of these flags when _bt_checkkeys() * returns continuescan = false. */ bool moreLeft; bool moreRight; /* * If we are doing an index-only scan, nextTupleOffset is the first free * location in the associated tuple storage workspace. */ int nextTupleOffset; /* * The items array is always ordered in index order (ie, increasing * indexoffset). When scanning backwards it is convenient to fill the * array back-to-front, so we start at the last slot and fill downwards. * Hence we need both a first-valid-entry and a last-valid-entry counter. * itemIndex is a cursor showing which entry was last returned to caller. */ int firstItem; /* first valid index in items[] */ int lastItem; /* last valid index in items[] */ int itemIndex; /* current index in items[] */ BTScanPosItem items[MaxIndexTuplesPerPage]; /* MUST BE LAST */ } BTScanPosData; typedef BTScanPosData *BTScanPos; #define BTScanPosIsValid(scanpos) BufferIsValid((scanpos).buf) /* We need one of these for each equality-type SK_SEARCHARRAY scan key */ typedef struct BTArrayKeyInfo { int scan_key; /* index of associated key in arrayKeyData */ int cur_elem; /* index of current element in elem_values */ int mark_elem; /* index of marked element in elem_values */ int num_elems; /* number of elems in current array value */ Datum *elem_values; /* array of num_elems Datums */ } BTArrayKeyInfo; typedef struct BTScanOpaqueData { /* these fields are set by _bt_preprocess_keys(): */ bool qual_ok; /* false if qual can never be satisfied */ int numberOfKeys; /* number of preprocessed scan keys */ ScanKey keyData; /* array of preprocessed scan keys */ /* workspace for SK_SEARCHARRAY support */ ScanKey arrayKeyData; /* modified copy of scan->keyData */ int numArrayKeys; /* number of equality-type array keys (-1 if * there are any unsatisfiable array keys) */ BTArrayKeyInfo *arrayKeys; /* info about each equality-type array key */ MemoryContext arrayContext; /* scan-lifespan context for array data */ /* info about killed items if any (killedItems is NULL if never used) */ int *killedItems; /* currPos.items indexes of killed items */ int numKilled; /* number of currently stored items */ /* * If we are doing an index-only scan, these are the tuple storage * workspaces for the currPos and markPos respectively. Each is of size * BLCKSZ, so it can hold as much as a full page's worth of tuples. */ char *currTuples; /* tuple storage for currPos */ char *markTuples; /* tuple storage for markPos */ /* * If the marked position is on the same page as current position, we * don't use markPos, but just keep the marked itemIndex in markItemIndex * (all the rest of currPos is valid for the mark position). Hence, to * determine if there is a mark, first look at markItemIndex, then at * markPos. */ int markItemIndex; /* itemIndex, or -1 if not valid */ /* keep these last in struct for efficiency */ BTScanPosData currPos; /* current position data */ BTScanPosData markPos; /* marked position, if any */ } BTScanOpaqueData; typedef BTScanOpaqueData *BTScanOpaque; /* * We use some private sk_flags bits in preprocessed scan keys. We're allowed * to use bits 16-31 (see skey.h). The uppermost bits are copied from the * index's indoption[] array entry for the index attribute. */ #define SK_BT_REQFWD 0x00010000 /* required to continue forward scan */ #define SK_BT_REQBKWD 0x00020000 /* required to continue backward scan */ #define SK_BT_INDOPTION_SHIFT 24 /* must clear the above bits */ #define SK_BT_DESC (INDOPTION_DESC << SK_BT_INDOPTION_SHIFT) #define SK_BT_NULLS_FIRST (INDOPTION_NULLS_FIRST << SK_BT_INDOPTION_SHIFT) /* * prototypes for functions in nbtree.c (external entry points for btree) */ extern Datum btbuild(PG_FUNCTION_ARGS); extern Datum btbuildempty(PG_FUNCTION_ARGS); extern Datum btinsert(PG_FUNCTION_ARGS); extern Datum btbeginscan(PG_FUNCTION_ARGS); extern Datum btgettuple(PG_FUNCTION_ARGS); extern Datum btgetbitmap(PG_FUNCTION_ARGS); extern Datum btrescan(PG_FUNCTION_ARGS); extern Datum btendscan(PG_FUNCTION_ARGS); extern Datum btmarkpos(PG_FUNCTION_ARGS); extern Datum btrestrpos(PG_FUNCTION_ARGS); extern Datum btbulkdelete(PG_FUNCTION_ARGS); extern Datum btvacuumcleanup(PG_FUNCTION_ARGS); extern Datum btcanreturn(PG_FUNCTION_ARGS); extern Datum btoptions(PG_FUNCTION_ARGS); /* * prototypes for functions in nbtinsert.c */ extern bool _bt_doinsert(Relation rel, IndexTuple itup, IndexUniqueCheck checkUnique, Relation heapRel); extern Buffer _bt_getstackbuf(Relation rel, BTStack stack, int access); extern void _bt_insert_parent(Relation rel, Buffer buf, Buffer rbuf, BTStack stack, bool is_root, bool is_only); /* * prototypes for functions in nbtpage.c */ extern void _bt_initmetapage(Page page, BlockNumber rootbknum, uint32 level); extern Buffer _bt_getroot(Relation rel, int access); extern Buffer _bt_gettrueroot(Relation rel); extern void _bt_checkpage(Relation rel, Buffer buf); extern Buffer _bt_getbuf(Relation rel, BlockNumber blkno, int access); extern Buffer _bt_relandgetbuf(Relation rel, Buffer obuf, BlockNumber blkno, int access); extern void _bt_relbuf(Relation rel, Buffer buf); extern void _bt_pageinit(Page page, Size size); extern bool _bt_page_recyclable(Page page); extern void _bt_delitems_delete(Relation rel, Buffer buf, OffsetNumber *itemnos, int nitems, Relation heapRel); extern void _bt_delitems_vacuum(Relation rel, Buffer buf, OffsetNumber *itemnos, int nitems, BlockNumber lastBlockVacuumed); extern int _bt_pagedel(Relation rel, Buffer buf, BTStack stack); /* * prototypes for functions in nbtsearch.c */ extern BTStack _bt_search(Relation rel, int keysz, ScanKey scankey, bool nextkey, Buffer *bufP, int access); extern Buffer _bt_moveright(Relation rel, Buffer buf, int keysz, ScanKey scankey, bool nextkey, int access); extern OffsetNumber _bt_binsrch(Relation rel, Buffer buf, int keysz, ScanKey scankey, bool nextkey); extern int32 _bt_compare(Relation rel, int keysz, ScanKey scankey, Page page, OffsetNumber offnum); extern bool _bt_first(IndexScanDesc scan, ScanDirection dir); extern bool _bt_next(IndexScanDesc scan, ScanDirection dir); extern Buffer _bt_get_endpoint(Relation rel, uint32 level, bool rightmost); /* * prototypes for functions in nbtutils.c */ extern ScanKey _bt_mkscankey(Relation rel, IndexTuple itup); extern ScanKey _bt_mkscankey_nodata(Relation rel); extern void _bt_freeskey(ScanKey skey); extern void _bt_freestack(BTStack stack); extern void _bt_preprocess_array_keys(IndexScanDesc scan); extern void _bt_start_array_keys(IndexScanDesc scan, ScanDirection dir); extern bool _bt_advance_array_keys(IndexScanDesc scan, ScanDirection dir); extern void _bt_mark_array_keys(IndexScanDesc scan); extern void _bt_restore_array_keys(IndexScanDesc scan); extern void _bt_preprocess_keys(IndexScanDesc scan); extern IndexTuple _bt_checkkeys(IndexScanDesc scan, Page page, OffsetNumber offnum, ScanDirection dir, bool *continuescan); extern void _bt_killitems(IndexScanDesc scan, bool haveLock); extern BTCycleId _bt_vacuum_cycleid(Relation rel); extern BTCycleId _bt_start_vacuum(Relation rel); extern void _bt_end_vacuum(Relation rel); extern void _bt_end_vacuum_callback(int code, Datum arg); extern Size BTreeShmemSize(void); extern void BTreeShmemInit(void); /* * prototypes for functions in nbtsort.c */ typedef struct BTSpool BTSpool; /* opaque type known only within nbtsort.c */ extern BTSpool *_bt_spoolinit(Relation index, bool isunique, bool isdead); extern void _bt_spooldestroy(BTSpool *btspool); extern void _bt_spool(IndexTuple itup, BTSpool *btspool); extern void _bt_leafbuild(BTSpool *btspool, BTSpool *spool2); /* * prototypes for functions in nbtxlog.c */ extern void btree_redo(XLogRecPtr lsn, XLogRecord *record); extern void btree_desc(StringInfo buf, uint8 xl_info, char *rec); extern void btree_xlog_startup(void); extern void btree_xlog_cleanup(void); extern bool btree_safe_restartpoint(void); #endif /* NBTREE_H */ �������������������������������������������������������������������pgsql/server/access/attnum.h������������������������������������������������������������������������0000644�����������������00000003023�14763166026�0012133 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * attnum.h * POSTGRES attribute number definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/attnum.h * *------------------------------------------------------------------------- */ #ifndef ATTNUM_H #define ATTNUM_H /* * user defined attribute numbers start at 1. -ay 2/95 */ typedef int16 AttrNumber; #define InvalidAttrNumber 0 #define MaxAttrNumber 32767 /* ---------------- * support macros * ---------------- */ /* * AttributeNumberIsValid * True iff the attribute number is valid. */ #define AttributeNumberIsValid(attributeNumber) \ ((bool) ((attributeNumber) != InvalidAttrNumber)) /* * AttrNumberIsForUserDefinedAttr * True iff the attribute number corresponds to an user defined attribute. */ #define AttrNumberIsForUserDefinedAttr(attributeNumber) \ ((bool) ((attributeNumber) > 0)) /* * AttrNumberGetAttrOffset * Returns the attribute offset for an attribute number. * * Note: * Assumes the attribute number is for an user defined attribute. */ #define AttrNumberGetAttrOffset(attNum) \ ( \ AssertMacro(AttrNumberIsForUserDefinedAttr(attNum)), \ ((attNum) - 1) \ ) /* * AttributeOffsetGetAttributeNumber * Returns the attribute number for an attribute offset. */ #define AttrOffsetGetAttrNumber(attributeOffset) \ ((AttrNumber) (1 + (attributeOffset))) #endif /* ATTNUM_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/xlogdefs.h����������������������������������������������������������������������0000644�����������������00000010771�14763166026�0012446 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * xlogdefs.h * * Postgres transaction log manager record pointer and * timeline number definitions * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/xlogdefs.h */ #ifndef XLOG_DEFS_H #define XLOG_DEFS_H #include <fcntl.h> /* need open() flags */ /* * Pointer to a location in the XLOG. These pointers are 64 bits wide, * because we don't want them ever to overflow. * * NOTE: xrecoff == 0 is used to indicate an invalid pointer. This is OK * because we use page headers in the XLOG, so no XLOG record can start * right at the beginning of a file. * * NOTE: the "log file number" is somewhat misnamed, since the actual files * making up the XLOG are much smaller than 4Gb. Each actual file is an * XLogSegSize-byte "segment" of a logical log file having the indicated * xlogid. The log file number and segment number together identify a * physical XLOG file. Segment number and offset within the physical file * are computed from xrecoff div and mod XLogSegSize. */ typedef struct XLogRecPtr { uint32 xlogid; /* log file #, 0 based */ uint32 xrecoff; /* byte offset of location in log file */ } XLogRecPtr; #define XLogRecPtrIsInvalid(r) ((r).xrecoff == 0) /* * Macros for comparing XLogRecPtrs * * Beware of passing expressions with side-effects to these macros, * since the arguments may be evaluated multiple times. */ #define XLByteLT(a, b) \ ((a).xlogid < (b).xlogid || \ ((a).xlogid == (b).xlogid && (a).xrecoff < (b).xrecoff)) #define XLByteLE(a, b) \ ((a).xlogid < (b).xlogid || \ ((a).xlogid == (b).xlogid && (a).xrecoff <= (b).xrecoff)) #define XLByteEQ(a, b) \ ((a).xlogid == (b).xlogid && (a).xrecoff == (b).xrecoff) /* * Macro for advancing a record pointer by the specified number of bytes. */ #define XLByteAdvance(recptr, nbytes) \ do { \ if (recptr.xrecoff + nbytes >= XLogFileSize) \ { \ recptr.xlogid += 1; \ recptr.xrecoff \ = recptr.xrecoff + nbytes - XLogFileSize; \ } \ else \ recptr.xrecoff += nbytes; \ } while (0) /* * TimeLineID (TLI) - identifies different database histories to prevent * confusion after restoring a prior state of a database installation. * TLI does not change in a normal stop/restart of the database (including * crash-and-recover cases); but we must assign a new TLI after doing * a recovery to a prior state, a/k/a point-in-time recovery. This makes * the new WAL logfile sequence we generate distinguishable from the * sequence that was generated in the previous incarnation. */ typedef uint32 TimeLineID; /* * Because O_DIRECT bypasses the kernel buffers, and because we never * read those buffers except during crash recovery or if wal_level != minimal, * it is a win to use it in all cases where we sync on each write(). We could * allow O_DIRECT with fsync(), but it is unclear if fsync() could process * writes not buffered in the kernel. Also, O_DIRECT is never enough to force * data to the drives, it merely tries to bypass the kernel cache, so we still * need O_SYNC/O_DSYNC. */ #ifdef O_DIRECT #define PG_O_DIRECT O_DIRECT #else #define PG_O_DIRECT 0 #endif /* * This chunk of hackery attempts to determine which file sync methods * are available on the current platform, and to choose an appropriate * default method. We assume that fsync() is always available, and that * configure determined whether fdatasync() is. */ #if defined(O_SYNC) #define OPEN_SYNC_FLAG O_SYNC #elif defined(O_FSYNC) #define OPEN_SYNC_FLAG O_FSYNC #endif #if defined(O_DSYNC) #if defined(OPEN_SYNC_FLAG) /* O_DSYNC is distinct? */ #if O_DSYNC != OPEN_SYNC_FLAG #define OPEN_DATASYNC_FLAG O_DSYNC #endif #else /* !defined(OPEN_SYNC_FLAG) */ /* Win32 only has O_DSYNC */ #define OPEN_DATASYNC_FLAG O_DSYNC #endif #endif #if defined(PLATFORM_DEFAULT_SYNC_METHOD) #define DEFAULT_SYNC_METHOD PLATFORM_DEFAULT_SYNC_METHOD #elif defined(OPEN_DATASYNC_FLAG) #define DEFAULT_SYNC_METHOD SYNC_METHOD_OPEN_DSYNC #elif defined(HAVE_FDATASYNC) #define DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC #else #define DEFAULT_SYNC_METHOD SYNC_METHOD_FSYNC #endif /* * Limitation of buffer-alignment for direct IO depends on OS and filesystem, * but XLOG_BLCKSZ is assumed to be enough for it. */ #ifdef O_DIRECT #define ALIGNOF_XLOG_BUFFER XLOG_BLCKSZ #else #define ALIGNOF_XLOG_BUFFER ALIGNOF_BUFFER #endif #endif /* XLOG_DEFS_H */ �������pgsql/server/access/tupmacs.h�����������������������������������������������������������������������0000644�����������������00000016240�14763166026�0012304 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * tupmacs.h * Tuple macros used by both index tuples and heap tuples. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/tupmacs.h * *------------------------------------------------------------------------- */ #ifndef TUPMACS_H #define TUPMACS_H /* * check to see if the ATT'th bit of an array of 8-bit bytes is set. */ #define att_isnull(ATT, BITS) (!((BITS)[(ATT) >> 3] & (1 << ((ATT) & 0x07)))) /* * Given a Form_pg_attribute and a pointer into a tuple's data area, * return the correct value or pointer. * * We return a Datum value in all cases. If the attribute has "byval" false, * we return the same pointer into the tuple data area that we're passed. * Otherwise, we return the correct number of bytes fetched from the data * area and extended to Datum form. * * On machines where Datum is 8 bytes, we support fetching 8-byte byval * attributes; otherwise, only 1, 2, and 4-byte values are supported. * * Note that T must already be properly aligned for this to work correctly. */ #define fetchatt(A,T) fetch_att(T, (A)->attbyval, (A)->attlen) /* * Same, but work from byval/len parameters rather than Form_pg_attribute. */ #if SIZEOF_DATUM == 8 #define fetch_att(T,attbyval,attlen) \ ( \ (attbyval) ? \ ( \ (attlen) == (int) sizeof(Datum) ? \ *((Datum *)(T)) \ : \ ( \ (attlen) == (int) sizeof(int32) ? \ Int32GetDatum(*((int32 *)(T))) \ : \ ( \ (attlen) == (int) sizeof(int16) ? \ Int16GetDatum(*((int16 *)(T))) \ : \ ( \ AssertMacro((attlen) == 1), \ CharGetDatum(*((char *)(T))) \ ) \ ) \ ) \ ) \ : \ PointerGetDatum((char *) (T)) \ ) #else /* SIZEOF_DATUM != 8 */ #define fetch_att(T,attbyval,attlen) \ ( \ (attbyval) ? \ ( \ (attlen) == (int) sizeof(int32) ? \ Int32GetDatum(*((int32 *)(T))) \ : \ ( \ (attlen) == (int) sizeof(int16) ? \ Int16GetDatum(*((int16 *)(T))) \ : \ ( \ AssertMacro((attlen) == 1), \ CharGetDatum(*((char *)(T))) \ ) \ ) \ ) \ : \ PointerGetDatum((char *) (T)) \ ) #endif /* SIZEOF_DATUM == 8 */ /* * att_align_datum aligns the given offset as needed for a datum of alignment * requirement attalign and typlen attlen. attdatum is the Datum variable * we intend to pack into a tuple (it's only accessed if we are dealing with * a varlena type). Note that this assumes the Datum will be stored as-is; * callers that are intending to convert non-short varlena datums to short * format have to account for that themselves. */ #define att_align_datum(cur_offset, attalign, attlen, attdatum) \ ( \ ((attlen) == -1 && VARATT_IS_SHORT(DatumGetPointer(attdatum))) ? \ (intptr_t) (cur_offset) : \ att_align_nominal(cur_offset, attalign) \ ) /* * att_align_pointer performs the same calculation as att_align_datum, * but is used when walking a tuple. attptr is the current actual data * pointer; when accessing a varlena field we have to "peek" to see if we * are looking at a pad byte or the first byte of a 1-byte-header datum. * (A zero byte must be either a pad byte, or the first byte of a correctly * aligned 4-byte length word; in either case we can align safely. A non-zero * byte must be either a 1-byte length word, or the first byte of a correctly * aligned 4-byte length word; in either case we need not align.) * * Note: some callers pass a "char *" pointer for cur_offset. This is * a bit of a hack but should work all right as long as intptr_t is the * correct width. */ #define att_align_pointer(cur_offset, attalign, attlen, attptr) \ ( \ ((attlen) == -1 && VARATT_NOT_PAD_BYTE(attptr)) ? \ (intptr_t) (cur_offset) : \ att_align_nominal(cur_offset, attalign) \ ) /* * att_align_nominal aligns the given offset as needed for a datum of alignment * requirement attalign, ignoring any consideration of packed varlena datums. * There are three main use cases for using this macro directly: * * we know that the att in question is not varlena (attlen != -1); * in this case it is cheaper than the above macros and just as good. * * we need to estimate alignment padding cost abstractly, ie without * reference to a real tuple. We must assume the worst case that * all varlenas are aligned. * * within arrays, we unconditionally align varlenas (XXX this should be * revisited, probably). * * The attalign cases are tested in what is hopefully something like their * frequency of occurrence. */ #define att_align_nominal(cur_offset, attalign) \ ( \ ((attalign) == 'i') ? INTALIGN(cur_offset) : \ (((attalign) == 'c') ? (intptr_t) (cur_offset) : \ (((attalign) == 'd') ? DOUBLEALIGN(cur_offset) : \ ( \ AssertMacro((attalign) == 's'), \ SHORTALIGN(cur_offset) \ ))) \ ) /* * att_addlength_datum increments the given offset by the space needed for * the given Datum variable. attdatum is only accessed if we are dealing * with a variable-length attribute. */ #define att_addlength_datum(cur_offset, attlen, attdatum) \ att_addlength_pointer(cur_offset, attlen, DatumGetPointer(attdatum)) /* * att_addlength_pointer performs the same calculation as att_addlength_datum, * but is used when walking a tuple --- attptr is the pointer to the field * within the tuple. * * Note: some callers pass a "char *" pointer for cur_offset. This is * actually perfectly OK, but probably should be cleaned up along with * the same practice for att_align_pointer. */ #define att_addlength_pointer(cur_offset, attlen, attptr) \ ( \ ((attlen) > 0) ? \ ( \ (cur_offset) + (attlen) \ ) \ : (((attlen) == -1) ? \ ( \ (cur_offset) + VARSIZE_ANY(attptr) \ ) \ : \ ( \ AssertMacro((attlen) == -2), \ (cur_offset) + (strlen((char *) (attptr)) + 1) \ )) \ ) /* * store_att_byval is a partial inverse of fetch_att: store a given Datum * value into a tuple data area at the specified address. However, it only * handles the byval case, because in typical usage the caller needs to * distinguish by-val and by-ref cases anyway, and so a do-it-all macro * wouldn't be convenient. */ #if SIZEOF_DATUM == 8 #define store_att_byval(T,newdatum,attlen) \ do { \ switch (attlen) \ { \ case sizeof(char): \ *(char *) (T) = DatumGetChar(newdatum); \ break; \ case sizeof(int16): \ *(int16 *) (T) = DatumGetInt16(newdatum); \ break; \ case sizeof(int32): \ *(int32 *) (T) = DatumGetInt32(newdatum); \ break; \ case sizeof(Datum): \ *(Datum *) (T) = (newdatum); \ break; \ default: \ elog(ERROR, "unsupported byval length: %d", \ (int) (attlen)); \ break; \ } \ } while (0) #else /* SIZEOF_DATUM != 8 */ #define store_att_byval(T,newdatum,attlen) \ do { \ switch (attlen) \ { \ case sizeof(char): \ *(char *) (T) = DatumGetChar(newdatum); \ break; \ case sizeof(int16): \ *(int16 *) (T) = DatumGetInt16(newdatum); \ break; \ case sizeof(int32): \ *(int32 *) (T) = DatumGetInt32(newdatum); \ break; \ default: \ elog(ERROR, "unsupported byval length: %d", \ (int) (attlen)); \ break; \ } \ } while (0) #endif /* SIZEOF_DATUM == 8 */ #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/genam.h�������������������������������������������������������������������������0000644�����������������00000016460�14763166026�0011723 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * genam.h * POSTGRES generalized index access method definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/genam.h * *------------------------------------------------------------------------- */ #ifndef GENAM_H #define GENAM_H #include "access/sdir.h" #include "access/skey.h" #include "nodes/tidbitmap.h" #include "storage/lock.h" #include "utils/relcache.h" #include "utils/snapshot.h" /* * Struct for statistics returned by ambuild */ typedef struct IndexBuildResult { double heap_tuples; /* # of tuples seen in parent table */ double index_tuples; /* # of tuples inserted into index */ } IndexBuildResult; /* * Struct for input arguments passed to ambulkdelete and amvacuumcleanup * * num_heap_tuples is accurate only when estimated_count is false; * otherwise it's just an estimate (currently, the estimate is the * prior value of the relation's pg_class.reltuples field). It will * always just be an estimate during ambulkdelete. */ typedef struct IndexVacuumInfo { Relation index; /* the index being vacuumed */ bool analyze_only; /* ANALYZE (without any actual vacuum) */ bool estimated_count; /* num_heap_tuples is an estimate */ int message_level; /* ereport level for progress messages */ double num_heap_tuples; /* tuples remaining in heap */ BufferAccessStrategy strategy; /* access strategy for reads */ } IndexVacuumInfo; /* * Struct for statistics returned by ambulkdelete and amvacuumcleanup * * This struct is normally allocated by the first ambulkdelete call and then * passed along through subsequent ones until amvacuumcleanup; however, * amvacuumcleanup must be prepared to allocate it in the case where no * ambulkdelete calls were made (because no tuples needed deletion). * Note that an index AM could choose to return a larger struct * of which this is just the first field; this provides a way for ambulkdelete * to communicate additional private data to amvacuumcleanup. * * Note: pages_removed is the amount by which the index physically shrank, * if any (ie the change in its total size on disk). pages_deleted and * pages_free refer to free space within the index file. Some index AMs * may compute num_index_tuples by reference to num_heap_tuples, in which * case they should copy the estimated_count field from IndexVacuumInfo. */ typedef struct IndexBulkDeleteResult { BlockNumber num_pages; /* pages remaining in index */ BlockNumber pages_removed; /* # removed during vacuum operation */ bool estimated_count; /* num_index_tuples is an estimate */ double num_index_tuples; /* tuples remaining */ double tuples_removed; /* # removed during vacuum operation */ BlockNumber pages_deleted; /* # unused pages in index */ BlockNumber pages_free; /* # pages available for reuse */ } IndexBulkDeleteResult; /* Typedef for callback function to determine if a tuple is bulk-deletable */ typedef bool (*IndexBulkDeleteCallback) (ItemPointer itemptr, void *state); /* struct definitions appear in relscan.h */ typedef struct IndexScanDescData *IndexScanDesc; typedef struct SysScanDescData *SysScanDesc; /* * Enumeration specifying the type of uniqueness check to perform in * index_insert(). * * UNIQUE_CHECK_YES is the traditional Postgres immediate check, possibly * blocking to see if a conflicting transaction commits. * * For deferrable unique constraints, UNIQUE_CHECK_PARTIAL is specified at * insertion time. The index AM should test if the tuple is unique, but * should not throw error, block, or prevent the insertion if the tuple * appears not to be unique. We'll recheck later when it is time for the * constraint to be enforced. The AM must return true if the tuple is * known unique, false if it is possibly non-unique. In the "true" case * it is safe to omit the later recheck. * * When it is time to recheck the deferred constraint, a pseudo-insertion * call is made with UNIQUE_CHECK_EXISTING. The tuple is already in the * index in this case, so it should not be inserted again. Rather, just * check for conflicting live tuples (possibly blocking). */ typedef enum IndexUniqueCheck { UNIQUE_CHECK_NO, /* Don't do any uniqueness checking */ UNIQUE_CHECK_YES, /* Enforce uniqueness at insertion time */ UNIQUE_CHECK_PARTIAL, /* Test uniqueness, but no error */ UNIQUE_CHECK_EXISTING /* Check if existing tuple is unique */ } IndexUniqueCheck; /* * generalized index_ interface routines (in indexam.c) */ /* * IndexScanIsValid * True iff the index scan is valid. */ #define IndexScanIsValid(scan) PointerIsValid(scan) extern Relation index_open(Oid relationId, LOCKMODE lockmode); extern void index_close(Relation relation, LOCKMODE lockmode); extern bool index_insert(Relation indexRelation, Datum *values, bool *isnull, ItemPointer heap_t_ctid, Relation heapRelation, IndexUniqueCheck checkUnique); extern IndexScanDesc index_beginscan(Relation heapRelation, Relation indexRelation, Snapshot snapshot, int nkeys, int norderbys); extern IndexScanDesc index_beginscan_bitmap(Relation indexRelation, Snapshot snapshot, int nkeys); extern void index_rescan(IndexScanDesc scan, ScanKey keys, int nkeys, ScanKey orderbys, int norderbys); extern void index_endscan(IndexScanDesc scan); extern void index_markpos(IndexScanDesc scan); extern void index_restrpos(IndexScanDesc scan); extern ItemPointer index_getnext_tid(IndexScanDesc scan, ScanDirection direction); extern HeapTuple index_fetch_heap(IndexScanDesc scan); extern HeapTuple index_getnext(IndexScanDesc scan, ScanDirection direction); extern int64 index_getbitmap(IndexScanDesc scan, TIDBitmap *bitmap); extern IndexBulkDeleteResult *index_bulk_delete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback, void *callback_state); extern IndexBulkDeleteResult *index_vacuum_cleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats); extern bool index_can_return(Relation indexRelation); extern RegProcedure index_getprocid(Relation irel, AttrNumber attnum, uint16 procnum); extern FmgrInfo *index_getprocinfo(Relation irel, AttrNumber attnum, uint16 procnum); /* * index access method support routines (in genam.c) */ extern IndexScanDesc RelationGetIndexScan(Relation indexRelation, int nkeys, int norderbys); extern void IndexScanEnd(IndexScanDesc scan); extern char *BuildIndexValueDescription(Relation indexRelation, Datum *values, bool *isnull); /* * heap-or-index access to system catalogs (in genam.c) */ extern SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key); extern HeapTuple systable_getnext(SysScanDesc sysscan); extern bool systable_recheck_tuple(SysScanDesc sysscan, HeapTuple tup); extern void systable_endscan(SysScanDesc sysscan); extern SysScanDesc systable_beginscan_ordered(Relation heapRelation, Relation indexRelation, Snapshot snapshot, int nkeys, ScanKey key); extern HeapTuple systable_getnext_ordered(SysScanDesc sysscan, ScanDirection direction); extern void systable_endscan_ordered(SysScanDesc sysscan); #endif /* GENAM_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/gin.h���������������������������������������������������������������������������0000644�����������������00000003200�14763166026�0011375 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*-------------------------------------------------------------------------- * gin.h * Public header file for Generalized Inverted Index access method. * * Copyright (c) 2006-2012, PostgreSQL Global Development Group * * src/include/access/gin.h *-------------------------------------------------------------------------- */ #ifndef GIN_H #define GIN_H #include "access/xlog.h" #include "storage/block.h" #include "utils/relcache.h" /* * amproc indexes for inverted indexes. */ #define GIN_COMPARE_PROC 1 #define GIN_EXTRACTVALUE_PROC 2 #define GIN_EXTRACTQUERY_PROC 3 #define GIN_CONSISTENT_PROC 4 #define GIN_COMPARE_PARTIAL_PROC 5 #define GINNProcs 5 /* * searchMode settings for extractQueryFn. */ #define GIN_SEARCH_MODE_DEFAULT 0 #define GIN_SEARCH_MODE_INCLUDE_EMPTY 1 #define GIN_SEARCH_MODE_ALL 2 #define GIN_SEARCH_MODE_EVERYTHING 3 /* for internal use only */ /* * GinStatsData represents stats data for planner use */ typedef struct GinStatsData { BlockNumber nPendingPages; BlockNumber nTotalPages; BlockNumber nEntryPages; BlockNumber nDataPages; int64 nEntries; int32 ginVersion; } GinStatsData; /* GUC parameter */ extern PGDLLIMPORT int GinFuzzySearchLimit; /* ginutil.c */ extern void ginGetStats(Relation index, GinStatsData *stats); extern void ginUpdateStats(Relation index, const GinStatsData *stats); /* ginxlog.c */ extern void gin_redo(XLogRecPtr lsn, XLogRecord *record); extern void gin_desc(StringInfo buf, uint8 xl_info, char *rec); extern void gin_xlog_startup(void); extern void gin_xlog_cleanup(void); extern bool gin_safe_restartpoint(void); #endif /* GIN_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/gistscan.h����������������������������������������������������������������������0000644�����������������00000001316�14763166026�0012441 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * gistscan.h * routines defined in access/gist/gistscan.c * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/gistscan.h * *------------------------------------------------------------------------- */ #ifndef GISTSCAN_H #define GISTSCAN_H #include "fmgr.h" extern Datum gistbeginscan(PG_FUNCTION_ARGS); extern Datum gistrescan(PG_FUNCTION_ARGS); extern Datum gistmarkpos(PG_FUNCTION_ARGS); extern Datum gistrestrpos(PG_FUNCTION_ARGS); extern Datum gistendscan(PG_FUNCTION_ARGS); #endif /* GISTSCAN_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/xlog.h��������������������������������������������������������������������������0000644�����������������00000030674�14763166026�0011610 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * xlog.h * * PostgreSQL transaction log manager * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/xlog.h */ #ifndef XLOG_H #define XLOG_H #include "access/rmgr.h" #include "access/xlogdefs.h" #include "datatype/timestamp.h" #include "lib/stringinfo.h" #include "storage/buf.h" #include "utils/pg_crc.h" /* * The overall layout of an XLOG record is: * Fixed-size header (XLogRecord struct) * rmgr-specific data * BkpBlock * backup block data * BkpBlock * backup block data * ... * * where there can be zero to four backup blocks (as signaled by xl_info flag * bits). XLogRecord structs always start on MAXALIGN boundaries in the WAL * files, and we round up SizeOfXLogRecord so that the rmgr data is also * guaranteed to begin on a MAXALIGN boundary. However, no padding is added * to align BkpBlock structs or backup block data. * * NOTE: xl_len counts only the rmgr data, not the XLogRecord header, * and also not any backup blocks. xl_tot_len counts everything. Neither * length field is rounded up to an alignment boundary. */ typedef struct XLogRecord { pg_crc32 xl_crc; /* CRC for this record */ XLogRecPtr xl_prev; /* ptr to previous record in log */ TransactionId xl_xid; /* xact id */ uint32 xl_tot_len; /* total len of entire record */ uint32 xl_len; /* total len of rmgr data */ uint8 xl_info; /* flag bits, see below */ RmgrId xl_rmid; /* resource manager for this record */ /* Depending on MAXALIGN, there are either 2 or 6 wasted bytes here */ /* ACTUAL LOG DATA FOLLOWS AT END OF STRUCT */ } XLogRecord; #define SizeOfXLogRecord MAXALIGN(sizeof(XLogRecord)) #define XLogRecGetData(record) ((char*) (record) + SizeOfXLogRecord) /* * XLOG uses only low 4 bits of xl_info. High 4 bits may be used by rmgr. */ #define XLR_INFO_MASK 0x0F /* * If we backed up any disk blocks with the XLOG record, we use flag bits in * xl_info to signal it. We support backup of up to 4 disk blocks per XLOG * record. */ #define XLR_BKP_BLOCK_MASK 0x0F /* all info bits used for bkp blocks */ #define XLR_MAX_BKP_BLOCKS 4 #define XLR_BKP_BLOCK(iblk) (0x08 >> (iblk)) /* iblk in 0..3 */ /* These macros are deprecated and will be removed in 9.3; use XLR_BKP_BLOCK */ #define XLR_SET_BKP_BLOCK(iblk) (0x08 >> (iblk)) #define XLR_BKP_BLOCK_1 XLR_SET_BKP_BLOCK(0) /* 0x08 */ #define XLR_BKP_BLOCK_2 XLR_SET_BKP_BLOCK(1) /* 0x04 */ #define XLR_BKP_BLOCK_3 XLR_SET_BKP_BLOCK(2) /* 0x02 */ #define XLR_BKP_BLOCK_4 XLR_SET_BKP_BLOCK(3) /* 0x01 */ /* Sync methods */ #define SYNC_METHOD_FSYNC 0 #define SYNC_METHOD_FDATASYNC 1 #define SYNC_METHOD_OPEN 2 /* for O_SYNC */ #define SYNC_METHOD_FSYNC_WRITETHROUGH 3 #define SYNC_METHOD_OPEN_DSYNC 4 /* for O_DSYNC */ extern int sync_method; /* * The rmgr data to be written by XLogInsert() is defined by a chain of * one or more XLogRecData structs. (Multiple structs would be used when * parts of the source data aren't physically adjacent in memory, or when * multiple associated buffers need to be specified.) * * If buffer is valid then XLOG will check if buffer must be backed up * (ie, whether this is first change of that page since last checkpoint). * If so, the whole page contents are attached to the XLOG record, and XLOG * sets XLR_BKP_BLOCK(N) bit in xl_info. Note that the buffer must be pinned * and exclusive-locked by the caller, so that it won't change under us. * NB: when the buffer is backed up, we DO NOT insert the data pointed to by * this XLogRecData struct into the XLOG record, since we assume it's present * in the buffer. Therefore, rmgr redo routines MUST pay attention to * XLR_BKP_BLOCK(N) to know what is actually stored in the XLOG record. * The N'th XLR_BKP_BLOCK bit corresponds to the N'th distinct buffer * value (ignoring InvalidBuffer) appearing in the rdata chain. * * When buffer is valid, caller must set buffer_std to indicate whether the * page uses standard pd_lower/pd_upper header fields. If this is true, then * XLOG is allowed to omit the free space between pd_lower and pd_upper from * the backed-up page image. Note that even when buffer_std is false, the * page MUST have an LSN field as its first eight bytes! * * Note: data can be NULL to indicate no rmgr data associated with this chain * entry. This can be sensible (ie, not a wasted entry) if buffer is valid. * The implication is that the buffer has been changed by the operation being * logged, and so may need to be backed up, but the change can be redone using * only information already present elsewhere in the XLOG entry. */ typedef struct XLogRecData { char *data; /* start of rmgr data to include */ uint32 len; /* length of rmgr data to include */ Buffer buffer; /* buffer associated with data, if any */ bool buffer_std; /* buffer has standard pd_lower/pd_upper */ struct XLogRecData *next; /* next struct in chain, or NULL */ } XLogRecData; extern PGDLLIMPORT TimeLineID ThisTimeLineID; /* current TLI */ /* * Prior to 8.4, all activity during recovery was carried out by the startup * process. This local variable continues to be used in many parts of the * code to indicate actions taken by RecoveryManagers. Other processes that * potentially perform work during recovery should check RecoveryInProgress(). * See XLogCtl notes in xlog.c. */ extern bool InRecovery; /* * Like InRecovery, standbyState is only valid in the startup process. * In all other processes it will have the value STANDBY_DISABLED (so * InHotStandby will read as FALSE). * * In DISABLED state, we're performing crash recovery or hot standby was * disabled in postgresql.conf. * * In INITIALIZED state, we've run InitRecoveryTransactionEnvironment, but * we haven't yet processed a RUNNING_XACTS or shutdown-checkpoint WAL record * to initialize our master-transaction tracking system. * * When the transaction tracking is initialized, we enter the SNAPSHOT_PENDING * state. The tracked information might still be incomplete, so we can't allow * connections yet, but redo functions must update the in-memory state when * appropriate. * * In SNAPSHOT_READY mode, we have full knowledge of transactions that are * (or were) running in the master at the current WAL location. Snapshots * can be taken, and read-only queries can be run. */ typedef enum { STANDBY_DISABLED, STANDBY_INITIALIZED, STANDBY_SNAPSHOT_PENDING, STANDBY_SNAPSHOT_READY } HotStandbyState; extern HotStandbyState standbyState; #define InHotStandby (standbyState >= STANDBY_SNAPSHOT_PENDING) /* * Recovery target type. * Only set during a Point in Time recovery, not when standby_mode = on */ typedef enum { RECOVERY_TARGET_UNSET, RECOVERY_TARGET_XID, RECOVERY_TARGET_TIME, RECOVERY_TARGET_NAME } RecoveryTargetType; extern XLogRecPtr XactLastRecEnd; extern bool reachedConsistency; /* these variables are GUC parameters related to XLOG */ extern int CheckPointSegments; extern int wal_keep_segments; extern int XLOGbuffers; extern int XLogArchiveTimeout; extern bool XLogArchiveMode; extern char *XLogArchiveCommand; extern bool EnableHotStandby; extern bool fullPageWrites; extern bool log_checkpoints; /* WAL levels */ typedef enum WalLevel { WAL_LEVEL_MINIMAL = 0, WAL_LEVEL_ARCHIVE, WAL_LEVEL_HOT_STANDBY } WalLevel; extern int wal_level; #define XLogArchivingActive() (XLogArchiveMode && wal_level >= WAL_LEVEL_ARCHIVE) #define XLogArchiveCommandSet() (XLogArchiveCommand[0] != '\0') /* * Is WAL-logging necessary for archival or log-shipping, or can we skip * WAL-logging if we fsync() the data before committing instead? */ #define XLogIsNeeded() (wal_level >= WAL_LEVEL_ARCHIVE) /* Do we need to WAL-log information required only for Hot Standby? */ #define XLogStandbyInfoActive() (wal_level >= WAL_LEVEL_HOT_STANDBY) #ifdef WAL_DEBUG extern bool XLOG_DEBUG; #endif /* * OR-able request flag bits for checkpoints. The "cause" bits are used only * for logging purposes. Note: the flags must be defined so that it's * sensible to OR together request flags arising from different requestors. */ /* These directly affect the behavior of CreateCheckPoint and subsidiaries */ #define CHECKPOINT_IS_SHUTDOWN 0x0001 /* Checkpoint is for shutdown */ #define CHECKPOINT_END_OF_RECOVERY 0x0002 /* Like shutdown checkpoint, * but issued at end of WAL * recovery */ #define CHECKPOINT_IMMEDIATE 0x0004 /* Do it without delays */ #define CHECKPOINT_FORCE 0x0008 /* Force even if no activity */ /* These are important to RequestCheckpoint */ #define CHECKPOINT_WAIT 0x0010 /* Wait for completion */ /* These indicate the cause of a checkpoint request */ #define CHECKPOINT_CAUSE_XLOG 0x0020 /* XLOG consumption */ #define CHECKPOINT_CAUSE_TIME 0x0040 /* Elapsed time */ #define CHECKPOINT_FLUSH_ALL 0x0080 /* Flush all pages, including those * belonging to unlogged tables */ /* Checkpoint statistics */ typedef struct CheckpointStatsData { TimestampTz ckpt_start_t; /* start of checkpoint */ TimestampTz ckpt_write_t; /* start of flushing buffers */ TimestampTz ckpt_sync_t; /* start of fsyncs */ TimestampTz ckpt_sync_end_t; /* end of fsyncs */ TimestampTz ckpt_end_t; /* end of checkpoint */ int ckpt_bufs_written; /* # of buffers written */ int ckpt_segs_added; /* # of new xlog segments created */ int ckpt_segs_removed; /* # of xlog segments deleted */ int ckpt_segs_recycled; /* # of xlog segments recycled */ int ckpt_sync_rels; /* # of relations synced */ uint64 ckpt_longest_sync; /* Longest sync for one relation */ uint64 ckpt_agg_sync_time; /* The sum of all the individual sync * times, which is not necessarily the * same as the total elapsed time for * the entire sync phase. */ } CheckpointStatsData; extern CheckpointStatsData CheckpointStats; extern XLogRecPtr XLogInsert(RmgrId rmid, uint8 info, XLogRecData *rdata); extern void XLogFlush(XLogRecPtr RecPtr); extern bool XLogBackgroundFlush(void); extern bool XLogNeedsFlush(XLogRecPtr RecPtr); extern int XLogFileInit(uint32 log, uint32 seg, bool *use_existent, bool use_lock); extern int XLogFileOpen(uint32 log, uint32 seg); extern void CheckXLogRemoved(uint32 log, uint32 seg, TimeLineID tli); extern void XLogSetAsyncXactLSN(XLogRecPtr record); extern Buffer RestoreBackupBlock(XLogRecPtr lsn, XLogRecord *record, int block_index, bool get_cleanup_lock, bool keep_buffer); extern void xlog_redo(XLogRecPtr lsn, XLogRecord *record); extern void xlog_desc(StringInfo buf, uint8 xl_info, char *rec); extern void issue_xlog_fsync(int fd, uint32 log, uint32 seg); extern bool RecoveryInProgress(void); extern bool HotStandbyActive(void); extern bool HotStandbyActiveInReplay(void); extern bool XLogInsertAllowed(void); extern void GetXLogReceiptTime(TimestampTz *rtime, bool *fromStream); extern XLogRecPtr GetXLogReplayRecPtr(TimeLineID *targetTLI); extern XLogRecPtr GetStandbyFlushRecPtr(TimeLineID *targetTLI); extern XLogRecPtr GetXLogInsertRecPtr(void); extern XLogRecPtr GetXLogWriteRecPtr(void); extern bool RecoveryIsPaused(void); extern void SetRecoveryPause(bool recoveryPause); extern TimestampTz GetLatestXTime(void); extern TimestampTz GetCurrentChunkReplayStartTime(void); extern void UpdateControlFile(void); extern uint64 GetSystemIdentifier(void); extern Size XLOGShmemSize(void); extern void XLOGShmemInit(void); extern void BootStrapXLOG(void); extern void StartupXLOG(void); extern void ShutdownXLOG(int code, Datum arg); extern void InitXLOGAccess(void); extern void CreateCheckPoint(int flags); extern bool CreateRestartPoint(int flags); extern void XLogPutNextOid(Oid nextOid); extern XLogRecPtr XLogRestorePoint(const char *rpName); extern void UpdateFullPageWrites(void); extern XLogRecPtr GetRedoRecPtr(void); extern XLogRecPtr GetInsertRecPtr(void); extern XLogRecPtr GetFlushRecPtr(void); extern void GetNextXidAndEpoch(TransactionId *xid, uint32 *epoch); extern TimeLineID GetRecoveryTargetTLI(void); extern void RemovePromoteSignalFiles(void); extern bool CheckPromoteSignal(void); extern void WakeupRecovery(void); extern void SetWalWriterSleeping(bool sleeping); /* * Starting/stopping a base backup */ extern XLogRecPtr do_pg_start_backup(const char *backupidstr, bool fast, char **labelfile); extern XLogRecPtr do_pg_stop_backup(char *labelfile, bool waitforarchive); extern void do_pg_abort_backup(void); /* File path names (all relative to $PGDATA) */ #define BACKUP_LABEL_FILE "backup_label" #define BACKUP_LABEL_OLD "backup_label.old" #endif /* XLOG_H */ ��������������������������������������������������������������������pgsql/server/access/heapam.h������������������������������������������������������������������������0000644�����������������00000014375�14763166026�0012072 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * heapam.h * POSTGRES heap access method definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/heapam.h * *------------------------------------------------------------------------- */ #ifndef HEAPAM_H #define HEAPAM_H #include "access/sdir.h" #include "access/skey.h" #include "access/xlog.h" #include "nodes/primnodes.h" #include "storage/lock.h" #include "utils/relcache.h" #include "utils/snapshot.h" /* "options" flag bits for heap_insert */ #define HEAP_INSERT_SKIP_WAL 0x0001 #define HEAP_INSERT_SKIP_FSM 0x0002 typedef struct BulkInsertStateData *BulkInsertState; typedef enum { LockTupleShared, LockTupleExclusive } LockTupleMode; /* ---------------- * function prototypes for heap access method * * heap_create, heap_create_with_catalog, and heap_drop_with_catalog * are declared in catalog/heap.h * ---------------- */ /* in heap/heapam.c */ extern Relation relation_open(Oid relationId, LOCKMODE lockmode); extern Relation try_relation_open(Oid relationId, LOCKMODE lockmode); extern Relation relation_openrv(const RangeVar *relation, LOCKMODE lockmode); extern Relation relation_openrv_extended(const RangeVar *relation, LOCKMODE lockmode, bool missing_ok); extern void relation_close(Relation relation, LOCKMODE lockmode); extern Relation heap_open(Oid relationId, LOCKMODE lockmode); extern Relation heap_openrv(const RangeVar *relation, LOCKMODE lockmode); extern Relation heap_openrv_extended(const RangeVar *relation, LOCKMODE lockmode, bool missing_ok); #define heap_close(r,l) relation_close(r,l) /* struct definition appears in relscan.h */ typedef struct HeapScanDescData *HeapScanDesc; /* * HeapScanIsValid * True iff the heap scan is valid. */ #define HeapScanIsValid(scan) PointerIsValid(scan) extern HeapScanDesc heap_beginscan(Relation relation, Snapshot snapshot, int nkeys, ScanKey key); extern HeapScanDesc heap_beginscan_strat(Relation relation, Snapshot snapshot, int nkeys, ScanKey key, bool allow_strat, bool allow_sync); extern HeapScanDesc heap_beginscan_bm(Relation relation, Snapshot snapshot, int nkeys, ScanKey key); extern void heap_rescan(HeapScanDesc scan, ScanKey key); extern void heap_endscan(HeapScanDesc scan); extern HeapTuple heap_getnext(HeapScanDesc scan, ScanDirection direction); extern bool heap_fetch(Relation relation, Snapshot snapshot, HeapTuple tuple, Buffer *userbuf, bool keep_buf, Relation stats_relation); extern bool heap_hot_search_buffer(ItemPointer tid, Relation relation, Buffer buffer, Snapshot snapshot, HeapTuple heapTuple, bool *all_dead, bool first_call); extern bool heap_hot_search(ItemPointer tid, Relation relation, Snapshot snapshot, bool *all_dead); extern void heap_get_latest_tid(Relation relation, Snapshot snapshot, ItemPointer tid); extern void setLastTid(const ItemPointer tid); extern BulkInsertState GetBulkInsertState(void); extern void FreeBulkInsertState(BulkInsertState); extern Oid heap_insert(Relation relation, HeapTuple tup, CommandId cid, int options, BulkInsertState bistate); extern void heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples, CommandId cid, int options, BulkInsertState bistate); extern HTSU_Result heap_delete(Relation relation, ItemPointer tid, ItemPointer ctid, TransactionId *update_xmax, CommandId cid, Snapshot crosscheck, bool wait); extern HTSU_Result heap_update(Relation relation, ItemPointer otid, HeapTuple newtup, ItemPointer ctid, TransactionId *update_xmax, CommandId cid, Snapshot crosscheck, bool wait); extern HTSU_Result heap_lock_tuple(Relation relation, HeapTuple tuple, Buffer *buffer, ItemPointer ctid, TransactionId *update_xmax, CommandId cid, LockTupleMode mode, bool nowait); extern void heap_inplace_update(Relation relation, HeapTuple tuple); extern bool heap_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid); extern bool heap_tuple_needs_freeze(HeapTupleHeader tuple, TransactionId cutoff_xid, Buffer buf); extern Oid simple_heap_insert(Relation relation, HeapTuple tup); extern void simple_heap_delete(Relation relation, ItemPointer tid); extern void simple_heap_update(Relation relation, ItemPointer otid, HeapTuple tup); extern void heap_markpos(HeapScanDesc scan); extern void heap_restrpos(HeapScanDesc scan); extern void heap_sync(Relation relation); extern void heap_redo(XLogRecPtr lsn, XLogRecord *rptr); extern void heap_desc(StringInfo buf, uint8 xl_info, char *rec); extern void heap2_redo(XLogRecPtr lsn, XLogRecord *rptr); extern void heap2_desc(StringInfo buf, uint8 xl_info, char *rec); extern XLogRecPtr log_heap_cleanup_info(RelFileNode rnode, TransactionId latestRemovedXid); extern XLogRecPtr log_heap_clean(Relation reln, Buffer buffer, OffsetNumber *redirected, int nredirected, OffsetNumber *nowdead, int ndead, OffsetNumber *nowunused, int nunused, TransactionId latestRemovedXid); extern XLogRecPtr log_heap_freeze(Relation reln, Buffer buffer, TransactionId cutoff_xid, OffsetNumber *offsets, int offcnt); extern XLogRecPtr log_heap_visible(RelFileNode rnode, BlockNumber block, Buffer vm_buffer, TransactionId cutoff_xid); extern XLogRecPtr log_newpage(RelFileNode *rnode, ForkNumber forkNum, BlockNumber blk, Page page); extern XLogRecPtr log_newpage_buffer(Buffer buffer); /* in heap/pruneheap.c */ extern void heap_page_prune_opt(Relation relation, Buffer buffer, TransactionId OldestXmin); extern int heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin, bool report_stats, TransactionId *latestRemovedXid); extern void heap_page_prune_execute(Buffer buffer, OffsetNumber *redirected, int nredirected, OffsetNumber *nowdead, int ndead, OffsetNumber *nowunused, int nunused); extern void heap_get_root_tuples(Page page, OffsetNumber *root_offsets); /* in heap/syncscan.c */ extern void ss_report_location(Relation rel, BlockNumber location); extern BlockNumber ss_get_location(Relation rel, BlockNumber relnblocks); extern void SyncScanShmemInit(void); extern Size SyncScanShmemSize(void); #endif /* HEAPAM_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/clog.h��������������������������������������������������������������������������0000644�����������������00000002744�14763166026�0011560 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * clog.h * * PostgreSQL transaction-commit-log manager * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/clog.h */ #ifndef CLOG_H #define CLOG_H #include "access/xlog.h" /* * Possible transaction statuses --- note that all-zeroes is the initial * state. * * A "subcommitted" transaction is a committed subtransaction whose parent * hasn't committed or aborted yet. */ typedef int XidStatus; #define TRANSACTION_STATUS_IN_PROGRESS 0x00 #define TRANSACTION_STATUS_COMMITTED 0x01 #define TRANSACTION_STATUS_ABORTED 0x02 #define TRANSACTION_STATUS_SUB_COMMITTED 0x03 extern void TransactionIdSetTreeStatus(TransactionId xid, int nsubxids, TransactionId *subxids, XidStatus status, XLogRecPtr lsn); extern XidStatus TransactionIdGetStatus(TransactionId xid, XLogRecPtr *lsn); extern Size CLOGShmemBuffers(void); extern Size CLOGShmemSize(void); extern void CLOGShmemInit(void); extern void BootStrapCLOG(void); extern void StartupCLOG(void); extern void TrimCLOG(void); extern void ShutdownCLOG(void); extern void CheckPointCLOG(void); extern void ExtendCLOG(TransactionId newestXact); extern void TruncateCLOG(TransactionId oldestXact); /* XLOG stuff */ #define CLOG_ZEROPAGE 0x00 #define CLOG_TRUNCATE 0x10 extern void clog_redo(XLogRecPtr lsn, XLogRecord *record); extern void clog_desc(StringInfo buf, uint8 xl_info, char *rec); #endif /* CLOG_H */ ����������������������������pgsql/server/access/relscan.h�����������������������������������������������������������������������0000644�����������������00000010110�14763166026�0012245 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * relscan.h * POSTGRES relation scan descriptor definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/relscan.h * *------------------------------------------------------------------------- */ #ifndef RELSCAN_H #define RELSCAN_H #include "access/genam.h" #include "access/heapam.h" #include "access/itup.h" #include "access/tupdesc.h" typedef struct HeapScanDescData { /* scan parameters */ Relation rs_rd; /* heap relation descriptor */ Snapshot rs_snapshot; /* snapshot to see */ int rs_nkeys; /* number of scan keys */ ScanKey rs_key; /* array of scan key descriptors */ bool rs_bitmapscan; /* true if this is really a bitmap scan */ bool rs_pageatatime; /* verify visibility page-at-a-time? */ bool rs_allow_strat; /* allow or disallow use of access strategy */ bool rs_allow_sync; /* allow or disallow use of syncscan */ /* state set up at initscan time */ BlockNumber rs_nblocks; /* number of blocks to scan */ BlockNumber rs_startblock; /* block # to start at */ BufferAccessStrategy rs_strategy; /* access strategy for reads */ bool rs_syncscan; /* report location to syncscan logic? */ /* scan current state */ bool rs_inited; /* false = scan not init'd yet */ HeapTupleData rs_ctup; /* current tuple in scan, if any */ BlockNumber rs_cblock; /* current block # in scan, if any */ Buffer rs_cbuf; /* current buffer in scan, if any */ /* NB: if rs_cbuf is not InvalidBuffer, we hold a pin on that buffer */ ItemPointerData rs_mctid; /* marked scan position, if any */ /* these fields only used in page-at-a-time mode and for bitmap scans */ int rs_cindex; /* current tuple's index in vistuples */ int rs_mindex; /* marked tuple's saved index */ int rs_ntuples; /* number of visible tuples on page */ OffsetNumber rs_vistuples[MaxHeapTuplesPerPage]; /* their offsets */ } HeapScanDescData; /* * We use the same IndexScanDescData structure for both amgettuple-based * and amgetbitmap-based index scans. Some fields are only relevant in * amgettuple-based scans. */ typedef struct IndexScanDescData { /* scan parameters */ Relation heapRelation; /* heap relation descriptor, or NULL */ Relation indexRelation; /* index relation descriptor */ Snapshot xs_snapshot; /* snapshot to see */ int numberOfKeys; /* number of index qualifier conditions */ int numberOfOrderBys; /* number of ordering operators */ ScanKey keyData; /* array of index qualifier descriptors */ ScanKey orderByData; /* array of ordering op descriptors */ bool xs_want_itup; /* caller requests index tuples */ /* signaling to index AM about killing index tuples */ bool kill_prior_tuple; /* last-returned tuple is dead */ bool ignore_killed_tuples; /* do not return killed entries */ bool xactStartedInRecovery; /* prevents killing/seeing killed * tuples */ /* index access method's private state */ void *opaque; /* access-method-specific info */ /* in an index-only scan, this is valid after a successful amgettuple */ IndexTuple xs_itup; /* index tuple returned by AM */ TupleDesc xs_itupdesc; /* rowtype descriptor of xs_itup */ /* xs_ctup/xs_cbuf/xs_recheck are valid after a successful index_getnext */ HeapTupleData xs_ctup; /* current heap tuple, if any */ Buffer xs_cbuf; /* current heap buffer in scan, if any */ /* NB: if xs_cbuf is not InvalidBuffer, we hold a pin on that buffer */ bool xs_recheck; /* T means scan keys must be rechecked */ /* state data for traversing HOT chains in index_getnext */ bool xs_continue_hot; /* T if must keep walking HOT chain */ } IndexScanDescData; /* Struct for heap-or-index scans of system tables */ typedef struct SysScanDescData { Relation heap_rel; /* catalog being scanned */ Relation irel; /* NULL if doing heap scan */ HeapScanDesc scan; /* only valid in heap-scan case */ IndexScanDesc iscan; /* only valid in index-scan case */ } SysScanDescData; #endif /* RELSCAN_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/hio.h���������������������������������������������������������������������������0000644�����������������00000002400�14763166026�0011400 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * hio.h * POSTGRES heap access method input/output definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/hio.h * *------------------------------------------------------------------------- */ #ifndef HIO_H #define HIO_H #include "access/heapam.h" #include "access/htup.h" #include "utils/relcache.h" #include "storage/buf.h" /* * state for bulk inserts --- private to heapam.c and hio.c * * If current_buf isn't InvalidBuffer, then we are holding an extra pin * on that buffer. * * "typedef struct BulkInsertStateData *BulkInsertState" is in heapam.h */ typedef struct BulkInsertStateData { BufferAccessStrategy strategy; /* our BULKWRITE strategy object */ Buffer current_buf; /* current insertion target page */ } BulkInsertStateData; extern void RelationPutHeapTuple(Relation relation, Buffer buffer, HeapTuple tuple); extern Buffer RelationGetBufferForTuple(Relation relation, Size len, Buffer otherBuffer, int options, BulkInsertState bistate, Buffer *vmbuffer, Buffer *vmbuffer_other); #endif /* HIO_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/reloptions.h��������������������������������������������������������������������0000644�����������������00000021156�14763166026�0013030 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * reloptions.h * Core support for relation and tablespace options (pg_class.reloptions * and pg_tablespace.spcoptions) * * Note: the functions dealing with text-array reloptions values declare * them as Datum, not ArrayType *, to avoid needing to include array.h * into a lot of low-level code. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/reloptions.h * *------------------------------------------------------------------------- */ #ifndef RELOPTIONS_H #define RELOPTIONS_H #include "access/htup.h" #include "nodes/pg_list.h" /* types supported by reloptions */ typedef enum relopt_type { RELOPT_TYPE_BOOL, RELOPT_TYPE_INT, RELOPT_TYPE_REAL, RELOPT_TYPE_STRING } relopt_type; /* kinds supported by reloptions */ typedef enum relopt_kind { RELOPT_KIND_HEAP = (1 << 0), RELOPT_KIND_TOAST = (1 << 1), RELOPT_KIND_BTREE = (1 << 2), RELOPT_KIND_HASH = (1 << 3), RELOPT_KIND_GIN = (1 << 4), RELOPT_KIND_GIST = (1 << 5), RELOPT_KIND_ATTRIBUTE = (1 << 6), RELOPT_KIND_TABLESPACE = (1 << 7), RELOPT_KIND_SPGIST = (1 << 8), RELOPT_KIND_VIEW = (1 << 9), /* if you add a new kind, make sure you update "last_default" too */ RELOPT_KIND_LAST_DEFAULT = RELOPT_KIND_VIEW, /* some compilers treat enums as signed ints, so we can't use 1 << 31 */ RELOPT_KIND_MAX = (1 << 30) } relopt_kind; /* reloption namespaces allowed for heaps -- currently only TOAST */ #define HEAP_RELOPT_NAMESPACES { "toast", NULL } /* generic struct to hold shared data */ typedef struct relopt_gen { const char *name; /* must be first (used as list termination * marker) */ const char *desc; bits32 kinds; int namelen; relopt_type type; } relopt_gen; /* holds a parsed value */ typedef struct relopt_value { relopt_gen *gen; bool isset; union { bool bool_val; int int_val; double real_val; char *string_val; /* allocated separately */ } values; } relopt_value; /* reloptions records for specific variable types */ typedef struct relopt_bool { relopt_gen gen; bool default_val; } relopt_bool; typedef struct relopt_int { relopt_gen gen; int default_val; int min; int max; } relopt_int; typedef struct relopt_real { relopt_gen gen; double default_val; double min; double max; } relopt_real; /* validation routines for strings */ typedef void (*validate_string_relopt) (char *value); typedef struct relopt_string { relopt_gen gen; int default_len; bool default_isnull; validate_string_relopt validate_cb; char *default_val; } relopt_string; /* This is the table datatype for fillRelOptions */ typedef struct { const char *optname; /* option's name */ relopt_type opttype; /* option's datatype */ int offset; /* offset of field in result struct */ } relopt_parse_elt; /* * These macros exist for the convenience of amoptions writers (but consider * using fillRelOptions, which is a lot simpler). Beware of multiple * evaluation of arguments! * * The last argument in the HANDLE_*_RELOPTION macros allows the caller to * determine whether the option was set (true), or its value acquired from * defaults (false); it can be passed as (char *) NULL if the caller does not * need this information. * * optname is the option name (a string), var is the variable * on which the value should be stored (e.g. StdRdOptions->fillfactor), and * option is a relopt_value pointer. * * The normal way to use this is to loop on the relopt_value array returned by * parseRelOptions: * for (i = 0; options[i].gen->name; i++) * { * if (HAVE_RELOPTION("fillfactor", options[i]) * { * HANDLE_INT_RELOPTION("fillfactor", rdopts->fillfactor, options[i], &isset); * continue; * } * if (HAVE_RELOPTION("default_row_acl", options[i]) * { * ... * } * ... * if (validate) * ereport(ERROR, * (errmsg("unknown option"))); * } * * Note that this is more or less the same that fillRelOptions does, so only * use this if you need to do something non-standard within some option's * code block. */ #define HAVE_RELOPTION(optname, option) \ (pg_strncasecmp(option.gen->name, optname, option.gen->namelen + 1) == 0) #define HANDLE_INT_RELOPTION(optname, var, option, wasset) \ do { \ if (option.isset) \ var = option.values.int_val; \ else \ var = ((relopt_int *) option.gen)->default_val; \ (wasset) != NULL ? *(wasset) = option.isset : (dummyret)NULL; \ } while (0) #define HANDLE_BOOL_RELOPTION(optname, var, option, wasset) \ do { \ if (option.isset) \ var = option.values.bool_val; \ else \ var = ((relopt_bool *) option.gen)->default_val; \ (wasset) != NULL ? *(wasset) = option.isset : (dummyret) NULL; \ } while (0) #define HANDLE_REAL_RELOPTION(optname, var, option, wasset) \ do { \ if (option.isset) \ var = option.values.real_val; \ else \ var = ((relopt_real *) option.gen)->default_val; \ (wasset) != NULL ? *(wasset) = option.isset : (dummyret) NULL; \ } while (0) /* * Note that this assumes that the variable is already allocated at the tail of * reloptions structure (StdRdOptions or equivalent). * * "base" is a pointer to the reloptions structure, and "offset" is an integer * variable that must be initialized to sizeof(reloptions structure). This * struct must have been allocated with enough space to hold any string option * present, including terminating \0 for every option. SET_VARSIZE() must be * called on the struct with this offset as the second argument, after all the * string options have been processed. */ #define HANDLE_STRING_RELOPTION(optname, var, option, base, offset, wasset) \ do { \ relopt_string *optstring = (relopt_string *) option.gen;\ char *string_val; \ if (option.isset) \ string_val = option.values.string_val; \ else if (!optstring->default_isnull) \ string_val = optstring->default_val; \ else \ string_val = NULL; \ (wasset) != NULL ? *(wasset) = option.isset : (dummyret) NULL; \ if (string_val == NULL) \ var = 0; \ else \ { \ strcpy(((char *)(base)) + (offset), string_val); \ var = (offset); \ (offset) += strlen(string_val) + 1; \ } \ } while (0) /* * For use during amoptions: get the strlen of a string option * (either default or the user defined value) */ #define GET_STRING_RELOPTION_LEN(option) \ ((option).isset ? strlen((option).values.string_val) : \ ((relopt_string *) (option).gen)->default_len) /* * For use by code reading options already parsed: get a pointer to the string * value itself. "optstruct" is the StdRdOption struct or equivalent, "member" * is the struct member corresponding to the string option */ #define GET_STRING_RELOPTION(optstruct, member) \ ((optstruct)->member == 0 ? NULL : \ (char *)(optstruct) + (optstruct)->member) extern relopt_kind add_reloption_kind(void); extern void add_bool_reloption(bits32 kinds, char *name, char *desc, bool default_val); extern void add_int_reloption(bits32 kinds, char *name, char *desc, int default_val, int min_val, int max_val); extern void add_real_reloption(bits32 kinds, char *name, char *desc, double default_val, double min_val, double max_val); extern void add_string_reloption(bits32 kinds, char *name, char *desc, char *default_val, validate_string_relopt validator); extern Datum transformRelOptions(Datum oldOptions, List *defList, char *namspace, char *validnsps[], bool ignoreOids, bool isReset); extern List *untransformRelOptions(Datum options); extern bytea *extractRelOptions(HeapTuple tuple, TupleDesc tupdesc, Oid amoptions); extern relopt_value *parseRelOptions(Datum options, bool validate, relopt_kind kind, int *numrelopts); extern void *allocateReloptStruct(Size base, relopt_value *options, int numoptions); extern void fillRelOptions(void *rdopts, Size basesize, relopt_value *options, int numoptions, bool validate, const relopt_parse_elt *elems, int nelems); extern bytea *default_reloptions(Datum reloptions, bool validate, relopt_kind kind); extern bytea *heap_reloptions(char relkind, Datum reloptions, bool validate); extern bytea *index_reloptions(RegProcedure amoptions, Datum reloptions, bool validate); extern bytea *attribute_reloptions(Datum reloptions, bool validate); extern bytea *tablespace_reloptions(Datum reloptions, bool validate); #endif /* RELOPTIONS_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/skey.h��������������������������������������������������������������������������0000644�����������������00000015573�14763166026�0011613 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * skey.h * POSTGRES scan key definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/skey.h * *------------------------------------------------------------------------- */ #ifndef SKEY_H #define SKEY_H #include "access/attnum.h" #include "fmgr.h" /* * Strategy numbers identify the semantics that particular operators have * with respect to particular operator classes. In some cases a strategy * subtype (an OID) is used as further information. */ typedef uint16 StrategyNumber; #define InvalidStrategy ((StrategyNumber) 0) /* * We define the strategy numbers for B-tree indexes here, to avoid having * to import access/nbtree.h into a lot of places that shouldn't need it. */ #define BTLessStrategyNumber 1 #define BTLessEqualStrategyNumber 2 #define BTEqualStrategyNumber 3 #define BTGreaterEqualStrategyNumber 4 #define BTGreaterStrategyNumber 5 #define BTMaxStrategyNumber 5 /* * A ScanKey represents the application of a comparison operator between * a table or index column and a constant. When it's part of an array of * ScanKeys, the comparison conditions are implicitly ANDed. The index * column is the left argument of the operator, if it's a binary operator. * (The data structure can support unary indexable operators too; in that * case sk_argument would go unused. This is not currently implemented.) * * For an index scan, sk_strategy and sk_subtype must be set correctly for * the operator. When using a ScanKey in a heap scan, these fields are not * used and may be set to InvalidStrategy/InvalidOid. * * If the operator is collation-sensitive, sk_collation must be set * correctly as well. * * A ScanKey can also represent a ScalarArrayOpExpr, that is a condition * "column op ANY(ARRAY[...])". This is signaled by the SK_SEARCHARRAY * flag bit. The sk_argument is not a value of the operator's right-hand * argument type, but rather an array of such values, and the per-element * comparisons are to be ORed together. * * A ScanKey can also represent a condition "column IS NULL" or "column * IS NOT NULL"; these cases are signaled by the SK_SEARCHNULL and * SK_SEARCHNOTNULL flag bits respectively. The argument is always NULL, * and the sk_strategy, sk_subtype, sk_collation, and sk_func fields are * not used (unless set by the index AM). * * SK_SEARCHARRAY, SK_SEARCHNULL and SK_SEARCHNOTNULL are supported only * for index scans, not heap scans; and not all index AMs support them, * only those that set amsearcharray or amsearchnulls respectively. * * A ScanKey can also represent an ordering operator invocation, that is * an ordering requirement "ORDER BY indexedcol op constant". This looks * the same as a comparison operator, except that the operator doesn't * (usually) yield boolean. We mark such ScanKeys with SK_ORDER_BY. * SK_SEARCHARRAY, SK_SEARCHNULL, SK_SEARCHNOTNULL cannot be used here. * * Note: in some places, ScanKeys are used as a convenient representation * for the invocation of an access method support procedure. In this case * sk_strategy/sk_subtype are not meaningful (but sk_collation can be); and * sk_func may refer to a function that returns something other than boolean. */ typedef struct ScanKeyData { int sk_flags; /* flags, see below */ AttrNumber sk_attno; /* table or index column number */ StrategyNumber sk_strategy; /* operator strategy number */ Oid sk_subtype; /* strategy subtype */ Oid sk_collation; /* collation to use, if needed */ FmgrInfo sk_func; /* lookup info for function to call */ Datum sk_argument; /* data to compare */ } ScanKeyData; typedef ScanKeyData *ScanKey; /* * About row comparisons: * * The ScanKey data structure also supports row comparisons, that is ordered * tuple comparisons like (x, y) > (c1, c2), having the SQL-spec semantics * "x > c1 OR (x = c1 AND y > c2)". Note that this is currently only * implemented for btree index searches, not for heapscans or any other index * type. A row comparison is represented by a "header" ScanKey entry plus * a separate array of ScanKeys, one for each column of the row comparison. * The header entry has these properties: * sk_flags = SK_ROW_HEADER * sk_attno = index column number for leading column of row comparison * sk_strategy = btree strategy code for semantics of row comparison * (ie, < <= > or >=) * sk_subtype, sk_collation, sk_func: not used * sk_argument: pointer to subsidiary ScanKey array * If the header is part of a ScanKey array that's sorted by attno, it * must be sorted according to the leading column number. * * The subsidiary ScanKey array appears in logical column order of the row * comparison, which may be different from index column order. The array * elements are like a normal ScanKey array except that: * sk_flags must include SK_ROW_MEMBER, plus SK_ROW_END in the last * element (needed since row header does not include a count) * sk_func points to the btree comparison support function for the * opclass, NOT the operator's implementation function. * sk_strategy must be the same in all elements of the subsidiary array, * that is, the same as in the header entry. * SK_SEARCHARRAY, SK_SEARCHNULL, SK_SEARCHNOTNULL cannot be used here. */ /* * ScanKeyData sk_flags * * sk_flags bits 0-15 are reserved for system-wide use (symbols for those * bits should be defined here). Bits 16-31 are reserved for use within * individual index access methods. */ #define SK_ISNULL 0x0001 /* sk_argument is NULL */ #define SK_UNARY 0x0002 /* unary operator (not supported!) */ #define SK_ROW_HEADER 0x0004 /* row comparison header (see above) */ #define SK_ROW_MEMBER 0x0008 /* row comparison member (see above) */ #define SK_ROW_END 0x0010 /* last row comparison member */ #define SK_SEARCHARRAY 0x0020 /* scankey represents ScalarArrayOp */ #define SK_SEARCHNULL 0x0040 /* scankey represents "col IS NULL" */ #define SK_SEARCHNOTNULL 0x0080 /* scankey represents "col IS NOT * NULL" */ #define SK_ORDER_BY 0x0100 /* scankey is for ORDER BY op */ /* * prototypes for functions in access/common/scankey.c */ extern void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument); extern void ScanKeyEntryInitialize(ScanKey entry, int flags, AttrNumber attributeNumber, StrategyNumber strategy, Oid subtype, Oid collation, RegProcedure procedure, Datum argument); extern void ScanKeyEntryInitializeWithInfo(ScanKey entry, int flags, AttrNumber attributeNumber, StrategyNumber strategy, Oid subtype, Oid collation, FmgrInfo *finfo, Datum argument); #endif /* SKEY_H */ �������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/sysattr.h�����������������������������������������������������������������������0000644�����������������00000001573�14763166026�0012344 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * sysattr.h * POSTGRES system attribute definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/sysattr.h * *------------------------------------------------------------------------- */ #ifndef SYSATTR_H #define SYSATTR_H /* * Attribute numbers for the system-defined attributes */ #define SelfItemPointerAttributeNumber (-1) #define ObjectIdAttributeNumber (-2) #define MinTransactionIdAttributeNumber (-3) #define MinCommandIdAttributeNumber (-4) #define MaxTransactionIdAttributeNumber (-5) #define MaxCommandIdAttributeNumber (-6) #define TableOidAttributeNumber (-7) #define FirstLowInvalidHeapAttributeNumber (-8) #endif /* SYSATTR_H */ �������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/visibilitymap.h�����������������������������������������������������������������0000644�����������������00000002232�14763166026�0013511 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * visibilitymap.h * visibility map interface * * * Portions Copyright (c) 2007-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/visibilitymap.h * *------------------------------------------------------------------------- */ #ifndef VISIBILITYMAP_H #define VISIBILITYMAP_H #include "access/xlogdefs.h" #include "storage/block.h" #include "storage/buf.h" #include "utils/relcache.h" extern void visibilitymap_clear(Relation rel, BlockNumber heapBlk, Buffer vmbuf); extern void visibilitymap_pin(Relation rel, BlockNumber heapBlk, Buffer *vmbuf); extern bool visibilitymap_pin_ok(BlockNumber heapBlk, Buffer vmbuf); extern void visibilitymap_set(Relation rel, BlockNumber heapBlk, XLogRecPtr recptr, Buffer vmbuf, TransactionId cutoff_xid); extern bool visibilitymap_test(Relation rel, BlockNumber heapBlk, Buffer *vmbuf); extern BlockNumber visibilitymap_count(Relation rel); extern void visibilitymap_truncate(Relation rel, BlockNumber nheapblocks); #endif /* VISIBILITYMAP_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/rmgr.h��������������������������������������������������������������������������0000644�����������������00000001444�14763166026�0011577 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * rmgr.h * * Resource managers definition * * src/include/access/rmgr.h */ #ifndef RMGR_H #define RMGR_H typedef uint8 RmgrId; /* * Built-in resource managers * * Note: RM_MAX_ID could be as much as 255 without breaking the XLOG file * format, but we keep it small to minimize the size of RmgrTable[]. */ #define RM_XLOG_ID 0 #define RM_XACT_ID 1 #define RM_SMGR_ID 2 #define RM_CLOG_ID 3 #define RM_DBASE_ID 4 #define RM_TBLSPC_ID 5 #define RM_MULTIXACT_ID 6 #define RM_RELMAP_ID 7 #define RM_STANDBY_ID 8 #define RM_HEAP2_ID 9 #define RM_HEAP_ID 10 #define RM_BTREE_ID 11 #define RM_HASH_ID 12 #define RM_GIN_ID 13 #define RM_GIST_ID 14 #define RM_SEQ_ID 15 #define RM_SPGIST_ID 16 #define RM_MAX_ID RM_SPGIST_ID #endif /* RMGR_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/hash.h��������������������������������������������������������������������������0000644�����������������00000031572�14763166026�0011560 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * hash.h * header file for postgres hash access method implementation * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/hash.h * * NOTES * modeled after Margo Seltzer's hash implementation for unix. * *------------------------------------------------------------------------- */ #ifndef HASH_H #define HASH_H #include "access/genam.h" #include "access/itup.h" #include "access/sdir.h" #include "access/xlog.h" #include "fmgr.h" #include "storage/bufmgr.h" #include "storage/lock.h" #include "utils/relcache.h" /* * Mapping from hash bucket number to physical block number of bucket's * starting page. Beware of multiple evaluations of argument! */ typedef uint32 Bucket; #define BUCKET_TO_BLKNO(metap,B) \ ((BlockNumber) ((B) + ((B) ? (metap)->hashm_spares[_hash_log2((B)+1)-1] : 0)) + 1) /* * Special space for hash index pages. * * hasho_flag tells us which type of page we're looking at. For * example, knowing overflow pages from bucket pages is necessary * information when you're deleting tuples from a page. If all the * tuples are deleted from an overflow page, the overflow is made * available to other buckets by calling _hash_freeovflpage(). If all * the tuples are deleted from a bucket page, no additional action is * necessary. */ #define LH_UNUSED_PAGE (0) #define LH_OVERFLOW_PAGE (1 << 0) #define LH_BUCKET_PAGE (1 << 1) #define LH_BITMAP_PAGE (1 << 2) #define LH_META_PAGE (1 << 3) typedef struct HashPageOpaqueData { BlockNumber hasho_prevblkno; /* previous ovfl (or bucket) blkno */ BlockNumber hasho_nextblkno; /* next ovfl blkno */ Bucket hasho_bucket; /* bucket number this pg belongs to */ uint16 hasho_flag; /* page type code, see above */ uint16 hasho_page_id; /* for identification of hash indexes */ } HashPageOpaqueData; typedef HashPageOpaqueData *HashPageOpaque; /* * The page ID is for the convenience of pg_filedump and similar utilities, * which otherwise would have a hard time telling pages of different index * types apart. It should be the last 2 bytes on the page. This is more or * less "free" due to alignment considerations. */ #define HASHO_PAGE_ID 0xFF80 /* * HashScanOpaqueData is private state for a hash index scan. */ typedef struct HashScanOpaqueData { /* Hash value of the scan key, ie, the hash key we seek */ uint32 hashso_sk_hash; /* * By definition, a hash scan should be examining only one bucket. We * record the bucket number here as soon as it is known. */ Bucket hashso_bucket; bool hashso_bucket_valid; /* * If we have a share lock on the bucket, we record it here. When * hashso_bucket_blkno is zero, we have no such lock. */ BlockNumber hashso_bucket_blkno; /* * We also want to remember which buffer we're currently examining in the * scan. We keep the buffer pinned (but not locked) across hashgettuple * calls, in order to avoid doing a ReadBuffer() for every tuple in the * index. */ Buffer hashso_curbuf; /* Current position of the scan, as an index TID */ ItemPointerData hashso_curpos; /* Current position of the scan, as a heap TID */ ItemPointerData hashso_heappos; } HashScanOpaqueData; typedef HashScanOpaqueData *HashScanOpaque; /* * Definitions for metapage. */ #define HASH_METAPAGE 0 /* metapage is always block 0 */ #define HASH_MAGIC 0x6440640 #define HASH_VERSION 2 /* 2 signifies only hash key value is stored */ /* * Spares[] holds the number of overflow pages currently allocated at or * before a certain splitpoint. For example, if spares[3] = 7 then there are * 7 ovflpages before splitpoint 3 (compare BUCKET_TO_BLKNO macro). The * value in spares[ovflpoint] increases as overflow pages are added at the * end of the index. Once ovflpoint increases (ie, we have actually allocated * the bucket pages belonging to that splitpoint) the number of spares at the * prior splitpoint cannot change anymore. * * ovflpages that have been recycled for reuse can be found by looking at * bitmaps that are stored within ovflpages dedicated for the purpose. * The blknos of these bitmap pages are kept in bitmaps[]; nmaps is the * number of currently existing bitmaps. * * The limitation on the size of spares[] comes from the fact that there's * no point in having more than 2^32 buckets with only uint32 hashcodes. * There is no particular upper limit on the size of mapp[], other than * needing to fit into the metapage. (With 8K block size, 128 bitmaps * limit us to 64 Gb of overflow space...) */ #define HASH_MAX_SPLITPOINTS 32 #define HASH_MAX_BITMAPS 128 typedef struct HashMetaPageData { uint32 hashm_magic; /* magic no. for hash tables */ uint32 hashm_version; /* version ID */ double hashm_ntuples; /* number of tuples stored in the table */ uint16 hashm_ffactor; /* target fill factor (tuples/bucket) */ uint16 hashm_bsize; /* index page size (bytes) */ uint16 hashm_bmsize; /* bitmap array size (bytes) - must be a power * of 2 */ uint16 hashm_bmshift; /* log2(bitmap array size in BITS) */ uint32 hashm_maxbucket; /* ID of maximum bucket in use */ uint32 hashm_highmask; /* mask to modulo into entire table */ uint32 hashm_lowmask; /* mask to modulo into lower half of table */ uint32 hashm_ovflpoint;/* splitpoint from which ovflpgs being * allocated */ uint32 hashm_firstfree; /* lowest-number free ovflpage (bit#) */ uint32 hashm_nmaps; /* number of bitmap pages */ RegProcedure hashm_procid; /* hash procedure id from pg_proc */ uint32 hashm_spares[HASH_MAX_SPLITPOINTS]; /* spare pages before * each splitpoint */ BlockNumber hashm_mapp[HASH_MAX_BITMAPS]; /* blknos of ovfl bitmaps */ } HashMetaPageData; typedef HashMetaPageData *HashMetaPage; /* * Maximum size of a hash index item (it's okay to have only one per page) */ #define HashMaxItemSize(page) \ MAXALIGN_DOWN(PageGetPageSize(page) - \ SizeOfPageHeaderData - \ sizeof(ItemIdData) - \ MAXALIGN(sizeof(HashPageOpaqueData))) #define HASH_MIN_FILLFACTOR 10 #define HASH_DEFAULT_FILLFACTOR 75 /* * Constants */ #define BYTE_TO_BIT 3 /* 2^3 bits/byte */ #define ALL_SET ((uint32) ~0) /* * Bitmap pages do not contain tuples. They do contain the standard * page headers and trailers; however, everything in between is a * giant bit array. The number of bits that fit on a page obviously * depends on the page size and the header/trailer overhead. We require * the number of bits per page to be a power of 2. */ #define BMPGSZ_BYTE(metap) ((metap)->hashm_bmsize) #define BMPGSZ_BIT(metap) ((metap)->hashm_bmsize << BYTE_TO_BIT) #define BMPG_SHIFT(metap) ((metap)->hashm_bmshift) #define BMPG_MASK(metap) (BMPGSZ_BIT(metap) - 1) #define HashPageGetBitmap(page) \ ((uint32 *) PageGetContents(page)) #define HashGetMaxBitmapSize(page) \ (PageGetPageSize((Page) page) - \ (MAXALIGN(SizeOfPageHeaderData) + MAXALIGN(sizeof(HashPageOpaqueData)))) #define HashPageGetMeta(page) \ ((HashMetaPage) PageGetContents(page)) /* * The number of bits in an ovflpage bitmap word. */ #define BITS_PER_MAP 32 /* Number of bits in uint32 */ /* Given the address of the beginning of a bit map, clear/set the nth bit */ #define CLRBIT(A, N) ((A)[(N)/BITS_PER_MAP] &= ~(1<<((N)%BITS_PER_MAP))) #define SETBIT(A, N) ((A)[(N)/BITS_PER_MAP] |= (1<<((N)%BITS_PER_MAP))) #define ISSET(A, N) ((A)[(N)/BITS_PER_MAP] & (1<<((N)%BITS_PER_MAP))) /* * page-level and high-level locking modes (see README) */ #define HASH_READ BUFFER_LOCK_SHARE #define HASH_WRITE BUFFER_LOCK_EXCLUSIVE #define HASH_NOLOCK (-1) #define HASH_SHARE ShareLock #define HASH_EXCLUSIVE ExclusiveLock /* * Strategy number. There's only one valid strategy for hashing: equality. */ #define HTEqualStrategyNumber 1 #define HTMaxStrategyNumber 1 /* * When a new operator class is declared, we require that the user supply * us with an amproc procudure for hashing a key of the new type. * Since we only have one such proc in amproc, it's number 1. */ #define HASHPROC 1 /* public routines */ extern Datum hashbuild(PG_FUNCTION_ARGS); extern Datum hashbuildempty(PG_FUNCTION_ARGS); extern Datum hashinsert(PG_FUNCTION_ARGS); extern Datum hashbeginscan(PG_FUNCTION_ARGS); extern Datum hashgettuple(PG_FUNCTION_ARGS); extern Datum hashgetbitmap(PG_FUNCTION_ARGS); extern Datum hashrescan(PG_FUNCTION_ARGS); extern Datum hashendscan(PG_FUNCTION_ARGS); extern Datum hashmarkpos(PG_FUNCTION_ARGS); extern Datum hashrestrpos(PG_FUNCTION_ARGS); extern Datum hashbulkdelete(PG_FUNCTION_ARGS); extern Datum hashvacuumcleanup(PG_FUNCTION_ARGS); extern Datum hashoptions(PG_FUNCTION_ARGS); /* * Datatype-specific hash functions in hashfunc.c. * * These support both hash indexes and hash joins. * * NOTE: some of these are also used by catcache operations, without * any direct connection to hash indexes. Also, the common hash_any * routine is also used by dynahash tables. */ extern Datum hashchar(PG_FUNCTION_ARGS); extern Datum hashint2(PG_FUNCTION_ARGS); extern Datum hashint4(PG_FUNCTION_ARGS); extern Datum hashint8(PG_FUNCTION_ARGS); extern Datum hashoid(PG_FUNCTION_ARGS); extern Datum hashenum(PG_FUNCTION_ARGS); extern Datum hashfloat4(PG_FUNCTION_ARGS); extern Datum hashfloat8(PG_FUNCTION_ARGS); extern Datum hashoidvector(PG_FUNCTION_ARGS); extern Datum hashint2vector(PG_FUNCTION_ARGS); extern Datum hashname(PG_FUNCTION_ARGS); extern Datum hashtext(PG_FUNCTION_ARGS); extern Datum hashvarlena(PG_FUNCTION_ARGS); extern Datum hash_any(register const unsigned char *k, register int keylen); extern Datum hash_uint32(uint32 k); /* private routines */ /* hashinsert.c */ extern void _hash_doinsert(Relation rel, IndexTuple itup); extern OffsetNumber _hash_pgaddtup(Relation rel, Buffer buf, Size itemsize, IndexTuple itup); /* hashovfl.c */ extern Buffer _hash_addovflpage(Relation rel, Buffer metabuf, Buffer buf); extern BlockNumber _hash_freeovflpage(Relation rel, Buffer ovflbuf, BufferAccessStrategy bstrategy); extern void _hash_initbitmap(Relation rel, HashMetaPage metap, BlockNumber blkno, ForkNumber forkNum); extern void _hash_squeezebucket(Relation rel, Bucket bucket, BlockNumber bucket_blkno, BufferAccessStrategy bstrategy); /* hashpage.c */ extern void _hash_getlock(Relation rel, BlockNumber whichlock, int access); extern bool _hash_try_getlock(Relation rel, BlockNumber whichlock, int access); extern void _hash_droplock(Relation rel, BlockNumber whichlock, int access); extern Buffer _hash_getbuf(Relation rel, BlockNumber blkno, int access, int flags); extern Buffer _hash_getinitbuf(Relation rel, BlockNumber blkno); extern Buffer _hash_getnewbuf(Relation rel, BlockNumber blkno, ForkNumber forkNum); extern Buffer _hash_getbuf_with_strategy(Relation rel, BlockNumber blkno, int access, int flags, BufferAccessStrategy bstrategy); extern void _hash_relbuf(Relation rel, Buffer buf); extern void _hash_dropbuf(Relation rel, Buffer buf); extern void _hash_wrtbuf(Relation rel, Buffer buf); extern void _hash_chgbufaccess(Relation rel, Buffer buf, int from_access, int to_access); extern uint32 _hash_metapinit(Relation rel, double num_tuples, ForkNumber forkNum); extern void _hash_pageinit(Page page, Size size); extern void _hash_expandtable(Relation rel, Buffer metabuf); /* hashscan.c */ extern void _hash_regscan(IndexScanDesc scan); extern void _hash_dropscan(IndexScanDesc scan); extern bool _hash_has_active_scan(Relation rel, Bucket bucket); extern void ReleaseResources_hash(void); /* hashsearch.c */ extern bool _hash_next(IndexScanDesc scan, ScanDirection dir); extern bool _hash_first(IndexScanDesc scan, ScanDirection dir); extern bool _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir); /* hashsort.c */ typedef struct HSpool HSpool; /* opaque struct in hashsort.c */ extern HSpool *_h_spoolinit(Relation index, uint32 num_buckets); extern void _h_spooldestroy(HSpool *hspool); extern void _h_spool(IndexTuple itup, HSpool *hspool); extern void _h_indexbuild(HSpool *hspool); /* hashutil.c */ extern bool _hash_checkqual(IndexScanDesc scan, IndexTuple itup); extern uint32 _hash_datum2hashkey(Relation rel, Datum key); extern uint32 _hash_datum2hashkey_type(Relation rel, Datum key, Oid keytype); extern Bucket _hash_hashkey2bucket(uint32 hashkey, uint32 maxbucket, uint32 highmask, uint32 lowmask); extern uint32 _hash_log2(uint32 num); extern void _hash_checkpage(Relation rel, Buffer buf, int flags); extern uint32 _hash_get_indextuple_hashkey(IndexTuple itup); extern IndexTuple _hash_form_tuple(Relation index, Datum *values, bool *isnull); extern OffsetNumber _hash_binsearch(Page page, uint32 hash_value); extern OffsetNumber _hash_binsearch_last(Page page, uint32 hash_value); /* hash.c */ extern void hash_redo(XLogRecPtr lsn, XLogRecord *record); extern void hash_desc(StringInfo buf, uint8 xl_info, char *rec); #endif /* HASH_H */ ��������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/multixact.h���������������������������������������������������������������������0000644�����������������00000005516�14763166026�0012646 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * multixact.h * * PostgreSQL multi-transaction-log manager * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/multixact.h */ #ifndef MULTIXACT_H #define MULTIXACT_H #include "access/xlog.h" #define InvalidMultiXactId ((MultiXactId) 0) #define FirstMultiXactId ((MultiXactId) 1) #define MaxMultiXactId ((MultiXactId) 0xFFFFFFFF) #define MultiXactIdIsValid(multi) ((multi) != InvalidMultiXactId) /* Number of SLRU buffers to use for multixact */ #define NUM_MXACTOFFSET_BUFFERS 8 #define NUM_MXACTMEMBER_BUFFERS 16 /* ---------------- * multixact-related XLOG entries * ---------------- */ #define XLOG_MULTIXACT_ZERO_OFF_PAGE 0x00 #define XLOG_MULTIXACT_ZERO_MEM_PAGE 0x10 #define XLOG_MULTIXACT_CREATE_ID 0x20 typedef struct xl_multixact_create { MultiXactId mid; /* new MultiXact's ID */ MultiXactOffset moff; /* its starting offset in members file */ int32 nxids; /* number of member XIDs */ TransactionId xids[1]; /* VARIABLE LENGTH ARRAY */ } xl_multixact_create; #define MinSizeOfMultiXactCreate offsetof(xl_multixact_create, xids) extern MultiXactId MultiXactIdCreate(TransactionId xid1, TransactionId xid2); extern MultiXactId MultiXactIdExpand(MultiXactId multi, TransactionId xid); extern bool MultiXactIdIsRunning(MultiXactId multi); extern bool MultiXactIdIsCurrent(MultiXactId multi); extern void MultiXactIdWait(MultiXactId multi); extern bool ConditionalMultiXactIdWait(MultiXactId multi); extern void MultiXactIdSetOldestMember(void); extern int GetMultiXactIdMembers(MultiXactId multi, TransactionId **xids); extern void AtEOXact_MultiXact(void); extern void AtPrepare_MultiXact(void); extern void PostPrepare_MultiXact(TransactionId xid); extern Size MultiXactShmemSize(void); extern void MultiXactShmemInit(void); extern void BootStrapMultiXact(void); extern void StartupMultiXact(void); extern void TrimMultiXact(void); extern void ShutdownMultiXact(void); extern void MultiXactGetCheckptMulti(bool is_shutdown, MultiXactId *nextMulti, MultiXactOffset *nextMultiOffset); extern void CheckPointMultiXact(void); extern void MultiXactSetNextMXact(MultiXactId nextMulti, MultiXactOffset nextMultiOffset); extern void MultiXactAdvanceNextMXact(MultiXactId minMulti, MultiXactOffset minMultiOffset); extern void multixact_twophase_recover(TransactionId xid, uint16 info, void *recdata, uint32 len); extern void multixact_twophase_postcommit(TransactionId xid, uint16 info, void *recdata, uint32 len); extern void multixact_twophase_postabort(TransactionId xid, uint16 info, void *recdata, uint32 len); extern void multixact_redo(XLogRecPtr lsn, XLogRecord *record); extern void multixact_desc(StringInfo buf, uint8 xl_info, char *rec); #endif /* MULTIXACT_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/itup.h��������������������������������������������������������������������������0000644�����������������00000010465�14763166026�0011614 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * itup.h * POSTGRES index tuple definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/itup.h * *------------------------------------------------------------------------- */ #ifndef ITUP_H #define ITUP_H #include "access/tupdesc.h" #include "access/tupmacs.h" #include "storage/bufpage.h" #include "storage/itemptr.h" /* * Index tuple header structure * * All index tuples start with IndexTupleData. If the HasNulls bit is set, * this is followed by an IndexAttributeBitMapData. The index attribute * values follow, beginning at a MAXALIGN boundary. * * Note that the space allocated for the bitmap does not vary with the number * of attributes; that is because we don't have room to store the number of * attributes in the header. Given the MAXALIGN constraint there's no space * savings to be had anyway, for usual values of INDEX_MAX_KEYS. */ typedef struct IndexTupleData { ItemPointerData t_tid; /* reference TID to heap tuple */ /* --------------- * t_info is laid out in the following fashion: * * 15th (high) bit: has nulls * 14th bit: has var-width attributes * 13th bit: unused * 12-0 bit: size of tuple * --------------- */ unsigned short t_info; /* various info about tuple */ } IndexTupleData; /* MORE DATA FOLLOWS AT END OF STRUCT */ typedef IndexTupleData *IndexTuple; typedef struct IndexAttributeBitMapData { bits8 bits[(INDEX_MAX_KEYS + 8 - 1) / 8]; } IndexAttributeBitMapData; typedef IndexAttributeBitMapData *IndexAttributeBitMap; /* * t_info manipulation macros */ #define INDEX_SIZE_MASK 0x1FFF /* bit 0x2000 is not used at present */ #define INDEX_VAR_MASK 0x4000 #define INDEX_NULL_MASK 0x8000 #define IndexTupleSize(itup) ((Size) (((IndexTuple) (itup))->t_info & INDEX_SIZE_MASK)) #define IndexTupleDSize(itup) ((Size) ((itup).t_info & INDEX_SIZE_MASK)) #define IndexTupleHasNulls(itup) ((((IndexTuple) (itup))->t_info & INDEX_NULL_MASK)) #define IndexTupleHasVarwidths(itup) ((((IndexTuple) (itup))->t_info & INDEX_VAR_MASK)) /* * Takes an infomask as argument (primarily because this needs to be usable * at index_form_tuple time so enough space is allocated). */ #define IndexInfoFindDataOffset(t_info) \ ( \ (!((t_info) & INDEX_NULL_MASK)) ? \ ( \ (Size)MAXALIGN(sizeof(IndexTupleData)) \ ) \ : \ ( \ (Size)MAXALIGN(sizeof(IndexTupleData) + sizeof(IndexAttributeBitMapData)) \ ) \ ) /* ---------------- * index_getattr * * This gets called many times, so we macro the cacheable and NULL * lookups, and call nocache_index_getattr() for the rest. * * ---------------- */ #define index_getattr(tup, attnum, tupleDesc, isnull) \ ( \ AssertMacro(PointerIsValid(isnull) && (attnum) > 0), \ *(isnull) = false, \ !IndexTupleHasNulls(tup) ? \ ( \ (tupleDesc)->attrs[(attnum)-1]->attcacheoff >= 0 ? \ ( \ fetchatt((tupleDesc)->attrs[(attnum)-1], \ (char *) (tup) + IndexInfoFindDataOffset((tup)->t_info) \ + (tupleDesc)->attrs[(attnum)-1]->attcacheoff) \ ) \ : \ nocache_index_getattr((tup), (attnum), (tupleDesc)) \ ) \ : \ ( \ (att_isnull((attnum)-1, (char *)(tup) + sizeof(IndexTupleData))) ? \ ( \ *(isnull) = true, \ (Datum)NULL \ ) \ : \ ( \ nocache_index_getattr((tup), (attnum), (tupleDesc)) \ ) \ ) \ ) /* * MaxIndexTuplesPerPage is an upper bound on the number of tuples that can * fit on one index page. An index tuple must have either data or a null * bitmap, so we can safely assume it's at least 1 byte bigger than a bare * IndexTupleData struct. We arrive at the divisor because each tuple * must be maxaligned, and it must have an associated item pointer. */ #define MaxIndexTuplesPerPage \ ((int) ((BLCKSZ - SizeOfPageHeaderData) / \ (MAXALIGN(sizeof(IndexTupleData) + 1) + sizeof(ItemIdData)))) /* routines in indextuple.c */ extern IndexTuple index_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull); extern Datum nocache_index_getattr(IndexTuple tup, int attnum, TupleDesc tupleDesc); extern void index_deform_tuple(IndexTuple tup, TupleDesc tupleDescriptor, Datum *values, bool *isnull); extern IndexTuple CopyIndexTuple(IndexTuple source); #endif /* ITUP_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/twophase_rmgr.h�����������������������������������������������������������������0000644�����������������00000002370�14763166026�0013510 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * twophase_rmgr.h * Two-phase-commit resource managers definition * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/twophase_rmgr.h * *------------------------------------------------------------------------- */ #ifndef TWOPHASE_RMGR_H #define TWOPHASE_RMGR_H typedef void (*TwoPhaseCallback) (TransactionId xid, uint16 info, void *recdata, uint32 len); typedef uint8 TwoPhaseRmgrId; /* * Built-in resource managers */ #define TWOPHASE_RM_END_ID 0 #define TWOPHASE_RM_LOCK_ID 1 #define TWOPHASE_RM_PGSTAT_ID 2 #define TWOPHASE_RM_MULTIXACT_ID 3 #define TWOPHASE_RM_PREDICATELOCK_ID 4 #define TWOPHASE_RM_MAX_ID TWOPHASE_RM_PREDICATELOCK_ID extern const TwoPhaseCallback twophase_recover_callbacks[]; extern const TwoPhaseCallback twophase_postcommit_callbacks[]; extern const TwoPhaseCallback twophase_postabort_callbacks[]; extern const TwoPhaseCallback twophase_standby_recover_callbacks[]; extern void RegisterTwoPhaseRecord(TwoPhaseRmgrId rmid, uint16 info, const void *data, uint32 len); #endif /* TWOPHASE_RMGR_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/sdir.h��������������������������������������������������������������������������0000644�����������������00000002672�14763166026�0011575 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * sdir.h * POSTGRES scan direction definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/sdir.h * *------------------------------------------------------------------------- */ #ifndef SDIR_H #define SDIR_H /* * ScanDirection was an int8 for no apparent reason. I kept the original * values because I'm not sure if I'll break anything otherwise. -ay 2/95 */ typedef enum ScanDirection { BackwardScanDirection = -1, NoMovementScanDirection = 0, ForwardScanDirection = 1 } ScanDirection; /* * ScanDirectionIsValid * True iff scan direction is valid. */ #define ScanDirectionIsValid(direction) \ ((bool) (BackwardScanDirection <= (direction) && \ (direction) <= ForwardScanDirection)) /* * ScanDirectionIsBackward * True iff scan direction is backward. */ #define ScanDirectionIsBackward(direction) \ ((bool) ((direction) == BackwardScanDirection)) /* * ScanDirectionIsNoMovement * True iff scan direction indicates no movement. */ #define ScanDirectionIsNoMovement(direction) \ ((bool) ((direction) == NoMovementScanDirection)) /* * ScanDirectionIsForward * True iff scan direction is forward. */ #define ScanDirectionIsForward(direction) \ ((bool) ((direction) == ForwardScanDirection)) #endif /* SDIR_H */ ����������������������������������������������������������������������pgsql/server/access/slru.h��������������������������������������������������������������������������0000644�����������������00000012237�14763166026�0011617 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * slru.h * Simple LRU buffering for transaction status logfiles * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/slru.h * *------------------------------------------------------------------------- */ #ifndef SLRU_H #define SLRU_H #include "access/xlogdefs.h" #include "storage/lwlock.h" /* * Define SLRU segment size. A page is the same BLCKSZ as is used everywhere * else in Postgres. The segment size can be chosen somewhat arbitrarily; * we make it 32 pages by default, or 256Kb, i.e. 1M transactions for CLOG * or 64K transactions for SUBTRANS. * * Note: because TransactionIds are 32 bits and wrap around at 0xFFFFFFFF, * page numbering also wraps around at 0xFFFFFFFF/xxxx_XACTS_PER_PAGE (where * xxxx is CLOG or SUBTRANS, respectively), and segment numbering at * 0xFFFFFFFF/xxxx_XACTS_PER_PAGE/SLRU_PAGES_PER_SEGMENT. We need * take no explicit notice of that fact in slru.c, except when comparing * segment and page numbers in SimpleLruTruncate (see PagePrecedes()). * * Note: slru.c currently assumes that segment file names will be four hex * digits. This sets a lower bound on the segment size (64K transactions * for 32-bit TransactionIds). */ #define SLRU_PAGES_PER_SEGMENT 32 /* * Page status codes. Note that these do not include the "dirty" bit. * page_dirty can be TRUE only in the VALID or WRITE_IN_PROGRESS states; * in the latter case it implies that the page has been re-dirtied since * the write started. */ typedef enum { SLRU_PAGE_EMPTY, /* buffer is not in use */ SLRU_PAGE_READ_IN_PROGRESS, /* page is being read in */ SLRU_PAGE_VALID, /* page is valid and not being written */ SLRU_PAGE_WRITE_IN_PROGRESS /* page is being written out */ } SlruPageStatus; /* * Shared-memory state */ typedef struct SlruSharedData { LWLockId ControlLock; /* Number of buffers managed by this SLRU structure */ int num_slots; /* * Arrays holding info for each buffer slot. Page number is undefined * when status is EMPTY, as is page_lru_count. */ char **page_buffer; SlruPageStatus *page_status; bool *page_dirty; int *page_number; int *page_lru_count; LWLockId *buffer_locks; /* * Optional array of WAL flush LSNs associated with entries in the SLRU * pages. If not zero/NULL, we must flush WAL before writing pages (true * for pg_clog, false for multixact, pg_subtrans, pg_notify). group_lsn[] * has lsn_groups_per_page entries per buffer slot, each containing the * highest LSN known for a contiguous group of SLRU entries on that slot's * page. */ XLogRecPtr *group_lsn; int lsn_groups_per_page; /*---------- * We mark a page "most recently used" by setting * page_lru_count[slotno] = ++cur_lru_count; * The oldest page is therefore the one with the highest value of * cur_lru_count - page_lru_count[slotno] * The counts will eventually wrap around, but this calculation still * works as long as no page's age exceeds INT_MAX counts. *---------- */ int cur_lru_count; /* * latest_page_number is the page number of the current end of the log; * this is not critical data, since we use it only to avoid swapping out * the latest page. */ int latest_page_number; } SlruSharedData; typedef SlruSharedData *SlruShared; /* * SlruCtlData is an unshared structure that points to the active information * in shared memory. */ typedef struct SlruCtlData { SlruShared shared; /* * This flag tells whether to fsync writes (true for pg_clog and multixact * stuff, false for pg_subtrans and pg_notify). */ bool do_fsync; /* * Decide which of two page numbers is "older" for truncation purposes. We * need to use comparison of TransactionIds here in order to do the right * thing with wraparound XID arithmetic. */ bool (*PagePrecedes) (int, int); /* * Dir is set during SimpleLruInit and does not change thereafter. Since * it's always the same, it doesn't need to be in shared memory. */ char Dir[64]; } SlruCtlData; typedef SlruCtlData *SlruCtl; extern Size SimpleLruShmemSize(int nslots, int nlsns); extern void SimpleLruInit(SlruCtl ctl, const char *name, int nslots, int nlsns, LWLockId ctllock, const char *subdir); extern int SimpleLruZeroPage(SlruCtl ctl, int pageno); extern int SimpleLruReadPage(SlruCtl ctl, int pageno, bool write_ok, TransactionId xid); extern int SimpleLruReadPage_ReadOnly(SlruCtl ctl, int pageno, TransactionId xid); extern void SimpleLruWritePage(SlruCtl ctl, int slotno); extern void SimpleLruFlush(SlruCtl ctl, bool checkpoint); extern void SimpleLruTruncate(SlruCtl ctl, int cutoffPage); typedef bool (*SlruScanCallback) (SlruCtl ctl, char *filename, int segpage, void *data); extern bool SlruScanDirectory(SlruCtl ctl, SlruScanCallback callback, void *data); /* SlruScanDirectory public callbacks */ extern bool SlruScanDirCbReportPresence(SlruCtl ctl, char *filename, int segpage, void *data); extern bool SlruScanDirCbDeleteAll(SlruCtl ctl, char *filename, int segpage, void *data); #endif /* SLRU_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/tupdesc.h�����������������������������������������������������������������������0000644�����������������00000010377�14763166026�0012304 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * tupdesc.h * POSTGRES tuple descriptor definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/tupdesc.h * *------------------------------------------------------------------------- */ #ifndef TUPDESC_H #define TUPDESC_H #include "access/attnum.h" #include "catalog/pg_attribute.h" #include "nodes/pg_list.h" typedef struct attrDefault { AttrNumber adnum; char *adbin; /* nodeToString representation of expr */ } AttrDefault; typedef struct constrCheck { char *ccname; char *ccbin; /* nodeToString representation of expr */ bool ccvalid; bool ccnoinherit; /* this is a non-inheritable constraint */ } ConstrCheck; /* This structure contains constraints of a tuple */ typedef struct tupleConstr { AttrDefault *defval; /* array */ ConstrCheck *check; /* array */ uint16 num_defval; uint16 num_check; bool has_not_null; } TupleConstr; /* * This struct is passed around within the backend to describe the structure * of tuples. For tuples coming from on-disk relations, the information is * collected from the pg_attribute, pg_attrdef, and pg_constraint catalogs. * Transient row types (such as the result of a join query) have anonymous * TupleDesc structs that generally omit any constraint info; therefore the * structure is designed to let the constraints be omitted efficiently. * * Note that only user attributes, not system attributes, are mentioned in * TupleDesc; with the exception that tdhasoid indicates if OID is present. * * If the tupdesc is known to correspond to a named rowtype (such as a table's * rowtype) then tdtypeid identifies that type and tdtypmod is -1. Otherwise * tdtypeid is RECORDOID, and tdtypmod can be either -1 for a fully anonymous * row type, or a value >= 0 to allow the rowtype to be looked up in the * typcache.c type cache. * * Tuple descriptors that live in caches (relcache or typcache, at present) * are reference-counted: they can be deleted when their reference count goes * to zero. Tuple descriptors created by the executor need no reference * counting, however: they are simply created in the appropriate memory * context and go away when the context is freed. We set the tdrefcount * field of such a descriptor to -1, while reference-counted descriptors * always have tdrefcount >= 0. */ typedef struct tupleDesc { int natts; /* number of attributes in the tuple */ Form_pg_attribute *attrs; /* attrs[N] is a pointer to the description of Attribute Number N+1 */ TupleConstr *constr; /* constraints, or NULL if none */ Oid tdtypeid; /* composite type ID for tuple type */ int32 tdtypmod; /* typmod for tuple type */ bool tdhasoid; /* tuple has oid attribute in its header */ int tdrefcount; /* reference count, or -1 if not counting */ } *TupleDesc; /* Accessor for the i'th attribute of tupdesc. */ #define TupleDescAttr(tupdesc, i) ((tupdesc)->attrs[(i)]) extern TupleDesc CreateTemplateTupleDesc(int natts, bool hasoid); extern TupleDesc CreateTupleDesc(int natts, bool hasoid, Form_pg_attribute *attrs); extern TupleDesc CreateTupleDescCopy(TupleDesc tupdesc); extern TupleDesc CreateTupleDescCopyConstr(TupleDesc tupdesc); extern void FreeTupleDesc(TupleDesc tupdesc); extern void IncrTupleDescRefCount(TupleDesc tupdesc); extern void DecrTupleDescRefCount(TupleDesc tupdesc); #define PinTupleDesc(tupdesc) \ do { \ if ((tupdesc)->tdrefcount >= 0) \ IncrTupleDescRefCount(tupdesc); \ } while (0) #define ReleaseTupleDesc(tupdesc) \ do { \ if ((tupdesc)->tdrefcount >= 0) \ DecrTupleDescRefCount(tupdesc); \ } while (0) extern bool equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2); extern void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim); extern void TupleDescInitEntryCollation(TupleDesc desc, AttrNumber attributeNumber, Oid collationid); extern TupleDesc BuildDescForRelation(List *schema); extern TupleDesc BuildDescFromLists(List *names, List *types, List *typmods, List *collations); #endif /* TUPDESC_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/htup.h��������������������������������������������������������������������������0000644�����������������00000100205�14763166026�0011603 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * htup.h * POSTGRES heap tuple definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/htup.h * *------------------------------------------------------------------------- */ #ifndef HTUP_H #define HTUP_H #include "access/tupdesc.h" #include "access/tupmacs.h" #include "storage/bufpage.h" #include "storage/itemptr.h" #include "storage/relfilenode.h" /* * MaxTupleAttributeNumber limits the number of (user) columns in a tuple. * The key limit on this value is that the size of the fixed overhead for * a tuple, plus the size of the null-values bitmap (at 1 bit per column), * plus MAXALIGN alignment, must fit into t_hoff which is uint8. On most * machines the upper limit without making t_hoff wider would be a little * over 1700. We use round numbers here and for MaxHeapAttributeNumber * so that alterations in HeapTupleHeaderData layout won't change the * supported max number of columns. */ #define MaxTupleAttributeNumber 1664 /* 8 * 208 */ /* * MaxHeapAttributeNumber limits the number of (user) columns in a table. * This should be somewhat less than MaxTupleAttributeNumber. It must be * at least one less, else we will fail to do UPDATEs on a maximal-width * table (because UPDATE has to form working tuples that include CTID). * In practice we want some additional daylight so that we can gracefully * support operations that add hidden "resjunk" columns, for example * SELECT * FROM wide_table ORDER BY foo, bar, baz. * In any case, depending on column data types you will likely be running * into the disk-block-based limit on overall tuple size if you have more * than a thousand or so columns. TOAST won't help. */ #define MaxHeapAttributeNumber 1600 /* 8 * 200 */ /* * Heap tuple header. To avoid wasting space, the fields should be * laid out in such a way as to avoid structure padding. * * Datums of composite types (row types) share the same general structure * as on-disk tuples, so that the same routines can be used to build and * examine them. However the requirements are slightly different: a Datum * does not need any transaction visibility information, and it does need * a length word and some embedded type information. We can achieve this * by overlaying the xmin/cmin/xmax/cmax/xvac fields of a heap tuple * with the fields needed in the Datum case. Typically, all tuples built * in-memory will be initialized with the Datum fields; but when a tuple is * about to be inserted in a table, the transaction fields will be filled, * overwriting the datum fields. * * The overall structure of a heap tuple looks like: * fixed fields (HeapTupleHeaderData struct) * nulls bitmap (if HEAP_HASNULL is set in t_infomask) * alignment padding (as needed to make user data MAXALIGN'd) * object ID (if HEAP_HASOID is set in t_infomask) * user data fields * * We store five "virtual" fields Xmin, Cmin, Xmax, Cmax, and Xvac in three * physical fields. Xmin and Xmax are always really stored, but Cmin, Cmax * and Xvac share a field. This works because we know that Cmin and Cmax * are only interesting for the lifetime of the inserting and deleting * transaction respectively. If a tuple is inserted and deleted in the same * transaction, we store a "combo" command id that can be mapped to the real * cmin and cmax, but only by use of local state within the originating * backend. See combocid.c for more details. Meanwhile, Xvac is only set by * old-style VACUUM FULL, which does not have any command sub-structure and so * does not need either Cmin or Cmax. (This requires that old-style VACUUM * FULL never try to move a tuple whose Cmin or Cmax is still interesting, * ie, an insert-in-progress or delete-in-progress tuple.) * * A word about t_ctid: whenever a new tuple is stored on disk, its t_ctid * is initialized with its own TID (location). If the tuple is ever updated, * its t_ctid is changed to point to the replacement version of the tuple. * Thus, a tuple is the latest version of its row iff XMAX is invalid or * t_ctid points to itself (in which case, if XMAX is valid, the tuple is * either locked or deleted). One can follow the chain of t_ctid links * to find the newest version of the row. Beware however that VACUUM might * erase the pointed-to (newer) tuple before erasing the pointing (older) * tuple. Hence, when following a t_ctid link, it is necessary to check * to see if the referenced slot is empty or contains an unrelated tuple. * Check that the referenced tuple has XMIN equal to the referencing tuple's * XMAX to verify that it is actually the descendant version and not an * unrelated tuple stored into a slot recently freed by VACUUM. If either * check fails, one may assume that there is no live descendant version. * * Following the fixed header fields, the nulls bitmap is stored (beginning * at t_bits). The bitmap is *not* stored if t_infomask shows that there * are no nulls in the tuple. If an OID field is present (as indicated by * t_infomask), then it is stored just before the user data, which begins at * the offset shown by t_hoff. Note that t_hoff must be a multiple of * MAXALIGN. */ typedef struct HeapTupleFields { TransactionId t_xmin; /* inserting xact ID */ TransactionId t_xmax; /* deleting or locking xact ID */ union { CommandId t_cid; /* inserting or deleting command ID, or both */ TransactionId t_xvac; /* old-style VACUUM FULL xact ID */ } t_field3; } HeapTupleFields; typedef struct DatumTupleFields { int32 datum_len_; /* varlena header (do not touch directly!) */ int32 datum_typmod; /* -1, or identifier of a record type */ Oid datum_typeid; /* composite type OID, or RECORDOID */ /* * Note: field ordering is chosen with thought that Oid might someday * widen to 64 bits. */ } DatumTupleFields; typedef struct HeapTupleHeaderData { union { HeapTupleFields t_heap; DatumTupleFields t_datum; } t_choice; ItemPointerData t_ctid; /* current TID of this or newer tuple */ /* Fields below here must match MinimalTupleData! */ uint16 t_infomask2; /* number of attributes + various flags */ uint16 t_infomask; /* various flag bits, see below */ uint8 t_hoff; /* sizeof header incl. bitmap, padding */ /* ^ - 23 bytes - ^ */ bits8 t_bits[1]; /* bitmap of NULLs -- VARIABLE LENGTH */ /* MORE DATA FOLLOWS AT END OF STRUCT */ } HeapTupleHeaderData; typedef HeapTupleHeaderData *HeapTupleHeader; /* * information stored in t_infomask: */ #define HEAP_HASNULL 0x0001 /* has null attribute(s) */ #define HEAP_HASVARWIDTH 0x0002 /* has variable-width attribute(s) */ #define HEAP_HASEXTERNAL 0x0004 /* has external stored attribute(s) */ #define HEAP_HASOID 0x0008 /* has an object-id field */ /* bit 0x0010 is available */ #define HEAP_COMBOCID 0x0020 /* t_cid is a combo cid */ #define HEAP_XMAX_EXCL_LOCK 0x0040 /* xmax is exclusive locker */ #define HEAP_XMAX_SHARED_LOCK 0x0080 /* xmax is shared locker */ /* if either LOCK bit is set, xmax hasn't deleted the tuple, only locked it */ #define HEAP_IS_LOCKED (HEAP_XMAX_EXCL_LOCK | HEAP_XMAX_SHARED_LOCK) #define HEAP_XMIN_COMMITTED 0x0100 /* t_xmin committed */ #define HEAP_XMIN_INVALID 0x0200 /* t_xmin invalid/aborted */ #define HEAP_XMAX_COMMITTED 0x0400 /* t_xmax committed */ #define HEAP_XMAX_INVALID 0x0800 /* t_xmax invalid/aborted */ #define HEAP_XMAX_IS_MULTI 0x1000 /* t_xmax is a MultiXactId */ #define HEAP_UPDATED 0x2000 /* this is UPDATEd version of row */ #define HEAP_MOVED_OFF 0x4000 /* moved to another place by pre-9.0 * VACUUM FULL; kept for binary * upgrade support */ #define HEAP_MOVED_IN 0x8000 /* moved from another place by pre-9.0 * VACUUM FULL; kept for binary * upgrade support */ #define HEAP_MOVED (HEAP_MOVED_OFF | HEAP_MOVED_IN) #define HEAP_XACT_MASK 0xFFE0 /* visibility-related bits */ /* * information stored in t_infomask2: */ #define HEAP_NATTS_MASK 0x07FF /* 11 bits for number of attributes */ /* bits 0x3800 are available */ #define HEAP_HOT_UPDATED 0x4000 /* tuple was HOT-updated */ #define HEAP_ONLY_TUPLE 0x8000 /* this is heap-only tuple */ #define HEAP2_XACT_MASK 0xC000 /* visibility-related bits */ /* * HEAP_TUPLE_HAS_MATCH is a temporary flag used during hash joins. It is * only used in tuples that are in the hash table, and those don't need * any visibility information, so we can overlay it on a visibility flag * instead of using up a dedicated bit. */ #define HEAP_TUPLE_HAS_MATCH HEAP_ONLY_TUPLE /* tuple has a join match */ /* * HeapTupleHeader accessor macros * * Note: beware of multiple evaluations of "tup" argument. But the Set * macros evaluate their other argument only once. */ #define HeapTupleHeaderGetXmin(tup) \ ( \ (tup)->t_choice.t_heap.t_xmin \ ) #define HeapTupleHeaderSetXmin(tup, xid) \ ( \ (tup)->t_choice.t_heap.t_xmin = (xid) \ ) #define HeapTupleHeaderGetXmax(tup) \ ( \ (tup)->t_choice.t_heap.t_xmax \ ) #define HeapTupleHeaderSetXmax(tup, xid) \ ( \ (tup)->t_choice.t_heap.t_xmax = (xid) \ ) /* * HeapTupleHeaderGetRawCommandId will give you what's in the header whether * it is useful or not. Most code should use HeapTupleHeaderGetCmin or * HeapTupleHeaderGetCmax instead, but note that those Assert that you can * get a legitimate result, ie you are in the originating transaction! */ #define HeapTupleHeaderGetRawCommandId(tup) \ ( \ (tup)->t_choice.t_heap.t_field3.t_cid \ ) /* SetCmin is reasonably simple since we never need a combo CID */ #define HeapTupleHeaderSetCmin(tup, cid) \ do { \ Assert(!((tup)->t_infomask & HEAP_MOVED)); \ (tup)->t_choice.t_heap.t_field3.t_cid = (cid); \ (tup)->t_infomask &= ~HEAP_COMBOCID; \ } while (0) /* SetCmax must be used after HeapTupleHeaderAdjustCmax; see combocid.c */ #define HeapTupleHeaderSetCmax(tup, cid, iscombo) \ do { \ Assert(!((tup)->t_infomask & HEAP_MOVED)); \ (tup)->t_choice.t_heap.t_field3.t_cid = (cid); \ if (iscombo) \ (tup)->t_infomask |= HEAP_COMBOCID; \ else \ (tup)->t_infomask &= ~HEAP_COMBOCID; \ } while (0) #define HeapTupleHeaderGetXvac(tup) \ ( \ ((tup)->t_infomask & HEAP_MOVED) ? \ (tup)->t_choice.t_heap.t_field3.t_xvac \ : \ InvalidTransactionId \ ) #define HeapTupleHeaderSetXvac(tup, xid) \ do { \ Assert((tup)->t_infomask & HEAP_MOVED); \ (tup)->t_choice.t_heap.t_field3.t_xvac = (xid); \ } while (0) #define HeapTupleHeaderGetDatumLength(tup) \ VARSIZE(tup) #define HeapTupleHeaderSetDatumLength(tup, len) \ SET_VARSIZE(tup, len) #define HeapTupleHeaderGetTypeId(tup) \ ( \ (tup)->t_choice.t_datum.datum_typeid \ ) #define HeapTupleHeaderSetTypeId(tup, typeid) \ ( \ (tup)->t_choice.t_datum.datum_typeid = (typeid) \ ) #define HeapTupleHeaderGetTypMod(tup) \ ( \ (tup)->t_choice.t_datum.datum_typmod \ ) #define HeapTupleHeaderSetTypMod(tup, typmod) \ ( \ (tup)->t_choice.t_datum.datum_typmod = (typmod) \ ) #define HeapTupleHeaderGetOid(tup) \ ( \ ((tup)->t_infomask & HEAP_HASOID) ? \ *((Oid *) ((char *)(tup) + (tup)->t_hoff - sizeof(Oid))) \ : \ InvalidOid \ ) #define HeapTupleHeaderSetOid(tup, oid) \ do { \ Assert((tup)->t_infomask & HEAP_HASOID); \ *((Oid *) ((char *)(tup) + (tup)->t_hoff - sizeof(Oid))) = (oid); \ } while (0) /* * Note that we stop considering a tuple HOT-updated as soon as it is known * aborted or the would-be updating transaction is known aborted. For best * efficiency, check tuple visibility before using this macro, so that the * INVALID bits will be as up to date as possible. */ #define HeapTupleHeaderIsHotUpdated(tup) \ ( \ ((tup)->t_infomask2 & HEAP_HOT_UPDATED) != 0 && \ ((tup)->t_infomask & (HEAP_XMIN_INVALID | HEAP_XMAX_INVALID)) == 0 \ ) #define HeapTupleHeaderSetHotUpdated(tup) \ ( \ (tup)->t_infomask2 |= HEAP_HOT_UPDATED \ ) #define HeapTupleHeaderClearHotUpdated(tup) \ ( \ (tup)->t_infomask2 &= ~HEAP_HOT_UPDATED \ ) #define HeapTupleHeaderIsHeapOnly(tup) \ ( \ ((tup)->t_infomask2 & HEAP_ONLY_TUPLE) != 0 \ ) #define HeapTupleHeaderSetHeapOnly(tup) \ ( \ (tup)->t_infomask2 |= HEAP_ONLY_TUPLE \ ) #define HeapTupleHeaderClearHeapOnly(tup) \ ( \ (tup)->t_infomask2 &= ~HEAP_ONLY_TUPLE \ ) #define HeapTupleHeaderHasMatch(tup) \ ( \ ((tup)->t_infomask2 & HEAP_TUPLE_HAS_MATCH) != 0 \ ) #define HeapTupleHeaderSetMatch(tup) \ ( \ (tup)->t_infomask2 |= HEAP_TUPLE_HAS_MATCH \ ) #define HeapTupleHeaderClearMatch(tup) \ ( \ (tup)->t_infomask2 &= ~HEAP_TUPLE_HAS_MATCH \ ) #define HeapTupleHeaderGetNatts(tup) \ ((tup)->t_infomask2 & HEAP_NATTS_MASK) #define HeapTupleHeaderSetNatts(tup, natts) \ ( \ (tup)->t_infomask2 = ((tup)->t_infomask2 & ~HEAP_NATTS_MASK) | (natts) \ ) #define HeapTupleHeaderHasExternal(tup) \ (((tup)->t_infomask & HEAP_HASEXTERNAL) != 0) /* * BITMAPLEN(NATTS) - * Computes size of null bitmap given number of data columns. */ #define BITMAPLEN(NATTS) (((int)(NATTS) + 7) / 8) /* * MaxHeapTupleSize is the maximum allowed size of a heap tuple, including * header and MAXALIGN alignment padding. Basically it's BLCKSZ minus the * other stuff that has to be on a disk page. Since heap pages use no * "special space", there's no deduction for that. * * NOTE: we allow for the ItemId that must point to the tuple, ensuring that * an otherwise-empty page can indeed hold a tuple of this size. Because * ItemIds and tuples have different alignment requirements, don't assume that * you can, say, fit 2 tuples of size MaxHeapTupleSize/2 on the same page. */ #define MaxHeapTupleSize (BLCKSZ - MAXALIGN(SizeOfPageHeaderData + sizeof(ItemIdData))) /* * MaxHeapTuplesPerPage is an upper bound on the number of tuples that can * fit on one heap page. (Note that indexes could have more, because they * use a smaller tuple header.) We arrive at the divisor because each tuple * must be maxaligned, and it must have an associated item pointer. * * Note: with HOT, there could theoretically be more line pointers (not actual * tuples) than this on a heap page. However we constrain the number of line * pointers to this anyway, to avoid excessive line-pointer bloat and not * require increases in the size of work arrays. */ #define MaxHeapTuplesPerPage \ ((int) ((BLCKSZ - SizeOfPageHeaderData) / \ (MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) + sizeof(ItemIdData)))) /* * MaxAttrSize is a somewhat arbitrary upper limit on the declared size of * data fields of char(n) and similar types. It need not have anything * directly to do with the *actual* upper limit of varlena values, which * is currently 1Gb (see TOAST structures in postgres.h). I've set it * at 10Mb which seems like a reasonable number --- tgl 8/6/00. */ #define MaxAttrSize (10 * 1024 * 1024) /* * MinimalTuple is an alternative representation that is used for transient * tuples inside the executor, in places where transaction status information * is not required, the tuple rowtype is known, and shaving off a few bytes * is worthwhile because we need to store many tuples. The representation * is chosen so that tuple access routines can work with either full or * minimal tuples via a HeapTupleData pointer structure. The access routines * see no difference, except that they must not access the transaction status * or t_ctid fields because those aren't there. * * For the most part, MinimalTuples should be accessed via TupleTableSlot * routines. These routines will prevent access to the "system columns" * and thereby prevent accidental use of the nonexistent fields. * * MinimalTupleData contains a length word, some padding, and fields matching * HeapTupleHeaderData beginning with t_infomask2. The padding is chosen so * that offsetof(t_infomask2) is the same modulo MAXIMUM_ALIGNOF in both * structs. This makes data alignment rules equivalent in both cases. * * When a minimal tuple is accessed via a HeapTupleData pointer, t_data is * set to point MINIMAL_TUPLE_OFFSET bytes before the actual start of the * minimal tuple --- that is, where a full tuple matching the minimal tuple's * data would start. This trick is what makes the structs seem equivalent. * * Note that t_hoff is computed the same as in a full tuple, hence it includes * the MINIMAL_TUPLE_OFFSET distance. t_len does not include that, however. * * MINIMAL_TUPLE_DATA_OFFSET is the offset to the first useful (non-pad) data * other than the length word. tuplesort.c and tuplestore.c use this to avoid * writing the padding to disk. */ #define MINIMAL_TUPLE_OFFSET \ ((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) / MAXIMUM_ALIGNOF * MAXIMUM_ALIGNOF) #define MINIMAL_TUPLE_PADDING \ ((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) % MAXIMUM_ALIGNOF) #define MINIMAL_TUPLE_DATA_OFFSET \ offsetof(MinimalTupleData, t_infomask2) typedef struct MinimalTupleData { uint32 t_len; /* actual length of minimal tuple */ char mt_padding[MINIMAL_TUPLE_PADDING]; /* Fields below here must match HeapTupleHeaderData! */ uint16 t_infomask2; /* number of attributes + various flags */ uint16 t_infomask; /* various flag bits, see below */ uint8 t_hoff; /* sizeof header incl. bitmap, padding */ /* ^ - 23 bytes - ^ */ bits8 t_bits[1]; /* bitmap of NULLs -- VARIABLE LENGTH */ /* MORE DATA FOLLOWS AT END OF STRUCT */ } MinimalTupleData; typedef MinimalTupleData *MinimalTuple; /* * HeapTupleData is an in-memory data structure that points to a tuple. * * There are several ways in which this data structure is used: * * * Pointer to a tuple in a disk buffer: t_data points directly into the * buffer (which the code had better be holding a pin on, but this is not * reflected in HeapTupleData itself). * * * Pointer to nothing: t_data is NULL. This is used as a failure indication * in some functions. * * * Part of a palloc'd tuple: the HeapTupleData itself and the tuple * form a single palloc'd chunk. t_data points to the memory location * immediately following the HeapTupleData struct (at offset HEAPTUPLESIZE). * This is the output format of heap_form_tuple and related routines. * * * Separately allocated tuple: t_data points to a palloc'd chunk that * is not adjacent to the HeapTupleData. (This case is deprecated since * it's difficult to tell apart from case #1. It should be used only in * limited contexts where the code knows that case #1 will never apply.) * * * Separately allocated minimal tuple: t_data points MINIMAL_TUPLE_OFFSET * bytes before the start of a MinimalTuple. As with the previous case, * this can't be told apart from case #1 by inspection; code setting up * or destroying this representation has to know what it's doing. * * t_len should always be valid, except in the pointer-to-nothing case. * t_self and t_tableOid should be valid if the HeapTupleData points to * a disk buffer, or if it represents a copy of a tuple on disk. They * should be explicitly set invalid in manufactured tuples. */ typedef struct HeapTupleData { uint32 t_len; /* length of *t_data */ ItemPointerData t_self; /* SelfItemPointer */ Oid t_tableOid; /* table the tuple came from */ HeapTupleHeader t_data; /* -> tuple header and data */ } HeapTupleData; typedef HeapTupleData *HeapTuple; #define HEAPTUPLESIZE MAXALIGN(sizeof(HeapTupleData)) /* * GETSTRUCT - given a HeapTuple pointer, return address of the user data */ #define GETSTRUCT(TUP) ((char *) ((TUP)->t_data) + (TUP)->t_data->t_hoff) /* * Accessor macros to be used with HeapTuple pointers. */ #define HeapTupleIsValid(tuple) PointerIsValid(tuple) #define HeapTupleHasNulls(tuple) \ (((tuple)->t_data->t_infomask & HEAP_HASNULL) != 0) #define HeapTupleNoNulls(tuple) \ (!((tuple)->t_data->t_infomask & HEAP_HASNULL)) #define HeapTupleHasVarWidth(tuple) \ (((tuple)->t_data->t_infomask & HEAP_HASVARWIDTH) != 0) #define HeapTupleAllFixed(tuple) \ (!((tuple)->t_data->t_infomask & HEAP_HASVARWIDTH)) #define HeapTupleHasExternal(tuple) \ (((tuple)->t_data->t_infomask & HEAP_HASEXTERNAL) != 0) #define HeapTupleIsHotUpdated(tuple) \ HeapTupleHeaderIsHotUpdated((tuple)->t_data) #define HeapTupleSetHotUpdated(tuple) \ HeapTupleHeaderSetHotUpdated((tuple)->t_data) #define HeapTupleClearHotUpdated(tuple) \ HeapTupleHeaderClearHotUpdated((tuple)->t_data) #define HeapTupleIsHeapOnly(tuple) \ HeapTupleHeaderIsHeapOnly((tuple)->t_data) #define HeapTupleSetHeapOnly(tuple) \ HeapTupleHeaderSetHeapOnly((tuple)->t_data) #define HeapTupleClearHeapOnly(tuple) \ HeapTupleHeaderClearHeapOnly((tuple)->t_data) #define HeapTupleGetOid(tuple) \ HeapTupleHeaderGetOid((tuple)->t_data) #define HeapTupleSetOid(tuple, oid) \ HeapTupleHeaderSetOid((tuple)->t_data, (oid)) /* * WAL record definitions for heapam.c's WAL operations * * XLOG allows to store some information in high 4 bits of log * record xl_info field. We use 3 for opcode and one for init bit. */ #define XLOG_HEAP_INSERT 0x00 #define XLOG_HEAP_DELETE 0x10 #define XLOG_HEAP_UPDATE 0x20 /* 0x030 is free, was XLOG_HEAP_MOVE */ #define XLOG_HEAP_HOT_UPDATE 0x40 #define XLOG_HEAP_NEWPAGE 0x50 #define XLOG_HEAP_LOCK 0x60 #define XLOG_HEAP_INPLACE 0x70 #define XLOG_HEAP_OPMASK 0x70 /* * When we insert 1st item on new page in INSERT, UPDATE, HOT_UPDATE, * or MULTI_INSERT, we can (and we do) restore entire page in redo */ #define XLOG_HEAP_INIT_PAGE 0x80 /* * We ran out of opcodes, so heapam.c now has a second RmgrId. These opcodes * are associated with RM_HEAP2_ID, but are not logically different from * the ones above associated with RM_HEAP_ID. XLOG_HEAP_OPMASK applies to * these, too. */ #define XLOG_HEAP2_FREEZE 0x00 #define XLOG_HEAP2_CLEAN 0x10 /* 0x20 is free, was XLOG_HEAP2_CLEAN_MOVE */ #define XLOG_HEAP2_CLEANUP_INFO 0x30 #define XLOG_HEAP2_VISIBLE 0x40 #define XLOG_HEAP2_MULTI_INSERT 0x50 /* * All what we need to find changed tuple * * NB: on most machines, sizeof(xl_heaptid) will include some trailing pad * bytes for alignment. We don't want to store the pad space in the XLOG, * so use SizeOfHeapTid for space calculations. Similar comments apply for * the other xl_FOO structs. */ typedef struct xl_heaptid { RelFileNode node; ItemPointerData tid; /* changed tuple id */ } xl_heaptid; #define SizeOfHeapTid (offsetof(xl_heaptid, tid) + SizeOfIptrData) /* This is what we need to know about delete */ typedef struct xl_heap_delete { xl_heaptid target; /* deleted tuple id */ bool all_visible_cleared; /* PD_ALL_VISIBLE was cleared */ } xl_heap_delete; #define SizeOfHeapDelete (offsetof(xl_heap_delete, all_visible_cleared) + sizeof(bool)) /* * We don't store the whole fixed part (HeapTupleHeaderData) of an inserted * or updated tuple in WAL; we can save a few bytes by reconstructing the * fields that are available elsewhere in the WAL record, or perhaps just * plain needn't be reconstructed. These are the fields we must store. * NOTE: t_hoff could be recomputed, but we may as well store it because * it will come for free due to alignment considerations. */ typedef struct xl_heap_header { uint16 t_infomask2; uint16 t_infomask; uint8 t_hoff; } xl_heap_header; #define SizeOfHeapHeader (offsetof(xl_heap_header, t_hoff) + sizeof(uint8)) /* This is what we need to know about insert */ typedef struct xl_heap_insert { xl_heaptid target; /* inserted tuple id */ bool all_visible_cleared; /* PD_ALL_VISIBLE was cleared */ /* xl_heap_header & TUPLE DATA FOLLOWS AT END OF STRUCT */ } xl_heap_insert; #define SizeOfHeapInsert (offsetof(xl_heap_insert, all_visible_cleared) + sizeof(bool)) /* * This is what we need to know about a multi-insert. The record consists of * xl_heap_multi_insert header, followed by a xl_multi_insert_tuple and tuple * data for each tuple. 'offsets' array is omitted if the whole page is * reinitialized (XLOG_HEAP_INIT_PAGE) */ typedef struct xl_heap_multi_insert { RelFileNode node; BlockNumber blkno; bool all_visible_cleared; uint16 ntuples; OffsetNumber offsets[1]; /* TUPLE DATA (xl_multi_insert_tuples) FOLLOW AT END OF STRUCT */ } xl_heap_multi_insert; #define SizeOfHeapMultiInsert offsetof(xl_heap_multi_insert, offsets) typedef struct xl_multi_insert_tuple { uint16 datalen; /* size of tuple data that follows */ uint16 t_infomask2; uint16 t_infomask; uint8 t_hoff; /* TUPLE DATA FOLLOWS AT END OF STRUCT */ } xl_multi_insert_tuple; #define SizeOfMultiInsertTuple (offsetof(xl_multi_insert_tuple, t_hoff) + sizeof(uint8)) /* This is what we need to know about update|hot_update */ typedef struct xl_heap_update { xl_heaptid target; /* deleted tuple id */ ItemPointerData newtid; /* new inserted tuple id */ bool all_visible_cleared; /* PD_ALL_VISIBLE was cleared */ bool new_all_visible_cleared; /* same for the page of newtid */ /* NEW TUPLE xl_heap_header AND TUPLE DATA FOLLOWS AT END OF STRUCT */ } xl_heap_update; #define SizeOfHeapUpdate (offsetof(xl_heap_update, new_all_visible_cleared) + sizeof(bool)) /* * This is what we need to know about vacuum page cleanup/redirect * * The array of OffsetNumbers following the fixed part of the record contains: * * for each redirected item: the item offset, then the offset redirected to * * for each now-dead item: the item offset * * for each now-unused item: the item offset * The total number of OffsetNumbers is therefore 2*nredirected+ndead+nunused. * Note that nunused is not explicitly stored, but may be found by reference * to the total record length. */ typedef struct xl_heap_clean { RelFileNode node; BlockNumber block; TransactionId latestRemovedXid; uint16 nredirected; uint16 ndead; /* OFFSET NUMBERS FOLLOW */ } xl_heap_clean; #define SizeOfHeapClean (offsetof(xl_heap_clean, ndead) + sizeof(uint16)) /* * Cleanup_info is required in some cases during a lazy VACUUM. * Used for reporting the results of HeapTupleHeaderAdvanceLatestRemovedXid() * see vacuumlazy.c for full explanation */ typedef struct xl_heap_cleanup_info { RelFileNode node; TransactionId latestRemovedXid; } xl_heap_cleanup_info; #define SizeOfHeapCleanupInfo (sizeof(xl_heap_cleanup_info)) /* This is for replacing a page's contents in toto */ /* NB: this is used for indexes as well as heaps */ typedef struct xl_heap_newpage { RelFileNode node; ForkNumber forknum; BlockNumber blkno; /* location of new page */ /* entire page contents follow at end of record */ } xl_heap_newpage; #define SizeOfHeapNewpage (offsetof(xl_heap_newpage, blkno) + sizeof(BlockNumber)) /* This is what we need to know about lock */ typedef struct xl_heap_lock { xl_heaptid target; /* locked tuple id */ TransactionId locking_xid; /* might be a MultiXactId not xid */ bool xid_is_mxact; /* is it? */ bool shared_lock; /* shared or exclusive row lock? */ } xl_heap_lock; #define SizeOfHeapLock (offsetof(xl_heap_lock, shared_lock) + sizeof(bool)) /* This is what we need to know about in-place update */ typedef struct xl_heap_inplace { xl_heaptid target; /* updated tuple id */ /* TUPLE DATA FOLLOWS AT END OF STRUCT */ } xl_heap_inplace; #define SizeOfHeapInplace (offsetof(xl_heap_inplace, target) + SizeOfHeapTid) /* This is what we need to know about tuple freezing during vacuum */ typedef struct xl_heap_freeze { RelFileNode node; BlockNumber block; TransactionId cutoff_xid; /* TUPLE OFFSET NUMBERS FOLLOW AT THE END */ } xl_heap_freeze; #define SizeOfHeapFreeze (offsetof(xl_heap_freeze, cutoff_xid) + sizeof(TransactionId)) /* This is what we need to know about setting a visibility map bit */ typedef struct xl_heap_visible { RelFileNode node; BlockNumber block; TransactionId cutoff_xid; } xl_heap_visible; #define SizeOfHeapVisible (offsetof(xl_heap_visible, cutoff_xid) + sizeof(TransactionId)) extern void HeapTupleHeaderAdvanceLatestRemovedXid(HeapTupleHeader tuple, TransactionId *latestRemovedXid); /* HeapTupleHeader functions implemented in utils/time/combocid.c */ extern CommandId HeapTupleHeaderGetCmin(HeapTupleHeader tup); extern CommandId HeapTupleHeaderGetCmax(HeapTupleHeader tup); extern void HeapTupleHeaderAdjustCmax(HeapTupleHeader tup, CommandId *cmax, bool *iscombo); /* ---------------- * fastgetattr * * Fetch a user attribute's value as a Datum (might be either a * value, or a pointer into the data area of the tuple). * * This must not be used when a system attribute might be requested. * Furthermore, the passed attnum MUST be valid. Use heap_getattr() * instead, if in doubt. * * This gets called many times, so we macro the cacheable and NULL * lookups, and call nocachegetattr() for the rest. * ---------------- */ #if !defined(DISABLE_COMPLEX_MACRO) #define fastgetattr(tup, attnum, tupleDesc, isnull) \ ( \ AssertMacro((attnum) > 0), \ (*(isnull) = false), \ HeapTupleNoNulls(tup) ? \ ( \ (tupleDesc)->attrs[(attnum)-1]->attcacheoff >= 0 ? \ ( \ fetchatt((tupleDesc)->attrs[(attnum)-1], \ (char *) (tup)->t_data + (tup)->t_data->t_hoff + \ (tupleDesc)->attrs[(attnum)-1]->attcacheoff) \ ) \ : \ nocachegetattr((tup), (attnum), (tupleDesc)) \ ) \ : \ ( \ att_isnull((attnum)-1, (tup)->t_data->t_bits) ? \ ( \ (*(isnull) = true), \ (Datum)NULL \ ) \ : \ ( \ nocachegetattr((tup), (attnum), (tupleDesc)) \ ) \ ) \ ) #else /* defined(DISABLE_COMPLEX_MACRO) */ extern Datum fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull); #endif /* defined(DISABLE_COMPLEX_MACRO) */ /* ---------------- * heap_getattr * * Extract an attribute of a heap tuple and return it as a Datum. * This works for either system or user attributes. The given attnum * is properly range-checked. * * If the field in question has a NULL value, we return a zero Datum * and set *isnull == true. Otherwise, we set *isnull == false. * * <tup> is the pointer to the heap tuple. <attnum> is the attribute * number of the column (field) caller wants. <tupleDesc> is a * pointer to the structure describing the row and all its fields. * ---------------- */ #define heap_getattr(tup, attnum, tupleDesc, isnull) \ ( \ ((attnum) > 0) ? \ ( \ ((attnum) > (int) HeapTupleHeaderGetNatts((tup)->t_data)) ? \ ( \ (*(isnull) = true), \ (Datum)NULL \ ) \ : \ fastgetattr((tup), (attnum), (tupleDesc), (isnull)) \ ) \ : \ heap_getsysattr((tup), (attnum), (tupleDesc), (isnull)) \ ) /* prototypes for functions in common/heaptuple.c */ extern Size heap_compute_data_size(TupleDesc tupleDesc, Datum *values, bool *isnull); extern void heap_fill_tuple(TupleDesc tupleDesc, Datum *values, bool *isnull, char *data, Size data_size, uint16 *infomask, bits8 *bit); extern bool heap_attisnull(HeapTuple tup, int attnum); extern Datum nocachegetattr(HeapTuple tup, int attnum, TupleDesc att); extern Datum heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull); extern HeapTuple heap_copytuple(HeapTuple tuple); extern void heap_copytuple_with_tuple(HeapTuple src, HeapTuple dest); extern Datum heap_copy_tuple_as_datum(HeapTuple tuple, TupleDesc tupleDesc); extern HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull); extern HeapTuple heap_modify_tuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *replValues, bool *replIsnull, bool *doReplace); extern void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *values, bool *isnull); /* these three are deprecated versions of the three above: */ extern HeapTuple heap_formtuple(TupleDesc tupleDescriptor, Datum *values, char *nulls); extern HeapTuple heap_modifytuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *replValues, char *replNulls, char *replActions); extern void heap_deformtuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *values, char *nulls); extern void heap_freetuple(HeapTuple htup); extern MinimalTuple heap_form_minimal_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull); extern void heap_free_minimal_tuple(MinimalTuple mtup); extern MinimalTuple heap_copy_minimal_tuple(MinimalTuple mtup); extern HeapTuple heap_tuple_from_minimal_tuple(MinimalTuple mtup); extern MinimalTuple minimal_tuple_from_heap_tuple(HeapTuple htup); #endif /* HTUP_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/spgist_private.h����������������������������������������������������������������0000644�����������������00000054160�14763166026�0013676 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * spgist_private.h * Private declarations for SP-GiST access method. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/spgist_private.h * *------------------------------------------------------------------------- */ #ifndef SPGIST_PRIVATE_H #define SPGIST_PRIVATE_H #include "access/itup.h" #include "access/spgist.h" #include "nodes/tidbitmap.h" #include "utils/rel.h" /* Page numbers of fixed-location pages */ #define SPGIST_METAPAGE_BLKNO (0) /* metapage */ #define SPGIST_ROOT_BLKNO (1) /* root for normal entries */ #define SPGIST_NULL_BLKNO (2) /* root for null-value entries */ #define SPGIST_LAST_FIXED_BLKNO SPGIST_NULL_BLKNO #define SpGistBlockIsRoot(blkno) \ ((blkno) == SPGIST_ROOT_BLKNO || (blkno) == SPGIST_NULL_BLKNO) #define SpGistBlockIsFixed(blkno) \ ((BlockNumber) (blkno) <= (BlockNumber) SPGIST_LAST_FIXED_BLKNO) /* * Contents of page special space on SPGiST index pages */ typedef struct SpGistPageOpaqueData { uint16 flags; /* see bit definitions below */ uint16 nRedirection; /* number of redirection tuples on page */ uint16 nPlaceholder; /* number of placeholder tuples on page */ /* note there's no count of either LIVE or DEAD tuples ... */ uint16 spgist_page_id; /* for identification of SP-GiST indexes */ } SpGistPageOpaqueData; typedef SpGistPageOpaqueData *SpGistPageOpaque; /* Flag bits in page special space */ #define SPGIST_META (1<<0) #define SPGIST_DELETED (1<<1) /* never set, but keep for backwards * compatibility */ #define SPGIST_LEAF (1<<2) #define SPGIST_NULLS (1<<3) #define SpGistPageGetOpaque(page) ((SpGistPageOpaque) PageGetSpecialPointer(page)) #define SpGistPageIsMeta(page) (SpGistPageGetOpaque(page)->flags & SPGIST_META) #define SpGistPageIsDeleted(page) (SpGistPageGetOpaque(page)->flags & SPGIST_DELETED) #define SpGistPageIsLeaf(page) (SpGistPageGetOpaque(page)->flags & SPGIST_LEAF) #define SpGistPageStoresNulls(page) (SpGistPageGetOpaque(page)->flags & SPGIST_NULLS) /* * The page ID is for the convenience of pg_filedump and similar utilities, * which otherwise would have a hard time telling pages of different index * types apart. It should be the last 2 bytes on the page. This is more or * less "free" due to alignment considerations. */ #define SPGIST_PAGE_ID 0xFF82 /* * Each backend keeps a cache of last-used page info in its index->rd_amcache * area. This is initialized from, and occasionally written back to, * shared storage in the index metapage. */ typedef struct SpGistLastUsedPage { BlockNumber blkno; /* block number, or InvalidBlockNumber */ int freeSpace; /* page's free space (could be obsolete!) */ } SpGistLastUsedPage; /* Note: indexes in cachedPage[] match flag assignments for SpGistGetBuffer */ #define SPGIST_CACHED_PAGES 8 typedef struct SpGistLUPCache { SpGistLastUsedPage cachedPage[SPGIST_CACHED_PAGES]; } SpGistLUPCache; /* * metapage */ typedef struct SpGistMetaPageData { uint32 magicNumber; /* for identity cross-check */ SpGistLUPCache lastUsedPages; /* shared storage of last-used info */ } SpGistMetaPageData; #define SPGIST_MAGIC_NUMBER (0xBA0BABEE) #define SpGistPageGetMeta(p) \ ((SpGistMetaPageData *) PageGetContents(p)) /* * Private state of index AM. SpGistState is common to both insert and * search code; SpGistScanOpaque is for searches only. */ /* Per-datatype info needed in SpGistState */ typedef struct SpGistTypeDesc { Oid type; bool attbyval; int16 attlen; } SpGistTypeDesc; typedef struct SpGistState { spgConfigOut config; /* filled in by opclass config method */ SpGistTypeDesc attType; /* type of input data and leaf values */ SpGistTypeDesc attPrefixType; /* type of inner-tuple prefix values */ SpGistTypeDesc attLabelType; /* type of node label values */ char *deadTupleStorage; /* workspace for spgFormDeadTuple */ TransactionId myXid; /* XID to use when creating a redirect tuple */ bool isBuild; /* true if doing index build */ } SpGistState; /* * Private state of an index scan */ typedef struct SpGistScanOpaqueData { SpGistState state; /* see above */ MemoryContext tempCxt; /* short-lived memory context */ /* Control flags showing whether to search nulls and/or non-nulls */ bool searchNulls; /* scan matches (all) null entries */ bool searchNonNulls; /* scan matches (some) non-null entries */ /* Index quals to be passed to opclass (null-related quals removed) */ int numberOfKeys; /* number of index qualifier conditions */ ScanKey keyData; /* array of index qualifier descriptors */ /* Stack of yet-to-be-visited pages */ List *scanStack; /* List of ScanStackEntrys */ /* These fields are only used in amgetbitmap scans: */ TIDBitmap *tbm; /* bitmap being filled */ int64 ntids; /* number of TIDs passed to bitmap */ /* These fields are only used in amgettuple scans: */ bool want_itup; /* are we reconstructing tuples? */ TupleDesc indexTupDesc; /* if so, tuple descriptor for them */ int nPtrs; /* number of TIDs found on current page */ int iPtr; /* index for scanning through same */ ItemPointerData heapPtrs[MaxIndexTuplesPerPage]; /* TIDs from cur page */ bool recheck[MaxIndexTuplesPerPage]; /* their recheck flags */ IndexTuple indexTups[MaxIndexTuplesPerPage]; /* reconstructed tuples */ /* * Note: using MaxIndexTuplesPerPage above is a bit hokey since * SpGistLeafTuples aren't exactly IndexTuples; however, they are larger, * so this is safe. */ } SpGistScanOpaqueData; typedef SpGistScanOpaqueData *SpGistScanOpaque; /* * This struct is what we actually keep in index->rd_amcache. It includes * static configuration information as well as the lastUsedPages cache. */ typedef struct SpGistCache { spgConfigOut config; /* filled in by opclass config method */ SpGistTypeDesc attType; /* type of input data and leaf values */ SpGistTypeDesc attPrefixType; /* type of inner-tuple prefix values */ SpGistTypeDesc attLabelType; /* type of node label values */ SpGistLUPCache lastUsedPages; /* local storage of last-used info */ } SpGistCache; /* * SPGiST tuple types. Note: inner, leaf, and dead tuple structs * must have the same tupstate field in the same position! Real inner and * leaf tuples always have tupstate = LIVE; if the state is something else, * use the SpGistDeadTuple struct to inspect the tuple. */ /* values of tupstate (see README for more info) */ #define SPGIST_LIVE 0 /* normal live tuple (either inner or leaf) */ #define SPGIST_REDIRECT 1 /* temporary redirection placeholder */ #define SPGIST_DEAD 2 /* dead, cannot be removed because of links */ #define SPGIST_PLACEHOLDER 3 /* placeholder, used to preserve offsets */ /* * SPGiST inner tuple: list of "nodes" that subdivide a set of tuples * * Inner tuple layout: * header/optional prefix/array of nodes, which are SpGistNodeTuples * * size and prefixSize must be multiples of MAXALIGN */ typedef struct SpGistInnerTupleData { unsigned int tupstate:2, /* LIVE/REDIRECT/DEAD/PLACEHOLDER */ allTheSame:1, /* all nodes in tuple are equivalent */ nNodes:13, /* number of nodes within inner tuple */ prefixSize:16; /* size of prefix, or 0 if none */ uint16 size; /* total size of inner tuple */ /* On most machines there will be a couple of wasted bytes here */ /* prefix datum follows, then nodes */ } SpGistInnerTupleData; typedef SpGistInnerTupleData *SpGistInnerTuple; /* these must match largest values that fit in bit fields declared above */ #define SGITMAXNNODES 0x1FFF #define SGITMAXPREFIXSIZE 0xFFFF #define SGITMAXSIZE 0xFFFF #define SGITHDRSZ MAXALIGN(sizeof(SpGistInnerTupleData)) #define _SGITDATA(x) (((char *) (x)) + SGITHDRSZ) #define SGITDATAPTR(x) ((x)->prefixSize ? _SGITDATA(x) : NULL) #define SGITDATUM(x, s) ((x)->prefixSize ? \ ((s)->attPrefixType.attbyval ? \ *(Datum *) _SGITDATA(x) : \ PointerGetDatum(_SGITDATA(x))) \ : (Datum) 0) #define SGITNODEPTR(x) ((SpGistNodeTuple) (_SGITDATA(x) + (x)->prefixSize)) /* Macro for iterating through the nodes of an inner tuple */ #define SGITITERATE(x, i, nt) \ for ((i) = 0, (nt) = SGITNODEPTR(x); \ (i) < (x)->nNodes; \ (i)++, (nt) = (SpGistNodeTuple) (((char *) (nt)) + IndexTupleSize(nt))) /* * SPGiST node tuple: one node within an inner tuple * * Node tuples use the same header as ordinary Postgres IndexTuples, but * we do not use a null bitmap, because we know there is only one column * so the INDEX_NULL_MASK bit suffices. Also, pass-by-value datums are * stored as a full Datum, the same convention as for inner tuple prefixes * and leaf tuple datums. */ typedef IndexTupleData SpGistNodeTupleData; typedef SpGistNodeTupleData *SpGistNodeTuple; #define SGNTHDRSZ MAXALIGN(sizeof(SpGistNodeTupleData)) #define SGNTDATAPTR(x) (((char *) (x)) + SGNTHDRSZ) #define SGNTDATUM(x, s) ((s)->attLabelType.attbyval ? \ *(Datum *) SGNTDATAPTR(x) : \ PointerGetDatum(SGNTDATAPTR(x))) /* * SPGiST leaf tuple: carries a datum and a heap tuple TID * * In the simplest case, the datum is the same as the indexed value; but * it could also be a suffix or some other sort of delta that permits * reconstruction given knowledge of the prefix path traversed to get here. * * The size field is wider than could possibly be needed for an on-disk leaf * tuple, but this allows us to form leaf tuples even when the datum is too * wide to be stored immediately, and it costs nothing because of alignment * considerations. * * Normally, nextOffset links to the next tuple belonging to the same parent * node (which must be on the same page). But when the root page is a leaf * page, we don't chain its tuples, so nextOffset is always 0 on the root. * * size must be a multiple of MAXALIGN; also, it must be at least SGDTSIZE * so that the tuple can be converted to REDIRECT status later. (This * restriction only adds bytes for the null-datum case, otherwise alignment * restrictions force it anyway.) * * In a leaf tuple for a NULL indexed value, there's no useful datum value; * however, the SGDTSIZE limit ensures that's there's a Datum word there * anyway, so SGLTDATUM can be applied safely as long as you don't do * anything with the result. */ typedef struct SpGistLeafTupleData { unsigned int tupstate:2, /* LIVE/REDIRECT/DEAD/PLACEHOLDER */ size:30; /* large enough for any palloc'able value */ OffsetNumber nextOffset; /* next tuple in chain, or InvalidOffset */ ItemPointerData heapPtr; /* TID of represented heap tuple */ /* leaf datum follows */ } SpGistLeafTupleData; typedef SpGistLeafTupleData *SpGistLeafTuple; #define SGLTHDRSZ MAXALIGN(sizeof(SpGistLeafTupleData)) #define SGLTDATAPTR(x) (((char *) (x)) + SGLTHDRSZ) #define SGLTDATUM(x, s) ((s)->attType.attbyval ? \ *(Datum *) SGLTDATAPTR(x) : \ PointerGetDatum(SGLTDATAPTR(x))) /* * SPGiST dead tuple: declaration for examining non-live tuples * * The tupstate field of this struct must match those of regular inner and * leaf tuples, and its size field must match a leaf tuple's. * Also, the pointer field must be in the same place as a leaf tuple's heapPtr * field, to satisfy some Asserts that we make when replacing a leaf tuple * with a dead tuple. * We don't use nextOffset, but it's needed to align the pointer field. * pointer and xid are only valid when tupstate = REDIRECT. */ typedef struct SpGistDeadTupleData { unsigned int tupstate:2, /* LIVE/REDIRECT/DEAD/PLACEHOLDER */ size:30; OffsetNumber nextOffset; /* not used in dead tuples */ ItemPointerData pointer; /* redirection inside index */ TransactionId xid; /* ID of xact that inserted this tuple */ } SpGistDeadTupleData; typedef SpGistDeadTupleData *SpGistDeadTuple; #define SGDTSIZE MAXALIGN(sizeof(SpGistDeadTupleData)) /* * Macros for doing free-space calculations. Note that when adding up the * space needed for tuples, we always consider each tuple to need the tuple's * size plus sizeof(ItemIdData) (for the line pointer). This works correctly * so long as tuple sizes are always maxaligned. */ /* Page capacity after allowing for fixed header and special space */ #define SPGIST_PAGE_CAPACITY \ MAXALIGN_DOWN(BLCKSZ - \ SizeOfPageHeaderData - \ MAXALIGN(sizeof(SpGistPageOpaqueData))) /* * Compute free space on page, assuming that up to n placeholders can be * recycled if present (n should be the number of tuples to be inserted) */ #define SpGistPageGetFreeSpace(p, n) \ (PageGetExactFreeSpace(p) + \ Min(SpGistPageGetOpaque(p)->nPlaceholder, n) * \ (SGDTSIZE + sizeof(ItemIdData))) /* * XLOG stuff * * ACCEPT_RDATA_* can only use fixed-length rdata arrays, because of lengthof */ #define ACCEPT_RDATA_DATA(p, s, i) \ do { \ Assert((i) < lengthof(rdata)); \ rdata[i].data = (char *) (p); \ rdata[i].len = (s); \ rdata[i].buffer = InvalidBuffer; \ rdata[i].buffer_std = true; \ rdata[i].next = NULL; \ if ((i) > 0) \ rdata[(i) - 1].next = rdata + (i); \ } while(0) #define ACCEPT_RDATA_BUFFER(b, i) \ do { \ Assert((i) < lengthof(rdata)); \ rdata[i].data = NULL; \ rdata[i].len = 0; \ rdata[i].buffer = (b); \ rdata[i].buffer_std = true; \ rdata[i].next = NULL; \ if ((i) > 0) \ rdata[(i) - 1].next = rdata + (i); \ } while(0) /* XLOG record types for SPGiST */ #define XLOG_SPGIST_CREATE_INDEX 0x00 #define XLOG_SPGIST_ADD_LEAF 0x10 #define XLOG_SPGIST_MOVE_LEAFS 0x20 #define XLOG_SPGIST_ADD_NODE 0x30 #define XLOG_SPGIST_SPLIT_TUPLE 0x40 #define XLOG_SPGIST_PICKSPLIT 0x50 #define XLOG_SPGIST_VACUUM_LEAF 0x60 #define XLOG_SPGIST_VACUUM_ROOT 0x70 #define XLOG_SPGIST_VACUUM_REDIRECT 0x80 /* * Some redo functions need an SpGistState, although only a few of its fields * need to be valid. spgxlogState carries the required info in xlog records. * (See fillFakeState in spgxlog.c for more comments.) */ typedef struct spgxlogState { TransactionId myXid; bool isBuild; } spgxlogState; #define STORE_STATE(s, d) \ do { \ (d).myXid = (s)->myXid; \ (d).isBuild = (s)->isBuild; \ } while(0) typedef struct spgxlogAddLeaf { RelFileNode node; BlockNumber blknoLeaf; /* destination page for leaf tuple */ bool newPage; /* init dest page? */ bool storesNulls; /* page is in the nulls tree? */ OffsetNumber offnumLeaf; /* offset where leaf tuple gets placed */ OffsetNumber offnumHeadLeaf; /* offset of head tuple in chain, if any */ BlockNumber blknoParent; /* where the parent downlink is, if any */ OffsetNumber offnumParent; uint16 nodeI; /* * new leaf tuple follows, on an intalign boundary (replay only needs to * fetch its size field, so that should be enough alignment) */ } spgxlogAddLeaf; typedef struct spgxlogMoveLeafs { RelFileNode node; BlockNumber blknoSrc; /* source leaf page */ BlockNumber blknoDst; /* destination leaf page */ uint16 nMoves; /* number of tuples moved from source page */ bool newPage; /* init dest page? */ bool replaceDead; /* are we replacing a DEAD source tuple? */ bool storesNulls; /* pages are in the nulls tree? */ BlockNumber blknoParent; /* where the parent downlink is */ OffsetNumber offnumParent; uint16 nodeI; spgxlogState stateSrc; /*---------- * data follows: * array of deleted tuple numbers, length nMoves * array of inserted tuple numbers, length nMoves + 1 or 1 * list of leaf tuples, length nMoves + 1 or 1 (must be maxaligned) * the tuple number arrays are padded to maxalign boundaries so that the * leaf tuples will be suitably aligned * * Note: if replaceDead is true then there is only one inserted tuple * number and only one leaf tuple in the data, because we are not copying * the dead tuple from the source * * Buffer references in the rdata array are: * Src page * Dest page * Parent page *---------- */ } spgxlogMoveLeafs; typedef struct spgxlogAddNode { RelFileNode node; BlockNumber blkno; /* block number of original inner tuple */ OffsetNumber offnum; /* offset of original inner tuple */ BlockNumber blknoParent; /* where parent downlink is, if updated */ OffsetNumber offnumParent; uint16 nodeI; BlockNumber blknoNew; /* where new tuple goes, if not same place */ OffsetNumber offnumNew; bool newPage; /* init new page? */ spgxlogState stateSrc; /* * updated inner tuple follows, on an intalign boundary (replay only needs * to fetch its size field, so that should be enough alignment) */ } spgxlogAddNode; typedef struct spgxlogSplitTuple { RelFileNode node; BlockNumber blknoPrefix; /* where the prefix tuple goes */ OffsetNumber offnumPrefix; BlockNumber blknoPostfix; /* where the postfix tuple goes */ OffsetNumber offnumPostfix; bool newPage; /* need to init that page? */ /* * new prefix inner tuple follows, then new postfix inner tuple, on * intalign boundaries (replay only needs to fetch size fields, so that * should be enough alignment) */ } spgxlogSplitTuple; typedef struct spgxlogPickSplit { RelFileNode node; BlockNumber blknoSrc; /* original leaf page */ BlockNumber blknoDest; /* other leaf page, if any */ uint16 nDelete; /* n to delete from Src */ uint16 nInsert; /* n to insert on Src and/or Dest */ bool initSrc; /* re-init the Src page? */ bool initDest; /* re-init the Dest page? */ BlockNumber blknoInner; /* where to put new inner tuple */ OffsetNumber offnumInner; bool initInner; /* re-init the Inner page? */ bool storesNulls; /* pages are in the nulls tree? */ BlockNumber blknoParent; /* where the parent downlink is, if any */ OffsetNumber offnumParent; uint16 nodeI; spgxlogState stateSrc; /*---------- * data follows: * new inner tuple (assumed to have a maxaligned length) * array of deleted tuple numbers, length nDelete * array of inserted tuple numbers, length nInsert * array of page selector bytes for inserted tuples, length nInsert * list of leaf tuples, length nInsert (must be maxaligned) * the tuple number and page selector arrays are padded to maxalign * boundaries so that the leaf tuples will be suitably aligned * * Buffer references in the rdata array are: * Src page (only if not root and not being init'd) * Dest page (if used and not being init'd) * Inner page (only if not being init'd) * Parent page (if any; could be same as Inner) *---------- */ } spgxlogPickSplit; typedef struct spgxlogVacuumLeaf { RelFileNode node; BlockNumber blkno; /* block number to clean */ uint16 nDead; /* number of tuples to become DEAD */ uint16 nPlaceholder; /* number of tuples to become PLACEHOLDER */ uint16 nMove; /* number of tuples to move */ uint16 nChain; /* number of tuples to re-chain */ spgxlogState stateSrc; /*---------- * data follows: * tuple numbers to become DEAD * tuple numbers to become PLACEHOLDER * tuple numbers to move from (and replace with PLACEHOLDER) * tuple numbers to move to (replacing what is there) * tuple numbers to update nextOffset links of * tuple numbers to insert in nextOffset links *---------- */ } spgxlogVacuumLeaf; typedef struct spgxlogVacuumRoot { /* vacuum a root page when it is also a leaf */ RelFileNode node; BlockNumber blkno; /* block number to clean */ uint16 nDelete; /* number of tuples to delete */ spgxlogState stateSrc; /* offsets of tuples to delete follow */ } spgxlogVacuumRoot; typedef struct spgxlogVacuumRedirect { RelFileNode node; BlockNumber blkno; /* block number to clean */ uint16 nToPlaceholder; /* number of redirects to make placeholders */ OffsetNumber firstPlaceholder; /* first placeholder tuple to remove */ TransactionId newestRedirectXid; /* newest XID of removed redirects */ /* offsets of redirect tuples to make placeholders follow */ } spgxlogVacuumRedirect; /* * The "flags" argument for SpGistGetBuffer should be either GBUF_LEAF to * get a leaf page, or GBUF_INNER_PARITY(blockNumber) to get an inner * page in the same triple-parity group as the specified block number. * (Typically, this should be GBUF_INNER_PARITY(parentBlockNumber + 1) * to follow the rule described in spgist/README.) * In addition, GBUF_NULLS can be OR'd in to get a page for storage of * null-valued tuples. * * Note: these flag values are used as indexes into lastUsedPages. */ #define GBUF_LEAF 0x03 #define GBUF_INNER_PARITY(x) ((x) % 3) #define GBUF_NULLS 0x04 #define GBUF_PARITY_MASK 0x03 #define GBUF_REQ_LEAF(flags) (((flags) & GBUF_PARITY_MASK) == GBUF_LEAF) #define GBUF_REQ_NULLS(flags) ((flags) & GBUF_NULLS) /* spgutils.c */ extern SpGistCache *spgGetCache(Relation index); extern void initSpGistState(SpGistState *state, Relation index); extern Buffer SpGistNewBuffer(Relation index); extern void SpGistUpdateMetaPage(Relation index); extern Buffer SpGistGetBuffer(Relation index, int flags, int needSpace, bool *isNew); extern void SpGistSetLastUsedPage(Relation index, Buffer buffer); extern void SpGistInitPage(Page page, uint16 f); extern void SpGistInitBuffer(Buffer b, uint16 f); extern void SpGistInitMetapage(Page page); extern unsigned int SpGistGetTypeSize(SpGistTypeDesc *att, Datum datum); extern SpGistLeafTuple spgFormLeafTuple(SpGistState *state, ItemPointer heapPtr, Datum datum, bool isnull); extern SpGistNodeTuple spgFormNodeTuple(SpGistState *state, Datum label, bool isnull); extern SpGistInnerTuple spgFormInnerTuple(SpGistState *state, bool hasPrefix, Datum prefix, int nNodes, SpGistNodeTuple *nodes); extern SpGistDeadTuple spgFormDeadTuple(SpGistState *state, int tupstate, BlockNumber blkno, OffsetNumber offnum); extern Datum *spgExtractNodeLabels(SpGistState *state, SpGistInnerTuple innerTuple); extern OffsetNumber SpGistPageAddNewItem(SpGistState *state, Page page, Item item, Size size, OffsetNumber *startOffset, bool errorOK); /* spgdoinsert.c */ extern void spgUpdateNodeLink(SpGistInnerTuple tup, int nodeN, BlockNumber blkno, OffsetNumber offset); extern void spgPageIndexMultiDelete(SpGistState *state, Page page, OffsetNumber *itemnos, int nitems, int firststate, int reststate, BlockNumber blkno, OffsetNumber offnum); extern bool spgdoinsert(Relation index, SpGistState *state, ItemPointer heapPtr, Datum datum, bool isnull); #endif /* SPGIST_PRIVATE_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/transam.h�����������������������������������������������������������������������0000644�����������������00000014022�14763166026�0012271 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * transam.h * postgres transaction access method support code * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/transam.h * *------------------------------------------------------------------------- */ #ifndef TRANSAM_H #define TRANSAM_H #include "access/xlogdefs.h" /* ---------------- * Special transaction ID values * * BootstrapTransactionId is the XID for "bootstrap" operations, and * FrozenTransactionId is used for very old tuples. Both should * always be considered valid. * * FirstNormalTransactionId is the first "normal" transaction id. * Note: if you need to change it, you must change pg_class.h as well. * ---------------- */ #define InvalidTransactionId ((TransactionId) 0) #define BootstrapTransactionId ((TransactionId) 1) #define FrozenTransactionId ((TransactionId) 2) #define FirstNormalTransactionId ((TransactionId) 3) #define MaxTransactionId ((TransactionId) 0xFFFFFFFF) /* ---------------- * transaction ID manipulation macros * ---------------- */ #define TransactionIdIsValid(xid) ((xid) != InvalidTransactionId) #define TransactionIdIsNormal(xid) ((xid) >= FirstNormalTransactionId) #define TransactionIdEquals(id1, id2) ((id1) == (id2)) #define TransactionIdStore(xid, dest) (*(dest) = (xid)) #define StoreInvalidTransactionId(dest) (*(dest) = InvalidTransactionId) /* advance a transaction ID variable, handling wraparound correctly */ #define TransactionIdAdvance(dest) \ do { \ (dest)++; \ if ((dest) < FirstNormalTransactionId) \ (dest) = FirstNormalTransactionId; \ } while(0) /* back up a transaction ID variable, handling wraparound correctly */ #define TransactionIdRetreat(dest) \ do { \ (dest)--; \ } while ((dest) < FirstNormalTransactionId) /* compare two XIDs already known to be normal; this is a macro for speed */ #define NormalTransactionIdPrecedes(id1, id2) \ (AssertMacro(TransactionIdIsNormal(id1) && TransactionIdIsNormal(id2)), \ (int32) ((id1) - (id2)) < 0) /* ---------- * Object ID (OID) zero is InvalidOid. * * OIDs 1-9999 are reserved for manual assignment (see the files * in src/include/catalog/). * * OIDS 10000-16383 are reserved for assignment during initdb * using the OID generator. (We start the generator at 10000.) * * OIDs beginning at 16384 are assigned from the OID generator * during normal multiuser operation. (We force the generator up to * 16384 as soon as we are in normal operation.) * * The choices of 10000 and 16384 are completely arbitrary, and can be moved * if we run low on OIDs in either category. Changing the macros below * should be sufficient to do this. * * NOTE: if the OID generator wraps around, we skip over OIDs 0-16383 * and resume with 16384. This minimizes the odds of OID conflict, by not * reassigning OIDs that might have been assigned during initdb. * ---------- */ #define FirstBootstrapObjectId 10000 #define FirstNormalObjectId 16384 /* * VariableCache is a data structure in shared memory that is used to track * OID and XID assignment state. For largely historical reasons, there is * just one struct with different fields that are protected by different * LWLocks. * * Note: xidWrapLimit and oldestXidDB are not "active" values, but are * used just to generate useful messages when xidWarnLimit or xidStopLimit * are exceeded. */ typedef struct VariableCacheData { /* * These fields are protected by OidGenLock. */ Oid nextOid; /* next OID to assign */ uint32 oidCount; /* OIDs available before must do XLOG work */ /* * These fields are protected by XidGenLock. */ TransactionId nextXid; /* next XID to assign */ TransactionId oldestXid; /* cluster-wide minimum datfrozenxid */ TransactionId xidVacLimit; /* start forcing autovacuums here */ TransactionId xidWarnLimit; /* start complaining here */ TransactionId xidStopLimit; /* refuse to advance nextXid beyond here */ TransactionId xidWrapLimit; /* where the world ends */ Oid oldestXidDB; /* database with minimum datfrozenxid */ /* * These fields are protected by ProcArrayLock. */ TransactionId latestCompletedXid; /* newest XID that has committed or * aborted */ } VariableCacheData; typedef VariableCacheData *VariableCache; /* ---------------- * extern declarations * ---------------- */ /* in transam/xact.c */ extern bool TransactionStartedDuringRecovery(void); /* in transam/varsup.c */ extern PGDLLIMPORT VariableCache ShmemVariableCache; /* in transam/transam.c */ extern const XLogRecPtr InvalidXLogRecPtr; /* * prototypes for functions in transam/transam.c */ extern bool TransactionIdDidCommit(TransactionId transactionId); extern bool TransactionIdDidAbort(TransactionId transactionId); extern bool TransactionIdIsKnownCompleted(TransactionId transactionId); extern void TransactionIdAbort(TransactionId transactionId); extern void TransactionIdCommitTree(TransactionId xid, int nxids, TransactionId *xids); extern void TransactionIdAsyncCommitTree(TransactionId xid, int nxids, TransactionId *xids, XLogRecPtr lsn); extern void TransactionIdAbortTree(TransactionId xid, int nxids, TransactionId *xids); extern bool TransactionIdPrecedes(TransactionId id1, TransactionId id2); extern bool TransactionIdPrecedesOrEquals(TransactionId id1, TransactionId id2); extern bool TransactionIdFollows(TransactionId id1, TransactionId id2); extern bool TransactionIdFollowsOrEquals(TransactionId id1, TransactionId id2); extern TransactionId TransactionIdLatest(TransactionId mainxid, int nxids, const TransactionId *xids); extern XLogRecPtr TransactionIdGetCommitLSN(TransactionId xid); /* in transam/varsup.c */ extern TransactionId GetNewTransactionId(bool isSubXact); extern TransactionId ReadNewTransactionId(void); extern void SetTransactionIdLimit(TransactionId oldest_datfrozenxid, Oid oldest_datoid); extern bool ForceTransactionIdLimitUpdate(void); extern Oid GetNewObjectId(void); #endif /* TRAMSAM_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/gist.h��������������������������������������������������������������������������0000644�����������������00000015225�14763166026�0011600 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * gist.h * The public API for GiST indexes. This API is exposed to * individuals implementing GiST indexes, so backward-incompatible * changes should be made with care. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/gist.h * *------------------------------------------------------------------------- */ #ifndef GIST_H #define GIST_H #include "access/xlog.h" #include "access/xlogdefs.h" #include "storage/block.h" #include "storage/bufpage.h" #include "utils/relcache.h" /* * amproc indexes for GiST indexes. */ #define GIST_CONSISTENT_PROC 1 #define GIST_UNION_PROC 2 #define GIST_COMPRESS_PROC 3 #define GIST_DECOMPRESS_PROC 4 #define GIST_PENALTY_PROC 5 #define GIST_PICKSPLIT_PROC 6 #define GIST_EQUAL_PROC 7 #define GIST_DISTANCE_PROC 8 #define GISTNProcs 8 /* * strategy numbers for GiST opclasses that want to implement the old * RTREE behavior. */ #define RTLeftStrategyNumber 1 #define RTOverLeftStrategyNumber 2 #define RTOverlapStrategyNumber 3 #define RTOverRightStrategyNumber 4 #define RTRightStrategyNumber 5 #define RTSameStrategyNumber 6 #define RTContainsStrategyNumber 7 /* for @> */ #define RTContainedByStrategyNumber 8 /* for <@ */ #define RTOverBelowStrategyNumber 9 #define RTBelowStrategyNumber 10 #define RTAboveStrategyNumber 11 #define RTOverAboveStrategyNumber 12 #define RTOldContainsStrategyNumber 13 /* for old spelling of @> */ #define RTOldContainedByStrategyNumber 14 /* for old spelling of <@ */ #define RTKNNSearchStrategyNumber 15 /* * Page opaque data in a GiST index page. */ #define F_LEAF (1 << 0) /* leaf page */ #define F_DELETED (1 << 1) /* the page has been deleted */ #define F_TUPLES_DELETED (1 << 2) /* some tuples on the page are dead */ #define F_FOLLOW_RIGHT (1 << 3) /* page to the right has no downlink */ typedef XLogRecPtr GistNSN; typedef struct GISTPageOpaqueData { GistNSN nsn; /* this value must change on page split */ BlockNumber rightlink; /* next page if any */ uint16 flags; /* see bit definitions above */ uint16 gist_page_id; /* for identification of GiST indexes */ } GISTPageOpaqueData; typedef GISTPageOpaqueData *GISTPageOpaque; /* * The page ID is for the convenience of pg_filedump and similar utilities, * which otherwise would have a hard time telling pages of different index * types apart. It should be the last 2 bytes on the page. This is more or * less "free" due to alignment considerations. */ #define GIST_PAGE_ID 0xFF81 /* * This is the Split Vector to be returned by the PickSplit method. * PickSplit should fill the indexes of tuples to go to the left side into * spl_left[], and those to go to the right into spl_right[] (note the method * is responsible for palloc'ing both of these arrays!). The tuple counts * go into spl_nleft/spl_nright, and spl_ldatum/spl_rdatum must be set to * the union keys for each side. * * If spl_ldatum_exists and spl_rdatum_exists are true, then we are performing * a "secondary split" using a non-first index column. In this case some * decisions have already been made about a page split, and the set of tuples * being passed to PickSplit is just the tuples about which we are undecided. * spl_ldatum/spl_rdatum then contain the union keys for the tuples already * chosen to go left or right. Ideally the PickSplit method should take those * keys into account while deciding what to do with the remaining tuples, ie * it should try to "build out" from those unions so as to minimally expand * them. If it does so, it should union the given tuples' keys into the * existing spl_ldatum/spl_rdatum values rather than just setting those values * from scratch, and then set spl_ldatum_exists/spl_rdatum_exists to false to * show it has done this. * * If the PickSplit method fails to clear spl_ldatum_exists/spl_rdatum_exists, * the core GiST code will make its own decision about how to merge the * secondary-split results with the previously-chosen tuples, and will then * recompute the union keys from scratch. This is a workable though often not * optimal approach. */ typedef struct GIST_SPLITVEC { OffsetNumber *spl_left; /* array of entries that go left */ int spl_nleft; /* size of this array */ Datum spl_ldatum; /* Union of keys in spl_left */ bool spl_ldatum_exists; /* true, if spl_ldatum already exists. */ OffsetNumber *spl_right; /* array of entries that go right */ int spl_nright; /* size of the array */ Datum spl_rdatum; /* Union of keys in spl_right */ bool spl_rdatum_exists; /* true, if spl_rdatum already exists. */ } GIST_SPLITVEC; /* * An entry on a GiST node. Contains the key, as well as its own * location (rel,page,offset) which can supply the matching pointer. * leafkey is a flag to tell us if the entry is in a leaf node. */ typedef struct GISTENTRY { Datum key; Relation rel; Page page; OffsetNumber offset; bool leafkey; } GISTENTRY; #define GistPageGetOpaque(page) ( (GISTPageOpaque) PageGetSpecialPointer(page) ) #define GistPageIsLeaf(page) ( GistPageGetOpaque(page)->flags & F_LEAF) #define GIST_LEAF(entry) (GistPageIsLeaf((entry)->page)) #define GistPageSetLeaf(page) ( GistPageGetOpaque(page)->flags |= F_LEAF) #define GistPageSetNonLeaf(page) ( GistPageGetOpaque(page)->flags &= ~F_LEAF) #define GistPageIsDeleted(page) ( GistPageGetOpaque(page)->flags & F_DELETED) #define GistPageSetDeleted(page) ( GistPageGetOpaque(page)->flags |= F_DELETED) #define GistPageSetNonDeleted(page) ( GistPageGetOpaque(page)->flags &= ~F_DELETED) #define GistTuplesDeleted(page) ( GistPageGetOpaque(page)->flags & F_TUPLES_DELETED) #define GistMarkTuplesDeleted(page) ( GistPageGetOpaque(page)->flags |= F_TUPLES_DELETED) #define GistClearTuplesDeleted(page) ( GistPageGetOpaque(page)->flags &= ~F_TUPLES_DELETED) #define GistFollowRight(page) ( GistPageGetOpaque(page)->flags & F_FOLLOW_RIGHT) #define GistMarkFollowRight(page) ( GistPageGetOpaque(page)->flags |= F_FOLLOW_RIGHT) #define GistClearFollowRight(page) ( GistPageGetOpaque(page)->flags &= ~F_FOLLOW_RIGHT) /* * Vector of GISTENTRY structs; user-defined methods union and picksplit * take it as one of their arguments */ typedef struct { int32 n; /* number of elements */ GISTENTRY vector[FLEXIBLE_ARRAY_MEMBER]; } GistEntryVector; #define GEVHDRSZ (offsetof(GistEntryVector, vector)) /* * macro to initialize a GISTENTRY */ #define gistentryinit(e, k, r, pg, o, l) \ do { (e).key = (k); (e).rel = (r); (e).page = (pg); \ (e).offset = (o); (e).leafkey = (l); } while (0) #endif /* GIST_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/xlog_internal.h�����������������������������������������������������������������0000644�����������������00000022541�14763166026�0013476 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * xlog_internal.h * * PostgreSQL transaction log internal declarations * * NOTE: this file is intended to contain declarations useful for * manipulating the XLOG files directly, but it is not supposed to be * needed by rmgr routines (redo support for individual record types). * So the XLogRecord typedef and associated stuff appear in xlog.h. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/xlog_internal.h */ #ifndef XLOG_INTERNAL_H #define XLOG_INTERNAL_H #include "access/xlog.h" #include "fmgr.h" #include "pgtime.h" #include "storage/block.h" #include "storage/relfilenode.h" /* * Header info for a backup block appended to an XLOG record. * * As a trivial form of data compression, the XLOG code is aware that * PG data pages usually contain an unused "hole" in the middle, which * contains only zero bytes. If hole_length > 0 then we have removed * such a "hole" from the stored data (and it's not counted in the * XLOG record's CRC, either). Hence, the amount of block data actually * present following the BkpBlock struct is BLCKSZ - hole_length bytes. * * Note that we don't attempt to align either the BkpBlock struct or the * block's data. So, the struct must be copied to aligned local storage * before use. */ typedef struct BkpBlock { RelFileNode node; /* relation containing block */ ForkNumber fork; /* fork within the relation */ BlockNumber block; /* block number */ uint16 hole_offset; /* number of bytes before "hole" */ uint16 hole_length; /* number of bytes in "hole" */ /* ACTUAL BLOCK DATA FOLLOWS AT END OF STRUCT */ } BkpBlock; /* * When there is not enough space on current page for whole record, we * continue on the next page with continuation record. (However, the * XLogRecord header will never be split across pages; if there's less than * SizeOfXLogRecord space left at the end of a page, we just waste it.) * * Note that xl_rem_len includes backup-block data; that is, it tracks * xl_tot_len not xl_len in the initial header. Also note that the * continuation data isn't necessarily aligned. */ typedef struct XLogContRecord { uint32 xl_rem_len; /* total len of remaining data for record */ /* ACTUAL LOG DATA FOLLOWS AT END OF STRUCT */ } XLogContRecord; #define SizeOfXLogContRecord sizeof(XLogContRecord) /* * Each page of XLOG file has a header like this: */ #define XLOG_PAGE_MAGIC 0xD071 /* can be used as WAL version indicator */ typedef struct XLogPageHeaderData { uint16 xlp_magic; /* magic value for correctness checks */ uint16 xlp_info; /* flag bits, see below */ TimeLineID xlp_tli; /* TimeLineID of first record on page */ XLogRecPtr xlp_pageaddr; /* XLOG address of this page */ } XLogPageHeaderData; #define SizeOfXLogShortPHD MAXALIGN(sizeof(XLogPageHeaderData)) typedef XLogPageHeaderData *XLogPageHeader; /* * When the XLP_LONG_HEADER flag is set, we store additional fields in the * page header. (This is ordinarily done just in the first page of an * XLOG file.) The additional fields serve to identify the file accurately. */ typedef struct XLogLongPageHeaderData { XLogPageHeaderData std; /* standard header fields */ uint64 xlp_sysid; /* system identifier from pg_control */ uint32 xlp_seg_size; /* just as a cross-check */ uint32 xlp_xlog_blcksz; /* just as a cross-check */ } XLogLongPageHeaderData; #define SizeOfXLogLongPHD MAXALIGN(sizeof(XLogLongPageHeaderData)) typedef XLogLongPageHeaderData *XLogLongPageHeader; /* When record crosses page boundary, set this flag in new page's header */ #define XLP_FIRST_IS_CONTRECORD 0x0001 /* This flag indicates a "long" page header */ #define XLP_LONG_HEADER 0x0002 /* This flag indicates backup blocks starting in this page are optional */ #define XLP_BKP_REMOVABLE 0x0004 /* All defined flag bits in xlp_info (used for validity checking of header) */ #define XLP_ALL_FLAGS 0x0007 #define XLogPageHeaderSize(hdr) \ (((hdr)->xlp_info & XLP_LONG_HEADER) ? SizeOfXLogLongPHD : SizeOfXLogShortPHD) /* * We break each logical log file (xlogid value) into segment files of the * size indicated by XLOG_SEG_SIZE. One possible segment at the end of each * log file is wasted, to ensure that we don't have problems representing * last-byte-position-plus-1. */ #define XLogSegSize ((uint32) XLOG_SEG_SIZE) #define XLogSegsPerFile (((uint32) 0xffffffff) / XLogSegSize) #define XLogFileSize (XLogSegsPerFile * XLogSegSize) /* * Macros for manipulating XLOG pointers */ /* Increment an xlogid/segment pair */ #define NextLogSeg(logId, logSeg) \ do { \ if ((logSeg) >= XLogSegsPerFile-1) \ { \ (logId)++; \ (logSeg) = 0; \ } \ else \ (logSeg)++; \ } while (0) /* Decrement an xlogid/segment pair (assume it's not 0,0) */ #define PrevLogSeg(logId, logSeg) \ do { \ if (logSeg) \ (logSeg)--; \ else \ { \ (logId)--; \ (logSeg) = XLogSegsPerFile-1; \ } \ } while (0) /* Align a record pointer to next page */ #define NextLogPage(recptr) \ do { \ if ((recptr).xrecoff % XLOG_BLCKSZ != 0) \ (recptr).xrecoff += \ (XLOG_BLCKSZ - (recptr).xrecoff % XLOG_BLCKSZ); \ if ((recptr).xrecoff >= XLogFileSize) \ { \ ((recptr).xlogid)++; \ (recptr).xrecoff = 0; \ } \ } while (0) /* * Compute ID and segment from an XLogRecPtr. * * For XLByteToSeg, do the computation at face value. For XLByteToPrevSeg, * a boundary byte is taken to be in the previous segment. This is suitable * for deciding which segment to write given a pointer to a record end, * for example. (We can assume xrecoff is not zero, since no valid recptr * can have that.) */ #define XLByteToSeg(xlrp, logId, logSeg) \ ( logId = (xlrp).xlogid, \ logSeg = (xlrp).xrecoff / XLogSegSize \ ) #define XLByteToPrevSeg(xlrp, logId, logSeg) \ ( logId = (xlrp).xlogid, \ logSeg = ((xlrp).xrecoff - 1) / XLogSegSize \ ) /* * Is an XLogRecPtr within a particular XLOG segment? * * For XLByteInSeg, do the computation at face value. For XLByteInPrevSeg, * a boundary byte is taken to be in the previous segment. */ #define XLByteInSeg(xlrp, logId, logSeg) \ ((xlrp).xlogid == (logId) && \ (xlrp).xrecoff / XLogSegSize == (logSeg)) #define XLByteInPrevSeg(xlrp, logId, logSeg) \ ((xlrp).xlogid == (logId) && \ ((xlrp).xrecoff - 1) / XLogSegSize == (logSeg)) /* Check if an xrecoff value is in a plausible range */ #define XRecOffIsValid(xrecoff) \ ((xrecoff) % XLOG_BLCKSZ >= SizeOfXLogShortPHD && \ (XLOG_BLCKSZ - (xrecoff) % XLOG_BLCKSZ) >= SizeOfXLogRecord) /* * The XLog directory and control file (relative to $PGDATA) */ #define XLOGDIR "pg_xlog" #define XLOG_CONTROL_FILE "global/pg_control" /* * These macros encapsulate knowledge about the exact layout of XLog file * names, timeline history file names, and archive-status file names. */ #define MAXFNAMELEN 64 #define XLogFileName(fname, tli, log, seg) \ snprintf(fname, MAXFNAMELEN, "%08X%08X%08X", tli, log, seg) #define XLogFromFileName(fname, tli, log, seg) \ sscanf(fname, "%08X%08X%08X", tli, log, seg) #define XLogFilePath(path, tli, log, seg) \ snprintf(path, MAXPGPATH, XLOGDIR "/%08X%08X%08X", tli, log, seg) #define TLHistoryFileName(fname, tli) \ snprintf(fname, MAXFNAMELEN, "%08X.history", tli) #define TLHistoryFilePath(path, tli) \ snprintf(path, MAXPGPATH, XLOGDIR "/%08X.history", tli) #define StatusFilePath(path, xlog, suffix) \ snprintf(path, MAXPGPATH, XLOGDIR "/archive_status/%s%s", xlog, suffix) #define BackupHistoryFileName(fname, tli, log, seg, offset) \ snprintf(fname, MAXFNAMELEN, "%08X%08X%08X.%08X.backup", tli, log, seg, offset) #define BackupHistoryFilePath(path, tli, log, seg, offset) \ snprintf(path, MAXPGPATH, XLOGDIR "/%08X%08X%08X.%08X.backup", tli, log, seg, offset) /* * Method table for resource managers. * * RmgrTable[] is indexed by RmgrId values (see rmgr.h). */ typedef struct RmgrData { const char *rm_name; void (*rm_redo) (XLogRecPtr lsn, XLogRecord *rptr); void (*rm_desc) (StringInfo buf, uint8 xl_info, char *rec); void (*rm_startup) (void); void (*rm_cleanup) (void); bool (*rm_safe_restartpoint) (void); } RmgrData; extern const RmgrData RmgrTable[]; /* * Exported to support xlog switching from checkpointer */ extern pg_time_t GetLastSegSwitchTime(void); extern XLogRecPtr RequestXLogSwitch(void); /* * Exported to support xlog archive status setting from WALReceiver */ extern void XLogArchiveForceDone(const char *xlog); /* * These aren't in xlog.h because I'd rather not include fmgr.h there. */ extern Datum pg_start_backup(PG_FUNCTION_ARGS); extern Datum pg_stop_backup(PG_FUNCTION_ARGS); extern Datum pg_switch_xlog(PG_FUNCTION_ARGS); extern Datum pg_create_restore_point(PG_FUNCTION_ARGS); extern Datum pg_current_xlog_location(PG_FUNCTION_ARGS); extern Datum pg_current_xlog_insert_location(PG_FUNCTION_ARGS); extern Datum pg_last_xlog_receive_location(PG_FUNCTION_ARGS); extern Datum pg_last_xlog_replay_location(PG_FUNCTION_ARGS); extern Datum pg_last_xact_replay_timestamp(PG_FUNCTION_ARGS); extern Datum pg_xlogfile_name_offset(PG_FUNCTION_ARGS); extern Datum pg_xlogfile_name(PG_FUNCTION_ARGS); extern Datum pg_is_in_recovery(PG_FUNCTION_ARGS); extern Datum pg_xlog_replay_pause(PG_FUNCTION_ARGS); extern Datum pg_xlog_replay_resume(PG_FUNCTION_ARGS); extern Datum pg_is_xlog_replay_paused(PG_FUNCTION_ARGS); extern Datum pg_xlog_location_diff(PG_FUNCTION_ARGS); #endif /* XLOG_INTERNAL_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/gin_private.h�������������������������������������������������������������������0000644�����������������00000055577�14763166026�0013157 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*-------------------------------------------------------------------------- * gin_private.h * header file for postgres inverted index access method implementation. * * Copyright (c) 2006-2012, PostgreSQL Global Development Group * * src/include/access/gin_private.h *-------------------------------------------------------------------------- */ #ifndef GIN_PRIVATE_H #define GIN_PRIVATE_H #include "access/genam.h" #include "access/gin.h" #include "access/itup.h" #include "fmgr.h" #include "storage/bufmgr.h" #include "utils/rbtree.h" /* * Page opaque data in a inverted index page. * * Note: GIN does not include a page ID word as do the other index types. * This is OK because the opaque data is only 8 bytes and so can be reliably * distinguished by size. Revisit this if the size ever increases. * Further note: as of 9.2, SP-GiST also uses 8-byte special space. This is * still OK, as long as GIN isn't using all of the high-order bits in its * flags word, because that way the flags word cannot match the page ID used * by SP-GiST. */ typedef struct GinPageOpaqueData { BlockNumber rightlink; /* next page if any */ OffsetNumber maxoff; /* number entries on GIN_DATA page: number of * heap ItemPointers on GIN_DATA|GIN_LEAF page * or number of PostingItems on GIN_DATA & * ~GIN_LEAF page. On GIN_LIST page, number of * heap tuples. */ uint16 flags; /* see bit definitions below */ } GinPageOpaqueData; typedef GinPageOpaqueData *GinPageOpaque; #define GIN_DATA (1 << 0) #define GIN_LEAF (1 << 1) #define GIN_DELETED (1 << 2) #define GIN_META (1 << 3) #define GIN_LIST (1 << 4) #define GIN_LIST_FULLROW (1 << 5) /* makes sense only on GIN_LIST page */ /* Page numbers of fixed-location pages */ #define GIN_METAPAGE_BLKNO (0) #define GIN_ROOT_BLKNO (1) typedef struct GinMetaPageData { /* * Pointers to head and tail of pending list, which consists of GIN_LIST * pages. These store fast-inserted entries that haven't yet been moved * into the regular GIN structure. */ BlockNumber head; BlockNumber tail; /* * Free space in bytes in the pending list's tail page. */ uint32 tailFreeSize; /* * We store both number of pages and number of heap tuples that are in the * pending list. */ BlockNumber nPendingPages; int64 nPendingHeapTuples; /* * Statistics for planner use (accurate as of last VACUUM) */ BlockNumber nTotalPages; BlockNumber nEntryPages; BlockNumber nDataPages; int64 nEntries; /* * GIN version number (ideally this should have been at the front, but too * late now. Don't move it!) * * Currently 1 (for indexes initialized in 9.1 or later) * * Version 0 (indexes initialized in 9.0 or before) is compatible but may * be missing null entries, including both null keys and placeholders. * Reject full-index-scan attempts on such indexes. */ int32 ginVersion; } GinMetaPageData; #define GIN_CURRENT_VERSION 1 #define GinPageGetMeta(p) \ ((GinMetaPageData *) PageGetContents(p)) /* * Macros for accessing a GIN index page's opaque data */ #define GinPageGetOpaque(page) ( (GinPageOpaque) PageGetSpecialPointer(page) ) #define GinPageIsLeaf(page) ( (GinPageGetOpaque(page)->flags & GIN_LEAF) != 0 ) #define GinPageSetLeaf(page) ( GinPageGetOpaque(page)->flags |= GIN_LEAF ) #define GinPageSetNonLeaf(page) ( GinPageGetOpaque(page)->flags &= ~GIN_LEAF ) #define GinPageIsData(page) ( (GinPageGetOpaque(page)->flags & GIN_DATA) != 0 ) #define GinPageSetData(page) ( GinPageGetOpaque(page)->flags |= GIN_DATA ) #define GinPageIsList(page) ( (GinPageGetOpaque(page)->flags & GIN_LIST) != 0 ) #define GinPageSetList(page) ( GinPageGetOpaque(page)->flags |= GIN_LIST ) #define GinPageHasFullRow(page) ( (GinPageGetOpaque(page)->flags & GIN_LIST_FULLROW) != 0 ) #define GinPageSetFullRow(page) ( GinPageGetOpaque(page)->flags |= GIN_LIST_FULLROW ) #define GinPageIsDeleted(page) ( (GinPageGetOpaque(page)->flags & GIN_DELETED) != 0 ) #define GinPageSetDeleted(page) ( GinPageGetOpaque(page)->flags |= GIN_DELETED) #define GinPageSetNonDeleted(page) ( GinPageGetOpaque(page)->flags &= ~GIN_DELETED) #define GinPageRightMost(page) ( GinPageGetOpaque(page)->rightlink == InvalidBlockNumber) /* * We use our own ItemPointerGet(BlockNumber|GetOffsetNumber) * to avoid Asserts, since sometimes the ip_posid isn't "valid" */ #define GinItemPointerGetBlockNumber(pointer) \ BlockIdGetBlockNumber(&(pointer)->ip_blkid) #define GinItemPointerGetOffsetNumber(pointer) \ ((pointer)->ip_posid) /* * Special-case item pointer values needed by the GIN search logic. * MIN: sorts less than any valid item pointer * MAX: sorts greater than any valid item pointer * LOSSY PAGE: indicates a whole heap page, sorts after normal item * pointers for that page * Note that these are all distinguishable from an "invalid" item pointer * (which is InvalidBlockNumber/0) as well as from all normal item * pointers (which have item numbers in the range 1..MaxHeapTuplesPerPage). */ #define ItemPointerSetMin(p) \ ItemPointerSet((p), (BlockNumber)0, (OffsetNumber)0) #define ItemPointerIsMin(p) \ (GinItemPointerGetOffsetNumber(p) == (OffsetNumber)0 && \ GinItemPointerGetBlockNumber(p) == (BlockNumber)0) #define ItemPointerSetMax(p) \ ItemPointerSet((p), InvalidBlockNumber, (OffsetNumber)0xffff) #define ItemPointerIsMax(p) \ (GinItemPointerGetOffsetNumber(p) == (OffsetNumber)0xffff && \ GinItemPointerGetBlockNumber(p) == InvalidBlockNumber) #define ItemPointerSetLossyPage(p, b) \ ItemPointerSet((p), (b), (OffsetNumber)0xffff) #define ItemPointerIsLossyPage(p) \ (GinItemPointerGetOffsetNumber(p) == (OffsetNumber)0xffff && \ GinItemPointerGetBlockNumber(p) != InvalidBlockNumber) /* * Posting item in a non-leaf posting-tree page */ typedef struct { /* We use BlockIdData not BlockNumber to avoid padding space wastage */ BlockIdData child_blkno; ItemPointerData key; } PostingItem; #define PostingItemGetBlockNumber(pointer) \ BlockIdGetBlockNumber(&(pointer)->child_blkno) #define PostingItemSetBlockNumber(pointer, blockNumber) \ BlockIdSet(&((pointer)->child_blkno), (blockNumber)) /* * Category codes to distinguish placeholder nulls from ordinary NULL keys. * Note that the datatype size and the first two code values are chosen to be * compatible with the usual usage of bool isNull flags. * * GIN_CAT_EMPTY_QUERY is never stored in the index; and notice that it is * chosen to sort before not after regular key values. */ typedef signed char GinNullCategory; #define GIN_CAT_NORM_KEY 0 /* normal, non-null key value */ #define GIN_CAT_NULL_KEY 1 /* null key value */ #define GIN_CAT_EMPTY_ITEM 2 /* placeholder for zero-key item */ #define GIN_CAT_NULL_ITEM 3 /* placeholder for null item */ #define GIN_CAT_EMPTY_QUERY (-1) /* placeholder for full-scan query */ /* * Access macros for null category byte in entry tuples */ #define GinCategoryOffset(itup,ginstate) \ (IndexInfoFindDataOffset((itup)->t_info) + \ ((ginstate)->oneCol ? 0 : sizeof(int2))) #define GinGetNullCategory(itup,ginstate) \ (*((GinNullCategory *) ((char*)(itup) + GinCategoryOffset(itup,ginstate)))) #define GinSetNullCategory(itup,ginstate,c) \ (*((GinNullCategory *) ((char*)(itup) + GinCategoryOffset(itup,ginstate))) = (c)) /* * Access macros for leaf-page entry tuples (see discussion in README) */ #define GinGetNPosting(itup) GinItemPointerGetOffsetNumber(&(itup)->t_tid) #define GinSetNPosting(itup,n) ItemPointerSetOffsetNumber(&(itup)->t_tid,n) #define GIN_TREE_POSTING ((OffsetNumber)0xffff) #define GinIsPostingTree(itup) (GinGetNPosting(itup) == GIN_TREE_POSTING) #define GinSetPostingTree(itup, blkno) ( GinSetNPosting((itup),GIN_TREE_POSTING), ItemPointerSetBlockNumber(&(itup)->t_tid, blkno) ) #define GinGetPostingTree(itup) GinItemPointerGetBlockNumber(&(itup)->t_tid) #define GinGetPostingOffset(itup) GinItemPointerGetBlockNumber(&(itup)->t_tid) #define GinSetPostingOffset(itup,n) ItemPointerSetBlockNumber(&(itup)->t_tid,n) #define GinGetPosting(itup) ((ItemPointer) ((char*)(itup) + GinGetPostingOffset(itup))) #define GinMaxItemSize \ MAXALIGN_DOWN(((BLCKSZ - SizeOfPageHeaderData - \ MAXALIGN(sizeof(GinPageOpaqueData))) / 3 - sizeof(ItemIdData))) /* * Access macros for non-leaf entry tuples */ #define GinGetDownlink(itup) GinItemPointerGetBlockNumber(&(itup)->t_tid) #define GinSetDownlink(itup,blkno) ItemPointerSet(&(itup)->t_tid, blkno, InvalidOffsetNumber) /* * Data (posting tree) pages */ #define GinDataPageGetRightBound(page) ((ItemPointer) PageGetContents(page)) #define GinDataPageGetData(page) \ (PageGetContents(page) + MAXALIGN(sizeof(ItemPointerData))) #define GinSizeOfDataPageItem(page) \ (GinPageIsLeaf(page) ? sizeof(ItemPointerData) : sizeof(PostingItem)) #define GinDataPageGetItem(page,i) \ (GinDataPageGetData(page) + ((i)-1) * GinSizeOfDataPageItem(page)) #define GinDataPageGetFreeSpace(page) \ (BLCKSZ - MAXALIGN(SizeOfPageHeaderData) \ - MAXALIGN(sizeof(ItemPointerData)) \ - GinPageGetOpaque(page)->maxoff * GinSizeOfDataPageItem(page) \ - MAXALIGN(sizeof(GinPageOpaqueData))) #define GinMaxLeafDataItems \ ((BLCKSZ - MAXALIGN(SizeOfPageHeaderData) - \ MAXALIGN(sizeof(ItemPointerData)) - \ MAXALIGN(sizeof(GinPageOpaqueData))) \ / sizeof(ItemPointerData)) /* * List pages */ #define GinListPageSize \ ( BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(GinPageOpaqueData)) ) /* * Storage type for GIN's reloptions */ typedef struct GinOptions { int32 vl_len_; /* varlena header (do not touch directly!) */ bool useFastUpdate; /* use fast updates? */ } GinOptions; #define GIN_DEFAULT_USE_FASTUPDATE true #define GinGetUseFastUpdate(relation) \ ((relation)->rd_options ? \ ((GinOptions *) (relation)->rd_options)->useFastUpdate : GIN_DEFAULT_USE_FASTUPDATE) /* Macros for buffer lock/unlock operations */ #define GIN_UNLOCK BUFFER_LOCK_UNLOCK #define GIN_SHARE BUFFER_LOCK_SHARE #define GIN_EXCLUSIVE BUFFER_LOCK_EXCLUSIVE /* * GinState: working data structure describing the index being worked on */ typedef struct GinState { Relation index; bool oneCol; /* true if single-column index */ /* * origTupDesc is the nominal tuple descriptor of the index, ie, the i'th * attribute shows the key type (not the input data type!) of the i'th * index column. In a single-column index this describes the actual leaf * index tuples. In a multi-column index, the actual leaf tuples contain * a smallint column number followed by a key datum of the appropriate * type for that column. We set up tupdesc[i] to describe the actual * rowtype of the index tuples for the i'th column, ie, (int2, keytype). * Note that in any case, leaf tuples contain more data than is known to * the TupleDesc; see access/gin/README for details. */ TupleDesc origTupdesc; TupleDesc tupdesc[INDEX_MAX_KEYS]; /* * Per-index-column opclass support functions */ FmgrInfo compareFn[INDEX_MAX_KEYS]; FmgrInfo extractValueFn[INDEX_MAX_KEYS]; FmgrInfo extractQueryFn[INDEX_MAX_KEYS]; FmgrInfo consistentFn[INDEX_MAX_KEYS]; FmgrInfo comparePartialFn[INDEX_MAX_KEYS]; /* optional method */ /* canPartialMatch[i] is true if comparePartialFn[i] is valid */ bool canPartialMatch[INDEX_MAX_KEYS]; /* Collations to pass to the support functions */ Oid supportCollation[INDEX_MAX_KEYS]; } GinState; /* XLog stuff */ #define XLOG_GIN_CREATE_INDEX 0x00 #define XLOG_GIN_CREATE_PTREE 0x10 typedef struct ginxlogCreatePostingTree { RelFileNode node; BlockNumber blkno; uint32 nitem; /* follows list of heap's ItemPointer */ } ginxlogCreatePostingTree; #define XLOG_GIN_INSERT 0x20 typedef struct ginxlogInsert { RelFileNode node; BlockNumber blkno; BlockNumber updateBlkno; OffsetNumber offset; bool isDelete; bool isData; bool isLeaf; OffsetNumber nitem; /* * follows: tuples or ItemPointerData or PostingItem or list of * ItemPointerData */ } ginxlogInsert; #define XLOG_GIN_SPLIT 0x30 typedef struct ginxlogSplit { RelFileNode node; BlockNumber lblkno; BlockNumber rootBlkno; BlockNumber rblkno; BlockNumber rrlink; OffsetNumber separator; OffsetNumber nitem; bool isData; bool isLeaf; bool isRootSplit; BlockNumber leftChildBlkno; BlockNumber updateBlkno; ItemPointerData rightbound; /* used only in posting tree */ /* follows: list of tuple or ItemPointerData or PostingItem */ } ginxlogSplit; #define XLOG_GIN_VACUUM_PAGE 0x40 typedef struct ginxlogVacuumPage { RelFileNode node; BlockNumber blkno; OffsetNumber nitem; /* follows content of page */ } ginxlogVacuumPage; #define XLOG_GIN_DELETE_PAGE 0x50 typedef struct ginxlogDeletePage { RelFileNode node; BlockNumber blkno; BlockNumber parentBlkno; OffsetNumber parentOffset; BlockNumber leftBlkno; BlockNumber rightLink; } ginxlogDeletePage; #define XLOG_GIN_UPDATE_META_PAGE 0x60 typedef struct ginxlogUpdateMeta { RelFileNode node; GinMetaPageData metadata; BlockNumber prevTail; BlockNumber newRightlink; int32 ntuples; /* if ntuples > 0 then metadata.tail was * updated with that many tuples; else new sub * list was inserted */ /* array of inserted tuples follows */ } ginxlogUpdateMeta; #define XLOG_GIN_INSERT_LISTPAGE 0x70 typedef struct ginxlogInsertListPage { RelFileNode node; BlockNumber blkno; BlockNumber rightlink; int32 ntuples; /* array of inserted tuples follows */ } ginxlogInsertListPage; #define XLOG_GIN_DELETE_LISTPAGE 0x80 #define GIN_NDELETE_AT_ONCE 16 typedef struct ginxlogDeleteListPages { RelFileNode node; GinMetaPageData metadata; int32 ndeleted; BlockNumber toDelete[GIN_NDELETE_AT_ONCE]; } ginxlogDeleteListPages; /* ginutil.c */ extern Datum ginoptions(PG_FUNCTION_ARGS); extern void initGinState(GinState *state, Relation index); extern Buffer GinNewBuffer(Relation index); extern void GinInitBuffer(Buffer b, uint32 f); extern void GinInitPage(Page page, uint32 f, Size pageSize); extern void GinInitMetabuffer(Buffer b); extern int ginCompareEntries(GinState *ginstate, OffsetNumber attnum, Datum a, GinNullCategory categorya, Datum b, GinNullCategory categoryb); extern int ginCompareAttEntries(GinState *ginstate, OffsetNumber attnuma, Datum a, GinNullCategory categorya, OffsetNumber attnumb, Datum b, GinNullCategory categoryb); extern Datum *ginExtractEntries(GinState *ginstate, OffsetNumber attnum, Datum value, bool isNull, int32 *nentries, GinNullCategory **categories); extern OffsetNumber gintuple_get_attrnum(GinState *ginstate, IndexTuple tuple); extern Datum gintuple_get_key(GinState *ginstate, IndexTuple tuple, GinNullCategory *category); /* gininsert.c */ extern Datum ginbuild(PG_FUNCTION_ARGS); extern Datum ginbuildempty(PG_FUNCTION_ARGS); extern Datum gininsert(PG_FUNCTION_ARGS); extern void ginEntryInsert(GinState *ginstate, OffsetNumber attnum, Datum key, GinNullCategory category, ItemPointerData *items, uint32 nitem, GinStatsData *buildStats); /* ginbtree.c */ typedef struct GinBtreeStack { BlockNumber blkno; Buffer buffer; OffsetNumber off; /* predictNumber contains predicted number of pages on current level */ uint32 predictNumber; struct GinBtreeStack *parent; } GinBtreeStack; typedef struct GinBtreeData *GinBtree; typedef struct GinBtreeData { /* search methods */ BlockNumber (*findChildPage) (GinBtree, GinBtreeStack *); bool (*isMoveRight) (GinBtree, Page); bool (*findItem) (GinBtree, GinBtreeStack *); /* insert methods */ OffsetNumber (*findChildPtr) (GinBtree, Page, BlockNumber, OffsetNumber); BlockNumber (*getLeftMostPage) (GinBtree, Page); bool (*isEnoughSpace) (GinBtree, Buffer, OffsetNumber); void (*placeToPage) (GinBtree, Buffer, OffsetNumber, XLogRecData **); Page (*splitPage) (GinBtree, Buffer, Buffer, OffsetNumber, XLogRecData **); void (*fillRoot) (GinBtree, Buffer, Buffer, Buffer); bool isData; bool searchMode; Relation index; GinState *ginstate; /* not valid in a data scan */ bool fullScan; bool isBuild; BlockNumber rightblkno; /* Entry options */ OffsetNumber entryAttnum; Datum entryKey; GinNullCategory entryCategory; IndexTuple entry; bool isDelete; /* Data (posting tree) options */ ItemPointerData *items; uint32 nitem; uint32 curitem; PostingItem pitem; } GinBtreeData; extern GinBtreeStack *ginPrepareFindLeafPage(GinBtree btree, BlockNumber blkno); extern GinBtreeStack *ginFindLeafPage(GinBtree btree, GinBtreeStack *stack); extern Buffer ginStepRight(Buffer buffer, Relation index, int lockmode); extern void freeGinBtreeStack(GinBtreeStack *stack); extern void ginInsertValue(GinBtree btree, GinBtreeStack *stack, GinStatsData *buildStats); extern void ginFindParents(GinBtree btree, GinBtreeStack *stack, BlockNumber rootBlkno); /* ginentrypage.c */ extern IndexTuple GinFormTuple(GinState *ginstate, OffsetNumber attnum, Datum key, GinNullCategory category, ItemPointerData *ipd, uint32 nipd, bool errorTooBig); extern void GinShortenTuple(IndexTuple itup, uint32 nipd); extern void ginPrepareEntryScan(GinBtree btree, OffsetNumber attnum, Datum key, GinNullCategory category, GinState *ginstate); extern void ginEntryFillRoot(GinBtree btree, Buffer root, Buffer lbuf, Buffer rbuf); extern IndexTuple ginPageGetLinkItup(Buffer buf); /* gindatapage.c */ extern int ginCompareItemPointers(ItemPointer a, ItemPointer b); extern uint32 ginMergeItemPointers(ItemPointerData *dst, ItemPointerData *a, uint32 na, ItemPointerData *b, uint32 nb); extern void GinDataPageAddItem(Page page, void *data, OffsetNumber offset); extern void GinPageDeletePostingItem(Page page, OffsetNumber offset); typedef struct { GinBtreeData btree; GinBtreeStack *stack; } GinPostingTreeScan; extern GinPostingTreeScan *ginPrepareScanPostingTree(Relation index, BlockNumber rootBlkno, bool searchMode); extern void ginInsertItemPointers(GinPostingTreeScan *gdi, ItemPointerData *items, uint32 nitem, GinStatsData *buildStats); extern Buffer ginScanBeginPostingTree(GinPostingTreeScan *gdi); extern void ginDataFillRoot(GinBtree btree, Buffer root, Buffer lbuf, Buffer rbuf); extern void ginPrepareDataScan(GinBtree btree, Relation index); /* ginscan.c */ /* * GinScanKeyData describes a single GIN index qualifier expression. * * From each qual expression, we extract one or more specific index search * conditions, which are represented by GinScanEntryData. It's quite * possible for identical search conditions to be requested by more than * one qual expression, in which case we merge such conditions to have just * one unique GinScanEntry --- this is particularly important for efficiency * when dealing with full-index-scan entries. So there can be multiple * GinScanKeyData.scanEntry pointers to the same GinScanEntryData. * * In each GinScanKeyData, nentries is the true number of entries, while * nuserentries is the number that extractQueryFn returned (which is what * we report to consistentFn). The "user" entries must come first. */ typedef struct GinScanKeyData *GinScanKey; typedef struct GinScanEntryData *GinScanEntry; typedef struct GinScanKeyData { /* Real number of entries in scanEntry[] (always > 0) */ uint32 nentries; /* Number of entries that extractQueryFn and consistentFn know about */ uint32 nuserentries; /* array of GinScanEntry pointers, one per extracted search condition */ GinScanEntry *scanEntry; /* array of check flags, reported to consistentFn */ bool *entryRes; /* other data needed for calling consistentFn */ Datum query; /* NB: these three arrays have only nuserentries elements! */ Datum *queryValues; GinNullCategory *queryCategories; Pointer *extra_data; StrategyNumber strategy; int32 searchMode; OffsetNumber attnum; /* * Match status data. curItem is the TID most recently tested (could be a * lossy-page pointer). curItemMatches is TRUE if it passes the * consistentFn test; if so, recheckCurItem is the recheck flag. * isFinished means that all the input entry streams are finished, so this * key cannot succeed for any later TIDs. */ ItemPointerData curItem; bool curItemMatches; bool recheckCurItem; bool isFinished; } GinScanKeyData; typedef struct GinScanEntryData { /* query key and other information from extractQueryFn */ Datum queryKey; GinNullCategory queryCategory; bool isPartialMatch; Pointer extra_data; StrategyNumber strategy; int32 searchMode; OffsetNumber attnum; /* Current page in posting tree */ Buffer buffer; /* current ItemPointer to heap */ ItemPointerData curItem; /* for a partial-match or full-scan query, we accumulate all TIDs here */ TIDBitmap *matchBitmap; TBMIterator *matchIterator; TBMIterateResult *matchResult; /* used for Posting list and one page in Posting tree */ ItemPointerData *list; uint32 nlist; OffsetNumber offset; bool isFinished; bool reduceResult; uint32 predictNumberResult; } GinScanEntryData; typedef struct GinScanOpaqueData { MemoryContext tempCtx; GinState ginstate; GinScanKey keys; /* one per scan qualifier expr */ uint32 nkeys; GinScanEntry *entries; /* one per index search condition */ uint32 totalentries; uint32 allocentries; /* allocated length of entries[] */ bool isVoidRes; /* true if query is unsatisfiable */ } GinScanOpaqueData; typedef GinScanOpaqueData *GinScanOpaque; extern Datum ginbeginscan(PG_FUNCTION_ARGS); extern Datum ginendscan(PG_FUNCTION_ARGS); extern Datum ginrescan(PG_FUNCTION_ARGS); extern Datum ginmarkpos(PG_FUNCTION_ARGS); extern Datum ginrestrpos(PG_FUNCTION_ARGS); extern void ginNewScanKey(IndexScanDesc scan); /* ginget.c */ extern Datum gingetbitmap(PG_FUNCTION_ARGS); /* ginvacuum.c */ extern Datum ginbulkdelete(PG_FUNCTION_ARGS); extern Datum ginvacuumcleanup(PG_FUNCTION_ARGS); /* ginbulk.c */ typedef struct GinEntryAccumulator { RBNode rbnode; Datum key; GinNullCategory category; OffsetNumber attnum; bool shouldSort; ItemPointerData *list; uint32 maxcount; /* allocated size of list[] */ uint32 count; /* current number of list[] entries */ } GinEntryAccumulator; typedef struct { GinState *ginstate; long allocatedMemory; GinEntryAccumulator *entryallocator; uint32 eas_used; RBTree *tree; } BuildAccumulator; extern void ginInitBA(BuildAccumulator *accum); extern void ginInsertBAEntries(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum, Datum *entries, GinNullCategory *categories, int32 nentries); extern void ginBeginBAScan(BuildAccumulator *accum); extern ItemPointerData *ginGetBAEntry(BuildAccumulator *accum, OffsetNumber *attnum, Datum *key, GinNullCategory *category, uint32 *n); /* ginfast.c */ typedef struct GinTupleCollector { IndexTuple *tuples; uint32 ntuples; uint32 lentuples; uint32 sumsize; } GinTupleCollector; extern void ginHeapTupleFastInsert(GinState *ginstate, GinTupleCollector *collector); extern void ginHeapTupleFastCollect(GinState *ginstate, GinTupleCollector *collector, OffsetNumber attnum, Datum value, bool isNull, ItemPointer ht_ctid); extern void ginInsertCleanup(GinState *ginstate, bool vac_delay, IndexBulkDeleteResult *stats); #endif /* GIN_PRIVATE_H */ ���������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/printtup.h����������������������������������������������������������������������0000644�����������������00000002033�14763166026�0012510 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * printtup.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/printtup.h * *------------------------------------------------------------------------- */ #ifndef PRINTTUP_H #define PRINTTUP_H #include "utils/portal.h" extern DestReceiver *printtup_create_DR(CommandDest dest); extern void SetRemoteDestReceiverParams(DestReceiver *self, Portal portal); extern void SendRowDescriptionMessage(TupleDesc typeinfo, List *targetlist, int16 *formats); extern void debugStartup(DestReceiver *self, int operation, TupleDesc typeinfo); extern void debugtup(TupleTableSlot *slot, DestReceiver *self); /* XXX these are really in executor/spi.c */ extern void spi_dest_startup(DestReceiver *self, int operation, TupleDesc typeinfo); extern void spi_printtup(TupleTableSlot *slot, DestReceiver *self); #endif /* PRINTTUP_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/gist_private.h������������������������������������������������������������������0000644�����������������00000046133�14763166026�0013334 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * gist_private.h * private declarations for GiST -- declarations related to the * internal implementation of GiST, not the public API * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/gist_private.h * *------------------------------------------------------------------------- */ #ifndef GIST_PRIVATE_H #define GIST_PRIVATE_H #include "access/gist.h" #include "access/itup.h" #include "fmgr.h" #include "storage/bufmgr.h" #include "storage/buffile.h" #include "utils/rbtree.h" #include "utils/hsearch.h" /* * Maximum number of "halves" a page can be split into in one operation. * Typically a split produces 2 halves, but can be more if keys have very * different lengths, or when inserting multiple keys in one operation (as * when inserting downlinks to an internal node). There is no theoretical * limit on this, but in practice if you get more than a handful page halves * in one split, there's something wrong with the opclass implementation. * GIST_MAX_SPLIT_PAGES is an arbitrary limit on that, used to size some * local arrays used during split. Note that there is also a limit on the * number of buffers that can be held locked at a time, MAX_SIMUL_LWLOCKS, * so if you raise this higher than that limit, you'll just get a different * error. */ #define GIST_MAX_SPLIT_PAGES 75 /* Buffer lock modes */ #define GIST_SHARE BUFFER_LOCK_SHARE #define GIST_EXCLUSIVE BUFFER_LOCK_EXCLUSIVE #define GIST_UNLOCK BUFFER_LOCK_UNLOCK typedef struct { BlockNumber prev; uint32 freespace; char tupledata[1]; } GISTNodeBufferPage; #define BUFFER_PAGE_DATA_OFFSET MAXALIGN(offsetof(GISTNodeBufferPage, tupledata)) /* Returns free space in node buffer page */ #define PAGE_FREE_SPACE(nbp) (nbp->freespace) /* Checks if node buffer page is empty */ #define PAGE_IS_EMPTY(nbp) (nbp->freespace == BLCKSZ - BUFFER_PAGE_DATA_OFFSET) /* Checks if node buffers page don't contain sufficient space for index tuple */ #define PAGE_NO_SPACE(nbp, itup) (PAGE_FREE_SPACE(nbp) < \ MAXALIGN(IndexTupleSize(itup))) /* * GISTSTATE: information needed for any GiST index operation * * This struct retains call info for the index's opclass-specific support * functions (per index column), plus the index's tuple descriptor. * * scanCxt holds the GISTSTATE itself as well as any data that lives for the * lifetime of the index operation. We pass this to the support functions * via fn_mcxt, so that they can store scan-lifespan data in it. The * functions are invoked in tempCxt, which is typically short-lifespan * (that is, it's reset after each tuple). However, tempCxt can be the same * as scanCxt if we're not bothering with per-tuple context resets. */ typedef struct GISTSTATE { MemoryContext scanCxt; /* context for scan-lifespan data */ MemoryContext tempCxt; /* short-term context for calling functions */ TupleDesc tupdesc; /* index's tuple descriptor */ FmgrInfo consistentFn[INDEX_MAX_KEYS]; FmgrInfo unionFn[INDEX_MAX_KEYS]; FmgrInfo compressFn[INDEX_MAX_KEYS]; FmgrInfo decompressFn[INDEX_MAX_KEYS]; FmgrInfo penaltyFn[INDEX_MAX_KEYS]; FmgrInfo picksplitFn[INDEX_MAX_KEYS]; FmgrInfo equalFn[INDEX_MAX_KEYS]; FmgrInfo distanceFn[INDEX_MAX_KEYS]; /* Collations to pass to the support functions */ Oid supportCollation[INDEX_MAX_KEYS]; } GISTSTATE; /* * During a GiST index search, we must maintain a queue of unvisited items, * which can be either individual heap tuples or whole index pages. If it * is an ordered search, the unvisited items should be visited in distance * order. Unvisited items at the same distance should be visited in * depth-first order, that is heap items first, then lower index pages, then * upper index pages; this rule avoids doing extra work during a search that * ends early due to LIMIT. * * To perform an ordered search, we use an RBTree to manage the distance-order * queue. Each GISTSearchTreeItem stores all unvisited items of the same * distance; they are GISTSearchItems chained together via their next fields. * * In a non-ordered search (no order-by operators), the RBTree degenerates * to a single item, which we use as a queue of unvisited index pages only. * In this case matched heap items from the current index leaf page are * remembered in GISTScanOpaqueData.pageData[] and returned directly from * there, instead of building a separate GISTSearchItem for each one. */ /* Individual heap tuple to be visited */ typedef struct GISTSearchHeapItem { ItemPointerData heapPtr; bool recheck; /* T if quals must be rechecked */ } GISTSearchHeapItem; /* Unvisited item, either index page or heap tuple */ typedef struct GISTSearchItem { struct GISTSearchItem *next; /* list link */ BlockNumber blkno; /* index page number, or InvalidBlockNumber */ union { GistNSN parentlsn; /* parent page's LSN, if index page */ /* we must store parentlsn to detect whether a split occurred */ GISTSearchHeapItem heap; /* heap info, if heap tuple */ } data; } GISTSearchItem; #define GISTSearchItemIsHeap(item) ((item).blkno == InvalidBlockNumber) /* * Within a GISTSearchTreeItem's chain, heap items always appear before * index-page items, since we want to visit heap items first. lastHeap points * to the last heap item in the chain, or is NULL if there are none. */ typedef struct GISTSearchTreeItem { RBNode rbnode; /* this is an RBTree item */ GISTSearchItem *head; /* first chain member */ GISTSearchItem *lastHeap; /* last heap-tuple member, if any */ double distances[1]; /* array with numberOfOrderBys entries */ } GISTSearchTreeItem; #define GSTIHDRSZ offsetof(GISTSearchTreeItem, distances) /* * GISTScanOpaqueData: private state for a scan of a GiST index */ typedef struct GISTScanOpaqueData { GISTSTATE *giststate; /* index information, see above */ RBTree *queue; /* queue of unvisited items */ MemoryContext queueCxt; /* context holding the queue */ bool qual_ok; /* false if qual can never be satisfied */ bool firstCall; /* true until first gistgettuple call */ GISTSearchTreeItem *curTreeItem; /* current queue item, if any */ /* pre-allocated workspace arrays */ GISTSearchTreeItem *tmpTreeItem; /* workspace to pass to rb_insert */ double *distances; /* output area for gistindex_keytest */ /* In a non-ordered search, returnable heap items are stored here: */ GISTSearchHeapItem pageData[BLCKSZ / sizeof(IndexTupleData)]; OffsetNumber nPageData; /* number of valid items in array */ OffsetNumber curPageData; /* next item to return */ } GISTScanOpaqueData; typedef GISTScanOpaqueData *GISTScanOpaque; /* XLog stuff */ #define XLOG_GIST_PAGE_UPDATE 0x00 /* #define XLOG_GIST_NEW_ROOT 0x20 */ /* not used anymore */ #define XLOG_GIST_PAGE_SPLIT 0x30 /* #define XLOG_GIST_INSERT_COMPLETE 0x40 */ /* not used anymore */ #define XLOG_GIST_CREATE_INDEX 0x50 #define XLOG_GIST_PAGE_DELETE 0x60 typedef struct gistxlogPageUpdate { RelFileNode node; BlockNumber blkno; /* * If this operation completes a page split, by inserting a downlink for * the split page, leftchild points to the left half of the split. */ BlockNumber leftchild; /* number of deleted offsets */ uint16 ntodelete; /* * follow: 1. todelete OffsetNumbers 2. tuples to insert */ } gistxlogPageUpdate; typedef struct gistxlogPageSplit { RelFileNode node; BlockNumber origblkno; /* splitted page */ BlockNumber origrlink; /* rightlink of the page before split */ GistNSN orignsn; /* NSN of the page before split */ bool origleaf; /* was splitted page a leaf page? */ BlockNumber leftchild; /* like in gistxlogPageUpdate */ uint16 npage; /* # of pages in the split */ bool markfollowright; /* set F_FOLLOW_RIGHT flags */ /* * follow: 1. gistxlogPage and array of IndexTupleData per page */ } gistxlogPageSplit; typedef struct gistxlogPage { BlockNumber blkno; int num; /* number of index tuples following */ } gistxlogPage; typedef struct gistxlogPageDelete { RelFileNode node; BlockNumber blkno; } gistxlogPageDelete; /* SplitedPageLayout - gistSplit function result */ typedef struct SplitedPageLayout { gistxlogPage block; IndexTupleData *list; int lenlist; IndexTuple itup; /* union key for page */ Page page; /* to operate */ Buffer buffer; /* to write after all proceed */ struct SplitedPageLayout *next; } SplitedPageLayout; /* * GISTInsertStack used for locking buffers and transfer arguments during * insertion */ typedef struct GISTInsertStack { /* current page */ BlockNumber blkno; Buffer buffer; Page page; /* * log sequence number from page->lsn to recognize page update and compare * it with page's nsn to recognize page split */ GistNSN lsn; /* offset of the downlink in the parent page, that points to this page */ OffsetNumber downlinkoffnum; /* pointer to parent */ struct GISTInsertStack *parent; } GISTInsertStack; /* Working state and results for multi-column split logic in gistsplit.c */ typedef struct GistSplitVector { GIST_SPLITVEC splitVector; /* passed to/from user PickSplit method */ Datum spl_lattr[INDEX_MAX_KEYS]; /* Union of subkeys in * splitVector.spl_left */ bool spl_lisnull[INDEX_MAX_KEYS]; Datum spl_rattr[INDEX_MAX_KEYS]; /* Union of subkeys in * splitVector.spl_right */ bool spl_risnull[INDEX_MAX_KEYS]; bool *spl_dontcare; /* flags tuples which could go to either side * of the split for zero penalty */ } GistSplitVector; typedef struct { Relation r; Size freespace; /* free space to be left */ GISTInsertStack *stack; } GISTInsertState; /* root page of a gist index */ #define GIST_ROOT_BLKNO 0 /* * Before PostgreSQL 9.1, we used rely on so-called "invalid tuples" on inner * pages to finish crash recovery of incomplete page splits. If a crash * happened in the middle of a page split, so that the downlink pointers were * not yet inserted, crash recovery inserted a special downlink pointer. The * semantics of an invalid tuple was that it if you encounter one in a scan, * it must always be followed, because we don't know if the tuples on the * child page match or not. * * We no longer create such invalid tuples, we now mark the left-half of such * an incomplete split with the F_FOLLOW_RIGHT flag instead, and finish the * split properly the next time we need to insert on that page. To retain * on-disk compatibility for the sake of pg_upgrade, we still store 0xffff as * the offset number of all inner tuples. If we encounter any invalid tuples * with 0xfffe during insertion, we throw an error, though scans still handle * them. You should only encounter invalid tuples if you pg_upgrade a pre-9.1 * gist index which already has invalid tuples in it because of a crash. That * should be rare, and you are recommended to REINDEX anyway if you have any * invalid tuples in an index, so throwing an error is as far as we go with * supporting that. */ #define TUPLE_IS_VALID 0xffff #define TUPLE_IS_INVALID 0xfffe #define GistTupleIsInvalid(itup) ( ItemPointerGetOffsetNumber( &((itup)->t_tid) ) == TUPLE_IS_INVALID ) #define GistTupleSetValid(itup) ItemPointerSetOffsetNumber( &((itup)->t_tid), TUPLE_IS_VALID ) /* * A buffer attached to an internal node, used when building an index in * buffering mode. */ typedef struct { BlockNumber nodeBlocknum; /* index block # this buffer is for */ int32 blocksCount; /* current # of blocks occupied by buffer */ BlockNumber pageBlocknum; /* temporary file block # */ GISTNodeBufferPage *pageBuffer; /* in-memory buffer page */ /* is this buffer queued for emptying? */ bool queuedForEmptying; /* is this a temporary copy, not in the hash table? */ bool isTemp; int level; /* 0 == leaf */ } GISTNodeBuffer; /* * Does specified level have buffers? (Beware of multiple evaluation of * arguments.) */ #define LEVEL_HAS_BUFFERS(nlevel, gfbb) \ ((nlevel) != 0 && (nlevel) % (gfbb)->levelStep == 0 && \ (nlevel) != (gfbb)->rootlevel) /* Is specified buffer at least half-filled (should be queued for emptying)? */ #define BUFFER_HALF_FILLED(nodeBuffer, gfbb) \ ((nodeBuffer)->blocksCount > (gfbb)->pagesPerBuffer / 2) /* * Is specified buffer full? Our buffers can actually grow indefinitely, * beyond the "maximum" size, so this just means whether the buffer has grown * beyond the nominal maximum size. */ #define BUFFER_OVERFLOWED(nodeBuffer, gfbb) \ ((nodeBuffer)->blocksCount > (gfbb)->pagesPerBuffer) /* * Data structure with general information about build buffers. */ typedef struct GISTBuildBuffers { /* Persistent memory context for the buffers and metadata. */ MemoryContext context; BufFile *pfile; /* Temporary file to store buffers in */ long nFileBlocks; /* Current size of the temporary file */ /* * resizable array of free blocks. */ long *freeBlocks; int nFreeBlocks; /* # of currently free blocks in the array */ int freeBlocksLen; /* current allocated length of the array */ /* Hash for buffers by block number */ HTAB *nodeBuffersTab; /* List of buffers scheduled for emptying */ List *bufferEmptyingQueue; /* * Parameters to the buffering build algorithm. levelStep determines which * levels in the tree have buffers, and pagesPerBuffer determines how * large each buffer is. */ int levelStep; int pagesPerBuffer; /* Array of lists of buffers on each level, for final emptying */ List **buffersOnLevels; int buffersOnLevelsLen; /* * Dynamically-sized array of buffers that currently have their last page * loaded in main memory. */ GISTNodeBuffer **loadedBuffers; int loadedBuffersCount; /* # of entries in loadedBuffers */ int loadedBuffersLen; /* allocated size of loadedBuffers */ /* Level of the current root node (= height of the index tree - 1) */ int rootlevel; } GISTBuildBuffers; /* * Storage type for GiST's reloptions */ typedef struct GiSTOptions { int32 vl_len_; /* varlena header (do not touch directly!) */ int fillfactor; /* page fill factor in percent (0..100) */ int bufferingModeOffset; /* use buffering build? */ } GiSTOptions; /* gist.c */ extern Datum gistbuildempty(PG_FUNCTION_ARGS); extern Datum gistinsert(PG_FUNCTION_ARGS); extern MemoryContext createTempGistContext(void); extern GISTSTATE *initGISTstate(Relation index); extern void freeGISTstate(GISTSTATE *giststate); extern void gistdoinsert(Relation r, IndexTuple itup, Size freespace, GISTSTATE *GISTstate); /* A List of these is returned from gistplacetopage() in *splitinfo */ typedef struct { Buffer buf; /* the split page "half" */ IndexTuple downlink; /* downlink for this half. */ } GISTPageSplitInfo; extern bool gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate, Buffer buffer, IndexTuple *itup, int ntup, OffsetNumber oldoffnum, BlockNumber *newblkno, Buffer leftchildbuf, List **splitinfo, bool markleftchild); extern SplitedPageLayout *gistSplit(Relation r, Page page, IndexTuple *itup, int len, GISTSTATE *giststate); /* gistxlog.c */ extern void gist_redo(XLogRecPtr lsn, XLogRecord *record); extern void gist_desc(StringInfo buf, uint8 xl_info, char *rec); extern void gist_xlog_startup(void); extern void gist_xlog_cleanup(void); extern XLogRecPtr gistXLogUpdate(RelFileNode node, Buffer buffer, OffsetNumber *todelete, int ntodelete, IndexTuple *itup, int ntup, Buffer leftchild); extern XLogRecPtr gistXLogSplit(RelFileNode node, BlockNumber blkno, bool page_is_leaf, SplitedPageLayout *dist, BlockNumber origrlink, GistNSN oldnsn, Buffer leftchild, bool markfollowright); /* gistget.c */ extern Datum gistgettuple(PG_FUNCTION_ARGS); extern Datum gistgetbitmap(PG_FUNCTION_ARGS); /* gistutil.c */ #define GiSTPageSize \ ( BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(GISTPageOpaqueData)) ) #define GIST_MIN_FILLFACTOR 10 #define GIST_DEFAULT_FILLFACTOR 90 extern Datum gistoptions(PG_FUNCTION_ARGS); extern bool gistfitpage(IndexTuple *itvec, int len); extern bool gistnospace(Page page, IndexTuple *itvec, int len, OffsetNumber todelete, Size freespace); extern void gistcheckpage(Relation rel, Buffer buf); extern Buffer gistNewBuffer(Relation r); extern void gistfillbuffer(Page page, IndexTuple *itup, int len, OffsetNumber off); extern IndexTuple *gistextractpage(Page page, int *len /* out */ ); extern IndexTuple *gistjoinvector( IndexTuple *itvec, int *len, IndexTuple *additvec, int addlen); extern IndexTupleData *gistfillitupvec(IndexTuple *vec, int veclen, int *memlen); extern IndexTuple gistunion(Relation r, IndexTuple *itvec, int len, GISTSTATE *giststate); extern IndexTuple gistgetadjusted(Relation r, IndexTuple oldtup, IndexTuple addtup, GISTSTATE *giststate); extern IndexTuple gistFormTuple(GISTSTATE *giststate, Relation r, Datum *attdata, bool *isnull, bool newValues); extern OffsetNumber gistchoose(Relation r, Page p, IndexTuple it, GISTSTATE *giststate); extern void gistcentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e, Datum k, Relation r, Page pg, OffsetNumber o, bool l, bool isNull); extern void GISTInitBuffer(Buffer b, uint32 f); extern void gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e, Datum k, Relation r, Page pg, OffsetNumber o, bool l, bool isNull); extern float gistpenalty(GISTSTATE *giststate, int attno, GISTENTRY *key1, bool isNull1, GISTENTRY *key2, bool isNull2); extern void gistMakeUnionItVec(GISTSTATE *giststate, IndexTuple *itvec, int len, Datum *attr, bool *isnull); extern bool gistKeyIsEQ(GISTSTATE *giststate, int attno, Datum a, Datum b); extern void gistDeCompressAtt(GISTSTATE *giststate, Relation r, IndexTuple tuple, Page p, OffsetNumber o, GISTENTRY *attdata, bool *isnull); extern void gistMakeUnionKey(GISTSTATE *giststate, int attno, GISTENTRY *entry1, bool isnull1, GISTENTRY *entry2, bool isnull2, Datum *dst, bool *dstisnull); extern XLogRecPtr GetXLogRecPtrForTemp(void); /* gistvacuum.c */ extern Datum gistbulkdelete(PG_FUNCTION_ARGS); extern Datum gistvacuumcleanup(PG_FUNCTION_ARGS); /* gistsplit.c */ extern void gistSplitByKey(Relation r, Page page, IndexTuple *itup, int len, GISTSTATE *giststate, GistSplitVector *v, int attno); /* gistbuild.c */ extern Datum gistbuild(PG_FUNCTION_ARGS); extern void gistValidateBufferingOption(char *value); /* gistbuildbuffers.c */ extern GISTBuildBuffers *gistInitBuildBuffers(int pagesPerBuffer, int levelStep, int maxLevel); extern GISTNodeBuffer *gistGetNodeBuffer(GISTBuildBuffers *gfbb, GISTSTATE *giststate, BlockNumber blkno, int level); extern void gistPushItupToNodeBuffer(GISTBuildBuffers *gfbb, GISTNodeBuffer *nodeBuffer, IndexTuple item); extern bool gistPopItupFromNodeBuffer(GISTBuildBuffers *gfbb, GISTNodeBuffer *nodeBuffer, IndexTuple *item); extern void gistFreeBuildBuffers(GISTBuildBuffers *gfbb); extern void gistRelocateBuildBuffersOnSplit(GISTBuildBuffers *gfbb, GISTSTATE *giststate, Relation r, int level, Buffer buffer, List *splitinfo); extern void gistUnloadNodeBuffers(GISTBuildBuffers *gfbb); #endif /* GIST_PRIVATE_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/xlogutils.h���������������������������������������������������������������������0000644�����������������00000001674�14763166026�0012667 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * xlogutils.h * * PostgreSQL transaction log manager utility routines * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/xlogutils.h */ #ifndef XLOG_UTILS_H #define XLOG_UTILS_H #include "storage/bufmgr.h" extern bool XLogHaveInvalidPages(void); extern void XLogCheckInvalidPages(void); extern void XLogDropRelation(RelFileNode rnode, ForkNumber forknum); extern void XLogDropDatabase(Oid dbid); extern void XLogTruncateRelation(RelFileNode rnode, ForkNumber forkNum, BlockNumber nblocks); extern Buffer XLogReadBuffer(RelFileNode rnode, BlockNumber blkno, bool init); extern Buffer XLogReadBufferExtended(RelFileNode rnode, ForkNumber forknum, BlockNumber blkno, ReadBufferMode mode); extern Relation CreateFakeRelcacheEntry(RelFileNode rnode); extern void FreeFakeRelcacheEntry(Relation fakerel); #endif ��������������������������������������������������������������������pgsql/server/access/tuptoaster.h��������������������������������������������������������������������0000644�����������������00000013024�14763166026�0013037 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * tuptoaster.h * POSTGRES definitions for external and compressed storage * of variable size attributes. * * Copyright (c) 2000-2012, PostgreSQL Global Development Group * * src/include/access/tuptoaster.h * *------------------------------------------------------------------------- */ #ifndef TUPTOASTER_H #define TUPTOASTER_H #include "access/htup.h" #include "utils/relcache.h" /* * This enables de-toasting of index entries. Needed until VACUUM is * smart enough to rebuild indexes from scratch. */ #define TOAST_INDEX_HACK /* * Find the maximum size of a tuple if there are to be N tuples per page. */ #define MaximumBytesPerTuple(tuplesPerPage) \ MAXALIGN_DOWN((BLCKSZ - \ MAXALIGN(SizeOfPageHeaderData + (tuplesPerPage) * sizeof(ItemIdData))) \ / (tuplesPerPage)) /* * These symbols control toaster activation. If a tuple is larger than * TOAST_TUPLE_THRESHOLD, we will try to toast it down to no more than * TOAST_TUPLE_TARGET bytes through compressing compressible fields and * moving EXTENDED and EXTERNAL data out-of-line. * * The numbers need not be the same, though they currently are. It doesn't * make sense for TARGET to exceed THRESHOLD, but it could be useful to make * it be smaller. * * Currently we choose both values to match the largest tuple size for which * TOAST_TUPLES_PER_PAGE tuples can fit on a heap page. * * XXX while these can be modified without initdb, some thought needs to be * given to needs_toast_table() in toasting.c before unleashing random * changes. Also see LOBLKSIZE in large_object.h, which can *not* be * changed without initdb. */ #define TOAST_TUPLES_PER_PAGE 4 #define TOAST_TUPLE_THRESHOLD MaximumBytesPerTuple(TOAST_TUPLES_PER_PAGE) #define TOAST_TUPLE_TARGET TOAST_TUPLE_THRESHOLD /* * The code will also consider moving MAIN data out-of-line, but only as a * last resort if the previous steps haven't reached the target tuple size. * In this phase we use a different target size, currently equal to the * largest tuple that will fit on a heap page. This is reasonable since * the user has told us to keep the data in-line if at all possible. */ #define TOAST_TUPLES_PER_PAGE_MAIN 1 #define TOAST_TUPLE_TARGET_MAIN MaximumBytesPerTuple(TOAST_TUPLES_PER_PAGE_MAIN) /* * If an index value is larger than TOAST_INDEX_TARGET, we will try to * compress it (we can't move it out-of-line, however). Note that this * number is per-datum, not per-tuple, for simplicity in index_form_tuple(). */ #define TOAST_INDEX_TARGET (MaxHeapTupleSize / 16) /* * When we store an oversize datum externally, we divide it into chunks * containing at most TOAST_MAX_CHUNK_SIZE data bytes. This number *must* * be small enough that the completed toast-table tuple (including the * ID and sequence fields and all overhead) will fit on a page. * The coding here sets the size on the theory that we want to fit * EXTERN_TUPLES_PER_PAGE tuples of maximum size onto a page. * * NB: Changing TOAST_MAX_CHUNK_SIZE requires an initdb. */ #define EXTERN_TUPLES_PER_PAGE 4 /* tweak only this */ #define EXTERN_TUPLE_MAX_SIZE MaximumBytesPerTuple(EXTERN_TUPLES_PER_PAGE) #define TOAST_MAX_CHUNK_SIZE \ (EXTERN_TUPLE_MAX_SIZE - \ MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) - \ sizeof(Oid) - \ sizeof(int32) - \ VARHDRSZ) /* ---------- * toast_insert_or_update - * * Called by heap_insert() and heap_update(). * ---------- */ extern HeapTuple toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup, int options); /* ---------- * toast_delete - * * Called by heap_delete(). * ---------- */ extern void toast_delete(Relation rel, HeapTuple oldtup); /* ---------- * heap_tuple_fetch_attr() - * * Fetches an external stored attribute from the toast * relation. Does NOT decompress it, if stored external * in compressed format. * ---------- */ extern struct varlena *heap_tuple_fetch_attr(struct varlena * attr); /* ---------- * heap_tuple_untoast_attr() - * * Fully detoasts one attribute, fetching and/or decompressing * it as needed. * ---------- */ extern struct varlena *heap_tuple_untoast_attr(struct varlena * attr); /* ---------- * heap_tuple_untoast_attr_slice() - * * Fetches only the specified portion of an attribute. * (Handles all cases for attribute storage) * ---------- */ extern struct varlena *heap_tuple_untoast_attr_slice(struct varlena * attr, int32 sliceoffset, int32 slicelength); /* ---------- * toast_flatten_tuple - * * "Flatten" a tuple to contain no out-of-line toasted fields. * (This does not eliminate compressed or short-header datums.) * ---------- */ extern HeapTuple toast_flatten_tuple(HeapTuple tup, TupleDesc tupleDesc); /* ---------- * toast_flatten_tuple_to_datum - * * "Flatten" a tuple containing out-of-line toasted fields into a Datum. * ---------- */ extern Datum toast_flatten_tuple_to_datum(HeapTupleHeader tup, uint32 tup_len, TupleDesc tupleDesc); /* ---------- * toast_compress_datum - * * Create a compressed version of a varlena datum, if possible * ---------- */ extern Datum toast_compress_datum(Datum value); /* ---------- * toast_raw_datum_size - * * Return the raw (detoasted) size of a varlena datum * ---------- */ extern Size toast_raw_datum_size(Datum value); /* ---------- * toast_datum_size - * * Return the storage size of a varlena datum * ---------- */ extern Size toast_datum_size(Datum value); #endif /* TUPTOASTER_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/spgist.h������������������������������������������������������������������������0000644�����������������00000014367�14763166026�0012151 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * spgist.h * Public header file for SP-GiST access method. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/spgist.h * *------------------------------------------------------------------------- */ #ifndef SPGIST_H #define SPGIST_H #include "access/skey.h" #include "access/xlog.h" #include "fmgr.h" /* reloption parameters */ #define SPGIST_MIN_FILLFACTOR 10 #define SPGIST_DEFAULT_FILLFACTOR 80 /* SPGiST opclass support function numbers */ #define SPGIST_CONFIG_PROC 1 #define SPGIST_CHOOSE_PROC 2 #define SPGIST_PICKSPLIT_PROC 3 #define SPGIST_INNER_CONSISTENT_PROC 4 #define SPGIST_LEAF_CONSISTENT_PROC 5 #define SPGISTNProc 5 /* * Argument structs for spg_config method */ typedef struct spgConfigIn { Oid attType; /* Data type to be indexed */ } spgConfigIn; typedef struct spgConfigOut { Oid prefixType; /* Data type of inner-tuple prefixes */ Oid labelType; /* Data type of inner-tuple node labels */ bool canReturnData; /* Opclass can reconstruct original data */ bool longValuesOK; /* Opclass can cope with values > 1 page */ } spgConfigOut; /* * Argument structs for spg_choose method */ typedef struct spgChooseIn { Datum datum; /* original datum to be indexed */ Datum leafDatum; /* current datum to be stored at leaf */ int level; /* current level (counting from zero) */ /* Data from current inner tuple */ bool allTheSame; /* tuple is marked all-the-same? */ bool hasPrefix; /* tuple has a prefix? */ Datum prefixDatum; /* if so, the prefix value */ int nNodes; /* number of nodes in the inner tuple */ Datum *nodeLabels; /* node label values (NULL if none) */ } spgChooseIn; typedef enum spgChooseResultType { spgMatchNode = 1, /* descend into existing node */ spgAddNode, /* add a node to the inner tuple */ spgSplitTuple /* split inner tuple (change its prefix) */ } spgChooseResultType; typedef struct spgChooseOut { spgChooseResultType resultType; /* action code, see above */ union { struct /* results for spgMatchNode */ { int nodeN; /* descend to this node (index from 0) */ int levelAdd; /* increment level by this much */ Datum restDatum; /* new leaf datum */ } matchNode; struct /* results for spgAddNode */ { Datum nodeLabel; /* new node's label */ int nodeN; /* where to insert it (index from 0) */ } addNode; struct /* results for spgSplitTuple */ { /* Info to form new inner tuple with one node */ bool prefixHasPrefix; /* tuple should have a prefix? */ Datum prefixPrefixDatum; /* if so, its value */ Datum nodeLabel; /* node's label */ /* Info to form new lower-level inner tuple with all old nodes */ bool postfixHasPrefix; /* tuple should have a prefix? */ Datum postfixPrefixDatum; /* if so, its value */ } splitTuple; } result; } spgChooseOut; /* * Argument structs for spg_picksplit method */ typedef struct spgPickSplitIn { int nTuples; /* number of leaf tuples */ Datum *datums; /* their datums (array of length nTuples) */ int level; /* current level (counting from zero) */ } spgPickSplitIn; typedef struct spgPickSplitOut { bool hasPrefix; /* new inner tuple should have a prefix? */ Datum prefixDatum; /* if so, its value */ int nNodes; /* number of nodes for new inner tuple */ Datum *nodeLabels; /* their labels (or NULL for no labels) */ int *mapTuplesToNodes; /* node index for each leaf tuple */ Datum *leafTupleDatums; /* datum to store in each new leaf tuple */ } spgPickSplitOut; /* * Argument structs for spg_inner_consistent method */ typedef struct spgInnerConsistentIn { ScanKey scankeys; /* array of operators and comparison values */ int nkeys; /* length of array */ Datum reconstructedValue; /* value reconstructed at parent */ int level; /* current level (counting from zero) */ bool returnData; /* original data must be returned? */ /* Data from current inner tuple */ bool allTheSame; /* tuple is marked all-the-same? */ bool hasPrefix; /* tuple has a prefix? */ Datum prefixDatum; /* if so, the prefix value */ int nNodes; /* number of nodes in the inner tuple */ Datum *nodeLabels; /* node label values (NULL if none) */ } spgInnerConsistentIn; typedef struct spgInnerConsistentOut { int nNodes; /* number of child nodes to be visited */ int *nodeNumbers; /* their indexes in the node array */ int *levelAdds; /* increment level by this much for each */ Datum *reconstructedValues; /* associated reconstructed values */ } spgInnerConsistentOut; /* * Argument structs for spg_leaf_consistent method */ typedef struct spgLeafConsistentIn { ScanKey scankeys; /* array of operators and comparison values */ int nkeys; /* length of array */ Datum reconstructedValue; /* value reconstructed at parent */ int level; /* current level (counting from zero) */ bool returnData; /* original data must be returned? */ Datum leafDatum; /* datum in leaf tuple */ } spgLeafConsistentIn; typedef struct spgLeafConsistentOut { Datum leafValue; /* reconstructed original data, if any */ bool recheck; /* set true if operator must be rechecked */ } spgLeafConsistentOut; /* spginsert.c */ extern Datum spgbuild(PG_FUNCTION_ARGS); extern Datum spgbuildempty(PG_FUNCTION_ARGS); extern Datum spginsert(PG_FUNCTION_ARGS); /* spgscan.c */ extern Datum spgbeginscan(PG_FUNCTION_ARGS); extern Datum spgendscan(PG_FUNCTION_ARGS); extern Datum spgrescan(PG_FUNCTION_ARGS); extern Datum spgmarkpos(PG_FUNCTION_ARGS); extern Datum spgrestrpos(PG_FUNCTION_ARGS); extern Datum spggetbitmap(PG_FUNCTION_ARGS); extern Datum spggettuple(PG_FUNCTION_ARGS); extern Datum spgcanreturn(PG_FUNCTION_ARGS); /* spgutils.c */ extern Datum spgoptions(PG_FUNCTION_ARGS); /* spgvacuum.c */ extern Datum spgbulkdelete(PG_FUNCTION_ARGS); extern Datum spgvacuumcleanup(PG_FUNCTION_ARGS); /* spgxlog.c */ extern void spg_redo(XLogRecPtr lsn, XLogRecord *record); extern void spg_desc(StringInfo buf, uint8 xl_info, char *rec); extern void spg_xlog_startup(void); extern void spg_xlog_cleanup(void); #endif /* SPGIST_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/access/valid.h�������������������������������������������������������������������������0000644�����������������00000002635�14763166026�0011732 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * valid.h * POSTGRES tuple qualification validity definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/valid.h * *------------------------------------------------------------------------- */ #ifndef VALID_H #define VALID_H /* * HeapKeyTest * * Test a heap tuple to see if it satisfies a scan key. */ #define HeapKeyTest(tuple, \ tupdesc, \ nkeys, \ keys, \ result) \ do \ { \ /* Use underscores to protect the variables passed in as parameters */ \ int __cur_nkeys = (nkeys); \ ScanKey __cur_keys = (keys); \ \ (result) = true; /* may change */ \ for (; __cur_nkeys--; __cur_keys++) \ { \ Datum __atp; \ bool __isnull; \ Datum __test; \ \ if (__cur_keys->sk_flags & SK_ISNULL) \ { \ (result) = false; \ break; \ } \ \ __atp = heap_getattr((tuple), \ __cur_keys->sk_attno, \ (tupdesc), \ &__isnull); \ \ if (__isnull) \ { \ (result) = false; \ break; \ } \ \ __test = FunctionCall2Coll(&__cur_keys->sk_func, \ __cur_keys->sk_collation, \ __atp, __cur_keys->sk_argument); \ \ if (!DatumGetBool(__test)) \ { \ (result) = false; \ break; \ } \ } \ } while (0) #endif /* VALID_H */ ���������������������������������������������������������������������������������������������������pgsql/server/getopt_long.h��������������������������������������������������������������������������0000644�����������������00000001473�14763166026�0011712 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Portions Copyright (c) 1987, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Portions Copyright (c) 2003-2012, PostgreSQL Global Development Group * * src/include/getopt_long.h */ #ifndef GETOPT_LONG_H #define GETOPT_LONG_H #ifdef HAVE_GETOPT_H #include <getopt.h> #endif /* These are picked up from the system's getopt() facility. */ extern int opterr; extern int optind; extern int optopt; extern char *optarg; #ifndef HAVE_STRUCT_OPTION struct option { const char *name; int has_arg; int *flag; int val; }; #define no_argument 0 #define required_argument 1 #endif #ifndef HAVE_GETOPT_LONG extern int getopt_long(int argc, char *const argv[], const char *optstring, const struct option * longopts, int *longindex); #endif #endif /* GETOPT_LONG_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/comment.h���������������������������������������������������������������������0000644�����������������00000002525�14763166026�0012633 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * src/include/commands/comment.h * *------------------------------------------------------------------------- * * comment.h * * Prototypes for functions in commands/comment.c * * Copyright (c) 1999-2012, PostgreSQL Global Development Group * *------------------------------------------------------------------------- */ #ifndef COMMENT_H #define COMMENT_H #include "nodes/parsenodes.h" /*------------------------------------------------------------------ * Function Prototypes -- * * The following prototypes define the public functions of the comment * related routines. CommentObject() implements the SQL "COMMENT ON" * command. DeleteComments() deletes all comments for an object. * CreateComments creates (or deletes, if comment is NULL) a comment * for a specific key. There are versions of these two methods for * both normal and shared objects. *------------------------------------------------------------------ */ extern void CommentObject(CommentStmt *stmt); extern void DeleteComments(Oid oid, Oid classoid, int32 subid); extern void CreateComments(Oid oid, Oid classoid, int32 subid, char *comment); extern void DeleteSharedComments(Oid oid, Oid classoid); extern void CreateSharedComments(Oid oid, Oid classoid, char *comment); extern char *GetComment(Oid oid, Oid classoid, int32 subid); #endif /* COMMENT_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/seclabel.h��������������������������������������������������������������������0000644�����������������00000001712�14763166026�0012740 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * seclabel.h * * Prototypes for functions in commands/seclabel.c * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California */ #ifndef SECLABEL_H #define SECLABEL_H #include "catalog/objectaddress.h" /* * Internal APIs */ extern char *GetSecurityLabel(const ObjectAddress *object, const char *provider); extern void SetSecurityLabel(const ObjectAddress *object, const char *provider, const char *label); extern void DeleteSecurityLabel(const ObjectAddress *object); extern void DeleteSharedSecurityLabel(Oid objectId, Oid classId); /* * Statement and ESP hook support */ extern void ExecSecLabelStmt(SecLabelStmt *stmt); typedef void (*check_object_relabel_type) (const ObjectAddress *object, const char *seclabel); extern void register_label_provider(const char *provider, check_object_relabel_type hook); #endif /* SECLABEL_H */ ������������������������������������������������������pgsql/server/commands/dbcommands.h������������������������������������������������������������������0000644�����������������00000004105�14763166026�0013274 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * dbcommands.h * Database management commands (create/drop database). * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/dbcommands.h * *------------------------------------------------------------------------- */ #ifndef DBCOMMANDS_H #define DBCOMMANDS_H #include "access/xlog.h" #include "nodes/parsenodes.h" /* XLOG stuff */ #define XLOG_DBASE_CREATE 0x00 #define XLOG_DBASE_DROP 0x10 typedef struct xl_dbase_create_rec_old { /* Records copying of a single subdirectory incl. contents */ Oid db_id; char src_path[1]; /* VARIABLE LENGTH STRING */ /* dst_path follows src_path */ } xl_dbase_create_rec_old; typedef struct xl_dbase_drop_rec_old { /* Records dropping of a single subdirectory incl. contents */ Oid db_id; char dir_path[1]; /* VARIABLE LENGTH STRING */ } xl_dbase_drop_rec_old; typedef struct xl_dbase_create_rec { /* Records copying of a single subdirectory incl. contents */ Oid db_id; Oid tablespace_id; Oid src_db_id; Oid src_tablespace_id; } xl_dbase_create_rec; typedef struct xl_dbase_drop_rec { /* Records dropping of a single subdirectory incl. contents */ Oid db_id; Oid tablespace_id; } xl_dbase_drop_rec; extern void createdb(const CreatedbStmt *stmt); extern void dropdb(const char *dbname, bool missing_ok); extern void RenameDatabase(const char *oldname, const char *newname); extern void AlterDatabase(AlterDatabaseStmt *stmt, bool isTopLevel); extern void AlterDatabaseSet(AlterDatabaseSetStmt *stmt); extern void AlterDatabaseOwner(const char *dbname, Oid newOwnerId); extern Oid get_database_oid(const char *dbname, bool missingok); extern char *get_database_name(Oid dbid); extern void dbase_redo(XLogRecPtr lsn, XLogRecord *rptr); extern void dbase_desc(StringInfo buf, uint8 xl_info, char *rec); extern void check_encoding_locale_matches(int encoding, const char *collate, const char *ctype); #endif /* DBCOMMANDS_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/explain.h���������������������������������������������������������������������0000644�����������������00000005662�14763166026�0012636 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * explain.h * prototypes for explain.c * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994-5, Regents of the University of California * * src/include/commands/explain.h * *------------------------------------------------------------------------- */ #ifndef EXPLAIN_H #define EXPLAIN_H #include "executor/executor.h" typedef enum ExplainFormat { EXPLAIN_FORMAT_TEXT, EXPLAIN_FORMAT_XML, EXPLAIN_FORMAT_JSON, EXPLAIN_FORMAT_YAML } ExplainFormat; typedef struct ExplainState { StringInfo str; /* output buffer */ /* options */ bool verbose; /* be verbose */ bool analyze; /* print actual times */ bool costs; /* print costs */ bool buffers; /* print buffer usage */ bool timing; /* print timing */ ExplainFormat format; /* output format */ /* other states */ PlannedStmt *pstmt; /* top of plan */ List *rtable; /* range table */ int indent; /* current indentation level */ List *grouping_stack; /* format-specific grouping state */ } ExplainState; /* Hook for plugins to get control in ExplainOneQuery() */ typedef void (*ExplainOneQuery_hook_type) (Query *query, IntoClause *into, ExplainState *es, const char *queryString, ParamListInfo params); extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook; /* Hook for plugins to get control in explain_get_index_name() */ typedef const char *(*explain_get_index_name_hook_type) (Oid indexId); extern PGDLLIMPORT explain_get_index_name_hook_type explain_get_index_name_hook; extern void ExplainQuery(ExplainStmt *stmt, const char *queryString, ParamListInfo params, DestReceiver *dest); extern void ExplainInitState(ExplainState *es); extern TupleDesc ExplainResultDesc(ExplainStmt *stmt); extern void ExplainOneUtility(Node *utilityStmt, IntoClause *into, ExplainState *es, const char *queryString, ParamListInfo params); extern void ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into, ExplainState *es, const char *queryString, ParamListInfo params); extern void ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc); extern void ExplainQueryText(ExplainState *es, QueryDesc *queryDesc); extern void ExplainBeginOutput(ExplainState *es); extern void ExplainEndOutput(ExplainState *es); extern void ExplainSeparatePlans(ExplainState *es); extern void ExplainPropertyList(const char *qlabel, List *data, ExplainState *es); extern void ExplainPropertyText(const char *qlabel, const char *value, ExplainState *es); extern void ExplainPropertyInteger(const char *qlabel, int value, ExplainState *es); extern void ExplainPropertyLong(const char *qlabel, long value, ExplainState *es); extern void ExplainPropertyFloat(const char *qlabel, double value, int ndigits, ExplainState *es); #endif /* EXPLAIN_H */ ������������������������������������������������������������������������������pgsql/server/commands/portalcmds.h������������������������������������������������������������������0000644�����������������00000001600�14763166026�0013332 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * portalcmds.h * prototypes for portalcmds.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/portalcmds.h * *------------------------------------------------------------------------- */ #ifndef PORTALCMDS_H #define PORTALCMDS_H #include "nodes/parsenodes.h" #include "utils/portal.h" extern void PerformCursorOpen(PlannedStmt *stmt, ParamListInfo params, const char *queryString, bool isTopLevel); extern void PerformPortalFetch(FetchStmt *stmt, DestReceiver *dest, char *completionTag); extern void PerformPortalClose(const char *name); extern void PortalCleanup(Portal portal); extern void PersistHoldablePortal(Portal portal); #endif /* PORTALCMDS_H */ ��������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/user.h������������������������������������������������������������������������0000644�����������������00000002121�14763166026�0012137 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * user.h * Commands for manipulating roles (formerly called users). * * * src/include/commands/user.h * *------------------------------------------------------------------------- */ #ifndef USER_H #define USER_H #include "nodes/parsenodes.h" /* Hook to check passwords in CreateRole() and AlterRole() */ #define PASSWORD_TYPE_PLAINTEXT 0 #define PASSWORD_TYPE_MD5 1 typedef void (*check_password_hook_type) (const char *username, const char *password, int password_type, Datum validuntil_time, bool validuntil_null); extern PGDLLIMPORT check_password_hook_type check_password_hook; extern void CreateRole(CreateRoleStmt *stmt); extern void AlterRole(AlterRoleStmt *stmt); extern void AlterRoleSet(AlterRoleSetStmt *stmt); extern void DropRole(DropRoleStmt *stmt); extern void GrantRole(GrantRoleStmt *stmt); extern void RenameRole(const char *oldname, const char *newname); extern void DropOwnedObjects(DropOwnedStmt *stmt); extern void ReassignOwnedObjects(ReassignOwnedStmt *stmt); #endif /* USER_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/prepare.h���������������������������������������������������������������������0000644�����������������00000004036�14763166026�0012626 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * prepare.h * PREPARE, EXECUTE and DEALLOCATE commands, and prepared-stmt storage * * * Copyright (c) 2002-2012, PostgreSQL Global Development Group * * src/include/commands/prepare.h * *------------------------------------------------------------------------- */ #ifndef PREPARE_H #define PREPARE_H #include "commands/explain.h" #include "utils/plancache.h" /* * The data structure representing a prepared statement. This is now just * a thin veneer over a plancache entry --- the main addition is that of * a name. * * Note: all subsidiary storage lives in the referenced plancache entry. */ typedef struct { /* dynahash.c requires key to be first field */ char stmt_name[NAMEDATALEN]; CachedPlanSource *plansource; /* the actual cached plan */ bool from_sql; /* prepared via SQL, not FE/BE protocol? */ TimestampTz prepare_time; /* the time when the stmt was prepared */ } PreparedStatement; /* Utility statements PREPARE, EXECUTE, DEALLOCATE, EXPLAIN EXECUTE */ extern void PrepareQuery(PrepareStmt *stmt, const char *queryString); extern void ExecuteQuery(ExecuteStmt *stmt, IntoClause *intoClause, const char *queryString, ParamListInfo params, DestReceiver *dest, char *completionTag); extern void DeallocateQuery(DeallocateStmt *stmt); extern void ExplainExecuteQuery(ExecuteStmt *execstmt, IntoClause *into, ExplainState *es, const char *queryString, ParamListInfo params); /* Low-level access to stored prepared statements */ extern void StorePreparedStatement(const char *stmt_name, CachedPlanSource *plansource, bool from_sql); extern PreparedStatement *FetchPreparedStatement(const char *stmt_name, bool throwError); extern void DropPreparedStatement(const char *stmt_name, bool showError); extern TupleDesc FetchPreparedStatementResultDesc(PreparedStatement *stmt); extern List *FetchPreparedStatementTargetList(PreparedStatement *stmt); extern void DropAllPreparedStatements(void); #endif /* PREPARE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/collationcmds.h���������������������������������������������������������������0000644�����������������00000001627�14763166026�0014026 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * collationcmds.h * prototypes for collationcmds.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/collationcmds.h * *------------------------------------------------------------------------- */ #ifndef COLLATIONCMDS_H #define COLLATIONCMDS_H #include "nodes/parsenodes.h" extern void DefineCollation(List *names, List *parameters); extern void RenameCollation(List *name, const char *newname); extern void AlterCollationOwner(List *name, Oid newOwnerId); extern void AlterCollationOwner_oid(Oid collationOid, Oid newOwnerId); extern void AlterCollationNamespace(List *name, const char *newschema); extern Oid AlterCollationNamespace_oid(Oid collOid, Oid newNspOid); #endif /* COLLATIONCMDS_H */ ���������������������������������������������������������������������������������������������������������pgsql/server/commands/conversioncmds.h��������������������������������������������������������������0000644�����������������00000001655�14763166026�0014230 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * conversioncmds.h * prototypes for conversioncmds.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/conversioncmds.h * *------------------------------------------------------------------------- */ #ifndef CONVERSIONCMDS_H #define CONVERSIONCMDS_H #include "nodes/parsenodes.h" extern void CreateConversionCommand(CreateConversionStmt *parsetree); extern void RenameConversion(List *name, const char *newname); extern void AlterConversionOwner(List *name, Oid newOwnerId); extern void AlterConversionOwner_oid(Oid conversionOid, Oid newOwnerId); extern void AlterConversionNamespace(List *name, const char *newschema); extern Oid AlterConversionNamespace_oid(Oid convOid, Oid newNspOid); #endif /* CONVERSIONCMDS_H */ �����������������������������������������������������������������������������������pgsql/server/commands/tablespace.h������������������������������������������������������������������0000644�����������������00000003413�14763166026�0013271 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * tablespace.h * Tablespace management commands (create/drop tablespace). * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/tablespace.h * *------------------------------------------------------------------------- */ #ifndef TABLESPACE_H #define TABLESPACE_H #include "access/xlog.h" #include "nodes/parsenodes.h" /* XLOG stuff */ #define XLOG_TBLSPC_CREATE 0x00 #define XLOG_TBLSPC_DROP 0x10 typedef struct xl_tblspc_create_rec { Oid ts_id; char ts_path[1]; /* VARIABLE LENGTH STRING */ } xl_tblspc_create_rec; typedef struct xl_tblspc_drop_rec { Oid ts_id; } xl_tblspc_drop_rec; typedef struct TableSpaceOpts { int32 vl_len_; /* varlena header (do not touch directly!) */ float8 random_page_cost; float8 seq_page_cost; } TableSpaceOpts; extern void CreateTableSpace(CreateTableSpaceStmt *stmt); extern void DropTableSpace(DropTableSpaceStmt *stmt); extern void RenameTableSpace(const char *oldname, const char *newname); extern void AlterTableSpaceOwner(const char *name, Oid newOwnerId); extern void AlterTableSpaceOptions(AlterTableSpaceOptionsStmt *stmt); extern void TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo); extern Oid GetDefaultTablespace(char relpersistence); extern void PrepareTempTablespaces(void); extern Oid get_tablespace_oid(const char *tablespacename, bool missing_ok); extern char *get_tablespace_name(Oid spc_oid); extern bool directory_is_empty(const char *path); extern void tblspc_redo(XLogRecPtr lsn, XLogRecord *rptr); extern void tblspc_desc(StringInfo buf, uint8 xl_info, char *rec); #endif /* TABLESPACE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/lockcmds.h��������������������������������������������������������������������0000644�����������������00000001057�14763166026�0012767 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * lockcmds.h * prototypes for lockcmds.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/lockcmds.h * *------------------------------------------------------------------------- */ #ifndef LOCKCMDS_H #define LOCKCMDS_H #include "nodes/parsenodes.h" /* * LOCK */ extern void LockTableCommand(LockStmt *lockstmt); #endif /* LOCKCMDS_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/proclang.h��������������������������������������������������������������������0000644�����������������00000001420�14763166026�0012767 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * src/include/commands/proclang.h * *------------------------------------------------------------------------- * * proclang.h * prototypes for proclang.c. * * *------------------------------------------------------------------------- */ #ifndef PROCLANG_H #define PROCLANG_H #include "nodes/parsenodes.h" extern void CreateProceduralLanguage(CreatePLangStmt *stmt); extern void DropProceduralLanguageById(Oid langOid); extern void RenameLanguage(const char *oldname, const char *newname); extern void AlterLanguageOwner(const char *name, Oid newOwnerId); extern void AlterLanguageOwner_oid(Oid oid, Oid newOwnerId); extern bool PLTemplateExists(const char *languageName); extern Oid get_language_oid(const char *langname, bool missing_ok); #endif /* PROCLANG_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/alter.h�����������������������������������������������������������������������0000644�����������������00000001761�14763166026�0012301 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * alter.h * prototypes for commands/alter.c * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/alter.h * *------------------------------------------------------------------------- */ #ifndef ALTER_H #define ALTER_H #include "catalog/dependency.h" #include "utils/acl.h" #include "utils/relcache.h" extern void ExecRenameStmt(RenameStmt *stmt); extern void ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt); extern Oid AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid, ObjectAddresses *objsMoved); extern Oid AlterObjectNamespace(Relation rel, int oidCacheId, int nameCacheId, Oid objid, Oid nspOid, int Anum_name, int Anum_namespace, int Anum_owner, AclObjectKind acl_kind); extern void ExecAlterOwnerStmt(AlterOwnerStmt *stmt); #endif /* ALTER_H */ ���������������pgsql/server/commands/createas.h��������������������������������������������������������������������0000644�����������������00000001441�14763166026�0012754 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * createas.h * prototypes for createas.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/createas.h * *------------------------------------------------------------------------- */ #ifndef CREATEAS_H #define CREATEAS_H #include "nodes/params.h" #include "nodes/parsenodes.h" #include "tcop/dest.h" extern void ExecCreateTableAs(CreateTableAsStmt *stmt, const char *queryString, ParamListInfo params, char *completionTag); extern int GetIntoRelEFlags(IntoClause *intoClause); extern DestReceiver *CreateIntoRelDestReceiver(IntoClause *intoClause); #endif /* CREATEAS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/typecmds.h��������������������������������������������������������������������0000644�����������������00000004023�14763166026�0013014 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * typecmds.h * prototypes for typecmds.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/typecmds.h * *------------------------------------------------------------------------- */ #ifndef TYPECMDS_H #define TYPECMDS_H #include "access/htup.h" #include "catalog/dependency.h" #include "nodes/parsenodes.h" #define DEFAULT_TYPDELIM ',' extern void DefineType(List *names, List *parameters); extern void RemoveTypeById(Oid typeOid); extern void DefineDomain(CreateDomainStmt *stmt); extern void DefineEnum(CreateEnumStmt *stmt); extern void DefineRange(CreateRangeStmt *stmt); extern void AlterEnum(AlterEnumStmt *stmt); extern Oid DefineCompositeType(RangeVar *typevar, List *coldeflist); extern Oid AssignTypeArrayOid(void); extern void AlterDomainDefault(List *names, Node *defaultRaw); extern void AlterDomainNotNull(List *names, bool notNull); extern void AlterDomainAddConstraint(List *names, Node *constr); extern void AlterDomainValidateConstraint(List *names, char *constrName); extern void AlterDomainDropConstraint(List *names, const char *constrName, DropBehavior behavior, bool missing_ok); extern void checkDomainOwner(HeapTuple tup); extern List *GetDomainConstraints(Oid typeOid); extern void RenameType(RenameStmt *stmt); extern void AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype); extern void AlterTypeOwner_oid(Oid typeOid, Oid newOwnerId, bool hasDependEntry); extern void AlterTypeOwnerInternal(Oid typeOid, Oid newOwnerId); extern void AlterTypeNamespace(List *names, const char *newschema, ObjectType objecttype); extern Oid AlterTypeNamespace_oid(Oid typeOid, Oid nspOid, ObjectAddresses *objsMoved); extern Oid AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid, bool isImplicitArray, bool errorOnTableType, ObjectAddresses *objsMoved); #endif /* TYPECMDS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/tablecmds.h�������������������������������������������������������������������0000644�����������������00000005126�14763166026�0013127 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * tablecmds.h * prototypes for tablecmds.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/tablecmds.h * *------------------------------------------------------------------------- */ #ifndef TABLECMDS_H #define TABLECMDS_H #include "access/htup.h" #include "catalog/dependency.h" #include "nodes/parsenodes.h" #include "storage/lock.h" #include "utils/relcache.h" extern Oid DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId); extern void RemoveRelations(DropStmt *drop); extern Oid AlterTableLookupRelation(AlterTableStmt *stmt, LOCKMODE lockmode); extern void AlterTable(Oid relid, LOCKMODE lockmode, AlterTableStmt *stmt); extern LOCKMODE AlterTableGetLockLevel(List *cmds); extern void ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lockmode); extern void AlterTableInternal(Oid relid, List *cmds, bool recurse); extern void AlterTableNamespace(AlterObjectSchemaStmt *stmt); extern void AlterTableNamespaceInternal(Relation rel, Oid oldNspOid, Oid nspOid, ObjectAddresses *objsMoved); extern void AlterRelationNamespaceInternal(Relation classRel, Oid relOid, Oid oldNspOid, Oid newNspOid, bool hasDependEntry, ObjectAddresses *objsMoved); extern void CheckTableNotInUse(Relation rel, const char *stmt); extern void ExecuteTruncate(TruncateStmt *stmt); extern void SetRelationHasSubclass(Oid relationId, bool relhassubclass); extern void renameatt(RenameStmt *stmt); extern void RenameConstraint(RenameStmt *stmt); extern void RenameRelation(RenameStmt *stmt); extern void RenameRelationInternal(Oid myrelid, const char *newrelname); extern void find_composite_type_dependencies(Oid typeOid, Relation origRelation, const char *origTypeName); extern void check_of_type(HeapTuple typetuple); extern void register_on_commit_action(Oid relid, OnCommitAction action); extern void remove_on_commit_action(Oid relid); extern void PreCommit_on_commit_actions(void); extern void AtEOXact_on_commit_actions(bool isCommit); extern void AtEOSubXact_on_commit_actions(bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid); extern void RangeVarCallbackOwnsTable(const RangeVar *relation, Oid relId, Oid oldRelId, void *arg); extern void RangeVarCallbackOwnsRelation(const RangeVar *relation, Oid relId, Oid oldRelId, void *noCatalogs); #endif /* TABLECMDS_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/vacuum.h����������������������������������������������������������������������0000644�����������������00000015415�14763166026�0012473 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * vacuum.h * header file for postgres vacuum cleaner and statistics analyzer * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/vacuum.h * *------------------------------------------------------------------------- */ #ifndef VACUUM_H #define VACUUM_H #include "access/htup.h" #include "catalog/pg_statistic.h" #include "catalog/pg_type.h" #include "nodes/parsenodes.h" #include "storage/buf.h" #include "storage/lock.h" #include "utils/relcache.h" /*---------- * ANALYZE builds one of these structs for each attribute (column) that is * to be analyzed. The struct and subsidiary data are in anl_context, * so they live until the end of the ANALYZE operation. * * The type-specific typanalyze function is passed a pointer to this struct * and must return TRUE to continue analysis, FALSE to skip analysis of this * column. In the TRUE case it must set the compute_stats and minrows fields, * and can optionally set extra_data to pass additional info to compute_stats. * minrows is its request for the minimum number of sample rows to be gathered * (but note this request might not be honored, eg if there are fewer rows * than that in the table). * * The compute_stats routine will be called after sample rows have been * gathered. Aside from this struct, it is passed: * fetchfunc: a function for accessing the column values from the * sample rows * samplerows: the number of sample tuples * totalrows: estimated total number of rows in relation * The fetchfunc may be called with rownum running from 0 to samplerows-1. * It returns a Datum and an isNull flag. * * compute_stats should set stats_valid TRUE if it is able to compute * any useful statistics. If it does, the remainder of the struct holds * the information to be stored in a pg_statistic row for the column. Be * careful to allocate any pointed-to data in anl_context, which will NOT * be CurrentMemoryContext when compute_stats is called. * * Note: for the moment, all comparisons done for statistical purposes * should use the database's default collation (DEFAULT_COLLATION_OID). * This might change in some future release. *---------- */ typedef struct VacAttrStats *VacAttrStatsP; typedef Datum (*AnalyzeAttrFetchFunc) (VacAttrStatsP stats, int rownum, bool *isNull); typedef void (*AnalyzeAttrComputeStatsFunc) (VacAttrStatsP stats, AnalyzeAttrFetchFunc fetchfunc, int samplerows, double totalrows); typedef struct VacAttrStats { /* * These fields are set up by the main ANALYZE code before invoking the * type-specific typanalyze function. * * Note: do not assume that the data being analyzed has the same datatype * shown in attr, ie do not trust attr->atttypid, attlen, etc. This is * because some index opclasses store a different type than the underlying * column/expression. Instead use attrtypid, attrtypmod, and attrtype for * information about the datatype being fed to the typanalyze function. */ Form_pg_attribute attr; /* copy of pg_attribute row for column */ Oid attrtypid; /* type of data being analyzed */ int32 attrtypmod; /* typmod of data being analyzed */ Form_pg_type attrtype; /* copy of pg_type row for attrtypid */ MemoryContext anl_context; /* where to save long-lived data */ /* * These fields must be filled in by the typanalyze routine, unless it * returns FALSE. */ AnalyzeAttrComputeStatsFunc compute_stats; /* function pointer */ int minrows; /* Minimum # of rows wanted for stats */ void *extra_data; /* for extra type-specific data */ /* * These fields are to be filled in by the compute_stats routine. (They * are initialized to zero when the struct is created.) */ bool stats_valid; float4 stanullfrac; /* fraction of entries that are NULL */ int4 stawidth; /* average width of column values */ float4 stadistinct; /* # distinct values */ int2 stakind[STATISTIC_NUM_SLOTS]; Oid staop[STATISTIC_NUM_SLOTS]; int numnumbers[STATISTIC_NUM_SLOTS]; float4 *stanumbers[STATISTIC_NUM_SLOTS]; int numvalues[STATISTIC_NUM_SLOTS]; Datum *stavalues[STATISTIC_NUM_SLOTS]; /* * These fields describe the stavalues[n] element types. They will be * initialized to match attrtypid, but a custom typanalyze function might * want to store an array of something other than the analyzed column's * elements. It should then overwrite these fields. */ Oid statypid[STATISTIC_NUM_SLOTS]; int2 statyplen[STATISTIC_NUM_SLOTS]; bool statypbyval[STATISTIC_NUM_SLOTS]; char statypalign[STATISTIC_NUM_SLOTS]; /* * These fields are private to the main ANALYZE code and should not be * looked at by type-specific functions. */ int tupattnum; /* attribute number within tuples */ HeapTuple *rows; /* access info for std fetch function */ TupleDesc tupDesc; Datum *exprvals; /* access info for index fetch function */ bool *exprnulls; int rowstride; } VacAttrStats; /* GUC parameters */ extern PGDLLIMPORT int default_statistics_target; /* PGDLLIMPORT for * PostGIS */ extern int vacuum_freeze_min_age; extern int vacuum_freeze_table_age; /* in commands/vacuum.c */ extern void vacuum(VacuumStmt *vacstmt, Oid relid, bool do_toast, BufferAccessStrategy bstrategy, bool for_wraparound, bool isTopLevel); extern void vac_open_indexes(Relation relation, LOCKMODE lockmode, int *nindexes, Relation **Irel); extern void vac_close_indexes(int nindexes, Relation *Irel, LOCKMODE lockmode); extern double vac_estimate_reltuples(Relation relation, bool is_analyze, BlockNumber total_pages, BlockNumber scanned_pages, double scanned_tuples); extern void vac_update_relstats(Relation relation, BlockNumber num_pages, double num_tuples, BlockNumber num_all_visible_pages, bool hasindex, TransactionId frozenxid, bool in_outer_xact); extern void vacuum_set_xid_limits(int freeze_min_age, int freeze_table_age, bool sharedRel, TransactionId *oldestXmin, TransactionId *freezeLimit, TransactionId *freezeTableLimit); extern void vac_update_datfrozenxid(void); extern void vacuum_delay_point(void); /* in commands/vacuumlazy.c */ extern void lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt, BufferAccessStrategy bstrategy); /* in commands/analyze.c */ extern void analyze_rel(Oid relid, VacuumStmt *vacstmt, bool in_outer_xact, BufferAccessStrategy bstrategy); extern bool std_typanalyze(VacAttrStats *stats); extern double anl_random_fract(void); extern double anl_init_selection_state(int n); extern double anl_get_next_S(double t, int n, double *stateptr); #endif /* VACUUM_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/extension.h�������������������������������������������������������������������0000644�����������������00000003036�14763166026�0013203 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * extension.h * Extension management commands (create/drop extension). * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/extension.h * *------------------------------------------------------------------------- */ #ifndef EXTENSION_H #define EXTENSION_H #include "nodes/parsenodes.h" /* * creating_extension is only true while running a CREATE EXTENSION command. * It instructs recordDependencyOnCurrentExtension() to register a dependency * on the current pg_extension object for each SQL object created by its * installation script. */ extern bool creating_extension; extern Oid CurrentExtensionObject; extern void CreateExtension(CreateExtensionStmt *stmt); extern void RemoveExtensionById(Oid extId); extern Oid InsertExtensionTuple(const char *extName, Oid extOwner, Oid schemaOid, bool relocatable, const char *extVersion, Datum extConfig, Datum extCondition, List *requiredExtensions); extern void ExecAlterExtensionStmt(AlterExtensionStmt *stmt); extern void ExecAlterExtensionContentsStmt(AlterExtensionContentsStmt *stmt); extern Oid get_extension_oid(const char *extname, bool missing_ok); extern char *get_extension_name(Oid ext_oid); extern void AlterExtensionNamespace(List *names, const char *newschema); extern void AlterExtensionOwner_oid(Oid extensionOid, Oid newOwnerId); #endif /* EXTENSION_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/sequence.h��������������������������������������������������������������������0000644�����������������00000003715�14763166026�0013003 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * sequence.h * prototypes for sequence.c. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/sequence.h * *------------------------------------------------------------------------- */ #ifndef SEQUENCE_H #define SEQUENCE_H #include "access/xlog.h" #include "fmgr.h" #include "nodes/parsenodes.h" #include "storage/relfilenode.h" typedef struct FormData_pg_sequence { NameData sequence_name; int64 last_value; int64 start_value; int64 increment_by; int64 max_value; int64 min_value; int64 cache_value; int64 log_cnt; bool is_cycled; bool is_called; } FormData_pg_sequence; typedef FormData_pg_sequence *Form_pg_sequence; /* * Columns of a sequence relation */ #define SEQ_COL_NAME 1 #define SEQ_COL_LASTVAL 2 #define SEQ_COL_STARTVAL 3 #define SEQ_COL_INCBY 4 #define SEQ_COL_MAXVALUE 5 #define SEQ_COL_MINVALUE 6 #define SEQ_COL_CACHE 7 #define SEQ_COL_LOG 8 #define SEQ_COL_CYCLE 9 #define SEQ_COL_CALLED 10 #define SEQ_COL_FIRSTCOL SEQ_COL_NAME #define SEQ_COL_LASTCOL SEQ_COL_CALLED /* XLOG stuff */ #define XLOG_SEQ_LOG 0x00 typedef struct xl_seq_rec { RelFileNode node; /* SEQUENCE TUPLE DATA FOLLOWS AT THE END */ } xl_seq_rec; extern Datum nextval(PG_FUNCTION_ARGS); extern Datum nextval_oid(PG_FUNCTION_ARGS); extern Datum currval_oid(PG_FUNCTION_ARGS); extern Datum setval_oid(PG_FUNCTION_ARGS); extern Datum setval3_oid(PG_FUNCTION_ARGS); extern Datum lastval(PG_FUNCTION_ARGS); extern Datum pg_sequence_parameters(PG_FUNCTION_ARGS); extern void DefineSequence(CreateSeqStmt *stmt); extern void AlterSequence(AlterSeqStmt *stmt); extern void ResetSequence(Oid seq_relid); extern void seq_redo(XLogRecPtr lsn, XLogRecord *rptr); extern void seq_desc(StringInfo buf, uint8 xl_info, char *rec); #endif /* SEQUENCE_H */ ���������������������������������������������������pgsql/server/commands/defrem.h����������������������������������������������������������������������0000644�����������������00000017224�14763166026�0012435 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * defrem.h * POSTGRES define and remove utility definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/defrem.h * *------------------------------------------------------------------------- */ #ifndef DEFREM_H #define DEFREM_H #include "nodes/parsenodes.h" /* commands/dropcmds.c */ extern void RemoveObjects(DropStmt *stmt); /* commands/indexcmds.c */ extern Oid DefineIndex(Oid relationId, IndexStmt *stmt, Oid indexRelationId, bool is_alter_table, bool check_rights, bool skip_build, bool quiet); extern void ReindexIndex(RangeVar *indexRelation); extern void ReindexTable(RangeVar *relation); extern void ReindexDatabase(const char *databaseName, bool do_system, bool do_user); extern char *makeObjectName(const char *name1, const char *name2, const char *label); extern char *ChooseRelationName(const char *name1, const char *name2, const char *label, Oid namespaceid); extern bool CheckIndexCompatible(Oid oldId, char *accessMethodName, List *attributeList, List *exclusionOpNames); extern Oid GetDefaultOpClass(Oid type_id, Oid am_id); /* commands/functioncmds.c */ extern void CreateFunction(CreateFunctionStmt *stmt, const char *queryString); extern void RemoveFunctionById(Oid funcOid); extern void SetFunctionReturnType(Oid funcOid, Oid newRetType); extern void SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType); extern void RenameFunction(List *name, List *argtypes, const char *newname); extern void AlterFunctionOwner(List *name, List *argtypes, Oid newOwnerId); extern void AlterFunctionOwner_oid(Oid procOid, Oid newOwnerId); extern void AlterFunction(AlterFunctionStmt *stmt); extern void CreateCast(CreateCastStmt *stmt); extern void DropCastById(Oid castOid); extern void AlterFunctionNamespace(List *name, List *argtypes, bool isagg, const char *newschema); extern Oid AlterFunctionNamespace_oid(Oid procOid, Oid nspOid); extern void ExecuteDoStmt(DoStmt *stmt); extern Oid get_cast_oid(Oid sourcetypeid, Oid targettypeid, bool missing_ok); /* commands/operatorcmds.c */ extern void DefineOperator(List *names, List *parameters); extern void RemoveOperatorById(Oid operOid); extern void AlterOperatorOwner(List *name, TypeName *typeName1, TypeName *typename2, Oid newOwnerId); extern void AlterOperatorOwner_oid(Oid operOid, Oid newOwnerId); extern void AlterOperatorNamespace(List *names, List *argtypes, const char *newschema); extern Oid AlterOperatorNamespace_oid(Oid operOid, Oid newNspOid); /* commands/aggregatecmds.c */ extern void DefineAggregate(List *name, List *args, bool oldstyle, List *parameters); extern void RenameAggregate(List *name, List *args, const char *newname); extern void AlterAggregateOwner(List *name, List *args, Oid newOwnerId); /* commands/opclasscmds.c */ extern void DefineOpClass(CreateOpClassStmt *stmt); extern void DefineOpFamily(CreateOpFamilyStmt *stmt); extern void AlterOpFamily(AlterOpFamilyStmt *stmt); extern void RemoveOpClassById(Oid opclassOid); extern void RemoveOpFamilyById(Oid opfamilyOid); extern void RemoveAmOpEntryById(Oid entryOid); extern void RemoveAmProcEntryById(Oid entryOid); extern void RenameOpClass(List *name, const char *access_method, const char *newname); extern void RenameOpFamily(List *name, const char *access_method, const char *newname); extern void AlterOpClassOwner(List *name, const char *access_method, Oid newOwnerId); extern void AlterOpClassOwner_oid(Oid opclassOid, Oid newOwnerId); extern void AlterOpClassNamespace(List *name, char *access_method, const char *newschema); extern Oid AlterOpClassNamespace_oid(Oid opclassOid, Oid newNspOid); extern void AlterOpFamilyOwner(List *name, const char *access_method, Oid newOwnerId); extern void AlterOpFamilyOwner_oid(Oid opfamilyOid, Oid newOwnerId); extern void AlterOpFamilyNamespace(List *name, char *access_method, const char *newschema); extern Oid AlterOpFamilyNamespace_oid(Oid opfamilyOid, Oid newNspOid); extern Oid get_am_oid(const char *amname, bool missing_ok); extern Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok); extern Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok); /* commands/tsearchcmds.c */ extern void DefineTSParser(List *names, List *parameters); extern void RenameTSParser(List *oldname, const char *newname); extern void AlterTSParserNamespace(List *name, const char *newschema); extern Oid AlterTSParserNamespace_oid(Oid prsId, Oid newNspOid); extern void RemoveTSParserById(Oid prsId); extern void DefineTSDictionary(List *names, List *parameters); extern void RenameTSDictionary(List *oldname, const char *newname); extern void RemoveTSDictionaryById(Oid dictId); extern void AlterTSDictionary(AlterTSDictionaryStmt *stmt); extern void AlterTSDictionaryOwner(List *name, Oid newOwnerId); extern void AlterTSDictionaryOwner_oid(Oid dictId, Oid newOwnerId); extern void AlterTSDictionaryNamespace(List *name, const char *newschema); extern Oid AlterTSDictionaryNamespace_oid(Oid dictId, Oid newNspOid); extern void DefineTSTemplate(List *names, List *parameters); extern void RenameTSTemplate(List *oldname, const char *newname); extern void AlterTSTemplateNamespace(List *name, const char *newschema); extern Oid AlterTSTemplateNamespace_oid(Oid tmplId, Oid newNspOid); extern void RemoveTSTemplateById(Oid tmplId); extern void DefineTSConfiguration(List *names, List *parameters); extern void RenameTSConfiguration(List *oldname, const char *newname); extern void RemoveTSConfigurationById(Oid cfgId); extern void AlterTSConfiguration(AlterTSConfigurationStmt *stmt); extern void AlterTSConfigurationOwner(List *name, Oid newOwnerId); extern void AlterTSConfigurationOwner_oid(Oid cfgId, Oid newOwnerId); extern void AlterTSConfigurationNamespace(List *name, const char *newschema); extern Oid AlterTSConfigurationNamespace_oid(Oid cfgId, Oid newNspOid); extern text *serialize_deflist(List *deflist); extern List *deserialize_deflist(Datum txt); /* commands/foreigncmds.c */ extern void RenameForeignServer(const char *oldname, const char *newname); extern void RenameForeignDataWrapper(const char *oldname, const char *newname); extern void AlterForeignServerOwner(const char *name, Oid newOwnerId); extern void AlterForeignServerOwner_oid(Oid, Oid newOwnerId); extern void AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId); extern void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId); extern void CreateForeignDataWrapper(CreateFdwStmt *stmt); extern void AlterForeignDataWrapper(AlterFdwStmt *stmt); extern void RemoveForeignDataWrapperById(Oid fdwId); extern void CreateForeignServer(CreateForeignServerStmt *stmt); extern void AlterForeignServer(AlterForeignServerStmt *stmt); extern void RemoveForeignServerById(Oid srvId); extern void CreateUserMapping(CreateUserMappingStmt *stmt); extern void AlterUserMapping(AlterUserMappingStmt *stmt); extern void RemoveUserMapping(DropUserMappingStmt *stmt); extern void RemoveUserMappingById(Oid umId); extern void CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid); extern Datum transformGenericOptions(Oid catalogId, Datum oldOptions, List *options, Oid fdwvalidator); /* support routines in commands/define.c */ extern char *defGetString(DefElem *def); extern double defGetNumeric(DefElem *def); extern bool defGetBoolean(DefElem *def); extern int64 defGetInt64(DefElem *def); extern List *defGetQualifiedName(DefElem *def); extern TypeName *defGetTypeName(DefElem *def); extern int defGetTypeLength(DefElem *def); extern DefElem *defWithOids(bool value); #endif /* DEFREM_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/cluster.h���������������������������������������������������������������������0000644�����������������00000002217�14763166026�0012650 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * cluster.h * header file for postgres cluster command stuff * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994-5, Regents of the University of California * * src/include/commands/cluster.h * *------------------------------------------------------------------------- */ #ifndef CLUSTER_H #define CLUSTER_H #include "nodes/parsenodes.h" #include "storage/lock.h" #include "utils/relcache.h" extern void cluster(ClusterStmt *stmt, bool isTopLevel); extern void cluster_rel(Oid tableOid, Oid indexOid, bool recheck, bool verbose, int freeze_min_age, int freeze_table_age); extern void check_index_is_clusterable(Relation OldHeap, Oid indexOid, bool recheck, LOCKMODE lockmode); extern void mark_index_clustered(Relation rel, Oid indexOid); extern Oid make_new_heap(Oid OIDOldHeap, Oid NewTableSpace); extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap, bool is_system_catalog, bool swap_toast_by_content, bool check_constraints, TransactionId frozenXid); #endif /* CLUSTER_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/view.h������������������������������������������������������������������������0000644�����������������00000000776�14763166026�0012151 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * view.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/view.h * *------------------------------------------------------------------------- */ #ifndef VIEW_H #define VIEW_H #include "nodes/parsenodes.h" extern void DefineView(ViewStmt *stmt, const char *queryString); #endif /* VIEW_H */ ��pgsql/server/commands/async.h�����������������������������������������������������������������������0000644�����������������00000003450�14763166026�0012304 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * async.h * Asynchronous notification: NOTIFY, LISTEN, UNLISTEN * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/async.h * *------------------------------------------------------------------------- */ #ifndef ASYNC_H #define ASYNC_H #include "fmgr.h" /* * The number of SLRU page buffers we use for the notification queue. */ #define NUM_ASYNC_BUFFERS 8 extern bool Trace_notify; extern Size AsyncShmemSize(void); extern void AsyncShmemInit(void); /* notify-related SQL statements */ extern void Async_Notify(const char *channel, const char *payload); extern void Async_Listen(const char *channel); extern void Async_Unlisten(const char *channel); extern void Async_UnlistenAll(void); /* notify-related SQL functions */ extern Datum pg_listening_channels(PG_FUNCTION_ARGS); extern Datum pg_notify(PG_FUNCTION_ARGS); /* perform (or cancel) outbound notify processing at transaction commit */ extern void PreCommit_Notify(void); extern void AtCommit_Notify(void); extern void AtAbort_Notify(void); extern void AtSubStart_Notify(void); extern void AtSubCommit_Notify(void); extern void AtSubAbort_Notify(void); extern void AtPrepare_Notify(void); extern void ProcessCompletedNotifies(void); /* signal handler for inbound notifies (PROCSIG_NOTIFY_INTERRUPT) */ extern void HandleNotifyInterrupt(void); /* * enable/disable processing of inbound notifies directly from signal handler. * The enable routine first performs processing of any inbound notifies that * have occurred since the last disable. */ extern void EnableNotifyInterrupt(void); extern bool DisableNotifyInterrupt(void); #endif /* ASYNC_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/trigger.h���������������������������������������������������������������������0000644�����������������00000015227�14763166026�0012637 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * trigger.h * Declarations for trigger handling. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/trigger.h * *------------------------------------------------------------------------- */ #ifndef TRIGGER_H #define TRIGGER_H #include "nodes/execnodes.h" #include "nodes/parsenodes.h" /* * TriggerData is the node type that is passed as fmgr "context" info * when a function is called by the trigger manager. */ #define CALLED_AS_TRIGGER(fcinfo) \ ((fcinfo)->context != NULL && IsA((fcinfo)->context, TriggerData)) typedef uint32 TriggerEvent; typedef struct TriggerData { NodeTag type; TriggerEvent tg_event; Relation tg_relation; HeapTuple tg_trigtuple; HeapTuple tg_newtuple; Trigger *tg_trigger; Buffer tg_trigtuplebuf; Buffer tg_newtuplebuf; } TriggerData; /* * TriggerEvent bit flags * * Note that we assume different event types (INSERT/DELETE/UPDATE/TRUNCATE) * can't be OR'd together in a single TriggerEvent. This is unlike the * situation for pg_trigger rows, so pg_trigger.tgtype uses a different * representation! */ #define TRIGGER_EVENT_INSERT 0x00000000 #define TRIGGER_EVENT_DELETE 0x00000001 #define TRIGGER_EVENT_UPDATE 0x00000002 #define TRIGGER_EVENT_TRUNCATE 0x00000003 #define TRIGGER_EVENT_OPMASK 0x00000003 #define TRIGGER_EVENT_ROW 0x00000004 #define TRIGGER_EVENT_BEFORE 0x00000008 #define TRIGGER_EVENT_AFTER 0x00000000 #define TRIGGER_EVENT_INSTEAD 0x00000010 #define TRIGGER_EVENT_TIMINGMASK 0x00000018 /* More TriggerEvent flags, used only within trigger.c */ #define AFTER_TRIGGER_DEFERRABLE 0x00000020 #define AFTER_TRIGGER_INITDEFERRED 0x00000040 #define TRIGGER_FIRED_BY_INSERT(event) \ (((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_INSERT) #define TRIGGER_FIRED_BY_DELETE(event) \ (((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_DELETE) #define TRIGGER_FIRED_BY_UPDATE(event) \ (((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_UPDATE) #define TRIGGER_FIRED_BY_TRUNCATE(event) \ (((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_TRUNCATE) #define TRIGGER_FIRED_FOR_ROW(event) \ ((event) & TRIGGER_EVENT_ROW) #define TRIGGER_FIRED_FOR_STATEMENT(event) \ (!TRIGGER_FIRED_FOR_ROW(event)) #define TRIGGER_FIRED_BEFORE(event) \ (((event) & TRIGGER_EVENT_TIMINGMASK) == TRIGGER_EVENT_BEFORE) #define TRIGGER_FIRED_AFTER(event) \ (((event) & TRIGGER_EVENT_TIMINGMASK) == TRIGGER_EVENT_AFTER) #define TRIGGER_FIRED_INSTEAD(event) \ (((event) & TRIGGER_EVENT_TIMINGMASK) == TRIGGER_EVENT_INSTEAD) /* * Definitions for replication role based firing. */ #define SESSION_REPLICATION_ROLE_ORIGIN 0 #define SESSION_REPLICATION_ROLE_REPLICA 1 #define SESSION_REPLICATION_ROLE_LOCAL 2 extern PGDLLIMPORT int SessionReplicationRole; /* * States at which a trigger can be fired. These are the * possible values for pg_trigger.tgenabled. */ #define TRIGGER_FIRES_ON_ORIGIN 'O' #define TRIGGER_FIRES_ALWAYS 'A' #define TRIGGER_FIRES_ON_REPLICA 'R' #define TRIGGER_DISABLED 'D' extern Oid CreateTrigger(CreateTrigStmt *stmt, const char *queryString, Oid relOid, Oid refRelOid, Oid constraintOid, Oid indexOid, bool isInternal); extern void RemoveTriggerById(Oid trigOid); extern Oid get_trigger_oid(Oid relid, const char *name, bool missing_ok); extern void renametrig(RenameStmt *stmt); extern void EnableDisableTrigger(Relation rel, const char *tgname, char fires_when, bool skip_system); extern void RelationBuildTriggers(Relation relation); extern TriggerDesc *CopyTriggerDesc(TriggerDesc *trigdesc); extern void FreeTriggerDesc(TriggerDesc *trigdesc); extern void ExecBSInsertTriggers(EState *estate, ResultRelInfo *relinfo); extern void ExecASInsertTriggers(EState *estate, ResultRelInfo *relinfo); extern TupleTableSlot *ExecBRInsertTriggers(EState *estate, ResultRelInfo *relinfo, TupleTableSlot *slot); extern void ExecARInsertTriggers(EState *estate, ResultRelInfo *relinfo, HeapTuple trigtuple, List *recheckIndexes); extern TupleTableSlot *ExecIRInsertTriggers(EState *estate, ResultRelInfo *relinfo, TupleTableSlot *slot); extern void ExecBSDeleteTriggers(EState *estate, ResultRelInfo *relinfo); extern void ExecASDeleteTriggers(EState *estate, ResultRelInfo *relinfo); extern bool ExecBRDeleteTriggers(EState *estate, EPQState *epqstate, ResultRelInfo *relinfo, ItemPointer tupleid); extern void ExecARDeleteTriggers(EState *estate, ResultRelInfo *relinfo, ItemPointer tupleid); extern bool ExecIRDeleteTriggers(EState *estate, ResultRelInfo *relinfo, HeapTuple trigtuple); extern void ExecBSUpdateTriggers(EState *estate, ResultRelInfo *relinfo); extern void ExecASUpdateTriggers(EState *estate, ResultRelInfo *relinfo); extern TupleTableSlot *ExecBRUpdateTriggers(EState *estate, EPQState *epqstate, ResultRelInfo *relinfo, ItemPointer tupleid, TupleTableSlot *slot); extern void ExecARUpdateTriggers(EState *estate, ResultRelInfo *relinfo, ItemPointer tupleid, HeapTuple newtuple, List *recheckIndexes); extern TupleTableSlot *ExecIRUpdateTriggers(EState *estate, ResultRelInfo *relinfo, HeapTuple trigtuple, TupleTableSlot *slot); extern void ExecBSTruncateTriggers(EState *estate, ResultRelInfo *relinfo); extern void ExecASTruncateTriggers(EState *estate, ResultRelInfo *relinfo); extern void AfterTriggerBeginXact(void); extern void AfterTriggerBeginQuery(void); extern void AfterTriggerEndQuery(EState *estate); extern void AfterTriggerFireDeferred(void); extern void AfterTriggerEndXact(bool isCommit); extern void AfterTriggerBeginSubXact(void); extern void AfterTriggerEndSubXact(bool isCommit); extern void AfterTriggerSetState(ConstraintsSetStmt *stmt); extern bool AfterTriggerPendingOnRel(Oid relid); /* * in utils/adt/ri_triggers.c */ extern bool RI_FKey_keyequal_upd_pk(Trigger *trigger, Relation pk_rel, HeapTuple old_row, HeapTuple new_row); extern bool RI_FKey_keyequal_upd_fk(Trigger *trigger, Relation fk_rel, HeapTuple old_row, HeapTuple new_row); extern bool RI_Initial_Check(Trigger *trigger, Relation fk_rel, Relation pk_rel); /* result values for RI_FKey_trigger_type: */ #define RI_TRIGGER_PK 1 /* is a trigger on the PK relation */ #define RI_TRIGGER_FK 2 /* is a trigger on the FK relation */ #define RI_TRIGGER_NONE 0 /* is not an RI trigger function */ extern int RI_FKey_trigger_type(Oid tgfoid); extern Datum pg_trigger_depth(PG_FUNCTION_ARGS); #endif /* TRIGGER_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/schemacmds.h������������������������������������������������������������������0000644�����������������00000001513�14763166026�0013274 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * schemacmds.h * prototypes for schemacmds.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/schemacmds.h * *------------------------------------------------------------------------- */ #ifndef SCHEMACMDS_H #define SCHEMACMDS_H #include "nodes/parsenodes.h" extern void CreateSchemaCommand(CreateSchemaStmt *parsetree, const char *queryString); extern void RemoveSchemaById(Oid schemaOid); extern void RenameSchema(const char *oldname, const char *newname); extern void AlterSchemaOwner(const char *name, Oid newOwnerId); extern void AlterSchemaOwner_oid(Oid schemaOid, Oid newOwnerId); #endif /* SCHEMACMDS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/variable.h��������������������������������������������������������������������0000644�����������������00000003531�14763166026�0012754 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * variable.h * Routines for handling specialized SET variables. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/variable.h */ #ifndef VARIABLE_H #define VARIABLE_H #include "utils/guc.h" extern bool check_datestyle(char **newval, void **extra, GucSource source); extern void assign_datestyle(const char *newval, void *extra); extern bool check_timezone(char **newval, void **extra, GucSource source); extern void assign_timezone(const char *newval, void *extra); extern const char *show_timezone(void); extern bool check_log_timezone(char **newval, void **extra, GucSource source); extern void assign_log_timezone(const char *newval, void *extra); extern const char *show_log_timezone(void); extern bool check_transaction_read_only(bool *newval, void **extra, GucSource source); extern bool check_XactIsoLevel(char **newval, void **extra, GucSource source); extern void assign_XactIsoLevel(const char *newval, void *extra); extern const char *show_XactIsoLevel(void); extern bool check_transaction_deferrable(bool *newval, void **extra, GucSource source); extern bool check_random_seed(double *newval, void **extra, GucSource source); extern void assign_random_seed(double newval, void *extra); extern const char *show_random_seed(void); extern bool check_client_encoding(char **newval, void **extra, GucSource source); extern void assign_client_encoding(const char *newval, void *extra); extern bool check_session_authorization(char **newval, void **extra, GucSource source); extern void assign_session_authorization(const char *newval, void *extra); extern bool check_role(char **newval, void **extra, GucSource source); extern void assign_role(const char *newval, void *extra); extern const char *show_role(void); #endif /* VARIABLE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/commands/discard.h���������������������������������������������������������������������0000644�����������������00000000727�14763166026�0012604 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * discard.h * prototypes for discard.c. * * * Copyright (c) 1996-2012, PostgreSQL Global Development Group * * src/include/commands/discard.h * *------------------------------------------------------------------------- */ #ifndef DISCARD_H #define DISCARD_H #include "nodes/parsenodes.h" extern void DiscardCommand(DiscardStmt *stmt, bool isTopLevel); #endif /* DISCARD_H */ �����������������������������������������pgsql/server/commands/copy.h������������������������������������������������������������������������0000644�����������������00000002331�14763166026�0012136 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * copy.h * Definitions for using the POSTGRES copy command. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/copy.h * *------------------------------------------------------------------------- */ #ifndef COPY_H #define COPY_H #include "nodes/execnodes.h" #include "nodes/parsenodes.h" #include "tcop/dest.h" /* CopyStateData is private in commands/copy.c */ typedef struct CopyStateData *CopyState; extern uint64 DoCopy(const CopyStmt *stmt, const char *queryString); extern void ProcessCopyOptions(CopyState cstate, bool is_from, List *options); extern CopyState BeginCopyFrom(Relation rel, const char *filename, List *attnamelist, List *options); extern void EndCopyFrom(CopyState cstate); extern bool NextCopyFrom(CopyState cstate, ExprContext *econtext, Datum *values, bool *nulls, Oid *tupleOid); extern bool NextCopyFromRawFields(CopyState cstate, char ***fields, int *nfields); extern void CopyFromErrorCallback(void *arg); extern DestReceiver *CreateCopyDestReceiver(void); #endif /* COPY_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/foreign/foreign.h����������������������������������������������������������������������0000644�����������������00000005056�14763166026�0012454 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * foreign.h * support for foreign-data wrappers, servers and user mappings. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * * src/include/foreign/foreign.h * *------------------------------------------------------------------------- */ #ifndef FOREIGN_H #define FOREIGN_H #include "nodes/parsenodes.h" /* Helper for obtaining username for user mapping */ #define MappingUserName(userid) \ (OidIsValid(userid) ? GetUserNameFromId(userid) : "public") /* * Generic option types for validation. * NB! Thes are treated as flags, so use only powers of two here. */ typedef enum { ServerOpt = 1, /* options applicable to SERVER */ UserMappingOpt = 2, /* options for USER MAPPING */ FdwOpt = 4 /* options for FOREIGN DATA WRAPPER */ } GenericOptionFlags; typedef struct ForeignDataWrapper { Oid fdwid; /* FDW Oid */ Oid owner; /* FDW owner user Oid */ char *fdwname; /* Name of the FDW */ Oid fdwhandler; /* Oid of handler function, or 0 */ Oid fdwvalidator; /* Oid of validator function, or 0 */ List *options; /* fdwoptions as DefElem list */ } ForeignDataWrapper; typedef struct ForeignServer { Oid serverid; /* server Oid */ Oid fdwid; /* foreign-data wrapper */ Oid owner; /* server owner user Oid */ char *servername; /* name of the server */ char *servertype; /* server type, optional */ char *serverversion; /* server version, optional */ List *options; /* srvoptions as DefElem list */ } ForeignServer; typedef struct UserMapping { Oid userid; /* local user Oid */ Oid serverid; /* server Oid */ List *options; /* useoptions as DefElem list */ } UserMapping; typedef struct ForeignTable { Oid relid; /* relation Oid */ Oid serverid; /* server Oid */ List *options; /* ftoptions as DefElem list */ } ForeignTable; extern ForeignServer *GetForeignServer(Oid serverid); extern ForeignServer *GetForeignServerByName(const char *name, bool missing_ok); extern UserMapping *GetUserMapping(Oid userid, Oid serverid); extern ForeignDataWrapper *GetForeignDataWrapper(Oid fdwid); extern ForeignDataWrapper *GetForeignDataWrapperByName(const char *name, bool missing_ok); extern ForeignTable *GetForeignTable(Oid relid); extern List *GetForeignColumnOptions(Oid relid, AttrNumber attnum); extern Oid get_foreign_data_wrapper_oid(const char *fdwname, bool missing_ok); extern Oid get_foreign_server_oid(const char *servername, bool missing_ok); #endif /* FOREIGN_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/foreign/fdwapi.h�����������������������������������������������������������������������0000644�����������������00000006013�14763166026�0012267 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * fdwapi.h * API for foreign-data wrappers * * Copyright (c) 2010-2012, PostgreSQL Global Development Group * * src/include/foreign/fdwapi.h * *------------------------------------------------------------------------- */ #ifndef FDWAPI_H #define FDWAPI_H #include "nodes/execnodes.h" #include "nodes/relation.h" /* To avoid including explain.h here, reference ExplainState thus: */ struct ExplainState; /* * Callback function signatures --- see fdwhandler.sgml for more info. */ typedef void (*GetForeignRelSize_function) (PlannerInfo *root, RelOptInfo *baserel, Oid foreigntableid); typedef void (*GetForeignPaths_function) (PlannerInfo *root, RelOptInfo *baserel, Oid foreigntableid); typedef ForeignScan *(*GetForeignPlan_function) (PlannerInfo *root, RelOptInfo *baserel, Oid foreigntableid, ForeignPath *best_path, List *tlist, List *scan_clauses); typedef void (*ExplainForeignScan_function) (ForeignScanState *node, struct ExplainState *es); typedef void (*BeginForeignScan_function) (ForeignScanState *node, int eflags); typedef TupleTableSlot *(*IterateForeignScan_function) (ForeignScanState *node); typedef void (*ReScanForeignScan_function) (ForeignScanState *node); typedef void (*EndForeignScan_function) (ForeignScanState *node); typedef int (*AcquireSampleRowsFunc) (Relation relation, int elevel, HeapTuple *rows, int targrows, double *totalrows, double *totaldeadrows); typedef bool (*AnalyzeForeignTable_function) (Relation relation, AcquireSampleRowsFunc *func, BlockNumber *totalpages); /* * FdwRoutine is the struct returned by a foreign-data wrapper's handler * function. It provides pointers to the callback functions needed by the * planner and executor. * * More function pointers are likely to be added in the future. Therefore * it's recommended that the handler initialize the struct with * makeNode(FdwRoutine) so that all fields are set to NULL. This will * ensure that no fields are accidentally left undefined. */ typedef struct FdwRoutine { NodeTag type; /* * These functions are required. */ GetForeignRelSize_function GetForeignRelSize; GetForeignPaths_function GetForeignPaths; GetForeignPlan_function GetForeignPlan; ExplainForeignScan_function ExplainForeignScan; BeginForeignScan_function BeginForeignScan; IterateForeignScan_function IterateForeignScan; ReScanForeignScan_function ReScanForeignScan; EndForeignScan_function EndForeignScan; /* * These functions are optional. Set the pointer to NULL for any that are * not provided. */ AnalyzeForeignTable_function AnalyzeForeignTable; } FdwRoutine; /* Functions in foreign/foreign.c */ extern FdwRoutine *GetFdwRoutine(Oid fdwhandler); extern FdwRoutine *GetFdwRoutineByRelId(Oid relid); #endif /* FDWAPI_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/geqo_mutation.h��������������������������������������������������������������0000644�����������������00000001677�14763166026�0014274 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * geqo_mutation.h * prototypes for mutation functions in optimizer/geqo * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/geqo_mutation.h * *------------------------------------------------------------------------- */ /* contributed by: =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= * Martin Utesch * Institute of Automatic Control * = = University of Mining and Technology = * utesch@aut.tu-freiberg.de * Freiberg, Germany * =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= */ #ifndef GEQO_MUTATION_H #define GEQO_MUTATION_H #include "optimizer/geqo.h" extern void geqo_mutation(PlannerInfo *root, Gene *tour, int num_gene); #endif /* GEQO_MUTATION_H */ �����������������������������������������������������������������pgsql/server/optimizer/geqo_misc.h������������������������������������������������������������������0000644�����������������00000002144�14763166026�0013355 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * geqo_misc.h * prototypes for printout routines in optimizer/geqo * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/geqo_misc.h * *------------------------------------------------------------------------- */ /* contributed by: =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= * Martin Utesch * Institute of Automatic Control * = = University of Mining and Technology = * utesch@aut.tu-freiberg.de * Freiberg, Germany * =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= */ #ifndef GEQO_MISC_H #define GEQO_MISC_H #include "optimizer/geqo_recombination.h" #ifdef GEQO_DEBUG extern void print_pool(FILE *fp, Pool *pool, int start, int stop); extern void print_gen(FILE *fp, Pool *pool, int generation); extern void print_edge_table(FILE *fp, Edge *edge_table, int num_gene); #endif /* GEQO_DEBUG */ #endif /* GEQO_MISC_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/geqo_copy.h������������������������������������������������������������������0000644�����������������00000001706�14763166026�0013377 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * geqo_copy.h * prototypes for copy functions in optimizer/geqo * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/geqo_copy.h * *------------------------------------------------------------------------- */ /* contributed by: =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= * Martin Utesch * Institute of Automatic Control * = = University of Mining and Technology = * utesch@aut.tu-freiberg.de * Freiberg, Germany * =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= */ #ifndef GEQO_COPY_H #define GEQO_COPY_H #include "optimizer/geqo.h" extern void geqo_copy(PlannerInfo *root, Chromosome *chromo1, Chromosome *chromo2, int string_length); #endif /* GEQO_COPY_H */ ����������������������������������������������������������pgsql/server/optimizer/predtest.h�������������������������������������������������������������������0000644�����������������00000001234�14763166026�0013240 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * predtest.h * prototypes for predtest.c * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/predtest.h * *------------------------------------------------------------------------- */ #ifndef PREDTEST_H #define PREDTEST_H #include "nodes/primnodes.h" extern bool predicate_implied_by(List *predicate_list, List *restrictinfo_list); extern bool predicate_refuted_by(List *predicate_list, List *restrictinfo_list); #endif /* PREDTEST_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/geqo_recombination.h���������������������������������������������������������0000644�����������������00000005124�14763166026�0015254 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * geqo_recombination.h * prototypes for recombination in the genetic query optimizer * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/geqo_recombination.h * *------------------------------------------------------------------------- */ /* contributed by: =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= * Martin Utesch * Institute of Automatic Control * = = University of Mining and Technology = * utesch@aut.tu-freiberg.de * Freiberg, Germany * =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= */ /* -- parts of this are adapted from D. Whitley's Genitor algorithm -- */ #ifndef GEQO_RECOMBINATION_H #define GEQO_RECOMBINATION_H #include "optimizer/geqo.h" extern void init_tour(PlannerInfo *root, Gene *tour, int num_gene); /* edge recombination crossover [ERX] */ typedef struct Edge { Gene edge_list[4]; /* list of edges */ int total_edges; int unused_edges; } Edge; extern Edge *alloc_edge_table(PlannerInfo *root, int num_gene); extern void free_edge_table(PlannerInfo *root, Edge *edge_table); extern float gimme_edge_table(PlannerInfo *root, Gene *tour1, Gene *tour2, int num_gene, Edge *edge_table); extern int gimme_tour(PlannerInfo *root, Edge *edge_table, Gene *new_gene, int num_gene); /* partially matched crossover [PMX] */ #define DAD 1 /* indicator for gene from dad */ #define MOM 0 /* indicator for gene from mom */ extern void pmx(PlannerInfo *root, Gene *tour1, Gene *tour2, Gene *offspring, int num_gene); typedef struct City { int tour2_position; int tour1_position; int used; int select_list; } City; extern City *alloc_city_table(PlannerInfo *root, int num_gene); extern void free_city_table(PlannerInfo *root, City *city_table); /* cycle crossover [CX] */ extern int cx(PlannerInfo *root, Gene *tour1, Gene *tour2, Gene *offspring, int num_gene, City *city_table); /* position crossover [PX] */ extern void px(PlannerInfo *root, Gene *tour1, Gene *tour2, Gene *offspring, int num_gene, City *city_table); /* order crossover [OX1] according to Davis */ extern void ox1(PlannerInfo *root, Gene *mom, Gene *dad, Gene *offspring, int num_gene, City *city_table); /* order crossover [OX2] according to Syswerda */ extern void ox2(PlannerInfo *root, Gene *mom, Gene *dad, Gene *offspring, int num_gene, City *city_table); #endif /* GEQO_RECOMBINATION_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/plancat.h��������������������������������������������������������������������0000644�����������������00000003233�14763166026�0013031 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * plancat.h * prototypes for plancat.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/plancat.h * *------------------------------------------------------------------------- */ #ifndef PLANCAT_H #define PLANCAT_H #include "nodes/relation.h" #include "utils/relcache.h" /* Hook for plugins to get control in get_relation_info() */ typedef void (*get_relation_info_hook_type) (PlannerInfo *root, Oid relationObjectId, bool inhparent, RelOptInfo *rel); extern PGDLLIMPORT get_relation_info_hook_type get_relation_info_hook; extern void get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent, RelOptInfo *rel); extern void estimate_rel_size(Relation rel, int32 *attr_widths, BlockNumber *pages, double *tuples, double *allvisfrac); extern int32 get_relation_data_width(Oid relid, int32 *attr_widths); extern bool relation_excluded_by_constraints(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte); extern List *build_physical_tlist(PlannerInfo *root, RelOptInfo *rel); extern bool has_unique_index(RelOptInfo *rel, AttrNumber attno); extern Selectivity restriction_selectivity(PlannerInfo *root, Oid operatorid, List *args, Oid inputcollid, int varRelid); extern Selectivity join_selectivity(PlannerInfo *root, Oid operatorid, List *args, Oid inputcollid, JoinType jointype, SpecialJoinInfo *sjinfo); #endif /* PLANCAT_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/pathnode.h�������������������������������������������������������������������0000644�����������������00000013043�14763166026�0013211 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pathnode.h * prototypes for pathnode.c, relnode.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/pathnode.h * *------------------------------------------------------------------------- */ #ifndef PATHNODE_H #define PATHNODE_H #include "nodes/relation.h" /* * prototypes for pathnode.c */ extern int compare_path_costs(Path *path1, Path *path2, CostSelector criterion); extern int compare_fractional_path_costs(Path *path1, Path *path2, double fraction); extern void set_cheapest(RelOptInfo *parent_rel); extern void add_path(RelOptInfo *parent_rel, Path *new_path); extern bool add_path_precheck(RelOptInfo *parent_rel, Cost startup_cost, Cost total_cost, List *pathkeys, Relids required_outer); extern Path *create_seqscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer); extern IndexPath *create_index_path(PlannerInfo *root, IndexOptInfo *index, List *indexclauses, List *indexclausecols, List *indexorderbys, List *indexorderbycols, List *pathkeys, ScanDirection indexscandir, bool indexonly, Relids required_outer, double loop_count); extern BitmapHeapPath *create_bitmap_heap_path(PlannerInfo *root, RelOptInfo *rel, Path *bitmapqual, Relids required_outer, double loop_count); extern BitmapAndPath *create_bitmap_and_path(PlannerInfo *root, RelOptInfo *rel, List *bitmapquals); extern BitmapOrPath *create_bitmap_or_path(PlannerInfo *root, RelOptInfo *rel, List *bitmapquals); extern TidPath *create_tidscan_path(PlannerInfo *root, RelOptInfo *rel, List *tidquals); extern AppendPath *create_append_path(RelOptInfo *rel, List *subpaths, Relids required_outer); extern MergeAppendPath *create_merge_append_path(PlannerInfo *root, RelOptInfo *rel, List *subpaths, List *pathkeys, Relids required_outer); extern ResultPath *create_result_path(List *quals); extern MaterialPath *create_material_path(RelOptInfo *rel, Path *subpath); extern UniquePath *create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, SpecialJoinInfo *sjinfo); extern Path *create_subqueryscan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer); extern Path *create_functionscan_path(PlannerInfo *root, RelOptInfo *rel); extern Path *create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel); extern Path *create_ctescan_path(PlannerInfo *root, RelOptInfo *rel); extern Path *create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel); extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel, double rows, Cost startup_cost, Cost total_cost, List *pathkeys, Relids required_outer, List *fdw_private); extern Relids calc_nestloop_required_outer(Path *outer_path, Path *inner_path); extern Relids calc_non_nestloop_required_outer(Path *outer_path, Path *inner_path); extern NestPath *create_nestloop_path(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, JoinCostWorkspace *workspace, SpecialJoinInfo *sjinfo, SemiAntiJoinFactors *semifactors, Path *outer_path, Path *inner_path, List *restrict_clauses, List *pathkeys, Relids required_outer); extern MergePath *create_mergejoin_path(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, JoinCostWorkspace *workspace, SpecialJoinInfo *sjinfo, Path *outer_path, Path *inner_path, List *restrict_clauses, List *pathkeys, Relids required_outer, List *mergeclauses, List *outersortkeys, List *innersortkeys); extern HashPath *create_hashjoin_path(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, JoinCostWorkspace *workspace, SpecialJoinInfo *sjinfo, SemiAntiJoinFactors *semifactors, Path *outer_path, Path *inner_path, List *restrict_clauses, Relids required_outer, List *hashclauses); extern Path *reparameterize_path(PlannerInfo *root, Path *path, Relids required_outer, double loop_count); /* * prototypes for relnode.c */ extern void setup_simple_rel_arrays(PlannerInfo *root); extern RelOptInfo *build_simple_rel(PlannerInfo *root, int relid, RelOptKind reloptkind); extern RelOptInfo *find_base_rel(PlannerInfo *root, int relid); extern RelOptInfo *find_join_rel(PlannerInfo *root, Relids relids); extern RelOptInfo *build_join_rel(PlannerInfo *root, Relids joinrelids, RelOptInfo *outer_rel, RelOptInfo *inner_rel, SpecialJoinInfo *sjinfo, List **restrictlist_ptr); extern AppendRelInfo *find_childrel_appendrelinfo(PlannerInfo *root, RelOptInfo *rel); extern RelOptInfo *find_childrel_top_parent(PlannerInfo *root, RelOptInfo *rel); extern Relids find_childrel_parents(PlannerInfo *root, RelOptInfo *rel); extern ParamPathInfo *get_baserel_parampathinfo(PlannerInfo *root, RelOptInfo *baserel, Relids required_outer); extern ParamPathInfo *get_joinrel_parampathinfo(PlannerInfo *root, RelOptInfo *joinrel, Path *outer_path, Path *inner_path, SpecialJoinInfo *sjinfo, Relids required_outer, List **restrict_clauses); extern ParamPathInfo *get_appendrel_parampathinfo(RelOptInfo *appendrel, Relids required_outer); #endif /* PATHNODE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/geqo.h�����������������������������������������������������������������������0000644�����������������00000004175�14763166026�0012350 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * geqo.h * prototypes for various files in optimizer/geqo * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/geqo.h * *------------------------------------------------------------------------- */ /* contributed by: =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= * Martin Utesch * Institute of Automatic Control * = = University of Mining and Technology = * utesch@aut.tu-freiberg.de * Freiberg, Germany * =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= */ #ifndef GEQO_H #define GEQO_H #include "nodes/relation.h" #include "optimizer/geqo_gene.h" /* GEQO debug flag */ /* #define GEQO_DEBUG */ /* recombination mechanism */ /* #define ERX #define PMX #define CX #define PX #define OX1 #define OX2 */ #define ERX /* * Configuration options * * If you change these, update backend/utils/misc/postgresql.conf.sample */ extern int Geqo_effort; /* 1 .. 10, knob for adjustment of defaults */ #define DEFAULT_GEQO_EFFORT 5 #define MIN_GEQO_EFFORT 1 #define MAX_GEQO_EFFORT 10 extern int Geqo_pool_size; /* 2 .. inf, or 0 to use default */ extern int Geqo_generations; /* 1 .. inf, or 0 to use default */ extern double Geqo_selection_bias; #define DEFAULT_GEQO_SELECTION_BIAS 2.0 #define MIN_GEQO_SELECTION_BIAS 1.5 #define MAX_GEQO_SELECTION_BIAS 2.0 extern double Geqo_seed; /* 0 .. 1 */ /* * Private state for a GEQO run --- accessible via root->join_search_private */ typedef struct { List *initial_rels; /* the base relations we are joining */ unsigned short random_state[3]; /* state for pg_erand48() */ } GeqoPrivateData; /* routines in geqo_main.c */ extern RelOptInfo *geqo(PlannerInfo *root, int number_of_rels, List *initial_rels); /* routines in geqo_eval.c */ extern Cost geqo_eval(PlannerInfo *root, Gene *tour, int num_gene); extern RelOptInfo *gimme_tree(PlannerInfo *root, Gene *tour, int num_gene); #endif /* GEQO_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/joininfo.h�������������������������������������������������������������������0000644�����������������00000001504�14763166026�0013221 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * joininfo.h * prototypes for joininfo.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/joininfo.h * *------------------------------------------------------------------------- */ #ifndef JOININFO_H #define JOININFO_H #include "nodes/relation.h" extern bool have_relevant_joinclause(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2); extern void add_join_clause_to_rels(PlannerInfo *root, RestrictInfo *restrictinfo, Relids join_relids); extern void remove_join_clause_from_rels(PlannerInfo *root, RestrictInfo *restrictinfo, Relids join_relids); #endif /* JOININFO_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/cost.h�����������������������������������������������������������������������0000644�����������������00000016516�14763166026�0012367 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * cost.h * prototypes for costsize.c and clausesel.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/cost.h * *------------------------------------------------------------------------- */ #ifndef COST_H #define COST_H #include "nodes/plannodes.h" #include "nodes/relation.h" /* defaults for costsize.c's Cost parameters */ /* NB: cost-estimation code should use the variables, not these constants! */ /* If you change these, update backend/utils/misc/postgresql.sample.conf */ #define DEFAULT_SEQ_PAGE_COST 1.0 #define DEFAULT_RANDOM_PAGE_COST 4.0 #define DEFAULT_CPU_TUPLE_COST 0.01 #define DEFAULT_CPU_INDEX_TUPLE_COST 0.005 #define DEFAULT_CPU_OPERATOR_COST 0.0025 #define DEFAULT_EFFECTIVE_CACHE_SIZE 16384 /* measured in pages */ typedef enum { CONSTRAINT_EXCLUSION_OFF, /* do not use c_e */ CONSTRAINT_EXCLUSION_ON, /* apply c_e to all rels */ CONSTRAINT_EXCLUSION_PARTITION /* apply c_e to otherrels only */ } ConstraintExclusionType; /* * prototypes for costsize.c * routines to compute costs and sizes */ /* parameter variables and flags */ extern PGDLLIMPORT double seq_page_cost; extern PGDLLIMPORT double random_page_cost; extern PGDLLIMPORT double cpu_tuple_cost; extern PGDLLIMPORT double cpu_index_tuple_cost; extern PGDLLIMPORT double cpu_operator_cost; extern PGDLLIMPORT int effective_cache_size; extern Cost disable_cost; extern bool enable_seqscan; extern bool enable_indexscan; extern bool enable_indexonlyscan; extern bool enable_bitmapscan; extern bool enable_tidscan; extern bool enable_sort; extern bool enable_hashagg; extern bool enable_nestloop; extern bool enable_material; extern bool enable_mergejoin; extern bool enable_hashjoin; extern int constraint_exclusion; extern double clamp_row_est(double nrows); extern double index_pages_fetched(double tuples_fetched, BlockNumber pages, double index_pages, PlannerInfo *root); extern void cost_seqscan(Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info); extern void cost_index(IndexPath *path, PlannerInfo *root, double loop_count); extern void cost_bitmap_heap_scan(Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info, Path *bitmapqual, double loop_count); extern void cost_bitmap_and_node(BitmapAndPath *path, PlannerInfo *root); extern void cost_bitmap_or_node(BitmapOrPath *path, PlannerInfo *root); extern void cost_bitmap_tree_node(Path *path, Cost *cost, Selectivity *selec); extern void cost_tidscan(Path *path, PlannerInfo *root, RelOptInfo *baserel, List *tidquals); extern void cost_subqueryscan(Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info); extern void cost_functionscan(Path *path, PlannerInfo *root, RelOptInfo *baserel); extern void cost_valuesscan(Path *path, PlannerInfo *root, RelOptInfo *baserel); extern void cost_ctescan(Path *path, PlannerInfo *root, RelOptInfo *baserel); extern void cost_recursive_union(Plan *runion, Plan *nrterm, Plan *rterm); extern void cost_sort(Path *path, PlannerInfo *root, List *pathkeys, Cost input_cost, double tuples, int width, Cost comparison_cost, int sort_mem, double limit_tuples); extern void cost_merge_append(Path *path, PlannerInfo *root, List *pathkeys, int n_streams, Cost input_startup_cost, Cost input_total_cost, double tuples); extern void cost_material(Path *path, Cost input_startup_cost, Cost input_total_cost, double tuples, int width); extern void cost_agg(Path *path, PlannerInfo *root, AggStrategy aggstrategy, const AggClauseCosts *aggcosts, int numGroupCols, double numGroups, Cost input_startup_cost, Cost input_total_cost, double input_tuples); extern void cost_windowagg(Path *path, PlannerInfo *root, List *windowFuncs, int numPartCols, int numOrderCols, Cost input_startup_cost, Cost input_total_cost, double input_tuples); extern void cost_group(Path *path, PlannerInfo *root, int numGroupCols, double numGroups, Cost input_startup_cost, Cost input_total_cost, double input_tuples); extern void initial_cost_nestloop(PlannerInfo *root, JoinCostWorkspace *workspace, JoinType jointype, Path *outer_path, Path *inner_path, SpecialJoinInfo *sjinfo, SemiAntiJoinFactors *semifactors); extern void final_cost_nestloop(PlannerInfo *root, NestPath *path, JoinCostWorkspace *workspace, SpecialJoinInfo *sjinfo, SemiAntiJoinFactors *semifactors); extern void initial_cost_mergejoin(PlannerInfo *root, JoinCostWorkspace *workspace, JoinType jointype, List *mergeclauses, Path *outer_path, Path *inner_path, List *outersortkeys, List *innersortkeys, SpecialJoinInfo *sjinfo); extern void final_cost_mergejoin(PlannerInfo *root, MergePath *path, JoinCostWorkspace *workspace, SpecialJoinInfo *sjinfo); extern void initial_cost_hashjoin(PlannerInfo *root, JoinCostWorkspace *workspace, JoinType jointype, List *hashclauses, Path *outer_path, Path *inner_path, SpecialJoinInfo *sjinfo, SemiAntiJoinFactors *semifactors); extern void final_cost_hashjoin(PlannerInfo *root, HashPath *path, JoinCostWorkspace *workspace, SpecialJoinInfo *sjinfo, SemiAntiJoinFactors *semifactors); extern void cost_subplan(PlannerInfo *root, SubPlan *subplan, Plan *plan); extern void cost_qual_eval(QualCost *cost, List *quals, PlannerInfo *root); extern void cost_qual_eval_node(QualCost *cost, Node *qual, PlannerInfo *root); extern void compute_semi_anti_join_factors(PlannerInfo *root, RelOptInfo *outerrel, RelOptInfo *innerrel, JoinType jointype, SpecialJoinInfo *sjinfo, List *restrictlist, SemiAntiJoinFactors *semifactors); extern void set_baserel_size_estimates(PlannerInfo *root, RelOptInfo *rel); extern double get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel, List *param_clauses); extern double get_parameterized_joinrel_size(PlannerInfo *root, RelOptInfo *rel, double outer_rows, double inner_rows, SpecialJoinInfo *sjinfo, List *restrict_clauses); extern void set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, SpecialJoinInfo *sjinfo, List *restrictlist); extern void set_subquery_size_estimates(PlannerInfo *root, RelOptInfo *rel); extern void set_function_size_estimates(PlannerInfo *root, RelOptInfo *rel); extern void set_values_size_estimates(PlannerInfo *root, RelOptInfo *rel); extern void set_cte_size_estimates(PlannerInfo *root, RelOptInfo *rel, Plan *cteplan); extern void set_foreign_size_estimates(PlannerInfo *root, RelOptInfo *rel); /* * prototypes for clausesel.c * routines to compute clause selectivities */ extern Selectivity clauselist_selectivity(PlannerInfo *root, List *clauses, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo); extern Selectivity clause_selectivity(PlannerInfo *root, Node *clause, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo); #endif /* COST_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/planner.h��������������������������������������������������������������������0000644�����������������00000002523�14763166026�0013047 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * planner.h * prototypes for planner.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/planner.h * *------------------------------------------------------------------------- */ #ifndef PLANNER_H #define PLANNER_H #include "nodes/plannodes.h" #include "nodes/relation.h" /* Hook for plugins to get control in planner() */ typedef PlannedStmt *(*planner_hook_type) (Query *parse, int cursorOptions, ParamListInfo boundParams); extern PGDLLIMPORT planner_hook_type planner_hook; extern PlannedStmt *planner(Query *parse, int cursorOptions, ParamListInfo boundParams); extern PlannedStmt *standard_planner(Query *parse, int cursorOptions, ParamListInfo boundParams); extern Plan *subquery_planner(PlannerGlobal *glob, Query *parse, PlannerInfo *parent_root, bool hasRecursion, double tuple_fraction, PlannerInfo **subroot); extern void add_tlist_costs_to_plan(PlannerInfo *root, Plan *plan, List *tlist); extern bool is_dummy_plan(Plan *plan); extern Expr *expression_planner(Expr *expr); extern bool plan_cluster_use_sort(Oid tableOid, Oid indexOid); #endif /* PLANNER_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/geqo_selection.h�������������������������������������������������������������0000644�����������������00000001767�14763166026�0014421 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * geqo_selection.h * prototypes for selection routines in optimizer/geqo * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/geqo_selection.h * *------------------------------------------------------------------------- */ /* contributed by: =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= * Martin Utesch * Institute of Automatic Control * = = University of Mining and Technology = * utesch@aut.tu-freiberg.de * Freiberg, Germany * =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= */ #ifndef GEQO_SELECTION_H #define GEQO_SELECTION_H #include "optimizer/geqo.h" extern void geqo_selection(PlannerInfo *root, Chromosome *momma, Chromosome *daddy, Pool *pool, double bias); #endif /* GEQO_SELECTION_H */ ���������pgsql/server/optimizer/clauses.h��������������������������������������������������������������������0000644�����������������00000005603�14763166026�0013051 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * clauses.h * prototypes for clauses.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/clauses.h * *------------------------------------------------------------------------- */ #ifndef CLAUSES_H #define CLAUSES_H #include "nodes/relation.h" #define is_opclause(clause) ((clause) != NULL && IsA(clause, OpExpr)) #define is_funcclause(clause) ((clause) != NULL && IsA(clause, FuncExpr)) typedef struct { int numWindowFuncs; /* total number of WindowFuncs found */ Index maxWinRef; /* windowFuncs[] is indexed 0 .. maxWinRef */ List **windowFuncs; /* lists of WindowFuncs for each winref */ } WindowFuncLists; extern Expr *make_opclause(Oid opno, Oid opresulttype, bool opretset, Expr *leftop, Expr *rightop, Oid opcollid, Oid inputcollid); extern Node *get_leftop(const Expr *clause); extern Node *get_rightop(const Expr *clause); extern bool not_clause(Node *clause); extern Expr *make_notclause(Expr *notclause); extern Expr *get_notclausearg(Expr *notclause); extern bool or_clause(Node *clause); extern Expr *make_orclause(List *orclauses); extern bool and_clause(Node *clause); extern Expr *make_andclause(List *andclauses); extern Node *make_and_qual(Node *qual1, Node *qual2); extern Expr *make_ands_explicit(List *andclauses); extern List *make_ands_implicit(Expr *clause); extern bool contain_agg_clause(Node *clause); extern void count_agg_clauses(PlannerInfo *root, Node *clause, AggClauseCosts *costs); extern bool contain_window_function(Node *clause); extern WindowFuncLists *find_window_functions(Node *clause, Index maxWinRef); extern double expression_returns_set_rows(Node *clause); extern double tlist_returns_set_rows(List *tlist); extern bool contain_subplans(Node *clause); extern bool contain_mutable_functions(Node *clause); extern bool contain_volatile_functions(Node *clause); extern bool contain_nonstrict_functions(Node *clause); extern bool contain_leaky_functions(Node *clause); extern Relids find_nonnullable_rels(Node *clause); extern List *find_nonnullable_vars(Node *clause); extern List *find_forced_null_vars(Node *clause); extern Var *find_forced_null_var(Node *clause); extern bool is_pseudo_constant_clause(Node *clause); extern bool is_pseudo_constant_clause_relids(Node *clause, Relids relids); extern int NumRelids(Node *clause); extern void CommuteOpExpr(OpExpr *clause); extern void CommuteRowCompareExpr(RowCompareExpr *clause); extern Node *strip_implicit_coercions(Node *node); extern Node *eval_const_expressions(PlannerInfo *root, Node *node); extern Node *estimate_expression_value(PlannerInfo *root, Node *node); extern Query *inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte); #endif /* CLAUSES_H */ �����������������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/restrictinfo.h���������������������������������������������������������������0000644�����������������00000003332�14763166026�0014122 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * restrictinfo.h * prototypes for restrictinfo.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/restrictinfo.h * *------------------------------------------------------------------------- */ #ifndef RESTRICTINFO_H #define RESTRICTINFO_H #include "nodes/relation.h" /* Convenience macro for the common case of a valid-everywhere qual */ #define make_simple_restrictinfo(clause) \ make_restrictinfo(clause, true, false, false, NULL, NULL, NULL) extern RestrictInfo *make_restrictinfo(Expr *clause, bool is_pushed_down, bool outerjoin_delayed, bool pseudoconstant, Relids required_relids, Relids outer_relids, Relids nullable_relids); extern List *make_restrictinfo_from_bitmapqual(Path *bitmapqual, bool is_pushed_down, bool include_predicates); extern List *make_restrictinfos_from_actual_clauses(PlannerInfo *root, List *clause_list); extern bool restriction_is_or_clause(RestrictInfo *restrictinfo); extern List *get_actual_clauses(List *restrictinfo_list); extern List *get_all_actual_clauses(List *restrictinfo_list); extern List *extract_actual_clauses(List *restrictinfo_list, bool pseudoconstant); extern void extract_actual_join_clauses(List *restrictinfo_list, List **joinquals, List **otherquals); extern bool join_clause_is_movable_to(RestrictInfo *rinfo, Index baserelid); extern bool join_clause_is_movable_into(RestrictInfo *rinfo, Relids currentrelids, Relids current_and_outer); #endif /* RESTRICTINFO_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/subselect.h������������������������������������������������������������������0000644�����������������00000002611�14763166026�0013377 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * subselect.h * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/subselect.h * *------------------------------------------------------------------------- */ #ifndef SUBSELECT_H #define SUBSELECT_H #include "nodes/plannodes.h" #include "nodes/relation.h" extern void SS_process_ctes(PlannerInfo *root); extern JoinExpr *convert_ANY_sublink_to_join(PlannerInfo *root, SubLink *sublink, Relids available_rels); extern JoinExpr *convert_EXISTS_sublink_to_join(PlannerInfo *root, SubLink *sublink, bool under_not, Relids available_rels); extern Node *SS_replace_correlation_vars(PlannerInfo *root, Node *expr); extern Node *SS_process_sublinks(PlannerInfo *root, Node *expr, bool isQual); extern void SS_finalize_plan(PlannerInfo *root, Plan *plan, bool attach_initplans); extern Param *SS_make_initplan_from_plan(PlannerInfo *root, Plan *plan, Oid resulttype, int32 resulttypmod, Oid resultcollation); extern Param *assign_nestloop_param_var(PlannerInfo *root, Var *var); extern Param *assign_nestloop_param_placeholdervar(PlannerInfo *root, PlaceHolderVar *phv); extern int SS_assign_special_param(PlannerInfo *root); #endif /* SUBSELECT_H */ �����������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/paths.h����������������������������������������������������������������������0000644�����������������00000015525�14763166026�0012535 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * paths.h * prototypes for various files in optimizer/path * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/paths.h * *------------------------------------------------------------------------- */ #ifndef PATHS_H #define PATHS_H #include "nodes/relation.h" /* * allpaths.c */ extern bool enable_geqo; extern int geqo_threshold; /* Hook for plugins to replace standard_join_search() */ typedef RelOptInfo *(*join_search_hook_type) (PlannerInfo *root, int levels_needed, List *initial_rels); extern PGDLLIMPORT join_search_hook_type join_search_hook; extern RelOptInfo *make_one_rel(PlannerInfo *root, List *joinlist); extern RelOptInfo *standard_join_search(PlannerInfo *root, int levels_needed, List *initial_rels); #ifdef OPTIMIZER_DEBUG extern void debug_print_rel(PlannerInfo *root, RelOptInfo *rel); #endif /* * indxpath.c * routines to generate index paths */ extern void create_index_paths(PlannerInfo *root, RelOptInfo *rel); extern List *generate_bitmap_or_paths(PlannerInfo *root, RelOptInfo *rel, List *clauses, List *other_clauses, bool restriction_only); extern bool relation_has_unique_index_for(PlannerInfo *root, RelOptInfo *rel, List *restrictlist, List *exprlist, List *oprlist); extern bool eclass_member_matches_indexcol(EquivalenceClass *ec, EquivalenceMember *em, IndexOptInfo *index, int indexcol); extern bool match_index_to_operand(Node *operand, int indexcol, IndexOptInfo *index); extern void expand_indexqual_conditions(IndexOptInfo *index, List *indexclauses, List *indexclausecols, List **indexquals_p, List **indexqualcols_p); extern void check_partial_indexes(PlannerInfo *root, RelOptInfo *rel); extern Expr *adjust_rowcompare_for_index(RowCompareExpr *clause, IndexOptInfo *index, int indexcol, List **indexcolnos, bool *var_on_left_p); /* * orindxpath.c * additional routines for indexable OR clauses */ extern bool create_or_index_quals(PlannerInfo *root, RelOptInfo *rel); /* * tidpath.h * routines to generate tid paths */ extern void create_tidscan_paths(PlannerInfo *root, RelOptInfo *rel); /* * joinpath.c * routines to create join paths */ extern void add_paths_to_joinrel(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel, JoinType jointype, SpecialJoinInfo *sjinfo, List *restrictlist); /* * joinrels.c * routines to determine which relations to join */ extern void join_search_one_level(PlannerInfo *root, int level); extern RelOptInfo *make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2); extern bool have_join_order_restriction(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2); /* * equivclass.c * routines for managing EquivalenceClasses */ extern bool process_equivalence(PlannerInfo *root, RestrictInfo *restrictinfo, bool below_outer_join); extern Expr *canonicalize_ec_expression(Expr *expr, Oid req_type, Oid req_collation); extern void reconsider_outer_join_clauses(PlannerInfo *root); extern EquivalenceClass *get_eclass_for_sort_expr(PlannerInfo *root, Expr *expr, Relids nullable_relids, List *opfamilies, Oid opcintype, Oid collation, Index sortref, Relids rel, bool create_it); extern void generate_base_implied_equalities(PlannerInfo *root); extern List *generate_join_implied_equalities(PlannerInfo *root, Relids join_relids, Relids outer_relids, RelOptInfo *inner_rel); extern List *generate_join_implied_equalities_for_ecs(PlannerInfo *root, List *eclasses, Relids join_relids, Relids outer_relids, RelOptInfo *inner_rel); extern bool exprs_known_equal(PlannerInfo *root, Node *item1, Node *item2); extern void add_child_rel_equivalences(PlannerInfo *root, AppendRelInfo *appinfo, RelOptInfo *parent_rel, RelOptInfo *child_rel); extern void mutate_eclass_expressions(PlannerInfo *root, Node *(*mutator) (), void *context, bool include_child_exprs); extern List *generate_implied_equalities_for_indexcol(PlannerInfo *root, IndexOptInfo *index, int indexcol); extern bool have_relevant_eclass_joinclause(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2); extern bool has_relevant_eclass_joinclause(PlannerInfo *root, RelOptInfo *rel1); extern bool eclass_useful_for_merging(EquivalenceClass *eclass, RelOptInfo *rel); extern bool is_redundant_derived_clause(RestrictInfo *rinfo, List *clauselist); /* * pathkeys.c * utilities for matching and building path keys */ typedef enum { PATHKEYS_EQUAL, /* pathkeys are identical */ PATHKEYS_BETTER1, /* pathkey 1 is a superset of pathkey 2 */ PATHKEYS_BETTER2, /* vice versa */ PATHKEYS_DIFFERENT /* neither pathkey includes the other */ } PathKeysComparison; extern List *canonicalize_pathkeys(PlannerInfo *root, List *pathkeys); extern PathKeysComparison compare_pathkeys(List *keys1, List *keys2); extern bool pathkeys_contained_in(List *keys1, List *keys2); extern Path *get_cheapest_path_for_pathkeys(List *paths, List *pathkeys, Relids required_outer, CostSelector cost_criterion); extern Path *get_cheapest_fractional_path_for_pathkeys(List *paths, List *pathkeys, Relids required_outer, double fraction); extern List *build_index_pathkeys(PlannerInfo *root, IndexOptInfo *index, ScanDirection scandir); extern List *convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel, List *subquery_pathkeys); extern List *build_join_pathkeys(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, List *outer_pathkeys); extern List *make_pathkeys_for_sortclauses(PlannerInfo *root, List *sortclauses, List *tlist, bool canonicalize); extern void initialize_mergeclause_eclasses(PlannerInfo *root, RestrictInfo *restrictinfo); extern void update_mergeclause_eclasses(PlannerInfo *root, RestrictInfo *restrictinfo); extern List *find_mergeclauses_for_pathkeys(PlannerInfo *root, List *pathkeys, bool outer_keys, List *restrictinfos); extern List *select_outer_pathkeys_for_merge(PlannerInfo *root, List *mergeclauses, RelOptInfo *joinrel); extern List *make_inner_pathkeys_for_merge(PlannerInfo *root, List *mergeclauses, List *outer_pathkeys); extern List *truncate_useless_pathkeys(PlannerInfo *root, RelOptInfo *rel, List *pathkeys); extern bool has_useful_pathkeys(PlannerInfo *root, RelOptInfo *rel); #endif /* PATHS_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/tlist.h����������������������������������������������������������������������0000644�����������������00000003276�14763166026�0012555 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * tlist.h * prototypes for tlist.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/tlist.h * *------------------------------------------------------------------------- */ #ifndef TLIST_H #define TLIST_H #include "optimizer/var.h" extern TargetEntry *tlist_member(Node *node, List *targetlist); extern TargetEntry *tlist_member_ignore_relabel(Node *node, List *targetlist); extern TargetEntry *tlist_member_match_var(Var *var, List *targetlist); extern List *flatten_tlist(List *tlist, PVCAggregateBehavior aggbehavior, PVCPlaceHolderBehavior phbehavior); extern List *add_to_flat_tlist(List *tlist, List *exprs); extern List *get_tlist_exprs(List *tlist, bool includeJunk); extern bool tlist_same_exprs(List *tlist1, List *tlist2); extern bool tlist_same_datatypes(List *tlist, List *colTypes, bool junkOK); extern bool tlist_same_collations(List *tlist, List *colCollations, bool junkOK); extern TargetEntry *get_sortgroupref_tle(Index sortref, List *targetList); extern TargetEntry *get_sortgroupclause_tle(SortGroupClause *sgClause, List *targetList); extern Node *get_sortgroupclause_expr(SortGroupClause *sgClause, List *targetList); extern List *get_sortgrouplist_exprs(List *sgClauses, List *targetList); extern Oid *extract_grouping_ops(List *groupClause); extern AttrNumber *extract_grouping_cols(List *groupClause, List *tlist); extern bool grouping_is_sortable(List *groupClause); extern bool grouping_is_hashable(List *groupClause); #endif /* TLIST_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/geqo_random.h����������������������������������������������������������������0000644�����������������00000002440�14763166026�0013701 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * geqo_random.h * random number generator * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/geqo_random.h * *------------------------------------------------------------------------- */ /* contributed by: =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= * Martin Utesch * Institute of Automatic Control * = = University of Mining and Technology = * utesch@aut.tu-freiberg.de * Freiberg, Germany * =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= */ /* -- parts of this are adapted from D. Whitley's Genitor algorithm -- */ #ifndef GEQO_RANDOM_H #define GEQO_RANDOM_H #include <math.h> #include "optimizer/geqo.h" extern void geqo_set_seed(PlannerInfo *root, double seed); /* geqo_rand returns a random float value between 0 and 1 inclusive */ extern double geqo_rand(PlannerInfo *root); /* geqo_randint returns integer value between lower and upper inclusive */ #define geqo_randint(root, upper, lower) \ ( (int) floor( geqo_rand(root)*(((upper)-(lower))+0.999999) ) + (lower) ) #endif /* GEQO_RANDOM_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/prep.h�����������������������������������������������������������������������0000644�����������������00000003352�14763166026�0012357 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * prep.h * prototypes for files in optimizer/prep/ * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/prep.h * *------------------------------------------------------------------------- */ #ifndef PREP_H #define PREP_H #include "nodes/plannodes.h" #include "nodes/relation.h" /* * prototypes for prepjointree.c */ extern void pull_up_sublinks(PlannerInfo *root); extern void inline_set_returning_functions(PlannerInfo *root); extern Node *pull_up_subqueries(PlannerInfo *root, Node *jtnode, JoinExpr *lowest_outer_join, AppendRelInfo *containing_appendrel); extern void flatten_simple_union_all(PlannerInfo *root); extern void reduce_outer_joins(PlannerInfo *root); extern Relids get_relids_in_jointree(Node *jtnode, bool include_joins); extern Relids get_relids_for_join(PlannerInfo *root, int joinrelid); /* * prototypes for prepqual.c */ extern Node *negate_clause(Node *node); extern Expr *canonicalize_qual(Expr *qual); /* * prototypes for preptlist.c */ extern List *preprocess_targetlist(PlannerInfo *root, List *tlist); extern PlanRowMark *get_plan_rowmark(List *rowmarks, Index rtindex); /* * prototypes for prepunion.c */ extern Plan *plan_set_operations(PlannerInfo *root, double tuple_fraction, List **sortClauses); extern void expand_inherited_tables(PlannerInfo *root); extern Node *adjust_appendrel_attrs(PlannerInfo *root, Node *node, AppendRelInfo *appinfo); extern Node *adjust_appendrel_attrs_multilevel(PlannerInfo *root, Node *node, RelOptInfo *child_rel); #endif /* PREP_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/placeholder.h����������������������������������������������������������������0000644�����������������00000002321�14763166026�0013666 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * placeholder.h * prototypes for optimizer/util/placeholder.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/placeholder.h * *------------------------------------------------------------------------- */ #ifndef PLACEHOLDER_H #define PLACEHOLDER_H #include "nodes/relation.h" extern PlaceHolderVar *make_placeholder_expr(PlannerInfo *root, Expr *expr, Relids phrels); extern PlaceHolderInfo *find_placeholder_info(PlannerInfo *root, PlaceHolderVar *phv, bool create_new_ph); extern void find_placeholders_in_jointree(PlannerInfo *root); extern void mark_placeholder_maybe_needed(PlannerInfo *root, PlaceHolderInfo *phinfo, Relids relids); extern void update_placeholder_eval_levels(PlannerInfo *root, SpecialJoinInfo *new_sjinfo); extern void fix_placeholder_input_needed_levels(PlannerInfo *root); extern void add_placeholders_to_base_rels(PlannerInfo *root); extern void add_placeholders_to_joinrel(PlannerInfo *root, RelOptInfo *joinrel); #endif /* PLACEHOLDER_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/var.h������������������������������������������������������������������������0000644�����������������00000002776�14763166026�0012212 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * var.h * prototypes for optimizer/util/var.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/var.h * *------------------------------------------------------------------------- */ #ifndef VAR_H #define VAR_H #include "nodes/relation.h" typedef enum { PVC_REJECT_AGGREGATES, /* throw error if Aggref found */ PVC_INCLUDE_AGGREGATES, /* include Aggrefs in output list */ PVC_RECURSE_AGGREGATES /* recurse into Aggref arguments */ } PVCAggregateBehavior; typedef enum { PVC_REJECT_PLACEHOLDERS, /* throw error if PlaceHolderVar found */ PVC_INCLUDE_PLACEHOLDERS, /* include PlaceHolderVars in output list */ PVC_RECURSE_PLACEHOLDERS /* recurse into PlaceHolderVar arguments */ } PVCPlaceHolderBehavior; extern Relids pull_varnos(Node *node); extern void pull_varattnos(Node *node, Index varno, Bitmapset **varattnos); extern bool contain_var_clause(Node *node); extern bool contain_vars_of_level(Node *node, int levelsup); extern int locate_var_of_level(Node *node, int levelsup); extern int locate_var_of_relation(Node *node, int relid, int levelsup); extern int find_minimum_var_level(Node *node); extern List *pull_var_clause(Node *node, PVCAggregateBehavior aggbehavior, PVCPlaceHolderBehavior phbehavior); extern Node *flatten_join_alias_vars(PlannerInfo *root, Node *node); #endif /* VAR_H */ ��pgsql/server/optimizer/geqo_gene.h������������������������������������������������������������������0000644�����������������00000002132�14763166026�0013335 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * geqo_gene.h * genome representation in optimizer/geqo * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/geqo_gene.h * *------------------------------------------------------------------------- */ /* contributed by: =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= * Martin Utesch * Institute of Automatic Control * = = University of Mining and Technology = * utesch@aut.tu-freiberg.de * Freiberg, Germany * =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= */ #ifndef GEQO_GENE_H #define GEQO_GENE_H #include "nodes/nodes.h" /* we presume that int instead of Relid is o.k. for Gene; so don't change it! */ typedef int Gene; typedef struct Chromosome { Gene *string; Cost worth; } Chromosome; typedef struct Pool { Chromosome *data; int size; int string_length; } Pool; #endif /* GEQO_GENE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/planmain.h�������������������������������������������������������������������0000644�����������������00000012150�14763166026�0013204 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * planmain.h * prototypes for various files in optimizer/plan * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/planmain.h * *------------------------------------------------------------------------- */ #ifndef PLANMAIN_H #define PLANMAIN_H #include "nodes/plannodes.h" #include "nodes/relation.h" /* GUC parameters */ #define DEFAULT_CURSOR_TUPLE_FRACTION 0.1 extern double cursor_tuple_fraction; /* query_planner callback to compute query_pathkeys */ typedef void (*query_pathkeys_callback) (PlannerInfo *root, void *extra); /* * prototypes for plan/planmain.c */ extern void query_planner(PlannerInfo *root, List *tlist, double tuple_fraction, double limit_tuples, query_pathkeys_callback qp_callback, void *qp_extra, Path **cheapest_path, Path **sorted_path, double *num_groups); /* * prototypes for plan/planagg.c */ extern void preprocess_minmax_aggregates(PlannerInfo *root, List *tlist); extern Plan *optimize_minmax_aggregates(PlannerInfo *root, List *tlist, const AggClauseCosts *aggcosts, Path *best_path); /* * prototypes for plan/createplan.c */ extern Plan *create_plan(PlannerInfo *root, Path *best_path); extern SubqueryScan *make_subqueryscan(List *qptlist, List *qpqual, Index scanrelid, Plan *subplan); extern ForeignScan *make_foreignscan(List *qptlist, List *qpqual, Index scanrelid, List *fdw_exprs, List *fdw_private); extern Append *make_append(List *appendplans, List *tlist); extern RecursiveUnion *make_recursive_union(List *tlist, Plan *lefttree, Plan *righttree, int wtParam, List *distinctList, long numGroups); extern Sort *make_sort_from_pathkeys(PlannerInfo *root, Plan *lefttree, List *pathkeys, double limit_tuples); extern Sort *make_sort_from_sortclauses(PlannerInfo *root, List *sortcls, Plan *lefttree); extern Sort *make_sort_from_groupcols(PlannerInfo *root, List *groupcls, AttrNumber *grpColIdx, Plan *lefttree); extern Agg *make_agg(PlannerInfo *root, List *tlist, List *qual, AggStrategy aggstrategy, const AggClauseCosts *aggcosts, int numGroupCols, AttrNumber *grpColIdx, Oid *grpOperators, long numGroups, Plan *lefttree); extern WindowAgg *make_windowagg(PlannerInfo *root, List *tlist, List *windowFuncs, Index winref, int partNumCols, AttrNumber *partColIdx, Oid *partOperators, int ordNumCols, AttrNumber *ordColIdx, Oid *ordOperators, int frameOptions, Node *startOffset, Node *endOffset, Plan *lefttree); extern Group *make_group(PlannerInfo *root, List *tlist, List *qual, int numGroupCols, AttrNumber *grpColIdx, Oid *grpOperators, double numGroups, Plan *lefttree); extern Plan *materialize_finished_plan(Plan *subplan); extern Unique *make_unique(Plan *lefttree, List *distinctList); extern LockRows *make_lockrows(Plan *lefttree, List *rowMarks, int epqParam); extern Limit *make_limit(Plan *lefttree, Node *limitOffset, Node *limitCount, int64 offset_est, int64 count_est); extern SetOp *make_setop(SetOpCmd cmd, SetOpStrategy strategy, Plan *lefttree, List *distinctList, AttrNumber flagColIdx, int firstFlag, long numGroups, double outputRows); extern Result *make_result(PlannerInfo *root, List *tlist, Node *resconstantqual, Plan *subplan); extern ModifyTable *make_modifytable(CmdType operation, bool canSetTag, List *resultRelations, List *subplans, List *returningLists, List *rowMarks, int epqParam); extern bool is_projection_capable_plan(Plan *plan); /* * prototypes for plan/initsplan.c */ extern int from_collapse_limit; extern int join_collapse_limit; extern void add_base_rels_to_query(PlannerInfo *root, Node *jtnode); extern void build_base_rel_tlists(PlannerInfo *root, List *final_tlist); extern void add_vars_to_targetlist(PlannerInfo *root, List *vars, Relids where_needed, bool create_new_ph); extern List *deconstruct_jointree(PlannerInfo *root); extern void distribute_restrictinfo_to_rels(PlannerInfo *root, RestrictInfo *restrictinfo); extern void process_implied_equality(PlannerInfo *root, Oid opno, Oid collation, Expr *item1, Expr *item2, Relids qualscope, Relids nullable_relids, bool below_outer_join, bool both_const); extern RestrictInfo *build_implied_join_equality(Oid opno, Oid collation, Expr *item1, Expr *item2, Relids qualscope, Relids nullable_relids); /* * prototypes for plan/analyzejoins.c */ extern List *remove_useless_joins(PlannerInfo *root, List *joinlist); /* * prototypes for plan/setrefs.c */ extern Plan *set_plan_references(PlannerInfo *root, Plan *plan); extern void fix_opfuncids(Node *node); extern void set_opfuncid(OpExpr *opexpr); extern void set_sa_opfuncid(ScalarArrayOpExpr *opexpr); extern void record_plan_function_dependency(PlannerInfo *root, Oid funcid); extern void extract_query_dependencies(Node *query, List **relationOids, List **invalItems); #endif /* PLANMAIN_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/optimizer/geqo_pool.h������������������������������������������������������������������0000644�����������������00000002445�14763166026�0013377 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * geqo_pool.h * pool representation in optimizer/geqo * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/optimizer/geqo_pool.h * *------------------------------------------------------------------------- */ /* contributed by: =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= * Martin Utesch * Institute of Automatic Control * = = University of Mining and Technology = * utesch@aut.tu-freiberg.de * Freiberg, Germany * =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= */ #ifndef GEQO_POOL_H #define GEQO_POOL_H #include "optimizer/geqo.h" extern Pool *alloc_pool(PlannerInfo *root, int pool_size, int string_length); extern void free_pool(PlannerInfo *root, Pool *pool); extern void random_init_pool(PlannerInfo *root, Pool *pool); extern Chromosome *alloc_chromo(PlannerInfo *root, int string_length); extern void free_chromo(PlannerInfo *root, Chromosome *chromo); extern void spread_chromo(PlannerInfo *root, Chromosome *chromo, Pool *pool); extern void sort_pool(PlannerInfo *root, Pool *pool); #endif /* GEQO_POOL_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/c.h������������������������������������������������������������������������������������0000644�����������������00000062501�14763166026�0007612 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * c.h * Fundamental C definitions. This is included by every .c file in * PostgreSQL (via either postgres.h or postgres_fe.h, as appropriate). * * Note that the definitions here are not intended to be exposed to clients * of the frontend interface libraries --- so we don't worry much about * polluting the namespace with lots of stuff... * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/c.h * *------------------------------------------------------------------------- */ /* *---------------------------------------------------------------- * TABLE OF CONTENTS * * When adding stuff to this file, please try to put stuff * into the relevant section, or add new sections as appropriate. * * section description * ------- ------------------------------------------------ * 0) pg_config.h and standard system headers * 1) hacks to cope with non-ANSI C compilers * 2) bool, true, false, TRUE, FALSE, NULL * 3) standard system types * 4) IsValid macros for system types * 5) offsetof, lengthof, endof, alignment * 6) widely useful macros * 7) random stuff * 8) system-specific hacks * * NOTE: since this file is included by both frontend and backend modules, it's * almost certainly wrong to put an "extern" declaration here. typedefs and * macros are the kind of thing that might go here. * *---------------------------------------------------------------- */ #ifndef C_H #define C_H /* * We have to include stdlib.h here because it defines many of these macros * on some platforms, and we only want our definitions used if stdlib.h doesn't * have its own. The same goes for stddef and stdarg if present. */ #include "pg_config.h" #include "pg_config_manual.h" /* must be after pg_config.h */ #if !defined(WIN32) && !defined(__CYGWIN__) /* win32 will include further * down */ #include "pg_config_os.h" /* must be before any system header files */ #endif #include "postgres_ext.h" #if _MSC_VER >= 1400 || defined(HAVE_CRTDEFS_H) #define errcode __msvc_errcode #include <crtdefs.h> #undef errcode #endif #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stddef.h> #include <stdarg.h> #ifdef HAVE_STRINGS_H #include <strings.h> #endif #ifdef HAVE_STDINT_H #include <stdint.h> #endif #include <sys/types.h> #include <errno.h> #if defined(WIN32) || defined(__CYGWIN__) #include <fcntl.h> /* ensure O_BINARY is available */ #endif #if defined(WIN32) || defined(__CYGWIN__) /* We have to redefine some system functions after they are included above. */ #include "pg_config_os.h" #endif /* Must be before gettext() games below */ #include <locale.h> #define _(x) gettext(x) #ifdef ENABLE_NLS #include <libintl.h> #else #define gettext(x) (x) #define dgettext(d,x) (x) #define ngettext(s,p,n) ((n) == 1 ? (s) : (p)) #define dngettext(d,s,p,n) ((n) == 1 ? (s) : (p)) #endif /* * Use this to mark string constants as needing translation at some later * time, rather than immediately. This is useful for cases where you need * access to the original string and translated string, and for cases where * immediate translation is not possible, like when initializing global * variables. * http://www.gnu.org/software/autoconf/manual/gettext/Special-cases.html */ #define gettext_noop(x) (x) /* ---------------------------------------------------------------- * Section 1: hacks to cope with non-ANSI C compilers * * type prefixes (const, signed, volatile, inline) are handled in pg_config.h. * ---------------------------------------------------------------- */ /* * Hints to the compiler about the likelihood of a branch. Both likely() and * unlikely() return the boolean value of the contained expression. * * These should only be used sparingly, in very hot code paths. It's very easy * to mis-estimate likelihoods. */ #if __GNUC__ >= 3 #define likely(x) __builtin_expect((x) != 0, 1) #define unlikely(x) __builtin_expect((x) != 0, 0) #else #define likely(x) ((x) != 0) #define unlikely(x) ((x) != 0) #endif /* * CppAsString * Convert the argument to a string, using the C preprocessor. * CppConcat * Concatenate two arguments together, using the C preprocessor. * * Note: the standard Autoconf macro AC_C_STRINGIZE actually only checks * whether #identifier works, but if we have that we likely have ## too. */ #if defined(HAVE_STRINGIZE) #define CppAsString(identifier) #identifier #define CppConcat(x, y) x##y #else /* !HAVE_STRINGIZE */ #define CppAsString(identifier) "identifier" /* * CppIdentity -- On Reiser based cpp's this is used to concatenate * two tokens. That is * CppIdentity(A)B ==> AB * We renamed it to _private_CppIdentity because it should not * be referenced outside this file. On other cpp's it * produces A B. */ #define _priv_CppIdentity(x)x #define CppConcat(x, y) _priv_CppIdentity(x)y #endif /* !HAVE_STRINGIZE */ /* * dummyret is used to set return values in macros that use ?: to make * assignments. gcc wants these to be void, other compilers like char */ #ifdef __GNUC__ /* GNU cc */ #define dummyret void #else #define dummyret char #endif #ifndef __GNUC__ #define __attribute__(_arg_) #endif /* ---------------------------------------------------------------- * Section 2: bool, true, false, TRUE, FALSE, NULL * ---------------------------------------------------------------- */ /* * bool * Boolean value, either true or false. * * XXX for C++ compilers, we assume the compiler has a compatible * built-in definition of bool. */ #ifndef __cplusplus #ifndef bool typedef char bool; #endif #ifndef true #define true ((bool) 1) #endif #ifndef false #define false ((bool) 0) #endif #endif /* not C++ */ typedef bool *BoolPtr; #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif /* * NULL * Null pointer. */ #ifndef NULL #define NULL ((void *) 0) #endif /* ---------------------------------------------------------------- * Section 3: standard system types * ---------------------------------------------------------------- */ /* * stdint.h limits aren't guaranteed to be present and aren't guaranteed to * have compatible types with our fixed width types. So just define our own. */ #define PG_INT8_MIN (-0x7F-1) #define PG_INT8_MAX (0x7F) #define PG_UINT8_MAX (0xFF) #define PG_INT16_MIN (-0x7FFF-1) #define PG_INT16_MAX (0x7FFF) #define PG_UINT16_MAX (0xFFFF) #define PG_INT32_MIN (-0x7FFFFFFF-1) #define PG_INT32_MAX (0x7FFFFFFF) #define PG_UINT32_MAX (0xFFFFFFFFU) #define PG_INT64_MIN (-INT64CONST(0x7FFFFFFFFFFFFFFF) - 1) #define PG_INT64_MAX INT64CONST(0x7FFFFFFFFFFFFFFF) #define PG_UINT64_MAX UINT64CONST(0xFFFFFFFFFFFFFFFF) /* * Pointer * Variable holding address of any memory resident object. * * XXX Pointer arithmetic is done with this, so it can't be void * * under "true" ANSI compilers. */ typedef char *Pointer; /* * intN * Signed integer, EXACTLY N BITS IN SIZE, * used for numerical computations and the * frontend/backend protocol. */ #ifndef HAVE_INT8 typedef signed char int8; /* == 8 bits */ typedef signed short int16; /* == 16 bits */ typedef signed int int32; /* == 32 bits */ #endif /* not HAVE_INT8 */ /* * uintN * Unsigned integer, EXACTLY N BITS IN SIZE, * used for numerical computations and the * frontend/backend protocol. */ #ifndef HAVE_UINT8 typedef unsigned char uint8; /* == 8 bits */ typedef unsigned short uint16; /* == 16 bits */ typedef unsigned int uint32; /* == 32 bits */ #endif /* not HAVE_UINT8 */ /* * bitsN * Unit of bitwise operation, AT LEAST N BITS IN SIZE. */ typedef uint8 bits8; /* >= 8 bits */ typedef uint16 bits16; /* >= 16 bits */ typedef uint32 bits32; /* >= 32 bits */ /* * 64-bit integers */ #ifdef HAVE_LONG_INT_64 /* Plain "long int" fits, use it */ #ifndef HAVE_INT64 typedef long int int64; #endif #ifndef HAVE_UINT64 typedef unsigned long int uint64; #endif #define INT64CONST(x) (x##L) #define UINT64CONST(x) (x##UL) #elif defined(HAVE_LONG_LONG_INT_64) /* We have working support for "long long int", use that */ #ifndef HAVE_INT64 typedef long long int int64; #endif #ifndef HAVE_UINT64 typedef unsigned long long int uint64; #endif #define INT64CONST(x) (x##LL) #define UINT64CONST(x) (x##ULL) #else /* neither HAVE_LONG_INT_64 nor HAVE_LONG_LONG_INT_64 */ #error must have a working 64-bit integer datatype #endif /* Max value of size_t might be missing if we don't have stdint.h */ #ifndef SIZE_MAX #if SIZEOF_SIZE_T == 8 #define SIZE_MAX UINT64CONST(0xFFFFFFFFFFFFFFFF) #else #define SIZE_MAX (0xFFFFFFFFU) #endif #endif /* Select timestamp representation (float8 or int64) */ #ifdef USE_INTEGER_DATETIMES #define HAVE_INT64_TIMESTAMP #endif /* sig_atomic_t is required by ANSI C, but may be missing on old platforms */ #ifndef HAVE_SIG_ATOMIC_T typedef int sig_atomic_t; #endif /* * Size * Size of any memory resident object, as returned by sizeof. */ typedef size_t Size; /* * Index * Index into any memory resident array. * * Note: * Indices are non negative. */ typedef unsigned int Index; /* * Offset * Offset into any memory resident array. * * Note: * This differs from an Index in that an Index is always * non negative, whereas Offset may be negative. */ typedef signed int Offset; /* * Common Postgres datatype names (as used in the catalogs) */ typedef int16 int2; typedef int32 int4; typedef float float4; typedef double float8; /* * Oid, RegProcedure, TransactionId, SubTransactionId, MultiXactId, * CommandId */ /* typedef Oid is in postgres_ext.h */ /* * regproc is the type name used in the include/catalog headers, but * RegProcedure is the preferred name in C code. */ typedef Oid regproc; typedef regproc RegProcedure; typedef uint32 TransactionId; typedef uint32 LocalTransactionId; typedef uint32 SubTransactionId; #define InvalidSubTransactionId ((SubTransactionId) 0) #define TopSubTransactionId ((SubTransactionId) 1) /* MultiXactId must be equivalent to TransactionId, to fit in t_xmax */ typedef TransactionId MultiXactId; typedef uint32 MultiXactOffset; typedef uint32 CommandId; #define FirstCommandId ((CommandId) 0) /* * Array indexing support */ #define MAXDIM 6 typedef struct { int indx[MAXDIM]; } IntArray; /* ---------------- * Variable-length datatypes all share the 'struct varlena' header. * * NOTE: for TOASTable types, this is an oversimplification, since the value * may be compressed or moved out-of-line. However datatype-specific routines * are mostly content to deal with de-TOASTed values only, and of course * client-side routines should never see a TOASTed value. But even in a * de-TOASTed value, beware of touching vl_len_ directly, as its representation * is no longer convenient. It's recommended that code always use the VARDATA, * VARSIZE, and SET_VARSIZE macros instead of relying on direct mentions of * the struct fields. See postgres.h for details of the TOASTed form. * ---------------- */ struct varlena { char vl_len_[4]; /* Do not touch this field directly! */ char vl_dat[1]; }; #define VARHDRSZ ((int32) sizeof(int32)) /* * These widely-used datatypes are just a varlena header and the data bytes. * There is no terminating null or anything like that --- the data length is * always VARSIZE(ptr) - VARHDRSZ. */ typedef struct varlena bytea; typedef struct varlena text; typedef struct varlena BpChar; /* blank-padded char, ie SQL char(n) */ typedef struct varlena VarChar; /* var-length char, ie SQL varchar(n) */ /* * Specialized array types. These are physically laid out just the same * as regular arrays (so that the regular array subscripting code works * with them). They exist as distinct types mostly for historical reasons: * they have nonstandard I/O behavior which we don't want to change for fear * of breaking applications that look at the system catalogs. There is also * an implementation issue for oidvector: it's part of the primary key for * pg_proc, and we can't use the normal btree array support routines for that * without circularity. */ typedef struct { int32 vl_len_; /* these fields must match ArrayType! */ int ndim; /* always 1 for int2vector */ int32 dataoffset; /* always 0 for int2vector */ Oid elemtype; int dim1; int lbound1; int2 values[1]; /* VARIABLE LENGTH ARRAY */ } int2vector; /* VARIABLE LENGTH STRUCT */ typedef struct { int32 vl_len_; /* these fields must match ArrayType! */ int ndim; /* always 1 for oidvector */ int32 dataoffset; /* always 0 for oidvector */ Oid elemtype; int dim1; int lbound1; Oid values[1]; /* VARIABLE LENGTH ARRAY */ } oidvector; /* VARIABLE LENGTH STRUCT */ /* * Representation of a Name: effectively just a C string, but null-padded to * exactly NAMEDATALEN bytes. The use of a struct is historical. */ typedef struct nameData { char data[NAMEDATALEN]; } NameData; typedef NameData *Name; #define NameStr(name) ((name).data) /* * Support macros for escaping strings. escape_backslash should be TRUE * if generating a non-standard-conforming string. Prefixing a string * with ESCAPE_STRING_SYNTAX guarantees it is non-standard-conforming. * Beware of multiple evaluation of the "ch" argument! */ #define SQL_STR_DOUBLE(ch, escape_backslash) \ ((ch) == '\'' || ((ch) == '\\' && (escape_backslash))) #define ESCAPE_STRING_SYNTAX 'E' /* ---------------------------------------------------------------- * Section 4: IsValid macros for system types * ---------------------------------------------------------------- */ /* * BoolIsValid * True iff bool is valid. */ #define BoolIsValid(boolean) ((boolean) == false || (boolean) == true) /* * PointerIsValid * True iff pointer is valid. */ #define PointerIsValid(pointer) ((const void*)(pointer) != NULL) /* * PointerIsAligned * True iff pointer is properly aligned to point to the given type. */ #define PointerIsAligned(pointer, type) \ (((intptr_t)(pointer) % (sizeof (type))) == 0) #define OidIsValid(objectId) ((bool) ((objectId) != InvalidOid)) #define RegProcedureIsValid(p) OidIsValid(p) /* ---------------------------------------------------------------- * Section 5: offsetof, lengthof, endof, alignment * ---------------------------------------------------------------- */ /* * offsetof * Offset of a structure/union field within that structure/union. * * XXX This is supposed to be part of stddef.h, but isn't on * some systems (like SunOS 4). */ #ifndef offsetof #define offsetof(type, field) ((long) &((type *)0)->field) #endif /* offsetof */ /* * lengthof * Number of elements in an array. */ #define lengthof(array) (sizeof (array) / sizeof ((array)[0])) /* * endof * Address of the element one past the last in an array. */ #define endof(array) (&(array)[lengthof(array)]) /* ---------------- * Alignment macros: align a length or address appropriately for a given type. * The fooALIGN() macros round up to a multiple of the required alignment, * while the fooALIGN_DOWN() macros round down. The latter are more useful * for problems like "how many X-sized structures will fit in a page?". * * NOTE: TYPEALIGN[_DOWN] will not work if ALIGNVAL is not a power of 2. * That case seems extremely unlikely to be needed in practice, however. * ---------------- */ #define TYPEALIGN(ALIGNVAL,LEN) \ (((intptr_t) (LEN) + ((ALIGNVAL) - 1)) & ~((intptr_t) ((ALIGNVAL) - 1))) #define SHORTALIGN(LEN) TYPEALIGN(ALIGNOF_SHORT, (LEN)) #define INTALIGN(LEN) TYPEALIGN(ALIGNOF_INT, (LEN)) #define LONGALIGN(LEN) TYPEALIGN(ALIGNOF_LONG, (LEN)) #define DOUBLEALIGN(LEN) TYPEALIGN(ALIGNOF_DOUBLE, (LEN)) #define MAXALIGN(LEN) TYPEALIGN(MAXIMUM_ALIGNOF, (LEN)) /* MAXALIGN covers only built-in types, not buffers */ #define BUFFERALIGN(LEN) TYPEALIGN(ALIGNOF_BUFFER, (LEN)) #define TYPEALIGN_DOWN(ALIGNVAL,LEN) \ (((intptr_t) (LEN)) & ~((intptr_t) ((ALIGNVAL) - 1))) #define SHORTALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_SHORT, (LEN)) #define INTALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_INT, (LEN)) #define LONGALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_LONG, (LEN)) #define DOUBLEALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_DOUBLE, (LEN)) #define MAXALIGN_DOWN(LEN) TYPEALIGN_DOWN(MAXIMUM_ALIGNOF, (LEN)) /* ---------------------------------------------------------------- * Section 6: widely useful macros * ---------------------------------------------------------------- */ /* * Max * Return the maximum of two numbers. */ #define Max(x, y) ((x) > (y) ? (x) : (y)) /* * Min * Return the minimum of two numbers. */ #define Min(x, y) ((x) < (y) ? (x) : (y)) /* * Abs * Return the absolute value of the argument. */ #define Abs(x) ((x) >= 0 ? (x) : -(x)) /* * StrNCpy * Like standard library function strncpy(), except that result string * is guaranteed to be null-terminated --- that is, at most N-1 bytes * of the source string will be kept. * Also, the macro returns no result (too hard to do that without * evaluating the arguments multiple times, which seems worse). * * BTW: when you need to copy a non-null-terminated string (like a text * datum) and add a null, do not do it with StrNCpy(..., len+1). That * might seem to work, but it fetches one byte more than there is in the * text object. One fine day you'll have a SIGSEGV because there isn't * another byte before the end of memory. Don't laugh, we've had real * live bug reports from real live users over exactly this mistake. * Do it honestly with "memcpy(dst,src,len); dst[len] = '\0';", instead. */ #define StrNCpy(dst,src,len) \ do \ { \ char * _dst = (dst); \ Size _len = (len); \ \ if (_len > 0) \ { \ strncpy(_dst, (src), _len); \ _dst[_len-1] = '\0'; \ } \ } while (0) /* Get a bit mask of the bits set in non-long aligned addresses */ #define LONG_ALIGN_MASK (sizeof(long) - 1) /* * MemSet * Exactly the same as standard library function memset(), but considerably * faster for zeroing small word-aligned structures (such as parsetree nodes). * This has to be a macro because the main point is to avoid function-call * overhead. However, we have also found that the loop is faster than * native libc memset() on some platforms, even those with assembler * memset() functions. More research needs to be done, perhaps with * MEMSET_LOOP_LIMIT tests in configure. */ #define MemSet(start, val, len) \ do \ { \ /* must be void* because we don't know if it is integer aligned yet */ \ void *_vstart = (void *) (start); \ int _val = (val); \ Size _len = (len); \ \ if ((((intptr_t) _vstart) & LONG_ALIGN_MASK) == 0 && \ (_len & LONG_ALIGN_MASK) == 0 && \ _val == 0 && \ _len <= MEMSET_LOOP_LIMIT && \ /* \ * If MEMSET_LOOP_LIMIT == 0, optimizer should find \ * the whole "if" false at compile time. \ */ \ MEMSET_LOOP_LIMIT != 0) \ { \ long *_start = (long *) _vstart; \ long *_stop = (long *) ((char *) _start + _len); \ while (_start < _stop) \ *_start++ = 0; \ } \ else \ memset(_vstart, _val, _len); \ } while (0) /* * MemSetAligned is the same as MemSet except it omits the test to see if * "start" is word-aligned. This is okay to use if the caller knows a-priori * that the pointer is suitably aligned (typically, because he just got it * from palloc(), which always delivers a max-aligned pointer). */ #define MemSetAligned(start, val, len) \ do \ { \ long *_start = (long *) (start); \ int _val = (val); \ Size _len = (len); \ \ if ((_len & LONG_ALIGN_MASK) == 0 && \ _val == 0 && \ _len <= MEMSET_LOOP_LIMIT && \ MEMSET_LOOP_LIMIT != 0) \ { \ long *_stop = (long *) ((char *) _start + _len); \ while (_start < _stop) \ *_start++ = 0; \ } \ else \ memset(_start, _val, _len); \ } while (0) /* * MemSetTest/MemSetLoop are a variant version that allow all the tests in * MemSet to be done at compile time in cases where "val" and "len" are * constants *and* we know the "start" pointer must be word-aligned. * If MemSetTest succeeds, then it is okay to use MemSetLoop, otherwise use * MemSetAligned. Beware of multiple evaluations of the arguments when using * this approach. */ #define MemSetTest(val, len) \ ( ((len) & LONG_ALIGN_MASK) == 0 && \ (len) <= MEMSET_LOOP_LIMIT && \ MEMSET_LOOP_LIMIT != 0 && \ (val) == 0 ) #define MemSetLoop(start, val, len) \ do \ { \ long * _start = (long *) (start); \ long * _stop = (long *) ((char *) _start + (Size) (len)); \ \ while (_start < _stop) \ *_start++ = 0; \ } while (0) /* ---------------------------------------------------------------- * Section 7: random stuff * ---------------------------------------------------------------- */ /* msb for char */ #define HIGHBIT (0x80) #define IS_HIGHBIT_SET(ch) ((unsigned char)(ch) & HIGHBIT) #define STATUS_OK (0) #define STATUS_ERROR (-1) #define STATUS_EOF (-2) #define STATUS_FOUND (1) #define STATUS_WAITING (2) /* * Append PG_USED_FOR_ASSERTS_ONLY to definitions of variables that are only * used in assert-enabled builds, to avoid compiler warnings about unused * variables in assert-disabled builds. */ #ifdef USE_ASSERT_CHECKING #define PG_USED_FOR_ASSERTS_ONLY #else #define PG_USED_FOR_ASSERTS_ONLY __attribute__((unused)) #endif /* gettext domain name mangling */ /* * To better support parallel installations of major PostgreSQL * versions as well as parallel installations of major library soname * versions, we mangle the gettext domain name by appending those * version numbers. The coding rule ought to be that whereever the * domain name is mentioned as a literal, it must be wrapped into * PG_TEXTDOMAIN(). The macros below do not work on non-literals; but * that is somewhat intentional because it avoids having to worry * about multiple states of premangling and postmangling as the values * are being passed around. * * Make sure this matches the installation rules in nls-global.mk. */ /* need a second indirection because we want to stringize the macro value, not the name */ #define CppAsString2(x) CppAsString(x) #ifdef SO_MAJOR_VERSION #define PG_TEXTDOMAIN(domain) (domain CppAsString2(SO_MAJOR_VERSION) "-" PG_MAJORVERSION) #else #define PG_TEXTDOMAIN(domain) (domain "-" PG_MAJORVERSION) #endif /* ---------------------------------------------------------------- * Section 8: system-specific hacks * * This should be limited to things that absolutely have to be * included in every source file. The port-specific header file * is usually a better place for this sort of thing. * ---------------------------------------------------------------- */ /* * NOTE: this is also used for opening text files. * WIN32 treats Control-Z as EOF in files opened in text mode. * Therefore, we open files in binary mode on Win32 so we can read * literal control-Z. The other affect is that we see CRLF, but * that is OK because we can already handle those cleanly. */ #if defined(WIN32) || defined(__CYGWIN__) #define PG_BINARY O_BINARY #define PG_BINARY_A "ab" #define PG_BINARY_R "rb" #define PG_BINARY_W "wb" #else #define PG_BINARY 0 #define PG_BINARY_A "a" #define PG_BINARY_R "r" #define PG_BINARY_W "w" #endif /* * Provide prototypes for routines not present in a particular machine's * standard C library. */ #if !HAVE_DECL_SNPRINTF extern int snprintf(char *str, size_t count, const char *fmt,...) /* This extension allows gcc to check the format string */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 4))); #endif #if !HAVE_DECL_VSNPRINTF extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args); #endif #if !defined(HAVE_MEMMOVE) && !defined(memmove) #define memmove(d, s, c) bcopy(s, d, c) #endif /* no special DLL markers on most ports */ #ifndef PGDLLIMPORT #define PGDLLIMPORT #endif #ifndef PGDLLEXPORT #define PGDLLEXPORT #endif /* * The following is used as the arg list for signal handlers. Any ports * that take something other than an int argument should override this in * their pg_config_os.h file. Note that variable names are required * because it is used in both the prototypes as well as the definitions. * Note also the long name. We expect that this won't collide with * other names causing compiler warnings. */ #ifndef SIGNAL_ARGS #define SIGNAL_ARGS int postgres_signal_arg #endif /* * When there is no sigsetjmp, its functionality is provided by plain * setjmp. Incidentally, nothing provides setjmp's functionality in * that case. */ #ifndef HAVE_SIGSETJMP #define sigjmp_buf jmp_buf #define sigsetjmp(x,y) setjmp(x) #define siglongjmp longjmp #endif #if defined(HAVE_FDATASYNC) && !HAVE_DECL_FDATASYNC extern int fdatasync(int fildes); #endif /* If strtoq() exists, rename it to the more standard strtoll() */ #if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOLL) && defined(HAVE_STRTOQ) #define strtoll strtoq #define HAVE_STRTOLL 1 #endif /* If strtouq() exists, rename it to the more standard strtoull() */ #if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOULL) && defined(HAVE_STRTOUQ) #define strtoull strtouq #define HAVE_STRTOULL 1 #endif /* * We assume if we have these two functions, we have their friends too, and * can use the wide-character functions. */ #if defined(HAVE_WCSTOMBS) && defined(HAVE_TOWLOWER) #define USE_WIDE_UPPER_LOWER #endif /* EXEC_BACKEND defines */ #ifdef EXEC_BACKEND #define NON_EXEC_STATIC #else #define NON_EXEC_STATIC static #endif /* /port compatibility functions */ #include "port.h" #endif /* C_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/nodes/params.h�������������������������������������������������������������������������0000644�����������������00000007304�14763166026�0011763 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * params.h * Support for finding the values associated with Param nodes. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/nodes/params.h * *------------------------------------------------------------------------- */ #ifndef PARAMS_H #define PARAMS_H /* To avoid including a pile of parser headers, reference ParseState thus: */ struct ParseState; /* ---------------- * ParamListInfo * * ParamListInfo arrays are used to pass parameters into the executor * for parameterized plans. Each entry in the array defines the value * to be substituted for a PARAM_EXTERN parameter. The "paramid" * of a PARAM_EXTERN Param can range from 1 to numParams. * * Although parameter numbers are normally consecutive, we allow * ptype == InvalidOid to signal an unused array entry. * * pflags is a flags field. Currently the only used bit is: * PARAM_FLAG_CONST signals the planner that it may treat this parameter * as a constant (i.e., generate a plan that works only for this value * of the parameter). * * There are two hook functions that can be associated with a ParamListInfo * array to support dynamic parameter handling. First, if paramFetch * isn't null and the executor requires a value for an invalid parameter * (one with ptype == InvalidOid), the paramFetch hook is called to give * it a chance to fill in the parameter value. Second, a parserSetup * hook can be supplied to re-instantiate the original parsing hooks if * a query needs to be re-parsed/planned (as a substitute for supposing * that the current ptype values represent a fixed set of parameter types). * Although the data structure is really an array, not a list, we keep * the old typedef name to avoid unnecessary code changes. * ---------------- */ #define PARAM_FLAG_CONST 0x0001 /* parameter is constant */ typedef struct ParamExternData { Datum value; /* parameter value */ bool isnull; /* is it NULL? */ uint16 pflags; /* flag bits, see above */ Oid ptype; /* parameter's datatype, or 0 */ } ParamExternData; typedef struct ParamListInfoData *ParamListInfo; typedef void (*ParamFetchHook) (ParamListInfo params, int paramid); typedef void (*ParserSetupHook) (struct ParseState *pstate, void *arg); typedef struct ParamListInfoData { ParamFetchHook paramFetch; /* parameter fetch hook */ void *paramFetchArg; ParserSetupHook parserSetup; /* parser setup hook */ void *parserSetupArg; int numParams; /* number of ParamExternDatas following */ ParamExternData params[1]; /* VARIABLE LENGTH ARRAY */ } ParamListInfoData; /* ---------------- * ParamExecData * * ParamExecData entries are used for executor internal parameters * (that is, values being passed into or out of a sub-query). The * paramid of a PARAM_EXEC Param is a (zero-based) index into an * array of ParamExecData records, which is referenced through * es_param_exec_vals or ecxt_param_exec_vals. * * If execPlan is not NULL, it points to a SubPlanState node that needs * to be executed to produce the value. (This is done so that we can have * lazy evaluation of InitPlans: they aren't executed until/unless a * result value is needed.) Otherwise the value is assumed to be valid * when needed. * ---------------- */ typedef struct ParamExecData { void *execPlan; /* should be "SubPlanState *" */ Datum value; bool isnull; } ParamExecData; /* Functions found in src/backend/nodes/params.c */ extern ParamListInfo copyParamList(ParamListInfo from); #endif /* PARAMS_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/nodes/value.h��������������������������������������������������������������������������0000644�����������������00000003407�14763166026�0011614 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * value.h * interface for Value nodes * * * Copyright (c) 2003-2012, PostgreSQL Global Development Group * * src/include/nodes/value.h * *------------------------------------------------------------------------- */ #ifndef VALUE_H #define VALUE_H #include "nodes/nodes.h" /*---------------------- * Value node * * The same Value struct is used for five node types: T_Integer, * T_Float, T_String, T_BitString, T_Null. * * Integral values are actually represented by a machine integer, * but both floats and strings are represented as strings. * Using T_Float as the node type simply indicates that * the contents of the string look like a valid numeric literal. * * (Before Postgres 7.0, we used a double to represent T_Float, * but that creates loss-of-precision problems when the value is * ultimately destined to be converted to NUMERIC. Since Value nodes * are only used in the parsing process, not for runtime data, it's * better to use the more general representation.) * * Note that an integer-looking string will get lexed as T_Float if * the value is too large to fit in a 'long'. * * Nulls, of course, don't need the value part at all. *---------------------- */ typedef struct Value { NodeTag type; /* tag appropriately (eg. T_String) */ union ValUnion { long ival; /* machine integer */ char *str; /* string */ } val; } Value; #define intVal(v) (((Value *)(v))->val.ival) #define floatVal(v) atof(((Value *)(v))->val.str) #define strVal(v) (((Value *)(v))->val.str) extern Value *makeInteger(long i); extern Value *makeFloat(char *numericStr); extern Value *makeString(char *str); extern Value *makeBitString(char *str); #endif /* VALUE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/nodes/pg_list.h������������������������������������������������������������������������0000644�����������������00000026772�14763166026�0012153 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_list.h * interface for PostgreSQL generic linked list package * * This package implements singly-linked homogeneous lists. * * It is important to have constant-time length, append, and prepend * operations. To achieve this, we deal with two distinct data * structures: * * 1. A set of "list cells": each cell contains a data field and * a link to the next cell in the list or NULL. * 2. A single structure containing metadata about the list: the * type of the list, pointers to the head and tail cells, and * the length of the list. * * We support three types of lists: * * T_List: lists of pointers * (in practice usually pointers to Nodes, but not always; * declared as "void *" to minimize casting annoyances) * T_IntList: lists of integers * T_OidList: lists of Oids * * (At the moment, ints and Oids are the same size, but they may not * always be so; try to be careful to maintain the distinction.) * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/nodes/pg_list.h * *------------------------------------------------------------------------- */ #ifndef PG_LIST_H #define PG_LIST_H #include "nodes/nodes.h" typedef struct ListCell ListCell; typedef struct List { NodeTag type; /* T_List, T_IntList, or T_OidList */ int length; ListCell *head; ListCell *tail; } List; struct ListCell { union { void *ptr_value; int int_value; Oid oid_value; } data; ListCell *next; }; /* * The *only* valid representation of an empty list is NIL; in other * words, a non-NIL list is guaranteed to have length >= 1 and * head/tail != NULL */ #define NIL ((List *) NULL) /* * These routines are used frequently. However, we can't implement * them as macros, since we want to avoid double-evaluation of macro * arguments. Therefore, we implement them using static inline functions * if supported by the compiler, or as regular functions otherwise. */ #ifdef USE_INLINE static inline ListCell * list_head(const List *l) { return l ? l->head : NULL; } static inline ListCell * list_tail(List *l) { return l ? l->tail : NULL; } static inline int list_length(const List *l) { return l ? l->length : 0; } #else extern ListCell *list_head(const List *l); extern ListCell *list_tail(List *l); extern int list_length(const List *l); #endif /* USE_INLINE */ /* * NB: There is an unfortunate legacy from a previous incarnation of * the List API: the macro lfirst() was used to mean "the data in this * cons cell". To avoid changing every usage of lfirst(), that meaning * has been kept. As a result, lfirst() takes a ListCell and returns * the data it contains; to get the data in the first cell of a * List, use linitial(). Worse, lsecond() is more closely related to * linitial() than lfirst(): given a List, lsecond() returns the data * in the second cons cell. */ #define lnext(lc) ((lc)->next) #define lfirst(lc) ((lc)->data.ptr_value) #define lfirst_int(lc) ((lc)->data.int_value) #define lfirst_oid(lc) ((lc)->data.oid_value) #define lfirst_node(type,lc) castNode(type, lfirst(lc)) #define linitial(l) lfirst(list_head(l)) #define linitial_int(l) lfirst_int(list_head(l)) #define linitial_oid(l) lfirst_oid(list_head(l)) #define linitial_node(type,l) castNode(type, linitial(l)) #define lsecond(l) lfirst(lnext(list_head(l))) #define lsecond_int(l) lfirst_int(lnext(list_head(l))) #define lsecond_oid(l) lfirst_oid(lnext(list_head(l))) #define lsecond_node(type,l) castNode(type, lsecond(l)) #define lthird(l) lfirst(lnext(lnext(list_head(l)))) #define lthird_int(l) lfirst_int(lnext(lnext(list_head(l)))) #define lthird_oid(l) lfirst_oid(lnext(lnext(list_head(l)))) #define lthird_node(type,l) castNode(type, lthird(l)) #define lfourth(l) lfirst(lnext(lnext(lnext(list_head(l))))) #define lfourth_int(l) lfirst_int(lnext(lnext(lnext(list_head(l))))) #define lfourth_oid(l) lfirst_oid(lnext(lnext(lnext(list_head(l))))) #define lfourth_node(type,l) castNode(type, lfourth(l)) #define llast(l) lfirst(list_tail(l)) #define llast_int(l) lfirst_int(list_tail(l)) #define llast_oid(l) lfirst_oid(list_tail(l)) #define llast_node(type,l) castNode(type, llast(l)) /* * Convenience macros for building fixed-length lists */ #define list_make1(x1) lcons(x1, NIL) #define list_make2(x1,x2) lcons(x1, list_make1(x2)) #define list_make3(x1,x2,x3) lcons(x1, list_make2(x2, x3)) #define list_make4(x1,x2,x3,x4) lcons(x1, list_make3(x2, x3, x4)) #define list_make1_int(x1) lcons_int(x1, NIL) #define list_make2_int(x1,x2) lcons_int(x1, list_make1_int(x2)) #define list_make3_int(x1,x2,x3) lcons_int(x1, list_make2_int(x2, x3)) #define list_make4_int(x1,x2,x3,x4) lcons_int(x1, list_make3_int(x2, x3, x4)) #define list_make1_oid(x1) lcons_oid(x1, NIL) #define list_make2_oid(x1,x2) lcons_oid(x1, list_make1_oid(x2)) #define list_make3_oid(x1,x2,x3) lcons_oid(x1, list_make2_oid(x2, x3)) #define list_make4_oid(x1,x2,x3,x4) lcons_oid(x1, list_make3_oid(x2, x3, x4)) /* * foreach - * a convenience macro which loops through the list */ #define foreach(cell, l) \ for ((cell) = list_head(l); (cell) != NULL; (cell) = lnext(cell)) /* * for_each_cell - * a convenience macro which loops through a list starting from a * specified cell */ #define for_each_cell(cell, initcell) \ for ((cell) = (initcell); (cell) != NULL; (cell) = lnext(cell)) /* * forboth - * a convenience macro for advancing through two linked lists * simultaneously. This macro loops through both lists at the same * time, stopping when either list runs out of elements. Depending * on the requirements of the call site, it may also be wise to * assert that the lengths of the two lists are equal. */ #define forboth(cell1, list1, cell2, list2) \ for ((cell1) = list_head(list1), (cell2) = list_head(list2); \ (cell1) != NULL && (cell2) != NULL; \ (cell1) = lnext(cell1), (cell2) = lnext(cell2)) /* * forthree - * the same for three lists */ #define forthree(cell1, list1, cell2, list2, cell3, list3) \ for ((cell1) = list_head(list1), (cell2) = list_head(list2), (cell3) = list_head(list3); \ (cell1) != NULL && (cell2) != NULL && (cell3) != NULL; \ (cell1) = lnext(cell1), (cell2) = lnext(cell2), (cell3) = lnext(cell3)) extern List *lappend(List *list, void *datum); extern List *lappend_int(List *list, int datum); extern List *lappend_oid(List *list, Oid datum); extern ListCell *lappend_cell(List *list, ListCell *prev, void *datum); extern ListCell *lappend_cell_int(List *list, ListCell *prev, int datum); extern ListCell *lappend_cell_oid(List *list, ListCell *prev, Oid datum); extern List *lcons(void *datum, List *list); extern List *lcons_int(int datum, List *list); extern List *lcons_oid(Oid datum, List *list); extern List *list_concat(List *list1, List *list2); extern List *list_truncate(List *list, int new_size); extern void *list_nth(const List *list, int n); extern int list_nth_int(const List *list, int n); extern Oid list_nth_oid(const List *list, int n); #define list_nth_node(type,list,n) castNode(type, list_nth(list, n)) extern bool list_member(const List *list, const void *datum); extern bool list_member_ptr(const List *list, const void *datum); extern bool list_member_int(const List *list, int datum); extern bool list_member_oid(const List *list, Oid datum); extern List *list_delete(List *list, void *datum); extern List *list_delete_ptr(List *list, void *datum); extern List *list_delete_int(List *list, int datum); extern List *list_delete_oid(List *list, Oid datum); extern List *list_delete_first(List *list); extern List *list_delete_cell(List *list, ListCell *cell, ListCell *prev); extern List *list_union(const List *list1, const List *list2); extern List *list_union_ptr(const List *list1, const List *list2); extern List *list_union_int(const List *list1, const List *list2); extern List *list_union_oid(const List *list1, const List *list2); extern List *list_intersection(const List *list1, const List *list2); /* currently, there's no need for list_intersection_int etc */ extern List *list_difference(const List *list1, const List *list2); extern List *list_difference_ptr(const List *list1, const List *list2); extern List *list_difference_int(const List *list1, const List *list2); extern List *list_difference_oid(const List *list1, const List *list2); extern List *list_append_unique(List *list, void *datum); extern List *list_append_unique_ptr(List *list, void *datum); extern List *list_append_unique_int(List *list, int datum); extern List *list_append_unique_oid(List *list, Oid datum); extern List *list_concat_unique(List *list1, List *list2); extern List *list_concat_unique_ptr(List *list1, List *list2); extern List *list_concat_unique_int(List *list1, List *list2); extern List *list_concat_unique_oid(List *list1, List *list2); extern void list_free(List *list); extern void list_free_deep(List *list); extern List *list_copy(const List *list); extern List *list_copy_tail(const List *list, int nskip); /* * To ease migration to the new list API, a set of compatibility * macros are provided that reduce the impact of the list API changes * as far as possible. Until client code has been rewritten to use the * new list API, the ENABLE_LIST_COMPAT symbol can be defined before * including pg_list.h */ #ifdef ENABLE_LIST_COMPAT #define lfirsti(lc) lfirst_int(lc) #define lfirsto(lc) lfirst_oid(lc) #define makeList1(x1) list_make1(x1) #define makeList2(x1, x2) list_make2(x1, x2) #define makeList3(x1, x2, x3) list_make3(x1, x2, x3) #define makeList4(x1, x2, x3, x4) list_make4(x1, x2, x3, x4) #define makeListi1(x1) list_make1_int(x1) #define makeListi2(x1, x2) list_make2_int(x1, x2) #define makeListo1(x1) list_make1_oid(x1) #define makeListo2(x1, x2) list_make2_oid(x1, x2) #define lconsi(datum, list) lcons_int(datum, list) #define lconso(datum, list) lcons_oid(datum, list) #define lappendi(list, datum) lappend_int(list, datum) #define lappendo(list, datum) lappend_oid(list, datum) #define nconc(l1, l2) list_concat(l1, l2) #define nth(n, list) list_nth(list, n) #define member(datum, list) list_member(list, datum) #define ptrMember(datum, list) list_member_ptr(list, datum) #define intMember(datum, list) list_member_int(list, datum) #define oidMember(datum, list) list_member_oid(list, datum) /* * Note that the old lremove() determined equality via pointer * comparison, whereas the new list_delete() uses equal(); in order to * keep the same behavior, we therefore need to map lremove() calls to * list_delete_ptr() rather than list_delete() */ #define lremove(elem, list) list_delete_ptr(list, elem) #define LispRemove(elem, list) list_delete(list, elem) #define lremovei(elem, list) list_delete_int(list, elem) #define lremoveo(elem, list) list_delete_oid(list, elem) #define ltruncate(n, list) list_truncate(list, n) #define set_union(l1, l2) list_union(l1, l2) #define set_uniono(l1, l2) list_union_oid(l1, l2) #define set_ptrUnion(l1, l2) list_union_ptr(l1, l2) #define set_difference(l1, l2) list_difference(l1, l2) #define set_differenceo(l1, l2) list_difference_oid(l1, l2) #define set_ptrDifference(l1, l2) list_difference_ptr(l1, l2) #define equali(l1, l2) equal(l1, l2) #define equalo(l1, l2) equal(l1, l2) #define freeList(list) list_free(list) #define listCopy(list) list_copy(list) extern int length(List *list); #endif /* ENABLE_LIST_COMPAT */ #endif /* PG_LIST_H */ ������pgsql/server/nodes/bitmapset.h����������������������������������������������������������������������0000644�����������������00000006560�14763166026�0012473 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * bitmapset.h * PostgreSQL generic bitmap set package * * A bitmap set can represent any set of nonnegative integers, although * it is mainly intended for sets where the maximum value is not large, * say at most a few hundred. By convention, a NULL pointer is always * accepted by all operations to represent the empty set. (But beware * that this is not the only representation of the empty set. Use * bms_is_empty() in preference to testing for NULL.) * * * Copyright (c) 2003-2012, PostgreSQL Global Development Group * * src/include/nodes/bitmapset.h * *------------------------------------------------------------------------- */ #ifndef BITMAPSET_H #define BITMAPSET_H /* * Data representation */ /* The unit size can be adjusted by changing these three declarations: */ #define BITS_PER_BITMAPWORD 32 typedef uint32 bitmapword; /* must be an unsigned type */ typedef int32 signedbitmapword; /* must be the matching signed type */ typedef struct Bitmapset { int nwords; /* number of words in array */ bitmapword words[1]; /* really [nwords] */ } Bitmapset; /* VARIABLE LENGTH STRUCT */ /* result of bms_subset_compare */ typedef enum { BMS_EQUAL, /* sets are equal */ BMS_SUBSET1, /* first set is a subset of the second */ BMS_SUBSET2, /* second set is a subset of the first */ BMS_DIFFERENT /* neither set is a subset of the other */ } BMS_Comparison; /* result of bms_membership */ typedef enum { BMS_EMPTY_SET, /* 0 members */ BMS_SINGLETON, /* 1 member */ BMS_MULTIPLE /* >1 member */ } BMS_Membership; /* * function prototypes in nodes/bitmapset.c */ extern Bitmapset *bms_copy(const Bitmapset *a); extern bool bms_equal(const Bitmapset *a, const Bitmapset *b); extern Bitmapset *bms_make_singleton(int x); extern void bms_free(Bitmapset *a); extern Bitmapset *bms_union(const Bitmapset *a, const Bitmapset *b); extern Bitmapset *bms_intersect(const Bitmapset *a, const Bitmapset *b); extern Bitmapset *bms_difference(const Bitmapset *a, const Bitmapset *b); extern bool bms_is_subset(const Bitmapset *a, const Bitmapset *b); extern BMS_Comparison bms_subset_compare(const Bitmapset *a, const Bitmapset *b); extern bool bms_is_member(int x, const Bitmapset *a); extern bool bms_overlap(const Bitmapset *a, const Bitmapset *b); extern bool bms_nonempty_difference(const Bitmapset *a, const Bitmapset *b); extern int bms_singleton_member(const Bitmapset *a); extern int bms_num_members(const Bitmapset *a); /* optimized tests when we don't need to know exact membership count: */ extern BMS_Membership bms_membership(const Bitmapset *a); extern bool bms_is_empty(const Bitmapset *a); /* these routines recycle (modify or free) their non-const inputs: */ extern Bitmapset *bms_add_member(Bitmapset *a, int x); extern Bitmapset *bms_del_member(Bitmapset *a, int x); extern Bitmapset *bms_add_members(Bitmapset *a, const Bitmapset *b); extern Bitmapset *bms_int_members(Bitmapset *a, const Bitmapset *b); extern Bitmapset *bms_del_members(Bitmapset *a, const Bitmapset *b); extern Bitmapset *bms_join(Bitmapset *a, Bitmapset *b); /* support for iterating through the integer elements of a set: */ extern int bms_first_member(Bitmapset *a); /* support for hashtables using Bitmapsets as keys: */ extern uint32 bms_hash_value(const Bitmapset *a); #endif /* BITMAPSET_H */ ������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/nodes/makefuncs.h����������������������������������������������������������������������0000644�����������������00000004514�14763166026�0012454 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * makefuncs.h * prototypes for the creator functions (for primitive nodes) * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/nodes/makefuncs.h * *------------------------------------------------------------------------- */ #ifndef MAKEFUNC_H #define MAKEFUNC_H #include "nodes/parsenodes.h" extern A_Expr *makeA_Expr(A_Expr_Kind kind, List *name, Node *lexpr, Node *rexpr, int location); extern A_Expr *makeSimpleA_Expr(A_Expr_Kind kind, char *name, Node *lexpr, Node *rexpr, int location); extern Var *makeVar(Index varno, AttrNumber varattno, Oid vartype, int32 vartypmod, Oid varcollid, Index varlevelsup); extern Var *makeVarFromTargetEntry(Index varno, TargetEntry *tle); extern Var *makeWholeRowVar(RangeTblEntry *rte, Index varno, Index varlevelsup, bool allowScalar); extern TargetEntry *makeTargetEntry(Expr *expr, AttrNumber resno, char *resname, bool resjunk); extern TargetEntry *flatCopyTargetEntry(TargetEntry *src_tle); extern FromExpr *makeFromExpr(List *fromlist, Node *quals); extern Const *makeConst(Oid consttype, int32 consttypmod, Oid constcollid, int constlen, Datum constvalue, bool constisnull, bool constbyval); extern Const *makeNullConst(Oid consttype, int32 consttypmod, Oid constcollid); extern Node *makeBoolConst(bool value, bool isnull); extern Expr *makeBoolExpr(BoolExprType boolop, List *args, int location); extern Alias *makeAlias(const char *aliasname, List *colnames); extern RelabelType *makeRelabelType(Expr *arg, Oid rtype, int32 rtypmod, Oid rcollid, CoercionForm rformat); extern RangeVar *makeRangeVar(char *schemaname, char *relname, int location); extern TypeName *makeTypeName(char *typnam); extern TypeName *makeTypeNameFromNameList(List *names); extern TypeName *makeTypeNameFromOid(Oid typeOid, int32 typmod); extern FuncExpr *makeFuncExpr(Oid funcid, Oid rettype, List *args, Oid funccollid, Oid inputcollid, CoercionForm fformat); extern DefElem *makeDefElem(char *name, Node *arg); extern DefElem *makeDefElemExtended(char *nameSpace, char *name, Node *arg, DefElemAction defaction); #endif /* MAKEFUNC_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/nodes/nodeFuncs.h����������������������������������������������������������������������0000644�����������������00000004716�14763166026�0012430 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeFuncs.h * Various general-purpose manipulations of Node trees * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/nodes/nodeFuncs.h * *------------------------------------------------------------------------- */ #ifndef NODEFUNCS_H #define NODEFUNCS_H #include "nodes/parsenodes.h" /* flags bits for query_tree_walker and query_tree_mutator */ #define QTW_IGNORE_RT_SUBQUERIES 0x01 /* subqueries in rtable */ #define QTW_IGNORE_CTE_SUBQUERIES 0x02 /* subqueries in cteList */ #define QTW_IGNORE_RC_SUBQUERIES 0x03 /* both of above */ #define QTW_IGNORE_JOINALIASES 0x04 /* JOIN alias var lists */ #define QTW_IGNORE_RANGE_TABLE 0x08 /* skip rangetable entirely */ #define QTW_EXAMINE_RTES 0x10 /* examine RTEs */ #define QTW_DONT_COPY_QUERY 0x20 /* do not copy top Query */ extern Oid exprType(const Node *expr); extern int32 exprTypmod(const Node *expr); extern bool exprIsLengthCoercion(const Node *expr, int32 *coercedTypmod); extern Node *relabel_to_typmod(Node *expr, int32 typmod); extern bool expression_returns_set(Node *clause); extern Oid exprCollation(const Node *expr); extern Oid exprInputCollation(const Node *expr); extern void exprSetCollation(Node *expr, Oid collation); extern void exprSetInputCollation(Node *expr, Oid inputcollation); extern int exprLocation(const Node *expr); extern bool expression_tree_walker(Node *node, bool (*walker) (), void *context); extern Node *expression_tree_mutator(Node *node, Node *(*mutator) (), void *context); extern bool query_tree_walker(Query *query, bool (*walker) (), void *context, int flags); extern Query *query_tree_mutator(Query *query, Node *(*mutator) (), void *context, int flags); extern bool range_table_walker(List *rtable, bool (*walker) (), void *context, int flags); extern List *range_table_mutator(List *rtable, Node *(*mutator) (), void *context, int flags); extern bool query_or_expression_tree_walker(Node *node, bool (*walker) (), void *context, int flags); extern Node *query_or_expression_tree_mutator(Node *node, Node *(*mutator) (), void *context, int flags); extern bool raw_expression_tree_walker(Node *node, bool (*walker) (), void *context); #endif /* NODEFUNCS_H */ ��������������������������������������������������pgsql/server/nodes/tidbitmap.h����������������������������������������������������������������������0000644�����������������00000004277�14763166026�0012463 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * tidbitmap.h * PostgreSQL tuple-id (TID) bitmap package * * This module provides bitmap data structures that are spiritually * similar to Bitmapsets, but are specially adapted to store sets of * tuple identifiers (TIDs), or ItemPointers. In particular, the division * of an ItemPointer into BlockNumber and OffsetNumber is catered for. * Also, since we wish to be able to store very large tuple sets in * memory with this data structure, we support "lossy" storage, in which * we no longer remember individual tuple offsets on a page but only the * fact that a particular page needs to be visited. * * * Copyright (c) 2003-2012, PostgreSQL Global Development Group * * src/include/nodes/tidbitmap.h * *------------------------------------------------------------------------- */ #ifndef TIDBITMAP_H #define TIDBITMAP_H #include "storage/itemptr.h" /* * Actual bitmap representation is private to tidbitmap.c. Callers can * do IsA(x, TIDBitmap) on it, but nothing else. */ typedef struct TIDBitmap TIDBitmap; /* Likewise, TBMIterator is private */ typedef struct TBMIterator TBMIterator; /* Result structure for tbm_iterate */ typedef struct { BlockNumber blockno; /* page number containing tuples */ int ntuples; /* -1 indicates lossy result */ bool recheck; /* should the tuples be rechecked? */ /* Note: recheck is always true if ntuples < 0 */ OffsetNumber offsets[1]; /* VARIABLE LENGTH ARRAY */ } TBMIterateResult; /* VARIABLE LENGTH STRUCT */ /* function prototypes in nodes/tidbitmap.c */ extern TIDBitmap *tbm_create(long maxbytes); extern void tbm_free(TIDBitmap *tbm); extern void tbm_add_tuples(TIDBitmap *tbm, const ItemPointer tids, int ntids, bool recheck); extern void tbm_add_page(TIDBitmap *tbm, BlockNumber pageno); extern void tbm_union(TIDBitmap *a, const TIDBitmap *b); extern void tbm_intersect(TIDBitmap *a, const TIDBitmap *b); extern bool tbm_is_empty(const TIDBitmap *tbm); extern TBMIterator *tbm_begin_iterate(TIDBitmap *tbm); extern TBMIterateResult *tbm_iterate(TBMIterator *iterator); extern void tbm_end_iterate(TBMIterator *iterator); #endif /* TIDBITMAP_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/nodes/plannodes.h����������������������������������������������������������������������0000644�����������������00000067161�14763166026�0012472 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * plannodes.h * definitions for query plan nodes * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/nodes/plannodes.h * *------------------------------------------------------------------------- */ #ifndef PLANNODES_H #define PLANNODES_H #include "access/sdir.h" #include "nodes/bitmapset.h" #include "nodes/primnodes.h" /* ---------------------------------------------------------------- * node definitions * ---------------------------------------------------------------- */ /* ---------------- * PlannedStmt node * * The output of the planner is a Plan tree headed by a PlannedStmt node. * PlannedStmt holds the "one time" information needed by the executor. * ---------------- */ typedef struct PlannedStmt { NodeTag type; CmdType commandType; /* select|insert|update|delete */ uint32 queryId; /* query identifier (copied from Query) */ bool hasReturning; /* is it insert|update|delete RETURNING? */ bool hasModifyingCTE; /* has insert|update|delete in WITH? */ bool canSetTag; /* do I set the command result tag? */ bool transientPlan; /* redo plan when TransactionXmin changes? */ struct Plan *planTree; /* tree of Plan nodes */ List *rtable; /* list of RangeTblEntry nodes */ /* rtable indexes of target relations for INSERT/UPDATE/DELETE */ List *resultRelations; /* integer list of RT indexes, or NIL */ Node *utilityStmt; /* non-null if this is DECLARE CURSOR */ List *subplans; /* Plan trees for SubPlan expressions */ Bitmapset *rewindPlanIDs; /* indices of subplans that require REWIND */ List *rowMarks; /* a list of PlanRowMark's */ List *relationOids; /* OIDs of relations the plan depends on */ List *invalItems; /* other dependencies, as PlanInvalItems */ int nParamExec; /* number of PARAM_EXEC Params used */ } PlannedStmt; /* macro for fetching the Plan associated with a SubPlan node */ #define exec_subplan_get_plan(plannedstmt, subplan) \ ((Plan *) list_nth((plannedstmt)->subplans, (subplan)->plan_id - 1)) /* ---------------- * Plan node * * All plan nodes "derive" from the Plan structure by having the * Plan structure as the first field. This ensures that everything works * when nodes are cast to Plan's. (node pointers are frequently cast to Plan* * when passed around generically in the executor) * * We never actually instantiate any Plan nodes; this is just the common * abstract superclass for all Plan-type nodes. * ---------------- */ typedef struct Plan { NodeTag type; /* * estimated execution costs for plan (see costsize.c for more info) */ Cost startup_cost; /* cost expended before fetching any tuples */ Cost total_cost; /* total cost (assuming all tuples fetched) */ /* * planner's estimate of result size of this plan step */ double plan_rows; /* number of rows plan is expected to emit */ int plan_width; /* average row width in bytes */ /* * Common structural data for all Plan types. */ List *targetlist; /* target list to be computed at this node */ List *qual; /* implicitly-ANDed qual conditions */ struct Plan *lefttree; /* input plan tree(s) */ struct Plan *righttree; List *initPlan; /* Init Plan nodes (un-correlated expr * subselects) */ /* * Information for management of parameter-change-driven rescanning * * extParam includes the paramIDs of all external PARAM_EXEC params * affecting this plan node or its children. setParam params from the * node's initPlans are not included, but their extParams are. * * allParam includes all the extParam paramIDs, plus the IDs of local * params that affect the node (i.e., the setParams of its initplans). * These are _all_ the PARAM_EXEC params that affect this node. */ Bitmapset *extParam; Bitmapset *allParam; } Plan; /* ---------------- * these are defined to avoid confusion problems with "left" * and "right" and "inner" and "outer". The convention is that * the "left" plan is the "outer" plan and the "right" plan is * the inner plan, but these make the code more readable. * ---------------- */ #define innerPlan(node) (((Plan *)(node))->righttree) #define outerPlan(node) (((Plan *)(node))->lefttree) /* ---------------- * Result node - * If no outer plan, evaluate a variable-free targetlist. * If outer plan, return tuples from outer plan (after a level of * projection as shown by targetlist). * * If resconstantqual isn't NULL, it represents a one-time qualification * test (i.e., one that doesn't depend on any variables from the outer plan, * so needs to be evaluated only once). * ---------------- */ typedef struct Result { Plan plan; Node *resconstantqual; } Result; /* ---------------- * ModifyTable node - * Apply rows produced by subplan(s) to result table(s), * by inserting, updating, or deleting. * * Note that rowMarks and epqParam are presumed to be valid for all the * subplan(s); they can't contain any info that varies across subplans. * ---------------- */ typedef struct ModifyTable { Plan plan; CmdType operation; /* INSERT, UPDATE, or DELETE */ bool canSetTag; /* do we set the command tag/es_processed? */ List *resultRelations; /* integer list of RT indexes */ int resultRelIndex; /* index of first resultRel in plan's list */ List *plans; /* plan(s) producing source data */ List *returningLists; /* per-target-table RETURNING tlists */ List *rowMarks; /* PlanRowMarks (non-locking only) */ int epqParam; /* ID of Param for EvalPlanQual re-eval */ } ModifyTable; /* ---------------- * Append node - * Generate the concatenation of the results of sub-plans. * ---------------- */ typedef struct Append { Plan plan; List *appendplans; } Append; /* ---------------- * MergeAppend node - * Merge the results of pre-sorted sub-plans to preserve the ordering. * ---------------- */ typedef struct MergeAppend { Plan plan; List *mergeplans; /* remaining fields are just like the sort-key info in struct Sort */ int numCols; /* number of sort-key columns */ AttrNumber *sortColIdx; /* their indexes in the target list */ Oid *sortOperators; /* OIDs of operators to sort them by */ Oid *collations; /* OIDs of collations */ bool *nullsFirst; /* NULLS FIRST/LAST directions */ } MergeAppend; /* ---------------- * RecursiveUnion node - * Generate a recursive union of two subplans. * * The "outer" subplan is always the non-recursive term, and the "inner" * subplan is the recursive term. * ---------------- */ typedef struct RecursiveUnion { Plan plan; int wtParam; /* ID of Param representing work table */ /* Remaining fields are zero/null in UNION ALL case */ int numCols; /* number of columns to check for * duplicate-ness */ AttrNumber *dupColIdx; /* their indexes in the target list */ Oid *dupOperators; /* equality operators to compare with */ long numGroups; /* estimated number of groups in input */ } RecursiveUnion; /* ---------------- * BitmapAnd node - * Generate the intersection of the results of sub-plans. * * The subplans must be of types that yield tuple bitmaps. The targetlist * and qual fields of the plan are unused and are always NIL. * ---------------- */ typedef struct BitmapAnd { Plan plan; List *bitmapplans; } BitmapAnd; /* ---------------- * BitmapOr node - * Generate the union of the results of sub-plans. * * The subplans must be of types that yield tuple bitmaps. The targetlist * and qual fields of the plan are unused and are always NIL. * ---------------- */ typedef struct BitmapOr { Plan plan; List *bitmapplans; } BitmapOr; /* * ========== * Scan nodes * ========== */ typedef struct Scan { Plan plan; Index scanrelid; /* relid is index into the range table */ } Scan; /* ---------------- * sequential scan node * ---------------- */ typedef Scan SeqScan; /* ---------------- * index scan node * * indexqualorig is an implicitly-ANDed list of index qual expressions, each * in the same form it appeared in the query WHERE condition. Each should * be of the form (indexkey OP comparisonval) or (comparisonval OP indexkey). * The indexkey is a Var or expression referencing column(s) of the index's * base table. The comparisonval might be any expression, but it won't use * any columns of the base table. The expressions are ordered by index * column position (but items referencing the same index column can appear * in any order). indexqualorig is used at runtime only if we have to recheck * a lossy indexqual. * * indexqual has the same form, but the expressions have been commuted if * necessary to put the indexkeys on the left, and the indexkeys are replaced * by Var nodes identifying the index columns (their varno is INDEX_VAR and * their varattno is the index column number). * * indexorderbyorig is similarly the original form of any ORDER BY expressions * that are being implemented by the index, while indexorderby is modified to * have index column Vars on the left-hand side. Here, multiple expressions * must appear in exactly the ORDER BY order, and this is not necessarily the * index column order. Only the expressions are provided, not the auxiliary * sort-order information from the ORDER BY SortGroupClauses; it's assumed * that the sort ordering is fully determinable from the top-level operators. * indexorderbyorig is unused at run time, but is needed for EXPLAIN. * (Note these fields are used for amcanorderbyop cases, not amcanorder cases.) * * indexorderdir specifies the scan ordering, for indexscans on amcanorder * indexes (for other indexes it should be "don't care"). * ---------------- */ typedef struct IndexScan { Scan scan; Oid indexid; /* OID of index to scan */ List *indexqual; /* list of index quals (usually OpExprs) */ List *indexqualorig; /* the same in original form */ List *indexorderby; /* list of index ORDER BY exprs */ List *indexorderbyorig; /* the same in original form */ ScanDirection indexorderdir; /* forward or backward or don't care */ } IndexScan; /* ---------------- * index-only scan node * * IndexOnlyScan is very similar to IndexScan, but it specifies an * index-only scan, in which the data comes from the index not the heap. * Because of this, *all* Vars in the plan node's targetlist, qual, and * index expressions reference index columns and have varno = INDEX_VAR. * Hence we do not need separate indexqualorig and indexorderbyorig lists, * since their contents would be equivalent to indexqual and indexorderby. * * To help EXPLAIN interpret the index Vars for display, we provide * indextlist, which represents the contents of the index as a targetlist * with one TLE per index column. Vars appearing in this list reference * the base table, and this is the only field in the plan node that may * contain such Vars. * ---------------- */ typedef struct IndexOnlyScan { Scan scan; Oid indexid; /* OID of index to scan */ List *indexqual; /* list of index quals (usually OpExprs) */ List *indexorderby; /* list of index ORDER BY exprs */ List *indextlist; /* TargetEntry list describing index's cols */ ScanDirection indexorderdir; /* forward or backward or don't care */ } IndexOnlyScan; /* ---------------- * bitmap index scan node * * BitmapIndexScan delivers a bitmap of potential tuple locations; * it does not access the heap itself. The bitmap is used by an * ancestor BitmapHeapScan node, possibly after passing through * intermediate BitmapAnd and/or BitmapOr nodes to combine it with * the results of other BitmapIndexScans. * * The fields have the same meanings as for IndexScan, except we don't * store a direction flag because direction is uninteresting. * * In a BitmapIndexScan plan node, the targetlist and qual fields are * not used and are always NIL. The indexqualorig field is unused at * run time too, but is saved for the benefit of EXPLAIN. * ---------------- */ typedef struct BitmapIndexScan { Scan scan; Oid indexid; /* OID of index to scan */ List *indexqual; /* list of index quals (OpExprs) */ List *indexqualorig; /* the same in original form */ } BitmapIndexScan; /* ---------------- * bitmap sequential scan node * * This needs a copy of the qual conditions being used by the input index * scans because there are various cases where we need to recheck the quals; * for example, when the bitmap is lossy about the specific rows on a page * that meet the index condition. * ---------------- */ typedef struct BitmapHeapScan { Scan scan; List *bitmapqualorig; /* index quals, in standard expr form */ } BitmapHeapScan; /* ---------------- * tid scan node * * tidquals is an implicitly OR'ed list of qual expressions of the form * "CTID = pseudoconstant" or "CTID = ANY(pseudoconstant_array)". * ---------------- */ typedef struct TidScan { Scan scan; List *tidquals; /* qual(s) involving CTID = something */ } TidScan; /* ---------------- * subquery scan node * * SubqueryScan is for scanning the output of a sub-query in the range table. * We often need an extra plan node above the sub-query's plan to perform * expression evaluations (which we can't push into the sub-query without * risking changing its semantics). Although we are not scanning a physical * relation, we make this a descendant of Scan anyway for code-sharing * purposes. * * Note: we store the sub-plan in the type-specific subplan field, not in * the generic lefttree field as you might expect. This is because we do * not want plan-tree-traversal routines to recurse into the subplan without * knowing that they are changing Query contexts. * ---------------- */ typedef struct SubqueryScan { Scan scan; Plan *subplan; } SubqueryScan; /* ---------------- * FunctionScan node * ---------------- */ typedef struct FunctionScan { Scan scan; Node *funcexpr; /* expression tree for func call */ List *funccolnames; /* output column names (string Value nodes) */ List *funccoltypes; /* OID list of column type OIDs */ List *funccoltypmods; /* integer list of column typmods */ List *funccolcollations; /* OID list of column collation OIDs */ } FunctionScan; /* ---------------- * ValuesScan node * ---------------- */ typedef struct ValuesScan { Scan scan; List *values_lists; /* list of expression lists */ } ValuesScan; /* ---------------- * CteScan node * ---------------- */ typedef struct CteScan { Scan scan; int ctePlanId; /* ID of init SubPlan for CTE */ int cteParam; /* ID of Param representing CTE output */ } CteScan; /* ---------------- * WorkTableScan node * ---------------- */ typedef struct WorkTableScan { Scan scan; int wtParam; /* ID of Param representing work table */ } WorkTableScan; /* ---------------- * ForeignScan node * * fdw_exprs and fdw_private are both under the control of the foreign-data * wrapper, but fdw_exprs is presumed to contain expression trees and will * be post-processed accordingly by the planner; fdw_private won't be. * Note that everything in both lists must be copiable by copyObject(). * One way to store an arbitrary blob of bytes is to represent it as a bytea * Const. Usually, though, you'll be better off choosing a representation * that can be dumped usefully by nodeToString(). * ---------------- */ typedef struct ForeignScan { Scan scan; List *fdw_exprs; /* expressions that FDW may evaluate */ List *fdw_private; /* private data for FDW */ bool fsSystemCol; /* true if any "system column" is needed */ } ForeignScan; /* * ========== * Join nodes * ========== */ /* ---------------- * Join node * * jointype: rule for joining tuples from left and right subtrees * joinqual: qual conditions that came from JOIN/ON or JOIN/USING * (plan.qual contains conditions that came from WHERE) * * When jointype is INNER, joinqual and plan.qual are semantically * interchangeable. For OUTER jointypes, the two are *not* interchangeable; * only joinqual is used to determine whether a match has been found for * the purpose of deciding whether to generate null-extended tuples. * (But plan.qual is still applied before actually returning a tuple.) * For an outer join, only joinquals are allowed to be used as the merge * or hash condition of a merge or hash join. * ---------------- */ typedef struct Join { Plan plan; JoinType jointype; List *joinqual; /* JOIN quals (in addition to plan.qual) */ } Join; /* ---------------- * nest loop join node * * The nestParams list identifies any executor Params that must be passed * into execution of the inner subplan carrying values from the current row * of the outer subplan. Currently we restrict these values to be simple * Vars, but perhaps someday that'd be worth relaxing. (Note: during plan * creation, the paramval can actually be a PlaceHolderVar expression; but it * must be a Var with varno OUTER_VAR by the time it gets to the executor.) * ---------------- */ typedef struct NestLoop { Join join; List *nestParams; /* list of NestLoopParam nodes */ } NestLoop; typedef struct NestLoopParam { NodeTag type; int paramno; /* number of the PARAM_EXEC Param to set */ Var *paramval; /* outer-relation Var to assign to Param */ } NestLoopParam; /* ---------------- * merge join node * * The expected ordering of each mergeable column is described by a btree * opfamily OID, a collation OID, a direction (BTLessStrategyNumber or * BTGreaterStrategyNumber) and a nulls-first flag. Note that the two sides * of each mergeclause may be of different datatypes, but they are ordered the * same way according to the common opfamily and collation. The operator in * each mergeclause must be an equality operator of the indicated opfamily. * ---------------- */ typedef struct MergeJoin { Join join; List *mergeclauses; /* mergeclauses as expression trees */ /* these are arrays, but have the same length as the mergeclauses list: */ Oid *mergeFamilies; /* per-clause OIDs of btree opfamilies */ Oid *mergeCollations; /* per-clause OIDs of collations */ int *mergeStrategies; /* per-clause ordering (ASC or DESC) */ bool *mergeNullsFirst; /* per-clause nulls ordering */ } MergeJoin; /* ---------------- * hash join node * ---------------- */ typedef struct HashJoin { Join join; List *hashclauses; } HashJoin; /* ---------------- * materialization node * ---------------- */ typedef struct Material { Plan plan; } Material; /* ---------------- * sort node * ---------------- */ typedef struct Sort { Plan plan; int numCols; /* number of sort-key columns */ AttrNumber *sortColIdx; /* their indexes in the target list */ Oid *sortOperators; /* OIDs of operators to sort them by */ Oid *collations; /* OIDs of collations */ bool *nullsFirst; /* NULLS FIRST/LAST directions */ } Sort; /* --------------- * group node - * Used for queries with GROUP BY (but no aggregates) specified. * The input must be presorted according to the grouping columns. * --------------- */ typedef struct Group { Plan plan; int numCols; /* number of grouping columns */ AttrNumber *grpColIdx; /* their indexes in the target list */ Oid *grpOperators; /* equality operators to compare with */ } Group; /* --------------- * aggregate node * * An Agg node implements plain or grouped aggregation. For grouped * aggregation, we can work with presorted input or unsorted input; * the latter strategy uses an internal hashtable. * * Notice the lack of any direct info about the aggregate functions to be * computed. They are found by scanning the node's tlist and quals during * executor startup. (It is possible that there are no aggregate functions; * this could happen if they get optimized away by constant-folding, or if * we are using the Agg node to implement hash-based grouping.) * --------------- */ typedef enum AggStrategy { AGG_PLAIN, /* simple agg across all input rows */ AGG_SORTED, /* grouped agg, input must be sorted */ AGG_HASHED /* grouped agg, use internal hashtable */ } AggStrategy; typedef struct Agg { Plan plan; AggStrategy aggstrategy; int numCols; /* number of grouping columns */ AttrNumber *grpColIdx; /* their indexes in the target list */ Oid *grpOperators; /* equality operators to compare with */ long numGroups; /* estimated number of groups in input */ Bitmapset *aggParams; /* IDs of Params used in Aggref inputs */ /* Note: planner provides numGroups & aggParams only in AGG_HASHED case */ } Agg; /* ---------------- * window aggregate node * ---------------- */ typedef struct WindowAgg { Plan plan; Index winref; /* ID referenced by window functions */ int partNumCols; /* number of columns in partition clause */ AttrNumber *partColIdx; /* their indexes in the target list */ Oid *partOperators; /* equality operators for partition columns */ int ordNumCols; /* number of columns in ordering clause */ AttrNumber *ordColIdx; /* their indexes in the target list */ Oid *ordOperators; /* equality operators for ordering columns */ int frameOptions; /* frame_clause options, see WindowDef */ Node *startOffset; /* expression for starting bound, if any */ Node *endOffset; /* expression for ending bound, if any */ } WindowAgg; /* ---------------- * unique node * ---------------- */ typedef struct Unique { Plan plan; int numCols; /* number of columns to check for uniqueness */ AttrNumber *uniqColIdx; /* their indexes in the target list */ Oid *uniqOperators; /* equality operators to compare with */ } Unique; /* ---------------- * hash build node * * If the executor is supposed to try to apply skew join optimization, then * skewTable/skewColumn/skewInherit identify the outer relation's join key * column, from which the relevant MCV statistics can be fetched. Also, its * type information is provided to save a lookup. * ---------------- */ typedef struct Hash { Plan plan; Oid skewTable; /* outer join key's table OID, or InvalidOid */ AttrNumber skewColumn; /* outer join key's column #, or zero */ bool skewInherit; /* is outer join rel an inheritance tree? */ Oid skewColType; /* datatype of the outer key column */ int32 skewColTypmod; /* typmod of the outer key column */ /* all other info is in the parent HashJoin node */ } Hash; /* ---------------- * setop node * ---------------- */ typedef enum SetOpCmd { SETOPCMD_INTERSECT, SETOPCMD_INTERSECT_ALL, SETOPCMD_EXCEPT, SETOPCMD_EXCEPT_ALL } SetOpCmd; typedef enum SetOpStrategy { SETOP_SORTED, /* input must be sorted */ SETOP_HASHED /* use internal hashtable */ } SetOpStrategy; typedef struct SetOp { Plan plan; SetOpCmd cmd; /* what to do */ SetOpStrategy strategy; /* how to do it */ int numCols; /* number of columns to check for * duplicate-ness */ AttrNumber *dupColIdx; /* their indexes in the target list */ Oid *dupOperators; /* equality operators to compare with */ AttrNumber flagColIdx; /* where is the flag column, if any */ int firstFlag; /* flag value for first input relation */ long numGroups; /* estimated number of groups in input */ } SetOp; /* ---------------- * lock-rows node * * rowMarks identifies the rels to be locked by this node; it should be * a subset of the rowMarks listed in the top-level PlannedStmt. * epqParam is a Param that all scan nodes below this one must depend on. * It is used to force re-evaluation of the plan during EvalPlanQual. * ---------------- */ typedef struct LockRows { Plan plan; List *rowMarks; /* a list of PlanRowMark's */ int epqParam; /* ID of Param for EvalPlanQual re-eval */ } LockRows; /* ---------------- * limit node * * Note: as of Postgres 8.2, the offset and count expressions are expected * to yield int8, rather than int4 as before. * ---------------- */ typedef struct Limit { Plan plan; Node *limitOffset; /* OFFSET parameter, or NULL if none */ Node *limitCount; /* COUNT parameter, or NULL if none */ } Limit; /* * RowMarkType - * enums for types of row-marking operations * * When doing UPDATE, DELETE, or SELECT FOR UPDATE/SHARE, we have to uniquely * identify all the source rows, not only those from the target relations, so * that we can perform EvalPlanQual rechecking at need. For plain tables we * can just fetch the TID, the same as for a target relation. Otherwise (for * example for VALUES or FUNCTION scans) we have to copy the whole row value. * The latter is pretty inefficient but fortunately the case is not * performance-critical in practice. */ typedef enum RowMarkType { ROW_MARK_EXCLUSIVE, /* obtain exclusive tuple lock */ ROW_MARK_SHARE, /* obtain shared tuple lock */ ROW_MARK_REFERENCE, /* just fetch the TID */ ROW_MARK_COPY /* physically copy the row value */ } RowMarkType; #define RowMarkRequiresRowShareLock(marktype) ((marktype) <= ROW_MARK_SHARE) /* * PlanRowMark - * plan-time representation of FOR UPDATE/SHARE clauses * * When doing UPDATE, DELETE, or SELECT FOR UPDATE/SHARE, we create a separate * PlanRowMark node for each non-target relation in the query. Relations that * are not specified as FOR UPDATE/SHARE are marked ROW_MARK_REFERENCE (if * real tables) or ROW_MARK_COPY (if not). * * Initially all PlanRowMarks have rti == prti and isParent == false. * When the planner discovers that a relation is the root of an inheritance * tree, it sets isParent true, and adds an additional PlanRowMark to the * list for each child relation (including the target rel itself in its role * as a child). The child entries have rti == child rel's RT index and * prti == parent's RT index, and can therefore be recognized as children by * the fact that prti != rti. * * The planner also adds resjunk output columns to the plan that carry * information sufficient to identify the locked or fetched rows. For * tables (markType != ROW_MARK_COPY), these columns are named * tableoid%u OID of table * ctid%u TID of row * The tableoid column is only present for an inheritance hierarchy. * When markType == ROW_MARK_COPY, there is instead a single column named * wholerow%u whole-row value of relation * In all three cases, %u represents the rowmark ID number (rowmarkId). * This number is unique within a plan tree, except that child relation * entries copy their parent's rowmarkId. (Assigning unique numbers * means we needn't renumber rowmarkIds when flattening subqueries, which * would require finding and renaming the resjunk columns as well.) * Note this means that all tables in an inheritance hierarchy share the * same resjunk column names. However, in an inherited UPDATE/DELETE the * columns could have different physical column numbers in each subplan. */ typedef struct PlanRowMark { NodeTag type; Index rti; /* range table index of markable relation */ Index prti; /* range table index of parent relation */ Index rowmarkId; /* unique identifier for resjunk columns */ RowMarkType markType; /* see enum above */ bool noWait; /* NOWAIT option */ bool isParent; /* true if this is a "dummy" parent entry */ } PlanRowMark; /* * Plan invalidation info * * We track the objects on which a PlannedStmt depends in two ways: * relations are recorded as a simple list of OIDs, and everything else * is represented as a list of PlanInvalItems. A PlanInvalItem is designed * to be used with the syscache invalidation mechanism, so it identifies a * system catalog entry by cache ID and hash value. */ typedef struct PlanInvalItem { NodeTag type; int cacheId; /* a syscache ID, see utils/syscache.h */ uint32 hashValue; /* hash value of object's cache lookup key */ } PlanInvalItem; #endif /* PLANNODES_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/nodes/nodes.h��������������������������������������������������������������������������0000644�����������������00000034544�14763166026�0011616 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodes.h * Definitions for tagged nodes. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/nodes/nodes.h * *------------------------------------------------------------------------- */ #ifndef NODES_H #define NODES_H /* * The first field of every node is NodeTag. Each node created (with makeNode) * will have one of the following tags as the value of its first field. * * Note that the numbers of the node tags are not contiguous. We left holes * here so that we can add more tags without changing the existing enum's. * (Since node tag numbers never exist outside backend memory, there's no * real harm in renumbering, it just costs a full rebuild ...) */ typedef enum NodeTag { T_Invalid = 0, /* * TAGS FOR EXECUTOR NODES (execnodes.h) */ T_IndexInfo = 10, T_ExprContext, T_ProjectionInfo, T_JunkFilter, T_ResultRelInfo, T_EState, T_TupleTableSlot, /* * TAGS FOR PLAN NODES (plannodes.h) */ T_Plan = 100, T_Result, T_ModifyTable, T_Append, T_MergeAppend, T_RecursiveUnion, T_BitmapAnd, T_BitmapOr, T_Scan, T_SeqScan, T_IndexScan, T_IndexOnlyScan, T_BitmapIndexScan, T_BitmapHeapScan, T_TidScan, T_SubqueryScan, T_FunctionScan, T_ValuesScan, T_CteScan, T_WorkTableScan, T_ForeignScan, T_Join, T_NestLoop, T_MergeJoin, T_HashJoin, T_Material, T_Sort, T_Group, T_Agg, T_WindowAgg, T_Unique, T_Hash, T_SetOp, T_LockRows, T_Limit, /* these aren't subclasses of Plan: */ T_NestLoopParam, T_PlanRowMark, T_PlanInvalItem, /* * TAGS FOR PLAN STATE NODES (execnodes.h) * * These should correspond one-to-one with Plan node types. */ T_PlanState = 200, T_ResultState, T_ModifyTableState, T_AppendState, T_MergeAppendState, T_RecursiveUnionState, T_BitmapAndState, T_BitmapOrState, T_ScanState, T_SeqScanState, T_IndexScanState, T_IndexOnlyScanState, T_BitmapIndexScanState, T_BitmapHeapScanState, T_TidScanState, T_SubqueryScanState, T_FunctionScanState, T_ValuesScanState, T_CteScanState, T_WorkTableScanState, T_ForeignScanState, T_JoinState, T_NestLoopState, T_MergeJoinState, T_HashJoinState, T_MaterialState, T_SortState, T_GroupState, T_AggState, T_WindowAggState, T_UniqueState, T_HashState, T_SetOpState, T_LockRowsState, T_LimitState, /* * TAGS FOR PRIMITIVE NODES (primnodes.h) */ T_Alias = 300, T_RangeVar, T_Expr, T_Var, T_Const, T_Param, T_Aggref, T_WindowFunc, T_ArrayRef, T_FuncExpr, T_NamedArgExpr, T_OpExpr, T_DistinctExpr, T_NullIfExpr, T_ScalarArrayOpExpr, T_BoolExpr, T_SubLink, T_SubPlan, T_AlternativeSubPlan, T_FieldSelect, T_FieldStore, T_RelabelType, T_CoerceViaIO, T_ArrayCoerceExpr, T_ConvertRowtypeExpr, T_CollateExpr, T_CaseExpr, T_CaseWhen, T_CaseTestExpr, T_ArrayExpr, T_RowExpr, T_RowCompareExpr, T_CoalesceExpr, T_MinMaxExpr, T_XmlExpr, T_NullTest, T_BooleanTest, T_CoerceToDomain, T_CoerceToDomainValue, T_SetToDefault, T_CurrentOfExpr, T_TargetEntry, T_RangeTblRef, T_JoinExpr, T_FromExpr, T_IntoClause, /* * TAGS FOR EXPRESSION STATE NODES (execnodes.h) * * These correspond (not always one-for-one) to primitive nodes derived * from Expr. */ T_ExprState = 400, T_GenericExprState, T_AggrefExprState, T_WindowFuncExprState, T_ArrayRefExprState, T_FuncExprState, T_ScalarArrayOpExprState, T_BoolExprState, T_SubPlanState, T_AlternativeSubPlanState, T_FieldSelectState, T_FieldStoreState, T_CoerceViaIOState, T_ArrayCoerceExprState, T_ConvertRowtypeExprState, T_CaseExprState, T_CaseWhenState, T_ArrayExprState, T_RowExprState, T_RowCompareExprState, T_CoalesceExprState, T_MinMaxExprState, T_XmlExprState, T_NullTestState, T_CoerceToDomainState, T_DomainConstraintState, T_WholeRowVarExprState, /* will be in a more natural position in 9.3 */ /* * TAGS FOR PLANNER NODES (relation.h) */ T_PlannerInfo = 500, T_PlannerGlobal, T_RelOptInfo, T_IndexOptInfo, T_ParamPathInfo, T_Path, T_IndexPath, T_BitmapHeapPath, T_BitmapAndPath, T_BitmapOrPath, T_NestPath, T_MergePath, T_HashPath, T_TidPath, T_ForeignPath, T_AppendPath, T_MergeAppendPath, T_ResultPath, T_MaterialPath, T_UniquePath, T_EquivalenceClass, T_EquivalenceMember, T_PathKey, T_RestrictInfo, T_PlaceHolderVar, T_SpecialJoinInfo, T_AppendRelInfo, T_PlaceHolderInfo, T_MinMaxAggInfo, T_PlannerParamItem, /* * TAGS FOR MEMORY NODES (memnodes.h) */ T_MemoryContext = 600, T_AllocSetContext, /* * TAGS FOR VALUE NODES (value.h) */ T_Value = 650, T_Integer, T_Float, T_String, T_BitString, T_Null, /* * TAGS FOR LIST NODES (pg_list.h) */ T_List, T_IntList, T_OidList, /* * TAGS FOR STATEMENT NODES (mostly in parsenodes.h) */ T_Query = 700, T_PlannedStmt, T_InsertStmt, T_DeleteStmt, T_UpdateStmt, T_SelectStmt, T_AlterTableStmt, T_AlterTableCmd, T_AlterDomainStmt, T_SetOperationStmt, T_GrantStmt, T_GrantRoleStmt, T_AlterDefaultPrivilegesStmt, T_ClosePortalStmt, T_ClusterStmt, T_CopyStmt, T_CreateStmt, T_DefineStmt, T_DropStmt, T_TruncateStmt, T_CommentStmt, T_FetchStmt, T_IndexStmt, T_CreateFunctionStmt, T_AlterFunctionStmt, T_DoStmt, T_RenameStmt, T_RuleStmt, T_NotifyStmt, T_ListenStmt, T_UnlistenStmt, T_TransactionStmt, T_ViewStmt, T_LoadStmt, T_CreateDomainStmt, T_CreatedbStmt, T_DropdbStmt, T_VacuumStmt, T_ExplainStmt, T_CreateTableAsStmt, T_CreateSeqStmt, T_AlterSeqStmt, T_VariableSetStmt, T_VariableShowStmt, T_DiscardStmt, T_CreateTrigStmt, T_CreatePLangStmt, T_CreateRoleStmt, T_AlterRoleStmt, T_DropRoleStmt, T_LockStmt, T_ConstraintsSetStmt, T_ReindexStmt, T_CheckPointStmt, T_CreateSchemaStmt, T_AlterDatabaseStmt, T_AlterDatabaseSetStmt, T_AlterRoleSetStmt, T_CreateConversionStmt, T_CreateCastStmt, T_CreateOpClassStmt, T_CreateOpFamilyStmt, T_AlterOpFamilyStmt, T_PrepareStmt, T_ExecuteStmt, T_DeallocateStmt, T_DeclareCursorStmt, T_CreateTableSpaceStmt, T_DropTableSpaceStmt, T_AlterObjectSchemaStmt, T_AlterOwnerStmt, T_DropOwnedStmt, T_ReassignOwnedStmt, T_CompositeTypeStmt, T_CreateEnumStmt, T_CreateRangeStmt, T_AlterEnumStmt, T_AlterTSDictionaryStmt, T_AlterTSConfigurationStmt, T_CreateFdwStmt, T_AlterFdwStmt, T_CreateForeignServerStmt, T_AlterForeignServerStmt, T_CreateUserMappingStmt, T_AlterUserMappingStmt, T_DropUserMappingStmt, T_AlterTableSpaceOptionsStmt, T_SecLabelStmt, T_CreateForeignTableStmt, T_CreateExtensionStmt, T_AlterExtensionStmt, T_AlterExtensionContentsStmt, /* * TAGS FOR PARSE TREE NODES (parsenodes.h) */ T_A_Expr = 900, T_ColumnRef, T_ParamRef, T_A_Const, T_FuncCall, T_A_Star, T_A_Indices, T_A_Indirection, T_A_ArrayExpr, T_ResTarget, T_TypeCast, T_CollateClause, T_SortBy, T_WindowDef, T_RangeSubselect, T_RangeFunction, T_TypeName, T_ColumnDef, T_IndexElem, T_Constraint, T_DefElem, T_RangeTblEntry, T_SortGroupClause, T_WindowClause, T_PrivGrantee, T_FuncWithArgs, T_AccessPriv, T_CreateOpClassItem, T_TableLikeClause, T_FunctionParameter, T_LockingClause, T_RowMarkClause, T_XmlSerialize, T_WithClause, T_CommonTableExpr, /* * TAGS FOR REPLICATION GRAMMAR PARSE NODES (replnodes.h) */ T_IdentifySystemCmd, T_BaseBackupCmd, T_StartReplicationCmd, /* * TAGS FOR RANDOM OTHER STUFF * * These are objects that aren't part of parse/plan/execute node tree * structures, but we give them NodeTags anyway for identification * purposes (usually because they are involved in APIs where we want to * pass multiple object types through the same pointer). */ T_TriggerData = 950, /* in commands/trigger.h */ T_ReturnSetInfo, /* in nodes/execnodes.h */ T_WindowObjectData, /* private in nodeWindowAgg.c */ T_TIDBitmap, /* in nodes/tidbitmap.h */ T_InlineCodeBlock, /* in nodes/parsenodes.h */ T_FdwRoutine /* in foreign/fdwapi.h */ } NodeTag; /* * The first field of a node of any type is guaranteed to be the NodeTag. * Hence the type of any node can be gotten by casting it to Node. Declaring * a variable to be of Node * (instead of void *) can also facilitate * debugging. */ typedef struct Node { NodeTag type; } Node; #define nodeTag(nodeptr) (((const Node*)(nodeptr))->type) /* * newNode - * create a new node of the specified size and tag the node with the * specified tag. * * !WARNING!: Avoid using newNode directly. You should be using the * macro makeNode. eg. to create a Query node, use makeNode(Query) * * Note: the size argument should always be a compile-time constant, so the * apparent risk of multiple evaluation doesn't matter in practice. */ #ifdef __GNUC__ /* With GCC, we can use a compound statement within an expression */ #define newNode(size, tag) \ ({ Node *_result; \ AssertMacro((size) >= sizeof(Node)); /* need the tag, at least */ \ _result = (Node *) palloc0fast(size); \ _result->type = (tag); \ _result; \ }) #else /* * There is no way to dereference the palloc'ed pointer to assign the * tag, and also return the pointer itself, so we need a holder variable. * Fortunately, this macro isn't recursive so we just define * a global variable for this purpose. */ extern PGDLLIMPORT Node *newNodeMacroHolder; #define newNode(size, tag) \ ( \ AssertMacro((size) >= sizeof(Node)), /* need the tag, at least */ \ newNodeMacroHolder = (Node *) palloc0fast(size), \ newNodeMacroHolder->type = (tag), \ newNodeMacroHolder \ ) #endif /* __GNUC__ */ #define makeNode(_type_) ((_type_ *) newNode(sizeof(_type_),T_##_type_)) #define NodeSetTag(nodeptr,t) (((Node*)(nodeptr))->type = (t)) #define IsA(nodeptr,_type_) (nodeTag(nodeptr) == T_##_type_) /* * castNode(type, ptr) casts ptr to "type *", and if assertions are enabled, * verifies that the node has the appropriate type (using its nodeTag()). * * Use an inline function when assertions are enabled, to avoid multiple * evaluations of the ptr argument (which could e.g. be a function call). * If inline functions are not available - only a small number of platforms - * don't Assert, but use the non-checking version. */ #if defined(USE_ASSERT_CHECKING) && defined(PG_USE_INLINE) static inline Node * castNodeImpl(NodeTag type, void *ptr) { Assert(ptr == NULL || nodeTag(ptr) == type); return (Node *) ptr; } #define castNode(_type_, nodeptr) ((_type_ *) castNodeImpl(T_##_type_, nodeptr)) #else #define castNode(_type_, nodeptr) ((_type_ *) (nodeptr)) #endif /* USE_ASSERT_CHECKING && PG_USE_INLINE */ /* ---------------------------------------------------------------- * extern declarations follow * ---------------------------------------------------------------- */ /* * nodes/{outfuncs.c,print.c} */ extern char *nodeToString(const void *obj); /* * nodes/{readfuncs.c,read.c} */ extern void *stringToNode(char *str); /* * nodes/copyfuncs.c */ extern void *copyObject(const void *obj); /* * nodes/equalfuncs.c */ extern bool equal(const void *a, const void *b); /* * Typedefs for identifying qualifier selectivities and plan costs as such. * These are just plain "double"s, but declaring a variable as Selectivity * or Cost makes the intent more obvious. * * These could have gone into plannodes.h or some such, but many files * depend on them... */ typedef double Selectivity; /* fraction of tuples a qualifier will pass */ typedef double Cost; /* execution cost (in page-access units) */ /* * CmdType - * enums for type of operation represented by a Query or PlannedStmt * * This is needed in both parsenodes.h and plannodes.h, so put it here... */ typedef enum CmdType { CMD_UNKNOWN, CMD_SELECT, /* select stmt */ CMD_UPDATE, /* update stmt */ CMD_INSERT, /* insert stmt */ CMD_DELETE, CMD_UTILITY, /* cmds like create, destroy, copy, vacuum, * etc. */ CMD_NOTHING /* dummy command for instead nothing rules * with qual */ } CmdType; /* * JoinType - * enums for types of relation joins * * JoinType determines the exact semantics of joining two relations using * a matching qualification. For example, it tells what to do with a tuple * that has no match in the other relation. * * This is needed in both parsenodes.h and plannodes.h, so put it here... */ typedef enum JoinType { /* * The canonical kinds of joins according to the SQL JOIN syntax. Only * these codes can appear in parser output (e.g., JoinExpr nodes). */ JOIN_INNER, /* matching tuple pairs only */ JOIN_LEFT, /* pairs + unmatched LHS tuples */ JOIN_FULL, /* pairs + unmatched LHS + unmatched RHS */ JOIN_RIGHT, /* pairs + unmatched RHS tuples */ /* * Semijoins and anti-semijoins (as defined in relational theory) do not * appear in the SQL JOIN syntax, but there are standard idioms for * representing them (e.g., using EXISTS). The planner recognizes these * cases and converts them to joins. So the planner and executor must * support these codes. NOTE: in JOIN_SEMI output, it is unspecified * which matching RHS row is joined to. In JOIN_ANTI output, the row is * guaranteed to be null-extended. */ JOIN_SEMI, /* 1 copy of each LHS row that has match(es) */ JOIN_ANTI, /* 1 copy of each LHS row that has no match */ /* * These codes are used internally in the planner, but are not supported * by the executor (nor, indeed, by most of the planner). */ JOIN_UNIQUE_OUTER, /* LHS path must be made unique */ JOIN_UNIQUE_INNER /* RHS path must be made unique */ /* * We might need additional join types someday. */ } JoinType; /* * OUTER joins are those for which pushed-down quals must behave differently * from the join's own quals. This is in fact everything except INNER and * SEMI joins. However, this macro must also exclude the JOIN_UNIQUE symbols * since those are temporary proxies for what will eventually be an INNER * join. * * Note: semijoins are a hybrid case, but we choose to treat them as not * being outer joins. This is okay principally because the SQL syntax makes * it impossible to have a pushed-down qual that refers to the inner relation * of a semijoin; so there is no strong need to distinguish join quals from * pushed-down quals. This is convenient because for almost all purposes, * quals attached to a semijoin can be treated the same as innerjoin quals. */ #define IS_OUTER_JOIN(jointype) \ (((1 << (jointype)) & \ ((1 << JOIN_LEFT) | \ (1 << JOIN_FULL) | \ (1 << JOIN_RIGHT) | \ (1 << JOIN_ANTI))) != 0) #endif /* NODES_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/nodes/parsenodes.h���������������������������������������������������������������������0000644�����������������00000255723�14763166026�0012655 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * parsenodes.h * definitions for parse tree nodes * * Many of the node types used in parsetrees include a "location" field. * This is a byte (not character) offset in the original source text, to be * used for positioning an error cursor when there is an error related to * the node. Access to the original source text is needed to make use of * the location. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/nodes/parsenodes.h * *------------------------------------------------------------------------- */ #ifndef PARSENODES_H #define PARSENODES_H #include "nodes/bitmapset.h" #include "nodes/primnodes.h" #include "nodes/value.h" /* Possible sources of a Query */ typedef enum QuerySource { QSRC_ORIGINAL, /* original parsetree (explicit query) */ QSRC_PARSER, /* added by parse analysis (now unused) */ QSRC_INSTEAD_RULE, /* added by unconditional INSTEAD rule */ QSRC_QUAL_INSTEAD_RULE, /* added by conditional INSTEAD rule */ QSRC_NON_INSTEAD_RULE /* added by non-INSTEAD rule */ } QuerySource; /* Sort ordering options for ORDER BY and CREATE INDEX */ typedef enum SortByDir { SORTBY_DEFAULT, SORTBY_ASC, SORTBY_DESC, SORTBY_USING /* not allowed in CREATE INDEX ... */ } SortByDir; typedef enum SortByNulls { SORTBY_NULLS_DEFAULT, SORTBY_NULLS_FIRST, SORTBY_NULLS_LAST } SortByNulls; /* * Grantable rights are encoded so that we can OR them together in a bitmask. * The present representation of AclItem limits us to 16 distinct rights, * even though AclMode is defined as uint32. See utils/acl.h. * * Caution: changing these codes breaks stored ACLs, hence forces initdb. */ typedef uint32 AclMode; /* a bitmask of privilege bits */ #define ACL_INSERT (1<<0) /* for relations */ #define ACL_SELECT (1<<1) #define ACL_UPDATE (1<<2) #define ACL_DELETE (1<<3) #define ACL_TRUNCATE (1<<4) #define ACL_REFERENCES (1<<5) #define ACL_TRIGGER (1<<6) #define ACL_EXECUTE (1<<7) /* for functions */ #define ACL_USAGE (1<<8) /* for languages, namespaces, FDWs, and * servers */ #define ACL_CREATE (1<<9) /* for namespaces and databases */ #define ACL_CREATE_TEMP (1<<10) /* for databases */ #define ACL_CONNECT (1<<11) /* for databases */ #define N_ACL_RIGHTS 12 /* 1 plus the last 1<<x */ #define ACL_NO_RIGHTS 0 /* Currently, SELECT ... FOR UPDATE/FOR SHARE requires UPDATE privileges */ #define ACL_SELECT_FOR_UPDATE ACL_UPDATE /***************************************************************************** * Query Tree *****************************************************************************/ /* * Query - * Parse analysis turns all statements into a Query tree * for further processing by the rewriter and planner. * * Utility statements (i.e. non-optimizable statements) have the * utilityStmt field set, and the Query itself is mostly dummy. * DECLARE CURSOR is a special case: it is represented like a SELECT, * but the original DeclareCursorStmt is stored in utilityStmt. * * Planning converts a Query tree into a Plan tree headed by a PlannedStmt * node --- the Query structure is not used by the executor. */ typedef struct Query { NodeTag type; CmdType commandType; /* select|insert|update|delete|utility */ QuerySource querySource; /* where did I come from? */ uint32 queryId; /* query identifier (can be set by plugins) */ bool canSetTag; /* do I set the command result tag? */ Node *utilityStmt; /* non-null if this is DECLARE CURSOR or a * non-optimizable statement */ int resultRelation; /* rtable index of target relation for * INSERT/UPDATE/DELETE; 0 for SELECT */ bool hasAggs; /* has aggregates in tlist or havingQual */ bool hasWindowFuncs; /* has window functions in tlist */ bool hasSubLinks; /* has subquery SubLink */ bool hasDistinctOn; /* distinctClause is from DISTINCT ON */ bool hasRecursive; /* WITH RECURSIVE was specified */ bool hasModifyingCTE; /* has INSERT/UPDATE/DELETE in WITH */ bool hasForUpdate; /* FOR UPDATE or FOR SHARE was specified */ List *cteList; /* WITH list (of CommonTableExpr's) */ List *rtable; /* list of range table entries */ FromExpr *jointree; /* table join tree (FROM and WHERE clauses) */ List *targetList; /* target list (of TargetEntry) */ List *returningList; /* return-values list (of TargetEntry) */ List *groupClause; /* a list of SortGroupClause's */ Node *havingQual; /* qualifications applied to groups */ List *windowClause; /* a list of WindowClause's */ List *distinctClause; /* a list of SortGroupClause's */ List *sortClause; /* a list of SortGroupClause's */ Node *limitOffset; /* # of result tuples to skip (int8 expr) */ Node *limitCount; /* # of result tuples to return (int8 expr) */ List *rowMarks; /* a list of RowMarkClause's */ Node *setOperations; /* set-operation tree if this is top level of * a UNION/INTERSECT/EXCEPT query */ List *constraintDeps; /* a list of pg_constraint OIDs that the query * depends on to be semantically valid */ } Query; /**************************************************************************** * Supporting data structures for Parse Trees * * Most of these node types appear in raw parsetrees output by the grammar, * and get transformed to something else by the analyzer. A few of them * are used as-is in transformed querytrees. ****************************************************************************/ /* * TypeName - specifies a type in definitions * * For TypeName structures generated internally, it is often easier to * specify the type by OID than by name. If "names" is NIL then the * actual type OID is given by typeOid, otherwise typeOid is unused. * Similarly, if "typmods" is NIL then the actual typmod is expected to * be prespecified in typemod, otherwise typemod is unused. * * If pct_type is TRUE, then names is actually a field name and we look up * the type of that field. Otherwise (the normal case), names is a type * name possibly qualified with schema and database name. */ typedef struct TypeName { NodeTag type; List *names; /* qualified name (list of Value strings) */ Oid typeOid; /* type identified by OID */ bool setof; /* is a set? */ bool pct_type; /* %TYPE specified? */ List *typmods; /* type modifier expression(s) */ int32 typemod; /* prespecified type modifier */ List *arrayBounds; /* array bounds */ int location; /* token location, or -1 if unknown */ } TypeName; /* * ColumnRef - specifies a reference to a column, or possibly a whole tuple * * The "fields" list must be nonempty. It can contain string Value nodes * (representing names) and A_Star nodes (representing occurrence of a '*'). * Currently, A_Star must appear only as the last list element --- the grammar * is responsible for enforcing this! * * Note: any array subscripting or selection of fields from composite columns * is represented by an A_Indirection node above the ColumnRef. However, * for simplicity in the normal case, initial field selection from a table * name is represented within ColumnRef and not by adding A_Indirection. */ typedef struct ColumnRef { NodeTag type; List *fields; /* field names (Value strings) or A_Star */ int location; /* token location, or -1 if unknown */ } ColumnRef; /* * ParamRef - specifies a $n parameter reference */ typedef struct ParamRef { NodeTag type; int number; /* the number of the parameter */ int location; /* token location, or -1 if unknown */ } ParamRef; /* * A_Expr - infix, prefix, and postfix expressions */ typedef enum A_Expr_Kind { AEXPR_OP, /* normal operator */ AEXPR_AND, /* booleans - name field is unused */ AEXPR_OR, AEXPR_NOT, AEXPR_OP_ANY, /* scalar op ANY (array) */ AEXPR_OP_ALL, /* scalar op ALL (array) */ AEXPR_DISTINCT, /* IS DISTINCT FROM - name must be "=" */ AEXPR_NULLIF, /* NULLIF - name must be "=" */ AEXPR_OF, /* IS [NOT] OF - name must be "=" or "<>" */ AEXPR_IN /* [NOT] IN - name must be "=" or "<>" */ } A_Expr_Kind; typedef struct A_Expr { NodeTag type; A_Expr_Kind kind; /* see above */ List *name; /* possibly-qualified name of operator */ Node *lexpr; /* left argument, or NULL if none */ Node *rexpr; /* right argument, or NULL if none */ int location; /* token location, or -1 if unknown */ } A_Expr; /* * A_Const - a literal constant */ typedef struct A_Const { NodeTag type; Value val; /* value (includes type info, see value.h) */ int location; /* token location, or -1 if unknown */ } A_Const; /* * TypeCast - a CAST expression */ typedef struct TypeCast { NodeTag type; Node *arg; /* the expression being casted */ TypeName *typeName; /* the target type */ int location; /* token location, or -1 if unknown */ } TypeCast; /* * CollateClause - a COLLATE expression */ typedef struct CollateClause { NodeTag type; Node *arg; /* input expression */ List *collname; /* possibly-qualified collation name */ int location; /* token location, or -1 if unknown */ } CollateClause; /* * FuncCall - a function or aggregate invocation * * agg_order (if not NIL) indicates we saw 'foo(... ORDER BY ...)'. * agg_star indicates we saw a 'foo(*)' construct, while agg_distinct * indicates we saw 'foo(DISTINCT ...)'. In any of these cases, the * construct *must* be an aggregate call. Otherwise, it might be either an * aggregate or some other kind of function. However, if OVER is present * it had better be an aggregate or window function. */ typedef struct FuncCall { NodeTag type; List *funcname; /* qualified name of function */ List *args; /* the arguments (list of exprs) */ List *agg_order; /* ORDER BY (list of SortBy) */ bool agg_star; /* argument was really '*' */ bool agg_distinct; /* arguments were labeled DISTINCT */ bool func_variadic; /* last argument was labeled VARIADIC */ struct WindowDef *over; /* OVER clause, if any */ int location; /* token location, or -1 if unknown */ } FuncCall; /* * A_Star - '*' representing all columns of a table or compound field * * This can appear within ColumnRef.fields, A_Indirection.indirection, and * ResTarget.indirection lists. */ typedef struct A_Star { NodeTag type; } A_Star; /* * A_Indices - array subscript or slice bounds ([lidx:uidx] or [uidx]) */ typedef struct A_Indices { NodeTag type; Node *lidx; /* NULL if it's a single subscript */ Node *uidx; } A_Indices; /* * A_Indirection - select a field and/or array element from an expression * * The indirection list can contain A_Indices nodes (representing * subscripting), string Value nodes (representing field selection --- the * string value is the name of the field to select), and A_Star nodes * (representing selection of all fields of a composite type). * For example, a complex selection operation like * (foo).field1[42][7].field2 * would be represented with a single A_Indirection node having a 4-element * indirection list. * * Currently, A_Star must appear only as the last list element --- the grammar * is responsible for enforcing this! */ typedef struct A_Indirection { NodeTag type; Node *arg; /* the thing being selected from */ List *indirection; /* subscripts and/or field names and/or * */ } A_Indirection; /* * A_ArrayExpr - an ARRAY[] construct */ typedef struct A_ArrayExpr { NodeTag type; List *elements; /* array element expressions */ int location; /* token location, or -1 if unknown */ } A_ArrayExpr; /* * ResTarget - * result target (used in target list of pre-transformed parse trees) * * In a SELECT target list, 'name' is the column label from an * 'AS ColumnLabel' clause, or NULL if there was none, and 'val' is the * value expression itself. The 'indirection' field is not used. * * INSERT uses ResTarget in its target-column-names list. Here, 'name' is * the name of the destination column, 'indirection' stores any subscripts * attached to the destination, and 'val' is not used. * * In an UPDATE target list, 'name' is the name of the destination column, * 'indirection' stores any subscripts attached to the destination, and * 'val' is the expression to assign. * * See A_Indirection for more info about what can appear in 'indirection'. */ typedef struct ResTarget { NodeTag type; char *name; /* column name or NULL */ List *indirection; /* subscripts, field names, and '*', or NIL */ Node *val; /* the value expression to compute or assign */ int location; /* token location, or -1 if unknown */ } ResTarget; /* * SortBy - for ORDER BY clause */ typedef struct SortBy { NodeTag type; Node *node; /* expression to sort on */ SortByDir sortby_dir; /* ASC/DESC/USING/default */ SortByNulls sortby_nulls; /* NULLS FIRST/LAST */ List *useOp; /* name of op to use, if SORTBY_USING */ int location; /* operator location, or -1 if none/unknown */ } SortBy; /* * WindowDef - raw representation of WINDOW and OVER clauses * * For entries in a WINDOW list, "name" is the window name being defined. * For OVER clauses, we use "name" for the "OVER window" syntax, or "refname" * for the "OVER (window)" syntax, which is subtly different --- the latter * implies overriding the window frame clause. */ typedef struct WindowDef { NodeTag type; char *name; /* window's own name */ char *refname; /* referenced window name, if any */ List *partitionClause; /* PARTITION BY expression list */ List *orderClause; /* ORDER BY (list of SortBy) */ int frameOptions; /* frame_clause options, see below */ Node *startOffset; /* expression for starting bound, if any */ Node *endOffset; /* expression for ending bound, if any */ int location; /* parse location, or -1 if none/unknown */ } WindowDef; /* * frameOptions is an OR of these bits. The NONDEFAULT and BETWEEN bits are * used so that ruleutils.c can tell which properties were specified and * which were defaulted; the correct behavioral bits must be set either way. * The START_foo and END_foo options must come in pairs of adjacent bits for * the convenience of gram.y, even though some of them are useless/invalid. * We will need more bits (and fields) to cover the full SQL:2008 option set. */ #define FRAMEOPTION_NONDEFAULT 0x00001 /* any specified? */ #define FRAMEOPTION_RANGE 0x00002 /* RANGE behavior */ #define FRAMEOPTION_ROWS 0x00004 /* ROWS behavior */ #define FRAMEOPTION_BETWEEN 0x00008 /* BETWEEN given? */ #define FRAMEOPTION_START_UNBOUNDED_PRECEDING 0x00010 /* start is U. P. */ #define FRAMEOPTION_END_UNBOUNDED_PRECEDING 0x00020 /* (disallowed) */ #define FRAMEOPTION_START_UNBOUNDED_FOLLOWING 0x00040 /* (disallowed) */ #define FRAMEOPTION_END_UNBOUNDED_FOLLOWING 0x00080 /* end is U. F. */ #define FRAMEOPTION_START_CURRENT_ROW 0x00100 /* start is C. R. */ #define FRAMEOPTION_END_CURRENT_ROW 0x00200 /* end is C. R. */ #define FRAMEOPTION_START_VALUE_PRECEDING 0x00400 /* start is V. P. */ #define FRAMEOPTION_END_VALUE_PRECEDING 0x00800 /* end is V. P. */ #define FRAMEOPTION_START_VALUE_FOLLOWING 0x01000 /* start is V. F. */ #define FRAMEOPTION_END_VALUE_FOLLOWING 0x02000 /* end is V. F. */ #define FRAMEOPTION_START_VALUE \ (FRAMEOPTION_START_VALUE_PRECEDING | FRAMEOPTION_START_VALUE_FOLLOWING) #define FRAMEOPTION_END_VALUE \ (FRAMEOPTION_END_VALUE_PRECEDING | FRAMEOPTION_END_VALUE_FOLLOWING) #define FRAMEOPTION_DEFAULTS \ (FRAMEOPTION_RANGE | FRAMEOPTION_START_UNBOUNDED_PRECEDING | \ FRAMEOPTION_END_CURRENT_ROW) /* * RangeSubselect - subquery appearing in a FROM clause */ typedef struct RangeSubselect { NodeTag type; Node *subquery; /* the untransformed sub-select clause */ Alias *alias; /* table alias & optional column aliases */ } RangeSubselect; /* * RangeFunction - function call appearing in a FROM clause */ typedef struct RangeFunction { NodeTag type; Node *funccallnode; /* untransformed function call tree */ Alias *alias; /* table alias & optional column aliases */ List *coldeflist; /* list of ColumnDef nodes to describe result * of function returning RECORD */ } RangeFunction; /* * ColumnDef - column definition (used in various creates) * * If the column has a default value, we may have the value expression * in either "raw" form (an untransformed parse tree) or "cooked" form * (a post-parse-analysis, executable expression tree), depending on * how this ColumnDef node was created (by parsing, or by inheritance * from an existing relation). We should never have both in the same node! * * Similarly, we may have a COLLATE specification in either raw form * (represented as a CollateClause with arg==NULL) or cooked form * (the collation's OID). * * The constraints list may contain a CONSTR_DEFAULT item in a raw * parsetree produced by gram.y, but transformCreateStmt will remove * the item and set raw_default instead. CONSTR_DEFAULT items * should not appear in any subsequent processing. */ typedef struct ColumnDef { NodeTag type; char *colname; /* name of column */ TypeName *typeName; /* type of column */ int inhcount; /* number of times column is inherited */ bool is_local; /* column has local (non-inherited) def'n */ bool is_not_null; /* NOT NULL constraint specified? */ bool is_from_type; /* column definition came from table type */ char storage; /* attstorage setting, or 0 for default */ Node *raw_default; /* default value (untransformed parse tree) */ Node *cooked_default; /* default value (transformed expr tree) */ CollateClause *collClause; /* untransformed COLLATE spec, if any */ Oid collOid; /* collation OID (InvalidOid if not set) */ List *constraints; /* other constraints on column */ List *fdwoptions; /* per-column FDW options */ } ColumnDef; /* * TableLikeClause - CREATE TABLE ( ... LIKE ... ) clause */ typedef struct TableLikeClause { NodeTag type; RangeVar *relation; bits32 options; /* OR of TableLikeOption flags */ } TableLikeClause; typedef enum TableLikeOption { CREATE_TABLE_LIKE_DEFAULTS = 1 << 0, CREATE_TABLE_LIKE_CONSTRAINTS = 1 << 1, CREATE_TABLE_LIKE_INDEXES = 1 << 2, CREATE_TABLE_LIKE_STORAGE = 1 << 3, CREATE_TABLE_LIKE_COMMENTS = 1 << 4, CREATE_TABLE_LIKE_ALL = 0x7FFFFFFF } TableLikeOption; /* * IndexElem - index parameters (used in CREATE INDEX) * * For a plain index attribute, 'name' is the name of the table column to * index, and 'expr' is NULL. For an index expression, 'name' is NULL and * 'expr' is the expression tree. */ typedef struct IndexElem { NodeTag type; char *name; /* name of attribute to index, or NULL */ Node *expr; /* expression to index, or NULL */ char *indexcolname; /* name for index column; NULL = default */ List *collation; /* name of collation; NIL = default */ List *opclass; /* name of desired opclass; NIL = default */ SortByDir ordering; /* ASC/DESC/default */ SortByNulls nulls_ordering; /* FIRST/LAST/default */ } IndexElem; /* * DefElem - a generic "name = value" option definition * * In some contexts the name can be qualified. Also, certain SQL commands * allow a SET/ADD/DROP action to be attached to option settings, so it's * convenient to carry a field for that too. (Note: currently, it is our * practice that the grammar allows namespace and action only in statements * where they are relevant; C code can just ignore those fields in other * statements.) */ typedef enum DefElemAction { DEFELEM_UNSPEC, /* no action given */ DEFELEM_SET, DEFELEM_ADD, DEFELEM_DROP } DefElemAction; typedef struct DefElem { NodeTag type; char *defnamespace; /* NULL if unqualified name */ char *defname; Node *arg; /* a (Value *) or a (TypeName *) */ DefElemAction defaction; /* unspecified action, or SET/ADD/DROP */ } DefElem; /* * LockingClause - raw representation of FOR UPDATE/SHARE options * * Note: lockedRels == NIL means "all relations in query". Otherwise it * is a list of RangeVar nodes. (We use RangeVar mainly because it carries * a location field --- currently, parse analysis insists on unqualified * names in LockingClause.) */ typedef struct LockingClause { NodeTag type; List *lockedRels; /* FOR UPDATE or FOR SHARE relations */ bool forUpdate; /* true = FOR UPDATE, false = FOR SHARE */ bool noWait; /* NOWAIT option */ } LockingClause; /* * XMLSERIALIZE (in raw parse tree only) */ typedef struct XmlSerialize { NodeTag type; XmlOptionType xmloption; /* DOCUMENT or CONTENT */ Node *expr; TypeName *typeName; int location; /* token location, or -1 if unknown */ } XmlSerialize; /**************************************************************************** * Nodes for a Query tree ****************************************************************************/ /*-------------------- * RangeTblEntry - * A range table is a List of RangeTblEntry nodes. * * A range table entry may represent a plain relation, a sub-select in * FROM, or the result of a JOIN clause. (Only explicit JOIN syntax * produces an RTE, not the implicit join resulting from multiple FROM * items. This is because we only need the RTE to deal with SQL features * like outer joins and join-output-column aliasing.) Other special * RTE types also exist, as indicated by RTEKind. * * Note that we consider RTE_RELATION to cover anything that has a pg_class * entry. relkind distinguishes the sub-cases. * * alias is an Alias node representing the AS alias-clause attached to the * FROM expression, or NULL if no clause. * * eref is the table reference name and column reference names (either * real or aliases). Note that system columns (OID etc) are not included * in the column list. * eref->aliasname is required to be present, and should generally be used * to identify the RTE for error messages etc. * * In RELATION RTEs, the colnames in both alias and eref are indexed by * physical attribute number; this means there must be colname entries for * dropped columns. When building an RTE we insert empty strings ("") for * dropped columns. Note however that a stored rule may have nonempty * colnames for columns dropped since the rule was created (and for that * matter the colnames might be out of date due to column renamings). * The same comments apply to FUNCTION RTEs when the function's return type * is a named composite type. * * In JOIN RTEs, the colnames in both alias and eref are one-to-one with * joinaliasvars entries. A JOIN RTE will omit columns of its inputs when * those columns are known to be dropped at parse time. Again, however, * a stored rule might contain entries for columns dropped since the rule * was created. (This is only possible for columns not actually referenced * in the rule.) When loading a stored rule, we replace the joinaliasvars * items for any such columns with null pointers. (We can't simply delete * them from the joinaliasvars list, because that would affect the attnums * of Vars referencing the rest of the list.) * * inh is TRUE for relation references that should be expanded to include * inheritance children, if the rel has any. This *must* be FALSE for * RTEs other than RTE_RELATION entries. * * inFromCl marks those range variables that are listed in the FROM clause. * It's false for RTEs that are added to a query behind the scenes, such * as the NEW and OLD variables for a rule, or the subqueries of a UNION. * This flag is not used anymore during parsing, since the parser now uses * a separate "namespace" data structure to control visibility, but it is * needed by ruleutils.c to determine whether RTEs should be shown in * decompiled queries. * * requiredPerms and checkAsUser specify run-time access permissions * checks to be performed at query startup. The user must have *all* * of the permissions that are OR'd together in requiredPerms (zero * indicates no permissions checking). If checkAsUser is not zero, * then do the permissions checks using the access rights of that user, * not the current effective user ID. (This allows rules to act as * setuid gateways.) Permissions checks only apply to RELATION RTEs. * * For SELECT/INSERT/UPDATE permissions, if the user doesn't have * table-wide permissions then it is sufficient to have the permissions * on all columns identified in selectedCols (for SELECT) and/or * modifiedCols (for INSERT/UPDATE; we can tell which from the query type). * selectedCols and modifiedCols are bitmapsets, which cannot have negative * integer members, so we subtract FirstLowInvalidHeapAttributeNumber from * column numbers before storing them in these fields. A whole-row Var * reference is represented by setting the bit for InvalidAttrNumber. *-------------------- */ typedef enum RTEKind { RTE_RELATION, /* ordinary relation reference */ RTE_SUBQUERY, /* subquery in FROM */ RTE_JOIN, /* join */ RTE_FUNCTION, /* function in FROM */ RTE_VALUES, /* VALUES (<exprlist>), (<exprlist>), ... */ RTE_CTE /* common table expr (WITH list element) */ } RTEKind; typedef struct RangeTblEntry { NodeTag type; RTEKind rtekind; /* see above */ /* * XXX the fields applicable to only some rte kinds should be merged into * a union. I didn't do this yet because the diffs would impact a lot of * code that is being actively worked on. FIXME someday. */ /* * Fields valid for a plain relation RTE (else zero): */ Oid relid; /* OID of the relation */ char relkind; /* relation kind (see pg_class.relkind) */ /* * Fields valid for a subquery RTE (else NULL): */ Query *subquery; /* the sub-query */ bool security_barrier; /* subquery from security_barrier view */ /* * Fields valid for a join RTE (else NULL/zero): * * joinaliasvars is a list of (usually) Vars corresponding to the columns * of the join result. An alias Var referencing column K of the join * result can be replaced by the K'th element of joinaliasvars --- but to * simplify the task of reverse-listing aliases correctly, we do not do * that until planning time. In detail: an element of joinaliasvars can * be a Var of one of the join's input relations, or such a Var with an * implicit coercion to the join's output column type, or a COALESCE * expression containing the two input column Vars (possibly coerced). * Within a Query loaded from a stored rule, it is also possible for * joinaliasvars items to be null pointers, which are placeholders for * (necessarily unreferenced) columns dropped since the rule was made. * Also, once planning begins, joinaliasvars items can be almost anything, * as a result of subquery-flattening substitutions. */ JoinType jointype; /* type of join */ List *joinaliasvars; /* list of alias-var expansions */ /* * Fields valid for a function RTE (else NULL): * * If the function returns RECORD, funccoltypes lists the column types * declared in the RTE's column type specification, funccoltypmods lists * their declared typmods, funccolcollations their collations. Otherwise, * those fields are NIL. */ Node *funcexpr; /* expression tree for func call */ List *funccoltypes; /* OID list of column type OIDs */ List *funccoltypmods; /* integer list of column typmods */ List *funccolcollations; /* OID list of column collation OIDs */ /* * Fields valid for a values RTE (else NIL): */ List *values_lists; /* list of expression lists */ List *values_collations; /* OID list of column collation OIDs */ /* * Fields valid for a CTE RTE (else NULL/zero): */ char *ctename; /* name of the WITH list item */ Index ctelevelsup; /* number of query levels up */ bool self_reference; /* is this a recursive self-reference? */ List *ctecoltypes; /* OID list of column type OIDs */ List *ctecoltypmods; /* integer list of column typmods */ List *ctecolcollations; /* OID list of column collation OIDs */ /* * Fields valid in all RTEs: */ Alias *alias; /* user-written alias clause, if any */ Alias *eref; /* expanded reference names */ bool inh; /* inheritance requested? */ bool inFromCl; /* present in FROM clause? */ AclMode requiredPerms; /* bitmask of required access permissions */ Oid checkAsUser; /* if valid, check access as this role */ Bitmapset *selectedCols; /* columns needing SELECT permission */ Bitmapset *modifiedCols; /* columns needing INSERT/UPDATE permission */ } RangeTblEntry; /* * SortGroupClause - * representation of ORDER BY, GROUP BY, PARTITION BY, * DISTINCT, DISTINCT ON items * * You might think that ORDER BY is only interested in defining ordering, * and GROUP/DISTINCT are only interested in defining equality. However, * one way to implement grouping is to sort and then apply a "uniq"-like * filter. So it's also interesting to keep track of possible sort operators * for GROUP/DISTINCT, and in particular to try to sort for the grouping * in a way that will also yield a requested ORDER BY ordering. So we need * to be able to compare ORDER BY and GROUP/DISTINCT lists, which motivates * the decision to give them the same representation. * * tleSortGroupRef must match ressortgroupref of exactly one entry of the * query's targetlist; that is the expression to be sorted or grouped by. * eqop is the OID of the equality operator. * sortop is the OID of the ordering operator (a "<" or ">" operator), * or InvalidOid if not available. * nulls_first means about what you'd expect. If sortop is InvalidOid * then nulls_first is meaningless and should be set to false. * hashable is TRUE if eqop is hashable (note this condition also depends * on the datatype of the input expression). * * In an ORDER BY item, all fields must be valid. (The eqop isn't essential * here, but it's cheap to get it along with the sortop, and requiring it * to be valid eases comparisons to grouping items.) Note that this isn't * actually enough information to determine an ordering: if the sortop is * collation-sensitive, a collation OID is needed too. We don't store the * collation in SortGroupClause because it's not available at the time the * parser builds the SortGroupClause; instead, consult the exposed collation * of the referenced targetlist expression to find out what it is. * * In a grouping item, eqop must be valid. If the eqop is a btree equality * operator, then sortop should be set to a compatible ordering operator. * We prefer to set eqop/sortop/nulls_first to match any ORDER BY item that * the query presents for the same tlist item. If there is none, we just * use the default ordering op for the datatype. * * If the tlist item's type has a hash opclass but no btree opclass, then * we will set eqop to the hash equality operator, sortop to InvalidOid, * and nulls_first to false. A grouping item of this kind can only be * implemented by hashing, and of course it'll never match an ORDER BY item. * * The hashable flag is provided since we generally have the requisite * information readily available when the SortGroupClause is constructed, * and it's relatively expensive to get it again later. Note there is no * need for a "sortable" flag since OidIsValid(sortop) serves the purpose. * * A query might have both ORDER BY and DISTINCT (or DISTINCT ON) clauses. * In SELECT DISTINCT, the distinctClause list is as long or longer than the * sortClause list, while in SELECT DISTINCT ON it's typically shorter. * The two lists must match up to the end of the shorter one --- the parser * rearranges the distinctClause if necessary to make this true. (This * restriction ensures that only one sort step is needed to both satisfy the * ORDER BY and set up for the Unique step. This is semantically necessary * for DISTINCT ON, and presents no real drawback for DISTINCT.) */ typedef struct SortGroupClause { NodeTag type; Index tleSortGroupRef; /* reference into targetlist */ Oid eqop; /* the equality operator ('=' op) */ Oid sortop; /* the ordering operator ('<' op), or 0 */ bool nulls_first; /* do NULLs come before normal values? */ bool hashable; /* can eqop be implemented by hashing? */ } SortGroupClause; /* * WindowClause - * transformed representation of WINDOW and OVER clauses * * A parsed Query's windowClause list contains these structs. "name" is set * if the clause originally came from WINDOW, and is NULL if it originally * was an OVER clause (but note that we collapse out duplicate OVERs). * partitionClause and orderClause are lists of SortGroupClause structs. * winref is an ID number referenced by WindowFunc nodes; it must be unique * among the members of a Query's windowClause list. * When refname isn't null, the partitionClause is always copied from there; * the orderClause might or might not be copied (see copiedOrder); the framing * options are never copied, per spec. */ typedef struct WindowClause { NodeTag type; char *name; /* window name (NULL in an OVER clause) */ char *refname; /* referenced window name, if any */ List *partitionClause; /* PARTITION BY list */ List *orderClause; /* ORDER BY list */ int frameOptions; /* frame_clause options, see WindowDef */ Node *startOffset; /* expression for starting bound, if any */ Node *endOffset; /* expression for ending bound, if any */ Index winref; /* ID referenced by window functions */ bool copiedOrder; /* did we copy orderClause from refname? */ } WindowClause; /* * RowMarkClause - * parser output representation of FOR UPDATE/SHARE clauses * * Query.rowMarks contains a separate RowMarkClause node for each relation * identified as a FOR UPDATE/SHARE target. If FOR UPDATE/SHARE is applied * to a subquery, we generate RowMarkClauses for all normal and subquery rels * in the subquery, but they are marked pushedDown = true to distinguish them * from clauses that were explicitly written at this query level. Also, * Query.hasForUpdate tells whether there were explicit FOR UPDATE/SHARE * clauses in the current query level. */ typedef struct RowMarkClause { NodeTag type; Index rti; /* range table index of target relation */ bool forUpdate; /* true = FOR UPDATE, false = FOR SHARE */ bool noWait; /* NOWAIT option */ bool pushedDown; /* pushed down from higher query level? */ } RowMarkClause; /* * WithClause - * representation of WITH clause * * Note: WithClause does not propagate into the Query representation; * but CommonTableExpr does. */ typedef struct WithClause { NodeTag type; List *ctes; /* list of CommonTableExprs */ bool recursive; /* true = WITH RECURSIVE */ int location; /* token location, or -1 if unknown */ } WithClause; /* * CommonTableExpr - * representation of WITH list element * * We don't currently support the SEARCH or CYCLE clause. */ typedef struct CommonTableExpr { NodeTag type; char *ctename; /* query name (never qualified) */ List *aliascolnames; /* optional list of column names */ /* SelectStmt/InsertStmt/etc before parse analysis, Query afterwards: */ Node *ctequery; /* the CTE's subquery */ int location; /* token location, or -1 if unknown */ /* These fields are set during parse analysis: */ bool cterecursive; /* is this CTE actually recursive? */ int cterefcount; /* number of RTEs referencing this CTE * (excluding internal self-references) */ List *ctecolnames; /* list of output column names */ List *ctecoltypes; /* OID list of output column type OIDs */ List *ctecoltypmods; /* integer list of output column typmods */ List *ctecolcollations; /* OID list of column collation OIDs */ } CommonTableExpr; /* Convenience macro to get the output tlist of a CTE's query */ #define GetCTETargetList(cte) \ (AssertMacro(IsA((cte)->ctequery, Query)), \ ((Query *) (cte)->ctequery)->commandType == CMD_SELECT ? \ ((Query *) (cte)->ctequery)->targetList : \ ((Query *) (cte)->ctequery)->returningList) /***************************************************************************** * Optimizable Statements *****************************************************************************/ /* ---------------------- * Insert Statement * * The source expression is represented by SelectStmt for both the * SELECT and VALUES cases. If selectStmt is NULL, then the query * is INSERT ... DEFAULT VALUES. * ---------------------- */ typedef struct InsertStmt { NodeTag type; RangeVar *relation; /* relation to insert into */ List *cols; /* optional: names of the target columns */ Node *selectStmt; /* the source SELECT/VALUES, or NULL */ List *returningList; /* list of expressions to return */ WithClause *withClause; /* WITH clause */ } InsertStmt; /* ---------------------- * Delete Statement * ---------------------- */ typedef struct DeleteStmt { NodeTag type; RangeVar *relation; /* relation to delete from */ List *usingClause; /* optional using clause for more tables */ Node *whereClause; /* qualifications */ List *returningList; /* list of expressions to return */ WithClause *withClause; /* WITH clause */ } DeleteStmt; /* ---------------------- * Update Statement * ---------------------- */ typedef struct UpdateStmt { NodeTag type; RangeVar *relation; /* relation to update */ List *targetList; /* the target list (of ResTarget) */ Node *whereClause; /* qualifications */ List *fromClause; /* optional from clause for more tables */ List *returningList; /* list of expressions to return */ WithClause *withClause; /* WITH clause */ } UpdateStmt; /* ---------------------- * Select Statement * * A "simple" SELECT is represented in the output of gram.y by a single * SelectStmt node; so is a VALUES construct. A query containing set * operators (UNION, INTERSECT, EXCEPT) is represented by a tree of SelectStmt * nodes, in which the leaf nodes are component SELECTs and the internal nodes * represent UNION, INTERSECT, or EXCEPT operators. Using the same node * type for both leaf and internal nodes allows gram.y to stick ORDER BY, * LIMIT, etc, clause values into a SELECT statement without worrying * whether it is a simple or compound SELECT. * ---------------------- */ typedef enum SetOperation { SETOP_NONE = 0, SETOP_UNION, SETOP_INTERSECT, SETOP_EXCEPT } SetOperation; typedef struct SelectStmt { NodeTag type; /* * These fields are used only in "leaf" SelectStmts. */ List *distinctClause; /* NULL, list of DISTINCT ON exprs, or * lcons(NIL,NIL) for all (SELECT DISTINCT) */ IntoClause *intoClause; /* target for SELECT INTO */ List *targetList; /* the target list (of ResTarget) */ List *fromClause; /* the FROM clause */ Node *whereClause; /* WHERE qualification */ List *groupClause; /* GROUP BY clauses */ Node *havingClause; /* HAVING conditional-expression */ List *windowClause; /* WINDOW window_name AS (...), ... */ WithClause *withClause; /* WITH clause */ /* * In a "leaf" node representing a VALUES list, the above fields are all * null, and instead this field is set. Note that the elements of the * sublists are just expressions, without ResTarget decoration. Also note * that a list element can be DEFAULT (represented as a SetToDefault * node), regardless of the context of the VALUES list. It's up to parse * analysis to reject that where not valid. */ List *valuesLists; /* untransformed list of expression lists */ /* * These fields are used in both "leaf" SelectStmts and upper-level * SelectStmts. */ List *sortClause; /* sort clause (a list of SortBy's) */ Node *limitOffset; /* # of result tuples to skip */ Node *limitCount; /* # of result tuples to return */ List *lockingClause; /* FOR UPDATE (list of LockingClause's) */ /* * These fields are used only in upper-level SelectStmts. */ SetOperation op; /* type of set op */ bool all; /* ALL specified? */ struct SelectStmt *larg; /* left child */ struct SelectStmt *rarg; /* right child */ /* Eventually add fields for CORRESPONDING spec here */ } SelectStmt; /* ---------------------- * Set Operation node for post-analysis query trees * * After parse analysis, a SELECT with set operations is represented by a * top-level Query node containing the leaf SELECTs as subqueries in its * range table. Its setOperations field shows the tree of set operations, * with leaf SelectStmt nodes replaced by RangeTblRef nodes, and internal * nodes replaced by SetOperationStmt nodes. Information about the output * column types is added, too. (Note that the child nodes do not necessarily * produce these types directly, but we've checked that their output types * can be coerced to the output column type.) Also, if it's not UNION ALL, * information about the types' sort/group semantics is provided in the form * of a SortGroupClause list (same representation as, eg, DISTINCT). * The resolved common column collations are provided too; but note that if * it's not UNION ALL, it's okay for a column to not have a common collation, * so a member of the colCollations list could be InvalidOid even though the * column has a collatable type. * ---------------------- */ typedef struct SetOperationStmt { NodeTag type; SetOperation op; /* type of set op */ bool all; /* ALL specified? */ Node *larg; /* left child */ Node *rarg; /* right child */ /* Eventually add fields for CORRESPONDING spec here */ /* Fields derived during parse analysis: */ List *colTypes; /* OID list of output column type OIDs */ List *colTypmods; /* integer list of output column typmods */ List *colCollations; /* OID list of output column collation OIDs */ List *groupClauses; /* a list of SortGroupClause's */ /* groupClauses is NIL if UNION ALL, but must be set otherwise */ } SetOperationStmt; /***************************************************************************** * Other Statements (no optimizations required) * * These are not touched by parser/analyze.c except to put them into * the utilityStmt field of a Query. This is eventually passed to * ProcessUtility (by-passing rewriting and planning). Some of the * statements do need attention from parse analysis, and this is * done by routines in parser/parse_utilcmd.c after ProcessUtility * receives the command for execution. *****************************************************************************/ /* * When a command can act on several kinds of objects with only one * parse structure required, use these constants to designate the * object type. Note that commands typically don't support all the types. */ typedef enum ObjectType { OBJECT_AGGREGATE, OBJECT_ATTRIBUTE, /* type's attribute, when distinct from column */ OBJECT_CAST, OBJECT_COLUMN, OBJECT_CONSTRAINT, OBJECT_COLLATION, OBJECT_CONVERSION, OBJECT_DATABASE, OBJECT_DOMAIN, OBJECT_EXTENSION, OBJECT_FDW, OBJECT_FOREIGN_SERVER, OBJECT_FOREIGN_TABLE, OBJECT_FUNCTION, OBJECT_INDEX, OBJECT_LANGUAGE, OBJECT_LARGEOBJECT, OBJECT_OPCLASS, OBJECT_OPERATOR, OBJECT_OPFAMILY, OBJECT_ROLE, OBJECT_RULE, OBJECT_SCHEMA, OBJECT_SEQUENCE, OBJECT_TABLE, OBJECT_TABLESPACE, OBJECT_TRIGGER, OBJECT_TSCONFIGURATION, OBJECT_TSDICTIONARY, OBJECT_TSPARSER, OBJECT_TSTEMPLATE, OBJECT_TYPE, OBJECT_VIEW } ObjectType; /* ---------------------- * Create Schema Statement * * NOTE: the schemaElts list contains raw parsetrees for component statements * of the schema, such as CREATE TABLE, GRANT, etc. These are analyzed and * executed after the schema itself is created. * ---------------------- */ typedef struct CreateSchemaStmt { NodeTag type; char *schemaname; /* the name of the schema to create */ char *authid; /* the owner of the created schema */ List *schemaElts; /* schema components (list of parsenodes) */ } CreateSchemaStmt; typedef enum DropBehavior { DROP_RESTRICT, /* drop fails if any dependent objects */ DROP_CASCADE /* remove dependent objects too */ } DropBehavior; /* ---------------------- * Alter Table * ---------------------- */ typedef struct AlterTableStmt { NodeTag type; RangeVar *relation; /* table to work on */ List *cmds; /* list of subcommands */ ObjectType relkind; /* type of object */ bool missing_ok; /* skip error if table missing */ } AlterTableStmt; typedef enum AlterTableType { AT_AddColumn, /* add column */ AT_AddColumnRecurse, /* internal to commands/tablecmds.c */ AT_AddColumnToView, /* implicitly via CREATE OR REPLACE VIEW */ AT_ColumnDefault, /* alter column default */ AT_DropNotNull, /* alter column drop not null */ AT_SetNotNull, /* alter column set not null */ AT_SetStatistics, /* alter column set statistics */ AT_SetOptions, /* alter column set ( options ) */ AT_ResetOptions, /* alter column reset ( options ) */ AT_SetStorage, /* alter column set storage */ AT_DropColumn, /* drop column */ AT_DropColumnRecurse, /* internal to commands/tablecmds.c */ AT_AddIndex, /* add index */ AT_ReAddIndex, /* internal to commands/tablecmds.c */ AT_AddConstraint, /* add constraint */ AT_AddConstraintRecurse, /* internal to commands/tablecmds.c */ AT_ValidateConstraint, /* validate constraint */ AT_ValidateConstraintRecurse, /* internal to commands/tablecmds.c */ AT_ProcessedConstraint, /* pre-processed add constraint (local in * parser/parse_utilcmd.c) */ AT_AddIndexConstraint, /* add constraint using existing index */ AT_DropConstraint, /* drop constraint */ AT_DropConstraintRecurse, /* internal to commands/tablecmds.c */ AT_AlterColumnType, /* alter column type */ AT_AlterColumnGenericOptions, /* alter column OPTIONS (...) */ AT_ChangeOwner, /* change owner */ AT_ClusterOn, /* CLUSTER ON */ AT_DropCluster, /* SET WITHOUT CLUSTER */ AT_AddOids, /* SET WITH OIDS */ AT_AddOidsRecurse, /* internal to commands/tablecmds.c */ AT_DropOids, /* SET WITHOUT OIDS */ AT_SetTableSpace, /* SET TABLESPACE */ AT_SetRelOptions, /* SET (...) -- AM specific parameters */ AT_ResetRelOptions, /* RESET (...) -- AM specific parameters */ AT_ReplaceRelOptions, /* replace reloption list in its entirety */ AT_EnableTrig, /* ENABLE TRIGGER name */ AT_EnableAlwaysTrig, /* ENABLE ALWAYS TRIGGER name */ AT_EnableReplicaTrig, /* ENABLE REPLICA TRIGGER name */ AT_DisableTrig, /* DISABLE TRIGGER name */ AT_EnableTrigAll, /* ENABLE TRIGGER ALL */ AT_DisableTrigAll, /* DISABLE TRIGGER ALL */ AT_EnableTrigUser, /* ENABLE TRIGGER USER */ AT_DisableTrigUser, /* DISABLE TRIGGER USER */ AT_EnableRule, /* ENABLE RULE name */ AT_EnableAlwaysRule, /* ENABLE ALWAYS RULE name */ AT_EnableReplicaRule, /* ENABLE REPLICA RULE name */ AT_DisableRule, /* DISABLE RULE name */ AT_AddInherit, /* INHERIT parent */ AT_DropInherit, /* NO INHERIT parent */ AT_AddOf, /* OF <type_name> */ AT_DropOf, /* NOT OF */ AT_GenericOptions, /* OPTIONS (...) */ /* this will be in a more natural position in 9.3: */ AT_ReAddConstraint /* internal to commands/tablecmds.c */ } AlterTableType; typedef struct AlterTableCmd /* one subcommand of an ALTER TABLE */ { NodeTag type; AlterTableType subtype; /* Type of table alteration to apply */ char *name; /* column, constraint, or trigger to act on, * or new owner or tablespace */ Node *def; /* definition of new column, index, * constraint, or parent table */ DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */ bool missing_ok; /* skip error if missing? */ } AlterTableCmd; /* ---------------------- * Alter Domain * * The fields are used in different ways by the different variants of * this command. * ---------------------- */ typedef struct AlterDomainStmt { NodeTag type; char subtype; /*------------ * T = alter column default * N = alter column drop not null * O = alter column set not null * C = add constraint * X = drop constraint *------------ */ List *typeName; /* domain to work on */ char *name; /* column or constraint name to act on */ Node *def; /* definition of default or constraint */ DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */ bool missing_ok; /* skip error if missing? */ } AlterDomainStmt; /* ---------------------- * Grant|Revoke Statement * ---------------------- */ typedef enum GrantTargetType { ACL_TARGET_OBJECT, /* grant on specific named object(s) */ ACL_TARGET_ALL_IN_SCHEMA, /* grant on all objects in given schema(s) */ ACL_TARGET_DEFAULTS /* ALTER DEFAULT PRIVILEGES */ } GrantTargetType; typedef enum GrantObjectType { ACL_OBJECT_COLUMN, /* column */ ACL_OBJECT_RELATION, /* table, view */ ACL_OBJECT_SEQUENCE, /* sequence */ ACL_OBJECT_DATABASE, /* database */ ACL_OBJECT_DOMAIN, /* domain */ ACL_OBJECT_FDW, /* foreign-data wrapper */ ACL_OBJECT_FOREIGN_SERVER, /* foreign server */ ACL_OBJECT_FUNCTION, /* function */ ACL_OBJECT_LANGUAGE, /* procedural language */ ACL_OBJECT_LARGEOBJECT, /* largeobject */ ACL_OBJECT_NAMESPACE, /* namespace */ ACL_OBJECT_TABLESPACE, /* tablespace */ ACL_OBJECT_TYPE /* type */ } GrantObjectType; typedef struct GrantStmt { NodeTag type; bool is_grant; /* true = GRANT, false = REVOKE */ GrantTargetType targtype; /* type of the grant target */ GrantObjectType objtype; /* kind of object being operated on */ List *objects; /* list of RangeVar nodes, FuncWithArgs nodes, * or plain names (as Value strings) */ List *privileges; /* list of AccessPriv nodes */ /* privileges == NIL denotes ALL PRIVILEGES */ List *grantees; /* list of PrivGrantee nodes */ bool grant_option; /* grant or revoke grant option */ DropBehavior behavior; /* drop behavior (for REVOKE) */ } GrantStmt; typedef struct PrivGrantee { NodeTag type; char *rolname; /* if NULL then PUBLIC */ } PrivGrantee; /* * Note: FuncWithArgs carries only the types of the input parameters of the * function. So it is sufficient to identify an existing function, but it * is not enough info to define a function nor to call it. */ typedef struct FuncWithArgs { NodeTag type; List *funcname; /* qualified name of function */ List *funcargs; /* list of Typename nodes */ } FuncWithArgs; /* * An access privilege, with optional list of column names * priv_name == NULL denotes ALL PRIVILEGES (only used with a column list) * cols == NIL denotes "all columns" * Note that simple "ALL PRIVILEGES" is represented as a NIL list, not * an AccessPriv with both fields null. */ typedef struct AccessPriv { NodeTag type; char *priv_name; /* string name of privilege */ List *cols; /* list of Value strings */ } AccessPriv; /* ---------------------- * Grant/Revoke Role Statement * * Note: because of the parsing ambiguity with the GRANT <privileges> * statement, granted_roles is a list of AccessPriv; the execution code * should complain if any column lists appear. grantee_roles is a list * of role names, as Value strings. * ---------------------- */ typedef struct GrantRoleStmt { NodeTag type; List *granted_roles; /* list of roles to be granted/revoked */ List *grantee_roles; /* list of member roles to add/delete */ bool is_grant; /* true = GRANT, false = REVOKE */ bool admin_opt; /* with admin option */ char *grantor; /* set grantor to other than current role */ DropBehavior behavior; /* drop behavior (for REVOKE) */ } GrantRoleStmt; /* ---------------------- * Alter Default Privileges Statement * ---------------------- */ typedef struct AlterDefaultPrivilegesStmt { NodeTag type; List *options; /* list of DefElem */ GrantStmt *action; /* GRANT/REVOKE action (with objects=NIL) */ } AlterDefaultPrivilegesStmt; /* ---------------------- * Copy Statement * * We support "COPY relation FROM file", "COPY relation TO file", and * "COPY (query) TO file". In any given CopyStmt, exactly one of "relation" * and "query" must be non-NULL. * ---------------------- */ typedef struct CopyStmt { NodeTag type; RangeVar *relation; /* the relation to copy */ Node *query; /* the SELECT query to copy */ List *attlist; /* List of column names (as Strings), or NIL * for all columns */ bool is_from; /* TO or FROM */ char *filename; /* filename, or NULL for STDIN/STDOUT */ List *options; /* List of DefElem nodes */ } CopyStmt; /* ---------------------- * SET Statement (includes RESET) * * "SET var TO DEFAULT" and "RESET var" are semantically equivalent, but we * preserve the distinction in VariableSetKind for CreateCommandTag(). * ---------------------- */ typedef enum { VAR_SET_VALUE, /* SET var = value */ VAR_SET_DEFAULT, /* SET var TO DEFAULT */ VAR_SET_CURRENT, /* SET var FROM CURRENT */ VAR_SET_MULTI, /* special case for SET TRANSACTION ... */ VAR_RESET, /* RESET var */ VAR_RESET_ALL /* RESET ALL */ } VariableSetKind; typedef struct VariableSetStmt { NodeTag type; VariableSetKind kind; char *name; /* variable to be set */ List *args; /* List of A_Const nodes */ bool is_local; /* SET LOCAL? */ } VariableSetStmt; /* ---------------------- * Show Statement * ---------------------- */ typedef struct VariableShowStmt { NodeTag type; char *name; } VariableShowStmt; /* ---------------------- * Create Table Statement * * NOTE: in the raw gram.y output, ColumnDef and Constraint nodes are * intermixed in tableElts, and constraints is NIL. After parse analysis, * tableElts contains just ColumnDefs, and constraints contains just * Constraint nodes (in fact, only CONSTR_CHECK nodes, in the present * implementation). * ---------------------- */ typedef struct CreateStmt { NodeTag type; RangeVar *relation; /* relation to create */ List *tableElts; /* column definitions (list of ColumnDef) */ List *inhRelations; /* relations to inherit from (list of * inhRelation) */ TypeName *ofTypename; /* OF typename */ List *constraints; /* constraints (list of Constraint nodes) */ List *options; /* options from WITH clause */ OnCommitAction oncommit; /* what do we do at COMMIT? */ char *tablespacename; /* table space to use, or NULL */ bool if_not_exists; /* just do nothing if it already exists? */ } CreateStmt; /* ---------- * Definitions for constraints in CreateStmt * * Note that column defaults are treated as a type of constraint, * even though that's a bit odd semantically. * * For constraints that use expressions (CONSTR_CHECK, CONSTR_DEFAULT) * we may have the expression in either "raw" form (an untransformed * parse tree) or "cooked" form (the nodeToString representation of * an executable expression tree), depending on how this Constraint * node was created (by parsing, or by inheritance from an existing * relation). We should never have both in the same node! * * FKCONSTR_ACTION_xxx values are stored into pg_constraint.confupdtype * and pg_constraint.confdeltype columns; FKCONSTR_MATCH_xxx values are * stored into pg_constraint.confmatchtype. Changing the code values may * require an initdb! * * If skip_validation is true then we skip checking that the existing rows * in the table satisfy the constraint, and just install the catalog entries * for the constraint. A new FK constraint is marked as valid iff * initially_valid is true. (Usually skip_validation and initially_valid * are inverses, but we can set both true if the table is known empty.) * * Constraint attributes (DEFERRABLE etc) are initially represented as * separate Constraint nodes for simplicity of parsing. parse_utilcmd.c makes * a pass through the constraints list to insert the info into the appropriate * Constraint node. * ---------- */ typedef enum ConstrType /* types of constraints */ { CONSTR_NULL, /* not SQL92, but a lot of people expect it */ CONSTR_NOTNULL, CONSTR_DEFAULT, CONSTR_CHECK, CONSTR_PRIMARY, CONSTR_UNIQUE, CONSTR_EXCLUSION, CONSTR_FOREIGN, CONSTR_ATTR_DEFERRABLE, /* attributes for previous constraint node */ CONSTR_ATTR_NOT_DEFERRABLE, CONSTR_ATTR_DEFERRED, CONSTR_ATTR_IMMEDIATE } ConstrType; /* Foreign key action codes */ #define FKCONSTR_ACTION_NOACTION 'a' #define FKCONSTR_ACTION_RESTRICT 'r' #define FKCONSTR_ACTION_CASCADE 'c' #define FKCONSTR_ACTION_SETNULL 'n' #define FKCONSTR_ACTION_SETDEFAULT 'd' /* Foreign key matchtype codes */ #define FKCONSTR_MATCH_FULL 'f' #define FKCONSTR_MATCH_PARTIAL 'p' #define FKCONSTR_MATCH_UNSPECIFIED 'u' typedef struct Constraint { NodeTag type; ConstrType contype; /* see above */ /* Fields used for most/all constraint types: */ char *conname; /* Constraint name, or NULL if unnamed */ bool deferrable; /* DEFERRABLE? */ bool initdeferred; /* INITIALLY DEFERRED? */ int location; /* token location, or -1 if unknown */ /* Fields used for constraints with expressions (CHECK and DEFAULT): */ bool is_no_inherit; /* is constraint non-inheritable? */ Node *raw_expr; /* expr, as untransformed parse tree */ char *cooked_expr; /* expr, as nodeToString representation */ /* Fields used for unique constraints (UNIQUE and PRIMARY KEY): */ List *keys; /* String nodes naming referenced column(s) */ /* Fields used for EXCLUSION constraints: */ List *exclusions; /* list of (IndexElem, operator name) pairs */ /* Fields used for index constraints (UNIQUE, PRIMARY KEY, EXCLUSION): */ List *options; /* options from WITH clause */ char *indexname; /* existing index to use; otherwise NULL */ char *indexspace; /* index tablespace; NULL for default */ /* These could be, but currently are not, used for UNIQUE/PKEY: */ char *access_method; /* index access method; NULL for default */ Node *where_clause; /* partial index predicate */ /* Fields used for FOREIGN KEY constraints: */ RangeVar *pktable; /* Primary key table */ List *fk_attrs; /* Attributes of foreign key */ List *pk_attrs; /* Corresponding attrs in PK table */ char fk_matchtype; /* FULL, PARTIAL, UNSPECIFIED */ char fk_upd_action; /* ON UPDATE action */ char fk_del_action; /* ON DELETE action */ List *old_conpfeqop; /* pg_constraint.conpfeqop of my former self */ /* Fields used for constraints that allow a NOT VALID specification */ bool skip_validation; /* skip validation of existing rows? */ bool initially_valid; /* mark the new constraint as valid? */ Oid old_pktable_oid; /* pg_constraint.confrelid of my former self */ } Constraint; /* ---------------------- * Create/Drop Table Space Statements * ---------------------- */ typedef struct CreateTableSpaceStmt { NodeTag type; char *tablespacename; char *owner; char *location; } CreateTableSpaceStmt; typedef struct DropTableSpaceStmt { NodeTag type; char *tablespacename; bool missing_ok; /* skip error if missing? */ } DropTableSpaceStmt; typedef struct AlterTableSpaceOptionsStmt { NodeTag type; char *tablespacename; List *options; bool isReset; } AlterTableSpaceOptionsStmt; /* ---------------------- * Create/Alter Extension Statements * ---------------------- */ typedef struct CreateExtensionStmt { NodeTag type; char *extname; bool if_not_exists; /* just do nothing if it already exists? */ List *options; /* List of DefElem nodes */ } CreateExtensionStmt; /* Only used for ALTER EXTENSION UPDATE; later might need an action field */ typedef struct AlterExtensionStmt { NodeTag type; char *extname; List *options; /* List of DefElem nodes */ } AlterExtensionStmt; typedef struct AlterExtensionContentsStmt { NodeTag type; char *extname; /* Extension's name */ int action; /* +1 = add object, -1 = drop object */ ObjectType objtype; /* Object's type */ List *objname; /* Qualified name of the object */ List *objargs; /* Arguments if needed (eg, for functions) */ } AlterExtensionContentsStmt; /* ---------------------- * Create/Alter FOREIGN DATA WRAPPER Statements * ---------------------- */ typedef struct CreateFdwStmt { NodeTag type; char *fdwname; /* foreign-data wrapper name */ List *func_options; /* HANDLER/VALIDATOR options */ List *options; /* generic options to FDW */ } CreateFdwStmt; typedef struct AlterFdwStmt { NodeTag type; char *fdwname; /* foreign-data wrapper name */ List *func_options; /* HANDLER/VALIDATOR options */ List *options; /* generic options to FDW */ } AlterFdwStmt; /* ---------------------- * Create/Alter FOREIGN SERVER Statements * ---------------------- */ typedef struct CreateForeignServerStmt { NodeTag type; char *servername; /* server name */ char *servertype; /* optional server type */ char *version; /* optional server version */ char *fdwname; /* FDW name */ List *options; /* generic options to server */ } CreateForeignServerStmt; typedef struct AlterForeignServerStmt { NodeTag type; char *servername; /* server name */ char *version; /* optional server version */ List *options; /* generic options to server */ bool has_version; /* version specified */ } AlterForeignServerStmt; /* ---------------------- * Create FOREIGN TABLE Statements * ---------------------- */ typedef struct CreateForeignTableStmt { CreateStmt base; char *servername; List *options; } CreateForeignTableStmt; /* ---------------------- * Create/Drop USER MAPPING Statements * ---------------------- */ typedef struct CreateUserMappingStmt { NodeTag type; char *username; /* username or PUBLIC/CURRENT_USER */ char *servername; /* server name */ List *options; /* generic options to server */ } CreateUserMappingStmt; typedef struct AlterUserMappingStmt { NodeTag type; char *username; /* username or PUBLIC/CURRENT_USER */ char *servername; /* server name */ List *options; /* generic options to server */ } AlterUserMappingStmt; typedef struct DropUserMappingStmt { NodeTag type; char *username; /* username or PUBLIC/CURRENT_USER */ char *servername; /* server name */ bool missing_ok; /* ignore missing mappings */ } DropUserMappingStmt; /* ---------------------- * Create TRIGGER Statement * ---------------------- */ typedef struct CreateTrigStmt { NodeTag type; char *trigname; /* TRIGGER's name */ RangeVar *relation; /* relation trigger is on */ List *funcname; /* qual. name of function to call */ List *args; /* list of (T_String) Values or NIL */ bool row; /* ROW/STATEMENT */ /* timing uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */ int16 timing; /* BEFORE, AFTER, or INSTEAD */ /* events uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */ int16 events; /* "OR" of INSERT/UPDATE/DELETE/TRUNCATE */ List *columns; /* column names, or NIL for all columns */ Node *whenClause; /* qual expression, or NULL if none */ bool isconstraint; /* This is a constraint trigger */ /* The remaining fields are only used for constraint triggers */ bool deferrable; /* [NOT] DEFERRABLE */ bool initdeferred; /* INITIALLY {DEFERRED|IMMEDIATE} */ RangeVar *constrrel; /* opposite relation, if RI trigger */ } CreateTrigStmt; /* ---------------------- * Create PROCEDURAL LANGUAGE Statements * ---------------------- */ typedef struct CreatePLangStmt { NodeTag type; bool replace; /* T => replace if already exists */ char *plname; /* PL name */ List *plhandler; /* PL call handler function (qual. name) */ List *plinline; /* optional inline function (qual. name) */ List *plvalidator; /* optional validator function (qual. name) */ bool pltrusted; /* PL is trusted */ } CreatePLangStmt; /* ---------------------- * Create/Alter/Drop Role Statements * * Note: these node types are also used for the backwards-compatible * Create/Alter/Drop User/Group statements. In the ALTER and DROP cases * there's really no need to distinguish what the original spelling was, * but for CREATE we mark the type because the defaults vary. * ---------------------- */ typedef enum RoleStmtType { ROLESTMT_ROLE, ROLESTMT_USER, ROLESTMT_GROUP } RoleStmtType; typedef struct CreateRoleStmt { NodeTag type; RoleStmtType stmt_type; /* ROLE/USER/GROUP */ char *role; /* role name */ List *options; /* List of DefElem nodes */ } CreateRoleStmt; typedef struct AlterRoleStmt { NodeTag type; char *role; /* role name */ List *options; /* List of DefElem nodes */ int action; /* +1 = add members, -1 = drop members */ } AlterRoleStmt; typedef struct AlterRoleSetStmt { NodeTag type; char *role; /* role name */ char *database; /* database name, or NULL */ VariableSetStmt *setstmt; /* SET or RESET subcommand */ } AlterRoleSetStmt; typedef struct DropRoleStmt { NodeTag type; List *roles; /* List of roles to remove */ bool missing_ok; /* skip error if a role is missing? */ } DropRoleStmt; /* ---------------------- * {Create|Alter} SEQUENCE Statement * ---------------------- */ typedef struct CreateSeqStmt { NodeTag type; RangeVar *sequence; /* the sequence to create */ List *options; Oid ownerId; /* ID of owner, or InvalidOid for default */ } CreateSeqStmt; typedef struct AlterSeqStmt { NodeTag type; RangeVar *sequence; /* the sequence to alter */ List *options; bool missing_ok; /* skip error if a role is missing? */ } AlterSeqStmt; /* ---------------------- * Create {Aggregate|Operator|Type} Statement * ---------------------- */ typedef struct DefineStmt { NodeTag type; ObjectType kind; /* aggregate, operator, type */ bool oldstyle; /* hack to signal old CREATE AGG syntax */ List *defnames; /* qualified name (list of Value strings) */ List *args; /* a list of TypeName (if needed) */ List *definition; /* a list of DefElem */ } DefineStmt; /* ---------------------- * Create Domain Statement * ---------------------- */ typedef struct CreateDomainStmt { NodeTag type; List *domainname; /* qualified name (list of Value strings) */ TypeName *typeName; /* the base type */ CollateClause *collClause; /* untransformed COLLATE spec, if any */ List *constraints; /* constraints (list of Constraint nodes) */ } CreateDomainStmt; /* ---------------------- * Create Operator Class Statement * ---------------------- */ typedef struct CreateOpClassStmt { NodeTag type; List *opclassname; /* qualified name (list of Value strings) */ List *opfamilyname; /* qualified name (ditto); NIL if omitted */ char *amname; /* name of index AM opclass is for */ TypeName *datatype; /* datatype of indexed column */ List *items; /* List of CreateOpClassItem nodes */ bool isDefault; /* Should be marked as default for type? */ } CreateOpClassStmt; #define OPCLASS_ITEM_OPERATOR 1 #define OPCLASS_ITEM_FUNCTION 2 #define OPCLASS_ITEM_STORAGETYPE 3 typedef struct CreateOpClassItem { NodeTag type; int itemtype; /* see codes above */ /* fields used for an operator or function item: */ List *name; /* operator or function name */ List *args; /* argument types */ int number; /* strategy num or support proc num */ List *order_family; /* only used for ordering operators */ List *class_args; /* only used for functions */ /* fields used for a storagetype item: */ TypeName *storedtype; /* datatype stored in index */ } CreateOpClassItem; /* ---------------------- * Create Operator Family Statement * ---------------------- */ typedef struct CreateOpFamilyStmt { NodeTag type; List *opfamilyname; /* qualified name (list of Value strings) */ char *amname; /* name of index AM opfamily is for */ } CreateOpFamilyStmt; /* ---------------------- * Alter Operator Family Statement * ---------------------- */ typedef struct AlterOpFamilyStmt { NodeTag type; List *opfamilyname; /* qualified name (list of Value strings) */ char *amname; /* name of index AM opfamily is for */ bool isDrop; /* ADD or DROP the items? */ List *items; /* List of CreateOpClassItem nodes */ } AlterOpFamilyStmt; /* ---------------------- * Drop Table|Sequence|View|Index|Type|Domain|Conversion|Schema Statement * ---------------------- */ typedef struct DropStmt { NodeTag type; List *objects; /* list of sublists of names (as Values) */ List *arguments; /* list of sublists of arguments (as Values) */ ObjectType removeType; /* object type */ DropBehavior behavior; /* RESTRICT or CASCADE behavior */ bool missing_ok; /* skip error if object is missing? */ bool concurrent; /* drop index concurrently? */ } DropStmt; /* ---------------------- * Truncate Table Statement * ---------------------- */ typedef struct TruncateStmt { NodeTag type; List *relations; /* relations (RangeVars) to be truncated */ bool restart_seqs; /* restart owned sequences? */ DropBehavior behavior; /* RESTRICT or CASCADE behavior */ } TruncateStmt; /* ---------------------- * Comment On Statement * ---------------------- */ typedef struct CommentStmt { NodeTag type; ObjectType objtype; /* Object's type */ List *objname; /* Qualified name of the object */ List *objargs; /* Arguments if needed (eg, for functions) */ char *comment; /* Comment to insert, or NULL to remove */ } CommentStmt; /* ---------------------- * SECURITY LABEL Statement * ---------------------- */ typedef struct SecLabelStmt { NodeTag type; ObjectType objtype; /* Object's type */ List *objname; /* Qualified name of the object */ List *objargs; /* Arguments if needed (eg, for functions) */ char *provider; /* Label provider (or NULL) */ char *label; /* New security label to be assigned */ } SecLabelStmt; /* ---------------------- * Declare Cursor Statement * * Note: the "query" field of DeclareCursorStmt is only used in the raw grammar * output. After parse analysis it's set to null, and the Query points to the * DeclareCursorStmt, not vice versa. * ---------------------- */ #define CURSOR_OPT_BINARY 0x0001 /* BINARY */ #define CURSOR_OPT_SCROLL 0x0002 /* SCROLL explicitly given */ #define CURSOR_OPT_NO_SCROLL 0x0004 /* NO SCROLL explicitly given */ #define CURSOR_OPT_INSENSITIVE 0x0008 /* INSENSITIVE */ #define CURSOR_OPT_HOLD 0x0010 /* WITH HOLD */ /* these planner-control flags do not correspond to any SQL grammar: */ #define CURSOR_OPT_FAST_PLAN 0x0020 /* prefer fast-start plan */ #define CURSOR_OPT_GENERIC_PLAN 0x0040 /* force use of generic plan */ #define CURSOR_OPT_CUSTOM_PLAN 0x0080 /* force use of custom plan */ typedef struct DeclareCursorStmt { NodeTag type; char *portalname; /* name of the portal (cursor) */ int options; /* bitmask of options (see above) */ Node *query; /* the raw SELECT query */ } DeclareCursorStmt; /* ---------------------- * Close Portal Statement * ---------------------- */ typedef struct ClosePortalStmt { NodeTag type; char *portalname; /* name of the portal (cursor) */ /* NULL means CLOSE ALL */ } ClosePortalStmt; /* ---------------------- * Fetch Statement (also Move) * ---------------------- */ typedef enum FetchDirection { /* for these, howMany is how many rows to fetch; FETCH_ALL means ALL */ FETCH_FORWARD, FETCH_BACKWARD, /* for these, howMany indicates a position; only one row is fetched */ FETCH_ABSOLUTE, FETCH_RELATIVE } FetchDirection; #define FETCH_ALL LONG_MAX typedef struct FetchStmt { NodeTag type; FetchDirection direction; /* see above */ long howMany; /* number of rows, or position argument */ char *portalname; /* name of portal (cursor) */ bool ismove; /* TRUE if MOVE */ } FetchStmt; /* ---------------------- * Create Index Statement * * This represents creation of an index and/or an associated constraint. * If isconstraint is true, we should create a pg_constraint entry along * with the index. But if indexOid isn't InvalidOid, we are not creating an * index, just a UNIQUE/PKEY constraint using an existing index. isconstraint * must always be true in this case, and the fields describing the index * properties are empty. * ---------------------- */ typedef struct IndexStmt { NodeTag type; char *idxname; /* name of new index, or NULL for default */ RangeVar *relation; /* relation to build index on */ char *accessMethod; /* name of access method (eg. btree) */ char *tableSpace; /* tablespace, or NULL for default */ List *indexParams; /* columns to index: a list of IndexElem */ List *options; /* WITH clause options: a list of DefElem */ Node *whereClause; /* qualification (partial-index predicate) */ List *excludeOpNames; /* exclusion operator names, or NIL if none */ char *idxcomment; /* comment to apply to index, or NULL */ Oid indexOid; /* OID of an existing index, if any */ Oid oldNode; /* relfilenode of existing storage, if any */ bool unique; /* is index unique? */ bool primary; /* is index a primary key? */ bool isconstraint; /* is it for a pkey/unique constraint? */ bool deferrable; /* is the constraint DEFERRABLE? */ bool initdeferred; /* is the constraint INITIALLY DEFERRED? */ bool concurrent; /* should this be a concurrent index build? */ } IndexStmt; /* ---------------------- * Create Function Statement * ---------------------- */ typedef struct CreateFunctionStmt { NodeTag type; bool replace; /* T => replace if already exists */ List *funcname; /* qualified name of function to create */ List *parameters; /* a list of FunctionParameter */ TypeName *returnType; /* the return type */ List *options; /* a list of DefElem */ List *withClause; /* a list of DefElem */ } CreateFunctionStmt; typedef enum FunctionParameterMode { /* the assigned enum values appear in pg_proc, don't change 'em! */ FUNC_PARAM_IN = 'i', /* input only */ FUNC_PARAM_OUT = 'o', /* output only */ FUNC_PARAM_INOUT = 'b', /* both */ FUNC_PARAM_VARIADIC = 'v', /* variadic (always input) */ FUNC_PARAM_TABLE = 't' /* table function output column */ } FunctionParameterMode; typedef struct FunctionParameter { NodeTag type; char *name; /* parameter name, or NULL if not given */ TypeName *argType; /* TypeName for parameter type */ FunctionParameterMode mode; /* IN/OUT/etc */ Node *defexpr; /* raw default expr, or NULL if not given */ } FunctionParameter; typedef struct AlterFunctionStmt { NodeTag type; FuncWithArgs *func; /* name and args of function */ List *actions; /* list of DefElem */ } AlterFunctionStmt; /* ---------------------- * DO Statement * * DoStmt is the raw parser output, InlineCodeBlock is the execution-time API * ---------------------- */ typedef struct DoStmt { NodeTag type; List *args; /* List of DefElem nodes */ } DoStmt; typedef struct InlineCodeBlock { NodeTag type; char *source_text; /* source text of anonymous code block */ Oid langOid; /* OID of selected language */ bool langIsTrusted; /* trusted property of the language */ } InlineCodeBlock; /* ---------------------- * Alter Object Rename Statement * ---------------------- */ typedef struct RenameStmt { NodeTag type; ObjectType renameType; /* OBJECT_TABLE, OBJECT_COLUMN, etc */ ObjectType relationType; /* if column name, associated relation type */ RangeVar *relation; /* in case it's a table */ List *object; /* in case it's some other object */ List *objarg; /* argument types, if applicable */ char *subname; /* name of contained object (column, rule, * trigger, etc) */ char *newname; /* the new name */ DropBehavior behavior; /* RESTRICT or CASCADE behavior */ bool missing_ok; /* skip error if missing? */ } RenameStmt; /* ---------------------- * ALTER object SET SCHEMA Statement * ---------------------- */ typedef struct AlterObjectSchemaStmt { NodeTag type; ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */ RangeVar *relation; /* in case it's a table */ List *object; /* in case it's some other object */ List *objarg; /* argument types, if applicable */ char *addname; /* additional name if needed */ char *newschema; /* the new schema */ bool missing_ok; /* skip error if missing? */ } AlterObjectSchemaStmt; /* ---------------------- * Alter Object Owner Statement * ---------------------- */ typedef struct AlterOwnerStmt { NodeTag type; ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */ RangeVar *relation; /* in case it's a table */ List *object; /* in case it's some other object */ List *objarg; /* argument types, if applicable */ char *addname; /* additional name if needed */ char *newowner; /* the new owner */ } AlterOwnerStmt; /* ---------------------- * Create Rule Statement * ---------------------- */ typedef struct RuleStmt { NodeTag type; RangeVar *relation; /* relation the rule is for */ char *rulename; /* name of the rule */ Node *whereClause; /* qualifications */ CmdType event; /* SELECT, INSERT, etc */ bool instead; /* is a 'do instead'? */ List *actions; /* the action statements */ bool replace; /* OR REPLACE */ } RuleStmt; /* ---------------------- * Notify Statement * ---------------------- */ typedef struct NotifyStmt { NodeTag type; char *conditionname; /* condition name to notify */ char *payload; /* the payload string, or NULL if none */ } NotifyStmt; /* ---------------------- * Listen Statement * ---------------------- */ typedef struct ListenStmt { NodeTag type; char *conditionname; /* condition name to listen on */ } ListenStmt; /* ---------------------- * Unlisten Statement * ---------------------- */ typedef struct UnlistenStmt { NodeTag type; char *conditionname; /* name to unlisten on, or NULL for all */ } UnlistenStmt; /* ---------------------- * {Begin|Commit|Rollback} Transaction Statement * ---------------------- */ typedef enum TransactionStmtKind { TRANS_STMT_BEGIN, TRANS_STMT_START, /* semantically identical to BEGIN */ TRANS_STMT_COMMIT, TRANS_STMT_ROLLBACK, TRANS_STMT_SAVEPOINT, TRANS_STMT_RELEASE, TRANS_STMT_ROLLBACK_TO, TRANS_STMT_PREPARE, TRANS_STMT_COMMIT_PREPARED, TRANS_STMT_ROLLBACK_PREPARED } TransactionStmtKind; typedef struct TransactionStmt { NodeTag type; TransactionStmtKind kind; /* see above */ List *options; /* for BEGIN/START and savepoint commands */ char *gid; /* for two-phase-commit related commands */ } TransactionStmt; /* ---------------------- * Create Type Statement, composite types * ---------------------- */ typedef struct CompositeTypeStmt { NodeTag type; RangeVar *typevar; /* the composite type to be created */ List *coldeflist; /* list of ColumnDef nodes */ } CompositeTypeStmt; /* ---------------------- * Create Type Statement, enum types * ---------------------- */ typedef struct CreateEnumStmt { NodeTag type; List *typeName; /* qualified name (list of Value strings) */ List *vals; /* enum values (list of Value strings) */ } CreateEnumStmt; /* ---------------------- * Create Type Statement, range types * ---------------------- */ typedef struct CreateRangeStmt { NodeTag type; List *typeName; /* qualified name (list of Value strings) */ List *params; /* range parameters (list of DefElem) */ } CreateRangeStmt; /* ---------------------- * Alter Type Statement, enum types * ---------------------- */ typedef struct AlterEnumStmt { NodeTag type; List *typeName; /* qualified name (list of Value strings) */ char *newVal; /* new enum value's name */ char *newValNeighbor; /* neighboring enum value, if specified */ bool newValIsAfter; /* place new enum value after neighbor? */ } AlterEnumStmt; /* ---------------------- * Create View Statement * ---------------------- */ typedef struct ViewStmt { NodeTag type; RangeVar *view; /* the view to be created */ List *aliases; /* target column names */ Node *query; /* the SELECT query */ bool replace; /* replace an existing view? */ List *options; /* options from WITH clause */ } ViewStmt; /* ---------------------- * Load Statement * ---------------------- */ typedef struct LoadStmt { NodeTag type; char *filename; /* file to load */ } LoadStmt; /* ---------------------- * Createdb Statement * ---------------------- */ typedef struct CreatedbStmt { NodeTag type; char *dbname; /* name of database to create */ List *options; /* List of DefElem nodes */ } CreatedbStmt; /* ---------------------- * Alter Database * ---------------------- */ typedef struct AlterDatabaseStmt { NodeTag type; char *dbname; /* name of database to alter */ List *options; /* List of DefElem nodes */ } AlterDatabaseStmt; typedef struct AlterDatabaseSetStmt { NodeTag type; char *dbname; /* database name */ VariableSetStmt *setstmt; /* SET or RESET subcommand */ } AlterDatabaseSetStmt; /* ---------------------- * Dropdb Statement * ---------------------- */ typedef struct DropdbStmt { NodeTag type; char *dbname; /* database to drop */ bool missing_ok; /* skip error if db is missing? */ } DropdbStmt; /* ---------------------- * Cluster Statement (support pbrown's cluster index implementation) * ---------------------- */ typedef struct ClusterStmt { NodeTag type; RangeVar *relation; /* relation being indexed, or NULL if all */ char *indexname; /* original index defined */ bool verbose; /* print progress info */ } ClusterStmt; /* ---------------------- * Vacuum and Analyze Statements * * Even though these are nominally two statements, it's convenient to use * just one node type for both. Note that at least one of VACOPT_VACUUM * and VACOPT_ANALYZE must be set in options. VACOPT_FREEZE is an internal * convenience for the grammar and is not examined at runtime --- the * freeze_min_age and freeze_table_age fields are what matter. * ---------------------- */ typedef enum VacuumOption { VACOPT_VACUUM = 1 << 0, /* do VACUUM */ VACOPT_ANALYZE = 1 << 1, /* do ANALYZE */ VACOPT_VERBOSE = 1 << 2, /* print progress info */ VACOPT_FREEZE = 1 << 3, /* FREEZE option */ VACOPT_FULL = 1 << 4, /* FULL (non-concurrent) vacuum */ VACOPT_NOWAIT = 1 << 5 /* don't wait to get lock (autovacuum only) */ } VacuumOption; typedef struct VacuumStmt { NodeTag type; int options; /* OR of VacuumOption flags */ int freeze_min_age; /* min freeze age, or -1 to use default */ int freeze_table_age; /* age at which to scan whole table */ RangeVar *relation; /* single table to process, or NULL */ List *va_cols; /* list of column names, or NIL for all */ } VacuumStmt; /* ---------------------- * Explain Statement * * The "query" field is either a raw parse tree (SelectStmt, InsertStmt, etc) * or a Query node if parse analysis has been done. Note that rewriting and * planning of the query are always postponed until execution of EXPLAIN. * ---------------------- */ typedef struct ExplainStmt { NodeTag type; Node *query; /* the query (see comments above) */ List *options; /* list of DefElem nodes */ } ExplainStmt; /* ---------------------- * CREATE TABLE AS Statement (a/k/a SELECT INTO) * * A query written as CREATE TABLE AS will produce this node type natively. * A query written as SELECT ... INTO will be transformed to this form during * parse analysis. * * The "query" field is handled similarly to EXPLAIN, though note that it * can be a SELECT or an EXECUTE, but not other DML statements. * ---------------------- */ typedef struct CreateTableAsStmt { NodeTag type; Node *query; /* the query (see comments above) */ IntoClause *into; /* destination table */ bool is_select_into; /* it was written as SELECT INTO */ } CreateTableAsStmt; /* ---------------------- * Checkpoint Statement * ---------------------- */ typedef struct CheckPointStmt { NodeTag type; } CheckPointStmt; /* ---------------------- * Discard Statement * ---------------------- */ typedef enum DiscardMode { DISCARD_ALL, DISCARD_PLANS, DISCARD_TEMP } DiscardMode; typedef struct DiscardStmt { NodeTag type; DiscardMode target; } DiscardStmt; /* ---------------------- * LOCK Statement * ---------------------- */ typedef struct LockStmt { NodeTag type; List *relations; /* relations to lock */ int mode; /* lock mode */ bool nowait; /* no wait mode */ } LockStmt; /* ---------------------- * SET CONSTRAINTS Statement * ---------------------- */ typedef struct ConstraintsSetStmt { NodeTag type; List *constraints; /* List of names as RangeVars */ bool deferred; } ConstraintsSetStmt; /* ---------------------- * REINDEX Statement * ---------------------- */ typedef struct ReindexStmt { NodeTag type; ObjectType kind; /* OBJECT_INDEX, OBJECT_TABLE, OBJECT_DATABASE */ RangeVar *relation; /* Table or index to reindex */ const char *name; /* name of database to reindex */ bool do_system; /* include system tables in database case */ bool do_user; /* include user tables in database case */ } ReindexStmt; /* ---------------------- * CREATE CONVERSION Statement * ---------------------- */ typedef struct CreateConversionStmt { NodeTag type; List *conversion_name; /* Name of the conversion */ char *for_encoding_name; /* source encoding name */ char *to_encoding_name; /* destination encoding name */ List *func_name; /* qualified conversion function name */ bool def; /* is this a default conversion? */ } CreateConversionStmt; /* ---------------------- * CREATE CAST Statement * ---------------------- */ typedef struct CreateCastStmt { NodeTag type; TypeName *sourcetype; TypeName *targettype; FuncWithArgs *func; CoercionContext context; bool inout; } CreateCastStmt; /* ---------------------- * PREPARE Statement * ---------------------- */ typedef struct PrepareStmt { NodeTag type; char *name; /* Name of plan, arbitrary */ List *argtypes; /* Types of parameters (List of TypeName) */ Node *query; /* The query itself (as a raw parsetree) */ } PrepareStmt; /* ---------------------- * EXECUTE Statement * ---------------------- */ typedef struct ExecuteStmt { NodeTag type; char *name; /* The name of the plan to execute */ List *params; /* Values to assign to parameters */ } ExecuteStmt; /* ---------------------- * DEALLOCATE Statement * ---------------------- */ typedef struct DeallocateStmt { NodeTag type; char *name; /* The name of the plan to remove */ /* NULL means DEALLOCATE ALL */ } DeallocateStmt; /* * DROP OWNED statement */ typedef struct DropOwnedStmt { NodeTag type; List *roles; DropBehavior behavior; } DropOwnedStmt; /* * REASSIGN OWNED statement */ typedef struct ReassignOwnedStmt { NodeTag type; List *roles; char *newrole; } ReassignOwnedStmt; /* * TS Dictionary stmts: DefineStmt, RenameStmt and DropStmt are default */ typedef struct AlterTSDictionaryStmt { NodeTag type; List *dictname; /* qualified name (list of Value strings) */ List *options; /* List of DefElem nodes */ } AlterTSDictionaryStmt; /* * TS Configuration stmts: DefineStmt, RenameStmt and DropStmt are default */ typedef struct AlterTSConfigurationStmt { NodeTag type; List *cfgname; /* qualified name (list of Value strings) */ /* * dicts will be non-NIL if ADD/ALTER MAPPING was specified. If dicts is * NIL, but tokentype isn't, DROP MAPPING was specified. */ List *tokentype; /* list of Value strings */ List *dicts; /* list of list of Value strings */ bool override; /* if true - remove old variant */ bool replace; /* if true - replace dictionary by another */ bool missing_ok; /* for DROP - skip error if missing? */ } AlterTSConfigurationStmt; #endif /* PARSENODES_H */ ���������������������������������������������pgsql/server/nodes/execnodes.h����������������������������������������������������������������������0000644�����������������00000201426�14763166026�0012456 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * execnodes.h * definitions for executor state nodes * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/nodes/execnodes.h * *------------------------------------------------------------------------- */ #ifndef EXECNODES_H #define EXECNODES_H #include "access/genam.h" #include "access/heapam.h" #include "executor/instrument.h" #include "nodes/params.h" #include "nodes/plannodes.h" #include "utils/reltrigger.h" #include "utils/sortsupport.h" #include "utils/tuplestore.h" /* ---------------- * IndexInfo information * * this struct holds the information needed to construct new index * entries for a particular index. Used for both index_build and * retail creation of index entries. * * NumIndexAttrs number of columns in this index * KeyAttrNumbers underlying-rel attribute numbers used as keys * (zeroes indicate expressions) * Expressions expr trees for expression entries, or NIL if none * ExpressionsState exec state for expressions, or NIL if none * Predicate partial-index predicate, or NIL if none * PredicateState exec state for predicate, or NIL if none * ExclusionOps Per-column exclusion operators, or NULL if none * ExclusionProcs Underlying function OIDs for ExclusionOps * ExclusionStrats Opclass strategy numbers for ExclusionOps * Unique is it a unique index? * ReadyForInserts is it valid for inserts? * Concurrent are we doing a concurrent index build? * BrokenHotChain did we detect any broken HOT chains? * * ii_Concurrent and ii_BrokenHotChain are used only during index build; * they're conventionally set to false otherwise. * ---------------- */ typedef struct IndexInfo { NodeTag type; int ii_NumIndexAttrs; AttrNumber ii_KeyAttrNumbers[INDEX_MAX_KEYS]; List *ii_Expressions; /* list of Expr */ List *ii_ExpressionsState; /* list of ExprState */ List *ii_Predicate; /* list of Expr */ List *ii_PredicateState; /* list of ExprState */ Oid *ii_ExclusionOps; /* array with one entry per column */ Oid *ii_ExclusionProcs; /* array with one entry per column */ uint16 *ii_ExclusionStrats; /* array with one entry per column */ bool ii_Unique; bool ii_ReadyForInserts; bool ii_Concurrent; bool ii_BrokenHotChain; } IndexInfo; /* ---------------- * ExprContext_CB * * List of callbacks to be called at ExprContext shutdown. * ---------------- */ typedef void (*ExprContextCallbackFunction) (Datum arg); typedef struct ExprContext_CB { struct ExprContext_CB *next; ExprContextCallbackFunction function; Datum arg; } ExprContext_CB; /* ---------------- * ExprContext * * This class holds the "current context" information * needed to evaluate expressions for doing tuple qualifications * and tuple projections. For example, if an expression refers * to an attribute in the current inner tuple then we need to know * what the current inner tuple is and so we look at the expression * context. * * There are two memory contexts associated with an ExprContext: * * ecxt_per_query_memory is a query-lifespan context, typically the same * context the ExprContext node itself is allocated in. This context * can be used for purposes such as storing function call cache info. * * ecxt_per_tuple_memory is a short-term context for expression results. * As the name suggests, it will typically be reset once per tuple, * before we begin to evaluate expressions for that tuple. Each * ExprContext normally has its very own per-tuple memory context. * * CurrentMemoryContext should be set to ecxt_per_tuple_memory before * calling ExecEvalExpr() --- see ExecEvalExprSwitchContext(). * ---------------- */ typedef struct ExprContext { NodeTag type; /* Tuples that Var nodes in expression may refer to */ TupleTableSlot *ecxt_scantuple; TupleTableSlot *ecxt_innertuple; TupleTableSlot *ecxt_outertuple; /* Memory contexts for expression evaluation --- see notes above */ MemoryContext ecxt_per_query_memory; MemoryContext ecxt_per_tuple_memory; /* Values to substitute for Param nodes in expression */ ParamExecData *ecxt_param_exec_vals; /* for PARAM_EXEC params */ ParamListInfo ecxt_param_list_info; /* for other param types */ /* * Values to substitute for Aggref nodes in the expressions of an Agg * node, or for WindowFunc nodes within a WindowAgg node. */ Datum *ecxt_aggvalues; /* precomputed values for aggs/windowfuncs */ bool *ecxt_aggnulls; /* null flags for aggs/windowfuncs */ /* Value to substitute for CaseTestExpr nodes in expression */ Datum caseValue_datum; bool caseValue_isNull; /* Value to substitute for CoerceToDomainValue nodes in expression */ Datum domainValue_datum; bool domainValue_isNull; /* Link to containing EState (NULL if a standalone ExprContext) */ struct EState *ecxt_estate; /* Functions to call back when ExprContext is shut down */ ExprContext_CB *ecxt_callbacks; } ExprContext; /* * Set-result status returned by ExecEvalExpr() */ typedef enum { ExprSingleResult, /* expression does not return a set */ ExprMultipleResult, /* this result is an element of a set */ ExprEndResult /* there are no more elements in the set */ } ExprDoneCond; /* * Return modes for functions returning sets. Note values must be chosen * as separate bits so that a bitmask can be formed to indicate supported * modes. SFRM_Materialize_Random and SFRM_Materialize_Preferred are * auxiliary flags about SFRM_Materialize mode, rather than separate modes. */ typedef enum { SFRM_ValuePerCall = 0x01, /* one value returned per call */ SFRM_Materialize = 0x02, /* result set instantiated in Tuplestore */ SFRM_Materialize_Random = 0x04, /* Tuplestore needs randomAccess */ SFRM_Materialize_Preferred = 0x08 /* caller prefers Tuplestore */ } SetFunctionReturnMode; /* * When calling a function that might return a set (multiple rows), * a node of this type is passed as fcinfo->resultinfo to allow * return status to be passed back. A function returning set should * raise an error if no such resultinfo is provided. */ typedef struct ReturnSetInfo { NodeTag type; /* values set by caller: */ ExprContext *econtext; /* context function is being called in */ TupleDesc expectedDesc; /* tuple descriptor expected by caller */ int allowedModes; /* bitmask: return modes caller can handle */ /* result status from function (but pre-initialized by caller): */ SetFunctionReturnMode returnMode; /* actual return mode */ ExprDoneCond isDone; /* status for ValuePerCall mode */ /* fields filled by function in Materialize return mode: */ Tuplestorestate *setResult; /* holds the complete returned tuple set */ TupleDesc setDesc; /* actual descriptor for returned tuples */ } ReturnSetInfo; /* ---------------- * ProjectionInfo node information * * This is all the information needed to perform projections --- * that is, form new tuples by evaluation of targetlist expressions. * Nodes which need to do projections create one of these. * * ExecProject() evaluates the tlist, forms a tuple, and stores it * in the given slot. Note that the result will be a "virtual" tuple * unless ExecMaterializeSlot() is then called to force it to be * converted to a physical tuple. The slot must have a tupledesc * that matches the output of the tlist! * * The planner very often produces tlists that consist entirely of * simple Var references (lower levels of a plan tree almost always * look like that). And top-level tlists are often mostly Vars too. * We therefore optimize execution of simple-Var tlist entries. * The pi_targetlist list actually contains only the tlist entries that * aren't simple Vars, while those that are Vars are processed using the * varSlotOffsets/varNumbers/varOutputCols arrays. * * The lastXXXVar fields are used to optimize fetching of fields from * input tuples: they let us do a slot_getsomeattrs() call to ensure * that all needed attributes are extracted in one pass. * * targetlist target list for projection (non-Var expressions only) * exprContext expression context in which to evaluate targetlist * slot slot to place projection result in * itemIsDone workspace array for ExecProject * directMap true if varOutputCols[] is an identity map * numSimpleVars number of simple Vars found in original tlist * varSlotOffsets array indicating which slot each simple Var is from * varNumbers array containing input attr numbers of simple Vars * varOutputCols array containing output attr numbers of simple Vars * lastInnerVar highest attnum from inner tuple slot (0 if none) * lastOuterVar highest attnum from outer tuple slot (0 if none) * lastScanVar highest attnum from scan tuple slot (0 if none) * ---------------- */ typedef struct ProjectionInfo { NodeTag type; List *pi_targetlist; ExprContext *pi_exprContext; TupleTableSlot *pi_slot; ExprDoneCond *pi_itemIsDone; bool pi_directMap; int pi_numSimpleVars; int *pi_varSlotOffsets; int *pi_varNumbers; int *pi_varOutputCols; int pi_lastInnerVar; int pi_lastOuterVar; int pi_lastScanVar; } ProjectionInfo; /* ---------------- * JunkFilter * * This class is used to store information regarding junk attributes. * A junk attribute is an attribute in a tuple that is needed only for * storing intermediate information in the executor, and does not belong * in emitted tuples. For example, when we do an UPDATE query, * the planner adds a "junk" entry to the targetlist so that the tuples * returned to ExecutePlan() contain an extra attribute: the ctid of * the tuple to be updated. This is needed to do the update, but we * don't want the ctid to be part of the stored new tuple! So, we * apply a "junk filter" to remove the junk attributes and form the * real output tuple. The junkfilter code also provides routines to * extract the values of the junk attribute(s) from the input tuple. * * targetList: the original target list (including junk attributes). * cleanTupType: the tuple descriptor for the "clean" tuple (with * junk attributes removed). * cleanMap: A map with the correspondence between the non-junk * attribute numbers of the "original" tuple and the * attribute numbers of the "clean" tuple. * resultSlot: tuple slot used to hold cleaned tuple. * junkAttNo: not used by junkfilter code. Can be used by caller * to remember the attno of a specific junk attribute * (execMain.c stores the "ctid" attno here). * ---------------- */ typedef struct JunkFilter { NodeTag type; List *jf_targetList; TupleDesc jf_cleanTupType; AttrNumber *jf_cleanMap; TupleTableSlot *jf_resultSlot; AttrNumber jf_junkAttNo; } JunkFilter; /* ---------------- * ResultRelInfo information * * Whenever we update an existing relation, we have to * update indices on the relation, and perhaps also fire triggers. * The ResultRelInfo class is used to hold all the information needed * about a result relation, including indices.. -cim 10/15/89 * * RangeTableIndex result relation's range table index * RelationDesc relation descriptor for result relation * NumIndices # of indices existing on result relation * IndexRelationDescs array of relation descriptors for indices * IndexRelationInfo array of key/attr info for indices * TrigDesc triggers to be fired, if any * TrigFunctions cached lookup info for trigger functions * TrigWhenExprs array of trigger WHEN expr states * TrigInstrument optional runtime measurements for triggers * ConstraintExprs array of constraint-checking expr states * junkFilter for removing junk attributes from tuples * projectReturning for computing a RETURNING list * ---------------- */ typedef struct ResultRelInfo { NodeTag type; Index ri_RangeTableIndex; Relation ri_RelationDesc; int ri_NumIndices; RelationPtr ri_IndexRelationDescs; IndexInfo **ri_IndexRelationInfo; TriggerDesc *ri_TrigDesc; FmgrInfo *ri_TrigFunctions; List **ri_TrigWhenExprs; Instrumentation *ri_TrigInstrument; List **ri_ConstraintExprs; JunkFilter *ri_junkFilter; ProjectionInfo *ri_projectReturning; } ResultRelInfo; /* ---------------- * EState information * * Master working state for an Executor invocation * ---------------- */ typedef struct EState { NodeTag type; /* Basic state for all query types: */ ScanDirection es_direction; /* current scan direction */ Snapshot es_snapshot; /* time qual to use */ Snapshot es_crosscheck_snapshot; /* crosscheck time qual for RI */ List *es_range_table; /* List of RangeTblEntry */ PlannedStmt *es_plannedstmt; /* link to top of plan tree */ JunkFilter *es_junkFilter; /* top-level junk filter, if any */ /* If query can insert/delete tuples, the command ID to mark them with */ CommandId es_output_cid; /* Info about target table(s) for insert/update/delete queries: */ ResultRelInfo *es_result_relations; /* array of ResultRelInfos */ int es_num_result_relations; /* length of array */ ResultRelInfo *es_result_relation_info; /* currently active array elt */ /* Stuff used for firing triggers: */ List *es_trig_target_relations; /* trigger-only ResultRelInfos */ TupleTableSlot *es_trig_tuple_slot; /* for trigger output tuples */ TupleTableSlot *es_trig_oldtup_slot; /* for TriggerEnabled */ TupleTableSlot *es_trig_newtup_slot; /* for TriggerEnabled */ /* Parameter info: */ ParamListInfo es_param_list_info; /* values of external params */ ParamExecData *es_param_exec_vals; /* values of internal params */ /* Other working state: */ MemoryContext es_query_cxt; /* per-query context in which EState lives */ List *es_tupleTable; /* List of TupleTableSlots */ List *es_rowMarks; /* List of ExecRowMarks */ uint32 es_processed; /* # of tuples processed */ Oid es_lastoid; /* last oid processed (by INSERT) */ int es_top_eflags; /* eflags passed to ExecutorStart */ int es_instrument; /* OR of InstrumentOption flags */ bool es_finished; /* true when ExecutorFinish is done */ List *es_exprcontexts; /* List of ExprContexts within EState */ List *es_subplanstates; /* List of PlanState for SubPlans */ List *es_auxmodifytables; /* List of secondary ModifyTableStates */ /* * this ExprContext is for per-output-tuple operations, such as constraint * checks and index-value computations. It will be reset for each output * tuple. Note that it will be created only if needed. */ ExprContext *es_per_tuple_exprcontext; /* * These fields are for re-evaluating plan quals when an updated tuple is * substituted in READ COMMITTED mode. es_epqTuple[] contains tuples that * scan plan nodes should return instead of whatever they'd normally * return, or NULL if nothing to return; es_epqTupleSet[] is true if a * particular array entry is valid; and es_epqScanDone[] is state to * remember if the tuple has been returned already. Arrays are of size * list_length(es_range_table) and are indexed by scan node scanrelid - 1. */ HeapTuple *es_epqTuple; /* array of EPQ substitute tuples */ bool *es_epqTupleSet; /* true if EPQ tuple is provided */ bool *es_epqScanDone; /* true if EPQ tuple has been fetched */ } EState; /* * ExecRowMark - * runtime representation of FOR UPDATE/SHARE clauses * * When doing UPDATE, DELETE, or SELECT FOR UPDATE/SHARE, we should have an * ExecRowMark for each non-target relation in the query (except inheritance * parent RTEs, which can be ignored at runtime). See PlanRowMark for details * about most of the fields. In addition to fields directly derived from * PlanRowMark, we store curCtid, which is used by the WHERE CURRENT OF code. * * EState->es_rowMarks is a list of these structs. */ typedef struct ExecRowMark { Relation relation; /* opened and suitably locked relation */ Index rti; /* its range table index */ Index prti; /* parent range table index, if child */ Index rowmarkId; /* unique identifier for resjunk columns */ RowMarkType markType; /* see enum in nodes/plannodes.h */ bool noWait; /* NOWAIT option */ ItemPointerData curCtid; /* ctid of currently locked tuple, if any */ } ExecRowMark; /* * ExecAuxRowMark - * additional runtime representation of FOR UPDATE/SHARE clauses * * Each LockRows and ModifyTable node keeps a list of the rowmarks it needs to * deal with. In addition to a pointer to the related entry in es_rowMarks, * this struct carries the column number(s) of the resjunk columns associated * with the rowmark (see comments for PlanRowMark for more detail). In the * case of ModifyTable, there has to be a separate ExecAuxRowMark list for * each child plan, because the resjunk columns could be at different physical * column positions in different subplans. */ typedef struct ExecAuxRowMark { ExecRowMark *rowmark; /* related entry in es_rowMarks */ AttrNumber ctidAttNo; /* resno of ctid junk attribute, if any */ AttrNumber toidAttNo; /* resno of tableoid junk attribute, if any */ AttrNumber wholeAttNo; /* resno of whole-row junk attribute, if any */ } ExecAuxRowMark; /* ---------------------------------------------------------------- * Tuple Hash Tables * * All-in-memory tuple hash tables are used for a number of purposes. * * Note: tab_hash_funcs are for the key datatype(s) stored in the table, * and tab_eq_funcs are non-cross-type equality operators for those types. * Normally these are the only functions used, but FindTupleHashEntry() * supports searching a hashtable using cross-data-type hashing. For that, * the caller must supply hash functions for the LHS datatype as well as * the cross-type equality operators to use. in_hash_funcs and cur_eq_funcs * are set to point to the caller's function arrays while doing such a search. * During LookupTupleHashEntry(), they point to tab_hash_funcs and * tab_eq_funcs respectively. * ---------------------------------------------------------------- */ typedef struct TupleHashEntryData *TupleHashEntry; typedef struct TupleHashTableData *TupleHashTable; typedef struct TupleHashEntryData { /* firstTuple must be the first field in this struct! */ MinimalTuple firstTuple; /* copy of first tuple in this group */ /* there may be additional data beyond the end of this struct */ } TupleHashEntryData; /* VARIABLE LENGTH STRUCT */ typedef struct TupleHashTableData { HTAB *hashtab; /* underlying dynahash table */ int numCols; /* number of columns in lookup key */ AttrNumber *keyColIdx; /* attr numbers of key columns */ FmgrInfo *tab_hash_funcs; /* hash functions for table datatype(s) */ FmgrInfo *tab_eq_funcs; /* equality functions for table datatype(s) */ MemoryContext tablecxt; /* memory context containing table */ MemoryContext tempcxt; /* context for function evaluations */ Size entrysize; /* actual size to make each hash entry */ TupleTableSlot *tableslot; /* slot for referencing table entries */ /* The following fields are set transiently for each table search: */ TupleTableSlot *inputslot; /* current input tuple's slot */ FmgrInfo *in_hash_funcs; /* hash functions for input datatype(s) */ FmgrInfo *cur_eq_funcs; /* equality functions for input vs. table */ } TupleHashTableData; typedef HASH_SEQ_STATUS TupleHashIterator; /* * Use InitTupleHashIterator/TermTupleHashIterator for a read/write scan. * Use ResetTupleHashIterator if the table can be frozen (in this case no * explicit scan termination is needed). */ #define InitTupleHashIterator(htable, iter) \ hash_seq_init(iter, (htable)->hashtab) #define TermTupleHashIterator(iter) \ hash_seq_term(iter) #define ResetTupleHashIterator(htable, iter) \ do { \ hash_freeze((htable)->hashtab); \ hash_seq_init(iter, (htable)->hashtab); \ } while (0) #define ScanTupleHashTable(iter) \ ((TupleHashEntry) hash_seq_search(iter)) /* ---------------------------------------------------------------- * Expression State Trees * * Each executable expression tree has a parallel ExprState tree. * * Unlike PlanState, there is not an exact one-for-one correspondence between * ExprState node types and Expr node types. Many Expr node types have no * need for node-type-specific run-time state, and so they can use plain * ExprState or GenericExprState as their associated ExprState node type. * ---------------------------------------------------------------- */ /* ---------------- * ExprState node * * ExprState is the common superclass for all ExprState-type nodes. * * It can also be instantiated directly for leaf Expr nodes that need no * local run-time state (such as Var, Const, or Param). * * To save on dispatch overhead, each ExprState node contains a function * pointer to the routine to execute to evaluate the node. * ---------------- */ typedef struct ExprState ExprState; typedef Datum (*ExprStateEvalFunc) (ExprState *expression, ExprContext *econtext, bool *isNull, ExprDoneCond *isDone); struct ExprState { NodeTag type; Expr *expr; /* associated Expr node */ ExprStateEvalFunc evalfunc; /* routine to run to execute node */ }; /* ---------------- * GenericExprState node * * This is used for Expr node types that need no local run-time state, * but have one child Expr node. * ---------------- */ typedef struct GenericExprState { ExprState xprstate; ExprState *arg; /* state of my child node */ } GenericExprState; /* ---------------- * WholeRowVarExprState node * ---------------- */ typedef struct WholeRowVarExprState { ExprState xprstate; struct PlanState *parent; /* parent PlanState, or NULL if none */ JunkFilter *wrv_junkFilter; /* JunkFilter to remove resjunk cols */ TupleDesc wrv_tupdesc; /* descriptor for resulting tuples */ } WholeRowVarExprState; /* ---------------- * AggrefExprState node * ---------------- */ typedef struct AggrefExprState { ExprState xprstate; List *args; /* states of argument expressions */ int aggno; /* ID number for agg within its plan node */ } AggrefExprState; /* ---------------- * WindowFuncExprState node * ---------------- */ typedef struct WindowFuncExprState { ExprState xprstate; List *args; /* states of argument expressions */ int wfuncno; /* ID number for wfunc within its plan node */ } WindowFuncExprState; /* ---------------- * ArrayRefExprState node * * Note: array types can be fixed-length (typlen > 0), but only when the * element type is itself fixed-length. Otherwise they are varlena structures * and have typlen = -1. In any case, an array type is never pass-by-value. * ---------------- */ typedef struct ArrayRefExprState { ExprState xprstate; List *refupperindexpr; /* states for child nodes */ List *reflowerindexpr; ExprState *refexpr; ExprState *refassgnexpr; int16 refattrlength; /* typlen of array type */ int16 refelemlength; /* typlen of the array element type */ bool refelembyval; /* is the element type pass-by-value? */ char refelemalign; /* typalign of the element type */ } ArrayRefExprState; /* ---------------- * FuncExprState node * * Although named for FuncExpr, this is also used for OpExpr, DistinctExpr, * and NullIf nodes; be careful to check what xprstate.expr is actually * pointing at! * ---------------- */ typedef struct FuncExprState { ExprState xprstate; List *args; /* states of argument expressions */ /* * Function manager's lookup info for the target function. If func.fn_oid * is InvalidOid, we haven't initialized it yet (nor any of the following * fields). */ FmgrInfo func; /* * For a set-returning function (SRF) that returns a tuplestore, we keep * the tuplestore here and dole out the result rows one at a time. The * slot holds the row currently being returned. */ Tuplestorestate *funcResultStore; TupleTableSlot *funcResultSlot; /* * In some cases we need to compute a tuple descriptor for the function's * output. If so, it's stored here. */ TupleDesc funcResultDesc; bool funcReturnsTuple; /* valid when funcResultDesc isn't * NULL */ /* * setArgsValid is true when we are evaluating a set-returning function * that uses value-per-call mode and we are in the middle of a call * series; we want to pass the same argument values to the function again * (and again, until it returns ExprEndResult). This indicates that * fcinfo_data already contains valid argument data. */ bool setArgsValid; /* * Flag to remember whether we found a set-valued argument to the * function. This causes the function result to be a set as well. Valid * only when setArgsValid is true or funcResultStore isn't NULL. */ bool setHasSetArg; /* some argument returns a set */ /* * Flag to remember whether we have registered a shutdown callback for * this FuncExprState. We do so only if funcResultStore or setArgsValid * has been set at least once (since all the callback is for is to release * the tuplestore or clear setArgsValid). */ bool shutdown_reg; /* a shutdown callback is registered */ /* * Call parameter structure for the function. This has been initialized * (by InitFunctionCallInfoData) if func.fn_oid is valid. It also saves * argument values between calls, when setArgsValid is true. */ FunctionCallInfoData fcinfo_data; } FuncExprState; /* ---------------- * ScalarArrayOpExprState node * * This is a FuncExprState plus some additional data. * ---------------- */ typedef struct ScalarArrayOpExprState { FuncExprState fxprstate; /* Cached info about array element type */ Oid element_type; int16 typlen; bool typbyval; char typalign; } ScalarArrayOpExprState; /* ---------------- * BoolExprState node * ---------------- */ typedef struct BoolExprState { ExprState xprstate; List *args; /* states of argument expression(s) */ } BoolExprState; /* ---------------- * SubPlanState node * ---------------- */ typedef struct SubPlanState { ExprState xprstate; struct PlanState *planstate; /* subselect plan's state tree */ ExprState *testexpr; /* state of combining expression */ List *args; /* states of argument expression(s) */ HeapTuple curTuple; /* copy of most recent tuple from subplan */ Datum curArray; /* most recent array from ARRAY() subplan */ /* these are used when hashing the subselect's output: */ ProjectionInfo *projLeft; /* for projecting lefthand exprs */ ProjectionInfo *projRight; /* for projecting subselect output */ TupleHashTable hashtable; /* hash table for no-nulls subselect rows */ TupleHashTable hashnulls; /* hash table for rows with null(s) */ bool havehashrows; /* TRUE if hashtable is not empty */ bool havenullrows; /* TRUE if hashnulls is not empty */ MemoryContext hashtablecxt; /* memory context containing hash tables */ MemoryContext hashtempcxt; /* temp memory context for hash tables */ ExprContext *innerecontext; /* econtext for computing inner tuples */ AttrNumber *keyColIdx; /* control data for hash tables */ FmgrInfo *tab_hash_funcs; /* hash functions for table datatype(s) */ FmgrInfo *tab_eq_funcs; /* equality functions for table datatype(s) */ FmgrInfo *lhs_hash_funcs; /* hash functions for lefthand datatype(s) */ FmgrInfo *cur_eq_funcs; /* equality functions for LHS vs. table */ } SubPlanState; /* ---------------- * AlternativeSubPlanState node * ---------------- */ typedef struct AlternativeSubPlanState { ExprState xprstate; List *subplans; /* states of alternative subplans */ int active; /* list index of the one we're using */ } AlternativeSubPlanState; /* ---------------- * FieldSelectState node * ---------------- */ typedef struct FieldSelectState { ExprState xprstate; ExprState *arg; /* input expression */ TupleDesc argdesc; /* tupdesc for most recent input */ } FieldSelectState; /* ---------------- * FieldStoreState node * ---------------- */ typedef struct FieldStoreState { ExprState xprstate; ExprState *arg; /* input tuple value */ List *newvals; /* new value(s) for field(s) */ TupleDesc argdesc; /* tupdesc for most recent input */ } FieldStoreState; /* ---------------- * CoerceViaIOState node * ---------------- */ typedef struct CoerceViaIOState { ExprState xprstate; ExprState *arg; /* input expression */ FmgrInfo outfunc; /* lookup info for source output function */ FmgrInfo infunc; /* lookup info for result input function */ Oid intypioparam; /* argument needed for input function */ } CoerceViaIOState; /* ---------------- * ArrayCoerceExprState node * ---------------- */ typedef struct ArrayCoerceExprState { ExprState xprstate; ExprState *arg; /* input array value */ Oid resultelemtype; /* element type of result array */ FmgrInfo elemfunc; /* lookup info for element coercion function */ /* use struct pointer to avoid including array.h here */ struct ArrayMapState *amstate; /* workspace for array_map */ } ArrayCoerceExprState; /* ---------------- * ConvertRowtypeExprState node * ---------------- */ typedef struct ConvertRowtypeExprState { ExprState xprstate; ExprState *arg; /* input tuple value */ TupleDesc indesc; /* tupdesc for source rowtype */ TupleDesc outdesc; /* tupdesc for result rowtype */ /* use "struct" so we needn't include tupconvert.h here */ struct TupleConversionMap *map; bool initialized; } ConvertRowtypeExprState; /* ---------------- * CaseExprState node * ---------------- */ typedef struct CaseExprState { ExprState xprstate; ExprState *arg; /* implicit equality comparison argument */ List *args; /* the arguments (list of WHEN clauses) */ ExprState *defresult; /* the default result (ELSE clause) */ } CaseExprState; /* ---------------- * CaseWhenState node * ---------------- */ typedef struct CaseWhenState { ExprState xprstate; ExprState *expr; /* condition expression */ ExprState *result; /* substitution result */ } CaseWhenState; /* ---------------- * ArrayExprState node * * Note: ARRAY[] expressions always produce varlena arrays, never fixed-length * arrays. * ---------------- */ typedef struct ArrayExprState { ExprState xprstate; List *elements; /* states for child nodes */ int16 elemlength; /* typlen of the array element type */ bool elembyval; /* is the element type pass-by-value? */ char elemalign; /* typalign of the element type */ } ArrayExprState; /* ---------------- * RowExprState node * ---------------- */ typedef struct RowExprState { ExprState xprstate; List *args; /* the arguments */ TupleDesc tupdesc; /* descriptor for result tuples */ } RowExprState; /* ---------------- * RowCompareExprState node * ---------------- */ typedef struct RowCompareExprState { ExprState xprstate; List *largs; /* the left-hand input arguments */ List *rargs; /* the right-hand input arguments */ FmgrInfo *funcs; /* array of comparison function info */ Oid *collations; /* array of collations to use */ } RowCompareExprState; /* ---------------- * CoalesceExprState node * ---------------- */ typedef struct CoalesceExprState { ExprState xprstate; List *args; /* the arguments */ } CoalesceExprState; /* ---------------- * MinMaxExprState node * ---------------- */ typedef struct MinMaxExprState { ExprState xprstate; List *args; /* the arguments */ FmgrInfo cfunc; /* lookup info for comparison func */ } MinMaxExprState; /* ---------------- * XmlExprState node * ---------------- */ typedef struct XmlExprState { ExprState xprstate; List *named_args; /* ExprStates for named arguments */ List *args; /* ExprStates for other arguments */ } XmlExprState; /* ---------------- * NullTestState node * ---------------- */ typedef struct NullTestState { ExprState xprstate; ExprState *arg; /* input expression */ /* used only if input is of composite type: */ TupleDesc argdesc; /* tupdesc for most recent input */ } NullTestState; /* ---------------- * CoerceToDomainState node * ---------------- */ typedef struct CoerceToDomainState { ExprState xprstate; ExprState *arg; /* input expression */ /* Cached list of constraints that need to be checked */ List *constraints; /* list of DomainConstraintState nodes */ } CoerceToDomainState; /* * DomainConstraintState - one item to check during CoerceToDomain * * Note: this is just a Node, and not an ExprState, because it has no * corresponding Expr to link to. Nonetheless it is part of an ExprState * tree, so we give it a name following the xxxState convention. */ typedef enum DomainConstraintType { DOM_CONSTRAINT_NOTNULL, DOM_CONSTRAINT_CHECK } DomainConstraintType; typedef struct DomainConstraintState { NodeTag type; DomainConstraintType constrainttype; /* constraint type */ char *name; /* name of constraint (for error msgs) */ ExprState *check_expr; /* for CHECK, a boolean expression */ } DomainConstraintState; /* ---------------------------------------------------------------- * Executor State Trees * * An executing query has a PlanState tree paralleling the Plan tree * that describes the plan. * ---------------------------------------------------------------- */ /* ---------------- * PlanState node * * We never actually instantiate any PlanState nodes; this is just the common * abstract superclass for all PlanState-type nodes. * ---------------- */ typedef struct PlanState { NodeTag type; Plan *plan; /* associated Plan node */ EState *state; /* at execution time, states of individual * nodes point to one EState for the whole * top-level plan */ Instrumentation *instrument; /* Optional runtime stats for this node */ /* * Common structural data for all Plan types. These links to subsidiary * state trees parallel links in the associated plan tree (except for the * subPlan list, which does not exist in the plan tree). */ List *targetlist; /* target list to be computed at this node */ List *qual; /* implicitly-ANDed qual conditions */ struct PlanState *lefttree; /* input plan tree(s) */ struct PlanState *righttree; List *initPlan; /* Init SubPlanState nodes (un-correlated expr * subselects) */ List *subPlan; /* SubPlanState nodes in my expressions */ /* * State for management of parameter-change-driven rescanning */ Bitmapset *chgParam; /* set of IDs of changed Params */ /* * Other run-time state needed by most if not all node types. */ TupleTableSlot *ps_ResultTupleSlot; /* slot for my result tuples */ ExprContext *ps_ExprContext; /* node's expression-evaluation context */ ProjectionInfo *ps_ProjInfo; /* info for doing tuple projection */ bool ps_TupFromTlist;/* state flag for processing set-valued * functions in targetlist */ } PlanState; /* ---------------- * these are defined to avoid confusion problems with "left" * and "right" and "inner" and "outer". The convention is that * the "left" plan is the "outer" plan and the "right" plan is * the inner plan, but these make the code more readable. * ---------------- */ #define innerPlanState(node) (((PlanState *)(node))->righttree) #define outerPlanState(node) (((PlanState *)(node))->lefttree) /* Macros for inline access to certain instrumentation counters */ #define InstrCountFiltered1(node, delta) \ do { \ if (((PlanState *)(node))->instrument) \ ((PlanState *)(node))->instrument->nfiltered1 += (delta); \ } while(0) #define InstrCountFiltered2(node, delta) \ do { \ if (((PlanState *)(node))->instrument) \ ((PlanState *)(node))->instrument->nfiltered2 += (delta); \ } while(0) /* * EPQState is state for executing an EvalPlanQual recheck on a candidate * tuple in ModifyTable or LockRows. The estate and planstate fields are * NULL if inactive. */ typedef struct EPQState { EState *estate; /* subsidiary EState */ PlanState *planstate; /* plan state tree ready to be executed */ TupleTableSlot *origslot; /* original output tuple to be rechecked */ Plan *plan; /* plan tree to be executed */ List *arowMarks; /* ExecAuxRowMarks (non-locking only) */ int epqParam; /* ID of Param to force scan node re-eval */ } EPQState; /* ---------------- * ResultState information * ---------------- */ typedef struct ResultState { PlanState ps; /* its first field is NodeTag */ ExprState *resconstantqual; bool rs_done; /* are we done? */ bool rs_checkqual; /* do we need to check the qual? */ } ResultState; /* ---------------- * ModifyTableState information * ---------------- */ typedef struct ModifyTableState { PlanState ps; /* its first field is NodeTag */ CmdType operation; /* INSERT, UPDATE, or DELETE */ bool canSetTag; /* do we set the command tag/es_processed? */ bool mt_done; /* are we done? */ PlanState **mt_plans; /* subplans (one per target rel) */ int mt_nplans; /* number of plans in the array */ int mt_whichplan; /* which one is being executed (0..n-1) */ ResultRelInfo *resultRelInfo; /* per-subplan target relations */ List **mt_arowmarks; /* per-subplan ExecAuxRowMark lists */ EPQState mt_epqstate; /* for evaluating EvalPlanQual rechecks */ bool fireBSTriggers; /* do we need to fire stmt triggers? */ } ModifyTableState; /* ---------------- * AppendState information * * nplans how many plans are in the array * whichplan which plan is being executed (0 .. n-1) * ---------------- */ typedef struct AppendState { PlanState ps; /* its first field is NodeTag */ PlanState **appendplans; /* array of PlanStates for my inputs */ int as_nplans; int as_whichplan; } AppendState; /* ---------------- * MergeAppendState information * * nplans how many plans are in the array * nkeys number of sort key columns * sortkeys sort keys in SortSupport representation * slots current output tuple of each subplan * heap heap of active tuples (represented as array indexes) * heap_size number of active heap entries * initialized true if we have fetched first tuple from each subplan * last_slot last subplan fetched from (which must be re-called) * ---------------- */ typedef struct MergeAppendState { PlanState ps; /* its first field is NodeTag */ PlanState **mergeplans; /* array of PlanStates for my inputs */ int ms_nplans; int ms_nkeys; SortSupport ms_sortkeys; /* array of length ms_nkeys */ TupleTableSlot **ms_slots; /* array of length ms_nplans */ int *ms_heap; /* array of length ms_nplans */ int ms_heap_size; /* current active length of ms_heap[] */ bool ms_initialized; /* are subplans started? */ int ms_last_slot; /* last subplan slot we returned from */ } MergeAppendState; /* ---------------- * RecursiveUnionState information * * RecursiveUnionState is used for performing a recursive union. * * recursing T when we're done scanning the non-recursive term * intermediate_empty T if intermediate_table is currently empty * working_table working table (to be scanned by recursive term) * intermediate_table current recursive output (next generation of WT) * ---------------- */ typedef struct RecursiveUnionState { PlanState ps; /* its first field is NodeTag */ bool recursing; bool intermediate_empty; Tuplestorestate *working_table; Tuplestorestate *intermediate_table; /* Remaining fields are unused in UNION ALL case */ FmgrInfo *eqfunctions; /* per-grouping-field equality fns */ FmgrInfo *hashfunctions; /* per-grouping-field hash fns */ MemoryContext tempContext; /* short-term context for comparisons */ TupleHashTable hashtable; /* hash table for tuples already seen */ MemoryContext tableContext; /* memory context containing hash table */ } RecursiveUnionState; /* ---------------- * BitmapAndState information * ---------------- */ typedef struct BitmapAndState { PlanState ps; /* its first field is NodeTag */ PlanState **bitmapplans; /* array of PlanStates for my inputs */ int nplans; /* number of input plans */ } BitmapAndState; /* ---------------- * BitmapOrState information * ---------------- */ typedef struct BitmapOrState { PlanState ps; /* its first field is NodeTag */ PlanState **bitmapplans; /* array of PlanStates for my inputs */ int nplans; /* number of input plans */ } BitmapOrState; /* ---------------------------------------------------------------- * Scan State Information * ---------------------------------------------------------------- */ /* ---------------- * ScanState information * * ScanState extends PlanState for node types that represent * scans of an underlying relation. It can also be used for nodes * that scan the output of an underlying plan node --- in that case, * only ScanTupleSlot is actually useful, and it refers to the tuple * retrieved from the subplan. * * currentRelation relation being scanned (NULL if none) * currentScanDesc current scan descriptor for scan (NULL if none) * ScanTupleSlot pointer to slot in tuple table holding scan tuple * ---------------- */ typedef struct ScanState { PlanState ps; /* its first field is NodeTag */ Relation ss_currentRelation; HeapScanDesc ss_currentScanDesc; TupleTableSlot *ss_ScanTupleSlot; } ScanState; /* * SeqScan uses a bare ScanState as its state node, since it needs * no additional fields. */ typedef ScanState SeqScanState; /* * These structs store information about index quals that don't have simple * constant right-hand sides. See comments for ExecIndexBuildScanKeys() * for discussion. */ typedef struct { ScanKey scan_key; /* scankey to put value into */ ExprState *key_expr; /* expr to evaluate to get value */ bool key_toastable; /* is expr's result a toastable datatype? */ } IndexRuntimeKeyInfo; typedef struct { ScanKey scan_key; /* scankey to put value into */ ExprState *array_expr; /* expr to evaluate to get array value */ int next_elem; /* next array element to use */ int num_elems; /* number of elems in current array value */ Datum *elem_values; /* array of num_elems Datums */ bool *elem_nulls; /* array of num_elems is-null flags */ } IndexArrayKeyInfo; /* ---------------- * IndexScanState information * * indexqualorig execution state for indexqualorig expressions * ScanKeys Skey structures for index quals * NumScanKeys number of ScanKeys * OrderByKeys Skey structures for index ordering operators * NumOrderByKeys number of OrderByKeys * RuntimeKeys info about Skeys that must be evaluated at runtime * NumRuntimeKeys number of RuntimeKeys * RuntimeKeysReady true if runtime Skeys have been computed * RuntimeContext expr context for evaling runtime Skeys * RelationDesc index relation descriptor * ScanDesc index scan descriptor * ---------------- */ typedef struct IndexScanState { ScanState ss; /* its first field is NodeTag */ List *indexqualorig; ScanKey iss_ScanKeys; int iss_NumScanKeys; ScanKey iss_OrderByKeys; int iss_NumOrderByKeys; IndexRuntimeKeyInfo *iss_RuntimeKeys; int iss_NumRuntimeKeys; bool iss_RuntimeKeysReady; ExprContext *iss_RuntimeContext; Relation iss_RelationDesc; IndexScanDesc iss_ScanDesc; } IndexScanState; /* ---------------- * IndexOnlyScanState information * * indexqual execution state for indexqual expressions * ScanKeys Skey structures for index quals * NumScanKeys number of ScanKeys * OrderByKeys Skey structures for index ordering operators * NumOrderByKeys number of OrderByKeys * RuntimeKeys info about Skeys that must be evaluated at runtime * NumRuntimeKeys number of RuntimeKeys * RuntimeKeysReady true if runtime Skeys have been computed * RuntimeContext expr context for evaling runtime Skeys * RelationDesc index relation descriptor * ScanDesc index scan descriptor * VMBuffer buffer in use for visibility map testing, if any * HeapFetches number of tuples we were forced to fetch from heap * ---------------- */ typedef struct IndexOnlyScanState { ScanState ss; /* its first field is NodeTag */ List *indexqual; ScanKey ioss_ScanKeys; int ioss_NumScanKeys; ScanKey ioss_OrderByKeys; int ioss_NumOrderByKeys; IndexRuntimeKeyInfo *ioss_RuntimeKeys; int ioss_NumRuntimeKeys; bool ioss_RuntimeKeysReady; ExprContext *ioss_RuntimeContext; Relation ioss_RelationDesc; IndexScanDesc ioss_ScanDesc; Buffer ioss_VMBuffer; long ioss_HeapFetches; } IndexOnlyScanState; /* ---------------- * BitmapIndexScanState information * * result bitmap to return output into, or NULL * ScanKeys Skey structures for index quals * NumScanKeys number of ScanKeys * RuntimeKeys info about Skeys that must be evaluated at runtime * NumRuntimeKeys number of RuntimeKeys * ArrayKeys info about Skeys that come from ScalarArrayOpExprs * NumArrayKeys number of ArrayKeys * RuntimeKeysReady true if runtime Skeys have been computed * RuntimeContext expr context for evaling runtime Skeys * RelationDesc index relation descriptor * ScanDesc index scan descriptor * ---------------- */ typedef struct BitmapIndexScanState { ScanState ss; /* its first field is NodeTag */ TIDBitmap *biss_result; ScanKey biss_ScanKeys; int biss_NumScanKeys; IndexRuntimeKeyInfo *biss_RuntimeKeys; int biss_NumRuntimeKeys; IndexArrayKeyInfo *biss_ArrayKeys; int biss_NumArrayKeys; bool biss_RuntimeKeysReady; ExprContext *biss_RuntimeContext; Relation biss_RelationDesc; IndexScanDesc biss_ScanDesc; } BitmapIndexScanState; /* ---------------- * BitmapHeapScanState information * * bitmapqualorig execution state for bitmapqualorig expressions * tbm bitmap obtained from child index scan(s) * tbmiterator iterator for scanning current pages * tbmres current-page data * prefetch_iterator iterator for prefetching ahead of current page * prefetch_pages # pages prefetch iterator is ahead of current * prefetch_target target prefetch distance * ---------------- */ typedef struct BitmapHeapScanState { ScanState ss; /* its first field is NodeTag */ List *bitmapqualorig; TIDBitmap *tbm; TBMIterator *tbmiterator; TBMIterateResult *tbmres; TBMIterator *prefetch_iterator; int prefetch_pages; int prefetch_target; } BitmapHeapScanState; /* ---------------- * TidScanState information * * isCurrentOf scan has a CurrentOfExpr qual * NumTids number of tids in this scan * TidPtr index of currently fetched tid * TidList evaluated item pointers (array of size NumTids) * ---------------- */ typedef struct TidScanState { ScanState ss; /* its first field is NodeTag */ List *tss_tidquals; /* list of ExprState nodes */ bool tss_isCurrentOf; int tss_NumTids; int tss_TidPtr; int tss_MarkTidPtr; ItemPointerData *tss_TidList; HeapTupleData tss_htup; } TidScanState; /* ---------------- * SubqueryScanState information * * SubqueryScanState is used for scanning a sub-query in the range table. * ScanTupleSlot references the current output tuple of the sub-query. * ---------------- */ typedef struct SubqueryScanState { ScanState ss; /* its first field is NodeTag */ PlanState *subplan; } SubqueryScanState; /* ---------------- * FunctionScanState information * * Function nodes are used to scan the results of a * function appearing in FROM (typically a function returning set). * * eflags node's capability flags * tupdesc expected return tuple description * tuplestorestate private state of tuplestore.c * funcexpr state for function expression being evaluated * argcontext memory context to evaluate function arguments in * ---------------- */ typedef struct FunctionScanState { ScanState ss; /* its first field is NodeTag */ int eflags; TupleDesc tupdesc; Tuplestorestate *tuplestorestate; ExprState *funcexpr; MemoryContext argcontext; } FunctionScanState; /* ---------------- * ValuesScanState information * * ValuesScan nodes are used to scan the results of a VALUES list * * rowcontext per-expression-list context * exprlists array of expression lists being evaluated * array_len size of array * curr_idx current array index (0-based) * marked_idx marked position (for mark/restore) * * Note: ss.ps.ps_ExprContext is used to evaluate any qual or projection * expressions attached to the node. We create a second ExprContext, * rowcontext, in which to build the executor expression state for each * Values sublist. Resetting this context lets us get rid of expression * state for each row, avoiding major memory leakage over a long values list. * ---------------- */ typedef struct ValuesScanState { ScanState ss; /* its first field is NodeTag */ ExprContext *rowcontext; List **exprlists; int array_len; int curr_idx; int marked_idx; } ValuesScanState; /* ---------------- * CteScanState information * * CteScan nodes are used to scan a CommonTableExpr query. * * Multiple CteScan nodes can read out from the same CTE query. We use * a tuplestore to hold rows that have been read from the CTE query but * not yet consumed by all readers. * ---------------- */ typedef struct CteScanState { ScanState ss; /* its first field is NodeTag */ int eflags; /* capability flags to pass to tuplestore */ int readptr; /* index of my tuplestore read pointer */ PlanState *cteplanstate; /* PlanState for the CTE query itself */ /* Link to the "leader" CteScanState (possibly this same node) */ struct CteScanState *leader; /* The remaining fields are only valid in the "leader" CteScanState */ Tuplestorestate *cte_table; /* rows already read from the CTE query */ bool eof_cte; /* reached end of CTE query? */ } CteScanState; /* ---------------- * WorkTableScanState information * * WorkTableScan nodes are used to scan the work table created by * a RecursiveUnion node. We locate the RecursiveUnion node * during executor startup. * ---------------- */ typedef struct WorkTableScanState { ScanState ss; /* its first field is NodeTag */ RecursiveUnionState *rustate; } WorkTableScanState; /* ---------------- * ForeignScanState information * * ForeignScan nodes are used to scan foreign-data tables. * ---------------- */ typedef struct ForeignScanState { ScanState ss; /* its first field is NodeTag */ /* use struct pointer to avoid including fdwapi.h here */ struct FdwRoutine *fdwroutine; void *fdw_state; /* foreign-data wrapper can keep state here */ } ForeignScanState; /* ---------------------------------------------------------------- * Join State Information * ---------------------------------------------------------------- */ /* ---------------- * JoinState information * * Superclass for state nodes of join plans. * ---------------- */ typedef struct JoinState { PlanState ps; JoinType jointype; List *joinqual; /* JOIN quals (in addition to ps.qual) */ } JoinState; /* ---------------- * NestLoopState information * * NeedNewOuter true if need new outer tuple on next call * MatchedOuter true if found a join match for current outer tuple * NullInnerTupleSlot prepared null tuple for left outer joins * ---------------- */ typedef struct NestLoopState { JoinState js; /* its first field is NodeTag */ bool nl_NeedNewOuter; bool nl_MatchedOuter; TupleTableSlot *nl_NullInnerTupleSlot; } NestLoopState; /* ---------------- * MergeJoinState information * * NumClauses number of mergejoinable join clauses * Clauses info for each mergejoinable clause * JoinState current state of ExecMergeJoin state machine * ExtraMarks true to issue extra Mark operations on inner scan * ConstFalseJoin true if we have a constant-false joinqual * FillOuter true if should emit unjoined outer tuples anyway * FillInner true if should emit unjoined inner tuples anyway * MatchedOuter true if found a join match for current outer tuple * MatchedInner true if found a join match for current inner tuple * OuterTupleSlot slot in tuple table for cur outer tuple * InnerTupleSlot slot in tuple table for cur inner tuple * MarkedTupleSlot slot in tuple table for marked tuple * NullOuterTupleSlot prepared null tuple for right outer joins * NullInnerTupleSlot prepared null tuple for left outer joins * OuterEContext workspace for computing outer tuple's join values * InnerEContext workspace for computing inner tuple's join values * ---------------- */ /* private in nodeMergejoin.c: */ typedef struct MergeJoinClauseData *MergeJoinClause; typedef struct MergeJoinState { JoinState js; /* its first field is NodeTag */ int mj_NumClauses; MergeJoinClause mj_Clauses; /* array of length mj_NumClauses */ int mj_JoinState; bool mj_ExtraMarks; bool mj_ConstFalseJoin; bool mj_FillOuter; bool mj_FillInner; bool mj_MatchedOuter; bool mj_MatchedInner; TupleTableSlot *mj_OuterTupleSlot; TupleTableSlot *mj_InnerTupleSlot; TupleTableSlot *mj_MarkedTupleSlot; TupleTableSlot *mj_NullOuterTupleSlot; TupleTableSlot *mj_NullInnerTupleSlot; ExprContext *mj_OuterEContext; ExprContext *mj_InnerEContext; } MergeJoinState; /* ---------------- * HashJoinState information * * hashclauses original form of the hashjoin condition * hj_OuterHashKeys the outer hash keys in the hashjoin condition * hj_InnerHashKeys the inner hash keys in the hashjoin condition * hj_HashOperators the join operators in the hashjoin condition * hj_HashTable hash table for the hashjoin * (NULL if table not built yet) * hj_CurHashValue hash value for current outer tuple * hj_CurBucketNo regular bucket# for current outer tuple * hj_CurSkewBucketNo skew bucket# for current outer tuple * hj_CurTuple last inner tuple matched to current outer * tuple, or NULL if starting search * (hj_CurXXX variables are undefined if * OuterTupleSlot is empty!) * hj_OuterTupleSlot tuple slot for outer tuples * hj_HashTupleSlot tuple slot for inner (hashed) tuples * hj_NullOuterTupleSlot prepared null tuple for right/full outer joins * hj_NullInnerTupleSlot prepared null tuple for left/full outer joins * hj_FirstOuterTupleSlot first tuple retrieved from outer plan * hj_JoinState current state of ExecHashJoin state machine * hj_MatchedOuter true if found a join match for current outer * hj_OuterNotEmpty true if outer relation known not empty * ---------------- */ /* these structs are defined in executor/hashjoin.h: */ typedef struct HashJoinTupleData *HashJoinTuple; typedef struct HashJoinTableData *HashJoinTable; typedef struct HashJoinState { JoinState js; /* its first field is NodeTag */ List *hashclauses; /* list of ExprState nodes */ List *hj_OuterHashKeys; /* list of ExprState nodes */ List *hj_InnerHashKeys; /* list of ExprState nodes */ List *hj_HashOperators; /* list of operator OIDs */ HashJoinTable hj_HashTable; uint32 hj_CurHashValue; int hj_CurBucketNo; int hj_CurSkewBucketNo; HashJoinTuple hj_CurTuple; TupleTableSlot *hj_OuterTupleSlot; TupleTableSlot *hj_HashTupleSlot; TupleTableSlot *hj_NullOuterTupleSlot; TupleTableSlot *hj_NullInnerTupleSlot; TupleTableSlot *hj_FirstOuterTupleSlot; int hj_JoinState; bool hj_MatchedOuter; bool hj_OuterNotEmpty; } HashJoinState; /* ---------------------------------------------------------------- * Materialization State Information * ---------------------------------------------------------------- */ /* ---------------- * MaterialState information * * materialize nodes are used to materialize the results * of a subplan into a temporary file. * * ss.ss_ScanTupleSlot refers to output of underlying plan. * ---------------- */ typedef struct MaterialState { ScanState ss; /* its first field is NodeTag */ int eflags; /* capability flags to pass to tuplestore */ bool eof_underlying; /* reached end of underlying plan? */ Tuplestorestate *tuplestorestate; } MaterialState; /* ---------------- * SortState information * ---------------- */ typedef struct SortState { ScanState ss; /* its first field is NodeTag */ bool randomAccess; /* need random access to sort output? */ bool bounded; /* is the result set bounded? */ int64 bound; /* if bounded, how many tuples are needed */ bool sort_Done; /* sort completed yet? */ bool bounded_Done; /* value of bounded we did the sort with */ int64 bound_Done; /* value of bound we did the sort with */ void *tuplesortstate; /* private state of tuplesort.c */ } SortState; /* --------------------- * GroupState information * ------------------------- */ typedef struct GroupState { ScanState ss; /* its first field is NodeTag */ FmgrInfo *eqfunctions; /* per-field lookup data for equality fns */ bool grp_done; /* indicates completion of Group scan */ } GroupState; /* --------------------- * AggState information * * ss.ss_ScanTupleSlot refers to output of underlying plan. * * Note: ss.ps.ps_ExprContext contains ecxt_aggvalues and * ecxt_aggnulls arrays, which hold the computed agg values for the current * input group during evaluation of an Agg node's output tuple(s). We * create a second ExprContext, tmpcontext, in which to evaluate input * expressions and run the aggregate transition functions. * ------------------------- */ /* these structs are private in nodeAgg.c: */ typedef struct AggStatePerAggData *AggStatePerAgg; typedef struct AggStatePerGroupData *AggStatePerGroup; typedef struct AggState { ScanState ss; /* its first field is NodeTag */ List *aggs; /* all Aggref nodes in targetlist & quals */ int numaggs; /* length of list (could be zero!) */ FmgrInfo *eqfunctions; /* per-grouping-field equality fns */ FmgrInfo *hashfunctions; /* per-grouping-field hash fns */ AggStatePerAgg peragg; /* per-Aggref information */ MemoryContext aggcontext; /* memory context for long-lived data */ ExprContext *tmpcontext; /* econtext for input expressions */ bool agg_done; /* indicates completion of Agg scan */ /* these fields are used in AGG_PLAIN and AGG_SORTED modes: */ AggStatePerGroup pergroup; /* per-Aggref-per-group working state */ HeapTuple grp_firstTuple; /* copy of first tuple of current group */ /* these fields are used in AGG_HASHED mode: */ TupleHashTable hashtable; /* hash table with one entry per group */ TupleTableSlot *hashslot; /* slot for loading hash table */ List *hash_needed; /* list of columns needed in hash table */ bool table_filled; /* hash table filled yet? */ TupleHashIterator hashiter; /* for iterating through hash table */ } AggState; /* ---------------- * WindowAggState information * ---------------- */ /* these structs are private in nodeWindowAgg.c: */ typedef struct WindowStatePerFuncData *WindowStatePerFunc; typedef struct WindowStatePerAggData *WindowStatePerAgg; typedef struct WindowAggState { ScanState ss; /* its first field is NodeTag */ /* these fields are filled in by ExecInitExpr: */ List *funcs; /* all WindowFunc nodes in targetlist */ int numfuncs; /* total number of window functions */ int numaggs; /* number that are plain aggregates */ WindowStatePerFunc perfunc; /* per-window-function information */ WindowStatePerAgg peragg; /* per-plain-aggregate information */ FmgrInfo *partEqfunctions; /* equality funcs for partition columns */ FmgrInfo *ordEqfunctions; /* equality funcs for ordering columns */ Tuplestorestate *buffer; /* stores rows of current partition */ int current_ptr; /* read pointer # for current */ int64 spooled_rows; /* total # of rows in buffer */ int64 currentpos; /* position of current row in partition */ int64 frameheadpos; /* current frame head position */ int64 frametailpos; /* current frame tail position */ /* use struct pointer to avoid including windowapi.h here */ struct WindowObjectData *agg_winobj; /* winobj for aggregate * fetches */ int64 aggregatedbase; /* start row for current aggregates */ int64 aggregatedupto; /* rows before this one are aggregated */ int frameOptions; /* frame_clause options, see WindowDef */ ExprState *startOffset; /* expression for starting bound offset */ ExprState *endOffset; /* expression for ending bound offset */ Datum startOffsetValue; /* result of startOffset evaluation */ Datum endOffsetValue; /* result of endOffset evaluation */ MemoryContext partcontext; /* context for partition-lifespan data */ MemoryContext aggcontext; /* context for each aggregate data */ ExprContext *tmpcontext; /* short-term evaluation context */ bool all_first; /* true if the scan is starting */ bool all_done; /* true if the scan is finished */ bool partition_spooled; /* true if all tuples in current * partition have been spooled into * tuplestore */ bool more_partitions;/* true if there's more partitions after this * one */ bool framehead_valid;/* true if frameheadpos is known up to date * for current row */ bool frametail_valid;/* true if frametailpos is known up to date * for current row */ TupleTableSlot *first_part_slot; /* first tuple of current or next * partition */ /* temporary slots for tuples fetched back from tuplestore */ TupleTableSlot *agg_row_slot; TupleTableSlot *temp_slot_1; TupleTableSlot *temp_slot_2; } WindowAggState; /* ---------------- * UniqueState information * * Unique nodes are used "on top of" sort nodes to discard * duplicate tuples returned from the sort phase. Basically * all it does is compare the current tuple from the subplan * with the previously fetched tuple (stored in its result slot). * If the two are identical in all interesting fields, then * we just fetch another tuple from the sort and try again. * ---------------- */ typedef struct UniqueState { PlanState ps; /* its first field is NodeTag */ FmgrInfo *eqfunctions; /* per-field lookup data for equality fns */ MemoryContext tempContext; /* short-term context for comparisons */ } UniqueState; /* ---------------- * HashState information * ---------------- */ typedef struct HashState { PlanState ps; /* its first field is NodeTag */ HashJoinTable hashtable; /* hash table for the hashjoin */ List *hashkeys; /* list of ExprState nodes */ /* hashkeys is same as parent's hj_InnerHashKeys */ } HashState; /* ---------------- * SetOpState information * * Even in "sorted" mode, SetOp nodes are more complex than a simple * Unique, since we have to count how many duplicates to return. But * we also support hashing, so this is really more like a cut-down * form of Agg. * ---------------- */ /* this struct is private in nodeSetOp.c: */ typedef struct SetOpStatePerGroupData *SetOpStatePerGroup; typedef struct SetOpState { PlanState ps; /* its first field is NodeTag */ FmgrInfo *eqfunctions; /* per-grouping-field equality fns */ FmgrInfo *hashfunctions; /* per-grouping-field hash fns */ bool setop_done; /* indicates completion of output scan */ long numOutput; /* number of dups left to output */ MemoryContext tempContext; /* short-term context for comparisons */ /* these fields are used in SETOP_SORTED mode: */ SetOpStatePerGroup pergroup; /* per-group working state */ HeapTuple grp_firstTuple; /* copy of first tuple of current group */ /* these fields are used in SETOP_HASHED mode: */ TupleHashTable hashtable; /* hash table with one entry per group */ MemoryContext tableContext; /* memory context containing hash table */ bool table_filled; /* hash table filled yet? */ TupleHashIterator hashiter; /* for iterating through hash table */ } SetOpState; /* ---------------- * LockRowsState information * * LockRows nodes are used to enforce FOR UPDATE/FOR SHARE locking. * ---------------- */ typedef struct LockRowsState { PlanState ps; /* its first field is NodeTag */ List *lr_arowMarks; /* List of ExecAuxRowMarks */ EPQState lr_epqstate; /* for evaluating EvalPlanQual rechecks */ } LockRowsState; /* ---------------- * LimitState information * * Limit nodes are used to enforce LIMIT/OFFSET clauses. * They just select the desired subrange of their subplan's output. * * offset is the number of initial tuples to skip (0 does nothing). * count is the number of tuples to return after skipping the offset tuples. * If no limit count was specified, count is undefined and noCount is true. * When lstate == LIMIT_INITIAL, offset/count/noCount haven't been set yet. * ---------------- */ typedef enum { LIMIT_INITIAL, /* initial state for LIMIT node */ LIMIT_RESCAN, /* rescan after recomputing parameters */ LIMIT_EMPTY, /* there are no returnable rows */ LIMIT_INWINDOW, /* have returned a row in the window */ LIMIT_SUBPLANEOF, /* at EOF of subplan (within window) */ LIMIT_WINDOWEND, /* stepped off end of window */ LIMIT_WINDOWSTART /* stepped off beginning of window */ } LimitStateCond; typedef struct LimitState { PlanState ps; /* its first field is NodeTag */ ExprState *limitOffset; /* OFFSET parameter, or NULL if none */ ExprState *limitCount; /* COUNT parameter, or NULL if none */ int64 offset; /* current OFFSET value */ int64 count; /* current COUNT, if any */ bool noCount; /* if true, ignore count */ LimitStateCond lstate; /* state machine status, as above */ int64 position; /* 1-based index of last tuple returned */ TupleTableSlot *subSlot; /* tuple last obtained from subplan */ } LimitState; #endif /* EXECNODES_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/nodes/primnodes.h����������������������������������������������������������������������0000644�����������������00000144055�14763166026�0012505 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * primnodes.h * Definitions for "primitive" node types, those that are used in more * than one of the parse/plan/execute stages of the query pipeline. * Currently, these are mostly nodes for executable expressions * and join trees. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/nodes/primnodes.h * *------------------------------------------------------------------------- */ #ifndef PRIMNODES_H #define PRIMNODES_H #include "access/attnum.h" #include "nodes/pg_list.h" /* ---------------------------------------------------------------- * node definitions * ---------------------------------------------------------------- */ /* * Alias - * specifies an alias for a range variable; the alias might also * specify renaming of columns within the table. * * Note: colnames is a list of Value nodes (always strings). In Alias structs * associated with RTEs, there may be entries corresponding to dropped * columns; these are normally empty strings (""). See parsenodes.h for info. */ typedef struct Alias { NodeTag type; char *aliasname; /* aliased rel name (never qualified) */ List *colnames; /* optional list of column aliases */ } Alias; typedef enum InhOption { INH_NO, /* Do NOT scan child tables */ INH_YES, /* DO scan child tables */ INH_DEFAULT /* Use current SQL_inheritance option */ } InhOption; /* What to do at commit time for temporary relations */ typedef enum OnCommitAction { ONCOMMIT_NOOP, /* No ON COMMIT clause (do nothing) */ ONCOMMIT_PRESERVE_ROWS, /* ON COMMIT PRESERVE ROWS (do nothing) */ ONCOMMIT_DELETE_ROWS, /* ON COMMIT DELETE ROWS */ ONCOMMIT_DROP /* ON COMMIT DROP */ } OnCommitAction; /* * RangeVar - range variable, used in FROM clauses * * Also used to represent table names in utility statements; there, the alias * field is not used, and inhOpt shows whether to apply the operation * recursively to child tables. In some contexts it is also useful to carry * a TEMP table indication here. */ typedef struct RangeVar { NodeTag type; char *catalogname; /* the catalog (database) name, or NULL */ char *schemaname; /* the schema name, or NULL */ char *relname; /* the relation/sequence name */ InhOption inhOpt; /* expand rel by inheritance? recursively act * on children? */ char relpersistence; /* see RELPERSISTENCE_* in pg_class.h */ Alias *alias; /* table alias & optional column aliases */ int location; /* token location, or -1 if unknown */ } RangeVar; /* * IntoClause - target information for SELECT INTO and CREATE TABLE AS */ typedef struct IntoClause { NodeTag type; RangeVar *rel; /* target relation name */ List *colNames; /* column names to assign, or NIL */ List *options; /* options from WITH clause */ OnCommitAction onCommit; /* what do we do at COMMIT? */ char *tableSpaceName; /* table space to use, or NULL */ bool skipData; /* true for WITH NO DATA */ } IntoClause; /* ---------------------------------------------------------------- * node types for executable expressions * ---------------------------------------------------------------- */ /* * Expr - generic superclass for executable-expression nodes * * All node types that are used in executable expression trees should derive * from Expr (that is, have Expr as their first field). Since Expr only * contains NodeTag, this is a formality, but it is an easy form of * documentation. See also the ExprState node types in execnodes.h. */ typedef struct Expr { NodeTag type; } Expr; /* * Var - expression node representing a variable (ie, a table column) * * Note: during parsing/planning, varnoold/varoattno are always just copies * of varno/varattno. At the tail end of planning, Var nodes appearing in * upper-level plan nodes are reassigned to point to the outputs of their * subplans; for example, in a join node varno becomes INNER_VAR or OUTER_VAR * and varattno becomes the index of the proper element of that subplan's * target list. But varnoold/varoattno continue to hold the original values. * The code doesn't really need varnoold/varoattno, but they are very useful * for debugging and interpreting completed plans, so we keep them around. */ #define INNER_VAR 65000 /* reference to inner subplan */ #define OUTER_VAR 65001 /* reference to outer subplan */ #define INDEX_VAR 65002 /* reference to index column */ #define IS_SPECIAL_VARNO(varno) ((varno) >= INNER_VAR) /* Symbols for the indexes of the special RTE entries in rules */ #define PRS2_OLD_VARNO 1 #define PRS2_NEW_VARNO 2 typedef struct Var { Expr xpr; Index varno; /* index of this var's relation in the range * table, or INNER_VAR/OUTER_VAR/INDEX_VAR */ AttrNumber varattno; /* attribute number of this var, or zero for * all */ Oid vartype; /* pg_type OID for the type of this var */ int32 vartypmod; /* pg_attribute typmod value */ Oid varcollid; /* OID of collation, or InvalidOid if none */ Index varlevelsup; /* for subquery variables referencing outer * relations; 0 in a normal var, >0 means N * levels up */ Index varnoold; /* original value of varno, for debugging */ AttrNumber varoattno; /* original value of varattno */ int location; /* token location, or -1 if unknown */ } Var; /* * Const */ typedef struct Const { Expr xpr; Oid consttype; /* pg_type OID of the constant's datatype */ int32 consttypmod; /* typmod value, if any */ Oid constcollid; /* OID of collation, or InvalidOid if none */ int constlen; /* typlen of the constant's datatype */ Datum constvalue; /* the constant's value */ bool constisnull; /* whether the constant is null (if true, * constvalue is undefined) */ bool constbyval; /* whether this datatype is passed by value. * If true, then all the information is stored * in the Datum. If false, then the Datum * contains a pointer to the information. */ int location; /* token location, or -1 if unknown */ } Const; /* ---------------- * Param * paramkind - specifies the kind of parameter. The possible values * for this field are: * * PARAM_EXTERN: The parameter value is supplied from outside the plan. * Such parameters are numbered from 1 to n. * * PARAM_EXEC: The parameter is an internal executor parameter, used * for passing values into and out of sub-queries or from * nestloop joins to their inner scans. * For historical reasons, such parameters are numbered from 0. * These numbers are independent of PARAM_EXTERN numbers. * * PARAM_SUBLINK: The parameter represents an output column of a SubLink * node's sub-select. The column number is contained in the * `paramid' field. (This type of Param is converted to * PARAM_EXEC during planning.) * * Note: currently, paramtypmod is valid for PARAM_SUBLINK Params, and for * PARAM_EXEC Params generated from them; it is always -1 for PARAM_EXTERN * params, since the APIs that supply values for such parameters don't carry * any typmod info. * ---------------- */ typedef enum ParamKind { PARAM_EXTERN, PARAM_EXEC, PARAM_SUBLINK } ParamKind; typedef struct Param { Expr xpr; ParamKind paramkind; /* kind of parameter. See above */ int paramid; /* numeric ID for parameter */ Oid paramtype; /* pg_type OID of parameter's datatype */ int32 paramtypmod; /* typmod value, if known */ Oid paramcollid; /* OID of collation, or InvalidOid if none */ int location; /* token location, or -1 if unknown */ } Param; /* * Aggref * * The aggregate's args list is a targetlist, ie, a list of TargetEntry nodes * (before Postgres 9.0 it was just bare expressions). The non-resjunk TLEs * represent the aggregate's regular arguments (if any) and resjunk TLEs can * be added at the end to represent ORDER BY expressions that are not also * arguments. As in a top-level Query, the TLEs can be marked with * ressortgroupref indexes to let them be referenced by SortGroupClause * entries in the aggorder and/or aggdistinct lists. This represents ORDER BY * and DISTINCT operations to be applied to the aggregate input rows before * they are passed to the transition function. The grammar only allows a * simple "DISTINCT" specifier for the arguments, but we use the full * query-level representation to allow more code sharing. */ typedef struct Aggref { Expr xpr; Oid aggfnoid; /* pg_proc Oid of the aggregate */ Oid aggtype; /* type Oid of result of the aggregate */ Oid aggcollid; /* OID of collation of result */ Oid inputcollid; /* OID of collation that function should use */ List *args; /* arguments and sort expressions */ List *aggorder; /* ORDER BY (list of SortGroupClause) */ List *aggdistinct; /* DISTINCT (list of SortGroupClause) */ bool aggstar; /* TRUE if argument list was really '*' */ Index agglevelsup; /* > 0 if agg belongs to outer query */ int location; /* token location, or -1 if unknown */ } Aggref; /* * WindowFunc */ typedef struct WindowFunc { Expr xpr; Oid winfnoid; /* pg_proc Oid of the function */ Oid wintype; /* type Oid of result of the window function */ Oid wincollid; /* OID of collation of result */ Oid inputcollid; /* OID of collation that function should use */ List *args; /* arguments to the window function */ Index winref; /* index of associated WindowClause */ bool winstar; /* TRUE if argument list was really '*' */ bool winagg; /* is function a simple aggregate? */ int location; /* token location, or -1 if unknown */ } WindowFunc; /* ---------------- * ArrayRef: describes an array subscripting operation * * An ArrayRef can describe fetching a single element from an array, * fetching a subarray (array slice), storing a single element into * an array, or storing a slice. The "store" cases work with an * initial array value and a source value that is inserted into the * appropriate part of the array; the result of the operation is an * entire new modified array value. * * If reflowerindexpr = NIL, then we are fetching or storing a single array * element at the subscripts given by refupperindexpr. Otherwise we are * fetching or storing an array slice, that is a rectangular subarray * with lower and upper bounds given by the index expressions. * reflowerindexpr must be the same length as refupperindexpr when it * is not NIL. * * Note: the result datatype is the element type when fetching a single * element; but it is the array type when doing subarray fetch or either * type of store. * ---------------- */ typedef struct ArrayRef { Expr xpr; Oid refarraytype; /* type of the array proper */ Oid refelemtype; /* type of the array elements */ int32 reftypmod; /* typmod of the array (and elements too) */ Oid refcollid; /* OID of collation, or InvalidOid if none */ List *refupperindexpr;/* expressions that evaluate to upper array * indexes */ List *reflowerindexpr;/* expressions that evaluate to lower array * indexes */ Expr *refexpr; /* the expression that evaluates to an array * value */ Expr *refassgnexpr; /* expression for the source value, or NULL if * fetch */ } ArrayRef; /* * CoercionContext - distinguishes the allowed set of type casts * * NB: ordering of the alternatives is significant; later (larger) values * allow more casts than earlier ones. */ typedef enum CoercionContext { COERCION_IMPLICIT, /* coercion in context of expression */ COERCION_ASSIGNMENT, /* coercion in context of assignment */ COERCION_EXPLICIT /* explicit cast operation */ } CoercionContext; /* * CoercionForm - information showing how to display a function-call node * * NB: equal() ignores CoercionForm fields, therefore this *must* not carry * any semantically significant information. We need that behavior so that * the planner will consider equivalent implicit and explicit casts to be * equivalent. In cases where those actually behave differently, the coercion * function's arguments will be different. */ typedef enum CoercionForm { COERCE_EXPLICIT_CALL, /* display as a function call */ COERCE_EXPLICIT_CAST, /* display as an explicit cast */ COERCE_IMPLICIT_CAST, /* implicit cast, so hide it */ COERCE_DONTCARE /* special case for planner */ } CoercionForm; /* * FuncExpr - expression node for a function call */ typedef struct FuncExpr { Expr xpr; Oid funcid; /* PG_PROC OID of the function */ Oid funcresulttype; /* PG_TYPE OID of result value */ bool funcretset; /* true if function returns set */ CoercionForm funcformat; /* how to display this function call */ Oid funccollid; /* OID of collation of result */ Oid inputcollid; /* OID of collation that function should use */ List *args; /* arguments to the function */ int location; /* token location, or -1 if unknown */ } FuncExpr; /* * NamedArgExpr - a named argument of a function * * This node type can only appear in the args list of a FuncCall or FuncExpr * node. We support pure positional call notation (no named arguments), * named notation (all arguments are named), and mixed notation (unnamed * arguments followed by named ones). * * Parse analysis sets argnumber to the positional index of the argument, * but doesn't rearrange the argument list. * * The planner will convert argument lists to pure positional notation * during expression preprocessing, so execution never sees a NamedArgExpr. */ typedef struct NamedArgExpr { Expr xpr; Expr *arg; /* the argument expression */ char *name; /* the name */ int argnumber; /* argument's number in positional notation */ int location; /* argument name location, or -1 if unknown */ } NamedArgExpr; /* * OpExpr - expression node for an operator invocation * * Semantically, this is essentially the same as a function call. * * Note that opfuncid is not necessarily filled in immediately on creation * of the node. The planner makes sure it is valid before passing the node * tree to the executor, but during parsing/planning opfuncid can be 0. */ typedef struct OpExpr { Expr xpr; Oid opno; /* PG_OPERATOR OID of the operator */ Oid opfuncid; /* PG_PROC OID of underlying function */ Oid opresulttype; /* PG_TYPE OID of result value */ bool opretset; /* true if operator returns set */ Oid opcollid; /* OID of collation of result */ Oid inputcollid; /* OID of collation that operator should use */ List *args; /* arguments to the operator (1 or 2) */ int location; /* token location, or -1 if unknown */ } OpExpr; /* * DistinctExpr - expression node for "x IS DISTINCT FROM y" * * Except for the nodetag, this is represented identically to an OpExpr * referencing the "=" operator for x and y. * We use "=", not the more obvious "<>", because more datatypes have "=" * than "<>". This means the executor must invert the operator result. * Note that the operator function won't be called at all if either input * is NULL, since then the result can be determined directly. */ typedef OpExpr DistinctExpr; /* * NullIfExpr - a NULLIF expression * * Like DistinctExpr, this is represented the same as an OpExpr referencing * the "=" operator for x and y. */ typedef OpExpr NullIfExpr; /* * ScalarArrayOpExpr - expression node for "scalar op ANY/ALL (array)" * * The operator must yield boolean. It is applied to the left operand * and each element of the righthand array, and the results are combined * with OR or AND (for ANY or ALL respectively). The node representation * is almost the same as for the underlying operator, but we need a useOr * flag to remember whether it's ANY or ALL, and we don't have to store * the result type (or the collation) because it must be boolean. */ typedef struct ScalarArrayOpExpr { Expr xpr; Oid opno; /* PG_OPERATOR OID of the operator */ Oid opfuncid; /* PG_PROC OID of underlying function */ bool useOr; /* true for ANY, false for ALL */ Oid inputcollid; /* OID of collation that operator should use */ List *args; /* the scalar and array operands */ int location; /* token location, or -1 if unknown */ } ScalarArrayOpExpr; /* * BoolExpr - expression node for the basic Boolean operators AND, OR, NOT * * Notice the arguments are given as a List. For NOT, of course the list * must always have exactly one element. For AND and OR, the executor can * handle any number of arguments. The parser generally treats AND and OR * as binary and so it typically only produces two-element lists, but the * optimizer will flatten trees of AND and OR nodes to produce longer lists * when possible. There are also a few special cases where more arguments * can appear before optimization. */ typedef enum BoolExprType { AND_EXPR, OR_EXPR, NOT_EXPR } BoolExprType; typedef struct BoolExpr { Expr xpr; BoolExprType boolop; List *args; /* arguments to this expression */ int location; /* token location, or -1 if unknown */ } BoolExpr; /* * SubLink * * A SubLink represents a subselect appearing in an expression, and in some * cases also the combining operator(s) just above it. The subLinkType * indicates the form of the expression represented: * EXISTS_SUBLINK EXISTS(SELECT ...) * ALL_SUBLINK (lefthand) op ALL (SELECT ...) * ANY_SUBLINK (lefthand) op ANY (SELECT ...) * ROWCOMPARE_SUBLINK (lefthand) op (SELECT ...) * EXPR_SUBLINK (SELECT with single targetlist item ...) * ARRAY_SUBLINK ARRAY(SELECT with single targetlist item ...) * CTE_SUBLINK WITH query (never actually part of an expression) * For ALL, ANY, and ROWCOMPARE, the lefthand is a list of expressions of the * same length as the subselect's targetlist. ROWCOMPARE will *always* have * a list with more than one entry; if the subselect has just one target * then the parser will create an EXPR_SUBLINK instead (and any operator * above the subselect will be represented separately). Note that both * ROWCOMPARE and EXPR require the subselect to deliver only one row. * ALL, ANY, and ROWCOMPARE require the combining operators to deliver boolean * results. ALL and ANY combine the per-row results using AND and OR * semantics respectively. * ARRAY requires just one target column, and creates an array of the target * column's type using any number of rows resulting from the subselect. * * SubLink is classed as an Expr node, but it is not actually executable; * it must be replaced in the expression tree by a SubPlan node during * planning. * * NOTE: in the raw output of gram.y, testexpr contains just the raw form * of the lefthand expression (if any), and operName is the String name of * the combining operator. Also, subselect is a raw parsetree. During parse * analysis, the parser transforms testexpr into a complete boolean expression * that compares the lefthand value(s) to PARAM_SUBLINK nodes representing the * output columns of the subselect. And subselect is transformed to a Query. * This is the representation seen in saved rules and in the rewriter. * * In EXISTS, EXPR, and ARRAY SubLinks, testexpr and operName are unused and * are always null. * * The CTE_SUBLINK case never occurs in actual SubLink nodes, but it is used * in SubPlans generated for WITH subqueries. */ typedef enum SubLinkType { EXISTS_SUBLINK, ALL_SUBLINK, ANY_SUBLINK, ROWCOMPARE_SUBLINK, EXPR_SUBLINK, ARRAY_SUBLINK, CTE_SUBLINK /* for SubPlans only */ } SubLinkType; typedef struct SubLink { Expr xpr; SubLinkType subLinkType; /* see above */ Node *testexpr; /* outer-query test for ALL/ANY/ROWCOMPARE */ List *operName; /* originally specified operator name */ Node *subselect; /* subselect as Query* or parsetree */ int location; /* token location, or -1 if unknown */ } SubLink; /* * SubPlan - executable expression node for a subplan (sub-SELECT) * * The planner replaces SubLink nodes in expression trees with SubPlan * nodes after it has finished planning the subquery. SubPlan references * a sub-plantree stored in the subplans list of the toplevel PlannedStmt. * (We avoid a direct link to make it easier to copy expression trees * without causing multiple processing of the subplan.) * * In an ordinary subplan, testexpr points to an executable expression * (OpExpr, an AND/OR tree of OpExprs, or RowCompareExpr) for the combining * operator(s); the left-hand arguments are the original lefthand expressions, * and the right-hand arguments are PARAM_EXEC Param nodes representing the * outputs of the sub-select. (NOTE: runtime coercion functions may be * inserted as well.) This is just the same expression tree as testexpr in * the original SubLink node, but the PARAM_SUBLINK nodes are replaced by * suitably numbered PARAM_EXEC nodes. * * If the sub-select becomes an initplan rather than a subplan, the executable * expression is part of the outer plan's expression tree (and the SubPlan * node itself is not, but rather is found in the outer plan's initPlan * list). In this case testexpr is NULL to avoid duplication. * * The planner also derives lists of the values that need to be passed into * and out of the subplan. Input values are represented as a list "args" of * expressions to be evaluated in the outer-query context (currently these * args are always just Vars, but in principle they could be any expression). * The values are assigned to the global PARAM_EXEC params indexed by parParam * (the parParam and args lists must have the same ordering). setParam is a * list of the PARAM_EXEC params that are computed by the sub-select, if it * is an initplan; they are listed in order by sub-select output column * position. (parParam and setParam are integer Lists, not Bitmapsets, * because their ordering is significant.) * * Also, the planner computes startup and per-call costs for use of the * SubPlan. Note that these include the cost of the subquery proper, * evaluation of the testexpr if any, and any hashtable management overhead. */ typedef struct SubPlan { Expr xpr; /* Fields copied from original SubLink: */ SubLinkType subLinkType; /* see above */ /* The combining operators, transformed to an executable expression: */ Node *testexpr; /* OpExpr or RowCompareExpr expression tree */ List *paramIds; /* IDs of Params embedded in the above */ /* Identification of the Plan tree to use: */ int plan_id; /* Index (from 1) in PlannedStmt.subplans */ /* Identification of the SubPlan for EXPLAIN and debugging purposes: */ char *plan_name; /* A name assigned during planning */ /* Extra data useful for determining subplan's output type: */ Oid firstColType; /* Type of first column of subplan result */ int32 firstColTypmod; /* Typmod of first column of subplan result */ Oid firstColCollation; /* Collation of first column of * subplan result */ /* Information about execution strategy: */ bool useHashTable; /* TRUE to store subselect output in a hash * table (implies we are doing "IN") */ bool unknownEqFalse; /* TRUE if it's okay to return FALSE when the * spec result is UNKNOWN; this allows much * simpler handling of null values */ /* Information for passing params into and out of the subselect: */ /* setParam and parParam are lists of integers (param IDs) */ List *setParam; /* initplan subqueries have to set these * Params for parent plan */ List *parParam; /* indices of input Params from parent plan */ List *args; /* exprs to pass as parParam values */ /* Estimated execution costs: */ Cost startup_cost; /* one-time setup cost */ Cost per_call_cost; /* cost for each subplan evaluation */ } SubPlan; /* * AlternativeSubPlan - expression node for a choice among SubPlans * * The subplans are given as a List so that the node definition need not * change if there's ever more than two alternatives. For the moment, * though, there are always exactly two; and the first one is the fast-start * plan. */ typedef struct AlternativeSubPlan { Expr xpr; List *subplans; /* SubPlan(s) with equivalent results */ } AlternativeSubPlan; /* ---------------- * FieldSelect * * FieldSelect represents the operation of extracting one field from a tuple * value. At runtime, the input expression is expected to yield a rowtype * Datum. The specified field number is extracted and returned as a Datum. * ---------------- */ typedef struct FieldSelect { Expr xpr; Expr *arg; /* input expression */ AttrNumber fieldnum; /* attribute number of field to extract */ Oid resulttype; /* type of the field (result type of this * node) */ int32 resulttypmod; /* output typmod (usually -1) */ Oid resultcollid; /* OID of collation of the field */ } FieldSelect; /* ---------------- * FieldStore * * FieldStore represents the operation of modifying one field in a tuple * value, yielding a new tuple value (the input is not touched!). Like * the assign case of ArrayRef, this is used to implement UPDATE of a * portion of a column. * * A single FieldStore can actually represent updates of several different * fields. The parser only generates FieldStores with single-element lists, * but the planner will collapse multiple updates of the same base column * into one FieldStore. * ---------------- */ typedef struct FieldStore { Expr xpr; Expr *arg; /* input tuple value */ List *newvals; /* new value(s) for field(s) */ List *fieldnums; /* integer list of field attnums */ Oid resulttype; /* type of result (same as type of arg) */ /* Like RowExpr, we deliberately omit a typmod and collation here */ } FieldStore; /* ---------------- * RelabelType * * RelabelType represents a "dummy" type coercion between two binary- * compatible datatypes, such as reinterpreting the result of an OID * expression as an int4. It is a no-op at runtime; we only need it * to provide a place to store the correct type to be attributed to * the expression result during type resolution. (We can't get away * with just overwriting the type field of the input expression node, * so we need a separate node to show the coercion's result type.) * ---------------- */ typedef struct RelabelType { Expr xpr; Expr *arg; /* input expression */ Oid resulttype; /* output type of coercion expression */ int32 resulttypmod; /* output typmod (usually -1) */ Oid resultcollid; /* OID of collation, or InvalidOid if none */ CoercionForm relabelformat; /* how to display this node */ int location; /* token location, or -1 if unknown */ } RelabelType; /* ---------------- * CoerceViaIO * * CoerceViaIO represents a type coercion between two types whose textual * representations are compatible, implemented by invoking the source type's * typoutput function then the destination type's typinput function. * ---------------- */ typedef struct CoerceViaIO { Expr xpr; Expr *arg; /* input expression */ Oid resulttype; /* output type of coercion */ /* output typmod is not stored, but is presumed -1 */ Oid resultcollid; /* OID of collation, or InvalidOid if none */ CoercionForm coerceformat; /* how to display this node */ int location; /* token location, or -1 if unknown */ } CoerceViaIO; /* ---------------- * ArrayCoerceExpr * * ArrayCoerceExpr represents a type coercion from one array type to another, * which is implemented by applying the indicated element-type coercion * function to each element of the source array. If elemfuncid is InvalidOid * then the element types are binary-compatible, but the coercion still * requires some effort (we have to fix the element type ID stored in the * array header). * ---------------- */ typedef struct ArrayCoerceExpr { Expr xpr; Expr *arg; /* input expression (yields an array) */ Oid elemfuncid; /* OID of element coercion function, or 0 */ Oid resulttype; /* output type of coercion (an array type) */ int32 resulttypmod; /* output typmod (also element typmod) */ Oid resultcollid; /* OID of collation, or InvalidOid if none */ bool isExplicit; /* conversion semantics flag to pass to func */ CoercionForm coerceformat; /* how to display this node */ int location; /* token location, or -1 if unknown */ } ArrayCoerceExpr; /* ---------------- * ConvertRowtypeExpr * * ConvertRowtypeExpr represents a type coercion from one composite type * to another, where the source type is guaranteed to contain all the columns * needed for the destination type plus possibly others; the columns need not * be in the same positions, but are matched up by name. This is primarily * used to convert a whole-row value of an inheritance child table into a * valid whole-row value of its parent table's rowtype. * ---------------- */ typedef struct ConvertRowtypeExpr { Expr xpr; Expr *arg; /* input expression */ Oid resulttype; /* output type (always a composite type) */ /* Like RowExpr, we deliberately omit a typmod and collation here */ CoercionForm convertformat; /* how to display this node */ int location; /* token location, or -1 if unknown */ } ConvertRowtypeExpr; /*---------- * CollateExpr - COLLATE * * The planner replaces CollateExpr with RelabelType during expression * preprocessing, so execution never sees a CollateExpr. *---------- */ typedef struct CollateExpr { Expr xpr; Expr *arg; /* input expression */ Oid collOid; /* collation's OID */ int location; /* token location, or -1 if unknown */ } CollateExpr; /*---------- * CaseExpr - a CASE expression * * We support two distinct forms of CASE expression: * CASE WHEN boolexpr THEN expr [ WHEN boolexpr THEN expr ... ] * CASE testexpr WHEN compexpr THEN expr [ WHEN compexpr THEN expr ... ] * These are distinguishable by the "arg" field being NULL in the first case * and the testexpr in the second case. * * In the raw grammar output for the second form, the condition expressions * of the WHEN clauses are just the comparison values. Parse analysis * converts these to valid boolean expressions of the form * CaseTestExpr '=' compexpr * where the CaseTestExpr node is a placeholder that emits the correct * value at runtime. This structure is used so that the testexpr need be * evaluated only once. Note that after parse analysis, the condition * expressions always yield boolean. * * Note: we can test whether a CaseExpr has been through parse analysis * yet by checking whether casetype is InvalidOid or not. *---------- */ typedef struct CaseExpr { Expr xpr; Oid casetype; /* type of expression result */ Oid casecollid; /* OID of collation, or InvalidOid if none */ Expr *arg; /* implicit equality comparison argument */ List *args; /* the arguments (list of WHEN clauses) */ Expr *defresult; /* the default result (ELSE clause) */ int location; /* token location, or -1 if unknown */ } CaseExpr; /* * CaseWhen - one arm of a CASE expression */ typedef struct CaseWhen { Expr xpr; Expr *expr; /* condition expression */ Expr *result; /* substitution result */ int location; /* token location, or -1 if unknown */ } CaseWhen; /* * Placeholder node for the test value to be processed by a CASE expression. * This is effectively like a Param, but can be implemented more simply * since we need only one replacement value at a time. * * We also use this in nested UPDATE expressions. * See transformAssignmentIndirection(). */ typedef struct CaseTestExpr { Expr xpr; Oid typeId; /* type for substituted value */ int32 typeMod; /* typemod for substituted value */ Oid collation; /* collation for the substituted value */ } CaseTestExpr; /* * ArrayExpr - an ARRAY[] expression * * Note: if multidims is false, the constituent expressions all yield the * scalar type identified by element_typeid. If multidims is true, the * constituent expressions all yield arrays of element_typeid (ie, the same * type as array_typeid); at runtime we must check for compatible subscripts. */ typedef struct ArrayExpr { Expr xpr; Oid array_typeid; /* type of expression result */ Oid array_collid; /* OID of collation, or InvalidOid if none */ Oid element_typeid; /* common type of array elements */ List *elements; /* the array elements or sub-arrays */ bool multidims; /* true if elements are sub-arrays */ int location; /* token location, or -1 if unknown */ } ArrayExpr; /* * RowExpr - a ROW() expression * * Note: the list of fields must have a one-for-one correspondence with * physical fields of the associated rowtype, although it is okay for it * to be shorter than the rowtype. That is, the N'th list element must * match up with the N'th physical field. When the N'th physical field * is a dropped column (attisdropped) then the N'th list element can just * be a NULL constant. (This case can only occur for named composite types, * not RECORD types, since those are built from the RowExpr itself rather * than vice versa.) It is important not to assume that length(args) is * the same as the number of columns logically present in the rowtype. * * colnames provides field names in cases where the names can't easily be * obtained otherwise. Names *must* be provided if row_typeid is RECORDOID. * If row_typeid identifies a known composite type, colnames can be NIL to * indicate the type's cataloged field names apply. Note that colnames can * be non-NIL even for a composite type, and typically is when the RowExpr * was created by expanding a whole-row Var. This is so that we can retain * the column alias names of the RTE that the Var referenced (which would * otherwise be very difficult to extract from the parsetree). Like the * args list, colnames is one-for-one with physical fields of the rowtype. */ typedef struct RowExpr { Expr xpr; List *args; /* the fields */ Oid row_typeid; /* RECORDOID or a composite type's ID */ /* * Note: we deliberately do NOT store a typmod. Although a typmod will be * associated with specific RECORD types at runtime, it will differ for * different backends, and so cannot safely be stored in stored * parsetrees. We must assume typmod -1 for a RowExpr node. * * We don't need to store a collation either. The result type is * necessarily composite, and composite types never have a collation. */ CoercionForm row_format; /* how to display this node */ List *colnames; /* list of String, or NIL */ int location; /* token location, or -1 if unknown */ } RowExpr; /* * RowCompareExpr - row-wise comparison, such as (a, b) <= (1, 2) * * We support row comparison for any operator that can be determined to * act like =, <>, <, <=, >, or >= (we determine this by looking for the * operator in btree opfamilies). Note that the same operator name might * map to a different operator for each pair of row elements, since the * element datatypes can vary. * * A RowCompareExpr node is only generated for the < <= > >= cases; * the = and <> cases are translated to simple AND or OR combinations * of the pairwise comparisons. However, we include = and <> in the * RowCompareType enum for the convenience of parser logic. */ typedef enum RowCompareType { /* Values of this enum are chosen to match btree strategy numbers */ ROWCOMPARE_LT = 1, /* BTLessStrategyNumber */ ROWCOMPARE_LE = 2, /* BTLessEqualStrategyNumber */ ROWCOMPARE_EQ = 3, /* BTEqualStrategyNumber */ ROWCOMPARE_GE = 4, /* BTGreaterEqualStrategyNumber */ ROWCOMPARE_GT = 5, /* BTGreaterStrategyNumber */ ROWCOMPARE_NE = 6 /* no such btree strategy */ } RowCompareType; typedef struct RowCompareExpr { Expr xpr; RowCompareType rctype; /* LT LE GE or GT, never EQ or NE */ List *opnos; /* OID list of pairwise comparison ops */ List *opfamilies; /* OID list of containing operator families */ List *inputcollids; /* OID list of collations for comparisons */ List *largs; /* the left-hand input arguments */ List *rargs; /* the right-hand input arguments */ } RowCompareExpr; /* * CoalesceExpr - a COALESCE expression */ typedef struct CoalesceExpr { Expr xpr; Oid coalescetype; /* type of expression result */ Oid coalescecollid; /* OID of collation, or InvalidOid if none */ List *args; /* the arguments */ int location; /* token location, or -1 if unknown */ } CoalesceExpr; /* * MinMaxExpr - a GREATEST or LEAST function */ typedef enum MinMaxOp { IS_GREATEST, IS_LEAST } MinMaxOp; typedef struct MinMaxExpr { Expr xpr; Oid minmaxtype; /* common type of arguments and result */ Oid minmaxcollid; /* OID of collation of result */ Oid inputcollid; /* OID of collation that function should use */ MinMaxOp op; /* function to execute */ List *args; /* the arguments */ int location; /* token location, or -1 if unknown */ } MinMaxExpr; /* * XmlExpr - various SQL/XML functions requiring special grammar productions * * 'name' carries the "NAME foo" argument (already XML-escaped). * 'named_args' and 'arg_names' represent an xml_attribute list. * 'args' carries all other arguments. * * Note: result type/typmod/collation are not stored, but can be deduced * from the XmlExprOp. The type/typmod fields are just used for display * purposes, and are NOT necessarily the true result type of the node. * (We also use type == InvalidOid to mark a not-yet-parse-analyzed XmlExpr.) */ typedef enum XmlExprOp { IS_XMLCONCAT, /* XMLCONCAT(args) */ IS_XMLELEMENT, /* XMLELEMENT(name, xml_attributes, args) */ IS_XMLFOREST, /* XMLFOREST(xml_attributes) */ IS_XMLPARSE, /* XMLPARSE(text, is_doc, preserve_ws) */ IS_XMLPI, /* XMLPI(name [, args]) */ IS_XMLROOT, /* XMLROOT(xml, version, standalone) */ IS_XMLSERIALIZE, /* XMLSERIALIZE(is_document, xmlval) */ IS_DOCUMENT /* xmlval IS DOCUMENT */ } XmlExprOp; typedef enum { XMLOPTION_DOCUMENT, XMLOPTION_CONTENT } XmlOptionType; typedef struct XmlExpr { Expr xpr; XmlExprOp op; /* xml function ID */ char *name; /* name in xml(NAME foo ...) syntaxes */ List *named_args; /* non-XML expressions for xml_attributes */ List *arg_names; /* parallel list of Value strings */ List *args; /* list of expressions */ XmlOptionType xmloption; /* DOCUMENT or CONTENT */ Oid type; /* target type/typmod for XMLSERIALIZE */ int32 typmod; int location; /* token location, or -1 if unknown */ } XmlExpr; /* ---------------- * NullTest * * NullTest represents the operation of testing a value for NULLness. * The appropriate test is performed and returned as a boolean Datum. * * When argisrow is false, this simply represents a test for the null value. * * When argisrow is true, the input expression must yield a rowtype, and * the node implements "row IS [NOT] NULL" per the SQL standard. This * includes checking individual fields for NULLness when the row datum * itself isn't NULL. * * NOTE: the combination of a rowtype input and argisrow==false does NOT * correspond to the SQL notation "row IS [NOT] NULL"; instead, this case * represents the SQL notation "row IS [NOT] DISTINCT FROM NULL". * ---------------- */ typedef enum NullTestType { IS_NULL, IS_NOT_NULL } NullTestType; typedef struct NullTest { Expr xpr; Expr *arg; /* input expression */ NullTestType nulltesttype; /* IS NULL, IS NOT NULL */ bool argisrow; /* T to perform field-by-field null checks */ } NullTest; /* * BooleanTest * * BooleanTest represents the operation of determining whether a boolean * is TRUE, FALSE, or UNKNOWN (ie, NULL). All six meaningful combinations * are supported. Note that a NULL input does *not* cause a NULL result. * The appropriate test is performed and returned as a boolean Datum. */ typedef enum BoolTestType { IS_TRUE, IS_NOT_TRUE, IS_FALSE, IS_NOT_FALSE, IS_UNKNOWN, IS_NOT_UNKNOWN } BoolTestType; typedef struct BooleanTest { Expr xpr; Expr *arg; /* input expression */ BoolTestType booltesttype; /* test type */ } BooleanTest; /* * CoerceToDomain * * CoerceToDomain represents the operation of coercing a value to a domain * type. At runtime (and not before) the precise set of constraints to be * checked will be determined. If the value passes, it is returned as the * result; if not, an error is raised. Note that this is equivalent to * RelabelType in the scenario where no constraints are applied. */ typedef struct CoerceToDomain { Expr xpr; Expr *arg; /* input expression */ Oid resulttype; /* domain type ID (result type) */ int32 resulttypmod; /* output typmod (currently always -1) */ Oid resultcollid; /* OID of collation, or InvalidOid if none */ CoercionForm coercionformat; /* how to display this node */ int location; /* token location, or -1 if unknown */ } CoerceToDomain; /* * Placeholder node for the value to be processed by a domain's check * constraint. This is effectively like a Param, but can be implemented more * simply since we need only one replacement value at a time. * * Note: the typeId/typeMod/collation will be set from the domain's base type, * not the domain itself. This is because we shouldn't consider the value * to be a member of the domain if we haven't yet checked its constraints. */ typedef struct CoerceToDomainValue { Expr xpr; Oid typeId; /* type for substituted value */ int32 typeMod; /* typemod for substituted value */ Oid collation; /* collation for the substituted value */ int location; /* token location, or -1 if unknown */ } CoerceToDomainValue; /* * Placeholder node for a DEFAULT marker in an INSERT or UPDATE command. * * This is not an executable expression: it must be replaced by the actual * column default expression during rewriting. But it is convenient to * treat it as an expression node during parsing and rewriting. */ typedef struct SetToDefault { Expr xpr; Oid typeId; /* type for substituted value */ int32 typeMod; /* typemod for substituted value */ Oid collation; /* collation for the substituted value */ int location; /* token location, or -1 if unknown */ } SetToDefault; /* * Node representing [WHERE] CURRENT OF cursor_name * * CURRENT OF is a bit like a Var, in that it carries the rangetable index * of the target relation being constrained; this aids placing the expression * correctly during planning. We can assume however that its "levelsup" is * always zero, due to the syntactic constraints on where it can appear. * * The referenced cursor can be represented either as a hardwired string * or as a reference to a run-time parameter of type REFCURSOR. The latter * case is for the convenience of plpgsql. */ typedef struct CurrentOfExpr { Expr xpr; Index cvarno; /* RT index of target relation */ char *cursor_name; /* name of referenced cursor, or NULL */ int cursor_param; /* refcursor parameter number, or 0 */ } CurrentOfExpr; /*-------------------- * TargetEntry - * a target entry (used in query target lists) * * Strictly speaking, a TargetEntry isn't an expression node (since it can't * be evaluated by ExecEvalExpr). But we treat it as one anyway, since in * very many places it's convenient to process a whole query targetlist as a * single expression tree. * * In a SELECT's targetlist, resno should always be equal to the item's * ordinal position (counting from 1). However, in an INSERT or UPDATE * targetlist, resno represents the attribute number of the destination * column for the item; so there may be missing or out-of-order resnos. * It is even legal to have duplicated resnos; consider * UPDATE table SET arraycol[1] = ..., arraycol[2] = ..., ... * The two meanings come together in the executor, because the planner * transforms INSERT/UPDATE tlists into a normalized form with exactly * one entry for each column of the destination table. Before that's * happened, however, it is risky to assume that resno == position. * Generally get_tle_by_resno() should be used rather than list_nth() * to fetch tlist entries by resno, and only in SELECT should you assume * that resno is a unique identifier. * * resname is required to represent the correct column name in non-resjunk * entries of top-level SELECT targetlists, since it will be used as the * column title sent to the frontend. In most other contexts it is only * a debugging aid, and may be wrong or even NULL. (In particular, it may * be wrong in a tlist from a stored rule, if the referenced column has been * renamed by ALTER TABLE since the rule was made. Also, the planner tends * to store NULL rather than look up a valid name for tlist entries in * non-toplevel plan nodes.) In resjunk entries, resname should be either * a specific system-generated name (such as "ctid") or NULL; anything else * risks confusing ExecGetJunkAttribute! * * ressortgroupref is used in the representation of ORDER BY, GROUP BY, and * DISTINCT items. Targetlist entries with ressortgroupref=0 are not * sort/group items. If ressortgroupref>0, then this item is an ORDER BY, * GROUP BY, and/or DISTINCT target value. No two entries in a targetlist * may have the same nonzero ressortgroupref --- but there is no particular * meaning to the nonzero values, except as tags. (For example, one must * not assume that lower ressortgroupref means a more significant sort key.) * The order of the associated SortGroupClause lists determine the semantics. * * resorigtbl/resorigcol identify the source of the column, if it is a * simple reference to a column of a base table (or view). If it is not * a simple reference, these fields are zeroes. * * If resjunk is true then the column is a working column (such as a sort key) * that should be removed from the final output of the query. Resjunk columns * must have resnos that cannot duplicate any regular column's resno. Also * note that there are places that assume resjunk columns come after non-junk * columns. *-------------------- */ typedef struct TargetEntry { Expr xpr; Expr *expr; /* expression to evaluate */ AttrNumber resno; /* attribute number (see notes above) */ char *resname; /* name of the column (could be NULL) */ Index ressortgroupref;/* nonzero if referenced by a sort/group * clause */ Oid resorigtbl; /* OID of column's source table */ AttrNumber resorigcol; /* column's number in source table */ bool resjunk; /* set to true to eliminate the attribute from * final target list */ } TargetEntry; /* ---------------------------------------------------------------- * node types for join trees * * The leaves of a join tree structure are RangeTblRef nodes. Above * these, JoinExpr nodes can appear to denote a specific kind of join * or qualified join. Also, FromExpr nodes can appear to denote an * ordinary cross-product join ("FROM foo, bar, baz WHERE ..."). * FromExpr is like a JoinExpr of jointype JOIN_INNER, except that it * may have any number of child nodes, not just two. * * NOTE: the top level of a Query's jointree is always a FromExpr. * Even if the jointree contains no rels, there will be a FromExpr. * * NOTE: the qualification expressions present in JoinExpr nodes are * *in addition to* the query's main WHERE clause, which appears as the * qual of the top-level FromExpr. The reason for associating quals with * specific nodes in the jointree is that the position of a qual is critical * when outer joins are present. (If we enforce a qual too soon or too late, * that may cause the outer join to produce the wrong set of NULL-extended * rows.) If all joins are inner joins then all the qual positions are * semantically interchangeable. * * NOTE: in the raw output of gram.y, a join tree contains RangeVar, * RangeSubselect, and RangeFunction nodes, which are all replaced by * RangeTblRef nodes during the parse analysis phase. Also, the top-level * FromExpr is added during parse analysis; the grammar regards FROM and * WHERE as separate. * ---------------------------------------------------------------- */ /* * RangeTblRef - reference to an entry in the query's rangetable * * We could use direct pointers to the RT entries and skip having these * nodes, but multiple pointers to the same node in a querytree cause * lots of headaches, so it seems better to store an index into the RT. */ typedef struct RangeTblRef { NodeTag type; int rtindex; } RangeTblRef; /*---------- * JoinExpr - for SQL JOIN expressions * * isNatural, usingClause, and quals are interdependent. The user can write * only one of NATURAL, USING(), or ON() (this is enforced by the grammar). * If he writes NATURAL then parse analysis generates the equivalent USING() * list, and from that fills in "quals" with the right equality comparisons. * If he writes USING() then "quals" is filled with equality comparisons. * If he writes ON() then only "quals" is set. Note that NATURAL/USING * are not equivalent to ON() since they also affect the output column list. * * alias is an Alias node representing the AS alias-clause attached to the * join expression, or NULL if no clause. NB: presence or absence of the * alias has a critical impact on semantics, because a join with an alias * restricts visibility of the tables/columns inside it. * * During parse analysis, an RTE is created for the Join, and its index * is filled into rtindex. This RTE is present mainly so that Vars can * be created that refer to the outputs of the join. The planner sometimes * generates JoinExprs internally; these can have rtindex = 0 if there are * no join alias variables referencing such joins. *---------- */ typedef struct JoinExpr { NodeTag type; JoinType jointype; /* type of join */ bool isNatural; /* Natural join? Will need to shape table */ Node *larg; /* left subtree */ Node *rarg; /* right subtree */ List *usingClause; /* USING clause, if any (list of String) */ Node *quals; /* qualifiers on join, if any */ Alias *alias; /* user-written alias clause, if any */ int rtindex; /* RT index assigned for join, or 0 */ } JoinExpr; /*---------- * FromExpr - represents a FROM ... WHERE ... construct * * This is both more flexible than a JoinExpr (it can have any number of * children, including zero) and less so --- we don't need to deal with * aliases and so on. The output column set is implicitly just the union * of the outputs of the children. *---------- */ typedef struct FromExpr { NodeTag type; List *fromlist; /* List of join subtrees */ Node *quals; /* qualifiers on join, if any */ } FromExpr; #endif /* PRIMNODES_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/nodes/readfuncs.h����������������������������������������������������������������������0000644�����������������00000001601�14763166026�0012444 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * readfuncs.h * header file for read.c and readfuncs.c. These functions are internal * to the stringToNode interface and should not be used by anyone else. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/nodes/readfuncs.h * *------------------------------------------------------------------------- */ #ifndef READFUNCS_H #define READFUNCS_H #include "nodes/nodes.h" /* * prototypes for functions in read.c (the lisp token parser) */ extern char *pg_strtok(int *length); extern char *debackslash(char *token, int length); extern void *nodeRead(char *token, int tok_len); /* * prototypes for functions in readfuncs.c */ extern Node *parseNodeString(void); #endif /* READFUNCS_H */ �������������������������������������������������������������������������������������������������������������������������������pgsql/server/nodes/relation.h�����������������������������������������������������������������������0000644�����������������00000210203�14763166026�0012307 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * relation.h * Definitions for planner's internal data structures. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/nodes/relation.h * *------------------------------------------------------------------------- */ #ifndef RELATION_H #define RELATION_H #include "access/sdir.h" #include "nodes/params.h" #include "nodes/parsenodes.h" #include "storage/block.h" /* * Relids * Set of relation identifiers (indexes into the rangetable). */ typedef Bitmapset *Relids; /* * When looking for a "cheapest path", this enum specifies whether we want * cheapest startup cost or cheapest total cost. */ typedef enum CostSelector { STARTUP_COST, TOTAL_COST } CostSelector; /* * The cost estimate produced by cost_qual_eval() includes both a one-time * (startup) cost, and a per-tuple cost. */ typedef struct QualCost { Cost startup; /* one-time cost */ Cost per_tuple; /* per-evaluation cost */ } QualCost; /* * Costing aggregate function execution requires these statistics about * the aggregates to be executed by a given Agg node. Note that transCost * includes the execution costs of the aggregates' input expressions. */ typedef struct AggClauseCosts { int numAggs; /* total number of aggregate functions */ int numOrderedAggs; /* number that use DISTINCT or ORDER BY */ QualCost transCost; /* total per-input-row execution costs */ Cost finalCost; /* total costs of agg final functions */ Size transitionSpace; /* space for pass-by-ref transition data */ } AggClauseCosts; /*---------- * PlannerGlobal * Global information for planning/optimization * * PlannerGlobal holds state for an entire planner invocation; this state * is shared across all levels of sub-Queries that exist in the command being * planned. *---------- */ typedef struct PlannerGlobal { NodeTag type; ParamListInfo boundParams; /* Param values provided to planner() */ List *paramlist; /* unused, will be removed in 9.3 */ List *subplans; /* Plans for SubPlan nodes */ List *subroots; /* PlannerInfos for SubPlan nodes */ Bitmapset *rewindPlanIDs; /* indices of subplans that require REWIND */ List *finalrtable; /* "flat" rangetable for executor */ List *finalrowmarks; /* "flat" list of PlanRowMarks */ List *resultRelations; /* "flat" list of integer RT indexes */ List *relationOids; /* OIDs of relations the plan depends on */ List *invalItems; /* other dependencies, as PlanInvalItems */ Index lastPHId; /* highest PlaceHolderVar ID assigned */ Index lastRowMarkId; /* highest PlanRowMark ID assigned */ bool transientPlan; /* redo plan when TransactionXmin changes? */ /* Added post-release, will be in a saner place in 9.3: */ int nParamExec; /* number of PARAM_EXEC Params used */ } PlannerGlobal; /* macro for fetching the Plan associated with a SubPlan node */ #define planner_subplan_get_plan(root, subplan) \ ((Plan *) list_nth((root)->glob->subplans, (subplan)->plan_id - 1)) /*---------- * PlannerInfo * Per-query information for planning/optimization * * This struct is conventionally called "root" in all the planner routines. * It holds links to all of the planner's working state, in addition to the * original Query. Note that at present the planner extensively modifies * the passed-in Query data structure; someday that should stop. *---------- */ typedef struct PlannerInfo { NodeTag type; Query *parse; /* the Query being planned */ PlannerGlobal *glob; /* global info for current planner run */ Index query_level; /* 1 at the outermost Query */ struct PlannerInfo *parent_root; /* NULL at outermost Query */ /* * simple_rel_array holds pointers to "base rels" and "other rels" (see * comments for RelOptInfo for more info). It is indexed by rangetable * index (so entry 0 is always wasted). Entries can be NULL when an RTE * does not correspond to a base relation, such as a join RTE or an * unreferenced view RTE; or if the RelOptInfo hasn't been made yet. */ struct RelOptInfo **simple_rel_array; /* All 1-rel RelOptInfos */ int simple_rel_array_size; /* allocated size of array */ /* * simple_rte_array is the same length as simple_rel_array and holds * pointers to the associated rangetable entries. This lets us avoid * rt_fetch(), which can be a bit slow once large inheritance sets have * been expanded. */ RangeTblEntry **simple_rte_array; /* rangetable as an array */ /* * all_baserels is a Relids set of all base relids (but not "other" * relids) in the query; that is, the Relids identifier of the final join * we need to form. This is computed in make_one_rel, just before we * start making Paths. */ Relids all_baserels; /* * join_rel_list is a list of all join-relation RelOptInfos we have * considered in this planning run. For small problems we just scan the * list to do lookups, but when there are many join relations we build a * hash table for faster lookups. The hash table is present and valid * when join_rel_hash is not NULL. Note that we still maintain the list * even when using the hash table for lookups; this simplifies life for * GEQO. */ List *join_rel_list; /* list of join-relation RelOptInfos */ struct HTAB *join_rel_hash; /* optional hashtable for join relations */ /* * When doing a dynamic-programming-style join search, join_rel_level[k] * is a list of all join-relation RelOptInfos of level k, and * join_cur_level is the current level. New join-relation RelOptInfos are * automatically added to the join_rel_level[join_cur_level] list. * join_rel_level is NULL if not in use. */ List **join_rel_level; /* lists of join-relation RelOptInfos */ int join_cur_level; /* index of list being extended */ List *init_plans; /* init SubPlans for query */ List *cte_plan_ids; /* per-CTE-item list of subplan IDs */ List *eq_classes; /* list of active EquivalenceClasses */ List *canon_pathkeys; /* list of "canonical" PathKeys */ List *left_join_clauses; /* list of RestrictInfos for * mergejoinable outer join clauses * w/nonnullable var on left */ List *right_join_clauses; /* list of RestrictInfos for * mergejoinable outer join clauses * w/nonnullable var on right */ List *full_join_clauses; /* list of RestrictInfos for * mergejoinable full join clauses */ List *join_info_list; /* list of SpecialJoinInfos */ List *append_rel_list; /* list of AppendRelInfos */ List *rowMarks; /* list of PlanRowMarks */ List *placeholder_list; /* list of PlaceHolderInfos */ List *query_pathkeys; /* desired pathkeys for query_planner(), and * actual pathkeys after planning */ List *group_pathkeys; /* groupClause pathkeys, if any */ List *window_pathkeys; /* pathkeys of bottom window, if any */ List *distinct_pathkeys; /* distinctClause pathkeys, if any */ List *sort_pathkeys; /* sortClause pathkeys, if any */ List *minmax_aggs; /* List of MinMaxAggInfos */ List *initial_rels; /* RelOptInfos we are now trying to join */ MemoryContext planner_cxt; /* context holding PlannerInfo */ double total_table_pages; /* # of pages in all tables of query */ double tuple_fraction; /* tuple_fraction passed to query_planner */ double limit_tuples; /* limit_tuples passed to query_planner */ bool hasInheritedTarget; /* true if parse->resultRelation is an * inheritance child rel */ bool hasJoinRTEs; /* true if any RTEs are RTE_JOIN kind */ bool hasHavingQual; /* true if havingQual was non-null */ bool hasPseudoConstantQuals; /* true if any RestrictInfo has * pseudoconstant = true */ bool hasRecursion; /* true if planning a recursive WITH item */ /* These fields are used only when hasRecursion is true: */ int wt_param_id; /* PARAM_EXEC ID for the work table */ struct Plan *non_recursive_plan; /* plan for non-recursive term */ /* These fields are workspace for createplan.c */ Relids curOuterRels; /* outer rels above current node */ List *curOuterParams; /* not-yet-assigned NestLoopParams */ /* optional private data for join_search_hook, e.g., GEQO */ void *join_search_private; /* Added post-release, will be in a saner place in 9.3: */ List *plan_params; /* list of PlannerParamItems, see below */ /* This will be in a saner place in 9.4: */ Relids nullable_baserels; } PlannerInfo; /* * In places where it's known that simple_rte_array[] must have been prepared * already, we just index into it to fetch RTEs. In code that might be * executed before or after entering query_planner(), use this macro. */ #define planner_rt_fetch(rti, root) \ ((root)->simple_rte_array ? (root)->simple_rte_array[rti] : \ rt_fetch(rti, (root)->parse->rtable)) /*---------- * RelOptInfo * Per-relation information for planning/optimization * * For planning purposes, a "base rel" is either a plain relation (a table) * or the output of a sub-SELECT or function that appears in the range table. * In either case it is uniquely identified by an RT index. A "joinrel" * is the joining of two or more base rels. A joinrel is identified by * the set of RT indexes for its component baserels. We create RelOptInfo * nodes for each baserel and joinrel, and store them in the PlannerInfo's * simple_rel_array and join_rel_list respectively. * * Note that there is only one joinrel for any given set of component * baserels, no matter what order we assemble them in; so an unordered * set is the right datatype to identify it with. * * We also have "other rels", which are like base rels in that they refer to * single RT indexes; but they are not part of the join tree, and are given * a different RelOptKind to identify them. Lastly, there is a RelOptKind * for "dead" relations, which are base rels that we have proven we don't * need to join after all. * * Currently the only kind of otherrels are those made for member relations * of an "append relation", that is an inheritance set or UNION ALL subquery. * An append relation has a parent RTE that is a base rel, which represents * the entire append relation. The member RTEs are otherrels. The parent * is present in the query join tree but the members are not. The member * RTEs and otherrels are used to plan the scans of the individual tables or * subqueries of the append set; then the parent baserel is given Append * and/or MergeAppend paths comprising the best paths for the individual * member rels. (See comments for AppendRelInfo for more information.) * * At one time we also made otherrels to represent join RTEs, for use in * handling join alias Vars. Currently this is not needed because all join * alias Vars are expanded to non-aliased form during preprocess_expression. * * Parts of this data structure are specific to various scan and join * mechanisms. It didn't seem worth creating new node types for them. * * relids - Set of base-relation identifiers; it is a base relation * if there is just one, a join relation if more than one * rows - estimated number of tuples in the relation after restriction * clauses have been applied (ie, output rows of a plan for it) * width - avg. number of bytes per tuple in the relation after the * appropriate projections have been done (ie, output width) * reltargetlist - List of Var and PlaceHolderVar nodes for the values * we need to output from this relation. * List is in no particular order, but all rels of an * appendrel set must use corresponding orders. * NOTE: in a child relation, may contain RowExpr or * ConvertRowtypeExpr representing a whole-row Var. * pathlist - List of Path nodes, one for each potentially useful * method of generating the relation * ppilist - ParamPathInfo nodes for parameterized Paths, if any * cheapest_startup_path - the pathlist member with lowest startup cost * (regardless of its ordering; but must be * unparameterized) * cheapest_total_path - the pathlist member with lowest total cost * (regardless of its ordering; but must be * unparameterized) * cheapest_unique_path - for caching cheapest path to produce unique * (no duplicates) output from relation * cheapest_parameterized_paths - paths with cheapest total costs for * their parameterizations; always includes * cheapest_total_path * * If the relation is a base relation it will have these fields set: * * relid - RTE index (this is redundant with the relids field, but * is provided for convenience of access) * rtekind - distinguishes plain relation, subquery, or function RTE * min_attr, max_attr - range of valid AttrNumbers for rel * attr_needed - array of bitmapsets indicating the highest joinrel * in which each attribute is needed; if bit 0 is set then * the attribute is needed as part of final targetlist * attr_widths - cache space for per-attribute width estimates; * zero means not computed yet * indexlist - list of IndexOptInfo nodes for relation's indexes * (always NIL if it's not a table) * pages - number of disk pages in relation (zero if not a table) * tuples - number of tuples in relation (not considering restrictions) * allvisfrac - fraction of disk pages that are marked all-visible * subplan - plan for subquery (NULL if it's not a subquery) * subroot - PlannerInfo for subquery (NULL if it's not a subquery) * fdwroutine - function hooks for FDW, if foreign table (else NULL) * fdw_private - private state for FDW, if foreign table (else NULL) * * Note: for a subquery, tuples, subplan, subroot are not set immediately * upon creation of the RelOptInfo object; they are filled in when * set_subquery_pathlist processes the object. Likewise, fdwroutine * and fdw_private are filled during initial path creation. * * For otherrels that are appendrel members, these fields are filled * in just as for a baserel. * * The presence of the remaining fields depends on the restrictions * and joins that the relation participates in: * * baserestrictinfo - List of RestrictInfo nodes, containing info about * each non-join qualification clause in which this relation * participates (only used for base rels) * baserestrictcost - Estimated cost of evaluating the baserestrictinfo * clauses at a single tuple (only used for base rels) * joininfo - List of RestrictInfo nodes, containing info about each * join clause in which this relation participates (but * note this excludes clauses that might be derivable from * EquivalenceClasses) * has_eclass_joins - flag that EquivalenceClass joins are possible * * Note: Keeping a restrictinfo list in the RelOptInfo is useful only for * base rels, because for a join rel the set of clauses that are treated as * restrict clauses varies depending on which sub-relations we choose to join. * (For example, in a 3-base-rel join, a clause relating rels 1 and 2 must be * treated as a restrictclause if we join {1} and {2 3} to make {1 2 3}; but * if we join {1 2} and {3} then that clause will be a restrictclause in {1 2} * and should not be processed again at the level of {1 2 3}.) Therefore, * the restrictinfo list in the join case appears in individual JoinPaths * (field joinrestrictinfo), not in the parent relation. But it's OK for * the RelOptInfo to store the joininfo list, because that is the same * for a given rel no matter how we form it. * * We store baserestrictcost in the RelOptInfo (for base relations) because * we know we will need it at least once (to price the sequential scan) * and may need it multiple times to price index scans. *---------- */ typedef enum RelOptKind { RELOPT_BASEREL, RELOPT_JOINREL, RELOPT_OTHER_MEMBER_REL, RELOPT_DEADREL } RelOptKind; typedef struct RelOptInfo { NodeTag type; RelOptKind reloptkind; /* all relations included in this RelOptInfo */ Relids relids; /* set of base relids (rangetable indexes) */ /* size estimates generated by planner */ double rows; /* estimated number of result tuples */ int width; /* estimated avg width of result tuples */ /* materialization information */ List *reltargetlist; /* Vars to be output by scan of relation */ List *pathlist; /* Path structures */ List *ppilist; /* ParamPathInfos used in pathlist */ struct Path *cheapest_startup_path; struct Path *cheapest_total_path; struct Path *cheapest_unique_path; List *cheapest_parameterized_paths; /* information about a base rel (not set for join rels!) */ Index relid; Oid reltablespace; /* containing tablespace */ RTEKind rtekind; /* RELATION, SUBQUERY, or FUNCTION */ AttrNumber min_attr; /* smallest attrno of rel (often <0) */ AttrNumber max_attr; /* largest attrno of rel */ Relids *attr_needed; /* array indexed [min_attr .. max_attr] */ int32 *attr_widths; /* array indexed [min_attr .. max_attr] */ List *indexlist; /* list of IndexOptInfo */ BlockNumber pages; /* size estimates derived from pg_class */ double tuples; double allvisfrac; /* use "struct Plan" to avoid including plannodes.h here */ struct Plan *subplan; /* if subquery */ PlannerInfo *subroot; /* if subquery */ /* use "struct FdwRoutine" to avoid including fdwapi.h here */ struct FdwRoutine *fdwroutine; /* if foreign table */ void *fdw_private; /* if foreign table */ /* used by various scans and joins: */ List *baserestrictinfo; /* RestrictInfo structures (if base * rel) */ QualCost baserestrictcost; /* cost of evaluating the above */ List *joininfo; /* RestrictInfo structures for join clauses * involving this rel */ bool has_eclass_joins; /* T means joininfo is incomplete */ } RelOptInfo; /* * IndexOptInfo * Per-index information for planning/optimization * * indexkeys[], indexcollations[], opfamily[], and opcintype[] * each have ncolumns entries. * * sortopfamily[], reverse_sort[], and nulls_first[] likewise have * ncolumns entries, if the index is ordered; but if it is unordered, * those pointers are NULL. * * Zeroes in the indexkeys[] array indicate index columns that are * expressions; there is one element in indexprs for each such column. * * For an ordered index, reverse_sort[] and nulls_first[] describe the * sort ordering of a forward indexscan; we can also consider a backward * indexscan, which will generate the reverse ordering. * * The indexprs and indpred expressions have been run through * prepqual.c and eval_const_expressions() for ease of matching to * WHERE clauses. indpred is in implicit-AND form. * * indextlist is a TargetEntry list representing the index columns. * It provides an equivalent base-relation Var for each simple column, * and links to the matching indexprs element for each expression column. */ typedef struct IndexOptInfo { NodeTag type; Oid indexoid; /* OID of the index relation */ Oid reltablespace; /* tablespace of index (not table) */ RelOptInfo *rel; /* back-link to index's table */ /* statistics from pg_class */ BlockNumber pages; /* number of disk pages in index */ double tuples; /* number of index tuples in index */ /* index descriptor information */ int ncolumns; /* number of columns in index */ int *indexkeys; /* column numbers of index's keys, or 0 */ Oid *indexcollations; /* OIDs of collations of index columns */ Oid *opfamily; /* OIDs of operator families for columns */ Oid *opcintype; /* OIDs of opclass declared input data types */ Oid *sortopfamily; /* OIDs of btree opfamilies, if orderable */ bool *reverse_sort; /* is sort order descending? */ bool *nulls_first; /* do NULLs come first in the sort order? */ Oid relam; /* OID of the access method (in pg_am) */ RegProcedure amcostestimate; /* OID of the access method's cost fcn */ List *indexprs; /* expressions for non-simple index columns */ List *indpred; /* predicate if a partial index, else NIL */ List *indextlist; /* targetlist representing index columns */ bool predOK; /* true if predicate matches query */ bool unique; /* true if a unique index */ bool immediate; /* is uniqueness enforced immediately? */ bool hypothetical; /* true if index doesn't really exist */ bool canreturn; /* can index return IndexTuples? */ bool amcanorderbyop; /* does AM support order by operator result? */ bool amoptionalkey; /* can query omit key for the first column? */ bool amsearcharray; /* can AM handle ScalarArrayOpExpr quals? */ bool amsearchnulls; /* can AM search for NULL/NOT NULL entries? */ bool amhasgettuple; /* does AM have amgettuple interface? */ bool amhasgetbitmap; /* does AM have amgetbitmap interface? */ } IndexOptInfo; /* * EquivalenceClasses * * Whenever we can determine that a mergejoinable equality clause A = B is * not delayed by any outer join, we create an EquivalenceClass containing * the expressions A and B to record this knowledge. If we later find another * equivalence B = C, we add C to the existing EquivalenceClass; this may * require merging two existing EquivalenceClasses. At the end of the qual * distribution process, we have sets of values that are known all transitively * equal to each other, where "equal" is according to the rules of the btree * operator family(s) shown in ec_opfamilies, as well as the collation shown * by ec_collation. (We restrict an EC to contain only equalities whose * operators belong to the same set of opfamilies. This could probably be * relaxed, but for now it's not worth the trouble, since nearly all equality * operators belong to only one btree opclass anyway. Similarly, we suppose * that all or none of the input datatypes are collatable, so that a single * collation value is sufficient.) * * We also use EquivalenceClasses as the base structure for PathKeys, letting * us represent knowledge about different sort orderings being equivalent. * Since every PathKey must reference an EquivalenceClass, we will end up * with single-member EquivalenceClasses whenever a sort key expression has * not been equivalenced to anything else. It is also possible that such an * EquivalenceClass will contain a volatile expression ("ORDER BY random()"), * which is a case that can't arise otherwise since clauses containing * volatile functions are never considered mergejoinable. We mark such * EquivalenceClasses specially to prevent them from being merged with * ordinary EquivalenceClasses. Also, for volatile expressions we have * to be careful to match the EquivalenceClass to the correct targetlist * entry: consider SELECT random() AS a, random() AS b ... ORDER BY b,a. * So we record the SortGroupRef of the originating sort clause. * * We allow equality clauses appearing below the nullable side of an outer join * to form EquivalenceClasses, but these have a slightly different meaning: * the included values might be all NULL rather than all the same non-null * values. See src/backend/optimizer/README for more on that point. * * NB: if ec_merged isn't NULL, this class has been merged into another, and * should be ignored in favor of using the pointed-to class. */ typedef struct EquivalenceClass { NodeTag type; List *ec_opfamilies; /* btree operator family OIDs */ Oid ec_collation; /* collation, if datatypes are collatable */ List *ec_members; /* list of EquivalenceMembers */ List *ec_sources; /* list of generating RestrictInfos */ List *ec_derives; /* list of derived RestrictInfos */ Relids ec_relids; /* all relids appearing in ec_members */ bool ec_has_const; /* any pseudoconstants in ec_members? */ bool ec_has_volatile; /* the (sole) member is a volatile expr */ bool ec_below_outer_join; /* equivalence applies below an OJ */ bool ec_broken; /* failed to generate needed clauses? */ Index ec_sortref; /* originating sortclause label, or 0 */ struct EquivalenceClass *ec_merged; /* set if merged into another EC */ } EquivalenceClass; /* * If an EC contains a const and isn't below-outer-join, any PathKey depending * on it must be redundant, since there's only one possible value of the key. */ #define EC_MUST_BE_REDUNDANT(eclass) \ ((eclass)->ec_has_const && !(eclass)->ec_below_outer_join) /* * EquivalenceMember - one member expression of an EquivalenceClass * * em_is_child signifies that this element was built by transposing a member * for an appendrel parent relation to represent the corresponding expression * for an appendrel child. These members are used for determining the * pathkeys of scans on the child relation and for explicitly sorting the * child when necessary to build a MergeAppend path for the whole appendrel * tree. An em_is_child member has no impact on the properties of the EC as a * whole; in particular the EC's ec_relids field does NOT include the child * relation. An em_is_child member should never be marked em_is_const nor * cause ec_has_const or ec_has_volatile to be set, either. Thus, em_is_child * members are not really full-fledged members of the EC, but just reflections * or doppelgangers of real members. Most operations on EquivalenceClasses * should ignore em_is_child members, and those that don't should test * em_relids to make sure they only consider relevant members. * * em_datatype is usually the same as exprType(em_expr), but can be * different when dealing with a binary-compatible opfamily; in particular * anyarray_ops would never work without this. Use em_datatype when * looking up a specific btree operator to work with this expression. */ typedef struct EquivalenceMember { NodeTag type; Expr *em_expr; /* the expression represented */ Relids em_relids; /* all relids appearing in em_expr */ Relids em_nullable_relids; /* nullable by lower outer joins */ bool em_is_const; /* expression is pseudoconstant? */ bool em_is_child; /* derived version for a child relation? */ Oid em_datatype; /* the "nominal type" used by the opfamily */ } EquivalenceMember; /* * PathKeys * * The sort ordering of a path is represented by a list of PathKey nodes. * An empty list implies no known ordering. Otherwise the first item * represents the primary sort key, the second the first secondary sort key, * etc. The value being sorted is represented by linking to an * EquivalenceClass containing that value and including pk_opfamily among its * ec_opfamilies. The EquivalenceClass tells which collation to use, too. * This is a convenient method because it makes it trivial to detect * equivalent and closely-related orderings. (See optimizer/README for more * information.) * * Note: pk_strategy is either BTLessStrategyNumber (for ASC) or * BTGreaterStrategyNumber (for DESC). We assume that all ordering-capable * index types will use btree-compatible strategy numbers. */ typedef struct PathKey { NodeTag type; EquivalenceClass *pk_eclass; /* the value that is ordered */ Oid pk_opfamily; /* btree opfamily defining the ordering */ int pk_strategy; /* sort direction (ASC or DESC) */ bool pk_nulls_first; /* do NULLs come before normal values? */ } PathKey; /* * ParamPathInfo * * All parameterized paths for a given relation with given required outer rels * link to a single ParamPathInfo, which stores common information such as * the estimated rowcount for this parameterization. We do this partly to * avoid recalculations, but mostly to ensure that the estimated rowcount * is in fact the same for every such path. * * Note: ppi_clauses is only used in ParamPathInfos for base relation paths; * in join cases it's NIL because the set of relevant clauses varies depending * on how the join is formed. The relevant clauses will appear in each * parameterized join path's joinrestrictinfo list, instead. */ typedef struct ParamPathInfo { NodeTag type; Relids ppi_req_outer; /* rels supplying parameters used by path */ double ppi_rows; /* estimated number of result tuples */ List *ppi_clauses; /* join clauses available from outer rels */ } ParamPathInfo; /* * Type "Path" is used as-is for sequential-scan paths, as well as some other * simple plan types that we don't need any extra information in the path for. * For other path types it is the first component of a larger struct. * * "pathtype" is the NodeTag of the Plan node we could build from this Path. * It is partially redundant with the Path's NodeTag, but allows us to use * the same Path type for multiple Plan types when there is no need to * distinguish the Plan type during path processing. * * "param_info", if not NULL, links to a ParamPathInfo that identifies outer * relation(s) that provide parameter values to each scan of this path. * That means this path can only be joined to those rels by means of nestloop * joins with this path on the inside. Also note that a parameterized path * is responsible for testing all "movable" joinclauses involving this rel * and the specified outer rel(s). * * "rows" is the same as parent->rows in simple paths, but in parameterized * paths and UniquePaths it can be less than parent->rows, reflecting the * fact that we've filtered by extra join conditions or removed duplicates. * * "pathkeys" is a List of PathKey nodes (see above), describing the sort * ordering of the path's output rows. */ typedef struct Path { NodeTag type; NodeTag pathtype; /* tag identifying scan/join method */ RelOptInfo *parent; /* the relation this path can build */ ParamPathInfo *param_info; /* parameterization info, or NULL if none */ /* estimated size/costs for path (see costsize.c for more info) */ double rows; /* estimated number of result tuples */ Cost startup_cost; /* cost expended before fetching any tuples */ Cost total_cost; /* total cost (assuming all tuples fetched) */ List *pathkeys; /* sort ordering of path's output */ /* pathkeys is a List of PathKey nodes; see above */ } Path; /* Macro for extracting a path's parameterization relids; beware double eval */ #define PATH_REQ_OUTER(path) \ ((path)->param_info ? (path)->param_info->ppi_req_outer : (Relids) NULL) /*---------- * IndexPath represents an index scan over a single index. * * This struct is used for both regular indexscans and index-only scans; * path.pathtype is T_IndexScan or T_IndexOnlyScan to show which is meant. * * 'indexinfo' is the index to be scanned. * * 'indexclauses' is a list of index qualification clauses, with implicit * AND semantics across the list. Each clause is a RestrictInfo node from * the query's WHERE or JOIN conditions. An empty list implies a full * index scan. * * 'indexquals' has the same structure as 'indexclauses', but it contains * the actual index qual conditions that can be used with the index. * In simple cases this is identical to 'indexclauses', but when special * indexable operators appear in 'indexclauses', they are replaced by the * derived indexscannable conditions in 'indexquals'. * * 'indexqualcols' is an integer list of index column numbers (zero-based) * of the same length as 'indexquals', showing which index column each qual * is meant to be used with. 'indexquals' is required to be ordered by * index column, so 'indexqualcols' must form a nondecreasing sequence. * (The order of multiple quals for the same index column is unspecified.) * * 'indexorderbys', if not NIL, is a list of ORDER BY expressions that have * been found to be usable as ordering operators for an amcanorderbyop index. * The list must match the path's pathkeys, ie, one expression per pathkey * in the same order. These are not RestrictInfos, just bare expressions, * since they generally won't yield booleans. Also, unlike the case for * quals, it's guaranteed that each expression has the index key on the left * side of the operator. * * 'indexorderbycols' is an integer list of index column numbers (zero-based) * of the same length as 'indexorderbys', showing which index column each * ORDER BY expression is meant to be used with. (There is no restriction * on which index column each ORDER BY can be used with.) * * 'indexscandir' is one of: * ForwardScanDirection: forward scan of an ordered index * BackwardScanDirection: backward scan of an ordered index * NoMovementScanDirection: scan of an unordered index, or don't care * (The executor doesn't care whether it gets ForwardScanDirection or * NoMovementScanDirection for an indexscan, but the planner wants to * distinguish ordered from unordered indexes for building pathkeys.) * * 'indextotalcost' and 'indexselectivity' are saved in the IndexPath so that * we need not recompute them when considering using the same index in a * bitmap index/heap scan (see BitmapHeapPath). The costs of the IndexPath * itself represent the costs of an IndexScan or IndexOnlyScan plan type. *---------- */ typedef struct IndexPath { Path path; IndexOptInfo *indexinfo; List *indexclauses; List *indexquals; List *indexqualcols; List *indexorderbys; List *indexorderbycols; ScanDirection indexscandir; Cost indextotalcost; Selectivity indexselectivity; } IndexPath; /* * BitmapHeapPath represents one or more indexscans that generate TID bitmaps * instead of directly accessing the heap, followed by AND/OR combinations * to produce a single bitmap, followed by a heap scan that uses the bitmap. * Note that the output is always considered unordered, since it will come * out in physical heap order no matter what the underlying indexes did. * * The individual indexscans are represented by IndexPath nodes, and any * logic on top of them is represented by a tree of BitmapAndPath and * BitmapOrPath nodes. Notice that we can use the same IndexPath node both * to represent a regular (or index-only) index scan plan, and as the child * of a BitmapHeapPath that represents scanning the same index using a * BitmapIndexScan. The startup_cost and total_cost figures of an IndexPath * always represent the costs to use it as a regular (or index-only) * IndexScan. The costs of a BitmapIndexScan can be computed using the * IndexPath's indextotalcost and indexselectivity. */ typedef struct BitmapHeapPath { Path path; Path *bitmapqual; /* IndexPath, BitmapAndPath, BitmapOrPath */ } BitmapHeapPath; /* * BitmapAndPath represents a BitmapAnd plan node; it can only appear as * part of the substructure of a BitmapHeapPath. The Path structure is * a bit more heavyweight than we really need for this, but for simplicity * we make it a derivative of Path anyway. */ typedef struct BitmapAndPath { Path path; List *bitmapquals; /* IndexPaths and BitmapOrPaths */ Selectivity bitmapselectivity; } BitmapAndPath; /* * BitmapOrPath represents a BitmapOr plan node; it can only appear as * part of the substructure of a BitmapHeapPath. The Path structure is * a bit more heavyweight than we really need for this, but for simplicity * we make it a derivative of Path anyway. */ typedef struct BitmapOrPath { Path path; List *bitmapquals; /* IndexPaths and BitmapAndPaths */ Selectivity bitmapselectivity; } BitmapOrPath; /* * TidPath represents a scan by TID * * tidquals is an implicitly OR'ed list of qual expressions of the form * "CTID = pseudoconstant" or "CTID = ANY(pseudoconstant_array)". * Note they are bare expressions, not RestrictInfos. */ typedef struct TidPath { Path path; List *tidquals; /* qual(s) involving CTID = something */ } TidPath; /* * ForeignPath represents a potential scan of a foreign table * * fdw_private stores FDW private data about the scan. While fdw_private is * not actually touched by the core code during normal operations, it's * generally a good idea to use a representation that can be dumped by * nodeToString(), so that you can examine the structure during debugging * with tools like pprint(). */ typedef struct ForeignPath { Path path; List *fdw_private; } ForeignPath; /* * AppendPath represents an Append plan, ie, successive execution of * several member plans. * * Note: it is possible for "subpaths" to contain only one, or even no, * elements. These cases are optimized during create_append_plan. * In particular, an AppendPath with no subpaths is a "dummy" path that * is created to represent the case that a relation is provably empty. */ typedef struct AppendPath { Path path; List *subpaths; /* list of component Paths */ } AppendPath; #define IS_DUMMY_PATH(p) \ (IsA((p), AppendPath) && ((AppendPath *) (p))->subpaths == NIL) /* A relation that's been proven empty will have one path that is dummy */ #define IS_DUMMY_REL(r) \ ((r)->cheapest_total_path != NULL && \ IS_DUMMY_PATH((r)->cheapest_total_path)) /* * MergeAppendPath represents a MergeAppend plan, ie, the merging of sorted * results from several member plans to produce similarly-sorted output. */ typedef struct MergeAppendPath { Path path; List *subpaths; /* list of component Paths */ double limit_tuples; /* hard limit on output tuples, or -1 */ } MergeAppendPath; /* * ResultPath represents use of a Result plan node to compute a variable-free * targetlist with no underlying tables (a "SELECT expressions" query). * The query could have a WHERE clause, too, represented by "quals". * * Note that quals is a list of bare clauses, not RestrictInfos. */ typedef struct ResultPath { Path path; List *quals; } ResultPath; /* * MaterialPath represents use of a Material plan node, i.e., caching of * the output of its subpath. This is used when the subpath is expensive * and needs to be scanned repeatedly, or when we need mark/restore ability * and the subpath doesn't have it. */ typedef struct MaterialPath { Path path; Path *subpath; } MaterialPath; /* * UniquePath represents elimination of distinct rows from the output of * its subpath. * * This is unlike the other Path nodes in that it can actually generate * different plans: either hash-based or sort-based implementation, or a * no-op if the input path can be proven distinct already. The decision * is sufficiently localized that it's not worth having separate Path node * types. (Note: in the no-op case, we could eliminate the UniquePath node * entirely and just return the subpath; but it's convenient to have a * UniquePath in the path tree to signal upper-level routines that the input * is known distinct.) */ typedef enum { UNIQUE_PATH_NOOP, /* input is known unique already */ UNIQUE_PATH_HASH, /* use hashing */ UNIQUE_PATH_SORT /* use sorting */ } UniquePathMethod; typedef struct UniquePath { Path path; Path *subpath; UniquePathMethod umethod; List *in_operators; /* equality operators of the IN clause */ List *uniq_exprs; /* expressions to be made unique */ } UniquePath; /* * All join-type paths share these fields. */ typedef struct JoinPath { Path path; JoinType jointype; Path *outerjoinpath; /* path for the outer side of the join */ Path *innerjoinpath; /* path for the inner side of the join */ List *joinrestrictinfo; /* RestrictInfos to apply to join */ /* * See the notes for RelOptInfo and ParamPathInfo to understand why * joinrestrictinfo is needed in JoinPath, and can't be merged into the * parent RelOptInfo. */ } JoinPath; /* * A nested-loop path needs no special fields. */ typedef JoinPath NestPath; /* * A mergejoin path has these fields. * * Unlike other path types, a MergePath node doesn't represent just a single * run-time plan node: it can represent up to four. Aside from the MergeJoin * node itself, there can be a Sort node for the outer input, a Sort node * for the inner input, and/or a Material node for the inner input. We could * represent these nodes by separate path nodes, but considering how many * different merge paths are investigated during a complex join problem, * it seems better to avoid unnecessary palloc overhead. * * path_mergeclauses lists the clauses (in the form of RestrictInfos) * that will be used in the merge. * * Note that the mergeclauses are a subset of the parent relation's * restriction-clause list. Any join clauses that are not mergejoinable * appear only in the parent's restrict list, and must be checked by a * qpqual at execution time. * * outersortkeys (resp. innersortkeys) is NIL if the outer path * (resp. inner path) is already ordered appropriately for the * mergejoin. If it is not NIL then it is a PathKeys list describing * the ordering that must be created by an explicit Sort node. * * materialize_inner is TRUE if a Material node should be placed atop the * inner input. This may appear with or without an inner Sort step. */ typedef struct MergePath { JoinPath jpath; List *path_mergeclauses; /* join clauses to be used for merge */ List *outersortkeys; /* keys for explicit sort, if any */ List *innersortkeys; /* keys for explicit sort, if any */ bool materialize_inner; /* add Materialize to inner? */ } MergePath; /* * A hashjoin path has these fields. * * The remarks above for mergeclauses apply for hashclauses as well. * * Hashjoin does not care what order its inputs appear in, so we have * no need for sortkeys. */ typedef struct HashPath { JoinPath jpath; List *path_hashclauses; /* join clauses used for hashing */ int num_batches; /* number of batches expected */ } HashPath; /* * Restriction clause info. * * We create one of these for each AND sub-clause of a restriction condition * (WHERE or JOIN/ON clause). Since the restriction clauses are logically * ANDed, we can use any one of them or any subset of them to filter out * tuples, without having to evaluate the rest. The RestrictInfo node itself * stores data used by the optimizer while choosing the best query plan. * * If a restriction clause references a single base relation, it will appear * in the baserestrictinfo list of the RelOptInfo for that base rel. * * If a restriction clause references more than one base rel, it will * appear in the joininfo list of every RelOptInfo that describes a strict * subset of the base rels mentioned in the clause. The joininfo lists are * used to drive join tree building by selecting plausible join candidates. * The clause cannot actually be applied until we have built a join rel * containing all the base rels it references, however. * * When we construct a join rel that includes all the base rels referenced * in a multi-relation restriction clause, we place that clause into the * joinrestrictinfo lists of paths for the join rel, if neither left nor * right sub-path includes all base rels referenced in the clause. The clause * will be applied at that join level, and will not propagate any further up * the join tree. (Note: the "predicate migration" code was once intended to * push restriction clauses up and down the plan tree based on evaluation * costs, but it's dead code and is unlikely to be resurrected in the * foreseeable future.) * * Note that in the presence of more than two rels, a multi-rel restriction * might reach different heights in the join tree depending on the join * sequence we use. So, these clauses cannot be associated directly with * the join RelOptInfo, but must be kept track of on a per-join-path basis. * * RestrictInfos that represent equivalence conditions (i.e., mergejoinable * equalities that are not outerjoin-delayed) are handled a bit differently. * Initially we attach them to the EquivalenceClasses that are derived from * them. When we construct a scan or join path, we look through all the * EquivalenceClasses and generate derived RestrictInfos representing the * minimal set of conditions that need to be checked for this particular scan * or join to enforce that all members of each EquivalenceClass are in fact * equal in all rows emitted by the scan or join. * * When dealing with outer joins we have to be very careful about pushing qual * clauses up and down the tree. An outer join's own JOIN/ON conditions must * be evaluated exactly at that join node, unless they are "degenerate" * conditions that reference only Vars from the nullable side of the join. * Quals appearing in WHERE or in a JOIN above the outer join cannot be pushed * down below the outer join, if they reference any nullable Vars. * RestrictInfo nodes contain a flag to indicate whether a qual has been * pushed down to a lower level than its original syntactic placement in the * join tree would suggest. If an outer join prevents us from pushing a qual * down to its "natural" semantic level (the level associated with just the * base rels used in the qual) then we mark the qual with a "required_relids" * value including more than just the base rels it actually uses. By * pretending that the qual references all the rels required to form the outer * join, we prevent it from being evaluated below the outer join's joinrel. * When we do form the outer join's joinrel, we still need to distinguish * those quals that are actually in that join's JOIN/ON condition from those * that appeared elsewhere in the tree and were pushed down to the join rel * because they used no other rels. That's what the is_pushed_down flag is * for; it tells us that a qual is not an OUTER JOIN qual for the set of base * rels listed in required_relids. A clause that originally came from WHERE * or an INNER JOIN condition will *always* have its is_pushed_down flag set. * It's possible for an OUTER JOIN clause to be marked is_pushed_down too, * if we decide that it can be pushed down into the nullable side of the join. * In that case it acts as a plain filter qual for wherever it gets evaluated. * (In short, is_pushed_down is only false for non-degenerate outer join * conditions. Possibly we should rename it to reflect that meaning?) * * RestrictInfo nodes also contain an outerjoin_delayed flag, which is true * if the clause's applicability must be delayed due to any outer joins * appearing below it (ie, it has to be postponed to some join level higher * than the set of relations it actually references). * * There is also an outer_relids field, which is NULL except for outer join * clauses; for those, it is the set of relids on the outer side of the * clause's outer join. (These are rels that the clause cannot be applied to * in parameterized scans, since pushing it into the join's outer side would * lead to wrong answers.) * * There is also a nullable_relids field, which is the set of rels the clause * references that can be forced null by some outer join below the clause. * * outerjoin_delayed = true is subtly different from nullable_relids != NULL: * a clause might reference some nullable rels and yet not be * outerjoin_delayed because it also references all the other rels of the * outer join(s). A clause that is not outerjoin_delayed can be enforced * anywhere it is computable. * * In general, the referenced clause might be arbitrarily complex. The * kinds of clauses we can handle as indexscan quals, mergejoin clauses, * or hashjoin clauses are limited (e.g., no volatile functions). The code * for each kind of path is responsible for identifying the restrict clauses * it can use and ignoring the rest. Clauses not implemented by an indexscan, * mergejoin, or hashjoin will be placed in the plan qual or joinqual field * of the finished Plan node, where they will be enforced by general-purpose * qual-expression-evaluation code. (But we are still entitled to count * their selectivity when estimating the result tuple count, if we * can guess what it is...) * * When the referenced clause is an OR clause, we generate a modified copy * in which additional RestrictInfo nodes are inserted below the top-level * OR/AND structure. This is a convenience for OR indexscan processing: * indexquals taken from either the top level or an OR subclause will have * associated RestrictInfo nodes. * * The can_join flag is set true if the clause looks potentially useful as * a merge or hash join clause, that is if it is a binary opclause with * nonoverlapping sets of relids referenced in the left and right sides. * (Whether the operator is actually merge or hash joinable isn't checked, * however.) * * The pseudoconstant flag is set true if the clause contains no Vars of * the current query level and no volatile functions. Such a clause can be * pulled out and used as a one-time qual in a gating Result node. We keep * pseudoconstant clauses in the same lists as other RestrictInfos so that * the regular clause-pushing machinery can assign them to the correct join * level, but they need to be treated specially for cost and selectivity * estimates. Note that a pseudoconstant clause can never be an indexqual * or merge or hash join clause, so it's of no interest to large parts of * the planner. * * When join clauses are generated from EquivalenceClasses, there may be * several equally valid ways to enforce join equivalence, of which we need * apply only one. We mark clauses of this kind by setting parent_ec to * point to the generating EquivalenceClass. Multiple clauses with the same * parent_ec in the same join are redundant. */ typedef struct RestrictInfo { NodeTag type; Expr *clause; /* the represented clause of WHERE or JOIN */ bool is_pushed_down; /* TRUE if clause was pushed down in level */ bool outerjoin_delayed; /* TRUE if delayed by lower outer join */ bool can_join; /* see comment above */ bool pseudoconstant; /* see comment above */ /* The set of relids (varnos) actually referenced in the clause: */ Relids clause_relids; /* The set of relids required to evaluate the clause: */ Relids required_relids; /* If an outer-join clause, the outer-side relations, else NULL: */ Relids outer_relids; /* The relids used in the clause that are nullable by lower outer joins: */ Relids nullable_relids; /* These fields are set for any binary opclause: */ Relids left_relids; /* relids in left side of clause */ Relids right_relids; /* relids in right side of clause */ /* This field is NULL unless clause is an OR clause: */ Expr *orclause; /* modified clause with RestrictInfos */ /* This field is NULL unless clause is potentially redundant: */ EquivalenceClass *parent_ec; /* generating EquivalenceClass */ /* cache space for cost and selectivity */ QualCost eval_cost; /* eval cost of clause; -1 if not yet set */ Selectivity norm_selec; /* selectivity for "normal" (JOIN_INNER) * semantics; -1 if not yet set; >1 means a * redundant clause */ Selectivity outer_selec; /* selectivity for outer join semantics; -1 if * not yet set */ /* valid if clause is mergejoinable, else NIL */ List *mergeopfamilies; /* opfamilies containing clause operator */ /* cache space for mergeclause processing; NULL if not yet set */ EquivalenceClass *left_ec; /* EquivalenceClass containing lefthand */ EquivalenceClass *right_ec; /* EquivalenceClass containing righthand */ EquivalenceMember *left_em; /* EquivalenceMember for lefthand */ EquivalenceMember *right_em; /* EquivalenceMember for righthand */ List *scansel_cache; /* list of MergeScanSelCache structs */ /* transient workspace for use while considering a specific join path */ bool outer_is_left; /* T = outer var on left, F = on right */ /* valid if clause is hashjoinable, else InvalidOid: */ Oid hashjoinoperator; /* copy of clause operator */ /* cache space for hashclause processing; -1 if not yet set */ Selectivity left_bucketsize; /* avg bucketsize of left side */ Selectivity right_bucketsize; /* avg bucketsize of right side */ } RestrictInfo; /* * Since mergejoinscansel() is a relatively expensive function, and would * otherwise be invoked many times while planning a large join tree, * we go out of our way to cache its results. Each mergejoinable * RestrictInfo carries a list of the specific sort orderings that have * been considered for use with it, and the resulting selectivities. */ typedef struct MergeScanSelCache { /* Ordering details (cache lookup key) */ Oid opfamily; /* btree opfamily defining the ordering */ Oid collation; /* collation for the ordering */ int strategy; /* sort direction (ASC or DESC) */ bool nulls_first; /* do NULLs come before normal values? */ /* Results */ Selectivity leftstartsel; /* first-join fraction for clause left side */ Selectivity leftendsel; /* last-join fraction for clause left side */ Selectivity rightstartsel; /* first-join fraction for clause right side */ Selectivity rightendsel; /* last-join fraction for clause right side */ } MergeScanSelCache; /* * Placeholder node for an expression to be evaluated below the top level * of a plan tree. This is used during planning to represent the contained * expression. At the end of the planning process it is replaced by either * the contained expression or a Var referring to a lower-level evaluation of * the contained expression. Typically the evaluation occurs below an outer * join, and Var references above the outer join might thereby yield NULL * instead of the expression value. * * Although the planner treats this as an expression node type, it is not * recognized by the parser or executor, so we declare it here rather than * in primnodes.h. */ typedef struct PlaceHolderVar { Expr xpr; Expr *phexpr; /* the represented expression */ Relids phrels; /* base relids syntactically within expr src */ Index phid; /* ID for PHV (unique within planner run) */ Index phlevelsup; /* > 0 if PHV belongs to outer query */ } PlaceHolderVar; /* * "Special join" info. * * One-sided outer joins constrain the order of joining partially but not * completely. We flatten such joins into the planner's top-level list of * relations to join, but record information about each outer join in a * SpecialJoinInfo struct. These structs are kept in the PlannerInfo node's * join_info_list. * * Similarly, semijoins and antijoins created by flattening IN (subselect) * and EXISTS(subselect) clauses create partial constraints on join order. * These are likewise recorded in SpecialJoinInfo structs. * * We make SpecialJoinInfos for FULL JOINs even though there is no flexibility * of planning for them, because this simplifies make_join_rel()'s API. * * min_lefthand and min_righthand are the sets of base relids that must be * available on each side when performing the special join. lhs_strict is * true if the special join's condition cannot succeed when the LHS variables * are all NULL (this means that an outer join can commute with upper-level * outer joins even if it appears in their RHS). We don't bother to set * lhs_strict for FULL JOINs, however. * * It is not valid for either min_lefthand or min_righthand to be empty sets; * if they were, this would break the logic that enforces join order. * * syn_lefthand and syn_righthand are the sets of base relids that are * syntactically below this special join. (These are needed to help compute * min_lefthand and min_righthand for higher joins.) * * delay_upper_joins is set TRUE if we detect a pushed-down clause that has * to be evaluated after this join is formed (because it references the RHS). * Any outer joins that have such a clause and this join in their RHS cannot * commute with this join, because that would leave noplace to check the * pushed-down clause. (We don't track this for FULL JOINs, either.) * * join_quals is an implicit-AND list of the quals syntactically associated * with the join (they may or may not end up being applied at the join level). * This is just a side list and does not drive actual application of quals. * For JOIN_SEMI joins, this is cleared to NIL in create_unique_path() if * the join is found not to be suitable for a uniqueify-the-RHS plan. * * jointype is never JOIN_RIGHT; a RIGHT JOIN is handled by switching * the inputs to make it a LEFT JOIN. So the allowed values of jointype * in a join_info_list member are only LEFT, FULL, SEMI, or ANTI. * * For purposes of join selectivity estimation, we create transient * SpecialJoinInfo structures for regular inner joins; so it is possible * to have jointype == JOIN_INNER in such a structure, even though this is * not allowed within join_info_list. We also create transient * SpecialJoinInfos with jointype == JOIN_INNER for outer joins, since for * cost estimation purposes it is sometimes useful to know the join size under * plain innerjoin semantics. Note that lhs_strict, delay_upper_joins, and * join_quals are not set meaningfully within such structs. */ typedef struct SpecialJoinInfo { NodeTag type; Relids min_lefthand; /* base relids in minimum LHS for join */ Relids min_righthand; /* base relids in minimum RHS for join */ Relids syn_lefthand; /* base relids syntactically within LHS */ Relids syn_righthand; /* base relids syntactically within RHS */ JoinType jointype; /* always INNER, LEFT, FULL, SEMI, or ANTI */ bool lhs_strict; /* joinclause is strict for some LHS rel */ bool delay_upper_joins; /* can't commute with upper RHS */ List *join_quals; /* join quals, in implicit-AND list format */ } SpecialJoinInfo; /* * Append-relation info. * * When we expand an inheritable table or a UNION-ALL subselect into an * "append relation" (essentially, a list of child RTEs), we build an * AppendRelInfo for each child RTE. The list of AppendRelInfos indicates * which child RTEs must be included when expanding the parent, and each * node carries information needed to translate Vars referencing the parent * into Vars referencing that child. * * These structs are kept in the PlannerInfo node's append_rel_list. * Note that we just throw all the structs into one list, and scan the * whole list when desiring to expand any one parent. We could have used * a more complex data structure (eg, one list per parent), but this would * be harder to update during operations such as pulling up subqueries, * and not really any easier to scan. Considering that typical queries * will not have many different append parents, it doesn't seem worthwhile * to complicate things. * * Note: after completion of the planner prep phase, any given RTE is an * append parent having entries in append_rel_list if and only if its * "inh" flag is set. We clear "inh" for plain tables that turn out not * to have inheritance children, and (in an abuse of the original meaning * of the flag) we set "inh" for subquery RTEs that turn out to be * flattenable UNION ALL queries. This lets us avoid useless searches * of append_rel_list. * * Note: the data structure assumes that append-rel members are single * baserels. This is OK for inheritance, but it prevents us from pulling * up a UNION ALL member subquery if it contains a join. While that could * be fixed with a more complex data structure, at present there's not much * point because no improvement in the plan could result. */ typedef struct AppendRelInfo { NodeTag type; /* * These fields uniquely identify this append relationship. There can be * (in fact, always should be) multiple AppendRelInfos for the same * parent_relid, but never more than one per child_relid, since a given * RTE cannot be a child of more than one append parent. */ Index parent_relid; /* RT index of append parent rel */ Index child_relid; /* RT index of append child rel */ /* * For an inheritance appendrel, the parent and child are both regular * relations, and we store their rowtype OIDs here for use in translating * whole-row Vars. For a UNION-ALL appendrel, the parent and child are * both subqueries with no named rowtype, and we store InvalidOid here. */ Oid parent_reltype; /* OID of parent's composite type */ Oid child_reltype; /* OID of child's composite type */ /* * The N'th element of this list is a Var or expression representing the * child column corresponding to the N'th column of the parent. This is * used to translate Vars referencing the parent rel into references to * the child. A list element is NULL if it corresponds to a dropped * column of the parent (this is only possible for inheritance cases, not * UNION ALL). The list elements are always simple Vars for inheritance * cases, but can be arbitrary expressions in UNION ALL cases. * * Notice we only store entries for user columns (attno > 0). Whole-row * Vars are special-cased, and system columns (attno < 0) need no special * translation since their attnos are the same for all tables. * * Caution: the Vars have varlevelsup = 0. Be careful to adjust as needed * when copying into a subquery. */ List *translated_vars; /* Expressions in the child's Vars */ /* * We store the parent table's OID here for inheritance, or InvalidOid for * UNION ALL. This is only needed to help in generating error messages if * an attempt is made to reference a dropped parent column. */ Oid parent_reloid; /* OID of parent relation */ } AppendRelInfo; /* * For each distinct placeholder expression generated during planning, we * store a PlaceHolderInfo node in the PlannerInfo node's placeholder_list. * This stores info that is needed centrally rather than in each copy of the * PlaceHolderVar. The phid fields identify which PlaceHolderInfo goes with * each PlaceHolderVar. Note that phid is unique throughout a planner run, * not just within a query level --- this is so that we need not reassign ID's * when pulling a subquery into its parent. * * The idea is to evaluate the expression at (only) the ph_eval_at join level, * then allow it to bubble up like a Var until the ph_needed join level. * ph_needed has the same definition as attr_needed for a regular Var. * * ph_may_need is an initial estimate of ph_needed, formed using the * syntactic locations of references to the PHV. We need this in order to * determine whether the PHV reference forces a join ordering constraint: * if the PHV has to be evaluated below the nullable side of an outer join, * and then used above that outer join, we must constrain join order to ensure * there's a valid place to evaluate the PHV below the join. The final * actual ph_needed level might be lower than ph_may_need, but we can't * determine that until later on. Fortunately this doesn't matter for what * we need ph_may_need for: if there's a PHV reference syntactically * above the outer join, it's not going to be allowed to drop below the outer * join, so we would come to the same conclusions about join order even if * we had the final ph_needed value to compare to. * * We create a PlaceHolderInfo only after determining that the PlaceHolderVar * is actually referenced in the plan tree, so that unreferenced placeholders * don't result in unnecessary constraints on join order. */ typedef struct PlaceHolderInfo { NodeTag type; Index phid; /* ID for PH (unique within planner run) */ PlaceHolderVar *ph_var; /* copy of PlaceHolderVar tree */ Relids ph_eval_at; /* lowest level we can evaluate value at */ Relids ph_needed; /* highest level the value is needed at */ Relids ph_may_need; /* highest level it might be needed at */ int32 ph_width; /* estimated attribute width */ } PlaceHolderInfo; /* * For each potentially index-optimizable MIN/MAX aggregate function, * root->minmax_aggs stores a MinMaxAggInfo describing it. */ typedef struct MinMaxAggInfo { NodeTag type; Oid aggfnoid; /* pg_proc Oid of the aggregate */ Oid aggsortop; /* Oid of its sort operator */ Expr *target; /* expression we are aggregating on */ PlannerInfo *subroot; /* modified "root" for planning the subquery */ Path *path; /* access path for subquery */ Cost pathcost; /* estimated cost to fetch first row */ Param *param; /* param for subplan's output */ } MinMaxAggInfo; /* * At runtime, PARAM_EXEC slots are used to pass values around from one plan * node to another. They can be used to pass values down into subqueries (for * outer references in subqueries), or up out of subqueries (for the results * of a subplan), or from a NestLoop plan node into its inner relation (when * the inner scan is parameterized with values from the outer relation). * The planner is responsible for assigning nonconflicting PARAM_EXEC IDs to * the PARAM_EXEC Params it generates. * * Outer references are managed via root->plan_params, which is a list of * PlannerParamItems. While planning a subquery, each parent query level's * plan_params contains the values required from it by the current subquery. * During create_plan(), we use plan_params to track values that must be * passed from outer to inner sides of NestLoop plan nodes. * * The item a PlannerParamItem represents can be one of three kinds: * * A Var: the slot represents a variable of this level that must be passed * down because subqueries have outer references to it, or must be passed * from a NestLoop node to its inner scan. The varlevelsup value in the Var * will always be zero. * * A PlaceHolderVar: this works much like the Var case, except that the * entry is a PlaceHolderVar node with a contained expression. The PHV * will have phlevelsup = 0, and the contained expression is adjusted * to match in level. * * An Aggref (with an expression tree representing its argument): the slot * represents an aggregate expression that is an outer reference for some * subquery. The Aggref itself has agglevelsup = 0, and its argument tree * is adjusted to match in level. * * Note: we detect duplicate Var and PlaceHolderVar parameters and coalesce * them into one slot, but we do not bother to do that for Aggrefs. * The scope of duplicate-elimination only extends across the set of * parameters passed from one query level into a single subquery, or for * nestloop parameters across the set of nestloop parameters used in a single * query level. So there is no possibility of a PARAM_EXEC slot being used * for conflicting purposes. * * In addition, PARAM_EXEC slots are assigned for Params representing outputs * from subplans (values that are setParam items for those subplans). These * IDs need not be tracked via PlannerParamItems, since we do not need any * duplicate-elimination nor later processing of the represented expressions. * Instead, we just record the assignment of the slot number by incrementing * root->glob->nParamExec. */ typedef struct PlannerParamItem { NodeTag type; Node *item; /* the Var, PlaceHolderVar, or Aggref */ int paramId; /* its assigned PARAM_EXEC slot number */ } PlannerParamItem; /* * When making cost estimates for a SEMI or ANTI join, there are some * correction factors that are needed in both nestloop and hash joins * to account for the fact that the executor can stop scanning inner rows * as soon as it finds a match to the current outer row. These numbers * depend only on the selected outer and inner join relations, not on the * particular paths used for them, so it's worthwhile to calculate them * just once per relation pair not once per considered path. This struct * is filled by compute_semi_anti_join_factors and must be passed along * to the join cost estimation functions. * * outer_match_frac is the fraction of the outer tuples that are * expected to have at least one match. * match_count is the average number of matches expected for * outer tuples that have at least one match. */ typedef struct SemiAntiJoinFactors { Selectivity outer_match_frac; Selectivity match_count; } SemiAntiJoinFactors; /* * For speed reasons, cost estimation for join paths is performed in two * phases: the first phase tries to quickly derive a lower bound for the * join cost, and then we check if that's sufficient to reject the path. * If not, we come back for a more refined cost estimate. The first phase * fills a JoinCostWorkspace struct with its preliminary cost estimates * and possibly additional intermediate values. The second phase takes * these values as inputs to avoid repeating work. * * (Ideally we'd declare this in cost.h, but it's also needed in pathnode.h, * so seems best to put it here.) */ typedef struct JoinCostWorkspace { /* Preliminary cost estimates --- must not be larger than final ones! */ Cost startup_cost; /* cost expended before fetching any tuples */ Cost total_cost; /* total cost (assuming all tuples fetched) */ /* Fields below here should be treated as private to costsize.c */ Cost run_cost; /* non-startup cost components */ /* private for cost_nestloop code */ Cost inner_rescan_run_cost; double outer_matched_rows; Selectivity inner_scan_frac; /* private for cost_mergejoin code */ Cost inner_run_cost; double outer_rows; double inner_rows; double outer_skip_rows; double inner_skip_rows; /* private for cost_hashjoin code */ int numbuckets; int numbatches; } JoinCostWorkspace; #endif /* RELATION_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/nodes/print.h��������������������������������������������������������������������������0000644�����������������00000002056�14763166026�0011633 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * print.h * definitions for nodes/print.c * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/nodes/print.h * *------------------------------------------------------------------------- */ #ifndef PRINT_H #define PRINT_H #include "executor/tuptable.h" #define nodeDisplay(x) pprint(x) extern void print(const void *obj); extern void pprint(const void *obj); extern void elog_node_display(int lev, const char *title, const void *obj, bool pretty); extern char *format_node_dump(const char *dump); extern char *pretty_format_node_dump(const char *dump); extern void print_rt(const List *rtable); extern void print_expr(const Node *expr, const List *rtable); extern void print_pathkeys(const List *pathkeys, const List *rtable); extern void print_tl(const List *tlist, const List *rtable); extern void print_slot(TupleTableSlot *slot); #endif /* PRINT_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/nodes/memnodes.h�����������������������������������������������������������������������0000644�����������������00000005066�14763166026�0012312 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * memnodes.h * POSTGRES memory context node definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/nodes/memnodes.h * *------------------------------------------------------------------------- */ #ifndef MEMNODES_H #define MEMNODES_H #include "nodes/nodes.h" /* * MemoryContext * A logical context in which memory allocations occur. * * MemoryContext itself is an abstract type that can have multiple * implementations, though for now we have only AllocSetContext. * The function pointers in MemoryContextMethods define one specific * implementation of MemoryContext --- they are a virtual function table * in C++ terms. * * Node types that are actual implementations of memory contexts must * begin with the same fields as MemoryContext. * * Note: for largely historical reasons, typedef MemoryContext is a pointer * to the context struct rather than the struct type itself. */ typedef struct MemoryContextMethods { void *(*alloc) (MemoryContext context, Size size); /* call this free_p in case someone #define's free() */ void (*free_p) (MemoryContext context, void *pointer); void *(*realloc) (MemoryContext context, void *pointer, Size size); void (*init) (MemoryContext context); void (*reset) (MemoryContext context); void (*delete_context) (MemoryContext context); Size (*get_chunk_space) (MemoryContext context, void *pointer); bool (*is_empty) (MemoryContext context); void (*stats) (MemoryContext context, int level); #ifdef MEMORY_CONTEXT_CHECKING void (*check) (MemoryContext context); #endif } MemoryContextMethods; typedef struct MemoryContextData { NodeTag type; /* identifies exact kind of context */ MemoryContextMethods *methods; /* virtual function table */ MemoryContext parent; /* NULL if no parent (toplevel context) */ MemoryContext firstchild; /* head of linked list of children */ MemoryContext nextchild; /* next child of same parent */ char *name; /* context name (just for debugging) */ bool isReset; /* T = no space alloced since last reset */ } MemoryContextData; /* utils/palloc.h contains typedef struct MemoryContextData *MemoryContext */ /* * MemoryContextIsValid * True iff memory context is valid. * * Add new context types to the set accepted by this macro. */ #define MemoryContextIsValid(context) \ ((context) != NULL && \ (IsA((context), AllocSetContext))) #endif /* MEMNODES_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/nodes/replnodes.h����������������������������������������������������������������������0000644�����������������00000002035�14763166026�0012467 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * replnodes.h * definitions for replication grammar parse nodes * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/nodes/replnodes.h * *------------------------------------------------------------------------- */ #ifndef REPLNODES_H #define REPLNODES_H #include "access/xlogdefs.h" #include "nodes/pg_list.h" /* ---------------------- * IDENTIFY_SYSTEM command * ---------------------- */ typedef struct IdentifySystemCmd { NodeTag type; } IdentifySystemCmd; /* ---------------------- * BASE_BACKUP command * ---------------------- */ typedef struct BaseBackupCmd { NodeTag type; List *options; } BaseBackupCmd; /* ---------------------- * START_REPLICATION command * ---------------------- */ typedef struct StartReplicationCmd { NodeTag type; XLogRecPtr startpoint; } StartReplicationCmd; #endif /* REPLNODES_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeSubqueryscan.h������������������������������������������������������������0000644�����������������00000001421�14763166026�0014552 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeSubqueryscan.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeSubqueryscan.h * *------------------------------------------------------------------------- */ #ifndef NODESUBQUERYSCAN_H #define NODESUBQUERYSCAN_H #include "nodes/execnodes.h" extern SubqueryScanState *ExecInitSubqueryScan(SubqueryScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecSubqueryScan(SubqueryScanState *node); extern void ExecEndSubqueryScan(SubqueryScanState *node); extern void ExecReScanSubqueryScan(SubqueryScanState *node); #endif /* NODESUBQUERYSCAN_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeHash.h��������������������������������������������������������������������0000644�����������������00000003606�14763166026�0012760 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeHash.h * prototypes for nodeHash.c * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeHash.h * *------------------------------------------------------------------------- */ #ifndef NODEHASH_H #define NODEHASH_H #include "nodes/execnodes.h" extern HashState *ExecInitHash(Hash *node, EState *estate, int eflags); extern TupleTableSlot *ExecHash(HashState *node); extern Node *MultiExecHash(HashState *node); extern void ExecEndHash(HashState *node); extern void ExecReScanHash(HashState *node); extern HashJoinTable ExecHashTableCreate(Hash *node, List *hashOperators, bool keepNulls); extern void ExecHashTableDestroy(HashJoinTable hashtable); extern void ExecHashTableInsert(HashJoinTable hashtable, TupleTableSlot *slot, uint32 hashvalue); extern bool ExecHashGetHashValue(HashJoinTable hashtable, ExprContext *econtext, List *hashkeys, bool outer_tuple, bool keep_nulls, uint32 *hashvalue); extern void ExecHashGetBucketAndBatch(HashJoinTable hashtable, uint32 hashvalue, int *bucketno, int *batchno); extern bool ExecScanHashBucket(HashJoinState *hjstate, ExprContext *econtext); extern void ExecPrepHashTableForUnmatched(HashJoinState *hjstate); extern bool ExecScanHashTableForUnmatched(HashJoinState *hjstate, ExprContext *econtext); extern void ExecHashTableReset(HashJoinTable hashtable); extern void ExecHashTableResetMatchFlags(HashJoinTable hashtable); extern void ExecChooseHashTableSize(double ntuples, int tupwidth, bool useskew, int *numbuckets, int *numbatches, int *num_skew_mcvs); extern int ExecHashGetSkewBucket(HashJoinTable hashtable, uint32 hashvalue); #endif /* NODEHASH_H */ ��������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/execdesc.h��������������������������������������������������������������������0000644�����������������00000004520�14763166026�0013006 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * execdesc.h * plan and query descriptor accessor macros used by the executor * and related modules. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/execdesc.h * *------------------------------------------------------------------------- */ #ifndef EXECDESC_H #define EXECDESC_H #include "nodes/execnodes.h" #include "tcop/dest.h" /* ---------------- * query descriptor: * * a QueryDesc encapsulates everything that the executor * needs to execute the query. * * For the convenience of SQL-language functions, we also support QueryDescs * containing utility statements; these must not be passed to the executor * however. * --------------------- */ typedef struct QueryDesc { /* These fields are provided by CreateQueryDesc */ CmdType operation; /* CMD_SELECT, CMD_UPDATE, etc. */ PlannedStmt *plannedstmt; /* planner's output, or null if utility */ Node *utilitystmt; /* utility statement, or null */ const char *sourceText; /* source text of the query */ Snapshot snapshot; /* snapshot to use for query */ Snapshot crosscheck_snapshot; /* crosscheck for RI update/delete */ DestReceiver *dest; /* the destination for tuple output */ ParamListInfo params; /* param values being passed in */ int instrument_options; /* OR of InstrumentOption flags */ /* These fields are set by ExecutorStart */ TupleDesc tupDesc; /* descriptor for result tuples */ EState *estate; /* executor's query-wide state */ PlanState *planstate; /* tree of per-plan-node state */ /* This is always set NULL by the core system, but plugins can change it */ struct Instrumentation *totaltime; /* total time spent in ExecutorRun */ } QueryDesc; /* in pquery.c */ extern QueryDesc *CreateQueryDesc(PlannedStmt *plannedstmt, const char *sourceText, Snapshot snapshot, Snapshot crosscheck_snapshot, DestReceiver *dest, ParamListInfo params, int instrument_options); extern QueryDesc *CreateUtilityQueryDesc(Node *utilitystmt, const char *sourceText, Snapshot snapshot, DestReceiver *dest, ParamListInfo params); extern void FreeQueryDesc(QueryDesc *qdesc); #endif /* EXECDESC_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/execdebug.h�������������������������������������������������������������������0000644�����������������00000010512�14763166026�0013154 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * execdebug.h * #defines governing debugging behaviour in the executor * * XXX this is all pretty old and crufty. Newer code tends to use elog() * for debug printouts, because that's more flexible than printf(). * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/execdebug.h * *------------------------------------------------------------------------- */ #ifndef EXECDEBUG_H #define EXECDEBUG_H #include "executor/executor.h" #include "nodes/print.h" /* ---------------------------------------------------------------- * debugging defines. * * If you want certain debugging behaviour, then #define * the variable to 1. No need to explicitly #undef by default, * since we can use -D compiler options to enable features. * - thomas 1999-02-20 * ---------------------------------------------------------------- */ /* ---------------- * EXEC_NESTLOOPDEBUG is a flag which turns on debugging of the * nest loop node by NL_printf() and ENL_printf() in nodeNestloop.c * ---------------- #undef EXEC_NESTLOOPDEBUG */ /* ---------------- * EXEC_EVALDEBUG is a flag which turns on debugging of * ExecEval and ExecTargetList() stuff by EV_printf() in execQual.c * ---------------- #undef EXEC_EVALDEBUG */ /* ---------------- * EXEC_SORTDEBUG is a flag which turns on debugging of * the ExecSort() stuff by SO_printf() in nodeSort.c * ---------------- #undef EXEC_SORTDEBUG */ /* ---------------- * EXEC_MERGEJOINDEBUG is a flag which turns on debugging of * the ExecMergeJoin() stuff by MJ_printf() in nodeMergejoin.c * ---------------- #undef EXEC_MERGEJOINDEBUG */ /* ---------------------------------------------------------------- * #defines controlled by above definitions * * Note: most of these are "incomplete" because I didn't * need the ones not defined. More should be added * only as necessary -cim 10/26/89 * ---------------------------------------------------------------- */ #define T_OR_F(b) ((b) ? "true" : "false") #define NULL_OR_TUPLE(slot) (TupIsNull(slot) ? "null" : "a tuple") /* ---------------- * nest loop debugging defines * ---------------- */ #ifdef EXEC_NESTLOOPDEBUG #define NL_nodeDisplay(l) nodeDisplay(l) #define NL_printf(s) printf(s) #define NL1_printf(s, a) printf(s, a) #define ENL1_printf(message) printf("ExecNestLoop: %s\n", message) #else #define NL_nodeDisplay(l) #define NL_printf(s) #define NL1_printf(s, a) #define ENL1_printf(message) #endif /* EXEC_NESTLOOPDEBUG */ /* ---------------- * exec eval / target list debugging defines * ---------------- */ #ifdef EXEC_EVALDEBUG #define EV_nodeDisplay(l) nodeDisplay(l) #define EV_printf(s) printf(s) #define EV1_printf(s, a) printf(s, a) #else #define EV_nodeDisplay(l) #define EV_printf(s) #define EV1_printf(s, a) #endif /* EXEC_EVALDEBUG */ /* ---------------- * sort node debugging defines * ---------------- */ #ifdef EXEC_SORTDEBUG #define SO_nodeDisplay(l) nodeDisplay(l) #define SO_printf(s) printf(s) #define SO1_printf(s, p) printf(s, p) #else #define SO_nodeDisplay(l) #define SO_printf(s) #define SO1_printf(s, p) #endif /* EXEC_SORTDEBUG */ /* ---------------- * merge join debugging defines * ---------------- */ #ifdef EXEC_MERGEJOINDEBUG #define MJ_nodeDisplay(l) nodeDisplay(l) #define MJ_printf(s) printf(s) #define MJ1_printf(s, p) printf(s, p) #define MJ2_printf(s, p1, p2) printf(s, p1, p2) #define MJ_debugtup(slot) debugtup(slot, NULL) #define MJ_dump(state) ExecMergeTupleDump(state) #define MJ_DEBUG_COMPARE(res) \ MJ1_printf(" MJCompare() returns %d\n", (res)) #define MJ_DEBUG_QUAL(clause, res) \ MJ2_printf(" ExecQual(%s, econtext) returns %s\n", \ CppAsString(clause), T_OR_F(res)) #define MJ_DEBUG_PROC_NODE(slot) \ MJ2_printf(" %s = ExecProcNode(...) returns %s\n", \ CppAsString(slot), NULL_OR_TUPLE(slot)) #else #define MJ_nodeDisplay(l) #define MJ_printf(s) #define MJ1_printf(s, p) #define MJ2_printf(s, p1, p2) #define MJ_debugtup(slot) #define MJ_dump(state) #define MJ_DEBUG_COMPARE(res) #define MJ_DEBUG_QUAL(clause, res) #define MJ_DEBUG_PROC_NODE(slot) #endif /* EXEC_MERGEJOINDEBUG */ #endif /* ExecDebugIncluded */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeCtescan.h�����������������������������������������������������������������0000644�����������������00000001313�14763166026�0013446 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeCtescan.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeCtescan.h * *------------------------------------------------------------------------- */ #ifndef NODECTESCAN_H #define NODECTESCAN_H #include "nodes/execnodes.h" extern CteScanState *ExecInitCteScan(CteScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecCteScan(CteScanState *node); extern void ExecEndCteScan(CteScanState *node); extern void ExecReScanCteScan(CteScanState *node); #endif /* NODECTESCAN_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/spi_priv.h��������������������������������������������������������������������0000644�����������������00000007154�14763166026�0013064 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * spi_priv.h * Server Programming Interface private declarations * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/spi_priv.h * *------------------------------------------------------------------------- */ #ifndef SPI_PRIV_H #define SPI_PRIV_H #include "executor/spi.h" #define _SPI_PLAN_MAGIC 569278163 typedef struct { /* current results */ uint32 processed; /* by Executor */ Oid lastoid; SPITupleTable *tuptable; MemoryContext procCxt; /* procedure context */ MemoryContext execCxt; /* executor context */ MemoryContext savedcxt; /* context of SPI_connect's caller */ SubTransactionId connectSubid; /* ID of connecting subtransaction */ } _SPI_connection; /* * SPI plans have three states: saved, unsaved, or temporary. * * Ordinarily, the _SPI_plan struct itself as well as the argtypes array * are in a dedicated memory context identified by plancxt (which can be * really small). All the other subsidiary state is in plancache entries * identified by plancache_list (note: the list cells themselves are in * plancxt). * * In an unsaved plan, the plancxt as well as the plancache entries' contexts * are children of the SPI procedure context, so they'll all disappear at * function exit. plancache.c also knows that the plancache entries are * "unsaved", so it doesn't link them into its global list; hence they do * not respond to inval events. This is OK since we are presumably holding * adequate locks to prevent other backends from messing with the tables. * * For a saved plan, the plancxt is made a child of CacheMemoryContext * since it should persist until explicitly destroyed. Likewise, the * plancache entries will be under CacheMemoryContext since we tell * plancache.c to save them. We rely on plancache.c to keep the cache * entries up-to-date as needed in the face of invalidation events. * * There are also "temporary" SPI plans, in which the _SPI_plan struct is * not even palloc'd but just exists in some function's local variable. * The plancache entries are unsaved and exist under the SPI executor context, * while additional data such as argtypes and list cells is loose in the SPI * executor context. Such plans can be identified by having plancxt == NULL. * * We can also have "one-shot" SPI plans (which are typically temporary, * as described above). These are meant to be executed once and discarded, * and various optimizations are made on the assumption of single use. * Note in particular that the CachedPlanSources within such an SPI plan * are not "complete" until execution. * * Note: if the original query string contained only whitespace and comments, * the plancache_list will be NIL and so there is no place to store the * query string. We don't care about that, but we do care about the * argument type array, which is why it's seemingly-redundantly stored. */ typedef struct _SPI_plan { int magic; /* should equal _SPI_PLAN_MAGIC */ bool saved; /* saved or unsaved plan? */ bool oneshot; /* one-shot plan? */ List *plancache_list; /* one CachedPlanSource per parsetree */ MemoryContext plancxt; /* Context containing _SPI_plan and data */ int cursor_options; /* Cursor options used for planning */ int nargs; /* number of plan arguments */ Oid *argtypes; /* Argument types (NULL if nargs is 0) */ ParserSetupHook parserSetup; /* alternative parameter spec method */ void *parserSetupArg; } _SPI_plan; #endif /* SPI_PRIV_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeModifyTable.h�������������������������������������������������������������0000644�����������������00000001400�14763166026�0014262 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeModifyTable.h * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeModifyTable.h * *------------------------------------------------------------------------- */ #ifndef NODEMODIFYTABLE_H #define NODEMODIFYTABLE_H #include "nodes/execnodes.h" extern ModifyTableState *ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags); extern TupleTableSlot *ExecModifyTable(ModifyTableState *node); extern void ExecEndModifyTable(ModifyTableState *node); extern void ExecReScanModifyTable(ModifyTableState *node); #endif /* NODEMODIFYTABLE_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeForeignscan.h�������������������������������������������������������������0000644�����������������00000001403�14763166026�0014324 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeForeignscan.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeForeignscan.h * *------------------------------------------------------------------------- */ #ifndef NODEFOREIGNSCAN_H #define NODEFOREIGNSCAN_H #include "nodes/execnodes.h" extern ForeignScanState *ExecInitForeignScan(ForeignScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecForeignScan(ForeignScanState *node); extern void ExecEndForeignScan(ForeignScanState *node); extern void ExecReScanForeignScan(ForeignScanState *node); #endif /* NODEFOREIGNSCAN_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeBitmapAnd.h���������������������������������������������������������������0000644�����������������00000001342�14763166026�0013727 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeBitmapAnd.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeBitmapAnd.h * *------------------------------------------------------------------------- */ #ifndef NODEBITMAPAND_H #define NODEBITMAPAND_H #include "nodes/execnodes.h" extern BitmapAndState *ExecInitBitmapAnd(BitmapAnd *node, EState *estate, int eflags); extern Node *MultiExecBitmapAnd(BitmapAndState *node); extern void ExecEndBitmapAnd(BitmapAndState *node); extern void ExecReScanBitmapAnd(BitmapAndState *node); #endif /* NODEBITMAPAND_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeWorktablescan.h�����������������������������������������������������������0000644�����������������00000001437�14763166026�0014674 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeWorktablescan.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeWorktablescan.h * *------------------------------------------------------------------------- */ #ifndef NODEWORKTABLESCAN_H #define NODEWORKTABLESCAN_H #include "nodes/execnodes.h" extern WorkTableScanState *ExecInitWorkTableScan(WorkTableScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecWorkTableScan(WorkTableScanState *node); extern void ExecEndWorkTableScan(WorkTableScanState *node); extern void ExecReScanWorkTableScan(WorkTableScanState *node); #endif /* NODEWORKTABLESCAN_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeFunctionscan.h������������������������������������������������������������0000644�����������������00000001421�14763166026�0014520 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeFunctionscan.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeFunctionscan.h * *------------------------------------------------------------------------- */ #ifndef NODEFUNCTIONSCAN_H #define NODEFUNCTIONSCAN_H #include "nodes/execnodes.h" extern FunctionScanState *ExecInitFunctionScan(FunctionScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecFunctionScan(FunctionScanState *node); extern void ExecEndFunctionScan(FunctionScanState *node); extern void ExecReScanFunctionScan(FunctionScanState *node); #endif /* NODEFUNCTIONSCAN_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeHashjoin.h����������������������������������������������������������������0000644�����������������00000001572�14763166026�0013640 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeHashjoin.h * prototypes for nodeHashjoin.c * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeHashjoin.h * *------------------------------------------------------------------------- */ #ifndef NODEHASHJOIN_H #define NODEHASHJOIN_H #include "nodes/execnodes.h" #include "storage/buffile.h" extern HashJoinState *ExecInitHashJoin(HashJoin *node, EState *estate, int eflags); extern TupleTableSlot *ExecHashJoin(HashJoinState *node); extern void ExecEndHashJoin(HashJoinState *node); extern void ExecReScanHashJoin(HashJoinState *node); extern void ExecHashJoinSaveTuple(MinimalTuple tuple, uint32 hashvalue, BufFile **fileptr); #endif /* NODEHASHJOIN_H */ ��������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeSetOp.h�������������������������������������������������������������������0000644�����������������00000001257�14763166026�0013127 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeSetOp.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeSetOp.h * *------------------------------------------------------------------------- */ #ifndef NODESETOP_H #define NODESETOP_H #include "nodes/execnodes.h" extern SetOpState *ExecInitSetOp(SetOp *node, EState *estate, int eflags); extern TupleTableSlot *ExecSetOp(SetOpState *node); extern void ExecEndSetOp(SetOpState *node); extern void ExecReScanSetOp(SetOpState *node); #endif /* NODESETOP_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeValuesscan.h��������������������������������������������������������������0000644�����������������00000001542�14763166026�0014176 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeValuesscan.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeValuesscan.h * *------------------------------------------------------------------------- */ #ifndef NODEVALUESSCAN_H #define NODEVALUESSCAN_H #include "nodes/execnodes.h" extern ValuesScanState *ExecInitValuesScan(ValuesScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecValuesScan(ValuesScanState *node); extern void ExecEndValuesScan(ValuesScanState *node); extern void ExecValuesMarkPos(ValuesScanState *node); extern void ExecValuesRestrPos(ValuesScanState *node); extern void ExecReScanValuesScan(ValuesScanState *node); #endif /* NODEVALUESSCAN_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/functions.h�������������������������������������������������������������������0000644�����������������00000002176�14763166026�0013240 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * functions.h * Declarations for execution of SQL-language functions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/functions.h * *------------------------------------------------------------------------- */ #ifndef FUNCTIONS_H #define FUNCTIONS_H #include "nodes/execnodes.h" #include "tcop/dest.h" /* This struct is known only within executor/functions.c */ typedef struct SQLFunctionParseInfo *SQLFunctionParseInfoPtr; extern Datum fmgr_sql(PG_FUNCTION_ARGS); extern SQLFunctionParseInfoPtr prepare_sql_fn_parse_info(HeapTuple procedureTuple, Node *call_expr, Oid inputCollation); extern void sql_fn_parser_setup(struct ParseState *pstate, SQLFunctionParseInfoPtr pinfo); extern bool check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, bool *modifyTargetList, JunkFilter **junkFilter); extern DestReceiver *CreateSQLFunctionDestReceiver(void); #endif /* FUNCTIONS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeResult.h������������������������������������������������������������������0000644�����������������00000001442�14763166026�0013347 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeResult.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeResult.h * *------------------------------------------------------------------------- */ #ifndef NODERESULT_H #define NODERESULT_H #include "nodes/execnodes.h" extern ResultState *ExecInitResult(Result *node, EState *estate, int eflags); extern TupleTableSlot *ExecResult(ResultState *node); extern void ExecEndResult(ResultState *node); extern void ExecResultMarkPos(ResultState *node); extern void ExecResultRestrPos(ResultState *node); extern void ExecReScanResult(ResultState *node); #endif /* NODERESULT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeAppend.h������������������������������������������������������������������0000644�����������������00000001275�14763166026�0013304 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeAppend.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeAppend.h * *------------------------------------------------------------------------- */ #ifndef NODEAPPEND_H #define NODEAPPEND_H #include "nodes/execnodes.h" extern AppendState *ExecInitAppend(Append *node, EState *estate, int eflags); extern TupleTableSlot *ExecAppend(AppendState *node); extern void ExecEndAppend(AppendState *node); extern void ExecReScanAppend(AppendState *node); #endif /* NODEAPPEND_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeBitmapHeapscan.h����������������������������������������������������������0000644�����������������00000001455�14763166026�0014754 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeBitmapHeapscan.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeBitmapHeapscan.h * *------------------------------------------------------------------------- */ #ifndef NODEBITMAPHEAPSCAN_H #define NODEBITMAPHEAPSCAN_H #include "nodes/execnodes.h" extern BitmapHeapScanState *ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecBitmapHeapScan(BitmapHeapScanState *node); extern void ExecEndBitmapHeapScan(BitmapHeapScanState *node); extern void ExecReScanBitmapHeapScan(BitmapHeapScanState *node); #endif /* NODEBITMAPHEAPSCAN_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeNestloop.h����������������������������������������������������������������0000644�����������������00000001331�14763166026�0013671 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeNestloop.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeNestloop.h * *------------------------------------------------------------------------- */ #ifndef NODENESTLOOP_H #define NODENESTLOOP_H #include "nodes/execnodes.h" extern NestLoopState *ExecInitNestLoop(NestLoop *node, EState *estate, int eflags); extern TupleTableSlot *ExecNestLoop(NestLoopState *node); extern void ExecEndNestLoop(NestLoopState *node); extern void ExecReScanNestLoop(NestLoopState *node); #endif /* NODENESTLOOP_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeRecursiveunion.h����������������������������������������������������������0000644�����������������00000001455�14763166026�0015115 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeRecursiveunion.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeRecursiveunion.h * *------------------------------------------------------------------------- */ #ifndef NODERECURSIVEUNION_H #define NODERECURSIVEUNION_H #include "nodes/execnodes.h" extern RecursiveUnionState *ExecInitRecursiveUnion(RecursiveUnion *node, EState *estate, int eflags); extern TupleTableSlot *ExecRecursiveUnion(RecursiveUnionState *node); extern void ExecEndRecursiveUnion(RecursiveUnionState *node); extern void ExecReScanRecursiveUnion(RecursiveUnionState *node); #endif /* NODERECURSIVEUNION_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeTidscan.h�����������������������������������������������������������������0000644�����������������00000001454�14763166026�0013461 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeTidscan.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeTidscan.h * *------------------------------------------------------------------------- */ #ifndef NODETIDSCAN_H #define NODETIDSCAN_H #include "nodes/execnodes.h" extern TidScanState *ExecInitTidScan(TidScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecTidScan(TidScanState *node); extern void ExecEndTidScan(TidScanState *node); extern void ExecTidMarkPos(TidScanState *node); extern void ExecTidRestrPos(TidScanState *node); extern void ExecReScanTidScan(TidScanState *node); #endif /* NODETIDSCAN_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeAgg.h���������������������������������������������������������������������0000644�����������������00000001416�14763166026�0012570 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeAgg.h * prototypes for nodeAgg.c * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeAgg.h * *------------------------------------------------------------------------- */ #ifndef NODEAGG_H #define NODEAGG_H #include "nodes/execnodes.h" extern AggState *ExecInitAgg(Agg *node, EState *estate, int eflags); extern TupleTableSlot *ExecAgg(AggState *node); extern void ExecEndAgg(AggState *node); extern void ExecReScanAgg(AggState *node); extern Size hash_agg_entry_size(int numAggs); extern Datum aggregate_dummy(PG_FUNCTION_ARGS); #endif /* NODEAGG_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeMaterial.h����������������������������������������������������������������0000644�����������������00000001506�14763166026�0013630 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeMaterial.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeMaterial.h * *------------------------------------------------------------------------- */ #ifndef NODEMATERIAL_H #define NODEMATERIAL_H #include "nodes/execnodes.h" extern MaterialState *ExecInitMaterial(Material *node, EState *estate, int eflags); extern TupleTableSlot *ExecMaterial(MaterialState *node); extern void ExecEndMaterial(MaterialState *node); extern void ExecMaterialMarkPos(MaterialState *node); extern void ExecMaterialRestrPos(MaterialState *node); extern void ExecReScanMaterial(MaterialState *node); #endif /* NODEMATERIAL_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeBitmapIndexscan.h���������������������������������������������������������0000644�����������������00000001466�14763166026�0015150 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeBitmapIndexscan.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeBitmapIndexscan.h * *------------------------------------------------------------------------- */ #ifndef NODEBITMAPINDEXSCAN_H #define NODEBITMAPINDEXSCAN_H #include "nodes/execnodes.h" extern BitmapIndexScanState *ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate, int eflags); extern Node *MultiExecBitmapIndexScan(BitmapIndexScanState *node); extern void ExecEndBitmapIndexScan(BitmapIndexScanState *node); extern void ExecReScanBitmapIndexScan(BitmapIndexScanState *node); #endif /* NODEBITMAPINDEXSCAN_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/tuptable.h��������������������������������������������������������������������0000644�����������������00000020625�14763166026�0013047 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * tuptable.h * tuple table support stuff * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/tuptable.h * *------------------------------------------------------------------------- */ #ifndef TUPTABLE_H #define TUPTABLE_H #include "access/htup.h" #include "storage/buf.h" /*---------- * The executor stores tuples in a "tuple table" which is a List of * independent TupleTableSlots. There are several cases we need to handle: * 1. physical tuple in a disk buffer page * 2. physical tuple constructed in palloc'ed memory * 3. "minimal" physical tuple constructed in palloc'ed memory * 4. "virtual" tuple consisting of Datum/isnull arrays * * The first two cases are similar in that they both deal with "materialized" * tuples, but resource management is different. For a tuple in a disk page * we need to hold a pin on the buffer until the TupleTableSlot's reference * to the tuple is dropped; while for a palloc'd tuple we usually want the * tuple pfree'd when the TupleTableSlot's reference is dropped. * * A "minimal" tuple is handled similarly to a palloc'd regular tuple. * At present, minimal tuples never are stored in buffers, so there is no * parallel to case 1. Note that a minimal tuple has no "system columns". * (Actually, it could have an OID, but we have no need to access the OID.) * * A "virtual" tuple is an optimization used to minimize physical data * copying in a nest of plan nodes. Any pass-by-reference Datums in the * tuple point to storage that is not directly associated with the * TupleTableSlot; generally they will point to part of a tuple stored in * a lower plan node's output TupleTableSlot, or to a function result * constructed in a plan node's per-tuple econtext. It is the responsibility * of the generating plan node to be sure these resources are not released * for as long as the virtual tuple needs to be valid. We only use virtual * tuples in the result slots of plan nodes --- tuples to be copied anywhere * else need to be "materialized" into physical tuples. Note also that a * virtual tuple does not have any "system columns". * * It is also possible for a TupleTableSlot to hold both physical and minimal * copies of a tuple. This is done when the slot is requested to provide * the format other than the one it currently holds. (Originally we attempted * to handle such requests by replacing one format with the other, but that * had the fatal defect of invalidating any pass-by-reference Datums pointing * into the existing slot contents.) Both copies must contain identical data * payloads when this is the case. * * The Datum/isnull arrays of a TupleTableSlot serve double duty. When the * slot contains a virtual tuple, they are the authoritative data. When the * slot contains a physical tuple, the arrays contain data extracted from * the tuple. (In this state, any pass-by-reference Datums point into * the physical tuple.) The extracted information is built "lazily", * ie, only as needed. This serves to avoid repeated extraction of data * from the physical tuple. * * A TupleTableSlot can also be "empty", holding no valid data. This is * the only valid state for a freshly-created slot that has not yet had a * tuple descriptor assigned to it. In this state, tts_isempty must be * TRUE, tts_shouldFree FALSE, tts_tuple NULL, tts_buffer InvalidBuffer, * and tts_nvalid zero. * * The tupleDescriptor is simply referenced, not copied, by the TupleTableSlot * code. The caller of ExecSetSlotDescriptor() is responsible for providing * a descriptor that will live as long as the slot does. (Typically, both * slots and descriptors are in per-query memory and are freed by memory * context deallocation at query end; so it's not worth providing any extra * mechanism to do more. However, the slot will increment the tupdesc * reference count if a reference-counted tupdesc is supplied.) * * When tts_shouldFree is true, the physical tuple is "owned" by the slot * and should be freed when the slot's reference to the tuple is dropped. * * If tts_buffer is not InvalidBuffer, then the slot is holding a pin * on the indicated buffer page; drop the pin when we release the * slot's reference to that buffer. (tts_shouldFree should always be * false in such a case, since presumably tts_tuple is pointing at the * buffer page.) * * tts_nvalid indicates the number of valid columns in the tts_values/isnull * arrays. When the slot is holding a "virtual" tuple this must be equal * to the descriptor's natts. When the slot is holding a physical tuple * this is equal to the number of columns we have extracted (we always * extract columns from left to right, so there are no holes). * * tts_values/tts_isnull are allocated when a descriptor is assigned to the * slot; they are of length equal to the descriptor's natts. * * tts_mintuple must always be NULL if the slot does not hold a "minimal" * tuple. When it does, tts_mintuple points to the actual MinimalTupleData * object (the thing to be pfree'd if tts_shouldFreeMin is true). If the slot * has only a minimal and not also a regular physical tuple, then tts_tuple * points at tts_minhdr and the fields of that struct are set correctly * for access to the minimal tuple; in particular, tts_minhdr.t_data points * MINIMAL_TUPLE_OFFSET bytes before tts_mintuple. This allows column * extraction to treat the case identically to regular physical tuples. * * tts_slow/tts_off are saved state for slot_deform_tuple, and should not * be touched by any other code. *---------- */ typedef struct TupleTableSlot { NodeTag type; bool tts_isempty; /* true = slot is empty */ bool tts_shouldFree; /* should pfree tts_tuple? */ bool tts_shouldFreeMin; /* should pfree tts_mintuple? */ bool tts_slow; /* saved state for slot_deform_tuple */ HeapTuple tts_tuple; /* physical tuple, or NULL if virtual */ TupleDesc tts_tupleDescriptor; /* slot's tuple descriptor */ MemoryContext tts_mcxt; /* slot itself is in this context */ Buffer tts_buffer; /* tuple's buffer, or InvalidBuffer */ int tts_nvalid; /* # of valid values in tts_values */ Datum *tts_values; /* current per-attribute values */ bool *tts_isnull; /* current per-attribute isnull flags */ MinimalTuple tts_mintuple; /* minimal tuple, or NULL if none */ HeapTupleData tts_minhdr; /* workspace for minimal-tuple-only case */ long tts_off; /* saved state for slot_deform_tuple */ } TupleTableSlot; #define TTS_HAS_PHYSICAL_TUPLE(slot) \ ((slot)->tts_tuple != NULL && (slot)->tts_tuple != &((slot)->tts_minhdr)) /* * TupIsNull -- is a TupleTableSlot empty? */ #define TupIsNull(slot) \ ((slot) == NULL || (slot)->tts_isempty) /* in executor/execTuples.c */ extern TupleTableSlot *MakeTupleTableSlot(void); extern TupleTableSlot *ExecAllocTableSlot(List **tupleTable); extern void ExecResetTupleTable(List *tupleTable, bool shouldFree); extern TupleTableSlot *MakeSingleTupleTableSlot(TupleDesc tupdesc); extern void ExecDropSingleTupleTableSlot(TupleTableSlot *slot); extern void ExecSetSlotDescriptor(TupleTableSlot *slot, TupleDesc tupdesc); extern TupleTableSlot *ExecStoreTuple(HeapTuple tuple, TupleTableSlot *slot, Buffer buffer, bool shouldFree); extern TupleTableSlot *ExecStoreMinimalTuple(MinimalTuple mtup, TupleTableSlot *slot, bool shouldFree); extern TupleTableSlot *ExecClearTuple(TupleTableSlot *slot); extern TupleTableSlot *ExecStoreVirtualTuple(TupleTableSlot *slot); extern TupleTableSlot *ExecStoreAllNullTuple(TupleTableSlot *slot); extern HeapTuple ExecCopySlotTuple(TupleTableSlot *slot); extern MinimalTuple ExecCopySlotMinimalTuple(TupleTableSlot *slot); extern HeapTuple ExecFetchSlotTuple(TupleTableSlot *slot); extern MinimalTuple ExecFetchSlotMinimalTuple(TupleTableSlot *slot); extern Datum ExecFetchSlotTupleDatum(TupleTableSlot *slot); extern HeapTuple ExecMaterializeSlot(TupleTableSlot *slot); extern TupleTableSlot *ExecCopySlot(TupleTableSlot *dstslot, TupleTableSlot *srcslot); /* in access/common/heaptuple.c */ extern Datum slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull); extern void slot_getallattrs(TupleTableSlot *slot); extern void slot_getsomeattrs(TupleTableSlot *slot, int attnum); extern bool slot_attisnull(TupleTableSlot *slot, int attnum); #endif /* TUPTABLE_H */ �����������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeSubplan.h�����������������������������������������������������������������0000644�����������������00000001454�14763166026�0013500 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeSubplan.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeSubplan.h * *------------------------------------------------------------------------- */ #ifndef NODESUBPLAN_H #define NODESUBPLAN_H #include "nodes/execnodes.h" extern SubPlanState *ExecInitSubPlan(SubPlan *subplan, PlanState *parent); extern AlternativeSubPlanState *ExecInitAlternativeSubPlan(AlternativeSubPlan *asplan, PlanState *parent); extern void ExecReScanSetParamPlan(SubPlanState *node, PlanState *parent); extern void ExecSetParamPlan(SubPlanState *node, ExprContext *econtext); #endif /* NODESUBPLAN_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeSort.h��������������������������������������������������������������������0000644�����������������00000001376�14763166026�0013026 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeSort.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeSort.h * *------------------------------------------------------------------------- */ #ifndef NODESORT_H #define NODESORT_H #include "nodes/execnodes.h" extern SortState *ExecInitSort(Sort *node, EState *estate, int eflags); extern TupleTableSlot *ExecSort(SortState *node); extern void ExecEndSort(SortState *node); extern void ExecSortMarkPos(SortState *node); extern void ExecSortRestrPos(SortState *node); extern void ExecReScanSort(SortState *node); #endif /* NODESORT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeMergejoin.h���������������������������������������������������������������0000644�����������������00000001347�14763166026�0014014 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeMergejoin.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeMergejoin.h * *------------------------------------------------------------------------- */ #ifndef NODEMERGEJOIN_H #define NODEMERGEJOIN_H #include "nodes/execnodes.h" extern MergeJoinState *ExecInitMergeJoin(MergeJoin *node, EState *estate, int eflags); extern TupleTableSlot *ExecMergeJoin(MergeJoinState *node); extern void ExecEndMergeJoin(MergeJoinState *node); extern void ExecReScanMergeJoin(MergeJoinState *node); #endif /* NODEMERGEJOIN_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/tstoreReceiver.h��������������������������������������������������������������0000644�����������������00000001377�14763166026�0014237 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * tstoreReceiver.h * prototypes for tstoreReceiver.c * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/tstoreReceiver.h * *------------------------------------------------------------------------- */ #ifndef TSTORE_RECEIVER_H #define TSTORE_RECEIVER_H #include "tcop/dest.h" #include "utils/tuplestore.h" extern DestReceiver *CreateTuplestoreDestReceiver(void); extern void SetTuplestoreDestReceiverParams(DestReceiver *self, Tuplestorestate *tStore, MemoryContext tContext, bool detoast); #endif /* TSTORE_RECEIVER_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeBitmapOr.h����������������������������������������������������������������0000644�����������������00000001324�14763166026�0013605 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeBitmapOr.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeBitmapOr.h * *------------------------------------------------------------------------- */ #ifndef NODEBITMAPOR_H #define NODEBITMAPOR_H #include "nodes/execnodes.h" extern BitmapOrState *ExecInitBitmapOr(BitmapOr *node, EState *estate, int eflags); extern Node *MultiExecBitmapOr(BitmapOrState *node); extern void ExecEndBitmapOr(BitmapOrState *node); extern void ExecReScanBitmapOr(BitmapOrState *node); #endif /* NODEBITMAPOR_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeMergeAppend.h�������������������������������������������������������������0000644�����������������00000001403�14763166026�0014255 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeMergeAppend.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeMergeAppend.h * *------------------------------------------------------------------------- */ #ifndef NODEMERGEAPPEND_H #define NODEMERGEAPPEND_H #include "nodes/execnodes.h" extern MergeAppendState *ExecInitMergeAppend(MergeAppend *node, EState *estate, int eflags); extern TupleTableSlot *ExecMergeAppend(MergeAppendState *node); extern void ExecEndMergeAppend(MergeAppendState *node); extern void ExecReScanMergeAppend(MergeAppendState *node); #endif /* NODEMERGEAPPEND_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeIndexonlyscan.h�����������������������������������������������������������0000644�����������������00000001630�14763166026�0014706 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeIndexonlyscan.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeIndexonlyscan.h * *------------------------------------------------------------------------- */ #ifndef NODEINDEXONLYSCAN_H #define NODEINDEXONLYSCAN_H #include "nodes/execnodes.h" extern IndexOnlyScanState *ExecInitIndexOnlyScan(IndexOnlyScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecIndexOnlyScan(IndexOnlyScanState *node); extern void ExecEndIndexOnlyScan(IndexOnlyScanState *node); extern void ExecIndexOnlyMarkPos(IndexOnlyScanState *node); extern void ExecIndexOnlyRestrPos(IndexOnlyScanState *node); extern void ExecReScanIndexOnlyScan(IndexOnlyScanState *node); #endif /* NODEINDEXONLYSCAN_H */ ��������������������������������������������������������������������������������������������������������pgsql/server/executor/hashjoin.h��������������������������������������������������������������������0000644�����������������00000016273�14763166026�0013036 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * hashjoin.h * internal structures for hash joins * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/hashjoin.h * *------------------------------------------------------------------------- */ #ifndef HASHJOIN_H #define HASHJOIN_H #include "nodes/execnodes.h" #include "storage/buffile.h" /* ---------------------------------------------------------------- * hash-join hash table structures * * Each active hashjoin has a HashJoinTable control block, which is * palloc'd in the executor's per-query context. All other storage needed * for the hashjoin is kept in private memory contexts, two for each hashjoin. * This makes it easy and fast to release the storage when we don't need it * anymore. (Exception: data associated with the temp files lives in the * per-query context too, since we always call buffile.c in that context.) * * The hashtable contexts are made children of the per-query context, ensuring * that they will be discarded at end of statement even if the join is * aborted early by an error. (Likewise, any temporary files we make will * be cleaned up by the virtual file manager in event of an error.) * * Storage that should live through the entire join is allocated from the * "hashCxt", while storage that is only wanted for the current batch is * allocated in the "batchCxt". By resetting the batchCxt at the end of * each batch, we free all the per-batch storage reliably and without tedium. * * During first scan of inner relation, we get its tuples from executor. * If nbatch > 1 then tuples that don't belong in first batch get saved * into inner-batch temp files. The same statements apply for the * first scan of the outer relation, except we write tuples to outer-batch * temp files. After finishing the first scan, we do the following for * each remaining batch: * 1. Read tuples from inner batch file, load into hash buckets. * 2. Read tuples from outer batch file, match to hash buckets and output. * * It is possible to increase nbatch on the fly if the in-memory hash table * gets too big. The hash-value-to-batch computation is arranged so that this * can only cause a tuple to go into a later batch than previously thought, * never into an earlier batch. When we increase nbatch, we rescan the hash * table and dump out any tuples that are now of a later batch to the correct * inner batch file. Subsequently, while reading either inner or outer batch * files, we might find tuples that no longer belong to the current batch; * if so, we just dump them out to the correct batch file. * ---------------------------------------------------------------- */ /* these are in nodes/execnodes.h: */ /* typedef struct HashJoinTupleData *HashJoinTuple; */ /* typedef struct HashJoinTableData *HashJoinTable; */ typedef struct HashJoinTupleData { struct HashJoinTupleData *next; /* link to next tuple in same bucket */ uint32 hashvalue; /* tuple's hash code */ /* Tuple data, in MinimalTuple format, follows on a MAXALIGN boundary */ } HashJoinTupleData; #define HJTUPLE_OVERHEAD MAXALIGN(sizeof(HashJoinTupleData)) #define HJTUPLE_MINTUPLE(hjtup) \ ((MinimalTuple) ((char *) (hjtup) + HJTUPLE_OVERHEAD)) /* * If the outer relation's distribution is sufficiently nonuniform, we attempt * to optimize the join by treating the hash values corresponding to the outer * relation's MCVs specially. Inner relation tuples matching these hash * values go into the "skew" hashtable instead of the main hashtable, and * outer relation tuples with these hash values are matched against that * table instead of the main one. Thus, tuples with these hash values are * effectively handled as part of the first batch and will never go to disk. * The skew hashtable is limited to SKEW_WORK_MEM_PERCENT of the total memory * allowed for the join; while building the hashtables, we decrease the number * of MCVs being specially treated if needed to stay under this limit. * * Note: you might wonder why we look at the outer relation stats for this, * rather than the inner. One reason is that the outer relation is typically * bigger, so we get more I/O savings by optimizing for its most common values. * Also, for similarly-sized relations, the planner prefers to put the more * uniformly distributed relation on the inside, so we're more likely to find * interesting skew in the outer relation. */ typedef struct HashSkewBucket { uint32 hashvalue; /* common hash value */ HashJoinTuple tuples; /* linked list of inner-relation tuples */ } HashSkewBucket; #define SKEW_BUCKET_OVERHEAD MAXALIGN(sizeof(HashSkewBucket)) #define INVALID_SKEW_BUCKET_NO (-1) #define SKEW_WORK_MEM_PERCENT 2 #define SKEW_MIN_OUTER_FRACTION 0.01 typedef struct HashJoinTableData { int nbuckets; /* # buckets in the in-memory hash table */ int log2_nbuckets; /* its log2 (nbuckets must be a power of 2) */ /* buckets[i] is head of list of tuples in i'th in-memory bucket */ struct HashJoinTupleData **buckets; /* buckets array is per-batch storage, as are all the tuples */ bool keepNulls; /* true to store unmatchable NULL tuples */ bool skewEnabled; /* are we using skew optimization? */ HashSkewBucket **skewBucket; /* hashtable of skew buckets */ int skewBucketLen; /* size of skewBucket array (a power of 2!) */ int nSkewBuckets; /* number of active skew buckets */ int *skewBucketNums; /* array indexes of active skew buckets */ int nbatch; /* number of batches */ int curbatch; /* current batch #; 0 during 1st pass */ int nbatch_original; /* nbatch when we started inner scan */ int nbatch_outstart; /* nbatch when we started outer scan */ bool growEnabled; /* flag to shut off nbatch increases */ double totalTuples; /* # tuples obtained from inner plan */ /* * These arrays are allocated for the life of the hash join, but only if * nbatch > 1. A file is opened only when we first write a tuple into it * (otherwise its pointer remains NULL). Note that the zero'th array * elements never get used, since we will process rather than dump out any * tuples of batch zero. */ BufFile **innerBatchFile; /* buffered virtual temp file per batch */ BufFile **outerBatchFile; /* buffered virtual temp file per batch */ /* * Info about the datatype-specific hash functions for the datatypes being * hashed. These are arrays of the same length as the number of hash join * clauses (hash keys). */ FmgrInfo *outer_hashfunctions; /* lookup data for hash functions */ FmgrInfo *inner_hashfunctions; /* lookup data for hash functions */ bool *hashStrict; /* is each hash join operator strict? */ Size spaceUsed; /* memory space currently used by tuples */ Size spaceAllowed; /* upper limit for space used */ Size spacePeak; /* peak space used */ Size spaceUsedSkew; /* skew hash table's current space usage */ Size spaceAllowedSkew; /* upper limit for skew hashtable */ MemoryContext hashCxt; /* context for whole-hash-join storage */ MemoryContext batchCxt; /* context for this-batch-only storage */ } HashJoinTableData; #endif /* HASHJOIN_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeIndexscan.h���������������������������������������������������������������0000644�����������������00000003026�14763166026�0014005 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeIndexscan.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeIndexscan.h * *------------------------------------------------------------------------- */ #ifndef NODEINDEXSCAN_H #define NODEINDEXSCAN_H #include "nodes/execnodes.h" extern IndexScanState *ExecInitIndexScan(IndexScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecIndexScan(IndexScanState *node); extern void ExecEndIndexScan(IndexScanState *node); extern void ExecIndexMarkPos(IndexScanState *node); extern void ExecIndexRestrPos(IndexScanState *node); extern void ExecReScanIndexScan(IndexScanState *node); /* * These routines are exported to share code with nodeIndexonlyscan.c and * nodeBitmapIndexscan.c */ extern void ExecIndexBuildScanKeys(PlanState *planstate, Relation index, List *quals, bool isorderby, ScanKey *scanKeys, int *numScanKeys, IndexRuntimeKeyInfo **runtimeKeys, int *numRuntimeKeys, IndexArrayKeyInfo **arrayKeys, int *numArrayKeys); extern void ExecIndexEvalRuntimeKeys(ExprContext *econtext, IndexRuntimeKeyInfo *runtimeKeys, int numRuntimeKeys); extern bool ExecIndexEvalArrayKeys(ExprContext *econtext, IndexArrayKeyInfo *arrayKeys, int numArrayKeys); extern bool ExecIndexAdvanceArrayKeys(IndexArrayKeyInfo *arrayKeys, int numArrayKeys); #endif /* NODEINDEXSCAN_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeLimit.h�������������������������������������������������������������������0000644�����������������00000001257�14763166026�0013153 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeLimit.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeLimit.h * *------------------------------------------------------------------------- */ #ifndef NODELIMIT_H #define NODELIMIT_H #include "nodes/execnodes.h" extern LimitState *ExecInitLimit(Limit *node, EState *estate, int eflags); extern TupleTableSlot *ExecLimit(LimitState *node); extern void ExecEndLimit(LimitState *node); extern void ExecReScanLimit(LimitState *node); #endif /* NODELIMIT_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeLockRows.h����������������������������������������������������������������0000644�����������������00000001331�14763166026�0013631 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeLockRows.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeLockRows.h * *------------------------------------------------------------------------- */ #ifndef NODELOCKROWS_H #define NODELOCKROWS_H #include "nodes/execnodes.h" extern LockRowsState *ExecInitLockRows(LockRows *node, EState *estate, int eflags); extern TupleTableSlot *ExecLockRows(LockRowsState *node); extern void ExecEndLockRows(LockRowsState *node); extern void ExecReScanLockRows(LockRowsState *node); #endif /* NODELOCKROWS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeGroup.h�������������������������������������������������������������������0000644�����������������00000001314�14763166026�0013163 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeGroup.h * prototypes for nodeGroup.c * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeGroup.h * *------------------------------------------------------------------------- */ #ifndef NODEGROUP_H #define NODEGROUP_H #include "nodes/execnodes.h" extern GroupState *ExecInitGroup(Group *node, EState *estate, int eflags); extern TupleTableSlot *ExecGroup(GroupState *node); extern void ExecEndGroup(GroupState *node); extern void ExecReScanGroup(GroupState *node); #endif /* NODEGROUP_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeWindowAgg.h���������������������������������������������������������������0000644�����������������00000001410�14763166026�0013752 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeWindowAgg.h * prototypes for nodeWindowAgg.c * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeWindowAgg.h * *------------------------------------------------------------------------- */ #ifndef NODEWINDOWAGG_H #define NODEWINDOWAGG_H #include "nodes/execnodes.h" extern WindowAggState *ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags); extern TupleTableSlot *ExecWindowAgg(WindowAggState *node); extern void ExecEndWindowAgg(WindowAggState *node); extern void ExecReScanWindowAgg(WindowAggState *node); #endif /* NODEWINDOWAGG_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeUnique.h������������������������������������������������������������������0000644�����������������00000001275�14763166026�0013343 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeUnique.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeUnique.h * *------------------------------------------------------------------------- */ #ifndef NODEUNIQUE_H #define NODEUNIQUE_H #include "nodes/execnodes.h" extern UniqueState *ExecInitUnique(Unique *node, EState *estate, int eflags); extern TupleTableSlot *ExecUnique(UniqueState *node); extern void ExecEndUnique(UniqueState *node); extern void ExecReScanUnique(UniqueState *node); #endif /* NODEUNIQUE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/nodeSeqscan.h�����������������������������������������������������������������0000644�����������������00000001454�14763166026�0013471 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * nodeSeqscan.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeSeqscan.h * *------------------------------------------------------------------------- */ #ifndef NODESEQSCAN_H #define NODESEQSCAN_H #include "nodes/execnodes.h" extern SeqScanState *ExecInitSeqScan(SeqScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecSeqScan(SeqScanState *node); extern void ExecEndSeqScan(SeqScanState *node); extern void ExecSeqMarkPos(SeqScanState *node); extern void ExecSeqRestrPos(SeqScanState *node); extern void ExecReScanSeqScan(SeqScanState *node); #endif /* NODESEQSCAN_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/instrument.h������������������������������������������������������������������0000644�����������������00000005451�14763166026�0013437 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * instrument.h * definitions for run-time statistics collection * * * Copyright (c) 2001-2012, PostgreSQL Global Development Group * * src/include/executor/instrument.h * *------------------------------------------------------------------------- */ #ifndef INSTRUMENT_H #define INSTRUMENT_H #include "portability/instr_time.h" typedef struct BufferUsage { long shared_blks_hit; /* # of shared buffer hits */ long shared_blks_read; /* # of shared disk blocks read */ long shared_blks_dirtied; /* # of shared blocks dirtied */ long shared_blks_written; /* # of shared disk blocks written */ long local_blks_hit; /* # of local buffer hits */ long local_blks_read; /* # of local disk blocks read */ long local_blks_dirtied; /* # of shared blocks dirtied */ long local_blks_written; /* # of local disk blocks written */ long temp_blks_read; /* # of temp blocks read */ long temp_blks_written; /* # of temp blocks written */ instr_time blk_read_time; /* time spent reading */ instr_time blk_write_time; /* time spent writing */ } BufferUsage; /* Flag bits included in InstrAlloc's instrument_options bitmask */ typedef enum InstrumentOption { INSTRUMENT_TIMER = 1 << 0, /* needs timer (and row counts) */ INSTRUMENT_BUFFERS = 1 << 1, /* needs buffer usage */ INSTRUMENT_ROWS = 1 << 2, /* needs row count */ INSTRUMENT_ALL = 0x7FFFFFFF } InstrumentOption; typedef struct Instrumentation { /* Parameters set at node creation: */ bool need_timer; /* TRUE if we need timer data */ bool need_bufusage; /* TRUE if we need buffer usage data */ /* Info about current plan cycle: */ bool running; /* TRUE if we've completed first tuple */ instr_time starttime; /* Start time of current iteration of node */ instr_time counter; /* Accumulated runtime for this node */ double firsttuple; /* Time for first tuple of this cycle */ double tuplecount; /* Tuples emitted so far this cycle */ BufferUsage bufusage_start; /* Buffer usage at start */ /* Accumulated statistics across all completed cycles: */ double startup; /* Total startup time (in seconds) */ double total; /* Total total time (in seconds) */ double ntuples; /* Total tuples produced */ double nloops; /* # of run cycles for this node */ double nfiltered1; /* # tuples removed by scanqual or joinqual */ double nfiltered2; /* # tuples removed by "other" quals */ BufferUsage bufusage; /* Total buffer usage */ } Instrumentation; extern PGDLLIMPORT BufferUsage pgBufferUsage; extern Instrumentation *InstrAlloc(int n, int instrument_options); extern void InstrStartNode(Instrumentation *instr); extern void InstrStopNode(Instrumentation *instr, double nTuples); extern void InstrEndLoop(Instrumentation *instr); #endif /* INSTRUMENT_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/spi.h�������������������������������������������������������������������������0000644�����������������00000013037�14763166026�0012021 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * spi.h * Server Programming Interface public declarations * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/spi.h * *------------------------------------------------------------------------- */ #ifndef SPI_H #define SPI_H #include "nodes/parsenodes.h" #include "utils/portal.h" typedef struct SPITupleTable { MemoryContext tuptabcxt; /* memory context of result table */ uint32 alloced; /* # of alloced vals */ uint32 free; /* # of free vals */ TupleDesc tupdesc; /* tuple descriptor */ HeapTuple *vals; /* tuples */ } SPITupleTable; /* Plans are opaque structs for standard users of SPI */ typedef struct _SPI_plan *SPIPlanPtr; #define SPI_ERROR_CONNECT (-1) #define SPI_ERROR_COPY (-2) #define SPI_ERROR_OPUNKNOWN (-3) #define SPI_ERROR_UNCONNECTED (-4) #define SPI_ERROR_CURSOR (-5) /* not used anymore */ #define SPI_ERROR_ARGUMENT (-6) #define SPI_ERROR_PARAM (-7) #define SPI_ERROR_TRANSACTION (-8) #define SPI_ERROR_NOATTRIBUTE (-9) #define SPI_ERROR_NOOUTFUNC (-10) #define SPI_ERROR_TYPUNKNOWN (-11) #define SPI_OK_CONNECT 1 #define SPI_OK_FINISH 2 #define SPI_OK_FETCH 3 #define SPI_OK_UTILITY 4 #define SPI_OK_SELECT 5 #define SPI_OK_SELINTO 6 #define SPI_OK_INSERT 7 #define SPI_OK_DELETE 8 #define SPI_OK_UPDATE 9 #define SPI_OK_CURSOR 10 #define SPI_OK_INSERT_RETURNING 11 #define SPI_OK_DELETE_RETURNING 12 #define SPI_OK_UPDATE_RETURNING 13 #define SPI_OK_REWRITTEN 14 extern PGDLLIMPORT uint32 SPI_processed; extern PGDLLIMPORT Oid SPI_lastoid; extern PGDLLIMPORT SPITupleTable *SPI_tuptable; extern PGDLLIMPORT int SPI_result; extern int SPI_connect(void); extern int SPI_finish(void); extern void SPI_push(void); extern void SPI_pop(void); extern bool SPI_push_conditional(void); extern void SPI_pop_conditional(bool pushed); extern void SPI_restore_connection(void); extern int SPI_execute(const char *src, bool read_only, long tcount); extern int SPI_execute_plan(SPIPlanPtr plan, Datum *Values, const char *Nulls, bool read_only, long tcount); extern int SPI_execute_plan_with_paramlist(SPIPlanPtr plan, ParamListInfo params, bool read_only, long tcount); extern int SPI_exec(const char *src, long tcount); extern int SPI_execp(SPIPlanPtr plan, Datum *Values, const char *Nulls, long tcount); extern int SPI_execute_snapshot(SPIPlanPtr plan, Datum *Values, const char *Nulls, Snapshot snapshot, Snapshot crosscheck_snapshot, bool read_only, bool fire_triggers, long tcount); extern int SPI_execute_with_args(const char *src, int nargs, Oid *argtypes, Datum *Values, const char *Nulls, bool read_only, long tcount); extern SPIPlanPtr SPI_prepare(const char *src, int nargs, Oid *argtypes); extern SPIPlanPtr SPI_prepare_cursor(const char *src, int nargs, Oid *argtypes, int cursorOptions); extern SPIPlanPtr SPI_prepare_params(const char *src, ParserSetupHook parserSetup, void *parserSetupArg, int cursorOptions); extern int SPI_keepplan(SPIPlanPtr plan); extern SPIPlanPtr SPI_saveplan(SPIPlanPtr plan); extern int SPI_freeplan(SPIPlanPtr plan); extern Oid SPI_getargtypeid(SPIPlanPtr plan, int argIndex); extern int SPI_getargcount(SPIPlanPtr plan); extern bool SPI_is_cursor_plan(SPIPlanPtr plan); extern bool SPI_plan_is_valid(SPIPlanPtr plan); extern const char *SPI_result_code_string(int code); extern List *SPI_plan_get_plan_sources(SPIPlanPtr plan); extern CachedPlan *SPI_plan_get_cached_plan(SPIPlanPtr plan); extern HeapTuple SPI_copytuple(HeapTuple tuple); extern HeapTupleHeader SPI_returntuple(HeapTuple tuple, TupleDesc tupdesc); extern HeapTuple SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum, Datum *Values, const char *Nulls); extern int SPI_fnumber(TupleDesc tupdesc, const char *fname); extern char *SPI_fname(TupleDesc tupdesc, int fnumber); extern char *SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber); extern Datum SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull); extern char *SPI_gettype(TupleDesc tupdesc, int fnumber); extern Oid SPI_gettypeid(TupleDesc tupdesc, int fnumber); extern char *SPI_getrelname(Relation rel); extern char *SPI_getnspname(Relation rel); extern void *SPI_palloc(Size size); extern void *SPI_repalloc(void *pointer, Size size); extern void SPI_pfree(void *pointer); extern void SPI_freetuple(HeapTuple pointer); extern void SPI_freetuptable(SPITupleTable *tuptable); extern Portal SPI_cursor_open(const char *name, SPIPlanPtr plan, Datum *Values, const char *Nulls, bool read_only); extern Portal SPI_cursor_open_with_args(const char *name, const char *src, int nargs, Oid *argtypes, Datum *Values, const char *Nulls, bool read_only, int cursorOptions); extern Portal SPI_cursor_open_with_paramlist(const char *name, SPIPlanPtr plan, ParamListInfo params, bool read_only); extern Portal SPI_cursor_find(const char *name); extern void SPI_cursor_fetch(Portal portal, bool forward, long count); extern void SPI_cursor_move(Portal portal, bool forward, long count); extern void SPI_scroll_cursor_fetch(Portal, FetchDirection direction, long count); extern void SPI_scroll_cursor_move(Portal, FetchDirection direction, long count); extern void SPI_cursor_close(Portal portal); extern void AtEOXact_SPI(bool isCommit); extern void AtEOSubXact_SPI(bool isCommit, SubTransactionId mySubid); #endif /* SPI_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/executor/executor.h��������������������������������������������������������������������0000644�����������������00000035074�14763166026�0013071 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * executor.h * support for the POSTGRES executor module * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/executor.h * *------------------------------------------------------------------------- */ #ifndef EXECUTOR_H #define EXECUTOR_H #include "executor/execdesc.h" #include "nodes/parsenodes.h" /* * The "eflags" argument to ExecutorStart and the various ExecInitNode * routines is a bitwise OR of the following flag bits, which tell the * called plan node what to expect. Note that the flags will get modified * as they are passed down the plan tree, since an upper node may require * functionality in its subnode not demanded of the plan as a whole * (example: MergeJoin requires mark/restore capability in its inner input), * or an upper node may shield its input from some functionality requirement * (example: Materialize shields its input from needing to do backward scan). * * EXPLAIN_ONLY indicates that the plan tree is being initialized just so * EXPLAIN can print it out; it will not be run. Hence, no side-effects * of startup should occur. However, error checks (such as permission checks) * should be performed. * * REWIND indicates that the plan node should try to efficiently support * rescans without parameter changes. (Nodes must support ExecReScan calls * in any case, but if this flag was not given, they are at liberty to do it * through complete recalculation. Note that a parameter change forces a * full recalculation in any case.) * * BACKWARD indicates that the plan node must respect the es_direction flag. * When this is not passed, the plan node will only be run forwards. * * MARK indicates that the plan node must support Mark/Restore calls. * When this is not passed, no Mark/Restore will occur. * * SKIP_TRIGGERS tells ExecutorStart/ExecutorFinish to skip calling * AfterTriggerBeginQuery/AfterTriggerEndQuery. This does not necessarily * mean that the plan can't queue any AFTER triggers; just that the caller * is responsible for there being a trigger context for them to be queued in. * * WITH/WITHOUT_OIDS tell the executor to emit tuples with or without space * for OIDs, respectively. These are currently used only for CREATE TABLE AS. * If neither is set, the plan may or may not produce tuples including OIDs. */ #define EXEC_FLAG_EXPLAIN_ONLY 0x0001 /* EXPLAIN, no ANALYZE */ #define EXEC_FLAG_REWIND 0x0002 /* need efficient rescan */ #define EXEC_FLAG_BACKWARD 0x0004 /* need backward scan */ #define EXEC_FLAG_MARK 0x0008 /* need mark/restore */ #define EXEC_FLAG_SKIP_TRIGGERS 0x0010 /* skip AfterTrigger calls */ #define EXEC_FLAG_WITH_OIDS 0x0020 /* force OIDs in returned tuples */ #define EXEC_FLAG_WITHOUT_OIDS 0x0040 /* force no OIDs in returned tuples */ /* * ExecEvalExpr was formerly a function containing a switch statement; * now it's just a macro invoking the function pointed to by an ExprState * node. Beware of double evaluation of the ExprState argument! */ #define ExecEvalExpr(expr, econtext, isNull, isDone) \ ((*(expr)->evalfunc) (expr, econtext, isNull, isDone)) /* Hook for plugins to get control in ExecutorStart() */ typedef void (*ExecutorStart_hook_type) (QueryDesc *queryDesc, int eflags); extern PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook; /* Hook for plugins to get control in ExecutorRun() */ typedef void (*ExecutorRun_hook_type) (QueryDesc *queryDesc, ScanDirection direction, long count); extern PGDLLIMPORT ExecutorRun_hook_type ExecutorRun_hook; /* Hook for plugins to get control in ExecutorFinish() */ typedef void (*ExecutorFinish_hook_type) (QueryDesc *queryDesc); extern PGDLLIMPORT ExecutorFinish_hook_type ExecutorFinish_hook; /* Hook for plugins to get control in ExecutorEnd() */ typedef void (*ExecutorEnd_hook_type) (QueryDesc *queryDesc); extern PGDLLIMPORT ExecutorEnd_hook_type ExecutorEnd_hook; /* Hook for plugins to get control in ExecCheckRTPerms() */ typedef bool (*ExecutorCheckPerms_hook_type) (List *, bool); extern PGDLLIMPORT ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook; /* * prototypes from functions in execAmi.c */ extern void ExecReScan(PlanState *node); extern void ExecMarkPos(PlanState *node); extern void ExecRestrPos(PlanState *node); extern bool ExecSupportsMarkRestore(NodeTag plantype); extern bool ExecSupportsBackwardScan(Plan *node); extern bool ExecMaterializesOutput(NodeTag plantype); /* * prototypes from functions in execCurrent.c */ extern bool execCurrentOf(CurrentOfExpr *cexpr, ExprContext *econtext, Oid table_oid, ItemPointer current_tid); /* * prototypes from functions in execGrouping.c */ extern bool execTuplesMatch(TupleTableSlot *slot1, TupleTableSlot *slot2, int numCols, AttrNumber *matchColIdx, FmgrInfo *eqfunctions, MemoryContext evalContext); extern bool execTuplesUnequal(TupleTableSlot *slot1, TupleTableSlot *slot2, int numCols, AttrNumber *matchColIdx, FmgrInfo *eqfunctions, MemoryContext evalContext); extern FmgrInfo *execTuplesMatchPrepare(int numCols, Oid *eqOperators); extern void execTuplesHashPrepare(int numCols, Oid *eqOperators, FmgrInfo **eqFunctions, FmgrInfo **hashFunctions); extern TupleHashTable BuildTupleHashTable(int numCols, AttrNumber *keyColIdx, FmgrInfo *eqfunctions, FmgrInfo *hashfunctions, long nbuckets, Size entrysize, MemoryContext tablecxt, MemoryContext tempcxt); extern TupleHashEntry LookupTupleHashEntry(TupleHashTable hashtable, TupleTableSlot *slot, bool *isnew); extern TupleHashEntry FindTupleHashEntry(TupleHashTable hashtable, TupleTableSlot *slot, FmgrInfo *eqfunctions, FmgrInfo *hashfunctions); /* * prototypes from functions in execJunk.c */ extern JunkFilter *ExecInitJunkFilter(List *targetList, bool hasoid, TupleTableSlot *slot); extern JunkFilter *ExecInitJunkFilterConversion(List *targetList, TupleDesc cleanTupType, TupleTableSlot *slot); extern AttrNumber ExecFindJunkAttribute(JunkFilter *junkfilter, const char *attrName); extern AttrNumber ExecFindJunkAttributeInTlist(List *targetlist, const char *attrName); extern Datum ExecGetJunkAttribute(TupleTableSlot *slot, AttrNumber attno, bool *isNull); extern TupleTableSlot *ExecFilterJunk(JunkFilter *junkfilter, TupleTableSlot *slot); /* * prototypes from functions in execMain.c */ extern void ExecutorStart(QueryDesc *queryDesc, int eflags); extern void standard_ExecutorStart(QueryDesc *queryDesc, int eflags); extern void ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, long count); extern void standard_ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, long count); extern void ExecutorFinish(QueryDesc *queryDesc); extern void standard_ExecutorFinish(QueryDesc *queryDesc); extern void ExecutorEnd(QueryDesc *queryDesc); extern void standard_ExecutorEnd(QueryDesc *queryDesc); extern void ExecutorRewind(QueryDesc *queryDesc); extern bool ExecCheckRTPerms(List *rangeTable, bool ereport_on_violation); extern void CheckValidResultRel(Relation resultRel, CmdType operation); extern void InitResultRelInfo(ResultRelInfo *resultRelInfo, Relation resultRelationDesc, Index resultRelationIndex, int instrument_options); extern ResultRelInfo *ExecGetTriggerResultRel(EState *estate, Oid relid); extern bool ExecContextForcesOids(PlanState *planstate, bool *hasoids); extern void ExecConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate); extern ExecRowMark *ExecFindRowMark(EState *estate, Index rti); extern ExecAuxRowMark *ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist); extern TupleTableSlot *EvalPlanQual(EState *estate, EPQState *epqstate, Relation relation, Index rti, ItemPointer tid, TransactionId priorXmax); extern HeapTuple EvalPlanQualFetch(EState *estate, Relation relation, int lockmode, ItemPointer tid, TransactionId priorXmax); extern void EvalPlanQualInit(EPQState *epqstate, EState *estate, Plan *subplan, List *auxrowmarks, int epqParam); extern void EvalPlanQualSetPlan(EPQState *epqstate, Plan *subplan, List *auxrowmarks); extern void EvalPlanQualSetTuple(EPQState *epqstate, Index rti, HeapTuple tuple); extern HeapTuple EvalPlanQualGetTuple(EPQState *epqstate, Index rti); #define EvalPlanQualSetSlot(epqstate, slot) ((epqstate)->origslot = (slot)) extern void EvalPlanQualFetchRowMarks(EPQState *epqstate); extern TupleTableSlot *EvalPlanQualNext(EPQState *epqstate); extern void EvalPlanQualBegin(EPQState *epqstate, EState *parentestate); extern void EvalPlanQualEnd(EPQState *epqstate); /* * prototypes from functions in execProcnode.c */ extern PlanState *ExecInitNode(Plan *node, EState *estate, int eflags); extern TupleTableSlot *ExecProcNode(PlanState *node); extern Node *MultiExecProcNode(PlanState *node); extern void ExecEndNode(PlanState *node); /* * prototypes from functions in execQual.c */ extern Datum GetAttributeByNum(HeapTupleHeader tuple, AttrNumber attrno, bool *isNull); extern Datum GetAttributeByName(HeapTupleHeader tuple, const char *attname, bool *isNull); extern Tuplestorestate *ExecMakeTableFunctionResult(ExprState *funcexpr, ExprContext *econtext, MemoryContext argContext, TupleDesc expectedDesc, bool randomAccess); extern Datum ExecEvalExprSwitchContext(ExprState *expression, ExprContext *econtext, bool *isNull, ExprDoneCond *isDone); extern ExprState *ExecInitExpr(Expr *node, PlanState *parent); extern ExprState *ExecPrepareExpr(Expr *node, EState *estate); extern bool ExecQual(List *qual, ExprContext *econtext, bool resultForNull); extern int ExecTargetListLength(List *targetlist); extern int ExecCleanTargetListLength(List *targetlist); extern TupleTableSlot *ExecProject(ProjectionInfo *projInfo, ExprDoneCond *isDone); /* * prototypes from functions in execScan.c */ typedef TupleTableSlot *(*ExecScanAccessMtd) (ScanState *node); typedef bool (*ExecScanRecheckMtd) (ScanState *node, TupleTableSlot *slot); extern TupleTableSlot *ExecScan(ScanState *node, ExecScanAccessMtd accessMtd, ExecScanRecheckMtd recheckMtd); extern void ExecAssignScanProjectionInfo(ScanState *node); extern void ExecScanReScan(ScanState *node); /* * prototypes from functions in execTuples.c */ extern void ExecInitResultTupleSlot(EState *estate, PlanState *planstate); extern void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate); extern TupleTableSlot *ExecInitExtraTupleSlot(EState *estate); extern TupleTableSlot *ExecInitNullTupleSlot(EState *estate, TupleDesc tupType); extern TupleDesc ExecTypeFromTL(List *targetList, bool hasoid); extern TupleDesc ExecCleanTypeFromTL(List *targetList, bool hasoid); extern TupleDesc ExecTypeFromExprList(List *exprList, List *namesList); extern void ExecTypeSetColNames(TupleDesc typeInfo, List *namesList); extern void UpdateChangedParamSet(PlanState *node, Bitmapset *newchg); typedef struct TupOutputState { TupleTableSlot *slot; DestReceiver *dest; } TupOutputState; extern TupOutputState *begin_tup_output_tupdesc(DestReceiver *dest, TupleDesc tupdesc); extern void do_tup_output(TupOutputState *tstate, Datum *values, bool *isnull); extern void do_text_output_multiline(TupOutputState *tstate, const char *txt); extern void end_tup_output(TupOutputState *tstate); /* * Write a single line of text given as a C string. * * Should only be used with a single-TEXT-attribute tupdesc. */ #define do_text_output_oneline(tstate, str_to_emit) \ do { \ Datum values_[1]; \ bool isnull_[1]; \ values_[0] = PointerGetDatum(cstring_to_text(str_to_emit)); \ isnull_[0] = false; \ do_tup_output(tstate, values_, isnull_); \ pfree(DatumGetPointer(values_[0])); \ } while (0) /* * prototypes from functions in execUtils.c */ extern EState *CreateExecutorState(void); extern void FreeExecutorState(EState *estate); extern ExprContext *CreateExprContext(EState *estate); extern ExprContext *CreateStandaloneExprContext(void); extern void FreeExprContext(ExprContext *econtext, bool isCommit); extern void ReScanExprContext(ExprContext *econtext); #define ResetExprContext(econtext) \ MemoryContextReset((econtext)->ecxt_per_tuple_memory) extern ExprContext *MakePerTupleExprContext(EState *estate); /* Get an EState's per-output-tuple exprcontext, making it if first use */ #define GetPerTupleExprContext(estate) \ ((estate)->es_per_tuple_exprcontext ? \ (estate)->es_per_tuple_exprcontext : \ MakePerTupleExprContext(estate)) #define GetPerTupleMemoryContext(estate) \ (GetPerTupleExprContext(estate)->ecxt_per_tuple_memory) /* Reset an EState's per-output-tuple exprcontext, if one's been created */ #define ResetPerTupleExprContext(estate) \ do { \ if ((estate)->es_per_tuple_exprcontext) \ ResetExprContext((estate)->es_per_tuple_exprcontext); \ } while (0) extern void ExecAssignExprContext(EState *estate, PlanState *planstate); extern void ExecAssignResultType(PlanState *planstate, TupleDesc tupDesc); extern void ExecAssignResultTypeFromTL(PlanState *planstate); extern TupleDesc ExecGetResultType(PlanState *planstate); extern ProjectionInfo *ExecBuildProjectionInfo(List *targetList, ExprContext *econtext, TupleTableSlot *slot, TupleDesc inputDesc); extern void ExecAssignProjectionInfo(PlanState *planstate, TupleDesc inputDesc); extern void ExecFreeExprContext(PlanState *planstate); extern TupleDesc ExecGetScanType(ScanState *scanstate); extern void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc); extern void ExecAssignScanTypeFromOuterPlan(ScanState *scanstate); extern bool ExecRelationIsTargetRelation(EState *estate, Index scanrelid); extern Relation ExecOpenScanRelation(EState *estate, Index scanrelid); extern void ExecCloseScanRelation(Relation scanrel); extern void ExecOpenIndices(ResultRelInfo *resultRelInfo); extern void ExecCloseIndices(ResultRelInfo *resultRelInfo); extern List *ExecInsertIndexTuples(TupleTableSlot *slot, ItemPointer tupleid, EState *estate); extern bool check_exclusion_constraint(Relation heap, Relation index, IndexInfo *indexInfo, ItemPointer tupleid, Datum *values, bool *isnull, EState *estate, bool newIndex, bool errorOK); extern void RegisterExprContextCallback(ExprContext *econtext, ExprContextCallbackFunction function, Datum arg); extern void UnregisterExprContextCallback(ExprContext *econtext, ExprContextCallbackFunction function, Datum arg); #endif /* EXECUTOR_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/replication/walprotocol.h��������������������������������������������������������������0000644�����������������00000006447�14763166026�0014255 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * walprotocol.h * Definitions relevant to the streaming WAL transmission protocol. * * Portions Copyright (c) 2010-2012, PostgreSQL Global Development Group * * src/include/replication/walprotocol.h * *------------------------------------------------------------------------- */ #ifndef _WALPROTOCOL_H #define _WALPROTOCOL_H #include "access/xlogdefs.h" #include "datatype/timestamp.h" /* * All messages from WalSender must contain these fields to allow us to * correctly calculate the replication delay. */ typedef struct { /* Current end of WAL on the sender */ XLogRecPtr walEnd; /* Sender's system clock at the time of transmission */ TimestampTz sendTime; } WalSndrMessage; /* * Header for a WAL data message (message type 'w'). This is wrapped within * a CopyData message at the FE/BE protocol level. * * The header is followed by actual WAL data. Note that the data length is * not specified in the header --- it's just whatever remains in the message. * * walEnd and sendTime are not essential data, but are provided in case * the receiver wants to adjust its behavior depending on how far behind * it is. */ typedef struct { /* WAL start location of the data included in this message */ XLogRecPtr dataStart; /* Current end of WAL on the sender */ XLogRecPtr walEnd; /* Sender's system clock at the time of transmission */ TimestampTz sendTime; } WalDataMessageHeader; /* * Keepalive message from primary (message type 'k'). (lowercase k) * This is wrapped within a CopyData message at the FE/BE protocol level. * * Note that the data length is not specified here. */ typedef WalSndrMessage PrimaryKeepaliveMessage; /* * Reply message from standby (message type 'r'). This is wrapped within * a CopyData message at the FE/BE protocol level. * * Note that the data length is not specified here. */ typedef struct { /* * The xlog locations that have been written, flushed, and applied by * standby-side. These may be invalid if the standby-side is unable to or * chooses not to report these. */ XLogRecPtr write; XLogRecPtr flush; XLogRecPtr apply; /* Sender's system clock at the time of transmission */ TimestampTz sendTime; } StandbyReplyMessage; /* * Hot Standby feedback from standby (message type 'h'). This is wrapped within * a CopyData message at the FE/BE protocol level. * * Note that the data length is not specified here. */ typedef struct { /* * The current xmin and epoch from the standby, for Hot Standby feedback. * This may be invalid if the standby-side does not support feedback, or * Hot Standby is not yet available. */ TransactionId xmin; uint32 epoch; /* Sender's system clock at the time of transmission */ TimestampTz sendTime; } StandbyHSFeedbackMessage; /* * Maximum data payload in a WAL data message. Must be >= XLOG_BLCKSZ. * * We don't have a good idea of what a good value would be; there's some * overhead per message in both walsender and walreceiver, but on the other * hand sending large batches makes walsender less responsive to signals * because signals are checked only between messages. 128kB (with * default 8k blocks) seems like a reasonable guess for now. */ #define MAX_SEND_SIZE (XLOG_BLCKSZ * 16) #endif /* _WALPROTOCOL_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/replication/walreceiver.h��������������������������������������������������������������0000644�����������������00000007455�14763166026�0014220 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * walreceiver.h * Exports from replication/walreceiverfuncs.c. * * Portions Copyright (c) 2010-2012, PostgreSQL Global Development Group * * src/include/replication/walreceiver.h * *------------------------------------------------------------------------- */ #ifndef _WALRECEIVER_H #define _WALRECEIVER_H #include "access/xlog.h" #include "access/xlogdefs.h" #include "storage/spin.h" #include "pgtime.h" extern int wal_receiver_status_interval; extern bool hot_standby_feedback; /* * MAXCONNINFO: maximum size of a connection string. * * XXX: Should this move to pg_config_manual.h? */ #define MAXCONNINFO 1024 /* Can we allow the standby to accept replication connection from another standby? */ #define AllowCascadeReplication() (EnableHotStandby && max_wal_senders > 0) /* * Values for WalRcv->walRcvState. */ typedef enum { WALRCV_STOPPED, /* stopped and mustn't start up again */ WALRCV_STARTING, /* launched, but the process hasn't * initialized yet */ WALRCV_RUNNING, /* walreceiver is running */ WALRCV_STOPPING /* requested to stop, but still running */ } WalRcvState; /* Shared memory area for management of walreceiver process */ typedef struct { /* * PID of currently active walreceiver process, its current state and * start time (actually, the time at which it was requested to be * started). */ pid_t pid; WalRcvState walRcvState; pg_time_t startTime; /* * receiveStart is the first byte position that will be received. When * startup process starts the walreceiver, it sets receiveStart to the * point where it wants the streaming to begin. */ XLogRecPtr receiveStart; /* * receivedUpto-1 is the last byte position that has already been * received. At the first startup of walreceiver, receivedUpto is set to * receiveStart. After that, walreceiver updates this whenever it flushes * the received WAL to disk. */ XLogRecPtr receivedUpto; /* * latestChunkStart is the starting byte position of the current "batch" * of received WAL. It's actually the same as the previous value of * receivedUpto before the last flush to disk. Startup process can use * this to detect whether it's keeping up or not. */ XLogRecPtr latestChunkStart; /* * Time of send and receive of any message received. */ TimestampTz lastMsgSendTime; TimestampTz lastMsgReceiptTime; /* * Latest reported end of WAL on the sender */ XLogRecPtr latestWalEnd; TimestampTz latestWalEndTime; /* * connection string; is used for walreceiver to connect with the primary. */ char conninfo[MAXCONNINFO]; slock_t mutex; /* locks shared variables shown above */ } WalRcvData; extern WalRcvData *WalRcv; /* libpqwalreceiver hooks */ typedef bool (*walrcv_connect_type) (char *conninfo, XLogRecPtr startpoint); extern PGDLLIMPORT walrcv_connect_type walrcv_connect; typedef bool (*walrcv_receive_type) (int timeout, unsigned char *type, char **buffer, int *len); extern PGDLLIMPORT walrcv_receive_type walrcv_receive; typedef void (*walrcv_send_type) (const char *buffer, int nbytes); extern PGDLLIMPORT walrcv_send_type walrcv_send; typedef void (*walrcv_disconnect_type) (void); extern PGDLLIMPORT walrcv_disconnect_type walrcv_disconnect; /* prototypes for functions in walreceiver.c */ extern void WalReceiverMain(void); /* prototypes for functions in walreceiverfuncs.c */ extern Size WalRcvShmemSize(void); extern void WalRcvShmemInit(void); extern void ShutdownWalRcv(void); extern bool WalRcvInProgress(void); extern void RequestXLogStreaming(XLogRecPtr recptr, const char *conninfo); extern XLogRecPtr GetWalRcvWriteRecPtr(XLogRecPtr *latestChunkStart); extern int GetReplicationApplyDelay(void); extern int GetReplicationTransferLatency(void); #endif /* _WALRECEIVER_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/replication/walsender_private.h��������������������������������������������������������0000644�����������������00000005734�14763166026�0015424 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * walsender_private.h * Private definitions from replication/walsender.c. * * Portions Copyright (c) 2010-2012, PostgreSQL Global Development Group * * src/include/replication/walsender_private.h * *------------------------------------------------------------------------- */ #ifndef _WALSENDER_PRIVATE_H #define _WALSENDER_PRIVATE_H #include "access/xlog.h" #include "nodes/nodes.h" #include "replication/syncrep.h" #include "storage/latch.h" #include "storage/shmem.h" #include "storage/spin.h" typedef enum WalSndState { WALSNDSTATE_STARTUP = 0, WALSNDSTATE_BACKUP, WALSNDSTATE_CATCHUP, WALSNDSTATE_STREAMING } WalSndState; /* * Each walsender has a WalSnd struct in shared memory. */ typedef struct WalSnd { pid_t pid; /* this walsender's process id, or 0 */ WalSndState state; /* this walsender's state */ XLogRecPtr sentPtr; /* WAL has been sent up to this point */ bool needreload; /* does currently-open file need to be * reloaded? */ bool sendKeepalive; /* do we send keepalives on this connection? */ /* * The xlog locations that have been written, flushed, and applied by * standby-side. These may be invalid if the standby-side has not offered * values yet. */ XLogRecPtr write; XLogRecPtr flush; XLogRecPtr apply; /* Protects shared variables shown above. */ slock_t mutex; /* * Latch used by backends to wake up this walsender when it has work to * do. */ Latch latch; /* * The priority order of the standby managed by this WALSender, as listed * in synchronous_standby_names, or 0 if not-listed. Protected by * SyncRepLock. */ int sync_standby_priority; } WalSnd; extern WalSnd *MyWalSnd; /* There is one WalSndCtl struct for the whole database cluster */ typedef struct { /* * Synchronous replication queue with one queue per request type. * Protected by SyncRepLock. */ SHM_QUEUE SyncRepQueue[NUM_SYNC_REP_WAIT_MODE]; /* * Current location of the head of the queue. All waiters should have a * waitLSN that follows this value. Protected by SyncRepLock. */ XLogRecPtr lsn[NUM_SYNC_REP_WAIT_MODE]; /* * Are any sync standbys defined? Waiting backends can't reload the * config file safely, so checkpointer updates this value as needed. * Protected by SyncRepLock. */ bool sync_standbys_defined; WalSnd walsnds[1]; /* VARIABLE LENGTH ARRAY */ } WalSndCtlData; extern WalSndCtlData *WalSndCtl; extern void WalSndSetState(WalSndState state); extern void XLogRead(char *buf, XLogRecPtr startptr, Size count); /* * Internal functions for parsing the replication grammar, in repl_gram.y and * repl_scanner.l */ extern int replication_yyparse(void); extern int replication_yylex(void); extern void replication_yyerror(const char *str); extern void replication_scanner_init(const char *query_string); extern void replication_scanner_finish(void); extern Node *replication_parse_result; #endif /* _WALSENDER_PRIVATE_H */ ������������������������������������pgsql/server/replication/basebackup.h���������������������������������������������������������������0000644�����������������00000000756�14763166026�0014005 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * basebackup.h * Exports from replication/basebackup.c. * * Portions Copyright (c) 2010-2012, PostgreSQL Global Development Group * * src/include/replication/basebackup.h * *------------------------------------------------------------------------- */ #ifndef _BASEBACKUP_H #define _BASEBACKUP_H #include "nodes/replnodes.h" extern void SendBaseBackup(BaseBackupCmd *cmd); #endif /* _BASEBACKUP_H */ ������������������pgsql/server/replication/syncrep.h������������������������������������������������������������������0000644�����������������00000002640�14763166026�0013362 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * syncrep.h * Exports from replication/syncrep.c. * * Portions Copyright (c) 2010-2012, PostgreSQL Global Development Group * * IDENTIFICATION * src/include/replication/syncrep.h * *------------------------------------------------------------------------- */ #ifndef _SYNCREP_H #define _SYNCREP_H #include "access/xlogdefs.h" #include "utils/guc.h" #define SyncRepRequested() \ (max_wal_senders > 0 && synchronous_commit > SYNCHRONOUS_COMMIT_LOCAL_FLUSH) /* SyncRepWaitMode */ #define SYNC_REP_NO_WAIT -1 #define SYNC_REP_WAIT_WRITE 0 #define SYNC_REP_WAIT_FLUSH 1 #define NUM_SYNC_REP_WAIT_MODE 2 /* syncRepState */ #define SYNC_REP_NOT_WAITING 0 #define SYNC_REP_WAITING 1 #define SYNC_REP_WAIT_COMPLETE 2 /* user-settable parameters for synchronous replication */ extern char *SyncRepStandbyNames; /* called by user backend */ extern void SyncRepWaitForLSN(XLogRecPtr XactCommitLSN); /* called at backend exit */ extern void SyncRepCleanupAtProcExit(void); /* called by wal sender */ extern void SyncRepInitConfig(void); extern void SyncRepReleaseWaiters(void); /* called by checkpointer */ extern void SyncRepUpdateSyncStandbysDefined(void); extern bool check_synchronous_standby_names(char **newval, void **extra, GucSource source); extern void assign_synchronous_commit(int newval, void *extra); #endif /* _SYNCREP_H */ ������������������������������������������������������������������������������������������������pgsql/server/replication/walsender.h����������������������������������������������������������������0000644�����������������00000001751�14763166026�0013665 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * walsender.h * Exports from replication/walsender.c. * * Portions Copyright (c) 2010-2012, PostgreSQL Global Development Group * * src/include/replication/walsender.h * *------------------------------------------------------------------------- */ #ifndef _WALSENDER_H #define _WALSENDER_H #include <signal.h> #include "fmgr.h" /* global state */ extern bool am_walsender; extern bool am_cascading_walsender; extern volatile sig_atomic_t walsender_shutdown_requested; extern volatile sig_atomic_t walsender_ready_to_stop; /* user-settable parameters */ extern int max_wal_senders; extern int replication_timeout; extern int WalSenderMain(void); extern void WalSndSignals(void); extern Size WalSndShmemSize(void); extern void WalSndShmemInit(void); extern void WalSndWakeup(void); extern void WalSndRqstFileReload(void); extern Datum pg_stat_get_wal_senders(PG_FUNCTION_ARGS); #endif /* _WALSENDER_H */ �����������������������pgsql/server/pg_config_x86_64.h���������������������������������������������������������������������0000644�����������������00000064665�14763166026�0012356 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/pg_config.h. Generated from pg_config.h.in by configure. */ /* src/include/pg_config.h.in. Generated from configure.in by autoheader. */ /* Define to the type of arg 1 of 'accept' */ #define ACCEPT_TYPE_ARG1 int /* Define to the type of arg 2 of 'accept' */ #define ACCEPT_TYPE_ARG2 struct sockaddr * /* Define to the type of arg 3 of 'accept' */ #define ACCEPT_TYPE_ARG3 socklen_t /* Define to the return type of 'accept' */ #define ACCEPT_TYPE_RETURN int /* Define if building universal (internal helper macro) */ /* #undef AC_APPLE_UNIVERSAL_BUILD */ /* The normal alignment of `double', in bytes. */ #define ALIGNOF_DOUBLE 8 /* The normal alignment of `int', in bytes. */ #define ALIGNOF_INT 4 /* The normal alignment of `long', in bytes. */ #define ALIGNOF_LONG 8 /* The normal alignment of `long long int', in bytes. */ /* #undef ALIGNOF_LONG_LONG_INT */ /* The normal alignment of `short', in bytes. */ #define ALIGNOF_SHORT 2 /* Size of a disk block --- this also limits the size of a tuple. You can set it bigger if you need bigger tuples (although TOAST should reduce the need to have large tuples, since fields can be spread across multiple tuples). BLCKSZ must be a power of 2. The maximum possible value of BLCKSZ is currently 2^15 (32768). This is determined by the 15-bit widths of the lp_off and lp_len fields in ItemIdData (see include/storage/itemid.h). Changing BLCKSZ requires an initdb. */ #define BLCKSZ 8192 /* Define to the default TCP port number on which the server listens and to which clients will try to connect. This can be overridden at run-time, but it's convenient if your clients have the right default compiled in. (--with-pgport=PORTNUM) */ #define DEF_PGPORT 5432 /* Define to the default TCP port number as a string constant. */ #define DEF_PGPORT_STR "5432" /* Define to build with GSSAPI support. (--with-gssapi) */ #define ENABLE_GSS 1 /* Define to 1 if you want National Language Support. (--enable-nls) */ #define ENABLE_NLS 1 /* Define to 1 to build client libraries as thread-safe code. (--enable-thread-safety) */ #define ENABLE_THREAD_SAFETY 1 /* Define to nothing if C supports flexible array members, and to 1 if it does not. That way, with a declaration like `struct s { int n; double d[FLEXIBLE_ARRAY_MEMBER]; };', the struct hack can be used with pre-C99 compilers. When computing the size of such an object, don't use 'sizeof (struct s)' as it overestimates the size. Use 'offsetof (struct s, d)' instead. Don't use 'offsetof (struct s, d[0])', as this doesn't work with MSVC and with C++ compilers. */ #define FLEXIBLE_ARRAY_MEMBER /**/ /* float4 values are passed by value if 'true', by reference if 'false' */ #define FLOAT4PASSBYVAL true /* float8, int8, and related values are passed by value if 'true', by reference if 'false' */ #define FLOAT8PASSBYVAL true /* Define to 1 if getpwuid_r() takes a 5th argument. */ #define GETPWUID_R_5ARG /**/ /* Define to 1 if gettimeofday() takes only 1 argument. */ /* #undef GETTIMEOFDAY_1ARG */ #ifdef GETTIMEOFDAY_1ARG # define gettimeofday(a,b) gettimeofday(a) #endif /* Define to 1 if you have the `append_history' function. */ #define HAVE_APPEND_HISTORY 1 /* Define to 1 if you have the `ASN1_STRING_get0_data' function. */ /* #undef HAVE_ASN1_STRING_GET0_DATA */ /* Define to 1 if you have the `BIO_meth_new' function. */ /* #undef HAVE_BIO_METH_NEW */ /* Define to 1 if you have the `cbrt' function. */ #define HAVE_CBRT 1 /* Define to 1 if you have the `class' function. */ /* #undef HAVE_CLASS */ /* Define to 1 if you have the <crtdefs.h> header file. */ /* #undef HAVE_CRTDEFS_H */ /* Define to 1 if you have the `crypt' function. */ #define HAVE_CRYPT 1 /* Define to 1 if you have the `CRYPTO_lock' function. */ #define HAVE_CRYPTO_LOCK 1 /* Define to 1 if you have the <crypt.h> header file. */ #define HAVE_CRYPT_H 1 /* Define to 1 if you have the declaration of `fdatasync', and to 0 if you don't. */ #define HAVE_DECL_FDATASYNC 1 /* Define to 1 if you have the declaration of `F_FULLFSYNC', and to 0 if you don't. */ #define HAVE_DECL_F_FULLFSYNC 0 /* Define to 1 if you have the declaration of `posix_fadvise', and to 0 if you don't. */ #define HAVE_DECL_POSIX_FADVISE 1 /* Define to 1 if you have the declaration of `snprintf', and to 0 if you don't. */ #define HAVE_DECL_SNPRINTF 1 /* Define to 1 if you have the declaration of `strlcat', and to 0 if you don't. */ #define HAVE_DECL_STRLCAT 0 /* Define to 1 if you have the declaration of `strlcpy', and to 0 if you don't. */ #define HAVE_DECL_STRLCPY 0 /* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you don't. */ #define HAVE_DECL_SYS_SIGLIST 1 /* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you don't. */ #define HAVE_DECL_VSNPRINTF 1 /* Define to 1 if you have the <dld.h> header file. */ /* #undef HAVE_DLD_H */ /* Define to 1 if you have the `dlopen' function. */ #define HAVE_DLOPEN 1 /* Define to 1 if you have the <editline/history.h> header file. */ /* #undef HAVE_EDITLINE_HISTORY_H */ /* Define to 1 if you have the <editline/readline.h> header file. */ /* #undef HAVE_EDITLINE_READLINE_H */ /* Define to 1 if you have the `fdatasync' function. */ #define HAVE_FDATASYNC 1 /* Define to 1 if you have the `fls' function. */ /* #undef HAVE_FLS */ /* Define to 1 if you have the `fpclass' function. */ /* #undef HAVE_FPCLASS */ /* Define to 1 if you have the `fp_class' function. */ /* #undef HAVE_FP_CLASS */ /* Define to 1 if you have the `fp_class_d' function. */ /* #undef HAVE_FP_CLASS_D */ /* Define to 1 if you have the <fp_class.h> header file. */ /* #undef HAVE_FP_CLASS_H */ /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ #define HAVE_FSEEKO 1 /* Define to 1 if your compiler understands __func__. */ #define HAVE_FUNCNAME__FUNC 1 /* Define to 1 if your compiler understands __FUNCTION__. */ /* #undef HAVE_FUNCNAME__FUNCTION */ /* Define to 1 if you have __sync_lock_test_and_set(int *) and friends. */ #define HAVE_GCC_INT_ATOMICS 1 /* Define to 1 if you have the `getaddrinfo' function. */ #define HAVE_GETADDRINFO 1 /* Define to 1 if you have the `gethostbyname_r' function. */ #define HAVE_GETHOSTBYNAME_R 1 /* Define to 1 if you have the `getifaddrs' function. */ #define HAVE_GETIFADDRS 1 /* Define to 1 if you have the `getopt' function. */ #define HAVE_GETOPT 1 /* Define to 1 if you have the <getopt.h> header file. */ #define HAVE_GETOPT_H 1 /* Define to 1 if you have the `getopt_long' function. */ #define HAVE_GETOPT_LONG 1 /* Define to 1 if you have the `getpeereid' function. */ /* #undef HAVE_GETPEEREID */ /* Define to 1 if you have the `getpeerucred' function. */ /* #undef HAVE_GETPEERUCRED */ /* Define to 1 if you have the `getpwuid_r' function. */ #define HAVE_GETPWUID_R 1 /* Define to 1 if you have the `getrlimit' function. */ #define HAVE_GETRLIMIT 1 /* Define to 1 if you have the `getrusage' function. */ #define HAVE_GETRUSAGE 1 /* Define to 1 if you have the `gettimeofday' function. */ /* #undef HAVE_GETTIMEOFDAY */ /* Define to 1 if you have the <gssapi/gssapi.h> header file. */ #define HAVE_GSSAPI_GSSAPI_H 1 /* Define to 1 if you have the <gssapi.h> header file. */ /* #undef HAVE_GSSAPI_H */ /* Define to 1 if you have the <history.h> header file. */ /* #undef HAVE_HISTORY_H */ /* Define to 1 if you have the `history_truncate_file' function. */ #define HAVE_HISTORY_TRUNCATE_FILE 1 /* Define to 1 if you have the <ieeefp.h> header file. */ /* #undef HAVE_IEEEFP_H */ /* Define to 1 if you have the <ifaddrs.h> header file. */ #define HAVE_IFADDRS_H 1 /* Define to 1 if you have the `inet_aton' function. */ #define HAVE_INET_ATON 1 /* Define to 1 if the system has the type `int64'. */ /* #undef HAVE_INT64 */ /* Define to 1 if the system has the type `int8'. */ /* #undef HAVE_INT8 */ /* Define to 1 if the system has the type `intptr_t'. */ #define HAVE_INTPTR_T 1 /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the global variable 'int opterr'. */ #define HAVE_INT_OPTERR 1 /* Define to 1 if you have the global variable 'int optreset'. */ /* #undef HAVE_INT_OPTRESET */ /* Define to 1 if you have the global variable 'int timezone'. */ #define HAVE_INT_TIMEZONE /**/ /* Define to 1 if you have support for IPv6. */ #define HAVE_IPV6 1 /* Define to 1 if you have isinf(). */ #define HAVE_ISINF 1 /* Define to 1 if `e_data' is member of `krb5_error'. */ /* #undef HAVE_KRB5_ERROR_E_DATA */ /* Define to 1 if `text.data' is member of `krb5_error'. */ #define HAVE_KRB5_ERROR_TEXT_DATA 1 /* Define to 1 if you have krb5_free_unparsed_name. */ #define HAVE_KRB5_FREE_UNPARSED_NAME 1 /* Define to 1 if `client' is member of `krb5_ticket'. */ /* #undef HAVE_KRB5_TICKET_CLIENT */ /* Define to 1 if `enc_part2' is member of `krb5_ticket'. */ #define HAVE_KRB5_TICKET_ENC_PART2 1 /* Define to 1 if you have the <langinfo.h> header file. */ #define HAVE_LANGINFO_H 1 /* Define to 1 if you have the <ldap.h> header file. */ #define HAVE_LDAP_H 1 /* Define to 1 if you have the `crypto' library (-lcrypto). */ #define HAVE_LIBCRYPTO 1 /* Define to 1 if you have the `ldap' library (-lldap). */ #define HAVE_LIBLDAP 1 /* Define to 1 if you have the `ldap_r' library (-lldap_r). */ #define HAVE_LIBLDAP_R 1 /* Define to 1 if you have the `m' library (-lm). */ #define HAVE_LIBM 1 /* Define to 1 if you have the `pam' library (-lpam). */ #define HAVE_LIBPAM 1 /* Define if you have a function readline library */ #define HAVE_LIBREADLINE 1 /* Define to 1 if you have the `selinux' library (-lselinux). */ #define HAVE_LIBSELINUX 1 /* Define to 1 if you have the `ssl' library (-lssl). */ #define HAVE_LIBSSL 1 /* Define to 1 if you have the `wldap32' library (-lwldap32). */ /* #undef HAVE_LIBWLDAP32 */ /* Define to 1 if you have the `xml2' library (-lxml2). */ #define HAVE_LIBXML2 1 /* Define to 1 if you have the `xslt' library (-lxslt). */ #define HAVE_LIBXSLT 1 /* Define to 1 if you have the `z' library (-lz). */ #define HAVE_LIBZ 1 /* Define to 1 if the system has the type `locale_t'. */ #define HAVE_LOCALE_T 1 /* Define to 1 if `long int' works and is 64 bits. */ #define HAVE_LONG_INT_64 1 /* Define to 1 if the system has the type `long long int'. */ #define HAVE_LONG_LONG_INT 1 /* Define to 1 if `long long int' works and is 64 bits. */ /* #undef HAVE_LONG_LONG_INT_64 */ /* Define to 1 if you have the `mbstowcs_l' function. */ /* #undef HAVE_MBSTOWCS_L */ /* Define to 1 if you have the `memmove' function. */ #define HAVE_MEMMOVE 1 /* Define to 1 if you have the <memory.h> header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if the system has the type `MINIDUMP_TYPE'. */ /* #undef HAVE_MINIDUMP_TYPE */ /* Define to 1 if you have the `mkdtemp' function. */ #define HAVE_MKDTEMP 1 /* Define to 1 if you have the <netinet/in.h> header file. */ #define HAVE_NETINET_IN_H 1 /* Define to 1 if you have the <netinet/tcp.h> header file. */ #define HAVE_NETINET_TCP_H 1 /* Define to 1 if you have the <net/if.h> header file. */ #define HAVE_NET_IF_H 1 /* Define to 1 if you have the `OPENSSL_init_ssl' function. */ /* #undef HAVE_OPENSSL_INIT_SSL */ /* Define to 1 if you have the <ossp/uuid.h> header file. */ /* #undef HAVE_OSSP_UUID_H */ /* Define to 1 if you have the <pam/pam_appl.h> header file. */ /* #undef HAVE_PAM_PAM_APPL_H */ /* Define to 1 if you have the `poll' function. */ #define HAVE_POLL 1 /* Define to 1 if you have the <poll.h> header file. */ #define HAVE_POLL_H 1 /* Define to 1 if you have the `posix_fadvise' function. */ #define HAVE_POSIX_FADVISE 1 /* Define to 1 if you have the POSIX signal interface. */ #define HAVE_POSIX_SIGNALS /**/ /* Define to 1 if the assembler supports PPC's LWARX mutex hint bit. */ /* #undef HAVE_PPC_LWARX_MUTEX_HINT */ /* Define to 1 if you have the `pstat' function. */ /* #undef HAVE_PSTAT */ /* Define to 1 if the PS_STRINGS thing exists. */ /* #undef HAVE_PS_STRINGS */ /* Define if you have POSIX threads libraries and header files. */ /* #undef HAVE_PTHREAD */ /* Define to 1 if you have the `pthread_is_threaded_np' function. */ /* #undef HAVE_PTHREAD_IS_THREADED_NP */ /* Define to 1 if you have the <pwd.h> header file. */ #define HAVE_PWD_H 1 /* Define to 1 if you have the `random' function. */ #define HAVE_RANDOM 1 /* Define to 1 if you have the `RAND_OpenSSL' function. */ /* #undef HAVE_RAND_OPENSSL */ /* Define to 1 if you have the <readline.h> header file. */ /* #undef HAVE_READLINE_H */ /* Define to 1 if you have the <readline/history.h> header file. */ #define HAVE_READLINE_HISTORY_H 1 /* Define to 1 if you have the <readline/readline.h> header file. */ #define HAVE_READLINE_READLINE_H 1 /* Define to 1 if you have the `readlink' function. */ #define HAVE_READLINK 1 /* Define to 1 if you have the `rint' function. */ #define HAVE_RINT 1 /* Define to 1 if you have the global variable 'rl_completion_append_character'. */ #define HAVE_RL_COMPLETION_APPEND_CHARACTER 1 /* Define to 1 if you have the `rl_completion_matches' function. */ #define HAVE_RL_COMPLETION_MATCHES 1 /* Define to 1 if you have the `rl_filename_completion_function' function. */ #define HAVE_RL_FILENAME_COMPLETION_FUNCTION 1 /* Define to 1 if you have the `rl_reset_screen_size' function. */ #define HAVE_RL_RESET_SCREEN_SIZE 1 /* Define to 1 if you have the <security/pam_appl.h> header file. */ #define HAVE_SECURITY_PAM_APPL_H 1 /* Define to 1 if you have the `setproctitle' function. */ /* #undef HAVE_SETPROCTITLE */ /* Define to 1 if you have the `setsid' function. */ #define HAVE_SETSID 1 /* Define to 1 if you have the `sigprocmask' function. */ #define HAVE_SIGPROCMASK 1 /* Define to 1 if you have sigsetjmp(). */ #define HAVE_SIGSETJMP 1 /* Define to 1 if the system has the type `sig_atomic_t'. */ #define HAVE_SIG_ATOMIC_T 1 /* Define to 1 if you have the `snprintf' function. */ #define HAVE_SNPRINTF 1 /* Define to 1 if you have spinlocks. */ #define HAVE_SPINLOCKS 1 /* Define to 1 if you have the `srandom' function. */ #define HAVE_SRANDOM 1 /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the `strerror' function. */ #define HAVE_STRERROR 1 /* Define to 1 if you have the `strerror_r' function. */ #define HAVE_STRERROR_R 1 /* Define to 1 if cpp supports the ANSI # stringizing operator. */ #define HAVE_STRINGIZE 1 /* Define to 1 if you have the <strings.h> header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strlcat' function. */ /* #undef HAVE_STRLCAT */ /* Define to 1 if you have the `strlcpy' function. */ /* #undef HAVE_STRLCPY */ /* Define to 1 if you have the `strtoll' function. */ #define HAVE_STRTOLL 1 /* Define to 1 if you have the `strtoq' function. */ /* #undef HAVE_STRTOQ */ /* Define to 1 if you have the `strtoull' function. */ #define HAVE_STRTOULL 1 /* Define to 1 if you have the `strtouq' function. */ /* #undef HAVE_STRTOUQ */ /* Define to 1 if the system has the type `struct addrinfo'. */ #define HAVE_STRUCT_ADDRINFO 1 /* Define to 1 if the system has the type `struct cmsgcred'. */ /* #undef HAVE_STRUCT_CMSGCRED */ /* Define to 1 if the system has the type `struct option'. */ #define HAVE_STRUCT_OPTION 1 /* Define to 1 if `sa_len' is member of `struct sockaddr'. */ /* #undef HAVE_STRUCT_SOCKADDR_SA_LEN */ /* Define to 1 if the system has the type `struct sockaddr_storage'. */ #define HAVE_STRUCT_SOCKADDR_STORAGE 1 /* Define to 1 if `ss_family' is member of `struct sockaddr_storage'. */ #define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1 /* Define to 1 if `ss_len' is member of `struct sockaddr_storage'. */ /* #undef HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN */ /* Define to 1 if `__ss_family' is member of `struct sockaddr_storage'. */ /* #undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */ /* Define to 1 if `__ss_len' is member of `struct sockaddr_storage'. */ /* #undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_LEN */ /* Define to 1 if `tm_zone' is member of `struct tm'. */ #define HAVE_STRUCT_TM_TM_ZONE 1 /* Define to 1 if you have the `symlink' function. */ #define HAVE_SYMLINK 1 /* Define to 1 if you have the syslog interface. */ #define HAVE_SYSLOG 1 /* Define to 1 if you have the <sys/ioctl.h> header file. */ #define HAVE_SYS_IOCTL_H 1 /* Define to 1 if you have the <sys/ipc.h> header file. */ #define HAVE_SYS_IPC_H 1 /* Define to 1 if you have the <sys/poll.h> header file. */ #define HAVE_SYS_POLL_H 1 /* Define to 1 if you have the <sys/pstat.h> header file. */ /* #undef HAVE_SYS_PSTAT_H */ /* Define to 1 if you have the <sys/resource.h> header file. */ #define HAVE_SYS_RESOURCE_H 1 /* Define to 1 if you have the <sys/select.h> header file. */ #define HAVE_SYS_SELECT_H 1 /* Define to 1 if you have the <sys/sem.h> header file. */ #define HAVE_SYS_SEM_H 1 /* Define to 1 if you have the <sys/shm.h> header file. */ #define HAVE_SYS_SHM_H 1 /* Define to 1 if you have the <sys/socket.h> header file. */ #define HAVE_SYS_SOCKET_H 1 /* Define to 1 if you have the <sys/sockio.h> header file. */ /* #undef HAVE_SYS_SOCKIO_H */ /* Define to 1 if you have the <sys/stat.h> header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the <sys/tas.h> header file. */ /* #undef HAVE_SYS_TAS_H */ /* Define to 1 if you have the <sys/time.h> header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <sys/ucred.h> header file. */ /* #undef HAVE_SYS_UCRED_H */ /* Define to 1 if you have the <sys/un.h> header file. */ #define HAVE_SYS_UN_H 1 /* Define to 1 if you have the <termios.h> header file. */ #define HAVE_TERMIOS_H 1 /* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use `HAVE_STRUCT_TM_TM_ZONE' instead. */ #define HAVE_TM_ZONE 1 /* Define to 1 if you have the `towlower' function. */ #define HAVE_TOWLOWER 1 /* Define to 1 if you have the external array `tzname'. */ #define HAVE_TZNAME 1 /* Define to 1 if you have the <ucred.h> header file. */ /* #undef HAVE_UCRED_H */ /* Define to 1 if the system has the type `uint64'. */ /* #undef HAVE_UINT64 */ /* Define to 1 if the system has the type `uint8'. */ /* #undef HAVE_UINT8 */ /* Define to 1 if the system has the type `uintptr_t'. */ #define HAVE_UINTPTR_T 1 /* Define to 1 if the system has the type `union semun'. */ /* #undef HAVE_UNION_SEMUN */ /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have unix sockets. */ #define HAVE_UNIX_SOCKETS 1 /* Define to 1 if you have the `unsetenv' function. */ #define HAVE_UNSETENV 1 /* Define to 1 if you have the `utime' function. */ #define HAVE_UTIME 1 /* Define to 1 if you have the `utimes' function. */ #define HAVE_UTIMES 1 /* Define to 1 if you have the <utime.h> header file. */ #define HAVE_UTIME_H 1 /* Define to 1 if you have the <uuid.h> header file. */ #define HAVE_UUID_H 1 /* Define to 1 if you have the `vsnprintf' function. */ #define HAVE_VSNPRINTF 1 /* Define to 1 if you have the `waitpid' function. */ #define HAVE_WAITPID 1 /* Define to 1 if you have the <wchar.h> header file. */ #define HAVE_WCHAR_H 1 /* Define to 1 if you have the `wcstombs' function. */ #define HAVE_WCSTOMBS 1 /* Define to 1 if you have the `wcstombs_l' function. */ /* #undef HAVE_WCSTOMBS_L */ /* Define to 1 if you have the <wctype.h> header file. */ #define HAVE_WCTYPE_H 1 /* Define to 1 if you have the <winldap.h> header file. */ /* #undef HAVE_WINLDAP_H */ /* Define to the appropriate snprintf format for 64-bit ints. */ #define INT64_FORMAT "%ld" /* Define to build with Kerberos 5 support. (--with-krb5) */ #define KRB5 1 /* Define to 1 if `locale_t' requires <xlocale.h>. */ /* #undef LOCALE_T_IN_XLOCALE */ /* Define as the maximum alignment requirement of any C data type. */ #define MAXIMUM_ALIGNOF 8 /* Define bytes to use libc memset(). */ #define MEMSET_LOOP_LIMIT 1024 /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "pgsql-bugs@postgresql.org" /* Define to the full name of this package. */ #define PACKAGE_NAME "PostgreSQL" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "PostgreSQL 9.2.24" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "postgresql" /* Define to the version of this package. */ #define PACKAGE_VERSION "9.2.24" /* Define to the name of the default PostgreSQL service principal in Kerberos. (--with-krb-srvnam=NAME) */ #define PG_KRB_SRVNAM "postgres" /* PostgreSQL major version as a string */ #define PG_MAJORVERSION "9.2" /* PostgreSQL version as a string */ #define PG_VERSION "9.2.24" /* PostgreSQL version as a number */ #define PG_VERSION_NUM 90224 /* A string containing the version number, platform, and C compiler */ #define PG_VERSION_STR "PostgreSQL 9.2.24 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit" /* Define to 1 to allow profiling output to be saved separately for each process. */ /* #undef PROFILE_PID_DIR */ /* Define to the necessary symbol if this constant uses a non-standard name on your system. */ /* #undef PTHREAD_CREATE_JOINABLE */ /* RELSEG_SIZE is the maximum number of blocks allowed in one disk file. Thus, the maximum size of a single file is RELSEG_SIZE * BLCKSZ; relations bigger than that are divided into multiple files. RELSEG_SIZE * BLCKSZ must be less than your OS' limit on file size. This is often 2 GB or 4GB in a 32-bit operating system, unless you have large file support enabled. By default, we make the limit 1 GB to avoid any possible integer-overflow problems within the OS. A limit smaller than necessary only means we divide a large relation into more chunks than necessary, so it seems best to err in the direction of a small limit. A power-of-2 value is recommended to save a few cycles in md.c, but is not absolutely required. Changing RELSEG_SIZE requires an initdb. */ #define RELSEG_SIZE 131072 /* The size of `long', as computed by sizeof. */ #define SIZEOF_LONG 8 /* The size of `off_t', as computed by sizeof. */ #define SIZEOF_OFF_T 8 /* The size of `size_t', as computed by sizeof. */ #define SIZEOF_SIZE_T 8 /* The size of `void *', as computed by sizeof. */ #define SIZEOF_VOID_P 8 /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define to 1 if strerror_r() returns a int. */ /* #undef STRERROR_R_INT */ /* Define to 1 if your <sys/time.h> declares `struct tm'. */ /* #undef TM_IN_SYS_TIME */ /* Define to the appropriate snprintf format for unsigned 64-bit ints. */ #define UINT64_FORMAT "%lu" /* Define to 1 to build with assertion checks. (--enable-cassert) */ /* #undef USE_ASSERT_CHECKING */ /* Define to 1 to build with Bonjour support. (--with-bonjour) */ /* #undef USE_BONJOUR */ /* Define to 1 if you want float4 values to be passed by value. (--enable-float4-byval) */ #define USE_FLOAT4_BYVAL 1 /* Define to 1 if you want float8, int8, etc values to be passed by value. (--enable-float8-byval) */ #define USE_FLOAT8_BYVAL 1 /* Define to 1 if "static inline" works without unwanted warnings from compilations where static inline functions are defined but not called. */ #define USE_INLINE 1 /* Define to 1 if you want 64-bit integer timestamp and interval support. (--enable-integer-datetimes) */ #define USE_INTEGER_DATETIMES 1 /* Define to 1 to build with LDAP support. (--with-ldap) */ #define USE_LDAP 1 /* Define to 1 to build with XML support. (--with-libxml) */ #define USE_LIBXML 1 /* Define to 1 to use XSLT support when building contrib/xml2. (--with-libxslt) */ #define USE_LIBXSLT 1 /* Define to select named POSIX semaphores. */ /* #undef USE_NAMED_POSIX_SEMAPHORES */ /* Define to 1 to build with PAM support. (--with-pam) */ #define USE_PAM 1 /* Use replacement snprintf() functions. */ /* #undef USE_REPL_SNPRINTF */ /* Define to build with (Open)SSL support. (--with-openssl) */ #define USE_SSL 1 /* Define to select SysV-style semaphores. */ #define USE_SYSV_SEMAPHORES 1 /* Define to select SysV-style shared memory. */ #define USE_SYSV_SHARED_MEMORY 1 /* Define to select unnamed POSIX semaphores. */ /* #undef USE_UNNAMED_POSIX_SEMAPHORES */ /* Define to select Win32-style semaphores. */ /* #undef USE_WIN32_SEMAPHORES */ /* Define to select Win32-style shared memory. */ /* #undef USE_WIN32_SHARED_MEMORY */ /* Define to 1 if `wcstombs_l' requires <xlocale.h>. */ /* #undef WCSTOMBS_L_IN_XLOCALE */ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN /* # undef WORDS_BIGENDIAN */ # endif #endif /* Size of a WAL file block. This need have no particular relation to BLCKSZ. XLOG_BLCKSZ must be a power of 2, and if your system supports O_DIRECT I/O, XLOG_BLCKSZ must be a multiple of the alignment requirement for direct-I/O buffers, else direct I/O may fail. Changing XLOG_BLCKSZ requires an initdb. */ #define XLOG_BLCKSZ 8192 /* XLOG_SEG_SIZE is the size of a single WAL file. This must be a power of 2 and larger than XLOG_BLCKSZ (preferably, a great deal larger than XLOG_BLCKSZ). Changing XLOG_SEG_SIZE requires an initdb. */ #define XLOG_SEG_SIZE (16 * 1024 * 1024) /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ /* #undef _LARGEFILE_SOURCE */ /* Define for large files, on AIX-style hosts. */ /* #undef _LARGE_FILES */ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus /* #undef inline */ #endif /* Define to the type of a signed integer type wide enough to hold a pointer, if such a type exists, and if the system does not define it. */ /* #undef intptr_t */ /* Define to empty if the C compiler does not understand signed types. */ /* #undef signed */ /* Define to the type of an unsigned integer type wide enough to hold a pointer, if such a type exists, and if the system does not define it. */ /* #undef uintptr_t */ /* Define to empty if the keyword `volatile' does not work. Warning: valid code using `volatile' can become incorrect without. Disable with care. */ /* #undef volatile */ ���������������������������������������������������������������������������pgsql/server/postmaster/bgwriter.h������������������������������������������������������������������0000644�����������������00000002327�14763166026�0013416 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * bgwriter.h * Exports from postmaster/bgwriter.c and postmaster/checkpointer.c. * * The bgwriter process used to handle checkpointing duties too. Now * there is a separate process, but we did not bother to split this header. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * * src/include/postmaster/bgwriter.h * *------------------------------------------------------------------------- */ #ifndef _BGWRITER_H #define _BGWRITER_H #include "storage/block.h" #include "storage/relfilenode.h" /* GUC options */ extern int BgWriterDelay; extern int CheckPointTimeout; extern int CheckPointWarning; extern double CheckPointCompletionTarget; extern void BackgroundWriterMain(void); extern void CheckpointerMain(void); extern void RequestCheckpoint(int flags); extern void CheckpointWriteDelay(int flags, double progress); extern bool ForwardFsyncRequest(RelFileNode rnode, ForkNumber forknum, BlockNumber segno); extern void AbsorbFsyncRequests(void); extern Size CheckpointerShmemSize(void); extern void CheckpointerShmemInit(void); extern bool FirstCallSinceLastCheckpoint(void); #endif /* _BGWRITER_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/postmaster/postmaster.h����������������������������������������������������������������0000644�����������������00000003357�14763166026�0013776 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * postmaster.h * Exports from postmaster/postmaster.c. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/postmaster/postmaster.h * *------------------------------------------------------------------------- */ #ifndef _POSTMASTER_H #define _POSTMASTER_H /* GUC options */ extern bool EnableSSL; extern int ReservedBackends; extern int PostPortNumber; extern int Unix_socket_permissions; extern char *Unix_socket_group; extern char *Unix_socket_directories; extern char *ListenAddresses; extern bool ClientAuthInProgress; extern int PreAuthDelay; extern int AuthenticationTimeout; extern bool Log_connections; extern bool log_hostname; extern bool enable_bonjour; extern char *bonjour_name; extern bool restart_after_crash; #ifdef WIN32 extern HANDLE PostmasterHandle; #else extern int postmaster_alive_fds[2]; /* * Constants that represent which of postmaster_alive_fds is held by * postmaster, and which is used in children to check for postmaster death. */ #define POSTMASTER_FD_WATCH 0 /* used in children to check for * postmaster death */ #define POSTMASTER_FD_OWN 1 /* kept open by postmaster only */ #endif extern const char *progname; extern int PostmasterMain(int argc, char *argv[]); extern void ClosePostmasterPorts(bool am_syslogger); extern int MaxLivePostmasterChildren(void); #ifdef EXEC_BACKEND extern pid_t postmaster_forkexec(int argc, char *argv[]); extern int SubPostmasterMain(int argc, char *argv[]); extern Size ShmemBackendArraySize(void); extern void ShmemBackendArrayAllocation(void); #endif #endif /* _POSTMASTER_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/postmaster/pgarch.h��������������������������������������������������������������������0000644�����������������00000001201�14763166026�0013023 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pgarch.h * Exports from postmaster/pgarch.c. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/postmaster/pgarch.h * *------------------------------------------------------------------------- */ #ifndef _PGARCH_H #define _PGARCH_H /* ---------- * Functions called from postmaster * ---------- */ extern int pgarch_start(void); #ifdef EXEC_BACKEND extern void PgArchiverMain(int argc, char *argv[]); #endif #endif /* _PGARCH_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/postmaster/fork_process.h��������������������������������������������������������������0000644�����������������00000000677�14763166026�0014276 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * fork_process.h * Exports from postmaster/fork_process.c. * * Copyright (c) 1996-2012, PostgreSQL Global Development Group * * src/include/postmaster/fork_process.h * *------------------------------------------------------------------------- */ #ifndef FORK_PROCESS_H #define FORK_PROCESS_H extern pid_t fork_process(void); #endif /* FORK_PROCESS_H */ �����������������������������������������������������������������pgsql/server/postmaster/autovacuum.h����������������������������������������������������������������0000644�����������������00000003655�14763166026�0013767 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * autovacuum.h * header file for integrated autovacuum daemon * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/postmaster/autovacuum.h * *------------------------------------------------------------------------- */ #ifndef AUTOVACUUM_H #define AUTOVACUUM_H /* GUC variables */ extern bool autovacuum_start_daemon; extern int autovacuum_max_workers; extern int autovacuum_naptime; extern int autovacuum_vac_thresh; extern double autovacuum_vac_scale; extern int autovacuum_anl_thresh; extern double autovacuum_anl_scale; extern int autovacuum_freeze_max_age; extern int autovacuum_vac_cost_delay; extern int autovacuum_vac_cost_limit; /* autovacuum launcher PID, only valid when worker is shutting down */ extern int AutovacuumLauncherPid; extern int Log_autovacuum_min_duration; /* Status inquiry functions */ extern bool AutoVacuumingActive(void); extern bool IsAutoVacuumLauncherProcess(void); extern bool IsAutoVacuumWorkerProcess(void); #define IsAnyAutoVacuumProcess() \ (IsAutoVacuumLauncherProcess() || IsAutoVacuumWorkerProcess()) /* Functions to start autovacuum process, called from postmaster */ extern void autovac_init(void); extern int StartAutoVacLauncher(void); extern int StartAutoVacWorker(void); /* called from postmaster when a worker could not be forked */ extern void AutoVacWorkerFailed(void); /* autovacuum cost-delay balancer */ extern void AutoVacuumUpdateDelay(void); #ifdef EXEC_BACKEND extern void AutoVacLauncherMain(int argc, char *argv[]); extern void AutoVacWorkerMain(int argc, char *argv[]); extern void AutovacuumWorkerIAm(void); extern void AutovacuumLauncherIAm(void); #endif /* shared memory stuff */ extern Size AutoVacuumShmemSize(void); extern void AutoVacuumShmemInit(void); #endif /* AUTOVACUUM_H */ �����������������������������������������������������������������������������������pgsql/server/postmaster/walwriter.h�����������������������������������������������������������������0000644�����������������00000000747�14763166026�0013615 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * walwriter.h * Exports from postmaster/walwriter.c. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * * src/include/postmaster/walwriter.h * *------------------------------------------------------------------------- */ #ifndef _WALWRITER_H #define _WALWRITER_H /* GUC options */ extern int WalWriterDelay; extern void WalWriterMain(void); #endif /* _WALWRITER_H */ �������������������������pgsql/server/postmaster/startup.h�������������������������������������������������������������������0000644�����������������00000001173�14763166026�0013271 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * startup.h * Exports from postmaster/startup.c. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * * src/include/postmaster/startup.h * *------------------------------------------------------------------------- */ #ifndef _STARTUP_H #define _STARTUP_H extern void HandleStartupProcInterrupts(void); extern void StartupProcessMain(void); extern void PreRestoreCommand(void); extern void PostRestoreCommand(void); extern bool IsPromoteTriggered(void); extern void ResetPromoteTriggered(void); #endif /* _STARTUP_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/postmaster/syslogger.h�����������������������������������������������������������������0000644�����������������00000005014�14763166026�0013603 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * syslogger.h * Exports from postmaster/syslogger.c. * * Copyright (c) 2004-2012, PostgreSQL Global Development Group * * src/include/postmaster/syslogger.h * *------------------------------------------------------------------------- */ #ifndef _SYSLOGGER_H #define _SYSLOGGER_H #include <limits.h> /* for PIPE_BUF */ /* * Primitive protocol structure for writing to syslogger pipe(s). The idea * here is to divide long messages into chunks that are not more than * PIPE_BUF bytes long, which according to POSIX spec must be written into * the pipe atomically. The pipe reader then uses the protocol headers to * reassemble the parts of a message into a single string. The reader can * also cope with non-protocol data coming down the pipe, though we cannot * guarantee long strings won't get split apart. * * We use non-nul bytes in is_last to make the protocol a tiny bit * more robust against finding a false double nul byte prologue. But * we still might find it in the len and/or pid bytes unless we're careful. */ #ifdef PIPE_BUF /* Are there any systems with PIPE_BUF > 64K? Unlikely, but ... */ #if PIPE_BUF > 65536 #define PIPE_CHUNK_SIZE 65536 #else #define PIPE_CHUNK_SIZE ((int) PIPE_BUF) #endif #else /* not defined */ /* POSIX says the value of PIPE_BUF must be at least 512, so use that */ #define PIPE_CHUNK_SIZE 512 #endif typedef struct { char nuls[2]; /* always \0\0 */ uint16 len; /* size of this chunk (counts data only) */ int32 pid; /* writer's pid */ char is_last; /* last chunk of message? 't' or 'f' ('T' or * 'F' for CSV case) */ char data[1]; /* data payload starts here */ } PipeProtoHeader; typedef union { PipeProtoHeader proto; char filler[PIPE_CHUNK_SIZE]; } PipeProtoChunk; #define PIPE_HEADER_SIZE offsetof(PipeProtoHeader, data) #define PIPE_MAX_PAYLOAD ((int) (PIPE_CHUNK_SIZE - PIPE_HEADER_SIZE)) /* GUC options */ extern bool Logging_collector; extern int Log_RotationAge; extern int Log_RotationSize; extern PGDLLIMPORT char *Log_directory; extern PGDLLIMPORT char *Log_filename; extern bool Log_truncate_on_rotation; extern int Log_file_mode; extern bool am_syslogger; #ifndef WIN32 extern int syslogPipe[2]; #else extern HANDLE syslogPipe[2]; #endif extern int SysLogger_Start(void); extern void write_syslogger_file(const char *buffer, int count, int dest); #ifdef EXEC_BACKEND extern void SysLoggerMain(int argc, char *argv[]); #endif #endif /* _SYSLOGGER_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/pg_trace.h�����������������������������������������������������������������������������0000644�����������������00000000474�14763166026�0011155 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ---------- * pg_trace.h * * Definitions for the PostgreSQL tracing framework * * Copyright (c) 2006-2012, PostgreSQL Global Development Group * * src/include/pg_trace.h * ---------- */ #ifndef PG_TRACE_H #define PG_TRACE_H #include "utils/probes.h" /* pgrminclude ignore */ #endif /* PG_TRACE_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/pg_config_os.h�������������������������������������������������������������������������0000644�����������������00000002034�14763166026�0012017 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/linux.h */ /* * As of July 2007, all known versions of the Linux kernel will sometimes * return EIDRM for a shmctl() operation when EINVAL is correct (it happens * when the low-order 15 bits of the supplied shm ID match the slot number * assigned to a newer shmem segment). We deal with this by assuming that * EIDRM means EINVAL in PGSharedMemoryIsInUse(). This is reasonably safe * since in fact Linux has no excuse for ever returning EIDRM; it doesn't * track removed segments in a way that would allow distinguishing them from * private ones. But someday that code might get upgraded, and we'd have * to have a kernel version test here. */ #define HAVE_LINUX_EIDRM_BUG /* * Set the default wal_sync_method to fdatasync. With recent Linux versions, * xlogdefs.h's normal rules will prefer open_datasync, which (a) doesn't * perform better and (b) causes outright failures on ext4 data=journal * filesystems, because those don't support O_DIRECT. */ #define PLATFORM_DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/lib/dllist.h���������������������������������������������������������������������������0000644�����������������00000005467�14763166026�0011441 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * dllist.h * simple doubly linked list primitives * the elements of the list are void* so the lists can contain anything * Dlelem can only be in one list at a time * * * Here's a small example of how to use Dllists: * * Dllist *lst; * Dlelem *elt; * void *in_stuff; -- stuff to stick in the list * void *out_stuff * * lst = DLNewList(); -- make a new dllist * DLAddHead(lst, DLNewElem(in_stuff)); -- add a new element to the list * with in_stuff as the value * ... * elt = DLGetHead(lst); -- retrieve the head element * out_stuff = (void*)DLE_VAL(elt); -- get the stuff out * DLRemove(elt); -- removes the element from its list * DLFreeElem(elt); -- free the element since we don't * use it anymore * * * It is also possible to use Dllist objects that are embedded in larger * structures instead of being separately malloc'd. To do this, use * DLInitElem() to initialize a Dllist field within a larger object. * Don't forget to DLRemove() each field from its list (if any) before * freeing the larger object! * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/lib/dllist.h * *------------------------------------------------------------------------- */ #ifndef DLLIST_H #define DLLIST_H struct Dllist; struct Dlelem; typedef struct Dlelem { struct Dlelem *dle_next; /* next element */ struct Dlelem *dle_prev; /* previous element */ void *dle_val; /* value of the element */ struct Dllist *dle_list; /* what list this element is in */ } Dlelem; typedef struct Dllist { Dlelem *dll_head; Dlelem *dll_tail; } Dllist; extern Dllist *DLNewList(void); /* allocate and initialize a list header */ extern void DLInitList(Dllist *list); /* init a header alloced by caller */ extern void DLFreeList(Dllist *list); /* free up a list and all the nodes in * it */ extern Dlelem *DLNewElem(void *val); extern void DLInitElem(Dlelem *e, void *val); extern void DLFreeElem(Dlelem *e); extern void DLRemove(Dlelem *e); /* removes node from list */ extern void DLAddHead(Dllist *list, Dlelem *node); extern void DLAddTail(Dllist *list, Dlelem *node); extern Dlelem *DLRemHead(Dllist *list); /* remove and return the head */ extern Dlelem *DLRemTail(Dllist *list); extern void DLMoveToFront(Dlelem *e); /* move node to front of its list */ /* These are macros for speed */ #define DLGetHead(list) ((list)->dll_head) #define DLGetTail(list) ((list)->dll_tail) #define DLGetSucc(elem) ((elem)->dle_next) #define DLGetPred(elem) ((elem)->dle_prev) #define DLGetListHdr(elem) ((elem)->dle_list) #define DLE_VAL(elem) ((elem)->dle_val) #endif /* DLLIST_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/lib/stringinfo.h�����������������������������������������������������������������������0000644�����������������00000012563�14763166026�0012323 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * stringinfo.h * Declarations/definitions for "StringInfo" functions. * * StringInfo provides an indefinitely-extensible string data type. * It can be used to buffer either ordinary C strings (null-terminated text) * or arbitrary binary data. All storage is allocated with palloc(). * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/lib/stringinfo.h * *------------------------------------------------------------------------- */ #ifndef STRINGINFO_H #define STRINGINFO_H /*------------------------- * StringInfoData holds information about an extensible string. * data is the current buffer for the string (allocated with palloc). * len is the current string length. There is guaranteed to be * a terminating '\0' at data[len], although this is not very * useful when the string holds binary data rather than text. * maxlen is the allocated size in bytes of 'data', i.e. the maximum * string size (including the terminating '\0' char) that we can * currently store in 'data' without having to reallocate * more space. We must always have maxlen > len. * cursor is initialized to zero by makeStringInfo or initStringInfo, * but is not otherwise touched by the stringinfo.c routines. * Some routines use it to scan through a StringInfo. *------------------------- */ typedef struct StringInfoData { char *data; int len; int maxlen; int cursor; } StringInfoData; typedef StringInfoData *StringInfo; /*------------------------ * There are two ways to create a StringInfo object initially: * * StringInfo stringptr = makeStringInfo(); * Both the StringInfoData and the data buffer are palloc'd. * * StringInfoData string; * initStringInfo(&string); * The data buffer is palloc'd but the StringInfoData is just local. * This is the easiest approach for a StringInfo object that will * only live as long as the current routine. * * To destroy a StringInfo, pfree() the data buffer, and then pfree() the * StringInfoData if it was palloc'd. There's no special support for this. * * NOTE: some routines build up a string using StringInfo, and then * release the StringInfoData but return the data string itself to their * caller. At that point the data string looks like a plain palloc'd * string. *------------------------- */ /*------------------------ * makeStringInfo * Create an empty 'StringInfoData' & return a pointer to it. */ extern StringInfo makeStringInfo(void); /*------------------------ * initStringInfo * Initialize a StringInfoData struct (with previously undefined contents) * to describe an empty string. */ extern void initStringInfo(StringInfo str); /*------------------------ * resetStringInfo * Clears the current content of the StringInfo, if any. The * StringInfo remains valid. */ extern void resetStringInfo(StringInfo str); /*------------------------ * appendStringInfo * Format text data under the control of fmt (an sprintf-style format string) * and append it to whatever is already in str. More space is allocated * to str if necessary. This is sort of like a combination of sprintf and * strcat. */ extern void appendStringInfo(StringInfo str, const char *fmt,...) /* This extension allows gcc to check the format string */ __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3))); /*------------------------ * appendStringInfoVA * Attempt to format text data under the control of fmt (an sprintf-style * format string) and append it to whatever is already in str. If successful * return true; if not (because there's not enough space), return false * without modifying str. Typically the caller would enlarge str and retry * on false return --- see appendStringInfo for standard usage pattern. */ extern bool appendStringInfoVA(StringInfo str, const char *fmt, va_list args) __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 0))); /*------------------------ * appendStringInfoString * Append a null-terminated string to str. * Like appendStringInfo(str, "%s", s) but faster. */ extern void appendStringInfoString(StringInfo str, const char *s); /*------------------------ * appendStringInfoChar * Append a single byte to str. * Like appendStringInfo(str, "%c", ch) but much faster. */ extern void appendStringInfoChar(StringInfo str, char ch); /*------------------------ * appendStringInfoCharMacro * As above, but a macro for even more speed where it matters. * Caution: str argument will be evaluated multiple times. */ #define appendStringInfoCharMacro(str,ch) \ (((str)->len + 1 >= (str)->maxlen) ? \ appendStringInfoChar(str, ch) : \ (void)((str)->data[(str)->len] = (ch), (str)->data[++(str)->len] = '\0')) /*------------------------ * appendStringInfoSpaces * Append a given number of spaces to str. */ extern void appendStringInfoSpaces(StringInfo str, int count); /*------------------------ * appendBinaryStringInfo * Append arbitrary binary data to a StringInfo, allocating more space * if necessary. */ extern void appendBinaryStringInfo(StringInfo str, const char *data, int datalen); /*------------------------ * enlargeStringInfo * Make sure a StringInfo's buffer can hold at least 'needed' more bytes. */ extern void enlargeStringInfo(StringInfo str, int needed); #endif /* STRINGINFO_H */ ���������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/postgres_fe.h��������������������������������������������������������������������������0000644�����������������00000001332�14763166026�0011703 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * postgres_fe.h * Primary include file for PostgreSQL client-side .c files * * This should be the first file included by PostgreSQL client libraries and * application programs --- but not by backend modules, which should include * postgres.h. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1995, Regents of the University of California * * src/include/postgres_fe.h * *------------------------------------------------------------------------- */ #ifndef POSTGRES_FE_H #define POSTGRES_FE_H #ifndef FRONTEND #define FRONTEND 1 #endif #include "c.h" #endif /* POSTGRES_FE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/pgstat.h�������������������������������������������������������������������������������0000644�����������������00000057700�14763166026�0010677 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ---------- * pgstat.h * * Definitions for the PostgreSQL statistics collector daemon. * * Copyright (c) 2001-2012, PostgreSQL Global Development Group * * src/include/pgstat.h * ---------- */ #ifndef PGSTAT_H #define PGSTAT_H #include "datatype/timestamp.h" #include "fmgr.h" #include "libpq/pqcomm.h" #include "portability/instr_time.h" #include "utils/hsearch.h" #include "utils/relcache.h" /* Values for track_functions GUC variable --- order is significant! */ typedef enum TrackFunctionsLevel { TRACK_FUNC_OFF, TRACK_FUNC_PL, TRACK_FUNC_ALL } TrackFunctionsLevel; /* ---------- * The types of backend -> collector messages * ---------- */ typedef enum StatMsgType { PGSTAT_MTYPE_DUMMY, PGSTAT_MTYPE_INQUIRY, PGSTAT_MTYPE_TABSTAT, PGSTAT_MTYPE_TABPURGE, PGSTAT_MTYPE_DROPDB, PGSTAT_MTYPE_RESETCOUNTER, PGSTAT_MTYPE_RESETSHAREDCOUNTER, PGSTAT_MTYPE_RESETSINGLECOUNTER, PGSTAT_MTYPE_AUTOVAC_START, PGSTAT_MTYPE_VACUUM, PGSTAT_MTYPE_ANALYZE, PGSTAT_MTYPE_BGWRITER, PGSTAT_MTYPE_FUNCSTAT, PGSTAT_MTYPE_FUNCPURGE, PGSTAT_MTYPE_RECOVERYCONFLICT, PGSTAT_MTYPE_TEMPFILE, PGSTAT_MTYPE_DEADLOCK } StatMsgType; /* ---------- * The data type used for counters. * ---------- */ typedef int64 PgStat_Counter; /* ---------- * PgStat_TableCounts The actual per-table counts kept by a backend * * This struct should contain only actual event counters, because we memcmp * it against zeroes to detect whether there are any counts to transmit. * It is a component of PgStat_TableStatus (within-backend state) and * PgStat_TableEntry (the transmitted message format). * * Note: for a table, tuples_returned is the number of tuples successfully * fetched by heap_getnext, while tuples_fetched is the number of tuples * successfully fetched by heap_fetch under the control of bitmap indexscans. * For an index, tuples_returned is the number of index entries returned by * the index AM, while tuples_fetched is the number of tuples successfully * fetched by heap_fetch under the control of simple indexscans for this index. * * tuples_inserted/updated/deleted/hot_updated count attempted actions, * regardless of whether the transaction committed. delta_live_tuples, * delta_dead_tuples, and changed_tuples are set depending on commit or abort. * Note that delta_live_tuples and delta_dead_tuples can be negative! * ---------- */ typedef struct PgStat_TableCounts { PgStat_Counter t_numscans; PgStat_Counter t_tuples_returned; PgStat_Counter t_tuples_fetched; PgStat_Counter t_tuples_inserted; PgStat_Counter t_tuples_updated; PgStat_Counter t_tuples_deleted; PgStat_Counter t_tuples_hot_updated; PgStat_Counter t_delta_live_tuples; PgStat_Counter t_delta_dead_tuples; PgStat_Counter t_changed_tuples; PgStat_Counter t_blocks_fetched; PgStat_Counter t_blocks_hit; } PgStat_TableCounts; /* Possible targets for resetting cluster-wide shared values */ typedef enum PgStat_Shared_Reset_Target { RESET_BGWRITER } PgStat_Shared_Reset_Target; /* Possible object types for resetting single counters */ typedef enum PgStat_Single_Reset_Type { RESET_TABLE, RESET_FUNCTION } PgStat_Single_Reset_Type; /* ------------------------------------------------------------ * Structures kept in backend local memory while accumulating counts * ------------------------------------------------------------ */ /* ---------- * PgStat_TableStatus Per-table status within a backend * * Many of the event counters are nontransactional, ie, we count events * in committed and aborted transactions alike. For these, we just count * directly in the PgStat_TableStatus. However, delta_live_tuples, * delta_dead_tuples, and changed_tuples must be derived from event counts * with awareness of whether the transaction or subtransaction committed or * aborted. Hence, we also keep a stack of per-(sub)transaction status * records for every table modified in the current transaction. At commit * or abort, we propagate tuples_inserted/updated/deleted up to the * parent subtransaction level, or out to the parent PgStat_TableStatus, * as appropriate. * ---------- */ typedef struct PgStat_TableStatus { Oid t_id; /* table's OID */ bool t_shared; /* is it a shared catalog? */ struct PgStat_TableXactStatus *trans; /* lowest subxact's counts */ PgStat_TableCounts t_counts; /* event counts to be sent */ } PgStat_TableStatus; /* ---------- * PgStat_TableXactStatus Per-table, per-subtransaction status * ---------- */ typedef struct PgStat_TableXactStatus { PgStat_Counter tuples_inserted; /* tuples inserted in (sub)xact */ PgStat_Counter tuples_updated; /* tuples updated in (sub)xact */ PgStat_Counter tuples_deleted; /* tuples deleted in (sub)xact */ int nest_level; /* subtransaction nest level */ /* links to other structs for same relation: */ struct PgStat_TableXactStatus *upper; /* next higher subxact if any */ PgStat_TableStatus *parent; /* per-table status */ /* structs of same subxact level are linked here: */ struct PgStat_TableXactStatus *next; /* next of same subxact */ } PgStat_TableXactStatus; /* ------------------------------------------------------------ * Message formats follow * ------------------------------------------------------------ */ /* ---------- * PgStat_MsgHdr The common message header * ---------- */ typedef struct PgStat_MsgHdr { StatMsgType m_type; int m_size; } PgStat_MsgHdr; /* ---------- * Space available in a message. This will keep the UDP packets below 1K, * which should fit unfragmented into the MTU of the lo interface on most * platforms. Does anybody care for platforms where it doesn't? * ---------- */ #define PGSTAT_MSG_PAYLOAD (1000 - sizeof(PgStat_MsgHdr)) /* ---------- * PgStat_MsgDummy A dummy message, ignored by the collector * ---------- */ typedef struct PgStat_MsgDummy { PgStat_MsgHdr m_hdr; } PgStat_MsgDummy; /* ---------- * PgStat_MsgInquiry Sent by a backend to ask the collector * to write the stats file. * ---------- */ typedef struct PgStat_MsgInquiry { PgStat_MsgHdr m_hdr; TimestampTz inquiry_time; /* minimum acceptable file timestamp */ } PgStat_MsgInquiry; /* ---------- * PgStat_TableEntry Per-table info in a MsgTabstat * ---------- */ typedef struct PgStat_TableEntry { Oid t_id; PgStat_TableCounts t_counts; } PgStat_TableEntry; /* ---------- * PgStat_MsgTabstat Sent by the backend to report table * and buffer access statistics. * ---------- */ #define PGSTAT_NUM_TABENTRIES \ ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - 3 * sizeof(int)) \ / sizeof(PgStat_TableEntry)) typedef struct PgStat_MsgTabstat { PgStat_MsgHdr m_hdr; Oid m_databaseid; int m_nentries; int m_xact_commit; int m_xact_rollback; PgStat_Counter m_block_read_time; /* times in microseconds */ PgStat_Counter m_block_write_time; PgStat_TableEntry m_entry[PGSTAT_NUM_TABENTRIES]; } PgStat_MsgTabstat; /* ---------- * PgStat_MsgTabpurge Sent by the backend to tell the collector * about dead tables. * ---------- */ #define PGSTAT_NUM_TABPURGE \ ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \ / sizeof(Oid)) typedef struct PgStat_MsgTabpurge { PgStat_MsgHdr m_hdr; Oid m_databaseid; int m_nentries; Oid m_tableid[PGSTAT_NUM_TABPURGE]; } PgStat_MsgTabpurge; /* ---------- * PgStat_MsgDropdb Sent by the backend to tell the collector * about a dropped database * ---------- */ typedef struct PgStat_MsgDropdb { PgStat_MsgHdr m_hdr; Oid m_databaseid; } PgStat_MsgDropdb; /* ---------- * PgStat_MsgResetcounter Sent by the backend to tell the collector * to reset counters * ---------- */ typedef struct PgStat_MsgResetcounter { PgStat_MsgHdr m_hdr; Oid m_databaseid; } PgStat_MsgResetcounter; /* ---------- * PgStat_MsgResetsharedcounter Sent by the backend to tell the collector * to reset a shared counter * ---------- */ typedef struct PgStat_MsgResetsharedcounter { PgStat_MsgHdr m_hdr; PgStat_Shared_Reset_Target m_resettarget; } PgStat_MsgResetsharedcounter; /* ---------- * PgStat_MsgResetsinglecounter Sent by the backend to tell the collector * to reset a single counter * ---------- */ typedef struct PgStat_MsgResetsinglecounter { PgStat_MsgHdr m_hdr; Oid m_databaseid; PgStat_Single_Reset_Type m_resettype; Oid m_objectid; } PgStat_MsgResetsinglecounter; /* ---------- * PgStat_MsgAutovacStart Sent by the autovacuum daemon to signal * that a database is going to be processed * ---------- */ typedef struct PgStat_MsgAutovacStart { PgStat_MsgHdr m_hdr; Oid m_databaseid; TimestampTz m_start_time; } PgStat_MsgAutovacStart; /* ---------- * PgStat_MsgVacuum Sent by the backend or autovacuum daemon * after VACUUM * ---------- */ typedef struct PgStat_MsgVacuum { PgStat_MsgHdr m_hdr; Oid m_databaseid; Oid m_tableoid; bool m_autovacuum; TimestampTz m_vacuumtime; PgStat_Counter m_tuples; } PgStat_MsgVacuum; /* ---------- * PgStat_MsgAnalyze Sent by the backend or autovacuum daemon * after ANALYZE * ---------- */ typedef struct PgStat_MsgAnalyze { PgStat_MsgHdr m_hdr; Oid m_databaseid; Oid m_tableoid; bool m_autovacuum; bool m_resetcounter; TimestampTz m_analyzetime; PgStat_Counter m_live_tuples; PgStat_Counter m_dead_tuples; } PgStat_MsgAnalyze; /* ---------- * PgStat_MsgBgWriter Sent by the bgwriter to update statistics. * ---------- */ typedef struct PgStat_MsgBgWriter { PgStat_MsgHdr m_hdr; PgStat_Counter m_timed_checkpoints; PgStat_Counter m_requested_checkpoints; PgStat_Counter m_buf_written_checkpoints; PgStat_Counter m_buf_written_clean; PgStat_Counter m_maxwritten_clean; PgStat_Counter m_buf_written_backend; PgStat_Counter m_buf_fsync_backend; PgStat_Counter m_buf_alloc; PgStat_Counter m_checkpoint_write_time; /* times in milliseconds */ PgStat_Counter m_checkpoint_sync_time; } PgStat_MsgBgWriter; /* ---------- * PgStat_MsgRecoveryConflict Sent by the backend upon recovery conflict * ---------- */ typedef struct PgStat_MsgRecoveryConflict { PgStat_MsgHdr m_hdr; Oid m_databaseid; int m_reason; } PgStat_MsgRecoveryConflict; /* ---------- * PgStat_MsgTempFile Sent by the backend upon creating a temp file * ---------- */ typedef struct PgStat_MsgTempFile { PgStat_MsgHdr m_hdr; Oid m_databaseid; size_t m_filesize; } PgStat_MsgTempFile; /* ---------- * PgStat_FunctionCounts The actual per-function counts kept by a backend * * This struct should contain only actual event counters, because we memcmp * it against zeroes to detect whether there are any counts to transmit. * * Note that the time counters are in instr_time format here. We convert to * microseconds in PgStat_Counter format when transmitting to the collector. * ---------- */ typedef struct PgStat_FunctionCounts { PgStat_Counter f_numcalls; instr_time f_total_time; instr_time f_self_time; } PgStat_FunctionCounts; /* ---------- * PgStat_BackendFunctionEntry Entry in backend's per-function hash table * ---------- */ typedef struct PgStat_BackendFunctionEntry { Oid f_id; PgStat_FunctionCounts f_counts; } PgStat_BackendFunctionEntry; /* ---------- * PgStat_FunctionEntry Per-function info in a MsgFuncstat * ---------- */ typedef struct PgStat_FunctionEntry { Oid f_id; PgStat_Counter f_numcalls; PgStat_Counter f_total_time; /* times in microseconds */ PgStat_Counter f_self_time; } PgStat_FunctionEntry; /* ---------- * PgStat_MsgFuncstat Sent by the backend to report function * usage statistics. * ---------- */ #define PGSTAT_NUM_FUNCENTRIES \ ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \ / sizeof(PgStat_FunctionEntry)) typedef struct PgStat_MsgFuncstat { PgStat_MsgHdr m_hdr; Oid m_databaseid; int m_nentries; PgStat_FunctionEntry m_entry[PGSTAT_NUM_FUNCENTRIES]; } PgStat_MsgFuncstat; /* ---------- * PgStat_MsgFuncpurge Sent by the backend to tell the collector * about dead functions. * ---------- */ #define PGSTAT_NUM_FUNCPURGE \ ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \ / sizeof(Oid)) typedef struct PgStat_MsgFuncpurge { PgStat_MsgHdr m_hdr; Oid m_databaseid; int m_nentries; Oid m_functionid[PGSTAT_NUM_FUNCPURGE]; } PgStat_MsgFuncpurge; /* ---------- * PgStat_MsgDeadlock Sent by the backend to tell the collector * about a deadlock that occurred. * ---------- */ typedef struct PgStat_MsgDeadlock { PgStat_MsgHdr m_hdr; Oid m_databaseid; } PgStat_MsgDeadlock; /* ---------- * PgStat_Msg Union over all possible messages. * ---------- */ typedef union PgStat_Msg { PgStat_MsgHdr msg_hdr; PgStat_MsgDummy msg_dummy; PgStat_MsgInquiry msg_inquiry; PgStat_MsgTabstat msg_tabstat; PgStat_MsgTabpurge msg_tabpurge; PgStat_MsgDropdb msg_dropdb; PgStat_MsgResetcounter msg_resetcounter; PgStat_MsgResetsharedcounter msg_resetsharedcounter; PgStat_MsgResetsinglecounter msg_resetsinglecounter; PgStat_MsgAutovacStart msg_autovacuum; PgStat_MsgVacuum msg_vacuum; PgStat_MsgAnalyze msg_analyze; PgStat_MsgBgWriter msg_bgwriter; PgStat_MsgFuncstat msg_funcstat; PgStat_MsgFuncpurge msg_funcpurge; PgStat_MsgRecoveryConflict msg_recoveryconflict; PgStat_MsgDeadlock msg_deadlock; } PgStat_Msg; /* ------------------------------------------------------------ * Statistic collector data structures follow * * PGSTAT_FILE_FORMAT_ID should be changed whenever any of these * data structures change. * ------------------------------------------------------------ */ #define PGSTAT_FILE_FORMAT_ID 0x01A5BC9A /* ---------- * PgStat_StatDBEntry The collector's data per database * ---------- */ typedef struct PgStat_StatDBEntry { Oid databaseid; PgStat_Counter n_xact_commit; PgStat_Counter n_xact_rollback; PgStat_Counter n_blocks_fetched; PgStat_Counter n_blocks_hit; PgStat_Counter n_tuples_returned; PgStat_Counter n_tuples_fetched; PgStat_Counter n_tuples_inserted; PgStat_Counter n_tuples_updated; PgStat_Counter n_tuples_deleted; TimestampTz last_autovac_time; PgStat_Counter n_conflict_tablespace; PgStat_Counter n_conflict_lock; PgStat_Counter n_conflict_snapshot; PgStat_Counter n_conflict_bufferpin; PgStat_Counter n_conflict_startup_deadlock; PgStat_Counter n_temp_files; PgStat_Counter n_temp_bytes; PgStat_Counter n_deadlocks; PgStat_Counter n_block_read_time; /* times in microseconds */ PgStat_Counter n_block_write_time; TimestampTz stat_reset_timestamp; /* * tables and functions must be last in the struct, because we don't write * the pointers out to the stats file. */ HTAB *tables; HTAB *functions; } PgStat_StatDBEntry; /* ---------- * PgStat_StatTabEntry The collector's data per table (or index) * ---------- */ typedef struct PgStat_StatTabEntry { Oid tableid; PgStat_Counter numscans; PgStat_Counter tuples_returned; PgStat_Counter tuples_fetched; PgStat_Counter tuples_inserted; PgStat_Counter tuples_updated; PgStat_Counter tuples_deleted; PgStat_Counter tuples_hot_updated; PgStat_Counter n_live_tuples; PgStat_Counter n_dead_tuples; PgStat_Counter changes_since_analyze; PgStat_Counter blocks_fetched; PgStat_Counter blocks_hit; TimestampTz vacuum_timestamp; /* user initiated vacuum */ PgStat_Counter vacuum_count; TimestampTz autovac_vacuum_timestamp; /* autovacuum initiated */ PgStat_Counter autovac_vacuum_count; TimestampTz analyze_timestamp; /* user initiated */ PgStat_Counter analyze_count; TimestampTz autovac_analyze_timestamp; /* autovacuum initiated */ PgStat_Counter autovac_analyze_count; } PgStat_StatTabEntry; /* ---------- * PgStat_StatFuncEntry The collector's data per function * ---------- */ typedef struct PgStat_StatFuncEntry { Oid functionid; PgStat_Counter f_numcalls; PgStat_Counter f_total_time; /* times in microseconds */ PgStat_Counter f_self_time; } PgStat_StatFuncEntry; /* * Global statistics kept in the stats collector */ typedef struct PgStat_GlobalStats { TimestampTz stats_timestamp; /* time of stats file update */ PgStat_Counter timed_checkpoints; PgStat_Counter requested_checkpoints; PgStat_Counter checkpoint_write_time; /* times in milliseconds */ PgStat_Counter checkpoint_sync_time; PgStat_Counter buf_written_checkpoints; PgStat_Counter buf_written_clean; PgStat_Counter maxwritten_clean; PgStat_Counter buf_written_backend; PgStat_Counter buf_fsync_backend; PgStat_Counter buf_alloc; TimestampTz stat_reset_timestamp; } PgStat_GlobalStats; /* ---------- * Backend states * ---------- */ typedef enum BackendState { STATE_UNDEFINED, STATE_IDLE, STATE_RUNNING, STATE_IDLEINTRANSACTION, STATE_FASTPATH, STATE_IDLEINTRANSACTION_ABORTED, STATE_DISABLED } BackendState; /* ---------- * Shared-memory data structures * ---------- */ /* ---------- * PgBackendStatus * * Each live backend maintains a PgBackendStatus struct in shared memory * showing its current activity. (The structs are allocated according to * BackendId, but that is not critical.) Note that the collector process * has no involvement in, or even access to, these structs. * ---------- */ typedef struct PgBackendStatus { /* * To avoid locking overhead, we use the following protocol: a backend * increments st_changecount before modifying its entry, and again after * finishing a modification. A would-be reader should note the value of * st_changecount, copy the entry into private memory, then check * st_changecount again. If the value hasn't changed, and if it's even, * the copy is valid; otherwise start over. This makes updates cheap * while reads are potentially expensive, but that's the tradeoff we want. */ int st_changecount; /* The entry is valid iff st_procpid > 0, unused if st_procpid == 0 */ int st_procpid; /* Times when current backend, transaction, and activity started */ TimestampTz st_proc_start_timestamp; TimestampTz st_xact_start_timestamp; TimestampTz st_activity_start_timestamp; TimestampTz st_state_start_timestamp; /* Database OID, owning user's OID, connection client address */ Oid st_databaseid; Oid st_userid; SockAddr st_clientaddr; char *st_clienthostname; /* MUST be null-terminated */ /* Is backend currently waiting on an lmgr lock? */ bool st_waiting; /* current state */ BackendState st_state; /* application name; MUST be null-terminated */ char *st_appname; /* current command string; MUST be null-terminated */ char *st_activity; } PgBackendStatus; /* * Working state needed to accumulate per-function-call timing statistics. */ typedef struct PgStat_FunctionCallUsage { /* Link to function's hashtable entry (must still be there at exit!) */ /* NULL means we are not tracking the current function call */ PgStat_FunctionCounts *fs; /* Total time previously charged to function, as of function start */ instr_time save_f_total_time; /* Backend-wide total time as of function start */ instr_time save_total; /* system clock as of function start */ instr_time f_start; } PgStat_FunctionCallUsage; /* ---------- * GUC parameters * ---------- */ extern bool pgstat_track_activities; extern bool pgstat_track_counts; extern int pgstat_track_functions; extern PGDLLIMPORT int pgstat_track_activity_query_size; extern char *pgstat_stat_tmpname; extern char *pgstat_stat_filename; /* * BgWriter statistics counters are updated directly by bgwriter and bufmgr */ extern PgStat_MsgBgWriter BgWriterStats; /* * Updated by pgstat_count_buffer_*_time macros */ extern PgStat_Counter pgStatBlockReadTime; extern PgStat_Counter pgStatBlockWriteTime; /* ---------- * Functions called from postmaster * ---------- */ extern Size BackendStatusShmemSize(void); extern void CreateSharedBackendStatus(void); extern void pgstat_init(void); extern int pgstat_start(void); extern void pgstat_reset_all(void); extern void allow_immediate_pgstat_restart(void); #ifdef EXEC_BACKEND extern void PgstatCollectorMain(int argc, char *argv[]); #endif /* ---------- * Functions called from backends * ---------- */ extern void pgstat_ping(void); extern void pgstat_report_stat(bool force); extern void pgstat_vacuum_stat(void); extern void pgstat_drop_database(Oid databaseid); extern void pgstat_clear_snapshot(void); extern void pgstat_reset_counters(void); extern void pgstat_reset_shared_counters(const char *); extern void pgstat_reset_single_counter(Oid objectid, PgStat_Single_Reset_Type type); extern void pgstat_report_autovac(Oid dboid); extern void pgstat_report_vacuum(Oid tableoid, bool shared, PgStat_Counter tuples); extern void pgstat_report_analyze(Relation rel, PgStat_Counter livetuples, PgStat_Counter deadtuples, bool resetcounter); extern void pgstat_report_recovery_conflict(int reason); extern void pgstat_report_deadlock(void); extern void pgstat_initialize(void); extern void pgstat_bestart(void); extern void pgstat_report_activity(BackendState state, const char *cmd_str); extern void pgstat_report_tempfile(size_t filesize); extern void pgstat_report_appname(const char *appname); extern void pgstat_report_xact_timestamp(TimestampTz tstamp); extern void pgstat_report_waiting(bool waiting); extern const char *pgstat_get_backend_current_activity(int pid, bool checkUser); extern const char *pgstat_get_crashed_backend_activity(int pid, char *buffer, int buflen); extern PgStat_TableStatus *find_tabstat_entry(Oid rel_id); extern PgStat_BackendFunctionEntry *find_funcstat_entry(Oid func_id); extern void pgstat_initstats(Relation rel); /* nontransactional event counts are simple enough to inline */ #define pgstat_count_heap_scan(rel) \ do { \ if ((rel)->pgstat_info != NULL) \ (rel)->pgstat_info->t_counts.t_numscans++; \ } while (0) #define pgstat_count_heap_getnext(rel) \ do { \ if ((rel)->pgstat_info != NULL) \ (rel)->pgstat_info->t_counts.t_tuples_returned++; \ } while (0) #define pgstat_count_heap_fetch(rel) \ do { \ if ((rel)->pgstat_info != NULL) \ (rel)->pgstat_info->t_counts.t_tuples_fetched++; \ } while (0) #define pgstat_count_index_scan(rel) \ do { \ if ((rel)->pgstat_info != NULL) \ (rel)->pgstat_info->t_counts.t_numscans++; \ } while (0) #define pgstat_count_index_tuples(rel, n) \ do { \ if ((rel)->pgstat_info != NULL) \ (rel)->pgstat_info->t_counts.t_tuples_returned += (n); \ } while (0) #define pgstat_count_buffer_read(rel) \ do { \ if ((rel)->pgstat_info != NULL) \ (rel)->pgstat_info->t_counts.t_blocks_fetched++; \ } while (0) #define pgstat_count_buffer_hit(rel) \ do { \ if ((rel)->pgstat_info != NULL) \ (rel)->pgstat_info->t_counts.t_blocks_hit++; \ } while (0) #define pgstat_count_buffer_read_time(n) \ (pgStatBlockReadTime += (n)) #define pgstat_count_buffer_write_time(n) \ (pgStatBlockWriteTime += (n)) extern void pgstat_count_heap_insert(Relation rel, int n); extern void pgstat_count_heap_update(Relation rel, bool hot); extern void pgstat_count_heap_delete(Relation rel); extern void pgstat_update_heap_dead_tuples(Relation rel, int delta); extern void pgstat_init_function_usage(FunctionCallInfoData *fcinfo, PgStat_FunctionCallUsage *fcu); extern void pgstat_end_function_usage(PgStat_FunctionCallUsage *fcu, bool finalize); extern void AtEOXact_PgStat(bool isCommit); extern void AtEOSubXact_PgStat(bool isCommit, int nestDepth); extern void AtPrepare_PgStat(void); extern void PostPrepare_PgStat(void); extern void pgstat_twophase_postcommit(TransactionId xid, uint16 info, void *recdata, uint32 len); extern void pgstat_twophase_postabort(TransactionId xid, uint16 info, void *recdata, uint32 len); extern void pgstat_send_bgwriter(void); /* ---------- * Support functions for the SQL-callable functions to * generate the pgstat* views. * ---------- */ extern PgStat_StatDBEntry *pgstat_fetch_stat_dbentry(Oid dbid); extern PgStat_StatTabEntry *pgstat_fetch_stat_tabentry(Oid relid); extern PgBackendStatus *pgstat_fetch_stat_beentry(int beid); extern PgStat_StatFuncEntry *pgstat_fetch_stat_funcentry(Oid funcid); extern int pgstat_fetch_stat_numbackends(void); extern PgStat_GlobalStats *pgstat_fetch_global(void); #endif /* PGSTAT_H */ ����������������������������������������������������������������pgsql/server/storage/lmgr.h�������������������������������������������������������������������������0000644�����������������00000006342�14763166026�0011776 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * lmgr.h * POSTGRES lock manager definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/lmgr.h * *------------------------------------------------------------------------- */ #ifndef LMGR_H #define LMGR_H #include "lib/stringinfo.h" #include "storage/itemptr.h" #include "storage/lock.h" #include "utils/rel.h" extern void RelationInitLockInfo(Relation relation); /* Lock a relation */ extern void LockRelationOid(Oid relid, LOCKMODE lockmode); extern bool ConditionalLockRelationOid(Oid relid, LOCKMODE lockmode); extern void UnlockRelationId(LockRelId *relid, LOCKMODE lockmode); extern void UnlockRelationOid(Oid relid, LOCKMODE lockmode); extern void LockRelation(Relation relation, LOCKMODE lockmode); extern bool ConditionalLockRelation(Relation relation, LOCKMODE lockmode); extern void UnlockRelation(Relation relation, LOCKMODE lockmode); extern bool LockHasWaitersRelation(Relation relation, LOCKMODE lockmode); extern void LockRelationIdForSession(LockRelId *relid, LOCKMODE lockmode); extern void UnlockRelationIdForSession(LockRelId *relid, LOCKMODE lockmode); /* Lock a relation for extension */ extern void LockRelationForExtension(Relation relation, LOCKMODE lockmode); extern void UnlockRelationForExtension(Relation relation, LOCKMODE lockmode); /* Lock a page (currently only used within indexes) */ extern void LockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode); extern bool ConditionalLockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode); extern void UnlockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode); /* Lock a tuple (see heap_lock_tuple before assuming you understand this) */ extern void LockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode); extern bool ConditionalLockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode); extern void UnlockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode); /* Lock an XID (used to wait for a transaction to finish) */ extern void XactLockTableInsert(TransactionId xid); extern void XactLockTableDelete(TransactionId xid); extern void XactLockTableWait(TransactionId xid); extern bool ConditionalXactLockTableWait(TransactionId xid); /* Lock a general object (other than a relation) of the current database */ extern void LockDatabaseObject(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode); extern void UnlockDatabaseObject(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode); /* Lock a shared-across-databases object (other than a relation) */ extern void LockSharedObject(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode); extern void UnlockSharedObject(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode); extern void LockSharedObjectForSession(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode); extern void UnlockSharedObjectForSession(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode); /* Describe a locktag for error messages */ extern void DescribeLockTag(StringInfo buf, const LOCKTAG *tag); #endif /* LMGR_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/lock.h�������������������������������������������������������������������������0000644�����������������00000052245�14763166026�0011770 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * lock.h * POSTGRES low-level lock mechanism * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/lock.h * *------------------------------------------------------------------------- */ #ifndef LOCK_H_ #define LOCK_H_ #include "storage/backendid.h" #include "storage/lwlock.h" #include "storage/shmem.h" /* struct PGPROC is declared in proc.h, but must forward-reference it */ typedef struct PGPROC PGPROC; typedef struct PROC_QUEUE { SHM_QUEUE links; /* head of list of PGPROC objects */ int size; /* number of entries in list */ } PROC_QUEUE; /* GUC variables */ extern int max_locks_per_xact; #ifdef LOCK_DEBUG extern int Trace_lock_oidmin; extern bool Trace_locks; extern bool Trace_userlocks; extern int Trace_lock_table; extern bool Debug_deadlocks; #endif /* LOCK_DEBUG */ /* * Top-level transactions are identified by VirtualTransactionIDs comprising * the BackendId of the backend running the xact, plus a locally-assigned * LocalTransactionId. These are guaranteed unique over the short term, * but will be reused after a database restart; hence they should never * be stored on disk. * * Note that struct VirtualTransactionId can not be assumed to be atomically * assignable as a whole. However, type LocalTransactionId is assumed to * be atomically assignable, and the backend ID doesn't change often enough * to be a problem, so we can fetch or assign the two fields separately. * We deliberately refrain from using the struct within PGPROC, to prevent * coding errors from trying to use struct assignment with it; instead use * GET_VXID_FROM_PGPROC(). */ typedef struct { BackendId backendId; /* determined at backend startup */ LocalTransactionId localTransactionId; /* backend-local transaction * id */ } VirtualTransactionId; #define InvalidLocalTransactionId 0 #define LocalTransactionIdIsValid(lxid) ((lxid) != InvalidLocalTransactionId) #define VirtualTransactionIdIsValid(vxid) \ (((vxid).backendId != InvalidBackendId) && \ LocalTransactionIdIsValid((vxid).localTransactionId)) #define VirtualTransactionIdEquals(vxid1, vxid2) \ ((vxid1).backendId == (vxid2).backendId && \ (vxid1).localTransactionId == (vxid2).localTransactionId) #define SetInvalidVirtualTransactionId(vxid) \ ((vxid).backendId = InvalidBackendId, \ (vxid).localTransactionId = InvalidLocalTransactionId) #define GET_VXID_FROM_PGPROC(vxid, proc) \ ((vxid).backendId = (proc).backendId, \ (vxid).localTransactionId = (proc).lxid) /* * LOCKMODE is an integer (1..N) indicating a lock type. LOCKMASK is a bit * mask indicating a set of held or requested lock types (the bit 1<<mode * corresponds to a particular lock mode). */ typedef int LOCKMASK; typedef int LOCKMODE; /* MAX_LOCKMODES cannot be larger than the # of bits in LOCKMASK */ #define MAX_LOCKMODES 10 #define LOCKBIT_ON(lockmode) (1 << (lockmode)) #define LOCKBIT_OFF(lockmode) (~(1 << (lockmode))) /* * This data structure defines the locking semantics associated with a * "lock method". The semantics specify the meaning of each lock mode * (by defining which lock modes it conflicts with). * All of this data is constant and is kept in const tables. * * numLockModes -- number of lock modes (READ,WRITE,etc) that * are defined in this lock method. Must be less than MAX_LOCKMODES. * * conflictTab -- this is an array of bitmasks showing lock * mode conflicts. conflictTab[i] is a mask with the j-th bit * turned on if lock modes i and j conflict. Lock modes are * numbered 1..numLockModes; conflictTab[0] is unused. * * lockModeNames -- ID strings for debug printouts. * * trace_flag -- pointer to GUC trace flag for this lock method. (The * GUC variable is not constant, but we use "const" here to denote that * it can't be changed through this reference.) */ typedef struct LockMethodData { int numLockModes; const LOCKMASK *conflictTab; const char *const * lockModeNames; const bool *trace_flag; } LockMethodData; typedef const LockMethodData *LockMethod; /* * Lock methods are identified by LOCKMETHODID. (Despite the declaration as * uint16, we are constrained to 256 lockmethods by the layout of LOCKTAG.) */ typedef uint16 LOCKMETHODID; /* These identify the known lock methods */ #define DEFAULT_LOCKMETHOD 1 #define USER_LOCKMETHOD 2 /* * These are the valid values of type LOCKMODE for all the standard lock * methods (both DEFAULT and USER). */ /* NoLock is not a lock mode, but a flag value meaning "don't get a lock" */ #define NoLock 0 #define AccessShareLock 1 /* SELECT */ #define RowShareLock 2 /* SELECT FOR UPDATE/FOR SHARE */ #define RowExclusiveLock 3 /* INSERT, UPDATE, DELETE */ #define ShareUpdateExclusiveLock 4 /* VACUUM (non-FULL),ANALYZE, CREATE * INDEX CONCURRENTLY */ #define ShareLock 5 /* CREATE INDEX (WITHOUT CONCURRENTLY) */ #define ShareRowExclusiveLock 6 /* like EXCLUSIVE MODE, but allows ROW * SHARE */ #define ExclusiveLock 7 /* blocks ROW SHARE/SELECT...FOR * UPDATE */ #define AccessExclusiveLock 8 /* ALTER TABLE, DROP TABLE, VACUUM * FULL, and unqualified LOCK TABLE */ /* * LOCKTAG is the key information needed to look up a LOCK item in the * lock hashtable. A LOCKTAG value uniquely identifies a lockable object. * * The LockTagType enum defines the different kinds of objects we can lock. * We can handle up to 256 different LockTagTypes. */ typedef enum LockTagType { LOCKTAG_RELATION, /* whole relation */ /* ID info for a relation is DB OID + REL OID; DB OID = 0 if shared */ LOCKTAG_RELATION_EXTEND, /* the right to extend a relation */ /* same ID info as RELATION */ LOCKTAG_PAGE, /* one page of a relation */ /* ID info for a page is RELATION info + BlockNumber */ LOCKTAG_TUPLE, /* one physical tuple */ /* ID info for a tuple is PAGE info + OffsetNumber */ LOCKTAG_TRANSACTION, /* transaction (for waiting for xact done) */ /* ID info for a transaction is its TransactionId */ LOCKTAG_VIRTUALTRANSACTION, /* virtual transaction (ditto) */ /* ID info for a virtual transaction is its VirtualTransactionId */ LOCKTAG_OBJECT, /* non-relation database object */ /* ID info for an object is DB OID + CLASS OID + OBJECT OID + SUBID */ /* * Note: object ID has same representation as in pg_depend and * pg_description, but notice that we are constraining SUBID to 16 bits. * Also, we use DB OID = 0 for shared objects such as tablespaces. */ LOCKTAG_USERLOCK, /* reserved for old contrib/userlock code */ LOCKTAG_ADVISORY /* advisory user locks */ } LockTagType; #define LOCKTAG_LAST_TYPE LOCKTAG_ADVISORY /* * The LOCKTAG struct is defined with malice aforethought to fit into 16 * bytes with no padding. Note that this would need adjustment if we were * to widen Oid, BlockNumber, or TransactionId to more than 32 bits. * * We include lockmethodid in the locktag so that a single hash table in * shared memory can store locks of different lockmethods. */ typedef struct LOCKTAG { uint32 locktag_field1; /* a 32-bit ID field */ uint32 locktag_field2; /* a 32-bit ID field */ uint32 locktag_field3; /* a 32-bit ID field */ uint16 locktag_field4; /* a 16-bit ID field */ uint8 locktag_type; /* see enum LockTagType */ uint8 locktag_lockmethodid; /* lockmethod indicator */ } LOCKTAG; /* * These macros define how we map logical IDs of lockable objects into * the physical fields of LOCKTAG. Use these to set up LOCKTAG values, * rather than accessing the fields directly. Note multiple eval of target! */ #define SET_LOCKTAG_RELATION(locktag,dboid,reloid) \ ((locktag).locktag_field1 = (dboid), \ (locktag).locktag_field2 = (reloid), \ (locktag).locktag_field3 = 0, \ (locktag).locktag_field4 = 0, \ (locktag).locktag_type = LOCKTAG_RELATION, \ (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) #define SET_LOCKTAG_RELATION_EXTEND(locktag,dboid,reloid) \ ((locktag).locktag_field1 = (dboid), \ (locktag).locktag_field2 = (reloid), \ (locktag).locktag_field3 = 0, \ (locktag).locktag_field4 = 0, \ (locktag).locktag_type = LOCKTAG_RELATION_EXTEND, \ (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) #define SET_LOCKTAG_PAGE(locktag,dboid,reloid,blocknum) \ ((locktag).locktag_field1 = (dboid), \ (locktag).locktag_field2 = (reloid), \ (locktag).locktag_field3 = (blocknum), \ (locktag).locktag_field4 = 0, \ (locktag).locktag_type = LOCKTAG_PAGE, \ (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) #define SET_LOCKTAG_TUPLE(locktag,dboid,reloid,blocknum,offnum) \ ((locktag).locktag_field1 = (dboid), \ (locktag).locktag_field2 = (reloid), \ (locktag).locktag_field3 = (blocknum), \ (locktag).locktag_field4 = (offnum), \ (locktag).locktag_type = LOCKTAG_TUPLE, \ (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) #define SET_LOCKTAG_TRANSACTION(locktag,xid) \ ((locktag).locktag_field1 = (xid), \ (locktag).locktag_field2 = 0, \ (locktag).locktag_field3 = 0, \ (locktag).locktag_field4 = 0, \ (locktag).locktag_type = LOCKTAG_TRANSACTION, \ (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) #define SET_LOCKTAG_VIRTUALTRANSACTION(locktag,vxid) \ ((locktag).locktag_field1 = (vxid).backendId, \ (locktag).locktag_field2 = (vxid).localTransactionId, \ (locktag).locktag_field3 = 0, \ (locktag).locktag_field4 = 0, \ (locktag).locktag_type = LOCKTAG_VIRTUALTRANSACTION, \ (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) #define SET_LOCKTAG_OBJECT(locktag,dboid,classoid,objoid,objsubid) \ ((locktag).locktag_field1 = (dboid), \ (locktag).locktag_field2 = (classoid), \ (locktag).locktag_field3 = (objoid), \ (locktag).locktag_field4 = (objsubid), \ (locktag).locktag_type = LOCKTAG_OBJECT, \ (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) #define SET_LOCKTAG_ADVISORY(locktag,id1,id2,id3,id4) \ ((locktag).locktag_field1 = (id1), \ (locktag).locktag_field2 = (id2), \ (locktag).locktag_field3 = (id3), \ (locktag).locktag_field4 = (id4), \ (locktag).locktag_type = LOCKTAG_ADVISORY, \ (locktag).locktag_lockmethodid = USER_LOCKMETHOD) /* * Per-locked-object lock information: * * tag -- uniquely identifies the object being locked * grantMask -- bitmask for all lock types currently granted on this object. * waitMask -- bitmask for all lock types currently awaited on this object. * procLocks -- list of PROCLOCK objects for this lock. * waitProcs -- queue of processes waiting for this lock. * requested -- count of each lock type currently requested on the lock * (includes requests already granted!!). * nRequested -- total requested locks of all types. * granted -- count of each lock type currently granted on the lock. * nGranted -- total granted locks of all types. * * Note: these counts count 1 for each backend. Internally to a backend, * there may be multiple grabs on a particular lock, but this is not reflected * into shared memory. */ typedef struct LOCK { /* hash key */ LOCKTAG tag; /* unique identifier of lockable object */ /* data */ LOCKMASK grantMask; /* bitmask for lock types already granted */ LOCKMASK waitMask; /* bitmask for lock types awaited */ SHM_QUEUE procLocks; /* list of PROCLOCK objects assoc. with lock */ PROC_QUEUE waitProcs; /* list of PGPROC objects waiting on lock */ int requested[MAX_LOCKMODES]; /* counts of requested locks */ int nRequested; /* total of requested[] array */ int granted[MAX_LOCKMODES]; /* counts of granted locks */ int nGranted; /* total of granted[] array */ } LOCK; #define LOCK_LOCKMETHOD(lock) ((LOCKMETHODID) (lock).tag.locktag_lockmethodid) /* * We may have several different backends holding or awaiting locks * on the same lockable object. We need to store some per-holder/waiter * information for each such holder (or would-be holder). This is kept in * a PROCLOCK struct. * * PROCLOCKTAG is the key information needed to look up a PROCLOCK item in the * proclock hashtable. A PROCLOCKTAG value uniquely identifies the combination * of a lockable object and a holder/waiter for that object. (We can use * pointers here because the PROCLOCKTAG need only be unique for the lifespan * of the PROCLOCK, and it will never outlive the lock or the proc.) * * Internally to a backend, it is possible for the same lock to be held * for different purposes: the backend tracks transaction locks separately * from session locks. However, this is not reflected in the shared-memory * state: we only track which backend(s) hold the lock. This is OK since a * backend can never block itself. * * The holdMask field shows the already-granted locks represented by this * proclock. Note that there will be a proclock object, possibly with * zero holdMask, for any lock that the process is currently waiting on. * Otherwise, proclock objects whose holdMasks are zero are recycled * as soon as convenient. * * releaseMask is workspace for LockReleaseAll(): it shows the locks due * to be released during the current call. This must only be examined or * set by the backend owning the PROCLOCK. * * Each PROCLOCK object is linked into lists for both the associated LOCK * object and the owning PGPROC object. Note that the PROCLOCK is entered * into these lists as soon as it is created, even if no lock has yet been * granted. A PGPROC that is waiting for a lock to be granted will also be * linked into the lock's waitProcs queue. */ typedef struct PROCLOCKTAG { /* NB: we assume this struct contains no padding! */ LOCK *myLock; /* link to per-lockable-object information */ PGPROC *myProc; /* link to PGPROC of owning backend */ } PROCLOCKTAG; typedef struct PROCLOCK { /* tag */ PROCLOCKTAG tag; /* unique identifier of proclock object */ /* data */ LOCKMASK holdMask; /* bitmask for lock types currently held */ LOCKMASK releaseMask; /* bitmask for lock types to be released */ SHM_QUEUE lockLink; /* list link in LOCK's list of proclocks */ SHM_QUEUE procLink; /* list link in PGPROC's list of proclocks */ } PROCLOCK; #define PROCLOCK_LOCKMETHOD(proclock) \ LOCK_LOCKMETHOD(*((proclock).tag.myLock)) /* * Each backend also maintains a local hash table with information about each * lock it is currently interested in. In particular the local table counts * the number of times that lock has been acquired. This allows multiple * requests for the same lock to be executed without additional accesses to * shared memory. We also track the number of lock acquisitions per * ResourceOwner, so that we can release just those locks belonging to a * particular ResourceOwner. * * When holding a lock taken "normally", the lock and proclock fields always * point to the associated objects in shared memory. However, if we acquired * the lock via the fast-path mechanism, the lock and proclock fields are set * to NULL, since there probably aren't any such objects in shared memory. * (If the lock later gets promoted to normal representation, we may eventually * update our locallock's lock/proclock fields after finding the shared * objects.) * * Caution: a locallock object can be left over from a failed lock acquisition * attempt. In this case its lock/proclock fields are untrustworthy, since * the shared lock object is neither held nor awaited, and hence is available * to be reclaimed. If nLocks > 0 then these pointers must either be valid or * NULL, but when nLocks == 0 they should be considered garbage. */ typedef struct LOCALLOCKTAG { LOCKTAG lock; /* identifies the lockable object */ LOCKMODE mode; /* lock mode for this table entry */ } LOCALLOCKTAG; typedef struct LOCALLOCKOWNER { /* * Note: if owner is NULL then the lock is held on behalf of the session; * otherwise it is held on behalf of my current transaction. * * Must use a forward struct reference to avoid circularity. */ struct ResourceOwnerData *owner; int64 nLocks; /* # of times held by this owner */ } LOCALLOCKOWNER; typedef struct LOCALLOCK { /* tag */ LOCALLOCKTAG tag; /* unique identifier of locallock entry */ /* data */ LOCK *lock; /* associated LOCK object, if any */ PROCLOCK *proclock; /* associated PROCLOCK object, if any */ uint32 hashcode; /* copy of LOCKTAG's hash value */ int64 nLocks; /* total number of times lock is held */ int numLockOwners; /* # of relevant ResourceOwners */ int maxLockOwners; /* allocated size of array */ bool holdsStrongLockCount; /* bumped FastPathStrongRelationLocks */ LOCALLOCKOWNER *lockOwners; /* dynamically resizable array */ } LOCALLOCK; #define LOCALLOCK_LOCKMETHOD(llock) ((llock).tag.lock.locktag_lockmethodid) /* * These structures hold information passed from lmgr internals to the lock * listing user-level functions (in lockfuncs.c). */ typedef struct LockInstanceData { LOCKTAG locktag; /* locked object */ LOCKMASK holdMask; /* locks held by this PGPROC */ LOCKMODE waitLockMode; /* lock awaited by this PGPROC, if any */ BackendId backend; /* backend ID of this PGPROC */ LocalTransactionId lxid; /* local transaction ID of this PGPROC */ int pid; /* pid of this PGPROC */ bool fastpath; /* taken via fastpath? */ } LockInstanceData; typedef struct LockData { int nelements; /* The length of the array */ LockInstanceData *locks; } LockData; /* Result codes for LockAcquire() */ typedef enum { LOCKACQUIRE_NOT_AVAIL, /* lock not available, and dontWait=true */ LOCKACQUIRE_OK, /* lock successfully acquired */ LOCKACQUIRE_ALREADY_HELD /* incremented count for lock already held */ } LockAcquireResult; /* Deadlock states identified by DeadLockCheck() */ typedef enum { DS_NOT_YET_CHECKED, /* no deadlock check has run yet */ DS_NO_DEADLOCK, /* no deadlock detected */ DS_SOFT_DEADLOCK, /* deadlock avoided by queue rearrangement */ DS_HARD_DEADLOCK, /* deadlock, no way out but ERROR */ DS_BLOCKED_BY_AUTOVACUUM /* no deadlock; queue blocked by autovacuum * worker */ } DeadLockState; /* * The lockmgr's shared hash tables are partitioned to reduce contention. * To determine which partition a given locktag belongs to, compute the tag's * hash code with LockTagHashCode(), then apply one of these macros. * NB: NUM_LOCK_PARTITIONS must be a power of 2! */ #define LockHashPartition(hashcode) \ ((hashcode) % NUM_LOCK_PARTITIONS) #define LockHashPartitionLock(hashcode) \ ((LWLockId) (FirstLockMgrLock + LockHashPartition(hashcode))) /* * function prototypes */ extern void InitLocks(void); extern LockMethod GetLocksMethodTable(const LOCK *lock); extern uint32 LockTagHashCode(const LOCKTAG *locktag); extern LockAcquireResult LockAcquire(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock, bool dontWait); extern LockAcquireResult LockAcquireExtended(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock, bool dontWait, bool report_memory_error); extern void AbortStrongLockAcquire(void); extern bool LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock); extern void LockReleaseAll(LOCKMETHODID lockmethodid, bool allLocks); extern void LockReleaseSession(LOCKMETHODID lockmethodid); extern void LockReleaseCurrentOwner(LOCALLOCK **locallocks, int nlocks); extern void LockReassignCurrentOwner(LOCALLOCK **locallocks, int nlocks); extern bool LockHasWaiters(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock); extern VirtualTransactionId *GetLockConflicts(const LOCKTAG *locktag, LOCKMODE lockmode); extern void AtPrepare_Locks(void); extern void PostPrepare_Locks(TransactionId xid); extern int LockCheckConflicts(LockMethod lockMethodTable, LOCKMODE lockmode, LOCK *lock, PROCLOCK *proclock, PGPROC *proc); extern void GrantLock(LOCK *lock, PROCLOCK *proclock, LOCKMODE lockmode); extern void GrantAwaitedLock(void); extern void RemoveFromWaitQueue(PGPROC *proc, uint32 hashcode); extern Size LockShmemSize(void); extern LockData *GetLockStatusData(void); extern void ReportLockTableError(bool report); typedef struct xl_standby_lock { TransactionId xid; /* xid of holder of AccessExclusiveLock */ Oid dbOid; Oid relOid; } xl_standby_lock; extern xl_standby_lock *GetRunningTransactionLocks(int *nlocks); extern const char *GetLockmodeName(LOCKMETHODID lockmethodid, LOCKMODE mode); extern void lock_twophase_recover(TransactionId xid, uint16 info, void *recdata, uint32 len); extern void lock_twophase_postcommit(TransactionId xid, uint16 info, void *recdata, uint32 len); extern void lock_twophase_postabort(TransactionId xid, uint16 info, void *recdata, uint32 len); extern void lock_twophase_standby_recover(TransactionId xid, uint16 info, void *recdata, uint32 len); extern DeadLockState DeadLockCheck(PGPROC *proc); extern PGPROC *GetBlockingAutoVacuumPgproc(void); extern void DeadLockReport(void); extern void RememberSimpleDeadLock(PGPROC *proc1, LOCKMODE lockmode, LOCK *lock, PGPROC *proc2); extern void InitDeadLockChecking(void); #ifdef LOCK_DEBUG extern void DumpLocks(PGPROC *proc); extern void DumpAllLocks(void); #endif /* Lock a VXID (used to wait for a transaction to finish) */ extern void VirtualXactLockTableInsert(VirtualTransactionId vxid); extern void VirtualXactLockTableCleanup(void); extern bool VirtualXactLock(VirtualTransactionId vxid, bool wait); #endif /* LOCK_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/block.h������������������������������������������������������������������������0000644�����������������00000006322�14763166026�0012125 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * block.h * POSTGRES disk block definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/block.h * *------------------------------------------------------------------------- */ #ifndef BLOCK_H #define BLOCK_H /* * BlockNumber: * * each data file (heap or index) is divided into postgres disk blocks * (which may be thought of as the unit of i/o -- a postgres buffer * contains exactly one disk block). the blocks are numbered * sequentially, 0 to 0xFFFFFFFE. * * InvalidBlockNumber is the same thing as P_NEW in buf.h. * * the access methods, the buffer manager and the storage manager are * more or less the only pieces of code that should be accessing disk * blocks directly. */ typedef uint32 BlockNumber; #define InvalidBlockNumber ((BlockNumber) 0xFFFFFFFF) #define MaxBlockNumber ((BlockNumber) 0xFFFFFFFE) /* * BlockId: * * this is a storage type for BlockNumber. in other words, this type * is used for on-disk structures (e.g., in HeapTupleData) whereas * BlockNumber is the type on which calculations are performed (e.g., * in access method code). * * there doesn't appear to be any reason to have separate types except * for the fact that BlockIds can be SHORTALIGN'd (and therefore any * structures that contains them, such as ItemPointerData, can also be * SHORTALIGN'd). this is an important consideration for reducing the * space requirements of the line pointer (ItemIdData) array on each * page and the header of each heap or index tuple, so it doesn't seem * wise to change this without good reason. */ typedef struct BlockIdData { uint16 bi_hi; uint16 bi_lo; } BlockIdData; typedef BlockIdData *BlockId; /* block identifier */ /* ---------------- * support macros * ---------------- */ /* * BlockNumberIsValid * True iff blockNumber is valid. */ #define BlockNumberIsValid(blockNumber) \ ((bool) ((BlockNumber) (blockNumber) != InvalidBlockNumber)) /* * BlockIdIsValid * True iff the block identifier is valid. */ #define BlockIdIsValid(blockId) \ ((bool) PointerIsValid(blockId)) /* * BlockIdSet * Sets a block identifier to the specified value. */ #define BlockIdSet(blockId, blockNumber) \ ( \ AssertMacro(PointerIsValid(blockId)), \ (blockId)->bi_hi = (blockNumber) >> 16, \ (blockId)->bi_lo = (blockNumber) & 0xffff \ ) /* * BlockIdCopy * Copy a block identifier. */ #define BlockIdCopy(toBlockId, fromBlockId) \ ( \ AssertMacro(PointerIsValid(toBlockId)), \ AssertMacro(PointerIsValid(fromBlockId)), \ (toBlockId)->bi_hi = (fromBlockId)->bi_hi, \ (toBlockId)->bi_lo = (fromBlockId)->bi_lo \ ) /* * BlockIdEquals * Check for block number equality. */ #define BlockIdEquals(blockId1, blockId2) \ ((blockId1)->bi_hi == (blockId2)->bi_hi && \ (blockId1)->bi_lo == (blockId2)->bi_lo) /* * BlockIdGetBlockNumber * Retrieve the block number from a block identifier. */ #define BlockIdGetBlockNumber(blockId) \ ( \ AssertMacro(BlockIdIsValid(blockId)), \ (BlockNumber) (((blockId)->bi_hi << 16) | ((uint16) (blockId)->bi_lo)) \ ) #endif /* BLOCK_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/spin.h�������������������������������������������������������������������������0000644�����������������00000005327�14763166026�0012010 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * spin.h * Hardware-independent implementation of spinlocks. * * * The hardware-independent interface to spinlocks is defined by the * typedef "slock_t" and these macros: * * void SpinLockInit(volatile slock_t *lock) * Initialize a spinlock (to the unlocked state). * * void SpinLockAcquire(volatile slock_t *lock) * Acquire a spinlock, waiting if necessary. * Time out and abort() if unable to acquire the lock in a * "reasonable" amount of time --- typically ~ 1 minute. * * void SpinLockRelease(volatile slock_t *lock) * Unlock a previously acquired lock. * * bool SpinLockFree(slock_t *lock) * Tests if the lock is free. Returns TRUE if free, FALSE if locked. * This does *not* change the state of the lock. * * Callers must beware that the macro argument may be evaluated multiple * times! * * CAUTION: Care must be taken to ensure that loads and stores of * shared memory values are not rearranged around spinlock acquire * and release. This is done using the "volatile" qualifier: the C * standard states that loads and stores of volatile objects cannot * be rearranged *with respect to other volatile objects*. The * spinlock is always written through a volatile pointer by the * spinlock macros, but this is not sufficient by itself: code that * protects shared data with a spinlock MUST reference that shared * data through a volatile pointer. * * Keep in mind the coding rule that spinlocks must not be held for more * than a few instructions. In particular, we assume it is not possible * for a CHECK_FOR_INTERRUPTS() to occur while holding a spinlock, and so * it is not necessary to do HOLD/RESUME_INTERRUPTS() in these macros. * * These macros are implemented in terms of hardware-dependent macros * supplied by s_lock.h. There is not currently any extra functionality * added by this header, but there has been in the past and may someday * be again. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/spin.h * *------------------------------------------------------------------------- */ #ifndef SPIN_H #define SPIN_H #include "storage/s_lock.h" #ifndef HAVE_SPINLOCKS #include "storage/pg_sema.h" #endif #define SpinLockInit(lock) S_INIT_LOCK(lock) #define SpinLockAcquire(lock) S_LOCK(lock) #define SpinLockRelease(lock) S_UNLOCK(lock) #define SpinLockFree(lock) S_LOCK_FREE(lock) extern int SpinlockSemas(void); extern Size SpinlockSemaSize(void); #ifndef HAVE_SPINLOCKS extern void SpinlockSemaInit(PGSemaphore); extern PGSemaphore SpinlockSemaArray; #endif #endif /* SPIN_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/item.h�������������������������������������������������������������������������0000644�����������������00000000725�14763166026�0011772 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * item.h * POSTGRES disk item definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/item.h * *------------------------------------------------------------------------- */ #ifndef ITEM_H #define ITEM_H typedef Pointer Item; #endif /* ITEM_H */ �������������������������������������������pgsql/server/storage/fd.h���������������������������������������������������������������������������0000644�����������������00000007101�14763166026�0011420 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * fd.h * Virtual file descriptor definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/fd.h * *------------------------------------------------------------------------- */ /* * calls: * * File {Close, Read, Write, Seek, Tell, Sync} * {File Name Open, Allocate, Free} File * * These are NOT JUST RENAMINGS OF THE UNIX ROUTINES. * Use them for all file activity... * * File fd; * fd = FilePathOpenFile("foo", O_RDONLY, 0600); * * AllocateFile(); * FreeFile(); * * Use AllocateFile, not fopen, if you need a stdio file (FILE*); then * use FreeFile, not fclose, to close it. AVOID using stdio for files * that you intend to hold open for any length of time, since there is * no way for them to share kernel file descriptors with other files. * * Likewise, use AllocateDir/FreeDir, not opendir/closedir, to allocate * open directories (DIR*). */ #ifndef FD_H #define FD_H #include <dirent.h> /* * FileSeek uses the standard UNIX lseek(2) flags. */ typedef char *FileName; typedef int File; /* GUC parameter */ extern int max_files_per_process; /* * This is private to fd.c, but exported for save/restore_backend_variables() */ extern int max_safe_fds; /* * prototypes for functions in fd.c */ /* Operations on virtual Files --- equivalent to Unix kernel file ops */ extern File PathNameOpenFile(FileName fileName, int fileFlags, int fileMode); extern File OpenTemporaryFile(bool interXact); extern void FileClose(File file); extern int FilePrefetch(File file, off_t offset, int amount); extern int FileRead(File file, char *buffer, int amount); extern int FileWrite(File file, char *buffer, int amount); extern int FileSync(File file); extern off_t FileSeek(File file, off_t offset, int whence); extern int FileTruncate(File file, off_t offset); extern char *FilePathName(File file); /* Operations that allow use of regular stdio --- USE WITH CAUTION */ extern FILE *AllocateFile(const char *name, const char *mode); extern int FreeFile(FILE *file); /* Operations to allow use of the <dirent.h> library routines */ extern DIR *AllocateDir(const char *dirname); extern struct dirent *ReadDir(DIR *dir, const char *dirname); extern int FreeDir(DIR *dir); /* If you've really really gotta have a plain kernel FD, use this */ extern int BasicOpenFile(FileName fileName, int fileFlags, int fileMode); /* Miscellaneous support routines */ extern void InitFileAccess(void); extern void set_max_safe_fds(void); extern void closeAllVfds(void); extern void SetTempTablespaces(Oid *tableSpaces, int numSpaces); extern bool TempTablespacesAreSet(void); extern Oid GetNextTempTableSpace(void); extern void AtEOXact_Files(void); extern void AtEOSubXact_Files(bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid); extern void RemovePgTempFiles(void); extern int pg_fsync(int fd); extern int pg_fsync_no_writethrough(int fd); extern int pg_fsync_writethrough(int fd); extern int pg_fdatasync(int fd); extern int pg_flush_data(int fd, off_t offset, off_t amount); extern void fsync_fname(const char *fname, bool isdir); extern int durable_rename(const char *oldfile, const char *newfile, int loglevel); extern int durable_link_or_rename(const char *oldfile, const char *newfile, int loglevel); extern void SyncDataDirectory(void); /* Filename components for OpenTemporaryFile */ #define PG_TEMP_FILES_DIR "pgsql_tmp" #define PG_TEMP_FILE_PREFIX "pgsql_tmp" #endif /* FD_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/pos.h��������������������������������������������������������������������������0000644�����������������00000003071�14763166026�0011632 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pos.h * POSTGRES "position" definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/pos.h * *------------------------------------------------------------------------- */ #ifndef POS_H #define POS_H /* * a 'position' used to be <pagenumber, offset> in postgres. this has * been changed to just <offset> as the notion of having multiple pages * within a block has been removed. * * the 'offset' abstraction is somewhat confusing. it is NOT a byte * offset within the page; instead, it is an offset into the line * pointer array contained on every page that store (heap or index) * tuples. */ typedef bits16 PositionIdData; typedef PositionIdData *PositionId; /* ---------------- * support macros * ---------------- */ /* * PositionIdIsValid * True iff the position identifier is valid. */ #define PositionIdIsValid(positionId) \ PointerIsValid(positionId) /* * PositionIdSetInvalid * Make an invalid position. */ #define PositionIdSetInvalid(positionId) \ *(positionId) = (bits16) 0 /* * PositionIdSet * Sets a position identifier to the specified value. */ #define PositionIdSet(positionId, offsetNumber) \ *(positionId) = (offsetNumber) /* * PositionIdGetOffsetNumber * Retrieve the offset number from a position identifier. */ #define PositionIdGetOffsetNumber(positionId) \ ((OffsetNumber) *(positionId)) #endif /* POS_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/fsm_internals.h����������������������������������������������������������������0000644�����������������00000004370�14763166026�0013700 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * fsm_internal.h * internal functions for free space map * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/fsm_internals.h * *------------------------------------------------------------------------- */ #ifndef FSM_INTERNALS_H #define FSM_INTERNALS_H #include "storage/buf.h" #include "storage/bufpage.h" /* * Structure of a FSM page. See src/backend/storage/freespace/README for * details. */ typedef struct { /* * fsm_search_avail() tries to spread the load of multiple backends by * returning different pages to different backends in a round-robin * fashion. fp_next_slot points to the next slot to be returned (assuming * there's enough space on it for the request). It's defined as an int, * because it's updated without an exclusive lock. uint16 would be more * appropriate, but int is more likely to be atomically * fetchable/storable. */ int fp_next_slot; /* * fp_nodes contains the binary tree, stored in array. The first * NonLeafNodesPerPage elements are upper nodes, and the following * LeafNodesPerPage elements are leaf nodes. Unused nodes are zero. */ uint8 fp_nodes[1]; } FSMPageData; typedef FSMPageData *FSMPage; /* * Number of non-leaf and leaf nodes, and nodes in total, on an FSM page. * These definitions are internal to fsmpage.c. */ #define NodesPerPage (BLCKSZ - MAXALIGN(SizeOfPageHeaderData) - \ offsetof(FSMPageData, fp_nodes)) #define NonLeafNodesPerPage (BLCKSZ / 2 - 1) #define LeafNodesPerPage (NodesPerPage - NonLeafNodesPerPage) /* * Number of FSM "slots" on a FSM page. This is what should be used * outside fsmpage.c. */ #define SlotsPerFSMPage LeafNodesPerPage /* Prototypes for functions in fsmpage.c */ extern int fsm_search_avail(Buffer buf, uint8 min_cat, bool advancenext, bool exclusive_lock_held); extern uint8 fsm_get_avail(Page page, int slot); extern uint8 fsm_get_max_avail(Page page); extern bool fsm_set_avail(Page page, int slot, uint8 value); extern bool fsm_truncate_avail(Page page, int nslots); extern bool fsm_rebuild_page(Page page); #endif /* FSM_INTERNALS_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/buffile.h����������������������������������������������������������������������0000644�����������������00000003262�14763166026�0012447 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * buffile.h * Management of large buffered files, primarily temporary files. * * The BufFile routines provide a partial replacement for stdio atop * virtual file descriptors managed by fd.c. Currently they only support * buffered access to a virtual file, without any of stdio's formatting * features. That's enough for immediate needs, but the set of facilities * could be expanded if necessary. * * BufFile also supports working with temporary files that exceed the OS * file size limit and/or the largest offset representable in an int. * It might be better to split that out as a separately accessible module, * but currently we have no need for oversize temp files without buffered * access. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/buffile.h * *------------------------------------------------------------------------- */ #ifndef BUFFILE_H #define BUFFILE_H /* BufFile is an opaque type whose details are not known outside buffile.c. */ typedef struct BufFile BufFile; /* * prototypes for functions in buffile.c */ extern BufFile *BufFileCreateTemp(bool interXact); extern void BufFileClose(BufFile *file); extern size_t BufFileRead(BufFile *file, void *ptr, size_t size); extern size_t BufFileWrite(BufFile *file, void *ptr, size_t size); extern int BufFileSeek(BufFile *file, int fileno, off_t offset, int whence); extern void BufFileTell(BufFile *file, int *fileno, off_t *offset); extern int BufFileSeekBlock(BufFile *file, long blknum); #endif /* BUFFILE_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/procarray.h��������������������������������������������������������������������0000644�����������������00000005723�14763166026�0013041 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * procarray.h * POSTGRES process array definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/procarray.h * *------------------------------------------------------------------------- */ #ifndef PROCARRAY_H #define PROCARRAY_H #include "storage/standby.h" #include "utils/snapshot.h" extern Size ProcArrayShmemSize(void); extern void CreateSharedProcArray(void); extern void ProcArrayAdd(PGPROC *proc); extern void ProcArrayRemove(PGPROC *proc, TransactionId latestXid); extern void ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid); extern void ProcArrayClearTransaction(PGPROC *proc); extern void ProcArrayInitRecovery(TransactionId initializedUptoXID); extern void ProcArrayApplyRecoveryInfo(RunningTransactions running); extern void ProcArrayApplyXidAssignment(TransactionId topxid, int nsubxids, TransactionId *subxids); extern void RecordKnownAssignedTransactionIds(TransactionId xid); extern void ExpireTreeKnownAssignedTransactionIds(TransactionId xid, int nsubxids, TransactionId *subxids, TransactionId max_xid); extern void ExpireAllKnownAssignedTransactionIds(void); extern void ExpireOldKnownAssignedTransactionIds(TransactionId xid); extern int GetMaxSnapshotXidCount(void); extern int GetMaxSnapshotSubxidCount(void); extern Snapshot GetSnapshotData(Snapshot snapshot); extern bool ProcArrayInstallImportedXmin(TransactionId xmin, TransactionId sourcexid); extern RunningTransactions GetRunningTransactionData(void); extern bool TransactionIdIsInProgress(TransactionId xid); extern bool TransactionIdIsActive(TransactionId xid); extern TransactionId GetOldestXmin(bool allDbs, bool ignoreVacuum); extern TransactionId GetOldestActiveTransactionId(void); extern int GetTransactionsInCommit(TransactionId **xids_p); extern bool HaveTransactionsInCommit(TransactionId *xids, int nxids); extern PGPROC *BackendPidGetProc(int pid); extern int BackendXidGetPid(TransactionId xid); extern bool IsBackendPid(int pid); extern VirtualTransactionId *GetCurrentVirtualXIDs(TransactionId limitXmin, bool excludeXmin0, bool allDbs, int excludeVacuum, int *nvxids); extern VirtualTransactionId *GetConflictingVirtualXIDs(TransactionId limitXmin, Oid dbOid); extern pid_t CancelVirtualTransaction(VirtualTransactionId vxid, ProcSignalReason sigmode); extern bool MinimumActiveBackends(int min); extern int CountDBBackends(Oid databaseid); extern void CancelDBBackends(Oid databaseid, ProcSignalReason sigmode, bool conflictPending); extern int CountUserBackends(Oid roleid); extern bool CountOtherDBBackends(Oid databaseId, int *nbackends, int *nprepared); extern void XidCacheRemoveRunningXids(TransactionId xid, int nxids, const TransactionId *xids, TransactionId latestXid); #endif /* PROCARRAY_H */ ���������������������������������������������pgsql/server/storage/predicate_internals.h����������������������������������������������������������0000644�����������������00000041752�14763166026�0015060 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * predicate_internals.h * POSTGRES internal predicate locking definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/predicate_internals.h * *------------------------------------------------------------------------- */ #ifndef PREDICATE_INTERNALS_H #define PREDICATE_INTERNALS_H #include "storage/lock.h" /* * Commit number. */ typedef uint64 SerCommitSeqNo; /* * Reserved commit sequence numbers: * - 0 is reserved to indicate a non-existent SLRU entry; it cannot be * used as a SerCommitSeqNo, even an invalid one * - InvalidSerCommitSeqNo is used to indicate a transaction that * hasn't committed yet, so use a number greater than all valid * ones to make comparison do the expected thing * - RecoverySerCommitSeqNo is used to refer to transactions that * happened before a crash/recovery, since we restart the sequence * at that point. It's earlier than all normal sequence numbers, * and is only used by recovered prepared transactions */ #define InvalidSerCommitSeqNo ((SerCommitSeqNo) UINT64CONST(0xFFFFFFFFFFFFFFFF)) #define RecoverySerCommitSeqNo ((SerCommitSeqNo) 1) #define FirstNormalSerCommitSeqNo ((SerCommitSeqNo) 2) /* * The SERIALIZABLEXACT struct contains information needed for each * serializable database transaction to support SSI techniques. * * A home-grown list is maintained in shared memory to manage these. * An entry is used when the serializable transaction acquires a snapshot. * Unless the transaction is rolled back, this entry must generally remain * until all concurrent transactions have completed. (There are special * optimizations for READ ONLY transactions which often allow them to be * cleaned up earlier.) A transaction which is rolled back is cleaned up * as soon as possible. * * Eligibility for cleanup of committed transactions is generally determined * by comparing the transaction's finishedBefore field to * SerializableGlobalXmin. */ typedef struct SERIALIZABLEXACT { VirtualTransactionId vxid; /* The executing process always has one of * these. */ /* * We use two numbers to track the order that transactions commit. Before * commit, a transaction is marked as prepared, and prepareSeqNo is set. * Shortly after commit, it's marked as committed, and commitSeqNo is set. * This doesn't give a strict commit order, but these two values together * are good enough for us, as we can always err on the safe side and * assume that there's a conflict, if we can't be sure of the exact * ordering of two commits. * * Note that a transaction is marked as prepared for a short period during * commit processing, even if two-phase commit is not used. But with * two-phase commit, a transaction can stay in prepared state for some * time. */ SerCommitSeqNo prepareSeqNo; SerCommitSeqNo commitSeqNo; /* these values are not both interesting at the same time */ union { SerCommitSeqNo earliestOutConflictCommit; /* when committed with * conflict out */ SerCommitSeqNo lastCommitBeforeSnapshot; /* when not committed or * no conflict out */ } SeqNo; SHM_QUEUE outConflicts; /* list of write transactions whose data we * couldn't read. */ SHM_QUEUE inConflicts; /* list of read transactions which couldn't * see our write. */ SHM_QUEUE predicateLocks; /* list of associated PREDICATELOCK objects */ SHM_QUEUE finishedLink; /* list link in * FinishedSerializableTransactions */ /* * for r/o transactions: list of concurrent r/w transactions that we could * potentially have conflicts with, and vice versa for r/w transactions */ SHM_QUEUE possibleUnsafeConflicts; TransactionId topXid; /* top level xid for the transaction, if one * exists; else invalid */ TransactionId finishedBefore; /* invalid means still running; else * the struct expires when no * serializable xids are before this. */ TransactionId xmin; /* the transaction's snapshot xmin */ uint32 flags; /* OR'd combination of values defined below */ int pid; /* pid of associated process */ } SERIALIZABLEXACT; #define SXACT_FLAG_COMMITTED 0x00000001 /* already committed */ #define SXACT_FLAG_PREPARED 0x00000002 /* about to commit */ #define SXACT_FLAG_ROLLED_BACK 0x00000004 /* already rolled back */ #define SXACT_FLAG_DOOMED 0x00000008 /* will roll back */ /* * The following flag actually means that the flagged transaction has a * conflict out *to a transaction which committed ahead of it*. It's hard * to get that into a name of a reasonable length. */ #define SXACT_FLAG_CONFLICT_OUT 0x00000010 #define SXACT_FLAG_READ_ONLY 0x00000020 #define SXACT_FLAG_DEFERRABLE_WAITING 0x00000040 #define SXACT_FLAG_RO_SAFE 0x00000080 #define SXACT_FLAG_RO_UNSAFE 0x00000100 #define SXACT_FLAG_SUMMARY_CONFLICT_IN 0x00000200 #define SXACT_FLAG_SUMMARY_CONFLICT_OUT 0x00000400 /* * The following types are used to provide an ad hoc list for holding * SERIALIZABLEXACT objects. An HTAB is overkill, since there is no need to * access these by key -- there are direct pointers to these objects where * needed. If a shared memory list is created, these types can probably be * eliminated in favor of using the general solution. */ typedef struct PredXactListElementData { SHM_QUEUE link; SERIALIZABLEXACT sxact; } PredXactListElementData; typedef struct PredXactListElementData *PredXactListElement; #define PredXactListElementDataSize \ ((Size)MAXALIGN(sizeof(PredXactListElementData))) typedef struct PredXactListData { SHM_QUEUE availableList; SHM_QUEUE activeList; /* * These global variables are maintained when registering and cleaning up * serializable transactions. They must be global across all backends, * but are not needed outside the predicate.c source file. Protected by * SerializableXactHashLock. */ TransactionId SxactGlobalXmin; /* global xmin for active serializable * transactions */ int SxactGlobalXminCount; /* how many active serializable * transactions have this xmin */ int WritableSxactCount; /* how many non-read-only serializable * transactions are active */ SerCommitSeqNo LastSxactCommitSeqNo; /* a strictly monotonically * increasing number for * commits of serializable * transactions */ /* Protected by SerializableXactHashLock. */ SerCommitSeqNo CanPartialClearThrough; /* can clear predicate locks * and inConflicts for * committed transactions * through this seq no */ /* Protected by SerializableFinishedListLock. */ SerCommitSeqNo HavePartialClearedThrough; /* have cleared through this * seq no */ SERIALIZABLEXACT *OldCommittedSxact; /* shared copy of dummy sxact */ PredXactListElement element; } PredXactListData; typedef struct PredXactListData *PredXactList; #define PredXactListDataSize \ ((Size)MAXALIGN(sizeof(PredXactListData))) /* * The following types are used to provide lists of rw-conflicts between * pairs of transactions. Since exactly the same information is needed, * they are also used to record possible unsafe transaction relationships * for purposes of identifying safe snapshots for read-only transactions. * * When a RWConflictData is not in use to record either type of relationship * between a pair of transactions, it is kept on an "available" list. The * outLink field is used for maintaining that list. */ typedef struct RWConflictData { SHM_QUEUE outLink; /* link for list of conflicts out from a sxact */ SHM_QUEUE inLink; /* link for list of conflicts in to a sxact */ SERIALIZABLEXACT *sxactOut; SERIALIZABLEXACT *sxactIn; } RWConflictData; typedef struct RWConflictData *RWConflict; #define RWConflictDataSize \ ((Size)MAXALIGN(sizeof(RWConflictData))) typedef struct RWConflictPoolHeaderData { SHM_QUEUE availableList; RWConflict element; } RWConflictPoolHeaderData; typedef struct RWConflictPoolHeaderData *RWConflictPoolHeader; #define RWConflictPoolHeaderDataSize \ ((Size)MAXALIGN(sizeof(RWConflictPoolHeaderData))) /* * The SERIALIZABLEXIDTAG struct identifies an xid assigned to a serializable * transaction or any of its subtransactions. */ typedef struct SERIALIZABLEXIDTAG { TransactionId xid; } SERIALIZABLEXIDTAG; /* * The SERIALIZABLEXID struct provides a link from a TransactionId for a * serializable transaction to the related SERIALIZABLEXACT record, even if * the transaction has completed and its connection has been closed. * * These are created as new top level transaction IDs are first assigned to * transactions which are participating in predicate locking. This may * never happen for a particular transaction if it doesn't write anything. * They are removed with their related serializable transaction objects. * * The SubTransGetTopmostTransaction method is used where necessary to get * from an XID which might be from a subtransaction to the top level XID. */ typedef struct SERIALIZABLEXID { /* hash key */ SERIALIZABLEXIDTAG tag; /* data */ SERIALIZABLEXACT *myXact; /* pointer to the top level transaction data */ } SERIALIZABLEXID; /* * The PREDICATELOCKTARGETTAG struct identifies a database object which can * be the target of predicate locks. * * Note that the hash function being used doesn't properly respect tag * length -- if the length of the structure isn't a multiple of four bytes it * will go to a four byte boundary past the end of the tag. If you change * this struct, make sure any slack space is initialized, so that any random * bytes in the middle or at the end are not included in the hash. * * TODO SSI: If we always use the same fields for the same type of value, we * should rename these. Holding off until it's clear there are no exceptions. * Since indexes are relations with blocks and tuples, it's looking likely that * the rename will be possible. If not, we may need to divide the last field * and use part of it for a target type, so that we know how to interpret the * data.. */ typedef struct PREDICATELOCKTARGETTAG { uint32 locktag_field1; /* a 32-bit ID field */ uint32 locktag_field2; /* a 32-bit ID field */ uint32 locktag_field3; /* a 32-bit ID field */ uint32 locktag_field4; /* a 32-bit ID field */ } PREDICATELOCKTARGETTAG; /* * The PREDICATELOCKTARGET struct represents a database object on which there * are predicate locks. * * A hash list of these objects is maintained in shared memory. An entry is * added when a predicate lock is requested on an object which doesn't * already have one. An entry is removed when the last lock is removed from * its list. */ typedef struct PREDICATELOCKTARGET { /* hash key */ PREDICATELOCKTARGETTAG tag; /* unique identifier of lockable object */ /* data */ SHM_QUEUE predicateLocks; /* list of PREDICATELOCK objects assoc. with * predicate lock target */ } PREDICATELOCKTARGET; /* * The PREDICATELOCKTAG struct identifies an individual predicate lock. * * It is the combination of predicate lock target (which is a lockable * object) and a serializable transaction which has acquired a lock on that * target. */ typedef struct PREDICATELOCKTAG { PREDICATELOCKTARGET *myTarget; SERIALIZABLEXACT *myXact; } PREDICATELOCKTAG; /* * The PREDICATELOCK struct represents an individual lock. * * An entry can be created here when the related database object is read, or * by promotion of multiple finer-grained targets. All entries related to a * serializable transaction are removed when that serializable transaction is * cleaned up. Entries can also be removed when they are combined into a * single coarser-grained lock entry. */ typedef struct PREDICATELOCK { /* hash key */ PREDICATELOCKTAG tag; /* unique identifier of lock */ /* data */ SHM_QUEUE targetLink; /* list link in PREDICATELOCKTARGET's list of * predicate locks */ SHM_QUEUE xactLink; /* list link in SERIALIZABLEXACT's list of * predicate locks */ SerCommitSeqNo commitSeqNo; /* only used for summarized predicate locks */ } PREDICATELOCK; /* * The LOCALPREDICATELOCK struct represents a local copy of data which is * also present in the PREDICATELOCK table, organized for fast access without * needing to acquire a LWLock. It is strictly for optimization. * * Each serializable transaction creates its own local hash table to hold a * collection of these. This information is used to determine when a number * of fine-grained locks should be promoted to a single coarser-grained lock. * The information is maintained more-or-less in parallel to the * PREDICATELOCK data, but because this data is not protected by locks and is * only used in an optimization heuristic, it is allowed to drift in a few * corner cases where maintaining exact data would be expensive. * * The hash table is created when the serializable transaction acquires its * snapshot, and its memory is released upon completion of the transaction. */ typedef struct LOCALPREDICATELOCK { /* hash key */ PREDICATELOCKTARGETTAG tag; /* unique identifier of lockable object */ /* data */ bool held; /* is lock held, or just its children? */ int childLocks; /* number of child locks currently held */ } LOCALPREDICATELOCK; /* * The types of predicate locks which can be acquired. */ typedef enum PredicateLockTargetType { PREDLOCKTAG_RELATION, PREDLOCKTAG_PAGE, PREDLOCKTAG_TUPLE /* TODO SSI: Other types may be needed for index locking */ } PredicateLockTargetType; /* * This structure is used to quickly capture a copy of all predicate * locks. This is currently used only by the pg_lock_status function, * which in turn is used by the pg_locks view. */ typedef struct PredicateLockData { int nelements; PREDICATELOCKTARGETTAG *locktags; SERIALIZABLEXACT *xacts; } PredicateLockData; /* * These macros define how we map logical IDs of lockable objects into the * physical fields of PREDICATELOCKTARGETTAG. Use these to set up values, * rather than accessing the fields directly. Note multiple eval of target! */ #define SET_PREDICATELOCKTARGETTAG_RELATION(locktag,dboid,reloid) \ ((locktag).locktag_field1 = (dboid), \ (locktag).locktag_field2 = (reloid), \ (locktag).locktag_field3 = InvalidBlockNumber, \ (locktag).locktag_field4 = InvalidOffsetNumber) #define SET_PREDICATELOCKTARGETTAG_PAGE(locktag,dboid,reloid,blocknum) \ ((locktag).locktag_field1 = (dboid), \ (locktag).locktag_field2 = (reloid), \ (locktag).locktag_field3 = (blocknum), \ (locktag).locktag_field4 = InvalidOffsetNumber) #define SET_PREDICATELOCKTARGETTAG_TUPLE(locktag,dboid,reloid,blocknum,offnum) \ ((locktag).locktag_field1 = (dboid), \ (locktag).locktag_field2 = (reloid), \ (locktag).locktag_field3 = (blocknum), \ (locktag).locktag_field4 = (offnum)) #define GET_PREDICATELOCKTARGETTAG_DB(locktag) \ ((Oid) (locktag).locktag_field1) #define GET_PREDICATELOCKTARGETTAG_RELATION(locktag) \ ((Oid) (locktag).locktag_field2) #define GET_PREDICATELOCKTARGETTAG_PAGE(locktag) \ ((BlockNumber) (locktag).locktag_field3) #define GET_PREDICATELOCKTARGETTAG_OFFSET(locktag) \ ((OffsetNumber) (locktag).locktag_field4) #define GET_PREDICATELOCKTARGETTAG_TYPE(locktag) \ (((locktag).locktag_field4 != InvalidOffsetNumber) ? PREDLOCKTAG_TUPLE : \ (((locktag).locktag_field3 != InvalidBlockNumber) ? PREDLOCKTAG_PAGE : \ PREDLOCKTAG_RELATION)) /* * Two-phase commit statefile records. There are two types: for each * transaction, we generate one per-transaction record and a variable * number of per-predicate-lock records. */ typedef enum TwoPhasePredicateRecordType { TWOPHASEPREDICATERECORD_XACT, TWOPHASEPREDICATERECORD_LOCK } TwoPhasePredicateRecordType; /* * Per-transaction information to reconstruct a SERIALIZABLEXACT. Not * much is needed because most of it not meaningful for a recovered * prepared transaction. * * In particular, we do not record the in and out conflict lists for a * prepared transaction because the associated SERIALIZABLEXACTs will * not be available after recovery. Instead, we simply record the * existence of each type of conflict by setting the transaction's * summary conflict in/out flag. */ typedef struct TwoPhasePredicateXactRecord { TransactionId xmin; uint32 flags; } TwoPhasePredicateXactRecord; /* Per-lock state */ typedef struct TwoPhasePredicateLockRecord { PREDICATELOCKTARGETTAG target; uint32 filler; /* to avoid length change in back-patched fix */ } TwoPhasePredicateLockRecord; typedef struct TwoPhasePredicateRecord { TwoPhasePredicateRecordType type; union { TwoPhasePredicateXactRecord xactRecord; TwoPhasePredicateLockRecord lockRecord; } data; } TwoPhasePredicateRecord; /* * Define a macro to use for an "empty" SERIALIZABLEXACT reference. */ #define InvalidSerializableXact ((SERIALIZABLEXACT *) NULL) /* * Function definitions for functions needing awareness of predicate * locking internals. */ extern PredicateLockData *GetPredicateLockStatusData(void); #endif /* PREDICATE_INTERNALS_H */ ����������������������pgsql/server/storage/bufmgr.h�����������������������������������������������������������������������0000644�����������������00000016321�14763166026�0012315 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * bufmgr.h * POSTGRES buffer manager definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/bufmgr.h * *------------------------------------------------------------------------- */ #ifndef BUFMGR_H #define BUFMGR_H #include "storage/block.h" #include "storage/buf.h" #include "storage/bufpage.h" #include "storage/relfilenode.h" #include "utils/relcache.h" typedef void *Block; /* Possible arguments for GetAccessStrategy() */ typedef enum BufferAccessStrategyType { BAS_NORMAL, /* Normal random access */ BAS_BULKREAD, /* Large read-only scan (hint bit updates are * ok) */ BAS_BULKWRITE, /* Large multi-block write (e.g. COPY IN) */ BAS_VACUUM /* VACUUM */ } BufferAccessStrategyType; /* Possible modes for ReadBufferExtended() */ typedef enum { RBM_NORMAL, /* Normal read */ RBM_DO_NOT_USE, /* This used to be RBM_ZERO. Only kept for * binary compatibility with 3rd party * extensions. */ RBM_ZERO_ON_ERROR, /* Read, but return an all-zeros page on error */ RBM_NORMAL_NO_LOG, /* Don't log page as invalid during WAL * replay; otherwise same as RBM_NORMAL */ RBM_ZERO_AND_LOCK, /* Don't read from disk, caller will * initialize. Also locks the page. */ RBM_ZERO_AND_CLEANUP_LOCK /* Like RBM_ZERO_AND_LOCK, but locks the page * in "cleanup" mode */ } ReadBufferMode; /* in globals.c ... this duplicates miscadmin.h */ extern PGDLLIMPORT int NBuffers; /* in bufmgr.c */ extern bool zero_damaged_pages; extern int bgwriter_lru_maxpages; extern double bgwriter_lru_multiplier; extern bool track_io_timing; extern int target_prefetch_pages; /* in buf_init.c */ extern PGDLLIMPORT char *BufferBlocks; extern PGDLLIMPORT int32 *PrivateRefCount; /* in localbuf.c */ extern PGDLLIMPORT int NLocBuffer; extern PGDLLIMPORT Block *LocalBufferBlockPointers; extern PGDLLIMPORT int32 *LocalRefCount; /* special block number for ReadBuffer() */ #define P_NEW InvalidBlockNumber /* grow the file to get a new page */ /* * Buffer content lock modes (mode argument for LockBuffer()) */ #define BUFFER_LOCK_UNLOCK 0 #define BUFFER_LOCK_SHARE 1 #define BUFFER_LOCK_EXCLUSIVE 2 /* * These routines are beaten on quite heavily, hence the macroization. */ /* * BufferIsValid * True iff the given buffer number is valid (either as a shared * or local buffer). * * Note: For a long time this was defined the same as BufferIsPinned, * that is it would say False if you didn't hold a pin on the buffer. * I believe this was bogus and served only to mask logic errors. * Code should always know whether it has a buffer reference, * independently of the pin state. * * Note: For a further long time this was not quite the inverse of the * BufferIsInvalid() macro, in that it also did sanity checks to verify * that the buffer number was in range. Most likely, this macro was * originally intended only to be used in assertions, but its use has * since expanded quite a bit, and the overhead of making those checks * even in non-assert-enabled builds can be significant. Thus, we've * now demoted the range checks to assertions within the macro itself. */ #define BufferIsValid(bufnum) \ ( \ AssertMacro((bufnum) <= NBuffers && (bufnum) >= -NLocBuffer), \ (bufnum) != InvalidBuffer \ ) /* * BufferIsPinned * True iff the buffer is pinned (also checks for valid buffer number). * * NOTE: what we check here is that *this* backend holds a pin on * the buffer. We do not care whether some other backend does. */ #define BufferIsPinned(bufnum) \ ( \ !BufferIsValid(bufnum) ? \ false \ : \ BufferIsLocal(bufnum) ? \ (LocalRefCount[-(bufnum) - 1] > 0) \ : \ (PrivateRefCount[(bufnum) - 1] > 0) \ ) /* * BufferGetBlock * Returns a reference to a disk page image associated with a buffer. * * Note: * Assumes buffer is valid. */ #define BufferGetBlock(buffer) \ ( \ AssertMacro(BufferIsValid(buffer)), \ BufferIsLocal(buffer) ? \ LocalBufferBlockPointers[-(buffer) - 1] \ : \ (Block) (BufferBlocks + ((Size) ((buffer) - 1)) * BLCKSZ) \ ) /* * BufferGetPageSize * Returns the page size within a buffer. * * Notes: * Assumes buffer is valid. * * The buffer can be a raw disk block and need not contain a valid * (formatted) disk page. */ /* XXX should dig out of buffer descriptor */ #define BufferGetPageSize(buffer) \ ( \ AssertMacro(BufferIsValid(buffer)), \ (Size)BLCKSZ \ ) /* * BufferGetPage * Returns the page associated with a buffer. */ #define BufferGetPage(buffer) ((Page)BufferGetBlock(buffer)) /* * prototypes for functions in bufmgr.c */ extern void PrefetchBuffer(Relation reln, ForkNumber forkNum, BlockNumber blockNum); extern Buffer ReadBuffer(Relation reln, BlockNumber blockNum); extern Buffer ReadBufferExtended(Relation reln, ForkNumber forkNum, BlockNumber blockNum, ReadBufferMode mode, BufferAccessStrategy strategy); extern Buffer ReadBufferWithoutRelcache(RelFileNode rnode, ForkNumber forkNum, BlockNumber blockNum, ReadBufferMode mode, BufferAccessStrategy strategy); extern void ReleaseBuffer(Buffer buffer); extern void UnlockReleaseBuffer(Buffer buffer); extern void MarkBufferDirty(Buffer buffer); extern void IncrBufferRefCount(Buffer buffer); extern Buffer ReleaseAndReadBuffer(Buffer buffer, Relation relation, BlockNumber blockNum); extern void InitBufferPool(void); extern void InitBufferPoolAccess(void); extern void InitBufferPoolBackend(void); extern void AtEOXact_Buffers(bool isCommit); extern void PrintBufferLeakWarning(Buffer buffer); extern void CheckPointBuffers(int flags); extern BlockNumber BufferGetBlockNumber(Buffer buffer); extern BlockNumber RelationGetNumberOfBlocksInFork(Relation relation, ForkNumber forkNum); extern void FlushOneBuffer(Buffer buffer); extern void FlushRelationBuffers(Relation rel); extern void FlushDatabaseBuffers(Oid dbid); extern void DropRelFileNodeBuffers(RelFileNodeBackend rnode, ForkNumber forkNum, BlockNumber firstDelBlock); extern void DropRelFileNodeAllBuffers(RelFileNodeBackend rnode); extern void DropDatabaseBuffers(Oid dbid); #define RelationGetNumberOfBlocks(reln) \ RelationGetNumberOfBlocksInFork(reln, MAIN_FORKNUM) extern bool BufferIsPermanent(Buffer buffer); #ifdef NOT_USED extern void PrintPinnedBufs(void); #endif extern Size BufferShmemSize(void); extern void BufferGetTag(Buffer buffer, RelFileNode *rnode, ForkNumber *forknum, BlockNumber *blknum); extern void SetBufferCommitInfoNeedsSave(Buffer buffer); extern void UnlockBuffers(void); extern void LockBuffer(Buffer buffer, int mode); extern bool ConditionalLockBuffer(Buffer buffer); extern void LockBufferForCleanup(Buffer buffer); extern bool ConditionalLockBufferForCleanup(Buffer buffer); extern bool HoldingBufferPinThatDelaysRecovery(void); extern void AbortBufferIO(void); extern void BufmgrCommit(void); extern bool BgBufferSync(void); extern void AtProcExit_LocalBuffers(void); /* in freelist.c */ extern BufferAccessStrategy GetAccessStrategy(BufferAccessStrategyType btype); extern void FreeAccessStrategy(BufferAccessStrategy strategy); #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/buf_internals.h����������������������������������������������������������������0000644�����������������00000017454�14763166026�0013676 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * buf_internals.h * Internal definitions for buffer manager and the buffer replacement * strategy. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/buf_internals.h * *------------------------------------------------------------------------- */ #ifndef BUFMGR_INTERNALS_H #define BUFMGR_INTERNALS_H #include "storage/buf.h" #include "storage/latch.h" #include "storage/lwlock.h" #include "storage/shmem.h" #include "storage/smgr.h" #include "storage/spin.h" #include "utils/relcache.h" /* * Flags for buffer descriptors * * Note: TAG_VALID essentially means that there is a buffer hashtable * entry associated with the buffer's tag. */ #define BM_DIRTY (1 << 0) /* data needs writing */ #define BM_VALID (1 << 1) /* data is valid */ #define BM_TAG_VALID (1 << 2) /* tag is assigned */ #define BM_IO_IN_PROGRESS (1 << 3) /* read or write in progress */ #define BM_IO_ERROR (1 << 4) /* previous I/O failed */ #define BM_JUST_DIRTIED (1 << 5) /* dirtied since write started */ #define BM_PIN_COUNT_WAITER (1 << 6) /* have waiter for sole pin */ #define BM_CHECKPOINT_NEEDED (1 << 7) /* must write for checkpoint */ #define BM_PERMANENT (1 << 8) /* permanent relation (not * unlogged, or init fork) */ typedef bits16 BufFlags; /* * The maximum allowed value of usage_count represents a tradeoff between * accuracy and speed of the clock-sweep buffer management algorithm. A * large value (comparable to NBuffers) would approximate LRU semantics. * But it can take as many as BM_MAX_USAGE_COUNT+1 complete cycles of * clock sweeps to find a free buffer, so in practice we don't want the * value to be very large. */ #define BM_MAX_USAGE_COUNT 5 /* * Buffer tag identifies which disk block the buffer contains. * * Note: the BufferTag data must be sufficient to determine where to write the * block, without reference to pg_class or pg_tablespace entries. It's * possible that the backend flushing the buffer doesn't even believe the * relation is visible yet (its xact may have started before the xact that * created the rel). The storage manager must be able to cope anyway. * * Note: if there's any pad bytes in the struct, INIT_BUFFERTAG will have * to be fixed to zero them, since this struct is used as a hash key. */ typedef struct buftag { RelFileNode rnode; /* physical relation identifier */ ForkNumber forkNum; BlockNumber blockNum; /* blknum relative to begin of reln */ } BufferTag; #define CLEAR_BUFFERTAG(a) \ ( \ (a).rnode.spcNode = InvalidOid, \ (a).rnode.dbNode = InvalidOid, \ (a).rnode.relNode = InvalidOid, \ (a).forkNum = InvalidForkNumber, \ (a).blockNum = InvalidBlockNumber \ ) #define INIT_BUFFERTAG(a,xx_rnode,xx_forkNum,xx_blockNum) \ ( \ (a).rnode = (xx_rnode), \ (a).forkNum = (xx_forkNum), \ (a).blockNum = (xx_blockNum) \ ) #define BUFFERTAGS_EQUAL(a,b) \ ( \ RelFileNodeEquals((a).rnode, (b).rnode) && \ (a).blockNum == (b).blockNum && \ (a).forkNum == (b).forkNum \ ) /* * The shared buffer mapping table is partitioned to reduce contention. * To determine which partition lock a given tag requires, compute the tag's * hash code with BufTableHashCode(), then apply BufMappingPartitionLock(). * NB: NUM_BUFFER_PARTITIONS must be a power of 2! */ #define BufTableHashPartition(hashcode) \ ((hashcode) % NUM_BUFFER_PARTITIONS) #define BufMappingPartitionLock(hashcode) \ ((LWLockId) (FirstBufMappingLock + BufTableHashPartition(hashcode))) /* * BufferDesc -- shared descriptor/state data for a single shared buffer. * * Note: buf_hdr_lock must be held to examine or change the tag, flags, * usage_count, refcount, or wait_backend_pid fields. buf_id field never * changes after initialization, so does not need locking. freeNext is * protected by the BufFreelistLock not buf_hdr_lock. The LWLocks can take * care of themselves. The buf_hdr_lock is *not* used to control access to * the data in the buffer! * * An exception is that if we have the buffer pinned, its tag can't change * underneath us, so we can examine the tag without locking the spinlock. * Also, in places we do one-time reads of the flags without bothering to * lock the spinlock; this is generally for situations where we don't expect * the flag bit being tested to be changing. * * We can't physically remove items from a disk page if another backend has * the buffer pinned. Hence, a backend may need to wait for all other pins * to go away. This is signaled by storing its own PID into * wait_backend_pid and setting flag bit BM_PIN_COUNT_WAITER. At present, * there can be only one such waiter per buffer. * * We use this same struct for local buffer headers, but the lock fields * are not used and not all of the flag bits are useful either. */ typedef struct sbufdesc { BufferTag tag; /* ID of page contained in buffer */ BufFlags flags; /* see bit definitions above */ uint16 usage_count; /* usage counter for clock sweep code */ unsigned refcount; /* # of backends holding pins on buffer */ int wait_backend_pid; /* backend PID of pin-count waiter */ slock_t buf_hdr_lock; /* protects the above fields */ int buf_id; /* buffer's index number (from 0) */ int freeNext; /* link in freelist chain */ LWLockId io_in_progress_lock; /* to wait for I/O to complete */ LWLockId content_lock; /* to lock access to buffer contents */ } BufferDesc; #define BufferDescriptorGetBuffer(bdesc) ((bdesc)->buf_id + 1) /* * The freeNext field is either the index of the next freelist entry, * or one of these special values: */ #define FREENEXT_END_OF_LIST (-1) #define FREENEXT_NOT_IN_LIST (-2) /* * Macros for acquiring/releasing a shared buffer header's spinlock. * Do not apply these to local buffers! * * Note: as a general coding rule, if you are using these then you probably * need to be using a volatile-qualified pointer to the buffer header, to * ensure that the compiler doesn't rearrange accesses to the header to * occur before or after the spinlock is acquired/released. */ #define LockBufHdr(bufHdr) SpinLockAcquire(&(bufHdr)->buf_hdr_lock) #define UnlockBufHdr(bufHdr) SpinLockRelease(&(bufHdr)->buf_hdr_lock) /* in buf_init.c */ extern PGDLLIMPORT BufferDesc *BufferDescriptors; /* in localbuf.c */ extern BufferDesc *LocalBufferDescriptors; /* * Internal routines: only called by bufmgr */ /* freelist.c */ extern volatile BufferDesc *StrategyGetBuffer(BufferAccessStrategy strategy, bool *lock_held); extern void StrategyFreeBuffer(volatile BufferDesc *buf); extern bool StrategyRejectBuffer(BufferAccessStrategy strategy, volatile BufferDesc *buf); extern int StrategySyncStart(uint32 *complete_passes, uint32 *num_buf_alloc); extern void StrategyNotifyBgWriter(Latch *bgwriterLatch); extern Size StrategyShmemSize(void); extern void StrategyInitialize(bool init); /* buf_table.c */ extern Size BufTableShmemSize(int size); extern void InitBufTable(int size); extern uint32 BufTableHashCode(BufferTag *tagPtr); extern int BufTableLookup(BufferTag *tagPtr, uint32 hashcode); extern int BufTableInsert(BufferTag *tagPtr, uint32 hashcode, int buf_id); extern void BufTableDelete(BufferTag *tagPtr, uint32 hashcode); /* localbuf.c */ extern void LocalPrefetchBuffer(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum); extern BufferDesc *LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum, bool *foundPtr); extern void MarkLocalBufferDirty(Buffer buffer); extern void DropRelFileNodeLocalBuffers(RelFileNode rnode, ForkNumber forkNum, BlockNumber firstDelBlock); extern void DropRelFileNodeAllLocalBuffers(RelFileNode rnode); extern void AtEOXact_LocalBuffers(bool isCommit); #endif /* BUFMGR_INTERNALS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/bufpage.h����������������������������������������������������������������������0000644�����������������00000031642�14763166026�0012447 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * bufpage.h * Standard POSTGRES buffer page definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/bufpage.h * *------------------------------------------------------------------------- */ #ifndef BUFPAGE_H #define BUFPAGE_H #include "access/xlogdefs.h" #include "storage/item.h" #include "storage/off.h" /* * A postgres disk page is an abstraction layered on top of a postgres * disk block (which is simply a unit of i/o, see block.h). * * specifically, while a disk block can be unformatted, a postgres * disk page is always a slotted page of the form: * * +----------------+---------------------------------+ * | PageHeaderData | linp1 linp2 linp3 ... | * +-----------+----+---------------------------------+ * | ... linpN | | * +-----------+--------------------------------------+ * | ^ pd_lower | * | | * | v pd_upper | * +-------------+------------------------------------+ * | | tupleN ... | * +-------------+------------------+-----------------+ * | ... tuple3 tuple2 tuple1 | "special space" | * +--------------------------------+-----------------+ * ^ pd_special * * a page is full when nothing can be added between pd_lower and * pd_upper. * * all blocks written out by an access method must be disk pages. * * EXCEPTIONS: * * obviously, a page is not formatted before it is initialized by * a call to PageInit. * * NOTES: * * linp1..N form an ItemId array. ItemPointers point into this array * rather than pointing directly to a tuple. Note that OffsetNumbers * conventionally start at 1, not 0. * * tuple1..N are added "backwards" on the page. because a tuple's * ItemPointer points to its ItemId entry rather than its actual * byte-offset position, tuples can be physically shuffled on a page * whenever the need arises. * * AM-generic per-page information is kept in PageHeaderData. * * AM-specific per-page data (if any) is kept in the area marked "special * space"; each AM has an "opaque" structure defined somewhere that is * stored as the page trailer. an access method should always * initialize its pages with PageInit and then set its own opaque * fields. */ typedef Pointer Page; /* * location (byte offset) within a page. * * note that this is actually limited to 2^15 because we have limited * ItemIdData.lp_off and ItemIdData.lp_len to 15 bits (see itemid.h). */ typedef uint16 LocationIndex; /* * disk page organization * * space management information generic to any page * * pd_lsn - identifies xlog record for last change to this page. * pd_tli - ditto. * pd_flags - flag bits. * pd_lower - offset to start of free space. * pd_upper - offset to end of free space. * pd_special - offset to start of special space. * pd_pagesize_version - size in bytes and page layout version number. * pd_prune_xid - oldest XID among potentially prunable tuples on page. * * The LSN is used by the buffer manager to enforce the basic rule of WAL: * "thou shalt write xlog before data". A dirty buffer cannot be dumped * to disk until xlog has been flushed at least as far as the page's LSN. * We also store the 16 least significant bits of the TLI for identification * purposes (it is not clear that this is actually necessary, but it seems * like a good idea). * * pd_prune_xid is a hint field that helps determine whether pruning will be * useful. It is currently unused in index pages. * * The page version number and page size are packed together into a single * uint16 field. This is for historical reasons: before PostgreSQL 7.3, * there was no concept of a page version number, and doing it this way * lets us pretend that pre-7.3 databases have page version number zero. * We constrain page sizes to be multiples of 256, leaving the low eight * bits available for a version number. * * Minimum possible page size is perhaps 64B to fit page header, opaque space * and a minimal tuple; of course, in reality you want it much bigger, so * the constraint on pagesize mod 256 is not an important restriction. * On the high end, we can only support pages up to 32KB because lp_off/lp_len * are 15 bits. */ typedef struct PageHeaderData { /* XXX LSN is member of *any* block, not only page-organized ones */ XLogRecPtr pd_lsn; /* LSN: next byte after last byte of xlog * record for last change to this page */ uint16 pd_tli; /* least significant bits of the TimeLineID * containing the LSN */ uint16 pd_flags; /* flag bits, see below */ LocationIndex pd_lower; /* offset to start of free space */ LocationIndex pd_upper; /* offset to end of free space */ LocationIndex pd_special; /* offset to start of special space */ uint16 pd_pagesize_version; TransactionId pd_prune_xid; /* oldest prunable XID, or zero if none */ ItemIdData pd_linp[1]; /* beginning of line pointer array */ } PageHeaderData; typedef PageHeaderData *PageHeader; /* * pd_flags contains the following flag bits. Undefined bits are initialized * to zero and may be used in the future. * * PD_HAS_FREE_LINES is set if there are any LP_UNUSED line pointers before * pd_lower. This should be considered a hint rather than the truth, since * changes to it are not WAL-logged. * * PD_PAGE_FULL is set if an UPDATE doesn't find enough free space in the * page for its new tuple version; this suggests that a prune is needed. * Again, this is just a hint. */ #define PD_HAS_FREE_LINES 0x0001 /* are there any unused line pointers? */ #define PD_PAGE_FULL 0x0002 /* not enough free space for new * tuple? */ #define PD_ALL_VISIBLE 0x0004 /* all tuples on page are visible to * everyone */ #define PD_VALID_FLAG_BITS 0x0007 /* OR of all valid pd_flags bits */ /* * Page layout version number 0 is for pre-7.3 Postgres releases. * Releases 7.3 and 7.4 use 1, denoting a new HeapTupleHeader layout. * Release 8.0 uses 2; it changed the HeapTupleHeader layout again. * Release 8.1 uses 3; it redefined HeapTupleHeader infomask bits. * Release 8.3 uses 4; it changed the HeapTupleHeader layout again, and * added the pd_flags field (by stealing some bits from pd_tli), * as well as adding the pd_prune_xid field (which enlarges the header). */ #define PG_PAGE_LAYOUT_VERSION 4 /* ---------------------------------------------------------------- * page support macros * ---------------------------------------------------------------- */ /* * PageIsValid * True iff page is valid. */ #define PageIsValid(page) PointerIsValid(page) /* * line pointer(s) do not count as part of header */ #define SizeOfPageHeaderData (offsetof(PageHeaderData, pd_linp)) /* * PageIsEmpty * returns true iff no itemid has been allocated on the page */ #define PageIsEmpty(page) \ (((PageHeader) (page))->pd_lower <= SizeOfPageHeaderData) /* * PageIsNew * returns true iff page has not been initialized (by PageInit) */ #define PageIsNew(page) (((PageHeader) (page))->pd_upper == 0) /* * PageGetItemId * Returns an item identifier of a page. */ #define PageGetItemId(page, offsetNumber) \ ((ItemId) (&((PageHeader) (page))->pd_linp[(offsetNumber) - 1])) /* * PageGetContents * To be used in case the page does not contain item pointers. * * Note: prior to 8.3 this was not guaranteed to yield a MAXALIGN'd result. * Now it is. Beware of old code that might think the offset to the contents * is just SizeOfPageHeaderData rather than MAXALIGN(SizeOfPageHeaderData). */ #define PageGetContents(page) \ ((char *) (page) + MAXALIGN(SizeOfPageHeaderData)) /* ---------------- * macros to access page size info * ---------------- */ /* * PageSizeIsValid * True iff the page size is valid. */ #define PageSizeIsValid(pageSize) ((pageSize) == BLCKSZ) /* * PageGetPageSize * Returns the page size of a page. * * this can only be called on a formatted page (unlike * BufferGetPageSize, which can be called on an unformatted page). * however, it can be called on a page that is not stored in a buffer. */ #define PageGetPageSize(page) \ ((Size) (((PageHeader) (page))->pd_pagesize_version & (uint16) 0xFF00)) /* * PageGetPageLayoutVersion * Returns the page layout version of a page. */ #define PageGetPageLayoutVersion(page) \ (((PageHeader) (page))->pd_pagesize_version & 0x00FF) /* * PageSetPageSizeAndVersion * Sets the page size and page layout version number of a page. * * We could support setting these two values separately, but there's * no real need for it at the moment. */ #define PageSetPageSizeAndVersion(page, size, version) \ ( \ AssertMacro(((size) & 0xFF00) == (size)), \ AssertMacro(((version) & 0x00FF) == (version)), \ ((PageHeader) (page))->pd_pagesize_version = (size) | (version) \ ) /* ---------------- * page special data macros * ---------------- */ /* * PageGetSpecialSize * Returns size of special space on a page. */ #define PageGetSpecialSize(page) \ ((uint16) (PageGetPageSize(page) - ((PageHeader)(page))->pd_special)) /* * PageGetSpecialPointer * Returns pointer to special space on a page. */ #define PageGetSpecialPointer(page) \ ( \ AssertMacro(PageIsValid(page)), \ (char *) ((char *) (page) + ((PageHeader) (page))->pd_special) \ ) /* * PageGetItem * Retrieves an item on the given page. * * Note: * This does not change the status of any of the resources passed. * The semantics may change in the future. */ #define PageGetItem(page, itemId) \ ( \ AssertMacro(PageIsValid(page)), \ AssertMacro(ItemIdHasStorage(itemId)), \ (Item)(((char *)(page)) + ItemIdGetOffset(itemId)) \ ) /* * PageGetMaxOffsetNumber * Returns the maximum offset number used by the given page. * Since offset numbers are 1-based, this is also the number * of items on the page. * * NOTE: if the page is not initialized (pd_lower == 0), we must * return zero to ensure sane behavior. Accept double evaluation * of the argument so that we can ensure this. */ #define PageGetMaxOffsetNumber(page) \ (((PageHeader) (page))->pd_lower <= SizeOfPageHeaderData ? 0 : \ ((((PageHeader) (page))->pd_lower - SizeOfPageHeaderData) \ / sizeof(ItemIdData))) /* * Additional macros for access to page headers */ #define PageGetLSN(page) \ (((PageHeader) (page))->pd_lsn) #define PageSetLSN(page, lsn) \ (((PageHeader) (page))->pd_lsn = (lsn)) /* NOTE: only the 16 least significant bits are stored */ #define PageGetTLI(page) \ (((PageHeader) (page))->pd_tli) #define PageSetTLI(page, tli) \ (((PageHeader) (page))->pd_tli = (uint16) (tli)) #define PageHasFreeLinePointers(page) \ (((PageHeader) (page))->pd_flags & PD_HAS_FREE_LINES) #define PageSetHasFreeLinePointers(page) \ (((PageHeader) (page))->pd_flags |= PD_HAS_FREE_LINES) #define PageClearHasFreeLinePointers(page) \ (((PageHeader) (page))->pd_flags &= ~PD_HAS_FREE_LINES) #define PageIsFull(page) \ (((PageHeader) (page))->pd_flags & PD_PAGE_FULL) #define PageSetFull(page) \ (((PageHeader) (page))->pd_flags |= PD_PAGE_FULL) #define PageClearFull(page) \ (((PageHeader) (page))->pd_flags &= ~PD_PAGE_FULL) #define PageIsAllVisible(page) \ (((PageHeader) (page))->pd_flags & PD_ALL_VISIBLE) #define PageSetAllVisible(page) \ (((PageHeader) (page))->pd_flags |= PD_ALL_VISIBLE) #define PageClearAllVisible(page) \ (((PageHeader) (page))->pd_flags &= ~PD_ALL_VISIBLE) #define PageIsPrunable(page, oldestxmin) \ ( \ AssertMacro(TransactionIdIsNormal(oldestxmin)), \ TransactionIdIsValid(((PageHeader) (page))->pd_prune_xid) && \ TransactionIdPrecedes(((PageHeader) (page))->pd_prune_xid, oldestxmin) \ ) #define PageSetPrunable(page, xid) \ do { \ Assert(TransactionIdIsNormal(xid)); \ if (!TransactionIdIsValid(((PageHeader) (page))->pd_prune_xid) || \ TransactionIdPrecedes(xid, ((PageHeader) (page))->pd_prune_xid)) \ ((PageHeader) (page))->pd_prune_xid = (xid); \ } while (0) #define PageClearPrunable(page) \ (((PageHeader) (page))->pd_prune_xid = InvalidTransactionId) /* ---------------------------------------------------------------- * extern declarations * ---------------------------------------------------------------- */ extern void PageInit(Page page, Size pageSize, Size specialSize); extern bool PageHeaderIsValid(PageHeader page); extern OffsetNumber PageAddItem(Page page, Item item, Size size, OffsetNumber offsetNumber, bool overwrite, bool is_heap); extern Page PageGetTempPage(Page page); extern Page PageGetTempPageCopy(Page page); extern Page PageGetTempPageCopySpecial(Page page); extern void PageRestoreTempPage(Page tempPage, Page oldPage); extern void PageRepairFragmentation(Page page); extern Size PageGetFreeSpace(Page page); extern Size PageGetExactFreeSpace(Page page); extern Size PageGetHeapFreeSpace(Page page); extern void PageIndexTupleDelete(Page page, OffsetNumber offset); extern void PageIndexMultiDelete(Page page, OffsetNumber *itemnos, int nitems); #endif /* BUFPAGE_H */ ����������������������������������������������������������������������������������������������pgsql/server/storage/large_object.h�����������������������������������������������������������������0000644�����������������00000005624�14763166026�0013457 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * large_object.h * Declarations for PostgreSQL large objects. POSTGRES 4.2 supported * zillions of large objects (internal, external, jaquith, inversion). * Now we only support inversion. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/large_object.h * *------------------------------------------------------------------------- */ #ifndef LARGE_OBJECT_H #define LARGE_OBJECT_H #include "utils/snapshot.h" /*---------- * Data about a currently-open large object. * * id is the logical OID of the large object * snapshot is the snapshot to use for read/write operations * subid is the subtransaction that opened the desc (or currently owns it) * offset is the current seek offset within the LO * flags contains some flag bits * * NOTE: before 7.1, we also had to store references to the separate table * and index of a specific large object. Now they all live in pg_largeobject * and are accessed via a common relation descriptor. *---------- */ typedef struct LargeObjectDesc { Oid id; /* LO's identifier */ Snapshot snapshot; /* snapshot to use */ SubTransactionId subid; /* owning subtransaction ID */ uint32 offset; /* current seek pointer */ int flags; /* locking info, etc */ /* flag bits: */ #define IFS_RDLOCK (1 << 0) #define IFS_WRLOCK (1 << 1) } LargeObjectDesc; /* * Each "page" (tuple) of a large object can hold this much data * * We could set this as high as BLCKSZ less some overhead, but it seems * better to make it a smaller value, so that not as much space is used * up when a page-tuple is updated. Note that the value is deliberately * chosen large enough to trigger the tuple toaster, so that we will * attempt to compress page tuples in-line. (But they won't be moved off * unless the user creates a toast-table for pg_largeobject...) * * Also, it seems to be a smart move to make the page size be a power of 2, * since clients will often be written to send data in power-of-2 blocks. * This avoids unnecessary tuple updates caused by partial-page writes. */ #define LOBLKSIZE (BLCKSZ / 4) /* * Function definitions... */ /* inversion stuff in inv_api.c */ extern void close_lo_relation(bool isCommit); extern Oid inv_create(Oid lobjId); extern LargeObjectDesc *inv_open(Oid lobjId, int flags, MemoryContext mcxt); extern void inv_close(LargeObjectDesc *obj_desc); extern int inv_drop(Oid lobjId); extern int inv_seek(LargeObjectDesc *obj_desc, int offset, int whence); extern int inv_tell(LargeObjectDesc *obj_desc); extern int inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes); extern int inv_write(LargeObjectDesc *obj_desc, const char *buf, int nbytes); extern void inv_truncate(LargeObjectDesc *obj_desc, int len); #endif /* LARGE_OBJECT_H */ ������������������������������������������������������������������������������������������������������������pgsql/server/storage/s_lock.h�����������������������������������������������������������������������0000644�����������������00000070003�14763166026�0012302 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * s_lock.h * Hardware-dependent implementation of spinlocks. * * NOTE: none of the macros in this file are intended to be called directly. * Call them through the hardware-independent macros in spin.h. * * The following hardware-dependent macros must be provided for each * supported platform: * * void S_INIT_LOCK(slock_t *lock) * Initialize a spinlock (to the unlocked state). * * void S_LOCK(slock_t *lock) * Acquire a spinlock, waiting if necessary. * Time out and abort() if unable to acquire the lock in a * "reasonable" amount of time --- typically ~ 1 minute. * * void S_UNLOCK(slock_t *lock) * Unlock a previously acquired lock. * * bool S_LOCK_FREE(slock_t *lock) * Tests if the lock is free. Returns TRUE if free, FALSE if locked. * This does *not* change the state of the lock. * * void SPIN_DELAY(void) * Delay operation to occur inside spinlock wait loop. * * Note to implementors: there are default implementations for all these * macros at the bottom of the file. Check if your platform can use * these or needs to override them. * * Usually, S_LOCK() is implemented in terms of even lower-level macros * TAS() and TAS_SPIN(): * * int TAS(slock_t *lock) * Atomic test-and-set instruction. Attempt to acquire the lock, * but do *not* wait. Returns 0 if successful, nonzero if unable * to acquire the lock. * * int TAS_SPIN(slock_t *lock) * Like TAS(), but this version is used when waiting for a lock * previously found to be contended. By default, this is the * same as TAS(), but on some architectures it's better to poll a * contended lock using an unlocked instruction and retry the * atomic test-and-set only when it appears free. * * TAS() and TAS_SPIN() are NOT part of the API, and should never be called * directly. * * CAUTION: on some platforms TAS() and/or TAS_SPIN() may sometimes report * failure to acquire a lock even when the lock is not locked. For example, * on Alpha TAS() will "fail" if interrupted. Therefore a retry loop must * always be used, even if you are certain the lock is free. * * Another caution for users of these macros is that it is the caller's * responsibility to ensure that the compiler doesn't re-order accesses * to shared memory to precede the actual lock acquisition, or follow the * lock release. Typically we handle this by using volatile-qualified * pointers to refer to both the spinlock itself and the shared data * structure being accessed within the spinlocked critical section. * That fixes it because compilers are not allowed to re-order accesses * to volatile objects relative to other such accesses. * * On platforms with weak memory ordering, the TAS(), TAS_SPIN(), and * S_UNLOCK() macros must further include hardware-level memory fence * instructions to prevent similar re-ordering at the hardware level. * TAS() and TAS_SPIN() must guarantee that loads and stores issued after * the macro are not executed until the lock has been obtained. Conversely, * S_UNLOCK() must guarantee that loads and stores issued before the macro * have been executed before the lock is released. * * On most supported platforms, TAS() uses a tas() function written * in assembly language to execute a hardware atomic-test-and-set * instruction. Equivalent OS-supplied mutex routines could be used too. * * If no system-specific TAS() is available (ie, HAVE_SPINLOCKS is not * defined), then we fall back on an emulation that uses SysV semaphores * (see spin.c). This emulation will be MUCH MUCH slower than a proper TAS() * implementation, because of the cost of a kernel call per lock or unlock. * An old report is that Postgres spends around 40% of its time in semop(2) * when using the SysV semaphore code. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/s_lock.h * *------------------------------------------------------------------------- */ #ifndef S_LOCK_H #define S_LOCK_H #ifdef HAVE_SPINLOCKS /* skip spinlocks if requested */ #if defined(__GNUC__) || defined(__INTEL_COMPILER) /************************************************************************* * All the gcc inlines * Gcc consistently defines the CPU as __cpu__. * Other compilers use __cpu or __cpu__ so we test for both in those cases. */ /*---------- * Standard gcc asm format (assuming "volatile slock_t *lock"): __asm__ __volatile__( " instruction \n" " instruction \n" " instruction \n" : "=r"(_res), "+m"(*lock) // return register, in/out lock value : "r"(lock) // lock pointer, in input register : "memory", "cc"); // show clobbered registers here * The output-operands list (after first colon) should always include * "+m"(*lock), whether or not the asm code actually refers to this * operand directly. This ensures that gcc believes the value in the * lock variable is used and set by the asm code. Also, the clobbers * list (after third colon) should always include "memory"; this prevents * gcc from thinking it can cache the values of shared-memory fields * across the asm code. Add "cc" if your asm code changes the condition * code register, and also list any temp registers the code uses. *---------- */ #ifdef __i386__ /* 32-bit i386 */ #define HAS_TEST_AND_SET typedef unsigned char slock_t; #define TAS(lock) tas(lock) static __inline__ int tas(volatile slock_t *lock) { register slock_t _res = 1; /* * Use a non-locking test before asserting the bus lock. Note that the * extra test appears to be a small loss on some x86 platforms and a small * win on others; it's by no means clear that we should keep it. */ __asm__ __volatile__( " cmpb $0,%1 \n" " jne 1f \n" " lock \n" " xchgb %0,%1 \n" "1: \n" : "+q"(_res), "+m"(*lock) : : "memory", "cc"); return (int) _res; } #define SPIN_DELAY() spin_delay() static __inline__ void spin_delay(void) { /* * This sequence is equivalent to the PAUSE instruction ("rep" is * ignored by old IA32 processors if the following instruction is * not a string operation); the IA-32 Architecture Software * Developer's Manual, Vol. 3, Section 7.7.2 describes why using * PAUSE in the inner loop of a spin lock is necessary for good * performance: * * The PAUSE instruction improves the performance of IA-32 * processors supporting Hyper-Threading Technology when * executing spin-wait loops and other routines where one * thread is accessing a shared lock or semaphore in a tight * polling loop. When executing a spin-wait loop, the * processor can suffer a severe performance penalty when * exiting the loop because it detects a possible memory order * violation and flushes the core processor's pipeline. The * PAUSE instruction provides a hint to the processor that the * code sequence is a spin-wait loop. The processor uses this * hint to avoid the memory order violation and prevent the * pipeline flush. In addition, the PAUSE instruction * de-pipelines the spin-wait loop to prevent it from * consuming execution resources excessively. */ __asm__ __volatile__( " rep; nop \n"); } #endif /* __i386__ */ #ifdef __x86_64__ /* AMD Opteron, Intel EM64T */ #define HAS_TEST_AND_SET typedef unsigned char slock_t; #define TAS(lock) tas(lock) static __inline__ int tas(volatile slock_t *lock) { register slock_t _res = 1; /* * On Opteron, using a non-locking test before the locking instruction * is a huge loss. On EM64T, it appears to be a wash or small loss, * so we needn't bother to try to distinguish the sub-architectures. */ __asm__ __volatile__( " lock \n" " xchgb %0,%1 \n" : "+q"(_res), "+m"(*lock) : : "memory", "cc"); return (int) _res; } #define SPIN_DELAY() spin_delay() static __inline__ void spin_delay(void) { /* * Adding a PAUSE in the spin delay loop is demonstrably a no-op on * Opteron, but it may be of some use on EM64T, so we keep it. */ __asm__ __volatile__( " rep; nop \n"); } #endif /* __x86_64__ */ #if defined(__ia64__) || defined(__ia64) /* * Intel Itanium, gcc or Intel's compiler. * * Itanium has weak memory ordering, but we rely on the compiler to enforce * strict ordering of accesses to volatile data. In particular, while the * xchg instruction implicitly acts as a memory barrier with 'acquire' * semantics, we do not have an explicit memory fence instruction in the * S_UNLOCK macro. We use a regular assignment to clear the spinlock, and * trust that the compiler marks the generated store instruction with the * ".rel" opcode. * * Testing shows that assumption to hold on gcc, although I could not find * any explicit statement on that in the gcc manual. In Intel's compiler, * the -m[no-]serialize-volatile option controls that, and testing shows that * it is enabled by default. */ #define HAS_TEST_AND_SET typedef unsigned int slock_t; #define TAS(lock) tas(lock) /* On IA64, it's a win to use a non-locking test before the xchg proper */ #define TAS_SPIN(lock) (*(lock) ? 1 : TAS(lock)) #ifndef __INTEL_COMPILER static __inline__ int tas(volatile slock_t *lock) { long int ret; __asm__ __volatile__( " xchg4 %0=%1,%2 \n" : "=r"(ret), "+m"(*lock) : "r"(1) : "memory"); return (int) ret; } #else /* __INTEL_COMPILER */ static __inline__ int tas(volatile slock_t *lock) { int ret; ret = _InterlockedExchange(lock,1); /* this is a xchg asm macro */ return ret; } #endif /* __INTEL_COMPILER */ #endif /* __ia64__ || __ia64 */ /* * On ARM, we use __sync_lock_test_and_set(int *, int) if available, and if * not fall back on the SWPB instruction. SWPB does not work on ARMv6 or * later, so the compiler builtin is preferred if available. Note also that * the int-width variant of the builtin works on more chips than other widths. */ #if defined(__arm__) || defined(__arm) #define HAS_TEST_AND_SET #define TAS(lock) tas(lock) #ifdef HAVE_GCC_INT_ATOMICS typedef int slock_t; static __inline__ int tas(volatile slock_t *lock) { return __sync_lock_test_and_set(lock, 1); } #define S_UNLOCK(lock) __sync_lock_release(lock) #else /* !HAVE_GCC_INT_ATOMICS */ typedef unsigned char slock_t; static __inline__ int tas(volatile slock_t *lock) { register slock_t _res = 1; __asm__ __volatile__( " swpb %0, %0, [%2] \n" : "+r"(_res), "+m"(*lock) : "r"(lock) : "memory"); return (int) _res; } #endif /* HAVE_GCC_INT_ATOMICS */ #endif /* __arm__ */ /* * On ARM64, we use __sync_lock_test_and_set(int *, int) if available. */ #if defined(__aarch64__) || defined(__aarch64) #ifdef HAVE_GCC_INT_ATOMICS #define HAS_TEST_AND_SET #define TAS(lock) tas(lock) typedef int slock_t; static __inline__ int tas(volatile slock_t *lock) { return __sync_lock_test_and_set(lock, 1); } #define S_UNLOCK(lock) __sync_lock_release(lock) #endif /* HAVE_GCC_INT_ATOMICS */ #endif /* __aarch64__ */ /* S/390 and S/390x Linux (32- and 64-bit zSeries) */ #if defined(__s390__) || defined(__s390x__) #define HAS_TEST_AND_SET typedef unsigned int slock_t; #define TAS(lock) tas(lock) static __inline__ int tas(volatile slock_t *lock) { int _res = 0; __asm__ __volatile__( " cs %0,%3,0(%2) \n" : "+d"(_res), "+m"(*lock) : "a"(lock), "d"(1) : "memory", "cc"); return _res; } #endif /* __s390__ || __s390x__ */ #if defined(__sparc__) /* Sparc */ /* * Solaris has always run sparc processors in TSO (total store) mode, but * linux didn't use to and the *BSDs still don't. So, be careful about * acquire/release semantics. The CPU will treat superflous membars as NOPs, * so it's just code space. */ #define HAS_TEST_AND_SET typedef unsigned char slock_t; #define TAS(lock) tas(lock) static __inline__ int tas(volatile slock_t *lock) { register slock_t _res; /* * See comment in /pg/backend/port/tas/solaris_sparc.s for why this * uses "ldstub", and that file uses "cas". gcc currently generates * sparcv7-targeted binaries, so "cas" use isn't possible. */ __asm__ __volatile__( " ldstub [%2], %0 \n" : "=r"(_res), "+m"(*lock) : "r"(lock) : "memory"); #if defined(__sparcv7) || defined(__sparc_v7__) /* * No stbar or membar available, luckily no actually produced hardware * requires a barrier. */ #elif defined(__sparcv8) || defined(__sparc_v8__) /* stbar is available (and required for both PSO, RMO), membar isn't */ __asm__ __volatile__ ("stbar \n":::"memory"); #else /* * #LoadStore (RMO) | #LoadLoad (RMO) together are the appropriate acquire * barrier for sparcv8+ upwards. */ __asm__ __volatile__ ("membar #LoadStore | #LoadLoad \n":::"memory"); #endif return (int) _res; } #if defined(__sparcv7) || defined(__sparc_v7__) /* * No stbar or membar available, luckily no actually produced hardware * requires a barrier. */ #define S_UNLOCK(lock) (*((volatile slock_t *) (lock)) = 0) #elif defined(__sparcv8) || defined(__sparc_v8__) /* stbar is available (and required for both PSO, RMO), membar isn't */ #define S_UNLOCK(lock) \ do \ { \ __asm__ __volatile__ ("stbar \n":::"memory"); \ *((volatile slock_t *) (lock)) = 0; \ } while (0) #else /* * #LoadStore (RMO) | #StoreStore (RMO, PSO) together are the appropriate * release barrier for sparcv8+ upwards. */ #define S_UNLOCK(lock) \ do \ { \ __asm__ __volatile__ ("membar #LoadStore | #StoreStore \n":::"memory"); \ *((volatile slock_t *) (lock)) = 0; \ } while (0) #endif #endif /* __sparc__ */ /* PowerPC */ #if defined(__ppc__) || defined(__powerpc__) || defined(__ppc64__) || defined(__powerpc64__) #define HAS_TEST_AND_SET typedef unsigned int slock_t; #define TAS(lock) tas(lock) /* On PPC, it's a win to use a non-locking test before the lwarx */ #define TAS_SPIN(lock) (*(lock) ? 1 : TAS(lock)) /* * NOTE: per the Enhanced PowerPC Architecture manual, v1.0 dated 7-May-2002, * an isync is a sufficient synchronization barrier after a lwarx/stwcx loop. * On newer machines, we can use lwsync instead for better performance. * * Ordinarily, we'd code the branches here using GNU-style local symbols, that * is "1f" referencing "1:" and so on. But some people run gcc on AIX with * IBM's assembler as backend, and IBM's assembler doesn't do local symbols. * So hand-code the branch offsets; fortunately, all PPC instructions are * exactly 4 bytes each, so it's not too hard to count. */ static __inline__ int tas(volatile slock_t *lock) { slock_t _t; int _res; __asm__ __volatile__( #ifdef USE_PPC_LWARX_MUTEX_HINT " lwarx %0,0,%3,1 \n" #else " lwarx %0,0,%3 \n" #endif " cmpwi %0,0 \n" " bne $+16 \n" /* branch to li %1,1 */ " addi %0,%0,1 \n" " stwcx. %0,0,%3 \n" " beq $+12 \n" /* branch to lwsync/isync */ " li %1,1 \n" " b $+12 \n" /* branch to end of asm sequence */ #ifdef USE_PPC_LWSYNC " lwsync \n" #else " isync \n" #endif " li %1,0 \n" : "=&r"(_t), "=r"(_res), "+m"(*lock) : "r"(lock) : "memory", "cc"); return _res; } /* * PowerPC S_UNLOCK is almost standard but requires a "sync" instruction. * On newer machines, we can use lwsync instead for better performance. */ #ifdef USE_PPC_LWSYNC #define S_UNLOCK(lock) \ do \ { \ __asm__ __volatile__ (" lwsync \n"); \ *((volatile slock_t *) (lock)) = 0; \ } while (0) #else #define S_UNLOCK(lock) \ do \ { \ __asm__ __volatile__ (" sync \n"); \ *((volatile slock_t *) (lock)) = 0; \ } while (0) #endif /* USE_PPC_LWSYNC */ #endif /* powerpc */ /* Linux Motorola 68k */ #if (defined(__mc68000__) || defined(__m68k__)) && defined(__linux__) #define HAS_TEST_AND_SET typedef unsigned char slock_t; #define TAS(lock) tas(lock) static __inline__ int tas(volatile slock_t *lock) { register int rv; __asm__ __volatile__( " clrl %0 \n" " tas %1 \n" " sne %0 \n" : "=d"(rv), "+m"(*lock) : : "memory", "cc"); return rv; } #endif /* (__mc68000__ || __m68k__) && __linux__ */ /* * VAXen -- even multiprocessor ones * (thanks to Tom Ivar Helbekkmo) */ #if defined(__vax__) #define HAS_TEST_AND_SET typedef unsigned char slock_t; #define TAS(lock) tas(lock) static __inline__ int tas(volatile slock_t *lock) { register int _res; __asm__ __volatile__( " movl $1, %0 \n" " bbssi $0, (%2), 1f \n" " clrl %0 \n" "1: \n" : "=&r"(_res), "+m"(*lock) : "r"(lock) : "memory"); return _res; } #endif /* __vax__ */ #if defined(__ns32k__) /* National Semiconductor 32K */ #define HAS_TEST_AND_SET typedef unsigned char slock_t; #define TAS(lock) tas(lock) static __inline__ int tas(volatile slock_t *lock) { register int _res; __asm__ __volatile__( " sbitb 0, %1 \n" " sfsd %0 \n" : "=r"(_res), "+m"(*lock) : : "memory"); return _res; } #endif /* __ns32k__ */ #if defined(__alpha) || defined(__alpha__) /* Alpha */ /* * Correct multi-processor locking methods are explained in section 5.5.3 * of the Alpha AXP Architecture Handbook, which at this writing can be * found at ftp://ftp.netbsd.org/pub/NetBSD/misc/dec-docs/index.html. * For gcc we implement the handbook's code directly with inline assembler. */ #define HAS_TEST_AND_SET typedef unsigned long slock_t; #define TAS(lock) tas(lock) static __inline__ int tas(volatile slock_t *lock) { register slock_t _res; __asm__ __volatile__( " ldq $0, %1 \n" " bne $0, 2f \n" " ldq_l %0, %1 \n" " bne %0, 2f \n" " mov 1, $0 \n" " stq_c $0, %1 \n" " beq $0, 2f \n" " mb \n" " br 3f \n" "2: mov 1, %0 \n" "3: \n" : "=&r"(_res), "+m"(*lock) : : "memory", "0"); return (int) _res; } #define S_UNLOCK(lock) \ do \ {\ __asm__ __volatile__ (" mb \n"); \ *((volatile slock_t *) (lock)) = 0; \ } while (0) #endif /* __alpha || __alpha__ */ #if defined(__mips__) && !defined(__sgi) /* non-SGI MIPS */ /* Note: on SGI we use the OS' mutex ABI, see below */ /* Note: R10000 processors require a separate SYNC */ #define HAS_TEST_AND_SET typedef unsigned int slock_t; #define TAS(lock) tas(lock) static __inline__ int tas(volatile slock_t *lock) { register volatile slock_t *_l = lock; register int _res; register int _tmp; __asm__ __volatile__( " .set push \n" " .set mips2 \n" " .set noreorder \n" " .set nomacro \n" " ll %0, %2 \n" " or %1, %0, 1 \n" " sc %1, %2 \n" " xori %1, 1 \n" " or %0, %0, %1 \n" " sync \n" " .set pop " : "=&r" (_res), "=&r" (_tmp), "+R" (*_l) : : "memory"); return _res; } /* MIPS S_UNLOCK is almost standard but requires a "sync" instruction */ #define S_UNLOCK(lock) \ do \ { \ __asm__ __volatile__( \ " .set push \n" \ " .set mips2 \n" \ " .set noreorder \n" \ " .set nomacro \n" \ " sync \n" \ " .set pop "); \ *((volatile slock_t *) (lock)) = 0; \ } while (0) #endif /* __mips__ && !__sgi */ #if defined(__m32r__) && defined(HAVE_SYS_TAS_H) /* Renesas' M32R */ #define HAS_TEST_AND_SET #include <sys/tas.h> typedef int slock_t; #define TAS(lock) tas(lock) #endif /* __m32r__ */ #if defined(__sh__) /* Renesas' SuperH */ #define HAS_TEST_AND_SET typedef unsigned char slock_t; #define TAS(lock) tas(lock) static __inline__ int tas(volatile slock_t *lock) { register int _res; /* * This asm is coded as if %0 could be any register, but actually SuperH * restricts the target of xor-immediate to be R0. That's handled by * the "z" constraint on _res. */ __asm__ __volatile__( " tas.b @%2 \n" " movt %0 \n" " xor #1,%0 \n" : "=z"(_res), "+m"(*lock) : "r"(lock) : "memory", "t"); return _res; } #endif /* __sh__ */ /* These live in s_lock.c, but only for gcc */ #if defined(__m68k__) && !defined(__linux__) /* non-Linux Motorola 68k */ #define HAS_TEST_AND_SET typedef unsigned char slock_t; #endif #endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */ /* * --------------------------------------------------------------------- * Platforms that use non-gcc inline assembly: * --------------------------------------------------------------------- */ #if !defined(HAS_TEST_AND_SET) /* We didn't trigger above, let's try here */ #if defined(USE_UNIVEL_CC) /* Unixware compiler */ #define HAS_TEST_AND_SET typedef unsigned char slock_t; #define TAS(lock) tas(lock) asm int tas(volatile slock_t *s_lock) { /* UNIVEL wants %mem in column 1, so we don't pg_indent this file */ %mem s_lock pushl %ebx movl s_lock, %ebx movl $255, %eax lock xchgb %al, (%ebx) popl %ebx } #endif /* defined(USE_UNIVEL_CC) */ #if defined(__alpha) || defined(__alpha__) /* Tru64 Unix Alpha compiler */ /* * The Tru64 compiler doesn't support gcc-style inline asm, but it does * have some builtin functions that accomplish much the same results. * For simplicity, slock_t is defined as long (ie, quadword) on Alpha * regardless of the compiler in use. LOCK_LONG and UNLOCK_LONG only * operate on an int (ie, longword), but that's OK as long as we define * S_INIT_LOCK to zero out the whole quadword. */ #define HAS_TEST_AND_SET typedef unsigned long slock_t; #include <alpha/builtins.h> #define S_INIT_LOCK(lock) (*(lock) = 0) #define TAS(lock) (__LOCK_LONG_RETRY((lock), 1) == 0) #define S_UNLOCK(lock) __UNLOCK_LONG(lock) #endif /* __alpha || __alpha__ */ #if defined(__hppa) || defined(__hppa__) /* HP PA-RISC, GCC and HP compilers */ /* * HP's PA-RISC * * See src/backend/port/hpux/tas.c.template for details about LDCWX. Because * LDCWX requires a 16-byte-aligned address, we declare slock_t as a 16-byte * struct. The active word in the struct is whichever has the aligned address; * the other three words just sit at -1. * * When using gcc, we can inline the required assembly code. */ #define HAS_TEST_AND_SET typedef struct { int sema[4]; } slock_t; #define TAS_ACTIVE_WORD(lock) ((volatile int *) (((uintptr_t) (lock) + 15) & ~15)) #if defined(__GNUC__) static __inline__ int tas(volatile slock_t *lock) { volatile int *lockword = TAS_ACTIVE_WORD(lock); register int lockval; __asm__ __volatile__( " ldcwx 0(0,%2),%0 \n" : "=r"(lockval), "+m"(*lockword) : "r"(lockword) : "memory"); return (lockval == 0); } #endif /* __GNUC__ */ #define S_UNLOCK(lock) (*TAS_ACTIVE_WORD(lock) = -1) #define S_INIT_LOCK(lock) \ do { \ volatile slock_t *lock_ = (lock); \ lock_->sema[0] = -1; \ lock_->sema[1] = -1; \ lock_->sema[2] = -1; \ lock_->sema[3] = -1; \ } while (0) #define S_LOCK_FREE(lock) (*TAS_ACTIVE_WORD(lock) != 0) #endif /* __hppa || __hppa__ */ #if defined(__hpux) && defined(__ia64) && !defined(__GNUC__) /* * HP-UX on Itanium, non-gcc compiler * * We assume that the compiler enforces strict ordering of loads/stores on * volatile data (see comments on the gcc-version earlier in this file). * Note that this assumption does *not* hold if you use the * +Ovolatile=__unordered option on the HP-UX compiler, so don't do that. * * See also Implementing Spinlocks on the Intel Itanium Architecture and * PA-RISC, by Tor Ekqvist and David Graves, for more information. As of * this writing, version 1.0 of the manual is available at: * http://h21007.www2.hp.com/portal/download/files/unprot/itanium/spinlocks.pdf */ #define HAS_TEST_AND_SET typedef unsigned int slock_t; #include <ia64/sys/inline.h> #define TAS(lock) _Asm_xchg(_SZ_W, lock, 1, _LDHINT_NONE) /* On IA64, it's a win to use a non-locking test before the xchg proper */ #define TAS_SPIN(lock) (*(lock) ? 1 : TAS(lock)) #endif /* HPUX on IA64, non gcc */ #if defined(__sgi) /* SGI compiler */ /* * SGI IRIX 5 * slock_t is defined as a unsigned long. We use the standard SGI * mutex API. * * The following comment is left for historical reasons, but is probably * not a good idea since the mutex ABI is supported. * * This stuff may be supplemented in the future with Masato Kataoka's MIPS-II * assembly from his NECEWS SVR4 port, but we probably ought to retain this * for the R3000 chips out there. */ #define HAS_TEST_AND_SET typedef unsigned long slock_t; #include "mutex.h" #define TAS(lock) (test_and_set(lock,1)) #define S_UNLOCK(lock) (test_then_and(lock,0)) #define S_INIT_LOCK(lock) (test_then_and(lock,0)) #define S_LOCK_FREE(lock) (test_then_add(lock,0) == 0) #endif /* __sgi */ #if defined(sinix) /* Sinix */ /* * SINIX / Reliant UNIX * slock_t is defined as a struct abilock_t, which has a single unsigned long * member. (Basically same as SGI) */ #define HAS_TEST_AND_SET #include "abi_mutex.h" typedef abilock_t slock_t; #define TAS(lock) (!acquire_lock(lock)) #define S_UNLOCK(lock) release_lock(lock) #define S_INIT_LOCK(lock) init_lock(lock) #define S_LOCK_FREE(lock) (stat_lock(lock) == UNLOCKED) #endif /* sinix */ #if defined(_AIX) /* AIX */ /* * AIX (POWER) */ #define HAS_TEST_AND_SET #include <sys/atomic_op.h> typedef int slock_t; #define TAS(lock) _check_lock((slock_t *) (lock), 0, 1) #define S_UNLOCK(lock) _clear_lock((slock_t *) (lock), 0) #endif /* _AIX */ /* These are in sunstudio_(sparc|x86).s */ #if defined(sun3) /* Sun3 */ #define HAS_TEST_AND_SET typedef unsigned char slock_t; #endif #if defined(__SUNPRO_C) && (defined(__i386) || defined(__x86_64__) || defined(__sparc__) || defined(__sparc)) #define HAS_TEST_AND_SET #if defined(__i386) || defined(__x86_64__) || defined(__sparcv9) || defined(__sparcv8plus) typedef unsigned int slock_t; #else typedef unsigned char slock_t; #endif extern slock_t pg_atomic_cas(volatile slock_t *lock, slock_t with, slock_t cmp); #define TAS(a) (pg_atomic_cas((a), 1, 0) != 0) #endif #ifdef WIN32_ONLY_COMPILER typedef LONG slock_t; #define HAS_TEST_AND_SET #define TAS(lock) (InterlockedCompareExchange(lock, 1, 0)) #define SPIN_DELAY() spin_delay() /* If using Visual C++ on Win64, inline assembly is unavailable. * Use a _mm_pause intrinsic instead of rep nop. */ #if defined(_WIN64) static __forceinline void spin_delay(void) { _mm_pause(); } #else static __forceinline void spin_delay(void) { /* See comment for gcc code. Same code, MASM syntax */ __asm rep nop; } #endif #endif #endif /* !defined(HAS_TEST_AND_SET) */ /* Blow up if we didn't have any way to do spinlocks */ #ifndef HAS_TEST_AND_SET #error PostgreSQL does not have native spinlock support on this platform. To continue the compilation, rerun configure using --disable-spinlocks. However, performance will be poor. Please report this to pgsql-bugs@postgresql.org. #endif #else /* !HAVE_SPINLOCKS */ /* * Fake spinlock implementation using semaphores --- slow and prone * to fall foul of kernel limits on number of semaphores, so don't use this * unless you must! The subroutines appear in spin.c. */ typedef int slock_t; extern bool s_lock_free_sema(volatile slock_t *lock); extern void s_unlock_sema(volatile slock_t *lock); extern void s_init_lock_sema(volatile slock_t *lock); extern int tas_sema(volatile slock_t *lock); #define S_LOCK_FREE(lock) s_lock_free_sema(lock) #define S_UNLOCK(lock) s_unlock_sema(lock) #define S_INIT_LOCK(lock) s_init_lock_sema(lock) #define TAS(lock) tas_sema(lock) #endif /* HAVE_SPINLOCKS */ /* * Default Definitions - override these above as needed. */ #if !defined(S_LOCK) #define S_LOCK(lock) \ do { \ if (TAS(lock)) \ s_lock((lock), __FILE__, __LINE__); \ } while (0) #endif /* S_LOCK */ #if !defined(S_LOCK_FREE) #define S_LOCK_FREE(lock) (*(lock) == 0) #endif /* S_LOCK_FREE */ #if !defined(S_UNLOCK) #define S_UNLOCK(lock) (*((volatile slock_t *) (lock)) = 0) #endif /* S_UNLOCK */ #if !defined(S_INIT_LOCK) #define S_INIT_LOCK(lock) S_UNLOCK(lock) #endif /* S_INIT_LOCK */ #if !defined(SPIN_DELAY) #define SPIN_DELAY() ((void) 0) #endif /* SPIN_DELAY */ #if !defined(TAS) extern int tas(volatile slock_t *lock); /* in port/.../tas.s, or * s_lock.c */ #define TAS(lock) tas(lock) #endif /* TAS */ #if !defined(TAS_SPIN) #define TAS_SPIN(lock) TAS(lock) #endif /* TAS_SPIN */ /* * Platform-independent out-of-line support routines */ extern void s_lock(volatile slock_t *lock, const char *file, int line); /* Support for dynamic adjustment of spins_per_delay */ #define DEFAULT_SPINS_PER_DELAY 100 extern void set_spins_per_delay(int shared_spins_per_delay); extern int update_spins_per_delay(int shared_spins_per_delay); #endif /* S_LOCK_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/standby.h����������������������������������������������������������������������0000644�����������������00000007743�14763166026�0012507 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * standby.h * Definitions for hot standby mode. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/standby.h * *------------------------------------------------------------------------- */ #ifndef STANDBY_H #define STANDBY_H #include "access/xlog.h" #include "storage/lock.h" #include "storage/procsignal.h" #include "storage/relfilenode.h" /* User-settable GUC parameters */ extern int vacuum_defer_cleanup_age; extern int max_standby_archive_delay; extern int max_standby_streaming_delay; extern void InitRecoveryTransactionEnvironment(void); extern void ShutdownRecoveryTransactionEnvironment(void); extern void ResolveRecoveryConflictWithSnapshot(TransactionId latestRemovedXid, RelFileNode node); extern void ResolveRecoveryConflictWithTablespace(Oid tsid); extern void ResolveRecoveryConflictWithDatabase(Oid dbid); extern void ResolveRecoveryConflictWithBufferPin(void); extern void SendRecoveryConflictWithBufferPin(ProcSignalReason reason); extern void CheckRecoveryConflictDeadlock(void); /* * Standby Rmgr (RM_STANDBY_ID) * * Standby recovery manager exists to perform actions that are required * to make hot standby work. That includes logging AccessExclusiveLocks taken * by transactions and running-xacts snapshots. */ extern void StandbyAcquireAccessExclusiveLock(TransactionId xid, Oid dbOid, Oid relOid); extern void StandbyReleaseLockTree(TransactionId xid, int nsubxids, TransactionId *subxids); extern void StandbyReleaseAllLocks(void); extern void StandbyReleaseOldLocks(int nxids, TransactionId *xids); /* * XLOG message types */ #define XLOG_STANDBY_LOCK 0x00 #define XLOG_RUNNING_XACTS 0x10 typedef struct xl_standby_locks { int nlocks; /* number of entries in locks array */ xl_standby_lock locks[1]; /* VARIABLE LENGTH ARRAY */ } xl_standby_locks; /* * When we write running xact data to WAL, we use this structure. */ typedef struct xl_running_xacts { int xcnt; /* # of xact ids in xids[] */ bool subxid_overflow; /* snapshot overflowed, subxids missing */ TransactionId nextXid; /* copy of ShmemVariableCache->nextXid */ TransactionId oldestRunningXid; /* *not* oldestXmin */ TransactionId latestCompletedXid; /* so we can set xmax */ TransactionId xids[1]; /* VARIABLE LENGTH ARRAY */ } xl_running_xacts; #define MinSizeOfXactRunningXacts offsetof(xl_running_xacts, xids) /* Recovery handlers for the Standby Rmgr (RM_STANDBY_ID) */ extern void standby_redo(XLogRecPtr lsn, XLogRecord *record); extern void standby_desc(StringInfo buf, uint8 xl_info, char *rec); /* * Declarations for GetRunningTransactionData(). Similar to Snapshots, but * not quite. This has nothing at all to do with visibility on this server, * so this is completely separate from snapmgr.c and snapmgr.h. * This data is important for creating the initial snapshot state on a * standby server. We need lots more information than a normal snapshot, * hence we use a specific data structure for our needs. This data * is written to WAL as a separate record immediately after each * checkpoint. That means that wherever we start a standby from we will * almost immediately see the data we need to begin executing queries. */ typedef struct RunningTransactionsData { int xcnt; /* # of xact ids in xids[] */ bool subxid_overflow; /* snapshot overflowed, subxids missing */ TransactionId nextXid; /* copy of ShmemVariableCache->nextXid */ TransactionId oldestRunningXid; /* *not* oldestXmin */ TransactionId latestCompletedXid; /* so we can set xmax */ TransactionId *xids; /* array of (sub)xids still running */ } RunningTransactionsData; typedef RunningTransactionsData *RunningTransactions; extern void LogAccessExclusiveLock(Oid dbOid, Oid relOid); extern void LogAccessExclusiveLockPrepare(void); extern void LogStandbySnapshot(void); #endif /* STANDBY_H */ �����������������������������pgsql/server/storage/latch.h������������������������������������������������������������������������0000644�����������������00000012433�14763166026�0012126 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * latch.h * Routines for interprocess latches * * A latch is a boolean variable, with operations that let processes sleep * until it is set. A latch can be set from another process, or a signal * handler within the same process. * * The latch interface is a reliable replacement for the common pattern of * using pg_usleep() or select() to wait until a signal arrives, where the * signal handler sets a flag variable. Because on some platforms an * incoming signal doesn't interrupt sleep, and even on platforms where it * does there is a race condition if the signal arrives just before * entering the sleep, the common pattern must periodically wake up and * poll the flag variable. The pselect() system call was invented to solve * this problem, but it is not portable enough. Latches are designed to * overcome these limitations, allowing you to sleep without polling and * ensuring quick response to signals from other processes. * * There are two kinds of latches: local and shared. A local latch is * initialized by InitLatch, and can only be set from the same process. * A local latch can be used to wait for a signal to arrive, by calling * SetLatch in the signal handler. A shared latch resides in shared memory, * and must be initialized at postmaster startup by InitSharedLatch. Before * a shared latch can be waited on, it must be associated with a process * with OwnLatch. Only the process owning the latch can wait on it, but any * process can set it. * * There are three basic operations on a latch: * * SetLatch - Sets the latch * ResetLatch - Clears the latch, allowing it to be set again * WaitLatch - Waits for the latch to become set * * WaitLatch includes a provision for timeouts (which should be avoided * when possible, as they incur extra overhead) and a provision for * postmaster child processes to wake up immediately on postmaster death. * See unix_latch.c for detailed specifications for the exported functions. * * The correct pattern to wait for event(s) is: * * for (;;) * { * ResetLatch(); * if (work to do) * Do Stuff(); * WaitLatch(); * } * * It's important to reset the latch *before* checking if there's work to * do. Otherwise, if someone sets the latch between the check and the * ResetLatch call, you will miss it and Wait will incorrectly block. * * To wake up the waiter, you must first set a global flag or something * else that the wait loop tests in the "if (work to do)" part, and call * SetLatch *after* that. SetLatch is designed to return quickly if the * latch is already set. * * Presently, when using a shared latch for interprocess signalling, the * flag variable(s) set by senders and inspected by the wait loop must * be protected by spinlocks or LWLocks, else it is possible to miss events * on machines with weak memory ordering (such as PPC). This restriction * will be lifted in future by inserting suitable memory barriers into * SetLatch and ResetLatch. * * On some platforms, signals will not interrupt the latch wait primitive * by themselves. Therefore, it is critical that any signal handler that * is meant to terminate a WaitLatch wait calls SetLatch. * * Note that use of the process latch (PGPROC.procLatch) is generally better * than an ad-hoc shared latch for signaling auxiliary processes. This is * because generic signal handlers will call SetLatch on the process latch * only, so using any latch other than the process latch effectively precludes * use of any generic handler. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/latch.h * *------------------------------------------------------------------------- */ #ifndef LATCH_H #define LATCH_H #include <signal.h> /* * Latch structure should be treated as opaque and only accessed through * the public functions. It is defined here to allow embedding Latches as * part of bigger structs. */ typedef struct { sig_atomic_t is_set; bool is_shared; int owner_pid; #ifdef WIN32 HANDLE event; #endif } Latch; /* Bitmasks for events that may wake-up WaitLatch() clients */ #define WL_LATCH_SET (1 << 0) #define WL_SOCKET_READABLE (1 << 1) #define WL_SOCKET_WRITEABLE (1 << 2) #define WL_TIMEOUT (1 << 3) #define WL_POSTMASTER_DEATH (1 << 4) /* * prototypes for functions in latch.c */ extern void InitializeLatchSupport(void); extern void InitLatch(volatile Latch *latch); extern void InitSharedLatch(volatile Latch *latch); extern void OwnLatch(volatile Latch *latch); extern void DisownLatch(volatile Latch *latch); extern int WaitLatch(volatile Latch *latch, int wakeEvents, long timeout); extern int WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock, long timeout); extern void SetLatch(volatile Latch *latch); extern void ResetLatch(volatile Latch *latch); /* beware of memory ordering issues if you use this macro! */ #define TestLatch(latch) (((volatile Latch *) (latch))->is_set) /* * Unix implementation uses SIGUSR1 for inter-process signaling. * Win32 doesn't need this. */ #ifndef WIN32 extern void latch_sigusr1_handler(void); #else #define latch_sigusr1_handler() ((void) 0) #endif #endif /* LATCH_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/sinval.h�����������������������������������������������������������������������0000644�����������������00000011743�14763166026�0012332 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * sinval.h * POSTGRES shared cache invalidation communication definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/sinval.h * *------------------------------------------------------------------------- */ #ifndef SINVAL_H #define SINVAL_H #include "storage/relfilenode.h" /* * We support several types of shared-invalidation messages: * * invalidate a specific tuple in a specific catcache * * invalidate all catcache entries from a given system catalog * * invalidate a relcache entry for a specific logical relation * * invalidate an smgr cache entry for a specific physical relation * * invalidate the mapped-relation mapping for a given database * More types could be added if needed. The message type is identified by * the first "int8" field of the message struct. Zero or positive means a * specific-catcache inval message (and also serves as the catcache ID field). * Negative values identify the other message types, as per codes below. * * Catcache inval events are initially driven by detecting tuple inserts, * updates and deletions in system catalogs (see CacheInvalidateHeapTuple). * An update can generate two inval events, one for the old tuple and one for * the new, but this is reduced to one event if the tuple's hash key doesn't * change. Note that the inval events themselves don't actually say whether * the tuple is being inserted or deleted. Also, since we transmit only a * hash key, there is a small risk of unnecessary invalidations due to chance * matches of hash keys. * * Note that some system catalogs have multiple caches on them (with different * indexes). On detecting a tuple invalidation in such a catalog, separate * catcache inval messages must be generated for each of its caches, since * the hash keys will generally be different. * * Catcache and relcache invalidations are transactional, and so are sent * to other backends upon commit. Internally to the generating backend, * they are also processed at CommandCounterIncrement so that later commands * in the same transaction see the new state. The generating backend also * has to process them at abort, to flush out any cache state it's loaded * from no-longer-valid entries. * * smgr and relation mapping invalidations are non-transactional: they are * sent immediately when the underlying file change is made. */ typedef struct { int8 id; /* cache ID --- must be first */ Oid dbId; /* database ID, or 0 if a shared relation */ uint32 hashValue; /* hash value of key for this catcache */ } SharedInvalCatcacheMsg; #define SHAREDINVALCATALOG_ID (-1) typedef struct { int8 id; /* type field --- must be first */ Oid dbId; /* database ID, or 0 if a shared catalog */ Oid catId; /* ID of catalog whose contents are invalid */ } SharedInvalCatalogMsg; #define SHAREDINVALRELCACHE_ID (-2) typedef struct { int8 id; /* type field --- must be first */ Oid dbId; /* database ID, or 0 if a shared relation */ Oid relId; /* relation ID */ } SharedInvalRelcacheMsg; #define SHAREDINVALSMGR_ID (-3) typedef struct { /* note: field layout chosen to pack into 16 bytes */ int8 id; /* type field --- must be first */ int8 backend_hi; /* high bits of backend ID, if temprel */ uint16 backend_lo; /* low bits of backend ID, if temprel */ RelFileNode rnode; /* spcNode, dbNode, relNode */ } SharedInvalSmgrMsg; #define SHAREDINVALRELMAP_ID (-4) typedef struct { int8 id; /* type field --- must be first */ Oid dbId; /* database ID, or 0 for shared catalogs */ } SharedInvalRelmapMsg; typedef union { int8 id; /* type field --- must be first */ SharedInvalCatcacheMsg cc; SharedInvalCatalogMsg cat; SharedInvalRelcacheMsg rc; SharedInvalSmgrMsg sm; SharedInvalRelmapMsg rm; } SharedInvalidationMessage; /* Counter of messages processed; don't worry about overflow. */ extern uint64 SharedInvalidMessageCounter; extern void SendSharedInvalidMessages(const SharedInvalidationMessage *msgs, int n); extern void ReceiveSharedInvalidMessages( void (*invalFunction) (SharedInvalidationMessage *msg), void (*resetFunction) (void)); /* signal handler for catchup events (PROCSIG_CATCHUP_INTERRUPT) */ extern void HandleCatchupInterrupt(void); /* * enable/disable processing of catchup events directly from signal handler. * The enable routine first performs processing of any catchup events that * have occurred since the last disable. */ extern void EnableCatchupInterrupt(void); extern bool DisableCatchupInterrupt(void); extern int xactGetCommittedInvalidationMessages(SharedInvalidationMessage **msgs, bool *RelcacheInitFileInval); extern void ProcessCommittedInvalidationMessages(SharedInvalidationMessage *msgs, int nmsgs, bool RelcacheInitFileInval, Oid dbid, Oid tsid); #endif /* SINVAL_H */ �����������������������������pgsql/server/storage/itemptr.h����������������������������������������������������������������������0000644�����������������00000007345�14763166026�0012525 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * itemptr.h * POSTGRES disk item pointer definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/itemptr.h * *------------------------------------------------------------------------- */ #ifndef ITEMPTR_H #define ITEMPTR_H #include "storage/block.h" #include "storage/off.h" /* * ItemPointer: * * This is a pointer to an item within a disk page of a known file * (for example, a cross-link from an index to its parent table). * blkid tells us which block, posid tells us which entry in the linp * (ItemIdData) array we want. * * Note: because there is an item pointer in each tuple header and index * tuple header on disk, it's very important not to waste space with * structure padding bytes. The struct is designed to be six bytes long * (it contains three int16 fields) but a few compilers will pad it to * eight bytes unless coerced. We apply appropriate persuasion where * possible, and to cope with unpersuadable compilers, we try to use * "SizeOfIptrData" rather than "sizeof(ItemPointerData)" when computing * on-disk sizes. */ typedef struct ItemPointerData { BlockIdData ip_blkid; OffsetNumber ip_posid; } #ifdef __arm__ __attribute__((packed)) /* Appropriate whack upside the head for ARM */ #endif ItemPointerData; #define SizeOfIptrData \ (offsetof(ItemPointerData, ip_posid) + sizeof(OffsetNumber)) typedef ItemPointerData *ItemPointer; /* ---------------- * support macros * ---------------- */ /* * ItemPointerIsValid * True iff the disk item pointer is not NULL. */ #define ItemPointerIsValid(pointer) \ ((bool) (PointerIsValid(pointer) && ((pointer)->ip_posid != 0))) /* * ItemPointerGetBlockNumber * Returns the block number of a disk item pointer. */ #define ItemPointerGetBlockNumber(pointer) \ ( \ AssertMacro(ItemPointerIsValid(pointer)), \ BlockIdGetBlockNumber(&(pointer)->ip_blkid) \ ) /* * ItemPointerGetOffsetNumber * Returns the offset number of a disk item pointer. */ #define ItemPointerGetOffsetNumber(pointer) \ ( \ AssertMacro(ItemPointerIsValid(pointer)), \ (pointer)->ip_posid \ ) /* * ItemPointerSet * Sets a disk item pointer to the specified block and offset. */ #define ItemPointerSet(pointer, blockNumber, offNum) \ ( \ AssertMacro(PointerIsValid(pointer)), \ BlockIdSet(&((pointer)->ip_blkid), blockNumber), \ (pointer)->ip_posid = offNum \ ) /* * ItemPointerSetBlockNumber * Sets a disk item pointer to the specified block. */ #define ItemPointerSetBlockNumber(pointer, blockNumber) \ ( \ AssertMacro(PointerIsValid(pointer)), \ BlockIdSet(&((pointer)->ip_blkid), blockNumber) \ ) /* * ItemPointerSetOffsetNumber * Sets a disk item pointer to the specified offset. */ #define ItemPointerSetOffsetNumber(pointer, offsetNumber) \ ( \ AssertMacro(PointerIsValid(pointer)), \ (pointer)->ip_posid = (offsetNumber) \ ) /* * ItemPointerCopy * Copies the contents of one disk item pointer to another. */ #define ItemPointerCopy(fromPointer, toPointer) \ ( \ AssertMacro(PointerIsValid(toPointer)), \ AssertMacro(PointerIsValid(fromPointer)), \ *(toPointer) = *(fromPointer) \ ) /* * ItemPointerSetInvalid * Sets a disk item pointer to be invalid. */ #define ItemPointerSetInvalid(pointer) \ ( \ AssertMacro(PointerIsValid(pointer)), \ BlockIdSet(&((pointer)->ip_blkid), InvalidBlockNumber), \ (pointer)->ip_posid = InvalidOffsetNumber \ ) /* ---------------- * externs * ---------------- */ extern bool ItemPointerEquals(ItemPointer pointer1, ItemPointer pointer2); extern int32 ItemPointerCompare(ItemPointer arg1, ItemPointer arg2); #endif /* ITEMPTR_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/smgr.h�������������������������������������������������������������������������0000644�����������������00000013255�14763166026�0012006 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * smgr.h * storage manager switch public interface declarations. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/smgr.h * *------------------------------------------------------------------------- */ #ifndef SMGR_H #define SMGR_H #include "fmgr.h" #include "storage/block.h" #include "storage/relfilenode.h" /* * smgr.c maintains a table of SMgrRelation objects, which are essentially * cached file handles. An SMgrRelation is created (if not already present) * by smgropen(), and destroyed by smgrclose(). Note that neither of these * operations imply I/O, they just create or destroy a hashtable entry. * (But smgrclose() may release associated resources, such as OS-level file * descriptors.) * * An SMgrRelation may have an "owner", which is just a pointer to it from * somewhere else; smgr.c will clear this pointer if the SMgrRelation is * closed. We use this to avoid dangling pointers from relcache to smgr * without having to make the smgr explicitly aware of relcache. There * can't be more than one "owner" pointer per SMgrRelation, but that's * all we need. * * SMgrRelations that do not have an "owner" are considered to be transient, * and are deleted at end of transaction. */ typedef struct SMgrRelationData { /* rnode is the hashtable lookup key, so it must be first! */ RelFileNodeBackend smgr_rnode; /* relation physical identifier */ /* pointer to owning pointer, or NULL if none */ struct SMgrRelationData **smgr_owner; /* * These next three fields are not actually used or manipulated by smgr, * except that they are reset to InvalidBlockNumber upon a cache flush * event (in particular, upon truncation of the relation). Higher levels * store cached state here so that it will be reset when truncation * happens. In all three cases, InvalidBlockNumber means "unknown". */ BlockNumber smgr_targblock; /* current insertion target block */ BlockNumber smgr_fsm_nblocks; /* last known size of fsm fork */ BlockNumber smgr_vm_nblocks; /* last known size of vm fork */ /* additional public fields may someday exist here */ /* * Fields below here are intended to be private to smgr.c and its * submodules. Do not touch them from elsewhere. */ int smgr_which; /* storage manager selector */ /* for md.c; NULL for forks that are not open */ struct _MdfdVec *md_fd[MAX_FORKNUM + 1]; /* if unowned, list link in list of all unowned SMgrRelations */ struct SMgrRelationData *next_unowned_reln; } SMgrRelationData; typedef SMgrRelationData *SMgrRelation; #define SmgrIsTemp(smgr) \ RelFileNodeBackendIsTemp((smgr)->smgr_rnode) extern void smgrinit(void); extern SMgrRelation smgropen(RelFileNode rnode, BackendId backend); extern bool smgrexists(SMgrRelation reln, ForkNumber forknum); extern void smgrsetowner(SMgrRelation *owner, SMgrRelation reln); extern void smgrclearowner(SMgrRelation *owner, SMgrRelation reln); extern void smgrclose(SMgrRelation reln); extern void smgrcloseall(void); extern void smgrclosenode(RelFileNodeBackend rnode); extern void smgrcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo); extern void smgrdounlink(SMgrRelation reln, bool isRedo); extern void smgrdounlinkfork(SMgrRelation reln, ForkNumber forknum, bool isRedo); extern void smgrextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, char *buffer, bool skipFsync); extern void smgrprefetch(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum); extern void smgrread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, char *buffer); extern void smgrwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, char *buffer, bool skipFsync); extern BlockNumber smgrnblocks(SMgrRelation reln, ForkNumber forknum); extern void smgrtruncate(SMgrRelation reln, ForkNumber forknum, BlockNumber nblocks); extern void smgrimmedsync(SMgrRelation reln, ForkNumber forknum); extern void smgrpreckpt(void); extern void smgrsync(void); extern void smgrpostckpt(void); extern void AtEOXact_SMgr(void); /* internals: move me elsewhere -- ay 7/94 */ /* in md.c */ extern void mdinit(void); extern void mdclose(SMgrRelation reln, ForkNumber forknum); extern void mdcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo); extern bool mdexists(SMgrRelation reln, ForkNumber forknum); extern void mdunlink(RelFileNodeBackend rnode, ForkNumber forknum, bool isRedo); extern void mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, char *buffer, bool skipFsync); extern void mdprefetch(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum); extern void mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, char *buffer); extern void mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, char *buffer, bool skipFsync); extern BlockNumber mdnblocks(SMgrRelation reln, ForkNumber forknum); extern void mdtruncate(SMgrRelation reln, ForkNumber forknum, BlockNumber nblocks); extern void mdimmedsync(SMgrRelation reln, ForkNumber forknum); extern void mdpreckpt(void); extern void mdsync(void); extern void mdpostckpt(void); extern void SetForwardFsyncRequests(void); extern void RememberFsyncRequest(RelFileNode rnode, ForkNumber forknum, BlockNumber segno); extern void ForgetRelationFsyncRequests(RelFileNode rnode, ForkNumber forknum); extern void ForgetDatabaseFsyncRequests(Oid dbid); /* smgrtype.c */ extern Datum smgrout(PG_FUNCTION_ARGS); extern Datum smgrin(PG_FUNCTION_ARGS); extern Datum smgreq(PG_FUNCTION_ARGS); extern Datum smgrne(PG_FUNCTION_ARGS); #endif /* SMGR_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/relfilenode.h������������������������������������������������������������������0000644�����������������00000010501�14763166026�0013315 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * relfilenode.h * Physical access information for relations. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/relfilenode.h * *------------------------------------------------------------------------- */ #ifndef RELFILENODE_H #define RELFILENODE_H #include "storage/backendid.h" /* * The physical storage of a relation consists of one or more forks. The * main fork is always created, but in addition to that there can be * additional forks for storing various metadata. ForkNumber is used when * we need to refer to a specific fork in a relation. */ typedef enum ForkNumber { InvalidForkNumber = -1, MAIN_FORKNUM = 0, FSM_FORKNUM, VISIBILITYMAP_FORKNUM, INIT_FORKNUM /* * NOTE: if you add a new fork, change MAX_FORKNUM below and update the * forkNames array in catalog.c */ } ForkNumber; #define MAX_FORKNUM INIT_FORKNUM /* * RelFileNode must provide all that we need to know to physically access * a relation, with the exception of the backend ID, which can be provided * separately. Note, however, that a "physical" relation is comprised of * multiple files on the filesystem, as each fork is stored as a separate * file, and each fork can be divided into multiple segments. See md.c. * * spcNode identifies the tablespace of the relation. It corresponds to * pg_tablespace.oid. * * dbNode identifies the database of the relation. It is zero for * "shared" relations (those common to all databases of a cluster). * Nonzero dbNode values correspond to pg_database.oid. * * relNode identifies the specific relation. relNode corresponds to * pg_class.relfilenode (NOT pg_class.oid, because we need to be able * to assign new physical files to relations in some situations). * Notice that relNode is only unique within a particular database. * * Note: spcNode must be GLOBALTABLESPACE_OID if and only if dbNode is * zero. We support shared relations only in the "global" tablespace. * * Note: in pg_class we allow reltablespace == 0 to denote that the * relation is stored in its database's "default" tablespace (as * identified by pg_database.dattablespace). However this shorthand * is NOT allowed in RelFileNode structs --- the real tablespace ID * must be supplied when setting spcNode. * * Note: in pg_class, relfilenode can be zero to denote that the relation * is a "mapped" relation, whose current true filenode number is available * from relmapper.c. Again, this case is NOT allowed in RelFileNodes. * * Note: various places use RelFileNode in hashtable keys. Therefore, * there *must not* be any unused padding bytes in this struct. That * should be safe as long as all the fields are of type Oid. */ typedef struct RelFileNode { Oid spcNode; /* tablespace */ Oid dbNode; /* database */ Oid relNode; /* relation */ } RelFileNode; /* * Augmenting a relfilenode with the backend ID provides all the information * we need to locate the physical storage. The backend ID is InvalidBackendId * for regular relations (those accessible to more than one backend), or the * owning backend's ID for backend-local relations. Backend-local relations * are always transient and removed in case of a database crash; they are * never WAL-logged or fsync'd. */ typedef struct RelFileNodeBackend { RelFileNode node; BackendId backend; } RelFileNodeBackend; #define RelFileNodeBackendIsTemp(rnode) \ ((rnode).backend != InvalidBackendId) /* * Note: RelFileNodeEquals and RelFileNodeBackendEquals compare relNode first * since that is most likely to be different in two unequal RelFileNodes. It * is probably redundant to compare spcNode if the other fields are found equal, * but do it anyway to be sure. Likewise for checking the backend ID in * RelFileNodeBackendEquals. */ #define RelFileNodeEquals(node1, node2) \ ((node1).relNode == (node2).relNode && \ (node1).dbNode == (node2).dbNode && \ (node1).spcNode == (node2).spcNode) #define RelFileNodeBackendEquals(node1, node2) \ ((node1).node.relNode == (node2).node.relNode && \ (node1).node.dbNode == (node2).node.dbNode && \ (node1).backend == (node2).backend && \ (node1).node.spcNode == (node2).node.spcNode) #endif /* RELFILENODE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/copydir.h����������������������������������������������������������������������0000644�����������������00000001061�14763166026�0012477 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * copydir.h * Copy a directory. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/copydir.h * *------------------------------------------------------------------------- */ #ifndef COPYDIR_H #define COPYDIR_H extern void copydir(char *fromdir, char *todir, bool recurse); extern void copy_file(char *fromfile, char *tofile); #endif /* COPYDIR_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/shmem.h������������������������������������������������������������������������0000644�����������������00000005206�14763166026�0012144 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * shmem.h * shared memory management structures * * Historical note: * A long time ago, Postgres' shared memory region was allowed to be mapped * at a different address in each process, and shared memory "pointers" were * passed around as offsets relative to the start of the shared memory region. * That is no longer the case: each process must map the shared memory region * at the same address. This means shared memory pointers can be passed * around directly between different processes. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/shmem.h * *------------------------------------------------------------------------- */ #ifndef SHMEM_H #define SHMEM_H #include "utils/hsearch.h" /* shmqueue.c */ typedef struct SHM_QUEUE { struct SHM_QUEUE *prev; struct SHM_QUEUE *next; } SHM_QUEUE; /* shmem.c */ extern void InitShmemAccess(void *seghdr); extern void InitShmemAllocation(void); extern void *ShmemAlloc(Size size); extern bool ShmemAddrIsValid(const void *addr); extern void InitShmemIndex(void); extern HTAB *ShmemInitHash(const char *name, long init_size, long max_size, HASHCTL *infoP, int hash_flags); extern void *ShmemInitStruct(const char *name, Size size, bool *foundPtr); extern Size add_size(Size s1, Size s2); extern Size mul_size(Size s1, Size s2); /* ipci.c */ extern void RequestAddinShmemSpace(Size size); /* size constants for the shmem index table */ /* max size of data structure string name */ #define SHMEM_INDEX_KEYSIZE (48) /* estimated size of the shmem index table (not a hard limit) */ #define SHMEM_INDEX_SIZE (64) /* this is a hash bucket in the shmem index table */ typedef struct { char key[SHMEM_INDEX_KEYSIZE]; /* string name */ void *location; /* location in shared mem */ Size size; /* # bytes allocated for the structure */ } ShmemIndexEnt; /* * prototypes for functions in shmqueue.c */ extern void SHMQueueInit(SHM_QUEUE *queue); extern void SHMQueueElemInit(SHM_QUEUE *queue); extern void SHMQueueDelete(SHM_QUEUE *queue); extern void SHMQueueInsertBefore(SHM_QUEUE *queue, SHM_QUEUE *elem); extern void SHMQueueInsertAfter(SHM_QUEUE *queue, SHM_QUEUE *elem); extern Pointer SHMQueueNext(const SHM_QUEUE *queue, const SHM_QUEUE *curElem, Size linkOffset); extern Pointer SHMQueuePrev(const SHM_QUEUE *queue, const SHM_QUEUE *curElem, Size linkOffset); extern bool SHMQueueEmpty(const SHM_QUEUE *queue); extern bool SHMQueueIsDetached(const SHM_QUEUE *queue); #endif /* SHMEM_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/lwlock.h�����������������������������������������������������������������������0000644�����������������00000007121�14763166026�0012324 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * lwlock.h * Lightweight lock manager * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/lwlock.h * *------------------------------------------------------------------------- */ #ifndef LWLOCK_H #define LWLOCK_H /* * It's a bit odd to declare NUM_BUFFER_PARTITIONS and NUM_LOCK_PARTITIONS * here, but we need them to set up enum LWLockId correctly, and having * this file include lock.h or bufmgr.h would be backwards. */ /* Number of partitions of the shared buffer mapping hashtable */ #define NUM_BUFFER_PARTITIONS 16 /* Number of partitions the shared lock tables are divided into */ #define LOG2_NUM_LOCK_PARTITIONS 4 #define NUM_LOCK_PARTITIONS (1 << LOG2_NUM_LOCK_PARTITIONS) /* Number of partitions the shared predicate lock tables are divided into */ #define LOG2_NUM_PREDICATELOCK_PARTITIONS 4 #define NUM_PREDICATELOCK_PARTITIONS (1 << LOG2_NUM_PREDICATELOCK_PARTITIONS) /* * We have a number of predefined LWLocks, plus a bunch of LWLocks that are * dynamically assigned (e.g., for shared buffers). The LWLock structures * live in shared memory (since they contain shared data) and are identified * by values of this enumerated type. We abuse the notion of an enum somewhat * by allowing values not listed in the enum declaration to be assigned. * The extra value MaxDynamicLWLock is there to keep the compiler from * deciding that the enum can be represented as char or short ... * * If you remove a lock, please replace it with a placeholder. This retains * the lock numbering, which is helpful for DTrace and other external * debugging scripts. */ typedef enum LWLockId { BufFreelistLock, ShmemIndexLock, OidGenLock, XidGenLock, ProcArrayLock, SInvalReadLock, SInvalWriteLock, WALInsertLock, WALWriteLock, ControlFileLock, CheckpointLock, CLogControlLock, SubtransControlLock, MultiXactGenLock, MultiXactOffsetControlLock, MultiXactMemberControlLock, RelCacheInitLock, CheckpointerCommLock, TwoPhaseStateLock, TablespaceCreateLock, BtreeVacuumLock, AddinShmemInitLock, AutovacuumLock, AutovacuumScheduleLock, SyncScanLock, RelationMappingLock, AsyncCtlLock, AsyncQueueLock, SerializableXactHashLock, SerializableFinishedListLock, SerializablePredicateLockListLock, OldSerXidLock, SyncRepLock, /* Individual lock IDs end here */ FirstBufMappingLock, FirstLockMgrLock = FirstBufMappingLock + NUM_BUFFER_PARTITIONS, FirstPredicateLockMgrLock = FirstLockMgrLock + NUM_LOCK_PARTITIONS, /* must be last except for MaxDynamicLWLock: */ NumFixedLWLocks = FirstPredicateLockMgrLock + NUM_PREDICATELOCK_PARTITIONS, MaxDynamicLWLock = 1000000000 } LWLockId; typedef enum LWLockMode { LW_EXCLUSIVE, LW_SHARED, LW_WAIT_UNTIL_FREE /* A special mode used in PGPROC->lwlockMode, * when waiting for lock to become free. Not * to be used as LWLockAcquire argument */ } LWLockMode; #ifdef LOCK_DEBUG extern bool Trace_lwlocks; #endif extern LWLockId LWLockAssign(void); extern void LWLockAcquire(LWLockId lockid, LWLockMode mode); extern bool LWLockConditionalAcquire(LWLockId lockid, LWLockMode mode); extern bool LWLockAcquireOrWait(LWLockId lockid, LWLockMode mode); extern void LWLockRelease(LWLockId lockid); extern void LWLockReleaseAll(void); extern bool LWLockHeldByMe(LWLockId lockid); extern int NumLWLocks(void); extern Size LWLockShmemSize(void); extern void CreateLWLocks(void); extern void RequestAddinLWLocks(int n); #endif /* LWLOCK_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/backendid.h��������������������������������������������������������������������0000644�����������������00000001332�14763166026�0012733 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * backendid.h * POSTGRES backend id communication definitions * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/backendid.h * *------------------------------------------------------------------------- */ #ifndef BACKENDID_H #define BACKENDID_H /* ---------------- * -cim 8/17/90 * ---------------- */ typedef int BackendId; /* unique currently active backend identifier */ #define InvalidBackendId (-1) extern PGDLLIMPORT BackendId MyBackendId; /* backend id of this backend */ #endif /* BACKENDID_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/buf.h��������������������������������������������������������������������������0000644�����������������00000002072�14763166026�0011605 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * buf.h * Basic buffer manager data types. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/buf.h * *------------------------------------------------------------------------- */ #ifndef BUF_H #define BUF_H /* * Buffer identifiers. * * Zero is invalid, positive is the index of a shared buffer (1..NBuffers), * negative is the index of a local buffer (-1 .. -NLocBuffer). */ typedef int Buffer; #define InvalidBuffer 0 /* * BufferIsInvalid * True iff the buffer is invalid. */ #define BufferIsInvalid(buffer) ((buffer) == InvalidBuffer) /* * BufferIsLocal * True iff the buffer is local (not visible to other backends). */ #define BufferIsLocal(buffer) ((buffer) < 0) /* * Buffer access strategy objects. * * BufferAccessStrategyData is private to freelist.c */ typedef struct BufferAccessStrategyData *BufferAccessStrategy; #endif /* BUF_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/barrier.h����������������������������������������������������������������������0000644�����������������00000015143�14763166026�0012462 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * barrier.h * Memory barrier operations. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/barrier.h * *------------------------------------------------------------------------- */ #ifndef BARRIER_H #define BARRIER_H #include "storage/s_lock.h" extern slock_t dummy_spinlock; /* * A compiler barrier need not (and preferably should not) emit any actual * machine code, but must act as an optimization fence: the compiler must not * reorder loads or stores to main memory around the barrier. However, the * CPU may still reorder loads or stores at runtime, if the architecture's * memory model permits this. * * A memory barrier must act as a compiler barrier, and in addition must * guarantee that all loads and stores issued prior to the barrier are * completed before any loads or stores issued after the barrier. Unless * loads and stores are totally ordered (which is not the case on most * architectures) this requires issuing some sort of memory fencing * instruction. * * A read barrier must act as a compiler barrier, and in addition must * guarantee that any loads issued prior to the barrier are completed before * any loads issued after the barrier. Similarly, a write barrier acts * as a compiler barrier, and also orders stores. Read and write barriers * are thus weaker than a full memory barrier, but stronger than a compiler * barrier. In practice, on machines with strong memory ordering, read and * write barriers may require nothing more than a compiler barrier. * * For an introduction to using memory barriers within the PostgreSQL backend, * see src/backend/storage/lmgr/README.barrier */ #if defined(DISABLE_BARRIERS) /* * Fall through to the spinlock-based implementation. */ #elif defined(__INTEL_COMPILER) /* * icc defines __GNUC__, but doesn't support gcc's inline asm syntax */ #if defined(__ia64__) || defined(__ia64) #define pg_memory_barrier() __mf() #elif defined(__i386__) || defined(__x86_64__) #define pg_memory_barrier() _mm_mfence() #endif #define pg_compiler_barrier() __memory_barrier() #elif defined(__GNUC__) /* This works on any architecture, since it's only talking to GCC itself. */ #define pg_compiler_barrier() __asm__ __volatile__("" : : : "memory") #if defined(__i386__) /* * i386 does not allow loads to be reordered with other loads, or stores to be * reordered with other stores, but a load can be performed before a subsequent * store. * * "lock; addl" has worked for longer than "mfence". */ #define pg_memory_barrier() \ __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory", "cc") #define pg_read_barrier() pg_compiler_barrier() #define pg_write_barrier() pg_compiler_barrier() #elif defined(__x86_64__) /* 64 bit x86 */ /* * x86_64 has similar ordering characteristics to i386. * * Technically, some x86-ish chips support uncached memory access and/or * special instructions that are weakly ordered. In those cases we'd need * the read and write barriers to be lfence and sfence. But since we don't * do those things, a compiler barrier should be enough. */ #define pg_memory_barrier() \ __asm__ __volatile__ ("lock; addl $0,0(%%rsp)" : : : "memory", "cc") #define pg_read_barrier() pg_compiler_barrier() #define pg_write_barrier() pg_compiler_barrier() #elif defined(__ia64__) || defined(__ia64) /* * Itanium is weakly ordered, so read and write barriers require a full * fence. */ #define pg_memory_barrier() __asm__ __volatile__ ("mf" : : : "memory") #elif defined(__ppc__) || defined(__powerpc__) || defined(__ppc64__) || defined(__powerpc64__) /* * lwsync orders loads with respect to each other, and similarly with stores. * But a load can be performed before a subsequent store, so sync must be used * for a full memory barrier. */ #define pg_memory_barrier() __asm__ __volatile__ ("sync" : : : "memory") #define pg_read_barrier() __asm__ __volatile__ ("lwsync" : : : "memory") #define pg_write_barrier() __asm__ __volatile__ ("lwsync" : : : "memory") #elif defined(__alpha) || defined(__alpha__) /* Alpha */ /* * Unlike all other known architectures, Alpha allows dependent reads to be * reordered, but we don't currently find it necessary to provide a conditional * read barrier to cover that case. We might need to add that later. */ #define pg_memory_barrier() __asm__ __volatile__ ("mb" : : : "memory") #define pg_read_barrier() __asm__ __volatile__ ("mb" : : : "memory") #define pg_write_barrier() __asm__ __volatile__ ("wmb" : : : "memory") #elif defined(__hppa) || defined(__hppa__) /* HP PA-RISC */ /* HPPA doesn't do either read or write reordering */ #define pg_memory_barrier() pg_compiler_barrier() #elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) /* * If we're on GCC 4.1.0 or higher, we should be able to get a memory * barrier out of this compiler built-in. But we prefer to rely on our * own definitions where possible, and use this only as a fallback. */ #define pg_memory_barrier() __sync_synchronize() #endif #elif defined(__ia64__) || defined(__ia64) #define pg_compiler_barrier() _Asm_sched_fence() #define pg_memory_barrier() _Asm_mf() #elif defined(WIN32_ONLY_COMPILER) /* Should work on both MSVC and Borland. */ #include <intrin.h> #pragma intrinsic(_ReadWriteBarrier) #define pg_compiler_barrier() _ReadWriteBarrier() #define pg_memory_barrier() MemoryBarrier() #endif /* * If we have no memory barrier implementation for this architecture, we * fall back to acquiring and releasing a spinlock. This might, in turn, * fall back to the semaphore-based spinlock implementation, which will be * amazingly slow. * * It's not self-evident that every possible legal implementation of a * spinlock acquire-and-release would be equivalent to a full memory barrier. * For example, I'm not sure that Itanium's acq and rel add up to a full * fence. But all of our actual implementations seem OK in this regard. */ #if !defined(pg_memory_barrier) #define pg_memory_barrier() \ do { S_LOCK(&dummy_spinlock); S_UNLOCK(&dummy_spinlock); } while (0) #endif /* * If read or write barriers are undefined, we upgrade them to full memory * barriers. * * If a compiler barrier is unavailable, you probably don't want a full * memory barrier instead, so if you have a use case for a compiler barrier, * you'd better use #ifdef. */ #if !defined(pg_read_barrier) #define pg_read_barrier() pg_memory_barrier() #endif #if !defined(pg_write_barrier) #define pg_write_barrier() pg_memory_barrier() #endif #endif /* BARRIER_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/sinvaladt.h��������������������������������������������������������������������0000644�����������������00000002763�14763166026�0013025 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * sinvaladt.h * POSTGRES shared cache invalidation data manager. * * The shared cache invalidation manager is responsible for transmitting * invalidation messages between backends. Any message sent by any backend * must be delivered to all already-running backends before it can be * forgotten. (If we run out of space, we instead deliver a "RESET" * message to backends that have fallen too far behind.) * * The struct type SharedInvalidationMessage, defining the contents of * a single message, is defined in sinval.h. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/sinvaladt.h * *------------------------------------------------------------------------- */ #ifndef SINVALADT_H #define SINVALADT_H #include "storage/proc.h" #include "storage/sinval.h" /* * prototypes for functions in sinvaladt.c */ extern Size SInvalShmemSize(void); extern void CreateSharedInvalidationState(void); extern void SharedInvalBackendInit(bool sendOnly); extern PGPROC *BackendIdGetProc(int backendID); extern void SIInsertDataEntries(const SharedInvalidationMessage *data, int n); extern int SIGetDataEntries(SharedInvalidationMessage *data, int datasize); extern void SICleanupQueue(bool callerHasWriteLock, int minFree); extern LocalTransactionId GetNextLocalTransactionId(void); #endif /* SINVALADT_H */ �������������pgsql/server/storage/itemid.h�����������������������������������������������������������������������0000644�����������������00000010366�14763166026�0012311 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * itemid.h * Standard POSTGRES buffer page item identifier definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/itemid.h * *------------------------------------------------------------------------- */ #ifndef ITEMID_H #define ITEMID_H /* * An item pointer (also called line pointer) on a buffer page * * In some cases an item pointer is "in use" but does not have any associated * storage on the page. By convention, lp_len == 0 in every item pointer * that does not have storage, independently of its lp_flags state. */ typedef struct ItemIdData { unsigned lp_off:15, /* offset to tuple (from start of page) */ lp_flags:2, /* state of item pointer, see below */ lp_len:15; /* byte length of tuple */ } ItemIdData; typedef ItemIdData *ItemId; /* * lp_flags has these possible states. An UNUSED line pointer is available * for immediate re-use, the other states are not. */ #define LP_UNUSED 0 /* unused (should always have lp_len=0) */ #define LP_NORMAL 1 /* used (should always have lp_len>0) */ #define LP_REDIRECT 2 /* HOT redirect (should have lp_len=0) */ #define LP_DEAD 3 /* dead, may or may not have storage */ /* * Item offsets and lengths are represented by these types when * they're not actually stored in an ItemIdData. */ typedef uint16 ItemOffset; typedef uint16 ItemLength; /* ---------------- * support macros * ---------------- */ /* * ItemIdGetLength */ #define ItemIdGetLength(itemId) \ ((itemId)->lp_len) /* * ItemIdGetOffset */ #define ItemIdGetOffset(itemId) \ ((itemId)->lp_off) /* * ItemIdGetFlags */ #define ItemIdGetFlags(itemId) \ ((itemId)->lp_flags) /* * ItemIdGetRedirect * In a REDIRECT pointer, lp_off holds the link to the next item pointer */ #define ItemIdGetRedirect(itemId) \ ((itemId)->lp_off) /* * ItemIdIsValid * True iff item identifier is valid. * This is a pretty weak test, probably useful only in Asserts. */ #define ItemIdIsValid(itemId) PointerIsValid(itemId) /* * ItemIdIsUsed * True iff item identifier is in use. */ #define ItemIdIsUsed(itemId) \ ((itemId)->lp_flags != LP_UNUSED) /* * ItemIdIsNormal * True iff item identifier is in state NORMAL. */ #define ItemIdIsNormal(itemId) \ ((itemId)->lp_flags == LP_NORMAL) /* * ItemIdIsRedirected * True iff item identifier is in state REDIRECT. */ #define ItemIdIsRedirected(itemId) \ ((itemId)->lp_flags == LP_REDIRECT) /* * ItemIdIsDead * True iff item identifier is in state DEAD. */ #define ItemIdIsDead(itemId) \ ((itemId)->lp_flags == LP_DEAD) /* * ItemIdHasStorage * True iff item identifier has associated storage. */ #define ItemIdHasStorage(itemId) \ ((itemId)->lp_len != 0) /* * ItemIdSetUnused * Set the item identifier to be UNUSED, with no storage. * Beware of multiple evaluations of itemId! */ #define ItemIdSetUnused(itemId) \ ( \ (itemId)->lp_flags = LP_UNUSED, \ (itemId)->lp_off = 0, \ (itemId)->lp_len = 0 \ ) /* * ItemIdSetNormal * Set the item identifier to be NORMAL, with the specified storage. * Beware of multiple evaluations of itemId! */ #define ItemIdSetNormal(itemId, off, len) \ ( \ (itemId)->lp_flags = LP_NORMAL, \ (itemId)->lp_off = (off), \ (itemId)->lp_len = (len) \ ) /* * ItemIdSetRedirect * Set the item identifier to be REDIRECT, with the specified link. * Beware of multiple evaluations of itemId! */ #define ItemIdSetRedirect(itemId, link) \ ( \ (itemId)->lp_flags = LP_REDIRECT, \ (itemId)->lp_off = (link), \ (itemId)->lp_len = 0 \ ) /* * ItemIdSetDead * Set the item identifier to be DEAD, with no storage. * Beware of multiple evaluations of itemId! */ #define ItemIdSetDead(itemId) \ ( \ (itemId)->lp_flags = LP_DEAD, \ (itemId)->lp_off = 0, \ (itemId)->lp_len = 0 \ ) /* * ItemIdMarkDead * Set the item identifier to be DEAD, keeping its existing storage. * * Note: in indexes, this is used as if it were a hint-bit mechanism; * we trust that multiple processors can do this in parallel and get * the same result. */ #define ItemIdMarkDead(itemId) \ ( \ (itemId)->lp_flags = LP_DEAD \ ) #endif /* ITEMID_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/pg_sema.h����������������������������������������������������������������������0000644�����������������00000004646�14763166026�0012455 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_sema.h * Platform-independent API for semaphores. * * PostgreSQL requires counting semaphores (the kind that keep track of * multiple unlock operations, and will allow an equal number of subsequent * lock operations before blocking). The underlying implementation is * not the same on every platform. This file defines the API that must * be provided by each port. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/pg_sema.h * *------------------------------------------------------------------------- */ #ifndef PG_SEMA_H #define PG_SEMA_H /* * PGSemaphoreData and pointer type PGSemaphore are the data structure * representing an individual semaphore. The contents of PGSemaphoreData * vary across implementations and must never be touched by platform- * independent code. PGSemaphoreData structures are always allocated * in shared memory (to support implementations where the data changes during * lock/unlock). * * pg_config.h must define exactly one of the USE_xxx_SEMAPHORES symbols. */ #ifdef USE_NAMED_POSIX_SEMAPHORES #include <semaphore.h> typedef sem_t *PGSemaphoreData; #endif #ifdef USE_UNNAMED_POSIX_SEMAPHORES #include <semaphore.h> typedef sem_t PGSemaphoreData; #endif #ifdef USE_SYSV_SEMAPHORES typedef struct PGSemaphoreData { int semId; /* semaphore set identifier */ int semNum; /* semaphore number within set */ } PGSemaphoreData; #endif #ifdef USE_WIN32_SEMAPHORES typedef HANDLE PGSemaphoreData; #endif typedef PGSemaphoreData *PGSemaphore; /* Module initialization (called during postmaster start or shmem reinit) */ extern void PGReserveSemaphores(int maxSemas, int port); /* Initialize a PGSemaphore structure to represent a sema with count 1 */ extern void PGSemaphoreCreate(PGSemaphore sema); /* Reset a previously-initialized PGSemaphore to have count 0 */ extern void PGSemaphoreReset(PGSemaphore sema); /* Lock a semaphore (decrement count), blocking if count would be < 0 */ extern void PGSemaphoreLock(PGSemaphore sema, bool interruptOK); /* Unlock a semaphore (increment count) */ extern void PGSemaphoreUnlock(PGSemaphore sema); /* Lock a semaphore only if able to do so without blocking */ extern bool PGSemaphoreTryLock(PGSemaphore sema); #endif /* PG_SEMA_H */ ������������������������������������������������������������������������������������������pgsql/server/storage/indexfsm.h���������������������������������������������������������������������0000644�����������������00000001433�14763166026�0012646 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * indexfsm.h * POSTGRES free space map for quickly finding an unused page in index * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/indexfsm.h * *------------------------------------------------------------------------- */ #ifndef INDEXFSM_H_ #define INDEXFSM_H_ #include "storage/block.h" #include "utils/relcache.h" extern BlockNumber GetFreeIndexPage(Relation rel); extern void RecordFreeIndexPage(Relation rel, BlockNumber page); extern void RecordUsedIndexPage(Relation rel, BlockNumber page); extern void IndexFreeSpaceMapVacuum(Relation rel); #endif /* INDEXFSM_H_ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/off.h��������������������������������������������������������������������������0000644�����������������00000003122�14763166026�0011600 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * off.h * POSTGRES disk "offset" definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/off.h * *------------------------------------------------------------------------- */ #ifndef OFF_H #define OFF_H #include "storage/itemid.h" /* * OffsetNumber: * * this is a 1-based index into the linp (ItemIdData) array in the * header of each disk page. */ typedef uint16 OffsetNumber; #define InvalidOffsetNumber ((OffsetNumber) 0) #define FirstOffsetNumber ((OffsetNumber) 1) #define MaxOffsetNumber ((OffsetNumber) (BLCKSZ / sizeof(ItemIdData))) #define OffsetNumberMask (0xffff) /* valid uint16 bits */ /* ---------------- * support macros * ---------------- */ /* * OffsetNumberIsValid * True iff the offset number is valid. */ #define OffsetNumberIsValid(offsetNumber) \ ((bool) ((offsetNumber != InvalidOffsetNumber) && \ (offsetNumber <= MaxOffsetNumber))) /* * OffsetNumberNext * OffsetNumberPrev * Increments/decrements the argument. These macros look pointless * but they help us disambiguate the different manipulations on * OffsetNumbers (e.g., sometimes we subtract one from an * OffsetNumber to move back, and sometimes we do so to form a * real C array index). */ #define OffsetNumberNext(offsetNumber) \ ((OffsetNumber) (1 + (offsetNumber))) #define OffsetNumberPrev(offsetNumber) \ ((OffsetNumber) (-1 + (offsetNumber))) #endif /* OFF_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/reinit.h�����������������������������������������������������������������������0000644�����������������00000001114�14763166026�0012317 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * reinit.h * Reinitialization of unlogged relations * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/fd.h * *------------------------------------------------------------------------- */ #ifndef REINIT_H #define REINIT_H extern void ResetUnloggedRelations(int op); #define UNLOGGED_RELATION_CLEANUP 0x0001 #define UNLOGGED_RELATION_INIT 0x0002 #endif /* REINIT_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/freespace.h��������������������������������������������������������������������0000644�����������������00000002360�14763166026�0012766 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * freespace.h * POSTGRES free space map for quickly finding free space in relations * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/freespace.h * *------------------------------------------------------------------------- */ #ifndef FREESPACE_H_ #define FREESPACE_H_ #include "storage/block.h" #include "storage/relfilenode.h" #include "utils/relcache.h" /* prototypes for public functions in freespace.c */ extern Size GetRecordedFreeSpace(Relation rel, BlockNumber heapBlk); extern BlockNumber GetPageWithFreeSpace(Relation rel, Size spaceNeeded); extern BlockNumber RecordAndGetPageWithFreeSpace(Relation rel, BlockNumber oldPage, Size oldSpaceAvail, Size spaceNeeded); extern void RecordPageWithFreeSpace(Relation rel, BlockNumber heapBlk, Size spaceAvail); extern void XLogRecordPageWithFreeSpace(RelFileNode rnode, BlockNumber heapBlk, Size spaceAvail); extern void FreeSpaceMapTruncateRel(Relation rel, BlockNumber nblocks); extern void FreeSpaceMapVacuum(Relation rel); #endif /* FREESPACE_H_ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/proc.h�������������������������������������������������������������������������0000644�����������������00000023115�14763166026�0011775 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * proc.h * per-process shared memory data structures * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/proc.h * *------------------------------------------------------------------------- */ #ifndef _PROC_H_ #define _PROC_H_ #include "access/xlog.h" #include "datatype/timestamp.h" #include "storage/latch.h" #include "storage/lock.h" #include "storage/pg_sema.h" /* * Each backend advertises up to PGPROC_MAX_CACHED_SUBXIDS TransactionIds * for non-aborted subtransactions of its current top transaction. These * have to be treated as running XIDs by other backends. * * We also keep track of whether the cache overflowed (ie, the transaction has * generated at least one subtransaction that didn't fit in the cache). * If none of the caches have overflowed, we can assume that an XID that's not * listed anywhere in the PGPROC array is not a running transaction. Else we * have to look at pg_subtrans. */ #define PGPROC_MAX_CACHED_SUBXIDS 64 /* XXX guessed-at value */ struct XidCache { TransactionId xids[PGPROC_MAX_CACHED_SUBXIDS]; }; /* Flags for PGXACT->vacuumFlags */ #define PROC_IS_AUTOVACUUM 0x01 /* is it an autovac worker? */ #define PROC_IN_VACUUM 0x02 /* currently running lazy vacuum */ #define PROC_IN_ANALYZE 0x04 /* currently running analyze */ #define PROC_VACUUM_FOR_WRAPAROUND 0x08 /* set by autovac only */ /* flags reset at EOXact */ #define PROC_VACUUM_STATE_MASK (0x0E) /* * We allow a small number of "weak" relation locks (AccesShareLock, * RowShareLock, RowExclusiveLock) to be recorded in the PGPROC structure * rather than the main lock table. This eases contention on the lock * manager LWLocks. See storage/lmgr/README for additional details. */ #define FP_LOCK_SLOTS_PER_BACKEND 16 /* * Each backend has a PGPROC struct in shared memory. There is also a list of * currently-unused PGPROC structs that will be reallocated to new backends. * * links: list link for any list the PGPROC is in. When waiting for a lock, * the PGPROC is linked into that lock's waitProcs queue. A recycled PGPROC * is linked into ProcGlobal's freeProcs list. * * Note: twophase.c also sets up a dummy PGPROC struct for each currently * prepared transaction. These PGPROCs appear in the ProcArray data structure * so that the prepared transactions appear to be still running and are * correctly shown as holding locks. A prepared transaction PGPROC can be * distinguished from a real one at need by the fact that it has pid == 0. * The semaphore and lock-activity fields in a prepared-xact PGPROC are unused, * but its myProcLocks[] lists are valid. */ struct PGPROC { /* proc->links MUST BE FIRST IN STRUCT (see ProcSleep,ProcWakeup,etc) */ SHM_QUEUE links; /* list link if process is in a list */ PGSemaphoreData sem; /* ONE semaphore to sleep on */ int waitStatus; /* STATUS_WAITING, STATUS_OK or STATUS_ERROR */ Latch procLatch; /* generic latch for process */ LocalTransactionId lxid; /* local id of top-level transaction currently * being executed by this proc, if running; * else InvalidLocalTransactionId */ int pid; /* Backend's process ID; 0 if prepared xact */ int pgprocno; /* These fields are zero while a backend is still starting up: */ BackendId backendId; /* This backend's backend ID (if assigned) */ Oid databaseId; /* OID of database this backend is using */ Oid roleId; /* OID of role using this backend */ /* * While in hot standby mode, shows that a conflict signal has been sent * for the current transaction. Set/cleared while holding ProcArrayLock, * though not required. Accessed without lock, if needed. */ bool recoveryConflictPending; /* Info about LWLock the process is currently waiting for, if any. */ bool lwWaiting; /* true if waiting for an LW lock */ uint8 lwWaitMode; /* lwlock mode being waited for */ struct PGPROC *lwWaitLink; /* next waiter for same LW lock */ /* Info about lock the process is currently waiting for, if any. */ /* waitLock and waitProcLock are NULL if not currently waiting. */ LOCK *waitLock; /* Lock object we're sleeping on ... */ PROCLOCK *waitProcLock; /* Per-holder info for awaited lock */ LOCKMODE waitLockMode; /* type of lock we're waiting for */ LOCKMASK heldLocks; /* bitmask for lock types already held on this * lock object by this backend */ /* * Info to allow us to wait for synchronous replication, if needed. * waitLSN is InvalidXLogRecPtr if not waiting; set only by user backend. * syncRepState must not be touched except by owning process or WALSender. * syncRepLinks used only while holding SyncRepLock. */ XLogRecPtr waitLSN; /* waiting for this LSN or higher */ int syncRepState; /* wait state for sync rep */ SHM_QUEUE syncRepLinks; /* list link if process is in syncrep queue */ /* * All PROCLOCK objects for locks held or awaited by this backend are * linked into one of these lists, according to the partition number of * their lock. */ SHM_QUEUE myProcLocks[NUM_LOCK_PARTITIONS]; struct XidCache subxids; /* cache for subtransaction XIDs */ /* Per-backend LWLock. Protects fields below. */ LWLockId backendLock; /* protects the fields below */ /* Lock manager data, recording fast-path locks taken by this backend. */ uint64 fpLockBits; /* lock modes held for each fast-path slot */ Oid fpRelId[FP_LOCK_SLOTS_PER_BACKEND]; /* slots for rel oids */ bool fpVXIDLock; /* are we holding a fast-path VXID lock? */ LocalTransactionId fpLocalTransactionId; /* lxid for fast-path VXID * lock */ }; /* NOTE: "typedef struct PGPROC PGPROC" appears in storage/lock.h. */ extern PGDLLIMPORT PGPROC *MyProc; extern PGDLLIMPORT struct PGXACT *MyPgXact; /* * Prior to PostgreSQL 9.2, the fields below were stored as part of the * PGPROC. However, benchmarking revealed that packing these particular * members into a separate array as tightly as possible sped up GetSnapshotData * considerably on systems with many CPU cores, by reducing the number of * cache lines needing to be fetched. Thus, think very carefully before adding * anything else here. */ typedef struct PGXACT { TransactionId xid; /* id of top-level transaction currently being * executed by this proc, if running and XID * is assigned; else InvalidTransactionId */ TransactionId xmin; /* minimal running XID as it was when we were * starting our xact, excluding LAZY VACUUM: * vacuum must not remove tuples deleted by * xid >= xmin ! */ uint8 vacuumFlags; /* vacuum-related flags, see above */ bool overflowed; bool inCommit; /* true if within commit critical section */ uint8 nxids; } PGXACT; /* * There is one ProcGlobal struct for the whole database cluster. */ typedef struct PROC_HDR { /* Array of PGPROC structures (not including dummies for prepared txns) */ PGPROC *allProcs; /* Array of PGXACT structures (not including dummies for prepared txns) */ PGXACT *allPgXact; /* Length of allProcs array */ uint32 allProcCount; /* Head of list of free PGPROC structures */ PGPROC *freeProcs; /* Head of list of autovacuum's free PGPROC structures */ PGPROC *autovacFreeProcs; /* WALWriter process's latch */ Latch *walwriterLatch; /* Checkpointer process's latch */ Latch *checkpointerLatch; /* Current shared estimate of appropriate spins_per_delay value */ int spins_per_delay; /* The proc of the Startup process, since not in ProcArray */ PGPROC *startupProc; int startupProcPid; /* Buffer id of the buffer that Startup process waits for pin on, or -1 */ int startupBufferPinWaitBufId; } PROC_HDR; extern PROC_HDR *ProcGlobal; extern PGPROC *PreparedXactProcs; /* * We set aside some extra PGPROC structures for auxiliary processes, * ie things that aren't full-fledged backends but need shmem access. * * Background writer, checkpointer and WAL writer run during normal operation. * Startup process and WAL receiver also consume 2 slots, but WAL writer is * launched only after startup has exited, so we only need 4 slots. */ #define NUM_AUXILIARY_PROCS 4 /* configurable options */ extern int DeadlockTimeout; extern int StatementTimeout; extern bool log_lock_waits; extern volatile bool cancel_from_timeout; /* * Function Prototypes */ extern int ProcGlobalSemas(void); extern Size ProcGlobalShmemSize(void); extern void InitProcGlobal(void); extern void InitProcess(void); extern void InitProcessPhase2(void); extern void InitAuxiliaryProcess(void); extern void PublishStartupProcessInformation(void); extern void SetStartupBufferPinWaitBufId(int bufid); extern int GetStartupBufferPinWaitBufId(void); extern bool HaveNFreeProcs(int n); extern void ProcReleaseLocks(bool isCommit); extern void ProcQueueInit(PROC_QUEUE *queue); extern int ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable); extern PGPROC *ProcWakeup(PGPROC *proc, int waitStatus); extern void ProcLockWakeup(LockMethod lockMethodTable, LOCK *lock); extern bool IsWaitingForLock(void); extern void LockErrorCleanup(void); extern void ProcWaitForSignal(void); extern void ProcSendSignal(int pid); extern bool enable_sig_alarm(int delayms, bool is_statement_timeout); extern bool disable_sig_alarm(bool is_statement_timeout); extern void handle_sig_alarm(SIGNAL_ARGS); extern bool enable_standby_sig_alarm(TimestampTz now, TimestampTz fin_time, bool deadlock_only); extern bool disable_standby_sig_alarm(void); extern void handle_standby_sig_alarm(SIGNAL_ARGS); #endif /* PROC_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/pmsignal.h���������������������������������������������������������������������0000644�����������������00000004040�14763166026�0012640 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pmsignal.h * routines for signaling the postmaster from its child processes * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/pmsignal.h * *------------------------------------------------------------------------- */ #ifndef PMSIGNAL_H #define PMSIGNAL_H /* * Reasons for signaling the postmaster. We can cope with simultaneous * signals for different reasons. If the same reason is signaled multiple * times in quick succession, however, the postmaster is likely to observe * only one notification of it. This is okay for the present uses. */ typedef enum { PMSIGNAL_RECOVERY_STARTED, /* recovery has started */ PMSIGNAL_BEGIN_HOT_STANDBY, /* begin Hot Standby */ PMSIGNAL_WAKEN_ARCHIVER, /* send a NOTIFY signal to xlog archiver */ PMSIGNAL_ROTATE_LOGFILE, /* send SIGUSR1 to syslogger to rotate logfile */ PMSIGNAL_START_AUTOVAC_LAUNCHER, /* start an autovacuum launcher */ PMSIGNAL_START_AUTOVAC_WORKER, /* start an autovacuum worker */ PMSIGNAL_START_WALRECEIVER, /* start a walreceiver */ PMSIGNAL_ADVANCE_STATE_MACHINE, /* advance postmaster's state machine */ NUM_PMSIGNALS /* Must be last value of enum! */ } PMSignalReason; /* PMSignalData is an opaque struct, details known only within pmsignal.c */ typedef struct PMSignalData PMSignalData; /* * prototypes for functions in pmsignal.c */ extern Size PMSignalShmemSize(void); extern void PMSignalShmemInit(void); extern void SendPostmasterSignal(PMSignalReason reason); extern bool CheckPostmasterSignal(PMSignalReason reason); extern int AssignPostmasterChildSlot(void); extern bool ReleasePostmasterChildSlot(int slot); extern bool IsPostmasterChildWalSender(int slot); extern void MarkPostmasterChildActive(void); extern void MarkPostmasterChildInactive(void); extern void MarkPostmasterChildWalSender(void); extern bool PostmasterIsAlive(void); #endif /* PMSIGNAL_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/pg_shmem.h���������������������������������������������������������������������0000644�����������������00000003721�14763166026�0012632 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pg_shmem.h * Platform-independent API for shared memory support. * * Every port is expected to support shared memory with approximately * SysV-ish semantics; in particular, a memory block is not anonymous * but has an ID, and we must be able to tell whether there are any * remaining processes attached to a block of a specified ID. * * To simplify life for the SysV implementation, the ID is assumed to * consist of two unsigned long values (these are key and ID in SysV * terms). Other platforms may ignore the second value if they need * only one ID number. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/pg_shmem.h * *------------------------------------------------------------------------- */ #ifndef PG_SHMEM_H #define PG_SHMEM_H typedef struct PGShmemHeader /* standard header for all Postgres shmem */ { int32 magic; /* magic # to identify Postgres segments */ #define PGShmemMagic 679834894 pid_t creatorPID; /* PID of creating process */ Size totalsize; /* total size of segment */ Size freeoffset; /* offset to first free space */ void *index; /* pointer to ShmemIndex table */ #ifndef WIN32 /* Windows doesn't have useful inode#s */ dev_t device; /* device data directory is on */ ino_t inode; /* inode number of data directory */ #endif } PGShmemHeader; #ifdef EXEC_BACKEND #ifndef WIN32 extern unsigned long UsedShmemSegID; #else extern HANDLE UsedShmemSegID; #endif extern void *UsedShmemSegAddr; extern void PGSharedMemoryReAttach(void); extern void PGSharedMemoryNoReAttach(void); #endif extern PGShmemHeader *PGSharedMemoryCreate(Size size, bool makePrivate, int port); extern bool PGSharedMemoryIsInUse(unsigned long id1, unsigned long id2); extern void PGSharedMemoryDetach(void); #endif /* PG_SHMEM_H */ �����������������������������������������������pgsql/server/storage/procsignal.h�������������������������������������������������������������������0000644�����������������00000003406�14763166026�0013174 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * procsignal.h * Routines for interprocess signalling * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/procsignal.h * *------------------------------------------------------------------------- */ #ifndef PROCSIGNAL_H #define PROCSIGNAL_H #include "storage/backendid.h" /* * Reasons for signalling a Postgres child process (a backend or an auxiliary * process, like checkpointer). We can cope with concurrent signals for different * reasons. However, if the same reason is signaled multiple times in quick * succession, the process is likely to observe only one notification of it. * This is okay for the present uses. * * Also, because of race conditions, it's important that all the signals be * defined so that no harm is done if a process mistakenly receives one. */ typedef enum { PROCSIG_CATCHUP_INTERRUPT, /* sinval catchup interrupt */ PROCSIG_NOTIFY_INTERRUPT, /* listen/notify interrupt */ /* Recovery conflict reasons */ PROCSIG_RECOVERY_CONFLICT_DATABASE, PROCSIG_RECOVERY_CONFLICT_TABLESPACE, PROCSIG_RECOVERY_CONFLICT_LOCK, PROCSIG_RECOVERY_CONFLICT_SNAPSHOT, PROCSIG_RECOVERY_CONFLICT_BUFFERPIN, PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK, NUM_PROCSIGNALS /* Must be last! */ } ProcSignalReason; /* * prototypes for functions in procsignal.c */ extern Size ProcSignalShmemSize(void); extern void ProcSignalShmemInit(void); extern void ProcSignalInit(int pss_idx); extern int SendProcSignal(pid_t pid, ProcSignalReason reason, BackendId backendId); extern void procsignal_sigusr1_handler(SIGNAL_ARGS); #endif /* PROCSIGNAL_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/predicate.h��������������������������������������������������������������������0000644�����������������00000005077�14763166026�0013001 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * predicate.h * POSTGRES public predicate locking definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/predicate.h * *------------------------------------------------------------------------- */ #ifndef PREDICATE_H #define PREDICATE_H #include "utils/relcache.h" #include "utils/snapshot.h" /* * GUC variables */ extern int max_predicate_locks_per_xact; /* Number of SLRU buffers to use for predicate locking */ #define NUM_OLDSERXID_BUFFERS 16 /* * function prototypes */ /* housekeeping for shared memory predicate lock structures */ extern void InitPredicateLocks(void); extern Size PredicateLockShmemSize(void); extern void CheckPointPredicate(void); /* predicate lock reporting */ extern bool PageIsPredicateLocked(Relation relation, BlockNumber blkno); /* predicate lock maintenance */ extern Snapshot GetSerializableTransactionSnapshot(Snapshot snapshot); extern void SetSerializableTransactionSnapshot(Snapshot snapshot, TransactionId sourcexid); extern void RegisterPredicateLockingXid(TransactionId xid); extern void PredicateLockRelation(Relation relation, Snapshot snapshot); extern void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot); extern void PredicateLockTuple(Relation relation, HeapTuple tuple, Snapshot snapshot); extern void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno); extern void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno); extern void TransferPredicateLocksToHeapRelation(Relation relation); extern void ReleasePredicateLocks(bool isCommit); /* conflict detection (may also trigger rollback) */ extern void CheckForSerializableConflictOut(bool valid, Relation relation, HeapTuple tuple, Buffer buffer, Snapshot snapshot); extern void CheckForSerializableConflictIn(Relation relation, HeapTuple tuple, Buffer buffer); extern void CheckTableForSerializableConflictIn(Relation relation); /* final rollback checking */ extern void PreCommit_CheckForSerializationFailure(void); /* two-phase commit support */ extern void AtPrepare_PredicateLocks(void); extern void PostPrepare_PredicateLocks(TransactionId xid); extern void PredicateLockTwoPhaseFinish(TransactionId xid, bool isCommit); extern void predicatelock_twophase_recover(TransactionId xid, uint16 info, void *recdata, uint32 len); #endif /* PREDICATE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/storage/ipc.h��������������������������������������������������������������������������0000644�����������������00000005051�14763166026�0011604 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * ipc.h * POSTGRES inter-process communication definitions. * * This file is misnamed, as it no longer has much of anything directly * to do with IPC. The functionality here is concerned with managing * exit-time cleanup for either a postmaster or a backend. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/storage/ipc.h * *------------------------------------------------------------------------- */ #ifndef IPC_H #define IPC_H typedef void (*pg_on_exit_callback) (int code, Datum arg); typedef void (*shmem_startup_hook_type) (void); /*---------- * API for handling cleanup that must occur during either ereport(ERROR) * or ereport(FATAL) exits from a block of code. (Typical examples are * undoing transient changes to shared-memory state.) * * PG_ENSURE_ERROR_CLEANUP(cleanup_function, arg); * { * ... code that might throw ereport(ERROR) or ereport(FATAL) ... * } * PG_END_ENSURE_ERROR_CLEANUP(cleanup_function, arg); * * where the cleanup code is in a function declared per pg_on_exit_callback. * The Datum value "arg" can carry any information the cleanup function * needs. * * This construct ensures that cleanup_function() will be called during * either ERROR or FATAL exits. It will not be called on successful * exit from the controlled code. (If you want it to happen then too, * call the function yourself from just after the construct.) * * Note: the macro arguments are multiply evaluated, so avoid side-effects. *---------- */ #define PG_ENSURE_ERROR_CLEANUP(cleanup_function, arg) \ do { \ on_shmem_exit(cleanup_function, arg); \ PG_TRY() #define PG_END_ENSURE_ERROR_CLEANUP(cleanup_function, arg) \ cancel_shmem_exit(cleanup_function, arg); \ PG_CATCH(); \ { \ cancel_shmem_exit(cleanup_function, arg); \ cleanup_function (0, arg); \ PG_RE_THROW(); \ } \ PG_END_TRY(); \ } while (0) /* ipc.c */ extern bool proc_exit_inprogress; extern void proc_exit(int code); extern void shmem_exit(int code); extern void on_proc_exit(pg_on_exit_callback function, Datum arg); extern void on_shmem_exit(pg_on_exit_callback function, Datum arg); extern void cancel_shmem_exit(pg_on_exit_callback function, Datum arg); extern void on_exit_reset(void); /* ipci.c */ extern PGDLLIMPORT shmem_startup_hook_type shmem_startup_hook; extern void CreateSharedMemoryAndSemaphores(bool makePrivate, int port); #endif /* IPC_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/windowapi.h����������������������������������������������������������������������������0000644�����������������00000004513�14763166026�0011370 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * windowapi.h * API for window functions to extract data from their window * * A window function does not receive its arguments in the normal way * (and therefore the concept of strictness is irrelevant). Instead it * receives a "WindowObject", which it can fetch with PG_WINDOW_OBJECT() * (note V1 calling convention must be used). Correct call context can * be tested with WindowObjectIsValid(). Although argument values are * not passed, the call is correctly set up so that PG_NARGS() can be * used and argument type information can be obtained with * get_fn_expr_argtype(), get_fn_expr_arg_stable(), etc. * * Operations on the WindowObject allow the window function to find out * the current row number, total number of rows in the partition, etc * and to evaluate its argument expression(s) at various rows in the * window partition. See the header comments for each WindowObject API * function in nodeWindowAgg.c for details. * * * Portions Copyright (c) 2000-2012, PostgreSQL Global Development Group * * src/include/windowapi.h * *------------------------------------------------------------------------- */ #ifndef WINDOWAPI_H #define WINDOWAPI_H /* values of "seektype" */ #define WINDOW_SEEK_CURRENT 0 #define WINDOW_SEEK_HEAD 1 #define WINDOW_SEEK_TAIL 2 /* this struct is private in nodeWindowAgg.c */ typedef struct WindowObjectData *WindowObject; #define PG_WINDOW_OBJECT() ((WindowObject) fcinfo->context) #define WindowObjectIsValid(winobj) \ ((winobj) != NULL && IsA(winobj, WindowObjectData)) extern void *WinGetPartitionLocalMemory(WindowObject winobj, Size sz); extern int64 WinGetCurrentPosition(WindowObject winobj); extern int64 WinGetPartitionRowCount(WindowObject winobj); extern void WinSetMarkPosition(WindowObject winobj, int64 markpos); extern bool WinRowsArePeers(WindowObject winobj, int64 pos1, int64 pos2); extern Datum WinGetFuncArgInPartition(WindowObject winobj, int argno, int relpos, int seektype, bool set_mark, bool *isnull, bool *isout); extern Datum WinGetFuncArgInFrame(WindowObject winobj, int argno, int relpos, int seektype, bool set_mark, bool *isnull, bool *isout); extern Datum WinGetFuncArgCurrent(WindowObject winobj, int argno, bool *isnull); #endif /* WINDOWAPI_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/parser/keywords.h����������������������������������������������������������������������0000644�����������������00000002037�14763166026�0012531 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * keywords.h * lexical token lookup for key words in PostgreSQL * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/keywords.h * *------------------------------------------------------------------------- */ #ifndef KEYWORDS_H #define KEYWORDS_H /* Keyword categories --- should match lists in gram.y */ #define UNRESERVED_KEYWORD 0 #define COL_NAME_KEYWORD 1 #define TYPE_FUNC_NAME_KEYWORD 2 #define RESERVED_KEYWORD 3 typedef struct ScanKeyword { const char *name; /* in lower case */ int16 value; /* grammar's token code */ int16 category; /* see codes above */ } ScanKeyword; extern PGDLLIMPORT const ScanKeyword ScanKeywords[]; extern PGDLLIMPORT const int NumScanKeywords; extern const ScanKeyword *ScanKeywordLookup(const char *text, const ScanKeyword *keywords, int num_keywords); #endif /* KEYWORDS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/parser/kwlist.h������������������������������������������������������������������������0000644�����������������00000050411�14763166026�0012176 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * kwlist.h * * The keyword list is kept in its own source file for possible use by * automatic tools. The exact representation of a keyword is determined * by the PG_KEYWORD macro, which is not defined in this file; it can * be defined by the caller for special purposes. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION * src/include/parser/kwlist.h * *------------------------------------------------------------------------- */ /* there is deliberately not an #ifndef KWLIST_H here */ /* * List of keyword (name, token-value, category) entries. * * !!WARNING!!: This list must be sorted by ASCII name, because binary * search is used to locate entries. */ /* name, value, category */ PG_KEYWORD("abort", ABORT_P, UNRESERVED_KEYWORD) PG_KEYWORD("absolute", ABSOLUTE_P, UNRESERVED_KEYWORD) PG_KEYWORD("access", ACCESS, UNRESERVED_KEYWORD) PG_KEYWORD("action", ACTION, UNRESERVED_KEYWORD) PG_KEYWORD("add", ADD_P, UNRESERVED_KEYWORD) PG_KEYWORD("admin", ADMIN, UNRESERVED_KEYWORD) PG_KEYWORD("after", AFTER, UNRESERVED_KEYWORD) PG_KEYWORD("aggregate", AGGREGATE, UNRESERVED_KEYWORD) PG_KEYWORD("all", ALL, RESERVED_KEYWORD) PG_KEYWORD("also", ALSO, UNRESERVED_KEYWORD) PG_KEYWORD("alter", ALTER, UNRESERVED_KEYWORD) PG_KEYWORD("always", ALWAYS, UNRESERVED_KEYWORD) PG_KEYWORD("analyse", ANALYSE, RESERVED_KEYWORD) /* British spelling */ PG_KEYWORD("analyze", ANALYZE, RESERVED_KEYWORD) PG_KEYWORD("and", AND, RESERVED_KEYWORD) PG_KEYWORD("any", ANY, RESERVED_KEYWORD) PG_KEYWORD("array", ARRAY, RESERVED_KEYWORD) PG_KEYWORD("as", AS, RESERVED_KEYWORD) PG_KEYWORD("asc", ASC, RESERVED_KEYWORD) PG_KEYWORD("assertion", ASSERTION, UNRESERVED_KEYWORD) PG_KEYWORD("assignment", ASSIGNMENT, UNRESERVED_KEYWORD) PG_KEYWORD("asymmetric", ASYMMETRIC, RESERVED_KEYWORD) PG_KEYWORD("at", AT, UNRESERVED_KEYWORD) PG_KEYWORD("attribute", ATTRIBUTE, UNRESERVED_KEYWORD) PG_KEYWORD("authorization", AUTHORIZATION, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("backward", BACKWARD, UNRESERVED_KEYWORD) PG_KEYWORD("before", BEFORE, UNRESERVED_KEYWORD) PG_KEYWORD("begin", BEGIN_P, UNRESERVED_KEYWORD) PG_KEYWORD("between", BETWEEN, COL_NAME_KEYWORD) PG_KEYWORD("bigint", BIGINT, COL_NAME_KEYWORD) PG_KEYWORD("binary", BINARY, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("bit", BIT, COL_NAME_KEYWORD) PG_KEYWORD("boolean", BOOLEAN_P, COL_NAME_KEYWORD) PG_KEYWORD("both", BOTH, RESERVED_KEYWORD) PG_KEYWORD("by", BY, UNRESERVED_KEYWORD) PG_KEYWORD("cache", CACHE, UNRESERVED_KEYWORD) PG_KEYWORD("called", CALLED, UNRESERVED_KEYWORD) PG_KEYWORD("cascade", CASCADE, UNRESERVED_KEYWORD) PG_KEYWORD("cascaded", CASCADED, UNRESERVED_KEYWORD) PG_KEYWORD("case", CASE, RESERVED_KEYWORD) PG_KEYWORD("cast", CAST, RESERVED_KEYWORD) PG_KEYWORD("catalog", CATALOG_P, UNRESERVED_KEYWORD) PG_KEYWORD("chain", CHAIN, UNRESERVED_KEYWORD) PG_KEYWORD("char", CHAR_P, COL_NAME_KEYWORD) PG_KEYWORD("character", CHARACTER, COL_NAME_KEYWORD) PG_KEYWORD("characteristics", CHARACTERISTICS, UNRESERVED_KEYWORD) PG_KEYWORD("check", CHECK, RESERVED_KEYWORD) PG_KEYWORD("checkpoint", CHECKPOINT, UNRESERVED_KEYWORD) PG_KEYWORD("class", CLASS, UNRESERVED_KEYWORD) PG_KEYWORD("close", CLOSE, UNRESERVED_KEYWORD) PG_KEYWORD("cluster", CLUSTER, UNRESERVED_KEYWORD) PG_KEYWORD("coalesce", COALESCE, COL_NAME_KEYWORD) PG_KEYWORD("collate", COLLATE, RESERVED_KEYWORD) PG_KEYWORD("collation", COLLATION, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("column", COLUMN, RESERVED_KEYWORD) PG_KEYWORD("comment", COMMENT, UNRESERVED_KEYWORD) PG_KEYWORD("comments", COMMENTS, UNRESERVED_KEYWORD) PG_KEYWORD("commit", COMMIT, UNRESERVED_KEYWORD) PG_KEYWORD("committed", COMMITTED, UNRESERVED_KEYWORD) PG_KEYWORD("concurrently", CONCURRENTLY, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("configuration", CONFIGURATION, UNRESERVED_KEYWORD) PG_KEYWORD("connection", CONNECTION, UNRESERVED_KEYWORD) PG_KEYWORD("constraint", CONSTRAINT, RESERVED_KEYWORD) PG_KEYWORD("constraints", CONSTRAINTS, UNRESERVED_KEYWORD) PG_KEYWORD("content", CONTENT_P, UNRESERVED_KEYWORD) PG_KEYWORD("continue", CONTINUE_P, UNRESERVED_KEYWORD) PG_KEYWORD("conversion", CONVERSION_P, UNRESERVED_KEYWORD) PG_KEYWORD("copy", COPY, UNRESERVED_KEYWORD) PG_KEYWORD("cost", COST, UNRESERVED_KEYWORD) PG_KEYWORD("create", CREATE, RESERVED_KEYWORD) PG_KEYWORD("cross", CROSS, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("csv", CSV, UNRESERVED_KEYWORD) PG_KEYWORD("current", CURRENT_P, UNRESERVED_KEYWORD) PG_KEYWORD("current_catalog", CURRENT_CATALOG, RESERVED_KEYWORD) PG_KEYWORD("current_date", CURRENT_DATE, RESERVED_KEYWORD) PG_KEYWORD("current_role", CURRENT_ROLE, RESERVED_KEYWORD) PG_KEYWORD("current_schema", CURRENT_SCHEMA, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("current_time", CURRENT_TIME, RESERVED_KEYWORD) PG_KEYWORD("current_timestamp", CURRENT_TIMESTAMP, RESERVED_KEYWORD) PG_KEYWORD("current_user", CURRENT_USER, RESERVED_KEYWORD) PG_KEYWORD("cursor", CURSOR, UNRESERVED_KEYWORD) PG_KEYWORD("cycle", CYCLE, UNRESERVED_KEYWORD) PG_KEYWORD("data", DATA_P, UNRESERVED_KEYWORD) PG_KEYWORD("database", DATABASE, UNRESERVED_KEYWORD) PG_KEYWORD("day", DAY_P, UNRESERVED_KEYWORD) PG_KEYWORD("deallocate", DEALLOCATE, UNRESERVED_KEYWORD) PG_KEYWORD("dec", DEC, COL_NAME_KEYWORD) PG_KEYWORD("decimal", DECIMAL_P, COL_NAME_KEYWORD) PG_KEYWORD("declare", DECLARE, UNRESERVED_KEYWORD) PG_KEYWORD("default", DEFAULT, RESERVED_KEYWORD) PG_KEYWORD("defaults", DEFAULTS, UNRESERVED_KEYWORD) PG_KEYWORD("deferrable", DEFERRABLE, RESERVED_KEYWORD) PG_KEYWORD("deferred", DEFERRED, UNRESERVED_KEYWORD) PG_KEYWORD("definer", DEFINER, UNRESERVED_KEYWORD) PG_KEYWORD("delete", DELETE_P, UNRESERVED_KEYWORD) PG_KEYWORD("delimiter", DELIMITER, UNRESERVED_KEYWORD) PG_KEYWORD("delimiters", DELIMITERS, UNRESERVED_KEYWORD) PG_KEYWORD("desc", DESC, RESERVED_KEYWORD) PG_KEYWORD("dictionary", DICTIONARY, UNRESERVED_KEYWORD) PG_KEYWORD("disable", DISABLE_P, UNRESERVED_KEYWORD) PG_KEYWORD("discard", DISCARD, UNRESERVED_KEYWORD) PG_KEYWORD("distinct", DISTINCT, RESERVED_KEYWORD) PG_KEYWORD("do", DO, RESERVED_KEYWORD) PG_KEYWORD("document", DOCUMENT_P, UNRESERVED_KEYWORD) PG_KEYWORD("domain", DOMAIN_P, UNRESERVED_KEYWORD) PG_KEYWORD("double", DOUBLE_P, UNRESERVED_KEYWORD) PG_KEYWORD("drop", DROP, UNRESERVED_KEYWORD) PG_KEYWORD("each", EACH, UNRESERVED_KEYWORD) PG_KEYWORD("else", ELSE, RESERVED_KEYWORD) PG_KEYWORD("enable", ENABLE_P, UNRESERVED_KEYWORD) PG_KEYWORD("encoding", ENCODING, UNRESERVED_KEYWORD) PG_KEYWORD("encrypted", ENCRYPTED, UNRESERVED_KEYWORD) PG_KEYWORD("end", END_P, RESERVED_KEYWORD) PG_KEYWORD("enum", ENUM_P, UNRESERVED_KEYWORD) PG_KEYWORD("escape", ESCAPE, UNRESERVED_KEYWORD) PG_KEYWORD("except", EXCEPT, RESERVED_KEYWORD) PG_KEYWORD("exclude", EXCLUDE, UNRESERVED_KEYWORD) PG_KEYWORD("excluding", EXCLUDING, UNRESERVED_KEYWORD) PG_KEYWORD("exclusive", EXCLUSIVE, UNRESERVED_KEYWORD) PG_KEYWORD("execute", EXECUTE, UNRESERVED_KEYWORD) PG_KEYWORD("exists", EXISTS, COL_NAME_KEYWORD) PG_KEYWORD("explain", EXPLAIN, UNRESERVED_KEYWORD) PG_KEYWORD("extension", EXTENSION, UNRESERVED_KEYWORD) PG_KEYWORD("external", EXTERNAL, UNRESERVED_KEYWORD) PG_KEYWORD("extract", EXTRACT, COL_NAME_KEYWORD) PG_KEYWORD("false", FALSE_P, RESERVED_KEYWORD) PG_KEYWORD("family", FAMILY, UNRESERVED_KEYWORD) PG_KEYWORD("fetch", FETCH, RESERVED_KEYWORD) PG_KEYWORD("first", FIRST_P, UNRESERVED_KEYWORD) PG_KEYWORD("float", FLOAT_P, COL_NAME_KEYWORD) PG_KEYWORD("following", FOLLOWING, UNRESERVED_KEYWORD) PG_KEYWORD("for", FOR, RESERVED_KEYWORD) PG_KEYWORD("force", FORCE, UNRESERVED_KEYWORD) PG_KEYWORD("foreign", FOREIGN, RESERVED_KEYWORD) PG_KEYWORD("forward", FORWARD, UNRESERVED_KEYWORD) PG_KEYWORD("freeze", FREEZE, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("from", FROM, RESERVED_KEYWORD) PG_KEYWORD("full", FULL, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("function", FUNCTION, UNRESERVED_KEYWORD) PG_KEYWORD("functions", FUNCTIONS, UNRESERVED_KEYWORD) PG_KEYWORD("global", GLOBAL, UNRESERVED_KEYWORD) PG_KEYWORD("grant", GRANT, RESERVED_KEYWORD) PG_KEYWORD("granted", GRANTED, UNRESERVED_KEYWORD) PG_KEYWORD("greatest", GREATEST, COL_NAME_KEYWORD) PG_KEYWORD("group", GROUP_P, RESERVED_KEYWORD) PG_KEYWORD("handler", HANDLER, UNRESERVED_KEYWORD) PG_KEYWORD("having", HAVING, RESERVED_KEYWORD) PG_KEYWORD("header", HEADER_P, UNRESERVED_KEYWORD) PG_KEYWORD("hold", HOLD, UNRESERVED_KEYWORD) PG_KEYWORD("hour", HOUR_P, UNRESERVED_KEYWORD) PG_KEYWORD("identity", IDENTITY_P, UNRESERVED_KEYWORD) PG_KEYWORD("if", IF_P, UNRESERVED_KEYWORD) PG_KEYWORD("ilike", ILIKE, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("immediate", IMMEDIATE, UNRESERVED_KEYWORD) PG_KEYWORD("immutable", IMMUTABLE, UNRESERVED_KEYWORD) PG_KEYWORD("implicit", IMPLICIT_P, UNRESERVED_KEYWORD) PG_KEYWORD("in", IN_P, RESERVED_KEYWORD) PG_KEYWORD("including", INCLUDING, UNRESERVED_KEYWORD) PG_KEYWORD("increment", INCREMENT, UNRESERVED_KEYWORD) PG_KEYWORD("index", INDEX, UNRESERVED_KEYWORD) PG_KEYWORD("indexes", INDEXES, UNRESERVED_KEYWORD) PG_KEYWORD("inherit", INHERIT, UNRESERVED_KEYWORD) PG_KEYWORD("inherits", INHERITS, UNRESERVED_KEYWORD) PG_KEYWORD("initially", INITIALLY, RESERVED_KEYWORD) PG_KEYWORD("inline", INLINE_P, UNRESERVED_KEYWORD) PG_KEYWORD("inner", INNER_P, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("inout", INOUT, COL_NAME_KEYWORD) PG_KEYWORD("input", INPUT_P, UNRESERVED_KEYWORD) PG_KEYWORD("insensitive", INSENSITIVE, UNRESERVED_KEYWORD) PG_KEYWORD("insert", INSERT, UNRESERVED_KEYWORD) PG_KEYWORD("instead", INSTEAD, UNRESERVED_KEYWORD) PG_KEYWORD("int", INT_P, COL_NAME_KEYWORD) PG_KEYWORD("integer", INTEGER, COL_NAME_KEYWORD) PG_KEYWORD("intersect", INTERSECT, RESERVED_KEYWORD) PG_KEYWORD("interval", INTERVAL, COL_NAME_KEYWORD) PG_KEYWORD("into", INTO, RESERVED_KEYWORD) PG_KEYWORD("invoker", INVOKER, UNRESERVED_KEYWORD) PG_KEYWORD("is", IS, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("isnull", ISNULL, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("isolation", ISOLATION, UNRESERVED_KEYWORD) PG_KEYWORD("join", JOIN, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("key", KEY, UNRESERVED_KEYWORD) PG_KEYWORD("label", LABEL, UNRESERVED_KEYWORD) PG_KEYWORD("language", LANGUAGE, UNRESERVED_KEYWORD) PG_KEYWORD("large", LARGE_P, UNRESERVED_KEYWORD) PG_KEYWORD("last", LAST_P, UNRESERVED_KEYWORD) PG_KEYWORD("lc_collate", LC_COLLATE_P, UNRESERVED_KEYWORD) PG_KEYWORD("lc_ctype", LC_CTYPE_P, UNRESERVED_KEYWORD) PG_KEYWORD("leading", LEADING, RESERVED_KEYWORD) PG_KEYWORD("leakproof", LEAKPROOF, UNRESERVED_KEYWORD) PG_KEYWORD("least", LEAST, COL_NAME_KEYWORD) PG_KEYWORD("left", LEFT, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("level", LEVEL, UNRESERVED_KEYWORD) PG_KEYWORD("like", LIKE, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("limit", LIMIT, RESERVED_KEYWORD) PG_KEYWORD("listen", LISTEN, UNRESERVED_KEYWORD) PG_KEYWORD("load", LOAD, UNRESERVED_KEYWORD) PG_KEYWORD("local", LOCAL, UNRESERVED_KEYWORD) PG_KEYWORD("localtime", LOCALTIME, RESERVED_KEYWORD) PG_KEYWORD("localtimestamp", LOCALTIMESTAMP, RESERVED_KEYWORD) PG_KEYWORD("location", LOCATION, UNRESERVED_KEYWORD) PG_KEYWORD("lock", LOCK_P, UNRESERVED_KEYWORD) PG_KEYWORD("mapping", MAPPING, UNRESERVED_KEYWORD) PG_KEYWORD("match", MATCH, UNRESERVED_KEYWORD) PG_KEYWORD("maxvalue", MAXVALUE, UNRESERVED_KEYWORD) PG_KEYWORD("minute", MINUTE_P, UNRESERVED_KEYWORD) PG_KEYWORD("minvalue", MINVALUE, UNRESERVED_KEYWORD) PG_KEYWORD("mode", MODE, UNRESERVED_KEYWORD) PG_KEYWORD("month", MONTH_P, UNRESERVED_KEYWORD) PG_KEYWORD("move", MOVE, UNRESERVED_KEYWORD) PG_KEYWORD("name", NAME_P, UNRESERVED_KEYWORD) PG_KEYWORD("names", NAMES, UNRESERVED_KEYWORD) PG_KEYWORD("national", NATIONAL, COL_NAME_KEYWORD) PG_KEYWORD("natural", NATURAL, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("nchar", NCHAR, COL_NAME_KEYWORD) PG_KEYWORD("next", NEXT, UNRESERVED_KEYWORD) PG_KEYWORD("no", NO, UNRESERVED_KEYWORD) PG_KEYWORD("none", NONE, COL_NAME_KEYWORD) PG_KEYWORD("not", NOT, RESERVED_KEYWORD) PG_KEYWORD("nothing", NOTHING, UNRESERVED_KEYWORD) PG_KEYWORD("notify", NOTIFY, UNRESERVED_KEYWORD) PG_KEYWORD("notnull", NOTNULL, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("nowait", NOWAIT, UNRESERVED_KEYWORD) PG_KEYWORD("null", NULL_P, RESERVED_KEYWORD) PG_KEYWORD("nullif", NULLIF, COL_NAME_KEYWORD) PG_KEYWORD("nulls", NULLS_P, UNRESERVED_KEYWORD) PG_KEYWORD("numeric", NUMERIC, COL_NAME_KEYWORD) PG_KEYWORD("object", OBJECT_P, UNRESERVED_KEYWORD) PG_KEYWORD("of", OF, UNRESERVED_KEYWORD) PG_KEYWORD("off", OFF, UNRESERVED_KEYWORD) PG_KEYWORD("offset", OFFSET, RESERVED_KEYWORD) PG_KEYWORD("oids", OIDS, UNRESERVED_KEYWORD) PG_KEYWORD("on", ON, RESERVED_KEYWORD) PG_KEYWORD("only", ONLY, RESERVED_KEYWORD) PG_KEYWORD("operator", OPERATOR, UNRESERVED_KEYWORD) PG_KEYWORD("option", OPTION, UNRESERVED_KEYWORD) PG_KEYWORD("options", OPTIONS, UNRESERVED_KEYWORD) PG_KEYWORD("or", OR, RESERVED_KEYWORD) PG_KEYWORD("order", ORDER, RESERVED_KEYWORD) PG_KEYWORD("out", OUT_P, COL_NAME_KEYWORD) PG_KEYWORD("outer", OUTER_P, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("over", OVER, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("overlaps", OVERLAPS, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("overlay", OVERLAY, COL_NAME_KEYWORD) PG_KEYWORD("owned", OWNED, UNRESERVED_KEYWORD) PG_KEYWORD("owner", OWNER, UNRESERVED_KEYWORD) PG_KEYWORD("parser", PARSER, UNRESERVED_KEYWORD) PG_KEYWORD("partial", PARTIAL, UNRESERVED_KEYWORD) PG_KEYWORD("partition", PARTITION, UNRESERVED_KEYWORD) PG_KEYWORD("passing", PASSING, UNRESERVED_KEYWORD) PG_KEYWORD("password", PASSWORD, UNRESERVED_KEYWORD) PG_KEYWORD("placing", PLACING, RESERVED_KEYWORD) PG_KEYWORD("plans", PLANS, UNRESERVED_KEYWORD) PG_KEYWORD("position", POSITION, COL_NAME_KEYWORD) PG_KEYWORD("preceding", PRECEDING, UNRESERVED_KEYWORD) PG_KEYWORD("precision", PRECISION, COL_NAME_KEYWORD) PG_KEYWORD("prepare", PREPARE, UNRESERVED_KEYWORD) PG_KEYWORD("prepared", PREPARED, UNRESERVED_KEYWORD) PG_KEYWORD("preserve", PRESERVE, UNRESERVED_KEYWORD) PG_KEYWORD("primary", PRIMARY, RESERVED_KEYWORD) PG_KEYWORD("prior", PRIOR, UNRESERVED_KEYWORD) PG_KEYWORD("privileges", PRIVILEGES, UNRESERVED_KEYWORD) PG_KEYWORD("procedural", PROCEDURAL, UNRESERVED_KEYWORD) PG_KEYWORD("procedure", PROCEDURE, UNRESERVED_KEYWORD) PG_KEYWORD("quote", QUOTE, UNRESERVED_KEYWORD) PG_KEYWORD("range", RANGE, UNRESERVED_KEYWORD) PG_KEYWORD("read", READ, UNRESERVED_KEYWORD) PG_KEYWORD("real", REAL, COL_NAME_KEYWORD) PG_KEYWORD("reassign", REASSIGN, UNRESERVED_KEYWORD) PG_KEYWORD("recheck", RECHECK, UNRESERVED_KEYWORD) PG_KEYWORD("recursive", RECURSIVE, UNRESERVED_KEYWORD) PG_KEYWORD("ref", REF, UNRESERVED_KEYWORD) PG_KEYWORD("references", REFERENCES, RESERVED_KEYWORD) PG_KEYWORD("reindex", REINDEX, UNRESERVED_KEYWORD) PG_KEYWORD("relative", RELATIVE_P, UNRESERVED_KEYWORD) PG_KEYWORD("release", RELEASE, UNRESERVED_KEYWORD) PG_KEYWORD("rename", RENAME, UNRESERVED_KEYWORD) PG_KEYWORD("repeatable", REPEATABLE, UNRESERVED_KEYWORD) PG_KEYWORD("replace", REPLACE, UNRESERVED_KEYWORD) PG_KEYWORD("replica", REPLICA, UNRESERVED_KEYWORD) PG_KEYWORD("reset", RESET, UNRESERVED_KEYWORD) PG_KEYWORD("restart", RESTART, UNRESERVED_KEYWORD) PG_KEYWORD("restrict", RESTRICT, UNRESERVED_KEYWORD) PG_KEYWORD("returning", RETURNING, RESERVED_KEYWORD) PG_KEYWORD("returns", RETURNS, UNRESERVED_KEYWORD) PG_KEYWORD("revoke", REVOKE, UNRESERVED_KEYWORD) PG_KEYWORD("right", RIGHT, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("role", ROLE, UNRESERVED_KEYWORD) PG_KEYWORD("rollback", ROLLBACK, UNRESERVED_KEYWORD) PG_KEYWORD("row", ROW, COL_NAME_KEYWORD) PG_KEYWORD("rows", ROWS, UNRESERVED_KEYWORD) PG_KEYWORD("rule", RULE, UNRESERVED_KEYWORD) PG_KEYWORD("savepoint", SAVEPOINT, UNRESERVED_KEYWORD) PG_KEYWORD("schema", SCHEMA, UNRESERVED_KEYWORD) PG_KEYWORD("scroll", SCROLL, UNRESERVED_KEYWORD) PG_KEYWORD("search", SEARCH, UNRESERVED_KEYWORD) PG_KEYWORD("second", SECOND_P, UNRESERVED_KEYWORD) PG_KEYWORD("security", SECURITY, UNRESERVED_KEYWORD) PG_KEYWORD("select", SELECT, RESERVED_KEYWORD) PG_KEYWORD("sequence", SEQUENCE, UNRESERVED_KEYWORD) PG_KEYWORD("sequences", SEQUENCES, UNRESERVED_KEYWORD) PG_KEYWORD("serializable", SERIALIZABLE, UNRESERVED_KEYWORD) PG_KEYWORD("server", SERVER, UNRESERVED_KEYWORD) PG_KEYWORD("session", SESSION, UNRESERVED_KEYWORD) PG_KEYWORD("session_user", SESSION_USER, RESERVED_KEYWORD) PG_KEYWORD("set", SET, UNRESERVED_KEYWORD) PG_KEYWORD("setof", SETOF, COL_NAME_KEYWORD) PG_KEYWORD("share", SHARE, UNRESERVED_KEYWORD) PG_KEYWORD("show", SHOW, UNRESERVED_KEYWORD) PG_KEYWORD("similar", SIMILAR, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("simple", SIMPLE, UNRESERVED_KEYWORD) PG_KEYWORD("smallint", SMALLINT, COL_NAME_KEYWORD) PG_KEYWORD("snapshot", SNAPSHOT, UNRESERVED_KEYWORD) PG_KEYWORD("some", SOME, RESERVED_KEYWORD) PG_KEYWORD("stable", STABLE, UNRESERVED_KEYWORD) PG_KEYWORD("standalone", STANDALONE_P, UNRESERVED_KEYWORD) PG_KEYWORD("start", START, UNRESERVED_KEYWORD) PG_KEYWORD("statement", STATEMENT, UNRESERVED_KEYWORD) PG_KEYWORD("statistics", STATISTICS, UNRESERVED_KEYWORD) PG_KEYWORD("stdin", STDIN, UNRESERVED_KEYWORD) PG_KEYWORD("stdout", STDOUT, UNRESERVED_KEYWORD) PG_KEYWORD("storage", STORAGE, UNRESERVED_KEYWORD) PG_KEYWORD("strict", STRICT_P, UNRESERVED_KEYWORD) PG_KEYWORD("strip", STRIP_P, UNRESERVED_KEYWORD) PG_KEYWORD("substring", SUBSTRING, COL_NAME_KEYWORD) PG_KEYWORD("symmetric", SYMMETRIC, RESERVED_KEYWORD) PG_KEYWORD("sysid", SYSID, UNRESERVED_KEYWORD) PG_KEYWORD("system", SYSTEM_P, UNRESERVED_KEYWORD) PG_KEYWORD("table", TABLE, RESERVED_KEYWORD) PG_KEYWORD("tables", TABLES, UNRESERVED_KEYWORD) PG_KEYWORD("tablespace", TABLESPACE, UNRESERVED_KEYWORD) PG_KEYWORD("temp", TEMP, UNRESERVED_KEYWORD) PG_KEYWORD("template", TEMPLATE, UNRESERVED_KEYWORD) PG_KEYWORD("temporary", TEMPORARY, UNRESERVED_KEYWORD) PG_KEYWORD("text", TEXT_P, UNRESERVED_KEYWORD) PG_KEYWORD("then", THEN, RESERVED_KEYWORD) PG_KEYWORD("time", TIME, COL_NAME_KEYWORD) PG_KEYWORD("timestamp", TIMESTAMP, COL_NAME_KEYWORD) PG_KEYWORD("to", TO, RESERVED_KEYWORD) PG_KEYWORD("trailing", TRAILING, RESERVED_KEYWORD) PG_KEYWORD("transaction", TRANSACTION, UNRESERVED_KEYWORD) PG_KEYWORD("treat", TREAT, COL_NAME_KEYWORD) PG_KEYWORD("trigger", TRIGGER, UNRESERVED_KEYWORD) PG_KEYWORD("trim", TRIM, COL_NAME_KEYWORD) PG_KEYWORD("true", TRUE_P, RESERVED_KEYWORD) PG_KEYWORD("truncate", TRUNCATE, UNRESERVED_KEYWORD) PG_KEYWORD("trusted", TRUSTED, UNRESERVED_KEYWORD) PG_KEYWORD("type", TYPE_P, UNRESERVED_KEYWORD) PG_KEYWORD("types", TYPES_P, UNRESERVED_KEYWORD) PG_KEYWORD("unbounded", UNBOUNDED, UNRESERVED_KEYWORD) PG_KEYWORD("uncommitted", UNCOMMITTED, UNRESERVED_KEYWORD) PG_KEYWORD("unencrypted", UNENCRYPTED, UNRESERVED_KEYWORD) PG_KEYWORD("union", UNION, RESERVED_KEYWORD) PG_KEYWORD("unique", UNIQUE, RESERVED_KEYWORD) PG_KEYWORD("unknown", UNKNOWN, UNRESERVED_KEYWORD) PG_KEYWORD("unlisten", UNLISTEN, UNRESERVED_KEYWORD) PG_KEYWORD("unlogged", UNLOGGED, UNRESERVED_KEYWORD) PG_KEYWORD("until", UNTIL, UNRESERVED_KEYWORD) PG_KEYWORD("update", UPDATE, UNRESERVED_KEYWORD) PG_KEYWORD("user", USER, RESERVED_KEYWORD) PG_KEYWORD("using", USING, RESERVED_KEYWORD) PG_KEYWORD("vacuum", VACUUM, UNRESERVED_KEYWORD) PG_KEYWORD("valid", VALID, UNRESERVED_KEYWORD) PG_KEYWORD("validate", VALIDATE, UNRESERVED_KEYWORD) PG_KEYWORD("validator", VALIDATOR, UNRESERVED_KEYWORD) PG_KEYWORD("value", VALUE_P, UNRESERVED_KEYWORD) PG_KEYWORD("values", VALUES, COL_NAME_KEYWORD) PG_KEYWORD("varchar", VARCHAR, COL_NAME_KEYWORD) PG_KEYWORD("variadic", VARIADIC, RESERVED_KEYWORD) PG_KEYWORD("varying", VARYING, UNRESERVED_KEYWORD) PG_KEYWORD("verbose", VERBOSE, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("version", VERSION_P, UNRESERVED_KEYWORD) PG_KEYWORD("view", VIEW, UNRESERVED_KEYWORD) PG_KEYWORD("volatile", VOLATILE, UNRESERVED_KEYWORD) PG_KEYWORD("when", WHEN, RESERVED_KEYWORD) PG_KEYWORD("where", WHERE, RESERVED_KEYWORD) PG_KEYWORD("whitespace", WHITESPACE_P, UNRESERVED_KEYWORD) PG_KEYWORD("window", WINDOW, RESERVED_KEYWORD) PG_KEYWORD("with", WITH, RESERVED_KEYWORD) PG_KEYWORD("without", WITHOUT, UNRESERVED_KEYWORD) PG_KEYWORD("work", WORK, UNRESERVED_KEYWORD) PG_KEYWORD("wrapper", WRAPPER, UNRESERVED_KEYWORD) PG_KEYWORD("write", WRITE, UNRESERVED_KEYWORD) PG_KEYWORD("xml", XML_P, UNRESERVED_KEYWORD) PG_KEYWORD("xmlattributes", XMLATTRIBUTES, COL_NAME_KEYWORD) PG_KEYWORD("xmlconcat", XMLCONCAT, COL_NAME_KEYWORD) PG_KEYWORD("xmlelement", XMLELEMENT, COL_NAME_KEYWORD) PG_KEYWORD("xmlexists", XMLEXISTS, COL_NAME_KEYWORD) PG_KEYWORD("xmlforest", XMLFOREST, COL_NAME_KEYWORD) PG_KEYWORD("xmlparse", XMLPARSE, COL_NAME_KEYWORD) PG_KEYWORD("xmlpi", XMLPI, COL_NAME_KEYWORD) PG_KEYWORD("xmlroot", XMLROOT, COL_NAME_KEYWORD) PG_KEYWORD("xmlserialize", XMLSERIALIZE, COL_NAME_KEYWORD) PG_KEYWORD("year", YEAR_P, UNRESERVED_KEYWORD) PG_KEYWORD("yes", YES_P, UNRESERVED_KEYWORD) PG_KEYWORD("zone", ZONE, UNRESERVED_KEYWORD) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/parser/gramparse.h���������������������������������������������������������������������0000644�����������������00000004146�14763166026�0012646 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * gramparse.h * Shared definitions for the "raw" parser (flex and bison phases only) * * NOTE: this file is only meant to be included in the core parsing files, * ie, parser.c, gram.y, scan.l, and keywords.c. Definitions that are needed * outside the core parser should be in parser.h. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/gramparse.h * *------------------------------------------------------------------------- */ #ifndef GRAMPARSE_H #define GRAMPARSE_H #include "nodes/parsenodes.h" #include "parser/scanner.h" /* * NB: include gram.h only AFTER including scanner.h, because scanner.h * is what #defines YYLTYPE. */ #include "parser/gram.h" /* * The YY_EXTRA data that a flex scanner allows us to pass around. Private * state needed for raw parsing/lexing goes here. */ typedef struct base_yy_extra_type { /* * Fields used by the core scanner. */ core_yy_extra_type core_yy_extra; /* * State variables for base_yylex(). */ bool have_lookahead; /* is lookahead info valid? */ int lookahead_token; /* one-token lookahead */ core_YYSTYPE lookahead_yylval; /* yylval for lookahead token */ YYLTYPE lookahead_yylloc; /* yylloc for lookahead token */ /* * State variables that belong to the grammar. */ List *parsetree; /* final parse result is delivered here */ } base_yy_extra_type; /* * In principle we should use yyget_extra() to fetch the yyextra field * from a yyscanner struct. However, flex always puts that field first, * and this is sufficiently performance-critical to make it seem worth * cheating a bit to use an inline macro. */ #define pg_yyget_extra(yyscanner) (*((base_yy_extra_type **) (yyscanner))) /* from parser.c */ extern int base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp, core_yyscan_t yyscanner); /* from gram.y */ extern void parser_init(base_yy_extra_type *yyext); extern int base_yyparse(core_yyscan_t yyscanner); #endif /* GRAMPARSE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/parser/parse_param.h�������������������������������������������������������������������0000644�����������������00000001410�14763166026�0013146 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * parse_param.h * handle parameters in parser * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/parse_param.h * *------------------------------------------------------------------------- */ #ifndef PARSE_PARAM_H #define PARSE_PARAM_H #include "parser/parse_node.h" extern void parse_fixed_parameters(ParseState *pstate, Oid *paramTypes, int numParams); extern void parse_variable_parameters(ParseState *pstate, Oid **paramTypes, int *numParams); extern void check_variable_parameters(ParseState *pstate, Query *query); #endif /* PARSE_PARAM_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/parser/parse_agg.h���������������������������������������������������������������������0000644�����������������00000002200�14763166026�0012602 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * parse_agg.h * handle aggregates and window functions in parser * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/parse_agg.h * *------------------------------------------------------------------------- */ #ifndef PARSE_AGG_H #define PARSE_AGG_H #include "parser/parse_node.h" extern void transformAggregateCall(ParseState *pstate, Aggref *agg, List *args, List *aggorder, bool agg_distinct); extern void transformWindowFuncCall(ParseState *pstate, WindowFunc *wfunc, WindowDef *windef); extern void parseCheckAggregates(ParseState *pstate, Query *qry); extern void parseCheckWindowFuncs(ParseState *pstate, Query *qry); extern void build_aggregate_fnexprs(Oid *agg_input_types, int agg_num_inputs, Oid agg_state_type, Oid agg_result_type, Oid agg_input_collation, Oid transfn_oid, Oid finalfn_oid, Expr **transfnexpr, Expr **finalfnexpr); #endif /* PARSE_AGG_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/parser/parse_cte.h���������������������������������������������������������������������0000644�����������������00000001266�14763166026�0012632 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * parse_cte.h * handle CTEs (common table expressions) in parser * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/parse_cte.h * *------------------------------------------------------------------------- */ #ifndef PARSE_CTE_H #define PARSE_CTE_H #include "parser/parse_node.h" extern List *transformWithClause(ParseState *pstate, WithClause *withClause); extern void analyzeCTETargetList(ParseState *pstate, CommonTableExpr *cte, List *tlist); #endif /* PARSE_CTE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/parser/scanner.h�����������������������������������������������������������������������0000644�����������������00000010151�14763166026�0012307 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * scanner.h * API for the core scanner (flex machine) * * The core scanner is also used by PL/pgsql, so we provide a public API * for it. However, the rest of the backend is only expected to use the * higher-level API provided by parser.h. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/scanner.h * *------------------------------------------------------------------------- */ #ifndef SCANNER_H #define SCANNER_H #include "parser/keywords.h" /* * The scanner returns extra data about scanned tokens in this union type. * Note that this is a subset of the fields used in YYSTYPE of the bison * parsers built atop the scanner. */ typedef union core_YYSTYPE { int ival; /* for integer literals */ char *str; /* for identifiers and non-integer literals */ const char *keyword; /* canonical spelling of keywords */ } core_YYSTYPE; /* * We track token locations in terms of byte offsets from the start of the * source string, not the column number/line number representation that * bison uses by default. Also, to minimize overhead we track only one * location (usually the first token location) for each construct, not * the beginning and ending locations as bison does by default. It's * therefore sufficient to make YYLTYPE an int. */ #define YYLTYPE int /* * Another important component of the scanner's API is the token code numbers. * However, those are not defined in this file, because bison insists on * defining them for itself. The token codes used by the core scanner are * the ASCII characters plus these: * %token <str> IDENT FCONST SCONST BCONST XCONST Op * %token <ival> ICONST PARAM * %token TYPECAST DOT_DOT COLON_EQUALS * The above token definitions *must* be the first ones declared in any * bison parser built atop this scanner, so that they will have consistent * numbers assigned to them (specifically, IDENT = 258 and so on). */ /* * The YY_EXTRA data that a flex scanner allows us to pass around. * Private state needed by the core scanner goes here. Note that the actual * yy_extra struct may be larger and have this as its first component, thus * allowing the calling parser to keep some fields of its own in YY_EXTRA. */ typedef struct core_yy_extra_type { /* * The string the scanner is physically scanning. We keep this mainly so * that we can cheaply compute the offset of the current token (yytext). */ char *scanbuf; Size scanbuflen; /* * The keyword list to use. */ const ScanKeyword *keywords; int num_keywords; /* * literalbuf is used to accumulate literal values when multiple rules are * needed to parse a single literal. Call startlit() to reset buffer to * empty, addlit() to add text. NOTE: the string in literalbuf is NOT * necessarily null-terminated, but there always IS room to add a trailing * null at offset literallen. We store a null only when we need it. */ char *literalbuf; /* palloc'd expandable buffer */ int literallen; /* actual current string length */ int literalalloc; /* current allocated buffer size */ int xcdepth; /* depth of nesting in slash-star comments */ char *dolqstart; /* current $foo$ quote start string */ /* first part of UTF16 surrogate pair for Unicode escapes */ int32 utf16_first_part; /* state variables for literal-lexing warnings */ bool warn_on_first_escape; bool saw_non_ascii; } core_yy_extra_type; /* * The type of yyscanner is opaque outside scan.l. */ typedef void *core_yyscan_t; /* Entry points in parser/scan.l */ extern core_yyscan_t scanner_init(const char *str, core_yy_extra_type *yyext, const ScanKeyword *keywords, int num_keywords); extern void scanner_finish(core_yyscan_t yyscanner); extern int core_yylex(core_YYSTYPE *lvalp, YYLTYPE *llocp, core_yyscan_t yyscanner); extern int scanner_errposition(int location, core_yyscan_t yyscanner); extern void scanner_yyerror(const char *message, core_yyscan_t yyscanner); #endif /* SCANNER_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/parser/parse_type.h��������������������������������������������������������������������0000644�����������������00000003506�14763166026�0013037 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * parse_type.h * handle type operations for parser * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/parse_type.h * *------------------------------------------------------------------------- */ #ifndef PARSE_TYPE_H #define PARSE_TYPE_H #include "access/htup.h" #include "parser/parse_node.h" typedef HeapTuple Type; extern Type LookupTypeName(ParseState *pstate, const TypeName *typeName, int32 *typmod_p); extern Type LookupTypeNameExtended(ParseState *pstate, const TypeName *typeName, int32 *typmod_p, bool temp_ok, bool missing_ok); extern Type typenameType(ParseState *pstate, const TypeName *typeName, int32 *typmod_p); extern Oid typenameTypeId(ParseState *pstate, const TypeName *typeName); extern void typenameTypeIdAndMod(ParseState *pstate, const TypeName *typeName, Oid *typeid_p, int32 *typmod_p); extern char *TypeNameToString(const TypeName *typeName); extern char *TypeNameListToString(List *typenames); extern Oid LookupCollation(ParseState *pstate, List *collnames, int location); extern Oid GetColumnDefCollation(ParseState *pstate, ColumnDef *coldef, Oid typeOid); extern Type typeidType(Oid id); extern Oid typeTypeId(Type tp); extern int16 typeLen(Type t); extern bool typeByVal(Type t); extern char *typeTypeName(Type t); extern Oid typeTypeRelid(Type typ); extern Oid typeTypeCollation(Type typ); extern Datum stringTypeDatum(Type tp, char *string, int32 atttypmod); extern Oid typeidTypeRelid(Oid type_id); extern void parseTypeString(const char *str, Oid *typeid_p, int32 *typmod_p); #define ISCOMPLEX(typeid) (typeidTypeRelid(typeid) != InvalidOid) #endif /* PARSE_TYPE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/parser/gram.h��������������������������������������������������������������������������0000644�����������������00000025324�14763166026�0011614 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* A Bison parser, made by GNU Bison 3.0.2. */ /* Bison interface for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. 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 3 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, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ #ifndef YY_BASE_YY_GRAM_H_INCLUDED # define YY_BASE_YY_GRAM_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int base_yydebug; #endif /* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { IDENT = 258, FCONST = 259, SCONST = 260, BCONST = 261, XCONST = 262, Op = 263, ICONST = 264, PARAM = 265, TYPECAST = 266, DOT_DOT = 267, COLON_EQUALS = 268, ABORT_P = 269, ABSOLUTE_P = 270, ACCESS = 271, ACTION = 272, ADD_P = 273, ADMIN = 274, AFTER = 275, AGGREGATE = 276, ALL = 277, ALSO = 278, ALTER = 279, ALWAYS = 280, ANALYSE = 281, ANALYZE = 282, AND = 283, ANY = 284, ARRAY = 285, AS = 286, ASC = 287, ASSERTION = 288, ASSIGNMENT = 289, ASYMMETRIC = 290, AT = 291, ATTRIBUTE = 292, AUTHORIZATION = 293, BACKWARD = 294, BEFORE = 295, BEGIN_P = 296, BETWEEN = 297, BIGINT = 298, BINARY = 299, BIT = 300, BOOLEAN_P = 301, BOTH = 302, BY = 303, CACHE = 304, CALLED = 305, CASCADE = 306, CASCADED = 307, CASE = 308, CAST = 309, CATALOG_P = 310, CHAIN = 311, CHAR_P = 312, CHARACTER = 313, CHARACTERISTICS = 314, CHECK = 315, CHECKPOINT = 316, CLASS = 317, CLOSE = 318, CLUSTER = 319, COALESCE = 320, COLLATE = 321, COLLATION = 322, COLUMN = 323, COMMENT = 324, COMMENTS = 325, COMMIT = 326, COMMITTED = 327, CONCURRENTLY = 328, CONFIGURATION = 329, CONNECTION = 330, CONSTRAINT = 331, CONSTRAINTS = 332, CONTENT_P = 333, CONTINUE_P = 334, CONVERSION_P = 335, COPY = 336, COST = 337, CREATE = 338, CROSS = 339, CSV = 340, CURRENT_P = 341, CURRENT_CATALOG = 342, CURRENT_DATE = 343, CURRENT_ROLE = 344, CURRENT_SCHEMA = 345, CURRENT_TIME = 346, CURRENT_TIMESTAMP = 347, CURRENT_USER = 348, CURSOR = 349, CYCLE = 350, DATA_P = 351, DATABASE = 352, DAY_P = 353, DEALLOCATE = 354, DEC = 355, DECIMAL_P = 356, DECLARE = 357, DEFAULT = 358, DEFAULTS = 359, DEFERRABLE = 360, DEFERRED = 361, DEFINER = 362, DELETE_P = 363, DELIMITER = 364, DELIMITERS = 365, DESC = 366, DICTIONARY = 367, DISABLE_P = 368, DISCARD = 369, DISTINCT = 370, DO = 371, DOCUMENT_P = 372, DOMAIN_P = 373, DOUBLE_P = 374, DROP = 375, EACH = 376, ELSE = 377, ENABLE_P = 378, ENCODING = 379, ENCRYPTED = 380, END_P = 381, ENUM_P = 382, ESCAPE = 383, EXCEPT = 384, EXCLUDE = 385, EXCLUDING = 386, EXCLUSIVE = 387, EXECUTE = 388, EXISTS = 389, EXPLAIN = 390, EXTENSION = 391, EXTERNAL = 392, EXTRACT = 393, FALSE_P = 394, FAMILY = 395, FETCH = 396, FIRST_P = 397, FLOAT_P = 398, FOLLOWING = 399, FOR = 400, FORCE = 401, FOREIGN = 402, FORWARD = 403, FREEZE = 404, FROM = 405, FULL = 406, FUNCTION = 407, FUNCTIONS = 408, GLOBAL = 409, GRANT = 410, GRANTED = 411, GREATEST = 412, GROUP_P = 413, HANDLER = 414, HAVING = 415, HEADER_P = 416, HOLD = 417, HOUR_P = 418, IDENTITY_P = 419, IF_P = 420, ILIKE = 421, IMMEDIATE = 422, IMMUTABLE = 423, IMPLICIT_P = 424, IN_P = 425, INCLUDING = 426, INCREMENT = 427, INDEX = 428, INDEXES = 429, INHERIT = 430, INHERITS = 431, INITIALLY = 432, INLINE_P = 433, INNER_P = 434, INOUT = 435, INPUT_P = 436, INSENSITIVE = 437, INSERT = 438, INSTEAD = 439, INT_P = 440, INTEGER = 441, INTERSECT = 442, INTERVAL = 443, INTO = 444, INVOKER = 445, IS = 446, ISNULL = 447, ISOLATION = 448, JOIN = 449, KEY = 450, LABEL = 451, LANGUAGE = 452, LARGE_P = 453, LAST_P = 454, LC_COLLATE_P = 455, LC_CTYPE_P = 456, LEADING = 457, LEAKPROOF = 458, LEAST = 459, LEFT = 460, LEVEL = 461, LIKE = 462, LIMIT = 463, LISTEN = 464, LOAD = 465, LOCAL = 466, LOCALTIME = 467, LOCALTIMESTAMP = 468, LOCATION = 469, LOCK_P = 470, MAPPING = 471, MATCH = 472, MAXVALUE = 473, MINUTE_P = 474, MINVALUE = 475, MODE = 476, MONTH_P = 477, MOVE = 478, NAME_P = 479, NAMES = 480, NATIONAL = 481, NATURAL = 482, NCHAR = 483, NEXT = 484, NO = 485, NONE = 486, NOT = 487, NOTHING = 488, NOTIFY = 489, NOTNULL = 490, NOWAIT = 491, NULL_P = 492, NULLIF = 493, NULLS_P = 494, NUMERIC = 495, OBJECT_P = 496, OF = 497, OFF = 498, OFFSET = 499, OIDS = 500, ON = 501, ONLY = 502, OPERATOR = 503, OPTION = 504, OPTIONS = 505, OR = 506, ORDER = 507, OUT_P = 508, OUTER_P = 509, OVER = 510, OVERLAPS = 511, OVERLAY = 512, OWNED = 513, OWNER = 514, PARSER = 515, PARTIAL = 516, PARTITION = 517, PASSING = 518, PASSWORD = 519, PLACING = 520, PLANS = 521, POSITION = 522, PRECEDING = 523, PRECISION = 524, PRESERVE = 525, PREPARE = 526, PREPARED = 527, PRIMARY = 528, PRIOR = 529, PRIVILEGES = 530, PROCEDURAL = 531, PROCEDURE = 532, QUOTE = 533, RANGE = 534, READ = 535, REAL = 536, REASSIGN = 537, RECHECK = 538, RECURSIVE = 539, REF = 540, REFERENCES = 541, REINDEX = 542, RELATIVE_P = 543, RELEASE = 544, RENAME = 545, REPEATABLE = 546, REPLACE = 547, REPLICA = 548, RESET = 549, RESTART = 550, RESTRICT = 551, RETURNING = 552, RETURNS = 553, REVOKE = 554, RIGHT = 555, ROLE = 556, ROLLBACK = 557, ROW = 558, ROWS = 559, RULE = 560, SAVEPOINT = 561, SCHEMA = 562, SCROLL = 563, SEARCH = 564, SECOND_P = 565, SECURITY = 566, SELECT = 567, SEQUENCE = 568, SEQUENCES = 569, SERIALIZABLE = 570, SERVER = 571, SESSION = 572, SESSION_USER = 573, SET = 574, SETOF = 575, SHARE = 576, SHOW = 577, SIMILAR = 578, SIMPLE = 579, SMALLINT = 580, SNAPSHOT = 581, SOME = 582, STABLE = 583, STANDALONE_P = 584, START = 585, STATEMENT = 586, STATISTICS = 587, STDIN = 588, STDOUT = 589, STORAGE = 590, STRICT_P = 591, STRIP_P = 592, SUBSTRING = 593, SYMMETRIC = 594, SYSID = 595, SYSTEM_P = 596, TABLE = 597, TABLES = 598, TABLESPACE = 599, TEMP = 600, TEMPLATE = 601, TEMPORARY = 602, TEXT_P = 603, THEN = 604, TIME = 605, TIMESTAMP = 606, TO = 607, TRAILING = 608, TRANSACTION = 609, TREAT = 610, TRIGGER = 611, TRIM = 612, TRUE_P = 613, TRUNCATE = 614, TRUSTED = 615, TYPE_P = 616, TYPES_P = 617, UNBOUNDED = 618, UNCOMMITTED = 619, UNENCRYPTED = 620, UNION = 621, UNIQUE = 622, UNKNOWN = 623, UNLISTEN = 624, UNLOGGED = 625, UNTIL = 626, UPDATE = 627, USER = 628, USING = 629, VACUUM = 630, VALID = 631, VALIDATE = 632, VALIDATOR = 633, VALUE_P = 634, VALUES = 635, VARCHAR = 636, VARIADIC = 637, VARYING = 638, VERBOSE = 639, VERSION_P = 640, VIEW = 641, VOLATILE = 642, WHEN = 643, WHERE = 644, WHITESPACE_P = 645, WINDOW = 646, WITH = 647, WITHOUT = 648, WORK = 649, WRAPPER = 650, WRITE = 651, XML_P = 652, XMLATTRIBUTES = 653, XMLCONCAT = 654, XMLELEMENT = 655, XMLEXISTS = 656, XMLFOREST = 657, XMLPARSE = 658, XMLPI = 659, XMLROOT = 660, XMLSERIALIZE = 661, YEAR_P = 662, YES_P = 663, ZONE = 664, NULLS_FIRST = 665, NULLS_LAST = 666, WITH_TIME = 667, POSTFIXOP = 668, UMINUS = 669 }; #endif /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE YYSTYPE; union YYSTYPE { #line 158 "gram.y" /* yacc.c:1909 */ core_YYSTYPE core_yystype; /* these fields must match core_YYSTYPE: */ int ival; char *str; const char *keyword; char chr; bool boolean; JoinType jtype; DropBehavior dbehavior; OnCommitAction oncommit; List *list; Node *node; Value *value; ObjectType objtype; TypeName *typnam; FunctionParameter *fun_param; FunctionParameterMode fun_param_mode; FuncWithArgs *funwithargs; DefElem *defelt; SortBy *sortby; WindowDef *windef; JoinExpr *jexpr; IndexElem *ielem; Alias *alias; RangeVar *range; IntoClause *into; WithClause *with; A_Indices *aind; ResTarget *target; struct PrivTarget *privtarget; AccessPriv *accesspriv; InsertStmt *istmt; VariableSetStmt *vsetstmt; #line 506 "gram.h" /* yacc.c:1909 */ }; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif /* Location type. */ #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED typedef struct YYLTYPE YYLTYPE; struct YYLTYPE { int first_line; int first_column; int last_line; int last_column; }; # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 #endif int base_yyparse (core_yyscan_t yyscanner); #endif /* !YY_BASE_YY_GRAM_H_INCLUDED */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/parser/parse_expr.h��������������������������������������������������������������������0000644�����������������00000001153�14763166026�0013030 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * parse_expr.h * handle expressions in parser * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/parse_expr.h * *------------------------------------------------------------------------- */ #ifndef PARSE_EXPR_H #define PARSE_EXPR_H #include "parser/parse_node.h" /* GUC parameters */ extern bool Transform_null_equals; extern Node *transformExpr(ParseState *pstate, Node *expr); #endif /* PARSE_EXPR_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/parser/parser.h������������������������������������������������������������������������0000644�����������������00000002172�14763166026�0012156 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * parser.h * Definitions for the "raw" parser (flex and bison phases only) * * This is the external API for the raw lexing/parsing functions. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/parser.h * *------------------------------------------------------------------------- */ #ifndef PARSER_H #define PARSER_H #include "nodes/parsenodes.h" typedef enum { BACKSLASH_QUOTE_OFF, BACKSLASH_QUOTE_ON, BACKSLASH_QUOTE_SAFE_ENCODING } BackslashQuoteType; /* GUC variables in scan.l (every one of these is a bad idea :-() */ extern int backslash_quote; extern bool escape_string_warning; extern PGDLLIMPORT bool standard_conforming_strings; /* Primary entry point for the raw parsing functions */ extern List *raw_parser(const char *str); /* Utility functions exported by gram.y (perhaps these should be elsewhere) */ extern List *SystemFuncName(char *name); extern TypeName *SystemTypeName(char *name); #endif /* PARSER_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/parser/parse_collate.h�����������������������������������������������������������������0000644�����������������00000001475�14763166026�0013504 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * parse_collate.h * Routines for assigning collation information. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/parse_collate.h * *------------------------------------------------------------------------- */ #ifndef PARSE_COLLATE_H #define PARSE_COLLATE_H #include "parser/parse_node.h" extern void assign_query_collations(ParseState *pstate, Query *query); extern void assign_list_collations(ParseState *pstate, List *exprs); extern void assign_expr_collations(ParseState *pstate, Node *expr); extern Oid select_common_collation(ParseState *pstate, List *exprs, bool none_ok); #endif /* PARSE_COLLATE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/parser/parse_coerce.h������������������������������������������������������������������0000644�����������������00000006054�14763166026�0013317 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * parse_coerce.h * Routines for type coercion. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/parse_coerce.h * *------------------------------------------------------------------------- */ #ifndef PARSE_COERCE_H #define PARSE_COERCE_H #include "parser/parse_node.h" /* Type categories (see TYPCATEGORY_xxx symbols in catalog/pg_type.h) */ typedef char TYPCATEGORY; /* Result codes for find_coercion_pathway */ typedef enum CoercionPathType { COERCION_PATH_NONE, /* failed to find any coercion pathway */ COERCION_PATH_FUNC, /* apply the specified coercion function */ COERCION_PATH_RELABELTYPE, /* binary-compatible cast, no function */ COERCION_PATH_ARRAYCOERCE, /* need an ArrayCoerceExpr node */ COERCION_PATH_COERCEVIAIO /* need a CoerceViaIO node */ } CoercionPathType; extern bool IsBinaryCoercible(Oid srctype, Oid targettype); extern bool IsPreferredType(TYPCATEGORY category, Oid type); extern TYPCATEGORY TypeCategory(Oid type); extern Node *coerce_to_target_type(ParseState *pstate, Node *expr, Oid exprtype, Oid targettype, int32 targettypmod, CoercionContext ccontext, CoercionForm cformat, int location); extern bool can_coerce_type(int nargs, Oid *input_typeids, Oid *target_typeids, CoercionContext ccontext); extern Node *coerce_type(ParseState *pstate, Node *node, Oid inputTypeId, Oid targetTypeId, int32 targetTypeMod, CoercionContext ccontext, CoercionForm cformat, int location); extern Node *coerce_to_domain(Node *arg, Oid baseTypeId, int32 baseTypeMod, Oid typeId, CoercionForm cformat, int location, bool hideInputCoercion, bool lengthCoercionDone); extern Node *coerce_to_boolean(ParseState *pstate, Node *node, const char *constructName); extern Node *coerce_to_specific_type(ParseState *pstate, Node *node, Oid targetTypeId, const char *constructName); extern int parser_coercion_errposition(ParseState *pstate, int coerce_location, Node *input_expr); extern Oid select_common_type(ParseState *pstate, List *exprs, const char *context, Node **which_expr); extern Node *coerce_to_common_type(ParseState *pstate, Node *node, Oid targetTypeId, const char *context); extern bool check_generic_type_consistency(Oid *actual_arg_types, Oid *declared_arg_types, int nargs); extern Oid enforce_generic_type_consistency(Oid *actual_arg_types, Oid *declared_arg_types, int nargs, Oid rettype, bool allow_poly); extern Oid resolve_generic_type(Oid declared_type, Oid context_actual_type, Oid context_declared_type); extern CoercionPathType find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId, CoercionContext ccontext, Oid *funcid); extern CoercionPathType find_typmod_coercion_function(Oid typeId, Oid *funcid); #endif /* PARSE_COERCE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/parser/analyze.h�����������������������������������������������������������������������0000644�����������������00000002671�14763166026�0012331 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * analyze.h * parse analysis for optimizable statements * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/analyze.h * *------------------------------------------------------------------------- */ #ifndef ANALYZE_H #define ANALYZE_H #include "parser/parse_node.h" /* Hook for plugins to get control at end of parse analysis */ typedef void (*post_parse_analyze_hook_type) (ParseState *pstate, Query *query); extern PGDLLIMPORT post_parse_analyze_hook_type post_parse_analyze_hook; extern Query *parse_analyze(Node *parseTree, const char *sourceText, Oid *paramTypes, int numParams); extern Query *parse_analyze_varparams(Node *parseTree, const char *sourceText, Oid **paramTypes, int *numParams); extern Query *parse_sub_analyze(Node *parseTree, ParseState *parentParseState, CommonTableExpr *parentCTE, bool locked_from_parent); extern Query *transformTopLevelStmt(ParseState *pstate, Node *parseTree); extern Query *transformStmt(ParseState *pstate, Node *parseTree); extern bool analyze_requires_snapshot(Node *parseTree); extern void CheckSelectLocking(Query *qry); extern void applyLockingClause(Query *qry, Index rtindex, bool forUpdate, bool noWait, bool pushedDown); #endif /* ANALYZE_H */ �����������������������������������������������������������������������pgsql/server/parser/parse_target.h������������������������������������������������������������������0000644�����������������00000002621�14763166026�0013341 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * parse_target.h * handle target lists * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/parse_target.h * *------------------------------------------------------------------------- */ #ifndef PARSE_TARGET_H #define PARSE_TARGET_H #include "parser/parse_node.h" extern List *transformTargetList(ParseState *pstate, List *targetlist); extern List *transformExpressionList(ParseState *pstate, List *exprlist); extern void markTargetListOrigins(ParseState *pstate, List *targetlist); extern TargetEntry *transformTargetEntry(ParseState *pstate, Node *node, Node *expr, char *colname, bool resjunk); extern Expr *transformAssignedExpr(ParseState *pstate, Expr *expr, char *colname, int attrno, List *indirection, int location); extern void updateTargetListEntry(ParseState *pstate, TargetEntry *tle, char *colname, int attrno, List *indirection, int location); extern List *checkInsertTargets(ParseState *pstate, List *cols, List **attrnos); extern TupleDesc expandRecordVariable(ParseState *pstate, Var *var, int levelsup); extern char *FigureColname(Node *node); extern char *FigureIndexColname(Node *node); #endif /* PARSE_TARGET_H */ ���������������������������������������������������������������������������������������������������������������pgsql/server/parser/parse_node.h��������������������������������������������������������������������0000644�����������������00000014146�14763166026�0013005 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * parse_node.h * Internal definitions for parser * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/parse_node.h * *------------------------------------------------------------------------- */ #ifndef PARSE_NODE_H #define PARSE_NODE_H #include "nodes/parsenodes.h" #include "utils/relcache.h" /* * Function signatures for parser hooks */ typedef struct ParseState ParseState; typedef Node *(*PreParseColumnRefHook) (ParseState *pstate, ColumnRef *cref); typedef Node *(*PostParseColumnRefHook) (ParseState *pstate, ColumnRef *cref, Node *var); typedef Node *(*ParseParamRefHook) (ParseState *pstate, ParamRef *pref); typedef Node *(*CoerceParamHook) (ParseState *pstate, Param *param, Oid targetTypeId, int32 targetTypeMod, int location); /* * State information used during parse analysis * * parentParseState: NULL in a top-level ParseState. When parsing a subquery, * links to current parse state of outer query. * * p_sourcetext: source string that generated the raw parsetree being * analyzed, or NULL if not available. (The string is used only to * generate cursor positions in error messages: we need it to convert * byte-wise locations in parse structures to character-wise cursor * positions.) * * p_rtable: list of RTEs that will become the rangetable of the query. * Note that neither relname nor refname of these entries are necessarily * unique; searching the rtable by name is a bad idea. * * p_joinexprs: list of JoinExpr nodes associated with p_rtable entries. * This is one-for-one with p_rtable, but contains NULLs for non-join * RTEs, and may be shorter than p_rtable if the last RTE(s) aren't joins. * * p_joinlist: list of join items (RangeTblRef and JoinExpr nodes) that * will become the fromlist of the query's top-level FromExpr node. * * p_relnamespace: list of RTEs that represents the current namespace for * table lookup, ie, those RTEs that are accessible by qualified names. * This may be just a subset of the rtable + joinlist, and/or may contain * entries that are not yet added to the main joinlist. * * p_varnamespace: list of RTEs that represents the current namespace for * column lookup, ie, those RTEs that are accessible by unqualified names. * This is different from p_relnamespace because a JOIN without an alias does * not hide the contained tables (so they must still be in p_relnamespace) * but it does hide their columns (unqualified references to the columns must * refer to the JOIN, not the member tables). Other special RTEs such as * NEW/OLD for rules may also appear in just one of these lists. * * p_ctenamespace: list of CommonTableExprs (WITH items) that are visible * at the moment. This is different from p_relnamespace because you have * to make an RTE before you can access a CTE. * * p_future_ctes: list of CommonTableExprs (WITH items) that are not yet * visible due to scope rules. This is used to help improve error messages. * * p_parent_cte: CommonTableExpr that immediately contains the current query, * if any. * * p_windowdefs: list of WindowDefs representing WINDOW and OVER clauses. * We collect these while transforming expressions and then transform them * afterwards (so that any resjunk tlist items needed for the sort/group * clauses end up at the end of the query tlist). A WindowDef's location in * this list, counting from 1, is the winref number to use to reference it. */ struct ParseState { struct ParseState *parentParseState; /* stack link */ const char *p_sourcetext; /* source text, or NULL if not available */ List *p_rtable; /* range table so far */ List *p_joinexprs; /* JoinExprs for RTE_JOIN p_rtable entries */ List *p_joinlist; /* join items so far (will become FromExpr * node's fromlist) */ List *p_relnamespace; /* current namespace for relations */ List *p_varnamespace; /* current namespace for columns */ List *p_ctenamespace; /* current namespace for common table exprs */ List *p_future_ctes; /* common table exprs not yet in namespace */ CommonTableExpr *p_parent_cte; /* this query's containing CTE */ List *p_windowdefs; /* raw representations of window clauses */ int p_next_resno; /* next targetlist resno to assign */ List *p_locking_clause; /* raw FOR UPDATE/FOR SHARE info */ Node *p_value_substitute; /* what to replace VALUE with, if any */ bool p_hasAggs; bool p_hasWindowFuncs; bool p_hasSubLinks; bool p_hasModifyingCTE; bool p_is_insert; bool p_is_update; bool p_locked_from_parent; Relation p_target_relation; RangeTblEntry *p_target_rangetblentry; /* * Optional hook functions for parser callbacks. These are null unless * set up by the caller of make_parsestate. */ PreParseColumnRefHook p_pre_columnref_hook; PostParseColumnRefHook p_post_columnref_hook; ParseParamRefHook p_paramref_hook; CoerceParamHook p_coerce_param_hook; void *p_ref_hook_state; /* common passthrough link for above */ }; /* Support for parser_errposition_callback function */ typedef struct ParseCallbackState { ParseState *pstate; int location; ErrorContextCallback errcontext; } ParseCallbackState; extern ParseState *make_parsestate(ParseState *parentParseState); extern void free_parsestate(ParseState *pstate); extern int parser_errposition(ParseState *pstate, int location); extern void setup_parser_errposition_callback(ParseCallbackState *pcbstate, ParseState *pstate, int location); extern void cancel_parser_errposition_callback(ParseCallbackState *pcbstate); extern Var *make_var(ParseState *pstate, RangeTblEntry *rte, int attrno, int location); extern Oid transformArrayType(Oid *arrayType, int32 *arrayTypmod); extern ArrayRef *transformArraySubscripts(ParseState *pstate, Node *arrayBase, Oid arrayType, Oid elementType, int32 arrayTypMod, List *indirection, Node *assignFrom); extern Const *make_const(ParseState *pstate, Value *value, int location); #endif /* PARSE_NODE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/parser/scansup.h�����������������������������������������������������������������������0000644�����������������00000001360�14763166026�0012334 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * scansup.h * scanner support routines. used by both the bootstrap lexer * as well as the normal lexer * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/scansup.h * *------------------------------------------------------------------------- */ #ifndef SCANSUP_H #define SCANSUP_H extern char *scanstr(const char *s); extern char *downcase_truncate_identifier(const char *ident, int len, bool warn); extern void truncate_identifier(char *ident, int len, bool warn); extern bool scanner_isspace(char ch); #endif /* SCANSUP_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/parser/parsetree.h���������������������������������������������������������������������0000644�����������������00000004025�14763166026�0012653 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * parsetree.h * Routines to access various components and subcomponents of * parse trees. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/parsetree.h * *------------------------------------------------------------------------- */ #ifndef PARSETREE_H #define PARSETREE_H #include "nodes/parsenodes.h" /* ---------------- * range table operations * ---------------- */ /* * rt_fetch * * NB: this will crash and burn if handed an out-of-range RT index */ #define rt_fetch(rangetable_index, rangetable) \ ((RangeTblEntry *) list_nth(rangetable, (rangetable_index)-1)) /* * getrelid * * Given the range index of a relation, return the corresponding * relation OID. Note that InvalidOid will be returned if the * RTE is for a non-relation-type RTE. */ #define getrelid(rangeindex,rangetable) \ (rt_fetch(rangeindex, rangetable)->relid) /* * Given an RTE and an attribute number, return the appropriate * variable name or alias for that attribute of that RTE. */ extern char *get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum); /* * Given an RTE and an attribute number, return the appropriate * type and typemod info for that attribute of that RTE. */ extern void get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum, Oid *vartype, int32 *vartypmod, Oid *varcollid); /* * Check whether an attribute of an RTE has been dropped (note that * get_rte_attribute_type will fail on such an attr) */ extern bool get_rte_attribute_is_dropped(RangeTblEntry *rte, AttrNumber attnum); /* ---------------- * target list operations * ---------------- */ extern TargetEntry *get_tle_by_resno(List *tlist, AttrNumber resno); /* ---------------- * FOR UPDATE/SHARE info * ---------------- */ extern RowMarkClause *get_parse_rowmark(Query *qry, Index rtindex); #endif /* PARSETREE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/parser/parse_func.h��������������������������������������������������������������������0000644�����������������00000005160�14763166026�0013007 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * parse_func.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/parse_func.h * *------------------------------------------------------------------------- */ #ifndef PARSER_FUNC_H #define PARSER_FUNC_H #include "catalog/namespace.h" #include "parser/parse_node.h" /* * This structure is used to explore the inheritance hierarchy above * nodes in the type tree in order to disambiguate among polymorphic * functions. */ typedef struct _InhPaths { int nsupers; /* number of superclasses */ Oid self; /* this class */ Oid *supervec; /* vector of superclasses */ } InhPaths; /* Result codes for func_get_detail */ typedef enum { FUNCDETAIL_NOTFOUND, /* no matching function */ FUNCDETAIL_MULTIPLE, /* too many matching functions */ FUNCDETAIL_NORMAL, /* found a matching regular function */ FUNCDETAIL_AGGREGATE, /* found a matching aggregate function */ FUNCDETAIL_WINDOWFUNC, /* found a matching window function */ FUNCDETAIL_COERCION /* it's a type coercion request */ } FuncDetailCode; extern Node *ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, List *agg_order, bool agg_star, bool agg_distinct, bool func_variadic, WindowDef *over, bool is_column, int location); extern FuncDetailCode func_get_detail(List *funcname, List *fargs, List *fargnames, int nargs, Oid *argtypes, bool expand_variadic, bool expand_defaults, Oid *funcid, Oid *rettype, bool *retset, int *nvargs, Oid **true_typeids, List **argdefaults); extern int func_match_argtypes(int nargs, Oid *input_typeids, FuncCandidateList raw_candidates, FuncCandidateList *candidates); extern FuncCandidateList func_select_candidate(int nargs, Oid *input_typeids, FuncCandidateList candidates); extern void make_fn_arguments(ParseState *pstate, List *fargs, Oid *actual_arg_types, Oid *declared_arg_types); extern const char *funcname_signature_string(const char *funcname, int nargs, List *argnames, const Oid *argtypes); extern const char *func_signature_string(List *funcname, int nargs, List *argnames, const Oid *argtypes); extern Oid LookupFuncName(List *funcname, int nargs, const Oid *argtypes, bool noError); extern Oid LookupFuncNameTypeNames(List *funcname, List *argtypes, bool noError); extern Oid LookupAggNameTypeNames(List *aggname, List *argtypes, bool noError); #endif /* PARSE_FUNC_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/parser/parse_clause.h������������������������������������������������������������������0000644�����������������00000003354�14763166026�0013333 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * parse_clause.h * handle clauses in parser * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/parse_clause.h * *------------------------------------------------------------------------- */ #ifndef PARSE_CLAUSE_H #define PARSE_CLAUSE_H #include "parser/parse_node.h" extern void transformFromClause(ParseState *pstate, List *frmList); extern int setTargetTable(ParseState *pstate, RangeVar *relation, bool inh, bool alsoSource, AclMode requiredPerms); extern bool interpretInhOption(InhOption inhOpt); extern bool interpretOidsOption(List *defList); extern Node *transformWhereClause(ParseState *pstate, Node *clause, const char *constructName); extern Node *transformLimitClause(ParseState *pstate, Node *clause, const char *constructName); extern List *transformGroupClause(ParseState *pstate, List *grouplist, List **targetlist, List *sortClause, bool useSQL99); extern List *transformSortClause(ParseState *pstate, List *orderlist, List **targetlist, bool resolveUnknown, bool useSQL99); extern List *transformWindowDefinitions(ParseState *pstate, List *windowdefs, List **targetlist); extern List *transformDistinctClause(ParseState *pstate, List **targetlist, List *sortClause, bool is_agg); extern List *transformDistinctOnClause(ParseState *pstate, List *distinctlist, List **targetlist, List *sortClause); extern Index assignSortGroupRef(TargetEntry *tle, List *tlist); extern bool targetIsInSortList(TargetEntry *tle, Oid sortop, List *sortList); #endif /* PARSE_CLAUSE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/parser/parse_relation.h����������������������������������������������������������������0000644�����������������00000006730�14763166026�0013675 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * parse_relation.h * prototypes for parse_relation.c. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/parse_relation.h * *------------------------------------------------------------------------- */ #ifndef PARSE_RELATION_H #define PARSE_RELATION_H #include "parser/parse_node.h" extern RangeTblEntry *refnameRangeTblEntry(ParseState *pstate, const char *schemaname, const char *refname, int location, int *sublevels_up); extern CommonTableExpr *scanNameSpaceForCTE(ParseState *pstate, const char *refname, Index *ctelevelsup); extern void checkNameSpaceConflicts(ParseState *pstate, List *namespace1, List *namespace2); extern int RTERangeTablePosn(ParseState *pstate, RangeTblEntry *rte, int *sublevels_up); extern RangeTblEntry *GetRTEByRangeTablePosn(ParseState *pstate, int varno, int sublevels_up); extern CommonTableExpr *GetCTEForRTE(ParseState *pstate, RangeTblEntry *rte, int rtelevelsup); extern Node *scanRTEForColumn(ParseState *pstate, RangeTblEntry *rte, char *colname, int location); extern Node *colNameToVar(ParseState *pstate, char *colname, bool localonly, int location); extern void markVarForSelectPriv(ParseState *pstate, Var *var, RangeTblEntry *rte); extern Relation parserOpenTable(ParseState *pstate, const RangeVar *relation, int lockmode); extern RangeTblEntry *addRangeTableEntry(ParseState *pstate, RangeVar *relation, Alias *alias, bool inh, bool inFromCl); extern RangeTblEntry *addRangeTableEntryForRelation(ParseState *pstate, Relation rel, Alias *alias, bool inh, bool inFromCl); extern RangeTblEntry *addRangeTableEntryForSubquery(ParseState *pstate, Query *subquery, Alias *alias, bool inFromCl); extern RangeTblEntry *addRangeTableEntryForFunction(ParseState *pstate, char *funcname, Node *funcexpr, RangeFunction *rangefunc, bool inFromCl); extern RangeTblEntry *addRangeTableEntryForValues(ParseState *pstate, List *exprs, List *collations, Alias *alias, bool inFromCl); extern RangeTblEntry *addRangeTableEntryForJoin(ParseState *pstate, List *colnames, JoinType jointype, List *aliasvars, Alias *alias, bool inFromCl); extern RangeTblEntry *addRangeTableEntryForCTE(ParseState *pstate, CommonTableExpr *cte, Index levelsup, RangeVar *rv, bool inFromCl); extern bool isLockedRefname(ParseState *pstate, const char *refname); extern void addRTEtoQuery(ParseState *pstate, RangeTblEntry *rte, bool addToJoinList, bool addToRelNameSpace, bool addToVarNameSpace); extern void errorMissingRTE(ParseState *pstate, RangeVar *relation); extern void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up, int location, bool include_dropped, List **colnames, List **colvars); extern List *expandRelAttrs(ParseState *pstate, RangeTblEntry *rte, int rtindex, int sublevels_up, int location); extern int attnameAttNum(Relation rd, const char *attname, bool sysColOK); extern Name attnumAttName(Relation rd, int attid); extern Oid attnumTypeId(Relation rd, int attid); extern Oid attnumCollationId(Relation rd, int attid); #endif /* PARSE_RELATION_H */ ����������������������������������������pgsql/server/parser/parse_utilcmd.h�����������������������������������������������������������������0000644�����������������00000001726�14763166026�0013521 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * parse_utilcmd.h * parse analysis for utility commands * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/parse_utilcmd.h * *------------------------------------------------------------------------- */ #ifndef PARSE_UTILCMD_H #define PARSE_UTILCMD_H #include "parser/parse_node.h" extern List *transformCreateStmt(CreateStmt *stmt, const char *queryString); extern List *transformAlterTableStmt(Oid relid, AlterTableStmt *stmt, const char *queryString); extern IndexStmt *transformIndexStmt(Oid relid, IndexStmt *stmt, const char *queryString); extern void transformRuleStmt(RuleStmt *stmt, const char *queryString, List **actions, Node **whereClause); extern List *transformCreateSchemaStmt(CreateSchemaStmt *stmt); #endif /* PARSE_UTILCMD_H */ ������������������������������������������pgsql/server/parser/parse_oper.h��������������������������������������������������������������������0000644�����������������00000004701�14763166026�0013021 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * parse_oper.h * handle operator things for parser * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/parser/parse_oper.h * *------------------------------------------------------------------------- */ #ifndef PARSE_OPER_H #define PARSE_OPER_H #include "access/htup.h" #include "parser/parse_node.h" typedef HeapTuple Operator; /* Routines to look up an operator given name and exact input type(s) */ extern Oid LookupOperName(ParseState *pstate, List *opername, Oid oprleft, Oid oprright, bool noError, int location); extern Oid LookupOperNameTypeNames(ParseState *pstate, List *opername, TypeName *oprleft, TypeName *oprright, bool noError, int location); /* Routines to find operators matching a name and given input types */ /* NB: the selected operator may require coercion of the input types! */ extern Operator oper(ParseState *pstate, List *op, Oid arg1, Oid arg2, bool noError, int location); extern Operator right_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location); extern Operator left_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location); /* Routines to find operators that DO NOT require coercion --- ie, their */ /* input types are either exactly as given, or binary-compatible */ extern Operator compatible_oper(ParseState *pstate, List *op, Oid arg1, Oid arg2, bool noError, int location); /* currently no need for compatible_left_oper/compatible_right_oper */ /* Routines for identifying "<", "=", ">" operators for a type */ extern void get_sort_group_operators(Oid argtype, bool needLT, bool needEQ, bool needGT, Oid *ltOpr, Oid *eqOpr, Oid *gtOpr, bool *isHashable); /* Convenience routines for common calls on the above */ extern Oid compatible_oper_opid(List *op, Oid arg1, Oid arg2, bool noError); /* Extract operator OID or underlying-function OID from an Operator tuple */ extern Oid oprid(Operator op); extern Oid oprfuncid(Operator op); /* Build expression tree for an operator invocation */ extern Expr *make_op(ParseState *pstate, List *opname, Node *ltree, Node *rtree, int location); extern Expr *make_scalar_array_op(ParseState *pstate, List *opname, bool useOr, Node *ltree, Node *rtree, int location); #endif /* PARSE_OPER_H */ ���������������������������������������������������������������pgsql/server/libpq/ip.h�����������������������������������������������������������������������������0000644�����������������00000003003�14763166026�0011077 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * ip.h * Definitions for IPv6-aware network access. * * These definitions are used by both frontend and backend code. Be careful * what you include here! * * Copyright (c) 2003-2012, PostgreSQL Global Development Group * * src/include/libpq/ip.h * *------------------------------------------------------------------------- */ #ifndef IP_H #define IP_H #include "getaddrinfo.h" /* pgrminclude ignore */ #include "libpq/pqcomm.h" /* pgrminclude ignore */ #ifdef HAVE_UNIX_SOCKETS #define IS_AF_UNIX(fam) ((fam) == AF_UNIX) #else #define IS_AF_UNIX(fam) (0) #endif typedef void (*PgIfAddrCallback) (struct sockaddr * addr, struct sockaddr * netmask, void *cb_data); extern int pg_getaddrinfo_all(const char *hostname, const char *servname, const struct addrinfo * hintp, struct addrinfo ** result); extern void pg_freeaddrinfo_all(int hint_ai_family, struct addrinfo * ai); extern int pg_getnameinfo_all(const struct sockaddr_storage * addr, int salen, char *node, int nodelen, char *service, int servicelen, int flags); extern int pg_range_sockaddr(const struct sockaddr_storage * addr, const struct sockaddr_storage * netaddr, const struct sockaddr_storage * netmask); extern int pg_sockaddr_cidr_mask(struct sockaddr_storage * mask, char *numbits, int family); extern int pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data); #endif /* IP_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/libpq/be-fsstubs.h���������������������������������������������������������������������0000644�����������������00000003112�14763166026�0012545 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * be-fsstubs.h * * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/libpq/be-fsstubs.h * *------------------------------------------------------------------------- */ #ifndef BE_FSSTUBS_H #define BE_FSSTUBS_H #include "fmgr.h" /* * LO functions available via pg_proc entries */ extern Datum lo_import(PG_FUNCTION_ARGS); extern Datum lo_import_with_oid(PG_FUNCTION_ARGS); extern Datum lo_export(PG_FUNCTION_ARGS); extern Datum lo_creat(PG_FUNCTION_ARGS); extern Datum lo_create(PG_FUNCTION_ARGS); extern Datum lo_open(PG_FUNCTION_ARGS); extern Datum lo_close(PG_FUNCTION_ARGS); extern Datum loread(PG_FUNCTION_ARGS); extern Datum lowrite(PG_FUNCTION_ARGS); extern Datum lo_lseek(PG_FUNCTION_ARGS); extern Datum lo_tell(PG_FUNCTION_ARGS); extern Datum lo_unlink(PG_FUNCTION_ARGS); extern Datum lo_truncate(PG_FUNCTION_ARGS); /* * compatibility option for access control */ extern bool lo_compat_privileges; /* * These are not fmgr-callable, but are available to C code. * Probably these should have had the underscore-free names, * but too late now... */ extern int lo_read(int fd, char *buf, int len); extern int lo_write(int fd, const char *buf, int len); /* * Cleanup LOs at xact commit/abort */ extern void AtEOXact_LargeObject(bool isCommit); extern void AtEOSubXact_LargeObject(bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid); #endif /* BE_FSSTUBS_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/libpq/libpq-fs.h�����������������������������������������������������������������������0000644�����������������00000001171�14763166026�0012210 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * libpq-fs.h * definitions for using Inversion file system routines (ie, large objects) * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/libpq/libpq-fs.h * *------------------------------------------------------------------------- */ #ifndef LIBPQ_FS_H #define LIBPQ_FS_H /* * Read/write mode flags for inversion (large object) calls */ #define INV_WRITE 0x00020000 #define INV_READ 0x00040000 #endif /* LIBPQ_FS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/libpq/auth.h���������������������������������������������������������������������������0000644�����������������00000001607�14763166026�0011440 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * auth.h * Definitions for network authentication routines * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/libpq/auth.h * *------------------------------------------------------------------------- */ #ifndef AUTH_H #define AUTH_H #include "libpq/libpq-be.h" extern char *pg_krb_server_keyfile; extern char *pg_krb_srvnam; extern bool pg_krb_caseins_users; extern char *pg_krb_server_hostname; extern char *pg_krb_realm; extern void ClientAuthentication(Port *port); /* Hook for plugins to get control in ClientAuthentication() */ typedef void (*ClientAuthentication_hook_type) (Port *, int); extern PGDLLIMPORT ClientAuthentication_hook_type ClientAuthentication_hook; #endif /* AUTH_H */ �������������������������������������������������������������������������������������������������������������������������pgsql/server/libpq/hba.h����������������������������������������������������������������������������0000644�����������������00000003364�14763166026�0011233 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * hba.h * Interface to hba.c * * * src/include/libpq/hba.h * *------------------------------------------------------------------------- */ #ifndef HBA_H #define HBA_H #include "libpq/pqcomm.h" /* pgrminclude ignore */ /* needed for NetBSD */ #include "nodes/pg_list.h" typedef enum UserAuth { uaReject, uaImplicitReject, uaKrb5, uaTrust, uaIdent, uaPassword, uaMD5, uaGSS, uaSSPI, uaPAM, uaLDAP, uaCert, uaRADIUS, uaPeer } UserAuth; typedef enum IPCompareMethod { ipCmpMask, ipCmpSameHost, ipCmpSameNet, ipCmpAll } IPCompareMethod; typedef enum ConnType { ctLocal, ctHost, ctHostSSL, ctHostNoSSL } ConnType; typedef struct HbaLine { int linenumber; ConnType conntype; List *databases; List *roles; struct sockaddr_storage addr; struct sockaddr_storage mask; IPCompareMethod ip_cmp_method; char *hostname; UserAuth auth_method; char *usermap; char *pamservice; bool ldaptls; char *ldapserver; int ldapport; char *ldapbinddn; char *ldapbindpasswd; char *ldapsearchattribute; char *ldapbasedn; char *ldapprefix; char *ldapsuffix; bool clientcert; char *krb_server_hostname; char *krb_realm; bool include_realm; char *radiusserver; char *radiussecret; char *radiusidentifier; int radiusport; } HbaLine; /* kluge to avoid including libpq/libpq-be.h here */ typedef struct Port hbaPort; extern bool load_hba(void); extern void load_ident(void); extern void hba_getauthmethod(hbaPort *port); extern int check_usermap(const char *usermap_name, const char *pg_role, const char *auth_user, bool case_sensitive); extern bool pg_isblank(const char c); #endif /* HBA_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/libpq/libpq.h��������������������������������������������������������������������������0000644�����������������00000005050�14763166026�0011602 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * libpq.h * POSTGRES LIBPQ buffer structure definitions. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/libpq/libpq.h * *------------------------------------------------------------------------- */ #ifndef LIBPQ_H #define LIBPQ_H #include <sys/types.h> #include <netinet/in.h> #include "lib/stringinfo.h" #include "libpq/libpq-be.h" /* ---------------- * PQArgBlock * Information (pointer to array of this structure) required * for the PQfn() call. (This probably ought to go somewhere else...) * ---------------- */ typedef struct { int len; int isint; union { int *ptr; /* can't use void (dec compiler barfs) */ int integer; } u; } PQArgBlock; /* * External functions. */ /* * prototypes for functions in pqcomm.c */ extern int StreamServerPort(int family, char *hostName, unsigned short portNumber, char *unixSocketDir, pgsocket ListenSocket[], int MaxListen); extern int StreamConnection(pgsocket server_fd, Port *port); extern void StreamClose(pgsocket sock); extern void TouchSocketFiles(void); extern void pq_init(void); extern void pq_comm_reset(void); extern int pq_getbytes(char *s, size_t len); extern int pq_getstring(StringInfo s); extern void pq_startmsgread(void); extern void pq_endmsgread(void); extern bool pq_is_reading_msg(void); extern int pq_getmessage(StringInfo s, int maxlen); extern int pq_getbyte(void); extern int pq_peekbyte(void); extern int pq_getbyte_if_available(unsigned char *c); extern bool pq_buffer_has_data(void); extern int pq_putbytes(const char *s, size_t len); extern int pq_flush(void); extern int pq_flush_if_writable(void); extern bool pq_is_send_pending(void); extern int pq_putmessage(char msgtype, const char *s, size_t len); extern void pq_putmessage_noblock(char msgtype, const char *s, size_t len); extern void pq_startcopyout(void); extern void pq_endcopyout(bool errorAbort); /* * prototypes for functions in be-secure.c */ extern char *ssl_cert_file; extern char *ssl_key_file; extern char *ssl_ca_file; extern char *ssl_crl_file; extern int secure_initialize(void); extern bool secure_loaded_verify_locations(void); extern void secure_destroy(void); extern int secure_open_server(Port *port); extern void secure_close(Port *port); extern ssize_t secure_read(Port *port, void *ptr, size_t len); extern ssize_t secure_write(Port *port, void *ptr, size_t len); #endif /* LIBPQ_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/libpq/md5.h����������������������������������������������������������������������������0000644�����������������00000001605�14763166026�0011162 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * md5.h * Interface to libpq/md5.c * * These definitions are needed by both frontend and backend code to work * with MD5-encrypted passwords. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/libpq/md5.h * *------------------------------------------------------------------------- */ #ifndef PG_MD5_H #define PG_MD5_H #define MD5_PASSWD_LEN 35 #define isMD5(passwd) (strncmp(passwd, "md5", 3) == 0 && \ strlen(passwd) == MD5_PASSWD_LEN) extern bool pg_md5_hash(const void *buff, size_t len, char *hexsum); extern bool pg_md5_binary(const void *buff, size_t len, void *outbuf); extern bool pg_md5_encrypt(const char *passwd, const char *salt, size_t salt_len, char *buf); #endif ���������������������������������������������������������������������������������������������������������������������������pgsql/server/libpq/pqsignal.h�����������������������������������������������������������������������0000644�����������������00000002424�14763166026�0012313 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pqsignal.h * prototypes for the reliable BSD-style signal(2) routine. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/libpq/pqsignal.h * * NOTES * This shouldn't be in libpq, but the monitor and some other * things need it... * *------------------------------------------------------------------------- */ #ifndef PQSIGNAL_H #define PQSIGNAL_H #include <signal.h> #ifdef HAVE_SIGPROCMASK extern sigset_t UnBlockSig, BlockSig, StartupBlockSig; #define PG_SETMASK(mask) sigprocmask(SIG_SETMASK, mask, NULL) #else /* not HAVE_SIGPROCMASK */ extern int UnBlockSig, BlockSig, StartupBlockSig; #ifndef WIN32 #define PG_SETMASK(mask) sigsetmask(*((int*)(mask))) #else #define PG_SETMASK(mask) pqsigsetmask(*((int*)(mask))) int pqsigsetmask(int mask); #endif #define sigaddset(set, signum) (*(set) |= (sigmask(signum))) #define sigdelset(set, signum) (*(set) &= ~(sigmask(signum))) #endif /* not HAVE_SIGPROCMASK */ typedef void (*pqsigfunc) (int); extern void pqinitmask(void); extern pqsigfunc pqsignal(int signo, pqsigfunc func); #endif /* PQSIGNAL_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/libpq/pqformat.h�����������������������������������������������������������������������0000644�����������������00000003715�14763166026�0012332 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pqformat.h * Definitions for formatting and parsing frontend/backend messages * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/libpq/pqformat.h * *------------------------------------------------------------------------- */ #ifndef PQFORMAT_H #define PQFORMAT_H #include "lib/stringinfo.h" extern void pq_beginmessage(StringInfo buf, char msgtype); extern void pq_sendbyte(StringInfo buf, int byt); extern void pq_sendbytes(StringInfo buf, const char *data, int datalen); extern void pq_sendcountedtext(StringInfo buf, const char *str, int slen, bool countincludesself); extern void pq_sendtext(StringInfo buf, const char *str, int slen); extern void pq_sendstring(StringInfo buf, const char *str); extern void pq_send_ascii_string(StringInfo buf, const char *str); extern void pq_sendint(StringInfo buf, int i, int b); extern void pq_sendint64(StringInfo buf, int64 i); extern void pq_sendfloat4(StringInfo buf, float4 f); extern void pq_sendfloat8(StringInfo buf, float8 f); extern void pq_endmessage(StringInfo buf); extern void pq_begintypsend(StringInfo buf); extern bytea *pq_endtypsend(StringInfo buf); extern void pq_puttextmessage(char msgtype, const char *str); extern void pq_putemptymessage(char msgtype); extern int pq_getmsgbyte(StringInfo msg); extern unsigned int pq_getmsgint(StringInfo msg, int b); extern int64 pq_getmsgint64(StringInfo msg); extern float4 pq_getmsgfloat4(StringInfo msg); extern float8 pq_getmsgfloat8(StringInfo msg); extern const char *pq_getmsgbytes(StringInfo msg, int datalen); extern void pq_copymsgbytes(StringInfo msg, char *buf, int datalen); extern char *pq_getmsgtext(StringInfo msg, int rawbytes, int *nbytes); extern const char *pq_getmsgstring(StringInfo msg); extern void pq_getmsgend(StringInfo msg); #endif /* PQFORMAT_H */ ���������������������������������������������������pgsql/server/libpq/libpq-be.h�����������������������������������������������������������������������0000644�����������������00000014252�14763166026�0012172 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * libpq_be.h * This file contains definitions for structures and externs used * by the postmaster during client authentication. * * Note that this is backend-internal and is NOT exported to clients. * Structs that need to be client-visible are in pqcomm.h. * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/libpq/libpq-be.h * *------------------------------------------------------------------------- */ #ifndef LIBPQ_BE_H #define LIBPQ_BE_H #ifdef HAVE_SYS_TIME_H #include <sys/time.h> #endif #ifdef USE_SSL #include <openssl/ssl.h> #include <openssl/err.h> #endif #ifdef HAVE_NETINET_TCP_H #include <netinet/tcp.h> #endif #ifdef ENABLE_GSS #if defined(HAVE_GSSAPI_H) #include <gssapi.h> #else #include <gssapi/gssapi.h> #endif /* HAVE_GSSAPI_H */ /* * GSSAPI brings in headers that set a lot of things in the global namespace on win32, * that doesn't match the msvc build. It gives a bunch of compiler warnings that we ignore, * but also defines a symbol that simply does not exist. Undefine it again. */ #ifdef WIN32_ONLY_COMPILER #undef HAVE_GETADDRINFO #endif #endif /* ENABLE_GSS */ #ifdef ENABLE_SSPI #define SECURITY_WIN32 #if defined(WIN32) && !defined(WIN32_ONLY_COMPILER) #include <ntsecapi.h> #endif #include <security.h> #undef SECURITY_WIN32 #ifndef ENABLE_GSS /* * Define a fake structure compatible with GSSAPI on Unix. */ typedef struct { void *value; int length; } gss_buffer_desc; #endif #endif /* ENABLE_SSPI */ #include "datatype/timestamp.h" #include "libpq/hba.h" #include "libpq/pqcomm.h" typedef enum CAC_state { CAC_OK, CAC_STARTUP, CAC_SHUTDOWN, CAC_RECOVERY, CAC_TOOMANY, CAC_WAITBACKUP } CAC_state; /* * GSSAPI specific state information */ #if defined(ENABLE_GSS) | defined(ENABLE_SSPI) typedef struct { gss_buffer_desc outbuf; /* GSSAPI output token buffer */ #ifdef ENABLE_GSS gss_cred_id_t cred; /* GSSAPI connection cred's */ gss_ctx_id_t ctx; /* GSSAPI connection context */ gss_name_t name; /* GSSAPI client name */ #endif } pg_gssinfo; #endif /* * This is used by the postmaster in its communication with frontends. It * contains all state information needed during this communication before the * backend is run. The Port structure is kept in malloc'd memory and is * still available when a backend is running (see MyProcPort). The data * it points to must also be malloc'd, or else palloc'd in TopMemoryContext, * so that it survives into PostgresMain execution! * * remote_hostname is set if we did a successful reverse lookup of the * client's IP address during connection setup. * remote_hostname_resolv tracks the state of hostname verification: * +1 = remote_hostname is known to resolve to client's IP address * -1 = remote_hostname is known NOT to resolve to client's IP address * 0 = we have not done the forward DNS lookup yet * -2 = there was an error in name resolution * If reverse lookup of the client IP address fails, remote_hostname will be * left NULL while remote_hostname_resolv is set to -2. If reverse lookup * succeeds but forward lookup fails, remote_hostname_resolv is also set to -2 * (the case is distinguishable because remote_hostname isn't NULL). In * either of the -2 cases, remote_hostname_errcode saves the lookup return * code for possible later use with gai_strerror. */ typedef struct Port { pgsocket sock; /* File descriptor */ bool noblock; /* is the socket in non-blocking mode? */ ProtocolVersion proto; /* FE/BE protocol version */ SockAddr laddr; /* local addr (postmaster) */ SockAddr raddr; /* remote addr (client) */ char *remote_host; /* name (or ip addr) of remote host */ char *remote_hostname;/* name (not ip addr) of remote host, if * available */ int remote_hostname_resolv; /* see above */ char *remote_port; /* text rep of remote port */ CAC_state canAcceptConnections; /* postmaster connection status */ /* * Information that needs to be saved from the startup packet and passed * into backend execution. "char *" fields are NULL if not set. * guc_options points to a List of alternating option names and values. */ char *database_name; char *user_name; char *cmdline_options; List *guc_options; /* * Information that needs to be held during the authentication cycle. */ HbaLine *hba; char md5Salt[4]; /* Password salt */ /* * Information that really has no business at all being in struct Port, * but since it gets used by elog.c in the same way as database_name and * other members of this struct, we may as well keep it here. */ TimestampTz SessionStartTime; /* backend start time */ /* * TCP keepalive settings. * * default values are 0 if AF_UNIX or not yet known; current values are 0 * if AF_UNIX or using the default. Also, -1 in a default value means we * were unable to find out the default (getsockopt failed). */ int default_keepalives_idle; int default_keepalives_interval; int default_keepalives_count; int keepalives_idle; int keepalives_interval; int keepalives_count; #if defined(ENABLE_GSS) || defined(ENABLE_SSPI) /* * If GSSAPI is supported, store GSSAPI information. Otherwise, store a * NULL pointer to make sure offsets in the struct remain the same. */ pg_gssinfo *gss; #else void *gss; #endif /* * SSL structures (keep these last so that USE_SSL doesn't affect * locations of other fields) */ #ifdef USE_SSL SSL *ssl; X509 *peer; char *peer_cn; unsigned long count; #endif /* This field will be in a saner place in 9.4 and up */ int remote_hostname_errcode; /* see above */ } Port; extern ProtocolVersion FrontendProtocol; /* TCP keepalives configuration. These are no-ops on an AF_UNIX socket. */ extern int pq_getkeepalivesidle(Port *port); extern int pq_getkeepalivesinterval(Port *port); extern int pq_getkeepalivescount(Port *port); extern int pq_setkeepalivesidle(int idle, Port *port); extern int pq_setkeepalivesinterval(int interval, Port *port); extern int pq_setkeepalivescount(int count, Port *port); #endif /* LIBPQ_BE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/libpq/crypt.h��������������������������������������������������������������������������0000644�����������������00000001046�14763166026�0011635 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * crypt.h * Interface to libpq/crypt.c * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/libpq/crypt.h * *------------------------------------------------------------------------- */ #ifndef PG_CRYPT_H #define PG_CRYPT_H #include "libpq/libpq-be.h" extern int md5_crypt_verify(const Port *port, const char *user, char *client_pass); #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/libpq/pqcomm.h�������������������������������������������������������������������������0000644�����������������00000014557�14763166026�0012003 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * pqcomm.h * Definitions common to frontends and backends. * * NOTE: for historical reasons, this does not correspond to pqcomm.c. * pqcomm.c's routines are declared in libpq.h. * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/libpq/pqcomm.h * *------------------------------------------------------------------------- */ #ifndef PQCOMM_H #define PQCOMM_H #include <sys/socket.h> #include <netdb.h> #ifdef HAVE_SYS_UN_H #include <sys/un.h> #endif #include <netinet/in.h> #ifdef HAVE_STRUCT_SOCKADDR_STORAGE #ifndef HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY #ifdef HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY #define ss_family __ss_family #else #error struct sockaddr_storage does not provide an ss_family member #endif #endif #ifdef HAVE_STRUCT_SOCKADDR_STORAGE___SS_LEN #define ss_len __ss_len #define HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN 1 #endif #else /* !HAVE_STRUCT_SOCKADDR_STORAGE */ /* Define a struct sockaddr_storage if we don't have one. */ struct sockaddr_storage { union { struct sockaddr sa; /* get the system-dependent fields */ int64 ss_align; /* ensures struct is properly aligned */ char ss_pad[128]; /* ensures struct has desired size */ } ss_stuff; }; #define ss_family ss_stuff.sa.sa_family /* It should have an ss_len field if sockaddr has sa_len. */ #ifdef HAVE_STRUCT_SOCKADDR_SA_LEN #define ss_len ss_stuff.sa.sa_len #define HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN 1 #endif #endif /* HAVE_STRUCT_SOCKADDR_STORAGE */ typedef struct { struct sockaddr_storage addr; ACCEPT_TYPE_ARG3 salen; } SockAddr; /* Configure the UNIX socket location for the well known port. */ #define UNIXSOCK_PATH(path, port, sockdir) \ snprintf(path, sizeof(path), "%s/.s.PGSQL.%d", \ ((sockdir) && *(sockdir) != '\0') ? (sockdir) : \ DEFAULT_PGSOCKET_DIR, \ (port)) /* * The maximum workable length of a socket path is what will fit into * struct sockaddr_un. This is usually only 100 or so bytes :-(. * * For consistency, always pass a MAXPGPATH-sized buffer to UNIXSOCK_PATH(), * then complain if the resulting string is >= UNIXSOCK_PATH_BUFLEN bytes. * (Because the standard API for getaddrinfo doesn't allow it to complain in * a useful way when the socket pathname is too long, we have to test for * this explicitly, instead of just letting the subroutine return an error.) */ #define UNIXSOCK_PATH_BUFLEN sizeof(((struct sockaddr_un *) NULL)->sun_path) /* * These manipulate the frontend/backend protocol version number. * * The major number should be incremented for incompatible changes. The minor * number should be incremented for compatible changes (eg. additional * functionality). * * If a backend supports version m.n of the protocol it must actually support * versions m.[0..n]. Backend support for version m-1 can be dropped after a * `reasonable' length of time. * * A frontend isn't required to support anything other than the current * version. */ #define PG_PROTOCOL_MAJOR(v) ((v) >> 16) #define PG_PROTOCOL_MINOR(v) ((v) & 0x0000ffff) #define PG_PROTOCOL(m,n) (((m) << 16) | (n)) /* The earliest and latest frontend/backend protocol version supported. */ #define PG_PROTOCOL_EARLIEST PG_PROTOCOL(1,0) #define PG_PROTOCOL_LATEST PG_PROTOCOL(3,0) typedef uint32 ProtocolVersion; /* FE/BE protocol version number */ typedef ProtocolVersion MsgType; /* * Packet lengths are 4 bytes in network byte order. * * The initial length is omitted from the packet layouts appearing below. */ typedef uint32 PacketLen; /* * Old-style startup packet layout with fixed-width fields. This is used in * protocol 1.0 and 2.0, but not in later versions. Note that the fields * in this layout are '\0' terminated only if there is room. */ #define SM_DATABASE 64 #define SM_USER 32 /* We append database name if db_user_namespace true. */ #define SM_DATABASE_USER (SM_DATABASE+SM_USER+1) /* +1 for @ */ #define SM_OPTIONS 64 #define SM_UNUSED 64 #define SM_TTY 64 typedef struct StartupPacket { ProtocolVersion protoVersion; /* Protocol version */ char database[SM_DATABASE]; /* Database name */ /* Db_user_namespace appends dbname */ char user[SM_USER]; /* User name */ char options[SM_OPTIONS]; /* Optional additional args */ char unused[SM_UNUSED]; /* Unused */ char tty[SM_TTY]; /* Tty for debug output */ } StartupPacket; extern bool Db_user_namespace; /* * In protocol 3.0 and later, the startup packet length is not fixed, but * we set an arbitrary limit on it anyway. This is just to prevent simple * denial-of-service attacks via sending enough data to run the server * out of memory. */ #define MAX_STARTUP_PACKET_LENGTH 10000 /* These are the authentication request codes sent by the backend. */ #define AUTH_REQ_OK 0 /* User is authenticated */ #define AUTH_REQ_KRB4 1 /* Kerberos V4. Not supported any more. */ #define AUTH_REQ_KRB5 2 /* Kerberos V5 */ #define AUTH_REQ_PASSWORD 3 /* Password */ #define AUTH_REQ_CRYPT 4 /* crypt password. Not supported any more. */ #define AUTH_REQ_MD5 5 /* md5 password */ #define AUTH_REQ_SCM_CREDS 6 /* transfer SCM credentials */ #define AUTH_REQ_GSS 7 /* GSSAPI without wrap() */ #define AUTH_REQ_GSS_CONT 8 /* Continue GSS exchanges */ #define AUTH_REQ_SSPI 9 /* SSPI negotiate without wrap() */ #define AUTH_REQ_SASL 10 /* SASL authentication. Not supported before * libpq version 10. */ typedef uint32 AuthRequest; /* * A client can also send a cancel-current-operation request to the postmaster. * This is uglier than sending it directly to the client's backend, but it * avoids depending on out-of-band communication facilities. * * The cancel request code must not match any protocol version number * we're ever likely to use. This random choice should do. */ #define CANCEL_REQUEST_CODE PG_PROTOCOL(1234,5678) typedef struct CancelRequestPacket { /* Note that each field is stored in network byte order! */ MsgType cancelRequestCode; /* code to identify a cancel request */ uint32 backendPID; /* PID of client's backend */ uint32 cancelAuthCode; /* secret key to authorize cancel */ } CancelRequestPacket; /* * A client can also start by sending a SSL negotiation request, to get a * secure channel. */ #define NEGOTIATE_SSL_CODE PG_PROTOCOL(1234,5679) #endif /* PQCOMM_H */ �������������������������������������������������������������������������������������������������������������������������������������������������pgsql/server/portability/instr_time.h���������������������������������������������������������������0000644�����������������00000010250�14763166026�0014101 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * instr_time.h * portable high-precision interval timing * * This file provides an abstraction layer to hide portability issues in * interval timing. On Unix we use gettimeofday(), but on Windows that * gives a low-precision result so we must use QueryPerformanceCounter() * instead. These macros also give some breathing room to use other * high-precision-timing APIs on yet other platforms. * * The basic data type is instr_time, which all callers should treat as an * opaque typedef. instr_time can store either an absolute time (of * unspecified reference time) or an interval. The operations provided * for it are: * * INSTR_TIME_IS_ZERO(t) is t equal to zero? * * INSTR_TIME_SET_ZERO(t) set t to zero (memset is acceptable too) * * INSTR_TIME_SET_CURRENT(t) set t to current time * * INSTR_TIME_ADD(x, y) x += y * * INSTR_TIME_SUBTRACT(x, y) x -= y * * INSTR_TIME_ACCUM_DIFF(x, y, z) x += (y - z) * * INSTR_TIME_GET_DOUBLE(t) convert t to double (in seconds) * * INSTR_TIME_GET_MILLISEC(t) convert t to double (in milliseconds) * * INSTR_TIME_GET_MICROSEC(t) convert t to uint64 (in microseconds) * * Note that INSTR_TIME_SUBTRACT and INSTR_TIME_ACCUM_DIFF convert * absolute times to intervals. The INSTR_TIME_GET_xxx operations are * only useful on intervals. * * When summing multiple measurements, it's recommended to leave the * running sum in instr_time form (ie, use INSTR_TIME_ADD or * INSTR_TIME_ACCUM_DIFF) and convert to a result format only at the end. * * Beware of multiple evaluations of the macro arguments. * * * Copyright (c) 2001-2012, PostgreSQL Global Development Group * * src/include/portability/instr_time.h * *------------------------------------------------------------------------- */ #ifndef INSTR_TIME_H #define INSTR_TIME_H #ifndef WIN32 #include <sys/time.h> typedef struct timeval instr_time; #define INSTR_TIME_IS_ZERO(t) ((t).tv_usec == 0 && (t).tv_sec == 0) #define INSTR_TIME_SET_ZERO(t) ((t).tv_sec = 0, (t).tv_usec = 0) #define INSTR_TIME_SET_CURRENT(t) gettimeofday(&(t), NULL) #define INSTR_TIME_ADD(x,y) \ do { \ (x).tv_sec += (y).tv_sec; \ (x).tv_usec += (y).tv_usec; \ /* Normalize */ \ while ((x).tv_usec >= 1000000) \ { \ (x).tv_usec -= 1000000; \ (x).tv_sec++; \ } \ } while (0) #define INSTR_TIME_SUBTRACT(x,y) \ do { \ (x).tv_sec -= (y).tv_sec; \ (x).tv_usec -= (y).tv_usec; \ /* Normalize */ \ while ((x).tv_usec < 0) \ { \ (x).tv_usec += 1000000; \ (x).tv_sec--; \ } \ } while (0) #define INSTR_TIME_ACCUM_DIFF(x,y,z) \ do { \ (x).tv_sec += (y).tv_sec - (z).tv_sec; \ (x).tv_usec += (y).tv_usec - (z).tv_usec; \ /* Normalize after each add to avoid overflow/underflow of tv_usec */ \ while ((x).tv_usec < 0) \ { \ (x).tv_usec += 1000000; \ (x).tv_sec--; \ } \ while ((x).tv_usec >= 1000000) \ { \ (x).tv_usec -= 1000000; \ (x).tv_sec++; \ } \ } while (0) #define INSTR_TIME_GET_DOUBLE(t) \ (((double) (t).tv_sec) + ((double) (t).tv_usec) / 1000000.0) #define INSTR_TIME_GET_MILLISEC(t) \ (((double) (t).tv_sec * 1000.0) + ((double) (t).tv_usec) / 1000.0) #define INSTR_TIME_GET_MICROSEC(t) \ (((uint64) (t).tv_sec * (uint64) 1000000) + (uint64) (t).tv_usec) #else /* WIN32 */ typedef LARGE_INTEGER instr_time; #define INSTR_TIME_IS_ZERO(t) ((t).QuadPart == 0) #define INSTR_TIME_SET_ZERO(t) ((t).QuadPart = 0) #define INSTR_TIME_SET_CURRENT(t) QueryPerformanceCounter(&(t)) #define INSTR_TIME_ADD(x,y) \ ((x).QuadPart += (y).QuadPart) #define INSTR_TIME_SUBTRACT(x,y) \ ((x).QuadPart -= (y).QuadPart) #define INSTR_TIME_ACCUM_DIFF(x,y,z) \ ((x).QuadPart += (y).QuadPart - (z).QuadPart) #define INSTR_TIME_GET_DOUBLE(t) \ (((double) (t).QuadPart) / GetTimerFrequency()) #define INSTR_TIME_GET_MILLISEC(t) \ (((double) (t).QuadPart * 1000.0) / GetTimerFrequency()) #define INSTR_TIME_GET_MICROSEC(t) \ ((uint64) (((double) (t).QuadPart * 1000000.0) / GetTimerFrequency())) static inline double GetTimerFrequency(void) { LARGE_INTEGER f; QueryPerformanceFrequency(&f); return (double) f.QuadPart; } #endif /* WIN32 */ #endif /* INSTR_TIME_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������stdio_ext.h�����������������������������������������������������������������������������������������0000644�����������������00000005366�14763166027�0006745 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Functions to access FILE structure internals. Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* This header contains the same definitions as the header of the same name on Sun's Solaris OS. */ #ifndef _STDIO_EXT_H #define _STDIO_EXT_H 1 #include <stdio.h> enum { /* Query current state of the locking status. */ FSETLOCKING_QUERY = 0, #define FSETLOCKING_QUERY FSETLOCKING_QUERY /* The library protects all uses of the stream functions, except for uses of the *_unlocked functions, by calls equivalent to flockfile(). */ FSETLOCKING_INTERNAL, #define FSETLOCKING_INTERNAL FSETLOCKING_INTERNAL /* The user will take care of locking. */ FSETLOCKING_BYCALLER #define FSETLOCKING_BYCALLER FSETLOCKING_BYCALLER }; __BEGIN_DECLS /* Return the size of the buffer of FP in bytes currently in use by the given stream. */ extern size_t __fbufsize (FILE *__fp) __THROW; /* Return non-zero value iff the stream FP is opened readonly, or if the last operation on the stream was a read operation. */ extern int __freading (FILE *__fp) __THROW; /* Return non-zero value iff the stream FP is opened write-only or append-only, or if the last operation on the stream was a write operation. */ extern int __fwriting (FILE *__fp) __THROW; /* Return non-zero value iff stream FP is not opened write-only or append-only. */ extern int __freadable (FILE *__fp) __THROW; /* Return non-zero value iff stream FP is not opened read-only. */ extern int __fwritable (FILE *__fp) __THROW; /* Return non-zero value iff the stream FP is line-buffered. */ extern int __flbf (FILE *__fp) __THROW; /* Discard all pending buffered I/O on the stream FP. */ extern void __fpurge (FILE *__fp) __THROW; /* Return amount of output in bytes pending on a stream FP. */ extern size_t __fpending (FILE *__fp) __THROW; /* Flush all line-buffered files. */ extern void _flushlbf (void); /* Set locking status of stream FP to TYPE. */ extern int __fsetlocking (FILE *__fp, int __type) __THROW; __END_DECLS #endif /* stdio_ext.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ar.h������������������������������������������������������������������������������������������������0000644�����������������00000003275�14763166027�0005342 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Header describing `ar' archive file format. Copyright (C) 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _AR_H #define _AR_H 1 #include <sys/cdefs.h> /* Archive files start with the ARMAG identifying string. Then follows a `struct ar_hdr', and as many bytes of member file data as its `ar_size' member indicates, for each member file. */ #define ARMAG "!<arch>\n" /* String that begins an archive file. */ #define SARMAG 8 /* Size of that string. */ #define ARFMAG "`\n" /* String in ar_fmag at end of each header. */ __BEGIN_DECLS struct ar_hdr { char ar_name[16]; /* Member file name, sometimes / terminated. */ char ar_date[12]; /* File date, decimal seconds since Epoch. */ char ar_uid[6], ar_gid[6]; /* User and group IDs, in ASCII decimal. */ char ar_mode[8]; /* File mode, in ASCII octal. */ char ar_size[10]; /* File size, in ASCII decimal. */ char ar_fmag[2]; /* Always contains ARFMAG. */ }; __END_DECLS #endif /* ar.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netipx/ipx.h����������������������������������������������������������������������������������������0000644�����������������00000005554�14763166027�0007051 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991, 92, 93, 95, 96, 97, 98 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __NETIPX_IPX_H #define __NETIPX_IPX_H 1 #include <features.h> #include <sys/types.h> #include <bits/sockaddr.h> __BEGIN_DECLS #define SOL_IPX 256 /* sockopt level */ #define IPX_TYPE 1 #define IPX_NODE_LEN 6 #define IPX_MTU 576 struct sockaddr_ipx { sa_family_t sipx_family; u_int16_t sipx_port; u_int32_t sipx_network; unsigned char sipx_node[IPX_NODE_LEN]; u_int8_t sipx_type; unsigned char sipx_zero; /* 16 byte fill */ }; /* * So we can fit the extra info for SIOCSIFADDR into the address nicely */ #define sipx_special sipx_port #define sipx_action sipx_zero #define IPX_DLTITF 0 #define IPX_CRTITF 1 typedef struct ipx_route_definition { unsigned long ipx_network; unsigned long ipx_router_network; unsigned char ipx_router_node[IPX_NODE_LEN]; } ipx_route_definition; typedef struct ipx_interface_definition { unsigned long ipx_network; unsigned char ipx_device[16]; unsigned char ipx_dlink_type; #define IPX_FRAME_NONE 0 #define IPX_FRAME_SNAP 1 #define IPX_FRAME_8022 2 #define IPX_FRAME_ETHERII 3 #define IPX_FRAME_8023 4 #define IPX_FRAME_TR_8022 5 unsigned char ipx_special; #define IPX_SPECIAL_NONE 0 #define IPX_PRIMARY 1 #define IPX_INTERNAL 2 unsigned char ipx_node[IPX_NODE_LEN]; } ipx_interface_definition; typedef struct ipx_config_data { unsigned char ipxcfg_auto_select_primary; unsigned char ipxcfg_auto_create_interfaces; } ipx_config_data; /* * OLD Route Definition for backward compatibility. */ struct ipx_route_def { unsigned long ipx_network; unsigned long ipx_router_network; #define IPX_ROUTE_NO_ROUTER 0 unsigned char ipx_router_node[IPX_NODE_LEN]; unsigned char ipx_device[16]; unsigned short ipx_flags; #define IPX_RT_SNAP 8 #define IPX_RT_8022 4 #define IPX_RT_BLUEBOOK 2 #define IPX_RT_ROUTED 1 }; #define SIOCAIPXITFCRT (SIOCPROTOPRIVATE) #define SIOCAIPXPRISLT (SIOCPROTOPRIVATE + 1) #define SIOCIPXCFGDATA (SIOCPROTOPRIVATE + 2) #define SIOCIPXNCPCONN (SIOCPROTOPRIVATE + 3) __END_DECLS #endif /* netipx/ipx.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������monetary.h������������������������������������������������������������������������������������������0000644�����������������00000003351�14763166027�0006571 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Header file for monetary value formatting functions. Copyright (C) 1996,1997,1998,1999,2000,2002,2006,2009,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MONETARY_H #define _MONETARY_H 1 #include <features.h> /* Get needed types. */ #define __need_size_t #include <stddef.h> #include <bits/types.h> #ifndef __ssize_t_defined typedef __ssize_t ssize_t; # define __ssize_t_defined #endif __BEGIN_DECLS /* Formatting a monetary value according to the current locale. */ extern ssize_t strfmon (char *__restrict __s, size_t __maxsize, const char *__restrict __format, ...) __THROW __attribute_format_strfmon__ (3, 4); #ifdef __USE_XOPEN2K8 # include <xlocale.h> /* Formatting a monetary value according to the current locale. */ extern ssize_t strfmon_l (char *__restrict __s, size_t __maxsize, __locale_t __loc, const char *__restrict __format, ...) __THROW __attribute_format_strfmon__ (4, 5); #endif #ifdef __LDBL_COMPAT # include <bits/monetary-ldbl.h> #endif __END_DECLS #endif /* monetary.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/ibpkeys.h�������������������������������������������������������������������������������������0000644�����������������00000002456�14763166027�0007530 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_IBPKEYS_H_ #define _SEPOL_IBPKEYS_H_ #include <sepol/handle.h> #include <sepol/policydb.h> #include <sepol/ibpkey_record.h> #include <sys/cdefs.h> __BEGIN_DECLS /* Return the number of ibpkeys */ extern int sepol_ibpkey_count(sepol_handle_t *handle, const sepol_policydb_t *p, unsigned int *response); /* Check if a ibpkey exists */ extern int sepol_ibpkey_exists(sepol_handle_t *handle, const sepol_policydb_t *policydb, const sepol_ibpkey_key_t *key, int *response); /* Query a ibpkey - returns the ibpkey, or NULL if not found */ extern int sepol_ibpkey_query(sepol_handle_t *handle, const sepol_policydb_t *policydb, const sepol_ibpkey_key_t *key, sepol_ibpkey_t **response); /* Modify a ibpkey, or add it, if the key is not found */ extern int sepol_ibpkey_modify(sepol_handle_t *handle, sepol_policydb_t *policydb, const sepol_ibpkey_key_t *key, const sepol_ibpkey_t *data); /* Iterate the ibpkeys * The handler may return: * -1 to signal an error condition, * 1 to signal successful exit * 0 to signal continue */ extern int sepol_ibpkey_iterate(sepol_handle_t *handle, const sepol_policydb_t *policydb, int (*fn)(const sepol_ibpkey_t *ibpkey, void *fn_arg), void *arg); __END_DECLS #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/context_record.h������������������������������������������������������������������������������0000644�����������������00000003163�14763166027�0011100 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_CONTEXT_RECORD_H_ #define _SEPOL_CONTEXT_RECORD_H_ #include <sepol/handle.h> #include <sys/cdefs.h> __BEGIN_DECLS struct sepol_context; typedef struct sepol_context sepol_context_t; /* We don't need a key, because the context is never stored * in a data collection by itself */ /* User */ extern const char *sepol_context_get_user(const sepol_context_t * con); extern int sepol_context_set_user(sepol_handle_t * handle, sepol_context_t * con, const char *user); /* Role */ extern const char *sepol_context_get_role(const sepol_context_t * con); extern int sepol_context_set_role(sepol_handle_t * handle, sepol_context_t * con, const char *role); /* Type */ extern const char *sepol_context_get_type(const sepol_context_t * con); extern int sepol_context_set_type(sepol_handle_t * handle, sepol_context_t * con, const char *type); /* MLS */ extern const char *sepol_context_get_mls(const sepol_context_t * con); extern int sepol_context_set_mls(sepol_handle_t * handle, sepol_context_t * con, const char *mls_range); /* Create/Clone/Destroy */ extern int sepol_context_create(sepol_handle_t * handle, sepol_context_t ** con_ptr); extern int sepol_context_clone(sepol_handle_t * handle, const sepol_context_t * con, sepol_context_t ** con_ptr); extern void sepol_context_free(sepol_context_t * con); /* Parse to/from string */ extern int sepol_context_from_string(sepol_handle_t * handle, const char *str, sepol_context_t ** con); extern int sepol_context_to_string(sepol_handle_t * handle, const sepol_context_t * con, char **str_ptr); __END_DECLS #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/booleans.h������������������������������������������������������������������������������������0000644�����������������00000004253�14763166027�0007661 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_BOOLEANS_H_ #define _SEPOL_BOOLEANS_H_ #include <stddef.h> #include <sepol/policydb.h> #include <sepol/boolean_record.h> #include <sepol/handle.h> #include <sys/cdefs.h> __BEGIN_DECLS /*--------------compatibility--------------*/ /* Given an existing binary policy (starting at 'data', with length 'len') and a boolean configuration file named by 'boolpath', rewrite the binary policy for the boolean settings in the boolean configuration file. The binary policy is rewritten in place in memory. Returns 0 upon success, or -1 otherwise. */ extern int sepol_genbools(void *data, size_t len, char *boolpath); /* Given an existing binary policy (starting at 'data', with length 'len') and boolean settings specified by the parallel arrays ('names', 'values') with 'nel' elements, rewrite the binary policy for the boolean settings. The binary policy is rewritten in place in memory. Returns 0 upon success or -1 otherwise. */ extern int sepol_genbools_array(void *data, size_t len, char **names, int *values, int nel); /*---------------end compatbility------------*/ /* Set the specified boolean */ extern int sepol_bool_set(sepol_handle_t * handle, sepol_policydb_t * policydb, const sepol_bool_key_t * key, const sepol_bool_t * data); /* Return the number of booleans */ extern int sepol_bool_count(sepol_handle_t * handle, const sepol_policydb_t * p, unsigned int *response); /* Check if the specified boolean exists */ extern int sepol_bool_exists(sepol_handle_t * handle, const sepol_policydb_t * policydb, const sepol_bool_key_t * key, int *response); /* Query a boolean - returns the boolean, or NULL if not found */ extern int sepol_bool_query(sepol_handle_t * handle, const sepol_policydb_t * p, const sepol_bool_key_t * key, sepol_bool_t ** response); /* Iterate the booleans * The handler may return: * -1 to signal an error condition, * 1 to signal successful exit * 0 to signal continue */ extern int sepol_bool_iterate(sepol_handle_t * handle, const sepol_policydb_t * policydb, int (*fn) (const sepol_bool_t * boolean, void *fn_arg), void *arg); __END_DECLS #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/module.h��������������������������������������������������������������������������������������0000644�����������������00000005145�14763166027�0007345 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_MODULE_H_ #define _SEPOL_MODULE_H_ #include <stddef.h> #include <stdio.h> #include <stdint.h> #include <sepol/handle.h> #include <sepol/policydb.h> #include <sys/cdefs.h> __BEGIN_DECLS struct sepol_module_package; typedef struct sepol_module_package sepol_module_package_t; /* Module package public interfaces. */ extern int sepol_module_package_create(sepol_module_package_t ** p); extern void sepol_module_package_free(sepol_module_package_t * p); extern char *sepol_module_package_get_file_contexts(sepol_module_package_t * p); extern size_t sepol_module_package_get_file_contexts_len(sepol_module_package_t * p); extern int sepol_module_package_set_file_contexts(sepol_module_package_t * p, char *data, size_t len); extern char *sepol_module_package_get_seusers(sepol_module_package_t * p); extern size_t sepol_module_package_get_seusers_len(sepol_module_package_t * p); extern int sepol_module_package_set_seusers(sepol_module_package_t * p, char *data, size_t len); extern char *sepol_module_package_get_user_extra(sepol_module_package_t * p); extern size_t sepol_module_package_get_user_extra_len(sepol_module_package_t * p); extern int sepol_module_package_set_user_extra(sepol_module_package_t * p, char *data, size_t len); extern char *sepol_module_package_get_netfilter_contexts(sepol_module_package_t * p); extern size_t sepol_module_package_get_netfilter_contexts_len(sepol_module_package_t * p); extern int sepol_module_package_set_netfilter_contexts(sepol_module_package_t * p, char *data, size_t len); extern sepol_policydb_t *sepol_module_package_get_policy(sepol_module_package_t * p); extern int sepol_link_packages(sepol_handle_t * handle, sepol_module_package_t * base, sepol_module_package_t ** modules, int num_modules, int verbose); extern int sepol_module_package_read(sepol_module_package_t * mod, struct sepol_policy_file *file, int verbose); extern int sepol_module_package_info(struct sepol_policy_file *file, int *type, char **name, char **version); extern int sepol_module_package_write(sepol_module_package_t * p, struct sepol_policy_file *file); /* Module linking/expanding public interfaces. */ extern int sepol_link_modules(sepol_handle_t * handle, sepol_policydb_t * base, sepol_policydb_t ** modules, size_t len, int verbose); extern int sepol_expand_module(sepol_handle_t * handle, sepol_policydb_t * base, sepol_policydb_t * out, int verbose, int check); __END_DECLS #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/debug.h���������������������������������������������������������������������������������������0000644�����������������00000001674�14763166027�0007151 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_DEBUG_H_ #define _SEPOL_DEBUG_H_ #include <sepol/handle.h> #include <sys/cdefs.h> __BEGIN_DECLS /* Deprecated */ extern void sepol_debug(int on); /* End deprecated */ #define SEPOL_MSG_ERR 1 #define SEPOL_MSG_WARN 2 #define SEPOL_MSG_INFO 3 extern int sepol_msg_get_level(sepol_handle_t * handle); extern const char *sepol_msg_get_channel(sepol_handle_t * handle); extern const char *sepol_msg_get_fname(sepol_handle_t * handle); /* Set the messaging callback. * By the default, the callback will print * the message on standard output, in a * particular format. Passing NULL here * indicates that messaging should be suppressed */ extern void sepol_msg_set_callback(sepol_handle_t * handle, #ifdef __GNUC__ __attribute__ ((format(printf, 3, 4))) #endif void (*msg_callback) (void *varg, sepol_handle_t * handle, const char *fmt, ...), void *msg_callback_arg); __END_DECLS #endif ��������������������������������������������������������������������sepol/boolean_record.h������������������������������������������������������������������������������0000644�����������������00000002774�14763166027�0011042 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_BOOLEAN_RECORD_H_ #define _SEPOL_BOOLEAN_RECORD_H_ #include <stddef.h> #include <sepol/handle.h> #include <sys/cdefs.h> __BEGIN_DECLS struct sepol_bool; struct sepol_bool_key; typedef struct sepol_bool sepol_bool_t; typedef struct sepol_bool_key sepol_bool_key_t; /* Key */ extern int sepol_bool_key_create(sepol_handle_t * handle, const char *name, sepol_bool_key_t ** key); extern void sepol_bool_key_unpack(const sepol_bool_key_t * key, const char **name); extern int sepol_bool_key_extract(sepol_handle_t * handle, const sepol_bool_t * boolean, sepol_bool_key_t ** key_ptr); extern void sepol_bool_key_free(sepol_bool_key_t * key); extern int sepol_bool_compare(const sepol_bool_t * boolean, const sepol_bool_key_t * key); extern int sepol_bool_compare2(const sepol_bool_t * boolean, const sepol_bool_t * boolean2); /* Name */ extern const char *sepol_bool_get_name(const sepol_bool_t * boolean); extern int sepol_bool_set_name(sepol_handle_t * handle, sepol_bool_t * boolean, const char *name); /* Value */ extern int sepol_bool_get_value(const sepol_bool_t * boolean); extern void sepol_bool_set_value(sepol_bool_t * boolean, int value); /* Create/Clone/Destroy */ extern int sepol_bool_create(sepol_handle_t * handle, sepol_bool_t ** bool_ptr); extern int sepol_bool_clone(sepol_handle_t * handle, const sepol_bool_t * boolean, sepol_bool_t ** bool_ptr); extern void sepol_bool_free(sepol_bool_t * boolean); __END_DECLS #endif ����sepol/cil/cil.h�������������������������������������������������������������������������������������0000644�����������������00000006051�14763166027�0007373 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright 2011 Tresys Technology, LLC. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY TRESYS TECHNOLOGY, LLC ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * EVENT SHALL TRESYS TECHNOLOGY, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The views and conclusions contained in the software and documentation are those * of the authors and should not be interpreted as representing official policies, * either expressed or implied, of Tresys Technology, LLC. */ #ifndef CIL_H_ #define CIL_H_ #include <sepol/policydb/policydb.h> struct cil_db; typedef struct cil_db cil_db_t; extern void cil_db_init(cil_db_t **db); extern void cil_db_destroy(cil_db_t **db); extern int cil_add_file(cil_db_t *db, char *name, char *data, size_t size); extern int cil_compile(cil_db_t *db); extern int cil_build_policydb(cil_db_t *db, sepol_policydb_t **sepol_db); extern int cil_userprefixes_to_string(cil_db_t *db, char **out, size_t *size); extern int cil_selinuxusers_to_string(cil_db_t *db, char **out, size_t *size); extern int cil_filecons_to_string(cil_db_t *db, char **out, size_t *size); extern void cil_set_disable_dontaudit(cil_db_t *db, int disable_dontaudit); extern void cil_set_disable_neverallow(cil_db_t *db, int disable_neverallow); extern void cil_set_preserve_tunables(cil_db_t *db, int preserve_tunables); extern int cil_set_handle_unknown(cil_db_t *db, int handle_unknown); extern void cil_set_mls(cil_db_t *db, int mls); extern void cil_set_target_platform(cil_db_t *db, int target_platform); extern void cil_set_policy_version(cil_db_t *db, int policy_version); enum cil_log_level { CIL_ERR = 1, CIL_WARN, CIL_INFO }; extern void cil_set_log_level(enum cil_log_level lvl); extern void cil_set_log_handler(void (*handler)(int lvl, char *msg)); #ifdef __GNUC__ __attribute__ ((format(printf, 2, 3))) #endif extern void cil_log(enum cil_log_level lvl, const char *msg, ...); extern void cil_set_malloc_error_handler(void (*handler)(void)); #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/errcodes.h������������������������������������������������������������������������������������0000644�����������������00000001501�14763166027�0007656 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Author: Karl MacMillan <kmacmillan@mentalrootkit.com> */ #ifndef __sepol_errno_h__ #define __sepol_errno_h__ #include <errno.h> #include <sys/cdefs.h> __BEGIN_DECLS #define SEPOL_OK 0 /* These first error codes are defined for compatibility with * previous version of libsepol. In the future, custome error * codes that don't map to system error codes should be defined * outside of the range of system error codes. */ #define SEPOL_ERR -1 #define SEPOL_ENOTSUP -2 /* feature not supported in module language */ #define SEPOL_EREQ -3 /* requirements not met */ /* Error codes that map to system error codes */ #define SEPOL_ENOMEM -ENOMEM #define SEPOL_ERANGE -ERANGE #define SEPOL_EEXIST -EEXIST #define SEPOL_ENOENT -ENOENT __END_DECLS #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/context.h�������������������������������������������������������������������������������������0000644�����������������00000001335�14763166027�0007541 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_CONTEXT_H_ #define _SEPOL_CONTEXT_H_ #include <sepol/context_record.h> #include <sepol/policydb.h> #include <sepol/handle.h> #include <sys/cdefs.h> __BEGIN_DECLS /* -- Deprecated -- */ extern int sepol_check_context(const char *context); /* -- End deprecated -- */ extern int sepol_context_check(sepol_handle_t * handle, const sepol_policydb_t * policydb, const sepol_context_t * context); extern int sepol_mls_contains(sepol_handle_t * handle, const sepol_policydb_t * policydb, const char *mls1, const char *mls2, int *response); extern int sepol_mls_check(sepol_handle_t * handle, const sepol_policydb_t * policydb, const char *mls); __END_DECLS #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/interfaces.h����������������������������������������������������������������������������������0000644�����������������00000002550�14763166027�0010200 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef __SEPOL_INTERFACES_H_ #define __SEPOL_INTERFACES_H_ #include <sepol/policydb.h> #include <sepol/iface_record.h> #include <sepol/handle.h> #include <sys/cdefs.h> __BEGIN_DECLS /* Return the number of interfaces */ extern int sepol_iface_count(sepol_handle_t * handle, const sepol_policydb_t * policydb, unsigned int *response); /* Check if an interface exists */ extern int sepol_iface_exists(sepol_handle_t * handle, const sepol_policydb_t * policydb, const sepol_iface_key_t * key, int *response); /* Query an interface - returns the interface, * or NULL if not found */ extern int sepol_iface_query(sepol_handle_t * handle, const sepol_policydb_t * policydb, const sepol_iface_key_t * key, sepol_iface_t ** response); /* Modify an interface, or add it, if the key * is not found */ extern int sepol_iface_modify(sepol_handle_t * handle, sepol_policydb_t * policydb, const sepol_iface_key_t * key, const sepol_iface_t * data); /* Iterate the interfaces * The handler may return: * -1 to signal an error condition, * 1 to signal successful exit * 0 to signal continue */ extern int sepol_iface_iterate(sepol_handle_t * handle, const sepol_policydb_t * policydb, int (*fn) (const sepol_iface_t * iface, void *fn_arg), void *arg); __END_DECLS #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������sepol/iface_record.h��������������������������������������������������������������������������������0000644�����������������00000003435�14763166027�0010465 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_IFACE_RECORD_H_ #define _SEPOL_IFACE_RECORD_H_ #include <sepol/handle.h> #include <sepol/context_record.h> #include <sys/cdefs.h> __BEGIN_DECLS struct sepol_iface; struct sepol_iface_key; typedef struct sepol_iface sepol_iface_t; typedef struct sepol_iface_key sepol_iface_key_t; /* Key */ extern int sepol_iface_compare(const sepol_iface_t * iface, const sepol_iface_key_t * key); extern int sepol_iface_compare2(const sepol_iface_t * iface, const sepol_iface_t * iface2); extern void sepol_iface_key_unpack(const sepol_iface_key_t * key, const char **name); extern int sepol_iface_key_create(sepol_handle_t * handle, const char *name, sepol_iface_key_t ** key_ptr); extern int sepol_iface_key_extract(sepol_handle_t * handle, const sepol_iface_t * iface, sepol_iface_key_t ** key_ptr); extern void sepol_iface_key_free(sepol_iface_key_t * key); /* Name */ extern const char *sepol_iface_get_name(const sepol_iface_t * iface); extern int sepol_iface_set_name(sepol_handle_t * handle, sepol_iface_t * iface, const char *name); /* Context */ extern sepol_context_t *sepol_iface_get_ifcon(const sepol_iface_t * iface); extern int sepol_iface_set_ifcon(sepol_handle_t * handle, sepol_iface_t * iface, sepol_context_t * con); extern sepol_context_t *sepol_iface_get_msgcon(const sepol_iface_t * iface); extern int sepol_iface_set_msgcon(sepol_handle_t * handle, sepol_iface_t * iface, sepol_context_t * con); /* Create/Clone/Destroy */ extern int sepol_iface_create(sepol_handle_t * handle, sepol_iface_t ** iface_ptr); extern int sepol_iface_clone(sepol_handle_t * handle, const sepol_iface_t * iface, sepol_iface_t ** iface_ptr); extern void sepol_iface_free(sepol_iface_t * iface); __END_DECLS #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/ibendports.h����������������������������������������������������������������������������������0000644�����������������00000002527�14763166027�0010232 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_IBENDPORTS_H_ #define _SEPOL_IBENDPORTS_H_ #include <sepol/handle.h> #include <sepol/policydb.h> #include <sepol/ibendport_record.h> #include <sys/cdefs.h> __BEGIN_DECLS /* Return the number of ibendports */ extern int sepol_ibendport_count(sepol_handle_t *handle, const sepol_policydb_t *p, unsigned int *response); /* Check if a ibendport exists */ extern int sepol_ibendport_exists(sepol_handle_t *handle, const sepol_policydb_t *policydb, const sepol_ibendport_key_t *key, int *response); /* Query a ibendport - returns the ibendport, or NULL if not found */ extern int sepol_ibendport_query(sepol_handle_t *handle, const sepol_policydb_t *policydb, const sepol_ibendport_key_t *key, sepol_ibendport_t **response); /* Modify a ibendport, or add it, if the key is not found */ extern int sepol_ibendport_modify(sepol_handle_t *handle, sepol_policydb_t *policydb, const sepol_ibendport_key_t *key, const sepol_ibendport_t *data); /* Iterate the ibendports * The handler may return: * -1 to signal an error condition, * 1 to signal successful exit * 0 to signal continue */ extern int sepol_ibendport_iterate(sepol_handle_t *handle, const sepol_policydb_t *policydb, int (*fn)(const sepol_ibendport_t *ibendport, void *fn_arg), void *arg); __END_DECLS #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/node_record.h���������������������������������������������������������������������������������0000644�����������������00000005343�14763166027�0010343 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_NODE_RECORD_H_ #define _SEPOL_NODE_RECORD_H_ #include <stddef.h> #include <sepol/context_record.h> #include <sepol/handle.h> #include <sys/cdefs.h> __BEGIN_DECLS struct sepol_node; struct sepol_node_key; typedef struct sepol_node sepol_node_t; typedef struct sepol_node_key sepol_node_key_t; #define SEPOL_PROTO_IP4 0 #define SEPOL_PROTO_IP6 1 /* Key */ extern int sepol_node_compare(const sepol_node_t * node, const sepol_node_key_t * key); extern int sepol_node_compare2(const sepol_node_t * node, const sepol_node_t * node2); extern int sepol_node_key_create(sepol_handle_t * handle, const char *addr, const char *mask, int proto, sepol_node_key_t ** key_ptr); extern void sepol_node_key_unpack(const sepol_node_key_t * key, const char **addr, const char **mask, int *proto); extern int sepol_node_key_extract(sepol_handle_t * handle, const sepol_node_t * node, sepol_node_key_t ** key_ptr); extern void sepol_node_key_free(sepol_node_key_t * key); /* Address */ extern int sepol_node_get_addr(sepol_handle_t * handle, const sepol_node_t * node, char **addr); extern int sepol_node_get_addr_bytes(sepol_handle_t * handle, const sepol_node_t * node, char **addr, size_t * addr_sz); extern int sepol_node_set_addr(sepol_handle_t * handle, sepol_node_t * node, int proto, const char *addr); extern int sepol_node_set_addr_bytes(sepol_handle_t * handle, sepol_node_t * node, const char *addr, size_t addr_sz); /* Netmask */ extern int sepol_node_get_mask(sepol_handle_t * handle, const sepol_node_t * node, char **mask); extern int sepol_node_get_mask_bytes(sepol_handle_t * handle, const sepol_node_t * node, char **mask, size_t * mask_sz); extern int sepol_node_set_mask(sepol_handle_t * handle, sepol_node_t * node, int proto, const char *mask); extern int sepol_node_set_mask_bytes(sepol_handle_t * handle, sepol_node_t * node, const char *mask, size_t mask_sz); /* Protocol */ extern int sepol_node_get_proto(const sepol_node_t * node); extern void sepol_node_set_proto(sepol_node_t * node, int proto); extern const char *sepol_node_get_proto_str(int proto); /* Context */ extern sepol_context_t *sepol_node_get_con(const sepol_node_t * node); extern int sepol_node_set_con(sepol_handle_t * handle, sepol_node_t * node, sepol_context_t * con); /* Create/Clone/Destroy */ extern int sepol_node_create(sepol_handle_t * handle, sepol_node_t ** node_ptr); extern int sepol_node_clone(sepol_handle_t * handle, const sepol_node_t * node, sepol_node_t ** node_ptr); extern void sepol_node_free(sepol_node_t * node); __END_DECLS #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/policydb/sidtab.h�����������������������������������������������������������������������������0000644�����������������00000003646�14763166027�0011137 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Author : Stephen Smalley, <sds@epoch.ncsc.mil> */ /* FLASK */ /* * A security identifier table (sidtab) is a hash table * of security context structures indexed by SID value. */ #ifndef _SEPOL_POLICYDB_SIDTAB_H_ #define _SEPOL_POLICYDB_SIDTAB_H_ #include <sepol/policydb/context.h> #include <sys/cdefs.h> __BEGIN_DECLS typedef struct sidtab_node { sepol_security_id_t sid; /* security identifier */ context_struct_t context; /* security context structure */ struct sidtab_node *next; } sidtab_node_t; typedef struct sidtab_node *sidtab_ptr_t; #define SIDTAB_HASH_BITS 7 #define SIDTAB_HASH_BUCKETS (1 << SIDTAB_HASH_BITS) #define SIDTAB_HASH_MASK (SIDTAB_HASH_BUCKETS-1) #define SIDTAB_SIZE SIDTAB_HASH_BUCKETS typedef struct { sidtab_ptr_t *htable; unsigned int nel; /* number of elements */ unsigned int next_sid; /* next SID to allocate */ unsigned char shutdown; } sidtab_t; extern int sepol_sidtab_init(sidtab_t * s); extern int sepol_sidtab_insert(sidtab_t * s, sepol_security_id_t sid, context_struct_t * context); extern context_struct_t *sepol_sidtab_search(sidtab_t * s, sepol_security_id_t sid); extern int sepol_sidtab_map(sidtab_t * s, int (*apply) (sepol_security_id_t sid, context_struct_t * context, void *args), void *args); extern void sepol_sidtab_map_remove_on_error(sidtab_t * s, int (*apply) (sepol_security_id_t s, context_struct_t * context, void *args), void *args); extern int sepol_sidtab_context_to_sid(sidtab_t * s, /* IN */ context_struct_t * context, /* IN */ sepol_security_id_t * sid); /* OUT */ extern void sepol_sidtab_hash_eval(sidtab_t * h, char *tag); extern void sepol_sidtab_destroy(sidtab_t * s); extern void sepol_sidtab_set(sidtab_t * dst, sidtab_t * src); extern void sepol_sidtab_shutdown(sidtab_t * s); __END_DECLS #endif /* _SIDTAB_H_ */ /* FLASK */ ������������������������������������������������������������������������������������������sepol/policydb/constraint.h�������������������������������������������������������������������������0000644�����������������00000004742�14763166027�0012053 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Author : Stephen Smalley, <sds@epoch.ncsc.mil> */ /* FLASK */ /* * A constraint is a condition that must be satisfied in * order for one or more permissions to be granted. * Constraints are used to impose additional restrictions * beyond the type-based rules in `te' or the role-based * transition rules in `rbac'. Constraints are typically * used to prevent a process from transitioning to a new user * identity or role unless it is in a privileged type. * Constraints are likewise typically used to prevent a * process from labeling an object with a different user * identity. */ #ifndef _SEPOL_POLICYDB_CONSTRAINT_H_ #define _SEPOL_POLICYDB_CONSTRAINT_H_ #include <sepol/policydb/policydb.h> #include <sepol/policydb/ebitmap.h> #include <sepol/policydb/flask_types.h> __BEGIN_DECLS #define CEXPR_MAXDEPTH 5 struct type_set; typedef struct constraint_expr { #define CEXPR_NOT 1 /* not expr */ #define CEXPR_AND 2 /* expr and expr */ #define CEXPR_OR 3 /* expr or expr */ #define CEXPR_ATTR 4 /* attr op attr */ #define CEXPR_NAMES 5 /* attr op names */ uint32_t expr_type; /* expression type */ #define CEXPR_USER 1 /* user */ #define CEXPR_ROLE 2 /* role */ #define CEXPR_TYPE 4 /* type */ #define CEXPR_TARGET 8 /* target if set, source otherwise */ #define CEXPR_XTARGET 16 /* special 3rd target for validatetrans rule */ #define CEXPR_L1L2 32 /* low level 1 vs. low level 2 */ #define CEXPR_L1H2 64 /* low level 1 vs. high level 2 */ #define CEXPR_H1L2 128 /* high level 1 vs. low level 2 */ #define CEXPR_H1H2 256 /* high level 1 vs. high level 2 */ #define CEXPR_L1H1 512 /* low level 1 vs. high level 1 */ #define CEXPR_L2H2 1024 /* low level 2 vs. high level 2 */ uint32_t attr; /* attribute */ #define CEXPR_EQ 1 /* == or eq */ #define CEXPR_NEQ 2 /* != */ #define CEXPR_DOM 3 /* dom */ #define CEXPR_DOMBY 4 /* domby */ #define CEXPR_INCOMP 5 /* incomp */ uint32_t op; /* operator */ ebitmap_t names; /* names */ struct type_set *type_names; struct constraint_expr *next; /* next expression */ } constraint_expr_t; typedef struct constraint_node { sepol_access_vector_t permissions; /* constrained permissions */ constraint_expr_t *expr; /* constraint on permissions */ struct constraint_node *next; /* next constraint */ } constraint_node_t; struct policydb; extern int constraint_expr_init(constraint_expr_t * expr); extern void constraint_expr_destroy(constraint_expr_t * expr); __END_DECLS #endif /* _CONSTRAINT_H_ */ /* FLASK */ ������������������������������sepol/policydb/hierarchy.h��������������������������������������������������������������������������0000644�����������������00000003407�14763166027�0011642 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Authors: Jason Tang <jtang@tresys.com> * Joshua Brindle <jbrindle@tresys.com> * Karl MacMillan <kmacmillan@tresys.com> * * A set of utility functions that aid policy decision when dealing * with hierarchal items. * * Copyright (C) 2005 Tresys Technology, LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _SEPOL_POLICYDB_HIERARCHY_H_ #define _SEPOL_POLICYDB_HIERARCHY_H_ #include <sepol/policydb/avtab.h> #include <sepol/policydb/policydb.h> #include <sys/cdefs.h> __BEGIN_DECLS extern int hierarchy_add_bounds(sepol_handle_t *handle, policydb_t *p); extern void bounds_destroy_bad(avtab_ptr_t cur); extern int bounds_check_type(sepol_handle_t *handle, policydb_t *p, uint32_t child, uint32_t parent, avtab_ptr_t *bad, int *numbad); extern int bounds_check_users(sepol_handle_t *handle, policydb_t *p); extern int bounds_check_roles(sepol_handle_t *handle, policydb_t *p); extern int bounds_check_types(sepol_handle_t *handle, policydb_t *p); extern int hierarchy_check_constraints(sepol_handle_t * handle, policydb_t * p); __END_DECLS #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/policydb/module.h�����������������������������������������������������������������������������0000644�����������������00000002751�14763166027�0011152 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Author: Karl MacMillan <kmacmillan@tresys.com> * * Copyright (C) 2004-2005 Tresys Technology, LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _SEPOL_POLICYDB_MODULE_H_ #define _SEPOL_POLICYDB_MODULE_H_ #include <stdlib.h> #include <stddef.h> #include <sepol/module.h> #include <sepol/policydb/policydb.h> #include <sepol/policydb/conditional.h> #include <sys/cdefs.h> #define SEPOL_MODULE_PACKAGE_MAGIC 0xf97cff8f __BEGIN_DECLS struct sepol_module_package { sepol_policydb_t *policy; uint32_t version; char *file_contexts; size_t file_contexts_len; char *seusers; size_t seusers_len; char *user_extra; size_t user_extra_len; char *netfilter_contexts; size_t netfilter_contexts_len; }; extern int sepol_module_package_init(sepol_module_package_t * p); __END_DECLS #endif �����������������������sepol/policydb/expand.h�����������������������������������������������������������������������������0000644�����������������00000007065�14763166027�0011147 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Authors: Jason Tang <jtang@tresys.com> * Joshua Brindle <jbrindle@tresys.com> * Karl MacMillan <kmacmillan@tresys.com> * * A set of utility functions that aid policy decision when dealing * with hierarchal items. * * Copyright (C) 2005 Tresys Technology, LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _SEPOL_POLICYDB_EXPAND_H #define _SEPOL_POLICYDB_EXPAND_H #include <stddef.h> #include <sepol/handle.h> #include <sepol/policydb/conditional.h> #include <sys/cdefs.h> __BEGIN_DECLS /* * Expand only the avrules for a module. It is valid for this function * to expand base into itself (i.e. base == out); the typemap for * this special case should map type[i] to i+1. Likewise the boolmap * should map bool[i] to i + 1. This function optionally expands * neverallow rules. If neverallow rules are expanded, there is no * need to copy them and doing so could cause duplicate entries when * base == out. If the neverallow rules are not expanded, they are * just copied to the destination policy so that assertion checking * can be performed after expand. No assertion or hierarchy checking * is performed by this function. */ extern int expand_module_avrules(sepol_handle_t * handle, policydb_t * base, policydb_t * out, uint32_t * typemap, uint32_t * boolmap, uint32_t * rolemap, uint32_t * usermap, int verbose, int expand_neverallow); /* * Expand all parts of a module. Neverallow rules are not expanded (only * copied). It is not valid to expand base into itself. If check is non-zero, * performs hierarchy and assertion checking. */ extern int expand_module(sepol_handle_t * handle, policydb_t * base, policydb_t * out, int verbose, int check); extern int convert_type_ebitmap(ebitmap_t * src, ebitmap_t * dst, uint32_t * typemap); extern int expand_convert_type_set(policydb_t * p, uint32_t * typemap, type_set_t * set, ebitmap_t * types, unsigned char alwaysexpand); extern int type_set_expand(type_set_t * set, ebitmap_t * t, policydb_t * p, unsigned char alwaysexpand); extern int role_set_expand(role_set_t * x, ebitmap_t * r, policydb_t * out, policydb_t * base, uint32_t * rolemap); extern int mls_semantic_level_expand(mls_semantic_level_t *sl, mls_level_t *l, policydb_t *p, sepol_handle_t *h); extern int mls_semantic_range_expand(mls_semantic_range_t *sr, mls_range_t *r, policydb_t *p, sepol_handle_t *h); extern int expand_rule(sepol_handle_t * handle, policydb_t * source_pol, avrule_t * source_rule, avtab_t * dest_avtab, cond_av_list_t ** cond, cond_av_list_t ** other, int enabled); extern int expand_avtab(policydb_t * p, avtab_t * a, avtab_t * expa); extern int expand_cond_av_list(policydb_t * p, cond_av_list_t * l, cond_av_list_t ** newl, avtab_t * expa); __END_DECLS #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/policydb/context.h����������������������������������������������������������������������������0000644�����������������00000004305�14763166027�0011346 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Author : Stephen Smalley, <sds@epoch.ncsc.mil> */ /* FLASK */ /* * A security context is a set of security attributes * associated with each subject and object controlled * by the security policy. Security contexts are * externally represented as variable-length strings * that can be interpreted by a user or application * with an understanding of the security policy. * Internally, the security server uses a simple * structure. This structure is private to the * security server and can be changed without affecting * clients of the security server. */ #ifndef _SEPOL_POLICYDB_CONTEXT_H_ #define _SEPOL_POLICYDB_CONTEXT_H_ #include <stddef.h> #include <sepol/policydb/ebitmap.h> #include <sepol/policydb/mls_types.h> __BEGIN_DECLS /* * A security context consists of an authenticated user * identity, a role, a type and a MLS range. */ typedef struct context_struct { uint32_t user; uint32_t role; uint32_t type; mls_range_t range; } context_struct_t; static inline void mls_context_init(context_struct_t * c) { mls_range_init(&c->range); } static inline int mls_context_cpy(context_struct_t * dst, context_struct_t * src) { if (mls_range_cpy(&dst->range, &src->range) < 0) return -1; return 0; } static inline int mls_context_cmp(context_struct_t * c1, context_struct_t * c2) { return (mls_level_eq(&c1->range.level[0], &c2->range.level[0]) && mls_level_eq(&c1->range.level[1], &c2->range.level[1])); } static inline void mls_context_destroy(context_struct_t * c) { if (c == NULL) return; mls_range_destroy(&c->range); mls_context_init(c); } static inline void context_init(context_struct_t * c) { memset(c, 0, sizeof(*c)); } static inline int context_cpy(context_struct_t * dst, context_struct_t * src) { dst->user = src->user; dst->role = src->role; dst->type = src->type; return mls_context_cpy(dst, src); } static inline void context_destroy(context_struct_t * c) { if (c == NULL) return; c->user = c->role = c->type = 0; mls_context_destroy(c); } static inline int context_cmp(context_struct_t * c1, context_struct_t * c2) { return ((c1->user == c2->user) && (c1->role == c2->role) && (c1->type == c2->type) && mls_context_cmp(c1, c2)); } __END_DECLS #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/policydb/conditional.h������������������������������������������������������������������������0000644�����������������00000011152�14763166027�0012163 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Authors: Karl MacMillan <kmacmillan@tresys.com> * Frank Mayer <mayerf@tresys.com> * * Copyright (C) 2003 - 2005 Tresys Technology, LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _SEPOL_POLICYDB_CONDITIONAL_H_ #define _SEPOL_POLICYDB_CONDITIONAL_H_ #include <sepol/policydb/flask_types.h> #include <sepol/policydb/avtab.h> #include <sepol/policydb/symtab.h> #include <sepol/policydb/policydb.h> #include <sys/cdefs.h> __BEGIN_DECLS #define COND_EXPR_MAXDEPTH 10 /* this is the max unique bools in a conditional expression * for which we precompute all outcomes for the expression. * * NOTE - do _NOT_ use value greater than 5 because * cond_node_t->expr_pre_comp can only hold at most 32 values */ #define COND_MAX_BOOLS 5 /* * A conditional expression is a list of operators and operands * in reverse polish notation. */ typedef struct cond_expr { #define COND_BOOL 1 /* plain bool */ #define COND_NOT 2 /* !bool */ #define COND_OR 3 /* bool || bool */ #define COND_AND 4 /* bool && bool */ #define COND_XOR 5 /* bool ^ bool */ #define COND_EQ 6 /* bool == bool */ #define COND_NEQ 7 /* bool != bool */ #define COND_LAST COND_NEQ uint32_t expr_type; uint32_t bool; struct cond_expr *next; } cond_expr_t; /* * Each cond_node_t contains a list of rules to be enabled/disabled * depending on the current value of the conditional expression. This * struct is for that list. */ typedef struct cond_av_list { avtab_ptr_t node; struct cond_av_list *next; } cond_av_list_t; /* * A cond node represents a conditional block in a policy. It * contains a conditional expression, the current state of the expression, * two lists of rules to enable/disable depending on the value of the * expression (the true list corresponds to if and the false list corresponds * to else).. */ typedef struct cond_node { int cur_state; cond_expr_t *expr; /* these true/false lists point into te_avtab when that is used */ cond_av_list_t *true_list; cond_av_list_t *false_list; /* and these are used during parsing and for modules */ avrule_t *avtrue_list; avrule_t *avfalse_list; /* these fields are not written to binary policy */ unsigned int nbools; uint32_t bool_ids[COND_MAX_BOOLS]; uint32_t expr_pre_comp; struct cond_node *next; /* a tunable conditional, calculated and used at expansion */ #define COND_NODE_FLAGS_TUNABLE 0x01 uint32_t flags; } cond_node_t; extern int cond_evaluate_expr(policydb_t * p, cond_expr_t * expr); extern cond_expr_t *cond_copy_expr(cond_expr_t * expr); extern int cond_expr_equal(cond_node_t * a, cond_node_t * b); extern int cond_normalize_expr(policydb_t * p, cond_node_t * cn); extern void cond_node_destroy(cond_node_t * node); extern void cond_expr_destroy(cond_expr_t * expr); extern cond_node_t *cond_node_find(policydb_t * p, cond_node_t * needle, cond_node_t * haystack, int *was_created); extern cond_node_t *cond_node_create(policydb_t * p, cond_node_t * node); extern cond_node_t *cond_node_search(policydb_t * p, cond_node_t * list, cond_node_t * cn); extern int evaluate_conds(policydb_t * p); extern avtab_datum_t *cond_av_list_search(avtab_key_t * key, cond_av_list_t * cond_list); extern void cond_av_list_destroy(cond_av_list_t * list); extern void cond_optimize_lists(cond_list_t * cl); extern int cond_policydb_init(policydb_t * p); extern void cond_policydb_destroy(policydb_t * p); extern void cond_list_destroy(cond_list_t * list); extern int cond_init_bool_indexes(policydb_t * p); extern int cond_destroy_bool(hashtab_key_t key, hashtab_datum_t datum, void *p); extern int cond_index_bool(hashtab_key_t key, hashtab_datum_t datum, void *datap); extern int cond_read_bool(policydb_t * p, hashtab_t h, struct policy_file *fp); extern int cond_read_list(policydb_t * p, cond_list_t ** list, void *fp); extern void cond_compute_av(avtab_t * ctab, avtab_key_t * key, struct sepol_av_decision *avd); __END_DECLS #endif /* _CONDITIONAL_H_ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/policydb/hashtab.h����������������������������������������������������������������������������0000644�����������������00000010273�14763166027�0011275 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Author : Stephen Smalley, <sds@epoch.ncsc.mil> */ /* FLASK */ /* * A hash table (hashtab) maintains associations between * key values and datum values. The type of the key values * and the type of the datum values is arbitrary. The * functions for hash computation and key comparison are * provided by the creator of the table. */ #ifndef _SEPOL_POLICYDB_HASHTAB_H_ #define _SEPOL_POLICYDB_HASHTAB_H_ #include <sepol/errcodes.h> #include <stdint.h> #include <stdio.h> #include <sys/cdefs.h> __BEGIN_DECLS typedef char *hashtab_key_t; /* generic key type */ typedef void *hashtab_datum_t; /* generic datum type */ typedef struct hashtab_node *hashtab_ptr_t; typedef struct hashtab_node { hashtab_key_t key; hashtab_datum_t datum; hashtab_ptr_t next; } hashtab_node_t; typedef struct hashtab_val { hashtab_ptr_t *htable; /* hash table */ unsigned int size; /* number of slots in hash table */ uint32_t nel; /* number of elements in hash table */ unsigned int (*hash_value) (struct hashtab_val * h, hashtab_key_t key); /* hash function */ int (*keycmp) (struct hashtab_val * h, hashtab_key_t key1, hashtab_key_t key2); /* key comparison function */ } hashtab_val_t; typedef hashtab_val_t *hashtab_t; /* Creates a new hash table with the specified characteristics. Returns NULL if insufficent space is available or the new hash table otherwise. */ extern hashtab_t hashtab_create(unsigned int (*hash_value) (hashtab_t h, const hashtab_key_t key), int (*keycmp) (hashtab_t h, const hashtab_key_t key1, const hashtab_key_t key2), unsigned int size); /* Inserts the specified (key, datum) pair into the specified hash table. Returns SEPOL_ENOMEM if insufficient space is available or SEPOL_EEXIST if there is already an entry with the same key or SEPOL_OK otherwise. */ extern int hashtab_insert(hashtab_t h, hashtab_key_t k, hashtab_datum_t d); /* Removes the entry with the specified key from the hash table. Applies the specified destroy function to (key,datum,args) for the entry. Returns SEPOL_ENOENT if no entry has the specified key or SEPOL_OK otherwise. */ extern int hashtab_remove(hashtab_t h, hashtab_key_t k, void (*destroy) (hashtab_key_t k, hashtab_datum_t d, void *args), void *args); /* Insert or replace the specified (key, datum) pair in the specified hash table. If an entry for the specified key already exists, then the specified destroy function is applied to (key,datum,args) for the entry prior to replacing the entry's contents. Returns SEPOL_ENOMEM if insufficient space is available or SEPOL_OK otherwise. */ extern int hashtab_replace(hashtab_t h, hashtab_key_t k, hashtab_datum_t d, void (*destroy) (hashtab_key_t k, hashtab_datum_t d, void *args), void *args); /* Searches for the entry with the specified key in the hash table. Returns NULL if no entry has the specified key or the datum of the entry otherwise. */ extern hashtab_datum_t hashtab_search(hashtab_t h, const hashtab_key_t k); /* Destroys the specified hash table. */ extern void hashtab_destroy(hashtab_t h); /* Applies the specified apply function to (key,datum,args) for each entry in the specified hash table. The order in which the function is applied to the entries is dependent upon the internal structure of the hash table. If apply returns a non-zero status, then hashtab_map will cease iterating through the hash table and will propagate the error return to its caller. */ extern int hashtab_map(hashtab_t h, int (*apply) (hashtab_key_t k, hashtab_datum_t d, void *args), void *args); /* Same as hashtab_map, except that if apply returns a non-zero status, then the (key,datum) pair will be removed from the hashtab and the destroy function will be applied to (key,datum,args). */ extern void hashtab_map_remove_on_error(hashtab_t h, int (*apply) (hashtab_key_t k, hashtab_datum_t d, void *args), void (*destroy) (hashtab_key_t k, hashtab_datum_t d, void *args), void *args); extern void hashtab_hash_eval(hashtab_t h, char *tag); __END_DECLS #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/policydb/flask_types.h������������������������������������������������������������������������0000644�����������������00000003342�14763166027�0012206 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- linux-c -*- */ /* * Author : Stephen Smalley, <sds@epoch.ncsc.mil> */ #ifndef _SEPOL_POLICYDB_FLASK_TYPES_H_ #define _SEPOL_POLICYDB_FLASK_TYPES_H_ /* * The basic Flask types and constants. */ #include <sys/types.h> #include <stdint.h> #include <sys/cdefs.h> __BEGIN_DECLS /* * A security context is a set of security attributes * associated with each subject and object controlled * by the security policy. The security context type * is defined as a variable-length string that can be * interpreted by any application or user with an * understanding of the security policy. */ typedef char *sepol_security_context_t; /* * An access vector (AV) is a collection of related permissions * for a pair of SIDs. The bits within an access vector * are interpreted differently depending on the class of * the object. The access vector interpretations are specified * in flask/access_vectors, and the corresponding constants * for permissions are defined in the automatically generated * header file av_permissions.h. */ typedef uint32_t sepol_access_vector_t; /* * Each object class is identified by a fixed-size value. * The set of security classes is specified in flask/security_classes, * with the corresponding constants defined in the automatically * generated header file flask.h. */ typedef uint16_t sepol_security_class_t; #define SEPOL_SECCLASS_NULL 0x0000 /* no class */ #define SELINUX_MAGIC 0xf97cff8c #define SELINUX_MOD_MAGIC 0xf97cff8d typedef uint32_t sepol_security_id_t; #define SEPOL_SECSID_NULL 0 struct sepol_av_decision { sepol_access_vector_t allowed; sepol_access_vector_t decided; sepol_access_vector_t auditallow; sepol_access_vector_t auditdeny; uint32_t seqno; }; __END_DECLS #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/policydb/mls_types.h��������������������������������������������������������������������������0000644�����������������00000010406�14763166027�0011700 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Author : Stephen Smalley, <sds@epoch.ncsc.mil> */ /* * Updated: Trusted Computer Solutions, Inc. <dgoeddel@trustedcs.com> * * Support for enhanced MLS infrastructure. * * Copyright (C) 2004-2005 Trusted Computer Solutions, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* FLASK */ /* * Type definitions for the multi-level security (MLS) policy. */ #ifndef _SEPOL_POLICYDB_MLS_TYPES_H_ #define _SEPOL_POLICYDB_MLS_TYPES_H_ #include <stdint.h> #include <stdlib.h> #include <sepol/policydb/ebitmap.h> #include <sepol/policydb/flask_types.h> #include <sys/cdefs.h> __BEGIN_DECLS typedef struct mls_level { uint32_t sens; /* sensitivity */ ebitmap_t cat; /* category set */ } mls_level_t; typedef struct mls_range { mls_level_t level[2]; /* low == level[0], high == level[1] */ } mls_range_t; static inline int mls_level_cpy(struct mls_level *dst, struct mls_level *src) { dst->sens = src->sens; if (ebitmap_cpy(&dst->cat, &src->cat) < 0) return -1; return 0; } static inline void mls_level_init(struct mls_level *level) { memset(level, 0, sizeof(mls_level_t)); } static inline void mls_level_destroy(struct mls_level *level) { if (level == NULL) return; ebitmap_destroy(&level->cat); mls_level_init(level); } static inline int mls_level_eq(const struct mls_level *l1, const struct mls_level *l2) { return ((l1->sens == l2->sens) && ebitmap_cmp(&l1->cat, &l2->cat)); } static inline int mls_level_dom(const struct mls_level *l1, const struct mls_level *l2) { return ((l1->sens >= l2->sens) && ebitmap_contains(&l1->cat, &l2->cat)); } #define mls_level_incomp(l1, l2) \ (!mls_level_dom((l1), (l2)) && !mls_level_dom((l2), (l1))) #define mls_level_between(l1, l2, l3) \ (mls_level_dom((l1), (l2)) && mls_level_dom((l3), (l1))) #define mls_range_contains(r1, r2) \ (mls_level_dom(&(r2).level[0], &(r1).level[0]) && \ mls_level_dom(&(r1).level[1], &(r2).level[1])) static inline int mls_range_cpy(mls_range_t * dst, mls_range_t * src) { if (mls_level_cpy(&dst->level[0], &src->level[0]) < 0) goto err; if (mls_level_cpy(&dst->level[1], &src->level[1]) < 0) goto err_destroy; return 0; err_destroy: mls_level_destroy(&dst->level[0]); err: return -1; } static inline void mls_range_init(struct mls_range *r) { mls_level_init(&r->level[0]); mls_level_init(&r->level[1]); } static inline void mls_range_destroy(struct mls_range *r) { mls_level_destroy(&r->level[0]); mls_level_destroy(&r->level[1]); } static inline int mls_range_eq(struct mls_range *r1, struct mls_range *r2) { return (mls_level_eq(&r1->level[0], &r2->level[0]) && mls_level_eq(&r1->level[1], &r2->level[1])); } typedef struct mls_semantic_cat { uint32_t low; /* first bit this struct represents */ uint32_t high; /* last bit represented - equals low for a single cat */ struct mls_semantic_cat *next; } mls_semantic_cat_t; typedef struct mls_semantic_level { uint32_t sens; mls_semantic_cat_t *cat; } mls_semantic_level_t; typedef struct mls_semantic_range { mls_semantic_level_t level[2]; } mls_semantic_range_t; extern void mls_semantic_cat_init(mls_semantic_cat_t *c); extern void mls_semantic_cat_destroy(mls_semantic_cat_t *c); extern void mls_semantic_level_init(mls_semantic_level_t *l); extern void mls_semantic_level_destroy(mls_semantic_level_t *l); extern int mls_semantic_level_cpy(mls_semantic_level_t *dst, mls_semantic_level_t *src); extern void mls_semantic_range_init(mls_semantic_range_t *r); extern void mls_semantic_range_destroy(mls_semantic_range_t *r); extern int mls_semantic_range_cpy(mls_semantic_range_t *dst, mls_semantic_range_t *src); __END_DECLS #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/policydb/util.h�������������������������������������������������������������������������������0000644�����������������00000002643�14763166027�0010642 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Authors: Karl MacMillan <kmacmillan@tresys.com> * * A set of utility functions that aid policy decision when dealing * with hierarchal namespaces. * * Copyright (C) 2006 Tresys Technology, LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __SEPOL_UTIL_H__ #define __SEPOL_UTIL_H__ #include <sys/cdefs.h> __BEGIN_DECLS extern int add_i_to_a(uint32_t i, uint32_t * cnt, uint32_t ** a); extern char *sepol_av_to_string(policydb_t * policydbp, uint32_t tclass, sepol_access_vector_t av); char *sepol_extended_perms_to_string(avtab_extended_perms_t *xperms); /* * The tokenize function may be used to * replace sscanf */ extern int tokenize(char *line_buf, char delim, int num_args, ...); __END_DECLS #endif ���������������������������������������������������������������������������������������������sepol/policydb/flask.h������������������������������������������������������������������������������0000644�����������������00000011600�14763166027�0010756 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* This file is automatically generated. Do not edit. */ #ifndef _SEPOL_POLICYDB_FLASK_H_ #define _SEPOL_POLICYDB_FLASK_H_ /* * Security object class definitions */ #define SECCLASS_SECURITY 1 #define SECCLASS_PROCESS 2 #define SECCLASS_SYSTEM 3 #define SECCLASS_CAPABILITY 4 #define SECCLASS_FILESYSTEM 5 #define SECCLASS_FILE 6 #define SECCLASS_DIR 7 #define SECCLASS_FD 8 #define SECCLASS_LNK_FILE 9 #define SECCLASS_CHR_FILE 10 #define SECCLASS_BLK_FILE 11 #define SECCLASS_SOCK_FILE 12 #define SECCLASS_FIFO_FILE 13 #define SECCLASS_SOCKET 14 #define SECCLASS_TCP_SOCKET 15 #define SECCLASS_UDP_SOCKET 16 #define SECCLASS_RAWIP_SOCKET 17 #define SECCLASS_NODE 18 #define SECCLASS_NETIF 19 #define SECCLASS_NETLINK_SOCKET 20 #define SECCLASS_PACKET_SOCKET 21 #define SECCLASS_KEY_SOCKET 22 #define SECCLASS_UNIX_STREAM_SOCKET 23 #define SECCLASS_UNIX_DGRAM_SOCKET 24 #define SECCLASS_SEM 25 #define SECCLASS_MSG 26 #define SECCLASS_MSGQ 27 #define SECCLASS_SHM 28 #define SECCLASS_IPC 29 #define SECCLASS_PASSWD 30 #define SECCLASS_DRAWABLE 31 #define SECCLASS_WINDOW 32 #define SECCLASS_GC 33 #define SECCLASS_FONT 34 #define SECCLASS_COLORMAP 35 #define SECCLASS_PROPERTY 36 #define SECCLASS_CURSOR 37 #define SECCLASS_XCLIENT 38 #define SECCLASS_XINPUT 39 #define SECCLASS_XSERVER 40 #define SECCLASS_XEXTENSION 41 #define SECCLASS_PAX 42 #define SECCLASS_NETLINK_ROUTE_SOCKET 43 #define SECCLASS_NETLINK_FIREWALL_SOCKET 44 #define SECCLASS_NETLINK_TCPDIAG_SOCKET 45 #define SECCLASS_NETLINK_NFLOG_SOCKET 46 #define SECCLASS_NETLINK_XFRM_SOCKET 47 #define SECCLASS_NETLINK_SELINUX_SOCKET 48 #define SECCLASS_NETLINK_AUDIT_SOCKET 49 #define SECCLASS_NETLINK_IP6FW_SOCKET 50 #define SECCLASS_NETLINK_DNRT_SOCKET 51 #define SECCLASS_DBUS 52 /* * Security identifier indices for initial entities */ #define SECINITSID_KERNEL 1 #define SECINITSID_SECURITY 2 #define SECINITSID_UNLABELED 3 #define SECINITSID_FS 4 #define SECINITSID_FILE 5 #define SECINITSID_FILE_LABELS 6 #define SECINITSID_INIT 7 #define SECINITSID_ANY_SOCKET 8 #define SECINITSID_PORT 9 #define SECINITSID_NETIF 10 #define SECINITSID_NETMSG 11 #define SECINITSID_NODE 12 #define SECINITSID_IGMP_PACKET 13 #define SECINITSID_ICMP_SOCKET 14 #define SECINITSID_TCP_SOCKET 15 #define SECINITSID_SYSCTL_MODPROBE 16 #define SECINITSID_SYSCTL 17 #define SECINITSID_SYSCTL_FS 18 #define SECINITSID_SYSCTL_KERNEL 19 #define SECINITSID_SYSCTL_NET 20 #define SECINITSID_SYSCTL_NET_UNIX 21 #define SECINITSID_SYSCTL_VM 22 #define SECINITSID_SYSCTL_DEV 23 #define SECINITSID_KMOD 24 #define SECINITSID_POLICY 25 #define SECINITSID_SCMP_PACKET 26 #define SECINITSID_DEVNULL 27 #define SECINITSID_NUM 27 #endif ��������������������������������������������������������������������������������������������������������������������������������sepol/policydb/symtab.h�����������������������������������������������������������������������������0000644�����������������00000002074�14763166027�0011162 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Author : Stephen Smalley, <sds@epoch.ncsc.mil> */ /* FLASK */ /* * A symbol table (symtab) maintains associations between symbol * strings and datum values. The type of the datum values * is arbitrary. The symbol table type is implemented * using the hash table type (hashtab). */ #ifndef _SEPOL_POLICYDB_SYMTAB_H_ #define _SEPOL_POLICYDB_SYMTAB_H_ #include <sepol/policydb/hashtab.h> #include <sys/cdefs.h> __BEGIN_DECLS /* The symtab_datum struct stores the common information for * all symtab datums. It should the first element in every * struct that will be used in a symtab to allow the specific * datum types to be freely cast to this type. * * The values start at 1 - 0 is never a valid value. */ typedef struct symtab_datum { uint32_t value; } symtab_datum_t; typedef struct { hashtab_t table; /* hash table (keyed on a string) */ uint32_t nprim; /* number of primary names in table */ } symtab_t; extern int symtab_init(symtab_t *, unsigned int size); extern void symtab_destroy(symtab_t *); __END_DECLS #endif /* _SYMTAB_H_ */ /* FLASK */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/policydb/ebitmap.h����������������������������������������������������������������������������0000644�����������������00000006126�14763166027�0011306 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Author : Stephen Smalley, <sds@epoch.ncsc.mil> */ /* FLASK */ /* * An extensible bitmap is a bitmap that supports an * arbitrary number of bits. Extensible bitmaps are * used to represent sets of values, such as types, * roles, categories, and classes. * * Each extensible bitmap is implemented as a linked * list of bitmap nodes, where each bitmap node has * an explicitly specified starting bit position within * the total bitmap. */ #ifndef _SEPOL_POLICYDB_EBITMAP_H_ #define _SEPOL_POLICYDB_EBITMAP_H_ #include <stdint.h> #include <string.h> #include <sys/cdefs.h> __BEGIN_DECLS #define MAPTYPE uint64_t /* portion of bitmap in each node */ #define MAPSIZE (sizeof(MAPTYPE) * 8) /* number of bits in node bitmap */ #define MAPBIT 1ULL /* a bit in the node bitmap */ typedef struct ebitmap_node { uint32_t startbit; /* starting position in the total bitmap */ MAPTYPE map; /* this node's portion of the bitmap */ struct ebitmap_node *next; } ebitmap_node_t; typedef struct ebitmap { ebitmap_node_t *node; /* first node in the bitmap */ uint32_t highbit; /* highest position in the total bitmap */ } ebitmap_t; #define ebitmap_length(e) ((e)->highbit) #define ebitmap_startbit(e) ((e)->node ? (e)->node->startbit : 0) #define ebitmap_startnode(e) ((e)->node) static inline unsigned int ebitmap_start(const ebitmap_t * e, ebitmap_node_t ** n) { *n = e->node; return ebitmap_startbit(e); } static inline void ebitmap_init(ebitmap_t * e) { memset(e, 0, sizeof(*e)); } static inline unsigned int ebitmap_next(ebitmap_node_t ** n, unsigned int bit) { if ((bit == ((*n)->startbit + MAPSIZE - 1)) && (*n)->next) { *n = (*n)->next; return (*n)->startbit; } return (bit + 1); } static inline int ebitmap_node_get_bit(ebitmap_node_t * n, unsigned int bit) { if (n->map & (MAPBIT << (bit - n->startbit))) return 1; return 0; } #define ebitmap_for_each_bit(e, n, bit) \ for (bit = ebitmap_start(e, &n); bit < ebitmap_length(e); bit = ebitmap_next(&n, bit)) \ extern int ebitmap_cmp(const ebitmap_t * e1, const ebitmap_t * e2); extern int ebitmap_or(ebitmap_t * dst, const ebitmap_t * e1, const ebitmap_t * e2); extern int ebitmap_union(ebitmap_t * dst, const ebitmap_t * e1); extern int ebitmap_and(ebitmap_t *dst, ebitmap_t *e1, ebitmap_t *e2); extern int ebitmap_xor(ebitmap_t *dst, ebitmap_t *e1, ebitmap_t *e2); extern int ebitmap_not(ebitmap_t *dst, ebitmap_t *e1, unsigned int maxbit); extern int ebitmap_andnot(ebitmap_t *dst, ebitmap_t *e1, ebitmap_t *e2, unsigned int maxbit); extern unsigned int ebitmap_cardinality(ebitmap_t *e1); extern int ebitmap_hamming_distance(ebitmap_t * e1, ebitmap_t * e2); extern int ebitmap_cpy(ebitmap_t * dst, const ebitmap_t * src); extern int ebitmap_contains(const ebitmap_t * e1, const ebitmap_t * e2); extern int ebitmap_match_any(const ebitmap_t *e1, const ebitmap_t *e2); extern int ebitmap_get_bit(const ebitmap_t * e, unsigned int bit); extern int ebitmap_set_bit(ebitmap_t * e, unsigned int bit, int value); extern void ebitmap_destroy(ebitmap_t * e); extern int ebitmap_read(ebitmap_t * e, void *fp); __END_DECLS #endif /* _EBITMAP_H_ */ /* FLASK */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/policydb/policydb.h���������������������������������������������������������������������������0000644�����������������00000061641�14763166027�0011475 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Author : Stephen Smalley, <sds@epoch.ncsc.mil> */ /* * Updated: Joshua Brindle <jbrindle@tresys.com> * Karl MacMillan <kmacmillan@tresys.com> * Jason Tang <jtang@tresys.com> * * Module support * * Updated: Trusted Computer Solutions, Inc. <dgoeddel@trustedcs.com> * * Support for enhanced MLS infrastructure. * * Updated: Frank Mayer <mayerf@tresys.com> and Karl MacMillan <kmacmillan@tresys.com> * * Added conditional policy language extensions * * Updated: Red Hat, Inc. James Morris <jmorris@redhat.com> * * Fine-grained netlink support * IPv6 support * Code cleanup * * Copyright (C) 2004-2005 Trusted Computer Solutions, Inc. * Copyright (C) 2003 - 2004 Tresys Technology, LLC * Copyright (C) 2003 - 2004 Red Hat, Inc. * Copyright (C) 2017 Mellanox Techonolgies Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* FLASK */ /* * A policy database (policydb) specifies the * configuration data for the security policy. */ #ifndef _SEPOL_POLICYDB_POLICYDB_H_ #define _SEPOL_POLICYDB_POLICYDB_H_ #include <stdio.h> #include <stddef.h> #include <sepol/policydb.h> #include <sepol/policydb/flask_types.h> #include <sepol/policydb/symtab.h> #include <sepol/policydb/avtab.h> #include <sepol/policydb/context.h> #include <sepol/policydb/constraint.h> #include <sepol/policydb/sidtab.h> #include <sys/cdefs.h> #define ERRMSG_LEN 1024 #define POLICYDB_SUCCESS 0 #define POLICYDB_ERROR -1 #define POLICYDB_UNSUPPORTED -2 __BEGIN_DECLS #define IB_DEVICE_NAME_MAX 64 /* * A datum type is defined for each kind of symbol * in the configuration data: individual permissions, * common prefixes for access vectors, classes, * users, roles, types, sensitivities, categories, etc. */ /* type set preserves data needed by modules such as *, ~ and attributes */ typedef struct type_set { ebitmap_t types; ebitmap_t negset; #define TYPE_STAR 1 #define TYPE_COMP 2 uint32_t flags; } type_set_t; typedef struct role_set { ebitmap_t roles; #define ROLE_STAR 1 #define ROLE_COMP 2 uint32_t flags; } role_set_t; /* Permission attributes */ typedef struct perm_datum { symtab_datum_t s; } perm_datum_t; /* Attributes of a common prefix for access vectors */ typedef struct common_datum { symtab_datum_t s; symtab_t permissions; /* common permissions */ } common_datum_t; /* Class attributes */ typedef struct class_datum { symtab_datum_t s; char *comkey; /* common name */ common_datum_t *comdatum; /* common datum */ symtab_t permissions; /* class-specific permission symbol table */ constraint_node_t *constraints; /* constraints on class permissions */ constraint_node_t *validatetrans; /* special transition rules */ /* Options how a new object user and role should be decided */ #define DEFAULT_SOURCE 1 #define DEFAULT_TARGET 2 char default_user; char default_role; char default_type; /* Options how a new object range should be decided */ #define DEFAULT_SOURCE_LOW 1 #define DEFAULT_SOURCE_HIGH 2 #define DEFAULT_SOURCE_LOW_HIGH 3 #define DEFAULT_TARGET_LOW 4 #define DEFAULT_TARGET_HIGH 5 #define DEFAULT_TARGET_LOW_HIGH 6 char default_range; } class_datum_t; /* Role attributes */ typedef struct role_datum { symtab_datum_t s; ebitmap_t dominates; /* set of roles dominated by this role */ type_set_t types; /* set of authorized types for role */ ebitmap_t cache; /* This is an expanded set used for context validation during parsing */ uint32_t bounds; /* bounds role, if exist */ #define ROLE_ROLE 0 /* regular role in kernel policies */ #define ROLE_ATTRIB 1 /* attribute */ uint32_t flavor; ebitmap_t roles; /* roles with this attribute */ } role_datum_t; typedef struct role_trans { uint32_t role; /* current role */ uint32_t type; /* program executable type, or new object type */ uint32_t tclass; /* process class, or new object class */ uint32_t new_role; /* new role */ struct role_trans *next; } role_trans_t; typedef struct role_allow { uint32_t role; /* current role */ uint32_t new_role; /* new role */ struct role_allow *next; } role_allow_t; /* filename_trans rules */ typedef struct filename_trans { uint32_t stype; uint32_t ttype; uint32_t tclass; char *name; uint32_t otype; struct filename_trans *next; } filename_trans_t; /* Type attributes */ typedef struct type_datum { symtab_datum_t s; uint32_t primary; /* primary name? can be set to primary value if below is TYPE_ */ #define TYPE_TYPE 0 /* regular type or alias in kernel policies */ #define TYPE_ATTRIB 1 /* attribute */ #define TYPE_ALIAS 2 /* alias in modular policy */ uint32_t flavor; ebitmap_t types; /* types with this attribute */ #define TYPE_FLAGS_PERMISSIVE 0x01 uint32_t flags; uint32_t bounds; /* bounds type, if exist */ } type_datum_t; /* * Properties of type_datum * available on the policy version >= (MOD_)POLICYDB_VERSION_BOUNDARY */ #define TYPEDATUM_PROPERTY_PRIMARY 0x0001 #define TYPEDATUM_PROPERTY_ATTRIBUTE 0x0002 #define TYPEDATUM_PROPERTY_ALIAS 0x0004 /* userspace only */ #define TYPEDATUM_PROPERTY_PERMISSIVE 0x0008 /* userspace only */ /* User attributes */ typedef struct user_datum { symtab_datum_t s; role_set_t roles; /* set of authorized roles for user */ mls_semantic_range_t range; /* MLS range (min. - max.) for user */ mls_semantic_level_t dfltlevel; /* default login MLS level for user */ ebitmap_t cache; /* This is an expanded set used for context validation during parsing */ mls_range_t exp_range; /* expanded range used for validation */ mls_level_t exp_dfltlevel; /* expanded range used for validation */ uint32_t bounds; /* bounds user, if exist */ } user_datum_t; /* Sensitivity attributes */ typedef struct level_datum { mls_level_t *level; /* sensitivity and associated categories */ unsigned char isalias; /* is this sensitivity an alias for another? */ unsigned char defined; } level_datum_t; /* Category attributes */ typedef struct cat_datum { symtab_datum_t s; unsigned char isalias; /* is this category an alias for another? */ } cat_datum_t; typedef struct range_trans { uint32_t source_type; uint32_t target_type; uint32_t target_class; mls_range_t target_range; struct range_trans *next; } range_trans_t; /* Boolean data type */ typedef struct cond_bool_datum { symtab_datum_t s; int state; #define COND_BOOL_FLAGS_TUNABLE 0x01 /* is this a tunable? */ uint32_t flags; } cond_bool_datum_t; struct cond_node; typedef struct cond_node cond_list_t; struct cond_av_list; typedef struct class_perm_node { uint32_t tclass; uint32_t data; /* permissions or new type */ struct class_perm_node *next; } class_perm_node_t; #define xperm_test(x, p) (1 & (p[x >> 5] >> (x & 0x1f))) #define xperm_set(x, p) (p[x >> 5] |= (1 << (x & 0x1f))) #define xperm_clear(x, p) (p[x >> 5] &= ~(1 << (x & 0x1f))) #define EXTENDED_PERMS_LEN 8 typedef struct av_extended_perms { #define AVRULE_XPERMS_IOCTLFUNCTION 0x01 #define AVRULE_XPERMS_IOCTLDRIVER 0x02 uint8_t specified; uint8_t driver; /* 256 bits of permissions */ uint32_t perms[EXTENDED_PERMS_LEN]; } av_extended_perms_t; typedef struct avrule { /* these typedefs are almost exactly the same as those in avtab.h - they are * here because of the need to include neverallow and dontaudit messages */ #define AVRULE_ALLOWED 0x0001 #define AVRULE_AUDITALLOW 0x0002 #define AVRULE_AUDITDENY 0x0004 #define AVRULE_DONTAUDIT 0x0008 #define AVRULE_NEVERALLOW 0x0080 #define AVRULE_AV (AVRULE_ALLOWED | AVRULE_AUDITALLOW | AVRULE_AUDITDENY | AVRULE_DONTAUDIT | AVRULE_NEVERALLOW) #define AVRULE_TRANSITION 0x0010 #define AVRULE_MEMBER 0x0020 #define AVRULE_CHANGE 0x0040 #define AVRULE_TYPE (AVRULE_TRANSITION | AVRULE_MEMBER | AVRULE_CHANGE) #define AVRULE_XPERMS_ALLOWED 0x0100 #define AVRULE_XPERMS_AUDITALLOW 0x0200 #define AVRULE_XPERMS_DONTAUDIT 0x0400 #define AVRULE_XPERMS_NEVERALLOW 0x0800 #define AVRULE_XPERMS (AVRULE_XPERMS_ALLOWED | AVRULE_XPERMS_AUDITALLOW | \ AVRULE_XPERMS_DONTAUDIT | AVRULE_XPERMS_NEVERALLOW) uint32_t specified; #define RULE_SELF 1 uint32_t flags; type_set_t stypes; type_set_t ttypes; class_perm_node_t *perms; av_extended_perms_t *xperms; unsigned long line; /* line number from policy.conf where * this rule originated */ /* source file name and line number (e.g. .te file) */ char *source_filename; unsigned long source_line; struct avrule *next; } avrule_t; typedef struct role_trans_rule { role_set_t roles; /* current role */ type_set_t types; /* program executable type, or new object type */ ebitmap_t classes; /* process class, or new object class */ uint32_t new_role; /* new role */ struct role_trans_rule *next; } role_trans_rule_t; typedef struct role_allow_rule { role_set_t roles; /* current role */ role_set_t new_roles; /* new roles */ struct role_allow_rule *next; } role_allow_rule_t; typedef struct filename_trans_rule { type_set_t stypes; type_set_t ttypes; uint32_t tclass; char *name; uint32_t otype; /* new type */ struct filename_trans_rule *next; } filename_trans_rule_t; typedef struct range_trans_rule { type_set_t stypes; type_set_t ttypes; ebitmap_t tclasses; mls_semantic_range_t trange; struct range_trans_rule *next; } range_trans_rule_t; /* * The configuration data includes security contexts for * initial SIDs, unlabeled file systems, TCP and UDP port numbers, * network interfaces, and nodes. This structure stores the * relevant data for one such entry. Entries of the same kind * (e.g. all initial SIDs) are linked together into a list. */ typedef struct ocontext { union { char *name; /* name of initial SID, fs, netif, fstype, path */ struct { uint8_t protocol; uint16_t low_port; uint16_t high_port; } port; /* TCP or UDP port information */ struct { uint32_t addr; /* network order */ uint32_t mask; /* network order */ } node; /* node information */ struct { uint32_t addr[4]; /* network order */ uint32_t mask[4]; /* network order */ } node6; /* IPv6 node information */ uint32_t device; uint16_t pirq; struct { uint64_t low_iomem; uint64_t high_iomem; } iomem; struct { uint32_t low_ioport; uint32_t high_ioport; } ioport; struct { uint64_t subnet_prefix; uint16_t low_pkey; uint16_t high_pkey; } ibpkey; struct { char *dev_name; uint8_t port; } ibendport; } u; union { uint32_t sclass; /* security class for genfs */ uint32_t behavior; /* labeling behavior for fs_use */ } v; context_struct_t context[2]; /* security context(s) */ sepol_security_id_t sid[2]; /* SID(s) */ struct ocontext *next; } ocontext_t; typedef struct genfs { char *fstype; struct ocontext *head; struct genfs *next; } genfs_t; /* symbol table array indices */ #define SYM_COMMONS 0 #define SYM_CLASSES 1 #define SYM_ROLES 2 #define SYM_TYPES 3 #define SYM_USERS 4 #define SYM_BOOLS 5 #define SYM_LEVELS 6 #define SYM_CATS 7 #define SYM_NUM 8 /* object context array indices */ #define OCON_ISID 0 /* initial SIDs */ #define OCON_FS 1 /* unlabeled file systems */ #define OCON_PORT 2 /* TCP and UDP port numbers */ #define OCON_NETIF 3 /* network interfaces */ #define OCON_NODE 4 /* nodes */ #define OCON_FSUSE 5 /* fs_use */ #define OCON_NODE6 6 /* IPv6 nodes */ #define OCON_IBPKEY 7 /* Infiniband PKEY */ #define OCON_IBENDPORT 8 /* Infiniband End Port */ /* object context array indices for Xen */ #define OCON_XEN_ISID 0 /* initial SIDs */ #define OCON_XEN_PIRQ 1 /* physical irqs */ #define OCON_XEN_IOPORT 2 /* io ports */ #define OCON_XEN_IOMEM 3 /* io memory */ #define OCON_XEN_PCIDEVICE 4 /* pci devices */ #define OCON_XEN_DEVICETREE 5 /* device tree node */ /* OCON_NUM needs to be the largest index in any platform's ocontext array */ #define OCON_NUM 9 /* section: module information */ /* scope_index_t holds all of the symbols that are in scope in a * particular situation. The bitmaps are indices (and thus must * subtract one) into the global policydb->scope array. */ typedef struct scope_index { ebitmap_t scope[SYM_NUM]; #define p_classes_scope scope[SYM_CLASSES] #define p_roles_scope scope[SYM_ROLES] #define p_types_scope scope[SYM_TYPES] #define p_users_scope scope[SYM_USERS] #define p_bools_scope scope[SYM_BOOLS] #define p_sens_scope scope[SYM_LEVELS] #define p_cat_scope scope[SYM_CATS] /* this array maps from class->value to the permissions within * scope. if bit (perm->value - 1) is set in map * class_perms_map[class->value - 1] then that permission is * enabled for this class within this decl. */ ebitmap_t *class_perms_map; /* total number of classes in class_perms_map array */ uint32_t class_perms_len; } scope_index_t; /* a list of declarations for a particular avrule_decl */ /* These two structs declare a block of policy that has TE and RBAC * statements and declarations. The root block (the global policy) * can never have an ELSE branch. */ typedef struct avrule_decl { uint32_t decl_id; uint32_t enabled; /* whether this block is enabled */ cond_list_t *cond_list; avrule_t *avrules; role_trans_rule_t *role_tr_rules; role_allow_rule_t *role_allow_rules; range_trans_rule_t *range_tr_rules; scope_index_t required; /* symbols needed to activate this block */ scope_index_t declared; /* symbols declared within this block */ /* type transition rules with a 'name' component */ filename_trans_rule_t *filename_trans_rules; /* for additive statements (type attribute, roles, and users) */ symtab_t symtab[SYM_NUM]; /* In a linked module this will contain the name of the module * from which this avrule_decl originated. */ char *module_name; struct avrule_decl *next; } avrule_decl_t; typedef struct avrule_block { avrule_decl_t *branch_list; avrule_decl_t *enabled; /* pointer to which branch is enabled. this is used in linking and never written to disk */ #define AVRULE_OPTIONAL 1 uint32_t flags; /* any flags for this block, currently just optional */ struct avrule_block *next; } avrule_block_t; /* Every identifier has its own scope datum. The datum describes if * the item is to be included into the final policy during * expansion. */ typedef struct scope_datum { /* Required for this decl */ #define SCOPE_REQ 1 /* Declared in this decl */ #define SCOPE_DECL 2 uint32_t scope; uint32_t *decl_ids; uint32_t decl_ids_len; /* decl_ids is a list of avrule_decl's that declare/require * this symbol. If scope==SCOPE_DECL then this is a list of * declarations. If the symbol may only be declared once * (types, bools) then decl_ids_len will be exactly 1. For * implicitly declared things (roles, users) then decl_ids_len * will be at least 1. */ } scope_datum_t; /* The policy database */ typedef struct policydb { #define POLICY_KERN SEPOL_POLICY_KERN #define POLICY_BASE SEPOL_POLICY_BASE #define POLICY_MOD SEPOL_POLICY_MOD uint32_t policy_type; char *name; char *version; int target_platform; /* Set when the policydb is modified such that writing is unsupported */ int unsupported_format; /* Whether this policydb is mls, should always be set */ int mls; /* symbol tables */ symtab_t symtab[SYM_NUM]; #define p_commons symtab[SYM_COMMONS] #define p_classes symtab[SYM_CLASSES] #define p_roles symtab[SYM_ROLES] #define p_types symtab[SYM_TYPES] #define p_users symtab[SYM_USERS] #define p_bools symtab[SYM_BOOLS] #define p_levels symtab[SYM_LEVELS] #define p_cats symtab[SYM_CATS] /* symbol names indexed by (value - 1) */ char **sym_val_to_name[SYM_NUM]; #define p_common_val_to_name sym_val_to_name[SYM_COMMONS] #define p_class_val_to_name sym_val_to_name[SYM_CLASSES] #define p_role_val_to_name sym_val_to_name[SYM_ROLES] #define p_type_val_to_name sym_val_to_name[SYM_TYPES] #define p_user_val_to_name sym_val_to_name[SYM_USERS] #define p_bool_val_to_name sym_val_to_name[SYM_BOOLS] #define p_sens_val_to_name sym_val_to_name[SYM_LEVELS] #define p_cat_val_to_name sym_val_to_name[SYM_CATS] /* class, role, and user attributes indexed by (value - 1) */ class_datum_t **class_val_to_struct; role_datum_t **role_val_to_struct; user_datum_t **user_val_to_struct; type_datum_t **type_val_to_struct; /* module stuff section -- used in parsing and for modules */ /* keep track of the scope for every identifier. these are * hash tables, where the key is the identifier name and value * a scope_datum_t. as a convenience, one may use the * p_*_macros (cf. struct scope_index_t declaration). */ symtab_t scope[SYM_NUM]; /* module rule storage */ avrule_block_t *global; /* avrule_decl index used for link/expand */ avrule_decl_t **decl_val_to_struct; /* compiled storage of rules - use for the kernel policy */ /* type enforcement access vectors and transitions */ avtab_t te_avtab; /* bools indexed by (value - 1) */ cond_bool_datum_t **bool_val_to_struct; /* type enforcement conditional access vectors and transitions */ avtab_t te_cond_avtab; /* linked list indexing te_cond_avtab by conditional */ cond_list_t *cond_list; /* role transitions */ role_trans_t *role_tr; /* type transition rules with a 'name' component */ filename_trans_t *filename_trans; /* role allows */ role_allow_t *role_allow; /* security contexts of initial SIDs, unlabeled file systems, TCP or UDP port numbers, network interfaces and nodes */ ocontext_t *ocontexts[OCON_NUM]; /* security contexts for files in filesystems that cannot support a persistent label mapping or use another fixed labeling behavior. */ genfs_t *genfs; /* range transitions */ range_trans_t *range_tr; ebitmap_t *type_attr_map; ebitmap_t *attr_type_map; /* not saved in the binary policy */ ebitmap_t policycaps; /* this bitmap is referenced by type NOT the typical type-1 used in other bitmaps. Someday the 0 bit may be used for global permissive */ ebitmap_t permissive_map; unsigned policyvers; unsigned handle_unknown; } policydb_t; struct sepol_policydb { struct policydb p; }; extern int policydb_init(policydb_t * p); extern int policydb_from_image(sepol_handle_t * handle, void *data, size_t len, policydb_t * policydb); extern int policydb_to_image(sepol_handle_t * handle, policydb_t * policydb, void **newdata, size_t * newlen); extern int policydb_index_classes(policydb_t * p); extern int policydb_index_bools(policydb_t * p); extern int policydb_index_others(sepol_handle_t * handle, policydb_t * p, unsigned int verbose); extern int policydb_reindex_users(policydb_t * p); extern void policydb_destroy(policydb_t * p); extern int policydb_load_isids(policydb_t * p, sidtab_t * s); /* Deprecated */ extern int policydb_context_isvalid(const policydb_t * p, const context_struct_t * c); extern void symtabs_destroy(symtab_t * symtab); extern int scope_destroy(hashtab_key_t key, hashtab_datum_t datum, void *p); typedef void (*hashtab_destroy_func_t) (hashtab_key_t k, hashtab_datum_t d, void *args); extern hashtab_destroy_func_t get_symtab_destroy_func(int sym_num); extern void class_perm_node_init(class_perm_node_t * x); extern void type_set_init(type_set_t * x); extern void type_set_destroy(type_set_t * x); extern int type_set_cpy(type_set_t * dst, type_set_t * src); extern int type_set_or_eq(type_set_t * dst, type_set_t * other); extern void role_set_init(role_set_t * x); extern void role_set_destroy(role_set_t * x); extern void avrule_init(avrule_t * x); extern void avrule_destroy(avrule_t * x); extern void avrule_list_destroy(avrule_t * x); extern void role_trans_rule_init(role_trans_rule_t * x); extern void role_trans_rule_list_destroy(role_trans_rule_t * x); extern void filename_trans_rule_init(filename_trans_rule_t * x); extern void filename_trans_rule_list_destroy(filename_trans_rule_t * x); extern void role_datum_init(role_datum_t * x); extern void role_datum_destroy(role_datum_t * x); extern void role_allow_rule_init(role_allow_rule_t * x); extern void role_allow_rule_destroy(role_allow_rule_t * x); extern void role_allow_rule_list_destroy(role_allow_rule_t * x); extern void range_trans_rule_init(range_trans_rule_t *x); extern void range_trans_rule_destroy(range_trans_rule_t *x); extern void range_trans_rule_list_destroy(range_trans_rule_t *x); extern void type_datum_init(type_datum_t * x); extern void type_datum_destroy(type_datum_t * x); extern void user_datum_init(user_datum_t * x); extern void user_datum_destroy(user_datum_t * x); extern void level_datum_init(level_datum_t * x); extern void level_datum_destroy(level_datum_t * x); extern void cat_datum_init(cat_datum_t * x); extern void cat_datum_destroy(cat_datum_t * x); extern int check_assertion(policydb_t *p, avrule_t *avrule); extern int check_assertions(sepol_handle_t * handle, policydb_t * p, avrule_t * avrules); extern int symtab_insert(policydb_t * x, uint32_t sym, hashtab_key_t key, hashtab_datum_t datum, uint32_t scope, uint32_t avrule_decl_id, uint32_t * value); /* A policy "file" may be a memory region referenced by a (data, len) pair or a file referenced by a FILE pointer. */ typedef struct policy_file { #define PF_USE_MEMORY 0 #define PF_USE_STDIO 1 #define PF_LEN 2 /* total up length in len field */ unsigned type; char *data; size_t len; size_t size; FILE *fp; struct sepol_handle *handle; } policy_file_t; struct sepol_policy_file { struct policy_file pf; }; extern void policy_file_init(policy_file_t * x); extern int policydb_read(policydb_t * p, struct policy_file *fp, unsigned int verbose); extern int avrule_read_list(policydb_t * p, avrule_t ** avrules, struct policy_file *fp); extern int policydb_write(struct policydb *p, struct policy_file *pf); extern int policydb_set_target_platform(policydb_t *p, int platform); #define PERM_SYMTAB_SIZE 32 /* Identify specific policy version changes */ #define POLICYDB_VERSION_BASE 15 #define POLICYDB_VERSION_BOOL 16 #define POLICYDB_VERSION_IPV6 17 #define POLICYDB_VERSION_NLCLASS 18 #define POLICYDB_VERSION_VALIDATETRANS 19 #define POLICYDB_VERSION_MLS 19 #define POLICYDB_VERSION_AVTAB 20 #define POLICYDB_VERSION_RANGETRANS 21 #define POLICYDB_VERSION_POLCAP 22 #define POLICYDB_VERSION_PERMISSIVE 23 #define POLICYDB_VERSION_BOUNDARY 24 #define POLICYDB_VERSION_FILENAME_TRANS 25 #define POLICYDB_VERSION_ROLETRANS 26 #define POLICYDB_VERSION_NEW_OBJECT_DEFAULTS 27 #define POLICYDB_VERSION_DEFAULT_TYPE 28 #define POLICYDB_VERSION_CONSTRAINT_NAMES 29 #define POLICYDB_VERSION_XEN_DEVICETREE 30 /* Xen-specific */ #define POLICYDB_VERSION_XPERMS_IOCTL 30 /* Linux-specific */ #define POLICYDB_VERSION_INFINIBAND 31 /* Linux-specific */ /* Range of policy versions we understand*/ #define POLICYDB_VERSION_MIN POLICYDB_VERSION_BASE #define POLICYDB_VERSION_MAX POLICYDB_VERSION_INFINIBAND /* Module versions and specific changes*/ #define MOD_POLICYDB_VERSION_BASE 4 #define MOD_POLICYDB_VERSION_VALIDATETRANS 5 #define MOD_POLICYDB_VERSION_MLS 5 #define MOD_POLICYDB_VERSION_RANGETRANS 6 #define MOD_POLICYDB_VERSION_MLS_USERS 6 #define MOD_POLICYDB_VERSION_POLCAP 7 #define MOD_POLICYDB_VERSION_PERMISSIVE 8 #define MOD_POLICYDB_VERSION_BOUNDARY 9 #define MOD_POLICYDB_VERSION_BOUNDARY_ALIAS 10 #define MOD_POLICYDB_VERSION_FILENAME_TRANS 11 #define MOD_POLICYDB_VERSION_ROLETRANS 12 #define MOD_POLICYDB_VERSION_ROLEATTRIB 13 #define MOD_POLICYDB_VERSION_TUNABLE_SEP 14 #define MOD_POLICYDB_VERSION_NEW_OBJECT_DEFAULTS 15 #define MOD_POLICYDB_VERSION_DEFAULT_TYPE 16 #define MOD_POLICYDB_VERSION_CONSTRAINT_NAMES 17 #define MOD_POLICYDB_VERSION_XPERMS_IOCTL 18 #define MOD_POLICYDB_VERSION_INFINIBAND 19 #define MOD_POLICYDB_VERSION_MIN MOD_POLICYDB_VERSION_BASE #define MOD_POLICYDB_VERSION_MAX MOD_POLICYDB_VERSION_INFINIBAND #define POLICYDB_CONFIG_MLS 1 /* macros to check policy feature */ /* TODO: add other features here */ #define policydb_has_boundary_feature(p) \ (((p)->policy_type == POLICY_KERN \ && p->policyvers >= POLICYDB_VERSION_BOUNDARY) || \ ((p)->policy_type != POLICY_KERN \ && p->policyvers >= MOD_POLICYDB_VERSION_BOUNDARY)) /* the config flags related to unknown classes/perms are bits 2 and 3 */ #define DENY_UNKNOWN SEPOL_DENY_UNKNOWN #define REJECT_UNKNOWN SEPOL_REJECT_UNKNOWN #define ALLOW_UNKNOWN SEPOL_ALLOW_UNKNOWN #define POLICYDB_CONFIG_UNKNOWN_MASK (DENY_UNKNOWN | REJECT_UNKNOWN | ALLOW_UNKNOWN) #define OBJECT_R "object_r" #define OBJECT_R_VAL 1 #define POLICYDB_MAGIC SELINUX_MAGIC #define POLICYDB_STRING "SE Linux" #define POLICYDB_XEN_STRING "XenFlask" #define POLICYDB_STRING_MAX_LENGTH 32 #define POLICYDB_MOD_MAGIC SELINUX_MOD_MAGIC #define POLICYDB_MOD_STRING "SE Linux Module" __END_DECLS #endif /* _POLICYDB_H_ */ /* FLASK */ �����������������������������������������������������������������������������������������������sepol/policydb/services.h���������������������������������������������������������������������������0000644�����������������00000020503�14763166027�0011503 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* -*- linux-c -*- */ /* * Author : Stephen Smalley, <sds@epoch.ncsc.mil> */ #ifndef _SEPOL_POLICYDB_SERVICES_H_ #define _SEPOL_POLICYDB_SERVICES_H_ /* * Security server interface. */ #include <sepol/policydb/flask_types.h> #include <sepol/policydb/policydb.h> #include <stddef.h> #include <sys/cdefs.h> __BEGIN_DECLS /* Set the policydb and sidtab structures to be used by the service functions. If not set, then these default to private structures within libsepol that can only be initialized and accessed via the service functions themselves. Setting the structures explicitly allows a program to directly manipulate them, e.g. checkpolicy populates the structures directly from a source policy rather than from a binary policy. */ extern int sepol_set_policydb(policydb_t * p); extern int sepol_set_sidtab(sidtab_t * s); /* Modify a policydb for boolean settings. */ int sepol_genbools_policydb(policydb_t * policydb, const char *booleans); /* Modify a policydb for user settings. */ int sepol_genusers_policydb(policydb_t * policydb, const char *usersdir); /* Load the security policy. This initializes the policydb and sidtab based on the provided binary policy. */ extern int sepol_load_policy(void *data, size_t len); /* * Compute access vectors based on a SID pair for * the permissions in a particular class. */ extern int sepol_compute_av(sepol_security_id_t ssid, /* IN */ sepol_security_id_t tsid, /* IN */ sepol_security_class_t tclass, /* IN */ sepol_access_vector_t requested, /* IN */ struct sepol_av_decision *avd); /* OUT */ /* Same as above, but also return the reason(s) for any denials of the requested permissions. */ #define SEPOL_COMPUTEAV_TE 1 #define SEPOL_COMPUTEAV_CONS 2 #define SEPOL_COMPUTEAV_RBAC 4 extern int sepol_compute_av_reason(sepol_security_id_t ssid, sepol_security_id_t tsid, sepol_security_class_t tclass, sepol_access_vector_t requested, struct sepol_av_decision *avd, unsigned int *reason); /* * Same as above, but also returns the constraint expression calculations * whether allowed or denied in a buffer. This buffer is allocated by * this call and must be free'd by the caller using free(3). The contraint * buffer will contain any constraints in infix notation. * If the SHOW_GRANTED flag is set it will show granted and denied * constraints. The default is to show only denied constraints. */ #define SHOW_GRANTED 1 extern int sepol_compute_av_reason_buffer(sepol_security_id_t ssid, sepol_security_id_t tsid, sepol_security_class_t tclass, sepol_access_vector_t requested, struct sepol_av_decision *avd, unsigned int *reason, char **reason_buf, unsigned int flags); /* * Returns the mls/validatetrans constraint expression calculations in * a buffer that must be free'd by the caller using free(3). * If the SHOW_GRANTED flag is set it will show granted and denied * mls/validatetrans (the default is to show only those denied). */ extern int sepol_validate_transition_reason_buffer(sepol_security_id_t oldsid, sepol_security_id_t newsid, sepol_security_id_t tasksid, sepol_security_class_t tclass, char **reason_buf, unsigned int flags); /* * Return a class ID associated with the class string representation * specified by `class_name'. */ extern int sepol_string_to_security_class(const char *class_name, sepol_security_class_t *tclass); /* * Return a permission av bit associated with tclass and the string * representation of the `perm_name'. */ extern int sepol_string_to_av_perm(sepol_security_class_t tclass, const char *perm_name, sepol_access_vector_t *av); /* * Compute a SID to use for labeling a new object in the * class `tclass' based on a SID pair. */ extern int sepol_transition_sid(sepol_security_id_t ssid, /* IN */ sepol_security_id_t tsid, /* IN */ sepol_security_class_t tclass, /* IN */ sepol_security_id_t * out_sid); /* OUT */ /* * Compute a SID to use when selecting a member of a * polyinstantiated object of class `tclass' based on * a SID pair. */ extern int sepol_member_sid(sepol_security_id_t ssid, /* IN */ sepol_security_id_t tsid, /* IN */ sepol_security_class_t tclass, /* IN */ sepol_security_id_t * out_sid); /* OUT */ /* * Compute a SID to use for relabeling an object in the * class `tclass' based on a SID pair. */ extern int sepol_change_sid(sepol_security_id_t ssid, /* IN */ sepol_security_id_t tsid, /* IN */ sepol_security_class_t tclass, /* IN */ sepol_security_id_t * out_sid); /* OUT */ /* * Write the security context string representation of * the context associated with `sid' into a dynamically * allocated string of the correct size. Set `*scontext' * to point to this string and set `*scontext_len' to * the length of the string. */ extern int sepol_sid_to_context(sepol_security_id_t sid, /* IN */ sepol_security_context_t * scontext, /* OUT */ size_t * scontext_len); /* OUT */ /* * Return a SID associated with the security context that * has the string representation specified by `scontext'. */ extern int sepol_context_to_sid(const sepol_security_context_t scontext, /* IN */ size_t scontext_len, /* IN */ sepol_security_id_t * out_sid); /* OUT */ /* * Generate the set of SIDs for legal security contexts * for a given user that can be reached by `fromsid'. * Set `*sids' to point to a dynamically allocated * array containing the set of SIDs. Set `*nel' to the * number of elements in the array. */ extern int sepol_get_user_sids(sepol_security_id_t callsid, char *username, sepol_security_id_t ** sids, uint32_t * nel); /* * Return the SIDs to use for an unlabeled file system * that is being mounted from the device with the * the kdevname `name'. The `fs_sid' SID is returned for * the file system and the `file_sid' SID is returned * for all files within that file system. */ extern int sepol_fs_sid(char *dev, /* IN */ sepol_security_id_t * fs_sid, /* OUT */ sepol_security_id_t * file_sid); /* OUT */ /* * Return the SID of the port specified by * `domain', `type', `protocol', and `port'. */ extern int sepol_port_sid(uint16_t domain, uint16_t type, uint8_t protocol, uint16_t port, sepol_security_id_t * out_sid); /* * Return the SID of the ibpkey specified by * `subnet prefix', and `pkey'. */ extern int sepol_ibpkey_sid(uint64_t subnet_prefix_p, uint16_t pkey, sepol_security_id_t *out_sid); /* * Return the SID of the ibendport specified by * `dev_name', and `port'. */ extern int sepol_ibendport_sid(char *dev_name, uint8_t port, sepol_security_id_t *out_sid); /* * Return the SIDs to use for a network interface * with the name `name'. The `if_sid' SID is returned for * the interface and the `msg_sid' SID is returned as * the default SID for messages received on the * interface. */ extern int sepol_netif_sid(char *name, sepol_security_id_t * if_sid, sepol_security_id_t * msg_sid); /* * Return the SID of the node specified by the address * `addr' where `addrlen' is the length of the address * in bytes and `domain' is the communications domain or * address family in which the address should be interpreted. */ extern int sepol_node_sid(uint16_t domain, void *addr, size_t addrlen, sepol_security_id_t * out_sid); /* * Return a value indicating how to handle labeling for the * the specified filesystem type, and optionally return a SID * for the filesystem object. */ #define SECURITY_FS_USE_XATTR 1 /* use xattr */ #define SECURITY_FS_USE_TRANS 2 /* use transition SIDs, e.g. devpts/tmpfs */ #define SECURITY_FS_USE_TASK 3 /* use task SIDs, e.g. pipefs/sockfs */ #define SECURITY_FS_USE_GENFS 4 /* use the genfs support */ #define SECURITY_FS_USE_NONE 5 /* no labeling support */ extern int sepol_fs_use(const char *fstype, /* IN */ unsigned int *behavior, /* OUT */ sepol_security_id_t * sid); /* OUT */ /* * Return the SID to use for a file in a filesystem * that cannot support a persistent label mapping or use another * fixed labeling behavior like transition SIDs or task SIDs. */ extern int sepol_genfs_sid(const char *fstype, /* IN */ const char *name, /* IN */ sepol_security_class_t sclass, /* IN */ sepol_security_id_t * sid); /* OUT */ __END_DECLS #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/policydb/link.h�������������������������������������������������������������������������������0000644�����������������00000000762�14763166027�0010622 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Authors: Jason Tang <jtang@tresys.com> * Joshua Brindle <jbrindle@tresys.com> * Karl MacMillan <kmacmillan@mentalrootkit.com> */ #ifndef _SEPOL_POLICYDB_LINK_H #define _SEPOL_POLICYDB_LINK_H #include <sepol/handle.h> #include <sepol/errcodes.h> #include <sepol/policydb/policydb.h> #include <stddef.h> #include <sys/cdefs.h> __BEGIN_DECLS extern int link_modules(sepol_handle_t * handle, policydb_t * b, policydb_t ** mods, int len, int verbose); __END_DECLS #endif ��������������sepol/policydb/avrule_block.h�����������������������������������������������������������������������0000644�����������������00000003122�14763166027�0012326 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Authors: Jason Tang <jtang@tresys.com> * * Copyright (C) 2005 Tresys Technology, LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _SEPOL_AVRULE_BLOCK_H_ #define _SEPOL_AVRULE_BLOCK_H_ #include <sepol/policydb/policydb.h> #include <sys/cdefs.h> __BEGIN_DECLS extern avrule_block_t *avrule_block_create(void); extern void avrule_block_destroy(avrule_block_t * x); extern avrule_decl_t *avrule_decl_create(uint32_t decl_id); extern void avrule_decl_destroy(avrule_decl_t * x); extern void avrule_block_list_destroy(avrule_block_t * x); extern avrule_decl_t *get_avrule_decl(policydb_t * p, uint32_t decl_id); extern cond_list_t *get_decl_cond_list(policydb_t * p, avrule_decl_t * decl, cond_list_t * cond); extern int is_id_enabled(char *id, policydb_t * p, int symbol_table); extern int is_perm_enabled(char *class_id, char *perm_id, policydb_t * p); __END_DECLS #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/policydb/polcaps.h����������������������������������������������������������������������������0000644�����������������00000001266�14763166027�0011326 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_POLICYDB_POLCAPS_H_ #define _SEPOL_POLICYDB_POLCAPS_H_ #include <sys/cdefs.h> __BEGIN_DECLS /* Policy capabilities */ enum { POLICYDB_CAPABILITY_NETPEER, POLICYDB_CAPABILITY_OPENPERM, POLICYDB_CAPABILITY_EXTSOCKCLASS, POLICYDB_CAPABILITY_ALWAYSNETWORK, POLICYDB_CAPABILITY_CGROUPSECLABEL, POLICYDB_CAPABILITY_NNP_NOSUID_TRANSITION, __POLICYDB_CAPABILITY_MAX }; #define POLICYDB_CAPABILITY_MAX (__POLICYDB_CAPABILITY_MAX - 1) /* Convert a capability name to number. */ extern int sepol_polcap_getnum(const char *name); /* Convert a capability number to name. */ extern const char *sepol_polcap_getname(int capnum); __END_DECLS #endif /* _SEPOL_POLICYDB_POLCAPS_H_ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/policydb/avtab.h������������������������������������������������������������������������������0000644�����������������00000011165�14763166027�0010761 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Author : Stephen Smalley, <sds@epoch.ncsc.mil> */ /* * Updated: Yuichi Nakamura <ynakam@hitachisoft.jp> * Tuned number of hash slots for avtab to reduce memory usage */ /* Updated: Frank Mayer <mayerf@tresys.com> and Karl MacMillan <kmacmillan@tresys.com> * * Added conditional policy language extensions * * Copyright (C) 2003 Tresys Technology, LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* FLASK */ /* * An access vector table (avtab) is a hash table * of access vectors and transition types indexed * by a type pair and a class. An access vector * table is used to represent the type enforcement * tables. */ #ifndef _SEPOL_POLICYDB_AVTAB_H_ #define _SEPOL_POLICYDB_AVTAB_H_ #include <sys/cdefs.h> #include <sys/types.h> #include <stdint.h> __BEGIN_DECLS typedef struct avtab_key { uint16_t source_type; uint16_t target_type; uint16_t target_class; #define AVTAB_ALLOWED 0x0001 #define AVTAB_AUDITALLOW 0x0002 #define AVTAB_AUDITDENY 0x0004 #define AVTAB_NEVERALLOW 0x0080 #define AVTAB_AV (AVTAB_ALLOWED | AVTAB_AUDITALLOW | AVTAB_AUDITDENY) #define AVTAB_TRANSITION 0x0010 #define AVTAB_MEMBER 0x0020 #define AVTAB_CHANGE 0x0040 #define AVTAB_TYPE (AVTAB_TRANSITION | AVTAB_MEMBER | AVTAB_CHANGE) #define AVTAB_XPERMS_ALLOWED 0x0100 #define AVTAB_XPERMS_AUDITALLOW 0x0200 #define AVTAB_XPERMS_DONTAUDIT 0x0400 #define AVTAB_XPERMS_NEVERALLOW 0x0800 #define AVTAB_XPERMS (AVTAB_XPERMS_ALLOWED | AVTAB_XPERMS_AUDITALLOW | AVTAB_XPERMS_DONTAUDIT) #define AVTAB_ENABLED_OLD 0x80000000 #define AVTAB_ENABLED 0x8000 /* reserved for used in cond_avtab */ uint16_t specified; /* what fields are specified */ } avtab_key_t; typedef struct avtab_extended_perms { #define AVTAB_XPERMS_IOCTLFUNCTION 0x01 #define AVTAB_XPERMS_IOCTLDRIVER 0x02 /* extension of the avtab_key specified */ uint8_t specified; uint8_t driver; uint32_t perms[8]; } avtab_extended_perms_t; typedef struct avtab_datum { uint32_t data; /* access vector or type */ avtab_extended_perms_t *xperms; } avtab_datum_t; typedef struct avtab_node *avtab_ptr_t; struct avtab_node { avtab_key_t key; avtab_datum_t datum; avtab_ptr_t next; void *parse_context; /* generic context pointer used by parser; * not saved in binary policy */ unsigned merged; /* flag for avtab_write only; not saved in binary policy */ }; typedef struct avtab { avtab_ptr_t *htable; uint32_t nel; /* number of elements */ uint32_t nslot; /* number of hash slots */ uint32_t mask; /* mask to compute hash func */ } avtab_t; extern int avtab_init(avtab_t *); extern int avtab_alloc(avtab_t *, uint32_t); extern int avtab_insert(avtab_t * h, avtab_key_t * k, avtab_datum_t * d); extern avtab_datum_t *avtab_search(avtab_t * h, avtab_key_t * k); extern void avtab_destroy(avtab_t * h); extern int avtab_map(avtab_t * h, int (*apply) (avtab_key_t * k, avtab_datum_t * d, void *args), void *args); extern void avtab_hash_eval(avtab_t * h, char *tag); struct policy_file; extern int avtab_read_item(struct policy_file *fp, uint32_t vers, avtab_t * a, int (*insert) (avtab_t * a, avtab_key_t * k, avtab_datum_t * d, void *p), void *p); extern int avtab_read(avtab_t * a, struct policy_file *fp, uint32_t vers); extern avtab_ptr_t avtab_insert_nonunique(avtab_t * h, avtab_key_t * key, avtab_datum_t * datum); extern avtab_ptr_t avtab_insert_with_parse_context(avtab_t * h, avtab_key_t * key, avtab_datum_t * datum, void *parse_context); extern avtab_ptr_t avtab_search_node(avtab_t * h, avtab_key_t * key); extern avtab_ptr_t avtab_search_node_next(avtab_ptr_t node, int specified); #define MAX_AVTAB_HASH_BITS 20 #define MAX_AVTAB_HASH_BUCKETS (1 << MAX_AVTAB_HASH_BITS) #define MAX_AVTAB_HASH_MASK (MAX_AVTAB_HASH_BUCKETS-1) /* avtab_alloc uses one bucket per 2-4 elements, so adjust to get maximum buckets */ #define MAX_AVTAB_SIZE (MAX_AVTAB_HASH_BUCKETS << 1) __END_DECLS #endif /* _AVTAB_H_ */ /* FLASK */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/nodes.h���������������������������������������������������������������������������������������0000644�����������������00000002415�14763166027�0007165 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_NODES_H_ #define _SEPOL_NODES_H_ #include <sepol/handle.h> #include <sepol/policydb.h> #include <sepol/node_record.h> #include <sys/cdefs.h> __BEGIN_DECLS /* Return the number of nodes */ extern int sepol_node_count(sepol_handle_t * handle, const sepol_policydb_t * p, unsigned int *response); /* Check if a node exists */ extern int sepol_node_exists(sepol_handle_t * handle, const sepol_policydb_t * policydb, const sepol_node_key_t * key, int *response); /* Query a node - returns the node, or NULL if not found */ extern int sepol_node_query(sepol_handle_t * handle, const sepol_policydb_t * policydb, const sepol_node_key_t * key, sepol_node_t ** response); /* Modify a node, or add it, if the key is not found */ extern int sepol_node_modify(sepol_handle_t * handle, sepol_policydb_t * policydb, const sepol_node_key_t * key, const sepol_node_t * data); /* Iterate the nodes * The handler may return: * -1 to signal an error condition, * 1 to signal successful exit * 0 to signal continue */ extern int sepol_node_iterate(sepol_handle_t * handle, const sepol_policydb_t * policydb, int (*fn) (const sepol_node_t * node, void *fn_arg), void *arg); __END_DECLS #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/users.h���������������������������������������������������������������������������������������0000644�����������������00000003724�14763166027�0007222 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_USERS_H_ #define _SEPOL_USERS_H_ #include <sepol/policydb.h> #include <sepol/user_record.h> #include <sepol/handle.h> #include <stddef.h> #include <sys/cdefs.h> __BEGIN_DECLS /*---------compatibility------------*/ /* Given an existing binary policy (starting at 'data with length 'len') and user configurations living in 'usersdir', generate a new binary policy for the new user configurations. Sets '*newdata' and '*newlen' to refer to the new binary policy image. */ extern int sepol_genusers(void *data, size_t len, const char *usersdir, void **newdata, size_t * newlen); /* Enable or disable deletion of users by sepol_genusers(3) when a user in original binary policy image is not defined by the new user configurations. Defaults to disabled. */ extern void sepol_set_delusers(int on); /*--------end compatibility----------*/ /* Modify the user, or add it, if the key is not found */ extern int sepol_user_modify(sepol_handle_t * handle, sepol_policydb_t * policydb, const sepol_user_key_t * key, const sepol_user_t * data); /* Return the number of users */ extern int sepol_user_count(sepol_handle_t * handle, const sepol_policydb_t * p, unsigned int *response); /* Check if the specified user exists */ extern int sepol_user_exists(sepol_handle_t * handle, const sepol_policydb_t * policydb, const sepol_user_key_t * key, int *response); /* Query a user - returns the user or NULL if not found */ extern int sepol_user_query(sepol_handle_t * handle, const sepol_policydb_t * p, const sepol_user_key_t * key, sepol_user_t ** response); /* Iterate the users * The handler may return: * -1 to signal an error condition, * 1 to signal successful exit * 0 to signal continue */ extern int sepol_user_iterate(sepol_handle_t * handle, const sepol_policydb_t * policydb, int (*fn) (const sepol_user_t * user, void *fn_arg), void *arg); __END_DECLS #endif ��������������������������������������������sepol/ports.h���������������������������������������������������������������������������������������0000644�����������������00000002415�14763166027�0007224 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_PORTS_H_ #define _SEPOL_PORTS_H_ #include <sepol/handle.h> #include <sepol/policydb.h> #include <sepol/port_record.h> #include <sys/cdefs.h> __BEGIN_DECLS /* Return the number of ports */ extern int sepol_port_count(sepol_handle_t * handle, const sepol_policydb_t * p, unsigned int *response); /* Check if a port exists */ extern int sepol_port_exists(sepol_handle_t * handle, const sepol_policydb_t * policydb, const sepol_port_key_t * key, int *response); /* Query a port - returns the port, or NULL if not found */ extern int sepol_port_query(sepol_handle_t * handle, const sepol_policydb_t * policydb, const sepol_port_key_t * key, sepol_port_t ** response); /* Modify a port, or add it, if the key is not found */ extern int sepol_port_modify(sepol_handle_t * handle, sepol_policydb_t * policydb, const sepol_port_key_t * key, const sepol_port_t * data); /* Iterate the ports * The handler may return: * -1 to signal an error condition, * 1 to signal successful exit * 0 to signal continue */ extern int sepol_port_iterate(sepol_handle_t * handle, const sepol_policydb_t * policydb, int (*fn) (const sepol_port_t * port, void *fn_arg), void *arg); __END_DECLS #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/sepol.h���������������������������������������������������������������������������������������0000644�����������������00000001513�14763166027�0007175 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_H_ #define _SEPOL_H_ #include <stddef.h> #include <stdio.h> #include <sys/cdefs.h> __BEGIN_DECLS #include <sepol/user_record.h> #include <sepol/context_record.h> #include <sepol/iface_record.h> #include <sepol/ibpkey_record.h> #include <sepol/ibendport_record.h> #include <sepol/port_record.h> #include <sepol/boolean_record.h> #include <sepol/node_record.h> #include <sepol/booleans.h> #include <sepol/interfaces.h> #include <sepol/ibpkeys.h> #include <sepol/ibendports.h> #include <sepol/ports.h> #include <sepol/nodes.h> #include <sepol/users.h> #include <sepol/handle.h> #include <sepol/debug.h> #include <sepol/policydb.h> #include <sepol/module.h> #include <sepol/context.h> /* Set internal policydb from a file for subsequent service calls. */ extern int sepol_set_policydb_from_file(FILE * fp); __END_DECLS #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/port_record.h���������������������������������������������������������������������������������0000644�����������������00000003714�14763166027�0010402 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_PORT_RECORD_H_ #define _SEPOL_PORT_RECORD_H_ #include <sepol/context_record.h> #include <sepol/handle.h> #include <sys/cdefs.h> __BEGIN_DECLS struct sepol_port; struct sepol_port_key; typedef struct sepol_port sepol_port_t; typedef struct sepol_port_key sepol_port_key_t; #define SEPOL_PROTO_UDP 0 #define SEPOL_PROTO_TCP 1 #define SEPOL_PROTO_DCCP 2 #define SEPOL_PROTO_SCTP 3 /* Key */ extern int sepol_port_compare(const sepol_port_t * port, const sepol_port_key_t * key); extern int sepol_port_compare2(const sepol_port_t * port, const sepol_port_t * port2); extern int sepol_port_key_create(sepol_handle_t * handle, int low, int high, int proto, sepol_port_key_t ** key_ptr); extern void sepol_port_key_unpack(const sepol_port_key_t * key, int *low, int *high, int *proto); extern int sepol_port_key_extract(sepol_handle_t * handle, const sepol_port_t * port, sepol_port_key_t ** key_ptr); extern void sepol_port_key_free(sepol_port_key_t * key); /* Protocol */ extern int sepol_port_get_proto(const sepol_port_t * port); extern void sepol_port_set_proto(sepol_port_t * port, int proto); extern const char *sepol_port_get_proto_str(int proto); /* Port */ extern int sepol_port_get_low(const sepol_port_t * port); extern int sepol_port_get_high(const sepol_port_t * port); extern void sepol_port_set_port(sepol_port_t * port, int port_num); extern void sepol_port_set_range(sepol_port_t * port, int low, int high); /* Context */ extern sepol_context_t *sepol_port_get_con(const sepol_port_t * port); extern int sepol_port_set_con(sepol_handle_t * handle, sepol_port_t * port, sepol_context_t * con); /* Create/Clone/Destroy */ extern int sepol_port_create(sepol_handle_t * handle, sepol_port_t ** port_ptr); extern int sepol_port_clone(sepol_handle_t * handle, const sepol_port_t * port, sepol_port_t ** port_ptr); extern void sepol_port_free(sepol_port_t * port); __END_DECLS #endif ����������������������������������������������������sepol/roles.h���������������������������������������������������������������������������������������0000644�����������������00000000501�14763166027�0007173 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_ROLES_H_ #define _SEPOL_ROLES_H_ #include <sys/cdefs.h> __BEGIN_DECLS extern int sepol_role_exists(const sepol_policydb_t * policydb, const char *role, int *response); extern int sepol_role_list(const sepol_policydb_t * policydb, char ***roles, unsigned int *nroles); __END_DECLS #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/policydb.h������������������������������������������������������������������������������������0000644�����������������00000011104�14763166027�0007655 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_POLICYDB_H_ #define _SEPOL_POLICYDB_H_ #include <stddef.h> #include <stdio.h> #include <sepol/handle.h> #include <sys/cdefs.h> __BEGIN_DECLS struct sepol_policy_file; typedef struct sepol_policy_file sepol_policy_file_t; struct sepol_policydb; typedef struct sepol_policydb sepol_policydb_t; /* Policy file public interfaces. */ /* Create and free memory associated with a policy file. */ extern int sepol_policy_file_create(sepol_policy_file_t ** pf); extern void sepol_policy_file_free(sepol_policy_file_t * pf); /* * Set the policy file to represent a binary policy memory image. * Subsequent operations using the policy file will read and write * the image located at the specified address with the specified length. * If 'len' is 0, then merely compute the necessary length upon * subsequent policydb write operations in order to determine the * necessary buffer size to allocate. */ extern void sepol_policy_file_set_mem(sepol_policy_file_t * pf, char *data, size_t len); /* * Get the size of the buffer needed to store a policydb write * previously done on this policy file. */ extern int sepol_policy_file_get_len(sepol_policy_file_t * pf, size_t * len); /* * Set the policy file to represent a FILE. * Subsequent operations using the policy file will read and write * to the FILE. */ extern void sepol_policy_file_set_fp(sepol_policy_file_t * pf, FILE * fp); /* * Associate a handle with a policy file, for use in * error reporting from subsequent calls that take the * policy file as an argument. */ extern void sepol_policy_file_set_handle(sepol_policy_file_t * pf, sepol_handle_t * handle); /* Policydb public interfaces. */ /* Create and free memory associated with a policydb. */ extern int sepol_policydb_create(sepol_policydb_t ** p); extern void sepol_policydb_free(sepol_policydb_t * p); /* Legal types of policies that the policydb can represent. */ #define SEPOL_POLICY_KERN 0 #define SEPOL_POLICY_BASE 1 #define SEPOL_POLICY_MOD 2 /* * Range of policy versions for the kernel policy type supported * by this library. */ extern int sepol_policy_kern_vers_min(void); extern int sepol_policy_kern_vers_max(void); /* * Set the policy type as specified, and automatically initialize the * policy version accordingly to the maximum version supported for the * policy type. * Returns -1 if the policy type is not legal. */ extern int sepol_policydb_set_typevers(sepol_policydb_t * p, unsigned int type); /* * Set the policy version to a different value. * Returns -1 if the policy version is not in the supported range for * the (previously set) policy type. */ extern int sepol_policydb_set_vers(sepol_policydb_t * p, unsigned int vers); /* Set how to handle unknown class/perms. */ #define SEPOL_DENY_UNKNOWN 0 #define SEPOL_REJECT_UNKNOWN 2 #define SEPOL_ALLOW_UNKNOWN 4 extern int sepol_policydb_set_handle_unknown(sepol_policydb_t * p, unsigned int handle_unknown); /* Set the target platform */ #define SEPOL_TARGET_SELINUX 0 #define SEPOL_TARGET_XEN 1 extern int sepol_policydb_set_target_platform(sepol_policydb_t * p, int target_platform); /* * Read a policydb from a policy file. * This automatically sets the type and version based on the * image contents. */ extern int sepol_policydb_read(sepol_policydb_t * p, sepol_policy_file_t * pf); /* * Write a policydb to a policy file. * The generated image will be in the binary format corresponding * to the policy version associated with the policydb. */ extern int sepol_policydb_write(sepol_policydb_t * p, sepol_policy_file_t * pf); /* * Extract a policydb from a binary policy memory image. * This is equivalent to sepol_policydb_read with a policy file * set to refer to memory. */ extern int sepol_policydb_from_image(sepol_handle_t * handle, void *data, size_t len, sepol_policydb_t * p); /* * Generate a binary policy memory image from a policydb. * This is equivalent to sepol_policydb_write with a policy file * set to refer to memory, but internally handles computing the * necessary length and allocating an appropriately sized memory * buffer for the caller. */ extern int sepol_policydb_to_image(sepol_handle_t * handle, sepol_policydb_t * p, void **newdata, size_t * newlen); /* * Check whether the policydb has MLS enabled. */ extern int sepol_policydb_mls_enabled(const sepol_policydb_t * p); /* * Check whether the compatibility mode for SELinux network * checks should be enabled when using this policy. */ extern int sepol_policydb_compat_net(const sepol_policydb_t * p); __END_DECLS #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/ibendport_record.h����������������������������������������������������������������������������0000644�����������������00000004163�14763166027�0011403 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_IBENDPORT_RECORD_H_ #define _SEPOL_IBENDPORT_RECORD_H_ #include <stddef.h> #include <sepol/context_record.h> #include <sepol/handle.h> #include <sys/cdefs.h> __BEGIN_DECLS struct sepol_ibendport; struct sepol_ibendport_key; typedef struct sepol_ibendport sepol_ibendport_t; typedef struct sepol_ibendport_key sepol_ibendport_key_t; extern int sepol_ibendport_compare(const sepol_ibendport_t *ibendport, const sepol_ibendport_key_t *key); extern int sepol_ibendport_compare2(const sepol_ibendport_t *ibendport, const sepol_ibendport_t *ibendport2); extern int sepol_ibendport_key_create(sepol_handle_t *handle, const char *ibdev_name, int port, sepol_ibendport_key_t **key_ptr); extern void sepol_ibendport_key_unpack(const sepol_ibendport_key_t *key, const char **ibdev_name, int *port); extern int sepol_ibendport_alloc_ibdev_name(sepol_handle_t *handle, char **ibdev_name); extern int sepol_ibendport_key_extract(sepol_handle_t *handle, const sepol_ibendport_t *ibendport, sepol_ibendport_key_t **key_ptr); extern void sepol_ibendport_key_free(sepol_ibendport_key_t *key); extern void sepol_ibendport_set_port(sepol_ibendport_t *ibendport, int port); extern int sepol_ibendport_get_port(const sepol_ibendport_t *ibendport); extern int sepol_ibendport_get_ibdev_name(sepol_handle_t *handle, const sepol_ibendport_t *ibendport, char **ibdev_name); extern int sepol_ibendport_set_ibdev_name(sepol_handle_t *handle, sepol_ibendport_t *ibendport, const char *ibdev_name); extern sepol_context_t *sepol_ibendport_get_con(const sepol_ibendport_t *ibendport); extern int sepol_ibendport_set_con(sepol_handle_t *handle, sepol_ibendport_t *ibendport, sepol_context_t *con); extern int sepol_ibendport_create(sepol_handle_t *handle, sepol_ibendport_t **ibendport_ptr); extern int sepol_ibendport_clone(sepol_handle_t *handle, const sepol_ibendport_t *ibendport, sepol_ibendport_t **ibendport_ptr); extern void sepol_ibendport_free(sepol_ibendport_t *ibendport); __END_DECLS #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/user_record.h���������������������������������������������������������������������������������0000644�����������������00000004475�14763166027�0010401 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_USER_RECORD_H_ #define _SEPOL_USER_RECORD_H_ #include <stddef.h> #include <sepol/handle.h> #include <sys/cdefs.h> __BEGIN_DECLS struct sepol_user; struct sepol_user_key; typedef struct sepol_user sepol_user_t; typedef struct sepol_user_key sepol_user_key_t; /* Key */ extern int sepol_user_key_create(sepol_handle_t * handle, const char *name, sepol_user_key_t ** key); extern void sepol_user_key_unpack(const sepol_user_key_t * key, const char **name); extern int sepol_user_key_extract(sepol_handle_t * handle, const sepol_user_t * user, sepol_user_key_t ** key_ptr); extern void sepol_user_key_free(sepol_user_key_t * key); extern int sepol_user_compare(const sepol_user_t * user, const sepol_user_key_t * key); extern int sepol_user_compare2(const sepol_user_t * user, const sepol_user_t * user2); /* Name */ extern const char *sepol_user_get_name(const sepol_user_t * user); extern int sepol_user_set_name(sepol_handle_t * handle, sepol_user_t * user, const char *name); /* MLS */ extern const char *sepol_user_get_mlslevel(const sepol_user_t * user); extern int sepol_user_set_mlslevel(sepol_handle_t * handle, sepol_user_t * user, const char *mls_level); extern const char *sepol_user_get_mlsrange(const sepol_user_t * user); extern int sepol_user_set_mlsrange(sepol_handle_t * handle, sepol_user_t * user, const char *mls_range); /* Role management */ extern int sepol_user_get_num_roles(const sepol_user_t * user); extern int sepol_user_add_role(sepol_handle_t * handle, sepol_user_t * user, const char *role); extern void sepol_user_del_role(sepol_user_t * user, const char *role); extern int sepol_user_has_role(const sepol_user_t * user, const char *role); extern int sepol_user_get_roles(sepol_handle_t * handle, const sepol_user_t * user, const char ***roles_arr, unsigned int *num_roles); extern int sepol_user_set_roles(sepol_handle_t * handle, sepol_user_t * user, const char **roles_arr, unsigned int num_roles); /* Create/Clone/Destroy */ extern int sepol_user_create(sepol_handle_t * handle, sepol_user_t ** user_ptr); extern int sepol_user_clone(sepol_handle_t * handle, const sepol_user_t * user, sepol_user_t ** user_ptr); extern void sepol_user_free(sepol_user_t * user); __END_DECLS #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/ibpkey_record.h�������������������������������������������������������������������������������0000644�����������������00000004351�14763166027�0010677 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_IBPKEY_RECORD_H_ #define _SEPOL_IBPKEY_RECORD_H_ #include <stddef.h> #include <stdint.h> #include <sepol/context_record.h> #include <sepol/handle.h> #include <sys/cdefs.h> #define INET6_ADDRLEN 16 __BEGIN_DECLS struct sepol_ibpkey; struct sepol_ibpkey_key; typedef struct sepol_ibpkey sepol_ibpkey_t; typedef struct sepol_ibpkey_key sepol_ibpkey_key_t; extern int sepol_ibpkey_compare(const sepol_ibpkey_t *ibpkey, const sepol_ibpkey_key_t *key); extern int sepol_ibpkey_compare2(const sepol_ibpkey_t *ibpkey, const sepol_ibpkey_t *ibpkey2); extern int sepol_ibpkey_key_create(sepol_handle_t *handle, const char *subnet_prefix, int low, int high, sepol_ibpkey_key_t **key_ptr); extern void sepol_ibpkey_key_unpack(const sepol_ibpkey_key_t *key, uint64_t *subnet_prefix, int *low, int *high); extern int sepol_ibpkey_key_extract(sepol_handle_t *handle, const sepol_ibpkey_t *ibpkey, sepol_ibpkey_key_t **key_ptr); extern void sepol_ibpkey_key_free(sepol_ibpkey_key_t *key); extern int sepol_ibpkey_get_low(const sepol_ibpkey_t *ibpkey); extern int sepol_ibpkey_get_high(const sepol_ibpkey_t *ibpkey); extern void sepol_ibpkey_set_pkey(sepol_ibpkey_t *ibpkey, int pkey_num); extern void sepol_ibpkey_set_range(sepol_ibpkey_t *ibpkey, int low, int high); extern int sepol_ibpkey_get_subnet_prefix(sepol_handle_t *handle, const sepol_ibpkey_t *ibpkey, char **subnet_prefix); extern uint64_t sepol_ibpkey_get_subnet_prefix_bytes(const sepol_ibpkey_t *ibpkey); extern int sepol_ibpkey_set_subnet_prefix(sepol_handle_t *handle, sepol_ibpkey_t *ibpkey, const char *subnet_prefix); extern void sepol_ibpkey_set_subnet_prefix_bytes(sepol_ibpkey_t *ibpkey, uint64_t subnet_prefix); extern sepol_context_t *sepol_ibpkey_get_con(const sepol_ibpkey_t *ibpkey); extern int sepol_ibpkey_set_con(sepol_handle_t *handle, sepol_ibpkey_t *ibpkey, sepol_context_t *con); extern int sepol_ibpkey_create(sepol_handle_t *handle, sepol_ibpkey_t **ibpkey_ptr); extern int sepol_ibpkey_clone(sepol_handle_t *handle, const sepol_ibpkey_t *ibpkey, sepol_ibpkey_t **ibpkey_ptr); extern void sepol_ibpkey_free(sepol_ibpkey_t *ibpkey); __END_DECLS #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/module_to_cil.h�������������������������������������������������������������������������������0000644�����������������00000000511�14763166027�0010666 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <stdlib.h> #include <sepol/module.h> #include <sepol/policydb/policydb.h> int sepol_module_policydb_to_cil(FILE *fp, struct policydb *pdb, int linked); int sepol_module_package_to_cil(FILE *fp, struct sepol_module_package *mod_pkg); int sepol_ppfile_to_module_package(FILE *fp, struct sepol_module_package **mod_pkg); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sepol/handle.h��������������������������������������������������������������������������������������0000644�����������������00000002537�14763166027�0007315 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _SEPOL_HANDLE_H_ #define _SEPOL_HANDLE_H_ #include <sys/cdefs.h> __BEGIN_DECLS struct sepol_handle; typedef struct sepol_handle sepol_handle_t; /* Create and return a sepol handle. */ sepol_handle_t *sepol_handle_create(void); /* Get whether or not dontaudits will be disabled, same values as * specified by set_disable_dontaudit. This value reflects the state * your system will be set to upon commit, not necessarily its * current state.*/ int sepol_get_disable_dontaudit(sepol_handle_t * sh); /* Set whether or not to disable dontaudits, 0 is default and does * not disable dontaudits, 1 disables them */ void sepol_set_disable_dontaudit(sepol_handle_t * sh, int disable_dontaudit); /* Set whether module_expand() should consume the base policy passed in. * This should reduce the amount of memory required to expand the policy. */ void sepol_set_expand_consume_base(sepol_handle_t * sh, int consume_base); /* Destroy a sepol handle. */ void sepol_handle_destroy(sepol_handle_t *); /* Get whether or not needless unused branch of tunables would be preserved */ int sepol_get_preserve_tunables(sepol_handle_t * sh); /* Set whether or not to preserve the needless unused branch of tunables, * 0 is default and discard such branch, 1 preserves them */ void sepol_set_preserve_tunables(sepol_handle_t * sh, int preserve_tunables); __END_DECLS #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������pcre_scanner.h��������������������������������������������������������������������������������������0000644�����������������00000014710�14763166027�0007376 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Copyright (c) 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Author: Sanjay Ghemawat // // Regular-expression based scanner for parsing an input stream. // // Example 1: parse a sequence of "var = number" entries from input: // // Scanner scanner(input); // string var; // int number; // scanner.SetSkipExpression("\\s+"); // Skip any white space we encounter // while (scanner.Consume("(\\w+) = (\\d+)", &var, &number)) { // ...; // } #ifndef _PCRE_SCANNER_H #define _PCRE_SCANNER_H #include <assert.h> #include <string> #include <vector> #include <pcrecpp.h> #include <pcre_stringpiece.h> namespace pcrecpp { class PCRECPP_EXP_DEFN Scanner { public: Scanner(); explicit Scanner(const std::string& input); ~Scanner(); // Return current line number. The returned line-number is // one-based. I.e. it returns 1 + the number of consumed newlines. // // Note: this method may be slow. It may take time proportional to // the size of the input. int LineNumber() const; // Return the byte-offset that the scanner is looking in the // input data; int Offset() const; // Return true iff the start of the remaining input matches "re" bool LookingAt(const RE& re) const; // Return true iff all of the following are true // a. the start of the remaining input matches "re", // b. if any arguments are supplied, matched sub-patterns can be // parsed and stored into the arguments. // If it returns true, it skips over the matched input and any // following input that matches the "skip" regular expression. bool Consume(const RE& re, const Arg& arg0 = RE::no_arg, const Arg& arg1 = RE::no_arg, const Arg& arg2 = RE::no_arg // TODO: Allow more arguments? ); // Set the "skip" regular expression. If after consuming some data, // a prefix of the input matches this RE, it is automatically // skipped. For example, a programming language scanner would use // a skip RE that matches white space and comments. // // scanner.SetSkipExpression("\\s+|//.*|/[*](.|\n)*?[*]/"); // // Skipping repeats as long as it succeeds. We used to let people do // this by writing "(...)*" in the regular expression, but that added // up to lots of recursive calls within the pcre library, so now we // control repetition explicitly via the function call API. // // You can pass NULL for "re" if you do not want any data to be skipped. void Skip(const char* re); // DEPRECATED; does *not* repeat void SetSkipExpression(const char* re); // Temporarily pause "skip"ing. This // Skip("Foo"); code ; DisableSkip(); code; EnableSkip() // is similar to // Skip("Foo"); code ; Skip(NULL); code ; Skip("Foo"); // but avoids creating/deleting new RE objects. void DisableSkip(); // Reenable previously paused skipping. Any prefix of the input // that matches the skip pattern is immediately dropped. void EnableSkip(); /***** Special wrappers around SetSkip() for some common idioms *****/ // Arranges to skip whitespace, C comments, C++ comments. // The overall RE is a disjunction of the following REs: // \\s whitespace // //.*\n C++ comment // /[*](.|\n)*?[*]/ C comment (x*? means minimal repetitions of x) // We get repetition via the semantics of SetSkipExpression, not by using * void SkipCXXComments() { SetSkipExpression("\\s|//.*\n|/[*](?:\n|.)*?[*]/"); } void set_save_comments(bool comments) { save_comments_ = comments; } bool save_comments() { return save_comments_; } // Append to vector ranges the comments found in the // byte range [start,end] (inclusive) of the input data. // Only comments that were extracted entirely within that // range are returned: no range splitting of atomically-extracted // comments is performed. void GetComments(int start, int end, std::vector<StringPiece> *ranges); // Append to vector ranges the comments added // since the last time this was called. This // functionality is provided for efficiency when // interleaving scanning with parsing. void GetNextComments(std::vector<StringPiece> *ranges); private: std::string data_; // All the input data StringPiece input_; // Unprocessed input RE* skip_; // If non-NULL, RE for skipping input bool should_skip_; // If true, use skip_ bool skip_repeat_; // If true, repeat skip_ as long as it works bool save_comments_; // If true, aggregate the skip expression // the skipped comments // TODO: later consider requiring that the StringPieces be added // in order by their start position std::vector<StringPiece> *comments_; // the offset into comments_ that has been returned by GetNextComments int comments_offset_; // helper function to consume *skip_ and honour // save_comments_ void ConsumeSkip(); }; } // namespace pcrecpp #endif /* _PCRE_SCANNER_H */ ��������������������������������������������������������ifaddrs.h�������������������������������������������������������������������������������������������0000644�����������������00000005423�14763166027�0006351 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ifaddrs.h -- declarations for getting network interface addresses Copyright (C) 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _IFADDRS_H #define _IFADDRS_H 1 #include <features.h> #include <sys/socket.h> __BEGIN_DECLS /* The `getifaddrs' function generates a linked list of these structures. Each element of the list describes one network interface. */ struct ifaddrs { struct ifaddrs *ifa_next; /* Pointer to the next structure. */ char *ifa_name; /* Name of this network interface. */ unsigned int ifa_flags; /* Flags as from SIOCGIFFLAGS ioctl. */ struct sockaddr *ifa_addr; /* Network address of this interface. */ struct sockaddr *ifa_netmask; /* Netmask of this interface. */ union { /* At most one of the following two is valid. If the IFF_BROADCAST bit is set in `ifa_flags', then `ifa_broadaddr' is valid. If the IFF_POINTOPOINT bit is set, then `ifa_dstaddr' is valid. It is never the case that both these bits are set at once. */ struct sockaddr *ifu_broadaddr; /* Broadcast address of this interface. */ struct sockaddr *ifu_dstaddr; /* Point-to-point destination address. */ } ifa_ifu; /* These very same macros are defined by <net/if.h> for `struct ifaddr'. So if they are defined already, the existing definitions will be fine. */ # ifndef ifa_broadaddr # define ifa_broadaddr ifa_ifu.ifu_broadaddr # endif # ifndef ifa_dstaddr # define ifa_dstaddr ifa_ifu.ifu_dstaddr # endif void *ifa_data; /* Address-specific data (may be unused). */ }; /* Create a linked list of `struct ifaddrs' structures, one for each network interface on the host machine. If successful, store the list in *IFAP and return 0. On errors, return -1 and set `errno'. The storage returned in *IFAP is allocated dynamically and can only be properly freed by passing it to `freeifaddrs'. */ extern int getifaddrs (struct ifaddrs **__ifap) __THROW; /* Reclaim the storage allocated by a previous `getifaddrs' call. */ extern void freeifaddrs (struct ifaddrs *__ifa) __THROW; __END_DECLS #endif /* ifaddrs.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������fnmatch.h�������������������������������������������������������������������������������������������0000644�����������������00000004421�14763166027�0006352 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-93,1996-1999,2001,2004,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _FNMATCH_H #define _FNMATCH_H 1 #ifdef __cplusplus extern "C" { #endif /* We #undef these before defining them because some losing systems (HP-UX A.08.07 for example) define these in <unistd.h>. */ #undef FNM_PATHNAME #undef FNM_NOESCAPE #undef FNM_PERIOD /* Bits set in the FLAGS argument to `fnmatch'. */ #define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ #define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ #define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ #if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE # define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ # define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ # define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ # define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching. */ #endif /* Value returned by `fnmatch' if STRING does not match PATTERN. */ #define FNM_NOMATCH 1 /* This value is returned if the implementation does not support `fnmatch'. Since this is not the case here it will never be returned but the conformance test suites still require the symbol to be defined. */ #ifdef _XOPEN_SOURCE # define FNM_NOSYS (-1) #endif /* Match NAME against the filename pattern PATTERN, returning zero if it matches, FNM_NOMATCH if not. */ extern int fnmatch (const char *__pattern, const char *__name, int __flags); #ifdef __cplusplus } #endif #endif /* fnmatch.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������nss.h�����������������������������������������������������������������������������������������������0000644�����������������00000003551�14763166027�0005540 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996, 1997, 1999, 2008, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* Define interface to NSS. This is meant for the interface functions and for implementors of new services. */ #ifndef _NSS_H #define _NSS_H 1 #include <features.h> #include <stdint.h> __BEGIN_DECLS /* Possible results of lookup using a nss_* function. */ enum nss_status { NSS_STATUS_TRYAGAIN = -2, NSS_STATUS_UNAVAIL, NSS_STATUS_NOTFOUND, NSS_STATUS_SUCCESS, NSS_STATUS_RETURN }; /* Data structure used for the 'gethostbyname4_r' function. */ struct gaih_addrtuple { struct gaih_addrtuple *next; char *name; int family; uint32_t addr[4]; uint32_t scopeid; }; /* Overwrite service selection for database DBNAME using specification in STRING. This function should only be used by system programs which have to work around non-existing services (e.e., while booting). Attention: Using this function repeatedly will slowly eat up the whole memory since previous selection data cannot be freed. */ extern int __nss_configure_lookup (const char *__dbname, const char *__string) __THROW; __END_DECLS #endif /* nss.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������gdfontg.h�������������������������������������������������������������������������������������������0000644�����������������00000001157�14763166027�0006365 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifdef __cplusplus extern "C" { #endif #ifndef _GDFONTG_H_ #define _GDFONTG_H_ 1 #ifdef __cplusplus extern "C" { #endif /* This is a header file for gd font, generated using bdftogd version 0.51 by Jan Pazdziora, adelton@fi.muni.cz from bdf font -Misc-Fixed-Bold-R-Normal-Sans-15-140-75-75-C-90-ISO8859-2 at Mon Jan 26 14:45:58 1998. The original bdf was holding following copyright: "Libor Skarvada, libor@informatics.muni.cz" */ #include "gd.h" BGD_EXPORT_DATA_PROT gdFontPtr gdFontGiant; BGD_DECLARE(gdFontPtr) gdFontGetGiant(void); #ifdef __cplusplus } #endif #endif #ifdef __cplusplus } #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������jerror.h��������������������������������������������������������������������������������������������0000644�����������������00000034634�14763166027�0006246 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jerror.h * * Copyright (C) 1994-1997, Thomas G. Lane. * Modified 1997-2009 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file defines the error and message codes for the JPEG library. * Edit this file to add new codes, or to translate the message strings to * some other language. * A set of error-reporting macros are defined too. Some applications using * the JPEG library may wish to include this file to get the error codes * and/or the macros. */ /* * To define the enum list of message codes, include this file without * defining macro JMESSAGE. To create a message string table, include it * again with a suitable JMESSAGE definition (see jerror.c for an example). */ #ifndef JMESSAGE #ifndef JERROR_H /* First time through, define the enum list */ #define JMAKE_ENUM_LIST #else /* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */ #define JMESSAGE(code,string) #endif /* JERROR_H */ #endif /* JMESSAGE */ #ifdef JMAKE_ENUM_LIST typedef enum { #define JMESSAGE(code,string) code , #endif /* JMAKE_ENUM_LIST */ JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */ /* For maintenance convenience, list is alphabetical by message code name */ #if JPEG_LIB_VERSION < 70 JMESSAGE(JERR_ARITH_NOTIMPL, "Sorry, arithmetic coding is not implemented") #endif JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix") JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix") JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode") JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS") #if JPEG_LIB_VERSION >= 70 JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request") #endif JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range") JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported") #if JPEG_LIB_VERSION >= 70 JMESSAGE(JERR_BAD_DROP_SAMPLING, "Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c") #endif JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition") JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace") JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace") JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length") JMESSAGE(JERR_BAD_LIB_VERSION, "Wrong JPEG library version: library is %d, caller expects %d") JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan") JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d") JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d") JMESSAGE(JERR_BAD_PROGRESSION, "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d") JMESSAGE(JERR_BAD_PROG_SCRIPT, "Invalid progressive parameters at scan script entry %d") JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors") JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d") JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d") JMESSAGE(JERR_BAD_STRUCT_SIZE, "JPEG parameter struct mismatch: library thinks size is %u, caller expects %u") JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access") JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small") JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here") JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet") JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d") JMESSAGE(JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request") JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d") JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x") JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d") JMESSAGE(JERR_DQT_INDEX, "Bogus DQT index %d") JMESSAGE(JERR_EMPTY_IMAGE, "Empty JPEG image (DNL not supported)") JMESSAGE(JERR_EMS_READ, "Read from EMS failed") JMESSAGE(JERR_EMS_WRITE, "Write to EMS failed") JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan") JMESSAGE(JERR_FILE_READ, "Input file read error") JMESSAGE(JERR_FILE_WRITE, "Output file write error --- out of disk space?") JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet") JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow") JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry") JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels") JMESSAGE(JERR_INPUT_EMPTY, "Empty input file") JMESSAGE(JERR_INPUT_EOF, "Premature end of input file") JMESSAGE(JERR_MISMATCHED_QUANT_TABLE, "Cannot transcode due to multiple use of quantization table %d") JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data") JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change") JMESSAGE(JERR_NOTIMPL, "Not implemented yet") JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time") #if JPEG_LIB_VERSION >= 70 JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined") #endif JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported") JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined") JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image") JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined") JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x") JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)") JMESSAGE(JERR_QUANT_COMPONENTS, "Cannot quantize more than %d color components") JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors") JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors") JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers") JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker") JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x") JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers") JMESSAGE(JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF") JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s") JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file") JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file") JMESSAGE(JERR_TFILE_WRITE, "Write failed on temporary file --- out of disk space?") JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines") JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x") JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up") JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation") JMESSAGE(JERR_XMS_READ, "Read from XMS failed") JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed") JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT) JMESSAGE(JMSG_VERSION, JVERSION) JMESSAGE(JTRC_16BIT_TABLES, "Caution: quantization tables are too coarse for baseline JPEG") JMESSAGE(JTRC_ADOBE, "Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d") JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u") JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u") JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x") JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x") JMESSAGE(JTRC_DQT, "Define Quantization Table %d precision %d") JMESSAGE(JTRC_DRI, "Define Restart Interval %u") JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u") JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u") JMESSAGE(JTRC_EOI, "End Of Image") JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d") JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d") JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE, "Warning: thumbnail image size does not match data length %u") JMESSAGE(JTRC_JFIF_EXTENSION, "JFIF extension marker: type 0x%02x, length %u") JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image") JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u") JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x") JMESSAGE(JTRC_QUANTVALS, " %4u %4u %4u %4u %4u %4u %4u %4u") JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors") JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors") JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization") JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d") JMESSAGE(JTRC_RST, "RST%d") JMESSAGE(JTRC_SMOOTH_NOTIMPL, "Smoothing not supported with nonstandard sampling ratios") JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d") JMESSAGE(JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d") JMESSAGE(JTRC_SOI, "Start of Image") JMESSAGE(JTRC_SOS, "Start Of Scan: %d components") JMESSAGE(JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d") JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d") JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s") JMESSAGE(JTRC_TFILE_OPEN, "Opened temporary file %s") JMESSAGE(JTRC_THUMB_JPEG, "JFIF extension marker: JPEG-compressed thumbnail image, length %u") JMESSAGE(JTRC_THUMB_PALETTE, "JFIF extension marker: palette thumbnail image, length %u") JMESSAGE(JTRC_THUMB_RGB, "JFIF extension marker: RGB thumbnail image, length %u") JMESSAGE(JTRC_UNKNOWN_IDS, "Unrecognized component IDs %d %d %d, assuming YCbCr") JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u") JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u") JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d") #if JPEG_LIB_VERSION >= 70 JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code") #endif JMESSAGE(JWRN_BOGUS_PROGRESSION, "Inconsistent progression sequence for component %d coefficient %d") JMESSAGE(JWRN_EXTRANEOUS_DATA, "Corrupt JPEG data: %u extraneous bytes before marker 0x%02x") JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment") JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code") JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d") JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file") JMESSAGE(JWRN_MUST_RESYNC, "Corrupt JPEG data: found marker 0x%02x instead of RST%d") JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG") JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines") #if JPEG_LIB_VERSION < 70 JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request") #if defined(C_ARITH_CODING_SUPPORTED) || defined(D_ARITH_CODING_SUPPORTED) JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined") JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code") #endif #endif #ifdef JMAKE_ENUM_LIST JMSG_LASTMSGCODE } J_MESSAGE_CODE; #undef JMAKE_ENUM_LIST #endif /* JMAKE_ENUM_LIST */ /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ #undef JMESSAGE #ifndef JERROR_H #define JERROR_H /* Macros to simplify using the error and trace message stuff */ /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ #define ERREXIT(cinfo,code) \ ((cinfo)->err->msg_code = (code), \ (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) #define ERREXIT1(cinfo,code,p1) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) #define ERREXIT2(cinfo,code,p1,p2) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (cinfo)->err->msg_parm.i[1] = (p2), \ (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) #define ERREXIT3(cinfo,code,p1,p2,p3) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (cinfo)->err->msg_parm.i[1] = (p2), \ (cinfo)->err->msg_parm.i[2] = (p3), \ (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) #define ERREXIT4(cinfo,code,p1,p2,p3,p4) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (cinfo)->err->msg_parm.i[1] = (p2), \ (cinfo)->err->msg_parm.i[2] = (p3), \ (cinfo)->err->msg_parm.i[3] = (p4), \ (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) #define ERREXITS(cinfo,code,str) \ ((cinfo)->err->msg_code = (code), \ strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \ (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) #define MAKESTMT(stuff) do { stuff } while (0) /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ #define WARNMS(cinfo,code) \ ((cinfo)->err->msg_code = (code), \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) #define WARNMS1(cinfo,code,p1) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) #define WARNMS2(cinfo,code,p1,p2) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (cinfo)->err->msg_parm.i[1] = (p2), \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) /* Informational/debugging messages */ #define TRACEMS(cinfo,lvl,code) \ ((cinfo)->err->msg_code = (code), \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) #define TRACEMS1(cinfo,lvl,code,p1) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) #define TRACEMS2(cinfo,lvl,code,p1,p2) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (cinfo)->err->msg_parm.i[1] = (p2), \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) #define TRACEMS3(cinfo,lvl,code,p1,p2,p3) \ MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \ (cinfo)->err->msg_code = (code); \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) #define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4) \ MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ (cinfo)->err->msg_code = (code); \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) #define TRACEMS5(cinfo,lvl,code,p1,p2,p3,p4,p5) \ MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ _mp[4] = (p5); \ (cinfo)->err->msg_code = (code); \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) #define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8) \ MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \ (cinfo)->err->msg_code = (code); \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) #define TRACEMSS(cinfo,lvl,code,str) \ ((cinfo)->err->msg_code = (code), \ strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \ (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) #endif /* JERROR_H */ ����������������������������������������������������������������������������������������������������linux/ivtv.h����������������������������������������������������������������������������������������0000644�����������������00000005716�14763166027�0007071 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* Public ivtv API header Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com> Copyright (C) 2004-2007 Hans Verkuil <hverkuil@xs4all.nl> 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __LINUX_IVTV_H__ #define __LINUX_IVTV_H__ #include <linux/types.h> #include <linux/videodev2.h> /* ivtv knows several distinct output modes: MPEG streaming, YUV streaming, YUV updates through user DMA and the passthrough mode. In order to clearly tell the driver that we are in user DMA YUV mode you need to call IVTV_IOC_DMA_FRAME with y_source == NULL first (althrough if you don't then the first time DMA_FRAME is called the mode switch is done automatically). When you close the file handle the user DMA mode is exited again. While in one mode, you cannot use another mode (EBUSY is returned). All this means that if you want to change the YUV interlacing for the user DMA YUV mode you first need to do call IVTV_IOC_DMA_FRAME with y_source == NULL before you can set the correct format using VIDIOC_S_FMT. Eventually all this should be replaced with a proper V4L2 API, but for now we have to do it this way. */ struct ivtv_dma_frame { enum v4l2_buf_type type; /* V4L2_BUF_TYPE_VIDEO_OUTPUT */ __u32 pixelformat; /* 0 == same as destination */ void *y_source; /* if NULL and type == V4L2_BUF_TYPE_VIDEO_OUTPUT, then just switch to user DMA YUV output mode */ void *uv_source; /* Unused for RGB pixelformats */ struct v4l2_rect src; struct v4l2_rect dst; __u32 src_width; __u32 src_height; }; #define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame) /* Select the passthrough mode (if the argument is non-zero). In the passthrough mode the output of the encoder is passed immediately into the decoder. */ #define IVTV_IOC_PASSTHROUGH_MODE _IOW ('V', BASE_VIDIOC_PRIVATE+1, int) /* Deprecated defines: applications should use the defines from videodev2.h */ #define IVTV_SLICED_TYPE_TELETEXT_B V4L2_MPEG_VBI_IVTV_TELETEXT_B #define IVTV_SLICED_TYPE_CAPTION_525 V4L2_MPEG_VBI_IVTV_CAPTION_525 #define IVTV_SLICED_TYPE_WSS_625 V4L2_MPEG_VBI_IVTV_WSS_625 #define IVTV_SLICED_TYPE_VPS V4L2_MPEG_VBI_IVTV_VPS #endif /* _LINUX_IVTV_H */ ��������������������������������������������������linux/net_namespace.h�������������������������������������������������������������������������������0000644�����������������00000001240�14763166027�0010667 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Copyright (c) 2015 6WIND S.A. * Author: Nicolas Dichtel <nicolas.dichtel@6wind.com> * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. */ #ifndef _LINUX_NET_NAMESPACE_H_ #define _LINUX_NET_NAMESPACE_H_ /* Attributes of RTM_NEWNSID/RTM_GETNSID messages */ enum { NETNSA_NONE, #define NETNSA_NSID_NOT_ASSIGNED -1 NETNSA_NSID, NETNSA_PID, NETNSA_FD, __NETNSA_MAX, }; #define NETNSA_MAX (__NETNSA_MAX - 1) #endif /* _LINUX_NET_NAMESPACE_H_ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/nfs4.h����������������������������������������������������������������������������������������0000644�����������������00000014440�14763166027�0006745 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/linux/nfs4.h * * NFSv4 protocol definitions. * * Copyright (c) 2002 The Regents of the University of Michigan. * All rights reserved. * * Kendrick Smith <kmsmith@umich.edu> * Andy Adamson <andros@umich.edu> */ #ifndef _LINUX_NFS4_H #define _LINUX_NFS4_H #include <linux/types.h> #define NFS4_BITMAP_SIZE 3 #define NFS4_VERIFIER_SIZE 8 #define NFS4_STATEID_SEQID_SIZE 4 #define NFS4_STATEID_OTHER_SIZE 12 #define NFS4_STATEID_SIZE (NFS4_STATEID_SEQID_SIZE + NFS4_STATEID_OTHER_SIZE) #define NFS4_FHSIZE 128 #define NFS4_MAXPATHLEN PATH_MAX #define NFS4_MAXNAMLEN NAME_MAX #define NFS4_OPAQUE_LIMIT 1024 #define NFS4_MAX_SESSIONID_LEN 16 #define NFS4_ACCESS_READ 0x0001 #define NFS4_ACCESS_LOOKUP 0x0002 #define NFS4_ACCESS_MODIFY 0x0004 #define NFS4_ACCESS_EXTEND 0x0008 #define NFS4_ACCESS_DELETE 0x0010 #define NFS4_ACCESS_EXECUTE 0x0020 #define NFS4_FH_PERSISTENT 0x0000 #define NFS4_FH_NOEXPIRE_WITH_OPEN 0x0001 #define NFS4_FH_VOLATILE_ANY 0x0002 #define NFS4_FH_VOL_MIGRATION 0x0004 #define NFS4_FH_VOL_RENAME 0x0008 #define NFS4_OPEN_RESULT_CONFIRM 0x0002 #define NFS4_OPEN_RESULT_LOCKTYPE_POSIX 0x0004 #define NFS4_OPEN_RESULT_MAY_NOTIFY_LOCK 0x0020 #define NFS4_SHARE_ACCESS_MASK 0x000F #define NFS4_SHARE_ACCESS_READ 0x0001 #define NFS4_SHARE_ACCESS_WRITE 0x0002 #define NFS4_SHARE_ACCESS_BOTH 0x0003 #define NFS4_SHARE_DENY_READ 0x0001 #define NFS4_SHARE_DENY_WRITE 0x0002 #define NFS4_SHARE_DENY_BOTH 0x0003 /* nfs41 */ #define NFS4_SHARE_WANT_MASK 0xFF00 #define NFS4_SHARE_WANT_NO_PREFERENCE 0x0000 #define NFS4_SHARE_WANT_READ_DELEG 0x0100 #define NFS4_SHARE_WANT_WRITE_DELEG 0x0200 #define NFS4_SHARE_WANT_ANY_DELEG 0x0300 #define NFS4_SHARE_WANT_NO_DELEG 0x0400 #define NFS4_SHARE_WANT_CANCEL 0x0500 #define NFS4_SHARE_WHEN_MASK 0xF0000 #define NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL 0x10000 #define NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED 0x20000 #define NFS4_CDFC4_FORE 0x1 #define NFS4_CDFC4_BACK 0x2 #define NFS4_CDFC4_BOTH 0x3 #define NFS4_CDFC4_FORE_OR_BOTH 0x3 #define NFS4_CDFC4_BACK_OR_BOTH 0x7 #define NFS4_CDFS4_FORE 0x1 #define NFS4_CDFS4_BACK 0x2 #define NFS4_CDFS4_BOTH 0x3 #define NFS4_SET_TO_SERVER_TIME 0 #define NFS4_SET_TO_CLIENT_TIME 1 #define NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE 0 #define NFS4_ACE_ACCESS_DENIED_ACE_TYPE 1 #define NFS4_ACE_SYSTEM_AUDIT_ACE_TYPE 2 #define NFS4_ACE_SYSTEM_ALARM_ACE_TYPE 3 #define ACL4_SUPPORT_ALLOW_ACL 0x01 #define ACL4_SUPPORT_DENY_ACL 0x02 #define ACL4_SUPPORT_AUDIT_ACL 0x04 #define ACL4_SUPPORT_ALARM_ACL 0x08 #define NFS4_ACL_AUTO_INHERIT 0x00000001 #define NFS4_ACL_PROTECTED 0x00000002 #define NFS4_ACL_DEFAULTED 0x00000004 #define NFS4_ACE_FILE_INHERIT_ACE 0x00000001 #define NFS4_ACE_DIRECTORY_INHERIT_ACE 0x00000002 #define NFS4_ACE_NO_PROPAGATE_INHERIT_ACE 0x00000004 #define NFS4_ACE_INHERIT_ONLY_ACE 0x00000008 #define NFS4_ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010 #define NFS4_ACE_FAILED_ACCESS_ACE_FLAG 0x00000020 #define NFS4_ACE_IDENTIFIER_GROUP 0x00000040 #define NFS4_ACE_INHERITED_ACE 0x00000080 #define NFS4_ACE_READ_DATA 0x00000001 #define NFS4_ACE_LIST_DIRECTORY 0x00000001 #define NFS4_ACE_WRITE_DATA 0x00000002 #define NFS4_ACE_ADD_FILE 0x00000002 #define NFS4_ACE_APPEND_DATA 0x00000004 #define NFS4_ACE_ADD_SUBDIRECTORY 0x00000004 #define NFS4_ACE_READ_NAMED_ATTRS 0x00000008 #define NFS4_ACE_WRITE_NAMED_ATTRS 0x00000010 #define NFS4_ACE_EXECUTE 0x00000020 #define NFS4_ACE_DELETE_CHILD 0x00000040 #define NFS4_ACE_READ_ATTRIBUTES 0x00000080 #define NFS4_ACE_WRITE_ATTRIBUTES 0x00000100 #define NFS4_ACE_WRITE_RETENTION 0x00000200 #define NFS4_ACE_WRITE_RETENTION_HOLD 0x00000400 #define NFS4_ACE_DELETE 0x00010000 #define NFS4_ACE_READ_ACL 0x00020000 #define NFS4_ACE_WRITE_ACL 0x00040000 #define NFS4_ACE_WRITE_OWNER 0x00080000 #define NFS4_ACE_SYNCHRONIZE 0x00100000 #define NFS4_ACE_GENERIC_READ 0x00120081 #define NFS4_ACE_GENERIC_WRITE 0x00160106 #define NFS4_ACE_GENERIC_EXECUTE 0x001200A0 #define NFS4_ACE_MASK_ALL 0x001F01FF #define EXCHGID4_FLAG_SUPP_MOVED_REFER 0x00000001 #define EXCHGID4_FLAG_SUPP_MOVED_MIGR 0x00000002 #define EXCHGID4_FLAG_BIND_PRINC_STATEID 0x00000100 #define EXCHGID4_FLAG_USE_NON_PNFS 0x00010000 #define EXCHGID4_FLAG_USE_PNFS_MDS 0x00020000 #define EXCHGID4_FLAG_USE_PNFS_DS 0x00040000 #define EXCHGID4_FLAG_MASK_PNFS 0x00070000 #define EXCHGID4_FLAG_UPD_CONFIRMED_REC_A 0x40000000 #define EXCHGID4_FLAG_CONFIRMED_R 0x80000000 #define EXCHGID4_FLAG_SUPP_FENCE_OPS 0x00000004 /* * Since the validity of these bits depends on whether * they're set in the argument or response, have separate * invalid flag masks for arg (_A) and resp (_R). */ #define EXCHGID4_FLAG_MASK_A 0x40070103 #define EXCHGID4_FLAG_MASK_R 0x80070103 #define EXCHGID4_2_FLAG_MASK_R 0x80070107 #define SEQ4_STATUS_CB_PATH_DOWN 0x00000001 #define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING 0x00000002 #define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED 0x00000004 #define SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED 0x00000008 #define SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED 0x00000010 #define SEQ4_STATUS_ADMIN_STATE_REVOKED 0x00000020 #define SEQ4_STATUS_RECALLABLE_STATE_REVOKED 0x00000040 #define SEQ4_STATUS_LEASE_MOVED 0x00000080 #define SEQ4_STATUS_RESTART_RECLAIM_NEEDED 0x00000100 #define SEQ4_STATUS_CB_PATH_DOWN_SESSION 0x00000200 #define SEQ4_STATUS_BACKCHANNEL_FAULT 0x00000400 #define NFS4_SECINFO_STYLE4_CURRENT_FH 0 #define NFS4_SECINFO_STYLE4_PARENT 1 #define NFS4_MAX_UINT64 (~(__u64)0) /* An NFS4 sessions server must support at least NFS4_MAX_OPS operations. * If a compound requires more operations, adjust NFS4_MAX_OPS accordingly. */ #define NFS4_MAX_OPS 8 /* Our NFS4 client back channel server only wants the cb_sequene and the * actual operation per compound */ #define NFS4_MAX_BACK_CHANNEL_OPS 2 #endif /* _LINUX_NFS4_H */ /* * Local variables: * c-basic-offset: 8 * End: */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/hdreg.h���������������������������������������������������������������������������������������0000644�����������������00000054257�14763166027�0007176 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_HDREG_H #define _LINUX_HDREG_H #include <linux/types.h> /* * Command Header sizes for IOCTL commands */ #define HDIO_DRIVE_CMD_HDR_SIZE (4 * sizeof(__u8)) #define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8)) #define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8)) #define IDE_DRIVE_TASK_NO_DATA 0 #define IDE_DRIVE_TASK_INVALID -1 #define IDE_DRIVE_TASK_SET_XFER 1 #define IDE_DRIVE_TASK_IN 2 #define IDE_DRIVE_TASK_OUT 3 #define IDE_DRIVE_TASK_RAW_WRITE 4 /* * Define standard taskfile in/out register */ #define IDE_TASKFILE_STD_IN_FLAGS 0xFE #define IDE_HOB_STD_IN_FLAGS 0x3C #define IDE_TASKFILE_STD_OUT_FLAGS 0xFE #define IDE_HOB_STD_OUT_FLAGS 0x3C typedef unsigned char task_ioreg_t; typedef unsigned long sata_ioreg_t; typedef union ide_reg_valid_s { unsigned all : 16; struct { unsigned data : 1; unsigned error_feature : 1; unsigned sector : 1; unsigned nsector : 1; unsigned lcyl : 1; unsigned hcyl : 1; unsigned select : 1; unsigned status_command : 1; unsigned data_hob : 1; unsigned error_feature_hob : 1; unsigned sector_hob : 1; unsigned nsector_hob : 1; unsigned lcyl_hob : 1; unsigned hcyl_hob : 1; unsigned select_hob : 1; unsigned control_hob : 1; } b; } ide_reg_valid_t; typedef struct ide_task_request_s { __u8 io_ports[8]; __u8 hob_ports[8]; /* bytes 6 and 7 are unused */ ide_reg_valid_t out_flags; ide_reg_valid_t in_flags; int data_phase; int req_cmd; unsigned long out_size; unsigned long in_size; } ide_task_request_t; typedef struct ide_ioctl_request_s { ide_task_request_t *task_request; unsigned char *out_buffer; unsigned char *in_buffer; } ide_ioctl_request_t; struct hd_drive_cmd_hdr { __u8 command; __u8 sector_number; __u8 feature; __u8 sector_count; }; typedef struct hd_drive_task_hdr { __u8 data; __u8 feature; __u8 sector_count; __u8 sector_number; __u8 low_cylinder; __u8 high_cylinder; __u8 device_head; __u8 command; } task_struct_t; typedef struct hd_drive_hob_hdr { __u8 data; __u8 feature; __u8 sector_count; __u8 sector_number; __u8 low_cylinder; __u8 high_cylinder; __u8 device_head; __u8 control; } hob_struct_t; #define TASKFILE_NO_DATA 0x0000 #define TASKFILE_IN 0x0001 #define TASKFILE_MULTI_IN 0x0002 #define TASKFILE_OUT 0x0004 #define TASKFILE_MULTI_OUT 0x0008 #define TASKFILE_IN_OUT 0x0010 #define TASKFILE_IN_DMA 0x0020 #define TASKFILE_OUT_DMA 0x0040 #define TASKFILE_IN_DMAQ 0x0080 #define TASKFILE_OUT_DMAQ 0x0100 #define TASKFILE_P_IN 0x0200 #define TASKFILE_P_OUT 0x0400 #define TASKFILE_P_IN_DMA 0x0800 #define TASKFILE_P_OUT_DMA 0x1000 #define TASKFILE_P_IN_DMAQ 0x2000 #define TASKFILE_P_OUT_DMAQ 0x4000 #define TASKFILE_48 0x8000 #define TASKFILE_INVALID 0x7fff /* ATA/ATAPI Commands pre T13 Spec */ #define WIN_NOP 0x00 /* * 0x01->0x02 Reserved */ #define CFA_REQ_EXT_ERROR_CODE 0x03 /* CFA Request Extended Error Code */ /* * 0x04->0x07 Reserved */ #define WIN_SRST 0x08 /* ATAPI soft reset command */ #define WIN_DEVICE_RESET 0x08 /* * 0x09->0x0F Reserved */ #define WIN_RECAL 0x10 #define WIN_RESTORE WIN_RECAL /* * 0x10->0x1F Reserved */ #define WIN_READ 0x20 /* 28-Bit */ #define WIN_READ_ONCE 0x21 /* 28-Bit without retries */ #define WIN_READ_LONG 0x22 /* 28-Bit */ #define WIN_READ_LONG_ONCE 0x23 /* 28-Bit without retries */ #define WIN_READ_EXT 0x24 /* 48-Bit */ #define WIN_READDMA_EXT 0x25 /* 48-Bit */ #define WIN_READDMA_QUEUED_EXT 0x26 /* 48-Bit */ #define WIN_READ_NATIVE_MAX_EXT 0x27 /* 48-Bit */ /* * 0x28 */ #define WIN_MULTREAD_EXT 0x29 /* 48-Bit */ /* * 0x2A->0x2F Reserved */ #define WIN_WRITE 0x30 /* 28-Bit */ #define WIN_WRITE_ONCE 0x31 /* 28-Bit without retries */ #define WIN_WRITE_LONG 0x32 /* 28-Bit */ #define WIN_WRITE_LONG_ONCE 0x33 /* 28-Bit without retries */ #define WIN_WRITE_EXT 0x34 /* 48-Bit */ #define WIN_WRITEDMA_EXT 0x35 /* 48-Bit */ #define WIN_WRITEDMA_QUEUED_EXT 0x36 /* 48-Bit */ #define WIN_SET_MAX_EXT 0x37 /* 48-Bit */ #define CFA_WRITE_SECT_WO_ERASE 0x38 /* CFA Write Sectors without erase */ #define WIN_MULTWRITE_EXT 0x39 /* 48-Bit */ /* * 0x3A->0x3B Reserved */ #define WIN_WRITE_VERIFY 0x3C /* 28-Bit */ /* * 0x3D->0x3F Reserved */ #define WIN_VERIFY 0x40 /* 28-Bit - Read Verify Sectors */ #define WIN_VERIFY_ONCE 0x41 /* 28-Bit - without retries */ #define WIN_VERIFY_EXT 0x42 /* 48-Bit */ /* * 0x43->0x4F Reserved */ #define WIN_FORMAT 0x50 /* * 0x51->0x5F Reserved */ #define WIN_INIT 0x60 /* * 0x61->0x5F Reserved */ #define WIN_SEEK 0x70 /* 0x70-0x7F Reserved */ #define CFA_TRANSLATE_SECTOR 0x87 /* CFA Translate Sector */ #define WIN_DIAGNOSE 0x90 #define WIN_SPECIFY 0x91 /* set drive geometry translation */ #define WIN_DOWNLOAD_MICROCODE 0x92 #define WIN_STANDBYNOW2 0x94 #define WIN_STANDBY2 0x96 #define WIN_SETIDLE2 0x97 #define WIN_CHECKPOWERMODE2 0x98 #define WIN_SLEEPNOW2 0x99 /* * 0x9A VENDOR */ #define WIN_PACKETCMD 0xA0 /* Send a packet command. */ #define WIN_PIDENTIFY 0xA1 /* identify ATAPI device */ #define WIN_QUEUED_SERVICE 0xA2 #define WIN_SMART 0xB0 /* self-monitoring and reporting */ #define CFA_ERASE_SECTORS 0xC0 #define WIN_MULTREAD 0xC4 /* read sectors using multiple mode*/ #define WIN_MULTWRITE 0xC5 /* write sectors using multiple mode */ #define WIN_SETMULT 0xC6 /* enable/disable multiple mode */ #define WIN_READDMA_QUEUED 0xC7 /* read sectors using Queued DMA transfers */ #define WIN_READDMA 0xC8 /* read sectors using DMA transfers */ #define WIN_READDMA_ONCE 0xC9 /* 28-Bit - without retries */ #define WIN_WRITEDMA 0xCA /* write sectors using DMA transfers */ #define WIN_WRITEDMA_ONCE 0xCB /* 28-Bit - without retries */ #define WIN_WRITEDMA_QUEUED 0xCC /* write sectors using Queued DMA transfers */ #define CFA_WRITE_MULTI_WO_ERASE 0xCD /* CFA Write multiple without erase */ #define WIN_GETMEDIASTATUS 0xDA #define WIN_ACKMEDIACHANGE 0xDB /* ATA-1, ATA-2 vendor */ #define WIN_POSTBOOT 0xDC #define WIN_PREBOOT 0xDD #define WIN_DOORLOCK 0xDE /* lock door on removable drives */ #define WIN_DOORUNLOCK 0xDF /* unlock door on removable drives */ #define WIN_STANDBYNOW1 0xE0 #define WIN_IDLEIMMEDIATE 0xE1 /* force drive to become "ready" */ #define WIN_STANDBY 0xE2 /* Set device in Standby Mode */ #define WIN_SETIDLE1 0xE3 #define WIN_READ_BUFFER 0xE4 /* force read only 1 sector */ #define WIN_CHECKPOWERMODE1 0xE5 #define WIN_SLEEPNOW1 0xE6 #define WIN_FLUSH_CACHE 0xE7 #define WIN_WRITE_BUFFER 0xE8 /* force write only 1 sector */ #define WIN_WRITE_SAME 0xE9 /* read ata-2 to use */ /* SET_FEATURES 0x22 or 0xDD */ #define WIN_FLUSH_CACHE_EXT 0xEA /* 48-Bit */ #define WIN_IDENTIFY 0xEC /* ask drive to identify itself */ #define WIN_MEDIAEJECT 0xED #define WIN_IDENTIFY_DMA 0xEE /* same as WIN_IDENTIFY, but DMA */ #define WIN_SETFEATURES 0xEF /* set special drive features */ #define EXABYTE_ENABLE_NEST 0xF0 #define WIN_SECURITY_SET_PASS 0xF1 #define WIN_SECURITY_UNLOCK 0xF2 #define WIN_SECURITY_ERASE_PREPARE 0xF3 #define WIN_SECURITY_ERASE_UNIT 0xF4 #define WIN_SECURITY_FREEZE_LOCK 0xF5 #define WIN_SECURITY_DISABLE 0xF6 #define WIN_READ_NATIVE_MAX 0xF8 /* return the native maximum address */ #define WIN_SET_MAX 0xF9 #define DISABLE_SEAGATE 0xFB /* WIN_SMART sub-commands */ #define SMART_READ_VALUES 0xD0 #define SMART_READ_THRESHOLDS 0xD1 #define SMART_AUTOSAVE 0xD2 #define SMART_SAVE 0xD3 #define SMART_IMMEDIATE_OFFLINE 0xD4 #define SMART_READ_LOG_SECTOR 0xD5 #define SMART_WRITE_LOG_SECTOR 0xD6 #define SMART_WRITE_THRESHOLDS 0xD7 #define SMART_ENABLE 0xD8 #define SMART_DISABLE 0xD9 #define SMART_STATUS 0xDA #define SMART_AUTO_OFFLINE 0xDB /* Password used in TF4 & TF5 executing SMART commands */ #define SMART_LCYL_PASS 0x4F #define SMART_HCYL_PASS 0xC2 /* WIN_SETFEATURES sub-commands */ #define SETFEATURES_EN_8BIT 0x01 /* Enable 8-Bit Transfers */ #define SETFEATURES_EN_WCACHE 0x02 /* Enable write cache */ #define SETFEATURES_DIS_DEFECT 0x04 /* Disable Defect Management */ #define SETFEATURES_EN_APM 0x05 /* Enable advanced power management */ #define SETFEATURES_EN_SAME_R 0x22 /* for a region ATA-1 */ #define SETFEATURES_DIS_MSN 0x31 /* Disable Media Status Notification */ #define SETFEATURES_DIS_RETRY 0x33 /* Disable Retry */ #define SETFEATURES_EN_AAM 0x42 /* Enable Automatic Acoustic Management */ #define SETFEATURES_RW_LONG 0x44 /* Set Length of VS bytes */ #define SETFEATURES_SET_CACHE 0x54 /* Set Cache segments to SC Reg. Val */ #define SETFEATURES_DIS_RLA 0x55 /* Disable read look-ahead feature */ #define SETFEATURES_EN_RI 0x5D /* Enable release interrupt */ #define SETFEATURES_EN_SI 0x5E /* Enable SERVICE interrupt */ #define SETFEATURES_DIS_RPOD 0x66 /* Disable reverting to power on defaults */ #define SETFEATURES_DIS_ECC 0x77 /* Disable ECC byte count */ #define SETFEATURES_DIS_8BIT 0x81 /* Disable 8-Bit Transfers */ #define SETFEATURES_DIS_WCACHE 0x82 /* Disable write cache */ #define SETFEATURES_EN_DEFECT 0x84 /* Enable Defect Management */ #define SETFEATURES_DIS_APM 0x85 /* Disable advanced power management */ #define SETFEATURES_EN_ECC 0x88 /* Enable ECC byte count */ #define SETFEATURES_EN_MSN 0x95 /* Enable Media Status Notification */ #define SETFEATURES_EN_RETRY 0x99 /* Enable Retry */ #define SETFEATURES_EN_RLA 0xAA /* Enable read look-ahead feature */ #define SETFEATURES_PREFETCH 0xAB /* Sets drive prefetch value */ #define SETFEATURES_EN_REST 0xAC /* ATA-1 */ #define SETFEATURES_4B_RW_LONG 0xBB /* Set Length of 4 bytes */ #define SETFEATURES_DIS_AAM 0xC2 /* Disable Automatic Acoustic Management */ #define SETFEATURES_EN_RPOD 0xCC /* Enable reverting to power on defaults */ #define SETFEATURES_DIS_RI 0xDD /* Disable release interrupt ATAPI */ #define SETFEATURES_EN_SAME_M 0xDD /* for a entire device ATA-1 */ #define SETFEATURES_DIS_SI 0xDE /* Disable SERVICE interrupt ATAPI */ /* WIN_SECURITY sub-commands */ #define SECURITY_SET_PASSWORD 0xBA #define SECURITY_UNLOCK 0xBB #define SECURITY_ERASE_PREPARE 0xBC #define SECURITY_ERASE_UNIT 0xBD #define SECURITY_FREEZE_LOCK 0xBE #define SECURITY_DISABLE_PASSWORD 0xBF struct hd_geometry { unsigned char heads; unsigned char sectors; unsigned short cylinders; unsigned long start; }; /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ #define HDIO_GETGEO 0x0301 /* get device geometry */ #define HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ #define HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ #define HDIO_GET_QDMA 0x0305 /* get use-qdma flag */ #define HDIO_SET_XFER 0x0306 /* set transfer rate via proc */ #define HDIO_OBSOLETE_IDENTITY 0x0307 /* OBSOLETE, DO NOT USE: returns 142 bytes */ #define HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ #define HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ #define HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ #define HDIO_GET_DMA 0x030b /* get use-dma flag */ #define HDIO_GET_NICE 0x030c /* get nice flags */ #define HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ #define HDIO_GET_WCACHE 0x030e /* get write cache mode on|off */ #define HDIO_GET_ACOUSTIC 0x030f /* get acoustic value */ #define HDIO_GET_ADDRESS 0x0310 /* */ #define HDIO_GET_BUSSTATE 0x031a /* get the bus state of the hwif */ #define HDIO_TRISTATE_HWIF 0x031b /* execute a channel tristate */ #define HDIO_DRIVE_RESET 0x031c /* execute a device reset */ #define HDIO_DRIVE_TASKFILE 0x031d /* execute raw taskfile */ #define HDIO_DRIVE_TASK 0x031e /* execute task and special drive command */ #define HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ #define HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ #define HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ #define HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ #define HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ #define HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ #define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ #define HDIO_SET_DMA 0x0326 /* change use-dma flag */ #define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ #define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */ #define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */ #define HDIO_SET_NICE 0x0329 /* set nice flags */ #define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */ #define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */ #define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */ #define HDIO_SET_QDMA 0x032e /* change use-qdma flag */ #define HDIO_SET_ADDRESS 0x032f /* change lba addressing modes */ /* bus states */ enum { BUSSTATE_OFF = 0, BUSSTATE_ON, BUSSTATE_TRISTATE }; /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x033n/0x033n */ /* 0x330 is reserved - used to be HDIO_GETGEO_BIG */ /* 0x331 is reserved - used to be HDIO_GETGEO_BIG_RAW */ /* 0x338 is reserved - used to be HDIO_SET_IDE_SCSI */ /* 0x339 is reserved - used to be HDIO_SET_SCSI_IDE */ #define __NEW_HD_DRIVE_ID /* * Structure returned by HDIO_GET_IDENTITY, as per ANSI NCITS ATA6 rev.1b spec. * * If you change something here, please remember to update fix_driveid() in * ide/probe.c. */ struct hd_driveid { unsigned short config; /* lots of obsolete bit flags */ unsigned short cyls; /* Obsolete, "physical" cyls */ unsigned short reserved2; /* reserved (word 2) */ unsigned short heads; /* Obsolete, "physical" heads */ unsigned short track_bytes; /* unformatted bytes per track */ unsigned short sector_bytes; /* unformatted bytes per sector */ unsigned short sectors; /* Obsolete, "physical" sectors per track */ unsigned short vendor0; /* vendor unique */ unsigned short vendor1; /* vendor unique */ unsigned short vendor2; /* Retired vendor unique */ unsigned char serial_no[20]; /* 0 = not_specified */ unsigned short buf_type; /* Retired */ unsigned short buf_size; /* Retired, 512 byte increments * 0 = not_specified */ unsigned short ecc_bytes; /* for r/w long cmds; 0 = not_specified */ unsigned char fw_rev[8]; /* 0 = not_specified */ unsigned char model[40]; /* 0 = not_specified */ unsigned char max_multsect; /* 0=not_implemented */ unsigned char vendor3; /* vendor unique */ unsigned short dword_io; /* 0=not_implemented; 1=implemented */ unsigned char vendor4; /* vendor unique */ unsigned char capability; /* (upper byte of word 49) * 3: IORDYsup * 2: IORDYsw * 1: LBA * 0: DMA */ unsigned short reserved50; /* reserved (word 50) */ unsigned char vendor5; /* Obsolete, vendor unique */ unsigned char tPIO; /* Obsolete, 0=slow, 1=medium, 2=fast */ unsigned char vendor6; /* Obsolete, vendor unique */ unsigned char tDMA; /* Obsolete, 0=slow, 1=medium, 2=fast */ unsigned short field_valid; /* (word 53) * 2: ultra_ok word 88 * 1: eide_ok words 64-70 * 0: cur_ok words 54-58 */ unsigned short cur_cyls; /* Obsolete, logical cylinders */ unsigned short cur_heads; /* Obsolete, l heads */ unsigned short cur_sectors; /* Obsolete, l sectors per track */ unsigned short cur_capacity0; /* Obsolete, l total sectors on drive */ unsigned short cur_capacity1; /* Obsolete, (2 words, misaligned int) */ unsigned char multsect; /* current multiple sector count */ unsigned char multsect_valid; /* when (bit0==1) multsect is ok */ unsigned int lba_capacity; /* Obsolete, total number of sectors */ unsigned short dma_1word; /* Obsolete, single-word dma info */ unsigned short dma_mword; /* multiple-word dma info */ unsigned short eide_pio_modes; /* bits 0:mode3 1:mode4 */ unsigned short eide_dma_min; /* min mword dma cycle time (ns) */ unsigned short eide_dma_time; /* recommended mword dma cycle time (ns) */ unsigned short eide_pio; /* min cycle time (ns), no IORDY */ unsigned short eide_pio_iordy; /* min cycle time (ns), with IORDY */ unsigned short words69_70[2]; /* reserved words 69-70 * future command overlap and queuing */ unsigned short words71_74[4]; /* reserved words 71-74 * for IDENTIFY PACKET DEVICE command */ unsigned short queue_depth; /* (word 75) * 15:5 reserved * 4:0 Maximum queue depth -1 */ unsigned short words76_79[4]; /* reserved words 76-79 */ unsigned short major_rev_num; /* (word 80) */ unsigned short minor_rev_num; /* (word 81) */ unsigned short command_set_1; /* (word 82) supported * 15: Obsolete * 14: NOP command * 13: READ_BUFFER * 12: WRITE_BUFFER * 11: Obsolete * 10: Host Protected Area * 9: DEVICE Reset * 8: SERVICE Interrupt * 7: Release Interrupt * 6: look-ahead * 5: write cache * 4: PACKET Command * 3: Power Management Feature Set * 2: Removable Feature Set * 1: Security Feature Set * 0: SMART Feature Set */ unsigned short command_set_2; /* (word 83) * 15: Shall be ZERO * 14: Shall be ONE * 13: FLUSH CACHE EXT * 12: FLUSH CACHE * 11: Device Configuration Overlay * 10: 48-bit Address Feature Set * 9: Automatic Acoustic Management * 8: SET MAX security * 7: reserved 1407DT PARTIES * 6: SetF sub-command Power-Up * 5: Power-Up in Standby Feature Set * 4: Removable Media Notification * 3: APM Feature Set * 2: CFA Feature Set * 1: READ/WRITE DMA QUEUED * 0: Download MicroCode */ unsigned short cfsse; /* (word 84) * cmd set-feature supported extensions * 15: Shall be ZERO * 14: Shall be ONE * 13:6 reserved * 5: General Purpose Logging * 4: Streaming Feature Set * 3: Media Card Pass Through * 2: Media Serial Number Valid * 1: SMART selt-test supported * 0: SMART error logging */ unsigned short cfs_enable_1; /* (word 85) * command set-feature enabled * 15: Obsolete * 14: NOP command * 13: READ_BUFFER * 12: WRITE_BUFFER * 11: Obsolete * 10: Host Protected Area * 9: DEVICE Reset * 8: SERVICE Interrupt * 7: Release Interrupt * 6: look-ahead * 5: write cache * 4: PACKET Command * 3: Power Management Feature Set * 2: Removable Feature Set * 1: Security Feature Set * 0: SMART Feature Set */ unsigned short cfs_enable_2; /* (word 86) * command set-feature enabled * 15: Shall be ZERO * 14: Shall be ONE * 13: FLUSH CACHE EXT * 12: FLUSH CACHE * 11: Device Configuration Overlay * 10: 48-bit Address Feature Set * 9: Automatic Acoustic Management * 8: SET MAX security * 7: reserved 1407DT PARTIES * 6: SetF sub-command Power-Up * 5: Power-Up in Standby Feature Set * 4: Removable Media Notification * 3: APM Feature Set * 2: CFA Feature Set * 1: READ/WRITE DMA QUEUED * 0: Download MicroCode */ unsigned short csf_default; /* (word 87) * command set-feature default * 15: Shall be ZERO * 14: Shall be ONE * 13:6 reserved * 5: General Purpose Logging enabled * 4: Valid CONFIGURE STREAM executed * 3: Media Card Pass Through enabled * 2: Media Serial Number Valid * 1: SMART selt-test supported * 0: SMART error logging */ unsigned short dma_ultra; /* (word 88) */ unsigned short trseuc; /* time required for security erase */ unsigned short trsEuc; /* time required for enhanced erase */ unsigned short CurAPMvalues; /* current APM values */ unsigned short mprc; /* master password revision code */ unsigned short hw_config; /* hardware config (word 93) * 15: Shall be ZERO * 14: Shall be ONE * 13: * 12: * 11: * 10: * 9: * 8: * 7: * 6: * 5: * 4: * 3: * 2: * 1: * 0: Shall be ONE */ unsigned short acoustic; /* (word 94) * 15:8 Vendor's recommended value * 7:0 current value */ unsigned short msrqs; /* min stream request size */ unsigned short sxfert; /* stream transfer time */ unsigned short sal; /* stream access latency */ unsigned int spg; /* stream performance granularity */ unsigned long long lba_capacity_2;/* 48-bit total number of sectors */ unsigned short words104_125[22];/* reserved words 104-125 */ unsigned short last_lun; /* (word 126) */ unsigned short word127; /* (word 127) Feature Set * Removable Media Notification * 15:2 reserved * 1:0 00 = not supported * 01 = supported * 10 = reserved * 11 = reserved */ unsigned short dlf; /* (word 128) * device lock function * 15:9 reserved * 8 security level 1:max 0:high * 7:6 reserved * 5 enhanced erase * 4 expire * 3 frozen * 2 locked * 1 en/disabled * 0 capability */ unsigned short csfo; /* (word 129) * current set features options * 15:4 reserved * 3: auto reassign * 2: reverting * 1: read-look-ahead * 0: write cache */ unsigned short words130_155[26];/* reserved vendor words 130-155 */ unsigned short word156; /* reserved vendor word 156 */ unsigned short words157_159[3];/* reserved vendor words 157-159 */ unsigned short cfa_power; /* (word 160) CFA Power Mode * 15 word 160 supported * 14 reserved * 13 * 12 * 11:0 */ unsigned short words161_175[15];/* Reserved for CFA */ unsigned short words176_205[30];/* Current Media Serial Number */ unsigned short words206_254[49];/* reserved words 206-254 */ unsigned short integrity_word; /* (word 255) * 15:8 Checksum * 7:0 Signature */ }; /* * IDE "nice" flags. These are used on a per drive basis to determine * when to be nice and give more bandwidth to the other devices which * share the same IDE bus. */ #define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */ #define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */ #define IDE_NICE_1 (3) /* when probably won't affect us much */ #define IDE_NICE_0 (2) /* when sure that it won't affect us */ #define IDE_NICE_2 (4) /* when we know it's on our expense */ #endif /* _LINUX_HDREG_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/screen_info.h���������������������������������������������������������������������������������0000644�����������������00000004657�14763166027�0010376 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _SCREEN_INFO_H #define _SCREEN_INFO_H #include <linux/types.h> /* * These are set up by the setup-routine at boot-time: */ struct screen_info { __u8 orig_x; /* 0x00 */ __u8 orig_y; /* 0x01 */ __u16 ext_mem_k; /* 0x02 */ __u16 orig_video_page; /* 0x04 */ __u8 orig_video_mode; /* 0x06 */ __u8 orig_video_cols; /* 0x07 */ __u8 flags; /* 0x08 */ __u8 unused2; /* 0x09 */ __u16 orig_video_ega_bx;/* 0x0a */ __u16 unused3; /* 0x0c */ __u8 orig_video_lines; /* 0x0e */ __u8 orig_video_isVGA; /* 0x0f */ __u16 orig_video_points;/* 0x10 */ /* VESA graphic mode -- linear frame buffer */ __u16 lfb_width; /* 0x12 */ __u16 lfb_height; /* 0x14 */ __u16 lfb_depth; /* 0x16 */ __u32 lfb_base; /* 0x18 */ __u32 lfb_size; /* 0x1c */ __u16 cl_magic, cl_offset; /* 0x20 */ __u16 lfb_linelength; /* 0x24 */ __u8 red_size; /* 0x26 */ __u8 red_pos; /* 0x27 */ __u8 green_size; /* 0x28 */ __u8 green_pos; /* 0x29 */ __u8 blue_size; /* 0x2a */ __u8 blue_pos; /* 0x2b */ __u8 rsvd_size; /* 0x2c */ __u8 rsvd_pos; /* 0x2d */ __u16 vesapm_seg; /* 0x2e */ __u16 vesapm_off; /* 0x30 */ __u16 pages; /* 0x32 */ __u16 vesa_attributes; /* 0x34 */ __u32 capabilities; /* 0x36 */ __u32 ext_lfb_base; /* 0x3a */ __u8 _reserved[2]; /* 0x3e */ } __attribute__((packed)); #define VIDEO_TYPE_MDA 0x10 /* Monochrome Text Display */ #define VIDEO_TYPE_CGA 0x11 /* CGA Display */ #define VIDEO_TYPE_EGAM 0x20 /* EGA/VGA in Monochrome Mode */ #define VIDEO_TYPE_EGAC 0x21 /* EGA in Color Mode */ #define VIDEO_TYPE_VGAC 0x22 /* VGA+ in Color Mode */ #define VIDEO_TYPE_VLFB 0x23 /* VESA VGA in graphic mode */ #define VIDEO_TYPE_PICA_S3 0x30 /* ACER PICA-61 local S3 video */ #define VIDEO_TYPE_MIPS_G364 0x31 /* MIPS Magnum 4000 G364 video */ #define VIDEO_TYPE_SGI 0x33 /* Various SGI graphics hardware */ #define VIDEO_TYPE_TGAC 0x40 /* DEC TGA */ #define VIDEO_TYPE_SUN 0x50 /* Sun frame buffer. */ #define VIDEO_TYPE_SUNPCI 0x51 /* Sun PCI based frame buffer. */ #define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */ #define VIDEO_TYPE_EFI 0x70 /* EFI graphic mode */ #define VIDEO_FLAGS_NOCURSOR (1 << 0) /* The video mode has no cursor set */ #define VIDEO_CAPABILITY_SKIP_QUIRKS (1 << 0) #define VIDEO_CAPABILITY_64BIT_BASE (1 << 1) /* Frame buffer base is 64-bit */ #endif /* _SCREEN_INFO_H */ ���������������������������������������������������������������������������������linux/arm_sdei.h������������������������������������������������������������������������������������0000644�����������������00000005277�14763166027�0007666 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Copyright (C) 2017 Arm Ltd. */ #ifndef _LINUX_ARM_SDEI_H #define _LINUX_ARM_SDEI_H #define SDEI_1_0_FN_BASE 0xC4000020 #define SDEI_1_0_MASK 0xFFFFFFE0 #define SDEI_1_0_FN(n) (SDEI_1_0_FN_BASE + (n)) #define SDEI_1_0_FN_SDEI_VERSION SDEI_1_0_FN(0x00) #define SDEI_1_0_FN_SDEI_EVENT_REGISTER SDEI_1_0_FN(0x01) #define SDEI_1_0_FN_SDEI_EVENT_ENABLE SDEI_1_0_FN(0x02) #define SDEI_1_0_FN_SDEI_EVENT_DISABLE SDEI_1_0_FN(0x03) #define SDEI_1_0_FN_SDEI_EVENT_CONTEXT SDEI_1_0_FN(0x04) #define SDEI_1_0_FN_SDEI_EVENT_COMPLETE SDEI_1_0_FN(0x05) #define SDEI_1_0_FN_SDEI_EVENT_COMPLETE_AND_RESUME SDEI_1_0_FN(0x06) #define SDEI_1_0_FN_SDEI_EVENT_UNREGISTER SDEI_1_0_FN(0x07) #define SDEI_1_0_FN_SDEI_EVENT_STATUS SDEI_1_0_FN(0x08) #define SDEI_1_0_FN_SDEI_EVENT_GET_INFO SDEI_1_0_FN(0x09) #define SDEI_1_0_FN_SDEI_EVENT_ROUTING_SET SDEI_1_0_FN(0x0A) #define SDEI_1_0_FN_SDEI_PE_MASK SDEI_1_0_FN(0x0B) #define SDEI_1_0_FN_SDEI_PE_UNMASK SDEI_1_0_FN(0x0C) #define SDEI_1_0_FN_SDEI_INTERRUPT_BIND SDEI_1_0_FN(0x0D) #define SDEI_1_0_FN_SDEI_INTERRUPT_RELEASE SDEI_1_0_FN(0x0E) #define SDEI_1_0_FN_SDEI_PRIVATE_RESET SDEI_1_0_FN(0x11) #define SDEI_1_0_FN_SDEI_SHARED_RESET SDEI_1_0_FN(0x12) #define SDEI_VERSION_MAJOR_SHIFT 48 #define SDEI_VERSION_MAJOR_MASK 0x7fff #define SDEI_VERSION_MINOR_SHIFT 32 #define SDEI_VERSION_MINOR_MASK 0xffff #define SDEI_VERSION_VENDOR_SHIFT 0 #define SDEI_VERSION_VENDOR_MASK 0xffffffff #define SDEI_VERSION_MAJOR(x) (x>>SDEI_VERSION_MAJOR_SHIFT & SDEI_VERSION_MAJOR_MASK) #define SDEI_VERSION_MINOR(x) (x>>SDEI_VERSION_MINOR_SHIFT & SDEI_VERSION_MINOR_MASK) #define SDEI_VERSION_VENDOR(x) (x>>SDEI_VERSION_VENDOR_SHIFT & SDEI_VERSION_VENDOR_MASK) /* SDEI return values */ #define SDEI_SUCCESS 0 #define SDEI_NOT_SUPPORTED -1 #define SDEI_INVALID_PARAMETERS -2 #define SDEI_DENIED -3 #define SDEI_PENDING -5 #define SDEI_OUT_OF_RESOURCE -10 /* EVENT_REGISTER flags */ #define SDEI_EVENT_REGISTER_RM_ANY 0 #define SDEI_EVENT_REGISTER_RM_PE 1 /* EVENT_STATUS return value bits */ #define SDEI_EVENT_STATUS_RUNNING 2 #define SDEI_EVENT_STATUS_ENABLED 1 #define SDEI_EVENT_STATUS_REGISTERED 0 /* EVENT_COMPLETE status values */ #define SDEI_EV_HANDLED 0 #define SDEI_EV_FAILED 1 /* GET_INFO values */ #define SDEI_EVENT_INFO_EV_TYPE 0 #define SDEI_EVENT_INFO_EV_SIGNALED 1 #define SDEI_EVENT_INFO_EV_PRIORITY 2 #define SDEI_EVENT_INFO_EV_ROUTING_MODE 3 #define SDEI_EVENT_INFO_EV_ROUTING_AFF 4 /* and their results */ #define SDEI_EVENT_TYPE_PRIVATE 0 #define SDEI_EVENT_TYPE_SHARED 1 #define SDEI_EVENT_PRIORITY_NORMAL 0 #define SDEI_EVENT_PRIORITY_CRITICAL 1 #endif /* _LINUX_ARM_SDEI_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/ioctl.h���������������������������������������������������������������������������������������0000644�����������������00000000243�14763166027�0007201 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_IOCTL_H #define _LINUX_IOCTL_H #include <asm/ioctl.h> #endif /* _LINUX_IOCTL_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/isdn/capicmd.h��������������������������������������������������������������������������������0000644�����������������00000011257�14763166027�0010433 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* $Id: capicmd.h,v 1.2.6.2 2001/09/23 22:24:33 kai Exp $ * * CAPI 2.0 Interface for Linux * * Copyright 1997 by Carsten Paeth <calle@calle.de> * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * */ #ifndef __CAPICMD_H__ #define __CAPICMD_H__ #define CAPI_MSG_BASELEN 8 #define CAPI_DATA_B3_REQ_LEN (CAPI_MSG_BASELEN+4+4+2+2+2) #define CAPI_DATA_B3_RESP_LEN (CAPI_MSG_BASELEN+4+2) #define CAPI_DISCONNECT_B3_RESP_LEN (CAPI_MSG_BASELEN+4) /*----- CAPI commands -----*/ #define CAPI_ALERT 0x01 #define CAPI_CONNECT 0x02 #define CAPI_CONNECT_ACTIVE 0x03 #define CAPI_CONNECT_B3_ACTIVE 0x83 #define CAPI_CONNECT_B3 0x82 #define CAPI_CONNECT_B3_T90_ACTIVE 0x88 #define CAPI_DATA_B3 0x86 #define CAPI_DISCONNECT_B3 0x84 #define CAPI_DISCONNECT 0x04 #define CAPI_FACILITY 0x80 #define CAPI_INFO 0x08 #define CAPI_LISTEN 0x05 #define CAPI_MANUFACTURER 0xff #define CAPI_RESET_B3 0x87 #define CAPI_SELECT_B_PROTOCOL 0x41 /*----- CAPI subcommands -----*/ #define CAPI_REQ 0x80 #define CAPI_CONF 0x81 #define CAPI_IND 0x82 #define CAPI_RESP 0x83 /*----- CAPI combined commands -----*/ #define CAPICMD(cmd,subcmd) (((cmd)<<8)|(subcmd)) #define CAPI_DISCONNECT_REQ CAPICMD(CAPI_DISCONNECT,CAPI_REQ) #define CAPI_DISCONNECT_CONF CAPICMD(CAPI_DISCONNECT,CAPI_CONF) #define CAPI_DISCONNECT_IND CAPICMD(CAPI_DISCONNECT,CAPI_IND) #define CAPI_DISCONNECT_RESP CAPICMD(CAPI_DISCONNECT,CAPI_RESP) #define CAPI_ALERT_REQ CAPICMD(CAPI_ALERT,CAPI_REQ) #define CAPI_ALERT_CONF CAPICMD(CAPI_ALERT,CAPI_CONF) #define CAPI_CONNECT_REQ CAPICMD(CAPI_CONNECT,CAPI_REQ) #define CAPI_CONNECT_CONF CAPICMD(CAPI_CONNECT,CAPI_CONF) #define CAPI_CONNECT_IND CAPICMD(CAPI_CONNECT,CAPI_IND) #define CAPI_CONNECT_RESP CAPICMD(CAPI_CONNECT,CAPI_RESP) #define CAPI_CONNECT_ACTIVE_REQ CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_REQ) #define CAPI_CONNECT_ACTIVE_CONF CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_CONF) #define CAPI_CONNECT_ACTIVE_IND CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_IND) #define CAPI_CONNECT_ACTIVE_RESP CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_RESP) #define CAPI_SELECT_B_PROTOCOL_REQ CAPICMD(CAPI_SELECT_B_PROTOCOL,CAPI_REQ) #define CAPI_SELECT_B_PROTOCOL_CONF CAPICMD(CAPI_SELECT_B_PROTOCOL,CAPI_CONF) #define CAPI_CONNECT_B3_ACTIVE_REQ CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_REQ) #define CAPI_CONNECT_B3_ACTIVE_CONF CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_CONF) #define CAPI_CONNECT_B3_ACTIVE_IND CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_IND) #define CAPI_CONNECT_B3_ACTIVE_RESP CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_RESP) #define CAPI_CONNECT_B3_REQ CAPICMD(CAPI_CONNECT_B3,CAPI_REQ) #define CAPI_CONNECT_B3_CONF CAPICMD(CAPI_CONNECT_B3,CAPI_CONF) #define CAPI_CONNECT_B3_IND CAPICMD(CAPI_CONNECT_B3,CAPI_IND) #define CAPI_CONNECT_B3_RESP CAPICMD(CAPI_CONNECT_B3,CAPI_RESP) #define CAPI_CONNECT_B3_T90_ACTIVE_IND CAPICMD(CAPI_CONNECT_B3_T90_ACTIVE,CAPI_IND) #define CAPI_CONNECT_B3_T90_ACTIVE_RESP CAPICMD(CAPI_CONNECT_B3_T90_ACTIVE,CAPI_RESP) #define CAPI_DATA_B3_REQ CAPICMD(CAPI_DATA_B3,CAPI_REQ) #define CAPI_DATA_B3_CONF CAPICMD(CAPI_DATA_B3,CAPI_CONF) #define CAPI_DATA_B3_IND CAPICMD(CAPI_DATA_B3,CAPI_IND) #define CAPI_DATA_B3_RESP CAPICMD(CAPI_DATA_B3,CAPI_RESP) #define CAPI_DISCONNECT_B3_REQ CAPICMD(CAPI_DISCONNECT_B3,CAPI_REQ) #define CAPI_DISCONNECT_B3_CONF CAPICMD(CAPI_DISCONNECT_B3,CAPI_CONF) #define CAPI_DISCONNECT_B3_IND CAPICMD(CAPI_DISCONNECT_B3,CAPI_IND) #define CAPI_DISCONNECT_B3_RESP CAPICMD(CAPI_DISCONNECT_B3,CAPI_RESP) #define CAPI_RESET_B3_REQ CAPICMD(CAPI_RESET_B3,CAPI_REQ) #define CAPI_RESET_B3_CONF CAPICMD(CAPI_RESET_B3,CAPI_CONF) #define CAPI_RESET_B3_IND CAPICMD(CAPI_RESET_B3,CAPI_IND) #define CAPI_RESET_B3_RESP CAPICMD(CAPI_RESET_B3,CAPI_RESP) #define CAPI_LISTEN_REQ CAPICMD(CAPI_LISTEN,CAPI_REQ) #define CAPI_LISTEN_CONF CAPICMD(CAPI_LISTEN,CAPI_CONF) #define CAPI_MANUFACTURER_REQ CAPICMD(CAPI_MANUFACTURER,CAPI_REQ) #define CAPI_MANUFACTURER_CONF CAPICMD(CAPI_MANUFACTURER,CAPI_CONF) #define CAPI_MANUFACTURER_IND CAPICMD(CAPI_MANUFACTURER,CAPI_IND) #define CAPI_MANUFACTURER_RESP CAPICMD(CAPI_MANUFACTURER,CAPI_RESP) #define CAPI_FACILITY_REQ CAPICMD(CAPI_FACILITY,CAPI_REQ) #define CAPI_FACILITY_CONF CAPICMD(CAPI_FACILITY,CAPI_CONF) #define CAPI_FACILITY_IND CAPICMD(CAPI_FACILITY,CAPI_IND) #define CAPI_FACILITY_RESP CAPICMD(CAPI_FACILITY,CAPI_RESP) #define CAPI_INFO_REQ CAPICMD(CAPI_INFO,CAPI_REQ) #define CAPI_INFO_CONF CAPICMD(CAPI_INFO,CAPI_CONF) #define CAPI_INFO_IND CAPICMD(CAPI_INFO,CAPI_IND) #define CAPI_INFO_RESP CAPICMD(CAPI_INFO,CAPI_RESP) #endif /* __CAPICMD_H__ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/prctl.h���������������������������������������������������������������������������������������0000644�����������������00000016662�14763166027�0007227 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_PRCTL_H #define _LINUX_PRCTL_H #include <linux/types.h> /* Values to pass as first argument to prctl() */ #define PR_SET_PDEATHSIG 1 /* Second arg is a signal */ #define PR_GET_PDEATHSIG 2 /* Second arg is a ptr to return the signal */ /* Get/set current->mm->dumpable */ #define PR_GET_DUMPABLE 3 #define PR_SET_DUMPABLE 4 /* Get/set unaligned access control bits (if meaningful) */ #define PR_GET_UNALIGN 5 #define PR_SET_UNALIGN 6 # define PR_UNALIGN_NOPRINT 1 /* silently fix up unaligned user accesses */ # define PR_UNALIGN_SIGBUS 2 /* generate SIGBUS on unaligned user access */ /* Get/set whether or not to drop capabilities on setuid() away from * uid 0 (as per security/commoncap.c) */ #define PR_GET_KEEPCAPS 7 #define PR_SET_KEEPCAPS 8 /* Get/set floating-point emulation control bits (if meaningful) */ #define PR_GET_FPEMU 9 #define PR_SET_FPEMU 10 # define PR_FPEMU_NOPRINT 1 /* silently emulate fp operations accesses */ # define PR_FPEMU_SIGFPE 2 /* don't emulate fp operations, send SIGFPE instead */ /* Get/set floating-point exception mode (if meaningful) */ #define PR_GET_FPEXC 11 #define PR_SET_FPEXC 12 # define PR_FP_EXC_SW_ENABLE 0x80 /* Use FPEXC for FP exception enables */ # define PR_FP_EXC_DIV 0x010000 /* floating point divide by zero */ # define PR_FP_EXC_OVF 0x020000 /* floating point overflow */ # define PR_FP_EXC_UND 0x040000 /* floating point underflow */ # define PR_FP_EXC_RES 0x080000 /* floating point inexact result */ # define PR_FP_EXC_INV 0x100000 /* floating point invalid operation */ # define PR_FP_EXC_DISABLED 0 /* FP exceptions disabled */ # define PR_FP_EXC_NONRECOV 1 /* async non-recoverable exc. mode */ # define PR_FP_EXC_ASYNC 2 /* async recoverable exception mode */ # define PR_FP_EXC_PRECISE 3 /* precise exception mode */ /* Get/set whether we use statistical process timing or accurate timestamp * based process timing */ #define PR_GET_TIMING 13 #define PR_SET_TIMING 14 # define PR_TIMING_STATISTICAL 0 /* Normal, traditional, statistical process timing */ # define PR_TIMING_TIMESTAMP 1 /* Accurate timestamp based process timing */ #define PR_SET_NAME 15 /* Set process name */ #define PR_GET_NAME 16 /* Get process name */ /* Get/set process endian */ #define PR_GET_ENDIAN 19 #define PR_SET_ENDIAN 20 # define PR_ENDIAN_BIG 0 # define PR_ENDIAN_LITTLE 1 /* True little endian mode */ # define PR_ENDIAN_PPC_LITTLE 2 /* "PowerPC" pseudo little endian */ /* Get/set process seccomp mode */ #define PR_GET_SECCOMP 21 #define PR_SET_SECCOMP 22 /* Get/set the capability bounding set (as per security/commoncap.c) */ #define PR_CAPBSET_READ 23 #define PR_CAPBSET_DROP 24 /* Get/set the process' ability to use the timestamp counter instruction */ #define PR_GET_TSC 25 #define PR_SET_TSC 26 # define PR_TSC_ENABLE 1 /* allow the use of the timestamp counter */ # define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */ /* Get/set securebits (as per security/commoncap.c) */ #define PR_GET_SECUREBITS 27 #define PR_SET_SECUREBITS 28 /* * Get/set the timerslack as used by poll/select/nanosleep * A value of 0 means "use default" */ #define PR_SET_TIMERSLACK 29 #define PR_GET_TIMERSLACK 30 #define PR_TASK_PERF_EVENTS_DISABLE 31 #define PR_TASK_PERF_EVENTS_ENABLE 32 /* * Set early/late kill mode for hwpoison memory corruption. * This influences when the process gets killed on a memory corruption. */ #define PR_MCE_KILL 33 # define PR_MCE_KILL_CLEAR 0 # define PR_MCE_KILL_SET 1 # define PR_MCE_KILL_LATE 0 # define PR_MCE_KILL_EARLY 1 # define PR_MCE_KILL_DEFAULT 2 #define PR_MCE_KILL_GET 34 /* * Tune up process memory map specifics. */ #define PR_SET_MM 35 # define PR_SET_MM_START_CODE 1 # define PR_SET_MM_END_CODE 2 # define PR_SET_MM_START_DATA 3 # define PR_SET_MM_END_DATA 4 # define PR_SET_MM_START_STACK 5 # define PR_SET_MM_START_BRK 6 # define PR_SET_MM_BRK 7 # define PR_SET_MM_ARG_START 8 # define PR_SET_MM_ARG_END 9 # define PR_SET_MM_ENV_START 10 # define PR_SET_MM_ENV_END 11 # define PR_SET_MM_AUXV 12 # define PR_SET_MM_EXE_FILE 13 # define PR_SET_MM_MAP 14 # define PR_SET_MM_MAP_SIZE 15 /* * This structure provides new memory descriptor * map which mostly modifies /proc/pid/stat[m] * output for a task. This mostly done in a * sake of checkpoint/restore functionality. */ struct prctl_mm_map { __u64 start_code; /* code section bounds */ __u64 end_code; __u64 start_data; /* data section bounds */ __u64 end_data; __u64 start_brk; /* heap for brk() syscall */ __u64 brk; __u64 start_stack; /* stack starts at */ __u64 arg_start; /* command line arguments bounds */ __u64 arg_end; __u64 env_start; /* environment variables bounds */ __u64 env_end; __u64 *auxv; /* auxiliary vector */ __u32 auxv_size; /* vector size */ __u32 exe_fd; /* /proc/$pid/exe link file */ }; /* * Set specific pid that is allowed to ptrace the current task. * A value of 0 mean "no process". */ #define PR_SET_PTRACER 0x59616d61 # define PR_SET_PTRACER_ANY ((unsigned long)-1) #define PR_SET_CHILD_SUBREAPER 36 #define PR_GET_CHILD_SUBREAPER 37 /* * If no_new_privs is set, then operations that grant new privileges (i.e. * execve) will either fail or not grant them. This affects suid/sgid, * file capabilities, and LSMs. * * Operations that merely manipulate or drop existing privileges (setresuid, * capset, etc.) will still work. Drop those privileges if you want them gone. * * Changing LSM security domain is considered a new privilege. So, for example, * asking selinux for a specific new context (e.g. with runcon) will result * in execve returning -EPERM. * * See Documentation/userspace-api/no_new_privs.rst for more details. */ #define PR_SET_NO_NEW_PRIVS 38 #define PR_GET_NO_NEW_PRIVS 39 #define PR_GET_TID_ADDRESS 40 #define PR_SET_THP_DISABLE 41 #define PR_GET_THP_DISABLE 42 /* * Tell the kernel to start/stop helping userspace manage bounds tables. */ #define PR_MPX_ENABLE_MANAGEMENT 43 #define PR_MPX_DISABLE_MANAGEMENT 44 #define PR_SET_FP_MODE 45 #define PR_GET_FP_MODE 46 # define PR_FP_MODE_FR (1 << 0) /* 64b FP registers */ # define PR_FP_MODE_FRE (1 << 1) /* 32b compatibility */ /* Control the ambient capability set */ #define PR_CAP_AMBIENT 47 # define PR_CAP_AMBIENT_IS_SET 1 # define PR_CAP_AMBIENT_RAISE 2 # define PR_CAP_AMBIENT_LOWER 3 # define PR_CAP_AMBIENT_CLEAR_ALL 4 /* arm64 Scalable Vector Extension controls */ /* Flag values must be kept in sync with ptrace NT_ARM_SVE interface */ #define PR_SVE_SET_VL 50 /* set task vector length */ # define PR_SVE_SET_VL_ONEXEC (1 << 18) /* defer effect until exec */ #define PR_SVE_GET_VL 51 /* get task vector length */ /* Bits common to PR_SVE_SET_VL and PR_SVE_GET_VL */ # define PR_SVE_VL_LEN_MASK 0xffff # define PR_SVE_VL_INHERIT (1 << 17) /* inherit across exec */ /* Per task speculation control */ #define PR_GET_SPECULATION_CTRL 52 #define PR_SET_SPECULATION_CTRL 53 /* Speculation control variants */ # define PR_SPEC_STORE_BYPASS 0 # define PR_SPEC_INDIRECT_BRANCH 1 /* Return and control values for PR_SET/GET_SPECULATION_CTRL */ # define PR_SPEC_NOT_AFFECTED 0 # define PR_SPEC_PRCTL (1UL << 0) # define PR_SPEC_ENABLE (1UL << 1) # define PR_SPEC_DISABLE (1UL << 2) # define PR_SPEC_FORCE_DISABLE (1UL << 3) #endif /* _LINUX_PRCTL_H */ ������������������������������������������������������������������������������linux/nfs_mount.h�����������������������������������������������������������������������������������0000644�����������������00000004606�14763166027�0010106 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_NFS_MOUNT_H #define _LINUX_NFS_MOUNT_H /* * linux/include/linux/nfs_mount.h * * Copyright (C) 1992 Rick Sladkey * * structure passed from user-space to kernel-space during an nfs mount */ #include <linux/in.h> #include <linux/nfs.h> #include <linux/nfs2.h> #include <linux/nfs3.h> /* * WARNING! Do not delete or change the order of these fields. If * a new field is required then add it to the end. The version field * tracks which fields are present. This will ensure some measure of * mount-to-kernel version compatibility. Some of these aren't used yet * but here they are anyway. */ #define NFS_MOUNT_VERSION 6 #define NFS_MAX_CONTEXT_LEN 256 struct nfs_mount_data { int version; /* 1 */ int fd; /* 1 */ struct nfs2_fh old_root; /* 1 */ int flags; /* 1 */ int rsize; /* 1 */ int wsize; /* 1 */ int timeo; /* 1 */ int retrans; /* 1 */ int acregmin; /* 1 */ int acregmax; /* 1 */ int acdirmin; /* 1 */ int acdirmax; /* 1 */ struct sockaddr_in addr; /* 1 */ char hostname[NFS_MAXNAMLEN + 1]; /* 1 */ int namlen; /* 2 */ unsigned int bsize; /* 3 */ struct nfs3_fh root; /* 4 */ int pseudoflavor; /* 5 */ char context[NFS_MAX_CONTEXT_LEN + 1]; /* 6 */ }; /* bits in the flags field visible to user space */ #define NFS_MOUNT_SOFT 0x0001 /* 1 */ #define NFS_MOUNT_INTR 0x0002 /* 1 */ /* now unused, but ABI */ #define NFS_MOUNT_SECURE 0x0004 /* 1 */ #define NFS_MOUNT_POSIX 0x0008 /* 1 */ #define NFS_MOUNT_NOCTO 0x0010 /* 1 */ #define NFS_MOUNT_NOAC 0x0020 /* 1 */ #define NFS_MOUNT_TCP 0x0040 /* 2 */ #define NFS_MOUNT_VER3 0x0080 /* 3 */ #define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ #define NFS_MOUNT_NONLM 0x0200 /* 3 */ #define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ #define NFS_MOUNT_NOACL 0x0800 /* 4 */ #define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */ #define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 non-text parsed mount data only */ #define NFS_MOUNT_NORDIRPLUS 0x4000 /* 5 */ #define NFS_MOUNT_UNSHARED 0x8000 /* 5 */ #define NFS_MOUNT_FLAGMASK 0xFFFF /* The following are for internal use only */ #define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000 #define NFS_MOUNT_LOOKUP_CACHE_NONE 0x20000 #define NFS_MOUNT_NORESVPORT 0x40000 #define NFS_MOUNT_LEGACY_INTERFACE 0x80000 #define NFS_MOUNT_LOCAL_FLOCK 0x100000 #define NFS_MOUNT_LOCAL_FCNTL 0x200000 #endif ��������������������������������������������������������������������������������������������������������������������������linux/vhost.h���������������������������������������������������������������������������������������0000644�����������������00000017027�14763166027�0007242 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_VHOST_H #define _LINUX_VHOST_H /* Userspace interface for in-kernel virtio accelerators. */ /* vhost is used to reduce the number of system calls involved in virtio. * * Existing virtio net code is used in the guest without modification. * * This header includes interface used by userspace hypervisor for * device configuration. */ #include <linux/types.h> #include <linux/ioctl.h> #include <linux/virtio_config.h> #include <linux/virtio_ring.h> struct vhost_vring_state { unsigned int index; unsigned int num; }; struct vhost_vring_file { unsigned int index; int fd; /* Pass -1 to unbind from file. */ }; struct vhost_vring_addr { unsigned int index; /* Option flags. */ unsigned int flags; /* Flag values: */ /* Whether log address is valid. If set enables logging. */ #define VHOST_VRING_F_LOG 0 /* Start of array of descriptors (virtually contiguous) */ __u64 desc_user_addr; /* Used structure address. Must be 32 bit aligned */ __u64 used_user_addr; /* Available structure address. Must be 16 bit aligned */ __u64 avail_user_addr; /* Logging support. */ /* Log writes to used structure, at offset calculated from specified * address. Address must be 32 bit aligned. */ __u64 log_guest_addr; }; /* no alignment requirement */ struct vhost_iotlb_msg { __u64 iova; __u64 size; __u64 uaddr; #define VHOST_ACCESS_RO 0x1 #define VHOST_ACCESS_WO 0x2 #define VHOST_ACCESS_RW 0x3 __u8 perm; #define VHOST_IOTLB_MISS 1 #define VHOST_IOTLB_UPDATE 2 #define VHOST_IOTLB_INVALIDATE 3 #define VHOST_IOTLB_ACCESS_FAIL 4 __u8 type; }; #define VHOST_IOTLB_MSG 0x1 #define VHOST_IOTLB_MSG_V2 0x2 struct vhost_msg { int type; union { struct vhost_iotlb_msg iotlb; __u8 padding[64]; }; }; struct vhost_msg_v2 { __u32 type; __u32 reserved; union { struct vhost_iotlb_msg iotlb; __u8 padding[64]; }; }; struct vhost_memory_region { __u64 guest_phys_addr; __u64 memory_size; /* bytes */ __u64 userspace_addr; __u64 flags_padding; /* No flags are currently specified. */ }; /* All region addresses and sizes must be 4K aligned. */ #define VHOST_PAGE_SIZE 0x1000 struct vhost_memory { __u32 nregions; __u32 padding; struct vhost_memory_region regions[0]; }; /* ioctls */ #define VHOST_VIRTIO 0xAF /* Features bitmask for forward compatibility. Transport bits are used for * vhost specific features. */ #define VHOST_GET_FEATURES _IOR(VHOST_VIRTIO, 0x00, __u64) #define VHOST_SET_FEATURES _IOW(VHOST_VIRTIO, 0x00, __u64) /* Set current process as the (exclusive) owner of this file descriptor. This * must be called before any other vhost command. Further calls to * VHOST_OWNER_SET fail until VHOST_OWNER_RESET is called. */ #define VHOST_SET_OWNER _IO(VHOST_VIRTIO, 0x01) /* Give up ownership, and reset the device to default values. * Allows subsequent call to VHOST_OWNER_SET to succeed. */ #define VHOST_RESET_OWNER _IO(VHOST_VIRTIO, 0x02) /* Set up/modify memory layout */ #define VHOST_SET_MEM_TABLE _IOW(VHOST_VIRTIO, 0x03, struct vhost_memory) /* Write logging setup. */ /* Memory writes can optionally be logged by setting bit at an offset * (calculated from the physical address) from specified log base. * The bit is set using an atomic 32 bit operation. */ /* Set base address for logging. */ #define VHOST_SET_LOG_BASE _IOW(VHOST_VIRTIO, 0x04, __u64) /* Specify an eventfd file descriptor to signal on log write. */ #define VHOST_SET_LOG_FD _IOW(VHOST_VIRTIO, 0x07, int) /* Ring setup. */ /* Set number of descriptors in ring. This parameter can not * be modified while ring is running (bound to a device). */ #define VHOST_SET_VRING_NUM _IOW(VHOST_VIRTIO, 0x10, struct vhost_vring_state) /* Set addresses for the ring. */ #define VHOST_SET_VRING_ADDR _IOW(VHOST_VIRTIO, 0x11, struct vhost_vring_addr) /* Base value where queue looks for available descriptors */ #define VHOST_SET_VRING_BASE _IOW(VHOST_VIRTIO, 0x12, struct vhost_vring_state) /* Get accessor: reads index, writes value in num */ #define VHOST_GET_VRING_BASE _IOWR(VHOST_VIRTIO, 0x12, struct vhost_vring_state) /* Set the vring byte order in num. Valid values are VHOST_VRING_LITTLE_ENDIAN * or VHOST_VRING_BIG_ENDIAN (other values return -EINVAL). * The byte order cannot be changed while the device is active: trying to do so * returns -EBUSY. * This is a legacy only API that is simply ignored when VIRTIO_F_VERSION_1 is * set. * Not all kernel configurations support this ioctl, but all configurations that * support SET also support GET. */ #define VHOST_VRING_LITTLE_ENDIAN 0 #define VHOST_VRING_BIG_ENDIAN 1 #define VHOST_SET_VRING_ENDIAN _IOW(VHOST_VIRTIO, 0x13, struct vhost_vring_state) #define VHOST_GET_VRING_ENDIAN _IOW(VHOST_VIRTIO, 0x14, struct vhost_vring_state) /* The following ioctls use eventfd file descriptors to signal and poll * for events. */ /* Set eventfd to poll for added buffers */ #define VHOST_SET_VRING_KICK _IOW(VHOST_VIRTIO, 0x20, struct vhost_vring_file) /* Set eventfd to signal when buffers have beed used */ #define VHOST_SET_VRING_CALL _IOW(VHOST_VIRTIO, 0x21, struct vhost_vring_file) /* Set eventfd to signal an error */ #define VHOST_SET_VRING_ERR _IOW(VHOST_VIRTIO, 0x22, struct vhost_vring_file) /* Set busy loop timeout (in us) */ #define VHOST_SET_VRING_BUSYLOOP_TIMEOUT _IOW(VHOST_VIRTIO, 0x23, \ struct vhost_vring_state) /* Get busy loop timeout (in us) */ #define VHOST_GET_VRING_BUSYLOOP_TIMEOUT _IOW(VHOST_VIRTIO, 0x24, \ struct vhost_vring_state) /* Set or get vhost backend capability */ /* Use message type V2 */ #define VHOST_BACKEND_F_IOTLB_MSG_V2 0x1 #define VHOST_SET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x25, __u64) #define VHOST_GET_BACKEND_FEATURES _IOR(VHOST_VIRTIO, 0x26, __u64) /* VHOST_NET specific defines */ /* Attach virtio net ring to a raw socket, or tap device. * The socket must be already bound to an ethernet device, this device will be * used for transmit. Pass fd -1 to unbind from the socket and the transmit * device. This can be used to stop the ring (e.g. for migration). */ #define VHOST_NET_SET_BACKEND _IOW(VHOST_VIRTIO, 0x30, struct vhost_vring_file) /* Feature bits */ /* Log all write descriptors. Can be changed while device is active. */ #define VHOST_F_LOG_ALL 26 /* vhost-net should add virtio_net_hdr for RX, and strip for TX packets. */ #define VHOST_NET_F_VIRTIO_NET_HDR 27 /* VHOST_SCSI specific definitions */ /* * Used by QEMU userspace to ensure a consistent vhost-scsi ABI. * * ABI Rev 0: July 2012 version starting point for v3.6-rc merge candidate + * RFC-v2 vhost-scsi userspace. Add GET_ABI_VERSION ioctl usage * ABI Rev 1: January 2013. Ignore vhost_tpgt filed in struct vhost_scsi_target. * All the targets under vhost_wwpn can be seen and used by guset. */ #define VHOST_SCSI_ABI_VERSION 1 struct vhost_scsi_target { int abi_version; char vhost_wwpn[224]; /* TRANSPORT_IQN_LEN */ unsigned short vhost_tpgt; unsigned short reserved; }; #define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_scsi_target) #define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target) /* Changing this breaks userspace. */ #define VHOST_SCSI_GET_ABI_VERSION _IOW(VHOST_VIRTIO, 0x42, int) /* Set and get the events missed flag */ #define VHOST_SCSI_SET_EVENTS_MISSED _IOW(VHOST_VIRTIO, 0x43, __u32) #define VHOST_SCSI_GET_EVENTS_MISSED _IOW(VHOST_VIRTIO, 0x44, __u32) /* VHOST_VSOCK specific defines */ #define VHOST_VSOCK_SET_GUEST_CID _IOW(VHOST_VIRTIO, 0x60, __u64) #define VHOST_VSOCK_SET_RUNNING _IOW(VHOST_VIRTIO, 0x61, int) #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/gtp.h�����������������������������������������������������������������������������������������0000644�����������������00000001251�14763166027�0006661 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_GTP_H_ #define _LINUX_GTP_H_ enum gtp_genl_cmds { GTP_CMD_NEWPDP, GTP_CMD_DELPDP, GTP_CMD_GETPDP, GTP_CMD_MAX, }; enum gtp_version { GTP_V0 = 0, GTP_V1, }; enum gtp_attrs { GTPA_UNSPEC = 0, GTPA_LINK, GTPA_VERSION, GTPA_TID, /* for GTPv0 only */ GTPA_PEER_ADDRESS, /* Remote GSN peer, either SGSN or GGSN */ #define GTPA_SGSN_ADDRESS GTPA_PEER_ADDRESS /* maintain legacy attr name */ GTPA_MS_ADDRESS, GTPA_FLOW, GTPA_NET_NS_FD, GTPA_I_TEI, /* for GTPv1 only */ GTPA_O_TEI, /* for GTPv1 only */ GTPA_PAD, __GTPA_MAX, }; #define GTPA_MAX (__GTPA_MAX + 1) #endif /* _LINUX_GTP_H_ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/n_r3964.h�������������������������������������������������������������������������������������0000644�����������������00000004552�14763166027�0007202 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* r3964 linediscipline for linux * * ----------------------------------------------------------- * Copyright by * Philips Automation Projects * Kassel (Germany) * ----------------------------------------------------------- * This software may be used and distributed according to the terms of * the GNU General Public License, incorporated herein by reference. * * Author: * L. Haag * * $Log: r3964.h,v $ * Revision 1.4 2005/12/21 19:54:24 Kurt Huwig <kurt huwig de> * Fixed HZ usage on 2.6 kernels * Removed unnecessary include * * Revision 1.3 2001/03/18 13:02:24 dwmw2 * Fix timer usage, use spinlocks properly. * * Revision 1.2 2001/03/18 12:53:15 dwmw2 * Merge changes in 2.4.2 * * Revision 1.1.1.1 1998/10/13 16:43:14 dwmw2 * This'll screw the version control * * Revision 1.6 1998/09/30 00:40:38 dwmw2 * Updated to use kernel's N_R3964 if available * * Revision 1.4 1998/04/02 20:29:44 lhaag * select, blocking, ... * * Revision 1.3 1998/02/12 18:58:43 root * fixed some memory leaks * calculation of checksum characters * * Revision 1.2 1998/02/07 13:03:17 root * ioctl read_telegram * * Revision 1.1 1998/02/06 19:19:43 root * Initial revision * * */ #ifndef __LINUX_N_R3964_H__ #define __LINUX_N_R3964_H__ /* line disciplines for r3964 protocol */ /* * Ioctl-commands */ #define R3964_ENABLE_SIGNALS 0x5301 #define R3964_SETPRIORITY 0x5302 #define R3964_USE_BCC 0x5303 #define R3964_READ_TELEGRAM 0x5304 /* Options for R3964_SETPRIORITY */ #define R3964_MASTER 0 #define R3964_SLAVE 1 /* Options for R3964_ENABLE_SIGNALS */ #define R3964_SIG_ACK 0x0001 #define R3964_SIG_DATA 0x0002 #define R3964_SIG_ALL 0x000f #define R3964_SIG_NONE 0x0000 #define R3964_USE_SIGIO 0x1000 /* * r3964 operation states: */ /* types for msg_id: */ enum {R3964_MSG_ACK=1, R3964_MSG_DATA }; #define R3964_MAX_MSG_COUNT 32 /* error codes for client messages */ #define R3964_OK 0 /* no error. */ #define R3964_TX_FAIL -1 /* transmission error, block NOT sent */ #define R3964_OVERFLOW -2 /* msg queue overflow */ /* the client gets this struct when calling read(fd,...): */ struct r3964_client_message { int msg_id; int arg; int error_code; }; #define R3964_MTU 256 #endif /* __LINUX_N_R3964_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������linux/genetlink.h�����������������������������������������������������������������������������������0000644�����������������00000003603�14763166027�0010052 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_GENERIC_NETLINK_H #define __LINUX_GENERIC_NETLINK_H #include <linux/types.h> #include <linux/netlink.h> #define GENL_NAMSIZ 16 /* length of family name */ #define GENL_MIN_ID NLMSG_MIN_TYPE #define GENL_MAX_ID 1023 struct genlmsghdr { __u8 cmd; __u8 version; __u16 reserved; }; #define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr)) #define GENL_ADMIN_PERM 0x01 #define GENL_CMD_CAP_DO 0x02 #define GENL_CMD_CAP_DUMP 0x04 #define GENL_CMD_CAP_HASPOL 0x08 #define GENL_UNS_ADMIN_PERM 0x10 /* * List of reserved static generic netlink identifiers: */ #define GENL_ID_CTRL NLMSG_MIN_TYPE #define GENL_ID_VFS_DQUOT (NLMSG_MIN_TYPE + 1) #define GENL_ID_PMCRAID (NLMSG_MIN_TYPE + 2) /* must be last reserved + 1 */ #define GENL_START_ALLOC (NLMSG_MIN_TYPE + 3) /************************************************************************** * Controller **************************************************************************/ enum { CTRL_CMD_UNSPEC, CTRL_CMD_NEWFAMILY, CTRL_CMD_DELFAMILY, CTRL_CMD_GETFAMILY, CTRL_CMD_NEWOPS, CTRL_CMD_DELOPS, CTRL_CMD_GETOPS, CTRL_CMD_NEWMCAST_GRP, CTRL_CMD_DELMCAST_GRP, CTRL_CMD_GETMCAST_GRP, /* unused */ __CTRL_CMD_MAX, }; #define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1) enum { CTRL_ATTR_UNSPEC, CTRL_ATTR_FAMILY_ID, CTRL_ATTR_FAMILY_NAME, CTRL_ATTR_VERSION, CTRL_ATTR_HDRSIZE, CTRL_ATTR_MAXATTR, CTRL_ATTR_OPS, CTRL_ATTR_MCAST_GROUPS, __CTRL_ATTR_MAX, }; #define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1) enum { CTRL_ATTR_OP_UNSPEC, CTRL_ATTR_OP_ID, CTRL_ATTR_OP_FLAGS, __CTRL_ATTR_OP_MAX, }; #define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1) enum { CTRL_ATTR_MCAST_GRP_UNSPEC, CTRL_ATTR_MCAST_GRP_NAME, CTRL_ATTR_MCAST_GRP_ID, __CTRL_ATTR_MCAST_GRP_MAX, }; #define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1) #endif /* __LINUX_GENERIC_NETLINK_H */ �����������������������������������������������������������������������������������������������������������������������������linux/tty.h�����������������������������������������������������������������������������������������0000644�����������������00000003061�14763166027�0006710 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_TTY_H #define _LINUX_TTY_H /* * 'tty.h' defines some structures used by tty_io.c and some defines. */ #define NR_LDISCS 30 /* line disciplines */ #define N_TTY 0 #define N_SLIP 1 #define N_MOUSE 2 #define N_PPP 3 #define N_STRIP 4 #define N_AX25 5 #define N_X25 6 /* X.25 async */ #define N_6PACK 7 #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ #define N_R3964 9 /* Reserved for Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Reserved for Profibus */ #define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */ #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data */ /* cards about SMS messages */ #define N_HDLC 13 /* synchronous HDLC */ #define N_SYNC_PPP 14 /* synchronous PPP */ #define N_HCI 15 /* Bluetooth HCI UART */ #define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */ #define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */ #define N_PPS 18 /* Pulse per Second */ #define N_V253 19 /* Codec control over voice modem */ #define N_CAIF 20 /* CAIF protocol for talking to modems */ #define N_GSM0710 21 /* GSM 0710 Mux */ #define N_TI_WL 22 /* for TI's WL BT, FM, GPS combo chips */ #define N_TRACESINK 23 /* Trace data routing for MIPI P1149.7 */ #define N_TRACEROUTER 24 /* Trace data routing for MIPI P1149.7 */ #define N_NCI 25 /* NFC NCI UART */ #define N_SPEAKUP 26 /* Speakup communication with synths */ #define N_NULL 27 /* Null ldisc used for error handling */ #endif /* _LINUX_TTY_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/rxrpc.h���������������������������������������������������������������������������������������0000644�����������������00000011730�14763166027�0007230 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Types and definitions for AF_RXRPC. * * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public Licence * as published by the Free Software Foundation; either version * 2 of the Licence, or (at your option) any later version. */ #ifndef _LINUX_RXRPC_H #define _LINUX_RXRPC_H #include <linux/types.h> #include <linux/in.h> #include <linux/in6.h> /* * RxRPC socket address */ struct sockaddr_rxrpc { __kernel_sa_family_t srx_family; /* address family */ __u16 srx_service; /* service desired */ __u16 transport_type; /* type of transport socket (SOCK_DGRAM) */ __u16 transport_len; /* length of transport address */ union { __kernel_sa_family_t family; /* transport address family */ struct sockaddr_in sin; /* IPv4 transport address */ struct sockaddr_in6 sin6; /* IPv6 transport address */ } transport; }; /* * RxRPC socket options */ #define RXRPC_SECURITY_KEY 1 /* [clnt] set client security key */ #define RXRPC_SECURITY_KEYRING 2 /* [srvr] set ring of server security keys */ #define RXRPC_EXCLUSIVE_CONNECTION 3 /* Deprecated; use RXRPC_EXCLUSIVE_CALL instead */ #define RXRPC_MIN_SECURITY_LEVEL 4 /* minimum security level */ #define RXRPC_UPGRADEABLE_SERVICE 5 /* Upgrade service[0] -> service[1] */ #define RXRPC_SUPPORTED_CMSG 6 /* Get highest supported control message type */ /* * RxRPC control messages * - If neither abort or accept are specified, the message is a data message. * - terminal messages mean that a user call ID tag can be recycled * - s/r/- indicate whether these are applicable to sendmsg() and/or recvmsg() */ enum rxrpc_cmsg_type { RXRPC_USER_CALL_ID = 1, /* sr: user call ID specifier */ RXRPC_ABORT = 2, /* sr: abort request / notification [terminal] */ RXRPC_ACK = 3, /* -r: [Service] RPC op final ACK received [terminal] */ RXRPC_NET_ERROR = 5, /* -r: network error received [terminal] */ RXRPC_BUSY = 6, /* -r: server busy received [terminal] */ RXRPC_LOCAL_ERROR = 7, /* -r: local error generated [terminal] */ RXRPC_NEW_CALL = 8, /* -r: [Service] new incoming call notification */ RXRPC_ACCEPT = 9, /* s-: [Service] accept request */ RXRPC_EXCLUSIVE_CALL = 10, /* s-: Call should be on exclusive connection */ RXRPC_UPGRADE_SERVICE = 11, /* s-: Request service upgrade for client call */ RXRPC_TX_LENGTH = 12, /* s-: Total length of Tx data */ RXRPC_SET_CALL_TIMEOUT = 13, /* s-: Set one or more call timeouts */ RXRPC__SUPPORTED }; /* * RxRPC security levels */ #define RXRPC_SECURITY_PLAIN 0 /* plain secure-checksummed packets only */ #define RXRPC_SECURITY_AUTH 1 /* authenticated packets */ #define RXRPC_SECURITY_ENCRYPT 2 /* encrypted packets */ /* * RxRPC security indices */ #define RXRPC_SECURITY_NONE 0 /* no security protocol */ #define RXRPC_SECURITY_RXKAD 2 /* kaserver or kerberos 4 */ #define RXRPC_SECURITY_RXGK 4 /* gssapi-based */ #define RXRPC_SECURITY_RXK5 5 /* kerberos 5 */ /* * RxRPC-level abort codes */ #define RX_CALL_DEAD -1 /* call/conn has been inactive and is shut down */ #define RX_INVALID_OPERATION -2 /* invalid operation requested / attempted */ #define RX_CALL_TIMEOUT -3 /* call timeout exceeded */ #define RX_EOF -4 /* unexpected end of data on read op */ #define RX_PROTOCOL_ERROR -5 /* low-level protocol error */ #define RX_USER_ABORT -6 /* generic user abort */ #define RX_ADDRINUSE -7 /* UDP port in use */ #define RX_DEBUGI_BADTYPE -8 /* bad debugging packet type */ /* * (un)marshalling abort codes (rxgen) */ #define RXGEN_CC_MARSHAL -450 #define RXGEN_CC_UNMARSHAL -451 #define RXGEN_SS_MARSHAL -452 #define RXGEN_SS_UNMARSHAL -453 #define RXGEN_DECODE -454 #define RXGEN_OPCODE -455 #define RXGEN_SS_XDRFREE -456 #define RXGEN_CC_XDRFREE -457 /* * Rx kerberos security abort codes * - unfortunately we have no generalised security abort codes to say things * like "unsupported security", so we have to use these instead and hope the * other side understands */ #define RXKADINCONSISTENCY 19270400 /* security module structure inconsistent */ #define RXKADPACKETSHORT 19270401 /* packet too short for security challenge */ #define RXKADLEVELFAIL 19270402 /* security level negotiation failed */ #define RXKADTICKETLEN 19270403 /* ticket length too short or too long */ #define RXKADOUTOFSEQUENCE 19270404 /* packet had bad sequence number */ #define RXKADNOAUTH 19270405 /* caller not authorised */ #define RXKADBADKEY 19270406 /* illegal key: bad parity or weak */ #define RXKADBADTICKET 19270407 /* security object was passed a bad ticket */ #define RXKADUNKNOWNKEY 19270408 /* ticket contained unknown key version number */ #define RXKADEXPIRED 19270409 /* authentication expired */ #define RXKADSEALEDINCON 19270410 /* sealed data inconsistent */ #define RXKADDATALEN 19270411 /* user data too long */ #define RXKADILLEGALLEVEL 19270412 /* caller not authorised to use encrypted conns */ #endif /* _LINUX_RXRPC_H */ ����������������������������������������linux/inet_diag.h�����������������������������������������������������������������������������������0000644�����������������00000010422�14763166027�0010012 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _INET_DIAG_H_ #define _INET_DIAG_H_ #include <linux/types.h> /* Just some random number */ #define TCPDIAG_GETSOCK 18 #define DCCPDIAG_GETSOCK 19 #define INET_DIAG_GETSOCK_MAX 24 /* Socket identity */ struct inet_diag_sockid { __be16 idiag_sport; __be16 idiag_dport; __be32 idiag_src[4]; __be32 idiag_dst[4]; __u32 idiag_if; __u32 idiag_cookie[2]; #define INET_DIAG_NOCOOKIE (~0U) }; /* Request structure */ struct inet_diag_req { __u8 idiag_family; /* Family of addresses. */ __u8 idiag_src_len; __u8 idiag_dst_len; __u8 idiag_ext; /* Query extended information */ struct inet_diag_sockid id; __u32 idiag_states; /* States to dump */ __u32 idiag_dbs; /* Tables to dump (NI) */ }; struct inet_diag_req_v2 { __u8 sdiag_family; __u8 sdiag_protocol; __u8 idiag_ext; __u8 pad; __u32 idiag_states; struct inet_diag_sockid id; }; /* * SOCK_RAW sockets require the underlied protocol to be * additionally specified so we can use @pad member for * this, but we can't rename it because userspace programs * still may depend on this name. Instead lets use another * structure definition as an alias for struct * @inet_diag_req_v2. */ struct inet_diag_req_raw { __u8 sdiag_family; __u8 sdiag_protocol; __u8 idiag_ext; __u8 sdiag_raw_protocol; __u32 idiag_states; struct inet_diag_sockid id; }; enum { INET_DIAG_REQ_NONE, INET_DIAG_REQ_BYTECODE, }; #define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE /* Bytecode is sequence of 4 byte commands followed by variable arguments. * All the commands identified by "code" are conditional jumps forward: * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be * length of the command and its arguments. */ struct inet_diag_bc_op { unsigned char code; unsigned char yes; unsigned short no; }; enum { INET_DIAG_BC_NOP, INET_DIAG_BC_JMP, INET_DIAG_BC_S_GE, INET_DIAG_BC_S_LE, INET_DIAG_BC_D_GE, INET_DIAG_BC_D_LE, INET_DIAG_BC_AUTO, INET_DIAG_BC_S_COND, INET_DIAG_BC_D_COND, INET_DIAG_BC_DEV_COND, /* u32 ifindex */ INET_DIAG_BC_MARK_COND, INET_DIAG_BC_S_EQ, INET_DIAG_BC_D_EQ, }; struct inet_diag_hostcond { __u8 family; __u8 prefix_len; int port; __be32 addr[0]; }; struct inet_diag_markcond { __u32 mark; __u32 mask; }; /* Base info structure. It contains socket identity (addrs/ports/cookie) * and, alas, the information shown by netstat. */ struct inet_diag_msg { __u8 idiag_family; __u8 idiag_state; __u8 idiag_timer; __u8 idiag_retrans; struct inet_diag_sockid id; __u32 idiag_expires; __u32 idiag_rqueue; __u32 idiag_wqueue; __u32 idiag_uid; __u32 idiag_inode; }; /* Extensions */ enum { INET_DIAG_NONE, INET_DIAG_MEMINFO, INET_DIAG_INFO, INET_DIAG_VEGASINFO, INET_DIAG_CONG, INET_DIAG_TOS, INET_DIAG_TCLASS, INET_DIAG_SKMEMINFO, INET_DIAG_SHUTDOWN, /* * Next extenstions cannot be requested in struct inet_diag_req_v2: * its field idiag_ext has only 8 bits. */ INET_DIAG_DCTCPINFO, /* request as INET_DIAG_VEGASINFO */ INET_DIAG_PROTOCOL, /* response attribute only */ INET_DIAG_SKV6ONLY, INET_DIAG_LOCALS, INET_DIAG_PEERS, INET_DIAG_PAD, INET_DIAG_MARK, /* only with CAP_NET_ADMIN */ INET_DIAG_BBRINFO, /* request as INET_DIAG_VEGASINFO */ INET_DIAG_CLASS_ID, /* request as INET_DIAG_TCLASS */ INET_DIAG_MD5SIG, __INET_DIAG_MAX, }; #define INET_DIAG_MAX (__INET_DIAG_MAX - 1) /* INET_DIAG_MEM */ struct inet_diag_meminfo { __u32 idiag_rmem; __u32 idiag_wmem; __u32 idiag_fmem; __u32 idiag_tmem; }; /* INET_DIAG_VEGASINFO */ struct tcpvegas_info { __u32 tcpv_enabled; __u32 tcpv_rttcnt; __u32 tcpv_rtt; __u32 tcpv_minrtt; }; /* INET_DIAG_DCTCPINFO */ struct tcp_dctcp_info { __u16 dctcp_enabled; __u16 dctcp_ce_state; __u32 dctcp_alpha; __u32 dctcp_ab_ecn; __u32 dctcp_ab_tot; }; /* INET_DIAG_BBRINFO */ struct tcp_bbr_info { /* u64 bw: max-filtered BW (app throughput) estimate in Byte per sec: */ __u32 bbr_bw_lo; /* lower 32 bits of bw */ __u32 bbr_bw_hi; /* upper 32 bits of bw */ __u32 bbr_min_rtt; /* min-filtered RTT in uSec */ __u32 bbr_pacing_gain; /* pacing gain shifted left 8 bits */ __u32 bbr_cwnd_gain; /* cwnd gain shifted left 8 bits */ }; union tcp_cc_info { struct tcpvegas_info vegas; struct tcp_dctcp_info dctcp; struct tcp_bbr_info bbr; }; #endif /* _INET_DIAG_H_ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_phonet.h�����������������������������������������������������������������������������������0000644�����������������00000000650�14763166027�0010044 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * File: if_phonet.h * * Phonet interface kernel definitions * * Copyright (C) 2008 Nokia Corporation. All rights reserved. */ #ifndef LINUX_IF_PHONET_H #define LINUX_IF_PHONET_H #define PHONET_MIN_MTU 6 /* pn_length = 0 */ #define PHONET_MAX_MTU 65541 /* pn_length = 0xffff */ #define PHONET_DEV_MTU PHONET_MAX_MTU #endif /* LINUX_IF_PHONET_H */ ����������������������������������������������������������������������������������������linux/version.h�������������������������������������������������������������������������������������0000644�����������������00000000141�14763166027�0007551 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define LINUX_VERSION_CODE 267263 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/mdio.h����������������������������������������������������������������������������������������0000644�����������������00000033463�14763166027�0007031 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/mdio.h: definitions for MDIO (clause 45) transceivers * Copyright 2006-2009 Solarflare Communications Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation, incorporated herein by reference. */ #ifndef __LINUX_MDIO_H__ #define __LINUX_MDIO_H__ #include <linux/types.h> #include <linux/mii.h> /* MDIO Manageable Devices (MMDs). */ #define MDIO_MMD_PMAPMD 1 /* Physical Medium Attachment/ * Physical Medium Dependent */ #define MDIO_MMD_WIS 2 /* WAN Interface Sublayer */ #define MDIO_MMD_PCS 3 /* Physical Coding Sublayer */ #define MDIO_MMD_PHYXS 4 /* PHY Extender Sublayer */ #define MDIO_MMD_DTEXS 5 /* DTE Extender Sublayer */ #define MDIO_MMD_TC 6 /* Transmission Convergence */ #define MDIO_MMD_AN 7 /* Auto-Negotiation */ #define MDIO_MMD_C22EXT 29 /* Clause 22 extension */ #define MDIO_MMD_VEND1 30 /* Vendor specific 1 */ #define MDIO_MMD_VEND2 31 /* Vendor specific 2 */ /* Generic MDIO registers. */ #define MDIO_CTRL1 MII_BMCR #define MDIO_STAT1 MII_BMSR #define MDIO_DEVID1 MII_PHYSID1 #define MDIO_DEVID2 MII_PHYSID2 #define MDIO_SPEED 4 /* Speed ability */ #define MDIO_DEVS1 5 /* Devices in package */ #define MDIO_DEVS2 6 #define MDIO_CTRL2 7 /* 10G control 2 */ #define MDIO_STAT2 8 /* 10G status 2 */ #define MDIO_PMA_TXDIS 9 /* 10G PMA/PMD transmit disable */ #define MDIO_PMA_RXDET 10 /* 10G PMA/PMD receive signal detect */ #define MDIO_PMA_EXTABLE 11 /* 10G PMA/PMD extended ability */ #define MDIO_PKGID1 14 /* Package identifier */ #define MDIO_PKGID2 15 #define MDIO_AN_ADVERTISE 16 /* AN advertising (base page) */ #define MDIO_AN_LPA 19 /* AN LP abilities (base page) */ #define MDIO_PCS_EEE_ABLE 20 /* EEE Capability register */ #define MDIO_PCS_EEE_WK_ERR 22 /* EEE wake error counter */ #define MDIO_PHYXS_LNSTAT 24 /* PHY XGXS lane state */ #define MDIO_AN_EEE_ADV 60 /* EEE advertisement */ #define MDIO_AN_EEE_LPABLE 61 /* EEE link partner ability */ /* Media-dependent registers. */ #define MDIO_PMA_10GBT_SWAPPOL 130 /* 10GBASE-T pair swap & polarity */ #define MDIO_PMA_10GBT_TXPWR 131 /* 10GBASE-T TX power control */ #define MDIO_PMA_10GBT_SNR 133 /* 10GBASE-T SNR margin, lane A. * Lanes B-D are numbered 134-136. */ #define MDIO_PMA_10GBR_FECABLE 170 /* 10GBASE-R FEC ability */ #define MDIO_PCS_10GBX_STAT1 24 /* 10GBASE-X PCS status 1 */ #define MDIO_PCS_10GBRT_STAT1 32 /* 10GBASE-R/-T PCS status 1 */ #define MDIO_PCS_10GBRT_STAT2 33 /* 10GBASE-R/-T PCS status 2 */ #define MDIO_AN_10GBT_CTRL 32 /* 10GBASE-T auto-negotiation control */ #define MDIO_AN_10GBT_STAT 33 /* 10GBASE-T auto-negotiation status */ /* LASI (Link Alarm Status Interrupt) registers, defined by XENPAK MSA. */ #define MDIO_PMA_LASI_RXCTRL 0x9000 /* RX_ALARM control */ #define MDIO_PMA_LASI_TXCTRL 0x9001 /* TX_ALARM control */ #define MDIO_PMA_LASI_CTRL 0x9002 /* LASI control */ #define MDIO_PMA_LASI_RXSTAT 0x9003 /* RX_ALARM status */ #define MDIO_PMA_LASI_TXSTAT 0x9004 /* TX_ALARM status */ #define MDIO_PMA_LASI_STAT 0x9005 /* LASI status */ /* Control register 1. */ /* Enable extended speed selection */ #define MDIO_CTRL1_SPEEDSELEXT (BMCR_SPEED1000 | BMCR_SPEED100) /* All speed selection bits */ #define MDIO_CTRL1_SPEEDSEL (MDIO_CTRL1_SPEEDSELEXT | 0x003c) #define MDIO_CTRL1_FULLDPLX BMCR_FULLDPLX #define MDIO_CTRL1_LPOWER BMCR_PDOWN #define MDIO_CTRL1_RESET BMCR_RESET #define MDIO_PMA_CTRL1_LOOPBACK 0x0001 #define MDIO_PMA_CTRL1_SPEED1000 BMCR_SPEED1000 #define MDIO_PMA_CTRL1_SPEED100 BMCR_SPEED100 #define MDIO_PCS_CTRL1_LOOPBACK BMCR_LOOPBACK #define MDIO_PHYXS_CTRL1_LOOPBACK BMCR_LOOPBACK #define MDIO_AN_CTRL1_RESTART BMCR_ANRESTART #define MDIO_AN_CTRL1_ENABLE BMCR_ANENABLE #define MDIO_AN_CTRL1_XNP 0x2000 /* Enable extended next page */ #define MDIO_PCS_CTRL1_CLKSTOP_EN 0x400 /* Stop the clock during LPI */ /* 10 Gb/s */ #define MDIO_CTRL1_SPEED10G (MDIO_CTRL1_SPEEDSELEXT | 0x00) /* 10PASS-TS/2BASE-TL */ #define MDIO_CTRL1_SPEED10P2B (MDIO_CTRL1_SPEEDSELEXT | 0x04) /* Status register 1. */ #define MDIO_STAT1_LPOWERABLE 0x0002 /* Low-power ability */ #define MDIO_STAT1_LSTATUS BMSR_LSTATUS #define MDIO_STAT1_FAULT 0x0080 /* Fault */ #define MDIO_AN_STAT1_LPABLE 0x0001 /* Link partner AN ability */ #define MDIO_AN_STAT1_ABLE BMSR_ANEGCAPABLE #define MDIO_AN_STAT1_RFAULT BMSR_RFAULT #define MDIO_AN_STAT1_COMPLETE BMSR_ANEGCOMPLETE #define MDIO_AN_STAT1_PAGE 0x0040 /* Page received */ #define MDIO_AN_STAT1_XNP 0x0080 /* Extended next page status */ /* Speed register. */ #define MDIO_SPEED_10G 0x0001 /* 10G capable */ #define MDIO_PMA_SPEED_2B 0x0002 /* 2BASE-TL capable */ #define MDIO_PMA_SPEED_10P 0x0004 /* 10PASS-TS capable */ #define MDIO_PMA_SPEED_1000 0x0010 /* 1000M capable */ #define MDIO_PMA_SPEED_100 0x0020 /* 100M capable */ #define MDIO_PMA_SPEED_10 0x0040 /* 10M capable */ #define MDIO_PCS_SPEED_10P2B 0x0002 /* 10PASS-TS/2BASE-TL capable */ /* Device present registers. */ #define MDIO_DEVS_PRESENT(devad) (1 << (devad)) #define MDIO_DEVS_PMAPMD MDIO_DEVS_PRESENT(MDIO_MMD_PMAPMD) #define MDIO_DEVS_WIS MDIO_DEVS_PRESENT(MDIO_MMD_WIS) #define MDIO_DEVS_PCS MDIO_DEVS_PRESENT(MDIO_MMD_PCS) #define MDIO_DEVS_PHYXS MDIO_DEVS_PRESENT(MDIO_MMD_PHYXS) #define MDIO_DEVS_DTEXS MDIO_DEVS_PRESENT(MDIO_MMD_DTEXS) #define MDIO_DEVS_TC MDIO_DEVS_PRESENT(MDIO_MMD_TC) #define MDIO_DEVS_AN MDIO_DEVS_PRESENT(MDIO_MMD_AN) #define MDIO_DEVS_C22EXT MDIO_DEVS_PRESENT(MDIO_MMD_C22EXT) /* Control register 2. */ #define MDIO_PMA_CTRL2_TYPE 0x000f /* PMA/PMD type selection */ #define MDIO_PMA_CTRL2_10GBCX4 0x0000 /* 10GBASE-CX4 type */ #define MDIO_PMA_CTRL2_10GBEW 0x0001 /* 10GBASE-EW type */ #define MDIO_PMA_CTRL2_10GBLW 0x0002 /* 10GBASE-LW type */ #define MDIO_PMA_CTRL2_10GBSW 0x0003 /* 10GBASE-SW type */ #define MDIO_PMA_CTRL2_10GBLX4 0x0004 /* 10GBASE-LX4 type */ #define MDIO_PMA_CTRL2_10GBER 0x0005 /* 10GBASE-ER type */ #define MDIO_PMA_CTRL2_10GBLR 0x0006 /* 10GBASE-LR type */ #define MDIO_PMA_CTRL2_10GBSR 0x0007 /* 10GBASE-SR type */ #define MDIO_PMA_CTRL2_10GBLRM 0x0008 /* 10GBASE-LRM type */ #define MDIO_PMA_CTRL2_10GBT 0x0009 /* 10GBASE-T type */ #define MDIO_PMA_CTRL2_10GBKX4 0x000a /* 10GBASE-KX4 type */ #define MDIO_PMA_CTRL2_10GBKR 0x000b /* 10GBASE-KR type */ #define MDIO_PMA_CTRL2_1000BT 0x000c /* 1000BASE-T type */ #define MDIO_PMA_CTRL2_1000BKX 0x000d /* 1000BASE-KX type */ #define MDIO_PMA_CTRL2_100BTX 0x000e /* 100BASE-TX type */ #define MDIO_PMA_CTRL2_10BT 0x000f /* 10BASE-T type */ #define MDIO_PCS_CTRL2_TYPE 0x0003 /* PCS type selection */ #define MDIO_PCS_CTRL2_10GBR 0x0000 /* 10GBASE-R type */ #define MDIO_PCS_CTRL2_10GBX 0x0001 /* 10GBASE-X type */ #define MDIO_PCS_CTRL2_10GBW 0x0002 /* 10GBASE-W type */ #define MDIO_PCS_CTRL2_10GBT 0x0003 /* 10GBASE-T type */ /* Status register 2. */ #define MDIO_STAT2_RXFAULT 0x0400 /* Receive fault */ #define MDIO_STAT2_TXFAULT 0x0800 /* Transmit fault */ #define MDIO_STAT2_DEVPRST 0xc000 /* Device present */ #define MDIO_STAT2_DEVPRST_VAL 0x8000 /* Device present value */ #define MDIO_PMA_STAT2_LBABLE 0x0001 /* PMA loopback ability */ #define MDIO_PMA_STAT2_10GBEW 0x0002 /* 10GBASE-EW ability */ #define MDIO_PMA_STAT2_10GBLW 0x0004 /* 10GBASE-LW ability */ #define MDIO_PMA_STAT2_10GBSW 0x0008 /* 10GBASE-SW ability */ #define MDIO_PMA_STAT2_10GBLX4 0x0010 /* 10GBASE-LX4 ability */ #define MDIO_PMA_STAT2_10GBER 0x0020 /* 10GBASE-ER ability */ #define MDIO_PMA_STAT2_10GBLR 0x0040 /* 10GBASE-LR ability */ #define MDIO_PMA_STAT2_10GBSR 0x0080 /* 10GBASE-SR ability */ #define MDIO_PMD_STAT2_TXDISAB 0x0100 /* PMD TX disable ability */ #define MDIO_PMA_STAT2_EXTABLE 0x0200 /* Extended abilities */ #define MDIO_PMA_STAT2_RXFLTABLE 0x1000 /* Receive fault ability */ #define MDIO_PMA_STAT2_TXFLTABLE 0x2000 /* Transmit fault ability */ #define MDIO_PCS_STAT2_10GBR 0x0001 /* 10GBASE-R capable */ #define MDIO_PCS_STAT2_10GBX 0x0002 /* 10GBASE-X capable */ #define MDIO_PCS_STAT2_10GBW 0x0004 /* 10GBASE-W capable */ #define MDIO_PCS_STAT2_RXFLTABLE 0x1000 /* Receive fault ability */ #define MDIO_PCS_STAT2_TXFLTABLE 0x2000 /* Transmit fault ability */ /* Transmit disable register. */ #define MDIO_PMD_TXDIS_GLOBAL 0x0001 /* Global PMD TX disable */ #define MDIO_PMD_TXDIS_0 0x0002 /* PMD TX disable 0 */ #define MDIO_PMD_TXDIS_1 0x0004 /* PMD TX disable 1 */ #define MDIO_PMD_TXDIS_2 0x0008 /* PMD TX disable 2 */ #define MDIO_PMD_TXDIS_3 0x0010 /* PMD TX disable 3 */ /* Receive signal detect register. */ #define MDIO_PMD_RXDET_GLOBAL 0x0001 /* Global PMD RX signal detect */ #define MDIO_PMD_RXDET_0 0x0002 /* PMD RX signal detect 0 */ #define MDIO_PMD_RXDET_1 0x0004 /* PMD RX signal detect 1 */ #define MDIO_PMD_RXDET_2 0x0008 /* PMD RX signal detect 2 */ #define MDIO_PMD_RXDET_3 0x0010 /* PMD RX signal detect 3 */ /* Extended abilities register. */ #define MDIO_PMA_EXTABLE_10GCX4 0x0001 /* 10GBASE-CX4 ability */ #define MDIO_PMA_EXTABLE_10GBLRM 0x0002 /* 10GBASE-LRM ability */ #define MDIO_PMA_EXTABLE_10GBT 0x0004 /* 10GBASE-T ability */ #define MDIO_PMA_EXTABLE_10GBKX4 0x0008 /* 10GBASE-KX4 ability */ #define MDIO_PMA_EXTABLE_10GBKR 0x0010 /* 10GBASE-KR ability */ #define MDIO_PMA_EXTABLE_1000BT 0x0020 /* 1000BASE-T ability */ #define MDIO_PMA_EXTABLE_1000BKX 0x0040 /* 1000BASE-KX ability */ #define MDIO_PMA_EXTABLE_100BTX 0x0080 /* 100BASE-TX ability */ #define MDIO_PMA_EXTABLE_10BT 0x0100 /* 10BASE-T ability */ /* PHY XGXS lane state register. */ #define MDIO_PHYXS_LNSTAT_SYNC0 0x0001 #define MDIO_PHYXS_LNSTAT_SYNC1 0x0002 #define MDIO_PHYXS_LNSTAT_SYNC2 0x0004 #define MDIO_PHYXS_LNSTAT_SYNC3 0x0008 #define MDIO_PHYXS_LNSTAT_ALIGN 0x1000 /* PMA 10GBASE-T pair swap & polarity */ #define MDIO_PMA_10GBT_SWAPPOL_ABNX 0x0001 /* Pair A/B uncrossed */ #define MDIO_PMA_10GBT_SWAPPOL_CDNX 0x0002 /* Pair C/D uncrossed */ #define MDIO_PMA_10GBT_SWAPPOL_AREV 0x0100 /* Pair A polarity reversed */ #define MDIO_PMA_10GBT_SWAPPOL_BREV 0x0200 /* Pair B polarity reversed */ #define MDIO_PMA_10GBT_SWAPPOL_CREV 0x0400 /* Pair C polarity reversed */ #define MDIO_PMA_10GBT_SWAPPOL_DREV 0x0800 /* Pair D polarity reversed */ /* PMA 10GBASE-T TX power register. */ #define MDIO_PMA_10GBT_TXPWR_SHORT 0x0001 /* Short-reach mode */ /* PMA 10GBASE-T SNR registers. */ /* Value is SNR margin in dB, clamped to range [-127, 127], plus 0x8000. */ #define MDIO_PMA_10GBT_SNR_BIAS 0x8000 #define MDIO_PMA_10GBT_SNR_MAX 127 /* PMA 10GBASE-R FEC ability register. */ #define MDIO_PMA_10GBR_FECABLE_ABLE 0x0001 /* FEC ability */ #define MDIO_PMA_10GBR_FECABLE_ERRABLE 0x0002 /* FEC error indic. ability */ /* PCS 10GBASE-R/-T status register 1. */ #define MDIO_PCS_10GBRT_STAT1_BLKLK 0x0001 /* Block lock attained */ /* PCS 10GBASE-R/-T status register 2. */ #define MDIO_PCS_10GBRT_STAT2_ERR 0x00ff #define MDIO_PCS_10GBRT_STAT2_BER 0x3f00 /* AN 10GBASE-T control register. */ #define MDIO_AN_10GBT_CTRL_ADV10G 0x1000 /* Advertise 10GBASE-T */ /* AN 10GBASE-T status register. */ #define MDIO_AN_10GBT_STAT_LPTRR 0x0200 /* LP training reset req. */ #define MDIO_AN_10GBT_STAT_LPLTABLE 0x0400 /* LP loop timing ability */ #define MDIO_AN_10GBT_STAT_LP10G 0x0800 /* LP is 10GBT capable */ #define MDIO_AN_10GBT_STAT_REMOK 0x1000 /* Remote OK */ #define MDIO_AN_10GBT_STAT_LOCOK 0x2000 /* Local OK */ #define MDIO_AN_10GBT_STAT_MS 0x4000 /* Master/slave config */ #define MDIO_AN_10GBT_STAT_MSFLT 0x8000 /* Master/slave config fault */ /* EEE Supported/Advertisement/LP Advertisement registers. * * EEE capability Register (3.20), Advertisement (7.60) and * Link partner ability (7.61) registers have and can use the same identical * bit masks. */ #define MDIO_AN_EEE_ADV_100TX 0x0002 /* Advertise 100TX EEE cap */ #define MDIO_AN_EEE_ADV_1000T 0x0004 /* Advertise 1000T EEE cap */ /* Note: the two defines above can be potentially used by the user-land * and cannot remove them now. * So, we define the new generic MDIO_EEE_100TX and MDIO_EEE_1000T macros * using the previous ones (that can be considered obsolete). */ #define MDIO_EEE_100TX MDIO_AN_EEE_ADV_100TX /* 100TX EEE cap */ #define MDIO_EEE_1000T MDIO_AN_EEE_ADV_1000T /* 1000T EEE cap */ #define MDIO_EEE_10GT 0x0008 /* 10GT EEE cap */ #define MDIO_EEE_1000KX 0x0010 /* 1000KX EEE cap */ #define MDIO_EEE_10GKX4 0x0020 /* 10G KX4 EEE cap */ #define MDIO_EEE_10GKR 0x0040 /* 10G KR EEE cap */ /* LASI RX_ALARM control/status registers. */ #define MDIO_PMA_LASI_RX_PHYXSLFLT 0x0001 /* PHY XS RX local fault */ #define MDIO_PMA_LASI_RX_PCSLFLT 0x0008 /* PCS RX local fault */ #define MDIO_PMA_LASI_RX_PMALFLT 0x0010 /* PMA/PMD RX local fault */ #define MDIO_PMA_LASI_RX_OPTICPOWERFLT 0x0020 /* RX optical power fault */ #define MDIO_PMA_LASI_RX_WISLFLT 0x0200 /* WIS local fault */ /* LASI TX_ALARM control/status registers. */ #define MDIO_PMA_LASI_TX_PHYXSLFLT 0x0001 /* PHY XS TX local fault */ #define MDIO_PMA_LASI_TX_PCSLFLT 0x0008 /* PCS TX local fault */ #define MDIO_PMA_LASI_TX_PMALFLT 0x0010 /* PMA/PMD TX local fault */ #define MDIO_PMA_LASI_TX_LASERPOWERFLT 0x0080 /* Laser output power fault */ #define MDIO_PMA_LASI_TX_LASERTEMPFLT 0x0100 /* Laser temperature fault */ #define MDIO_PMA_LASI_TX_LASERBICURRFLT 0x0200 /* Laser bias current fault */ /* LASI control/status registers. */ #define MDIO_PMA_LASI_LSALARM 0x0001 /* LS_ALARM enable/status */ #define MDIO_PMA_LASI_TXALARM 0x0002 /* TX_ALARM enable/status */ #define MDIO_PMA_LASI_RXALARM 0x0004 /* RX_ALARM enable/status */ /* Mapping between MDIO PRTAD/DEVAD and mii_ioctl_data::phy_id */ #define MDIO_PHY_ID_C45 0x8000 #define MDIO_PHY_ID_PRTAD 0x03e0 #define MDIO_PHY_ID_DEVAD 0x001f #define MDIO_PHY_ID_C45_MASK \ (MDIO_PHY_ID_C45 | MDIO_PHY_ID_PRTAD | MDIO_PHY_ID_DEVAD) static __inline__ __u16 mdio_phy_id_c45(int prtad, int devad) { return MDIO_PHY_ID_C45 | (prtad << 5) | devad; } #endif /* __LINUX_MDIO_H__ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/v4l2-dv-timings.h�����������������������������������������������������������������������������0000644�����������������00000075512�14763166027�0010750 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * V4L2 DV timings header. * * Copyright (C) 2012-2016 Hans Verkuil <hans.verkuil@cisco.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * 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. */ #ifndef _V4L2_DV_TIMINGS_H #define _V4L2_DV_TIMINGS_H #if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6)) /* Sadly gcc versions older than 4.6 have a bug in how they initialize anonymous unions where they require additional curly brackets. This violates the C1x standard. This workaround adds the curly brackets if needed. */ #define V4L2_INIT_BT_TIMINGS(_width, args...) \ { .bt = { _width , ## args } } #else #define V4L2_INIT_BT_TIMINGS(_width, args...) \ .bt = { _width , ## args } #endif /* CEA-861-F timings (i.e. standard HDTV timings) */ #define V4L2_DV_BT_CEA_640X480P59_94 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, \ 25175000, 16, 96, 48, 10, 2, 33, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 1) \ } /* Note: these are the nominal timings, for HDMI links this format is typically * double-clocked to meet the minimum pixelclock requirements. */ #define V4L2_DV_BT_CEA_720X480I59_94 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(720, 480, 1, 0, \ 13500000, 19, 62, 57, 4, 3, 15, 4, 3, 16, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_HALF_LINE | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_PICTURE_ASPECT | V4L2_DV_FL_HAS_CEA861_VIC, \ { 4, 3 }, 6) \ } #define V4L2_DV_BT_CEA_720X480P59_94 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(720, 480, 0, 0, \ 27000000, 16, 62, 60, 9, 6, 30, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_PICTURE_ASPECT | \ V4L2_DV_FL_HAS_CEA861_VIC, { 4, 3 }, 2) \ } /* Note: these are the nominal timings, for HDMI links this format is typically * double-clocked to meet the minimum pixelclock requirements. */ #define V4L2_DV_BT_CEA_720X576I50 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(720, 576, 1, 0, \ 13500000, 12, 63, 69, 2, 3, 19, 2, 3, 20, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_HALF_LINE | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_PICTURE_ASPECT | V4L2_DV_FL_HAS_CEA861_VIC, \ { 4, 3 }, 21) \ } #define V4L2_DV_BT_CEA_720X576P50 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(720, 576, 0, 0, \ 27000000, 12, 64, 68, 5, 5, 39, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_PICTURE_ASPECT | \ V4L2_DV_FL_HAS_CEA861_VIC, { 4, 3 }, 17) \ } #define V4L2_DV_BT_CEA_1280X720P24 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 720, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 59400000, 1760, 40, 220, 5, 5, 20, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 60) \ } #define V4L2_DV_BT_CEA_1280X720P25 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 720, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 74250000, 2420, 40, 220, 5, 5, 20, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 61) \ } #define V4L2_DV_BT_CEA_1280X720P30 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 720, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 74250000, 1760, 40, 220, 5, 5, 20, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 62) \ } #define V4L2_DV_BT_CEA_1280X720P50 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 720, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 74250000, 440, 40, 220, 5, 5, 20, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 19) \ } #define V4L2_DV_BT_CEA_1280X720P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 720, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 74250000, 110, 40, 220, 5, 5, 20, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 4) \ } #define V4L2_DV_BT_CEA_1920X1080P24 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 74250000, 638, 44, 148, 4, 5, 36, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 32) \ } #define V4L2_DV_BT_CEA_1920X1080P25 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 74250000, 528, 44, 148, 4, 5, 36, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 33) \ } #define V4L2_DV_BT_CEA_1920X1080P30 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 74250000, 88, 44, 148, 4, 5, 36, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 34) \ } #define V4L2_DV_BT_CEA_1920X1080I50 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1080, 1, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 74250000, 528, 44, 148, 2, 5, 15, 2, 5, 16, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_HALF_LINE | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 20) \ } #define V4L2_DV_BT_CEA_1920X1080P50 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 148500000, 528, 44, 148, 4, 5, 36, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 31) \ } #define V4L2_DV_BT_CEA_1920X1080I60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1080, 1, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 74250000, 88, 44, 148, 2, 5, 15, 2, 5, 16, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | \ V4L2_DV_FL_HALF_LINE | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 5) \ } #define V4L2_DV_BT_CEA_1920X1080P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 148500000, 88, 44, 148, 4, 5, 36, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 16) \ } #define V4L2_DV_BT_CEA_3840X2160P24 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(3840, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 297000000, 1276, 88, 296, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC | V4L2_DV_FL_HAS_HDMI_VIC, \ { 0, 0 }, 93, 3) \ } #define V4L2_DV_BT_CEA_3840X2160P25 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(3840, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 297000000, 1056, 88, 296, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_CEA861_VIC | \ V4L2_DV_FL_HAS_HDMI_VIC, { 0, 0 }, 94, 2) \ } #define V4L2_DV_BT_CEA_3840X2160P30 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(3840, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 297000000, 176, 88, 296, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC | V4L2_DV_FL_HAS_HDMI_VIC, \ { 0, 0 }, 95, 1) \ } #define V4L2_DV_BT_CEA_3840X2160P50 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(3840, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 594000000, 1056, 88, 296, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 96) \ } #define V4L2_DV_BT_CEA_3840X2160P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(3840, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 594000000, 176, 88, 296, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 97) \ } #define V4L2_DV_BT_CEA_4096X2160P24 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(4096, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 297000000, 1020, 88, 296, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC | V4L2_DV_FL_HAS_HDMI_VIC, \ { 0, 0 }, 98, 4) \ } #define V4L2_DV_BT_CEA_4096X2160P25 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(4096, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 297000000, 968, 88, 128, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 99) \ } #define V4L2_DV_BT_CEA_4096X2160P30 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(4096, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 297000000, 88, 88, 128, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 100) \ } #define V4L2_DV_BT_CEA_4096X2160P50 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(4096, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 594000000, 968, 88, 128, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 101) \ } #define V4L2_DV_BT_CEA_4096X2160P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(4096, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 594000000, 88, 88, 128, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 102) \ } /* VESA Discrete Monitor Timings as per version 1.0, revision 12 */ #define V4L2_DV_BT_DMT_640X350P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(640, 350, 0, V4L2_DV_HSYNC_POS_POL, \ 31500000, 32, 64, 96, 32, 3, 60, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_640X400P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(640, 400, 0, V4L2_DV_VSYNC_POS_POL, \ 31500000, 32, 64, 96, 1, 3, 41, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_720X400P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(720, 400, 0, V4L2_DV_VSYNC_POS_POL, \ 35500000, 36, 72, 108, 1, 3, 42, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } /* VGA resolutions */ #define V4L2_DV_BT_DMT_640X480P60 V4L2_DV_BT_CEA_640X480P59_94 #define V4L2_DV_BT_DMT_640X480P72 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, \ 31500000, 24, 40, 128, 9, 3, 28, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_640X480P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, \ 31500000, 16, 64, 120, 1, 3, 16, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_640X480P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, \ 36000000, 56, 56, 80, 1, 3, 25, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } /* SVGA resolutions */ #define V4L2_DV_BT_DMT_800X600P56 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(800, 600, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 36000000, 24, 72, 128, 1, 2, 22, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_800X600P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(800, 600, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 40000000, 40, 128, 88, 1, 4, 23, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_800X600P72 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(800, 600, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 50000000, 56, 120, 64, 37, 6, 23, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_800X600P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(800, 600, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 49500000, 16, 80, 160, 1, 3, 21, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_800X600P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(800, 600, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 56250000, 32, 64, 152, 1, 3, 27, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_800X600P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(800, 600, 0, V4L2_DV_HSYNC_POS_POL, \ 73250000, 48, 32, 80, 3, 4, 29, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_848X480P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(848, 480, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 33750000, 16, 112, 112, 6, 8, 23, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1024X768I43 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1024, 768, 1, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 44900000, 8, 176, 56, 0, 4, 20, 0, 4, 21, \ V4L2_DV_BT_STD_DMT, 0) \ } /* XGA resolutions */ #define V4L2_DV_BT_DMT_1024X768P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1024, 768, 0, 0, \ 65000000, 24, 136, 160, 3, 6, 29, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1024X768P70 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1024, 768, 0, 0, \ 75000000, 24, 136, 144, 3, 6, 29, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1024X768P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1024, 768, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 78750000, 16, 96, 176, 1, 3, 28, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1024X768P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1024, 768, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 94500000, 48, 96, 208, 1, 3, 36, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1024X768P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1024, 768, 0, V4L2_DV_HSYNC_POS_POL, \ 115500000, 48, 32, 80, 3, 4, 38, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } /* XGA+ resolution */ #define V4L2_DV_BT_DMT_1152X864P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1152, 864, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 108000000, 64, 128, 256, 1, 3, 32, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1280X720P60 V4L2_DV_BT_CEA_1280X720P60 /* WXGA resolutions */ #define V4L2_DV_BT_DMT_1280X768P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_HSYNC_POS_POL, \ 68250000, 48, 32, 80, 3, 7, 12, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1280X768P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_VSYNC_POS_POL, \ 79500000, 64, 128, 192, 3, 7, 20, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1280X768P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_VSYNC_POS_POL, \ 102250000, 80, 128, 208, 3, 7, 27, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1280X768P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_VSYNC_POS_POL, \ 117500000, 80, 136, 216, 3, 7, 31, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1280X768P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_HSYNC_POS_POL, \ 140250000, 48, 32, 80, 3, 7, 35, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1280X800P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_HSYNC_POS_POL, \ 71000000, 48, 32, 80, 3, 6, 14, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1280X800P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_VSYNC_POS_POL, \ 83500000, 72, 128, 200, 3, 6, 22, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1280X800P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_VSYNC_POS_POL, \ 106500000, 80, 128, 208, 3, 6, 29, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1280X800P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_VSYNC_POS_POL, \ 122500000, 80, 136, 216, 3, 6, 34, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1280X800P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_HSYNC_POS_POL, \ 146250000, 48, 32, 80, 3, 6, 38, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1280X960P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 960, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 108000000, 96, 112, 312, 1, 3, 36, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1280X960P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 960, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 148500000, 64, 160, 224, 1, 3, 47, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1280X960P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 960, 0, V4L2_DV_HSYNC_POS_POL, \ 175500000, 48, 32, 80, 3, 4, 50, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } /* SXGA resolutions */ #define V4L2_DV_BT_DMT_1280X1024P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 1024, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 108000000, 48, 112, 248, 1, 3, 38, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1280X1024P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 1024, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 135000000, 16, 144, 248, 1, 3, 38, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1280X1024P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 1024, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 157500000, 64, 160, 224, 1, 3, 44, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1280X1024P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 1024, 0, V4L2_DV_HSYNC_POS_POL, \ 187250000, 48, 32, 80, 3, 7, 50, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1360X768P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1360, 768, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 85500000, 64, 112, 256, 3, 6, 18, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1360X768P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1360, 768, 0, V4L2_DV_HSYNC_POS_POL, \ 148250000, 48, 32, 80, 3, 5, 37, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1366X768P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1366, 768, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 85500000, 70, 143, 213, 3, 3, 24, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1366X768P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1366, 768, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 72000000, 14, 56, 64, 1, 3, 28, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, V4L2_DV_FL_REDUCED_BLANKING) \ } /* SXGA+ resolutions */ #define V4L2_DV_BT_DMT_1400X1050P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_HSYNC_POS_POL, \ 101000000, 48, 32, 80, 3, 4, 23, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1400X1050P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_VSYNC_POS_POL, \ 121750000, 88, 144, 232, 3, 4, 32, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1400X1050P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_VSYNC_POS_POL, \ 156000000, 104, 144, 248, 3, 4, 42, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1400X1050P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_VSYNC_POS_POL, \ 179500000, 104, 152, 256, 3, 4, 48, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1400X1050P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_HSYNC_POS_POL, \ 208000000, 48, 32, 80, 3, 4, 55, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } /* WXGA+ resolutions */ #define V4L2_DV_BT_DMT_1440X900P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_HSYNC_POS_POL, \ 88750000, 48, 32, 80, 3, 6, 17, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1440X900P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_VSYNC_POS_POL, \ 106500000, 80, 152, 232, 3, 6, 25, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1440X900P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_VSYNC_POS_POL, \ 136750000, 96, 152, 248, 3, 6, 33, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1440X900P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_VSYNC_POS_POL, \ 157000000, 104, 152, 256, 3, 6, 39, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1440X900P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_HSYNC_POS_POL, \ 182750000, 48, 32, 80, 3, 6, 44, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1600X900P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1600, 900, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 108000000, 24, 80, 96, 1, 3, 96, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, V4L2_DV_FL_REDUCED_BLANKING) \ } /* UXGA resolutions */ #define V4L2_DV_BT_DMT_1600X1200P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 162000000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1600X1200P65 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 175500000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1600X1200P70 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 189000000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1600X1200P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 202500000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1600X1200P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 229500000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1600X1200P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1600, 1200, 0, V4L2_DV_HSYNC_POS_POL, \ 268250000, 48, 32, 80, 3, 4, 64, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } /* WSXGA+ resolutions */ #define V4L2_DV_BT_DMT_1680X1050P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_HSYNC_POS_POL, \ 119000000, 48, 32, 80, 3, 6, 21, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1680X1050P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_VSYNC_POS_POL, \ 146250000, 104, 176, 280, 3, 6, 30, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1680X1050P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_VSYNC_POS_POL, \ 187000000, 120, 176, 296, 3, 6, 40, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1680X1050P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_VSYNC_POS_POL, \ 214750000, 128, 176, 304, 3, 6, 46, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1680X1050P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_HSYNC_POS_POL, \ 245500000, 48, 32, 80, 3, 6, 53, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1792X1344P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1792, 1344, 0, V4L2_DV_VSYNC_POS_POL, \ 204750000, 128, 200, 328, 1, 3, 46, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1792X1344P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1792, 1344, 0, V4L2_DV_VSYNC_POS_POL, \ 261000000, 96, 216, 352, 1, 3, 69, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1792X1344P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1792, 1344, 0, V4L2_DV_HSYNC_POS_POL, \ 333250000, 48, 32, 80, 3, 4, 72, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1856X1392P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1856, 1392, 0, V4L2_DV_VSYNC_POS_POL, \ 218250000, 96, 224, 352, 1, 3, 43, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1856X1392P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1856, 1392, 0, V4L2_DV_VSYNC_POS_POL, \ 288000000, 128, 224, 352, 1, 3, 104, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1856X1392P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1856, 1392, 0, V4L2_DV_HSYNC_POS_POL, \ 356500000, 48, 32, 80, 3, 4, 75, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1920X1080P60 V4L2_DV_BT_CEA_1920X1080P60 /* WUXGA resolutions */ #define V4L2_DV_BT_DMT_1920X1200P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_HSYNC_POS_POL, \ 154000000, 48, 32, 80, 3, 6, 26, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1920X1200P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_VSYNC_POS_POL, \ 193250000, 136, 200, 336, 3, 6, 36, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1920X1200P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_VSYNC_POS_POL, \ 245250000, 136, 208, 344, 3, 6, 46, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1920X1200P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_VSYNC_POS_POL, \ 281250000, 144, 208, 352, 3, 6, 53, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1920X1200P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_HSYNC_POS_POL, \ 317000000, 48, 32, 80, 3, 6, 62, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1920X1440P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1440, 0, V4L2_DV_VSYNC_POS_POL, \ 234000000, 128, 208, 344, 1, 3, 56, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1920X1440P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1440, 0, V4L2_DV_VSYNC_POS_POL, \ 297000000, 144, 224, 352, 1, 3, 56, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1920X1440P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1440, 0, V4L2_DV_HSYNC_POS_POL, \ 380500000, 48, 32, 80, 3, 4, 78, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_2048X1152P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(2048, 1152, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 162000000, 26, 80, 96, 1, 3, 44, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, V4L2_DV_FL_REDUCED_BLANKING) \ } /* WQXGA resolutions */ #define V4L2_DV_BT_DMT_2560X1600P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_HSYNC_POS_POL, \ 268500000, 48, 32, 80, 3, 6, 37, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_2560X1600P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_VSYNC_POS_POL, \ 348500000, 192, 280, 472, 3, 6, 49, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_2560X1600P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_VSYNC_POS_POL, \ 443250000, 208, 280, 488, 3, 6, 63, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_2560X1600P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_VSYNC_POS_POL, \ 505250000, 208, 280, 488, 3, 6, 73, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_2560X1600P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_HSYNC_POS_POL, \ 552750000, 48, 32, 80, 3, 6, 85, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } /* 4K resolutions */ #define V4L2_DV_BT_DMT_4096X2160P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \ 556744000, 8, 32, 40, 48, 8, 6, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_4096X2160P59_94_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \ 556188000, 8, 32, 40, 48, 8, 6, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } /* SDI timings definitions */ /* SMPTE-125M */ #define V4L2_DV_BT_SDI_720X487I60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(720, 487, 1, \ V4L2_DV_HSYNC_POS_POL, \ 13500000, 16, 121, 0, 0, 19, 0, 0, 19, 0, \ V4L2_DV_BT_STD_SDI, \ V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE) \ } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_arp.h�������������������������������������������������������������������������������0000644�����������������00000000675�14763166027�0010736 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ #ifndef __LINUX_ARP_NETFILTER_H #define __LINUX_ARP_NETFILTER_H /* ARP-specific defines for netfilter. * (C)2002 Rusty Russell IBM -- This code is GPL. */ #include <linux/netfilter.h> /* There is no PF_ARP. */ #define NF_ARP 0 /* ARP Hooks */ #define NF_ARP_IN 0 #define NF_ARP_OUT 1 #define NF_ARP_FORWARD 2 #define NF_ARP_NUMHOOKS 3 #endif /* __LINUX_ARP_NETFILTER_H */ �������������������������������������������������������������������linux/virtio_pci.h����������������������������������������������������������������������������������0000644�����������������00000015647�14763166027�0010254 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Virtio PCI driver * * This module allows virtio devices to be used over a virtual PCI device. * This can be used with QEMU based VMMs like KVM or Xen. * * Copyright IBM Corp. 2007 * * Authors: * Anthony Liguori <aliguori@us.ibm.com> * * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _LINUX_VIRTIO_PCI_H #define _LINUX_VIRTIO_PCI_H #include <linux/types.h> #ifndef VIRTIO_PCI_NO_LEGACY /* A 32-bit r/o bitmask of the features supported by the host */ #define VIRTIO_PCI_HOST_FEATURES 0 /* A 32-bit r/w bitmask of features activated by the guest */ #define VIRTIO_PCI_GUEST_FEATURES 4 /* A 32-bit r/w PFN for the currently selected queue */ #define VIRTIO_PCI_QUEUE_PFN 8 /* A 16-bit r/o queue size for the currently selected queue */ #define VIRTIO_PCI_QUEUE_NUM 12 /* A 16-bit r/w queue selector */ #define VIRTIO_PCI_QUEUE_SEL 14 /* A 16-bit r/w queue notifier */ #define VIRTIO_PCI_QUEUE_NOTIFY 16 /* An 8-bit device status register. */ #define VIRTIO_PCI_STATUS 18 /* An 8-bit r/o interrupt status register. Reading the value will return the * current contents of the ISR and will also clear it. This is effectively * a read-and-acknowledge. */ #define VIRTIO_PCI_ISR 19 /* MSI-X registers: only enabled if MSI-X is enabled. */ /* A 16-bit vector for configuration changes. */ #define VIRTIO_MSI_CONFIG_VECTOR 20 /* A 16-bit vector for selected queue notifications. */ #define VIRTIO_MSI_QUEUE_VECTOR 22 /* The remaining space is defined by each driver as the per-driver * configuration space */ #define VIRTIO_PCI_CONFIG_OFF(msix_enabled) ((msix_enabled) ? 24 : 20) /* Deprecated: please use VIRTIO_PCI_CONFIG_OFF instead */ #define VIRTIO_PCI_CONFIG(dev) VIRTIO_PCI_CONFIG_OFF((dev)->msix_enabled) /* Virtio ABI version, this must match exactly */ #define VIRTIO_PCI_ABI_VERSION 0 /* How many bits to shift physical queue address written to QUEUE_PFN. * 12 is historical, and due to x86 page size. */ #define VIRTIO_PCI_QUEUE_ADDR_SHIFT 12 /* The alignment to use between consumer and producer parts of vring. * x86 pagesize again. */ #define VIRTIO_PCI_VRING_ALIGN 4096 #endif /* VIRTIO_PCI_NO_LEGACY */ /* The bit of the ISR which indicates a device configuration change. */ #define VIRTIO_PCI_ISR_CONFIG 0x2 /* Vector value used to disable MSI for queue */ #define VIRTIO_MSI_NO_VECTOR 0xffff #ifndef VIRTIO_PCI_NO_MODERN /* IDs for different capabilities. Must all exist. */ /* Common configuration */ #define VIRTIO_PCI_CAP_COMMON_CFG 1 /* Notifications */ #define VIRTIO_PCI_CAP_NOTIFY_CFG 2 /* ISR access */ #define VIRTIO_PCI_CAP_ISR_CFG 3 /* Device specific configuration */ #define VIRTIO_PCI_CAP_DEVICE_CFG 4 /* PCI configuration access */ #define VIRTIO_PCI_CAP_PCI_CFG 5 /* This is the PCI capability header: */ struct virtio_pci_cap { __u8 cap_vndr; /* Generic PCI field: PCI_CAP_ID_VNDR */ __u8 cap_next; /* Generic PCI field: next ptr. */ __u8 cap_len; /* Generic PCI field: capability length */ __u8 cfg_type; /* Identifies the structure. */ __u8 bar; /* Where to find it. */ __u8 padding[3]; /* Pad to full dword. */ __le32 offset; /* Offset within bar. */ __le32 length; /* Length of the structure, in bytes. */ }; struct virtio_pci_notify_cap { struct virtio_pci_cap cap; __le32 notify_off_multiplier; /* Multiplier for queue_notify_off. */ }; /* Fields in VIRTIO_PCI_CAP_COMMON_CFG: */ struct virtio_pci_common_cfg { /* About the whole device. */ __le32 device_feature_select; /* read-write */ __le32 device_feature; /* read-only */ __le32 guest_feature_select; /* read-write */ __le32 guest_feature; /* read-write */ __le16 msix_config; /* read-write */ __le16 num_queues; /* read-only */ __u8 device_status; /* read-write */ __u8 config_generation; /* read-only */ /* About a specific virtqueue. */ __le16 queue_select; /* read-write */ __le16 queue_size; /* read-write, power of 2. */ __le16 queue_msix_vector; /* read-write */ __le16 queue_enable; /* read-write */ __le16 queue_notify_off; /* read-only */ __le32 queue_desc_lo; /* read-write */ __le32 queue_desc_hi; /* read-write */ __le32 queue_avail_lo; /* read-write */ __le32 queue_avail_hi; /* read-write */ __le32 queue_used_lo; /* read-write */ __le32 queue_used_hi; /* read-write */ }; /* Fields in VIRTIO_PCI_CAP_PCI_CFG: */ struct virtio_pci_cfg_cap { struct virtio_pci_cap cap; __u8 pci_cfg_data[4]; /* Data for BAR access. */ }; /* Macro versions of offsets for the Old Timers! */ #define VIRTIO_PCI_CAP_VNDR 0 #define VIRTIO_PCI_CAP_NEXT 1 #define VIRTIO_PCI_CAP_LEN 2 #define VIRTIO_PCI_CAP_CFG_TYPE 3 #define VIRTIO_PCI_CAP_BAR 4 #define VIRTIO_PCI_CAP_OFFSET 8 #define VIRTIO_PCI_CAP_LENGTH 12 #define VIRTIO_PCI_NOTIFY_CAP_MULT 16 #define VIRTIO_PCI_COMMON_DFSELECT 0 #define VIRTIO_PCI_COMMON_DF 4 #define VIRTIO_PCI_COMMON_GFSELECT 8 #define VIRTIO_PCI_COMMON_GF 12 #define VIRTIO_PCI_COMMON_MSIX 16 #define VIRTIO_PCI_COMMON_NUMQ 18 #define VIRTIO_PCI_COMMON_STATUS 20 #define VIRTIO_PCI_COMMON_CFGGENERATION 21 #define VIRTIO_PCI_COMMON_Q_SELECT 22 #define VIRTIO_PCI_COMMON_Q_SIZE 24 #define VIRTIO_PCI_COMMON_Q_MSIX 26 #define VIRTIO_PCI_COMMON_Q_ENABLE 28 #define VIRTIO_PCI_COMMON_Q_NOFF 30 #define VIRTIO_PCI_COMMON_Q_DESCLO 32 #define VIRTIO_PCI_COMMON_Q_DESCHI 36 #define VIRTIO_PCI_COMMON_Q_AVAILLO 40 #define VIRTIO_PCI_COMMON_Q_AVAILHI 44 #define VIRTIO_PCI_COMMON_Q_USEDLO 48 #define VIRTIO_PCI_COMMON_Q_USEDHI 52 #endif /* VIRTIO_PCI_NO_MODERN */ #endif �����������������������������������������������������������������������������������������linux/firewire-constants.h��������������������������������������������������������������������������0000644�����������������00000006237�14763166027�0011726 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * IEEE 1394 constants. * * Copyright (C) 2005-2007 Kristian Hoegsberg <krh@bitplanet.net> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef _LINUX_FIREWIRE_CONSTANTS_H #define _LINUX_FIREWIRE_CONSTANTS_H #define TCODE_WRITE_QUADLET_REQUEST 0x0 #define TCODE_WRITE_BLOCK_REQUEST 0x1 #define TCODE_WRITE_RESPONSE 0x2 #define TCODE_READ_QUADLET_REQUEST 0x4 #define TCODE_READ_BLOCK_REQUEST 0x5 #define TCODE_READ_QUADLET_RESPONSE 0x6 #define TCODE_READ_BLOCK_RESPONSE 0x7 #define TCODE_CYCLE_START 0x8 #define TCODE_LOCK_REQUEST 0x9 #define TCODE_STREAM_DATA 0xa #define TCODE_LOCK_RESPONSE 0xb #define EXTCODE_MASK_SWAP 0x1 #define EXTCODE_COMPARE_SWAP 0x2 #define EXTCODE_FETCH_ADD 0x3 #define EXTCODE_LITTLE_ADD 0x4 #define EXTCODE_BOUNDED_ADD 0x5 #define EXTCODE_WRAP_ADD 0x6 #define EXTCODE_VENDOR_DEPENDENT 0x7 /* Linux firewire-core (Juju) specific tcodes */ #define TCODE_LOCK_MASK_SWAP (0x10 | EXTCODE_MASK_SWAP) #define TCODE_LOCK_COMPARE_SWAP (0x10 | EXTCODE_COMPARE_SWAP) #define TCODE_LOCK_FETCH_ADD (0x10 | EXTCODE_FETCH_ADD) #define TCODE_LOCK_LITTLE_ADD (0x10 | EXTCODE_LITTLE_ADD) #define TCODE_LOCK_BOUNDED_ADD (0x10 | EXTCODE_BOUNDED_ADD) #define TCODE_LOCK_WRAP_ADD (0x10 | EXTCODE_WRAP_ADD) #define TCODE_LOCK_VENDOR_DEPENDENT (0x10 | EXTCODE_VENDOR_DEPENDENT) #define RCODE_COMPLETE 0x0 #define RCODE_CONFLICT_ERROR 0x4 #define RCODE_DATA_ERROR 0x5 #define RCODE_TYPE_ERROR 0x6 #define RCODE_ADDRESS_ERROR 0x7 /* Linux firewire-core (Juju) specific rcodes */ #define RCODE_SEND_ERROR 0x10 #define RCODE_CANCELLED 0x11 #define RCODE_BUSY 0x12 #define RCODE_GENERATION 0x13 #define RCODE_NO_ACK 0x14 #define SCODE_100 0x0 #define SCODE_200 0x1 #define SCODE_400 0x2 #define SCODE_800 0x3 #define SCODE_1600 0x4 #define SCODE_3200 0x5 #define SCODE_BETA 0x3 #define ACK_COMPLETE 0x1 #define ACK_PENDING 0x2 #define ACK_BUSY_X 0x4 #define ACK_BUSY_A 0x5 #define ACK_BUSY_B 0x6 #define ACK_DATA_ERROR 0xd #define ACK_TYPE_ERROR 0xe #define RETRY_1 0x00 #define RETRY_X 0x01 #define RETRY_A 0x02 #define RETRY_B 0x03 #endif /* _LINUX_FIREWIRE_CONSTANTS_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/qnxtypes.h������������������������������������������������������������������������������������0000644�����������������00000001160�14763166027�0007761 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Name : qnxtypes.h * Author : Richard Frowijn * Function : standard qnx types * History : 22-03-1998 created * */ #ifndef _QNX4TYPES_H #define _QNX4TYPES_H #include <linux/types.h> typedef __le16 qnx4_nxtnt_t; typedef __u8 qnx4_ftype_t; typedef struct { __le32 xtnt_blk; __le32 xtnt_size; } qnx4_xtnt_t; typedef __le16 qnx4_mode_t; typedef __le16 qnx4_muid_t; typedef __le16 qnx4_mgid_t; typedef __le32 qnx4_off_t; typedef __le16 qnx4_nlink_t; #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/types.h���������������������������������������������������������������������������������������0000644�����������������00000002704�14763166027�0007237 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_TYPES_H #define _LINUX_TYPES_H #include <asm/types.h> #ifndef __ASSEMBLY__ #include <linux/posix_types.h> /* * Below are truly Linux-specific types that should never collide with * any application/library that wants linux/types.h. */ #ifdef __CHECKER__ #define __bitwise__ __attribute__((bitwise)) #else #define __bitwise__ #endif #define __bitwise __bitwise__ typedef __u16 __bitwise __le16; typedef __u16 __bitwise __be16; typedef __u32 __bitwise __le32; typedef __u32 __bitwise __be32; typedef __u64 __bitwise __le64; typedef __u64 __bitwise __be64; typedef __u16 __bitwise __sum16; typedef __u32 __bitwise __wsum; /* * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid * common 32/64-bit compat problems. * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other * architectures) and to 8-byte boundaries on 64-bit architectures. The new * aligned_64 type enforces 8-byte alignment so that structs containing * aligned_64 values have the same alignment on 32-bit and 64-bit architectures. * No conversions are necessary between 32-bit user-space and a 64-bit kernel. */ #define __aligned_u64 __u64 __attribute__((aligned(8))) #define __aligned_be64 __be64 __attribute__((aligned(8))) #define __aligned_le64 __le64 __attribute__((aligned(8))) typedef unsigned __bitwise __poll_t; #endif /* __ASSEMBLY__ */ #endif /* _LINUX_TYPES_H */ ������������������������������������������������������������linux/hysdn_if.h������������������������������������������������������������������������������������0000644�����������������00000002546�14763166027�0007702 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* $Id: hysdn_if.h,v 1.1.8.3 2001/09/23 22:25:05 kai Exp $ * * Linux driver for HYSDN cards * ioctl definitions shared by hynetmgr and driver. * * Author Werner Cornelius (werner@titro.de) for Hypercope GmbH * Copyright 1999 by Werner Cornelius (werner@titro.de) * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * */ /****************/ /* error values */ /****************/ #define ERR_NONE 0 /* no error occurred */ #define ERR_ALREADY_BOOT 1000 /* we are already booting */ #define EPOF_BAD_MAGIC 1001 /* bad magic in POF header */ #define ERR_BOARD_DPRAM 1002 /* board DPRAM failed */ #define EPOF_INTERNAL 1003 /* internal POF handler error */ #define EPOF_BAD_IMG_SIZE 1004 /* POF boot image size invalid */ #define ERR_BOOTIMG_FAIL 1005 /* 1. stage boot image did not start */ #define ERR_BOOTSEQ_FAIL 1006 /* 2. stage boot seq handshake timeout */ #define ERR_POF_TIMEOUT 1007 /* timeout waiting for card pof ready */ #define ERR_NOT_BOOTED 1008 /* operation only allowed when booted */ #define ERR_CONF_LONG 1009 /* conf line is too long */ #define ERR_INV_CHAN 1010 /* invalid channel number */ #define ERR_ASYNC_TIME 1011 /* timeout sending async data */ ����������������������������������������������������������������������������������������������������������������������������������������������������������linux/edd.h�����������������������������������������������������������������������������������������0000644�����������������00000012744�14763166027�0006634 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/include/linux/edd.h * Copyright (C) 2002, 2003, 2004 Dell Inc. * by Matt Domsch <Matt_Domsch@dell.com> * * structures and definitions for the int 13h, ax={41,48}h * BIOS Enhanced Disk Drive Services * This is based on the T13 group document D1572 Revision 0 (August 14 2002) * available at http://www.t13.org/docs2002/d1572r0.pdf. It is * very similar to D1484 Revision 3 http://www.t13.org/docs2002/d1484r3.pdf * * In a nutshell, arch/{i386,x86_64}/boot/setup.S populates a scratch * table in the boot_params that contains a list of BIOS-enumerated * boot devices. * In arch/{i386,x86_64}/kernel/setup.c, this information is * transferred into the edd structure, and in drivers/firmware/edd.c, that * information is used to identify BIOS boot disk. The code in setup.S * is very sensitive to the size of these structures. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License v2.0 as published by * the Free Software Foundation * * 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. * */ #ifndef _LINUX_EDD_H #define _LINUX_EDD_H #include <linux/types.h> #define EDDNR 0x1e9 /* addr of number of edd_info structs at EDDBUF in boot_params - treat this as 1 byte */ #define EDDBUF 0xd00 /* addr of edd_info structs in boot_params */ #define EDDMAXNR 6 /* number of edd_info structs starting at EDDBUF */ #define EDDEXTSIZE 8 /* change these if you muck with the structures */ #define EDDPARMSIZE 74 #define CHECKEXTENSIONSPRESENT 0x41 #define GETDEVICEPARAMETERS 0x48 #define LEGACYGETDEVICEPARAMETERS 0x08 #define EDDMAGIC1 0x55AA #define EDDMAGIC2 0xAA55 #define READ_SECTORS 0x02 /* int13 AH=0x02 is READ_SECTORS command */ #define EDD_MBR_SIG_OFFSET 0x1B8 /* offset of signature in the MBR */ #define EDD_MBR_SIG_BUF 0x290 /* addr in boot params */ #define EDD_MBR_SIG_MAX 16 /* max number of signatures to store */ #define EDD_MBR_SIG_NR_BUF 0x1ea /* addr of number of MBR signtaures at EDD_MBR_SIG_BUF in boot_params - treat this as 1 byte */ #ifndef __ASSEMBLY__ #define EDD_EXT_FIXED_DISK_ACCESS (1 << 0) #define EDD_EXT_DEVICE_LOCKING_AND_EJECTING (1 << 1) #define EDD_EXT_ENHANCED_DISK_DRIVE_SUPPORT (1 << 2) #define EDD_EXT_64BIT_EXTENSIONS (1 << 3) #define EDD_INFO_DMA_BOUNDARY_ERROR_TRANSPARENT (1 << 0) #define EDD_INFO_GEOMETRY_VALID (1 << 1) #define EDD_INFO_REMOVABLE (1 << 2) #define EDD_INFO_WRITE_VERIFY (1 << 3) #define EDD_INFO_MEDIA_CHANGE_NOTIFICATION (1 << 4) #define EDD_INFO_LOCKABLE (1 << 5) #define EDD_INFO_NO_MEDIA_PRESENT (1 << 6) #define EDD_INFO_USE_INT13_FN50 (1 << 7) struct edd_device_params { __u16 length; __u16 info_flags; __u32 num_default_cylinders; __u32 num_default_heads; __u32 sectors_per_track; __u64 number_of_sectors; __u16 bytes_per_sector; __u32 dpte_ptr; /* 0xFFFFFFFF for our purposes */ __u16 key; /* = 0xBEDD */ __u8 device_path_info_length; /* = 44 */ __u8 reserved2; __u16 reserved3; __u8 host_bus_type[4]; __u8 interface_type[8]; union { struct { __u16 base_address; __u16 reserved1; __u32 reserved2; } __attribute__ ((packed)) isa; struct { __u8 bus; __u8 slot; __u8 function; __u8 channel; __u32 reserved; } __attribute__ ((packed)) pci; /* pcix is same as pci */ struct { __u64 reserved; } __attribute__ ((packed)) ibnd; struct { __u64 reserved; } __attribute__ ((packed)) xprs; struct { __u64 reserved; } __attribute__ ((packed)) htpt; struct { __u64 reserved; } __attribute__ ((packed)) unknown; } interface_path; union { struct { __u8 device; __u8 reserved1; __u16 reserved2; __u32 reserved3; __u64 reserved4; } __attribute__ ((packed)) ata; struct { __u8 device; __u8 lun; __u8 reserved1; __u8 reserved2; __u32 reserved3; __u64 reserved4; } __attribute__ ((packed)) atapi; struct { __u16 id; __u64 lun; __u16 reserved1; __u32 reserved2; } __attribute__ ((packed)) scsi; struct { __u64 serial_number; __u64 reserved; } __attribute__ ((packed)) usb; struct { __u64 eui; __u64 reserved; } __attribute__ ((packed)) i1394; struct { __u64 wwid; __u64 lun; } __attribute__ ((packed)) fibre; struct { __u64 identity_tag; __u64 reserved; } __attribute__ ((packed)) i2o; struct { __u32 array_number; __u32 reserved1; __u64 reserved2; } __attribute__ ((packed)) raid; struct { __u8 device; __u8 reserved1; __u16 reserved2; __u32 reserved3; __u64 reserved4; } __attribute__ ((packed)) sata; struct { __u64 reserved1; __u64 reserved2; } __attribute__ ((packed)) unknown; } device_path; __u8 reserved4; __u8 checksum; } __attribute__ ((packed)); struct edd_info { __u8 device; __u8 version; __u16 interface_support; __u16 legacy_max_cylinder; __u8 legacy_max_head; __u8 legacy_sectors_per_track; struct edd_device_params params; } __attribute__ ((packed)); struct edd { unsigned int mbr_signature[EDD_MBR_SIG_MAX]; struct edd_info edd_info[EDDMAXNR]; unsigned char mbr_signature_nr; unsigned char edd_info_nr; }; #endif /*!__ASSEMBLY__ */ #endif /* _LINUX_EDD_H */ ����������������������������linux/posix_acl_xattr.h�����������������������������������������������������������������������������0000644�����������������00000002133�14763166027�0011272 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * Copyright (C) 2002 Andreas Gruenbacher <a.gruenbacher@computer.org> * Copyright (C) 2016 Red Hat, Inc. * * This file is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This file 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 * Lesser General Public License for more details. * */ #ifndef __UAPI_POSIX_ACL_XATTR_H #define __UAPI_POSIX_ACL_XATTR_H #include <linux/types.h> /* Supported ACL a_version fields */ #define POSIX_ACL_XATTR_VERSION 0x0002 /* An undefined entry e_id value */ #define ACL_UNDEFINED_ID (-1) struct posix_acl_xattr_entry { __le16 e_tag; __le16 e_perm; __le32 e_id; }; struct posix_acl_xattr_header { __le32 a_version; }; #endif /* __UAPI_POSIX_ACL_XATTR_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netrom.h��������������������������������������������������������������������������������������0000644�����������������00000001447�14763166027�0007402 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * These are the public elements of the Linux kernel NET/ROM implementation. * For kernel AX.25 see the file ax25.h. This file requires ax25.h for the * definition of the ax25_address structure. */ #ifndef NETROM_KERNEL_H #define NETROM_KERNEL_H #include <linux/ax25.h> #define NETROM_MTU 236 #define NETROM_T1 1 #define NETROM_T2 2 #define NETROM_N2 3 #define NETROM_T4 6 #define NETROM_IDLE 7 #define SIOCNRDECOBS (SIOCPROTOPRIVATE+2) struct nr_route_struct { #define NETROM_NEIGH 0 #define NETROM_NODE 1 int type; ax25_address callsign; char device[16]; unsigned int quality; char mnemonic[7]; ax25_address neighbour; unsigned int obs_count; unsigned int ndigis; ax25_address digipeaters[AX25_MAX_DIGIS]; }; #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/matroxfb.h������������������������������������������������������������������������������������0000644�����������������00000002670�14763166027�0007717 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_MATROXFB_H__ #define __LINUX_MATROXFB_H__ #include <asm/ioctl.h> #include <linux/types.h> #include <linux/videodev2.h> #include <linux/fb.h> struct matroxioc_output_mode { __u32 output; /* which output */ #define MATROXFB_OUTPUT_PRIMARY 0x0000 #define MATROXFB_OUTPUT_SECONDARY 0x0001 #define MATROXFB_OUTPUT_DFP 0x0002 __u32 mode; /* which mode */ #define MATROXFB_OUTPUT_MODE_PAL 0x0001 #define MATROXFB_OUTPUT_MODE_NTSC 0x0002 #define MATROXFB_OUTPUT_MODE_MONITOR 0x0080 }; #define MATROXFB_SET_OUTPUT_MODE _IOW('n',0xFA,size_t) #define MATROXFB_GET_OUTPUT_MODE _IOWR('n',0xFA,size_t) /* bitfield */ #define MATROXFB_OUTPUT_CONN_PRIMARY (1 << MATROXFB_OUTPUT_PRIMARY) #define MATROXFB_OUTPUT_CONN_SECONDARY (1 << MATROXFB_OUTPUT_SECONDARY) #define MATROXFB_OUTPUT_CONN_DFP (1 << MATROXFB_OUTPUT_DFP) /* connect these outputs to this framebuffer */ #define MATROXFB_SET_OUTPUT_CONNECTION _IOW('n',0xF8,size_t) /* which outputs are connected to this framebuffer */ #define MATROXFB_GET_OUTPUT_CONNECTION _IOR('n',0xF8,size_t) /* which outputs are available for this framebuffer */ #define MATROXFB_GET_AVAILABLE_OUTPUTS _IOR('n',0xF9,size_t) /* which outputs exist on this framebuffer */ #define MATROXFB_GET_ALL_OUTPUTS _IOR('n',0xFB,size_t) enum matroxfb_ctrl_id { MATROXFB_CID_TESTOUT = V4L2_CID_PRIVATE_BASE, MATROXFB_CID_DEFLICKER, MATROXFB_CID_LAST }; #endif ������������������������������������������������������������������������linux/if_alg.h��������������������������������������������������������������������������������������0000644�����������������00000002776�14763166027�0007325 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * if_alg: User-space algorithm interface * * Copyright (c) 2010 Herbert Xu <herbert@gondor.apana.org.au> * * 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. * */ #ifndef _LINUX_IF_ALG_H #define _LINUX_IF_ALG_H #include <linux/types.h> struct sockaddr_alg { __u16 salg_family; __u8 salg_type[14]; __u32 salg_feat; __u32 salg_mask; __u8 salg_name[64]; }; /* * Linux v4.12 and later removed the 64-byte limit on salg_name[]; it's now an * arbitrary-length field. We had to keep the original struct above for source * compatibility with existing userspace programs, though. Use the new struct * below if support for very long algorithm names is needed. To do this, * allocate 'sizeof(struct sockaddr_alg_new) + strlen(algname) + 1' bytes, and * copy algname (including the null terminator) into salg_name. */ struct sockaddr_alg_new { __u16 salg_family; __u8 salg_type[14]; __u32 salg_feat; __u32 salg_mask; __u8 salg_name[]; }; struct af_alg_iv { __u32 ivlen; __u8 iv[0]; }; /* Socket options */ #define ALG_SET_KEY 1 #define ALG_SET_IV 2 #define ALG_SET_OP 3 #define ALG_SET_AEAD_ASSOCLEN 4 #define ALG_SET_AEAD_AUTHSIZE 5 /* Operations */ #define ALG_OP_DECRYPT 0 #define ALG_OP_ENCRYPT 1 #endif /* _LINUX_IF_ALG_H */ ��linux/if_tunnel.h�����������������������������������������������������������������������������������0000644�����������������00000007244�14763166027�0010062 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IF_TUNNEL_H_ #define _IF_TUNNEL_H_ #include <linux/types.h> #include <linux/if.h> #include <linux/ip.h> #include <linux/in6.h> #include <asm/byteorder.h> #define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) #define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) #define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2) #define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3) #define SIOCGETPRL (SIOCDEVPRIVATE + 4) #define SIOCADDPRL (SIOCDEVPRIVATE + 5) #define SIOCDELPRL (SIOCDEVPRIVATE + 6) #define SIOCCHGPRL (SIOCDEVPRIVATE + 7) #define SIOCGET6RD (SIOCDEVPRIVATE + 8) #define SIOCADD6RD (SIOCDEVPRIVATE + 9) #define SIOCDEL6RD (SIOCDEVPRIVATE + 10) #define SIOCCHG6RD (SIOCDEVPRIVATE + 11) #define GRE_CSUM __cpu_to_be16(0x8000) #define GRE_ROUTING __cpu_to_be16(0x4000) #define GRE_KEY __cpu_to_be16(0x2000) #define GRE_SEQ __cpu_to_be16(0x1000) #define GRE_STRICT __cpu_to_be16(0x0800) #define GRE_REC __cpu_to_be16(0x0700) #define GRE_ACK __cpu_to_be16(0x0080) #define GRE_FLAGS __cpu_to_be16(0x0078) #define GRE_VERSION __cpu_to_be16(0x0007) #define GRE_IS_CSUM(f) ((f) & GRE_CSUM) #define GRE_IS_ROUTING(f) ((f) & GRE_ROUTING) #define GRE_IS_KEY(f) ((f) & GRE_KEY) #define GRE_IS_SEQ(f) ((f) & GRE_SEQ) #define GRE_IS_STRICT(f) ((f) & GRE_STRICT) #define GRE_IS_REC(f) ((f) & GRE_REC) #define GRE_IS_ACK(f) ((f) & GRE_ACK) #define GRE_VERSION_0 __cpu_to_be16(0x0000) #define GRE_VERSION_1 __cpu_to_be16(0x0001) #define GRE_PROTO_PPP __cpu_to_be16(0x880b) #define GRE_PPTP_KEY_MASK __cpu_to_be32(0xffff) struct ip_tunnel_parm { char name[IFNAMSIZ]; int link; __be16 i_flags; __be16 o_flags; __be32 i_key; __be32 o_key; struct iphdr iph; }; enum { IFLA_IPTUN_UNSPEC, IFLA_IPTUN_LINK, IFLA_IPTUN_LOCAL, IFLA_IPTUN_REMOTE, IFLA_IPTUN_TTL, IFLA_IPTUN_TOS, IFLA_IPTUN_ENCAP_LIMIT, IFLA_IPTUN_FLOWINFO, IFLA_IPTUN_FLAGS, IFLA_IPTUN_PROTO, IFLA_IPTUN_PMTUDISC, IFLA_IPTUN_6RD_PREFIX, IFLA_IPTUN_6RD_RELAY_PREFIX, IFLA_IPTUN_6RD_PREFIXLEN, IFLA_IPTUN_6RD_RELAY_PREFIXLEN, IFLA_IPTUN_ENCAP_TYPE, IFLA_IPTUN_ENCAP_FLAGS, IFLA_IPTUN_ENCAP_SPORT, IFLA_IPTUN_ENCAP_DPORT, IFLA_IPTUN_COLLECT_METADATA, IFLA_IPTUN_FWMARK, __IFLA_IPTUN_MAX, }; #define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1) enum tunnel_encap_types { TUNNEL_ENCAP_NONE, TUNNEL_ENCAP_FOU, TUNNEL_ENCAP_GUE, TUNNEL_ENCAP_MPLS, }; #define TUNNEL_ENCAP_FLAG_CSUM (1<<0) #define TUNNEL_ENCAP_FLAG_CSUM6 (1<<1) #define TUNNEL_ENCAP_FLAG_REMCSUM (1<<2) /* SIT-mode i_flags */ #define SIT_ISATAP 0x0001 struct ip_tunnel_prl { __be32 addr; __u16 flags; __u16 __reserved; __u32 datalen; __u32 __reserved2; /* data follows */ }; /* PRL flags */ #define PRL_DEFAULT 0x0001 struct ip_tunnel_6rd { struct in6_addr prefix; __be32 relay_prefix; __u16 prefixlen; __u16 relay_prefixlen; }; enum { IFLA_GRE_UNSPEC, IFLA_GRE_LINK, IFLA_GRE_IFLAGS, IFLA_GRE_OFLAGS, IFLA_GRE_IKEY, IFLA_GRE_OKEY, IFLA_GRE_LOCAL, IFLA_GRE_REMOTE, IFLA_GRE_TTL, IFLA_GRE_TOS, IFLA_GRE_PMTUDISC, IFLA_GRE_ENCAP_LIMIT, IFLA_GRE_FLOWINFO, IFLA_GRE_FLAGS, IFLA_GRE_ENCAP_TYPE, IFLA_GRE_ENCAP_FLAGS, IFLA_GRE_ENCAP_SPORT, IFLA_GRE_ENCAP_DPORT, IFLA_GRE_COLLECT_METADATA, IFLA_GRE_IGNORE_DF, IFLA_GRE_FWMARK, IFLA_GRE_ERSPAN_INDEX, IFLA_GRE_ERSPAN_VER, IFLA_GRE_ERSPAN_DIR, IFLA_GRE_ERSPAN_HWID, __IFLA_GRE_MAX, }; #define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1) /* VTI-mode i_flags */ #define VTI_ISVTI ((__be16)0x0001) enum { IFLA_VTI_UNSPEC, IFLA_VTI_LINK, IFLA_VTI_IKEY, IFLA_VTI_OKEY, IFLA_VTI_LOCAL, IFLA_VTI_REMOTE, IFLA_VTI_FWMARK, __IFLA_VTI_MAX, }; #define IFLA_VTI_MAX (__IFLA_VTI_MAX - 1) #endif /* _IF_TUNNEL_H_ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_team.h�������������������������������������������������������������������������������������0000644�����������������00000005050�14763166027�0007474 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * include/linux/if_team.h - Network team device driver header * Copyright (c) 2011 Jiri Pirko <jpirko@redhat.com> * * 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. */ #ifndef _LINUX_IF_TEAM_H_ #define _LINUX_IF_TEAM_H_ #define TEAM_STRING_MAX_LEN 32 /********************************** * NETLINK_GENERIC netlink family. **********************************/ enum { TEAM_CMD_NOOP, TEAM_CMD_OPTIONS_SET, TEAM_CMD_OPTIONS_GET, TEAM_CMD_PORT_LIST_GET, __TEAM_CMD_MAX, TEAM_CMD_MAX = (__TEAM_CMD_MAX - 1), }; enum { TEAM_ATTR_UNSPEC, TEAM_ATTR_TEAM_IFINDEX, /* u32 */ TEAM_ATTR_LIST_OPTION, /* nest */ TEAM_ATTR_LIST_PORT, /* nest */ __TEAM_ATTR_MAX, TEAM_ATTR_MAX = __TEAM_ATTR_MAX - 1, }; /* Nested layout of get/set msg: * * [TEAM_ATTR_LIST_OPTION] * [TEAM_ATTR_ITEM_OPTION] * [TEAM_ATTR_OPTION_*], ... * [TEAM_ATTR_ITEM_OPTION] * [TEAM_ATTR_OPTION_*], ... * ... * [TEAM_ATTR_LIST_PORT] * [TEAM_ATTR_ITEM_PORT] * [TEAM_ATTR_PORT_*], ... * [TEAM_ATTR_ITEM_PORT] * [TEAM_ATTR_PORT_*], ... * ... */ enum { TEAM_ATTR_ITEM_OPTION_UNSPEC, TEAM_ATTR_ITEM_OPTION, /* nest */ __TEAM_ATTR_ITEM_OPTION_MAX, TEAM_ATTR_ITEM_OPTION_MAX = __TEAM_ATTR_ITEM_OPTION_MAX - 1, }; enum { TEAM_ATTR_OPTION_UNSPEC, TEAM_ATTR_OPTION_NAME, /* string */ TEAM_ATTR_OPTION_CHANGED, /* flag */ TEAM_ATTR_OPTION_TYPE, /* u8 */ TEAM_ATTR_OPTION_DATA, /* dynamic */ TEAM_ATTR_OPTION_REMOVED, /* flag */ TEAM_ATTR_OPTION_PORT_IFINDEX, /* u32 */ /* for per-port options */ TEAM_ATTR_OPTION_ARRAY_INDEX, /* u32 */ /* for array options */ __TEAM_ATTR_OPTION_MAX, TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1, }; enum { TEAM_ATTR_ITEM_PORT_UNSPEC, TEAM_ATTR_ITEM_PORT, /* nest */ __TEAM_ATTR_ITEM_PORT_MAX, TEAM_ATTR_ITEM_PORT_MAX = __TEAM_ATTR_ITEM_PORT_MAX - 1, }; enum { TEAM_ATTR_PORT_UNSPEC, TEAM_ATTR_PORT_IFINDEX, /* u32 */ TEAM_ATTR_PORT_CHANGED, /* flag */ TEAM_ATTR_PORT_LINKUP, /* flag */ TEAM_ATTR_PORT_SPEED, /* u32 */ TEAM_ATTR_PORT_DUPLEX, /* u8 */ TEAM_ATTR_PORT_REMOVED, /* flag */ __TEAM_ATTR_PORT_MAX, TEAM_ATTR_PORT_MAX = __TEAM_ATTR_PORT_MAX - 1, }; /* * NETLINK_GENERIC related info */ #define TEAM_GENL_NAME "team" #define TEAM_GENL_VERSION 0x1 #define TEAM_GENL_CHANGE_EVENT_MC_GRP_NAME "change_event" #endif /* _LINUX_IF_TEAM_H_ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/ip.h������������������������������������������������������������������������������������������0000644�����������������00000011170�14763166027�0006500 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Definitions for the IP protocol. * * Version: @(#)ip.h 1.0.2 04/28/93 * * Authors: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * * 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. */ #ifndef _LINUX_IP_H #define _LINUX_IP_H #include <linux/types.h> #include <asm/byteorder.h> #define IPTOS_TOS_MASK 0x1E #define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK) #define IPTOS_LOWDELAY 0x10 #define IPTOS_THROUGHPUT 0x08 #define IPTOS_RELIABILITY 0x04 #define IPTOS_MINCOST 0x02 #define IPTOS_PREC_MASK 0xE0 #define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK) #define IPTOS_PREC_NETCONTROL 0xe0 #define IPTOS_PREC_INTERNETCONTROL 0xc0 #define IPTOS_PREC_CRITIC_ECP 0xa0 #define IPTOS_PREC_FLASHOVERRIDE 0x80 #define IPTOS_PREC_FLASH 0x60 #define IPTOS_PREC_IMMEDIATE 0x40 #define IPTOS_PREC_PRIORITY 0x20 #define IPTOS_PREC_ROUTINE 0x00 /* IP options */ #define IPOPT_COPY 0x80 #define IPOPT_CLASS_MASK 0x60 #define IPOPT_NUMBER_MASK 0x1f #define IPOPT_COPIED(o) ((o)&IPOPT_COPY) #define IPOPT_CLASS(o) ((o)&IPOPT_CLASS_MASK) #define IPOPT_NUMBER(o) ((o)&IPOPT_NUMBER_MASK) #define IPOPT_CONTROL 0x00 #define IPOPT_RESERVED1 0x20 #define IPOPT_MEASUREMENT 0x40 #define IPOPT_RESERVED2 0x60 #define IPOPT_END (0 |IPOPT_CONTROL) #define IPOPT_NOOP (1 |IPOPT_CONTROL) #define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY) #define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY) #define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT) #define IPOPT_CIPSO (6 |IPOPT_CONTROL|IPOPT_COPY) #define IPOPT_RR (7 |IPOPT_CONTROL) #define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY) #define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY) #define IPOPT_RA (20|IPOPT_CONTROL|IPOPT_COPY) #define IPVERSION 4 #define MAXTTL 255 #define IPDEFTTL 64 #define IPOPT_OPTVAL 0 #define IPOPT_OLEN 1 #define IPOPT_OFFSET 2 #define IPOPT_MINOFF 4 #define MAX_IPOPTLEN 40 #define IPOPT_NOP IPOPT_NOOP #define IPOPT_EOL IPOPT_END #define IPOPT_TS IPOPT_TIMESTAMP #define IPOPT_TS_TSONLY 0 /* timestamps only */ #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ #define IPOPT_TS_PRESPEC 3 /* specified modules only */ #define IPV4_BEET_PHMAXLEN 8 struct iphdr { #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 ihl:4, version:4; #elif defined (__BIG_ENDIAN_BITFIELD) __u8 version:4, ihl:4; #else #error "Please fix <asm/byteorder.h>" #endif __u8 tos; __be16 tot_len; __be16 id; __be16 frag_off; __u8 ttl; __u8 protocol; __sum16 check; __be32 saddr; __be32 daddr; /*The options start here. */ }; struct ip_auth_hdr { __u8 nexthdr; __u8 hdrlen; /* This one is measured in 32 bit units! */ __be16 reserved; __be32 spi; __be32 seq_no; /* Sequence number */ __u8 auth_data[0]; /* Variable len but >=4. Mind the 64 bit alignment! */ }; struct ip_esp_hdr { __be32 spi; __be32 seq_no; /* Sequence number */ __u8 enc_data[0]; /* Variable len but >=8. Mind the 64 bit alignment! */ }; struct ip_comp_hdr { __u8 nexthdr; __u8 flags; __be16 cpi; }; struct ip_beet_phdr { __u8 nexthdr; __u8 hdrlen; __u8 padlen; __u8 reserved; }; /* index values for the variables in ipv4_devconf */ enum { IPV4_DEVCONF_FORWARDING=1, IPV4_DEVCONF_MC_FORWARDING, IPV4_DEVCONF_PROXY_ARP, IPV4_DEVCONF_ACCEPT_REDIRECTS, IPV4_DEVCONF_SECURE_REDIRECTS, IPV4_DEVCONF_SEND_REDIRECTS, IPV4_DEVCONF_SHARED_MEDIA, IPV4_DEVCONF_RP_FILTER, IPV4_DEVCONF_ACCEPT_SOURCE_ROUTE, IPV4_DEVCONF_BOOTP_RELAY, IPV4_DEVCONF_LOG_MARTIANS, IPV4_DEVCONF_TAG, IPV4_DEVCONF_ARPFILTER, IPV4_DEVCONF_MEDIUM_ID, IPV4_DEVCONF_NOXFRM, IPV4_DEVCONF_NOPOLICY, IPV4_DEVCONF_FORCE_IGMP_VERSION, IPV4_DEVCONF_ARP_ANNOUNCE, IPV4_DEVCONF_ARP_IGNORE, IPV4_DEVCONF_PROMOTE_SECONDARIES, IPV4_DEVCONF_ARP_ACCEPT, IPV4_DEVCONF_ARP_NOTIFY, IPV4_DEVCONF_ACCEPT_LOCAL, IPV4_DEVCONF_SRC_VMARK, IPV4_DEVCONF_PROXY_ARP_PVLAN, IPV4_DEVCONF_ROUTE_LOCALNET, IPV4_DEVCONF_IGMPV2_UNSOLICITED_REPORT_INTERVAL, IPV4_DEVCONF_IGMPV3_UNSOLICITED_REPORT_INTERVAL, IPV4_DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN, IPV4_DEVCONF_DROP_UNICAST_IN_L2_MULTICAST, IPV4_DEVCONF_DROP_GRATUITOUS_ARP, IPV4_DEVCONF_BC_FORWARDING, __IPV4_DEVCONF_MAX }; #define IPV4_DEVCONF_MAX (__IPV4_DEVCONF_MAX - 1) #endif /* _LINUX_IP_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/stddef.h��������������������������������������������������������������������������������������0000644�����������������00000000203�14763166027�0007334 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __always_inline #define __always_inline __inline__ #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/module.h��������������������������������������������������������������������������������������0000644�����������������00000000377�14763166027�0007364 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_MODULE_H #define _LINUX_MODULE_H /* Flags for sys_finit_module: */ #define MODULE_INIT_IGNORE_MODVERSIONS 1 #define MODULE_INIT_IGNORE_VERMAGIC 2 #endif /* _LINUX_MODULE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/gen_stats.h�����������������������������������������������������������������������������������0000644�����������������00000003052�14763166027�0010057 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_GEN_STATS_H #define __LINUX_GEN_STATS_H #include <linux/types.h> enum { TCA_STATS_UNSPEC, TCA_STATS_BASIC, TCA_STATS_RATE_EST, TCA_STATS_QUEUE, TCA_STATS_APP, TCA_STATS_RATE_EST64, TCA_STATS_PAD, __TCA_STATS_MAX, }; #define TCA_STATS_MAX (__TCA_STATS_MAX - 1) /** * struct gnet_stats_basic - byte/packet throughput statistics * @bytes: number of seen bytes * @packets: number of seen packets */ struct gnet_stats_basic { __u64 bytes; __u32 packets; }; struct gnet_stats_basic_packed { __u64 bytes; __u32 packets; } __attribute__ ((packed)); /** * struct gnet_stats_rate_est - rate estimator * @bps: current byte rate * @pps: current packet rate */ struct gnet_stats_rate_est { __u32 bps; __u32 pps; }; /** * struct gnet_stats_rate_est64 - rate estimator * @bps: current byte rate * @pps: current packet rate */ struct gnet_stats_rate_est64 { __u64 bps; __u64 pps; }; /** * struct gnet_stats_queue - queuing statistics * @qlen: queue length * @backlog: backlog size of queue * @drops: number of dropped packets * @requeues: number of requeues * @overlimits: number of enqueues over the limit */ struct gnet_stats_queue { __u32 qlen; __u32 backlog; __u32 drops; __u32 requeues; __u32 overlimits; }; /** * struct gnet_estimator - rate estimator configuration * @interval: sampling period * @ewma_log: the log of measurement window weight */ struct gnet_estimator { signed char interval; unsigned char ewma_log; }; #endif /* __LINUX_GEN_STATS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/fcntl.h���������������������������������������������������������������������������������������0000644�����������������00000006341�14763166027�0007202 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_FCNTL_H #define _LINUX_FCNTL_H #include <asm/fcntl.h> #define F_SETLEASE (F_LINUX_SPECIFIC_BASE + 0) #define F_GETLEASE (F_LINUX_SPECIFIC_BASE + 1) /* * Cancel a blocking posix lock; internal use only until we expose an * asynchronous lock api to userspace: */ #define F_CANCELLK (F_LINUX_SPECIFIC_BASE + 5) /* Create a file descriptor with FD_CLOEXEC set. */ #define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6) /* * Request nofications on a directory. * See below for events that may be notified. */ #define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2) /* * Set and get of pipe page size array */ #define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7) #define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8) /* * Set/Get seals */ #define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9) #define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10) /* * Types of seals */ #define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */ #define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */ #define F_SEAL_GROW 0x0004 /* prevent file from growing */ #define F_SEAL_WRITE 0x0008 /* prevent writes */ /* (1U << 31) is reserved for signed error codes */ /* * Set/Get write life time hints. {GET,SET}_RW_HINT operate on the * underlying inode, while {GET,SET}_FILE_RW_HINT operate only on * the specific file. */ #define F_GET_RW_HINT (F_LINUX_SPECIFIC_BASE + 11) #define F_SET_RW_HINT (F_LINUX_SPECIFIC_BASE + 12) #define F_GET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 13) #define F_SET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 14) /* * Valid hint values for F_{GET,SET}_RW_HINT. 0 is "not set", or can be * used to clear any hints previously set. */ #define RWF_WRITE_LIFE_NOT_SET 0 #define RWH_WRITE_LIFE_NONE 1 #define RWH_WRITE_LIFE_SHORT 2 #define RWH_WRITE_LIFE_MEDIUM 3 #define RWH_WRITE_LIFE_LONG 4 #define RWH_WRITE_LIFE_EXTREME 5 /* * Types of directory notifications that may be requested. */ #define DN_ACCESS 0x00000001 /* File accessed */ #define DN_MODIFY 0x00000002 /* File modified */ #define DN_CREATE 0x00000004 /* File created */ #define DN_DELETE 0x00000008 /* File removed */ #define DN_RENAME 0x00000010 /* File renamed */ #define DN_ATTRIB 0x00000020 /* File changed attibutes */ #define DN_MULTISHOT 0x80000000 /* Don't remove notifier */ #define AT_FDCWD -100 /* Special value used to indicate openat should use the current working directory. */ #define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */ #define AT_REMOVEDIR 0x200 /* Remove directory instead of unlinking file. */ #define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ #define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */ #define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */ #define AT_STATX_SYNC_TYPE 0x6000 /* Type of synchronisation required from statx() */ #define AT_STATX_SYNC_AS_STAT 0x0000 /* - Do whatever stat() does */ #define AT_STATX_FORCE_SYNC 0x2000 /* - Force the attributes to be sync'd with the server */ #define AT_STATX_DONT_SYNC 0x4000 /* - Don't sync attributes with the server */ #endif /* _LINUX_FCNTL_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/tiocl.h���������������������������������������������������������������������������������������0000644�����������������00000003301�14763166027�0007177 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_TIOCL_H #define _LINUX_TIOCL_H #define TIOCL_SETSEL 2 /* set a selection */ #define TIOCL_SELCHAR 0 /* select characters */ #define TIOCL_SELWORD 1 /* select whole words */ #define TIOCL_SELLINE 2 /* select whole lines */ #define TIOCL_SELPOINTER 3 /* show the pointer */ #define TIOCL_SELCLEAR 4 /* clear visibility of selection */ #define TIOCL_SELMOUSEREPORT 16 /* report beginning of selection */ #define TIOCL_SELBUTTONMASK 15 /* button mask for report */ /* selection extent */ struct tiocl_selection { unsigned short xs; /* X start */ unsigned short ys; /* Y start */ unsigned short xe; /* X end */ unsigned short ye; /* Y end */ unsigned short sel_mode; /* selection mode */ }; #define TIOCL_PASTESEL 3 /* paste previous selection */ #define TIOCL_UNBLANKSCREEN 4 /* unblank screen */ #define TIOCL_SELLOADLUT 5 /* set characters to be considered alphabetic when selecting */ /* u32[8] bit array, 4 bytes-aligned with type */ /* these two don't return a value: they write it back in the type */ #define TIOCL_GETSHIFTSTATE 6 /* write shift state */ #define TIOCL_GETMOUSEREPORTING 7 /* write whether mouse event are reported */ #define TIOCL_SETVESABLANK 10 /* set vesa blanking mode */ #define TIOCL_SETKMSGREDIRECT 11 /* restrict kernel messages to a vt */ #define TIOCL_GETFGCONSOLE 12 /* get foreground vt */ #define TIOCL_SCROLLCONSOLE 13 /* scroll console */ #define TIOCL_BLANKSCREEN 14 /* keep screen blank even if a key is pressed */ #define TIOCL_BLANKEDSCREEN 15 /* return which vt was blanked */ #define TIOCL_GETKMSGREDIRECT 17 /* get the vt the kernel messages are restricted to */ #endif /* _LINUX_TIOCL_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/qemu_fw_cfg.h���������������������������������������������������������������������������������0000644�����������������00000004645�14763166027�0010363 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: BSD-3-Clause */ #ifndef _LINUX_FW_CFG_H #define _LINUX_FW_CFG_H #include <linux/types.h> #define FW_CFG_ACPI_DEVICE_ID "QEMU0002" /* selector key values for "well-known" fw_cfg entries */ #define FW_CFG_SIGNATURE 0x00 #define FW_CFG_ID 0x01 #define FW_CFG_UUID 0x02 #define FW_CFG_RAM_SIZE 0x03 #define FW_CFG_NOGRAPHIC 0x04 #define FW_CFG_NB_CPUS 0x05 #define FW_CFG_MACHINE_ID 0x06 #define FW_CFG_KERNEL_ADDR 0x07 #define FW_CFG_KERNEL_SIZE 0x08 #define FW_CFG_KERNEL_CMDLINE 0x09 #define FW_CFG_INITRD_ADDR 0x0a #define FW_CFG_INITRD_SIZE 0x0b #define FW_CFG_BOOT_DEVICE 0x0c #define FW_CFG_NUMA 0x0d #define FW_CFG_BOOT_MENU 0x0e #define FW_CFG_MAX_CPUS 0x0f #define FW_CFG_KERNEL_ENTRY 0x10 #define FW_CFG_KERNEL_DATA 0x11 #define FW_CFG_INITRD_DATA 0x12 #define FW_CFG_CMDLINE_ADDR 0x13 #define FW_CFG_CMDLINE_SIZE 0x14 #define FW_CFG_CMDLINE_DATA 0x15 #define FW_CFG_SETUP_ADDR 0x16 #define FW_CFG_SETUP_SIZE 0x17 #define FW_CFG_SETUP_DATA 0x18 #define FW_CFG_FILE_DIR 0x19 #define FW_CFG_FILE_FIRST 0x20 #define FW_CFG_FILE_SLOTS_MIN 0x10 #define FW_CFG_WRITE_CHANNEL 0x4000 #define FW_CFG_ARCH_LOCAL 0x8000 #define FW_CFG_ENTRY_MASK (~(FW_CFG_WRITE_CHANNEL | FW_CFG_ARCH_LOCAL)) #define FW_CFG_INVALID 0xffff /* width in bytes of fw_cfg control register */ #define FW_CFG_CTL_SIZE 0x02 /* fw_cfg "file name" is up to 56 characters (including terminating nul) */ #define FW_CFG_MAX_FILE_PATH 56 /* size in bytes of fw_cfg signature */ #define FW_CFG_SIG_SIZE 4 /* FW_CFG_ID bits */ #define FW_CFG_VERSION 0x01 #define FW_CFG_VERSION_DMA 0x02 /* fw_cfg file directory entry type */ struct fw_cfg_file { __be32 size; __be16 select; __u16 reserved; char name[FW_CFG_MAX_FILE_PATH]; }; /* FW_CFG_DMA_CONTROL bits */ #define FW_CFG_DMA_CTL_ERROR 0x01 #define FW_CFG_DMA_CTL_READ 0x02 #define FW_CFG_DMA_CTL_SKIP 0x04 #define FW_CFG_DMA_CTL_SELECT 0x08 #define FW_CFG_DMA_CTL_WRITE 0x10 #define FW_CFG_DMA_SIGNATURE 0x51454d5520434647ULL /* "QEMU CFG" */ /* Control as first field allows for different structures selected by this * field, which might be useful in the future */ struct fw_cfg_dma_access { __be32 control; __be32 length; __be64 address; }; #define FW_CFG_VMCOREINFO_FILENAME "etc/vmcoreinfo" #define FW_CFG_VMCOREINFO_FORMAT_NONE 0x0 #define FW_CFG_VMCOREINFO_FORMAT_ELF 0x1 struct fw_cfg_vmcoreinfo { __le16 host_format; __le16 guest_format; __le32 size; __le64 paddr; }; #endif �������������������������������������������������������������������������������������������linux/isdnif.h��������������������������������������������������������������������������������������0000644�����������������00000004502�14763166027�0007345 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* $Id: isdnif.h,v 1.43.2.2 2004/01/12 23:08:35 keil Exp $ * * Linux ISDN subsystem * Definition of the interface between the subsystem and its low-level drivers. * * Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de) * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * */ #ifndef __ISDNIF_H__ #define __ISDNIF_H__ /* * Values for general protocol-selection */ #define ISDN_PTYPE_UNKNOWN 0 /* Protocol undefined */ #define ISDN_PTYPE_1TR6 1 /* german 1TR6-protocol */ #define ISDN_PTYPE_EURO 2 /* EDSS1-protocol */ #define ISDN_PTYPE_LEASED 3 /* for leased lines */ #define ISDN_PTYPE_NI1 4 /* US NI-1 protocol */ #define ISDN_PTYPE_MAX 7 /* Max. 8 Protocols */ /* * Values for Layer-2-protocol-selection */ #define ISDN_PROTO_L2_X75I 0 /* X75/LAPB with I-Frames */ #define ISDN_PROTO_L2_X75UI 1 /* X75/LAPB with UI-Frames */ #define ISDN_PROTO_L2_X75BUI 2 /* X75/LAPB with UI-Frames */ #define ISDN_PROTO_L2_HDLC 3 /* HDLC */ #define ISDN_PROTO_L2_TRANS 4 /* Transparent (Voice) */ #define ISDN_PROTO_L2_X25DTE 5 /* X25/LAPB DTE mode */ #define ISDN_PROTO_L2_X25DCE 6 /* X25/LAPB DCE mode */ #define ISDN_PROTO_L2_V11096 7 /* V.110 bitrate adaption 9600 Baud */ #define ISDN_PROTO_L2_V11019 8 /* V.110 bitrate adaption 19200 Baud */ #define ISDN_PROTO_L2_V11038 9 /* V.110 bitrate adaption 38400 Baud */ #define ISDN_PROTO_L2_MODEM 10 /* Analog Modem on Board */ #define ISDN_PROTO_L2_FAX 11 /* Fax Group 2/3 */ #define ISDN_PROTO_L2_HDLC_56K 12 /* HDLC 56k */ #define ISDN_PROTO_L2_MAX 15 /* Max. 16 Protocols */ /* * Values for Layer-3-protocol-selection */ #define ISDN_PROTO_L3_TRANS 0 /* Transparent */ #define ISDN_PROTO_L3_TRANSDSP 1 /* Transparent with DSP */ #define ISDN_PROTO_L3_FCLASS2 2 /* Fax Group 2/3 CLASS 2 */ #define ISDN_PROTO_L3_FCLASS1 3 /* Fax Group 2/3 CLASS 1 */ #define ISDN_PROTO_L3_MAX 7 /* Max. 8 Protocols */ #endif /* __ISDNIF_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/errqueue.h������������������������������������������������������������������������������������0000644�����������������00000002705�14763166027�0007731 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_ERRQUEUE_H #define _LINUX_ERRQUEUE_H #include <linux/types.h> struct sock_extended_err { __u32 ee_errno; __u8 ee_origin; __u8 ee_type; __u8 ee_code; __u8 ee_pad; __u32 ee_info; __u32 ee_data; }; #define SO_EE_ORIGIN_NONE 0 #define SO_EE_ORIGIN_LOCAL 1 #define SO_EE_ORIGIN_ICMP 2 #define SO_EE_ORIGIN_ICMP6 3 #define SO_EE_ORIGIN_TXSTATUS 4 #define SO_EE_ORIGIN_ZEROCOPY 5 #define SO_EE_ORIGIN_TXTIME 6 #define SO_EE_ORIGIN_TIMESTAMPING SO_EE_ORIGIN_TXSTATUS #define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1)) #define SO_EE_CODE_ZEROCOPY_COPIED 1 #define SO_EE_CODE_TXTIME_INVALID_PARAM 1 #define SO_EE_CODE_TXTIME_MISSED 2 /** * struct scm_timestamping - timestamps exposed through cmsg * * The timestamping interfaces SO_TIMESTAMPING, MSG_TSTAMP_* * communicate network timestamps by passing this struct in a cmsg with * recvmsg(). See Documentation/networking/timestamping.txt for details. */ struct scm_timestamping { struct timespec ts[3]; }; /* The type of scm_timestamping, passed in sock_extended_err ee_info. * This defines the type of ts[0]. For SCM_TSTAMP_SND only, if ts[0] * is zero, then this is a hardware timestamp and recorded in ts[2]. */ enum { SCM_TSTAMP_SND, /* driver passed skb to NIC, or HW */ SCM_TSTAMP_SCHED, /* data entered the packet scheduler */ SCM_TSTAMP_ACK, /* data acknowledged by peer */ }; #endif /* _LINUX_ERRQUEUE_H */ �����������������������������������������������������������linux/gigaset_dev.h���������������������������������������������������������������������������������0000644�����������������00000002642�14763166027�0010355 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * interface to user space for the gigaset driver * * Copyright (c) 2004 by Hansjoerg Lipp <hjlipp@web.de> * * ===================================================================== * 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. * ===================================================================== */ #ifndef GIGASET_INTERFACE_H #define GIGASET_INTERFACE_H #include <linux/ioctl.h> /* The magic IOCTL value for this interface. */ #define GIGASET_IOCTL 0x47 /* enable/disable device control via character device (lock out ISDN subsys) */ #define GIGASET_REDIR _IOWR(GIGASET_IOCTL, 0, int) /* enable adapter configuration mode (M10x only) */ #define GIGASET_CONFIG _IOWR(GIGASET_IOCTL, 1, int) /* set break characters (M105 only) */ #define GIGASET_BRKCHARS _IOW(GIGASET_IOCTL, 2, unsigned char[6]) /* get version information selected by arg[0] */ #define GIGASET_VERSION _IOWR(GIGASET_IOCTL, 3, unsigned[4]) /* values for GIGASET_VERSION arg[0] */ #define GIGVER_DRIVER 0 /* get driver version */ #define GIGVER_COMPAT 1 /* get interface compatibility version */ #define GIGVER_FWBASE 2 /* get base station firmware version */ #endif ����������������������������������������������������������������������������������������������linux/seg6_iptunnel.h�������������������������������������������������������������������������������0000644�����������������00000001637�14763166027�0010661 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * SR-IPv6 implementation * * Author: * David Lebrun <david.lebrun@uclouvain.be> * * * 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. */ #ifndef _LINUX_SEG6_IPTUNNEL_H #define _LINUX_SEG6_IPTUNNEL_H #include <linux/seg6.h> /* For struct ipv6_sr_hdr. */ enum { SEG6_IPTUNNEL_UNSPEC, SEG6_IPTUNNEL_SRH, __SEG6_IPTUNNEL_MAX, }; #define SEG6_IPTUNNEL_MAX (__SEG6_IPTUNNEL_MAX - 1) struct seg6_iptunnel_encap { int mode; struct ipv6_sr_hdr srh[0]; }; #define SEG6_IPTUN_ENCAP_SIZE(x) ((sizeof(*x)) + (((x)->srh->hdrlen + 1) << 3)) enum { SEG6_IPTUN_MODE_INLINE, SEG6_IPTUN_MODE_ENCAP, SEG6_IPTUN_MODE_L2ENCAP, }; #endif �������������������������������������������������������������������������������������������������linux/am437x-vpfe.h���������������������������������������������������������������������������������0000644�����������������00000007141�14763166027�0010054 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2013 - 2014 Texas Instruments, Inc. * * Benoit Parrot <bparrot@ti.com> * Lad, Prabhakar <prabhakar.csengg@gmail.com> * * This program is free software; you may redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef AM437X_VPFE_USER_H #define AM437X_VPFE_USER_H #include <linux/videodev2.h> enum vpfe_ccdc_data_size { VPFE_CCDC_DATA_16BITS = 0, VPFE_CCDC_DATA_15BITS, VPFE_CCDC_DATA_14BITS, VPFE_CCDC_DATA_13BITS, VPFE_CCDC_DATA_12BITS, VPFE_CCDC_DATA_11BITS, VPFE_CCDC_DATA_10BITS, VPFE_CCDC_DATA_8BITS, }; /* enum for No of pixel per line to be avg. in Black Clamping*/ enum vpfe_ccdc_sample_length { VPFE_CCDC_SAMPLE_1PIXELS = 0, VPFE_CCDC_SAMPLE_2PIXELS, VPFE_CCDC_SAMPLE_4PIXELS, VPFE_CCDC_SAMPLE_8PIXELS, VPFE_CCDC_SAMPLE_16PIXELS, }; /* enum for No of lines in Black Clamping */ enum vpfe_ccdc_sample_line { VPFE_CCDC_SAMPLE_1LINES = 0, VPFE_CCDC_SAMPLE_2LINES, VPFE_CCDC_SAMPLE_4LINES, VPFE_CCDC_SAMPLE_8LINES, VPFE_CCDC_SAMPLE_16LINES, }; /* enum for Alaw gamma width */ enum vpfe_ccdc_gamma_width { VPFE_CCDC_GAMMA_BITS_15_6 = 0, /* use bits 15-6 for gamma */ VPFE_CCDC_GAMMA_BITS_14_5, VPFE_CCDC_GAMMA_BITS_13_4, VPFE_CCDC_GAMMA_BITS_12_3, VPFE_CCDC_GAMMA_BITS_11_2, VPFE_CCDC_GAMMA_BITS_10_1, VPFE_CCDC_GAMMA_BITS_09_0, /* use bits 9-0 for gamma */ }; /* structure for ALaw */ struct vpfe_ccdc_a_law { /* Enable/disable A-Law */ unsigned char enable; /* Gamma Width Input */ enum vpfe_ccdc_gamma_width gamma_wd; }; /* structure for Black Clamping */ struct vpfe_ccdc_black_clamp { unsigned char enable; /* only if bClampEnable is TRUE */ enum vpfe_ccdc_sample_length sample_pixel; /* only if bClampEnable is TRUE */ enum vpfe_ccdc_sample_line sample_ln; /* only if bClampEnable is TRUE */ unsigned short start_pixel; /* only if bClampEnable is TRUE */ unsigned short sgain; /* only if bClampEnable is FALSE */ unsigned short dc_sub; }; /* structure for Black Level Compensation */ struct vpfe_ccdc_black_compensation { /* Constant value to subtract from Red component */ char r; /* Constant value to subtract from Gr component */ char gr; /* Constant value to subtract from Blue component */ char b; /* Constant value to subtract from Gb component */ char gb; }; /* Structure for CCDC configuration parameters for raw capture mode passed * by application */ struct vpfe_ccdc_config_params_raw { /* data size value from 8 to 16 bits */ enum vpfe_ccdc_data_size data_sz; /* Structure for Optional A-Law */ struct vpfe_ccdc_a_law alaw; /* Structure for Optical Black Clamp */ struct vpfe_ccdc_black_clamp blk_clamp; /* Structure for Black Compensation */ struct vpfe_ccdc_black_compensation blk_comp; }; /* * Private IOCTL * VIDIOC_AM437X_CCDC_CFG - Set CCDC configuration for raw capture * This is an experimental ioctl that will change in future kernels. So use * this ioctl with care ! **/ #define VIDIOC_AM437X_CCDC_CFG \ _IOW('V', BASE_VIDIOC_PRIVATE + 1, void *) #endif /* AM437X_VPFE_USER_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/efs_fs_sb.h�����������������������������������������������������������������������������������0000644�����������������00000004263�14763166027�0010026 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * efs_fs_sb.h * * Copyright (c) 1999 Al Smith * * Portions derived from IRIX header files (c) 1988 Silicon Graphics */ #ifndef __EFS_FS_SB_H__ #define __EFS_FS_SB_H__ #include <linux/types.h> #include <linux/magic.h> /* EFS superblock magic numbers */ #define EFS_MAGIC 0x072959 #define EFS_NEWMAGIC 0x07295a #define IS_EFS_MAGIC(x) ((x == EFS_MAGIC) || (x == EFS_NEWMAGIC)) #define EFS_SUPER 1 #define EFS_ROOTINODE 2 /* efs superblock on disk */ struct efs_super { __be32 fs_size; /* size of filesystem, in sectors */ __be32 fs_firstcg; /* bb offset to first cg */ __be32 fs_cgfsize; /* size of cylinder group in bb's */ __be16 fs_cgisize; /* bb's of inodes per cylinder group */ __be16 fs_sectors; /* sectors per track */ __be16 fs_heads; /* heads per cylinder */ __be16 fs_ncg; /* # of cylinder groups in filesystem */ __be16 fs_dirty; /* fs needs to be fsck'd */ __be32 fs_time; /* last super-block update */ __be32 fs_magic; /* magic number */ char fs_fname[6]; /* file system name */ char fs_fpack[6]; /* file system pack name */ __be32 fs_bmsize; /* size of bitmap in bytes */ __be32 fs_tfree; /* total free data blocks */ __be32 fs_tinode; /* total free inodes */ __be32 fs_bmblock; /* bitmap location. */ __be32 fs_replsb; /* Location of replicated superblock. */ __be32 fs_lastialloc; /* last allocated inode */ char fs_spare[20]; /* space for expansion - MUST BE ZERO */ __be32 fs_checksum; /* checksum of volume portion of fs */ }; /* efs superblock information in memory */ struct efs_sb_info { __u32 fs_magic; /* superblock magic number */ __u32 fs_start; /* first block of filesystem */ __u32 first_block; /* first data block in filesystem */ __u32 total_blocks; /* total number of blocks in filesystem */ __u32 group_size; /* # of blocks a group consists of */ __u32 data_free; /* # of free data blocks */ __u32 inode_free; /* # of free inodes */ __u16 inode_blocks; /* # of blocks used for inodes in every grp */ __u16 total_groups; /* # of groups */ }; #endif /* __EFS_FS_SB_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/b1lli.h���������������������������������������������������������������������������������������0000644�����������������00000003265�14763166027�0007101 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* $Id: b1lli.h,v 1.8.8.3 2001/09/23 22:25:05 kai Exp $ * * ISDN lowlevel-module for AVM B1-card. * * Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de) * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * */ #ifndef _B1LLI_H_ #define _B1LLI_H_ /* * struct for loading t4 file */ typedef struct avmb1_t4file { int len; unsigned char *data; } avmb1_t4file; typedef struct avmb1_loaddef { int contr; avmb1_t4file t4file; } avmb1_loaddef; typedef struct avmb1_loadandconfigdef { int contr; avmb1_t4file t4file; avmb1_t4file t4config; } avmb1_loadandconfigdef; typedef struct avmb1_resetdef { int contr; } avmb1_resetdef; typedef struct avmb1_getdef { int contr; int cardtype; int cardstate; } avmb1_getdef; /* * struct for adding new cards */ typedef struct avmb1_carddef { int port; int irq; } avmb1_carddef; #define AVM_CARDTYPE_B1 0 #define AVM_CARDTYPE_T1 1 #define AVM_CARDTYPE_M1 2 #define AVM_CARDTYPE_M2 3 typedef struct avmb1_extcarddef { int port; int irq; int cardtype; int cardnr; /* for HEMA/T1 */ } avmb1_extcarddef; #define AVMB1_LOAD 0 /* load image to card */ #define AVMB1_ADDCARD 1 /* add a new card - OBSOLETE */ #define AVMB1_RESETCARD 2 /* reset a card */ #define AVMB1_LOAD_AND_CONFIG 3 /* load image and config to card */ #define AVMB1_ADDCARD_WITH_TYPE 4 /* add a new card, with cardtype */ #define AVMB1_GET_CARDINFO 5 /* get cardtype */ #define AVMB1_REMOVECARD 6 /* remove a card - OBSOLETE */ #define AVMB1_REGISTERCARD_IS_OBSOLETE #endif /* _B1LLI_H_ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/signal.h��������������������������������������������������������������������������������������0000644�����������������00000000604�14763166027�0007345 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SIGNAL_H #define _LINUX_SIGNAL_H #include <asm/signal.h> #include <asm/siginfo.h> #define SS_ONSTACK 1 #define SS_DISABLE 2 /* bit-flags */ #define SS_AUTODISARM (1U << 31) /* disable sas during sighandling */ /* mask for all SS_xxx flags */ #define SS_FLAG_BITS SS_AUTODISARM #endif /* _LINUX_SIGNAL_H */ ����������������������������������������������������������������������������������������������������������������������������linux/gsmmux.h��������������������������������������������������������������������������������������0000644�����������������00000002021�14763166027�0007403 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_GSMMUX_H #define _LINUX_GSMMUX_H #include <linux/if.h> #include <linux/ioctl.h> #include <linux/types.h> struct gsm_config { unsigned int adaption; unsigned int encapsulation; unsigned int initiator; unsigned int t1; unsigned int t2; unsigned int t3; unsigned int n2; unsigned int mru; unsigned int mtu; unsigned int k; unsigned int i; unsigned int unused[8]; /* Padding for expansion without breaking stuff */ }; #define GSMIOC_GETCONF _IOR('G', 0, struct gsm_config) #define GSMIOC_SETCONF _IOW('G', 1, struct gsm_config) struct gsm_netconfig { unsigned int adaption; /* Adaption to use in network mode */ unsigned short protocol;/* Protocol to use - only ETH_P_IP supported */ unsigned short unused2; char if_name[IFNAMSIZ]; /* interface name format string */ __u8 unused[28]; /* For future use */ }; #define GSMIOC_ENABLE_NET _IOW('G', 2, struct gsm_netconfig) #define GSMIOC_DISABLE_NET _IO('G', 3) #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/wanrouter.h�����������������������������������������������������������������������������������0000644�����������������00000000705�14763166027�0010120 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * wanrouter.h Legacy declarations kept around until X25 is removed */ #ifndef _ROUTER_H #define _ROUTER_H /* 'state' defines */ enum wan_states { WAN_UNCONFIGURED, /* link/channel is not configured */ WAN_DISCONNECTED, /* link/channel is disconnected */ WAN_CONNECTING, /* connection is in progress */ WAN_CONNECTED /* link/channel is operational */ }; #endif /* _ROUTER_H */ �����������������������������������������������������������linux/mpls.h����������������������������������������������������������������������������������������0000644�����������������00000004376�14763166027�0007055 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _MPLS_H #define _MPLS_H #include <linux/types.h> #include <asm/byteorder.h> /* Reference: RFC 5462, RFC 3032 * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Label | TC |S| TTL | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * * Label: Label Value, 20 bits * TC: Traffic Class field, 3 bits * S: Bottom of Stack, 1 bit * TTL: Time to Live, 8 bits */ struct mpls_label { __be32 entry; }; #define MPLS_LS_LABEL_MASK 0xFFFFF000 #define MPLS_LS_LABEL_SHIFT 12 #define MPLS_LS_TC_MASK 0x00000E00 #define MPLS_LS_TC_SHIFT 9 #define MPLS_LS_S_MASK 0x00000100 #define MPLS_LS_S_SHIFT 8 #define MPLS_LS_TTL_MASK 0x000000FF #define MPLS_LS_TTL_SHIFT 0 /* Reserved labels */ #define MPLS_LABEL_IPV4NULL 0 /* RFC3032 */ #define MPLS_LABEL_RTALERT 1 /* RFC3032 */ #define MPLS_LABEL_IPV6NULL 2 /* RFC3032 */ #define MPLS_LABEL_IMPLNULL 3 /* RFC3032 */ #define MPLS_LABEL_ENTROPY 7 /* RFC6790 */ #define MPLS_LABEL_GAL 13 /* RFC5586 */ #define MPLS_LABEL_OAMALERT 14 /* RFC3429 */ #define MPLS_LABEL_EXTENSION 15 /* RFC7274 */ #define MPLS_LABEL_FIRST_UNRESERVED 16 /* RFC3032 */ /* These are embedded into IFLA_STATS_AF_SPEC: * [IFLA_STATS_AF_SPEC] * -> [AF_MPLS] * -> [MPLS_STATS_xxx] * * Attributes: * [MPLS_STATS_LINK] = { * struct mpls_link_stats * } */ enum { MPLS_STATS_UNSPEC, /* also used as 64bit pad attribute */ MPLS_STATS_LINK, __MPLS_STATS_MAX, }; #define MPLS_STATS_MAX (__MPLS_STATS_MAX - 1) struct mpls_link_stats { __u64 rx_packets; /* total packets received */ __u64 tx_packets; /* total packets transmitted */ __u64 rx_bytes; /* total bytes received */ __u64 tx_bytes; /* total bytes transmitted */ __u64 rx_errors; /* bad packets received */ __u64 tx_errors; /* packet transmit problems */ __u64 rx_dropped; /* packet dropped on receive */ __u64 tx_dropped; /* packet dropped on transmit */ __u64 rx_noroute; /* no route for packet dest */ }; #endif /* _MPLS_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netconf.h�������������������������������������������������������������������������������������0000644�����������������00000001146�14763166027�0007526 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_NETCONF_H_ #define _LINUX_NETCONF_H_ #include <linux/types.h> #include <linux/netlink.h> struct netconfmsg { __u8 ncm_family; }; enum { NETCONFA_UNSPEC, NETCONFA_IFINDEX, NETCONFA_FORWARDING, NETCONFA_RP_FILTER, NETCONFA_MC_FORWARDING, NETCONFA_PROXY_NEIGH, NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN, NETCONFA_INPUT, NETCONFA_BC_FORWARDING, __NETCONFA_MAX }; #define NETCONFA_MAX (__NETCONFA_MAX - 1) #define NETCONFA_ALL -1 #define NETCONFA_IFINDEX_ALL -1 #define NETCONFA_IFINDEX_DEFAULT -2 #endif /* _LINUX_NETCONF_H_ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/nl80211.h�������������������������������������������������������������������������������������0000644�����������������00000747012�14763166027�0007110 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef __LINUX_NL80211_H #define __LINUX_NL80211_H /* * 802.11 netlink interface public header * * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> * Copyright 2008 Michael Wu <flamingice@sourmilk.net> * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com> * Copyright 2008 Michael Buesch <m@bues.ch> * Copyright 2008, 2009 Luis R. Rodriguez <lrodriguez@atheros.com> * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com> * Copyright 2008 Colin McCabe <colin@cozybit.com> * Copyright 2015-2017 Intel Deutschland GmbH * Copyright (C) 2018 Intel Corporation * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ /* * This header file defines the userspace API to the wireless stack. Please * be careful not to break things - i.e. don't move anything around or so * unless you can demonstrate that it breaks neither API nor ABI. * * Additions to the API should be accompanied by actual implementations in * an upstream driver, so that example implementations exist in case there * are ever concerns about the precise semantics of the API or changes are * needed, and to ensure that code for dead (no longer implemented) API * can actually be identified and removed. * Nonetheless, semantics should also be documented carefully in this file. */ #include <linux/types.h> #define NL80211_GENL_NAME "nl80211" #define NL80211_MULTICAST_GROUP_CONFIG "config" #define NL80211_MULTICAST_GROUP_SCAN "scan" #define NL80211_MULTICAST_GROUP_REG "regulatory" #define NL80211_MULTICAST_GROUP_MLME "mlme" #define NL80211_MULTICAST_GROUP_VENDOR "vendor" #define NL80211_MULTICAST_GROUP_NAN "nan" #define NL80211_MULTICAST_GROUP_TESTMODE "testmode" /** * DOC: Station handling * * Stations are added per interface, but a special case exists with VLAN * interfaces. When a station is bound to an AP interface, it may be moved * into a VLAN identified by a VLAN interface index (%NL80211_ATTR_STA_VLAN). * The station is still assumed to belong to the AP interface it was added * to. * * Station handling varies per interface type and depending on the driver's * capabilities. * * For drivers supporting TDLS with external setup (WIPHY_FLAG_SUPPORTS_TDLS * and WIPHY_FLAG_TDLS_EXTERNAL_SETUP), the station lifetime is as follows: * - a setup station entry is added, not yet authorized, without any rate * or capability information, this just exists to avoid race conditions * - when the TDLS setup is done, a single NL80211_CMD_SET_STATION is valid * to add rate and capability information to the station and at the same * time mark it authorized. * - %NL80211_TDLS_ENABLE_LINK is then used * - after this, the only valid operation is to remove it by tearing down * the TDLS link (%NL80211_TDLS_DISABLE_LINK) * * TODO: need more info for other interface types */ /** * DOC: Frame transmission/registration support * * Frame transmission and registration support exists to allow userspace * management entities such as wpa_supplicant react to management frames * that are not being handled by the kernel. This includes, for example, * certain classes of action frames that cannot be handled in the kernel * for various reasons. * * Frame registration is done on a per-interface basis and registrations * cannot be removed other than by closing the socket. It is possible to * specify a registration filter to register, for example, only for a * certain type of action frame. In particular with action frames, those * that userspace registers for will not be returned as unhandled by the * driver, so that the registered application has to take responsibility * for doing that. * * The type of frame that can be registered for is also dependent on the * driver and interface type. The frame types are advertised in wiphy * attributes so applications know what to expect. * * NOTE: When an interface changes type while registrations are active, * these registrations are ignored until the interface type is * changed again. This means that changing the interface type can * lead to a situation that couldn't otherwise be produced, but * any such registrations will be dormant in the sense that they * will not be serviced, i.e. they will not receive any frames. * * Frame transmission allows userspace to send for example the required * responses to action frames. It is subject to some sanity checking, * but many frames can be transmitted. When a frame was transmitted, its * status is indicated to the sending socket. * * For more technical details, see the corresponding command descriptions * below. */ /** * DOC: Virtual interface / concurrency capabilities * * Some devices are able to operate with virtual MACs, they can have * more than one virtual interface. The capability handling for this * is a bit complex though, as there may be a number of restrictions * on the types of concurrency that are supported. * * To start with, each device supports the interface types listed in * the %NL80211_ATTR_SUPPORTED_IFTYPES attribute, but by listing the * types there no concurrency is implied. * * Once concurrency is desired, more attributes must be observed: * To start with, since some interface types are purely managed in * software, like the AP-VLAN type in mac80211 for example, there's * an additional list of these, they can be added at any time and * are only restricted by some semantic restrictions (e.g. AP-VLAN * cannot be added without a corresponding AP interface). This list * is exported in the %NL80211_ATTR_SOFTWARE_IFTYPES attribute. * * Further, the list of supported combinations is exported. This is * in the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute. Basically, * it exports a list of "groups", and at any point in time the * interfaces that are currently active must fall into any one of * the advertised groups. Within each group, there are restrictions * on the number of interfaces of different types that are supported * and also the number of different channels, along with potentially * some other restrictions. See &enum nl80211_if_combination_attrs. * * All together, these attributes define the concurrency of virtual * interfaces that a given device supports. */ /** * DOC: packet coalesce support * * In most cases, host that receives IPv4 and IPv6 multicast/broadcast * packets does not do anything with these packets. Therefore the * reception of these unwanted packets causes unnecessary processing * and power consumption. * * Packet coalesce feature helps to reduce number of received interrupts * to host by buffering these packets in firmware/hardware for some * predefined time. Received interrupt will be generated when one of the * following events occur. * a) Expiration of hardware timer whose expiration time is set to maximum * coalescing delay of matching coalesce rule. * b) Coalescing buffer in hardware reaches it's limit. * c) Packet doesn't match any of the configured coalesce rules. * * User needs to configure following parameters for creating a coalesce * rule. * a) Maximum coalescing delay * b) List of packet patterns which needs to be matched * c) Condition for coalescence. pattern 'match' or 'no match' * Multiple such rules can be created. */ /** * DOC: WPA/WPA2 EAPOL handshake offload * * By setting @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK flag drivers * can indicate they support offloading EAPOL handshakes for WPA/WPA2 * preshared key authentication. In %NL80211_CMD_CONNECT the preshared * key should be specified using %NL80211_ATTR_PMK. Drivers supporting * this offload may reject the %NL80211_CMD_CONNECT when no preshared * key material is provided, for example when that driver does not * support setting the temporal keys through %CMD_NEW_KEY. * * Similarly @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X flag can be * set by drivers indicating offload support of the PTK/GTK EAPOL * handshakes during 802.1X authentication. In order to use the offload * the %NL80211_CMD_CONNECT should have %NL80211_ATTR_WANT_1X_4WAY_HS * attribute flag. Drivers supporting this offload may reject the * %NL80211_CMD_CONNECT when the attribute flag is not present. * * For 802.1X the PMK or PMK-R0 are set by providing %NL80211_ATTR_PMK * using %NL80211_CMD_SET_PMK. For offloaded FT support also * %NL80211_ATTR_PMKR0_NAME must be provided. */ /** * DOC: FILS shared key authentication offload * * FILS shared key authentication offload can be advertized by drivers by * setting @NL80211_EXT_FEATURE_FILS_SK_OFFLOAD flag. The drivers that support * FILS shared key authentication offload should be able to construct the * authentication and association frames for FILS shared key authentication and * eventually do a key derivation as per IEEE 802.11ai. The below additional * parameters should be given to driver in %NL80211_CMD_CONNECT and/or in * %NL80211_CMD_UPDATE_CONNECT_PARAMS. * %NL80211_ATTR_FILS_ERP_USERNAME - used to construct keyname_nai * %NL80211_ATTR_FILS_ERP_REALM - used to construct keyname_nai * %NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM - used to construct erp message * %NL80211_ATTR_FILS_ERP_RRK - used to generate the rIK and rMSK * rIK should be used to generate an authentication tag on the ERP message and * rMSK should be used to derive a PMKSA. * rIK, rMSK should be generated and keyname_nai, sequence number should be used * as specified in IETF RFC 6696. * * When FILS shared key authentication is completed, driver needs to provide the * below additional parameters to userspace, which can be either after setting * up a connection or after roaming. * %NL80211_ATTR_FILS_KEK - used for key renewal * %NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM - used in further EAP-RP exchanges * %NL80211_ATTR_PMKID - used to identify the PMKSA used/generated * %Nl80211_ATTR_PMK - used to update PMKSA cache in userspace * The PMKSA can be maintained in userspace persistently so that it can be used * later after reboots or wifi turn off/on also. * * %NL80211_ATTR_FILS_CACHE_ID is the cache identifier advertized by a FILS * capable AP supporting PMK caching. It specifies the scope within which the * PMKSAs are cached in an ESS. %NL80211_CMD_SET_PMKSA and * %NL80211_CMD_DEL_PMKSA are enhanced to allow support for PMKSA caching based * on FILS cache identifier. Additionally %NL80211_ATTR_PMK is used with * %NL80211_SET_PMKSA to specify the PMK corresponding to a PMKSA for driver to * use in a FILS shared key connection with PMKSA caching. */ /** * enum nl80211_commands - supported nl80211 commands * * @NL80211_CMD_UNSPEC: unspecified command to catch errors * * @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request * to get a list of all present wiphys. * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME, * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ (and the * attributes determining the channel width; this is used for setting * monitor mode channel), %NL80211_ATTR_WIPHY_RETRY_SHORT, * %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD, * and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD. * However, for setting the channel, see %NL80211_CMD_SET_CHANNEL * instead, the support here is for backward compatibility only. * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request * or rename notification. Has attributes %NL80211_ATTR_WIPHY and * %NL80211_ATTR_WIPHY_NAME. * @NL80211_CMD_DEL_WIPHY: Wiphy deleted. Has attributes * %NL80211_ATTR_WIPHY and %NL80211_ATTR_WIPHY_NAME. * * @NL80211_CMD_GET_INTERFACE: Request an interface's configuration; * either a dump request for all interfaces or a specific get with a * single %NL80211_ATTR_IFINDEX is supported. * @NL80211_CMD_SET_INTERFACE: Set type of a virtual interface, requires * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_IFTYPE. * @NL80211_CMD_NEW_INTERFACE: Newly created virtual interface or response * to %NL80211_CMD_GET_INTERFACE. Has %NL80211_ATTR_IFINDEX, * %NL80211_ATTR_WIPHY and %NL80211_ATTR_IFTYPE attributes. Can also * be sent from userspace to request creation of a new virtual interface, * then requires attributes %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFTYPE and * %NL80211_ATTR_IFNAME. * @NL80211_CMD_DEL_INTERFACE: Virtual interface was deleted, has attributes * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_WIPHY. Can also be sent from * userspace to request deletion of a virtual interface, then requires * attribute %NL80211_ATTR_IFINDEX. * * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT, * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD. * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA, * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC, %NL80211_ATTR_KEY_CIPHER, * and %NL80211_ATTR_KEY_SEQ attributes. * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX * or %NL80211_ATTR_MAC. * * @NL80211_CMD_GET_BEACON: (not used) * @NL80211_CMD_SET_BEACON: change the beacon on an access point interface * using the %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL * attributes. For drivers that generate the beacon and probe responses * internally, the following attributes must be provided: %NL80211_ATTR_IE, * %NL80211_ATTR_IE_PROBE_RESP and %NL80211_ATTR_IE_ASSOC_RESP. * @NL80211_CMD_START_AP: Start AP operation on an AP interface, parameters * are like for %NL80211_CMD_SET_BEACON, and additionally parameters that * do not change are used, these include %NL80211_ATTR_BEACON_INTERVAL, * %NL80211_ATTR_DTIM_PERIOD, %NL80211_ATTR_SSID, * %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE, * %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS, * %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY, * %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_INACTIVITY_TIMEOUT, * %NL80211_ATTR_ACL_POLICY and %NL80211_ATTR_MAC_ADDRS. * The channel to use can be set on the interface or be given using the * %NL80211_ATTR_WIPHY_FREQ and the attributes determining channel width. * @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP * @NL80211_CMD_STOP_AP: Stop AP operation on the given interface * @NL80211_CMD_DEL_BEACON: old alias for %NL80211_CMD_STOP_AP * * @NL80211_CMD_GET_STATION: Get station attributes for station identified by * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX. * @NL80211_CMD_SET_STATION: Set station attributes for station identified by * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX. * @NL80211_CMD_NEW_STATION: Add a station with given attributes to the * the interface identified by %NL80211_ATTR_IFINDEX. * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC * or, if no MAC address given, all stations, on the interface identified * by %NL80211_ATTR_IFINDEX. %NL80211_ATTR_MGMT_SUBTYPE and * %NL80211_ATTR_REASON_CODE can optionally be used to specify which type * of disconnection indication should be sent to the station * (Deauthentication or Disassociation frame and reason code for that * frame). * * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to * destination %NL80211_ATTR_MAC on the interface identified by * %NL80211_ATTR_IFINDEX. * @NL80211_CMD_SET_MPATH: Set mesh path attributes for mesh path to * destination %NL80211_ATTR_MAC on the interface identified by * %NL80211_ATTR_IFINDEX. * @NL80211_CMD_NEW_MPATH: Create a new mesh path for the destination given by * %NL80211_ATTR_MAC via %NL80211_ATTR_MPATH_NEXT_HOP. * @NL80211_CMD_DEL_MPATH: Delete a mesh path to the destination given by * %NL80211_ATTR_MAC. * @NL80211_CMD_NEW_PATH: Add a mesh path with given attributes to the * the interface identified by %NL80211_ATTR_IFINDEX. * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC * or, if no MAC address given, all mesh paths, on the interface identified * by %NL80211_ATTR_IFINDEX. * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by * %NL80211_ATTR_IFINDEX. * * @NL80211_CMD_GET_REG: ask the wireless core to send us its currently set * regulatory domain. If %NL80211_ATTR_WIPHY is specified and the device * has a private regulatory domain, it will be returned. Otherwise, the * global regdomain will be returned. * A device will have a private regulatory domain if it uses the * regulatory_hint() API. Even when a private regdomain is used the channel * information will still be mended according to further hints from * the regulatory core to help with compliance. A dump version of this API * is now available which will returns the global regdomain as well as * all private regdomains of present wiphys (for those that have it). * If a wiphy is self-managed (%NL80211_ATTR_WIPHY_SELF_MANAGED_REG), then * its private regdomain is the only valid one for it. The regulatory * core is not used to help with compliance in this case. * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command * after being queried by the kernel. CRDA replies by sending a regulatory * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our * current alpha2 if it found a match. It also provides * NL80211_ATTR_REG_RULE_FLAGS, and a set of regulatory rules. Each * regulatory rule is a nested set of attributes given by * %NL80211_ATTR_REG_RULE_FREQ_[START|END] and * %NL80211_ATTR_FREQ_RANGE_MAX_BW with an attached power rule given by * %NL80211_ATTR_REG_RULE_POWER_MAX_ANT_GAIN and * %NL80211_ATTR_REG_RULE_POWER_MAX_EIRP. * @NL80211_CMD_REQ_SET_REG: ask the wireless core to set the regulatory domain * to the specified ISO/IEC 3166-1 alpha2 country code. The core will * store this as a valid request and then query userspace for it. * * @NL80211_CMD_GET_MESH_CONFIG: Get mesh networking properties for the * interface identified by %NL80211_ATTR_IFINDEX * * @NL80211_CMD_SET_MESH_CONFIG: Set mesh networking properties for the * interface identified by %NL80211_ATTR_IFINDEX * * @NL80211_CMD_SET_MGMT_EXTRA_IE: Set extra IEs for management frames. The * interface is identified with %NL80211_ATTR_IFINDEX and the management * frame subtype with %NL80211_ATTR_MGMT_SUBTYPE. The extra IE data to be * added to the end of the specified management frame is specified with * %NL80211_ATTR_IE. If the command succeeds, the requested data will be * added to all specified management frames generated by * kernel/firmware/driver. * Note: This command has been removed and it is only reserved at this * point to avoid re-using existing command number. The functionality this * command was planned for has been provided with cleaner design with the * option to specify additional IEs in NL80211_CMD_TRIGGER_SCAN, * NL80211_CMD_AUTHENTICATE, NL80211_CMD_ASSOCIATE, * NL80211_CMD_DEAUTHENTICATE, and NL80211_CMD_DISASSOCIATE. * * @NL80211_CMD_GET_SCAN: get scan results * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the * probe requests at CCK rate or not. %NL80211_ATTR_BSSID can be used to * specify a BSSID to scan for; if not included, the wildcard BSSID will * be used. * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to * NL80211_CMD_GET_SCAN and on the "scan" multicast group) * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons, * partial scan results may be available * * @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan at certain * intervals and certain number of cycles, as specified by * %NL80211_ATTR_SCHED_SCAN_PLANS. If %NL80211_ATTR_SCHED_SCAN_PLANS is * not specified and only %NL80211_ATTR_SCHED_SCAN_INTERVAL is specified, * scheduled scan will run in an infinite loop with the specified interval. * These attributes are mutually exculsive, * i.e. NL80211_ATTR_SCHED_SCAN_INTERVAL must not be passed if * NL80211_ATTR_SCHED_SCAN_PLANS is defined. * If for some reason scheduled scan is aborted by the driver, all scan * plans are canceled (including scan plans that did not start yet). * Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS) * are passed, they are used in the probe requests. For * broadcast, a broadcast SSID must be passed (ie. an empty * string). If no SSID is passed, no probe requests are sent and * a passive scan is performed. %NL80211_ATTR_SCAN_FREQUENCIES, * if passed, define which channels should be scanned; if not * passed, all channels allowed for the current regulatory domain * are used. Extra IEs can also be passed from the userspace by * using the %NL80211_ATTR_IE attribute. The first cycle of the * scheduled scan can be delayed by %NL80211_ATTR_SCHED_SCAN_DELAY * is supplied. If the device supports multiple concurrent scheduled * scans, it will allow such when the caller provides the flag attribute * %NL80211_ATTR_SCHED_SCAN_MULTI to indicate user-space support for it. * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan. Returns -ENOENT if * scheduled scan is not running. The caller may assume that as soon * as the call returns, it is safe to start a new scheduled scan again. * @NL80211_CMD_SCHED_SCAN_RESULTS: indicates that there are scheduled scan * results available. * @NL80211_CMD_SCHED_SCAN_STOPPED: indicates that the scheduled scan has * stopped. The driver may issue this event at any time during a * scheduled scan. One reason for stopping the scan is if the hardware * does not support starting an association or a normal scan while running * a scheduled scan. This event is also sent when the * %NL80211_CMD_STOP_SCHED_SCAN command is received or when the interface * is brought down while a scheduled scan was running. * * @NL80211_CMD_GET_SURVEY: get survey resuls, e.g. channel occupation * or noise level * @NL80211_CMD_NEW_SURVEY_RESULTS: survey data notification (as a reply to * NL80211_CMD_GET_SURVEY and on the "scan" multicast group) * * @NL80211_CMD_SET_PMKSA: Add a PMKSA cache entry using %NL80211_ATTR_MAC * (for the BSSID), %NL80211_ATTR_PMKID, and optionally %NL80211_ATTR_PMK * (PMK is used for PTKSA derivation in case of FILS shared key offload) or * using %NL80211_ATTR_SSID, %NL80211_ATTR_FILS_CACHE_ID, * %NL80211_ATTR_PMKID, and %NL80211_ATTR_PMK in case of FILS * authentication where %NL80211_ATTR_FILS_CACHE_ID is the identifier * advertized by a FILS capable AP identifying the scope of PMKSA in an * ESS. * @NL80211_CMD_DEL_PMKSA: Delete a PMKSA cache entry, using %NL80211_ATTR_MAC * (for the BSSID) and %NL80211_ATTR_PMKID or using %NL80211_ATTR_SSID, * %NL80211_ATTR_FILS_CACHE_ID, and %NL80211_ATTR_PMKID in case of FILS * authentication. * @NL80211_CMD_FLUSH_PMKSA: Flush all PMKSA cache entries. * * @NL80211_CMD_REG_CHANGE: indicates to userspace the regulatory domain * has been changed and provides details of the request information * that caused the change such as who initiated the regulatory request * (%NL80211_ATTR_REG_INITIATOR), the wiphy_idx * (%NL80211_ATTR_REG_ALPHA2) on which the request was made from if * the initiator was %NL80211_REGDOM_SET_BY_COUNTRY_IE or * %NL80211_REGDOM_SET_BY_DRIVER, the type of regulatory domain * set (%NL80211_ATTR_REG_TYPE), if the type of regulatory domain is * %NL80211_REG_TYPE_COUNTRY the alpha2 to which we have moved on * to (%NL80211_ATTR_REG_ALPHA2). * @NL80211_CMD_REG_BEACON_HINT: indicates to userspace that an AP beacon * has been found while world roaming thus enabling active scan or * any mode of operation that initiates TX (beacons) on a channel * where we would not have been able to do either before. As an example * if you are world roaming (regulatory domain set to world or if your * driver is using a custom world roaming regulatory domain) and while * doing a passive scan on the 5 GHz band you find an AP there (if not * on a DFS channel) you will now be able to actively scan for that AP * or use AP mode on your card on that same channel. Note that this will * never be used for channels 1-11 on the 2 GHz band as they are always * enabled world wide. This beacon hint is only sent if your device had * either disabled active scanning or beaconing on a channel. We send to * userspace the wiphy on which we removed a restriction from * (%NL80211_ATTR_WIPHY) and the channel on which this occurred * before (%NL80211_ATTR_FREQ_BEFORE) and after (%NL80211_ATTR_FREQ_AFTER) * the beacon hint was processed. * * @NL80211_CMD_AUTHENTICATE: authentication request and notification. * This command is used both as a command (request to authenticate) and * as an event on the "mlme" multicast group indicating completion of the * authentication process. * When used as a command, %NL80211_ATTR_IFINDEX is used to identify the * interface. %NL80211_ATTR_MAC is used to specify PeerSTAAddress (and * BSSID in case of station mode). %NL80211_ATTR_SSID is used to specify * the SSID (mainly for association, but is included in authentication * request, too, to help BSS selection. %NL80211_ATTR_WIPHY_FREQ is used * to specify the frequence of the channel in MHz. %NL80211_ATTR_AUTH_TYPE * is used to specify the authentication type. %NL80211_ATTR_IE is used to * define IEs (VendorSpecificInfo, but also including RSN IE and FT IEs) * to be added to the frame. * When used as an event, this reports reception of an Authentication * frame in station and IBSS modes when the local MLME processed the * frame, i.e., it was for the local STA and was received in correct * state. This is similar to MLME-AUTHENTICATE.confirm primitive in the * MLME SAP interface (kernel providing MLME, userspace SME). The * included %NL80211_ATTR_FRAME attribute contains the management frame * (including both the header and frame body, but not FCS). This event is * also used to indicate if the authentication attempt timed out. In that * case the %NL80211_ATTR_FRAME attribute is replaced with a * %NL80211_ATTR_TIMED_OUT flag (and %NL80211_ATTR_MAC to indicate which * pending authentication timed out). * @NL80211_CMD_ASSOCIATE: association request and notification; like * NL80211_CMD_AUTHENTICATE but for Association and Reassociation * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request, * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives). The * %NL80211_ATTR_PREV_BSSID attribute is used to specify whether the * request is for the initial association to an ESS (that attribute not * included) or for reassociation within the ESS (that attribute is * included). * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like * NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to * MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication * primitives). * @NL80211_CMD_DISASSOCIATE: disassociation request and notification; like * NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to * MLME-DISASSOCIATE.request and MLME-DISASSOCIATE.indication primitives). * * @NL80211_CMD_MICHAEL_MIC_FAILURE: notification of a locally detected Michael * MIC (part of TKIP) failure; sent on the "mlme" multicast group; the * event includes %NL80211_ATTR_MAC to describe the source MAC address of * the frame with invalid MIC, %NL80211_ATTR_KEY_TYPE to show the key * type, %NL80211_ATTR_KEY_IDX to indicate the key identifier, and * %NL80211_ATTR_KEY_SEQ to indicate the TSC value of the frame; this * event matches with MLME-MICHAELMICFAILURE.indication() primitive * * @NL80211_CMD_JOIN_IBSS: Join a new IBSS -- given at least an SSID and a * FREQ attribute (for the initial frequency if no peer can be found) * and optionally a MAC (as BSSID) and FREQ_FIXED attribute if those * should be fixed rather than automatically determined. Can only be * executed on a network interface that is UP, and fixed BSSID/FREQ * may be rejected. Another optional parameter is the beacon interval, * given in the %NL80211_ATTR_BEACON_INTERVAL attribute, which if not * given defaults to 100 TU (102.4ms). * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is * determined by the network interface. * * @NL80211_CMD_TESTMODE: testmode command, takes a wiphy (or ifindex) attribute * to identify the device, and the TESTDATA blob attribute to pass through * to the driver. * * @NL80211_CMD_CONNECT: connection request and notification; this command * requests to connect to a specified network but without separating * auth and assoc steps. For this, you need to specify the SSID in a * %NL80211_ATTR_SSID attribute, and can optionally specify the association * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_USE_MFP, * %NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT, * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE, * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT, * %NL80211_ATTR_CONTROL_PORT_OVER_NL80211, %NL80211_ATTR_MAC_HINT, and * %NL80211_ATTR_WIPHY_FREQ_HINT. * If included, %NL80211_ATTR_MAC and %NL80211_ATTR_WIPHY_FREQ are * restrictions on BSS selection, i.e., they effectively prevent roaming * within the ESS. %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT * can be included to provide a recommendation of the initial BSS while * allowing the driver to roam to other BSSes within the ESS and also to * ignore this recommendation if the indicated BSS is not ideal. Only one * set of BSSID,frequency parameters is used (i.e., either the enforcing * %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict * %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT). * %NL80211_ATTR_PREV_BSSID can be used to request a reassociation within * the ESS in case the device is already associated and an association with * a different BSS is desired. * Background scan period can optionally be * specified in %NL80211_ATTR_BG_SCAN_PERIOD, * if not specified default background scan configuration * in driver is used and if period value is 0, bg scan will be disabled. * This attribute is ignored if driver does not support roam scan. * It is also sent as an event, with the BSSID and response IEs when the * connection is established or failed to be established. This can be * determined by the %NL80211_ATTR_STATUS_CODE attribute (0 = success, * non-zero = failure). If %NL80211_ATTR_TIMED_OUT is included in the * event, the connection attempt failed due to not being able to initiate * authentication/association or not receiving a response from the AP. * Non-zero %NL80211_ATTR_STATUS_CODE value is indicated in that case as * well to remain backwards compatible. * When establishing a security association, drivers that support 4 way * handshake offload should send %NL80211_CMD_PORT_AUTHORIZED event when * the 4 way handshake is completed successfully. * @NL80211_CMD_ROAM: Notification indicating the card/driver roamed by itself. * When a security association was established with the new AP (e.g. if * the FT protocol was used for roaming or the driver completed the 4 way * handshake), this event should be followed by an * %NL80211_CMD_PORT_AUTHORIZED event. * @NL80211_CMD_DISCONNECT: drop a given connection; also used to notify * userspace that a connection was dropped by the AP or due to other * reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and * %NL80211_ATTR_REASON_CODE attributes are used. * * @NL80211_CMD_SET_WIPHY_NETNS: Set a wiphy's netns. Note that all devices * associated with this wiphy must be down and will follow. * * @NL80211_CMD_REMAIN_ON_CHANNEL: Request to remain awake on the specified * channel for the specified amount of time. This can be used to do * off-channel operations like transmit a Public Action frame and wait for * a response while being associated to an AP on another channel. * %NL80211_ATTR_IFINDEX is used to specify which interface (and thus * radio) is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the * frequency for the operation. * %NL80211_ATTR_DURATION is used to specify the duration in milliseconds * to remain on the channel. This command is also used as an event to * notify when the requested duration starts (it may take a while for the * driver to schedule this time due to other concurrent needs for the * radio). * When called, this operation returns a cookie (%NL80211_ATTR_COOKIE) * that will be included with any events pertaining to this request; * the cookie is also used to cancel the request. * @NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL: This command can be used to cancel a * pending remain-on-channel duration if the desired operation has been * completed prior to expiration of the originally requested duration. * %NL80211_ATTR_WIPHY or %NL80211_ATTR_IFINDEX is used to specify the * radio. The %NL80211_ATTR_COOKIE attribute must be given as well to * uniquely identify the request. * This command is also used as an event to notify when a requested * remain-on-channel duration has expired. * * @NL80211_CMD_SET_TX_BITRATE_MASK: Set the mask of rates to be used in TX * rate selection. %NL80211_ATTR_IFINDEX is used to specify the interface * and @NL80211_ATTR_TX_RATES the set of allowed rates. * * @NL80211_CMD_REGISTER_FRAME: Register for receiving certain mgmt frames * (via @NL80211_CMD_FRAME) for processing in userspace. This command * requires an interface index, a frame type attribute (optional for * backward compatibility reasons, if not given assumes action frames) * and a match attribute containing the first few bytes of the frame * that should match, e.g. a single byte for only a category match or * four bytes for vendor frames including the OUI. The registration * cannot be dropped, but is removed automatically when the netlink * socket is closed. Multiple registrations can be made. * @NL80211_CMD_REGISTER_ACTION: Alias for @NL80211_CMD_REGISTER_FRAME for * backward compatibility * @NL80211_CMD_FRAME: Management frame TX request and RX notification. This * command is used both as a request to transmit a management frame and * as an event indicating reception of a frame that was not processed in * kernel code, but is for us (i.e., which may need to be processed in a * user space application). %NL80211_ATTR_FRAME is used to specify the * frame contents (including header). %NL80211_ATTR_WIPHY_FREQ is used * to indicate on which channel the frame is to be transmitted or was * received. If this channel is not the current channel (remain-on-channel * or the operational channel) the device will switch to the given channel * and transmit the frame, optionally waiting for a response for the time * specified using %NL80211_ATTR_DURATION. When called, this operation * returns a cookie (%NL80211_ATTR_COOKIE) that will be included with the * TX status event pertaining to the TX request. * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the * management frames at CCK rate or not in 2GHz band. * %NL80211_ATTR_CSA_C_OFFSETS_TX is an array of offsets to CSA * counters which will be updated to the current value. This attribute * is used during CSA period. * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this * command may be used with the corresponding cookie to cancel the wait * time if it is known that it is no longer necessary. * @NL80211_CMD_ACTION: Alias for @NL80211_CMD_FRAME for backward compatibility. * @NL80211_CMD_FRAME_TX_STATUS: Report TX status of a management frame * transmitted with %NL80211_CMD_FRAME. %NL80211_ATTR_COOKIE identifies * the TX command and %NL80211_ATTR_FRAME includes the contents of the * frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged * the frame. * @NL80211_CMD_ACTION_TX_STATUS: Alias for @NL80211_CMD_FRAME_TX_STATUS for * backward compatibility. * * @NL80211_CMD_SET_POWER_SAVE: Set powersave, using %NL80211_ATTR_PS_STATE * @NL80211_CMD_GET_POWER_SAVE: Get powersave status in %NL80211_ATTR_PS_STATE * * @NL80211_CMD_SET_CQM: Connection quality monitor configuration. This command * is used to configure connection quality monitoring notification trigger * levels. * @NL80211_CMD_NOTIFY_CQM: Connection quality monitor notification. This * command is used as an event to indicate the that a trigger level was * reached. * @NL80211_CMD_SET_CHANNEL: Set the channel (using %NL80211_ATTR_WIPHY_FREQ * and the attributes determining channel width) the given interface * (identifed by %NL80211_ATTR_IFINDEX) shall operate on. * In case multiple channels are supported by the device, the mechanism * with which it switches channels is implementation-defined. * When a monitor interface is given, it can only switch channel while * no other interfaces are operating to avoid disturbing the operation * of any other interfaces, and other interfaces will again take * precedence when they are used. * * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface. * * @NL80211_CMD_SET_MULTICAST_TO_UNICAST: Configure if this AP should perform * multicast to unicast conversion. When enabled, all multicast packets * with ethertype ARP, IPv4 or IPv6 (possibly within an 802.1Q header) * will be sent out to each station once with the destination (multicast) * MAC address replaced by the station's MAC address. Note that this may * break certain expectations of the receiver, e.g. the ability to drop * unicast IP packets encapsulated in multicast L2 frames, or the ability * to not send destination unreachable messages in such cases. * This can only be toggled per BSS. Configure this on an interface of * type %NL80211_IFTYPE_AP. It applies to all its VLAN interfaces * (%NL80211_IFTYPE_AP_VLAN), except for those in 4addr (WDS) mode. * If %NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED is not present with this * command, the feature is disabled. * * @NL80211_CMD_JOIN_MESH: Join a mesh. The mesh ID must be given, and initial * mesh config parameters may be given. * @NL80211_CMD_LEAVE_MESH: Leave the mesh network -- no special arguments, the * network is determined by the network interface. * * @NL80211_CMD_UNPROT_DEAUTHENTICATE: Unprotected deauthentication frame * notification. This event is used to indicate that an unprotected * deauthentication frame was dropped when MFP is in use. * @NL80211_CMD_UNPROT_DISASSOCIATE: Unprotected disassociation frame * notification. This event is used to indicate that an unprotected * disassociation frame was dropped when MFP is in use. * * @NL80211_CMD_NEW_PEER_CANDIDATE: Notification on the reception of a * beacon or probe response from a compatible mesh peer. This is only * sent while no station information (sta_info) exists for the new peer * candidate and when @NL80211_MESH_SETUP_USERSPACE_AUTH, * @NL80211_MESH_SETUP_USERSPACE_AMPE, or * @NL80211_MESH_SETUP_USERSPACE_MPM is set. On reception of this * notification, userspace may decide to create a new station * (@NL80211_CMD_NEW_STATION). To stop this notification from * reoccurring, the userspace authentication daemon may want to create the * new station with the AUTHENTICATED flag unset and maybe change it later * depending on the authentication result. * * @NL80211_CMD_GET_WOWLAN: get Wake-on-Wireless-LAN (WoWLAN) settings. * @NL80211_CMD_SET_WOWLAN: set Wake-on-Wireless-LAN (WoWLAN) settings. * Since wireless is more complex than wired ethernet, it supports * various triggers. These triggers can be configured through this * command with the %NL80211_ATTR_WOWLAN_TRIGGERS attribute. For * more background information, see * http://wireless.kernel.org/en/users/Documentation/WoWLAN. * The @NL80211_CMD_SET_WOWLAN command can also be used as a notification * from the driver reporting the wakeup reason. In this case, the * @NL80211_ATTR_WOWLAN_TRIGGERS attribute will contain the reason * for the wakeup, if it was caused by wireless. If it is not present * in the wakeup notification, the wireless device didn't cause the * wakeup but reports that it was woken up. * * @NL80211_CMD_SET_REKEY_OFFLOAD: This command is used give the driver * the necessary information for supporting GTK rekey offload. This * feature is typically used during WoWLAN. The configuration data * is contained in %NL80211_ATTR_REKEY_DATA (which is nested and * contains the data in sub-attributes). After rekeying happened, * this command may also be sent by the driver as an MLME event to * inform userspace of the new replay counter. * * @NL80211_CMD_PMKSA_CANDIDATE: This is used as an event to inform userspace * of PMKSA caching dandidates. * * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup). * In addition, this can be used as an event to request userspace to take * actions on TDLS links (set up a new link or tear down an existing one). * In such events, %NL80211_ATTR_TDLS_OPERATION indicates the requested * operation, %NL80211_ATTR_MAC contains the peer MAC address, and * %NL80211_ATTR_REASON_CODE the reason code to be used (only with * %NL80211_TDLS_TEARDOWN). * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame. The * %NL80211_ATTR_TDLS_ACTION attribute determines the type of frame to be * sent. Public Action codes (802.11-2012 8.1.5.1) will be sent as * 802.11 management frames, while TDLS action codes (802.11-2012 * 8.5.13.1) will be encapsulated and sent as data frames. The currently * supported Public Action code is %WLAN_PUB_ACTION_TDLS_DISCOVER_RES * and the currently supported TDLS actions codes are given in * &enum ieee80211_tdls_actioncode. * * @NL80211_CMD_UNEXPECTED_FRAME: Used by an application controlling an AP * (or GO) interface (i.e. hostapd) to ask for unexpected frames to * implement sending deauth to stations that send unexpected class 3 * frames. Also used as the event sent by the kernel when such a frame * is received. * For the event, the %NL80211_ATTR_MAC attribute carries the TA and * other attributes like the interface index are present. * If used as the command it must have an interface index and you can * only unsubscribe from the event by closing the socket. Subscription * is also for %NL80211_CMD_UNEXPECTED_4ADDR_FRAME events. * * @NL80211_CMD_UNEXPECTED_4ADDR_FRAME: Sent as an event indicating that the * associated station identified by %NL80211_ATTR_MAC sent a 4addr frame * and wasn't already in a 4-addr VLAN. The event will be sent similarly * to the %NL80211_CMD_UNEXPECTED_FRAME event, to the same listener. * * @NL80211_CMD_PROBE_CLIENT: Probe an associated station on an AP interface * by sending a null data frame to it and reporting when the frame is * acknowleged. This is used to allow timing out inactive clients. Uses * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_MAC. The command returns a * direct reply with an %NL80211_ATTR_COOKIE that is later used to match * up the event with the request. The event includes the same data and * has %NL80211_ATTR_ACK set if the frame was ACKed. * * @NL80211_CMD_REGISTER_BEACONS: Register this socket to receive beacons from * other BSSes when any interfaces are in AP mode. This helps implement * OLBC handling in hostapd. Beacons are reported in %NL80211_CMD_FRAME * messages. Note that per PHY only one application may register. * * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether * No Acknowledgement Policy should be applied. * * @NL80211_CMD_CH_SWITCH_NOTIFY: An AP or GO may decide to switch channels * independently of the userspace SME, send this event indicating * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ and the * attributes determining channel width. This indication may also be * sent when a remotely-initiated switch (e.g., when a STA receives a CSA * from the remote AP) is completed; * * @NL80211_CMD_CH_SWITCH_STARTED_NOTIFY: Notify that a channel switch * has been started on an interface, regardless of the initiator * (ie. whether it was requested from a remote device or * initiated on our own). It indicates that * %NL80211_ATTR_IFINDEX will be on %NL80211_ATTR_WIPHY_FREQ * after %NL80211_ATTR_CH_SWITCH_COUNT TBTT's. The userspace may * decide to react to this indication by requesting other * interfaces to change channel as well. * * @NL80211_CMD_START_P2P_DEVICE: Start the given P2P Device, identified by * its %NL80211_ATTR_WDEV identifier. It must have been created with * %NL80211_CMD_NEW_INTERFACE previously. After it has been started, the * P2P Device can be used for P2P operations, e.g. remain-on-channel and * public action frame TX. * @NL80211_CMD_STOP_P2P_DEVICE: Stop the given P2P Device, identified by * its %NL80211_ATTR_WDEV identifier. * * @NL80211_CMD_CONN_FAILED: connection request to an AP failed; used to * notify userspace that AP has rejected the connection request from a * station, due to particular reason. %NL80211_ATTR_CONN_FAILED_REASON * is used for this. * * @NL80211_CMD_SET_MCAST_RATE: Change the rate used to send multicast frames * for IBSS or MESH vif. * * @NL80211_CMD_SET_MAC_ACL: sets ACL for MAC address based access control. * This is to be used with the drivers advertising the support of MAC * address based access control. List of MAC addresses is passed in * %NL80211_ATTR_MAC_ADDRS and ACL policy is passed in * %NL80211_ATTR_ACL_POLICY. Driver will enable ACL with this list, if it * is not already done. The new list will replace any existing list. Driver * will clear its ACL when the list of MAC addresses passed is empty. This * command is used in AP/P2P GO mode. Driver has to make sure to clear its * ACL list during %NL80211_CMD_STOP_AP. * * @NL80211_CMD_RADAR_DETECT: Start a Channel availability check (CAC). Once * a radar is detected or the channel availability scan (CAC) has finished * or was aborted, or a radar was detected, usermode will be notified with * this event. This command is also used to notify userspace about radars * while operating on this channel. * %NL80211_ATTR_RADAR_EVENT is used to inform about the type of the * event. * * @NL80211_CMD_GET_PROTOCOL_FEATURES: Get global nl80211 protocol features, * i.e. features for the nl80211 protocol rather than device features. * Returns the features in the %NL80211_ATTR_PROTOCOL_FEATURES bitmap. * * @NL80211_CMD_UPDATE_FT_IES: Pass down the most up-to-date Fast Transition * Information Element to the WLAN driver * * @NL80211_CMD_FT_EVENT: Send a Fast transition event from the WLAN driver * to the supplicant. This will carry the target AP's MAC address along * with the relevant Information Elements. This event is used to report * received FT IEs (MDIE, FTIE, RSN IE, TIE, RICIE). * * @NL80211_CMD_CRIT_PROTOCOL_START: Indicates user-space will start running * a critical protocol that needs more reliability in the connection to * complete. * * @NL80211_CMD_CRIT_PROTOCOL_STOP: Indicates the connection reliability can * return back to normal. * * @NL80211_CMD_GET_COALESCE: Get currently supported coalesce rules. * @NL80211_CMD_SET_COALESCE: Configure coalesce rules or clear existing rules. * * @NL80211_CMD_CHANNEL_SWITCH: Perform a channel switch by announcing the * the new channel information (Channel Switch Announcement - CSA) * in the beacon for some time (as defined in the * %NL80211_ATTR_CH_SWITCH_COUNT parameter) and then change to the * new channel. Userspace provides the new channel information (using * %NL80211_ATTR_WIPHY_FREQ and the attributes determining channel * width). %NL80211_ATTR_CH_SWITCH_BLOCK_TX may be supplied to inform * other station that transmission must be blocked until the channel * switch is complete. * * @NL80211_CMD_VENDOR: Vendor-specified command/event. The command is specified * by the %NL80211_ATTR_VENDOR_ID attribute and a sub-command in * %NL80211_ATTR_VENDOR_SUBCMD. Parameter(s) can be transported in * %NL80211_ATTR_VENDOR_DATA. * For feature advertisement, the %NL80211_ATTR_VENDOR_DATA attribute is * used in the wiphy data as a nested attribute containing descriptions * (&struct nl80211_vendor_cmd_info) of the supported vendor commands. * This may also be sent as an event with the same attributes. * * @NL80211_CMD_SET_QOS_MAP: Set Interworking QoS mapping for IP DSCP values. * The QoS mapping information is included in %NL80211_ATTR_QOS_MAP. If * that attribute is not included, QoS mapping is disabled. Since this * QoS mapping is relevant for IP packets, it is only valid during an * association. This is cleared on disassociation and AP restart. * * @NL80211_CMD_ADD_TX_TS: Ask the kernel to add a traffic stream for the given * %NL80211_ATTR_TSID and %NL80211_ATTR_MAC with %NL80211_ATTR_USER_PRIO * and %NL80211_ATTR_ADMITTED_TIME parameters. * Note that the action frame handshake with the AP shall be handled by * userspace via the normal management RX/TX framework, this only sets * up the TX TS in the driver/device. * If the admitted time attribute is not added then the request just checks * if a subsequent setup could be successful, the intent is to use this to * avoid setting up a session with the AP when local restrictions would * make that impossible. However, the subsequent "real" setup may still * fail even if the check was successful. * @NL80211_CMD_DEL_TX_TS: Remove an existing TS with the %NL80211_ATTR_TSID * and %NL80211_ATTR_MAC parameters. It isn't necessary to call this * before removing a station entry entirely, or before disassociating * or similar, cleanup will happen in the driver/device in this case. * * @NL80211_CMD_GET_MPP: Get mesh path attributes for mesh proxy path to * destination %NL80211_ATTR_MAC on the interface identified by * %NL80211_ATTR_IFINDEX. * * @NL80211_CMD_JOIN_OCB: Join the OCB network. The center frequency and * bandwidth of a channel must be given. * @NL80211_CMD_LEAVE_OCB: Leave the OCB network -- no special arguments, the * network is determined by the network interface. * * @NL80211_CMD_TDLS_CHANNEL_SWITCH: Start channel-switching with a TDLS peer, * identified by the %NL80211_ATTR_MAC parameter. A target channel is * provided via %NL80211_ATTR_WIPHY_FREQ and other attributes determining * channel width/type. The target operating class is given via * %NL80211_ATTR_OPER_CLASS. * The driver is responsible for continually initiating channel-switching * operations and returning to the base channel for communication with the * AP. * @NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH: Stop channel-switching with a TDLS * peer given by %NL80211_ATTR_MAC. Both peers must be on the base channel * when this command completes. * * @NL80211_CMD_WIPHY_REG_CHANGE: Similar to %NL80211_CMD_REG_CHANGE, but used * as an event to indicate changes for devices with wiphy-specific regdom * management. * * @NL80211_CMD_ABORT_SCAN: Stop an ongoing scan. Returns -ENOENT if a scan is * not running. The driver indicates the status of the scan through * cfg80211_scan_done(). * * @NL80211_CMD_START_NAN: Start NAN operation, identified by its * %NL80211_ATTR_WDEV interface. This interface must have been * previously created with %NL80211_CMD_NEW_INTERFACE. After it * has been started, the NAN interface will create or join a * cluster. This command must have a valid * %NL80211_ATTR_NAN_MASTER_PREF attribute and optional * %NL80211_ATTR_BANDS attributes. If %NL80211_ATTR_BANDS is * omitted or set to 0, it means don't-care and the device will * decide what to use. After this command NAN functions can be * added. * @NL80211_CMD_STOP_NAN: Stop the NAN operation, identified by * its %NL80211_ATTR_WDEV interface. * @NL80211_CMD_ADD_NAN_FUNCTION: Add a NAN function. The function is defined * with %NL80211_ATTR_NAN_FUNC nested attribute. When called, this * operation returns the strictly positive and unique instance id * (%NL80211_ATTR_NAN_FUNC_INST_ID) and a cookie (%NL80211_ATTR_COOKIE) * of the function upon success. * Since instance ID's can be re-used, this cookie is the right * way to identify the function. This will avoid races when a termination * event is handled by the user space after it has already added a new * function that got the same instance id from the kernel as the one * which just terminated. * This cookie may be used in NAN events even before the command * returns, so userspace shouldn't process NAN events until it processes * the response to this command. * Look at %NL80211_ATTR_SOCKET_OWNER as well. * @NL80211_CMD_DEL_NAN_FUNCTION: Delete a NAN function by cookie. * This command is also used as a notification sent when a NAN function is * terminated. This will contain a %NL80211_ATTR_NAN_FUNC_INST_ID * and %NL80211_ATTR_COOKIE attributes. * @NL80211_CMD_CHANGE_NAN_CONFIG: Change current NAN * configuration. NAN must be operational (%NL80211_CMD_START_NAN * was executed). It must contain at least one of the following * attributes: %NL80211_ATTR_NAN_MASTER_PREF, * %NL80211_ATTR_BANDS. If %NL80211_ATTR_BANDS is omitted, the * current configuration is not changed. If it is present but * set to zero, the configuration is changed to don't-care * (i.e. the device can decide what to do). * @NL80211_CMD_NAN_FUNC_MATCH: Notification sent when a match is reported. * This will contain a %NL80211_ATTR_NAN_MATCH nested attribute and * %NL80211_ATTR_COOKIE. * * @NL80211_CMD_UPDATE_CONNECT_PARAMS: Update one or more connect parameters * for subsequent roaming cases if the driver or firmware uses internal * BSS selection. This command can be issued only while connected and it * does not result in a change for the current association. Currently, * only the %NL80211_ATTR_IE data is used and updated with this command. * * @NL80211_CMD_SET_PMK: For offloaded 4-Way handshake, set the PMK or PMK-R0 * for the given authenticator address (specified with %NL80211_ATTR_MAC). * When %NL80211_ATTR_PMKR0_NAME is set, %NL80211_ATTR_PMK specifies the * PMK-R0, otherwise it specifies the PMK. * @NL80211_CMD_DEL_PMK: For offloaded 4-Way handshake, delete the previously * configured PMK for the authenticator address identified by * %NL80211_ATTR_MAC. * @NL80211_CMD_PORT_AUTHORIZED: An event that indicates that the 4 way * handshake was completed successfully by the driver. The BSSID is * specified with %NL80211_ATTR_MAC. Drivers that support 4 way handshake * offload should send this event after indicating 802.11 association with * %NL80211_CMD_CONNECT or %NL80211_CMD_ROAM. If the 4 way handshake failed * %NL80211_CMD_DISCONNECT should be indicated instead. * * @NL80211_CMD_CONTROL_PORT_FRAME: Control Port (e.g. PAE) frame TX request * and RX notification. This command is used both as a request to transmit * a control port frame and as a notification that a control port frame * has been received. %NL80211_ATTR_FRAME is used to specify the * frame contents. The frame is the raw EAPoL data, without ethernet or * 802.11 headers. * When used as an event indication %NL80211_ATTR_CONTROL_PORT_ETHERTYPE, * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT and %NL80211_ATTR_MAC are added * indicating the protocol type of the received frame; whether the frame * was received unencrypted and the MAC address of the peer respectively. * * @NL80211_CMD_RELOAD_REGDB: Request that the regdb firmware file is reloaded. * * @NL80211_CMD_EXTERNAL_AUTH: This interface is exclusively defined for host * drivers that do not define separate commands for authentication and * association, but rely on user space for the authentication to happen. * This interface acts both as the event request (driver to user space) * to trigger the authentication and command response (userspace to * driver) to indicate the authentication status. * * User space uses the %NL80211_CMD_CONNECT command to the host driver to * trigger a connection. The host driver selects a BSS and further uses * this interface to offload only the authentication part to the user * space. Authentication frames are passed between the driver and user * space through the %NL80211_CMD_FRAME interface. Host driver proceeds * further with the association after getting successful authentication * status. User space indicates the authentication status through * %NL80211_ATTR_STATUS_CODE attribute in %NL80211_CMD_EXTERNAL_AUTH * command interface. * * Host driver reports this status on an authentication failure to the * user space through the connect result as the user space would have * initiated the connection through the connect request. * * @NL80211_CMD_STA_OPMODE_CHANGED: An event that notify station's * ht opmode or vht opmode changes using any of %NL80211_ATTR_SMPS_MODE, * %NL80211_ATTR_CHANNEL_WIDTH,%NL80211_ATTR_NSS attributes with its * address(specified in %NL80211_ATTR_MAC). * * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */ enum nl80211_commands { /* don't change the order or add anything between, this is ABI! */ NL80211_CMD_UNSPEC, NL80211_CMD_GET_WIPHY, /* can dump */ NL80211_CMD_SET_WIPHY, NL80211_CMD_NEW_WIPHY, NL80211_CMD_DEL_WIPHY, NL80211_CMD_GET_INTERFACE, /* can dump */ NL80211_CMD_SET_INTERFACE, NL80211_CMD_NEW_INTERFACE, NL80211_CMD_DEL_INTERFACE, NL80211_CMD_GET_KEY, NL80211_CMD_SET_KEY, NL80211_CMD_NEW_KEY, NL80211_CMD_DEL_KEY, NL80211_CMD_GET_BEACON, NL80211_CMD_SET_BEACON, NL80211_CMD_START_AP, NL80211_CMD_NEW_BEACON = NL80211_CMD_START_AP, NL80211_CMD_STOP_AP, NL80211_CMD_DEL_BEACON = NL80211_CMD_STOP_AP, NL80211_CMD_GET_STATION, NL80211_CMD_SET_STATION, NL80211_CMD_NEW_STATION, NL80211_CMD_DEL_STATION, NL80211_CMD_GET_MPATH, NL80211_CMD_SET_MPATH, NL80211_CMD_NEW_MPATH, NL80211_CMD_DEL_MPATH, NL80211_CMD_SET_BSS, NL80211_CMD_SET_REG, NL80211_CMD_REQ_SET_REG, NL80211_CMD_GET_MESH_CONFIG, NL80211_CMD_SET_MESH_CONFIG, NL80211_CMD_SET_MGMT_EXTRA_IE /* reserved; not used */, NL80211_CMD_GET_REG, NL80211_CMD_GET_SCAN, NL80211_CMD_TRIGGER_SCAN, NL80211_CMD_NEW_SCAN_RESULTS, NL80211_CMD_SCAN_ABORTED, NL80211_CMD_REG_CHANGE, NL80211_CMD_AUTHENTICATE, NL80211_CMD_ASSOCIATE, NL80211_CMD_DEAUTHENTICATE, NL80211_CMD_DISASSOCIATE, NL80211_CMD_MICHAEL_MIC_FAILURE, NL80211_CMD_REG_BEACON_HINT, NL80211_CMD_JOIN_IBSS, NL80211_CMD_LEAVE_IBSS, NL80211_CMD_TESTMODE, NL80211_CMD_CONNECT, NL80211_CMD_ROAM, NL80211_CMD_DISCONNECT, NL80211_CMD_SET_WIPHY_NETNS, NL80211_CMD_GET_SURVEY, NL80211_CMD_NEW_SURVEY_RESULTS, NL80211_CMD_SET_PMKSA, NL80211_CMD_DEL_PMKSA, NL80211_CMD_FLUSH_PMKSA, NL80211_CMD_REMAIN_ON_CHANNEL, NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL, NL80211_CMD_SET_TX_BITRATE_MASK, NL80211_CMD_REGISTER_FRAME, NL80211_CMD_REGISTER_ACTION = NL80211_CMD_REGISTER_FRAME, NL80211_CMD_FRAME, NL80211_CMD_ACTION = NL80211_CMD_FRAME, NL80211_CMD_FRAME_TX_STATUS, NL80211_CMD_ACTION_TX_STATUS = NL80211_CMD_FRAME_TX_STATUS, NL80211_CMD_SET_POWER_SAVE, NL80211_CMD_GET_POWER_SAVE, NL80211_CMD_SET_CQM, NL80211_CMD_NOTIFY_CQM, NL80211_CMD_SET_CHANNEL, NL80211_CMD_SET_WDS_PEER, NL80211_CMD_FRAME_WAIT_CANCEL, NL80211_CMD_JOIN_MESH, NL80211_CMD_LEAVE_MESH, NL80211_CMD_UNPROT_DEAUTHENTICATE, NL80211_CMD_UNPROT_DISASSOCIATE, NL80211_CMD_NEW_PEER_CANDIDATE, NL80211_CMD_GET_WOWLAN, NL80211_CMD_SET_WOWLAN, NL80211_CMD_START_SCHED_SCAN, NL80211_CMD_STOP_SCHED_SCAN, NL80211_CMD_SCHED_SCAN_RESULTS, NL80211_CMD_SCHED_SCAN_STOPPED, NL80211_CMD_SET_REKEY_OFFLOAD, NL80211_CMD_PMKSA_CANDIDATE, NL80211_CMD_TDLS_OPER, NL80211_CMD_TDLS_MGMT, NL80211_CMD_UNEXPECTED_FRAME, NL80211_CMD_PROBE_CLIENT, NL80211_CMD_REGISTER_BEACONS, NL80211_CMD_UNEXPECTED_4ADDR_FRAME, NL80211_CMD_SET_NOACK_MAP, NL80211_CMD_CH_SWITCH_NOTIFY, NL80211_CMD_START_P2P_DEVICE, NL80211_CMD_STOP_P2P_DEVICE, NL80211_CMD_CONN_FAILED, NL80211_CMD_SET_MCAST_RATE, NL80211_CMD_SET_MAC_ACL, NL80211_CMD_RADAR_DETECT, NL80211_CMD_GET_PROTOCOL_FEATURES, NL80211_CMD_UPDATE_FT_IES, NL80211_CMD_FT_EVENT, NL80211_CMD_CRIT_PROTOCOL_START, NL80211_CMD_CRIT_PROTOCOL_STOP, NL80211_CMD_GET_COALESCE, NL80211_CMD_SET_COALESCE, NL80211_CMD_CHANNEL_SWITCH, NL80211_CMD_VENDOR, NL80211_CMD_SET_QOS_MAP, NL80211_CMD_ADD_TX_TS, NL80211_CMD_DEL_TX_TS, NL80211_CMD_GET_MPP, NL80211_CMD_JOIN_OCB, NL80211_CMD_LEAVE_OCB, NL80211_CMD_CH_SWITCH_STARTED_NOTIFY, NL80211_CMD_TDLS_CHANNEL_SWITCH, NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH, NL80211_CMD_WIPHY_REG_CHANGE, NL80211_CMD_ABORT_SCAN, NL80211_CMD_START_NAN, NL80211_CMD_STOP_NAN, NL80211_CMD_ADD_NAN_FUNCTION, NL80211_CMD_DEL_NAN_FUNCTION, NL80211_CMD_CHANGE_NAN_CONFIG, NL80211_CMD_NAN_MATCH, NL80211_CMD_SET_MULTICAST_TO_UNICAST, NL80211_CMD_UPDATE_CONNECT_PARAMS, NL80211_CMD_SET_PMK, NL80211_CMD_DEL_PMK, NL80211_CMD_PORT_AUTHORIZED, NL80211_CMD_RELOAD_REGDB, NL80211_CMD_EXTERNAL_AUTH, NL80211_CMD_STA_OPMODE_CHANGED, NL80211_CMD_CONTROL_PORT_FRAME, /* add new commands above here */ /* used to define NL80211_CMD_MAX below */ __NL80211_CMD_AFTER_LAST, NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 }; /* * Allow user space programs to use #ifdef on new commands by defining them * here */ #define NL80211_CMD_SET_BSS NL80211_CMD_SET_BSS #define NL80211_CMD_SET_MGMT_EXTRA_IE NL80211_CMD_SET_MGMT_EXTRA_IE #define NL80211_CMD_REG_CHANGE NL80211_CMD_REG_CHANGE #define NL80211_CMD_AUTHENTICATE NL80211_CMD_AUTHENTICATE #define NL80211_CMD_ASSOCIATE NL80211_CMD_ASSOCIATE #define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE #define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE #define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT #define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS /* source-level API compatibility */ #define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG #define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG #define NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE NL80211_MESH_SETUP_IE /** * enum nl80211_attrs - nl80211 netlink attributes * * @NL80211_ATTR_UNSPEC: unspecified attribute to catch errors * * @NL80211_ATTR_WIPHY: index of wiphy to operate on, cf. * /sys/class/ieee80211/<phyname>/index * @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming) * @NL80211_ATTR_WIPHY_TXQ_PARAMS: a nested array of TX queue parameters * @NL80211_ATTR_WIPHY_FREQ: frequency of the selected channel in MHz, * defines the channel together with the (deprecated) * %NL80211_ATTR_WIPHY_CHANNEL_TYPE attribute or the attributes * %NL80211_ATTR_CHANNEL_WIDTH and if needed %NL80211_ATTR_CENTER_FREQ1 * and %NL80211_ATTR_CENTER_FREQ2 * @NL80211_ATTR_CHANNEL_WIDTH: u32 attribute containing one of the values * of &enum nl80211_chan_width, describing the channel width. See the * documentation of the enum for more information. * @NL80211_ATTR_CENTER_FREQ1: Center frequency of the first part of the * channel, used for anything but 20 MHz bandwidth * @NL80211_ATTR_CENTER_FREQ2: Center frequency of the second part of the * channel, used only for 80+80 MHz bandwidth * @NL80211_ATTR_WIPHY_CHANNEL_TYPE: included with NL80211_ATTR_WIPHY_FREQ * if HT20 or HT40 are to be used (i.e., HT disabled if not included): * NL80211_CHAN_NO_HT = HT not allowed (i.e., same as not including * this attribute) * NL80211_CHAN_HT20 = HT20 only * NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel * NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel * This attribute is now deprecated. * @NL80211_ATTR_WIPHY_RETRY_SHORT: TX retry limit for frames whose length is * less than or equal to the RTS threshold; allowed range: 1..255; * dot11ShortRetryLimit; u8 * @NL80211_ATTR_WIPHY_RETRY_LONG: TX retry limit for frames whose length is * greater than the RTS threshold; allowed range: 1..255; * dot11ShortLongLimit; u8 * @NL80211_ATTR_WIPHY_FRAG_THRESHOLD: fragmentation threshold, i.e., maximum * length in octets for frames; allowed range: 256..8000, disable * fragmentation with (u32)-1; dot11FragmentationThreshold; u32 * @NL80211_ATTR_WIPHY_RTS_THRESHOLD: RTS threshold (TX frames with length * larger than or equal to this use RTS/CTS handshake); allowed range: * 0..65536, disable with (u32)-1; dot11RTSThreshold; u32 * @NL80211_ATTR_WIPHY_COVERAGE_CLASS: Coverage Class as defined by IEEE 802.11 * section 7.3.2.9; dot11CoverageClass; u8 * * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on * @NL80211_ATTR_IFNAME: network interface name * @NL80211_ATTR_IFTYPE: type of virtual interface, see &enum nl80211_iftype * * @NL80211_ATTR_WDEV: wireless device identifier, used for pseudo-devices * that don't have a netdev (u64) * * @NL80211_ATTR_MAC: MAC address (various uses) * * @NL80211_ATTR_KEY_DATA: (temporal) key data; for TKIP this consists of * 16 bytes encryption key followed by 8 bytes each for TX and RX MIC * keys * @NL80211_ATTR_KEY_IDX: key ID (u8, 0-3) * @NL80211_ATTR_KEY_CIPHER: key cipher suite (u32, as defined by IEEE 802.11 * section 7.3.2.25.1, e.g. 0x000FAC04) * @NL80211_ATTR_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and * CCMP keys, each six bytes in little endian * @NL80211_ATTR_KEY_DEFAULT: Flag attribute indicating the key is default key * @NL80211_ATTR_KEY_DEFAULT_MGMT: Flag attribute indicating the key is the * default management key * @NL80211_ATTR_CIPHER_SUITES_PAIRWISE: For crypto settings for connect or * other commands, indicates which pairwise cipher suites are used * @NL80211_ATTR_CIPHER_SUITE_GROUP: For crypto settings for connect or * other commands, indicates which group cipher suite is used * * @NL80211_ATTR_BEACON_INTERVAL: beacon interval in TU * @NL80211_ATTR_DTIM_PERIOD: DTIM period for beaconing * @NL80211_ATTR_BEACON_HEAD: portion of the beacon before the TIM IE * @NL80211_ATTR_BEACON_TAIL: portion of the beacon after the TIM IE * * @NL80211_ATTR_STA_AID: Association ID for the station (u16) * @NL80211_ATTR_STA_FLAGS: flags, nested element with NLA_FLAG attributes of * &enum nl80211_sta_flags (deprecated, use %NL80211_ATTR_STA_FLAGS2) * @NL80211_ATTR_STA_LISTEN_INTERVAL: listen interval as defined by * IEEE 802.11 7.3.1.6 (u16). * @NL80211_ATTR_STA_SUPPORTED_RATES: supported rates, array of supported * rates as defined by IEEE 802.11 7.3.2.2 but without the length * restriction (at most %NL80211_MAX_SUPP_RATES). * @NL80211_ATTR_STA_VLAN: interface index of VLAN interface to move station * to, or the AP interface the station was originally added to to. * @NL80211_ATTR_STA_INFO: information about a station, part of station info * given for %NL80211_CMD_GET_STATION, nested attribute containing * info as possible, see &enum nl80211_sta_info. * * @NL80211_ATTR_WIPHY_BANDS: Information about an operating bands, * consisting of a nested array. * * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes). * @NL80211_ATTR_STA_PLINK_ACTION: action to perform on the mesh peer link * (see &enum nl80211_plink_action). * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path. * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path * info given for %NL80211_CMD_GET_MPATH, nested attribute described at * &enum nl80211_mpath_info. * * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of * &enum nl80211_mntr_flags. * * @NL80211_ATTR_REG_ALPHA2: an ISO-3166-alpha2 country code for which the * current regulatory domain should be set to or is already set to. * For example, 'CR', for Costa Rica. This attribute is used by the kernel * to query the CRDA to retrieve one regulatory domain. This attribute can * also be used by userspace to query the kernel for the currently set * regulatory domain. We chose an alpha2 as that is also used by the * IEEE-802.11 country information element to identify a country. * Users can also simply ask the wireless core to set regulatory domain * to a specific alpha2. * @NL80211_ATTR_REG_RULES: a nested array of regulatory domain regulatory * rules. * * @NL80211_ATTR_BSS_CTS_PROT: whether CTS protection is enabled (u8, 0 or 1) * @NL80211_ATTR_BSS_SHORT_PREAMBLE: whether short preamble is enabled * (u8, 0 or 1) * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled * (u8, 0 or 1) * @NL80211_ATTR_BSS_BASIC_RATES: basic rates, array of basic * rates in format defined by IEEE 802.11 7.3.2.2 but without the length * restriction (at most %NL80211_MAX_SUPP_RATES). * * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from * association request when used with NL80211_CMD_NEW_STATION) * * @NL80211_ATTR_SUPPORTED_IFTYPES: nested attribute containing all * supported interface types, each a flag attribute with the number * of the interface mode. * * @NL80211_ATTR_MGMT_SUBTYPE: Management frame subtype for * %NL80211_CMD_SET_MGMT_EXTRA_IE. * * @NL80211_ATTR_IE: Information element(s) data (used, e.g., with * %NL80211_CMD_SET_MGMT_EXTRA_IE). * * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with * a single scan request, a wiphy attribute. * @NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS: number of SSIDs you can * scan with a single scheduled scan request, a wiphy attribute. * @NL80211_ATTR_MAX_SCAN_IE_LEN: maximum length of information elements * that can be added to a scan request * @NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN: maximum length of information * elements that can be added to a scheduled scan request * @NL80211_ATTR_MAX_MATCH_SETS: maximum number of sets that can be * used with @NL80211_ATTR_SCHED_SCAN_MATCH, a wiphy attribute. * * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz) * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive * scanning and include a zero-length SSID (wildcard) for wildcard scan * @NL80211_ATTR_BSS: scan result BSS * * @NL80211_ATTR_REG_INITIATOR: indicates who requested the regulatory domain * currently in effect. This could be any of the %NL80211_REGDOM_SET_BY_* * @NL80211_ATTR_REG_TYPE: indicates the type of the regulatory domain currently * set. This can be one of the nl80211_reg_type (%NL80211_REGDOM_TYPE_*) * * @NL80211_ATTR_SUPPORTED_COMMANDS: wiphy attribute that specifies * an array of command numbers (i.e. a mapping index to command number) * that the driver for the given wiphy supports. * * @NL80211_ATTR_FRAME: frame data (binary attribute), including frame header * and body, but not FCS; used, e.g., with NL80211_CMD_AUTHENTICATE and * NL80211_CMD_ASSOCIATE events * @NL80211_ATTR_SSID: SSID (binary attribute, 0..32 octets) * @NL80211_ATTR_AUTH_TYPE: AuthenticationType, see &enum nl80211_auth_type, * represented as a u32 * @NL80211_ATTR_REASON_CODE: ReasonCode for %NL80211_CMD_DEAUTHENTICATE and * %NL80211_CMD_DISASSOCIATE, u16 * * @NL80211_ATTR_KEY_TYPE: Key Type, see &enum nl80211_key_type, represented as * a u32 * * @NL80211_ATTR_FREQ_BEFORE: A channel which has suffered a regulatory change * due to considerations from a beacon hint. This attribute reflects * the state of the channel _before_ the beacon hint processing. This * attributes consists of a nested attribute containing * NL80211_FREQUENCY_ATTR_* * @NL80211_ATTR_FREQ_AFTER: A channel which has suffered a regulatory change * due to considerations from a beacon hint. This attribute reflects * the state of the channel _after_ the beacon hint processing. This * attributes consists of a nested attribute containing * NL80211_FREQUENCY_ATTR_* * * @NL80211_ATTR_CIPHER_SUITES: a set of u32 values indicating the supported * cipher suites * * @NL80211_ATTR_FREQ_FIXED: a flag indicating the IBSS should not try to look * for other networks on different channels * * @NL80211_ATTR_TIMED_OUT: a flag indicating than an operation timed out; this * is used, e.g., with %NL80211_CMD_AUTHENTICATE event * * @NL80211_ATTR_USE_MFP: Whether management frame protection (IEEE 802.11w) is * used for the association (&enum nl80211_mfp, represented as a u32); * this attribute can be used with %NL80211_CMD_ASSOCIATE and * %NL80211_CMD_CONNECT requests. %NL80211_MFP_OPTIONAL is not allowed for * %NL80211_CMD_ASSOCIATE since user space SME is expected and hence, it * must have decided whether to use management frame protection or not. * Setting %NL80211_MFP_OPTIONAL with a %NL80211_CMD_CONNECT request will * let the driver (or the firmware) decide whether to use MFP or not. * * @NL80211_ATTR_STA_FLAGS2: Attribute containing a * &struct nl80211_sta_flag_update. * * @NL80211_ATTR_CONTROL_PORT: A flag indicating whether user space controls * IEEE 802.1X port, i.e., sets/clears %NL80211_STA_FLAG_AUTHORIZED, in * station mode. If the flag is included in %NL80211_CMD_ASSOCIATE * request, the driver will assume that the port is unauthorized until * authorized by user space. Otherwise, port is marked authorized by * default in station mode. * @NL80211_ATTR_CONTROL_PORT_ETHERTYPE: A 16-bit value indicating the * ethertype that will be used for key negotiation. It can be * specified with the associate and connect commands. If it is not * specified, the value defaults to 0x888E (PAE, 802.1X). This * attribute is also used as a flag in the wiphy information to * indicate that protocols other than PAE are supported. * @NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT: When included along with * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE, indicates that the custom * ethertype frames used for key negotiation must not be encrypted. * @NL80211_ATTR_CONTROL_PORT_OVER_NL80211: A flag indicating whether control * port frames (e.g. of type given in %NL80211_ATTR_CONTROL_PORT_ETHERTYPE) * will be sent directly to the network interface or sent via the NL80211 * socket. If this attribute is missing, then legacy behavior of sending * control port frames directly to the network interface is used. If the * flag is included, then control port frames are sent over NL80211 instead * using %CMD_CONTROL_PORT_FRAME. If control port routing over NL80211 is * to be used then userspace must also use the %NL80211_ATTR_SOCKET_OWNER * flag. * * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver. * We recommend using nested, driver-specific attributes within this. * * @NL80211_ATTR_DISCONNECTED_BY_AP: A flag indicating that the DISCONNECT * event was due to the AP disconnecting the station, and not due to * a local disconnect request. * @NL80211_ATTR_STATUS_CODE: StatusCode for the %NL80211_CMD_CONNECT * event (u16) * @NL80211_ATTR_PRIVACY: Flag attribute, used with connect(), indicating * that protected APs should be used. This is also used with NEW_BEACON to * indicate that the BSS is to use protection. * * @NL80211_ATTR_CIPHERS_PAIRWISE: Used with CONNECT, ASSOCIATE, and NEW_BEACON * to indicate which unicast key ciphers will be used with the connection * (an array of u32). * @NL80211_ATTR_CIPHER_GROUP: Used with CONNECT, ASSOCIATE, and NEW_BEACON to * indicate which group key cipher will be used with the connection (a * u32). * @NL80211_ATTR_WPA_VERSIONS: Used with CONNECT, ASSOCIATE, and NEW_BEACON to * indicate which WPA version(s) the AP we want to associate with is using * (a u32 with flags from &enum nl80211_wpa_versions). * @NL80211_ATTR_AKM_SUITES: Used with CONNECT, ASSOCIATE, and NEW_BEACON to * indicate which key management algorithm(s) to use (an array of u32). * * @NL80211_ATTR_REQ_IE: (Re)association request information elements as * sent out by the card, for ROAM and successful CONNECT events. * @NL80211_ATTR_RESP_IE: (Re)association response information elements as * sent by peer, for ROAM and successful CONNECT events. * * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used in ASSOCIATE and CONNECT * commands to specify a request to reassociate within an ESS, i.e., to use * Reassociate Request frame (with the value of this attribute in the * Current AP address field) instead of Association Request frame which is * used for the initial association to an ESS. * * @NL80211_ATTR_KEY: key information in a nested attribute with * %NL80211_KEY_* sub-attributes * @NL80211_ATTR_KEYS: array of keys for static WEP keys for connect() * and join_ibss(), key information is in a nested attribute each * with %NL80211_KEY_* sub-attributes * * @NL80211_ATTR_PID: Process ID of a network namespace. * * @NL80211_ATTR_GENERATION: Used to indicate consistent snapshots for * dumps. This number increases whenever the object list being * dumped changes, and as such userspace can verify that it has * obtained a complete and consistent snapshot by verifying that * all dump messages contain the same generation number. If it * changed then the list changed and the dump should be repeated * completely from scratch. * * @NL80211_ATTR_4ADDR: Use 4-address frames on a virtual interface * * @NL80211_ATTR_SURVEY_INFO: survey information about a channel, part of * the survey response for %NL80211_CMD_GET_SURVEY, nested attribute * containing info as possible, see &enum survey_info. * * @NL80211_ATTR_PMKID: PMK material for PMKSA caching. * @NL80211_ATTR_MAX_NUM_PMKIDS: maximum number of PMKIDs a firmware can * cache, a wiphy attribute. * * @NL80211_ATTR_DURATION: Duration of an operation in milliseconds, u32. * @NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION: Device attribute that * specifies the maximum duration that can be requested with the * remain-on-channel operation, in milliseconds, u32. * * @NL80211_ATTR_COOKIE: Generic 64-bit cookie to identify objects. * * @NL80211_ATTR_TX_RATES: Nested set of attributes * (enum nl80211_tx_rate_attributes) describing TX rates per band. The * enum nl80211_band value is used as the index (nla_type() of the nested * data. If a band is not included, it will be configured to allow all * rates based on negotiated supported rates information. This attribute * is used with %NL80211_CMD_SET_TX_BITRATE_MASK and with starting AP, * and joining mesh networks (not IBSS yet). In the later case, it must * specify just a single bitrate, which is to be used for the beacon. * The driver must also specify support for this with the extended * features NL80211_EXT_FEATURE_BEACON_RATE_LEGACY, * NL80211_EXT_FEATURE_BEACON_RATE_HT and * NL80211_EXT_FEATURE_BEACON_RATE_VHT. * * @NL80211_ATTR_FRAME_MATCH: A binary attribute which typically must contain * at least one byte, currently used with @NL80211_CMD_REGISTER_FRAME. * @NL80211_ATTR_FRAME_TYPE: A u16 indicating the frame type/subtype for the * @NL80211_CMD_REGISTER_FRAME command. * @NL80211_ATTR_TX_FRAME_TYPES: wiphy capability attribute, which is a * nested attribute of %NL80211_ATTR_FRAME_TYPE attributes, containing * information about which frame types can be transmitted with * %NL80211_CMD_FRAME. * @NL80211_ATTR_RX_FRAME_TYPES: wiphy capability attribute, which is a * nested attribute of %NL80211_ATTR_FRAME_TYPE attributes, containing * information about which frame types can be registered for RX. * * @NL80211_ATTR_ACK: Flag attribute indicating that the frame was * acknowledged by the recipient. * * @NL80211_ATTR_PS_STATE: powersave state, using &enum nl80211_ps_state values. * * @NL80211_ATTR_CQM: connection quality monitor configuration in a * nested attribute with %NL80211_ATTR_CQM_* sub-attributes. * * @NL80211_ATTR_LOCAL_STATE_CHANGE: Flag attribute to indicate that a command * is requesting a local authentication/association state change without * invoking actual management frame exchange. This can be used with * NL80211_CMD_AUTHENTICATE, NL80211_CMD_DEAUTHENTICATE, * NL80211_CMD_DISASSOCIATE. * * @NL80211_ATTR_AP_ISOLATE: (AP mode) Do not forward traffic between stations * connected to this BSS. * * @NL80211_ATTR_WIPHY_TX_POWER_SETTING: Transmit power setting type. See * &enum nl80211_tx_power_setting for possible values. * @NL80211_ATTR_WIPHY_TX_POWER_LEVEL: Transmit power level in signed mBm units. * This is used in association with @NL80211_ATTR_WIPHY_TX_POWER_SETTING * for non-automatic settings. * * @NL80211_ATTR_SUPPORT_IBSS_RSN: The device supports IBSS RSN, which mostly * means support for per-station GTKs. * * @NL80211_ATTR_WIPHY_ANTENNA_TX: Bitmap of allowed antennas for transmitting. * This can be used to mask out antennas which are not attached or should * not be used for transmitting. If an antenna is not selected in this * bitmap the hardware is not allowed to transmit on this antenna. * * Each bit represents one antenna, starting with antenna 1 at the first * bit. Depending on which antennas are selected in the bitmap, 802.11n * drivers can derive which chainmasks to use (if all antennas belonging to * a particular chain are disabled this chain should be disabled) and if * a chain has diversity antennas wether diversity should be used or not. * HT capabilities (STBC, TX Beamforming, Antenna selection) can be * derived from the available chains after applying the antenna mask. * Non-802.11n drivers can derive wether to use diversity or not. * Drivers may reject configurations or RX/TX mask combinations they cannot * support by returning -EINVAL. * * @NL80211_ATTR_WIPHY_ANTENNA_RX: Bitmap of allowed antennas for receiving. * This can be used to mask out antennas which are not attached or should * not be used for receiving. If an antenna is not selected in this bitmap * the hardware should not be configured to receive on this antenna. * For a more detailed description see @NL80211_ATTR_WIPHY_ANTENNA_TX. * * @NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX: Bitmap of antennas which are available * for configuration as TX antennas via the above parameters. * * @NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX: Bitmap of antennas which are available * for configuration as RX antennas via the above parameters. * * @NL80211_ATTR_MCAST_RATE: Multicast tx rate (in 100 kbps) for IBSS * * @NL80211_ATTR_OFFCHANNEL_TX_OK: For management frame TX, the frame may be * transmitted on another channel when the channel given doesn't match * the current channel. If the current channel doesn't match and this * flag isn't set, the frame will be rejected. This is also used as an * nl80211 capability flag. * * @NL80211_ATTR_BSS_HT_OPMODE: HT operation mode (u16) * * @NL80211_ATTR_KEY_DEFAULT_TYPES: A nested attribute containing flags * attributes, specifying what a key should be set as default as. * See &enum nl80211_key_default_types. * * @NL80211_ATTR_MESH_SETUP: Optional mesh setup parameters. These cannot be * changed once the mesh is active. * @NL80211_ATTR_MESH_CONFIG: Mesh configuration parameters, a nested attribute * containing attributes from &enum nl80211_meshconf_params. * @NL80211_ATTR_SUPPORT_MESH_AUTH: Currently, this means the underlying driver * allows auth frames in a mesh to be passed to userspace for processing via * the @NL80211_MESH_SETUP_USERSPACE_AUTH flag. * @NL80211_ATTR_STA_PLINK_STATE: The state of a mesh peer link as defined in * &enum nl80211_plink_state. Used when userspace is driving the peer link * management state machine. @NL80211_MESH_SETUP_USERSPACE_AMPE or * @NL80211_MESH_SETUP_USERSPACE_MPM must be enabled. * * @NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED: indicates, as part of the wiphy * capabilities, the supported WoWLAN triggers * @NL80211_ATTR_WOWLAN_TRIGGERS: used by %NL80211_CMD_SET_WOWLAN to * indicate which WoW triggers should be enabled. This is also * used by %NL80211_CMD_GET_WOWLAN to get the currently enabled WoWLAN * triggers. * * @NL80211_ATTR_SCHED_SCAN_INTERVAL: Interval between scheduled scan * cycles, in msecs. * * @NL80211_ATTR_SCHED_SCAN_MATCH: Nested attribute with one or more * sets of attributes to match during scheduled scans. Only BSSs * that match any of the sets will be reported. These are * pass-thru filter rules. * For a match to succeed, the BSS must match all attributes of a * set. Since not every hardware supports matching all types of * attributes, there is no guarantee that the reported BSSs are * fully complying with the match sets and userspace needs to be * able to ignore them by itself. * Thus, the implementation is somewhat hardware-dependent, but * this is only an optimization and the userspace application * needs to handle all the non-filtered results anyway. * If the match attributes don't make sense when combined with * the values passed in @NL80211_ATTR_SCAN_SSIDS (eg. if an SSID * is included in the probe request, but the match attributes * will never let it go through), -EINVAL may be returned. * If ommited, no filtering is done. * * @NL80211_ATTR_INTERFACE_COMBINATIONS: Nested attribute listing the supported * interface combinations. In each nested item, it contains attributes * defined in &enum nl80211_if_combination_attrs. * @NL80211_ATTR_SOFTWARE_IFTYPES: Nested attribute (just like * %NL80211_ATTR_SUPPORTED_IFTYPES) containing the interface types that * are managed in software: interfaces of these types aren't subject to * any restrictions in their number or combinations. * * @NL80211_ATTR_REKEY_DATA: nested attribute containing the information * necessary for GTK rekeying in the device, see &enum nl80211_rekey_data. * * @NL80211_ATTR_SCAN_SUPP_RATES: rates per to be advertised as supported in scan, * nested array attribute containing an entry for each band, with the entry * being a list of supported rates as defined by IEEE 802.11 7.3.2.2 but * without the length restriction (at most %NL80211_MAX_SUPP_RATES). * * @NL80211_ATTR_HIDDEN_SSID: indicates whether SSID is to be hidden from Beacon * and Probe Response (when response to wildcard Probe Request); see * &enum nl80211_hidden_ssid, represented as a u32 * * @NL80211_ATTR_IE_PROBE_RESP: Information element(s) for Probe Response frame. * This is used with %NL80211_CMD_NEW_BEACON and %NL80211_CMD_SET_BEACON to * provide extra IEs (e.g., WPS/P2P IE) into Probe Response frames when the * driver (or firmware) replies to Probe Request frames. * @NL80211_ATTR_IE_ASSOC_RESP: Information element(s) for (Re)Association * Response frames. This is used with %NL80211_CMD_NEW_BEACON and * %NL80211_CMD_SET_BEACON to provide extra IEs (e.g., WPS/P2P IE) into * (Re)Association Response frames when the driver (or firmware) replies to * (Re)Association Request frames. * * @NL80211_ATTR_STA_WME: Nested attribute containing the wme configuration * of the station, see &enum nl80211_sta_wme_attr. * @NL80211_ATTR_SUPPORT_AP_UAPSD: the device supports uapsd when working * as AP. * * @NL80211_ATTR_ROAM_SUPPORT: Indicates whether the firmware is capable of * roaming to another AP in the same ESS if the signal lever is low. * * @NL80211_ATTR_PMKSA_CANDIDATE: Nested attribute containing the PMKSA caching * candidate information, see &enum nl80211_pmksa_candidate_attr. * * @NL80211_ATTR_TX_NO_CCK_RATE: Indicates whether to use CCK rate or not * for management frames transmission. In order to avoid p2p probe/action * frames are being transmitted at CCK rate in 2GHz band, the user space * applications use this attribute. * This attribute is used with %NL80211_CMD_TRIGGER_SCAN and * %NL80211_CMD_FRAME commands. * * @NL80211_ATTR_TDLS_ACTION: Low level TDLS action code (e.g. link setup * request, link setup confirm, link teardown, etc.). Values are * described in the TDLS (802.11z) specification. * @NL80211_ATTR_TDLS_DIALOG_TOKEN: Non-zero token for uniquely identifying a * TDLS conversation between two devices. * @NL80211_ATTR_TDLS_OPERATION: High level TDLS operation; see * &enum nl80211_tdls_operation, represented as a u8. * @NL80211_ATTR_TDLS_SUPPORT: A flag indicating the device can operate * as a TDLS peer sta. * @NL80211_ATTR_TDLS_EXTERNAL_SETUP: The TDLS discovery/setup and teardown * procedures should be performed by sending TDLS packets via * %NL80211_CMD_TDLS_MGMT. Otherwise %NL80211_CMD_TDLS_OPER should be * used for asking the driver to perform a TDLS operation. * * @NL80211_ATTR_DEVICE_AP_SME: This u32 attribute may be listed for devices * that have AP support to indicate that they have the AP SME integrated * with support for the features listed in this attribute, see * &enum nl80211_ap_sme_features. * * @NL80211_ATTR_DONT_WAIT_FOR_ACK: Used with %NL80211_CMD_FRAME, this tells * the driver to not wait for an acknowledgement. Note that due to this, * it will also not give a status callback nor return a cookie. This is * mostly useful for probe responses to save airtime. * * @NL80211_ATTR_FEATURE_FLAGS: This u32 attribute contains flags from * &enum nl80211_feature_flags and is advertised in wiphy information. * @NL80211_ATTR_PROBE_RESP_OFFLOAD: Indicates that the HW responds to probe * requests while operating in AP-mode. * This attribute holds a bitmap of the supported protocols for * offloading (see &enum nl80211_probe_resp_offload_support_attr). * * @NL80211_ATTR_PROBE_RESP: Probe Response template data. Contains the entire * probe-response frame. The DA field in the 802.11 header is zero-ed out, * to be filled by the FW. * @NL80211_ATTR_DISABLE_HT: Force HT capable interfaces to disable * this feature. Currently, only supported in mac80211 drivers. * @NL80211_ATTR_HT_CAPABILITY_MASK: Specify which bits of the * ATTR_HT_CAPABILITY to which attention should be paid. * Currently, only mac80211 NICs support this feature. * The values that may be configured are: * MCS rates, MAX-AMSDU, HT-20-40 and HT_CAP_SGI_40 * AMPDU density and AMPDU factor. * All values are treated as suggestions and may be ignored * by the driver as required. The actual values may be seen in * the station debugfs ht_caps file. * * @NL80211_ATTR_DFS_REGION: region for regulatory rules which this country * abides to when initiating radiation on DFS channels. A country maps * to one DFS region. * * @NL80211_ATTR_NOACK_MAP: This u16 bitmap contains the No Ack Policy of * up to 16 TIDs. * * @NL80211_ATTR_INACTIVITY_TIMEOUT: timeout value in seconds, this can be * used by the drivers which has MLME in firmware and does not have support * to report per station tx/rx activity to free up the staion entry from * the list. This needs to be used when the driver advertises the * capability to timeout the stations. * * @NL80211_ATTR_RX_SIGNAL_DBM: signal strength in dBm (as a 32-bit int); * this attribute is (depending on the driver capabilities) added to * received frames indicated with %NL80211_CMD_FRAME. * * @NL80211_ATTR_BG_SCAN_PERIOD: Background scan period in seconds * or 0 to disable background scan. * * @NL80211_ATTR_USER_REG_HINT_TYPE: type of regulatory hint passed from * userspace. If unset it is assumed the hint comes directly from * a user. If set code could specify exactly what type of source * was used to provide the hint. For the different types of * allowed user regulatory hints see nl80211_user_reg_hint_type. * * @NL80211_ATTR_CONN_FAILED_REASON: The reason for which AP has rejected * the connection request from a station. nl80211_connect_failed_reason * enum has different reasons of connection failure. * * @NL80211_ATTR_AUTH_DATA: Fields and elements in Authentication frames. * This contains the authentication frame body (non-IE and IE data), * excluding the Authentication algorithm number, i.e., starting at the * Authentication transaction sequence number field. It is used with * authentication algorithms that need special fields to be added into * the frames (SAE and FILS). Currently, only the SAE cases use the * initial two fields (Authentication transaction sequence number and * Status code). However, those fields are included in the attribute data * for all authentication algorithms to keep the attribute definition * consistent. * * @NL80211_ATTR_VHT_CAPABILITY: VHT Capability information element (from * association request when used with NL80211_CMD_NEW_STATION) * * @NL80211_ATTR_SCAN_FLAGS: scan request control flags (u32) * * @NL80211_ATTR_P2P_CTWINDOW: P2P GO Client Traffic Window (u8), used with * the START_AP and SET_BSS commands * @NL80211_ATTR_P2P_OPPPS: P2P GO opportunistic PS (u8), used with the * START_AP and SET_BSS commands. This can have the values 0 or 1; * if not given in START_AP 0 is assumed, if not given in SET_BSS * no change is made. * * @NL80211_ATTR_LOCAL_MESH_POWER_MODE: local mesh STA link-specific power mode * defined in &enum nl80211_mesh_power_mode. * * @NL80211_ATTR_ACL_POLICY: ACL policy, see &enum nl80211_acl_policy, * carried in a u32 attribute * * @NL80211_ATTR_MAC_ADDRS: Array of nested MAC addresses, used for * MAC ACL. * * @NL80211_ATTR_MAC_ACL_MAX: u32 attribute to advertise the maximum * number of MAC addresses that a device can support for MAC * ACL. * * @NL80211_ATTR_RADAR_EVENT: Type of radar event for notification to userspace, * contains a value of enum nl80211_radar_event (u32). * * @NL80211_ATTR_EXT_CAPA: 802.11 extended capabilities that the kernel driver * has and handles. The format is the same as the IE contents. See * 802.11-2012 8.4.2.29 for more information. * @NL80211_ATTR_EXT_CAPA_MASK: Extended capabilities that the kernel driver * has set in the %NL80211_ATTR_EXT_CAPA value, for multibit fields. * * @NL80211_ATTR_STA_CAPABILITY: Station capabilities (u16) are advertised to * the driver, e.g., to enable TDLS power save (PU-APSD). * * @NL80211_ATTR_STA_EXT_CAPABILITY: Station extended capabilities are * advertised to the driver, e.g., to enable TDLS off channel operations * and PU-APSD. * * @NL80211_ATTR_PROTOCOL_FEATURES: global nl80211 feature flags, see * &enum nl80211_protocol_features, the attribute is a u32. * * @NL80211_ATTR_SPLIT_WIPHY_DUMP: flag attribute, userspace supports * receiving the data for a single wiphy split across multiple * messages, given with wiphy dump message * * @NL80211_ATTR_MDID: Mobility Domain Identifier * * @NL80211_ATTR_IE_RIC: Resource Information Container Information * Element * * @NL80211_ATTR_CRIT_PROT_ID: critical protocol identifier requiring increased * reliability, see &enum nl80211_crit_proto_id (u16). * @NL80211_ATTR_MAX_CRIT_PROT_DURATION: duration in milliseconds in which * the connection should have increased reliability (u16). * * @NL80211_ATTR_PEER_AID: Association ID for the peer TDLS station (u16). * This is similar to @NL80211_ATTR_STA_AID but with a difference of being * allowed to be used with the first @NL80211_CMD_SET_STATION command to * update a TDLS peer STA entry. * * @NL80211_ATTR_COALESCE_RULE: Coalesce rule information. * * @NL80211_ATTR_CH_SWITCH_COUNT: u32 attribute specifying the number of TBTT's * until the channel switch event. * @NL80211_ATTR_CH_SWITCH_BLOCK_TX: flag attribute specifying that transmission * must be blocked on the current channel (before the channel switch * operation). * @NL80211_ATTR_CSA_IES: Nested set of attributes containing the IE information * for the time while performing a channel switch. * @NL80211_ATTR_CSA_C_OFF_BEACON: An array of offsets (u16) to the channel * switch counters in the beacons tail (%NL80211_ATTR_BEACON_TAIL). * @NL80211_ATTR_CSA_C_OFF_PRESP: An array of offsets (u16) to the channel * switch counters in the probe response (%NL80211_ATTR_PROBE_RESP). * * @NL80211_ATTR_RXMGMT_FLAGS: flags for nl80211_send_mgmt(), u32. * As specified in the &enum nl80211_rxmgmt_flags. * * @NL80211_ATTR_STA_SUPPORTED_CHANNELS: array of supported channels. * * @NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES: array of supported * supported operating classes. * * @NL80211_ATTR_HANDLE_DFS: A flag indicating whether user space * controls DFS operation in IBSS mode. If the flag is included in * %NL80211_CMD_JOIN_IBSS request, the driver will allow use of DFS * channels and reports radar events to userspace. Userspace is required * to react to radar events, e.g. initiate a channel switch or leave the * IBSS network. * * @NL80211_ATTR_SUPPORT_5_MHZ: A flag indicating that the device supports * 5 MHz channel bandwidth. * @NL80211_ATTR_SUPPORT_10_MHZ: A flag indicating that the device supports * 10 MHz channel bandwidth. * * @NL80211_ATTR_OPMODE_NOTIF: Operating mode field from Operating Mode * Notification Element based on association request when used with * %NL80211_CMD_NEW_STATION or %NL80211_CMD_SET_STATION (only when * %NL80211_FEATURE_FULL_AP_CLIENT_STATE is supported, or with TDLS); * u8 attribute. * * @NL80211_ATTR_VENDOR_ID: The vendor ID, either a 24-bit OUI or, if * %NL80211_VENDOR_ID_IS_LINUX is set, a special Linux ID (not used yet) * @NL80211_ATTR_VENDOR_SUBCMD: vendor sub-command * @NL80211_ATTR_VENDOR_DATA: data for the vendor command, if any; this * attribute is also used for vendor command feature advertisement * @NL80211_ATTR_VENDOR_EVENTS: used for event list advertising in the wiphy * info, containing a nested array of possible events * * @NL80211_ATTR_QOS_MAP: IP DSCP mapping for Interworking QoS mapping. This * data is in the format defined for the payload of the QoS Map Set element * in IEEE Std 802.11-2012, 8.4.2.97. * * @NL80211_ATTR_MAC_HINT: MAC address recommendation as initial BSS * @NL80211_ATTR_WIPHY_FREQ_HINT: frequency of the recommended initial BSS * * @NL80211_ATTR_MAX_AP_ASSOC_STA: Device attribute that indicates how many * associated stations are supported in AP mode (including P2P GO); u32. * Since drivers may not have a fixed limit on the maximum number (e.g., * other concurrent operations may affect this), drivers are allowed to * advertise values that cannot always be met. In such cases, an attempt * to add a new station entry with @NL80211_CMD_NEW_STATION may fail. * * @NL80211_ATTR_CSA_C_OFFSETS_TX: An array of csa counter offsets (u16) which * should be updated when the frame is transmitted. * @NL80211_ATTR_MAX_CSA_COUNTERS: U8 attribute used to advertise the maximum * supported number of csa counters. * * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32. * As specified in the &enum nl80211_tdls_peer_capability. * * @NL80211_ATTR_SOCKET_OWNER: Flag attribute, if set during interface * creation then the new interface will be owned by the netlink socket * that created it and will be destroyed when the socket is closed. * If set during scheduled scan start then the new scan req will be * owned by the netlink socket that created it and the scheduled scan will * be stopped when the socket is closed. * If set during configuration of regulatory indoor operation then the * regulatory indoor configuration would be owned by the netlink socket * that configured the indoor setting, and the indoor operation would be * cleared when the socket is closed. * If set during NAN interface creation, the interface will be destroyed * if the socket is closed just like any other interface. Moreover, NAN * notifications will be sent in unicast to that socket. Without this * attribute, the notifications will be sent to the %NL80211_MCGRP_NAN * multicast group. * If set during %NL80211_CMD_ASSOCIATE or %NL80211_CMD_CONNECT the * station will deauthenticate when the socket is closed. * If set during %NL80211_CMD_JOIN_IBSS the IBSS will be automatically * torn down when the socket is closed. * If set during %NL80211_CMD_JOIN_MESH the mesh setup will be * automatically torn down when the socket is closed. * If set during %NL80211_CMD_START_AP the AP will be automatically * disabled when the socket is closed. * * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is * the TDLS link initiator. * * @NL80211_ATTR_USE_RRM: flag for indicating whether the current connection * shall support Radio Resource Measurements (11k). This attribute can be * used with %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests. * User space applications are expected to use this flag only if the * underlying device supports these minimal RRM features: * %NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES, * %NL80211_FEATURE_QUIET, * Or, if global RRM is supported, see: * %NL80211_EXT_FEATURE_RRM * If this flag is used, driver must add the Power Capabilities IE to the * association request. In addition, it must also set the RRM capability * flag in the association request's Capability Info field. * * @NL80211_ATTR_WIPHY_DYN_ACK: flag attribute used to enable ACK timeout * estimation algorithm (dynack). In order to activate dynack * %NL80211_FEATURE_ACKTO_ESTIMATION feature flag must be set by lower * drivers to indicate dynack capability. Dynack is automatically disabled * setting valid value for coverage class. * * @NL80211_ATTR_TSID: a TSID value (u8 attribute) * @NL80211_ATTR_USER_PRIO: user priority value (u8 attribute) * @NL80211_ATTR_ADMITTED_TIME: admitted time in units of 32 microseconds * (per second) (u16 attribute) * * @NL80211_ATTR_SMPS_MODE: SMPS mode to use (ap mode). see * &enum nl80211_smps_mode. * * @NL80211_ATTR_OPER_CLASS: operating class * * @NL80211_ATTR_MAC_MASK: MAC address mask * * @NL80211_ATTR_WIPHY_SELF_MANAGED_REG: flag attribute indicating this device * is self-managing its regulatory information and any regulatory domain * obtained from it is coming from the device's wiphy and not the global * cfg80211 regdomain. * * @NL80211_ATTR_EXT_FEATURES: extended feature flags contained in a byte * array. The feature flags are identified by their bit index (see &enum * nl80211_ext_feature_index). The bit index is ordered starting at the * least-significant bit of the first byte in the array, ie. bit index 0 * is located at bit 0 of byte 0. bit index 25 would be located at bit 1 * of byte 3 (u8 array). * * @NL80211_ATTR_SURVEY_RADIO_STATS: Request overall radio statistics to be * returned along with other survey data. If set, @NL80211_CMD_GET_SURVEY * may return a survey entry without a channel indicating global radio * statistics (only some values are valid and make sense.) * For devices that don't return such an entry even then, the information * should be contained in the result as the sum of the respective counters * over all channels. * * @NL80211_ATTR_SCHED_SCAN_DELAY: delay before the first cycle of a * scheduled scan is started. Or the delay before a WoWLAN * net-detect scan is started, counting from the moment the * system is suspended. This value is a u32, in seconds. * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device * is operating in an indoor environment. * * @NL80211_ATTR_MAX_NUM_SCHED_SCAN_PLANS: maximum number of scan plans for * scheduled scan supported by the device (u32), a wiphy attribute. * @NL80211_ATTR_MAX_SCAN_PLAN_INTERVAL: maximum interval (in seconds) for * a scan plan (u32), a wiphy attribute. * @NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS: maximum number of iterations in * a scan plan (u32), a wiphy attribute. * @NL80211_ATTR_SCHED_SCAN_PLANS: a list of scan plans for scheduled scan. * Each scan plan defines the number of scan iterations and the interval * between scans. The last scan plan will always run infinitely, * thus it must not specify the number of iterations, only the interval * between scans. The scan plans are executed sequentially. * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan. * @NL80211_ATTR_PBSS: flag attribute. If set it means operate * in a PBSS. Specified in %NL80211_CMD_CONNECT to request * connecting to a PCP, and in %NL80211_CMD_START_AP to start * a PCP instead of AP. Relevant for DMG networks only. * @NL80211_ATTR_BSS_SELECT: nested attribute for driver supporting the * BSS selection feature. When used with %NL80211_CMD_GET_WIPHY it contains * attributes according &enum nl80211_bss_select_attr to indicate what * BSS selection behaviours are supported. When used with %NL80211_CMD_CONNECT * it contains the behaviour-specific attribute containing the parameters for * BSS selection to be done by driver and/or firmware. * * @NL80211_ATTR_STA_SUPPORT_P2P_PS: whether P2P PS mechanism supported * or not. u8, one of the values of &enum nl80211_sta_p2p_ps_status * * @NL80211_ATTR_PAD: attribute used for padding for 64-bit alignment * * @NL80211_ATTR_IFTYPE_EXT_CAPA: Nested attribute of the following attributes: * %NL80211_ATTR_IFTYPE, %NL80211_ATTR_EXT_CAPA, * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities per * interface type. * * @NL80211_ATTR_MU_MIMO_GROUP_DATA: array of 24 bytes that defines a MU-MIMO * groupID for monitor mode. * The first 8 bytes are a mask that defines the membership in each * group (there are 64 groups, group 0 and 63 are reserved), * each bit represents a group and set to 1 for being a member in * that group and 0 for not being a member. * The remaining 16 bytes define the position in each group: 2 bits for * each group. * (smaller group numbers represented on most significant bits and bigger * group numbers on least significant bits.) * This attribute is used only if all interfaces are in monitor mode. * Set this attribute in order to monitor packets using the given MU-MIMO * groupID data. * to turn off that feature set all the bits of the groupID to zero. * @NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR: mac address for the sniffer to follow * when using MU-MIMO air sniffer. * to turn that feature off set an invalid mac address * (e.g. FF:FF:FF:FF:FF:FF) * * @NL80211_ATTR_SCAN_START_TIME_TSF: The time at which the scan was actually * started (u64). The time is the TSF of the BSS the interface that * requested the scan is connected to (if available, otherwise this * attribute must not be included). * @NL80211_ATTR_SCAN_START_TIME_TSF_BSSID: The BSS according to which * %NL80211_ATTR_SCAN_START_TIME_TSF is set. * @NL80211_ATTR_MEASUREMENT_DURATION: measurement duration in TUs (u16). If * %NL80211_ATTR_MEASUREMENT_DURATION_MANDATORY is not set, this is the * maximum measurement duration allowed. This attribute is used with * measurement requests. It can also be used with %NL80211_CMD_TRIGGER_SCAN * if the scan is used for beacon report radio measurement. * @NL80211_ATTR_MEASUREMENT_DURATION_MANDATORY: flag attribute that indicates * that the duration specified with %NL80211_ATTR_MEASUREMENT_DURATION is * mandatory. If this flag is not set, the duration is the maximum duration * and the actual measurement duration may be shorter. * * @NL80211_ATTR_MESH_PEER_AID: Association ID for the mesh peer (u16). This is * used to pull the stored data for mesh peer in power save state. * * @NL80211_ATTR_NAN_MASTER_PREF: the master preference to be used by * %NL80211_CMD_START_NAN and optionally with * %NL80211_CMD_CHANGE_NAN_CONFIG. Its type is u8 and it can't be 0. * Also, values 1 and 255 are reserved for certification purposes and * should not be used during a normal device operation. * @NL80211_ATTR_BANDS: operating bands configuration. This is a u32 * bitmask of BIT(NL80211_BAND_*) as described in %enum * nl80211_band. For instance, for NL80211_BAND_2GHZ, bit 0 * would be set. This attribute is used with * %NL80211_CMD_START_NAN and %NL80211_CMD_CHANGE_NAN_CONFIG, and * it is optional. If no bands are set, it means don't-care and * the device will decide what to use. * @NL80211_ATTR_NAN_FUNC: a function that can be added to NAN. See * &enum nl80211_nan_func_attributes for description of this nested * attribute. * @NL80211_ATTR_NAN_MATCH: used to report a match. This is a nested attribute. * See &enum nl80211_nan_match_attributes. * @NL80211_ATTR_FILS_KEK: KEK for FILS (Re)Association Request/Response frame * protection. * @NL80211_ATTR_FILS_NONCES: Nonces (part of AAD) for FILS (Re)Association * Request/Response frame protection. This attribute contains the 16 octet * STA Nonce followed by 16 octets of AP Nonce. * * @NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED: Indicates whether or not multicast * packets should be send out as unicast to all stations (flag attribute). * * @NL80211_ATTR_BSSID: The BSSID of the AP. Note that %NL80211_ATTR_MAC is also * used in various commands/events for specifying the BSSID. * * @NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI: Relative RSSI threshold by which * other BSSs has to be better or slightly worse than the current * connected BSS so that they get reported to user space. * This will give an opportunity to userspace to consider connecting to * other matching BSSs which have better or slightly worse RSSI than * the current connected BSS by using an offloaded operation to avoid * unnecessary wakeups. * * @NL80211_ATTR_SCHED_SCAN_RSSI_ADJUST: When present the RSSI level for BSSs in * the specified band is to be adjusted before doing * %NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI based comparision to figure out * better BSSs. The attribute value is a packed structure * value as specified by &struct nl80211_bss_select_rssi_adjust. * * @NL80211_ATTR_TIMEOUT_REASON: The reason for which an operation timed out. * u32 attribute with an &enum nl80211_timeout_reason value. This is used, * e.g., with %NL80211_CMD_CONNECT event. * * @NL80211_ATTR_FILS_ERP_USERNAME: EAP Re-authentication Protocol (ERP) * username part of NAI used to refer keys rRK and rIK. This is used with * %NL80211_CMD_CONNECT. * * @NL80211_ATTR_FILS_ERP_REALM: EAP Re-authentication Protocol (ERP) realm part * of NAI specifying the domain name of the ER server. This is used with * %NL80211_CMD_CONNECT. * * @NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM: Unsigned 16-bit ERP next sequence number * to use in ERP messages. This is used in generating the FILS wrapped data * for FILS authentication and is used with %NL80211_CMD_CONNECT. * * @NL80211_ATTR_FILS_ERP_RRK: ERP re-authentication Root Key (rRK) for the * NAI specified by %NL80211_ATTR_FILS_ERP_USERNAME and * %NL80211_ATTR_FILS_ERP_REALM. This is used for generating rIK and rMSK * from successful FILS authentication and is used with * %NL80211_CMD_CONNECT. * * @NL80211_ATTR_FILS_CACHE_ID: A 2-octet identifier advertized by a FILS AP * identifying the scope of PMKSAs. This is used with * @NL80211_CMD_SET_PMKSA and @NL80211_CMD_DEL_PMKSA. * * @NL80211_ATTR_PMK: attribute for passing PMK key material. Used with * %NL80211_CMD_SET_PMKSA for the PMKSA identified by %NL80211_ATTR_PMKID. * For %NL80211_CMD_CONNECT it is used to provide PSK for offloading 4-way * handshake for WPA/WPA2-PSK networks. For 802.1X authentication it is * used with %NL80211_CMD_SET_PMK. For offloaded FT support this attribute * specifies the PMK-R0 if NL80211_ATTR_PMKR0_NAME is included as well. * * @NL80211_ATTR_SCHED_SCAN_MULTI: flag attribute which user-space shall use to * indicate that it supports multiple active scheduled scan requests. * @NL80211_ATTR_SCHED_SCAN_MAX_REQS: indicates maximum number of scheduled * scan request that may be active for the device (u32). * * @NL80211_ATTR_WANT_1X_4WAY_HS: flag attribute which user-space can include * in %NL80211_CMD_CONNECT to indicate that for 802.1X authentication it * wants to use the supported offload of the 4-way handshake. * @NL80211_ATTR_PMKR0_NAME: PMK-R0 Name for offloaded FT. * @NL80211_ATTR_PORT_AUTHORIZED: (reserved) * * @NL80211_ATTR_EXTERNAL_AUTH_ACTION: Identify the requested external * authentication operation (u32 attribute with an * &enum nl80211_external_auth_action value). This is used with the * %NL80211_CMD_EXTERNAL_AUTH request event. * @NL80211_ATTR_EXTERNAL_AUTH_SUPPORT: Flag attribute indicating that the user * space supports external authentication. This attribute shall be used * only with %NL80211_CMD_CONNECT request. The driver may offload * authentication processing to user space if this capability is indicated * in NL80211_CMD_CONNECT requests from the user space. * * @NL80211_ATTR_NSS: Station's New/updated RX_NSS value notified using this * u8 attribute. This is used with %NL80211_CMD_STA_OPMODE_CHANGED. * * @NL80211_ATTR_TXQ_STATS: TXQ statistics (nested attribute, see &enum * nl80211_txq_stats) * @NL80211_ATTR_TXQ_LIMIT: Total packet limit for the TXQ queues for this phy. * The smaller of this and the memory limit is enforced. * @NL80211_ATTR_TXQ_MEMORY_LIMIT: Total memory memory limit (in bytes) for the * TXQ queues for this phy. The smaller of this and the packet limit is * enforced. * @NL80211_ATTR_TXQ_QUANTUM: TXQ scheduler quantum (bytes). Number of bytes * a flow is assigned on each round of the DRR scheduler. * @NL80211_ATTR_HE_CAPABILITY: HE Capability information element (from * association request when used with NL80211_CMD_NEW_STATION). Can be set * only if %NL80211_STA_FLAG_WME is set. * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use */ enum nl80211_attrs { /* don't change the order or add anything between, this is ABI! */ NL80211_ATTR_UNSPEC, NL80211_ATTR_WIPHY, NL80211_ATTR_WIPHY_NAME, NL80211_ATTR_IFINDEX, NL80211_ATTR_IFNAME, NL80211_ATTR_IFTYPE, NL80211_ATTR_MAC, NL80211_ATTR_KEY_DATA, NL80211_ATTR_KEY_IDX, NL80211_ATTR_KEY_CIPHER, NL80211_ATTR_KEY_SEQ, NL80211_ATTR_KEY_DEFAULT, NL80211_ATTR_BEACON_INTERVAL, NL80211_ATTR_DTIM_PERIOD, NL80211_ATTR_BEACON_HEAD, NL80211_ATTR_BEACON_TAIL, NL80211_ATTR_STA_AID, NL80211_ATTR_STA_FLAGS, NL80211_ATTR_STA_LISTEN_INTERVAL, NL80211_ATTR_STA_SUPPORTED_RATES, NL80211_ATTR_STA_VLAN, NL80211_ATTR_STA_INFO, NL80211_ATTR_WIPHY_BANDS, NL80211_ATTR_MNTR_FLAGS, NL80211_ATTR_MESH_ID, NL80211_ATTR_STA_PLINK_ACTION, NL80211_ATTR_MPATH_NEXT_HOP, NL80211_ATTR_MPATH_INFO, NL80211_ATTR_BSS_CTS_PROT, NL80211_ATTR_BSS_SHORT_PREAMBLE, NL80211_ATTR_BSS_SHORT_SLOT_TIME, NL80211_ATTR_HT_CAPABILITY, NL80211_ATTR_SUPPORTED_IFTYPES, NL80211_ATTR_REG_ALPHA2, NL80211_ATTR_REG_RULES, NL80211_ATTR_MESH_CONFIG, NL80211_ATTR_BSS_BASIC_RATES, NL80211_ATTR_WIPHY_TXQ_PARAMS, NL80211_ATTR_WIPHY_FREQ, NL80211_ATTR_WIPHY_CHANNEL_TYPE, NL80211_ATTR_KEY_DEFAULT_MGMT, NL80211_ATTR_MGMT_SUBTYPE, NL80211_ATTR_IE, NL80211_ATTR_MAX_NUM_SCAN_SSIDS, NL80211_ATTR_SCAN_FREQUENCIES, NL80211_ATTR_SCAN_SSIDS, NL80211_ATTR_GENERATION, /* replaces old SCAN_GENERATION */ NL80211_ATTR_BSS, NL80211_ATTR_REG_INITIATOR, NL80211_ATTR_REG_TYPE, NL80211_ATTR_SUPPORTED_COMMANDS, NL80211_ATTR_FRAME, NL80211_ATTR_SSID, NL80211_ATTR_AUTH_TYPE, NL80211_ATTR_REASON_CODE, NL80211_ATTR_KEY_TYPE, NL80211_ATTR_MAX_SCAN_IE_LEN, NL80211_ATTR_CIPHER_SUITES, NL80211_ATTR_FREQ_BEFORE, NL80211_ATTR_FREQ_AFTER, NL80211_ATTR_FREQ_FIXED, NL80211_ATTR_WIPHY_RETRY_SHORT, NL80211_ATTR_WIPHY_RETRY_LONG, NL80211_ATTR_WIPHY_FRAG_THRESHOLD, NL80211_ATTR_WIPHY_RTS_THRESHOLD, NL80211_ATTR_TIMED_OUT, NL80211_ATTR_USE_MFP, NL80211_ATTR_STA_FLAGS2, NL80211_ATTR_CONTROL_PORT, NL80211_ATTR_TESTDATA, NL80211_ATTR_PRIVACY, NL80211_ATTR_DISCONNECTED_BY_AP, NL80211_ATTR_STATUS_CODE, NL80211_ATTR_CIPHER_SUITES_PAIRWISE, NL80211_ATTR_CIPHER_SUITE_GROUP, NL80211_ATTR_WPA_VERSIONS, NL80211_ATTR_AKM_SUITES, NL80211_ATTR_REQ_IE, NL80211_ATTR_RESP_IE, NL80211_ATTR_PREV_BSSID, NL80211_ATTR_KEY, NL80211_ATTR_KEYS, NL80211_ATTR_PID, NL80211_ATTR_4ADDR, NL80211_ATTR_SURVEY_INFO, NL80211_ATTR_PMKID, NL80211_ATTR_MAX_NUM_PMKIDS, NL80211_ATTR_DURATION, NL80211_ATTR_COOKIE, NL80211_ATTR_WIPHY_COVERAGE_CLASS, NL80211_ATTR_TX_RATES, NL80211_ATTR_FRAME_MATCH, NL80211_ATTR_ACK, NL80211_ATTR_PS_STATE, NL80211_ATTR_CQM, NL80211_ATTR_LOCAL_STATE_CHANGE, NL80211_ATTR_AP_ISOLATE, NL80211_ATTR_WIPHY_TX_POWER_SETTING, NL80211_ATTR_WIPHY_TX_POWER_LEVEL, NL80211_ATTR_TX_FRAME_TYPES, NL80211_ATTR_RX_FRAME_TYPES, NL80211_ATTR_FRAME_TYPE, NL80211_ATTR_CONTROL_PORT_ETHERTYPE, NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT, NL80211_ATTR_SUPPORT_IBSS_RSN, NL80211_ATTR_WIPHY_ANTENNA_TX, NL80211_ATTR_WIPHY_ANTENNA_RX, NL80211_ATTR_MCAST_RATE, NL80211_ATTR_OFFCHANNEL_TX_OK, NL80211_ATTR_BSS_HT_OPMODE, NL80211_ATTR_KEY_DEFAULT_TYPES, NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION, NL80211_ATTR_MESH_SETUP, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX, NL80211_ATTR_SUPPORT_MESH_AUTH, NL80211_ATTR_STA_PLINK_STATE, NL80211_ATTR_WOWLAN_TRIGGERS, NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, NL80211_ATTR_SCHED_SCAN_INTERVAL, NL80211_ATTR_INTERFACE_COMBINATIONS, NL80211_ATTR_SOFTWARE_IFTYPES, NL80211_ATTR_REKEY_DATA, NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS, NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN, NL80211_ATTR_SCAN_SUPP_RATES, NL80211_ATTR_HIDDEN_SSID, NL80211_ATTR_IE_PROBE_RESP, NL80211_ATTR_IE_ASSOC_RESP, NL80211_ATTR_STA_WME, NL80211_ATTR_SUPPORT_AP_UAPSD, NL80211_ATTR_ROAM_SUPPORT, NL80211_ATTR_SCHED_SCAN_MATCH, NL80211_ATTR_MAX_MATCH_SETS, NL80211_ATTR_PMKSA_CANDIDATE, NL80211_ATTR_TX_NO_CCK_RATE, NL80211_ATTR_TDLS_ACTION, NL80211_ATTR_TDLS_DIALOG_TOKEN, NL80211_ATTR_TDLS_OPERATION, NL80211_ATTR_TDLS_SUPPORT, NL80211_ATTR_TDLS_EXTERNAL_SETUP, NL80211_ATTR_DEVICE_AP_SME, NL80211_ATTR_DONT_WAIT_FOR_ACK, NL80211_ATTR_FEATURE_FLAGS, NL80211_ATTR_PROBE_RESP_OFFLOAD, NL80211_ATTR_PROBE_RESP, NL80211_ATTR_DFS_REGION, NL80211_ATTR_DISABLE_HT, NL80211_ATTR_HT_CAPABILITY_MASK, NL80211_ATTR_NOACK_MAP, NL80211_ATTR_INACTIVITY_TIMEOUT, NL80211_ATTR_RX_SIGNAL_DBM, NL80211_ATTR_BG_SCAN_PERIOD, NL80211_ATTR_WDEV, NL80211_ATTR_USER_REG_HINT_TYPE, NL80211_ATTR_CONN_FAILED_REASON, NL80211_ATTR_AUTH_DATA, NL80211_ATTR_VHT_CAPABILITY, NL80211_ATTR_SCAN_FLAGS, NL80211_ATTR_CHANNEL_WIDTH, NL80211_ATTR_CENTER_FREQ1, NL80211_ATTR_CENTER_FREQ2, NL80211_ATTR_P2P_CTWINDOW, NL80211_ATTR_P2P_OPPPS, NL80211_ATTR_LOCAL_MESH_POWER_MODE, NL80211_ATTR_ACL_POLICY, NL80211_ATTR_MAC_ADDRS, NL80211_ATTR_MAC_ACL_MAX, NL80211_ATTR_RADAR_EVENT, NL80211_ATTR_EXT_CAPA, NL80211_ATTR_EXT_CAPA_MASK, NL80211_ATTR_STA_CAPABILITY, NL80211_ATTR_STA_EXT_CAPABILITY, NL80211_ATTR_PROTOCOL_FEATURES, NL80211_ATTR_SPLIT_WIPHY_DUMP, NL80211_ATTR_DISABLE_VHT, NL80211_ATTR_VHT_CAPABILITY_MASK, NL80211_ATTR_MDID, NL80211_ATTR_IE_RIC, NL80211_ATTR_CRIT_PROT_ID, NL80211_ATTR_MAX_CRIT_PROT_DURATION, NL80211_ATTR_PEER_AID, NL80211_ATTR_COALESCE_RULE, NL80211_ATTR_CH_SWITCH_COUNT, NL80211_ATTR_CH_SWITCH_BLOCK_TX, NL80211_ATTR_CSA_IES, NL80211_ATTR_CSA_C_OFF_BEACON, NL80211_ATTR_CSA_C_OFF_PRESP, NL80211_ATTR_RXMGMT_FLAGS, NL80211_ATTR_STA_SUPPORTED_CHANNELS, NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES, NL80211_ATTR_HANDLE_DFS, NL80211_ATTR_SUPPORT_5_MHZ, NL80211_ATTR_SUPPORT_10_MHZ, NL80211_ATTR_OPMODE_NOTIF, NL80211_ATTR_VENDOR_ID, NL80211_ATTR_VENDOR_SUBCMD, NL80211_ATTR_VENDOR_DATA, NL80211_ATTR_VENDOR_EVENTS, NL80211_ATTR_QOS_MAP, NL80211_ATTR_MAC_HINT, NL80211_ATTR_WIPHY_FREQ_HINT, NL80211_ATTR_MAX_AP_ASSOC_STA, NL80211_ATTR_TDLS_PEER_CAPABILITY, NL80211_ATTR_SOCKET_OWNER, NL80211_ATTR_CSA_C_OFFSETS_TX, NL80211_ATTR_MAX_CSA_COUNTERS, NL80211_ATTR_TDLS_INITIATOR, NL80211_ATTR_USE_RRM, NL80211_ATTR_WIPHY_DYN_ACK, NL80211_ATTR_TSID, NL80211_ATTR_USER_PRIO, NL80211_ATTR_ADMITTED_TIME, NL80211_ATTR_SMPS_MODE, NL80211_ATTR_OPER_CLASS, NL80211_ATTR_MAC_MASK, NL80211_ATTR_WIPHY_SELF_MANAGED_REG, NL80211_ATTR_EXT_FEATURES, NL80211_ATTR_SURVEY_RADIO_STATS, NL80211_ATTR_NETNS_FD, NL80211_ATTR_SCHED_SCAN_DELAY, NL80211_ATTR_REG_INDOOR, NL80211_ATTR_MAX_NUM_SCHED_SCAN_PLANS, NL80211_ATTR_MAX_SCAN_PLAN_INTERVAL, NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS, NL80211_ATTR_SCHED_SCAN_PLANS, NL80211_ATTR_PBSS, NL80211_ATTR_BSS_SELECT, NL80211_ATTR_STA_SUPPORT_P2P_PS, NL80211_ATTR_PAD, NL80211_ATTR_IFTYPE_EXT_CAPA, NL80211_ATTR_MU_MIMO_GROUP_DATA, NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR, NL80211_ATTR_SCAN_START_TIME_TSF, NL80211_ATTR_SCAN_START_TIME_TSF_BSSID, NL80211_ATTR_MEASUREMENT_DURATION, NL80211_ATTR_MEASUREMENT_DURATION_MANDATORY, NL80211_ATTR_MESH_PEER_AID, NL80211_ATTR_NAN_MASTER_PREF, NL80211_ATTR_BANDS, NL80211_ATTR_NAN_FUNC, NL80211_ATTR_NAN_MATCH, NL80211_ATTR_FILS_KEK, NL80211_ATTR_FILS_NONCES, NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED, NL80211_ATTR_BSSID, NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI, NL80211_ATTR_SCHED_SCAN_RSSI_ADJUST, NL80211_ATTR_TIMEOUT_REASON, NL80211_ATTR_FILS_ERP_USERNAME, NL80211_ATTR_FILS_ERP_REALM, NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM, NL80211_ATTR_FILS_ERP_RRK, NL80211_ATTR_FILS_CACHE_ID, NL80211_ATTR_PMK, NL80211_ATTR_SCHED_SCAN_MULTI, NL80211_ATTR_SCHED_SCAN_MAX_REQS, NL80211_ATTR_WANT_1X_4WAY_HS, NL80211_ATTR_PMKR0_NAME, NL80211_ATTR_PORT_AUTHORIZED, NL80211_ATTR_EXTERNAL_AUTH_ACTION, NL80211_ATTR_EXTERNAL_AUTH_SUPPORT, NL80211_ATTR_NSS, NL80211_ATTR_ACK_SIGNAL, NL80211_ATTR_CONTROL_PORT_OVER_NL80211, NL80211_ATTR_TXQ_STATS, NL80211_ATTR_TXQ_LIMIT, NL80211_ATTR_TXQ_MEMORY_LIMIT, NL80211_ATTR_TXQ_QUANTUM, NL80211_ATTR_HE_CAPABILITY, /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, NUM_NL80211_ATTR = __NL80211_ATTR_AFTER_LAST, NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 }; /* source-level API compatibility */ #define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION #define NL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG #define NL80211_ATTR_IFACE_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER #define NL80211_ATTR_SAE_DATA NL80211_ATTR_AUTH_DATA /* * Allow user space programs to use #ifdef on new attributes by defining them * here */ #define NL80211_CMD_CONNECT NL80211_CMD_CONNECT #define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY #define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES #define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS #define NL80211_ATTR_WIPHY_FREQ NL80211_ATTR_WIPHY_FREQ #define NL80211_ATTR_WIPHY_CHANNEL_TYPE NL80211_ATTR_WIPHY_CHANNEL_TYPE #define NL80211_ATTR_MGMT_SUBTYPE NL80211_ATTR_MGMT_SUBTYPE #define NL80211_ATTR_IE NL80211_ATTR_IE #define NL80211_ATTR_REG_INITIATOR NL80211_ATTR_REG_INITIATOR #define NL80211_ATTR_REG_TYPE NL80211_ATTR_REG_TYPE #define NL80211_ATTR_FRAME NL80211_ATTR_FRAME #define NL80211_ATTR_SSID NL80211_ATTR_SSID #define NL80211_ATTR_AUTH_TYPE NL80211_ATTR_AUTH_TYPE #define NL80211_ATTR_REASON_CODE NL80211_ATTR_REASON_CODE #define NL80211_ATTR_CIPHER_SUITES_PAIRWISE NL80211_ATTR_CIPHER_SUITES_PAIRWISE #define NL80211_ATTR_CIPHER_SUITE_GROUP NL80211_ATTR_CIPHER_SUITE_GROUP #define NL80211_ATTR_WPA_VERSIONS NL80211_ATTR_WPA_VERSIONS #define NL80211_ATTR_AKM_SUITES NL80211_ATTR_AKM_SUITES #define NL80211_ATTR_KEY NL80211_ATTR_KEY #define NL80211_ATTR_KEYS NL80211_ATTR_KEYS #define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS #define NL80211_WIPHY_NAME_MAXLEN 64 #define NL80211_MAX_SUPP_RATES 32 #define NL80211_MAX_SUPP_HT_RATES 77 #define NL80211_MAX_SUPP_REG_RULES 64 #define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 #define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 #define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24 #define NL80211_HT_CAPABILITY_LEN 26 #define NL80211_VHT_CAPABILITY_LEN 12 #define NL80211_HE_MIN_CAPABILITY_LEN 16 #define NL80211_HE_MAX_CAPABILITY_LEN 54 #define NL80211_MAX_NR_CIPHER_SUITES 5 #define NL80211_MAX_NR_AKM_SUITES 2 #define NL80211_MIN_REMAIN_ON_CHANNEL_TIME 10 /* default RSSI threshold for scan results if none specified. */ #define NL80211_SCAN_RSSI_THOLD_OFF -300 #define NL80211_CQM_TXE_MAX_INTVL 1800 /** * enum nl80211_iftype - (virtual) interface types * * @NL80211_IFTYPE_UNSPECIFIED: unspecified type, driver decides * @NL80211_IFTYPE_ADHOC: independent BSS member * @NL80211_IFTYPE_STATION: managed BSS member * @NL80211_IFTYPE_AP: access point * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points; VLAN interfaces * are a bit special in that they must always be tied to a pre-existing * AP type interface. * @NL80211_IFTYPE_WDS: wireless distribution interface * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames * @NL80211_IFTYPE_MESH_POINT: mesh point * @NL80211_IFTYPE_P2P_CLIENT: P2P client * @NL80211_IFTYPE_P2P_GO: P2P group owner * @NL80211_IFTYPE_P2P_DEVICE: P2P device interface type, this is not a netdev * and therefore can't be created in the normal ways, use the * %NL80211_CMD_START_P2P_DEVICE and %NL80211_CMD_STOP_P2P_DEVICE * commands to create and destroy one * @NL80211_IF_TYPE_OCB: Outside Context of a BSS * This mode corresponds to the MIB variable dot11OCBActivated=true * @NL80211_IFTYPE_NAN: NAN device interface type (not a netdev) * @NL80211_IFTYPE_MAX: highest interface type number currently defined * @NUM_NL80211_IFTYPES: number of defined interface types * * These values are used with the %NL80211_ATTR_IFTYPE * to set the type of an interface. * */ enum nl80211_iftype { NL80211_IFTYPE_UNSPECIFIED, NL80211_IFTYPE_ADHOC, NL80211_IFTYPE_STATION, NL80211_IFTYPE_AP, NL80211_IFTYPE_AP_VLAN, NL80211_IFTYPE_WDS, NL80211_IFTYPE_MONITOR, NL80211_IFTYPE_MESH_POINT, NL80211_IFTYPE_P2P_CLIENT, NL80211_IFTYPE_P2P_GO, NL80211_IFTYPE_P2P_DEVICE, NL80211_IFTYPE_OCB, NL80211_IFTYPE_NAN, /* keep last */ NUM_NL80211_IFTYPES, NL80211_IFTYPE_MAX = NUM_NL80211_IFTYPES - 1 }; /** * enum nl80211_sta_flags - station flags * * Station flags. When a station is added to an AP interface, it is * assumed to be already associated (and hence authenticated.) * * @__NL80211_STA_FLAG_INVALID: attribute number 0 is reserved * @NL80211_STA_FLAG_AUTHORIZED: station is authorized (802.1X) * @NL80211_STA_FLAG_SHORT_PREAMBLE: station is capable of receiving frames * with short barker preamble * @NL80211_STA_FLAG_WME: station is WME/QoS capable * @NL80211_STA_FLAG_MFP: station uses management frame protection * @NL80211_STA_FLAG_AUTHENTICATED: station is authenticated * @NL80211_STA_FLAG_TDLS_PEER: station is a TDLS peer -- this flag should * only be used in managed mode (even in the flags mask). Note that the * flag can't be changed, it is only valid while adding a station, and * attempts to change it will silently be ignored (rather than rejected * as errors.) * @NL80211_STA_FLAG_ASSOCIATED: station is associated; used with drivers * that support %NL80211_FEATURE_FULL_AP_CLIENT_STATE to transition a * previously added station into associated state * @NL80211_STA_FLAG_MAX: highest station flag number currently defined * @__NL80211_STA_FLAG_AFTER_LAST: internal use */ enum nl80211_sta_flags { __NL80211_STA_FLAG_INVALID, NL80211_STA_FLAG_AUTHORIZED, NL80211_STA_FLAG_SHORT_PREAMBLE, NL80211_STA_FLAG_WME, NL80211_STA_FLAG_MFP, NL80211_STA_FLAG_AUTHENTICATED, NL80211_STA_FLAG_TDLS_PEER, NL80211_STA_FLAG_ASSOCIATED, /* keep last */ __NL80211_STA_FLAG_AFTER_LAST, NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1 }; /** * enum nl80211_sta_p2p_ps_status - station support of P2P PS * * @NL80211_P2P_PS_UNSUPPORTED: station doesn't support P2P PS mechanism * @@NL80211_P2P_PS_SUPPORTED: station supports P2P PS mechanism * @NUM_NL80211_P2P_PS_STATUS: number of values */ enum nl80211_sta_p2p_ps_status { NL80211_P2P_PS_UNSUPPORTED = 0, NL80211_P2P_PS_SUPPORTED, NUM_NL80211_P2P_PS_STATUS, }; #define NL80211_STA_FLAG_MAX_OLD_API NL80211_STA_FLAG_TDLS_PEER /** * struct nl80211_sta_flag_update - station flags mask/set * @mask: mask of station flags to set * @set: which values to set them to * * Both mask and set contain bits as per &enum nl80211_sta_flags. */ struct nl80211_sta_flag_update { __u32 mask; __u32 set; } __attribute__((packed)); /** * enum nl80211_he_gi - HE guard interval * @NL80211_RATE_INFO_HE_GI_0_8: 0.8 usec * @NL80211_RATE_INFO_HE_GI_1_6: 1.6 usec * @NL80211_RATE_INFO_HE_GI_3_2: 3.2 usec */ enum nl80211_he_gi { NL80211_RATE_INFO_HE_GI_0_8, NL80211_RATE_INFO_HE_GI_1_6, NL80211_RATE_INFO_HE_GI_3_2, }; /** * enum nl80211_he_ru_alloc - HE RU allocation values * @NL80211_RATE_INFO_HE_RU_ALLOC_26: 26-tone RU allocation * @NL80211_RATE_INFO_HE_RU_ALLOC_52: 52-tone RU allocation * @NL80211_RATE_INFO_HE_RU_ALLOC_106: 106-tone RU allocation * @NL80211_RATE_INFO_HE_RU_ALLOC_242: 242-tone RU allocation * @NL80211_RATE_INFO_HE_RU_ALLOC_484: 484-tone RU allocation * @NL80211_RATE_INFO_HE_RU_ALLOC_996: 996-tone RU allocation * @NL80211_RATE_INFO_HE_RU_ALLOC_2x996: 2x996-tone RU allocation */ enum nl80211_he_ru_alloc { NL80211_RATE_INFO_HE_RU_ALLOC_26, NL80211_RATE_INFO_HE_RU_ALLOC_52, NL80211_RATE_INFO_HE_RU_ALLOC_106, NL80211_RATE_INFO_HE_RU_ALLOC_242, NL80211_RATE_INFO_HE_RU_ALLOC_484, NL80211_RATE_INFO_HE_RU_ALLOC_996, NL80211_RATE_INFO_HE_RU_ALLOC_2x996, }; /** * enum nl80211_rate_info - bitrate information * * These attribute types are used with %NL80211_STA_INFO_TXRATE * when getting information about the bitrate of a station. * There are 2 attributes for bitrate, a legacy one that represents * a 16-bit value, and new one that represents a 32-bit value. * If the rate value fits into 16 bit, both attributes are reported * with the same value. If the rate is too high to fit into 16 bits * (>6.5535Gbps) only 32-bit attribute is included. * User space tools encouraged to use the 32-bit attribute and fall * back to the 16-bit one for compatibility with older kernels. * * @__NL80211_RATE_INFO_INVALID: attribute number 0 is reserved * @NL80211_RATE_INFO_BITRATE: total bitrate (u16, 100kbit/s) * @NL80211_RATE_INFO_MCS: mcs index for 802.11n (u8) * @NL80211_RATE_INFO_40_MHZ_WIDTH: 40 MHz dualchannel bitrate * @NL80211_RATE_INFO_SHORT_GI: 400ns guard interval * @NL80211_RATE_INFO_BITRATE32: total bitrate (u32, 100kbit/s) * @NL80211_RATE_INFO_MAX: highest rate_info number currently defined * @NL80211_RATE_INFO_VHT_MCS: MCS index for VHT (u8) * @NL80211_RATE_INFO_VHT_NSS: number of streams in VHT (u8) * @NL80211_RATE_INFO_80_MHZ_WIDTH: 80 MHz VHT rate * @NL80211_RATE_INFO_80P80_MHZ_WIDTH: unused - 80+80 is treated the * same as 160 for purposes of the bitrates * @NL80211_RATE_INFO_160_MHZ_WIDTH: 160 MHz VHT rate * @NL80211_RATE_INFO_10_MHZ_WIDTH: 10 MHz width - note that this is * a legacy rate and will be reported as the actual bitrate, i.e. * half the base (20 MHz) rate * @NL80211_RATE_INFO_5_MHZ_WIDTH: 5 MHz width - note that this is * a legacy rate and will be reported as the actual bitrate, i.e. * a quarter of the base (20 MHz) rate * @NL80211_RATE_INFO_HE_MCS: HE MCS index (u8, 0-11) * @NL80211_RATE_INFO_HE_NSS: HE NSS value (u8, 1-8) * @NL80211_RATE_INFO_HE_GI: HE guard interval identifier * (u8, see &enum nl80211_he_gi) * @NL80211_RATE_INFO_HE_DCM: HE DCM value (u8, 0/1) * @NL80211_RATE_INFO_RU_ALLOC: HE RU allocation, if not present then * non-OFDMA was used (u8, see &enum nl80211_he_ru_alloc) * @__NL80211_RATE_INFO_AFTER_LAST: internal use */ enum nl80211_rate_info { __NL80211_RATE_INFO_INVALID, NL80211_RATE_INFO_BITRATE, NL80211_RATE_INFO_MCS, NL80211_RATE_INFO_40_MHZ_WIDTH, NL80211_RATE_INFO_SHORT_GI, NL80211_RATE_INFO_BITRATE32, NL80211_RATE_INFO_VHT_MCS, NL80211_RATE_INFO_VHT_NSS, NL80211_RATE_INFO_80_MHZ_WIDTH, NL80211_RATE_INFO_80P80_MHZ_WIDTH, NL80211_RATE_INFO_160_MHZ_WIDTH, NL80211_RATE_INFO_10_MHZ_WIDTH, NL80211_RATE_INFO_5_MHZ_WIDTH, NL80211_RATE_INFO_HE_MCS, NL80211_RATE_INFO_HE_NSS, NL80211_RATE_INFO_HE_GI, NL80211_RATE_INFO_HE_DCM, NL80211_RATE_INFO_HE_RU_ALLOC, /* keep last */ __NL80211_RATE_INFO_AFTER_LAST, NL80211_RATE_INFO_MAX = __NL80211_RATE_INFO_AFTER_LAST - 1 }; /** * enum nl80211_sta_bss_param - BSS information collected by STA * * These attribute types are used with %NL80211_STA_INFO_BSS_PARAM * when getting information about the bitrate of a station. * * @__NL80211_STA_BSS_PARAM_INVALID: attribute number 0 is reserved * @NL80211_STA_BSS_PARAM_CTS_PROT: whether CTS protection is enabled (flag) * @NL80211_STA_BSS_PARAM_SHORT_PREAMBLE: whether short preamble is enabled * (flag) * @NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME: whether short slot time is enabled * (flag) * @NL80211_STA_BSS_PARAM_DTIM_PERIOD: DTIM period for beaconing (u8) * @NL80211_STA_BSS_PARAM_BEACON_INTERVAL: Beacon interval (u16) * @NL80211_STA_BSS_PARAM_MAX: highest sta_bss_param number currently defined * @__NL80211_STA_BSS_PARAM_AFTER_LAST: internal use */ enum nl80211_sta_bss_param { __NL80211_STA_BSS_PARAM_INVALID, NL80211_STA_BSS_PARAM_CTS_PROT, NL80211_STA_BSS_PARAM_SHORT_PREAMBLE, NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME, NL80211_STA_BSS_PARAM_DTIM_PERIOD, NL80211_STA_BSS_PARAM_BEACON_INTERVAL, /* keep last */ __NL80211_STA_BSS_PARAM_AFTER_LAST, NL80211_STA_BSS_PARAM_MAX = __NL80211_STA_BSS_PARAM_AFTER_LAST - 1 }; /** * enum nl80211_sta_info - station information * * These attribute types are used with %NL80211_ATTR_STA_INFO * when getting information about a station. * * @__NL80211_STA_INFO_INVALID: attribute number 0 is reserved * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs) * @NL80211_STA_INFO_RX_BYTES: total received bytes (MPDU length) * (u32, from this station) * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (MPDU length) * (u32, to this station) * @NL80211_STA_INFO_RX_BYTES64: total received bytes (MPDU length) * (u64, from this station) * @NL80211_STA_INFO_TX_BYTES64: total transmitted bytes (MPDU length) * (u64, to this station) * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm) * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute * containing info as possible, see &enum nl80211_rate_info * @NL80211_STA_INFO_RX_PACKETS: total received packet (MSDUs and MMPDUs) * (u32, from this station) * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (MSDUs and MMPDUs) * (u32, to this station) * @NL80211_STA_INFO_TX_RETRIES: total retries (MPDUs) (u32, to this station) * @NL80211_STA_INFO_TX_FAILED: total failed packets (MPDUs) * (u32, to this station) * @NL80211_STA_INFO_SIGNAL_AVG: signal strength average (u8, dBm) * @NL80211_STA_INFO_LLID: the station's mesh LLID * @NL80211_STA_INFO_PLID: the station's mesh PLID * @NL80211_STA_INFO_PLINK_STATE: peer link state for the station * (see %enum nl80211_plink_state) * @NL80211_STA_INFO_RX_BITRATE: last unicast data frame rx rate, nested * attribute, like NL80211_STA_INFO_TX_BITRATE. * @NL80211_STA_INFO_BSS_PARAM: current station's view of BSS, nested attribute * containing info as possible, see &enum nl80211_sta_bss_param * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update. * @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32) * @NL80211_STA_INFO_T_OFFSET: timing offset with respect to this STA (s64) * @NL80211_STA_INFO_LOCAL_PM: local mesh STA link-specific power mode * @NL80211_STA_INFO_PEER_PM: peer mesh STA link-specific power mode * @NL80211_STA_INFO_NONPEER_PM: neighbor mesh STA power save mode towards * non-peer STA * @NL80211_STA_INFO_CHAIN_SIGNAL: per-chain signal strength of last PPDU * Contains a nested array of signal strength attributes (u8, dBm) * @NL80211_STA_INFO_CHAIN_SIGNAL_AVG: per-chain signal strength average * Same format as NL80211_STA_INFO_CHAIN_SIGNAL. * @NL80211_STA_EXPECTED_THROUGHPUT: expected throughput considering also the * 802.11 header (u32, kbps) * @NL80211_STA_INFO_RX_DROP_MISC: RX packets dropped for unspecified reasons * (u64) * @NL80211_STA_INFO_BEACON_RX: number of beacons received from this peer (u64) * @NL80211_STA_INFO_BEACON_SIGNAL_AVG: signal strength average * for beacons only (u8, dBm) * @NL80211_STA_INFO_TID_STATS: per-TID statistics (see &enum nl80211_tid_stats) * This is a nested attribute where each the inner attribute number is the * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames; * each one of those is again nested with &enum nl80211_tid_stats * attributes carrying the actual values. * @NL80211_STA_INFO_RX_DURATION: aggregate PPDU duration for all frames * received from the station (u64, usec) * @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment * @NL80211_STA_INFO_ACK_SIGNAL: signal strength of the last ACK frame(u8, dBm) * @NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG: avg signal strength of (data) * ACK frame (s8, dBm) * @__NL80211_STA_INFO_AFTER_LAST: internal * @NL80211_STA_INFO_MAX: highest possible station info attribute */ enum nl80211_sta_info { __NL80211_STA_INFO_INVALID, NL80211_STA_INFO_INACTIVE_TIME, NL80211_STA_INFO_RX_BYTES, NL80211_STA_INFO_TX_BYTES, NL80211_STA_INFO_LLID, NL80211_STA_INFO_PLID, NL80211_STA_INFO_PLINK_STATE, NL80211_STA_INFO_SIGNAL, NL80211_STA_INFO_TX_BITRATE, NL80211_STA_INFO_RX_PACKETS, NL80211_STA_INFO_TX_PACKETS, NL80211_STA_INFO_TX_RETRIES, NL80211_STA_INFO_TX_FAILED, NL80211_STA_INFO_SIGNAL_AVG, NL80211_STA_INFO_RX_BITRATE, NL80211_STA_INFO_BSS_PARAM, NL80211_STA_INFO_CONNECTED_TIME, NL80211_STA_INFO_STA_FLAGS, NL80211_STA_INFO_BEACON_LOSS, NL80211_STA_INFO_T_OFFSET, NL80211_STA_INFO_LOCAL_PM, NL80211_STA_INFO_PEER_PM, NL80211_STA_INFO_NONPEER_PM, NL80211_STA_INFO_RX_BYTES64, NL80211_STA_INFO_TX_BYTES64, NL80211_STA_INFO_CHAIN_SIGNAL, NL80211_STA_INFO_CHAIN_SIGNAL_AVG, NL80211_STA_INFO_EXPECTED_THROUGHPUT, NL80211_STA_INFO_RX_DROP_MISC, NL80211_STA_INFO_BEACON_RX, NL80211_STA_INFO_BEACON_SIGNAL_AVG, NL80211_STA_INFO_TID_STATS, NL80211_STA_INFO_RX_DURATION, NL80211_STA_INFO_PAD, NL80211_STA_INFO_ACK_SIGNAL, NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG, /* keep last */ __NL80211_STA_INFO_AFTER_LAST, NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1 }; /** * enum nl80211_tid_stats - per TID statistics attributes * @__NL80211_TID_STATS_INVALID: attribute number 0 is reserved * @NL80211_TID_STATS_RX_MSDU: number of MSDUs received (u64) * @NL80211_TID_STATS_TX_MSDU: number of MSDUs transmitted (or * attempted to transmit; u64) * @NL80211_TID_STATS_TX_MSDU_RETRIES: number of retries for * transmitted MSDUs (not counting the first attempt; u64) * @NL80211_TID_STATS_TX_MSDU_FAILED: number of failed transmitted * MSDUs (u64) * @NL80211_TID_STATS_PAD: attribute used for padding for 64-bit alignment * @NL80211_TID_STATS_TXQ_STATS: TXQ stats (nested attribute) * @NUM_NL80211_TID_STATS: number of attributes here * @NL80211_TID_STATS_MAX: highest numbered attribute here */ enum nl80211_tid_stats { __NL80211_TID_STATS_INVALID, NL80211_TID_STATS_RX_MSDU, NL80211_TID_STATS_TX_MSDU, NL80211_TID_STATS_TX_MSDU_RETRIES, NL80211_TID_STATS_TX_MSDU_FAILED, NL80211_TID_STATS_PAD, NL80211_TID_STATS_TXQ_STATS, /* keep last */ NUM_NL80211_TID_STATS, NL80211_TID_STATS_MAX = NUM_NL80211_TID_STATS - 1 }; /** * enum nl80211_txq_stats - per TXQ statistics attributes * @__NL80211_TXQ_STATS_INVALID: attribute number 0 is reserved * @NUM_NL80211_TXQ_STATS: number of attributes here * @NL80211_TXQ_STATS_BACKLOG_BYTES: number of bytes currently backlogged * @NL80211_TXQ_STATS_BACKLOG_PACKETS: number of packets currently * backlogged * @NL80211_TXQ_STATS_FLOWS: total number of new flows seen * @NL80211_TXQ_STATS_DROPS: total number of packet drops * @NL80211_TXQ_STATS_ECN_MARKS: total number of packet ECN marks * @NL80211_TXQ_STATS_OVERLIMIT: number of drops due to queue space overflow * @NL80211_TXQ_STATS_OVERMEMORY: number of drops due to memory limit overflow * (only for per-phy stats) * @NL80211_TXQ_STATS_COLLISIONS: number of hash collisions * @NL80211_TXQ_STATS_TX_BYTES: total number of bytes dequeued from TXQ * @NL80211_TXQ_STATS_TX_PACKETS: total number of packets dequeued from TXQ * @NL80211_TXQ_STATS_MAX_FLOWS: number of flow buckets for PHY * @NL80211_TXQ_STATS_MAX: highest numbered attribute here */ enum nl80211_txq_stats { __NL80211_TXQ_STATS_INVALID, NL80211_TXQ_STATS_BACKLOG_BYTES, NL80211_TXQ_STATS_BACKLOG_PACKETS, NL80211_TXQ_STATS_FLOWS, NL80211_TXQ_STATS_DROPS, NL80211_TXQ_STATS_ECN_MARKS, NL80211_TXQ_STATS_OVERLIMIT, NL80211_TXQ_STATS_OVERMEMORY, NL80211_TXQ_STATS_COLLISIONS, NL80211_TXQ_STATS_TX_BYTES, NL80211_TXQ_STATS_TX_PACKETS, NL80211_TXQ_STATS_MAX_FLOWS, /* keep last */ NUM_NL80211_TXQ_STATS, NL80211_TXQ_STATS_MAX = NUM_NL80211_TXQ_STATS - 1 }; /** * enum nl80211_mpath_flags - nl80211 mesh path flags * * @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active * @NL80211_MPATH_FLAG_RESOLVING: the mesh path discovery process is running * @NL80211_MPATH_FLAG_SN_VALID: the mesh path contains a valid SN * @NL80211_MPATH_FLAG_FIXED: the mesh path has been manually set * @NL80211_MPATH_FLAG_RESOLVED: the mesh path discovery process succeeded */ enum nl80211_mpath_flags { NL80211_MPATH_FLAG_ACTIVE = 1<<0, NL80211_MPATH_FLAG_RESOLVING = 1<<1, NL80211_MPATH_FLAG_SN_VALID = 1<<2, NL80211_MPATH_FLAG_FIXED = 1<<3, NL80211_MPATH_FLAG_RESOLVED = 1<<4, }; /** * enum nl80211_mpath_info - mesh path information * * These attribute types are used with %NL80211_ATTR_MPATH_INFO when getting * information about a mesh path. * * @__NL80211_MPATH_INFO_INVALID: attribute number 0 is reserved * @NL80211_MPATH_INFO_FRAME_QLEN: number of queued frames for this destination * @NL80211_MPATH_INFO_SN: destination sequence number * @NL80211_MPATH_INFO_METRIC: metric (cost) of this mesh path * @NL80211_MPATH_INFO_EXPTIME: expiration time for the path, in msec from now * @NL80211_MPATH_INFO_FLAGS: mesh path flags, enumerated in * &enum nl80211_mpath_flags; * @NL80211_MPATH_INFO_DISCOVERY_TIMEOUT: total path discovery timeout, in msec * @NL80211_MPATH_INFO_DISCOVERY_RETRIES: mesh path discovery retries * @NL80211_MPATH_INFO_MAX: highest mesh path information attribute number * currently defind * @__NL80211_MPATH_INFO_AFTER_LAST: internal use */ enum nl80211_mpath_info { __NL80211_MPATH_INFO_INVALID, NL80211_MPATH_INFO_FRAME_QLEN, NL80211_MPATH_INFO_SN, NL80211_MPATH_INFO_METRIC, NL80211_MPATH_INFO_EXPTIME, NL80211_MPATH_INFO_FLAGS, NL80211_MPATH_INFO_DISCOVERY_TIMEOUT, NL80211_MPATH_INFO_DISCOVERY_RETRIES, /* keep last */ __NL80211_MPATH_INFO_AFTER_LAST, NL80211_MPATH_INFO_MAX = __NL80211_MPATH_INFO_AFTER_LAST - 1 }; /** * enum nl80211_band_iftype_attr - Interface type data attributes * * @__NL80211_BAND_IFTYPE_ATTR_INVALID: attribute number 0 is reserved * @NL80211_BAND_IFTYPE_ATTR_IFTYPES: nested attribute containing a flag attribute * for each interface type that supports the band data * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_MAC: HE MAC capabilities as in HE * capabilities IE * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY: HE PHY capabilities as in HE * capabilities IE * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET: HE supported NSS/MCS as in HE * capabilities IE * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE: HE PPE thresholds information as * defined in HE capabilities IE * @NL80211_BAND_IFTYPE_ATTR_MAX: highest band HE capability attribute currently * defined * @__NL80211_BAND_IFTYPE_ATTR_AFTER_LAST: internal use */ enum nl80211_band_iftype_attr { __NL80211_BAND_IFTYPE_ATTR_INVALID, NL80211_BAND_IFTYPE_ATTR_IFTYPES, NL80211_BAND_IFTYPE_ATTR_HE_CAP_MAC, NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY, NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET, NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE, /* keep last */ __NL80211_BAND_IFTYPE_ATTR_AFTER_LAST, NL80211_BAND_IFTYPE_ATTR_MAX = __NL80211_BAND_IFTYPE_ATTR_AFTER_LAST - 1 }; /** * enum nl80211_band_attr - band attributes * @__NL80211_BAND_ATTR_INVALID: attribute number 0 is reserved * @NL80211_BAND_ATTR_FREQS: supported frequencies in this band, * an array of nested frequency attributes * @NL80211_BAND_ATTR_RATES: supported bitrates in this band, * an array of nested bitrate attributes * @NL80211_BAND_ATTR_HT_MCS_SET: 16-byte attribute containing the MCS set as * defined in 802.11n * @NL80211_BAND_ATTR_HT_CAPA: HT capabilities, as in the HT information IE * @NL80211_BAND_ATTR_HT_AMPDU_FACTOR: A-MPDU factor, as in 11n * @NL80211_BAND_ATTR_HT_AMPDU_DENSITY: A-MPDU density, as in 11n * @NL80211_BAND_ATTR_VHT_MCS_SET: 32-byte attribute containing the MCS set as * defined in 802.11ac * @NL80211_BAND_ATTR_VHT_CAPA: VHT capabilities, as in the HT information IE * @NL80211_BAND_ATTR_IFTYPE_DATA: nested array attribute, with each entry using * attributes from &enum nl80211_band_iftype_attr * @NL80211_BAND_ATTR_MAX: highest band attribute currently defined * @__NL80211_BAND_ATTR_AFTER_LAST: internal use */ enum nl80211_band_attr { __NL80211_BAND_ATTR_INVALID, NL80211_BAND_ATTR_FREQS, NL80211_BAND_ATTR_RATES, NL80211_BAND_ATTR_HT_MCS_SET, NL80211_BAND_ATTR_HT_CAPA, NL80211_BAND_ATTR_HT_AMPDU_FACTOR, NL80211_BAND_ATTR_HT_AMPDU_DENSITY, NL80211_BAND_ATTR_VHT_MCS_SET, NL80211_BAND_ATTR_VHT_CAPA, NL80211_BAND_ATTR_IFTYPE_DATA, /* keep last */ __NL80211_BAND_ATTR_AFTER_LAST, NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1 }; #define NL80211_BAND_ATTR_HT_CAPA NL80211_BAND_ATTR_HT_CAPA /** * enum nl80211_wmm_rule - regulatory wmm rule * * @__NL80211_WMMR_INVALID: attribute number 0 is reserved * @NL80211_WMMR_CW_MIN: Minimum contention window slot. * @NL80211_WMMR_CW_MAX: Maximum contention window slot. * @NL80211_WMMR_AIFSN: Arbitration Inter Frame Space. * @NL80211_WMMR_TXOP: Maximum allowed tx operation time. * @nl80211_WMMR_MAX: highest possible wmm rule. * @__NL80211_WMMR_LAST: Internal use. */ enum nl80211_wmm_rule { __NL80211_WMMR_INVALID, NL80211_WMMR_CW_MIN, NL80211_WMMR_CW_MAX, NL80211_WMMR_AIFSN, NL80211_WMMR_TXOP, /* keep last */ __NL80211_WMMR_LAST, NL80211_WMMR_MAX = __NL80211_WMMR_LAST - 1 }; /** * enum nl80211_frequency_attr - frequency attributes * @__NL80211_FREQUENCY_ATTR_INVALID: attribute number 0 is reserved * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz * @NL80211_FREQUENCY_ATTR_DISABLED: Channel is disabled in current * regulatory domain. * @NL80211_FREQUENCY_ATTR_NO_IR: no mechanisms that initiate radiation * are permitted on this channel, this includes sending probe * requests, or modes of operation that require beaconing. * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory * on this channel in current regulatory domain. * @NL80211_FREQUENCY_ATTR_MAX_TX_POWER: Maximum transmission power in mBm * (100 * dBm). * @NL80211_FREQUENCY_ATTR_DFS_STATE: current state for DFS * (enum nl80211_dfs_state) * @NL80211_FREQUENCY_ATTR_DFS_TIME: time in miliseconds for how long * this channel is in this DFS state. * @NL80211_FREQUENCY_ATTR_NO_HT40_MINUS: HT40- isn't possible with this * channel as the control channel * @NL80211_FREQUENCY_ATTR_NO_HT40_PLUS: HT40+ isn't possible with this * channel as the control channel * @NL80211_FREQUENCY_ATTR_NO_80MHZ: any 80 MHz channel using this channel * as the primary or any of the secondary channels isn't possible, * this includes 80+80 channels * @NL80211_FREQUENCY_ATTR_NO_160MHZ: any 160 MHz (but not 80+80) channel * using this channel as the primary or any of the secondary channels * isn't possible * @NL80211_FREQUENCY_ATTR_DFS_CAC_TIME: DFS CAC time in milliseconds. * @NL80211_FREQUENCY_ATTR_INDOOR_ONLY: Only indoor use is permitted on this * channel. A channel that has the INDOOR_ONLY attribute can only be * used when there is a clear assessment that the device is operating in * an indoor surroundings, i.e., it is connected to AC power (and not * through portable DC inverters) or is under the control of a master * that is acting as an AP and is connected to AC power. * @NL80211_FREQUENCY_ATTR_IR_CONCURRENT: IR operation is allowed on this * channel if it's connected concurrently to a BSS on the same channel on * the 2 GHz band or to a channel in the same UNII band (on the 5 GHz * band), and IEEE80211_CHAN_RADAR is not set. Instantiating a GO or TDLS * off-channel on a channel that has the IR_CONCURRENT attribute set can be * done when there is a clear assessment that the device is operating under * the guidance of an authorized master, i.e., setting up a GO or TDLS * off-channel while the device is also connected to an AP with DFS and * radar detection on the UNII band (it is up to user-space, i.e., * wpa_supplicant to perform the required verifications). Using this * attribute for IR is disallowed for master interfaces (IBSS, AP). * @NL80211_FREQUENCY_ATTR_NO_20MHZ: 20 MHz operation is not allowed * on this channel in current regulatory domain. * @NL80211_FREQUENCY_ATTR_NO_10MHZ: 10 MHz operation is not allowed * on this channel in current regulatory domain. * @NL80211_FREQUENCY_ATTR_WMM: this channel has wmm limitations. * This is a nested attribute that contains the wmm limitation per AC. * (see &enum nl80211_wmm_rule) * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number * currently defined * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use * * See https://apps.fcc.gov/eas/comments/GetPublishedDocument.html?id=327&tn=528122 * for more information on the FCC description of the relaxations allowed * by NL80211_FREQUENCY_ATTR_INDOOR_ONLY and * NL80211_FREQUENCY_ATTR_IR_CONCURRENT. */ enum nl80211_frequency_attr { __NL80211_FREQUENCY_ATTR_INVALID, NL80211_FREQUENCY_ATTR_FREQ, NL80211_FREQUENCY_ATTR_DISABLED, NL80211_FREQUENCY_ATTR_NO_IR, __NL80211_FREQUENCY_ATTR_NO_IBSS, NL80211_FREQUENCY_ATTR_RADAR, NL80211_FREQUENCY_ATTR_MAX_TX_POWER, NL80211_FREQUENCY_ATTR_DFS_STATE, NL80211_FREQUENCY_ATTR_DFS_TIME, NL80211_FREQUENCY_ATTR_NO_HT40_MINUS, NL80211_FREQUENCY_ATTR_NO_HT40_PLUS, NL80211_FREQUENCY_ATTR_NO_80MHZ, NL80211_FREQUENCY_ATTR_NO_160MHZ, NL80211_FREQUENCY_ATTR_DFS_CAC_TIME, NL80211_FREQUENCY_ATTR_INDOOR_ONLY, NL80211_FREQUENCY_ATTR_IR_CONCURRENT, NL80211_FREQUENCY_ATTR_NO_20MHZ, NL80211_FREQUENCY_ATTR_NO_10MHZ, NL80211_FREQUENCY_ATTR_WMM, /* keep last */ __NL80211_FREQUENCY_ATTR_AFTER_LAST, NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1 }; #define NL80211_FREQUENCY_ATTR_MAX_TX_POWER NL80211_FREQUENCY_ATTR_MAX_TX_POWER #define NL80211_FREQUENCY_ATTR_PASSIVE_SCAN NL80211_FREQUENCY_ATTR_NO_IR #define NL80211_FREQUENCY_ATTR_NO_IBSS NL80211_FREQUENCY_ATTR_NO_IR #define NL80211_FREQUENCY_ATTR_NO_IR NL80211_FREQUENCY_ATTR_NO_IR #define NL80211_FREQUENCY_ATTR_GO_CONCURRENT \ NL80211_FREQUENCY_ATTR_IR_CONCURRENT /** * enum nl80211_bitrate_attr - bitrate attributes * @__NL80211_BITRATE_ATTR_INVALID: attribute number 0 is reserved * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps * @NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE: Short preamble supported * in 2.4 GHz band. * @NL80211_BITRATE_ATTR_MAX: highest bitrate attribute number * currently defined * @__NL80211_BITRATE_ATTR_AFTER_LAST: internal use */ enum nl80211_bitrate_attr { __NL80211_BITRATE_ATTR_INVALID, NL80211_BITRATE_ATTR_RATE, NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE, /* keep last */ __NL80211_BITRATE_ATTR_AFTER_LAST, NL80211_BITRATE_ATTR_MAX = __NL80211_BITRATE_ATTR_AFTER_LAST - 1 }; /** * enum nl80211_initiator - Indicates the initiator of a reg domain request * @NL80211_REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world * regulatory domain. * @NL80211_REGDOM_SET_BY_USER: User asked the wireless core to set the * regulatory domain. * @NL80211_REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the * wireless core it thinks its knows the regulatory domain we should be in. * @NL80211_REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an * 802.11 country information element with regulatory information it * thinks we should consider. cfg80211 only processes the country * code from the IE, and relies on the regulatory domain information * structure passed by userspace (CRDA) from our wireless-regdb. * If a channel is enabled but the country code indicates it should * be disabled we disable the channel and re-enable it upon disassociation. */ enum nl80211_reg_initiator { NL80211_REGDOM_SET_BY_CORE, NL80211_REGDOM_SET_BY_USER, NL80211_REGDOM_SET_BY_DRIVER, NL80211_REGDOM_SET_BY_COUNTRY_IE, }; /** * enum nl80211_reg_type - specifies the type of regulatory domain * @NL80211_REGDOM_TYPE_COUNTRY: the regulatory domain set is one that pertains * to a specific country. When this is set you can count on the * ISO / IEC 3166 alpha2 country code being valid. * @NL80211_REGDOM_TYPE_WORLD: the regulatory set domain is the world regulatory * domain. * @NL80211_REGDOM_TYPE_CUSTOM_WORLD: the regulatory domain set is a custom * driver specific world regulatory domain. These do not apply system-wide * and are only applicable to the individual devices which have requested * them to be applied. * @NL80211_REGDOM_TYPE_INTERSECTION: the regulatory domain set is the product * of an intersection between two regulatory domains -- the previously * set regulatory domain on the system and the last accepted regulatory * domain request to be processed. */ enum nl80211_reg_type { NL80211_REGDOM_TYPE_COUNTRY, NL80211_REGDOM_TYPE_WORLD, NL80211_REGDOM_TYPE_CUSTOM_WORLD, NL80211_REGDOM_TYPE_INTERSECTION, }; /** * enum nl80211_reg_rule_attr - regulatory rule attributes * @__NL80211_REG_RULE_ATTR_INVALID: attribute number 0 is reserved * @NL80211_ATTR_REG_RULE_FLAGS: a set of flags which specify additional * considerations for a given frequency range. These are the * &enum nl80211_reg_rule_flags. * @NL80211_ATTR_FREQ_RANGE_START: starting frequencry for the regulatory * rule in KHz. This is not a center of frequency but an actual regulatory * band edge. * @NL80211_ATTR_FREQ_RANGE_END: ending frequency for the regulatory rule * in KHz. This is not a center a frequency but an actual regulatory * band edge. * @NL80211_ATTR_FREQ_RANGE_MAX_BW: maximum allowed bandwidth for this * frequency range, in KHz. * @NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN: the maximum allowed antenna gain * for a given frequency range. The value is in mBi (100 * dBi). * If you don't have one then don't send this. * @NL80211_ATTR_POWER_RULE_MAX_EIRP: the maximum allowed EIRP for * a given frequency range. The value is in mBm (100 * dBm). * @NL80211_ATTR_DFS_CAC_TIME: DFS CAC time in milliseconds. * If not present or 0 default CAC time will be used. * @NL80211_REG_RULE_ATTR_MAX: highest regulatory rule attribute number * currently defined * @__NL80211_REG_RULE_ATTR_AFTER_LAST: internal use */ enum nl80211_reg_rule_attr { __NL80211_REG_RULE_ATTR_INVALID, NL80211_ATTR_REG_RULE_FLAGS, NL80211_ATTR_FREQ_RANGE_START, NL80211_ATTR_FREQ_RANGE_END, NL80211_ATTR_FREQ_RANGE_MAX_BW, NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN, NL80211_ATTR_POWER_RULE_MAX_EIRP, NL80211_ATTR_DFS_CAC_TIME, /* keep last */ __NL80211_REG_RULE_ATTR_AFTER_LAST, NL80211_REG_RULE_ATTR_MAX = __NL80211_REG_RULE_ATTR_AFTER_LAST - 1 }; /** * enum nl80211_sched_scan_match_attr - scheduled scan match attributes * @__NL80211_SCHED_SCAN_MATCH_ATTR_INVALID: attribute number 0 is reserved * @NL80211_SCHED_SCAN_MATCH_ATTR_SSID: SSID to be used for matching, * only report BSS with matching SSID. * (This cannot be used together with BSSID.) * @NL80211_SCHED_SCAN_MATCH_ATTR_RSSI: RSSI threshold (in dBm) for reporting a * BSS in scan results. Filtering is turned off if not specified. Note that * if this attribute is in a match set of its own, then it is treated as * the default value for all matchsets with an SSID, rather than being a * matchset of its own without an RSSI filter. This is due to problems with * how this API was implemented in the past. Also, due to the same problem, * the only way to create a matchset with only an RSSI filter (with this * attribute) is if there's only a single matchset with the RSSI attribute. * @NL80211_SCHED_SCAN_MATCH_ATTR_RELATIVE_RSSI: Flag indicating whether * %NL80211_SCHED_SCAN_MATCH_ATTR_RSSI to be used as absolute RSSI or * relative to current bss's RSSI. * @NL80211_SCHED_SCAN_MATCH_ATTR_RSSI_ADJUST: When present the RSSI level for * BSS-es in the specified band is to be adjusted before doing * RSSI-based BSS selection. The attribute value is a packed structure * value as specified by &struct nl80211_bss_select_rssi_adjust. * @NL80211_SCHED_SCAN_MATCH_ATTR_BSSID: BSSID to be used for matching * (this cannot be used together with SSID). * @NL80211_SCHED_SCAN_MATCH_ATTR_MAX: highest scheduled scan filter * attribute number currently defined * @__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST: internal use */ enum nl80211_sched_scan_match_attr { __NL80211_SCHED_SCAN_MATCH_ATTR_INVALID, NL80211_SCHED_SCAN_MATCH_ATTR_SSID, NL80211_SCHED_SCAN_MATCH_ATTR_RSSI, NL80211_SCHED_SCAN_MATCH_ATTR_RELATIVE_RSSI, NL80211_SCHED_SCAN_MATCH_ATTR_RSSI_ADJUST, NL80211_SCHED_SCAN_MATCH_ATTR_BSSID, /* keep last */ __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST, NL80211_SCHED_SCAN_MATCH_ATTR_MAX = __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST - 1 }; /* only for backward compatibility */ #define NL80211_ATTR_SCHED_SCAN_MATCH_SSID NL80211_SCHED_SCAN_MATCH_ATTR_SSID /** * enum nl80211_reg_rule_flags - regulatory rule flags * * @NL80211_RRF_NO_OFDM: OFDM modulation not allowed * @NL80211_RRF_NO_CCK: CCK modulation not allowed * @NL80211_RRF_NO_INDOOR: indoor operation not allowed * @NL80211_RRF_NO_OUTDOOR: outdoor operation not allowed * @NL80211_RRF_DFS: DFS support is required to be used * @NL80211_RRF_PTP_ONLY: this is only for Point To Point links * @NL80211_RRF_PTMP_ONLY: this is only for Point To Multi Point links * @NL80211_RRF_NO_IR: no mechanisms that initiate radiation are allowed, * this includes probe requests or modes of operation that require * beaconing. * @NL80211_RRF_AUTO_BW: maximum available bandwidth should be calculated * base on contiguous rules and wider channels will be allowed to cross * multiple contiguous/overlapping frequency ranges. * @NL80211_RRF_IR_CONCURRENT: See %NL80211_FREQUENCY_ATTR_IR_CONCURRENT * @NL80211_RRF_NO_HT40MINUS: channels can't be used in HT40- operation * @NL80211_RRF_NO_HT40PLUS: channels can't be used in HT40+ operation * @NL80211_RRF_NO_80MHZ: 80MHz operation not allowed * @NL80211_RRF_NO_160MHZ: 160MHz operation not allowed */ enum nl80211_reg_rule_flags { NL80211_RRF_NO_OFDM = 1<<0, NL80211_RRF_NO_CCK = 1<<1, NL80211_RRF_NO_INDOOR = 1<<2, NL80211_RRF_NO_OUTDOOR = 1<<3, NL80211_RRF_DFS = 1<<4, NL80211_RRF_PTP_ONLY = 1<<5, NL80211_RRF_PTMP_ONLY = 1<<6, NL80211_RRF_NO_IR = 1<<7, __NL80211_RRF_NO_IBSS = 1<<8, NL80211_RRF_AUTO_BW = 1<<11, NL80211_RRF_IR_CONCURRENT = 1<<12, NL80211_RRF_NO_HT40MINUS = 1<<13, NL80211_RRF_NO_HT40PLUS = 1<<14, NL80211_RRF_NO_80MHZ = 1<<15, NL80211_RRF_NO_160MHZ = 1<<16, }; #define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR #define NL80211_RRF_NO_IBSS NL80211_RRF_NO_IR #define NL80211_RRF_NO_IR NL80211_RRF_NO_IR #define NL80211_RRF_NO_HT40 (NL80211_RRF_NO_HT40MINUS |\ NL80211_RRF_NO_HT40PLUS) #define NL80211_RRF_GO_CONCURRENT NL80211_RRF_IR_CONCURRENT /* For backport compatibility with older userspace */ #define NL80211_RRF_NO_IR_ALL (NL80211_RRF_NO_IR | __NL80211_RRF_NO_IBSS) /** * enum nl80211_dfs_regions - regulatory DFS regions * * @NL80211_DFS_UNSET: Country has no DFS master region specified * @NL80211_DFS_FCC: Country follows DFS master rules from FCC * @NL80211_DFS_ETSI: Country follows DFS master rules from ETSI * @NL80211_DFS_JP: Country follows DFS master rules from JP/MKK/Telec */ enum nl80211_dfs_regions { NL80211_DFS_UNSET = 0, NL80211_DFS_FCC = 1, NL80211_DFS_ETSI = 2, NL80211_DFS_JP = 3, }; /** * enum nl80211_user_reg_hint_type - type of user regulatory hint * * @NL80211_USER_REG_HINT_USER: a user sent the hint. This is always * assumed if the attribute is not set. * @NL80211_USER_REG_HINT_CELL_BASE: the hint comes from a cellular * base station. Device drivers that have been tested to work * properly to support this type of hint can enable these hints * by setting the NL80211_FEATURE_CELL_BASE_REG_HINTS feature * capability on the struct wiphy. The wireless core will * ignore all cell base station hints until at least one device * present has been registered with the wireless core that * has listed NL80211_FEATURE_CELL_BASE_REG_HINTS as a * supported feature. * @NL80211_USER_REG_HINT_INDOOR: a user sent an hint indicating that the * platform is operating in an indoor environment. */ enum nl80211_user_reg_hint_type { NL80211_USER_REG_HINT_USER = 0, NL80211_USER_REG_HINT_CELL_BASE = 1, NL80211_USER_REG_HINT_INDOOR = 2, }; /** * enum nl80211_survey_info - survey information * * These attribute types are used with %NL80211_ATTR_SURVEY_INFO * when getting information about a survey. * * @__NL80211_SURVEY_INFO_INVALID: attribute number 0 is reserved * @NL80211_SURVEY_INFO_FREQUENCY: center frequency of channel * @NL80211_SURVEY_INFO_NOISE: noise level of channel (u8, dBm) * @NL80211_SURVEY_INFO_IN_USE: channel is currently being used * @NL80211_SURVEY_INFO_TIME: amount of time (in ms) that the radio * was turned on (on channel or globally) * @NL80211_SURVEY_INFO_TIME_BUSY: amount of the time the primary * channel was sensed busy (either due to activity or energy detect) * @NL80211_SURVEY_INFO_TIME_EXT_BUSY: amount of time the extension * channel was sensed busy * @NL80211_SURVEY_INFO_TIME_RX: amount of time the radio spent * receiving data (on channel or globally) * @NL80211_SURVEY_INFO_TIME_TX: amount of time the radio spent * transmitting data (on channel or globally) * @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan * (on this channel or globally) * @NL80211_SURVEY_INFO_PAD: attribute used for padding for 64-bit alignment * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number * currently defined * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use */ enum nl80211_survey_info { __NL80211_SURVEY_INFO_INVALID, NL80211_SURVEY_INFO_FREQUENCY, NL80211_SURVEY_INFO_NOISE, NL80211_SURVEY_INFO_IN_USE, NL80211_SURVEY_INFO_TIME, NL80211_SURVEY_INFO_TIME_BUSY, NL80211_SURVEY_INFO_TIME_EXT_BUSY, NL80211_SURVEY_INFO_TIME_RX, NL80211_SURVEY_INFO_TIME_TX, NL80211_SURVEY_INFO_TIME_SCAN, NL80211_SURVEY_INFO_PAD, /* keep last */ __NL80211_SURVEY_INFO_AFTER_LAST, NL80211_SURVEY_INFO_MAX = __NL80211_SURVEY_INFO_AFTER_LAST - 1 }; /* keep old names for compatibility */ #define NL80211_SURVEY_INFO_CHANNEL_TIME NL80211_SURVEY_INFO_TIME #define NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY NL80211_SURVEY_INFO_TIME_BUSY #define NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY NL80211_SURVEY_INFO_TIME_EXT_BUSY #define NL80211_SURVEY_INFO_CHANNEL_TIME_RX NL80211_SURVEY_INFO_TIME_RX #define NL80211_SURVEY_INFO_CHANNEL_TIME_TX NL80211_SURVEY_INFO_TIME_TX /** * enum nl80211_mntr_flags - monitor configuration flags * * Monitor configuration flags. * * @__NL80211_MNTR_FLAG_INVALID: reserved * * @NL80211_MNTR_FLAG_FCSFAIL: pass frames with bad FCS * @NL80211_MNTR_FLAG_PLCPFAIL: pass frames with bad PLCP * @NL80211_MNTR_FLAG_CONTROL: pass control frames * @NL80211_MNTR_FLAG_OTHER_BSS: disable BSSID filtering * @NL80211_MNTR_FLAG_COOK_FRAMES: report frames after processing. * overrides all other flags. * @NL80211_MNTR_FLAG_ACTIVE: use the configured MAC address * and ACK incoming unicast packets. * * @__NL80211_MNTR_FLAG_AFTER_LAST: internal use * @NL80211_MNTR_FLAG_MAX: highest possible monitor flag */ enum nl80211_mntr_flags { __NL80211_MNTR_FLAG_INVALID, NL80211_MNTR_FLAG_FCSFAIL, NL80211_MNTR_FLAG_PLCPFAIL, NL80211_MNTR_FLAG_CONTROL, NL80211_MNTR_FLAG_OTHER_BSS, NL80211_MNTR_FLAG_COOK_FRAMES, NL80211_MNTR_FLAG_ACTIVE, /* keep last */ __NL80211_MNTR_FLAG_AFTER_LAST, NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1 }; /** * enum nl80211_mesh_power_mode - mesh power save modes * * @NL80211_MESH_POWER_UNKNOWN: The mesh power mode of the mesh STA is * not known or has not been set yet. * @NL80211_MESH_POWER_ACTIVE: Active mesh power mode. The mesh STA is * in Awake state all the time. * @NL80211_MESH_POWER_LIGHT_SLEEP: Light sleep mode. The mesh STA will * alternate between Active and Doze states, but will wake up for * neighbor's beacons. * @NL80211_MESH_POWER_DEEP_SLEEP: Deep sleep mode. The mesh STA will * alternate between Active and Doze states, but may not wake up * for neighbor's beacons. * * @__NL80211_MESH_POWER_AFTER_LAST - internal use * @NL80211_MESH_POWER_MAX - highest possible power save level */ enum nl80211_mesh_power_mode { NL80211_MESH_POWER_UNKNOWN, NL80211_MESH_POWER_ACTIVE, NL80211_MESH_POWER_LIGHT_SLEEP, NL80211_MESH_POWER_DEEP_SLEEP, __NL80211_MESH_POWER_AFTER_LAST, NL80211_MESH_POWER_MAX = __NL80211_MESH_POWER_AFTER_LAST - 1 }; /** * enum nl80211_meshconf_params - mesh configuration parameters * * Mesh configuration parameters. These can be changed while the mesh is * active. * * @__NL80211_MESHCONF_INVALID: internal use * * @NL80211_MESHCONF_RETRY_TIMEOUT: specifies the initial retry timeout in * millisecond units, used by the Peer Link Open message * * @NL80211_MESHCONF_CONFIRM_TIMEOUT: specifies the initial confirm timeout, in * millisecond units, used by the peer link management to close a peer link * * @NL80211_MESHCONF_HOLDING_TIMEOUT: specifies the holding timeout, in * millisecond units * * @NL80211_MESHCONF_MAX_PEER_LINKS: maximum number of peer links allowed * on this mesh interface * * @NL80211_MESHCONF_MAX_RETRIES: specifies the maximum number of peer link * open retries that can be sent to establish a new peer link instance in a * mesh * * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh * point. * * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically open * peer links when we detect compatible mesh peers. Disabled if * @NL80211_MESH_SETUP_USERSPACE_MPM or @NL80211_MESH_SETUP_USERSPACE_AMPE are * set. * * @NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES: the number of action frames * containing a PREQ that an MP can send to a particular destination (path * target) * * @NL80211_MESHCONF_PATH_REFRESH_TIME: how frequently to refresh mesh paths * (in milliseconds) * * @NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT: minimum length of time to wait * until giving up on a path discovery (in milliseconds) * * @NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT: The time (in TUs) for which mesh * points receiving a PREQ shall consider the forwarding information from * the root to be valid. (TU = time unit) * * @NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL: The minimum interval of time (in * TUs) during which an MP can send only one action frame containing a PREQ * reference element * * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs) * that it takes for an HWMP information element to propagate across the * mesh * * @NL80211_MESHCONF_HWMP_ROOTMODE: whether root mode is enabled or not * * @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a * source mesh point for path selection elements. * * @NL80211_MESHCONF_HWMP_RANN_INTERVAL: The interval of time (in TUs) between * root announcements are transmitted. * * @NL80211_MESHCONF_GATE_ANNOUNCEMENTS: Advertise that this mesh station has * access to a broader network beyond the MBSS. This is done via Root * Announcement frames. * * @NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL: The minimum interval of time (in * TUs) during which a mesh STA can send only one Action frame containing a * PERR element. * * @NL80211_MESHCONF_FORWARDING: set Mesh STA as forwarding or non-forwarding * or forwarding entity (default is TRUE - forwarding entity) * * @NL80211_MESHCONF_RSSI_THRESHOLD: RSSI threshold in dBm. This specifies the * threshold for average signal strength of candidate station to establish * a peer link. * * @NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR: maximum number of neighbors * to synchronize to for 11s default synchronization method * (see 11C.12.2.2) * * @NL80211_MESHCONF_HT_OPMODE: set mesh HT protection mode. * * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute * * @NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT: The time (in TUs) for * which mesh STAs receiving a proactive PREQ shall consider the forwarding * information to the root mesh STA to be valid. * * @NL80211_MESHCONF_HWMP_ROOT_INTERVAL: The interval of time (in TUs) between * proactive PREQs are transmitted. * * @NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL: The minimum interval of time * (in TUs) during which a mesh STA can send only one Action frame * containing a PREQ element for root path confirmation. * * @NL80211_MESHCONF_POWER_MODE: Default mesh power mode for new peer links. * type &enum nl80211_mesh_power_mode (u32) * * @NL80211_MESHCONF_AWAKE_WINDOW: awake window duration (in TUs) * * @NL80211_MESHCONF_PLINK_TIMEOUT: If no tx activity is seen from a STA we've * established peering with for longer than this time (in seconds), then * remove it from the STA's list of peers. You may set this to 0 to disable * the removal of the STA. Default is 30 minutes. * * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use */ enum nl80211_meshconf_params { __NL80211_MESHCONF_INVALID, NL80211_MESHCONF_RETRY_TIMEOUT, NL80211_MESHCONF_CONFIRM_TIMEOUT, NL80211_MESHCONF_HOLDING_TIMEOUT, NL80211_MESHCONF_MAX_PEER_LINKS, NL80211_MESHCONF_MAX_RETRIES, NL80211_MESHCONF_TTL, NL80211_MESHCONF_AUTO_OPEN_PLINKS, NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, NL80211_MESHCONF_PATH_REFRESH_TIME, NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, NL80211_MESHCONF_HWMP_ROOTMODE, NL80211_MESHCONF_ELEMENT_TTL, NL80211_MESHCONF_HWMP_RANN_INTERVAL, NL80211_MESHCONF_GATE_ANNOUNCEMENTS, NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, NL80211_MESHCONF_FORWARDING, NL80211_MESHCONF_RSSI_THRESHOLD, NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR, NL80211_MESHCONF_HT_OPMODE, NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT, NL80211_MESHCONF_HWMP_ROOT_INTERVAL, NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL, NL80211_MESHCONF_POWER_MODE, NL80211_MESHCONF_AWAKE_WINDOW, NL80211_MESHCONF_PLINK_TIMEOUT, /* keep last */ __NL80211_MESHCONF_ATTR_AFTER_LAST, NL80211_MESHCONF_ATTR_MAX = __NL80211_MESHCONF_ATTR_AFTER_LAST - 1 }; /** * enum nl80211_mesh_setup_params - mesh setup parameters * * Mesh setup parameters. These are used to start/join a mesh and cannot be * changed while the mesh is active. * * @__NL80211_MESH_SETUP_INVALID: Internal use * * @NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL: Enable this option to use a * vendor specific path selection algorithm or disable it to use the * default HWMP. * * @NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC: Enable this option to use a * vendor specific path metric or disable it to use the default Airtime * metric. * * @NL80211_MESH_SETUP_IE: Information elements for this mesh, for instance, a * robust security network ie, or a vendor specific information element * that vendors will use to identify the path selection methods and * metrics in use. * * @NL80211_MESH_SETUP_USERSPACE_AUTH: Enable this option if an authentication * daemon will be authenticating mesh candidates. * * @NL80211_MESH_SETUP_USERSPACE_AMPE: Enable this option if an authentication * daemon will be securing peer link frames. AMPE is a secured version of * Mesh Peering Management (MPM) and is implemented with the assistance of * a userspace daemon. When this flag is set, the kernel will send peer * management frames to a userspace daemon that will implement AMPE * functionality (security capabilities selection, key confirmation, and * key management). When the flag is unset (default), the kernel can * autonomously complete (unsecured) mesh peering without the need of a * userspace daemon. * * @NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC: Enable this option to use a * vendor specific synchronization method or disable it to use the default * neighbor offset synchronization * * @NL80211_MESH_SETUP_USERSPACE_MPM: Enable this option if userspace will * implement an MPM which handles peer allocation and state. * * @NL80211_MESH_SETUP_AUTH_PROTOCOL: Inform the kernel of the authentication * method (u8, as defined in IEEE 8.4.2.100.6, e.g. 0x1 for SAE). * Default is no authentication method required. * * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number * * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use */ enum nl80211_mesh_setup_params { __NL80211_MESH_SETUP_INVALID, NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL, NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC, NL80211_MESH_SETUP_IE, NL80211_MESH_SETUP_USERSPACE_AUTH, NL80211_MESH_SETUP_USERSPACE_AMPE, NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC, NL80211_MESH_SETUP_USERSPACE_MPM, NL80211_MESH_SETUP_AUTH_PROTOCOL, /* keep last */ __NL80211_MESH_SETUP_ATTR_AFTER_LAST, NL80211_MESH_SETUP_ATTR_MAX = __NL80211_MESH_SETUP_ATTR_AFTER_LAST - 1 }; /** * enum nl80211_txq_attr - TX queue parameter attributes * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved * @NL80211_TXQ_ATTR_AC: AC identifier (NL80211_AC_*) * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning * disabled * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form * 2^n-1 in the range 1..32767] * @NL80211_TXQ_ATTR_CWMAX: Maximum contention window [a value of the form * 2^n-1 in the range 1..32767] * @NL80211_TXQ_ATTR_AIFS: Arbitration interframe space [0..255] * @__NL80211_TXQ_ATTR_AFTER_LAST: Internal * @NL80211_TXQ_ATTR_MAX: Maximum TXQ attribute number */ enum nl80211_txq_attr { __NL80211_TXQ_ATTR_INVALID, NL80211_TXQ_ATTR_AC, NL80211_TXQ_ATTR_TXOP, NL80211_TXQ_ATTR_CWMIN, NL80211_TXQ_ATTR_CWMAX, NL80211_TXQ_ATTR_AIFS, /* keep last */ __NL80211_TXQ_ATTR_AFTER_LAST, NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1 }; enum nl80211_ac { NL80211_AC_VO, NL80211_AC_VI, NL80211_AC_BE, NL80211_AC_BK, NL80211_NUM_ACS }; /* backward compat */ #define NL80211_TXQ_ATTR_QUEUE NL80211_TXQ_ATTR_AC #define NL80211_TXQ_Q_VO NL80211_AC_VO #define NL80211_TXQ_Q_VI NL80211_AC_VI #define NL80211_TXQ_Q_BE NL80211_AC_BE #define NL80211_TXQ_Q_BK NL80211_AC_BK /** * enum nl80211_channel_type - channel type * @NL80211_CHAN_NO_HT: 20 MHz, non-HT channel * @NL80211_CHAN_HT20: 20 MHz HT channel * @NL80211_CHAN_HT40MINUS: HT40 channel, secondary channel * below the control channel * @NL80211_CHAN_HT40PLUS: HT40 channel, secondary channel * above the control channel */ enum nl80211_channel_type { NL80211_CHAN_NO_HT, NL80211_CHAN_HT20, NL80211_CHAN_HT40MINUS, NL80211_CHAN_HT40PLUS }; /** * enum nl80211_chan_width - channel width definitions * * These values are used with the %NL80211_ATTR_CHANNEL_WIDTH * attribute. * * @NL80211_CHAN_WIDTH_20_NOHT: 20 MHz, non-HT channel * @NL80211_CHAN_WIDTH_20: 20 MHz HT channel * @NL80211_CHAN_WIDTH_40: 40 MHz channel, the %NL80211_ATTR_CENTER_FREQ1 * attribute must be provided as well * @NL80211_CHAN_WIDTH_80: 80 MHz channel, the %NL80211_ATTR_CENTER_FREQ1 * attribute must be provided as well * @NL80211_CHAN_WIDTH_80P80: 80+80 MHz channel, the %NL80211_ATTR_CENTER_FREQ1 * and %NL80211_ATTR_CENTER_FREQ2 attributes must be provided as well * @NL80211_CHAN_WIDTH_160: 160 MHz channel, the %NL80211_ATTR_CENTER_FREQ1 * attribute must be provided as well * @NL80211_CHAN_WIDTH_5: 5 MHz OFDM channel * @NL80211_CHAN_WIDTH_10: 10 MHz OFDM channel */ enum nl80211_chan_width { NL80211_CHAN_WIDTH_20_NOHT, NL80211_CHAN_WIDTH_20, NL80211_CHAN_WIDTH_40, NL80211_CHAN_WIDTH_80, NL80211_CHAN_WIDTH_80P80, NL80211_CHAN_WIDTH_160, NL80211_CHAN_WIDTH_5, NL80211_CHAN_WIDTH_10, }; /** * enum nl80211_bss_scan_width - control channel width for a BSS * * These values are used with the %NL80211_BSS_CHAN_WIDTH attribute. * * @NL80211_BSS_CHAN_WIDTH_20: control channel is 20 MHz wide or compatible * @NL80211_BSS_CHAN_WIDTH_10: control channel is 10 MHz wide * @NL80211_BSS_CHAN_WIDTH_5: control channel is 5 MHz wide */ enum nl80211_bss_scan_width { NL80211_BSS_CHAN_WIDTH_20, NL80211_BSS_CHAN_WIDTH_10, NL80211_BSS_CHAN_WIDTH_5, }; /** * enum nl80211_bss - netlink attributes for a BSS * * @__NL80211_BSS_INVALID: invalid * @NL80211_BSS_BSSID: BSSID of the BSS (6 octets) * @NL80211_BSS_FREQUENCY: frequency in MHz (u32) * @NL80211_BSS_TSF: TSF of the received probe response/beacon (u64) * (if @NL80211_BSS_PRESP_DATA is present then this is known to be * from a probe response, otherwise it may be from the same beacon * that the NL80211_BSS_BEACON_TSF will be from) * @NL80211_BSS_BEACON_INTERVAL: beacon interval of the (I)BSS (u16) * @NL80211_BSS_CAPABILITY: capability field (CPU order, u16) * @NL80211_BSS_INFORMATION_ELEMENTS: binary attribute containing the * raw information elements from the probe response/beacon (bin); * if the %NL80211_BSS_BEACON_IES attribute is present and the data is * different then the IEs here are from a Probe Response frame; otherwise * they are from a Beacon frame. * However, if the driver does not indicate the source of the IEs, these * IEs may be from either frame subtype. * If present, the @NL80211_BSS_PRESP_DATA attribute indicates that the * data here is known to be from a probe response, without any heuristics. * @NL80211_BSS_SIGNAL_MBM: signal strength of probe response/beacon * in mBm (100 * dBm) (s32) * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon * in unspecified units, scaled to 0..100 (u8) * @NL80211_BSS_STATUS: status, if this BSS is "used" * @NL80211_BSS_SEEN_MS_AGO: age of this BSS entry in ms * @NL80211_BSS_BEACON_IES: binary attribute containing the raw information * elements from a Beacon frame (bin); not present if no Beacon frame has * yet been received * @NL80211_BSS_CHAN_WIDTH: channel width of the control channel * (u32, enum nl80211_bss_scan_width) * @NL80211_BSS_BEACON_TSF: TSF of the last received beacon (u64) * (not present if no beacon frame has been received yet) * @NL80211_BSS_PRESP_DATA: the data in @NL80211_BSS_INFORMATION_ELEMENTS and * @NL80211_BSS_TSF is known to be from a probe response (flag attribute) * @NL80211_BSS_LAST_SEEN_BOOTTIME: CLOCK_BOOTTIME timestamp when this entry * was last updated by a received frame. The value is expected to be * accurate to about 10ms. (u64, nanoseconds) * @NL80211_BSS_PAD: attribute used for padding for 64-bit alignment * @NL80211_BSS_PARENT_TSF: the time at the start of reception of the first * octet of the timestamp field of the last beacon/probe received for * this BSS. The time is the TSF of the BSS specified by * @NL80211_BSS_PARENT_BSSID. (u64). * @NL80211_BSS_PARENT_BSSID: the BSS according to which @NL80211_BSS_PARENT_TSF * is set. * @NL80211_BSS_CHAIN_SIGNAL: per-chain signal strength of last BSS update. * Contains a nested array of signal strength attributes (u8, dBm), * using the nesting index as the antenna number. * @__NL80211_BSS_AFTER_LAST: internal * @NL80211_BSS_MAX: highest BSS attribute */ enum nl80211_bss { __NL80211_BSS_INVALID, NL80211_BSS_BSSID, NL80211_BSS_FREQUENCY, NL80211_BSS_TSF, NL80211_BSS_BEACON_INTERVAL, NL80211_BSS_CAPABILITY, NL80211_BSS_INFORMATION_ELEMENTS, NL80211_BSS_SIGNAL_MBM, NL80211_BSS_SIGNAL_UNSPEC, NL80211_BSS_STATUS, NL80211_BSS_SEEN_MS_AGO, NL80211_BSS_BEACON_IES, NL80211_BSS_CHAN_WIDTH, NL80211_BSS_BEACON_TSF, NL80211_BSS_PRESP_DATA, NL80211_BSS_LAST_SEEN_BOOTTIME, NL80211_BSS_PAD, NL80211_BSS_PARENT_TSF, NL80211_BSS_PARENT_BSSID, NL80211_BSS_CHAIN_SIGNAL, /* keep last */ __NL80211_BSS_AFTER_LAST, NL80211_BSS_MAX = __NL80211_BSS_AFTER_LAST - 1 }; /** * enum nl80211_bss_status - BSS "status" * @NL80211_BSS_STATUS_AUTHENTICATED: Authenticated with this BSS. * Note that this is no longer used since cfg80211 no longer * keeps track of whether or not authentication was done with * a given BSS. * @NL80211_BSS_STATUS_ASSOCIATED: Associated with this BSS. * @NL80211_BSS_STATUS_IBSS_JOINED: Joined to this IBSS. * * The BSS status is a BSS attribute in scan dumps, which * indicates the status the interface has wrt. this BSS. */ enum nl80211_bss_status { NL80211_BSS_STATUS_AUTHENTICATED, NL80211_BSS_STATUS_ASSOCIATED, NL80211_BSS_STATUS_IBSS_JOINED, }; /** * enum nl80211_auth_type - AuthenticationType * * @NL80211_AUTHTYPE_OPEN_SYSTEM: Open System authentication * @NL80211_AUTHTYPE_SHARED_KEY: Shared Key authentication (WEP only) * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r) * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP) * @NL80211_AUTHTYPE_SAE: Simultaneous authentication of equals * @NL80211_AUTHTYPE_FILS_SK: Fast Initial Link Setup shared key * @NL80211_AUTHTYPE_FILS_SK_PFS: Fast Initial Link Setup shared key with PFS * @NL80211_AUTHTYPE_FILS_PK: Fast Initial Link Setup public key * @__NL80211_AUTHTYPE_NUM: internal * @NL80211_AUTHTYPE_MAX: maximum valid auth algorithm * @NL80211_AUTHTYPE_AUTOMATIC: determine automatically (if necessary by * trying multiple times); this is invalid in netlink -- leave out * the attribute for this on CONNECT commands. */ enum nl80211_auth_type { NL80211_AUTHTYPE_OPEN_SYSTEM, NL80211_AUTHTYPE_SHARED_KEY, NL80211_AUTHTYPE_FT, NL80211_AUTHTYPE_NETWORK_EAP, NL80211_AUTHTYPE_SAE, NL80211_AUTHTYPE_FILS_SK, NL80211_AUTHTYPE_FILS_SK_PFS, NL80211_AUTHTYPE_FILS_PK, /* keep last */ __NL80211_AUTHTYPE_NUM, NL80211_AUTHTYPE_MAX = __NL80211_AUTHTYPE_NUM - 1, NL80211_AUTHTYPE_AUTOMATIC }; /** * enum nl80211_key_type - Key Type * @NL80211_KEYTYPE_GROUP: Group (broadcast/multicast) key * @NL80211_KEYTYPE_PAIRWISE: Pairwise (unicast/individual) key * @NL80211_KEYTYPE_PEERKEY: PeerKey (DLS) * @NUM_NL80211_KEYTYPES: number of defined key types */ enum nl80211_key_type { NL80211_KEYTYPE_GROUP, NL80211_KEYTYPE_PAIRWISE, NL80211_KEYTYPE_PEERKEY, NUM_NL80211_KEYTYPES }; /** * enum nl80211_mfp - Management frame protection state * @NL80211_MFP_NO: Management frame protection not used * @NL80211_MFP_REQUIRED: Management frame protection required * @NL80211_MFP_OPTIONAL: Management frame protection is optional */ enum nl80211_mfp { NL80211_MFP_NO, NL80211_MFP_REQUIRED, NL80211_MFP_OPTIONAL, }; enum nl80211_wpa_versions { NL80211_WPA_VERSION_1 = 1 << 0, NL80211_WPA_VERSION_2 = 1 << 1, }; /** * enum nl80211_key_default_types - key default types * @__NL80211_KEY_DEFAULT_TYPE_INVALID: invalid * @NL80211_KEY_DEFAULT_TYPE_UNICAST: key should be used as default * unicast key * @NL80211_KEY_DEFAULT_TYPE_MULTICAST: key should be used as default * multicast key * @NUM_NL80211_KEY_DEFAULT_TYPES: number of default types */ enum nl80211_key_default_types { __NL80211_KEY_DEFAULT_TYPE_INVALID, NL80211_KEY_DEFAULT_TYPE_UNICAST, NL80211_KEY_DEFAULT_TYPE_MULTICAST, NUM_NL80211_KEY_DEFAULT_TYPES }; /** * enum nl80211_key_attributes - key attributes * @__NL80211_KEY_INVALID: invalid * @NL80211_KEY_DATA: (temporal) key data; for TKIP this consists of * 16 bytes encryption key followed by 8 bytes each for TX and RX MIC * keys * @NL80211_KEY_IDX: key ID (u8, 0-3) * @NL80211_KEY_CIPHER: key cipher suite (u32, as defined by IEEE 802.11 * section 7.3.2.25.1, e.g. 0x000FAC04) * @NL80211_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and * CCMP keys, each six bytes in little endian * @NL80211_KEY_DEFAULT: flag indicating default key * @NL80211_KEY_DEFAULT_MGMT: flag indicating default management key * @NL80211_KEY_TYPE: the key type from enum nl80211_key_type, if not * specified the default depends on whether a MAC address was * given with the command using the key or not (u32) * @NL80211_KEY_DEFAULT_TYPES: A nested attribute containing flags * attributes, specifying what a key should be set as default as. * See &enum nl80211_key_default_types. * @__NL80211_KEY_AFTER_LAST: internal * @NL80211_KEY_MAX: highest key attribute */ enum nl80211_key_attributes { __NL80211_KEY_INVALID, NL80211_KEY_DATA, NL80211_KEY_IDX, NL80211_KEY_CIPHER, NL80211_KEY_SEQ, NL80211_KEY_DEFAULT, NL80211_KEY_DEFAULT_MGMT, NL80211_KEY_TYPE, NL80211_KEY_DEFAULT_TYPES, /* keep last */ __NL80211_KEY_AFTER_LAST, NL80211_KEY_MAX = __NL80211_KEY_AFTER_LAST - 1 }; /** * enum nl80211_tx_rate_attributes - TX rate set attributes * @__NL80211_TXRATE_INVALID: invalid * @NL80211_TXRATE_LEGACY: Legacy (non-MCS) rates allowed for TX rate selection * in an array of rates as defined in IEEE 802.11 7.3.2.2 (u8 values with * 1 = 500 kbps) but without the IE length restriction (at most * %NL80211_MAX_SUPP_RATES in a single array). * @NL80211_TXRATE_HT: HT (MCS) rates allowed for TX rate selection * in an array of MCS numbers. * @NL80211_TXRATE_VHT: VHT rates allowed for TX rate selection, * see &struct nl80211_txrate_vht * @NL80211_TXRATE_GI: configure GI, see &enum nl80211_txrate_gi * @__NL80211_TXRATE_AFTER_LAST: internal * @NL80211_TXRATE_MAX: highest TX rate attribute */ enum nl80211_tx_rate_attributes { __NL80211_TXRATE_INVALID, NL80211_TXRATE_LEGACY, NL80211_TXRATE_HT, NL80211_TXRATE_VHT, NL80211_TXRATE_GI, /* keep last */ __NL80211_TXRATE_AFTER_LAST, NL80211_TXRATE_MAX = __NL80211_TXRATE_AFTER_LAST - 1 }; #define NL80211_TXRATE_MCS NL80211_TXRATE_HT #define NL80211_VHT_NSS_MAX 8 /** * struct nl80211_txrate_vht - VHT MCS/NSS txrate bitmap * @mcs: MCS bitmap table for each NSS (array index 0 for 1 stream, etc.) */ struct nl80211_txrate_vht { __u16 mcs[NL80211_VHT_NSS_MAX]; }; enum nl80211_txrate_gi { NL80211_TXRATE_DEFAULT_GI, NL80211_TXRATE_FORCE_SGI, NL80211_TXRATE_FORCE_LGI, }; /** * enum nl80211_band - Frequency band * @NL80211_BAND_2GHZ: 2.4 GHz ISM band * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz) * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz) * @NUM_NL80211_BANDS: number of bands, avoid using this in userspace * since newer kernel versions may support more bands */ enum nl80211_band { NL80211_BAND_2GHZ, NL80211_BAND_5GHZ, NL80211_BAND_60GHZ, NUM_NL80211_BANDS, }; /** * enum nl80211_ps_state - powersave state * @NL80211_PS_DISABLED: powersave is disabled * @NL80211_PS_ENABLED: powersave is enabled */ enum nl80211_ps_state { NL80211_PS_DISABLED, NL80211_PS_ENABLED, }; /** * enum nl80211_attr_cqm - connection quality monitor attributes * @__NL80211_ATTR_CQM_INVALID: invalid * @NL80211_ATTR_CQM_RSSI_THOLD: RSSI threshold in dBm. This value specifies * the threshold for the RSSI level at which an event will be sent. Zero * to disable. Alternatively, if %NL80211_EXT_FEATURE_CQM_RSSI_LIST is * set, multiple values can be supplied as a low-to-high sorted array of * threshold values in dBm. Events will be sent when the RSSI value * crosses any of the thresholds. * @NL80211_ATTR_CQM_RSSI_HYST: RSSI hysteresis in dBm. This value specifies * the minimum amount the RSSI level must change after an event before a * new event may be issued (to reduce effects of RSSI oscillation). * @NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT: RSSI threshold event * @NL80211_ATTR_CQM_PKT_LOSS_EVENT: a u32 value indicating that this many * consecutive packets were not acknowledged by the peer * @NL80211_ATTR_CQM_TXE_RATE: TX error rate in %. Minimum % of TX failures * during the given %NL80211_ATTR_CQM_TXE_INTVL before an * %NL80211_CMD_NOTIFY_CQM with reported %NL80211_ATTR_CQM_TXE_RATE and * %NL80211_ATTR_CQM_TXE_PKTS is generated. * @NL80211_ATTR_CQM_TXE_PKTS: number of attempted packets in a given * %NL80211_ATTR_CQM_TXE_INTVL before %NL80211_ATTR_CQM_TXE_RATE is * checked. * @NL80211_ATTR_CQM_TXE_INTVL: interval in seconds. Specifies the periodic * interval in which %NL80211_ATTR_CQM_TXE_PKTS and * %NL80211_ATTR_CQM_TXE_RATE must be satisfied before generating an * %NL80211_CMD_NOTIFY_CQM. Set to 0 to turn off TX error reporting. * @NL80211_ATTR_CQM_BEACON_LOSS_EVENT: flag attribute that's set in a beacon * loss event * @NL80211_ATTR_CQM_RSSI_LEVEL: the RSSI value in dBm that triggered the * RSSI threshold event. * @__NL80211_ATTR_CQM_AFTER_LAST: internal * @NL80211_ATTR_CQM_MAX: highest key attribute */ enum nl80211_attr_cqm { __NL80211_ATTR_CQM_INVALID, NL80211_ATTR_CQM_RSSI_THOLD, NL80211_ATTR_CQM_RSSI_HYST, NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT, NL80211_ATTR_CQM_PKT_LOSS_EVENT, NL80211_ATTR_CQM_TXE_RATE, NL80211_ATTR_CQM_TXE_PKTS, NL80211_ATTR_CQM_TXE_INTVL, NL80211_ATTR_CQM_BEACON_LOSS_EVENT, NL80211_ATTR_CQM_RSSI_LEVEL, /* keep last */ __NL80211_ATTR_CQM_AFTER_LAST, NL80211_ATTR_CQM_MAX = __NL80211_ATTR_CQM_AFTER_LAST - 1 }; /** * enum nl80211_cqm_rssi_threshold_event - RSSI threshold event * @NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW: The RSSI level is lower than the * configured threshold * @NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH: The RSSI is higher than the * configured threshold * @NL80211_CQM_RSSI_BEACON_LOSS_EVENT: (reserved, never sent) */ enum nl80211_cqm_rssi_threshold_event { NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH, NL80211_CQM_RSSI_BEACON_LOSS_EVENT, }; /** * enum nl80211_tx_power_setting - TX power adjustment * @NL80211_TX_POWER_AUTOMATIC: automatically determine transmit power * @NL80211_TX_POWER_LIMITED: limit TX power by the mBm parameter * @NL80211_TX_POWER_FIXED: fix TX power to the mBm parameter */ enum nl80211_tx_power_setting { NL80211_TX_POWER_AUTOMATIC, NL80211_TX_POWER_LIMITED, NL80211_TX_POWER_FIXED, }; /** * enum nl80211_packet_pattern_attr - packet pattern attribute * @__NL80211_PKTPAT_INVALID: invalid number for nested attribute * @NL80211_PKTPAT_PATTERN: the pattern, values where the mask has * a zero bit are ignored * @NL80211_PKTPAT_MASK: pattern mask, must be long enough to have * a bit for each byte in the pattern. The lowest-order bit corresponds * to the first byte of the pattern, but the bytes of the pattern are * in a little-endian-like format, i.e. the 9th byte of the pattern * corresponds to the lowest-order bit in the second byte of the mask. * For example: The match 00:xx:00:00:xx:00:00:00:00:xx:xx:xx (where * xx indicates "don't care") would be represented by a pattern of * twelve zero bytes, and a mask of "0xed,0x01". * Note that the pattern matching is done as though frames were not * 802.11 frames but 802.3 frames, i.e. the frame is fully unpacked * first (including SNAP header unpacking) and then matched. * @NL80211_PKTPAT_OFFSET: packet offset, pattern is matched after * these fixed number of bytes of received packet * @NUM_NL80211_PKTPAT: number of attributes * @MAX_NL80211_PKTPAT: max attribute number */ enum nl80211_packet_pattern_attr { __NL80211_PKTPAT_INVALID, NL80211_PKTPAT_MASK, NL80211_PKTPAT_PATTERN, NL80211_PKTPAT_OFFSET, NUM_NL80211_PKTPAT, MAX_NL80211_PKTPAT = NUM_NL80211_PKTPAT - 1, }; /** * struct nl80211_pattern_support - packet pattern support information * @max_patterns: maximum number of patterns supported * @min_pattern_len: minimum length of each pattern * @max_pattern_len: maximum length of each pattern * @max_pkt_offset: maximum Rx packet offset * * This struct is carried in %NL80211_WOWLAN_TRIG_PKT_PATTERN when * that is part of %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED or in * %NL80211_ATTR_COALESCE_RULE_PKT_PATTERN when that is part of * %NL80211_ATTR_COALESCE_RULE in the capability information given * by the kernel to userspace. */ struct nl80211_pattern_support { __u32 max_patterns; __u32 min_pattern_len; __u32 max_pattern_len; __u32 max_pkt_offset; } __attribute__((packed)); /* only for backward compatibility */ #define __NL80211_WOWLAN_PKTPAT_INVALID __NL80211_PKTPAT_INVALID #define NL80211_WOWLAN_PKTPAT_MASK NL80211_PKTPAT_MASK #define NL80211_WOWLAN_PKTPAT_PATTERN NL80211_PKTPAT_PATTERN #define NL80211_WOWLAN_PKTPAT_OFFSET NL80211_PKTPAT_OFFSET #define NUM_NL80211_WOWLAN_PKTPAT NUM_NL80211_PKTPAT #define MAX_NL80211_WOWLAN_PKTPAT MAX_NL80211_PKTPAT #define nl80211_wowlan_pattern_support nl80211_pattern_support /** * enum nl80211_wowlan_triggers - WoWLAN trigger definitions * @__NL80211_WOWLAN_TRIG_INVALID: invalid number for nested attributes * @NL80211_WOWLAN_TRIG_ANY: wake up on any activity, do not really put * the chip into a special state -- works best with chips that have * support for low-power operation already (flag) * Note that this mode is incompatible with all of the others, if * any others are even supported by the device. * @NL80211_WOWLAN_TRIG_DISCONNECT: wake up on disconnect, the way disconnect * is detected is implementation-specific (flag) * @NL80211_WOWLAN_TRIG_MAGIC_PKT: wake up on magic packet (6x 0xff, followed * by 16 repetitions of MAC addr, anywhere in payload) (flag) * @NL80211_WOWLAN_TRIG_PKT_PATTERN: wake up on the specified packet patterns * which are passed in an array of nested attributes, each nested attribute * defining a with attributes from &struct nl80211_wowlan_trig_pkt_pattern. * Each pattern defines a wakeup packet. Packet offset is associated with * each pattern which is used while matching the pattern. The matching is * done on the MSDU, i.e. as though the packet was an 802.3 packet, so the * pattern matching is done after the packet is converted to the MSDU. * * In %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, it is a binary attribute * carrying a &struct nl80211_pattern_support. * * When reporting wakeup. it is a u32 attribute containing the 0-based * index of the pattern that caused the wakeup, in the patterns passed * to the kernel when configuring. * @NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED: Not a real trigger, and cannot be * used when setting, used only to indicate that GTK rekeying is supported * by the device (flag) * @NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE: wake up on GTK rekey failure (if * done by the device) (flag) * @NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST: wake up on EAP Identity Request * packet (flag) * @NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE: wake up on 4-way handshake (flag) * @NL80211_WOWLAN_TRIG_RFKILL_RELEASE: wake up when rfkill is released * (on devices that have rfkill in the device) (flag) * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211: For wakeup reporting only, contains * the 802.11 packet that caused the wakeup, e.g. a deauth frame. The frame * may be truncated, the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN * attribute contains the original length. * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN: Original length of the 802.11 * packet, may be bigger than the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211 * attribute if the packet was truncated somewhere. * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023: For wakeup reporting only, contains the * 802.11 packet that caused the wakeup, e.g. a magic packet. The frame may * be truncated, the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023_LEN attribute * contains the original length. * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023_LEN: Original length of the 802.3 * packet, may be bigger than the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023 * attribute if the packet was truncated somewhere. * @NL80211_WOWLAN_TRIG_TCP_CONNECTION: TCP connection wake, see DOC section * "TCP connection wakeup" for more details. This is a nested attribute * containing the exact information for establishing and keeping alive * the TCP connection. * @NL80211_WOWLAN_TRIG_TCP_WAKEUP_MATCH: For wakeup reporting only, the * wakeup packet was received on the TCP connection * @NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST: For wakeup reporting only, the * TCP connection was lost or failed to be established * @NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS: For wakeup reporting only, * the TCP connection ran out of tokens to use for data to send to the * service * @NL80211_WOWLAN_TRIG_NET_DETECT: wake up when a configured network * is detected. This is a nested attribute that contains the * same attributes used with @NL80211_CMD_START_SCHED_SCAN. It * specifies how the scan is performed (e.g. the interval, the * channels to scan and the initial delay) as well as the scan * results that will trigger a wake (i.e. the matchsets). This * attribute is also sent in a response to * @NL80211_CMD_GET_WIPHY, indicating the number of match sets * supported by the driver (u32). * @NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS: nested attribute * containing an array with information about what triggered the * wake up. If no elements are present in the array, it means * that the information is not available. If more than one * element is present, it means that more than one match * occurred. * Each element in the array is a nested attribute that contains * one optional %NL80211_ATTR_SSID attribute and one optional * %NL80211_ATTR_SCAN_FREQUENCIES attribute. At least one of * these attributes must be present. If * %NL80211_ATTR_SCAN_FREQUENCIES contains more than one * frequency, it means that the match occurred in more than one * channel. * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number * * These nested attributes are used to configure the wakeup triggers and * to report the wakeup reason(s). */ enum nl80211_wowlan_triggers { __NL80211_WOWLAN_TRIG_INVALID, NL80211_WOWLAN_TRIG_ANY, NL80211_WOWLAN_TRIG_DISCONNECT, NL80211_WOWLAN_TRIG_MAGIC_PKT, NL80211_WOWLAN_TRIG_PKT_PATTERN, NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE, NL80211_WOWLAN_TRIG_RFKILL_RELEASE, NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211, NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN, NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023, NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023_LEN, NL80211_WOWLAN_TRIG_TCP_CONNECTION, NL80211_WOWLAN_TRIG_WAKEUP_TCP_MATCH, NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST, NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS, NL80211_WOWLAN_TRIG_NET_DETECT, NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS, /* keep last */ NUM_NL80211_WOWLAN_TRIG, MAX_NL80211_WOWLAN_TRIG = NUM_NL80211_WOWLAN_TRIG - 1 }; /** * DOC: TCP connection wakeup * * Some devices can establish a TCP connection in order to be woken up by a * packet coming in from outside their network segment, or behind NAT. If * configured, the device will establish a TCP connection to the given * service, and periodically send data to that service. The first data * packet is usually transmitted after SYN/ACK, also ACKing the SYN/ACK. * The data packets can optionally include a (little endian) sequence * number (in the TCP payload!) that is generated by the device, and, also * optionally, a token from a list of tokens. This serves as a keep-alive * with the service, and for NATed connections, etc. * * During this keep-alive period, the server doesn't send any data to the * client. When receiving data, it is compared against the wakeup pattern * (and mask) and if it matches, the host is woken up. Similarly, if the * connection breaks or cannot be established to start with, the host is * also woken up. * * Developer's note: ARP offload is required for this, otherwise TCP * response packets might not go through correctly. */ /** * struct nl80211_wowlan_tcp_data_seq - WoWLAN TCP data sequence * @start: starting value * @offset: offset of sequence number in packet * @len: length of the sequence value to write, 1 through 4 * * Note: don't confuse with the TCP sequence number(s), this is for the * keepalive packet payload. The actual value is written into the packet * in little endian. */ struct nl80211_wowlan_tcp_data_seq { __u32 start, offset, len; }; /** * struct nl80211_wowlan_tcp_data_token - WoWLAN TCP data token config * @offset: offset of token in packet * @len: length of each token * @token_stream: stream of data to be used for the tokens, the length must * be a multiple of @len for this to make sense */ struct nl80211_wowlan_tcp_data_token { __u32 offset, len; __u8 token_stream[]; }; /** * struct nl80211_wowlan_tcp_data_token_feature - data token features * @min_len: minimum token length * @max_len: maximum token length * @bufsize: total available token buffer size (max size of @token_stream) */ struct nl80211_wowlan_tcp_data_token_feature { __u32 min_len, max_len, bufsize; }; /** * enum nl80211_wowlan_tcp_attrs - WoWLAN TCP connection parameters * @__NL80211_WOWLAN_TCP_INVALID: invalid number for nested attributes * @NL80211_WOWLAN_TCP_SRC_IPV4: source IPv4 address (in network byte order) * @NL80211_WOWLAN_TCP_DST_IPV4: destination IPv4 address * (in network byte order) * @NL80211_WOWLAN_TCP_DST_MAC: destination MAC address, this is given because * route lookup when configured might be invalid by the time we suspend, * and doing a route lookup when suspending is no longer possible as it * might require ARP querying. * @NL80211_WOWLAN_TCP_SRC_PORT: source port (u16); optional, if not given a * socket and port will be allocated * @NL80211_WOWLAN_TCP_DST_PORT: destination port (u16) * @NL80211_WOWLAN_TCP_DATA_PAYLOAD: data packet payload, at least one byte. * For feature advertising, a u32 attribute holding the maximum length * of the data payload. * @NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ: data packet sequence configuration * (if desired), a &struct nl80211_wowlan_tcp_data_seq. For feature * advertising it is just a flag * @NL80211_WOWLAN_TCP_DATA_PAYLOAD_TOKEN: data packet token configuration, * see &struct nl80211_wowlan_tcp_data_token and for advertising see * &struct nl80211_wowlan_tcp_data_token_feature. * @NL80211_WOWLAN_TCP_DATA_INTERVAL: data interval in seconds, maximum * interval in feature advertising (u32) * @NL80211_WOWLAN_TCP_WAKE_PAYLOAD: wake packet payload, for advertising a * u32 attribute holding the maximum length * @NL80211_WOWLAN_TCP_WAKE_MASK: Wake packet payload mask, not used for * feature advertising. The mask works like @NL80211_PKTPAT_MASK * but on the TCP payload only. * @NUM_NL80211_WOWLAN_TCP: number of TCP attributes * @MAX_NL80211_WOWLAN_TCP: highest attribute number */ enum nl80211_wowlan_tcp_attrs { __NL80211_WOWLAN_TCP_INVALID, NL80211_WOWLAN_TCP_SRC_IPV4, NL80211_WOWLAN_TCP_DST_IPV4, NL80211_WOWLAN_TCP_DST_MAC, NL80211_WOWLAN_TCP_SRC_PORT, NL80211_WOWLAN_TCP_DST_PORT, NL80211_WOWLAN_TCP_DATA_PAYLOAD, NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ, NL80211_WOWLAN_TCP_DATA_PAYLOAD_TOKEN, NL80211_WOWLAN_TCP_DATA_INTERVAL, NL80211_WOWLAN_TCP_WAKE_PAYLOAD, NL80211_WOWLAN_TCP_WAKE_MASK, /* keep last */ NUM_NL80211_WOWLAN_TCP, MAX_NL80211_WOWLAN_TCP = NUM_NL80211_WOWLAN_TCP - 1 }; /** * struct nl80211_coalesce_rule_support - coalesce rule support information * @max_rules: maximum number of rules supported * @pat: packet pattern support information * @max_delay: maximum supported coalescing delay in msecs * * This struct is carried in %NL80211_ATTR_COALESCE_RULE in the * capability information given by the kernel to userspace. */ struct nl80211_coalesce_rule_support { __u32 max_rules; struct nl80211_pattern_support pat; __u32 max_delay; } __attribute__((packed)); /** * enum nl80211_attr_coalesce_rule - coalesce rule attribute * @__NL80211_COALESCE_RULE_INVALID: invalid number for nested attribute * @NL80211_ATTR_COALESCE_RULE_DELAY: delay in msecs used for packet coalescing * @NL80211_ATTR_COALESCE_RULE_CONDITION: condition for packet coalescence, * see &enum nl80211_coalesce_condition. * @NL80211_ATTR_COALESCE_RULE_PKT_PATTERN: packet offset, pattern is matched * after these fixed number of bytes of received packet * @NUM_NL80211_ATTR_COALESCE_RULE: number of attributes * @NL80211_ATTR_COALESCE_RULE_MAX: max attribute number */ enum nl80211_attr_coalesce_rule { __NL80211_COALESCE_RULE_INVALID, NL80211_ATTR_COALESCE_RULE_DELAY, NL80211_ATTR_COALESCE_RULE_CONDITION, NL80211_ATTR_COALESCE_RULE_PKT_PATTERN, /* keep last */ NUM_NL80211_ATTR_COALESCE_RULE, NL80211_ATTR_COALESCE_RULE_MAX = NUM_NL80211_ATTR_COALESCE_RULE - 1 }; /** * enum nl80211_coalesce_condition - coalesce rule conditions * @NL80211_COALESCE_CONDITION_MATCH: coalaesce Rx packets when patterns * in a rule are matched. * @NL80211_COALESCE_CONDITION_NO_MATCH: coalesce Rx packets when patterns * in a rule are not matched. */ enum nl80211_coalesce_condition { NL80211_COALESCE_CONDITION_MATCH, NL80211_COALESCE_CONDITION_NO_MATCH }; /** * enum nl80211_iface_limit_attrs - limit attributes * @NL80211_IFACE_LIMIT_UNSPEC: (reserved) * @NL80211_IFACE_LIMIT_MAX: maximum number of interfaces that * can be chosen from this set of interface types (u32) * @NL80211_IFACE_LIMIT_TYPES: nested attribute containing a * flag attribute for each interface type in this set * @NUM_NL80211_IFACE_LIMIT: number of attributes * @MAX_NL80211_IFACE_LIMIT: highest attribute number */ enum nl80211_iface_limit_attrs { NL80211_IFACE_LIMIT_UNSPEC, NL80211_IFACE_LIMIT_MAX, NL80211_IFACE_LIMIT_TYPES, /* keep last */ NUM_NL80211_IFACE_LIMIT, MAX_NL80211_IFACE_LIMIT = NUM_NL80211_IFACE_LIMIT - 1 }; /** * enum nl80211_if_combination_attrs -- interface combination attributes * * @NL80211_IFACE_COMB_UNSPEC: (reserved) * @NL80211_IFACE_COMB_LIMITS: Nested attributes containing the limits * for given interface types, see &enum nl80211_iface_limit_attrs. * @NL80211_IFACE_COMB_MAXNUM: u32 attribute giving the total number of * interfaces that can be created in this group. This number doesn't * apply to interfaces purely managed in software, which are listed * in a separate attribute %NL80211_ATTR_INTERFACES_SOFTWARE. * @NL80211_IFACE_COMB_STA_AP_BI_MATCH: flag attribute specifying that * beacon intervals within this group must be all the same even for * infrastructure and AP/GO combinations, i.e. the GO(s) must adopt * the infrastructure network's beacon interval. * @NL80211_IFACE_COMB_NUM_CHANNELS: u32 attribute specifying how many * different channels may be used within this group. * @NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS: u32 attribute containing the bitmap * of supported channel widths for radar detection. * @NL80211_IFACE_COMB_RADAR_DETECT_REGIONS: u32 attribute containing the bitmap * of supported regulatory regions for radar detection. * @NL80211_IFACE_COMB_BI_MIN_GCD: u32 attribute specifying the minimum GCD of * different beacon intervals supported by all the interface combinations * in this group (if not present, all beacon intervals be identical). * @NUM_NL80211_IFACE_COMB: number of attributes * @MAX_NL80211_IFACE_COMB: highest attribute number * * Examples: * limits = [ #{STA} <= 1, #{AP} <= 1 ], matching BI, channels = 1, max = 2 * => allows an AP and a STA that must match BIs * * numbers = [ #{AP, P2P-GO} <= 8 ], BI min gcd, channels = 1, max = 8, * => allows 8 of AP/GO that can have BI gcd >= min gcd * * numbers = [ #{STA} <= 2 ], channels = 2, max = 2 * => allows two STAs on different channels * * numbers = [ #{STA} <= 1, #{P2P-client,P2P-GO} <= 3 ], max = 4 * => allows a STA plus three P2P interfaces * * The list of these four possiblities could completely be contained * within the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute to indicate * that any of these groups must match. * * "Combinations" of just a single interface will not be listed here, * a single interface of any valid interface type is assumed to always * be possible by itself. This means that implicitly, for each valid * interface type, the following group always exists: * numbers = [ #{<type>} <= 1 ], channels = 1, max = 1 */ enum nl80211_if_combination_attrs { NL80211_IFACE_COMB_UNSPEC, NL80211_IFACE_COMB_LIMITS, NL80211_IFACE_COMB_MAXNUM, NL80211_IFACE_COMB_STA_AP_BI_MATCH, NL80211_IFACE_COMB_NUM_CHANNELS, NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS, NL80211_IFACE_COMB_RADAR_DETECT_REGIONS, NL80211_IFACE_COMB_BI_MIN_GCD, /* keep last */ NUM_NL80211_IFACE_COMB, MAX_NL80211_IFACE_COMB = NUM_NL80211_IFACE_COMB - 1 }; /** * enum nl80211_plink_state - state of a mesh peer link finite state machine * * @NL80211_PLINK_LISTEN: initial state, considered the implicit * state of non existant mesh peer links * @NL80211_PLINK_OPN_SNT: mesh plink open frame has been sent to * this mesh peer * @NL80211_PLINK_OPN_RCVD: mesh plink open frame has been received * from this mesh peer * @NL80211_PLINK_CNF_RCVD: mesh plink confirm frame has been * received from this mesh peer * @NL80211_PLINK_ESTAB: mesh peer link is established * @NL80211_PLINK_HOLDING: mesh peer link is being closed or cancelled * @NL80211_PLINK_BLOCKED: all frames transmitted from this mesh * plink are discarded * @NUM_NL80211_PLINK_STATES: number of peer link states * @MAX_NL80211_PLINK_STATES: highest numerical value of plink states */ enum nl80211_plink_state { NL80211_PLINK_LISTEN, NL80211_PLINK_OPN_SNT, NL80211_PLINK_OPN_RCVD, NL80211_PLINK_CNF_RCVD, NL80211_PLINK_ESTAB, NL80211_PLINK_HOLDING, NL80211_PLINK_BLOCKED, /* keep last */ NUM_NL80211_PLINK_STATES, MAX_NL80211_PLINK_STATES = NUM_NL80211_PLINK_STATES - 1 }; /** * enum nl80211_plink_action - actions to perform in mesh peers * * @NL80211_PLINK_ACTION_NO_ACTION: perform no action * @NL80211_PLINK_ACTION_OPEN: start mesh peer link establishment * @NL80211_PLINK_ACTION_BLOCK: block traffic from this mesh peer * @NUM_NL80211_PLINK_ACTIONS: number of possible actions */ enum plink_actions { NL80211_PLINK_ACTION_NO_ACTION, NL80211_PLINK_ACTION_OPEN, NL80211_PLINK_ACTION_BLOCK, NUM_NL80211_PLINK_ACTIONS, }; #define NL80211_KCK_LEN 16 #define NL80211_KEK_LEN 16 #define NL80211_REPLAY_CTR_LEN 8 /** * enum nl80211_rekey_data - attributes for GTK rekey offload * @__NL80211_REKEY_DATA_INVALID: invalid number for nested attributes * @NL80211_REKEY_DATA_KEK: key encryption key (binary) * @NL80211_REKEY_DATA_KCK: key confirmation key (binary) * @NL80211_REKEY_DATA_REPLAY_CTR: replay counter (binary) * @NUM_NL80211_REKEY_DATA: number of rekey attributes (internal) * @MAX_NL80211_REKEY_DATA: highest rekey attribute (internal) */ enum nl80211_rekey_data { __NL80211_REKEY_DATA_INVALID, NL80211_REKEY_DATA_KEK, NL80211_REKEY_DATA_KCK, NL80211_REKEY_DATA_REPLAY_CTR, /* keep last */ NUM_NL80211_REKEY_DATA, MAX_NL80211_REKEY_DATA = NUM_NL80211_REKEY_DATA - 1 }; /** * enum nl80211_hidden_ssid - values for %NL80211_ATTR_HIDDEN_SSID * @NL80211_HIDDEN_SSID_NOT_IN_USE: do not hide SSID (i.e., broadcast it in * Beacon frames) * @NL80211_HIDDEN_SSID_ZERO_LEN: hide SSID by using zero-length SSID element * in Beacon frames * @NL80211_HIDDEN_SSID_ZERO_CONTENTS: hide SSID by using correct length of SSID * element in Beacon frames but zero out each byte in the SSID */ enum nl80211_hidden_ssid { NL80211_HIDDEN_SSID_NOT_IN_USE, NL80211_HIDDEN_SSID_ZERO_LEN, NL80211_HIDDEN_SSID_ZERO_CONTENTS }; /** * enum nl80211_sta_wme_attr - station WME attributes * @__NL80211_STA_WME_INVALID: invalid number for nested attribute * @NL80211_STA_WME_UAPSD_QUEUES: bitmap of uapsd queues. the format * is the same as the AC bitmap in the QoS info field. * @NL80211_STA_WME_MAX_SP: max service period. the format is the same * as the MAX_SP field in the QoS info field (but already shifted down). * @__NL80211_STA_WME_AFTER_LAST: internal * @NL80211_STA_WME_MAX: highest station WME attribute */ enum nl80211_sta_wme_attr { __NL80211_STA_WME_INVALID, NL80211_STA_WME_UAPSD_QUEUES, NL80211_STA_WME_MAX_SP, /* keep last */ __NL80211_STA_WME_AFTER_LAST, NL80211_STA_WME_MAX = __NL80211_STA_WME_AFTER_LAST - 1 }; /** * enum nl80211_pmksa_candidate_attr - attributes for PMKSA caching candidates * @__NL80211_PMKSA_CANDIDATE_INVALID: invalid number for nested attributes * @NL80211_PMKSA_CANDIDATE_INDEX: candidate index (u32; the smaller, the higher * priority) * @NL80211_PMKSA_CANDIDATE_BSSID: candidate BSSID (6 octets) * @NL80211_PMKSA_CANDIDATE_PREAUTH: RSN pre-authentication supported (flag) * @NUM_NL80211_PMKSA_CANDIDATE: number of PMKSA caching candidate attributes * (internal) * @MAX_NL80211_PMKSA_CANDIDATE: highest PMKSA caching candidate attribute * (internal) */ enum nl80211_pmksa_candidate_attr { __NL80211_PMKSA_CANDIDATE_INVALID, NL80211_PMKSA_CANDIDATE_INDEX, NL80211_PMKSA_CANDIDATE_BSSID, NL80211_PMKSA_CANDIDATE_PREAUTH, /* keep last */ NUM_NL80211_PMKSA_CANDIDATE, MAX_NL80211_PMKSA_CANDIDATE = NUM_NL80211_PMKSA_CANDIDATE - 1 }; /** * enum nl80211_tdls_operation - values for %NL80211_ATTR_TDLS_OPERATION * @NL80211_TDLS_DISCOVERY_REQ: Send a TDLS discovery request * @NL80211_TDLS_SETUP: Setup TDLS link * @NL80211_TDLS_TEARDOWN: Teardown a TDLS link which is already established * @NL80211_TDLS_ENABLE_LINK: Enable TDLS link * @NL80211_TDLS_DISABLE_LINK: Disable TDLS link */ enum nl80211_tdls_operation { NL80211_TDLS_DISCOVERY_REQ, NL80211_TDLS_SETUP, NL80211_TDLS_TEARDOWN, NL80211_TDLS_ENABLE_LINK, NL80211_TDLS_DISABLE_LINK, }; /* * enum nl80211_ap_sme_features - device-integrated AP features * Reserved for future use, no bits are defined in * NL80211_ATTR_DEVICE_AP_SME yet. enum nl80211_ap_sme_features { }; */ /** * enum nl80211_feature_flags - device/driver features * @NL80211_FEATURE_SK_TX_STATUS: This driver supports reflecting back * TX status to the socket error queue when requested with the * socket option. * @NL80211_FEATURE_HT_IBSS: This driver supports IBSS with HT datarates. * @NL80211_FEATURE_INACTIVITY_TIMER: This driver takes care of freeing up * the connected inactive stations in AP mode. * @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested * to work properly to suppport receiving regulatory hints from * cellular base stations. * @NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL: (no longer available, only * here to reserve the value for API/ABI compatibility) * @NL80211_FEATURE_SAE: This driver supports simultaneous authentication of * equals (SAE) with user space SME (NL80211_CMD_AUTHENTICATE) in station * mode * @NL80211_FEATURE_LOW_PRIORITY_SCAN: This driver supports low priority scan * @NL80211_FEATURE_SCAN_FLUSH: Scan flush is supported * @NL80211_FEATURE_AP_SCAN: Support scanning using an AP vif * @NL80211_FEATURE_VIF_TXPOWER: The driver supports per-vif TX power setting * @NL80211_FEATURE_NEED_OBSS_SCAN: The driver expects userspace to perform * OBSS scans and generate 20/40 BSS coex reports. This flag is used only * for drivers implementing the CONNECT API, for AUTH/ASSOC it is implied. * @NL80211_FEATURE_P2P_GO_CTWIN: P2P GO implementation supports CT Window * setting * @NL80211_FEATURE_P2P_GO_OPPPS: P2P GO implementation supports opportunistic * powersave * @NL80211_FEATURE_FULL_AP_CLIENT_STATE: The driver supports full state * transitions for AP clients. Without this flag (and if the driver * doesn't have the AP SME in the device) the driver supports adding * stations only when they're associated and adds them in associated * state (to later be transitioned into authorized), with this flag * they should be added before even sending the authentication reply * and then transitioned into authenticated, associated and authorized * states using station flags. * Note that even for drivers that support this, the default is to add * stations in authenticated/associated state, so to add unauthenticated * stations the authenticated/associated bits have to be set in the mask. * @NL80211_FEATURE_ADVERTISE_CHAN_LIMITS: cfg80211 advertises channel limits * (HT40, VHT 80/160 MHz) if this flag is set * @NL80211_FEATURE_USERSPACE_MPM: This driver supports a userspace Mesh * Peering Management entity which may be implemented by registering for * beacons or NL80211_CMD_NEW_PEER_CANDIDATE events. The mesh beacon is * still generated by the driver. * @NL80211_FEATURE_ACTIVE_MONITOR: This driver supports an active monitor * interface. An active monitor interface behaves like a normal monitor * interface, but gets added to the driver. It ensures that incoming * unicast packets directed at the configured interface address get ACKed. * @NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE: This driver supports dynamic * channel bandwidth change (e.g., HT 20 <-> 40 MHz channel) during the * lifetime of a BSS. * @NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES: This device adds a DS Parameter * Set IE to probe requests. * @NL80211_FEATURE_WFA_TPC_IE_IN_PROBES: This device adds a WFA TPC Report IE * to probe requests. * @NL80211_FEATURE_QUIET: This device, in client mode, supports Quiet Period * requests sent to it by an AP. * @NL80211_FEATURE_TX_POWER_INSERTION: This device is capable of inserting the * current tx power value into the TPC Report IE in the spectrum * management TPC Report action frame, and in the Radio Measurement Link * Measurement Report action frame. * @NL80211_FEATURE_ACKTO_ESTIMATION: This driver supports dynamic ACK timeout * estimation (dynack). %NL80211_ATTR_WIPHY_DYN_ACK flag attribute is used * to enable dynack. * @NL80211_FEATURE_STATIC_SMPS: Device supports static spatial * multiplexing powersave, ie. can turn off all but one chain * even on HT connections that should be using more chains. * @NL80211_FEATURE_DYNAMIC_SMPS: Device supports dynamic spatial * multiplexing powersave, ie. can turn off all but one chain * and then wake the rest up as required after, for example, * rts/cts handshake. * @NL80211_FEATURE_SUPPORTS_WMM_ADMISSION: the device supports setting up WMM * TSPEC sessions (TID aka TSID 0-7) with the %NL80211_CMD_ADD_TX_TS * command. Standard IEEE 802.11 TSPEC setup is not yet supported, it * needs to be able to handle Block-Ack agreements and other things. * @NL80211_FEATURE_MAC_ON_CREATE: Device supports configuring * the vif's MAC address upon creation. * See 'macaddr' field in the vif_params (cfg80211.h). * @NL80211_FEATURE_TDLS_CHANNEL_SWITCH: Driver supports channel switching when * operating as a TDLS peer. * @NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR: This device/driver supports using a * random MAC address during scan (if the device is unassociated); the * %NL80211_SCAN_FLAG_RANDOM_ADDR flag may be set for scans and the MAC * address mask/value will be used. * @NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR: This device/driver supports * using a random MAC address for every scan iteration during scheduled * scan (while not associated), the %NL80211_SCAN_FLAG_RANDOM_ADDR may * be set for scheduled scan and the MAC address mask/value will be used. * @NL80211_FEATURE_ND_RANDOM_MAC_ADDR: This device/driver supports using a * random MAC address for every scan iteration during "net detect", i.e. * scan in unassociated WoWLAN, the %NL80211_SCAN_FLAG_RANDOM_ADDR may * be set for scheduled scan and the MAC address mask/value will be used. */ enum nl80211_feature_flags { NL80211_FEATURE_SK_TX_STATUS = 1 << 0, NL80211_FEATURE_HT_IBSS = 1 << 1, NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2, NL80211_FEATURE_CELL_BASE_REG_HINTS = 1 << 3, NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL = 1 << 4, NL80211_FEATURE_SAE = 1 << 5, NL80211_FEATURE_LOW_PRIORITY_SCAN = 1 << 6, NL80211_FEATURE_SCAN_FLUSH = 1 << 7, NL80211_FEATURE_AP_SCAN = 1 << 8, NL80211_FEATURE_VIF_TXPOWER = 1 << 9, NL80211_FEATURE_NEED_OBSS_SCAN = 1 << 10, NL80211_FEATURE_P2P_GO_CTWIN = 1 << 11, NL80211_FEATURE_P2P_GO_OPPPS = 1 << 12, /* bit 13 is reserved */ NL80211_FEATURE_ADVERTISE_CHAN_LIMITS = 1 << 14, NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 15, NL80211_FEATURE_USERSPACE_MPM = 1 << 16, NL80211_FEATURE_ACTIVE_MONITOR = 1 << 17, NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE = 1 << 18, NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES = 1 << 19, NL80211_FEATURE_WFA_TPC_IE_IN_PROBES = 1 << 20, NL80211_FEATURE_QUIET = 1 << 21, NL80211_FEATURE_TX_POWER_INSERTION = 1 << 22, NL80211_FEATURE_ACKTO_ESTIMATION = 1 << 23, NL80211_FEATURE_STATIC_SMPS = 1 << 24, NL80211_FEATURE_DYNAMIC_SMPS = 1 << 25, NL80211_FEATURE_SUPPORTS_WMM_ADMISSION = 1 << 26, NL80211_FEATURE_MAC_ON_CREATE = 1 << 27, NL80211_FEATURE_TDLS_CHANNEL_SWITCH = 1 << 28, NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR = 1 << 29, NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR = 1 << 30, NL80211_FEATURE_ND_RANDOM_MAC_ADDR = 1 << 31, }; /** * enum nl80211_ext_feature_index - bit index of extended features. * @NL80211_EXT_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates. * @NL80211_EXT_FEATURE_RRM: This driver supports RRM. When featured, user can * can request to use RRM (see %NL80211_ATTR_USE_RRM) with * %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests, which will set * the ASSOC_REQ_USE_RRM flag in the association request even if * NL80211_FEATURE_QUIET is not advertized. * @NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER: This device supports MU-MIMO air * sniffer which means that it can be configured to hear packets from * certain groups which can be configured by the * %NL80211_ATTR_MU_MIMO_GROUP_DATA attribute, * or can be configured to follow a station by configuring the * %NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR attribute. * @NL80211_EXT_FEATURE_SCAN_START_TIME: This driver includes the actual * time the scan started in scan results event. The time is the TSF of * the BSS that the interface that requested the scan is connected to * (if available). * @NL80211_EXT_FEATURE_BSS_PARENT_TSF: Per BSS, this driver reports the * time the last beacon/probe was received. The time is the TSF of the * BSS that the interface that requested the scan is connected to * (if available). * @NL80211_EXT_FEATURE_SET_SCAN_DWELL: This driver supports configuration of * channel dwell time. * @NL80211_EXT_FEATURE_BEACON_RATE_LEGACY: Driver supports beacon rate * configuration (AP/mesh), supporting a legacy (non HT/VHT) rate. * @NL80211_EXT_FEATURE_BEACON_RATE_HT: Driver supports beacon rate * configuration (AP/mesh) with HT rates. * @NL80211_EXT_FEATURE_BEACON_RATE_VHT: Driver supports beacon rate * configuration (AP/mesh) with VHT rates. * @NL80211_EXT_FEATURE_FILS_STA: This driver supports Fast Initial Link Setup * with user space SME (NL80211_CMD_AUTHENTICATE) in station mode. * @NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA: This driver supports randomized TA * in @NL80211_CMD_FRAME while not associated. * @NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA_CONNECTED: This driver supports * randomized TA in @NL80211_CMD_FRAME while associated. * @NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI: The driver supports sched_scan * for reporting BSSs with better RSSI than the current connected BSS * (%NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI). * @NL80211_EXT_FEATURE_CQM_RSSI_LIST: With this driver the * %NL80211_ATTR_CQM_RSSI_THOLD attribute accepts a list of zero or more * RSSI threshold values to monitor rather than exactly one threshold. * @NL80211_EXT_FEATURE_FILS_SK_OFFLOAD: Driver SME supports FILS shared key * authentication with %NL80211_CMD_CONNECT. * @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK: Device wants to do 4-way * handshake with PSK in station mode (PSK is passed as part of the connect * and associate commands), doing it in the host might not be supported. * @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X: Device wants to do doing 4-way * handshake with 802.1X in station mode (will pass EAP frames to the host * and accept the set_pmk/del_pmk commands), doing it in the host might not * be supported. * @NL80211_EXT_FEATURE_FILS_MAX_CHANNEL_TIME: Driver is capable of overriding * the max channel attribute in the FILS request params IE with the * actual dwell time. * @NL80211_EXT_FEATURE_ACCEPT_BCAST_PROBE_RESP: Driver accepts broadcast probe * response * @NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE: Driver supports sending * the first probe request in each channel at rate of at least 5.5Mbps. * @NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION: Driver supports * probe request tx deferral and suppression * @NL80211_EXT_FEATURE_MFP_OPTIONAL: Driver supports the %NL80211_MFP_OPTIONAL * value in %NL80211_ATTR_USE_MFP. * @NL80211_EXT_FEATURE_LOW_SPAN_SCAN: Driver supports low span scan. * @NL80211_EXT_FEATURE_LOW_POWER_SCAN: Driver supports low power scan. * @NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN: Driver supports high accuracy scan. * @NL80211_EXT_FEATURE_DFS_OFFLOAD: HW/driver will offload DFS actions. * Device or driver will do all DFS-related actions by itself, * informing user-space about CAC progress, radar detection event, * channel change triggered by radar detection event. * No need to start CAC from user-space, no need to react to * "radar detected" event. * @NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211: Driver supports sending and * receiving control port frames over nl80211 instead of the netdevice. * @NL80211_EXT_FEATURE_DATA_ACK_SIGNAL_SUPPORT: This Driver support data ack * rssi if firmware support, this flag is to intimate about ack rssi * support to nl80211. * @NL80211_EXT_FEATURE_TXQS: Driver supports FQ-CoDel-enabled intermediate * TXQs. * @NL80211_EXT_FEATURE_SCAN_RANDOM_SN: Driver/device supports randomizing the * SN in probe request frames if requested by %NL80211_SCAN_FLAG_RANDOM_SN. * @NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT: Driver/device can omit all data * except for supported rates from the probe request content if requested * by the %NL80211_SCAN_FLAG_MIN_PREQ_CONTENT flag. * * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. */ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_VHT_IBSS, NL80211_EXT_FEATURE_RRM, NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER, NL80211_EXT_FEATURE_SCAN_START_TIME, NL80211_EXT_FEATURE_BSS_PARENT_TSF, NL80211_EXT_FEATURE_SET_SCAN_DWELL, NL80211_EXT_FEATURE_BEACON_RATE_LEGACY, NL80211_EXT_FEATURE_BEACON_RATE_HT, NL80211_EXT_FEATURE_BEACON_RATE_VHT, NL80211_EXT_FEATURE_FILS_STA, NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA, NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA_CONNECTED, NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI, NL80211_EXT_FEATURE_CQM_RSSI_LIST, NL80211_EXT_FEATURE_FILS_SK_OFFLOAD, NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK, NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X, NL80211_EXT_FEATURE_FILS_MAX_CHANNEL_TIME, NL80211_EXT_FEATURE_ACCEPT_BCAST_PROBE_RESP, NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE, NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION, NL80211_EXT_FEATURE_MFP_OPTIONAL, NL80211_EXT_FEATURE_LOW_SPAN_SCAN, NL80211_EXT_FEATURE_LOW_POWER_SCAN, NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN, NL80211_EXT_FEATURE_DFS_OFFLOAD, NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211, NL80211_EXT_FEATURE_DATA_ACK_SIGNAL_SUPPORT, NL80211_EXT_FEATURE_TXQS, NL80211_EXT_FEATURE_SCAN_RANDOM_SN, NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1 }; /** * enum nl80211_probe_resp_offload_support_attr - optional supported * protocols for probe-response offloading by the driver/FW. * To be used with the %NL80211_ATTR_PROBE_RESP_OFFLOAD attribute. * Each enum value represents a bit in the bitmap of supported * protocols. Typically a subset of probe-requests belonging to a * supported protocol will be excluded from offload and uploaded * to the host. * * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS: Support for WPS ver. 1 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2: Support for WPS ver. 2 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P: Support for P2P * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U: Support for 802.11u */ enum nl80211_probe_resp_offload_support_attr { NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS = 1<<0, NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 = 1<<1, NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P = 1<<2, NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U = 1<<3, }; /** * enum nl80211_connect_failed_reason - connection request failed reasons * @NL80211_CONN_FAIL_MAX_CLIENTS: Maximum number of clients that can be * handled by the AP is reached. * @NL80211_CONN_FAIL_BLOCKED_CLIENT: Connection request is rejected due to ACL. */ enum nl80211_connect_failed_reason { NL80211_CONN_FAIL_MAX_CLIENTS, NL80211_CONN_FAIL_BLOCKED_CLIENT, }; /** * enum nl80211_timeout_reason - timeout reasons * * @NL80211_TIMEOUT_UNSPECIFIED: Timeout reason unspecified. * @NL80211_TIMEOUT_SCAN: Scan (AP discovery) timed out. * @NL80211_TIMEOUT_AUTH: Authentication timed out. * @NL80211_TIMEOUT_ASSOC: Association timed out. */ enum nl80211_timeout_reason { NL80211_TIMEOUT_UNSPECIFIED, NL80211_TIMEOUT_SCAN, NL80211_TIMEOUT_AUTH, NL80211_TIMEOUT_ASSOC, }; /** * enum nl80211_scan_flags - scan request control flags * * Scan request control flags are used to control the handling * of NL80211_CMD_TRIGGER_SCAN and NL80211_CMD_START_SCHED_SCAN * requests. * * NL80211_SCAN_FLAG_LOW_SPAN, NL80211_SCAN_FLAG_LOW_POWER, and * NL80211_SCAN_FLAG_HIGH_ACCURACY flags are exclusive of each other, i.e., only * one of them can be used in the request. * * @NL80211_SCAN_FLAG_LOW_PRIORITY: scan request has low priority * @NL80211_SCAN_FLAG_FLUSH: flush cache before scanning * @NL80211_SCAN_FLAG_AP: force a scan even if the interface is configured * as AP and the beaconing has already been configured. This attribute is * dangerous because will destroy stations performance as a lot of frames * will be lost while scanning off-channel, therefore it must be used only * when really needed * @NL80211_SCAN_FLAG_RANDOM_ADDR: use a random MAC address for this scan (or * for scheduled scan: a different one for every scan iteration). When the * flag is set, depending on device capabilities the @NL80211_ATTR_MAC and * @NL80211_ATTR_MAC_MASK attributes may also be given in which case only * the masked bits will be preserved from the MAC address and the remainder * randomised. If the attributes are not given full randomisation (46 bits, * locally administered 1, multicast 0) is assumed. * This flag must not be requested when the feature isn't supported, check * the nl80211 feature flags for the device. * @NL80211_SCAN_FLAG_FILS_MAX_CHANNEL_TIME: fill the dwell time in the FILS * request parameters IE in the probe request * @NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP: accept broadcast probe responses * @NL80211_SCAN_FLAG_OCE_PROBE_REQ_HIGH_TX_RATE: send probe request frames at * rate of at least 5.5M. In case non OCE AP is dicovered in the channel, * only the first probe req in the channel will be sent in high rate. * @NL80211_SCAN_FLAG_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION: allow probe request * tx deferral (dot11FILSProbeDelay shall be set to 15ms) * and suppression (if it has received a broadcast Probe Response frame, * Beacon frame or FILS Discovery frame from an AP that the STA considers * a suitable candidate for (re-)association - suitable in terms of * SSID and/or RSSI. * @NL80211_SCAN_FLAG_LOW_SPAN: Span corresponds to the total time taken to * accomplish the scan. Thus, this flag intends the driver to perform the * scan request with lesser span/duration. It is specific to the driver * implementations on how this is accomplished. Scan accuracy may get * impacted with this flag. * @NL80211_SCAN_FLAG_LOW_POWER: This flag intends the scan attempts to consume * optimal possible power. Drivers can resort to their specific means to * optimize the power. Scan accuracy may get impacted with this flag. * @NL80211_SCAN_FLAG_HIGH_ACCURACY: Accuracy here intends to the extent of scan * results obtained. Thus HIGH_ACCURACY scan flag aims to get maximum * possible scan results. This flag hints the driver to use the best * possible scan configuration to improve the accuracy in scanning. * Latency and power use may get impacted with this flag. * @NL80211_SCAN_FLAG_RANDOM_SN: randomize the sequence number in probe * request frames from this scan to avoid correlation/tracking being * possible. * @NL80211_SCAN_FLAG_MIN_PREQ_CONTENT: minimize probe request content to * only have supported rates and no additional capabilities (unless * added by userspace explicitly.) */ enum nl80211_scan_flags { NL80211_SCAN_FLAG_LOW_PRIORITY = 1<<0, NL80211_SCAN_FLAG_FLUSH = 1<<1, NL80211_SCAN_FLAG_AP = 1<<2, NL80211_SCAN_FLAG_RANDOM_ADDR = 1<<3, NL80211_SCAN_FLAG_FILS_MAX_CHANNEL_TIME = 1<<4, NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP = 1<<5, NL80211_SCAN_FLAG_OCE_PROBE_REQ_HIGH_TX_RATE = 1<<6, NL80211_SCAN_FLAG_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION = 1<<7, NL80211_SCAN_FLAG_LOW_SPAN = 1<<8, NL80211_SCAN_FLAG_LOW_POWER = 1<<9, NL80211_SCAN_FLAG_HIGH_ACCURACY = 1<<10, NL80211_SCAN_FLAG_RANDOM_SN = 1<<11, NL80211_SCAN_FLAG_MIN_PREQ_CONTENT = 1<<12, }; /** * enum nl80211_acl_policy - access control policy * * Access control policy is applied on a MAC list set by * %NL80211_CMD_START_AP and %NL80211_CMD_SET_MAC_ACL, to * be used with %NL80211_ATTR_ACL_POLICY. * * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are * listed in ACL, i.e. allow all the stations which are not listed * in ACL to authenticate. * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow the stations which are listed * in ACL, i.e. deny all the stations which are not listed in ACL. */ enum nl80211_acl_policy { NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED, NL80211_ACL_POLICY_DENY_UNLESS_LISTED, }; /** * enum nl80211_smps_mode - SMPS mode * * Requested SMPS mode (for AP mode) * * @NL80211_SMPS_OFF: SMPS off (use all antennas). * @NL80211_SMPS_STATIC: static SMPS (use a single antenna) * @NL80211_SMPS_DYNAMIC: dynamic smps (start with a single antenna and * turn on other antennas after CTS/RTS). */ enum nl80211_smps_mode { NL80211_SMPS_OFF, NL80211_SMPS_STATIC, NL80211_SMPS_DYNAMIC, __NL80211_SMPS_AFTER_LAST, NL80211_SMPS_MAX = __NL80211_SMPS_AFTER_LAST - 1 }; /** * enum nl80211_radar_event - type of radar event for DFS operation * * Type of event to be used with NL80211_ATTR_RADAR_EVENT to inform userspace * about detected radars or success of the channel available check (CAC) * * @NL80211_RADAR_DETECTED: A radar pattern has been detected. The channel is * now unusable. * @NL80211_RADAR_CAC_FINISHED: Channel Availability Check has been finished, * the channel is now available. * @NL80211_RADAR_CAC_ABORTED: Channel Availability Check has been aborted, no * change to the channel status. * @NL80211_RADAR_NOP_FINISHED: The Non-Occupancy Period for this channel is * over, channel becomes usable. * @NL80211_RADAR_PRE_CAC_EXPIRED: Channel Availability Check done on this * non-operating channel is expired and no longer valid. New CAC must * be done on this channel before starting the operation. This is not * applicable for ETSI dfs domain where pre-CAC is valid for ever. * @NL80211_RADAR_CAC_STARTED: Channel Availability Check has been started, * should be generated by HW if NL80211_EXT_FEATURE_DFS_OFFLOAD is enabled. */ enum nl80211_radar_event { NL80211_RADAR_DETECTED, NL80211_RADAR_CAC_FINISHED, NL80211_RADAR_CAC_ABORTED, NL80211_RADAR_NOP_FINISHED, NL80211_RADAR_PRE_CAC_EXPIRED, NL80211_RADAR_CAC_STARTED, }; /** * enum nl80211_dfs_state - DFS states for channels * * Channel states used by the DFS code. * * @NL80211_DFS_USABLE: The channel can be used, but channel availability * check (CAC) must be performed before using it for AP or IBSS. * @NL80211_DFS_UNAVAILABLE: A radar has been detected on this channel, it * is therefore marked as not available. * @NL80211_DFS_AVAILABLE: The channel has been CAC checked and is available. */ enum nl80211_dfs_state { NL80211_DFS_USABLE, NL80211_DFS_UNAVAILABLE, NL80211_DFS_AVAILABLE, }; /** * enum enum nl80211_protocol_features - nl80211 protocol features * @NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP: nl80211 supports splitting * wiphy dumps (if requested by the application with the attribute * %NL80211_ATTR_SPLIT_WIPHY_DUMP. Also supported is filtering the * wiphy dump by %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFINDEX or * %NL80211_ATTR_WDEV. */ enum nl80211_protocol_features { NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP = 1 << 0, }; /** * enum nl80211_crit_proto_id - nl80211 critical protocol identifiers * * @NL80211_CRIT_PROTO_UNSPEC: protocol unspecified. * @NL80211_CRIT_PROTO_DHCP: BOOTP or DHCPv6 protocol. * @NL80211_CRIT_PROTO_EAPOL: EAPOL protocol. * @NL80211_CRIT_PROTO_APIPA: APIPA protocol. * @NUM_NL80211_CRIT_PROTO: must be kept last. */ enum nl80211_crit_proto_id { NL80211_CRIT_PROTO_UNSPEC, NL80211_CRIT_PROTO_DHCP, NL80211_CRIT_PROTO_EAPOL, NL80211_CRIT_PROTO_APIPA, /* add other protocols before this one */ NUM_NL80211_CRIT_PROTO }; /* maximum duration for critical protocol measures */ #define NL80211_CRIT_PROTO_MAX_DURATION 5000 /* msec */ /** * enum nl80211_rxmgmt_flags - flags for received management frame. * * Used by cfg80211_rx_mgmt() * * @NL80211_RXMGMT_FLAG_ANSWERED: frame was answered by device/driver. */ enum nl80211_rxmgmt_flags { NL80211_RXMGMT_FLAG_ANSWERED = 1 << 0, }; /* * If this flag is unset, the lower 24 bits are an OUI, if set * a Linux nl80211 vendor ID is used (no such IDs are allocated * yet, so that's not valid so far) */ #define NL80211_VENDOR_ID_IS_LINUX 0x80000000 /** * struct nl80211_vendor_cmd_info - vendor command data * @vendor_id: If the %NL80211_VENDOR_ID_IS_LINUX flag is clear, then the * value is a 24-bit OUI; if it is set then a separately allocated ID * may be used, but no such IDs are allocated yet. New IDs should be * added to this file when needed. * @subcmd: sub-command ID for the command */ struct nl80211_vendor_cmd_info { __u32 vendor_id; __u32 subcmd; }; /** * enum nl80211_tdls_peer_capability - TDLS peer flags. * * Used by tdls_mgmt() to determine which conditional elements need * to be added to TDLS Setup frames. * * @NL80211_TDLS_PEER_HT: TDLS peer is HT capable. * @NL80211_TDLS_PEER_VHT: TDLS peer is VHT capable. * @NL80211_TDLS_PEER_WMM: TDLS peer is WMM capable. */ enum nl80211_tdls_peer_capability { NL80211_TDLS_PEER_HT = 1<<0, NL80211_TDLS_PEER_VHT = 1<<1, NL80211_TDLS_PEER_WMM = 1<<2, }; /** * enum nl80211_sched_scan_plan - scanning plan for scheduled scan * @__NL80211_SCHED_SCAN_PLAN_INVALID: attribute number 0 is reserved * @NL80211_SCHED_SCAN_PLAN_INTERVAL: interval between scan iterations. In * seconds (u32). * @NL80211_SCHED_SCAN_PLAN_ITERATIONS: number of scan iterations in this * scan plan (u32). The last scan plan must not specify this attribute * because it will run infinitely. A value of zero is invalid as it will * make the scan plan meaningless. * @NL80211_SCHED_SCAN_PLAN_MAX: highest scheduled scan plan attribute number * currently defined * @__NL80211_SCHED_SCAN_PLAN_AFTER_LAST: internal use */ enum nl80211_sched_scan_plan { __NL80211_SCHED_SCAN_PLAN_INVALID, NL80211_SCHED_SCAN_PLAN_INTERVAL, NL80211_SCHED_SCAN_PLAN_ITERATIONS, /* keep last */ __NL80211_SCHED_SCAN_PLAN_AFTER_LAST, NL80211_SCHED_SCAN_PLAN_MAX = __NL80211_SCHED_SCAN_PLAN_AFTER_LAST - 1 }; /** * struct nl80211_bss_select_rssi_adjust - RSSI adjustment parameters. * * @band: band of BSS that must match for RSSI value adjustment. The value * of this field is according to &enum nl80211_band. * @delta: value used to adjust the RSSI value of matching BSS in dB. */ struct nl80211_bss_select_rssi_adjust { __u8 band; __s8 delta; } __attribute__((packed)); /** * enum nl80211_bss_select_attr - attributes for bss selection. * * @__NL80211_BSS_SELECT_ATTR_INVALID: reserved. * @NL80211_BSS_SELECT_ATTR_RSSI: Flag indicating only RSSI-based BSS selection * is requested. * @NL80211_BSS_SELECT_ATTR_BAND_PREF: attribute indicating BSS * selection should be done such that the specified band is preferred. * When there are multiple BSS-es in the preferred band, the driver * shall use RSSI-based BSS selection as a second step. The value of * this attribute is according to &enum nl80211_band (u32). * @NL80211_BSS_SELECT_ATTR_RSSI_ADJUST: When present the RSSI level for * BSS-es in the specified band is to be adjusted before doing * RSSI-based BSS selection. The attribute value is a packed structure * value as specified by &struct nl80211_bss_select_rssi_adjust. * @NL80211_BSS_SELECT_ATTR_MAX: highest bss select attribute number. * @__NL80211_BSS_SELECT_ATTR_AFTER_LAST: internal use. * * One and only one of these attributes are found within %NL80211_ATTR_BSS_SELECT * for %NL80211_CMD_CONNECT. It specifies the required BSS selection behaviour * which the driver shall use. */ enum nl80211_bss_select_attr { __NL80211_BSS_SELECT_ATTR_INVALID, NL80211_BSS_SELECT_ATTR_RSSI, NL80211_BSS_SELECT_ATTR_BAND_PREF, NL80211_BSS_SELECT_ATTR_RSSI_ADJUST, /* keep last */ __NL80211_BSS_SELECT_ATTR_AFTER_LAST, NL80211_BSS_SELECT_ATTR_MAX = __NL80211_BSS_SELECT_ATTR_AFTER_LAST - 1 }; /** * enum nl80211_nan_function_type - NAN function type * * Defines the function type of a NAN function * * @NL80211_NAN_FUNC_PUBLISH: function is publish * @NL80211_NAN_FUNC_SUBSCRIBE: function is subscribe * @NL80211_NAN_FUNC_FOLLOW_UP: function is follow-up */ enum nl80211_nan_function_type { NL80211_NAN_FUNC_PUBLISH, NL80211_NAN_FUNC_SUBSCRIBE, NL80211_NAN_FUNC_FOLLOW_UP, /* keep last */ __NL80211_NAN_FUNC_TYPE_AFTER_LAST, NL80211_NAN_FUNC_MAX_TYPE = __NL80211_NAN_FUNC_TYPE_AFTER_LAST - 1, }; /** * enum nl80211_nan_publish_type - NAN publish tx type * * Defines how to send publish Service Discovery Frames * * @NL80211_NAN_SOLICITED_PUBLISH: publish function is solicited * @NL80211_NAN_UNSOLICITED_PUBLISH: publish function is unsolicited */ enum nl80211_nan_publish_type { NL80211_NAN_SOLICITED_PUBLISH = 1 << 0, NL80211_NAN_UNSOLICITED_PUBLISH = 1 << 1, }; /** * enum nl80211_nan_func_term_reason - NAN functions termination reason * * Defines termination reasons of a NAN function * * @NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST: requested by user * @NL80211_NAN_FUNC_TERM_REASON_TTL_EXPIRED: timeout * @NL80211_NAN_FUNC_TERM_REASON_ERROR: errored */ enum nl80211_nan_func_term_reason { NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST, NL80211_NAN_FUNC_TERM_REASON_TTL_EXPIRED, NL80211_NAN_FUNC_TERM_REASON_ERROR, }; #define NL80211_NAN_FUNC_SERVICE_ID_LEN 6 #define NL80211_NAN_FUNC_SERVICE_SPEC_INFO_MAX_LEN 0xff #define NL80211_NAN_FUNC_SRF_MAX_LEN 0xff /** * enum nl80211_nan_func_attributes - NAN function attributes * @__NL80211_NAN_FUNC_INVALID: invalid * @NL80211_NAN_FUNC_TYPE: &enum nl80211_nan_function_type (u8). * @NL80211_NAN_FUNC_SERVICE_ID: 6 bytes of the service ID hash as * specified in NAN spec. This is a binary attribute. * @NL80211_NAN_FUNC_PUBLISH_TYPE: relevant if the function's type is * publish. Defines the transmission type for the publish Service Discovery * Frame, see &enum nl80211_nan_publish_type. Its type is u8. * @NL80211_NAN_FUNC_PUBLISH_BCAST: relevant if the function is a solicited * publish. Should the solicited publish Service Discovery Frame be sent to * the NAN Broadcast address. This is a flag. * @NL80211_NAN_FUNC_SUBSCRIBE_ACTIVE: relevant if the function's type is * subscribe. Is the subscribe active. This is a flag. * @NL80211_NAN_FUNC_FOLLOW_UP_ID: relevant if the function's type is follow up. * The instance ID for the follow up Service Discovery Frame. This is u8. * @NL80211_NAN_FUNC_FOLLOW_UP_REQ_ID: relevant if the function's type * is follow up. This is a u8. * The requestor instance ID for the follow up Service Discovery Frame. * @NL80211_NAN_FUNC_FOLLOW_UP_DEST: the MAC address of the recipient of the * follow up Service Discovery Frame. This is a binary attribute. * @NL80211_NAN_FUNC_CLOSE_RANGE: is this function limited for devices in a * close range. The range itself (RSSI) is defined by the device. * This is a flag. * @NL80211_NAN_FUNC_TTL: strictly positive number of DWs this function should * stay active. If not present infinite TTL is assumed. This is a u32. * @NL80211_NAN_FUNC_SERVICE_INFO: array of bytes describing the service * specific info. This is a binary attribute. * @NL80211_NAN_FUNC_SRF: Service Receive Filter. This is a nested attribute. * See &enum nl80211_nan_srf_attributes. * @NL80211_NAN_FUNC_RX_MATCH_FILTER: Receive Matching filter. This is a nested * attribute. It is a list of binary values. * @NL80211_NAN_FUNC_TX_MATCH_FILTER: Transmit Matching filter. This is a * nested attribute. It is a list of binary values. * @NL80211_NAN_FUNC_INSTANCE_ID: The instance ID of the function. * Its type is u8 and it cannot be 0. * @NL80211_NAN_FUNC_TERM_REASON: NAN function termination reason. * See &enum nl80211_nan_func_term_reason. * * @NUM_NL80211_NAN_FUNC_ATTR: internal * @NL80211_NAN_FUNC_ATTR_MAX: highest NAN function attribute */ enum nl80211_nan_func_attributes { __NL80211_NAN_FUNC_INVALID, NL80211_NAN_FUNC_TYPE, NL80211_NAN_FUNC_SERVICE_ID, NL80211_NAN_FUNC_PUBLISH_TYPE, NL80211_NAN_FUNC_PUBLISH_BCAST, NL80211_NAN_FUNC_SUBSCRIBE_ACTIVE, NL80211_NAN_FUNC_FOLLOW_UP_ID, NL80211_NAN_FUNC_FOLLOW_UP_REQ_ID, NL80211_NAN_FUNC_FOLLOW_UP_DEST, NL80211_NAN_FUNC_CLOSE_RANGE, NL80211_NAN_FUNC_TTL, NL80211_NAN_FUNC_SERVICE_INFO, NL80211_NAN_FUNC_SRF, NL80211_NAN_FUNC_RX_MATCH_FILTER, NL80211_NAN_FUNC_TX_MATCH_FILTER, NL80211_NAN_FUNC_INSTANCE_ID, NL80211_NAN_FUNC_TERM_REASON, /* keep last */ NUM_NL80211_NAN_FUNC_ATTR, NL80211_NAN_FUNC_ATTR_MAX = NUM_NL80211_NAN_FUNC_ATTR - 1 }; /** * enum nl80211_nan_srf_attributes - NAN Service Response filter attributes * @__NL80211_NAN_SRF_INVALID: invalid * @NL80211_NAN_SRF_INCLUDE: present if the include bit of the SRF set. * This is a flag. * @NL80211_NAN_SRF_BF: Bloom Filter. Present if and only if * %NL80211_NAN_SRF_MAC_ADDRS isn't present. This attribute is binary. * @NL80211_NAN_SRF_BF_IDX: index of the Bloom Filter. Mandatory if * %NL80211_NAN_SRF_BF is present. This is a u8. * @NL80211_NAN_SRF_MAC_ADDRS: list of MAC addresses for the SRF. Present if * and only if %NL80211_NAN_SRF_BF isn't present. This is a nested * attribute. Each nested attribute is a MAC address. * @NUM_NL80211_NAN_SRF_ATTR: internal * @NL80211_NAN_SRF_ATTR_MAX: highest NAN SRF attribute */ enum nl80211_nan_srf_attributes { __NL80211_NAN_SRF_INVALID, NL80211_NAN_SRF_INCLUDE, NL80211_NAN_SRF_BF, NL80211_NAN_SRF_BF_IDX, NL80211_NAN_SRF_MAC_ADDRS, /* keep last */ NUM_NL80211_NAN_SRF_ATTR, NL80211_NAN_SRF_ATTR_MAX = NUM_NL80211_NAN_SRF_ATTR - 1, }; /** * enum nl80211_nan_match_attributes - NAN match attributes * @__NL80211_NAN_MATCH_INVALID: invalid * @NL80211_NAN_MATCH_FUNC_LOCAL: the local function that had the * match. This is a nested attribute. * See &enum nl80211_nan_func_attributes. * @NL80211_NAN_MATCH_FUNC_PEER: the peer function * that caused the match. This is a nested attribute. * See &enum nl80211_nan_func_attributes. * * @NUM_NL80211_NAN_MATCH_ATTR: internal * @NL80211_NAN_MATCH_ATTR_MAX: highest NAN match attribute */ enum nl80211_nan_match_attributes { __NL80211_NAN_MATCH_INVALID, NL80211_NAN_MATCH_FUNC_LOCAL, NL80211_NAN_MATCH_FUNC_PEER, /* keep last */ NUM_NL80211_NAN_MATCH_ATTR, NL80211_NAN_MATCH_ATTR_MAX = NUM_NL80211_NAN_MATCH_ATTR - 1 }; /** * nl80211_external_auth_action - Action to perform with external * authentication request. Used by NL80211_ATTR_EXTERNAL_AUTH_ACTION. * @NL80211_EXTERNAL_AUTH_START: Start the authentication. * @NL80211_EXTERNAL_AUTH_ABORT: Abort the ongoing authentication. */ enum nl80211_external_auth_action { NL80211_EXTERNAL_AUTH_START, NL80211_EXTERNAL_AUTH_ABORT, }; #endif /* __LINUX_NL80211_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/irqnr.h���������������������������������������������������������������������������������������0000644�����������������00000000150�14763166027�0007217 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * There isn't anything here anymore, but the file must not be empty or patch * will delete it. */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/meye.h����������������������������������������������������������������������������������������0000644�����������������00000004741�14763166027�0007035 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Motion Eye video4linux driver for Sony Vaio PictureBook * * Copyright (C) 2001-2003 Stelian Pop <stelian@popies.net> * * Copyright (C) 2001-2002 Alcôve <www.alcove.com> * * Copyright (C) 2000 Andrew Tridgell <tridge@valinux.com> * * Earlier work by Werner Almesberger, Paul `Rusty' Russell and Paul Mackerras. * * Some parts borrowed from various video4linux drivers, especially * bttv-driver.c and zoran.c, see original files for credits. * * 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. */ #ifndef _MEYE_H_ #define _MEYE_H_ /****************************************************************************/ /* Private API for handling mjpeg capture / playback. */ /****************************************************************************/ struct meye_params { unsigned char subsample; unsigned char quality; unsigned char sharpness; unsigned char agc; unsigned char picture; unsigned char framerate; }; /* query the extended parameters */ #define MEYEIOC_G_PARAMS _IOR ('v', BASE_VIDIOC_PRIVATE+0, struct meye_params) /* set the extended parameters */ #define MEYEIOC_S_PARAMS _IOW ('v', BASE_VIDIOC_PRIVATE+1, struct meye_params) /* queue a buffer for mjpeg capture */ #define MEYEIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOC_PRIVATE+2, int) /* sync a previously queued mjpeg buffer */ #define MEYEIOC_SYNC _IOWR('v', BASE_VIDIOC_PRIVATE+3, int) /* get a still uncompressed snapshot */ #define MEYEIOC_STILLCAPT _IO ('v', BASE_VIDIOC_PRIVATE+4) /* get a jpeg compressed snapshot */ #define MEYEIOC_STILLJCAPT _IOR ('v', BASE_VIDIOC_PRIVATE+5, int) /* V4L2 private controls */ #define V4L2_CID_MEYE_AGC (V4L2_CID_USER_MEYE_BASE + 0) #define V4L2_CID_MEYE_PICTURE (V4L2_CID_USER_MEYE_BASE + 1) #define V4L2_CID_MEYE_FRAMERATE (V4L2_CID_USER_MEYE_BASE + 2) #endif �������������������������������linux/fanotify.h������������������������������������������������������������������������������������0000644�����������������00000007130�14763166027�0007710 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_FANOTIFY_H #define _LINUX_FANOTIFY_H #include <linux/types.h> /* the following events that user-space can register for */ #define FAN_ACCESS 0x00000001 /* File was accessed */ #define FAN_MODIFY 0x00000002 /* File was modified */ #define FAN_CLOSE_WRITE 0x00000008 /* Writtable file closed */ #define FAN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */ #define FAN_OPEN 0x00000020 /* File was opened */ #define FAN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */ #define FAN_OPEN_PERM 0x00010000 /* File open in perm check */ #define FAN_ACCESS_PERM 0x00020000 /* File accessed in perm check */ #define FAN_ONDIR 0x40000000 /* event occurred against dir */ #define FAN_EVENT_ON_CHILD 0x08000000 /* interested in child events */ /* helper events */ #define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE) /* close */ /* flags used for fanotify_init() */ #define FAN_CLOEXEC 0x00000001 #define FAN_NONBLOCK 0x00000002 /* These are NOT bitwise flags. Both bits are used togther. */ #define FAN_CLASS_NOTIF 0x00000000 #define FAN_CLASS_CONTENT 0x00000004 #define FAN_CLASS_PRE_CONTENT 0x00000008 #define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | \ FAN_CLASS_PRE_CONTENT) #define FAN_UNLIMITED_QUEUE 0x00000010 #define FAN_UNLIMITED_MARKS 0x00000020 #define FAN_ENABLE_AUDIT 0x00000040 #define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | \ FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE |\ FAN_UNLIMITED_MARKS) /* flags used for fanotify_modify_mark() */ #define FAN_MARK_ADD 0x00000001 #define FAN_MARK_REMOVE 0x00000002 #define FAN_MARK_DONT_FOLLOW 0x00000004 #define FAN_MARK_ONLYDIR 0x00000008 #define FAN_MARK_MOUNT 0x00000010 #define FAN_MARK_IGNORED_MASK 0x00000020 #define FAN_MARK_IGNORED_SURV_MODIFY 0x00000040 #define FAN_MARK_FLUSH 0x00000080 #define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD |\ FAN_MARK_REMOVE |\ FAN_MARK_DONT_FOLLOW |\ FAN_MARK_ONLYDIR |\ FAN_MARK_MOUNT |\ FAN_MARK_IGNORED_MASK |\ FAN_MARK_IGNORED_SURV_MODIFY |\ FAN_MARK_FLUSH) /* * All of the events - we build the list by hand so that we can add flags in * the future and not break backward compatibility. Apps will get only the * events that they originally wanted. Be sure to add new events here! */ #define FAN_ALL_EVENTS (FAN_ACCESS |\ FAN_MODIFY |\ FAN_CLOSE |\ FAN_OPEN) /* * All events which require a permission response from userspace */ #define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM |\ FAN_ACCESS_PERM) #define FAN_ALL_OUTGOING_EVENTS (FAN_ALL_EVENTS |\ FAN_ALL_PERM_EVENTS |\ FAN_Q_OVERFLOW) #define FANOTIFY_METADATA_VERSION 3 struct fanotify_event_metadata { __u32 event_len; __u8 vers; __u8 reserved; __u16 metadata_len; __aligned_u64 mask; __s32 fd; __s32 pid; }; struct fanotify_response { __s32 fd; __u32 response; }; /* Legit userspace responses to a _PERM event */ #define FAN_ALLOW 0x01 #define FAN_DENY 0x02 #define FAN_AUDIT 0x10 /* Bit mask to create audit record for result */ /* No fd set in event */ #define FAN_NOFD -1 /* Helper functions to deal with fanotify_event_metadata buffers */ #define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata)) #define FAN_EVENT_NEXT(meta, len) ((len) -= (meta)->event_len, \ (struct fanotify_event_metadata*)(((char *)(meta)) + \ (meta)->event_len)) #define FAN_EVENT_OK(meta, len) ((long)(len) >= (long)FAN_EVENT_METADATA_LEN && \ (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && \ (long)(meta)->event_len <= (long)(len)) #endif /* _LINUX_FANOTIFY_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/mei.h�����������������������������������������������������������������������������������������0000644�����������������00000011317�14763166027�0006645 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /****************************************************************************** * Intel Management Engine Interface (Intel MEI) Linux driver * Intel MEI Interface Header * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license. * * GPL LICENSE SUMMARY * * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, * USA * * The full GNU General Public License is included in this distribution * in the file called LICENSE.GPL. * * Contact Information: * Intel Corporation. * linux-mei@linux.intel.com * http://www.intel.com * * BSD LICENSE * * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *****************************************************************************/ #ifndef _LINUX_MEI_H #define _LINUX_MEI_H #include <linux/uuid.h> /* * This IOCTL is used to associate the current file descriptor with a * FW Client (given by UUID). This opens a communication channel * between a host client and a FW client. From this point every read and write * will communicate with the associated FW client. * Only in close() (file_operation release()) the communication between * the clients is disconnected * * The IOCTL argument is a struct with a union that contains * the input parameter and the output parameter for this IOCTL. * * The input parameter is UUID of the FW Client. * The output parameter is the properties of the FW client * (FW protocol version and max message size). * */ #define IOCTL_MEI_CONNECT_CLIENT \ _IOWR('H' , 0x01, struct mei_connect_client_data) /* * Intel MEI client information struct */ struct mei_client { __u32 max_msg_length; __u8 protocol_version; __u8 reserved[3]; }; /* * IOCTL Connect Client Data structure */ struct mei_connect_client_data { union { uuid_le in_client_uuid; struct mei_client out_client_properties; }; }; /** * DOC: set and unset event notification for a connected client * * The IOCTL argument is 1 for enabling event notification and 0 for * disabling the service * Return: -EOPNOTSUPP if the devices doesn't support the feature */ #define IOCTL_MEI_NOTIFY_SET _IOW('H', 0x02, __u32) /** * DOC: retrieve notification * * The IOCTL output argument is 1 if an event was is pending and 0 otherwise * the ioctl has to be called in order to acknowledge pending event * * Return: -EOPNOTSUPP if the devices doesn't support the feature */ #define IOCTL_MEI_NOTIFY_GET _IOR('H', 0x03, __u32) #endif /* _LINUX_MEI_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/i2c-dev.h�������������������������������������������������������������������������������������0000644�����������������00000005064�14763166027�0007326 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* i2c-dev.h - i2c-bus driver, char device interface Copyright (C) 1995-97 Simon G. Vogl Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl> 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef _LINUX_I2C_DEV_H #define _LINUX_I2C_DEV_H #include <linux/types.h> /* /dev/i2c-X ioctl commands. The ioctl's parameter is always an * unsigned long, except for: * - I2C_FUNCS, takes pointer to an unsigned long * - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data * - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data */ #define I2C_RETRIES 0x0701 /* number of times a device address should be polled when not acknowledging */ #define I2C_TIMEOUT 0x0702 /* set timeout in units of 10 ms */ /* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses * are NOT supported! (due to code brokenness) */ #define I2C_SLAVE 0x0703 /* Use this slave address */ #define I2C_SLAVE_FORCE 0x0706 /* Use this slave address, even if it is already in use by a driver! */ #define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */ #define I2C_FUNCS 0x0705 /* Get the adapter functionality mask */ #define I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */ #define I2C_PEC 0x0708 /* != 0 to use PEC with SMBus */ #define I2C_SMBUS 0x0720 /* SMBus transfer */ /* This is the structure as used in the I2C_SMBUS ioctl call */ struct i2c_smbus_ioctl_data { __u8 read_write; __u8 command; __u32 size; union i2c_smbus_data *data; }; /* This is the structure as used in the I2C_RDWR ioctl call */ struct i2c_rdwr_ioctl_data { struct i2c_msg *msgs; /* pointers to i2c_msgs */ __u32 nmsgs; /* number of i2c_msgs */ }; #define I2C_RDWR_IOCTL_MAX_MSGS 42 /* Originally defined with a typo, keep it for compatibility */ #define I2C_RDRW_IOCTL_MAX_MSGS I2C_RDWR_IOCTL_MAX_MSGS #endif /* _LINUX_I2C_DEV_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/map_to_7segment.h�����������������������������������������������������������������������������0000644�����������������00000016123�14763166027�0011163 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 2005 Henk Vergonet <Henk.Vergonet@gmail.com> * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef MAP_TO_7SEGMENT_H #define MAP_TO_7SEGMENT_H /* This file provides translation primitives and tables for the conversion * of (ASCII) characters to a 7-segments notation. * * The 7 segment's wikipedia notation below is used as standard. * See: http://en.wikipedia.org/wiki/Seven_segment_display * * Notation: +-a-+ * f b * +-g-+ * e c * +-d-+ * * Usage: * * Register a map variable, and fill it with a character set: * static SEG7_DEFAULT_MAP(map_seg7); * * * Then use for conversion: * seg7 = map_to_seg7(&map_seg7, some_char); * ... * * In device drivers it is recommended, if required, to make the char map * accessible via the sysfs interface using the following scheme: * * static ssize_t show_map(struct device *dev, char *buf) { * memcpy(buf, &map_seg7, sizeof(map_seg7)); * return sizeof(map_seg7); * } * static ssize_t store_map(struct device *dev, const char *buf, size_t cnt) { * if(cnt != sizeof(map_seg7)) * return -EINVAL; * memcpy(&map_seg7, buf, cnt); * return cnt; * } * static DEVICE_ATTR(map_seg7, PERMS_RW, show_map, store_map); * * History: * 2005-05-31 RFC linux-kernel@vger.kernel.org */ #include <linux/errno.h> #define BIT_SEG7_A 0 #define BIT_SEG7_B 1 #define BIT_SEG7_C 2 #define BIT_SEG7_D 3 #define BIT_SEG7_E 4 #define BIT_SEG7_F 5 #define BIT_SEG7_G 6 #define BIT_SEG7_RESERVED 7 struct seg7_conversion_map { unsigned char table[128]; }; static __inline__ int map_to_seg7(struct seg7_conversion_map *map, int c) { return c >= 0 && c < sizeof(map->table) ? map->table[c] : -EINVAL; } #define SEG7_CONVERSION_MAP(_name, _map) \ struct seg7_conversion_map _name = { .table = { _map } } /* * It is recommended to use a facility that allows user space to redefine * custom character sets for LCD devices. Please use a sysfs interface * as described above. */ #define MAP_TO_SEG7_SYSFS_FILE "map_seg7" /******************************************************************************* * ASCII conversion table ******************************************************************************/ #define _SEG7(l,a,b,c,d,e,f,g) \ ( a<<BIT_SEG7_A | b<<BIT_SEG7_B | c<<BIT_SEG7_C | d<<BIT_SEG7_D | \ e<<BIT_SEG7_E | f<<BIT_SEG7_F | g<<BIT_SEG7_G ) #define _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, #define _MAP_33_47_ASCII_SEG7_SYMBOL \ _SEG7('!',0,0,0,0,1,1,0), _SEG7('"',0,1,0,0,0,1,0), _SEG7('#',0,1,1,0,1,1,0),\ _SEG7('$',1,0,1,1,0,1,1), _SEG7('%',0,0,1,0,0,1,0), _SEG7('&',1,0,1,1,1,1,1),\ _SEG7('\'',0,0,0,0,0,1,0),_SEG7('(',1,0,0,1,1,1,0), _SEG7(')',1,1,1,1,0,0,0),\ _SEG7('*',0,1,1,0,1,1,1), _SEG7('+',0,1,1,0,0,0,1), _SEG7(',',0,0,0,0,1,0,0),\ _SEG7('-',0,0,0,0,0,0,1), _SEG7('.',0,0,0,0,1,0,0), _SEG7('/',0,1,0,0,1,0,1), #define _MAP_48_57_ASCII_SEG7_NUMERIC \ _SEG7('0',1,1,1,1,1,1,0), _SEG7('1',0,1,1,0,0,0,0), _SEG7('2',1,1,0,1,1,0,1),\ _SEG7('3',1,1,1,1,0,0,1), _SEG7('4',0,1,1,0,0,1,1), _SEG7('5',1,0,1,1,0,1,1),\ _SEG7('6',1,0,1,1,1,1,1), _SEG7('7',1,1,1,0,0,0,0), _SEG7('8',1,1,1,1,1,1,1),\ _SEG7('9',1,1,1,1,0,1,1), #define _MAP_58_64_ASCII_SEG7_SYMBOL \ _SEG7(':',0,0,0,1,0,0,1), _SEG7(';',0,0,0,1,0,0,1), _SEG7('<',1,0,0,0,0,1,1),\ _SEG7('=',0,0,0,1,0,0,1), _SEG7('>',1,1,0,0,0,0,1), _SEG7('?',1,1,1,0,0,1,0),\ _SEG7('@',1,1,0,1,1,1,1), #define _MAP_65_90_ASCII_SEG7_ALPHA_UPPR \ _SEG7('A',1,1,1,0,1,1,1), _SEG7('B',1,1,1,1,1,1,1), _SEG7('C',1,0,0,1,1,1,0),\ _SEG7('D',1,1,1,1,1,1,0), _SEG7('E',1,0,0,1,1,1,1), _SEG7('F',1,0,0,0,1,1,1),\ _SEG7('G',1,1,1,1,0,1,1), _SEG7('H',0,1,1,0,1,1,1), _SEG7('I',0,1,1,0,0,0,0),\ _SEG7('J',0,1,1,1,0,0,0), _SEG7('K',0,1,1,0,1,1,1), _SEG7('L',0,0,0,1,1,1,0),\ _SEG7('M',1,1,1,0,1,1,0), _SEG7('N',1,1,1,0,1,1,0), _SEG7('O',1,1,1,1,1,1,0),\ _SEG7('P',1,1,0,0,1,1,1), _SEG7('Q',1,1,1,1,1,1,0), _SEG7('R',1,1,1,0,1,1,1),\ _SEG7('S',1,0,1,1,0,1,1), _SEG7('T',0,0,0,1,1,1,1), _SEG7('U',0,1,1,1,1,1,0),\ _SEG7('V',0,1,1,1,1,1,0), _SEG7('W',0,1,1,1,1,1,1), _SEG7('X',0,1,1,0,1,1,1),\ _SEG7('Y',0,1,1,0,0,1,1), _SEG7('Z',1,1,0,1,1,0,1), #define _MAP_91_96_ASCII_SEG7_SYMBOL \ _SEG7('[',1,0,0,1,1,1,0), _SEG7('\\',0,0,1,0,0,1,1),_SEG7(']',1,1,1,1,0,0,0),\ _SEG7('^',1,1,0,0,0,1,0), _SEG7('_',0,0,0,1,0,0,0), _SEG7('`',0,1,0,0,0,0,0), #define _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ _SEG7('A',1,1,1,0,1,1,1), _SEG7('b',0,0,1,1,1,1,1), _SEG7('c',0,0,0,1,1,0,1),\ _SEG7('d',0,1,1,1,1,0,1), _SEG7('E',1,0,0,1,1,1,1), _SEG7('F',1,0,0,0,1,1,1),\ _SEG7('G',1,1,1,1,0,1,1), _SEG7('h',0,0,1,0,1,1,1), _SEG7('i',0,0,1,0,0,0,0),\ _SEG7('j',0,0,1,1,0,0,0), _SEG7('k',0,0,1,0,1,1,1), _SEG7('L',0,0,0,1,1,1,0),\ _SEG7('M',1,1,1,0,1,1,0), _SEG7('n',0,0,1,0,1,0,1), _SEG7('o',0,0,1,1,1,0,1),\ _SEG7('P',1,1,0,0,1,1,1), _SEG7('q',1,1,1,0,0,1,1), _SEG7('r',0,0,0,0,1,0,1),\ _SEG7('S',1,0,1,1,0,1,1), _SEG7('T',0,0,0,1,1,1,1), _SEG7('u',0,0,1,1,1,0,0),\ _SEG7('v',0,0,1,1,1,0,0), _SEG7('W',0,1,1,1,1,1,1), _SEG7('X',0,1,1,0,1,1,1),\ _SEG7('y',0,1,1,1,0,1,1), _SEG7('Z',1,1,0,1,1,0,1), #define _MAP_123_126_ASCII_SEG7_SYMBOL \ _SEG7('{',1,0,0,1,1,1,0), _SEG7('|',0,0,0,0,1,1,0), _SEG7('}',1,1,1,1,0,0,0),\ _SEG7('~',1,0,0,0,0,0,0), /* Maps */ /* This set tries to map as close as possible to the visible characteristics * of the ASCII symbol, lowercase and uppercase letters may differ in * presentation on the display. */ #define MAP_ASCII7SEG_ALPHANUM \ _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \ _MAP_33_47_ASCII_SEG7_SYMBOL \ _MAP_48_57_ASCII_SEG7_NUMERIC \ _MAP_58_64_ASCII_SEG7_SYMBOL \ _MAP_65_90_ASCII_SEG7_ALPHA_UPPR \ _MAP_91_96_ASCII_SEG7_SYMBOL \ _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ _MAP_123_126_ASCII_SEG7_SYMBOL /* This set tries to map as close as possible to the symbolic characteristics * of the ASCII character for maximum discrimination. * For now this means all alpha chars are in lower case representations. * (This for example facilitates the use of hex numbers with uppercase input.) */ #define MAP_ASCII7SEG_ALPHANUM_LC \ _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \ _MAP_33_47_ASCII_SEG7_SYMBOL \ _MAP_48_57_ASCII_SEG7_NUMERIC \ _MAP_58_64_ASCII_SEG7_SYMBOL \ _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ _MAP_91_96_ASCII_SEG7_SYMBOL \ _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ _MAP_123_126_ASCII_SEG7_SYMBOL #define SEG7_DEFAULT_MAP(_name) \ SEG7_CONVERSION_MAP(_name,MAP_ASCII7SEG_ALPHANUM) #endif /* MAP_TO_7SEGMENT_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/isdn.h����������������������������������������������������������������������������������������0000644�����������������00000013216�14763166027�0007030 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* $Id: isdn.h,v 1.125.2.3 2004/02/10 01:07:14 keil Exp $ * * Main header for the Linux ISDN subsystem (linklevel). * * Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de) * Copyright 1995,96 by Thinking Objects Software GmbH Wuerzburg * Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de) * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * */ #ifndef __ISDN_H__ #define __ISDN_H__ #include <linux/ioctl.h> #include <linux/tty.h> #define ISDN_MAX_DRIVERS 32 #define ISDN_MAX_CHANNELS 64 /* New ioctl-codes */ #define IIOCNETAIF _IO('I',1) #define IIOCNETDIF _IO('I',2) #define IIOCNETSCF _IO('I',3) #define IIOCNETGCF _IO('I',4) #define IIOCNETANM _IO('I',5) #define IIOCNETDNM _IO('I',6) #define IIOCNETGNM _IO('I',7) #define IIOCGETSET _IO('I',8) /* no longer supported */ #define IIOCSETSET _IO('I',9) /* no longer supported */ #define IIOCSETVER _IO('I',10) #define IIOCNETHUP _IO('I',11) #define IIOCSETGST _IO('I',12) #define IIOCSETBRJ _IO('I',13) #define IIOCSIGPRF _IO('I',14) #define IIOCGETPRF _IO('I',15) #define IIOCSETPRF _IO('I',16) #define IIOCGETMAP _IO('I',17) #define IIOCSETMAP _IO('I',18) #define IIOCNETASL _IO('I',19) #define IIOCNETDIL _IO('I',20) #define IIOCGETCPS _IO('I',21) #define IIOCGETDVR _IO('I',22) #define IIOCNETLCR _IO('I',23) /* dwabc ioctl for LCR from isdnlog */ #define IIOCNETDWRSET _IO('I',24) /* dwabc ioctl to reset abc-values to default on a net-interface */ #define IIOCNETALN _IO('I',32) #define IIOCNETDLN _IO('I',33) #define IIOCNETGPN _IO('I',34) #define IIOCDBGVAR _IO('I',127) #define IIOCDRVCTL _IO('I',128) /* cisco hdlck device private ioctls */ #define SIOCGKEEPPERIOD (SIOCDEVPRIVATE + 0) #define SIOCSKEEPPERIOD (SIOCDEVPRIVATE + 1) #define SIOCGDEBSERINT (SIOCDEVPRIVATE + 2) #define SIOCSDEBSERINT (SIOCDEVPRIVATE + 3) /* Packet encapsulations for net-interfaces */ #define ISDN_NET_ENCAP_ETHER 0 #define ISDN_NET_ENCAP_RAWIP 1 #define ISDN_NET_ENCAP_IPTYP 2 #define ISDN_NET_ENCAP_CISCOHDLC 3 /* Without SLARP and keepalive */ #define ISDN_NET_ENCAP_SYNCPPP 4 #define ISDN_NET_ENCAP_UIHDLC 5 #define ISDN_NET_ENCAP_CISCOHDLCK 6 /* With SLARP and keepalive */ #define ISDN_NET_ENCAP_X25IFACE 7 /* Documentation/networking/x25-iface.txt */ #define ISDN_NET_ENCAP_MAX_ENCAP ISDN_NET_ENCAP_X25IFACE /* Facility which currently uses an ISDN-channel */ #define ISDN_USAGE_NONE 0 #define ISDN_USAGE_RAW 1 #define ISDN_USAGE_MODEM 2 #define ISDN_USAGE_NET 3 #define ISDN_USAGE_VOICE 4 #define ISDN_USAGE_FAX 5 #define ISDN_USAGE_MASK 7 /* Mask to get plain usage */ #define ISDN_USAGE_DISABLED 32 /* This bit is set, if channel is disabled */ #define ISDN_USAGE_EXCLUSIVE 64 /* This bit is set, if channel is exclusive */ #define ISDN_USAGE_OUTGOING 128 /* This bit is set, if channel is outgoing */ #define ISDN_MODEM_NUMREG 24 /* Number of Modem-Registers */ #define ISDN_LMSNLEN 255 /* Length of tty's Listen-MSN string */ #define ISDN_CMSGLEN 50 /* Length of CONNECT-Message to add for Modem */ #define ISDN_MSNLEN 32 #define NET_DV 0x06 /* Data version for isdn_net_ioctl_cfg */ #define TTY_DV 0x06 /* Data version for iprofd etc. */ #define INF_DV 0x01 /* Data version for /dev/isdninfo */ typedef struct { char drvid[25]; unsigned long arg; } isdn_ioctl_struct; typedef struct { char name[10]; char phone[ISDN_MSNLEN]; int outgoing; } isdn_net_ioctl_phone; typedef struct { char name[10]; /* Name of interface */ char master[10]; /* Name of Master for Bundling */ char slave[10]; /* Name of Slave for Bundling */ char eaz[256]; /* EAZ/MSN */ char drvid[25]; /* DriverId for Bindings */ int onhtime; /* Hangup-Timeout */ int charge; /* Charge-Units */ int l2_proto; /* Layer-2 protocol */ int l3_proto; /* Layer-3 protocol */ int p_encap; /* Encapsulation */ int exclusive; /* Channel, if bound exclusive */ int dialmax; /* Dial Retry-Counter */ int slavedelay; /* Delay until slave starts up */ int cbdelay; /* Delay before Callback */ int chargehup; /* Flag: Charge-Hangup */ int ihup; /* Flag: Hangup-Timeout on incoming line */ int secure; /* Flag: Secure */ int callback; /* Flag: Callback */ int cbhup; /* Flag: Reject Call before Callback */ int pppbind; /* ippp device for bindings */ int chargeint; /* Use fixed charge interval length */ int triggercps; /* BogoCPS needed for triggering slave */ int dialtimeout; /* Dial-Timeout */ int dialwait; /* Time to wait after failed dial */ int dialmode; /* Flag: off / on / auto */ } isdn_net_ioctl_cfg; #define ISDN_NET_DIALMODE_MASK 0xC0 /* bits for status */ #define ISDN_NET_DM_OFF 0x00 /* this interface is stopped */ #define ISDN_NET_DM_MANUAL 0x40 /* this interface is on (manual) */ #define ISDN_NET_DM_AUTO 0x80 /* this interface is autodial */ #define ISDN_NET_DIALMODE(x) ((&(x))->flags & ISDN_NET_DIALMODE_MASK) #endif /* __ISDN_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/selinux_netlink.h�����������������������������������������������������������������������������0000644�����������������00000002253�14763166027�0011305 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Netlink event notifications for SELinux. * * Author: James Morris <jmorris@redhat.com> * * Copyright (C) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, * as published by the Free Software Foundation. */ #ifndef _LINUX_SELINUX_NETLINK_H #define _LINUX_SELINUX_NETLINK_H #include <linux/types.h> /* Message types. */ #define SELNL_MSG_BASE 0x10 enum { SELNL_MSG_SETENFORCE = SELNL_MSG_BASE, SELNL_MSG_POLICYLOAD, SELNL_MSG_MAX }; /* Multicast groups - backwards compatiblility for userspace */ #define SELNL_GRP_NONE 0x00000000 #define SELNL_GRP_AVC 0x00000001 /* AVC notifications */ #define SELNL_GRP_ALL 0xffffffff enum selinux_nlgroups { SELNLGRP_NONE, #define SELNLGRP_NONE SELNLGRP_NONE SELNLGRP_AVC, #define SELNLGRP_AVC SELNLGRP_AVC __SELNLGRP_MAX }; #define SELNLGRP_MAX (__SELNLGRP_MAX - 1) /* Message structures */ struct selnl_msg_setenforce { __s32 val; }; struct selnl_msg_policyload { __u32 seqno; }; #endif /* _LINUX_SELINUX_NETLINK_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/cciss_ioctl.h���������������������������������������������������������������������������������0000644�����������������00000005311�14763166027�0010366 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef CCISS_IOCTLH #define CCISS_IOCTLH #include <linux/types.h> #include <linux/ioctl.h> #include <linux/cciss_defs.h> #define CCISS_IOC_MAGIC 'B' typedef struct _cciss_pci_info_struct { unsigned char bus; unsigned char dev_fn; unsigned short domain; __u32 board_id; } cciss_pci_info_struct; typedef struct _cciss_coalint_struct { __u32 delay; __u32 count; } cciss_coalint_struct; typedef char NodeName_type[16]; typedef __u32 Heartbeat_type; #define CISS_PARSCSIU2 0x0001 #define CISS_PARCSCIU3 0x0002 #define CISS_FIBRE1G 0x0100 #define CISS_FIBRE2G 0x0200 typedef __u32 BusTypes_type; typedef char FirmwareVer_type[4]; typedef __u32 DriverVer_type; #define MAX_KMALLOC_SIZE 128000 typedef struct _IOCTL_Command_struct { LUNAddr_struct LUN_info; RequestBlock_struct Request; ErrorInfo_struct error_info; WORD buf_size; /* size in bytes of the buf */ BYTE *buf; } IOCTL_Command_struct; typedef struct _BIG_IOCTL_Command_struct { LUNAddr_struct LUN_info; RequestBlock_struct Request; ErrorInfo_struct error_info; DWORD malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */ DWORD buf_size; /* size in bytes of the buf */ /* < malloc_size * MAXSGENTRIES */ BYTE *buf; } BIG_IOCTL_Command_struct; typedef struct _LogvolInfo_struct{ __u32 LunID; int num_opens; /* number of opens on the logical volume */ int num_parts; /* number of partitions configured on logvol */ } LogvolInfo_struct; #define CCISS_GETPCIINFO _IOR(CCISS_IOC_MAGIC, 1, cciss_pci_info_struct) #define CCISS_GETINTINFO _IOR(CCISS_IOC_MAGIC, 2, cciss_coalint_struct) #define CCISS_SETINTINFO _IOW(CCISS_IOC_MAGIC, 3, cciss_coalint_struct) #define CCISS_GETNODENAME _IOR(CCISS_IOC_MAGIC, 4, NodeName_type) #define CCISS_SETNODENAME _IOW(CCISS_IOC_MAGIC, 5, NodeName_type) #define CCISS_GETHEARTBEAT _IOR(CCISS_IOC_MAGIC, 6, Heartbeat_type) #define CCISS_GETBUSTYPES _IOR(CCISS_IOC_MAGIC, 7, BusTypes_type) #define CCISS_GETFIRMVER _IOR(CCISS_IOC_MAGIC, 8, FirmwareVer_type) #define CCISS_GETDRIVVER _IOR(CCISS_IOC_MAGIC, 9, DriverVer_type) #define CCISS_REVALIDVOLS _IO(CCISS_IOC_MAGIC, 10) #define CCISS_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 11, IOCTL_Command_struct) #define CCISS_DEREGDISK _IO(CCISS_IOC_MAGIC, 12) /* no longer used... use REGNEWD instead */ #define CCISS_REGNEWDISK _IOW(CCISS_IOC_MAGIC, 13, int) #define CCISS_REGNEWD _IO(CCISS_IOC_MAGIC, 14) #define CCISS_RESCANDISK _IO(CCISS_IOC_MAGIC, 16) #define CCISS_GETLUNINFO _IOR(CCISS_IOC_MAGIC, 17, LogvolInfo_struct) #define CCISS_BIG_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL_Command_struct) #endif /* CCISS_IOCTLH */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_addrlabel.h��������������������������������������������������������������������������������0000644�����������������00000001321�14763166027�0010455 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * if_addrlabel.h - netlink interface for address labels * * Copyright (C)2007 USAGI/WIDE Project, All Rights Reserved. * * Authors: * YOSHIFUJI Hideaki @ USAGI/WIDE <yoshfuji@linux-ipv6.org> */ #ifndef __LINUX_IF_ADDRLABEL_H #define __LINUX_IF_ADDRLABEL_H #include <linux/types.h> struct ifaddrlblmsg { __u8 ifal_family; /* Address family */ __u8 __ifal_reserved; /* Reserved */ __u8 ifal_prefixlen; /* Prefix length */ __u8 ifal_flags; /* Flags */ __u32 ifal_index; /* Link index */ __u32 ifal_seq; /* sequence number */ }; enum { IFAL_ADDRESS = 1, IFAL_LABEL = 2, __IFAL_MAX }; #define IFAL_MAX (__IFAL_MAX - 1) #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/time.h����������������������������������������������������������������������������������������0000644�����������������00000004707�14763166027�0007036 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_TIME_H #define _LINUX_TIME_H #include <linux/types.h> #ifndef _STRUCT_TIMESPEC #define _STRUCT_TIMESPEC struct timespec { __kernel_time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; #endif struct timeval { __kernel_time_t tv_sec; /* seconds */ __kernel_suseconds_t tv_usec; /* microseconds */ }; struct timezone { int tz_minuteswest; /* minutes west of Greenwich */ int tz_dsttime; /* type of dst correction */ }; /* * Names of the interval timers, and structure * defining a timer setting: */ #define ITIMER_REAL 0 #define ITIMER_VIRTUAL 1 #define ITIMER_PROF 2 struct itimerspec { struct timespec it_interval; /* timer period */ struct timespec it_value; /* timer expiration */ }; struct itimerval { struct timeval it_interval; /* timer interval */ struct timeval it_value; /* current value */ }; #ifndef __kernel_timespec struct __kernel_timespec { __kernel_time64_t tv_sec; /* seconds */ long long tv_nsec; /* nanoseconds */ }; #endif #ifndef __kernel_itimerspec struct __kernel_itimerspec { struct __kernel_timespec it_interval; /* timer period */ struct __kernel_timespec it_value; /* timer expiration */ }; #endif /* * legacy timeval structure, only embedded in structures that * traditionally used 'timeval' to pass time intervals (not absolute * times). Do not add new users. If user space fails to compile * here, this is probably because it is not y2038 safe and needs to * be changed to use another interface. */ struct __kernel_old_timeval { __kernel_long_t tv_sec; __kernel_long_t tv_usec; }; /* * The IDs of the various system clocks (for POSIX.1b interval timers): */ #define CLOCK_REALTIME 0 #define CLOCK_MONOTONIC 1 #define CLOCK_PROCESS_CPUTIME_ID 2 #define CLOCK_THREAD_CPUTIME_ID 3 #define CLOCK_MONOTONIC_RAW 4 #define CLOCK_REALTIME_COARSE 5 #define CLOCK_MONOTONIC_COARSE 6 #define CLOCK_BOOTTIME 7 #define CLOCK_REALTIME_ALARM 8 #define CLOCK_BOOTTIME_ALARM 9 /* * The driver implementing this got removed. The clock ID is kept as a * place holder. Do not reuse! */ #define CLOCK_SGI_CYCLE 10 #define CLOCK_TAI 11 #define MAX_CLOCKS 16 #define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC) #define CLOCKS_MONO CLOCK_MONOTONIC /* * The various flags for setting POSIX.1b interval timers: */ #define TIMER_ABSTIME 0x01 #endif /* _LINUX_TIME_H */ ���������������������������������������������������������linux/posix_acl.h�����������������������������������������������������������������������������������0000644�����������������00000002346�14763166027�0010056 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * Copyright (C) 2002 Andreas Gruenbacher <a.gruenbacher@computer.org> * Copyright (C) 2016 Red Hat, Inc. * * This file is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This file 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 * Lesser General Public License for more details. * */ #ifndef __UAPI_POSIX_ACL_H #define __UAPI_POSIX_ACL_H #define ACL_UNDEFINED_ID (-1) /* a_type field in acl_user_posix_entry_t */ #define ACL_TYPE_ACCESS (0x8000) #define ACL_TYPE_DEFAULT (0x4000) /* e_tag entry in struct posix_acl_entry */ #define ACL_USER_OBJ (0x01) #define ACL_USER (0x02) #define ACL_GROUP_OBJ (0x04) #define ACL_GROUP (0x08) #define ACL_MASK (0x10) #define ACL_OTHER (0x20) /* permissions in the e_perm field */ #define ACL_READ (0x04) #define ACL_WRITE (0x02) #define ACL_EXECUTE (0x01) #endif /* __UAPI_POSIX_ACL_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_pppol2tp.h���������������������������������������������������������������������������������0000644�����������������00000006334�14763166027�0010334 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /*************************************************************************** * Linux PPP over L2TP (PPPoL2TP) Socket Implementation (RFC 2661) * * This file supplies definitions required by the PPP over L2TP driver * (l2tp_ppp.c). All version information wrt this file is located in l2tp_ppp.c * * License: * 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. * */ #ifndef __LINUX_IF_PPPOL2TP_H #define __LINUX_IF_PPPOL2TP_H #include <linux/types.h> #include <linux/in.h> #include <linux/in6.h> #include <linux/l2tp.h> /* Structure used to connect() the socket to a particular tunnel UDP * socket over IPv4. */ struct pppol2tp_addr { __kernel_pid_t pid; /* pid that owns the fd. * 0 => current */ int fd; /* FD of UDP socket to use */ struct sockaddr_in addr; /* IP address and port to send to */ __u16 s_tunnel, s_session; /* For matching incoming packets */ __u16 d_tunnel, d_session; /* For sending outgoing packets */ }; /* Structure used to connect() the socket to a particular tunnel UDP * socket over IPv6. */ struct pppol2tpin6_addr { __kernel_pid_t pid; /* pid that owns the fd. * 0 => current */ int fd; /* FD of UDP socket to use */ __u16 s_tunnel, s_session; /* For matching incoming packets */ __u16 d_tunnel, d_session; /* For sending outgoing packets */ struct sockaddr_in6 addr; /* IP address and port to send to */ }; /* The L2TPv3 protocol changes tunnel and session ids from 16 to 32 * bits. So we need a different sockaddr structure. */ struct pppol2tpv3_addr { __kernel_pid_t pid; /* pid that owns the fd. * 0 => current */ int fd; /* FD of UDP or IP socket to use */ struct sockaddr_in addr; /* IP address and port to send to */ __u32 s_tunnel, s_session; /* For matching incoming packets */ __u32 d_tunnel, d_session; /* For sending outgoing packets */ }; struct pppol2tpv3in6_addr { __kernel_pid_t pid; /* pid that owns the fd. * 0 => current */ int fd; /* FD of UDP or IP socket to use */ __u32 s_tunnel, s_session; /* For matching incoming packets */ __u32 d_tunnel, d_session; /* For sending outgoing packets */ struct sockaddr_in6 addr; /* IP address and port to send to */ }; /* Socket options: * DEBUG - bitmask of debug message categories * SENDSEQ - 0 => don't send packets with sequence numbers * 1 => send packets with sequence numbers * RECVSEQ - 0 => receive packet sequence numbers are optional * 1 => drop receive packets without sequence numbers * LNSMODE - 0 => act as LAC. * 1 => act as LNS. * REORDERTO - reorder timeout (in millisecs). If 0, don't try to reorder. */ enum { PPPOL2TP_SO_DEBUG = 1, PPPOL2TP_SO_RECVSEQ = 2, PPPOL2TP_SO_SENDSEQ = 3, PPPOL2TP_SO_LNSMODE = 4, PPPOL2TP_SO_REORDERTO = 5, }; /* Debug message categories for the DEBUG socket option (deprecated) */ enum { PPPOL2TP_MSG_DEBUG = L2TP_MSG_DEBUG, PPPOL2TP_MSG_CONTROL = L2TP_MSG_CONTROL, PPPOL2TP_MSG_SEQ = L2TP_MSG_SEQ, PPPOL2TP_MSG_DATA = L2TP_MSG_DATA, }; #endif /* __LINUX_IF_PPPOL2TP_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/cec-funcs.h�����������������������������������������������������������������������������������0000644�����������������00000150571�14763166027�0007747 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * cec - HDMI Consumer Electronics Control message functions * * Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved. */ #ifndef _CEC_UAPI_FUNCS_H #define _CEC_UAPI_FUNCS_H #include <linux/cec.h> /* One Touch Play Feature */ static __inline__ void cec_msg_active_source(struct cec_msg *msg, __u16 phys_addr) { msg->len = 4; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_ACTIVE_SOURCE; msg->msg[2] = phys_addr >> 8; msg->msg[3] = phys_addr & 0xff; } static __inline__ void cec_ops_active_source(const struct cec_msg *msg, __u16 *phys_addr) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; } static __inline__ void cec_msg_image_view_on(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_IMAGE_VIEW_ON; } static __inline__ void cec_msg_text_view_on(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_TEXT_VIEW_ON; } /* Routing Control Feature */ static __inline__ void cec_msg_inactive_source(struct cec_msg *msg, __u16 phys_addr) { msg->len = 4; msg->msg[1] = CEC_MSG_INACTIVE_SOURCE; msg->msg[2] = phys_addr >> 8; msg->msg[3] = phys_addr & 0xff; } static __inline__ void cec_ops_inactive_source(const struct cec_msg *msg, __u16 *phys_addr) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; } static __inline__ void cec_msg_request_active_source(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_REQUEST_ACTIVE_SOURCE; msg->reply = reply ? CEC_MSG_ACTIVE_SOURCE : 0; } static __inline__ void cec_msg_routing_information(struct cec_msg *msg, __u16 phys_addr) { msg->len = 4; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_ROUTING_INFORMATION; msg->msg[2] = phys_addr >> 8; msg->msg[3] = phys_addr & 0xff; } static __inline__ void cec_ops_routing_information(const struct cec_msg *msg, __u16 *phys_addr) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; } static __inline__ void cec_msg_routing_change(struct cec_msg *msg, int reply, __u16 orig_phys_addr, __u16 new_phys_addr) { msg->len = 6; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_ROUTING_CHANGE; msg->msg[2] = orig_phys_addr >> 8; msg->msg[3] = orig_phys_addr & 0xff; msg->msg[4] = new_phys_addr >> 8; msg->msg[5] = new_phys_addr & 0xff; msg->reply = reply ? CEC_MSG_ROUTING_INFORMATION : 0; } static __inline__ void cec_ops_routing_change(const struct cec_msg *msg, __u16 *orig_phys_addr, __u16 *new_phys_addr) { *orig_phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *new_phys_addr = (msg->msg[4] << 8) | msg->msg[5]; } static __inline__ void cec_msg_set_stream_path(struct cec_msg *msg, __u16 phys_addr) { msg->len = 4; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_SET_STREAM_PATH; msg->msg[2] = phys_addr >> 8; msg->msg[3] = phys_addr & 0xff; } static __inline__ void cec_ops_set_stream_path(const struct cec_msg *msg, __u16 *phys_addr) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; } /* Standby Feature */ static __inline__ void cec_msg_standby(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_STANDBY; } /* One Touch Record Feature */ static __inline__ void cec_msg_record_off(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_RECORD_OFF; msg->reply = reply ? CEC_MSG_RECORD_STATUS : 0; } struct cec_op_arib_data { __u16 transport_id; __u16 service_id; __u16 orig_network_id; }; struct cec_op_atsc_data { __u16 transport_id; __u16 program_number; }; struct cec_op_dvb_data { __u16 transport_id; __u16 service_id; __u16 orig_network_id; }; struct cec_op_channel_data { __u8 channel_number_fmt; __u16 major; __u16 minor; }; struct cec_op_digital_service_id { __u8 service_id_method; __u8 dig_bcast_system; union { struct cec_op_arib_data arib; struct cec_op_atsc_data atsc; struct cec_op_dvb_data dvb; struct cec_op_channel_data channel; }; }; struct cec_op_record_src { __u8 type; union { struct cec_op_digital_service_id digital; struct { __u8 ana_bcast_type; __u16 ana_freq; __u8 bcast_system; } analog; struct { __u8 plug; } ext_plug; struct { __u16 phys_addr; } ext_phys_addr; }; }; static __inline__ void cec_set_digital_service_id(__u8 *msg, const struct cec_op_digital_service_id *digital) { *msg++ = (digital->service_id_method << 7) | digital->dig_bcast_system; if (digital->service_id_method == CEC_OP_SERVICE_ID_METHOD_BY_CHANNEL) { *msg++ = (digital->channel.channel_number_fmt << 2) | (digital->channel.major >> 8); *msg++ = digital->channel.major & 0xff; *msg++ = digital->channel.minor >> 8; *msg++ = digital->channel.minor & 0xff; *msg++ = 0; *msg++ = 0; return; } switch (digital->dig_bcast_system) { case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_GEN: case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_CABLE: case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_SAT: case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_T: *msg++ = digital->atsc.transport_id >> 8; *msg++ = digital->atsc.transport_id & 0xff; *msg++ = digital->atsc.program_number >> 8; *msg++ = digital->atsc.program_number & 0xff; *msg++ = 0; *msg++ = 0; break; default: *msg++ = digital->dvb.transport_id >> 8; *msg++ = digital->dvb.transport_id & 0xff; *msg++ = digital->dvb.service_id >> 8; *msg++ = digital->dvb.service_id & 0xff; *msg++ = digital->dvb.orig_network_id >> 8; *msg++ = digital->dvb.orig_network_id & 0xff; break; } } static __inline__ void cec_get_digital_service_id(const __u8 *msg, struct cec_op_digital_service_id *digital) { digital->service_id_method = msg[0] >> 7; digital->dig_bcast_system = msg[0] & 0x7f; if (digital->service_id_method == CEC_OP_SERVICE_ID_METHOD_BY_CHANNEL) { digital->channel.channel_number_fmt = msg[1] >> 2; digital->channel.major = ((msg[1] & 3) << 6) | msg[2]; digital->channel.minor = (msg[3] << 8) | msg[4]; return; } digital->dvb.transport_id = (msg[1] << 8) | msg[2]; digital->dvb.service_id = (msg[3] << 8) | msg[4]; digital->dvb.orig_network_id = (msg[5] << 8) | msg[6]; } static __inline__ void cec_msg_record_on_own(struct cec_msg *msg) { msg->len = 3; msg->msg[1] = CEC_MSG_RECORD_ON; msg->msg[2] = CEC_OP_RECORD_SRC_OWN; } static __inline__ void cec_msg_record_on_digital(struct cec_msg *msg, const struct cec_op_digital_service_id *digital) { msg->len = 10; msg->msg[1] = CEC_MSG_RECORD_ON; msg->msg[2] = CEC_OP_RECORD_SRC_DIGITAL; cec_set_digital_service_id(msg->msg + 3, digital); } static __inline__ void cec_msg_record_on_analog(struct cec_msg *msg, __u8 ana_bcast_type, __u16 ana_freq, __u8 bcast_system) { msg->len = 7; msg->msg[1] = CEC_MSG_RECORD_ON; msg->msg[2] = CEC_OP_RECORD_SRC_ANALOG; msg->msg[3] = ana_bcast_type; msg->msg[4] = ana_freq >> 8; msg->msg[5] = ana_freq & 0xff; msg->msg[6] = bcast_system; } static __inline__ void cec_msg_record_on_plug(struct cec_msg *msg, __u8 plug) { msg->len = 4; msg->msg[1] = CEC_MSG_RECORD_ON; msg->msg[2] = CEC_OP_RECORD_SRC_EXT_PLUG; msg->msg[3] = plug; } static __inline__ void cec_msg_record_on_phys_addr(struct cec_msg *msg, __u16 phys_addr) { msg->len = 5; msg->msg[1] = CEC_MSG_RECORD_ON; msg->msg[2] = CEC_OP_RECORD_SRC_EXT_PHYS_ADDR; msg->msg[3] = phys_addr >> 8; msg->msg[4] = phys_addr & 0xff; } static __inline__ void cec_msg_record_on(struct cec_msg *msg, int reply, const struct cec_op_record_src *rec_src) { switch (rec_src->type) { case CEC_OP_RECORD_SRC_OWN: cec_msg_record_on_own(msg); break; case CEC_OP_RECORD_SRC_DIGITAL: cec_msg_record_on_digital(msg, &rec_src->digital); break; case CEC_OP_RECORD_SRC_ANALOG: cec_msg_record_on_analog(msg, rec_src->analog.ana_bcast_type, rec_src->analog.ana_freq, rec_src->analog.bcast_system); break; case CEC_OP_RECORD_SRC_EXT_PLUG: cec_msg_record_on_plug(msg, rec_src->ext_plug.plug); break; case CEC_OP_RECORD_SRC_EXT_PHYS_ADDR: cec_msg_record_on_phys_addr(msg, rec_src->ext_phys_addr.phys_addr); break; } msg->reply = reply ? CEC_MSG_RECORD_STATUS : 0; } static __inline__ void cec_ops_record_on(const struct cec_msg *msg, struct cec_op_record_src *rec_src) { rec_src->type = msg->msg[2]; switch (rec_src->type) { case CEC_OP_RECORD_SRC_OWN: break; case CEC_OP_RECORD_SRC_DIGITAL: cec_get_digital_service_id(msg->msg + 3, &rec_src->digital); break; case CEC_OP_RECORD_SRC_ANALOG: rec_src->analog.ana_bcast_type = msg->msg[3]; rec_src->analog.ana_freq = (msg->msg[4] << 8) | msg->msg[5]; rec_src->analog.bcast_system = msg->msg[6]; break; case CEC_OP_RECORD_SRC_EXT_PLUG: rec_src->ext_plug.plug = msg->msg[3]; break; case CEC_OP_RECORD_SRC_EXT_PHYS_ADDR: rec_src->ext_phys_addr.phys_addr = (msg->msg[3] << 8) | msg->msg[4]; break; } } static __inline__ void cec_msg_record_status(struct cec_msg *msg, __u8 rec_status) { msg->len = 3; msg->msg[1] = CEC_MSG_RECORD_STATUS; msg->msg[2] = rec_status; } static __inline__ void cec_ops_record_status(const struct cec_msg *msg, __u8 *rec_status) { *rec_status = msg->msg[2]; } static __inline__ void cec_msg_record_tv_screen(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_RECORD_TV_SCREEN; msg->reply = reply ? CEC_MSG_RECORD_ON : 0; } /* Timer Programming Feature */ static __inline__ void cec_msg_timer_status(struct cec_msg *msg, __u8 timer_overlap_warning, __u8 media_info, __u8 prog_info, __u8 prog_error, __u8 duration_hr, __u8 duration_min) { msg->len = 3; msg->msg[1] = CEC_MSG_TIMER_STATUS; msg->msg[2] = (timer_overlap_warning << 7) | (media_info << 5) | (prog_info ? 0x10 : 0) | (prog_info ? prog_info : prog_error); if (prog_info == CEC_OP_PROG_INFO_NOT_ENOUGH_SPACE || prog_info == CEC_OP_PROG_INFO_MIGHT_NOT_BE_ENOUGH_SPACE || prog_error == CEC_OP_PROG_ERROR_DUPLICATE) { msg->len += 2; msg->msg[3] = ((duration_hr / 10) << 4) | (duration_hr % 10); msg->msg[4] = ((duration_min / 10) << 4) | (duration_min % 10); } } static __inline__ void cec_ops_timer_status(const struct cec_msg *msg, __u8 *timer_overlap_warning, __u8 *media_info, __u8 *prog_info, __u8 *prog_error, __u8 *duration_hr, __u8 *duration_min) { *timer_overlap_warning = msg->msg[2] >> 7; *media_info = (msg->msg[2] >> 5) & 3; if (msg->msg[2] & 0x10) { *prog_info = msg->msg[2] & 0xf; *prog_error = 0; } else { *prog_info = 0; *prog_error = msg->msg[2] & 0xf; } if (*prog_info == CEC_OP_PROG_INFO_NOT_ENOUGH_SPACE || *prog_info == CEC_OP_PROG_INFO_MIGHT_NOT_BE_ENOUGH_SPACE || *prog_error == CEC_OP_PROG_ERROR_DUPLICATE) { *duration_hr = (msg->msg[3] >> 4) * 10 + (msg->msg[3] & 0xf); *duration_min = (msg->msg[4] >> 4) * 10 + (msg->msg[4] & 0xf); } else { *duration_hr = *duration_min = 0; } } static __inline__ void cec_msg_timer_cleared_status(struct cec_msg *msg, __u8 timer_cleared_status) { msg->len = 3; msg->msg[1] = CEC_MSG_TIMER_CLEARED_STATUS; msg->msg[2] = timer_cleared_status; } static __inline__ void cec_ops_timer_cleared_status(const struct cec_msg *msg, __u8 *timer_cleared_status) { *timer_cleared_status = msg->msg[2]; } static __inline__ void cec_msg_clear_analogue_timer(struct cec_msg *msg, int reply, __u8 day, __u8 month, __u8 start_hr, __u8 start_min, __u8 duration_hr, __u8 duration_min, __u8 recording_seq, __u8 ana_bcast_type, __u16 ana_freq, __u8 bcast_system) { msg->len = 13; msg->msg[1] = CEC_MSG_CLEAR_ANALOGUE_TIMER; msg->msg[2] = day; msg->msg[3] = month; /* Hours and minutes are in BCD format */ msg->msg[4] = ((start_hr / 10) << 4) | (start_hr % 10); msg->msg[5] = ((start_min / 10) << 4) | (start_min % 10); msg->msg[6] = ((duration_hr / 10) << 4) | (duration_hr % 10); msg->msg[7] = ((duration_min / 10) << 4) | (duration_min % 10); msg->msg[8] = recording_seq; msg->msg[9] = ana_bcast_type; msg->msg[10] = ana_freq >> 8; msg->msg[11] = ana_freq & 0xff; msg->msg[12] = bcast_system; msg->reply = reply ? CEC_MSG_TIMER_CLEARED_STATUS : 0; } static __inline__ void cec_ops_clear_analogue_timer(const struct cec_msg *msg, __u8 *day, __u8 *month, __u8 *start_hr, __u8 *start_min, __u8 *duration_hr, __u8 *duration_min, __u8 *recording_seq, __u8 *ana_bcast_type, __u16 *ana_freq, __u8 *bcast_system) { *day = msg->msg[2]; *month = msg->msg[3]; /* Hours and minutes are in BCD format */ *start_hr = (msg->msg[4] >> 4) * 10 + (msg->msg[4] & 0xf); *start_min = (msg->msg[5] >> 4) * 10 + (msg->msg[5] & 0xf); *duration_hr = (msg->msg[6] >> 4) * 10 + (msg->msg[6] & 0xf); *duration_min = (msg->msg[7] >> 4) * 10 + (msg->msg[7] & 0xf); *recording_seq = msg->msg[8]; *ana_bcast_type = msg->msg[9]; *ana_freq = (msg->msg[10] << 8) | msg->msg[11]; *bcast_system = msg->msg[12]; } static __inline__ void cec_msg_clear_digital_timer(struct cec_msg *msg, int reply, __u8 day, __u8 month, __u8 start_hr, __u8 start_min, __u8 duration_hr, __u8 duration_min, __u8 recording_seq, const struct cec_op_digital_service_id *digital) { msg->len = 16; msg->reply = reply ? CEC_MSG_TIMER_CLEARED_STATUS : 0; msg->msg[1] = CEC_MSG_CLEAR_DIGITAL_TIMER; msg->msg[2] = day; msg->msg[3] = month; /* Hours and minutes are in BCD format */ msg->msg[4] = ((start_hr / 10) << 4) | (start_hr % 10); msg->msg[5] = ((start_min / 10) << 4) | (start_min % 10); msg->msg[6] = ((duration_hr / 10) << 4) | (duration_hr % 10); msg->msg[7] = ((duration_min / 10) << 4) | (duration_min % 10); msg->msg[8] = recording_seq; cec_set_digital_service_id(msg->msg + 9, digital); } static __inline__ void cec_ops_clear_digital_timer(const struct cec_msg *msg, __u8 *day, __u8 *month, __u8 *start_hr, __u8 *start_min, __u8 *duration_hr, __u8 *duration_min, __u8 *recording_seq, struct cec_op_digital_service_id *digital) { *day = msg->msg[2]; *month = msg->msg[3]; /* Hours and minutes are in BCD format */ *start_hr = (msg->msg[4] >> 4) * 10 + (msg->msg[4] & 0xf); *start_min = (msg->msg[5] >> 4) * 10 + (msg->msg[5] & 0xf); *duration_hr = (msg->msg[6] >> 4) * 10 + (msg->msg[6] & 0xf); *duration_min = (msg->msg[7] >> 4) * 10 + (msg->msg[7] & 0xf); *recording_seq = msg->msg[8]; cec_get_digital_service_id(msg->msg + 9, digital); } static __inline__ void cec_msg_clear_ext_timer(struct cec_msg *msg, int reply, __u8 day, __u8 month, __u8 start_hr, __u8 start_min, __u8 duration_hr, __u8 duration_min, __u8 recording_seq, __u8 ext_src_spec, __u8 plug, __u16 phys_addr) { msg->len = 13; msg->msg[1] = CEC_MSG_CLEAR_EXT_TIMER; msg->msg[2] = day; msg->msg[3] = month; /* Hours and minutes are in BCD format */ msg->msg[4] = ((start_hr / 10) << 4) | (start_hr % 10); msg->msg[5] = ((start_min / 10) << 4) | (start_min % 10); msg->msg[6] = ((duration_hr / 10) << 4) | (duration_hr % 10); msg->msg[7] = ((duration_min / 10) << 4) | (duration_min % 10); msg->msg[8] = recording_seq; msg->msg[9] = ext_src_spec; msg->msg[10] = plug; msg->msg[11] = phys_addr >> 8; msg->msg[12] = phys_addr & 0xff; msg->reply = reply ? CEC_MSG_TIMER_CLEARED_STATUS : 0; } static __inline__ void cec_ops_clear_ext_timer(const struct cec_msg *msg, __u8 *day, __u8 *month, __u8 *start_hr, __u8 *start_min, __u8 *duration_hr, __u8 *duration_min, __u8 *recording_seq, __u8 *ext_src_spec, __u8 *plug, __u16 *phys_addr) { *day = msg->msg[2]; *month = msg->msg[3]; /* Hours and minutes are in BCD format */ *start_hr = (msg->msg[4] >> 4) * 10 + (msg->msg[4] & 0xf); *start_min = (msg->msg[5] >> 4) * 10 + (msg->msg[5] & 0xf); *duration_hr = (msg->msg[6] >> 4) * 10 + (msg->msg[6] & 0xf); *duration_min = (msg->msg[7] >> 4) * 10 + (msg->msg[7] & 0xf); *recording_seq = msg->msg[8]; *ext_src_spec = msg->msg[9]; *plug = msg->msg[10]; *phys_addr = (msg->msg[11] << 8) | msg->msg[12]; } static __inline__ void cec_msg_set_analogue_timer(struct cec_msg *msg, int reply, __u8 day, __u8 month, __u8 start_hr, __u8 start_min, __u8 duration_hr, __u8 duration_min, __u8 recording_seq, __u8 ana_bcast_type, __u16 ana_freq, __u8 bcast_system) { msg->len = 13; msg->msg[1] = CEC_MSG_SET_ANALOGUE_TIMER; msg->msg[2] = day; msg->msg[3] = month; /* Hours and minutes are in BCD format */ msg->msg[4] = ((start_hr / 10) << 4) | (start_hr % 10); msg->msg[5] = ((start_min / 10) << 4) | (start_min % 10); msg->msg[6] = ((duration_hr / 10) << 4) | (duration_hr % 10); msg->msg[7] = ((duration_min / 10) << 4) | (duration_min % 10); msg->msg[8] = recording_seq; msg->msg[9] = ana_bcast_type; msg->msg[10] = ana_freq >> 8; msg->msg[11] = ana_freq & 0xff; msg->msg[12] = bcast_system; msg->reply = reply ? CEC_MSG_TIMER_STATUS : 0; } static __inline__ void cec_ops_set_analogue_timer(const struct cec_msg *msg, __u8 *day, __u8 *month, __u8 *start_hr, __u8 *start_min, __u8 *duration_hr, __u8 *duration_min, __u8 *recording_seq, __u8 *ana_bcast_type, __u16 *ana_freq, __u8 *bcast_system) { *day = msg->msg[2]; *month = msg->msg[3]; /* Hours and minutes are in BCD format */ *start_hr = (msg->msg[4] >> 4) * 10 + (msg->msg[4] & 0xf); *start_min = (msg->msg[5] >> 4) * 10 + (msg->msg[5] & 0xf); *duration_hr = (msg->msg[6] >> 4) * 10 + (msg->msg[6] & 0xf); *duration_min = (msg->msg[7] >> 4) * 10 + (msg->msg[7] & 0xf); *recording_seq = msg->msg[8]; *ana_bcast_type = msg->msg[9]; *ana_freq = (msg->msg[10] << 8) | msg->msg[11]; *bcast_system = msg->msg[12]; } static __inline__ void cec_msg_set_digital_timer(struct cec_msg *msg, int reply, __u8 day, __u8 month, __u8 start_hr, __u8 start_min, __u8 duration_hr, __u8 duration_min, __u8 recording_seq, const struct cec_op_digital_service_id *digital) { msg->len = 16; msg->reply = reply ? CEC_MSG_TIMER_STATUS : 0; msg->msg[1] = CEC_MSG_SET_DIGITAL_TIMER; msg->msg[2] = day; msg->msg[3] = month; /* Hours and minutes are in BCD format */ msg->msg[4] = ((start_hr / 10) << 4) | (start_hr % 10); msg->msg[5] = ((start_min / 10) << 4) | (start_min % 10); msg->msg[6] = ((duration_hr / 10) << 4) | (duration_hr % 10); msg->msg[7] = ((duration_min / 10) << 4) | (duration_min % 10); msg->msg[8] = recording_seq; cec_set_digital_service_id(msg->msg + 9, digital); } static __inline__ void cec_ops_set_digital_timer(const struct cec_msg *msg, __u8 *day, __u8 *month, __u8 *start_hr, __u8 *start_min, __u8 *duration_hr, __u8 *duration_min, __u8 *recording_seq, struct cec_op_digital_service_id *digital) { *day = msg->msg[2]; *month = msg->msg[3]; /* Hours and minutes are in BCD format */ *start_hr = (msg->msg[4] >> 4) * 10 + (msg->msg[4] & 0xf); *start_min = (msg->msg[5] >> 4) * 10 + (msg->msg[5] & 0xf); *duration_hr = (msg->msg[6] >> 4) * 10 + (msg->msg[6] & 0xf); *duration_min = (msg->msg[7] >> 4) * 10 + (msg->msg[7] & 0xf); *recording_seq = msg->msg[8]; cec_get_digital_service_id(msg->msg + 9, digital); } static __inline__ void cec_msg_set_ext_timer(struct cec_msg *msg, int reply, __u8 day, __u8 month, __u8 start_hr, __u8 start_min, __u8 duration_hr, __u8 duration_min, __u8 recording_seq, __u8 ext_src_spec, __u8 plug, __u16 phys_addr) { msg->len = 13; msg->msg[1] = CEC_MSG_SET_EXT_TIMER; msg->msg[2] = day; msg->msg[3] = month; /* Hours and minutes are in BCD format */ msg->msg[4] = ((start_hr / 10) << 4) | (start_hr % 10); msg->msg[5] = ((start_min / 10) << 4) | (start_min % 10); msg->msg[6] = ((duration_hr / 10) << 4) | (duration_hr % 10); msg->msg[7] = ((duration_min / 10) << 4) | (duration_min % 10); msg->msg[8] = recording_seq; msg->msg[9] = ext_src_spec; msg->msg[10] = plug; msg->msg[11] = phys_addr >> 8; msg->msg[12] = phys_addr & 0xff; msg->reply = reply ? CEC_MSG_TIMER_STATUS : 0; } static __inline__ void cec_ops_set_ext_timer(const struct cec_msg *msg, __u8 *day, __u8 *month, __u8 *start_hr, __u8 *start_min, __u8 *duration_hr, __u8 *duration_min, __u8 *recording_seq, __u8 *ext_src_spec, __u8 *plug, __u16 *phys_addr) { *day = msg->msg[2]; *month = msg->msg[3]; /* Hours and minutes are in BCD format */ *start_hr = (msg->msg[4] >> 4) * 10 + (msg->msg[4] & 0xf); *start_min = (msg->msg[5] >> 4) * 10 + (msg->msg[5] & 0xf); *duration_hr = (msg->msg[6] >> 4) * 10 + (msg->msg[6] & 0xf); *duration_min = (msg->msg[7] >> 4) * 10 + (msg->msg[7] & 0xf); *recording_seq = msg->msg[8]; *ext_src_spec = msg->msg[9]; *plug = msg->msg[10]; *phys_addr = (msg->msg[11] << 8) | msg->msg[12]; } static __inline__ void cec_msg_set_timer_program_title(struct cec_msg *msg, const char *prog_title) { unsigned int len = strlen(prog_title); if (len > 14) len = 14; msg->len = 2 + len; msg->msg[1] = CEC_MSG_SET_TIMER_PROGRAM_TITLE; memcpy(msg->msg + 2, prog_title, len); } static __inline__ void cec_ops_set_timer_program_title(const struct cec_msg *msg, char *prog_title) { unsigned int len = msg->len > 2 ? msg->len - 2 : 0; if (len > 14) len = 14; memcpy(prog_title, msg->msg + 2, len); prog_title[len] = '\0'; } /* System Information Feature */ static __inline__ void cec_msg_cec_version(struct cec_msg *msg, __u8 cec_version) { msg->len = 3; msg->msg[1] = CEC_MSG_CEC_VERSION; msg->msg[2] = cec_version; } static __inline__ void cec_ops_cec_version(const struct cec_msg *msg, __u8 *cec_version) { *cec_version = msg->msg[2]; } static __inline__ void cec_msg_get_cec_version(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_GET_CEC_VERSION; msg->reply = reply ? CEC_MSG_CEC_VERSION : 0; } static __inline__ void cec_msg_report_physical_addr(struct cec_msg *msg, __u16 phys_addr, __u8 prim_devtype) { msg->len = 5; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_REPORT_PHYSICAL_ADDR; msg->msg[2] = phys_addr >> 8; msg->msg[3] = phys_addr & 0xff; msg->msg[4] = prim_devtype; } static __inline__ void cec_ops_report_physical_addr(const struct cec_msg *msg, __u16 *phys_addr, __u8 *prim_devtype) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *prim_devtype = msg->msg[4]; } static __inline__ void cec_msg_give_physical_addr(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_GIVE_PHYSICAL_ADDR; msg->reply = reply ? CEC_MSG_REPORT_PHYSICAL_ADDR : 0; } static __inline__ void cec_msg_set_menu_language(struct cec_msg *msg, const char *language) { msg->len = 5; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_SET_MENU_LANGUAGE; memcpy(msg->msg + 2, language, 3); } static __inline__ void cec_ops_set_menu_language(const struct cec_msg *msg, char *language) { memcpy(language, msg->msg + 2, 3); language[3] = '\0'; } static __inline__ void cec_msg_get_menu_language(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_GET_MENU_LANGUAGE; msg->reply = reply ? CEC_MSG_SET_MENU_LANGUAGE : 0; } /* * Assumes a single RC Profile byte and a single Device Features byte, * i.e. no extended features are supported by this helper function. * * As of CEC 2.0 no extended features are defined, should those be added * in the future, then this function needs to be adapted or a new function * should be added. */ static __inline__ void cec_msg_report_features(struct cec_msg *msg, __u8 cec_version, __u8 all_device_types, __u8 rc_profile, __u8 dev_features) { msg->len = 6; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_REPORT_FEATURES; msg->msg[2] = cec_version; msg->msg[3] = all_device_types; msg->msg[4] = rc_profile; msg->msg[5] = dev_features; } static __inline__ void cec_ops_report_features(const struct cec_msg *msg, __u8 *cec_version, __u8 *all_device_types, const __u8 **rc_profile, const __u8 **dev_features) { const __u8 *p = &msg->msg[4]; *cec_version = msg->msg[2]; *all_device_types = msg->msg[3]; *rc_profile = p; *dev_features = NULL; while (p < &msg->msg[14] && (*p & CEC_OP_FEAT_EXT)) p++; if (!(*p & CEC_OP_FEAT_EXT)) { *dev_features = p + 1; while (p < &msg->msg[15] && (*p & CEC_OP_FEAT_EXT)) p++; } if (*p & CEC_OP_FEAT_EXT) *rc_profile = *dev_features = NULL; } static __inline__ void cec_msg_give_features(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_GIVE_FEATURES; msg->reply = reply ? CEC_MSG_REPORT_FEATURES : 0; } /* Deck Control Feature */ static __inline__ void cec_msg_deck_control(struct cec_msg *msg, __u8 deck_control_mode) { msg->len = 3; msg->msg[1] = CEC_MSG_DECK_CONTROL; msg->msg[2] = deck_control_mode; } static __inline__ void cec_ops_deck_control(const struct cec_msg *msg, __u8 *deck_control_mode) { *deck_control_mode = msg->msg[2]; } static __inline__ void cec_msg_deck_status(struct cec_msg *msg, __u8 deck_info) { msg->len = 3; msg->msg[1] = CEC_MSG_DECK_STATUS; msg->msg[2] = deck_info; } static __inline__ void cec_ops_deck_status(const struct cec_msg *msg, __u8 *deck_info) { *deck_info = msg->msg[2]; } static __inline__ void cec_msg_give_deck_status(struct cec_msg *msg, int reply, __u8 status_req) { msg->len = 3; msg->msg[1] = CEC_MSG_GIVE_DECK_STATUS; msg->msg[2] = status_req; msg->reply = (reply && status_req != CEC_OP_STATUS_REQ_OFF) ? CEC_MSG_DECK_STATUS : 0; } static __inline__ void cec_ops_give_deck_status(const struct cec_msg *msg, __u8 *status_req) { *status_req = msg->msg[2]; } static __inline__ void cec_msg_play(struct cec_msg *msg, __u8 play_mode) { msg->len = 3; msg->msg[1] = CEC_MSG_PLAY; msg->msg[2] = play_mode; } static __inline__ void cec_ops_play(const struct cec_msg *msg, __u8 *play_mode) { *play_mode = msg->msg[2]; } /* Tuner Control Feature */ struct cec_op_tuner_device_info { __u8 rec_flag; __u8 tuner_display_info; __u8 is_analog; union { struct cec_op_digital_service_id digital; struct { __u8 ana_bcast_type; __u16 ana_freq; __u8 bcast_system; } analog; }; }; static __inline__ void cec_msg_tuner_device_status_analog(struct cec_msg *msg, __u8 rec_flag, __u8 tuner_display_info, __u8 ana_bcast_type, __u16 ana_freq, __u8 bcast_system) { msg->len = 7; msg->msg[1] = CEC_MSG_TUNER_DEVICE_STATUS; msg->msg[2] = (rec_flag << 7) | tuner_display_info; msg->msg[3] = ana_bcast_type; msg->msg[4] = ana_freq >> 8; msg->msg[5] = ana_freq & 0xff; msg->msg[6] = bcast_system; } static __inline__ void cec_msg_tuner_device_status_digital(struct cec_msg *msg, __u8 rec_flag, __u8 tuner_display_info, const struct cec_op_digital_service_id *digital) { msg->len = 10; msg->msg[1] = CEC_MSG_TUNER_DEVICE_STATUS; msg->msg[2] = (rec_flag << 7) | tuner_display_info; cec_set_digital_service_id(msg->msg + 3, digital); } static __inline__ void cec_msg_tuner_device_status(struct cec_msg *msg, const struct cec_op_tuner_device_info *tuner_dev_info) { if (tuner_dev_info->is_analog) cec_msg_tuner_device_status_analog(msg, tuner_dev_info->rec_flag, tuner_dev_info->tuner_display_info, tuner_dev_info->analog.ana_bcast_type, tuner_dev_info->analog.ana_freq, tuner_dev_info->analog.bcast_system); else cec_msg_tuner_device_status_digital(msg, tuner_dev_info->rec_flag, tuner_dev_info->tuner_display_info, &tuner_dev_info->digital); } static __inline__ void cec_ops_tuner_device_status(const struct cec_msg *msg, struct cec_op_tuner_device_info *tuner_dev_info) { tuner_dev_info->is_analog = msg->len < 10; tuner_dev_info->rec_flag = msg->msg[2] >> 7; tuner_dev_info->tuner_display_info = msg->msg[2] & 0x7f; if (tuner_dev_info->is_analog) { tuner_dev_info->analog.ana_bcast_type = msg->msg[3]; tuner_dev_info->analog.ana_freq = (msg->msg[4] << 8) | msg->msg[5]; tuner_dev_info->analog.bcast_system = msg->msg[6]; return; } cec_get_digital_service_id(msg->msg + 3, &tuner_dev_info->digital); } static __inline__ void cec_msg_give_tuner_device_status(struct cec_msg *msg, int reply, __u8 status_req) { msg->len = 3; msg->msg[1] = CEC_MSG_GIVE_TUNER_DEVICE_STATUS; msg->msg[2] = status_req; msg->reply = (reply && status_req != CEC_OP_STATUS_REQ_OFF) ? CEC_MSG_TUNER_DEVICE_STATUS : 0; } static __inline__ void cec_ops_give_tuner_device_status(const struct cec_msg *msg, __u8 *status_req) { *status_req = msg->msg[2]; } static __inline__ void cec_msg_select_analogue_service(struct cec_msg *msg, __u8 ana_bcast_type, __u16 ana_freq, __u8 bcast_system) { msg->len = 6; msg->msg[1] = CEC_MSG_SELECT_ANALOGUE_SERVICE; msg->msg[2] = ana_bcast_type; msg->msg[3] = ana_freq >> 8; msg->msg[4] = ana_freq & 0xff; msg->msg[5] = bcast_system; } static __inline__ void cec_ops_select_analogue_service(const struct cec_msg *msg, __u8 *ana_bcast_type, __u16 *ana_freq, __u8 *bcast_system) { *ana_bcast_type = msg->msg[2]; *ana_freq = (msg->msg[3] << 8) | msg->msg[4]; *bcast_system = msg->msg[5]; } static __inline__ void cec_msg_select_digital_service(struct cec_msg *msg, const struct cec_op_digital_service_id *digital) { msg->len = 9; msg->msg[1] = CEC_MSG_SELECT_DIGITAL_SERVICE; cec_set_digital_service_id(msg->msg + 2, digital); } static __inline__ void cec_ops_select_digital_service(const struct cec_msg *msg, struct cec_op_digital_service_id *digital) { cec_get_digital_service_id(msg->msg + 2, digital); } static __inline__ void cec_msg_tuner_step_decrement(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_TUNER_STEP_DECREMENT; } static __inline__ void cec_msg_tuner_step_increment(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_TUNER_STEP_INCREMENT; } /* Vendor Specific Commands Feature */ static __inline__ void cec_msg_device_vendor_id(struct cec_msg *msg, __u32 vendor_id) { msg->len = 5; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_DEVICE_VENDOR_ID; msg->msg[2] = vendor_id >> 16; msg->msg[3] = (vendor_id >> 8) & 0xff; msg->msg[4] = vendor_id & 0xff; } static __inline__ void cec_ops_device_vendor_id(const struct cec_msg *msg, __u32 *vendor_id) { *vendor_id = (msg->msg[2] << 16) | (msg->msg[3] << 8) | msg->msg[4]; } static __inline__ void cec_msg_give_device_vendor_id(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_GIVE_DEVICE_VENDOR_ID; msg->reply = reply ? CEC_MSG_DEVICE_VENDOR_ID : 0; } static __inline__ void cec_msg_vendor_command(struct cec_msg *msg, __u8 size, const __u8 *vendor_cmd) { if (size > 14) size = 14; msg->len = 2 + size; msg->msg[1] = CEC_MSG_VENDOR_COMMAND; memcpy(msg->msg + 2, vendor_cmd, size); } static __inline__ void cec_ops_vendor_command(const struct cec_msg *msg, __u8 *size, const __u8 **vendor_cmd) { *size = msg->len - 2; if (*size > 14) *size = 14; *vendor_cmd = msg->msg + 2; } static __inline__ void cec_msg_vendor_command_with_id(struct cec_msg *msg, __u32 vendor_id, __u8 size, const __u8 *vendor_cmd) { if (size > 11) size = 11; msg->len = 5 + size; msg->msg[1] = CEC_MSG_VENDOR_COMMAND_WITH_ID; msg->msg[2] = vendor_id >> 16; msg->msg[3] = (vendor_id >> 8) & 0xff; msg->msg[4] = vendor_id & 0xff; memcpy(msg->msg + 5, vendor_cmd, size); } static __inline__ void cec_ops_vendor_command_with_id(const struct cec_msg *msg, __u32 *vendor_id, __u8 *size, const __u8 **vendor_cmd) { *size = msg->len - 5; if (*size > 11) *size = 11; *vendor_id = (msg->msg[2] << 16) | (msg->msg[3] << 8) | msg->msg[4]; *vendor_cmd = msg->msg + 5; } static __inline__ void cec_msg_vendor_remote_button_down(struct cec_msg *msg, __u8 size, const __u8 *rc_code) { if (size > 14) size = 14; msg->len = 2 + size; msg->msg[1] = CEC_MSG_VENDOR_REMOTE_BUTTON_DOWN; memcpy(msg->msg + 2, rc_code, size); } static __inline__ void cec_ops_vendor_remote_button_down(const struct cec_msg *msg, __u8 *size, const __u8 **rc_code) { *size = msg->len - 2; if (*size > 14) *size = 14; *rc_code = msg->msg + 2; } static __inline__ void cec_msg_vendor_remote_button_up(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_VENDOR_REMOTE_BUTTON_UP; } /* OSD Display Feature */ static __inline__ void cec_msg_set_osd_string(struct cec_msg *msg, __u8 disp_ctl, const char *osd) { unsigned int len = strlen(osd); if (len > 13) len = 13; msg->len = 3 + len; msg->msg[1] = CEC_MSG_SET_OSD_STRING; msg->msg[2] = disp_ctl; memcpy(msg->msg + 3, osd, len); } static __inline__ void cec_ops_set_osd_string(const struct cec_msg *msg, __u8 *disp_ctl, char *osd) { unsigned int len = msg->len > 3 ? msg->len - 3 : 0; *disp_ctl = msg->msg[2]; if (len > 13) len = 13; memcpy(osd, msg->msg + 3, len); osd[len] = '\0'; } /* Device OSD Transfer Feature */ static __inline__ void cec_msg_set_osd_name(struct cec_msg *msg, const char *name) { unsigned int len = strlen(name); if (len > 14) len = 14; msg->len = 2 + len; msg->msg[1] = CEC_MSG_SET_OSD_NAME; memcpy(msg->msg + 2, name, len); } static __inline__ void cec_ops_set_osd_name(const struct cec_msg *msg, char *name) { unsigned int len = msg->len > 2 ? msg->len - 2 : 0; if (len > 14) len = 14; memcpy(name, msg->msg + 2, len); name[len] = '\0'; } static __inline__ void cec_msg_give_osd_name(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_GIVE_OSD_NAME; msg->reply = reply ? CEC_MSG_SET_OSD_NAME : 0; } /* Device Menu Control Feature */ static __inline__ void cec_msg_menu_status(struct cec_msg *msg, __u8 menu_state) { msg->len = 3; msg->msg[1] = CEC_MSG_MENU_STATUS; msg->msg[2] = menu_state; } static __inline__ void cec_ops_menu_status(const struct cec_msg *msg, __u8 *menu_state) { *menu_state = msg->msg[2]; } static __inline__ void cec_msg_menu_request(struct cec_msg *msg, int reply, __u8 menu_req) { msg->len = 3; msg->msg[1] = CEC_MSG_MENU_REQUEST; msg->msg[2] = menu_req; msg->reply = reply ? CEC_MSG_MENU_STATUS : 0; } static __inline__ void cec_ops_menu_request(const struct cec_msg *msg, __u8 *menu_req) { *menu_req = msg->msg[2]; } struct cec_op_ui_command { __u8 ui_cmd; __u8 has_opt_arg; union { struct cec_op_channel_data channel_identifier; __u8 ui_broadcast_type; __u8 ui_sound_presentation_control; __u8 play_mode; __u8 ui_function_media; __u8 ui_function_select_av_input; __u8 ui_function_select_audio_input; }; }; static __inline__ void cec_msg_user_control_pressed(struct cec_msg *msg, const struct cec_op_ui_command *ui_cmd) { msg->len = 3; msg->msg[1] = CEC_MSG_USER_CONTROL_PRESSED; msg->msg[2] = ui_cmd->ui_cmd; if (!ui_cmd->has_opt_arg) return; switch (ui_cmd->ui_cmd) { case 0x56: case 0x57: case 0x60: case 0x68: case 0x69: case 0x6a: /* The optional operand is one byte for all these ui commands */ msg->len++; msg->msg[3] = ui_cmd->play_mode; break; case 0x67: msg->len += 4; msg->msg[3] = (ui_cmd->channel_identifier.channel_number_fmt << 2) | (ui_cmd->channel_identifier.major >> 8); msg->msg[4] = ui_cmd->channel_identifier.major & 0xff; msg->msg[5] = ui_cmd->channel_identifier.minor >> 8; msg->msg[6] = ui_cmd->channel_identifier.minor & 0xff; break; } } static __inline__ void cec_ops_user_control_pressed(const struct cec_msg *msg, struct cec_op_ui_command *ui_cmd) { ui_cmd->ui_cmd = msg->msg[2]; ui_cmd->has_opt_arg = 0; if (msg->len == 3) return; switch (ui_cmd->ui_cmd) { case 0x56: case 0x57: case 0x60: case 0x68: case 0x69: case 0x6a: /* The optional operand is one byte for all these ui commands */ ui_cmd->play_mode = msg->msg[3]; ui_cmd->has_opt_arg = 1; break; case 0x67: if (msg->len < 7) break; ui_cmd->has_opt_arg = 1; ui_cmd->channel_identifier.channel_number_fmt = msg->msg[3] >> 2; ui_cmd->channel_identifier.major = ((msg->msg[3] & 3) << 6) | msg->msg[4]; ui_cmd->channel_identifier.minor = (msg->msg[5] << 8) | msg->msg[6]; break; } } static __inline__ void cec_msg_user_control_released(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_USER_CONTROL_RELEASED; } /* Remote Control Passthrough Feature */ /* Power Status Feature */ static __inline__ void cec_msg_report_power_status(struct cec_msg *msg, __u8 pwr_state) { msg->len = 3; msg->msg[1] = CEC_MSG_REPORT_POWER_STATUS; msg->msg[2] = pwr_state; } static __inline__ void cec_ops_report_power_status(const struct cec_msg *msg, __u8 *pwr_state) { *pwr_state = msg->msg[2]; } static __inline__ void cec_msg_give_device_power_status(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_GIVE_DEVICE_POWER_STATUS; msg->reply = reply ? CEC_MSG_REPORT_POWER_STATUS : 0; } /* General Protocol Messages */ static __inline__ void cec_msg_feature_abort(struct cec_msg *msg, __u8 abort_msg, __u8 reason) { msg->len = 4; msg->msg[1] = CEC_MSG_FEATURE_ABORT; msg->msg[2] = abort_msg; msg->msg[3] = reason; } static __inline__ void cec_ops_feature_abort(const struct cec_msg *msg, __u8 *abort_msg, __u8 *reason) { *abort_msg = msg->msg[2]; *reason = msg->msg[3]; } /* This changes the current message into a feature abort message */ static __inline__ void cec_msg_reply_feature_abort(struct cec_msg *msg, __u8 reason) { cec_msg_set_reply_to(msg, msg); msg->len = 4; msg->msg[2] = msg->msg[1]; msg->msg[3] = reason; msg->msg[1] = CEC_MSG_FEATURE_ABORT; } static __inline__ void cec_msg_abort(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_ABORT; } /* System Audio Control Feature */ static __inline__ void cec_msg_report_audio_status(struct cec_msg *msg, __u8 aud_mute_status, __u8 aud_vol_status) { msg->len = 3; msg->msg[1] = CEC_MSG_REPORT_AUDIO_STATUS; msg->msg[2] = (aud_mute_status << 7) | (aud_vol_status & 0x7f); } static __inline__ void cec_ops_report_audio_status(const struct cec_msg *msg, __u8 *aud_mute_status, __u8 *aud_vol_status) { *aud_mute_status = msg->msg[2] >> 7; *aud_vol_status = msg->msg[2] & 0x7f; } static __inline__ void cec_msg_give_audio_status(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_GIVE_AUDIO_STATUS; msg->reply = reply ? CEC_MSG_REPORT_AUDIO_STATUS : 0; } static __inline__ void cec_msg_set_system_audio_mode(struct cec_msg *msg, __u8 sys_aud_status) { msg->len = 3; msg->msg[1] = CEC_MSG_SET_SYSTEM_AUDIO_MODE; msg->msg[2] = sys_aud_status; } static __inline__ void cec_ops_set_system_audio_mode(const struct cec_msg *msg, __u8 *sys_aud_status) { *sys_aud_status = msg->msg[2]; } static __inline__ void cec_msg_system_audio_mode_request(struct cec_msg *msg, int reply, __u16 phys_addr) { msg->len = phys_addr == 0xffff ? 2 : 4; msg->msg[1] = CEC_MSG_SYSTEM_AUDIO_MODE_REQUEST; msg->msg[2] = phys_addr >> 8; msg->msg[3] = phys_addr & 0xff; msg->reply = reply ? CEC_MSG_SET_SYSTEM_AUDIO_MODE : 0; } static __inline__ void cec_ops_system_audio_mode_request(const struct cec_msg *msg, __u16 *phys_addr) { if (msg->len < 4) *phys_addr = 0xffff; else *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; } static __inline__ void cec_msg_system_audio_mode_status(struct cec_msg *msg, __u8 sys_aud_status) { msg->len = 3; msg->msg[1] = CEC_MSG_SYSTEM_AUDIO_MODE_STATUS; msg->msg[2] = sys_aud_status; } static __inline__ void cec_ops_system_audio_mode_status(const struct cec_msg *msg, __u8 *sys_aud_status) { *sys_aud_status = msg->msg[2]; } static __inline__ void cec_msg_give_system_audio_mode_status(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_GIVE_SYSTEM_AUDIO_MODE_STATUS; msg->reply = reply ? CEC_MSG_SYSTEM_AUDIO_MODE_STATUS : 0; } static __inline__ void cec_msg_report_short_audio_descriptor(struct cec_msg *msg, __u8 num_descriptors, const __u32 *descriptors) { unsigned int i; if (num_descriptors > 4) num_descriptors = 4; msg->len = 2 + num_descriptors * 3; msg->msg[1] = CEC_MSG_REPORT_SHORT_AUDIO_DESCRIPTOR; for (i = 0; i < num_descriptors; i++) { msg->msg[2 + i * 3] = (descriptors[i] >> 16) & 0xff; msg->msg[3 + i * 3] = (descriptors[i] >> 8) & 0xff; msg->msg[4 + i * 3] = descriptors[i] & 0xff; } } static __inline__ void cec_ops_report_short_audio_descriptor(const struct cec_msg *msg, __u8 *num_descriptors, __u32 *descriptors) { unsigned int i; *num_descriptors = (msg->len - 2) / 3; if (*num_descriptors > 4) *num_descriptors = 4; for (i = 0; i < *num_descriptors; i++) descriptors[i] = (msg->msg[2 + i * 3] << 16) | (msg->msg[3 + i * 3] << 8) | msg->msg[4 + i * 3]; } static __inline__ void cec_msg_request_short_audio_descriptor(struct cec_msg *msg, int reply, __u8 num_descriptors, const __u8 *audio_format_id, const __u8 *audio_format_code) { unsigned int i; if (num_descriptors > 4) num_descriptors = 4; msg->len = 2 + num_descriptors; msg->msg[1] = CEC_MSG_REQUEST_SHORT_AUDIO_DESCRIPTOR; msg->reply = reply ? CEC_MSG_REPORT_SHORT_AUDIO_DESCRIPTOR : 0; for (i = 0; i < num_descriptors; i++) msg->msg[2 + i] = (audio_format_id[i] << 6) | (audio_format_code[i] & 0x3f); } static __inline__ void cec_ops_request_short_audio_descriptor(const struct cec_msg *msg, __u8 *num_descriptors, __u8 *audio_format_id, __u8 *audio_format_code) { unsigned int i; *num_descriptors = msg->len - 2; if (*num_descriptors > 4) *num_descriptors = 4; for (i = 0; i < *num_descriptors; i++) { audio_format_id[i] = msg->msg[2 + i] >> 6; audio_format_code[i] = msg->msg[2 + i] & 0x3f; } } /* Audio Rate Control Feature */ static __inline__ void cec_msg_set_audio_rate(struct cec_msg *msg, __u8 audio_rate) { msg->len = 3; msg->msg[1] = CEC_MSG_SET_AUDIO_RATE; msg->msg[2] = audio_rate; } static __inline__ void cec_ops_set_audio_rate(const struct cec_msg *msg, __u8 *audio_rate) { *audio_rate = msg->msg[2]; } /* Audio Return Channel Control Feature */ static __inline__ void cec_msg_report_arc_initiated(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_REPORT_ARC_INITIATED; } static __inline__ void cec_msg_initiate_arc(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_INITIATE_ARC; msg->reply = reply ? CEC_MSG_REPORT_ARC_INITIATED : 0; } static __inline__ void cec_msg_request_arc_initiation(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_REQUEST_ARC_INITIATION; msg->reply = reply ? CEC_MSG_INITIATE_ARC : 0; } static __inline__ void cec_msg_report_arc_terminated(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_REPORT_ARC_TERMINATED; } static __inline__ void cec_msg_terminate_arc(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_TERMINATE_ARC; msg->reply = reply ? CEC_MSG_REPORT_ARC_TERMINATED : 0; } static __inline__ void cec_msg_request_arc_termination(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_REQUEST_ARC_TERMINATION; msg->reply = reply ? CEC_MSG_TERMINATE_ARC : 0; } /* Dynamic Audio Lipsync Feature */ /* Only for CEC 2.0 and up */ static __inline__ void cec_msg_report_current_latency(struct cec_msg *msg, __u16 phys_addr, __u8 video_latency, __u8 low_latency_mode, __u8 audio_out_compensated, __u8 audio_out_delay) { msg->len = 6; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_REPORT_CURRENT_LATENCY; msg->msg[2] = phys_addr >> 8; msg->msg[3] = phys_addr & 0xff; msg->msg[4] = video_latency; msg->msg[5] = (low_latency_mode << 2) | audio_out_compensated; if (audio_out_compensated == 3) msg->msg[msg->len++] = audio_out_delay; } static __inline__ void cec_ops_report_current_latency(const struct cec_msg *msg, __u16 *phys_addr, __u8 *video_latency, __u8 *low_latency_mode, __u8 *audio_out_compensated, __u8 *audio_out_delay) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *video_latency = msg->msg[4]; *low_latency_mode = (msg->msg[5] >> 2) & 1; *audio_out_compensated = msg->msg[5] & 3; if (*audio_out_compensated == 3 && msg->len >= 7) *audio_out_delay = msg->msg[6]; else *audio_out_delay = 0; } static __inline__ void cec_msg_request_current_latency(struct cec_msg *msg, int reply, __u16 phys_addr) { msg->len = 4; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_REQUEST_CURRENT_LATENCY; msg->msg[2] = phys_addr >> 8; msg->msg[3] = phys_addr & 0xff; msg->reply = reply ? CEC_MSG_REPORT_CURRENT_LATENCY : 0; } static __inline__ void cec_ops_request_current_latency(const struct cec_msg *msg, __u16 *phys_addr) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; } /* Capability Discovery and Control Feature */ static __inline__ void cec_msg_cdc_hec_inquire_state(struct cec_msg *msg, __u16 phys_addr1, __u16 phys_addr2) { msg->len = 9; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_CDC_MESSAGE; /* msg[2] and msg[3] (phys_addr) are filled in by the CEC framework */ msg->msg[4] = CEC_MSG_CDC_HEC_INQUIRE_STATE; msg->msg[5] = phys_addr1 >> 8; msg->msg[6] = phys_addr1 & 0xff; msg->msg[7] = phys_addr2 >> 8; msg->msg[8] = phys_addr2 & 0xff; } static __inline__ void cec_ops_cdc_hec_inquire_state(const struct cec_msg *msg, __u16 *phys_addr, __u16 *phys_addr1, __u16 *phys_addr2) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *phys_addr1 = (msg->msg[5] << 8) | msg->msg[6]; *phys_addr2 = (msg->msg[7] << 8) | msg->msg[8]; } static __inline__ void cec_msg_cdc_hec_report_state(struct cec_msg *msg, __u16 target_phys_addr, __u8 hec_func_state, __u8 host_func_state, __u8 enc_func_state, __u8 cdc_errcode, __u8 has_field, __u16 hec_field) { msg->len = has_field ? 10 : 8; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_CDC_MESSAGE; /* msg[2] and msg[3] (phys_addr) are filled in by the CEC framework */ msg->msg[4] = CEC_MSG_CDC_HEC_REPORT_STATE; msg->msg[5] = target_phys_addr >> 8; msg->msg[6] = target_phys_addr & 0xff; msg->msg[7] = (hec_func_state << 6) | (host_func_state << 4) | (enc_func_state << 2) | cdc_errcode; if (has_field) { msg->msg[8] = hec_field >> 8; msg->msg[9] = hec_field & 0xff; } } static __inline__ void cec_ops_cdc_hec_report_state(const struct cec_msg *msg, __u16 *phys_addr, __u16 *target_phys_addr, __u8 *hec_func_state, __u8 *host_func_state, __u8 *enc_func_state, __u8 *cdc_errcode, __u8 *has_field, __u16 *hec_field) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *target_phys_addr = (msg->msg[5] << 8) | msg->msg[6]; *hec_func_state = msg->msg[7] >> 6; *host_func_state = (msg->msg[7] >> 4) & 3; *enc_func_state = (msg->msg[7] >> 4) & 3; *cdc_errcode = msg->msg[7] & 3; *has_field = msg->len >= 10; *hec_field = *has_field ? ((msg->msg[8] << 8) | msg->msg[9]) : 0; } static __inline__ void cec_msg_cdc_hec_set_state(struct cec_msg *msg, __u16 phys_addr1, __u16 phys_addr2, __u8 hec_set_state, __u16 phys_addr3, __u16 phys_addr4, __u16 phys_addr5) { msg->len = 10; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_CDC_MESSAGE; /* msg[2] and msg[3] (phys_addr) are filled in by the CEC framework */ msg->msg[4] = CEC_MSG_CDC_HEC_INQUIRE_STATE; msg->msg[5] = phys_addr1 >> 8; msg->msg[6] = phys_addr1 & 0xff; msg->msg[7] = phys_addr2 >> 8; msg->msg[8] = phys_addr2 & 0xff; msg->msg[9] = hec_set_state; if (phys_addr3 != CEC_PHYS_ADDR_INVALID) { msg->msg[msg->len++] = phys_addr3 >> 8; msg->msg[msg->len++] = phys_addr3 & 0xff; if (phys_addr4 != CEC_PHYS_ADDR_INVALID) { msg->msg[msg->len++] = phys_addr4 >> 8; msg->msg[msg->len++] = phys_addr4 & 0xff; if (phys_addr5 != CEC_PHYS_ADDR_INVALID) { msg->msg[msg->len++] = phys_addr5 >> 8; msg->msg[msg->len++] = phys_addr5 & 0xff; } } } } static __inline__ void cec_ops_cdc_hec_set_state(const struct cec_msg *msg, __u16 *phys_addr, __u16 *phys_addr1, __u16 *phys_addr2, __u8 *hec_set_state, __u16 *phys_addr3, __u16 *phys_addr4, __u16 *phys_addr5) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *phys_addr1 = (msg->msg[5] << 8) | msg->msg[6]; *phys_addr2 = (msg->msg[7] << 8) | msg->msg[8]; *hec_set_state = msg->msg[9]; *phys_addr3 = *phys_addr4 = *phys_addr5 = CEC_PHYS_ADDR_INVALID; if (msg->len >= 12) *phys_addr3 = (msg->msg[10] << 8) | msg->msg[11]; if (msg->len >= 14) *phys_addr4 = (msg->msg[12] << 8) | msg->msg[13]; if (msg->len >= 16) *phys_addr5 = (msg->msg[14] << 8) | msg->msg[15]; } static __inline__ void cec_msg_cdc_hec_set_state_adjacent(struct cec_msg *msg, __u16 phys_addr1, __u8 hec_set_state) { msg->len = 8; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_CDC_MESSAGE; /* msg[2] and msg[3] (phys_addr) are filled in by the CEC framework */ msg->msg[4] = CEC_MSG_CDC_HEC_SET_STATE_ADJACENT; msg->msg[5] = phys_addr1 >> 8; msg->msg[6] = phys_addr1 & 0xff; msg->msg[7] = hec_set_state; } static __inline__ void cec_ops_cdc_hec_set_state_adjacent(const struct cec_msg *msg, __u16 *phys_addr, __u16 *phys_addr1, __u8 *hec_set_state) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *phys_addr1 = (msg->msg[5] << 8) | msg->msg[6]; *hec_set_state = msg->msg[7]; } static __inline__ void cec_msg_cdc_hec_request_deactivation(struct cec_msg *msg, __u16 phys_addr1, __u16 phys_addr2, __u16 phys_addr3) { msg->len = 11; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_CDC_MESSAGE; /* msg[2] and msg[3] (phys_addr) are filled in by the CEC framework */ msg->msg[4] = CEC_MSG_CDC_HEC_REQUEST_DEACTIVATION; msg->msg[5] = phys_addr1 >> 8; msg->msg[6] = phys_addr1 & 0xff; msg->msg[7] = phys_addr2 >> 8; msg->msg[8] = phys_addr2 & 0xff; msg->msg[9] = phys_addr3 >> 8; msg->msg[10] = phys_addr3 & 0xff; } static __inline__ void cec_ops_cdc_hec_request_deactivation(const struct cec_msg *msg, __u16 *phys_addr, __u16 *phys_addr1, __u16 *phys_addr2, __u16 *phys_addr3) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *phys_addr1 = (msg->msg[5] << 8) | msg->msg[6]; *phys_addr2 = (msg->msg[7] << 8) | msg->msg[8]; *phys_addr3 = (msg->msg[9] << 8) | msg->msg[10]; } static __inline__ void cec_msg_cdc_hec_notify_alive(struct cec_msg *msg) { msg->len = 5; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_CDC_MESSAGE; /* msg[2] and msg[3] (phys_addr) are filled in by the CEC framework */ msg->msg[4] = CEC_MSG_CDC_HEC_NOTIFY_ALIVE; } static __inline__ void cec_ops_cdc_hec_notify_alive(const struct cec_msg *msg, __u16 *phys_addr) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; } static __inline__ void cec_msg_cdc_hec_discover(struct cec_msg *msg) { msg->len = 5; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_CDC_MESSAGE; /* msg[2] and msg[3] (phys_addr) are filled in by the CEC framework */ msg->msg[4] = CEC_MSG_CDC_HEC_DISCOVER; } static __inline__ void cec_ops_cdc_hec_discover(const struct cec_msg *msg, __u16 *phys_addr) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; } static __inline__ void cec_msg_cdc_hpd_set_state(struct cec_msg *msg, __u8 input_port, __u8 hpd_state) { msg->len = 6; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_CDC_MESSAGE; /* msg[2] and msg[3] (phys_addr) are filled in by the CEC framework */ msg->msg[4] = CEC_MSG_CDC_HPD_SET_STATE; msg->msg[5] = (input_port << 4) | hpd_state; } static __inline__ void cec_ops_cdc_hpd_set_state(const struct cec_msg *msg, __u16 *phys_addr, __u8 *input_port, __u8 *hpd_state) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *input_port = msg->msg[5] >> 4; *hpd_state = msg->msg[5] & 0xf; } static __inline__ void cec_msg_cdc_hpd_report_state(struct cec_msg *msg, __u8 hpd_state, __u8 hpd_error) { msg->len = 6; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_CDC_MESSAGE; /* msg[2] and msg[3] (phys_addr) are filled in by the CEC framework */ msg->msg[4] = CEC_MSG_CDC_HPD_REPORT_STATE; msg->msg[5] = (hpd_state << 4) | hpd_error; } static __inline__ void cec_ops_cdc_hpd_report_state(const struct cec_msg *msg, __u16 *phys_addr, __u8 *hpd_state, __u8 *hpd_error) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *hpd_state = msg->msg[5] >> 4; *hpd_error = msg->msg[5] & 0xf; } #endif ���������������������������������������������������������������������������������������������������������������������������������������linux/nvme_ioctl.h����������������������������������������������������������������������������������0000644�����������������00000003160�14763166027�0010227 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Definitions for the NVM Express ioctl interface * Copyright (c) 2011-2014, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope 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. */ #ifndef _LINUX_NVME_IOCTL_H #define _LINUX_NVME_IOCTL_H #include <linux/types.h> struct nvme_user_io { __u8 opcode; __u8 flags; __u16 control; __u16 nblocks; __u16 rsvd; __u64 metadata; __u64 addr; __u64 slba; __u32 dsmgmt; __u32 reftag; __u16 apptag; __u16 appmask; }; struct nvme_passthru_cmd { __u8 opcode; __u8 flags; __u16 rsvd1; __u32 nsid; __u32 cdw2; __u32 cdw3; __u64 metadata; __u64 addr; __u32 metadata_len; __u32 data_len; __u32 cdw10; __u32 cdw11; __u32 cdw12; __u32 cdw13; __u32 cdw14; __u32 cdw15; __u32 timeout_ms; __u32 result; }; #define nvme_admin_cmd nvme_passthru_cmd #define NVME_IOCTL_ID _IO('N', 0x40) #define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd) #define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io) #define NVME_IOCTL_IO_CMD _IOWR('N', 0x43, struct nvme_passthru_cmd) #define NVME_IOCTL_RESET _IO('N', 0x44) #define NVME_IOCTL_SUBSYS_RESET _IO('N', 0x45) #define NVME_IOCTL_RESCAN _IO('N', 0x46) #endif /* _LINUX_NVME_IOCTL_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/cn_proc.h�������������������������������������������������������������������������������������0000644�����������������00000006600�14763166027�0007515 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.1 WITH Linux-syscall-note */ /* * cn_proc.h - process events connector * * Copyright (C) Matt Helsley, IBM Corp. 2005 * Based on cn_fork.h by Nguyen Anh Quynh and Guillaume Thouvenin * Copyright (C) 2005 Nguyen Anh Quynh <aquynh@gmail.com> * Copyright (C) 2005 Guillaume Thouvenin <guillaume.thouvenin@bull.net> * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2.1 of the GNU Lesser General Public License * as published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ #ifndef CN_PROC_H #define CN_PROC_H #include <linux/types.h> /* * Userspace sends this enum to register with the kernel that it is listening * for events on the connector. */ enum proc_cn_mcast_op { PROC_CN_MCAST_LISTEN = 1, PROC_CN_MCAST_IGNORE = 2 }; /* * From the user's point of view, the process * ID is the thread group ID and thread ID is the internal * kernel "pid". So, fields are assigned as follow: * * In user space - In kernel space * * parent process ID = parent->tgid * parent thread ID = parent->pid * child process ID = child->tgid * child thread ID = child->pid */ struct proc_event { enum what { /* Use successive bits so the enums can be used to record * sets of events as well */ PROC_EVENT_NONE = 0x00000000, PROC_EVENT_FORK = 0x00000001, PROC_EVENT_EXEC = 0x00000002, PROC_EVENT_UID = 0x00000004, PROC_EVENT_GID = 0x00000040, PROC_EVENT_SID = 0x00000080, PROC_EVENT_PTRACE = 0x00000100, PROC_EVENT_COMM = 0x00000200, /* "next" should be 0x00000400 */ /* "last" is the last process event: exit, * while "next to last" is coredumping event */ PROC_EVENT_COREDUMP = 0x40000000, PROC_EVENT_EXIT = 0x80000000 } what; __u32 cpu; __u64 __attribute__((aligned(8))) timestamp_ns; /* Number of nano seconds since system boot */ union { /* must be last field of proc_event struct */ struct { __u32 err; } ack; struct fork_proc_event { __kernel_pid_t parent_pid; __kernel_pid_t parent_tgid; __kernel_pid_t child_pid; __kernel_pid_t child_tgid; } fork; struct exec_proc_event { __kernel_pid_t process_pid; __kernel_pid_t process_tgid; } exec; struct id_proc_event { __kernel_pid_t process_pid; __kernel_pid_t process_tgid; union { __u32 ruid; /* task uid */ __u32 rgid; /* task gid */ } r; union { __u32 euid; __u32 egid; } e; } id; struct sid_proc_event { __kernel_pid_t process_pid; __kernel_pid_t process_tgid; } sid; struct ptrace_proc_event { __kernel_pid_t process_pid; __kernel_pid_t process_tgid; __kernel_pid_t tracer_pid; __kernel_pid_t tracer_tgid; } ptrace; struct comm_proc_event { __kernel_pid_t process_pid; __kernel_pid_t process_tgid; char comm[16]; } comm; struct coredump_proc_event { __kernel_pid_t process_pid; __kernel_pid_t process_tgid; __kernel_pid_t parent_pid; __kernel_pid_t parent_tgid; } coredump; struct exit_proc_event { __kernel_pid_t process_pid; __kernel_pid_t process_tgid; __u32 exit_code, exit_signal; __kernel_pid_t parent_pid; __kernel_pid_t parent_tgid; } exit; } event_data; }; #endif /* CN_PROC_H */ ��������������������������������������������������������������������������������������������������������������������������������linux/virtio_ids.h����������������������������������������������������������������������������������0000644�����������������00000004575�14763166027�0010256 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _LINUX_VIRTIO_IDS_H #define _LINUX_VIRTIO_IDS_H /* * Virtio IDs * * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #define VIRTIO_ID_NET 1 /* virtio net */ #define VIRTIO_ID_BLOCK 2 /* virtio block */ #define VIRTIO_ID_CONSOLE 3 /* virtio console */ #define VIRTIO_ID_RNG 4 /* virtio rng */ #define VIRTIO_ID_BALLOON 5 /* virtio balloon */ #define VIRTIO_ID_RPMSG 7 /* virtio remote processor messaging */ #define VIRTIO_ID_SCSI 8 /* virtio scsi */ #define VIRTIO_ID_9P 9 /* 9p virtio console */ #define VIRTIO_ID_RPROC_SERIAL 11 /* virtio remoteproc serial link */ #define VIRTIO_ID_CAIF 12 /* Virtio caif */ #define VIRTIO_ID_GPU 16 /* virtio GPU */ #define VIRTIO_ID_INPUT 18 /* virtio input */ #define VIRTIO_ID_VSOCK 19 /* virtio vsock transport */ #define VIRTIO_ID_CRYPTO 20 /* virtio crypto */ #endif /* _LINUX_VIRTIO_IDS_H */ �����������������������������������������������������������������������������������������������������������������������������������linux/atmmpc.h��������������������������������������������������������������������������������������0000644�����������������00000010202�14763166027�0007344 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ATMMPC_H_ #define _ATMMPC_H_ #include <linux/atmapi.h> #include <linux/atmioc.h> #include <linux/atm.h> #include <linux/types.h> #define ATMMPC_CTRL _IO('a', ATMIOC_MPOA) #define ATMMPC_DATA _IO('a', ATMIOC_MPOA+1) #define MPC_SOCKET_INGRESS 1 #define MPC_SOCKET_EGRESS 2 struct atmmpc_ioc { int dev_num; __be32 ipaddr; /* the IP address of the shortcut */ int type; /* ingress or egress */ }; typedef struct in_ctrl_info { __u8 Last_NHRP_CIE_code; __u8 Last_Q2931_cause_value; __u8 eg_MPC_ATM_addr[ATM_ESA_LEN]; __be32 tag; __be32 in_dst_ip; /* IP address this ingress MPC sends packets to */ __u16 holding_time; __u32 request_id; } in_ctrl_info; typedef struct eg_ctrl_info { __u8 DLL_header[256]; __u8 DH_length; __be32 cache_id; __be32 tag; __be32 mps_ip; __be32 eg_dst_ip; /* IP address to which ingress MPC sends packets */ __u8 in_MPC_data_ATM_addr[ATM_ESA_LEN]; __u16 holding_time; } eg_ctrl_info; struct mpc_parameters { __u16 mpc_p1; /* Shortcut-Setup Frame Count */ __u16 mpc_p2; /* Shortcut-Setup Frame Time */ __u8 mpc_p3[8]; /* Flow-detection Protocols */ __u16 mpc_p4; /* MPC Initial Retry Time */ __u16 mpc_p5; /* MPC Retry Time Maximum */ __u16 mpc_p6; /* Hold Down Time */ } ; struct k_message { __u16 type; __be32 ip_mask; __u8 MPS_ctrl[ATM_ESA_LEN]; union { in_ctrl_info in_info; eg_ctrl_info eg_info; struct mpc_parameters params; } content; struct atm_qos qos; } __ATM_API_ALIGN; struct llc_snap_hdr { /* RFC 1483 LLC/SNAP encapsulation for routed IP PDUs */ __u8 dsap; /* Destination Service Access Point (0xAA) */ __u8 ssap; /* Source Service Access Point (0xAA) */ __u8 ui; /* Unnumbered Information (0x03) */ __u8 org[3]; /* Organizational identification (0x000000) */ __u8 type[2]; /* Ether type (for IP) (0x0800) */ }; /* TLVs this MPC recognizes */ #define TLV_MPOA_DEVICE_TYPE 0x00a03e2a /* MPOA device types in MPOA Device Type TLV */ #define NON_MPOA 0 #define MPS 1 #define MPC 2 #define MPS_AND_MPC 3 /* MPC parameter defaults */ #define MPC_P1 10 /* Shortcut-Setup Frame Count */ #define MPC_P2 1 /* Shortcut-Setup Frame Time */ #define MPC_P3 0 /* Flow-detection Protocols */ #define MPC_P4 5 /* MPC Initial Retry Time */ #define MPC_P5 40 /* MPC Retry Time Maximum */ #define MPC_P6 160 /* Hold Down Time */ #define HOLDING_TIME_DEFAULT 1200 /* same as MPS-p7 */ /* MPC constants */ #define MPC_C1 2 /* Retry Time Multiplier */ #define MPC_C2 60 /* Initial Keep-Alive Lifetime */ /* Message types - to MPOA daemon */ #define SND_MPOA_RES_RQST 201 #define SET_MPS_CTRL_ADDR 202 #define SND_MPOA_RES_RTRY 203 /* Different type in a retry due to req id */ #define STOP_KEEP_ALIVE_SM 204 #define EGRESS_ENTRY_REMOVED 205 #define SND_EGRESS_PURGE 206 #define DIE 207 /* tell the daemon to exit() */ #define DATA_PLANE_PURGE 208 /* Data plane purge because of egress cache hit miss or dead MPS */ #define OPEN_INGRESS_SVC 209 /* Message types - from MPOA daemon */ #define MPOA_TRIGGER_RCVD 101 #define MPOA_RES_REPLY_RCVD 102 #define INGRESS_PURGE_RCVD 103 #define EGRESS_PURGE_RCVD 104 #define MPS_DEATH 105 #define CACHE_IMPOS_RCVD 106 #define SET_MPC_CTRL_ADDR 107 /* Our MPC's control ATM address */ #define SET_MPS_MAC_ADDR 108 #define CLEAN_UP_AND_EXIT 109 #define SET_MPC_PARAMS 110 /* MPC configuration parameters */ /* Message types - bidirectional */ #define RELOAD 301 /* kill -HUP the daemon for reload */ #endif /* _ATMMPC_H_ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/fb.h������������������������������������������������������������������������������������������0000644�����������������00000040076�14763166027�0006466 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_FB_H #define _LINUX_FB_H #include <linux/types.h> #include <linux/i2c.h> /* Definitions of frame buffers */ #define FB_MAX 32 /* sufficient for now */ /* ioctls 0x46 is 'F' */ #define FBIOGET_VSCREENINFO 0x4600 #define FBIOPUT_VSCREENINFO 0x4601 #define FBIOGET_FSCREENINFO 0x4602 #define FBIOGETCMAP 0x4604 #define FBIOPUTCMAP 0x4605 #define FBIOPAN_DISPLAY 0x4606 #define FBIO_CURSOR _IOWR('F', 0x08, struct fb_cursor) /* 0x4607-0x460B are defined below */ /* #define FBIOGET_MONITORSPEC 0x460C */ /* #define FBIOPUT_MONITORSPEC 0x460D */ /* #define FBIOSWITCH_MONIBIT 0x460E */ #define FBIOGET_CON2FBMAP 0x460F #define FBIOPUT_CON2FBMAP 0x4610 #define FBIOBLANK 0x4611 /* arg: 0 or vesa level + 1 */ #define FBIOGET_VBLANK _IOR('F', 0x12, struct fb_vblank) #define FBIO_ALLOC 0x4613 #define FBIO_FREE 0x4614 #define FBIOGET_GLYPH 0x4615 #define FBIOGET_HWCINFO 0x4616 #define FBIOPUT_MODEINFO 0x4617 #define FBIOGET_DISPINFO 0x4618 #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ #define FB_TYPE_PLANES 1 /* Non interleaved planes */ #define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */ #define FB_TYPE_TEXT 3 /* Text/attributes */ #define FB_TYPE_VGA_PLANES 4 /* EGA/VGA planes */ #define FB_TYPE_FOURCC 5 /* Type identified by a V4L2 FOURCC */ #define FB_AUX_TEXT_MDA 0 /* Monochrome text */ #define FB_AUX_TEXT_CGA 1 /* CGA/EGA/VGA Color text */ #define FB_AUX_TEXT_S3_MMIO 2 /* S3 MMIO fasttext */ #define FB_AUX_TEXT_MGA_STEP16 3 /* MGA Millenium I: text, attr, 14 reserved bytes */ #define FB_AUX_TEXT_MGA_STEP8 4 /* other MGAs: text, attr, 6 reserved bytes */ #define FB_AUX_TEXT_SVGA_GROUP 8 /* 8-15: SVGA tileblit compatible modes */ #define FB_AUX_TEXT_SVGA_MASK 7 /* lower three bits says step */ #define FB_AUX_TEXT_SVGA_STEP2 8 /* SVGA text mode: text, attr */ #define FB_AUX_TEXT_SVGA_STEP4 9 /* SVGA text mode: text, attr, 2 reserved bytes */ #define FB_AUX_TEXT_SVGA_STEP8 10 /* SVGA text mode: text, attr, 6 reserved bytes */ #define FB_AUX_TEXT_SVGA_STEP16 11 /* SVGA text mode: text, attr, 14 reserved bytes */ #define FB_AUX_TEXT_SVGA_LAST 15 /* reserved up to 15 */ #define FB_AUX_VGA_PLANES_VGA4 0 /* 16 color planes (EGA/VGA) */ #define FB_AUX_VGA_PLANES_CFB4 1 /* CFB4 in planes (VGA) */ #define FB_AUX_VGA_PLANES_CFB8 2 /* CFB8 in planes (VGA) */ #define FB_VISUAL_MONO01 0 /* Monochr. 1=Black 0=White */ #define FB_VISUAL_MONO10 1 /* Monochr. 1=White 0=Black */ #define FB_VISUAL_TRUECOLOR 2 /* True color */ #define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */ #define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */ #define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */ #define FB_VISUAL_FOURCC 6 /* Visual identified by a V4L2 FOURCC */ #define FB_ACCEL_NONE 0 /* no hardware accelerator */ #define FB_ACCEL_ATARIBLITT 1 /* Atari Blitter */ #define FB_ACCEL_AMIGABLITT 2 /* Amiga Blitter */ #define FB_ACCEL_S3_TRIO64 3 /* Cybervision64 (S3 Trio64) */ #define FB_ACCEL_NCR_77C32BLT 4 /* RetinaZ3 (NCR 77C32BLT) */ #define FB_ACCEL_S3_VIRGE 5 /* Cybervision64/3D (S3 ViRGE) */ #define FB_ACCEL_ATI_MACH64GX 6 /* ATI Mach 64GX family */ #define FB_ACCEL_DEC_TGA 7 /* DEC 21030 TGA */ #define FB_ACCEL_ATI_MACH64CT 8 /* ATI Mach 64CT family */ #define FB_ACCEL_ATI_MACH64VT 9 /* ATI Mach 64CT family VT class */ #define FB_ACCEL_ATI_MACH64GT 10 /* ATI Mach 64CT family GT class */ #define FB_ACCEL_SUN_CREATOR 11 /* Sun Creator/Creator3D */ #define FB_ACCEL_SUN_CGSIX 12 /* Sun cg6 */ #define FB_ACCEL_SUN_LEO 13 /* Sun leo/zx */ #define FB_ACCEL_IMS_TWINTURBO 14 /* IMS Twin Turbo */ #define FB_ACCEL_3DLABS_PERMEDIA2 15 /* 3Dlabs Permedia 2 */ #define FB_ACCEL_MATROX_MGA2064W 16 /* Matrox MGA2064W (Millenium) */ #define FB_ACCEL_MATROX_MGA1064SG 17 /* Matrox MGA1064SG (Mystique) */ #define FB_ACCEL_MATROX_MGA2164W 18 /* Matrox MGA2164W (Millenium II) */ #define FB_ACCEL_MATROX_MGA2164W_AGP 19 /* Matrox MGA2164W (Millenium II) */ #define FB_ACCEL_MATROX_MGAG100 20 /* Matrox G100 (Productiva G100) */ #define FB_ACCEL_MATROX_MGAG200 21 /* Matrox G200 (Myst, Mill, ...) */ #define FB_ACCEL_SUN_CG14 22 /* Sun cgfourteen */ #define FB_ACCEL_SUN_BWTWO 23 /* Sun bwtwo */ #define FB_ACCEL_SUN_CGTHREE 24 /* Sun cgthree */ #define FB_ACCEL_SUN_TCX 25 /* Sun tcx */ #define FB_ACCEL_MATROX_MGAG400 26 /* Matrox G400 */ #define FB_ACCEL_NV3 27 /* nVidia RIVA 128 */ #define FB_ACCEL_NV4 28 /* nVidia RIVA TNT */ #define FB_ACCEL_NV5 29 /* nVidia RIVA TNT2 */ #define FB_ACCEL_CT_6555x 30 /* C&T 6555x */ #define FB_ACCEL_3DFX_BANSHEE 31 /* 3Dfx Banshee */ #define FB_ACCEL_ATI_RAGE128 32 /* ATI Rage128 family */ #define FB_ACCEL_IGS_CYBER2000 33 /* CyberPro 2000 */ #define FB_ACCEL_IGS_CYBER2010 34 /* CyberPro 2010 */ #define FB_ACCEL_IGS_CYBER5000 35 /* CyberPro 5000 */ #define FB_ACCEL_SIS_GLAMOUR 36 /* SiS 300/630/540 */ #define FB_ACCEL_3DLABS_PERMEDIA3 37 /* 3Dlabs Permedia 3 */ #define FB_ACCEL_ATI_RADEON 38 /* ATI Radeon family */ #define FB_ACCEL_I810 39 /* Intel 810/815 */ #define FB_ACCEL_SIS_GLAMOUR_2 40 /* SiS 315, 650, 740 */ #define FB_ACCEL_SIS_XABRE 41 /* SiS 330 ("Xabre") */ #define FB_ACCEL_I830 42 /* Intel 830M/845G/85x/865G */ #define FB_ACCEL_NV_10 43 /* nVidia Arch 10 */ #define FB_ACCEL_NV_20 44 /* nVidia Arch 20 */ #define FB_ACCEL_NV_30 45 /* nVidia Arch 30 */ #define FB_ACCEL_NV_40 46 /* nVidia Arch 40 */ #define FB_ACCEL_XGI_VOLARI_V 47 /* XGI Volari V3XT, V5, V8 */ #define FB_ACCEL_XGI_VOLARI_Z 48 /* XGI Volari Z7 */ #define FB_ACCEL_OMAP1610 49 /* TI OMAP16xx */ #define FB_ACCEL_TRIDENT_TGUI 50 /* Trident TGUI */ #define FB_ACCEL_TRIDENT_3DIMAGE 51 /* Trident 3DImage */ #define FB_ACCEL_TRIDENT_BLADE3D 52 /* Trident Blade3D */ #define FB_ACCEL_TRIDENT_BLADEXP 53 /* Trident BladeXP */ #define FB_ACCEL_CIRRUS_ALPINE 53 /* Cirrus Logic 543x/544x/5480 */ #define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */ #define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */ #define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */ #define FB_ACCEL_NEOMAGIC_NM2097 93 /* NeoMagic NM2097 */ #define FB_ACCEL_NEOMAGIC_NM2160 94 /* NeoMagic NM2160 */ #define FB_ACCEL_NEOMAGIC_NM2200 95 /* NeoMagic NM2200 */ #define FB_ACCEL_NEOMAGIC_NM2230 96 /* NeoMagic NM2230 */ #define FB_ACCEL_NEOMAGIC_NM2360 97 /* NeoMagic NM2360 */ #define FB_ACCEL_NEOMAGIC_NM2380 98 /* NeoMagic NM2380 */ #define FB_ACCEL_PXA3XX 99 /* PXA3xx */ #define FB_ACCEL_SAVAGE4 0x80 /* S3 Savage4 */ #define FB_ACCEL_SAVAGE3D 0x81 /* S3 Savage3D */ #define FB_ACCEL_SAVAGE3D_MV 0x82 /* S3 Savage3D-MV */ #define FB_ACCEL_SAVAGE2000 0x83 /* S3 Savage2000 */ #define FB_ACCEL_SAVAGE_MX_MV 0x84 /* S3 Savage/MX-MV */ #define FB_ACCEL_SAVAGE_MX 0x85 /* S3 Savage/MX */ #define FB_ACCEL_SAVAGE_IX_MV 0x86 /* S3 Savage/IX-MV */ #define FB_ACCEL_SAVAGE_IX 0x87 /* S3 Savage/IX */ #define FB_ACCEL_PROSAVAGE_PM 0x88 /* S3 ProSavage PM133 */ #define FB_ACCEL_PROSAVAGE_KM 0x89 /* S3 ProSavage KM133 */ #define FB_ACCEL_S3TWISTER_P 0x8a /* S3 Twister */ #define FB_ACCEL_S3TWISTER_K 0x8b /* S3 TwisterK */ #define FB_ACCEL_SUPERSAVAGE 0x8c /* S3 Supersavage */ #define FB_ACCEL_PROSAVAGE_DDR 0x8d /* S3 ProSavage DDR */ #define FB_ACCEL_PROSAVAGE_DDRK 0x8e /* S3 ProSavage DDR-K */ #define FB_ACCEL_PUV3_UNIGFX 0xa0 /* PKUnity-v3 Unigfx */ #define FB_CAP_FOURCC 1 /* Device supports FOURCC-based formats */ struct fb_fix_screeninfo { char id[16]; /* identification string eg "TT Builtin" */ unsigned long smem_start; /* Start of frame buffer mem */ /* (physical address) */ __u32 smem_len; /* Length of frame buffer mem */ __u32 type; /* see FB_TYPE_* */ __u32 type_aux; /* Interleave for interleaved Planes */ __u32 visual; /* see FB_VISUAL_* */ __u16 xpanstep; /* zero if no hardware panning */ __u16 ypanstep; /* zero if no hardware panning */ __u16 ywrapstep; /* zero if no hardware ywrap */ __u32 line_length; /* length of a line in bytes */ unsigned long mmio_start; /* Start of Memory Mapped I/O */ /* (physical address) */ __u32 mmio_len; /* Length of Memory Mapped I/O */ __u32 accel; /* Indicate to driver which */ /* specific chip/card we have */ __u16 capabilities; /* see FB_CAP_* */ __u16 reserved[2]; /* Reserved for future compatibility */ }; /* Interpretation of offset for color fields: All offsets are from the right, * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you * can use the offset as right argument to <<). A pixel afterwards is a bit * stream and is written to video memory as that unmodified. * * For pseudocolor: offset and length should be the same for all color * components. Offset specifies the position of the least significant bit * of the pallette index in a pixel value. Length indicates the number * of available palette entries (i.e. # of entries = 1 << length). */ struct fb_bitfield { __u32 offset; /* beginning of bitfield */ __u32 length; /* length of bitfield */ __u32 msb_right; /* != 0 : Most significant bit is */ /* right */ }; #define FB_NONSTD_HAM 1 /* Hold-And-Modify (HAM) */ #define FB_NONSTD_REV_PIX_IN_B 2 /* order of pixels in each byte is reversed */ #define FB_ACTIVATE_NOW 0 /* set values immediately (or vbl)*/ #define FB_ACTIVATE_NXTOPEN 1 /* activate on next open */ #define FB_ACTIVATE_TEST 2 /* don't set, round up impossible */ #define FB_ACTIVATE_MASK 15 /* values */ #define FB_ACTIVATE_VBL 16 /* activate values on next vbl */ #define FB_CHANGE_CMAP_VBL 32 /* change colormap on vbl */ #define FB_ACTIVATE_ALL 64 /* change all VCs on this fb */ #define FB_ACTIVATE_FORCE 128 /* force apply even when no change*/ #define FB_ACTIVATE_INV_MODE 256 /* invalidate videomode */ #define FB_ACCELF_TEXT 1 /* (OBSOLETE) see fb_info.flags and vc_mode */ #define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */ #define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */ #define FB_SYNC_EXT 4 /* external sync */ #define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */ #define FB_SYNC_BROADCAST 16 /* broadcast video timings */ /* vtotal = 144d/288n/576i => PAL */ /* vtotal = 121d/242n/484i => NTSC */ #define FB_SYNC_ON_GREEN 32 /* sync on green */ #define FB_VMODE_NONINTERLACED 0 /* non interlaced */ #define FB_VMODE_INTERLACED 1 /* interlaced */ #define FB_VMODE_DOUBLE 2 /* double scan */ #define FB_VMODE_ODD_FLD_FIRST 4 /* interlaced: top line first */ #define FB_VMODE_MASK 255 #define FB_VMODE_YWRAP 256 /* ywrap instead of panning */ #define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */ #define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */ /* * Display rotation support */ #define FB_ROTATE_UR 0 #define FB_ROTATE_CW 1 #define FB_ROTATE_UD 2 #define FB_ROTATE_CCW 3 #define PICOS2KHZ(a) (1000000000UL/(a)) #define KHZ2PICOS(a) (1000000000UL/(a)) struct fb_var_screeninfo { __u32 xres; /* visible resolution */ __u32 yres; __u32 xres_virtual; /* virtual resolution */ __u32 yres_virtual; __u32 xoffset; /* offset from virtual to visible */ __u32 yoffset; /* resolution */ __u32 bits_per_pixel; /* guess what */ __u32 grayscale; /* 0 = color, 1 = grayscale, */ /* >1 = FOURCC */ struct fb_bitfield red; /* bitfield in fb mem if true color, */ struct fb_bitfield green; /* else only length is significant */ struct fb_bitfield blue; struct fb_bitfield transp; /* transparency */ __u32 nonstd; /* != 0 Non standard pixel format */ __u32 activate; /* see FB_ACTIVATE_* */ __u32 height; /* height of picture in mm */ __u32 width; /* width of picture in mm */ __u32 accel_flags; /* (OBSOLETE) see fb_info.flags */ /* Timing: All values in pixclocks, except pixclock (of course) */ __u32 pixclock; /* pixel clock in ps (pico seconds) */ __u32 left_margin; /* time from sync to picture */ __u32 right_margin; /* time from picture to sync */ __u32 upper_margin; /* time from sync to picture */ __u32 lower_margin; __u32 hsync_len; /* length of horizontal sync */ __u32 vsync_len; /* length of vertical sync */ __u32 sync; /* see FB_SYNC_* */ __u32 vmode; /* see FB_VMODE_* */ __u32 rotate; /* angle we rotate counter clockwise */ __u32 colorspace; /* colorspace for FOURCC-based modes */ __u32 reserved[4]; /* Reserved for future compatibility */ }; struct fb_cmap { __u32 start; /* First entry */ __u32 len; /* Number of entries */ __u16 *red; /* Red values */ __u16 *green; __u16 *blue; __u16 *transp; /* transparency, can be NULL */ }; struct fb_con2fbmap { __u32 console; __u32 framebuffer; }; /* VESA Blanking Levels */ #define VESA_NO_BLANKING 0 #define VESA_VSYNC_SUSPEND 1 #define VESA_HSYNC_SUSPEND 2 #define VESA_POWERDOWN 3 enum { /* screen: unblanked, hsync: on, vsync: on */ FB_BLANK_UNBLANK = VESA_NO_BLANKING, /* screen: blanked, hsync: on, vsync: on */ FB_BLANK_NORMAL = VESA_NO_BLANKING + 1, /* screen: blanked, hsync: on, vsync: off */ FB_BLANK_VSYNC_SUSPEND = VESA_VSYNC_SUSPEND + 1, /* screen: blanked, hsync: off, vsync: on */ FB_BLANK_HSYNC_SUSPEND = VESA_HSYNC_SUSPEND + 1, /* screen: blanked, hsync: off, vsync: off */ FB_BLANK_POWERDOWN = VESA_POWERDOWN + 1 }; #define FB_VBLANK_VBLANKING 0x001 /* currently in a vertical blank */ #define FB_VBLANK_HBLANKING 0x002 /* currently in a horizontal blank */ #define FB_VBLANK_HAVE_VBLANK 0x004 /* vertical blanks can be detected */ #define FB_VBLANK_HAVE_HBLANK 0x008 /* horizontal blanks can be detected */ #define FB_VBLANK_HAVE_COUNT 0x010 /* global retrace counter is available */ #define FB_VBLANK_HAVE_VCOUNT 0x020 /* the vcount field is valid */ #define FB_VBLANK_HAVE_HCOUNT 0x040 /* the hcount field is valid */ #define FB_VBLANK_VSYNCING 0x080 /* currently in a vsync */ #define FB_VBLANK_HAVE_VSYNC 0x100 /* verical syncs can be detected */ struct fb_vblank { __u32 flags; /* FB_VBLANK flags */ __u32 count; /* counter of retraces since boot */ __u32 vcount; /* current scanline position */ __u32 hcount; /* current scandot position */ __u32 reserved[4]; /* reserved for future compatibility */ }; /* Internal HW accel */ #define ROP_COPY 0 #define ROP_XOR 1 struct fb_copyarea { __u32 dx; __u32 dy; __u32 width; __u32 height; __u32 sx; __u32 sy; }; struct fb_fillrect { __u32 dx; /* screen-relative */ __u32 dy; __u32 width; __u32 height; __u32 color; __u32 rop; }; struct fb_image { __u32 dx; /* Where to place image */ __u32 dy; __u32 width; /* Size of image */ __u32 height; __u32 fg_color; /* Only used when a mono bitmap */ __u32 bg_color; __u8 depth; /* Depth of the image */ const char *data; /* Pointer to image data */ struct fb_cmap cmap; /* color map info */ }; /* * hardware cursor control */ #define FB_CUR_SETIMAGE 0x01 #define FB_CUR_SETPOS 0x02 #define FB_CUR_SETHOT 0x04 #define FB_CUR_SETCMAP 0x08 #define FB_CUR_SETSHAPE 0x10 #define FB_CUR_SETSIZE 0x20 #define FB_CUR_SETALL 0xFF struct fbcurpos { __u16 x, y; }; struct fb_cursor { __u16 set; /* what to set */ __u16 enable; /* cursor on/off */ __u16 rop; /* bitop operation */ const char *mask; /* cursor mask bits */ struct fbcurpos hot; /* cursor hot spot */ struct fb_image image; /* Cursor image */ }; #ifdef CONFIG_FB_BACKLIGHT /* Settings for the generic backlight code */ #define FB_BACKLIGHT_LEVELS 128 #define FB_BACKLIGHT_MAX 0xFF #endif #endif /* _LINUX_FB_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/quota.h���������������������������������������������������������������������������������������0000644�����������������00000014223�14763166027�0007223 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 1982, 1986 Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * Robert Elz at The University of Melbourne. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _LINUX_QUOTA_ #define _LINUX_QUOTA_ #include <linux/types.h> #define __DQUOT_VERSION__ "dquot_6.6.0" #define MAXQUOTAS 3 #define USRQUOTA 0 /* element used for user quotas */ #define GRPQUOTA 1 /* element used for group quotas */ #define PRJQUOTA 2 /* element used for project quotas */ /* * Definitions for the default names of the quotas files. */ #define INITQFNAMES { \ "user", /* USRQUOTA */ \ "group", /* GRPQUOTA */ \ "project", /* PRJQUOTA */ \ "undefined", \ }; /* * Command definitions for the 'quotactl' system call. * The commands are broken into a main command defined below * and a subcommand that is used to convey the type of * quota that is being manipulated (see above). */ #define SUBCMDMASK 0x00ff #define SUBCMDSHIFT 8 #define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK)) #define Q_SYNC 0x800001 /* sync disk copy of a filesystems quotas */ #define Q_QUOTAON 0x800002 /* turn quotas on */ #define Q_QUOTAOFF 0x800003 /* turn quotas off */ #define Q_GETFMT 0x800004 /* get quota format used on given filesystem */ #define Q_GETINFO 0x800005 /* get information about quota files */ #define Q_SETINFO 0x800006 /* set information about quota files */ #define Q_GETQUOTA 0x800007 /* get user quota structure */ #define Q_SETQUOTA 0x800008 /* set user quota structure */ #define Q_GETNEXTQUOTA 0x800009 /* get disk limits and usage >= ID */ /* Quota format type IDs */ #define QFMT_VFS_OLD 1 #define QFMT_VFS_V0 2 #define QFMT_OCFS2 3 #define QFMT_VFS_V1 4 /* Size of block in which space limits are passed through the quota * interface */ #define QIF_DQBLKSIZE_BITS 10 #define QIF_DQBLKSIZE (1 << QIF_DQBLKSIZE_BITS) /* * Quota structure used for communication with userspace via quotactl * Following flags are used to specify which fields are valid */ enum { QIF_BLIMITS_B = 0, QIF_SPACE_B, QIF_ILIMITS_B, QIF_INODES_B, QIF_BTIME_B, QIF_ITIME_B, }; #define QIF_BLIMITS (1 << QIF_BLIMITS_B) #define QIF_SPACE (1 << QIF_SPACE_B) #define QIF_ILIMITS (1 << QIF_ILIMITS_B) #define QIF_INODES (1 << QIF_INODES_B) #define QIF_BTIME (1 << QIF_BTIME_B) #define QIF_ITIME (1 << QIF_ITIME_B) #define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) #define QIF_USAGE (QIF_SPACE | QIF_INODES) #define QIF_TIMES (QIF_BTIME | QIF_ITIME) #define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES) struct if_dqblk { __u64 dqb_bhardlimit; __u64 dqb_bsoftlimit; __u64 dqb_curspace; __u64 dqb_ihardlimit; __u64 dqb_isoftlimit; __u64 dqb_curinodes; __u64 dqb_btime; __u64 dqb_itime; __u32 dqb_valid; }; struct if_nextdqblk { __u64 dqb_bhardlimit; __u64 dqb_bsoftlimit; __u64 dqb_curspace; __u64 dqb_ihardlimit; __u64 dqb_isoftlimit; __u64 dqb_curinodes; __u64 dqb_btime; __u64 dqb_itime; __u32 dqb_valid; __u32 dqb_id; }; /* * Structure used for setting quota information about file via quotactl * Following flags are used to specify which fields are valid */ #define IIF_BGRACE 1 #define IIF_IGRACE 2 #define IIF_FLAGS 4 #define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS) enum { DQF_ROOT_SQUASH_B = 0, DQF_SYS_FILE_B = 16, /* Kernel internal flags invisible to userspace */ DQF_PRIVATE }; /* Root squash enabled (for v1 quota format) */ #define DQF_ROOT_SQUASH (1 << DQF_ROOT_SQUASH_B) /* Quota stored in a system file */ #define DQF_SYS_FILE (1 << DQF_SYS_FILE_B) struct if_dqinfo { __u64 dqi_bgrace; __u64 dqi_igrace; __u32 dqi_flags; /* DFQ_* */ __u32 dqi_valid; }; /* * Definitions for quota netlink interface */ #define QUOTA_NL_NOWARN 0 #define QUOTA_NL_IHARDWARN 1 /* Inode hardlimit reached */ #define QUOTA_NL_ISOFTLONGWARN 2 /* Inode grace time expired */ #define QUOTA_NL_ISOFTWARN 3 /* Inode softlimit reached */ #define QUOTA_NL_BHARDWARN 4 /* Block hardlimit reached */ #define QUOTA_NL_BSOFTLONGWARN 5 /* Block grace time expired */ #define QUOTA_NL_BSOFTWARN 6 /* Block softlimit reached */ #define QUOTA_NL_IHARDBELOW 7 /* Usage got below inode hardlimit */ #define QUOTA_NL_ISOFTBELOW 8 /* Usage got below inode softlimit */ #define QUOTA_NL_BHARDBELOW 9 /* Usage got below block hardlimit */ #define QUOTA_NL_BSOFTBELOW 10 /* Usage got below block softlimit */ enum { QUOTA_NL_C_UNSPEC, QUOTA_NL_C_WARNING, __QUOTA_NL_C_MAX, }; #define QUOTA_NL_C_MAX (__QUOTA_NL_C_MAX - 1) enum { QUOTA_NL_A_UNSPEC, QUOTA_NL_A_QTYPE, QUOTA_NL_A_EXCESS_ID, QUOTA_NL_A_WARNING, QUOTA_NL_A_DEV_MAJOR, QUOTA_NL_A_DEV_MINOR, QUOTA_NL_A_CAUSED_ID, QUOTA_NL_A_PAD, __QUOTA_NL_A_MAX, }; #define QUOTA_NL_A_MAX (__QUOTA_NL_A_MAX - 1) #endif /* _LINUX_QUOTA_ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_xdp.h��������������������������������������������������������������������������������������0000644�����������������00000003472�14763166027�0007347 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * if_xdp: XDP socket user-space interface * Copyright(c) 2018 Intel Corporation. * * Author(s): Björn Töpel <bjorn.topel@intel.com> * Magnus Karlsson <magnus.karlsson@intel.com> */ #ifndef _LINUX_IF_XDP_H #define _LINUX_IF_XDP_H #include <linux/types.h> /* Options for the sxdp_flags field */ #define XDP_SHARED_UMEM (1 << 0) #define XDP_COPY (1 << 1) /* Force copy-mode */ #define XDP_ZEROCOPY (1 << 2) /* Force zero-copy mode */ struct sockaddr_xdp { __u16 sxdp_family; __u16 sxdp_flags; __u32 sxdp_ifindex; __u32 sxdp_queue_id; __u32 sxdp_shared_umem_fd; }; struct xdp_ring_offset { __u64 producer; __u64 consumer; __u64 desc; }; struct xdp_mmap_offsets { struct xdp_ring_offset rx; struct xdp_ring_offset tx; struct xdp_ring_offset fr; /* Fill */ struct xdp_ring_offset cr; /* Completion */ }; /* XDP socket options */ #define XDP_MMAP_OFFSETS 1 #define XDP_RX_RING 2 #define XDP_TX_RING 3 #define XDP_UMEM_REG 4 #define XDP_UMEM_FILL_RING 5 #define XDP_UMEM_COMPLETION_RING 6 #define XDP_STATISTICS 7 struct xdp_umem_reg { __u64 addr; /* Start of packet data area */ __u64 len; /* Length of packet data area */ __u32 chunk_size; __u32 headroom; }; struct xdp_statistics { __u64 rx_dropped; /* Dropped for reasons other than invalid desc */ __u64 rx_invalid_descs; /* Dropped due to invalid descriptor */ __u64 tx_invalid_descs; /* Dropped due to invalid descriptor */ }; /* Pgoff for mmaping the rings */ #define XDP_PGOFF_RX_RING 0 #define XDP_PGOFF_TX_RING 0x80000000 #define XDP_UMEM_PGOFF_FILL_RING 0x100000000ULL #define XDP_UMEM_PGOFF_COMPLETION_RING 0x180000000ULL /* Rx/Tx descriptor */ struct xdp_desc { __u64 addr; __u32 len; __u32 options; }; /* UMEM descriptor is __u64 */ #endif /* _LINUX_IF_XDP_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/ppp-ioctl.h�����������������������������������������������������������������������������������0000644�����������������00000012476�14763166027�0010011 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ppp-ioctl.h - PPP ioctl definitions. * * Copyright 1999-2002 Paul Mackerras. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. */ #ifndef _PPP_IOCTL_H #define _PPP_IOCTL_H #include <linux/types.h> #include <linux/ppp_defs.h> /* * Bit definitions for flags argument to PPPIOCGFLAGS/PPPIOCSFLAGS. */ #define SC_COMP_PROT 0x00000001 /* protocol compression (output) */ #define SC_COMP_AC 0x00000002 /* header compression (output) */ #define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */ #define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */ #define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */ #define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */ #define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */ #define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */ #define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */ #define SC_LOOP_TRAFFIC 0x00000200 /* send traffic to pppd */ #define SC_MULTILINK 0x00000400 /* do multilink encapsulation */ #define SC_MP_SHORTSEQ 0x00000800 /* use short MP sequence numbers */ #define SC_COMP_RUN 0x00001000 /* compressor has been inited */ #define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */ #define SC_MP_XSHORTSEQ 0x00004000 /* transmit short MP seq numbers */ #define SC_DEBUG 0x00010000 /* enable debug messages */ #define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */ #define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ #define SC_LOG_RAWIN 0x00080000 /* log all chars received */ #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ #define SC_SYNC 0x00200000 /* synchronous serial mode */ #define SC_MUST_COMP 0x00400000 /* no uncompressed packets may be sent or received */ #define SC_MASK 0x0f600fff /* bits that user can change */ /* state bits */ #define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */ #define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ #define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ #define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */ #define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */ #define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */ #define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */ /* Used with PPPIOCGNPMODE/PPPIOCSNPMODE */ struct npioctl { int protocol; /* PPP protocol, e.g. PPP_IP */ enum NPmode mode; }; /* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */ struct ppp_option_data { __u8 *ptr; __u32 length; int transmit; }; /* For PPPIOCGL2TPSTATS */ struct pppol2tp_ioc_stats { __u16 tunnel_id; /* redundant */ __u16 session_id; /* if zero, get tunnel stats */ __u32 using_ipsec:1; __aligned_u64 tx_packets; __aligned_u64 tx_bytes; __aligned_u64 tx_errors; __aligned_u64 rx_packets; __aligned_u64 rx_bytes; __aligned_u64 rx_seq_discards; __aligned_u64 rx_oos_packets; __aligned_u64 rx_errors; }; /* * Ioctl definitions. */ #define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */ #define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */ #define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */ #define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */ #define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */ #define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */ #define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */ #define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */ #define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */ #define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */ #define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */ #define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */ #define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */ #define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data) #define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */ #define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */ #define PPPIOCSPASS _IOW('t', 71, struct sock_fprog) /* set pass filter */ #define PPPIOCSACTIVE _IOW('t', 70, struct sock_fprog) /* set active filt */ #define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */ #define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */ #define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */ #define PPPIOCNEWUNIT _IOWR('t', 62, int) /* create new ppp unit */ #define PPPIOCATTACH _IOW('t', 61, int) /* attach to ppp unit */ #define PPPIOCDETACH _IOW('t', 60, int) /* obsolete, do not use */ #define PPPIOCSMRRU _IOW('t', 59, int) /* set multilink MRU */ #define PPPIOCCONNECT _IOW('t', 58, int) /* connect channel to unit */ #define PPPIOCDISCONN _IO('t', 57) /* disconnect channel */ #define PPPIOCATTCHAN _IOW('t', 56, int) /* attach to ppp channel */ #define PPPIOCGCHAN _IOR('t', 55, int) /* get ppp channel number */ #define PPPIOCGL2TPSTATS _IOR('t', 54, struct pppol2tp_ioc_stats) #define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0) #define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */ #define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2) #endif /* _PPP_IOCTL_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/iso_fs.h��������������������������������������������������������������������������������������0000644�����������������00000014525�14763166027�0007361 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ISOFS_FS_H #define _ISOFS_FS_H #include <linux/types.h> #include <linux/magic.h> /* * The isofs filesystem constants/structures */ /* This part borrowed from the bsd386 isofs */ #define ISODCL(from, to) (to - from + 1) struct iso_volume_descriptor { __u8 type[ISODCL(1,1)]; /* 711 */ char id[ISODCL(2,6)]; __u8 version[ISODCL(7,7)]; __u8 data[ISODCL(8,2048)]; }; /* volume descriptor types */ #define ISO_VD_PRIMARY 1 #define ISO_VD_SUPPLEMENTARY 2 #define ISO_VD_END 255 #define ISO_STANDARD_ID "CD001" struct iso_primary_descriptor { __u8 type [ISODCL ( 1, 1)]; /* 711 */ char id [ISODCL ( 2, 6)]; __u8 version [ISODCL ( 7, 7)]; /* 711 */ __u8 unused1 [ISODCL ( 8, 8)]; char system_id [ISODCL ( 9, 40)]; /* achars */ char volume_id [ISODCL ( 41, 72)]; /* dchars */ __u8 unused2 [ISODCL ( 73, 80)]; __u8 volume_space_size [ISODCL ( 81, 88)]; /* 733 */ __u8 unused3 [ISODCL ( 89, 120)]; __u8 volume_set_size [ISODCL (121, 124)]; /* 723 */ __u8 volume_sequence_number [ISODCL (125, 128)]; /* 723 */ __u8 logical_block_size [ISODCL (129, 132)]; /* 723 */ __u8 path_table_size [ISODCL (133, 140)]; /* 733 */ __u8 type_l_path_table [ISODCL (141, 144)]; /* 731 */ __u8 opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ __u8 type_m_path_table [ISODCL (149, 152)]; /* 732 */ __u8 opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ __u8 root_directory_record [ISODCL (157, 190)]; /* 9.1 */ char volume_set_id [ISODCL (191, 318)]; /* dchars */ char publisher_id [ISODCL (319, 446)]; /* achars */ char preparer_id [ISODCL (447, 574)]; /* achars */ char application_id [ISODCL (575, 702)]; /* achars */ char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ __u8 creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ __u8 modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ __u8 expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ __u8 effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ __u8 file_structure_version [ISODCL (882, 882)]; /* 711 */ __u8 unused4 [ISODCL (883, 883)]; __u8 application_data [ISODCL (884, 1395)]; __u8 unused5 [ISODCL (1396, 2048)]; }; /* Almost the same as the primary descriptor but two fields are specified */ struct iso_supplementary_descriptor { __u8 type [ISODCL ( 1, 1)]; /* 711 */ char id [ISODCL ( 2, 6)]; __u8 version [ISODCL ( 7, 7)]; /* 711 */ __u8 flags [ISODCL ( 8, 8)]; /* 853 */ char system_id [ISODCL ( 9, 40)]; /* achars */ char volume_id [ISODCL ( 41, 72)]; /* dchars */ __u8 unused2 [ISODCL ( 73, 80)]; __u8 volume_space_size [ISODCL ( 81, 88)]; /* 733 */ __u8 escape [ISODCL ( 89, 120)]; /* 856 */ __u8 volume_set_size [ISODCL (121, 124)]; /* 723 */ __u8 volume_sequence_number [ISODCL (125, 128)]; /* 723 */ __u8 logical_block_size [ISODCL (129, 132)]; /* 723 */ __u8 path_table_size [ISODCL (133, 140)]; /* 733 */ __u8 type_l_path_table [ISODCL (141, 144)]; /* 731 */ __u8 opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ __u8 type_m_path_table [ISODCL (149, 152)]; /* 732 */ __u8 opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ __u8 root_directory_record [ISODCL (157, 190)]; /* 9.1 */ char volume_set_id [ISODCL (191, 318)]; /* dchars */ char publisher_id [ISODCL (319, 446)]; /* achars */ char preparer_id [ISODCL (447, 574)]; /* achars */ char application_id [ISODCL (575, 702)]; /* achars */ char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ __u8 creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ __u8 modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ __u8 expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ __u8 effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ __u8 file_structure_version [ISODCL (882, 882)]; /* 711 */ __u8 unused4 [ISODCL (883, 883)]; __u8 application_data [ISODCL (884, 1395)]; __u8 unused5 [ISODCL (1396, 2048)]; }; #define HS_STANDARD_ID "CDROM" struct hs_volume_descriptor { __u8 foo [ISODCL ( 1, 8)]; /* 733 */ __u8 type [ISODCL ( 9, 9)]; /* 711 */ char id [ISODCL ( 10, 14)]; __u8 version [ISODCL ( 15, 15)]; /* 711 */ __u8 data[ISODCL(16,2048)]; }; struct hs_primary_descriptor { __u8 foo [ISODCL ( 1, 8)]; /* 733 */ __u8 type [ISODCL ( 9, 9)]; /* 711 */ __u8 id [ISODCL ( 10, 14)]; __u8 version [ISODCL ( 15, 15)]; /* 711 */ __u8 unused1 [ISODCL ( 16, 16)]; /* 711 */ char system_id [ISODCL ( 17, 48)]; /* achars */ char volume_id [ISODCL ( 49, 80)]; /* dchars */ __u8 unused2 [ISODCL ( 81, 88)]; /* 733 */ __u8 volume_space_size [ISODCL ( 89, 96)]; /* 733 */ __u8 unused3 [ISODCL ( 97, 128)]; /* 733 */ __u8 volume_set_size [ISODCL (129, 132)]; /* 723 */ __u8 volume_sequence_number [ISODCL (133, 136)]; /* 723 */ __u8 logical_block_size [ISODCL (137, 140)]; /* 723 */ __u8 path_table_size [ISODCL (141, 148)]; /* 733 */ __u8 type_l_path_table [ISODCL (149, 152)]; /* 731 */ __u8 unused4 [ISODCL (153, 180)]; /* 733 */ __u8 root_directory_record [ISODCL (181, 214)]; /* 9.1 */ }; /* We use this to help us look up the parent inode numbers. */ struct iso_path_table{ __u8 name_len[2]; /* 721 */ __u8 extent[4]; /* 731 */ __u8 parent[2]; /* 721 */ char name[0]; } __attribute__((packed)); /* high sierra is identical to iso, except that the date is only 6 bytes, and there is an extra reserved byte after the flags */ struct iso_directory_record { __u8 length [ISODCL (1, 1)]; /* 711 */ __u8 ext_attr_length [ISODCL (2, 2)]; /* 711 */ __u8 extent [ISODCL (3, 10)]; /* 733 */ __u8 size [ISODCL (11, 18)]; /* 733 */ __u8 date [ISODCL (19, 25)]; /* 7 by 711 */ __u8 flags [ISODCL (26, 26)]; __u8 file_unit_size [ISODCL (27, 27)]; /* 711 */ __u8 interleave [ISODCL (28, 28)]; /* 711 */ __u8 volume_sequence_number [ISODCL (29, 32)]; /* 723 */ __u8 name_len [ISODCL (33, 33)]; /* 711 */ char name [0]; } __attribute__((packed)); #define ISOFS_BLOCK_BITS 11 #define ISOFS_BLOCK_SIZE 2048 #define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize) #define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits) #endif /* _ISOFS_FS_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/mroute.h��������������������������������������������������������������������������������������0000644�����������������00000012641�14763166027�0007407 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_MROUTE_H #define __LINUX_MROUTE_H #include <linux/sockios.h> #include <linux/types.h> #include <linux/in.h> /* For struct in_addr. */ /* Based on the MROUTING 3.5 defines primarily to keep * source compatibility with BSD. * * See the mrouted code for the original history. * * Protocol Independent Multicast (PIM) data structures included * Carlos Picoto (cap@di.fc.ul.pt) */ #define MRT_BASE 200 #define MRT_INIT (MRT_BASE) /* Activate the kernel mroute code */ #define MRT_DONE (MRT_BASE+1) /* Shutdown the kernel mroute */ #define MRT_ADD_VIF (MRT_BASE+2) /* Add a virtual interface */ #define MRT_DEL_VIF (MRT_BASE+3) /* Delete a virtual interface */ #define MRT_ADD_MFC (MRT_BASE+4) /* Add a multicast forwarding entry */ #define MRT_DEL_MFC (MRT_BASE+5) /* Delete a multicast forwarding entry */ #define MRT_VERSION (MRT_BASE+6) /* Get the kernel multicast version */ #define MRT_ASSERT (MRT_BASE+7) /* Activate PIM assert mode */ #define MRT_PIM (MRT_BASE+8) /* enable PIM code */ #define MRT_TABLE (MRT_BASE+9) /* Specify mroute table ID */ #define MRT_ADD_MFC_PROXY (MRT_BASE+10) /* Add a (*,*|G) mfc entry */ #define MRT_DEL_MFC_PROXY (MRT_BASE+11) /* Del a (*,*|G) mfc entry */ #define MRT_MAX (MRT_BASE+11) #define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */ #define SIOCGETSGCNT (SIOCPROTOPRIVATE+1) #define SIOCGETRPF (SIOCPROTOPRIVATE+2) #define MAXVIFS 32 typedef unsigned long vifbitmap_t; /* User mode code depends on this lot */ typedef unsigned short vifi_t; #define ALL_VIFS ((vifi_t)(-1)) /* Same idea as select */ #define VIFM_SET(n,m) ((m)|=(1<<(n))) #define VIFM_CLR(n,m) ((m)&=~(1<<(n))) #define VIFM_ISSET(n,m) ((m)&(1<<(n))) #define VIFM_CLRALL(m) ((m)=0) #define VIFM_COPY(mfrom,mto) ((mto)=(mfrom)) #define VIFM_SAME(m1,m2) ((m1)==(m2)) /* Passed by mrouted for an MRT_ADD_VIF - again we use the * mrouted 3.6 structures for compatibility */ struct vifctl { vifi_t vifc_vifi; /* Index of VIF */ unsigned char vifc_flags; /* VIFF_ flags */ unsigned char vifc_threshold; /* ttl limit */ unsigned int vifc_rate_limit; /* Rate limiter values (NI) */ union { struct in_addr vifc_lcl_addr; /* Local interface address */ int vifc_lcl_ifindex; /* Local interface index */ }; struct in_addr vifc_rmt_addr; /* IPIP tunnel addr */ }; #define VIFF_TUNNEL 0x1 /* IPIP tunnel */ #define VIFF_SRCRT 0x2 /* NI */ #define VIFF_REGISTER 0x4 /* register vif */ #define VIFF_USE_IFINDEX 0x8 /* use vifc_lcl_ifindex instead of vifc_lcl_addr to find an interface */ /* Cache manipulation structures for mrouted and PIMd */ struct mfcctl { struct in_addr mfcc_origin; /* Origin of mcast */ struct in_addr mfcc_mcastgrp; /* Group in question */ vifi_t mfcc_parent; /* Where it arrived */ unsigned char mfcc_ttls[MAXVIFS]; /* Where it is going */ unsigned int mfcc_pkt_cnt; /* pkt count for src-grp */ unsigned int mfcc_byte_cnt; unsigned int mfcc_wrong_if; int mfcc_expire; }; /* Group count retrieval for mrouted */ struct sioc_sg_req { struct in_addr src; struct in_addr grp; unsigned long pktcnt; unsigned long bytecnt; unsigned long wrong_if; }; /* To get vif packet counts */ struct sioc_vif_req { vifi_t vifi; /* Which iface */ unsigned long icount; /* In packets */ unsigned long ocount; /* Out packets */ unsigned long ibytes; /* In bytes */ unsigned long obytes; /* Out bytes */ }; /* This is the format the mroute daemon expects to see IGMP control * data. Magically happens to be like an IP packet as per the original */ struct igmpmsg { __u32 unused1,unused2; unsigned char im_msgtype; /* What is this */ unsigned char im_mbz; /* Must be zero */ unsigned char im_vif; /* Interface (this ought to be a vifi_t!) */ unsigned char unused3; struct in_addr im_src,im_dst; }; /* ipmr netlink table attributes */ enum { IPMRA_TABLE_UNSPEC, IPMRA_TABLE_ID, IPMRA_TABLE_CACHE_RES_QUEUE_LEN, IPMRA_TABLE_MROUTE_REG_VIF_NUM, IPMRA_TABLE_MROUTE_DO_ASSERT, IPMRA_TABLE_MROUTE_DO_PIM, IPMRA_TABLE_VIFS, IPMRA_TABLE_MROUTE_DO_WRVIFWHOLE, __IPMRA_TABLE_MAX }; #define IPMRA_TABLE_MAX (__IPMRA_TABLE_MAX - 1) /* ipmr netlink vif attribute format * [ IPMRA_TABLE_VIFS ] - nested attribute * [ IPMRA_VIF ] - nested attribute * [ IPMRA_VIFA_xxx ] */ enum { IPMRA_VIF_UNSPEC, IPMRA_VIF, __IPMRA_VIF_MAX }; #define IPMRA_VIF_MAX (__IPMRA_VIF_MAX - 1) /* vif-specific attributes */ enum { IPMRA_VIFA_UNSPEC, IPMRA_VIFA_IFINDEX, IPMRA_VIFA_VIF_ID, IPMRA_VIFA_FLAGS, IPMRA_VIFA_BYTES_IN, IPMRA_VIFA_BYTES_OUT, IPMRA_VIFA_PACKETS_IN, IPMRA_VIFA_PACKETS_OUT, IPMRA_VIFA_LOCAL_ADDR, IPMRA_VIFA_REMOTE_ADDR, IPMRA_VIFA_PAD, __IPMRA_VIFA_MAX }; #define IPMRA_VIFA_MAX (__IPMRA_VIFA_MAX - 1) /* ipmr netlink cache report attributes */ enum { IPMRA_CREPORT_UNSPEC, IPMRA_CREPORT_MSGTYPE, IPMRA_CREPORT_VIF_ID, IPMRA_CREPORT_SRC_ADDR, IPMRA_CREPORT_DST_ADDR, IPMRA_CREPORT_PKT, __IPMRA_CREPORT_MAX }; #define IPMRA_CREPORT_MAX (__IPMRA_CREPORT_MAX - 1) /* That's all usermode folks */ #define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */ /* Pseudo messages used by mrouted */ #define IGMPMSG_NOCACHE 1 /* Kern cache fill request to mrouted */ #define IGMPMSG_WRONGVIF 2 /* For PIM assert processing (unused) */ #define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */ #define IGMPMSG_WRVIFWHOLE 4 /* For PIM Register and assert processing */ #endif /* __LINUX_MROUTE_H */ �����������������������������������������������������������������������������������������������linux/keyboard.h������������������������������������������������������������������������������������0000644�����������������00000032223�14763166027�0007672 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_KEYBOARD_H #define __LINUX_KEYBOARD_H #include <linux/wait.h> #define KG_SHIFT 0 #define KG_CTRL 2 #define KG_ALT 3 #define KG_ALTGR 1 #define KG_SHIFTL 4 #define KG_KANASHIFT 4 #define KG_SHIFTR 5 #define KG_CTRLL 6 #define KG_CTRLR 7 #define KG_CAPSSHIFT 8 #define NR_SHIFT 9 #define NR_KEYS 256 #define MAX_NR_KEYMAPS 256 /* This means 128Kb if all keymaps are allocated. Only the superuser may increase the number of keymaps beyond MAX_NR_OF_USER_KEYMAPS. */ #define MAX_NR_OF_USER_KEYMAPS 256 /* should be at least 7 */ #define MAX_NR_FUNC 256 /* max nr of strings assigned to keys */ #define KT_LATIN 0 /* we depend on this being zero */ #define KT_LETTER 11 /* symbol that can be acted upon by CapsLock */ #define KT_FN 1 #define KT_SPEC 2 #define KT_PAD 3 #define KT_DEAD 4 #define KT_CONS 5 #define KT_CUR 6 #define KT_SHIFT 7 #define KT_META 8 #define KT_ASCII 9 #define KT_LOCK 10 #define KT_SLOCK 12 #define KT_DEAD2 13 #define KT_BRL 14 #define K(t,v) (((t)<<8)|(v)) #define KTYP(x) ((x) >> 8) #define KVAL(x) ((x) & 0xff) #define K_F1 K(KT_FN,0) #define K_F2 K(KT_FN,1) #define K_F3 K(KT_FN,2) #define K_F4 K(KT_FN,3) #define K_F5 K(KT_FN,4) #define K_F6 K(KT_FN,5) #define K_F7 K(KT_FN,6) #define K_F8 K(KT_FN,7) #define K_F9 K(KT_FN,8) #define K_F10 K(KT_FN,9) #define K_F11 K(KT_FN,10) #define K_F12 K(KT_FN,11) #define K_F13 K(KT_FN,12) #define K_F14 K(KT_FN,13) #define K_F15 K(KT_FN,14) #define K_F16 K(KT_FN,15) #define K_F17 K(KT_FN,16) #define K_F18 K(KT_FN,17) #define K_F19 K(KT_FN,18) #define K_F20 K(KT_FN,19) #define K_FIND K(KT_FN,20) #define K_INSERT K(KT_FN,21) #define K_REMOVE K(KT_FN,22) #define K_SELECT K(KT_FN,23) #define K_PGUP K(KT_FN,24) /* PGUP is a synonym for PRIOR */ #define K_PGDN K(KT_FN,25) /* PGDN is a synonym for NEXT */ #define K_MACRO K(KT_FN,26) #define K_HELP K(KT_FN,27) #define K_DO K(KT_FN,28) #define K_PAUSE K(KT_FN,29) #define K_F21 K(KT_FN,30) #define K_F22 K(KT_FN,31) #define K_F23 K(KT_FN,32) #define K_F24 K(KT_FN,33) #define K_F25 K(KT_FN,34) #define K_F26 K(KT_FN,35) #define K_F27 K(KT_FN,36) #define K_F28 K(KT_FN,37) #define K_F29 K(KT_FN,38) #define K_F30 K(KT_FN,39) #define K_F31 K(KT_FN,40) #define K_F32 K(KT_FN,41) #define K_F33 K(KT_FN,42) #define K_F34 K(KT_FN,43) #define K_F35 K(KT_FN,44) #define K_F36 K(KT_FN,45) #define K_F37 K(KT_FN,46) #define K_F38 K(KT_FN,47) #define K_F39 K(KT_FN,48) #define K_F40 K(KT_FN,49) #define K_F41 K(KT_FN,50) #define K_F42 K(KT_FN,51) #define K_F43 K(KT_FN,52) #define K_F44 K(KT_FN,53) #define K_F45 K(KT_FN,54) #define K_F46 K(KT_FN,55) #define K_F47 K(KT_FN,56) #define K_F48 K(KT_FN,57) #define K_F49 K(KT_FN,58) #define K_F50 K(KT_FN,59) #define K_F51 K(KT_FN,60) #define K_F52 K(KT_FN,61) #define K_F53 K(KT_FN,62) #define K_F54 K(KT_FN,63) #define K_F55 K(KT_FN,64) #define K_F56 K(KT_FN,65) #define K_F57 K(KT_FN,66) #define K_F58 K(KT_FN,67) #define K_F59 K(KT_FN,68) #define K_F60 K(KT_FN,69) #define K_F61 K(KT_FN,70) #define K_F62 K(KT_FN,71) #define K_F63 K(KT_FN,72) #define K_F64 K(KT_FN,73) #define K_F65 K(KT_FN,74) #define K_F66 K(KT_FN,75) #define K_F67 K(KT_FN,76) #define K_F68 K(KT_FN,77) #define K_F69 K(KT_FN,78) #define K_F70 K(KT_FN,79) #define K_F71 K(KT_FN,80) #define K_F72 K(KT_FN,81) #define K_F73 K(KT_FN,82) #define K_F74 K(KT_FN,83) #define K_F75 K(KT_FN,84) #define K_F76 K(KT_FN,85) #define K_F77 K(KT_FN,86) #define K_F78 K(KT_FN,87) #define K_F79 K(KT_FN,88) #define K_F80 K(KT_FN,89) #define K_F81 K(KT_FN,90) #define K_F82 K(KT_FN,91) #define K_F83 K(KT_FN,92) #define K_F84 K(KT_FN,93) #define K_F85 K(KT_FN,94) #define K_F86 K(KT_FN,95) #define K_F87 K(KT_FN,96) #define K_F88 K(KT_FN,97) #define K_F89 K(KT_FN,98) #define K_F90 K(KT_FN,99) #define K_F91 K(KT_FN,100) #define K_F92 K(KT_FN,101) #define K_F93 K(KT_FN,102) #define K_F94 K(KT_FN,103) #define K_F95 K(KT_FN,104) #define K_F96 K(KT_FN,105) #define K_F97 K(KT_FN,106) #define K_F98 K(KT_FN,107) #define K_F99 K(KT_FN,108) #define K_F100 K(KT_FN,109) #define K_F101 K(KT_FN,110) #define K_F102 K(KT_FN,111) #define K_F103 K(KT_FN,112) #define K_F104 K(KT_FN,113) #define K_F105 K(KT_FN,114) #define K_F106 K(KT_FN,115) #define K_F107 K(KT_FN,116) #define K_F108 K(KT_FN,117) #define K_F109 K(KT_FN,118) #define K_F110 K(KT_FN,119) #define K_F111 K(KT_FN,120) #define K_F112 K(KT_FN,121) #define K_F113 K(KT_FN,122) #define K_F114 K(KT_FN,123) #define K_F115 K(KT_FN,124) #define K_F116 K(KT_FN,125) #define K_F117 K(KT_FN,126) #define K_F118 K(KT_FN,127) #define K_F119 K(KT_FN,128) #define K_F120 K(KT_FN,129) #define K_F121 K(KT_FN,130) #define K_F122 K(KT_FN,131) #define K_F123 K(KT_FN,132) #define K_F124 K(KT_FN,133) #define K_F125 K(KT_FN,134) #define K_F126 K(KT_FN,135) #define K_F127 K(KT_FN,136) #define K_F128 K(KT_FN,137) #define K_F129 K(KT_FN,138) #define K_F130 K(KT_FN,139) #define K_F131 K(KT_FN,140) #define K_F132 K(KT_FN,141) #define K_F133 K(KT_FN,142) #define K_F134 K(KT_FN,143) #define K_F135 K(KT_FN,144) #define K_F136 K(KT_FN,145) #define K_F137 K(KT_FN,146) #define K_F138 K(KT_FN,147) #define K_F139 K(KT_FN,148) #define K_F140 K(KT_FN,149) #define K_F141 K(KT_FN,150) #define K_F142 K(KT_FN,151) #define K_F143 K(KT_FN,152) #define K_F144 K(KT_FN,153) #define K_F145 K(KT_FN,154) #define K_F146 K(KT_FN,155) #define K_F147 K(KT_FN,156) #define K_F148 K(KT_FN,157) #define K_F149 K(KT_FN,158) #define K_F150 K(KT_FN,159) #define K_F151 K(KT_FN,160) #define K_F152 K(KT_FN,161) #define K_F153 K(KT_FN,162) #define K_F154 K(KT_FN,163) #define K_F155 K(KT_FN,164) #define K_F156 K(KT_FN,165) #define K_F157 K(KT_FN,166) #define K_F158 K(KT_FN,167) #define K_F159 K(KT_FN,168) #define K_F160 K(KT_FN,169) #define K_F161 K(KT_FN,170) #define K_F162 K(KT_FN,171) #define K_F163 K(KT_FN,172) #define K_F164 K(KT_FN,173) #define K_F165 K(KT_FN,174) #define K_F166 K(KT_FN,175) #define K_F167 K(KT_FN,176) #define K_F168 K(KT_FN,177) #define K_F169 K(KT_FN,178) #define K_F170 K(KT_FN,179) #define K_F171 K(KT_FN,180) #define K_F172 K(KT_FN,181) #define K_F173 K(KT_FN,182) #define K_F174 K(KT_FN,183) #define K_F175 K(KT_FN,184) #define K_F176 K(KT_FN,185) #define K_F177 K(KT_FN,186) #define K_F178 K(KT_FN,187) #define K_F179 K(KT_FN,188) #define K_F180 K(KT_FN,189) #define K_F181 K(KT_FN,190) #define K_F182 K(KT_FN,191) #define K_F183 K(KT_FN,192) #define K_F184 K(KT_FN,193) #define K_F185 K(KT_FN,194) #define K_F186 K(KT_FN,195) #define K_F187 K(KT_FN,196) #define K_F188 K(KT_FN,197) #define K_F189 K(KT_FN,198) #define K_F190 K(KT_FN,199) #define K_F191 K(KT_FN,200) #define K_F192 K(KT_FN,201) #define K_F193 K(KT_FN,202) #define K_F194 K(KT_FN,203) #define K_F195 K(KT_FN,204) #define K_F196 K(KT_FN,205) #define K_F197 K(KT_FN,206) #define K_F198 K(KT_FN,207) #define K_F199 K(KT_FN,208) #define K_F200 K(KT_FN,209) #define K_F201 K(KT_FN,210) #define K_F202 K(KT_FN,211) #define K_F203 K(KT_FN,212) #define K_F204 K(KT_FN,213) #define K_F205 K(KT_FN,214) #define K_F206 K(KT_FN,215) #define K_F207 K(KT_FN,216) #define K_F208 K(KT_FN,217) #define K_F209 K(KT_FN,218) #define K_F210 K(KT_FN,219) #define K_F211 K(KT_FN,220) #define K_F212 K(KT_FN,221) #define K_F213 K(KT_FN,222) #define K_F214 K(KT_FN,223) #define K_F215 K(KT_FN,224) #define K_F216 K(KT_FN,225) #define K_F217 K(KT_FN,226) #define K_F218 K(KT_FN,227) #define K_F219 K(KT_FN,228) #define K_F220 K(KT_FN,229) #define K_F221 K(KT_FN,230) #define K_F222 K(KT_FN,231) #define K_F223 K(KT_FN,232) #define K_F224 K(KT_FN,233) #define K_F225 K(KT_FN,234) #define K_F226 K(KT_FN,235) #define K_F227 K(KT_FN,236) #define K_F228 K(KT_FN,237) #define K_F229 K(KT_FN,238) #define K_F230 K(KT_FN,239) #define K_F231 K(KT_FN,240) #define K_F232 K(KT_FN,241) #define K_F233 K(KT_FN,242) #define K_F234 K(KT_FN,243) #define K_F235 K(KT_FN,244) #define K_F236 K(KT_FN,245) #define K_F237 K(KT_FN,246) #define K_F238 K(KT_FN,247) #define K_F239 K(KT_FN,248) #define K_F240 K(KT_FN,249) #define K_F241 K(KT_FN,250) #define K_F242 K(KT_FN,251) #define K_F243 K(KT_FN,252) #define K_F244 K(KT_FN,253) #define K_F245 K(KT_FN,254) #define K_UNDO K(KT_FN,255) #define K_HOLE K(KT_SPEC,0) #define K_ENTER K(KT_SPEC,1) #define K_SH_REGS K(KT_SPEC,2) #define K_SH_MEM K(KT_SPEC,3) #define K_SH_STAT K(KT_SPEC,4) #define K_BREAK K(KT_SPEC,5) #define K_CONS K(KT_SPEC,6) #define K_CAPS K(KT_SPEC,7) #define K_NUM K(KT_SPEC,8) #define K_HOLD K(KT_SPEC,9) #define K_SCROLLFORW K(KT_SPEC,10) #define K_SCROLLBACK K(KT_SPEC,11) #define K_BOOT K(KT_SPEC,12) #define K_CAPSON K(KT_SPEC,13) #define K_COMPOSE K(KT_SPEC,14) #define K_SAK K(KT_SPEC,15) #define K_DECRCONSOLE K(KT_SPEC,16) #define K_INCRCONSOLE K(KT_SPEC,17) #define K_SPAWNCONSOLE K(KT_SPEC,18) #define K_BARENUMLOCK K(KT_SPEC,19) #define K_ALLOCATED K(KT_SPEC,126) /* dynamically allocated keymap */ #define K_NOSUCHMAP K(KT_SPEC,127) /* returned by KDGKBENT */ #define K_P0 K(KT_PAD,0) #define K_P1 K(KT_PAD,1) #define K_P2 K(KT_PAD,2) #define K_P3 K(KT_PAD,3) #define K_P4 K(KT_PAD,4) #define K_P5 K(KT_PAD,5) #define K_P6 K(KT_PAD,6) #define K_P7 K(KT_PAD,7) #define K_P8 K(KT_PAD,8) #define K_P9 K(KT_PAD,9) #define K_PPLUS K(KT_PAD,10) /* key-pad plus */ #define K_PMINUS K(KT_PAD,11) /* key-pad minus */ #define K_PSTAR K(KT_PAD,12) /* key-pad asterisk (star) */ #define K_PSLASH K(KT_PAD,13) /* key-pad slash */ #define K_PENTER K(KT_PAD,14) /* key-pad enter */ #define K_PCOMMA K(KT_PAD,15) /* key-pad comma: kludge... */ #define K_PDOT K(KT_PAD,16) /* key-pad dot (period): kludge... */ #define K_PPLUSMINUS K(KT_PAD,17) /* key-pad plus/minus */ #define K_PPARENL K(KT_PAD,18) /* key-pad left parenthesis */ #define K_PPARENR K(KT_PAD,19) /* key-pad right parenthesis */ #define NR_PAD 20 #define K_DGRAVE K(KT_DEAD,0) #define K_DACUTE K(KT_DEAD,1) #define K_DCIRCM K(KT_DEAD,2) #define K_DTILDE K(KT_DEAD,3) #define K_DDIERE K(KT_DEAD,4) #define K_DCEDIL K(KT_DEAD,5) #define K_DMACRON K(KT_DEAD,6) #define K_DBREVE K(KT_DEAD,7) #define K_DABDOT K(KT_DEAD,8) #define K_DABRING K(KT_DEAD,9) #define K_DDBACUTE K(KT_DEAD,10) #define K_DCARON K(KT_DEAD,11) #define K_DOGONEK K(KT_DEAD,12) #define K_DIOTA K(KT_DEAD,13) #define K_DVOICED K(KT_DEAD,14) #define K_DSEMVOICED K(KT_DEAD,15) #define K_DBEDOT K(KT_DEAD,16) #define K_DHOOK K(KT_DEAD,17) #define K_DHORN K(KT_DEAD,18) #define K_DSTROKE K(KT_DEAD,19) #define K_DABCOMMA K(KT_DEAD,20) #define K_DABREVCOMMA K(KT_DEAD,21) #define K_DDBGRAVE K(KT_DEAD,22) #define K_DINVBREVE K(KT_DEAD,23) #define K_DBECOMMA K(KT_DEAD,24) #define K_DCURRENCY K(KT_DEAD,25) #define K_DGREEK K(KT_DEAD,26) #define NR_DEAD 27 #define K_DOWN K(KT_CUR,0) #define K_LEFT K(KT_CUR,1) #define K_RIGHT K(KT_CUR,2) #define K_UP K(KT_CUR,3) #define K_SHIFT K(KT_SHIFT,KG_SHIFT) #define K_CTRL K(KT_SHIFT,KG_CTRL) #define K_ALT K(KT_SHIFT,KG_ALT) #define K_ALTGR K(KT_SHIFT,KG_ALTGR) #define K_SHIFTL K(KT_SHIFT,KG_SHIFTL) #define K_SHIFTR K(KT_SHIFT,KG_SHIFTR) #define K_CTRLL K(KT_SHIFT,KG_CTRLL) #define K_CTRLR K(KT_SHIFT,KG_CTRLR) #define K_CAPSSHIFT K(KT_SHIFT,KG_CAPSSHIFT) #define K_ASC0 K(KT_ASCII,0) #define K_ASC1 K(KT_ASCII,1) #define K_ASC2 K(KT_ASCII,2) #define K_ASC3 K(KT_ASCII,3) #define K_ASC4 K(KT_ASCII,4) #define K_ASC5 K(KT_ASCII,5) #define K_ASC6 K(KT_ASCII,6) #define K_ASC7 K(KT_ASCII,7) #define K_ASC8 K(KT_ASCII,8) #define K_ASC9 K(KT_ASCII,9) #define K_HEX0 K(KT_ASCII,10) #define K_HEX1 K(KT_ASCII,11) #define K_HEX2 K(KT_ASCII,12) #define K_HEX3 K(KT_ASCII,13) #define K_HEX4 K(KT_ASCII,14) #define K_HEX5 K(KT_ASCII,15) #define K_HEX6 K(KT_ASCII,16) #define K_HEX7 K(KT_ASCII,17) #define K_HEX8 K(KT_ASCII,18) #define K_HEX9 K(KT_ASCII,19) #define K_HEXa K(KT_ASCII,20) #define K_HEXb K(KT_ASCII,21) #define K_HEXc K(KT_ASCII,22) #define K_HEXd K(KT_ASCII,23) #define K_HEXe K(KT_ASCII,24) #define K_HEXf K(KT_ASCII,25) #define NR_ASCII 26 #define K_SHIFTLOCK K(KT_LOCK,KG_SHIFT) #define K_CTRLLOCK K(KT_LOCK,KG_CTRL) #define K_ALTLOCK K(KT_LOCK,KG_ALT) #define K_ALTGRLOCK K(KT_LOCK,KG_ALTGR) #define K_SHIFTLLOCK K(KT_LOCK,KG_SHIFTL) #define K_SHIFTRLOCK K(KT_LOCK,KG_SHIFTR) #define K_CTRLLLOCK K(KT_LOCK,KG_CTRLL) #define K_CTRLRLOCK K(KT_LOCK,KG_CTRLR) #define K_CAPSSHIFTLOCK K(KT_LOCK,KG_CAPSSHIFT) #define K_SHIFT_SLOCK K(KT_SLOCK,KG_SHIFT) #define K_CTRL_SLOCK K(KT_SLOCK,KG_CTRL) #define K_ALT_SLOCK K(KT_SLOCK,KG_ALT) #define K_ALTGR_SLOCK K(KT_SLOCK,KG_ALTGR) #define K_SHIFTL_SLOCK K(KT_SLOCK,KG_SHIFTL) #define K_SHIFTR_SLOCK K(KT_SLOCK,KG_SHIFTR) #define K_CTRLL_SLOCK K(KT_SLOCK,KG_CTRLL) #define K_CTRLR_SLOCK K(KT_SLOCK,KG_CTRLR) #define K_CAPSSHIFT_SLOCK K(KT_SLOCK,KG_CAPSSHIFT) #define NR_LOCK 9 #define K_BRL_BLANK K(KT_BRL, 0) #define K_BRL_DOT1 K(KT_BRL, 1) #define K_BRL_DOT2 K(KT_BRL, 2) #define K_BRL_DOT3 K(KT_BRL, 3) #define K_BRL_DOT4 K(KT_BRL, 4) #define K_BRL_DOT5 K(KT_BRL, 5) #define K_BRL_DOT6 K(KT_BRL, 6) #define K_BRL_DOT7 K(KT_BRL, 7) #define K_BRL_DOT8 K(KT_BRL, 8) #define K_BRL_DOT9 K(KT_BRL, 9) #define K_BRL_DOT10 K(KT_BRL, 10) #define NR_BRL 11 #define MAX_DIACR 256 #endif /* __LINUX_KEYBOARD_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/pci_regs.h������������������������������������������������������������������������������������0000644�����������������00000154416�14763166027�0007676 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * pci_regs.h * * PCI standard defines * Copyright 1994, Drew Eckhardt * Copyright 1997--1999 Martin Mares <mj@ucw.cz> * * For more information, please consult the following manuals (look at * http://www.pcisig.com/ for how to get them): * * PCI BIOS Specification * PCI Local Bus Specification * PCI to PCI Bridge Specification * PCI System Design Guide * * For HyperTransport information, please consult the following manuals * from http://www.hypertransport.org * * The HyperTransport I/O Link Specification */ #ifndef LINUX_PCI_REGS_H #define LINUX_PCI_REGS_H /* * Conventional PCI and PCI-X Mode 1 devices have 256 bytes of * configuration space. PCI-X Mode 2 and PCIe devices have 4096 bytes of * configuration space. */ #define PCI_CFG_SPACE_SIZE 256 #define PCI_CFG_SPACE_EXP_SIZE 4096 /* * Under PCI, each device has 256 bytes of configuration address space, * of which the first 64 bytes are standardized as follows: */ #define PCI_STD_HEADER_SIZEOF 64 #define PCI_VENDOR_ID 0x00 /* 16 bits */ #define PCI_DEVICE_ID 0x02 /* 16 bits */ #define PCI_COMMAND 0x04 /* 16 bits */ #define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */ #define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */ #define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */ #define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */ #define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */ #define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */ #define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */ #define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */ #define PCI_COMMAND_SERR 0x100 /* Enable SERR */ #define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */ #define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */ #define PCI_STATUS 0x06 /* 16 bits */ #define PCI_STATUS_INTERRUPT 0x08 /* Interrupt status */ #define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ #define PCI_STATUS_66MHZ 0x20 /* Support 66 MHz PCI 2.1 bus */ #define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */ #define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */ #define PCI_STATUS_PARITY 0x100 /* Detected parity error */ #define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */ #define PCI_STATUS_DEVSEL_FAST 0x000 #define PCI_STATUS_DEVSEL_MEDIUM 0x200 #define PCI_STATUS_DEVSEL_SLOW 0x400 #define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */ #define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */ #define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */ #define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */ #define PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */ #define PCI_CLASS_REVISION 0x08 /* High 24 bits are class, low 8 revision */ #define PCI_REVISION_ID 0x08 /* Revision ID */ #define PCI_CLASS_PROG 0x09 /* Reg. Level Programming Interface */ #define PCI_CLASS_DEVICE 0x0a /* Device class */ #define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */ #define PCI_LATENCY_TIMER 0x0d /* 8 bits */ #define PCI_HEADER_TYPE 0x0e /* 8 bits */ #define PCI_HEADER_TYPE_NORMAL 0 #define PCI_HEADER_TYPE_BRIDGE 1 #define PCI_HEADER_TYPE_CARDBUS 2 #define PCI_BIST 0x0f /* 8 bits */ #define PCI_BIST_CODE_MASK 0x0f /* Return result */ #define PCI_BIST_START 0x40 /* 1 to start BIST, 2 secs or less */ #define PCI_BIST_CAPABLE 0x80 /* 1 if BIST capable */ /* * Base addresses specify locations in memory or I/O space. * Decoded size can be determined by writing a value of * 0xffffffff to the register, and reading it back. Only * 1 bits are decoded. */ #define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */ #define PCI_BASE_ADDRESS_1 0x14 /* 32 bits [htype 0,1 only] */ #define PCI_BASE_ADDRESS_2 0x18 /* 32 bits [htype 0 only] */ #define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */ #define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */ #define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */ #define PCI_BASE_ADDRESS_SPACE 0x01 /* 0 = memory, 1 = I/O */ #define PCI_BASE_ADDRESS_SPACE_IO 0x01 #define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00 #define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06 #define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */ #define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */ #define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */ #define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 /* prefetchable? */ #define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL) #define PCI_BASE_ADDRESS_IO_MASK (~0x03UL) /* bit 1 is reserved if address_space = 1 */ /* Header type 0 (normal devices) */ #define PCI_CARDBUS_CIS 0x28 #define PCI_SUBSYSTEM_VENDOR_ID 0x2c #define PCI_SUBSYSTEM_ID 0x2e #define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */ #define PCI_ROM_ADDRESS_ENABLE 0x01 #define PCI_ROM_ADDRESS_MASK (~0x7ffU) #define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */ /* 0x35-0x3b are reserved */ #define PCI_INTERRUPT_LINE 0x3c /* 8 bits */ #define PCI_INTERRUPT_PIN 0x3d /* 8 bits */ #define PCI_MIN_GNT 0x3e /* 8 bits */ #define PCI_MAX_LAT 0x3f /* 8 bits */ /* Header type 1 (PCI-to-PCI bridges) */ #define PCI_PRIMARY_BUS 0x18 /* Primary bus number */ #define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */ #define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */ #define PCI_SEC_LATENCY_TIMER 0x1b /* Latency timer for secondary interface */ #define PCI_IO_BASE 0x1c /* I/O range behind the bridge */ #define PCI_IO_LIMIT 0x1d #define PCI_IO_RANGE_TYPE_MASK 0x0fUL /* I/O bridging type */ #define PCI_IO_RANGE_TYPE_16 0x00 #define PCI_IO_RANGE_TYPE_32 0x01 #define PCI_IO_RANGE_MASK (~0x0fUL) /* Standard 4K I/O windows */ #define PCI_IO_1K_RANGE_MASK (~0x03UL) /* Intel 1K I/O windows */ #define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */ #define PCI_MEMORY_BASE 0x20 /* Memory range behind */ #define PCI_MEMORY_LIMIT 0x22 #define PCI_MEMORY_RANGE_TYPE_MASK 0x0fUL #define PCI_MEMORY_RANGE_MASK (~0x0fUL) #define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */ #define PCI_PREF_MEMORY_LIMIT 0x26 #define PCI_PREF_RANGE_TYPE_MASK 0x0fUL #define PCI_PREF_RANGE_TYPE_32 0x00 #define PCI_PREF_RANGE_TYPE_64 0x01 #define PCI_PREF_RANGE_MASK (~0x0fUL) #define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */ #define PCI_PREF_LIMIT_UPPER32 0x2c #define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */ #define PCI_IO_LIMIT_UPPER16 0x32 /* 0x34 same as for htype 0 */ /* 0x35-0x3b is reserved */ #define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */ /* 0x3c-0x3d are same as for htype 0 */ #define PCI_BRIDGE_CONTROL 0x3e #define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */ #define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */ #define PCI_BRIDGE_CTL_ISA 0x04 /* Enable ISA mode */ #define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */ #define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */ #define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */ #define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fast Back2Back enabled on secondary interface */ /* Header type 2 (CardBus bridges) */ #define PCI_CB_CAPABILITY_LIST 0x14 /* 0x15 reserved */ #define PCI_CB_SEC_STATUS 0x16 /* Secondary status */ #define PCI_CB_PRIMARY_BUS 0x18 /* PCI bus number */ #define PCI_CB_CARD_BUS 0x19 /* CardBus bus number */ #define PCI_CB_SUBORDINATE_BUS 0x1a /* Subordinate bus number */ #define PCI_CB_LATENCY_TIMER 0x1b /* CardBus latency timer */ #define PCI_CB_MEMORY_BASE_0 0x1c #define PCI_CB_MEMORY_LIMIT_0 0x20 #define PCI_CB_MEMORY_BASE_1 0x24 #define PCI_CB_MEMORY_LIMIT_1 0x28 #define PCI_CB_IO_BASE_0 0x2c #define PCI_CB_IO_BASE_0_HI 0x2e #define PCI_CB_IO_LIMIT_0 0x30 #define PCI_CB_IO_LIMIT_0_HI 0x32 #define PCI_CB_IO_BASE_1 0x34 #define PCI_CB_IO_BASE_1_HI 0x36 #define PCI_CB_IO_LIMIT_1 0x38 #define PCI_CB_IO_LIMIT_1_HI 0x3a #define PCI_CB_IO_RANGE_MASK (~0x03UL) /* 0x3c-0x3d are same as for htype 0 */ #define PCI_CB_BRIDGE_CONTROL 0x3e #define PCI_CB_BRIDGE_CTL_PARITY 0x01 /* Similar to standard bridge control register */ #define PCI_CB_BRIDGE_CTL_SERR 0x02 #define PCI_CB_BRIDGE_CTL_ISA 0x04 #define PCI_CB_BRIDGE_CTL_VGA 0x08 #define PCI_CB_BRIDGE_CTL_MASTER_ABORT 0x20 #define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 /* CardBus reset */ #define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 /* Enable interrupt for 16-bit cards */ #define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 /* Prefetch enable for both memory regions */ #define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200 #define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400 #define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40 #define PCI_CB_SUBSYSTEM_ID 0x42 #define PCI_CB_LEGACY_MODE_BASE 0x44 /* 16-bit PC Card legacy mode base address (ExCa) */ /* 0x48-0x7f reserved */ /* Capability lists */ #define PCI_CAP_LIST_ID 0 /* Capability ID */ #define PCI_CAP_ID_PM 0x01 /* Power Management */ #define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */ #define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */ #define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */ #define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ #define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ #define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ #define PCI_CAP_ID_HT 0x08 /* HyperTransport */ #define PCI_CAP_ID_VNDR 0x09 /* Vendor-Specific */ #define PCI_CAP_ID_DBG 0x0A /* Debug port */ #define PCI_CAP_ID_CCRC 0x0B /* CompactPCI Central Resource Control */ #define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ #define PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */ #define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */ #define PCI_CAP_ID_SECDEV 0x0F /* Secure Device */ #define PCI_CAP_ID_EXP 0x10 /* PCI Express */ #define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ #define PCI_CAP_ID_SATA 0x12 /* SATA Data/Index Conf. */ #define PCI_CAP_ID_AF 0x13 /* PCI Advanced Features */ #define PCI_CAP_ID_EA 0x14 /* PCI Enhanced Allocation */ #define PCI_CAP_ID_MAX PCI_CAP_ID_EA #define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ #define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */ #define PCI_CAP_SIZEOF 4 /* Power Management Registers */ #define PCI_PM_PMC 2 /* PM Capabilities Register */ #define PCI_PM_CAP_VER_MASK 0x0007 /* Version */ #define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */ #define PCI_PM_CAP_RESERVED 0x0010 /* Reserved field */ #define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */ #define PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxiliary power support mask */ #define PCI_PM_CAP_D1 0x0200 /* D1 power state support */ #define PCI_PM_CAP_D2 0x0400 /* D2 power state support */ #define PCI_PM_CAP_PME 0x0800 /* PME pin supported */ #define PCI_PM_CAP_PME_MASK 0xF800 /* PME Mask of all supported states */ #define PCI_PM_CAP_PME_D0 0x0800 /* PME# from D0 */ #define PCI_PM_CAP_PME_D1 0x1000 /* PME# from D1 */ #define PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */ #define PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */ #define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */ #define PCI_PM_CAP_PME_SHIFT 11 /* Start of the PME Mask in PMC */ #define PCI_PM_CTRL 4 /* PM control and status register */ #define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ #define PCI_PM_CTRL_NO_SOFT_RESET 0x0008 /* No reset for D3hot->D0 */ #define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */ #define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */ #define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */ #define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */ #define PCI_PM_PPB_EXTENSIONS 6 /* PPB support extensions (??) */ #define PCI_PM_PPB_B2_B3 0x40 /* Stop clock when in D3hot (??) */ #define PCI_PM_BPCC_ENABLE 0x80 /* Bus power/clock control enable (??) */ #define PCI_PM_DATA_REGISTER 7 /* (??) */ #define PCI_PM_SIZEOF 8 /* AGP registers */ #define PCI_AGP_VERSION 2 /* BCD version number */ #define PCI_AGP_RFU 3 /* Rest of capability flags */ #define PCI_AGP_STATUS 4 /* Status register */ #define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */ #define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */ #define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing supported */ #define PCI_AGP_STATUS_FW 0x0010 /* FW transfers supported */ #define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported */ #define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported */ #define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported */ #define PCI_AGP_COMMAND 8 /* Control register */ #define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */ #define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */ #define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */ #define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */ #define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */ #define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */ #define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */ #define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */ #define PCI_AGP_SIZEOF 12 /* Vital Product Data */ #define PCI_VPD_ADDR 2 /* Address to access (15 bits!) */ #define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */ #define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */ #define PCI_VPD_DATA 4 /* 32-bits of data returned here */ #define PCI_CAP_VPD_SIZEOF 8 /* Slot Identification */ #define PCI_SID_ESR 2 /* Expansion Slot Register */ #define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */ #define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */ #define PCI_SID_CHASSIS_NR 3 /* Chassis Number */ /* Message Signalled Interrupts registers */ #define PCI_MSI_FLAGS 2 /* Message Control */ #define PCI_MSI_FLAGS_ENABLE 0x0001 /* MSI feature enabled */ #define PCI_MSI_FLAGS_QMASK 0x000e /* Maximum queue size available */ #define PCI_MSI_FLAGS_QSIZE 0x0070 /* Message queue size configured */ #define PCI_MSI_FLAGS_64BIT 0x0080 /* 64-bit addresses allowed */ #define PCI_MSI_FLAGS_MASKBIT 0x0100 /* Per-vector masking capable */ #define PCI_MSI_RFU 3 /* Rest of capability flags */ #define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */ #define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ #define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */ #define PCI_MSI_MASK_32 12 /* Mask bits register for 32-bit devices */ #define PCI_MSI_PENDING_32 16 /* Pending intrs for 32-bit devices */ #define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ #define PCI_MSI_MASK_64 16 /* Mask bits register for 64-bit devices */ #define PCI_MSI_PENDING_64 20 /* Pending intrs for 64-bit devices */ /* MSI-X registers */ #define PCI_MSIX_FLAGS 2 /* Message Control */ #define PCI_MSIX_FLAGS_QSIZE 0x07FF /* Table size */ #define PCI_MSIX_FLAGS_MASKALL 0x4000 /* Mask all vectors for this function */ #define PCI_MSIX_FLAGS_ENABLE 0x8000 /* MSI-X enable */ #define PCI_MSIX_TABLE 4 /* Table offset */ #define PCI_MSIX_TABLE_BIR 0x00000007 /* BAR index */ #define PCI_MSIX_TABLE_OFFSET 0xfffffff8 /* Offset into specified BAR */ #define PCI_MSIX_PBA 8 /* Pending Bit Array offset */ #define PCI_MSIX_PBA_BIR 0x00000007 /* BAR index */ #define PCI_MSIX_PBA_OFFSET 0xfffffff8 /* Offset into specified BAR */ #define PCI_MSIX_FLAGS_BIRMASK PCI_MSIX_PBA_BIR /* deprecated */ #define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */ /* MSI-X Table entry format */ #define PCI_MSIX_ENTRY_SIZE 16 #define PCI_MSIX_ENTRY_LOWER_ADDR 0 #define PCI_MSIX_ENTRY_UPPER_ADDR 4 #define PCI_MSIX_ENTRY_DATA 8 #define PCI_MSIX_ENTRY_VECTOR_CTRL 12 #define PCI_MSIX_ENTRY_CTRL_MASKBIT 1 /* CompactPCI Hotswap Register */ #define PCI_CHSWP_CSR 2 /* Control and Status Register */ #define PCI_CHSWP_DHA 0x01 /* Device Hiding Arm */ #define PCI_CHSWP_EIM 0x02 /* ENUM# Signal Mask */ #define PCI_CHSWP_PIE 0x04 /* Pending Insert or Extract */ #define PCI_CHSWP_LOO 0x08 /* LED On / Off */ #define PCI_CHSWP_PI 0x30 /* Programming Interface */ #define PCI_CHSWP_EXT 0x40 /* ENUM# status - extraction */ #define PCI_CHSWP_INS 0x80 /* ENUM# status - insertion */ /* PCI Advanced Feature registers */ #define PCI_AF_LENGTH 2 #define PCI_AF_CAP 3 #define PCI_AF_CAP_TP 0x01 #define PCI_AF_CAP_FLR 0x02 #define PCI_AF_CTRL 4 #define PCI_AF_CTRL_FLR 0x01 #define PCI_AF_STATUS 5 #define PCI_AF_STATUS_TP 0x01 #define PCI_CAP_AF_SIZEOF 6 /* size of AF registers */ /* PCI Enhanced Allocation registers */ #define PCI_EA_NUM_ENT 2 /* Number of Capability Entries */ #define PCI_EA_NUM_ENT_MASK 0x3f /* Num Entries Mask */ #define PCI_EA_FIRST_ENT 4 /* First EA Entry in List */ #define PCI_EA_FIRST_ENT_BRIDGE 8 /* First EA Entry for Bridges */ #define PCI_EA_ES 0x00000007 /* Entry Size */ #define PCI_EA_BEI 0x000000f0 /* BAR Equivalent Indicator */ /* 0-5 map to BARs 0-5 respectively */ #define PCI_EA_BEI_BAR0 0 #define PCI_EA_BEI_BAR5 5 #define PCI_EA_BEI_BRIDGE 6 /* Resource behind bridge */ #define PCI_EA_BEI_ENI 7 /* Equivalent Not Indicated */ #define PCI_EA_BEI_ROM 8 /* Expansion ROM */ /* 9-14 map to VF BARs 0-5 respectively */ #define PCI_EA_BEI_VF_BAR0 9 #define PCI_EA_BEI_VF_BAR5 14 #define PCI_EA_BEI_RESERVED 15 /* Reserved - Treat like ENI */ #define PCI_EA_PP 0x0000ff00 /* Primary Properties */ #define PCI_EA_SP 0x00ff0000 /* Secondary Properties */ #define PCI_EA_P_MEM 0x00 /* Non-Prefetch Memory */ #define PCI_EA_P_MEM_PREFETCH 0x01 /* Prefetchable Memory */ #define PCI_EA_P_IO 0x02 /* I/O Space */ #define PCI_EA_P_VF_MEM_PREFETCH 0x03 /* VF Prefetchable Memory */ #define PCI_EA_P_VF_MEM 0x04 /* VF Non-Prefetch Memory */ #define PCI_EA_P_BRIDGE_MEM 0x05 /* Bridge Non-Prefetch Memory */ #define PCI_EA_P_BRIDGE_MEM_PREFETCH 0x06 /* Bridge Prefetchable Memory */ #define PCI_EA_P_BRIDGE_IO 0x07 /* Bridge I/O Space */ /* 0x08-0xfc reserved */ #define PCI_EA_P_MEM_RESERVED 0xfd /* Reserved Memory */ #define PCI_EA_P_IO_RESERVED 0xfe /* Reserved I/O Space */ #define PCI_EA_P_UNAVAILABLE 0xff /* Entry Unavailable */ #define PCI_EA_WRITABLE 0x40000000 /* Writable: 1 = RW, 0 = HwInit */ #define PCI_EA_ENABLE 0x80000000 /* Enable for this entry */ #define PCI_EA_BASE 4 /* Base Address Offset */ #define PCI_EA_MAX_OFFSET 8 /* MaxOffset (resource length) */ /* bit 0 is reserved */ #define PCI_EA_IS_64 0x00000002 /* 64-bit field flag */ #define PCI_EA_FIELD_MASK 0xfffffffc /* For Base & Max Offset */ /* PCI-X registers (Type 0 (non-bridge) devices) */ #define PCI_X_CMD 2 /* Modes & Features */ #define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */ #define PCI_X_CMD_ERO 0x0002 /* Enable Relaxed Ordering */ #define PCI_X_CMD_READ_512 0x0000 /* 512 byte maximum read byte count */ #define PCI_X_CMD_READ_1K 0x0004 /* 1Kbyte maximum read byte count */ #define PCI_X_CMD_READ_2K 0x0008 /* 2Kbyte maximum read byte count */ #define PCI_X_CMD_READ_4K 0x000c /* 4Kbyte maximum read byte count */ #define PCI_X_CMD_MAX_READ 0x000c /* Max Memory Read Byte Count */ /* Max # of outstanding split transactions */ #define PCI_X_CMD_SPLIT_1 0x0000 /* Max 1 */ #define PCI_X_CMD_SPLIT_2 0x0010 /* Max 2 */ #define PCI_X_CMD_SPLIT_3 0x0020 /* Max 3 */ #define PCI_X_CMD_SPLIT_4 0x0030 /* Max 4 */ #define PCI_X_CMD_SPLIT_8 0x0040 /* Max 8 */ #define PCI_X_CMD_SPLIT_12 0x0050 /* Max 12 */ #define PCI_X_CMD_SPLIT_16 0x0060 /* Max 16 */ #define PCI_X_CMD_SPLIT_32 0x0070 /* Max 32 */ #define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */ #define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */ #define PCI_X_STATUS 4 /* PCI-X capabilities */ #define PCI_X_STATUS_DEVFN 0x000000ff /* A copy of devfn */ #define PCI_X_STATUS_BUS 0x0000ff00 /* A copy of bus nr */ #define PCI_X_STATUS_64BIT 0x00010000 /* 64-bit device */ #define PCI_X_STATUS_133MHZ 0x00020000 /* 133 MHz capable */ #define PCI_X_STATUS_SPL_DISC 0x00040000 /* Split Completion Discarded */ #define PCI_X_STATUS_UNX_SPL 0x00080000 /* Unexpected Split Completion */ #define PCI_X_STATUS_COMPLEX 0x00100000 /* Device Complexity */ #define PCI_X_STATUS_MAX_READ 0x00600000 /* Designed Max Memory Read Count */ #define PCI_X_STATUS_MAX_SPLIT 0x03800000 /* Designed Max Outstanding Split Transactions */ #define PCI_X_STATUS_MAX_CUM 0x1c000000 /* Designed Max Cumulative Read Size */ #define PCI_X_STATUS_SPL_ERR 0x20000000 /* Rcvd Split Completion Error Msg */ #define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ #define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ #define PCI_X_ECC_CSR 8 /* ECC control and status */ #define PCI_CAP_PCIX_SIZEOF_V0 8 /* size of registers for Version 0 */ #define PCI_CAP_PCIX_SIZEOF_V1 24 /* size for Version 1 */ #define PCI_CAP_PCIX_SIZEOF_V2 PCI_CAP_PCIX_SIZEOF_V1 /* Same for v2 */ /* PCI-X registers (Type 1 (bridge) devices) */ #define PCI_X_BRIDGE_SSTATUS 2 /* Secondary Status */ #define PCI_X_SSTATUS_64BIT 0x0001 /* Secondary AD interface is 64 bits */ #define PCI_X_SSTATUS_133MHZ 0x0002 /* 133 MHz capable */ #define PCI_X_SSTATUS_FREQ 0x03c0 /* Secondary Bus Mode and Frequency */ #define PCI_X_SSTATUS_VERS 0x3000 /* PCI-X Capability Version */ #define PCI_X_SSTATUS_V1 0x1000 /* Mode 2, not Mode 1 */ #define PCI_X_SSTATUS_V2 0x2000 /* Mode 1 or Modes 1 and 2 */ #define PCI_X_SSTATUS_266MHZ 0x4000 /* 266 MHz capable */ #define PCI_X_SSTATUS_533MHZ 0x8000 /* 533 MHz capable */ #define PCI_X_BRIDGE_STATUS 4 /* Bridge Status */ /* PCI Bridge Subsystem ID registers */ #define PCI_SSVID_VENDOR_ID 4 /* PCI Bridge subsystem vendor ID */ #define PCI_SSVID_DEVICE_ID 6 /* PCI Bridge subsystem device ID */ /* PCI Express capability registers */ #define PCI_EXP_FLAGS 2 /* Capabilities register */ #define PCI_EXP_FLAGS_VERS 0x000f /* Capability version */ #define PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */ #define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */ #define PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */ #define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */ #define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ #define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ #define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCIe to PCI/PCI-X Bridge */ #define PCI_EXP_TYPE_PCIE_BRIDGE 0x8 /* PCI/PCI-X to PCIe Bridge */ #define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */ #define PCI_EXP_TYPE_RC_EC 0xa /* Root Complex Event Collector */ #define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ #define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ #define PCI_EXP_DEVCAP 4 /* Device capabilities */ #define PCI_EXP_DEVCAP_PAYLOAD 0x00000007 /* Max_Payload_Size */ #define PCI_EXP_DEVCAP_PHANTOM 0x00000018 /* Phantom functions */ #define PCI_EXP_DEVCAP_EXT_TAG 0x00000020 /* Extended tags */ #define PCI_EXP_DEVCAP_L0S 0x000001c0 /* L0s Acceptable Latency */ #define PCI_EXP_DEVCAP_L1 0x00000e00 /* L1 Acceptable Latency */ #define PCI_EXP_DEVCAP_ATN_BUT 0x00001000 /* Attention Button Present */ #define PCI_EXP_DEVCAP_ATN_IND 0x00002000 /* Attention Indicator Present */ #define PCI_EXP_DEVCAP_PWR_IND 0x00004000 /* Power Indicator Present */ #define PCI_EXP_DEVCAP_RBER 0x00008000 /* Role-Based Error Reporting */ #define PCI_EXP_DEVCAP_PWR_VAL 0x03fc0000 /* Slot Power Limit Value */ #define PCI_EXP_DEVCAP_PWR_SCL 0x0c000000 /* Slot Power Limit Scale */ #define PCI_EXP_DEVCAP_FLR 0x10000000 /* Function Level Reset */ #define PCI_EXP_DEVCTL 8 /* Device Control */ #define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */ #define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */ #define PCI_EXP_DEVCTL_FERE 0x0004 /* Fatal Error Reporting Enable */ #define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */ #define PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */ #define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */ #define PCI_EXP_DEVCTL_PAYLOAD_128B 0x0000 /* 128 Bytes */ #define PCI_EXP_DEVCTL_PAYLOAD_256B 0x0020 /* 256 Bytes */ #define PCI_EXP_DEVCTL_PAYLOAD_512B 0x0040 /* 512 Bytes */ #define PCI_EXP_DEVCTL_PAYLOAD_1024B 0x0060 /* 1024 Bytes */ #define PCI_EXP_DEVCTL_PAYLOAD_2048B 0x0080 /* 2048 Bytes */ #define PCI_EXP_DEVCTL_PAYLOAD_4096B 0x00a0 /* 4096 Bytes */ #define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */ #define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */ #define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ #define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */ #define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ #define PCI_EXP_DEVCTL_READRQ_128B 0x0000 /* 128 Bytes */ #define PCI_EXP_DEVCTL_READRQ_256B 0x1000 /* 256 Bytes */ #define PCI_EXP_DEVCTL_READRQ_512B 0x2000 /* 512 Bytes */ #define PCI_EXP_DEVCTL_READRQ_1024B 0x3000 /* 1024 Bytes */ #define PCI_EXP_DEVCTL_READRQ_2048B 0x4000 /* 2048 Bytes */ #define PCI_EXP_DEVCTL_READRQ_4096B 0x5000 /* 4096 Bytes */ #define PCI_EXP_DEVCTL_BCR_FLR 0x8000 /* Bridge Configuration Retry / FLR */ #define PCI_EXP_DEVSTA 10 /* Device Status */ #define PCI_EXP_DEVSTA_CED 0x0001 /* Correctable Error Detected */ #define PCI_EXP_DEVSTA_NFED 0x0002 /* Non-Fatal Error Detected */ #define PCI_EXP_DEVSTA_FED 0x0004 /* Fatal Error Detected */ #define PCI_EXP_DEVSTA_URD 0x0008 /* Unsupported Request Detected */ #define PCI_EXP_DEVSTA_AUXPD 0x0010 /* AUX Power Detected */ #define PCI_EXP_DEVSTA_TRPND 0x0020 /* Transactions Pending */ #define PCI_CAP_EXP_RC_ENDPOINT_SIZEOF_V1 12 /* v1 endpoints without link end here */ #define PCI_EXP_LNKCAP 12 /* Link Capabilities */ #define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */ #define PCI_EXP_LNKCAP_SLS_2_5GB 0x00000001 /* LNKCAP2 SLS Vector bit 0 */ #define PCI_EXP_LNKCAP_SLS_5_0GB 0x00000002 /* LNKCAP2 SLS Vector bit 1 */ #define PCI_EXP_LNKCAP_SLS_8_0GB 0x00000003 /* LNKCAP2 SLS Vector bit 2 */ #define PCI_EXP_LNKCAP_SLS_16_0GB 0x00000004 /* LNKCAP2 SLS Vector bit 3 */ #define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */ #define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */ #define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */ #define PCI_EXP_LNKCAP_L1EL 0x00038000 /* L1 Exit Latency */ #define PCI_EXP_LNKCAP_CLKPM 0x00040000 /* Clock Power Management */ #define PCI_EXP_LNKCAP_SDERC 0x00080000 /* Surprise Down Error Reporting Capable */ #define PCI_EXP_LNKCAP_DLLLARC 0x00100000 /* Data Link Layer Link Active Reporting Capable */ #define PCI_EXP_LNKCAP_LBNC 0x00200000 /* Link Bandwidth Notification Capability */ #define PCI_EXP_LNKCAP_PN 0xff000000 /* Port Number */ #define PCI_EXP_LNKCTL 16 /* Link Control */ #define PCI_EXP_LNKCTL_ASPMC 0x0003 /* ASPM Control */ #define PCI_EXP_LNKCTL_ASPM_L0S 0x0001 /* L0s Enable */ #define PCI_EXP_LNKCTL_ASPM_L1 0x0002 /* L1 Enable */ #define PCI_EXP_LNKCTL_RCB 0x0008 /* Read Completion Boundary */ #define PCI_EXP_LNKCTL_LD 0x0010 /* Link Disable */ #define PCI_EXP_LNKCTL_RL 0x0020 /* Retrain Link */ #define PCI_EXP_LNKCTL_CCC 0x0040 /* Common Clock Configuration */ #define PCI_EXP_LNKCTL_ES 0x0080 /* Extended Synch */ #define PCI_EXP_LNKCTL_CLKREQ_EN 0x0100 /* Enable clkreq */ #define PCI_EXP_LNKCTL_HAWD 0x0200 /* Hardware Autonomous Width Disable */ #define PCI_EXP_LNKCTL_LBMIE 0x0400 /* Link Bandwidth Management Interrupt Enable */ #define PCI_EXP_LNKCTL_LABIE 0x0800 /* Link Autonomous Bandwidth Interrupt Enable */ #define PCI_EXP_LNKSTA 18 /* Link Status */ #define PCI_EXP_LNKSTA_CLS 0x000f /* Current Link Speed */ #define PCI_EXP_LNKSTA_CLS_2_5GB 0x0001 /* Current Link Speed 2.5GT/s */ #define PCI_EXP_LNKSTA_CLS_5_0GB 0x0002 /* Current Link Speed 5.0GT/s */ #define PCI_EXP_LNKSTA_CLS_8_0GB 0x0003 /* Current Link Speed 8.0GT/s */ #define PCI_EXP_LNKSTA_CLS_16_0GB 0x0004 /* Current Link Speed 16.0GT/s */ #define PCI_EXP_LNKSTA_NLW 0x03f0 /* Negotiated Link Width */ #define PCI_EXP_LNKSTA_NLW_X1 0x0010 /* Current Link Width x1 */ #define PCI_EXP_LNKSTA_NLW_X2 0x0020 /* Current Link Width x2 */ #define PCI_EXP_LNKSTA_NLW_X4 0x0040 /* Current Link Width x4 */ #define PCI_EXP_LNKSTA_NLW_X8 0x0080 /* Current Link Width x8 */ #define PCI_EXP_LNKSTA_NLW_SHIFT 4 /* start of NLW mask in link status */ #define PCI_EXP_LNKSTA_LT 0x0800 /* Link Training */ #define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */ #define PCI_EXP_LNKSTA_DLLLA 0x2000 /* Data Link Layer Link Active */ #define PCI_EXP_LNKSTA_LBMS 0x4000 /* Link Bandwidth Management Status */ #define PCI_EXP_LNKSTA_LABS 0x8000 /* Link Autonomous Bandwidth Status */ #define PCI_CAP_EXP_ENDPOINT_SIZEOF_V1 20 /* v1 endpoints with link end here */ #define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ #define PCI_EXP_SLTCAP_ABP 0x00000001 /* Attention Button Present */ #define PCI_EXP_SLTCAP_PCP 0x00000002 /* Power Controller Present */ #define PCI_EXP_SLTCAP_MRLSP 0x00000004 /* MRL Sensor Present */ #define PCI_EXP_SLTCAP_AIP 0x00000008 /* Attention Indicator Present */ #define PCI_EXP_SLTCAP_PIP 0x00000010 /* Power Indicator Present */ #define PCI_EXP_SLTCAP_HPS 0x00000020 /* Hot-Plug Surprise */ #define PCI_EXP_SLTCAP_HPC 0x00000040 /* Hot-Plug Capable */ #define PCI_EXP_SLTCAP_SPLV 0x00007f80 /* Slot Power Limit Value */ #define PCI_EXP_SLTCAP_SPLS 0x00018000 /* Slot Power Limit Scale */ #define PCI_EXP_SLTCAP_EIP 0x00020000 /* Electromechanical Interlock Present */ #define PCI_EXP_SLTCAP_NCCS 0x00040000 /* No Command Completed Support */ #define PCI_EXP_SLTCAP_PSN 0xfff80000 /* Physical Slot Number */ #define PCI_EXP_SLTCTL 24 /* Slot Control */ #define PCI_EXP_SLTCTL_ABPE 0x0001 /* Attention Button Pressed Enable */ #define PCI_EXP_SLTCTL_PFDE 0x0002 /* Power Fault Detected Enable */ #define PCI_EXP_SLTCTL_MRLSCE 0x0004 /* MRL Sensor Changed Enable */ #define PCI_EXP_SLTCTL_PDCE 0x0008 /* Presence Detect Changed Enable */ #define PCI_EXP_SLTCTL_CCIE 0x0010 /* Command Completed Interrupt Enable */ #define PCI_EXP_SLTCTL_HPIE 0x0020 /* Hot-Plug Interrupt Enable */ #define PCI_EXP_SLTCTL_AIC 0x00c0 /* Attention Indicator Control */ #define PCI_EXP_SLTCTL_ATTN_IND_ON 0x0040 /* Attention Indicator on */ #define PCI_EXP_SLTCTL_ATTN_IND_BLINK 0x0080 /* Attention Indicator blinking */ #define PCI_EXP_SLTCTL_ATTN_IND_OFF 0x00c0 /* Attention Indicator off */ #define PCI_EXP_SLTCTL_PIC 0x0300 /* Power Indicator Control */ #define PCI_EXP_SLTCTL_PWR_IND_ON 0x0100 /* Power Indicator on */ #define PCI_EXP_SLTCTL_PWR_IND_BLINK 0x0200 /* Power Indicator blinking */ #define PCI_EXP_SLTCTL_PWR_IND_OFF 0x0300 /* Power Indicator off */ #define PCI_EXP_SLTCTL_PCC 0x0400 /* Power Controller Control */ #define PCI_EXP_SLTCTL_PWR_ON 0x0000 /* Power On */ #define PCI_EXP_SLTCTL_PWR_OFF 0x0400 /* Power Off */ #define PCI_EXP_SLTCTL_EIC 0x0800 /* Electromechanical Interlock Control */ #define PCI_EXP_SLTCTL_DLLSCE 0x1000 /* Data Link Layer State Changed Enable */ #define PCI_EXP_SLTSTA 26 /* Slot Status */ #define PCI_EXP_SLTSTA_ABP 0x0001 /* Attention Button Pressed */ #define PCI_EXP_SLTSTA_PFD 0x0002 /* Power Fault Detected */ #define PCI_EXP_SLTSTA_MRLSC 0x0004 /* MRL Sensor Changed */ #define PCI_EXP_SLTSTA_PDC 0x0008 /* Presence Detect Changed */ #define PCI_EXP_SLTSTA_CC 0x0010 /* Command Completed */ #define PCI_EXP_SLTSTA_MRLSS 0x0020 /* MRL Sensor State */ #define PCI_EXP_SLTSTA_PDS 0x0040 /* Presence Detect State */ #define PCI_EXP_SLTSTA_EIS 0x0080 /* Electromechanical Interlock Status */ #define PCI_EXP_SLTSTA_DLLSC 0x0100 /* Data Link Layer State Changed */ #define PCI_EXP_RTCTL 28 /* Root Control */ #define PCI_EXP_RTCTL_SECEE 0x0001 /* System Error on Correctable Error */ #define PCI_EXP_RTCTL_SENFEE 0x0002 /* System Error on Non-Fatal Error */ #define PCI_EXP_RTCTL_SEFEE 0x0004 /* System Error on Fatal Error */ #define PCI_EXP_RTCTL_PMEIE 0x0008 /* PME Interrupt Enable */ #define PCI_EXP_RTCTL_CRSSVE 0x0010 /* CRS Software Visibility Enable */ #define PCI_EXP_RTCAP 30 /* Root Capabilities */ #define PCI_EXP_RTCAP_CRSVIS 0x0001 /* CRS Software Visibility capability */ #define PCI_EXP_RTSTA 32 /* Root Status */ #define PCI_EXP_RTSTA_PME 0x00010000 /* PME status */ #define PCI_EXP_RTSTA_PENDING 0x00020000 /* PME pending */ /* * The Device Capabilities 2, Device Status 2, Device Control 2, * Link Capabilities 2, Link Status 2, Link Control 2, * Slot Capabilities 2, Slot Status 2, and Slot Control 2 registers * are only present on devices with PCIe Capability version 2. * Use pcie_capability_read_word() and similar interfaces to use them * safely. */ #define PCI_EXP_DEVCAP2 36 /* Device Capabilities 2 */ #define PCI_EXP_DEVCAP2_COMP_TMOUT_DIS 0x00000010 /* Completion Timeout Disable supported */ #define PCI_EXP_DEVCAP2_ARI 0x00000020 /* Alternative Routing-ID */ #define PCI_EXP_DEVCAP2_ATOMIC_ROUTE 0x00000040 /* Atomic Op routing */ #define PCI_EXP_DEVCAP2_ATOMIC_COMP32 0x00000080 /* 32b AtomicOp completion */ #define PCI_EXP_DEVCAP2_ATOMIC_COMP64 0x00000100 /* 64b AtomicOp completion */ #define PCI_EXP_DEVCAP2_ATOMIC_COMP128 0x00000200 /* 128b AtomicOp completion */ #define PCI_EXP_DEVCAP2_LTR 0x00000800 /* Latency tolerance reporting */ #define PCI_EXP_DEVCAP2_OBFF_MASK 0x000c0000 /* OBFF support mechanism */ #define PCI_EXP_DEVCAP2_OBFF_MSG 0x00040000 /* New message signaling */ #define PCI_EXP_DEVCAP2_OBFF_WAKE 0x00080000 /* Re-use WAKE# for OBFF */ #define PCI_EXP_DEVCAP2_EE_PREFIX 0x00200000 /* End-End TLP Prefix */ #define PCI_EXP_DEVCTL2 40 /* Device Control 2 */ #define PCI_EXP_DEVCTL2_COMP_TIMEOUT 0x000f /* Completion Timeout Value */ #define PCI_EXP_DEVCTL2_COMP_TMOUT_DIS 0x0010 /* Completion Timeout Disable */ #define PCI_EXP_DEVCTL2_ARI 0x0020 /* Alternative Routing-ID */ #define PCI_EXP_DEVCTL2_ATOMIC_REQ 0x0040 /* Set Atomic requests */ #define PCI_EXP_DEVCTL2_ATOMIC_EGRESS_BLOCK 0x0080 /* Block atomic egress */ #define PCI_EXP_DEVCTL2_IDO_REQ_EN 0x0100 /* Allow IDO for requests */ #define PCI_EXP_DEVCTL2_IDO_CMP_EN 0x0200 /* Allow IDO for completions */ #define PCI_EXP_DEVCTL2_LTR_EN 0x0400 /* Enable LTR mechanism */ #define PCI_EXP_DEVCTL2_OBFF_MSGA_EN 0x2000 /* Enable OBFF Message type A */ #define PCI_EXP_DEVCTL2_OBFF_MSGB_EN 0x4000 /* Enable OBFF Message type B */ #define PCI_EXP_DEVCTL2_OBFF_WAKE_EN 0x6000 /* OBFF using WAKE# signaling */ #define PCI_EXP_DEVSTA2 42 /* Device Status 2 */ #define PCI_CAP_EXP_RC_ENDPOINT_SIZEOF_V2 44 /* v2 endpoints without link end here */ #define PCI_EXP_LNKCAP2 44 /* Link Capabilities 2 */ #define PCI_EXP_LNKCAP2_SLS_2_5GB 0x00000002 /* Supported Speed 2.5GT/s */ #define PCI_EXP_LNKCAP2_SLS_5_0GB 0x00000004 /* Supported Speed 5GT/s */ #define PCI_EXP_LNKCAP2_SLS_8_0GB 0x00000008 /* Supported Speed 8GT/s */ #define PCI_EXP_LNKCAP2_SLS_16_0GB 0x00000010 /* Supported Speed 16GT/s */ #define PCI_EXP_LNKCAP2_CROSSLINK 0x00000100 /* Crosslink supported */ #define PCI_EXP_LNKCTL2 48 /* Link Control 2 */ #define PCI_EXP_LNKCTL2_TLS 0x000f #define PCI_EXP_LNKCTL2_TLS_2_5GT 0x0001 /* Supported Speed 2.5GT/s */ #define PCI_EXP_LNKCTL2_TLS_5_0GT 0x0002 /* Supported Speed 5GT/s */ #define PCI_EXP_LNKCTL2_TLS_8_0GT 0x0003 /* Supported Speed 8GT/s */ #define PCI_EXP_LNKCTL2_TLS_16_0GT 0x0004 /* Supported Speed 16GT/s */ #define PCI_EXP_LNKSTA2 50 /* Link Status 2 */ #define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 52 /* v2 endpoints with link end here */ #define PCI_EXP_SLTCAP2 52 /* Slot Capabilities 2 */ #define PCI_EXP_SLTCTL2 56 /* Slot Control 2 */ #define PCI_EXP_SLTSTA2 58 /* Slot Status 2 */ /* Extended Capabilities (PCI-X 2.0 and Express) */ #define PCI_EXT_CAP_ID(header) (header & 0x0000ffff) #define PCI_EXT_CAP_VER(header) ((header >> 16) & 0xf) #define PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc) #define PCI_EXT_CAP_ID_ERR 0x01 /* Advanced Error Reporting */ #define PCI_EXT_CAP_ID_VC 0x02 /* Virtual Channel Capability */ #define PCI_EXT_CAP_ID_DSN 0x03 /* Device Serial Number */ #define PCI_EXT_CAP_ID_PWR 0x04 /* Power Budgeting */ #define PCI_EXT_CAP_ID_RCLD 0x05 /* Root Complex Link Declaration */ #define PCI_EXT_CAP_ID_RCILC 0x06 /* Root Complex Internal Link Control */ #define PCI_EXT_CAP_ID_RCEC 0x07 /* Root Complex Event Collector */ #define PCI_EXT_CAP_ID_MFVC 0x08 /* Multi-Function VC Capability */ #define PCI_EXT_CAP_ID_VC9 0x09 /* same as _VC */ #define PCI_EXT_CAP_ID_RCRB 0x0A /* Root Complex RB? */ #define PCI_EXT_CAP_ID_VNDR 0x0B /* Vendor-Specific */ #define PCI_EXT_CAP_ID_CAC 0x0C /* Config Access - obsolete */ #define PCI_EXT_CAP_ID_ACS 0x0D /* Access Control Services */ #define PCI_EXT_CAP_ID_ARI 0x0E /* Alternate Routing ID */ #define PCI_EXT_CAP_ID_ATS 0x0F /* Address Translation Services */ #define PCI_EXT_CAP_ID_SRIOV 0x10 /* Single Root I/O Virtualization */ #define PCI_EXT_CAP_ID_MRIOV 0x11 /* Multi Root I/O Virtualization */ #define PCI_EXT_CAP_ID_MCAST 0x12 /* Multicast */ #define PCI_EXT_CAP_ID_PRI 0x13 /* Page Request Interface */ #define PCI_EXT_CAP_ID_AMD_XXX 0x14 /* Reserved for AMD */ #define PCI_EXT_CAP_ID_REBAR 0x15 /* Resizable BAR */ #define PCI_EXT_CAP_ID_DPA 0x16 /* Dynamic Power Allocation */ #define PCI_EXT_CAP_ID_TPH 0x17 /* TPH Requester */ #define PCI_EXT_CAP_ID_LTR 0x18 /* Latency Tolerance Reporting */ #define PCI_EXT_CAP_ID_SECPCI 0x19 /* Secondary PCIe Capability */ #define PCI_EXT_CAP_ID_PMUX 0x1A /* Protocol Multiplexing */ #define PCI_EXT_CAP_ID_PASID 0x1B /* Process Address Space ID */ #define PCI_EXT_CAP_ID_DPC 0x1D /* Downstream Port Containment */ #define PCI_EXT_CAP_ID_L1SS 0x1E /* L1 PM Substates */ #define PCI_EXT_CAP_ID_PTM 0x1F /* Precision Time Measurement */ #define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PTM #define PCI_EXT_CAP_DSN_SIZEOF 12 #define PCI_EXT_CAP_MCAST_ENDPOINT_SIZEOF 40 /* Advanced Error Reporting */ #define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ #define PCI_ERR_UNC_UND 0x00000001 /* Undefined */ #define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */ #define PCI_ERR_UNC_SURPDN 0x00000020 /* Surprise Down */ #define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */ #define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */ #define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */ #define PCI_ERR_UNC_COMP_ABORT 0x00008000 /* Completer Abort */ #define PCI_ERR_UNC_UNX_COMP 0x00010000 /* Unexpected Completion */ #define PCI_ERR_UNC_RX_OVER 0x00020000 /* Receiver Overflow */ #define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */ #define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */ #define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */ #define PCI_ERR_UNC_ACSV 0x00200000 /* ACS Violation */ #define PCI_ERR_UNC_INTN 0x00400000 /* internal error */ #define PCI_ERR_UNC_MCBTLP 0x00800000 /* MC blocked TLP */ #define PCI_ERR_UNC_ATOMEG 0x01000000 /* Atomic egress blocked */ #define PCI_ERR_UNC_TLPPRE 0x02000000 /* TLP prefix blocked */ #define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */ /* Same bits as above */ #define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */ /* Same bits as above */ #define PCI_ERR_COR_STATUS 16 /* Correctable Error Status */ #define PCI_ERR_COR_RCVR 0x00000001 /* Receiver Error Status */ #define PCI_ERR_COR_BAD_TLP 0x00000040 /* Bad TLP Status */ #define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */ #define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */ #define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */ #define PCI_ERR_COR_ADV_NFAT 0x00002000 /* Advisory Non-Fatal */ #define PCI_ERR_COR_INTERNAL 0x00004000 /* Corrected Internal */ #define PCI_ERR_COR_LOG_OVER 0x00008000 /* Header Log Overflow */ #define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */ /* Same bits as above */ #define PCI_ERR_CAP 24 /* Advanced Error Capabilities */ #define PCI_ERR_CAP_FEP(x) ((x) & 31) /* First Error Pointer */ #define PCI_ERR_CAP_ECRC_GENC 0x00000020 /* ECRC Generation Capable */ #define PCI_ERR_CAP_ECRC_GENE 0x00000040 /* ECRC Generation Enable */ #define PCI_ERR_CAP_ECRC_CHKC 0x00000080 /* ECRC Check Capable */ #define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */ #define PCI_ERR_HEADER_LOG 28 /* Header Log Register (16 bytes) */ #define PCI_ERR_ROOT_COMMAND 44 /* Root Error Command */ #define PCI_ERR_ROOT_CMD_COR_EN 0x00000001 /* Correctable Err Reporting Enable */ #define PCI_ERR_ROOT_CMD_NONFATAL_EN 0x00000002 /* Non-Fatal Err Reporting Enable */ #define PCI_ERR_ROOT_CMD_FATAL_EN 0x00000004 /* Fatal Err Reporting Enable */ #define PCI_ERR_ROOT_STATUS 48 #define PCI_ERR_ROOT_COR_RCV 0x00000001 /* ERR_COR Received */ #define PCI_ERR_ROOT_MULTI_COR_RCV 0x00000002 /* Multiple ERR_COR */ #define PCI_ERR_ROOT_UNCOR_RCV 0x00000004 /* ERR_FATAL/NONFATAL */ #define PCI_ERR_ROOT_MULTI_UNCOR_RCV 0x00000008 /* Multiple FATAL/NONFATAL */ #define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 /* First UNC is Fatal */ #define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */ #define PCI_ERR_ROOT_FATAL_RCV 0x00000040 /* Fatal Received */ #define PCI_ERR_ROOT_AER_IRQ 0xf8000000 /* Advanced Error Interrupt Message Number */ #define PCI_ERR_ROOT_ERR_SRC 52 /* Error Source Identification */ /* Virtual Channel */ #define PCI_VC_PORT_CAP1 4 #define PCI_VC_CAP1_EVCC 0x00000007 /* extended VC count */ #define PCI_VC_CAP1_LPEVCC 0x00000070 /* low prio extended VC count */ #define PCI_VC_CAP1_ARB_SIZE 0x00000c00 #define PCI_VC_PORT_CAP2 8 #define PCI_VC_CAP2_32_PHASE 0x00000002 #define PCI_VC_CAP2_64_PHASE 0x00000004 #define PCI_VC_CAP2_128_PHASE 0x00000008 #define PCI_VC_CAP2_ARB_OFF 0xff000000 #define PCI_VC_PORT_CTRL 12 #define PCI_VC_PORT_CTRL_LOAD_TABLE 0x00000001 #define PCI_VC_PORT_STATUS 14 #define PCI_VC_PORT_STATUS_TABLE 0x00000001 #define PCI_VC_RES_CAP 16 #define PCI_VC_RES_CAP_32_PHASE 0x00000002 #define PCI_VC_RES_CAP_64_PHASE 0x00000004 #define PCI_VC_RES_CAP_128_PHASE 0x00000008 #define PCI_VC_RES_CAP_128_PHASE_TB 0x00000010 #define PCI_VC_RES_CAP_256_PHASE 0x00000020 #define PCI_VC_RES_CAP_ARB_OFF 0xff000000 #define PCI_VC_RES_CTRL 20 #define PCI_VC_RES_CTRL_LOAD_TABLE 0x00010000 #define PCI_VC_RES_CTRL_ARB_SELECT 0x000e0000 #define PCI_VC_RES_CTRL_ID 0x07000000 #define PCI_VC_RES_CTRL_ENABLE 0x80000000 #define PCI_VC_RES_STATUS 26 #define PCI_VC_RES_STATUS_TABLE 0x00000001 #define PCI_VC_RES_STATUS_NEGO 0x00000002 #define PCI_CAP_VC_BASE_SIZEOF 0x10 #define PCI_CAP_VC_PER_VC_SIZEOF 0x0C /* Power Budgeting */ #define PCI_PWR_DSR 4 /* Data Select Register */ #define PCI_PWR_DATA 8 /* Data Register */ #define PCI_PWR_DATA_BASE(x) ((x) & 0xff) /* Base Power */ #define PCI_PWR_DATA_SCALE(x) (((x) >> 8) & 3) /* Data Scale */ #define PCI_PWR_DATA_PM_SUB(x) (((x) >> 10) & 7) /* PM Sub State */ #define PCI_PWR_DATA_PM_STATE(x) (((x) >> 13) & 3) /* PM State */ #define PCI_PWR_DATA_TYPE(x) (((x) >> 15) & 7) /* Type */ #define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */ #define PCI_PWR_CAP 12 /* Capability */ #define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ #define PCI_EXT_CAP_PWR_SIZEOF 16 /* Vendor-Specific (VSEC, PCI_EXT_CAP_ID_VNDR) */ #define PCI_VNDR_HEADER 4 /* Vendor-Specific Header */ #define PCI_VNDR_HEADER_ID(x) ((x) & 0xffff) #define PCI_VNDR_HEADER_REV(x) (((x) >> 16) & 0xf) #define PCI_VNDR_HEADER_LEN(x) (((x) >> 20) & 0xfff) /* * HyperTransport sub capability types * * Unfortunately there are both 3 bit and 5 bit capability types defined * in the HT spec, catering for that is a little messy. You probably don't * want to use these directly, just use pci_find_ht_capability() and it * will do the right thing for you. */ #define HT_3BIT_CAP_MASK 0xE0 #define HT_CAPTYPE_SLAVE 0x00 /* Slave/Primary link configuration */ #define HT_CAPTYPE_HOST 0x20 /* Host/Secondary link configuration */ #define HT_5BIT_CAP_MASK 0xF8 #define HT_CAPTYPE_IRQ 0x80 /* IRQ Configuration */ #define HT_CAPTYPE_REMAPPING_40 0xA0 /* 40 bit address remapping */ #define HT_CAPTYPE_REMAPPING_64 0xA2 /* 64 bit address remapping */ #define HT_CAPTYPE_UNITID_CLUMP 0x90 /* Unit ID clumping */ #define HT_CAPTYPE_EXTCONF 0x98 /* Extended Configuration Space Access */ #define HT_CAPTYPE_MSI_MAPPING 0xA8 /* MSI Mapping Capability */ #define HT_MSI_FLAGS 0x02 /* Offset to flags */ #define HT_MSI_FLAGS_ENABLE 0x1 /* Mapping enable */ #define HT_MSI_FLAGS_FIXED 0x2 /* Fixed mapping only */ #define HT_MSI_FIXED_ADDR 0x00000000FEE00000ULL /* Fixed addr */ #define HT_MSI_ADDR_LO 0x04 /* Offset to low addr bits */ #define HT_MSI_ADDR_LO_MASK 0xFFF00000 /* Low address bit mask */ #define HT_MSI_ADDR_HI 0x08 /* Offset to high addr bits */ #define HT_CAPTYPE_DIRECT_ROUTE 0xB0 /* Direct routing configuration */ #define HT_CAPTYPE_VCSET 0xB8 /* Virtual Channel configuration */ #define HT_CAPTYPE_ERROR_RETRY 0xC0 /* Retry on error configuration */ #define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 HyperTransport configuration */ #define HT_CAPTYPE_PM 0xE0 /* HyperTransport power management configuration */ #define HT_CAP_SIZEOF_LONG 28 /* slave & primary */ #define HT_CAP_SIZEOF_SHORT 24 /* host & secondary */ /* Alternative Routing-ID Interpretation */ #define PCI_ARI_CAP 0x04 /* ARI Capability Register */ #define PCI_ARI_CAP_MFVC 0x0001 /* MFVC Function Groups Capability */ #define PCI_ARI_CAP_ACS 0x0002 /* ACS Function Groups Capability */ #define PCI_ARI_CAP_NFN(x) (((x) >> 8) & 0xff) /* Next Function Number */ #define PCI_ARI_CTRL 0x06 /* ARI Control Register */ #define PCI_ARI_CTRL_MFVC 0x0001 /* MFVC Function Groups Enable */ #define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ #define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ #define PCI_EXT_CAP_ARI_SIZEOF 8 /* Address Translation Service */ #define PCI_ATS_CAP 0x04 /* ATS Capability Register */ #define PCI_ATS_CAP_QDEP(x) ((x) & 0x1f) /* Invalidate Queue Depth */ #define PCI_ATS_MAX_QDEP 32 /* Max Invalidate Queue Depth */ #define PCI_ATS_CTRL 0x06 /* ATS Control Register */ #define PCI_ATS_CTRL_ENABLE 0x8000 /* ATS Enable */ #define PCI_ATS_CTRL_STU(x) ((x) & 0x1f) /* Smallest Translation Unit */ #define PCI_ATS_MIN_STU 12 /* shift of minimum STU block */ #define PCI_EXT_CAP_ATS_SIZEOF 8 /* Page Request Interface */ #define PCI_PRI_CTRL 0x04 /* PRI control register */ #define PCI_PRI_CTRL_ENABLE 0x01 /* Enable */ #define PCI_PRI_CTRL_RESET 0x02 /* Reset */ #define PCI_PRI_STATUS 0x06 /* PRI status register */ #define PCI_PRI_STATUS_RF 0x001 /* Response Failure */ #define PCI_PRI_STATUS_UPRGI 0x002 /* Unexpected PRG index */ #define PCI_PRI_STATUS_STOPPED 0x100 /* PRI Stopped */ #define PCI_PRI_MAX_REQ 0x08 /* PRI max reqs supported */ #define PCI_PRI_ALLOC_REQ 0x0c /* PRI max reqs allowed */ #define PCI_EXT_CAP_PRI_SIZEOF 16 /* Process Address Space ID */ #define PCI_PASID_CAP 0x04 /* PASID feature register */ #define PCI_PASID_CAP_EXEC 0x02 /* Exec permissions Supported */ #define PCI_PASID_CAP_PRIV 0x04 /* Privilege Mode Supported */ #define PCI_PASID_CTRL 0x06 /* PASID control register */ #define PCI_PASID_CTRL_ENABLE 0x01 /* Enable bit */ #define PCI_PASID_CTRL_EXEC 0x02 /* Exec permissions Enable */ #define PCI_PASID_CTRL_PRIV 0x04 /* Privilege Mode Enable */ #define PCI_EXT_CAP_PASID_SIZEOF 8 /* Single Root I/O Virtualization */ #define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */ #define PCI_SRIOV_CAP_VFM 0x01 /* VF Migration Capable */ #define PCI_SRIOV_CAP_INTR(x) ((x) >> 21) /* Interrupt Message Number */ #define PCI_SRIOV_CTRL 0x08 /* SR-IOV Control */ #define PCI_SRIOV_CTRL_VFE 0x01 /* VF Enable */ #define PCI_SRIOV_CTRL_VFM 0x02 /* VF Migration Enable */ #define PCI_SRIOV_CTRL_INTR 0x04 /* VF Migration Interrupt Enable */ #define PCI_SRIOV_CTRL_MSE 0x08 /* VF Memory Space Enable */ #define PCI_SRIOV_CTRL_ARI 0x10 /* ARI Capable Hierarchy */ #define PCI_SRIOV_STATUS 0x0a /* SR-IOV Status */ #define PCI_SRIOV_STATUS_VFM 0x01 /* VF Migration Status */ #define PCI_SRIOV_INITIAL_VF 0x0c /* Initial VFs */ #define PCI_SRIOV_TOTAL_VF 0x0e /* Total VFs */ #define PCI_SRIOV_NUM_VF 0x10 /* Number of VFs */ #define PCI_SRIOV_FUNC_LINK 0x12 /* Function Dependency Link */ #define PCI_SRIOV_VF_OFFSET 0x14 /* First VF Offset */ #define PCI_SRIOV_VF_STRIDE 0x16 /* Following VF Stride */ #define PCI_SRIOV_VF_DID 0x1a /* VF Device ID */ #define PCI_SRIOV_SUP_PGSIZE 0x1c /* Supported Page Sizes */ #define PCI_SRIOV_SYS_PGSIZE 0x20 /* System Page Size */ #define PCI_SRIOV_BAR 0x24 /* VF BAR0 */ #define PCI_SRIOV_NUM_BARS 6 /* Number of VF BARs */ #define PCI_SRIOV_VFM 0x3c /* VF Migration State Array Offset*/ #define PCI_SRIOV_VFM_BIR(x) ((x) & 7) /* State BIR */ #define PCI_SRIOV_VFM_OFFSET(x) ((x) & ~7) /* State Offset */ #define PCI_SRIOV_VFM_UA 0x0 /* Inactive.Unavailable */ #define PCI_SRIOV_VFM_MI 0x1 /* Dormant.MigrateIn */ #define PCI_SRIOV_VFM_MO 0x2 /* Active.MigrateOut */ #define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */ #define PCI_EXT_CAP_SRIOV_SIZEOF 64 #define PCI_LTR_MAX_SNOOP_LAT 0x4 #define PCI_LTR_MAX_NOSNOOP_LAT 0x6 #define PCI_LTR_VALUE_MASK 0x000003ff #define PCI_LTR_SCALE_MASK 0x00001c00 #define PCI_LTR_SCALE_SHIFT 10 #define PCI_EXT_CAP_LTR_SIZEOF 8 /* Access Control Service */ #define PCI_ACS_CAP 0x04 /* ACS Capability Register */ #define PCI_ACS_SV 0x01 /* Source Validation */ #define PCI_ACS_TB 0x02 /* Translation Blocking */ #define PCI_ACS_RR 0x04 /* P2P Request Redirect */ #define PCI_ACS_CR 0x08 /* P2P Completion Redirect */ #define PCI_ACS_UF 0x10 /* Upstream Forwarding */ #define PCI_ACS_EC 0x20 /* P2P Egress Control */ #define PCI_ACS_DT 0x40 /* Direct Translated P2P */ #define PCI_ACS_EGRESS_BITS 0x05 /* ACS Egress Control Vector Size */ #define PCI_ACS_CTRL 0x06 /* ACS Control Register */ #define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */ #define PCI_VSEC_HDR 4 /* extended cap - vendor-specific */ #define PCI_VSEC_HDR_LEN_SHIFT 20 /* shift for length field */ /* SATA capability */ #define PCI_SATA_REGS 4 /* SATA REGs specifier */ #define PCI_SATA_REGS_MASK 0xF /* location - BAR#/inline */ #define PCI_SATA_REGS_INLINE 0xF /* REGS in config space */ #define PCI_SATA_SIZEOF_SHORT 8 #define PCI_SATA_SIZEOF_LONG 16 /* Resizable BARs */ #define PCI_REBAR_CAP 4 /* capability register */ #define PCI_REBAR_CAP_SIZES 0x00FFFFF0 /* supported BAR sizes */ #define PCI_REBAR_CTRL 8 /* control register */ #define PCI_REBAR_CTRL_BAR_IDX 0x00000007 /* BAR index */ #define PCI_REBAR_CTRL_NBAR_MASK 0x000000E0 /* # of resizable BARs */ #define PCI_REBAR_CTRL_NBAR_SHIFT 5 /* shift for # of BARs */ #define PCI_REBAR_CTRL_BAR_SIZE 0x00001F00 /* BAR size */ #define PCI_REBAR_CTRL_BAR_SHIFT 8 /* shift for BAR size */ /* Dynamic Power Allocation */ #define PCI_DPA_CAP 4 /* capability register */ #define PCI_DPA_CAP_SUBSTATE_MASK 0x1F /* # substates - 1 */ #define PCI_DPA_BASE_SIZEOF 16 /* size with 0 substates */ /* TPH Requester */ #define PCI_TPH_CAP 4 /* capability register */ #define PCI_TPH_CAP_LOC_MASK 0x600 /* location mask */ #define PCI_TPH_LOC_NONE 0x000 /* no location */ #define PCI_TPH_LOC_CAP 0x200 /* in capability */ #define PCI_TPH_LOC_MSIX 0x400 /* in MSI-X */ #define PCI_TPH_CAP_ST_MASK 0x07FF0000 /* st table mask */ #define PCI_TPH_CAP_ST_SHIFT 16 /* st table shift */ #define PCI_TPH_BASE_SIZEOF 12 /* size with no st table */ /* Downstream Port Containment */ #define PCI_EXP_DPC_CAP 4 /* DPC Capability */ #define PCI_EXP_DPC_IRQ 0x001F /* Interrupt Message Number */ #define PCI_EXP_DPC_CAP_RP_EXT 0x0020 /* Root Port Extensions */ #define PCI_EXP_DPC_CAP_POISONED_TLP 0x0040 /* Poisoned TLP Egress Blocking Supported */ #define PCI_EXP_DPC_CAP_SW_TRIGGER 0x0080 /* Software Triggering Supported */ #define PCI_EXP_DPC_RP_PIO_LOG_SIZE 0x0F00 /* RP PIO Log Size */ #define PCI_EXP_DPC_CAP_DL_ACTIVE 0x1000 /* ERR_COR signal on DL_Active supported */ #define PCI_EXP_DPC_CTL 6 /* DPC control */ #define PCI_EXP_DPC_CTL_EN_FATAL 0x0001 /* Enable trigger on ERR_FATAL message */ #define PCI_EXP_DPC_CTL_EN_NONFATAL 0x0002 /* Enable trigger on ERR_NONFATAL message */ #define PCI_EXP_DPC_CTL_INT_EN 0x0008 /* DPC Interrupt Enable */ #define PCI_EXP_DPC_STATUS 8 /* DPC Status */ #define PCI_EXP_DPC_STATUS_TRIGGER 0x0001 /* Trigger Status */ #define PCI_EXP_DPC_STATUS_TRIGGER_RSN 0x0006 /* Trigger Reason */ #define PCI_EXP_DPC_STATUS_INTERRUPT 0x0008 /* Interrupt Status */ #define PCI_EXP_DPC_RP_BUSY 0x0010 /* Root Port Busy */ #define PCI_EXP_DPC_STATUS_TRIGGER_RSN_EXT 0x0060 /* Trig Reason Extension */ #define PCI_EXP_DPC_SOURCE_ID 10 /* DPC Source Identifier */ #define PCI_EXP_DPC_RP_PIO_STATUS 0x0C /* RP PIO Status */ #define PCI_EXP_DPC_RP_PIO_MASK 0x10 /* RP PIO Mask */ #define PCI_EXP_DPC_RP_PIO_SEVERITY 0x14 /* RP PIO Severity */ #define PCI_EXP_DPC_RP_PIO_SYSERROR 0x18 /* RP PIO SysError */ #define PCI_EXP_DPC_RP_PIO_EXCEPTION 0x1C /* RP PIO Exception */ #define PCI_EXP_DPC_RP_PIO_HEADER_LOG 0x20 /* RP PIO Header Log */ #define PCI_EXP_DPC_RP_PIO_IMPSPEC_LOG 0x30 /* RP PIO ImpSpec Log */ #define PCI_EXP_DPC_RP_PIO_TLPPREFIX_LOG 0x34 /* RP PIO TLP Prefix Log */ /* Precision Time Measurement */ #define PCI_PTM_CAP 0x04 /* PTM Capability */ #define PCI_PTM_CAP_REQ 0x00000001 /* Requester capable */ #define PCI_PTM_CAP_ROOT 0x00000004 /* Root capable */ #define PCI_PTM_GRANULARITY_MASK 0x0000FF00 /* Clock granularity */ #define PCI_PTM_CTRL 0x08 /* PTM Control */ #define PCI_PTM_CTRL_ENABLE 0x00000001 /* PTM enable */ #define PCI_PTM_CTRL_ROOT 0x00000002 /* Root select */ /* ASPM L1 PM Substates */ #define PCI_L1SS_CAP 0x04 /* Capabilities Register */ #define PCI_L1SS_CAP_PCIPM_L1_2 0x00000001 /* PCI-PM L1.2 Supported */ #define PCI_L1SS_CAP_PCIPM_L1_1 0x00000002 /* PCI-PM L1.1 Supported */ #define PCI_L1SS_CAP_ASPM_L1_2 0x00000004 /* ASPM L1.2 Supported */ #define PCI_L1SS_CAP_ASPM_L1_1 0x00000008 /* ASPM L1.1 Supported */ #define PCI_L1SS_CAP_L1_PM_SS 0x00000010 /* L1 PM Substates Supported */ #define PCI_L1SS_CAP_CM_RESTORE_TIME 0x0000ff00 /* Port Common_Mode_Restore_Time */ #define PCI_L1SS_CAP_P_PWR_ON_SCALE 0x00030000 /* Port T_POWER_ON scale */ #define PCI_L1SS_CAP_P_PWR_ON_VALUE 0x00f80000 /* Port T_POWER_ON value */ #define PCI_L1SS_CTL1 0x08 /* Control 1 Register */ #define PCI_L1SS_CTL1_PCIPM_L1_2 0x00000001 /* PCI-PM L1.2 Enable */ #define PCI_L1SS_CTL1_PCIPM_L1_1 0x00000002 /* PCI-PM L1.1 Enable */ #define PCI_L1SS_CTL1_ASPM_L1_2 0x00000004 /* ASPM L1.2 Enable */ #define PCI_L1SS_CTL1_ASPM_L1_1 0x00000008 /* ASPM L1.1 Enable */ #define PCI_L1SS_CTL1_L1SS_MASK 0x0000000f #define PCI_L1SS_CTL1_CM_RESTORE_TIME 0x0000ff00 /* Common_Mode_Restore_Time */ #define PCI_L1SS_CTL1_LTR_L12_TH_VALUE 0x03ff0000 /* LTR_L1.2_THRESHOLD_Value */ #define PCI_L1SS_CTL1_LTR_L12_TH_SCALE 0xe0000000 /* LTR_L1.2_THRESHOLD_Scale */ #define PCI_L1SS_CTL2 0x0c /* Control 2 Register */ #endif /* LINUX_PCI_REGS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/neighbour.h�����������������������������������������������������������������������������������0000644�����������������00000010364�14763166027�0010056 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_NEIGHBOUR_H #define __LINUX_NEIGHBOUR_H #include <linux/types.h> #include <linux/netlink.h> struct ndmsg { __u8 ndm_family; __u8 ndm_pad1; __u16 ndm_pad2; __s32 ndm_ifindex; __u16 ndm_state; __u8 ndm_flags; __u8 ndm_type; }; enum { NDA_UNSPEC, NDA_DST, NDA_LLADDR, NDA_CACHEINFO, NDA_PROBES, NDA_VLAN, NDA_PORT, NDA_VNI, NDA_IFINDEX, NDA_MASTER, NDA_LINK_NETNSID, NDA_SRC_VNI, __NDA_MAX }; #define NDA_MAX (__NDA_MAX - 1) /* * Neighbor Cache Entry Flags */ #define NTF_USE 0x01 #define NTF_SELF 0x02 #define NTF_MASTER 0x04 #define NTF_PROXY 0x08 /* == ATF_PUBL */ #define NTF_EXT_LEARNED 0x10 #define NTF_OFFLOADED 0x20 #define NTF_ROUTER 0x80 /* * Neighbor Cache Entry States. */ #define NUD_INCOMPLETE 0x01 #define NUD_REACHABLE 0x02 #define NUD_STALE 0x04 #define NUD_DELAY 0x08 #define NUD_PROBE 0x10 #define NUD_FAILED 0x20 /* Dummy states */ #define NUD_NOARP 0x40 #define NUD_PERMANENT 0x80 #define NUD_NONE 0x00 /* NUD_NOARP & NUD_PERMANENT are pseudostates, they never change and make no address resolution or NUD. NUD_PERMANENT also cannot be deleted by garbage collectors. */ struct nda_cacheinfo { __u32 ndm_confirmed; __u32 ndm_used; __u32 ndm_updated; __u32 ndm_refcnt; }; /***************************************************************** * Neighbour tables specific messages. * * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the * NLM_F_DUMP flag set. Every neighbour table configuration is * spread over multiple messages to avoid running into message * size limits on systems with many interfaces. The first message * in the sequence transports all not device specific data such as * statistics, configuration, and the default parameter set. * This message is followed by 0..n messages carrying device * specific parameter sets. * Although the ordering should be sufficient, NDTA_NAME can be * used to identify sequences. The initial message can be identified * by checking for NDTA_CONFIG. The device specific messages do * not contain this TLV but have NDTPA_IFINDEX set to the * corresponding interface index. * * To change neighbour table attributes, send RTM_SETNEIGHTBL * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3], * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked * otherwise. Device specific parameter sets can be changed by * setting NDTPA_IFINDEX to the interface index of the corresponding * device. ****/ struct ndt_stats { __u64 ndts_allocs; __u64 ndts_destroys; __u64 ndts_hash_grows; __u64 ndts_res_failed; __u64 ndts_lookups; __u64 ndts_hits; __u64 ndts_rcv_probes_mcast; __u64 ndts_rcv_probes_ucast; __u64 ndts_periodic_gc_runs; __u64 ndts_forced_gc_runs; __u64 ndts_table_fulls; }; enum { NDTPA_UNSPEC, NDTPA_IFINDEX, /* u32, unchangeable */ NDTPA_REFCNT, /* u32, read-only */ NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */ NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */ NDTPA_RETRANS_TIME, /* u64, msecs */ NDTPA_GC_STALETIME, /* u64, msecs */ NDTPA_DELAY_PROBE_TIME, /* u64, msecs */ NDTPA_QUEUE_LEN, /* u32 */ NDTPA_APP_PROBES, /* u32 */ NDTPA_UCAST_PROBES, /* u32 */ NDTPA_MCAST_PROBES, /* u32 */ NDTPA_ANYCAST_DELAY, /* u64, msecs */ NDTPA_PROXY_DELAY, /* u64, msecs */ NDTPA_PROXY_QLEN, /* u32 */ NDTPA_LOCKTIME, /* u64, msecs */ NDTPA_QUEUE_LENBYTES, /* u32 */ NDTPA_MCAST_REPROBES, /* u32 */ NDTPA_PAD, __NDTPA_MAX }; #define NDTPA_MAX (__NDTPA_MAX - 1) struct ndtmsg { __u8 ndtm_family; __u8 ndtm_pad1; __u16 ndtm_pad2; }; struct ndt_config { __u16 ndtc_key_len; __u16 ndtc_entry_size; __u32 ndtc_entries; __u32 ndtc_last_flush; /* delta to now in msecs */ __u32 ndtc_last_rand; /* delta to now in msecs */ __u32 ndtc_hash_rnd; __u32 ndtc_hash_mask; __u32 ndtc_hash_chain_gc; __u32 ndtc_proxy_qlen; }; enum { NDTA_UNSPEC, NDTA_NAME, /* char *, unchangeable */ NDTA_THRESH1, /* u32 */ NDTA_THRESH2, /* u32 */ NDTA_THRESH3, /* u32 */ NDTA_CONFIG, /* struct ndt_config, read-only */ NDTA_PARMS, /* nested TLV NDTPA_* */ NDTA_STATS, /* struct ndt_stats, read-only */ NDTA_GC_INTERVAL, /* u64, msecs */ NDTA_PAD, __NDTA_MAX }; #define NDTA_MAX (__NDTA_MAX - 1) #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/pkt_cls.h�������������������������������������������������������������������������������������0000644�����������������00000031674�14763166027�0007542 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_PKT_CLS_H #define __LINUX_PKT_CLS_H #include <linux/types.h> #include <linux/pkt_sched.h> #define TC_COOKIE_MAX_SIZE 16 /* Action attributes */ enum { TCA_ACT_UNSPEC, TCA_ACT_KIND, TCA_ACT_OPTIONS, TCA_ACT_INDEX, TCA_ACT_STATS, TCA_ACT_PAD, TCA_ACT_COOKIE, __TCA_ACT_MAX }; #define TCA_ACT_MAX __TCA_ACT_MAX #define TCA_OLD_COMPAT (TCA_ACT_MAX+1) #define TCA_ACT_MAX_PRIO 32 #define TCA_ACT_BIND 1 #define TCA_ACT_NOBIND 0 #define TCA_ACT_UNBIND 1 #define TCA_ACT_NOUNBIND 0 #define TCA_ACT_REPLACE 1 #define TCA_ACT_NOREPLACE 0 #define TC_ACT_UNSPEC (-1) #define TC_ACT_OK 0 #define TC_ACT_RECLASSIFY 1 #define TC_ACT_SHOT 2 #define TC_ACT_PIPE 3 #define TC_ACT_STOLEN 4 #define TC_ACT_QUEUED 5 #define TC_ACT_REPEAT 6 #define TC_ACT_REDIRECT 7 #define TC_ACT_TRAP 8 /* For hw path, this means "trap to cpu" * and don't further process the frame * in hardware. For sw path, this is * equivalent of TC_ACT_STOLEN - drop * the skb and act like everything * is alright. */ #define TC_ACT_VALUE_MAX TC_ACT_TRAP /* There is a special kind of actions called "extended actions", * which need a value parameter. These have a local opcode located in * the highest nibble, starting from 1. The rest of the bits * are used to carry the value. These two parts together make * a combined opcode. */ #define __TC_ACT_EXT_SHIFT 28 #define __TC_ACT_EXT(local) ((local) << __TC_ACT_EXT_SHIFT) #define TC_ACT_EXT_VAL_MASK ((1 << __TC_ACT_EXT_SHIFT) - 1) #define TC_ACT_EXT_OPCODE(combined) ((combined) & (~TC_ACT_EXT_VAL_MASK)) #define TC_ACT_EXT_CMP(combined, opcode) (TC_ACT_EXT_OPCODE(combined) == opcode) #define TC_ACT_JUMP __TC_ACT_EXT(1) #define TC_ACT_GOTO_CHAIN __TC_ACT_EXT(2) #define TC_ACT_EXT_OPCODE_MAX TC_ACT_GOTO_CHAIN /* Action type identifiers*/ enum { TCA_ID_UNSPEC=0, TCA_ID_POLICE=1, /* other actions go here */ __TCA_ID_MAX=255 }; #define TCA_ID_MAX __TCA_ID_MAX struct tc_police { __u32 index; int action; #define TC_POLICE_UNSPEC TC_ACT_UNSPEC #define TC_POLICE_OK TC_ACT_OK #define TC_POLICE_RECLASSIFY TC_ACT_RECLASSIFY #define TC_POLICE_SHOT TC_ACT_SHOT #define TC_POLICE_PIPE TC_ACT_PIPE __u32 limit; __u32 burst; __u32 mtu; struct tc_ratespec rate; struct tc_ratespec peakrate; int refcnt; int bindcnt; __u32 capab; }; struct tcf_t { __u64 install; __u64 lastuse; __u64 expires; __u64 firstuse; }; struct tc_cnt { int refcnt; int bindcnt; }; #define tc_gen \ __u32 index; \ __u32 capab; \ int action; \ int refcnt; \ int bindcnt enum { TCA_POLICE_UNSPEC, TCA_POLICE_TBF, TCA_POLICE_RATE, TCA_POLICE_PEAKRATE, TCA_POLICE_AVRATE, TCA_POLICE_RESULT, TCA_POLICE_TM, TCA_POLICE_PAD, __TCA_POLICE_MAX #define TCA_POLICE_RESULT TCA_POLICE_RESULT }; #define TCA_POLICE_MAX (__TCA_POLICE_MAX - 1) /* tca flags definitions */ #define TCA_CLS_FLAGS_SKIP_HW (1 << 0) /* don't offload filter to HW */ #define TCA_CLS_FLAGS_SKIP_SW (1 << 1) /* don't use filter in SW */ #define TCA_CLS_FLAGS_IN_HW (1 << 2) /* filter is offloaded to HW */ #define TCA_CLS_FLAGS_NOT_IN_HW (1 << 3) /* filter isn't offloaded to HW */ #define TCA_CLS_FLAGS_VERBOSE (1 << 4) /* verbose logging */ /* U32 filters */ #define TC_U32_HTID(h) ((h)&0xFFF00000) #define TC_U32_USERHTID(h) (TC_U32_HTID(h)>>20) #define TC_U32_HASH(h) (((h)>>12)&0xFF) #define TC_U32_NODE(h) ((h)&0xFFF) #define TC_U32_KEY(h) ((h)&0xFFFFF) #define TC_U32_UNSPEC 0 #define TC_U32_ROOT (0xFFF00000) enum { TCA_U32_UNSPEC, TCA_U32_CLASSID, TCA_U32_HASH, TCA_U32_LINK, TCA_U32_DIVISOR, TCA_U32_SEL, TCA_U32_POLICE, TCA_U32_ACT, TCA_U32_INDEV, TCA_U32_PCNT, TCA_U32_MARK, TCA_U32_FLAGS, TCA_U32_PAD, __TCA_U32_MAX }; #define TCA_U32_MAX (__TCA_U32_MAX - 1) struct tc_u32_key { __be32 mask; __be32 val; int off; int offmask; }; struct tc_u32_sel { unsigned char flags; unsigned char offshift; unsigned char nkeys; __be16 offmask; __u16 off; short offoff; short hoff; __be32 hmask; struct tc_u32_key keys[0]; }; struct tc_u32_mark { __u32 val; __u32 mask; __u32 success; }; struct tc_u32_pcnt { __u64 rcnt; __u64 rhit; __u64 kcnts[0]; }; /* Flags */ #define TC_U32_TERMINAL 1 #define TC_U32_OFFSET 2 #define TC_U32_VAROFFSET 4 #define TC_U32_EAT 8 #define TC_U32_MAXDEPTH 8 /* RSVP filter */ enum { TCA_RSVP_UNSPEC, TCA_RSVP_CLASSID, TCA_RSVP_DST, TCA_RSVP_SRC, TCA_RSVP_PINFO, TCA_RSVP_POLICE, TCA_RSVP_ACT, __TCA_RSVP_MAX }; #define TCA_RSVP_MAX (__TCA_RSVP_MAX - 1 ) struct tc_rsvp_gpi { __u32 key; __u32 mask; int offset; }; struct tc_rsvp_pinfo { struct tc_rsvp_gpi dpi; struct tc_rsvp_gpi spi; __u8 protocol; __u8 tunnelid; __u8 tunnelhdr; __u8 pad; }; /* ROUTE filter */ enum { TCA_ROUTE4_UNSPEC, TCA_ROUTE4_CLASSID, TCA_ROUTE4_TO, TCA_ROUTE4_FROM, TCA_ROUTE4_IIF, TCA_ROUTE4_POLICE, TCA_ROUTE4_ACT, __TCA_ROUTE4_MAX }; #define TCA_ROUTE4_MAX (__TCA_ROUTE4_MAX - 1) /* FW filter */ enum { TCA_FW_UNSPEC, TCA_FW_CLASSID, TCA_FW_POLICE, TCA_FW_INDEV, /* used by CONFIG_NET_CLS_IND */ TCA_FW_ACT, /* used by CONFIG_NET_CLS_ACT */ TCA_FW_MASK, __TCA_FW_MAX }; #define TCA_FW_MAX (__TCA_FW_MAX - 1) /* TC index filter */ enum { TCA_TCINDEX_UNSPEC, TCA_TCINDEX_HASH, TCA_TCINDEX_MASK, TCA_TCINDEX_SHIFT, TCA_TCINDEX_FALL_THROUGH, TCA_TCINDEX_CLASSID, TCA_TCINDEX_POLICE, TCA_TCINDEX_ACT, __TCA_TCINDEX_MAX }; #define TCA_TCINDEX_MAX (__TCA_TCINDEX_MAX - 1) /* Flow filter */ enum { FLOW_KEY_SRC, FLOW_KEY_DST, FLOW_KEY_PROTO, FLOW_KEY_PROTO_SRC, FLOW_KEY_PROTO_DST, FLOW_KEY_IIF, FLOW_KEY_PRIORITY, FLOW_KEY_MARK, FLOW_KEY_NFCT, FLOW_KEY_NFCT_SRC, FLOW_KEY_NFCT_DST, FLOW_KEY_NFCT_PROTO_SRC, FLOW_KEY_NFCT_PROTO_DST, FLOW_KEY_RTCLASSID, FLOW_KEY_SKUID, FLOW_KEY_SKGID, FLOW_KEY_VLAN_TAG, FLOW_KEY_RXHASH, __FLOW_KEY_MAX, }; #define FLOW_KEY_MAX (__FLOW_KEY_MAX - 1) enum { FLOW_MODE_MAP, FLOW_MODE_HASH, }; enum { TCA_FLOW_UNSPEC, TCA_FLOW_KEYS, TCA_FLOW_MODE, TCA_FLOW_BASECLASS, TCA_FLOW_RSHIFT, TCA_FLOW_ADDEND, TCA_FLOW_MASK, TCA_FLOW_XOR, TCA_FLOW_DIVISOR, TCA_FLOW_ACT, TCA_FLOW_POLICE, TCA_FLOW_EMATCHES, TCA_FLOW_PERTURB, __TCA_FLOW_MAX }; #define TCA_FLOW_MAX (__TCA_FLOW_MAX - 1) /* Basic filter */ enum { TCA_BASIC_UNSPEC, TCA_BASIC_CLASSID, TCA_BASIC_EMATCHES, TCA_BASIC_ACT, TCA_BASIC_POLICE, __TCA_BASIC_MAX }; #define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1) /* Cgroup classifier */ enum { TCA_CGROUP_UNSPEC, TCA_CGROUP_ACT, TCA_CGROUP_POLICE, TCA_CGROUP_EMATCHES, __TCA_CGROUP_MAX, }; #define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1) /* BPF classifier */ #define TCA_BPF_FLAG_ACT_DIRECT (1 << 0) enum { TCA_BPF_UNSPEC, TCA_BPF_ACT, TCA_BPF_POLICE, TCA_BPF_CLASSID, TCA_BPF_OPS_LEN, TCA_BPF_OPS, TCA_BPF_FD, TCA_BPF_NAME, TCA_BPF_FLAGS, TCA_BPF_FLAGS_GEN, TCA_BPF_TAG, TCA_BPF_ID, __TCA_BPF_MAX, }; #define TCA_BPF_MAX (__TCA_BPF_MAX - 1) /* Flower classifier */ enum { TCA_FLOWER_UNSPEC, TCA_FLOWER_CLASSID, TCA_FLOWER_INDEV, TCA_FLOWER_ACT, TCA_FLOWER_KEY_ETH_DST, /* ETH_ALEN */ TCA_FLOWER_KEY_ETH_DST_MASK, /* ETH_ALEN */ TCA_FLOWER_KEY_ETH_SRC, /* ETH_ALEN */ TCA_FLOWER_KEY_ETH_SRC_MASK, /* ETH_ALEN */ TCA_FLOWER_KEY_ETH_TYPE, /* be16 */ TCA_FLOWER_KEY_IP_PROTO, /* u8 */ TCA_FLOWER_KEY_IPV4_SRC, /* be32 */ TCA_FLOWER_KEY_IPV4_SRC_MASK, /* be32 */ TCA_FLOWER_KEY_IPV4_DST, /* be32 */ TCA_FLOWER_KEY_IPV4_DST_MASK, /* be32 */ TCA_FLOWER_KEY_IPV6_SRC, /* struct in6_addr */ TCA_FLOWER_KEY_IPV6_SRC_MASK, /* struct in6_addr */ TCA_FLOWER_KEY_IPV6_DST, /* struct in6_addr */ TCA_FLOWER_KEY_IPV6_DST_MASK, /* struct in6_addr */ TCA_FLOWER_KEY_TCP_SRC, /* be16 */ TCA_FLOWER_KEY_TCP_DST, /* be16 */ TCA_FLOWER_KEY_UDP_SRC, /* be16 */ TCA_FLOWER_KEY_UDP_DST, /* be16 */ TCA_FLOWER_FLAGS, TCA_FLOWER_KEY_VLAN_ID, /* be16 */ TCA_FLOWER_KEY_VLAN_PRIO, /* u8 */ TCA_FLOWER_KEY_VLAN_ETH_TYPE, /* be16 */ TCA_FLOWER_KEY_ENC_KEY_ID, /* be32 */ TCA_FLOWER_KEY_ENC_IPV4_SRC, /* be32 */ TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK,/* be32 */ TCA_FLOWER_KEY_ENC_IPV4_DST, /* be32 */ TCA_FLOWER_KEY_ENC_IPV4_DST_MASK,/* be32 */ TCA_FLOWER_KEY_ENC_IPV6_SRC, /* struct in6_addr */ TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK,/* struct in6_addr */ TCA_FLOWER_KEY_ENC_IPV6_DST, /* struct in6_addr */ TCA_FLOWER_KEY_ENC_IPV6_DST_MASK,/* struct in6_addr */ TCA_FLOWER_KEY_TCP_SRC_MASK, /* be16 */ TCA_FLOWER_KEY_TCP_DST_MASK, /* be16 */ TCA_FLOWER_KEY_UDP_SRC_MASK, /* be16 */ TCA_FLOWER_KEY_UDP_DST_MASK, /* be16 */ TCA_FLOWER_KEY_SCTP_SRC_MASK, /* be16 */ TCA_FLOWER_KEY_SCTP_DST_MASK, /* be16 */ TCA_FLOWER_KEY_SCTP_SRC, /* be16 */ TCA_FLOWER_KEY_SCTP_DST, /* be16 */ TCA_FLOWER_KEY_ENC_UDP_SRC_PORT, /* be16 */ TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK, /* be16 */ TCA_FLOWER_KEY_ENC_UDP_DST_PORT, /* be16 */ TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK, /* be16 */ TCA_FLOWER_KEY_FLAGS, /* be32 */ TCA_FLOWER_KEY_FLAGS_MASK, /* be32 */ TCA_FLOWER_KEY_ICMPV4_CODE, /* u8 */ TCA_FLOWER_KEY_ICMPV4_CODE_MASK,/* u8 */ TCA_FLOWER_KEY_ICMPV4_TYPE, /* u8 */ TCA_FLOWER_KEY_ICMPV4_TYPE_MASK,/* u8 */ TCA_FLOWER_KEY_ICMPV6_CODE, /* u8 */ TCA_FLOWER_KEY_ICMPV6_CODE_MASK,/* u8 */ TCA_FLOWER_KEY_ICMPV6_TYPE, /* u8 */ TCA_FLOWER_KEY_ICMPV6_TYPE_MASK,/* u8 */ TCA_FLOWER_KEY_ARP_SIP, /* be32 */ TCA_FLOWER_KEY_ARP_SIP_MASK, /* be32 */ TCA_FLOWER_KEY_ARP_TIP, /* be32 */ TCA_FLOWER_KEY_ARP_TIP_MASK, /* be32 */ TCA_FLOWER_KEY_ARP_OP, /* u8 */ TCA_FLOWER_KEY_ARP_OP_MASK, /* u8 */ TCA_FLOWER_KEY_ARP_SHA, /* ETH_ALEN */ TCA_FLOWER_KEY_ARP_SHA_MASK, /* ETH_ALEN */ TCA_FLOWER_KEY_ARP_THA, /* ETH_ALEN */ TCA_FLOWER_KEY_ARP_THA_MASK, /* ETH_ALEN */ TCA_FLOWER_KEY_MPLS_TTL, /* u8 - 8 bits */ TCA_FLOWER_KEY_MPLS_BOS, /* u8 - 1 bit */ TCA_FLOWER_KEY_MPLS_TC, /* u8 - 3 bits */ TCA_FLOWER_KEY_MPLS_LABEL, /* be32 - 20 bits */ TCA_FLOWER_KEY_TCP_FLAGS, /* be16 */ TCA_FLOWER_KEY_TCP_FLAGS_MASK, /* be16 */ TCA_FLOWER_KEY_IP_TOS, /* u8 */ TCA_FLOWER_KEY_IP_TOS_MASK, /* u8 */ TCA_FLOWER_KEY_IP_TTL, /* u8 */ TCA_FLOWER_KEY_IP_TTL_MASK, /* u8 */ TCA_FLOWER_KEY_CVLAN_ID, /* be16 */ TCA_FLOWER_KEY_CVLAN_PRIO, /* u8 */ TCA_FLOWER_KEY_CVLAN_ETH_TYPE, /* be16 */ TCA_FLOWER_KEY_ENC_IP_TOS, /* u8 */ TCA_FLOWER_KEY_ENC_IP_TOS_MASK, /* u8 */ TCA_FLOWER_KEY_ENC_IP_TTL, /* u8 */ TCA_FLOWER_KEY_ENC_IP_TTL_MASK, /* u8 */ TCA_FLOWER_KEY_ENC_OPTS, TCA_FLOWER_KEY_ENC_OPTS_MASK, __TCA_FLOWER_MAX, }; #define TCA_FLOWER_MAX (__TCA_FLOWER_MAX - 1) enum { TCA_FLOWER_KEY_ENC_OPTS_UNSPEC, TCA_FLOWER_KEY_ENC_OPTS_GENEVE, /* Nested * TCA_FLOWER_KEY_ENC_OPT_GENEVE_ * attributes */ __TCA_FLOWER_KEY_ENC_OPTS_MAX, }; #define TCA_FLOWER_KEY_ENC_OPTS_MAX (__TCA_FLOWER_KEY_ENC_OPTS_MAX - 1) enum { TCA_FLOWER_KEY_ENC_OPT_GENEVE_UNSPEC, TCA_FLOWER_KEY_ENC_OPT_GENEVE_CLASS, /* u16 */ TCA_FLOWER_KEY_ENC_OPT_GENEVE_TYPE, /* u8 */ TCA_FLOWER_KEY_ENC_OPT_GENEVE_DATA, /* 4 to 128 bytes */ __TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX, }; #define TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX \ (__TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX - 1) enum { TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT = (1 << 0), TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST = (1 << 1), }; /* Match-all classifier */ enum { TCA_MATCHALL_UNSPEC, TCA_MATCHALL_CLASSID, TCA_MATCHALL_ACT, TCA_MATCHALL_FLAGS, __TCA_MATCHALL_MAX, }; #define TCA_MATCHALL_MAX (__TCA_MATCHALL_MAX - 1) /* Extended Matches */ struct tcf_ematch_tree_hdr { __u16 nmatches; __u16 progid; }; enum { TCA_EMATCH_TREE_UNSPEC, TCA_EMATCH_TREE_HDR, TCA_EMATCH_TREE_LIST, __TCA_EMATCH_TREE_MAX }; #define TCA_EMATCH_TREE_MAX (__TCA_EMATCH_TREE_MAX - 1) struct tcf_ematch_hdr { __u16 matchid; __u16 kind; __u16 flags; __u16 pad; /* currently unused */ }; /* 0 1 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 * +-----------------------+-+-+---+ * | Unused |S|I| R | * +-----------------------+-+-+---+ * * R(2) ::= relation to next ematch * where: 0 0 END (last ematch) * 0 1 AND * 1 0 OR * 1 1 Unused (invalid) * I(1) ::= invert result * S(1) ::= simple payload */ #define TCF_EM_REL_END 0 #define TCF_EM_REL_AND (1<<0) #define TCF_EM_REL_OR (1<<1) #define TCF_EM_INVERT (1<<2) #define TCF_EM_SIMPLE (1<<3) #define TCF_EM_REL_MASK 3 #define TCF_EM_REL_VALID(v) (((v) & TCF_EM_REL_MASK) != TCF_EM_REL_MASK) enum { TCF_LAYER_LINK, TCF_LAYER_NETWORK, TCF_LAYER_TRANSPORT, __TCF_LAYER_MAX }; #define TCF_LAYER_MAX (__TCF_LAYER_MAX - 1) /* Ematch type assignments * 1..32767 Reserved for ematches inside kernel tree * 32768..65535 Free to use, not reliable */ #define TCF_EM_CONTAINER 0 #define TCF_EM_CMP 1 #define TCF_EM_NBYTE 2 #define TCF_EM_U32 3 #define TCF_EM_META 4 #define TCF_EM_TEXT 5 #define TCF_EM_VLAN 6 #define TCF_EM_CANID 7 #define TCF_EM_IPSET 8 #define TCF_EM_IPT 9 #define TCF_EM_MAX 9 enum { TCF_EM_PROG_TC }; enum { TCF_EM_OPND_EQ, TCF_EM_OPND_GT, TCF_EM_OPND_LT }; #endif ��������������������������������������������������������������������linux/fd.h������������������������������������������������������������������������������������������0000644�����������������00000026630�14763166027�0006470 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_FD_H #define _LINUX_FD_H #include <linux/ioctl.h> /* New file layout: Now the ioctl definitions immediately follow the * definitions of the structures that they use */ /* * Geometry */ struct floppy_struct { unsigned int size, /* nr of sectors total */ sect, /* sectors per track */ head, /* nr of heads */ track, /* nr of tracks */ stretch; /* bit 0 !=0 means double track steps */ /* bit 1 != 0 means swap sides */ /* bits 2..9 give the first sector */ /* number (the LSB is flipped) */ #define FD_STRETCH 1 #define FD_SWAPSIDES 2 #define FD_ZEROBASED 4 #define FD_SECTBASEMASK 0x3FC #define FD_MKSECTBASE(s) (((s) ^ 1) << 2) #define FD_SECTBASE(floppy) ((((floppy)->stretch & FD_SECTBASEMASK) >> 2) ^ 1) unsigned char gap, /* gap1 size */ rate, /* data rate. |= 0x40 for perpendicular */ #define FD_2M 0x4 #define FD_SIZECODEMASK 0x38 #define FD_SIZECODE(floppy) (((((floppy)->rate&FD_SIZECODEMASK)>> 3)+ 2) %8) #define FD_SECTSIZE(floppy) ( (floppy)->rate & FD_2M ? \ 512 : 128 << FD_SIZECODE(floppy) ) #define FD_PERP 0x40 spec1, /* stepping rate, head unload time */ fmt_gap; /* gap2 size */ const char * name; /* used only for predefined formats */ }; /* commands needing write access have 0x40 set */ /* commands needing super user access have 0x80 set */ #define FDCLRPRM _IO(2, 0x41) /* clear user-defined parameters */ #define FDSETPRM _IOW(2, 0x42, struct floppy_struct) #define FDSETMEDIAPRM FDSETPRM /* set user-defined parameters for current media */ #define FDDEFPRM _IOW(2, 0x43, struct floppy_struct) #define FDGETPRM _IOR(2, 0x04, struct floppy_struct) #define FDDEFMEDIAPRM FDDEFPRM #define FDGETMEDIAPRM FDGETPRM /* set/get disk parameters */ #define FDMSGON _IO(2,0x45) #define FDMSGOFF _IO(2,0x46) /* issue/don't issue kernel messages on media type change */ /* * Formatting (obsolete) */ #define FD_FILL_BYTE 0xF6 /* format fill byte. */ struct format_descr { unsigned int device,head,track; }; #define FDFMTBEG _IO(2,0x47) /* begin formatting a disk */ #define FDFMTTRK _IOW(2,0x48, struct format_descr) /* format the specified track */ #define FDFMTEND _IO(2,0x49) /* end formatting a disk */ /* * Error thresholds */ struct floppy_max_errors { unsigned int abort, /* number of errors to be reached before aborting */ read_track, /* maximal number of errors permitted to read an * entire track at once */ reset, /* maximal number of errors before a reset is tried */ recal, /* maximal number of errors before a recalibrate is * tried */ /* * Threshold for reporting FDC errors to the console. * Setting this to zero may flood your screen when using * ultra cheap floppies ;-) */ reporting; }; #define FDSETEMSGTRESH _IO(2,0x4a) /* set fdc error reporting threshold */ #define FDFLUSH _IO(2,0x4b) /* flush buffers for media; either for verifying media, or for * handling a media change without closing the file descriptor */ #define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors) #define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors) /* set/get abortion and read_track threshold. See also floppy_drive_params * structure */ typedef char floppy_drive_name[16]; #define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name) /* get drive type: 5 1/4 or 3 1/2 */ /* * Drive parameters (user modifiable) */ struct floppy_drive_params { signed char cmos; /* CMOS type */ /* Spec2 is (HLD<<1 | ND), where HLD is head load time (1=2ms, 2=4 ms * etc) and ND is set means no DMA. Hardcoded to 6 (HLD=6ms, use DMA). */ unsigned long max_dtr; /* Step rate, usec */ unsigned long hlt; /* Head load/settle time, msec */ unsigned long hut; /* Head unload time (remnant of * 8" drives) */ unsigned long srt; /* Step rate, usec */ unsigned long spinup; /* time needed for spinup (expressed * in jiffies) */ unsigned long spindown; /* timeout needed for spindown */ unsigned char spindown_offset; /* decides in which position the disk * will stop */ unsigned char select_delay; /* delay to wait after select */ unsigned char rps; /* rotations per second */ unsigned char tracks; /* maximum number of tracks */ unsigned long timeout; /* timeout for interrupt requests */ unsigned char interleave_sect; /* if there are more sectors, use * interleave */ struct floppy_max_errors max_errors; char flags; /* various flags, including ftd_msg */ /* * Announce successful media type detection and media information loss after * disk changes. * Also used to enable/disable printing of overrun warnings. */ #define FTD_MSG 0x10 #define FD_BROKEN_DCL 0x20 #define FD_DEBUG 0x02 #define FD_SILENT_DCL_CLEAR 0x4 #define FD_INVERTED_DCL 0x80 /* must be 0x80, because of hardware considerations */ char read_track; /* use readtrack during probing? */ /* * Auto-detection. Each drive type has eight formats which are * used in succession to try to read the disk. If the FDC cannot lock onto * the disk, the next format is tried. This uses the variable 'probing'. */ short autodetect[8]; /* autodetected formats */ int checkfreq; /* how often should the drive be checked for disk * changes */ int native_format; /* native format of this drive */ }; enum { FD_NEED_TWADDLE_BIT, /* more magic */ FD_VERIFY_BIT, /* inquire for write protection */ FD_DISK_NEWCHANGE_BIT, /* change detected, and no action undertaken yet * to clear media change status */ FD_UNUSED_BIT, FD_DISK_CHANGED_BIT, /* disk has been changed since last i/o */ FD_DISK_WRITABLE_BIT, /* disk is writable */ FD_OPEN_SHOULD_FAIL_BIT }; #define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params) #define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params) /* set/get drive parameters */ /* * Current drive state (not directly modifiable by user, readonly) */ struct floppy_drive_struct { unsigned long flags; /* values for these flags */ #define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT) #define FD_VERIFY (1 << FD_VERIFY_BIT) #define FD_DISK_NEWCHANGE (1 << FD_DISK_NEWCHANGE_BIT) #define FD_DISK_CHANGED (1 << FD_DISK_CHANGED_BIT) #define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT) unsigned long spinup_date; unsigned long select_date; unsigned long first_read_date; short probed_format; short track; /* current track */ short maxblock; /* id of highest block read */ short maxtrack; /* id of highest half track read */ int generation; /* how many diskchanges? */ /* * (User-provided) media information is _not_ discarded after a media change * if the corresponding keep_data flag is non-zero. Positive values are * decremented after each probe. */ int keep_data; /* Prevent "aliased" accesses. */ int fd_ref; int fd_device; unsigned long last_checked; /* when was the drive last checked for a disk * change? */ char *dmabuf; int bufblocks; }; #define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct) #define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct) /* get drive state: GET returns the cached state, POLL polls for new state */ /* * reset FDC */ enum reset_mode { FD_RESET_IF_NEEDED, /* reset only if the reset flags is set */ FD_RESET_IF_RAWCMD, /* obsolete */ FD_RESET_ALWAYS /* reset always */ }; #define FDRESET _IO(2, 0x54) /* * FDC state */ struct floppy_fdc_state { int spec1; /* spec1 value last used */ int spec2; /* spec2 value last used */ int dtr; unsigned char version; /* FDC version code */ unsigned char dor; unsigned long address; /* io address */ unsigned int rawcmd:2; unsigned int reset:1; unsigned int need_configure:1; unsigned int perp_mode:2; unsigned int has_fifo:1; unsigned int driver_version; /* version code for floppy driver */ #define FD_DRIVER_VERSION 0x100 /* user programs using the floppy API should use floppy_fdc_state to * get the version number of the floppy driver that they are running * on. If this version number is bigger than the one compiled into the * user program (the FD_DRIVER_VERSION define), it should be prepared * to bigger structures */ unsigned char track[4]; /* Position of the heads of the 4 units attached to this FDC, * as stored on the FDC. In the future, the position as stored * on the FDC might not agree with the actual physical * position of these drive heads. By allowing such * disagreement, it will be possible to reset the FDC without * incurring the expensive cost of repositioning all heads. * Right now, these positions are hard wired to 0. */ }; #define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state) /* * Asynchronous Write error tracking */ struct floppy_write_errors { /* Write error logging. * * These fields can be cleared with the FDWERRORCLR ioctl. * Only writes that were attempted but failed due to a physical media * error are logged. write(2) calls that fail and return an error code * to the user process are not counted. */ unsigned int write_errors; /* number of physical write errors * encountered */ /* position of first and last write errors */ unsigned long first_error_sector; int first_error_generation; unsigned long last_error_sector; int last_error_generation; unsigned int badness; /* highest retry count for a read or write * operation */ }; #define FDWERRORCLR _IO(2, 0x56) /* clear write error and badness information */ #define FDWERRORGET _IOR(2, 0x17, struct floppy_write_errors) /* get write error and badness information */ /* * Raw commands */ /* new interface flag: now we can do them in batches */ #define FDHAVEBATCHEDRAWCMD struct floppy_raw_cmd { unsigned int flags; #define FD_RAW_READ 1 #define FD_RAW_WRITE 2 #define FD_RAW_NO_MOTOR 4 #define FD_RAW_DISK_CHANGE 4 /* out: disk change flag was set */ #define FD_RAW_INTR 8 /* wait for an interrupt */ #define FD_RAW_SPIN 0x10 /* spin up the disk for this command */ #define FD_RAW_NO_MOTOR_AFTER 0x20 /* switch the motor off after command * completion */ #define FD_RAW_NEED_DISK 0x40 /* this command needs a disk to be present */ #define FD_RAW_NEED_SEEK 0x80 /* this command uses an implied seek (soft) */ /* more "in" flags */ #define FD_RAW_MORE 0x100 /* more records follow */ #define FD_RAW_STOP_IF_FAILURE 0x200 /* stop if we encounter a failure */ #define FD_RAW_STOP_IF_SUCCESS 0x400 /* stop if command successful */ #define FD_RAW_SOFTFAILURE 0x800 /* consider the return value for failure * detection too */ /* more "out" flags */ #define FD_RAW_FAILURE 0x10000 /* command sent to fdc, fdc returned error */ #define FD_RAW_HARDFAILURE 0x20000 /* fdc had to be reset, or timed out */ void *data; char *kernel_data; /* location of data buffer in the kernel */ struct floppy_raw_cmd *next; /* used for chaining of raw cmd's * within the kernel */ long length; /* in: length of dma transfer. out: remaining bytes */ long phys_length; /* physical length, if different from dma length */ int buffer_length; /* length of allocated buffer */ unsigned char rate; unsigned char cmd_count; unsigned char cmd[16]; unsigned char reply_count; unsigned char reply[16]; int track; int resultcode; int reserved1; int reserved2; }; #define FDRAWCMD _IO(2, 0x58) /* send a raw command to the fdc. Structure size not included, because of * batches */ #define FDTWADDLE _IO(2, 0x59) /* flicker motor-on bit before reading a sector. Experimental */ #define FDEJECT _IO(2, 0x5a) /* eject the disk */ #endif /* _LINUX_FD_H */ ��������������������������������������������������������������������������������������������������������linux/sysctl.h��������������������������������������������������������������������������������������0000644�����������������00000062316�14763166027�0007421 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * sysctl.h: General linux system control interface * * Begun 24 March 1995, Stephen Tweedie * **************************************************************** **************************************************************** ** ** WARNING: ** The values in this file are exported to user space via ** the sysctl() binary interface. Do *NOT* change the ** numbering of any existing values here, and do not change ** any numbers within any one set of values. If you have to ** redefine an existing interface, use a new number for it. ** The kernel will then return -ENOTDIR to any application using ** the old binary interface. ** **************************************************************** **************************************************************** */ #ifndef _LINUX_SYSCTL_H #define _LINUX_SYSCTL_H #include <linux/const.h> #include <linux/types.h> #define CTL_MAXNAME 10 /* how many path components do we allow in a call to sysctl? In other words, what is the largest acceptable value for the nlen member of a struct __sysctl_args to have? */ struct __sysctl_args { int *name; int nlen; void *oldval; size_t *oldlenp; void *newval; size_t newlen; unsigned long __unused[4]; }; /* Define sysctl names first */ /* Top-level names: */ enum { CTL_KERN=1, /* General kernel info and control */ CTL_VM=2, /* VM management */ CTL_NET=3, /* Networking */ CTL_PROC=4, /* removal breaks strace(1) compilation */ CTL_FS=5, /* Filesystems */ CTL_DEBUG=6, /* Debugging */ CTL_DEV=7, /* Devices */ CTL_BUS=8, /* Busses */ CTL_ABI=9, /* Binary emulation */ CTL_CPU=10, /* CPU stuff (speed scaling, etc) */ CTL_ARLAN=254, /* arlan wireless driver */ CTL_S390DBF=5677, /* s390 debug */ CTL_SUNRPC=7249, /* sunrpc debug */ CTL_PM=9899, /* frv power management */ CTL_FRV=9898, /* frv specific sysctls */ }; /* CTL_BUS names: */ enum { CTL_BUS_ISA=1 /* ISA */ }; /* /proc/sys/fs/inotify/ */ enum { INOTIFY_MAX_USER_INSTANCES=1, /* max instances per user */ INOTIFY_MAX_USER_WATCHES=2, /* max watches per user */ INOTIFY_MAX_QUEUED_EVENTS=3 /* max queued events per instance */ }; /* CTL_KERN names: */ enum { KERN_OSTYPE=1, /* string: system version */ KERN_OSRELEASE=2, /* string: system release */ KERN_OSREV=3, /* int: system revision */ KERN_VERSION=4, /* string: compile time info */ KERN_SECUREMASK=5, /* struct: maximum rights mask */ KERN_PROF=6, /* table: profiling information */ KERN_NODENAME=7, /* string: hostname */ KERN_DOMAINNAME=8, /* string: domainname */ KERN_PANIC=15, /* int: panic timeout */ KERN_REALROOTDEV=16, /* real root device to mount after initrd */ KERN_SPARC_REBOOT=21, /* reboot command on Sparc */ KERN_CTLALTDEL=22, /* int: allow ctl-alt-del to reboot */ KERN_PRINTK=23, /* struct: control printk logging parameters */ KERN_NAMETRANS=24, /* Name translation */ KERN_PPC_HTABRECLAIM=25, /* turn htab reclaimation on/off on PPC */ KERN_PPC_ZEROPAGED=26, /* turn idle page zeroing on/off on PPC */ KERN_PPC_POWERSAVE_NAP=27, /* use nap mode for power saving */ KERN_MODPROBE=28, /* string: modprobe path */ KERN_SG_BIG_BUFF=29, /* int: sg driver reserved buffer size */ KERN_ACCT=30, /* BSD process accounting parameters */ KERN_PPC_L2CR=31, /* l2cr register on PPC */ KERN_RTSIGNR=32, /* Number of rt sigs queued */ KERN_RTSIGMAX=33, /* Max queuable */ KERN_SHMMAX=34, /* long: Maximum shared memory segment */ KERN_MSGMAX=35, /* int: Maximum size of a messege */ KERN_MSGMNB=36, /* int: Maximum message queue size */ KERN_MSGPOOL=37, /* int: Maximum system message pool size */ KERN_SYSRQ=38, /* int: Sysreq enable */ KERN_MAX_THREADS=39, /* int: Maximum nr of threads in the system */ KERN_RANDOM=40, /* Random driver */ KERN_SHMALL=41, /* int: Maximum size of shared memory */ KERN_MSGMNI=42, /* int: msg queue identifiers */ KERN_SEM=43, /* struct: sysv semaphore limits */ KERN_SPARC_STOP_A=44, /* int: Sparc Stop-A enable */ KERN_SHMMNI=45, /* int: shm array identifiers */ KERN_OVERFLOWUID=46, /* int: overflow UID */ KERN_OVERFLOWGID=47, /* int: overflow GID */ KERN_SHMPATH=48, /* string: path to shm fs */ KERN_HOTPLUG=49, /* string: path to uevent helper (deprecated) */ KERN_IEEE_EMULATION_WARNINGS=50, /* int: unimplemented ieee instructions */ KERN_S390_USER_DEBUG_LOGGING=51, /* int: dumps of user faults */ KERN_CORE_USES_PID=52, /* int: use core or core.%pid */ KERN_TAINTED=53, /* int: various kernel tainted flags */ KERN_CADPID=54, /* int: PID of the process to notify on CAD */ KERN_PIDMAX=55, /* int: PID # limit */ KERN_CORE_PATTERN=56, /* string: pattern for core-file names */ KERN_PANIC_ON_OOPS=57, /* int: whether we will panic on an oops */ KERN_HPPA_PWRSW=58, /* int: hppa soft-power enable */ KERN_HPPA_UNALIGNED=59, /* int: hppa unaligned-trap enable */ KERN_PRINTK_RATELIMIT=60, /* int: tune printk ratelimiting */ KERN_PRINTK_RATELIMIT_BURST=61, /* int: tune printk ratelimiting */ KERN_PTY=62, /* dir: pty driver */ KERN_NGROUPS_MAX=63, /* int: NGROUPS_MAX */ KERN_SPARC_SCONS_PWROFF=64, /* int: serial console power-off halt */ KERN_HZ_TIMER=65, /* int: hz timer on or off */ KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */ KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */ KERN_RANDOMIZE=68, /* int: randomize virtual address space */ KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */ KERN_SPIN_RETRY=70, /* int: number of spinlock retries */ KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */ KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */ KERN_COMPAT_LOG=73, /* int: print compat layer messages */ KERN_MAX_LOCK_DEPTH=74, /* int: rtmutex's maximum lock depth */ KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */ KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */ KERN_PANIC_ON_WARN=77, /* int: call panic() in WARN() functions */ }; /* CTL_VM names: */ enum { VM_UNUSED1=1, /* was: struct: Set vm swapping control */ VM_UNUSED2=2, /* was; int: Linear or sqrt() swapout for hogs */ VM_UNUSED3=3, /* was: struct: Set free page thresholds */ VM_UNUSED4=4, /* Spare */ VM_OVERCOMMIT_MEMORY=5, /* Turn off the virtual memory safety limit */ VM_UNUSED5=6, /* was: struct: Set buffer memory thresholds */ VM_UNUSED7=7, /* was: struct: Set cache memory thresholds */ VM_UNUSED8=8, /* was: struct: Control kswapd behaviour */ VM_UNUSED9=9, /* was: struct: Set page table cache parameters */ VM_PAGE_CLUSTER=10, /* int: set number of pages to swap together */ VM_DIRTY_BACKGROUND=11, /* dirty_background_ratio */ VM_DIRTY_RATIO=12, /* dirty_ratio */ VM_DIRTY_WB_CS=13, /* dirty_writeback_centisecs */ VM_DIRTY_EXPIRE_CS=14, /* dirty_expire_centisecs */ VM_NR_PDFLUSH_THREADS=15, /* nr_pdflush_threads */ VM_OVERCOMMIT_RATIO=16, /* percent of RAM to allow overcommit in */ VM_PAGEBUF=17, /* struct: Control pagebuf parameters */ VM_HUGETLB_PAGES=18, /* int: Number of available Huge Pages */ VM_SWAPPINESS=19, /* Tendency to steal mapped memory */ VM_LOWMEM_RESERVE_RATIO=20,/* reservation ratio for lower memory zones */ VM_MIN_FREE_KBYTES=21, /* Minimum free kilobytes to maintain */ VM_MAX_MAP_COUNT=22, /* int: Maximum number of mmaps/address-space */ VM_LAPTOP_MODE=23, /* vm laptop mode */ VM_BLOCK_DUMP=24, /* block dump mode */ VM_HUGETLB_GROUP=25, /* permitted hugetlb group */ VM_VFS_CACHE_PRESSURE=26, /* dcache/icache reclaim pressure */ VM_LEGACY_VA_LAYOUT=27, /* legacy/compatibility virtual address space layout */ VM_SWAP_TOKEN_TIMEOUT=28, /* default time for token time out */ VM_DROP_PAGECACHE=29, /* int: nuke lots of pagecache */ VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */ VM_ZONE_RECLAIM_MODE=31, /* reclaim local zone memory before going off node */ VM_MIN_UNMAPPED=32, /* Set min percent of unmapped pages */ VM_PANIC_ON_OOM=33, /* panic at out-of-memory */ VM_VDSO_ENABLED=34, /* map VDSO into new processes? */ VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */ }; /* CTL_NET names: */ enum { NET_CORE=1, NET_ETHER=2, NET_802=3, NET_UNIX=4, NET_IPV4=5, NET_IPX=6, NET_ATALK=7, NET_NETROM=8, NET_AX25=9, NET_BRIDGE=10, NET_ROSE=11, NET_IPV6=12, NET_X25=13, NET_TR=14, NET_DECNET=15, NET_ECONET=16, NET_SCTP=17, NET_LLC=18, NET_NETFILTER=19, NET_DCCP=20, NET_IRDA=412, }; /* /proc/sys/kernel/random */ enum { RANDOM_POOLSIZE=1, RANDOM_ENTROPY_COUNT=2, RANDOM_READ_THRESH=3, RANDOM_WRITE_THRESH=4, RANDOM_BOOT_ID=5, RANDOM_UUID=6 }; /* /proc/sys/kernel/pty */ enum { PTY_MAX=1, PTY_NR=2 }; /* /proc/sys/bus/isa */ enum { BUS_ISA_MEM_BASE=1, BUS_ISA_PORT_BASE=2, BUS_ISA_PORT_SHIFT=3 }; /* /proc/sys/net/core */ enum { NET_CORE_WMEM_MAX=1, NET_CORE_RMEM_MAX=2, NET_CORE_WMEM_DEFAULT=3, NET_CORE_RMEM_DEFAULT=4, /* was NET_CORE_DESTROY_DELAY */ NET_CORE_MAX_BACKLOG=6, NET_CORE_FASTROUTE=7, NET_CORE_MSG_COST=8, NET_CORE_MSG_BURST=9, NET_CORE_OPTMEM_MAX=10, NET_CORE_HOT_LIST_LENGTH=11, NET_CORE_DIVERT_VERSION=12, NET_CORE_NO_CONG_THRESH=13, NET_CORE_NO_CONG=14, NET_CORE_LO_CONG=15, NET_CORE_MOD_CONG=16, NET_CORE_DEV_WEIGHT=17, NET_CORE_SOMAXCONN=18, NET_CORE_BUDGET=19, NET_CORE_AEVENT_ETIME=20, NET_CORE_AEVENT_RSEQTH=21, NET_CORE_WARNINGS=22, }; /* /proc/sys/net/ethernet */ /* /proc/sys/net/802 */ /* /proc/sys/net/unix */ enum { NET_UNIX_DESTROY_DELAY=1, NET_UNIX_DELETE_DELAY=2, NET_UNIX_MAX_DGRAM_QLEN=3, }; /* /proc/sys/net/netfilter */ enum { NET_NF_CONNTRACK_MAX=1, NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2, NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3, NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4, NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5, NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6, NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7, NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8, NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9, NET_NF_CONNTRACK_UDP_TIMEOUT=10, NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11, NET_NF_CONNTRACK_ICMP_TIMEOUT=12, NET_NF_CONNTRACK_GENERIC_TIMEOUT=13, NET_NF_CONNTRACK_BUCKETS=14, NET_NF_CONNTRACK_LOG_INVALID=15, NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16, NET_NF_CONNTRACK_TCP_LOOSE=17, NET_NF_CONNTRACK_TCP_BE_LIBERAL=18, NET_NF_CONNTRACK_TCP_MAX_RETRANS=19, NET_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20, NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21, NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22, NET_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23, NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24, NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25, NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26, NET_NF_CONNTRACK_COUNT=27, NET_NF_CONNTRACK_ICMPV6_TIMEOUT=28, NET_NF_CONNTRACK_FRAG6_TIMEOUT=29, NET_NF_CONNTRACK_FRAG6_LOW_THRESH=30, NET_NF_CONNTRACK_FRAG6_HIGH_THRESH=31, NET_NF_CONNTRACK_CHECKSUM=32, }; /* /proc/sys/net/ipv4 */ enum { /* v2.0 compatibile variables */ NET_IPV4_FORWARD=8, NET_IPV4_DYNADDR=9, NET_IPV4_CONF=16, NET_IPV4_NEIGH=17, NET_IPV4_ROUTE=18, NET_IPV4_FIB_HASH=19, NET_IPV4_NETFILTER=20, NET_IPV4_TCP_TIMESTAMPS=33, NET_IPV4_TCP_WINDOW_SCALING=34, NET_IPV4_TCP_SACK=35, NET_IPV4_TCP_RETRANS_COLLAPSE=36, NET_IPV4_DEFAULT_TTL=37, NET_IPV4_AUTOCONFIG=38, NET_IPV4_NO_PMTU_DISC=39, NET_IPV4_TCP_SYN_RETRIES=40, NET_IPV4_IPFRAG_HIGH_THRESH=41, NET_IPV4_IPFRAG_LOW_THRESH=42, NET_IPV4_IPFRAG_TIME=43, NET_IPV4_TCP_MAX_KA_PROBES=44, NET_IPV4_TCP_KEEPALIVE_TIME=45, NET_IPV4_TCP_KEEPALIVE_PROBES=46, NET_IPV4_TCP_RETRIES1=47, NET_IPV4_TCP_RETRIES2=48, NET_IPV4_TCP_FIN_TIMEOUT=49, NET_IPV4_IP_MASQ_DEBUG=50, NET_TCP_SYNCOOKIES=51, NET_TCP_STDURG=52, NET_TCP_RFC1337=53, NET_TCP_SYN_TAILDROP=54, NET_TCP_MAX_SYN_BACKLOG=55, NET_IPV4_LOCAL_PORT_RANGE=56, NET_IPV4_ICMP_ECHO_IGNORE_ALL=57, NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS=58, NET_IPV4_ICMP_SOURCEQUENCH_RATE=59, NET_IPV4_ICMP_DESTUNREACH_RATE=60, NET_IPV4_ICMP_TIMEEXCEED_RATE=61, NET_IPV4_ICMP_PARAMPROB_RATE=62, NET_IPV4_ICMP_ECHOREPLY_RATE=63, NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES=64, NET_IPV4_IGMP_MAX_MEMBERSHIPS=65, NET_TCP_TW_RECYCLE=66, NET_IPV4_ALWAYS_DEFRAG=67, NET_IPV4_TCP_KEEPALIVE_INTVL=68, NET_IPV4_INET_PEER_THRESHOLD=69, NET_IPV4_INET_PEER_MINTTL=70, NET_IPV4_INET_PEER_MAXTTL=71, NET_IPV4_INET_PEER_GC_MINTIME=72, NET_IPV4_INET_PEER_GC_MAXTIME=73, NET_TCP_ORPHAN_RETRIES=74, NET_TCP_ABORT_ON_OVERFLOW=75, NET_TCP_SYNACK_RETRIES=76, NET_TCP_MAX_ORPHANS=77, NET_TCP_MAX_TW_BUCKETS=78, NET_TCP_FACK=79, NET_TCP_REORDERING=80, NET_TCP_ECN=81, NET_TCP_DSACK=82, NET_TCP_MEM=83, NET_TCP_WMEM=84, NET_TCP_RMEM=85, NET_TCP_APP_WIN=86, NET_TCP_ADV_WIN_SCALE=87, NET_IPV4_NONLOCAL_BIND=88, NET_IPV4_ICMP_RATELIMIT=89, NET_IPV4_ICMP_RATEMASK=90, NET_TCP_TW_REUSE=91, NET_TCP_FRTO=92, NET_TCP_LOW_LATENCY=93, NET_IPV4_IPFRAG_SECRET_INTERVAL=94, NET_IPV4_IGMP_MAX_MSF=96, NET_TCP_NO_METRICS_SAVE=97, NET_TCP_DEFAULT_WIN_SCALE=105, NET_TCP_MODERATE_RCVBUF=106, NET_TCP_TSO_WIN_DIVISOR=107, NET_TCP_BIC_BETA=108, NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, NET_TCP_CONG_CONTROL=110, NET_TCP_ABC=111, NET_IPV4_IPFRAG_MAX_DIST=112, NET_TCP_MTU_PROBING=113, NET_TCP_BASE_MSS=114, NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115, NET_TCP_DMA_COPYBREAK=116, NET_TCP_SLOW_START_AFTER_IDLE=117, NET_CIPSOV4_CACHE_ENABLE=118, NET_CIPSOV4_CACHE_BUCKET_SIZE=119, NET_CIPSOV4_RBM_OPTFMT=120, NET_CIPSOV4_RBM_STRICTVALID=121, NET_TCP_AVAIL_CONG_CONTROL=122, NET_TCP_ALLOWED_CONG_CONTROL=123, NET_TCP_MAX_SSTHRESH=124, NET_TCP_FRTO_RESPONSE=125, }; enum { NET_IPV4_ROUTE_FLUSH=1, NET_IPV4_ROUTE_MIN_DELAY=2, /* obsolete since 2.6.25 */ NET_IPV4_ROUTE_MAX_DELAY=3, /* obsolete since 2.6.25 */ NET_IPV4_ROUTE_GC_THRESH=4, NET_IPV4_ROUTE_MAX_SIZE=5, NET_IPV4_ROUTE_GC_MIN_INTERVAL=6, NET_IPV4_ROUTE_GC_TIMEOUT=7, NET_IPV4_ROUTE_GC_INTERVAL=8, /* obsolete since 2.6.38 */ NET_IPV4_ROUTE_REDIRECT_LOAD=9, NET_IPV4_ROUTE_REDIRECT_NUMBER=10, NET_IPV4_ROUTE_REDIRECT_SILENCE=11, NET_IPV4_ROUTE_ERROR_COST=12, NET_IPV4_ROUTE_ERROR_BURST=13, NET_IPV4_ROUTE_GC_ELASTICITY=14, NET_IPV4_ROUTE_MTU_EXPIRES=15, NET_IPV4_ROUTE_MIN_PMTU=16, NET_IPV4_ROUTE_MIN_ADVMSS=17, NET_IPV4_ROUTE_SECRET_INTERVAL=18, NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS=19, }; enum { NET_PROTO_CONF_ALL=-2, NET_PROTO_CONF_DEFAULT=-3 /* And device ifindices ... */ }; enum { NET_IPV4_CONF_FORWARDING=1, NET_IPV4_CONF_MC_FORWARDING=2, NET_IPV4_CONF_PROXY_ARP=3, NET_IPV4_CONF_ACCEPT_REDIRECTS=4, NET_IPV4_CONF_SECURE_REDIRECTS=5, NET_IPV4_CONF_SEND_REDIRECTS=6, NET_IPV4_CONF_SHARED_MEDIA=7, NET_IPV4_CONF_RP_FILTER=8, NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE=9, NET_IPV4_CONF_BOOTP_RELAY=10, NET_IPV4_CONF_LOG_MARTIANS=11, NET_IPV4_CONF_TAG=12, NET_IPV4_CONF_ARPFILTER=13, NET_IPV4_CONF_MEDIUM_ID=14, NET_IPV4_CONF_NOXFRM=15, NET_IPV4_CONF_NOPOLICY=16, NET_IPV4_CONF_FORCE_IGMP_VERSION=17, NET_IPV4_CONF_ARP_ANNOUNCE=18, NET_IPV4_CONF_ARP_IGNORE=19, NET_IPV4_CONF_PROMOTE_SECONDARIES=20, NET_IPV4_CONF_ARP_ACCEPT=21, NET_IPV4_CONF_ARP_NOTIFY=22, }; /* /proc/sys/net/ipv4/netfilter */ enum { NET_IPV4_NF_CONNTRACK_MAX=1, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9, NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT=10, NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11, NET_IPV4_NF_CONNTRACK_ICMP_TIMEOUT=12, NET_IPV4_NF_CONNTRACK_GENERIC_TIMEOUT=13, NET_IPV4_NF_CONNTRACK_BUCKETS=14, NET_IPV4_NF_CONNTRACK_LOG_INVALID=15, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16, NET_IPV4_NF_CONNTRACK_TCP_LOOSE=17, NET_IPV4_NF_CONNTRACK_TCP_BE_LIBERAL=18, NET_IPV4_NF_CONNTRACK_TCP_MAX_RETRANS=19, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26, NET_IPV4_NF_CONNTRACK_COUNT=27, NET_IPV4_NF_CONNTRACK_CHECKSUM=28, }; /* /proc/sys/net/ipv6 */ enum { NET_IPV6_CONF=16, NET_IPV6_NEIGH=17, NET_IPV6_ROUTE=18, NET_IPV6_ICMP=19, NET_IPV6_BINDV6ONLY=20, NET_IPV6_IP6FRAG_HIGH_THRESH=21, NET_IPV6_IP6FRAG_LOW_THRESH=22, NET_IPV6_IP6FRAG_TIME=23, NET_IPV6_IP6FRAG_SECRET_INTERVAL=24, NET_IPV6_MLD_MAX_MSF=25, }; enum { NET_IPV6_ROUTE_FLUSH=1, NET_IPV6_ROUTE_GC_THRESH=2, NET_IPV6_ROUTE_MAX_SIZE=3, NET_IPV6_ROUTE_GC_MIN_INTERVAL=4, NET_IPV6_ROUTE_GC_TIMEOUT=5, NET_IPV6_ROUTE_GC_INTERVAL=6, NET_IPV6_ROUTE_GC_ELASTICITY=7, NET_IPV6_ROUTE_MTU_EXPIRES=8, NET_IPV6_ROUTE_MIN_ADVMSS=9, NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS=10 }; enum { NET_IPV6_FORWARDING=1, NET_IPV6_HOP_LIMIT=2, NET_IPV6_MTU=3, NET_IPV6_ACCEPT_RA=4, NET_IPV6_ACCEPT_REDIRECTS=5, NET_IPV6_AUTOCONF=6, NET_IPV6_DAD_TRANSMITS=7, NET_IPV6_RTR_SOLICITS=8, NET_IPV6_RTR_SOLICIT_INTERVAL=9, NET_IPV6_RTR_SOLICIT_DELAY=10, NET_IPV6_USE_TEMPADDR=11, NET_IPV6_TEMP_VALID_LFT=12, NET_IPV6_TEMP_PREFERED_LFT=13, NET_IPV6_REGEN_MAX_RETRY=14, NET_IPV6_MAX_DESYNC_FACTOR=15, NET_IPV6_MAX_ADDRESSES=16, NET_IPV6_FORCE_MLD_VERSION=17, NET_IPV6_ACCEPT_RA_DEFRTR=18, NET_IPV6_ACCEPT_RA_PINFO=19, NET_IPV6_ACCEPT_RA_RTR_PREF=20, NET_IPV6_RTR_PROBE_INTERVAL=21, NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22, NET_IPV6_PROXY_NDP=23, NET_IPV6_ACCEPT_SOURCE_ROUTE=25, NET_IPV6_ACCEPT_RA_FROM_LOCAL=26, NET_IPV6_ACCEPT_RA_RT_INFO_MIN_PLEN=27, __NET_IPV6_MAX }; /* /proc/sys/net/ipv6/icmp */ enum { NET_IPV6_ICMP_RATELIMIT = 1, NET_IPV6_ICMP_ECHO_IGNORE_ALL = 2 }; /* /proc/sys/net/<protocol>/neigh/<dev> */ enum { NET_NEIGH_MCAST_SOLICIT=1, NET_NEIGH_UCAST_SOLICIT=2, NET_NEIGH_APP_SOLICIT=3, NET_NEIGH_RETRANS_TIME=4, NET_NEIGH_REACHABLE_TIME=5, NET_NEIGH_DELAY_PROBE_TIME=6, NET_NEIGH_GC_STALE_TIME=7, NET_NEIGH_UNRES_QLEN=8, NET_NEIGH_PROXY_QLEN=9, NET_NEIGH_ANYCAST_DELAY=10, NET_NEIGH_PROXY_DELAY=11, NET_NEIGH_LOCKTIME=12, NET_NEIGH_GC_INTERVAL=13, NET_NEIGH_GC_THRESH1=14, NET_NEIGH_GC_THRESH2=15, NET_NEIGH_GC_THRESH3=16, NET_NEIGH_RETRANS_TIME_MS=17, NET_NEIGH_REACHABLE_TIME_MS=18, }; /* /proc/sys/net/dccp */ enum { NET_DCCP_DEFAULT=1, }; /* /proc/sys/net/ipx */ enum { NET_IPX_PPROP_BROADCASTING=1, NET_IPX_FORWARDING=2 }; /* /proc/sys/net/llc */ enum { NET_LLC2=1, NET_LLC_STATION=2, }; /* /proc/sys/net/llc/llc2 */ enum { NET_LLC2_TIMEOUT=1, }; /* /proc/sys/net/llc/station */ enum { NET_LLC_STATION_ACK_TIMEOUT=1, }; /* /proc/sys/net/llc/llc2/timeout */ enum { NET_LLC2_ACK_TIMEOUT=1, NET_LLC2_P_TIMEOUT=2, NET_LLC2_REJ_TIMEOUT=3, NET_LLC2_BUSY_TIMEOUT=4, }; /* /proc/sys/net/appletalk */ enum { NET_ATALK_AARP_EXPIRY_TIME=1, NET_ATALK_AARP_TICK_TIME=2, NET_ATALK_AARP_RETRANSMIT_LIMIT=3, NET_ATALK_AARP_RESOLVE_TIME=4 }; /* /proc/sys/net/netrom */ enum { NET_NETROM_DEFAULT_PATH_QUALITY=1, NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER=2, NET_NETROM_NETWORK_TTL_INITIALISER=3, NET_NETROM_TRANSPORT_TIMEOUT=4, NET_NETROM_TRANSPORT_MAXIMUM_TRIES=5, NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY=6, NET_NETROM_TRANSPORT_BUSY_DELAY=7, NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE=8, NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT=9, NET_NETROM_ROUTING_CONTROL=10, NET_NETROM_LINK_FAILS_COUNT=11, NET_NETROM_RESET=12 }; /* /proc/sys/net/ax25 */ enum { NET_AX25_IP_DEFAULT_MODE=1, NET_AX25_DEFAULT_MODE=2, NET_AX25_BACKOFF_TYPE=3, NET_AX25_CONNECT_MODE=4, NET_AX25_STANDARD_WINDOW=5, NET_AX25_EXTENDED_WINDOW=6, NET_AX25_T1_TIMEOUT=7, NET_AX25_T2_TIMEOUT=8, NET_AX25_T3_TIMEOUT=9, NET_AX25_IDLE_TIMEOUT=10, NET_AX25_N2=11, NET_AX25_PACLEN=12, NET_AX25_PROTOCOL=13, NET_AX25_DAMA_SLAVE_TIMEOUT=14 }; /* /proc/sys/net/rose */ enum { NET_ROSE_RESTART_REQUEST_TIMEOUT=1, NET_ROSE_CALL_REQUEST_TIMEOUT=2, NET_ROSE_RESET_REQUEST_TIMEOUT=3, NET_ROSE_CLEAR_REQUEST_TIMEOUT=4, NET_ROSE_ACK_HOLD_BACK_TIMEOUT=5, NET_ROSE_ROUTING_CONTROL=6, NET_ROSE_LINK_FAIL_TIMEOUT=7, NET_ROSE_MAX_VCS=8, NET_ROSE_WINDOW_SIZE=9, NET_ROSE_NO_ACTIVITY_TIMEOUT=10 }; /* /proc/sys/net/x25 */ enum { NET_X25_RESTART_REQUEST_TIMEOUT=1, NET_X25_CALL_REQUEST_TIMEOUT=2, NET_X25_RESET_REQUEST_TIMEOUT=3, NET_X25_CLEAR_REQUEST_TIMEOUT=4, NET_X25_ACK_HOLD_BACK_TIMEOUT=5, NET_X25_FORWARD=6 }; /* /proc/sys/net/token-ring */ enum { NET_TR_RIF_TIMEOUT=1 }; /* /proc/sys/net/decnet/ */ enum { NET_DECNET_NODE_TYPE = 1, NET_DECNET_NODE_ADDRESS = 2, NET_DECNET_NODE_NAME = 3, NET_DECNET_DEFAULT_DEVICE = 4, NET_DECNET_TIME_WAIT = 5, NET_DECNET_DN_COUNT = 6, NET_DECNET_DI_COUNT = 7, NET_DECNET_DR_COUNT = 8, NET_DECNET_DST_GC_INTERVAL = 9, NET_DECNET_CONF = 10, NET_DECNET_NO_FC_MAX_CWND = 11, NET_DECNET_MEM = 12, NET_DECNET_RMEM = 13, NET_DECNET_WMEM = 14, NET_DECNET_DEBUG_LEVEL = 255 }; /* /proc/sys/net/decnet/conf/<dev> */ enum { NET_DECNET_CONF_LOOPBACK = -2, NET_DECNET_CONF_DDCMP = -3, NET_DECNET_CONF_PPP = -4, NET_DECNET_CONF_X25 = -5, NET_DECNET_CONF_GRE = -6, NET_DECNET_CONF_ETHER = -7 /* ... and ifindex of devices */ }; /* /proc/sys/net/decnet/conf/<dev>/ */ enum { NET_DECNET_CONF_DEV_PRIORITY = 1, NET_DECNET_CONF_DEV_T1 = 2, NET_DECNET_CONF_DEV_T2 = 3, NET_DECNET_CONF_DEV_T3 = 4, NET_DECNET_CONF_DEV_FORWARDING = 5, NET_DECNET_CONF_DEV_BLKSIZE = 6, NET_DECNET_CONF_DEV_STATE = 7 }; /* /proc/sys/net/sctp */ enum { NET_SCTP_RTO_INITIAL = 1, NET_SCTP_RTO_MIN = 2, NET_SCTP_RTO_MAX = 3, NET_SCTP_RTO_ALPHA = 4, NET_SCTP_RTO_BETA = 5, NET_SCTP_VALID_COOKIE_LIFE = 6, NET_SCTP_ASSOCIATION_MAX_RETRANS = 7, NET_SCTP_PATH_MAX_RETRANS = 8, NET_SCTP_MAX_INIT_RETRANSMITS = 9, NET_SCTP_HB_INTERVAL = 10, NET_SCTP_PRESERVE_ENABLE = 11, NET_SCTP_MAX_BURST = 12, NET_SCTP_ADDIP_ENABLE = 13, NET_SCTP_PRSCTP_ENABLE = 14, NET_SCTP_SNDBUF_POLICY = 15, NET_SCTP_SACK_TIMEOUT = 16, NET_SCTP_RCVBUF_POLICY = 17, }; /* /proc/sys/net/bridge */ enum { NET_BRIDGE_NF_CALL_ARPTABLES = 1, NET_BRIDGE_NF_CALL_IPTABLES = 2, NET_BRIDGE_NF_CALL_IP6TABLES = 3, NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4, NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5, }; /* CTL_FS names: */ enum { FS_NRINODE=1, /* int:current number of allocated inodes */ FS_STATINODE=2, FS_MAXINODE=3, /* int:maximum number of inodes that can be allocated */ FS_NRDQUOT=4, /* int:current number of allocated dquots */ FS_MAXDQUOT=5, /* int:maximum number of dquots that can be allocated */ FS_NRFILE=6, /* int:current number of allocated filedescriptors */ FS_MAXFILE=7, /* int:maximum number of filedescriptors that can be allocated */ FS_DENTRY=8, FS_NRSUPER=9, /* int:current number of allocated super_blocks */ FS_MAXSUPER=10, /* int:maximum number of super_blocks that can be allocated */ FS_OVERFLOWUID=11, /* int: overflow UID */ FS_OVERFLOWGID=12, /* int: overflow GID */ FS_LEASES=13, /* int: leases enabled */ FS_DIR_NOTIFY=14, /* int: directory notification enabled */ FS_LEASE_TIME=15, /* int: maximum time to wait for a lease break */ FS_DQSTATS=16, /* disc quota usage statistics and control */ FS_XFS=17, /* struct: control xfs parameters */ FS_AIO_NR=18, /* current system-wide number of aio requests */ FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */ FS_INOTIFY=20, /* inotify submenu */ FS_OCFS2=988, /* ocfs2 */ }; /* /proc/sys/fs/quota/ */ enum { FS_DQ_LOOKUPS = 1, FS_DQ_DROPS = 2, FS_DQ_READS = 3, FS_DQ_WRITES = 4, FS_DQ_CACHE_HITS = 5, FS_DQ_ALLOCATED = 6, FS_DQ_FREE = 7, FS_DQ_SYNCS = 8, FS_DQ_WARNINGS = 9, }; /* CTL_DEBUG names: */ /* CTL_DEV names: */ enum { DEV_CDROM=1, DEV_HWMON=2, DEV_PARPORT=3, DEV_RAID=4, DEV_MAC_HID=5, DEV_SCSI=6, DEV_IPMI=7, }; /* /proc/sys/dev/cdrom */ enum { DEV_CDROM_INFO=1, DEV_CDROM_AUTOCLOSE=2, DEV_CDROM_AUTOEJECT=3, DEV_CDROM_DEBUG=4, DEV_CDROM_LOCK=5, DEV_CDROM_CHECK_MEDIA=6 }; /* /proc/sys/dev/parport */ enum { DEV_PARPORT_DEFAULT=-3 }; /* /proc/sys/dev/raid */ enum { DEV_RAID_SPEED_LIMIT_MIN=1, DEV_RAID_SPEED_LIMIT_MAX=2 }; /* /proc/sys/dev/parport/default */ enum { DEV_PARPORT_DEFAULT_TIMESLICE=1, DEV_PARPORT_DEFAULT_SPINTIME=2 }; /* /proc/sys/dev/parport/parport n */ enum { DEV_PARPORT_SPINTIME=1, DEV_PARPORT_BASE_ADDR=2, DEV_PARPORT_IRQ=3, DEV_PARPORT_DMA=4, DEV_PARPORT_MODES=5, DEV_PARPORT_DEVICES=6, DEV_PARPORT_AUTOPROBE=16 }; /* /proc/sys/dev/parport/parport n/devices/ */ enum { DEV_PARPORT_DEVICES_ACTIVE=-3, }; /* /proc/sys/dev/parport/parport n/devices/device n */ enum { DEV_PARPORT_DEVICE_TIMESLICE=1, }; /* /proc/sys/dev/mac_hid */ enum { DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES=1, DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES=2, DEV_MAC_HID_MOUSE_BUTTON_EMULATION=3, DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE=4, DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE=5, DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6 }; /* /proc/sys/dev/scsi */ enum { DEV_SCSI_LOGGING_LEVEL=1, }; /* /proc/sys/dev/ipmi */ enum { DEV_IPMI_POWEROFF_POWERCYCLE=1, }; /* /proc/sys/abi */ enum { ABI_DEFHANDLER_COFF=1, /* default handler for coff binaries */ ABI_DEFHANDLER_ELF=2, /* default handler for ELF binaries */ ABI_DEFHANDLER_LCALL7=3,/* default handler for procs using lcall7 */ ABI_DEFHANDLER_LIBCSO=4,/* default handler for an libc.so ELF interp */ ABI_TRACE=5, /* tracing flags */ ABI_FAKE_UTSNAME=6, /* fake target utsname information */ }; #endif /* _LINUX_SYSCTL_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/dlm.h�����������������������������������������������������������������������������������������0000644�����������������00000004771�14763166027�0006655 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /****************************************************************************** ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. ** Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions ** of the GNU General Public License v.2. ** ******************************************************************************* ******************************************************************************/ #ifndef __DLM_DOT_H__ #define __DLM_DOT_H__ /* * Interface to Distributed Lock Manager (DLM) * routines and structures to use DLM lockspaces */ /* Lock levels and flags are here */ #include <linux/dlmconstants.h> #include <linux/types.h> typedef void dlm_lockspace_t; /* * Lock status block * * Use this structure to specify the contents of the lock value block. For a * conversion request, this structure is used to specify the lock ID of the * lock. DLM writes the status of the lock request and the lock ID assigned * to the request in the lock status block. * * sb_lkid: the returned lock ID. It is set on new (non-conversion) requests. * It is available when dlm_lock returns. * * sb_lvbptr: saves or returns the contents of the lock's LVB according to rules * shown for the DLM_LKF_VALBLK flag. * * sb_flags: DLM_SBF_DEMOTED is returned if in the process of promoting a lock, * it was first demoted to NL to avoid conversion deadlock. * DLM_SBF_VALNOTVALID is returned if the resource's LVB is marked invalid. * * sb_status: the returned status of the lock request set prior to AST * execution. Possible return values: * * 0 if lock request was successful * -EAGAIN if request would block and is flagged DLM_LKF_NOQUEUE * -DLM_EUNLOCK if unlock request was successful * -DLM_ECANCEL if a cancel completed successfully * -EDEADLK if a deadlock was detected * -ETIMEDOUT if the lock request was canceled due to a timeout */ #define DLM_SBF_DEMOTED 0x01 #define DLM_SBF_VALNOTVALID 0x02 #define DLM_SBF_ALTMODE 0x04 struct dlm_lksb { int sb_status; __u32 sb_lkid; char sb_flags; char * sb_lvbptr; }; /* dlm_new_lockspace() flags */ #define DLM_LSFL_TIMEWARN 0x00000002 #define DLM_LSFL_FS 0x00000004 #define DLM_LSFL_NEWEXCL 0x00000008 #endif /* __DLM_DOT_H__ */ �������linux/mqueue.h��������������������������������������������������������������������������������������0000644�����������������00000004231�14763166027�0007371 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* Copyright (C) 2003 Krzysztof Benedyczak & Michal Wronski This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. It 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this software; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _LINUX_MQUEUE_H #define _LINUX_MQUEUE_H #include <linux/types.h> #define MQ_PRIO_MAX 32768 /* per-uid limit of kernel memory used by mqueue, in bytes */ #define MQ_BYTES_MAX 819200 struct mq_attr { __kernel_long_t mq_flags; /* message queue flags */ __kernel_long_t mq_maxmsg; /* maximum number of messages */ __kernel_long_t mq_msgsize; /* maximum message size */ __kernel_long_t mq_curmsgs; /* number of messages currently queued */ __kernel_long_t __reserved[4]; /* ignored for input, zeroed for output */ }; /* * SIGEV_THREAD implementation: * SIGEV_THREAD must be implemented in user space. If SIGEV_THREAD is passed * to mq_notify, then * - sigev_signo must be the file descriptor of an AF_NETLINK socket. It's not * necessary that the socket is bound. * - sigev_value.sival_ptr must point to a cookie that is NOTIFY_COOKIE_LEN * bytes long. * If the notification is triggered, then the cookie is sent to the netlink * socket. The last byte of the cookie is replaced with the NOTIFY_?? codes: * NOTIFY_WOKENUP if the notification got triggered, NOTIFY_REMOVED if it was * removed, either due to a close() on the message queue fd or due to a * mq_notify() that removed the notification. */ #define NOTIFY_NONE 0 #define NOTIFY_WOKENUP 1 #define NOTIFY_REMOVED 2 #define NOTIFY_COOKIE_LEN 32 #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/tls.h�����������������������������������������������������������������������������������������0000644�����������������00000005361�14763166027�0006677 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2016-2017, Mellanox Technologies. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef _LINUX_TLS_H #define _LINUX_TLS_H #include <linux/types.h> /* TLS socket options */ #define TLS_TX 1 /* Set transmit parameters */ #define TLS_RX 2 /* Set receive parameters */ /* Supported versions */ #define TLS_VERSION_MINOR(ver) ((ver) & 0xFF) #define TLS_VERSION_MAJOR(ver) (((ver) >> 8) & 0xFF) #define TLS_VERSION_NUMBER(id) ((((id##_VERSION_MAJOR) & 0xFF) << 8) | \ ((id##_VERSION_MINOR) & 0xFF)) #define TLS_1_2_VERSION_MAJOR 0x3 #define TLS_1_2_VERSION_MINOR 0x3 #define TLS_1_2_VERSION TLS_VERSION_NUMBER(TLS_1_2) /* Supported ciphers */ #define TLS_CIPHER_AES_GCM_128 51 #define TLS_CIPHER_AES_GCM_128_IV_SIZE 8 #define TLS_CIPHER_AES_GCM_128_KEY_SIZE 16 #define TLS_CIPHER_AES_GCM_128_SALT_SIZE 4 #define TLS_CIPHER_AES_GCM_128_TAG_SIZE 16 #define TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE 8 #define TLS_SET_RECORD_TYPE 1 #define TLS_GET_RECORD_TYPE 2 struct tls_crypto_info { __u16 version; __u16 cipher_type; }; struct tls12_crypto_info_aes_gcm_128 { struct tls_crypto_info info; unsigned char iv[TLS_CIPHER_AES_GCM_128_IV_SIZE]; unsigned char key[TLS_CIPHER_AES_GCM_128_KEY_SIZE]; unsigned char salt[TLS_CIPHER_AES_GCM_128_SALT_SIZE]; unsigned char rec_seq[TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE]; }; #endif /* _LINUX_TLS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/psci.h����������������������������������������������������������������������������������������0000644�����������������00000007727�14763166027�0007043 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ARM Power State and Coordination Interface (PSCI) header * * This header holds common PSCI defines and macros shared * by: ARM kernel, ARM64 kernel, KVM ARM/ARM64 and user space. * * Copyright (C) 2014 Linaro Ltd. * Author: Anup Patel <anup.patel@linaro.org> */ #ifndef _LINUX_PSCI_H #define _LINUX_PSCI_H /* * PSCI v0.1 interface * * The PSCI v0.1 function numbers are implementation defined. * * Only PSCI return values such as: SUCCESS, NOT_SUPPORTED, * INVALID_PARAMS, and DENIED defined below are applicable * to PSCI v0.1. */ /* PSCI v0.2 interface */ #define PSCI_0_2_FN_BASE 0x84000000 #define PSCI_0_2_FN(n) (PSCI_0_2_FN_BASE + (n)) #define PSCI_0_2_64BIT 0x40000000 #define PSCI_0_2_FN64_BASE \ (PSCI_0_2_FN_BASE + PSCI_0_2_64BIT) #define PSCI_0_2_FN64(n) (PSCI_0_2_FN64_BASE + (n)) #define PSCI_0_2_FN_PSCI_VERSION PSCI_0_2_FN(0) #define PSCI_0_2_FN_CPU_SUSPEND PSCI_0_2_FN(1) #define PSCI_0_2_FN_CPU_OFF PSCI_0_2_FN(2) #define PSCI_0_2_FN_CPU_ON PSCI_0_2_FN(3) #define PSCI_0_2_FN_AFFINITY_INFO PSCI_0_2_FN(4) #define PSCI_0_2_FN_MIGRATE PSCI_0_2_FN(5) #define PSCI_0_2_FN_MIGRATE_INFO_TYPE PSCI_0_2_FN(6) #define PSCI_0_2_FN_MIGRATE_INFO_UP_CPU PSCI_0_2_FN(7) #define PSCI_0_2_FN_SYSTEM_OFF PSCI_0_2_FN(8) #define PSCI_0_2_FN_SYSTEM_RESET PSCI_0_2_FN(9) #define PSCI_0_2_FN64_CPU_SUSPEND PSCI_0_2_FN64(1) #define PSCI_0_2_FN64_CPU_ON PSCI_0_2_FN64(3) #define PSCI_0_2_FN64_AFFINITY_INFO PSCI_0_2_FN64(4) #define PSCI_0_2_FN64_MIGRATE PSCI_0_2_FN64(5) #define PSCI_0_2_FN64_MIGRATE_INFO_UP_CPU PSCI_0_2_FN64(7) #define PSCI_1_0_FN_PSCI_FEATURES PSCI_0_2_FN(10) #define PSCI_1_0_FN_SYSTEM_SUSPEND PSCI_0_2_FN(14) #define PSCI_1_0_FN64_SYSTEM_SUSPEND PSCI_0_2_FN64(14) /* PSCI v0.2 power state encoding for CPU_SUSPEND function */ #define PSCI_0_2_POWER_STATE_ID_MASK 0xffff #define PSCI_0_2_POWER_STATE_ID_SHIFT 0 #define PSCI_0_2_POWER_STATE_TYPE_SHIFT 16 #define PSCI_0_2_POWER_STATE_TYPE_MASK \ (0x1 << PSCI_0_2_POWER_STATE_TYPE_SHIFT) #define PSCI_0_2_POWER_STATE_AFFL_SHIFT 24 #define PSCI_0_2_POWER_STATE_AFFL_MASK \ (0x3 << PSCI_0_2_POWER_STATE_AFFL_SHIFT) /* PSCI extended power state encoding for CPU_SUSPEND function */ #define PSCI_1_0_EXT_POWER_STATE_ID_MASK 0xfffffff #define PSCI_1_0_EXT_POWER_STATE_ID_SHIFT 0 #define PSCI_1_0_EXT_POWER_STATE_TYPE_SHIFT 30 #define PSCI_1_0_EXT_POWER_STATE_TYPE_MASK \ (0x1 << PSCI_1_0_EXT_POWER_STATE_TYPE_SHIFT) /* PSCI v0.2 affinity level state returned by AFFINITY_INFO */ #define PSCI_0_2_AFFINITY_LEVEL_ON 0 #define PSCI_0_2_AFFINITY_LEVEL_OFF 1 #define PSCI_0_2_AFFINITY_LEVEL_ON_PENDING 2 /* PSCI v0.2 multicore support in Trusted OS returned by MIGRATE_INFO_TYPE */ #define PSCI_0_2_TOS_UP_MIGRATE 0 #define PSCI_0_2_TOS_UP_NO_MIGRATE 1 #define PSCI_0_2_TOS_MP 2 /* PSCI version decoding (independent of PSCI version) */ #define PSCI_VERSION_MAJOR_SHIFT 16 #define PSCI_VERSION_MINOR_MASK \ ((1U << PSCI_VERSION_MAJOR_SHIFT) - 1) #define PSCI_VERSION_MAJOR_MASK ~PSCI_VERSION_MINOR_MASK #define PSCI_VERSION_MAJOR(ver) \ (((ver) & PSCI_VERSION_MAJOR_MASK) >> PSCI_VERSION_MAJOR_SHIFT) #define PSCI_VERSION_MINOR(ver) \ ((ver) & PSCI_VERSION_MINOR_MASK) #define PSCI_VERSION(maj, min) \ ((((maj) << PSCI_VERSION_MAJOR_SHIFT) & PSCI_VERSION_MAJOR_MASK) | \ ((min) & PSCI_VERSION_MINOR_MASK)) /* PSCI features decoding (>=1.0) */ #define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT 1 #define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK \ (0x1 << PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT) /* PSCI return values (inclusive of all PSCI versions) */ #define PSCI_RET_SUCCESS 0 #define PSCI_RET_NOT_SUPPORTED -1 #define PSCI_RET_INVALID_PARAMS -2 #define PSCI_RET_DENIED -3 #define PSCI_RET_ALREADY_ON -4 #define PSCI_RET_ON_PENDING -5 #define PSCI_RET_INTERNAL_FAILURE -6 #define PSCI_RET_NOT_PRESENT -7 #define PSCI_RET_DISABLED -8 #define PSCI_RET_INVALID_ADDRESS -9 #endif /* _LINUX_PSCI_H */ �����������������������������������������linux/in_route.h������������������������������������������������������������������������������������0000644�����������������00000001650�14763166027�0007716 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_IN_ROUTE_H #define _LINUX_IN_ROUTE_H /* IPv4 routing cache flags */ #define RTCF_DEAD RTNH_F_DEAD #define RTCF_ONLINK RTNH_F_ONLINK /* Obsolete flag. About to be deleted */ #define RTCF_NOPMTUDISC RTM_F_NOPMTUDISC #define RTCF_NOTIFY 0x00010000 #define RTCF_DIRECTDST 0x00020000 /* unused */ #define RTCF_REDIRECTED 0x00040000 #define RTCF_TPROXY 0x00080000 /* unused */ #define RTCF_FAST 0x00200000 /* unused */ #define RTCF_MASQ 0x00400000 /* unused */ #define RTCF_SNAT 0x00800000 /* unused */ #define RTCF_DOREDIRECT 0x01000000 #define RTCF_DIRECTSRC 0x04000000 #define RTCF_DNAT 0x08000000 #define RTCF_BROADCAST 0x10000000 #define RTCF_MULTICAST 0x20000000 #define RTCF_REJECT 0x40000000 /* unused */ #define RTCF_LOCAL 0x80000000 #define RTCF_NAT (RTCF_DNAT|RTCF_SNAT) #define RT_TOS(tos) ((tos)&IPTOS_TOS_MASK) #endif /* _LINUX_IN_ROUTE_H */ ����������������������������������������������������������������������������������������linux/gfs2_ondisk.h���������������������������������������������������������������������������������0000644�����������������00000034473�14763166027�0010313 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. * * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions * of the GNU General Public License v.2. */ #ifndef __GFS2_ONDISK_DOT_H__ #define __GFS2_ONDISK_DOT_H__ #include <linux/types.h> #define GFS2_MAGIC 0x01161970 #define GFS2_BASIC_BLOCK 512 #define GFS2_BASIC_BLOCK_SHIFT 9 /* Lock numbers of the LM_TYPE_NONDISK type */ #define GFS2_MOUNT_LOCK 0 #define GFS2_LIVE_LOCK 1 #define GFS2_FREEZE_LOCK 2 #define GFS2_RENAME_LOCK 3 #define GFS2_CONTROL_LOCK 4 #define GFS2_MOUNTED_LOCK 5 /* Format numbers for various metadata types */ #define GFS2_FORMAT_NONE 0 #define GFS2_FORMAT_SB 100 #define GFS2_FORMAT_RG 200 #define GFS2_FORMAT_RB 300 #define GFS2_FORMAT_DI 400 #define GFS2_FORMAT_IN 500 #define GFS2_FORMAT_LF 600 #define GFS2_FORMAT_JD 700 #define GFS2_FORMAT_LH 800 #define GFS2_FORMAT_LD 900 #define GFS2_FORMAT_LB 1000 #define GFS2_FORMAT_EA 1600 #define GFS2_FORMAT_ED 1700 #define GFS2_FORMAT_QC 1400 /* These are format numbers for entities contained in files */ #define GFS2_FORMAT_RI 1100 #define GFS2_FORMAT_DE 1200 #define GFS2_FORMAT_QU 1500 /* These are part of the superblock */ #define GFS2_FORMAT_FS 1801 #define GFS2_FORMAT_MULTI 1900 /* * An on-disk inode number */ struct gfs2_inum { __be64 no_formal_ino; __be64 no_addr; }; /* * Generic metadata head structure * Every inplace buffer logged in the journal must start with this. */ #define GFS2_METATYPE_NONE 0 #define GFS2_METATYPE_SB 1 #define GFS2_METATYPE_RG 2 #define GFS2_METATYPE_RB 3 #define GFS2_METATYPE_DI 4 #define GFS2_METATYPE_IN 5 #define GFS2_METATYPE_LF 6 #define GFS2_METATYPE_JD 7 #define GFS2_METATYPE_LH 8 #define GFS2_METATYPE_LD 9 #define GFS2_METATYPE_LB 12 #define GFS2_METATYPE_EA 10 #define GFS2_METATYPE_ED 11 #define GFS2_METATYPE_QC 14 struct gfs2_meta_header { __be32 mh_magic; __be32 mh_type; __be64 __pad0; /* Was generation number in gfs1 */ __be32 mh_format; /* This union is to keep userspace happy */ union { __be32 mh_jid; /* Was incarnation number in gfs1 */ __be32 __pad1; }; }; /* * super-block structure * * It's probably good if SIZEOF_SB <= GFS2_BASIC_BLOCK (512 bytes) * * Order is important, need to be able to read old superblocks to do on-disk * version upgrades. */ /* Address of superblock in GFS2 basic blocks */ #define GFS2_SB_ADDR 128 /* The lock number for the superblock (must be zero) */ #define GFS2_SB_LOCK 0 /* Requirement: GFS2_LOCKNAME_LEN % 8 == 0 Includes: the fencing zero at the end */ #define GFS2_LOCKNAME_LEN 64 struct gfs2_sb { struct gfs2_meta_header sb_header; __be32 sb_fs_format; __be32 sb_multihost_format; __u32 __pad0; /* Was superblock flags in gfs1 */ __be32 sb_bsize; __be32 sb_bsize_shift; __u32 __pad1; /* Was journal segment size in gfs1 */ struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */ struct gfs2_inum __pad2; /* Was rindex dinode in gfs1 */ struct gfs2_inum sb_root_dir; char sb_lockproto[GFS2_LOCKNAME_LEN]; char sb_locktable[GFS2_LOCKNAME_LEN]; struct gfs2_inum __pad3; /* Was quota inode in gfs1 */ struct gfs2_inum __pad4; /* Was licence inode in gfs1 */ #define GFS2_HAS_UUID 1 __u8 sb_uuid[16]; /* The UUID, maybe 0 for backwards compat */ }; /* * resource index structure */ struct gfs2_rindex { __be64 ri_addr; /* grp block disk address */ __be32 ri_length; /* length of rgrp header in fs blocks */ __u32 __pad; __be64 ri_data0; /* first data location */ __be32 ri_data; /* num of data blocks in rgrp */ __be32 ri_bitbytes; /* number of bytes in data bitmaps */ __u8 ri_reserved[64]; }; /* * resource group header structure */ /* Number of blocks per byte in rgrp */ #define GFS2_NBBY 4 #define GFS2_BIT_SIZE 2 #define GFS2_BIT_MASK 0x00000003 #define GFS2_BLKST_FREE 0 #define GFS2_BLKST_USED 1 #define GFS2_BLKST_UNLINKED 2 #define GFS2_BLKST_DINODE 3 #define GFS2_RGF_JOURNAL 0x00000001 #define GFS2_RGF_METAONLY 0x00000002 #define GFS2_RGF_DATAONLY 0x00000004 #define GFS2_RGF_NOALLOC 0x00000008 #define GFS2_RGF_TRIMMED 0x00000010 struct gfs2_rgrp_lvb { __be32 rl_magic; __be32 rl_flags; __be32 rl_free; __be32 rl_dinodes; __be64 rl_igeneration; __be32 rl_unlinked; __be32 __pad; }; struct gfs2_rgrp { struct gfs2_meta_header rg_header; __be32 rg_flags; __be32 rg_free; __be32 rg_dinodes; union { __be32 __pad; __be32 rg_skip; /* Distance to the next rgrp in fs blocks */ }; __be64 rg_igeneration; /* The following 3 fields are duplicated from gfs2_rindex to reduce reliance on the rindex */ __be64 rg_data0; /* First data location */ __be32 rg_data; /* Number of data blocks in rgrp */ __be32 rg_bitbytes; /* Number of bytes in data bitmaps */ __be32 rg_crc; /* crc32 of the structure with this field 0 */ __u8 rg_reserved[60]; /* Several fields from gfs1 now reserved */ }; /* * quota structure */ struct gfs2_quota { __be64 qu_limit; __be64 qu_warn; __be64 qu_value; __u8 qu_reserved[64]; }; /* * dinode structure */ #define GFS2_MAX_META_HEIGHT 10 #define GFS2_DIR_MAX_DEPTH 17 #define DT2IF(dt) (((dt) << 12) & S_IFMT) #define IF2DT(sif) (((sif) & S_IFMT) >> 12) enum { gfs2fl_Jdata = 0, gfs2fl_ExHash = 1, gfs2fl_Unused = 2, gfs2fl_EaIndirect = 3, gfs2fl_Directio = 4, gfs2fl_Immutable = 5, gfs2fl_AppendOnly = 6, gfs2fl_NoAtime = 7, gfs2fl_Sync = 8, gfs2fl_System = 9, gfs2fl_TopLevel = 10, gfs2fl_TruncInProg = 29, gfs2fl_InheritDirectio = 30, gfs2fl_InheritJdata = 31, }; /* Dinode flags */ #define GFS2_DIF_JDATA 0x00000001 #define GFS2_DIF_EXHASH 0x00000002 #define GFS2_DIF_UNUSED 0x00000004 /* only in gfs1 */ #define GFS2_DIF_EA_INDIRECT 0x00000008 #define GFS2_DIF_DIRECTIO 0x00000010 #define GFS2_DIF_IMMUTABLE 0x00000020 #define GFS2_DIF_APPENDONLY 0x00000040 #define GFS2_DIF_NOATIME 0x00000080 #define GFS2_DIF_SYNC 0x00000100 #define GFS2_DIF_SYSTEM 0x00000200 /* New in gfs2 */ #define GFS2_DIF_TOPDIR 0x00000400 /* New in gfs2 */ #define GFS2_DIF_TRUNC_IN_PROG 0x20000000 /* New in gfs2 */ #define GFS2_DIF_INHERIT_DIRECTIO 0x40000000 /* only in gfs1 */ #define GFS2_DIF_INHERIT_JDATA 0x80000000 struct gfs2_dinode { struct gfs2_meta_header di_header; struct gfs2_inum di_num; __be32 di_mode; /* mode of file */ __be32 di_uid; /* owner's user id */ __be32 di_gid; /* owner's group id */ __be32 di_nlink; /* number of links to this file */ __be64 di_size; /* number of bytes in file */ __be64 di_blocks; /* number of blocks in file */ __be64 di_atime; /* time last accessed */ __be64 di_mtime; /* time last modified */ __be64 di_ctime; /* time last changed */ __be32 di_major; /* device major number */ __be32 di_minor; /* device minor number */ /* This section varies from gfs1. Padding added to align with * remainder of dinode */ __be64 di_goal_meta; /* rgrp to alloc from next */ __be64 di_goal_data; /* data block goal */ __be64 di_generation; /* generation number for NFS */ __be32 di_flags; /* GFS2_DIF_... */ __be32 di_payload_format; /* GFS2_FORMAT_... */ __u16 __pad1; /* Was ditype in gfs1 */ __be16 di_height; /* height of metadata */ __u32 __pad2; /* Unused incarnation number from gfs1 */ /* These only apply to directories */ __u16 __pad3; /* Padding */ __be16 di_depth; /* Number of bits in the table */ __be32 di_entries; /* The number of entries in the directory */ struct gfs2_inum __pad4; /* Unused even in current gfs1 */ __be64 di_eattr; /* extended attribute block number */ __be32 di_atime_nsec; /* nsec portion of atime */ __be32 di_mtime_nsec; /* nsec portion of mtime */ __be32 di_ctime_nsec; /* nsec portion of ctime */ __u8 di_reserved[44]; }; /* * directory structure - many of these per directory file */ #define GFS2_FNAMESIZE 255 #define GFS2_DIRENT_SIZE(name_len) ((sizeof(struct gfs2_dirent) + (name_len) + 7) & ~7) #define GFS2_MIN_DIRENT_SIZE (GFS2_DIRENT_SIZE(1)) struct gfs2_dirent { struct gfs2_inum de_inum; __be32 de_hash; __be16 de_rec_len; __be16 de_name_len; __be16 de_type; __be16 de_rahead; union { __u8 __pad[12]; struct { __u32 de_cookie; /* ondisk value not used */ __u8 pad3[8]; }; }; }; /* * Header of leaf directory nodes */ struct gfs2_leaf { struct gfs2_meta_header lf_header; __be16 lf_depth; /* Depth of leaf */ __be16 lf_entries; /* Number of dirents in leaf */ __be32 lf_dirent_format; /* Format of the dirents */ __be64 lf_next; /* Next leaf, if overflow */ union { __u8 lf_reserved[64]; struct { __be64 lf_inode; /* Dir inode number */ __be32 lf_dist; /* Dist from inode on chain */ __be32 lf_nsec; /* Last ins/del usecs */ __be64 lf_sec; /* Last ins/del in secs */ __u8 lf_reserved2[40]; }; }; }; /* * Extended attribute header format * * This works in a similar way to dirents. There is a fixed size header * followed by a variable length section made up of the name and the * associated data. In the case of a "stuffed" entry, the value is * __inline__ directly after the name, the ea_num_ptrs entry will be * zero in that case. For non-"stuffed" entries, there will be * a set of pointers (aligned to 8 byte boundary) to the block(s) * containing the value. * * The blocks containing the values and the blocks containing the * extended attribute headers themselves all start with the common * metadata header. Each inode, if it has extended attributes, will * have either a single block containing the extended attribute headers * or a single indirect block pointing to blocks containing the * extended attribute headers. * * The maximum size of the data part of an extended attribute is 64k * so the number of blocks required depends upon block size. Since the * block size also determines the number of pointers in an indirect * block, its a fairly complicated calculation to work out the maximum * number of blocks that an inode may have relating to extended attributes. * */ #define GFS2_EA_MAX_NAME_LEN 255 #define GFS2_EA_MAX_DATA_LEN 65536 #define GFS2_EATYPE_UNUSED 0 #define GFS2_EATYPE_USR 1 #define GFS2_EATYPE_SYS 2 #define GFS2_EATYPE_SECURITY 3 #define GFS2_EATYPE_LAST 3 #define GFS2_EATYPE_VALID(x) ((x) <= GFS2_EATYPE_LAST) #define GFS2_EAFLAG_LAST 0x01 /* last ea in block */ struct gfs2_ea_header { __be32 ea_rec_len; __be32 ea_data_len; __u8 ea_name_len; /* no NULL pointer after the string */ __u8 ea_type; /* GFS2_EATYPE_... */ __u8 ea_flags; /* GFS2_EAFLAG_... */ __u8 ea_num_ptrs; __u32 __pad; }; /* * Log header structure */ #define GFS2_LOG_HEAD_UNMOUNT 0x00000001 /* log is clean */ #define GFS2_LOG_HEAD_FLUSH_NORMAL 0x00000002 /* normal log flush */ #define GFS2_LOG_HEAD_FLUSH_SYNC 0x00000004 /* Sync log flush */ #define GFS2_LOG_HEAD_FLUSH_SHUTDOWN 0x00000008 /* Shutdown log flush */ #define GFS2_LOG_HEAD_FLUSH_FREEZE 0x00000010 /* Freeze flush */ #define GFS2_LOG_HEAD_RECOVERY 0x00000020 /* Journal recovery */ #define GFS2_LOG_HEAD_USERSPACE 0x80000000 /* Written by gfs2-utils */ /* Log flush callers */ #define GFS2_LFC_SHUTDOWN 0x00000100 #define GFS2_LFC_JDATA_WPAGES 0x00000200 #define GFS2_LFC_SET_FLAGS 0x00000400 #define GFS2_LFC_AIL_EMPTY_GL 0x00000800 #define GFS2_LFC_AIL_FLUSH 0x00001000 #define GFS2_LFC_RGRP_GO_SYNC 0x00002000 #define GFS2_LFC_INODE_GO_SYNC 0x00004000 #define GFS2_LFC_INODE_GO_INVAL 0x00008000 #define GFS2_LFC_FREEZE_GO_SYNC 0x00010000 #define GFS2_LFC_KILL_SB 0x00020000 #define GFS2_LFC_DO_SYNC 0x00040000 #define GFS2_LFC_INPLACE_RESERVE 0x00080000 #define GFS2_LFC_WRITE_INODE 0x00100000 #define GFS2_LFC_MAKE_FS_RO 0x00200000 #define GFS2_LFC_SYNC_FS 0x00400000 #define GFS2_LFC_EVICT_INODE 0x00800000 #define GFS2_LFC_TRANS_END 0x01000000 #define GFS2_LFC_LOGD_JFLUSH_REQD 0x02000000 #define GFS2_LFC_LOGD_AIL_FLUSH_REQD 0x04000000 #define LH_V1_SIZE (offsetofend(struct gfs2_log_header, lh_hash)) struct gfs2_log_header { struct gfs2_meta_header lh_header; __be64 lh_sequence; /* Sequence number of this transaction */ __be32 lh_flags; /* GFS2_LOG_HEAD_... */ __be32 lh_tail; /* Block number of log tail */ __be32 lh_blkno; __be32 lh_hash; /* crc up to here with this field 0 */ /* Version 2 additional fields start here */ __be32 lh_crc; /* crc32c from lh_nsec to end of block */ __be32 lh_nsec; /* Nanoseconds of timestamp */ __be64 lh_sec; /* Seconds of timestamp */ __be64 lh_addr; /* Block addr of this log header (absolute) */ __be64 lh_jinode; /* Journal inode number */ __be64 lh_statfs_addr; /* Local statfs inode number */ __be64 lh_quota_addr; /* Local quota change inode number */ /* Statfs local changes (i.e. diff from global statfs) */ __be64 lh_local_total; __be64 lh_local_free; __be64 lh_local_dinodes; }; /* * Log type descriptor */ #define GFS2_LOG_DESC_METADATA 300 /* ld_data1 is the number of metadata blocks in the descriptor. ld_data2 is unused. */ #define GFS2_LOG_DESC_REVOKE 301 /* ld_data1 is the number of revoke blocks in the descriptor. ld_data2 is unused. */ #define GFS2_LOG_DESC_JDATA 302 /* ld_data1 is the number of data blocks in the descriptor. ld_data2 is unused. */ struct gfs2_log_descriptor { struct gfs2_meta_header ld_header; __be32 ld_type; /* GFS2_LOG_DESC_... */ __be32 ld_length; /* Number of buffers in this chunk */ __be32 ld_data1; /* descriptor-specific field */ __be32 ld_data2; /* descriptor-specific field */ __u8 ld_reserved[32]; }; /* * Inum Range * Describe a range of formal inode numbers allocated to * one machine to assign to inodes. */ #define GFS2_INUM_QUANTUM 1048576 struct gfs2_inum_range { __be64 ir_start; __be64 ir_length; }; /* * Statfs change * Describes an change to the pool of free and allocated * blocks. */ struct gfs2_statfs_change { __be64 sc_total; __be64 sc_free; __be64 sc_dinodes; }; /* * Quota change * Describes an allocation change for a particular * user or group. */ #define GFS2_QCF_USER 0x00000001 struct gfs2_quota_change { __be64 qc_change; __be32 qc_flags; /* GFS2_QCF_... */ __be32 qc_id; }; struct gfs2_quota_lvb { __be32 qb_magic; __u32 __pad; __be64 qb_limit; /* Hard limit of # blocks to alloc */ __be64 qb_warn; /* Warn user when alloc is above this # */ __be64 qb_value; /* Current # blocks allocated */ }; #endif /* __GFS2_ONDISK_DOT_H__ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/dn.h������������������������������������������������������������������������������������������0000644�����������������00000011042�14763166027�0006467 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_DN_H #define _LINUX_DN_H #include <linux/ioctl.h> #include <linux/types.h> #include <linux/if_ether.h> /* DECnet Data Structures and Constants */ /* * DNPROTO_NSP can't be the same as SOL_SOCKET, * so increment each by one (compared to ULTRIX) */ #define DNPROTO_NSP 2 /* NSP protocol number */ #define DNPROTO_ROU 3 /* Routing protocol number */ #define DNPROTO_NML 4 /* Net mgt protocol number */ #define DNPROTO_EVL 5 /* Evl protocol number (usr) */ #define DNPROTO_EVR 6 /* Evl protocol number (evl) */ #define DNPROTO_NSPT 7 /* NSP trace protocol number */ #define DN_ADDL 2 #define DN_MAXADDL 2 /* ULTRIX headers have 20 here, but pathworks has 2 */ #define DN_MAXOPTL 16 #define DN_MAXOBJL 16 #define DN_MAXACCL 40 #define DN_MAXALIASL 128 #define DN_MAXNODEL 256 #define DNBUFSIZE 65023 /* * SET/GET Socket options - must match the DSO_ numbers below */ #define SO_CONDATA 1 #define SO_CONACCESS 2 #define SO_PROXYUSR 3 #define SO_LINKINFO 7 #define DSO_CONDATA 1 /* Set/Get connect data */ #define DSO_DISDATA 10 /* Set/Get disconnect data */ #define DSO_CONACCESS 2 /* Set/Get connect access data */ #define DSO_ACCEPTMODE 4 /* Set/Get accept mode */ #define DSO_CONACCEPT 5 /* Accept deferred connection */ #define DSO_CONREJECT 6 /* Reject deferred connection */ #define DSO_LINKINFO 7 /* Set/Get link information */ #define DSO_STREAM 8 /* Set socket type to stream */ #define DSO_SEQPACKET 9 /* Set socket type to sequenced packet */ #define DSO_MAXWINDOW 11 /* Maximum window size allowed */ #define DSO_NODELAY 12 /* Turn off nagle */ #define DSO_CORK 13 /* Wait for more data! */ #define DSO_SERVICES 14 /* NSP Services field */ #define DSO_INFO 15 /* NSP Info field */ #define DSO_MAX 15 /* Maximum option number */ /* LINK States */ #define LL_INACTIVE 0 #define LL_CONNECTING 1 #define LL_RUNNING 2 #define LL_DISCONNECTING 3 #define ACC_IMMED 0 #define ACC_DEFER 1 #define SDF_WILD 1 /* Wild card object */ #define SDF_PROXY 2 /* Addr eligible for proxy */ #define SDF_UICPROXY 4 /* Use uic-based proxy */ /* Structures */ struct dn_naddr { __le16 a_len; __u8 a_addr[DN_MAXADDL]; /* Two bytes little endian */ }; struct sockaddr_dn { __u16 sdn_family; __u8 sdn_flags; __u8 sdn_objnum; __le16 sdn_objnamel; __u8 sdn_objname[DN_MAXOBJL]; struct dn_naddr sdn_add; }; #define sdn_nodeaddrl sdn_add.a_len /* Node address length */ #define sdn_nodeaddr sdn_add.a_addr /* Node address */ /* * DECnet set/get DSO_CONDATA, DSO_DISDATA (optional data) structure */ struct optdata_dn { __le16 opt_status; /* Extended status return */ #define opt_sts opt_status __le16 opt_optl; /* Length of user data */ __u8 opt_data[16]; /* User data */ }; struct accessdata_dn { __u8 acc_accl; __u8 acc_acc[DN_MAXACCL]; __u8 acc_passl; __u8 acc_pass[DN_MAXACCL]; __u8 acc_userl; __u8 acc_user[DN_MAXACCL]; }; /* * DECnet logical link information structure */ struct linkinfo_dn { __u16 idn_segsize; /* Segment size for link */ __u8 idn_linkstate; /* Logical link state */ }; /* * Ethernet address format (for DECnet) */ union etheraddress { __u8 dne_addr[ETH_ALEN]; /* Full ethernet address */ struct { __u8 dne_hiord[4]; /* DECnet HIORD prefix */ __u8 dne_nodeaddr[2]; /* DECnet node address */ } dne_remote; }; /* * DECnet physical socket address format */ struct dn_addr { __le16 dna_family; /* AF_DECnet */ union etheraddress dna_netaddr; /* DECnet ethernet address */ }; #define DECNET_IOCTL_BASE 0x89 /* PROTOPRIVATE range */ #define SIOCSNETADDR _IOW(DECNET_IOCTL_BASE, 0xe0, struct dn_naddr) #define SIOCGNETADDR _IOR(DECNET_IOCTL_BASE, 0xe1, struct dn_naddr) #define OSIOCSNETADDR _IOW(DECNET_IOCTL_BASE, 0xe0, int) #define OSIOCGNETADDR _IOR(DECNET_IOCTL_BASE, 0xe1, int) #endif /* _LINUX_DN_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/const.h���������������������������������������������������������������������������������������0000644�����������������00000001737�14763166027�0007226 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* const.h: Macros for dealing with constants. */ #ifndef _LINUX_CONST_H #define _LINUX_CONST_H /* Some constant macros are used in both assembler and * C code. Therefore we cannot annotate them always with * 'UL' and other type specifiers unilaterally. We * use the following macros to deal with this. * * Similarly, _AT() will cast an expression with a type in C, but * leave it unchanged in asm. */ #ifdef __ASSEMBLY__ #define _AC(X,Y) X #define _AT(T,X) X #else #define __AC(X,Y) (X##Y) #define _AC(X,Y) __AC(X,Y) #define _AT(T,X) ((T)(X)) #endif #define _UL(x) (_AC(x, UL)) #define _ULL(x) (_AC(x, ULL)) #define _BITUL(x) (_UL(1) << (x)) #define _BITULL(x) (_ULL(1) << (x)) #define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1) #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) #endif /* _LINUX_CONST_H */ ���������������������������������linux/ipmi.h����������������������������������������������������������������������������������������0000644�����������������00000035311�14763166027�0007031 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * ipmi.h * * MontaVista IPMI interface * * Author: MontaVista Software, Inc. * Corey Minyard <minyard@mvista.com> * source@mvista.com * * Copyright 2002 MontaVista Software Inc. * */ #ifndef __LINUX_IPMI_H #define __LINUX_IPMI_H #include <linux/ipmi_msgdefs.h> /* * This file describes an interface to an IPMI driver. You have to * have a fairly good understanding of IPMI to use this, so go read * the specs first before actually trying to do anything. * * With that said, this driver provides a multi-user interface to the * IPMI driver, and it allows multiple IPMI physical interfaces below * the driver. The physical interfaces bind as a lower layer on the * driver. They appear as interfaces to the application using this * interface. * * Multi-user means that multiple applications may use the driver, * send commands, receive responses, etc. The driver keeps track of * commands the user sends and tracks the responses. The responses * will go back to the application that send the command. If the * response doesn't come back in time, the driver will return a * timeout error response to the application. Asynchronous events * from the BMC event queue will go to all users bound to the driver. * The incoming event queue in the BMC will automatically be flushed * if it becomes full and it is queried once a second to see if * anything is in it. Incoming commands to the driver will get * delivered as commands. */ /* * This is an overlay for all the address types, so it's easy to * determine the actual address type. This is kind of like addresses * work for sockets. */ #define IPMI_MAX_ADDR_SIZE 32 struct ipmi_addr { /* Try to take these from the "Channel Medium Type" table in section 6.5 of the IPMI 1.5 manual. */ int addr_type; short channel; char data[IPMI_MAX_ADDR_SIZE]; }; /* * When the address is not used, the type will be set to this value. * The channel is the BMC's channel number for the channel (usually * 0), or IPMC_BMC_CHANNEL if communicating directly with the BMC. */ #define IPMI_SYSTEM_INTERFACE_ADDR_TYPE 0x0c struct ipmi_system_interface_addr { int addr_type; short channel; unsigned char lun; }; /* An IPMB Address. */ #define IPMI_IPMB_ADDR_TYPE 0x01 /* Used for broadcast get device id as described in section 17.9 of the IPMI 1.5 manual. */ #define IPMI_IPMB_BROADCAST_ADDR_TYPE 0x41 struct ipmi_ipmb_addr { int addr_type; short channel; unsigned char slave_addr; unsigned char lun; }; /* * A LAN Address. This is an address to/from a LAN interface bridged * by the BMC, not an address actually out on the LAN. * * A conscious decision was made here to deviate slightly from the IPMI * spec. We do not use rqSWID and rsSWID like it shows in the * message. Instead, we use remote_SWID and local_SWID. This means * that any message (a request or response) from another device will * always have exactly the same address. If you didn't do this, * requests and responses from the same device would have different * addresses, and that's not too cool. * * In this address, the remote_SWID is always the SWID the remote * message came from, or the SWID we are sending the message to. * local_SWID is always our SWID. Note that having our SWID in the * message is a little weird, but this is required. */ #define IPMI_LAN_ADDR_TYPE 0x04 struct ipmi_lan_addr { int addr_type; short channel; unsigned char privilege; unsigned char session_handle; unsigned char remote_SWID; unsigned char local_SWID; unsigned char lun; }; /* * Channel for talking directly with the BMC. When using this * channel, This is for the system interface address type only. FIXME * - is this right, or should we use -1? */ #define IPMI_BMC_CHANNEL 0xf #define IPMI_NUM_CHANNELS 0x10 /* * Used to signify an "all channel" bitmask. This is more than the * actual number of channels because this is used in userland and * will cover us if the number of channels is extended. */ #define IPMI_CHAN_ALL (~0) /* * A raw IPMI message without any addressing. This covers both * commands and responses. The completion code is always the first * byte of data in the response (as the spec shows the messages laid * out). */ struct ipmi_msg { unsigned char netfn; unsigned char cmd; unsigned short data_len; unsigned char *data; }; struct kernel_ipmi_msg { unsigned char netfn; unsigned char cmd; unsigned short data_len; unsigned char *data; }; /* * Various defines that are useful for IPMI applications. */ #define IPMI_INVALID_CMD_COMPLETION_CODE 0xC1 #define IPMI_TIMEOUT_COMPLETION_CODE 0xC3 #define IPMI_UNKNOWN_ERR_COMPLETION_CODE 0xff /* * Receive types for messages coming from the receive interface. This * is used for the receive in-kernel interface and in the receive * IOCTL. * * The "IPMI_RESPONSE_RESPNOSE_TYPE" is a little strange sounding, but * it allows you to get the message results when you send a response * message. */ #define IPMI_RESPONSE_RECV_TYPE 1 /* A response to a command */ #define IPMI_ASYNC_EVENT_RECV_TYPE 2 /* Something from the event queue */ #define IPMI_CMD_RECV_TYPE 3 /* A command from somewhere else */ #define IPMI_RESPONSE_RESPONSE_TYPE 4 /* The response for a sent response, giving any error status for sending the response. When you send a response message, this will be returned. */ #define IPMI_OEM_RECV_TYPE 5 /* The response for OEM Channels */ /* Note that async events and received commands do not have a completion code as the first byte of the incoming data, unlike a response. */ /* * Modes for ipmi_set_maint_mode() and the userland IOCTL. The AUTO * setting is the default and means it will be set on certain * commands. Hard setting it on and off will override automatic * operation. */ #define IPMI_MAINTENANCE_MODE_AUTO 0 #define IPMI_MAINTENANCE_MODE_OFF 1 #define IPMI_MAINTENANCE_MODE_ON 2 /* * The userland interface */ /* * The userland interface for the IPMI driver is a standard character * device, with each instance of an interface registered as a minor * number under the major character device. * * The read and write calls do not work, to get messages in and out * requires ioctl calls because of the complexity of the data. select * and poll do work, so you can wait for input using the file * descriptor, you just can use read to get it. * * In general, you send a command down to the interface and receive * responses back. You can use the msgid value to correlate commands * and responses, the driver will take care of figuring out which * incoming messages are for which command and find the proper msgid * value to report. You will only receive reponses for commands you * send. Asynchronous events, however, go to all open users, so you * must be ready to handle these (or ignore them if you don't care). * * The address type depends upon the channel type. When talking * directly to the BMC (IPMC_BMC_CHANNEL), the address is ignored * (IPMI_UNUSED_ADDR_TYPE). When talking to an IPMB channel, you must * supply a valid IPMB address with the addr_type set properly. * * When talking to normal channels, the driver takes care of the * details of formatting and sending messages on that channel. You do * not, for instance, have to format a send command, you just send * whatever command you want to the channel, the driver will create * the send command, automatically issue receive command and get even * commands, and pass those up to the proper user. */ /* The magic IOCTL value for this interface. */ #define IPMI_IOC_MAGIC 'i' /* Messages sent to the interface are this format. */ struct ipmi_req { unsigned char *addr; /* Address to send the message to. */ unsigned int addr_len; long msgid; /* The sequence number for the message. This exact value will be reported back in the response to this request if it is a command. If it is a response, this will be used as the sequence value for the response. */ struct ipmi_msg msg; }; /* * Send a message to the interfaces. error values are: * - EFAULT - an address supplied was invalid. * - EINVAL - The address supplied was not valid, or the command * was not allowed. * - EMSGSIZE - The message to was too large. * - ENOMEM - Buffers could not be allocated for the command. */ #define IPMICTL_SEND_COMMAND _IOR(IPMI_IOC_MAGIC, 13, \ struct ipmi_req) /* Messages sent to the interface with timing parameters are this format. */ struct ipmi_req_settime { struct ipmi_req req; /* See ipmi_request_settime() above for details on these values. */ int retries; unsigned int retry_time_ms; }; /* * Send a message to the interfaces with timing parameters. error values * are: * - EFAULT - an address supplied was invalid. * - EINVAL - The address supplied was not valid, or the command * was not allowed. * - EMSGSIZE - The message to was too large. * - ENOMEM - Buffers could not be allocated for the command. */ #define IPMICTL_SEND_COMMAND_SETTIME _IOR(IPMI_IOC_MAGIC, 21, \ struct ipmi_req_settime) /* Messages received from the interface are this format. */ struct ipmi_recv { int recv_type; /* Is this a command, response or an asyncronous event. */ unsigned char *addr; /* Address the message was from is put here. The caller must supply the memory. */ unsigned int addr_len; /* The size of the address buffer. The caller supplies the full buffer length, this value is updated to the actual message length when the message is received. */ long msgid; /* The sequence number specified in the request if this is a response. If this is a command, this will be the sequence number from the command. */ struct ipmi_msg msg; /* The data field must point to a buffer. The data_size field must be set to the size of the message buffer. The caller supplies the full buffer length, this value is updated to the actual message length when the message is received. */ }; /* * Receive a message. error values: * - EAGAIN - no messages in the queue. * - EFAULT - an address supplied was invalid. * - EINVAL - The address supplied was not valid. * - EMSGSIZE - The message to was too large to fit into the message buffer, * the message will be left in the buffer. */ #define IPMICTL_RECEIVE_MSG _IOWR(IPMI_IOC_MAGIC, 12, \ struct ipmi_recv) /* * Like RECEIVE_MSG, but if the message won't fit in the buffer, it * will truncate the contents instead of leaving the data in the * buffer. */ #define IPMICTL_RECEIVE_MSG_TRUNC _IOWR(IPMI_IOC_MAGIC, 11, \ struct ipmi_recv) /* Register to get commands from other entities on this interface. */ struct ipmi_cmdspec { unsigned char netfn; unsigned char cmd; }; /* * Register to receive a specific command. error values: * - EFAULT - an address supplied was invalid. * - EBUSY - The netfn/cmd supplied was already in use. * - ENOMEM - could not allocate memory for the entry. */ #define IPMICTL_REGISTER_FOR_CMD _IOR(IPMI_IOC_MAGIC, 14, \ struct ipmi_cmdspec) /* * Unregister a registered command. error values: * - EFAULT - an address supplied was invalid. * - ENOENT - The netfn/cmd was not found registered for this user. */ #define IPMICTL_UNREGISTER_FOR_CMD _IOR(IPMI_IOC_MAGIC, 15, \ struct ipmi_cmdspec) /* * Register to get commands from other entities on specific channels. * This way, you can only listen on specific channels, or have messages * from some channels go to one place and other channels to someplace * else. The chans field is a bitmask, (1 << channel) for each channel. * It may be IPMI_CHAN_ALL for all channels. */ struct ipmi_cmdspec_chans { unsigned int netfn; unsigned int cmd; unsigned int chans; }; /* * Register to receive a specific command on specific channels. error values: * - EFAULT - an address supplied was invalid. * - EBUSY - One of the netfn/cmd/chans supplied was already in use. * - ENOMEM - could not allocate memory for the entry. */ #define IPMICTL_REGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 28, \ struct ipmi_cmdspec_chans) /* * Unregister some netfn/cmd/chans. error values: * - EFAULT - an address supplied was invalid. * - ENOENT - None of the netfn/cmd/chans were found registered for this user. */ #define IPMICTL_UNREGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 29, \ struct ipmi_cmdspec_chans) /* * Set whether this interface receives events. Note that the first * user registered for events will get all pending events for the * interface. error values: * - EFAULT - an address supplied was invalid. */ #define IPMICTL_SET_GETS_EVENTS_CMD _IOR(IPMI_IOC_MAGIC, 16, int) /* * Set and get the slave address and LUN that we will use for our * source messages. Note that this affects the interface, not just * this user, so it will affect all users of this interface. This is * so some initialization code can come in and do the OEM-specific * things it takes to determine your address (if not the BMC) and set * it for everyone else. You should probably leave the LUN alone. */ struct ipmi_channel_lun_address_set { unsigned short channel; unsigned char value; }; #define IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD \ _IOR(IPMI_IOC_MAGIC, 24, struct ipmi_channel_lun_address_set) #define IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD \ _IOR(IPMI_IOC_MAGIC, 25, struct ipmi_channel_lun_address_set) #define IPMICTL_SET_MY_CHANNEL_LUN_CMD \ _IOR(IPMI_IOC_MAGIC, 26, struct ipmi_channel_lun_address_set) #define IPMICTL_GET_MY_CHANNEL_LUN_CMD \ _IOR(IPMI_IOC_MAGIC, 27, struct ipmi_channel_lun_address_set) /* Legacy interfaces, these only set IPMB 0. */ #define IPMICTL_SET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 17, unsigned int) #define IPMICTL_GET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 18, unsigned int) #define IPMICTL_SET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 19, unsigned int) #define IPMICTL_GET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 20, unsigned int) /* * Get/set the default timing values for an interface. You shouldn't * generally mess with these. */ struct ipmi_timing_parms { int retries; unsigned int retry_time_ms; }; #define IPMICTL_SET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 22, \ struct ipmi_timing_parms) #define IPMICTL_GET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 23, \ struct ipmi_timing_parms) /* * Set the maintenance mode. See ipmi_set_maintenance_mode() above * for a description of what this does. */ #define IPMICTL_GET_MAINTENANCE_MODE_CMD _IOR(IPMI_IOC_MAGIC, 30, int) #define IPMICTL_SET_MAINTENANCE_MODE_CMD _IOW(IPMI_IOC_MAGIC, 31, int) #endif /* __LINUX_IPMI_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/ncsi.h����������������������������������������������������������������������������������������0000644�����������������00000007450�14763166027�0007032 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright Samuel Mendoza-Jonas, IBM Corporation 2018. * * 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. */ #ifndef __UAPI_NCSI_NETLINK_H__ #define __UAPI_NCSI_NETLINK_H__ /** * enum ncsi_nl_commands - supported NCSI commands * * @NCSI_CMD_UNSPEC: unspecified command to catch errors * @NCSI_CMD_PKG_INFO: list package and channel attributes. Requires * NCSI_ATTR_IFINDEX. If NCSI_ATTR_PACKAGE_ID is specified returns the * specific package and its channels - otherwise a dump request returns * all packages and their associated channels. * @NCSI_CMD_SET_INTERFACE: set preferred package and channel combination. * Requires NCSI_ATTR_IFINDEX and the preferred NCSI_ATTR_PACKAGE_ID and * optionally the preferred NCSI_ATTR_CHANNEL_ID. * @NCSI_CMD_CLEAR_INTERFACE: clear any preferred package/channel combination. * Requires NCSI_ATTR_IFINDEX. * @NCSI_CMD_MAX: highest command number */ enum ncsi_nl_commands { NCSI_CMD_UNSPEC, NCSI_CMD_PKG_INFO, NCSI_CMD_SET_INTERFACE, NCSI_CMD_CLEAR_INTERFACE, __NCSI_CMD_AFTER_LAST, NCSI_CMD_MAX = __NCSI_CMD_AFTER_LAST - 1 }; /** * enum ncsi_nl_attrs - General NCSI netlink attributes * * @NCSI_ATTR_UNSPEC: unspecified attributes to catch errors * @NCSI_ATTR_IFINDEX: ifindex of network device using NCSI * @NCSI_ATTR_PACKAGE_LIST: nested array of NCSI_PKG_ATTR attributes * @NCSI_ATTR_PACKAGE_ID: package ID * @NCSI_ATTR_CHANNEL_ID: channel ID * @NCSI_ATTR_MAX: highest attribute number */ enum ncsi_nl_attrs { NCSI_ATTR_UNSPEC, NCSI_ATTR_IFINDEX, NCSI_ATTR_PACKAGE_LIST, NCSI_ATTR_PACKAGE_ID, NCSI_ATTR_CHANNEL_ID, __NCSI_ATTR_AFTER_LAST, NCSI_ATTR_MAX = __NCSI_ATTR_AFTER_LAST - 1 }; /** * enum ncsi_nl_pkg_attrs - NCSI netlink package-specific attributes * * @NCSI_PKG_ATTR_UNSPEC: unspecified attributes to catch errors * @NCSI_PKG_ATTR: nested array of package attributes * @NCSI_PKG_ATTR_ID: package ID * @NCSI_PKG_ATTR_FORCED: flag signifying a package has been set as preferred * @NCSI_PKG_ATTR_CHANNEL_LIST: nested array of NCSI_CHANNEL_ATTR attributes * @NCSI_PKG_ATTR_MAX: highest attribute number */ enum ncsi_nl_pkg_attrs { NCSI_PKG_ATTR_UNSPEC, NCSI_PKG_ATTR, NCSI_PKG_ATTR_ID, NCSI_PKG_ATTR_FORCED, NCSI_PKG_ATTR_CHANNEL_LIST, __NCSI_PKG_ATTR_AFTER_LAST, NCSI_PKG_ATTR_MAX = __NCSI_PKG_ATTR_AFTER_LAST - 1 }; /** * enum ncsi_nl_channel_attrs - NCSI netlink channel-specific attributes * * @NCSI_CHANNEL_ATTR_UNSPEC: unspecified attributes to catch errors * @NCSI_CHANNEL_ATTR: nested array of channel attributes * @NCSI_CHANNEL_ATTR_ID: channel ID * @NCSI_CHANNEL_ATTR_VERSION_MAJOR: channel major version number * @NCSI_CHANNEL_ATTR_VERSION_MINOR: channel minor version number * @NCSI_CHANNEL_ATTR_VERSION_STR: channel version string * @NCSI_CHANNEL_ATTR_LINK_STATE: channel link state flags * @NCSI_CHANNEL_ATTR_ACTIVE: channels with this flag are in * NCSI_CHANNEL_ACTIVE state * @NCSI_CHANNEL_ATTR_FORCED: flag signifying a channel has been set as * preferred * @NCSI_CHANNEL_ATTR_VLAN_LIST: nested array of NCSI_CHANNEL_ATTR_VLAN_IDs * @NCSI_CHANNEL_ATTR_VLAN_ID: VLAN ID being filtered on this channel * @NCSI_CHANNEL_ATTR_MAX: highest attribute number */ enum ncsi_nl_channel_attrs { NCSI_CHANNEL_ATTR_UNSPEC, NCSI_CHANNEL_ATTR, NCSI_CHANNEL_ATTR_ID, NCSI_CHANNEL_ATTR_VERSION_MAJOR, NCSI_CHANNEL_ATTR_VERSION_MINOR, NCSI_CHANNEL_ATTR_VERSION_STR, NCSI_CHANNEL_ATTR_LINK_STATE, NCSI_CHANNEL_ATTR_ACTIVE, NCSI_CHANNEL_ATTR_FORCED, NCSI_CHANNEL_ATTR_VLAN_LIST, NCSI_CHANNEL_ATTR_VLAN_ID, __NCSI_CHANNEL_ATTR_AFTER_LAST, NCSI_CHANNEL_ATTR_MAX = __NCSI_CHANNEL_ATTR_AFTER_LAST - 1 }; #endif /* __UAPI_NCSI_NETLINK_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/hash_info.h�����������������������������������������������������������������������������������0000644�����������������00000001631�14763166027�0010027 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Hash Info: Hash algorithms information * * Copyright (c) 2013 Dmitry Kasatkin <d.kasatkin@samsung.com> * * 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. * */ #ifndef _LINUX_HASH_INFO_H #define _LINUX_HASH_INFO_H enum hash_algo { HASH_ALGO_MD4, HASH_ALGO_MD5, HASH_ALGO_SHA1, HASH_ALGO_RIPE_MD_160, HASH_ALGO_SHA256, HASH_ALGO_SHA384, HASH_ALGO_SHA512, HASH_ALGO_SHA224, HASH_ALGO_RIPE_MD_128, HASH_ALGO_RIPE_MD_256, HASH_ALGO_RIPE_MD_320, HASH_ALGO_WP_256, HASH_ALGO_WP_384, HASH_ALGO_WP_512, HASH_ALGO_TGR_128, HASH_ALGO_TGR_160, HASH_ALGO_TGR_192, HASH_ALGO_SM3_256, HASH_ALGO__LAST }; #endif /* _LINUX_HASH_INFO_H */ �������������������������������������������������������������������������������������������������������linux/cdrom.h���������������������������������������������������������������������������������������0000644�����������������00000070273�14763166027�0007205 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * -- <linux/cdrom.h> * General header file for linux CD-ROM drivers * Copyright (C) 1992 David Giller, rafetmad@oxy.edu * 1994, 1995 Eberhard Mönkeberg, emoenke@gwdg.de * 1996 David van Leeuwen, david@tm.tno.nl * 1997, 1998 Erik Andersen, andersee@debian.org * 1998-2002 Jens Axboe, axboe@suse.de */ #ifndef _LINUX_CDROM_H #define _LINUX_CDROM_H #include <linux/types.h> #include <asm/byteorder.h> /******************************************************* * As of Linux 2.1.x, all Linux CD-ROM application programs will use this * (and only this) include file. It is my hope to provide Linux with * a uniform interface between software accessing CD-ROMs and the various * device drivers that actually talk to the drives. There may still be * 23 different kinds of strange CD-ROM drives, but at least there will * now be one, and only one, Linux CD-ROM interface. * * Additionally, as of Linux 2.1.x, all Linux application programs * should use the O_NONBLOCK option when opening a CD-ROM device * for subsequent ioctl commands. This allows for neat system errors * like "No medium found" or "Wrong medium type" upon attempting to * mount or play an empty slot, mount an audio disc, or play a data disc. * Generally, changing an application program to support O_NONBLOCK * is as easy as the following: * - drive = open("/dev/cdrom", O_RDONLY); * + drive = open("/dev/cdrom", O_RDONLY | O_NONBLOCK); * It is worth the small change. * * Patches for many common CD programs (provided by David A. van Leeuwen) * can be found at: ftp://ftp.gwdg.de/pub/linux/cdrom/drivers/cm206/ * *******************************************************/ /* When a driver supports a certain function, but the cdrom drive we are * using doesn't, we will return the error EDRIVE_CANT_DO_THIS. We will * borrow the "Operation not supported" error from the network folks to * accomplish this. Maybe someday we will get a more targeted error code, * but this will do for now... */ #define EDRIVE_CANT_DO_THIS EOPNOTSUPP /******************************************************* * The CD-ROM IOCTL commands -- these should be supported by * all the various cdrom drivers. For the CD-ROM ioctls, we * will commandeer byte 0x53, or 'S'. *******************************************************/ #define CDROMPAUSE 0x5301 /* Pause Audio Operation */ #define CDROMRESUME 0x5302 /* Resume paused Audio Operation */ #define CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ #define CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index (struct cdrom_ti) */ #define CDROMREADTOCHDR 0x5305 /* Read TOC header (struct cdrom_tochdr) */ #define CDROMREADTOCENTRY 0x5306 /* Read TOC entry (struct cdrom_tocentry) */ #define CDROMSTOP 0x5307 /* Stop the cdrom drive */ #define CDROMSTART 0x5308 /* Start the cdrom drive */ #define CDROMEJECT 0x5309 /* Ejects the cdrom media */ #define CDROMVOLCTRL 0x530a /* Control output volume (struct cdrom_volctrl) */ #define CDROMSUBCHNL 0x530b /* Read subchannel data (struct cdrom_subchnl) */ #define CDROMREADMODE2 0x530c /* Read CDROM mode 2 data (2336 Bytes) (struct cdrom_read) */ #define CDROMREADMODE1 0x530d /* Read CDROM mode 1 data (2048 Bytes) (struct cdrom_read) */ #define CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ #define CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ #define CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session address of multi session disks (struct cdrom_multisession) */ #define CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" if available (struct cdrom_mcn) */ #define CDROM_GET_UPC CDROM_GET_MCN /* This one is deprecated, but here anyway for compatibility */ #define CDROMRESET 0x5312 /* hard-reset the drive */ #define CDROMVOLREAD 0x5313 /* Get the drive's volume setting (struct cdrom_volctrl) */ #define CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) (struct cdrom_read) */ /* * These ioctls are used only used in aztcd.c and optcd.c */ #define CDROMREADCOOKED 0x5315 /* read data in cooked mode */ #define CDROMSEEK 0x5316 /* seek msf address */ /* * This ioctl is only used by the scsi-cd driver. It is for playing audio in logical block addressing mode. */ #define CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ /* * These ioctls are only used in optcd.c */ #define CDROMREADALL 0x5318 /* read all 2646 bytes */ /* * These ioctls are (now) only in ide-cd.c for controlling * drive spindown time. They should be implemented in the * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... * -Erik */ #define CDROMGETSPINDOWN 0x531d #define CDROMSETSPINDOWN 0x531e /* * These ioctls are implemented through the uniform CD-ROM driver * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM * drivers are eventually ported to the uniform CD-ROM driver interface. */ #define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ #define CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ #define CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ #define CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ #define CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ #define CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ #define CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ #define CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ #define CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ #define CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ #define CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ #define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. * Future CDROM ioctls should be kept below 0x537F */ /* This ioctl is only used by sbpcd at the moment */ #define CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ /* conflict with SCSI_IOCTL_GET_IDLUN */ /* DVD-ROM Specific ioctls */ #define DVD_READ_STRUCT 0x5390 /* Read structure */ #define DVD_WRITE_STRUCT 0x5391 /* Write structure */ #define DVD_AUTH 0x5392 /* Authentication */ #define CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ #define CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ #define CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ /******************************************************* * CDROM IOCTL structures *******************************************************/ /* Address in MSF format */ struct cdrom_msf0 { __u8 minute; __u8 second; __u8 frame; }; /* Address in either MSF or logical format */ union cdrom_addr { struct cdrom_msf0 msf; int lba; }; /* This struct is used by the CDROMPLAYMSF ioctl */ struct cdrom_msf { __u8 cdmsf_min0; /* start minute */ __u8 cdmsf_sec0; /* start second */ __u8 cdmsf_frame0; /* start frame */ __u8 cdmsf_min1; /* end minute */ __u8 cdmsf_sec1; /* end second */ __u8 cdmsf_frame1; /* end frame */ }; /* This struct is used by the CDROMPLAYTRKIND ioctl */ struct cdrom_ti { __u8 cdti_trk0; /* start track */ __u8 cdti_ind0; /* start index */ __u8 cdti_trk1; /* end track */ __u8 cdti_ind1; /* end index */ }; /* This struct is used by the CDROMREADTOCHDR ioctl */ struct cdrom_tochdr { __u8 cdth_trk0; /* start track */ __u8 cdth_trk1; /* end track */ }; /* This struct is used by the CDROMVOLCTRL and CDROMVOLREAD ioctls */ struct cdrom_volctrl { __u8 channel0; __u8 channel1; __u8 channel2; __u8 channel3; }; /* This struct is used by the CDROMSUBCHNL ioctl */ struct cdrom_subchnl { __u8 cdsc_format; __u8 cdsc_audiostatus; __u8 cdsc_adr: 4; __u8 cdsc_ctrl: 4; __u8 cdsc_trk; __u8 cdsc_ind; union cdrom_addr cdsc_absaddr; union cdrom_addr cdsc_reladdr; }; /* This struct is used by the CDROMREADTOCENTRY ioctl */ struct cdrom_tocentry { __u8 cdte_track; __u8 cdte_adr :4; __u8 cdte_ctrl :4; __u8 cdte_format; union cdrom_addr cdte_addr; __u8 cdte_datamode; }; /* This struct is used by the CDROMREADMODE1, and CDROMREADMODE2 ioctls */ struct cdrom_read { int cdread_lba; char *cdread_bufaddr; int cdread_buflen; }; /* This struct is used by the CDROMREADAUDIO ioctl */ struct cdrom_read_audio { union cdrom_addr addr; /* frame address */ __u8 addr_format; /* CDROM_LBA or CDROM_MSF */ int nframes; /* number of 2352-byte-frames to read at once */ __u8 *buf; /* frame buffer (size: nframes*2352 bytes) */ }; /* This struct is used with the CDROMMULTISESSION ioctl */ struct cdrom_multisession { union cdrom_addr addr; /* frame address: start-of-last-session (not the new "frame 16"!). Only valid if the "xa_flag" is true. */ __u8 xa_flag; /* 1: "is XA disk" */ __u8 addr_format; /* CDROM_LBA or CDROM_MSF */ }; /* This struct is used with the CDROM_GET_MCN ioctl. * Very few audio discs actually have Universal Product Code information, * which should just be the Medium Catalog Number on the box. Also note * that the way the codeis written on CD is _not_ uniform across all discs! */ struct cdrom_mcn { __u8 medium_catalog_number[14]; /* 13 ASCII digits, null-terminated */ }; /* This is used by the CDROMPLAYBLK ioctl */ struct cdrom_blk { unsigned from; unsigned short len; }; #define CDROM_PACKET_SIZE 12 #define CGC_DATA_UNKNOWN 0 #define CGC_DATA_WRITE 1 #define CGC_DATA_READ 2 #define CGC_DATA_NONE 3 /* for CDROM_PACKET_COMMAND ioctl */ struct cdrom_generic_command { unsigned char cmd[CDROM_PACKET_SIZE]; unsigned char *buffer; unsigned int buflen; int stat; struct request_sense *sense; unsigned char data_direction; int quiet; int timeout; void *reserved[1]; /* unused, actually */ }; /* * A CD-ROM physical sector size is 2048, 2052, 2056, 2324, 2332, 2336, * 2340, or 2352 bytes long. * Sector types of the standard CD-ROM data formats: * * format sector type user data size (bytes) * ----------------------------------------------------------------------------- * 1 (Red Book) CD-DA 2352 (CD_FRAMESIZE_RAW) * 2 (Yellow Book) Mode1 Form1 2048 (CD_FRAMESIZE) * 3 (Yellow Book) Mode1 Form2 2336 (CD_FRAMESIZE_RAW0) * 4 (Green Book) Mode2 Form1 2048 (CD_FRAMESIZE) * 5 (Green Book) Mode2 Form2 2328 (2324+4 spare bytes) * * * The layout of the standard CD-ROM data formats: * ----------------------------------------------------------------------------- * - audio (red): | audio_sample_bytes | * | 2352 | * * - data (yellow, mode1): | sync - head - data - EDC - zero - ECC | * | 12 - 4 - 2048 - 4 - 8 - 276 | * * - data (yellow, mode2): | sync - head - data | * | 12 - 4 - 2336 | * * - XA data (green, mode2 form1): | sync - head - sub - data - EDC - ECC | * | 12 - 4 - 8 - 2048 - 4 - 276 | * * - XA data (green, mode2 form2): | sync - head - sub - data - Spare | * | 12 - 4 - 8 - 2324 - 4 | * */ /* Some generally useful CD-ROM information -- mostly based on the above */ #define CD_MINS 74 /* max. minutes per CD, not really a limit */ #define CD_SECS 60 /* seconds per minute */ #define CD_FRAMES 75 /* frames per second */ #define CD_SYNC_SIZE 12 /* 12 sync bytes per raw data frame */ #define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */ #define CD_CHUNK_SIZE 24 /* lowest-level "data bytes piece" */ #define CD_NUM_OF_CHUNKS 98 /* chunks per frame */ #define CD_FRAMESIZE_SUB 96 /* subchannel data "frame" size */ #define CD_HEAD_SIZE 4 /* header (address) bytes per raw data frame */ #define CD_SUBHEAD_SIZE 8 /* subheader bytes per raw XA data frame */ #define CD_EDC_SIZE 4 /* bytes EDC per most raw data frame types */ #define CD_ZERO_SIZE 8 /* bytes zero per yellow book mode 1 frame */ #define CD_ECC_SIZE 276 /* bytes ECC per most raw data frame types */ #define CD_FRAMESIZE 2048 /* bytes per frame, "cooked" mode */ #define CD_FRAMESIZE_RAW 2352 /* bytes per frame, "raw" mode */ #define CD_FRAMESIZE_RAWER 2646 /* The maximum possible returned bytes */ /* most drives don't deliver everything: */ #define CD_FRAMESIZE_RAW1 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE) /*2340*/ #define CD_FRAMESIZE_RAW0 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE-CD_HEAD_SIZE) /*2336*/ #define CD_XA_HEAD (CD_HEAD_SIZE+CD_SUBHEAD_SIZE) /* "before data" part of raw XA frame */ #define CD_XA_TAIL (CD_EDC_SIZE+CD_ECC_SIZE) /* "after data" part of raw XA frame */ #define CD_XA_SYNC_HEAD (CD_SYNC_SIZE+CD_XA_HEAD) /* sync bytes + header of XA frame */ /* CD-ROM address types (cdrom_tocentry.cdte_format) */ #define CDROM_LBA 0x01 /* "logical block": first frame is #0 */ #define CDROM_MSF 0x02 /* "minute-second-frame": binary, not bcd here! */ /* bit to tell whether track is data or audio (cdrom_tocentry.cdte_ctrl) */ #define CDROM_DATA_TRACK 0x04 /* The leadout track is always 0xAA, regardless of # of tracks on disc */ #define CDROM_LEADOUT 0xAA /* audio states (from SCSI-2, but seen with other drives, too) */ #define CDROM_AUDIO_INVALID 0x00 /* audio status not supported */ #define CDROM_AUDIO_PLAY 0x11 /* audio play operation in progress */ #define CDROM_AUDIO_PAUSED 0x12 /* audio play operation paused */ #define CDROM_AUDIO_COMPLETED 0x13 /* audio play successfully completed */ #define CDROM_AUDIO_ERROR 0x14 /* audio play stopped due to error */ #define CDROM_AUDIO_NO_STATUS 0x15 /* no current audio status to return */ /* capability flags used with the uniform CD-ROM driver */ #define CDC_CLOSE_TRAY 0x1 /* caddy systems _can't_ close */ #define CDC_OPEN_TRAY 0x2 /* but _can_ eject. */ #define CDC_LOCK 0x4 /* disable manual eject */ #define CDC_SELECT_SPEED 0x8 /* programmable speed */ #define CDC_SELECT_DISC 0x10 /* select disc from juke-box */ #define CDC_MULTI_SESSION 0x20 /* read sessions>1 */ #define CDC_MCN 0x40 /* Medium Catalog Number */ #define CDC_MEDIA_CHANGED 0x80 /* media changed */ #define CDC_PLAY_AUDIO 0x100 /* audio functions */ #define CDC_RESET 0x200 /* hard reset device */ #define CDC_DRIVE_STATUS 0x800 /* driver implements drive status */ #define CDC_GENERIC_PACKET 0x1000 /* driver implements generic packets */ #define CDC_CD_R 0x2000 /* drive is a CD-R */ #define CDC_CD_RW 0x4000 /* drive is a CD-RW */ #define CDC_DVD 0x8000 /* drive is a DVD */ #define CDC_DVD_R 0x10000 /* drive can write DVD-R */ #define CDC_DVD_RAM 0x20000 /* drive can write DVD-RAM */ #define CDC_MO_DRIVE 0x40000 /* drive is an MO device */ #define CDC_MRW 0x80000 /* drive can read MRW */ #define CDC_MRW_W 0x100000 /* drive can write MRW */ #define CDC_RAM 0x200000 /* ok to open for WRITE */ /* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */ #define CDS_NO_INFO 0 /* if not implemented */ #define CDS_NO_DISC 1 #define CDS_TRAY_OPEN 2 #define CDS_DRIVE_NOT_READY 3 #define CDS_DISC_OK 4 /* return values for the CDROM_DISC_STATUS ioctl */ /* can also return CDS_NO_[INFO|DISC], from above */ #define CDS_AUDIO 100 #define CDS_DATA_1 101 #define CDS_DATA_2 102 #define CDS_XA_2_1 103 #define CDS_XA_2_2 104 #define CDS_MIXED 105 /* User-configurable behavior options for the uniform CD-ROM driver */ #define CDO_AUTO_CLOSE 0x1 /* close tray on first open() */ #define CDO_AUTO_EJECT 0x2 /* open tray on last release() */ #define CDO_USE_FFLAGS 0x4 /* use O_NONBLOCK information on open */ #define CDO_LOCK 0x8 /* lock tray on open files */ #define CDO_CHECK_TYPE 0x10 /* check type on open for data */ /* Special codes used when specifying changer slots. */ #define CDSL_NONE (INT_MAX-1) #define CDSL_CURRENT INT_MAX /* For partition based multisession access. IDE can handle 64 partitions * per drive - SCSI CD-ROM's use minors to differentiate between the * various drives, so we can't do multisessions the same way there. * Use the -o session=x option to mount on them. */ #define CD_PART_MAX 64 #define CD_PART_MASK (CD_PART_MAX - 1) /********************************************************************* * Generic Packet commands, MMC commands, and such *********************************************************************/ /* The generic packet command opcodes for CD/DVD Logical Units, * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */ #define GPCMD_BLANK 0xa1 #define GPCMD_CLOSE_TRACK 0x5b #define GPCMD_FLUSH_CACHE 0x35 #define GPCMD_FORMAT_UNIT 0x04 #define GPCMD_GET_CONFIGURATION 0x46 #define GPCMD_GET_EVENT_STATUS_NOTIFICATION 0x4a #define GPCMD_GET_PERFORMANCE 0xac #define GPCMD_INQUIRY 0x12 #define GPCMD_LOAD_UNLOAD 0xa6 #define GPCMD_MECHANISM_STATUS 0xbd #define GPCMD_MODE_SELECT_10 0x55 #define GPCMD_MODE_SENSE_10 0x5a #define GPCMD_PAUSE_RESUME 0x4b #define GPCMD_PLAY_AUDIO_10 0x45 #define GPCMD_PLAY_AUDIO_MSF 0x47 #define GPCMD_PLAY_AUDIO_TI 0x48 #define GPCMD_PLAY_CD 0xbc #define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e #define GPCMD_READ_10 0x28 #define GPCMD_READ_12 0xa8 #define GPCMD_READ_BUFFER 0x3c #define GPCMD_READ_BUFFER_CAPACITY 0x5c #define GPCMD_READ_CDVD_CAPACITY 0x25 #define GPCMD_READ_CD 0xbe #define GPCMD_READ_CD_MSF 0xb9 #define GPCMD_READ_DISC_INFO 0x51 #define GPCMD_READ_DVD_STRUCTURE 0xad #define GPCMD_READ_FORMAT_CAPACITIES 0x23 #define GPCMD_READ_HEADER 0x44 #define GPCMD_READ_TRACK_RZONE_INFO 0x52 #define GPCMD_READ_SUBCHANNEL 0x42 #define GPCMD_READ_TOC_PMA_ATIP 0x43 #define GPCMD_REPAIR_RZONE_TRACK 0x58 #define GPCMD_REPORT_KEY 0xa4 #define GPCMD_REQUEST_SENSE 0x03 #define GPCMD_RESERVE_RZONE_TRACK 0x53 #define GPCMD_SEND_CUE_SHEET 0x5d #define GPCMD_SCAN 0xba #define GPCMD_SEEK 0x2b #define GPCMD_SEND_DVD_STRUCTURE 0xbf #define GPCMD_SEND_EVENT 0xa2 #define GPCMD_SEND_KEY 0xa3 #define GPCMD_SEND_OPC 0x54 #define GPCMD_SET_READ_AHEAD 0xa7 #define GPCMD_SET_STREAMING 0xb6 #define GPCMD_START_STOP_UNIT 0x1b #define GPCMD_STOP_PLAY_SCAN 0x4e #define GPCMD_TEST_UNIT_READY 0x00 #define GPCMD_VERIFY_10 0x2f #define GPCMD_WRITE_10 0x2a #define GPCMD_WRITE_12 0xaa #define GPCMD_WRITE_AND_VERIFY_10 0x2e #define GPCMD_WRITE_BUFFER 0x3b /* This is listed as optional in ATAPI 2.6, but is (curiously) * missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji * Table 377 as an MMC command for SCSi devices though... Most ATAPI * drives support it. */ #define GPCMD_SET_SPEED 0xbb /* This seems to be a SCSI specific CD-ROM opcode * to play data at track/index */ #define GPCMD_PLAYAUDIO_TI 0x48 /* * From MS Media Status Notification Support Specification. For * older drives only. */ #define GPCMD_GET_MEDIA_STATUS 0xda /* Mode page codes for mode sense/set */ #define GPMODE_VENDOR_PAGE 0x00 #define GPMODE_R_W_ERROR_PAGE 0x01 #define GPMODE_WRITE_PARMS_PAGE 0x05 #define GPMODE_WCACHING_PAGE 0x08 #define GPMODE_AUDIO_CTL_PAGE 0x0e #define GPMODE_POWER_PAGE 0x1a #define GPMODE_FAULT_FAIL_PAGE 0x1c #define GPMODE_TO_PROTECT_PAGE 0x1d #define GPMODE_CAPABILITIES_PAGE 0x2a #define GPMODE_ALL_PAGES 0x3f /* Not in Mt. Fuji, but in ATAPI 2.6 -- deprecated now in favor * of MODE_SENSE_POWER_PAGE */ #define GPMODE_CDROM_PAGE 0x0d /* DVD struct types */ #define DVD_STRUCT_PHYSICAL 0x00 #define DVD_STRUCT_COPYRIGHT 0x01 #define DVD_STRUCT_DISCKEY 0x02 #define DVD_STRUCT_BCA 0x03 #define DVD_STRUCT_MANUFACT 0x04 struct dvd_layer { __u8 book_version : 4; __u8 book_type : 4; __u8 min_rate : 4; __u8 disc_size : 4; __u8 layer_type : 4; __u8 track_path : 1; __u8 nlayers : 2; __u8 track_density : 4; __u8 linear_density : 4; __u8 bca : 1; __u32 start_sector; __u32 end_sector; __u32 end_sector_l0; }; #define DVD_LAYERS 4 struct dvd_physical { __u8 type; __u8 layer_num; struct dvd_layer layer[DVD_LAYERS]; }; struct dvd_copyright { __u8 type; __u8 layer_num; __u8 cpst; __u8 rmi; }; struct dvd_disckey { __u8 type; unsigned agid : 2; __u8 value[2048]; }; struct dvd_bca { __u8 type; int len; __u8 value[188]; }; struct dvd_manufact { __u8 type; __u8 layer_num; int len; __u8 value[2048]; }; typedef union { __u8 type; struct dvd_physical physical; struct dvd_copyright copyright; struct dvd_disckey disckey; struct dvd_bca bca; struct dvd_manufact manufact; } dvd_struct; /* * DVD authentication ioctl */ /* Authentication states */ #define DVD_LU_SEND_AGID 0 #define DVD_HOST_SEND_CHALLENGE 1 #define DVD_LU_SEND_KEY1 2 #define DVD_LU_SEND_CHALLENGE 3 #define DVD_HOST_SEND_KEY2 4 /* Termination states */ #define DVD_AUTH_ESTABLISHED 5 #define DVD_AUTH_FAILURE 6 /* Other functions */ #define DVD_LU_SEND_TITLE_KEY 7 #define DVD_LU_SEND_ASF 8 #define DVD_INVALIDATE_AGID 9 #define DVD_LU_SEND_RPC_STATE 10 #define DVD_HOST_SEND_RPC_STATE 11 /* State data */ typedef __u8 dvd_key[5]; /* 40-bit value, MSB is first elem. */ typedef __u8 dvd_challenge[10]; /* 80-bit value, MSB is first elem. */ struct dvd_lu_send_agid { __u8 type; unsigned agid : 2; }; struct dvd_host_send_challenge { __u8 type; unsigned agid : 2; dvd_challenge chal; }; struct dvd_send_key { __u8 type; unsigned agid : 2; dvd_key key; }; struct dvd_lu_send_challenge { __u8 type; unsigned agid : 2; dvd_challenge chal; }; #define DVD_CPM_NO_COPYRIGHT 0 #define DVD_CPM_COPYRIGHTED 1 #define DVD_CP_SEC_NONE 0 #define DVD_CP_SEC_EXIST 1 #define DVD_CGMS_UNRESTRICTED 0 #define DVD_CGMS_SINGLE 2 #define DVD_CGMS_RESTRICTED 3 struct dvd_lu_send_title_key { __u8 type; unsigned agid : 2; dvd_key title_key; int lba; unsigned cpm : 1; unsigned cp_sec : 1; unsigned cgms : 2; }; struct dvd_lu_send_asf { __u8 type; unsigned agid : 2; unsigned asf : 1; }; struct dvd_host_send_rpcstate { __u8 type; __u8 pdrc; }; struct dvd_lu_send_rpcstate { __u8 type : 2; __u8 vra : 3; __u8 ucca : 3; __u8 region_mask; __u8 rpc_scheme; }; typedef union { __u8 type; struct dvd_lu_send_agid lsa; struct dvd_host_send_challenge hsc; struct dvd_send_key lsk; struct dvd_lu_send_challenge lsc; struct dvd_send_key hsk; struct dvd_lu_send_title_key lstk; struct dvd_lu_send_asf lsasf; struct dvd_host_send_rpcstate hrpcs; struct dvd_lu_send_rpcstate lrpcs; } dvd_authinfo; struct request_sense { #if defined(__BIG_ENDIAN_BITFIELD) __u8 valid : 1; __u8 error_code : 7; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 error_code : 7; __u8 valid : 1; #endif __u8 segment_number; #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved1 : 2; __u8 ili : 1; __u8 reserved2 : 1; __u8 sense_key : 4; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 sense_key : 4; __u8 reserved2 : 1; __u8 ili : 1; __u8 reserved1 : 2; #endif __u8 information[4]; __u8 add_sense_len; __u8 command_info[4]; __u8 asc; __u8 ascq; __u8 fruc; __u8 sks[3]; __u8 asb[46]; }; /* * feature profile */ #define CDF_RWRT 0x0020 /* "Random Writable" */ #define CDF_HWDM 0x0024 /* "Hardware Defect Management" */ #define CDF_MRW 0x0028 /* * media status bits */ #define CDM_MRW_NOTMRW 0 #define CDM_MRW_BGFORMAT_INACTIVE 1 #define CDM_MRW_BGFORMAT_ACTIVE 2 #define CDM_MRW_BGFORMAT_COMPLETE 3 /* * mrw address spaces */ #define MRW_LBA_DMA 0 #define MRW_LBA_GAA 1 /* * mrw mode pages (first is deprecated) -- probed at init time and * cdi->mrw_mode_page is set */ #define MRW_MODE_PC_PRE1 0x2c #define MRW_MODE_PC 0x03 struct mrw_feature_desc { __be16 feature_code; #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved1 : 2; __u8 feature_version : 4; __u8 persistent : 1; __u8 curr : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 curr : 1; __u8 persistent : 1; __u8 feature_version : 4; __u8 reserved1 : 2; #endif __u8 add_len; #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved2 : 7; __u8 write : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 write : 1; __u8 reserved2 : 7; #endif __u8 reserved3; __u8 reserved4; __u8 reserved5; }; /* cf. mmc4r02g.pdf 5.3.10 Random Writable Feature (0020h) pg 197 of 635 */ struct rwrt_feature_desc { __be16 feature_code; #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved1 : 2; __u8 feature_version : 4; __u8 persistent : 1; __u8 curr : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 curr : 1; __u8 persistent : 1; __u8 feature_version : 4; __u8 reserved1 : 2; #endif __u8 add_len; __u32 last_lba; __u32 block_size; __u16 blocking; #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved2 : 7; __u8 page_present : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 page_present : 1; __u8 reserved2 : 7; #endif __u8 reserved3; }; typedef struct { __be16 disc_information_length; #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved1 : 3; __u8 erasable : 1; __u8 border_status : 2; __u8 disc_status : 2; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 disc_status : 2; __u8 border_status : 2; __u8 erasable : 1; __u8 reserved1 : 3; #else #error "Please fix <asm/byteorder.h>" #endif __u8 n_first_track; __u8 n_sessions_lsb; __u8 first_track_lsb; __u8 last_track_lsb; #if defined(__BIG_ENDIAN_BITFIELD) __u8 did_v : 1; __u8 dbc_v : 1; __u8 uru : 1; __u8 reserved2 : 2; __u8 dbit : 1; __u8 mrw_status : 2; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 mrw_status : 2; __u8 dbit : 1; __u8 reserved2 : 2; __u8 uru : 1; __u8 dbc_v : 1; __u8 did_v : 1; #endif __u8 disc_type; __u8 n_sessions_msb; __u8 first_track_msb; __u8 last_track_msb; __u32 disc_id; __u32 lead_in; __u32 lead_out; __u8 disc_bar_code[8]; __u8 reserved3; __u8 n_opc; } disc_information; typedef struct { __be16 track_information_length; __u8 track_lsb; __u8 session_lsb; __u8 reserved1; #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved2 : 2; __u8 damage : 1; __u8 copy : 1; __u8 track_mode : 4; __u8 rt : 1; __u8 blank : 1; __u8 packet : 1; __u8 fp : 1; __u8 data_mode : 4; __u8 reserved3 : 6; __u8 lra_v : 1; __u8 nwa_v : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 track_mode : 4; __u8 copy : 1; __u8 damage : 1; __u8 reserved2 : 2; __u8 data_mode : 4; __u8 fp : 1; __u8 packet : 1; __u8 blank : 1; __u8 rt : 1; __u8 nwa_v : 1; __u8 lra_v : 1; __u8 reserved3 : 6; #endif __be32 track_start; __be32 next_writable; __be32 free_blocks; __be32 fixed_packet_size; __be32 track_size; __be32 last_rec_address; } track_information; struct feature_header { __u32 data_len; __u8 reserved1; __u8 reserved2; __u16 curr_profile; }; struct mode_page_header { __be16 mode_data_length; __u8 medium_type; __u8 reserved1; __u8 reserved2; __u8 reserved3; __be16 desc_length; }; /* removable medium feature descriptor */ struct rm_feature_desc { __be16 feature_code; #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved1:2; __u8 feature_version:4; __u8 persistent:1; __u8 curr:1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 curr:1; __u8 persistent:1; __u8 feature_version:4; __u8 reserved1:2; #endif __u8 add_len; #if defined(__BIG_ENDIAN_BITFIELD) __u8 mech_type:3; __u8 load:1; __u8 eject:1; __u8 pvnt_jmpr:1; __u8 dbml:1; __u8 lock:1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 lock:1; __u8 dbml:1; __u8 pvnt_jmpr:1; __u8 eject:1; __u8 load:1; __u8 mech_type:3; #endif __u8 reserved2; __u8 reserved3; __u8 reserved4; }; #endif /* _LINUX_CDROM_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/reboot.h��������������������������������������������������������������������������������������0000644�����������������00000002477�14763166027�0007374 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_REBOOT_H #define _LINUX_REBOOT_H /* * Magic values required to use _reboot() system call. */ #define LINUX_REBOOT_MAGIC1 0xfee1dead #define LINUX_REBOOT_MAGIC2 672274793 #define LINUX_REBOOT_MAGIC2A 85072278 #define LINUX_REBOOT_MAGIC2B 369367448 #define LINUX_REBOOT_MAGIC2C 537993216 /* * Commands accepted by the _reboot() system call. * * RESTART Restart system using default command and mode. * HALT Stop OS and give system control to ROM monitor, if any. * CAD_ON Ctrl-Alt-Del sequence causes RESTART command. * CAD_OFF Ctrl-Alt-Del sequence sends SIGINT to init task. * POWER_OFF Stop OS and remove all power from system, if possible. * RESTART2 Restart system using given command string. * SW_SUSPEND Suspend system using software suspend if compiled in. * KEXEC Restart system using a previously loaded Linux kernel */ #define LINUX_REBOOT_CMD_RESTART 0x01234567 #define LINUX_REBOOT_CMD_HALT 0xCDEF0123 #define LINUX_REBOOT_CMD_CAD_ON 0x89ABCDEF #define LINUX_REBOOT_CMD_CAD_OFF 0x00000000 #define LINUX_REBOOT_CMD_POWER_OFF 0x4321FEDC #define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4 #define LINUX_REBOOT_CMD_SW_SUSPEND 0xD000FCE2 #define LINUX_REBOOT_CMD_KEXEC 0x45584543 #endif /* _LINUX_REBOOT_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/ultrasound.h����������������������������������������������������������������������������������0000644�����������������00000010722�14763166027�0010272 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ULTRASOUND_H_ #define _ULTRASOUND_H_ /* * ultrasound.h - Macros for programming the Gravis Ultrasound * These macros are extremely device dependent * and not portable. */ /* * Copyright (C) by Hannu Savolainen 1993-1997 * * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL) * Version 2 (June 1991). See the "COPYING" file distributed with this software * for more info. */ /* * Private events for Gravis Ultrasound (GUS) * * Format: * byte 0 - SEQ_PRIVATE (0xfe) * byte 1 - Synthesizer device number (0-N) * byte 2 - Command (see below) * byte 3 - Voice number (0-31) * bytes 4 and 5 - parameter P1 (unsigned short) * bytes 6 and 7 - parameter P2 (unsigned short) * * Commands: * Each command affects one voice defined in byte 3. * Unused parameters (P1 and/or P2 *MUST* be initialized to zero). * _GUS_NUMVOICES - Sets max. number of concurrent voices (P1=14-31, default 16) * _GUS_VOICESAMPLE- ************ OBSOLETE ************* * _GUS_VOICEON - Starts voice (P1=voice mode) * _GUS_VOICEOFF - Stops voice (no parameters) * _GUS_VOICEFADE - Stops the voice smoothly. * _GUS_VOICEMODE - Alters the voice mode, don't start or stop voice (P1=voice mode) * _GUS_VOICEBALA - Sets voice balance (P1, 0=left, 7=middle and 15=right, default 7) * _GUS_VOICEFREQ - Sets voice (sample) playback frequency (P1=Hz) * _GUS_VOICEVOL - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off) * _GUS_VOICEVOL2 - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off) * (Like GUS_VOICEVOL but doesn't change the hw * volume. It just updates volume in the voice table). * * _GUS_RAMPRANGE - Sets limits for volume ramping (P1=low volume, P2=high volume) * _GUS_RAMPRATE - Sets the speed for volume ramping (P1=scale, P2=rate) * _GUS_RAMPMODE - Sets the volume ramping mode (P1=ramping mode) * _GUS_RAMPON - Starts volume ramping (no parameters) * _GUS_RAMPOFF - Stops volume ramping (no parameters) * _GUS_VOLUME_SCALE - Changes the volume calculation constants * for all voices. */ #define _GUS_NUMVOICES 0x00 #define _GUS_VOICESAMPLE 0x01 /* OBSOLETE */ #define _GUS_VOICEON 0x02 #define _GUS_VOICEOFF 0x03 #define _GUS_VOICEMODE 0x04 #define _GUS_VOICEBALA 0x05 #define _GUS_VOICEFREQ 0x06 #define _GUS_VOICEVOL 0x07 #define _GUS_RAMPRANGE 0x08 #define _GUS_RAMPRATE 0x09 #define _GUS_RAMPMODE 0x0a #define _GUS_RAMPON 0x0b #define _GUS_RAMPOFF 0x0c #define _GUS_VOICEFADE 0x0d #define _GUS_VOLUME_SCALE 0x0e #define _GUS_VOICEVOL2 0x0f #define _GUS_VOICE_POS 0x10 /* * GUS API macros */ #define _GUS_CMD(chn, voice, cmd, p1, p2) \ {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = SEQ_PRIVATE;\ _seqbuf[_seqbufptr+1] = (chn); _seqbuf[_seqbufptr+2] = cmd;\ _seqbuf[_seqbufptr+3] = voice;\ *(unsigned short*)&_seqbuf[_seqbufptr+4] = p1;\ *(unsigned short*)&_seqbuf[_seqbufptr+6] = p2;\ _SEQ_ADVBUF(8);} #define GUS_NUMVOICES(chn, p1) _GUS_CMD(chn, 0, _GUS_NUMVOICES, (p1), 0) #define GUS_VOICESAMPLE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICESAMPLE, (p1), 0) /* OBSOLETE */ #define GUS_VOICEON(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEON, (p1), 0) #define GUS_VOICEOFF(chn, voice) _GUS_CMD(chn, voice, _GUS_VOICEOFF, 0, 0) #define GUS_VOICEFADE(chn, voice) _GUS_CMD(chn, voice, _GUS_VOICEFADE, 0, 0) #define GUS_VOICEMODE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEMODE, (p1), 0) #define GUS_VOICEBALA(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEBALA, (p1), 0) #define GUS_VOICEFREQ(chn, voice, p) _GUS_CMD(chn, voice, _GUS_VOICEFREQ, \ (p) & 0xffff, ((p) >> 16) & 0xffff) #define GUS_VOICEVOL(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEVOL, (p1), 0) #define GUS_VOICEVOL2(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEVOL2, (p1), 0) #define GUS_RAMPRANGE(chn, voice, low, high) _GUS_CMD(chn, voice, _GUS_RAMPRANGE, (low), (high)) #define GUS_RAMPRATE(chn, voice, p1, p2) _GUS_CMD(chn, voice, _GUS_RAMPRATE, (p1), (p2)) #define GUS_RAMPMODE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_RAMPMODE, (p1), 0) #define GUS_RAMPON(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_RAMPON, (p1), 0) #define GUS_RAMPOFF(chn, voice) _GUS_CMD(chn, voice, _GUS_RAMPOFF, 0, 0) #define GUS_VOLUME_SCALE(chn, voice, p1, p2) _GUS_CMD(chn, voice, _GUS_VOLUME_SCALE, (p1), (p2)) #define GUS_VOICE_POS(chn, voice, p) _GUS_CMD(chn, voice, _GUS_VOICE_POS, \ (p) & 0xffff, ((p) >> 16) & 0xffff) #endif ����������������������������������������������linux/ila.h�����������������������������������������������������������������������������������������0000644�����������������00000002336�14763166027�0006641 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* ila.h - ILA Interface */ #ifndef _LINUX_ILA_H #define _LINUX_ILA_H /* NETLINK_GENERIC related info */ #define ILA_GENL_NAME "ila" #define ILA_GENL_VERSION 0x1 enum { ILA_ATTR_UNSPEC, ILA_ATTR_LOCATOR, /* u64 */ ILA_ATTR_IDENTIFIER, /* u64 */ ILA_ATTR_LOCATOR_MATCH, /* u64 */ ILA_ATTR_IFINDEX, /* s32 */ ILA_ATTR_DIR, /* u32 */ ILA_ATTR_PAD, ILA_ATTR_CSUM_MODE, /* u8 */ ILA_ATTR_IDENT_TYPE, /* u8 */ ILA_ATTR_HOOK_TYPE, /* u8 */ __ILA_ATTR_MAX, }; #define ILA_ATTR_MAX (__ILA_ATTR_MAX - 1) enum { ILA_CMD_UNSPEC, ILA_CMD_ADD, ILA_CMD_DEL, ILA_CMD_GET, ILA_CMD_FLUSH, __ILA_CMD_MAX, }; #define ILA_CMD_MAX (__ILA_CMD_MAX - 1) #define ILA_DIR_IN (1 << 0) #define ILA_DIR_OUT (1 << 1) enum { ILA_CSUM_ADJUST_TRANSPORT, ILA_CSUM_NEUTRAL_MAP, ILA_CSUM_NO_ACTION, ILA_CSUM_NEUTRAL_MAP_AUTO, }; enum { ILA_ATYPE_IID = 0, ILA_ATYPE_LUID, ILA_ATYPE_VIRT_V4, ILA_ATYPE_VIRT_UNI_V6, ILA_ATYPE_VIRT_MULTI_V6, ILA_ATYPE_NONLOCAL_ADDR, ILA_ATYPE_RSVD_1, ILA_ATYPE_RSVD_2, ILA_ATYPE_USE_FORMAT = 32, /* Get type from type field in identifier */ }; enum { ILA_HOOK_ROUTE_OUTPUT, ILA_HOOK_ROUTE_INPUT, }; #endif /* _LINUX_ILA_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/rseq.h����������������������������������������������������������������������������������������0000644�����������������00000011450�14763166027�0007043 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef _LINUX_RSEQ_H #define _LINUX_RSEQ_H /* * linux/rseq.h * * Restartable sequences system call API * * Copyright (c) 2015-2018 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> */ #include <linux/types.h> #include <asm/byteorder.h> enum rseq_cpu_id_state { RSEQ_CPU_ID_UNINITIALIZED = -1, RSEQ_CPU_ID_REGISTRATION_FAILED = -2, }; enum rseq_flags { RSEQ_FLAG_UNREGISTER = (1 << 0), }; enum rseq_cs_flags_bit { RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT_BIT = 0, RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT = 1, RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT = 2, }; enum rseq_cs_flags { RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT_BIT), RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT), RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT), }; /* * struct rseq_cs is aligned on 4 * 8 bytes to ensure it is always * contained within a single cache-line. It is usually declared as * link-time constant data. */ struct rseq_cs { /* Version of this structure. */ __u32 version; /* enum rseq_cs_flags */ __u32 flags; __u64 start_ip; /* Offset from start_ip. */ __u64 post_commit_offset; __u64 abort_ip; } __attribute__((aligned(4 * sizeof(__u64)))); /* * struct rseq is aligned on 4 * 8 bytes to ensure it is always * contained within a single cache-line. * * A single struct rseq per thread is allowed. */ struct rseq { /* * Restartable sequences cpu_id_start field. Updated by the * kernel. Read by user-space with single-copy atomicity * semantics. This field should only be read by the thread which * registered this data structure. Aligned on 32-bit. Always * contains a value in the range of possible CPUs, although the * value may not be the actual current CPU (e.g. if rseq is not * initialized). This CPU number value should always be compared * against the value of the cpu_id field before performing a rseq * commit or returning a value read from a data structure indexed * using the cpu_id_start value. */ __u32 cpu_id_start; /* * Restartable sequences cpu_id field. Updated by the kernel. * Read by user-space with single-copy atomicity semantics. This * field should only be read by the thread which registered this * data structure. Aligned on 32-bit. Values * RSEQ_CPU_ID_UNINITIALIZED and RSEQ_CPU_ID_REGISTRATION_FAILED * have a special semantic: the former means "rseq uninitialized", * and latter means "rseq initialization failed". This value is * meant to be read within rseq critical sections and compared * with the cpu_id_start value previously read, before performing * the commit instruction, or read and compared with the * cpu_id_start value before returning a value loaded from a data * structure indexed using the cpu_id_start value. */ __u32 cpu_id; /* * Restartable sequences rseq_cs field. * * Contains NULL when no critical section is active for the current * thread, or holds a pointer to the currently active struct rseq_cs. * * Updated by user-space, which sets the address of the currently * active rseq_cs at the beginning of assembly instruction sequence * block, and set to NULL by the kernel when it restarts an assembly * instruction sequence block, as well as when the kernel detects that * it is preempting or delivering a signal outside of the range * targeted by the rseq_cs. Also needs to be set to NULL by user-space * before reclaiming memory that contains the targeted struct rseq_cs. * * Read and set by the kernel. Set by user-space with single-copy * atomicity semantics. This field should only be updated by the * thread which registered this data structure. Aligned on 64-bit. */ union { __u64 ptr64; #ifdef __LP64__ __u64 ptr; #else struct { #if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || defined(__BIG_ENDIAN) __u32 padding; /* Initialized to zero. */ __u32 ptr32; #else /* LITTLE */ __u32 ptr32; __u32 padding; /* Initialized to zero. */ #endif /* ENDIAN */ } ptr; #endif } rseq_cs; /* * Restartable sequences flags field. * * This field should only be updated by the thread which * registered this data structure. Read by the kernel. * Mainly used for single-stepping through rseq critical sections * with debuggers. * * - RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT * Inhibit instruction sequence block restart on preemption * for this thread. * - RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL * Inhibit instruction sequence block restart on signal * delivery for this thread. * - RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE * Inhibit instruction sequence block restart on migration for * this thread. */ __u32 flags; } __attribute__((aligned(4 * sizeof(__u64)))); #endif /* _LINUX_RSEQ_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/apm_bios.h������������������������������������������������������������������������������������0000644�����������������00000007143�14763166027�0007666 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Include file for the interface to an APM BIOS * Copyright 1994-2001 Stephen Rothwell (sfr@canb.auug.org.au) * * 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, 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. */ #ifndef _LINUX_APM_H #define _LINUX_APM_H #include <linux/types.h> typedef unsigned short apm_event_t; typedef unsigned short apm_eventinfo_t; struct apm_bios_info { __u16 version; __u16 cseg; __u32 offset; __u16 cseg_16; __u16 dseg; __u16 flags; __u16 cseg_len; __u16 cseg_16_len; __u16 dseg_len; }; /* * Power states */ #define APM_STATE_READY 0x0000 #define APM_STATE_STANDBY 0x0001 #define APM_STATE_SUSPEND 0x0002 #define APM_STATE_OFF 0x0003 #define APM_STATE_BUSY 0x0004 #define APM_STATE_REJECT 0x0005 #define APM_STATE_OEM_SYS 0x0020 #define APM_STATE_OEM_DEV 0x0040 #define APM_STATE_DISABLE 0x0000 #define APM_STATE_ENABLE 0x0001 #define APM_STATE_DISENGAGE 0x0000 #define APM_STATE_ENGAGE 0x0001 /* * Events (results of Get PM Event) */ #define APM_SYS_STANDBY 0x0001 #define APM_SYS_SUSPEND 0x0002 #define APM_NORMAL_RESUME 0x0003 #define APM_CRITICAL_RESUME 0x0004 #define APM_LOW_BATTERY 0x0005 #define APM_POWER_STATUS_CHANGE 0x0006 #define APM_UPDATE_TIME 0x0007 #define APM_CRITICAL_SUSPEND 0x0008 #define APM_USER_STANDBY 0x0009 #define APM_USER_SUSPEND 0x000a #define APM_STANDBY_RESUME 0x000b #define APM_CAPABILITY_CHANGE 0x000c #define APM_USER_HIBERNATION 0x000d #define APM_HIBERNATION_RESUME 0x000e /* * Error codes */ #define APM_SUCCESS 0x00 #define APM_DISABLED 0x01 #define APM_CONNECTED 0x02 #define APM_NOT_CONNECTED 0x03 #define APM_16_CONNECTED 0x05 #define APM_16_UNSUPPORTED 0x06 #define APM_32_CONNECTED 0x07 #define APM_32_UNSUPPORTED 0x08 #define APM_BAD_DEVICE 0x09 #define APM_BAD_PARAM 0x0a #define APM_NOT_ENGAGED 0x0b #define APM_BAD_FUNCTION 0x0c #define APM_RESUME_DISABLED 0x0d #define APM_NO_ERROR 0x53 #define APM_BAD_STATE 0x60 #define APM_NO_EVENTS 0x80 #define APM_NOT_PRESENT 0x86 /* * APM Device IDs */ #define APM_DEVICE_BIOS 0x0000 #define APM_DEVICE_ALL 0x0001 #define APM_DEVICE_DISPLAY 0x0100 #define APM_DEVICE_STORAGE 0x0200 #define APM_DEVICE_PARALLEL 0x0300 #define APM_DEVICE_SERIAL 0x0400 #define APM_DEVICE_NETWORK 0x0500 #define APM_DEVICE_PCMCIA 0x0600 #define APM_DEVICE_BATTERY 0x8000 #define APM_DEVICE_OEM 0xe000 #define APM_DEVICE_OLD_ALL 0xffff #define APM_DEVICE_CLASS 0x00ff #define APM_DEVICE_MASK 0xff00 /* * Battery status */ #define APM_MAX_BATTERIES 2 /* * APM defined capability bit flags */ #define APM_CAP_GLOBAL_STANDBY 0x0001 #define APM_CAP_GLOBAL_SUSPEND 0x0002 #define APM_CAP_RESUME_STANDBY_TIMER 0x0004 /* Timer resume from standby */ #define APM_CAP_RESUME_SUSPEND_TIMER 0x0008 /* Timer resume from suspend */ #define APM_CAP_RESUME_STANDBY_RING 0x0010 /* Resume on Ring fr standby */ #define APM_CAP_RESUME_SUSPEND_RING 0x0020 /* Resume on Ring fr suspend */ #define APM_CAP_RESUME_STANDBY_PCMCIA 0x0040 /* Resume on PCMCIA Ring */ #define APM_CAP_RESUME_SUSPEND_PCMCIA 0x0080 /* Resume on PCMCIA Ring */ /* * ioctl operations */ #include <linux/ioctl.h> #define APM_IOC_STANDBY _IO('A', 1) #define APM_IOC_SUSPEND _IO('A', 2) #endif /* _LINUX_APM_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/virtio_scsi.h���������������������������������������������������������������������������������0000644�����������������00000013623�14763166027�0010432 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _LINUX_VIRTIO_SCSI_H #define _LINUX_VIRTIO_SCSI_H #include <linux/virtio_types.h> /* Default values of the CDB and sense data size configuration fields */ #define VIRTIO_SCSI_CDB_DEFAULT_SIZE 32 #define VIRTIO_SCSI_SENSE_DEFAULT_SIZE 96 #ifndef VIRTIO_SCSI_CDB_SIZE #define VIRTIO_SCSI_CDB_SIZE VIRTIO_SCSI_CDB_DEFAULT_SIZE #endif #ifndef VIRTIO_SCSI_SENSE_SIZE #define VIRTIO_SCSI_SENSE_SIZE VIRTIO_SCSI_SENSE_DEFAULT_SIZE #endif /* SCSI command request, followed by data-out */ struct virtio_scsi_cmd_req { __u8 lun[8]; /* Logical Unit Number */ __virtio64 tag; /* Command identifier */ __u8 task_attr; /* Task attribute */ __u8 prio; /* SAM command priority field */ __u8 crn; __u8 cdb[VIRTIO_SCSI_CDB_SIZE]; } __attribute__((packed)); /* SCSI command request, followed by protection information */ struct virtio_scsi_cmd_req_pi { __u8 lun[8]; /* Logical Unit Number */ __virtio64 tag; /* Command identifier */ __u8 task_attr; /* Task attribute */ __u8 prio; /* SAM command priority field */ __u8 crn; __virtio32 pi_bytesout; /* DataOUT PI Number of bytes */ __virtio32 pi_bytesin; /* DataIN PI Number of bytes */ __u8 cdb[VIRTIO_SCSI_CDB_SIZE]; } __attribute__((packed)); /* Response, followed by sense data and data-in */ struct virtio_scsi_cmd_resp { __virtio32 sense_len; /* Sense data length */ __virtio32 resid; /* Residual bytes in data buffer */ __virtio16 status_qualifier; /* Status qualifier */ __u8 status; /* Command completion status */ __u8 response; /* Response values */ __u8 sense[VIRTIO_SCSI_SENSE_SIZE]; } __attribute__((packed)); /* Task Management Request */ struct virtio_scsi_ctrl_tmf_req { __virtio32 type; __virtio32 subtype; __u8 lun[8]; __virtio64 tag; } __attribute__((packed)); struct virtio_scsi_ctrl_tmf_resp { __u8 response; } __attribute__((packed)); /* Asynchronous notification query/subscription */ struct virtio_scsi_ctrl_an_req { __virtio32 type; __u8 lun[8]; __virtio32 event_requested; } __attribute__((packed)); struct virtio_scsi_ctrl_an_resp { __virtio32 event_actual; __u8 response; } __attribute__((packed)); struct virtio_scsi_event { __virtio32 event; __u8 lun[8]; __virtio32 reason; } __attribute__((packed)); struct virtio_scsi_config { __u32 num_queues; __u32 seg_max; __u32 max_sectors; __u32 cmd_per_lun; __u32 event_info_size; __u32 sense_size; __u32 cdb_size; __u16 max_channel; __u16 max_target; __u32 max_lun; } __attribute__((packed)); /* Feature Bits */ #define VIRTIO_SCSI_F_INOUT 0 #define VIRTIO_SCSI_F_HOTPLUG 1 #define VIRTIO_SCSI_F_CHANGE 2 #define VIRTIO_SCSI_F_T10_PI 3 /* Response codes */ #define VIRTIO_SCSI_S_OK 0 #define VIRTIO_SCSI_S_OVERRUN 1 #define VIRTIO_SCSI_S_ABORTED 2 #define VIRTIO_SCSI_S_BAD_TARGET 3 #define VIRTIO_SCSI_S_RESET 4 #define VIRTIO_SCSI_S_BUSY 5 #define VIRTIO_SCSI_S_TRANSPORT_FAILURE 6 #define VIRTIO_SCSI_S_TARGET_FAILURE 7 #define VIRTIO_SCSI_S_NEXUS_FAILURE 8 #define VIRTIO_SCSI_S_FAILURE 9 #define VIRTIO_SCSI_S_FUNCTION_SUCCEEDED 10 #define VIRTIO_SCSI_S_FUNCTION_REJECTED 11 #define VIRTIO_SCSI_S_INCORRECT_LUN 12 /* Controlq type codes. */ #define VIRTIO_SCSI_T_TMF 0 #define VIRTIO_SCSI_T_AN_QUERY 1 #define VIRTIO_SCSI_T_AN_SUBSCRIBE 2 /* Valid TMF subtypes. */ #define VIRTIO_SCSI_T_TMF_ABORT_TASK 0 #define VIRTIO_SCSI_T_TMF_ABORT_TASK_SET 1 #define VIRTIO_SCSI_T_TMF_CLEAR_ACA 2 #define VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET 3 #define VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET 4 #define VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET 5 #define VIRTIO_SCSI_T_TMF_QUERY_TASK 6 #define VIRTIO_SCSI_T_TMF_QUERY_TASK_SET 7 /* Events. */ #define VIRTIO_SCSI_T_EVENTS_MISSED 0x80000000 #define VIRTIO_SCSI_T_NO_EVENT 0 #define VIRTIO_SCSI_T_TRANSPORT_RESET 1 #define VIRTIO_SCSI_T_ASYNC_NOTIFY 2 #define VIRTIO_SCSI_T_PARAM_CHANGE 3 /* Reasons of transport reset event */ #define VIRTIO_SCSI_EVT_RESET_HARD 0 #define VIRTIO_SCSI_EVT_RESET_RESCAN 1 #define VIRTIO_SCSI_EVT_RESET_REMOVED 2 #define VIRTIO_SCSI_S_SIMPLE 0 #define VIRTIO_SCSI_S_ORDERED 1 #define VIRTIO_SCSI_S_HEAD 2 #define VIRTIO_SCSI_S_ACA 3 #endif /* _LINUX_VIRTIO_SCSI_H */ �������������������������������������������������������������������������������������������������������������linux/atm.h�����������������������������������������������������������������������������������������0000644�����������������00000017320�14763166027�0006654 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atm.h - general ATM declarations */ /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ /* * WARNING: User-space programs should not #include <linux/atm.h> directly. * Instead, #include <atm.h> */ #ifndef _LINUX_ATM_H #define _LINUX_ATM_H /* * BEGIN_xx and END_xx markers are used for automatic generation of * documentation. Do not change them. */ #include <linux/atmapi.h> #include <linux/atmsap.h> #include <linux/atmioc.h> #include <linux/types.h> /* general ATM constants */ #define ATM_CELL_SIZE 53 /* ATM cell size incl. header */ #define ATM_CELL_PAYLOAD 48 /* ATM payload size */ #define ATM_AAL0_SDU 52 /* AAL0 SDU size */ #define ATM_MAX_AAL34_PDU 65535 /* maximum AAL3/4 PDU payload */ #define ATM_AAL5_TRAILER 8 /* AAL5 trailer size */ #define ATM_MAX_AAL5_PDU 65535 /* maximum AAL5 PDU payload */ #define ATM_MAX_CDV 9999 /* maximum (default) CDV */ #define ATM_NOT_RSV_VCI 32 /* first non-reserved VCI value */ #define ATM_MAX_VPI 255 /* maximum VPI at the UNI */ #define ATM_MAX_VPI_NNI 4096 /* maximum VPI at the NNI */ #define ATM_MAX_VCI 65535 /* maximum VCI */ /* "protcol" values for the socket system call */ #define ATM_NO_AAL 0 /* AAL not specified */ #define ATM_AAL0 13 /* "raw" ATM cells */ #define ATM_AAL1 1 /* AAL1 (CBR) */ #define ATM_AAL2 2 /* AAL2 (VBR) */ #define ATM_AAL34 3 /* AAL3/4 (data) */ #define ATM_AAL5 5 /* AAL5 (data) */ /* * socket option name coding functions * * Note that __SO_ENCODE and __SO_LEVEL are somewhat a hack since the * << 22 only reserves 9 bits for the level. On some architectures * SOL_SOCKET is 0xFFFF, so that's a bit of a problem */ #define __SO_ENCODE(l,n,t) ((((l) & 0x1FF) << 22) | ((n) << 16) | \ sizeof(t)) #define __SO_LEVEL_MATCH(c,m) (((c) >> 22) == ((m) & 0x1FF)) #define __SO_NUMBER(c) (((c) >> 16) & 0x3f) #define __SO_SIZE(c) ((c) & 0x3fff) /* * ATM layer */ #define SO_SETCLP __SO_ENCODE(SOL_ATM,0,int) /* set CLP bit value - TODO */ #define SO_CIRANGE __SO_ENCODE(SOL_ATM,1,struct atm_cirange) /* connection identifier range; socket must be bound or connected */ #define SO_ATMQOS __SO_ENCODE(SOL_ATM,2,struct atm_qos) /* Quality of Service setting */ #define SO_ATMSAP __SO_ENCODE(SOL_ATM,3,struct atm_sap) /* Service Access Point */ #define SO_ATMPVC __SO_ENCODE(SOL_ATM,4,struct sockaddr_atmpvc) /* "PVC" address (also for SVCs); get only */ #define SO_MULTIPOINT __SO_ENCODE(SOL_ATM, 5, int) /* make this vc a p2mp */ /* * Note @@@: since the socket layers don't really distinguish the control and * the data plane but generally seems to be data plane-centric, any layer is * about equally wrong for the SAP. If you have a better idea about this, * please speak up ... */ /* ATM cell header (for AAL0) */ /* BEGIN_CH */ #define ATM_HDR_GFC_MASK 0xf0000000 #define ATM_HDR_GFC_SHIFT 28 #define ATM_HDR_VPI_MASK 0x0ff00000 #define ATM_HDR_VPI_SHIFT 20 #define ATM_HDR_VCI_MASK 0x000ffff0 #define ATM_HDR_VCI_SHIFT 4 #define ATM_HDR_PTI_MASK 0x0000000e #define ATM_HDR_PTI_SHIFT 1 #define ATM_HDR_CLP 0x00000001 /* END_CH */ /* PTI codings */ /* BEGIN_PTI */ #define ATM_PTI_US0 0 /* user data cell, congestion not exp, SDU-type 0 */ #define ATM_PTI_US1 1 /* user data cell, congestion not exp, SDU-type 1 */ #define ATM_PTI_UCES0 2 /* user data cell, cong. experienced, SDU-type 0 */ #define ATM_PTI_UCES1 3 /* user data cell, cong. experienced, SDU-type 1 */ #define ATM_PTI_SEGF5 4 /* segment OAM F5 flow related cell */ #define ATM_PTI_E2EF5 5 /* end-to-end OAM F5 flow related cell */ #define ATM_PTI_RSV_RM 6 /* reserved for traffic control/resource mgmt */ #define ATM_PTI_RSV 7 /* reserved */ /* END_PTI */ /* * The following items should stay in linux/atm.h, which should be linked to * netatm/atm.h */ /* Traffic description */ #define ATM_NONE 0 /* no traffic */ #define ATM_UBR 1 #define ATM_CBR 2 #define ATM_VBR 3 #define ATM_ABR 4 #define ATM_ANYCLASS 5 /* compatible with everything */ #define ATM_MAX_PCR -1 /* maximum available PCR */ struct atm_trafprm { unsigned char traffic_class; /* traffic class (ATM_UBR, ...) */ int max_pcr; /* maximum PCR in cells per second */ int pcr; /* desired PCR in cells per second */ int min_pcr; /* minimum PCR in cells per second */ int max_cdv; /* maximum CDV in microseconds */ int max_sdu; /* maximum SDU in bytes */ /* extra params for ABR */ unsigned int icr; /* Initial Cell Rate (24-bit) */ unsigned int tbe; /* Transient Buffer Exposure (24-bit) */ unsigned int frtt : 24; /* Fixed Round Trip Time (24-bit) */ unsigned int rif : 4; /* Rate Increment Factor (4-bit) */ unsigned int rdf : 4; /* Rate Decrease Factor (4-bit) */ unsigned int nrm_pres :1; /* nrm present bit */ unsigned int trm_pres :1; /* rm present bit */ unsigned int adtf_pres :1; /* adtf present bit */ unsigned int cdf_pres :1; /* cdf present bit*/ unsigned int nrm :3; /* Max # of Cells for each forward RM cell (3-bit) */ unsigned int trm :3; /* Time between forward RM cells (3-bit) */ unsigned int adtf :10; /* ACR Decrease Time Factor (10-bit) */ unsigned int cdf :3; /* Cutoff Decrease Factor (3-bit) */ unsigned int spare :9; /* spare bits */ }; struct atm_qos { struct atm_trafprm txtp; /* parameters in TX direction */ struct atm_trafprm rxtp __ATM_API_ALIGN; /* parameters in RX direction */ unsigned char aal __ATM_API_ALIGN; }; /* PVC addressing */ #define ATM_ITF_ANY -1 /* "magic" PVC address values */ #define ATM_VPI_ANY -1 #define ATM_VCI_ANY -1 #define ATM_VPI_UNSPEC -2 #define ATM_VCI_UNSPEC -2 struct sockaddr_atmpvc { unsigned short sap_family; /* address family, AF_ATMPVC */ struct { /* PVC address */ short itf; /* ATM interface */ short vpi; /* VPI (only 8 bits at UNI) */ int vci; /* VCI (only 16 bits at UNI) */ } sap_addr __ATM_API_ALIGN; /* PVC address */ }; /* SVC addressing */ #define ATM_ESA_LEN 20 /* ATM End System Address length */ #define ATM_E164_LEN 12 /* maximum E.164 number length */ #define ATM_AFI_DCC 0x39 /* DCC ATM Format */ #define ATM_AFI_ICD 0x47 /* ICD ATM Format */ #define ATM_AFI_E164 0x45 /* E.164 ATM Format */ #define ATM_AFI_LOCAL 0x49 /* Local ATM Format */ #define ATM_AFI_DCC_GROUP 0xBD /* DCC ATM Group Format */ #define ATM_AFI_ICD_GROUP 0xC5 /* ICD ATM Group Format */ #define ATM_AFI_E164_GROUP 0xC3 /* E.164 ATM Group Format */ #define ATM_AFI_LOCAL_GROUP 0xC7 /* Local ATM Group Format */ #define ATM_LIJ_NONE 0 /* no leaf-initiated join */ #define ATM_LIJ 1 /* request joining */ #define ATM_LIJ_RPJ 2 /* set to root-prompted join */ #define ATM_LIJ_NJ 3 /* set to network join */ struct sockaddr_atmsvc { unsigned short sas_family; /* address family, AF_ATMSVC */ struct { /* SVC address */ unsigned char prv[ATM_ESA_LEN];/* private ATM address */ char pub[ATM_E164_LEN+1]; /* public address (E.164) */ /* unused addresses must be bzero'ed */ char lij_type; /* role in LIJ call; one of ATM_LIJ* */ __u32 lij_id; /* LIJ call identifier */ } sas_addr __ATM_API_ALIGN; /* SVC address */ }; static __inline__ int atmsvc_addr_in_use(struct sockaddr_atmsvc addr) { return *addr.sas_addr.prv || *addr.sas_addr.pub; } static __inline__ int atmpvc_addr_in_use(struct sockaddr_atmpvc addr) { return addr.sap_addr.itf || addr.sap_addr.vpi || addr.sap_addr.vci; } /* * Some stuff for linux/sockios.h */ struct atmif_sioc { int number; int length; void *arg; }; typedef unsigned short atm_backend_t; #endif /* _LINUX_ATM_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/atmsap.h��������������������������������������������������������������������������������������0000644�����������������00000011552�14763166027�0007361 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atmsap.h - ATM Service Access Point addressing definitions */ /* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ #ifndef _LINUX_ATMSAP_H #define _LINUX_ATMSAP_H #include <linux/atmapi.h> /* * BEGIN_xx and END_xx markers are used for automatic generation of * documentation. Do not change them. */ /* * Layer 2 protocol identifiers */ /* BEGIN_L2 */ #define ATM_L2_NONE 0 /* L2 not specified */ #define ATM_L2_ISO1745 0x01 /* Basic mode ISO 1745 */ #define ATM_L2_Q291 0x02 /* ITU-T Q.291 (Rec. I.441) */ #define ATM_L2_X25_LL 0x06 /* ITU-T X.25, link layer */ #define ATM_L2_X25_ML 0x07 /* ITU-T X.25, multilink */ #define ATM_L2_LAPB 0x08 /* Extended LAPB, half-duplex (Rec. T.71) */ #define ATM_L2_HDLC_ARM 0x09 /* HDLC ARM (ISO/IEC 4335) */ #define ATM_L2_HDLC_NRM 0x0a /* HDLC NRM (ISO/IEC 4335) */ #define ATM_L2_HDLC_ABM 0x0b /* HDLC ABM (ISO/IEC 4335) */ #define ATM_L2_ISO8802 0x0c /* LAN LLC (ISO/IEC 8802/2) */ #define ATM_L2_X75 0x0d /* ITU-T X.75, SLP */ #define ATM_L2_Q922 0x0e /* ITU-T Q.922 */ #define ATM_L2_USER 0x10 /* user-specified */ #define ATM_L2_ISO7776 0x11 /* ISO 7776 DTE-DTE */ /* END_L2 */ /* * Layer 3 protocol identifiers */ /* BEGIN_L3 */ #define ATM_L3_NONE 0 /* L3 not specified */ #define ATM_L3_X25 0x06 /* ITU-T X.25, packet layer */ #define ATM_L3_ISO8208 0x07 /* ISO/IEC 8208 */ #define ATM_L3_X223 0x08 /* ITU-T X.223 | ISO/IEC 8878 */ #define ATM_L3_ISO8473 0x09 /* ITU-T X.233 | ISO/IEC 8473 */ #define ATM_L3_T70 0x0a /* ITU-T T.70 minimum network layer */ #define ATM_L3_TR9577 0x0b /* ISO/IEC TR 9577 */ #define ATM_L3_H310 0x0c /* ITU-T Recommendation H.310 */ #define ATM_L3_H321 0x0d /* ITU-T Recommendation H.321 */ #define ATM_L3_USER 0x10 /* user-specified */ /* END_L3 */ /* * High layer identifiers */ /* BEGIN_HL */ #define ATM_HL_NONE 0 /* HL not specified */ #define ATM_HL_ISO 0x01 /* ISO */ #define ATM_HL_USER 0x02 /* user-specific */ #define ATM_HL_HLP 0x03 /* high layer profile - UNI 3.0 only */ #define ATM_HL_VENDOR 0x04 /* vendor-specific application identifier */ /* END_HL */ /* * ITU-T coded mode of operation */ /* BEGIN_IMD */ #define ATM_IMD_NONE 0 /* mode not specified */ #define ATM_IMD_NORMAL 1 /* normal mode of operation */ #define ATM_IMD_EXTENDED 2 /* extended mode of operation */ /* END_IMD */ /* * H.310 code points */ #define ATM_TT_NONE 0 /* terminal type not specified */ #define ATM_TT_RX 1 /* receive only */ #define ATM_TT_TX 2 /* send only */ #define ATM_TT_RXTX 3 /* receive and send */ #define ATM_MC_NONE 0 /* no multiplexing */ #define ATM_MC_TS 1 /* transport stream (TS) */ #define ATM_MC_TS_FEC 2 /* transport stream with forward error corr. */ #define ATM_MC_PS 3 /* program stream (PS) */ #define ATM_MC_PS_FEC 4 /* program stream with forward error corr. */ #define ATM_MC_H221 5 /* ITU-T Rec. H.221 */ /* * SAP structures */ #define ATM_MAX_HLI 8 /* maximum high-layer information length */ struct atm_blli { unsigned char l2_proto; /* layer 2 protocol */ union { struct { unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */ /* absent */ unsigned char window; /* window size (k), 1-127 (0 to omit) */ } itu; /* ITU-T encoding */ unsigned char user; /* user-specified l2 information */ } l2; unsigned char l3_proto; /* layer 3 protocol */ union { struct { unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */ /* absent */ unsigned char def_size; /* default packet size (log2), 4-12 (0 to */ /* omit) */ unsigned char window;/* packet window size, 1-127 (0 to omit) */ } itu; /* ITU-T encoding */ unsigned char user; /* user specified l3 information */ struct { /* if l3_proto = ATM_L3_H310 */ unsigned char term_type; /* terminal type */ unsigned char fw_mpx_cap; /* forward multiplexing capability */ /* only if term_type != ATM_TT_NONE */ unsigned char bw_mpx_cap; /* backward multiplexing capability */ /* only if term_type != ATM_TT_NONE */ } h310; struct { /* if l3_proto = ATM_L3_TR9577 */ unsigned char ipi; /* initial protocol id */ unsigned char snap[5];/* IEEE 802.1 SNAP identifier */ /* (only if ipi == NLPID_IEEE802_1_SNAP) */ } tr9577; } l3; } __ATM_API_ALIGN; struct atm_bhli { unsigned char hl_type; /* high layer information type */ unsigned char hl_length; /* length (only if hl_type == ATM_HL_USER || */ /* hl_type == ATM_HL_ISO) */ unsigned char hl_info[ATM_MAX_HLI];/* high layer information */ }; #define ATM_MAX_BLLI 3 /* maximum number of BLLI elements */ struct atm_sap { struct atm_bhli bhli; /* local SAP, high-layer information */ struct atm_blli blli[ATM_MAX_BLLI] __ATM_API_ALIGN; /* local SAP, low-layer info */ }; static __inline__ int blli_in_use(struct atm_blli blli) { return blli.l2_proto || blli.l3_proto; } #endif ������������������������������������������������������������������������������������������������������������������������������������������������������linux/kernel-page-flags.h���������������������������������������������������������������������������0000644�����������������00000001604�14763166027�0011355 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef LINUX_KERNEL_PAGE_FLAGS_H #define LINUX_KERNEL_PAGE_FLAGS_H /* * Stable page flag bits exported to user space */ #define KPF_LOCKED 0 #define KPF_ERROR 1 #define KPF_REFERENCED 2 #define KPF_UPTODATE 3 #define KPF_DIRTY 4 #define KPF_LRU 5 #define KPF_ACTIVE 6 #define KPF_SLAB 7 #define KPF_WRITEBACK 8 #define KPF_RECLAIM 9 #define KPF_BUDDY 10 /* 11-20: new additions in 2.6.31 */ #define KPF_MMAP 11 #define KPF_ANON 12 #define KPF_SWAPCACHE 13 #define KPF_SWAPBACKED 14 #define KPF_COMPOUND_HEAD 15 #define KPF_COMPOUND_TAIL 16 #define KPF_HUGE 17 #define KPF_UNEVICTABLE 18 #define KPF_HWPOISON 19 #define KPF_NOPAGE 20 #define KPF_KSM 21 #define KPF_THP 22 #define KPF_BALLOON 23 #define KPF_ZERO_PAGE 24 #define KPF_IDLE 25 #define KPF_PGTABLE 26 #endif /* LINUX_KERNEL_PAGE_FLAGS_H */ ����������������������������������������������������������������������������������������������������������������������������linux/gpio.h����������������������������������������������������������������������������������������0000644�����������������00000013166�14763166027�0007035 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * <linux/gpio.h> - userspace ABI for the GPIO character devices * * Copyright (C) 2016 Linus Walleij * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #ifndef _GPIO_H_ #define _GPIO_H_ #include <linux/ioctl.h> #include <linux/types.h> /** * struct gpiochip_info - Information about a certain GPIO chip * @name: the Linux kernel name of this GPIO chip * @label: a functional name for this GPIO chip, such as a product * number, may be NULL * @lines: number of GPIO lines on this chip */ struct gpiochip_info { char name[32]; char label[32]; __u32 lines; }; /* Informational flags */ #define GPIOLINE_FLAG_KERNEL (1UL << 0) /* Line used by the kernel */ #define GPIOLINE_FLAG_IS_OUT (1UL << 1) #define GPIOLINE_FLAG_ACTIVE_LOW (1UL << 2) #define GPIOLINE_FLAG_OPEN_DRAIN (1UL << 3) #define GPIOLINE_FLAG_OPEN_SOURCE (1UL << 4) /** * struct gpioline_info - Information about a certain GPIO line * @line_offset: the local offset on this GPIO device, fill this in when * requesting the line information from the kernel * @flags: various flags for this line * @name: the name of this GPIO line, such as the output pin of the line on the * chip, a rail or a pin header name on a board, as specified by the gpio * chip, may be NULL * @consumer: a functional name for the consumer of this GPIO line as set by * whatever is using it, will be NULL if there is no current user but may * also be NULL if the consumer doesn't set this up */ struct gpioline_info { __u32 line_offset; __u32 flags; char name[32]; char consumer[32]; }; /* Maximum number of requested handles */ #define GPIOHANDLES_MAX 64 /* Linerequest flags */ #define GPIOHANDLE_REQUEST_INPUT (1UL << 0) #define GPIOHANDLE_REQUEST_OUTPUT (1UL << 1) #define GPIOHANDLE_REQUEST_ACTIVE_LOW (1UL << 2) #define GPIOHANDLE_REQUEST_OPEN_DRAIN (1UL << 3) #define GPIOHANDLE_REQUEST_OPEN_SOURCE (1UL << 4) /** * struct gpiohandle_request - Information about a GPIO handle request * @lineoffsets: an array desired lines, specified by offset index for the * associated GPIO device * @flags: desired flags for the desired GPIO lines, such as * GPIOHANDLE_REQUEST_OUTPUT, GPIOHANDLE_REQUEST_ACTIVE_LOW etc, OR:ed * together. Note that even if multiple lines are requested, the same flags * must be applicable to all of them, if you want lines with individual * flags set, request them one by one. It is possible to select * a batch of input or output lines, but they must all have the same * characteristics, i.e. all inputs or all outputs, all active low etc * @default_values: if the GPIOHANDLE_REQUEST_OUTPUT is set for a requested * line, this specifies the default output value, should be 0 (low) or * 1 (high), anything else than 0 or 1 will be interpreted as 1 (high) * @consumer_label: a desired consumer label for the selected GPIO line(s) * such as "my-bitbanged-relay" * @lines: number of lines requested in this request, i.e. the number of * valid fields in the above arrays, set to 1 to request a single line * @fd: if successful this field will contain a valid anonymous file handle * after a GPIO_GET_LINEHANDLE_IOCTL operation, zero or negative value * means error */ struct gpiohandle_request { __u32 lineoffsets[GPIOHANDLES_MAX]; __u32 flags; __u8 default_values[GPIOHANDLES_MAX]; char consumer_label[32]; __u32 lines; int fd; }; /** * struct gpiohandle_data - Information of values on a GPIO handle * @values: when getting the state of lines this contains the current * state of a line, when setting the state of lines these should contain * the desired target state */ struct gpiohandle_data { __u8 values[GPIOHANDLES_MAX]; }; #define GPIOHANDLE_GET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x08, struct gpiohandle_data) #define GPIOHANDLE_SET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x09, struct gpiohandle_data) /* Eventrequest flags */ #define GPIOEVENT_REQUEST_RISING_EDGE (1UL << 0) #define GPIOEVENT_REQUEST_FALLING_EDGE (1UL << 1) #define GPIOEVENT_REQUEST_BOTH_EDGES ((1UL << 0) | (1UL << 1)) /** * struct gpioevent_request - Information about a GPIO event request * @lineoffset: the desired line to subscribe to events from, specified by * offset index for the associated GPIO device * @handleflags: desired handle flags for the desired GPIO line, such as * GPIOHANDLE_REQUEST_ACTIVE_LOW or GPIOHANDLE_REQUEST_OPEN_DRAIN * @eventflags: desired flags for the desired GPIO event line, such as * GPIOEVENT_REQUEST_RISING_EDGE or GPIOEVENT_REQUEST_FALLING_EDGE * @consumer_label: a desired consumer label for the selected GPIO line(s) * such as "my-listener" * @fd: if successful this field will contain a valid anonymous file handle * after a GPIO_GET_LINEEVENT_IOCTL operation, zero or negative value * means error */ struct gpioevent_request { __u32 lineoffset; __u32 handleflags; __u32 eventflags; char consumer_label[32]; int fd; }; /** * GPIO event types */ #define GPIOEVENT_EVENT_RISING_EDGE 0x01 #define GPIOEVENT_EVENT_FALLING_EDGE 0x02 /** * struct gpioevent_data - The actual event being pushed to userspace * @timestamp: best estimate of time of event occurrence, in nanoseconds * @id: event identifier */ struct gpioevent_data { __u64 timestamp; __u32 id; }; #define GPIO_GET_CHIPINFO_IOCTL _IOR(0xB4, 0x01, struct gpiochip_info) #define GPIO_GET_LINEINFO_IOCTL _IOWR(0xB4, 0x02, struct gpioline_info) #define GPIO_GET_LINEHANDLE_IOCTL _IOWR(0xB4, 0x03, struct gpiohandle_request) #define GPIO_GET_LINEEVENT_IOCTL _IOWR(0xB4, 0x04, struct gpioevent_request) #endif /* _GPIO_H_ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/veth.h����������������������������������������������������������������������������������������0000644�����������������00000000340�14763166027�0007033 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __NET_VETH_H_ #define __NET_VETH_H_ enum { VETH_INFO_UNSPEC, VETH_INFO_PEER, __VETH_INFO_MAX #define VETH_INFO_MAX (__VETH_INFO_MAX - 1) }; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_plip.h�������������������������������������������������������������������������������������0000644�����������������00000001224�14763166027�0007511 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * NET3 PLIP tuning facilities for the new Niibe PLIP. * * 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. * */ #ifndef _LINUX_IF_PLIP_H #define _LINUX_IF_PLIP_H #include <linux/sockios.h> #define SIOCDEVPLIP SIOCDEVPRIVATE struct plipconf { unsigned short pcmd; unsigned long nibble; unsigned long trigger; }; #define PLIP_GET_TIMEOUT 0x1 #define PLIP_SET_TIMEOUT 0x2 #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/atmarp.h��������������������������������������������������������������������������������������0000644�����������������00000002420�14763166027�0007352 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atmarp.h - ATM ARP protocol and kernel-demon interface definitions */ /* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ #ifndef _LINUX_ATMARP_H #define _LINUX_ATMARP_H #include <linux/types.h> #include <linux/atmapi.h> #include <linux/atmioc.h> #define ATMARP_RETRY_DELAY 30 /* request next resolution or forget NAK after 30 sec - should go into atmclip.h */ #define ATMARP_MAX_UNRES_PACKETS 5 /* queue that many packets while waiting for the resolver */ #define ATMARPD_CTRL _IO('a',ATMIOC_CLIP+1) /* become atmarpd ctrl sock */ #define ATMARP_MKIP _IO('a',ATMIOC_CLIP+2) /* attach socket to IP */ #define ATMARP_SETENTRY _IO('a',ATMIOC_CLIP+3) /* fill or hide ARP entry */ #define ATMARP_ENCAP _IO('a',ATMIOC_CLIP+5) /* change encapsulation */ enum atmarp_ctrl_type { act_invalid, /* catch uninitialized structures */ act_need, /* need address resolution */ act_up, /* interface is coming up */ act_down, /* interface is going down */ act_change /* interface configuration has changed */ }; struct atmarp_ctrl { enum atmarp_ctrl_type type; /* message type */ int itf_num;/* interface number (if present) */ __be32 ip; /* IP address (act_need only) */ }; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/byteorder/little_endian.h���������������������������������������������������������������������0000644�����������������00000007033�14763166027�0012705 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_BYTEORDER_LITTLE_ENDIAN_H #define _LINUX_BYTEORDER_LITTLE_ENDIAN_H #ifndef __LITTLE_ENDIAN #define __LITTLE_ENDIAN 1234 #endif #ifndef __LITTLE_ENDIAN_BITFIELD #define __LITTLE_ENDIAN_BITFIELD #endif #include <linux/types.h> #include <linux/swab.h> #define __constant_htonl(x) ((__be32)___constant_swab32((x))) #define __constant_ntohl(x) ___constant_swab32((__be32)(x)) #define __constant_htons(x) ((__be16)___constant_swab16((x))) #define __constant_ntohs(x) ___constant_swab16((__be16)(x)) #define __constant_cpu_to_le64(x) ((__le64)(__u64)(x)) #define __constant_le64_to_cpu(x) ((__u64)(__le64)(x)) #define __constant_cpu_to_le32(x) ((__le32)(__u32)(x)) #define __constant_le32_to_cpu(x) ((__u32)(__le32)(x)) #define __constant_cpu_to_le16(x) ((__le16)(__u16)(x)) #define __constant_le16_to_cpu(x) ((__u16)(__le16)(x)) #define __constant_cpu_to_be64(x) ((__be64)___constant_swab64((x))) #define __constant_be64_to_cpu(x) ___constant_swab64((__u64)(__be64)(x)) #define __constant_cpu_to_be32(x) ((__be32)___constant_swab32((x))) #define __constant_be32_to_cpu(x) ___constant_swab32((__u32)(__be32)(x)) #define __constant_cpu_to_be16(x) ((__be16)___constant_swab16((x))) #define __constant_be16_to_cpu(x) ___constant_swab16((__u16)(__be16)(x)) #define __cpu_to_le64(x) ((__le64)(__u64)(x)) #define __le64_to_cpu(x) ((__u64)(__le64)(x)) #define __cpu_to_le32(x) ((__le32)(__u32)(x)) #define __le32_to_cpu(x) ((__u32)(__le32)(x)) #define __cpu_to_le16(x) ((__le16)(__u16)(x)) #define __le16_to_cpu(x) ((__u16)(__le16)(x)) #define __cpu_to_be64(x) ((__be64)__swab64((x))) #define __be64_to_cpu(x) __swab64((__u64)(__be64)(x)) #define __cpu_to_be32(x) ((__be32)__swab32((x))) #define __be32_to_cpu(x) __swab32((__u32)(__be32)(x)) #define __cpu_to_be16(x) ((__be16)__swab16((x))) #define __be16_to_cpu(x) __swab16((__u16)(__be16)(x)) static __always_inline __le64 __cpu_to_le64p(const __u64 *p) { return (__le64)*p; } static __always_inline __u64 __le64_to_cpup(const __le64 *p) { return (__u64)*p; } static __always_inline __le32 __cpu_to_le32p(const __u32 *p) { return (__le32)*p; } static __always_inline __u32 __le32_to_cpup(const __le32 *p) { return (__u32)*p; } static __always_inline __le16 __cpu_to_le16p(const __u16 *p) { return (__le16)*p; } static __always_inline __u16 __le16_to_cpup(const __le16 *p) { return (__u16)*p; } static __always_inline __be64 __cpu_to_be64p(const __u64 *p) { return (__be64)__swab64p(p); } static __always_inline __u64 __be64_to_cpup(const __be64 *p) { return __swab64p((__u64 *)p); } static __always_inline __be32 __cpu_to_be32p(const __u32 *p) { return (__be32)__swab32p(p); } static __always_inline __u32 __be32_to_cpup(const __be32 *p) { return __swab32p((__u32 *)p); } static __always_inline __be16 __cpu_to_be16p(const __u16 *p) { return (__be16)__swab16p(p); } static __always_inline __u16 __be16_to_cpup(const __be16 *p) { return __swab16p((__u16 *)p); } #define __cpu_to_le64s(x) do { (void)(x); } while (0) #define __le64_to_cpus(x) do { (void)(x); } while (0) #define __cpu_to_le32s(x) do { (void)(x); } while (0) #define __le32_to_cpus(x) do { (void)(x); } while (0) #define __cpu_to_le16s(x) do { (void)(x); } while (0) #define __le16_to_cpus(x) do { (void)(x); } while (0) #define __cpu_to_be64s(x) __swab64s((x)) #define __be64_to_cpus(x) __swab64s((x)) #define __cpu_to_be32s(x) __swab32s((x)) #define __be32_to_cpus(x) __swab32s((x)) #define __cpu_to_be16s(x) __swab16s((x)) #define __be16_to_cpus(x) __swab16s((x)) #endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/byteorder/big_endian.h������������������������������������������������������������������������0000644�����������������00000006726�14763166027�0012161 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_BYTEORDER_BIG_ENDIAN_H #define _LINUX_BYTEORDER_BIG_ENDIAN_H #ifndef __BIG_ENDIAN #define __BIG_ENDIAN 4321 #endif #ifndef __BIG_ENDIAN_BITFIELD #define __BIG_ENDIAN_BITFIELD #endif #include <linux/types.h> #include <linux/swab.h> #define __constant_htonl(x) ((__be32)(__u32)(x)) #define __constant_ntohl(x) ((__u32)(__be32)(x)) #define __constant_htons(x) ((__be16)(__u16)(x)) #define __constant_ntohs(x) ((__u16)(__be16)(x)) #define __constant_cpu_to_le64(x) ((__le64)___constant_swab64((x))) #define __constant_le64_to_cpu(x) ___constant_swab64((__u64)(__le64)(x)) #define __constant_cpu_to_le32(x) ((__le32)___constant_swab32((x))) #define __constant_le32_to_cpu(x) ___constant_swab32((__u32)(__le32)(x)) #define __constant_cpu_to_le16(x) ((__le16)___constant_swab16((x))) #define __constant_le16_to_cpu(x) ___constant_swab16((__u16)(__le16)(x)) #define __constant_cpu_to_be64(x) ((__be64)(__u64)(x)) #define __constant_be64_to_cpu(x) ((__u64)(__be64)(x)) #define __constant_cpu_to_be32(x) ((__be32)(__u32)(x)) #define __constant_be32_to_cpu(x) ((__u32)(__be32)(x)) #define __constant_cpu_to_be16(x) ((__be16)(__u16)(x)) #define __constant_be16_to_cpu(x) ((__u16)(__be16)(x)) #define __cpu_to_le64(x) ((__le64)__swab64((x))) #define __le64_to_cpu(x) __swab64((__u64)(__le64)(x)) #define __cpu_to_le32(x) ((__le32)__swab32((x))) #define __le32_to_cpu(x) __swab32((__u32)(__le32)(x)) #define __cpu_to_le16(x) ((__le16)__swab16((x))) #define __le16_to_cpu(x) __swab16((__u16)(__le16)(x)) #define __cpu_to_be64(x) ((__be64)(__u64)(x)) #define __be64_to_cpu(x) ((__u64)(__be64)(x)) #define __cpu_to_be32(x) ((__be32)(__u32)(x)) #define __be32_to_cpu(x) ((__u32)(__be32)(x)) #define __cpu_to_be16(x) ((__be16)(__u16)(x)) #define __be16_to_cpu(x) ((__u16)(__be16)(x)) static __always_inline __le64 __cpu_to_le64p(const __u64 *p) { return (__le64)__swab64p(p); } static __always_inline __u64 __le64_to_cpup(const __le64 *p) { return __swab64p((__u64 *)p); } static __always_inline __le32 __cpu_to_le32p(const __u32 *p) { return (__le32)__swab32p(p); } static __always_inline __u32 __le32_to_cpup(const __le32 *p) { return __swab32p((__u32 *)p); } static __always_inline __le16 __cpu_to_le16p(const __u16 *p) { return (__le16)__swab16p(p); } static __always_inline __u16 __le16_to_cpup(const __le16 *p) { return __swab16p((__u16 *)p); } static __always_inline __be64 __cpu_to_be64p(const __u64 *p) { return (__be64)*p; } static __always_inline __u64 __be64_to_cpup(const __be64 *p) { return (__u64)*p; } static __always_inline __be32 __cpu_to_be32p(const __u32 *p) { return (__be32)*p; } static __always_inline __u32 __be32_to_cpup(const __be32 *p) { return (__u32)*p; } static __always_inline __be16 __cpu_to_be16p(const __u16 *p) { return (__be16)*p; } static __always_inline __u16 __be16_to_cpup(const __be16 *p) { return (__u16)*p; } #define __cpu_to_le64s(x) __swab64s((x)) #define __le64_to_cpus(x) __swab64s((x)) #define __cpu_to_le32s(x) __swab32s((x)) #define __le32_to_cpus(x) __swab32s((x)) #define __cpu_to_le16s(x) __swab16s((x)) #define __le16_to_cpus(x) __swab16s((x)) #define __cpu_to_be64s(x) do { (void)(x); } while (0) #define __be64_to_cpus(x) do { (void)(x); } while (0) #define __cpu_to_be32s(x) do { (void)(x); } while (0) #define __be32_to_cpus(x) do { (void)(x); } while (0) #define __cpu_to_be16s(x) do { (void)(x); } while (0) #define __be16_to_cpus(x) do { (void)(x); } while (0) #endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */ ������������������������������������������linux/virtio_balloon.h������������������������������������������������������������������������������0000644�����������������00000011060�14763166027�0011110 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _LINUX_VIRTIO_BALLOON_H #define _LINUX_VIRTIO_BALLOON_H /* This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <linux/types.h> #include <linux/virtio_types.h> #include <linux/virtio_ids.h> #include <linux/virtio_config.h> /* The feature bitmap for virtio balloon */ #define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */ #define VIRTIO_BALLOON_F_STATS_VQ 1 /* Memory Stats virtqueue */ #define VIRTIO_BALLOON_F_DEFLATE_ON_OOM 2 /* Deflate balloon on OOM */ /* Size of a PFN in the balloon interface. */ #define VIRTIO_BALLOON_PFN_SHIFT 12 struct virtio_balloon_config { /* Number of pages host wants Guest to give up. */ __u32 num_pages; /* Number of pages we've actually got in balloon. */ __u32 actual; }; #define VIRTIO_BALLOON_S_SWAP_IN 0 /* Amount of memory swapped in */ #define VIRTIO_BALLOON_S_SWAP_OUT 1 /* Amount of memory swapped out */ #define VIRTIO_BALLOON_S_MAJFLT 2 /* Number of major faults */ #define VIRTIO_BALLOON_S_MINFLT 3 /* Number of minor faults */ #define VIRTIO_BALLOON_S_MEMFREE 4 /* Total amount of free memory */ #define VIRTIO_BALLOON_S_MEMTOT 5 /* Total amount of memory */ #define VIRTIO_BALLOON_S_AVAIL 6 /* Available memory as in /proc */ #define VIRTIO_BALLOON_S_CACHES 7 /* Disk caches */ #define VIRTIO_BALLOON_S_HTLB_PGALLOC 8 /* Hugetlb page allocations */ #define VIRTIO_BALLOON_S_HTLB_PGFAIL 9 /* Hugetlb page allocation failures */ #define VIRTIO_BALLOON_S_NR 10 #define VIRTIO_BALLOON_S_NAMES_WITH_PREFIX(VIRTIO_BALLOON_S_NAMES_prefix) { \ VIRTIO_BALLOON_S_NAMES_prefix "swap-in", \ VIRTIO_BALLOON_S_NAMES_prefix "swap-out", \ VIRTIO_BALLOON_S_NAMES_prefix "major-faults", \ VIRTIO_BALLOON_S_NAMES_prefix "minor-faults", \ VIRTIO_BALLOON_S_NAMES_prefix "free-memory", \ VIRTIO_BALLOON_S_NAMES_prefix "total-memory", \ VIRTIO_BALLOON_S_NAMES_prefix "available-memory", \ VIRTIO_BALLOON_S_NAMES_prefix "disk-caches", \ VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-allocations", \ VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-failures" \ } #define VIRTIO_BALLOON_S_NAMES VIRTIO_BALLOON_S_NAMES_WITH_PREFIX("") /* * Memory statistics structure. * Driver fills an array of these structures and passes to device. * * NOTE: fields are laid out in a way that would make compiler add padding * between and after fields, so we have to use compiler-specific attributes to * pack it, to disable this padding. This also often causes compiler to * generate suboptimal code. * * We maintain this statistics structure format for backwards compatibility, * but don't follow this example. * * If implementing a similar structure, do something like the below instead: * struct virtio_balloon_stat { * __virtio16 tag; * __u8 reserved[6]; * __virtio64 val; * }; * * In other words, add explicit reserved fields to align field and * structure boundaries at field size, avoiding compiler padding * without the packed attribute. */ struct virtio_balloon_stat { __virtio16 tag; __virtio64 val; } __attribute__((packed)); #endif /* _LINUX_VIRTIO_BALLOON_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/dlm_plock.h�����������������������������������������������������������������������������������0000644�����������������00000001576�14763166027�0010045 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. * * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions * of the GNU General Public License v.2. */ #ifndef __DLM_PLOCK_DOT_H__ #define __DLM_PLOCK_DOT_H__ #include <linux/types.h> #define DLM_PLOCK_MISC_NAME "dlm_plock" #define DLM_PLOCK_VERSION_MAJOR 1 #define DLM_PLOCK_VERSION_MINOR 2 #define DLM_PLOCK_VERSION_PATCH 0 enum { DLM_PLOCK_OP_LOCK = 1, DLM_PLOCK_OP_UNLOCK, DLM_PLOCK_OP_GET, }; #define DLM_PLOCK_FL_CLOSE 1 struct dlm_plock_info { __u32 version[3]; __u8 optype; __u8 ex; __u8 wait; __u8 flags; __u32 pid; __s32 nodeid; __s32 rv; __u32 fsid; __u64 number; __u64 start; __u64 end; __u64 owner; }; #endif /* __DLM_PLOCK_DOT_H__ */ ����������������������������������������������������������������������������������������������������������������������������������linux/fadvise.h�������������������������������������������������������������������������������������0000644�����������������00000001512�14763166027�0007510 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef FADVISE_H_INCLUDED #define FADVISE_H_INCLUDED #define POSIX_FADV_NORMAL 0 /* No further special treatment. */ #define POSIX_FADV_RANDOM 1 /* Expect random page references. */ #define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ #define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ /* * The advise values for POSIX_FADV_DONTNEED and POSIX_ADV_NOREUSE * for s390-64 differ from the values for the rest of the world. */ #if defined(__s390x__) #define POSIX_FADV_DONTNEED 6 /* Don't need these pages. */ #define POSIX_FADV_NOREUSE 7 /* Data will be accessed once. */ #else #define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ #define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif #endif /* FADVISE_H_INCLUDED */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/aio_abi.h�������������������������������������������������������������������������������������0000644�����������������00000006333�14763166027�0007460 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* include/linux/aio_abi.h * * Copyright 2000,2001,2002 Red Hat. * * Written by Benjamin LaHaise <bcrl@kvack.org> * * Distribute under the terms of the GPLv2 (see ../../COPYING) or under * the following terms. * * Permission to use, copy, modify, and distribute this software and its * documentation is hereby granted, provided that the above copyright * notice appears in all copies. This software is provided without any * warranty, express or implied. Red Hat makes no representations about * the suitability of this software for any purpose. * * IN NO EVENT SHALL RED HAT BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF * THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF RED HAT HAS BEEN ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * * RED HAT DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND * RED HAT HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, * ENHANCEMENTS, OR MODIFICATIONS. */ #ifndef __LINUX__AIO_ABI_H #define __LINUX__AIO_ABI_H #include <linux/types.h> #include <linux/fs.h> #include <asm/byteorder.h> typedef __kernel_ulong_t aio_context_t; enum { IOCB_CMD_PREAD = 0, IOCB_CMD_PWRITE = 1, IOCB_CMD_FSYNC = 2, IOCB_CMD_FDSYNC = 3, /* 4 was the experimental IOCB_CMD_PREADX */ IOCB_CMD_POLL = 5, IOCB_CMD_NOOP = 6, IOCB_CMD_PREADV = 7, IOCB_CMD_PWRITEV = 8, }; /* * Valid flags for the "aio_flags" member of the "struct iocb". * * IOCB_FLAG_RESFD - Set if the "aio_resfd" member of the "struct iocb" * is valid. */ #define IOCB_FLAG_RESFD (1 << 0) #define IOCB_FLAG_IOPRIO (1 << 1) /* read() from /dev/aio returns these structures. */ struct io_event { __u64 data; /* the data field from the iocb */ __u64 obj; /* what iocb this event came from */ __s64 res; /* result code for this event */ __s64 res2; /* secondary result */ }; /* * we always use a 64bit off_t when communicating * with userland. its up to libraries to do the * proper padding and aio_error abstraction */ struct iocb { /* these are internal to the kernel/libc. */ __u64 aio_data; /* data to be returned in event's data */ #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN) __u32 aio_key; /* the kernel sets aio_key to the req # */ __kernel_rwf_t aio_rw_flags; /* RWF_* flags */ #elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN) __kernel_rwf_t aio_rw_flags; /* RWF_* flags */ __u32 aio_key; /* the kernel sets aio_key to the req # */ #else #error edit for your odd byteorder. #endif /* common fields */ __u16 aio_lio_opcode; /* see IOCB_CMD_ above */ __s16 aio_reqprio; __u32 aio_fildes; __u64 aio_buf; __u64 aio_nbytes; __s64 aio_offset; /* extra parameters */ __u64 aio_reserved2; /* TODO: use this for a (struct sigevent *) */ /* flags for the "struct iocb" */ __u32 aio_flags; /* * if the IOCB_FLAG_RESFD flag of "aio_flags" is set, this is an * eventfd to signal AIO readiness to */ __u32 aio_resfd; }; /* 64 bytes */ #undef IFBIG #undef IFLITTLE #endif /* __LINUX__AIO_ABI_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/virtio_console.h������������������������������������������������������������������������������0000644�����������������00000006100�14763166027�0011123 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so * anyone can use the definitions to implement compatible drivers/servers: * * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Copyright (C) Red Hat, Inc., 2009, 2010, 2011 * Copyright (C) Amit Shah <amit.shah@redhat.com>, 2009, 2010, 2011 */ #ifndef _LINUX_VIRTIO_CONSOLE_H #define _LINUX_VIRTIO_CONSOLE_H #include <linux/types.h> #include <linux/virtio_types.h> #include <linux/virtio_ids.h> #include <linux/virtio_config.h> /* Feature bits */ #define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */ #define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */ #define VIRTIO_CONSOLE_F_EMERG_WRITE 2 /* Does host support emergency write? */ #define VIRTIO_CONSOLE_BAD_ID (~(__u32)0) struct virtio_console_config { /* colums of the screens */ __u16 cols; /* rows of the screens */ __u16 rows; /* max. number of ports this device can hold */ __u32 max_nr_ports; /* emergency write register */ __u32 emerg_wr; } __attribute__((packed)); /* * A message that's passed between the Host and the Guest for a * particular port. */ struct virtio_console_control { __virtio32 id; /* Port number */ __virtio16 event; /* The kind of control event (see below) */ __virtio16 value; /* Extra information for the key */ }; /* Some events for control messages */ #define VIRTIO_CONSOLE_DEVICE_READY 0 #define VIRTIO_CONSOLE_PORT_ADD 1 #define VIRTIO_CONSOLE_PORT_REMOVE 2 #define VIRTIO_CONSOLE_PORT_READY 3 #define VIRTIO_CONSOLE_CONSOLE_PORT 4 #define VIRTIO_CONSOLE_RESIZE 5 #define VIRTIO_CONSOLE_PORT_OPEN 6 #define VIRTIO_CONSOLE_PORT_NAME 7 #endif /* _LINUX_VIRTIO_CONSOLE_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/perf_event.h����������������������������������������������������������������������������������0000644�����������������00000100306�14763166027�0010225 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Performance events: * * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de> * Copyright (C) 2008-2011, Red Hat, Inc., Ingo Molnar * Copyright (C) 2008-2011, Red Hat, Inc., Peter Zijlstra * * Data type definitions, declarations, prototypes. * * Started by: Thomas Gleixner and Ingo Molnar * * For licencing details see kernel-base/COPYING */ #ifndef _LINUX_PERF_EVENT_H #define _LINUX_PERF_EVENT_H #include <linux/types.h> #include <linux/ioctl.h> #include <asm/byteorder.h> /* * User-space ABI bits: */ /* * attr.type */ enum perf_type_id { PERF_TYPE_HARDWARE = 0, PERF_TYPE_SOFTWARE = 1, PERF_TYPE_TRACEPOINT = 2, PERF_TYPE_HW_CACHE = 3, PERF_TYPE_RAW = 4, PERF_TYPE_BREAKPOINT = 5, PERF_TYPE_MAX, /* non-ABI */ }; /* * Generalized performance event event_id types, used by the * attr.event_id parameter of the sys_perf_event_open() * syscall: */ enum perf_hw_id { /* * Common hardware events, generalized by the kernel: */ PERF_COUNT_HW_CPU_CYCLES = 0, PERF_COUNT_HW_INSTRUCTIONS = 1, PERF_COUNT_HW_CACHE_REFERENCES = 2, PERF_COUNT_HW_CACHE_MISSES = 3, PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4, PERF_COUNT_HW_BRANCH_MISSES = 5, PERF_COUNT_HW_BUS_CYCLES = 6, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7, PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8, PERF_COUNT_HW_REF_CPU_CYCLES = 9, PERF_COUNT_HW_MAX, /* non-ABI */ }; /* * Generalized hardware cache events: * * { L1-D, L1-I, LLC, ITLB, DTLB, BPU, NODE } x * { read, write, prefetch } x * { accesses, misses } */ enum perf_hw_cache_id { PERF_COUNT_HW_CACHE_L1D = 0, PERF_COUNT_HW_CACHE_L1I = 1, PERF_COUNT_HW_CACHE_LL = 2, PERF_COUNT_HW_CACHE_DTLB = 3, PERF_COUNT_HW_CACHE_ITLB = 4, PERF_COUNT_HW_CACHE_BPU = 5, PERF_COUNT_HW_CACHE_NODE = 6, PERF_COUNT_HW_CACHE_MAX, /* non-ABI */ }; enum perf_hw_cache_op_id { PERF_COUNT_HW_CACHE_OP_READ = 0, PERF_COUNT_HW_CACHE_OP_WRITE = 1, PERF_COUNT_HW_CACHE_OP_PREFETCH = 2, PERF_COUNT_HW_CACHE_OP_MAX, /* non-ABI */ }; enum perf_hw_cache_op_result_id { PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0, PERF_COUNT_HW_CACHE_RESULT_MISS = 1, PERF_COUNT_HW_CACHE_RESULT_MAX, /* non-ABI */ }; /* * Special "software" events provided by the kernel, even if the hardware * does not support performance events. These events measure various * physical and sw events of the kernel (and allow the profiling of them as * well): */ enum perf_sw_ids { PERF_COUNT_SW_CPU_CLOCK = 0, PERF_COUNT_SW_TASK_CLOCK = 1, PERF_COUNT_SW_PAGE_FAULTS = 2, PERF_COUNT_SW_CONTEXT_SWITCHES = 3, PERF_COUNT_SW_CPU_MIGRATIONS = 4, PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, PERF_COUNT_SW_ALIGNMENT_FAULTS = 7, PERF_COUNT_SW_EMULATION_FAULTS = 8, PERF_COUNT_SW_DUMMY = 9, PERF_COUNT_SW_BPF_OUTPUT = 10, PERF_COUNT_SW_MAX, /* non-ABI */ }; /* * Bits that can be set in attr.sample_type to request information * in the overflow packets. */ enum perf_event_sample_format { PERF_SAMPLE_IP = 1U << 0, PERF_SAMPLE_TID = 1U << 1, PERF_SAMPLE_TIME = 1U << 2, PERF_SAMPLE_ADDR = 1U << 3, PERF_SAMPLE_READ = 1U << 4, PERF_SAMPLE_CALLCHAIN = 1U << 5, PERF_SAMPLE_ID = 1U << 6, PERF_SAMPLE_CPU = 1U << 7, PERF_SAMPLE_PERIOD = 1U << 8, PERF_SAMPLE_STREAM_ID = 1U << 9, PERF_SAMPLE_RAW = 1U << 10, PERF_SAMPLE_BRANCH_STACK = 1U << 11, PERF_SAMPLE_REGS_USER = 1U << 12, PERF_SAMPLE_STACK_USER = 1U << 13, PERF_SAMPLE_WEIGHT = 1U << 14, PERF_SAMPLE_DATA_SRC = 1U << 15, PERF_SAMPLE_IDENTIFIER = 1U << 16, PERF_SAMPLE_TRANSACTION = 1U << 17, PERF_SAMPLE_REGS_INTR = 1U << 18, PERF_SAMPLE_PHYS_ADDR = 1U << 19, PERF_SAMPLE_MAX = 1U << 20, /* non-ABI */ __PERF_SAMPLE_CALLCHAIN_EARLY = 1ULL << 63, /* non-ABI; internal use */ }; /* * values to program into branch_sample_type when PERF_SAMPLE_BRANCH is set * * If the user does not pass priv level information via branch_sample_type, * the kernel uses the event's priv level. Branch and event priv levels do * not have to match. Branch priv level is checked for permissions. * * The branch types can be combined, however BRANCH_ANY covers all types * of branches and therefore it supersedes all the other types. */ enum perf_branch_sample_type_shift { PERF_SAMPLE_BRANCH_USER_SHIFT = 0, /* user branches */ PERF_SAMPLE_BRANCH_KERNEL_SHIFT = 1, /* kernel branches */ PERF_SAMPLE_BRANCH_HV_SHIFT = 2, /* hypervisor branches */ PERF_SAMPLE_BRANCH_ANY_SHIFT = 3, /* any branch types */ PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT = 4, /* any call branch */ PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT = 5, /* any return branch */ PERF_SAMPLE_BRANCH_IND_CALL_SHIFT = 6, /* indirect calls */ PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT = 7, /* transaction aborts */ PERF_SAMPLE_BRANCH_IN_TX_SHIFT = 8, /* in transaction */ PERF_SAMPLE_BRANCH_NO_TX_SHIFT = 9, /* not in transaction */ PERF_SAMPLE_BRANCH_COND_SHIFT = 10, /* conditional branches */ PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT = 11, /* call/ret stack */ PERF_SAMPLE_BRANCH_IND_JUMP_SHIFT = 12, /* indirect jumps */ PERF_SAMPLE_BRANCH_CALL_SHIFT = 13, /* direct call */ PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT = 14, /* no flags */ PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT = 15, /* no cycles */ PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT = 16, /* save branch type */ PERF_SAMPLE_BRANCH_MAX_SHIFT /* non-ABI */ }; enum perf_branch_sample_type { PERF_SAMPLE_BRANCH_USER = 1U << PERF_SAMPLE_BRANCH_USER_SHIFT, PERF_SAMPLE_BRANCH_KERNEL = 1U << PERF_SAMPLE_BRANCH_KERNEL_SHIFT, PERF_SAMPLE_BRANCH_HV = 1U << PERF_SAMPLE_BRANCH_HV_SHIFT, PERF_SAMPLE_BRANCH_ANY = 1U << PERF_SAMPLE_BRANCH_ANY_SHIFT, PERF_SAMPLE_BRANCH_ANY_CALL = 1U << PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT, PERF_SAMPLE_BRANCH_ANY_RETURN = 1U << PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT, PERF_SAMPLE_BRANCH_IND_CALL = 1U << PERF_SAMPLE_BRANCH_IND_CALL_SHIFT, PERF_SAMPLE_BRANCH_ABORT_TX = 1U << PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT, PERF_SAMPLE_BRANCH_IN_TX = 1U << PERF_SAMPLE_BRANCH_IN_TX_SHIFT, PERF_SAMPLE_BRANCH_NO_TX = 1U << PERF_SAMPLE_BRANCH_NO_TX_SHIFT, PERF_SAMPLE_BRANCH_COND = 1U << PERF_SAMPLE_BRANCH_COND_SHIFT, PERF_SAMPLE_BRANCH_CALL_STACK = 1U << PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT, PERF_SAMPLE_BRANCH_IND_JUMP = 1U << PERF_SAMPLE_BRANCH_IND_JUMP_SHIFT, PERF_SAMPLE_BRANCH_CALL = 1U << PERF_SAMPLE_BRANCH_CALL_SHIFT, PERF_SAMPLE_BRANCH_NO_FLAGS = 1U << PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT, PERF_SAMPLE_BRANCH_NO_CYCLES = 1U << PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT, PERF_SAMPLE_BRANCH_TYPE_SAVE = 1U << PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT, PERF_SAMPLE_BRANCH_MAX = 1U << PERF_SAMPLE_BRANCH_MAX_SHIFT, }; /* * Common flow change classification */ enum { PERF_BR_UNKNOWN = 0, /* unknown */ PERF_BR_COND = 1, /* conditional */ PERF_BR_UNCOND = 2, /* unconditional */ PERF_BR_IND = 3, /* indirect */ PERF_BR_CALL = 4, /* function call */ PERF_BR_IND_CALL = 5, /* indirect function call */ PERF_BR_RET = 6, /* function return */ PERF_BR_SYSCALL = 7, /* syscall */ PERF_BR_SYSRET = 8, /* syscall return */ PERF_BR_COND_CALL = 9, /* conditional function call */ PERF_BR_COND_RET = 10, /* conditional function return */ PERF_BR_MAX, }; #define PERF_SAMPLE_BRANCH_PLM_ALL \ (PERF_SAMPLE_BRANCH_USER|\ PERF_SAMPLE_BRANCH_KERNEL|\ PERF_SAMPLE_BRANCH_HV) /* * Values to determine ABI of the registers dump. */ enum perf_sample_regs_abi { PERF_SAMPLE_REGS_ABI_NONE = 0, PERF_SAMPLE_REGS_ABI_32 = 1, PERF_SAMPLE_REGS_ABI_64 = 2, }; /* * Values for the memory transaction event qualifier, mostly for * abort events. Multiple bits can be set. */ enum { PERF_TXN_ELISION = (1 << 0), /* From elision */ PERF_TXN_TRANSACTION = (1 << 1), /* From transaction */ PERF_TXN_SYNC = (1 << 2), /* Instruction is related */ PERF_TXN_ASYNC = (1 << 3), /* Instruction not related */ PERF_TXN_RETRY = (1 << 4), /* Retry possible */ PERF_TXN_CONFLICT = (1 << 5), /* Conflict abort */ PERF_TXN_CAPACITY_WRITE = (1 << 6), /* Capacity write abort */ PERF_TXN_CAPACITY_READ = (1 << 7), /* Capacity read abort */ PERF_TXN_MAX = (1 << 8), /* non-ABI */ /* bits 32..63 are reserved for the abort code */ PERF_TXN_ABORT_MASK = (0xffffffffULL << 32), PERF_TXN_ABORT_SHIFT = 32, }; /* * The format of the data returned by read() on a perf event fd, * as specified by attr.read_format: * * struct read_format { * { u64 value; * { u64 time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED * { u64 time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING * { u64 id; } && PERF_FORMAT_ID * } && !PERF_FORMAT_GROUP * * { u64 nr; * { u64 time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED * { u64 time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING * { u64 value; * { u64 id; } && PERF_FORMAT_ID * } cntr[nr]; * } && PERF_FORMAT_GROUP * }; */ enum perf_event_read_format { PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0, PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1, PERF_FORMAT_ID = 1U << 2, PERF_FORMAT_GROUP = 1U << 3, PERF_FORMAT_MAX = 1U << 4, /* non-ABI */ }; #define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ #define PERF_ATTR_SIZE_VER1 72 /* add: config2 */ #define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */ #define PERF_ATTR_SIZE_VER3 96 /* add: sample_regs_user */ /* add: sample_stack_user */ #define PERF_ATTR_SIZE_VER4 104 /* add: sample_regs_intr */ #define PERF_ATTR_SIZE_VER5 112 /* add: aux_watermark */ /* * Hardware event_id to monitor via a performance monitoring event: * * @sample_max_stack: Max number of frame pointers in a callchain, * should be < /proc/sys/kernel/perf_event_max_stack */ struct perf_event_attr { /* * Major type: hardware/software/tracepoint/etc. */ __u32 type; /* * Size of the attr structure, for fwd/bwd compat. */ __u32 size; /* * Type specific configuration information. */ __u64 config; union { __u64 sample_period; __u64 sample_freq; }; __u64 sample_type; __u64 read_format; __u64 disabled : 1, /* off by default */ inherit : 1, /* children inherit it */ pinned : 1, /* must always be on PMU */ exclusive : 1, /* only group on PMU */ exclude_user : 1, /* don't count user */ exclude_kernel : 1, /* ditto kernel */ exclude_hv : 1, /* ditto hypervisor */ exclude_idle : 1, /* don't count when idle */ mmap : 1, /* include mmap data */ comm : 1, /* include comm data */ freq : 1, /* use freq, not period */ inherit_stat : 1, /* per task counts */ enable_on_exec : 1, /* next exec enables */ task : 1, /* trace fork/exit */ watermark : 1, /* wakeup_watermark */ /* * precise_ip: * * 0 - SAMPLE_IP can have arbitrary skid * 1 - SAMPLE_IP must have constant skid * 2 - SAMPLE_IP requested to have 0 skid * 3 - SAMPLE_IP must have 0 skid * * See also PERF_RECORD_MISC_EXACT_IP */ precise_ip : 2, /* skid constraint */ mmap_data : 1, /* non-exec mmap data */ sample_id_all : 1, /* sample_type all events */ exclude_host : 1, /* don't count in host */ exclude_guest : 1, /* don't count in guest */ exclude_callchain_kernel : 1, /* exclude kernel callchains */ exclude_callchain_user : 1, /* exclude user callchains */ mmap2 : 1, /* include mmap with inode data */ comm_exec : 1, /* flag comm events that are due to an exec */ use_clockid : 1, /* use @clockid for time fields */ context_switch : 1, /* context switch data */ write_backward : 1, /* Write ring buffer from end to beginning */ namespaces : 1, /* include namespaces data */ __reserved_1 : 35; union { __u32 wakeup_events; /* wakeup every n events */ __u32 wakeup_watermark; /* bytes before wakeup */ }; __u32 bp_type; union { __u64 bp_addr; __u64 kprobe_func; /* for perf_kprobe */ __u64 uprobe_path; /* for perf_uprobe */ __u64 config1; /* extension of config */ }; union { __u64 bp_len; __u64 kprobe_addr; /* when kprobe_func == NULL */ __u64 probe_offset; /* for perf_[k,u]probe */ __u64 config2; /* extension of config1 */ }; __u64 branch_sample_type; /* enum perf_branch_sample_type */ /* * Defines set of user regs to dump on samples. * See asm/perf_regs.h for details. */ __u64 sample_regs_user; /* * Defines size of the user stack to dump on samples. */ __u32 sample_stack_user; __s32 clockid; /* * Defines set of regs to dump for each sample * state captured on: * - precise = 0: PMU interrupt * - precise > 0: sampled instruction * * See asm/perf_regs.h for details. */ __u64 sample_regs_intr; /* * Wakeup watermark for AUX area */ __u32 aux_watermark; __u16 sample_max_stack; __u16 __reserved_2; /* align to __u64 */ }; /* * Structure used by below PERF_EVENT_IOC_QUERY_BPF command * to query bpf programs attached to the same perf tracepoint * as the given perf event. */ struct perf_event_query_bpf { /* * The below ids array length */ __u32 ids_len; /* * Set by the kernel to indicate the number of * available programs */ __u32 prog_cnt; /* * User provided buffer to store program ids */ __u32 ids[0]; }; #define perf_flags(attr) (*(&(attr)->read_format + 1)) /* * Ioctls that can be done on a perf event fd: */ #define PERF_EVENT_IOC_ENABLE _IO ('$', 0) #define PERF_EVENT_IOC_DISABLE _IO ('$', 1) #define PERF_EVENT_IOC_REFRESH _IO ('$', 2) #define PERF_EVENT_IOC_RESET _IO ('$', 3) #define PERF_EVENT_IOC_PERIOD _IOW('$', 4, __u64) #define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) #define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *) #define PERF_EVENT_IOC_ID _IOR('$', 7, __u64 *) #define PERF_EVENT_IOC_SET_BPF _IOW('$', 8, __u32) #define PERF_EVENT_IOC_PAUSE_OUTPUT _IOW('$', 9, __u32) #define PERF_EVENT_IOC_QUERY_BPF _IOWR('$', 10, struct perf_event_query_bpf *) #define PERF_EVENT_IOC_MODIFY_ATTRIBUTES _IOW('$', 11, struct perf_event_attr *) enum perf_event_ioc_flags { PERF_IOC_FLAG_GROUP = 1U << 0, }; /* * Structure of the page that can be mapped via mmap */ struct perf_event_mmap_page { __u32 version; /* version number of this structure */ __u32 compat_version; /* lowest version this is compat with */ /* * Bits needed to read the hw events in user-space. * * u32 seq, time_mult, time_shift, index, width; * u64 count, enabled, running; * u64 cyc, time_offset; * s64 pmc = 0; * * do { * seq = pc->lock; * barrier() * * enabled = pc->time_enabled; * running = pc->time_running; * * if (pc->cap_usr_time && enabled != running) { * cyc = rdtsc(); * time_offset = pc->time_offset; * time_mult = pc->time_mult; * time_shift = pc->time_shift; * } * * index = pc->index; * count = pc->offset; * if (pc->cap_user_rdpmc && index) { * width = pc->pmc_width; * pmc = rdpmc(index - 1); * } * * barrier(); * } while (pc->lock != seq); * * NOTE: for obvious reason this only works on self-monitoring * processes. */ __u32 lock; /* seqlock for synchronization */ __u32 index; /* hardware event identifier */ __s64 offset; /* add to hardware event value */ __u64 time_enabled; /* time event active */ __u64 time_running; /* time event on cpu */ union { __u64 capabilities; struct { __u64 cap_bit0 : 1, /* Always 0, deprecated, see commit 860f085b74e9 */ cap_bit0_is_deprecated : 1, /* Always 1, signals that bit 0 is zero */ cap_user_rdpmc : 1, /* The RDPMC instruction can be used to read counts */ cap_user_time : 1, /* The time_* fields are used */ cap_user_time_zero : 1, /* The time_zero field is used */ cap_____res : 59; }; }; /* * If cap_user_rdpmc this field provides the bit-width of the value * read using the rdpmc() or equivalent instruction. This can be used * to sign extend the result like: * * pmc <<= 64 - width; * pmc >>= 64 - width; // signed shift right * count += pmc; */ __u16 pmc_width; /* * If cap_usr_time the below fields can be used to compute the time * delta since time_enabled (in ns) using rdtsc or similar. * * u64 quot, rem; * u64 delta; * * quot = (cyc >> time_shift); * rem = cyc & (((u64)1 << time_shift) - 1); * delta = time_offset + quot * time_mult + * ((rem * time_mult) >> time_shift); * * Where time_offset,time_mult,time_shift and cyc are read in the * seqcount loop described above. This delta can then be added to * enabled and possible running (if index), improving the scaling: * * enabled += delta; * if (index) * running += delta; * * quot = count / running; * rem = count % running; * count = quot * enabled + (rem * enabled) / running; */ __u16 time_shift; __u32 time_mult; __u64 time_offset; /* * If cap_usr_time_zero, the hardware clock (e.g. TSC) can be calculated * from sample timestamps. * * time = timestamp - time_zero; * quot = time / time_mult; * rem = time % time_mult; * cyc = (quot << time_shift) + (rem << time_shift) / time_mult; * * And vice versa: * * quot = cyc >> time_shift; * rem = cyc & (((u64)1 << time_shift) - 1); * timestamp = time_zero + quot * time_mult + * ((rem * time_mult) >> time_shift); */ __u64 time_zero; __u32 size; /* Header size up to __reserved[] fields. */ /* * Hole for extension of the self monitor capabilities */ __u8 __reserved[118*8+4]; /* align to 1k. */ /* * Control data for the mmap() data buffer. * * User-space reading the @data_head value should issue an smp_rmb(), * after reading this value. * * When the mapping is PROT_WRITE the @data_tail value should be * written by userspace to reflect the last read data, after issueing * an smp_mb() to separate the data read from the ->data_tail store. * In this case the kernel will not over-write unread data. * * See perf_output_put_handle() for the data ordering. * * data_{offset,size} indicate the location and size of the perf record * buffer within the mmapped area. */ __u64 data_head; /* head in the data section */ __u64 data_tail; /* user-space written tail */ __u64 data_offset; /* where the buffer starts */ __u64 data_size; /* data buffer size */ /* * AUX area is defined by aux_{offset,size} fields that should be set * by the userspace, so that * * aux_offset >= data_offset + data_size * * prior to mmap()ing it. Size of the mmap()ed area should be aux_size. * * Ring buffer pointers aux_{head,tail} have the same semantics as * data_{head,tail} and same ordering rules apply. */ __u64 aux_head; __u64 aux_tail; __u64 aux_offset; __u64 aux_size; }; #define PERF_RECORD_MISC_CPUMODE_MASK (7 << 0) #define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0) #define PERF_RECORD_MISC_KERNEL (1 << 0) #define PERF_RECORD_MISC_USER (2 << 0) #define PERF_RECORD_MISC_HYPERVISOR (3 << 0) #define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0) #define PERF_RECORD_MISC_GUEST_USER (5 << 0) /* * Indicates that /proc/PID/maps parsing are truncated by time out. */ #define PERF_RECORD_MISC_PROC_MAP_PARSE_TIMEOUT (1 << 12) /* * Following PERF_RECORD_MISC_* are used on different * events, so can reuse the same bit position: * * PERF_RECORD_MISC_MMAP_DATA - PERF_RECORD_MMAP* events * PERF_RECORD_MISC_COMM_EXEC - PERF_RECORD_COMM event * PERF_RECORD_MISC_SWITCH_OUT - PERF_RECORD_SWITCH* events */ #define PERF_RECORD_MISC_MMAP_DATA (1 << 13) #define PERF_RECORD_MISC_COMM_EXEC (1 << 13) #define PERF_RECORD_MISC_SWITCH_OUT (1 << 13) /* * These PERF_RECORD_MISC_* flags below are safely reused * for the following events: * * PERF_RECORD_MISC_EXACT_IP - PERF_RECORD_SAMPLE of precise events * PERF_RECORD_MISC_SWITCH_OUT_PREEMPT - PERF_RECORD_SWITCH* events * * * PERF_RECORD_MISC_EXACT_IP: * Indicates that the content of PERF_SAMPLE_IP points to * the actual instruction that triggered the event. See also * perf_event_attr::precise_ip. * * PERF_RECORD_MISC_SWITCH_OUT_PREEMPT: * Indicates that thread was preempted in TASK_RUNNING state. */ #define PERF_RECORD_MISC_EXACT_IP (1 << 14) #define PERF_RECORD_MISC_SWITCH_OUT_PREEMPT (1 << 14) /* * Reserve the last bit to indicate some extended misc field */ #define PERF_RECORD_MISC_EXT_RESERVED (1 << 15) struct perf_event_header { __u32 type; __u16 misc; __u16 size; }; struct perf_ns_link_info { __u64 dev; __u64 ino; }; enum { NET_NS_INDEX = 0, UTS_NS_INDEX = 1, IPC_NS_INDEX = 2, PID_NS_INDEX = 3, USER_NS_INDEX = 4, MNT_NS_INDEX = 5, CGROUP_NS_INDEX = 6, NR_NAMESPACES, /* number of available namespaces */ }; enum perf_event_type { /* * If perf_event_attr.sample_id_all is set then all event types will * have the sample_type selected fields related to where/when * (identity) an event took place (TID, TIME, ID, STREAM_ID, CPU, * IDENTIFIER) described in PERF_RECORD_SAMPLE below, it will be stashed * just after the perf_event_header and the fields already present for * the existing fields, i.e. at the end of the payload. That way a newer * perf.data file will be supported by older perf tools, with these new * optional fields being ignored. * * struct sample_id { * { u32 pid, tid; } && PERF_SAMPLE_TID * { u64 time; } && PERF_SAMPLE_TIME * { u64 id; } && PERF_SAMPLE_ID * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID * { u32 cpu, res; } && PERF_SAMPLE_CPU * { u64 id; } && PERF_SAMPLE_IDENTIFIER * } && perf_event_attr::sample_id_all * * Note that PERF_SAMPLE_IDENTIFIER duplicates PERF_SAMPLE_ID. The * advantage of PERF_SAMPLE_IDENTIFIER is that its position is fixed * relative to header.size. */ /* * The MMAP events record the PROT_EXEC mappings so that we can * correlate userspace IPs to code. They have the following structure: * * struct { * struct perf_event_header header; * * u32 pid, tid; * u64 addr; * u64 len; * u64 pgoff; * char filename[]; * struct sample_id sample_id; * }; */ PERF_RECORD_MMAP = 1, /* * struct { * struct perf_event_header header; * u64 id; * u64 lost; * struct sample_id sample_id; * }; */ PERF_RECORD_LOST = 2, /* * struct { * struct perf_event_header header; * * u32 pid, tid; * char comm[]; * struct sample_id sample_id; * }; */ PERF_RECORD_COMM = 3, /* * struct { * struct perf_event_header header; * u32 pid, ppid; * u32 tid, ptid; * u64 time; * struct sample_id sample_id; * }; */ PERF_RECORD_EXIT = 4, /* * struct { * struct perf_event_header header; * u64 time; * u64 id; * u64 stream_id; * struct sample_id sample_id; * }; */ PERF_RECORD_THROTTLE = 5, PERF_RECORD_UNTHROTTLE = 6, /* * struct { * struct perf_event_header header; * u32 pid, ppid; * u32 tid, ptid; * u64 time; * struct sample_id sample_id; * }; */ PERF_RECORD_FORK = 7, /* * struct { * struct perf_event_header header; * u32 pid, tid; * * struct read_format values; * struct sample_id sample_id; * }; */ PERF_RECORD_READ = 8, /* * struct { * struct perf_event_header header; * * # * # Note that PERF_SAMPLE_IDENTIFIER duplicates PERF_SAMPLE_ID. * # The advantage of PERF_SAMPLE_IDENTIFIER is that its position * # is fixed relative to header. * # * * { u64 id; } && PERF_SAMPLE_IDENTIFIER * { u64 ip; } && PERF_SAMPLE_IP * { u32 pid, tid; } && PERF_SAMPLE_TID * { u64 time; } && PERF_SAMPLE_TIME * { u64 addr; } && PERF_SAMPLE_ADDR * { u64 id; } && PERF_SAMPLE_ID * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID * { u32 cpu, res; } && PERF_SAMPLE_CPU * { u64 period; } && PERF_SAMPLE_PERIOD * * { struct read_format values; } && PERF_SAMPLE_READ * * { u64 nr, * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN * * # * # The RAW record below is opaque data wrt the ABI * # * # That is, the ABI doesn't make any promises wrt to * # the stability of its content, it may vary depending * # on event, hardware, kernel version and phase of * # the moon. * # * # In other words, PERF_SAMPLE_RAW contents are not an ABI. * # * * { u32 size; * char data[size];}&& PERF_SAMPLE_RAW * * { u64 nr; * { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK * * { u64 abi; # enum perf_sample_regs_abi * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER * * { u64 size; * char data[size]; * u64 dyn_size; } && PERF_SAMPLE_STACK_USER * * { u64 weight; } && PERF_SAMPLE_WEIGHT * { u64 data_src; } && PERF_SAMPLE_DATA_SRC * { u64 transaction; } && PERF_SAMPLE_TRANSACTION * { u64 abi; # enum perf_sample_regs_abi * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_INTR * { u64 phys_addr;} && PERF_SAMPLE_PHYS_ADDR * }; */ PERF_RECORD_SAMPLE = 9, /* * The MMAP2 records are an augmented version of MMAP, they add * maj, min, ino numbers to be used to uniquely identify each mapping * * struct { * struct perf_event_header header; * * u32 pid, tid; * u64 addr; * u64 len; * u64 pgoff; * u32 maj; * u32 min; * u64 ino; * u64 ino_generation; * u32 prot, flags; * char filename[]; * struct sample_id sample_id; * }; */ PERF_RECORD_MMAP2 = 10, /* * Records that new data landed in the AUX buffer part. * * struct { * struct perf_event_header header; * * u64 aux_offset; * u64 aux_size; * u64 flags; * struct sample_id sample_id; * }; */ PERF_RECORD_AUX = 11, /* * Indicates that instruction trace has started * * struct { * struct perf_event_header header; * u32 pid; * u32 tid; * struct sample_id sample_id; * }; */ PERF_RECORD_ITRACE_START = 12, /* * Records the dropped/lost sample number. * * struct { * struct perf_event_header header; * * u64 lost; * struct sample_id sample_id; * }; */ PERF_RECORD_LOST_SAMPLES = 13, /* * Records a context switch in or out (flagged by * PERF_RECORD_MISC_SWITCH_OUT). See also * PERF_RECORD_SWITCH_CPU_WIDE. * * struct { * struct perf_event_header header; * struct sample_id sample_id; * }; */ PERF_RECORD_SWITCH = 14, /* * CPU-wide version of PERF_RECORD_SWITCH with next_prev_pid and * next_prev_tid that are the next (switching out) or previous * (switching in) pid/tid. * * struct { * struct perf_event_header header; * u32 next_prev_pid; * u32 next_prev_tid; * struct sample_id sample_id; * }; */ PERF_RECORD_SWITCH_CPU_WIDE = 15, /* * struct { * struct perf_event_header header; * u32 pid; * u32 tid; * u64 nr_namespaces; * { u64 dev, inode; } [nr_namespaces]; * struct sample_id sample_id; * }; */ PERF_RECORD_NAMESPACES = 16, PERF_RECORD_MAX, /* non-ABI */ }; #define PERF_MAX_STACK_DEPTH 127 #define PERF_MAX_CONTEXTS_PER_STACK 8 enum perf_callchain_context { PERF_CONTEXT_HV = (__u64)-32, PERF_CONTEXT_KERNEL = (__u64)-128, PERF_CONTEXT_USER = (__u64)-512, PERF_CONTEXT_GUEST = (__u64)-2048, PERF_CONTEXT_GUEST_KERNEL = (__u64)-2176, PERF_CONTEXT_GUEST_USER = (__u64)-2560, PERF_CONTEXT_MAX = (__u64)-4095, }; /** * PERF_RECORD_AUX::flags bits */ #define PERF_AUX_FLAG_TRUNCATED 0x01 /* record was truncated to fit */ #define PERF_AUX_FLAG_OVERWRITE 0x02 /* snapshot from overwrite mode */ #define PERF_AUX_FLAG_PARTIAL 0x04 /* record contains gaps */ #define PERF_AUX_FLAG_COLLISION 0x08 /* sample collided with another */ #define PERF_FLAG_FD_NO_GROUP (1UL << 0) #define PERF_FLAG_FD_OUTPUT (1UL << 1) #define PERF_FLAG_PID_CGROUP (1UL << 2) /* pid=cgroup id, per-cpu mode only */ #define PERF_FLAG_FD_CLOEXEC (1UL << 3) /* O_CLOEXEC */ #if defined(__LITTLE_ENDIAN_BITFIELD) union perf_mem_data_src { __u64 val; struct { __u64 mem_op:5, /* type of opcode */ mem_lvl:14, /* memory hierarchy level */ mem_snoop:5, /* snoop mode */ mem_lock:2, /* lock instr */ mem_dtlb:7, /* tlb access */ mem_lvl_num:4, /* memory hierarchy level number */ mem_remote:1, /* remote */ mem_snoopx:2, /* snoop mode, ext */ mem_rsvd:24; }; }; #elif defined(__BIG_ENDIAN_BITFIELD) union perf_mem_data_src { __u64 val; struct { __u64 mem_rsvd:24, mem_snoopx:2, /* snoop mode, ext */ mem_remote:1, /* remote */ mem_lvl_num:4, /* memory hierarchy level number */ mem_dtlb:7, /* tlb access */ mem_lock:2, /* lock instr */ mem_snoop:5, /* snoop mode */ mem_lvl:14, /* memory hierarchy level */ mem_op:5; /* type of opcode */ }; }; #else #error "Unknown endianness" #endif /* type of opcode (load/store/prefetch,code) */ #define PERF_MEM_OP_NA 0x01 /* not available */ #define PERF_MEM_OP_LOAD 0x02 /* load instruction */ #define PERF_MEM_OP_STORE 0x04 /* store instruction */ #define PERF_MEM_OP_PFETCH 0x08 /* prefetch */ #define PERF_MEM_OP_EXEC 0x10 /* code (execution) */ #define PERF_MEM_OP_SHIFT 0 /* memory hierarchy (memory level, hit or miss) */ #define PERF_MEM_LVL_NA 0x01 /* not available */ #define PERF_MEM_LVL_HIT 0x02 /* hit level */ #define PERF_MEM_LVL_MISS 0x04 /* miss level */ #define PERF_MEM_LVL_L1 0x08 /* L1 */ #define PERF_MEM_LVL_LFB 0x10 /* Line Fill Buffer */ #define PERF_MEM_LVL_L2 0x20 /* L2 */ #define PERF_MEM_LVL_L3 0x40 /* L3 */ #define PERF_MEM_LVL_LOC_RAM 0x80 /* Local DRAM */ #define PERF_MEM_LVL_REM_RAM1 0x100 /* Remote DRAM (1 hop) */ #define PERF_MEM_LVL_REM_RAM2 0x200 /* Remote DRAM (2 hops) */ #define PERF_MEM_LVL_REM_CCE1 0x400 /* Remote Cache (1 hop) */ #define PERF_MEM_LVL_REM_CCE2 0x800 /* Remote Cache (2 hops) */ #define PERF_MEM_LVL_IO 0x1000 /* I/O memory */ #define PERF_MEM_LVL_UNC 0x2000 /* Uncached memory */ #define PERF_MEM_LVL_SHIFT 5 #define PERF_MEM_REMOTE_REMOTE 0x01 /* Remote */ #define PERF_MEM_REMOTE_SHIFT 37 #define PERF_MEM_LVLNUM_L1 0x01 /* L1 */ #define PERF_MEM_LVLNUM_L2 0x02 /* L2 */ #define PERF_MEM_LVLNUM_L3 0x03 /* L3 */ #define PERF_MEM_LVLNUM_L4 0x04 /* L4 */ /* 5-0xa available */ #define PERF_MEM_LVLNUM_ANY_CACHE 0x0b /* Any cache */ #define PERF_MEM_LVLNUM_LFB 0x0c /* LFB */ #define PERF_MEM_LVLNUM_RAM 0x0d /* RAM */ #define PERF_MEM_LVLNUM_PMEM 0x0e /* PMEM */ #define PERF_MEM_LVLNUM_NA 0x0f /* N/A */ #define PERF_MEM_LVLNUM_SHIFT 33 /* snoop mode */ #define PERF_MEM_SNOOP_NA 0x01 /* not available */ #define PERF_MEM_SNOOP_NONE 0x02 /* no snoop */ #define PERF_MEM_SNOOP_HIT 0x04 /* snoop hit */ #define PERF_MEM_SNOOP_MISS 0x08 /* snoop miss */ #define PERF_MEM_SNOOP_HITM 0x10 /* snoop hit modified */ #define PERF_MEM_SNOOP_SHIFT 19 #define PERF_MEM_SNOOPX_FWD 0x01 /* forward */ /* 1 free */ #define PERF_MEM_SNOOPX_SHIFT 38 /* locked instruction */ #define PERF_MEM_LOCK_NA 0x01 /* not available */ #define PERF_MEM_LOCK_LOCKED 0x02 /* locked transaction */ #define PERF_MEM_LOCK_SHIFT 24 /* TLB access */ #define PERF_MEM_TLB_NA 0x01 /* not available */ #define PERF_MEM_TLB_HIT 0x02 /* hit level */ #define PERF_MEM_TLB_MISS 0x04 /* miss level */ #define PERF_MEM_TLB_L1 0x08 /* L1 */ #define PERF_MEM_TLB_L2 0x10 /* L2 */ #define PERF_MEM_TLB_WK 0x20 /* Hardware Walker*/ #define PERF_MEM_TLB_OS 0x40 /* OS fault handler */ #define PERF_MEM_TLB_SHIFT 26 #define PERF_MEM_S(a, s) \ (((__u64)PERF_MEM_##a##_##s) << PERF_MEM_##a##_SHIFT) /* * single taken branch record layout: * * from: source instruction (may not always be a branch insn) * to: branch target * mispred: branch target was mispredicted * predicted: branch target was predicted * * support for mispred, predicted is optional. In case it * is not supported mispred = predicted = 0. * * in_tx: running in a hardware transaction * abort: aborting a hardware transaction * cycles: cycles from last branch (or 0 if not supported) * type: branch type */ struct perf_branch_entry { __u64 from; __u64 to; __u64 mispred:1, /* target mispredicted */ predicted:1,/* target predicted */ in_tx:1, /* in transaction */ abort:1, /* transaction abort */ cycles:16, /* cycle count to last branch */ type:4, /* branch type */ reserved:40; }; #endif /* _LINUX_PERF_EVENT_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/inotify.h�������������������������������������������������������������������������������������0000644�����������������00000006334�14763166027�0007557 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Inode based directory notification for Linux * * Copyright (C) 2005 John McCutchan */ #ifndef _LINUX_INOTIFY_H #define _LINUX_INOTIFY_H /* For O_CLOEXEC and O_NONBLOCK */ #include <linux/fcntl.h> #include <linux/types.h> /* * struct inotify_event - structure read from the inotify device for each event * * When you are watching a directory, you will receive the filename for events * such as IN_CREATE, IN_DELETE, IN_OPEN, IN_CLOSE, ..., relative to the wd. */ struct inotify_event { __s32 wd; /* watch descriptor */ __u32 mask; /* watch mask */ __u32 cookie; /* cookie to synchronize two events */ __u32 len; /* length (including nulls) of name */ char name[0]; /* stub for possible name */ }; /* the following are legal, implemented events that user-space can watch for */ #define IN_ACCESS 0x00000001 /* File was accessed */ #define IN_MODIFY 0x00000002 /* File was modified */ #define IN_ATTRIB 0x00000004 /* Metadata changed */ #define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed */ #define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */ #define IN_OPEN 0x00000020 /* File was opened */ #define IN_MOVED_FROM 0x00000040 /* File was moved from X */ #define IN_MOVED_TO 0x00000080 /* File was moved to Y */ #define IN_CREATE 0x00000100 /* Subfile was created */ #define IN_DELETE 0x00000200 /* Subfile was deleted */ #define IN_DELETE_SELF 0x00000400 /* Self was deleted */ #define IN_MOVE_SELF 0x00000800 /* Self was moved */ /* the following are legal events. they are sent as needed to any watch */ #define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted */ #define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */ #define IN_IGNORED 0x00008000 /* File was ignored */ /* helper events */ #define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* close */ #define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */ /* special flags */ #define IN_ONLYDIR 0x01000000 /* only watch the path if it is a directory */ #define IN_DONT_FOLLOW 0x02000000 /* don't follow a sym link */ #define IN_EXCL_UNLINK 0x04000000 /* exclude events on unlinked objects */ #define IN_MASK_CREATE 0x10000000 /* only create watches */ #define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */ #define IN_ISDIR 0x40000000 /* event occurred against dir */ #define IN_ONESHOT 0x80000000 /* only send event once */ /* * All of the events - we build the list by hand so that we can add flags in * the future and not break backward compatibility. Apps will get only the * events that they originally wanted. Be sure to add new events here! */ #define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \ IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \ IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \ IN_MOVE_SELF) /* Flags for sys_inotify_init1. */ #define IN_CLOEXEC O_CLOEXEC #define IN_NONBLOCK O_NONBLOCK /* * ioctl numbers: inotify uses 'I' prefix for all ioctls, * except historical FIONREAD, which is based on 'T'. * * INOTIFY_IOC_SETNEXTWD: set desired number of next created * watch descriptor. */ #define INOTIFY_IOC_SETNEXTWD _IOW('I', 0, __s32) #endif /* _LINUX_INOTIFY_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/bcm933xx_hcs.h��������������������������������������������������������������������������������0000644�����������������00000000643�14763166027�0010310 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Broadcom Cable Modem firmware format */ #ifndef __BCM933XX_HCS_H #define __BCM933XX_HCS_H #include <linux/types.h> struct bcm_hcs { __u16 magic; __u16 control; __u16 rev_maj; __u16 rev_min; __u32 build_date; __u32 filelen; __u32 ldaddress; char filename[64]; __u16 hcs; __u16 her_znaet_chto; __u32 crc; }; #endif /* __BCM933XX_HCS */ ���������������������������������������������������������������������������������������������linux/pmu.h�����������������������������������������������������������������������������������������0000644�����������������00000012304�14763166027�0006671 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Definitions for talking to the PMU. The PMU is a microcontroller * which controls battery charging and system power on PowerBook 3400 * and 2400 models as well as the RTC and various other things. * * Copyright (C) 1998 Paul Mackerras. */ #ifndef _LINUX_PMU_H #define _LINUX_PMU_H #define PMU_DRIVER_VERSION 2 /* * PMU commands */ #define PMU_POWER_CTRL0 0x10 /* control power of some devices */ #define PMU_POWER_CTRL 0x11 /* control power of some devices */ #define PMU_ADB_CMD 0x20 /* send ADB packet */ #define PMU_ADB_POLL_OFF 0x21 /* disable ADB auto-poll */ #define PMU_WRITE_NVRAM 0x33 /* write non-volatile RAM */ #define PMU_READ_NVRAM 0x3b /* read non-volatile RAM */ #define PMU_SET_RTC 0x30 /* set real-time clock */ #define PMU_READ_RTC 0x38 /* read real-time clock */ #define PMU_SET_VOLBUTTON 0x40 /* set volume up/down position */ #define PMU_BACKLIGHT_BRIGHT 0x41 /* set backlight brightness */ #define PMU_GET_VOLBUTTON 0x48 /* get volume up/down position */ #define PMU_PCEJECT 0x4c /* eject PC-card from slot */ #define PMU_BATTERY_STATE 0x6b /* report battery state etc. */ #define PMU_SMART_BATTERY_STATE 0x6f /* report battery state (new way) */ #define PMU_SET_INTR_MASK 0x70 /* set PMU interrupt mask */ #define PMU_INT_ACK 0x78 /* read interrupt bits */ #define PMU_SHUTDOWN 0x7e /* turn power off */ #define PMU_CPU_SPEED 0x7d /* control CPU speed on some models */ #define PMU_SLEEP 0x7f /* put CPU to sleep */ #define PMU_POWER_EVENTS 0x8f /* Send power-event commands to PMU */ #define PMU_I2C_CMD 0x9a /* I2C operations */ #define PMU_RESET 0xd0 /* reset CPU */ #define PMU_GET_BRIGHTBUTTON 0xd9 /* report brightness up/down pos */ #define PMU_GET_COVER 0xdc /* report cover open/closed */ #define PMU_SYSTEM_READY 0xdf /* tell PMU we are awake */ #define PMU_GET_VERSION 0xea /* read the PMU version */ /* Bits to use with the PMU_POWER_CTRL0 command */ #define PMU_POW0_ON 0x80 /* OR this to power ON the device */ #define PMU_POW0_OFF 0x00 /* leave bit 7 to 0 to power it OFF */ #define PMU_POW0_HARD_DRIVE 0x04 /* Hard drive power (on wallstreet/lombard ?) */ /* Bits to use with the PMU_POWER_CTRL command */ #define PMU_POW_ON 0x80 /* OR this to power ON the device */ #define PMU_POW_OFF 0x00 /* leave bit 7 to 0 to power it OFF */ #define PMU_POW_BACKLIGHT 0x01 /* backlight power */ #define PMU_POW_CHARGER 0x02 /* battery charger power */ #define PMU_POW_IRLED 0x04 /* IR led power (on wallstreet) */ #define PMU_POW_MEDIABAY 0x08 /* media bay power (wallstreet/lombard ?) */ /* Bits in PMU interrupt and interrupt mask bytes */ #define PMU_INT_PCEJECT 0x04 /* PC-card eject buttons */ #define PMU_INT_SNDBRT 0x08 /* sound/brightness up/down buttons */ #define PMU_INT_ADB 0x10 /* ADB autopoll or reply data */ #define PMU_INT_BATTERY 0x20 /* Battery state change */ #define PMU_INT_ENVIRONMENT 0x40 /* Environment interrupts */ #define PMU_INT_TICK 0x80 /* 1-second tick interrupt */ /* Other bits in PMU interrupt valid when PMU_INT_ADB is set */ #define PMU_INT_ADB_AUTO 0x04 /* ADB autopoll, when PMU_INT_ADB */ #define PMU_INT_WAITING_CHARGER 0x01 /* ??? */ #define PMU_INT_AUTO_SRQ_POLL 0x02 /* ??? */ /* Bits in the environement message (either obtained via PMU_GET_COVER, * or via PMU_INT_ENVIRONMENT on core99 */ #define PMU_ENV_LID_CLOSED 0x01 /* The lid is closed */ /* I2C related definitions */ #define PMU_I2C_MODE_SIMPLE 0 #define PMU_I2C_MODE_STDSUB 1 #define PMU_I2C_MODE_COMBINED 2 #define PMU_I2C_BUS_STATUS 0 #define PMU_I2C_BUS_SYSCLK 1 #define PMU_I2C_BUS_POWER 2 #define PMU_I2C_STATUS_OK 0 #define PMU_I2C_STATUS_DATAREAD 1 #define PMU_I2C_STATUS_BUSY 0xfe /* Kind of PMU (model) */ enum { PMU_UNKNOWN, PMU_OHARE_BASED, /* 2400, 3400, 3500 (old G3 powerbook) */ PMU_HEATHROW_BASED, /* PowerBook G3 series */ PMU_PADDINGTON_BASED, /* 1999 PowerBook G3 */ PMU_KEYLARGO_BASED, /* Core99 motherboard (PMU99) */ PMU_68K_V1, /* Unused/deprecated */ PMU_68K_V2, /* Unused/deprecated */ }; /* PMU PMU_POWER_EVENTS commands */ enum { PMU_PWR_GET_POWERUP_EVENTS = 0x00, PMU_PWR_SET_POWERUP_EVENTS = 0x01, PMU_PWR_CLR_POWERUP_EVENTS = 0x02, PMU_PWR_GET_WAKEUP_EVENTS = 0x03, PMU_PWR_SET_WAKEUP_EVENTS = 0x04, PMU_PWR_CLR_WAKEUP_EVENTS = 0x05, }; /* Power events wakeup bits */ enum { PMU_PWR_WAKEUP_KEY = 0x01, /* Wake on key press */ PMU_PWR_WAKEUP_AC_INSERT = 0x02, /* Wake on AC adapter plug */ PMU_PWR_WAKEUP_AC_CHANGE = 0x04, PMU_PWR_WAKEUP_LID_OPEN = 0x08, PMU_PWR_WAKEUP_RING = 0x10, }; /* * Ioctl commands for the /dev/pmu device */ #include <linux/ioctl.h> /* no param */ #define PMU_IOC_SLEEP _IO('B', 0) /* out param: u32* backlight value: 0 to 15 */ #define PMU_IOC_GET_BACKLIGHT _IOR('B', 1, size_t) /* in param: u32 backlight value: 0 to 15 */ #define PMU_IOC_SET_BACKLIGHT _IOW('B', 2, size_t) /* out param: u32* PMU model */ #define PMU_IOC_GET_MODEL _IOR('B', 3, size_t) /* out param: u32* has_adb: 0 or 1 */ #define PMU_IOC_HAS_ADB _IOR('B', 4, size_t) /* out param: u32* can_sleep: 0 or 1 */ #define PMU_IOC_CAN_SLEEP _IOR('B', 5, size_t) /* no param, but historically was _IOR('B', 6, 0), meaning 4 bytes */ #define PMU_IOC_GRAB_BACKLIGHT _IOR('B', 6, size_t) #endif /* _LINUX_PMU_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netlink.h�������������������������������������������������������������������������������������0000644�����������������00000017155�14763166027�0007545 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_NETLINK_H #define __LINUX_NETLINK_H #include <linux/const.h> #include <linux/socket.h> /* for __kernel_sa_family_t */ #include <linux/types.h> #define NETLINK_ROUTE 0 /* Routing/device hook */ #define NETLINK_UNUSED 1 /* Unused number */ #define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ #define NETLINK_FIREWALL 3 /* Unused number, formerly ip_queue */ #define NETLINK_SOCK_DIAG 4 /* socket monitoring */ #define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ #define NETLINK_XFRM 6 /* ipsec */ #define NETLINK_SELINUX 7 /* SELinux event notifications */ #define NETLINK_ISCSI 8 /* Open-iSCSI */ #define NETLINK_AUDIT 9 /* auditing */ #define NETLINK_FIB_LOOKUP 10 #define NETLINK_CONNECTOR 11 #define NETLINK_NETFILTER 12 /* netfilter subsystem */ #define NETLINK_IP6_FW 13 #define NETLINK_DNRTMSG 14 /* DECnet routing messages */ #define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ #define NETLINK_GENERIC 16 /* leave room for NETLINK_DM (DM Events) */ #define NETLINK_SCSITRANSPORT 18 /* SCSI Transports */ #define NETLINK_ECRYPTFS 19 #define NETLINK_RDMA 20 #define NETLINK_CRYPTO 21 /* Crypto layer */ #define NETLINK_SMC 22 /* SMC monitoring */ #define NETLINK_INET_DIAG NETLINK_SOCK_DIAG #define MAX_LINKS 32 struct sockaddr_nl { __kernel_sa_family_t nl_family; /* AF_NETLINK */ unsigned short nl_pad; /* zero */ __u32 nl_pid; /* port ID */ __u32 nl_groups; /* multicast groups mask */ }; struct nlmsghdr { __u32 nlmsg_len; /* Length of message including header */ __u16 nlmsg_type; /* Message content */ __u16 nlmsg_flags; /* Additional flags */ __u32 nlmsg_seq; /* Sequence number */ __u32 nlmsg_pid; /* Sending process port ID */ }; /* Flags values */ #define NLM_F_REQUEST 0x01 /* It is request message. */ #define NLM_F_MULTI 0x02 /* Multipart message, terminated by NLMSG_DONE */ #define NLM_F_ACK 0x04 /* Reply with ack, with zero or error code */ #define NLM_F_ECHO 0x08 /* Echo this request */ #define NLM_F_DUMP_INTR 0x10 /* Dump was inconsistent due to sequence change */ #define NLM_F_DUMP_FILTERED 0x20 /* Dump was filtered as requested */ /* Modifiers to GET request */ #define NLM_F_ROOT 0x100 /* specify tree root */ #define NLM_F_MATCH 0x200 /* return all matching */ #define NLM_F_ATOMIC 0x400 /* atomic GET */ #define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH) /* Modifiers to NEW request */ #define NLM_F_REPLACE 0x100 /* Override existing */ #define NLM_F_EXCL 0x200 /* Do not touch, if it exists */ #define NLM_F_CREATE 0x400 /* Create, if it does not exist */ #define NLM_F_APPEND 0x800 /* Add to end of list */ /* Modifiers to DELETE request */ #define NLM_F_NONREC 0x100 /* Do not delete recursively */ /* Flags for ACK message */ #define NLM_F_CAPPED 0x100 /* request was capped */ #define NLM_F_ACK_TLVS 0x200 /* extended ACK TVLs were included */ /* 4.4BSD ADD NLM_F_CREATE|NLM_F_EXCL 4.4BSD CHANGE NLM_F_REPLACE True CHANGE NLM_F_CREATE|NLM_F_REPLACE Append NLM_F_CREATE Check NLM_F_EXCL */ #define NLMSG_ALIGNTO 4U #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) #define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN) #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) #define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len))) #define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \ (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \ (nlh)->nlmsg_len <= (len)) #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len))) #define NLMSG_NOOP 0x1 /* Nothing. */ #define NLMSG_ERROR 0x2 /* Error */ #define NLMSG_DONE 0x3 /* End of a dump */ #define NLMSG_OVERRUN 0x4 /* Data lost */ #define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */ struct nlmsgerr { int error; struct nlmsghdr msg; /* * followed by the message contents unless NETLINK_CAP_ACK was set * or the ACK indicates success (error == 0) * message length is aligned with NLMSG_ALIGN() */ /* * followed by TLVs defined in enum nlmsgerr_attrs * if NETLINK_EXT_ACK was set */ }; /** * enum nlmsgerr_attrs - nlmsgerr attributes * @NLMSGERR_ATTR_UNUSED: unused * @NLMSGERR_ATTR_MSG: error message string (string) * @NLMSGERR_ATTR_OFFS: offset of the invalid attribute in the original * message, counting from the beginning of the header (u32) * @NLMSGERR_ATTR_COOKIE: arbitrary subsystem specific cookie to * be used - in the success case - to identify a created * object or operation or similar (binary) * @__NLMSGERR_ATTR_MAX: number of attributes * @NLMSGERR_ATTR_MAX: highest attribute number */ enum nlmsgerr_attrs { NLMSGERR_ATTR_UNUSED, NLMSGERR_ATTR_MSG, NLMSGERR_ATTR_OFFS, NLMSGERR_ATTR_COOKIE, __NLMSGERR_ATTR_MAX, NLMSGERR_ATTR_MAX = __NLMSGERR_ATTR_MAX - 1 }; #define NETLINK_ADD_MEMBERSHIP 1 #define NETLINK_DROP_MEMBERSHIP 2 #define NETLINK_PKTINFO 3 #define NETLINK_BROADCAST_ERROR 4 #define NETLINK_NO_ENOBUFS 5 #define NETLINK_RX_RING 6 #define NETLINK_TX_RING 7 #define NETLINK_LISTEN_ALL_NSID 8 #define NETLINK_LIST_MEMBERSHIPS 9 #define NETLINK_CAP_ACK 10 #define NETLINK_EXT_ACK 11 struct nl_pktinfo { __u32 group; }; struct nl_mmap_req { unsigned int nm_block_size; unsigned int nm_block_nr; unsigned int nm_frame_size; unsigned int nm_frame_nr; }; struct nl_mmap_hdr { unsigned int nm_status; unsigned int nm_len; __u32 nm_group; /* credentials */ __u32 nm_pid; __u32 nm_uid; __u32 nm_gid; }; enum nl_mmap_status { NL_MMAP_STATUS_UNUSED, NL_MMAP_STATUS_RESERVED, NL_MMAP_STATUS_VALID, NL_MMAP_STATUS_COPY, NL_MMAP_STATUS_SKIP, }; #define NL_MMAP_MSG_ALIGNMENT NLMSG_ALIGNTO #define NL_MMAP_MSG_ALIGN(sz) __ALIGN_KERNEL(sz, NL_MMAP_MSG_ALIGNMENT) #define NL_MMAP_HDRLEN NL_MMAP_MSG_ALIGN(sizeof(struct nl_mmap_hdr)) #define NET_MAJOR 36 /* Major 36 is reserved for networking */ enum { NETLINK_UNCONNECTED = 0, NETLINK_CONNECTED, }; /* * <------- NLA_HDRLEN ------> <-- NLA_ALIGN(payload)--> * +---------------------+- - -+- - - - - - - - - -+- - -+ * | Header | Pad | Payload | Pad | * | (struct nlattr) | ing | | ing | * +---------------------+- - -+- - - - - - - - - -+- - -+ * <-------------- nlattr->nla_len --------------> */ struct nlattr { __u16 nla_len; __u16 nla_type; }; /* * nla_type (16 bits) * +---+---+-------------------------------+ * | N | O | Attribute Type | * +---+---+-------------------------------+ * N := Carries nested attributes * O := Payload stored in network byte order * * Note: The N and O flag are mutually exclusive. */ #define NLA_F_NESTED (1 << 15) #define NLA_F_NET_BYTEORDER (1 << 14) #define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER) #define NLA_ALIGNTO 4 #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) #define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr))) /* Generic 32 bitflags attribute content sent to the kernel. * * The value is a bitmap that defines the values being set * The selector is a bitmask that defines which value is legit * * Examples: * value = 0x0, and selector = 0x1 * implies we are selecting bit 1 and we want to set its value to 0. * * value = 0x2, and selector = 0x2 * implies we are selecting bit 2 and we want to set its value to 1. * */ struct nla_bitfield32 { __u32 value; __u32 selector; }; #endif /* __LINUX_NETLINK_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/joystick.h������������������������������������������������������������������������������������0000644�����������������00000006552�14763166027�0007737 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (C) 1996-2000 Vojtech Pavlik * * Sponsored by SuSE */ /* * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _LINUX_JOYSTICK_H #define _LINUX_JOYSTICK_H #include <linux/types.h> #include <linux/input.h> /* * Version */ #define JS_VERSION 0x020100 /* * Types and constants for reading from /dev/js */ #define JS_EVENT_BUTTON 0x01 /* button pressed/released */ #define JS_EVENT_AXIS 0x02 /* joystick moved */ #define JS_EVENT_INIT 0x80 /* initial state of device */ struct js_event { __u32 time; /* event timestamp in milliseconds */ __s16 value; /* value */ __u8 type; /* event type */ __u8 number; /* axis/button number */ }; /* * IOCTL commands for joystick driver */ #define JSIOCGVERSION _IOR('j', 0x01, __u32) /* get driver version */ #define JSIOCGAXES _IOR('j', 0x11, __u8) /* get number of axes */ #define JSIOCGBUTTONS _IOR('j', 0x12, __u8) /* get number of buttons */ #define JSIOCGNAME(len) _IOC(_IOC_READ, 'j', 0x13, len) /* get identifier string */ #define JSIOCSCORR _IOW('j', 0x21, struct js_corr) /* set correction values */ #define JSIOCGCORR _IOR('j', 0x22, struct js_corr) /* get correction values */ #define JSIOCSAXMAP _IOW('j', 0x31, __u8[ABS_CNT]) /* set axis mapping */ #define JSIOCGAXMAP _IOR('j', 0x32, __u8[ABS_CNT]) /* get axis mapping */ #define JSIOCSBTNMAP _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1]) /* set button mapping */ #define JSIOCGBTNMAP _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1]) /* get button mapping */ /* * Types and constants for get/set correction */ #define JS_CORR_NONE 0x00 /* returns raw values */ #define JS_CORR_BROKEN 0x01 /* broken line */ struct js_corr { __s32 coef[8]; __s16 prec; __u16 type; }; /* * v0.x compatibility definitions */ #define JS_RETURN sizeof(struct JS_DATA_TYPE) #define JS_TRUE 1 #define JS_FALSE 0 #define JS_X_0 0x01 #define JS_Y_0 0x02 #define JS_X_1 0x04 #define JS_Y_1 0x08 #define JS_MAX 2 #define JS_DEF_TIMEOUT 0x1300 #define JS_DEF_CORR 0 #define JS_DEF_TIMELIMIT 10L #define JS_SET_CAL 1 #define JS_GET_CAL 2 #define JS_SET_TIMEOUT 3 #define JS_GET_TIMEOUT 4 #define JS_SET_TIMELIMIT 5 #define JS_GET_TIMELIMIT 6 #define JS_GET_ALL 7 #define JS_SET_ALL 8 struct JS_DATA_TYPE { __s32 buttons; __s32 x; __s32 y; }; struct JS_DATA_SAVE_TYPE_32 { __s32 JS_TIMEOUT; __s32 BUSY; __s32 JS_EXPIRETIME; __s32 JS_TIMELIMIT; struct JS_DATA_TYPE JS_SAVE; struct JS_DATA_TYPE JS_CORR; }; struct JS_DATA_SAVE_TYPE_64 { __s32 JS_TIMEOUT; __s32 BUSY; __s64 JS_EXPIRETIME; __s64 JS_TIMELIMIT; struct JS_DATA_TYPE JS_SAVE; struct JS_DATA_TYPE JS_CORR; }; #endif /* _LINUX_JOYSTICK_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������linux/btf.h�����������������������������������������������������������������������������������������0000644�����������������00000005754�14763166027�0006656 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Copyright (c) 2018 Facebook */ #ifndef __LINUX_BTF_H__ #define __LINUX_BTF_H__ #include <linux/types.h> #define BTF_MAGIC 0xeB9F #define BTF_VERSION 1 struct btf_header { __u16 magic; __u8 version; __u8 flags; __u32 hdr_len; /* All offsets are in bytes relative to the end of this header */ __u32 type_off; /* offset of type section */ __u32 type_len; /* length of type section */ __u32 str_off; /* offset of string section */ __u32 str_len; /* length of string section */ }; /* Max # of type identifier */ #define BTF_MAX_TYPE 0x000fffff /* Max offset into the string section */ #define BTF_MAX_NAME_OFFSET 0x00ffffff /* Max # of struct/union/enum members or func args */ #define BTF_MAX_VLEN 0xffff struct btf_type { __u32 name_off; /* "info" bits arrangement * bits 0-15: vlen (e.g. # of struct's members) * bits 16-23: unused * bits 24-27: kind (e.g. int, ptr, array...etc) * bits 28-31: unused */ __u32 info; /* "size" is used by INT, ENUM, STRUCT and UNION. * "size" tells the size of the type it is describing. * * "type" is used by PTR, TYPEDEF, VOLATILE, CONST and RESTRICT. * "type" is a type_id referring to another type. */ union { __u32 size; __u32 type; }; }; #define BTF_INFO_KIND(info) (((info) >> 24) & 0x0f) #define BTF_INFO_VLEN(info) ((info) & 0xffff) #define BTF_KIND_UNKN 0 /* Unknown */ #define BTF_KIND_INT 1 /* Integer */ #define BTF_KIND_PTR 2 /* Pointer */ #define BTF_KIND_ARRAY 3 /* Array */ #define BTF_KIND_STRUCT 4 /* Struct */ #define BTF_KIND_UNION 5 /* Union */ #define BTF_KIND_ENUM 6 /* Enumeration */ #define BTF_KIND_FWD 7 /* Forward */ #define BTF_KIND_TYPEDEF 8 /* Typedef */ #define BTF_KIND_VOLATILE 9 /* Volatile */ #define BTF_KIND_CONST 10 /* Const */ #define BTF_KIND_RESTRICT 11 /* Restrict */ #define BTF_KIND_MAX 11 #define NR_BTF_KINDS 12 /* For some specific BTF_KIND, "struct btf_type" is immediately * followed by extra data. */ /* BTF_KIND_INT is followed by a u32 and the following * is the 32 bits arrangement: */ #define BTF_INT_ENCODING(VAL) (((VAL) & 0x0f000000) >> 24) #define BTF_INT_OFFSET(VAL) (((VAL & 0x00ff0000)) >> 16) #define BTF_INT_BITS(VAL) ((VAL) & 0x000000ff) /* Attributes stored in the BTF_INT_ENCODING */ #define BTF_INT_SIGNED (1 << 0) #define BTF_INT_CHAR (1 << 1) #define BTF_INT_BOOL (1 << 2) /* BTF_KIND_ENUM is followed by multiple "struct btf_enum". * The exact number of btf_enum is stored in the vlen (of the * info in "struct btf_type"). */ struct btf_enum { __u32 name_off; __s32 val; }; /* BTF_KIND_ARRAY is followed by one "struct btf_array" */ struct btf_array { __u32 type; __u32 index_type; __u32 nelems; }; /* BTF_KIND_STRUCT and BTF_KIND_UNION are followed * by multiple "struct btf_member". The exact number * of btf_member is stored in the vlen (of the info in * "struct btf_type"). */ struct btf_member { __u32 name_off; __u32 type; __u32 offset; /* offset in bits */ }; #endif /* __LINUX_BTF_H__ */ ��������������������linux/kcm.h�����������������������������������������������������������������������������������������0000644�����������������00000001466�14763166027�0006651 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Kernel Connection Multiplexor * * Copyright (c) 2016 Tom Herbert <tom@herbertland.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation. * * User API to clone KCM sockets and attach transport socket to a KCM * multiplexor. */ #ifndef KCM_KERNEL_H #define KCM_KERNEL_H struct kcm_attach { int fd; int bpf_fd; }; struct kcm_unattach { int fd; }; struct kcm_clone { int fd; }; #define SIOCKCMATTACH (SIOCPROTOPRIVATE + 0) #define SIOCKCMUNATTACH (SIOCPROTOPRIVATE + 1) #define SIOCKCMCLONE (SIOCPROTOPRIVATE + 2) #define KCMPROTO_CONNECTED 0 /* Socket options */ #define KCM_RECV_DISABLE 1 #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/media-bus-format.h����������������������������������������������������������������������������0000644�����������������00000015124�14763166027�0011227 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Media Bus API header * * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef __LINUX_MEDIA_BUS_FORMAT_H #define __LINUX_MEDIA_BUS_FORMAT_H /* * These bus formats uniquely identify data formats on the data bus. Format 0 * is reserved, MEDIA_BUS_FMT_FIXED shall be used by host-client pairs, where * the data format is fixed. Additionally, "2X8" means that one pixel is * transferred in two 8-bit samples, "BE" or "LE" specify in which order those * samples are transferred over the bus: "LE" means that the least significant * bits are transferred first, "BE" means that the most significant bits are * transferred first, and "PADHI" and "PADLO" define which bits - low or high, * in the incomplete high byte, are filled with padding bits. * * The bus formats are grouped by type, bus_width, bits per component, samples * per pixel and order of subsamples. Numerical values are sorted using generic * numerical sort order (8 thus comes before 10). * * As their value can't change when a new bus format is inserted in the * enumeration, the bus formats are explicitly given a numerical value. The next * free values for each category are listed below, update them when inserting * new pixel codes. */ #define MEDIA_BUS_FMT_FIXED 0x0001 /* RGB - next is 0x101b */ #define MEDIA_BUS_FMT_RGB444_1X12 0x1016 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE 0x1001 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE 0x1002 #define MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE 0x1003 #define MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE 0x1004 #define MEDIA_BUS_FMT_RGB565_1X16 0x1017 #define MEDIA_BUS_FMT_BGR565_2X8_BE 0x1005 #define MEDIA_BUS_FMT_BGR565_2X8_LE 0x1006 #define MEDIA_BUS_FMT_RGB565_2X8_BE 0x1007 #define MEDIA_BUS_FMT_RGB565_2X8_LE 0x1008 #define MEDIA_BUS_FMT_RGB666_1X18 0x1009 #define MEDIA_BUS_FMT_RBG888_1X24 0x100e #define MEDIA_BUS_FMT_RGB666_1X24_CPADHI 0x1015 #define MEDIA_BUS_FMT_RGB666_1X7X3_SPWG 0x1010 #define MEDIA_BUS_FMT_BGR888_1X24 0x1013 #define MEDIA_BUS_FMT_GBR888_1X24 0x1014 #define MEDIA_BUS_FMT_RGB888_1X24 0x100a #define MEDIA_BUS_FMT_RGB888_2X12_BE 0x100b #define MEDIA_BUS_FMT_RGB888_2X12_LE 0x100c #define MEDIA_BUS_FMT_RGB888_1X7X4_SPWG 0x1011 #define MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA 0x1012 #define MEDIA_BUS_FMT_ARGB8888_1X32 0x100d #define MEDIA_BUS_FMT_RGB888_1X32_PADHI 0x100f #define MEDIA_BUS_FMT_RGB101010_1X30 0x1018 #define MEDIA_BUS_FMT_RGB121212_1X36 0x1019 #define MEDIA_BUS_FMT_RGB161616_1X48 0x101a /* YUV (including grey) - next is 0x202d */ #define MEDIA_BUS_FMT_Y8_1X8 0x2001 #define MEDIA_BUS_FMT_UV8_1X8 0x2015 #define MEDIA_BUS_FMT_UYVY8_1_5X8 0x2002 #define MEDIA_BUS_FMT_VYUY8_1_5X8 0x2003 #define MEDIA_BUS_FMT_YUYV8_1_5X8 0x2004 #define MEDIA_BUS_FMT_YVYU8_1_5X8 0x2005 #define MEDIA_BUS_FMT_UYVY8_2X8 0x2006 #define MEDIA_BUS_FMT_VYUY8_2X8 0x2007 #define MEDIA_BUS_FMT_YUYV8_2X8 0x2008 #define MEDIA_BUS_FMT_YVYU8_2X8 0x2009 #define MEDIA_BUS_FMT_Y10_1X10 0x200a #define MEDIA_BUS_FMT_Y10_2X8_PADHI_LE 0x202c #define MEDIA_BUS_FMT_UYVY10_2X10 0x2018 #define MEDIA_BUS_FMT_VYUY10_2X10 0x2019 #define MEDIA_BUS_FMT_YUYV10_2X10 0x200b #define MEDIA_BUS_FMT_YVYU10_2X10 0x200c #define MEDIA_BUS_FMT_Y12_1X12 0x2013 #define MEDIA_BUS_FMT_UYVY12_2X12 0x201c #define MEDIA_BUS_FMT_VYUY12_2X12 0x201d #define MEDIA_BUS_FMT_YUYV12_2X12 0x201e #define MEDIA_BUS_FMT_YVYU12_2X12 0x201f #define MEDIA_BUS_FMT_UYVY8_1X16 0x200f #define MEDIA_BUS_FMT_VYUY8_1X16 0x2010 #define MEDIA_BUS_FMT_YUYV8_1X16 0x2011 #define MEDIA_BUS_FMT_YVYU8_1X16 0x2012 #define MEDIA_BUS_FMT_YDYUYDYV8_1X16 0x2014 #define MEDIA_BUS_FMT_UYVY10_1X20 0x201a #define MEDIA_BUS_FMT_VYUY10_1X20 0x201b #define MEDIA_BUS_FMT_YUYV10_1X20 0x200d #define MEDIA_BUS_FMT_YVYU10_1X20 0x200e #define MEDIA_BUS_FMT_VUY8_1X24 0x2024 #define MEDIA_BUS_FMT_YUV8_1X24 0x2025 #define MEDIA_BUS_FMT_UYYVYY8_0_5X24 0x2026 #define MEDIA_BUS_FMT_UYVY12_1X24 0x2020 #define MEDIA_BUS_FMT_VYUY12_1X24 0x2021 #define MEDIA_BUS_FMT_YUYV12_1X24 0x2022 #define MEDIA_BUS_FMT_YVYU12_1X24 0x2023 #define MEDIA_BUS_FMT_YUV10_1X30 0x2016 #define MEDIA_BUS_FMT_UYYVYY10_0_5X30 0x2027 #define MEDIA_BUS_FMT_AYUV8_1X32 0x2017 #define MEDIA_BUS_FMT_UYYVYY12_0_5X36 0x2028 #define MEDIA_BUS_FMT_YUV12_1X36 0x2029 #define MEDIA_BUS_FMT_YUV16_1X48 0x202a #define MEDIA_BUS_FMT_UYYVYY16_0_5X48 0x202b /* Bayer - next is 0x3021 */ #define MEDIA_BUS_FMT_SBGGR8_1X8 0x3001 #define MEDIA_BUS_FMT_SGBRG8_1X8 0x3013 #define MEDIA_BUS_FMT_SGRBG8_1X8 0x3002 #define MEDIA_BUS_FMT_SRGGB8_1X8 0x3014 #define MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8 0x3015 #define MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8 0x3016 #define MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8 0x3017 #define MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8 0x3018 #define MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8 0x300b #define MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8 0x300c #define MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8 0x3009 #define MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8 0x300d #define MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE 0x3003 #define MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE 0x3004 #define MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE 0x3005 #define MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE 0x3006 #define MEDIA_BUS_FMT_SBGGR10_1X10 0x3007 #define MEDIA_BUS_FMT_SGBRG10_1X10 0x300e #define MEDIA_BUS_FMT_SGRBG10_1X10 0x300a #define MEDIA_BUS_FMT_SRGGB10_1X10 0x300f #define MEDIA_BUS_FMT_SBGGR12_1X12 0x3008 #define MEDIA_BUS_FMT_SGBRG12_1X12 0x3010 #define MEDIA_BUS_FMT_SGRBG12_1X12 0x3011 #define MEDIA_BUS_FMT_SRGGB12_1X12 0x3012 #define MEDIA_BUS_FMT_SBGGR14_1X14 0x3019 #define MEDIA_BUS_FMT_SGBRG14_1X14 0x301a #define MEDIA_BUS_FMT_SGRBG14_1X14 0x301b #define MEDIA_BUS_FMT_SRGGB14_1X14 0x301c #define MEDIA_BUS_FMT_SBGGR16_1X16 0x301d #define MEDIA_BUS_FMT_SGBRG16_1X16 0x301e #define MEDIA_BUS_FMT_SGRBG16_1X16 0x301f #define MEDIA_BUS_FMT_SRGGB16_1X16 0x3020 /* JPEG compressed formats - next is 0x4002 */ #define MEDIA_BUS_FMT_JPEG_1X8 0x4001 /* Vendor specific formats - next is 0x5002 */ /* S5C73M3 sensor specific interleaved UYVY and JPEG */ #define MEDIA_BUS_FMT_S5C_UYVY_JPEG_1X8 0x5001 /* HSV - next is 0x6002 */ #define MEDIA_BUS_FMT_AHSV8888_1X32 0x6001 /* * This format should be used when the same driver handles * both sides of the link and the bus format is a fixed * metadata format that is not configurable from userspace. * Width and height will be set to 0 for this format. */ #define MEDIA_BUS_FMT_METADATA_FIXED 0x7001 #endif /* __LINUX_MEDIA_BUS_FORMAT_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/nfs2.h����������������������������������������������������������������������������������������0000644�����������������00000002674�14763166027�0006751 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * NFS protocol definitions * * This file contains constants for Version 2 of the protocol. */ #ifndef _LINUX_NFS2_H #define _LINUX_NFS2_H #define NFS2_PORT 2049 #define NFS2_MAXDATA 8192 #define NFS2_MAXPATHLEN 1024 #define NFS2_MAXNAMLEN 255 #define NFS2_MAXGROUPS 16 #define NFS2_FHSIZE 32 #define NFS2_COOKIESIZE 4 #define NFS2_FIFO_DEV (-1) #define NFS2MODE_FMT 0170000 #define NFS2MODE_DIR 0040000 #define NFS2MODE_CHR 0020000 #define NFS2MODE_BLK 0060000 #define NFS2MODE_REG 0100000 #define NFS2MODE_LNK 0120000 #define NFS2MODE_SOCK 0140000 #define NFS2MODE_FIFO 0010000 /* NFSv2 file types - beware, these are not the same in NFSv3 */ enum nfs2_ftype { NF2NON = 0, NF2REG = 1, NF2DIR = 2, NF2BLK = 3, NF2CHR = 4, NF2LNK = 5, NF2SOCK = 6, NF2BAD = 7, NF2FIFO = 8 }; struct nfs2_fh { char data[NFS2_FHSIZE]; }; /* * Procedure numbers for NFSv2 */ #define NFS2_VERSION 2 #define NFSPROC_NULL 0 #define NFSPROC_GETATTR 1 #define NFSPROC_SETATTR 2 #define NFSPROC_ROOT 3 #define NFSPROC_LOOKUP 4 #define NFSPROC_READLINK 5 #define NFSPROC_READ 6 #define NFSPROC_WRITECACHE 7 #define NFSPROC_WRITE 8 #define NFSPROC_CREATE 9 #define NFSPROC_REMOVE 10 #define NFSPROC_RENAME 11 #define NFSPROC_LINK 12 #define NFSPROC_SYMLINK 13 #define NFSPROC_MKDIR 14 #define NFSPROC_RMDIR 15 #define NFSPROC_READDIR 16 #define NFSPROC_STATFS 17 #endif /* _LINUX_NFS2_H */ ��������������������������������������������������������������������linux/patchkey.h������������������������������������������������������������������������������������0000644�����������������00000001574�14763166027�0007707 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * <linux/patchkey.h> -- definition of _PATCHKEY macro * * Copyright (C) 2005 Stuart Brady * * This exists because awe_voice.h defined its own _PATCHKEY and it wasn't * clear whether removing this would break anything in userspace. * * Do not include this file directly. Please use <sys/soundcard.h> instead. * For kernel code, use <linux/soundcard.h> */ #ifndef _LINUX_PATCHKEY_H_INDIRECT #error "patchkey.h included directly" #endif #ifndef _LINUX_PATCHKEY_H #define _LINUX_PATCHKEY_H /* Endian macros. */ # include <endian.h> #if defined(__BYTE_ORDER) # if __BYTE_ORDER == __BIG_ENDIAN # define _PATCHKEY(id) (0xfd00|id) # elif __BYTE_ORDER == __LITTLE_ENDIAN # define _PATCHKEY(id) ((id<<8)|0x00fd) # else # error "could not determine byte order" # endif #endif #endif /* _LINUX_PATCHKEY_H */ ������������������������������������������������������������������������������������������������������������������������������������linux/target_core_user.h����������������������������������������������������������������������������0000644�����������������00000007473�14763166027�0011437 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __TARGET_CORE_USER_H #define __TARGET_CORE_USER_H /* This header will be used by application too */ #include <linux/types.h> #include <linux/uio.h> #define TCMU_VERSION "2.0" /** * DOC: Ring Design * Ring Design * ----------- * * The mmaped area is divided into three parts: * 1) The mailbox (struct tcmu_mailbox, below); * 2) The command ring; * 3) Everything beyond the command ring (data). * * The mailbox tells userspace the offset of the command ring from the * start of the shared memory region, and how big the command ring is. * * The kernel passes SCSI commands to userspace by putting a struct * tcmu_cmd_entry in the ring, updating mailbox->cmd_head, and poking * userspace via UIO's interrupt mechanism. * * tcmu_cmd_entry contains a header. If the header type is PAD, * userspace should skip hdr->length bytes (mod cmdr_size) to find the * next cmd_entry. * * Otherwise, the entry will contain offsets into the mmaped area that * contain the cdb and data buffers -- the latter accessible via the * iov array. iov addresses are also offsets into the shared area. * * When userspace is completed handling the command, set * entry->rsp.scsi_status, fill in rsp.sense_buffer if appropriate, * and also set mailbox->cmd_tail equal to the old cmd_tail plus * hdr->length, mod cmdr_size. If cmd_tail doesn't equal cmd_head, it * should process the next packet the same way, and so on. */ #define TCMU_MAILBOX_VERSION 2 #define ALIGN_SIZE 64 /* Should be enough for most CPUs */ #define TCMU_MAILBOX_FLAG_CAP_OOOC (1 << 0) /* Out-of-order completions */ #define TCMU_MAILBOX_FLAG_CAP_READ_LEN (1 << 1) /* Read data length */ struct tcmu_mailbox { __u16 version; __u16 flags; __u32 cmdr_off; __u32 cmdr_size; __u32 cmd_head; /* Updated by user. On its own cacheline */ __u32 cmd_tail __attribute__((__aligned__(ALIGN_SIZE))); } __attribute__((packed)); enum tcmu_opcode { TCMU_OP_PAD = 0, TCMU_OP_CMD, }; /* * Only a few opcodes, and length is 8-byte aligned, so use low bits for opcode. */ struct tcmu_cmd_entry_hdr { __u32 len_op; __u16 cmd_id; __u8 kflags; #define TCMU_UFLAG_UNKNOWN_OP 0x1 #define TCMU_UFLAG_READ_LEN 0x2 __u8 uflags; } __attribute__((packed)); #define TCMU_OP_MASK 0x7 static __inline__ enum tcmu_opcode tcmu_hdr_get_op(__u32 len_op) { return len_op & TCMU_OP_MASK; } static __inline__ void tcmu_hdr_set_op(__u32 *len_op, enum tcmu_opcode op) { *len_op &= ~TCMU_OP_MASK; *len_op |= (op & TCMU_OP_MASK); } static __inline__ __u32 tcmu_hdr_get_len(__u32 len_op) { return len_op & ~TCMU_OP_MASK; } static __inline__ void tcmu_hdr_set_len(__u32 *len_op, __u32 len) { *len_op &= TCMU_OP_MASK; *len_op |= len; } /* Currently the same as SCSI_SENSE_BUFFERSIZE */ #define TCMU_SENSE_BUFFERSIZE 96 struct tcmu_cmd_entry { struct tcmu_cmd_entry_hdr hdr; union { struct { __u32 iov_cnt; __u32 iov_bidi_cnt; __u32 iov_dif_cnt; __u64 cdb_off; __u64 __pad1; __u64 __pad2; struct iovec iov[0]; } req; struct { __u8 scsi_status; __u8 __pad1; __u16 __pad2; __u32 read_len; char sense_buffer[TCMU_SENSE_BUFFERSIZE]; } rsp; }; } __attribute__((packed)); #define TCMU_OP_ALIGN_SIZE sizeof(__u64) enum tcmu_genl_cmd { TCMU_CMD_UNSPEC, TCMU_CMD_ADDED_DEVICE, TCMU_CMD_REMOVED_DEVICE, TCMU_CMD_RECONFIG_DEVICE, TCMU_CMD_ADDED_DEVICE_DONE, TCMU_CMD_REMOVED_DEVICE_DONE, TCMU_CMD_RECONFIG_DEVICE_DONE, TCMU_CMD_SET_FEATURES, __TCMU_CMD_MAX, }; #define TCMU_CMD_MAX (__TCMU_CMD_MAX - 1) enum tcmu_genl_attr { TCMU_ATTR_UNSPEC, TCMU_ATTR_DEVICE, TCMU_ATTR_MINOR, TCMU_ATTR_PAD, TCMU_ATTR_DEV_CFG, TCMU_ATTR_DEV_SIZE, TCMU_ATTR_WRITECACHE, TCMU_ATTR_CMD_STATUS, TCMU_ATTR_DEVICE_ID, TCMU_ATTR_SUPP_KERN_CMD_REPLY, __TCMU_ATTR_MAX, }; #define TCMU_ATTR_MAX (__TCMU_ATTR_MAX - 1) #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/lp.h������������������������������������������������������������������������������������������0000644�����������������00000010136�14763166027�0006504 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * usr/include/linux/lp.h c.1991-1992 James Wiegand * many modifications copyright (C) 1992 Michael K. Johnson * Interrupt support added 1993 Nigel Gamble * Removed 8255 status defines from inside __KERNEL__ Marcelo Tosatti */ #ifndef _LINUX_LP_H #define _LINUX_LP_H #include <linux/types.h> #include <linux/ioctl.h> /* * Per POSIX guidelines, this module reserves the LP and lp prefixes * These are the lp_table[minor].flags flags... */ #define LP_EXIST 0x0001 #define LP_SELEC 0x0002 #define LP_BUSY 0x0004 #define LP_BUSY_BIT_POS 2 #define LP_OFFL 0x0008 #define LP_NOPA 0x0010 #define LP_ERR 0x0020 #define LP_ABORT 0x0040 #define LP_CAREFUL 0x0080 /* obsoleted -arca */ #define LP_ABORTOPEN 0x0100 #define LP_TRUST_IRQ_ 0x0200 /* obsolete */ #define LP_NO_REVERSE 0x0400 /* No reverse mode available. */ #define LP_DATA_AVAIL 0x0800 /* Data is available. */ /* * bit defines for 8255 status port * base + 1 * accessed with LP_S(minor), which gets the byte... */ #define LP_PBUSY 0x80 /* inverted input, active high */ #define LP_PACK 0x40 /* unchanged input, active low */ #define LP_POUTPA 0x20 /* unchanged input, active high */ #define LP_PSELECD 0x10 /* unchanged input, active high */ #define LP_PERRORP 0x08 /* unchanged input, active low */ /* timeout for each character. This is relative to bus cycles -- it * is the count in a busy loop. THIS IS THE VALUE TO CHANGE if you * have extremely slow printing, or if the machine seems to slow down * a lot when you print. If you have slow printing, increase this * number and recompile, and if your system gets bogged down, decrease * this number. This can be changed with the tunelp(8) command as well. */ #define LP_INIT_CHAR 1000 /* The parallel port specs apparently say that there needs to be * a .5usec wait before and after the strobe. */ #define LP_INIT_WAIT 1 /* This is the amount of time that the driver waits for the printer to * catch up when the printer's buffer appears to be filled. If you * want to tune this and have a fast printer (i.e. HPIIIP), decrease * this number, and if you have a slow printer, increase this number. * This is in hundredths of a second, the default 2 being .05 second. * Or use the tunelp(8) command, which is especially nice if you want * change back and forth between character and graphics printing, which * are wildly different... */ #define LP_INIT_TIME 2 /* IOCTL numbers */ #define LPCHAR 0x0601 /* corresponds to LP_INIT_CHAR */ #define LPTIME 0x0602 /* corresponds to LP_INIT_TIME */ #define LPABORT 0x0604 /* call with TRUE arg to abort on error, FALSE to retry. Default is retry. */ #define LPSETIRQ 0x0605 /* call with new IRQ number, or 0 for polling (no IRQ) */ #define LPGETIRQ 0x0606 /* get the current IRQ number */ #define LPWAIT 0x0608 /* corresponds to LP_INIT_WAIT */ /* NOTE: LPCAREFUL is obsoleted and it' s always the default right now -arca */ #define LPCAREFUL 0x0609 /* call with TRUE arg to require out-of-paper, off- line, and error indicators good on all writes, FALSE to ignore them. Default is ignore. */ #define LPABORTOPEN 0x060a /* call with TRUE arg to abort open() on error, FALSE to ignore error. Default is ignore. */ #define LPGETSTATUS 0x060b /* return LP_S(minor) */ #define LPRESET 0x060c /* reset printer */ #ifdef LP_STATS #define LPGETSTATS 0x060d /* get statistics (struct lp_stats) */ #endif #define LPGETFLAGS 0x060e /* get status flags */ #define LPSETTIMEOUT_OLD 0x060f /* set parport timeout */ #define LPSETTIMEOUT_NEW \ _IOW(0x6, 0xf, __s64[2]) /* set parport timeout */ #if __BITS_PER_LONG == 64 #define LPSETTIMEOUT LPSETTIMEOUT_OLD #else #define LPSETTIMEOUT (sizeof(time_t) > sizeof(__kernel_long_t) ? \ LPSETTIMEOUT_NEW : LPSETTIMEOUT_OLD) #endif /* timeout for printk'ing a timeout, in jiffies (100ths of a second). This is also used for re-checking error conditions if LP_ABORT is not set. This is the default behavior. */ #define LP_TIMEOUT_INTERRUPT (60 * HZ) #define LP_TIMEOUT_POLLED (10 * HZ) #endif /* _LINUX_LP_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/sched.h���������������������������������������������������������������������������������������0000644�����������������00000004666�14763166027�0007172 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SCHED_H #define _LINUX_SCHED_H /* * cloning flags: */ #define CSIGNAL 0x000000ff /* signal mask to be sent at exit */ #define CLONE_VM 0x00000100 /* set if VM shared between processes */ #define CLONE_FS 0x00000200 /* set if fs info shared between processes */ #define CLONE_FILES 0x00000400 /* set if open files shared between processes */ #define CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */ #define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */ #define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */ #define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */ #define CLONE_THREAD 0x00010000 /* Same thread group? */ #define CLONE_NEWNS 0x00020000 /* New mount namespace group */ #define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */ #define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */ #define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */ #define CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */ #define CLONE_DETACHED 0x00400000 /* Unused, ignored */ #define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */ #define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */ #define CLONE_NEWCGROUP 0x02000000 /* New cgroup namespace */ #define CLONE_NEWUTS 0x04000000 /* New utsname namespace */ #define CLONE_NEWIPC 0x08000000 /* New ipc namespace */ #define CLONE_NEWUSER 0x10000000 /* New user namespace */ #define CLONE_NEWPID 0x20000000 /* New pid namespace */ #define CLONE_NEWNET 0x40000000 /* New network namespace */ #define CLONE_IO 0x80000000 /* Clone io context */ /* * Scheduling policies */ #define SCHED_NORMAL 0 #define SCHED_FIFO 1 #define SCHED_RR 2 #define SCHED_BATCH 3 /* SCHED_ISO: reserved but not implemented yet */ #define SCHED_IDLE 5 #define SCHED_DEADLINE 6 /* Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork */ #define SCHED_RESET_ON_FORK 0x40000000 /* * For the sched_{set,get}attr() calls */ #define SCHED_FLAG_RESET_ON_FORK 0x01 #define SCHED_FLAG_RECLAIM 0x02 #define SCHED_FLAG_DL_OVERRUN 0x04 #define SCHED_FLAG_ALL (SCHED_FLAG_RESET_ON_FORK | \ SCHED_FLAG_RECLAIM | \ SCHED_FLAG_DL_OVERRUN) #endif /* _LINUX_SCHED_H */ ��������������������������������������������������������������������������linux/fdreg.h���������������������������������������������������������������������������������������0000644�����������������00000012454�14763166027�0007165 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_FDREG_H #define _LINUX_FDREG_H /* * This file contains some defines for the floppy disk controller. * Various sources. Mostly "IBM Microcomputers: A Programmers * Handbook", Sanches and Canton. */ #ifdef FDPATCHES #define FD_IOPORT fdc_state[fdc].address #else /* It would be a lot saner just to force fdc_state[fdc].address to always be set ! FIXME */ #define FD_IOPORT 0x3f0 #endif /* Fd controller regs. S&C, about page 340 */ #define FD_STATUS (4 + FD_IOPORT ) #define FD_DATA (5 + FD_IOPORT ) /* Digital Output Register */ #define FD_DOR (2 + FD_IOPORT ) /* Digital Input Register (read) */ #define FD_DIR (7 + FD_IOPORT ) /* Diskette Control Register (write)*/ #define FD_DCR (7 + FD_IOPORT ) /* Bits of main status register */ #define STATUS_BUSYMASK 0x0F /* drive busy mask */ #define STATUS_BUSY 0x10 /* FDC busy */ #define STATUS_DMA 0x20 /* 0- DMA mode */ #define STATUS_DIR 0x40 /* 0- cpu->fdc */ #define STATUS_READY 0x80 /* Data reg ready */ /* Bits of FD_ST0 */ #define ST0_DS 0x03 /* drive select mask */ #define ST0_HA 0x04 /* Head (Address) */ #define ST0_NR 0x08 /* Not Ready */ #define ST0_ECE 0x10 /* Equipment check error */ #define ST0_SE 0x20 /* Seek end */ #define ST0_INTR 0xC0 /* Interrupt code mask */ /* Bits of FD_ST1 */ #define ST1_MAM 0x01 /* Missing Address Mark */ #define ST1_WP 0x02 /* Write Protect */ #define ST1_ND 0x04 /* No Data - unreadable */ #define ST1_OR 0x10 /* OverRun */ #define ST1_CRC 0x20 /* CRC error in data or addr */ #define ST1_EOC 0x80 /* End Of Cylinder */ /* Bits of FD_ST2 */ #define ST2_MAM 0x01 /* Missing Address Mark (again) */ #define ST2_BC 0x02 /* Bad Cylinder */ #define ST2_SNS 0x04 /* Scan Not Satisfied */ #define ST2_SEH 0x08 /* Scan Equal Hit */ #define ST2_WC 0x10 /* Wrong Cylinder */ #define ST2_CRC 0x20 /* CRC error in data field */ #define ST2_CM 0x40 /* Control Mark = deleted */ /* Bits of FD_ST3 */ #define ST3_HA 0x04 /* Head (Address) */ #define ST3_DS 0x08 /* drive is double-sided */ #define ST3_TZ 0x10 /* Track Zero signal (1=track 0) */ #define ST3_RY 0x20 /* drive is ready */ #define ST3_WP 0x40 /* Write Protect */ #define ST3_FT 0x80 /* Drive Fault */ /* Values for FD_COMMAND */ #define FD_RECALIBRATE 0x07 /* move to track 0 */ #define FD_SEEK 0x0F /* seek track */ #define FD_READ 0xE6 /* read with MT, MFM, SKip deleted */ #define FD_WRITE 0xC5 /* write with MT, MFM */ #define FD_SENSEI 0x08 /* Sense Interrupt Status */ #define FD_SPECIFY 0x03 /* specify HUT etc */ #define FD_FORMAT 0x4D /* format one track */ #define FD_VERSION 0x10 /* get version code */ #define FD_CONFIGURE 0x13 /* configure FIFO operation */ #define FD_PERPENDICULAR 0x12 /* perpendicular r/w mode */ #define FD_GETSTATUS 0x04 /* read ST3 */ #define FD_DUMPREGS 0x0E /* dump the contents of the fdc regs */ #define FD_READID 0xEA /* prints the header of a sector */ #define FD_UNLOCK 0x14 /* Fifo config unlock */ #define FD_LOCK 0x94 /* Fifo config lock */ #define FD_RSEEK_OUT 0x8f /* seek out (i.e. to lower tracks) */ #define FD_RSEEK_IN 0xcf /* seek in (i.e. to higher tracks) */ /* the following commands are new in the 82078. They are not used in the * floppy driver, except the first three. These commands may be useful for apps * which use the FDRAWCMD interface. For doc, get the 82078 spec sheets at * http://www.intel.com/design/archives/periphrl/docs/29046803.htm */ #define FD_PARTID 0x18 /* part id ("extended" version cmd) */ #define FD_SAVE 0x2e /* save fdc regs for later restore */ #define FD_DRIVESPEC 0x8e /* drive specification: Access to the * 2 Mbps data transfer rate for tape * drives */ #define FD_RESTORE 0x4e /* later restore */ #define FD_POWERDOWN 0x27 /* configure FDC's powersave features */ #define FD_FORMAT_N_WRITE 0xef /* format and write in one go. */ #define FD_OPTION 0x33 /* ISO format (which is a clean way to * pack more sectors on a track) */ /* DMA commands */ #define DMA_READ 0x46 #define DMA_WRITE 0x4A /* FDC version return types */ #define FDC_NONE 0x00 #define FDC_UNKNOWN 0x10 /* DO NOT USE THIS TYPE EXCEPT IF IDENTIFICATION FAILS EARLY */ #define FDC_8272A 0x20 /* Intel 8272a, NEC 765 */ #define FDC_765ED 0x30 /* Non-Intel 1MB-compatible FDC, can't detect */ #define FDC_82072 0x40 /* Intel 82072; 8272a + FIFO + DUMPREGS */ #define FDC_82072A 0x45 /* 82072A (on Sparcs) */ #define FDC_82077_ORIG 0x51 /* Original version of 82077AA, sans LOCK */ #define FDC_82077 0x52 /* 82077AA-1 */ #define FDC_82078_UNKN 0x5f /* Unknown 82078 variant */ #define FDC_82078 0x60 /* 44pin 82078 or 64pin 82078SL */ #define FDC_82078_1 0x61 /* 82078-1 (2Mbps fdc) */ #define FDC_S82078B 0x62 /* S82078B (first seen on Adaptec AVA-2825 VLB * SCSI/EIDE/Floppy controller) */ #define FDC_87306 0x63 /* National Semiconductor PC 87306 */ /* * Beware: the fdc type list is roughly sorted by increasing features. * Presence of features is tested by comparing the FDC version id with the * "oldest" version that has the needed feature. * If during FDC detection, an obscure test fails late in the sequence, don't * assign FDC_UNKNOWN. Else the FDC will be treated as a dumb 8272a, or worse. * This is especially true if the tests are unneeded. */ #define FD_RESET_DELAY 20 #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/mmtimer.h�������������������������������������������������������������������������������������0000644�����������������00000004105�14763166027�0007542 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Intel Multimedia Timer device interface * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (c) 2001-2004 Silicon Graphics, Inc. All rights reserved. * * This file should define an interface compatible with the IA-PC Multimedia * Timers Draft Specification (rev. 0.97) from Intel. Note that some * hardware may not be able to safely export its registers to userspace, * so the ioctl interface should support all necessary functionality. * * 11/01/01 - jbarnes - initial revision * 9/10/04 - Christoph Lameter - remove interrupt support * 9/17/04 - jbarnes - remove test program, move some #defines to the driver */ #ifndef _LINUX_MMTIMER_H #define _LINUX_MMTIMER_H /* * Breakdown of the ioctl's available. An 'optional' next to the command * indicates that supporting this command is optional, while 'required' * commands must be implemented if conformance is desired. * * MMTIMER_GETOFFSET - optional * Should return the offset (relative to the start of the page where the * registers are mapped) for the counter in question. * * MMTIMER_GETRES - required * The resolution of the clock in femto (10^-15) seconds * * MMTIMER_GETFREQ - required * Frequency of the clock in Hz * * MMTIMER_GETBITS - required * Number of bits in the clock's counter * * MMTIMER_MMAPAVAIL - required * Returns nonzero if the registers can be mmap'd into userspace, 0 otherwise * * MMTIMER_GETCOUNTER - required * Gets the current value in the counter */ #define MMTIMER_IOCTL_BASE 'm' #define MMTIMER_GETOFFSET _IO(MMTIMER_IOCTL_BASE, 0) #define MMTIMER_GETRES _IOR(MMTIMER_IOCTL_BASE, 1, unsigned long) #define MMTIMER_GETFREQ _IOR(MMTIMER_IOCTL_BASE, 2, unsigned long) #define MMTIMER_GETBITS _IO(MMTIMER_IOCTL_BASE, 4) #define MMTIMER_MMAPAVAIL _IO(MMTIMER_IOCTL_BASE, 6) #define MMTIMER_GETCOUNTER _IOR(MMTIMER_IOCTL_BASE, 9, unsigned long) #endif /* _LINUX_MMTIMER_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/serial.h��������������������������������������������������������������������������������������0000644�����������������00000006535�14763166027�0007360 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* * include/linux/serial.h * * Copyright (C) 1992 by Theodore Ts'o. * * Redistribution of this file is permitted under the terms of the GNU * Public License (GPL) */ #ifndef _LINUX_SERIAL_H #define _LINUX_SERIAL_H #include <linux/types.h> #include <linux/tty_flags.h> struct serial_struct { int type; int line; unsigned int port; int irq; int flags; int xmit_fifo_size; int custom_divisor; int baud_base; unsigned short close_delay; char io_type; char reserved_char[1]; int hub6; unsigned short closing_wait; /* time to wait before closing */ unsigned short closing_wait2; /* no longer used... */ unsigned char *iomem_base; unsigned short iomem_reg_shift; unsigned int port_high; unsigned long iomap_base; /* cookie passed into ioremap */ }; /* * For the close wait times, 0 means wait forever for serial port to * flush its output. 65535 means don't wait at all. */ #define ASYNC_CLOSING_WAIT_INF 0 #define ASYNC_CLOSING_WAIT_NONE 65535 /* * These are the supported serial types. */ #define PORT_UNKNOWN 0 #define PORT_8250 1 #define PORT_16450 2 #define PORT_16550 3 #define PORT_16550A 4 #define PORT_CIRRUS 5 /* usurped by cyclades.c */ #define PORT_16650 6 #define PORT_16650V2 7 #define PORT_16750 8 #define PORT_STARTECH 9 /* usurped by cyclades.c */ #define PORT_16C950 10 /* Oxford Semiconductor */ #define PORT_16654 11 #define PORT_16850 12 #define PORT_RSA 13 /* RSA-DV II/S card */ #define PORT_MAX 13 #define SERIAL_IO_PORT 0 #define SERIAL_IO_HUB6 1 #define SERIAL_IO_MEM 2 #define SERIAL_IO_MEM32 3 #define SERIAL_IO_AU 4 #define SERIAL_IO_TSI 5 #define SERIAL_IO_MEM32BE 6 #define SERIAL_IO_MEM16 7 #define UART_CLEAR_FIFO 0x01 #define UART_USE_FIFO 0x02 #define UART_STARTECH 0x04 #define UART_NATSEMI 0x08 /* * Multiport serial configuration structure --- external structure */ struct serial_multiport_struct { int irq; int port1; unsigned char mask1, match1; int port2; unsigned char mask2, match2; int port3; unsigned char mask3, match3; int port4; unsigned char mask4, match4; int port_monitor; int reserved[32]; }; /* * Serial input interrupt line counters -- external structure * Four lines can interrupt: CTS, DSR, RI, DCD */ struct serial_icounter_struct { int cts, dsr, rng, dcd; int rx, tx; int frame, overrun, parity, brk; int buf_overrun; int reserved[9]; }; /* * Serial interface for controlling RS485 settings on chips with suitable * support. Set with TIOCSRS485 and get with TIOCGRS485 if supported by your * platform. The set function returns the new state, with any unsupported bits * reverted appropriately. */ struct serial_rs485 { __u32 flags; /* RS485 feature flags */ #define SER_RS485_ENABLED (1 << 0) /* If enabled */ #define SER_RS485_RTS_ON_SEND (1 << 1) /* Logical level for RTS pin when sending */ #define SER_RS485_RTS_AFTER_SEND (1 << 2) /* Logical level for RTS pin after sent*/ #define SER_RS485_RX_DURING_TX (1 << 4) #define SER_RS485_TERMINATE_BUS (1 << 5) /* Enable bus termination (if supported) */ __u32 delay_rts_before_send; /* Delay before send (milliseconds) */ __u32 delay_rts_after_send; /* Delay after send (milliseconds) */ __u32 padding[5]; /* Memory is cheap, new structs are a royal PITA .. */ }; #endif /* _LINUX_SERIAL_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_vlan.h�������������������������������������������������������������������������������������0000644�����������������00000003401�14763166027�0007504 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * VLAN An implementation of 802.1Q VLAN tagging. * * Authors: Ben Greear <greearb@candelatech.com> * * 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. * */ #ifndef _LINUX_IF_VLAN_H_ #define _LINUX_IF_VLAN_H_ /* VLAN IOCTLs are found in sockios.h */ /* Passed in vlan_ioctl_args structure to determine behaviour. */ enum vlan_ioctl_cmds { ADD_VLAN_CMD, DEL_VLAN_CMD, SET_VLAN_INGRESS_PRIORITY_CMD, SET_VLAN_EGRESS_PRIORITY_CMD, GET_VLAN_INGRESS_PRIORITY_CMD, GET_VLAN_EGRESS_PRIORITY_CMD, SET_VLAN_NAME_TYPE_CMD, SET_VLAN_FLAG_CMD, GET_VLAN_REALDEV_NAME_CMD, /* If this works, you know it's a VLAN device, btw */ GET_VLAN_VID_CMD /* Get the VID of this VLAN (specified by name) */ }; enum vlan_flags { VLAN_FLAG_REORDER_HDR = 0x1, VLAN_FLAG_GVRP = 0x2, VLAN_FLAG_LOOSE_BINDING = 0x4, VLAN_FLAG_MVRP = 0x8, }; enum vlan_name_types { VLAN_NAME_TYPE_PLUS_VID, /* Name will look like: vlan0005 */ VLAN_NAME_TYPE_RAW_PLUS_VID, /* name will look like: eth1.0005 */ VLAN_NAME_TYPE_PLUS_VID_NO_PAD, /* Name will look like: vlan5 */ VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD, /* Name will look like: eth0.5 */ VLAN_NAME_TYPE_HIGHEST }; struct vlan_ioctl_args { int cmd; /* Should be one of the vlan_ioctl_cmds enum above. */ char device1[24]; union { char device2[24]; int VID; unsigned int skb_priority; unsigned int name_type; unsigned int bind_type; unsigned int flag; /* Matches vlan_dev_priv flags */ } u; short vlan_qos; }; #endif /* _LINUX_IF_VLAN_H_ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/v4l2-common.h���������������������������������������������������������������������������������0000644�����������������00000010121�14763166027�0010140 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * include/linux/v4l2-common.h * * Common V4L2 and V4L2 subdev definitions. * * Users are advised to #include this file either through videodev2.h * (V4L2) or through v4l2-subdev.h (V4L2 subdev) rather than to refer * to this file directly. * * Copyright (C) 2012 Nokia Corporation * Contact: Sakari Ailus <sakari.ailus@iki.fi> * * 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. * * Alternatively you can redistribute this file under the terms of the * BSD license as stated below: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of its contributors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef __V4L2_COMMON__ #define __V4L2_COMMON__ #include <linux/types.h> /* * * Selection interface definitions * */ /* Current cropping area */ #define V4L2_SEL_TGT_CROP 0x0000 /* Default cropping area */ #define V4L2_SEL_TGT_CROP_DEFAULT 0x0001 /* Cropping bounds */ #define V4L2_SEL_TGT_CROP_BOUNDS 0x0002 /* Native frame size */ #define V4L2_SEL_TGT_NATIVE_SIZE 0x0003 /* Current composing area */ #define V4L2_SEL_TGT_COMPOSE 0x0100 /* Default composing area */ #define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101 /* Composing bounds */ #define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102 /* Current composing area plus all padding pixels */ #define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103 /* Backward compatibility target definitions --- to be removed. */ #define V4L2_SEL_TGT_CROP_ACTIVE V4L2_SEL_TGT_CROP #define V4L2_SEL_TGT_COMPOSE_ACTIVE V4L2_SEL_TGT_COMPOSE #define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL V4L2_SEL_TGT_CROP #define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL V4L2_SEL_TGT_COMPOSE #define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS V4L2_SEL_TGT_CROP_BOUNDS #define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS V4L2_SEL_TGT_COMPOSE_BOUNDS /* Selection flags */ #define V4L2_SEL_FLAG_GE (1 << 0) #define V4L2_SEL_FLAG_LE (1 << 1) #define V4L2_SEL_FLAG_KEEP_CONFIG (1 << 2) /* Backward compatibility flag definitions --- to be removed. */ #define V4L2_SUBDEV_SEL_FLAG_SIZE_GE V4L2_SEL_FLAG_GE #define V4L2_SUBDEV_SEL_FLAG_SIZE_LE V4L2_SEL_FLAG_LE #define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG V4L2_SEL_FLAG_KEEP_CONFIG struct v4l2_edid { __u32 pad; __u32 start_block; __u32 blocks; __u32 reserved[5]; __u8 *edid; }; #endif /* __V4L2_COMMON__ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/uleds.h���������������������������������������������������������������������������������������0000644�����������������00000001436�14763166027�0007210 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Userspace driver support for the LED subsystem * * 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. */ #ifndef __ULEDS_H_ #define __ULEDS_H_ #define LED_MAX_NAME_SIZE 64 struct uleds_user_dev { char name[LED_MAX_NAME_SIZE]; int max_brightness; }; #endif /* __ULEDS_H_ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/ndctl.h���������������������������������������������������������������������������������������0000644�����������������00000015241�14763166027�0007177 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014-2016, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU Lesser General Public License, * version 2.1, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. */ #ifndef __NDCTL_H__ #define __NDCTL_H__ #include <linux/types.h> struct nd_cmd_dimm_flags { __u32 status; __u32 flags; } __attribute__((packed)); struct nd_cmd_get_config_size { __u32 status; __u32 config_size; __u32 max_xfer; } __attribute__((packed)); struct nd_cmd_get_config_data_hdr { __u32 in_offset; __u32 in_length; __u32 status; __u8 out_buf[0]; } __attribute__((packed)); struct nd_cmd_set_config_hdr { __u32 in_offset; __u32 in_length; __u8 in_buf[0]; } __attribute__((packed)); struct nd_cmd_vendor_hdr { __u32 opcode; __u32 in_length; __u8 in_buf[0]; } __attribute__((packed)); struct nd_cmd_vendor_tail { __u32 status; __u32 out_length; __u8 out_buf[0]; } __attribute__((packed)); struct nd_cmd_ars_cap { __u64 address; __u64 length; __u32 status; __u32 max_ars_out; __u32 clear_err_unit; __u16 flags; __u16 reserved; } __attribute__((packed)); struct nd_cmd_ars_start { __u64 address; __u64 length; __u16 type; __u8 flags; __u8 reserved[5]; __u32 status; __u32 scrub_time; } __attribute__((packed)); struct nd_cmd_ars_status { __u32 status; __u32 out_length; __u64 address; __u64 length; __u64 restart_address; __u64 restart_length; __u16 type; __u16 flags; __u32 num_records; struct nd_ars_record { __u32 handle; __u32 reserved; __u64 err_address; __u64 length; } __attribute__((packed)) records[0]; } __attribute__((packed)); struct nd_cmd_clear_error { __u64 address; __u64 length; __u32 status; __u8 reserved[4]; __u64 cleared; } __attribute__((packed)); enum { ND_CMD_IMPLEMENTED = 0, /* bus commands */ ND_CMD_ARS_CAP = 1, ND_CMD_ARS_START = 2, ND_CMD_ARS_STATUS = 3, ND_CMD_CLEAR_ERROR = 4, /* per-dimm commands */ ND_CMD_SMART = 1, ND_CMD_SMART_THRESHOLD = 2, ND_CMD_DIMM_FLAGS = 3, ND_CMD_GET_CONFIG_SIZE = 4, ND_CMD_GET_CONFIG_DATA = 5, ND_CMD_SET_CONFIG_DATA = 6, ND_CMD_VENDOR_EFFECT_LOG_SIZE = 7, ND_CMD_VENDOR_EFFECT_LOG = 8, ND_CMD_VENDOR = 9, ND_CMD_CALL = 10, }; enum { ND_ARS_VOLATILE = 1, ND_ARS_PERSISTENT = 2, ND_ARS_RETURN_PREV_DATA = 1 << 1, ND_CONFIG_LOCKED = 1, }; static __inline__ const char *nvdimm_bus_cmd_name(unsigned cmd) { switch (cmd) { case ND_CMD_ARS_CAP: return "ars_cap"; case ND_CMD_ARS_START: return "ars_start"; case ND_CMD_ARS_STATUS: return "ars_status"; case ND_CMD_CLEAR_ERROR: return "clear_error"; case ND_CMD_CALL: return "cmd_call"; default: return "unknown"; } } static __inline__ const char *nvdimm_cmd_name(unsigned cmd) { switch (cmd) { case ND_CMD_SMART: return "smart"; case ND_CMD_SMART_THRESHOLD: return "smart_thresh"; case ND_CMD_DIMM_FLAGS: return "flags"; case ND_CMD_GET_CONFIG_SIZE: return "get_size"; case ND_CMD_GET_CONFIG_DATA: return "get_data"; case ND_CMD_SET_CONFIG_DATA: return "set_data"; case ND_CMD_VENDOR_EFFECT_LOG_SIZE: return "effect_size"; case ND_CMD_VENDOR_EFFECT_LOG: return "effect_log"; case ND_CMD_VENDOR: return "vendor"; case ND_CMD_CALL: return "cmd_call"; default: return "unknown"; } } #define ND_IOCTL 'N' #define ND_IOCTL_DIMM_FLAGS _IOWR(ND_IOCTL, ND_CMD_DIMM_FLAGS,\ struct nd_cmd_dimm_flags) #define ND_IOCTL_GET_CONFIG_SIZE _IOWR(ND_IOCTL, ND_CMD_GET_CONFIG_SIZE,\ struct nd_cmd_get_config_size) #define ND_IOCTL_GET_CONFIG_DATA _IOWR(ND_IOCTL, ND_CMD_GET_CONFIG_DATA,\ struct nd_cmd_get_config_data_hdr) #define ND_IOCTL_SET_CONFIG_DATA _IOWR(ND_IOCTL, ND_CMD_SET_CONFIG_DATA,\ struct nd_cmd_set_config_hdr) #define ND_IOCTL_VENDOR _IOWR(ND_IOCTL, ND_CMD_VENDOR,\ struct nd_cmd_vendor_hdr) #define ND_IOCTL_ARS_CAP _IOWR(ND_IOCTL, ND_CMD_ARS_CAP,\ struct nd_cmd_ars_cap) #define ND_IOCTL_ARS_START _IOWR(ND_IOCTL, ND_CMD_ARS_START,\ struct nd_cmd_ars_start) #define ND_IOCTL_ARS_STATUS _IOWR(ND_IOCTL, ND_CMD_ARS_STATUS,\ struct nd_cmd_ars_status) #define ND_IOCTL_CLEAR_ERROR _IOWR(ND_IOCTL, ND_CMD_CLEAR_ERROR,\ struct nd_cmd_clear_error) #define ND_DEVICE_DIMM 1 /* nd_dimm: container for "config data" */ #define ND_DEVICE_REGION_PMEM 2 /* nd_region: (parent of PMEM namespaces) */ #define ND_DEVICE_REGION_BLK 3 /* nd_region: (parent of BLK namespaces) */ #define ND_DEVICE_NAMESPACE_IO 4 /* legacy persistent memory */ #define ND_DEVICE_NAMESPACE_PMEM 5 /* PMEM namespace (may alias with BLK) */ #define ND_DEVICE_NAMESPACE_BLK 6 /* BLK namespace (may alias with PMEM) */ #define ND_DEVICE_DAX_PMEM 7 /* Device DAX interface to pmem */ enum nd_driver_flags { ND_DRIVER_DIMM = 1 << ND_DEVICE_DIMM, ND_DRIVER_REGION_PMEM = 1 << ND_DEVICE_REGION_PMEM, ND_DRIVER_REGION_BLK = 1 << ND_DEVICE_REGION_BLK, ND_DRIVER_NAMESPACE_IO = 1 << ND_DEVICE_NAMESPACE_IO, ND_DRIVER_NAMESPACE_PMEM = 1 << ND_DEVICE_NAMESPACE_PMEM, ND_DRIVER_NAMESPACE_BLK = 1 << ND_DEVICE_NAMESPACE_BLK, ND_DRIVER_DAX_PMEM = 1 << ND_DEVICE_DAX_PMEM, }; enum { ND_MIN_NAMESPACE_SIZE = PAGE_SIZE, }; enum ars_masks { ARS_STATUS_MASK = 0x0000FFFF, ARS_EXT_STATUS_SHIFT = 16, }; /* * struct nd_cmd_pkg * * is a wrapper to a quasi pass thru interface for invoking firmware * associated with nvdimms. * * INPUT PARAMETERS * * nd_family corresponds to the firmware (e.g. DSM) interface. * * nd_command are the function index advertised by the firmware. * * nd_size_in is the size of the input parameters being passed to firmware * * OUTPUT PARAMETERS * * nd_fw_size is the size of the data firmware wants to return for * the call. If nd_fw_size is greater than size of nd_size_out, only * the first nd_size_out bytes are returned. */ struct nd_cmd_pkg { __u64 nd_family; /* family of commands */ __u64 nd_command; __u32 nd_size_in; /* INPUT: size of input args */ __u32 nd_size_out; /* INPUT: size of payload */ __u32 nd_reserved2[9]; /* reserved must be zero */ __u32 nd_fw_size; /* OUTPUT: size fw wants to return */ unsigned char nd_payload[]; /* Contents of call */ }; /* These NVDIMM families represent pre-standardization command sets */ #define NVDIMM_FAMILY_INTEL 0 #define NVDIMM_FAMILY_HPE1 1 #define NVDIMM_FAMILY_HPE2 2 #define NVDIMM_FAMILY_MSFT 3 #define NVDIMM_FAMILY_HYPERV 4 #define ND_IOCTL_CALL _IOWR(ND_IOCTL, ND_CMD_CALL,\ struct nd_cmd_pkg) #endif /* __NDCTL_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/connector.h�����������������������������������������������������������������������������������0000644�����������������00000004315�14763166027�0010065 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * connector.h * * 2004-2005 Copyright (c) Evgeniy Polyakov <zbr@ioremap.net> * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __CONNECTOR_H #define __CONNECTOR_H #include <linux/types.h> /* * Process Events connector unique ids -- used for message routing */ #define CN_IDX_PROC 0x1 #define CN_VAL_PROC 0x1 #define CN_IDX_CIFS 0x2 #define CN_VAL_CIFS 0x1 #define CN_W1_IDX 0x3 /* w1 communication */ #define CN_W1_VAL 0x1 #define CN_IDX_V86D 0x4 #define CN_VAL_V86D_UVESAFB 0x1 #define CN_IDX_BB 0x5 /* BlackBoard, from the TSP GPL sampling framework */ #define CN_DST_IDX 0x6 #define CN_DST_VAL 0x1 #define CN_IDX_DM 0x7 /* Device Mapper */ #define CN_VAL_DM_USERSPACE_LOG 0x1 #define CN_IDX_DRBD 0x8 #define CN_VAL_DRBD 0x1 #define CN_KVP_IDX 0x9 /* HyperV KVP */ #define CN_KVP_VAL 0x1 /* queries from the kernel */ #define CN_VSS_IDX 0xA /* HyperV VSS */ #define CN_VSS_VAL 0x1 /* queries from the kernel */ #define CN_NETLINK_USERS 11 /* Highest index + 1 */ /* * Maximum connector's message size. */ #define CONNECTOR_MAX_MSG_SIZE 16384 /* * idx and val are unique identifiers which * are used for message routing and * must be registered in connector.h for in-kernel usage. */ struct cb_id { __u32 idx; __u32 val; }; struct cn_msg { struct cb_id id; __u32 seq; __u32 ack; __u16 len; /* Length of the following data */ __u16 flags; __u8 data[0]; }; #endif /* __CONNECTOR_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/kernelcapi.h����������������������������������������������������������������������������������0000644�����������������00000001773�14763166027�0010215 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * $Id: kernelcapi.h,v 1.8.6.2 2001/02/07 11:31:31 kai Exp $ * * Kernel CAPI 2.0 Interface for Linux * * (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de) * */ #ifndef __KERNELCAPI_H__ #define __KERNELCAPI_H__ #define CAPI_MAXAPPL 240 /* maximum number of applications */ #define CAPI_MAXCONTR 32 /* maximum number of controller */ #define CAPI_MAXDATAWINDOW 8 typedef struct kcapi_flagdef { int contr; int flag; } kcapi_flagdef; typedef struct kcapi_carddef { char driver[32]; unsigned int port; unsigned irq; unsigned int membase; int cardnr; } kcapi_carddef; /* new ioctls >= 10 */ #define KCAPI_CMD_TRACE 10 #define KCAPI_CMD_ADDCARD 11 /* OBSOLETE */ /* * flag > 2 => trace also data * flag & 1 => show trace */ #define KCAPI_TRACE_OFF 0 #define KCAPI_TRACE_SHORT_NO_DATA 1 #define KCAPI_TRACE_FULL_NO_DATA 2 #define KCAPI_TRACE_SHORT 3 #define KCAPI_TRACE_FULL 4 #endif /* __KERNELCAPI_H__ */ �����linux/pfkeyv2.h�������������������������������������������������������������������������������������0000644�����������������00000024511�14763166027�0007461 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* PF_KEY user interface, this is defined by rfc2367 so * do not make arbitrary modifications or else this header * file will not be compliant. */ #ifndef _LINUX_PFKEY2_H #define _LINUX_PFKEY2_H #include <linux/types.h> #define PF_KEY_V2 2 #define PFKEYV2_REVISION 199806L struct sadb_msg { __u8 sadb_msg_version; __u8 sadb_msg_type; __u8 sadb_msg_errno; __u8 sadb_msg_satype; __u16 sadb_msg_len; __u16 sadb_msg_reserved; __u32 sadb_msg_seq; __u32 sadb_msg_pid; } __attribute__((packed)); /* sizeof(struct sadb_msg) == 16 */ struct sadb_ext { __u16 sadb_ext_len; __u16 sadb_ext_type; } __attribute__((packed)); /* sizeof(struct sadb_ext) == 4 */ struct sadb_sa { __u16 sadb_sa_len; __u16 sadb_sa_exttype; __be32 sadb_sa_spi; __u8 sadb_sa_replay; __u8 sadb_sa_state; __u8 sadb_sa_auth; __u8 sadb_sa_encrypt; __u32 sadb_sa_flags; } __attribute__((packed)); /* sizeof(struct sadb_sa) == 16 */ struct sadb_lifetime { __u16 sadb_lifetime_len; __u16 sadb_lifetime_exttype; __u32 sadb_lifetime_allocations; __u64 sadb_lifetime_bytes; __u64 sadb_lifetime_addtime; __u64 sadb_lifetime_usetime; } __attribute__((packed)); /* sizeof(struct sadb_lifetime) == 32 */ struct sadb_address { __u16 sadb_address_len; __u16 sadb_address_exttype; __u8 sadb_address_proto; __u8 sadb_address_prefixlen; __u16 sadb_address_reserved; } __attribute__((packed)); /* sizeof(struct sadb_address) == 8 */ struct sadb_key { __u16 sadb_key_len; __u16 sadb_key_exttype; __u16 sadb_key_bits; __u16 sadb_key_reserved; } __attribute__((packed)); /* sizeof(struct sadb_key) == 8 */ struct sadb_ident { __u16 sadb_ident_len; __u16 sadb_ident_exttype; __u16 sadb_ident_type; __u16 sadb_ident_reserved; __u64 sadb_ident_id; } __attribute__((packed)); /* sizeof(struct sadb_ident) == 16 */ struct sadb_sens { __u16 sadb_sens_len; __u16 sadb_sens_exttype; __u32 sadb_sens_dpd; __u8 sadb_sens_sens_level; __u8 sadb_sens_sens_len; __u8 sadb_sens_integ_level; __u8 sadb_sens_integ_len; __u32 sadb_sens_reserved; } __attribute__((packed)); /* sizeof(struct sadb_sens) == 16 */ /* followed by: __u64 sadb_sens_bitmap[sens_len]; __u64 sadb_integ_bitmap[integ_len]; */ struct sadb_prop { __u16 sadb_prop_len; __u16 sadb_prop_exttype; __u8 sadb_prop_replay; __u8 sadb_prop_reserved[3]; } __attribute__((packed)); /* sizeof(struct sadb_prop) == 8 */ /* followed by: struct sadb_comb sadb_combs[(sadb_prop_len + sizeof(__u64) - sizeof(struct sadb_prop)) / sizeof(struct sadb_comb)]; */ struct sadb_comb { __u8 sadb_comb_auth; __u8 sadb_comb_encrypt; __u16 sadb_comb_flags; __u16 sadb_comb_auth_minbits; __u16 sadb_comb_auth_maxbits; __u16 sadb_comb_encrypt_minbits; __u16 sadb_comb_encrypt_maxbits; __u32 sadb_comb_reserved; __u32 sadb_comb_soft_allocations; __u32 sadb_comb_hard_allocations; __u64 sadb_comb_soft_bytes; __u64 sadb_comb_hard_bytes; __u64 sadb_comb_soft_addtime; __u64 sadb_comb_hard_addtime; __u64 sadb_comb_soft_usetime; __u64 sadb_comb_hard_usetime; } __attribute__((packed)); /* sizeof(struct sadb_comb) == 72 */ struct sadb_supported { __u16 sadb_supported_len; __u16 sadb_supported_exttype; __u32 sadb_supported_reserved; } __attribute__((packed)); /* sizeof(struct sadb_supported) == 8 */ /* followed by: struct sadb_alg sadb_algs[(sadb_supported_len + sizeof(__u64) - sizeof(struct sadb_supported)) / sizeof(struct sadb_alg)]; */ struct sadb_alg { __u8 sadb_alg_id; __u8 sadb_alg_ivlen; __u16 sadb_alg_minbits; __u16 sadb_alg_maxbits; __u16 sadb_alg_reserved; } __attribute__((packed)); /* sizeof(struct sadb_alg) == 8 */ struct sadb_spirange { __u16 sadb_spirange_len; __u16 sadb_spirange_exttype; __u32 sadb_spirange_min; __u32 sadb_spirange_max; __u32 sadb_spirange_reserved; } __attribute__((packed)); /* sizeof(struct sadb_spirange) == 16 */ struct sadb_x_kmprivate { __u16 sadb_x_kmprivate_len; __u16 sadb_x_kmprivate_exttype; __u32 sadb_x_kmprivate_reserved; } __attribute__((packed)); /* sizeof(struct sadb_x_kmprivate) == 8 */ struct sadb_x_sa2 { __u16 sadb_x_sa2_len; __u16 sadb_x_sa2_exttype; __u8 sadb_x_sa2_mode; __u8 sadb_x_sa2_reserved1; __u16 sadb_x_sa2_reserved2; __u32 sadb_x_sa2_sequence; __u32 sadb_x_sa2_reqid; } __attribute__((packed)); /* sizeof(struct sadb_x_sa2) == 16 */ struct sadb_x_policy { __u16 sadb_x_policy_len; __u16 sadb_x_policy_exttype; __u16 sadb_x_policy_type; __u8 sadb_x_policy_dir; __u8 sadb_x_policy_reserved; __u32 sadb_x_policy_id; __u32 sadb_x_policy_priority; } __attribute__((packed)); /* sizeof(struct sadb_x_policy) == 16 */ struct sadb_x_ipsecrequest { __u16 sadb_x_ipsecrequest_len; __u16 sadb_x_ipsecrequest_proto; __u8 sadb_x_ipsecrequest_mode; __u8 sadb_x_ipsecrequest_level; __u16 sadb_x_ipsecrequest_reserved1; __u32 sadb_x_ipsecrequest_reqid; __u32 sadb_x_ipsecrequest_reserved2; } __attribute__((packed)); /* sizeof(struct sadb_x_ipsecrequest) == 16 */ /* This defines the TYPE of Nat Traversal in use. Currently only one * type of NAT-T is supported, draft-ietf-ipsec-udp-encaps-06 */ struct sadb_x_nat_t_type { __u16 sadb_x_nat_t_type_len; __u16 sadb_x_nat_t_type_exttype; __u8 sadb_x_nat_t_type_type; __u8 sadb_x_nat_t_type_reserved[3]; } __attribute__((packed)); /* sizeof(struct sadb_x_nat_t_type) == 8 */ /* Pass a NAT Traversal port (Source or Dest port) */ struct sadb_x_nat_t_port { __u16 sadb_x_nat_t_port_len; __u16 sadb_x_nat_t_port_exttype; __be16 sadb_x_nat_t_port_port; __u16 sadb_x_nat_t_port_reserved; } __attribute__((packed)); /* sizeof(struct sadb_x_nat_t_port) == 8 */ /* Generic LSM security context */ struct sadb_x_sec_ctx { __u16 sadb_x_sec_len; __u16 sadb_x_sec_exttype; __u8 sadb_x_ctx_alg; /* LSMs: e.g., selinux == 1 */ __u8 sadb_x_ctx_doi; __u16 sadb_x_ctx_len; } __attribute__((packed)); /* sizeof(struct sadb_sec_ctx) = 8 */ /* Used by MIGRATE to pass addresses IKE will use to perform * negotiation with the peer */ struct sadb_x_kmaddress { __u16 sadb_x_kmaddress_len; __u16 sadb_x_kmaddress_exttype; __u32 sadb_x_kmaddress_reserved; } __attribute__((packed)); /* sizeof(struct sadb_x_kmaddress) == 8 */ /* To specify the SA dump filter */ struct sadb_x_filter { __u16 sadb_x_filter_len; __u16 sadb_x_filter_exttype; __u32 sadb_x_filter_saddr[4]; __u32 sadb_x_filter_daddr[4]; __u16 sadb_x_filter_family; __u8 sadb_x_filter_splen; __u8 sadb_x_filter_dplen; } __attribute__((packed)); /* sizeof(struct sadb_x_filter) == 40 */ /* Message types */ #define SADB_RESERVED 0 #define SADB_GETSPI 1 #define SADB_UPDATE 2 #define SADB_ADD 3 #define SADB_DELETE 4 #define SADB_GET 5 #define SADB_ACQUIRE 6 #define SADB_REGISTER 7 #define SADB_EXPIRE 8 #define SADB_FLUSH 9 #define SADB_DUMP 10 #define SADB_X_PROMISC 11 #define SADB_X_PCHANGE 12 #define SADB_X_SPDUPDATE 13 #define SADB_X_SPDADD 14 #define SADB_X_SPDDELETE 15 #define SADB_X_SPDGET 16 #define SADB_X_SPDACQUIRE 17 #define SADB_X_SPDDUMP 18 #define SADB_X_SPDFLUSH 19 #define SADB_X_SPDSETIDX 20 #define SADB_X_SPDEXPIRE 21 #define SADB_X_SPDDELETE2 22 #define SADB_X_NAT_T_NEW_MAPPING 23 #define SADB_X_MIGRATE 24 #define SADB_MAX 24 /* Security Association flags */ #define SADB_SAFLAGS_PFS 1 #define SADB_SAFLAGS_NOPMTUDISC 0x20000000 #define SADB_SAFLAGS_DECAP_DSCP 0x40000000 #define SADB_SAFLAGS_NOECN 0x80000000 /* Security Association states */ #define SADB_SASTATE_LARVAL 0 #define SADB_SASTATE_MATURE 1 #define SADB_SASTATE_DYING 2 #define SADB_SASTATE_DEAD 3 #define SADB_SASTATE_MAX 3 /* Security Association types */ #define SADB_SATYPE_UNSPEC 0 #define SADB_SATYPE_AH 2 #define SADB_SATYPE_ESP 3 #define SADB_SATYPE_RSVP 5 #define SADB_SATYPE_OSPFV2 6 #define SADB_SATYPE_RIPV2 7 #define SADB_SATYPE_MIP 8 #define SADB_X_SATYPE_IPCOMP 9 #define SADB_SATYPE_MAX 9 /* Authentication algorithms */ #define SADB_AALG_NONE 0 #define SADB_AALG_MD5HMAC 2 #define SADB_AALG_SHA1HMAC 3 #define SADB_X_AALG_SHA2_256HMAC 5 #define SADB_X_AALG_SHA2_384HMAC 6 #define SADB_X_AALG_SHA2_512HMAC 7 #define SADB_X_AALG_RIPEMD160HMAC 8 #define SADB_X_AALG_AES_XCBC_MAC 9 #define SADB_X_AALG_NULL 251 /* kame */ #define SADB_AALG_MAX 251 /* Encryption algorithms */ #define SADB_EALG_NONE 0 #define SADB_EALG_DESCBC 2 #define SADB_EALG_3DESCBC 3 #define SADB_X_EALG_CASTCBC 6 #define SADB_X_EALG_BLOWFISHCBC 7 #define SADB_EALG_NULL 11 #define SADB_X_EALG_AESCBC 12 #define SADB_X_EALG_AESCTR 13 #define SADB_X_EALG_AES_CCM_ICV8 14 #define SADB_X_EALG_AES_CCM_ICV12 15 #define SADB_X_EALG_AES_CCM_ICV16 16 #define SADB_X_EALG_AES_GCM_ICV8 18 #define SADB_X_EALG_AES_GCM_ICV12 19 #define SADB_X_EALG_AES_GCM_ICV16 20 #define SADB_X_EALG_CAMELLIACBC 22 #define SADB_X_EALG_NULL_AES_GMAC 23 #define SADB_EALG_MAX 253 /* last EALG */ /* private allocations should use 249-255 (RFC2407) */ #define SADB_X_EALG_SERPENTCBC 252 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ #define SADB_X_EALG_TWOFISHCBC 253 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ /* Compression algorithms */ #define SADB_X_CALG_NONE 0 #define SADB_X_CALG_OUI 1 #define SADB_X_CALG_DEFLATE 2 #define SADB_X_CALG_LZS 3 #define SADB_X_CALG_LZJH 4 #define SADB_X_CALG_MAX 4 /* Extension Header values */ #define SADB_EXT_RESERVED 0 #define SADB_EXT_SA 1 #define SADB_EXT_LIFETIME_CURRENT 2 #define SADB_EXT_LIFETIME_HARD 3 #define SADB_EXT_LIFETIME_SOFT 4 #define SADB_EXT_ADDRESS_SRC 5 #define SADB_EXT_ADDRESS_DST 6 #define SADB_EXT_ADDRESS_PROXY 7 #define SADB_EXT_KEY_AUTH 8 #define SADB_EXT_KEY_ENCRYPT 9 #define SADB_EXT_IDENTITY_SRC 10 #define SADB_EXT_IDENTITY_DST 11 #define SADB_EXT_SENSITIVITY 12 #define SADB_EXT_PROPOSAL 13 #define SADB_EXT_SUPPORTED_AUTH 14 #define SADB_EXT_SUPPORTED_ENCRYPT 15 #define SADB_EXT_SPIRANGE 16 #define SADB_X_EXT_KMPRIVATE 17 #define SADB_X_EXT_POLICY 18 #define SADB_X_EXT_SA2 19 /* The next four entries are for setting up NAT Traversal */ #define SADB_X_EXT_NAT_T_TYPE 20 #define SADB_X_EXT_NAT_T_SPORT 21 #define SADB_X_EXT_NAT_T_DPORT 22 #define SADB_X_EXT_NAT_T_OA 23 #define SADB_X_EXT_SEC_CTX 24 /* Used with MIGRATE to pass @ to IKE for negotiation */ #define SADB_X_EXT_KMADDRESS 25 #define SADB_X_EXT_FILTER 26 #define SADB_EXT_MAX 26 /* Identity Extension values */ #define SADB_IDENTTYPE_RESERVED 0 #define SADB_IDENTTYPE_PREFIX 1 #define SADB_IDENTTYPE_FQDN 2 #define SADB_IDENTTYPE_USERFQDN 3 #define SADB_IDENTTYPE_MAX 3 #endif /* !(_LINUX_PFKEY2_H) */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/dlmconstants.h��������������������������������������������������������������������������������0000644�����������������00000011730�14763166027�0010603 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /****************************************************************************** ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. ** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions ** of the GNU General Public License v.2. ** ******************************************************************************* ******************************************************************************/ #ifndef __DLMCONSTANTS_DOT_H__ #define __DLMCONSTANTS_DOT_H__ /* * Constants used by DLM interface. */ #define DLM_LOCKSPACE_LEN 64 #define DLM_RESNAME_MAXLEN 64 /* * Lock Modes */ #define DLM_LOCK_IV (-1) /* invalid */ #define DLM_LOCK_NL 0 /* null */ #define DLM_LOCK_CR 1 /* concurrent read */ #define DLM_LOCK_CW 2 /* concurrent write */ #define DLM_LOCK_PR 3 /* protected read */ #define DLM_LOCK_PW 4 /* protected write */ #define DLM_LOCK_EX 5 /* exclusive */ /* * Flags to dlm_lock * * DLM_LKF_NOQUEUE * * Do not queue the lock request on the wait queue if it cannot be granted * immediately. If the lock cannot be granted because of this flag, DLM will * either return -EAGAIN from the dlm_lock call or will return 0 from * dlm_lock and -EAGAIN in the lock status block when the AST is executed. * * DLM_LKF_CANCEL * * Used to cancel a pending lock request or conversion. A converting lock is * returned to its previously granted mode. * * DLM_LKF_CONVERT * * Indicates a lock conversion request. For conversions the name and namelen * are ignored and the lock ID in the LKSB is used to identify the lock. * * DLM_LKF_VALBLK * * Requests DLM to return the current contents of the lock value block in the * lock status block. When this flag is set in a lock conversion from PW or EX * modes, DLM assigns the value specified in the lock status block to the lock * value block of the lock resource. The LVB is a DLM_LVB_LEN size array * containing application-specific information. * * DLM_LKF_QUECVT * * Force a conversion request to be queued, even if it is compatible with * the granted modes of other locks on the same resource. * * DLM_LKF_IVVALBLK * * Invalidate the lock value block. * * DLM_LKF_CONVDEADLK * * Allows the dlm to resolve conversion deadlocks internally by demoting the * granted mode of a converting lock to NL. The DLM_SBF_DEMOTED flag is * returned for a conversion that's been effected by this. * * DLM_LKF_PERSISTENT * * Only relevant to locks originating in userspace. A persistent lock will not * be removed if the process holding the lock exits. * * DLM_LKF_NODLCKWT * * Do not cancel the lock if it gets into conversion deadlock. * Exclude this lock from being monitored due to DLM_LSFL_TIMEWARN. * * DLM_LKF_NODLCKBLK * * net yet implemented * * DLM_LKF_EXPEDITE * * Used only with new requests for NL mode locks. Tells the lock manager * to grant the lock, ignoring other locks in convert and wait queues. * * DLM_LKF_NOQUEUEBAST * * Send blocking AST's before returning -EAGAIN to the caller. It is only * used along with the NOQUEUE flag. Blocking AST's are not sent for failed * NOQUEUE requests otherwise. * * DLM_LKF_HEADQUE * * Add a lock to the head of the convert or wait queue rather than the tail. * * DLM_LKF_NOORDER * * Disregard the standard grant order rules and grant a lock as soon as it * is compatible with other granted locks. * * DLM_LKF_ORPHAN * * Acquire an orphan lock. * * DLM_LKF_ALTPR * * If the requested mode cannot be granted immediately, try to grant the lock * in PR mode instead. If this alternate mode is granted instead of the * requested mode, DLM_SBF_ALTMODE is returned in the lksb. * * DLM_LKF_ALTCW * * The same as ALTPR, but the alternate mode is CW. * * DLM_LKF_FORCEUNLOCK * * Unlock the lock even if it is converting or waiting or has sublocks. * Only really for use by the userland device.c code. * */ #define DLM_LKF_NOQUEUE 0x00000001 #define DLM_LKF_CANCEL 0x00000002 #define DLM_LKF_CONVERT 0x00000004 #define DLM_LKF_VALBLK 0x00000008 #define DLM_LKF_QUECVT 0x00000010 #define DLM_LKF_IVVALBLK 0x00000020 #define DLM_LKF_CONVDEADLK 0x00000040 #define DLM_LKF_PERSISTENT 0x00000080 #define DLM_LKF_NODLCKWT 0x00000100 #define DLM_LKF_NODLCKBLK 0x00000200 #define DLM_LKF_EXPEDITE 0x00000400 #define DLM_LKF_NOQUEUEBAST 0x00000800 #define DLM_LKF_HEADQUE 0x00001000 #define DLM_LKF_NOORDER 0x00002000 #define DLM_LKF_ORPHAN 0x00004000 #define DLM_LKF_ALTPR 0x00008000 #define DLM_LKF_ALTCW 0x00010000 #define DLM_LKF_FORCEUNLOCK 0x00020000 #define DLM_LKF_TIMEOUT 0x00040000 /* * Some return codes that are not in errno.h */ #define DLM_ECANCEL 0x10001 #define DLM_EUNLOCK 0x10002 #endif /* __DLMCONSTANTS_DOT_H__ */ ����������������������������������������linux/igmp.h����������������������������������������������������������������������������������������0000644�����������������00000005706�14763166027�0007034 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Linux NET3: Internet Group Management Protocol [IGMP] * * Authors: * Alan Cox <alan@lxorguk.ukuu.org.uk> * * Extended to talk the BSD extended IGMP protocol of mrouted 3.6 * * * 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. */ #ifndef _LINUX_IGMP_H #define _LINUX_IGMP_H #include <linux/types.h> #include <asm/byteorder.h> /* * IGMP protocol structures */ /* * Header in on cable format */ struct igmphdr { __u8 type; __u8 code; /* For newer IGMP */ __sum16 csum; __be32 group; }; /* V3 group record types [grec_type] */ #define IGMPV3_MODE_IS_INCLUDE 1 #define IGMPV3_MODE_IS_EXCLUDE 2 #define IGMPV3_CHANGE_TO_INCLUDE 3 #define IGMPV3_CHANGE_TO_EXCLUDE 4 #define IGMPV3_ALLOW_NEW_SOURCES 5 #define IGMPV3_BLOCK_OLD_SOURCES 6 struct igmpv3_grec { __u8 grec_type; __u8 grec_auxwords; __be16 grec_nsrcs; __be32 grec_mca; __be32 grec_src[0]; }; struct igmpv3_report { __u8 type; __u8 resv1; __sum16 csum; __be16 resv2; __be16 ngrec; struct igmpv3_grec grec[0]; }; struct igmpv3_query { __u8 type; __u8 code; __sum16 csum; __be32 group; #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 qrv:3, suppress:1, resv:4; #elif defined(__BIG_ENDIAN_BITFIELD) __u8 resv:4, suppress:1, qrv:3; #else #error "Please fix <asm/byteorder.h>" #endif __u8 qqic; __be16 nsrcs; __be32 srcs[0]; }; #define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ #define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ #define IGMP_DVMRP 0x13 /* DVMRP routing */ #define IGMP_PIM 0x14 /* PIM routing */ #define IGMP_TRACE 0x15 #define IGMPV2_HOST_MEMBERSHIP_REPORT 0x16 /* V2 version of 0x12 */ #define IGMP_HOST_LEAVE_MESSAGE 0x17 #define IGMPV3_HOST_MEMBERSHIP_REPORT 0x22 /* V3 version of 0x12 */ #define IGMP_MTRACE_RESP 0x1e #define IGMP_MTRACE 0x1f /* * Use the BSD names for these for compatibility */ #define IGMP_DELAYING_MEMBER 0x01 #define IGMP_IDLE_MEMBER 0x02 #define IGMP_LAZY_MEMBER 0x03 #define IGMP_SLEEPING_MEMBER 0x04 #define IGMP_AWAKENING_MEMBER 0x05 #define IGMP_MINLEN 8 #define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */ /* query (in seconds) */ #define IGMP_TIMER_SCALE 10 /* denotes that the igmphdr->timer field */ /* specifies time in 10th of seconds */ #define IGMP_AGE_THRESHOLD 400 /* If this host don't hear any IGMP V1 */ /* message in this period of time, */ /* revert to IGMP v2 router. */ #define IGMP_ALL_HOSTS htonl(0xE0000001L) #define IGMP_ALL_ROUTER htonl(0xE0000002L) #define IGMPV3_ALL_MCR htonl(0xE0000016L) #define IGMP_LOCAL_GROUP htonl(0xE0000000L) #define IGMP_LOCAL_GROUP_MASK htonl(0xFFFFFF00L) /* * struct for keeping the multicast list in */ #endif /* _LINUX_IGMP_H */ ����������������������������������������������������������linux/seg6_hmac.h�����������������������������������������������������������������������������������0000644�����������������00000000647�14763166027�0007733 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SEG6_HMAC_H #define _LINUX_SEG6_HMAC_H #include <linux/types.h> #include <linux/seg6.h> #define SEG6_HMAC_SECRET_LEN 64 #define SEG6_HMAC_FIELD_LEN 32 struct sr6_tlv_hmac { struct sr6_tlv tlvhdr; __u16 reserved; __be32 hmackeyid; __u8 hmac[SEG6_HMAC_FIELD_LEN]; }; enum { SEG6_HMAC_ALGO_SHA1 = 1, SEG6_HMAC_ALGO_SHA256 = 2, }; #endif �����������������������������������������������������������������������������������������linux/netlink_diag.h��������������������������������������������������������������������������������0000644�����������������00000002764�14763166027�0010531 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __NETLINK_DIAG_H__ #define __NETLINK_DIAG_H__ #include <linux/types.h> struct netlink_diag_req { __u8 sdiag_family; __u8 sdiag_protocol; __u16 pad; __u32 ndiag_ino; __u32 ndiag_show; __u32 ndiag_cookie[2]; }; struct netlink_diag_msg { __u8 ndiag_family; __u8 ndiag_type; __u8 ndiag_protocol; __u8 ndiag_state; __u32 ndiag_portid; __u32 ndiag_dst_portid; __u32 ndiag_dst_group; __u32 ndiag_ino; __u32 ndiag_cookie[2]; }; struct netlink_diag_ring { __u32 ndr_block_size; __u32 ndr_block_nr; __u32 ndr_frame_size; __u32 ndr_frame_nr; }; enum { /* NETLINK_DIAG_NONE, standard nl API requires this attribute! */ NETLINK_DIAG_MEMINFO, NETLINK_DIAG_GROUPS, NETLINK_DIAG_RX_RING, NETLINK_DIAG_TX_RING, NETLINK_DIAG_FLAGS, __NETLINK_DIAG_MAX, }; #define NETLINK_DIAG_MAX (__NETLINK_DIAG_MAX - 1) #define NDIAG_PROTO_ALL ((__u8) ~0) #define NDIAG_SHOW_MEMINFO 0x00000001 /* show memory info of a socket */ #define NDIAG_SHOW_GROUPS 0x00000002 /* show groups of a netlink socket */ /* deprecated since 4.6 */ #define NDIAG_SHOW_RING_CFG 0x00000004 /* show ring configuration */ #define NDIAG_SHOW_FLAGS 0x00000008 /* show flags of a netlink socket */ /* flags */ #define NDIAG_FLAG_CB_RUNNING 0x00000001 #define NDIAG_FLAG_PKTINFO 0x00000002 #define NDIAG_FLAG_BROADCAST_ERROR 0x00000004 #define NDIAG_FLAG_NO_ENOBUFS 0x00000008 #define NDIAG_FLAG_LISTEN_ALL_NSID 0x00000010 #define NDIAG_FLAG_CAP_ACK 0x00000020 #endif ������������linux/netfilter_ipv6.h������������������������������������������������������������������������������0000644�����������������00000004215�14763166027�0011032 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* IPv6-specific defines for netfilter. * (C)1998 Rusty Russell -- This code is GPL. * (C)1999 David Jeffery * this header was blatantly ripped from netfilter_ipv4.h * it's amazing what adding a bunch of 6s can do =8^) */ #ifndef __LINUX_IP6_NETFILTER_H #define __LINUX_IP6_NETFILTER_H #include <linux/netfilter.h> /* only for userspace compatibility */ #include <limits.h> /* for INT_MIN, INT_MAX */ /* IP Cache bits. */ /* Src IP address. */ #define NFC_IP6_SRC 0x0001 /* Dest IP address. */ #define NFC_IP6_DST 0x0002 /* Input device. */ #define NFC_IP6_IF_IN 0x0004 /* Output device. */ #define NFC_IP6_IF_OUT 0x0008 /* TOS. */ #define NFC_IP6_TOS 0x0010 /* Protocol. */ #define NFC_IP6_PROTO 0x0020 /* IP options. */ #define NFC_IP6_OPTIONS 0x0040 /* Frag & flags. */ #define NFC_IP6_FRAG 0x0080 /* Per-protocol information: only matters if proto match. */ /* TCP flags. */ #define NFC_IP6_TCPFLAGS 0x0100 /* Source port. */ #define NFC_IP6_SRC_PT 0x0200 /* Dest port. */ #define NFC_IP6_DST_PT 0x0400 /* Something else about the proto */ #define NFC_IP6_PROTO_UNKNOWN 0x2000 /* IP6 Hooks */ /* After promisc drops, checksum checks. */ #define NF_IP6_PRE_ROUTING 0 /* If the packet is destined for this box. */ #define NF_IP6_LOCAL_IN 1 /* If the packet is destined for another interface. */ #define NF_IP6_FORWARD 2 /* Packets coming from a local process. */ #define NF_IP6_LOCAL_OUT 3 /* Packets about to hit the wire. */ #define NF_IP6_POST_ROUTING 4 #define NF_IP6_NUMHOOKS 5 enum nf_ip6_hook_priorities { NF_IP6_PRI_FIRST = INT_MIN, NF_IP6_PRI_RAW_BEFORE_DEFRAG = -450, NF_IP6_PRI_CONNTRACK_DEFRAG = -400, NF_IP6_PRI_RAW = -300, NF_IP6_PRI_SELINUX_FIRST = -225, NF_IP6_PRI_CONNTRACK = -200, NF_IP6_PRI_MANGLE = -150, NF_IP6_PRI_NAT_DST = -100, NF_IP6_PRI_FILTER = 0, NF_IP6_PRI_SECURITY = 50, NF_IP6_PRI_NAT_SRC = 100, NF_IP6_PRI_SELINUX_LAST = 225, NF_IP6_PRI_CONNTRACK_HELPER = 300, NF_IP6_PRI_LAST = INT_MAX, }; #endif /* __LINUX_IP6_NETFILTER_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/rfkill.h��������������������������������������������������������������������������������������0000644�����������������00000007142�14763166027�0007357 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 2006 - 2007 Ivo van Doorn * Copyright (C) 2007 Dmitry Torokhov * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef __RFKILL_H #define __RFKILL_H #include <linux/types.h> /* define userspace visible states */ #define RFKILL_STATE_SOFT_BLOCKED 0 #define RFKILL_STATE_UNBLOCKED 1 #define RFKILL_STATE_HARD_BLOCKED 2 /** * enum rfkill_type - type of rfkill switch. * * @RFKILL_TYPE_ALL: toggles all switches (requests only - not a switch type) * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device. * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. * @RFKILL_TYPE_UWB: switch is on a ultra wideband device. * @RFKILL_TYPE_WIMAX: switch is on a WiMAX device. * @RFKILL_TYPE_WWAN: switch is on a wireless WAN device. * @RFKILL_TYPE_GPS: switch is on a GPS device. * @RFKILL_TYPE_FM: switch is on a FM radio device. * @RFKILL_TYPE_NFC: switch is on an NFC device. * @NUM_RFKILL_TYPES: number of defined rfkill types */ enum rfkill_type { RFKILL_TYPE_ALL = 0, RFKILL_TYPE_WLAN, RFKILL_TYPE_BLUETOOTH, RFKILL_TYPE_UWB, RFKILL_TYPE_WIMAX, RFKILL_TYPE_WWAN, RFKILL_TYPE_GPS, RFKILL_TYPE_FM, RFKILL_TYPE_NFC, NUM_RFKILL_TYPES, }; /** * enum rfkill_operation - operation types * @RFKILL_OP_ADD: a device was added * @RFKILL_OP_DEL: a device was removed * @RFKILL_OP_CHANGE: a device's state changed -- userspace changes one device * @RFKILL_OP_CHANGE_ALL: userspace changes all devices (of a type, or all) * into a state, also updating the default state used for devices that * are hot-plugged later. */ enum rfkill_operation { RFKILL_OP_ADD = 0, RFKILL_OP_DEL, RFKILL_OP_CHANGE, RFKILL_OP_CHANGE_ALL, }; /** * struct rfkill_event - events for userspace on /dev/rfkill * @idx: index of dev rfkill * @type: type of the rfkill struct * @op: operation code * @hard: hard state (0/1) * @soft: soft state (0/1) * * Structure used for userspace communication on /dev/rfkill, * used for events from the kernel and control to the kernel. */ struct rfkill_event { __u32 idx; __u8 type; __u8 op; __u8 soft, hard; } __attribute__((packed)); /* * We are planning to be backward and forward compatible with changes * to the event struct, by adding new, optional, members at the end. * When reading an event (whether the kernel from userspace or vice * versa) we need to accept anything that's at least as large as the * version 1 event size, but might be able to accept other sizes in * the future. * * One exception is the kernel -- we already have two event sizes in * that we've made the 'hard' member optional since our only option * is to ignore it anyway. */ #define RFKILL_EVENT_SIZE_V1 8 /* ioctl for turning off rfkill-input (if present) */ #define RFKILL_IOC_MAGIC 'R' #define RFKILL_IOC_NOINPUT 1 #define RFKILL_IOCTL_NOINPUT _IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT) /* and that's all userspace gets */ #endif /* __RFKILL_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/a.out.h���������������������������������������������������������������������������������������0000644�����������������00000015354�14763166027�0007126 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __A_OUT_GNU_H__ #define __A_OUT_GNU_H__ #define __GNU_EXEC_MACROS__ #ifndef __STRUCT_EXEC_OVERRIDE__ #include <asm/a.out.h> #endif /* __STRUCT_EXEC_OVERRIDE__ */ #ifndef __ASSEMBLY__ /* these go in the N_MACHTYPE field */ enum machine_type { #if defined (M_OLDSUN2) M__OLDSUN2 = M_OLDSUN2, #else M_OLDSUN2 = 0, #endif #if defined (M_68010) M__68010 = M_68010, #else M_68010 = 1, #endif #if defined (M_68020) M__68020 = M_68020, #else M_68020 = 2, #endif #if defined (M_SPARC) M__SPARC = M_SPARC, #else M_SPARC = 3, #endif /* skip a bunch so we don't run into any of sun's numbers */ M_386 = 100, M_MIPS1 = 151, /* MIPS R3000/R3000 binary */ M_MIPS2 = 152 /* MIPS R6000/R4000 binary */ }; #if !defined (N_MAGIC) #define N_MAGIC(exec) ((exec).a_info & 0xffff) #endif #define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff)) #define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff) #define N_SET_INFO(exec, magic, type, flags) \ ((exec).a_info = ((magic) & 0xffff) \ | (((int)(type) & 0xff) << 16) \ | (((flags) & 0xff) << 24)) #define N_SET_MAGIC(exec, magic) \ ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff))) #define N_SET_MACHTYPE(exec, machtype) \ ((exec).a_info = \ ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16)) #define N_SET_FLAGS(exec, flags) \ ((exec).a_info = \ ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24)) /* Code indicating object file or impure executable. */ #define OMAGIC 0407 /* Code indicating pure executable. */ #define NMAGIC 0410 /* Code indicating demand-paged executable. */ #define ZMAGIC 0413 /* This indicates a demand-paged executable with the header in the text. The first page is unmapped to help trap NULL pointer references */ #define QMAGIC 0314 /* Code indicating core file. */ #define CMAGIC 0421 #if !defined (N_BADMAG) #define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \ && N_MAGIC(x) != NMAGIC \ && N_MAGIC(x) != ZMAGIC \ && N_MAGIC(x) != QMAGIC) #endif #define _N_HDROFF(x) (1024 - sizeof (struct exec)) #if !defined (N_TXTOFF) #define N_TXTOFF(x) \ (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \ (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec))) #endif #if !defined (N_DATOFF) #define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text) #endif #if !defined (N_TRELOFF) #define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data) #endif #if !defined (N_DRELOFF) #define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x)) #endif #if !defined (N_SYMOFF) #define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x)) #endif #if !defined (N_STROFF) #define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x)) #endif /* Address of text segment in memory after it is loaded. */ #if !defined (N_TXTADDR) #define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0) #endif /* Address of data segment in memory after it is loaded. */ #include <unistd.h> #if defined(__i386__) || defined(__mc68000__) #define SEGMENT_SIZE 1024 #else #ifndef SEGMENT_SIZE #define SEGMENT_SIZE getpagesize() #endif #endif #define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE) #define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text) #ifndef N_DATADDR #define N_DATADDR(x) \ (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \ : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x)))) #endif /* Address of bss segment in memory after it is loaded. */ #if !defined (N_BSSADDR) #define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data) #endif #if !defined (N_NLIST_DECLARED) struct nlist { union { char *n_name; struct nlist *n_next; long n_strx; } n_un; unsigned char n_type; char n_other; short n_desc; unsigned long n_value; }; #endif /* no N_NLIST_DECLARED. */ #if !defined (N_UNDF) #define N_UNDF 0 #endif #if !defined (N_ABS) #define N_ABS 2 #endif #if !defined (N_TEXT) #define N_TEXT 4 #endif #if !defined (N_DATA) #define N_DATA 6 #endif #if !defined (N_BSS) #define N_BSS 8 #endif #if !defined (N_FN) #define N_FN 15 #endif #if !defined (N_EXT) #define N_EXT 1 #endif #if !defined (N_TYPE) #define N_TYPE 036 #endif #if !defined (N_STAB) #define N_STAB 0340 #endif /* The following type indicates the definition of a symbol as being an indirect reference to another symbol. The other symbol appears as an undefined reference, immediately following this symbol. Indirection is asymmetrical. The other symbol's value will be used to satisfy requests for the indirect symbol, but not vice versa. If the other symbol does not have a definition, libraries will be searched to find a definition. */ #define N_INDR 0xa /* The following symbols refer to set elements. All the N_SET[ATDB] symbols with the same name form one set. Space is allocated for the set in the text section, and each set element's value is stored into one word of the space. The first word of the space is the length of the set (number of elements). The address of the set is made into an N_SETV symbol whose name is the same as the name of the set. This symbol acts like a N_DATA global symbol in that it can satisfy undefined external references. */ /* These appear as input to LD, in a .o file. */ #define N_SETA 0x14 /* Absolute set element symbol */ #define N_SETT 0x16 /* Text set element symbol */ #define N_SETD 0x18 /* Data set element symbol */ #define N_SETB 0x1A /* Bss set element symbol */ /* This is output from LD. */ #define N_SETV 0x1C /* Pointer to set vector in data area. */ #if !defined (N_RELOCATION_INFO_DECLARED) /* This structure describes a single relocation to be performed. The text-relocation section of the file is a vector of these structures, all of which apply to the text section. Likewise, the data-relocation section applies to the data section. */ struct relocation_info { /* Address (within segment) to be relocated. */ int r_address; /* The meaning of r_symbolnum depends on r_extern. */ unsigned int r_symbolnum:24; /* Nonzero means value is a pc-relative offset and it should be relocated for changes in its own address as well as for changes in the symbol or section specified. */ unsigned int r_pcrel:1; /* Length (as exponent of 2) of the field to be relocated. Thus, a value of 2 indicates 1<<2 bytes. */ unsigned int r_length:2; /* 1 => relocate with value of symbol. r_symbolnum is the index of the symbol in file's the symbol table. 0 => relocate with the address of a segment. r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS (the N_EXT bit may be set also, but signifies nothing). */ unsigned int r_extern:1; /* Four bits that aren't used, but when writing an object file it is desirable to clear them. */ unsigned int r_pad:4; }; #endif /* no N_RELOCATION_INFO_DECLARED. */ #endif /*__ASSEMBLY__ */ #endif /* __A_OUT_GNU_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/taskstats.h�����������������������������������������������������������������������������������0000644�����������������00000015621�14763166027�0010116 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.1 WITH Linux-syscall-note */ /* taskstats.h - exporting per-task statistics * * Copyright (C) Shailabh Nagar, IBM Corp. 2006 * (C) Balbir Singh, IBM Corp. 2006 * (C) Jay Lan, SGI, 2006 * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2.1 of the GNU Lesser General Public License * as published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ #ifndef _LINUX_TASKSTATS_H #define _LINUX_TASKSTATS_H #include <linux/types.h> /* Format for per-task data returned to userland when * - a task exits * - listener requests stats for a task * * The struct is versioned. Newer versions should only add fields to * the bottom of the struct to maintain backward compatibility. * * * To add new fields * a) bump up TASKSTATS_VERSION * b) add comment indicating new version number at end of struct * c) add new fields after version comment; maintain 64-bit alignment */ #define TASKSTATS_VERSION 8 #define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN * in linux/sched.h */ struct taskstats { /* The version number of this struct. This field is always set to * TAKSTATS_VERSION, which is defined in <linux/taskstats.h>. * Each time the struct is changed, the value should be incremented. */ __u16 version; __u32 ac_exitcode; /* Exit status */ /* The accounting flags of a task as defined in <linux/acct.h> * Defined values are AFORK, ASU, ACOMPAT, ACORE, and AXSIG. */ __u8 ac_flag; /* Record flags */ __u8 ac_nice; /* task_nice */ /* Delay accounting fields start * * All values, until comment "Delay accounting fields end" are * available only if delay accounting is enabled, even though the last * few fields are not delays * * xxx_count is the number of delay values recorded * xxx_delay_total is the corresponding cumulative delay in nanoseconds * * xxx_delay_total wraps around to zero on overflow * xxx_count incremented regardless of overflow */ /* Delay waiting for cpu, while runnable * count, delay_total NOT updated atomically */ __u64 cpu_count __attribute__((aligned(8))); __u64 cpu_delay_total; /* Following four fields atomically updated using task->delays->lock */ /* Delay waiting for synchronous block I/O to complete * does not account for delays in I/O submission */ __u64 blkio_count; __u64 blkio_delay_total; /* Delay waiting for page fault I/O (swap in only) */ __u64 swapin_count; __u64 swapin_delay_total; /* cpu "wall-clock" running time * On some architectures, value will adjust for cpu time stolen * from the kernel in involuntary waits due to virtualization. * Value is cumulative, in nanoseconds, without a corresponding count * and wraps around to zero silently on overflow */ __u64 cpu_run_real_total; /* cpu "virtual" running time * Uses time intervals seen by the kernel i.e. no adjustment * for kernel's involuntary waits due to virtualization. * Value is cumulative, in nanoseconds, without a corresponding count * and wraps around to zero silently on overflow */ __u64 cpu_run_virtual_total; /* Delay accounting fields end */ /* version 1 ends here */ /* Basic Accounting Fields start */ char ac_comm[TS_COMM_LEN]; /* Command name */ __u8 ac_sched __attribute__((aligned(8))); /* Scheduling discipline */ __u8 ac_pad[3]; __u32 ac_uid __attribute__((aligned(8))); /* User ID */ __u32 ac_gid; /* Group ID */ __u32 ac_pid; /* Process ID */ __u32 ac_ppid; /* Parent process ID */ __u32 ac_btime; /* Begin time [sec since 1970] */ __u64 ac_etime __attribute__((aligned(8))); /* Elapsed time [usec] */ __u64 ac_utime; /* User CPU time [usec] */ __u64 ac_stime; /* SYstem CPU time [usec] */ __u64 ac_minflt; /* Minor Page Fault Count */ __u64 ac_majflt; /* Major Page Fault Count */ /* Basic Accounting Fields end */ /* Extended accounting fields start */ /* Accumulated RSS usage in duration of a task, in MBytes-usecs. * The current rss usage is added to this counter every time * a tick is charged to a task's system time. So, at the end we * will have memory usage multiplied by system time. Thus an * average usage per system time unit can be calculated. */ __u64 coremem; /* accumulated RSS usage in MB-usec */ /* Accumulated virtual memory usage in duration of a task. * Same as acct_rss_mem1 above except that we keep track of VM usage. */ __u64 virtmem; /* accumulated VM usage in MB-usec */ /* High watermark of RSS and virtual memory usage in duration of * a task, in KBytes. */ __u64 hiwater_rss; /* High-watermark of RSS usage, in KB */ __u64 hiwater_vm; /* High-water VM usage, in KB */ /* The following four fields are I/O statistics of a task. */ __u64 read_char; /* bytes read */ __u64 write_char; /* bytes written */ __u64 read_syscalls; /* read syscalls */ __u64 write_syscalls; /* write syscalls */ /* Extended accounting fields end */ #define TASKSTATS_HAS_IO_ACCOUNTING /* Per-task storage I/O accounting starts */ __u64 read_bytes; /* bytes of read I/O */ __u64 write_bytes; /* bytes of write I/O */ __u64 cancelled_write_bytes; /* bytes of cancelled write I/O */ __u64 nvcsw; /* voluntary_ctxt_switches */ __u64 nivcsw; /* nonvoluntary_ctxt_switches */ /* time accounting for SMT machines */ __u64 ac_utimescaled; /* utime scaled on frequency etc */ __u64 ac_stimescaled; /* stime scaled on frequency etc */ __u64 cpu_scaled_run_real_total; /* scaled cpu_run_real_total */ /* Delay waiting for memory reclaim */ __u64 freepages_count; __u64 freepages_delay_total; }; /* * Commands sent from userspace * Not versioned. New commands should only be inserted at the enum's end * prior to __TASKSTATS_CMD_MAX */ enum { TASKSTATS_CMD_UNSPEC = 0, /* Reserved */ TASKSTATS_CMD_GET, /* user->kernel request/get-response */ TASKSTATS_CMD_NEW, /* kernel->user event */ __TASKSTATS_CMD_MAX, }; #define TASKSTATS_CMD_MAX (__TASKSTATS_CMD_MAX - 1) enum { TASKSTATS_TYPE_UNSPEC = 0, /* Reserved */ TASKSTATS_TYPE_PID, /* Process id */ TASKSTATS_TYPE_TGID, /* Thread group id */ TASKSTATS_TYPE_STATS, /* taskstats structure */ TASKSTATS_TYPE_AGGR_PID, /* contains pid + stats */ TASKSTATS_TYPE_AGGR_TGID, /* contains tgid + stats */ TASKSTATS_TYPE_NULL, /* contains nothing */ __TASKSTATS_TYPE_MAX, }; #define TASKSTATS_TYPE_MAX (__TASKSTATS_TYPE_MAX - 1) enum { TASKSTATS_CMD_ATTR_UNSPEC = 0, TASKSTATS_CMD_ATTR_PID, TASKSTATS_CMD_ATTR_TGID, TASKSTATS_CMD_ATTR_REGISTER_CPUMASK, TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK, __TASKSTATS_CMD_ATTR_MAX, }; #define TASKSTATS_CMD_ATTR_MAX (__TASKSTATS_CMD_ATTR_MAX - 1) /* NETLINK_GENERIC related info */ #define TASKSTATS_GENL_NAME "TASKSTATS" #define TASKSTATS_GENL_VERSION 0x1 #endif /* _LINUX_TASKSTATS_H */ ���������������������������������������������������������������������������������������������������������������linux/kcov.h����������������������������������������������������������������������������������������0000644�����������������00000002113�14763166027�0007027 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_KCOV_IOCTLS_H #define _LINUX_KCOV_IOCTLS_H #include <linux/types.h> #define KCOV_INIT_TRACE _IOR('c', 1, unsigned long) #define KCOV_ENABLE _IO('c', 100) #define KCOV_DISABLE _IO('c', 101) enum { /* * Tracing coverage collection mode. * Covered PCs are collected in a per-task buffer. * In new KCOV version the mode is chosen by calling * ioctl(fd, KCOV_ENABLE, mode). In older versions the mode argument * was supposed to be 0 in such a call. So, for reasons of backward * compatibility, we have chosen the value KCOV_TRACE_PC to be 0. */ KCOV_TRACE_PC = 0, /* Collecting comparison operands mode. */ KCOV_TRACE_CMP = 1, }; /* * The format for the types of collected comparisons. * * Bit 0 shows whether one of the arguments is a compile-time constant. * Bits 1 & 2 contain log2 of the argument size, up to 8 bytes. */ #define KCOV_CMP_CONST (1 << 0) #define KCOV_CMP_SIZE(n) ((n) << 1) #define KCOV_CMP_MASK KCOV_CMP_SIZE(3) #endif /* _LINUX_KCOV_IOCTLS_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/userio.h��������������������������������������������������������������������������������������0000644�����������������00000002754�14763166027�0007406 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.0+ WITH Linux-syscall-note */ /* * userio: virtual serio device support * Copyright (C) 2015 Red Hat * Copyright (C) 2015 Lyude (Stephen Chandler Paul) <cpaul@redhat.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser 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 Lesser General Public License for more * details. * * This is the public header used for user-space communication with the userio * driver. __attribute__((__packed__)) is used for all structs to keep ABI * compatibility between all architectures. */ #ifndef _USERIO_H #define _USERIO_H #include <linux/types.h> enum userio_cmd_type { USERIO_CMD_REGISTER = 0, USERIO_CMD_SET_PORT_TYPE = 1, USERIO_CMD_SEND_INTERRUPT = 2 }; /* * userio Commands * All commands sent to /dev/userio are encoded using this structure. The type * field should contain a USERIO_CMD* value that indicates what kind of command * is being sent to userio. The data field should contain the accompanying * argument for the command, if there is one. */ struct userio_cmd { __u8 type; __u8 data; } __attribute__((__packed__)); #endif /* !_USERIO_H */ ��������������������linux/timerfd.h�������������������������������������������������������������������������������������0000644�����������������00000001650�14763166027�0007524 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/linux/timerfd.h * * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org> * */ #ifndef _LINUX_TIMERFD_H #define _LINUX_TIMERFD_H #include <linux/types.h> /* For O_CLOEXEC and O_NONBLOCK */ #include <linux/fcntl.h> /* For _IO helpers */ #include <linux/ioctl.h> /* * CAREFUL: Check include/asm-generic/fcntl.h when defining * new flags, since they might collide with O_* ones. We want * to re-use O_* flags that couldn't possibly have a meaning * from eventfd, in order to leave a free define-space for * shared O_* flags. * * Also make sure to update the masks in include/linux/timerfd.h * when adding new flags. */ #define TFD_TIMER_ABSTIME (1 << 0) #define TFD_TIMER_CANCEL_ON_SET (1 << 1) #define TFD_CLOEXEC O_CLOEXEC #define TFD_NONBLOCK O_NONBLOCK #define TFD_IOC_SET_TICKS _IOW('T', 0, __u64) #endif /* _LINUX_TIMERFD_H */ ����������������������������������������������������������������������������������������linux/un.h������������������������������������������������������������������������������������������0000644�����������������00000000600�14763166027�0006506 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_UN_H #define _LINUX_UN_H #include <linux/socket.h> #define UNIX_PATH_MAX 108 struct sockaddr_un { __kernel_sa_family_t sun_family; /* AF_UNIX */ char sun_path[UNIX_PATH_MAX]; /* pathname */ }; #define SIOCUNIXFILE (SIOCPROTOPRIVATE + 0) /* open a socket file with O_PATH */ #endif /* _LINUX_UN_H */ ��������������������������������������������������������������������������������������������������������������������������������linux/pps.h�����������������������������������������������������������������������������������������0000644�����������������00000011176�14763166027�0006700 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * PPS API header * * Copyright (C) 2005-2009 Rodolfo Giometti <giometti@linux.it> * * 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. */ #ifndef _PPS_H_ #define _PPS_H_ #include <linux/types.h> #define PPS_VERSION "5.3.6" #define PPS_MAX_SOURCES 16 /* should be enough... */ /* Implementation note: the logical states ``assert'' and ``clear'' * are implemented in terms of the chip register, i.e. ``assert'' * means the bit is set. */ /* * 3.2 New data structures */ #define PPS_API_VERS_1 1 #define PPS_API_VERS PPS_API_VERS_1 /* we use API version 1 */ #define PPS_MAX_NAME_LEN 32 /* 32-bit vs. 64-bit compatibility. * * 0n i386, the alignment of a uint64_t is only 4 bytes, while on most other * architectures it's 8 bytes. On i386, there will be no padding between the * two consecutive 'struct pps_ktime' members of struct pps_kinfo and struct * pps_kparams. But on most platforms there will be padding to ensure correct * alignment. * * The simple fix is probably to add an explicit padding. * [David Woodhouse] */ struct pps_ktime { __s64 sec; __s32 nsec; __u32 flags; }; struct pps_ktime_compat { __s64 sec; __s32 nsec; __u32 flags; } __attribute__((packed, aligned(4))); #define PPS_TIME_INVALID (1<<0) /* used to specify timeout==NULL */ struct pps_kinfo { __u32 assert_sequence; /* seq. num. of assert event */ __u32 clear_sequence; /* seq. num. of clear event */ struct pps_ktime assert_tu; /* time of assert event */ struct pps_ktime clear_tu; /* time of clear event */ int current_mode; /* current mode bits */ }; struct pps_kinfo_compat { __u32 assert_sequence; /* seq. num. of assert event */ __u32 clear_sequence; /* seq. num. of clear event */ struct pps_ktime_compat assert_tu; /* time of assert event */ struct pps_ktime_compat clear_tu; /* time of clear event */ int current_mode; /* current mode bits */ }; struct pps_kparams { int api_version; /* API version # */ int mode; /* mode bits */ struct pps_ktime assert_off_tu; /* offset compensation for assert */ struct pps_ktime clear_off_tu; /* offset compensation for clear */ }; /* * 3.3 Mode bit definitions */ /* Device/implementation parameters */ #define PPS_CAPTUREASSERT 0x01 /* capture assert events */ #define PPS_CAPTURECLEAR 0x02 /* capture clear events */ #define PPS_CAPTUREBOTH 0x03 /* capture assert and clear events */ #define PPS_OFFSETASSERT 0x10 /* apply compensation for assert event */ #define PPS_OFFSETCLEAR 0x20 /* apply compensation for clear event */ #define PPS_CANWAIT 0x100 /* can we wait for an event? */ #define PPS_CANPOLL 0x200 /* bit reserved for future use */ /* Kernel actions */ #define PPS_ECHOASSERT 0x40 /* feed back assert event to output */ #define PPS_ECHOCLEAR 0x80 /* feed back clear event to output */ /* Timestamp formats */ #define PPS_TSFMT_TSPEC 0x1000 /* select timespec format */ #define PPS_TSFMT_NTPFP 0x2000 /* select NTP format */ /* * 3.4.4 New functions: disciplining the kernel timebase */ /* Kernel consumers */ #define PPS_KC_HARDPPS 0 /* hardpps() (or equivalent) */ #define PPS_KC_HARDPPS_PLL 1 /* hardpps() constrained to use a phase-locked loop */ #define PPS_KC_HARDPPS_FLL 2 /* hardpps() constrained to use a frequency-locked loop */ /* * Here begins the implementation-specific part! */ struct pps_fdata { struct pps_kinfo info; struct pps_ktime timeout; }; struct pps_fdata_compat { struct pps_kinfo_compat info; struct pps_ktime_compat timeout; }; struct pps_bind_args { int tsformat; /* format of time stamps */ int edge; /* selected event type */ int consumer; /* selected kernel consumer */ }; #include <linux/ioctl.h> #define PPS_GETPARAMS _IOR('p', 0xa1, struct pps_kparams *) #define PPS_SETPARAMS _IOW('p', 0xa2, struct pps_kparams *) #define PPS_GETCAP _IOR('p', 0xa3, int *) #define PPS_FETCH _IOWR('p', 0xa4, struct pps_fdata *) #define PPS_KC_BIND _IOW('p', 0xa5, struct pps_bind_args *) #endif /* _PPS_H_ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/xattr.h���������������������������������������������������������������������������������������0000644�����������������00000005454�14763166027�0007242 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* File: linux/xattr.h Extended attributes handling. Copyright (C) 2001 by Andreas Gruenbacher <a.gruenbacher@computer.org> Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved. Copyright (c) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com> */ #include <linux/libc-compat.h> #ifndef _LINUX_XATTR_H #define _LINUX_XATTR_H #if __UAPI_DEF_XATTR #define __USE_KERNEL_XATTR_DEFS #define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ #define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */ #endif /* Namespaces */ #define XATTR_OS2_PREFIX "os2." #define XATTR_OS2_PREFIX_LEN (sizeof(XATTR_OS2_PREFIX) - 1) #define XATTR_MAC_OSX_PREFIX "osx." #define XATTR_MAC_OSX_PREFIX_LEN (sizeof(XATTR_MAC_OSX_PREFIX) - 1) #define XATTR_BTRFS_PREFIX "btrfs." #define XATTR_BTRFS_PREFIX_LEN (sizeof(XATTR_BTRFS_PREFIX) - 1) #define XATTR_SECURITY_PREFIX "security." #define XATTR_SECURITY_PREFIX_LEN (sizeof(XATTR_SECURITY_PREFIX) - 1) #define XATTR_SYSTEM_PREFIX "system." #define XATTR_SYSTEM_PREFIX_LEN (sizeof(XATTR_SYSTEM_PREFIX) - 1) #define XATTR_TRUSTED_PREFIX "trusted." #define XATTR_TRUSTED_PREFIX_LEN (sizeof(XATTR_TRUSTED_PREFIX) - 1) #define XATTR_USER_PREFIX "user." #define XATTR_USER_PREFIX_LEN (sizeof(XATTR_USER_PREFIX) - 1) /* Security namespace */ #define XATTR_EVM_SUFFIX "evm" #define XATTR_NAME_EVM XATTR_SECURITY_PREFIX XATTR_EVM_SUFFIX #define XATTR_IMA_SUFFIX "ima" #define XATTR_NAME_IMA XATTR_SECURITY_PREFIX XATTR_IMA_SUFFIX #define XATTR_SELINUX_SUFFIX "selinux" #define XATTR_NAME_SELINUX XATTR_SECURITY_PREFIX XATTR_SELINUX_SUFFIX #define XATTR_SMACK_SUFFIX "SMACK64" #define XATTR_SMACK_IPIN "SMACK64IPIN" #define XATTR_SMACK_IPOUT "SMACK64IPOUT" #define XATTR_SMACK_EXEC "SMACK64EXEC" #define XATTR_SMACK_TRANSMUTE "SMACK64TRANSMUTE" #define XATTR_SMACK_MMAP "SMACK64MMAP" #define XATTR_NAME_SMACK XATTR_SECURITY_PREFIX XATTR_SMACK_SUFFIX #define XATTR_NAME_SMACKIPIN XATTR_SECURITY_PREFIX XATTR_SMACK_IPIN #define XATTR_NAME_SMACKIPOUT XATTR_SECURITY_PREFIX XATTR_SMACK_IPOUT #define XATTR_NAME_SMACKEXEC XATTR_SECURITY_PREFIX XATTR_SMACK_EXEC #define XATTR_NAME_SMACKTRANSMUTE XATTR_SECURITY_PREFIX XATTR_SMACK_TRANSMUTE #define XATTR_NAME_SMACKMMAP XATTR_SECURITY_PREFIX XATTR_SMACK_MMAP #define XATTR_APPARMOR_SUFFIX "apparmor" #define XATTR_NAME_APPARMOR XATTR_SECURITY_PREFIX XATTR_APPARMOR_SUFFIX #define XATTR_CAPS_SUFFIX "capability" #define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX #define XATTR_POSIX_ACL_ACCESS "posix_acl_access" #define XATTR_NAME_POSIX_ACL_ACCESS XATTR_SYSTEM_PREFIX XATTR_POSIX_ACL_ACCESS #define XATTR_POSIX_ACL_DEFAULT "posix_acl_default" #define XATTR_NAME_POSIX_ACL_DEFAULT XATTR_SYSTEM_PREFIX XATTR_POSIX_ACL_DEFAULT #endif /* _LINUX_XATTR_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/agpgart.h�������������������������������������������������������������������������������������0000644�����������������00000007544�14763166027�0007527 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * AGPGART module version 0.99 * Copyright (C) 1999 Jeff Hartmann * Copyright (C) 1999 Precision Insight, Inc. * Copyright (C) 1999 Xi Graphics, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #ifndef _AGP_H #define _AGP_H #define AGPIOC_BASE 'A' #define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, struct agp_info*) #define AGPIOC_ACQUIRE _IO (AGPIOC_BASE, 1) #define AGPIOC_RELEASE _IO (AGPIOC_BASE, 2) #define AGPIOC_SETUP _IOW (AGPIOC_BASE, 3, struct agp_setup*) #define AGPIOC_RESERVE _IOW (AGPIOC_BASE, 4, struct agp_region*) #define AGPIOC_PROTECT _IOW (AGPIOC_BASE, 5, struct agp_region*) #define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 6, struct agp_allocate*) #define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int) #define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, struct agp_bind*) #define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, struct agp_unbind*) #define AGPIOC_CHIPSET_FLUSH _IO (AGPIOC_BASE, 10) #define AGP_DEVICE "/dev/agpgart" #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #include <linux/types.h> #include <stdlib.h> struct agp_version { __u16 major; __u16 minor; }; typedef struct _agp_info { struct agp_version version; /* version of the driver */ __u32 bridge_id; /* bridge vendor/device */ __u32 agp_mode; /* mode info of bridge */ unsigned long aper_base;/* base of aperture */ size_t aper_size; /* size of aperture */ size_t pg_total; /* max pages (swap + system) */ size_t pg_system; /* max pages (system) */ size_t pg_used; /* current pages used */ } agp_info; typedef struct _agp_setup { __u32 agp_mode; /* mode info of bridge */ } agp_setup; /* * The "prot" down below needs still a "sleep" flag somehow ... */ typedef struct _agp_segment { __kernel_off_t pg_start; /* starting page to populate */ __kernel_size_t pg_count; /* number of pages */ int prot; /* prot flags for mmap */ } agp_segment; typedef struct _agp_region { __kernel_pid_t pid; /* pid of process */ __kernel_size_t seg_count; /* number of segments */ struct _agp_segment *seg_list; } agp_region; typedef struct _agp_allocate { int key; /* tag of allocation */ __kernel_size_t pg_count;/* number of pages */ __u32 type; /* 0 == normal, other devspec */ __u32 physical; /* device specific (some devices * need a phys address of the * actual page behind the gatt * table) */ } agp_allocate; typedef struct _agp_bind { int key; /* tag of allocation */ __kernel_off_t pg_start;/* starting page to populate */ } agp_bind; typedef struct _agp_unbind { int key; /* tag of allocation */ __u32 priority; /* priority for paging out */ } agp_unbind; #endif /* _AGP_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������linux/atmppp.h��������������������������������������������������������������������������������������0000644�����������������00000001177�14763166027�0007377 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atmppp.h - RFC2364 PPPoATM */ /* Written 2000 by Mitchell Blank Jr */ #ifndef _LINUX_ATMPPP_H #define _LINUX_ATMPPP_H #include <linux/atm.h> #define PPPOATM_ENCAPS_AUTODETECT (0) #define PPPOATM_ENCAPS_VC (1) #define PPPOATM_ENCAPS_LLC (2) /* * This is for the ATM_SETBACKEND call - these are like socket families: * the first element of the structure is the backend number and the rest * is per-backend specific */ struct atm_backend_ppp { atm_backend_t backend_num; /* ATM_BACKEND_PPP */ int encaps; /* PPPOATM_ENCAPS_* */ }; #endif /* _LINUX_ATMPPP_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/virtio_blk.h����������������������������������������������������������������������������������0000644�����������������00000012307�14763166027�0010237 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _LINUX_VIRTIO_BLK_H #define _LINUX_VIRTIO_BLK_H /* This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <linux/types.h> #include <linux/virtio_ids.h> #include <linux/virtio_config.h> #include <linux/virtio_types.h> /* Feature bits */ #define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */ #define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */ #define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */ #define VIRTIO_BLK_F_RO 5 /* Disk is read-only */ #define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ #define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */ #define VIRTIO_BLK_F_MQ 12 /* support more than one vq */ /* Legacy feature bits */ #ifndef VIRTIO_BLK_NO_LEGACY #define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ #define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ #define VIRTIO_BLK_F_FLUSH 9 /* Flush command supported */ #define VIRTIO_BLK_F_CONFIG_WCE 11 /* Writeback mode available in config */ /* Old (deprecated) name for VIRTIO_BLK_F_FLUSH. */ #define VIRTIO_BLK_F_WCE VIRTIO_BLK_F_FLUSH #endif /* !VIRTIO_BLK_NO_LEGACY */ #define VIRTIO_BLK_ID_BYTES 20 /* ID string length */ struct virtio_blk_config { /* The capacity (in 512-byte sectors). */ __u64 capacity; /* The maximum segment size (if VIRTIO_BLK_F_SIZE_MAX) */ __u32 size_max; /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */ __u32 seg_max; /* geometry of the device (if VIRTIO_BLK_F_GEOMETRY) */ struct virtio_blk_geometry { __u16 cylinders; __u8 heads; __u8 sectors; } geometry; /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ __u32 blk_size; /* the next 4 entries are guarded by VIRTIO_BLK_F_TOPOLOGY */ /* exponent for physical block per logical block. */ __u8 physical_block_exp; /* alignment offset in logical blocks. */ __u8 alignment_offset; /* minimum I/O size without performance penalty in logical blocks. */ __u16 min_io_size; /* optimal sustained I/O size in logical blocks. */ __u32 opt_io_size; /* writeback mode (if VIRTIO_BLK_F_CONFIG_WCE) */ __u8 wce; __u8 unused; /* number of vqs, only available when VIRTIO_BLK_F_MQ is set */ __u16 num_queues; } __attribute__((packed)); /* * Command types * * Usage is a bit tricky as some bits are used as flags and some are not. * * Rules: * VIRTIO_BLK_T_OUT may be combined with VIRTIO_BLK_T_SCSI_CMD or * VIRTIO_BLK_T_BARRIER. VIRTIO_BLK_T_FLUSH is a command of its own * and may not be combined with any of the other flags. */ /* These two define direction. */ #define VIRTIO_BLK_T_IN 0 #define VIRTIO_BLK_T_OUT 1 #ifndef VIRTIO_BLK_NO_LEGACY /* This bit says it's a scsi command, not an actual read or write. */ #define VIRTIO_BLK_T_SCSI_CMD 2 #endif /* VIRTIO_BLK_NO_LEGACY */ /* Cache flush command */ #define VIRTIO_BLK_T_FLUSH 4 /* Get device ID command */ #define VIRTIO_BLK_T_GET_ID 8 #ifndef VIRTIO_BLK_NO_LEGACY /* Barrier before this op. */ #define VIRTIO_BLK_T_BARRIER 0x80000000 #endif /* !VIRTIO_BLK_NO_LEGACY */ /* * This comes first in the read scatter-gather list. * For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated, * this is the first element of the read scatter-gather list. */ struct virtio_blk_outhdr { /* VIRTIO_BLK_T* */ __virtio32 type; /* io priority. */ __virtio32 ioprio; /* Sector (ie. 512 byte offset) */ __virtio64 sector; }; #ifndef VIRTIO_BLK_NO_LEGACY struct virtio_scsi_inhdr { __virtio32 errors; __virtio32 data_len; __virtio32 sense_len; __virtio32 residual; }; #endif /* !VIRTIO_BLK_NO_LEGACY */ /* And this is the final byte of the write scatter-gather list. */ #define VIRTIO_BLK_S_OK 0 #define VIRTIO_BLK_S_IOERR 1 #define VIRTIO_BLK_S_UNSUPP 2 #endif /* _LINUX_VIRTIO_BLK_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/cramfs_fs.h�����������������������������������������������������������������������������������0000644�����������������00000006743�14763166027�0010045 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __CRAMFS_H #define __CRAMFS_H #include <linux/types.h> #include <linux/magic.h> #define CRAMFS_SIGNATURE "Compressed ROMFS" /* * Width of various bitfields in struct cramfs_inode. * Primarily used to generate warnings in mkcramfs. */ #define CRAMFS_MODE_WIDTH 16 #define CRAMFS_UID_WIDTH 16 #define CRAMFS_SIZE_WIDTH 24 #define CRAMFS_GID_WIDTH 8 #define CRAMFS_NAMELEN_WIDTH 6 #define CRAMFS_OFFSET_WIDTH 26 /* * Since inode.namelen is a unsigned 6-bit number, the maximum cramfs * path length is 63 << 2 = 252. */ #define CRAMFS_MAXPATHLEN (((1 << CRAMFS_NAMELEN_WIDTH) - 1) << 2) /* * Reasonably terse representation of the inode data. */ struct cramfs_inode { __u32 mode:CRAMFS_MODE_WIDTH, uid:CRAMFS_UID_WIDTH; /* SIZE for device files is i_rdev */ __u32 size:CRAMFS_SIZE_WIDTH, gid:CRAMFS_GID_WIDTH; /* NAMELEN is the length of the file name, divided by 4 and rounded up. (cramfs doesn't support hard links.) */ /* OFFSET: For symlinks and non-empty regular files, this contains the offset (divided by 4) of the file data in compressed form (starting with an array of block pointers; see README). For non-empty directories it is the offset (divided by 4) of the inode of the first file in that directory. For anything else, offset is zero. */ __u32 namelen:CRAMFS_NAMELEN_WIDTH, offset:CRAMFS_OFFSET_WIDTH; }; struct cramfs_info { __u32 crc; __u32 edition; __u32 blocks; __u32 files; }; /* * Superblock information at the beginning of the FS. */ struct cramfs_super { __u32 magic; /* 0x28cd3d45 - random number */ __u32 size; /* length in bytes */ __u32 flags; /* feature flags */ __u32 future; /* reserved for future use */ __u8 signature[16]; /* "Compressed ROMFS" */ struct cramfs_info fsid; /* unique filesystem info */ __u8 name[16]; /* user-defined name */ struct cramfs_inode root; /* root inode data */ }; /* * Feature flags * * 0x00000000 - 0x000000ff: features that work for all past kernels * 0x00000100 - 0xffffffff: features that don't work for past kernels */ #define CRAMFS_FLAG_FSID_VERSION_2 0x00000001 /* fsid version #2 */ #define CRAMFS_FLAG_SORTED_DIRS 0x00000002 /* sorted dirs */ #define CRAMFS_FLAG_HOLES 0x00000100 /* support for holes */ #define CRAMFS_FLAG_WRONG_SIGNATURE 0x00000200 /* reserved */ #define CRAMFS_FLAG_SHIFTED_ROOT_OFFSET 0x00000400 /* shifted root fs */ #define CRAMFS_FLAG_EXT_BLOCK_POINTERS 0x00000800 /* block pointer extensions */ /* * Valid values in super.flags. Currently we refuse to mount * if (flags & ~CRAMFS_SUPPORTED_FLAGS). Maybe that should be * changed to test super.future instead. */ #define CRAMFS_SUPPORTED_FLAGS ( 0x000000ff \ | CRAMFS_FLAG_HOLES \ | CRAMFS_FLAG_WRONG_SIGNATURE \ | CRAMFS_FLAG_SHIFTED_ROOT_OFFSET \ | CRAMFS_FLAG_EXT_BLOCK_POINTERS ) /* * Block pointer flags * * The maximum block offset that needs to be represented is roughly: * * (1 << CRAMFS_OFFSET_WIDTH) * 4 + * (1 << CRAMFS_SIZE_WIDTH) / PAGE_SIZE * (4 + PAGE_SIZE) * = 0x11004000 * * That leaves room for 3 flag bits in the block pointer table. */ #define CRAMFS_BLK_FLAG_UNCOMPRESSED (1 << 31) #define CRAMFS_BLK_FLAG_DIRECT_PTR (1 << 30) #define CRAMFS_BLK_FLAGS ( CRAMFS_BLK_FLAG_UNCOMPRESSED \ | CRAMFS_BLK_FLAG_DIRECT_PTR ) /* * Direct blocks are at least 4-byte aligned. * Pointers to direct blocks are shifted down by 2 bits. */ #define CRAMFS_BLK_DIRECT_PTR_SHIFT 2 #endif /* __CRAMFS_H */ �����������������������������linux/blktrace_api.h��������������������������������������������������������������������������������0000644�����������������00000011135�14763166027�0010511 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef BLKTRACE_H #define BLKTRACE_H #include <linux/types.h> /* * Trace categories */ enum blktrace_cat { BLK_TC_READ = 1 << 0, /* reads */ BLK_TC_WRITE = 1 << 1, /* writes */ BLK_TC_FLUSH = 1 << 2, /* flush */ BLK_TC_SYNC = 1 << 3, /* sync IO */ BLK_TC_SYNCIO = BLK_TC_SYNC, BLK_TC_QUEUE = 1 << 4, /* queueing/merging */ BLK_TC_REQUEUE = 1 << 5, /* requeueing */ BLK_TC_ISSUE = 1 << 6, /* issue */ BLK_TC_COMPLETE = 1 << 7, /* completions */ BLK_TC_FS = 1 << 8, /* fs requests */ BLK_TC_PC = 1 << 9, /* pc requests */ BLK_TC_NOTIFY = 1 << 10, /* special message */ BLK_TC_AHEAD = 1 << 11, /* readahead */ BLK_TC_META = 1 << 12, /* metadata */ BLK_TC_DISCARD = 1 << 13, /* discard requests */ BLK_TC_DRV_DATA = 1 << 14, /* binary per-driver data */ BLK_TC_FUA = 1 << 15, /* fua requests */ BLK_TC_END = 1 << 15, /* we've run out of bits! */ }; #define BLK_TC_SHIFT (16) #define BLK_TC_ACT(act) ((act) << BLK_TC_SHIFT) /* * Basic trace actions */ enum blktrace_act { __BLK_TA_QUEUE = 1, /* queued */ __BLK_TA_BACKMERGE, /* back merged to existing rq */ __BLK_TA_FRONTMERGE, /* front merge to existing rq */ __BLK_TA_GETRQ, /* allocated new request */ __BLK_TA_SLEEPRQ, /* sleeping on rq allocation */ __BLK_TA_REQUEUE, /* request requeued */ __BLK_TA_ISSUE, /* sent to driver */ __BLK_TA_COMPLETE, /* completed by driver */ __BLK_TA_PLUG, /* queue was plugged */ __BLK_TA_UNPLUG_IO, /* queue was unplugged by io */ __BLK_TA_UNPLUG_TIMER, /* queue was unplugged by timer */ __BLK_TA_INSERT, /* insert request */ __BLK_TA_SPLIT, /* bio was split */ __BLK_TA_BOUNCE, /* bio was bounced */ __BLK_TA_REMAP, /* bio was remapped */ __BLK_TA_ABORT, /* request aborted */ __BLK_TA_DRV_DATA, /* driver-specific binary data */ __BLK_TA_CGROUP = 1 << 8, /* from a cgroup*/ }; /* * Notify events. */ enum blktrace_notify { __BLK_TN_PROCESS = 0, /* establish pid/name mapping */ __BLK_TN_TIMESTAMP, /* include system clock */ __BLK_TN_MESSAGE, /* Character string message */ __BLK_TN_CGROUP = __BLK_TA_CGROUP, /* from a cgroup */ }; /* * Trace actions in full. Additionally, read or write is masked */ #define BLK_TA_QUEUE (__BLK_TA_QUEUE | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_BACKMERGE (__BLK_TA_BACKMERGE | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_FRONTMERGE (__BLK_TA_FRONTMERGE | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_GETRQ (__BLK_TA_GETRQ | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_SLEEPRQ (__BLK_TA_SLEEPRQ | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_REQUEUE (__BLK_TA_REQUEUE | BLK_TC_ACT(BLK_TC_REQUEUE)) #define BLK_TA_ISSUE (__BLK_TA_ISSUE | BLK_TC_ACT(BLK_TC_ISSUE)) #define BLK_TA_COMPLETE (__BLK_TA_COMPLETE| BLK_TC_ACT(BLK_TC_COMPLETE)) #define BLK_TA_PLUG (__BLK_TA_PLUG | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_UNPLUG_IO (__BLK_TA_UNPLUG_IO | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_UNPLUG_TIMER (__BLK_TA_UNPLUG_TIMER | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_INSERT (__BLK_TA_INSERT | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_SPLIT (__BLK_TA_SPLIT) #define BLK_TA_BOUNCE (__BLK_TA_BOUNCE) #define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_ABORT (__BLK_TA_ABORT | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_DRV_DATA (__BLK_TA_DRV_DATA | BLK_TC_ACT(BLK_TC_DRV_DATA)) #define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY)) #define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY)) #define BLK_TN_MESSAGE (__BLK_TN_MESSAGE | BLK_TC_ACT(BLK_TC_NOTIFY)) #define BLK_IO_TRACE_MAGIC 0x65617400 #define BLK_IO_TRACE_VERSION 0x07 /* * The trace itself */ struct blk_io_trace { __u32 magic; /* MAGIC << 8 | version */ __u32 sequence; /* event number */ __u64 time; /* in nanoseconds */ __u64 sector; /* disk offset */ __u32 bytes; /* transfer length */ __u32 action; /* what happened */ __u32 pid; /* who did it */ __u32 device; /* device number */ __u32 cpu; /* on what cpu did it happen */ __u16 error; /* completion error */ __u16 pdu_len; /* length of data after this trace */ /* cgroup id will be stored here if exists */ }; /* * The remap event */ struct blk_io_trace_remap { __be32 device_from; __be32 device_to; __be64 sector_from; }; enum { Blktrace_setup = 1, Blktrace_running, Blktrace_stopped, }; #define BLKTRACE_BDEV_SIZE 32 /* * User setup structure passed with BLKTRACESETUP */ struct blk_user_trace_setup { char name[BLKTRACE_BDEV_SIZE]; /* output */ __u16 act_mask; /* input */ __u32 buf_size; /* input */ __u32 buf_nr; /* input */ __u64 start_lba; __u64 end_lba; __u32 pid; }; #endif /* BLKTRACE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/nbd.h�����������������������������������������������������������������������������������������0000644�����������������00000005720�14763166027�0006637 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* * 1999 Copyright (C) Pavel Machek, pavel@ucw.cz. This code is GPL. * 1999/11/04 Copyright (C) 1999 VMware, Inc. (Regis "HPReg" Duchesne) * Made nbd_end_request() use the io_request_lock * 2001 Copyright (C) Steven Whitehouse * New nbd_end_request() for compatibility with new linux block * layer code. * 2003/06/24 Louis D. Langholtz <ldl@aros.net> * Removed unneeded blksize_bits field from nbd_device struct. * Cleanup PARANOIA usage & code. * 2004/02/19 Paul Clements * Removed PARANOIA, plus various cleanup and comments */ #ifndef LINUX_NBD_H #define LINUX_NBD_H #include <linux/types.h> #define NBD_SET_SOCK _IO( 0xab, 0 ) #define NBD_SET_BLKSIZE _IO( 0xab, 1 ) #define NBD_SET_SIZE _IO( 0xab, 2 ) #define NBD_DO_IT _IO( 0xab, 3 ) #define NBD_CLEAR_SOCK _IO( 0xab, 4 ) #define NBD_CLEAR_QUE _IO( 0xab, 5 ) #define NBD_PRINT_DEBUG _IO( 0xab, 6 ) #define NBD_SET_SIZE_BLOCKS _IO( 0xab, 7 ) #define NBD_DISCONNECT _IO( 0xab, 8 ) #define NBD_SET_TIMEOUT _IO( 0xab, 9 ) #define NBD_SET_FLAGS _IO( 0xab, 10) enum { NBD_CMD_READ = 0, NBD_CMD_WRITE = 1, NBD_CMD_DISC = 2, NBD_CMD_FLUSH = 3, NBD_CMD_TRIM = 4 }; /* values for flags field, these are server interaction specific. */ #define NBD_FLAG_HAS_FLAGS (1 << 0) /* nbd-server supports flags */ #define NBD_FLAG_READ_ONLY (1 << 1) /* device is read-only */ #define NBD_FLAG_SEND_FLUSH (1 << 2) /* can flush writeback cache */ #define NBD_FLAG_SEND_FUA (1 << 3) /* send FUA (forced unit access) */ /* there is a gap here to match userspace */ #define NBD_FLAG_SEND_TRIM (1 << 5) /* send trim/discard */ #define NBD_FLAG_CAN_MULTI_CONN (1 << 8) /* Server supports multiple connections per export. */ /* values for cmd flags in the upper 16 bits of request type */ #define NBD_CMD_FLAG_FUA (1 << 16) /* FUA (forced unit access) op */ /* These are client behavior specific flags. */ #define NBD_CFLAG_DESTROY_ON_DISCONNECT (1 << 0) /* delete the nbd device on disconnect. */ #define NBD_CFLAG_DISCONNECT_ON_CLOSE (1 << 1) /* disconnect the nbd device on * close by last opener. */ /* userspace doesn't need the nbd_device structure */ /* These are sent over the network in the request/reply magic fields */ #define NBD_REQUEST_MAGIC 0x25609513 #define NBD_REPLY_MAGIC 0x67446698 /* Do *not* use magics: 0x12560953 0x96744668. */ /* * This is the packet used for communication between client and * server. All data are in network byte order. */ struct nbd_request { __be32 magic; __be32 type; /* == READ || == WRITE */ char handle[8]; __be64 from; __be32 len; } __attribute__((packed)); /* * This is the reply packet that nbd-server sends back to the client after * it has completed an I/O request (or an error occurs). */ struct nbd_reply { __be32 magic; __be32 error; /* 0 = ok, else error */ char handle[8]; /* handle you got from request */ }; #endif /* LINUX_NBD_H */ ������������������������������������������������linux/atmsvc.h��������������������������������������������������������������������������������������0000644�����������������00000003475�14763166027�0007376 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atmsvc.h - ATM signaling kernel-demon interface definitions */ /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ #ifndef _LINUX_ATMSVC_H #define _LINUX_ATMSVC_H #include <linux/atmapi.h> #include <linux/atm.h> #include <linux/atmioc.h> #define ATMSIGD_CTRL _IO('a',ATMIOC_SPECIAL) /* become ATM signaling demon control socket */ enum atmsvc_msg_type { as_catch_null, as_bind, as_connect, as_accept, as_reject, as_listen, as_okay, as_error, as_indicate, as_close, as_itf_notify, as_modify, as_identify, as_terminate, as_addparty, as_dropparty }; struct atmsvc_msg { enum atmsvc_msg_type type; atm_kptr_t vcc; atm_kptr_t listen_vcc; /* indicate */ int reply; /* for okay and close: */ /* < 0: error before active */ /* (sigd has discarded ctx) */ /* ==0: success */ /* > 0: error when active (still */ /* need to close) */ struct sockaddr_atmpvc pvc; /* indicate, okay (connect) */ struct sockaddr_atmsvc local; /* local SVC address */ struct atm_qos qos; /* QOS parameters */ struct atm_sap sap; /* SAP */ unsigned int session; /* for p2pm */ struct sockaddr_atmsvc svc; /* SVC address */ } __ATM_API_ALIGN; /* * Message contents: see ftp://icaftp.epfl.ch/pub/linux/atm/docs/isp-*.tar.gz */ /* * Some policy stuff for atmsigd and for net/atm/svc.c. Both have to agree on * what PCR is used to request bandwidth from the device driver. net/atm/svc.c * tries to do better than that, but only if there's no routing decision (i.e. * if signaling only uses one ATM interface). */ #define SELECT_TOP_PCR(tp) ((tp).pcr ? (tp).pcr : \ (tp).max_pcr && (tp).max_pcr != ATM_MAX_PCR ? (tp).max_pcr : \ (tp).min_pcr ? (tp).min_pcr : ATM_MAX_PCR) #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/phonet.h��������������������������������������������������������������������������������������0000644�����������������00000011105�14763166027�0007363 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /** * file phonet.h * * Phonet sockets kernel interface * * Copyright (C) 2008 Nokia Corporation. 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 * version 2 as published by the Free Software Foundation. * * 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., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #ifndef LINUX_PHONET_H #define LINUX_PHONET_H #include <linux/types.h> #include <linux/socket.h> /* Automatic protocol selection */ #define PN_PROTO_TRANSPORT 0 /* Phonet datagram socket */ #define PN_PROTO_PHONET 1 /* Phonet pipe */ #define PN_PROTO_PIPE 2 #define PHONET_NPROTO 3 /* Socket options for SOL_PNPIPE level */ #define PNPIPE_ENCAP 1 #define PNPIPE_IFINDEX 2 #define PNPIPE_HANDLE 3 #define PNPIPE_INITSTATE 4 #define PNADDR_ANY 0 #define PNADDR_BROADCAST 0xFC #define PNPORT_RESOURCE_ROUTING 0 /* Values for PNPIPE_ENCAP option */ #define PNPIPE_ENCAP_NONE 0 #define PNPIPE_ENCAP_IP 1 /* ioctls */ #define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0) #define SIOCPNENABLEPIPE (SIOCPROTOPRIVATE + 13) #define SIOCPNADDRESOURCE (SIOCPROTOPRIVATE + 14) #define SIOCPNDELRESOURCE (SIOCPROTOPRIVATE + 15) /* Phonet protocol header */ struct phonethdr { __u8 pn_rdev; __u8 pn_sdev; __u8 pn_res; __be16 pn_length; __u8 pn_robj; __u8 pn_sobj; } __attribute__((packed)); /* Common Phonet payload header */ struct phonetmsg { __u8 pn_trans_id; /* transaction ID */ __u8 pn_msg_id; /* message type */ union { struct { __u8 pn_submsg_id; /* message subtype */ __u8 pn_data[5]; } base; struct { __u16 pn_e_res_id; /* extended resource ID */ __u8 pn_e_submsg_id; /* message subtype */ __u8 pn_e_data[3]; } ext; } pn_msg_u; }; #define PN_COMMON_MESSAGE 0xF0 #define PN_COMMGR 0x10 #define PN_PREFIX 0xE0 /* resource for extended messages */ #define pn_submsg_id pn_msg_u.base.pn_submsg_id #define pn_e_submsg_id pn_msg_u.ext.pn_e_submsg_id #define pn_e_res_id pn_msg_u.ext.pn_e_res_id #define pn_data pn_msg_u.base.pn_data #define pn_e_data pn_msg_u.ext.pn_e_data /* data for unreachable errors */ #define PN_COMM_SERVICE_NOT_IDENTIFIED_RESP 0x01 #define PN_COMM_ISA_ENTITY_NOT_REACHABLE_RESP 0x14 #define pn_orig_msg_id pn_data[0] #define pn_status pn_data[1] #define pn_e_orig_msg_id pn_e_data[0] #define pn_e_status pn_e_data[1] /* Phonet socket address structure */ struct sockaddr_pn { __kernel_sa_family_t spn_family; __u8 spn_obj; __u8 spn_dev; __u8 spn_resource; __u8 spn_zero[sizeof(struct sockaddr) - sizeof(__kernel_sa_family_t) - 3]; } __attribute__((packed)); /* Well known address */ #define PN_DEV_PC 0x10 static __inline__ __u16 pn_object(__u8 addr, __u16 port) { return (addr << 8) | (port & 0x3ff); } static __inline__ __u8 pn_obj(__u16 handle) { return handle & 0xff; } static __inline__ __u8 pn_dev(__u16 handle) { return handle >> 8; } static __inline__ __u16 pn_port(__u16 handle) { return handle & 0x3ff; } static __inline__ __u8 pn_addr(__u16 handle) { return (handle >> 8) & 0xfc; } static __inline__ void pn_sockaddr_set_addr(struct sockaddr_pn *spn, __u8 addr) { spn->spn_dev &= 0x03; spn->spn_dev |= addr & 0xfc; } static __inline__ void pn_sockaddr_set_port(struct sockaddr_pn *spn, __u16 port) { spn->spn_dev &= 0xfc; spn->spn_dev |= (port >> 8) & 0x03; spn->spn_obj = port & 0xff; } static __inline__ void pn_sockaddr_set_object(struct sockaddr_pn *spn, __u16 handle) { spn->spn_dev = pn_dev(handle); spn->spn_obj = pn_obj(handle); } static __inline__ void pn_sockaddr_set_resource(struct sockaddr_pn *spn, __u8 resource) { spn->spn_resource = resource; } static __inline__ __u8 pn_sockaddr_get_addr(const struct sockaddr_pn *spn) { return spn->spn_dev & 0xfc; } static __inline__ __u16 pn_sockaddr_get_port(const struct sockaddr_pn *spn) { return ((spn->spn_dev & 0x03) << 8) | spn->spn_obj; } static __inline__ __u16 pn_sockaddr_get_object(const struct sockaddr_pn *spn) { return pn_object(spn->spn_dev, spn->spn_obj); } static __inline__ __u8 pn_sockaddr_get_resource(const struct sockaddr_pn *spn) { return spn->spn_resource; } /* Phonet device ioctl requests */ #endif /* LINUX_PHONET_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/sync_file.h�����������������������������������������������������������������������������������0000644�����������������00000005503�14763166027�0010046 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* * Copyright (C) 2012 Google, Inc. * * 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. * */ #ifndef _LINUX_SYNC_H #define _LINUX_SYNC_H #include <linux/ioctl.h> #include <linux/types.h> /** * struct sync_merge_data - data passed to merge ioctl * @name: name of new fence * @fd2: file descriptor of second fence * @fence: returns the fd of the new fence to userspace * @flags: merge_data flags * @pad: padding for 64-bit alignment, should always be zero */ struct sync_merge_data { char name[32]; __s32 fd2; __s32 fence; __u32 flags; __u32 pad; }; /** * struct sync_fence_info - detailed fence information * @obj_name: name of parent sync_timeline * @driver_name: name of driver implementing the parent * @status: status of the fence 0:active 1:signaled <0:error * @flags: fence_info flags * @timestamp_ns: timestamp of status change in nanoseconds */ struct sync_fence_info { char obj_name[32]; char driver_name[32]; __s32 status; __u32 flags; __u64 timestamp_ns; }; /** * struct sync_file_info - data returned from fence info ioctl * @name: name of fence * @status: status of fence. 1: signaled 0:active <0:error * @flags: sync_file_info flags * @num_fences number of fences in the sync_file * @pad: padding for 64-bit alignment, should always be zero * @sync_fence_info: pointer to array of structs sync_fence_info with all * fences in the sync_file */ struct sync_file_info { char name[32]; __s32 status; __u32 flags; __u32 num_fences; __u32 pad; __u64 sync_fence_info; }; #define SYNC_IOC_MAGIC '>' /** * Opcodes 0, 1 and 2 were burned during a API change to avoid users of the * old API to get weird errors when trying to handling sync_files. The API * change happened during the de-stage of the Sync Framework when there was * no upstream users available. */ /** * DOC: SYNC_IOC_MERGE - merge two fences * * Takes a struct sync_merge_data. Creates a new fence containing copies of * the sync_pts in both the calling fd and sync_merge_data.fd2. Returns the * new fence's fd in sync_merge_data.fence */ #define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data) /** * DOC: SYNC_IOC_FILE_INFO - get detailed information on a sync_file * * Takes a struct sync_file_info. If num_fences is 0, the field is updated * with the actual number of fences. If num_fences is > 0, the system will * use the pointer provided on sync_fence_info to return up to num_fences of * struct sync_fence_info, with detailed fence information. */ #define SYNC_IOC_FILE_INFO _IOWR(SYNC_IOC_MAGIC, 4, struct sync_file_info) #endif /* _LINUX_SYNC_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/signalfd.h������������������������������������������������������������������������������������0000644�����������������00000002321�14763166027�0007655 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/linux/signalfd.h * * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org> * */ #ifndef _LINUX_SIGNALFD_H #define _LINUX_SIGNALFD_H #include <linux/types.h> /* For O_CLOEXEC and O_NONBLOCK */ #include <linux/fcntl.h> /* Flags for signalfd4. */ #define SFD_CLOEXEC O_CLOEXEC #define SFD_NONBLOCK O_NONBLOCK struct signalfd_siginfo { __u32 ssi_signo; __s32 ssi_errno; __s32 ssi_code; __u32 ssi_pid; __u32 ssi_uid; __s32 ssi_fd; __u32 ssi_tid; __u32 ssi_band; __u32 ssi_overrun; __u32 ssi_trapno; __s32 ssi_status; __s32 ssi_int; __u64 ssi_ptr; __u64 ssi_utime; __u64 ssi_stime; __u64 ssi_addr; __u16 ssi_addr_lsb; __u16 __pad2; __s32 ssi_syscall; __u64 ssi_call_addr; __u32 ssi_arch; /* * Pad strcture to 128 bytes. Remember to update the * pad size when you add new members. We use a fixed * size structure to avoid compatibility problems with * future versions, and we leave extra space for additional * members. We use fixed size members because this strcture * comes out of a read(2) and we really don't want to have * a compat on read(2). */ __u8 __pad[28]; }; #endif /* _LINUX_SIGNALFD_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_infiniband.h�������������������������������������������������������������������������������0000644�����������������00000002335�14763166027�0010652 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ /* * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available at * <http://www.fsf.org/copyleft/gpl.html>, or the OpenIB.org BSD * license, available in the LICENSE.TXT file accompanying this * software. These details are also available at * <http://www.openfabrics.org/software_license.htm>. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Copyright (c) 2004 Topspin Communications. All rights reserved. * * $Id$ */ #ifndef _LINUX_IF_INFINIBAND_H #define _LINUX_IF_INFINIBAND_H #define INFINIBAND_ALEN 20 /* Octets in IPoIB HW addr */ #endif /* _LINUX_IF_INFINIBAND_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/virtio_ring.h���������������������������������������������������������������������������������0000644�����������������00000014300�14763166027�0010421 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _LINUX_VIRTIO_RING_H #define _LINUX_VIRTIO_RING_H /* An interface for efficient virtio implementation, currently for use by KVM, * but hopefully others soon. Do NOT change this since it will * break existing servers and clients. * * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Copyright Rusty Russell IBM Corporation 2007. */ #include <stdint.h> #include <linux/types.h> #include <linux/virtio_types.h> /* This marks a buffer as continuing via the next field. */ #define VRING_DESC_F_NEXT 1 /* This marks a buffer as write-only (otherwise read-only). */ #define VRING_DESC_F_WRITE 2 /* This means the buffer contains a list of buffer descriptors. */ #define VRING_DESC_F_INDIRECT 4 /* The Host uses this in used->flags to advise the Guest: don't kick me when * you add a buffer. It's unreliable, so it's simply an optimization. Guest * will still kick if it's out of buffers. */ #define VRING_USED_F_NO_NOTIFY 1 /* The Guest uses this in avail->flags to advise the Host: don't interrupt me * when you consume a buffer. It's unreliable, so it's simply an * optimization. */ #define VRING_AVAIL_F_NO_INTERRUPT 1 /* We support indirect buffer descriptors */ #define VIRTIO_RING_F_INDIRECT_DESC 28 /* The Guest publishes the used index for which it expects an interrupt * at the end of the avail ring. Host should ignore the avail->flags field. */ /* The Host publishes the avail index for which it expects a kick * at the end of the used ring. Guest should ignore the used->flags field. */ #define VIRTIO_RING_F_EVENT_IDX 29 /* Virtio ring descriptors: 16 bytes. These can chain together via "next". */ struct vring_desc { /* Address (guest-physical). */ __virtio64 addr; /* Length. */ __virtio32 len; /* The flags as indicated above. */ __virtio16 flags; /* We chain unused descriptors via this, too */ __virtio16 next; }; struct vring_avail { __virtio16 flags; __virtio16 idx; __virtio16 ring[]; }; /* u32 is used here for ids for padding reasons. */ struct vring_used_elem { /* Index of start of used descriptor chain. */ __virtio32 id; /* Total length of the descriptor chain which was used (written to) */ __virtio32 len; }; struct vring_used { __virtio16 flags; __virtio16 idx; struct vring_used_elem ring[]; }; struct vring { unsigned int num; struct vring_desc *desc; struct vring_avail *avail; struct vring_used *used; }; /* Alignment requirements for vring elements. * When using pre-virtio 1.0 layout, these fall out naturally. */ #define VRING_AVAIL_ALIGN_SIZE 2 #define VRING_USED_ALIGN_SIZE 4 #define VRING_DESC_ALIGN_SIZE 16 /* The standard layout for the ring is a continuous chunk of memory which looks * like this. We assume num is a power of 2. * * struct vring * { * // The actual descriptors (16 bytes each) * struct vring_desc desc[num]; * * // A ring of available descriptor heads with free-running index. * __virtio16 avail_flags; * __virtio16 avail_idx; * __virtio16 available[num]; * __virtio16 used_event_idx; * * // Padding to the next align boundary. * char pad[]; * * // A ring of used descriptor heads with free-running index. * __virtio16 used_flags; * __virtio16 used_idx; * struct vring_used_elem used[num]; * __virtio16 avail_event_idx; * }; */ /* We publish the used event index at the end of the available ring, and vice * versa. They are at the end for backwards compatibility. */ #define vring_used_event(vr) ((vr)->avail->ring[(vr)->num]) #define vring_avail_event(vr) (*(__virtio16 *)&(vr)->used->ring[(vr)->num]) static __inline__ void vring_init(struct vring *vr, unsigned int num, void *p, unsigned long align) { vr->num = num; vr->desc = p; vr->avail = p + num*sizeof(struct vring_desc); vr->used = (void *)(((uintptr_t)&vr->avail->ring[num] + sizeof(__virtio16) + align-1) & ~(align - 1)); } static __inline__ unsigned vring_size(unsigned int num, unsigned long align) { return ((sizeof(struct vring_desc) * num + sizeof(__virtio16) * (3 + num) + align - 1) & ~(align - 1)) + sizeof(__virtio16) * 3 + sizeof(struct vring_used_elem) * num; } /* The following is used with USED_EVENT_IDX and AVAIL_EVENT_IDX */ /* Assuming a given event_idx value from the other side, if * we have just incremented index from old to new_idx, * should we trigger an event? */ static __inline__ int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old) { /* Note: Xen has similar logic for notification hold-off * in include/xen/interface/io/ring.h with req_event and req_prod * corresponding to event_idx + 1 and new_idx respectively. * Note also that req_event and req_prod in Xen start at 1, * event indexes in virtio start at 0. */ return (__u16)(new_idx - event_idx - 1) < (__u16)(new_idx - old); } #endif /* _LINUX_VIRTIO_RING_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/raid/md_p.h�����������������������������������������������������������������������������������0000644�����������������00000037441�14763166027�0007737 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* md_p.h : physical layout of Linux RAID devices Copyright (C) 1996-98 Ingo Molnar, Gadi Oxman 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, or (at your option) any later version. You should have received a copy of the GNU General Public License (for example /usr/src/linux/COPYING); if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _MD_P_H #define _MD_P_H #include <linux/types.h> #include <asm/byteorder.h> /* * RAID superblock. * * The RAID superblock maintains some statistics on each RAID configuration. * Each real device in the RAID set contains it near the end of the device. * Some of the ideas are copied from the ext2fs implementation. * * We currently use 4096 bytes as follows: * * word offset function * * 0 - 31 Constant generic RAID device information. * 32 - 63 Generic state information. * 64 - 127 Personality specific information. * 128 - 511 12 32-words descriptors of the disks in the raid set. * 512 - 911 Reserved. * 912 - 1023 Disk specific descriptor. */ /* * If x is the real device size in bytes, we return an apparent size of: * * y = (x & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES * * and place the 4kB superblock at offset y. */ #define MD_RESERVED_BYTES (64 * 1024) #define MD_RESERVED_SECTORS (MD_RESERVED_BYTES / 512) #define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS) #define MD_SB_BYTES 4096 #define MD_SB_WORDS (MD_SB_BYTES / 4) #define MD_SB_SECTORS (MD_SB_BYTES / 512) /* * The following are counted in 32-bit words */ #define MD_SB_GENERIC_OFFSET 0 #define MD_SB_PERSONALITY_OFFSET 64 #define MD_SB_DISKS_OFFSET 128 #define MD_SB_DESCRIPTOR_OFFSET 992 #define MD_SB_GENERIC_CONSTANT_WORDS 32 #define MD_SB_GENERIC_STATE_WORDS 32 #define MD_SB_GENERIC_WORDS (MD_SB_GENERIC_CONSTANT_WORDS + MD_SB_GENERIC_STATE_WORDS) #define MD_SB_PERSONALITY_WORDS 64 #define MD_SB_DESCRIPTOR_WORDS 32 #define MD_SB_DISKS 27 #define MD_SB_DISKS_WORDS (MD_SB_DISKS*MD_SB_DESCRIPTOR_WORDS) #define MD_SB_RESERVED_WORDS (1024 - MD_SB_GENERIC_WORDS - MD_SB_PERSONALITY_WORDS - MD_SB_DISKS_WORDS - MD_SB_DESCRIPTOR_WORDS) #define MD_SB_EQUAL_WORDS (MD_SB_GENERIC_WORDS + MD_SB_PERSONALITY_WORDS + MD_SB_DISKS_WORDS) /* * Device "operational" state bits */ #define MD_DISK_FAULTY 0 /* disk is faulty / operational */ #define MD_DISK_ACTIVE 1 /* disk is running or spare disk */ #define MD_DISK_SYNC 2 /* disk is in sync with the raid set */ #define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */ #define MD_DISK_CLUSTER_ADD 4 /* Initiate a disk add across the cluster * For clustered enviroments only. */ #define MD_DISK_CANDIDATE 5 /* disk is added as spare (local) until confirmed * For clustered enviroments only. */ #define MD_DISK_FAILFAST 10 /* Send REQ_FAILFAST if there are multiple * devices available - and don't try to * correct read errors. */ #define MD_DISK_WRITEMOSTLY 9 /* disk is "write-mostly" is RAID1 config. * read requests will only be sent here in * dire need */ #define MD_DISK_JOURNAL 18 /* disk is used as the write journal in RAID-5/6 */ #define MD_DISK_ROLE_SPARE 0xffff #define MD_DISK_ROLE_FAULTY 0xfffe #define MD_DISK_ROLE_JOURNAL 0xfffd #define MD_DISK_ROLE_MAX 0xff00 /* max value of regular disk role */ typedef struct mdp_device_descriptor_s { __u32 number; /* 0 Device number in the entire set */ __u32 major; /* 1 Device major number */ __u32 minor; /* 2 Device minor number */ __u32 raid_disk; /* 3 The role of the device in the raid set */ __u32 state; /* 4 Operational state */ __u32 reserved[MD_SB_DESCRIPTOR_WORDS - 5]; } mdp_disk_t; #define MD_SB_MAGIC 0xa92b4efc /* * Superblock state bits */ #define MD_SB_CLEAN 0 #define MD_SB_ERRORS 1 #define MD_SB_CLUSTERED 5 /* MD is clustered */ #define MD_SB_BITMAP_PRESENT 8 /* bitmap may be present nearby */ /* * Notes: * - if an array is being reshaped (restriped) in order to change the * the number of active devices in the array, 'raid_disks' will be * the larger of the old and new numbers. 'delta_disks' will * be the "new - old". So if +ve, raid_disks is the new value, and * "raid_disks-delta_disks" is the old. If -ve, raid_disks is the * old value and "raid_disks+delta_disks" is the new (smaller) value. */ typedef struct mdp_superblock_s { /* * Constant generic information */ __u32 md_magic; /* 0 MD identifier */ __u32 major_version; /* 1 major version to which the set conforms */ __u32 minor_version; /* 2 minor version ... */ __u32 patch_version; /* 3 patchlevel version ... */ __u32 gvalid_words; /* 4 Number of used words in this section */ __u32 set_uuid0; /* 5 Raid set identifier */ __u32 ctime; /* 6 Creation time */ __u32 level; /* 7 Raid personality */ __u32 size; /* 8 Apparent size of each individual disk */ __u32 nr_disks; /* 9 total disks in the raid set */ __u32 raid_disks; /* 10 disks in a fully functional raid set */ __u32 md_minor; /* 11 preferred MD minor device number */ __u32 not_persistent; /* 12 does it have a persistent superblock */ __u32 set_uuid1; /* 13 Raid set identifier #2 */ __u32 set_uuid2; /* 14 Raid set identifier #3 */ __u32 set_uuid3; /* 15 Raid set identifier #4 */ __u32 gstate_creserved[MD_SB_GENERIC_CONSTANT_WORDS - 16]; /* * Generic state information */ __u32 utime; /* 0 Superblock update time */ __u32 state; /* 1 State bits (clean, ...) */ __u32 active_disks; /* 2 Number of currently active disks */ __u32 working_disks; /* 3 Number of working disks */ __u32 failed_disks; /* 4 Number of failed disks */ __u32 spare_disks; /* 5 Number of spare disks */ __u32 sb_csum; /* 6 checksum of the whole superblock */ #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN) __u32 events_hi; /* 7 high-order of superblock update count */ __u32 events_lo; /* 8 low-order of superblock update count */ __u32 cp_events_hi; /* 9 high-order of checkpoint update count */ __u32 cp_events_lo; /* 10 low-order of checkpoint update count */ #elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN) __u32 events_lo; /* 7 low-order of superblock update count */ __u32 events_hi; /* 8 high-order of superblock update count */ __u32 cp_events_lo; /* 9 low-order of checkpoint update count */ __u32 cp_events_hi; /* 10 high-order of checkpoint update count */ #else #error unspecified endianness #endif __u32 recovery_cp; /* 11 recovery checkpoint sector count */ /* There are only valid for minor_version > 90 */ __u64 reshape_position; /* 12,13 next address in array-space for reshape */ __u32 new_level; /* 14 new level we are reshaping to */ __u32 delta_disks; /* 15 change in number of raid_disks */ __u32 new_layout; /* 16 new layout */ __u32 new_chunk; /* 17 new chunk size (bytes) */ __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 18]; /* * Personality information */ __u32 layout; /* 0 the array's physical layout */ __u32 chunk_size; /* 1 chunk size in bytes */ __u32 root_pv; /* 2 LV root PV */ __u32 root_block; /* 3 LV root block */ __u32 pstate_reserved[MD_SB_PERSONALITY_WORDS - 4]; /* * Disks information */ mdp_disk_t disks[MD_SB_DISKS]; /* * Reserved */ __u32 reserved[MD_SB_RESERVED_WORDS]; /* * Active descriptor */ mdp_disk_t this_disk; } mdp_super_t; static __inline__ __u64 md_event(mdp_super_t *sb) { __u64 ev = sb->events_hi; return (ev<<32)| sb->events_lo; } #define MD_SUPERBLOCK_1_TIME_SEC_MASK ((1ULL<<40) - 1) /* * The version-1 superblock : * All numeric fields are little-endian. * * total size: 256 bytes plus 2 per device. * 1K allows 384 devices. */ struct mdp_superblock_1 { /* constant array information - 128 bytes */ __le32 magic; /* MD_SB_MAGIC: 0xa92b4efc - little endian */ __le32 major_version; /* 1 */ __le32 feature_map; /* bit 0 set if 'bitmap_offset' is meaningful */ __le32 pad0; /* always set to 0 when writing */ __u8 set_uuid[16]; /* user-space generated. */ char set_name[32]; /* set and interpreted by user-space */ __le64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/ __le32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */ __le32 layout; /* only for raid5 and raid10 currently */ __le64 size; /* used size of component devices, in 512byte sectors */ __le32 chunksize; /* in 512byte sectors */ __le32 raid_disks; union { __le32 bitmap_offset; /* sectors after start of superblock that bitmap starts * NOTE: signed, so bitmap can be before superblock * only meaningful of feature_map[0] is set. */ /* only meaningful when feature_map[MD_FEATURE_PPL] is set */ struct { __le16 offset; /* sectors from start of superblock that ppl starts (signed) */ __le16 size; /* ppl size in sectors */ } ppl; }; /* These are only valid with feature bit '4' */ __le32 new_level; /* new level we are reshaping to */ __le64 reshape_position; /* next address in array-space for reshape */ __le32 delta_disks; /* change in number of raid_disks */ __le32 new_layout; /* new layout */ __le32 new_chunk; /* new chunk size (512byte sectors) */ __le32 new_offset; /* signed number to add to data_offset in new * layout. 0 == no-change. This can be * different on each device in the array. */ /* constant this-device information - 64 bytes */ __le64 data_offset; /* sector start of data, often 0 */ __le64 data_size; /* sectors in this device that can be used for data */ __le64 super_offset; /* sector start of this superblock */ union { __le64 recovery_offset;/* sectors before this offset (from data_offset) have been recovered */ __le64 journal_tail;/* journal tail of journal device (from data_offset) */ }; __le32 dev_number; /* permanent identifier of this device - not role in raid */ __le32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */ __u8 device_uuid[16]; /* user-space setable, ignored by kernel */ __u8 devflags; /* per-device flags. Only two defined...*/ #define WriteMostly1 1 /* mask for writemostly flag in above */ #define FailFast1 2 /* Should avoid retries and fixups and just fail */ /* Bad block log. If there are any bad blocks the feature flag is set. * If offset and size are non-zero, that space is reserved and available */ __u8 bblog_shift; /* shift from sectors to block size */ __le16 bblog_size; /* number of sectors reserved for list */ __le32 bblog_offset; /* sector offset from superblock to bblog, * signed - not unsigned */ /* array state information - 64 bytes */ __le64 utime; /* 40 bits second, 24 bits microseconds */ __le64 events; /* incremented when superblock updated */ __le64 resync_offset; /* data before this offset (from data_offset) known to be in sync */ __le32 sb_csum; /* checksum up to devs[max_dev] */ __le32 max_dev; /* size of devs[] array to consider */ __u8 pad3[64-32]; /* set to 0 when writing */ /* device state information. Indexed by dev_number. * 2 bytes per device * Note there are no per-device state flags. State information is rolled * into the 'roles' value. If a device is spare or faulty, then it doesn't * have a meaningful role. */ __le16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */ }; /* feature_map bits */ #define MD_FEATURE_BITMAP_OFFSET 1 #define MD_FEATURE_RECOVERY_OFFSET 2 /* recovery_offset is present and * must be honoured */ #define MD_FEATURE_RESHAPE_ACTIVE 4 #define MD_FEATURE_BAD_BLOCKS 8 /* badblock list is not empty */ #define MD_FEATURE_REPLACEMENT 16 /* This device is replacing an * active device with same 'role'. * 'recovery_offset' is also set. */ #define MD_FEATURE_RESHAPE_BACKWARDS 32 /* Reshape doesn't change number * of devices, but is going * backwards anyway. */ #define MD_FEATURE_NEW_OFFSET 64 /* new_offset must be honoured */ #define MD_FEATURE_RECOVERY_BITMAP 128 /* recovery that is happening * is guided by bitmap. */ #define MD_FEATURE_CLUSTERED 256 /* clustered MD */ #define MD_FEATURE_JOURNAL 512 /* support write cache */ #define MD_FEATURE_PPL 1024 /* support PPL */ #define MD_FEATURE_MULTIPLE_PPLS 2048 /* support for multiple PPLs */ #define MD_FEATURE_RAID0_LAYOUT 4096 /* layout is meaningful for RAID0 */ #define MD_FEATURE_ALL (MD_FEATURE_BITMAP_OFFSET \ |MD_FEATURE_RECOVERY_OFFSET \ |MD_FEATURE_RESHAPE_ACTIVE \ |MD_FEATURE_BAD_BLOCKS \ |MD_FEATURE_REPLACEMENT \ |MD_FEATURE_RESHAPE_BACKWARDS \ |MD_FEATURE_NEW_OFFSET \ |MD_FEATURE_RECOVERY_BITMAP \ |MD_FEATURE_CLUSTERED \ |MD_FEATURE_JOURNAL \ |MD_FEATURE_PPL \ |MD_FEATURE_MULTIPLE_PPLS \ |MD_FEATURE_RAID0_LAYOUT \ ) struct r5l_payload_header { __le16 type; __le16 flags; } __attribute__ ((__packed__)); enum r5l_payload_type { R5LOG_PAYLOAD_DATA = 0, R5LOG_PAYLOAD_PARITY = 1, R5LOG_PAYLOAD_FLUSH = 2, }; struct r5l_payload_data_parity { struct r5l_payload_header header; __le32 size; /* sector. data/parity size. each 4k * has a checksum */ __le64 location; /* sector. For data, it's raid sector. For * parity, it's stripe sector */ __le32 checksum[]; } __attribute__ ((__packed__)); enum r5l_payload_data_parity_flag { R5LOG_PAYLOAD_FLAG_DISCARD = 1, /* payload is discard */ /* * RESHAPED/RESHAPING is only set when there is reshape activity. Note, * both data/parity of a stripe should have the same flag set * * RESHAPED: reshape is running, and this stripe finished reshape * RESHAPING: reshape is running, and this stripe isn't reshaped */ R5LOG_PAYLOAD_FLAG_RESHAPED = 2, R5LOG_PAYLOAD_FLAG_RESHAPING = 3, }; struct r5l_payload_flush { struct r5l_payload_header header; __le32 size; /* flush_stripes size, bytes */ __le64 flush_stripes[]; } __attribute__ ((__packed__)); enum r5l_payload_flush_flag { R5LOG_PAYLOAD_FLAG_FLUSH_STRIPE = 1, /* data represents whole stripe */ }; struct r5l_meta_block { __le32 magic; __le32 checksum; __u8 version; __u8 __zero_pading_1; __le16 __zero_pading_2; __le32 meta_size; /* whole size of the block */ __le64 seq; __le64 position; /* sector, start from rdev->data_offset, current position */ struct r5l_payload_header payloads[]; } __attribute__ ((__packed__)); #define R5LOG_VERSION 0x1 #define R5LOG_MAGIC 0x6433c509 struct ppl_header_entry { __le64 data_sector; /* raid sector of the new data */ __le32 pp_size; /* length of partial parity */ __le32 data_size; /* length of data */ __le32 parity_disk; /* member disk containing parity */ __le32 checksum; /* checksum of partial parity data for this * entry (~crc32c) */ } __attribute__ ((__packed__)); #define PPL_HEADER_SIZE 4096 #define PPL_HDR_RESERVED 512 #define PPL_HDR_ENTRY_SPACE \ (PPL_HEADER_SIZE - PPL_HDR_RESERVED - 4 * sizeof(__le32) - sizeof(__le64)) #define PPL_HDR_MAX_ENTRIES \ (PPL_HDR_ENTRY_SPACE / sizeof(struct ppl_header_entry)) struct ppl_header { __u8 reserved[PPL_HDR_RESERVED];/* reserved space, fill with 0xff */ __le32 signature; /* signature (family number of volume) */ __le32 padding; /* zero pad */ __le64 generation; /* generation number of the header */ __le32 entries_count; /* number of entries in entry array */ __le32 checksum; /* checksum of the header (~crc32c) */ struct ppl_header_entry entries[PPL_HDR_MAX_ENTRIES]; } __attribute__ ((__packed__)); #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/raid/md_u.h�����������������������������������������������������������������������������������0000644�����������������00000010604�14763166027�0007734 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* md_u.h : user <=> kernel API between Linux raidtools and RAID drivers Copyright (C) 1998 Ingo Molnar 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, or (at your option) any later version. You should have received a copy of the GNU General Public License (for example /usr/src/linux/COPYING); if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _MD_U_H #define _MD_U_H /* * Different major versions are not compatible. * Different minor versions are only downward compatible. * Different patchlevel versions are downward and upward compatible. */ #define MD_MAJOR_VERSION 0 #define MD_MINOR_VERSION 90 /* * MD_PATCHLEVEL_VERSION indicates kernel functionality. * >=1 means different superblock formats are selectable using SET_ARRAY_INFO * and major_version/minor_version accordingly * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT * in the super status byte * >=3 means that bitmap superblock version 4 is supported, which uses * little-ending representation rather than host-endian */ #define MD_PATCHLEVEL_VERSION 3 /* ioctls */ /* status */ #define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t) #define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t) #define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t) #define RAID_AUTORUN _IO (MD_MAJOR, 0x14) #define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t) /* configuration */ #define CLEAR_ARRAY _IO (MD_MAJOR, 0x20) #define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t) #define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22) #define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t) #define SET_DISK_INFO _IO (MD_MAJOR, 0x24) #define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25) #define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26) #define PROTECT_ARRAY _IO (MD_MAJOR, 0x27) #define HOT_ADD_DISK _IO (MD_MAJOR, 0x28) #define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29) #define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a) #define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int) /* usage */ #define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t) /* 0x31 was START_ARRAY */ #define STOP_ARRAY _IO (MD_MAJOR, 0x32) #define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33) #define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34) #define CLUSTERED_DISK_NACK _IO (MD_MAJOR, 0x35) /* 63 partitions with the alternate major number (mdp) */ #define MdpMinorShift 6 typedef struct mdu_version_s { int major; int minor; int patchlevel; } mdu_version_t; typedef struct mdu_array_info_s { /* * Generic constant information */ int major_version; int minor_version; int patch_version; unsigned int ctime; int level; int size; int nr_disks; int raid_disks; int md_minor; int not_persistent; /* * Generic state information */ unsigned int utime; /* 0 Superblock update time */ int state; /* 1 State bits (clean, ...) */ int active_disks; /* 2 Number of currently active disks */ int working_disks; /* 3 Number of working disks */ int failed_disks; /* 4 Number of failed disks */ int spare_disks; /* 5 Number of spare disks */ /* * Personality information */ int layout; /* 0 the array's physical layout */ int chunk_size; /* 1 chunk size in bytes */ } mdu_array_info_t; /* non-obvious values for 'level' */ #define LEVEL_MULTIPATH (-4) #define LEVEL_LINEAR (-1) #define LEVEL_FAULTY (-5) /* we need a value for 'no level specified' and 0 * means 'raid0', so we need something else. This is * for internal use only */ #define LEVEL_NONE (-1000000) typedef struct mdu_disk_info_s { /* * configuration/status of one particular disk */ int number; int major; int minor; int raid_disk; int state; } mdu_disk_info_t; typedef struct mdu_start_info_s { /* * configuration/status of one particular disk */ int major; int minor; int raid_disk; int state; } mdu_start_info_t; typedef struct mdu_bitmap_file_s { char pathname[4096]; } mdu_bitmap_file_t; typedef struct mdu_param_s { int personality; /* 1,2,3,4 */ int chunk_size; /* in bytes */ int max_fault; /* unused for now */ } mdu_param_t; #endif /* _MD_U_H */ ����������������������������������������������������������������������������������������������������������������������������linux/vt.h������������������������������������������������������������������������������������������0000644�����������������00000005763�14763166027�0006534 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_VT_H #define _LINUX_VT_H /* * These constants are also useful for user-level apps (e.g., VC * resizing). */ #define MIN_NR_CONSOLES 1 /* must be at least 1 */ #define MAX_NR_CONSOLES 63 /* serial lines start at 64 */ /* Note: the ioctl VT_GETSTATE does not work for consoles 16 and higher (since it returns a short) */ /* 0x56 is 'V', to avoid collision with termios and kd */ #define VT_OPENQRY 0x5600 /* find available vt */ struct vt_mode { char mode; /* vt mode */ char waitv; /* if set, hang on writes if not active */ short relsig; /* signal to raise on release req */ short acqsig; /* signal to raise on acquisition */ short frsig; /* unused (set to 0) */ }; #define VT_GETMODE 0x5601 /* get mode of active vt */ #define VT_SETMODE 0x5602 /* set mode of active vt */ #define VT_AUTO 0x00 /* auto vt switching */ #define VT_PROCESS 0x01 /* process controls switching */ #define VT_ACKACQ 0x02 /* acknowledge switch */ struct vt_stat { unsigned short v_active; /* active vt */ unsigned short v_signal; /* signal to send */ unsigned short v_state; /* vt bitmask */ }; #define VT_GETSTATE 0x5603 /* get global vt state info */ #define VT_SENDSIG 0x5604 /* signal to send to bitmask of vts */ #define VT_RELDISP 0x5605 /* release display */ #define VT_ACTIVATE 0x5606 /* make vt active */ #define VT_WAITACTIVE 0x5607 /* wait for vt active */ #define VT_DISALLOCATE 0x5608 /* free memory associated to vt */ struct vt_sizes { unsigned short v_rows; /* number of rows */ unsigned short v_cols; /* number of columns */ unsigned short v_scrollsize; /* number of lines of scrollback */ }; #define VT_RESIZE 0x5609 /* set kernel's idea of screensize */ struct vt_consize { unsigned short v_rows; /* number of rows */ unsigned short v_cols; /* number of columns */ unsigned short v_vlin; /* number of pixel rows on screen */ unsigned short v_clin; /* number of pixel rows per character */ unsigned short v_vcol; /* number of pixel columns on screen */ unsigned short v_ccol; /* number of pixel columns per character */ }; #define VT_RESIZEX 0x560A /* set kernel's idea of screensize + more */ #define VT_LOCKSWITCH 0x560B /* disallow vt switching */ #define VT_UNLOCKSWITCH 0x560C /* allow vt switching */ #define VT_GETHIFONTMASK 0x560D /* return hi font mask */ struct vt_event { unsigned int event; #define VT_EVENT_SWITCH 0x0001 /* Console switch */ #define VT_EVENT_BLANK 0x0002 /* Screen blank */ #define VT_EVENT_UNBLANK 0x0004 /* Screen unblank */ #define VT_EVENT_RESIZE 0x0008 /* Resize display */ #define VT_MAX_EVENT 0x000F unsigned int oldev; /* Old console */ unsigned int newev; /* New console (if changing) */ unsigned int pad[4]; /* Padding for expansion */ }; #define VT_WAITEVENT 0x560E /* Wait for an event */ struct vt_setactivate { unsigned int console; struct vt_mode mode; }; #define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */ #endif /* _LINUX_VT_H */ �������������linux/atm_eni.h�������������������������������������������������������������������������������������0000644�����������������00000001210�14763166027�0007476 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atm_eni.h - Driver-specific declarations of the ENI driver (for use by driver-specific utilities) */ /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ #ifndef LINUX_ATM_ENI_H #define LINUX_ATM_ENI_H #include <linux/atmioc.h> struct eni_multipliers { int tx,rx; /* values are in percent and must be > 100 */ }; #define ENI_MEMDUMP _IOW('a',ATMIOC_SARPRV,struct atmif_sioc) /* printk memory map */ #define ENI_SETMULT _IOW('a',ATMIOC_SARPRV+7,struct atmif_sioc) /* set buffer multipliers */ #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/vbox_vmmdev_types.h���������������������������������������������������������������������������0000644�����������������00000020244�14763166027�0011652 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: (GPL-2.0 OR CDDL-1.0) */ /* * Virtual Device for Guest <-> VMM/Host communication, type definitions * which are also used for the vboxguest ioctl interface / by vboxsf * * Copyright (C) 2006-2016 Oracle Corporation */ #ifndef __UAPI_VBOX_VMMDEV_TYPES_H__ #define __UAPI_VBOX_VMMDEV_TYPES_H__ #include <asm/bitsperlong.h> #include <linux/types.h> /* * We cannot use linux' compiletime_assert here because it expects to be used * inside a function only. Use a typedef to a char array with a negative size. */ #define VMMDEV_ASSERT_SIZE(type, size) \ typedef char type ## _asrt_size[1 - 2*!!(sizeof(struct type) != (size))] /** enum vmmdev_request_type - VMMDev request types. */ enum vmmdev_request_type { VMMDEVREQ_INVALID_REQUEST = 0, VMMDEVREQ_GET_MOUSE_STATUS = 1, VMMDEVREQ_SET_MOUSE_STATUS = 2, VMMDEVREQ_SET_POINTER_SHAPE = 3, VMMDEVREQ_GET_HOST_VERSION = 4, VMMDEVREQ_IDLE = 5, VMMDEVREQ_GET_HOST_TIME = 10, VMMDEVREQ_GET_HYPERVISOR_INFO = 20, VMMDEVREQ_SET_HYPERVISOR_INFO = 21, VMMDEVREQ_REGISTER_PATCH_MEMORY = 22, /* since version 3.0.6 */ VMMDEVREQ_DEREGISTER_PATCH_MEMORY = 23, /* since version 3.0.6 */ VMMDEVREQ_SET_POWER_STATUS = 30, VMMDEVREQ_ACKNOWLEDGE_EVENTS = 41, VMMDEVREQ_CTL_GUEST_FILTER_MASK = 42, VMMDEVREQ_REPORT_GUEST_INFO = 50, VMMDEVREQ_REPORT_GUEST_INFO2 = 58, /* since version 3.2.0 */ VMMDEVREQ_REPORT_GUEST_STATUS = 59, /* since version 3.2.8 */ VMMDEVREQ_REPORT_GUEST_USER_STATE = 74, /* since version 4.3 */ /* Retrieve a display resize request sent by the host, deprecated. */ VMMDEVREQ_GET_DISPLAY_CHANGE_REQ = 51, VMMDEVREQ_VIDEMODE_SUPPORTED = 52, VMMDEVREQ_GET_HEIGHT_REDUCTION = 53, /** * @VMMDEVREQ_GET_DISPLAY_CHANGE_REQ2: * Retrieve a display resize request sent by the host. * * Queries a display resize request sent from the host. If the * event_ack member is sent to true and there is an unqueried request * available for one of the virtual display then that request will * be returned. If several displays have unqueried requests the lowest * numbered display will be chosen first. Only the most recent unseen * request for each display is remembered. * If event_ack is set to false, the last host request queried with * event_ack set is resent, or failing that the most recent received * from the host. If no host request was ever received then all zeros * are returned. */ VMMDEVREQ_GET_DISPLAY_CHANGE_REQ2 = 54, VMMDEVREQ_REPORT_GUEST_CAPABILITIES = 55, VMMDEVREQ_SET_GUEST_CAPABILITIES = 56, VMMDEVREQ_VIDEMODE_SUPPORTED2 = 57, /* since version 3.2.0 */ VMMDEVREQ_GET_DISPLAY_CHANGE_REQEX = 80, /* since version 4.2.4 */ VMMDEVREQ_HGCM_CONNECT = 60, VMMDEVREQ_HGCM_DISCONNECT = 61, VMMDEVREQ_HGCM_CALL32 = 62, VMMDEVREQ_HGCM_CALL64 = 63, VMMDEVREQ_HGCM_CANCEL = 64, VMMDEVREQ_HGCM_CANCEL2 = 65, VMMDEVREQ_VIDEO_ACCEL_ENABLE = 70, VMMDEVREQ_VIDEO_ACCEL_FLUSH = 71, VMMDEVREQ_VIDEO_SET_VISIBLE_REGION = 72, VMMDEVREQ_GET_SEAMLESS_CHANGE_REQ = 73, VMMDEVREQ_QUERY_CREDENTIALS = 100, VMMDEVREQ_REPORT_CREDENTIALS_JUDGEMENT = 101, VMMDEVREQ_REPORT_GUEST_STATS = 110, VMMDEVREQ_GET_MEMBALLOON_CHANGE_REQ = 111, VMMDEVREQ_GET_STATISTICS_CHANGE_REQ = 112, VMMDEVREQ_CHANGE_MEMBALLOON = 113, VMMDEVREQ_GET_VRDPCHANGE_REQ = 150, VMMDEVREQ_LOG_STRING = 200, VMMDEVREQ_GET_CPU_HOTPLUG_REQ = 210, VMMDEVREQ_SET_CPU_HOTPLUG_STATUS = 211, VMMDEVREQ_REGISTER_SHARED_MODULE = 212, VMMDEVREQ_UNREGISTER_SHARED_MODULE = 213, VMMDEVREQ_CHECK_SHARED_MODULES = 214, VMMDEVREQ_GET_PAGE_SHARING_STATUS = 215, VMMDEVREQ_DEBUG_IS_PAGE_SHARED = 216, VMMDEVREQ_GET_SESSION_ID = 217, /* since version 3.2.8 */ VMMDEVREQ_WRITE_COREDUMP = 218, VMMDEVREQ_GUEST_HEARTBEAT = 219, VMMDEVREQ_HEARTBEAT_CONFIGURE = 220, /* Ensure the enum is a 32 bit data-type */ VMMDEVREQ_SIZEHACK = 0x7fffffff }; #if __BITS_PER_LONG == 64 #define VMMDEVREQ_HGCM_CALL VMMDEVREQ_HGCM_CALL64 #else #define VMMDEVREQ_HGCM_CALL VMMDEVREQ_HGCM_CALL32 #endif /** HGCM service location types. */ enum vmmdev_hgcm_service_location_type { VMMDEV_HGCM_LOC_INVALID = 0, VMMDEV_HGCM_LOC_LOCALHOST = 1, VMMDEV_HGCM_LOC_LOCALHOST_EXISTING = 2, /* Ensure the enum is a 32 bit data-type */ VMMDEV_HGCM_LOC_SIZEHACK = 0x7fffffff }; /** HGCM host service location. */ struct vmmdev_hgcm_service_location_localhost { /** Service name */ char service_name[128]; }; VMMDEV_ASSERT_SIZE(vmmdev_hgcm_service_location_localhost, 128); /** HGCM service location. */ struct vmmdev_hgcm_service_location { /** Type of the location. */ enum vmmdev_hgcm_service_location_type type; union { struct vmmdev_hgcm_service_location_localhost localhost; } u; }; VMMDEV_ASSERT_SIZE(vmmdev_hgcm_service_location, 128 + 4); /** HGCM function parameter type. */ enum vmmdev_hgcm_function_parameter_type { VMMDEV_HGCM_PARM_TYPE_INVALID = 0, VMMDEV_HGCM_PARM_TYPE_32BIT = 1, VMMDEV_HGCM_PARM_TYPE_64BIT = 2, /** Deprecated Doesn't work, use PAGELIST. */ VMMDEV_HGCM_PARM_TYPE_PHYSADDR = 3, /** In and Out, user-memory */ VMMDEV_HGCM_PARM_TYPE_LINADDR = 4, /** In, user-memory (read; host<-guest) */ VMMDEV_HGCM_PARM_TYPE_LINADDR_IN = 5, /** Out, user-memory (write; host->guest) */ VMMDEV_HGCM_PARM_TYPE_LINADDR_OUT = 6, /** In and Out, kernel-memory */ VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL = 7, /** In, kernel-memory (read; host<-guest) */ VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_IN = 8, /** Out, kernel-memory (write; host->guest) */ VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_OUT = 9, /** Physical addresses of locked pages for a buffer. */ VMMDEV_HGCM_PARM_TYPE_PAGELIST = 10, /* Ensure the enum is a 32 bit data-type */ VMMDEV_HGCM_PARM_TYPE_SIZEHACK = 0x7fffffff }; /** HGCM function parameter, 32-bit client. */ struct vmmdev_hgcm_function_parameter32 { enum vmmdev_hgcm_function_parameter_type type; union { __u32 value32; __u64 value64; struct { __u32 size; union { __u32 phys_addr; __u32 linear_addr; } u; } pointer; struct { /** Size of the buffer described by the page list. */ __u32 size; /** Relative to the request header. */ __u32 offset; } page_list; } u; } __attribute__((packed)); VMMDEV_ASSERT_SIZE(vmmdev_hgcm_function_parameter32, 4 + 8); /** HGCM function parameter, 64-bit client. */ struct vmmdev_hgcm_function_parameter64 { enum vmmdev_hgcm_function_parameter_type type; union { __u32 value32; __u64 value64; struct { __u32 size; union { __u64 phys_addr; __u64 linear_addr; } u; } __attribute__((packed)) pointer; struct { /** Size of the buffer described by the page list. */ __u32 size; /** Relative to the request header. */ __u32 offset; } page_list; } __attribute__((packed)) u; } __attribute__((packed)); VMMDEV_ASSERT_SIZE(vmmdev_hgcm_function_parameter64, 4 + 12); #if __BITS_PER_LONG == 64 #define vmmdev_hgcm_function_parameter vmmdev_hgcm_function_parameter64 #else #define vmmdev_hgcm_function_parameter vmmdev_hgcm_function_parameter32 #endif #define VMMDEV_HGCM_F_PARM_DIRECTION_NONE 0x00000000U #define VMMDEV_HGCM_F_PARM_DIRECTION_TO_HOST 0x00000001U #define VMMDEV_HGCM_F_PARM_DIRECTION_FROM_HOST 0x00000002U #define VMMDEV_HGCM_F_PARM_DIRECTION_BOTH 0x00000003U /** * struct vmmdev_hgcm_pagelist - VMMDEV_HGCM_PARM_TYPE_PAGELIST parameters * point to this structure to actually describe the buffer. */ struct vmmdev_hgcm_pagelist { __u32 flags; /** VMMDEV_HGCM_F_PARM_*. */ __u16 offset_first_page; /** Data offset in the first page. */ __u16 page_count; /** Number of pages. */ __u64 pages[1]; /** Page addresses. */ }; VMMDEV_ASSERT_SIZE(vmmdev_hgcm_pagelist, 4 + 2 + 2 + 8); #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/cryptouser.h����������������������������������������������������������������������������������0000644�����������������00000006500�14763166027�0010310 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Crypto user configuration API. * * Copyright (C) 2011 secunet Security Networks AG * Copyright (C) 2011 Steffen Klassert <steffen.klassert@secunet.com> * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope 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., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. */ #include <linux/types.h> /* Netlink configuration messages. */ enum { CRYPTO_MSG_BASE = 0x10, CRYPTO_MSG_NEWALG = 0x10, CRYPTO_MSG_DELALG, CRYPTO_MSG_UPDATEALG, CRYPTO_MSG_GETALG, CRYPTO_MSG_DELRNG, __CRYPTO_MSG_MAX }; #define CRYPTO_MSG_MAX (__CRYPTO_MSG_MAX - 1) #define CRYPTO_NR_MSGTYPES (CRYPTO_MSG_MAX + 1 - CRYPTO_MSG_BASE) #define CRYPTO_MAX_NAME 64 /* Netlink message attributes. */ enum crypto_attr_type_t { CRYPTOCFGA_UNSPEC, CRYPTOCFGA_PRIORITY_VAL, /* __u32 */ CRYPTOCFGA_REPORT_LARVAL, /* struct crypto_report_larval */ CRYPTOCFGA_REPORT_HASH, /* struct crypto_report_hash */ CRYPTOCFGA_REPORT_BLKCIPHER, /* struct crypto_report_blkcipher */ CRYPTOCFGA_REPORT_AEAD, /* struct crypto_report_aead */ CRYPTOCFGA_REPORT_COMPRESS, /* struct crypto_report_comp */ CRYPTOCFGA_REPORT_RNG, /* struct crypto_report_rng */ CRYPTOCFGA_REPORT_CIPHER, /* struct crypto_report_cipher */ CRYPTOCFGA_REPORT_AKCIPHER, /* struct crypto_report_akcipher */ CRYPTOCFGA_REPORT_KPP, /* struct crypto_report_kpp */ CRYPTOCFGA_REPORT_ACOMP, /* struct crypto_report_acomp */ __CRYPTOCFGA_MAX #define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1) }; struct crypto_user_alg { char cru_name[CRYPTO_MAX_NAME]; char cru_driver_name[CRYPTO_MAX_NAME]; char cru_module_name[CRYPTO_MAX_NAME]; __u32 cru_type; __u32 cru_mask; __u32 cru_refcnt; __u32 cru_flags; }; struct crypto_report_larval { char type[CRYPTO_MAX_NAME]; }; struct crypto_report_hash { char type[CRYPTO_MAX_NAME]; unsigned int blocksize; unsigned int digestsize; }; struct crypto_report_cipher { char type[CRYPTO_MAX_NAME]; unsigned int blocksize; unsigned int min_keysize; unsigned int max_keysize; }; struct crypto_report_blkcipher { char type[CRYPTO_MAX_NAME]; char geniv[CRYPTO_MAX_NAME]; unsigned int blocksize; unsigned int min_keysize; unsigned int max_keysize; unsigned int ivsize; }; struct crypto_report_aead { char type[CRYPTO_MAX_NAME]; char geniv[CRYPTO_MAX_NAME]; unsigned int blocksize; unsigned int maxauthsize; unsigned int ivsize; }; struct crypto_report_comp { char type[CRYPTO_MAX_NAME]; }; struct crypto_report_rng { char type[CRYPTO_MAX_NAME]; unsigned int seedsize; }; struct crypto_report_akcipher { char type[CRYPTO_MAX_NAME]; }; struct crypto_report_kpp { char type[CRYPTO_MAX_NAME]; }; struct crypto_report_acomp { char type[CRYPTO_MAX_NAME]; }; #define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \ sizeof(struct crypto_report_blkcipher)) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/mmc/ioctl.h�����������������������������������������������������������������������������������0000644�����������������00000004406�14763166027�0007762 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef LINUX_MMC_IOCTL_H #define LINUX_MMC_IOCTL_H #include <linux/types.h> #include <linux/major.h> struct mmc_ioc_cmd { /* Implies direction of data. true = write, false = read */ int write_flag; /* Application-specific command. true = precede with CMD55 */ int is_acmd; __u32 opcode; __u32 arg; __u32 response[4]; /* CMD response */ unsigned int flags; unsigned int blksz; unsigned int blocks; /* * Sleep at least postsleep_min_us useconds, and at most * postsleep_max_us useconds *after* issuing command. Needed for * some read commands for which cards have no other way of indicating * they're ready for the next command (i.e. there is no equivalent of * a "busy" indicator for read operations). */ unsigned int postsleep_min_us; unsigned int postsleep_max_us; /* * Override driver-computed timeouts. Note the difference in units! */ unsigned int data_timeout_ns; unsigned int cmd_timeout_ms; /* * For 64-bit machines, the next member, ``__u64 data_ptr``, wants to * be 8-byte aligned. Make sure this struct is the same size when * built for 32-bit. */ __u32 __pad; /* DAT buffer */ __u64 data_ptr; }; #define mmc_ioc_cmd_set_data(ic, ptr) ic.data_ptr = (__u64)(unsigned long) ptr /** * struct mmc_ioc_multi_cmd - multi command information * @num_of_cmds: Number of commands to send. Must be equal to or less than * MMC_IOC_MAX_CMDS. * @cmds: Array of commands with length equal to 'num_of_cmds' */ struct mmc_ioc_multi_cmd { __u64 num_of_cmds; struct mmc_ioc_cmd cmds[0]; }; #define MMC_IOC_CMD _IOWR(MMC_BLOCK_MAJOR, 0, struct mmc_ioc_cmd) /* * MMC_IOC_MULTI_CMD: Used to send an array of MMC commands described by * the structure mmc_ioc_multi_cmd. The MMC driver will issue all * commands in array in sequence to card. */ #define MMC_IOC_MULTI_CMD _IOWR(MMC_BLOCK_MAJOR, 1, struct mmc_ioc_multi_cmd) /* * Since this ioctl is only meant to enhance (and not replace) normal access * to the mmc bus device, an upper data transfer limit of MMC_IOC_MAX_BYTES * is enforced per ioctl call. For larger data transfers, use the normal * block device operations. */ #define MMC_IOC_MAX_BYTES (512L * 1024) #define MMC_IOC_MAX_CMDS 255 #endif /* LINUX_MMC_IOCTL_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/rio_cm_cdev.h���������������������������������������������������������������������������������0000644�����������������00000006260�14763166027�0010345 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * Copyright (c) 2015, Integrated Device Technology Inc. * Copyright (c) 2015, Prodrive Technologies * Copyright (c) 2015, RapidIO Trade Association * All rights reserved. * * This software is available to you under a choice of one of two licenses. * You may choose to be licensed under the terms of the GNU General Public * License(GPL) Version 2, or the BSD-3 Clause license below: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors * may be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RIO_CM_CDEV_H_ #define _RIO_CM_CDEV_H_ #include <linux/types.h> struct rio_cm_channel { __u16 id; __u16 remote_channel; __u16 remote_destid; __u8 mport_id; }; struct rio_cm_msg { __u16 ch_num; __u16 size; __u32 rxto; /* receive timeout in mSec. 0 = blocking */ __u64 msg; }; struct rio_cm_accept { __u16 ch_num; __u16 pad0; __u32 wait_to; /* accept timeout in mSec. 0 = blocking */ }; /* RapidIO Channelized Messaging Driver IOCTLs */ #define RIO_CM_IOC_MAGIC 'c' #define RIO_CM_EP_GET_LIST_SIZE _IOWR(RIO_CM_IOC_MAGIC, 1, __u32) #define RIO_CM_EP_GET_LIST _IOWR(RIO_CM_IOC_MAGIC, 2, __u32) #define RIO_CM_CHAN_CREATE _IOWR(RIO_CM_IOC_MAGIC, 3, __u16) #define RIO_CM_CHAN_CLOSE _IOW(RIO_CM_IOC_MAGIC, 4, __u16) #define RIO_CM_CHAN_BIND _IOW(RIO_CM_IOC_MAGIC, 5, struct rio_cm_channel) #define RIO_CM_CHAN_LISTEN _IOW(RIO_CM_IOC_MAGIC, 6, __u16) #define RIO_CM_CHAN_ACCEPT _IOWR(RIO_CM_IOC_MAGIC, 7, struct rio_cm_accept) #define RIO_CM_CHAN_CONNECT _IOW(RIO_CM_IOC_MAGIC, 8, struct rio_cm_channel) #define RIO_CM_CHAN_SEND _IOW(RIO_CM_IOC_MAGIC, 9, struct rio_cm_msg) #define RIO_CM_CHAN_RECEIVE _IOWR(RIO_CM_IOC_MAGIC, 10, struct rio_cm_msg) #define RIO_CM_MPORT_GET_LIST _IOWR(RIO_CM_IOC_MAGIC, 11, __u32) #endif /* _RIO_CM_CDEV_H_ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/mic_ioctl.h�����������������������������������������������������������������������������������0000644�����������������00000004314�14763166027�0010034 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Intel MIC Platform Software Stack (MPSS) * * Copyright(c) 2013 Intel Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * 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. * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Intel MIC Host driver. * */ #ifndef _MIC_IOCTL_H_ #define _MIC_IOCTL_H_ #include <linux/types.h> /* * mic_copy - MIC virtio descriptor copy. * * @iov: An array of IOVEC structures containing user space buffers. * @iovcnt: Number of IOVEC structures in iov. * @vr_idx: The vring index. * @update_used: A non zero value results in used index being updated. * @out_len: The aggregate of the total length written to or read from * the virtio device. */ struct mic_copy_desc { struct iovec *iov; __u32 iovcnt; __u8 vr_idx; __u8 update_used; __u32 out_len; }; /* * Add a new virtio device * The (struct mic_device_desc *) pointer points to a device page entry * for the virtio device consisting of: * - struct mic_device_desc * - struct mic_vqconfig (num_vq of these) * - host and guest features * - virtio device config space * The total size referenced by the pointer should equal the size returned * by desc_size() in mic_common.h */ #define MIC_VIRTIO_ADD_DEVICE _IOWR('s', 1, struct mic_device_desc *) /* * Copy the number of entries in the iovec and update the used index * if requested by the user. */ #define MIC_VIRTIO_COPY_DESC _IOWR('s', 2, struct mic_copy_desc *) /* * Notify virtio device of a config change * The (__u8 *) pointer points to config space values for the device * as they should be written into the device page. The total size * referenced by the pointer should equal the config_len field of struct * mic_device_desc. */ #define MIC_VIRTIO_CONFIG_CHANGE _IOWR('s', 5, __u8 *) #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/loop.h����������������������������������������������������������������������������������������0000644�����������������00000004730�14763166027�0007045 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* * include/linux/loop.h * * Written by Theodore Ts'o, 3/29/93. * * Copyright 1993 by Theodore Ts'o. Redistribution of this file is * permitted under the GNU General Public License. */ #ifndef _LINUX_LOOP_H #define _LINUX_LOOP_H #define LO_NAME_SIZE 64 #define LO_KEY_SIZE 32 /* * Loop flags */ enum { LO_FLAGS_READ_ONLY = 1, LO_FLAGS_AUTOCLEAR = 4, LO_FLAGS_PARTSCAN = 8, LO_FLAGS_DIRECT_IO = 16, }; #include <asm/posix_types.h> /* for __kernel_old_dev_t */ #include <linux/types.h> /* for __u64 */ /* Backwards compatibility version */ struct loop_info { int lo_number; /* ioctl r/o */ __kernel_old_dev_t lo_device; /* ioctl r/o */ unsigned long lo_inode; /* ioctl r/o */ __kernel_old_dev_t lo_rdevice; /* ioctl r/o */ int lo_offset; int lo_encrypt_type; int lo_encrypt_key_size; /* ioctl w/o */ int lo_flags; /* ioctl r/o */ char lo_name[LO_NAME_SIZE]; unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */ unsigned long lo_init[2]; char reserved[4]; }; struct loop_info64 { __u64 lo_device; /* ioctl r/o */ __u64 lo_inode; /* ioctl r/o */ __u64 lo_rdevice; /* ioctl r/o */ __u64 lo_offset; __u64 lo_sizelimit;/* bytes, 0 == max available */ __u32 lo_number; /* ioctl r/o */ __u32 lo_encrypt_type; __u32 lo_encrypt_key_size; /* ioctl w/o */ __u32 lo_flags; /* ioctl r/o */ __u8 lo_file_name[LO_NAME_SIZE]; __u8 lo_crypt_name[LO_NAME_SIZE]; __u8 lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */ __u64 lo_init[2]; }; /* * Loop filter types */ #define LO_CRYPT_NONE 0 #define LO_CRYPT_XOR 1 #define LO_CRYPT_DES 2 #define LO_CRYPT_FISH2 3 /* Twofish encryption */ #define LO_CRYPT_BLOW 4 #define LO_CRYPT_CAST128 5 #define LO_CRYPT_IDEA 6 #define LO_CRYPT_DUMMY 9 #define LO_CRYPT_SKIPJACK 10 #define LO_CRYPT_CRYPTOAPI 18 #define MAX_LO_CRYPT 20 /* * IOCTL commands --- we will commandeer 0x4C ('L') */ #define LOOP_SET_FD 0x4C00 #define LOOP_CLR_FD 0x4C01 #define LOOP_SET_STATUS 0x4C02 #define LOOP_GET_STATUS 0x4C03 #define LOOP_SET_STATUS64 0x4C04 #define LOOP_GET_STATUS64 0x4C05 #define LOOP_CHANGE_FD 0x4C06 #define LOOP_SET_CAPACITY 0x4C07 #define LOOP_SET_DIRECT_IO 0x4C08 #define LOOP_SET_BLOCK_SIZE 0x4C09 /* /dev/loop-control interface */ #define LOOP_CTL_ADD 0x4C80 #define LOOP_CTL_REMOVE 0x4C81 #define LOOP_CTL_GET_FREE 0x4C82 #endif /* _LINUX_LOOP_H */ ����������������������������������������linux/if_fc.h���������������������������������������������������������������������������������������0000644�����������������00000003312�14763166027�0007135 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Global definitions for Fibre Channel. * * Version: @(#)if_fc.h 0.0 11/20/98 * * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Donald Becker, <becker@super.org> * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be> * Vineet Abraham, <vma@iol.unh.edu> * * 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. */ #ifndef _LINUX_IF_FC_H #define _LINUX_IF_FC_H #include <linux/types.h> #define FC_ALEN 6 /* Octets in one ethernet addr */ #define FC_HLEN (sizeof(struct fch_hdr)+sizeof(struct fcllc)) #define FC_ID_LEN 3 /* Octets in a Fibre Channel Address */ /* LLC and SNAP constants */ #define EXTENDED_SAP 0xAA #define UI_CMD 0x03 /* This is NOT the Fibre Channel frame header. The FC frame header is * constructed in the driver as the Tachyon needs certain fields in * certains positions. So, it can't be generalized here.*/ struct fch_hdr { __u8 daddr[FC_ALEN]; /* destination address */ __u8 saddr[FC_ALEN]; /* source address */ }; /* This is a Fibre Channel LLC structure */ struct fcllc { __u8 dsap; /* destination SAP */ __u8 ssap; /* source SAP */ __u8 llc; /* LLC control field */ __u8 protid[3]; /* protocol id */ __be16 ethertype; /* ether type field */ }; #endif /* _LINUX_IF_FC_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/auto_fs.h�������������������������������������������������������������������������������������0000644�����������������00000014434�14763166027�0007536 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright 1997 Transmeta Corporation - All Rights Reserved * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org> * Copyright 2005-2006,2013,2017-2018 Ian Kent <raven@themaw.net> * * This file is part of the Linux kernel and is made available under * the terms of the GNU General Public License, version 2, or at your * option, any later version, incorporated herein by reference. * * ----------------------------------------------------------------------- */ #ifndef _LINUX_AUTO_FS_H #define _LINUX_AUTO_FS_H #include <linux/types.h> #include <linux/limits.h> #include <sys/ioctl.h> #define AUTOFS_PROTO_VERSION 5 #define AUTOFS_MIN_PROTO_VERSION 3 #define AUTOFS_MAX_PROTO_VERSION 5 #define AUTOFS_PROTO_SUBVERSION 3 /* * The wait_queue_token (autofs_wqt_t) is part of a structure which is passed * back to the kernel via ioctl from userspace. On architectures where 32- and * 64-bit userspace binaries can be executed it's important that the size of * autofs_wqt_t stays constant between 32- and 64-bit Linux kernels so that we * do not break the binary ABI interface by changing the structure size. */ #if defined(__ia64__) || defined(__alpha__) /* pure 64bit architectures */ typedef unsigned long autofs_wqt_t; #else typedef unsigned int autofs_wqt_t; #endif /* Packet types */ #define autofs_ptype_missing 0 /* Missing entry (mount request) */ #define autofs_ptype_expire 1 /* Expire entry (umount request) */ struct autofs_packet_hdr { int proto_version; /* Protocol version */ int type; /* Type of packet */ }; struct autofs_packet_missing { struct autofs_packet_hdr hdr; autofs_wqt_t wait_queue_token; int len; char name[NAME_MAX+1]; }; /* v3 expire (via ioctl) */ struct autofs_packet_expire { struct autofs_packet_hdr hdr; int len; char name[NAME_MAX+1]; }; #define AUTOFS_IOCTL 0x93 enum { AUTOFS_IOC_READY_CMD = 0x60, AUTOFS_IOC_FAIL_CMD, AUTOFS_IOC_CATATONIC_CMD, AUTOFS_IOC_PROTOVER_CMD, AUTOFS_IOC_SETTIMEOUT_CMD, AUTOFS_IOC_EXPIRE_CMD, }; #define AUTOFS_IOC_READY _IO(AUTOFS_IOCTL, AUTOFS_IOC_READY_CMD) #define AUTOFS_IOC_FAIL _IO(AUTOFS_IOCTL, AUTOFS_IOC_FAIL_CMD) #define AUTOFS_IOC_CATATONIC _IO(AUTOFS_IOCTL, AUTOFS_IOC_CATATONIC_CMD) #define AUTOFS_IOC_PROTOVER _IOR(AUTOFS_IOCTL, \ AUTOFS_IOC_PROTOVER_CMD, int) #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(AUTOFS_IOCTL, \ AUTOFS_IOC_SETTIMEOUT_CMD, \ compat_ulong_t) #define AUTOFS_IOC_SETTIMEOUT _IOWR(AUTOFS_IOCTL, \ AUTOFS_IOC_SETTIMEOUT_CMD, \ unsigned long) #define AUTOFS_IOC_EXPIRE _IOR(AUTOFS_IOCTL, \ AUTOFS_IOC_EXPIRE_CMD, \ struct autofs_packet_expire) /* autofs version 4 and later definitions */ /* Mask for expire behaviour */ #define AUTOFS_EXP_NORMAL 0x00 #define AUTOFS_EXP_IMMEDIATE 0x01 #define AUTOFS_EXP_LEAVES 0x02 #define AUTOFS_EXP_FORCED 0x04 #define AUTOFS_TYPE_ANY 0U #define AUTOFS_TYPE_INDIRECT 1U #define AUTOFS_TYPE_DIRECT 2U #define AUTOFS_TYPE_OFFSET 4U static __inline__ void set_autofs_type_indirect(unsigned int *type) { *type = AUTOFS_TYPE_INDIRECT; } static __inline__ unsigned int autofs_type_indirect(unsigned int type) { return (type == AUTOFS_TYPE_INDIRECT); } static __inline__ void set_autofs_type_direct(unsigned int *type) { *type = AUTOFS_TYPE_DIRECT; } static __inline__ unsigned int autofs_type_direct(unsigned int type) { return (type == AUTOFS_TYPE_DIRECT); } static __inline__ void set_autofs_type_offset(unsigned int *type) { *type = AUTOFS_TYPE_OFFSET; } static __inline__ unsigned int autofs_type_offset(unsigned int type) { return (type == AUTOFS_TYPE_OFFSET); } static __inline__ unsigned int autofs_type_trigger(unsigned int type) { return (type == AUTOFS_TYPE_DIRECT || type == AUTOFS_TYPE_OFFSET); } /* * This isn't really a type as we use it to say "no type set" to * indicate we want to search for "any" mount in the * autofs_dev_ioctl_ismountpoint() device ioctl function. */ static __inline__ void set_autofs_type_any(unsigned int *type) { *type = AUTOFS_TYPE_ANY; } static __inline__ unsigned int autofs_type_any(unsigned int type) { return (type == AUTOFS_TYPE_ANY); } /* Daemon notification packet types */ enum autofs_notify { NFY_NONE, NFY_MOUNT, NFY_EXPIRE }; /* Kernel protocol version 4 packet types */ /* Expire entry (umount request) */ #define autofs_ptype_expire_multi 2 /* Kernel protocol version 5 packet types */ /* Indirect mount missing and expire requests. */ #define autofs_ptype_missing_indirect 3 #define autofs_ptype_expire_indirect 4 /* Direct mount missing and expire requests */ #define autofs_ptype_missing_direct 5 #define autofs_ptype_expire_direct 6 /* v4 multi expire (via pipe) */ struct autofs_packet_expire_multi { struct autofs_packet_hdr hdr; autofs_wqt_t wait_queue_token; int len; char name[NAME_MAX+1]; }; union autofs_packet_union { struct autofs_packet_hdr hdr; struct autofs_packet_missing missing; struct autofs_packet_expire expire; struct autofs_packet_expire_multi expire_multi; }; /* autofs v5 common packet struct */ struct autofs_v5_packet { struct autofs_packet_hdr hdr; autofs_wqt_t wait_queue_token; __u32 dev; __u64 ino; __u32 uid; __u32 gid; __u32 pid; __u32 tgid; __u32 len; char name[NAME_MAX+1]; }; typedef struct autofs_v5_packet autofs_packet_missing_indirect_t; typedef struct autofs_v5_packet autofs_packet_expire_indirect_t; typedef struct autofs_v5_packet autofs_packet_missing_direct_t; typedef struct autofs_v5_packet autofs_packet_expire_direct_t; union autofs_v5_packet_union { struct autofs_packet_hdr hdr; struct autofs_v5_packet v5_packet; autofs_packet_missing_indirect_t missing_indirect; autofs_packet_expire_indirect_t expire_indirect; autofs_packet_missing_direct_t missing_direct; autofs_packet_expire_direct_t expire_direct; }; enum { AUTOFS_IOC_EXPIRE_MULTI_CMD = 0x66, /* AUTOFS_IOC_EXPIRE_CMD + 1 */ AUTOFS_IOC_PROTOSUBVER_CMD, AUTOFS_IOC_ASKUMOUNT_CMD = 0x70, /* AUTOFS_DEV_IOCTL_VERSION_CMD - 1 */ }; #define AUTOFS_IOC_EXPIRE_MULTI _IOW(AUTOFS_IOCTL, \ AUTOFS_IOC_EXPIRE_MULTI_CMD, int) #define AUTOFS_IOC_PROTOSUBVER _IOR(AUTOFS_IOCTL, \ AUTOFS_IOC_PROTOSUBVER_CMD, int) #define AUTOFS_IOC_ASKUMOUNT _IOR(AUTOFS_IOCTL, \ AUTOFS_IOC_ASKUMOUNT_CMD, int) #endif /* _LINUX_AUTO_FS_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/dm-ioctl.h������������������������������������������������������������������������������������0000644�����������������00000025166�14763166027�0007612 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited. * Copyright (C) 2004 - 2009 Red Hat, Inc. All rights reserved. * * This file is released under the LGPL. */ #ifndef _LINUX_DM_IOCTL_V4_H #define _LINUX_DM_IOCTL_V4_H #include <linux/types.h> #define DM_DIR "mapper" /* Slashes not supported */ #define DM_CONTROL_NODE "control" #define DM_MAX_TYPE_NAME 16 #define DM_NAME_LEN 128 #define DM_UUID_LEN 129 /* * A traditional ioctl interface for the device mapper. * * Each device can have two tables associated with it, an * 'active' table which is the one currently used by io passing * through the device, and an 'inactive' one which is a table * that is being prepared as a replacement for the 'active' one. * * DM_VERSION: * Just get the version information for the ioctl interface. * * DM_REMOVE_ALL: * Remove all dm devices, destroy all tables. Only really used * for debug. * * DM_LIST_DEVICES: * Get a list of all the dm device names. * * DM_DEV_CREATE: * Create a new device, neither the 'active' or 'inactive' table * slots will be filled. The device will be in suspended state * after creation, however any io to the device will get errored * since it will be out-of-bounds. * * DM_DEV_REMOVE: * Remove a device, destroy any tables. * * DM_DEV_RENAME: * Rename a device or set its uuid if none was previously supplied. * * DM_SUSPEND: * This performs both suspend and resume, depending which flag is * passed in. * Suspend: This command will not return until all pending io to * the device has completed. Further io will be deferred until * the device is resumed. * Resume: It is no longer an error to issue this command on an * unsuspended device. If a table is present in the 'inactive' * slot, it will be moved to the active slot, then the old table * from the active slot will be _destroyed_. Finally the device * is resumed. * * DM_DEV_STATUS: * Retrieves the status for the table in the 'active' slot. * * DM_DEV_WAIT: * Wait for a significant event to occur to the device. This * could either be caused by an event triggered by one of the * targets of the table in the 'active' slot, or a table change. * * DM_TABLE_LOAD: * Load a table into the 'inactive' slot for the device. The * device does _not_ need to be suspended prior to this command. * * DM_TABLE_CLEAR: * Destroy any table in the 'inactive' slot (ie. abort). * * DM_TABLE_DEPS: * Return a set of device dependencies for the 'active' table. * * DM_TABLE_STATUS: * Return the targets status for the 'active' table. * * DM_TARGET_MSG: * Pass a message string to the target at a specific offset of a device. * * DM_DEV_SET_GEOMETRY: * Set the geometry of a device by passing in a string in this format: * * "cylinders heads sectors_per_track start_sector" * * Beware that CHS geometry is nearly obsolete and only provided * for compatibility with dm devices that can be booted by a PC * BIOS. See struct hd_geometry for range limits. Also note that * the geometry is erased if the device size changes. */ /* * All ioctl arguments consist of a single chunk of memory, with * this structure at the start. If a uuid is specified any * lookup (eg. for a DM_INFO) will be done on that, *not* the * name. */ struct dm_ioctl { /* * The version number is made up of three parts: * major - no backward or forward compatibility, * minor - only backwards compatible, * patch - both backwards and forwards compatible. * * All clients of the ioctl interface should fill in the * version number of the interface that they were * compiled with. * * All recognised ioctl commands (ie. those that don't * return -ENOTTY) fill out this field, even if the * command failed. */ __u32 version[3]; /* in/out */ __u32 data_size; /* total size of data passed in * including this struct */ __u32 data_start; /* offset to start of data * relative to start of this struct */ __u32 target_count; /* in/out */ __s32 open_count; /* out */ __u32 flags; /* in/out */ /* * event_nr holds either the event number (input and output) or the * udev cookie value (input only). * The DM_DEV_WAIT ioctl takes an event number as input. * The DM_SUSPEND, DM_DEV_REMOVE and DM_DEV_RENAME ioctls * use the field as a cookie to return in the DM_COOKIE * variable with the uevents they issue. * For output, the ioctls return the event number, not the cookie. */ __u32 event_nr; /* in/out */ __u32 padding; __u64 dev; /* in/out */ char name[DM_NAME_LEN]; /* device name */ char uuid[DM_UUID_LEN]; /* unique identifier for * the block device */ char data[7]; /* padding or data */ }; /* * Used to specify tables. These structures appear after the * dm_ioctl. */ struct dm_target_spec { __u64 sector_start; __u64 length; __s32 status; /* used when reading from kernel only */ /* * Location of the next dm_target_spec. * - When specifying targets on a DM_TABLE_LOAD command, this value is * the number of bytes from the start of the "current" dm_target_spec * to the start of the "next" dm_target_spec. * - When retrieving targets on a DM_TABLE_STATUS command, this value * is the number of bytes from the start of the first dm_target_spec * (that follows the dm_ioctl struct) to the start of the "next" * dm_target_spec. */ __u32 next; char target_type[DM_MAX_TYPE_NAME]; /* * Parameter string starts immediately after this object. * Be careful to add padding after string to ensure correct * alignment of subsequent dm_target_spec. */ }; /* * Used to retrieve the target dependencies. */ struct dm_target_deps { __u32 count; /* Array size */ __u32 padding; /* unused */ __u64 dev[0]; /* out */ }; /* * Used to get a list of all dm devices. */ struct dm_name_list { __u64 dev; __u32 next; /* offset to the next record from the _start_ of this */ char name[0]; }; /* * Used to retrieve the target versions */ struct dm_target_versions { __u32 next; __u32 version[3]; char name[0]; }; /* * Used to pass message to a target */ struct dm_target_msg { __u64 sector; /* Device sector */ char message[0]; }; /* * If you change this make sure you make the corresponding change * to dm-ioctl.c:lookup_ioctl() */ enum { /* Top level cmds */ DM_VERSION_CMD = 0, DM_REMOVE_ALL_CMD, DM_LIST_DEVICES_CMD, /* device level cmds */ DM_DEV_CREATE_CMD, DM_DEV_REMOVE_CMD, DM_DEV_RENAME_CMD, DM_DEV_SUSPEND_CMD, DM_DEV_STATUS_CMD, DM_DEV_WAIT_CMD, /* Table level cmds */ DM_TABLE_LOAD_CMD, DM_TABLE_CLEAR_CMD, DM_TABLE_DEPS_CMD, DM_TABLE_STATUS_CMD, /* Added later */ DM_LIST_VERSIONS_CMD, DM_TARGET_MSG_CMD, DM_DEV_SET_GEOMETRY_CMD, DM_DEV_ARM_POLL_CMD, }; #define DM_IOCTL 0xfd #define DM_VERSION _IOWR(DM_IOCTL, DM_VERSION_CMD, struct dm_ioctl) #define DM_REMOVE_ALL _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD, struct dm_ioctl) #define DM_LIST_DEVICES _IOWR(DM_IOCTL, DM_LIST_DEVICES_CMD, struct dm_ioctl) #define DM_DEV_CREATE _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD, struct dm_ioctl) #define DM_DEV_REMOVE _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD, struct dm_ioctl) #define DM_DEV_RENAME _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD, struct dm_ioctl) #define DM_DEV_SUSPEND _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD, struct dm_ioctl) #define DM_DEV_STATUS _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD, struct dm_ioctl) #define DM_DEV_WAIT _IOWR(DM_IOCTL, DM_DEV_WAIT_CMD, struct dm_ioctl) #define DM_DEV_ARM_POLL _IOWR(DM_IOCTL, DM_DEV_ARM_POLL_CMD, struct dm_ioctl) #define DM_TABLE_LOAD _IOWR(DM_IOCTL, DM_TABLE_LOAD_CMD, struct dm_ioctl) #define DM_TABLE_CLEAR _IOWR(DM_IOCTL, DM_TABLE_CLEAR_CMD, struct dm_ioctl) #define DM_TABLE_DEPS _IOWR(DM_IOCTL, DM_TABLE_DEPS_CMD, struct dm_ioctl) #define DM_TABLE_STATUS _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, struct dm_ioctl) #define DM_LIST_VERSIONS _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, struct dm_ioctl) #define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl) #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) #define DM_VERSION_MAJOR 4 #define DM_VERSION_MINOR 39 #define DM_VERSION_PATCHLEVEL 0 #define DM_VERSION_EXTRA "-ioctl (2018-04-03)" /* Status bits */ #define DM_READONLY_FLAG (1 << 0) /* In/Out */ #define DM_SUSPEND_FLAG (1 << 1) /* In/Out */ #define DM_PERSISTENT_DEV_FLAG (1 << 3) /* In */ /* * Flag passed into ioctl STATUS command to get table information * rather than current status. */ #define DM_STATUS_TABLE_FLAG (1 << 4) /* In */ /* * Flags that indicate whether a table is present in either of * the two table slots that a device has. */ #define DM_ACTIVE_PRESENT_FLAG (1 << 5) /* Out */ #define DM_INACTIVE_PRESENT_FLAG (1 << 6) /* Out */ /* * Indicates that the buffer passed in wasn't big enough for the * results. */ #define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */ /* * This flag is now ignored. */ #define DM_SKIP_BDGET_FLAG (1 << 9) /* In */ /* * Set this to avoid attempting to freeze any filesystem when suspending. */ #define DM_SKIP_LOCKFS_FLAG (1 << 10) /* In */ /* * Set this to suspend without flushing queued ios. * Also disables flushing uncommitted changes in the thin target before * generating statistics for DM_TABLE_STATUS and DM_DEV_WAIT. */ #define DM_NOFLUSH_FLAG (1 << 11) /* In */ /* * If set, any table information returned will relate to the inactive * table instead of the live one. Always check DM_INACTIVE_PRESENT_FLAG * is set before using the data returned. */ #define DM_QUERY_INACTIVE_TABLE_FLAG (1 << 12) /* In */ /* * If set, a uevent was generated for which the caller may need to wait. */ #define DM_UEVENT_GENERATED_FLAG (1 << 13) /* Out */ /* * If set, rename changes the uuid not the name. Only permitted * if no uuid was previously supplied: an existing uuid cannot be changed. */ #define DM_UUID_FLAG (1 << 14) /* In */ /* * If set, all buffers are wiped after use. Use when sending * or requesting sensitive data such as an encryption key. */ #define DM_SECURE_DATA_FLAG (1 << 15) /* In */ /* * If set, a message generated output data. */ #define DM_DATA_OUT_FLAG (1 << 16) /* Out */ /* * If set with DM_DEV_REMOVE or DM_REMOVE_ALL this indicates that if * the device cannot be removed immediately because it is still in use * it should instead be scheduled for removal when it gets closed. * * On return from DM_DEV_REMOVE, DM_DEV_STATUS or other ioctls, this * flag indicates that the device is scheduled to be removed when it * gets closed. */ #define DM_DEFERRED_REMOVE (1 << 17) /* In/Out */ /* * If set, the device is suspended internally. */ #define DM_INTERNAL_SUSPEND_FLAG (1 << 18) /* Out */ #endif /* _LINUX_DM_IOCTL_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/uio.h�����������������������������������������������������������������������������������������0000644�����������������00000001334�14763166027�0006665 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Berkeley style UIO structures - Alan Cox 1994. * * 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. */ #ifndef __LINUX_UIO_H #define __LINUX_UIO_H #include <linux/types.h> struct iovec { void *iov_base; /* BSD uses caddr_t (1003.1g requires void *) */ __kernel_size_t iov_len; /* Must be size_t (1003.1g) */ }; /* * UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1) */ #define UIO_FASTIOV 8 #define UIO_MAXIOV 1024 #endif /* __LINUX_UIO_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/smc_diag.h������������������������������������������������������������������������������������0000644�����������������00000005423�14763166027�0007642 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _SMC_DIAG_H_ #define _SMC_DIAG_H_ #include <linux/types.h> #include <linux/inet_diag.h> #include <rdma/ib_user_verbs.h> /* Request structure */ struct smc_diag_req { __u8 diag_family; __u8 pad[2]; __u8 diag_ext; /* Query extended information */ struct inet_diag_sockid id; }; /* Base info structure. It contains socket identity (addrs/ports/cookie) based * on the internal clcsock, and more SMC-related socket data */ struct smc_diag_msg { __u8 diag_family; __u8 diag_state; union { __u8 diag_mode; __u8 diag_fallback; /* the old name of the field */ }; __u8 diag_shutdown; struct inet_diag_sockid id; __u32 diag_uid; __aligned_u64 diag_inode; }; /* Mode of a connection */ enum { SMC_DIAG_MODE_SMCR, SMC_DIAG_MODE_FALLBACK_TCP, SMC_DIAG_MODE_SMCD, }; /* Extensions */ enum { SMC_DIAG_NONE, SMC_DIAG_CONNINFO, SMC_DIAG_LGRINFO, SMC_DIAG_SHUTDOWN, SMC_DIAG_DMBINFO, SMC_DIAG_FALLBACK, __SMC_DIAG_MAX, }; #define SMC_DIAG_MAX (__SMC_DIAG_MAX - 1) /* SMC_DIAG_CONNINFO */ struct smc_diag_cursor { __u16 reserved; __u16 wrap; __u32 count; }; struct smc_diag_conninfo { __u32 token; /* unique connection id */ __u32 sndbuf_size; /* size of send buffer */ __u32 rmbe_size; /* size of RMB element */ __u32 peer_rmbe_size; /* size of peer RMB element */ /* local RMB element cursors */ struct smc_diag_cursor rx_prod; /* received producer cursor */ struct smc_diag_cursor rx_cons; /* received consumer cursor */ /* peer RMB element cursors */ struct smc_diag_cursor tx_prod; /* sent producer cursor */ struct smc_diag_cursor tx_cons; /* sent consumer cursor */ __u8 rx_prod_flags; /* received producer flags */ __u8 rx_conn_state_flags; /* recvd connection flags*/ __u8 tx_prod_flags; /* sent producer flags */ __u8 tx_conn_state_flags; /* sent connection flags*/ /* send buffer cursors */ struct smc_diag_cursor tx_prep; /* prepared to be sent cursor */ struct smc_diag_cursor tx_sent; /* sent cursor */ struct smc_diag_cursor tx_fin; /* confirmed sent cursor */ }; /* SMC_DIAG_LINKINFO */ struct smc_diag_linkinfo { __u8 link_id; /* link identifier */ __u8 ibname[IB_DEVICE_NAME_MAX]; /* name of the RDMA device */ __u8 ibport; /* RDMA device port number */ __u8 gid[40]; /* local GID */ __u8 peer_gid[40]; /* peer GID */ }; struct smc_diag_lgrinfo { struct smc_diag_linkinfo lnk[1]; __u8 role; }; struct smc_diag_fallback { __u32 reason; __u32 peer_diagnosis; }; struct smcd_diag_dmbinfo { /* SMC-D Socket internals */ __u32 linkid; /* Link identifier */ __aligned_u64 peer_gid; /* Peer GID */ __aligned_u64 my_gid; /* My GID */ __aligned_u64 token; /* Token of DMB */ __aligned_u64 peer_token; /* Token of remote DMBE */ }; #endif /* _SMC_DIAG_H_ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/oom.h�����������������������������������������������������������������������������������������0000644�����������������00000000777�14763166027�0006675 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __INCLUDE_LINUX_OOM_H #define __INCLUDE_LINUX_OOM_H /* * /proc/<pid>/oom_score_adj set to OOM_SCORE_ADJ_MIN disables oom killing for * pid. */ #define OOM_SCORE_ADJ_MIN (-1000) #define OOM_SCORE_ADJ_MAX 1000 /* * /proc/<pid>/oom_adj set to -17 protects from the oom killer for legacy * purposes. */ #define OOM_DISABLE (-17) /* inclusive */ #define OOM_ADJUST_MIN (-16) #define OOM_ADJUST_MAX 15 #endif /* __INCLUDE_LINUX_OOM_H */ �linux/rds.h�����������������������������������������������������������������������������������������0000644�����������������00000025067�14763166027�0006672 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2008, 2018 Oracle and/or its affiliates. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ #ifndef _LINUX_RDS_H #define _LINUX_RDS_H #include <linux/types.h> #include <linux/socket.h> /* For __kernel_sockaddr_storage. */ #include <linux/in6.h> /* For struct in6_addr. */ #define RDS_IB_ABI_VERSION 0x301 #define SOL_RDS 276 /* * setsockopt/getsockopt for SOL_RDS */ #define RDS_CANCEL_SENT_TO 1 #define RDS_GET_MR 2 #define RDS_FREE_MR 3 /* deprecated: RDS_BARRIER 4 */ #define RDS_RECVERR 5 #define RDS_CONG_MONITOR 6 #define RDS_GET_MR_FOR_DEST 7 #define SO_RDS_TRANSPORT 8 /* Socket option to tap receive path latency * SO_RDS: SO_RDS_MSG_RXPATH_LATENCY * Format used struct rds_rx_trace_so */ #define SO_RDS_MSG_RXPATH_LATENCY 10 /* supported values for SO_RDS_TRANSPORT */ #define RDS_TRANS_IB 0 #define RDS_TRANS_IWARP 1 #define RDS_TRANS_TCP 2 #define RDS_TRANS_COUNT 3 #define RDS_TRANS_NONE (~0) /* * Control message types for SOL_RDS. * * CMSG_RDMA_ARGS (sendmsg) * Request a RDMA transfer to/from the specified * memory ranges. * The cmsg_data is a struct rds_rdma_args. * RDS_CMSG_RDMA_DEST (recvmsg, sendmsg) * Kernel informs application about intended * source/destination of a RDMA transfer * RDS_CMSG_RDMA_MAP (sendmsg) * Application asks kernel to map the given * memory range into a IB MR, and send the * R_Key along in an RDS extension header. * The cmsg_data is a struct rds_get_mr_args, * the same as for the GET_MR setsockopt. * RDS_CMSG_RDMA_STATUS (recvmsg) * Returns the status of a completed RDMA operation. * RDS_CMSG_RXPATH_LATENCY(recvmsg) * Returns rds message latencies in various stages of receive * path in nS. Its set per socket using SO_RDS_MSG_RXPATH_LATENCY * socket option. Legitimate points are defined in * enum rds_message_rxpath_latency. More points can be added in * future. CSMG format is struct rds_cmsg_rx_trace. */ #define RDS_CMSG_RDMA_ARGS 1 #define RDS_CMSG_RDMA_DEST 2 #define RDS_CMSG_RDMA_MAP 3 #define RDS_CMSG_RDMA_STATUS 4 #define RDS_CMSG_CONG_UPDATE 5 #define RDS_CMSG_ATOMIC_FADD 6 #define RDS_CMSG_ATOMIC_CSWP 7 #define RDS_CMSG_MASKED_ATOMIC_FADD 8 #define RDS_CMSG_MASKED_ATOMIC_CSWP 9 #define RDS_CMSG_RXPATH_LATENCY 11 #define RDS_CMSG_ZCOPY_COOKIE 12 #define RDS_CMSG_ZCOPY_COMPLETION 13 #define RDS_INFO_FIRST 10000 #define RDS_INFO_COUNTERS 10000 #define RDS_INFO_CONNECTIONS 10001 /* 10002 aka RDS_INFO_FLOWS is deprecated */ #define RDS_INFO_SEND_MESSAGES 10003 #define RDS_INFO_RETRANS_MESSAGES 10004 #define RDS_INFO_RECV_MESSAGES 10005 #define RDS_INFO_SOCKETS 10006 #define RDS_INFO_TCP_SOCKETS 10007 #define RDS_INFO_IB_CONNECTIONS 10008 #define RDS_INFO_CONNECTION_STATS 10009 #define RDS_INFO_IWARP_CONNECTIONS 10010 /* PF_RDS6 options */ #define RDS6_INFO_CONNECTIONS 10011 #define RDS6_INFO_SEND_MESSAGES 10012 #define RDS6_INFO_RETRANS_MESSAGES 10013 #define RDS6_INFO_RECV_MESSAGES 10014 #define RDS6_INFO_SOCKETS 10015 #define RDS6_INFO_TCP_SOCKETS 10016 #define RDS6_INFO_IB_CONNECTIONS 10017 #define RDS_INFO_LAST 10017 struct rds_info_counter { __u8 name[32]; __u64 value; } __attribute__((packed)); #define RDS_INFO_CONNECTION_FLAG_SENDING 0x01 #define RDS_INFO_CONNECTION_FLAG_CONNECTING 0x02 #define RDS_INFO_CONNECTION_FLAG_CONNECTED 0x04 #define TRANSNAMSIZ 16 struct rds_info_connection { __u64 next_tx_seq; __u64 next_rx_seq; __be32 laddr; __be32 faddr; __u8 transport[TRANSNAMSIZ]; /* null term ascii */ __u8 flags; } __attribute__((packed)); struct rds6_info_connection { __u64 next_tx_seq; __u64 next_rx_seq; struct in6_addr laddr; struct in6_addr faddr; __u8 transport[TRANSNAMSIZ]; /* null term ascii */ __u8 flags; } __attribute__((packed)); #define RDS_INFO_MESSAGE_FLAG_ACK 0x01 #define RDS_INFO_MESSAGE_FLAG_FAST_ACK 0x02 struct rds_info_message { __u64 seq; __u32 len; __be32 laddr; __be32 faddr; __be16 lport; __be16 fport; __u8 flags; } __attribute__((packed)); struct rds6_info_message { __u64 seq; __u32 len; struct in6_addr laddr; struct in6_addr faddr; __be16 lport; __be16 fport; __u8 flags; __u8 tos; } __attribute__((packed)); struct rds_info_socket { __u32 sndbuf; __be32 bound_addr; __be32 connected_addr; __be16 bound_port; __be16 connected_port; __u32 rcvbuf; __u64 inum; } __attribute__((packed)); struct rds6_info_socket { __u32 sndbuf; struct in6_addr bound_addr; struct in6_addr connected_addr; __be16 bound_port; __be16 connected_port; __u32 rcvbuf; __u64 inum; } __attribute__((packed)); struct rds_info_tcp_socket { __be32 local_addr; __be16 local_port; __be32 peer_addr; __be16 peer_port; __u64 hdr_rem; __u64 data_rem; __u32 last_sent_nxt; __u32 last_expected_una; __u32 last_seen_una; } __attribute__((packed)); struct rds6_info_tcp_socket { struct in6_addr local_addr; __be16 local_port; struct in6_addr peer_addr; __be16 peer_port; __u64 hdr_rem; __u64 data_rem; __u32 last_sent_nxt; __u32 last_expected_una; __u32 last_seen_una; } __attribute__((packed)); #define RDS_IB_GID_LEN 16 struct rds_info_rdma_connection { __be32 src_addr; __be32 dst_addr; __u8 src_gid[RDS_IB_GID_LEN]; __u8 dst_gid[RDS_IB_GID_LEN]; __u32 max_send_wr; __u32 max_recv_wr; __u32 max_send_sge; __u32 rdma_mr_max; __u32 rdma_mr_size; }; struct rds6_info_rdma_connection { struct in6_addr src_addr; struct in6_addr dst_addr; __u8 src_gid[RDS_IB_GID_LEN]; __u8 dst_gid[RDS_IB_GID_LEN]; __u32 max_send_wr; __u32 max_recv_wr; __u32 max_send_sge; __u32 rdma_mr_max; __u32 rdma_mr_size; }; /* RDS message Receive Path Latency points */ enum rds_message_rxpath_latency { RDS_MSG_RX_HDR_TO_DGRAM_START = 0, RDS_MSG_RX_DGRAM_REASSEMBLE, RDS_MSG_RX_DGRAM_DELIVERED, RDS_MSG_RX_DGRAM_TRACE_MAX }; struct rds_rx_trace_so { __u8 rx_traces; __u8 rx_trace_pos[RDS_MSG_RX_DGRAM_TRACE_MAX]; }; struct rds_cmsg_rx_trace { __u8 rx_traces; __u8 rx_trace_pos[RDS_MSG_RX_DGRAM_TRACE_MAX]; __u64 rx_trace[RDS_MSG_RX_DGRAM_TRACE_MAX]; }; /* * Congestion monitoring. * Congestion control in RDS happens at the host connection * level by exchanging a bitmap marking congested ports. * By default, a process sleeping in poll() is always woken * up when the congestion map is updated. * With explicit monitoring, an application can have more * fine-grained control. * The application installs a 64bit mask value in the socket, * where each bit corresponds to a group of ports. * When a congestion update arrives, RDS checks the set of * ports that are now uncongested against the list bit mask * installed in the socket, and if they overlap, we queue a * cong_notification on the socket. * * To install the congestion monitor bitmask, use RDS_CONG_MONITOR * with the 64bit mask. * Congestion updates are received via RDS_CMSG_CONG_UPDATE * control messages. * * The correspondence between bits and ports is * 1 << (portnum % 64) */ #define RDS_CONG_MONITOR_SIZE 64 #define RDS_CONG_MONITOR_BIT(port) (((unsigned int) port) % RDS_CONG_MONITOR_SIZE) #define RDS_CONG_MONITOR_MASK(port) (1ULL << RDS_CONG_MONITOR_BIT(port)) /* * RDMA related types */ /* * This encapsulates a remote memory location. * In the current implementation, it contains the R_Key * of the remote memory region, and the offset into it * (so that the application does not have to worry about * alignment). */ typedef __u64 rds_rdma_cookie_t; struct rds_iovec { __u64 addr; __u64 bytes; }; struct rds_get_mr_args { struct rds_iovec vec; __u64 cookie_addr; __u64 flags; }; struct rds_get_mr_for_dest_args { struct __kernel_sockaddr_storage dest_addr; struct rds_iovec vec; __u64 cookie_addr; __u64 flags; }; struct rds_free_mr_args { rds_rdma_cookie_t cookie; __u64 flags; }; struct rds_rdma_args { rds_rdma_cookie_t cookie; struct rds_iovec remote_vec; __u64 local_vec_addr; __u64 nr_local; __u64 flags; __u64 user_token; }; struct rds_atomic_args { rds_rdma_cookie_t cookie; __u64 local_addr; __u64 remote_addr; union { struct { __u64 compare; __u64 swap; } cswp; struct { __u64 add; } fadd; struct { __u64 compare; __u64 swap; __u64 compare_mask; __u64 swap_mask; } m_cswp; struct { __u64 add; __u64 nocarry_mask; } m_fadd; }; __u64 flags; __u64 user_token; }; struct rds_rdma_notify { __u64 user_token; __s32 status; }; #define RDS_RDMA_SUCCESS 0 #define RDS_RDMA_REMOTE_ERROR 1 #define RDS_RDMA_CANCELED 2 #define RDS_RDMA_DROPPED 3 #define RDS_RDMA_OTHER_ERROR 4 #define RDS_MAX_ZCOOKIES 8 struct rds_zcopy_cookies { __u32 num; __u32 cookies[RDS_MAX_ZCOOKIES]; }; /* * Common set of flags for all RDMA related structs */ #define RDS_RDMA_READWRITE 0x0001 #define RDS_RDMA_FENCE 0x0002 /* use FENCE for immediate send */ #define RDS_RDMA_INVALIDATE 0x0004 /* invalidate R_Key after freeing MR */ #define RDS_RDMA_USE_ONCE 0x0008 /* free MR after use */ #define RDS_RDMA_DONTWAIT 0x0010 /* Don't wait in SET_BARRIER */ #define RDS_RDMA_NOTIFY_ME 0x0020 /* Notify when operation completes */ #define RDS_RDMA_SILENT 0x0040 /* Do not interrupt remote */ #endif /* IB_RDS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/hdlc.h����������������������������������������������������������������������������������������0000644�����������������00000001175�14763166027�0007006 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Generic HDLC support routines for Linux * * Copyright (C) 1999-2005 Krzysztof Halasa <khc@pm.waw.pl> * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License * as published by the Free Software Foundation. */ #ifndef __HDLC_H #define __HDLC_H #define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */ #if 0 #define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */ #else #define HDLC_MAX_MRU 1600 /* as required for FR network */ #endif #endif /* __HDLC_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/swab.h����������������������������������������������������������������������������������������0000644�����������������00000015442�14763166027�0007032 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SWAB_H #define _LINUX_SWAB_H #include <linux/types.h> #include <linux/stddef.h> #include <asm/bitsperlong.h> #include <asm/swab.h> /* * casts are necessary for constants, because we never know how for sure * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way. */ #define ___constant_swab16(x) ((__u16)( \ (((__u16)(x) & (__u16)0x00ffU) << 8) | \ (((__u16)(x) & (__u16)0xff00U) >> 8))) #define ___constant_swab32(x) ((__u32)( \ (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \ (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \ (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \ (((__u32)(x) & (__u32)0xff000000UL) >> 24))) #define ___constant_swab64(x) ((__u64)( \ (((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \ (((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \ (((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \ (((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \ (((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \ (((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \ (((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \ (((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56))) #define ___constant_swahw32(x) ((__u32)( \ (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \ (((__u32)(x) & (__u32)0xffff0000UL) >> 16))) #define ___constant_swahb32(x) ((__u32)( \ (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \ (((__u32)(x) & (__u32)0xff00ff00UL) >> 8))) /* * Implement the following as inlines, but define the interface using * macros to allow constant folding when possible: * ___swab16, ___swab32, ___swab64, ___swahw32, ___swahb32 */ static __inline__ __u16 __fswab16(__u16 val) { #if defined (__arch_swab16) return __arch_swab16(val); #else return ___constant_swab16(val); #endif } static __inline__ __u32 __fswab32(__u32 val) { #if defined(__arch_swab32) return __arch_swab32(val); #else return ___constant_swab32(val); #endif } static __inline__ __u64 __fswab64(__u64 val) { #if defined (__arch_swab64) return __arch_swab64(val); #elif defined(__SWAB_64_THRU_32__) __u32 h = val >> 32; __u32 l = val & ((1ULL << 32) - 1); return (((__u64)__fswab32(l)) << 32) | ((__u64)(__fswab32(h))); #else return ___constant_swab64(val); #endif } static __inline__ __u32 __fswahw32(__u32 val) { #ifdef __arch_swahw32 return __arch_swahw32(val); #else return ___constant_swahw32(val); #endif } static __inline__ __u32 __fswahb32(__u32 val) { #ifdef __arch_swahb32 return __arch_swahb32(val); #else return ___constant_swahb32(val); #endif } /** * __swab16 - return a byteswapped 16-bit value * @x: value to byteswap */ #ifdef __HAVE_BUILTIN_BSWAP16__ #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x)) #else #define __swab16(x) \ (__builtin_constant_p((__u16)(x)) ? \ ___constant_swab16(x) : \ __fswab16(x)) #endif /** * __swab32 - return a byteswapped 32-bit value * @x: value to byteswap */ #ifdef __HAVE_BUILTIN_BSWAP32__ #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x)) #else #define __swab32(x) \ (__builtin_constant_p((__u32)(x)) ? \ ___constant_swab32(x) : \ __fswab32(x)) #endif /** * __swab64 - return a byteswapped 64-bit value * @x: value to byteswap */ #ifdef __HAVE_BUILTIN_BSWAP64__ #define __swab64(x) (__u64)__builtin_bswap64((__u64)(x)) #else #define __swab64(x) \ (__builtin_constant_p((__u64)(x)) ? \ ___constant_swab64(x) : \ __fswab64(x)) #endif static __always_inline unsigned long __swab(const unsigned long y) { #if __BITS_PER_LONG == 64 return __swab64(y); #else /* __BITS_PER_LONG == 32 */ return __swab32(y); #endif } /** * __swahw32 - return a word-swapped 32-bit value * @x: value to wordswap * * __swahw32(0x12340000) is 0x00001234 */ #define __swahw32(x) \ (__builtin_constant_p((__u32)(x)) ? \ ___constant_swahw32(x) : \ __fswahw32(x)) /** * __swahb32 - return a high and low byte-swapped 32-bit value * @x: value to byteswap * * __swahb32(0x12345678) is 0x34127856 */ #define __swahb32(x) \ (__builtin_constant_p((__u32)(x)) ? \ ___constant_swahb32(x) : \ __fswahb32(x)) /** * __swab16p - return a byteswapped 16-bit value from a pointer * @p: pointer to a naturally-aligned 16-bit value */ static __always_inline __u16 __swab16p(const __u16 *p) { #ifdef __arch_swab16p return __arch_swab16p(p); #else return __swab16(*p); #endif } /** * __swab32p - return a byteswapped 32-bit value from a pointer * @p: pointer to a naturally-aligned 32-bit value */ static __always_inline __u32 __swab32p(const __u32 *p) { #ifdef __arch_swab32p return __arch_swab32p(p); #else return __swab32(*p); #endif } /** * __swab64p - return a byteswapped 64-bit value from a pointer * @p: pointer to a naturally-aligned 64-bit value */ static __always_inline __u64 __swab64p(const __u64 *p) { #ifdef __arch_swab64p return __arch_swab64p(p); #else return __swab64(*p); #endif } /** * __swahw32p - return a wordswapped 32-bit value from a pointer * @p: pointer to a naturally-aligned 32-bit value * * See __swahw32() for details of wordswapping. */ static __inline__ __u32 __swahw32p(const __u32 *p) { #ifdef __arch_swahw32p return __arch_swahw32p(p); #else return __swahw32(*p); #endif } /** * __swahb32p - return a high and low byteswapped 32-bit value from a pointer * @p: pointer to a naturally-aligned 32-bit value * * See __swahb32() for details of high/low byteswapping. */ static __inline__ __u32 __swahb32p(const __u32 *p) { #ifdef __arch_swahb32p return __arch_swahb32p(p); #else return __swahb32(*p); #endif } /** * __swab16s - byteswap a 16-bit value in-place * @p: pointer to a naturally-aligned 16-bit value */ static __inline__ void __swab16s(__u16 *p) { #ifdef __arch_swab16s __arch_swab16s(p); #else *p = __swab16p(p); #endif } /** * __swab32s - byteswap a 32-bit value in-place * @p: pointer to a naturally-aligned 32-bit value */ static __always_inline void __swab32s(__u32 *p) { #ifdef __arch_swab32s __arch_swab32s(p); #else *p = __swab32p(p); #endif } /** * __swab64s - byteswap a 64-bit value in-place * @p: pointer to a naturally-aligned 64-bit value */ static __always_inline void __swab64s(__u64 *p) { #ifdef __arch_swab64s __arch_swab64s(p); #else *p = __swab64p(p); #endif } /** * __swahw32s - wordswap a 32-bit value in-place * @p: pointer to a naturally-aligned 32-bit value * * See __swahw32() for details of wordswapping */ static __inline__ void __swahw32s(__u32 *p) { #ifdef __arch_swahw32s __arch_swahw32s(p); #else *p = __swahw32p(p); #endif } /** * __swahb32s - high and low byteswap a 32-bit value in-place * @p: pointer to a naturally-aligned 32-bit value * * See __swahb32() for details of high and low byte swapping */ static __inline__ void __swahb32s(__u32 *p) { #ifdef __arch_swahb32s __arch_swahb32s(p); #else *p = __swahb32p(p); #endif } #endif /* _LINUX_SWAB_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/serial_core.h���������������������������������������������������������������������������������0000644�����������������00000014074�14763166027�0010365 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * linux/drivers/char/serial_core.h * * Copyright (C) 2000 Deep Blue Solutions Ltd. * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef LINUX_SERIAL_CORE_H #define LINUX_SERIAL_CORE_H #include <linux/serial.h> /* * The type definitions. These are from Ted Ts'o's serial.h */ #define PORT_UNKNOWN 0 #define PORT_8250 1 #define PORT_16450 2 #define PORT_16550 3 #define PORT_16550A 4 #define PORT_CIRRUS 5 #define PORT_16650 6 #define PORT_16650V2 7 #define PORT_16750 8 #define PORT_STARTECH 9 #define PORT_16C950 10 #define PORT_16654 11 #define PORT_16850 12 #define PORT_RSA 13 #define PORT_NS16550A 14 #define PORT_XSCALE 15 #define PORT_RM9000 16 /* PMC-Sierra RM9xxx internal UART */ #define PORT_OCTEON 17 /* Cavium OCTEON internal UART */ #define PORT_AR7 18 /* Texas Instruments AR7 internal UART */ #define PORT_U6_16550A 19 /* ST-Ericsson U6xxx internal UART */ #define PORT_TEGRA 20 /* NVIDIA Tegra internal UART */ #define PORT_XR17D15X 21 /* Exar XR17D15x UART */ #define PORT_LPC3220 22 /* NXP LPC32xx SoC "Standard" UART */ #define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */ #define PORT_XR17V35X 24 /* Exar XR17V35x UARTs */ #define PORT_BRCM_TRUMANAGE 25 #define PORT_ALTR_16550_F32 26 /* Altera 16550 UART with 32 FIFOs */ #define PORT_ALTR_16550_F64 27 /* Altera 16550 UART with 64 FIFOs */ #define PORT_ALTR_16550_F128 28 /* Altera 16550 UART with 128 FIFOs */ #define PORT_RT2880 29 /* Ralink RT2880 internal UART */ #define PORT_16550A_FSL64 30 /* Freescale 16550 UART with 64 FIFOs */ /* * ARM specific type numbers. These are not currently guaranteed * to be implemented, and will change in the future. These are * separate so any additions to the old serial.c that occur before * we are merged can be easily merged here. */ #define PORT_PXA 31 #define PORT_AMBA 32 #define PORT_CLPS711X 33 #define PORT_SA1100 34 #define PORT_UART00 35 #define PORT_OWL 36 #define PORT_21285 37 /* Sparc type numbers. */ #define PORT_SUNZILOG 38 #define PORT_SUNSAB 39 /* Nuvoton UART */ #define PORT_NPCM 40 /* Intel EG20 */ #define PORT_PCH_8LINE 44 #define PORT_PCH_2LINE 45 /* DEC */ #define PORT_DZ 46 #define PORT_ZS 47 /* Parisc type numbers. */ #define PORT_MUX 48 /* Atmel AT91 SoC */ #define PORT_ATMEL 49 /* Macintosh Zilog type numbers */ #define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */ #define PORT_PMAC_ZILOG 51 /* SH-SCI */ #define PORT_SCI 52 #define PORT_SCIF 53 #define PORT_IRDA 54 /* Samsung S3C2410 SoC and derivatives thereof */ #define PORT_S3C2410 55 /* SGI IP22 aka Indy / Challenge S / Indigo 2 */ #define PORT_IP22ZILOG 56 /* Sharp LH7a40x -- an ARM9 SoC series */ #define PORT_LH7A40X 57 /* PPC CPM type number */ #define PORT_CPM 58 /* MPC52xx (and MPC512x) type numbers */ #define PORT_MPC52xx 59 /* IBM icom */ #define PORT_ICOM 60 /* Samsung S3C2440 SoC */ #define PORT_S3C2440 61 /* Motorola i.MX SoC */ #define PORT_IMX 62 /* Marvell MPSC */ #define PORT_MPSC 63 /* TXX9 type number */ #define PORT_TXX9 64 /* NEC VR4100 series SIU/DSIU */ #define PORT_VR41XX_SIU 65 #define PORT_VR41XX_DSIU 66 /* Samsung S3C2400 SoC */ #define PORT_S3C2400 67 /* M32R SIO */ #define PORT_M32R_SIO 68 /*Digi jsm */ #define PORT_JSM 69 #define PORT_PNX8XXX 70 /* Hilscher netx */ #define PORT_NETX 71 /* SUN4V Hypervisor Console */ #define PORT_SUNHV 72 #define PORT_S3C2412 73 /* Xilinx uartlite */ #define PORT_UARTLITE 74 /* Blackfin bf5xx */ #define PORT_BFIN 75 /* Micrel KS8695 */ #define PORT_KS8695 76 /* Broadcom SB1250, etc. SOC */ #define PORT_SB1250_DUART 77 /* Freescale ColdFire */ #define PORT_MCF 78 /* Blackfin SPORT */ #define PORT_BFIN_SPORT 79 /* MN10300 on-chip UART numbers */ #define PORT_MN10300 80 #define PORT_MN10300_CTS 81 #define PORT_SC26XX 82 /* SH-SCI */ #define PORT_SCIFA 83 #define PORT_S3C6400 84 /* NWPSERIAL, now removed */ #define PORT_NWPSERIAL 85 /* MAX3100 */ #define PORT_MAX3100 86 /* Timberdale UART */ #define PORT_TIMBUART 87 /* Qualcomm MSM SoCs */ #define PORT_MSM 88 /* BCM63xx family SoCs */ #define PORT_BCM63XX 89 /* Aeroflex Gaisler GRLIB APBUART */ #define PORT_APBUART 90 /* Altera UARTs */ #define PORT_ALTERA_JTAGUART 91 #define PORT_ALTERA_UART 92 /* SH-SCI */ #define PORT_SCIFB 93 /* MAX310X */ #define PORT_MAX310X 94 /* TI DA8xx/66AK2x */ #define PORT_DA830 95 /* TI OMAP-UART */ #define PORT_OMAP 96 /* VIA VT8500 SoC */ #define PORT_VT8500 97 /* Cadence (Xilinx Zynq) UART */ #define PORT_XUARTPS 98 /* Atheros AR933X SoC */ #define PORT_AR933X 99 /* Energy Micro efm32 SoC */ #define PORT_EFMUART 100 /* ARC (Synopsys) on-chip UART */ #define PORT_ARC 101 /* Rocketport EXPRESS/INFINITY */ #define PORT_RP2 102 /* Freescale lpuart */ #define PORT_LPUART 103 /* SH-SCI */ #define PORT_HSCIF 104 /* ST ASC type numbers */ #define PORT_ASC 105 /* Tilera TILE-Gx UART */ #define PORT_TILEGX 106 /* MEN 16z135 UART */ #define PORT_MEN_Z135 107 /* SC16IS74xx */ #define PORT_SC16IS7XX 108 /* MESON */ #define PORT_MESON 109 /* Conexant Digicolor */ #define PORT_DIGICOLOR 110 /* SPRD SERIAL */ #define PORT_SPRD 111 /* Cris v10 / v32 SoC */ #define PORT_CRIS 112 /* STM32 USART */ #define PORT_STM32 113 /* MVEBU UART */ #define PORT_MVEBU 114 /* Microchip PIC32 UART */ #define PORT_PIC32 115 /* MPS2 UART */ #define PORT_MPS2UART 116 /* MediaTek BTIF */ #define PORT_MTK_BTIF 117 #endif /* LINUX_SERIAL_CORE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/suspend_ioctls.h������������������������������������������������������������������������������0000644�����������������00000002627�14763166027�0011135 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SUSPEND_IOCTLS_H #define _LINUX_SUSPEND_IOCTLS_H #include <linux/types.h> /* * This structure is used to pass the values needed for the identification * of the resume swap area from a user space to the kernel via the * SNAPSHOT_SET_SWAP_AREA ioctl */ struct resume_swap_area { __kernel_loff_t offset; __u32 dev; } __attribute__((packed)); #define SNAPSHOT_IOC_MAGIC '3' #define SNAPSHOT_FREEZE _IO(SNAPSHOT_IOC_MAGIC, 1) #define SNAPSHOT_UNFREEZE _IO(SNAPSHOT_IOC_MAGIC, 2) #define SNAPSHOT_ATOMIC_RESTORE _IO(SNAPSHOT_IOC_MAGIC, 4) #define SNAPSHOT_FREE _IO(SNAPSHOT_IOC_MAGIC, 5) #define SNAPSHOT_FREE_SWAP_PAGES _IO(SNAPSHOT_IOC_MAGIC, 9) #define SNAPSHOT_S2RAM _IO(SNAPSHOT_IOC_MAGIC, 11) #define SNAPSHOT_SET_SWAP_AREA _IOW(SNAPSHOT_IOC_MAGIC, 13, \ struct resume_swap_area) #define SNAPSHOT_GET_IMAGE_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 14, __kernel_loff_t) #define SNAPSHOT_PLATFORM_SUPPORT _IO(SNAPSHOT_IOC_MAGIC, 15) #define SNAPSHOT_POWER_OFF _IO(SNAPSHOT_IOC_MAGIC, 16) #define SNAPSHOT_CREATE_IMAGE _IOW(SNAPSHOT_IOC_MAGIC, 17, int) #define SNAPSHOT_PREF_IMAGE_SIZE _IO(SNAPSHOT_IOC_MAGIC, 18) #define SNAPSHOT_AVAIL_SWAP_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 19, __kernel_loff_t) #define SNAPSHOT_ALLOC_SWAP_PAGE _IOR(SNAPSHOT_IOC_MAGIC, 20, __kernel_loff_t) #define SNAPSHOT_IOC_MAXNR 20 #endif /* _LINUX_SUSPEND_IOCTLS_H */ ���������������������������������������������������������������������������������������������������������linux/atm_he.h��������������������������������������������������������������������������������������0000644�����������������00000000626�14763166027�0007331 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atm_he.h */ #ifndef LINUX_ATM_HE_H #define LINUX_ATM_HE_H #include <linux/atmioc.h> #define HE_GET_REG _IOW('a', ATMIOC_SARPRV, struct atmif_sioc) #define HE_REGTYPE_PCI 1 #define HE_REGTYPE_RCM 2 #define HE_REGTYPE_TCM 3 #define HE_REGTYPE_MBOX 4 struct he_ioctl_reg { unsigned addr, val; char type; }; #endif /* LINUX_ATM_HE_H */ ����������������������������������������������������������������������������������������������������������linux/reiserfs_fs.h���������������������������������������������������������������������������������0000644�����������������00000001407�14763166027�0010404 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright 1996, 1997, 1998 Hans Reiser, see reiserfs/README for licensing and copyright details */ #ifndef _LINUX_REISER_FS_H #define _LINUX_REISER_FS_H #include <linux/types.h> #include <linux/magic.h> /* * include/linux/reiser_fs.h * * Reiser File System constants and structures * */ /* ioctl's command */ #define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) /* define following flags to be the same as in ext2, so that chattr(1), lsattr(1) will work with us. */ #define REISERFS_IOC_GETFLAGS FS_IOC_GETFLAGS #define REISERFS_IOC_SETFLAGS FS_IOC_SETFLAGS #define REISERFS_IOC_GETVERSION FS_IOC_GETVERSION #define REISERFS_IOC_SETVERSION FS_IOC_SETVERSION #endif /* _LINUX_REISER_FS_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/batman_adv.h����������������������������������������������������������������������������������0000644�����������������00000027311�14763166027�0010170 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: MIT */ /* Copyright (C) 2016-2018 B.A.T.M.A.N. contributors: * * Matthias Schiffer * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef _LINUX_BATMAN_ADV_H_ #define _LINUX_BATMAN_ADV_H_ #define BATADV_NL_NAME "batadv" #define BATADV_NL_MCAST_GROUP_TPMETER "tpmeter" /** * enum batadv_tt_client_flags - TT client specific flags * * Bits from 0 to 7 are called _remote flags_ because they are sent on the wire. * Bits from 8 to 15 are called _local flags_ because they are used for local * computations only. * * Bits from 4 to 7 - a subset of remote flags - are ensured to be in sync with * the other nodes in the network. To achieve this goal these flags are included * in the TT CRC computation. */ enum batadv_tt_client_flags { /** * @BATADV_TT_CLIENT_DEL: the client has to be deleted from the table */ BATADV_TT_CLIENT_DEL = (1 << 0), /** * @BATADV_TT_CLIENT_ROAM: the client roamed to/from another node and * the new update telling its new real location has not been * received/sent yet */ BATADV_TT_CLIENT_ROAM = (1 << 1), /** * @BATADV_TT_CLIENT_WIFI: this client is connected through a wifi * interface. This information is used by the "AP Isolation" feature */ BATADV_TT_CLIENT_WIFI = (1 << 4), /** * @BATADV_TT_CLIENT_ISOLA: this client is considered "isolated". This * information is used by the Extended Isolation feature */ BATADV_TT_CLIENT_ISOLA = (1 << 5), /** * @BATADV_TT_CLIENT_NOPURGE: this client should never be removed from * the table */ BATADV_TT_CLIENT_NOPURGE = (1 << 8), /** * @BATADV_TT_CLIENT_NEW: this client has been added to the local table * but has not been announced yet */ BATADV_TT_CLIENT_NEW = (1 << 9), /** * @BATADV_TT_CLIENT_PENDING: this client is marked for removal but it * is kept in the table for one more originator interval for consistency * purposes */ BATADV_TT_CLIENT_PENDING = (1 << 10), /** * @BATADV_TT_CLIENT_TEMP: this global client has been detected to be * part of the network but no nnode has already announced it */ BATADV_TT_CLIENT_TEMP = (1 << 11), }; /** * enum batadv_mcast_flags_priv - Private, own multicast flags * * These are internal, multicast related flags. Currently they describe certain * multicast related attributes of the segment this originator bridges into the * mesh. * * Those attributes are used to determine the public multicast flags this * originator is going to announce via TT. * * For netlink, if BATADV_MCAST_FLAGS_BRIDGED is unset then all querier * related flags are undefined. */ enum batadv_mcast_flags_priv { /** * @BATADV_MCAST_FLAGS_BRIDGED: There is a bridge on top of the mesh * interface. */ BATADV_MCAST_FLAGS_BRIDGED = (1 << 0), /** * @BATADV_MCAST_FLAGS_QUERIER_IPV4_EXISTS: Whether an IGMP querier * exists in the mesh */ BATADV_MCAST_FLAGS_QUERIER_IPV4_EXISTS = (1 << 1), /** * @BATADV_MCAST_FLAGS_QUERIER_IPV6_EXISTS: Whether an MLD querier * exists in the mesh */ BATADV_MCAST_FLAGS_QUERIER_IPV6_EXISTS = (1 << 2), /** * @BATADV_MCAST_FLAGS_QUERIER_IPV4_SHADOWING: If an IGMP querier * exists, whether it is potentially shadowing multicast listeners * (i.e. querier is behind our own bridge segment) */ BATADV_MCAST_FLAGS_QUERIER_IPV4_SHADOWING = (1 << 3), /** * @BATADV_MCAST_FLAGS_QUERIER_IPV6_SHADOWING: If an MLD querier * exists, whether it is potentially shadowing multicast listeners * (i.e. querier is behind our own bridge segment) */ BATADV_MCAST_FLAGS_QUERIER_IPV6_SHADOWING = (1 << 4), }; /** * enum batadv_nl_attrs - batman-adv netlink attributes */ enum batadv_nl_attrs { /** * @BATADV_ATTR_UNSPEC: unspecified attribute to catch errors */ BATADV_ATTR_UNSPEC, /** * @BATADV_ATTR_VERSION: batman-adv version string */ BATADV_ATTR_VERSION, /** * @BATADV_ATTR_ALGO_NAME: name of routing algorithm */ BATADV_ATTR_ALGO_NAME, /** * @BATADV_ATTR_MESH_IFINDEX: index of the batman-adv interface */ BATADV_ATTR_MESH_IFINDEX, /** * @BATADV_ATTR_MESH_IFNAME: name of the batman-adv interface */ BATADV_ATTR_MESH_IFNAME, /** * @BATADV_ATTR_MESH_ADDRESS: mac address of the batman-adv interface */ BATADV_ATTR_MESH_ADDRESS, /** * @BATADV_ATTR_HARD_IFINDEX: index of the non-batman-adv interface */ BATADV_ATTR_HARD_IFINDEX, /** * @BATADV_ATTR_HARD_IFNAME: name of the non-batman-adv interface */ BATADV_ATTR_HARD_IFNAME, /** * @BATADV_ATTR_HARD_ADDRESS: mac address of the non-batman-adv * interface */ BATADV_ATTR_HARD_ADDRESS, /** * @BATADV_ATTR_ORIG_ADDRESS: originator mac address */ BATADV_ATTR_ORIG_ADDRESS, /** * @BATADV_ATTR_TPMETER_RESULT: result of run (see * batadv_tp_meter_status) */ BATADV_ATTR_TPMETER_RESULT, /** * @BATADV_ATTR_TPMETER_TEST_TIME: time (msec) the run took */ BATADV_ATTR_TPMETER_TEST_TIME, /** * @BATADV_ATTR_TPMETER_BYTES: amount of acked bytes during run */ BATADV_ATTR_TPMETER_BYTES, /** * @BATADV_ATTR_TPMETER_COOKIE: session cookie to match tp_meter session */ BATADV_ATTR_TPMETER_COOKIE, /** * @BATADV_ATTR_PAD: attribute used for padding for 64-bit alignment */ BATADV_ATTR_PAD, /** * @BATADV_ATTR_ACTIVE: Flag indicating if the hard interface is active */ BATADV_ATTR_ACTIVE, /** * @BATADV_ATTR_TT_ADDRESS: Client MAC address */ BATADV_ATTR_TT_ADDRESS, /** * @BATADV_ATTR_TT_TTVN: Translation table version */ BATADV_ATTR_TT_TTVN, /** * @BATADV_ATTR_TT_LAST_TTVN: Previous translation table version */ BATADV_ATTR_TT_LAST_TTVN, /** * @BATADV_ATTR_TT_CRC32: CRC32 over translation table */ BATADV_ATTR_TT_CRC32, /** * @BATADV_ATTR_TT_VID: VLAN ID */ BATADV_ATTR_TT_VID, /** * @BATADV_ATTR_TT_FLAGS: Translation table client flags */ BATADV_ATTR_TT_FLAGS, /** * @BATADV_ATTR_FLAG_BEST: Flags indicating entry is the best */ BATADV_ATTR_FLAG_BEST, /** * @BATADV_ATTR_LAST_SEEN_MSECS: Time in milliseconds since last seen */ BATADV_ATTR_LAST_SEEN_MSECS, /** * @BATADV_ATTR_NEIGH_ADDRESS: Neighbour MAC address */ BATADV_ATTR_NEIGH_ADDRESS, /** * @BATADV_ATTR_TQ: TQ to neighbour */ BATADV_ATTR_TQ, /** * @BATADV_ATTR_THROUGHPUT: Estimated throughput to Neighbour */ BATADV_ATTR_THROUGHPUT, /** * @BATADV_ATTR_BANDWIDTH_UP: Reported uplink bandwidth */ BATADV_ATTR_BANDWIDTH_UP, /** * @BATADV_ATTR_BANDWIDTH_DOWN: Reported downlink bandwidth */ BATADV_ATTR_BANDWIDTH_DOWN, /** * @BATADV_ATTR_ROUTER: Gateway router MAC address */ BATADV_ATTR_ROUTER, /** * @BATADV_ATTR_BLA_OWN: Flag indicating own originator */ BATADV_ATTR_BLA_OWN, /** * @BATADV_ATTR_BLA_ADDRESS: Bridge loop avoidance claim MAC address */ BATADV_ATTR_BLA_ADDRESS, /** * @BATADV_ATTR_BLA_VID: BLA VLAN ID */ BATADV_ATTR_BLA_VID, /** * @BATADV_ATTR_BLA_BACKBONE: BLA gateway originator MAC address */ BATADV_ATTR_BLA_BACKBONE, /** * @BATADV_ATTR_BLA_CRC: BLA CRC */ BATADV_ATTR_BLA_CRC, /** * @BATADV_ATTR_DAT_CACHE_IP4ADDRESS: Client IPv4 address */ BATADV_ATTR_DAT_CACHE_IP4ADDRESS, /** * @BATADV_ATTR_DAT_CACHE_HWADDRESS: Client MAC address */ BATADV_ATTR_DAT_CACHE_HWADDRESS, /** * @BATADV_ATTR_DAT_CACHE_VID: VLAN ID */ BATADV_ATTR_DAT_CACHE_VID, /** * @BATADV_ATTR_MCAST_FLAGS: Per originator multicast flags */ BATADV_ATTR_MCAST_FLAGS, /** * @BATADV_ATTR_MCAST_FLAGS_PRIV: Private, own multicast flags */ BATADV_ATTR_MCAST_FLAGS_PRIV, /* add attributes above here, update the policy in netlink.c */ /** * @__BATADV_ATTR_AFTER_LAST: internal use */ __BATADV_ATTR_AFTER_LAST, /** * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available */ NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST, /** * @BATADV_ATTR_MAX: highest attribute number currently defined */ BATADV_ATTR_MAX = __BATADV_ATTR_AFTER_LAST - 1 }; /** * enum batadv_nl_commands - supported batman-adv netlink commands */ enum batadv_nl_commands { /** * @BATADV_CMD_UNSPEC: unspecified command to catch errors */ BATADV_CMD_UNSPEC, /** * @BATADV_CMD_GET_MESH_INFO: Query basic information about batman-adv * device */ BATADV_CMD_GET_MESH_INFO, /** * @BATADV_CMD_TP_METER: Start a tp meter session */ BATADV_CMD_TP_METER, /** * @BATADV_CMD_TP_METER_CANCEL: Cancel a tp meter session */ BATADV_CMD_TP_METER_CANCEL, /** * @BATADV_CMD_GET_ROUTING_ALGOS: Query the list of routing algorithms. */ BATADV_CMD_GET_ROUTING_ALGOS, /** * @BATADV_CMD_GET_HARDIFS: Query list of hard interfaces */ BATADV_CMD_GET_HARDIFS, /** * @BATADV_CMD_GET_TRANSTABLE_LOCAL: Query list of local translations */ BATADV_CMD_GET_TRANSTABLE_LOCAL, /** * @BATADV_CMD_GET_TRANSTABLE_GLOBAL: Query list of global translations */ BATADV_CMD_GET_TRANSTABLE_GLOBAL, /** * @BATADV_CMD_GET_ORIGINATORS: Query list of originators */ BATADV_CMD_GET_ORIGINATORS, /** * @BATADV_CMD_GET_NEIGHBORS: Query list of neighbours */ BATADV_CMD_GET_NEIGHBORS, /** * @BATADV_CMD_GET_GATEWAYS: Query list of gateways */ BATADV_CMD_GET_GATEWAYS, /** * @BATADV_CMD_GET_BLA_CLAIM: Query list of bridge loop avoidance claims */ BATADV_CMD_GET_BLA_CLAIM, /** * @BATADV_CMD_GET_BLA_BACKBONE: Query list of bridge loop avoidance * backbones */ BATADV_CMD_GET_BLA_BACKBONE, /** * @BATADV_CMD_GET_DAT_CACHE: Query list of DAT cache entries */ BATADV_CMD_GET_DAT_CACHE, /** * @BATADV_CMD_GET_MCAST_FLAGS: Query list of multicast flags */ BATADV_CMD_GET_MCAST_FLAGS, /* add new commands above here */ /** * @__BATADV_CMD_AFTER_LAST: internal use */ __BATADV_CMD_AFTER_LAST, /** * @BATADV_CMD_MAX: highest used command number */ BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST - 1 }; /** * enum batadv_tp_meter_reason - reason of a tp meter test run stop */ enum batadv_tp_meter_reason { /** * @BATADV_TP_REASON_COMPLETE: sender finished tp run */ BATADV_TP_REASON_COMPLETE = 3, /** * @BATADV_TP_REASON_CANCEL: sender was stopped during run */ BATADV_TP_REASON_CANCEL = 4, /* error status >= 128 */ /** * @BATADV_TP_REASON_DST_UNREACHABLE: receiver could not be reached or * didn't answer */ BATADV_TP_REASON_DST_UNREACHABLE = 128, /** * @BATADV_TP_REASON_RESEND_LIMIT: (unused) sender retry reached limit */ BATADV_TP_REASON_RESEND_LIMIT = 129, /** * @BATADV_TP_REASON_ALREADY_ONGOING: test to or from the same node * already ongoing */ BATADV_TP_REASON_ALREADY_ONGOING = 130, /** * @BATADV_TP_REASON_MEMORY_ERROR: test was stopped due to low memory */ BATADV_TP_REASON_MEMORY_ERROR = 131, /** * @BATADV_TP_REASON_CANT_SEND: failed to send via outgoing interface */ BATADV_TP_REASON_CANT_SEND = 132, /** * @BATADV_TP_REASON_TOO_MANY: too many ongoing sessions */ BATADV_TP_REASON_TOO_MANY = 133, }; #endif /* _LINUX_BATMAN_ADV_H_ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/gameport.h������������������������������������������������������������������������������������0000644�����������������00000001601�14763166027�0007704 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (c) 1999-2002 Vojtech Pavlik * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #ifndef _GAMEPORT_H #define _GAMEPORT_H #define GAMEPORT_MODE_DISABLED 0 #define GAMEPORT_MODE_RAW 1 #define GAMEPORT_MODE_COOKED 2 #define GAMEPORT_ID_VENDOR_ANALOG 0x0001 #define GAMEPORT_ID_VENDOR_MADCATZ 0x0002 #define GAMEPORT_ID_VENDOR_LOGITECH 0x0003 #define GAMEPORT_ID_VENDOR_CREATIVE 0x0004 #define GAMEPORT_ID_VENDOR_GENIUS 0x0005 #define GAMEPORT_ID_VENDOR_INTERACT 0x0006 #define GAMEPORT_ID_VENDOR_MICROSOFT 0x0007 #define GAMEPORT_ID_VENDOR_THRUSTMASTER 0x0008 #define GAMEPORT_ID_VENDOR_GRAVIS 0x0009 #define GAMEPORT_ID_VENDOR_GUILLEMOT 0x000a #endif /* _GAMEPORT_H */ �������������������������������������������������������������������������������������������������������������������������������linux/android/binder.h������������������������������������������������������������������������������0000644�����������������00000032567�14763166027�0010770 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2008 Google, Inc. * * Based on, but no longer compatible with, the original * OpenBinder.org binder driver interface, which is: * * Copyright (c) 2005 Palmsource, Inc. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * 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. * */ #ifndef _LINUX_BINDER_H #define _LINUX_BINDER_H #include <linux/types.h> #include <linux/ioctl.h> #define B_PACK_CHARS(c1, c2, c3, c4) \ ((((c1)<<24)) | (((c2)<<16)) | (((c3)<<8)) | (c4)) #define B_TYPE_LARGE 0x85 enum { BINDER_TYPE_BINDER = B_PACK_CHARS('s', 'b', '*', B_TYPE_LARGE), BINDER_TYPE_WEAK_BINDER = B_PACK_CHARS('w', 'b', '*', B_TYPE_LARGE), BINDER_TYPE_HANDLE = B_PACK_CHARS('s', 'h', '*', B_TYPE_LARGE), BINDER_TYPE_WEAK_HANDLE = B_PACK_CHARS('w', 'h', '*', B_TYPE_LARGE), BINDER_TYPE_FD = B_PACK_CHARS('f', 'd', '*', B_TYPE_LARGE), BINDER_TYPE_FDA = B_PACK_CHARS('f', 'd', 'a', B_TYPE_LARGE), BINDER_TYPE_PTR = B_PACK_CHARS('p', 't', '*', B_TYPE_LARGE), }; enum { FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff, FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100, }; #ifdef BINDER_IPC_32BIT typedef __u32 binder_size_t; typedef __u32 binder_uintptr_t; #else typedef __u64 binder_size_t; typedef __u64 binder_uintptr_t; #endif /** * struct binder_object_header - header shared by all binder metadata objects. * @type: type of the object */ struct binder_object_header { __u32 type; }; /* * This is the flattened representation of a Binder object for transfer * between processes. The 'offsets' supplied as part of a binder transaction * contains offsets into the data where these structures occur. The Binder * driver takes care of re-writing the structure type and data as it moves * between processes. */ struct flat_binder_object { struct binder_object_header hdr; __u32 flags; /* 8 bytes of data. */ union { binder_uintptr_t binder; /* local object */ __u32 handle; /* remote object */ }; /* extra data associated with local object */ binder_uintptr_t cookie; }; /** * struct binder_fd_object - describes a filedescriptor to be fixed up. * @hdr: common header structure * @pad_flags: padding to remain compatible with old userspace code * @pad_binder: padding to remain compatible with old userspace code * @fd: file descriptor * @cookie: opaque data, used by user-space */ struct binder_fd_object { struct binder_object_header hdr; __u32 pad_flags; union { binder_uintptr_t pad_binder; __u32 fd; }; binder_uintptr_t cookie; }; /* struct binder_buffer_object - object describing a userspace buffer * @hdr: common header structure * @flags: one or more BINDER_BUFFER_* flags * @buffer: address of the buffer * @length: length of the buffer * @parent: index in offset array pointing to parent buffer * @parent_offset: offset in @parent pointing to this buffer * * A binder_buffer object represents an object that the * binder kernel driver can copy verbatim to the target * address space. A buffer itself may be pointed to from * within another buffer, meaning that the pointer inside * that other buffer needs to be fixed up as well. This * can be done by setting the BINDER_BUFFER_FLAG_HAS_PARENT * flag in @flags, by setting @parent buffer to the index * in the offset array pointing to the parent binder_buffer_object, * and by setting @parent_offset to the offset in the parent buffer * at which the pointer to this buffer is located. */ struct binder_buffer_object { struct binder_object_header hdr; __u32 flags; binder_uintptr_t buffer; binder_size_t length; binder_size_t parent; binder_size_t parent_offset; }; enum { BINDER_BUFFER_FLAG_HAS_PARENT = 0x01, }; /* struct binder_fd_array_object - object describing an array of fds in a buffer * @hdr: common header structure * @pad: padding to ensure correct alignment * @num_fds: number of file descriptors in the buffer * @parent: index in offset array to buffer holding the fd array * @parent_offset: start offset of fd array in the buffer * * A binder_fd_array object represents an array of file * descriptors embedded in a binder_buffer_object. It is * different from a regular binder_buffer_object because it * describes a list of file descriptors to fix up, not an opaque * blob of memory, and hence the kernel needs to treat it differently. * * An example of how this would be used is with Android's * native_handle_t object, which is a struct with a list of integers * and a list of file descriptors. The native_handle_t struct itself * will be represented by a struct binder_buffer_objct, whereas the * embedded list of file descriptors is represented by a * struct binder_fd_array_object with that binder_buffer_object as * a parent. */ struct binder_fd_array_object { struct binder_object_header hdr; __u32 pad; binder_size_t num_fds; binder_size_t parent; binder_size_t parent_offset; }; /* * On 64-bit platforms where user code may run in 32-bits the driver must * translate the buffer (and local binder) addresses appropriately. */ struct binder_write_read { binder_size_t write_size; /* bytes to write */ binder_size_t write_consumed; /* bytes consumed by driver */ binder_uintptr_t write_buffer; binder_size_t read_size; /* bytes to read */ binder_size_t read_consumed; /* bytes consumed by driver */ binder_uintptr_t read_buffer; }; /* Use with BINDER_VERSION, driver fills in fields. */ struct binder_version { /* driver protocol version -- increment with incompatible change */ __s32 protocol_version; }; /* This is the current protocol version. */ #ifdef BINDER_IPC_32BIT #define BINDER_CURRENT_PROTOCOL_VERSION 7 #else #define BINDER_CURRENT_PROTOCOL_VERSION 8 #endif /* * Use with BINDER_GET_NODE_DEBUG_INFO, driver reads ptr, writes to all fields. * Set ptr to NULL for the first call to get the info for the first node, and * then repeat the call passing the previously returned value to get the next * nodes. ptr will be 0 when there are no more nodes. */ struct binder_node_debug_info { binder_uintptr_t ptr; binder_uintptr_t cookie; __u32 has_strong_ref; __u32 has_weak_ref; }; #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64) #define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32) #define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, __s32) #define BINDER_SET_CONTEXT_MGR _IOW('b', 7, __s32) #define BINDER_THREAD_EXIT _IOW('b', 8, __s32) #define BINDER_VERSION _IOWR('b', 9, struct binder_version) #define BINDER_GET_NODE_DEBUG_INFO _IOWR('b', 11, struct binder_node_debug_info) /* * NOTE: Two special error codes you should check for when calling * in to the driver are: * * EINTR -- The operation has been interupted. This should be * handled by retrying the ioctl() until a different error code * is returned. * * ECONNREFUSED -- The driver is no longer accepting operations * from your process. That is, the process is being destroyed. * You should handle this by exiting from your process. Note * that once this error code is returned, all further calls to * the driver from any thread will return this same code. */ enum transaction_flags { TF_ONE_WAY = 0x01, /* this is a one-way call: async, no return */ TF_ROOT_OBJECT = 0x04, /* contents are the component's root object */ TF_STATUS_CODE = 0x08, /* contents are a 32-bit status code */ TF_ACCEPT_FDS = 0x10, /* allow replies with file descriptors */ }; struct binder_transaction_data { /* The first two are only used for bcTRANSACTION and brTRANSACTION, * identifying the target and contents of the transaction. */ union { /* target descriptor of command transaction */ __u32 handle; /* target descriptor of return transaction */ binder_uintptr_t ptr; } target; binder_uintptr_t cookie; /* target object cookie */ __u32 code; /* transaction command */ /* General information about the transaction. */ __u32 flags; pid_t sender_pid; uid_t sender_euid; binder_size_t data_size; /* number of bytes of data */ binder_size_t offsets_size; /* number of bytes of offsets */ /* If this transaction is inline, the data immediately * follows here; otherwise, it ends with a pointer to * the data buffer. */ union { struct { /* transaction data */ binder_uintptr_t buffer; /* offsets from buffer to flat_binder_object structs */ binder_uintptr_t offsets; } ptr; __u8 buf[8]; } data; }; struct binder_transaction_data_sg { struct binder_transaction_data transaction_data; binder_size_t buffers_size; }; struct binder_ptr_cookie { binder_uintptr_t ptr; binder_uintptr_t cookie; }; struct binder_handle_cookie { __u32 handle; binder_uintptr_t cookie; } __attribute__((packed)); struct binder_pri_desc { __s32 priority; __u32 desc; }; struct binder_pri_ptr_cookie { __s32 priority; binder_uintptr_t ptr; binder_uintptr_t cookie; }; enum binder_driver_return_protocol { BR_ERROR = _IOR('r', 0, __s32), /* * int: error code */ BR_OK = _IO('r', 1), /* No parameters! */ BR_TRANSACTION = _IOR('r', 2, struct binder_transaction_data), BR_REPLY = _IOR('r', 3, struct binder_transaction_data), /* * binder_transaction_data: the received command. */ BR_ACQUIRE_RESULT = _IOR('r', 4, __s32), /* * not currently supported * int: 0 if the last bcATTEMPT_ACQUIRE was not successful. * Else the remote object has acquired a primary reference. */ BR_DEAD_REPLY = _IO('r', 5), /* * The target of the last transaction (either a bcTRANSACTION or * a bcATTEMPT_ACQUIRE) is no longer with us. No parameters. */ BR_TRANSACTION_COMPLETE = _IO('r', 6), /* * No parameters... always refers to the last transaction requested * (including replies). Note that this will be sent even for * asynchronous transactions. */ BR_INCREFS = _IOR('r', 7, struct binder_ptr_cookie), BR_ACQUIRE = _IOR('r', 8, struct binder_ptr_cookie), BR_RELEASE = _IOR('r', 9, struct binder_ptr_cookie), BR_DECREFS = _IOR('r', 10, struct binder_ptr_cookie), /* * void *: ptr to binder * void *: cookie for binder */ BR_ATTEMPT_ACQUIRE = _IOR('r', 11, struct binder_pri_ptr_cookie), /* * not currently supported * int: priority * void *: ptr to binder * void *: cookie for binder */ BR_NOOP = _IO('r', 12), /* * No parameters. Do nothing and examine the next command. It exists * primarily so that we can replace it with a BR_SPAWN_LOOPER command. */ BR_SPAWN_LOOPER = _IO('r', 13), /* * No parameters. The driver has determined that a process has no * threads waiting to service incoming transactions. When a process * receives this command, it must spawn a new service thread and * register it via bcENTER_LOOPER. */ BR_FINISHED = _IO('r', 14), /* * not currently supported * stop threadpool thread */ BR_DEAD_BINDER = _IOR('r', 15, binder_uintptr_t), /* * void *: cookie */ BR_CLEAR_DEATH_NOTIFICATION_DONE = _IOR('r', 16, binder_uintptr_t), /* * void *: cookie */ BR_FAILED_REPLY = _IO('r', 17), /* * The the last transaction (either a bcTRANSACTION or * a bcATTEMPT_ACQUIRE) failed (e.g. out of memory). No parameters. */ }; enum binder_driver_command_protocol { BC_TRANSACTION = _IOW('c', 0, struct binder_transaction_data), BC_REPLY = _IOW('c', 1, struct binder_transaction_data), /* * binder_transaction_data: the sent command. */ BC_ACQUIRE_RESULT = _IOW('c', 2, __s32), /* * not currently supported * int: 0 if the last BR_ATTEMPT_ACQUIRE was not successful. * Else you have acquired a primary reference on the object. */ BC_FREE_BUFFER = _IOW('c', 3, binder_uintptr_t), /* * void *: ptr to transaction data received on a read */ BC_INCREFS = _IOW('c', 4, __u32), BC_ACQUIRE = _IOW('c', 5, __u32), BC_RELEASE = _IOW('c', 6, __u32), BC_DECREFS = _IOW('c', 7, __u32), /* * int: descriptor */ BC_INCREFS_DONE = _IOW('c', 8, struct binder_ptr_cookie), BC_ACQUIRE_DONE = _IOW('c', 9, struct binder_ptr_cookie), /* * void *: ptr to binder * void *: cookie for binder */ BC_ATTEMPT_ACQUIRE = _IOW('c', 10, struct binder_pri_desc), /* * not currently supported * int: priority * int: descriptor */ BC_REGISTER_LOOPER = _IO('c', 11), /* * No parameters. * Register a spawned looper thread with the device. */ BC_ENTER_LOOPER = _IO('c', 12), BC_EXIT_LOOPER = _IO('c', 13), /* * No parameters. * These two commands are sent as an application-level thread * enters and exits the binder loop, respectively. They are * used so the binder can have an accurate count of the number * of looping threads it has available. */ BC_REQUEST_DEATH_NOTIFICATION = _IOW('c', 14, struct binder_handle_cookie), /* * int: handle * void *: cookie */ BC_CLEAR_DEATH_NOTIFICATION = _IOW('c', 15, struct binder_handle_cookie), /* * int: handle * void *: cookie */ BC_DEAD_BINDER_DONE = _IOW('c', 16, binder_uintptr_t), /* * void *: cookie */ BC_TRANSACTION_SG = _IOW('c', 17, struct binder_transaction_data_sg), BC_REPLY_SG = _IOW('c', 18, struct binder_transaction_data_sg), /* * binder_transaction_data_sg: the sent command. */ }; #endif /* _LINUX_BINDER_H */ �����������������������������������������������������������������������������������������������������������������������������������������linux/usbip.h���������������������������������������������������������������������������������������0000644�����������������00000001200�14763166027�0007203 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * usbip.h * * USBIP uapi defines and function prototypes etc. */ #ifndef _LINUX_USBIP_H #define _LINUX_USBIP_H /* usbip device status - exported in usbip device sysfs status */ enum usbip_device_status { /* sdev is available. */ SDEV_ST_AVAILABLE = 0x01, /* sdev is now used. */ SDEV_ST_USED, /* sdev is unusable because of a fatal error. */ SDEV_ST_ERROR, /* vdev does not connect a remote device. */ VDEV_ST_NULL, /* vdev is used, but the USB address is not assigned yet */ VDEV_ST_NOTASSIGNED, VDEV_ST_USED, VDEV_ST_ERROR }; #endif /* _LINUX_USBIP_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/msdos_fs.h������������������������������������������������������������������������������������0000644�����������������00000015463�14763166027�0007716 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_MSDOS_FS_H #define _LINUX_MSDOS_FS_H #include <linux/types.h> #include <linux/magic.h> #include <asm/byteorder.h> /* * The MS-DOS filesystem constants/structures */ #ifndef SECTOR_SIZE #define SECTOR_SIZE 512 /* sector size (bytes) */ #endif #define SECTOR_BITS 9 /* log2(SECTOR_SIZE) */ #define MSDOS_DPB (MSDOS_DPS) /* dir entries per block */ #define MSDOS_DPB_BITS 4 /* log2(MSDOS_DPB) */ #define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry)) #define MSDOS_DPS_BITS 4 /* log2(MSDOS_DPS) */ #define MSDOS_LONGNAME 256 /* maximum name length */ #define CF_LE_W(v) le16_to_cpu(v) #define CF_LE_L(v) le32_to_cpu(v) #define CT_LE_W(v) cpu_to_le16(v) #define CT_LE_L(v) cpu_to_le32(v) #define MSDOS_ROOT_INO 1 /* The root inode number */ #define MSDOS_FSINFO_INO 2 /* Used for managing the FSINFO block */ #define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */ /* directory limit */ #define FAT_MAX_DIR_ENTRIES (65536) #define FAT_MAX_DIR_SIZE (FAT_MAX_DIR_ENTRIES << MSDOS_DIR_BITS) #define ATTR_NONE 0 /* no attribute bits */ #define ATTR_RO 1 /* read-only */ #define ATTR_HIDDEN 2 /* hidden */ #define ATTR_SYS 4 /* system */ #define ATTR_VOLUME 8 /* volume label */ #define ATTR_DIR 16 /* directory */ #define ATTR_ARCH 32 /* archived */ /* attribute bits that are copied "as is" */ #define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN) /* bits that are used by the Windows 95/Windows NT extended FAT */ #define ATTR_EXT (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME) #define CASE_LOWER_BASE 8 /* base is lower case */ #define CASE_LOWER_EXT 16 /* extension is lower case */ #define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */ #define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG) #define FAT_LFN_LEN 255 /* maximum long name length */ #define MSDOS_NAME 11 /* maximum name length */ #define MSDOS_SLOTS 21 /* max # of slots for short and long names */ #define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */ #define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */ #define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \ MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x)) /* start of data cluster's entry (number of reserved clusters) */ #define FAT_START_ENT 2 /* maximum number of clusters */ #define MAX_FAT12 0xFF4 #define MAX_FAT16 0xFFF4 #define MAX_FAT32 0x0FFFFFF6 #define MAX_FAT(s) (MSDOS_SB(s)->fat_bits == 32 ? MAX_FAT32 : \ MSDOS_SB(s)->fat_bits == 16 ? MAX_FAT16 : MAX_FAT12) /* bad cluster mark */ #define BAD_FAT12 0xFF7 #define BAD_FAT16 0xFFF7 #define BAD_FAT32 0x0FFFFFF7 /* standard EOF */ #define EOF_FAT12 0xFFF #define EOF_FAT16 0xFFFF #define EOF_FAT32 0x0FFFFFFF #define FAT_ENT_FREE (0) #define FAT_ENT_BAD (BAD_FAT32) #define FAT_ENT_EOF (EOF_FAT32) #define FAT_FSINFO_SIG1 0x41615252 #define FAT_FSINFO_SIG2 0x61417272 #define IS_FSINFO(x) (le32_to_cpu((x)->signature1) == FAT_FSINFO_SIG1 \ && le32_to_cpu((x)->signature2) == FAT_FSINFO_SIG2) #define FAT_STATE_DIRTY 0x01 struct __fat_dirent { long d_ino; __kernel_off_t d_off; unsigned short d_reclen; char d_name[256]; /* We must not include limits.h! */ }; /* * ioctl commands */ #define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct __fat_dirent[2]) #define VFAT_IOCTL_READDIR_SHORT _IOR('r', 2, struct __fat_dirent[2]) /* <linux/videotext.h> has used 0x72 ('r') in collision, so skip a few */ #define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32) #define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32) /*Android kernel has used 0x12, so we use 0x13*/ #define FAT_IOCTL_GET_VOLUME_ID _IOR('r', 0x13, __u32) struct fat_boot_sector { __u8 ignored[3]; /* Boot strap short or near jump */ __u8 system_id[8]; /* Name - can be used to special case partition manager volumes */ __u8 sector_size[2]; /* bytes per logical sector */ __u8 sec_per_clus; /* sectors/cluster */ __le16 reserved; /* reserved sectors */ __u8 fats; /* number of FATs */ __u8 dir_entries[2]; /* root directory entries */ __u8 sectors[2]; /* number of sectors */ __u8 media; /* media code */ __le16 fat_length; /* sectors/FAT */ __le16 secs_track; /* sectors per track */ __le16 heads; /* number of heads */ __le32 hidden; /* hidden sectors (unused) */ __le32 total_sect; /* number of sectors (if sectors == 0) */ union { struct { /* Extended BPB Fields for FAT16 */ __u8 drive_number; /* Physical drive number */ __u8 state; /* undocumented, but used for mount state. */ __u8 signature; /* extended boot signature */ __u8 vol_id[4]; /* volume ID */ __u8 vol_label[11]; /* volume label */ __u8 fs_type[8]; /* file system type */ /* other fields are not added here */ } fat16; struct { /* only used by FAT32 */ __le32 length; /* sectors/FAT */ __le16 flags; /* bit 8: fat mirroring, low 4: active fat */ __u8 version[2]; /* major, minor filesystem version */ __le32 root_cluster; /* first cluster in root directory */ __le16 info_sector; /* filesystem info sector */ __le16 backup_boot; /* backup boot sector */ __le16 reserved2[6]; /* Unused */ /* Extended BPB Fields for FAT32 */ __u8 drive_number; /* Physical drive number */ __u8 state; /* undocumented, but used for mount state. */ __u8 signature; /* extended boot signature */ __u8 vol_id[4]; /* volume ID */ __u8 vol_label[11]; /* volume label */ __u8 fs_type[8]; /* file system type */ /* other fields are not added here */ } fat32; }; }; struct fat_boot_fsinfo { __le32 signature1; /* 0x41615252L */ __le32 reserved1[120]; /* Nothing as far as I can tell */ __le32 signature2; /* 0x61417272L */ __le32 free_clusters; /* Free cluster count. -1 if unknown */ __le32 next_cluster; /* Most recently allocated cluster */ __le32 reserved2[4]; }; struct msdos_dir_entry { __u8 name[MSDOS_NAME];/* name and extension */ __u8 attr; /* attribute bits */ __u8 lcase; /* Case for base and extension */ __u8 ctime_cs; /* Creation time, centiseconds (0-199) */ __le16 ctime; /* Creation time */ __le16 cdate; /* Creation date */ __le16 adate; /* Last access date */ __le16 starthi; /* High 16 bits of cluster in FAT32 */ __le16 time,date,start;/* time, date and first cluster */ __le32 size; /* file size (in bytes) */ }; /* Up to 13 characters of the name */ struct msdos_dir_slot { __u8 id; /* sequence number for slot */ __u8 name0_4[10]; /* first 5 characters in name */ __u8 attr; /* attribute byte */ __u8 reserved; /* always 0 */ __u8 alias_checksum; /* checksum for 8.3 alias */ __u8 name5_10[12]; /* 6 more characters in name */ __le16 start; /* starting cluster number, 0 in long slots */ __u8 name11_12[4]; /* last 2 characters in name */ }; #endif /* _LINUX_MSDOS_FS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/psample.h�������������������������������������������������������������������������������������0000644�����������������00000001436�14763166027�0007535 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __UAPI_PSAMPLE_H #define __UAPI_PSAMPLE_H enum { /* sampled packet metadata */ PSAMPLE_ATTR_IIFINDEX, PSAMPLE_ATTR_OIFINDEX, PSAMPLE_ATTR_ORIGSIZE, PSAMPLE_ATTR_SAMPLE_GROUP, PSAMPLE_ATTR_GROUP_SEQ, PSAMPLE_ATTR_SAMPLE_RATE, PSAMPLE_ATTR_DATA, /* commands attributes */ PSAMPLE_ATTR_GROUP_REFCOUNT, __PSAMPLE_ATTR_MAX }; enum psample_command { PSAMPLE_CMD_SAMPLE, PSAMPLE_CMD_GET_GROUP, PSAMPLE_CMD_NEW_GROUP, PSAMPLE_CMD_DEL_GROUP, }; /* Can be overridden at runtime by module option */ #define PSAMPLE_ATTR_MAX (__PSAMPLE_ATTR_MAX - 1) #define PSAMPLE_NL_MCGRP_CONFIG_NAME "config" #define PSAMPLE_NL_MCGRP_SAMPLE_NAME "packets" #define PSAMPLE_GENL_NAME "psample" #define PSAMPLE_GENL_VERSION 1 #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/ax25.h����������������������������������������������������������������������������������������0000644�����������������00000005410�14763166027�0006647 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * These are the public elements of the Linux kernel AX.25 code. A similar * file netrom.h exists for the NET/ROM protocol. */ #ifndef AX25_KERNEL_H #define AX25_KERNEL_H #include <linux/socket.h> #define AX25_MTU 256 #define AX25_MAX_DIGIS 8 #define AX25_WINDOW 1 #define AX25_T1 2 #define AX25_N2 3 #define AX25_T3 4 #define AX25_T2 5 #define AX25_BACKOFF 6 #define AX25_EXTSEQ 7 #define AX25_PIDINCL 8 #define AX25_IDLE 9 #define AX25_PACLEN 10 #define AX25_IAMDIGI 12 #define AX25_KILL 99 #define SIOCAX25GETUID (SIOCPROTOPRIVATE+0) #define SIOCAX25ADDUID (SIOCPROTOPRIVATE+1) #define SIOCAX25DELUID (SIOCPROTOPRIVATE+2) #define SIOCAX25NOUID (SIOCPROTOPRIVATE+3) #define SIOCAX25OPTRT (SIOCPROTOPRIVATE+7) #define SIOCAX25CTLCON (SIOCPROTOPRIVATE+8) #define SIOCAX25GETINFOOLD (SIOCPROTOPRIVATE+9) #define SIOCAX25ADDFWD (SIOCPROTOPRIVATE+10) #define SIOCAX25DELFWD (SIOCPROTOPRIVATE+11) #define SIOCAX25DEVCTL (SIOCPROTOPRIVATE+12) #define SIOCAX25GETINFO (SIOCPROTOPRIVATE+13) #define AX25_SET_RT_IPMODE 2 #define AX25_NOUID_DEFAULT 0 #define AX25_NOUID_BLOCK 1 typedef struct { char ax25_call[7]; /* 6 call + SSID (shifted ascii!) */ } ax25_address; struct sockaddr_ax25 { __kernel_sa_family_t sax25_family; ax25_address sax25_call; int sax25_ndigis; /* Digipeater ax25_address sets follow */ }; #define sax25_uid sax25_ndigis struct full_sockaddr_ax25 { struct sockaddr_ax25 fsa_ax25; ax25_address fsa_digipeater[AX25_MAX_DIGIS]; }; struct ax25_routes_struct { ax25_address port_addr; ax25_address dest_addr; unsigned char digi_count; ax25_address digi_addr[AX25_MAX_DIGIS]; }; struct ax25_route_opt_struct { ax25_address port_addr; ax25_address dest_addr; int cmd; int arg; }; struct ax25_ctl_struct { ax25_address port_addr; ax25_address source_addr; ax25_address dest_addr; unsigned int cmd; unsigned long arg; unsigned char digi_count; ax25_address digi_addr[AX25_MAX_DIGIS]; }; /* this will go away. Please do not export to user land */ struct ax25_info_struct_deprecated { unsigned int n2, n2count; unsigned int t1, t1timer; unsigned int t2, t2timer; unsigned int t3, t3timer; unsigned int idle, idletimer; unsigned int state; unsigned int rcv_q, snd_q; }; struct ax25_info_struct { unsigned int n2, n2count; unsigned int t1, t1timer; unsigned int t2, t2timer; unsigned int t3, t3timer; unsigned int idle, idletimer; unsigned int state; unsigned int rcv_q, snd_q; unsigned int vs, vr, va, vs_max; unsigned int paclen; unsigned int window; }; struct ax25_fwd_struct { ax25_address port_from; ax25_address port_to; }; #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_eql.h��������������������������������������������������������������������������������������0000644�����������������00000002505�14763166027�0007331 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Equalizer Load-balancer for serial network interfaces. * * (c) Copyright 1995 Simon "Guru Aleph-Null" Janes * NCM: Network and Communications Management, Inc. * * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * * The author may be reached as simon@ncm.com, or C/O * NCM * Attn: Simon Janes * 6803 Whittier Ave * McLean VA 22101 * Phone: 1-703-847-0040 ext 103 */ #ifndef _LINUX_IF_EQL_H #define _LINUX_IF_EQL_H #define EQL_DEFAULT_SLAVE_PRIORITY 28800 #define EQL_DEFAULT_MAX_SLAVES 4 #define EQL_DEFAULT_MTU 576 #define EQL_DEFAULT_RESCHED_IVAL HZ #define EQL_ENSLAVE (SIOCDEVPRIVATE) #define EQL_EMANCIPATE (SIOCDEVPRIVATE + 1) #define EQL_GETSLAVECFG (SIOCDEVPRIVATE + 2) #define EQL_SETSLAVECFG (SIOCDEVPRIVATE + 3) #define EQL_GETMASTRCFG (SIOCDEVPRIVATE + 4) #define EQL_SETMASTRCFG (SIOCDEVPRIVATE + 5) typedef struct master_config { char master_name[16]; int max_slaves; int min_slaves; } master_config_t; typedef struct slave_config { char slave_name[16]; long priority; } slave_config_t; typedef struct slaving_request { char slave_name[16]; long priority; } slaving_request_t; #endif /* _LINUX_IF_EQL_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/llc.h�����������������������������������������������������������������������������������������0000644�����������������00000006134�14763166027�0006646 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* * IEEE 802.2 User Interface SAPs for Linux, data structures and indicators. * * Copyright (c) 2001 by Jay Schulist <jschlst@samba.org> * * This program can be redistributed or modified under the terms of the * GNU General Public License as published by the Free Software Foundation. * This program is distributed without any warranty or implied warranty * of merchantability or fitness for a particular purpose. * * See the GNU General Public License for more details. */ #ifndef __LINUX_LLC_H #define __LINUX_LLC_H #include <linux/socket.h> #include <linux/if.h> /* For IFHWADDRLEN. */ #define __LLC_SOCK_SIZE__ 16 /* sizeof(sockaddr_llc), word align. */ struct sockaddr_llc { __kernel_sa_family_t sllc_family; /* AF_LLC */ __kernel_sa_family_t sllc_arphrd; /* ARPHRD_ETHER */ unsigned char sllc_test; unsigned char sllc_xid; unsigned char sllc_ua; /* UA data, only for SOCK_STREAM. */ unsigned char sllc_sap; unsigned char sllc_mac[IFHWADDRLEN]; unsigned char __pad[__LLC_SOCK_SIZE__ - sizeof(__kernel_sa_family_t) * 2 - sizeof(unsigned char) * 4 - IFHWADDRLEN]; }; /* sockopt definitions. */ enum llc_sockopts { LLC_OPT_UNKNOWN = 0, LLC_OPT_RETRY, /* max retrans attempts. */ LLC_OPT_SIZE, /* max PDU size (octets). */ LLC_OPT_ACK_TMR_EXP, /* ack expire time (secs). */ LLC_OPT_P_TMR_EXP, /* pf cycle expire time (secs). */ LLC_OPT_REJ_TMR_EXP, /* rej sent expire time (secs). */ LLC_OPT_BUSY_TMR_EXP, /* busy state expire time (secs). */ LLC_OPT_TX_WIN, /* tx window size. */ LLC_OPT_RX_WIN, /* rx window size. */ LLC_OPT_PKTINFO, /* ancillary packet information. */ LLC_OPT_MAX }; #define LLC_OPT_MAX_RETRY 100 #define LLC_OPT_MAX_SIZE 4196 #define LLC_OPT_MAX_WIN 127 #define LLC_OPT_MAX_ACK_TMR_EXP 60 #define LLC_OPT_MAX_P_TMR_EXP 60 #define LLC_OPT_MAX_REJ_TMR_EXP 60 #define LLC_OPT_MAX_BUSY_TMR_EXP 60 /* LLC SAP types. */ #define LLC_SAP_NULL 0x00 /* NULL SAP. */ #define LLC_SAP_LLC 0x02 /* LLC Sublayer Management. */ #define LLC_SAP_SNA 0x04 /* SNA Path Control. */ #define LLC_SAP_PNM 0x0E /* Proway Network Management. */ #define LLC_SAP_IP 0x06 /* TCP/IP. */ #define LLC_SAP_BSPAN 0x42 /* Bridge Spanning Tree Proto */ #define LLC_SAP_MMS 0x4E /* Manufacturing Message Srv. */ #define LLC_SAP_8208 0x7E /* ISO 8208 */ #define LLC_SAP_3COM 0x80 /* 3COM. */ #define LLC_SAP_PRO 0x8E /* Proway Active Station List */ #define LLC_SAP_SNAP 0xAA /* SNAP. */ #define LLC_SAP_BANYAN 0xBC /* Banyan. */ #define LLC_SAP_IPX 0xE0 /* IPX/SPX. */ #define LLC_SAP_NETBEUI 0xF0 /* NetBEUI. */ #define LLC_SAP_LANMGR 0xF4 /* LanManager. */ #define LLC_SAP_IMPL 0xF8 /* IMPL */ #define LLC_SAP_DISC 0xFC /* Discovery */ #define LLC_SAP_OSI 0xFE /* OSI Network Layers. */ #define LLC_SAP_LAR 0xDC /* LAN Address Resolution */ #define LLC_SAP_RM 0xD4 /* Resource Management */ #define LLC_SAP_GLOBAL 0xFF /* Global SAP. */ struct llc_pktinfo { int lpi_ifindex; unsigned char lpi_sap; unsigned char lpi_mac[IFHWADDRLEN]; }; #endif /* __LINUX_LLC_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/pcitest.h�������������������������������������������������������������������������������������0000644�����������������00000001307�14763166027�0007544 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /** * pcitest.h - PCI test uapi defines * * Copyright (C) 2017 Texas Instruments * Author: Kishon Vijay Abraham I <kishon@ti.com> * */ #ifndef __UAPI_LINUX_PCITEST_H #define __UAPI_LINUX_PCITEST_H #define PCITEST_BAR _IO('P', 0x1) #define PCITEST_LEGACY_IRQ _IO('P', 0x2) #define PCITEST_MSI _IOW('P', 0x3, int) #define PCITEST_WRITE _IOW('P', 0x4, unsigned long) #define PCITEST_READ _IOW('P', 0x5, unsigned long) #define PCITEST_COPY _IOW('P', 0x6, unsigned long) #define PCITEST_MSIX _IOW('P', 0x7, int) #define PCITEST_SET_IRQTYPE _IOW('P', 0x8, int) #define PCITEST_GET_IRQTYPE _IO('P', 0x9) #endif /* __UAPI_LINUX_PCITEST_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/bpfilter.h������������������������������������������������������������������������������������0000644�����������������00000000671�14763166027�0007703 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_BPFILTER_H #define _LINUX_BPFILTER_H #include <linux/if.h> enum { BPFILTER_IPT_SO_SET_REPLACE = 64, BPFILTER_IPT_SO_SET_ADD_COUNTERS = 65, BPFILTER_IPT_SET_MAX, }; enum { BPFILTER_IPT_SO_GET_INFO = 64, BPFILTER_IPT_SO_GET_ENTRIES = 65, BPFILTER_IPT_SO_GET_REVISION_MATCH = 66, BPFILTER_IPT_SO_GET_REVISION_TARGET = 67, BPFILTER_IPT_GET_MAX, }; #endif /* _LINUX_BPFILTER_H */ �����������������������������������������������������������������������linux/virtio_net.h����������������������������������������������������������������������������������0000644�����������������00000024465�14763166027�0010265 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _LINUX_VIRTIO_NET_H #define _LINUX_VIRTIO_NET_H /* This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <linux/types.h> #include <linux/virtio_ids.h> #include <linux/virtio_config.h> #include <linux/virtio_types.h> #include <linux/if_ether.h> /* The feature bitmap for virtio net */ #define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */ #define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */ #define VIRTIO_NET_F_CTRL_GUEST_OFFLOADS 2 /* Dynamic offload configuration. */ #define VIRTIO_NET_F_MTU 3 /* Initial MTU advice */ #define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */ #define VIRTIO_NET_F_GUEST_TSO4 7 /* Guest can handle TSOv4 in. */ #define VIRTIO_NET_F_GUEST_TSO6 8 /* Guest can handle TSOv6 in. */ #define VIRTIO_NET_F_GUEST_ECN 9 /* Guest can handle TSO[6] w/ ECN in. */ #define VIRTIO_NET_F_GUEST_UFO 10 /* Guest can handle UFO in. */ #define VIRTIO_NET_F_HOST_TSO4 11 /* Host can handle TSOv4 in. */ #define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */ #define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */ #define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */ #define VIRTIO_NET_F_MRG_RXBUF 15 /* Host can merge receive buffers. */ #define VIRTIO_NET_F_STATUS 16 /* virtio_net_config.status available */ #define VIRTIO_NET_F_CTRL_VQ 17 /* Control channel available */ #define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */ #define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */ #define VIRTIO_NET_F_CTRL_RX_EXTRA 20 /* Extra RX mode control support */ #define VIRTIO_NET_F_GUEST_ANNOUNCE 21 /* Guest can announce device on the * network */ #define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow * Steering */ #define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */ #define VIRTIO_NET_F_STANDBY 62 /* Act as standby for another device * with the same MAC. */ #define VIRTIO_NET_F_SPEED_DUPLEX 63 /* Device set linkspeed and duplex */ #ifndef VIRTIO_NET_NO_LEGACY #define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */ #endif /* VIRTIO_NET_NO_LEGACY */ #define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ #define VIRTIO_NET_S_ANNOUNCE 2 /* Announcement is needed */ struct virtio_net_config { /* The config defining mac address (if VIRTIO_NET_F_MAC) */ __u8 mac[ETH_ALEN]; /* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */ __u16 status; /* Maximum number of each of transmit and receive queues; * see VIRTIO_NET_F_MQ and VIRTIO_NET_CTRL_MQ. * Legal values are between 1 and 0x8000 */ __u16 max_virtqueue_pairs; /* Default maximum transmit unit advice */ __u16 mtu; /* * speed, in units of 1Mb. All values 0 to INT_MAX are legal. * Any other value stands for unknown. */ __u32 speed; /* * 0x00 - half duplex * 0x01 - full duplex * Any other value stands for unknown. */ __u8 duplex; } __attribute__((packed)); /* * This header comes first in the scatter-gather list. If you don't * specify GSO or CSUM features, you can simply ignore the header. * * This is bitwise-equivalent to the legacy struct virtio_net_hdr_mrg_rxbuf, * only flattened. */ struct virtio_net_hdr_v1 { #define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 /* Use csum_start, csum_offset */ #define VIRTIO_NET_HDR_F_DATA_VALID 2 /* Csum is valid */ __u8 flags; #define VIRTIO_NET_HDR_GSO_NONE 0 /* Not a GSO frame */ #define VIRTIO_NET_HDR_GSO_TCPV4 1 /* GSO frame, IPv4 TCP (TSO) */ #define VIRTIO_NET_HDR_GSO_UDP 3 /* GSO frame, IPv4 UDP (UFO) */ #define VIRTIO_NET_HDR_GSO_TCPV6 4 /* GSO frame, IPv6 TCP */ #define VIRTIO_NET_HDR_GSO_ECN 0x80 /* TCP has ECN set */ __u8 gso_type; __virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */ __virtio16 gso_size; /* Bytes to append to hdr_len per frame */ __virtio16 csum_start; /* Position to start checksumming from */ __virtio16 csum_offset; /* Offset after that to place checksum */ __virtio16 num_buffers; /* Number of merged rx buffers */ }; #ifndef VIRTIO_NET_NO_LEGACY /* This header comes first in the scatter-gather list. * For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated, it must * be the first element of the scatter-gather list. If you don't * specify GSO or CSUM features, you can simply ignore the header. */ struct virtio_net_hdr { /* See VIRTIO_NET_HDR_F_* */ __u8 flags; /* See VIRTIO_NET_HDR_GSO_* */ __u8 gso_type; __virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */ __virtio16 gso_size; /* Bytes to append to hdr_len per frame */ __virtio16 csum_start; /* Position to start checksumming from */ __virtio16 csum_offset; /* Offset after that to place checksum */ }; /* This is the version of the header to use when the MRG_RXBUF * feature has been negotiated. */ struct virtio_net_hdr_mrg_rxbuf { struct virtio_net_hdr hdr; __virtio16 num_buffers; /* Number of merged rx buffers */ }; #endif /* ...VIRTIO_NET_NO_LEGACY */ /* * Control virtqueue data structures * * The control virtqueue expects a header in the first sg entry * and an ack/status response in the last entry. Data for the * command goes in between. */ struct virtio_net_ctrl_hdr { __u8 class; __u8 cmd; } __attribute__((packed)); typedef __u8 virtio_net_ctrl_ack; #define VIRTIO_NET_OK 0 #define VIRTIO_NET_ERR 1 /* * Control the RX mode, ie. promisucous, allmulti, etc... * All commands require an "out" sg entry containing a 1 byte * state value, zero = disable, non-zero = enable. Commands * 0 and 1 are supported with the VIRTIO_NET_F_CTRL_RX feature. * Commands 2-5 are added with VIRTIO_NET_F_CTRL_RX_EXTRA. */ #define VIRTIO_NET_CTRL_RX 0 #define VIRTIO_NET_CTRL_RX_PROMISC 0 #define VIRTIO_NET_CTRL_RX_ALLMULTI 1 #define VIRTIO_NET_CTRL_RX_ALLUNI 2 #define VIRTIO_NET_CTRL_RX_NOMULTI 3 #define VIRTIO_NET_CTRL_RX_NOUNI 4 #define VIRTIO_NET_CTRL_RX_NOBCAST 5 /* * Control the MAC * * The MAC filter table is managed by the hypervisor, the guest should * assume the size is infinite. Filtering should be considered * non-perfect, ie. based on hypervisor resources, the guest may * received packets from sources not specified in the filter list. * * In addition to the class/cmd header, the TABLE_SET command requires * two out scatterlists. Each contains a 4 byte count of entries followed * by a concatenated byte stream of the ETH_ALEN MAC addresses. The * first sg list contains unicast addresses, the second is for multicast. * This functionality is present if the VIRTIO_NET_F_CTRL_RX feature * is available. * * The ADDR_SET command requests one out scatterlist, it contains a * 6 bytes MAC address. This functionality is present if the * VIRTIO_NET_F_CTRL_MAC_ADDR feature is available. */ struct virtio_net_ctrl_mac { __virtio32 entries; __u8 macs[][ETH_ALEN]; } __attribute__((packed)); #define VIRTIO_NET_CTRL_MAC 1 #define VIRTIO_NET_CTRL_MAC_TABLE_SET 0 #define VIRTIO_NET_CTRL_MAC_ADDR_SET 1 /* * Control VLAN filtering * * The VLAN filter table is controlled via a simple ADD/DEL interface. * VLAN IDs not added may be filterd by the hypervisor. Del is the * opposite of add. Both commands expect an out entry containing a 2 * byte VLAN ID. VLAN filterting is available with the * VIRTIO_NET_F_CTRL_VLAN feature bit. */ #define VIRTIO_NET_CTRL_VLAN 2 #define VIRTIO_NET_CTRL_VLAN_ADD 0 #define VIRTIO_NET_CTRL_VLAN_DEL 1 /* * Control link announce acknowledgement * * The command VIRTIO_NET_CTRL_ANNOUNCE_ACK is used to indicate that * driver has recevied the notification; device would clear the * VIRTIO_NET_S_ANNOUNCE bit in the status field after it receives * this command. */ #define VIRTIO_NET_CTRL_ANNOUNCE 3 #define VIRTIO_NET_CTRL_ANNOUNCE_ACK 0 /* * Control Receive Flow Steering * * The command VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET * enables Receive Flow Steering, specifying the number of the transmit and * receive queues that will be used. After the command is consumed and acked by * the device, the device will not steer new packets on receive virtqueues * other than specified nor read from transmit virtqueues other than specified. * Accordingly, driver should not transmit new packets on virtqueues other than * specified. */ struct virtio_net_ctrl_mq { __virtio16 virtqueue_pairs; }; #define VIRTIO_NET_CTRL_MQ 4 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000 /* * Control network offloads * * Reconfigures the network offloads that Guest can handle. * * Available with the VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature bit. * * Command data format matches the feature bit mask exactly. * * See VIRTIO_NET_F_GUEST_* for the list of offloads * that can be enabled/disabled. */ #define VIRTIO_NET_CTRL_GUEST_OFFLOADS 5 #define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0 #endif /* _LINUX_VIRTIO_NET_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/isdn_divertif.h�������������������������������������������������������������������������������0000644�����������������00000002260�14763166027�0010721 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* $Id: isdn_divertif.h,v 1.4.6.1 2001/09/23 22:25:05 kai Exp $ * * Header for the diversion supplementary interface for i4l. * * Author Werner Cornelius (werner@titro.de) * Copyright by Werner Cornelius (werner@titro.de) * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * */ #ifndef _LINUX_ISDN_DIVERTIF_H #define _LINUX_ISDN_DIVERTIF_H /***********************************************************/ /* magic value is also used to control version information */ /***********************************************************/ #define DIVERT_IF_MAGIC 0x25873401 #define DIVERT_CMD_REG 0x00 /* register command */ #define DIVERT_CMD_REL 0x01 /* release command */ #define DIVERT_NO_ERR 0x00 /* return value no error */ #define DIVERT_CMD_ERR 0x01 /* invalid cmd */ #define DIVERT_VER_ERR 0x02 /* magic/version invalid */ #define DIVERT_REG_ERR 0x03 /* module already registered */ #define DIVERT_REL_ERR 0x04 /* module not registered */ #define DIVERT_REG_NAME isdn_register_divert #endif /* _LINUX_ISDN_DIVERTIF_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/adb.h�����������������������������������������������������������������������������������������0000644�����������������00000002164�14763166027�0006621 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Definitions for ADB (Apple Desktop Bus) support. */ #ifndef __ADB_H #define __ADB_H /* ADB commands */ #define ADB_BUSRESET 0 #define ADB_FLUSH(id) (0x01 | ((id) << 4)) #define ADB_WRITEREG(id, reg) (0x08 | (reg) | ((id) << 4)) #define ADB_READREG(id, reg) (0x0C | (reg) | ((id) << 4)) /* ADB default device IDs (upper 4 bits of ADB command byte) */ #define ADB_DONGLE 1 /* "software execution control" devices */ #define ADB_KEYBOARD 2 #define ADB_MOUSE 3 #define ADB_TABLET 4 #define ADB_MODEM 5 #define ADB_MISC 7 /* maybe a monitor */ #define ADB_RET_OK 0 #define ADB_RET_TIMEOUT 3 /* The kind of ADB request. The controller may emulate some or all of those CUDA/PMU packet kinds */ #define ADB_PACKET 0 #define CUDA_PACKET 1 #define ERROR_PACKET 2 #define TIMER_PACKET 3 #define POWER_PACKET 4 #define MACIIC_PACKET 5 #define PMU_PACKET 6 #define ADB_QUERY 7 /* ADB queries */ /* ADB_QUERY_GETDEVINFO * Query ADB slot for device presence * data[2] = id, rep[0] = orig addr, rep[1] = handler_id */ #define ADB_QUERY_GETDEVINFO 1 #endif /* __ADB_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/ptrace.h��������������������������������������������������������������������������������������0000644�����������������00000006653�14763166027�0007360 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_PTRACE_H #define _LINUX_PTRACE_H /* ptrace.h */ /* structs and defines to help the user use the ptrace system call. */ /* has the defines to get at the registers. */ #include <linux/types.h> #define PTRACE_TRACEME 0 #define PTRACE_PEEKTEXT 1 #define PTRACE_PEEKDATA 2 #define PTRACE_PEEKUSR 3 #define PTRACE_POKETEXT 4 #define PTRACE_POKEDATA 5 #define PTRACE_POKEUSR 6 #define PTRACE_CONT 7 #define PTRACE_KILL 8 #define PTRACE_SINGLESTEP 9 #define PTRACE_ATTACH 16 #define PTRACE_DETACH 17 #define PTRACE_SYSCALL 24 /* 0x4200-0x4300 are reserved for architecture-independent additions. */ #define PTRACE_SETOPTIONS 0x4200 #define PTRACE_GETEVENTMSG 0x4201 #define PTRACE_GETSIGINFO 0x4202 #define PTRACE_SETSIGINFO 0x4203 /* * Generic ptrace interface that exports the architecture specific regsets * using the corresponding NT_* types (which are also used in the core dump). * Please note that the NT_PRSTATUS note type in a core dump contains a full * 'struct elf_prstatus'. But the user_regset for NT_PRSTATUS contains just the * elf_gregset_t that is the pr_reg field of 'struct elf_prstatus'. For all the * other user_regset flavors, the user_regset layout and the ELF core dump note * payload are exactly the same layout. * * This interface usage is as follows: * struct iovec iov = { buf, len}; * * ret = ptrace(PTRACE_GETREGSET/PTRACE_SETREGSET, pid, NT_XXX_TYPE, &iov); * * On the successful completion, iov.len will be updated by the kernel, * specifying how much the kernel has written/read to/from the user's iov.buf. */ #define PTRACE_GETREGSET 0x4204 #define PTRACE_SETREGSET 0x4205 #define PTRACE_SEIZE 0x4206 #define PTRACE_INTERRUPT 0x4207 #define PTRACE_LISTEN 0x4208 #define PTRACE_PEEKSIGINFO 0x4209 struct ptrace_peeksiginfo_args { __u64 off; /* from which siginfo to start */ __u32 flags; __s32 nr; /* how may siginfos to take */ }; #define PTRACE_GETSIGMASK 0x420a #define PTRACE_SETSIGMASK 0x420b #define PTRACE_SECCOMP_GET_FILTER 0x420c #define PTRACE_SECCOMP_GET_METADATA 0x420d struct seccomp_metadata { __u64 filter_off; /* Input: which filter */ __u64 flags; /* Output: filter's flags */ }; /* Read signals from a shared (process wide) queue */ #define PTRACE_PEEKSIGINFO_SHARED (1 << 0) /* Wait extended result codes for the above trace options. */ #define PTRACE_EVENT_FORK 1 #define PTRACE_EVENT_VFORK 2 #define PTRACE_EVENT_CLONE 3 #define PTRACE_EVENT_EXEC 4 #define PTRACE_EVENT_VFORK_DONE 5 #define PTRACE_EVENT_EXIT 6 #define PTRACE_EVENT_SECCOMP 7 /* Extended result codes which enabled by means other than options. */ #define PTRACE_EVENT_STOP 128 /* Options set using PTRACE_SETOPTIONS or using PTRACE_SEIZE @data param */ #define PTRACE_O_TRACESYSGOOD 1 #define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK) #define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK) #define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE) #define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC) #define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE) #define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT) #define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP) /* eventless options */ #define PTRACE_O_EXITKILL (1 << 20) #define PTRACE_O_SUSPEND_SECCOMP (1 << 21) #define PTRACE_O_MASK (\ 0x000000ff | PTRACE_O_EXITKILL | PTRACE_O_SUSPEND_SECCOMP) #include <asm/ptrace.h> #endif /* _LINUX_PTRACE_H */ �������������������������������������������������������������������������������������linux/ipx.h�����������������������������������������������������������������������������������������0000644�����������������00000004453�14763166027�0006676 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IPX_H_ #define _IPX_H_ #include <linux/libc-compat.h> /* for compatibility with glibc netipx/ipx.h */ #include <linux/types.h> #include <linux/sockios.h> #include <linux/socket.h> #define IPX_NODE_LEN 6 #define IPX_MTU 576 #if __UAPI_DEF_SOCKADDR_IPX struct sockaddr_ipx { __kernel_sa_family_t sipx_family; __be16 sipx_port; __be32 sipx_network; unsigned char sipx_node[IPX_NODE_LEN]; __u8 sipx_type; unsigned char sipx_zero; /* 16 byte fill */ }; #endif /* __UAPI_DEF_SOCKADDR_IPX */ /* * So we can fit the extra info for SIOCSIFADDR into the address nicely */ #define sipx_special sipx_port #define sipx_action sipx_zero #define IPX_DLTITF 0 #define IPX_CRTITF 1 #if __UAPI_DEF_IPX_ROUTE_DEFINITION struct ipx_route_definition { __be32 ipx_network; __be32 ipx_router_network; unsigned char ipx_router_node[IPX_NODE_LEN]; }; #endif /* __UAPI_DEF_IPX_ROUTE_DEFINITION */ #if __UAPI_DEF_IPX_INTERFACE_DEFINITION struct ipx_interface_definition { __be32 ipx_network; unsigned char ipx_device[16]; unsigned char ipx_dlink_type; #define IPX_FRAME_NONE 0 #define IPX_FRAME_SNAP 1 #define IPX_FRAME_8022 2 #define IPX_FRAME_ETHERII 3 #define IPX_FRAME_8023 4 #define IPX_FRAME_TR_8022 5 /* obsolete */ unsigned char ipx_special; #define IPX_SPECIAL_NONE 0 #define IPX_PRIMARY 1 #define IPX_INTERNAL 2 unsigned char ipx_node[IPX_NODE_LEN]; }; #endif /* __UAPI_DEF_IPX_INTERFACE_DEFINITION */ #if __UAPI_DEF_IPX_CONFIG_DATA struct ipx_config_data { unsigned char ipxcfg_auto_select_primary; unsigned char ipxcfg_auto_create_interfaces; }; #endif /* __UAPI_DEF_IPX_CONFIG_DATA */ /* * OLD Route Definition for backward compatibility. */ #if __UAPI_DEF_IPX_ROUTE_DEF struct ipx_route_def { __be32 ipx_network; __be32 ipx_router_network; #define IPX_ROUTE_NO_ROUTER 0 unsigned char ipx_router_node[IPX_NODE_LEN]; unsigned char ipx_device[16]; unsigned short ipx_flags; #define IPX_RT_SNAP 8 #define IPX_RT_8022 4 #define IPX_RT_BLUEBOOK 2 #define IPX_RT_ROUTED 1 }; #endif /* __UAPI_DEF_IPX_ROUTE_DEF */ #define SIOCAIPXITFCRT (SIOCPROTOPRIVATE) #define SIOCAIPXPRISLT (SIOCPROTOPRIVATE + 1) #define SIOCIPXCFGDATA (SIOCPROTOPRIVATE + 2) #define SIOCIPXNCPCONN (SIOCPROTOPRIVATE + 3) #endif /* _IPX_H_ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/major.h���������������������������������������������������������������������������������������0000644�����������������00000011151�14763166027�0007177 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_MAJOR_H #define _LINUX_MAJOR_H /* * This file has definitions for major device numbers. * For the device number assignments, see Documentation/admin-guide/devices.rst. */ #define UNNAMED_MAJOR 0 #define MEM_MAJOR 1 #define RAMDISK_MAJOR 1 #define FLOPPY_MAJOR 2 #define PTY_MASTER_MAJOR 2 #define IDE0_MAJOR 3 #define HD_MAJOR IDE0_MAJOR #define PTY_SLAVE_MAJOR 3 #define TTY_MAJOR 4 #define TTYAUX_MAJOR 5 #define LP_MAJOR 6 #define VCS_MAJOR 7 #define LOOP_MAJOR 7 #define SCSI_DISK0_MAJOR 8 #define SCSI_TAPE_MAJOR 9 #define MD_MAJOR 9 #define MISC_MAJOR 10 #define SCSI_CDROM_MAJOR 11 #define MUX_MAJOR 11 /* PA-RISC only */ #define XT_DISK_MAJOR 13 #define INPUT_MAJOR 13 #define SOUND_MAJOR 14 #define CDU31A_CDROM_MAJOR 15 #define JOYSTICK_MAJOR 15 #define GOLDSTAR_CDROM_MAJOR 16 #define OPTICS_CDROM_MAJOR 17 #define SANYO_CDROM_MAJOR 18 #define CYCLADES_MAJOR 19 #define CYCLADESAUX_MAJOR 20 #define MITSUMI_X_CDROM_MAJOR 20 #define MFM_ACORN_MAJOR 21 /* ARM Linux /dev/mfm */ #define SCSI_GENERIC_MAJOR 21 #define IDE1_MAJOR 22 #define DIGICU_MAJOR 22 #define DIGI_MAJOR 23 #define MITSUMI_CDROM_MAJOR 23 #define CDU535_CDROM_MAJOR 24 #define STL_SERIALMAJOR 24 #define MATSUSHITA_CDROM_MAJOR 25 #define STL_CALLOUTMAJOR 25 #define MATSUSHITA_CDROM2_MAJOR 26 #define QIC117_TAPE_MAJOR 27 #define MATSUSHITA_CDROM3_MAJOR 27 #define MATSUSHITA_CDROM4_MAJOR 28 #define STL_SIOMEMMAJOR 28 #define ACSI_MAJOR 28 #define AZTECH_CDROM_MAJOR 29 #define FB_MAJOR 29 /* /dev/fb* framebuffers */ #define MTD_BLOCK_MAJOR 31 #define CM206_CDROM_MAJOR 32 #define IDE2_MAJOR 33 #define IDE3_MAJOR 34 #define Z8530_MAJOR 34 #define XPRAM_MAJOR 35 /* Expanded storage on S/390: "slow ram"*/ #define NETLINK_MAJOR 36 #define PS2ESDI_MAJOR 36 #define IDETAPE_MAJOR 37 #define Z2RAM_MAJOR 37 #define APBLOCK_MAJOR 38 /* AP1000 Block device */ #define DDV_MAJOR 39 /* AP1000 DDV block device */ #define NBD_MAJOR 43 /* Network block device */ #define RISCOM8_NORMAL_MAJOR 48 #define DAC960_MAJOR 48 /* 48..55 */ #define RISCOM8_CALLOUT_MAJOR 49 #define MKISS_MAJOR 55 #define DSP56K_MAJOR 55 /* DSP56001 processor device */ #define IDE4_MAJOR 56 #define IDE5_MAJOR 57 #define SCSI_DISK1_MAJOR 65 #define SCSI_DISK2_MAJOR 66 #define SCSI_DISK3_MAJOR 67 #define SCSI_DISK4_MAJOR 68 #define SCSI_DISK5_MAJOR 69 #define SCSI_DISK6_MAJOR 70 #define SCSI_DISK7_MAJOR 71 #define COMPAQ_SMART2_MAJOR 72 #define COMPAQ_SMART2_MAJOR1 73 #define COMPAQ_SMART2_MAJOR2 74 #define COMPAQ_SMART2_MAJOR3 75 #define COMPAQ_SMART2_MAJOR4 76 #define COMPAQ_SMART2_MAJOR5 77 #define COMPAQ_SMART2_MAJOR6 78 #define COMPAQ_SMART2_MAJOR7 79 #define SPECIALIX_NORMAL_MAJOR 75 #define SPECIALIX_CALLOUT_MAJOR 76 #define AURORA_MAJOR 79 #define I2O_MAJOR 80 /* 80->87 */ #define SHMIQ_MAJOR 85 /* Linux/mips, SGI /dev/shmiq */ #define SCSI_CHANGER_MAJOR 86 #define IDE6_MAJOR 88 #define IDE7_MAJOR 89 #define IDE8_MAJOR 90 #define MTD_CHAR_MAJOR 90 #define IDE9_MAJOR 91 #define DASD_MAJOR 94 #define MDISK_MAJOR 95 #define UBD_MAJOR 98 #define PP_MAJOR 99 #define JSFD_MAJOR 99 #define PHONE_MAJOR 100 #define COMPAQ_CISS_MAJOR 104 #define COMPAQ_CISS_MAJOR1 105 #define COMPAQ_CISS_MAJOR2 106 #define COMPAQ_CISS_MAJOR3 107 #define COMPAQ_CISS_MAJOR4 108 #define COMPAQ_CISS_MAJOR5 109 #define COMPAQ_CISS_MAJOR6 110 #define COMPAQ_CISS_MAJOR7 111 #define VIODASD_MAJOR 112 #define VIOCD_MAJOR 113 #define ATARAID_MAJOR 114 #define SCSI_DISK8_MAJOR 128 #define SCSI_DISK9_MAJOR 129 #define SCSI_DISK10_MAJOR 130 #define SCSI_DISK11_MAJOR 131 #define SCSI_DISK12_MAJOR 132 #define SCSI_DISK13_MAJOR 133 #define SCSI_DISK14_MAJOR 134 #define SCSI_DISK15_MAJOR 135 #define UNIX98_PTY_MASTER_MAJOR 128 #define UNIX98_PTY_MAJOR_COUNT 8 #define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT) #define DRBD_MAJOR 147 #define RTF_MAJOR 150 #define RAW_MAJOR 162 #define USB_ACM_MAJOR 166 #define USB_ACM_AUX_MAJOR 167 #define USB_CHAR_MAJOR 180 #define MMC_BLOCK_MAJOR 179 #define VXVM_MAJOR 199 /* VERITAS volume i/o driver */ #define VXSPEC_MAJOR 200 /* VERITAS volume config driver */ #define VXDMP_MAJOR 201 /* VERITAS volume multipath driver */ #define XENVBD_MAJOR 202 /* Xen virtual block device */ #define MSR_MAJOR 202 #define CPUID_MAJOR 203 #define OSST_MAJOR 206 /* OnStream-SCx0 SCSI tape */ #define IBM_TTY3270_MAJOR 227 #define IBM_FS3270_MAJOR 228 #define VIOTAPE_MAJOR 230 #define BLOCK_EXT_MAJOR 259 #define SCSI_OSD_MAJOR 260 /* open-osd's OSD scsi device */ #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netdevice.h�����������������������������������������������������������������������������������0000644�����������������00000004315�14763166027�0010041 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Definitions for the Interfaces handler. * * Version: @(#)dev.h 1.0.10 08/12/93 * * Authors: Ross Biro * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Corey Minyard <wf-rch!minyard@relay.EU.net> * Donald J. Becker, <becker@cesdis.gsfc.nasa.gov> * Alan Cox, <alan@lxorguk.ukuu.org.uk> * Bjorn Ekwall. <bj0rn@blox.se> * Pekka Riikonen <priikone@poseidon.pspt.fi> * * 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. * * Moved to /usr/include/linux for NET3 */ #ifndef _LINUX_NETDEVICE_H #define _LINUX_NETDEVICE_H #include <linux/if.h> #include <linux/if_ether.h> #include <linux/if_packet.h> #include <linux/if_link.h> #define MAX_ADDR_LEN 32 /* Largest hardware address length */ /* Initial net device group. All devices belong to group 0 by default. */ #define INIT_NETDEV_GROUP 0 /* interface name assignment types (sysfs name_assign_type attribute) */ #define NET_NAME_UNKNOWN 0 /* unknown origin (not exposed to userspace) */ #define NET_NAME_ENUM 1 /* enumerated by kernel */ #define NET_NAME_PREDICTABLE 2 /* predictably named by the kernel */ #define NET_NAME_USER 3 /* provided by user-space */ #define NET_NAME_RENAMED 4 /* renamed by user-space */ /* Media selection options. */ enum { IF_PORT_UNKNOWN = 0, IF_PORT_10BASE2, IF_PORT_10BASET, IF_PORT_AUI, IF_PORT_100BASET, IF_PORT_100BASETX, IF_PORT_100BASEFX }; /* hardware address assignment types */ #define NET_ADDR_PERM 0 /* address is permanent (default) */ #define NET_ADDR_RANDOM 1 /* address is generated randomly */ #define NET_ADDR_STOLEN 2 /* address is stolen from other device */ #define NET_ADDR_SET 3 /* address is set using * dev_set_mac_address() */ #endif /* _LINUX_NETDEVICE_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/usbdevice_fs.h��������������������������������������������������������������������������������0000644�����������������00000015437�14763166027�0010543 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /*****************************************************************************/ /* * usbdevice_fs.h -- USB device file system. * * Copyright (C) 2000 * Thomas Sailer (sailer@ife.ee.ethz.ch) * * 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. * * History: * 0.1 04.01.2000 Created */ /*****************************************************************************/ #ifndef _LINUX_USBDEVICE_FS_H #define _LINUX_USBDEVICE_FS_H #include <linux/types.h> #include <linux/magic.h> /* --------------------------------------------------------------------- */ /* usbdevfs ioctl codes */ struct usbdevfs_ctrltransfer { __u8 bRequestType; __u8 bRequest; __u16 wValue; __u16 wIndex; __u16 wLength; __u32 timeout; /* in milliseconds */ void *data; }; struct usbdevfs_bulktransfer { unsigned int ep; unsigned int len; unsigned int timeout; /* in milliseconds */ void *data; }; struct usbdevfs_setinterface { unsigned int interface; unsigned int altsetting; }; struct usbdevfs_disconnectsignal { unsigned int signr; void *context; }; #define USBDEVFS_MAXDRIVERNAME 255 struct usbdevfs_getdriver { unsigned int interface; char driver[USBDEVFS_MAXDRIVERNAME + 1]; }; struct usbdevfs_connectinfo { unsigned int devnum; unsigned char slow; }; #define USBDEVFS_URB_SHORT_NOT_OK 0x01 #define USBDEVFS_URB_ISO_ASAP 0x02 #define USBDEVFS_URB_BULK_CONTINUATION 0x04 #define USBDEVFS_URB_NO_FSBR 0x20 /* Not used */ #define USBDEVFS_URB_ZERO_PACKET 0x40 #define USBDEVFS_URB_NO_INTERRUPT 0x80 #define USBDEVFS_URB_TYPE_ISO 0 #define USBDEVFS_URB_TYPE_INTERRUPT 1 #define USBDEVFS_URB_TYPE_CONTROL 2 #define USBDEVFS_URB_TYPE_BULK 3 struct usbdevfs_iso_packet_desc { unsigned int length; unsigned int actual_length; unsigned int status; }; struct usbdevfs_urb { unsigned char type; unsigned char endpoint; int status; unsigned int flags; void *buffer; int buffer_length; int actual_length; int start_frame; union { int number_of_packets; /* Only used for isoc urbs */ unsigned int stream_id; /* Only used with bulk streams */ }; int error_count; unsigned int signr; /* signal to be sent on completion, or 0 if none should be sent. */ void *usercontext; struct usbdevfs_iso_packet_desc iso_frame_desc[0]; }; /* ioctls for talking directly to drivers */ struct usbdevfs_ioctl { int ifno; /* interface 0..N ; negative numbers reserved */ int ioctl_code; /* MUST encode size + direction of data so the * macros in <asm/ioctl.h> give correct values */ void *data; /* param buffer (in, or out) */ }; /* You can do most things with hubs just through control messages, * except find out what device connects to what port. */ struct usbdevfs_hub_portinfo { char nports; /* number of downstream ports in this hub */ char port [127]; /* e.g. port 3 connects to device 27 */ }; /* System and bus capability flags */ #define USBDEVFS_CAP_ZERO_PACKET 0x01 #define USBDEVFS_CAP_BULK_CONTINUATION 0x02 #define USBDEVFS_CAP_NO_PACKET_SIZE_LIM 0x04 #define USBDEVFS_CAP_BULK_SCATTER_GATHER 0x08 #define USBDEVFS_CAP_REAP_AFTER_DISCONNECT 0x10 #define USBDEVFS_CAP_MMAP 0x20 #define USBDEVFS_CAP_DROP_PRIVILEGES 0x40 /* USBDEVFS_DISCONNECT_CLAIM flags & struct */ /* disconnect-and-claim if the driver matches the driver field */ #define USBDEVFS_DISCONNECT_CLAIM_IF_DRIVER 0x01 /* disconnect-and-claim except when the driver matches the driver field */ #define USBDEVFS_DISCONNECT_CLAIM_EXCEPT_DRIVER 0x02 struct usbdevfs_disconnect_claim { unsigned int interface; unsigned int flags; char driver[USBDEVFS_MAXDRIVERNAME + 1]; }; struct usbdevfs_streams { unsigned int num_streams; /* Not used by USBDEVFS_FREE_STREAMS */ unsigned int num_eps; unsigned char eps[0]; }; /* * USB_SPEED_* values returned by USBDEVFS_GET_SPEED are defined in * linux/usb/ch9.h */ #define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer) #define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32) #define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer) #define USBDEVFS_BULK32 _IOWR('U', 2, struct usbdevfs_bulktransfer32) #define USBDEVFS_RESETEP _IOR('U', 3, unsigned int) #define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface) #define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int) #define USBDEVFS_GETDRIVER _IOW('U', 8, struct usbdevfs_getdriver) #define USBDEVFS_SUBMITURB _IOR('U', 10, struct usbdevfs_urb) #define USBDEVFS_SUBMITURB32 _IOR('U', 10, struct usbdevfs_urb32) #define USBDEVFS_DISCARDURB _IO('U', 11) #define USBDEVFS_REAPURB _IOW('U', 12, void *) #define USBDEVFS_REAPURB32 _IOW('U', 12, __u32) #define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *) #define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, __u32) #define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal) #define USBDEVFS_DISCSIGNAL32 _IOR('U', 14, struct usbdevfs_disconnectsignal32) #define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int) #define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int) #define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo) #define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl) #define USBDEVFS_IOCTL32 _IOWR('U', 18, struct usbdevfs_ioctl32) #define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo) #define USBDEVFS_RESET _IO('U', 20) #define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int) #define USBDEVFS_DISCONNECT _IO('U', 22) #define USBDEVFS_CONNECT _IO('U', 23) #define USBDEVFS_CLAIM_PORT _IOR('U', 24, unsigned int) #define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int) #define USBDEVFS_GET_CAPABILITIES _IOR('U', 26, __u32) #define USBDEVFS_DISCONNECT_CLAIM _IOR('U', 27, struct usbdevfs_disconnect_claim) #define USBDEVFS_ALLOC_STREAMS _IOR('U', 28, struct usbdevfs_streams) #define USBDEVFS_FREE_STREAMS _IOR('U', 29, struct usbdevfs_streams) #define USBDEVFS_DROP_PRIVILEGES _IOW('U', 30, __u32) #define USBDEVFS_GET_SPEED _IO('U', 31) #endif /* _LINUX_USBDEVICE_FS_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/uinput.h��������������������������������������������������������������������������������������0000644�����������������00000022055�14763166027�0007420 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * User level driver support for input subsystem * * Heavily based on evdev.c by Vojtech Pavlik * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org> * * Changes/Revisions: * 0.5 08/13/2015 (David Herrmann <dh.herrmann@gmail.com> & * Benjamin Tissoires <benjamin.tissoires@redhat.com>) * - add UI_DEV_SETUP ioctl * - add UI_ABS_SETUP ioctl * - add UI_GET_VERSION ioctl * 0.4 01/09/2014 (Benjamin Tissoires <benjamin.tissoires@redhat.com>) * - add UI_GET_SYSNAME ioctl * 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>) * - update ff support for the changes in kernel interface * - add UINPUT_VERSION * 0.2 16/10/2004 (Micah Dowty <micah@navi.cx>) * - added force feedback support * - added UI_SET_PHYS * 0.1 20/06/2002 * - first public version */ #ifndef __UINPUT_H_ #define __UINPUT_H_ #include <linux/types.h> #include <linux/input.h> #define UINPUT_VERSION 5 #define UINPUT_MAX_NAME_SIZE 80 struct uinput_ff_upload { __u32 request_id; __s32 retval; struct ff_effect effect; struct ff_effect old; }; struct uinput_ff_erase { __u32 request_id; __s32 retval; __u32 effect_id; }; /* ioctl */ #define UINPUT_IOCTL_BASE 'U' #define UI_DEV_CREATE _IO(UINPUT_IOCTL_BASE, 1) #define UI_DEV_DESTROY _IO(UINPUT_IOCTL_BASE, 2) struct uinput_setup { struct input_id id; char name[UINPUT_MAX_NAME_SIZE]; __u32 ff_effects_max; }; /** * UI_DEV_SETUP - Set device parameters for setup * * This ioctl sets parameters for the input device to be created. It * supersedes the old "struct uinput_user_dev" method, which wrote this data * via write(). To actually set the absolute axes UI_ABS_SETUP should be * used. * * The ioctl takes a "struct uinput_setup" object as argument. The fields of * this object are as follows: * id: See the description of "struct input_id". This field is * copied unchanged into the new device. * name: This is used unchanged as name for the new device. * ff_effects_max: This limits the maximum numbers of force-feedback effects. * See below for a description of FF with uinput. * * This ioctl can be called multiple times and will overwrite previous values. * If this ioctl fails with -EINVAL, it is recommended to use the old * "uinput_user_dev" method via write() as a fallback, in case you run on an * old kernel that does not support this ioctl. * * This ioctl may fail with -EINVAL if it is not supported or if you passed * incorrect values, -ENOMEM if the kernel runs out of memory or -EFAULT if the * passed uinput_setup object cannot be read/written. * If this call fails, partial data may have already been applied to the * internal device. */ #define UI_DEV_SETUP _IOW(UINPUT_IOCTL_BASE, 3, struct uinput_setup) struct uinput_abs_setup { __u16 code; /* axis code */ /* __u16 filler; */ struct input_absinfo absinfo; }; /** * UI_ABS_SETUP - Set absolute axis information for the device to setup * * This ioctl sets one absolute axis information for the input device to be * created. It supersedes the old "struct uinput_user_dev" method, which wrote * part of this data and the content of UI_DEV_SETUP via write(). * * The ioctl takes a "struct uinput_abs_setup" object as argument. The fields * of this object are as follows: * code: The corresponding input code associated with this axis * (ABS_X, ABS_Y, etc...) * absinfo: See "struct input_absinfo" for a description of this field. * This field is copied unchanged into the kernel for the * specified axis. If the axis is not enabled via * UI_SET_ABSBIT, this ioctl will enable it. * * This ioctl can be called multiple times and will overwrite previous values. * If this ioctl fails with -EINVAL, it is recommended to use the old * "uinput_user_dev" method via write() as a fallback, in case you run on an * old kernel that does not support this ioctl. * * This ioctl may fail with -EINVAL if it is not supported or if you passed * incorrect values, -ENOMEM if the kernel runs out of memory or -EFAULT if the * passed uinput_setup object cannot be read/written. * If this call fails, partial data may have already been applied to the * internal device. */ #define UI_ABS_SETUP _IOW(UINPUT_IOCTL_BASE, 4, struct uinput_abs_setup) #define UI_SET_EVBIT _IOW(UINPUT_IOCTL_BASE, 100, int) #define UI_SET_KEYBIT _IOW(UINPUT_IOCTL_BASE, 101, int) #define UI_SET_RELBIT _IOW(UINPUT_IOCTL_BASE, 102, int) #define UI_SET_ABSBIT _IOW(UINPUT_IOCTL_BASE, 103, int) #define UI_SET_MSCBIT _IOW(UINPUT_IOCTL_BASE, 104, int) #define UI_SET_LEDBIT _IOW(UINPUT_IOCTL_BASE, 105, int) #define UI_SET_SNDBIT _IOW(UINPUT_IOCTL_BASE, 106, int) #define UI_SET_FFBIT _IOW(UINPUT_IOCTL_BASE, 107, int) #define UI_SET_PHYS _IOW(UINPUT_IOCTL_BASE, 108, char*) #define UI_SET_SWBIT _IOW(UINPUT_IOCTL_BASE, 109, int) #define UI_SET_PROPBIT _IOW(UINPUT_IOCTL_BASE, 110, int) #define UI_BEGIN_FF_UPLOAD _IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload) #define UI_END_FF_UPLOAD _IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload) #define UI_BEGIN_FF_ERASE _IOWR(UINPUT_IOCTL_BASE, 202, struct uinput_ff_erase) #define UI_END_FF_ERASE _IOW(UINPUT_IOCTL_BASE, 203, struct uinput_ff_erase) /** * UI_GET_SYSNAME - get the sysfs name of the created uinput device * * @return the sysfs name of the created virtual input device. * The complete sysfs path is then /sys/devices/virtual/input/--NAME-- * Usually, it is in the form "inputN" */ #define UI_GET_SYSNAME(len) _IOC(_IOC_READ, UINPUT_IOCTL_BASE, 44, len) /** * UI_GET_VERSION - Return version of uinput protocol * * This writes uinput protocol version implemented by the kernel into * the integer pointed to by the ioctl argument. The protocol version * is hard-coded in the kernel and is independent of the uinput device. */ #define UI_GET_VERSION _IOR(UINPUT_IOCTL_BASE, 45, unsigned int) /* * To write a force-feedback-capable driver, the upload_effect * and erase_effect callbacks in input_dev must be implemented. * The uinput driver will generate a fake input event when one of * these callbacks are invoked. The userspace code then uses * ioctls to retrieve additional parameters and send the return code. * The callback blocks until this return code is sent. * * The described callback mechanism is only used if ff_effects_max * is set. * * To implement upload_effect(): * 1. Wait for an event with type == EV_UINPUT and code == UI_FF_UPLOAD. * A request ID will be given in 'value'. * 2. Allocate a uinput_ff_upload struct, fill in request_id with * the 'value' from the EV_UINPUT event. * 3. Issue a UI_BEGIN_FF_UPLOAD ioctl, giving it the * uinput_ff_upload struct. It will be filled in with the * ff_effects passed to upload_effect(). * 4. Perform the effect upload, and place a return code back into the uinput_ff_upload struct. * 5. Issue a UI_END_FF_UPLOAD ioctl, also giving it the * uinput_ff_upload_effect struct. This will complete execution * of our upload_effect() handler. * * To implement erase_effect(): * 1. Wait for an event with type == EV_UINPUT and code == UI_FF_ERASE. * A request ID will be given in 'value'. * 2. Allocate a uinput_ff_erase struct, fill in request_id with * the 'value' from the EV_UINPUT event. * 3. Issue a UI_BEGIN_FF_ERASE ioctl, giving it the * uinput_ff_erase struct. It will be filled in with the * effect ID passed to erase_effect(). * 4. Perform the effect erasure, and place a return code back * into the uinput_ff_erase struct. * 5. Issue a UI_END_FF_ERASE ioctl, also giving it the * uinput_ff_erase_effect struct. This will complete execution * of our erase_effect() handler. */ /* * This is the new event type, used only by uinput. * 'code' is UI_FF_UPLOAD or UI_FF_ERASE, and 'value' * is the unique request ID. This number was picked * arbitrarily, above EV_MAX (since the input system * never sees it) but in the range of a 16-bit int. */ #define EV_UINPUT 0x0101 #define UI_FF_UPLOAD 1 #define UI_FF_ERASE 2 struct uinput_user_dev { char name[UINPUT_MAX_NAME_SIZE]; struct input_id id; __u32 ff_effects_max; __s32 absmax[ABS_CNT]; __s32 absmin[ABS_CNT]; __s32 absfuzz[ABS_CNT]; __s32 absflat[ABS_CNT]; }; #endif /* __UINPUT_H_ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/synclink.h������������������������������������������������������������������������������������0000644�����������������00000021431�14763166027�0007723 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* * SyncLink Multiprotocol Serial Adapter Driver * * $Id: synclink.h,v 3.14 2006/07/17 20:15:43 paulkf Exp $ * * Copyright (C) 1998-2000 by Microgate Corporation * * Redistribution of this file is permitted under * the terms of the GNU Public License (GPL) */ #ifndef _SYNCLINK_H_ #define _SYNCLINK_H_ #define SYNCLINK_H_VERSION 3.6 #include <linux/types.h> #define BIT0 0x0001 #define BIT1 0x0002 #define BIT2 0x0004 #define BIT3 0x0008 #define BIT4 0x0010 #define BIT5 0x0020 #define BIT6 0x0040 #define BIT7 0x0080 #define BIT8 0x0100 #define BIT9 0x0200 #define BIT10 0x0400 #define BIT11 0x0800 #define BIT12 0x1000 #define BIT13 0x2000 #define BIT14 0x4000 #define BIT15 0x8000 #define BIT16 0x00010000 #define BIT17 0x00020000 #define BIT18 0x00040000 #define BIT19 0x00080000 #define BIT20 0x00100000 #define BIT21 0x00200000 #define BIT22 0x00400000 #define BIT23 0x00800000 #define BIT24 0x01000000 #define BIT25 0x02000000 #define BIT26 0x04000000 #define BIT27 0x08000000 #define BIT28 0x10000000 #define BIT29 0x20000000 #define BIT30 0x40000000 #define BIT31 0x80000000 #define HDLC_MAX_FRAME_SIZE 65535 #define MAX_ASYNC_TRANSMIT 4096 #define MAX_ASYNC_BUFFER_SIZE 4096 #define ASYNC_PARITY_NONE 0 #define ASYNC_PARITY_EVEN 1 #define ASYNC_PARITY_ODD 2 #define ASYNC_PARITY_SPACE 3 #define HDLC_FLAG_UNDERRUN_ABORT7 0x0000 #define HDLC_FLAG_UNDERRUN_ABORT15 0x0001 #define HDLC_FLAG_UNDERRUN_FLAG 0x0002 #define HDLC_FLAG_UNDERRUN_CRC 0x0004 #define HDLC_FLAG_SHARE_ZERO 0x0010 #define HDLC_FLAG_AUTO_CTS 0x0020 #define HDLC_FLAG_AUTO_DCD 0x0040 #define HDLC_FLAG_AUTO_RTS 0x0080 #define HDLC_FLAG_RXC_DPLL 0x0100 #define HDLC_FLAG_RXC_BRG 0x0200 #define HDLC_FLAG_RXC_TXCPIN 0x8000 #define HDLC_FLAG_RXC_RXCPIN 0x0000 #define HDLC_FLAG_TXC_DPLL 0x0400 #define HDLC_FLAG_TXC_BRG 0x0800 #define HDLC_FLAG_TXC_TXCPIN 0x0000 #define HDLC_FLAG_TXC_RXCPIN 0x0008 #define HDLC_FLAG_DPLL_DIV8 0x1000 #define HDLC_FLAG_DPLL_DIV16 0x2000 #define HDLC_FLAG_DPLL_DIV32 0x0000 #define HDLC_FLAG_HDLC_LOOPMODE 0x4000 #define HDLC_CRC_NONE 0 #define HDLC_CRC_16_CCITT 1 #define HDLC_CRC_32_CCITT 2 #define HDLC_CRC_MASK 0x00ff #define HDLC_CRC_RETURN_EX 0x8000 #define RX_OK 0 #define RX_CRC_ERROR 1 #define HDLC_TXIDLE_FLAGS 0 #define HDLC_TXIDLE_ALT_ZEROS_ONES 1 #define HDLC_TXIDLE_ZEROS 2 #define HDLC_TXIDLE_ONES 3 #define HDLC_TXIDLE_ALT_MARK_SPACE 4 #define HDLC_TXIDLE_SPACE 5 #define HDLC_TXIDLE_MARK 6 #define HDLC_TXIDLE_CUSTOM_8 0x10000000 #define HDLC_TXIDLE_CUSTOM_16 0x20000000 #define HDLC_ENCODING_NRZ 0 #define HDLC_ENCODING_NRZB 1 #define HDLC_ENCODING_NRZI_MARK 2 #define HDLC_ENCODING_NRZI_SPACE 3 #define HDLC_ENCODING_NRZI HDLC_ENCODING_NRZI_SPACE #define HDLC_ENCODING_BIPHASE_MARK 4 #define HDLC_ENCODING_BIPHASE_SPACE 5 #define HDLC_ENCODING_BIPHASE_LEVEL 6 #define HDLC_ENCODING_DIFF_BIPHASE_LEVEL 7 #define HDLC_PREAMBLE_LENGTH_8BITS 0 #define HDLC_PREAMBLE_LENGTH_16BITS 1 #define HDLC_PREAMBLE_LENGTH_32BITS 2 #define HDLC_PREAMBLE_LENGTH_64BITS 3 #define HDLC_PREAMBLE_PATTERN_NONE 0 #define HDLC_PREAMBLE_PATTERN_ZEROS 1 #define HDLC_PREAMBLE_PATTERN_FLAGS 2 #define HDLC_PREAMBLE_PATTERN_10 3 #define HDLC_PREAMBLE_PATTERN_01 4 #define HDLC_PREAMBLE_PATTERN_ONES 5 #define MGSL_MODE_ASYNC 1 #define MGSL_MODE_HDLC 2 #define MGSL_MODE_MONOSYNC 3 #define MGSL_MODE_BISYNC 4 #define MGSL_MODE_RAW 6 #define MGSL_MODE_BASE_CLOCK 7 #define MGSL_MODE_XSYNC 8 #define MGSL_BUS_TYPE_ISA 1 #define MGSL_BUS_TYPE_EISA 2 #define MGSL_BUS_TYPE_PCI 5 #define MGSL_INTERFACE_MASK 0xf #define MGSL_INTERFACE_DISABLE 0 #define MGSL_INTERFACE_RS232 1 #define MGSL_INTERFACE_V35 2 #define MGSL_INTERFACE_RS422 3 #define MGSL_INTERFACE_RTS_EN 0x10 #define MGSL_INTERFACE_LL 0x20 #define MGSL_INTERFACE_RL 0x40 #define MGSL_INTERFACE_MSB_FIRST 0x80 typedef struct _MGSL_PARAMS { /* Common */ unsigned long mode; /* Asynchronous or HDLC */ unsigned char loopback; /* internal loopback mode */ /* HDLC Only */ unsigned short flags; unsigned char encoding; /* NRZ, NRZI, etc. */ unsigned long clock_speed; /* external clock speed in bits per second */ unsigned char addr_filter; /* receive HDLC address filter, 0xFF = disable */ unsigned short crc_type; /* None, CRC16-CCITT, or CRC32-CCITT */ unsigned char preamble_length; unsigned char preamble; /* Async Only */ unsigned long data_rate; /* bits per second */ unsigned char data_bits; /* 7 or 8 data bits */ unsigned char stop_bits; /* 1 or 2 stop bits */ unsigned char parity; /* none, even, or odd */ } MGSL_PARAMS, *PMGSL_PARAMS; #define MICROGATE_VENDOR_ID 0x13c0 #define SYNCLINK_DEVICE_ID 0x0010 #define MGSCC_DEVICE_ID 0x0020 #define SYNCLINK_SCA_DEVICE_ID 0x0030 #define SYNCLINK_GT_DEVICE_ID 0x0070 #define SYNCLINK_GT4_DEVICE_ID 0x0080 #define SYNCLINK_AC_DEVICE_ID 0x0090 #define SYNCLINK_GT2_DEVICE_ID 0x00A0 #define MGSL_MAX_SERIAL_NUMBER 30 /* ** device diagnostics status */ #define DiagStatus_OK 0 #define DiagStatus_AddressFailure 1 #define DiagStatus_AddressConflict 2 #define DiagStatus_IrqFailure 3 #define DiagStatus_IrqConflict 4 #define DiagStatus_DmaFailure 5 #define DiagStatus_DmaConflict 6 #define DiagStatus_PciAdapterNotFound 7 #define DiagStatus_CantAssignPciResources 8 #define DiagStatus_CantAssignPciMemAddr 9 #define DiagStatus_CantAssignPciIoAddr 10 #define DiagStatus_CantAssignPciIrq 11 #define DiagStatus_MemoryError 12 #define SerialSignal_DCD 0x01 /* Data Carrier Detect */ #define SerialSignal_TXD 0x02 /* Transmit Data */ #define SerialSignal_RI 0x04 /* Ring Indicator */ #define SerialSignal_RXD 0x08 /* Receive Data */ #define SerialSignal_CTS 0x10 /* Clear to Send */ #define SerialSignal_RTS 0x20 /* Request to Send */ #define SerialSignal_DSR 0x40 /* Data Set Ready */ #define SerialSignal_DTR 0x80 /* Data Terminal Ready */ /* * Counters of the input lines (CTS, DSR, RI, CD) interrupts */ struct mgsl_icount { __u32 cts, dsr, rng, dcd, tx, rx; __u32 frame, parity, overrun, brk; __u32 buf_overrun; __u32 txok; __u32 txunder; __u32 txabort; __u32 txtimeout; __u32 rxshort; __u32 rxlong; __u32 rxabort; __u32 rxover; __u32 rxcrc; __u32 rxok; __u32 exithunt; __u32 rxidle; }; struct gpio_desc { __u32 state; __u32 smask; __u32 dir; __u32 dmask; }; #define DEBUG_LEVEL_DATA 1 #define DEBUG_LEVEL_ERROR 2 #define DEBUG_LEVEL_INFO 3 #define DEBUG_LEVEL_BH 4 #define DEBUG_LEVEL_ISR 5 /* ** Event bit flags for use with MgslWaitEvent */ #define MgslEvent_DsrActive 0x0001 #define MgslEvent_DsrInactive 0x0002 #define MgslEvent_Dsr 0x0003 #define MgslEvent_CtsActive 0x0004 #define MgslEvent_CtsInactive 0x0008 #define MgslEvent_Cts 0x000c #define MgslEvent_DcdActive 0x0010 #define MgslEvent_DcdInactive 0x0020 #define MgslEvent_Dcd 0x0030 #define MgslEvent_RiActive 0x0040 #define MgslEvent_RiInactive 0x0080 #define MgslEvent_Ri 0x00c0 #define MgslEvent_ExitHuntMode 0x0100 #define MgslEvent_IdleReceived 0x0200 /* Private IOCTL codes: * * MGSL_IOCSPARAMS set MGSL_PARAMS structure values * MGSL_IOCGPARAMS get current MGSL_PARAMS structure values * MGSL_IOCSTXIDLE set current transmit idle mode * MGSL_IOCGTXIDLE get current transmit idle mode * MGSL_IOCTXENABLE enable or disable transmitter * MGSL_IOCRXENABLE enable or disable receiver * MGSL_IOCTXABORT abort transmitting frame (HDLC) * MGSL_IOCGSTATS return current statistics * MGSL_IOCWAITEVENT wait for specified event to occur * MGSL_LOOPTXDONE transmit in HDLC LoopMode done * MGSL_IOCSIF set the serial interface type * MGSL_IOCGIF get the serial interface type */ #define MGSL_MAGIC_IOC 'm' #define MGSL_IOCSPARAMS _IOW(MGSL_MAGIC_IOC,0,struct _MGSL_PARAMS) #define MGSL_IOCGPARAMS _IOR(MGSL_MAGIC_IOC,1,struct _MGSL_PARAMS) #define MGSL_IOCSTXIDLE _IO(MGSL_MAGIC_IOC,2) #define MGSL_IOCGTXIDLE _IO(MGSL_MAGIC_IOC,3) #define MGSL_IOCTXENABLE _IO(MGSL_MAGIC_IOC,4) #define MGSL_IOCRXENABLE _IO(MGSL_MAGIC_IOC,5) #define MGSL_IOCTXABORT _IO(MGSL_MAGIC_IOC,6) #define MGSL_IOCGSTATS _IO(MGSL_MAGIC_IOC,7) #define MGSL_IOCWAITEVENT _IOWR(MGSL_MAGIC_IOC,8,int) #define MGSL_IOCCLRMODCOUNT _IO(MGSL_MAGIC_IOC,15) #define MGSL_IOCLOOPTXDONE _IO(MGSL_MAGIC_IOC,9) #define MGSL_IOCSIF _IO(MGSL_MAGIC_IOC,10) #define MGSL_IOCGIF _IO(MGSL_MAGIC_IOC,11) #define MGSL_IOCSGPIO _IOW(MGSL_MAGIC_IOC,16,struct gpio_desc) #define MGSL_IOCGGPIO _IOR(MGSL_MAGIC_IOC,17,struct gpio_desc) #define MGSL_IOCWAITGPIO _IOWR(MGSL_MAGIC_IOC,18,struct gpio_desc) #define MGSL_IOCSXSYNC _IO(MGSL_MAGIC_IOC, 19) #define MGSL_IOCGXSYNC _IO(MGSL_MAGIC_IOC, 20) #define MGSL_IOCSXCTRL _IO(MGSL_MAGIC_IOC, 21) #define MGSL_IOCGXCTRL _IO(MGSL_MAGIC_IOC, 22) #endif /* _SYNCLINK_H_ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/romfs_fs.h������������������������������������������������������������������������������������0000644�����������������00000002326�14763166027�0007711 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_ROMFS_FS_H #define __LINUX_ROMFS_FS_H #include <linux/types.h> #include <linux/fs.h> /* The basic structures of the romfs filesystem */ #define ROMBSIZE BLOCK_SIZE #define ROMBSBITS BLOCK_SIZE_BITS #define ROMBMASK (ROMBSIZE-1) #define ROMFS_MAGIC 0x7275 #define ROMFS_MAXFN 128 #define __mkw(h,l) (((h)&0x00ff)<< 8|((l)&0x00ff)) #define __mkl(h,l) (((h)&0xffff)<<16|((l)&0xffff)) #define __mk4(a,b,c,d) cpu_to_be32(__mkl(__mkw(a,b),__mkw(c,d))) #define ROMSB_WORD0 __mk4('-','r','o','m') #define ROMSB_WORD1 __mk4('1','f','s','-') /* On-disk "super block" */ struct romfs_super_block { __be32 word0; __be32 word1; __be32 size; __be32 checksum; char name[0]; /* volume name */ }; /* On disk inode */ struct romfs_inode { __be32 next; /* low 4 bits see ROMFH_ */ __be32 spec; __be32 size; __be32 checksum; char name[0]; }; #define ROMFH_TYPE 7 #define ROMFH_HRD 0 #define ROMFH_DIR 1 #define ROMFH_REG 2 #define ROMFH_SYM 3 #define ROMFH_BLK 4 #define ROMFH_CHR 5 #define ROMFH_SCK 6 #define ROMFH_FIF 7 #define ROMFH_EXEC 8 /* Alignment */ #define ROMFH_SIZE 16 #define ROMFH_PAD (ROMFH_SIZE-1) #define ROMFH_MASK (~ROMFH_PAD) #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/toshiba.h�������������������������������������������������������������������������������������0000644�����������������00000003612�14763166027�0007523 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* toshiba.h -- Linux driver for accessing the SMM on Toshiba laptops * * Copyright (c) 1996-2000 Jonathan A. Buzzard (jonathan@buzzard.org.uk) * Copyright (c) 2015 Azael Avalos <coproscefalo@gmail.com> * * Thanks to Juergen Heinzl <juergen@monocerus.demon.co.uk> for the pointers * on making sure the structure is aligned and packed. * * 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, 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. * */ #ifndef _LINUX_TOSHIBA_H #define _LINUX_TOSHIBA_H /* * Toshiba modules paths */ #define TOSH_PROC "/proc/toshiba" #define TOSH_DEVICE "/dev/toshiba" #define TOSHIBA_ACPI_PROC "/proc/acpi/toshiba" #define TOSHIBA_ACPI_DEVICE "/dev/toshiba_acpi" /* * Toshiba SMM structure */ typedef struct { unsigned int eax; unsigned int ebx __attribute__ ((packed)); unsigned int ecx __attribute__ ((packed)); unsigned int edx __attribute__ ((packed)); unsigned int esi __attribute__ ((packed)); unsigned int edi __attribute__ ((packed)); } SMMRegisters; /* * IOCTLs (0x90 - 0x91) */ #define TOSH_SMM _IOWR('t', 0x90, SMMRegisters) /* * Convenience toshiba_acpi command. * * The System Configuration Interface (SCI) is opened/closed internally * to avoid userspace of buggy BIOSes. * * The toshiba_acpi module checks whether the eax register is set with * SCI_GET (0xf300) or SCI_SET (0xf400), returning -EINVAL if not. */ #define TOSHIBA_ACPI_SCI _IOWR('t', 0x91, SMMRegisters) #endif /* _LINUX_TOSHIBA_H */ ����������������������������������������������������������������������������������������������������������������������linux/aspeed-lpc-ctrl.h�����������������������������������������������������������������������������0000644�����������������00000003364�14763166027�0011055 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright 2017 IBM Corp. * * 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. */ #ifndef _LINUX_ASPEED_LPC_CTRL_H #define _LINUX_ASPEED_LPC_CTRL_H #include <linux/ioctl.h> #include <linux/types.h> /* Window types */ #define ASPEED_LPC_CTRL_WINDOW_FLASH 1 #define ASPEED_LPC_CTRL_WINDOW_MEMORY 2 /* * This driver provides a window for the host to access a BMC resource * across the BMC <-> Host LPC bus. * * window_type: The BMC resource that the host will access through the * window. BMC flash and BMC RAM. * * window_id: For each window type there may be multiple windows, * these are referenced by ID. * * flags: Reserved for future use, this field is expected to be * zeroed. * * addr: Address on the host LPC bus that the specified window should * be mapped. This address must be power of two aligned. * * offset: Offset into the BMC window that should be mapped to the * host (at addr). This must be a multiple of size. * * size: The size of the mapping. The smallest possible size is 64K. * This must be power of two aligned. * */ struct aspeed_lpc_ctrl_mapping { __u8 window_type; __u8 window_id; __u16 flags; __u32 addr; __u32 offset; __u32 size; }; #define __ASPEED_LPC_CTRL_IOCTL_MAGIC 0xb2 #define ASPEED_LPC_CTRL_IOCTL_GET_SIZE _IOWR(__ASPEED_LPC_CTRL_IOCTL_MAGIC, \ 0x00, struct aspeed_lpc_ctrl_mapping) #define ASPEED_LPC_CTRL_IOCTL_MAP _IOW(__ASPEED_LPC_CTRL_IOCTL_MAGIC, \ 0x01, struct aspeed_lpc_ctrl_mapping) #endif /* _LINUX_ASPEED_LPC_CTRL_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_arcnet.h�����������������������������������������������������������������������������������0000644�����������������00000007205�14763166027�0010026 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Global definitions for the ARCnet interface. * * Authors: David Woodhouse and Avery Pennarun * * 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. */ #ifndef _LINUX_IF_ARCNET_H #define _LINUX_IF_ARCNET_H #include <linux/types.h> #include <linux/if_ether.h> /* * These are the defined ARCnet Protocol ID's. */ /* CAP mode */ /* No macro but uses 1-8 */ /* RFC1201 Protocol ID's */ #define ARC_P_IP 212 /* 0xD4 */ #define ARC_P_IPV6 196 /* 0xC4: RFC2497 */ #define ARC_P_ARP 213 /* 0xD5 */ #define ARC_P_RARP 214 /* 0xD6 */ #define ARC_P_IPX 250 /* 0xFA */ #define ARC_P_NOVELL_EC 236 /* 0xEC */ /* Old RFC1051 Protocol ID's */ #define ARC_P_IP_RFC1051 240 /* 0xF0 */ #define ARC_P_ARP_RFC1051 241 /* 0xF1 */ /* MS LanMan/WfWg "NDIS" encapsulation */ #define ARC_P_ETHER 232 /* 0xE8 */ /* Unsupported/indirectly supported protocols */ #define ARC_P_DATAPOINT_BOOT 0 /* very old Datapoint equipment */ #define ARC_P_DATAPOINT_MOUNT 1 #define ARC_P_POWERLAN_BEACON 8 /* Probably ATA-Netbios related */ #define ARC_P_POWERLAN_BEACON2 243 /* 0xF3 */ #define ARC_P_LANSOFT 251 /* 0xFB - what is this? */ #define ARC_P_ATALK 0xDD /* Hardware address length */ #define ARCNET_ALEN 1 /* * The RFC1201-specific components of an arcnet packet header. */ struct arc_rfc1201 { __u8 proto; /* protocol ID field - varies */ __u8 split_flag; /* for use with split packets */ __be16 sequence; /* sequence number */ __u8 payload[0]; /* space remaining in packet (504 bytes)*/ }; #define RFC1201_HDR_SIZE 4 /* * The RFC1051-specific components. */ struct arc_rfc1051 { __u8 proto; /* ARC_P_RFC1051_ARP/RFC1051_IP */ __u8 payload[0]; /* 507 bytes */ }; #define RFC1051_HDR_SIZE 1 /* * The ethernet-encap-specific components. We have a real ethernet header * and some data. */ struct arc_eth_encap { __u8 proto; /* Always ARC_P_ETHER */ struct ethhdr eth; /* standard ethernet header (yuck!) */ __u8 payload[0]; /* 493 bytes */ }; #define ETH_ENCAP_HDR_SIZE 14 struct arc_cap { __u8 proto; __u8 cookie[sizeof(int)]; /* Actually NOT sent over the network */ union { __u8 ack; __u8 raw[0]; /* 507 bytes */ } mes; }; /* * The data needed by the actual arcnet hardware. * * Now, in the real arcnet hardware, the third and fourth bytes are the * 'offset' specification instead of the length, and the soft data is at * the _end_ of the 512-byte buffer. We hide this complexity inside the * driver. */ struct arc_hardware { __u8 source; /* source ARCnet - filled in automagically */ __u8 dest; /* destination ARCnet - 0 for broadcast */ __u8 offset[2]; /* offset bytes (some weird semantics) */ }; #define ARC_HDR_SIZE 4 /* * This is an ARCnet frame header, as seen by the kernel (and userspace, * when you do a raw packet capture). */ struct archdr { /* hardware requirements */ struct arc_hardware hard; /* arcnet encapsulation-specific bits */ union { struct arc_rfc1201 rfc1201; struct arc_rfc1051 rfc1051; struct arc_eth_encap eth_encap; struct arc_cap cap; __u8 raw[0]; /* 508 bytes */ } soft; }; #endif /* _LINUX_IF_ARCNET_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/fib_rules.h�����������������������������������������������������������������������������������0000644�����������������00000003764�14763166027�0010054 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_FIB_RULES_H #define __LINUX_FIB_RULES_H #include <linux/types.h> #include <linux/rtnetlink.h> /* rule is permanent, and cannot be deleted */ #define FIB_RULE_PERMANENT 0x00000001 #define FIB_RULE_INVERT 0x00000002 #define FIB_RULE_UNRESOLVED 0x00000004 #define FIB_RULE_IIF_DETACHED 0x00000008 #define FIB_RULE_DEV_DETACHED FIB_RULE_IIF_DETACHED #define FIB_RULE_OIF_DETACHED 0x00000010 /* try to find source address in routing lookups */ #define FIB_RULE_FIND_SADDR 0x00010000 struct fib_rule_hdr { __u8 family; __u8 dst_len; __u8 src_len; __u8 tos; __u8 table; __u8 res1; /* reserved */ __u8 res2; /* reserved */ __u8 action; __u32 flags; }; struct fib_rule_uid_range { __u32 start; __u32 end; }; struct fib_rule_port_range { __u16 start; __u16 end; }; enum { FRA_UNSPEC, FRA_DST, /* destination address */ FRA_SRC, /* source address */ FRA_IIFNAME, /* interface name */ #define FRA_IFNAME FRA_IIFNAME FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */ FRA_UNUSED2, FRA_PRIORITY, /* priority/preference */ FRA_UNUSED3, FRA_UNUSED4, FRA_UNUSED5, FRA_FWMARK, /* mark */ FRA_FLOW, /* flow/class id */ FRA_TUN_ID, FRA_SUPPRESS_IFGROUP, FRA_SUPPRESS_PREFIXLEN, FRA_TABLE, /* Extended table id */ FRA_FWMASK, /* mask for netfilter mark */ FRA_OIFNAME, FRA_PAD, FRA_L3MDEV, /* iif or oif is l3mdev goto its table */ FRA_UID_RANGE, /* UID range */ FRA_PROTOCOL, /* Originator of the rule */ FRA_IP_PROTO, /* ip proto */ FRA_SPORT_RANGE, /* sport */ FRA_DPORT_RANGE, /* dport */ __FRA_MAX }; #define FRA_MAX (__FRA_MAX - 1) enum { FR_ACT_UNSPEC, FR_ACT_TO_TBL, /* Pass to fixed table */ FR_ACT_GOTO, /* Jump to another rule */ FR_ACT_NOP, /* No operation */ FR_ACT_RES3, FR_ACT_RES4, FR_ACT_BLACKHOLE, /* Drop without notification */ FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */ FR_ACT_PROHIBIT, /* Drop with EACCES */ __FR_ACT_MAX, }; #define FR_ACT_MAX (__FR_ACT_MAX - 1) #endif ������������linux/nfs4_mount.h����������������������������������������������������������������������������������0000644�����������������00000003614�14763166027�0010170 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_NFS4_MOUNT_H #define _LINUX_NFS4_MOUNT_H /* * linux/include/linux/nfs4_mount.h * * Copyright (C) 2002 Trond Myklebust * * structure passed from user-space to kernel-space during an nfsv4 mount */ /* * WARNING! Do not delete or change the order of these fields. If * a new field is required then add it to the end. The version field * tracks which fields are present. This will ensure some measure of * mount-to-kernel version compatibility. Some of these aren't used yet * but here they are anyway. */ #define NFS4_MOUNT_VERSION 1 struct nfs_string { unsigned int len; const char * data; }; struct nfs4_mount_data { int version; /* 1 */ int flags; /* 1 */ int rsize; /* 1 */ int wsize; /* 1 */ int timeo; /* 1 */ int retrans; /* 1 */ int acregmin; /* 1 */ int acregmax; /* 1 */ int acdirmin; /* 1 */ int acdirmax; /* 1 */ /* see the definition of 'struct clientaddr4' in RFC3010 */ struct nfs_string client_addr; /* 1 */ /* Mount path */ struct nfs_string mnt_path; /* 1 */ /* Server details */ struct nfs_string hostname; /* 1 */ /* Server IP address */ unsigned int host_addrlen; /* 1 */ struct sockaddr * host_addr; /* 1 */ /* Transport protocol to use */ int proto; /* 1 */ /* Pseudo-flavours to use for authentication. See RFC2623 */ int auth_flavourlen; /* 1 */ int *auth_flavours; /* 1 */ }; /* bits in the flags field */ /* Note: the fields that correspond to existing NFSv2/v3 mount options * should mirror the values from include/linux/nfs_mount.h */ #define NFS4_MOUNT_SOFT 0x0001 /* 1 */ #define NFS4_MOUNT_INTR 0x0002 /* 1 */ #define NFS4_MOUNT_NOCTO 0x0010 /* 1 */ #define NFS4_MOUNT_NOAC 0x0020 /* 1 */ #define NFS4_MOUNT_STRICTLOCK 0x1000 /* 1 */ #define NFS4_MOUNT_UNSHARED 0x8000 /* 1 */ #define NFS4_MOUNT_FLAGMASK 0x9033 #endif ��������������������������������������������������������������������������������������������������������������������linux/icmpv6.h��������������������������������������������������������������������������������������0000644�����������������00000007611�14763166027�0007301 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_ICMPV6_H #define _LINUX_ICMPV6_H #include <linux/types.h> #include <asm/byteorder.h> struct icmp6hdr { __u8 icmp6_type; __u8 icmp6_code; __sum16 icmp6_cksum; union { __be32 un_data32[1]; __be16 un_data16[2]; __u8 un_data8[4]; struct icmpv6_echo { __be16 identifier; __be16 sequence; } u_echo; struct icmpv6_nd_advt { #if defined(__LITTLE_ENDIAN_BITFIELD) __u32 reserved:5, override:1, solicited:1, router:1, reserved2:24; #elif defined(__BIG_ENDIAN_BITFIELD) __u32 router:1, solicited:1, override:1, reserved:29; #else #error "Please fix <asm/byteorder.h>" #endif } u_nd_advt; struct icmpv6_nd_ra { __u8 hop_limit; #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 reserved:3, router_pref:2, home_agent:1, other:1, managed:1; #elif defined(__BIG_ENDIAN_BITFIELD) __u8 managed:1, other:1, home_agent:1, router_pref:2, reserved:3; #else #error "Please fix <asm/byteorder.h>" #endif __be16 rt_lifetime; } u_nd_ra; } icmp6_dataun; #define icmp6_identifier icmp6_dataun.u_echo.identifier #define icmp6_sequence icmp6_dataun.u_echo.sequence #define icmp6_pointer icmp6_dataun.un_data32[0] #define icmp6_mtu icmp6_dataun.un_data32[0] #define icmp6_unused icmp6_dataun.un_data32[0] #define icmp6_maxdelay icmp6_dataun.un_data16[0] #define icmp6_router icmp6_dataun.u_nd_advt.router #define icmp6_solicited icmp6_dataun.u_nd_advt.solicited #define icmp6_override icmp6_dataun.u_nd_advt.override #define icmp6_ndiscreserved icmp6_dataun.u_nd_advt.reserved #define icmp6_hop_limit icmp6_dataun.u_nd_ra.hop_limit #define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed #define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other #define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime #define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref }; #define ICMPV6_ROUTER_PREF_LOW 0x3 #define ICMPV6_ROUTER_PREF_MEDIUM 0x0 #define ICMPV6_ROUTER_PREF_HIGH 0x1 #define ICMPV6_ROUTER_PREF_INVALID 0x2 #define ICMPV6_DEST_UNREACH 1 #define ICMPV6_PKT_TOOBIG 2 #define ICMPV6_TIME_EXCEED 3 #define ICMPV6_PARAMPROB 4 #define ICMPV6_INFOMSG_MASK 0x80 #define ICMPV6_ECHO_REQUEST 128 #define ICMPV6_ECHO_REPLY 129 #define ICMPV6_MGM_QUERY 130 #define ICMPV6_MGM_REPORT 131 #define ICMPV6_MGM_REDUCTION 132 #define ICMPV6_NI_QUERY 139 #define ICMPV6_NI_REPLY 140 #define ICMPV6_MLD2_REPORT 143 #define ICMPV6_DHAAD_REQUEST 144 #define ICMPV6_DHAAD_REPLY 145 #define ICMPV6_MOBILE_PREFIX_SOL 146 #define ICMPV6_MOBILE_PREFIX_ADV 147 /* * Codes for Destination Unreachable */ #define ICMPV6_NOROUTE 0 #define ICMPV6_ADM_PROHIBITED 1 #define ICMPV6_NOT_NEIGHBOUR 2 #define ICMPV6_ADDR_UNREACH 3 #define ICMPV6_PORT_UNREACH 4 #define ICMPV6_POLICY_FAIL 5 #define ICMPV6_REJECT_ROUTE 6 /* * Codes for Time Exceeded */ #define ICMPV6_EXC_HOPLIMIT 0 #define ICMPV6_EXC_FRAGTIME 1 /* * Codes for Parameter Problem */ #define ICMPV6_HDR_FIELD 0 #define ICMPV6_UNK_NEXTHDR 1 #define ICMPV6_UNK_OPTION 2 /* * constants for (set|get)sockopt */ #define ICMPV6_FILTER 1 /* * ICMPV6 filter */ #define ICMPV6_FILTER_BLOCK 1 #define ICMPV6_FILTER_PASS 2 #define ICMPV6_FILTER_BLOCKOTHERS 3 #define ICMPV6_FILTER_PASSONLY 4 struct icmp6_filter { __u32 data[8]; }; /* * Definitions for MLDv2 */ #define MLD2_MODE_IS_INCLUDE 1 #define MLD2_MODE_IS_EXCLUDE 2 #define MLD2_CHANGE_TO_INCLUDE 3 #define MLD2_CHANGE_TO_EXCLUDE 4 #define MLD2_ALLOW_NEW_SOURCES 5 #define MLD2_BLOCK_OLD_SOURCES 6 #define MLD2_ALL_MCR_INIT { { { 0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,0x16 } } } #endif /* _LINUX_ICMPV6_H */ �����������������������������������������������������������������������������������������������������������������������linux/if.h������������������������������������������������������������������������������������������0000644�����������������00000025075�14763166027�0006477 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Global definitions for the INET interface module. * * Version: @(#)if.h 1.0.2 04/18/93 * * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1982-1988 * Ross Biro * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * * 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. */ #ifndef _LINUX_IF_H #define _LINUX_IF_H #include <linux/libc-compat.h> /* for compatibility with glibc */ #include <linux/types.h> /* for "__kernel_caddr_t" et al */ #include <linux/socket.h> /* for "struct sockaddr" et al */ /* for "__user" et al */ #include <sys/socket.h> /* for struct sockaddr. */ #if __UAPI_DEF_IF_IFNAMSIZ #define IFNAMSIZ 16 #endif /* __UAPI_DEF_IF_IFNAMSIZ */ #define IFALIASZ 256 #include <linux/hdlc/ioctl.h> /* For glibc compatibility. An empty enum does not compile. */ #if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || \ __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 /** * enum net_device_flags - &struct net_device flags * * These are the &struct net_device flags, they can be set by drivers, the * kernel and some can be triggered by userspace. Userspace can query and * set these flags using userspace utilities but there is also a sysfs * entry available for all dev flags which can be queried and set. These flags * are shared for all types of net_devices. The sysfs entries are available * via /sys/class/net/<dev>/flags. Flags which can be toggled through sysfs * are annotated below, note that only a few flags can be toggled and some * other flags are always preserved from the original net_device flags * even if you try to set them via sysfs. Flags which are always preserved * are kept under the flag grouping @IFF_VOLATILE. Flags which are __volatile__ * are annotated below as such. * * You should have a pretty good reason to be extending these flags. * * @IFF_UP: interface is up. Can be toggled through sysfs. * @IFF_BROADCAST: broadcast address valid. Volatile. * @IFF_DEBUG: turn on debugging. Can be toggled through sysfs. * @IFF_LOOPBACK: is a loopback net. Volatile. * @IFF_POINTOPOINT: interface is has p-p link. Volatile. * @IFF_NOTRAILERS: avoid use of trailers. Can be toggled through sysfs. * Volatile. * @IFF_RUNNING: interface RFC2863 OPER_UP. Volatile. * @IFF_NOARP: no ARP protocol. Can be toggled through sysfs. Volatile. * @IFF_PROMISC: receive all packets. Can be toggled through sysfs. * @IFF_ALLMULTI: receive all multicast packets. Can be toggled through * sysfs. * @IFF_MASTER: master of a load balancer. Volatile. * @IFF_SLAVE: slave of a load balancer. Volatile. * @IFF_MULTICAST: Supports multicast. Can be toggled through sysfs. * @IFF_PORTSEL: can set media type. Can be toggled through sysfs. * @IFF_AUTOMEDIA: auto media select active. Can be toggled through sysfs. * @IFF_DYNAMIC: dialup device with changing addresses. Can be toggled * through sysfs. * @IFF_LOWER_UP: driver signals L1 up. Volatile. * @IFF_DORMANT: driver signals dormant. Volatile. * @IFF_ECHO: echo sent packets. Volatile. */ enum net_device_flags { /* for compatibility with glibc net/if.h */ #if __UAPI_DEF_IF_NET_DEVICE_FLAGS IFF_UP = 1<<0, /* sysfs */ IFF_BROADCAST = 1<<1, /* __volatile__ */ IFF_DEBUG = 1<<2, /* sysfs */ IFF_LOOPBACK = 1<<3, /* __volatile__ */ IFF_POINTOPOINT = 1<<4, /* __volatile__ */ IFF_NOTRAILERS = 1<<5, /* sysfs */ IFF_RUNNING = 1<<6, /* __volatile__ */ IFF_NOARP = 1<<7, /* sysfs */ IFF_PROMISC = 1<<8, /* sysfs */ IFF_ALLMULTI = 1<<9, /* sysfs */ IFF_MASTER = 1<<10, /* __volatile__ */ IFF_SLAVE = 1<<11, /* __volatile__ */ IFF_MULTICAST = 1<<12, /* sysfs */ IFF_PORTSEL = 1<<13, /* sysfs */ IFF_AUTOMEDIA = 1<<14, /* sysfs */ IFF_DYNAMIC = 1<<15, /* sysfs */ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS */ #if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO IFF_LOWER_UP = 1<<16, /* __volatile__ */ IFF_DORMANT = 1<<17, /* __volatile__ */ IFF_ECHO = 1<<18, /* __volatile__ */ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */ }; #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 */ /* for compatibility with glibc net/if.h */ #if __UAPI_DEF_IF_NET_DEVICE_FLAGS #define IFF_UP IFF_UP #define IFF_BROADCAST IFF_BROADCAST #define IFF_DEBUG IFF_DEBUG #define IFF_LOOPBACK IFF_LOOPBACK #define IFF_POINTOPOINT IFF_POINTOPOINT #define IFF_NOTRAILERS IFF_NOTRAILERS #define IFF_RUNNING IFF_RUNNING #define IFF_NOARP IFF_NOARP #define IFF_PROMISC IFF_PROMISC #define IFF_ALLMULTI IFF_ALLMULTI #define IFF_MASTER IFF_MASTER #define IFF_SLAVE IFF_SLAVE #define IFF_MULTICAST IFF_MULTICAST #define IFF_PORTSEL IFF_PORTSEL #define IFF_AUTOMEDIA IFF_AUTOMEDIA #define IFF_DYNAMIC IFF_DYNAMIC #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS */ #if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO #define IFF_LOWER_UP IFF_LOWER_UP #define IFF_DORMANT IFF_DORMANT #define IFF_ECHO IFF_ECHO #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) #define IF_GET_IFACE 0x0001 /* for querying only */ #define IF_GET_PROTO 0x0002 /* For definitions see hdlc.h */ #define IF_IFACE_V35 0x1000 /* V.35 serial interface */ #define IF_IFACE_V24 0x1001 /* V.24 serial interface */ #define IF_IFACE_X21 0x1002 /* X.21 serial interface */ #define IF_IFACE_T1 0x1003 /* T1 telco serial interface */ #define IF_IFACE_E1 0x1004 /* E1 telco serial interface */ #define IF_IFACE_SYNC_SERIAL 0x1005 /* can't be set by software */ #define IF_IFACE_X21D 0x1006 /* X.21 Dual Clocking (FarSite) */ /* For definitions see hdlc.h */ #define IF_PROTO_HDLC 0x2000 /* raw HDLC protocol */ #define IF_PROTO_PPP 0x2001 /* PPP protocol */ #define IF_PROTO_CISCO 0x2002 /* Cisco HDLC protocol */ #define IF_PROTO_FR 0x2003 /* Frame Relay protocol */ #define IF_PROTO_FR_ADD_PVC 0x2004 /* Create FR PVC */ #define IF_PROTO_FR_DEL_PVC 0x2005 /* Delete FR PVC */ #define IF_PROTO_X25 0x2006 /* X.25 */ #define IF_PROTO_HDLC_ETH 0x2007 /* raw HDLC, Ethernet emulation */ #define IF_PROTO_FR_ADD_ETH_PVC 0x2008 /* Create FR Ethernet-bridged PVC */ #define IF_PROTO_FR_DEL_ETH_PVC 0x2009 /* Delete FR Ethernet-bridged PVC */ #define IF_PROTO_FR_PVC 0x200A /* for reading PVC status */ #define IF_PROTO_FR_ETH_PVC 0x200B #define IF_PROTO_RAW 0x200C /* RAW Socket */ /* RFC 2863 operational status */ enum { IF_OPER_UNKNOWN, IF_OPER_NOTPRESENT, IF_OPER_DOWN, IF_OPER_LOWERLAYERDOWN, IF_OPER_TESTING, IF_OPER_DORMANT, IF_OPER_UP, }; /* link modes */ enum { IF_LINK_MODE_DEFAULT, IF_LINK_MODE_DORMANT, /* limit upward transition to dormant */ }; /* * Device mapping structure. I'd just gone off and designed a * beautiful scheme using only loadable modules with arguments * for driver options and along come the PCMCIA people 8) * * Ah well. The get() side of this is good for WDSETUP, and it'll * be handy for debugging things. The set side is fine for now and * being very small might be worth keeping for clean configuration. */ /* for compatibility with glibc net/if.h */ #if __UAPI_DEF_IF_IFMAP struct ifmap { unsigned long mem_start; unsigned long mem_end; unsigned short base_addr; unsigned char irq; unsigned char dma; unsigned char port; /* 3 bytes spare */ }; #endif /* __UAPI_DEF_IF_IFMAP */ struct if_settings { unsigned int type; /* Type of physical device or protocol */ unsigned int size; /* Size of the data allocated by the caller */ union { /* {atm/eth/dsl}_settings anyone ? */ raw_hdlc_proto *raw_hdlc; cisco_proto *cisco; fr_proto *fr; fr_proto_pvc *fr_pvc; fr_proto_pvc_info *fr_pvc_info; /* interface settings */ sync_serial_settings *sync; te1_settings *te1; } ifs_ifsu; }; /* * Interface request structure used for socket * ioctl's. All interface ioctl's must have parameter * definitions which begin with ifr_name. The * remainder may be interface specific. */ /* for compatibility with glibc net/if.h */ #if __UAPI_DEF_IF_IFREQ struct ifreq { #define IFHWADDRLEN 6 union { char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ } ifr_ifrn; union { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; short ifru_flags; int ifru_ivalue; int ifru_mtu; struct ifmap ifru_map; char ifru_slave[IFNAMSIZ]; /* Just fits the size */ char ifru_newname[IFNAMSIZ]; void * ifru_data; struct if_settings ifru_settings; } ifr_ifru; }; #endif /* __UAPI_DEF_IF_IFREQ */ #define ifr_name ifr_ifrn.ifrn_name /* interface name */ #define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ #define ifr_addr ifr_ifru.ifru_addr /* address */ #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */ #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ #define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ #define ifr_flags ifr_ifru.ifru_flags /* flags */ #define ifr_metric ifr_ifru.ifru_ivalue /* metric */ #define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ #define ifr_map ifr_ifru.ifru_map /* device map */ #define ifr_slave ifr_ifru.ifru_slave /* slave device */ #define ifr_data ifr_ifru.ifru_data /* for use by interface */ #define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */ #define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */ #define ifr_qlen ifr_ifru.ifru_ivalue /* Queue length */ #define ifr_newname ifr_ifru.ifru_newname /* New name */ #define ifr_settings ifr_ifru.ifru_settings /* Device/proto settings*/ /* * Structure used in SIOCGIFCONF request. * Used to retrieve interface configuration * for machine (useful for programs which * must know all networks accessible). */ /* for compatibility with glibc net/if.h */ #if __UAPI_DEF_IF_IFCONF struct ifconf { int ifc_len; /* size of buffer */ union { char *ifcu_buf; struct ifreq *ifcu_req; } ifc_ifcu; }; #endif /* __UAPI_DEF_IF_IFCONF */ #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ #define ifc_req ifc_ifcu.ifcu_req /* array of structures */ #endif /* _LINUX_IF_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/pktcdvd.h�������������������������������������������������������������������������������������0000644�����������������00000005177�14763166027�0007541 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2000 Jens Axboe <axboe@suse.de> * Copyright (C) 2001-2004 Peter Osterlund <petero2@telia.com> * * May be copied or modified under the terms of the GNU General Public * License. See linux/COPYING for more information. * * Packet writing layer for ATAPI and SCSI CD-R, CD-RW, DVD-R, and * DVD-RW devices. * */ #ifndef __PKTCDVD_H #define __PKTCDVD_H #include <linux/types.h> /* * 1 for normal debug messages, 2 is very verbose. 0 to turn it off. */ #define PACKET_DEBUG 1 #define MAX_WRITERS 8 #define PKT_RB_POOL_SIZE 512 /* * How long we should hold a non-full packet before starting data gathering. */ #define PACKET_WAIT_TIME (HZ * 5 / 1000) /* * use drive write caching -- we need deferred error handling to be * able to successfully recover with this option (drive will return good * status as soon as the cdb is validated). */ #if defined(CONFIG_CDROM_PKTCDVD_WCACHE) #define USE_WCACHING 1 #else #define USE_WCACHING 0 #endif /* * No user-servicable parts beyond this point -> */ /* * device types */ #define PACKET_CDR 1 #define PACKET_CDRW 2 #define PACKET_DVDR 3 #define PACKET_DVDRW 4 /* * flags */ #define PACKET_WRITABLE 1 /* pd is writable */ #define PACKET_NWA_VALID 2 /* next writable address valid */ #define PACKET_LRA_VALID 3 /* last recorded address valid */ #define PACKET_MERGE_SEGS 4 /* perform segment merging to keep */ /* underlying cdrom device happy */ /* * Disc status -- from READ_DISC_INFO */ #define PACKET_DISC_EMPTY 0 #define PACKET_DISC_INCOMPLETE 1 #define PACKET_DISC_COMPLETE 2 #define PACKET_DISC_OTHER 3 /* * write type, and corresponding data block type */ #define PACKET_MODE1 1 #define PACKET_MODE2 2 #define PACKET_BLOCK_MODE1 8 #define PACKET_BLOCK_MODE2 10 /* * Last session/border status */ #define PACKET_SESSION_EMPTY 0 #define PACKET_SESSION_INCOMPLETE 1 #define PACKET_SESSION_RESERVED 2 #define PACKET_SESSION_COMPLETE 3 #define PACKET_MCN "4a656e734178626f65323030300000" #undef PACKET_USE_LS #define PKT_CTRL_CMD_SETUP 0 #define PKT_CTRL_CMD_TEARDOWN 1 #define PKT_CTRL_CMD_STATUS 2 struct pkt_ctrl_command { __u32 command; /* in: Setup, teardown, status */ __u32 dev_index; /* in/out: Device index */ __u32 dev; /* in/out: Device nr for cdrw device */ __u32 pkt_dev; /* in/out: Device nr for packet device */ __u32 num_devices; /* out: Largest device index + 1 */ __u32 padding; /* Not used */ }; /* * packet ioctls */ #define PACKET_IOCTL_MAGIC ('X') #define PACKET_CTRL_CMD _IOWR(PACKET_IOCTL_MAGIC, 1, struct pkt_ctrl_command) #endif /* __PKTCDVD_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/uuid.h����������������������������������������������������������������������������������������0000644�����������������00000002514�14763166027�0007040 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * UUID/GUID definition * * Copyright (C) 2010, Intel Corp. * Huang Ying <ying.huang@intel.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 as published by the Free Software Foundation; * * 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. */ #ifndef _LINUX_UUID_H_ #define _LINUX_UUID_H_ #include <linux/types.h> typedef struct { __u8 b[16]; } guid_t; #define GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ ((guid_t) \ {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \ (b) & 0xff, ((b) >> 8) & 0xff, \ (c) & 0xff, ((c) >> 8) & 0xff, \ (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}) /* backwards compatibility, don't use in new code */ typedef guid_t uuid_le; #define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) #define NULL_UUID_LE \ UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00) #endif /* _LINUX_UUID_H_ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_arp.h��������������������������������������������������������������������������������������0000644�����������������00000014661�14763166027�0007340 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Global definitions for the ARP (RFC 826) protocol. * * Version: @(#)if_arp.h 1.0.1 04/16/93 * * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1986-1988 * Portions taken from the KA9Q/NOS (v2.00m PA0GRI) source. * Ross Biro * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Florian La Roche, * Jonathan Layes <layes@loran.com> * Arnaldo Carvalho de Melo <acme@conectiva.com.br> ARPHRD_HWX25 * * 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. */ #ifndef _LINUX_IF_ARP_H #define _LINUX_IF_ARP_H #include <linux/netdevice.h> /* ARP protocol HARDWARE identifiers. */ #define ARPHRD_NETROM 0 /* from KA9Q: NET/ROM pseudo */ #define ARPHRD_ETHER 1 /* Ethernet 10Mbps */ #define ARPHRD_EETHER 2 /* Experimental Ethernet */ #define ARPHRD_AX25 3 /* AX.25 Level 2 */ #define ARPHRD_PRONET 4 /* PROnet token ring */ #define ARPHRD_CHAOS 5 /* Chaosnet */ #define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB */ #define ARPHRD_ARCNET 7 /* ARCnet */ #define ARPHRD_APPLETLK 8 /* APPLEtalk */ #define ARPHRD_DLCI 15 /* Frame Relay DLCI */ #define ARPHRD_ATM 19 /* ATM */ #define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id) */ #define ARPHRD_IEEE1394 24 /* IEEE 1394 IPv4 - RFC 2734 */ #define ARPHRD_EUI64 27 /* EUI-64 */ #define ARPHRD_INFINIBAND 32 /* InfiniBand */ /* Dummy types for non ARP hardware */ #define ARPHRD_SLIP 256 #define ARPHRD_CSLIP 257 #define ARPHRD_SLIP6 258 #define ARPHRD_CSLIP6 259 #define ARPHRD_RSRVD 260 /* Notional KISS type */ #define ARPHRD_ADAPT 264 #define ARPHRD_ROSE 270 #define ARPHRD_X25 271 /* CCITT X.25 */ #define ARPHRD_HWX25 272 /* Boards with X.25 in firmware */ #define ARPHRD_CAN 280 /* Controller Area Network */ #define ARPHRD_PPP 512 #define ARPHRD_CISCO 513 /* Cisco HDLC */ #define ARPHRD_HDLC ARPHRD_CISCO #define ARPHRD_LAPB 516 /* LAPB */ #define ARPHRD_DDCMP 517 /* Digital's DDCMP protocol */ #define ARPHRD_RAWHDLC 518 /* Raw HDLC */ #define ARPHRD_RAWIP 519 /* Raw IP */ #define ARPHRD_TUNNEL 768 /* IPIP tunnel */ #define ARPHRD_TUNNEL6 769 /* IP6IP6 tunnel */ #define ARPHRD_FRAD 770 /* Frame Relay Access Device */ #define ARPHRD_SKIP 771 /* SKIP vif */ #define ARPHRD_LOOPBACK 772 /* Loopback device */ #define ARPHRD_LOCALTLK 773 /* Localtalk device */ #define ARPHRD_FDDI 774 /* Fiber Distributed Data Interface */ #define ARPHRD_BIF 775 /* AP1000 BIF */ #define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4 */ #define ARPHRD_IPDDP 777 /* IP over DDP tunneller */ #define ARPHRD_IPGRE 778 /* GRE over IP */ #define ARPHRD_PIMREG 779 /* PIMSM register interface */ #define ARPHRD_HIPPI 780 /* High Performance Parallel Interface */ #define ARPHRD_ASH 781 /* Nexus 64Mbps Ash */ #define ARPHRD_ECONET 782 /* Acorn Econet */ #define ARPHRD_IRDA 783 /* Linux-IrDA */ /* ARP works differently on different FC media .. so */ #define ARPHRD_FCPP 784 /* Point to point fibrechannel */ #define ARPHRD_FCAL 785 /* Fibrechannel arbitrated loop */ #define ARPHRD_FCPL 786 /* Fibrechannel public loop */ #define ARPHRD_FCFABRIC 787 /* Fibrechannel fabric */ /* 787->799 reserved for fibrechannel media types */ #define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR */ #define ARPHRD_IEEE80211 801 /* IEEE 802.11 */ #define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ #define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ #define ARPHRD_IEEE802154 804 #define ARPHRD_IEEE802154_MONITOR 805 /* IEEE 802.15.4 network monitor */ #define ARPHRD_PHONET 820 /* PhoNet media type */ #define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ #define ARPHRD_CAIF 822 /* CAIF media type */ #define ARPHRD_IP6GRE 823 /* GRE over IPv6 */ #define ARPHRD_NETLINK 824 /* Netlink header */ #define ARPHRD_6LOWPAN 825 /* IPv6 over LoWPAN */ #define ARPHRD_VSOCKMON 826 /* Vsock monitor header */ #define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ #define ARPHRD_NONE 0xFFFE /* zero header length */ /* ARP protocol opcodes. */ #define ARPOP_REQUEST 1 /* ARP request */ #define ARPOP_REPLY 2 /* ARP reply */ #define ARPOP_RREQUEST 3 /* RARP request */ #define ARPOP_RREPLY 4 /* RARP reply */ #define ARPOP_InREQUEST 8 /* InARP request */ #define ARPOP_InREPLY 9 /* InARP reply */ #define ARPOP_NAK 10 /* (ATM)ARP NAK */ /* ARP ioctl request. */ struct arpreq { struct sockaddr arp_pa; /* protocol address */ struct sockaddr arp_ha; /* hardware address */ int arp_flags; /* flags */ struct sockaddr arp_netmask; /* netmask (only for proxy arps) */ char arp_dev[16]; }; struct arpreq_old { struct sockaddr arp_pa; /* protocol address */ struct sockaddr arp_ha; /* hardware address */ int arp_flags; /* flags */ struct sockaddr arp_netmask; /* netmask (only for proxy arps) */ }; /* ARP Flag values. */ #define ATF_COM 0x02 /* completed entry (ha valid) */ #define ATF_PERM 0x04 /* permanent entry */ #define ATF_PUBL 0x08 /* publish entry */ #define ATF_USETRAILERS 0x10 /* has requested trailers */ #define ATF_NETMASK 0x20 /* want to use a netmask (only for proxy entries) */ #define ATF_DONTPUB 0x40 /* don't answer this addresses */ /* * This structure defines an ethernet arp header. */ struct arphdr { __be16 ar_hrd; /* format of hardware address */ __be16 ar_pro; /* format of protocol address */ unsigned char ar_hln; /* length of hardware address */ unsigned char ar_pln; /* length of protocol address */ __be16 ar_op; /* ARP opcode (command) */ #if 0 /* * Ethernet looks like this : This bit is variable sized however... */ unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */ unsigned char ar_sip[4]; /* sender IP address */ unsigned char ar_tha[ETH_ALEN]; /* target hardware address */ unsigned char ar_tip[4]; /* target IP address */ #endif }; #endif /* _LINUX_IF_ARP_H */ �������������������������������������������������������������������������������linux/caif/if_caif.h��������������������������������������������������������������������������������0000644�����������������00000002021�14763166027�0010345 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) ST-Ericsson AB 2010 * Author: Sjur Brendeland * License terms: GNU General Public License (GPL) version 2 */ #ifndef IF_CAIF_H_ #define IF_CAIF_H_ #include <linux/sockios.h> #include <linux/types.h> #include <linux/socket.h> /** * enum ifla_caif - CAIF NetlinkRT parameters. * @IFLA_CAIF_IPV4_CONNID: Connection ID for IPv4 PDP Context. * The type of attribute is NLA_U32. * @IFLA_CAIF_IPV6_CONNID: Connection ID for IPv6 PDP Context. * The type of attribute is NLA_U32. * @IFLA_CAIF_LOOPBACK: If different from zero, device is doing loopback * The type of attribute is NLA_U8. * * When using RT Netlink to create, destroy or configure a CAIF IP interface, * enum ifla_caif is used to specify the configuration attributes. */ enum ifla_caif { __IFLA_CAIF_UNSPEC, IFLA_CAIF_IPV4_CONNID, IFLA_CAIF_IPV6_CONNID, IFLA_CAIF_LOOPBACK, __IFLA_CAIF_MAX }; #define IFLA_CAIF_MAX (__IFLA_CAIF_MAX-1) #endif /*IF_CAIF_H_*/ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/caif/caif_socket.h����������������������������������������������������������������������������0000644�����������������00000013310�14763166027�0011242 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* linux/caif_socket.h * CAIF Definitions for CAIF socket and network layer * Copyright (C) ST-Ericsson AB 2010 * Author: Sjur Brendeland * License terms: GNU General Public License (GPL) version 2 */ #ifndef _LINUX_CAIF_SOCKET_H #define _LINUX_CAIF_SOCKET_H #include <linux/types.h> #include <linux/socket.h> /** * enum caif_link_selector - Physical Link Selection. * @CAIF_LINK_HIGH_BANDW: Physical interface for high-bandwidth * traffic. * @CAIF_LINK_LOW_LATENCY: Physical interface for low-latency * traffic. * * CAIF Link Layers can register their link properties. * This enum is used for choosing between CAIF Link Layers when * setting up CAIF Channels when multiple CAIF Link Layers exists. */ enum caif_link_selector { CAIF_LINK_HIGH_BANDW, CAIF_LINK_LOW_LATENCY }; /** * enum caif_channel_priority - CAIF channel priorities. * * @CAIF_PRIO_MIN: Min priority for a channel. * @CAIF_PRIO_LOW: Low-priority channel. * @CAIF_PRIO_NORMAL: Normal/default priority level. * @CAIF_PRIO_HIGH: High priority level * @CAIF_PRIO_MAX: Max priority for channel * * Priority can be set on CAIF Channels in order to * prioritize between traffic on different CAIF Channels. * These priority levels are recommended, but the priority value * is not restricted to the values defined in this enum, any value * between CAIF_PRIO_MIN and CAIF_PRIO_MAX could be used. */ enum caif_channel_priority { CAIF_PRIO_MIN = 0x01, CAIF_PRIO_LOW = 0x04, CAIF_PRIO_NORMAL = 0x0f, CAIF_PRIO_HIGH = 0x14, CAIF_PRIO_MAX = 0x1F }; /** * enum caif_protocol_type - CAIF Channel type. * @CAIFPROTO_AT: Classic AT channel. * @CAIFPROTO_DATAGRAM: Datagram channel. * @CAIFPROTO_DATAGRAM_LOOP: Datagram loopback channel, used for testing. * @CAIFPROTO_UTIL: Utility (Psock) channel. * @CAIFPROTO_RFM: Remote File Manager * @CAIFPROTO_DEBUG: Debug link * * This enum defines the CAIF Channel type to be used. This defines * the service to connect to on the modem. */ enum caif_protocol_type { CAIFPROTO_AT, CAIFPROTO_DATAGRAM, CAIFPROTO_DATAGRAM_LOOP, CAIFPROTO_UTIL, CAIFPROTO_RFM, CAIFPROTO_DEBUG, _CAIFPROTO_MAX }; #define CAIFPROTO_MAX _CAIFPROTO_MAX /** * enum caif_at_type - AT Service Endpoint * @CAIF_ATTYPE_PLAIN: Connects to a plain vanilla AT channel. */ enum caif_at_type { CAIF_ATTYPE_PLAIN = 2 }; /** * enum caif_debug_type - Content selection for debug connection * @CAIF_DEBUG_TRACE_INTERACTIVE: Connection will contain * both trace and interactive debug. * @CAIF_DEBUG_TRACE: Connection contains trace only. * @CAIF_DEBUG_INTERACTIVE: Connection to interactive debug. */ enum caif_debug_type { CAIF_DEBUG_TRACE_INTERACTIVE = 0, CAIF_DEBUG_TRACE, CAIF_DEBUG_INTERACTIVE, }; /** * enum caif_debug_service - Debug Service Endpoint * @CAIF_RADIO_DEBUG_SERVICE: Debug service on the Radio sub-system * @CAIF_APP_DEBUG_SERVICE: Debug for the applications sub-system */ enum caif_debug_service { CAIF_RADIO_DEBUG_SERVICE = 1, CAIF_APP_DEBUG_SERVICE }; /** * struct sockaddr_caif - the sockaddr structure for CAIF sockets. * @family: Address family number, must be AF_CAIF. * @u: Union of address data 'switched' by family. * : * @u.at: Applies when family = CAIFPROTO_AT. * * @u.at.type: Type of AT link to set up (enum caif_at_type). * * @u.util: Applies when family = CAIFPROTO_UTIL * * @u.util.service: Utility service name. * * @u.dgm: Applies when family = CAIFPROTO_DATAGRAM * * @u.dgm.connection_id: Datagram connection id. * * @u.dgm.nsapi: NSAPI of the PDP-Context. * * @u.rfm: Applies when family = CAIFPROTO_RFM * * @u.rfm.connection_id: Connection ID for RFM. * * @u.rfm.volume: Volume to mount. * * @u.dbg: Applies when family = CAIFPROTO_DEBUG. * * @u.dbg.type: Type of debug connection to set up * (caif_debug_type). * * @u.dbg.service: Service sub-system to connect (caif_debug_service * Description: * This structure holds the connect parameters used for setting up a * CAIF Channel. It defines the service to connect to on the modem. */ struct sockaddr_caif { __kernel_sa_family_t family; union { struct { __u8 type; /* type: enum caif_at_type */ } at; /* CAIFPROTO_AT */ struct { char service[16]; } util; /* CAIFPROTO_UTIL */ union { __u32 connection_id; __u8 nsapi; } dgm; /* CAIFPROTO_DATAGRAM(_LOOP)*/ struct { __u32 connection_id; char volume[16]; } rfm; /* CAIFPROTO_RFM */ struct { __u8 type; /* type:enum caif_debug_type */ __u8 service; /* service:caif_debug_service */ } dbg; /* CAIFPROTO_DEBUG */ } u; }; /** * enum caif_socket_opts - CAIF option values for getsockopt and setsockopt. * * @CAIFSO_LINK_SELECT: Selector used if multiple CAIF Link layers are * available. Either a high bandwidth * link can be selected (CAIF_LINK_HIGH_BANDW) or * or a low latency link (CAIF_LINK_LOW_LATENCY). * This option is of type __u32. * Alternatively SO_BINDTODEVICE can be used. * * @CAIFSO_REQ_PARAM: Used to set the request parameters for a * utility channel. (maximum 256 bytes). This * option must be set before connecting. * * @CAIFSO_RSP_PARAM: Gets the response parameters for a utility * channel. (maximum 256 bytes). This option * is valid after a successful connect. * * * This enum defines the CAIF Socket options to be used on a socket * of type PF_CAIF. * */ enum caif_socket_opts { CAIFSO_LINK_SELECT = 127, CAIFSO_REQ_PARAM = 128, CAIFSO_RSP_PARAM = 129, }; #endif /* _LINUX_CAIF_SOCKET_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/serio.h���������������������������������������������������������������������������������������0000644�����������������00000004031�14763166027�0007207 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 1999-2002 Vojtech Pavlik * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #ifndef _SERIO_H #define _SERIO_H #include <linux/const.h> #include <linux/ioctl.h> #define SPIOCSTYPE _IOW('q', 0x01, unsigned long) /* * bit masks for use in "interrupt" flags (3rd argument) */ #define SERIO_TIMEOUT _BITUL(0) #define SERIO_PARITY _BITUL(1) #define SERIO_FRAME _BITUL(2) #define SERIO_OOB_DATA _BITUL(3) /* * Serio types */ #define SERIO_XT 0x00 #define SERIO_8042 0x01 #define SERIO_RS232 0x02 #define SERIO_HIL_MLC 0x03 #define SERIO_PS_PSTHRU 0x05 #define SERIO_8042_XL 0x06 /* * Serio protocols */ #define SERIO_UNKNOWN 0x00 #define SERIO_MSC 0x01 #define SERIO_SUN 0x02 #define SERIO_MS 0x03 #define SERIO_MP 0x04 #define SERIO_MZ 0x05 #define SERIO_MZP 0x06 #define SERIO_MZPP 0x07 #define SERIO_VSXXXAA 0x08 #define SERIO_SUNKBD 0x10 #define SERIO_WARRIOR 0x18 #define SERIO_SPACEORB 0x19 #define SERIO_MAGELLAN 0x1a #define SERIO_SPACEBALL 0x1b #define SERIO_GUNZE 0x1c #define SERIO_IFORCE 0x1d #define SERIO_STINGER 0x1e #define SERIO_NEWTON 0x1f #define SERIO_STOWAWAY 0x20 #define SERIO_H3600 0x21 #define SERIO_PS2SER 0x22 #define SERIO_TWIDKBD 0x23 #define SERIO_TWIDJOY 0x24 #define SERIO_HIL 0x25 #define SERIO_SNES232 0x26 #define SERIO_SEMTECH 0x27 #define SERIO_LKKBD 0x28 #define SERIO_ELO 0x29 #define SERIO_MICROTOUCH 0x30 #define SERIO_PENMOUNT 0x31 #define SERIO_TOUCHRIGHT 0x32 #define SERIO_TOUCHWIN 0x33 #define SERIO_TAOSEVM 0x34 #define SERIO_FUJITSU 0x35 #define SERIO_ZHENHUA 0x36 #define SERIO_INEXIO 0x37 #define SERIO_TOUCHIT213 0x38 #define SERIO_W8001 0x39 #define SERIO_DYNAPRO 0x3a #define SERIO_HAMPSHIRE 0x3b #define SERIO_PS2MULT 0x3c #define SERIO_TSC40 0x3d #define SERIO_WACOM_IV 0x3e #define SERIO_EGALAX 0x3f #define SERIO_PULSE8_CEC 0x40 #define SERIO_RAINSHADOW_CEC 0x41 #endif /* _SERIO_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/futex.h���������������������������������������������������������������������������������������0000644�����������������00000011601�14763166027�0007222 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_FUTEX_H #define _LINUX_FUTEX_H #include <linux/types.h> /* Second argument to futex syscall */ #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 #define FUTEX_FD 2 #define FUTEX_REQUEUE 3 #define FUTEX_CMP_REQUEUE 4 #define FUTEX_WAKE_OP 5 #define FUTEX_LOCK_PI 6 #define FUTEX_UNLOCK_PI 7 #define FUTEX_TRYLOCK_PI 8 #define FUTEX_WAIT_BITSET 9 #define FUTEX_WAKE_BITSET 10 #define FUTEX_WAIT_REQUEUE_PI 11 #define FUTEX_CMP_REQUEUE_PI 12 #define FUTEX_PRIVATE_FLAG 128 #define FUTEX_CLOCK_REALTIME 256 #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) #define FUTEX_WAIT_PRIVATE (FUTEX_WAIT | FUTEX_PRIVATE_FLAG) #define FUTEX_WAKE_PRIVATE (FUTEX_WAKE | FUTEX_PRIVATE_FLAG) #define FUTEX_REQUEUE_PRIVATE (FUTEX_REQUEUE | FUTEX_PRIVATE_FLAG) #define FUTEX_CMP_REQUEUE_PRIVATE (FUTEX_CMP_REQUEUE | FUTEX_PRIVATE_FLAG) #define FUTEX_WAKE_OP_PRIVATE (FUTEX_WAKE_OP | FUTEX_PRIVATE_FLAG) #define FUTEX_LOCK_PI_PRIVATE (FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG) #define FUTEX_UNLOCK_PI_PRIVATE (FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG) #define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG) #define FUTEX_WAIT_BITSET_PRIVATE (FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG) #define FUTEX_WAKE_BITSET_PRIVATE (FUTEX_WAKE_BITSET | FUTEX_PRIVATE_FLAG) #define FUTEX_WAIT_REQUEUE_PI_PRIVATE (FUTEX_WAIT_REQUEUE_PI | \ FUTEX_PRIVATE_FLAG) #define FUTEX_CMP_REQUEUE_PI_PRIVATE (FUTEX_CMP_REQUEUE_PI | \ FUTEX_PRIVATE_FLAG) /* * Support for robust futexes: the kernel cleans up held futexes at * thread exit time. */ /* * Per-lock list entry - embedded in user-space locks, somewhere close * to the futex field. (Note: user-space uses a double-linked list to * achieve O(1) list add and remove, but the kernel only needs to know * about the forward link) * * NOTE: this structure is part of the syscall ABI, and must not be * changed. */ struct robust_list { struct robust_list *next; }; /* * Per-thread list head: * * NOTE: this structure is part of the syscall ABI, and must only be * changed if the change is first communicated with the glibc folks. * (When an incompatible change is done, we'll increase the structure * size, which glibc will detect) */ struct robust_list_head { /* * The head of the list. Points back to itself if empty: */ struct robust_list list; /* * This relative offset is set by user-space, it gives the kernel * the relative position of the futex field to examine. This way * we keep userspace flexible, to freely shape its data-structure, * without hardcoding any particular offset into the kernel: */ long futex_offset; /* * The death of the thread may race with userspace setting * up a lock's links. So to handle this race, userspace first * sets this field to the address of the to-be-taken lock, * then does the lock acquire, and then adds itself to the * list, and then clears this field. Hence the kernel will * always have full knowledge of all locks that the thread * _might_ have taken. We check the owner TID in any case, * so only truly owned locks will be handled. */ struct robust_list *list_op_pending; }; /* * Are there any waiters for this robust futex: */ #define FUTEX_WAITERS 0x80000000 /* * The kernel signals via this bit that a thread holding a futex * has exited without unlocking the futex. The kernel also does * a FUTEX_WAKE on such futexes, after setting the bit, to wake * up any possible waiters: */ #define FUTEX_OWNER_DIED 0x40000000 /* * The rest of the robust-futex field is for the TID: */ #define FUTEX_TID_MASK 0x3fffffff /* * This limit protects against a deliberately circular list. * (Not worth introducing an rlimit for it) */ #define ROBUST_LIST_LIMIT 2048 /* * bitset with all bits set for the FUTEX_xxx_BITSET OPs to request a * match of any bit. */ #define FUTEX_BITSET_MATCH_ANY 0xffffffff #define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */ #define FUTEX_OP_ADD 1 /* *(int *)UADDR2 += OPARG; */ #define FUTEX_OP_OR 2 /* *(int *)UADDR2 |= OPARG; */ #define FUTEX_OP_ANDN 3 /* *(int *)UADDR2 &= ~OPARG; */ #define FUTEX_OP_XOR 4 /* *(int *)UADDR2 ^= OPARG; */ #define FUTEX_OP_OPARG_SHIFT 8 /* Use (1 << OPARG) instead of OPARG. */ #define FUTEX_OP_CMP_EQ 0 /* if (oldval == CMPARG) wake */ #define FUTEX_OP_CMP_NE 1 /* if (oldval != CMPARG) wake */ #define FUTEX_OP_CMP_LT 2 /* if (oldval < CMPARG) wake */ #define FUTEX_OP_CMP_LE 3 /* if (oldval <= CMPARG) wake */ #define FUTEX_OP_CMP_GT 4 /* if (oldval > CMPARG) wake */ #define FUTEX_OP_CMP_GE 5 /* if (oldval >= CMPARG) wake */ /* FUTEX_WAKE_OP will perform atomically int oldval = *(int *)UADDR2; *(int *)UADDR2 = oldval OP OPARG; if (oldval CMP CMPARG) wake UADDR2; */ #define FUTEX_OP(op, oparg, cmp, cmparg) \ (((op & 0xf) << 28) | ((cmp & 0xf) << 24) \ | ((oparg & 0xfff) << 12) | (cmparg & 0xfff)) #endif /* _LINUX_FUTEX_H */ �������������������������������������������������������������������������������������������������������������������������������linux/cyclades.h������������������������������������������������������������������������������������0000644�����������������00000041324�14763166027�0007663 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* $Revision: 3.0 $$Date: 1998/11/02 14:20:59 $ * linux/include/linux/cyclades.h * * This file was initially written by * Randolph Bentson <bentson@grieg.seaslug.org> and is maintained by * Ivan Passos <ivan@cyclades.com>. * * This file contains the general definitions for the cyclades.c driver *$Log: cyclades.h,v $ *Revision 3.1 2002/01/29 11:36:16 henrique *added throttle field on struct cyclades_port to indicate whether the *port is throttled or not * *Revision 3.1 2000/04/19 18:52:52 ivan *converted address fields to unsigned long and added fields for physical *addresses on cyclades_card structure; * *Revision 3.0 1998/11/02 14:20:59 ivan *added nports field on cyclades_card structure; * *Revision 2.5 1998/08/03 16:57:01 ivan *added cyclades_idle_stats structure; * *Revision 2.4 1998/06/01 12:09:53 ivan *removed closing_wait2 from cyclades_port structure; * *Revision 2.3 1998/03/16 18:01:12 ivan *changes in the cyclades_port structure to get it closer to the *standard serial port structure; *added constants for new ioctls; * *Revision 2.2 1998/02/17 16:50:00 ivan *changes in the cyclades_port structure (addition of shutdown_wait and *chip_rev variables); *added constants for new ioctls and for CD1400 rev. numbers. * *Revision 2.1 1997/10/24 16:03:00 ivan *added rflow (which allows enabling the CD1400 special flow control *feature) and rtsdtr_inv (which allows DTR/RTS pin inversion) to *cyclades_port structure; *added Alpha support * *Revision 2.0 1997/06/30 10:30:00 ivan *added some new doorbell command constants related to IOCTLW and *UART error signaling * *Revision 1.8 1997/06/03 15:30:00 ivan *added constant ZFIRM_HLT *added constant CyPCI_Ze_win ( = 2 * Cy_PCI_Zwin) * *Revision 1.7 1997/03/26 10:30:00 daniel *new entries at the end of cyclades_port struct to reallocate *variables illegally allocated within card memory. * *Revision 1.6 1996/09/09 18:35:30 bentson *fold in changes for Cyclom-Z -- including structures for *communicating with board as well modest changes to original *structures to support new features. * *Revision 1.5 1995/11/13 21:13:31 bentson *changes suggested by Michael Chastain <mec@duracef.shout.net> *to support use of this file in non-kernel applications * * */ #ifndef _LINUX_CYCLADES_H #define _LINUX_CYCLADES_H #include <linux/types.h> struct cyclades_monitor { unsigned long int_count; unsigned long char_count; unsigned long char_max; unsigned long char_last; }; /* * These stats all reflect activity since the device was last initialized. * (i.e., since the port was opened with no other processes already having it * open) */ struct cyclades_idle_stats { __kernel_time_t in_use; /* Time device has been in use (secs) */ __kernel_time_t recv_idle; /* Time since last char received (secs) */ __kernel_time_t xmit_idle; /* Time since last char transmitted (secs) */ unsigned long recv_bytes; /* Bytes received */ unsigned long xmit_bytes; /* Bytes transmitted */ unsigned long overruns; /* Input overruns */ unsigned long frame_errs; /* Input framing errors */ unsigned long parity_errs; /* Input parity errors */ }; #define CYCLADES_MAGIC 0x4359 #define CYGETMON 0x435901 #define CYGETTHRESH 0x435902 #define CYSETTHRESH 0x435903 #define CYGETDEFTHRESH 0x435904 #define CYSETDEFTHRESH 0x435905 #define CYGETTIMEOUT 0x435906 #define CYSETTIMEOUT 0x435907 #define CYGETDEFTIMEOUT 0x435908 #define CYSETDEFTIMEOUT 0x435909 #define CYSETRFLOW 0x43590a #define CYGETRFLOW 0x43590b #define CYSETRTSDTR_INV 0x43590c #define CYGETRTSDTR_INV 0x43590d #define CYZSETPOLLCYCLE 0x43590e #define CYZGETPOLLCYCLE 0x43590f #define CYGETCD1400VER 0x435910 #define CYSETWAIT 0x435912 #define CYGETWAIT 0x435913 /*************** CYCLOM-Z ADDITIONS ***************/ #define CZIOC ('M' << 8) #define CZ_NBOARDS (CZIOC|0xfa) #define CZ_BOOT_START (CZIOC|0xfb) #define CZ_BOOT_DATA (CZIOC|0xfc) #define CZ_BOOT_END (CZIOC|0xfd) #define CZ_TEST (CZIOC|0xfe) #define CZ_DEF_POLL (HZ/25) #define MAX_BOARD 4 /* Max number of boards */ #define MAX_DEV 256 /* Max number of ports total */ #define CYZ_MAX_SPEED 921600 #define CYZ_FIFO_SIZE 16 #define CYZ_BOOT_NWORDS 0x100 struct CYZ_BOOT_CTRL { unsigned short nboard; int status[MAX_BOARD]; int nchannel[MAX_BOARD]; int fw_rev[MAX_BOARD]; unsigned long offset; unsigned long data[CYZ_BOOT_NWORDS]; }; #ifndef DP_WINDOW_SIZE /* * Memory Window Sizes */ #define DP_WINDOW_SIZE (0x00080000) /* window size 512 Kb */ #define ZE_DP_WINDOW_SIZE (0x00100000) /* window size 1 Mb (Ze and 8Zo V.2 */ #define CTRL_WINDOW_SIZE (0x00000080) /* runtime regs 128 bytes */ /* * CUSTOM_REG - Cyclom-Z/PCI Custom Registers Set. The driver * normally will access only interested on the fpga_id, fpga_version, * start_cpu and stop_cpu. */ struct CUSTOM_REG { __u32 fpga_id; /* FPGA Identification Register */ __u32 fpga_version; /* FPGA Version Number Register */ __u32 cpu_start; /* CPU start Register (write) */ __u32 cpu_stop; /* CPU stop Register (write) */ __u32 misc_reg; /* Miscellaneous Register */ __u32 idt_mode; /* IDT mode Register */ __u32 uart_irq_status; /* UART IRQ status Register */ __u32 clear_timer0_irq; /* Clear timer interrupt Register */ __u32 clear_timer1_irq; /* Clear timer interrupt Register */ __u32 clear_timer2_irq; /* Clear timer interrupt Register */ __u32 test_register; /* Test Register */ __u32 test_count; /* Test Count Register */ __u32 timer_select; /* Timer select register */ __u32 pr_uart_irq_status; /* Prioritized UART IRQ stat Reg */ __u32 ram_wait_state; /* RAM wait-state Register */ __u32 uart_wait_state; /* UART wait-state Register */ __u32 timer_wait_state; /* timer wait-state Register */ __u32 ack_wait_state; /* ACK wait State Register */ }; /* * RUNTIME_9060 - PLX PCI9060ES local configuration and shared runtime * registers. This structure can be used to access the 9060 registers * (memory mapped). */ struct RUNTIME_9060 { __u32 loc_addr_range; /* 00h - Local Address Range */ __u32 loc_addr_base; /* 04h - Local Address Base */ __u32 loc_arbitr; /* 08h - Local Arbitration */ __u32 endian_descr; /* 0Ch - Big/Little Endian Descriptor */ __u32 loc_rom_range; /* 10h - Local ROM Range */ __u32 loc_rom_base; /* 14h - Local ROM Base */ __u32 loc_bus_descr; /* 18h - Local Bus descriptor */ __u32 loc_range_mst; /* 1Ch - Local Range for Master to PCI */ __u32 loc_base_mst; /* 20h - Local Base for Master PCI */ __u32 loc_range_io; /* 24h - Local Range for Master IO */ __u32 pci_base_mst; /* 28h - PCI Base for Master PCI */ __u32 pci_conf_io; /* 2Ch - PCI configuration for Master IO */ __u32 filler1; /* 30h */ __u32 filler2; /* 34h */ __u32 filler3; /* 38h */ __u32 filler4; /* 3Ch */ __u32 mail_box_0; /* 40h - Mail Box 0 */ __u32 mail_box_1; /* 44h - Mail Box 1 */ __u32 mail_box_2; /* 48h - Mail Box 2 */ __u32 mail_box_3; /* 4Ch - Mail Box 3 */ __u32 filler5; /* 50h */ __u32 filler6; /* 54h */ __u32 filler7; /* 58h */ __u32 filler8; /* 5Ch */ __u32 pci_doorbell; /* 60h - PCI to Local Doorbell */ __u32 loc_doorbell; /* 64h - Local to PCI Doorbell */ __u32 intr_ctrl_stat; /* 68h - Interrupt Control/Status */ __u32 init_ctrl; /* 6Ch - EEPROM control, Init Control, etc */ }; /* Values for the Local Base Address re-map register */ #define WIN_RAM 0x00000001L /* set the sliding window to RAM */ #define WIN_CREG 0x14000001L /* set the window to custom Registers */ /* Values timer select registers */ #define TIMER_BY_1M 0x00 /* clock divided by 1M */ #define TIMER_BY_256K 0x01 /* clock divided by 256k */ #define TIMER_BY_128K 0x02 /* clock divided by 128k */ #define TIMER_BY_32K 0x03 /* clock divided by 32k */ /****************** ****************** *******************/ #endif #ifndef ZFIRM_ID /* #include "zfwint.h" */ /****************** ****************** *******************/ /* * This file contains the definitions for interfacing with the * Cyclom-Z ZFIRM Firmware. */ /* General Constant definitions */ #define MAX_CHAN 64 /* max number of channels per board */ /* firmware id structure (set after boot) */ #define ID_ADDRESS 0x00000180L /* signature/pointer address */ #define ZFIRM_ID 0x5557465AL /* ZFIRM/U signature */ #define ZFIRM_HLT 0x59505B5CL /* ZFIRM needs external power supply */ #define ZFIRM_RST 0x56040674L /* RST signal (due to FW reset) */ #define ZF_TINACT_DEF 1000 /* default inactivity timeout (1000 ms) */ #define ZF_TINACT ZF_TINACT_DEF struct FIRM_ID { __u32 signature; /* ZFIRM/U signature */ __u32 zfwctrl_addr; /* pointer to ZFW_CTRL structure */ }; /* Op. System id */ #define C_OS_LINUX 0x00000030 /* generic Linux system */ /* channel op_mode */ #define C_CH_DISABLE 0x00000000 /* channel is disabled */ #define C_CH_TXENABLE 0x00000001 /* channel Tx enabled */ #define C_CH_RXENABLE 0x00000002 /* channel Rx enabled */ #define C_CH_ENABLE 0x00000003 /* channel Tx/Rx enabled */ #define C_CH_LOOPBACK 0x00000004 /* Loopback mode */ /* comm_parity - parity */ #define C_PR_NONE 0x00000000 /* None */ #define C_PR_ODD 0x00000001 /* Odd */ #define C_PR_EVEN 0x00000002 /* Even */ #define C_PR_MARK 0x00000004 /* Mark */ #define C_PR_SPACE 0x00000008 /* Space */ #define C_PR_PARITY 0x000000ff #define C_PR_DISCARD 0x00000100 /* discard char with frame/par error */ #define C_PR_IGNORE 0x00000200 /* ignore frame/par error */ /* comm_data_l - data length and stop bits */ #define C_DL_CS5 0x00000001 #define C_DL_CS6 0x00000002 #define C_DL_CS7 0x00000004 #define C_DL_CS8 0x00000008 #define C_DL_CS 0x0000000f #define C_DL_1STOP 0x00000010 #define C_DL_15STOP 0x00000020 #define C_DL_2STOP 0x00000040 #define C_DL_STOP 0x000000f0 /* interrupt enabling/status */ #define C_IN_DISABLE 0x00000000 /* zero, disable interrupts */ #define C_IN_TXBEMPTY 0x00000001 /* tx buffer empty */ #define C_IN_TXLOWWM 0x00000002 /* tx buffer below LWM */ #define C_IN_RXHIWM 0x00000010 /* rx buffer above HWM */ #define C_IN_RXNNDT 0x00000020 /* rx no new data timeout */ #define C_IN_MDCD 0x00000100 /* modem DCD change */ #define C_IN_MDSR 0x00000200 /* modem DSR change */ #define C_IN_MRI 0x00000400 /* modem RI change */ #define C_IN_MCTS 0x00000800 /* modem CTS change */ #define C_IN_RXBRK 0x00001000 /* Break received */ #define C_IN_PR_ERROR 0x00002000 /* parity error */ #define C_IN_FR_ERROR 0x00004000 /* frame error */ #define C_IN_OVR_ERROR 0x00008000 /* overrun error */ #define C_IN_RXOFL 0x00010000 /* RX buffer overflow */ #define C_IN_IOCTLW 0x00020000 /* I/O control w/ wait */ #define C_IN_MRTS 0x00040000 /* modem RTS drop */ #define C_IN_ICHAR 0x00080000 /* flow control */ #define C_FL_OXX 0x00000001 /* output Xon/Xoff flow control */ #define C_FL_IXX 0x00000002 /* output Xon/Xoff flow control */ #define C_FL_OIXANY 0x00000004 /* output Xon/Xoff (any xon) */ #define C_FL_SWFLOW 0x0000000f /* flow status */ #define C_FS_TXIDLE 0x00000000 /* no Tx data in the buffer or UART */ #define C_FS_SENDING 0x00000001 /* UART is sending data */ #define C_FS_SWFLOW 0x00000002 /* Tx is stopped by received Xoff */ /* rs_control/rs_status RS-232 signals */ #define C_RS_PARAM 0x80000000 /* Indicates presence of parameter in IOCTLM command */ #define C_RS_RTS 0x00000001 /* RTS */ #define C_RS_DTR 0x00000004 /* DTR */ #define C_RS_DCD 0x00000100 /* CD */ #define C_RS_DSR 0x00000200 /* DSR */ #define C_RS_RI 0x00000400 /* RI */ #define C_RS_CTS 0x00000800 /* CTS */ /* commands Host <-> Board */ #define C_CM_RESET 0x01 /* reset/flush buffers */ #define C_CM_IOCTL 0x02 /* re-read CH_CTRL */ #define C_CM_IOCTLW 0x03 /* re-read CH_CTRL, intr when done */ #define C_CM_IOCTLM 0x04 /* RS-232 outputs change */ #define C_CM_SENDXOFF 0x10 /* send Xoff */ #define C_CM_SENDXON 0x11 /* send Xon */ #define C_CM_CLFLOW 0x12 /* Clear flow control (resume) */ #define C_CM_SENDBRK 0x41 /* send break */ #define C_CM_INTBACK 0x42 /* Interrupt back */ #define C_CM_SET_BREAK 0x43 /* Tx break on */ #define C_CM_CLR_BREAK 0x44 /* Tx break off */ #define C_CM_CMD_DONE 0x45 /* Previous command done */ #define C_CM_INTBACK2 0x46 /* Alternate Interrupt back */ #define C_CM_TINACT 0x51 /* set inactivity detection */ #define C_CM_IRQ_ENBL 0x52 /* enable generation of interrupts */ #define C_CM_IRQ_DSBL 0x53 /* disable generation of interrupts */ #define C_CM_ACK_ENBL 0x54 /* enable acknowledged interrupt mode */ #define C_CM_ACK_DSBL 0x55 /* disable acknowledged intr mode */ #define C_CM_FLUSH_RX 0x56 /* flushes Rx buffer */ #define C_CM_FLUSH_TX 0x57 /* flushes Tx buffer */ #define C_CM_Q_ENABLE 0x58 /* enables queue access from the driver */ #define C_CM_Q_DISABLE 0x59 /* disables queue access from the driver */ #define C_CM_TXBEMPTY 0x60 /* Tx buffer is empty */ #define C_CM_TXLOWWM 0x61 /* Tx buffer low water mark */ #define C_CM_RXHIWM 0x62 /* Rx buffer high water mark */ #define C_CM_RXNNDT 0x63 /* rx no new data timeout */ #define C_CM_TXFEMPTY 0x64 #define C_CM_ICHAR 0x65 #define C_CM_MDCD 0x70 /* modem DCD change */ #define C_CM_MDSR 0x71 /* modem DSR change */ #define C_CM_MRI 0x72 /* modem RI change */ #define C_CM_MCTS 0x73 /* modem CTS change */ #define C_CM_MRTS 0x74 /* modem RTS drop */ #define C_CM_RXBRK 0x84 /* Break received */ #define C_CM_PR_ERROR 0x85 /* Parity error */ #define C_CM_FR_ERROR 0x86 /* Frame error */ #define C_CM_OVR_ERROR 0x87 /* Overrun error */ #define C_CM_RXOFL 0x88 /* RX buffer overflow */ #define C_CM_CMDERROR 0x90 /* command error */ #define C_CM_FATAL 0x91 /* fatal error */ #define C_CM_HW_RESET 0x92 /* reset board */ /* * CH_CTRL - This per port structure contains all parameters * that control an specific port. It can be seen as the * configuration registers of a "super-serial-controller". */ struct CH_CTRL { __u32 op_mode; /* operation mode */ __u32 intr_enable; /* interrupt masking */ __u32 sw_flow; /* SW flow control */ __u32 flow_status; /* output flow status */ __u32 comm_baud; /* baud rate - numerically specified */ __u32 comm_parity; /* parity */ __u32 comm_data_l; /* data length/stop */ __u32 comm_flags; /* other flags */ __u32 hw_flow; /* HW flow control */ __u32 rs_control; /* RS-232 outputs */ __u32 rs_status; /* RS-232 inputs */ __u32 flow_xon; /* xon char */ __u32 flow_xoff; /* xoff char */ __u32 hw_overflow; /* hw overflow counter */ __u32 sw_overflow; /* sw overflow counter */ __u32 comm_error; /* frame/parity error counter */ __u32 ichar; __u32 filler[7]; }; /* * BUF_CTRL - This per channel structure contains * all Tx and Rx buffer control for a given channel. */ struct BUF_CTRL { __u32 flag_dma; /* buffers are in Host memory */ __u32 tx_bufaddr; /* address of the tx buffer */ __u32 tx_bufsize; /* tx buffer size */ __u32 tx_threshold; /* tx low water mark */ __u32 tx_get; /* tail index tx buf */ __u32 tx_put; /* head index tx buf */ __u32 rx_bufaddr; /* address of the rx buffer */ __u32 rx_bufsize; /* rx buffer size */ __u32 rx_threshold; /* rx high water mark */ __u32 rx_get; /* tail index rx buf */ __u32 rx_put; /* head index rx buf */ __u32 filler[5]; /* filler to align structures */ }; /* * BOARD_CTRL - This per board structure contains all global * control fields related to the board. */ struct BOARD_CTRL { /* static info provided by the on-board CPU */ __u32 n_channel; /* number of channels */ __u32 fw_version; /* firmware version */ /* static info provided by the driver */ __u32 op_system; /* op_system id */ __u32 dr_version; /* driver version */ /* board control area */ __u32 inactivity; /* inactivity control */ /* host to FW commands */ __u32 hcmd_channel; /* channel number */ __u32 hcmd_param; /* pointer to parameters */ /* FW to Host commands */ __u32 fwcmd_channel; /* channel number */ __u32 fwcmd_param; /* pointer to parameters */ __u32 zf_int_queue_addr; /* offset for INT_QUEUE structure */ /* filler so the structures are aligned */ __u32 filler[6]; }; /* Host Interrupt Queue */ #define QUEUE_SIZE (10*MAX_CHAN) struct INT_QUEUE { unsigned char intr_code[QUEUE_SIZE]; unsigned long channel[QUEUE_SIZE]; unsigned long param[QUEUE_SIZE]; unsigned long put; unsigned long get; }; /* * ZFW_CTRL - This is the data structure that includes all other * data structures used by the Firmware. */ struct ZFW_CTRL { struct BOARD_CTRL board_ctrl; struct CH_CTRL ch_ctrl[MAX_CHAN]; struct BUF_CTRL buf_ctrl[MAX_CHAN]; }; /****************** ****************** *******************/ #endif #endif /* _LINUX_CYCLADES_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/parport.h�������������������������������������������������������������������������������������0000644�����������������00000007074�14763166027�0007567 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Any part of this program may be used in documents licensed under * the GNU Free Documentation License, Version 1.1 or any later version * published by the Free Software Foundation. */ #ifndef _PARPORT_H_ #define _PARPORT_H_ /* Start off with user-visible constants */ /* Maximum of 16 ports per machine */ #define PARPORT_MAX 16 /* Magic numbers */ #define PARPORT_IRQ_NONE -1 #define PARPORT_DMA_NONE -1 #define PARPORT_IRQ_AUTO -2 #define PARPORT_DMA_AUTO -2 #define PARPORT_DMA_NOFIFO -3 #define PARPORT_DISABLE -2 #define PARPORT_IRQ_PROBEONLY -3 #define PARPORT_IOHI_AUTO -1 #define PARPORT_CONTROL_STROBE 0x1 #define PARPORT_CONTROL_AUTOFD 0x2 #define PARPORT_CONTROL_INIT 0x4 #define PARPORT_CONTROL_SELECT 0x8 #define PARPORT_STATUS_ERROR 0x8 #define PARPORT_STATUS_SELECT 0x10 #define PARPORT_STATUS_PAPEROUT 0x20 #define PARPORT_STATUS_ACK 0x40 #define PARPORT_STATUS_BUSY 0x80 /* Type classes for Plug-and-Play probe. */ typedef enum { PARPORT_CLASS_LEGACY = 0, /* Non-IEEE1284 device */ PARPORT_CLASS_PRINTER, PARPORT_CLASS_MODEM, PARPORT_CLASS_NET, PARPORT_CLASS_HDC, /* Hard disk controller */ PARPORT_CLASS_PCMCIA, PARPORT_CLASS_MEDIA, /* Multimedia device */ PARPORT_CLASS_FDC, /* Floppy disk controller */ PARPORT_CLASS_PORTS, PARPORT_CLASS_SCANNER, PARPORT_CLASS_DIGCAM, PARPORT_CLASS_OTHER, /* Anything else */ PARPORT_CLASS_UNSPEC, /* No CLS field in ID */ PARPORT_CLASS_SCSIADAPTER } parport_device_class; /* The "modes" entry in parport is a bit field representing the capabilities of the hardware. */ #define PARPORT_MODE_PCSPP (1<<0) /* IBM PC registers available. */ #define PARPORT_MODE_TRISTATE (1<<1) /* Can tristate. */ #define PARPORT_MODE_EPP (1<<2) /* Hardware EPP. */ #define PARPORT_MODE_ECP (1<<3) /* Hardware ECP. */ #define PARPORT_MODE_COMPAT (1<<4) /* Hardware 'printer protocol'. */ #define PARPORT_MODE_DMA (1<<5) /* Hardware can DMA. */ #define PARPORT_MODE_SAFEININT (1<<6) /* SPP registers accessible in IRQ. */ /* IEEE1284 modes: Nibble mode, byte mode, ECP, ECPRLE and EPP are their own 'extensibility request' values. Others are special. 'Real' ECP modes must have the IEEE1284_MODE_ECP bit set. */ #define IEEE1284_MODE_NIBBLE 0 #define IEEE1284_MODE_BYTE (1<<0) #define IEEE1284_MODE_COMPAT (1<<8) #define IEEE1284_MODE_BECP (1<<9) /* Bounded ECP mode */ #define IEEE1284_MODE_ECP (1<<4) #define IEEE1284_MODE_ECPRLE (IEEE1284_MODE_ECP | (1<<5)) #define IEEE1284_MODE_ECPSWE (1<<10) /* Software-emulated */ #define IEEE1284_MODE_EPP (1<<6) #define IEEE1284_MODE_EPPSL (1<<11) /* EPP 1.7 */ #define IEEE1284_MODE_EPPSWE (1<<12) /* Software-emulated */ #define IEEE1284_DEVICEID (1<<2) /* This is a flag */ #define IEEE1284_EXT_LINK (1<<14) /* This flag causes the * extensibility link to * be requested, using * bits 0-6. */ /* For the benefit of parport_read/write, you can use these with * parport_negotiate to use address operations. They have no effect * other than to make parport_read/write use address transfers. */ #define IEEE1284_ADDR (1<<13) /* This is a flag */ #define IEEE1284_DATA 0 /* So is this */ /* Flags for block transfer operations. */ #define PARPORT_EPP_FAST (1<<0) /* Unreliable counts. */ #define PARPORT_W91284PIC (1<<1) /* have a Warp9 w91284pic in the device */ /* The rest is for the kernel only */ #endif /* _PARPORT_H_ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/pkt_sched.h�����������������������������������������������������������������������������������0000644�����������������00000060421�14763166027�0010037 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_PKT_SCHED_H #define __LINUX_PKT_SCHED_H #include <linux/types.h> /* Logical priority bands not depending on specific packet scheduler. Every scheduler will map them to real traffic classes, if it has no more precise mechanism to classify packets. These numbers have no special meaning, though their coincidence with obsolete IPv6 values is not occasional :-). New IPv6 drafts preferred full anarchy inspired by diffserv group. Note: TC_PRIO_BESTEFFORT does not mean that it is the most unhappy class, actually, as rule it will be handled with more care than filler or even bulk. */ #define TC_PRIO_BESTEFFORT 0 #define TC_PRIO_FILLER 1 #define TC_PRIO_BULK 2 #define TC_PRIO_INTERACTIVE_BULK 4 #define TC_PRIO_INTERACTIVE 6 #define TC_PRIO_CONTROL 7 #define TC_PRIO_MAX 15 /* Generic queue statistics, available for all the elements. Particular schedulers may have also their private records. */ struct tc_stats { __u64 bytes; /* Number of enqueued bytes */ __u32 packets; /* Number of enqueued packets */ __u32 drops; /* Packets dropped because of lack of resources */ __u32 overlimits; /* Number of throttle events when this * flow goes out of allocated bandwidth */ __u32 bps; /* Current flow byte rate */ __u32 pps; /* Current flow packet rate */ __u32 qlen; __u32 backlog; }; struct tc_estimator { signed char interval; unsigned char ewma_log; }; /* "Handles" --------- All the traffic control objects have 32bit identifiers, or "handles". They can be considered as opaque numbers from user API viewpoint, but actually they always consist of two fields: major and minor numbers, which are interpreted by kernel specially, that may be used by applications, though not recommended. F.e. qdisc handles always have minor number equal to zero, classes (or flows) have major equal to parent qdisc major, and minor uniquely identifying class inside qdisc. Macros to manipulate handles: */ #define TC_H_MAJ_MASK (0xFFFF0000U) #define TC_H_MIN_MASK (0x0000FFFFU) #define TC_H_MAJ(h) ((h)&TC_H_MAJ_MASK) #define TC_H_MIN(h) ((h)&TC_H_MIN_MASK) #define TC_H_MAKE(maj,min) (((maj)&TC_H_MAJ_MASK)|((min)&TC_H_MIN_MASK)) #define TC_H_UNSPEC (0U) #define TC_H_ROOT (0xFFFFFFFFU) #define TC_H_INGRESS (0xFFFFFFF1U) #define TC_H_CLSACT TC_H_INGRESS #define TC_H_MIN_PRIORITY 0xFFE0U #define TC_H_MIN_INGRESS 0xFFF2U #define TC_H_MIN_EGRESS 0xFFF3U /* Need to corrospond to iproute2 tc/tc_core.h "enum link_layer" */ enum tc_link_layer { TC_LINKLAYER_UNAWARE, /* Indicate unaware old iproute2 util */ TC_LINKLAYER_ETHERNET, TC_LINKLAYER_ATM, }; #define TC_LINKLAYER_MASK 0x0F /* limit use to lower 4 bits */ struct tc_ratespec { unsigned char cell_log; __u8 linklayer; /* lower 4 bits */ unsigned short overhead; short cell_align; unsigned short mpu; __u32 rate; }; #define TC_RTAB_SIZE 1024 struct tc_sizespec { unsigned char cell_log; unsigned char size_log; short cell_align; int overhead; unsigned int linklayer; unsigned int mpu; unsigned int mtu; unsigned int tsize; }; enum { TCA_STAB_UNSPEC, TCA_STAB_BASE, TCA_STAB_DATA, __TCA_STAB_MAX }; #define TCA_STAB_MAX (__TCA_STAB_MAX - 1) /* FIFO section */ struct tc_fifo_qopt { __u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */ }; /* SKBPRIO section */ /* * Priorities go from zero to (SKBPRIO_MAX_PRIORITY - 1). * SKBPRIO_MAX_PRIORITY should be at least 64 in order for skbprio to be able * to map one to one the DS field of IPV4 and IPV6 headers. * Memory allocation grows linearly with SKBPRIO_MAX_PRIORITY. */ #define SKBPRIO_MAX_PRIORITY 64 struct tc_skbprio_qopt { __u32 limit; /* Queue length in packets. */ }; /* PRIO section */ #define TCQ_PRIO_BANDS 16 #define TCQ_MIN_PRIO_BANDS 2 struct tc_prio_qopt { int bands; /* Number of bands */ __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ }; /* MULTIQ section */ struct tc_multiq_qopt { __u16 bands; /* Number of bands */ __u16 max_bands; /* Maximum number of queues */ }; /* PLUG section */ #define TCQ_PLUG_BUFFER 0 #define TCQ_PLUG_RELEASE_ONE 1 #define TCQ_PLUG_RELEASE_INDEFINITE 2 #define TCQ_PLUG_LIMIT 3 struct tc_plug_qopt { /* TCQ_PLUG_BUFFER: Inset a plug into the queue and * buffer any incoming packets * TCQ_PLUG_RELEASE_ONE: Dequeue packets from queue head * to beginning of the next plug. * TCQ_PLUG_RELEASE_INDEFINITE: Dequeue all packets from queue. * Stop buffering packets until the next TCQ_PLUG_BUFFER * command is received (just act as a pass-thru queue). * TCQ_PLUG_LIMIT: Increase/decrease queue size */ int action; __u32 limit; }; /* TBF section */ struct tc_tbf_qopt { struct tc_ratespec rate; struct tc_ratespec peakrate; __u32 limit; __u32 buffer; __u32 mtu; }; enum { TCA_TBF_UNSPEC, TCA_TBF_PARMS, TCA_TBF_RTAB, TCA_TBF_PTAB, TCA_TBF_RATE64, TCA_TBF_PRATE64, TCA_TBF_BURST, TCA_TBF_PBURST, TCA_TBF_PAD, __TCA_TBF_MAX, }; #define TCA_TBF_MAX (__TCA_TBF_MAX - 1) /* TEQL section */ /* TEQL does not require any parameters */ /* SFQ section */ struct tc_sfq_qopt { unsigned quantum; /* Bytes per round allocated to flow */ int perturb_period; /* Period of hash perturbation */ __u32 limit; /* Maximal packets in queue */ unsigned divisor; /* Hash divisor */ unsigned flows; /* Maximal number of flows */ }; struct tc_sfqred_stats { __u32 prob_drop; /* Early drops, below max threshold */ __u32 forced_drop; /* Early drops, after max threshold */ __u32 prob_mark; /* Marked packets, below max threshold */ __u32 forced_mark; /* Marked packets, after max threshold */ __u32 prob_mark_head; /* Marked packets, below max threshold */ __u32 forced_mark_head;/* Marked packets, after max threshold */ }; struct tc_sfq_qopt_v1 { struct tc_sfq_qopt v0; unsigned int depth; /* max number of packets per flow */ unsigned int headdrop; /* SFQRED parameters */ __u32 limit; /* HARD maximal flow queue length (bytes) */ __u32 qth_min; /* Min average length threshold (bytes) */ __u32 qth_max; /* Max average length threshold (bytes) */ unsigned char Wlog; /* log(W) */ unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ unsigned char Scell_log; /* cell size for idle damping */ unsigned char flags; __u32 max_P; /* probability, high resolution */ /* SFQRED stats */ struct tc_sfqred_stats stats; }; struct tc_sfq_xstats { __s32 allot; }; /* RED section */ enum { TCA_RED_UNSPEC, TCA_RED_PARMS, TCA_RED_STAB, TCA_RED_MAX_P, __TCA_RED_MAX, }; #define TCA_RED_MAX (__TCA_RED_MAX - 1) struct tc_red_qopt { __u32 limit; /* HARD maximal queue length (bytes) */ __u32 qth_min; /* Min average length threshold (bytes) */ __u32 qth_max; /* Max average length threshold (bytes) */ unsigned char Wlog; /* log(W) */ unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ unsigned char Scell_log; /* cell size for idle damping */ unsigned char flags; #define TC_RED_ECN 1 #define TC_RED_HARDDROP 2 #define TC_RED_ADAPTATIVE 4 }; struct tc_red_xstats { __u32 early; /* Early drops */ __u32 pdrop; /* Drops due to queue limits */ __u32 other; /* Drops due to drop() calls */ __u32 marked; /* Marked packets */ }; /* GRED section */ #define MAX_DPs 16 enum { TCA_GRED_UNSPEC, TCA_GRED_PARMS, TCA_GRED_STAB, TCA_GRED_DPS, TCA_GRED_MAX_P, TCA_GRED_LIMIT, __TCA_GRED_MAX, }; #define TCA_GRED_MAX (__TCA_GRED_MAX - 1) struct tc_gred_qopt { __u32 limit; /* HARD maximal queue length (bytes) */ __u32 qth_min; /* Min average length threshold (bytes) */ __u32 qth_max; /* Max average length threshold (bytes) */ __u32 DP; /* up to 2^32 DPs */ __u32 backlog; __u32 qave; __u32 forced; __u32 early; __u32 other; __u32 pdrop; __u8 Wlog; /* log(W) */ __u8 Plog; /* log(P_max/(qth_max-qth_min)) */ __u8 Scell_log; /* cell size for idle damping */ __u8 prio; /* prio of this VQ */ __u32 packets; __u32 bytesin; }; /* gred setup */ struct tc_gred_sopt { __u32 DPs; __u32 def_DP; __u8 grio; __u8 flags; __u16 pad1; }; /* CHOKe section */ enum { TCA_CHOKE_UNSPEC, TCA_CHOKE_PARMS, TCA_CHOKE_STAB, TCA_CHOKE_MAX_P, __TCA_CHOKE_MAX, }; #define TCA_CHOKE_MAX (__TCA_CHOKE_MAX - 1) struct tc_choke_qopt { __u32 limit; /* Hard queue length (packets) */ __u32 qth_min; /* Min average threshold (packets) */ __u32 qth_max; /* Max average threshold (packets) */ unsigned char Wlog; /* log(W) */ unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ unsigned char Scell_log; /* cell size for idle damping */ unsigned char flags; /* see RED flags */ }; struct tc_choke_xstats { __u32 early; /* Early drops */ __u32 pdrop; /* Drops due to queue limits */ __u32 other; /* Drops due to drop() calls */ __u32 marked; /* Marked packets */ __u32 matched; /* Drops due to flow match */ }; /* HTB section */ #define TC_HTB_NUMPRIO 8 #define TC_HTB_MAXDEPTH 8 #define TC_HTB_PROTOVER 3 /* the same as HTB and TC's major */ struct tc_htb_opt { struct tc_ratespec rate; struct tc_ratespec ceil; __u32 buffer; __u32 cbuffer; __u32 quantum; __u32 level; /* out only */ __u32 prio; }; struct tc_htb_glob { __u32 version; /* to match HTB/TC */ __u32 rate2quantum; /* bps->quantum divisor */ __u32 defcls; /* default class number */ __u32 debug; /* debug flags */ /* stats */ __u32 direct_pkts; /* count of non shaped packets */ }; enum { TCA_HTB_UNSPEC, TCA_HTB_PARMS, TCA_HTB_INIT, TCA_HTB_CTAB, TCA_HTB_RTAB, TCA_HTB_DIRECT_QLEN, TCA_HTB_RATE64, TCA_HTB_CEIL64, TCA_HTB_PAD, __TCA_HTB_MAX, }; #define TCA_HTB_MAX (__TCA_HTB_MAX - 1) struct tc_htb_xstats { __u32 lends; __u32 borrows; __u32 giants; /* too big packets (rate will not be accurate) */ __u32 tokens; __u32 ctokens; }; /* HFSC section */ struct tc_hfsc_qopt { __u16 defcls; /* default class */ }; struct tc_service_curve { __u32 m1; /* slope of the first segment in bps */ __u32 d; /* x-projection of the first segment in us */ __u32 m2; /* slope of the second segment in bps */ }; struct tc_hfsc_stats { __u64 work; /* total work done */ __u64 rtwork; /* work done by real-time criteria */ __u32 period; /* current period */ __u32 level; /* class level in hierarchy */ }; enum { TCA_HFSC_UNSPEC, TCA_HFSC_RSC, TCA_HFSC_FSC, TCA_HFSC_USC, __TCA_HFSC_MAX, }; #define TCA_HFSC_MAX (__TCA_HFSC_MAX - 1) /* CBQ section */ #define TC_CBQ_MAXPRIO 8 #define TC_CBQ_MAXLEVEL 8 #define TC_CBQ_DEF_EWMA 5 struct tc_cbq_lssopt { unsigned char change; unsigned char flags; #define TCF_CBQ_LSS_BOUNDED 1 #define TCF_CBQ_LSS_ISOLATED 2 unsigned char ewma_log; unsigned char level; #define TCF_CBQ_LSS_FLAGS 1 #define TCF_CBQ_LSS_EWMA 2 #define TCF_CBQ_LSS_MAXIDLE 4 #define TCF_CBQ_LSS_MINIDLE 8 #define TCF_CBQ_LSS_OFFTIME 0x10 #define TCF_CBQ_LSS_AVPKT 0x20 __u32 maxidle; __u32 minidle; __u32 offtime; __u32 avpkt; }; struct tc_cbq_wrropt { unsigned char flags; unsigned char priority; unsigned char cpriority; unsigned char __reserved; __u32 allot; __u32 weight; }; struct tc_cbq_ovl { unsigned char strategy; #define TC_CBQ_OVL_CLASSIC 0 #define TC_CBQ_OVL_DELAY 1 #define TC_CBQ_OVL_LOWPRIO 2 #define TC_CBQ_OVL_DROP 3 #define TC_CBQ_OVL_RCLASSIC 4 unsigned char priority2; __u16 pad; __u32 penalty; }; struct tc_cbq_police { unsigned char police; unsigned char __res1; unsigned short __res2; }; struct tc_cbq_fopt { __u32 split; __u32 defmap; __u32 defchange; }; struct tc_cbq_xstats { __u32 borrows; __u32 overactions; __s32 avgidle; __s32 undertime; }; enum { TCA_CBQ_UNSPEC, TCA_CBQ_LSSOPT, TCA_CBQ_WRROPT, TCA_CBQ_FOPT, TCA_CBQ_OVL_STRATEGY, TCA_CBQ_RATE, TCA_CBQ_RTAB, TCA_CBQ_POLICE, __TCA_CBQ_MAX, }; #define TCA_CBQ_MAX (__TCA_CBQ_MAX - 1) /* dsmark section */ enum { TCA_DSMARK_UNSPEC, TCA_DSMARK_INDICES, TCA_DSMARK_DEFAULT_INDEX, TCA_DSMARK_SET_TC_INDEX, TCA_DSMARK_MASK, TCA_DSMARK_VALUE, __TCA_DSMARK_MAX, }; #define TCA_DSMARK_MAX (__TCA_DSMARK_MAX - 1) /* ATM section */ enum { TCA_ATM_UNSPEC, TCA_ATM_FD, /* file/socket descriptor */ TCA_ATM_PTR, /* pointer to descriptor - later */ TCA_ATM_HDR, /* LL header */ TCA_ATM_EXCESS, /* excess traffic class (0 for CLP) */ TCA_ATM_ADDR, /* PVC address (for output only) */ TCA_ATM_STATE, /* VC state (ATM_VS_*; for output only) */ __TCA_ATM_MAX, }; #define TCA_ATM_MAX (__TCA_ATM_MAX - 1) /* Network emulator */ enum { TCA_NETEM_UNSPEC, TCA_NETEM_CORR, TCA_NETEM_DELAY_DIST, TCA_NETEM_REORDER, TCA_NETEM_CORRUPT, TCA_NETEM_LOSS, TCA_NETEM_RATE, TCA_NETEM_ECN, TCA_NETEM_RATE64, TCA_NETEM_PAD, TCA_NETEM_LATENCY64, TCA_NETEM_JITTER64, TCA_NETEM_SLOT, TCA_NETEM_SLOT_DIST, __TCA_NETEM_MAX, }; #define TCA_NETEM_MAX (__TCA_NETEM_MAX - 1) struct tc_netem_qopt { __u32 latency; /* added delay (us) */ __u32 limit; /* fifo limit (packets) */ __u32 loss; /* random packet loss (0=none ~0=100%) */ __u32 gap; /* re-ordering gap (0 for none) */ __u32 duplicate; /* random packet dup (0=none ~0=100%) */ __u32 jitter; /* random jitter in latency (us) */ }; struct tc_netem_corr { __u32 delay_corr; /* delay correlation */ __u32 loss_corr; /* packet loss correlation */ __u32 dup_corr; /* duplicate correlation */ }; struct tc_netem_reorder { __u32 probability; __u32 correlation; }; struct tc_netem_corrupt { __u32 probability; __u32 correlation; }; struct tc_netem_rate { __u32 rate; /* byte/s */ __s32 packet_overhead; __u32 cell_size; __s32 cell_overhead; }; struct tc_netem_slot { __s64 min_delay; /* nsec */ __s64 max_delay; __s32 max_packets; __s32 max_bytes; __s64 dist_delay; /* nsec */ __s64 dist_jitter; /* nsec */ }; enum { NETEM_LOSS_UNSPEC, NETEM_LOSS_GI, /* General Intuitive - 4 state model */ NETEM_LOSS_GE, /* Gilbert Elliot models */ __NETEM_LOSS_MAX }; #define NETEM_LOSS_MAX (__NETEM_LOSS_MAX - 1) /* State transition probabilities for 4 state model */ struct tc_netem_gimodel { __u32 p13; __u32 p31; __u32 p32; __u32 p14; __u32 p23; }; /* Gilbert-Elliot models */ struct tc_netem_gemodel { __u32 p; __u32 r; __u32 h; __u32 k1; }; #define NETEM_DIST_SCALE 8192 #define NETEM_DIST_MAX 16384 /* DRR */ enum { TCA_DRR_UNSPEC, TCA_DRR_QUANTUM, __TCA_DRR_MAX }; #define TCA_DRR_MAX (__TCA_DRR_MAX - 1) struct tc_drr_stats { __u32 deficit; }; /* MQPRIO */ #define TC_QOPT_BITMASK 15 #define TC_QOPT_MAX_QUEUE 16 enum { TC_MQPRIO_HW_OFFLOAD_NONE, /* no offload requested */ TC_MQPRIO_HW_OFFLOAD_TCS, /* offload TCs, no queue counts */ __TC_MQPRIO_HW_OFFLOAD_MAX }; #define TC_MQPRIO_HW_OFFLOAD_MAX (__TC_MQPRIO_HW_OFFLOAD_MAX - 1) enum { TC_MQPRIO_MODE_DCB, TC_MQPRIO_MODE_CHANNEL, __TC_MQPRIO_MODE_MAX }; #define __TC_MQPRIO_MODE_MAX (__TC_MQPRIO_MODE_MAX - 1) enum { TC_MQPRIO_SHAPER_DCB, TC_MQPRIO_SHAPER_BW_RATE, /* Add new shapers below */ __TC_MQPRIO_SHAPER_MAX }; #define __TC_MQPRIO_SHAPER_MAX (__TC_MQPRIO_SHAPER_MAX - 1) struct tc_mqprio_qopt { __u8 num_tc; __u8 prio_tc_map[TC_QOPT_BITMASK + 1]; __u8 hw; __u16 count[TC_QOPT_MAX_QUEUE]; __u16 offset[TC_QOPT_MAX_QUEUE]; }; #define TC_MQPRIO_F_MODE 0x1 #define TC_MQPRIO_F_SHAPER 0x2 #define TC_MQPRIO_F_MIN_RATE 0x4 #define TC_MQPRIO_F_MAX_RATE 0x8 enum { TCA_MQPRIO_UNSPEC, TCA_MQPRIO_MODE, TCA_MQPRIO_SHAPER, TCA_MQPRIO_MIN_RATE64, TCA_MQPRIO_MAX_RATE64, __TCA_MQPRIO_MAX, }; #define TCA_MQPRIO_MAX (__TCA_MQPRIO_MAX - 1) /* SFB */ enum { TCA_SFB_UNSPEC, TCA_SFB_PARMS, __TCA_SFB_MAX, }; #define TCA_SFB_MAX (__TCA_SFB_MAX - 1) /* * Note: increment, decrement are Q0.16 fixed-point values. */ struct tc_sfb_qopt { __u32 rehash_interval; /* delay between hash move, in ms */ __u32 warmup_time; /* double buffering warmup time in ms (warmup_time < rehash_interval) */ __u32 max; /* max len of qlen_min */ __u32 bin_size; /* maximum queue length per bin */ __u32 increment; /* probability increment, (d1 in Blue) */ __u32 decrement; /* probability decrement, (d2 in Blue) */ __u32 limit; /* max SFB queue length */ __u32 penalty_rate; /* inelastic flows are rate limited to 'rate' pps */ __u32 penalty_burst; }; struct tc_sfb_xstats { __u32 earlydrop; __u32 penaltydrop; __u32 bucketdrop; __u32 queuedrop; __u32 childdrop; /* drops in child qdisc */ __u32 marked; __u32 maxqlen; __u32 maxprob; __u32 avgprob; }; #define SFB_MAX_PROB 0xFFFF /* QFQ */ enum { TCA_QFQ_UNSPEC, TCA_QFQ_WEIGHT, TCA_QFQ_LMAX, __TCA_QFQ_MAX }; #define TCA_QFQ_MAX (__TCA_QFQ_MAX - 1) struct tc_qfq_stats { __u32 weight; __u32 lmax; }; /* CODEL */ enum { TCA_CODEL_UNSPEC, TCA_CODEL_TARGET, TCA_CODEL_LIMIT, TCA_CODEL_INTERVAL, TCA_CODEL_ECN, TCA_CODEL_CE_THRESHOLD, __TCA_CODEL_MAX }; #define TCA_CODEL_MAX (__TCA_CODEL_MAX - 1) struct tc_codel_xstats { __u32 maxpacket; /* largest packet we've seen so far */ __u32 count; /* how many drops we've done since the last time we * entered dropping state */ __u32 lastcount; /* count at entry to dropping state */ __u32 ldelay; /* in-queue delay seen by most recently dequeued packet */ __s32 drop_next; /* time to drop next packet */ __u32 drop_overlimit; /* number of time max qdisc packet limit was hit */ __u32 ecn_mark; /* number of packets we ECN marked instead of dropped */ __u32 dropping; /* are we in dropping state ? */ __u32 ce_mark; /* number of CE marked packets because of ce_threshold */ }; /* FQ_CODEL */ #define FQ_CODEL_QUANTUM_MAX (1 << 20) enum { TCA_FQ_CODEL_UNSPEC, TCA_FQ_CODEL_TARGET, TCA_FQ_CODEL_LIMIT, TCA_FQ_CODEL_INTERVAL, TCA_FQ_CODEL_ECN, TCA_FQ_CODEL_FLOWS, TCA_FQ_CODEL_QUANTUM, TCA_FQ_CODEL_CE_THRESHOLD, TCA_FQ_CODEL_DROP_BATCH_SIZE, TCA_FQ_CODEL_MEMORY_LIMIT, __TCA_FQ_CODEL_MAX }; #define TCA_FQ_CODEL_MAX (__TCA_FQ_CODEL_MAX - 1) enum { TCA_FQ_CODEL_XSTATS_QDISC, TCA_FQ_CODEL_XSTATS_CLASS, }; struct tc_fq_codel_qd_stats { __u32 maxpacket; /* largest packet we've seen so far */ __u32 drop_overlimit; /* number of time max qdisc * packet limit was hit */ __u32 ecn_mark; /* number of packets we ECN marked * instead of being dropped */ __u32 new_flow_count; /* number of time packets * created a 'new flow' */ __u32 new_flows_len; /* count of flows in new list */ __u32 old_flows_len; /* count of flows in old list */ __u32 ce_mark; /* packets above ce_threshold */ __u32 memory_usage; /* in bytes */ __u32 drop_overmemory; }; struct tc_fq_codel_cl_stats { __s32 deficit; __u32 ldelay; /* in-queue delay seen by most recently * dequeued packet */ __u32 count; __u32 lastcount; __u32 dropping; __s32 drop_next; }; struct tc_fq_codel_xstats { __u32 type; union { struct tc_fq_codel_qd_stats qdisc_stats; struct tc_fq_codel_cl_stats class_stats; }; }; /* FQ */ enum { TCA_FQ_UNSPEC, TCA_FQ_PLIMIT, /* limit of total number of packets in queue */ TCA_FQ_FLOW_PLIMIT, /* limit of packets per flow */ TCA_FQ_QUANTUM, /* RR quantum */ TCA_FQ_INITIAL_QUANTUM, /* RR quantum for new flow */ TCA_FQ_RATE_ENABLE, /* enable/disable rate limiting */ TCA_FQ_FLOW_DEFAULT_RATE,/* obsolete, do not use */ TCA_FQ_FLOW_MAX_RATE, /* per flow max rate */ TCA_FQ_BUCKETS_LOG, /* log2(number of buckets) */ TCA_FQ_FLOW_REFILL_DELAY, /* flow credit refill delay in usec */ TCA_FQ_ORPHAN_MASK, /* mask applied to orphaned skb hashes */ TCA_FQ_LOW_RATE_THRESHOLD, /* per packet delay under this rate */ __TCA_FQ_MAX }; #define TCA_FQ_MAX (__TCA_FQ_MAX - 1) struct tc_fq_qd_stats { __u64 gc_flows; __u64 highprio_packets; __u64 tcp_retrans; __u64 throttled; __u64 flows_plimit; __u64 pkts_too_long; __u64 allocation_errors; __s64 time_next_delayed_flow; __u32 flows; __u32 inactive_flows; __u32 throttled_flows; __u32 unthrottle_latency_ns; }; /* Heavy-Hitter Filter */ enum { TCA_HHF_UNSPEC, TCA_HHF_BACKLOG_LIMIT, TCA_HHF_QUANTUM, TCA_HHF_HH_FLOWS_LIMIT, TCA_HHF_RESET_TIMEOUT, TCA_HHF_ADMIT_BYTES, TCA_HHF_EVICT_TIMEOUT, TCA_HHF_NON_HH_WEIGHT, __TCA_HHF_MAX }; #define TCA_HHF_MAX (__TCA_HHF_MAX - 1) struct tc_hhf_xstats { __u32 drop_overlimit; /* number of times max qdisc packet limit * was hit */ __u32 hh_overlimit; /* number of times max heavy-hitters was hit */ __u32 hh_tot_count; /* number of captured heavy-hitters so far */ __u32 hh_cur_count; /* number of current heavy-hitters */ }; /* PIE */ enum { TCA_PIE_UNSPEC, TCA_PIE_TARGET, TCA_PIE_LIMIT, TCA_PIE_TUPDATE, TCA_PIE_ALPHA, TCA_PIE_BETA, TCA_PIE_ECN, TCA_PIE_BYTEMODE, __TCA_PIE_MAX }; #define TCA_PIE_MAX (__TCA_PIE_MAX - 1) struct tc_pie_xstats { __u32 prob; /* current probability */ __u32 delay; /* current delay in ms */ __u32 avg_dq_rate; /* current average dq_rate in bits/pie_time */ __u32 packets_in; /* total number of packets enqueued */ __u32 dropped; /* packets dropped due to pie_action */ __u32 overlimit; /* dropped due to lack of space in queue */ __u32 maxq; /* maximum queue size */ __u32 ecn_mark; /* packets marked with ecn*/ }; /* CBS */ struct tc_cbs_qopt { __u8 offload; __u8 _pad[3]; __s32 hicredit; __s32 locredit; __s32 idleslope; __s32 sendslope; }; enum { TCA_CBS_UNSPEC, TCA_CBS_PARMS, __TCA_CBS_MAX, }; #define TCA_CBS_MAX (__TCA_CBS_MAX - 1) /* ETF */ struct tc_etf_qopt { __s32 delta; __s32 clockid; __u32 flags; #define TC_ETF_DEADLINE_MODE_ON BIT(0) #define TC_ETF_OFFLOAD_ON BIT(1) }; enum { TCA_ETF_UNSPEC, TCA_ETF_PARMS, __TCA_ETF_MAX, }; #define TCA_ETF_MAX (__TCA_ETF_MAX - 1) /* CAKE */ enum { TCA_CAKE_UNSPEC, TCA_CAKE_PAD, TCA_CAKE_BASE_RATE64, TCA_CAKE_DIFFSERV_MODE, TCA_CAKE_ATM, TCA_CAKE_FLOW_MODE, TCA_CAKE_OVERHEAD, TCA_CAKE_RTT, TCA_CAKE_TARGET, TCA_CAKE_AUTORATE, TCA_CAKE_MEMORY, TCA_CAKE_NAT, TCA_CAKE_RAW, TCA_CAKE_WASH, TCA_CAKE_MPU, TCA_CAKE_INGRESS, TCA_CAKE_ACK_FILTER, TCA_CAKE_SPLIT_GSO, __TCA_CAKE_MAX }; #define TCA_CAKE_MAX (__TCA_CAKE_MAX - 1) enum { __TCA_CAKE_STATS_INVALID, TCA_CAKE_STATS_PAD, TCA_CAKE_STATS_CAPACITY_ESTIMATE64, TCA_CAKE_STATS_MEMORY_LIMIT, TCA_CAKE_STATS_MEMORY_USED, TCA_CAKE_STATS_AVG_NETOFF, TCA_CAKE_STATS_MIN_NETLEN, TCA_CAKE_STATS_MAX_NETLEN, TCA_CAKE_STATS_MIN_ADJLEN, TCA_CAKE_STATS_MAX_ADJLEN, TCA_CAKE_STATS_TIN_STATS, TCA_CAKE_STATS_DEFICIT, TCA_CAKE_STATS_COBALT_COUNT, TCA_CAKE_STATS_DROPPING, TCA_CAKE_STATS_DROP_NEXT_US, TCA_CAKE_STATS_P_DROP, TCA_CAKE_STATS_BLUE_TIMER_US, __TCA_CAKE_STATS_MAX }; #define TCA_CAKE_STATS_MAX (__TCA_CAKE_STATS_MAX - 1) enum { __TCA_CAKE_TIN_STATS_INVALID, TCA_CAKE_TIN_STATS_PAD, TCA_CAKE_TIN_STATS_SENT_PACKETS, TCA_CAKE_TIN_STATS_SENT_BYTES64, TCA_CAKE_TIN_STATS_DROPPED_PACKETS, TCA_CAKE_TIN_STATS_DROPPED_BYTES64, TCA_CAKE_TIN_STATS_ACKS_DROPPED_PACKETS, TCA_CAKE_TIN_STATS_ACKS_DROPPED_BYTES64, TCA_CAKE_TIN_STATS_ECN_MARKED_PACKETS, TCA_CAKE_TIN_STATS_ECN_MARKED_BYTES64, TCA_CAKE_TIN_STATS_BACKLOG_PACKETS, TCA_CAKE_TIN_STATS_BACKLOG_BYTES, TCA_CAKE_TIN_STATS_THRESHOLD_RATE64, TCA_CAKE_TIN_STATS_TARGET_US, TCA_CAKE_TIN_STATS_INTERVAL_US, TCA_CAKE_TIN_STATS_WAY_INDIRECT_HITS, TCA_CAKE_TIN_STATS_WAY_MISSES, TCA_CAKE_TIN_STATS_WAY_COLLISIONS, TCA_CAKE_TIN_STATS_PEAK_DELAY_US, TCA_CAKE_TIN_STATS_AVG_DELAY_US, TCA_CAKE_TIN_STATS_BASE_DELAY_US, TCA_CAKE_TIN_STATS_SPARSE_FLOWS, TCA_CAKE_TIN_STATS_BULK_FLOWS, TCA_CAKE_TIN_STATS_UNRESPONSIVE_FLOWS, TCA_CAKE_TIN_STATS_MAX_SKBLEN, TCA_CAKE_TIN_STATS_FLOW_QUANTUM, __TCA_CAKE_TIN_STATS_MAX }; #define TCA_CAKE_TIN_STATS_MAX (__TCA_CAKE_TIN_STATS_MAX - 1) #define TC_CAKE_MAX_TINS (8) enum { CAKE_FLOW_NONE = 0, CAKE_FLOW_SRC_IP, CAKE_FLOW_DST_IP, CAKE_FLOW_HOSTS, /* = CAKE_FLOW_SRC_IP | CAKE_FLOW_DST_IP */ CAKE_FLOW_FLOWS, CAKE_FLOW_DUAL_SRC, /* = CAKE_FLOW_SRC_IP | CAKE_FLOW_FLOWS */ CAKE_FLOW_DUAL_DST, /* = CAKE_FLOW_DST_IP | CAKE_FLOW_FLOWS */ CAKE_FLOW_TRIPLE, /* = CAKE_FLOW_HOSTS | CAKE_FLOW_FLOWS */ CAKE_FLOW_MAX, }; enum { CAKE_DIFFSERV_DIFFSERV3 = 0, CAKE_DIFFSERV_DIFFSERV4, CAKE_DIFFSERV_DIFFSERV8, CAKE_DIFFSERV_BESTEFFORT, CAKE_DIFFSERV_PRECEDENCE, CAKE_DIFFSERV_MAX }; enum { CAKE_ACK_NONE = 0, CAKE_ACK_FILTER, CAKE_ACK_AGGRESSIVE, CAKE_ACK_MAX }; enum { CAKE_ATM_NONE = 0, CAKE_ATM_ATM, CAKE_ATM_PTM, CAKE_ATM_MAX }; #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/vm_sockets.h����������������������������������������������������������������������������������0000644�����������������00000012302�14763166027�0010243 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * VMware vSockets Driver * * Copyright (C) 2007-2013 VMware, Inc. 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 version 2 and no 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. */ #ifndef _VM_SOCKETS_H #define _VM_SOCKETS_H #include <linux/socket.h> /* Option name for STREAM socket buffer size. Use as the option name in * setsockopt(3) or getsockopt(3) to set or get an unsigned long long that * specifies the size of the buffer underlying a vSockets STREAM socket. * Value is clamped to the MIN and MAX. */ #define SO_VM_SOCKETS_BUFFER_SIZE 0 /* Option name for STREAM socket minimum buffer size. Use as the option name * in setsockopt(3) or getsockopt(3) to set or get an unsigned long long that * specifies the minimum size allowed for the buffer underlying a vSockets * STREAM socket. */ #define SO_VM_SOCKETS_BUFFER_MIN_SIZE 1 /* Option name for STREAM socket maximum buffer size. Use as the option name * in setsockopt(3) or getsockopt(3) to set or get an unsigned long long * that specifies the maximum size allowed for the buffer underlying a * vSockets STREAM socket. */ #define SO_VM_SOCKETS_BUFFER_MAX_SIZE 2 /* Option name for socket peer's host-specific VM ID. Use as the option name * in getsockopt(3) to get a host-specific identifier for the peer endpoint's * VM. The identifier is a signed integer. * Only available for hypervisor endpoints. */ #define SO_VM_SOCKETS_PEER_HOST_VM_ID 3 /* Option name for determining if a socket is trusted. Use as the option name * in getsockopt(3) to determine if a socket is trusted. The value is a * signed integer. */ #define SO_VM_SOCKETS_TRUSTED 5 /* Option name for STREAM socket connection timeout. Use as the option name * in setsockopt(3) or getsockopt(3) to set or get the connection * timeout for a STREAM socket. */ #define SO_VM_SOCKETS_CONNECT_TIMEOUT 6 /* Option name for using non-blocking send/receive. Use as the option name * for setsockopt(3) or getsockopt(3) to set or get the non-blocking * transmit/receive flag for a STREAM socket. This flag determines whether * send() and recv() can be called in non-blocking contexts for the given * socket. The value is a signed integer. * * This option is only relevant to kernel endpoints, where descheduling the * thread of execution is not allowed, for example, while holding a spinlock. * It is not to be confused with conventional non-blocking socket operations. * * Only available for hypervisor endpoints. */ #define SO_VM_SOCKETS_NONBLOCK_TXRX 7 /* The vSocket equivalent of INADDR_ANY. This works for the svm_cid field of * sockaddr_vm and indicates the context ID of the current endpoint. */ #define VMADDR_CID_ANY -1U /* Bind to any available port. Works for the svm_port field of * sockaddr_vm. */ #define VMADDR_PORT_ANY -1U /* Use this as the destination CID in an address when referring to the * hypervisor. VMCI relies on it being 0, but this would be useful for other * transports too. */ #define VMADDR_CID_HYPERVISOR 0 /* This CID is specific to VMCI and can be considered reserved (even VMCI * doesn't use it anymore, it's a legacy value from an older release). */ #define VMADDR_CID_RESERVED 1 /* Use this as the destination CID in an address when referring to the host * (any process other than the hypervisor). VMCI relies on it being 2, but * this would be useful for other transports too. */ #define VMADDR_CID_HOST 2 /* Invalid vSockets version. */ #define VM_SOCKETS_INVALID_VERSION -1U /* The epoch (first) component of the vSockets version. A single byte * representing the epoch component of the vSockets version. */ #define VM_SOCKETS_VERSION_EPOCH(_v) (((_v) & 0xFF000000) >> 24) /* The major (second) component of the vSockets version. A single byte * representing the major component of the vSockets version. Typically * changes for every major release of a product. */ #define VM_SOCKETS_VERSION_MAJOR(_v) (((_v) & 0x00FF0000) >> 16) /* The minor (third) component of the vSockets version. Two bytes representing * the minor component of the vSockets version. */ #define VM_SOCKETS_VERSION_MINOR(_v) (((_v) & 0x0000FFFF)) /* Address structure for vSockets. The address family should be set to * AF_VSOCK. The structure members should all align on their natural * boundaries without resorting to compiler packing directives. The total size * of this structure should be exactly the same as that of struct sockaddr. */ struct sockaddr_vm { __kernel_sa_family_t svm_family; unsigned short svm_reserved1; unsigned int svm_port; unsigned int svm_cid; unsigned char svm_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - sizeof(unsigned short) - sizeof(unsigned int) - sizeof(unsigned int)]; }; #define IOCTL_VM_SOCKETS_GET_LOCAL_CID _IO(7, 0xb9) #endif /* _VM_SOCKETS_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/mman.h����������������������������������������������������������������������������������������0000644�����������������00000002472�14763166027�0007025 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_MMAN_H #define _LINUX_MMAN_H #include <asm/mman.h> #include <asm-generic/hugetlb_encode.h> #define MREMAP_MAYMOVE 1 #define MREMAP_FIXED 2 #define OVERCOMMIT_GUESS 0 #define OVERCOMMIT_ALWAYS 1 #define OVERCOMMIT_NEVER 2 /* * Huge page size encoding when MAP_HUGETLB is specified, and a huge page * size other than the default is desired. See hugetlb_encode.h. * All known huge page size encodings are provided here. It is the * responsibility of the application to know which sizes are supported on * the running system. See mmap(2) man page for details. */ #define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT #define MAP_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK #define MAP_HUGE_64KB HUGETLB_FLAG_ENCODE_64KB #define MAP_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB #define MAP_HUGE_1MB HUGETLB_FLAG_ENCODE_1MB #define MAP_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB #define MAP_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB #define MAP_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB #define MAP_HUGE_32MB HUGETLB_FLAG_ENCODE_32MB #define MAP_HUGE_256MB HUGETLB_FLAG_ENCODE_256MB #define MAP_HUGE_512MB HUGETLB_FLAG_ENCODE_512MB #define MAP_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB #define MAP_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB #define MAP_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB #endif /* _LINUX_MMAN_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/sed-opal.h������������������������������������������������������������������������������������0000644�����������������00000006313�14763166027�0007577 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright © 2016 Intel Corporation * * Authors: * Rafael Antognolli <rafael.antognolli@intel.com> * Scott Bauer <scott.bauer@intel.com> * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope 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. */ #ifndef _SED_OPAL_H #define _SED_OPAL_H #include <linux/types.h> #define OPAL_KEY_MAX 256 #define OPAL_MAX_LRS 9 enum opal_mbr { OPAL_MBR_ENABLE = 0x0, OPAL_MBR_DISABLE = 0x01, }; enum opal_user { OPAL_ADMIN1 = 0x0, OPAL_USER1 = 0x01, OPAL_USER2 = 0x02, OPAL_USER3 = 0x03, OPAL_USER4 = 0x04, OPAL_USER5 = 0x05, OPAL_USER6 = 0x06, OPAL_USER7 = 0x07, OPAL_USER8 = 0x08, OPAL_USER9 = 0x09, }; enum opal_lock_state { OPAL_RO = 0x01, /* 0001 */ OPAL_RW = 0x02, /* 0010 */ OPAL_LK = 0x04, /* 0100 */ }; struct opal_key { __u8 lr; __u8 key_len; __u8 __align[6]; __u8 key[OPAL_KEY_MAX]; }; struct opal_lr_act { struct opal_key key; __u32 sum; __u8 num_lrs; __u8 lr[OPAL_MAX_LRS]; __u8 align[2]; /* Align to 8 byte boundary */ }; struct opal_session_info { __u32 sum; __u32 who; struct opal_key opal_key; }; struct opal_user_lr_setup { __u64 range_start; __u64 range_length; __u32 RLE; /* Read Lock enabled */ __u32 WLE; /* Write Lock Enabled */ struct opal_session_info session; }; struct opal_lock_unlock { struct opal_session_info session; __u32 l_state; __u8 __align[4]; }; struct opal_new_pw { struct opal_session_info session; /* When we're not operating in sum, and we first set * passwords we need to set them via ADMIN authority. * After passwords are changed, we can set them via, * User authorities. * Because of this restriction we need to know about * Two different users. One in 'session' which we will use * to start the session and new_userr_pw as the user we're * chaning the pw for. */ struct opal_session_info new_user_pw; }; struct opal_mbr_data { struct opal_key key; __u8 enable_disable; __u8 __align[7]; }; #define IOC_OPAL_SAVE _IOW('p', 220, struct opal_lock_unlock) #define IOC_OPAL_LOCK_UNLOCK _IOW('p', 221, struct opal_lock_unlock) #define IOC_OPAL_TAKE_OWNERSHIP _IOW('p', 222, struct opal_key) #define IOC_OPAL_ACTIVATE_LSP _IOW('p', 223, struct opal_lr_act) #define IOC_OPAL_SET_PW _IOW('p', 224, struct opal_new_pw) #define IOC_OPAL_ACTIVATE_USR _IOW('p', 225, struct opal_session_info) #define IOC_OPAL_REVERT_TPR _IOW('p', 226, struct opal_key) #define IOC_OPAL_LR_SETUP _IOW('p', 227, struct opal_user_lr_setup) #define IOC_OPAL_ADD_USR_TO_LR _IOW('p', 228, struct opal_lock_unlock) #define IOC_OPAL_ENABLE_DISABLE_MBR _IOW('p', 229, struct opal_mbr_data) #define IOC_OPAL_ERASE_LR _IOW('p', 230, struct opal_session_info) #define IOC_OPAL_SECURE_ERASE_LR _IOW('p', 231, struct opal_session_info) #endif /* _SED_OPAL_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/utsname.h�������������������������������������������������������������������������������������0000644�����������������00000001235�14763166027�0007545 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_UTSNAME_H #define _LINUX_UTSNAME_H #define __OLD_UTS_LEN 8 struct oldold_utsname { char sysname[9]; char nodename[9]; char release[9]; char version[9]; char machine[9]; }; #define __NEW_UTS_LEN 64 struct old_utsname { char sysname[65]; char nodename[65]; char release[65]; char version[65]; char machine[65]; }; struct new_utsname { char sysname[__NEW_UTS_LEN + 1]; char nodename[__NEW_UTS_LEN + 1]; char release[__NEW_UTS_LEN + 1]; char version[__NEW_UTS_LEN + 1]; char machine[__NEW_UTS_LEN + 1]; char domainname[__NEW_UTS_LEN + 1]; }; #endif /* _LINUX_UTSNAME_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/ip6_tunnel.h����������������������������������������������������������������������������������0000644�����������������00000003641�14763166027�0010157 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IP6_TUNNEL_H #define _IP6_TUNNEL_H #include <linux/types.h> #include <linux/if.h> /* For IFNAMSIZ. */ #include <linux/in6.h> /* For struct in6_addr. */ #define IPV6_TLV_TNL_ENCAP_LIMIT 4 #define IPV6_DEFAULT_TNL_ENCAP_LIMIT 4 /* don't add encapsulation limit if one isn't present in inner packet */ #define IP6_TNL_F_IGN_ENCAP_LIMIT 0x1 /* copy the traffic class field from the inner packet */ #define IP6_TNL_F_USE_ORIG_TCLASS 0x2 /* copy the flowlabel from the inner packet */ #define IP6_TNL_F_USE_ORIG_FLOWLABEL 0x4 /* being used for Mobile IPv6 */ #define IP6_TNL_F_MIP6_DEV 0x8 /* copy DSCP from the outer packet */ #define IP6_TNL_F_RCV_DSCP_COPY 0x10 /* copy fwmark from inner packet */ #define IP6_TNL_F_USE_ORIG_FWMARK 0x20 /* allow remote endpoint on the local node */ #define IP6_TNL_F_ALLOW_LOCAL_REMOTE 0x40 struct ip6_tnl_parm { char name[IFNAMSIZ]; /* name of tunnel device */ int link; /* ifindex of underlying L2 interface */ __u8 proto; /* tunnel protocol */ __u8 encap_limit; /* encapsulation limit for tunnel */ __u8 hop_limit; /* hop limit for tunnel */ __be32 flowinfo; /* traffic class and flowlabel for tunnel */ __u32 flags; /* tunnel flags */ struct in6_addr laddr; /* local tunnel end-point address */ struct in6_addr raddr; /* remote tunnel end-point address */ }; struct ip6_tnl_parm2 { char name[IFNAMSIZ]; /* name of tunnel device */ int link; /* ifindex of underlying L2 interface */ __u8 proto; /* tunnel protocol */ __u8 encap_limit; /* encapsulation limit for tunnel */ __u8 hop_limit; /* hop limit for tunnel */ __be32 flowinfo; /* traffic class and flowlabel for tunnel */ __u32 flags; /* tunnel flags */ struct in6_addr laddr; /* local tunnel end-point address */ struct in6_addr raddr; /* remote tunnel end-point address */ __be16 i_flags; __be16 o_flags; __be32 i_key; __be32 o_key; }; #endif �����������������������������������������������������������������������������������������������linux/if_fddi.h�������������������������������������������������������������������������������������0000644�����������������00000007244�14763166027�0007463 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Global definitions for the ANSI FDDI interface. * * Version: @(#)if_fddi.h 1.0.2 Sep 29 2004 * * Author: Lawrence V. Stefani, <stefani@lkg.dec.com> * * if_fddi.h is based on previous if_ether.h and if_tr.h work by * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Donald Becker, <becker@super.org> * Alan Cox, <alan@lxorguk.ukuu.org.uk> * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be> * * 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. */ #ifndef _LINUX_IF_FDDI_H #define _LINUX_IF_FDDI_H #include <linux/types.h> /* * Define max and min legal sizes. The frame sizes do not include * 4 byte FCS/CRC (frame check sequence). */ #define FDDI_K_ALEN 6 /* Octets in one FDDI address */ #define FDDI_K_8022_HLEN 16 /* Total octets in 802.2 header */ #define FDDI_K_SNAP_HLEN 21 /* Total octets in 802.2 SNAP header */ #define FDDI_K_8022_ZLEN 16 /* Min octets in 802.2 frame sans FCS */ #define FDDI_K_SNAP_ZLEN 21 /* Min octets in 802.2 SNAP frame sans FCS */ #define FDDI_K_8022_DLEN 4475 /* Max octets in 802.2 payload */ #define FDDI_K_SNAP_DLEN 4470 /* Max octets in 802.2 SNAP payload */ #define FDDI_K_LLC_ZLEN 13 /* Min octets in LLC frame sans FCS */ #define FDDI_K_LLC_LEN 4491 /* Max octets in LLC frame sans FCS */ #define FDDI_K_OUI_LEN 3 /* Octets in OUI in 802.2 SNAP header */ /* Define FDDI Frame Control (FC) Byte values */ #define FDDI_FC_K_VOID 0x00 #define FDDI_FC_K_NON_RESTRICTED_TOKEN 0x80 #define FDDI_FC_K_RESTRICTED_TOKEN 0xC0 #define FDDI_FC_K_SMT_MIN 0x41 #define FDDI_FC_K_SMT_MAX 0x4F #define FDDI_FC_K_MAC_MIN 0xC1 #define FDDI_FC_K_MAC_MAX 0xCF #define FDDI_FC_K_ASYNC_LLC_MIN 0x50 #define FDDI_FC_K_ASYNC_LLC_DEF 0x54 #define FDDI_FC_K_ASYNC_LLC_MAX 0x5F #define FDDI_FC_K_SYNC_LLC_MIN 0xD0 #define FDDI_FC_K_SYNC_LLC_MAX 0xD7 #define FDDI_FC_K_IMPLEMENTOR_MIN 0x60 #define FDDI_FC_K_IMPLEMENTOR_MAX 0x6F #define FDDI_FC_K_RESERVED_MIN 0x70 #define FDDI_FC_K_RESERVED_MAX 0x7F /* Define LLC and SNAP constants */ #define FDDI_EXTENDED_SAP 0xAA #define FDDI_UI_CMD 0x03 /* Define 802.2 Type 1 header */ struct fddi_8022_1_hdr { __u8 dsap; /* destination service access point */ __u8 ssap; /* source service access point */ __u8 ctrl; /* control byte #1 */ } __attribute__((packed)); /* Define 802.2 Type 2 header */ struct fddi_8022_2_hdr { __u8 dsap; /* destination service access point */ __u8 ssap; /* source service access point */ __u8 ctrl_1; /* control byte #1 */ __u8 ctrl_2; /* control byte #2 */ } __attribute__((packed)); /* Define 802.2 SNAP header */ struct fddi_snap_hdr { __u8 dsap; /* always 0xAA */ __u8 ssap; /* always 0xAA */ __u8 ctrl; /* always 0x03 */ __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */ __be16 ethertype; /* packet type ID field */ } __attribute__((packed)); /* Define FDDI LLC frame header */ struct fddihdr { __u8 fc; /* frame control */ __u8 daddr[FDDI_K_ALEN]; /* destination address */ __u8 saddr[FDDI_K_ALEN]; /* source address */ union { struct fddi_8022_1_hdr llc_8022_1; struct fddi_8022_2_hdr llc_8022_2; struct fddi_snap_hdr llc_snap; } hdr; } __attribute__((packed)); #endif /* _LINUX_IF_FDDI_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/nbd-netlink.h���������������������������������������������������������������������������������0000644�����������������00000004512�14763166027�0010277 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2017 Facebook. 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 v2 as published by the Free Software Foundation. * * 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., 59 Temple Place - Suite 330, * Boston, MA 021110-1307, USA. */ #ifndef LINUX_NBD_NETLINK_H #define LINUX_NBD_NETLINK_H #define NBD_GENL_FAMILY_NAME "nbd" #define NBD_GENL_VERSION 0x1 #define NBD_GENL_MCAST_GROUP_NAME "nbd_mc_group" /* Configuration policy attributes, used for CONNECT */ enum { NBD_ATTR_UNSPEC, NBD_ATTR_INDEX, NBD_ATTR_SIZE_BYTES, NBD_ATTR_BLOCK_SIZE_BYTES, NBD_ATTR_TIMEOUT, NBD_ATTR_SERVER_FLAGS, NBD_ATTR_CLIENT_FLAGS, NBD_ATTR_SOCKETS, NBD_ATTR_DEAD_CONN_TIMEOUT, NBD_ATTR_DEVICE_LIST, __NBD_ATTR_MAX, }; #define NBD_ATTR_MAX (__NBD_ATTR_MAX - 1) /* * This is the format for multiple devices with NBD_ATTR_DEVICE_LIST * * [NBD_ATTR_DEVICE_LIST] * [NBD_DEVICE_ITEM] * [NBD_DEVICE_INDEX] * [NBD_DEVICE_CONNECTED] */ enum { NBD_DEVICE_ITEM_UNSPEC, NBD_DEVICE_ITEM, __NBD_DEVICE_ITEM_MAX, }; #define NBD_DEVICE_ITEM_MAX (__NBD_DEVICE_ITEM_MAX - 1) enum { NBD_DEVICE_UNSPEC, NBD_DEVICE_INDEX, NBD_DEVICE_CONNECTED, __NBD_DEVICE_MAX, }; #define NBD_DEVICE_ATTR_MAX (__NBD_DEVICE_MAX - 1) /* * This is the format for multiple sockets with NBD_ATTR_SOCKETS * * [NBD_ATTR_SOCKETS] * [NBD_SOCK_ITEM] * [NBD_SOCK_FD] * [NBD_SOCK_ITEM] * [NBD_SOCK_FD] */ enum { NBD_SOCK_ITEM_UNSPEC, NBD_SOCK_ITEM, __NBD_SOCK_ITEM_MAX, }; #define NBD_SOCK_ITEM_MAX (__NBD_SOCK_ITEM_MAX - 1) enum { NBD_SOCK_UNSPEC, NBD_SOCK_FD, __NBD_SOCK_MAX, }; #define NBD_SOCK_MAX (__NBD_SOCK_MAX - 1) enum { NBD_CMD_UNSPEC, NBD_CMD_CONNECT, NBD_CMD_DISCONNECT, NBD_CMD_RECONFIGURE, NBD_CMD_LINK_DEAD, NBD_CMD_STATUS, __NBD_CMD_MAX, }; #define NBD_CMD_MAX (__NBD_CMD_MAX - 1) #endif /* LINUX_NBD_NETLINK_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/tipc_config.h���������������������������������������������������������������������������������0000644�����������������00000035000�14763166027�0010352 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * include/uapi/linux/tipc_config.h: Header for TIPC configuration interface * * Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2005-2007, 2010-2011, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the names of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL") version 2 as published by the Free * Software Foundation. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _LINUX_TIPC_CONFIG_H_ #define _LINUX_TIPC_CONFIG_H_ #include <linux/types.h> #include <linux/string.h> #include <linux/tipc.h> #include <asm/byteorder.h> #include <arpa/inet.h> /* for ntohs etc. */ /* * Configuration * * All configuration management messaging involves sending a request message * to the TIPC configuration service on a node, which sends a reply message * back. (In the future multi-message replies may be supported.) * * Both request and reply messages consist of a transport header and payload. * The transport header contains info about the desired operation; * the payload consists of zero or more type/length/value (TLV) items * which specify parameters or results for the operation. * * For many operations, the request and reply messages have a fixed number * of TLVs (usually zero or one); however, some reply messages may return * a variable number of TLVs. A failed request is denoted by the presence * of an "error string" TLV in the reply message instead of the TLV(s) the * reply should contain if the request succeeds. */ /* * Public commands: * May be issued by any process. * Accepted by own node, or by remote node only if remote management enabled. */ #define TIPC_CMD_NOOP 0x0000 /* tx none, rx none */ #define TIPC_CMD_GET_NODES 0x0001 /* tx net_addr, rx node_info(s) */ #define TIPC_CMD_GET_MEDIA_NAMES 0x0002 /* tx none, rx media_name(s) */ #define TIPC_CMD_GET_BEARER_NAMES 0x0003 /* tx none, rx bearer_name(s) */ #define TIPC_CMD_GET_LINKS 0x0004 /* tx net_addr, rx link_info(s) */ #define TIPC_CMD_SHOW_NAME_TABLE 0x0005 /* tx name_tbl_query, rx ultra_string */ #define TIPC_CMD_SHOW_PORTS 0x0006 /* tx none, rx ultra_string */ #define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */ #define TIPC_CMD_SHOW_STATS 0x000F /* tx unsigned, rx ultra_string */ /* * Protected commands: * May only be issued by "network administration capable" process. * Accepted by own node, or by remote node only if remote management enabled * and this node is zone manager. */ #define TIPC_CMD_GET_REMOTE_MNG 0x4003 /* tx none, rx unsigned */ #define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */ #define TIPC_CMD_GET_MAX_PUBL 0x4005 /* obsoleted */ #define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* obsoleted */ #define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */ #define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */ #define TIPC_CMD_GET_MAX_NODES 0x4009 /* obsoleted */ #define TIPC_CMD_GET_MAX_SLAVES 0x400A /* obsoleted */ #define TIPC_CMD_GET_NETID 0x400B /* tx none, rx unsigned */ #define TIPC_CMD_ENABLE_BEARER 0x4101 /* tx bearer_config, rx none */ #define TIPC_CMD_DISABLE_BEARER 0x4102 /* tx bearer_name, rx none */ #define TIPC_CMD_SET_LINK_TOL 0x4107 /* tx link_config, rx none */ #define TIPC_CMD_SET_LINK_PRI 0x4108 /* tx link_config, rx none */ #define TIPC_CMD_SET_LINK_WINDOW 0x4109 /* tx link_config, rx none */ #define TIPC_CMD_SET_LOG_SIZE 0x410A /* obsoleted */ #define TIPC_CMD_DUMP_LOG 0x410B /* obsoleted */ #define TIPC_CMD_RESET_LINK_STATS 0x410C /* tx link_name, rx none */ /* * Private commands: * May only be issued by "network administration capable" process. * Accepted by own node only; cannot be used on a remote node. */ #define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */ #define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */ #define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */ #define TIPC_CMD_SET_MAX_PUBL 0x8005 /* obsoleted */ #define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* obsoleted */ #define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */ #define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */ #define TIPC_CMD_SET_MAX_NODES 0x8009 /* obsoleted */ #define TIPC_CMD_SET_MAX_SLAVES 0x800A /* obsoleted */ #define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */ /* * Reserved commands: * May not be issued by any process. * Used internally by TIPC. */ #define TIPC_CMD_NOT_NET_ADMIN 0xC001 /* tx none, rx none */ /* * TLV types defined for TIPC */ #define TIPC_TLV_NONE 0 /* no TLV present */ #define TIPC_TLV_VOID 1 /* empty TLV (0 data bytes)*/ #define TIPC_TLV_UNSIGNED 2 /* 32-bit integer */ #define TIPC_TLV_STRING 3 /* char[128] (max) */ #define TIPC_TLV_LARGE_STRING 4 /* char[2048] (max) */ #define TIPC_TLV_ULTRA_STRING 5 /* char[32768] (max) */ #define TIPC_TLV_ERROR_STRING 16 /* char[128] containing "error code" */ #define TIPC_TLV_NET_ADDR 17 /* 32-bit integer denoting <Z.C.N> */ #define TIPC_TLV_MEDIA_NAME 18 /* char[TIPC_MAX_MEDIA_NAME] */ #define TIPC_TLV_BEARER_NAME 19 /* char[TIPC_MAX_BEARER_NAME] */ #define TIPC_TLV_LINK_NAME 20 /* char[TIPC_MAX_LINK_NAME] */ #define TIPC_TLV_NODE_INFO 21 /* struct tipc_node_info */ #define TIPC_TLV_LINK_INFO 22 /* struct tipc_link_info */ #define TIPC_TLV_BEARER_CONFIG 23 /* struct tipc_bearer_config */ #define TIPC_TLV_LINK_CONFIG 24 /* struct tipc_link_config */ #define TIPC_TLV_NAME_TBL_QUERY 25 /* struct tipc_name_table_query */ #define TIPC_TLV_PORT_REF 26 /* 32-bit port reference */ /* * Link priority limits (min, default, max, media default) */ #define TIPC_MIN_LINK_PRI 0 #define TIPC_DEF_LINK_PRI 10 #define TIPC_MAX_LINK_PRI 31 #define TIPC_MEDIA_LINK_PRI (TIPC_MAX_LINK_PRI + 1) /* * Link tolerance limits (min, default, max), in ms */ #define TIPC_MIN_LINK_TOL 50 #define TIPC_DEF_LINK_TOL 1500 #define TIPC_MAX_LINK_TOL 30000 #if (TIPC_MIN_LINK_TOL < 16) #error "TIPC_MIN_LINK_TOL is too small (abort limit may be NaN)" #endif /* * Link window limits (min, default, max), in packets */ #define TIPC_MIN_LINK_WIN 16 #define TIPC_DEF_LINK_WIN 50 #define TIPC_MAX_LINK_WIN 8191 /* * Default MTU for UDP media */ #define TIPC_DEF_LINK_UDP_MTU 14000 struct tipc_node_info { __be32 addr; /* network address of node */ __be32 up; /* 0=down, 1= up */ }; struct tipc_link_info { __be32 dest; /* network address of peer node */ __be32 up; /* 0=down, 1=up */ char str[TIPC_MAX_LINK_NAME]; /* link name */ }; struct tipc_bearer_config { __be32 priority; /* Range [1,31]. Override per link */ __be32 disc_domain; /* <Z.C.N> describing desired nodes */ char name[TIPC_MAX_BEARER_NAME]; }; struct tipc_link_config { __be32 value; char name[TIPC_MAX_LINK_NAME]; }; #define TIPC_NTQ_ALLTYPES 0x80000000 struct tipc_name_table_query { __be32 depth; /* 1:type, 2:+name info, 3:+port info, 4+:+debug info */ __be32 type; /* {t,l,u} info ignored if high bit of "depth" is set */ __be32 lowbound; /* (i.e. displays all entries of name table) */ __be32 upbound; }; /* * The error string TLV is a null-terminated string describing the cause * of the request failure. To simplify error processing (and to save space) * the first character of the string can be a special error code character * (lying by the range 0x80 to 0xFF) which represents a pre-defined reason. */ #define TIPC_CFG_TLV_ERROR "\x80" /* request contains incorrect TLV(s) */ #define TIPC_CFG_NOT_NET_ADMIN "\x81" /* must be network administrator */ #define TIPC_CFG_NOT_ZONE_MSTR "\x82" /* must be zone master */ #define TIPC_CFG_NO_REMOTE "\x83" /* remote management not enabled */ #define TIPC_CFG_NOT_SUPPORTED "\x84" /* request is not supported by TIPC */ #define TIPC_CFG_INVALID_VALUE "\x85" /* request has invalid argument value */ /* * A TLV consists of a descriptor, followed by the TLV value. * TLV descriptor fields are stored in network byte order; * TLV values must also be stored in network byte order (where applicable). * TLV descriptors must be aligned to addresses which are multiple of 4, * so up to 3 bytes of padding may exist at the end of the TLV value area. * There must not be any padding between the TLV descriptor and its value. */ struct tlv_desc { __be16 tlv_len; /* TLV length (descriptor + value) */ __be16 tlv_type; /* TLV identifier */ }; #define TLV_ALIGNTO 4 #define TLV_ALIGN(datalen) (((datalen)+(TLV_ALIGNTO-1)) & ~(TLV_ALIGNTO-1)) #define TLV_LENGTH(datalen) (sizeof(struct tlv_desc) + (datalen)) #define TLV_SPACE(datalen) (TLV_ALIGN(TLV_LENGTH(datalen))) #define TLV_DATA(tlv) ((void *)((char *)(tlv) + TLV_LENGTH(0))) static __inline__ int TLV_OK(const void *tlv, __u16 space) { /* * Would also like to check that "tlv" is a multiple of 4, * but don't know how to do this in a portable way. * - Tried doing (!(tlv & (TLV_ALIGNTO-1))), but GCC compiler * won't allow binary "&" with a pointer. * - Tried casting "tlv" to integer type, but causes warning about size * mismatch when pointer is bigger than chosen type (int, long, ...). */ return (space >= TLV_SPACE(0)) && (ntohs(((struct tlv_desc *)tlv)->tlv_len) <= space); } static __inline__ int TLV_CHECK(const void *tlv, __u16 space, __u16 exp_type) { return TLV_OK(tlv, space) && (ntohs(((struct tlv_desc *)tlv)->tlv_type) == exp_type); } static __inline__ int TLV_GET_LEN(struct tlv_desc *tlv) { return ntohs(tlv->tlv_len); } static __inline__ void TLV_SET_LEN(struct tlv_desc *tlv, __u16 len) { tlv->tlv_len = htons(len); } static __inline__ int TLV_CHECK_TYPE(struct tlv_desc *tlv, __u16 type) { return (ntohs(tlv->tlv_type) == type); } static __inline__ void TLV_SET_TYPE(struct tlv_desc *tlv, __u16 type) { tlv->tlv_type = htons(type); } static __inline__ int TLV_SET(void *tlv, __u16 type, void *data, __u16 len) { struct tlv_desc *tlv_ptr; int tlv_len; tlv_len = TLV_LENGTH(len); tlv_ptr = (struct tlv_desc *)tlv; tlv_ptr->tlv_type = htons(type); tlv_ptr->tlv_len = htons(tlv_len); if (len && data) { memcpy(TLV_DATA(tlv_ptr), data, len); memset(TLV_DATA(tlv_ptr) + len, 0, TLV_SPACE(len) - tlv_len); } return TLV_SPACE(len); } /* * A TLV list descriptor simplifies processing of messages * containing multiple TLVs. */ struct tlv_list_desc { struct tlv_desc *tlv_ptr; /* ptr to current TLV */ __u32 tlv_space; /* # bytes from curr TLV to list end */ }; static __inline__ void TLV_LIST_INIT(struct tlv_list_desc *list, void *data, __u32 space) { list->tlv_ptr = (struct tlv_desc *)data; list->tlv_space = space; } static __inline__ int TLV_LIST_EMPTY(struct tlv_list_desc *list) { return (list->tlv_space == 0); } static __inline__ int TLV_LIST_CHECK(struct tlv_list_desc *list, __u16 exp_type) { return TLV_CHECK(list->tlv_ptr, list->tlv_space, exp_type); } static __inline__ void *TLV_LIST_DATA(struct tlv_list_desc *list) { return TLV_DATA(list->tlv_ptr); } static __inline__ void TLV_LIST_STEP(struct tlv_list_desc *list) { __u16 tlv_space = TLV_ALIGN(ntohs(list->tlv_ptr->tlv_len)); list->tlv_ptr = (struct tlv_desc *)((char *)list->tlv_ptr + tlv_space); list->tlv_space -= tlv_space; } /* * Configuration messages exchanged via NETLINK_GENERIC use the following * family id, name, version and command. */ #define TIPC_GENL_NAME "TIPC" #define TIPC_GENL_VERSION 0x1 #define TIPC_GENL_CMD 0x1 /* * TIPC specific header used in NETLINK_GENERIC requests. */ struct tipc_genlmsghdr { __u32 dest; /* Destination address */ __u16 cmd; /* Command */ __u16 reserved; /* Unused */ }; #define TIPC_GENL_HDRLEN NLMSG_ALIGN(sizeof(struct tipc_genlmsghdr)) /* * Configuration messages exchanged via TIPC sockets use the TIPC configuration * message header, which is defined below. This structure is analogous * to the Netlink message header, but fields are stored in network byte order * and no padding is permitted between the header and the message data * that follows. */ struct tipc_cfg_msg_hdr { __be32 tcm_len; /* Message length (including header) */ __be16 tcm_type; /* Command type */ __be16 tcm_flags; /* Additional flags */ char tcm_reserved[8]; /* Unused */ }; #define TCM_F_REQUEST 0x1 /* Flag: Request message */ #define TCM_F_MORE 0x2 /* Flag: Message to be continued */ #define TCM_ALIGN(datalen) (((datalen)+3) & ~3) #define TCM_LENGTH(datalen) (sizeof(struct tipc_cfg_msg_hdr) + datalen) #define TCM_SPACE(datalen) (TCM_ALIGN(TCM_LENGTH(datalen))) #define TCM_DATA(tcm_hdr) ((void *)((char *)(tcm_hdr) + TCM_LENGTH(0))) static __inline__ int TCM_SET(void *msg, __u16 cmd, __u16 flags, void *data, __u16 data_len) { struct tipc_cfg_msg_hdr *tcm_hdr; int msg_len; msg_len = TCM_LENGTH(data_len); tcm_hdr = (struct tipc_cfg_msg_hdr *)msg; tcm_hdr->tcm_len = htonl(msg_len); tcm_hdr->tcm_type = htons(cmd); tcm_hdr->tcm_flags = htons(flags); if (data_len && data) { memcpy(TCM_DATA(msg), data, data_len); memset(TCM_DATA(msg) + data_len, 0, TCM_SPACE(data_len) - msg_len); } return TCM_SPACE(data_len); } #endif linux/stm.h�����������������������������������������������������������������������������������������0000644�����������������00000002373�14763166027�0006700 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * System Trace Module (STM) userspace interfaces * Copyright (c) 2014, Intel Corporation. * * STM class implements generic infrastructure for System Trace Module devices * as defined in MIPI STPv2 specification. */ #ifndef _LINUX_STM_H #define _LINUX_STM_H #include <linux/types.h> /* Maximum allowed master and channel values */ #define STP_MASTER_MAX 0xffff #define STP_CHANNEL_MAX 0xffff /** * struct stp_policy_id - identification for the STP policy * @size: size of the structure including real id[] length * @master: assigned master * @channel: first assigned channel * @width: number of requested channels * @id: identification string * * User must calculate the total size of the structure and put it into * @size field, fill out the @id and desired @width. In return, kernel * fills out @master, @channel and @width. */ struct stp_policy_id { __u32 size; __u16 master; __u16 channel; __u16 width; /* padding */ __u16 __reserved_0; __u32 __reserved_1; char id[0]; }; #define STP_POLICY_ID_SET _IOWR('%', 0, struct stp_policy_id) #define STP_POLICY_ID_GET _IOR('%', 1, struct stp_policy_id) #define STP_SET_OPTIONS _IOW('%', 2, __u64) #endif /* _LINUX_STM_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_ppp.h��������������������������������������������������������������������������������������0000644�����������������00000000035�14763166027�0007343 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <linux/ppp-ioctl.h> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/rtc.h�����������������������������������������������������������������������������������������0000644�����������������00000007651�14763166027�0006671 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Generic RTC interface. * This version contains the part of the user interface to the Real Time Clock * service. It is used with both the legacy mc146818 and also EFI * Struct rtc_time and first 12 ioctl by Paul Gortmaker, 1996 - separated out * from <linux/mc146818rtc.h> to this file for 2.4 kernels. * * Copyright (C) 1999 Hewlett-Packard Co. * Copyright (C) 1999 Stephane Eranian <eranian@hpl.hp.com> */ #ifndef _LINUX_RTC_H_ #define _LINUX_RTC_H_ /* * The struct used to pass data via the following ioctl. Similar to the * struct tm in <time.h>, but it needs to be here so that the kernel * source is self contained, allowing cross-compiles, etc. etc. */ struct rtc_time { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; }; /* * This data structure is inspired by the EFI (v0.92) wakeup * alarm API. */ struct rtc_wkalrm { unsigned char enabled; /* 0 = alarm disabled, 1 = alarm enabled */ unsigned char pending; /* 0 = alarm not pending, 1 = alarm pending */ struct rtc_time time; /* time the alarm is set to */ }; /* * Data structure to control PLL correction some better RTC feature * pll_value is used to get or set current value of correction, * the rest of the struct is used to query HW capabilities. * This is modeled after the RTC used in Q40/Q60 computers but * should be sufficiently flexible for other devices * * +ve pll_value means clock will run faster by * pll_value*pll_posmult/pll_clock * -ve pll_value means clock will run slower by * pll_value*pll_negmult/pll_clock */ struct rtc_pll_info { int pll_ctrl; /* placeholder for fancier control */ int pll_value; /* get/set correction value */ int pll_max; /* max +ve (faster) adjustment value */ int pll_min; /* max -ve (slower) adjustment value */ int pll_posmult; /* factor for +ve correction */ int pll_negmult; /* factor for -ve correction */ long pll_clock; /* base PLL frequency */ }; /* * ioctl calls that are permitted to the /dev/rtc interface, if * any of the RTC drivers are enabled. */ #define RTC_AIE_ON _IO('p', 0x01) /* Alarm int. enable on */ #define RTC_AIE_OFF _IO('p', 0x02) /* ... off */ #define RTC_UIE_ON _IO('p', 0x03) /* Update int. enable on */ #define RTC_UIE_OFF _IO('p', 0x04) /* ... off */ #define RTC_PIE_ON _IO('p', 0x05) /* Periodic int. enable on */ #define RTC_PIE_OFF _IO('p', 0x06) /* ... off */ #define RTC_WIE_ON _IO('p', 0x0f) /* Watchdog int. enable on */ #define RTC_WIE_OFF _IO('p', 0x10) /* ... off */ #define RTC_ALM_SET _IOW('p', 0x07, struct rtc_time) /* Set alarm time */ #define RTC_ALM_READ _IOR('p', 0x08, struct rtc_time) /* Read alarm time */ #define RTC_RD_TIME _IOR('p', 0x09, struct rtc_time) /* Read RTC time */ #define RTC_SET_TIME _IOW('p', 0x0a, struct rtc_time) /* Set RTC time */ #define RTC_IRQP_READ _IOR('p', 0x0b, unsigned long) /* Read IRQ rate */ #define RTC_IRQP_SET _IOW('p', 0x0c, unsigned long) /* Set IRQ rate */ #define RTC_EPOCH_READ _IOR('p', 0x0d, unsigned long) /* Read epoch */ #define RTC_EPOCH_SET _IOW('p', 0x0e, unsigned long) /* Set epoch */ #define RTC_WKALM_SET _IOW('p', 0x0f, struct rtc_wkalrm)/* Set wakeup alarm*/ #define RTC_WKALM_RD _IOR('p', 0x10, struct rtc_wkalrm)/* Get wakeup alarm*/ #define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info) /* Get PLL correction */ #define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info) /* Set PLL correction */ #define RTC_VL_READ _IOR('p', 0x13, int) /* Voltage low detector */ #define RTC_VL_CLR _IO('p', 0x14) /* Clear voltage low information */ /* interrupt flags */ #define RTC_IRQF 0x80 /* Any of the following is active */ #define RTC_PF 0x40 /* Periodic interrupt */ #define RTC_AF 0x20 /* Alarm interrupt */ #define RTC_UF 0x10 /* Update interrupt for 1Hz RTC */ #define RTC_MAX_FREQ 8192 #endif /* _LINUX_RTC_H_ */ ���������������������������������������������������������������������������������������linux/sctp.h����������������������������������������������������������������������������������������0000644�����������������00000103020�14763166027�0007035 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* SCTP kernel implementation * (C) Copyright IBM Corp. 2001, 2004 * Copyright (c) 1999-2000 Cisco, Inc. * Copyright (c) 1999-2001 Motorola, Inc. * Copyright (c) 2002 Intel Corp. * * This file is part of the SCTP kernel implementation * * This header represents the structures and constants needed to support * the SCTP Extension to the Sockets API. * * This SCTP implementation 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, or (at your option) * any later version. * * This SCTP implementation 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 GNU CC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * * Please send any bug reports or fixes you make to the * email address(es): * lksctp developers <linux-sctp@vger.kernel.org> * * Or submit a bug report through the following website: * http://www.sf.net/projects/lksctp * * Written or modified by: * La Monte H.P. Yarroll <piggy@acm.org> * R. Stewart <randall@sctp.chicago.il.us> * K. Morneau <kmorneau@cisco.com> * Q. Xie <qxie1@email.mot.com> * Karl Knutson <karl@athena.chicago.il.us> * Jon Grimm <jgrimm@us.ibm.com> * Daisy Chang <daisyc@us.ibm.com> * Ryan Layer <rmlayer@us.ibm.com> * Ardelle Fan <ardelle.fan@intel.com> * Sridhar Samudrala <sri@us.ibm.com> * Inaky Perez-Gonzalez <inaky.gonzalez@intel.com> * Vlad Yasevich <vladislav.yasevich@hp.com> * * Any bugs reported given to us we will try to fix... any fixes shared will * be incorporated into the next SCTP release. */ #ifndef _SCTP_H #define _SCTP_H #include <linux/types.h> #include <linux/socket.h> typedef __s32 sctp_assoc_t; /* The following symbols come from the Sockets API Extensions for * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>. */ #define SCTP_RTOINFO 0 #define SCTP_ASSOCINFO 1 #define SCTP_INITMSG 2 #define SCTP_NODELAY 3 /* Get/set nodelay option. */ #define SCTP_AUTOCLOSE 4 #define SCTP_SET_PEER_PRIMARY_ADDR 5 #define SCTP_PRIMARY_ADDR 6 #define SCTP_ADAPTATION_LAYER 7 #define SCTP_DISABLE_FRAGMENTS 8 #define SCTP_PEER_ADDR_PARAMS 9 #define SCTP_DEFAULT_SEND_PARAM 10 #define SCTP_EVENTS 11 #define SCTP_I_WANT_MAPPED_V4_ADDR 12 /* Turn on/off mapped v4 addresses */ #define SCTP_MAXSEG 13 /* Get/set maximum fragment. */ #define SCTP_STATUS 14 #define SCTP_GET_PEER_ADDR_INFO 15 #define SCTP_DELAYED_ACK_TIME 16 #define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME #define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME #define SCTP_CONTEXT 17 #define SCTP_FRAGMENT_INTERLEAVE 18 #define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */ #define SCTP_MAX_BURST 20 /* Set/Get max burst */ #define SCTP_AUTH_CHUNK 21 /* Set only: add a chunk type to authenticate */ #define SCTP_HMAC_IDENT 22 #define SCTP_AUTH_KEY 23 #define SCTP_AUTH_ACTIVE_KEY 24 #define SCTP_AUTH_DELETE_KEY 25 #define SCTP_PEER_AUTH_CHUNKS 26 /* Read only */ #define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */ #define SCTP_GET_ASSOC_NUMBER 28 /* Read only */ #define SCTP_GET_ASSOC_ID_LIST 29 /* Read only */ #define SCTP_AUTO_ASCONF 30 #define SCTP_PEER_ADDR_THLDS 31 #define SCTP_RECVRCVINFO 32 #define SCTP_RECVNXTINFO 33 #define SCTP_DEFAULT_SNDINFO 34 #define SCTP_AUTH_DEACTIVATE_KEY 35 #define SCTP_REUSE_PORT 36 /* Internal Socket Options. Some of the sctp library functions are * implemented using these socket options. */ #define SCTP_SOCKOPT_BINDX_ADD 100 /* BINDX requests for adding addrs */ #define SCTP_SOCKOPT_BINDX_REM 101 /* BINDX requests for removing addrs. */ #define SCTP_SOCKOPT_PEELOFF 102 /* peel off association. */ /* Options 104-106 are deprecated and removed. Do not use this space */ #define SCTP_SOCKOPT_CONNECTX_OLD 107 /* CONNECTX old requests. */ #define SCTP_GET_PEER_ADDRS 108 /* Get all peer address. */ #define SCTP_GET_LOCAL_ADDRS 109 /* Get all local address. */ #define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */ #define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */ #define SCTP_GET_ASSOC_STATS 112 /* Read only */ #define SCTP_PR_SUPPORTED 113 #define SCTP_DEFAULT_PRINFO 114 #define SCTP_PR_ASSOC_STATUS 115 #define SCTP_PR_STREAM_STATUS 116 #define SCTP_RECONFIG_SUPPORTED 117 #define SCTP_ENABLE_STREAM_RESET 118 #define SCTP_RESET_STREAMS 119 #define SCTP_RESET_ASSOC 120 #define SCTP_ADD_STREAMS 121 #define SCTP_SOCKOPT_PEELOFF_FLAGS 122 #define SCTP_STREAM_SCHEDULER 123 #define SCTP_STREAM_SCHEDULER_VALUE 124 #define SCTP_INTERLEAVING_SUPPORTED 125 #define SCTP_SENDMSG_CONNECT 126 /* PR-SCTP policies */ #define SCTP_PR_SCTP_NONE 0x0000 #define SCTP_PR_SCTP_TTL 0x0010 #define SCTP_PR_SCTP_RTX 0x0020 #define SCTP_PR_SCTP_PRIO 0x0030 #define SCTP_PR_SCTP_MAX SCTP_PR_SCTP_PRIO #define SCTP_PR_SCTP_MASK 0x0030 #define __SCTP_PR_INDEX(x) ((x >> 4) - 1) #define SCTP_PR_INDEX(x) __SCTP_PR_INDEX(SCTP_PR_SCTP_ ## x) #define SCTP_PR_POLICY(x) ((x) & SCTP_PR_SCTP_MASK) #define SCTP_PR_SET_POLICY(flags, x) \ do { \ flags &= ~SCTP_PR_SCTP_MASK; \ flags |= x; \ } while (0) #define SCTP_PR_TTL_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_TTL) #define SCTP_PR_RTX_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_RTX) #define SCTP_PR_PRIO_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_PRIO) /* For enable stream reset */ #define SCTP_ENABLE_RESET_STREAM_REQ 0x01 #define SCTP_ENABLE_RESET_ASSOC_REQ 0x02 #define SCTP_ENABLE_CHANGE_ASSOC_REQ 0x04 #define SCTP_ENABLE_STRRESET_MASK 0x07 #define SCTP_STREAM_RESET_INCOMING 0x01 #define SCTP_STREAM_RESET_OUTGOING 0x02 /* These are bit fields for msghdr->msg_flags. See section 5.1. */ /* On user space Linux, these live in <bits/socket.h> as an enum. */ enum sctp_msg_flags { MSG_NOTIFICATION = 0x8000, #define MSG_NOTIFICATION MSG_NOTIFICATION }; /* 5.3.1 SCTP Initiation Structure (SCTP_INIT) * * This cmsghdr structure provides information for initializing new * SCTP associations with sendmsg(). The SCTP_INITMSG socket option * uses this same data structure. This structure is not used for * recvmsg(). * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ ---------------------- * IPPROTO_SCTP SCTP_INIT struct sctp_initmsg */ struct sctp_initmsg { __u16 sinit_num_ostreams; __u16 sinit_max_instreams; __u16 sinit_max_attempts; __u16 sinit_max_init_timeo; }; /* 5.3.2 SCTP Header Information Structure (SCTP_SNDRCV) * * This cmsghdr structure specifies SCTP options for sendmsg() and * describes SCTP header information about a received message through * recvmsg(). * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ ---------------------- * IPPROTO_SCTP SCTP_SNDRCV struct sctp_sndrcvinfo */ struct sctp_sndrcvinfo { __u16 sinfo_stream; __u16 sinfo_ssn; __u16 sinfo_flags; __u32 sinfo_ppid; __u32 sinfo_context; __u32 sinfo_timetolive; __u32 sinfo_tsn; __u32 sinfo_cumtsn; sctp_assoc_t sinfo_assoc_id; }; /* 5.3.4 SCTP Send Information Structure (SCTP_SNDINFO) * * This cmsghdr structure specifies SCTP options for sendmsg(). * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ ------------------- * IPPROTO_SCTP SCTP_SNDINFO struct sctp_sndinfo */ struct sctp_sndinfo { __u16 snd_sid; __u16 snd_flags; __u32 snd_ppid; __u32 snd_context; sctp_assoc_t snd_assoc_id; }; /* 5.3.5 SCTP Receive Information Structure (SCTP_RCVINFO) * * This cmsghdr structure describes SCTP receive information * about a received message through recvmsg(). * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ ------------------- * IPPROTO_SCTP SCTP_RCVINFO struct sctp_rcvinfo */ struct sctp_rcvinfo { __u16 rcv_sid; __u16 rcv_ssn; __u16 rcv_flags; __u32 rcv_ppid; __u32 rcv_tsn; __u32 rcv_cumtsn; __u32 rcv_context; sctp_assoc_t rcv_assoc_id; }; /* 5.3.6 SCTP Next Receive Information Structure (SCTP_NXTINFO) * * This cmsghdr structure describes SCTP receive information * of the next message that will be delivered through recvmsg() * if this information is already available when delivering * the current message. * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ ------------------- * IPPROTO_SCTP SCTP_NXTINFO struct sctp_nxtinfo */ struct sctp_nxtinfo { __u16 nxt_sid; __u16 nxt_flags; __u32 nxt_ppid; __u32 nxt_length; sctp_assoc_t nxt_assoc_id; }; /* 5.3.7 SCTP PR-SCTP Information Structure (SCTP_PRINFO) * * This cmsghdr structure specifies SCTP options for sendmsg(). * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ ------------------- * IPPROTO_SCTP SCTP_PRINFO struct sctp_prinfo */ struct sctp_prinfo { __u16 pr_policy; __u32 pr_value; }; /* 5.3.8 SCTP AUTH Information Structure (SCTP_AUTHINFO) * * This cmsghdr structure specifies SCTP options for sendmsg(). * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ ------------------- * IPPROTO_SCTP SCTP_AUTHINFO struct sctp_authinfo */ struct sctp_authinfo { __u16 auth_keynumber; }; /* * sinfo_flags: 16 bits (unsigned integer) * * This field may contain any of the following flags and is composed of * a bitwise OR of these values. */ enum sctp_sinfo_flags { SCTP_UNORDERED = (1 << 0), /* Send/receive message unordered. */ SCTP_ADDR_OVER = (1 << 1), /* Override the primary destination. */ SCTP_ABORT = (1 << 2), /* Send an ABORT message to the peer. */ SCTP_SACK_IMMEDIATELY = (1 << 3), /* SACK should be sent without delay. */ /* 2 bits here have been used by SCTP_PR_SCTP_MASK */ SCTP_SENDALL = (1 << 6), SCTP_PR_SCTP_ALL = (1 << 7), SCTP_NOTIFICATION = MSG_NOTIFICATION, /* Next message is not user msg but notification. */ SCTP_EOF = MSG_FIN, /* Initiate graceful shutdown process. */ }; typedef union { __u8 raw; struct sctp_initmsg init; struct sctp_sndrcvinfo sndrcv; } sctp_cmsg_data_t; /* These are cmsg_types. */ typedef enum sctp_cmsg_type { SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */ #define SCTP_INIT SCTP_INIT SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */ #define SCTP_SNDRCV SCTP_SNDRCV SCTP_SNDINFO, /* 5.3.4 SCTP Send Information Structure */ #define SCTP_SNDINFO SCTP_SNDINFO SCTP_RCVINFO, /* 5.3.5 SCTP Receive Information Structure */ #define SCTP_RCVINFO SCTP_RCVINFO SCTP_NXTINFO, /* 5.3.6 SCTP Next Receive Information Structure */ #define SCTP_NXTINFO SCTP_NXTINFO SCTP_PRINFO, /* 5.3.7 SCTP PR-SCTP Information Structure */ #define SCTP_PRINFO SCTP_PRINFO SCTP_AUTHINFO, /* 5.3.8 SCTP AUTH Information Structure */ #define SCTP_AUTHINFO SCTP_AUTHINFO SCTP_DSTADDRV4, /* 5.3.9 SCTP Destination IPv4 Address Structure */ #define SCTP_DSTADDRV4 SCTP_DSTADDRV4 SCTP_DSTADDRV6, /* 5.3.10 SCTP Destination IPv6 Address Structure */ #define SCTP_DSTADDRV6 SCTP_DSTADDRV6 } sctp_cmsg_t; /* * 5.3.1.1 SCTP_ASSOC_CHANGE * * Communication notifications inform the ULP that an SCTP association * has either begun or ended. The identifier for a new association is * provided by this notificaion. The notification information has the * following format: * */ struct sctp_assoc_change { __u16 sac_type; __u16 sac_flags; __u32 sac_length; __u16 sac_state; __u16 sac_error; __u16 sac_outbound_streams; __u16 sac_inbound_streams; sctp_assoc_t sac_assoc_id; __u8 sac_info[0]; }; /* * sac_state: 32 bits (signed integer) * * This field holds one of a number of values that communicate the * event that happened to the association. They include: * * Note: The following state names deviate from the API draft as * the names clash too easily with other kernel symbols. */ enum sctp_sac_state { SCTP_COMM_UP, SCTP_COMM_LOST, SCTP_RESTART, SCTP_SHUTDOWN_COMP, SCTP_CANT_STR_ASSOC, }; /* * 5.3.1.2 SCTP_PEER_ADDR_CHANGE * * When a destination address on a multi-homed peer encounters a change * an interface details event is sent. The information has the * following structure: */ struct sctp_paddr_change { __u16 spc_type; __u16 spc_flags; __u32 spc_length; struct sockaddr_storage spc_aaddr; int spc_state; int spc_error; sctp_assoc_t spc_assoc_id; } __attribute__((packed, aligned(4))); /* * spc_state: 32 bits (signed integer) * * This field holds one of a number of values that communicate the * event that happened to the address. They include: */ enum sctp_spc_state { SCTP_ADDR_AVAILABLE, SCTP_ADDR_UNREACHABLE, SCTP_ADDR_REMOVED, SCTP_ADDR_ADDED, SCTP_ADDR_MADE_PRIM, SCTP_ADDR_CONFIRMED, }; /* * 5.3.1.3 SCTP_REMOTE_ERROR * * A remote peer may send an Operational Error message to its peer. * This message indicates a variety of error conditions on an * association. The entire error TLV as it appears on the wire is * included in a SCTP_REMOTE_ERROR event. Please refer to the SCTP * specification [SCTP] and any extensions for a list of possible * error formats. SCTP error TLVs have the format: */ struct sctp_remote_error { __u16 sre_type; __u16 sre_flags; __u32 sre_length; __be16 sre_error; sctp_assoc_t sre_assoc_id; __u8 sre_data[0]; }; /* * 5.3.1.4 SCTP_SEND_FAILED * * If SCTP cannot deliver a message it may return the message as a * notification. */ struct sctp_send_failed { __u16 ssf_type; __u16 ssf_flags; __u32 ssf_length; __u32 ssf_error; struct sctp_sndrcvinfo ssf_info; sctp_assoc_t ssf_assoc_id; __u8 ssf_data[0]; }; /* * ssf_flags: 16 bits (unsigned integer) * * The flag value will take one of the following values * * SCTP_DATA_UNSENT - Indicates that the data was never put on * the wire. * * SCTP_DATA_SENT - Indicates that the data was put on the wire. * Note that this does not necessarily mean that the * data was (or was not) successfully delivered. */ enum sctp_ssf_flags { SCTP_DATA_UNSENT, SCTP_DATA_SENT, }; /* * 5.3.1.5 SCTP_SHUTDOWN_EVENT * * When a peer sends a SHUTDOWN, SCTP delivers this notification to * inform the application that it should cease sending data. */ struct sctp_shutdown_event { __u16 sse_type; __u16 sse_flags; __u32 sse_length; sctp_assoc_t sse_assoc_id; }; /* * 5.3.1.6 SCTP_ADAPTATION_INDICATION * * When a peer sends a Adaptation Layer Indication parameter , SCTP * delivers this notification to inform the application * that of the peers requested adaptation layer. */ struct sctp_adaptation_event { __u16 sai_type; __u16 sai_flags; __u32 sai_length; __u32 sai_adaptation_ind; sctp_assoc_t sai_assoc_id; }; /* * 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT * * When a receiver is engaged in a partial delivery of a * message this notification will be used to indicate * various events. */ struct sctp_pdapi_event { __u16 pdapi_type; __u16 pdapi_flags; __u32 pdapi_length; __u32 pdapi_indication; sctp_assoc_t pdapi_assoc_id; __u32 pdapi_stream; __u32 pdapi_seq; }; enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, }; /* * 5.3.1.8. SCTP_AUTHENTICATION_EVENT * * When a receiver is using authentication this message will provide * notifications regarding new keys being made active as well as errors. */ struct sctp_authkey_event { __u16 auth_type; __u16 auth_flags; __u32 auth_length; __u16 auth_keynumber; __u16 auth_altkeynumber; __u32 auth_indication; sctp_assoc_t auth_assoc_id; }; enum { SCTP_AUTH_NEW_KEY, #define SCTP_AUTH_NEWKEY SCTP_AUTH_NEW_KEY /* compatible with before */ SCTP_AUTH_FREE_KEY, SCTP_AUTH_NO_AUTH, }; /* * 6.1.9. SCTP_SENDER_DRY_EVENT * * When the SCTP stack has no more user data to send or retransmit, this * notification is given to the user. Also, at the time when a user app * subscribes to this event, if there is no data to be sent or * retransmit, the stack will immediately send up this notification. */ struct sctp_sender_dry_event { __u16 sender_dry_type; __u16 sender_dry_flags; __u32 sender_dry_length; sctp_assoc_t sender_dry_assoc_id; }; #define SCTP_STREAM_RESET_INCOMING_SSN 0x0001 #define SCTP_STREAM_RESET_OUTGOING_SSN 0x0002 #define SCTP_STREAM_RESET_DENIED 0x0004 #define SCTP_STREAM_RESET_FAILED 0x0008 struct sctp_stream_reset_event { __u16 strreset_type; __u16 strreset_flags; __u32 strreset_length; sctp_assoc_t strreset_assoc_id; __u16 strreset_stream_list[]; }; #define SCTP_ASSOC_RESET_DENIED 0x0004 #define SCTP_ASSOC_RESET_FAILED 0x0008 struct sctp_assoc_reset_event { __u16 assocreset_type; __u16 assocreset_flags; __u32 assocreset_length; sctp_assoc_t assocreset_assoc_id; __u32 assocreset_local_tsn; __u32 assocreset_remote_tsn; }; #define SCTP_ASSOC_CHANGE_DENIED 0x0004 #define SCTP_ASSOC_CHANGE_FAILED 0x0008 #define SCTP_STREAM_CHANGE_DENIED SCTP_ASSOC_CHANGE_DENIED #define SCTP_STREAM_CHANGE_FAILED SCTP_ASSOC_CHANGE_FAILED struct sctp_stream_change_event { __u16 strchange_type; __u16 strchange_flags; __u32 strchange_length; sctp_assoc_t strchange_assoc_id; __u16 strchange_instrms; __u16 strchange_outstrms; }; /* * Described in Section 7.3 * Ancillary Data and Notification Interest Options */ struct sctp_event_subscribe { __u8 sctp_data_io_event; __u8 sctp_association_event; __u8 sctp_address_event; __u8 sctp_send_failure_event; __u8 sctp_peer_error_event; __u8 sctp_shutdown_event; __u8 sctp_partial_delivery_event; __u8 sctp_adaptation_layer_event; __u8 sctp_authentication_event; __u8 sctp_sender_dry_event; __u8 sctp_stream_reset_event; __u8 sctp_assoc_reset_event; __u8 sctp_stream_change_event; }; /* * 5.3.1 SCTP Notification Structure * * The notification structure is defined as the union of all * notification types. * */ union sctp_notification { struct { __u16 sn_type; /* Notification type. */ __u16 sn_flags; __u32 sn_length; } sn_header; struct sctp_assoc_change sn_assoc_change; struct sctp_paddr_change sn_paddr_change; struct sctp_remote_error sn_remote_error; struct sctp_send_failed sn_send_failed; struct sctp_shutdown_event sn_shutdown_event; struct sctp_adaptation_event sn_adaptation_event; struct sctp_pdapi_event sn_pdapi_event; struct sctp_authkey_event sn_authkey_event; struct sctp_sender_dry_event sn_sender_dry_event; struct sctp_stream_reset_event sn_strreset_event; struct sctp_assoc_reset_event sn_assocreset_event; struct sctp_stream_change_event sn_strchange_event; }; /* Section 5.3.1 * All standard values for sn_type flags are greater than 2^15. * Values from 2^15 and down are reserved. */ enum sctp_sn_type { SCTP_SN_TYPE_BASE = (1<<15), SCTP_ASSOC_CHANGE, #define SCTP_ASSOC_CHANGE SCTP_ASSOC_CHANGE SCTP_PEER_ADDR_CHANGE, #define SCTP_PEER_ADDR_CHANGE SCTP_PEER_ADDR_CHANGE SCTP_SEND_FAILED, #define SCTP_SEND_FAILED SCTP_SEND_FAILED SCTP_REMOTE_ERROR, #define SCTP_REMOTE_ERROR SCTP_REMOTE_ERROR SCTP_SHUTDOWN_EVENT, #define SCTP_SHUTDOWN_EVENT SCTP_SHUTDOWN_EVENT SCTP_PARTIAL_DELIVERY_EVENT, #define SCTP_PARTIAL_DELIVERY_EVENT SCTP_PARTIAL_DELIVERY_EVENT SCTP_ADAPTATION_INDICATION, #define SCTP_ADAPTATION_INDICATION SCTP_ADAPTATION_INDICATION SCTP_AUTHENTICATION_EVENT, #define SCTP_AUTHENTICATION_INDICATION SCTP_AUTHENTICATION_EVENT SCTP_SENDER_DRY_EVENT, #define SCTP_SENDER_DRY_EVENT SCTP_SENDER_DRY_EVENT SCTP_STREAM_RESET_EVENT, #define SCTP_STREAM_RESET_EVENT SCTP_STREAM_RESET_EVENT SCTP_ASSOC_RESET_EVENT, #define SCTP_ASSOC_RESET_EVENT SCTP_ASSOC_RESET_EVENT SCTP_STREAM_CHANGE_EVENT, #define SCTP_STREAM_CHANGE_EVENT SCTP_STREAM_CHANGE_EVENT }; /* Notification error codes used to fill up the error fields in some * notifications. * SCTP_PEER_ADDRESS_CHAGE : spc_error * SCTP_ASSOC_CHANGE : sac_error * These names should be potentially included in the draft 04 of the SCTP * sockets API specification. */ typedef enum sctp_sn_error { SCTP_FAILED_THRESHOLD, SCTP_RECEIVED_SACK, SCTP_HEARTBEAT_SUCCESS, SCTP_RESPONSE_TO_USER_REQ, SCTP_INTERNAL_ERROR, SCTP_SHUTDOWN_GUARD_EXPIRES, SCTP_PEER_FAULTY, } sctp_sn_error_t; /* * 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO) * * The protocol parameters used to initialize and bound retransmission * timeout (RTO) are tunable. See [SCTP] for more information on how * these parameters are used in RTO calculation. */ struct sctp_rtoinfo { sctp_assoc_t srto_assoc_id; __u32 srto_initial; __u32 srto_max; __u32 srto_min; }; /* * 7.1.2 Association Parameters (SCTP_ASSOCINFO) * * This option is used to both examine and set various association and * endpoint parameters. */ struct sctp_assocparams { sctp_assoc_t sasoc_assoc_id; __u16 sasoc_asocmaxrxt; __u16 sasoc_number_peer_destinations; __u32 sasoc_peer_rwnd; __u32 sasoc_local_rwnd; __u32 sasoc_cookie_life; }; /* * 7.1.9 Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR) * * Requests that the peer mark the enclosed address as the association * primary. The enclosed address must be one of the association's * locally bound addresses. The following structure is used to make a * set primary request: */ struct sctp_setpeerprim { sctp_assoc_t sspp_assoc_id; struct sockaddr_storage sspp_addr; } __attribute__((packed, aligned(4))); /* * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR) * * Requests that the local SCTP stack use the enclosed peer address as * the association primary. The enclosed address must be one of the * association peer's addresses. The following structure is used to * make a set peer primary request: */ struct sctp_prim { sctp_assoc_t ssp_assoc_id; struct sockaddr_storage ssp_addr; } __attribute__((packed, aligned(4))); /* For backward compatibility use, define the old name too */ #define sctp_setprim sctp_prim /* * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER) * * Requests that the local endpoint set the specified Adaptation Layer * Indication parameter for all future INIT and INIT-ACK exchanges. */ struct sctp_setadaptation { __u32 ssb_adaptation_ind; }; /* * 7.1.13 Peer Address Parameters (SCTP_PEER_ADDR_PARAMS) * * Applications can enable or disable heartbeats for any peer address * of an association, modify an address's heartbeat interval, force a * heartbeat to be sent immediately, and adjust the address's maximum * number of retransmissions sent before an address is considered * unreachable. The following structure is used to access and modify an * address's parameters: */ enum sctp_spp_flags { SPP_HB_ENABLE = 1<<0, /*Enable heartbeats*/ SPP_HB_DISABLE = 1<<1, /*Disable heartbeats*/ SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE, SPP_HB_DEMAND = 1<<2, /*Send heartbeat immediately*/ SPP_PMTUD_ENABLE = 1<<3, /*Enable PMTU discovery*/ SPP_PMTUD_DISABLE = 1<<4, /*Disable PMTU discovery*/ SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE, SPP_SACKDELAY_ENABLE = 1<<5, /*Enable SACK*/ SPP_SACKDELAY_DISABLE = 1<<6, /*Disable SACK*/ SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE, SPP_HB_TIME_IS_ZERO = 1<<7, /* Set HB delay to 0 */ SPP_IPV6_FLOWLABEL = 1<<8, SPP_DSCP = 1<<9, }; struct sctp_paddrparams { sctp_assoc_t spp_assoc_id; struct sockaddr_storage spp_address; __u32 spp_hbinterval; __u16 spp_pathmaxrxt; __u32 spp_pathmtu; __u32 spp_sackdelay; __u32 spp_flags; __u32 spp_ipv6_flowlabel; __u8 spp_dscp; } __attribute__((packed, aligned(4))); /* * 7.1.18. Add a chunk that must be authenticated (SCTP_AUTH_CHUNK) * * This set option adds a chunk type that the user is requesting to be * received only in an authenticated way. Changes to the list of chunks * will only effect future associations on the socket. */ struct sctp_authchunk { __u8 sauth_chunk; }; /* * 7.1.19. Get or set the list of supported HMAC Identifiers (SCTP_HMAC_IDENT) * * This option gets or sets the list of HMAC algorithms that the local * endpoint requires the peer to use. */ /* This here is only used by user space as is. It might not be a good idea * to export/reveal the whole structure with reserved fields etc. */ enum { SCTP_AUTH_HMAC_ID_SHA1 = 1, SCTP_AUTH_HMAC_ID_SHA256 = 3, }; struct sctp_hmacalgo { __u32 shmac_num_idents; __u16 shmac_idents[]; }; /* Sadly, user and kernel space have different names for * this structure member, so this is to not break anything. */ #define shmac_number_of_idents shmac_num_idents /* * 7.1.20. Set a shared key (SCTP_AUTH_KEY) * * This option will set a shared secret key which is used to build an * association shared key. */ struct sctp_authkey { sctp_assoc_t sca_assoc_id; __u16 sca_keynumber; __u16 sca_keylength; __u8 sca_key[]; }; /* * 7.1.21. Get or set the active shared key (SCTP_AUTH_ACTIVE_KEY) * * This option will get or set the active shared key to be used to build * the association shared key. */ struct sctp_authkeyid { sctp_assoc_t scact_assoc_id; __u16 scact_keynumber; }; /* * 7.1.23. Get or set delayed ack timer (SCTP_DELAYED_SACK) * * This option will effect the way delayed acks are performed. This * option allows you to get or set the delayed ack time, in * milliseconds. It also allows changing the delayed ack frequency. * Changing the frequency to 1 disables the delayed sack algorithm. If * the assoc_id is 0, then this sets or gets the endpoints default * values. If the assoc_id field is non-zero, then the set or get * effects the specified association for the one to many model (the * assoc_id field is ignored by the one to one model). Note that if * sack_delay or sack_freq are 0 when setting this option, then the * current values will remain unchanged. */ struct sctp_sack_info { sctp_assoc_t sack_assoc_id; uint32_t sack_delay; uint32_t sack_freq; }; struct sctp_assoc_value { sctp_assoc_t assoc_id; uint32_t assoc_value; }; struct sctp_stream_value { sctp_assoc_t assoc_id; uint16_t stream_id; uint16_t stream_value; }; /* * 7.2.2 Peer Address Information * * Applications can retrieve information about a specific peer address * of an association, including its reachability state, congestion * window, and retransmission timer values. This information is * read-only. The following structure is used to access this * information: */ struct sctp_paddrinfo { sctp_assoc_t spinfo_assoc_id; struct sockaddr_storage spinfo_address; __s32 spinfo_state; __u32 spinfo_cwnd; __u32 spinfo_srtt; __u32 spinfo_rto; __u32 spinfo_mtu; } __attribute__((packed, aligned(4))); /* Peer addresses's state. */ /* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x] * calls. * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters. * Not yet confirmed by a heartbeat and not available for data * transfers. * ACTIVE : Peer address confirmed, active and available for data transfers. * INACTIVE: Peer address inactive and not available for data transfers. */ enum sctp_spinfo_state { SCTP_INACTIVE, SCTP_PF, SCTP_ACTIVE, SCTP_UNCONFIRMED, SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */ }; /* * 7.2.1 Association Status (SCTP_STATUS) * * Applications can retrieve current status information about an * association, including association state, peer receiver window size, * number of unacked data chunks, and number of data chunks pending * receipt. This information is read-only. The following structure is * used to access this information: */ struct sctp_status { sctp_assoc_t sstat_assoc_id; __s32 sstat_state; __u32 sstat_rwnd; __u16 sstat_unackdata; __u16 sstat_penddata; __u16 sstat_instrms; __u16 sstat_outstrms; __u32 sstat_fragmentation_point; struct sctp_paddrinfo sstat_primary; }; /* * 7.2.3. Get the list of chunks the peer requires to be authenticated * (SCTP_PEER_AUTH_CHUNKS) * * This option gets a list of chunks for a specified association that * the peer requires to be received authenticated only. */ struct sctp_authchunks { sctp_assoc_t gauth_assoc_id; __u32 gauth_number_of_chunks; uint8_t gauth_chunks[]; }; /* The broken spelling has been released already in lksctp-tools header, * so don't break anyone, now that it's fixed. */ #define guth_number_of_chunks gauth_number_of_chunks /* Association states. */ enum sctp_sstat_state { SCTP_EMPTY = 0, SCTP_CLOSED = 1, SCTP_COOKIE_WAIT = 2, SCTP_COOKIE_ECHOED = 3, SCTP_ESTABLISHED = 4, SCTP_SHUTDOWN_PENDING = 5, SCTP_SHUTDOWN_SENT = 6, SCTP_SHUTDOWN_RECEIVED = 7, SCTP_SHUTDOWN_ACK_SENT = 8, }; /* * 8.2.6. Get the Current Identifiers of Associations * (SCTP_GET_ASSOC_ID_LIST) * * This option gets the current list of SCTP association identifiers of * the SCTP associations handled by a one-to-many style socket. */ struct sctp_assoc_ids { __u32 gaids_number_of_ids; sctp_assoc_t gaids_assoc_id[]; }; /* * 8.3, 8.5 get all peer/local addresses in an association. * This parameter struct is used by SCTP_GET_PEER_ADDRS and * SCTP_GET_LOCAL_ADDRS socket options used internally to implement * sctp_getpaddrs() and sctp_getladdrs() API. */ struct sctp_getaddrs_old { sctp_assoc_t assoc_id; int addr_num; struct sockaddr *addrs; }; struct sctp_getaddrs { sctp_assoc_t assoc_id; /*input*/ __u32 addr_num; /*output*/ __u8 addrs[0]; /*output, variable size*/ }; /* A socket user request obtained via SCTP_GET_ASSOC_STATS that retrieves * association stats. All stats are counts except sas_maxrto and * sas_obs_rto_ipaddr. maxrto is the max observed rto + transport since * the last call. Will return 0 when RTO was not update since last call */ struct sctp_assoc_stats { sctp_assoc_t sas_assoc_id; /* Input */ /* Transport of observed max RTO */ struct sockaddr_storage sas_obs_rto_ipaddr; __u64 sas_maxrto; /* Maximum Observed RTO for period */ __u64 sas_isacks; /* SACKs received */ __u64 sas_osacks; /* SACKs sent */ __u64 sas_opackets; /* Packets sent */ __u64 sas_ipackets; /* Packets received */ __u64 sas_rtxchunks; /* Retransmitted Chunks */ __u64 sas_outofseqtsns;/* TSN received > next expected */ __u64 sas_idupchunks; /* Dups received (ordered+unordered) */ __u64 sas_gapcnt; /* Gap Acknowledgements Received */ __u64 sas_ouodchunks; /* Unordered data chunks sent */ __u64 sas_iuodchunks; /* Unordered data chunks received */ __u64 sas_oodchunks; /* Ordered data chunks sent */ __u64 sas_iodchunks; /* Ordered data chunks received */ __u64 sas_octrlchunks; /* Control chunks sent */ __u64 sas_ictrlchunks; /* Control chunks received */ }; /* * 8.1 sctp_bindx() * * The flags parameter is formed from the bitwise OR of zero or more of the * following currently defined flags: */ #define SCTP_BINDX_ADD_ADDR 0x01 #define SCTP_BINDX_REM_ADDR 0x02 /* This is the structure that is passed as an argument(optval) to * getsockopt(SCTP_SOCKOPT_PEELOFF). */ typedef struct { sctp_assoc_t associd; int sd; } sctp_peeloff_arg_t; typedef struct { sctp_peeloff_arg_t p_arg; unsigned flags; } sctp_peeloff_flags_arg_t; /* * Peer Address Thresholds socket option */ struct sctp_paddrthlds { sctp_assoc_t spt_assoc_id; struct sockaddr_storage spt_address; __u16 spt_pathmaxrxt; __u16 spt_pathpfthld; }; /* * Socket Option for Getting the Association/Stream-Specific PR-SCTP Status */ struct sctp_prstatus { sctp_assoc_t sprstat_assoc_id; __u16 sprstat_sid; __u16 sprstat_policy; __u64 sprstat_abandoned_unsent; __u64 sprstat_abandoned_sent; }; struct sctp_default_prinfo { sctp_assoc_t pr_assoc_id; __u32 pr_value; __u16 pr_policy; }; struct sctp_info { __u32 sctpi_tag; __u32 sctpi_state; __u32 sctpi_rwnd; __u16 sctpi_unackdata; __u16 sctpi_penddata; __u16 sctpi_instrms; __u16 sctpi_outstrms; __u32 sctpi_fragmentation_point; __u32 sctpi_inqueue; __u32 sctpi_outqueue; __u32 sctpi_overall_error; __u32 sctpi_max_burst; __u32 sctpi_maxseg; __u32 sctpi_peer_rwnd; __u32 sctpi_peer_tag; __u8 sctpi_peer_capable; __u8 sctpi_peer_sack; __u16 __reserved1; /* assoc status info */ __u64 sctpi_isacks; __u64 sctpi_osacks; __u64 sctpi_opackets; __u64 sctpi_ipackets; __u64 sctpi_rtxchunks; __u64 sctpi_outofseqtsns; __u64 sctpi_idupchunks; __u64 sctpi_gapcnt; __u64 sctpi_ouodchunks; __u64 sctpi_iuodchunks; __u64 sctpi_oodchunks; __u64 sctpi_iodchunks; __u64 sctpi_octrlchunks; __u64 sctpi_ictrlchunks; /* primary transport info */ struct sockaddr_storage sctpi_p_address; __s32 sctpi_p_state; __u32 sctpi_p_cwnd; __u32 sctpi_p_srtt; __u32 sctpi_p_rto; __u32 sctpi_p_hbinterval; __u32 sctpi_p_pathmaxrxt; __u32 sctpi_p_sackdelay; __u32 sctpi_p_sackfreq; __u32 sctpi_p_ssthresh; __u32 sctpi_p_partial_bytes_acked; __u32 sctpi_p_flight_size; __u16 sctpi_p_error; __u16 __reserved2; /* sctp sock info */ __u32 sctpi_s_autoclose; __u32 sctpi_s_adaptation_ind; __u32 sctpi_s_pd_point; __u8 sctpi_s_nodelay; __u8 sctpi_s_disable_fragments; __u8 sctpi_s_v4mapped; __u8 sctpi_s_frag_interleave; __u32 sctpi_s_type; __u32 __reserved3; }; struct sctp_reset_streams { sctp_assoc_t srs_assoc_id; uint16_t srs_flags; uint16_t srs_number_streams; /* 0 == ALL */ uint16_t srs_stream_list[]; /* list if srs_num_streams is not 0 */ }; struct sctp_add_streams { sctp_assoc_t sas_assoc_id; uint16_t sas_instrms; uint16_t sas_outstrms; }; /* SCTP Stream schedulers */ enum sctp_sched_type { SCTP_SS_FCFS, SCTP_SS_DEFAULT = SCTP_SS_FCFS, SCTP_SS_PRIO, SCTP_SS_RR, SCTP_SS_MAX = SCTP_SS_RR }; #endif /* _SCTP_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/atmioc.h��������������������������������������������������������������������������������������0000644�����������������00000003156�14763166027�0007351 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atmioc.h - ranges for ATM-related ioctl numbers */ /* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ /* * See http://icawww1.epfl.ch/linux-atm/magic.html for the complete list of * "magic" ioctl numbers. */ #ifndef _LINUX_ATMIOC_H #define _LINUX_ATMIOC_H #include <asm/ioctl.h> /* everybody including atmioc.h will also need _IO{,R,W,WR} */ #define ATMIOC_PHYCOM 0x00 /* PHY device common ioctls, globally unique */ #define ATMIOC_PHYCOM_END 0x0f #define ATMIOC_PHYTYP 0x10 /* PHY dev type ioctls, unique per PHY type */ #define ATMIOC_PHYTYP_END 0x2f #define ATMIOC_PHYPRV 0x30 /* PHY dev private ioctls, unique per driver */ #define ATMIOC_PHYPRV_END 0x4f #define ATMIOC_SARCOM 0x50 /* SAR device common ioctls, globally unique */ #define ATMIOC_SARCOM_END 0x50 #define ATMIOC_SARPRV 0x60 /* SAR dev private ioctls, unique per driver */ #define ATMIOC_SARPRV_END 0x7f #define ATMIOC_ITF 0x80 /* Interface ioctls, globally unique */ #define ATMIOC_ITF_END 0x8f #define ATMIOC_BACKEND 0x90 /* ATM generic backend ioctls, u. per backend */ #define ATMIOC_BACKEND_END 0xaf /* 0xb0-0xbf: Reserved for future use */ #define ATMIOC_AREQUIPA 0xc0 /* Application requested IP over ATM, glob. u. */ #define ATMIOC_LANE 0xd0 /* LAN Emulation, globally unique */ #define ATMIOC_MPOA 0xd8 /* MPOA, globally unique */ #define ATMIOC_CLIP 0xe0 /* Classical IP over ATM control, globally u. */ #define ATMIOC_CLIP_END 0xef #define ATMIOC_SPECIAL 0xf0 /* Special-purpose controls, globally unique */ #define ATMIOC_SPECIAL_END 0xff #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/fuse.h����������������������������������������������������������������������������������������0000644�����������������00000042317�14763166027�0007041 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ /* This file defines the kernel interface of FUSE Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu> This program can be distributed under the terms of the GNU GPL. See the file COPYING. This -- and only this -- header file may also be distributed under the terms of the BSD Licence as follows: Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * This file defines the kernel interface of FUSE * * Protocol changelog: * * 7.9: * - new fuse_getattr_in input argument of GETATTR * - add lk_flags in fuse_lk_in * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in * - add blksize field to fuse_attr * - add file flags field to fuse_read_in and fuse_write_in * * 7.10 * - add nonseekable open flag * * 7.11 * - add IOCTL message * - add unsolicited notification support * - add POLL message and NOTIFY_POLL notification * * 7.12 * - add umask flag to input argument of open, mknod and mkdir * - add notification messages for invalidation of inodes and * directory entries * * 7.13 * - make max number of background requests and congestion threshold * tunables * * 7.14 * - add splice support to fuse device * * 7.15 * - add store notify * - add retrieve notify * * 7.16 * - add BATCH_FORGET request * - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct * fuse_ioctl_iovec' instead of ambiguous 'struct iovec' * - add FUSE_IOCTL_32BIT flag * * 7.17 * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK * * 7.18 * - add FUSE_IOCTL_DIR flag * - add FUSE_NOTIFY_DELETE * * 7.19 * - add FUSE_FALLOCATE * * 7.20 * - add FUSE_AUTO_INVAL_DATA * * 7.21 * - add FUSE_READDIRPLUS * - send the requested events in POLL request * * 7.22 * - add FUSE_ASYNC_DIO * * 7.23 * - add FUSE_WRITEBACK_CACHE * - add time_gran to fuse_init_out * - add reserved space to fuse_init_out * - add FATTR_CTIME * - add ctime and ctimensec to fuse_setattr_in * - add FUSE_RENAME2 request * - add FUSE_NO_OPEN_SUPPORT flag * * 7.24 * - add FUSE_LSEEK for SEEK_HOLE and SEEK_DATA support * * 7.25 * - add FUSE_PARALLEL_DIROPS * * 7.26 * - add FUSE_HANDLE_KILLPRIV * - add FUSE_POSIX_ACL * * 7.27 * - add FUSE_ABORT_ERROR */ #ifndef _LINUX_FUSE_H #define _LINUX_FUSE_H #include <stdint.h> /* * Version negotiation: * * Both the kernel and userspace send the version they support in the * INIT request and reply respectively. * * If the major versions match then both shall use the smallest * of the two minor versions for communication. * * If the kernel supports a larger major version, then userspace shall * reply with the major version it supports, ignore the rest of the * INIT message and expect a new INIT message from the kernel with a * matching major version. * * If the library supports a larger major version, then it shall fall * back to the major protocol version sent by the kernel for * communication and reply with that major version (and an arbitrary * supported minor version). */ /** Version number of this interface */ #define FUSE_KERNEL_VERSION 7 /** Minor version number of this interface */ #define FUSE_KERNEL_MINOR_VERSION 27 /** The node ID of the root inode */ #define FUSE_ROOT_ID 1 /* Make sure all structures are padded to 64bit boundary, so 32bit userspace works under 64bit kernels */ struct fuse_attr { uint64_t ino; uint64_t size; uint64_t blocks; uint64_t atime; uint64_t mtime; uint64_t ctime; uint32_t atimensec; uint32_t mtimensec; uint32_t ctimensec; uint32_t mode; uint32_t nlink; uint32_t uid; uint32_t gid; uint32_t rdev; uint32_t blksize; uint32_t padding; }; struct fuse_kstatfs { uint64_t blocks; uint64_t bfree; uint64_t bavail; uint64_t files; uint64_t ffree; uint32_t bsize; uint32_t namelen; uint32_t frsize; uint32_t padding; uint32_t spare[6]; }; struct fuse_file_lock { uint64_t start; uint64_t end; uint32_t type; uint32_t pid; /* tgid */ }; /** * Bitmasks for fuse_setattr_in.valid */ #define FATTR_MODE (1 << 0) #define FATTR_UID (1 << 1) #define FATTR_GID (1 << 2) #define FATTR_SIZE (1 << 3) #define FATTR_ATIME (1 << 4) #define FATTR_MTIME (1 << 5) #define FATTR_FH (1 << 6) #define FATTR_ATIME_NOW (1 << 7) #define FATTR_MTIME_NOW (1 << 8) #define FATTR_LOCKOWNER (1 << 9) #define FATTR_CTIME (1 << 10) /** * Flags returned by the OPEN request * * FOPEN_DIRECT_IO: bypass page cache for this open file * FOPEN_KEEP_CACHE: don't invalidate the data cache on open * FOPEN_NONSEEKABLE: the file is not seekable * FOPEN_STREAM: the file is stream-like (no file position at all) */ #define FOPEN_DIRECT_IO (1 << 0) #define FOPEN_KEEP_CACHE (1 << 1) #define FOPEN_NONSEEKABLE (1 << 2) #define FOPEN_STREAM (1 << 4) /** * INIT request/reply flags * * FUSE_ASYNC_READ: asynchronous read requests * FUSE_POSIX_LOCKS: remote locking for POSIX file locks * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported) * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".." * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB * FUSE_DONT_MASK: don't apply umask to file mode on create operations * FUSE_SPLICE_WRITE: kernel supports splice write on the device * FUSE_SPLICE_MOVE: kernel supports splice move on the device * FUSE_SPLICE_READ: kernel supports splice read on the device * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one) * FUSE_READDIRPLUS_AUTO: adaptive readdirplus * FUSE_ASYNC_DIO: asynchronous direct I/O submission * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens * FUSE_PARALLEL_DIROPS: allow parallel lookups and readdir * FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc * FUSE_POSIX_ACL: filesystem supports posix acls * FUSE_ABORT_ERROR: reading the device after abort returns ECONNABORTED */ #define FUSE_ASYNC_READ (1 << 0) #define FUSE_POSIX_LOCKS (1 << 1) #define FUSE_FILE_OPS (1 << 2) #define FUSE_ATOMIC_O_TRUNC (1 << 3) #define FUSE_EXPORT_SUPPORT (1 << 4) #define FUSE_BIG_WRITES (1 << 5) #define FUSE_DONT_MASK (1 << 6) #define FUSE_SPLICE_WRITE (1 << 7) #define FUSE_SPLICE_MOVE (1 << 8) #define FUSE_SPLICE_READ (1 << 9) #define FUSE_FLOCK_LOCKS (1 << 10) #define FUSE_HAS_IOCTL_DIR (1 << 11) #define FUSE_AUTO_INVAL_DATA (1 << 12) #define FUSE_DO_READDIRPLUS (1 << 13) #define FUSE_READDIRPLUS_AUTO (1 << 14) #define FUSE_ASYNC_DIO (1 << 15) #define FUSE_WRITEBACK_CACHE (1 << 16) #define FUSE_NO_OPEN_SUPPORT (1 << 17) #define FUSE_PARALLEL_DIROPS (1 << 18) #define FUSE_HANDLE_KILLPRIV (1 << 19) #define FUSE_POSIX_ACL (1 << 20) #define FUSE_ABORT_ERROR (1 << 21) /** * CUSE INIT request/reply flags * * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl */ #define CUSE_UNRESTRICTED_IOCTL (1 << 0) /** * Release flags */ #define FUSE_RELEASE_FLUSH (1 << 0) #define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1) /** * Getattr flags */ #define FUSE_GETATTR_FH (1 << 0) /** * Lock flags */ #define FUSE_LK_FLOCK (1 << 0) /** * WRITE flags * * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed * FUSE_WRITE_LOCKOWNER: lock_owner field is valid */ #define FUSE_WRITE_CACHE (1 << 0) #define FUSE_WRITE_LOCKOWNER (1 << 1) /** * Read flags */ #define FUSE_READ_LOCKOWNER (1 << 1) /** * Ioctl flags * * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed * FUSE_IOCTL_RETRY: retry with new iovecs * FUSE_IOCTL_32BIT: 32bit ioctl * FUSE_IOCTL_DIR: is a directory * * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs */ #define FUSE_IOCTL_COMPAT (1 << 0) #define FUSE_IOCTL_UNRESTRICTED (1 << 1) #define FUSE_IOCTL_RETRY (1 << 2) #define FUSE_IOCTL_32BIT (1 << 3) #define FUSE_IOCTL_DIR (1 << 4) #define FUSE_IOCTL_MAX_IOV 256 /** * Poll flags * * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify */ #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0) enum fuse_opcode { FUSE_LOOKUP = 1, FUSE_FORGET = 2, /* no reply */ FUSE_GETATTR = 3, FUSE_SETATTR = 4, FUSE_READLINK = 5, FUSE_SYMLINK = 6, FUSE_MKNOD = 8, FUSE_MKDIR = 9, FUSE_UNLINK = 10, FUSE_RMDIR = 11, FUSE_RENAME = 12, FUSE_LINK = 13, FUSE_OPEN = 14, FUSE_READ = 15, FUSE_WRITE = 16, FUSE_STATFS = 17, FUSE_RELEASE = 18, FUSE_FSYNC = 20, FUSE_SETXATTR = 21, FUSE_GETXATTR = 22, FUSE_LISTXATTR = 23, FUSE_REMOVEXATTR = 24, FUSE_FLUSH = 25, FUSE_INIT = 26, FUSE_OPENDIR = 27, FUSE_READDIR = 28, FUSE_RELEASEDIR = 29, FUSE_FSYNCDIR = 30, FUSE_GETLK = 31, FUSE_SETLK = 32, FUSE_SETLKW = 33, FUSE_ACCESS = 34, FUSE_CREATE = 35, FUSE_INTERRUPT = 36, FUSE_BMAP = 37, FUSE_DESTROY = 38, FUSE_IOCTL = 39, FUSE_POLL = 40, FUSE_NOTIFY_REPLY = 41, FUSE_BATCH_FORGET = 42, FUSE_FALLOCATE = 43, FUSE_READDIRPLUS = 44, FUSE_RENAME2 = 45, FUSE_LSEEK = 46, /* CUSE specific operations */ CUSE_INIT = 4096, }; enum fuse_notify_code { FUSE_NOTIFY_POLL = 1, FUSE_NOTIFY_INVAL_INODE = 2, FUSE_NOTIFY_INVAL_ENTRY = 3, FUSE_NOTIFY_STORE = 4, FUSE_NOTIFY_RETRIEVE = 5, FUSE_NOTIFY_DELETE = 6, FUSE_NOTIFY_CODE_MAX, }; /* The read buffer is required to be at least 8k, but may be much larger */ #define FUSE_MIN_READ_BUFFER 8192 #define FUSE_COMPAT_ENTRY_OUT_SIZE 120 struct fuse_entry_out { uint64_t nodeid; /* Inode ID */ uint64_t generation; /* Inode generation: nodeid:gen must be unique for the fs's lifetime */ uint64_t entry_valid; /* Cache timeout for the name */ uint64_t attr_valid; /* Cache timeout for the attributes */ uint32_t entry_valid_nsec; uint32_t attr_valid_nsec; struct fuse_attr attr; }; struct fuse_forget_in { uint64_t nlookup; }; struct fuse_forget_one { uint64_t nodeid; uint64_t nlookup; }; struct fuse_batch_forget_in { uint32_t count; uint32_t dummy; }; struct fuse_getattr_in { uint32_t getattr_flags; uint32_t dummy; uint64_t fh; }; #define FUSE_COMPAT_ATTR_OUT_SIZE 96 struct fuse_attr_out { uint64_t attr_valid; /* Cache timeout for the attributes */ uint32_t attr_valid_nsec; uint32_t dummy; struct fuse_attr attr; }; #define FUSE_COMPAT_MKNOD_IN_SIZE 8 struct fuse_mknod_in { uint32_t mode; uint32_t rdev; uint32_t umask; uint32_t padding; }; struct fuse_mkdir_in { uint32_t mode; uint32_t umask; }; struct fuse_rename_in { uint64_t newdir; }; struct fuse_rename2_in { uint64_t newdir; uint32_t flags; uint32_t padding; }; struct fuse_link_in { uint64_t oldnodeid; }; struct fuse_setattr_in { uint32_t valid; uint32_t padding; uint64_t fh; uint64_t size; uint64_t lock_owner; uint64_t atime; uint64_t mtime; uint64_t ctime; uint32_t atimensec; uint32_t mtimensec; uint32_t ctimensec; uint32_t mode; uint32_t unused4; uint32_t uid; uint32_t gid; uint32_t unused5; }; struct fuse_open_in { uint32_t flags; uint32_t unused; }; struct fuse_create_in { uint32_t flags; uint32_t mode; uint32_t umask; uint32_t padding; }; struct fuse_open_out { uint64_t fh; uint32_t open_flags; uint32_t padding; }; struct fuse_release_in { uint64_t fh; uint32_t flags; uint32_t release_flags; uint64_t lock_owner; }; struct fuse_flush_in { uint64_t fh; uint32_t unused; uint32_t padding; uint64_t lock_owner; }; struct fuse_read_in { uint64_t fh; uint64_t offset; uint32_t size; uint32_t read_flags; uint64_t lock_owner; uint32_t flags; uint32_t padding; }; #define FUSE_COMPAT_WRITE_IN_SIZE 24 struct fuse_write_in { uint64_t fh; uint64_t offset; uint32_t size; uint32_t write_flags; uint64_t lock_owner; uint32_t flags; uint32_t padding; }; struct fuse_write_out { uint32_t size; uint32_t padding; }; #define FUSE_COMPAT_STATFS_SIZE 48 struct fuse_statfs_out { struct fuse_kstatfs st; }; struct fuse_fsync_in { uint64_t fh; uint32_t fsync_flags; uint32_t padding; }; struct fuse_setxattr_in { uint32_t size; uint32_t flags; }; struct fuse_getxattr_in { uint32_t size; uint32_t padding; }; struct fuse_getxattr_out { uint32_t size; uint32_t padding; }; struct fuse_lk_in { uint64_t fh; uint64_t owner; struct fuse_file_lock lk; uint32_t lk_flags; uint32_t padding; }; struct fuse_lk_out { struct fuse_file_lock lk; }; struct fuse_access_in { uint32_t mask; uint32_t padding; }; struct fuse_init_in { uint32_t major; uint32_t minor; uint32_t max_readahead; uint32_t flags; }; #define FUSE_COMPAT_INIT_OUT_SIZE 8 #define FUSE_COMPAT_22_INIT_OUT_SIZE 24 struct fuse_init_out { uint32_t major; uint32_t minor; uint32_t max_readahead; uint32_t flags; uint16_t max_background; uint16_t congestion_threshold; uint32_t max_write; uint32_t time_gran; uint32_t unused[9]; }; #define CUSE_INIT_INFO_MAX 4096 struct cuse_init_in { uint32_t major; uint32_t minor; uint32_t unused; uint32_t flags; }; struct cuse_init_out { uint32_t major; uint32_t minor; uint32_t unused; uint32_t flags; uint32_t max_read; uint32_t max_write; uint32_t dev_major; /* chardev major */ uint32_t dev_minor; /* chardev minor */ uint32_t spare[10]; }; struct fuse_interrupt_in { uint64_t unique; }; struct fuse_bmap_in { uint64_t block; uint32_t blocksize; uint32_t padding; }; struct fuse_bmap_out { uint64_t block; }; struct fuse_ioctl_in { uint64_t fh; uint32_t flags; uint32_t cmd; uint64_t arg; uint32_t in_size; uint32_t out_size; }; struct fuse_ioctl_iovec { uint64_t base; uint64_t len; }; struct fuse_ioctl_out { int32_t result; uint32_t flags; uint32_t in_iovs; uint32_t out_iovs; }; struct fuse_poll_in { uint64_t fh; uint64_t kh; uint32_t flags; uint32_t events; }; struct fuse_poll_out { uint32_t revents; uint32_t padding; }; struct fuse_notify_poll_wakeup_out { uint64_t kh; }; struct fuse_fallocate_in { uint64_t fh; uint64_t offset; uint64_t length; uint32_t mode; uint32_t padding; }; struct fuse_in_header { uint32_t len; uint32_t opcode; uint64_t unique; uint64_t nodeid; uint32_t uid; uint32_t gid; uint32_t pid; uint32_t padding; }; struct fuse_out_header { uint32_t len; int32_t error; uint64_t unique; }; struct fuse_dirent { uint64_t ino; uint64_t off; uint32_t namelen; uint32_t type; char name[]; }; #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) #define FUSE_DIRENT_ALIGN(x) \ (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1)) #define FUSE_DIRENT_SIZE(d) \ FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) struct fuse_direntplus { struct fuse_entry_out entry_out; struct fuse_dirent dirent; }; #define FUSE_NAME_OFFSET_DIRENTPLUS \ offsetof(struct fuse_direntplus, dirent.name) #define FUSE_DIRENTPLUS_SIZE(d) \ FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen) struct fuse_notify_inval_inode_out { uint64_t ino; int64_t off; int64_t len; }; struct fuse_notify_inval_entry_out { uint64_t parent; uint32_t namelen; uint32_t padding; }; struct fuse_notify_delete_out { uint64_t parent; uint64_t child; uint32_t namelen; uint32_t padding; }; struct fuse_notify_store_out { uint64_t nodeid; uint64_t offset; uint32_t size; uint32_t padding; }; struct fuse_notify_retrieve_out { uint64_t notify_unique; uint64_t nodeid; uint64_t offset; uint32_t size; uint32_t padding; }; /* Matches the size of fuse_write_in */ struct fuse_notify_retrieve_in { uint64_t dummy1; uint64_t offset; uint32_t size; uint32_t dummy2; uint64_t dummy3; uint64_t dummy4; }; /* Device ioctls: */ #define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t) struct fuse_lseek_in { uint64_t fh; uint64_t offset; uint32_t whence; uint32_t padding; }; struct fuse_lseek_out { uint64_t offset; }; #endif /* _LINUX_FUSE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/coresight-stm.h�������������������������������������������������������������������������������0000644�����������������00000001302�14763166027�0010654 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __UAPI_CORESIGHT_STM_H_ #define __UAPI_CORESIGHT_STM_H_ #include <linux/const.h> #define STM_FLAG_TIMESTAMPED _BITUL(3) #define STM_FLAG_GUARANTEED _BITUL(7) /* * The CoreSight STM supports guaranteed and invariant timing * transactions. Guaranteed transactions are guaranteed to be * traced, this might involve stalling the bus or system to * ensure the transaction is accepted by the STM. While invariant * timing transactions are not guaranteed to be traced, they * will take an invariant amount of time regardless of the * state of the STM. */ enum { STM_OPTION_GUARANTEED = 0, STM_OPTION_INVARIANT, }; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/nf_conntrack_tcp.h������������������������������������������������������������������0000644�����������������00000002607�14763166027�0013404 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NF_CONNTRACK_TCP_H #define _NF_CONNTRACK_TCP_H /* TCP tracking. */ #include <linux/types.h> /* This is exposed to userspace (ctnetlink) */ enum tcp_conntrack { TCP_CONNTRACK_NONE, TCP_CONNTRACK_SYN_SENT, TCP_CONNTRACK_SYN_RECV, TCP_CONNTRACK_ESTABLISHED, TCP_CONNTRACK_FIN_WAIT, TCP_CONNTRACK_CLOSE_WAIT, TCP_CONNTRACK_LAST_ACK, TCP_CONNTRACK_TIME_WAIT, TCP_CONNTRACK_CLOSE, TCP_CONNTRACK_LISTEN, /* obsolete */ #define TCP_CONNTRACK_SYN_SENT2 TCP_CONNTRACK_LISTEN TCP_CONNTRACK_MAX, TCP_CONNTRACK_IGNORE, TCP_CONNTRACK_RETRANS, TCP_CONNTRACK_UNACK, TCP_CONNTRACK_TIMEOUT_MAX }; /* Window scaling is advertised by the sender */ #define IP_CT_TCP_FLAG_WINDOW_SCALE 0x01 /* SACK is permitted by the sender */ #define IP_CT_TCP_FLAG_SACK_PERM 0x02 /* This sender sent FIN first */ #define IP_CT_TCP_FLAG_CLOSE_INIT 0x04 /* Be liberal in window checking */ #define IP_CT_TCP_FLAG_BE_LIBERAL 0x08 /* Has unacknowledged data */ #define IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED 0x10 /* The field td_maxack has been set */ #define IP_CT_TCP_FLAG_MAXACK_SET 0x20 /* Marks possibility for expected RFC5961 challenge ACK */ #define IP_CT_EXP_CHALLENGE_ACK 0x40 /* Simultaneous open initialized */ #define IP_CT_TCP_SIMULTANEOUS_OPEN 0x80 struct nf_ct_tcp_flags { __u8 flags; __u8 mask; }; #endif /* _NF_CONNTRACK_TCP_H */ �������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_tcpmss.h�������������������������������������������������������������������������0000644�����������������00000000375�14763166027�0012115 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_TCPMSS_MATCH_H #define _XT_TCPMSS_MATCH_H #include <linux/types.h> struct xt_tcpmss_match_info { __u16 mss_min, mss_max; __u8 invert; }; #endif /*_XT_TCPMSS_MATCH_H*/ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_ipcomp.h�������������������������������������������������������������������������0000644�����������������00000000745�14763166027�0012074 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_IPCOMP_H #define _XT_IPCOMP_H #include <linux/types.h> struct xt_ipcomp { __u32 spis[2]; /* Security Parameter Index */ __u8 invflags; /* Inverse flags */ __u8 hdrres; /* Test of the Reserved Filed */ }; /* Values for "invflags" field in struct xt_ipcomp. */ #define XT_IPCOMP_INV_SPI 0x01 /* Invert the sense of spi. */ #define XT_IPCOMP_INV_MASK 0x01 /* All possible flags. */ #endif /*_XT_IPCOMP_H*/ ���������������������������linux/netfilter/xt_CHECKSUM.h�����������������������������������������������������������������������0000644�����������������00000001063�14763166027�0012001 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Header file for iptables ipt_CHECKSUM target * * (C) 2002 by Harald Welte <laforge@gnumonks.org> * (C) 2010 Red Hat Inc * Author: Michael S. Tsirkin <mst@redhat.com> * * This software is distributed under GNU GPL v2, 1991 */ #ifndef _XT_CHECKSUM_TARGET_H #define _XT_CHECKSUM_TARGET_H #include <linux/types.h> #define XT_CHECKSUM_OP_FILL 0x01 /* fill in checksum in IP header */ struct xt_CHECKSUM_info { __u8 operation; /* bitset of operations */ }; #endif /* _XT_CHECKSUM_TARGET_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_rpfilter.h�����������������������������������������������������������������������0000644�����������������00000000500�14763166027�0012421 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_RPATH_H #define _XT_RPATH_H #include <linux/types.h> enum { XT_RPFILTER_LOOSE = 1 << 0, XT_RPFILTER_VALID_MARK = 1 << 1, XT_RPFILTER_ACCEPT_LOCAL = 1 << 2, XT_RPFILTER_INVERT = 1 << 3, }; struct xt_rpfilter_info { __u8 flags; }; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_RATEEST.h������������������������������������������������������������������������0000644�����������������00000000606�14763166027�0011710 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_RATEEST_TARGET_H #define _XT_RATEEST_TARGET_H #include <linux/types.h> #include <linux/if.h> struct xt_rateest_target_info { char name[IFNAMSIZ]; __s8 interval; __u8 ewma_log; /* Used internally by the kernel */ struct xt_rateest *est __attribute__((aligned(8))); }; #endif /* _XT_RATEEST_TARGET_H */ ��������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_IDLETIMER.h����������������������������������������������������������������������0000644�����������������00000002561�14763166027�0012121 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/include/linux/netfilter/xt_IDLETIMER.h * * Header file for Xtables timer target module. * * Copyright (C) 2004, 2010 Nokia Corporation * Written by Timo Teras <ext-timo.teras@nokia.com> * * Converted to x_tables and forward-ported to 2.6.34 * by Luciano Coelho <luciano.coelho@nokia.com> * * Contact: Luciano Coelho <luciano.coelho@nokia.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * 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., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #ifndef _XT_IDLETIMER_H #define _XT_IDLETIMER_H #include <linux/types.h> #define MAX_IDLETIMER_LABEL_SIZE 28 struct idletimer_tg_info { __u32 timeout; char label[MAX_IDLETIMER_LABEL_SIZE]; /* for kernel module internal use only */ struct idletimer_tg *timer __attribute__((aligned(8))); }; #endif �����������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/nf_tables.h�������������������������������������������������������������������������0000644�����������������00000136631�14763166027�0012033 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_NF_TABLES_H #define _LINUX_NF_TABLES_H #define NFT_NAME_MAXLEN 256 #define NFT_TABLE_MAXNAMELEN NFT_NAME_MAXLEN #define NFT_CHAIN_MAXNAMELEN NFT_NAME_MAXLEN #define NFT_SET_MAXNAMELEN NFT_NAME_MAXLEN #define NFT_OBJ_MAXNAMELEN NFT_NAME_MAXLEN #define NFT_USERDATA_MAXLEN 256 #define NFT_OSF_MAXGENRELEN 16 /** * enum nft_registers - nf_tables registers * * nf_tables used to have five registers: a verdict register and four data * registers of size 16. The data registers have been changed to 16 registers * of size 4. For compatibility reasons, the NFT_REG_[1-4] registers still * map to areas of size 16, the 4 byte registers are addressed using * NFT_REG32_00 - NFT_REG32_15. */ enum nft_registers { NFT_REG_VERDICT, NFT_REG_1, NFT_REG_2, NFT_REG_3, NFT_REG_4, __NFT_REG_MAX, NFT_REG32_00 = 8, NFT_REG32_01, NFT_REG32_02, NFT_REG32_03, NFT_REG32_04, NFT_REG32_05, NFT_REG32_06, NFT_REG32_07, NFT_REG32_08, NFT_REG32_09, NFT_REG32_10, NFT_REG32_11, NFT_REG32_12, NFT_REG32_13, NFT_REG32_14, NFT_REG32_15, }; #define NFT_REG_MAX (__NFT_REG_MAX - 1) #define NFT_REG_SIZE 16 #define NFT_REG32_SIZE 4 /** * enum nft_verdicts - nf_tables internal verdicts * * @NFT_CONTINUE: continue evaluation of the current rule * @NFT_BREAK: terminate evaluation of the current rule * @NFT_JUMP: push the current chain on the jump stack and jump to a chain * @NFT_GOTO: jump to a chain without pushing the current chain on the jump stack * @NFT_RETURN: return to the topmost chain on the jump stack * * The nf_tables verdicts share their numeric space with the netfilter verdicts. */ enum nft_verdicts { NFT_CONTINUE = -1, NFT_BREAK = -2, NFT_JUMP = -3, NFT_GOTO = -4, NFT_RETURN = -5, }; /** * enum nf_tables_msg_types - nf_tables netlink message types * * @NFT_MSG_NEWTABLE: create a new table (enum nft_table_attributes) * @NFT_MSG_GETTABLE: get a table (enum nft_table_attributes) * @NFT_MSG_DELTABLE: delete a table (enum nft_table_attributes) * @NFT_MSG_NEWCHAIN: create a new chain (enum nft_chain_attributes) * @NFT_MSG_GETCHAIN: get a chain (enum nft_chain_attributes) * @NFT_MSG_DELCHAIN: delete a chain (enum nft_chain_attributes) * @NFT_MSG_NEWRULE: create a new rule (enum nft_rule_attributes) * @NFT_MSG_GETRULE: get a rule (enum nft_rule_attributes) * @NFT_MSG_DELRULE: delete a rule (enum nft_rule_attributes) * @NFT_MSG_NEWSET: create a new set (enum nft_set_attributes) * @NFT_MSG_GETSET: get a set (enum nft_set_attributes) * @NFT_MSG_DELSET: delete a set (enum nft_set_attributes) * @NFT_MSG_NEWSETELEM: create a new set element (enum nft_set_elem_attributes) * @NFT_MSG_GETSETELEM: get a set element (enum nft_set_elem_attributes) * @NFT_MSG_DELSETELEM: delete a set element (enum nft_set_elem_attributes) * @NFT_MSG_NEWGEN: announce a new generation, only for events (enum nft_gen_attributes) * @NFT_MSG_GETGEN: get the rule-set generation (enum nft_gen_attributes) * @NFT_MSG_TRACE: trace event (enum nft_trace_attributes) * @NFT_MSG_NEWOBJ: create a stateful object (enum nft_obj_attributes) * @NFT_MSG_GETOBJ: get a stateful object (enum nft_obj_attributes) * @NFT_MSG_DELOBJ: delete a stateful object (enum nft_obj_attributes) * @NFT_MSG_GETOBJ_RESET: get and reset a stateful object (enum nft_obj_attributes) * @NFT_MSG_NEWFLOWTABLE: add new flow table (enum nft_flowtable_attributes) * @NFT_MSG_GETFLOWTABLE: get flow table (enum nft_flowtable_attributes) * @NFT_MSG_DELFLOWTABLE: delete flow table (enum nft_flowtable_attributes) */ enum nf_tables_msg_types { NFT_MSG_NEWTABLE, NFT_MSG_GETTABLE, NFT_MSG_DELTABLE, NFT_MSG_NEWCHAIN, NFT_MSG_GETCHAIN, NFT_MSG_DELCHAIN, NFT_MSG_NEWRULE, NFT_MSG_GETRULE, NFT_MSG_DELRULE, NFT_MSG_NEWSET, NFT_MSG_GETSET, NFT_MSG_DELSET, NFT_MSG_NEWSETELEM, NFT_MSG_GETSETELEM, NFT_MSG_DELSETELEM, NFT_MSG_NEWGEN, NFT_MSG_GETGEN, NFT_MSG_TRACE, NFT_MSG_NEWOBJ, NFT_MSG_GETOBJ, NFT_MSG_DELOBJ, NFT_MSG_GETOBJ_RESET, NFT_MSG_NEWFLOWTABLE, NFT_MSG_GETFLOWTABLE, NFT_MSG_DELFLOWTABLE, NFT_MSG_MAX, }; /** * enum nft_list_attributes - nf_tables generic list netlink attributes * * @NFTA_LIST_ELEM: list element (NLA_NESTED) */ enum nft_list_attributes { NFTA_LIST_UNSPEC, NFTA_LIST_ELEM, __NFTA_LIST_MAX }; #define NFTA_LIST_MAX (__NFTA_LIST_MAX - 1) /** * enum nft_hook_attributes - nf_tables netfilter hook netlink attributes * * @NFTA_HOOK_HOOKNUM: netfilter hook number (NLA_U32) * @NFTA_HOOK_PRIORITY: netfilter hook priority (NLA_U32) * @NFTA_HOOK_DEV: netdevice name (NLA_STRING) */ enum nft_hook_attributes { NFTA_HOOK_UNSPEC, NFTA_HOOK_HOOKNUM, NFTA_HOOK_PRIORITY, NFTA_HOOK_DEV, __NFTA_HOOK_MAX }; #define NFTA_HOOK_MAX (__NFTA_HOOK_MAX - 1) /** * enum nft_table_flags - nf_tables table flags * * @NFT_TABLE_F_DORMANT: this table is not active */ enum nft_table_flags { NFT_TABLE_F_DORMANT = 0x1, }; /** * enum nft_table_attributes - nf_tables table netlink attributes * * @NFTA_TABLE_NAME: name of the table (NLA_STRING) * @NFTA_TABLE_FLAGS: bitmask of enum nft_table_flags (NLA_U32) * @NFTA_TABLE_USE: number of chains in this table (NLA_U32) */ enum nft_table_attributes { NFTA_TABLE_UNSPEC, NFTA_TABLE_NAME, NFTA_TABLE_FLAGS, NFTA_TABLE_USE, NFTA_TABLE_HANDLE, NFTA_TABLE_PAD, __NFTA_TABLE_MAX }; #define NFTA_TABLE_MAX (__NFTA_TABLE_MAX - 1) /** * enum nft_chain_attributes - nf_tables chain netlink attributes * * @NFTA_CHAIN_TABLE: name of the table containing the chain (NLA_STRING) * @NFTA_CHAIN_HANDLE: numeric handle of the chain (NLA_U64) * @NFTA_CHAIN_NAME: name of the chain (NLA_STRING) * @NFTA_CHAIN_HOOK: hook specification for basechains (NLA_NESTED: nft_hook_attributes) * @NFTA_CHAIN_POLICY: numeric policy of the chain (NLA_U32) * @NFTA_CHAIN_USE: number of references to this chain (NLA_U32) * @NFTA_CHAIN_TYPE: type name of the string (NLA_NUL_STRING) * @NFTA_CHAIN_COUNTERS: counter specification of the chain (NLA_NESTED: nft_counter_attributes) */ enum nft_chain_attributes { NFTA_CHAIN_UNSPEC, NFTA_CHAIN_TABLE, NFTA_CHAIN_HANDLE, NFTA_CHAIN_NAME, NFTA_CHAIN_HOOK, NFTA_CHAIN_POLICY, NFTA_CHAIN_USE, NFTA_CHAIN_TYPE, NFTA_CHAIN_COUNTERS, NFTA_CHAIN_PAD, __NFTA_CHAIN_MAX }; #define NFTA_CHAIN_MAX (__NFTA_CHAIN_MAX - 1) /** * enum nft_rule_attributes - nf_tables rule netlink attributes * * @NFTA_RULE_TABLE: name of the table containing the rule (NLA_STRING) * @NFTA_RULE_CHAIN: name of the chain containing the rule (NLA_STRING) * @NFTA_RULE_HANDLE: numeric handle of the rule (NLA_U64) * @NFTA_RULE_EXPRESSIONS: list of expressions (NLA_NESTED: nft_expr_attributes) * @NFTA_RULE_COMPAT: compatibility specifications of the rule (NLA_NESTED: nft_rule_compat_attributes) * @NFTA_RULE_POSITION: numeric handle of the previous rule (NLA_U64) * @NFTA_RULE_USERDATA: user data (NLA_BINARY, NFT_USERDATA_MAXLEN) * @NFTA_RULE_ID: uniquely identifies a rule in a transaction (NLA_U32) */ enum nft_rule_attributes { NFTA_RULE_UNSPEC, NFTA_RULE_TABLE, NFTA_RULE_CHAIN, NFTA_RULE_HANDLE, NFTA_RULE_EXPRESSIONS, NFTA_RULE_COMPAT, NFTA_RULE_POSITION, NFTA_RULE_USERDATA, NFTA_RULE_PAD, NFTA_RULE_ID, __NFTA_RULE_MAX }; #define NFTA_RULE_MAX (__NFTA_RULE_MAX - 1) /** * enum nft_rule_compat_flags - nf_tables rule compat flags * * @NFT_RULE_COMPAT_F_INV: invert the check result */ enum nft_rule_compat_flags { NFT_RULE_COMPAT_F_INV = (1 << 1), NFT_RULE_COMPAT_F_MASK = NFT_RULE_COMPAT_F_INV, }; /** * enum nft_rule_compat_attributes - nf_tables rule compat attributes * * @NFTA_RULE_COMPAT_PROTO: numeric value of handled protocol (NLA_U32) * @NFTA_RULE_COMPAT_FLAGS: bitmask of enum nft_rule_compat_flags (NLA_U32) */ enum nft_rule_compat_attributes { NFTA_RULE_COMPAT_UNSPEC, NFTA_RULE_COMPAT_PROTO, NFTA_RULE_COMPAT_FLAGS, __NFTA_RULE_COMPAT_MAX }; #define NFTA_RULE_COMPAT_MAX (__NFTA_RULE_COMPAT_MAX - 1) /** * enum nft_set_flags - nf_tables set flags * * @NFT_SET_ANONYMOUS: name allocation, automatic cleanup on unlink * @NFT_SET_CONSTANT: set contents may not change while bound * @NFT_SET_INTERVAL: set contains intervals * @NFT_SET_MAP: set is used as a dictionary * @NFT_SET_TIMEOUT: set uses timeouts * @NFT_SET_EVAL: set can be updated from the evaluation path * @NFT_SET_OBJECT: set contains stateful objects */ enum nft_set_flags { NFT_SET_ANONYMOUS = 0x1, NFT_SET_CONSTANT = 0x2, NFT_SET_INTERVAL = 0x4, NFT_SET_MAP = 0x8, NFT_SET_TIMEOUT = 0x10, NFT_SET_EVAL = 0x20, NFT_SET_OBJECT = 0x40, }; /** * enum nft_set_policies - set selection policy * * @NFT_SET_POL_PERFORMANCE: prefer high performance over low memory use * @NFT_SET_POL_MEMORY: prefer low memory use over high performance */ enum nft_set_policies { NFT_SET_POL_PERFORMANCE, NFT_SET_POL_MEMORY, }; /** * enum nft_set_desc_attributes - set element description * * @NFTA_SET_DESC_SIZE: number of elements in set (NLA_U32) */ enum nft_set_desc_attributes { NFTA_SET_DESC_UNSPEC, NFTA_SET_DESC_SIZE, __NFTA_SET_DESC_MAX }; #define NFTA_SET_DESC_MAX (__NFTA_SET_DESC_MAX - 1) /** * enum nft_set_attributes - nf_tables set netlink attributes * * @NFTA_SET_TABLE: table name (NLA_STRING) * @NFTA_SET_NAME: set name (NLA_STRING) * @NFTA_SET_FLAGS: bitmask of enum nft_set_flags (NLA_U32) * @NFTA_SET_KEY_TYPE: key data type, informational purpose only (NLA_U32) * @NFTA_SET_KEY_LEN: key data length (NLA_U32) * @NFTA_SET_DATA_TYPE: mapping data type (NLA_U32) * @NFTA_SET_DATA_LEN: mapping data length (NLA_U32) * @NFTA_SET_POLICY: selection policy (NLA_U32) * @NFTA_SET_DESC: set description (NLA_NESTED) * @NFTA_SET_ID: uniquely identifies a set in a transaction (NLA_U32) * @NFTA_SET_TIMEOUT: default timeout value (NLA_U64) * @NFTA_SET_GC_INTERVAL: garbage collection interval (NLA_U32) * @NFTA_SET_USERDATA: user data (NLA_BINARY) * @NFTA_SET_OBJ_TYPE: stateful object type (NLA_U32: NFT_OBJECT_*) * @NFTA_SET_HANDLE: set handle (NLA_U64) */ enum nft_set_attributes { NFTA_SET_UNSPEC, NFTA_SET_TABLE, NFTA_SET_NAME, NFTA_SET_FLAGS, NFTA_SET_KEY_TYPE, NFTA_SET_KEY_LEN, NFTA_SET_DATA_TYPE, NFTA_SET_DATA_LEN, NFTA_SET_POLICY, NFTA_SET_DESC, NFTA_SET_ID, NFTA_SET_TIMEOUT, NFTA_SET_GC_INTERVAL, NFTA_SET_USERDATA, NFTA_SET_PAD, NFTA_SET_OBJ_TYPE, NFTA_SET_HANDLE, __NFTA_SET_MAX }; #define NFTA_SET_MAX (__NFTA_SET_MAX - 1) /** * enum nft_set_elem_flags - nf_tables set element flags * * @NFT_SET_ELEM_INTERVAL_END: element ends the previous interval */ enum nft_set_elem_flags { NFT_SET_ELEM_INTERVAL_END = 0x1, }; /** * enum nft_set_elem_attributes - nf_tables set element netlink attributes * * @NFTA_SET_ELEM_KEY: key value (NLA_NESTED: nft_data) * @NFTA_SET_ELEM_DATA: data value of mapping (NLA_NESTED: nft_data_attributes) * @NFTA_SET_ELEM_FLAGS: bitmask of nft_set_elem_flags (NLA_U32) * @NFTA_SET_ELEM_TIMEOUT: timeout value (NLA_U64) * @NFTA_SET_ELEM_EXPIRATION: expiration time (NLA_U64) * @NFTA_SET_ELEM_USERDATA: user data (NLA_BINARY) * @NFTA_SET_ELEM_EXPR: expression (NLA_NESTED: nft_expr_attributes) * @NFTA_SET_ELEM_OBJREF: stateful object reference (NLA_STRING) */ enum nft_set_elem_attributes { NFTA_SET_ELEM_UNSPEC, NFTA_SET_ELEM_KEY, NFTA_SET_ELEM_DATA, NFTA_SET_ELEM_FLAGS, NFTA_SET_ELEM_TIMEOUT, NFTA_SET_ELEM_EXPIRATION, NFTA_SET_ELEM_USERDATA, NFTA_SET_ELEM_EXPR, NFTA_SET_ELEM_PAD, NFTA_SET_ELEM_OBJREF, __NFTA_SET_ELEM_MAX }; #define NFTA_SET_ELEM_MAX (__NFTA_SET_ELEM_MAX - 1) /** * enum nft_set_elem_list_attributes - nf_tables set element list netlink attributes * * @NFTA_SET_ELEM_LIST_TABLE: table of the set to be changed (NLA_STRING) * @NFTA_SET_ELEM_LIST_SET: name of the set to be changed (NLA_STRING) * @NFTA_SET_ELEM_LIST_ELEMENTS: list of set elements (NLA_NESTED: nft_set_elem_attributes) * @NFTA_SET_ELEM_LIST_SET_ID: uniquely identifies a set in a transaction (NLA_U32) */ enum nft_set_elem_list_attributes { NFTA_SET_ELEM_LIST_UNSPEC, NFTA_SET_ELEM_LIST_TABLE, NFTA_SET_ELEM_LIST_SET, NFTA_SET_ELEM_LIST_ELEMENTS, NFTA_SET_ELEM_LIST_SET_ID, __NFTA_SET_ELEM_LIST_MAX }; #define NFTA_SET_ELEM_LIST_MAX (__NFTA_SET_ELEM_LIST_MAX - 1) /** * enum nft_data_types - nf_tables data types * * @NFT_DATA_VALUE: generic data * @NFT_DATA_VERDICT: netfilter verdict * * The type of data is usually determined by the kernel directly and is not * explicitly specified by userspace. The only difference are sets, where * userspace specifies the key and mapping data types. * * The values 0xffffff00-0xffffffff are reserved for internally used types. * The remaining range can be freely used by userspace to encode types, all * values are equivalent to NFT_DATA_VALUE. */ enum nft_data_types { NFT_DATA_VALUE, NFT_DATA_VERDICT = 0xffffff00U, }; #define NFT_DATA_RESERVED_MASK 0xffffff00U /** * enum nft_data_attributes - nf_tables data netlink attributes * * @NFTA_DATA_VALUE: generic data (NLA_BINARY) * @NFTA_DATA_VERDICT: nf_tables verdict (NLA_NESTED: nft_verdict_attributes) */ enum nft_data_attributes { NFTA_DATA_UNSPEC, NFTA_DATA_VALUE, NFTA_DATA_VERDICT, __NFTA_DATA_MAX }; #define NFTA_DATA_MAX (__NFTA_DATA_MAX - 1) /* Maximum length of a value */ #define NFT_DATA_VALUE_MAXLEN 64 /** * enum nft_verdict_attributes - nf_tables verdict netlink attributes * * @NFTA_VERDICT_CODE: nf_tables verdict (NLA_U32: enum nft_verdicts) * @NFTA_VERDICT_CHAIN: jump target chain name (NLA_STRING) */ enum nft_verdict_attributes { NFTA_VERDICT_UNSPEC, NFTA_VERDICT_CODE, NFTA_VERDICT_CHAIN, __NFTA_VERDICT_MAX }; #define NFTA_VERDICT_MAX (__NFTA_VERDICT_MAX - 1) /** * enum nft_expr_attributes - nf_tables expression netlink attributes * * @NFTA_EXPR_NAME: name of the expression type (NLA_STRING) * @NFTA_EXPR_DATA: type specific data (NLA_NESTED) */ enum nft_expr_attributes { NFTA_EXPR_UNSPEC, NFTA_EXPR_NAME, NFTA_EXPR_DATA, __NFTA_EXPR_MAX }; #define NFTA_EXPR_MAX (__NFTA_EXPR_MAX - 1) /** * enum nft_immediate_attributes - nf_tables immediate expression netlink attributes * * @NFTA_IMMEDIATE_DREG: destination register to load data into (NLA_U32) * @NFTA_IMMEDIATE_DATA: data to load (NLA_NESTED: nft_data_attributes) */ enum nft_immediate_attributes { NFTA_IMMEDIATE_UNSPEC, NFTA_IMMEDIATE_DREG, NFTA_IMMEDIATE_DATA, __NFTA_IMMEDIATE_MAX }; #define NFTA_IMMEDIATE_MAX (__NFTA_IMMEDIATE_MAX - 1) /** * enum nft_bitwise_attributes - nf_tables bitwise expression netlink attributes * * @NFTA_BITWISE_SREG: source register (NLA_U32: nft_registers) * @NFTA_BITWISE_DREG: destination register (NLA_U32: nft_registers) * @NFTA_BITWISE_LEN: length of operands (NLA_U32) * @NFTA_BITWISE_MASK: mask value (NLA_NESTED: nft_data_attributes) * @NFTA_BITWISE_XOR: xor value (NLA_NESTED: nft_data_attributes) * * The bitwise expression performs the following operation: * * dreg = (sreg & mask) ^ xor * * which allow to express all bitwise operations: * * mask xor * NOT: 1 1 * OR: 0 x * XOR: 1 x * AND: x 0 */ enum nft_bitwise_attributes { NFTA_BITWISE_UNSPEC, NFTA_BITWISE_SREG, NFTA_BITWISE_DREG, NFTA_BITWISE_LEN, NFTA_BITWISE_MASK, NFTA_BITWISE_XOR, __NFTA_BITWISE_MAX }; #define NFTA_BITWISE_MAX (__NFTA_BITWISE_MAX - 1) /** * enum nft_byteorder_ops - nf_tables byteorder operators * * @NFT_BYTEORDER_NTOH: network to host operator * @NFT_BYTEORDER_HTON: host to network operator */ enum nft_byteorder_ops { NFT_BYTEORDER_NTOH, NFT_BYTEORDER_HTON, }; /** * enum nft_byteorder_attributes - nf_tables byteorder expression netlink attributes * * @NFTA_BYTEORDER_SREG: source register (NLA_U32: nft_registers) * @NFTA_BYTEORDER_DREG: destination register (NLA_U32: nft_registers) * @NFTA_BYTEORDER_OP: operator (NLA_U32: enum nft_byteorder_ops) * @NFTA_BYTEORDER_LEN: length of the data (NLA_U32) * @NFTA_BYTEORDER_SIZE: data size in bytes (NLA_U32: 2 or 4) */ enum nft_byteorder_attributes { NFTA_BYTEORDER_UNSPEC, NFTA_BYTEORDER_SREG, NFTA_BYTEORDER_DREG, NFTA_BYTEORDER_OP, NFTA_BYTEORDER_LEN, NFTA_BYTEORDER_SIZE, __NFTA_BYTEORDER_MAX }; #define NFTA_BYTEORDER_MAX (__NFTA_BYTEORDER_MAX - 1) /** * enum nft_cmp_ops - nf_tables relational operator * * @NFT_CMP_EQ: equal * @NFT_CMP_NEQ: not equal * @NFT_CMP_LT: less than * @NFT_CMP_LTE: less than or equal to * @NFT_CMP_GT: greater than * @NFT_CMP_GTE: greater than or equal to */ enum nft_cmp_ops { NFT_CMP_EQ, NFT_CMP_NEQ, NFT_CMP_LT, NFT_CMP_LTE, NFT_CMP_GT, NFT_CMP_GTE, }; /** * enum nft_cmp_attributes - nf_tables cmp expression netlink attributes * * @NFTA_CMP_SREG: source register of data to compare (NLA_U32: nft_registers) * @NFTA_CMP_OP: cmp operation (NLA_U32: nft_cmp_ops) * @NFTA_CMP_DATA: data to compare against (NLA_NESTED: nft_data_attributes) */ enum nft_cmp_attributes { NFTA_CMP_UNSPEC, NFTA_CMP_SREG, NFTA_CMP_OP, NFTA_CMP_DATA, __NFTA_CMP_MAX }; #define NFTA_CMP_MAX (__NFTA_CMP_MAX - 1) /** * enum nft_range_ops - nf_tables range operator * * @NFT_RANGE_EQ: equal * @NFT_RANGE_NEQ: not equal */ enum nft_range_ops { NFT_RANGE_EQ, NFT_RANGE_NEQ, }; /** * enum nft_range_attributes - nf_tables range expression netlink attributes * * @NFTA_RANGE_SREG: source register of data to compare (NLA_U32: nft_registers) * @NFTA_RANGE_OP: cmp operation (NLA_U32: nft_cmp_ops) * @NFTA_RANGE_FROM_DATA: data range from (NLA_NESTED: nft_data_attributes) * @NFTA_RANGE_TO_DATA: data range to (NLA_NESTED: nft_data_attributes) */ enum nft_range_attributes { NFTA_RANGE_UNSPEC, NFTA_RANGE_SREG, NFTA_RANGE_OP, NFTA_RANGE_FROM_DATA, NFTA_RANGE_TO_DATA, __NFTA_RANGE_MAX }; #define NFTA_RANGE_MAX (__NFTA_RANGE_MAX - 1) enum nft_lookup_flags { NFT_LOOKUP_F_INV = (1 << 0), }; /** * enum nft_lookup_attributes - nf_tables set lookup expression netlink attributes * * @NFTA_LOOKUP_SET: name of the set where to look for (NLA_STRING) * @NFTA_LOOKUP_SREG: source register of the data to look for (NLA_U32: nft_registers) * @NFTA_LOOKUP_DREG: destination register (NLA_U32: nft_registers) * @NFTA_LOOKUP_SET_ID: uniquely identifies a set in a transaction (NLA_U32) * @NFTA_LOOKUP_FLAGS: flags (NLA_U32: enum nft_lookup_flags) */ enum nft_lookup_attributes { NFTA_LOOKUP_UNSPEC, NFTA_LOOKUP_SET, NFTA_LOOKUP_SREG, NFTA_LOOKUP_DREG, NFTA_LOOKUP_SET_ID, NFTA_LOOKUP_FLAGS, __NFTA_LOOKUP_MAX }; #define NFTA_LOOKUP_MAX (__NFTA_LOOKUP_MAX - 1) enum nft_dynset_ops { NFT_DYNSET_OP_ADD, NFT_DYNSET_OP_UPDATE, }; enum nft_dynset_flags { NFT_DYNSET_F_INV = (1 << 0), }; /** * enum nft_dynset_attributes - dynset expression attributes * * @NFTA_DYNSET_SET_NAME: name of set the to add data to (NLA_STRING) * @NFTA_DYNSET_SET_ID: uniquely identifier of the set in the transaction (NLA_U32) * @NFTA_DYNSET_OP: operation (NLA_U32) * @NFTA_DYNSET_SREG_KEY: source register of the key (NLA_U32) * @NFTA_DYNSET_SREG_DATA: source register of the data (NLA_U32) * @NFTA_DYNSET_TIMEOUT: timeout value for the new element (NLA_U64) * @NFTA_DYNSET_EXPR: expression (NLA_NESTED: nft_expr_attributes) * @NFTA_DYNSET_FLAGS: flags (NLA_U32) */ enum nft_dynset_attributes { NFTA_DYNSET_UNSPEC, NFTA_DYNSET_SET_NAME, NFTA_DYNSET_SET_ID, NFTA_DYNSET_OP, NFTA_DYNSET_SREG_KEY, NFTA_DYNSET_SREG_DATA, NFTA_DYNSET_TIMEOUT, NFTA_DYNSET_EXPR, NFTA_DYNSET_PAD, NFTA_DYNSET_FLAGS, __NFTA_DYNSET_MAX, }; #define NFTA_DYNSET_MAX (__NFTA_DYNSET_MAX - 1) /** * enum nft_payload_bases - nf_tables payload expression offset bases * * @NFT_PAYLOAD_LL_HEADER: link layer header * @NFT_PAYLOAD_NETWORK_HEADER: network header * @NFT_PAYLOAD_TRANSPORT_HEADER: transport header */ enum nft_payload_bases { NFT_PAYLOAD_LL_HEADER, NFT_PAYLOAD_NETWORK_HEADER, NFT_PAYLOAD_TRANSPORT_HEADER, }; /** * enum nft_payload_csum_types - nf_tables payload expression checksum types * * @NFT_PAYLOAD_CSUM_NONE: no checksumming * @NFT_PAYLOAD_CSUM_INET: internet checksum (RFC 791) */ enum nft_payload_csum_types { NFT_PAYLOAD_CSUM_NONE, NFT_PAYLOAD_CSUM_INET, }; enum nft_payload_csum_flags { NFT_PAYLOAD_L4CSUM_PSEUDOHDR = (1 << 0), }; /** * enum nft_payload_attributes - nf_tables payload expression netlink attributes * * @NFTA_PAYLOAD_DREG: destination register to load data into (NLA_U32: nft_registers) * @NFTA_PAYLOAD_BASE: payload base (NLA_U32: nft_payload_bases) * @NFTA_PAYLOAD_OFFSET: payload offset relative to base (NLA_U32) * @NFTA_PAYLOAD_LEN: payload length (NLA_U32) * @NFTA_PAYLOAD_SREG: source register to load data from (NLA_U32: nft_registers) * @NFTA_PAYLOAD_CSUM_TYPE: checksum type (NLA_U32) * @NFTA_PAYLOAD_CSUM_OFFSET: checksum offset relative to base (NLA_U32) * @NFTA_PAYLOAD_CSUM_FLAGS: checksum flags (NLA_U32) */ enum nft_payload_attributes { NFTA_PAYLOAD_UNSPEC, NFTA_PAYLOAD_DREG, NFTA_PAYLOAD_BASE, NFTA_PAYLOAD_OFFSET, NFTA_PAYLOAD_LEN, NFTA_PAYLOAD_SREG, NFTA_PAYLOAD_CSUM_TYPE, NFTA_PAYLOAD_CSUM_OFFSET, NFTA_PAYLOAD_CSUM_FLAGS, __NFTA_PAYLOAD_MAX }; #define NFTA_PAYLOAD_MAX (__NFTA_PAYLOAD_MAX - 1) enum nft_exthdr_flags { NFT_EXTHDR_F_PRESENT = (1 << 0), }; /** * enum nft_exthdr_op - nf_tables match options * * @NFT_EXTHDR_OP_IPV6: match against ipv6 extension headers * @NFT_EXTHDR_OP_TCP: match against tcp options */ enum nft_exthdr_op { NFT_EXTHDR_OP_IPV6, NFT_EXTHDR_OP_TCPOPT, __NFT_EXTHDR_OP_MAX }; #define NFT_EXTHDR_OP_MAX (__NFT_EXTHDR_OP_MAX - 1) /** * enum nft_exthdr_attributes - nf_tables extension header expression netlink attributes * * @NFTA_EXTHDR_DREG: destination register (NLA_U32: nft_registers) * @NFTA_EXTHDR_TYPE: extension header type (NLA_U8) * @NFTA_EXTHDR_OFFSET: extension header offset (NLA_U32) * @NFTA_EXTHDR_LEN: extension header length (NLA_U32) * @NFTA_EXTHDR_FLAGS: extension header flags (NLA_U32) * @NFTA_EXTHDR_OP: option match type (NLA_U32) * @NFTA_EXTHDR_SREG: option match type (NLA_U32) */ enum nft_exthdr_attributes { NFTA_EXTHDR_UNSPEC, NFTA_EXTHDR_DREG, NFTA_EXTHDR_TYPE, NFTA_EXTHDR_OFFSET, NFTA_EXTHDR_LEN, NFTA_EXTHDR_FLAGS, NFTA_EXTHDR_OP, NFTA_EXTHDR_SREG, __NFTA_EXTHDR_MAX }; #define NFTA_EXTHDR_MAX (__NFTA_EXTHDR_MAX - 1) /** * enum nft_meta_keys - nf_tables meta expression keys * * @NFT_META_LEN: packet length (skb->len) * @NFT_META_PROTOCOL: packet ethertype protocol (skb->protocol), invalid in OUTPUT * @NFT_META_PRIORITY: packet priority (skb->priority) * @NFT_META_MARK: packet mark (skb->mark) * @NFT_META_IIF: packet input interface index (dev->ifindex) * @NFT_META_OIF: packet output interface index (dev->ifindex) * @NFT_META_IIFNAME: packet input interface name (dev->name) * @NFT_META_OIFNAME: packet output interface name (dev->name) * @NFT_META_IIFTYPE: packet input interface type (dev->type) * @NFT_META_OIFTYPE: packet output interface type (dev->type) * @NFT_META_SKUID: originating socket UID (fsuid) * @NFT_META_SKGID: originating socket GID (fsgid) * @NFT_META_NFTRACE: packet nftrace bit * @NFT_META_RTCLASSID: realm value of packet's route (skb->dst->tclassid) * @NFT_META_SECMARK: packet secmark (skb->secmark) * @NFT_META_NFPROTO: netfilter protocol * @NFT_META_L4PROTO: layer 4 protocol number * @NFT_META_BRI_IIFNAME: packet input bridge interface name * @NFT_META_BRI_OIFNAME: packet output bridge interface name * @NFT_META_PKTTYPE: packet type (skb->pkt_type), special handling for loopback * @NFT_META_CPU: cpu id through smp_processor_id() * @NFT_META_IIFGROUP: packet input interface group * @NFT_META_OIFGROUP: packet output interface group * @NFT_META_CGROUP: socket control group (skb->sk->sk_classid) * @NFT_META_PRANDOM: a 32bit pseudo-random number * @NFT_META_SECPATH: boolean, secpath_exists (!!skb->sp) */ enum nft_meta_keys { NFT_META_LEN, NFT_META_PROTOCOL, NFT_META_PRIORITY, NFT_META_MARK, NFT_META_IIF, NFT_META_OIF, NFT_META_IIFNAME, NFT_META_OIFNAME, NFT_META_IIFTYPE, NFT_META_OIFTYPE, NFT_META_SKUID, NFT_META_SKGID, NFT_META_NFTRACE, NFT_META_RTCLASSID, NFT_META_SECMARK, NFT_META_NFPROTO, NFT_META_L4PROTO, NFT_META_BRI_IIFNAME, NFT_META_BRI_OIFNAME, NFT_META_PKTTYPE, NFT_META_CPU, NFT_META_IIFGROUP, NFT_META_OIFGROUP, NFT_META_CGROUP, NFT_META_PRANDOM, NFT_META_SECPATH, }; /** * enum nft_rt_keys - nf_tables routing expression keys * * @NFT_RT_CLASSID: realm value of packet's route (skb->dst->tclassid) * @NFT_RT_NEXTHOP4: routing nexthop for IPv4 * @NFT_RT_NEXTHOP6: routing nexthop for IPv6 * @NFT_RT_TCPMSS: fetch current path tcp mss */ enum nft_rt_keys { NFT_RT_CLASSID, NFT_RT_NEXTHOP4, NFT_RT_NEXTHOP6, NFT_RT_TCPMSS, __NFT_RT_MAX }; #define NFT_RT_MAX (__NFT_RT_MAX - 1) /** * enum nft_hash_types - nf_tables hash expression types * * @NFT_HASH_JENKINS: Jenkins Hash * @NFT_HASH_SYM: Symmetric Hash */ enum nft_hash_types { NFT_HASH_JENKINS, NFT_HASH_SYM, }; /** * enum nft_hash_attributes - nf_tables hash expression netlink attributes * * @NFTA_HASH_SREG: source register (NLA_U32) * @NFTA_HASH_DREG: destination register (NLA_U32) * @NFTA_HASH_LEN: source data length (NLA_U32) * @NFTA_HASH_MODULUS: modulus value (NLA_U32) * @NFTA_HASH_SEED: seed value (NLA_U32) * @NFTA_HASH_OFFSET: add this offset value to hash result (NLA_U32) * @NFTA_HASH_TYPE: hash operation (NLA_U32: nft_hash_types) * @NFTA_HASH_SET_NAME: name of the map to lookup (NLA_STRING) * @NFTA_HASH_SET_ID: id of the map (NLA_U32) */ enum nft_hash_attributes { NFTA_HASH_UNSPEC, NFTA_HASH_SREG, NFTA_HASH_DREG, NFTA_HASH_LEN, NFTA_HASH_MODULUS, NFTA_HASH_SEED, NFTA_HASH_OFFSET, NFTA_HASH_TYPE, NFTA_HASH_SET_NAME, NFTA_HASH_SET_ID, __NFTA_HASH_MAX, }; #define NFTA_HASH_MAX (__NFTA_HASH_MAX - 1) /** * enum nft_meta_attributes - nf_tables meta expression netlink attributes * * @NFTA_META_DREG: destination register (NLA_U32) * @NFTA_META_KEY: meta data item to load (NLA_U32: nft_meta_keys) * @NFTA_META_SREG: source register (NLA_U32) */ enum nft_meta_attributes { NFTA_META_UNSPEC, NFTA_META_DREG, NFTA_META_KEY, NFTA_META_SREG, __NFTA_META_MAX }; #define NFTA_META_MAX (__NFTA_META_MAX - 1) /** * enum nft_rt_attributes - nf_tables routing expression netlink attributes * * @NFTA_RT_DREG: destination register (NLA_U32) * @NFTA_RT_KEY: routing data item to load (NLA_U32: nft_rt_keys) */ enum nft_rt_attributes { NFTA_RT_UNSPEC, NFTA_RT_DREG, NFTA_RT_KEY, __NFTA_RT_MAX }; #define NFTA_RT_MAX (__NFTA_RT_MAX - 1) /** * enum nft_socket_attributes - nf_tables socket expression netlink attributes * * @NFTA_SOCKET_KEY: socket key to match * @NFTA_SOCKET_DREG: destination register */ enum nft_socket_attributes { NFTA_SOCKET_UNSPEC, NFTA_SOCKET_KEY, NFTA_SOCKET_DREG, __NFTA_SOCKET_MAX }; #define NFTA_SOCKET_MAX (__NFTA_SOCKET_MAX - 1) /* * enum nft_socket_keys - nf_tables socket expression keys * * @NFT_SOCKET_TRANSPARENT: Value of the IP(V6)_TRANSPARENT socket option * @NFT_SOCKET_MARK: Value of the socket mark */ enum nft_socket_keys { NFT_SOCKET_TRANSPARENT, NFT_SOCKET_MARK, __NFT_SOCKET_MAX }; #define NFT_SOCKET_MAX (__NFT_SOCKET_MAX - 1) /** * enum nft_ct_keys - nf_tables ct expression keys * * @NFT_CT_STATE: conntrack state (bitmask of enum ip_conntrack_info) * @NFT_CT_DIRECTION: conntrack direction (enum ip_conntrack_dir) * @NFT_CT_STATUS: conntrack status (bitmask of enum ip_conntrack_status) * @NFT_CT_MARK: conntrack mark value * @NFT_CT_SECMARK: conntrack secmark value * @NFT_CT_EXPIRATION: relative conntrack expiration time in ms * @NFT_CT_HELPER: connection tracking helper assigned to conntrack * @NFT_CT_L3PROTOCOL: conntrack layer 3 protocol * @NFT_CT_SRC: conntrack layer 3 protocol source (IPv4/IPv6 address, deprecated) * @NFT_CT_DST: conntrack layer 3 protocol destination (IPv4/IPv6 address, deprecated) * @NFT_CT_PROTOCOL: conntrack layer 4 protocol * @NFT_CT_PROTO_SRC: conntrack layer 4 protocol source * @NFT_CT_PROTO_DST: conntrack layer 4 protocol destination * @NFT_CT_LABELS: conntrack labels * @NFT_CT_PKTS: conntrack packets * @NFT_CT_BYTES: conntrack bytes * @NFT_CT_AVGPKT: conntrack average bytes per packet * @NFT_CT_ZONE: conntrack zone * @NFT_CT_EVENTMASK: ctnetlink events to be generated for this conntrack * @NFT_CT_SRC_IP: conntrack layer 3 protocol source (IPv4 address) * @NFT_CT_DST_IP: conntrack layer 3 protocol destination (IPv4 address) * @NFT_CT_SRC_IP6: conntrack layer 3 protocol source (IPv6 address) * @NFT_CT_DST_IP6: conntrack layer 3 protocol destination (IPv6 address) * @NFT_CT_TIMEOUT: connection tracking timeout policy assigned to conntrack */ enum nft_ct_keys { NFT_CT_STATE, NFT_CT_DIRECTION, NFT_CT_STATUS, NFT_CT_MARK, NFT_CT_SECMARK, NFT_CT_EXPIRATION, NFT_CT_HELPER, NFT_CT_L3PROTOCOL, NFT_CT_SRC, NFT_CT_DST, NFT_CT_PROTOCOL, NFT_CT_PROTO_SRC, NFT_CT_PROTO_DST, NFT_CT_LABELS, NFT_CT_PKTS, NFT_CT_BYTES, NFT_CT_AVGPKT, NFT_CT_ZONE, NFT_CT_EVENTMASK, NFT_CT_SRC_IP, NFT_CT_DST_IP, NFT_CT_SRC_IP6, NFT_CT_DST_IP6, NFT_CT_TIMEOUT, __NFT_CT_MAX }; #define NFT_CT_MAX (__NFT_CT_MAX - 1) /** * enum nft_ct_attributes - nf_tables ct expression netlink attributes * * @NFTA_CT_DREG: destination register (NLA_U32) * @NFTA_CT_KEY: conntrack data item to load (NLA_U32: nft_ct_keys) * @NFTA_CT_DIRECTION: direction in case of directional keys (NLA_U8) * @NFTA_CT_SREG: source register (NLA_U32) */ enum nft_ct_attributes { NFTA_CT_UNSPEC, NFTA_CT_DREG, NFTA_CT_KEY, NFTA_CT_DIRECTION, NFTA_CT_SREG, __NFTA_CT_MAX }; #define NFTA_CT_MAX (__NFTA_CT_MAX - 1) /** * enum nft_flow_attributes - ct offload expression attributes * @NFTA_FLOW_TABLE_NAME: flow table name (NLA_STRING) */ enum nft_offload_attributes { NFTA_FLOW_UNSPEC, NFTA_FLOW_TABLE_NAME, __NFTA_FLOW_MAX, }; #define NFTA_FLOW_MAX (__NFTA_FLOW_MAX - 1) enum nft_limit_type { NFT_LIMIT_PKTS, NFT_LIMIT_PKT_BYTES }; enum nft_limit_flags { NFT_LIMIT_F_INV = (1 << 0), }; /** * enum nft_limit_attributes - nf_tables limit expression netlink attributes * * @NFTA_LIMIT_RATE: refill rate (NLA_U64) * @NFTA_LIMIT_UNIT: refill unit (NLA_U64) * @NFTA_LIMIT_BURST: burst (NLA_U32) * @NFTA_LIMIT_TYPE: type of limit (NLA_U32: enum nft_limit_type) * @NFTA_LIMIT_FLAGS: flags (NLA_U32: enum nft_limit_flags) */ enum nft_limit_attributes { NFTA_LIMIT_UNSPEC, NFTA_LIMIT_RATE, NFTA_LIMIT_UNIT, NFTA_LIMIT_BURST, NFTA_LIMIT_TYPE, NFTA_LIMIT_FLAGS, NFTA_LIMIT_PAD, __NFTA_LIMIT_MAX }; #define NFTA_LIMIT_MAX (__NFTA_LIMIT_MAX - 1) enum nft_connlimit_flags { NFT_CONNLIMIT_F_INV = (1 << 0), }; /** * enum nft_connlimit_attributes - nf_tables connlimit expression netlink attributes * * @NFTA_CONNLIMIT_COUNT: number of connections (NLA_U32) * @NFTA_CONNLIMIT_FLAGS: flags (NLA_U32: enum nft_connlimit_flags) */ enum nft_connlimit_attributes { NFTA_CONNLIMIT_UNSPEC, NFTA_CONNLIMIT_COUNT, NFTA_CONNLIMIT_FLAGS, __NFTA_CONNLIMIT_MAX }; #define NFTA_CONNLIMIT_MAX (__NFTA_CONNLIMIT_MAX - 1) /** * enum nft_counter_attributes - nf_tables counter expression netlink attributes * * @NFTA_COUNTER_BYTES: number of bytes (NLA_U64) * @NFTA_COUNTER_PACKETS: number of packets (NLA_U64) */ enum nft_counter_attributes { NFTA_COUNTER_UNSPEC, NFTA_COUNTER_BYTES, NFTA_COUNTER_PACKETS, NFTA_COUNTER_PAD, __NFTA_COUNTER_MAX }; #define NFTA_COUNTER_MAX (__NFTA_COUNTER_MAX - 1) /** * enum nft_log_attributes - nf_tables log expression netlink attributes * * @NFTA_LOG_GROUP: netlink group to send messages to (NLA_U32) * @NFTA_LOG_PREFIX: prefix to prepend to log messages (NLA_STRING) * @NFTA_LOG_SNAPLEN: length of payload to include in netlink message (NLA_U32) * @NFTA_LOG_QTHRESHOLD: queue threshold (NLA_U32) * @NFTA_LOG_LEVEL: log level (NLA_U32) * @NFTA_LOG_FLAGS: logging flags (NLA_U32) */ enum nft_log_attributes { NFTA_LOG_UNSPEC, NFTA_LOG_GROUP, NFTA_LOG_PREFIX, NFTA_LOG_SNAPLEN, NFTA_LOG_QTHRESHOLD, NFTA_LOG_LEVEL, NFTA_LOG_FLAGS, __NFTA_LOG_MAX }; #define NFTA_LOG_MAX (__NFTA_LOG_MAX - 1) /** * enum nft_log_level - nf_tables log levels * * @NFT_LOGLEVEL_EMERG: system is unusable * @NFT_LOGLEVEL_ALERT: action must be taken immediately * @NFT_LOGLEVEL_CRIT: critical conditions * @NFT_LOGLEVEL_ERR: error conditions * @NFT_LOGLEVEL_WARNING: warning conditions * @NFT_LOGLEVEL_NOTICE: normal but significant condition * @NFT_LOGLEVEL_INFO: informational * @NFT_LOGLEVEL_DEBUG: debug-level messages * @NFT_LOGLEVEL_AUDIT: enabling audit logging */ enum nft_log_level { NFT_LOGLEVEL_EMERG, NFT_LOGLEVEL_ALERT, NFT_LOGLEVEL_CRIT, NFT_LOGLEVEL_ERR, NFT_LOGLEVEL_WARNING, NFT_LOGLEVEL_NOTICE, NFT_LOGLEVEL_INFO, NFT_LOGLEVEL_DEBUG, NFT_LOGLEVEL_AUDIT, __NFT_LOGLEVEL_MAX }; #define NFT_LOGLEVEL_MAX (__NFT_LOGLEVEL_MAX - 1) /** * enum nft_queue_attributes - nf_tables queue expression netlink attributes * * @NFTA_QUEUE_NUM: netlink queue to send messages to (NLA_U16) * @NFTA_QUEUE_TOTAL: number of queues to load balance packets on (NLA_U16) * @NFTA_QUEUE_FLAGS: various flags (NLA_U16) * @NFTA_QUEUE_SREG_QNUM: source register of queue number (NLA_U32: nft_registers) */ enum nft_queue_attributes { NFTA_QUEUE_UNSPEC, NFTA_QUEUE_NUM, NFTA_QUEUE_TOTAL, NFTA_QUEUE_FLAGS, NFTA_QUEUE_SREG_QNUM, __NFTA_QUEUE_MAX }; #define NFTA_QUEUE_MAX (__NFTA_QUEUE_MAX - 1) #define NFT_QUEUE_FLAG_BYPASS 0x01 /* for compatibility with v2 */ #define NFT_QUEUE_FLAG_CPU_FANOUT 0x02 /* use current CPU (no hashing) */ #define NFT_QUEUE_FLAG_MASK 0x03 enum nft_quota_flags { NFT_QUOTA_F_INV = (1 << 0), NFT_QUOTA_F_DEPLETED = (1 << 1), }; /** * enum nft_quota_attributes - nf_tables quota expression netlink attributes * * @NFTA_QUOTA_BYTES: quota in bytes (NLA_U16) * @NFTA_QUOTA_FLAGS: flags (NLA_U32) * @NFTA_QUOTA_CONSUMED: quota already consumed in bytes (NLA_U64) */ enum nft_quota_attributes { NFTA_QUOTA_UNSPEC, NFTA_QUOTA_BYTES, NFTA_QUOTA_FLAGS, NFTA_QUOTA_PAD, NFTA_QUOTA_CONSUMED, __NFTA_QUOTA_MAX }; #define NFTA_QUOTA_MAX (__NFTA_QUOTA_MAX - 1) /** * enum nft_reject_types - nf_tables reject expression reject types * * @NFT_REJECT_ICMP_UNREACH: reject using ICMP unreachable * @NFT_REJECT_TCP_RST: reject using TCP RST * @NFT_REJECT_ICMPX_UNREACH: abstracted ICMP unreachable for bridge and inet */ enum nft_reject_types { NFT_REJECT_ICMP_UNREACH, NFT_REJECT_TCP_RST, NFT_REJECT_ICMPX_UNREACH, }; /** * enum nft_reject_code - Generic reject codes for IPv4/IPv6 * * @NFT_REJECT_ICMPX_NO_ROUTE: no route to host / network unreachable * @NFT_REJECT_ICMPX_PORT_UNREACH: port unreachable * @NFT_REJECT_ICMPX_HOST_UNREACH: host unreachable * @NFT_REJECT_ICMPX_ADMIN_PROHIBITED: administratively prohibited * * These codes are mapped to real ICMP and ICMPv6 codes. */ enum nft_reject_inet_code { NFT_REJECT_ICMPX_NO_ROUTE = 0, NFT_REJECT_ICMPX_PORT_UNREACH, NFT_REJECT_ICMPX_HOST_UNREACH, NFT_REJECT_ICMPX_ADMIN_PROHIBITED, __NFT_REJECT_ICMPX_MAX }; #define NFT_REJECT_ICMPX_MAX (__NFT_REJECT_ICMPX_MAX - 1) /** * enum nft_reject_attributes - nf_tables reject expression netlink attributes * * @NFTA_REJECT_TYPE: packet type to use (NLA_U32: nft_reject_types) * @NFTA_REJECT_ICMP_CODE: ICMP code to use (NLA_U8) */ enum nft_reject_attributes { NFTA_REJECT_UNSPEC, NFTA_REJECT_TYPE, NFTA_REJECT_ICMP_CODE, __NFTA_REJECT_MAX }; #define NFTA_REJECT_MAX (__NFTA_REJECT_MAX - 1) /** * enum nft_nat_types - nf_tables nat expression NAT types * * @NFT_NAT_SNAT: source NAT * @NFT_NAT_DNAT: destination NAT */ enum nft_nat_types { NFT_NAT_SNAT, NFT_NAT_DNAT, }; /** * enum nft_nat_attributes - nf_tables nat expression netlink attributes * * @NFTA_NAT_TYPE: NAT type (NLA_U32: nft_nat_types) * @NFTA_NAT_FAMILY: NAT family (NLA_U32) * @NFTA_NAT_REG_ADDR_MIN: source register of address range start (NLA_U32: nft_registers) * @NFTA_NAT_REG_ADDR_MAX: source register of address range end (NLA_U32: nft_registers) * @NFTA_NAT_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers) * @NFTA_NAT_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers) * @NFTA_NAT_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32) */ enum nft_nat_attributes { NFTA_NAT_UNSPEC, NFTA_NAT_TYPE, NFTA_NAT_FAMILY, NFTA_NAT_REG_ADDR_MIN, NFTA_NAT_REG_ADDR_MAX, NFTA_NAT_REG_PROTO_MIN, NFTA_NAT_REG_PROTO_MAX, NFTA_NAT_FLAGS, __NFTA_NAT_MAX }; #define NFTA_NAT_MAX (__NFTA_NAT_MAX - 1) /** * enum nft_tproxy_attributes - nf_tables tproxy expression netlink attributes * * NFTA_TPROXY_FAMILY: Target address family (NLA_U32: nft_registers) * NFTA_TPROXY_REG_ADDR: Target address register (NLA_U32: nft_registers) * NFTA_TPROXY_REG_PORT: Target port register (NLA_U32: nft_registers) */ enum nft_tproxy_attributes { NFTA_TPROXY_UNSPEC, NFTA_TPROXY_FAMILY, NFTA_TPROXY_REG_ADDR, NFTA_TPROXY_REG_PORT, __NFTA_TPROXY_MAX }; #define NFTA_TPROXY_MAX (__NFTA_TPROXY_MAX - 1) /** * enum nft_masq_attributes - nf_tables masquerade expression attributes * * @NFTA_MASQ_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32) * @NFTA_MASQ_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers) * @NFTA_MASQ_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers) */ enum nft_masq_attributes { NFTA_MASQ_UNSPEC, NFTA_MASQ_FLAGS, NFTA_MASQ_REG_PROTO_MIN, NFTA_MASQ_REG_PROTO_MAX, __NFTA_MASQ_MAX }; #define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1) /** * enum nft_redir_attributes - nf_tables redirect expression netlink attributes * * @NFTA_REDIR_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers) * @NFTA_REDIR_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers) * @NFTA_REDIR_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32) */ enum nft_redir_attributes { NFTA_REDIR_UNSPEC, NFTA_REDIR_REG_PROTO_MIN, NFTA_REDIR_REG_PROTO_MAX, NFTA_REDIR_FLAGS, __NFTA_REDIR_MAX }; #define NFTA_REDIR_MAX (__NFTA_REDIR_MAX - 1) /** * enum nft_dup_attributes - nf_tables dup expression netlink attributes * * @NFTA_DUP_SREG_ADDR: source register of address (NLA_U32: nft_registers) * @NFTA_DUP_SREG_DEV: source register of output interface (NLA_U32: nft_register) */ enum nft_dup_attributes { NFTA_DUP_UNSPEC, NFTA_DUP_SREG_ADDR, NFTA_DUP_SREG_DEV, __NFTA_DUP_MAX }; #define NFTA_DUP_MAX (__NFTA_DUP_MAX - 1) /** * enum nft_fwd_attributes - nf_tables fwd expression netlink attributes * * @NFTA_FWD_SREG_DEV: source register of output interface (NLA_U32: nft_register) * @NFTA_FWD_SREG_ADDR: source register of destination address (NLA_U32: nft_register) * @NFTA_FWD_NFPROTO: layer 3 family of source register address (NLA_U32: enum nfproto) */ enum nft_fwd_attributes { NFTA_FWD_UNSPEC, NFTA_FWD_SREG_DEV, NFTA_FWD_SREG_ADDR, NFTA_FWD_NFPROTO, __NFTA_FWD_MAX }; #define NFTA_FWD_MAX (__NFTA_FWD_MAX - 1) /** * enum nft_objref_attributes - nf_tables stateful object expression netlink attributes * * @NFTA_OBJREF_IMM_TYPE: object type for immediate reference (NLA_U32: nft_register) * @NFTA_OBJREF_IMM_NAME: object name for immediate reference (NLA_STRING) * @NFTA_OBJREF_SET_SREG: source register of the data to look for (NLA_U32: nft_registers) * @NFTA_OBJREF_SET_NAME: name of the set where to look for (NLA_STRING) * @NFTA_OBJREF_SET_ID: id of the set where to look for in this transaction (NLA_U32) */ enum nft_objref_attributes { NFTA_OBJREF_UNSPEC, NFTA_OBJREF_IMM_TYPE, NFTA_OBJREF_IMM_NAME, NFTA_OBJREF_SET_SREG, NFTA_OBJREF_SET_NAME, NFTA_OBJREF_SET_ID, __NFTA_OBJREF_MAX }; #define NFTA_OBJREF_MAX (__NFTA_OBJREF_MAX - 1) /** * enum nft_gen_attributes - nf_tables ruleset generation attributes * * @NFTA_GEN_ID: Ruleset generation ID (NLA_U32) */ enum nft_gen_attributes { NFTA_GEN_UNSPEC, NFTA_GEN_ID, NFTA_GEN_PROC_PID, NFTA_GEN_PROC_NAME, __NFTA_GEN_MAX }; #define NFTA_GEN_MAX (__NFTA_GEN_MAX - 1) /* * enum nft_fib_attributes - nf_tables fib expression netlink attributes * * @NFTA_FIB_DREG: destination register (NLA_U32) * @NFTA_FIB_RESULT: desired result (NLA_U32) * @NFTA_FIB_FLAGS: flowi fields to initialize when querying the FIB (NLA_U32) * * The FIB expression performs a route lookup according * to the packet data. */ enum nft_fib_attributes { NFTA_FIB_UNSPEC, NFTA_FIB_DREG, NFTA_FIB_RESULT, NFTA_FIB_FLAGS, __NFTA_FIB_MAX }; #define NFTA_FIB_MAX (__NFTA_FIB_MAX - 1) enum nft_fib_result { NFT_FIB_RESULT_UNSPEC, NFT_FIB_RESULT_OIF, NFT_FIB_RESULT_OIFNAME, NFT_FIB_RESULT_ADDRTYPE, __NFT_FIB_RESULT_MAX }; #define NFT_FIB_RESULT_MAX (__NFT_FIB_RESULT_MAX - 1) enum nft_fib_flags { NFTA_FIB_F_SADDR = 1 << 0, /* look up src */ NFTA_FIB_F_DADDR = 1 << 1, /* look up dst */ NFTA_FIB_F_MARK = 1 << 2, /* use skb->mark */ NFTA_FIB_F_IIF = 1 << 3, /* restrict to iif */ NFTA_FIB_F_OIF = 1 << 4, /* restrict to oif */ NFTA_FIB_F_PRESENT = 1 << 5, /* check existence only */ }; enum nft_ct_helper_attributes { NFTA_CT_HELPER_UNSPEC, NFTA_CT_HELPER_NAME, NFTA_CT_HELPER_L3PROTO, NFTA_CT_HELPER_L4PROTO, __NFTA_CT_HELPER_MAX, }; #define NFTA_CT_HELPER_MAX (__NFTA_CT_HELPER_MAX - 1) enum nft_ct_timeout_timeout_attributes { NFTA_CT_TIMEOUT_UNSPEC, NFTA_CT_TIMEOUT_L3PROTO, NFTA_CT_TIMEOUT_L4PROTO, NFTA_CT_TIMEOUT_DATA, __NFTA_CT_TIMEOUT_MAX, }; #define NFTA_CT_TIMEOUT_MAX (__NFTA_CT_TIMEOUT_MAX - 1) #define NFT_OBJECT_UNSPEC 0 #define NFT_OBJECT_COUNTER 1 #define NFT_OBJECT_QUOTA 2 #define NFT_OBJECT_CT_HELPER 3 #define NFT_OBJECT_LIMIT 4 #define NFT_OBJECT_CONNLIMIT 5 #define NFT_OBJECT_TUNNEL 6 #define NFT_OBJECT_CT_TIMEOUT 7 #define __NFT_OBJECT_MAX 8 #define NFT_OBJECT_MAX (__NFT_OBJECT_MAX - 1) /** * enum nft_object_attributes - nf_tables stateful object netlink attributes * * @NFTA_OBJ_TABLE: name of the table containing the expression (NLA_STRING) * @NFTA_OBJ_NAME: name of this expression type (NLA_STRING) * @NFTA_OBJ_TYPE: stateful object type (NLA_U32) * @NFTA_OBJ_DATA: stateful object data (NLA_NESTED) * @NFTA_OBJ_USE: number of references to this expression (NLA_U32) * @NFTA_OBJ_HANDLE: object handle (NLA_U64) */ enum nft_object_attributes { NFTA_OBJ_UNSPEC, NFTA_OBJ_TABLE, NFTA_OBJ_NAME, NFTA_OBJ_TYPE, NFTA_OBJ_DATA, NFTA_OBJ_USE, NFTA_OBJ_HANDLE, NFTA_OBJ_PAD, __NFTA_OBJ_MAX }; #define NFTA_OBJ_MAX (__NFTA_OBJ_MAX - 1) /** * enum nft_flowtable_attributes - nf_tables flow table netlink attributes * * @NFTA_FLOWTABLE_TABLE: name of the table containing the expression (NLA_STRING) * @NFTA_FLOWTABLE_NAME: name of this flow table (NLA_STRING) * @NFTA_FLOWTABLE_HOOK: netfilter hook configuration(NLA_U32) * @NFTA_FLOWTABLE_USE: number of references to this flow table (NLA_U32) * @NFTA_FLOWTABLE_HANDLE: object handle (NLA_U64) */ enum nft_flowtable_attributes { NFTA_FLOWTABLE_UNSPEC, NFTA_FLOWTABLE_TABLE, NFTA_FLOWTABLE_NAME, NFTA_FLOWTABLE_HOOK, NFTA_FLOWTABLE_USE, NFTA_FLOWTABLE_HANDLE, NFTA_FLOWTABLE_PAD, __NFTA_FLOWTABLE_MAX }; #define NFTA_FLOWTABLE_MAX (__NFTA_FLOWTABLE_MAX - 1) /** * enum nft_flowtable_hook_attributes - nf_tables flow table hook netlink attributes * * @NFTA_FLOWTABLE_HOOK_NUM: netfilter hook number (NLA_U32) * @NFTA_FLOWTABLE_HOOK_PRIORITY: netfilter hook priority (NLA_U32) * @NFTA_FLOWTABLE_HOOK_DEVS: input devices this flow table is bound to (NLA_NESTED) */ enum nft_flowtable_hook_attributes { NFTA_FLOWTABLE_HOOK_UNSPEC, NFTA_FLOWTABLE_HOOK_NUM, NFTA_FLOWTABLE_HOOK_PRIORITY, NFTA_FLOWTABLE_HOOK_DEVS, __NFTA_FLOWTABLE_HOOK_MAX }; #define NFTA_FLOWTABLE_HOOK_MAX (__NFTA_FLOWTABLE_HOOK_MAX - 1) enum nft_osf_attributes { NFTA_OSF_UNSPEC, NFTA_OSF_DREG, __NFTA_OSF_MAX, }; #define NFTA_OSF_MAX (__NFTA_OSF_MAX - 1) /** * enum nft_device_attributes - nf_tables device netlink attributes * * @NFTA_DEVICE_NAME: name of this device (NLA_STRING) */ enum nft_devices_attributes { NFTA_DEVICE_UNSPEC, NFTA_DEVICE_NAME, __NFTA_DEVICE_MAX }; #define NFTA_DEVICE_MAX (__NFTA_DEVICE_MAX - 1) /** * enum nft_trace_attributes - nf_tables trace netlink attributes * * @NFTA_TRACE_TABLE: name of the table (NLA_STRING) * @NFTA_TRACE_CHAIN: name of the chain (NLA_STRING) * @NFTA_TRACE_RULE_HANDLE: numeric handle of the rule (NLA_U64) * @NFTA_TRACE_TYPE: type of the event (NLA_U32: nft_trace_types) * @NFTA_TRACE_VERDICT: verdict returned by hook (NLA_NESTED: nft_verdicts) * @NFTA_TRACE_ID: pseudo-id, same for each skb traced (NLA_U32) * @NFTA_TRACE_LL_HEADER: linklayer header (NLA_BINARY) * @NFTA_TRACE_NETWORK_HEADER: network header (NLA_BINARY) * @NFTA_TRACE_TRANSPORT_HEADER: transport header (NLA_BINARY) * @NFTA_TRACE_IIF: indev ifindex (NLA_U32) * @NFTA_TRACE_IIFTYPE: netdev->type of indev (NLA_U16) * @NFTA_TRACE_OIF: outdev ifindex (NLA_U32) * @NFTA_TRACE_OIFTYPE: netdev->type of outdev (NLA_U16) * @NFTA_TRACE_MARK: nfmark (NLA_U32) * @NFTA_TRACE_NFPROTO: nf protocol processed (NLA_U32) * @NFTA_TRACE_POLICY: policy that decided fate of packet (NLA_U32) */ enum nft_trace_attributes { NFTA_TRACE_UNSPEC, NFTA_TRACE_TABLE, NFTA_TRACE_CHAIN, NFTA_TRACE_RULE_HANDLE, NFTA_TRACE_TYPE, NFTA_TRACE_VERDICT, NFTA_TRACE_ID, NFTA_TRACE_LL_HEADER, NFTA_TRACE_NETWORK_HEADER, NFTA_TRACE_TRANSPORT_HEADER, NFTA_TRACE_IIF, NFTA_TRACE_IIFTYPE, NFTA_TRACE_OIF, NFTA_TRACE_OIFTYPE, NFTA_TRACE_MARK, NFTA_TRACE_NFPROTO, NFTA_TRACE_POLICY, NFTA_TRACE_PAD, __NFTA_TRACE_MAX }; #define NFTA_TRACE_MAX (__NFTA_TRACE_MAX - 1) enum nft_trace_types { NFT_TRACETYPE_UNSPEC, NFT_TRACETYPE_POLICY, NFT_TRACETYPE_RETURN, NFT_TRACETYPE_RULE, __NFT_TRACETYPE_MAX }; #define NFT_TRACETYPE_MAX (__NFT_TRACETYPE_MAX - 1) /** * enum nft_ng_attributes - nf_tables number generator expression netlink attributes * * @NFTA_NG_DREG: destination register (NLA_U32) * @NFTA_NG_MODULUS: maximum counter value (NLA_U32) * @NFTA_NG_TYPE: operation type (NLA_U32) * @NFTA_NG_OFFSET: offset to be added to the counter (NLA_U32) * @NFTA_NG_SET_NAME: name of the map to lookup (NLA_STRING) * @NFTA_NG_SET_ID: id of the map (NLA_U32) */ enum nft_ng_attributes { NFTA_NG_UNSPEC, NFTA_NG_DREG, NFTA_NG_MODULUS, NFTA_NG_TYPE, NFTA_NG_OFFSET, NFTA_NG_SET_NAME, /* deprecated */ NFTA_NG_SET_ID, /* deprecated */ __NFTA_NG_MAX }; #define NFTA_NG_MAX (__NFTA_NG_MAX - 1) enum nft_ng_types { NFT_NG_INCREMENTAL, NFT_NG_RANDOM, __NFT_NG_MAX }; #define NFT_NG_MAX (__NFT_NG_MAX - 1) enum nft_tunnel_key_ip_attributes { NFTA_TUNNEL_KEY_IP_UNSPEC, NFTA_TUNNEL_KEY_IP_SRC, NFTA_TUNNEL_KEY_IP_DST, __NFTA_TUNNEL_KEY_IP_MAX }; #define NFTA_TUNNEL_KEY_IP_MAX (__NFTA_TUNNEL_KEY_IP_MAX - 1) enum nft_tunnel_ip6_attributes { NFTA_TUNNEL_KEY_IP6_UNSPEC, NFTA_TUNNEL_KEY_IP6_SRC, NFTA_TUNNEL_KEY_IP6_DST, NFTA_TUNNEL_KEY_IP6_FLOWLABEL, __NFTA_TUNNEL_KEY_IP6_MAX }; #define NFTA_TUNNEL_KEY_IP6_MAX (__NFTA_TUNNEL_KEY_IP6_MAX - 1) enum nft_tunnel_opts_attributes { NFTA_TUNNEL_KEY_OPTS_UNSPEC, NFTA_TUNNEL_KEY_OPTS_VXLAN, NFTA_TUNNEL_KEY_OPTS_ERSPAN, __NFTA_TUNNEL_KEY_OPTS_MAX }; #define NFTA_TUNNEL_KEY_OPTS_MAX (__NFTA_TUNNEL_KEY_OPTS_MAX - 1) enum nft_tunnel_opts_vxlan_attributes { NFTA_TUNNEL_KEY_VXLAN_UNSPEC, NFTA_TUNNEL_KEY_VXLAN_GBP, __NFTA_TUNNEL_KEY_VXLAN_MAX }; #define NFTA_TUNNEL_KEY_VXLAN_MAX (__NFTA_TUNNEL_KEY_VXLAN_MAX - 1) enum nft_tunnel_opts_erspan_attributes { NFTA_TUNNEL_KEY_ERSPAN_UNSPEC, NFTA_TUNNEL_KEY_ERSPAN_VERSION, NFTA_TUNNEL_KEY_ERSPAN_V1_INDEX, NFTA_TUNNEL_KEY_ERSPAN_V2_HWID, NFTA_TUNNEL_KEY_ERSPAN_V2_DIR, __NFTA_TUNNEL_KEY_ERSPAN_MAX }; #define NFTA_TUNNEL_KEY_ERSPAN_MAX (__NFTA_TUNNEL_KEY_ERSPAN_MAX - 1) enum nft_tunnel_flags { NFT_TUNNEL_F_ZERO_CSUM_TX = (1 << 0), NFT_TUNNEL_F_DONT_FRAGMENT = (1 << 1), NFT_TUNNEL_F_SEQ_NUMBER = (1 << 2), }; #define NFT_TUNNEL_F_MASK (NFT_TUNNEL_F_ZERO_CSUM_TX | \ NFT_TUNNEL_F_DONT_FRAGMENT | \ NFT_TUNNEL_F_SEQ_NUMBER) enum nft_tunnel_key_attributes { NFTA_TUNNEL_KEY_UNSPEC, NFTA_TUNNEL_KEY_ID, NFTA_TUNNEL_KEY_IP, NFTA_TUNNEL_KEY_IP6, NFTA_TUNNEL_KEY_FLAGS, NFTA_TUNNEL_KEY_TOS, NFTA_TUNNEL_KEY_TTL, NFTA_TUNNEL_KEY_SPORT, NFTA_TUNNEL_KEY_DPORT, NFTA_TUNNEL_KEY_OPTS, __NFTA_TUNNEL_KEY_MAX }; #define NFTA_TUNNEL_KEY_MAX (__NFTA_TUNNEL_KEY_MAX - 1) enum nft_tunnel_keys { NFT_TUNNEL_PATH, NFT_TUNNEL_ID, __NFT_TUNNEL_MAX }; #define NFT_TUNNEL_MAX (__NFT_TUNNEL_MAX - 1) enum nft_tunnel_attributes { NFTA_TUNNEL_UNSPEC, NFTA_TUNNEL_KEY, NFTA_TUNNEL_DREG, __NFTA_TUNNEL_MAX }; #define NFTA_TUNNEL_MAX (__NFTA_TUNNEL_MAX - 1) #endif /* _LINUX_NF_TABLES_H */ �������������������������������������������������������������������������������������������������������linux/netfilter/xt_connlimit.h����������������������������������������������������������������������0000644�����������������00000001077�14763166027�0012600 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_CONNLIMIT_H #define _XT_CONNLIMIT_H #include <linux/types.h> #include <linux/netfilter.h> struct xt_connlimit_data; enum { XT_CONNLIMIT_INVERT = 1 << 0, XT_CONNLIMIT_DADDR = 1 << 1, }; struct xt_connlimit_info { union { union nf_inet_addr mask; union { __be32 v4_mask; __be32 v6_mask[4]; }; }; unsigned int limit; /* revision 1 */ __u32 flags; /* Used internally by the kernel */ struct nf_conncount_data *data __attribute__((aligned(8))); }; #endif /* _XT_CONNLIMIT_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_socket.h�������������������������������������������������������������������������0000644�����������������00000001200�14763166027�0012060 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_SOCKET_H #define _XT_SOCKET_H #include <linux/types.h> enum { XT_SOCKET_TRANSPARENT = 1 << 0, XT_SOCKET_NOWILDCARD = 1 << 1, XT_SOCKET_RESTORESKMARK = 1 << 2, }; struct xt_socket_mtinfo1 { __u8 flags; }; #define XT_SOCKET_FLAGS_V1 XT_SOCKET_TRANSPARENT struct xt_socket_mtinfo2 { __u8 flags; }; #define XT_SOCKET_FLAGS_V2 (XT_SOCKET_TRANSPARENT | XT_SOCKET_NOWILDCARD) struct xt_socket_mtinfo3 { __u8 flags; }; #define XT_SOCKET_FLAGS_V3 (XT_SOCKET_TRANSPARENT \ | XT_SOCKET_NOWILDCARD \ | XT_SOCKET_RESTORESKMARK) #endif /* _XT_SOCKET_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_nfacct.h�������������������������������������������������������������������������0000644�����������������00000000645�14763166027�0012042 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_NFACCT_MATCH_H #define _XT_NFACCT_MATCH_H #include <linux/netfilter/nfnetlink_acct.h> struct nf_acct; struct xt_nfacct_match_info { char name[NFACCT_NAME_MAX]; struct nf_acct *nfacct; }; struct xt_nfacct_match_info_v1 { char name[NFACCT_NAME_MAX]; struct nf_acct *nfacct __attribute__((aligned(8))); }; #endif /* _XT_NFACCT_MATCH_H */ �������������������������������������������������������������������������������������������linux/netfilter/nf_log.h����������������������������������������������������������������������������0000644�����������������00000001032�14763166027�0011324 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NETFILTER_NF_LOG_H #define _NETFILTER_NF_LOG_H #define NF_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ #define NF_LOG_TCPOPT 0x02 /* Log TCP options */ #define NF_LOG_IPOPT 0x04 /* Log IP options */ #define NF_LOG_UID 0x08 /* Log UID owning local socket */ #define NF_LOG_NFLOG 0x10 /* Unsupported, don't reuse */ #define NF_LOG_MACDECODE 0x20 /* Decode MAC header */ #define NF_LOG_MASK 0x2f #define NF_LOG_PREFIXLEN 128 #endif /* _NETFILTER_NF_LOG_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_policy.h�������������������������������������������������������������������������0000644�����������������00000001776�14763166027�0012111 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_POLICY_H #define _XT_POLICY_H #include <linux/types.h> #include <linux/in.h> #include <linux/in6.h> #define XT_POLICY_MAX_ELEM 4 enum xt_policy_flags { XT_POLICY_MATCH_IN = 0x1, XT_POLICY_MATCH_OUT = 0x2, XT_POLICY_MATCH_NONE = 0x4, XT_POLICY_MATCH_STRICT = 0x8, }; enum xt_policy_modes { XT_POLICY_MODE_TRANSPORT, XT_POLICY_MODE_TUNNEL }; struct xt_policy_spec { __u8 saddr:1, daddr:1, proto:1, mode:1, spi:1, reqid:1; }; union xt_policy_addr { struct in_addr a4; struct in6_addr a6; }; struct xt_policy_elem { union { struct { union xt_policy_addr saddr; union xt_policy_addr smask; union xt_policy_addr daddr; union xt_policy_addr dmask; }; }; __be32 spi; __u32 reqid; __u8 proto; __u8 mode; struct xt_policy_spec match; struct xt_policy_spec invert; }; struct xt_policy_info { struct xt_policy_elem pol[XT_POLICY_MAX_ELEM]; __u16 flags; __u16 len; }; #endif /* _XT_POLICY_H */ ��linux/netfilter/xt_TEE.h����������������������������������������������������������������������������0000644�����������������00000000515�14763166027�0011215 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_TEE_TARGET_H #define _XT_TEE_TARGET_H #include <linux/netfilter.h> struct xt_tee_tginfo { union nf_inet_addr gw; char oif[16]; /* used internally by the kernel */ struct xt_tee_priv *priv __attribute__((aligned(8))); }; #endif /* _XT_TEE_TARGET_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_LED.h����������������������������������������������������������������������������0000644�����������������00000000726�14763166027�0011210 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_LED_H #define _XT_LED_H #include <linux/types.h> struct xt_led_info { char id[27]; /* Unique ID for this trigger in the LED class */ __u8 always_blink; /* Blink even if the LED is already on */ __u32 delay; /* Delay until LED is switched off after trigger */ /* Kernel data used in the module */ void *internal_data __attribute__((aligned(8))); }; #endif /* _XT_LED_H */ ������������������������������������������linux/netfilter/xt_limit.h��������������������������������������������������������������������������0000644�����������������00000001241�14763166027�0011713 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_RATE_H #define _XT_RATE_H #include <linux/types.h> /* timings are in milliseconds. */ #define XT_LIMIT_SCALE 10000 struct xt_limit_priv; /* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 seconds, or one every 59 hours. */ struct xt_rateinfo { __u32 avg; /* Average secs between packets * scale */ __u32 burst; /* Period multiplier for upper limit. */ /* Used internally by the kernel */ unsigned long prev; /* moved to xt_limit_priv */ __u32 credit; /* moved to xt_limit_priv */ __u32 credit_cap, cost; struct xt_limit_priv *master; }; #endif /*_XT_RATE_H*/ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_time.h���������������������������������������������������������������������������0000644�����������������00000001332�14763166027�0011534 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_TIME_H #define _XT_TIME_H 1 #include <linux/types.h> struct xt_time_info { __u32 date_start; __u32 date_stop; __u32 daytime_start; __u32 daytime_stop; __u32 monthdays_match; __u8 weekdays_match; __u8 flags; }; enum { /* Match against local time (instead of UTC) */ XT_TIME_LOCAL_TZ = 1 << 0, /* treat timestart > timestop (e.g. 23:00-01:00) as single period */ XT_TIME_CONTIGUOUS = 1 << 1, /* Shortcuts */ XT_TIME_ALL_MONTHDAYS = 0xFFFFFFFE, XT_TIME_ALL_WEEKDAYS = 0xFE, XT_TIME_MIN_DAYTIME = 0, XT_TIME_MAX_DAYTIME = 24 * 60 * 60 - 1, }; #define XT_TIME_ALL_FLAGS (XT_TIME_LOCAL_TZ|XT_TIME_CONTIGUOUS) #endif /* _XT_TIME_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_string.h�������������������������������������������������������������������������0000644�����������������00000001230�14763166027�0012101 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_STRING_H #define _XT_STRING_H #include <linux/types.h> #define XT_STRING_MAX_PATTERN_SIZE 128 #define XT_STRING_MAX_ALGO_NAME_SIZE 16 enum { XT_STRING_FLAG_INVERT = 0x01, XT_STRING_FLAG_IGNORECASE = 0x02 }; struct xt_string_info { __u16 from_offset; __u16 to_offset; char algo[XT_STRING_MAX_ALGO_NAME_SIZE]; char pattern[XT_STRING_MAX_PATTERN_SIZE]; __u8 patlen; union { struct { __u8 invert; } v0; struct { __u8 flags; } v1; } u; /* Used internally by the kernel */ struct ts_config __attribute__((aligned(8))) *config; }; #endif /*_XT_STRING_H*/ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/nfnetlink.h�������������������������������������������������������������������������0000644�����������������00000004574�14763166027�0012066 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NFNETLINK_H #define _NFNETLINK_H #include <linux/types.h> #include <linux/netfilter/nfnetlink_compat.h> enum nfnetlink_groups { NFNLGRP_NONE, #define NFNLGRP_NONE NFNLGRP_NONE NFNLGRP_CONNTRACK_NEW, #define NFNLGRP_CONNTRACK_NEW NFNLGRP_CONNTRACK_NEW NFNLGRP_CONNTRACK_UPDATE, #define NFNLGRP_CONNTRACK_UPDATE NFNLGRP_CONNTRACK_UPDATE NFNLGRP_CONNTRACK_DESTROY, #define NFNLGRP_CONNTRACK_DESTROY NFNLGRP_CONNTRACK_DESTROY NFNLGRP_CONNTRACK_EXP_NEW, #define NFNLGRP_CONNTRACK_EXP_NEW NFNLGRP_CONNTRACK_EXP_NEW NFNLGRP_CONNTRACK_EXP_UPDATE, #define NFNLGRP_CONNTRACK_EXP_UPDATE NFNLGRP_CONNTRACK_EXP_UPDATE NFNLGRP_CONNTRACK_EXP_DESTROY, #define NFNLGRP_CONNTRACK_EXP_DESTROY NFNLGRP_CONNTRACK_EXP_DESTROY NFNLGRP_NFTABLES, #define NFNLGRP_NFTABLES NFNLGRP_NFTABLES NFNLGRP_ACCT_QUOTA, #define NFNLGRP_ACCT_QUOTA NFNLGRP_ACCT_QUOTA NFNLGRP_NFTRACE, #define NFNLGRP_NFTRACE NFNLGRP_NFTRACE __NFNLGRP_MAX, }; #define NFNLGRP_MAX (__NFNLGRP_MAX - 1) /* General form of address family dependent message. */ struct nfgenmsg { __u8 nfgen_family; /* AF_xxx */ __u8 version; /* nfnetlink version */ __be16 res_id; /* resource id */ }; #define NFNETLINK_V0 0 /* netfilter netlink message types are split in two pieces: * 8 bit subsystem, 8bit operation. */ #define NFNL_SUBSYS_ID(x) ((x & 0xff00) >> 8) #define NFNL_MSG_TYPE(x) (x & 0x00ff) /* No enum here, otherwise __stringify() trick of MODULE_ALIAS_NFNL_SUBSYS() * won't work anymore */ #define NFNL_SUBSYS_NONE 0 #define NFNL_SUBSYS_CTNETLINK 1 #define NFNL_SUBSYS_CTNETLINK_EXP 2 #define NFNL_SUBSYS_QUEUE 3 #define NFNL_SUBSYS_ULOG 4 #define NFNL_SUBSYS_OSF 5 #define NFNL_SUBSYS_IPSET 6 #define NFNL_SUBSYS_ACCT 7 #define NFNL_SUBSYS_CTNETLINK_TIMEOUT 8 #define NFNL_SUBSYS_CTHELPER 9 #define NFNL_SUBSYS_NFTABLES 10 #define NFNL_SUBSYS_NFT_COMPAT 11 #define NFNL_SUBSYS_COUNT 12 /* Reserved control nfnetlink messages */ #define NFNL_MSG_BATCH_BEGIN NLMSG_MIN_TYPE #define NFNL_MSG_BATCH_END NLMSG_MIN_TYPE+1 /** * enum nfnl_batch_attributes - nfnetlink batch netlink attributes * * @NFNL_BATCH_GENID: generation ID for this changeset (NLA_U32) */ enum nfnl_batch_attributes { NFNL_BATCH_UNSPEC, NFNL_BATCH_GENID, __NFNL_BATCH_MAX }; #define NFNL_BATCH_MAX (__NFNL_BATCH_MAX - 1) #endif /* _NFNETLINK_H */ ������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_comment.h������������������������������������������������������������������������0000644�����������������00000000346�14763166027�0012244 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_COMMENT_H #define _XT_COMMENT_H #define XT_MAX_COMMENT_LEN 256 struct xt_comment_info { char comment[XT_MAX_COMMENT_LEN]; }; #endif /* XT_COMMENT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_dscp.h���������������������������������������������������������������������������0000644�����������������00000001275�14763166027�0011535 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* x_tables module for matching the IPv4/IPv6 DSCP field * * (C) 2002 Harald Welte <laforge@gnumonks.org> * This software is distributed under GNU GPL v2, 1991 * * See RFC2474 for a description of the DSCP field within the IP Header. * * xt_dscp.h,v 1.3 2002/08/05 19:00:21 laforge Exp */ #ifndef _XT_DSCP_H #define _XT_DSCP_H #include <linux/types.h> #define XT_DSCP_MASK 0xfc /* 11111100 */ #define XT_DSCP_SHIFT 2 #define XT_DSCP_MAX 0x3f /* 00111111 */ /* match info */ struct xt_dscp_info { __u8 dscp; __u8 invert; }; struct xt_tos_match_info { __u8 tos_mask; __u8 tos_value; __u8 invert; }; #endif /* _XT_DSCP_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_l2tp.h���������������������������������������������������������������������������0000644�����������������00000001343�14763166027�0011461 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_NETFILTER_XT_L2TP_H #define _LINUX_NETFILTER_XT_L2TP_H #include <linux/types.h> enum xt_l2tp_type { XT_L2TP_TYPE_CONTROL, XT_L2TP_TYPE_DATA, }; /* L2TP matching stuff */ struct xt_l2tp_info { __u32 tid; /* tunnel id */ __u32 sid; /* session id */ __u8 version; /* L2TP protocol version */ __u8 type; /* L2TP packet type */ __u8 flags; /* which fields to match */ }; enum { XT_L2TP_TID = (1 << 0), /* match L2TP tunnel id */ XT_L2TP_SID = (1 << 1), /* match L2TP session id */ XT_L2TP_VERSION = (1 << 2), /* match L2TP protocol version */ XT_L2TP_TYPE = (1 << 3), /* match L2TP packet type */ }; #endif /* _LINUX_NETFILTER_XT_L2TP_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_rateest.h������������������������������������������������������������������������0000644�����������������00000001533�14763166027�0012250 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_RATEEST_MATCH_H #define _XT_RATEEST_MATCH_H #include <linux/types.h> #include <linux/if.h> enum xt_rateest_match_flags { XT_RATEEST_MATCH_INVERT = 1<<0, XT_RATEEST_MATCH_ABS = 1<<1, XT_RATEEST_MATCH_REL = 1<<2, XT_RATEEST_MATCH_DELTA = 1<<3, XT_RATEEST_MATCH_BPS = 1<<4, XT_RATEEST_MATCH_PPS = 1<<5, }; enum xt_rateest_match_mode { XT_RATEEST_MATCH_NONE, XT_RATEEST_MATCH_EQ, XT_RATEEST_MATCH_LT, XT_RATEEST_MATCH_GT, }; struct xt_rateest_match_info { char name1[IFNAMSIZ]; char name2[IFNAMSIZ]; __u16 flags; __u16 mode; __u32 bps1; __u32 pps1; __u32 bps2; __u32 pps2; /* Used internally by the kernel */ struct xt_rateest *est1 __attribute__((aligned(8))); struct xt_rateest *est2 __attribute__((aligned(8))); }; #endif /* _XT_RATEEST_MATCH_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_MARK.h���������������������������������������������������������������������������0000644�����������������00000000270�14763166027�0011330 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_MARK_H_target #define _XT_MARK_H_target #include <linux/netfilter/xt_mark.h> #endif /*_XT_MARK_H_target */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_SYNPROXY.h�����������������������������������������������������������������������0000644�����������������00000000643�14763166027�0012115 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_SYNPROXY_H #define _XT_SYNPROXY_H #include <linux/types.h> #define XT_SYNPROXY_OPT_MSS 0x01 #define XT_SYNPROXY_OPT_WSCALE 0x02 #define XT_SYNPROXY_OPT_SACK_PERM 0x04 #define XT_SYNPROXY_OPT_TIMESTAMP 0x08 #define XT_SYNPROXY_OPT_ECN 0x10 struct xt_synproxy_info { __u8 options; __u8 wscale; __u16 mss; }; #endif /* _XT_SYNPROXY_H */ ���������������������������������������������������������������������������������������������linux/netfilter/nfnetlink_cthelper.h����������������������������������������������������������������0000644�����������������00000002266�14763166027�0013750 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NFNL_CTHELPER_H_ #define _NFNL_CTHELPER_H_ #define NFCT_HELPER_STATUS_DISABLED 0 #define NFCT_HELPER_STATUS_ENABLED 1 enum nfnl_cthelper_msg_types { NFNL_MSG_CTHELPER_NEW, NFNL_MSG_CTHELPER_GET, NFNL_MSG_CTHELPER_DEL, NFNL_MSG_CTHELPER_MAX }; enum nfnl_cthelper_type { NFCTH_UNSPEC, NFCTH_NAME, NFCTH_TUPLE, NFCTH_QUEUE_NUM, NFCTH_POLICY, NFCTH_PRIV_DATA_LEN, NFCTH_STATUS, __NFCTH_MAX }; #define NFCTH_MAX (__NFCTH_MAX - 1) enum nfnl_cthelper_policy_type { NFCTH_POLICY_SET_UNSPEC, NFCTH_POLICY_SET_NUM, NFCTH_POLICY_SET, NFCTH_POLICY_SET1 = NFCTH_POLICY_SET, NFCTH_POLICY_SET2, NFCTH_POLICY_SET3, NFCTH_POLICY_SET4, __NFCTH_POLICY_SET_MAX }; #define NFCTH_POLICY_SET_MAX (__NFCTH_POLICY_SET_MAX - 1) enum nfnl_cthelper_pol_type { NFCTH_POLICY_UNSPEC, NFCTH_POLICY_NAME, NFCTH_POLICY_EXPECT_MAX, NFCTH_POLICY_EXPECT_TIMEOUT, __NFCTH_POLICY_MAX }; #define NFCTH_POLICY_MAX (__NFCTH_POLICY_MAX - 1) enum nfnl_cthelper_tuple_type { NFCTH_TUPLE_UNSPEC, NFCTH_TUPLE_L3PROTONUM, NFCTH_TUPLE_L4PROTONUM, __NFCTH_TUPLE_MAX, }; #define NFCTH_TUPLE_MAX (__NFCTH_TUPLE_MAX - 1) #endif /* _NFNL_CTHELPER_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_cpu.h����������������������������������������������������������������������������0000644�����������������00000000307�14763166027�0011366 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_CPU_H #define _XT_CPU_H #include <linux/types.h> struct xt_cpu_info { __u32 cpu; __u32 invert; }; #endif /*_XT_CPU_H*/ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_mark.h���������������������������������������������������������������������������0000644�����������������00000000404�14763166027�0011527 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_MARK_H #define _XT_MARK_H #include <linux/types.h> struct xt_mark_tginfo2 { __u32 mark, mask; }; struct xt_mark_mtinfo1 { __u32 mark, mask; __u8 invert; }; #endif /*_XT_MARK_H*/ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_physdev.h������������������������������������������������������������������������0000644�����������������00000001051�14763166027�0012256 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_PHYSDEV_H #define _XT_PHYSDEV_H #include <linux/types.h> #include <linux/if.h> #define XT_PHYSDEV_OP_IN 0x01 #define XT_PHYSDEV_OP_OUT 0x02 #define XT_PHYSDEV_OP_BRIDGED 0x04 #define XT_PHYSDEV_OP_ISIN 0x08 #define XT_PHYSDEV_OP_ISOUT 0x10 #define XT_PHYSDEV_OP_MASK (0x20 - 1) struct xt_physdev_info { char physindev[IFNAMSIZ]; char in_mask[IFNAMSIZ]; char physoutdev[IFNAMSIZ]; char out_mask[IFNAMSIZ]; __u8 invert; __u8 bitmask; }; #endif /* _XT_PHYSDEV_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_HMARK.h��������������������������������������������������������������������������0000644�����������������00000001645�14763166027�0011447 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef XT_HMARK_H_ #define XT_HMARK_H_ #include <linux/types.h> #include <linux/netfilter.h> enum { XT_HMARK_SADDR_MASK, XT_HMARK_DADDR_MASK, XT_HMARK_SPI, XT_HMARK_SPI_MASK, XT_HMARK_SPORT, XT_HMARK_DPORT, XT_HMARK_SPORT_MASK, XT_HMARK_DPORT_MASK, XT_HMARK_PROTO_MASK, XT_HMARK_RND, XT_HMARK_MODULUS, XT_HMARK_OFFSET, XT_HMARK_CT, XT_HMARK_METHOD_L3, XT_HMARK_METHOD_L3_4, }; #define XT_HMARK_FLAG(flag) (1 << flag) union hmark_ports { struct { __u16 src; __u16 dst; } p16; struct { __be16 src; __be16 dst; } b16; __u32 v32; __be32 b32; }; struct xt_hmark_info { union nf_inet_addr src_mask; union nf_inet_addr dst_mask; union hmark_ports port_mask; union hmark_ports port_set; __u32 flags; __u16 proto_mask; __u32 hashrnd; __u32 hmodulus; __u32 hoffset; /* Mark offset to start from */ }; #endif /* XT_HMARK_H_ */ �������������������������������������������������������������������������������������������linux/netfilter/nfnetlink_osf.h���������������������������������������������������������������������0000644�����������������00000005151�14763166027�0012725 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _NF_OSF_H #define _NF_OSF_H #include <linux/types.h> #include <linux/ip.h> #include <linux/tcp.h> #define MAXGENRELEN 32 #define NF_OSF_GENRE (1 << 0) #define NF_OSF_TTL (1 << 1) #define NF_OSF_LOG (1 << 2) #define NF_OSF_INVERT (1 << 3) #define NF_OSF_LOGLEVEL_ALL 0 /* log all matched fingerprints */ #define NF_OSF_LOGLEVEL_FIRST 1 /* log only the first matced fingerprint */ #define NF_OSF_LOGLEVEL_ALL_KNOWN 2 /* do not log unknown packets */ #define NF_OSF_TTL_TRUE 0 /* True ip and fingerprint TTL comparison */ /* Check if ip TTL is less than fingerprint one */ #define NF_OSF_TTL_LESS 1 /* Do not compare ip and fingerprint TTL at all */ #define NF_OSF_TTL_NOCHECK 2 #define NF_OSF_FLAGMASK (NF_OSF_GENRE | NF_OSF_TTL | \ NF_OSF_LOG | NF_OSF_INVERT) /* Wildcard MSS (kind of). * It is used to implement a state machine for the different wildcard values * of the MSS and window sizes. */ struct nf_osf_wc { __u32 wc; __u32 val; }; /* This struct represents IANA options * http://www.iana.org/assignments/tcp-parameters */ struct nf_osf_opt { __u16 kind, length; struct nf_osf_wc wc; }; struct nf_osf_info { char genre[MAXGENRELEN]; __u32 len; __u32 flags; __u32 loglevel; __u32 ttl; }; struct nf_osf_user_finger { struct nf_osf_wc wss; __u8 ttl, df; __u16 ss, mss; __u16 opt_num; char genre[MAXGENRELEN]; char version[MAXGENRELEN]; char subtype[MAXGENRELEN]; /* MAX_IPOPTLEN is maximum if all options are NOPs or EOLs */ struct nf_osf_opt opt[MAX_IPOPTLEN]; }; struct nf_osf_nlmsg { struct nf_osf_user_finger f; struct iphdr ip; struct tcphdr tcp; }; /* Defines for IANA option kinds */ enum iana_options { OSFOPT_EOL = 0, /* End of options */ OSFOPT_NOP, /* NOP */ OSFOPT_MSS, /* Maximum segment size */ OSFOPT_WSO, /* Window scale option */ OSFOPT_SACKP, /* SACK permitted */ OSFOPT_SACK, /* SACK */ OSFOPT_ECHO, OSFOPT_ECHOREPLY, OSFOPT_TS, /* Timestamp option */ OSFOPT_POCP, /* Partial Order Connection Permitted */ OSFOPT_POSP, /* Partial Order Service Profile */ /* Others are not used in the current OSF */ OSFOPT_EMPTY = 255, }; /* Initial window size option state machine: multiple of mss, mtu or * plain numeric value. Can also be made as plain numeric value which * is not a multiple of specified value. */ enum nf_osf_window_size_options { OSF_WSS_PLAIN = 0, OSF_WSS_MSS, OSF_WSS_MTU, OSF_WSS_MODULO, OSF_WSS_MAX, }; enum nf_osf_attr_type { OSF_ATTR_UNSPEC, OSF_ATTR_FINGER, OSF_ATTR_MAX, }; /* * Add/remove fingerprint from the kernel. */ enum nf_osf_msg_types { OSF_MSG_ADD, OSF_MSG_REMOVE, OSF_MSG_MAX, }; #endif /* _NF_OSF_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_connlabel.h����������������������������������������������������������������������0000644�����������������00000000430�14763166027�0012531 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #include <linux/types.h> #define XT_CONNLABEL_MAXBIT 127 enum xt_connlabel_mtopts { XT_CONNLABEL_OP_INVERT = 1 << 0, XT_CONNLABEL_OP_SET = 1 << 1, }; struct xt_connlabel_mtinfo { __u16 bit; __u16 options; }; ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_iprange.h������������������������������������������������������������������������0000644�����������������00000001105�14763166027�0012221 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_NETFILTER_XT_IPRANGE_H #define _LINUX_NETFILTER_XT_IPRANGE_H 1 #include <linux/types.h> #include <linux/netfilter.h> enum { IPRANGE_SRC = 1 << 0, /* match source IP address */ IPRANGE_DST = 1 << 1, /* match destination IP address */ IPRANGE_SRC_INV = 1 << 4, /* negate the condition */ IPRANGE_DST_INV = 1 << 5, /* -"- */ }; struct xt_iprange_mtinfo { union nf_inet_addr src_min, src_max; union nf_inet_addr dst_min, dst_max; __u8 flags; }; #endif /* _LINUX_NETFILTER_XT_IPRANGE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/nf_conntrack_tuple_common.h���������������������������������������������������������0000644�����������������00000001600�14763166027�0015307 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NF_CONNTRACK_TUPLE_COMMON_H #define _NF_CONNTRACK_TUPLE_COMMON_H #include <linux/types.h> #include <linux/netfilter.h> #include <linux/netfilter/nf_conntrack_common.h> /* IP_CT_IS_REPLY */ enum ip_conntrack_dir { IP_CT_DIR_ORIGINAL, IP_CT_DIR_REPLY, IP_CT_DIR_MAX }; /* The protocol-specific manipulable parts of the tuple: always in * network order */ union nf_conntrack_man_proto { /* Add other protocols here. */ __be16 all; struct { __be16 port; } tcp; struct { __be16 port; } udp; struct { __be16 id; } icmp; struct { __be16 port; } dccp; struct { __be16 port; } sctp; struct { __be16 key; /* GRE key is 32bit, PPtP only uses 16bit */ } gre; }; #define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL) #endif /* _NF_CONNTRACK_TUPLE_COMMON_H */ ��������������������������������������������������������������������������������������������������������������������������������linux/netfilter/ipset/ip_set.h����������������������������������������������������������������������0000644�����������������00000021257�14763166027�0012502 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> * Patrick Schaaf <bof@bof.de> * Martin Josefsson <gandalf@wlug.westbo.se> * Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef _IP_SET_H #define _IP_SET_H #include <linux/types.h> /* The protocol version */ #define IPSET_PROTOCOL 6 /* The max length of strings including NUL: set and type identifiers */ #define IPSET_MAXNAMELEN 32 /* The maximum permissible comment length we will accept over netlink */ #define IPSET_MAX_COMMENT_SIZE 255 /* Message types and commands */ enum ipset_cmd { IPSET_CMD_NONE, IPSET_CMD_PROTOCOL, /* 1: Return protocol version */ IPSET_CMD_CREATE, /* 2: Create a new (empty) set */ IPSET_CMD_DESTROY, /* 3: Destroy a (empty) set */ IPSET_CMD_FLUSH, /* 4: Remove all elements from a set */ IPSET_CMD_RENAME, /* 5: Rename a set */ IPSET_CMD_SWAP, /* 6: Swap two sets */ IPSET_CMD_LIST, /* 7: List sets */ IPSET_CMD_SAVE, /* 8: Save sets */ IPSET_CMD_ADD, /* 9: Add an element to a set */ IPSET_CMD_DEL, /* 10: Delete an element from a set */ IPSET_CMD_TEST, /* 11: Test an element in a set */ IPSET_CMD_HEADER, /* 12: Get set header data only */ IPSET_CMD_TYPE, /* 13: Get set type */ IPSET_MSG_MAX, /* Netlink message commands */ /* Commands in userspace: */ IPSET_CMD_RESTORE = IPSET_MSG_MAX, /* 14: Enter restore mode */ IPSET_CMD_HELP, /* 15: Get help */ IPSET_CMD_VERSION, /* 16: Get program version */ IPSET_CMD_QUIT, /* 17: Quit from interactive mode */ IPSET_CMD_MAX, IPSET_CMD_COMMIT = IPSET_CMD_MAX, /* 18: Commit buffered commands */ }; /* Attributes at command level */ enum { IPSET_ATTR_UNSPEC, IPSET_ATTR_PROTOCOL, /* 1: Protocol version */ IPSET_ATTR_SETNAME, /* 2: Name of the set */ IPSET_ATTR_TYPENAME, /* 3: Typename */ IPSET_ATTR_SETNAME2 = IPSET_ATTR_TYPENAME, /* Setname at rename/swap */ IPSET_ATTR_REVISION, /* 4: Settype revision */ IPSET_ATTR_FAMILY, /* 5: Settype family */ IPSET_ATTR_FLAGS, /* 6: Flags at command level */ IPSET_ATTR_DATA, /* 7: Nested attributes */ IPSET_ATTR_ADT, /* 8: Multiple data containers */ IPSET_ATTR_LINENO, /* 9: Restore lineno */ IPSET_ATTR_PROTOCOL_MIN, /* 10: Minimal supported version number */ IPSET_ATTR_REVISION_MIN = IPSET_ATTR_PROTOCOL_MIN, /* type rev min */ __IPSET_ATTR_CMD_MAX, }; #define IPSET_ATTR_CMD_MAX (__IPSET_ATTR_CMD_MAX - 1) /* CADT specific attributes */ enum { IPSET_ATTR_IP = IPSET_ATTR_UNSPEC + 1, IPSET_ATTR_IP_FROM = IPSET_ATTR_IP, IPSET_ATTR_IP_TO, /* 2 */ IPSET_ATTR_CIDR, /* 3 */ IPSET_ATTR_PORT, /* 4 */ IPSET_ATTR_PORT_FROM = IPSET_ATTR_PORT, IPSET_ATTR_PORT_TO, /* 5 */ IPSET_ATTR_TIMEOUT, /* 6 */ IPSET_ATTR_PROTO, /* 7 */ IPSET_ATTR_CADT_FLAGS, /* 8 */ IPSET_ATTR_CADT_LINENO = IPSET_ATTR_LINENO, /* 9 */ IPSET_ATTR_MARK, /* 10 */ IPSET_ATTR_MARKMASK, /* 11 */ /* Reserve empty slots */ IPSET_ATTR_CADT_MAX = 16, /* Create-only specific attributes */ IPSET_ATTR_GC, IPSET_ATTR_HASHSIZE, IPSET_ATTR_MAXELEM, IPSET_ATTR_NETMASK, IPSET_ATTR_PROBES, IPSET_ATTR_RESIZE, IPSET_ATTR_SIZE, /* Kernel-only */ IPSET_ATTR_ELEMENTS, IPSET_ATTR_REFERENCES, IPSET_ATTR_MEMSIZE, __IPSET_ATTR_CREATE_MAX, }; #define IPSET_ATTR_CREATE_MAX (__IPSET_ATTR_CREATE_MAX - 1) /* ADT specific attributes */ enum { IPSET_ATTR_ETHER = IPSET_ATTR_CADT_MAX + 1, IPSET_ATTR_NAME, IPSET_ATTR_NAMEREF, IPSET_ATTR_IP2, IPSET_ATTR_CIDR2, IPSET_ATTR_IP2_TO, IPSET_ATTR_IFACE, IPSET_ATTR_BYTES, IPSET_ATTR_PACKETS, IPSET_ATTR_COMMENT, IPSET_ATTR_SKBMARK, IPSET_ATTR_SKBPRIO, IPSET_ATTR_SKBQUEUE, IPSET_ATTR_PAD, __IPSET_ATTR_ADT_MAX, }; #define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1) /* IP specific attributes */ enum { IPSET_ATTR_IPADDR_IPV4 = IPSET_ATTR_UNSPEC + 1, IPSET_ATTR_IPADDR_IPV6, __IPSET_ATTR_IPADDR_MAX, }; #define IPSET_ATTR_IPADDR_MAX (__IPSET_ATTR_IPADDR_MAX - 1) /* Error codes */ enum ipset_errno { IPSET_ERR_PRIVATE = 4096, IPSET_ERR_PROTOCOL, IPSET_ERR_FIND_TYPE, IPSET_ERR_MAX_SETS, IPSET_ERR_BUSY, IPSET_ERR_EXIST_SETNAME2, IPSET_ERR_TYPE_MISMATCH, IPSET_ERR_EXIST, IPSET_ERR_INVALID_CIDR, IPSET_ERR_INVALID_NETMASK, IPSET_ERR_INVALID_FAMILY, IPSET_ERR_TIMEOUT, IPSET_ERR_REFERENCED, IPSET_ERR_IPADDR_IPV4, IPSET_ERR_IPADDR_IPV6, IPSET_ERR_COUNTER, IPSET_ERR_COMMENT, IPSET_ERR_INVALID_MARKMASK, IPSET_ERR_SKBINFO, /* Type specific error codes */ IPSET_ERR_TYPE_SPECIFIC = 4352, }; /* Flags at command level or match/target flags, lower half of cmdattrs*/ enum ipset_cmd_flags { IPSET_FLAG_BIT_EXIST = 0, IPSET_FLAG_EXIST = (1 << IPSET_FLAG_BIT_EXIST), IPSET_FLAG_BIT_LIST_SETNAME = 1, IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME), IPSET_FLAG_BIT_LIST_HEADER = 2, IPSET_FLAG_LIST_HEADER = (1 << IPSET_FLAG_BIT_LIST_HEADER), IPSET_FLAG_BIT_SKIP_COUNTER_UPDATE = 3, IPSET_FLAG_SKIP_COUNTER_UPDATE = (1 << IPSET_FLAG_BIT_SKIP_COUNTER_UPDATE), IPSET_FLAG_BIT_SKIP_SUBCOUNTER_UPDATE = 4, IPSET_FLAG_SKIP_SUBCOUNTER_UPDATE = (1 << IPSET_FLAG_BIT_SKIP_SUBCOUNTER_UPDATE), IPSET_FLAG_BIT_MATCH_COUNTERS = 5, IPSET_FLAG_MATCH_COUNTERS = (1 << IPSET_FLAG_BIT_MATCH_COUNTERS), IPSET_FLAG_BIT_RETURN_NOMATCH = 7, IPSET_FLAG_RETURN_NOMATCH = (1 << IPSET_FLAG_BIT_RETURN_NOMATCH), IPSET_FLAG_BIT_MAP_SKBMARK = 8, IPSET_FLAG_MAP_SKBMARK = (1 << IPSET_FLAG_BIT_MAP_SKBMARK), IPSET_FLAG_BIT_MAP_SKBPRIO = 9, IPSET_FLAG_MAP_SKBPRIO = (1 << IPSET_FLAG_BIT_MAP_SKBPRIO), IPSET_FLAG_BIT_MAP_SKBQUEUE = 10, IPSET_FLAG_MAP_SKBQUEUE = (1 << IPSET_FLAG_BIT_MAP_SKBQUEUE), IPSET_FLAG_CMD_MAX = 15, }; /* Flags at CADT attribute level, upper half of cmdattrs */ enum ipset_cadt_flags { IPSET_FLAG_BIT_BEFORE = 0, IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE), IPSET_FLAG_BIT_PHYSDEV = 1, IPSET_FLAG_PHYSDEV = (1 << IPSET_FLAG_BIT_PHYSDEV), IPSET_FLAG_BIT_NOMATCH = 2, IPSET_FLAG_NOMATCH = (1 << IPSET_FLAG_BIT_NOMATCH), IPSET_FLAG_BIT_WITH_COUNTERS = 3, IPSET_FLAG_WITH_COUNTERS = (1 << IPSET_FLAG_BIT_WITH_COUNTERS), IPSET_FLAG_BIT_WITH_COMMENT = 4, IPSET_FLAG_WITH_COMMENT = (1 << IPSET_FLAG_BIT_WITH_COMMENT), IPSET_FLAG_BIT_WITH_FORCEADD = 5, IPSET_FLAG_WITH_FORCEADD = (1 << IPSET_FLAG_BIT_WITH_FORCEADD), IPSET_FLAG_BIT_WITH_SKBINFO = 6, IPSET_FLAG_WITH_SKBINFO = (1 << IPSET_FLAG_BIT_WITH_SKBINFO), IPSET_FLAG_CADT_MAX = 15, }; /* The flag bits which correspond to the non-extension create flags */ enum ipset_create_flags { IPSET_CREATE_FLAG_BIT_FORCEADD = 0, IPSET_CREATE_FLAG_FORCEADD = (1 << IPSET_CREATE_FLAG_BIT_FORCEADD), IPSET_CREATE_FLAG_BIT_MAX = 7, }; /* Commands with settype-specific attributes */ enum ipset_adt { IPSET_ADD, IPSET_DEL, IPSET_TEST, IPSET_ADT_MAX, IPSET_CREATE = IPSET_ADT_MAX, IPSET_CADT_MAX, }; /* Sets are identified by an index in kernel space. Tweak with ip_set_id_t * and IPSET_INVALID_ID if you want to increase the max number of sets. */ typedef __u16 ip_set_id_t; #define IPSET_INVALID_ID 65535 enum ip_set_dim { IPSET_DIM_ZERO = 0, IPSET_DIM_ONE, IPSET_DIM_TWO, IPSET_DIM_THREE, /* Max dimension in elements. * If changed, new revision of iptables match/target is required. */ IPSET_DIM_MAX = 6, /* Backward compatibility: set match revision 2 */ IPSET_BIT_RETURN_NOMATCH = 7, }; /* Option flags for kernel operations */ enum ip_set_kopt { IPSET_INV_MATCH = (1 << IPSET_DIM_ZERO), IPSET_DIM_ONE_SRC = (1 << IPSET_DIM_ONE), IPSET_DIM_TWO_SRC = (1 << IPSET_DIM_TWO), IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE), IPSET_RETURN_NOMATCH = (1 << IPSET_BIT_RETURN_NOMATCH), }; enum { IPSET_COUNTER_NONE = 0, IPSET_COUNTER_EQ, IPSET_COUNTER_NE, IPSET_COUNTER_LT, IPSET_COUNTER_GT, }; /* Backward compatibility for set match v3 */ struct ip_set_counter_match0 { __u8 op; __u64 value; }; struct ip_set_counter_match { __aligned_u64 value; __u8 op; }; /* Interface to iptables/ip6tables */ #define SO_IP_SET 83 union ip_set_name_index { char name[IPSET_MAXNAMELEN]; ip_set_id_t index; }; #define IP_SET_OP_GET_BYNAME 0x00000006 /* Get set index by name */ struct ip_set_req_get_set { unsigned int op; unsigned int version; union ip_set_name_index set; }; #define IP_SET_OP_GET_BYINDEX 0x00000007 /* Get set name by index */ /* Uses ip_set_req_get_set */ #define IP_SET_OP_GET_FNAME 0x00000008 /* Get set index and family */ struct ip_set_req_get_set_family { unsigned int op; unsigned int version; unsigned int family; union ip_set_name_index set; }; #define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */ struct ip_set_req_version { unsigned int op; unsigned int version; }; #endif /* _IP_SET_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/ipset/ip_set_bitmap.h���������������������������������������������������������������0000644�����������������00000000654�14763166027�0014034 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __IP_SET_BITMAP_H #define __IP_SET_BITMAP_H #include <linux/netfilter/ipset/ip_set.h> /* Bitmap type specific error codes */ enum { /* The element is out of the range of the set */ IPSET_ERR_BITMAP_RANGE = IPSET_ERR_TYPE_SPECIFIC, /* The range exceeds the size limit of the set type */ IPSET_ERR_BITMAP_RANGE_SIZE, }; #endif /* __IP_SET_BITMAP_H */ ������������������������������������������������������������������������������������linux/netfilter/ipset/ip_set_list.h�����������������������������������������������������������������0000644�����������������00000001141�14763166027�0013523 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __IP_SET_LIST_H #define __IP_SET_LIST_H #include <linux/netfilter/ipset/ip_set.h> /* List type specific error codes */ enum { /* Set name to be added/deleted/tested does not exist. */ IPSET_ERR_NAME = IPSET_ERR_TYPE_SPECIFIC, /* list:set type is not permitted to add */ IPSET_ERR_LOOP, /* Missing reference set */ IPSET_ERR_BEFORE, /* Reference set does not exist */ IPSET_ERR_NAMEREF, /* Set is full */ IPSET_ERR_LIST_FULL, /* Reference set is not added to the set */ IPSET_ERR_REF_EXIST, }; #endif /* __IP_SET_LIST_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/ipset/ip_set_hash.h�����������������������������������������������������������������0000644�����������������00000001102�14763166027�0013470 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __IP_SET_HASH_H #define __IP_SET_HASH_H #include <linux/netfilter/ipset/ip_set.h> /* Hash type specific error codes */ enum { /* Hash is full */ IPSET_ERR_HASH_FULL = IPSET_ERR_TYPE_SPECIFIC, /* Null-valued element */ IPSET_ERR_HASH_ELEM, /* Invalid protocol */ IPSET_ERR_INVALID_PROTO, /* Protocol missing but must be specified */ IPSET_ERR_MISSING_PROTO, /* Range not supported */ IPSET_ERR_HASH_RANGE_UNSUPPORTED, /* Invalid range */ IPSET_ERR_HASH_RANGE, }; #endif /* __IP_SET_HASH_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_cgroup.h�������������������������������������������������������������������������0000644�����������������00000001344�14763166027�0012100 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_CGROUP_H #define _XT_CGROUP_H #include <linux/types.h> #include <linux/limits.h> struct xt_cgroup_info_v0 { __u32 id; __u32 invert; }; struct xt_cgroup_info_v1 { __u8 has_path; __u8 has_classid; __u8 invert_path; __u8 invert_classid; char path[PATH_MAX]; __u32 classid; /* kernel internal data */ void *priv __attribute__((aligned(8))); }; #define XT_CGROUP_PATH_MAX 512 struct xt_cgroup_info_v2 { __u8 has_path; __u8 has_classid; __u8 invert_path; __u8 invert_classid; union { char path[XT_CGROUP_PATH_MAX]; __u32 classid; }; /* kernel internal data */ void *priv __attribute__((aligned(8))); }; #endif /* _XT_CGROUP_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/nf_tables_compat.h������������������������������������������������������������������0000644�����������������00000001333�14763166027�0013364 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NFT_COMPAT_NFNETLINK_H_ #define _NFT_COMPAT_NFNETLINK_H_ enum nft_target_attributes { NFTA_TARGET_UNSPEC, NFTA_TARGET_NAME, NFTA_TARGET_REV, NFTA_TARGET_INFO, __NFTA_TARGET_MAX }; #define NFTA_TARGET_MAX (__NFTA_TARGET_MAX - 1) enum nft_match_attributes { NFTA_MATCH_UNSPEC, NFTA_MATCH_NAME, NFTA_MATCH_REV, NFTA_MATCH_INFO, __NFTA_MATCH_MAX }; #define NFTA_MATCH_MAX (__NFTA_MATCH_MAX - 1) #define NFT_COMPAT_NAME_MAX 32 enum { NFNL_MSG_COMPAT_GET, NFNL_MSG_COMPAT_MAX }; enum { NFTA_COMPAT_UNSPEC = 0, NFTA_COMPAT_NAME, NFTA_COMPAT_REV, NFTA_COMPAT_TYPE, __NFTA_COMPAT_MAX, }; #define NFTA_COMPAT_MAX (__NFTA_COMPAT_MAX - 1) #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_ecn.h����������������������������������������������������������������������������0000644�����������������00000001340�14763166027�0011342 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* iptables module for matching the ECN header in IPv4 and TCP header * * (C) 2002 Harald Welte <laforge@gnumonks.org> * * This software is distributed under GNU GPL v2, 1991 * * ipt_ecn.h,v 1.4 2002/08/05 19:39:00 laforge Exp */ #ifndef _XT_ECN_H #define _XT_ECN_H #include <linux/types.h> #include <linux/netfilter/xt_dscp.h> #define XT_ECN_IP_MASK (~XT_DSCP_MASK) #define XT_ECN_OP_MATCH_IP 0x01 #define XT_ECN_OP_MATCH_ECE 0x10 #define XT_ECN_OP_MATCH_CWR 0x20 #define XT_ECN_OP_MATCH_MASK 0xce /* match info */ struct xt_ecn_info { __u8 operation; __u8 invert; __u8 ip_ect; union { struct { __u8 ect; } tcp; } proto; }; #endif /* _XT_ECN_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_TCPOPTSTRIP.h��������������������������������������������������������������������0000644�����������������00000000627�14763166027�0012437 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_TCPOPTSTRIP_H #define _XT_TCPOPTSTRIP_H #include <linux/types.h> #define tcpoptstrip_set_bit(bmap, idx) \ (bmap[(idx) >> 5] |= 1U << (idx & 31)) #define tcpoptstrip_test_bit(bmap, idx) \ (((1U << (idx & 31)) & bmap[(idx) >> 5]) != 0) struct xt_tcpoptstrip_target_info { __u32 strip_bmap[8]; }; #endif /* _XT_TCPOPTSTRIP_H */ ���������������������������������������������������������������������������������������������������������linux/netfilter/nfnetlink_cttimeout.h���������������������������������������������������������������0000644�����������������00000005562�14763166027�0014161 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _CTTIMEOUT_NETLINK_H #define _CTTIMEOUT_NETLINK_H #include <linux/netfilter/nfnetlink.h> enum ctnl_timeout_msg_types { IPCTNL_MSG_TIMEOUT_NEW, IPCTNL_MSG_TIMEOUT_GET, IPCTNL_MSG_TIMEOUT_DELETE, IPCTNL_MSG_TIMEOUT_DEFAULT_SET, IPCTNL_MSG_TIMEOUT_DEFAULT_GET, IPCTNL_MSG_TIMEOUT_MAX }; enum ctattr_timeout { CTA_TIMEOUT_UNSPEC, CTA_TIMEOUT_NAME, CTA_TIMEOUT_L3PROTO, CTA_TIMEOUT_L4PROTO, CTA_TIMEOUT_DATA, CTA_TIMEOUT_USE, __CTA_TIMEOUT_MAX }; #define CTA_TIMEOUT_MAX (__CTA_TIMEOUT_MAX - 1) enum ctattr_timeout_generic { CTA_TIMEOUT_GENERIC_UNSPEC, CTA_TIMEOUT_GENERIC_TIMEOUT, __CTA_TIMEOUT_GENERIC_MAX }; #define CTA_TIMEOUT_GENERIC_MAX (__CTA_TIMEOUT_GENERIC_MAX - 1) enum ctattr_timeout_tcp { CTA_TIMEOUT_TCP_UNSPEC, CTA_TIMEOUT_TCP_SYN_SENT, CTA_TIMEOUT_TCP_SYN_RECV, CTA_TIMEOUT_TCP_ESTABLISHED, CTA_TIMEOUT_TCP_FIN_WAIT, CTA_TIMEOUT_TCP_CLOSE_WAIT, CTA_TIMEOUT_TCP_LAST_ACK, CTA_TIMEOUT_TCP_TIME_WAIT, CTA_TIMEOUT_TCP_CLOSE, CTA_TIMEOUT_TCP_SYN_SENT2, CTA_TIMEOUT_TCP_RETRANS, CTA_TIMEOUT_TCP_UNACK, __CTA_TIMEOUT_TCP_MAX }; #define CTA_TIMEOUT_TCP_MAX (__CTA_TIMEOUT_TCP_MAX - 1) enum ctattr_timeout_udp { CTA_TIMEOUT_UDP_UNSPEC, CTA_TIMEOUT_UDP_UNREPLIED, CTA_TIMEOUT_UDP_REPLIED, __CTA_TIMEOUT_UDP_MAX }; #define CTA_TIMEOUT_UDP_MAX (__CTA_TIMEOUT_UDP_MAX - 1) enum ctattr_timeout_udplite { CTA_TIMEOUT_UDPLITE_UNSPEC, CTA_TIMEOUT_UDPLITE_UNREPLIED, CTA_TIMEOUT_UDPLITE_REPLIED, __CTA_TIMEOUT_UDPLITE_MAX }; #define CTA_TIMEOUT_UDPLITE_MAX (__CTA_TIMEOUT_UDPLITE_MAX - 1) enum ctattr_timeout_icmp { CTA_TIMEOUT_ICMP_UNSPEC, CTA_TIMEOUT_ICMP_TIMEOUT, __CTA_TIMEOUT_ICMP_MAX }; #define CTA_TIMEOUT_ICMP_MAX (__CTA_TIMEOUT_ICMP_MAX - 1) enum ctattr_timeout_dccp { CTA_TIMEOUT_DCCP_UNSPEC, CTA_TIMEOUT_DCCP_REQUEST, CTA_TIMEOUT_DCCP_RESPOND, CTA_TIMEOUT_DCCP_PARTOPEN, CTA_TIMEOUT_DCCP_OPEN, CTA_TIMEOUT_DCCP_CLOSEREQ, CTA_TIMEOUT_DCCP_CLOSING, CTA_TIMEOUT_DCCP_TIMEWAIT, __CTA_TIMEOUT_DCCP_MAX }; #define CTA_TIMEOUT_DCCP_MAX (__CTA_TIMEOUT_DCCP_MAX - 1) enum ctattr_timeout_sctp { CTA_TIMEOUT_SCTP_UNSPEC, CTA_TIMEOUT_SCTP_CLOSED, CTA_TIMEOUT_SCTP_COOKIE_WAIT, CTA_TIMEOUT_SCTP_COOKIE_ECHOED, CTA_TIMEOUT_SCTP_ESTABLISHED, CTA_TIMEOUT_SCTP_SHUTDOWN_SENT, CTA_TIMEOUT_SCTP_SHUTDOWN_RECD, CTA_TIMEOUT_SCTP_SHUTDOWN_ACK_SENT, CTA_TIMEOUT_SCTP_HEARTBEAT_SENT, CTA_TIMEOUT_SCTP_HEARTBEAT_ACKED, __CTA_TIMEOUT_SCTP_MAX }; #define CTA_TIMEOUT_SCTP_MAX (__CTA_TIMEOUT_SCTP_MAX - 1) enum ctattr_timeout_icmpv6 { CTA_TIMEOUT_ICMPV6_UNSPEC, CTA_TIMEOUT_ICMPV6_TIMEOUT, __CTA_TIMEOUT_ICMPV6_MAX }; #define CTA_TIMEOUT_ICMPV6_MAX (__CTA_TIMEOUT_ICMPV6_MAX - 1) enum ctattr_timeout_gre { CTA_TIMEOUT_GRE_UNSPEC, CTA_TIMEOUT_GRE_UNREPLIED, CTA_TIMEOUT_GRE_REPLIED, __CTA_TIMEOUT_GRE_MAX }; #define CTA_TIMEOUT_GRE_MAX (__CTA_TIMEOUT_GRE_MAX - 1) #define CTNL_TIMEOUT_NAME_MAX 32 #endif ����������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_bpf.h����������������������������������������������������������������������������0000644�����������������00000001647�14763166027�0011356 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_BPF_H #define _XT_BPF_H #include <linux/filter.h> #include <linux/limits.h> #include <linux/types.h> #define XT_BPF_MAX_NUM_INSTR 64 #define XT_BPF_PATH_MAX (XT_BPF_MAX_NUM_INSTR * sizeof(struct sock_filter)) struct bpf_prog; struct xt_bpf_info { __u16 bpf_program_num_elem; struct sock_filter bpf_program[XT_BPF_MAX_NUM_INSTR]; /* only used in the kernel */ struct bpf_prog *filter __attribute__((aligned(8))); }; enum xt_bpf_modes { XT_BPF_MODE_BYTECODE, XT_BPF_MODE_FD_PINNED, XT_BPF_MODE_FD_ELF, }; #define XT_BPF_MODE_PATH_PINNED XT_BPF_MODE_FD_PINNED struct xt_bpf_info_v1 { __u16 mode; __u16 bpf_program_num_elem; __s32 fd; union { struct sock_filter bpf_program[XT_BPF_MAX_NUM_INSTR]; char path[XT_BPF_PATH_MAX]; }; /* only used in the kernel */ struct bpf_prog *filter __attribute__((aligned(8))); }; #endif /*_XT_BPF_H */ �����������������������������������������������������������������������������������������linux/netfilter/xt_mac.h����������������������������������������������������������������������������0000644�����������������00000000343�14763166027�0011337 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_MAC_H #define _XT_MAC_H #include <linux/if_ether.h> struct xt_mac_info { unsigned char srcaddr[ETH_ALEN]; int invert; }; #endif /*_XT_MAC_H*/ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/nf_conntrack_sctp.h�����������������������������������������������������������������0000644�����������������00000001100�14763166027�0013552 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NF_CONNTRACK_SCTP_H #define _NF_CONNTRACK_SCTP_H /* SCTP tracking. */ #include <linux/netfilter/nf_conntrack_tuple_common.h> enum sctp_conntrack { SCTP_CONNTRACK_NONE, SCTP_CONNTRACK_CLOSED, SCTP_CONNTRACK_COOKIE_WAIT, SCTP_CONNTRACK_COOKIE_ECHOED, SCTP_CONNTRACK_ESTABLISHED, SCTP_CONNTRACK_SHUTDOWN_SENT, SCTP_CONNTRACK_SHUTDOWN_RECD, SCTP_CONNTRACK_SHUTDOWN_ACK_SENT, SCTP_CONNTRACK_HEARTBEAT_SENT, SCTP_CONNTRACK_HEARTBEAT_ACKED, SCTP_CONNTRACK_MAX }; #endif /* _NF_CONNTRACK_SCTP_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_realm.h��������������������������������������������������������������������������0000644�����������������00000000334�14763166027�0011677 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_REALM_H #define _XT_REALM_H #include <linux/types.h> struct xt_realm_info { __u32 id; __u32 mask; __u8 invert; }; #endif /* _XT_REALM_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_recent.h�������������������������������������������������������������������������0000644�����������������00000002042�14763166027�0012055 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_NETFILTER_XT_RECENT_H #define _LINUX_NETFILTER_XT_RECENT_H 1 #include <linux/types.h> #include <linux/netfilter.h> enum { XT_RECENT_CHECK = 1 << 0, XT_RECENT_SET = 1 << 1, XT_RECENT_UPDATE = 1 << 2, XT_RECENT_REMOVE = 1 << 3, XT_RECENT_TTL = 1 << 4, XT_RECENT_REAP = 1 << 5, XT_RECENT_SOURCE = 0, XT_RECENT_DEST = 1, XT_RECENT_NAME_LEN = 200, }; /* Only allowed with --rcheck and --update */ #define XT_RECENT_MODIFIERS (XT_RECENT_TTL|XT_RECENT_REAP) #define XT_RECENT_VALID_FLAGS (XT_RECENT_CHECK|XT_RECENT_SET|XT_RECENT_UPDATE|\ XT_RECENT_REMOVE|XT_RECENT_TTL|XT_RECENT_REAP) struct xt_recent_mtinfo { __u32 seconds; __u32 hit_count; __u8 check_set; __u8 invert; char name[XT_RECENT_NAME_LEN]; __u8 side; }; struct xt_recent_mtinfo_v1 { __u32 seconds; __u32 hit_count; __u8 check_set; __u8 invert; char name[XT_RECENT_NAME_LEN]; __u8 side; union nf_inet_addr mask; }; #endif /* _LINUX_NETFILTER_XT_RECENT_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_CONNMARK.h�����������������������������������������������������������������������0000644�����������������00000000307�14763166027�0012007 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_CONNMARK_H_target #define _XT_CONNMARK_H_target #include <linux/netfilter/xt_connmark.h> #endif /*_XT_CONNMARK_H_target*/ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_owner.h��������������������������������������������������������������������������0000644�����������������00000000561�14763166027�0011733 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_OWNER_MATCH_H #define _XT_OWNER_MATCH_H #include <linux/types.h> enum { XT_OWNER_UID = 1 << 0, XT_OWNER_GID = 1 << 1, XT_OWNER_SOCKET = 1 << 2, }; struct xt_owner_match_info { __u32 uid_min, uid_max; __u32 gid_min, gid_max; __u8 match, invert; }; #endif /* _XT_OWNER_MATCH_H */ �����������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_LOG.h����������������������������������������������������������������������������0000644�����������������00000001202�14763166027�0011213 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_LOG_H #define _XT_LOG_H /* make sure not to change this without changing nf_log.h:NF_LOG_* (!) */ #define XT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ #define XT_LOG_TCPOPT 0x02 /* Log TCP options */ #define XT_LOG_IPOPT 0x04 /* Log IP options */ #define XT_LOG_UID 0x08 /* Log UID owning local socket */ #define XT_LOG_NFLOG 0x10 /* Unsupported, don't reuse */ #define XT_LOG_MACDECODE 0x20 /* Decode MAC header */ #define XT_LOG_MASK 0x2f struct xt_log_info { unsigned char level; unsigned char logflags; char prefix[30]; }; #endif /* _XT_LOG_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_multiport.h����������������������������������������������������������������������0000644�����������������00000001321�14763166027�0012633 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_MULTIPORT_H #define _XT_MULTIPORT_H #include <linux/types.h> enum xt_multiport_flags { XT_MULTIPORT_SOURCE, XT_MULTIPORT_DESTINATION, XT_MULTIPORT_EITHER }; #define XT_MULTI_PORTS 15 /* Must fit inside union xt_matchinfo: 16 bytes */ struct xt_multiport { __u8 flags; /* Type of comparison */ __u8 count; /* Number of ports */ __u16 ports[XT_MULTI_PORTS]; /* Ports */ }; struct xt_multiport_v1 { __u8 flags; /* Type of comparison */ __u8 count; /* Number of ports */ __u16 ports[XT_MULTI_PORTS]; /* Ports */ __u8 pflags[XT_MULTI_PORTS]; /* Port flags */ __u8 invert; /* Invert flag */ }; #endif /*_XT_MULTIPORT_H*/ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/x_tables.h��������������������������������������������������������������������������0000644�����������������00000010562�14763166027�0011671 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _X_TABLES_H #define _X_TABLES_H #include <linux/const.h> #include <linux/types.h> #define XT_FUNCTION_MAXNAMELEN 30 #define XT_EXTENSION_MAXNAMELEN 29 #define XT_TABLE_MAXNAMELEN 32 struct xt_entry_match { union { struct { __u16 match_size; /* Used by userspace */ char name[XT_EXTENSION_MAXNAMELEN]; __u8 revision; } user; struct { __u16 match_size; /* Used inside the kernel */ struct xt_match *match; } kernel; /* Total length */ __u16 match_size; } u; unsigned char data[0]; }; struct xt_entry_target { union { struct { __u16 target_size; /* Used by userspace */ char name[XT_EXTENSION_MAXNAMELEN]; __u8 revision; } user; struct { __u16 target_size; /* Used inside the kernel */ struct xt_target *target; } kernel; /* Total length */ __u16 target_size; } u; unsigned char data[0]; }; #define XT_TARGET_INIT(__name, __size) \ { \ .target.u.user = { \ .target_size = XT_ALIGN(__size), \ .name = __name, \ }, \ } struct xt_standard_target { struct xt_entry_target target; int verdict; }; struct xt_error_target { struct xt_entry_target target; char errorname[XT_FUNCTION_MAXNAMELEN]; }; /* The argument to IPT_SO_GET_REVISION_*. Returns highest revision * kernel supports, if >= revision. */ struct xt_get_revision { char name[XT_EXTENSION_MAXNAMELEN]; __u8 revision; }; /* CONTINUE verdict for targets */ #define XT_CONTINUE 0xFFFFFFFF /* For standard target */ #define XT_RETURN (-NF_REPEAT - 1) /* this is a dummy structure to find out the alignment requirement for a struct * containing all the fundamental data types that are used in ipt_entry, * ip6t_entry and arpt_entry. This sucks, and it is a hack. It will be my * personal pleasure to remove it -HW */ struct _xt_align { __u8 u8; __u16 u16; __u32 u32; __u64 u64; }; #define XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _xt_align)) /* Standard return verdict, or do jump. */ #define XT_STANDARD_TARGET "" /* Error verdict. */ #define XT_ERROR_TARGET "ERROR" #define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0) #define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0) struct xt_counters { __u64 pcnt, bcnt; /* Packet and byte counters */ }; /* The argument to IPT_SO_ADD_COUNTERS. */ struct xt_counters_info { /* Which table. */ char name[XT_TABLE_MAXNAMELEN]; unsigned int num_counters; /* The counters (actually `number' of these). */ struct xt_counters counters[0]; }; #define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */ /* fn returns 0 to continue iteration */ #define XT_MATCH_ITERATE(type, e, fn, args...) \ ({ \ unsigned int __i; \ int __ret = 0; \ struct xt_entry_match *__m; \ \ for (__i = sizeof(type); \ __i < (e)->target_offset; \ __i += __m->u.match_size) { \ __m = (void *)e + __i; \ \ __ret = fn(__m , ## args); \ if (__ret != 0) \ break; \ } \ __ret; \ }) /* fn returns 0 to continue iteration */ #define XT_ENTRY_ITERATE_CONTINUE(type, entries, size, n, fn, args...) \ ({ \ unsigned int __i, __n; \ int __ret = 0; \ type *__entry; \ \ for (__i = 0, __n = 0; __i < (size); \ __i += __entry->next_offset, __n++) { \ __entry = (void *)(entries) + __i; \ if (__n < n) \ continue; \ \ __ret = fn(__entry , ## args); \ if (__ret != 0) \ break; \ } \ __ret; \ }) /* fn returns 0 to continue iteration */ #define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \ XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args) /* pos is normally a struct ipt_entry/ip6t_entry/etc. */ #define xt_entry_foreach(pos, ehead, esize) \ for ((pos) = (typeof(pos))(ehead); \ (pos) < (typeof(pos))((char *)(ehead) + (esize)); \ (pos) = (typeof(pos))((char *)(pos) + (pos)->next_offset)) /* can only be xt_entry_match, so no use of typeof here */ #define xt_ematch_foreach(pos, entry) \ for ((pos) = (struct xt_entry_match *)entry->elems; \ (pos) < (struct xt_entry_match *)((char *)(entry) + \ (entry)->target_offset); \ (pos) = (struct xt_entry_match *)((char *)(pos) + \ (pos)->u.match_size)) #endif /* _X_TABLES_H */ ����������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_hashlimit.h����������������������������������������������������������������������0000644�����������������00000006270�14763166027�0012566 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_HASHLIMIT_H #define _XT_HASHLIMIT_H #include <linux/types.h> #include <linux/limits.h> #include <linux/if.h> /* timings are in milliseconds. */ #define XT_HASHLIMIT_SCALE 10000 #define XT_HASHLIMIT_SCALE_v2 1000000llu /* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 * seconds, or one packet every 59 hours. */ /* packet length accounting is done in 16-byte steps */ #define XT_HASHLIMIT_BYTE_SHIFT 4 /* details of this structure hidden by the implementation */ struct xt_hashlimit_htable; enum { XT_HASHLIMIT_HASH_DIP = 1 << 0, XT_HASHLIMIT_HASH_DPT = 1 << 1, XT_HASHLIMIT_HASH_SIP = 1 << 2, XT_HASHLIMIT_HASH_SPT = 1 << 3, XT_HASHLIMIT_INVERT = 1 << 4, XT_HASHLIMIT_BYTES = 1 << 5, XT_HASHLIMIT_RATE_MATCH = 1 << 6, }; struct hashlimit_cfg { __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */ __u32 avg; /* Average secs between packets * scale */ __u32 burst; /* Period multiplier for upper limit. */ /* user specified */ __u32 size; /* how many buckets */ __u32 max; /* max number of entries */ __u32 gc_interval; /* gc interval */ __u32 expire; /* when do entries expire? */ }; struct xt_hashlimit_info { char name [IFNAMSIZ]; /* name */ struct hashlimit_cfg cfg; /* Used internally by the kernel */ struct xt_hashlimit_htable *hinfo; union { void *ptr; struct xt_hashlimit_info *master; } u; }; struct hashlimit_cfg1 { __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */ __u32 avg; /* Average secs between packets * scale */ __u32 burst; /* Period multiplier for upper limit. */ /* user specified */ __u32 size; /* how many buckets */ __u32 max; /* max number of entries */ __u32 gc_interval; /* gc interval */ __u32 expire; /* when do entries expire? */ __u8 srcmask, dstmask; }; struct hashlimit_cfg2 { __u64 avg; /* Average secs between packets * scale */ __u64 burst; /* Period multiplier for upper limit. */ __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */ /* user specified */ __u32 size; /* how many buckets */ __u32 max; /* max number of entries */ __u32 gc_interval; /* gc interval */ __u32 expire; /* when do entries expire? */ __u8 srcmask, dstmask; }; struct hashlimit_cfg3 { __u64 avg; /* Average secs between packets * scale */ __u64 burst; /* Period multiplier for upper limit. */ __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */ /* user specified */ __u32 size; /* how many buckets */ __u32 max; /* max number of entries */ __u32 gc_interval; /* gc interval */ __u32 expire; /* when do entries expire? */ __u32 interval; __u8 srcmask, dstmask; }; struct xt_hashlimit_mtinfo1 { char name[IFNAMSIZ]; struct hashlimit_cfg1 cfg; /* Used internally by the kernel */ struct xt_hashlimit_htable *hinfo __attribute__((aligned(8))); }; struct xt_hashlimit_mtinfo2 { char name[NAME_MAX]; struct hashlimit_cfg2 cfg; /* Used internally by the kernel */ struct xt_hashlimit_htable *hinfo __attribute__((aligned(8))); }; struct xt_hashlimit_mtinfo3 { char name[NAME_MAX]; struct hashlimit_cfg3 cfg; /* Used internally by the kernel */ struct xt_hashlimit_htable *hinfo __attribute__((aligned(8))); }; #endif /* _XT_HASHLIMIT_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_u32.h����������������������������������������������������������������������������0000644�����������������00000001360�14763166027�0011210 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_U32_H #define _XT_U32_H 1 #include <linux/types.h> enum xt_u32_ops { XT_U32_AND, XT_U32_LEFTSH, XT_U32_RIGHTSH, XT_U32_AT, }; struct xt_u32_location_element { __u32 number; __u8 nextop; }; struct xt_u32_value_element { __u32 min; __u32 max; }; /* * Any way to allow for an arbitrary number of elements? * For now, I settle with a limit of 10 each. */ #define XT_U32_MAXSIZE 10 struct xt_u32_test { struct xt_u32_location_element location[XT_U32_MAXSIZE+1]; struct xt_u32_value_element value[XT_U32_MAXSIZE+1]; __u8 nnums; __u8 nvalues; }; struct xt_u32 { struct xt_u32_test tests[XT_U32_MAXSIZE+1]; __u8 ntests; __u8 invert; }; #endif /* _XT_U32_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/nfnetlink_conntrack.h���������������������������������������������������������������0000644�����������������00000013444�14763166027�0014124 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IPCONNTRACK_NETLINK_H #define _IPCONNTRACK_NETLINK_H #include <linux/netfilter/nfnetlink.h> enum cntl_msg_types { IPCTNL_MSG_CT_NEW, IPCTNL_MSG_CT_GET, IPCTNL_MSG_CT_DELETE, IPCTNL_MSG_CT_GET_CTRZERO, IPCTNL_MSG_CT_GET_STATS_CPU, IPCTNL_MSG_CT_GET_STATS, IPCTNL_MSG_CT_GET_DYING, IPCTNL_MSG_CT_GET_UNCONFIRMED, IPCTNL_MSG_MAX }; enum ctnl_exp_msg_types { IPCTNL_MSG_EXP_NEW, IPCTNL_MSG_EXP_GET, IPCTNL_MSG_EXP_DELETE, IPCTNL_MSG_EXP_GET_STATS_CPU, IPCTNL_MSG_EXP_MAX }; enum ctattr_type { CTA_UNSPEC, CTA_TUPLE_ORIG, CTA_TUPLE_REPLY, CTA_STATUS, CTA_PROTOINFO, CTA_HELP, CTA_NAT_SRC, #define CTA_NAT CTA_NAT_SRC /* backwards compatibility */ CTA_TIMEOUT, CTA_MARK, CTA_COUNTERS_ORIG, CTA_COUNTERS_REPLY, CTA_USE, CTA_ID, CTA_NAT_DST, CTA_TUPLE_MASTER, CTA_SEQ_ADJ_ORIG, CTA_NAT_SEQ_ADJ_ORIG = CTA_SEQ_ADJ_ORIG, CTA_SEQ_ADJ_REPLY, CTA_NAT_SEQ_ADJ_REPLY = CTA_SEQ_ADJ_REPLY, CTA_SECMARK, /* obsolete */ CTA_ZONE, CTA_SECCTX, CTA_TIMESTAMP, CTA_MARK_MASK, CTA_LABELS, CTA_LABELS_MASK, CTA_SYNPROXY, __CTA_MAX }; #define CTA_MAX (__CTA_MAX - 1) enum ctattr_tuple { CTA_TUPLE_UNSPEC, CTA_TUPLE_IP, CTA_TUPLE_PROTO, CTA_TUPLE_ZONE, __CTA_TUPLE_MAX }; #define CTA_TUPLE_MAX (__CTA_TUPLE_MAX - 1) enum ctattr_ip { CTA_IP_UNSPEC, CTA_IP_V4_SRC, CTA_IP_V4_DST, CTA_IP_V6_SRC, CTA_IP_V6_DST, __CTA_IP_MAX }; #define CTA_IP_MAX (__CTA_IP_MAX - 1) enum ctattr_l4proto { CTA_PROTO_UNSPEC, CTA_PROTO_NUM, CTA_PROTO_SRC_PORT, CTA_PROTO_DST_PORT, CTA_PROTO_ICMP_ID, CTA_PROTO_ICMP_TYPE, CTA_PROTO_ICMP_CODE, CTA_PROTO_ICMPV6_ID, CTA_PROTO_ICMPV6_TYPE, CTA_PROTO_ICMPV6_CODE, __CTA_PROTO_MAX }; #define CTA_PROTO_MAX (__CTA_PROTO_MAX - 1) enum ctattr_protoinfo { CTA_PROTOINFO_UNSPEC, CTA_PROTOINFO_TCP, CTA_PROTOINFO_DCCP, CTA_PROTOINFO_SCTP, __CTA_PROTOINFO_MAX }; #define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1) enum ctattr_protoinfo_tcp { CTA_PROTOINFO_TCP_UNSPEC, CTA_PROTOINFO_TCP_STATE, CTA_PROTOINFO_TCP_WSCALE_ORIGINAL, CTA_PROTOINFO_TCP_WSCALE_REPLY, CTA_PROTOINFO_TCP_FLAGS_ORIGINAL, CTA_PROTOINFO_TCP_FLAGS_REPLY, __CTA_PROTOINFO_TCP_MAX }; #define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1) enum ctattr_protoinfo_dccp { CTA_PROTOINFO_DCCP_UNSPEC, CTA_PROTOINFO_DCCP_STATE, CTA_PROTOINFO_DCCP_ROLE, CTA_PROTOINFO_DCCP_HANDSHAKE_SEQ, CTA_PROTOINFO_DCCP_PAD, __CTA_PROTOINFO_DCCP_MAX, }; #define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1) enum ctattr_protoinfo_sctp { CTA_PROTOINFO_SCTP_UNSPEC, CTA_PROTOINFO_SCTP_STATE, CTA_PROTOINFO_SCTP_VTAG_ORIGINAL, CTA_PROTOINFO_SCTP_VTAG_REPLY, __CTA_PROTOINFO_SCTP_MAX }; #define CTA_PROTOINFO_SCTP_MAX (__CTA_PROTOINFO_SCTP_MAX - 1) enum ctattr_counters { CTA_COUNTERS_UNSPEC, CTA_COUNTERS_PACKETS, /* 64bit counters */ CTA_COUNTERS_BYTES, /* 64bit counters */ CTA_COUNTERS32_PACKETS, /* old 32bit counters, unused */ CTA_COUNTERS32_BYTES, /* old 32bit counters, unused */ CTA_COUNTERS_PAD, __CTA_COUNTERS_MAX }; #define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1) enum ctattr_tstamp { CTA_TIMESTAMP_UNSPEC, CTA_TIMESTAMP_START, CTA_TIMESTAMP_STOP, CTA_TIMESTAMP_PAD, __CTA_TIMESTAMP_MAX }; #define CTA_TIMESTAMP_MAX (__CTA_TIMESTAMP_MAX - 1) enum ctattr_nat { CTA_NAT_UNSPEC, CTA_NAT_V4_MINIP, #define CTA_NAT_MINIP CTA_NAT_V4_MINIP CTA_NAT_V4_MAXIP, #define CTA_NAT_MAXIP CTA_NAT_V4_MAXIP CTA_NAT_PROTO, CTA_NAT_V6_MINIP, CTA_NAT_V6_MAXIP, __CTA_NAT_MAX }; #define CTA_NAT_MAX (__CTA_NAT_MAX - 1) enum ctattr_protonat { CTA_PROTONAT_UNSPEC, CTA_PROTONAT_PORT_MIN, CTA_PROTONAT_PORT_MAX, __CTA_PROTONAT_MAX }; #define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1) enum ctattr_seqadj { CTA_SEQADJ_UNSPEC, CTA_SEQADJ_CORRECTION_POS, CTA_SEQADJ_OFFSET_BEFORE, CTA_SEQADJ_OFFSET_AFTER, __CTA_SEQADJ_MAX }; #define CTA_SEQADJ_MAX (__CTA_SEQADJ_MAX - 1) enum ctattr_natseq { CTA_NAT_SEQ_UNSPEC, CTA_NAT_SEQ_CORRECTION_POS, CTA_NAT_SEQ_OFFSET_BEFORE, CTA_NAT_SEQ_OFFSET_AFTER, __CTA_NAT_SEQ_MAX }; #define CTA_NAT_SEQ_MAX (__CTA_NAT_SEQ_MAX - 1) enum ctattr_synproxy { CTA_SYNPROXY_UNSPEC, CTA_SYNPROXY_ISN, CTA_SYNPROXY_ITS, CTA_SYNPROXY_TSOFF, __CTA_SYNPROXY_MAX, }; #define CTA_SYNPROXY_MAX (__CTA_SYNPROXY_MAX - 1) enum ctattr_expect { CTA_EXPECT_UNSPEC, CTA_EXPECT_MASTER, CTA_EXPECT_TUPLE, CTA_EXPECT_MASK, CTA_EXPECT_TIMEOUT, CTA_EXPECT_ID, CTA_EXPECT_HELP_NAME, CTA_EXPECT_ZONE, CTA_EXPECT_FLAGS, CTA_EXPECT_CLASS, CTA_EXPECT_NAT, CTA_EXPECT_FN, __CTA_EXPECT_MAX }; #define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1) enum ctattr_expect_nat { CTA_EXPECT_NAT_UNSPEC, CTA_EXPECT_NAT_DIR, CTA_EXPECT_NAT_TUPLE, __CTA_EXPECT_NAT_MAX }; #define CTA_EXPECT_NAT_MAX (__CTA_EXPECT_NAT_MAX - 1) enum ctattr_help { CTA_HELP_UNSPEC, CTA_HELP_NAME, CTA_HELP_INFO, __CTA_HELP_MAX }; #define CTA_HELP_MAX (__CTA_HELP_MAX - 1) enum ctattr_secctx { CTA_SECCTX_UNSPEC, CTA_SECCTX_NAME, __CTA_SECCTX_MAX }; #define CTA_SECCTX_MAX (__CTA_SECCTX_MAX - 1) enum ctattr_stats_cpu { CTA_STATS_UNSPEC, CTA_STATS_SEARCHED, /* no longer used */ CTA_STATS_FOUND, CTA_STATS_NEW, /* no longer used */ CTA_STATS_INVALID, CTA_STATS_IGNORE, CTA_STATS_DELETE, /* no longer used */ CTA_STATS_DELETE_LIST, /* no longer used */ CTA_STATS_INSERT, CTA_STATS_INSERT_FAILED, CTA_STATS_DROP, CTA_STATS_EARLY_DROP, CTA_STATS_ERROR, CTA_STATS_SEARCH_RESTART, __CTA_STATS_MAX, }; #define CTA_STATS_MAX (__CTA_STATS_MAX - 1) enum ctattr_stats_global { CTA_STATS_GLOBAL_UNSPEC, CTA_STATS_GLOBAL_ENTRIES, CTA_STATS_GLOBAL_MAX_ENTRIES, __CTA_STATS_GLOBAL_MAX, }; #define CTA_STATS_GLOBAL_MAX (__CTA_STATS_GLOBAL_MAX - 1) enum ctattr_expect_stats { CTA_STATS_EXP_UNSPEC, CTA_STATS_EXP_NEW, CTA_STATS_EXP_CREATE, CTA_STATS_EXP_DELETE, __CTA_STATS_EXP_MAX, }; #define CTA_STATS_EXP_MAX (__CTA_STATS_EXP_MAX - 1) #endif /* _IPCONNTRACK_NETLINK_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_DSCP.h���������������������������������������������������������������������������0000644�����������������00000001271�14763166027�0011331 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* x_tables module for setting the IPv4/IPv6 DSCP field * * (C) 2002 Harald Welte <laforge@gnumonks.org> * based on ipt_FTOS.c (C) 2000 by Matthew G. Marsh <mgm@paktronix.com> * This software is distributed under GNU GPL v2, 1991 * * See RFC2474 for a description of the DSCP field within the IP Header. * * xt_DSCP.h,v 1.7 2002/03/14 12:03:13 laforge Exp */ #ifndef _XT_DSCP_TARGET_H #define _XT_DSCP_TARGET_H #include <linux/netfilter/xt_dscp.h> #include <linux/types.h> /* target info */ struct xt_DSCP_info { __u8 dscp; }; struct xt_tos_target_info { __u8 tos_value; __u8 tos_mask; }; #endif /* _XT_DSCP_TARGET_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_helper.h�������������������������������������������������������������������������0000644�����������������00000000274�14763166027�0012061 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_HELPER_H #define _XT_HELPER_H struct xt_helper_info { int invert; char name[30]; }; #endif /* _XT_HELPER_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_connmark.h�����������������������������������������������������������������������0000644�����������������00000001604�14763166027�0012410 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef _XT_CONNMARK_H #define _XT_CONNMARK_H #include <linux/types.h> /* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com> * by Henrik Nordstrom <hno@marasystems.com> * * 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. */ enum { XT_CONNMARK_SET = 0, XT_CONNMARK_SAVE, XT_CONNMARK_RESTORE }; enum { D_SHIFT_LEFT = 0, D_SHIFT_RIGHT, }; struct xt_connmark_tginfo1 { __u32 ctmark, ctmask, nfmask; __u8 mode; }; struct xt_connmark_tginfo2 { __u32 ctmark, ctmask, nfmask; __u8 shift_dir, shift_bits, mode; }; struct xt_connmark_mtinfo1 { __u32 mark, mask; __u8 invert; }; #endif /*_XT_CONNMARK_H*/ ����������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_conntrack.h����������������������������������������������������������������������0000644�����������������00000004775�14763166027�0012576 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* Header file for kernel module to match connection tracking information. * GPL (C) 2001 Marc Boucher (marc@mbsi.ca). */ #ifndef _XT_CONNTRACK_H #define _XT_CONNTRACK_H #include <linux/types.h> #include <linux/netfilter.h> #include <linux/netfilter/nf_conntrack_tuple_common.h> #define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) #define XT_CONNTRACK_STATE_INVALID (1 << 0) #define XT_CONNTRACK_STATE_SNAT (1 << (IP_CT_NUMBER + 1)) #define XT_CONNTRACK_STATE_DNAT (1 << (IP_CT_NUMBER + 2)) #define XT_CONNTRACK_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 3)) /* flags, invflags: */ enum { XT_CONNTRACK_STATE = 1 << 0, XT_CONNTRACK_PROTO = 1 << 1, XT_CONNTRACK_ORIGSRC = 1 << 2, XT_CONNTRACK_ORIGDST = 1 << 3, XT_CONNTRACK_REPLSRC = 1 << 4, XT_CONNTRACK_REPLDST = 1 << 5, XT_CONNTRACK_STATUS = 1 << 6, XT_CONNTRACK_EXPIRES = 1 << 7, XT_CONNTRACK_ORIGSRC_PORT = 1 << 8, XT_CONNTRACK_ORIGDST_PORT = 1 << 9, XT_CONNTRACK_REPLSRC_PORT = 1 << 10, XT_CONNTRACK_REPLDST_PORT = 1 << 11, XT_CONNTRACK_DIRECTION = 1 << 12, XT_CONNTRACK_STATE_ALIAS = 1 << 13, }; struct xt_conntrack_mtinfo1 { union nf_inet_addr origsrc_addr, origsrc_mask; union nf_inet_addr origdst_addr, origdst_mask; union nf_inet_addr replsrc_addr, replsrc_mask; union nf_inet_addr repldst_addr, repldst_mask; __u32 expires_min, expires_max; __u16 l4proto; __be16 origsrc_port, origdst_port; __be16 replsrc_port, repldst_port; __u16 match_flags, invert_flags; __u8 state_mask, status_mask; }; struct xt_conntrack_mtinfo2 { union nf_inet_addr origsrc_addr, origsrc_mask; union nf_inet_addr origdst_addr, origdst_mask; union nf_inet_addr replsrc_addr, replsrc_mask; union nf_inet_addr repldst_addr, repldst_mask; __u32 expires_min, expires_max; __u16 l4proto; __be16 origsrc_port, origdst_port; __be16 replsrc_port, repldst_port; __u16 match_flags, invert_flags; __u16 state_mask, status_mask; }; struct xt_conntrack_mtinfo3 { union nf_inet_addr origsrc_addr, origsrc_mask; union nf_inet_addr origdst_addr, origdst_mask; union nf_inet_addr replsrc_addr, replsrc_mask; union nf_inet_addr repldst_addr, repldst_mask; __u32 expires_min, expires_max; __u16 l4proto; __u16 origsrc_port, origdst_port; __u16 replsrc_port, repldst_port; __u16 match_flags, invert_flags; __u16 state_mask, status_mask; __u16 origsrc_port_high, origdst_port_high; __u16 replsrc_port_high, repldst_port_high; }; #endif /*_XT_CONNTRACK_H*/ ���linux/netfilter/nf_conntrack_ftp.h������������������������������������������������������������������0000644�����������������00000000666�14763166027�0013412 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NF_CONNTRACK_FTP_H #define _NF_CONNTRACK_FTP_H /* FTP tracking. */ /* This enum is exposed to userspace */ enum nf_ct_ftp_type { /* PORT command from client */ NF_CT_FTP_PORT, /* PASV response from server */ NF_CT_FTP_PASV, /* EPRT command from client */ NF_CT_FTP_EPRT, /* EPSV response from server */ NF_CT_FTP_EPSV, }; #endif /* _NF_CONNTRACK_FTP_H */ ��������������������������������������������������������������������������linux/netfilter/nf_conntrack_common.h���������������������������������������������������������������0000644�����������������00000010505�14763166027�0014102 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NF_CONNTRACK_COMMON_H #define _NF_CONNTRACK_COMMON_H /* Connection state tracking for netfilter. This is separated from, but required by, the NAT layer; it can also be used by an iptables extension. */ enum ip_conntrack_info { /* Part of an established connection (either direction). */ IP_CT_ESTABLISHED, /* Like NEW, but related to an existing connection, or ICMP error (in either direction). */ IP_CT_RELATED, /* Started a new connection to track (only IP_CT_DIR_ORIGINAL); may be a retransmission. */ IP_CT_NEW, /* >= this indicates reply direction */ IP_CT_IS_REPLY, IP_CT_ESTABLISHED_REPLY = IP_CT_ESTABLISHED + IP_CT_IS_REPLY, IP_CT_RELATED_REPLY = IP_CT_RELATED + IP_CT_IS_REPLY, /* No NEW in reply direction. */ /* Number of distinct IP_CT types. */ IP_CT_NUMBER, /* only for userspace compatibility */ IP_CT_NEW_REPLY = IP_CT_NUMBER, }; #define NF_CT_STATE_INVALID_BIT (1 << 0) #define NF_CT_STATE_BIT(ctinfo) (1 << ((ctinfo) % IP_CT_IS_REPLY + 1)) #define NF_CT_STATE_UNTRACKED_BIT (1 << 6) /* Bitset representing status of connection. */ enum ip_conntrack_status { /* It's an expected connection: bit 0 set. This bit never changed */ IPS_EXPECTED_BIT = 0, IPS_EXPECTED = (1 << IPS_EXPECTED_BIT), /* We've seen packets both ways: bit 1 set. Can be set, not unset. */ IPS_SEEN_REPLY_BIT = 1, IPS_SEEN_REPLY = (1 << IPS_SEEN_REPLY_BIT), /* Conntrack should never be early-expired. */ IPS_ASSURED_BIT = 2, IPS_ASSURED = (1 << IPS_ASSURED_BIT), /* Connection is confirmed: originating packet has left box */ IPS_CONFIRMED_BIT = 3, IPS_CONFIRMED = (1 << IPS_CONFIRMED_BIT), /* Connection needs src nat in orig dir. This bit never changed. */ IPS_SRC_NAT_BIT = 4, IPS_SRC_NAT = (1 << IPS_SRC_NAT_BIT), /* Connection needs dst nat in orig dir. This bit never changed. */ IPS_DST_NAT_BIT = 5, IPS_DST_NAT = (1 << IPS_DST_NAT_BIT), /* Both together. */ IPS_NAT_MASK = (IPS_DST_NAT | IPS_SRC_NAT), /* Connection needs TCP sequence adjusted. */ IPS_SEQ_ADJUST_BIT = 6, IPS_SEQ_ADJUST = (1 << IPS_SEQ_ADJUST_BIT), /* NAT initialization bits. */ IPS_SRC_NAT_DONE_BIT = 7, IPS_SRC_NAT_DONE = (1 << IPS_SRC_NAT_DONE_BIT), IPS_DST_NAT_DONE_BIT = 8, IPS_DST_NAT_DONE = (1 << IPS_DST_NAT_DONE_BIT), /* Both together */ IPS_NAT_DONE_MASK = (IPS_DST_NAT_DONE | IPS_SRC_NAT_DONE), /* Connection is dying (removed from lists), can not be unset. */ IPS_DYING_BIT = 9, IPS_DYING = (1 << IPS_DYING_BIT), /* Connection has fixed timeout. */ IPS_FIXED_TIMEOUT_BIT = 10, IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT), /* Conntrack is a template */ IPS_TEMPLATE_BIT = 11, IPS_TEMPLATE = (1 << IPS_TEMPLATE_BIT), /* Conntrack is a fake untracked entry. Obsolete and not used anymore */ IPS_UNTRACKED_BIT = 12, IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT), /* Conntrack got a helper explicitly attached via CT target. */ IPS_HELPER_BIT = 13, IPS_HELPER = (1 << IPS_HELPER_BIT), /* Conntrack has been offloaded to flow table. */ IPS_OFFLOAD_BIT = 14, IPS_OFFLOAD = (1 << IPS_OFFLOAD_BIT), /* Be careful here, modifying these bits can make things messy, * so don't let users modify them directly. */ IPS_UNCHANGEABLE_MASK = (IPS_NAT_DONE_MASK | IPS_NAT_MASK | IPS_EXPECTED | IPS_CONFIRMED | IPS_DYING | IPS_SEQ_ADJUST | IPS_TEMPLATE | IPS_OFFLOAD), __IPS_MAX_BIT = 15, }; /* Connection tracking event types */ enum ip_conntrack_events { IPCT_NEW, /* new conntrack */ IPCT_RELATED, /* related conntrack */ IPCT_DESTROY, /* destroyed conntrack */ IPCT_REPLY, /* connection has seen two-way traffic */ IPCT_ASSURED, /* connection status has changed to assured */ IPCT_PROTOINFO, /* protocol information has changed */ IPCT_HELPER, /* new helper has been set */ IPCT_MARK, /* new mark has been set */ IPCT_SEQADJ, /* sequence adjustment has changed */ IPCT_NATSEQADJ = IPCT_SEQADJ, IPCT_SECMARK, /* new security mark has been set */ IPCT_LABEL, /* new connlabel has been set */ IPCT_SYNPROXY, /* synproxy has been set */ }; enum ip_conntrack_expect_events { IPEXP_NEW, /* new expectation */ IPEXP_DESTROY, /* destroyed expectation */ }; /* expectation flags */ #define NF_CT_EXPECT_PERMANENT 0x1 #define NF_CT_EXPECT_INACTIVE 0x2 #define NF_CT_EXPECT_USERSPACE 0x4 #endif /* _NF_CONNTRACK_COMMON_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/nfnetlink_compat.h������������������������������������������������������������������0000644�����������������00000004614�14763166027�0013424 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NFNETLINK_COMPAT_H #define _NFNETLINK_COMPAT_H #include <linux/types.h> /* Old nfnetlink macros for userspace */ /* nfnetlink groups: Up to 32 maximum */ #define NF_NETLINK_CONNTRACK_NEW 0x00000001 #define NF_NETLINK_CONNTRACK_UPDATE 0x00000002 #define NF_NETLINK_CONNTRACK_DESTROY 0x00000004 #define NF_NETLINK_CONNTRACK_EXP_NEW 0x00000008 #define NF_NETLINK_CONNTRACK_EXP_UPDATE 0x00000010 #define NF_NETLINK_CONNTRACK_EXP_DESTROY 0x00000020 /* Generic structure for encapsulation optional netfilter information. * It is reminiscent of sockaddr, but with sa_family replaced * with attribute type. * ! This should someday be put somewhere generic as now rtnetlink and * ! nfnetlink use the same attributes methods. - J. Schulist. */ struct nfattr { __u16 nfa_len; __u16 nfa_type; /* we use 15 bits for the type, and the highest * bit to indicate whether the payload is nested */ }; /* FIXME: Apart from NFNL_NFA_NESTED shamelessly copy and pasted from * rtnetlink.h, it's time to put this in a generic file */ #define NFNL_NFA_NEST 0x8000 #define NFA_TYPE(attr) ((attr)->nfa_type & 0x7fff) #define NFA_ALIGNTO 4 #define NFA_ALIGN(len) (((len) + NFA_ALIGNTO - 1) & ~(NFA_ALIGNTO - 1)) #define NFA_OK(nfa,len) ((len) > 0 && (nfa)->nfa_len >= sizeof(struct nfattr) \ && (nfa)->nfa_len <= (len)) #define NFA_NEXT(nfa,attrlen) ((attrlen) -= NFA_ALIGN((nfa)->nfa_len), \ (struct nfattr *)(((char *)(nfa)) + NFA_ALIGN((nfa)->nfa_len))) #define NFA_LENGTH(len) (NFA_ALIGN(sizeof(struct nfattr)) + (len)) #define NFA_SPACE(len) NFA_ALIGN(NFA_LENGTH(len)) #define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) #define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) #define NFA_NEST(skb, type) \ ({ struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \ NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \ __start; }) #define NFA_NEST_END(skb, start) \ ({ (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \ (skb)->len; }) #define NFA_NEST_CANCEL(skb, start) \ ({ if (start) \ skb_trim(skb, (unsigned char *) (start) - (skb)->data); \ -1; }) #define NFM_NFA(n) ((struct nfattr *)(((char *)(n)) \ + NLMSG_ALIGN(sizeof(struct nfgenmsg)))) #define NFM_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct nfgenmsg)) #endif /* _NFNETLINK_COMPAT_H */ ��������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_CLASSIFY.h�����������������������������������������������������������������������0000644�����������������00000000331�14763166027�0012011 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_CLASSIFY_H #define _XT_CLASSIFY_H #include <linux/types.h> struct xt_classify_target_info { __u32 priority; }; #endif /*_XT_CLASSIFY_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_tcpudp.h�������������������������������������������������������������������������0000644�����������������00000002342�14763166027�0012077 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_TCPUDP_H #define _XT_TCPUDP_H #include <linux/types.h> /* TCP matching stuff */ struct xt_tcp { __u16 spts[2]; /* Source port range. */ __u16 dpts[2]; /* Destination port range. */ __u8 option; /* TCP Option iff non-zero*/ __u8 flg_mask; /* TCP flags mask byte */ __u8 flg_cmp; /* TCP flags compare byte */ __u8 invflags; /* Inverse flags */ }; /* Values for "inv" field in struct ipt_tcp. */ #define XT_TCP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ #define XT_TCP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ #define XT_TCP_INV_FLAGS 0x04 /* Invert the sense of TCP flags. */ #define XT_TCP_INV_OPTION 0x08 /* Invert the sense of option test. */ #define XT_TCP_INV_MASK 0x0F /* All possible flags. */ /* UDP matching stuff */ struct xt_udp { __u16 spts[2]; /* Source port range. */ __u16 dpts[2]; /* Destination port range. */ __u8 invflags; /* Inverse flags */ }; /* Values for "invflags" field in struct ipt_udp. */ #define XT_UDP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ #define XT_UDP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ #define XT_UDP_INV_MASK 0x03 /* All possible flags. */ #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_TPROXY.h�������������������������������������������������������������������������0000644�����������������00000001077�14763166027�0011651 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_TPROXY_H #define _XT_TPROXY_H #include <linux/types.h> #include <linux/netfilter.h> /* TPROXY target is capable of marking the packet to perform * redirection. We can get rid of that whenever we get support for * mutliple targets in the same rule. */ struct xt_tproxy_target_info { __u32 mark_mask; __u32 mark_value; __be32 laddr; __be16 lport; }; struct xt_tproxy_target_info_v1 { __u32 mark_mask; __u32 mark_value; union nf_inet_addr laddr; __be16 lport; }; #endif /* _XT_TPROXY_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_set.h����������������������������������������������������������������������������0000644�����������������00000003443�14763166027�0011376 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_SET_H #define _XT_SET_H #include <linux/types.h> #include <linux/netfilter/ipset/ip_set.h> /* Revision 0 interface: backward compatible with netfilter/iptables */ /* * Option flags for kernel operations (xt_set_info_v0) */ #define IPSET_SRC 0x01 /* Source match/add */ #define IPSET_DST 0x02 /* Destination match/add */ #define IPSET_MATCH_INV 0x04 /* Inverse matching */ struct xt_set_info_v0 { ip_set_id_t index; union { __u32 flags[IPSET_DIM_MAX + 1]; struct { __u32 __flags[IPSET_DIM_MAX]; __u8 dim; __u8 flags; } compat; } u; }; /* match and target infos */ struct xt_set_info_match_v0 { struct xt_set_info_v0 match_set; }; struct xt_set_info_target_v0 { struct xt_set_info_v0 add_set; struct xt_set_info_v0 del_set; }; /* Revision 1 match and target */ struct xt_set_info { ip_set_id_t index; __u8 dim; __u8 flags; }; /* match and target infos */ struct xt_set_info_match_v1 { struct xt_set_info match_set; }; struct xt_set_info_target_v1 { struct xt_set_info add_set; struct xt_set_info del_set; }; /* Revision 2 target */ struct xt_set_info_target_v2 { struct xt_set_info add_set; struct xt_set_info del_set; __u32 flags; __u32 timeout; }; /* Revision 3 match */ struct xt_set_info_match_v3 { struct xt_set_info match_set; struct ip_set_counter_match0 packets; struct ip_set_counter_match0 bytes; __u32 flags; }; /* Revision 3 target */ struct xt_set_info_target_v3 { struct xt_set_info add_set; struct xt_set_info del_set; struct xt_set_info map_set; __u32 flags; __u32 timeout; }; /* Revision 4 match */ struct xt_set_info_match_v4 { struct xt_set_info match_set; struct ip_set_counter_match packets; struct ip_set_counter_match bytes; __u32 flags; }; #endif /*_XT_SET_H*/ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_statistic.h����������������������������������������������������������������������0000644�����������������00000001314�14763166027�0012605 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_STATISTIC_H #define _XT_STATISTIC_H #include <linux/types.h> enum xt_statistic_mode { XT_STATISTIC_MODE_RANDOM, XT_STATISTIC_MODE_NTH, __XT_STATISTIC_MODE_MAX }; #define XT_STATISTIC_MODE_MAX (__XT_STATISTIC_MODE_MAX - 1) enum xt_statistic_flags { XT_STATISTIC_INVERT = 0x1, }; #define XT_STATISTIC_MASK 0x1 struct xt_statistic_priv; struct xt_statistic_info { __u16 mode; __u16 flags; union { struct { __u32 probability; } random; struct { __u32 every; __u32 packet; __u32 count; /* unused */ } nth; } u; struct xt_statistic_priv *master __attribute__((aligned(8))); }; #endif /* _XT_STATISTIC_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_CT.h�����������������������������������������������������������������������������0000644�����������������00000001525�14763166027�0011110 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_CT_H #define _XT_CT_H #include <linux/types.h> enum { XT_CT_NOTRACK = 1 << 0, XT_CT_NOTRACK_ALIAS = 1 << 1, XT_CT_ZONE_DIR_ORIG = 1 << 2, XT_CT_ZONE_DIR_REPL = 1 << 3, XT_CT_ZONE_MARK = 1 << 4, XT_CT_MASK = XT_CT_NOTRACK | XT_CT_NOTRACK_ALIAS | XT_CT_ZONE_DIR_ORIG | XT_CT_ZONE_DIR_REPL | XT_CT_ZONE_MARK, }; struct xt_ct_target_info { __u16 flags; __u16 zone; __u32 ct_events; __u32 exp_events; char helper[16]; /* Used internally by the kernel */ struct nf_conn *ct __attribute__((aligned(8))); }; struct xt_ct_target_info_v1 { __u16 flags; __u16 zone; __u32 ct_events; __u32 exp_events; char helper[16]; char timeout[32]; /* Used internally by the kernel */ struct nf_conn *ct __attribute__((aligned(8))); }; #endif /* _XT_CT_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_NFQUEUE.h������������������������������������������������������������������������0000644�����������������00000001413�14763166027�0011706 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* iptables module for using NFQUEUE mechanism * * (C) 2005 Harald Welte <laforge@netfilter.org> * * This software is distributed under GNU GPL v2, 1991 * */ #ifndef _XT_NFQ_TARGET_H #define _XT_NFQ_TARGET_H #include <linux/types.h> /* target info */ struct xt_NFQ_info { __u16 queuenum; }; struct xt_NFQ_info_v1 { __u16 queuenum; __u16 queues_total; }; struct xt_NFQ_info_v2 { __u16 queuenum; __u16 queues_total; __u16 bypass; }; struct xt_NFQ_info_v3 { __u16 queuenum; __u16 queues_total; __u16 flags; #define NFQ_FLAG_BYPASS 0x01 /* for compatibility with v2 */ #define NFQ_FLAG_CPU_FANOUT 0x02 /* use current CPU (no hashing) */ #define NFQ_FLAG_MASK 0x03 }; #endif /* _XT_NFQ_TARGET_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_connbytes.h����������������������������������������������������������������������0000644�����������������00000001101�14763166027�0012574 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_CONNBYTES_H #define _XT_CONNBYTES_H #include <linux/types.h> enum xt_connbytes_what { XT_CONNBYTES_PKTS, XT_CONNBYTES_BYTES, XT_CONNBYTES_AVGPKT, }; enum xt_connbytes_direction { XT_CONNBYTES_DIR_ORIGINAL, XT_CONNBYTES_DIR_REPLY, XT_CONNBYTES_DIR_BOTH, }; struct xt_connbytes_info { struct { __aligned_u64 from; /* count to be matched */ __aligned_u64 to; /* count to be matched */ } count; __u8 what; /* ipt_connbytes_what */ __u8 direction; /* ipt_connbytes_direction */ }; #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_quota.h��������������������������������������������������������������������������0000644�����������������00000000620�14763166027�0011726 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_QUOTA_H #define _XT_QUOTA_H #include <linux/types.h> enum xt_quota_flags { XT_QUOTA_INVERT = 0x1, }; #define XT_QUOTA_MASK 0x1 struct xt_quota_priv; struct xt_quota_info { __u32 flags; __u32 pad; __aligned_u64 quota; /* Used internally by the kernel */ struct xt_quota_priv *master; }; #endif /* _XT_QUOTA_H */ ����������������������������������������������������������������������������������������������������������������linux/netfilter/xt_NFLOG.h��������������������������������������������������������������������������0000644�����������������00000001054�14763166027�0011444 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_NFLOG_TARGET #define _XT_NFLOG_TARGET #include <linux/types.h> #define XT_NFLOG_DEFAULT_GROUP 0x1 #define XT_NFLOG_DEFAULT_THRESHOLD 0 #define XT_NFLOG_MASK 0x1 /* This flag indicates that 'len' field in xt_nflog_info is set*/ #define XT_NFLOG_F_COPY_LEN 0x1 struct xt_nflog_info { /* 'len' will be used iff you set XT_NFLOG_F_COPY_LEN in flags */ __u32 len; __u16 group; __u16 threshold; __u16 flags; __u16 pad; char prefix[64]; }; #endif /* _XT_NFLOG_TARGET */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_esp.h����������������������������������������������������������������������������0000644�����������������00000000642�14763166027�0011370 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_ESP_H #define _XT_ESP_H #include <linux/types.h> struct xt_esp { __u32 spis[2]; /* Security Parameter Index */ __u8 invflags; /* Inverse flags */ }; /* Values for "invflags" field in struct xt_esp. */ #define XT_ESP_INV_SPI 0x01 /* Invert the sense of spi. */ #define XT_ESP_INV_MASK 0x01 /* All possible flags. */ #endif /*_XT_ESP_H*/ ����������������������������������������������������������������������������������������������linux/netfilter/xt_osf.h����������������������������������������������������������������������������0000644�����������������00000003247�14763166027�0011374 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 2003+ Evgeniy Polyakov <johnpol@2ka.mxt.ru> * * * 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, see <http://www.gnu.org/licenses/>. */ #ifndef _XT_OSF_H #define _XT_OSF_H #include <linux/types.h> #include <linux/netfilter/nfnetlink_osf.h> #define XT_OSF_GENRE NF_OSF_GENRE #define XT_OSF_INVERT NF_OSF_INVERT #define XT_OSF_TTL NF_OSF_TTL #define XT_OSF_LOG NF_OSF_LOG #define XT_OSF_LOGLEVEL_ALL NF_OSF_LOGLEVEL_ALL #define XT_OSF_LOGLEVEL_FIRST NF_OSF_LOGLEVEL_FIRST #define XT_OSF_LOGLEVEL_ALL_KNOWN NF_OSF_LOGLEVEL_ALL_KNOWN #define XT_OSF_TTL_TRUE NF_OSF_TTL_TRUE #define XT_OSF_TTL_NOCHECK NF_OSF_TTL_NOCHECK #define XT_OSF_TTL_LESS NF_OSF_TTL_LESS #define xt_osf_wc nf_osf_wc #define xt_osf_opt nf_osf_opt #define xt_osf_info nf_osf_info #define xt_osf_user_finger nf_osf_user_finger #define xt_osf_finger nf_osf_finger #define xt_osf_nlmsg nf_osf_nlmsg #define xt_osf_window_size_options nf_osf_window_size_options #define xt_osf_attr_type nf_osf_attr_type #define xt_osf_msg_types nf_osf_msg_types #endif /* _XT_OSF_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/nfnetlink_log.h���������������������������������������������������������������������0000644�����������������00000005357�14763166027�0012727 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NFNETLINK_LOG_H #define _NFNETLINK_LOG_H /* This file describes the netlink messages (i.e. 'protocol packets'), * and not any kind of function definitions. It is shared between kernel and * userspace. Don't put kernel specific stuff in here */ #include <linux/types.h> #include <linux/netfilter/nfnetlink.h> enum nfulnl_msg_types { NFULNL_MSG_PACKET, /* packet from kernel to userspace */ NFULNL_MSG_CONFIG, /* connect to a particular queue */ NFULNL_MSG_MAX }; struct nfulnl_msg_packet_hdr { __be16 hw_protocol; /* hw protocol (network order) */ __u8 hook; /* netfilter hook */ __u8 _pad; }; struct nfulnl_msg_packet_hw { __be16 hw_addrlen; __u16 _pad; __u8 hw_addr[8]; }; struct nfulnl_msg_packet_timestamp { __aligned_be64 sec; __aligned_be64 usec; }; enum nfulnl_attr_type { NFULA_UNSPEC, NFULA_PACKET_HDR, NFULA_MARK, /* __u32 nfmark */ NFULA_TIMESTAMP, /* nfulnl_msg_packet_timestamp */ NFULA_IFINDEX_INDEV, /* __u32 ifindex */ NFULA_IFINDEX_OUTDEV, /* __u32 ifindex */ NFULA_IFINDEX_PHYSINDEV, /* __u32 ifindex */ NFULA_IFINDEX_PHYSOUTDEV, /* __u32 ifindex */ NFULA_HWADDR, /* nfulnl_msg_packet_hw */ NFULA_PAYLOAD, /* opaque data payload */ NFULA_PREFIX, /* string prefix */ NFULA_UID, /* user id of socket */ NFULA_SEQ, /* instance-local sequence number */ NFULA_SEQ_GLOBAL, /* global sequence number */ NFULA_GID, /* group id of socket */ NFULA_HWTYPE, /* hardware type */ NFULA_HWHEADER, /* hardware header */ NFULA_HWLEN, /* hardware header length */ NFULA_CT, /* nf_conntrack_netlink.h */ NFULA_CT_INFO, /* enum ip_conntrack_info */ __NFULA_MAX }; #define NFULA_MAX (__NFULA_MAX - 1) enum nfulnl_msg_config_cmds { NFULNL_CFG_CMD_NONE, NFULNL_CFG_CMD_BIND, NFULNL_CFG_CMD_UNBIND, NFULNL_CFG_CMD_PF_BIND, NFULNL_CFG_CMD_PF_UNBIND, }; struct nfulnl_msg_config_cmd { __u8 command; /* nfulnl_msg_config_cmds */ } __attribute__ ((packed)); struct nfulnl_msg_config_mode { __be32 copy_range; __u8 copy_mode; __u8 _pad; } __attribute__ ((packed)); enum nfulnl_attr_config { NFULA_CFG_UNSPEC, NFULA_CFG_CMD, /* nfulnl_msg_config_cmd */ NFULA_CFG_MODE, /* nfulnl_msg_config_mode */ NFULA_CFG_NLBUFSIZ, /* __u32 buffer size */ NFULA_CFG_TIMEOUT, /* __u32 in 1/100 s */ NFULA_CFG_QTHRESH, /* __u32 */ NFULA_CFG_FLAGS, /* __u16 */ __NFULA_CFG_MAX }; #define NFULA_CFG_MAX (__NFULA_CFG_MAX -1) #define NFULNL_COPY_NONE 0x00 #define NFULNL_COPY_META 0x01 #define NFULNL_COPY_PACKET 0x02 /* 0xff is reserved, don't use it for new copy modes. */ #define NFULNL_CFG_F_SEQ 0x0001 #define NFULNL_CFG_F_SEQ_GLOBAL 0x0002 #define NFULNL_CFG_F_CONNTRACK 0x0004 #endif /* _NFNETLINK_LOG_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_devgroup.h�����������������������������������������������������������������������0000644�����������������00000000655�14763166027�0012440 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_DEVGROUP_H #define _XT_DEVGROUP_H #include <linux/types.h> enum xt_devgroup_flags { XT_DEVGROUP_MATCH_SRC = 0x1, XT_DEVGROUP_INVERT_SRC = 0x2, XT_DEVGROUP_MATCH_DST = 0x4, XT_DEVGROUP_INVERT_DST = 0x8, }; struct xt_devgroup_info { __u32 flags; __u32 src_group; __u32 src_mask; __u32 dst_group; __u32 dst_mask; }; #endif /* _XT_DEVGROUP_H */ �����������������������������������������������������������������������������������linux/netfilter/xt_AUDIT.h��������������������������������������������������������������������������0000644�����������������00000001316�14763166027�0011446 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Header file for iptables xt_AUDIT target * * (C) 2010-2011 Thomas Graf <tgraf@redhat.com> * (C) 2010-2011 Red Hat, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef _XT_AUDIT_TARGET_H #define _XT_AUDIT_TARGET_H #include <linux/types.h> enum { XT_AUDIT_TYPE_ACCEPT = 0, XT_AUDIT_TYPE_DROP, XT_AUDIT_TYPE_REJECT, __XT_AUDIT_TYPE_MAX, }; #define XT_AUDIT_TYPE_MAX (__XT_AUDIT_TYPE_MAX - 1) struct xt_audit_info { __u8 type; /* XT_AUDIT_TYPE_* */ }; #endif /* _XT_AUDIT_TARGET_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_SECMARK.h������������������������������������������������������������������������0000644�����������������00000001210�14763166027�0011656 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_SECMARK_H_target #define _XT_SECMARK_H_target #include <linux/types.h> /* * This is intended for use by various security subsystems (but not * at the same time). * * 'mode' refers to the specific security subsystem which the * packets are being marked for. */ #define SECMARK_MODE_SEL 0x01 /* SELinux */ #define SECMARK_SECCTX_MAX 256 struct xt_secmark_target_info { __u8 mode; __u32 secid; char secctx[SECMARK_SECCTX_MAX]; }; struct xt_secmark_target_info_v1 { __u8 mode; char secctx[SECMARK_SECCTX_MAX]; __u32 secid; }; #endif /*_XT_SECMARK_H_target */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_cluster.h������������������������������������������������������������������������0000644�����������������00000000566�14763166027�0012267 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_CLUSTER_MATCH_H #define _XT_CLUSTER_MATCH_H #include <linux/types.h> enum xt_cluster_flags { XT_CLUSTER_F_INV = (1 << 0) }; struct xt_cluster_match_info { __u32 total_nodes; __u32 node_mask; __u32 hash_seed; __u32 flags; }; #define XT_CLUSTER_NODES_MAX 32 #endif /* _XT_CLUSTER_MATCH_H */ ������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_CONNSECMARK.h��������������������������������������������������������������������0000644�����������������00000000455�14763166027�0012346 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_CONNSECMARK_H_target #define _XT_CONNSECMARK_H_target #include <linux/types.h> enum { CONNSECMARK_SAVE = 1, CONNSECMARK_RESTORE, }; struct xt_connsecmark_target_info { __u8 mode; }; #endif /*_XT_CONNSECMARK_H_target */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_TCPMSS.h�������������������������������������������������������������������������0000644�����������������00000000353�14763166027�0011611 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_TCPMSS_H #define _XT_TCPMSS_H #include <linux/types.h> struct xt_tcpmss_info { __u16 mss; }; #define XT_TCPMSS_CLAMP_PMTU 0xffff #endif /* _XT_TCPMSS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/nfnetlink_queue.h�������������������������������������������������������������������0000644�����������������00000006653�14763166027�0013272 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NFNETLINK_QUEUE_H #define _NFNETLINK_QUEUE_H #include <linux/types.h> #include <linux/netfilter/nfnetlink.h> enum nfqnl_msg_types { NFQNL_MSG_PACKET, /* packet from kernel to userspace */ NFQNL_MSG_VERDICT, /* verdict from userspace to kernel */ NFQNL_MSG_CONFIG, /* connect to a particular queue */ NFQNL_MSG_VERDICT_BATCH, /* batchv from userspace to kernel */ NFQNL_MSG_MAX }; struct nfqnl_msg_packet_hdr { __be32 packet_id; /* unique ID of packet in queue */ __be16 hw_protocol; /* hw protocol (network order) */ __u8 hook; /* netfilter hook */ } __attribute__ ((packed)); struct nfqnl_msg_packet_hw { __be16 hw_addrlen; __u16 _pad; __u8 hw_addr[8]; }; struct nfqnl_msg_packet_timestamp { __aligned_be64 sec; __aligned_be64 usec; }; enum nfqnl_vlan_attr { NFQA_VLAN_UNSPEC, NFQA_VLAN_PROTO, /* __be16 skb vlan_proto */ NFQA_VLAN_TCI, /* __be16 skb htons(vlan_tci) */ __NFQA_VLAN_MAX, }; #define NFQA_VLAN_MAX (__NFQA_VLAN_MAX - 1) enum nfqnl_attr_type { NFQA_UNSPEC, NFQA_PACKET_HDR, NFQA_VERDICT_HDR, /* nfqnl_msg_verdict_hrd */ NFQA_MARK, /* __u32 nfmark */ NFQA_TIMESTAMP, /* nfqnl_msg_packet_timestamp */ NFQA_IFINDEX_INDEV, /* __u32 ifindex */ NFQA_IFINDEX_OUTDEV, /* __u32 ifindex */ NFQA_IFINDEX_PHYSINDEV, /* __u32 ifindex */ NFQA_IFINDEX_PHYSOUTDEV, /* __u32 ifindex */ NFQA_HWADDR, /* nfqnl_msg_packet_hw */ NFQA_PAYLOAD, /* opaque data payload */ NFQA_CT, /* nf_conntrack_netlink.h */ NFQA_CT_INFO, /* enum ip_conntrack_info */ NFQA_CAP_LEN, /* __u32 length of captured packet */ NFQA_SKB_INFO, /* __u32 skb meta information */ NFQA_EXP, /* nf_conntrack_netlink.h */ NFQA_UID, /* __u32 sk uid */ NFQA_GID, /* __u32 sk gid */ NFQA_SECCTX, /* security context string */ NFQA_VLAN, /* nested attribute: packet vlan info */ NFQA_L2HDR, /* full L2 header */ __NFQA_MAX }; #define NFQA_MAX (__NFQA_MAX - 1) struct nfqnl_msg_verdict_hdr { __be32 verdict; __be32 id; }; enum nfqnl_msg_config_cmds { NFQNL_CFG_CMD_NONE, NFQNL_CFG_CMD_BIND, NFQNL_CFG_CMD_UNBIND, NFQNL_CFG_CMD_PF_BIND, NFQNL_CFG_CMD_PF_UNBIND, }; struct nfqnl_msg_config_cmd { __u8 command; /* nfqnl_msg_config_cmds */ __u8 _pad; __be16 pf; /* AF_xxx for PF_[UN]BIND */ }; enum nfqnl_config_mode { NFQNL_COPY_NONE, NFQNL_COPY_META, NFQNL_COPY_PACKET, }; struct nfqnl_msg_config_params { __be32 copy_range; __u8 copy_mode; /* enum nfqnl_config_mode */ } __attribute__ ((packed)); enum nfqnl_attr_config { NFQA_CFG_UNSPEC, NFQA_CFG_CMD, /* nfqnl_msg_config_cmd */ NFQA_CFG_PARAMS, /* nfqnl_msg_config_params */ NFQA_CFG_QUEUE_MAXLEN, /* __u32 */ NFQA_CFG_MASK, /* identify which flags to change */ NFQA_CFG_FLAGS, /* value of these flags (__u32) */ __NFQA_CFG_MAX }; #define NFQA_CFG_MAX (__NFQA_CFG_MAX-1) /* Flags for NFQA_CFG_FLAGS */ #define NFQA_CFG_F_FAIL_OPEN (1 << 0) #define NFQA_CFG_F_CONNTRACK (1 << 1) #define NFQA_CFG_F_GSO (1 << 2) #define NFQA_CFG_F_UID_GID (1 << 3) #define NFQA_CFG_F_SECCTX (1 << 4) #define NFQA_CFG_F_MAX (1 << 5) /* flags for NFQA_SKB_INFO */ /* packet appears to have wrong checksums, but they are ok */ #define NFQA_SKB_CSUMNOTREADY (1 << 0) /* packet is GSO (i.e., exceeds device mtu) */ #define NFQA_SKB_GSO (1 << 1) /* csum not validated (incoming device doesn't support hw checksum, etc.) */ #define NFQA_SKB_CSUM_NOTVERIFIED (1 << 2) #endif /* _NFNETLINK_QUEUE_H */ �������������������������������������������������������������������������������������linux/netfilter/xt_state.h��������������������������������������������������������������������������0000644�����������������00000000513�14763166027�0011716 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_STATE_H #define _XT_STATE_H #define XT_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) #define XT_STATE_INVALID (1 << 0) #define XT_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 1)) struct xt_state_info { unsigned int statemask; }; #endif /*_XT_STATE_H*/ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_dccp.h���������������������������������������������������������������������������0000644�����������������00000000743�14763166027�0011514 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_DCCP_H_ #define _XT_DCCP_H_ #include <linux/types.h> #define XT_DCCP_SRC_PORTS 0x01 #define XT_DCCP_DEST_PORTS 0x02 #define XT_DCCP_TYPE 0x04 #define XT_DCCP_OPTION 0x08 #define XT_DCCP_VALID_FLAGS 0x0f struct xt_dccp_info { __u16 dpts[2]; /* Min, Max */ __u16 spts[2]; /* Min, Max */ __u16 flags; __u16 invflags; __u16 typemask; __u8 option; }; #endif /* _XT_DCCP_H_ */ �����������������������������linux/netfilter/xt_addrtype.h�����������������������������������������������������������������������0000644�����������������00000002074�14763166027�0012416 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_ADDRTYPE_H #define _XT_ADDRTYPE_H #include <linux/types.h> enum { XT_ADDRTYPE_INVERT_SOURCE = 0x0001, XT_ADDRTYPE_INVERT_DEST = 0x0002, XT_ADDRTYPE_LIMIT_IFACE_IN = 0x0004, XT_ADDRTYPE_LIMIT_IFACE_OUT = 0x0008, }; /* rtn_type enum values from rtnetlink.h, but shifted */ enum { XT_ADDRTYPE_UNSPEC = 1 << 0, XT_ADDRTYPE_UNICAST = 1 << 1, /* 1 << RTN_UNICAST */ XT_ADDRTYPE_LOCAL = 1 << 2, /* 1 << RTN_LOCAL, etc */ XT_ADDRTYPE_BROADCAST = 1 << 3, XT_ADDRTYPE_ANYCAST = 1 << 4, XT_ADDRTYPE_MULTICAST = 1 << 5, XT_ADDRTYPE_BLACKHOLE = 1 << 6, XT_ADDRTYPE_UNREACHABLE = 1 << 7, XT_ADDRTYPE_PROHIBIT = 1 << 8, XT_ADDRTYPE_THROW = 1 << 9, XT_ADDRTYPE_NAT = 1 << 10, XT_ADDRTYPE_XRESOLVE = 1 << 11, }; struct xt_addrtype_info_v1 { __u16 source; /* source-type mask */ __u16 dest; /* dest-type mask */ __u32 flags; }; /* revision 0 */ struct xt_addrtype_info { __u16 source; /* source-type mask */ __u16 dest; /* dest-type mask */ __u32 invert_source; __u32 invert_dest; }; #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/nfnetlink_acct.h��������������������������������������������������������������������0000644�����������������00000001604�14763166027�0013047 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NFNL_ACCT_H_ #define _NFNL_ACCT_H_ #ifndef NFACCT_NAME_MAX #define NFACCT_NAME_MAX 32 #endif enum nfnl_acct_msg_types { NFNL_MSG_ACCT_NEW, NFNL_MSG_ACCT_GET, NFNL_MSG_ACCT_GET_CTRZERO, NFNL_MSG_ACCT_DEL, NFNL_MSG_ACCT_OVERQUOTA, NFNL_MSG_ACCT_MAX }; enum nfnl_acct_flags { NFACCT_F_QUOTA_PKTS = (1 << 0), NFACCT_F_QUOTA_BYTES = (1 << 1), NFACCT_F_OVERQUOTA = (1 << 2), /* can't be set from userspace */ }; enum nfnl_acct_type { NFACCT_UNSPEC, NFACCT_NAME, NFACCT_PKTS, NFACCT_BYTES, NFACCT_USE, NFACCT_FLAGS, NFACCT_QUOTA, NFACCT_FILTER, NFACCT_PAD, __NFACCT_MAX }; #define NFACCT_MAX (__NFACCT_MAX - 1) enum nfnl_attr_filter_type { NFACCT_FILTER_UNSPEC, NFACCT_FILTER_MASK, NFACCT_FILTER_VALUE, __NFACCT_FILTER_MAX }; #define NFACCT_FILTER_MAX (__NFACCT_FILTER_MAX - 1) #endif /* _NFNL_ACCT_H_ */ ����������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_sctp.h���������������������������������������������������������������������������0000644�����������������00000004431�14763166027�0011552 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_SCTP_H_ #define _XT_SCTP_H_ #include <linux/types.h> #define XT_SCTP_SRC_PORTS 0x01 #define XT_SCTP_DEST_PORTS 0x02 #define XT_SCTP_CHUNK_TYPES 0x04 #define XT_SCTP_VALID_FLAGS 0x07 struct xt_sctp_flag_info { __u8 chunktype; __u8 flag; __u8 flag_mask; }; #define XT_NUM_SCTP_FLAGS 4 struct xt_sctp_info { __u16 dpts[2]; /* Min, Max */ __u16 spts[2]; /* Min, Max */ __u32 chunkmap[256 / sizeof (__u32)]; /* Bit mask of chunks to be matched according to RFC 2960 */ #define SCTP_CHUNK_MATCH_ANY 0x01 /* Match if any of the chunk types are present */ #define SCTP_CHUNK_MATCH_ALL 0x02 /* Match if all of the chunk types are present */ #define SCTP_CHUNK_MATCH_ONLY 0x04 /* Match if these are the only chunk types present */ __u32 chunk_match_type; struct xt_sctp_flag_info flag_info[XT_NUM_SCTP_FLAGS]; int flag_count; __u32 flags; __u32 invflags; }; #define bytes(type) (sizeof(type) * 8) #define SCTP_CHUNKMAP_SET(chunkmap, type) \ do { \ (chunkmap)[type / bytes(__u32)] |= \ 1u << (type % bytes(__u32)); \ } while (0) #define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \ do { \ (chunkmap)[type / bytes(__u32)] &= \ ~(1u << (type % bytes(__u32))); \ } while (0) #define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \ ({ \ ((chunkmap)[type / bytes (__u32)] & \ (1u << (type % bytes (__u32)))) ? 1: 0; \ }) #define SCTP_CHUNKMAP_RESET(chunkmap) \ memset((chunkmap), 0, sizeof(chunkmap)) #define SCTP_CHUNKMAP_SET_ALL(chunkmap) \ memset((chunkmap), ~0U, sizeof(chunkmap)) #define SCTP_CHUNKMAP_COPY(destmap, srcmap) \ memcpy((destmap), (srcmap), sizeof(srcmap)) #define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \ __sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap)) static __inline__ _Bool __sctp_chunkmap_is_clear(const __u32 *chunkmap, unsigned int n) { unsigned int i; for (i = 0; i < n; ++i) if (chunkmap[i]) return 0; return 1; } #define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \ __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap)) static __inline__ _Bool __sctp_chunkmap_is_all_set(const __u32 *chunkmap, unsigned int n) { unsigned int i; for (i = 0; i < n; ++i) if (chunkmap[i] != ~0U) return 0; return 1; } #endif /* _XT_SCTP_H_ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_pkttype.h������������������������������������������������������������������������0000644�����������������00000000274�14763166027�0012302 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_PKTTYPE_H #define _XT_PKTTYPE_H struct xt_pkttype_info { int pkttype; int invert; }; #endif /*_XT_PKTTYPE_H*/ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/nf_nat.h����������������������������������������������������������������������������0000644�����������������00000002762�14763166027�0011340 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NETFILTER_NF_NAT_H #define _NETFILTER_NF_NAT_H #include <linux/netfilter.h> #include <linux/netfilter/nf_conntrack_tuple_common.h> #define NF_NAT_RANGE_MAP_IPS (1 << 0) #define NF_NAT_RANGE_PROTO_SPECIFIED (1 << 1) #define NF_NAT_RANGE_PROTO_RANDOM (1 << 2) #define NF_NAT_RANGE_PERSISTENT (1 << 3) #define NF_NAT_RANGE_PROTO_RANDOM_FULLY (1 << 4) #define NF_NAT_RANGE_PROTO_OFFSET (1 << 5) #define NF_NAT_RANGE_PROTO_RANDOM_ALL \ (NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PROTO_RANDOM_FULLY) #define NF_NAT_RANGE_MASK \ (NF_NAT_RANGE_MAP_IPS | NF_NAT_RANGE_PROTO_SPECIFIED | \ NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PERSISTENT | \ NF_NAT_RANGE_PROTO_RANDOM_FULLY | NF_NAT_RANGE_PROTO_OFFSET) struct nf_nat_ipv4_range { unsigned int flags; __be32 min_ip; __be32 max_ip; union nf_conntrack_man_proto min; union nf_conntrack_man_proto max; }; struct nf_nat_ipv4_multi_range_compat { unsigned int rangesize; struct nf_nat_ipv4_range range[1]; }; struct nf_nat_range { unsigned int flags; union nf_inet_addr min_addr; union nf_inet_addr max_addr; union nf_conntrack_man_proto min_proto; union nf_conntrack_man_proto max_proto; }; struct nf_nat_range2 { unsigned int flags; union nf_inet_addr min_addr; union nf_inet_addr max_addr; union nf_conntrack_man_proto min_proto; union nf_conntrack_man_proto max_proto; union nf_conntrack_man_proto base_proto; }; #endif /* _NETFILTER_NF_NAT_H */ ��������������linux/netfilter/xt_ipvs.h���������������������������������������������������������������������������0000644�����������������00000001250�14763166027�0011556 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_IPVS_H #define _XT_IPVS_H #include <linux/types.h> #include <linux/netfilter.h> enum { XT_IPVS_IPVS_PROPERTY = 1 << 0, /* all other options imply this one */ XT_IPVS_PROTO = 1 << 1, XT_IPVS_VADDR = 1 << 2, XT_IPVS_VPORT = 1 << 3, XT_IPVS_DIR = 1 << 4, XT_IPVS_METHOD = 1 << 5, XT_IPVS_VPORTCTL = 1 << 6, XT_IPVS_MASK = (1 << 7) - 1, XT_IPVS_ONCE_MASK = XT_IPVS_MASK & ~XT_IPVS_IPVS_PROPERTY }; struct xt_ipvs_mtinfo { union nf_inet_addr vaddr, vmask; __be16 vport; __u8 l4proto; __u8 fwd_method; __be16 vportctl; __u8 invert; __u8 bitmask; }; #endif /* _XT_IPVS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter/xt_length.h�������������������������������������������������������������������������0000644�����������������00000000335�14763166027�0012061 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_LENGTH_H #define _XT_LENGTH_H #include <linux/types.h> struct xt_length_info { __u16 min, max; __u8 invert; }; #endif /*_XT_LENGTH_H*/ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/nsfs.h����������������������������������������������������������������������������������������0000644�����������������00000001177�14763166027�0007047 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_NSFS_H #define __LINUX_NSFS_H #include <linux/ioctl.h> #define NSIO 0xb7 /* Returns a file descriptor that refers to an owning user namespace */ #define NS_GET_USERNS _IO(NSIO, 0x1) /* Returns a file descriptor that refers to a parent namespace */ #define NS_GET_PARENT _IO(NSIO, 0x2) /* Returns the type of namespace (CLONE_NEW* value) referred to by file descriptor */ #define NS_GET_NSTYPE _IO(NSIO, 0x3) /* Get owner UID (in the caller's user namespace) for a user namespace */ #define NS_GET_OWNER_UID _IO(NSIO, 0x4) #endif /* __LINUX_NSFS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/media.h���������������������������������������������������������������������������������������0000644�����������������00000027515�14763166027�0007161 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Multimedia device API * * Copyright (C) 2010 Nokia Corporation * * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> * Sakari Ailus <sakari.ailus@iki.fi> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * 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. */ #ifndef __LINUX_MEDIA_H #define __LINUX_MEDIA_H #include <stdint.h> #include <linux/ioctl.h> #include <linux/types.h> struct media_device_info { char driver[16]; char model[32]; char serial[40]; char bus_info[32]; __u32 media_version; __u32 hw_revision; __u32 driver_version; __u32 reserved[31]; }; /* * Base number ranges for entity functions * * NOTE: Userspace should not rely on these ranges to identify a group * of function types, as newer functions can be added with any name within * the full u32 range. * * Some older functions use the MEDIA_ENT_F_OLD_*_BASE range. Do not * change this, this is for backwards compatibility. When adding new * functions always use MEDIA_ENT_F_BASE. */ #define MEDIA_ENT_F_BASE 0x00000000 #define MEDIA_ENT_F_OLD_BASE 0x00010000 #define MEDIA_ENT_F_OLD_SUBDEV_BASE 0x00020000 /* * Initial value to be used when a new entity is created * Drivers should change it to something useful. */ #define MEDIA_ENT_F_UNKNOWN MEDIA_ENT_F_BASE /* * Subdevs are initialized with MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN in order * to preserve backward compatibility. Drivers must change to the proper * subdev type before registering the entity. */ #define MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN MEDIA_ENT_F_OLD_SUBDEV_BASE /* * DVB entity functions */ #define MEDIA_ENT_F_DTV_DEMOD (MEDIA_ENT_F_BASE + 0x00001) #define MEDIA_ENT_F_TS_DEMUX (MEDIA_ENT_F_BASE + 0x00002) #define MEDIA_ENT_F_DTV_CA (MEDIA_ENT_F_BASE + 0x00003) #define MEDIA_ENT_F_DTV_NET_DECAP (MEDIA_ENT_F_BASE + 0x00004) /* * I/O entity functions */ #define MEDIA_ENT_F_IO_V4L (MEDIA_ENT_F_OLD_BASE + 1) #define MEDIA_ENT_F_IO_DTV (MEDIA_ENT_F_BASE + 0x01001) #define MEDIA_ENT_F_IO_VBI (MEDIA_ENT_F_BASE + 0x01002) #define MEDIA_ENT_F_IO_SWRADIO (MEDIA_ENT_F_BASE + 0x01003) /* * Sensor functions */ #define MEDIA_ENT_F_CAM_SENSOR (MEDIA_ENT_F_OLD_SUBDEV_BASE + 1) #define MEDIA_ENT_F_FLASH (MEDIA_ENT_F_OLD_SUBDEV_BASE + 2) #define MEDIA_ENT_F_LENS (MEDIA_ENT_F_OLD_SUBDEV_BASE + 3) /* * Digital TV, analog TV, radio and/or software defined radio tuner functions. * * It is a responsibility of the master/bridge drivers to add connectors * and links for MEDIA_ENT_F_TUNER. Please notice that some old tuners * may require the usage of separate I2C chips to decode analog TV signals, * when the master/bridge chipset doesn't have its own TV standard decoder. * On such cases, the IF-PLL staging is mapped via one or two entities: * MEDIA_ENT_F_IF_VID_DECODER and/or MEDIA_ENT_F_IF_AUD_DECODER. */ #define MEDIA_ENT_F_TUNER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 5) /* * Analog TV IF-PLL decoder functions * * It is a responsibility of the master/bridge drivers to create links * for MEDIA_ENT_F_IF_VID_DECODER and MEDIA_ENT_F_IF_AUD_DECODER. */ #define MEDIA_ENT_F_IF_VID_DECODER (MEDIA_ENT_F_BASE + 0x02001) #define MEDIA_ENT_F_IF_AUD_DECODER (MEDIA_ENT_F_BASE + 0x02002) /* * Audio entity functions */ #define MEDIA_ENT_F_AUDIO_CAPTURE (MEDIA_ENT_F_BASE + 0x03001) #define MEDIA_ENT_F_AUDIO_PLAYBACK (MEDIA_ENT_F_BASE + 0x03002) #define MEDIA_ENT_F_AUDIO_MIXER (MEDIA_ENT_F_BASE + 0x03003) /* * Processing entity functions */ #define MEDIA_ENT_F_PROC_VIDEO_COMPOSER (MEDIA_ENT_F_BASE + 0x4001) #define MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER (MEDIA_ENT_F_BASE + 0x4002) #define MEDIA_ENT_F_PROC_VIDEO_PIXEL_ENC_CONV (MEDIA_ENT_F_BASE + 0x4003) #define MEDIA_ENT_F_PROC_VIDEO_LUT (MEDIA_ENT_F_BASE + 0x4004) #define MEDIA_ENT_F_PROC_VIDEO_SCALER (MEDIA_ENT_F_BASE + 0x4005) #define MEDIA_ENT_F_PROC_VIDEO_STATISTICS (MEDIA_ENT_F_BASE + 0x4006) #define MEDIA_ENT_F_PROC_VIDEO_ENCODER (MEDIA_ENT_F_BASE + 0x4007) #define MEDIA_ENT_F_PROC_VIDEO_DECODER (MEDIA_ENT_F_BASE + 0x4008) /* * Switch and bridge entity functions */ #define MEDIA_ENT_F_VID_MUX (MEDIA_ENT_F_BASE + 0x5001) #define MEDIA_ENT_F_VID_IF_BRIDGE (MEDIA_ENT_F_BASE + 0x5002) /* * Video decoder/encoder functions */ #define MEDIA_ENT_F_ATV_DECODER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 4) #define MEDIA_ENT_F_DV_DECODER (MEDIA_ENT_F_BASE + 0x6001) #define MEDIA_ENT_F_DV_ENCODER (MEDIA_ENT_F_BASE + 0x6002) /* Entity flags */ #define MEDIA_ENT_FL_DEFAULT (1 << 0) #define MEDIA_ENT_FL_CONNECTOR (1 << 1) /* OR with the entity id value to find the next entity */ #define MEDIA_ENT_ID_FLAG_NEXT (1 << 31) struct media_entity_desc { __u32 id; char name[32]; __u32 type; __u32 revision; __u32 flags; __u32 group_id; __u16 pads; __u16 links; __u32 reserved[4]; union { /* Node specifications */ struct { __u32 major; __u32 minor; } dev; /* * TODO: this shouldn't have been added without * actual drivers that use this. When the first real driver * appears that sets this information, special attention * should be given whether this information is 1) enough, and * 2) can deal with udev rules that rename devices. The struct * dev would not be sufficient for this since that does not * contain the subdevice information. In addition, struct dev * can only refer to a single device, and not to multiple (e.g. * pcm and mixer devices). */ struct { __u32 card; __u32 device; __u32 subdevice; } alsa; /* * DEPRECATED: previous node specifications. Kept just to * avoid breaking compilation. Use media_entity_desc.dev * instead. */ struct { __u32 major; __u32 minor; } v4l; struct { __u32 major; __u32 minor; } fb; int dvb; /* Sub-device specifications */ /* Nothing needed yet */ __u8 raw[184]; }; }; #define MEDIA_PAD_FL_SINK (1 << 0) #define MEDIA_PAD_FL_SOURCE (1 << 1) #define MEDIA_PAD_FL_MUST_CONNECT (1 << 2) struct media_pad_desc { __u32 entity; /* entity ID */ __u16 index; /* pad index */ __u32 flags; /* pad flags */ __u32 reserved[2]; }; #define MEDIA_LNK_FL_ENABLED (1 << 0) #define MEDIA_LNK_FL_IMMUTABLE (1 << 1) #define MEDIA_LNK_FL_DYNAMIC (1 << 2) #define MEDIA_LNK_FL_LINK_TYPE (0xf << 28) # define MEDIA_LNK_FL_DATA_LINK (0 << 28) # define MEDIA_LNK_FL_INTERFACE_LINK (1 << 28) struct media_link_desc { struct media_pad_desc source; struct media_pad_desc sink; __u32 flags; __u32 reserved[2]; }; struct media_links_enum { __u32 entity; /* Should have enough room for pads elements */ struct media_pad_desc *pads; /* Should have enough room for links elements */ struct media_link_desc *links; __u32 reserved[4]; }; /* Interface type ranges */ #define MEDIA_INTF_T_DVB_BASE 0x00000100 #define MEDIA_INTF_T_V4L_BASE 0x00000200 /* Interface types */ #define MEDIA_INTF_T_DVB_FE (MEDIA_INTF_T_DVB_BASE) #define MEDIA_INTF_T_DVB_DEMUX (MEDIA_INTF_T_DVB_BASE + 1) #define MEDIA_INTF_T_DVB_DVR (MEDIA_INTF_T_DVB_BASE + 2) #define MEDIA_INTF_T_DVB_CA (MEDIA_INTF_T_DVB_BASE + 3) #define MEDIA_INTF_T_DVB_NET (MEDIA_INTF_T_DVB_BASE + 4) #define MEDIA_INTF_T_V4L_VIDEO (MEDIA_INTF_T_V4L_BASE) #define MEDIA_INTF_T_V4L_VBI (MEDIA_INTF_T_V4L_BASE + 1) #define MEDIA_INTF_T_V4L_RADIO (MEDIA_INTF_T_V4L_BASE + 2) #define MEDIA_INTF_T_V4L_SUBDEV (MEDIA_INTF_T_V4L_BASE + 3) #define MEDIA_INTF_T_V4L_SWRADIO (MEDIA_INTF_T_V4L_BASE + 4) #define MEDIA_INTF_T_V4L_TOUCH (MEDIA_INTF_T_V4L_BASE + 5) /* * MC next gen API definitions */ /* * Appeared in 4.19.0. * * The media_version argument comes from the media_version field in * struct media_device_info. */ #define MEDIA_V2_ENTITY_HAS_FLAGS(media_version) \ ((media_version) >= ((4 << 16) | (19 << 8) | 0)) struct media_v2_entity { __u32 id; char name[64]; __u32 function; /* Main function of the entity */ __u32 flags; __u32 reserved[5]; } __attribute__ ((packed)); /* Should match the specific fields at media_intf_devnode */ struct media_v2_intf_devnode { __u32 major; __u32 minor; } __attribute__ ((packed)); struct media_v2_interface { __u32 id; __u32 intf_type; __u32 flags; __u32 reserved[9]; union { struct media_v2_intf_devnode devnode; __u32 raw[16]; }; } __attribute__ ((packed)); /* * Appeared in 4.19.0. * * The media_version argument comes from the media_version field in * struct media_device_info. */ #define MEDIA_V2_PAD_HAS_INDEX(media_version) \ ((media_version) >= ((4 << 16) | (19 << 8) | 0)) struct media_v2_pad { __u32 id; __u32 entity_id; __u32 flags; __u32 index; __u32 reserved[4]; } __attribute__ ((packed)); struct media_v2_link { __u32 id; __u32 source_id; __u32 sink_id; __u32 flags; __u32 reserved[6]; } __attribute__ ((packed)); struct media_v2_topology { __u64 topology_version; __u32 num_entities; __u32 reserved1; __u64 ptr_entities; __u32 num_interfaces; __u32 reserved2; __u64 ptr_interfaces; __u32 num_pads; __u32 reserved3; __u64 ptr_pads; __u32 num_links; __u32 reserved4; __u64 ptr_links; } __attribute__ ((packed)); /* ioctls */ #define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info) #define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct media_entity_desc) #define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum) #define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc) #define MEDIA_IOC_G_TOPOLOGY _IOWR('|', 0x04, struct media_v2_topology) /* * Legacy symbols used to avoid userspace compilation breakages. * Do not use any of this in new applications! * * Those symbols map the entity function into types and should be * used only on legacy programs for legacy hardware. Don't rely * on those for MEDIA_IOC_G_TOPOLOGY. */ #define MEDIA_ENT_TYPE_SHIFT 16 #define MEDIA_ENT_TYPE_MASK 0x00ff0000 #define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff #define MEDIA_ENT_T_DEVNODE_UNKNOWN (MEDIA_ENT_F_OLD_BASE | \ MEDIA_ENT_SUBTYPE_MASK) #define MEDIA_ENT_T_DEVNODE MEDIA_ENT_F_OLD_BASE #define MEDIA_ENT_T_DEVNODE_V4L MEDIA_ENT_F_IO_V4L #define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_F_OLD_BASE + 2) #define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_F_OLD_BASE + 3) #define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_F_OLD_BASE + 4) #define MEDIA_ENT_T_UNKNOWN MEDIA_ENT_F_UNKNOWN #define MEDIA_ENT_T_V4L2_VIDEO MEDIA_ENT_F_IO_V4L #define MEDIA_ENT_T_V4L2_SUBDEV MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN #define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR MEDIA_ENT_F_CAM_SENSOR #define MEDIA_ENT_T_V4L2_SUBDEV_FLASH MEDIA_ENT_F_FLASH #define MEDIA_ENT_T_V4L2_SUBDEV_LENS MEDIA_ENT_F_LENS #define MEDIA_ENT_T_V4L2_SUBDEV_DECODER MEDIA_ENT_F_ATV_DECODER #define MEDIA_ENT_T_V4L2_SUBDEV_TUNER MEDIA_ENT_F_TUNER #define MEDIA_ENT_F_DTV_DECODER MEDIA_ENT_F_DV_DECODER /* * There is still no ALSA support in the media controller. These * defines should not have been added and we leave them here only * in case some application tries to use these defines. */ #define MEDIA_INTF_T_ALSA_BASE 0x00000300 #define MEDIA_INTF_T_ALSA_PCM_CAPTURE (MEDIA_INTF_T_ALSA_BASE) #define MEDIA_INTF_T_ALSA_PCM_PLAYBACK (MEDIA_INTF_T_ALSA_BASE + 1) #define MEDIA_INTF_T_ALSA_CONTROL (MEDIA_INTF_T_ALSA_BASE + 2) #define MEDIA_INTF_T_ALSA_COMPRESS (MEDIA_INTF_T_ALSA_BASE + 3) #define MEDIA_INTF_T_ALSA_RAWMIDI (MEDIA_INTF_T_ALSA_BASE + 4) #define MEDIA_INTF_T_ALSA_HWDEP (MEDIA_INTF_T_ALSA_BASE + 5) #define MEDIA_INTF_T_ALSA_SEQUENCER (MEDIA_INTF_T_ALSA_BASE + 6) #define MEDIA_INTF_T_ALSA_TIMER (MEDIA_INTF_T_ALSA_BASE + 7) /* Obsolete symbol for media_version, no longer used in the kernel */ #define MEDIA_API_VERSION ((0 << 16) | (1 << 8) | 0) #endif /* __LINUX_MEDIA_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/hyperv.h��������������������������������������������������������������������������������������0000644�����������������00000024511�14763166027�0007410 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * * Copyright (c) 2011, Microsoft Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope 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., 59 Temple * Place - Suite 330, Boston, MA 02111-1307 USA. * * Authors: * Haiyang Zhang <haiyangz@microsoft.com> * Hank Janssen <hjanssen@microsoft.com> * K. Y. Srinivasan <kys@microsoft.com> * */ #ifndef _HYPERV_H #define _HYPERV_H #include <linux/uuid.h> /* * Framework version for util services. */ #define UTIL_FW_MINOR 0 #define UTIL_WS2K8_FW_MAJOR 1 #define UTIL_WS2K8_FW_VERSION (UTIL_WS2K8_FW_MAJOR << 16 | UTIL_FW_MINOR) #define UTIL_FW_MAJOR 3 #define UTIL_FW_VERSION (UTIL_FW_MAJOR << 16 | UTIL_FW_MINOR) /* * Implementation of host controlled snapshot of the guest. */ #define VSS_OP_REGISTER 128 /* Daemon code with full handshake support. */ #define VSS_OP_REGISTER1 129 enum hv_vss_op { VSS_OP_CREATE = 0, VSS_OP_DELETE, VSS_OP_HOT_BACKUP, VSS_OP_GET_DM_INFO, VSS_OP_BU_COMPLETE, /* * Following operations are only supported with IC version >= 5.0 */ VSS_OP_FREEZE, /* Freeze the file systems in the VM */ VSS_OP_THAW, /* Unfreeze the file systems */ VSS_OP_AUTO_RECOVER, VSS_OP_COUNT /* Number of operations, must be last */ }; /* * Header for all VSS messages. */ struct hv_vss_hdr { __u8 operation; __u8 reserved[7]; } __attribute__((packed)); /* * Flag values for the hv_vss_check_feature. Linux supports only * one value. */ #define VSS_HBU_NO_AUTO_RECOVERY 0x00000005 struct hv_vss_check_feature { __u32 flags; } __attribute__((packed)); struct hv_vss_check_dm_info { __u32 flags; } __attribute__((packed)); struct hv_vss_msg { union { struct hv_vss_hdr vss_hdr; int error; }; union { struct hv_vss_check_feature vss_cf; struct hv_vss_check_dm_info dm_info; }; } __attribute__((packed)); /* * Implementation of a host to guest copy facility. */ #define FCOPY_VERSION_0 0 #define FCOPY_VERSION_1 1 #define FCOPY_CURRENT_VERSION FCOPY_VERSION_1 #define W_MAX_PATH 260 enum hv_fcopy_op { START_FILE_COPY = 0, WRITE_TO_FILE, COMPLETE_FCOPY, CANCEL_FCOPY, }; struct hv_fcopy_hdr { __u32 operation; uuid_le service_id0; /* currently unused */ uuid_le service_id1; /* currently unused */ } __attribute__((packed)); #define OVER_WRITE 0x1 #define CREATE_PATH 0x2 struct hv_start_fcopy { struct hv_fcopy_hdr hdr; __u16 file_name[W_MAX_PATH]; __u16 path_name[W_MAX_PATH]; __u32 copy_flags; __u64 file_size; } __attribute__((packed)); /* * The file is chunked into fragments. */ #define DATA_FRAGMENT (6 * 1024) struct hv_do_fcopy { struct hv_fcopy_hdr hdr; __u32 pad; __u64 offset; __u32 size; __u8 data[DATA_FRAGMENT]; } __attribute__((packed)); /* * An implementation of HyperV key value pair (KVP) functionality for Linux. * * * Copyright (C) 2010, Novell, Inc. * Author : K. Y. Srinivasan <ksrinivasan@novell.com> * */ /* * Maximum value size - used for both key names and value data, and includes * any applicable NULL terminators. * * Note: This limit is somewhat arbitrary, but falls easily within what is * supported for all native guests (back to Win 2000) and what is reasonable * for the IC KVP exchange functionality. Note that Windows Me/98/95 are * limited to 255 character key names. * * MSDN recommends not storing data values larger than 2048 bytes in the * registry. * * Note: This value is used in defining the KVP exchange message - this value * cannot be modified without affecting the message size and compatibility. */ /* * bytes, including any null terminators */ #define HV_KVP_EXCHANGE_MAX_VALUE_SIZE (2048) /* * Maximum key size - the registry limit for the length of an entry name * is 256 characters, including the null terminator */ #define HV_KVP_EXCHANGE_MAX_KEY_SIZE (512) /* * In Linux, we implement the KVP functionality in two components: * 1) The kernel component which is packaged as part of the hv_utils driver * is responsible for communicating with the host and responsible for * implementing the host/guest protocol. 2) A user level daemon that is * responsible for data gathering. * * Host/Guest Protocol: The host iterates over an index and expects the guest * to assign a key name to the index and also return the value corresponding to * the key. The host will have atmost one KVP transaction outstanding at any * given point in time. The host side iteration stops when the guest returns * an error. Microsoft has specified the following mapping of key names to * host specified index: * * Index Key Name * 0 FullyQualifiedDomainName * 1 IntegrationServicesVersion * 2 NetworkAddressIPv4 * 3 NetworkAddressIPv6 * 4 OSBuildNumber * 5 OSName * 6 OSMajorVersion * 7 OSMinorVersion * 8 OSVersion * 9 ProcessorArchitecture * * The Windows host expects the Key Name and Key Value to be encoded in utf16. * * Guest Kernel/KVP Daemon Protocol: As noted earlier, we implement all of the * data gathering functionality in a user mode daemon. The user level daemon * is also responsible for binding the key name to the index as well. The * kernel and user-level daemon communicate using a connector channel. * * The user mode component first registers with the * the kernel component. Subsequently, the kernel component requests, data * for the specified keys. In response to this message the user mode component * fills in the value corresponding to the specified key. We overload the * sequence field in the cn_msg header to define our KVP message types. * * * The kernel component simply acts as a conduit for communication between the * Windows host and the user-level daemon. The kernel component passes up the * index received from the Host to the user-level daemon. If the index is * valid (supported), the corresponding key as well as its * value (both are strings) is returned. If the index is invalid * (not supported), a NULL key string is returned. */ /* * Registry value types. */ #define REG_SZ 1 #define REG_U32 4 #define REG_U64 8 /* * As we look at expanding the KVP functionality to include * IP injection functionality, we need to maintain binary * compatibility with older daemons. * * The KVP opcodes are defined by the host and it was unfortunate * that I chose to treat the registration operation as part of the * KVP operations defined by the host. * Here is the level of compatibility * (between the user level daemon and the kernel KVP driver) that we * will implement: * * An older daemon will always be supported on a newer driver. * A given user level daemon will require a minimal version of the * kernel driver. * If we cannot handle the version differences, we will fail gracefully * (this can happen when we have a user level daemon that is more * advanced than the KVP driver. * * We will use values used in this handshake for determining if we have * workable user level daemon and the kernel driver. We begin by taking the * registration opcode out of the KVP opcode namespace. We will however, * maintain compatibility with the existing user-level daemon code. */ /* * Daemon code not supporting IP injection (legacy daemon). */ #define KVP_OP_REGISTER 4 /* * Daemon code supporting IP injection. * The KVP opcode field is used to communicate the * registration information; so define a namespace that * will be distinct from the host defined KVP opcode. */ #define KVP_OP_REGISTER1 100 enum hv_kvp_exchg_op { KVP_OP_GET = 0, KVP_OP_SET, KVP_OP_DELETE, KVP_OP_ENUMERATE, KVP_OP_GET_IP_INFO, KVP_OP_SET_IP_INFO, KVP_OP_COUNT /* Number of operations, must be last. */ }; enum hv_kvp_exchg_pool { KVP_POOL_EXTERNAL = 0, KVP_POOL_GUEST, KVP_POOL_AUTO, KVP_POOL_AUTO_EXTERNAL, KVP_POOL_AUTO_INTERNAL, KVP_POOL_COUNT /* Number of pools, must be last. */ }; /* * Some Hyper-V status codes. */ #define HV_S_OK 0x00000000 #define HV_E_FAIL 0x80004005 #define HV_S_CONT 0x80070103 #define HV_ERROR_NOT_SUPPORTED 0x80070032 #define HV_ERROR_MACHINE_LOCKED 0x800704F7 #define HV_ERROR_DEVICE_NOT_CONNECTED 0x8007048F #define HV_INVALIDARG 0x80070057 #define HV_GUID_NOTFOUND 0x80041002 #define HV_ERROR_ALREADY_EXISTS 0x80070050 #define HV_ERROR_DISK_FULL 0x80070070 #define ADDR_FAMILY_NONE 0x00 #define ADDR_FAMILY_IPV4 0x01 #define ADDR_FAMILY_IPV6 0x02 #define MAX_ADAPTER_ID_SIZE 128 #define MAX_IP_ADDR_SIZE 1024 #define MAX_GATEWAY_SIZE 512 struct hv_kvp_ipaddr_value { __u16 adapter_id[MAX_ADAPTER_ID_SIZE]; __u8 addr_family; __u8 dhcp_enabled; __u16 ip_addr[MAX_IP_ADDR_SIZE]; __u16 sub_net[MAX_IP_ADDR_SIZE]; __u16 gate_way[MAX_GATEWAY_SIZE]; __u16 dns_addr[MAX_IP_ADDR_SIZE]; } __attribute__((packed)); struct hv_kvp_hdr { __u8 operation; __u8 pool; __u16 pad; } __attribute__((packed)); struct hv_kvp_exchg_msg_value { __u32 value_type; __u32 key_size; __u32 value_size; __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE]; union { __u8 value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE]; __u32 value_u32; __u64 value_u64; }; } __attribute__((packed)); struct hv_kvp_msg_enumerate { __u32 index; struct hv_kvp_exchg_msg_value data; } __attribute__((packed)); struct hv_kvp_msg_get { struct hv_kvp_exchg_msg_value data; }; struct hv_kvp_msg_set { struct hv_kvp_exchg_msg_value data; }; struct hv_kvp_msg_delete { __u32 key_size; __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE]; }; struct hv_kvp_register { __u8 version[HV_KVP_EXCHANGE_MAX_KEY_SIZE]; }; struct hv_kvp_msg { union { struct hv_kvp_hdr kvp_hdr; int error; }; union { struct hv_kvp_msg_get kvp_get; struct hv_kvp_msg_set kvp_set; struct hv_kvp_msg_delete kvp_delete; struct hv_kvp_msg_enumerate kvp_enum_data; struct hv_kvp_ipaddr_value kvp_ip_val; struct hv_kvp_register kvp_register; } body; } __attribute__((packed)); struct hv_kvp_ip_msg { __u8 operation; __u8 pool; struct hv_kvp_ipaddr_value kvp_ip_val; } __attribute__((packed)); #endif /* _HYPERV_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/virtio_input.h��������������������������������������������������������������������������������0000644�����������������00000004712�14763166027�0010627 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _LINUX_VIRTIO_INPUT_H #define _LINUX_VIRTIO_INPUT_H /* This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <linux/types.h> enum virtio_input_config_select { VIRTIO_INPUT_CFG_UNSET = 0x00, VIRTIO_INPUT_CFG_ID_NAME = 0x01, VIRTIO_INPUT_CFG_ID_SERIAL = 0x02, VIRTIO_INPUT_CFG_ID_DEVIDS = 0x03, VIRTIO_INPUT_CFG_PROP_BITS = 0x10, VIRTIO_INPUT_CFG_EV_BITS = 0x11, VIRTIO_INPUT_CFG_ABS_INFO = 0x12, }; struct virtio_input_absinfo { __u32 min; __u32 max; __u32 fuzz; __u32 flat; __u32 res; }; struct virtio_input_devids { __u16 bustype; __u16 vendor; __u16 product; __u16 version; }; struct virtio_input_config { __u8 select; __u8 subsel; __u8 size; __u8 reserved[5]; union { char string[128]; __u8 bitmap[128]; struct virtio_input_absinfo abs; struct virtio_input_devids ids; } u; }; struct virtio_input_event { __le16 type; __le16 code; __le32 value; }; #endif /* _LINUX_VIRTIO_INPUT_H */ ������������������������������������������������������linux/personality.h���������������������������������������������������������������������������������0000644�����������������00000004061�14763166027�0010442 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_PERSONALITY_H #define _LINUX_PERSONALITY_H /* * Flags for bug emulation. * * These occupy the top three bytes. */ enum { UNAME26 = 0x0020000, ADDR_NO_RANDOMIZE = 0x0040000, /* disable randomization of VA space */ FDPIC_FUNCPTRS = 0x0080000, /* userspace function ptrs point to descriptors * (signal handling) */ MMAP_PAGE_ZERO = 0x0100000, ADDR_COMPAT_LAYOUT = 0x0200000, READ_IMPLIES_EXEC = 0x0400000, ADDR_LIMIT_32BIT = 0x0800000, SHORT_INODE = 0x1000000, WHOLE_SECONDS = 0x2000000, STICKY_TIMEOUTS = 0x4000000, ADDR_LIMIT_3GB = 0x8000000, }; /* * Security-relevant compatibility flags that must be * cleared upon setuid or setgid exec: */ #define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC | \ ADDR_NO_RANDOMIZE | \ ADDR_COMPAT_LAYOUT | \ MMAP_PAGE_ZERO) /* * Personality types. * * These go in the low byte. Avoid using the top bit, it will * conflict with error returns. */ enum { PER_LINUX = 0x0000, PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT, PER_LINUX_FDPIC = 0x0000 | FDPIC_FUNCPTRS, PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE, PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE, PER_OSR5 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS, PER_WYSEV386 = 0x0004 | STICKY_TIMEOUTS | SHORT_INODE, PER_ISCR4 = 0x0005 | STICKY_TIMEOUTS, PER_BSD = 0x0006, PER_SUNOS = 0x0006 | STICKY_TIMEOUTS, PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE, PER_LINUX32 = 0x0008, PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB, PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS,/* IRIX5 32-bit */ PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS,/* IRIX6 new 32-bit */ PER_IRIX64 = 0x000b | STICKY_TIMEOUTS,/* IRIX6 64-bit */ PER_RISCOS = 0x000c, PER_SOLARIS = 0x000d | STICKY_TIMEOUTS, PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, PER_OSF4 = 0x000f, /* OSF/1 v4 */ PER_HPUX = 0x0010, PER_MASK = 0x00ff, }; #endif /* _LINUX_PERSONALITY_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/jffs2.h���������������������������������������������������������������������������������������0000644�����������������00000015552�14763166027�0007112 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * JFFS2 -- Journalling Flash File System, Version 2. * * Copyright © 2001-2007 Red Hat, Inc. * Copyright © 2004-2010 David Woodhouse <dwmw2@infradead.org> * * Created by David Woodhouse <dwmw2@infradead.org> * * For licensing information, see the file 'LICENCE' in the * jffs2 directory. */ #ifndef __LINUX_JFFS2_H__ #define __LINUX_JFFS2_H__ #include <linux/types.h> #include <linux/magic.h> /* You must include something which defines the C99 uintXX_t types. We don't do it from here because this file is used in too many different environments. */ /* Values we may expect to find in the 'magic' field */ #define JFFS2_OLD_MAGIC_BITMASK 0x1984 #define JFFS2_MAGIC_BITMASK 0x1985 #define KSAMTIB_CIGAM_2SFFJ 0x8519 /* For detecting wrong-endian fs */ #define JFFS2_EMPTY_BITMASK 0xffff #define JFFS2_DIRTY_BITMASK 0x0000 /* Summary node MAGIC marker */ #define JFFS2_SUM_MAGIC 0x02851885 /* We only allow a single char for length, and 0xFF is empty flash so we don't want it confused with a real length. Hence max 254. */ #define JFFS2_MAX_NAME_LEN 254 /* How small can we sensibly write nodes? */ #define JFFS2_MIN_DATA_LEN 128 #define JFFS2_COMPR_NONE 0x00 #define JFFS2_COMPR_ZERO 0x01 #define JFFS2_COMPR_RTIME 0x02 #define JFFS2_COMPR_RUBINMIPS 0x03 #define JFFS2_COMPR_COPY 0x04 #define JFFS2_COMPR_DYNRUBIN 0x05 #define JFFS2_COMPR_ZLIB 0x06 #define JFFS2_COMPR_LZO 0x07 /* Compatibility flags. */ #define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */ #define JFFS2_NODE_ACCURATE 0x2000 /* INCOMPAT: Fail to mount the filesystem */ #define JFFS2_FEATURE_INCOMPAT 0xc000 /* ROCOMPAT: Mount read-only */ #define JFFS2_FEATURE_ROCOMPAT 0x8000 /* RWCOMPAT_COPY: Mount read/write, and copy the node when it's GC'd */ #define JFFS2_FEATURE_RWCOMPAT_COPY 0x4000 /* RWCOMPAT_DELETE: Mount read/write, and delete the node when it's GC'd */ #define JFFS2_FEATURE_RWCOMPAT_DELETE 0x0000 #define JFFS2_NODETYPE_DIRENT (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 1) #define JFFS2_NODETYPE_INODE (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 2) #define JFFS2_NODETYPE_CLEANMARKER (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3) #define JFFS2_NODETYPE_PADDING (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 4) #define JFFS2_NODETYPE_SUMMARY (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 6) #define JFFS2_NODETYPE_XATTR (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 8) #define JFFS2_NODETYPE_XREF (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 9) /* XATTR Related */ #define JFFS2_XPREFIX_USER 1 /* for "user." */ #define JFFS2_XPREFIX_SECURITY 2 /* for "security." */ #define JFFS2_XPREFIX_ACL_ACCESS 3 /* for "system.posix_acl_access" */ #define JFFS2_XPREFIX_ACL_DEFAULT 4 /* for "system.posix_acl_default" */ #define JFFS2_XPREFIX_TRUSTED 5 /* for "trusted.*" */ #define JFFS2_ACL_VERSION 0x0001 // Maybe later... //#define JFFS2_NODETYPE_CHECKPOINT (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3) //#define JFFS2_NODETYPE_OPTIONS (JFFS2_FEATURE_RWCOMPAT_COPY | JFFS2_NODE_ACCURATE | 4) #define JFFS2_INO_FLAG_PREREAD 1 /* Do read_inode() for this one at mount time, don't wait for it to happen later */ #define JFFS2_INO_FLAG_USERCOMPR 2 /* User has requested a specific compression type */ /* These can go once we've made sure we've caught all uses without byteswapping */ typedef struct { __u32 v32; } __attribute__((packed)) jint32_t; typedef struct { __u32 m; } __attribute__((packed)) jmode_t; typedef struct { __u16 v16; } __attribute__((packed)) jint16_t; struct jffs2_unknown_node { /* All start like this */ jint16_t magic; jint16_t nodetype; jint32_t totlen; /* So we can skip over nodes we don't grok */ jint32_t hdr_crc; }; struct jffs2_raw_dirent { jint16_t magic; jint16_t nodetype; /* == JFFS2_NODETYPE_DIRENT */ jint32_t totlen; jint32_t hdr_crc; jint32_t pino; jint32_t version; jint32_t ino; /* == zero for unlink */ jint32_t mctime; __u8 nsize; __u8 type; __u8 unused[2]; jint32_t node_crc; jint32_t name_crc; __u8 name[0]; }; /* The JFFS2 raw inode structure: Used for storage on physical media. */ /* The uid, gid, atime, mtime and ctime members could be longer, but are left like this for space efficiency. If and when people decide they really need them extended, it's simple enough to add support for a new type of raw node. */ struct jffs2_raw_inode { jint16_t magic; /* A constant magic number. */ jint16_t nodetype; /* == JFFS2_NODETYPE_INODE */ jint32_t totlen; /* Total length of this node (inc data, etc.) */ jint32_t hdr_crc; jint32_t ino; /* Inode number. */ jint32_t version; /* Version number. */ jmode_t mode; /* The file's type or mode. */ jint16_t uid; /* The file's owner. */ jint16_t gid; /* The file's group. */ jint32_t isize; /* Total resultant size of this inode (used for truncations) */ jint32_t atime; /* Last access time. */ jint32_t mtime; /* Last modification time. */ jint32_t ctime; /* Change time. */ jint32_t offset; /* Where to begin to write. */ jint32_t csize; /* (Compressed) data size */ jint32_t dsize; /* Size of the node's data. (after decompression) */ __u8 compr; /* Compression algorithm used */ __u8 usercompr; /* Compression algorithm requested by the user */ jint16_t flags; /* See JFFS2_INO_FLAG_* */ jint32_t data_crc; /* CRC for the (compressed) data. */ jint32_t node_crc; /* CRC for the raw inode (excluding data) */ __u8 data[0]; }; struct jffs2_raw_xattr { jint16_t magic; jint16_t nodetype; /* = JFFS2_NODETYPE_XATTR */ jint32_t totlen; jint32_t hdr_crc; jint32_t xid; /* XATTR identifier number */ jint32_t version; __u8 xprefix; __u8 name_len; jint16_t value_len; jint32_t data_crc; jint32_t node_crc; __u8 data[0]; } __attribute__((packed)); struct jffs2_raw_xref { jint16_t magic; jint16_t nodetype; /* = JFFS2_NODETYPE_XREF */ jint32_t totlen; jint32_t hdr_crc; jint32_t ino; /* inode number */ jint32_t xid; /* XATTR identifier number */ jint32_t xseqno; /* xref sequential number */ jint32_t node_crc; } __attribute__((packed)); struct jffs2_raw_summary { jint16_t magic; jint16_t nodetype; /* = JFFS2_NODETYPE_SUMMARY */ jint32_t totlen; jint32_t hdr_crc; jint32_t sum_num; /* number of sum entries*/ jint32_t cln_mkr; /* clean marker size, 0 = no cleanmarker */ jint32_t padded; /* sum of the size of padding nodes */ jint32_t sum_crc; /* summary information crc */ jint32_t node_crc; /* node crc */ jint32_t sum[0]; /* inode summary info */ }; union jffs2_node_union { struct jffs2_raw_inode i; struct jffs2_raw_dirent d; struct jffs2_raw_xattr x; struct jffs2_raw_xref r; struct jffs2_raw_summary s; struct jffs2_unknown_node u; }; /* Data payload for device nodes. */ union jffs2_device_node { jint16_t old_id; jint32_t new_id; }; #endif /* __LINUX_JFFS2_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������linux/usb/video.h�����������������������������������������������������������������������������������0000644�����������������00000041340�14763166027�0007771 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * USB Video Class definitions. * * Copyright (C) 2009 Laurent Pinchart <laurent.pinchart@skynet.be> * * This file holds USB constants and structures defined by the USB Device * Class Definition for Video Devices. Unless otherwise stated, comments * below reference relevant sections of the USB Video Class 1.1 specification * available at * * http://www.usb.org/developers/devclass_docs/USB_Video_Class_1_1.zip */ #ifndef __LINUX_USB_VIDEO_H #define __LINUX_USB_VIDEO_H #include <linux/types.h> /* -------------------------------------------------------------------------- * UVC constants */ /* A.2. Video Interface Subclass Codes */ #define UVC_SC_UNDEFINED 0x00 #define UVC_SC_VIDEOCONTROL 0x01 #define UVC_SC_VIDEOSTREAMING 0x02 #define UVC_SC_VIDEO_INTERFACE_COLLECTION 0x03 /* A.3. Video Interface Protocol Codes */ #define UVC_PC_PROTOCOL_UNDEFINED 0x00 #define UVC_PC_PROTOCOL_15 0x01 /* A.5. Video Class-Specific VC Interface Descriptor Subtypes */ #define UVC_VC_DESCRIPTOR_UNDEFINED 0x00 #define UVC_VC_HEADER 0x01 #define UVC_VC_INPUT_TERMINAL 0x02 #define UVC_VC_OUTPUT_TERMINAL 0x03 #define UVC_VC_SELECTOR_UNIT 0x04 #define UVC_VC_PROCESSING_UNIT 0x05 #define UVC_VC_EXTENSION_UNIT 0x06 /* A.6. Video Class-Specific VS Interface Descriptor Subtypes */ #define UVC_VS_UNDEFINED 0x00 #define UVC_VS_INPUT_HEADER 0x01 #define UVC_VS_OUTPUT_HEADER 0x02 #define UVC_VS_STILL_IMAGE_FRAME 0x03 #define UVC_VS_FORMAT_UNCOMPRESSED 0x04 #define UVC_VS_FRAME_UNCOMPRESSED 0x05 #define UVC_VS_FORMAT_MJPEG 0x06 #define UVC_VS_FRAME_MJPEG 0x07 #define UVC_VS_FORMAT_MPEG2TS 0x0a #define UVC_VS_FORMAT_DV 0x0c #define UVC_VS_COLORFORMAT 0x0d #define UVC_VS_FORMAT_FRAME_BASED 0x10 #define UVC_VS_FRAME_FRAME_BASED 0x11 #define UVC_VS_FORMAT_STREAM_BASED 0x12 /* A.7. Video Class-Specific Endpoint Descriptor Subtypes */ #define UVC_EP_UNDEFINED 0x00 #define UVC_EP_GENERAL 0x01 #define UVC_EP_ENDPOINT 0x02 #define UVC_EP_INTERRUPT 0x03 /* A.8. Video Class-Specific Request Codes */ #define UVC_RC_UNDEFINED 0x00 #define UVC_SET_CUR 0x01 #define UVC_GET_CUR 0x81 #define UVC_GET_MIN 0x82 #define UVC_GET_MAX 0x83 #define UVC_GET_RES 0x84 #define UVC_GET_LEN 0x85 #define UVC_GET_INFO 0x86 #define UVC_GET_DEF 0x87 /* A.9.1. VideoControl Interface Control Selectors */ #define UVC_VC_CONTROL_UNDEFINED 0x00 #define UVC_VC_VIDEO_POWER_MODE_CONTROL 0x01 #define UVC_VC_REQUEST_ERROR_CODE_CONTROL 0x02 /* A.9.2. Terminal Control Selectors */ #define UVC_TE_CONTROL_UNDEFINED 0x00 /* A.9.3. Selector Unit Control Selectors */ #define UVC_SU_CONTROL_UNDEFINED 0x00 #define UVC_SU_INPUT_SELECT_CONTROL 0x01 /* A.9.4. Camera Terminal Control Selectors */ #define UVC_CT_CONTROL_UNDEFINED 0x00 #define UVC_CT_SCANNING_MODE_CONTROL 0x01 #define UVC_CT_AE_MODE_CONTROL 0x02 #define UVC_CT_AE_PRIORITY_CONTROL 0x03 #define UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x04 #define UVC_CT_EXPOSURE_TIME_RELATIVE_CONTROL 0x05 #define UVC_CT_FOCUS_ABSOLUTE_CONTROL 0x06 #define UVC_CT_FOCUS_RELATIVE_CONTROL 0x07 #define UVC_CT_FOCUS_AUTO_CONTROL 0x08 #define UVC_CT_IRIS_ABSOLUTE_CONTROL 0x09 #define UVC_CT_IRIS_RELATIVE_CONTROL 0x0a #define UVC_CT_ZOOM_ABSOLUTE_CONTROL 0x0b #define UVC_CT_ZOOM_RELATIVE_CONTROL 0x0c #define UVC_CT_PANTILT_ABSOLUTE_CONTROL 0x0d #define UVC_CT_PANTILT_RELATIVE_CONTROL 0x0e #define UVC_CT_ROLL_ABSOLUTE_CONTROL 0x0f #define UVC_CT_ROLL_RELATIVE_CONTROL 0x10 #define UVC_CT_PRIVACY_CONTROL 0x11 /* A.9.5. Processing Unit Control Selectors */ #define UVC_PU_CONTROL_UNDEFINED 0x00 #define UVC_PU_BACKLIGHT_COMPENSATION_CONTROL 0x01 #define UVC_PU_BRIGHTNESS_CONTROL 0x02 #define UVC_PU_CONTRAST_CONTROL 0x03 #define UVC_PU_GAIN_CONTROL 0x04 #define UVC_PU_POWER_LINE_FREQUENCY_CONTROL 0x05 #define UVC_PU_HUE_CONTROL 0x06 #define UVC_PU_SATURATION_CONTROL 0x07 #define UVC_PU_SHARPNESS_CONTROL 0x08 #define UVC_PU_GAMMA_CONTROL 0x09 #define UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x0a #define UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL 0x0b #define UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL 0x0c #define UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0x0d #define UVC_PU_DIGITAL_MULTIPLIER_CONTROL 0x0e #define UVC_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x0f #define UVC_PU_HUE_AUTO_CONTROL 0x10 #define UVC_PU_ANALOG_VIDEO_STANDARD_CONTROL 0x11 #define UVC_PU_ANALOG_LOCK_STATUS_CONTROL 0x12 /* A.9.7. VideoStreaming Interface Control Selectors */ #define UVC_VS_CONTROL_UNDEFINED 0x00 #define UVC_VS_PROBE_CONTROL 0x01 #define UVC_VS_COMMIT_CONTROL 0x02 #define UVC_VS_STILL_PROBE_CONTROL 0x03 #define UVC_VS_STILL_COMMIT_CONTROL 0x04 #define UVC_VS_STILL_IMAGE_TRIGGER_CONTROL 0x05 #define UVC_VS_STREAM_ERROR_CODE_CONTROL 0x06 #define UVC_VS_GENERATE_KEY_FRAME_CONTROL 0x07 #define UVC_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08 #define UVC_VS_SYNC_DELAY_CONTROL 0x09 /* B.1. USB Terminal Types */ #define UVC_TT_VENDOR_SPECIFIC 0x0100 #define UVC_TT_STREAMING 0x0101 /* B.2. Input Terminal Types */ #define UVC_ITT_VENDOR_SPECIFIC 0x0200 #define UVC_ITT_CAMERA 0x0201 #define UVC_ITT_MEDIA_TRANSPORT_INPUT 0x0202 /* B.3. Output Terminal Types */ #define UVC_OTT_VENDOR_SPECIFIC 0x0300 #define UVC_OTT_DISPLAY 0x0301 #define UVC_OTT_MEDIA_TRANSPORT_OUTPUT 0x0302 /* B.4. External Terminal Types */ #define UVC_EXTERNAL_VENDOR_SPECIFIC 0x0400 #define UVC_COMPOSITE_CONNECTOR 0x0401 #define UVC_SVIDEO_CONNECTOR 0x0402 #define UVC_COMPONENT_CONNECTOR 0x0403 /* 2.4.2.2. Status Packet Type */ #define UVC_STATUS_TYPE_CONTROL 1 #define UVC_STATUS_TYPE_STREAMING 2 /* 2.4.3.3. Payload Header Information */ #define UVC_STREAM_EOH (1 << 7) #define UVC_STREAM_ERR (1 << 6) #define UVC_STREAM_STI (1 << 5) #define UVC_STREAM_RES (1 << 4) #define UVC_STREAM_SCR (1 << 3) #define UVC_STREAM_PTS (1 << 2) #define UVC_STREAM_EOF (1 << 1) #define UVC_STREAM_FID (1 << 0) /* 4.1.2. Control Capabilities */ #define UVC_CONTROL_CAP_GET (1 << 0) #define UVC_CONTROL_CAP_SET (1 << 1) #define UVC_CONTROL_CAP_DISABLED (1 << 2) #define UVC_CONTROL_CAP_AUTOUPDATE (1 << 3) #define UVC_CONTROL_CAP_ASYNCHRONOUS (1 << 4) /* 3.9.2.6 Color Matching Descriptor Values */ enum uvc_color_primaries_values { UVC_COLOR_PRIMARIES_UNSPECIFIED, UVC_COLOR_PRIMARIES_BT_709_SRGB, UVC_COLOR_PRIMARIES_BT_470_2_M, UVC_COLOR_PRIMARIES_BT_470_2_B_G, UVC_COLOR_PRIMARIES_SMPTE_170M, UVC_COLOR_PRIMARIES_SMPTE_240M, }; enum uvc_transfer_characteristics_values { UVC_TRANSFER_CHARACTERISTICS_UNSPECIFIED, UVC_TRANSFER_CHARACTERISTICS_BT_709, UVC_TRANSFER_CHARACTERISTICS_BT_470_2_M, UVC_TRANSFER_CHARACTERISTICS_BT_470_2_B_G, UVC_TRANSFER_CHARACTERISTICS_SMPTE_170M, UVC_TRANSFER_CHARACTERISTICS_SMPTE_240M, UVC_TRANSFER_CHARACTERISTICS_LINEAR, UVC_TRANSFER_CHARACTERISTICS_SRGB, }; enum uvc_matrix_coefficients { UVC_MATRIX_COEFFICIENTS_UNSPECIFIED, UVC_MATRIX_COEFFICIENTS_BT_709, UVC_MATRIX_COEFFICIENTS_FCC, UVC_MATRIX_COEFFICIENTS_BT_470_2_B_G, UVC_MATRIX_COEFFICIENTS_SMPTE_170M, UVC_MATRIX_COEFFICIENTS_SMPTE_240M, }; /* ------------------------------------------------------------------------ * UVC structures */ /* All UVC descriptors have these 3 fields at the beginning */ struct uvc_descriptor_header { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; } __attribute__((packed)); /* 3.7.2. Video Control Interface Header Descriptor */ struct uvc_header_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u16 bcdUVC; __u16 wTotalLength; __u32 dwClockFrequency; __u8 bInCollection; __u8 baInterfaceNr[]; } __attribute__((__packed__)); #define UVC_DT_HEADER_SIZE(n) (12+(n)) #define UVC_HEADER_DESCRIPTOR(n) \ uvc_header_descriptor_##n #define DECLARE_UVC_HEADER_DESCRIPTOR(n) \ struct UVC_HEADER_DESCRIPTOR(n) { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubType; \ __u16 bcdUVC; \ __u16 wTotalLength; \ __u32 dwClockFrequency; \ __u8 bInCollection; \ __u8 baInterfaceNr[n]; \ } __attribute__ ((packed)) /* 3.7.2.1. Input Terminal Descriptor */ struct uvc_input_terminal_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bTerminalID; __u16 wTerminalType; __u8 bAssocTerminal; __u8 iTerminal; } __attribute__((__packed__)); #define UVC_DT_INPUT_TERMINAL_SIZE 8 /* 3.7.2.2. Output Terminal Descriptor */ struct uvc_output_terminal_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bTerminalID; __u16 wTerminalType; __u8 bAssocTerminal; __u8 bSourceID; __u8 iTerminal; } __attribute__((__packed__)); #define UVC_DT_OUTPUT_TERMINAL_SIZE 9 /* 3.7.2.3. Camera Terminal Descriptor */ struct uvc_camera_terminal_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bTerminalID; __u16 wTerminalType; __u8 bAssocTerminal; __u8 iTerminal; __u16 wObjectiveFocalLengthMin; __u16 wObjectiveFocalLengthMax; __u16 wOcularFocalLength; __u8 bControlSize; __u8 bmControls[3]; } __attribute__((__packed__)); #define UVC_DT_CAMERA_TERMINAL_SIZE(n) (15+(n)) /* 3.7.2.4. Selector Unit Descriptor */ struct uvc_selector_unit_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bUnitID; __u8 bNrInPins; __u8 baSourceID[0]; __u8 iSelector; } __attribute__((__packed__)); #define UVC_DT_SELECTOR_UNIT_SIZE(n) (6+(n)) #define UVC_SELECTOR_UNIT_DESCRIPTOR(n) \ uvc_selector_unit_descriptor_##n #define DECLARE_UVC_SELECTOR_UNIT_DESCRIPTOR(n) \ struct UVC_SELECTOR_UNIT_DESCRIPTOR(n) { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubType; \ __u8 bUnitID; \ __u8 bNrInPins; \ __u8 baSourceID[n]; \ __u8 iSelector; \ } __attribute__ ((packed)) /* 3.7.2.5. Processing Unit Descriptor */ struct uvc_processing_unit_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bUnitID; __u8 bSourceID; __u16 wMaxMultiplier; __u8 bControlSize; __u8 bmControls[2]; __u8 iProcessing; } __attribute__((__packed__)); #define UVC_DT_PROCESSING_UNIT_SIZE(n) (9+(n)) /* 3.7.2.6. Extension Unit Descriptor */ struct uvc_extension_unit_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bUnitID; __u8 guidExtensionCode[16]; __u8 bNumControls; __u8 bNrInPins; __u8 baSourceID[0]; __u8 bControlSize; __u8 bmControls[0]; __u8 iExtension; } __attribute__((__packed__)); #define UVC_DT_EXTENSION_UNIT_SIZE(p, n) (24+(p)+(n)) #define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ uvc_extension_unit_descriptor_##p_##n #define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubType; \ __u8 bUnitID; \ __u8 guidExtensionCode[16]; \ __u8 bNumControls; \ __u8 bNrInPins; \ __u8 baSourceID[p]; \ __u8 bControlSize; \ __u8 bmControls[n]; \ __u8 iExtension; \ } __attribute__ ((packed)) /* 3.8.2.2. Video Control Interrupt Endpoint Descriptor */ struct uvc_control_endpoint_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u16 wMaxTransferSize; } __attribute__((__packed__)); #define UVC_DT_CONTROL_ENDPOINT_SIZE 5 /* 3.9.2.1. Input Header Descriptor */ struct uvc_input_header_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bNumFormats; __u16 wTotalLength; __u8 bEndpointAddress; __u8 bmInfo; __u8 bTerminalLink; __u8 bStillCaptureMethod; __u8 bTriggerSupport; __u8 bTriggerUsage; __u8 bControlSize; __u8 bmaControls[]; } __attribute__((__packed__)); #define UVC_DT_INPUT_HEADER_SIZE(n, p) (13+(n*p)) #define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ uvc_input_header_descriptor_##n_##p #define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubType; \ __u8 bNumFormats; \ __u16 wTotalLength; \ __u8 bEndpointAddress; \ __u8 bmInfo; \ __u8 bTerminalLink; \ __u8 bStillCaptureMethod; \ __u8 bTriggerSupport; \ __u8 bTriggerUsage; \ __u8 bControlSize; \ __u8 bmaControls[p][n]; \ } __attribute__ ((packed)) /* 3.9.2.2. Output Header Descriptor */ struct uvc_output_header_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bNumFormats; __u16 wTotalLength; __u8 bEndpointAddress; __u8 bTerminalLink; __u8 bControlSize; __u8 bmaControls[]; } __attribute__((__packed__)); #define UVC_DT_OUTPUT_HEADER_SIZE(n, p) (9+(n*p)) #define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ uvc_output_header_descriptor_##n_##p #define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubType; \ __u8 bNumFormats; \ __u16 wTotalLength; \ __u8 bEndpointAddress; \ __u8 bTerminalLink; \ __u8 bControlSize; \ __u8 bmaControls[p][n]; \ } __attribute__ ((packed)) /* 3.9.2.6. Color matching descriptor */ struct uvc_color_matching_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bColorPrimaries; __u8 bTransferCharacteristics; __u8 bMatrixCoefficients; } __attribute__((__packed__)); #define UVC_DT_COLOR_MATCHING_SIZE 6 /* 4.3.1.1. Video Probe and Commit Controls */ struct uvc_streaming_control { __u16 bmHint; __u8 bFormatIndex; __u8 bFrameIndex; __u32 dwFrameInterval; __u16 wKeyFrameRate; __u16 wPFrameRate; __u16 wCompQuality; __u16 wCompWindowSize; __u16 wDelay; __u32 dwMaxVideoFrameSize; __u32 dwMaxPayloadTransferSize; __u32 dwClockFrequency; __u8 bmFramingInfo; __u8 bPreferedVersion; __u8 bMinVersion; __u8 bMaxVersion; } __attribute__((__packed__)); /* Uncompressed Payload - 3.1.1. Uncompressed Video Format Descriptor */ struct uvc_format_uncompressed { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bFormatIndex; __u8 bNumFrameDescriptors; __u8 guidFormat[16]; __u8 bBitsPerPixel; __u8 bDefaultFrameIndex; __u8 bAspectRatioX; __u8 bAspectRatioY; __u8 bmInterfaceFlags; __u8 bCopyProtect; } __attribute__((__packed__)); #define UVC_DT_FORMAT_UNCOMPRESSED_SIZE 27 /* Uncompressed Payload - 3.1.2. Uncompressed Video Frame Descriptor */ struct uvc_frame_uncompressed { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bFrameIndex; __u8 bmCapabilities; __u16 wWidth; __u16 wHeight; __u32 dwMinBitRate; __u32 dwMaxBitRate; __u32 dwMaxVideoFrameBufferSize; __u32 dwDefaultFrameInterval; __u8 bFrameIntervalType; __u32 dwFrameInterval[]; } __attribute__((__packed__)); #define UVC_DT_FRAME_UNCOMPRESSED_SIZE(n) (26+4*(n)) #define UVC_FRAME_UNCOMPRESSED(n) \ uvc_frame_uncompressed_##n #define DECLARE_UVC_FRAME_UNCOMPRESSED(n) \ struct UVC_FRAME_UNCOMPRESSED(n) { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubType; \ __u8 bFrameIndex; \ __u8 bmCapabilities; \ __u16 wWidth; \ __u16 wHeight; \ __u32 dwMinBitRate; \ __u32 dwMaxBitRate; \ __u32 dwMaxVideoFrameBufferSize; \ __u32 dwDefaultFrameInterval; \ __u8 bFrameIntervalType; \ __u32 dwFrameInterval[n]; \ } __attribute__ ((packed)) /* MJPEG Payload - 3.1.1. MJPEG Video Format Descriptor */ struct uvc_format_mjpeg { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bFormatIndex; __u8 bNumFrameDescriptors; __u8 bmFlags; __u8 bDefaultFrameIndex; __u8 bAspectRatioX; __u8 bAspectRatioY; __u8 bmInterfaceFlags; __u8 bCopyProtect; } __attribute__((__packed__)); #define UVC_DT_FORMAT_MJPEG_SIZE 11 /* MJPEG Payload - 3.1.2. MJPEG Video Frame Descriptor */ struct uvc_frame_mjpeg { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bFrameIndex; __u8 bmCapabilities; __u16 wWidth; __u16 wHeight; __u32 dwMinBitRate; __u32 dwMaxBitRate; __u32 dwMaxVideoFrameBufferSize; __u32 dwDefaultFrameInterval; __u8 bFrameIntervalType; __u32 dwFrameInterval[]; } __attribute__((__packed__)); #define UVC_DT_FRAME_MJPEG_SIZE(n) (26+4*(n)) #define UVC_FRAME_MJPEG(n) \ uvc_frame_mjpeg_##n #define DECLARE_UVC_FRAME_MJPEG(n) \ struct UVC_FRAME_MJPEG(n) { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubType; \ __u8 bFrameIndex; \ __u8 bmCapabilities; \ __u16 wWidth; \ __u16 wHeight; \ __u32 dwMinBitRate; \ __u32 dwMaxBitRate; \ __u32 dwMaxVideoFrameBufferSize; \ __u32 dwDefaultFrameInterval; \ __u8 bFrameIntervalType; \ __u32 dwFrameInterval[n]; \ } __attribute__ ((packed)) #endif /* __LINUX_USB_VIDEO_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/usb/cdc.h�������������������������������������������������������������������������������������0000644�����������������00000031242�14763166027�0007414 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * USB Communications Device Class (CDC) definitions * * CDC says how to talk to lots of different types of network adapters, * notably ethernet adapters and various modems. It's used mostly with * firmware based USB peripherals. */ #ifndef __UAPI_LINUX_USB_CDC_H #define __UAPI_LINUX_USB_CDC_H #include <linux/types.h> #define USB_CDC_SUBCLASS_ACM 0x02 #define USB_CDC_SUBCLASS_ETHERNET 0x06 #define USB_CDC_SUBCLASS_WHCM 0x08 #define USB_CDC_SUBCLASS_DMM 0x09 #define USB_CDC_SUBCLASS_MDLM 0x0a #define USB_CDC_SUBCLASS_OBEX 0x0b #define USB_CDC_SUBCLASS_EEM 0x0c #define USB_CDC_SUBCLASS_NCM 0x0d #define USB_CDC_SUBCLASS_MBIM 0x0e #define USB_CDC_PROTO_NONE 0 #define USB_CDC_ACM_PROTO_AT_V25TER 1 #define USB_CDC_ACM_PROTO_AT_PCCA101 2 #define USB_CDC_ACM_PROTO_AT_PCCA101_WAKE 3 #define USB_CDC_ACM_PROTO_AT_GSM 4 #define USB_CDC_ACM_PROTO_AT_3G 5 #define USB_CDC_ACM_PROTO_AT_CDMA 6 #define USB_CDC_ACM_PROTO_VENDOR 0xff #define USB_CDC_PROTO_EEM 7 #define USB_CDC_NCM_PROTO_NTB 1 #define USB_CDC_MBIM_PROTO_NTB 2 /*-------------------------------------------------------------------------*/ /* * Class-Specific descriptors ... there are a couple dozen of them */ #define USB_CDC_HEADER_TYPE 0x00 /* header_desc */ #define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */ #define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */ #define USB_CDC_UNION_TYPE 0x06 /* union_desc */ #define USB_CDC_COUNTRY_TYPE 0x07 #define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */ #define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ #define USB_CDC_WHCM_TYPE 0x11 #define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */ #define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */ #define USB_CDC_DMM_TYPE 0x14 #define USB_CDC_OBEX_TYPE 0x15 #define USB_CDC_NCM_TYPE 0x1a #define USB_CDC_MBIM_TYPE 0x1b #define USB_CDC_MBIM_EXTENDED_TYPE 0x1c /* "Header Functional Descriptor" from CDC spec 5.2.3.1 */ struct usb_cdc_header_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __le16 bcdCDC; } __attribute__ ((packed)); /* "Call Management Descriptor" from CDC spec 5.2.3.2 */ struct usb_cdc_call_mgmt_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bmCapabilities; #define USB_CDC_CALL_MGMT_CAP_CALL_MGMT 0x01 #define USB_CDC_CALL_MGMT_CAP_DATA_INTF 0x02 __u8 bDataInterface; } __attribute__ ((packed)); /* "Abstract Control Management Descriptor" from CDC spec 5.2.3.3 */ struct usb_cdc_acm_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bmCapabilities; } __attribute__ ((packed)); /* capabilities from 5.2.3.3 */ #define USB_CDC_COMM_FEATURE 0x01 #define USB_CDC_CAP_LINE 0x02 #define USB_CDC_CAP_BRK 0x04 #define USB_CDC_CAP_NOTIFY 0x08 /* "Union Functional Descriptor" from CDC spec 5.2.3.8 */ struct usb_cdc_union_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bMasterInterface0; __u8 bSlaveInterface0; /* ... and there could be other slave interfaces */ } __attribute__ ((packed)); /* "Country Selection Functional Descriptor" from CDC spec 5.2.3.9 */ struct usb_cdc_country_functional_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 iCountryCodeRelDate; __le16 wCountyCode0; /* ... and there can be a lot of country codes */ } __attribute__ ((packed)); /* "Network Channel Terminal Functional Descriptor" from CDC spec 5.2.3.11 */ struct usb_cdc_network_terminal_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bEntityId; __u8 iName; __u8 bChannelIndex; __u8 bPhysicalInterface; } __attribute__ ((packed)); /* "Ethernet Networking Functional Descriptor" from CDC spec 5.2.3.16 */ struct usb_cdc_ether_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 iMACAddress; __le32 bmEthernetStatistics; __le16 wMaxSegmentSize; __le16 wNumberMCFilters; __u8 bNumberPowerFilters; } __attribute__ ((packed)); /* "Telephone Control Model Functional Descriptor" from CDC WMC spec 6.3..3 */ struct usb_cdc_dmm_desc { __u8 bFunctionLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __u16 bcdVersion; __le16 wMaxCommand; } __attribute__ ((packed)); /* "MDLM Functional Descriptor" from CDC WMC spec 6.7.2.3 */ struct usb_cdc_mdlm_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __le16 bcdVersion; __u8 bGUID[16]; } __attribute__ ((packed)); /* "MDLM Detail Functional Descriptor" from CDC WMC spec 6.7.2.4 */ struct usb_cdc_mdlm_detail_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; /* type is associated with mdlm_desc.bGUID */ __u8 bGuidDescriptorType; __u8 bDetailData[0]; } __attribute__ ((packed)); /* "OBEX Control Model Functional Descriptor" */ struct usb_cdc_obex_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __le16 bcdVersion; } __attribute__ ((packed)); /* "NCM Control Model Functional Descriptor" */ struct usb_cdc_ncm_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __le16 bcdNcmVersion; __u8 bmNetworkCapabilities; } __attribute__ ((packed)); /* "MBIM Control Model Functional Descriptor" */ struct usb_cdc_mbim_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __le16 bcdMBIMVersion; __le16 wMaxControlMessage; __u8 bNumberFilters; __u8 bMaxFilterSize; __le16 wMaxSegmentSize; __u8 bmNetworkCapabilities; } __attribute__ ((packed)); /* "MBIM Extended Functional Descriptor" from CDC MBIM spec 1.0 errata-1 */ struct usb_cdc_mbim_extended_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __le16 bcdMBIMExtendedVersion; __u8 bMaxOutstandingCommandMessages; __le16 wMTU; } __attribute__ ((packed)); /*-------------------------------------------------------------------------*/ /* * Class-Specific Control Requests (6.2) * * section 3.6.2.1 table 4 has the ACM profile, for modems. * section 3.8.2 table 10 has the ethernet profile. * * Microsoft's RNDIS stack for Ethernet is a vendor-specific CDC ACM variant, * heavily dependent on the encapsulated (proprietary) command mechanism. */ #define USB_CDC_SEND_ENCAPSULATED_COMMAND 0x00 #define USB_CDC_GET_ENCAPSULATED_RESPONSE 0x01 #define USB_CDC_REQ_SET_LINE_CODING 0x20 #define USB_CDC_REQ_GET_LINE_CODING 0x21 #define USB_CDC_REQ_SET_CONTROL_LINE_STATE 0x22 #define USB_CDC_REQ_SEND_BREAK 0x23 #define USB_CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40 #define USB_CDC_SET_ETHERNET_PM_PATTERN_FILTER 0x41 #define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42 #define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43 #define USB_CDC_GET_ETHERNET_STATISTIC 0x44 #define USB_CDC_GET_NTB_PARAMETERS 0x80 #define USB_CDC_GET_NET_ADDRESS 0x81 #define USB_CDC_SET_NET_ADDRESS 0x82 #define USB_CDC_GET_NTB_FORMAT 0x83 #define USB_CDC_SET_NTB_FORMAT 0x84 #define USB_CDC_GET_NTB_INPUT_SIZE 0x85 #define USB_CDC_SET_NTB_INPUT_SIZE 0x86 #define USB_CDC_GET_MAX_DATAGRAM_SIZE 0x87 #define USB_CDC_SET_MAX_DATAGRAM_SIZE 0x88 #define USB_CDC_GET_CRC_MODE 0x89 #define USB_CDC_SET_CRC_MODE 0x8a /* Line Coding Structure from CDC spec 6.2.13 */ struct usb_cdc_line_coding { __le32 dwDTERate; __u8 bCharFormat; #define USB_CDC_1_STOP_BITS 0 #define USB_CDC_1_5_STOP_BITS 1 #define USB_CDC_2_STOP_BITS 2 __u8 bParityType; #define USB_CDC_NO_PARITY 0 #define USB_CDC_ODD_PARITY 1 #define USB_CDC_EVEN_PARITY 2 #define USB_CDC_MARK_PARITY 3 #define USB_CDC_SPACE_PARITY 4 __u8 bDataBits; } __attribute__ ((packed)); /* table 62; bits in multicast filter */ #define USB_CDC_PACKET_TYPE_PROMISCUOUS (1 << 0) #define USB_CDC_PACKET_TYPE_ALL_MULTICAST (1 << 1) /* no filter */ #define USB_CDC_PACKET_TYPE_DIRECTED (1 << 2) #define USB_CDC_PACKET_TYPE_BROADCAST (1 << 3) #define USB_CDC_PACKET_TYPE_MULTICAST (1 << 4) /* filtered */ /*-------------------------------------------------------------------------*/ /* * Class-Specific Notifications (6.3) sent by interrupt transfers * * section 3.8.2 table 11 of the CDC spec lists Ethernet notifications * section 3.6.2.1 table 5 specifies ACM notifications, accepted by RNDIS * RNDIS also defines its own bit-incompatible notifications */ #define USB_CDC_NOTIFY_NETWORK_CONNECTION 0x00 #define USB_CDC_NOTIFY_RESPONSE_AVAILABLE 0x01 #define USB_CDC_NOTIFY_SERIAL_STATE 0x20 #define USB_CDC_NOTIFY_SPEED_CHANGE 0x2a struct usb_cdc_notification { __u8 bmRequestType; __u8 bNotificationType; __le16 wValue; __le16 wIndex; __le16 wLength; } __attribute__ ((packed)); struct usb_cdc_speed_change { __le32 DLBitRRate; /* contains the downlink bit rate (IN pipe) */ __le32 ULBitRate; /* contains the uplink bit rate (OUT pipe) */ } __attribute__ ((packed)); /*-------------------------------------------------------------------------*/ /* * Class Specific structures and constants * * CDC NCM NTB parameters structure, CDC NCM subclass 6.2.1 * */ struct usb_cdc_ncm_ntb_parameters { __le16 wLength; __le16 bmNtbFormatsSupported; __le32 dwNtbInMaxSize; __le16 wNdpInDivisor; __le16 wNdpInPayloadRemainder; __le16 wNdpInAlignment; __le16 wPadding1; __le32 dwNtbOutMaxSize; __le16 wNdpOutDivisor; __le16 wNdpOutPayloadRemainder; __le16 wNdpOutAlignment; __le16 wNtbOutMaxDatagrams; } __attribute__ ((packed)); /* * CDC NCM transfer headers, CDC NCM subclass 3.2 */ #define USB_CDC_NCM_NTH16_SIGN 0x484D434E /* NCMH */ #define USB_CDC_NCM_NTH32_SIGN 0x686D636E /* ncmh */ struct usb_cdc_ncm_nth16 { __le32 dwSignature; __le16 wHeaderLength; __le16 wSequence; __le16 wBlockLength; __le16 wNdpIndex; } __attribute__ ((packed)); struct usb_cdc_ncm_nth32 { __le32 dwSignature; __le16 wHeaderLength; __le16 wSequence; __le32 dwBlockLength; __le32 dwNdpIndex; } __attribute__ ((packed)); /* * CDC NCM datagram pointers, CDC NCM subclass 3.3 */ #define USB_CDC_NCM_NDP16_CRC_SIGN 0x314D434E /* NCM1 */ #define USB_CDC_NCM_NDP16_NOCRC_SIGN 0x304D434E /* NCM0 */ #define USB_CDC_NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */ #define USB_CDC_NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */ #define USB_CDC_MBIM_NDP16_IPS_SIGN 0x00535049 /* IPS<sessionID> : IPS0 for now */ #define USB_CDC_MBIM_NDP32_IPS_SIGN 0x00737069 /* ips<sessionID> : ips0 for now */ #define USB_CDC_MBIM_NDP16_DSS_SIGN 0x00535344 /* DSS<sessionID> */ #define USB_CDC_MBIM_NDP32_DSS_SIGN 0x00737364 /* dss<sessionID> */ /* 16-bit NCM Datagram Pointer Entry */ struct usb_cdc_ncm_dpe16 { __le16 wDatagramIndex; __le16 wDatagramLength; } __attribute__((__packed__)); /* 16-bit NCM Datagram Pointer Table */ struct usb_cdc_ncm_ndp16 { __le32 dwSignature; __le16 wLength; __le16 wNextNdpIndex; struct usb_cdc_ncm_dpe16 dpe16[0]; } __attribute__ ((packed)); /* 32-bit NCM Datagram Pointer Entry */ struct usb_cdc_ncm_dpe32 { __le32 dwDatagramIndex; __le32 dwDatagramLength; } __attribute__((__packed__)); /* 32-bit NCM Datagram Pointer Table */ struct usb_cdc_ncm_ndp32 { __le32 dwSignature; __le16 wLength; __le16 wReserved6; __le32 dwNextNdpIndex; __le32 dwReserved12; struct usb_cdc_ncm_dpe32 dpe32[0]; } __attribute__ ((packed)); /* CDC NCM subclass 3.2.1 and 3.2.2 */ #define USB_CDC_NCM_NDP16_INDEX_MIN 0x000C #define USB_CDC_NCM_NDP32_INDEX_MIN 0x0010 /* CDC NCM subclass 3.3.3 Datagram Formatting */ #define USB_CDC_NCM_DATAGRAM_FORMAT_CRC 0x30 #define USB_CDC_NCM_DATAGRAM_FORMAT_NOCRC 0X31 /* CDC NCM subclass 4.2 NCM Communications Interface Protocol Code */ #define USB_CDC_NCM_PROTO_CODE_NO_ENCAP_COMMANDS 0x00 #define USB_CDC_NCM_PROTO_CODE_EXTERN_PROTO 0xFE /* CDC NCM subclass 5.2.1 NCM Functional Descriptor, bmNetworkCapabilities */ #define USB_CDC_NCM_NCAP_ETH_FILTER (1 << 0) #define USB_CDC_NCM_NCAP_NET_ADDRESS (1 << 1) #define USB_CDC_NCM_NCAP_ENCAP_COMMAND (1 << 2) #define USB_CDC_NCM_NCAP_MAX_DATAGRAM_SIZE (1 << 3) #define USB_CDC_NCM_NCAP_CRC_MODE (1 << 4) #define USB_CDC_NCM_NCAP_NTB_INPUT_SIZE (1 << 5) /* CDC NCM subclass Table 6-3: NTB Parameter Structure */ #define USB_CDC_NCM_NTB16_SUPPORTED (1 << 0) #define USB_CDC_NCM_NTB32_SUPPORTED (1 << 1) /* CDC NCM subclass Table 6-3: NTB Parameter Structure */ #define USB_CDC_NCM_NDP_ALIGN_MIN_SIZE 0x04 #define USB_CDC_NCM_NTB_MAX_LENGTH 0x1C /* CDC NCM subclass 6.2.5 SetNtbFormat */ #define USB_CDC_NCM_NTB16_FORMAT 0x00 #define USB_CDC_NCM_NTB32_FORMAT 0x01 /* CDC NCM subclass 6.2.7 SetNtbInputSize */ #define USB_CDC_NCM_NTB_MIN_IN_SIZE 2048 #define USB_CDC_NCM_NTB_MIN_OUT_SIZE 2048 /* NTB Input Size Structure */ struct usb_cdc_ncm_ndp_input_size { __le32 dwNtbInMaxSize; __le16 wNtbInMaxDatagrams; __le16 wReserved; } __attribute__ ((packed)); /* CDC NCM subclass 6.2.11 SetCrcMode */ #define USB_CDC_NCM_CRC_NOT_APPENDED 0x00 #define USB_CDC_NCM_CRC_APPENDED 0x01 #endif /* __UAPI_LINUX_USB_CDC_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/usb/ch11.h������������������������������������������������������������������������������������0000644�����������������00000021675�14763166027�0007430 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * This file holds Hub protocol constants and data structures that are * defined in chapter 11 (Hub Specification) of the USB 2.0 specification. * * It is used/shared between the USB core, the HCDs and couple of other USB * drivers. */ #ifndef __LINUX_CH11_H #define __LINUX_CH11_H #include <linux/types.h> /* __u8 etc */ /* This is arbitrary. * From USB 2.0 spec Table 11-13, offset 7, a hub can * have up to 255 ports. The most yet reported is 10. * * Current Wireless USB host hardware (Intel i1480 for example) allows * up to 22 devices to connect. Upcoming hardware might raise that * limit. Because the arrays need to add a bit for hub status data, we * use 31, so plus one evens out to four bytes. */ #define USB_MAXCHILDREN 31 /* See USB 3.1 spec Table 10-5 */ #define USB_SS_MAXPORTS 15 /* * Hub request types */ #define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE) #define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER) /* * Port status type for GetPortStatus requests added in USB 3.1 * See USB 3.1 spec Table 10-12 */ #define HUB_PORT_STATUS 0 #define HUB_PORT_PD_STATUS 1 #define HUB_EXT_PORT_STATUS 2 /* * Hub class requests * See USB 2.0 spec Table 11-16 */ #define HUB_CLEAR_TT_BUFFER 8 #define HUB_RESET_TT 9 #define HUB_GET_TT_STATE 10 #define HUB_STOP_TT 11 /* * Hub class additional requests defined by USB 3.0 spec * See USB 3.0 spec Table 10-6 */ #define HUB_SET_DEPTH 12 #define HUB_GET_PORT_ERR_COUNT 13 /* * Hub Class feature numbers * See USB 2.0 spec Table 11-17 */ #define C_HUB_LOCAL_POWER 0 #define C_HUB_OVER_CURRENT 1 /* * Port feature numbers * See USB 2.0 spec Table 11-17 */ #define USB_PORT_FEAT_CONNECTION 0 #define USB_PORT_FEAT_ENABLE 1 #define USB_PORT_FEAT_SUSPEND 2 /* L2 suspend */ #define USB_PORT_FEAT_OVER_CURRENT 3 #define USB_PORT_FEAT_RESET 4 #define USB_PORT_FEAT_L1 5 /* L1 suspend */ #define USB_PORT_FEAT_POWER 8 #define USB_PORT_FEAT_LOWSPEED 9 /* Should never be used */ #define USB_PORT_FEAT_C_CONNECTION 16 #define USB_PORT_FEAT_C_ENABLE 17 #define USB_PORT_FEAT_C_SUSPEND 18 #define USB_PORT_FEAT_C_OVER_CURRENT 19 #define USB_PORT_FEAT_C_RESET 20 #define USB_PORT_FEAT_TEST 21 #define USB_PORT_FEAT_INDICATOR 22 #define USB_PORT_FEAT_C_PORT_L1 23 /* * Port feature selectors added by USB 3.0 spec. * See USB 3.0 spec Table 10-7 */ #define USB_PORT_FEAT_LINK_STATE 5 #define USB_PORT_FEAT_U1_TIMEOUT 23 #define USB_PORT_FEAT_U2_TIMEOUT 24 #define USB_PORT_FEAT_C_PORT_LINK_STATE 25 #define USB_PORT_FEAT_C_PORT_CONFIG_ERROR 26 #define USB_PORT_FEAT_REMOTE_WAKE_MASK 27 #define USB_PORT_FEAT_BH_PORT_RESET 28 #define USB_PORT_FEAT_C_BH_PORT_RESET 29 #define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 #define USB_PORT_LPM_TIMEOUT(p) (((p) & 0xff) << 8) /* USB 3.0 hub remote wake mask bits, see table 10-14 */ #define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8) #define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9) #define USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT (1 << 10) /* * Hub Status and Hub Change results * See USB 2.0 spec Table 11-19 and Table 11-20 * USB 3.1 extends the port status request and may return 4 additional bytes. * See USB 3.1 spec section 10.16.2.6 Table 10-12 and 10-15 */ struct usb_port_status { __le16 wPortStatus; __le16 wPortChange; __le32 dwExtPortStatus; } __attribute__ ((packed)); /* * wPortStatus bit field * See USB 2.0 spec Table 11-21 */ #define USB_PORT_STAT_CONNECTION 0x0001 #define USB_PORT_STAT_ENABLE 0x0002 #define USB_PORT_STAT_SUSPEND 0x0004 #define USB_PORT_STAT_OVERCURRENT 0x0008 #define USB_PORT_STAT_RESET 0x0010 #define USB_PORT_STAT_L1 0x0020 /* bits 6 to 7 are reserved */ #define USB_PORT_STAT_POWER 0x0100 #define USB_PORT_STAT_LOW_SPEED 0x0200 #define USB_PORT_STAT_HIGH_SPEED 0x0400 #define USB_PORT_STAT_TEST 0x0800 #define USB_PORT_STAT_INDICATOR 0x1000 /* bits 13 to 15 are reserved */ /* * Additions to wPortStatus bit field from USB 3.0 * See USB 3.0 spec Table 10-10 */ #define USB_PORT_STAT_LINK_STATE 0x01e0 #define USB_SS_PORT_STAT_POWER 0x0200 #define USB_SS_PORT_STAT_SPEED 0x1c00 #define USB_PORT_STAT_SPEED_5GBPS 0x0000 /* Valid only if port is enabled */ /* Bits that are the same from USB 2.0 */ #define USB_SS_PORT_STAT_MASK (USB_PORT_STAT_CONNECTION | \ USB_PORT_STAT_ENABLE | \ USB_PORT_STAT_OVERCURRENT | \ USB_PORT_STAT_RESET) /* * Definitions for PORT_LINK_STATE values * (bits 5-8) in wPortStatus */ #define USB_SS_PORT_LS_U0 0x0000 #define USB_SS_PORT_LS_U1 0x0020 #define USB_SS_PORT_LS_U2 0x0040 #define USB_SS_PORT_LS_U3 0x0060 #define USB_SS_PORT_LS_SS_DISABLED 0x0080 #define USB_SS_PORT_LS_RX_DETECT 0x00a0 #define USB_SS_PORT_LS_SS_INACTIVE 0x00c0 #define USB_SS_PORT_LS_POLLING 0x00e0 #define USB_SS_PORT_LS_RECOVERY 0x0100 #define USB_SS_PORT_LS_HOT_RESET 0x0120 #define USB_SS_PORT_LS_COMP_MOD 0x0140 #define USB_SS_PORT_LS_LOOPBACK 0x0160 /* * wPortChange bit field * See USB 2.0 spec Table 11-22 and USB 2.0 LPM ECN Table-4.10 * Bits 0 to 5 shown, bits 6 to 15 are reserved */ #define USB_PORT_STAT_C_CONNECTION 0x0001 #define USB_PORT_STAT_C_ENABLE 0x0002 #define USB_PORT_STAT_C_SUSPEND 0x0004 #define USB_PORT_STAT_C_OVERCURRENT 0x0008 #define USB_PORT_STAT_C_RESET 0x0010 #define USB_PORT_STAT_C_L1 0x0020 /* * USB 3.0 wPortChange bit fields * See USB 3.0 spec Table 10-11 */ #define USB_PORT_STAT_C_BH_RESET 0x0020 #define USB_PORT_STAT_C_LINK_STATE 0x0040 #define USB_PORT_STAT_C_CONFIG_ERROR 0x0080 /* * USB 3.1 dwExtPortStatus field masks * See USB 3.1 spec 10.16.2.6.3 Table 10-15 */ #define USB_EXT_PORT_STAT_RX_SPEED_ID 0x0000000f #define USB_EXT_PORT_STAT_TX_SPEED_ID 0x000000f0 #define USB_EXT_PORT_STAT_RX_LANES 0x00000f00 #define USB_EXT_PORT_STAT_TX_LANES 0x0000f000 #define USB_EXT_PORT_RX_LANES(p) \ (((p) & USB_EXT_PORT_STAT_RX_LANES) >> 8) #define USB_EXT_PORT_TX_LANES(p) \ (((p) & USB_EXT_PORT_STAT_TX_LANES) >> 12) /* * wHubCharacteristics (masks) * See USB 2.0 spec Table 11-13, offset 3 */ #define HUB_CHAR_LPSM 0x0003 /* Logical Power Switching Mode mask */ #define HUB_CHAR_COMMON_LPSM 0x0000 /* All ports power control at once */ #define HUB_CHAR_INDV_PORT_LPSM 0x0001 /* per-port power control */ #define HUB_CHAR_NO_LPSM 0x0002 /* no power switching */ #define HUB_CHAR_COMPOUND 0x0004 /* hub is part of a compound device */ #define HUB_CHAR_OCPM 0x0018 /* Over-Current Protection Mode mask */ #define HUB_CHAR_COMMON_OCPM 0x0000 /* All ports Over-Current reporting */ #define HUB_CHAR_INDV_PORT_OCPM 0x0008 /* per-port Over-current reporting */ #define HUB_CHAR_NO_OCPM 0x0010 /* No Over-current Protection support */ #define HUB_CHAR_TTTT 0x0060 /* TT Think Time mask */ #define HUB_CHAR_PORTIND 0x0080 /* per-port indicators (LEDs) */ struct usb_hub_status { __le16 wHubStatus; __le16 wHubChange; } __attribute__ ((packed)); /* * Hub Status & Hub Change bit masks * See USB 2.0 spec Table 11-19 and Table 11-20 * Bits 0 and 1 for wHubStatus and wHubChange * Bits 2 to 15 are reserved for both */ #define HUB_STATUS_LOCAL_POWER 0x0001 #define HUB_STATUS_OVERCURRENT 0x0002 #define HUB_CHANGE_LOCAL_POWER 0x0001 #define HUB_CHANGE_OVERCURRENT 0x0002 /* * Hub descriptor * See USB 2.0 spec Table 11-13 */ #define USB_DT_HUB (USB_TYPE_CLASS | 0x09) #define USB_DT_SS_HUB (USB_TYPE_CLASS | 0x0a) #define USB_DT_HUB_NONVAR_SIZE 7 #define USB_DT_SS_HUB_SIZE 12 /* * Hub Device descriptor * USB Hub class device protocols */ #define USB_HUB_PR_FS 0 /* Full speed hub */ #define USB_HUB_PR_HS_NO_TT 0 /* Hi-speed hub without TT */ #define USB_HUB_PR_HS_SINGLE_TT 1 /* Hi-speed hub with single TT */ #define USB_HUB_PR_HS_MULTI_TT 2 /* Hi-speed hub with multiple TT */ #define USB_HUB_PR_SS 3 /* Super speed hub */ struct usb_hub_descriptor { __u8 bDescLength; __u8 bDescriptorType; __u8 bNbrPorts; __le16 wHubCharacteristics; __u8 bPwrOn2PwrGood; __u8 bHubContrCurrent; /* 2.0 and 3.0 hubs differ here */ union { struct { /* add 1 bit for hub status change; round to bytes */ __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8]; __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8]; } __attribute__ ((packed)) hs; struct { __u8 bHubHdrDecLat; __le16 wHubDelay; __le16 DeviceRemovable; } __attribute__ ((packed)) ss; } u; } __attribute__ ((packed)); /* port indicator status selectors, tables 11-7 and 11-25 */ #define HUB_LED_AUTO 0 #define HUB_LED_AMBER 1 #define HUB_LED_GREEN 2 #define HUB_LED_OFF 3 enum hub_led_mode { INDICATOR_AUTO = 0, INDICATOR_CYCLE, /* software blinks for attention: software, hardware, reserved */ INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF, INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF, INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF } __attribute__ ((packed)); /* Transaction Translator Think Times, in bits */ #define HUB_TTTT_8_BITS 0x00 #define HUB_TTTT_16_BITS 0x20 #define HUB_TTTT_24_BITS 0x40 #define HUB_TTTT_32_BITS 0x60 #endif /* __LINUX_CH11_H */ �������������������������������������������������������������������linux/usb/audio.h�����������������������������������������������������������������������������������0000644�����������������00000046042�14763166027�0007770 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * <linux/usb/audio.h> -- USB Audio definitions. * * Copyright (C) 2006 Thumtronics Pty Ltd. * Developed for Thumtronics by Grey Innovation * Ben Williamson <ben.williamson@greyinnovation.com> * * This software is distributed under the terms of the GNU General Public * License ("GPL") version 2, as published by the Free Software Foundation. * * This file holds USB constants and structures defined * by the USB Device Class Definition for Audio Devices. * Comments below reference relevant sections of that document: * * http://www.usb.org/developers/devclass_docs/audio10.pdf * * Types and defines in this file are either specific to version 1.0 of * this standard or common for newer versions. */ #ifndef __LINUX_USB_AUDIO_H #define __LINUX_USB_AUDIO_H #include <linux/types.h> /* bInterfaceProtocol values to denote the version of the standard used */ #define UAC_VERSION_1 0x00 #define UAC_VERSION_2 0x20 #define UAC_VERSION_3 0x30 /* A.2 Audio Interface Subclass Codes */ #define USB_SUBCLASS_AUDIOCONTROL 0x01 #define USB_SUBCLASS_AUDIOSTREAMING 0x02 #define USB_SUBCLASS_MIDISTREAMING 0x03 /* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */ #define UAC_HEADER 0x01 #define UAC_INPUT_TERMINAL 0x02 #define UAC_OUTPUT_TERMINAL 0x03 #define UAC_MIXER_UNIT 0x04 #define UAC_SELECTOR_UNIT 0x05 #define UAC_FEATURE_UNIT 0x06 #define UAC1_PROCESSING_UNIT 0x07 #define UAC1_EXTENSION_UNIT 0x08 /* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */ #define UAC_AS_GENERAL 0x01 #define UAC_FORMAT_TYPE 0x02 #define UAC_FORMAT_SPECIFIC 0x03 /* A.7 Processing Unit Process Types */ #define UAC_PROCESS_UNDEFINED 0x00 #define UAC_PROCESS_UP_DOWNMIX 0x01 #define UAC_PROCESS_DOLBY_PROLOGIC 0x02 #define UAC_PROCESS_STEREO_EXTENDER 0x03 #define UAC_PROCESS_REVERB 0x04 #define UAC_PROCESS_CHORUS 0x05 #define UAC_PROCESS_DYN_RANGE_COMP 0x06 /* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */ #define UAC_EP_GENERAL 0x01 /* A.9 Audio Class-Specific Request Codes */ #define UAC_SET_ 0x00 #define UAC_GET_ 0x80 #define UAC__CUR 0x1 #define UAC__MIN 0x2 #define UAC__MAX 0x3 #define UAC__RES 0x4 #define UAC__MEM 0x5 #define UAC_SET_CUR (UAC_SET_ | UAC__CUR) #define UAC_GET_CUR (UAC_GET_ | UAC__CUR) #define UAC_SET_MIN (UAC_SET_ | UAC__MIN) #define UAC_GET_MIN (UAC_GET_ | UAC__MIN) #define UAC_SET_MAX (UAC_SET_ | UAC__MAX) #define UAC_GET_MAX (UAC_GET_ | UAC__MAX) #define UAC_SET_RES (UAC_SET_ | UAC__RES) #define UAC_GET_RES (UAC_GET_ | UAC__RES) #define UAC_SET_MEM (UAC_SET_ | UAC__MEM) #define UAC_GET_MEM (UAC_GET_ | UAC__MEM) #define UAC_GET_STAT 0xff /* A.10 Control Selector Codes */ /* A.10.1 Terminal Control Selectors */ #define UAC_TERM_COPY_PROTECT 0x01 /* A.10.2 Feature Unit Control Selectors */ #define UAC_FU_MUTE 0x01 #define UAC_FU_VOLUME 0x02 #define UAC_FU_BASS 0x03 #define UAC_FU_MID 0x04 #define UAC_FU_TREBLE 0x05 #define UAC_FU_GRAPHIC_EQUALIZER 0x06 #define UAC_FU_AUTOMATIC_GAIN 0x07 #define UAC_FU_DELAY 0x08 #define UAC_FU_BASS_BOOST 0x09 #define UAC_FU_LOUDNESS 0x0a #define UAC_CONTROL_BIT(CS) (1 << ((CS) - 1)) /* A.10.3.1 Up/Down-mix Processing Unit Controls Selectors */ #define UAC_UD_ENABLE 0x01 #define UAC_UD_MODE_SELECT 0x02 /* A.10.3.2 Dolby Prologic (tm) Processing Unit Controls Selectors */ #define UAC_DP_ENABLE 0x01 #define UAC_DP_MODE_SELECT 0x02 /* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */ #define UAC_3D_ENABLE 0x01 #define UAC_3D_SPACE 0x02 /* A.10.3.4 Reverberation Processing Unit Control Selectors */ #define UAC_REVERB_ENABLE 0x01 #define UAC_REVERB_LEVEL 0x02 #define UAC_REVERB_TIME 0x03 #define UAC_REVERB_FEEDBACK 0x04 /* A.10.3.5 Chorus Processing Unit Control Selectors */ #define UAC_CHORUS_ENABLE 0x01 #define UAC_CHORUS_LEVEL 0x02 #define UAC_CHORUS_RATE 0x03 #define UAC_CHORUS_DEPTH 0x04 /* A.10.3.6 Dynamic Range Compressor Unit Control Selectors */ #define UAC_DCR_ENABLE 0x01 #define UAC_DCR_RATE 0x02 #define UAC_DCR_MAXAMPL 0x03 #define UAC_DCR_THRESHOLD 0x04 #define UAC_DCR_ATTACK_TIME 0x05 #define UAC_DCR_RELEASE_TIME 0x06 /* A.10.4 Extension Unit Control Selectors */ #define UAC_XU_ENABLE 0x01 /* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */ #define UAC_MS_HEADER 0x01 #define UAC_MIDI_IN_JACK 0x02 #define UAC_MIDI_OUT_JACK 0x03 /* MIDI - A.1 MS Class-Specific Endpoint Descriptor Subtypes */ #define UAC_MS_GENERAL 0x01 /* Terminals - 2.1 USB Terminal Types */ #define UAC_TERMINAL_UNDEFINED 0x100 #define UAC_TERMINAL_STREAMING 0x101 #define UAC_TERMINAL_VENDOR_SPEC 0x1FF /* Terminal Control Selectors */ /* 4.3.2 Class-Specific AC Interface Descriptor */ struct uac1_ac_header_descriptor { __u8 bLength; /* 8 + n */ __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ __u8 bDescriptorSubtype; /* UAC_MS_HEADER */ __le16 bcdADC; /* 0x0100 */ __le16 wTotalLength; /* includes Unit and Terminal desc. */ __u8 bInCollection; /* n */ __u8 baInterfaceNr[]; /* [n] */ } __attribute__ ((packed)); #define UAC_DT_AC_HEADER_SIZE(n) (8 + (n)) /* As above, but more useful for defining your own descriptors: */ #define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \ struct uac1_ac_header_descriptor_##n { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubtype; \ __le16 bcdADC; \ __le16 wTotalLength; \ __u8 bInCollection; \ __u8 baInterfaceNr[n]; \ } __attribute__ ((packed)) /* 4.3.2.1 Input Terminal Descriptor */ struct uac_input_terminal_descriptor { __u8 bLength; /* in bytes: 12 */ __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */ __u8 bTerminalID; /* Constant uniquely terminal ID */ __le16 wTerminalType; /* USB Audio Terminal Types */ __u8 bAssocTerminal; /* ID of the Output Terminal associated */ __u8 bNrChannels; /* Number of logical output channels */ __le16 wChannelConfig; __u8 iChannelNames; __u8 iTerminal; } __attribute__ ((packed)); #define UAC_DT_INPUT_TERMINAL_SIZE 12 /* Terminals - 2.2 Input Terminal Types */ #define UAC_INPUT_TERMINAL_UNDEFINED 0x200 #define UAC_INPUT_TERMINAL_MICROPHONE 0x201 #define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202 #define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203 #define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204 #define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205 #define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206 /* Terminals - control selectors */ #define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01 /* 4.3.2.2 Output Terminal Descriptor */ struct uac1_output_terminal_descriptor { __u8 bLength; /* in bytes: 9 */ __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */ __u8 bTerminalID; /* Constant uniquely terminal ID */ __le16 wTerminalType; /* USB Audio Terminal Types */ __u8 bAssocTerminal; /* ID of the Input Terminal associated */ __u8 bSourceID; /* ID of the connected Unit or Terminal*/ __u8 iTerminal; } __attribute__ ((packed)); #define UAC_DT_OUTPUT_TERMINAL_SIZE 9 /* Terminals - 2.3 Output Terminal Types */ #define UAC_OUTPUT_TERMINAL_UNDEFINED 0x300 #define UAC_OUTPUT_TERMINAL_SPEAKER 0x301 #define UAC_OUTPUT_TERMINAL_HEADPHONES 0x302 #define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303 #define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304 #define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305 #define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306 #define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307 /* Terminals - 2.4 Bi-directional Terminal Types */ #define UAC_BIDIR_TERMINAL_UNDEFINED 0x400 #define UAC_BIDIR_TERMINAL_HANDSET 0x401 #define UAC_BIDIR_TERMINAL_HEADSET 0x402 #define UAC_BIDIR_TERMINAL_SPEAKER_PHONE 0x403 #define UAC_BIDIR_TERMINAL_ECHO_SUPPRESSING 0x404 #define UAC_BIDIR_TERMINAL_ECHO_CANCELING 0x405 /* Set bControlSize = 2 as default setting */ #define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2) /* As above, but more useful for defining your own descriptors: */ #define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \ struct uac_feature_unit_descriptor_##ch { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubtype; \ __u8 bUnitID; \ __u8 bSourceID; \ __u8 bControlSize; \ __le16 bmaControls[ch + 1]; \ __u8 iFeature; \ } __attribute__ ((packed)) /* 4.3.2.3 Mixer Unit Descriptor */ struct uac_mixer_unit_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __u8 bUnitID; __u8 bNrInPins; __u8 baSourceID[]; } __attribute__ ((packed)); static __inline__ __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc) { return desc->baSourceID[desc->bNrInPins]; } static __inline__ __u32 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc, int protocol) { if (protocol == UAC_VERSION_1) return (desc->baSourceID[desc->bNrInPins + 2] << 8) | desc->baSourceID[desc->bNrInPins + 1]; else return (desc->baSourceID[desc->bNrInPins + 4] << 24) | (desc->baSourceID[desc->bNrInPins + 3] << 16) | (desc->baSourceID[desc->bNrInPins + 2] << 8) | (desc->baSourceID[desc->bNrInPins + 1]); } static __inline__ __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc, int protocol) { return (protocol == UAC_VERSION_1) ? desc->baSourceID[desc->bNrInPins + 3] : desc->baSourceID[desc->bNrInPins + 5]; } static __inline__ __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc, int protocol) { switch (protocol) { case UAC_VERSION_1: return &desc->baSourceID[desc->bNrInPins + 4]; case UAC_VERSION_2: return &desc->baSourceID[desc->bNrInPins + 6]; case UAC_VERSION_3: return &desc->baSourceID[desc->bNrInPins + 2]; default: return NULL; } } static __inline__ __u16 uac3_mixer_unit_wClusterDescrID(struct uac_mixer_unit_descriptor *desc) { return (desc->baSourceID[desc->bNrInPins + 1] << 8) | desc->baSourceID[desc->bNrInPins]; } static __inline__ __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc) { __u8 *raw = (__u8 *) desc; return raw[desc->bLength - 1]; } /* 4.3.2.4 Selector Unit Descriptor */ struct uac_selector_unit_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __u8 bUintID; __u8 bNrInPins; __u8 baSourceID[]; } __attribute__ ((packed)); static __inline__ __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc) { __u8 *raw = (__u8 *) desc; return raw[desc->bLength - 1]; } /* 4.3.2.5 Feature Unit Descriptor */ struct uac_feature_unit_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __u8 bUnitID; __u8 bSourceID; __u8 bControlSize; __u8 bmaControls[0]; /* variable length */ } __attribute__((packed)); static __inline__ __u8 uac_feature_unit_iFeature(struct uac_feature_unit_descriptor *desc) { __u8 *raw = (__u8 *) desc; return raw[desc->bLength - 1]; } /* 4.3.2.6 Processing Unit Descriptors */ struct uac_processing_unit_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __u8 bUnitID; __le16 wProcessType; __u8 bNrInPins; __u8 baSourceID[]; } __attribute__ ((packed)); static __inline__ __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_descriptor *desc) { return desc->baSourceID[desc->bNrInPins]; } static __inline__ __u32 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc, int protocol) { if (protocol == UAC_VERSION_1) return (desc->baSourceID[desc->bNrInPins + 2] << 8) | desc->baSourceID[desc->bNrInPins + 1]; else return (desc->baSourceID[desc->bNrInPins + 4] << 24) | (desc->baSourceID[desc->bNrInPins + 3] << 16) | (desc->baSourceID[desc->bNrInPins + 2] << 8) | (desc->baSourceID[desc->bNrInPins + 1]); } static __inline__ __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc, int protocol) { return (protocol == UAC_VERSION_1) ? desc->baSourceID[desc->bNrInPins + 3] : desc->baSourceID[desc->bNrInPins + 5]; } static __inline__ __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc, int protocol) { switch (protocol) { case UAC_VERSION_1: return desc->baSourceID[desc->bNrInPins + 4]; case UAC_VERSION_2: return 2; /* in UAC2, this value is constant */ case UAC_VERSION_3: return 4; /* in UAC3, this value is constant */ default: return 1; } } static __inline__ __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc, int protocol) { switch (protocol) { case UAC_VERSION_1: return &desc->baSourceID[desc->bNrInPins + 5]; case UAC_VERSION_2: return &desc->baSourceID[desc->bNrInPins + 6]; case UAC_VERSION_3: return &desc->baSourceID[desc->bNrInPins + 2]; default: return NULL; } } static __inline__ __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc, int protocol) { __u8 control_size = uac_processing_unit_bControlSize(desc, protocol); switch (protocol) { case UAC_VERSION_1: case UAC_VERSION_2: default: return *(uac_processing_unit_bmControls(desc, protocol) + control_size); case UAC_VERSION_3: return 0; /* UAC3 does not have this field */ } } static __inline__ __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc, int protocol) { __u8 control_size = uac_processing_unit_bControlSize(desc, protocol); switch (protocol) { case UAC_VERSION_1: case UAC_VERSION_2: default: return uac_processing_unit_bmControls(desc, protocol) + control_size + 1; case UAC_VERSION_3: return uac_processing_unit_bmControls(desc, protocol) + control_size; } } /* * Extension Unit (XU) has almost compatible layout with Processing Unit, but * on UAC2, it has a different bmControls size (bControlSize); it's 1 byte for * XU while 2 bytes for PU. The last iExtension field is a one-byte index as * well as iProcessing field of PU. */ static __inline__ __u8 uac_extension_unit_bControlSize(struct uac_processing_unit_descriptor *desc, int protocol) { switch (protocol) { case UAC_VERSION_1: return desc->baSourceID[desc->bNrInPins + 4]; case UAC_VERSION_2: return 1; /* in UAC2, this value is constant */ case UAC_VERSION_3: return 4; /* in UAC3, this value is constant */ default: return 1; } } static __inline__ __u8 uac_extension_unit_iExtension(struct uac_processing_unit_descriptor *desc, int protocol) { __u8 control_size = uac_extension_unit_bControlSize(desc, protocol); switch (protocol) { case UAC_VERSION_1: case UAC_VERSION_2: default: return *(uac_processing_unit_bmControls(desc, protocol) + control_size); case UAC_VERSION_3: return 0; /* UAC3 does not have this field */ } } /* 4.5.2 Class-Specific AS Interface Descriptor */ struct uac1_as_header_descriptor { __u8 bLength; /* in bytes: 7 */ __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ __u8 bDescriptorSubtype; /* AS_GENERAL */ __u8 bTerminalLink; /* Terminal ID of connected Terminal */ __u8 bDelay; /* Delay introduced by the data path */ __le16 wFormatTag; /* The Audio Data Format */ } __attribute__ ((packed)); #define UAC_DT_AS_HEADER_SIZE 7 /* Formats - A.1.1 Audio Data Format Type I Codes */ #define UAC_FORMAT_TYPE_I_UNDEFINED 0x0 #define UAC_FORMAT_TYPE_I_PCM 0x1 #define UAC_FORMAT_TYPE_I_PCM8 0x2 #define UAC_FORMAT_TYPE_I_IEEE_FLOAT 0x3 #define UAC_FORMAT_TYPE_I_ALAW 0x4 #define UAC_FORMAT_TYPE_I_MULAW 0x5 struct uac_format_type_i_continuous_descriptor { __u8 bLength; /* in bytes: 8 + (ns * 3) */ __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ __u8 bDescriptorSubtype; /* FORMAT_TYPE */ __u8 bFormatType; /* FORMAT_TYPE_1 */ __u8 bNrChannels; /* physical channels in the stream */ __u8 bSubframeSize; /* */ __u8 bBitResolution; __u8 bSamFreqType; __u8 tLowerSamFreq[3]; __u8 tUpperSamFreq[3]; } __attribute__ ((packed)); #define UAC_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14 struct uac_format_type_i_discrete_descriptor { __u8 bLength; /* in bytes: 8 + (ns * 3) */ __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ __u8 bDescriptorSubtype; /* FORMAT_TYPE */ __u8 bFormatType; /* FORMAT_TYPE_1 */ __u8 bNrChannels; /* physical channels in the stream */ __u8 bSubframeSize; /* */ __u8 bBitResolution; __u8 bSamFreqType; __u8 tSamFreq[][3]; } __attribute__ ((packed)); #define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \ struct uac_format_type_i_discrete_descriptor_##n { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubtype; \ __u8 bFormatType; \ __u8 bNrChannels; \ __u8 bSubframeSize; \ __u8 bBitResolution; \ __u8 bSamFreqType; \ __u8 tSamFreq[n][3]; \ } __attribute__ ((packed)) #define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3)) struct uac_format_type_i_ext_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __u8 bFormatType; __u8 bSubslotSize; __u8 bBitResolution; __u8 bHeaderLength; __u8 bControlSize; __u8 bSideBandProtocol; } __attribute__((packed)); /* Formats - Audio Data Format Type I Codes */ #define UAC_FORMAT_TYPE_II_MPEG 0x1001 #define UAC_FORMAT_TYPE_II_AC3 0x1002 struct uac_format_type_ii_discrete_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __u8 bFormatType; __le16 wMaxBitRate; __le16 wSamplesPerFrame; __u8 bSamFreqType; __u8 tSamFreq[][3]; } __attribute__((packed)); struct uac_format_type_ii_ext_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __u8 bFormatType; __le16 wMaxBitRate; __le16 wSamplesPerFrame; __u8 bHeaderLength; __u8 bSideBandProtocol; } __attribute__((packed)); /* type III */ #define UAC_FORMAT_TYPE_III_IEC1937_AC3 0x2001 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1 0x2002 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT 0x2003 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT 0x2004 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS 0x2005 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS 0x2006 /* Formats - A.2 Format Type Codes */ #define UAC_FORMAT_TYPE_UNDEFINED 0x0 #define UAC_FORMAT_TYPE_I 0x1 #define UAC_FORMAT_TYPE_II 0x2 #define UAC_FORMAT_TYPE_III 0x3 #define UAC_EXT_FORMAT_TYPE_I 0x81 #define UAC_EXT_FORMAT_TYPE_II 0x82 #define UAC_EXT_FORMAT_TYPE_III 0x83 struct uac_iso_endpoint_descriptor { __u8 bLength; /* in bytes: 7 */ __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */ __u8 bDescriptorSubtype; /* EP_GENERAL */ __u8 bmAttributes; __u8 bLockDelayUnits; __le16 wLockDelay; } __attribute__((packed)); #define UAC_ISO_ENDPOINT_DESC_SIZE 7 #define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01 #define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02 #define UAC_EP_CS_ATTR_FILL_MAX 0x80 /* status word format (3.7.1.1) */ #define UAC1_STATUS_TYPE_ORIG_MASK 0x0f #define UAC1_STATUS_TYPE_ORIG_AUDIO_CONTROL_IF 0x0 #define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_IF 0x1 #define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_EP 0x2 #define UAC1_STATUS_TYPE_IRQ_PENDING (1 << 7) #define UAC1_STATUS_TYPE_MEM_CHANGED (1 << 6) struct uac1_status_word { __u8 bStatusType; __u8 bOriginator; } __attribute__((packed)); #endif /* __LINUX_USB_AUDIO_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/usb/g_uvc.h�����������������������������������������������������������������������������������0000644�����������������00000002061�14763166027�0007763 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ */ /* * g_uvc.h -- USB Video Class Gadget driver API * * Copyright (C) 2009-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> */ #ifndef __LINUX_USB_G_UVC_H #define __LINUX_USB_G_UVC_H #include <linux/ioctl.h> #include <linux/types.h> #include <linux/usb/ch9.h> #define UVC_EVENT_FIRST (V4L2_EVENT_PRIVATE_START + 0) #define UVC_EVENT_CONNECT (V4L2_EVENT_PRIVATE_START + 0) #define UVC_EVENT_DISCONNECT (V4L2_EVENT_PRIVATE_START + 1) #define UVC_EVENT_STREAMON (V4L2_EVENT_PRIVATE_START + 2) #define UVC_EVENT_STREAMOFF (V4L2_EVENT_PRIVATE_START + 3) #define UVC_EVENT_SETUP (V4L2_EVENT_PRIVATE_START + 4) #define UVC_EVENT_DATA (V4L2_EVENT_PRIVATE_START + 5) #define UVC_EVENT_LAST (V4L2_EVENT_PRIVATE_START + 5) struct uvc_request_data { __s32 length; __u8 data[60]; }; struct uvc_event { union { enum usb_device_speed speed; struct usb_ctrlrequest req; struct uvc_request_data data; }; }; #define UVCIOC_SEND_RESPONSE _IOW('U', 1, struct uvc_request_data) #endif /* __LINUX_USB_G_UVC_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/usb/charger.h���������������������������������������������������������������������������������0000644�����������������00000001126�14763166027�0010274 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file defines the USB charger type and state that are needed for * USB device APIs. */ #ifndef __LINUX_USB_CHARGER_H #define __LINUX_USB_CHARGER_H /* * USB charger type: * SDP (Standard Downstream Port) * DCP (Dedicated Charging Port) * CDP (Charging Downstream Port) * ACA (Accessory Charger Adapters) */ enum usb_charger_type { UNKNOWN_TYPE = 0, SDP_TYPE = 1, DCP_TYPE = 2, CDP_TYPE = 3, ACA_TYPE = 4, }; /* USB charger state */ enum usb_charger_state { USB_CHARGER_DEFAULT = 0, USB_CHARGER_PRESENT = 1, USB_CHARGER_ABSENT = 2, }; #endif /* __LINUX_USB_CHARGER_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/usb/cdc-wdm.h���������������������������������������������������������������������������������0000644�����������������00000001343�14763166027�0010200 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * USB CDC Device Management userspace API definitions * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. */ #ifndef __LINUX_USB_CDC_WDM_H #define __LINUX_USB_CDC_WDM_H #include <linux/types.h> /* * This IOCTL is used to retrieve the wMaxCommand for the device, * defining the message limit for both reading and writing. * * For CDC WDM functions this will be the wMaxCommand field of the * Device Management Functional Descriptor. */ #define IOCTL_WDM_MAX_COMMAND _IOR('H', 0xA0, __u16) #endif /* __LINUX_USB_CDC_WDM_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/usb/g_printer.h�������������������������������������������������������������������������������0000644�����������������00000002551�14763166027�0010655 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * g_printer.h -- Header file for USB Printer gadget driver * * Copyright (C) 2007 Craig W. Nadler * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __LINUX_USB_G_PRINTER_H #define __LINUX_USB_G_PRINTER_H #define PRINTER_NOT_ERROR 0x08 #define PRINTER_SELECTED 0x10 #define PRINTER_PAPER_EMPTY 0x20 /* The 'g' code is also used by gadgetfs ioctl requests. * Don't add any colliding codes to either driver, and keep * them in unique ranges (size 0x20 for now). */ #define GADGET_GET_PRINTER_STATUS _IOR('g', 0x21, unsigned char) #define GADGET_SET_PRINTER_STATUS _IOWR('g', 0x22, unsigned char) #endif /* __LINUX_USB_G_PRINTER_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������linux/usb/midi.h������������������������������������������������������������������������������������0000644�����������������00000006552�14763166027�0007613 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * <linux/usb/midi.h> -- USB MIDI definitions. * * Copyright (C) 2006 Thumtronics Pty Ltd. * Developed for Thumtronics by Grey Innovation * Ben Williamson <ben.williamson@greyinnovation.com> * * This software is distributed under the terms of the GNU General Public * License ("GPL") version 2, as published by the Free Software Foundation. * * This file holds USB constants and structures defined * by the USB Device Class Definition for MIDI Devices. * Comments below reference relevant sections of that document: * * http://www.usb.org/developers/devclass_docs/midi10.pdf */ #ifndef __LINUX_USB_MIDI_H #define __LINUX_USB_MIDI_H #include <linux/types.h> /* A.1 MS Class-Specific Interface Descriptor Subtypes */ #define USB_MS_HEADER 0x01 #define USB_MS_MIDI_IN_JACK 0x02 #define USB_MS_MIDI_OUT_JACK 0x03 #define USB_MS_ELEMENT 0x04 /* A.2 MS Class-Specific Endpoint Descriptor Subtypes */ #define USB_MS_GENERAL 0x01 /* A.3 MS MIDI IN and OUT Jack Types */ #define USB_MS_EMBEDDED 0x01 #define USB_MS_EXTERNAL 0x02 /* 6.1.2.1 Class-Specific MS Interface Header Descriptor */ struct usb_ms_header_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __le16 bcdMSC; __le16 wTotalLength; } __attribute__ ((packed)); #define USB_DT_MS_HEADER_SIZE 7 /* 6.1.2.2 MIDI IN Jack Descriptor */ struct usb_midi_in_jack_descriptor { __u8 bLength; __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ __u8 bDescriptorSubtype; /* USB_MS_MIDI_IN_JACK */ __u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */ __u8 bJackID; __u8 iJack; } __attribute__ ((packed)); #define USB_DT_MIDI_IN_SIZE 6 struct usb_midi_source_pin { __u8 baSourceID; __u8 baSourcePin; } __attribute__ ((packed)); /* 6.1.2.3 MIDI OUT Jack Descriptor */ struct usb_midi_out_jack_descriptor { __u8 bLength; __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ __u8 bDescriptorSubtype; /* USB_MS_MIDI_OUT_JACK */ __u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */ __u8 bJackID; __u8 bNrInputPins; /* p */ struct usb_midi_source_pin pins[]; /* [p] */ /*__u8 iJack; -- omitted due to variable-sized pins[] */ } __attribute__ ((packed)); #define USB_DT_MIDI_OUT_SIZE(p) (7 + 2 * (p)) /* As above, but more useful for defining your own descriptors: */ #define DECLARE_USB_MIDI_OUT_JACK_DESCRIPTOR(p) \ struct usb_midi_out_jack_descriptor_##p { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubtype; \ __u8 bJackType; \ __u8 bJackID; \ __u8 bNrInputPins; \ struct usb_midi_source_pin pins[p]; \ __u8 iJack; \ } __attribute__ ((packed)) /* 6.2.2 Class-Specific MS Bulk Data Endpoint Descriptor */ struct usb_ms_endpoint_descriptor { __u8 bLength; /* 4+n */ __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */ __u8 bDescriptorSubtype; /* USB_MS_GENERAL */ __u8 bNumEmbMIDIJack; /* n */ __u8 baAssocJackID[]; /* [n] */ } __attribute__ ((packed)); #define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n)) /* As above, but more useful for defining your own descriptors: */ #define DECLARE_USB_MS_ENDPOINT_DESCRIPTOR(n) \ struct usb_ms_endpoint_descriptor_##n { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubtype; \ __u8 bNumEmbMIDIJack; \ __u8 baAssocJackID[n]; \ } __attribute__ ((packed)) #endif /* __LINUX_USB_MIDI_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������linux/usb/functionfs.h������������������������������������������������������������������������������0000644�����������������00000024202�14763166027�0011037 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_FUNCTIONFS_H__ #define __LINUX_FUNCTIONFS_H__ #include <linux/types.h> #include <linux/ioctl.h> #include <linux/usb/ch9.h> enum { FUNCTIONFS_DESCRIPTORS_MAGIC = 1, FUNCTIONFS_STRINGS_MAGIC = 2, FUNCTIONFS_DESCRIPTORS_MAGIC_V2 = 3, }; enum functionfs_flags { FUNCTIONFS_HAS_FS_DESC = 1, FUNCTIONFS_HAS_HS_DESC = 2, FUNCTIONFS_HAS_SS_DESC = 4, FUNCTIONFS_HAS_MS_OS_DESC = 8, FUNCTIONFS_VIRTUAL_ADDR = 16, FUNCTIONFS_EVENTFD = 32, FUNCTIONFS_ALL_CTRL_RECIP = 64, FUNCTIONFS_CONFIG0_SETUP = 128, }; /* Descriptor of an non-audio endpoint */ struct usb_endpoint_descriptor_no_audio { __u8 bLength; __u8 bDescriptorType; __u8 bEndpointAddress; __u8 bmAttributes; __le16 wMaxPacketSize; __u8 bInterval; } __attribute__((packed)); struct usb_functionfs_descs_head_v2 { __le32 magic; __le32 length; __le32 flags; /* * __le32 fs_count, hs_count, fs_count; must be included manually in * the structure taking flags into consideration. */ } __attribute__((packed)); /* Legacy format, deprecated as of 3.14. */ struct usb_functionfs_descs_head { __le32 magic; __le32 length; __le32 fs_count; __le32 hs_count; } __attribute__((packed, deprecated)); /* MS OS Descriptor header */ struct usb_os_desc_header { __u8 interface; __le32 dwLength; __le16 bcdVersion; __le16 wIndex; union { struct { __u8 bCount; __u8 Reserved; }; __le16 wCount; }; } __attribute__((packed)); struct usb_ext_compat_desc { __u8 bFirstInterfaceNumber; __u8 Reserved1; __u8 CompatibleID[8]; __u8 SubCompatibleID[8]; __u8 Reserved2[6]; }; struct usb_ext_prop_desc { __le32 dwSize; __le32 dwPropertyDataType; __le16 wPropertyNameLength; } __attribute__((packed)); /* * Descriptors format: * * | off | name | type | description | * |-----+-----------+--------------+--------------------------------------| * | 0 | magic | LE32 | FUNCTIONFS_DESCRIPTORS_MAGIC_V2 | * | 4 | length | LE32 | length of the whole data chunk | * | 8 | flags | LE32 | combination of functionfs_flags | * | | eventfd | LE32 | eventfd file descriptor | * | | fs_count | LE32 | number of full-speed descriptors | * | | hs_count | LE32 | number of high-speed descriptors | * | | ss_count | LE32 | number of super-speed descriptors | * | | os_count | LE32 | number of MS OS descriptors | * | | fs_descrs | Descriptor[] | list of full-speed descriptors | * | | hs_descrs | Descriptor[] | list of high-speed descriptors | * | | ss_descrs | Descriptor[] | list of super-speed descriptors | * | | os_descrs | OSDesc[] | list of MS OS descriptors | * * Depending on which flags are set, various fields may be missing in the * structure. Any flags that are not recognised cause the whole block to be * rejected with -ENOSYS. * * Legacy descriptors format (deprecated as of 3.14): * * | off | name | type | description | * |-----+-----------+--------------+--------------------------------------| * | 0 | magic | LE32 | FUNCTIONFS_DESCRIPTORS_MAGIC | * | 4 | length | LE32 | length of the whole data chunk | * | 8 | fs_count | LE32 | number of full-speed descriptors | * | 12 | hs_count | LE32 | number of high-speed descriptors | * | 16 | fs_descrs | Descriptor[] | list of full-speed descriptors | * | | hs_descrs | Descriptor[] | list of high-speed descriptors | * * All numbers must be in little endian order. * * Descriptor[] is an array of valid USB descriptors which have the following * format: * * | off | name | type | description | * |-----+-----------------+------+--------------------------| * | 0 | bLength | U8 | length of the descriptor | * | 1 | bDescriptorType | U8 | descriptor type | * | 2 | payload | | descriptor's payload | * * OSDesc[] is an array of valid MS OS Feature Descriptors which have one of * the following formats: * * | off | name | type | description | * |-----+-----------------+------+--------------------------| * | 0 | inteface | U8 | related interface number | * | 1 | dwLength | U32 | length of the descriptor | * | 5 | bcdVersion | U16 | currently supported: 1 | * | 7 | wIndex | U16 | currently supported: 4 | * | 9 | bCount | U8 | number of ext. compat. | * | 10 | Reserved | U8 | 0 | * | 11 | ExtCompat[] | | list of ext. compat. d. | * * | off | name | type | description | * |-----+-----------------+------+--------------------------| * | 0 | inteface | U8 | related interface number | * | 1 | dwLength | U32 | length of the descriptor | * | 5 | bcdVersion | U16 | currently supported: 1 | * | 7 | wIndex | U16 | currently supported: 5 | * | 9 | wCount | U16 | number of ext. compat. | * | 11 | ExtProp[] | | list of ext. prop. d. | * * ExtCompat[] is an array of valid Extended Compatiblity descriptors * which have the following format: * * | off | name | type | description | * |-----+-----------------------+------+-------------------------------------| * | 0 | bFirstInterfaceNumber | U8 | index of the interface or of the 1st| * | | | | interface in an IAD group | * | 1 | Reserved | U8 | 1 | * | 2 | CompatibleID | U8[8]| compatible ID string | * | 10 | SubCompatibleID | U8[8]| subcompatible ID string | * | 18 | Reserved | U8[6]| 0 | * * ExtProp[] is an array of valid Extended Properties descriptors * which have the following format: * * | off | name | type | description | * |-----+-----------------------+------+-------------------------------------| * | 0 | dwSize | U32 | length of the descriptor | * | 4 | dwPropertyDataType | U32 | 1..7 | * | 8 | wPropertyNameLength | U16 | bPropertyName length (NL) | * | 10 | bPropertyName |U8[NL]| name of this property | * |10+NL| dwPropertyDataLength | U32 | bPropertyData length (DL) | * |14+NL| bProperty |U8[DL]| payload of this property | */ struct usb_functionfs_strings_head { __le32 magic; __le32 length; __le32 str_count; __le32 lang_count; } __attribute__((packed)); /* * Strings format: * * | off | name | type | description | * |-----+------------+-----------------------+----------------------------| * | 0 | magic | LE32 | FUNCTIONFS_STRINGS_MAGIC | * | 4 | length | LE32 | length of the data chunk | * | 8 | str_count | LE32 | number of strings | * | 12 | lang_count | LE32 | number of languages | * | 16 | stringtab | StringTab[lang_count] | table of strings per lang | * * For each language there is one stringtab entry (ie. there are lang_count * stringtab entires). Each StringTab has following format: * * | off | name | type | description | * |-----+---------+-------------------+------------------------------------| * | 0 | lang | LE16 | language code | * | 2 | strings | String[str_count] | array of strings in given language | * * For each string there is one strings entry (ie. there are str_count * string entries). Each String is a NUL terminated string encoded in * UTF-8. */ /* * Events are delivered on the ep0 file descriptor, when the user mode driver * reads from this file descriptor after writing the descriptors. Don't * stop polling this descriptor. */ enum usb_functionfs_event_type { FUNCTIONFS_BIND, FUNCTIONFS_UNBIND, FUNCTIONFS_ENABLE, FUNCTIONFS_DISABLE, FUNCTIONFS_SETUP, FUNCTIONFS_SUSPEND, FUNCTIONFS_RESUME }; /* NOTE: this structure must stay the same size and layout on * both 32-bit and 64-bit kernels. */ struct usb_functionfs_event { union { /* SETUP: packet; DATA phase i/o precedes next event *(setup.bmRequestType & USB_DIR_IN) flags direction */ struct usb_ctrlrequest setup; } __attribute__((packed)) u; /* enum usb_functionfs_event_type */ __u8 type; __u8 _pad[3]; } __attribute__((packed)); /* Endpoint ioctls */ /* The same as in gadgetfs */ /* IN transfers may be reported to the gadget driver as complete * when the fifo is loaded, before the host reads the data; * OUT transfers may be reported to the host's "client" driver as * complete when they're sitting in the FIFO unread. * THIS returns how many bytes are "unclaimed" in the endpoint fifo * (needed for precise fault handling, when the hardware allows it) */ #define FUNCTIONFS_FIFO_STATUS _IO('g', 1) /* discards any unclaimed data in the fifo. */ #define FUNCTIONFS_FIFO_FLUSH _IO('g', 2) /* resets endpoint halt+toggle; used to implement set_interface. * some hardware (like pxa2xx) can't support this. */ #define FUNCTIONFS_CLEAR_HALT _IO('g', 3) /* Specific for functionfs */ /* * Returns reverse mapping of an interface. Called on EP0. If there * is no such interface returns -EDOM. If function is not active * returns -ENODEV. */ #define FUNCTIONFS_INTERFACE_REVMAP _IO('g', 128) /* * Returns real bEndpointAddress of an endpoint. If endpoint shuts down * during the call, returns -ESHUTDOWN. */ #define FUNCTIONFS_ENDPOINT_REVMAP _IO('g', 129) /* * Returns endpoint descriptor. If endpoint shuts down during the call, * returns -ESHUTDOWN. */ #define FUNCTIONFS_ENDPOINT_DESC _IOR('g', 130, \ struct usb_endpoint_descriptor) #endif /* __LINUX_FUNCTIONFS_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/usb/gadgetfs.h��������������������������������������������������������������������������������0000644�����������������00000005402�14763166027�0010446 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Filesystem based user-mode API to USB Gadget controller hardware * * Other than ep0 operations, most things are done by read() and write() * on endpoint files found in one directory. They are configured by * writing descriptors, and then may be used for normal stream style * i/o requests. When ep0 is configured, the device can enumerate; * when it's closed, the device disconnects from usb. Operations on * ep0 require ioctl() operations. * * Configuration and device descriptors get written to /dev/gadget/$CHIP, * which may then be used to read usb_gadgetfs_event structs. The driver * may activate endpoints as it handles SET_CONFIGURATION setup events, * or earlier; writing endpoint descriptors to /dev/gadget/$ENDPOINT * then performing data transfers by reading or writing. */ #ifndef __LINUX_USB_GADGETFS_H #define __LINUX_USB_GADGETFS_H #include <linux/types.h> #include <linux/ioctl.h> #include <linux/usb/ch9.h> /* * Events are delivered on the ep0 file descriptor, when the user mode driver * reads from this file descriptor after writing the descriptors. Don't * stop polling this descriptor. */ enum usb_gadgetfs_event_type { GADGETFS_NOP = 0, GADGETFS_CONNECT, GADGETFS_DISCONNECT, GADGETFS_SETUP, GADGETFS_SUSPEND, /* and likely more ! */ }; /* NOTE: this structure must stay the same size and layout on * both 32-bit and 64-bit kernels. */ struct usb_gadgetfs_event { union { /* NOP, DISCONNECT, SUSPEND: nothing * ... some hardware can't report disconnection */ /* CONNECT: just the speed */ enum usb_device_speed speed; /* SETUP: packet; DATA phase i/o precedes next event *(setup.bmRequestType & USB_DIR_IN) flags direction * ... includes SET_CONFIGURATION, SET_INTERFACE */ struct usb_ctrlrequest setup; } u; enum usb_gadgetfs_event_type type; }; /* The 'g' code is also used by printer gadget ioctl requests. * Don't add any colliding codes to either driver, and keep * them in unique ranges (size 0x20 for now). */ /* endpoint ioctls */ /* IN transfers may be reported to the gadget driver as complete * when the fifo is loaded, before the host reads the data; * OUT transfers may be reported to the host's "client" driver as * complete when they're sitting in the FIFO unread. * THIS returns how many bytes are "unclaimed" in the endpoint fifo * (needed for precise fault handling, when the hardware allows it) */ #define GADGETFS_FIFO_STATUS _IO('g', 1) /* discards any unclaimed data in the fifo. */ #define GADGETFS_FIFO_FLUSH _IO('g', 2) /* resets endpoint halt+toggle; used to implement set_interface. * some hardware (like pxa2xx) can't support this. */ #define GADGETFS_CLEAR_HALT _IO('g', 3) #endif /* __LINUX_USB_GADGETFS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/usb/ch9.h�������������������������������������������������������������������������������������0000644�����������������00000113675�14763166027�0007361 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * This file holds USB constants and structures that are needed for * USB device APIs. These are used by the USB device model, which is * defined in chapter 9 of the USB 2.0 specification and in the * Wireless USB 1.0 (spread around). Linux has several APIs in C that * need these: * * - the master/host side Linux-USB kernel driver API; * - the "usbfs" user space API; and * - the Linux "gadget" slave/device/peripheral side driver API. * * USB 2.0 adds an additional "On The Go" (OTG) mode, which lets systems * act either as a USB master/host or as a USB slave/device. That means * the master and slave side APIs benefit from working well together. * * There's also "Wireless USB", using low power short range radios for * peripheral interconnection but otherwise building on the USB framework. * * Note all descriptors are declared '__attribute__((packed))' so that: * * [a] they never get padded, either internally (USB spec writers * probably handled that) or externally; * * [b] so that accessing bigger-than-a-bytes fields will never * generate bus errors on any platform, even when the location of * its descriptor inside a bundle isn't "naturally aligned", and * * [c] for consistency, removing all doubt even when it appears to * someone that the two other points are non-issues for that * particular descriptor type. */ #ifndef __LINUX_USB_CH9_H #define __LINUX_USB_CH9_H #include <linux/types.h> /* __u8 etc */ #include <asm/byteorder.h> /* le16_to_cpu */ /*-------------------------------------------------------------------------*/ /* CONTROL REQUEST SUPPORT */ /* * USB directions * * This bit flag is used in endpoint descriptors' bEndpointAddress field. * It's also one of three fields in control requests bRequestType. */ #define USB_DIR_OUT 0 /* to device */ #define USB_DIR_IN 0x80 /* to host */ /* * USB types, the second of three bRequestType fields */ #define USB_TYPE_MASK (0x03 << 5) #define USB_TYPE_STANDARD (0x00 << 5) #define USB_TYPE_CLASS (0x01 << 5) #define USB_TYPE_VENDOR (0x02 << 5) #define USB_TYPE_RESERVED (0x03 << 5) /* * USB recipients, the third of three bRequestType fields */ #define USB_RECIP_MASK 0x1f #define USB_RECIP_DEVICE 0x00 #define USB_RECIP_INTERFACE 0x01 #define USB_RECIP_ENDPOINT 0x02 #define USB_RECIP_OTHER 0x03 /* From Wireless USB 1.0 */ #define USB_RECIP_PORT 0x04 #define USB_RECIP_RPIPE 0x05 /* * Standard requests, for the bRequest field of a SETUP packet. * * These are qualified by the bRequestType field, so that for example * TYPE_CLASS or TYPE_VENDOR specific feature flags could be retrieved * by a GET_STATUS request. */ #define USB_REQ_GET_STATUS 0x00 #define USB_REQ_CLEAR_FEATURE 0x01 #define USB_REQ_SET_FEATURE 0x03 #define USB_REQ_SET_ADDRESS 0x05 #define USB_REQ_GET_DESCRIPTOR 0x06 #define USB_REQ_SET_DESCRIPTOR 0x07 #define USB_REQ_GET_CONFIGURATION 0x08 #define USB_REQ_SET_CONFIGURATION 0x09 #define USB_REQ_GET_INTERFACE 0x0A #define USB_REQ_SET_INTERFACE 0x0B #define USB_REQ_SYNCH_FRAME 0x0C #define USB_REQ_SET_SEL 0x30 #define USB_REQ_SET_ISOCH_DELAY 0x31 #define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */ #define USB_REQ_GET_ENCRYPTION 0x0E #define USB_REQ_RPIPE_ABORT 0x0E #define USB_REQ_SET_HANDSHAKE 0x0F #define USB_REQ_RPIPE_RESET 0x0F #define USB_REQ_GET_HANDSHAKE 0x10 #define USB_REQ_SET_CONNECTION 0x11 #define USB_REQ_SET_SECURITY_DATA 0x12 #define USB_REQ_GET_SECURITY_DATA 0x13 #define USB_REQ_SET_WUSB_DATA 0x14 #define USB_REQ_LOOPBACK_DATA_WRITE 0x15 #define USB_REQ_LOOPBACK_DATA_READ 0x16 #define USB_REQ_SET_INTERFACE_DS 0x17 /* specific requests for USB Power Delivery */ #define USB_REQ_GET_PARTNER_PDO 20 #define USB_REQ_GET_BATTERY_STATUS 21 #define USB_REQ_SET_PDO 22 #define USB_REQ_GET_VDM 23 #define USB_REQ_SEND_VDM 24 /* The Link Power Management (LPM) ECN defines USB_REQ_TEST_AND_SET command, * used by hubs to put ports into a new L1 suspend state, except that it * forgot to define its number ... */ /* * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and * are read as a bit array returned by USB_REQ_GET_STATUS. (So there * are at most sixteen features of each type.) Hubs may also support a * new USB_REQ_TEST_AND_SET_FEATURE to put ports into L1 suspend. */ #define USB_DEVICE_SELF_POWERED 0 /* (read only) */ #define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */ #define USB_DEVICE_TEST_MODE 2 /* (wired high speed only) */ #define USB_DEVICE_BATTERY 2 /* (wireless) */ #define USB_DEVICE_B_HNP_ENABLE 3 /* (otg) dev may initiate HNP */ #define USB_DEVICE_WUSB_DEVICE 3 /* (wireless)*/ #define USB_DEVICE_A_HNP_SUPPORT 4 /* (otg) RH port supports HNP */ #define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */ #define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */ /* * Test Mode Selectors * See USB 2.0 spec Table 9-7 */ #define TEST_J 1 #define TEST_K 2 #define TEST_SE0_NAK 3 #define TEST_PACKET 4 #define TEST_FORCE_EN 5 /* Status Type */ #define USB_STATUS_TYPE_STANDARD 0 #define USB_STATUS_TYPE_PTM 1 /* * New Feature Selectors as added by USB 3.0 * See USB 3.0 spec Table 9-7 */ #define USB_DEVICE_U1_ENABLE 48 /* dev may initiate U1 transition */ #define USB_DEVICE_U2_ENABLE 49 /* dev may initiate U2 transition */ #define USB_DEVICE_LTM_ENABLE 50 /* dev may send LTM */ #define USB_INTRF_FUNC_SUSPEND 0 /* function suspend */ #define USB_INTR_FUNC_SUSPEND_OPT_MASK 0xFF00 /* * Suspend Options, Table 9-8 USB 3.0 spec */ #define USB_INTRF_FUNC_SUSPEND_LP (1 << (8 + 0)) #define USB_INTRF_FUNC_SUSPEND_RW (1 << (8 + 1)) /* * Interface status, Figure 9-5 USB 3.0 spec */ #define USB_INTRF_STAT_FUNC_RW_CAP 1 #define USB_INTRF_STAT_FUNC_RW 2 #define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */ /* Bit array elements as returned by the USB_REQ_GET_STATUS request. */ #define USB_DEV_STAT_U1_ENABLED 2 /* transition into U1 state */ #define USB_DEV_STAT_U2_ENABLED 3 /* transition into U2 state */ #define USB_DEV_STAT_LTM_ENABLED 4 /* Latency tolerance messages */ /* * Feature selectors from Table 9-8 USB Power Delivery spec */ #define USB_DEVICE_BATTERY_WAKE_MASK 40 #define USB_DEVICE_OS_IS_PD_AWARE 41 #define USB_DEVICE_POLICY_MODE 42 #define USB_PORT_PR_SWAP 43 #define USB_PORT_GOTO_MIN 44 #define USB_PORT_RETURN_POWER 45 #define USB_PORT_ACCEPT_PD_REQUEST 46 #define USB_PORT_REJECT_PD_REQUEST 47 #define USB_PORT_PORT_PD_RESET 48 #define USB_PORT_C_PORT_PD_CHANGE 49 #define USB_PORT_CABLE_PD_RESET 50 #define USB_DEVICE_CHARGING_POLICY 54 /** * struct usb_ctrlrequest - SETUP data for a USB device control request * @bRequestType: matches the USB bmRequestType field * @bRequest: matches the USB bRequest field * @wValue: matches the USB wValue field (le16 byte order) * @wIndex: matches the USB wIndex field (le16 byte order) * @wLength: matches the USB wLength field (le16 byte order) * * This structure is used to send control requests to a USB device. It matches * the different fields of the USB 2.0 Spec section 9.3, table 9-2. See the * USB spec for a fuller description of the different fields, and what they are * used for. * * Note that the driver for any interface can issue control requests. * For most devices, interfaces don't coordinate with each other, so * such requests may be made at any time. */ struct usb_ctrlrequest { __u8 bRequestType; __u8 bRequest; __le16 wValue; __le16 wIndex; __le16 wLength; } __attribute__ ((packed)); /*-------------------------------------------------------------------------*/ /* * STANDARD DESCRIPTORS ... as returned by GET_DESCRIPTOR, or * (rarely) accepted by SET_DESCRIPTOR. * * Note that all multi-byte values here are encoded in little endian * byte order "on the wire". Within the kernel and when exposed * through the Linux-USB APIs, they are not converted to cpu byte * order; it is the responsibility of the client code to do this. * The single exception is when device and configuration descriptors (but * not other descriptors) are read from character devices * (i.e. /dev/bus/usb/BBB/DDD); * in this case the fields are converted to host endianness by the kernel. */ /* * Descriptor types ... USB 2.0 spec table 9.5 */ #define USB_DT_DEVICE 0x01 #define USB_DT_CONFIG 0x02 #define USB_DT_STRING 0x03 #define USB_DT_INTERFACE 0x04 #define USB_DT_ENDPOINT 0x05 #define USB_DT_DEVICE_QUALIFIER 0x06 #define USB_DT_OTHER_SPEED_CONFIG 0x07 #define USB_DT_INTERFACE_POWER 0x08 /* these are from a minor usb 2.0 revision (ECN) */ #define USB_DT_OTG 0x09 #define USB_DT_DEBUG 0x0a #define USB_DT_INTERFACE_ASSOCIATION 0x0b /* these are from the Wireless USB spec */ #define USB_DT_SECURITY 0x0c #define USB_DT_KEY 0x0d #define USB_DT_ENCRYPTION_TYPE 0x0e #define USB_DT_BOS 0x0f #define USB_DT_DEVICE_CAPABILITY 0x10 #define USB_DT_WIRELESS_ENDPOINT_COMP 0x11 #define USB_DT_WIRE_ADAPTER 0x21 #define USB_DT_RPIPE 0x22 #define USB_DT_CS_RADIO_CONTROL 0x23 /* From the T10 UAS specification */ #define USB_DT_PIPE_USAGE 0x24 /* From the USB 3.0 spec */ #define USB_DT_SS_ENDPOINT_COMP 0x30 /* From the USB 3.1 spec */ #define USB_DT_SSP_ISOC_ENDPOINT_COMP 0x31 /* Conventional codes for class-specific descriptors. The convention is * defined in the USB "Common Class" Spec (3.11). Individual class specs * are authoritative for their usage, not the "common class" writeup. */ #define USB_DT_CS_DEVICE (USB_TYPE_CLASS | USB_DT_DEVICE) #define USB_DT_CS_CONFIG (USB_TYPE_CLASS | USB_DT_CONFIG) #define USB_DT_CS_STRING (USB_TYPE_CLASS | USB_DT_STRING) #define USB_DT_CS_INTERFACE (USB_TYPE_CLASS | USB_DT_INTERFACE) #define USB_DT_CS_ENDPOINT (USB_TYPE_CLASS | USB_DT_ENDPOINT) /* All standard descriptors have these 2 fields at the beginning */ struct usb_descriptor_header { __u8 bLength; __u8 bDescriptorType; } __attribute__ ((packed)); /*-------------------------------------------------------------------------*/ /* USB_DT_DEVICE: Device descriptor */ struct usb_device_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 bcdUSB; __u8 bDeviceClass; __u8 bDeviceSubClass; __u8 bDeviceProtocol; __u8 bMaxPacketSize0; __le16 idVendor; __le16 idProduct; __le16 bcdDevice; __u8 iManufacturer; __u8 iProduct; __u8 iSerialNumber; __u8 bNumConfigurations; } __attribute__ ((packed)); #define USB_DT_DEVICE_SIZE 18 /* * Device and/or Interface Class codes * as found in bDeviceClass or bInterfaceClass * and defined by www.usb.org documents */ #define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */ #define USB_CLASS_AUDIO 1 #define USB_CLASS_COMM 2 #define USB_CLASS_HID 3 #define USB_CLASS_PHYSICAL 5 #define USB_CLASS_STILL_IMAGE 6 #define USB_CLASS_PRINTER 7 #define USB_CLASS_MASS_STORAGE 8 #define USB_CLASS_HUB 9 #define USB_CLASS_CDC_DATA 0x0a #define USB_CLASS_CSCID 0x0b /* chip+ smart card */ #define USB_CLASS_CONTENT_SEC 0x0d /* content security */ #define USB_CLASS_VIDEO 0x0e #define USB_CLASS_WIRELESS_CONTROLLER 0xe0 #define USB_CLASS_MISC 0xef #define USB_CLASS_APP_SPEC 0xfe #define USB_CLASS_VENDOR_SPEC 0xff #define USB_SUBCLASS_VENDOR_SPEC 0xff /*-------------------------------------------------------------------------*/ /* USB_DT_CONFIG: Configuration descriptor information. * * USB_DT_OTHER_SPEED_CONFIG is the same descriptor, except that the * descriptor type is different. Highspeed-capable devices can look * different depending on what speed they're currently running. Only * devices with a USB_DT_DEVICE_QUALIFIER have any OTHER_SPEED_CONFIG * descriptors. */ struct usb_config_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wTotalLength; __u8 bNumInterfaces; __u8 bConfigurationValue; __u8 iConfiguration; __u8 bmAttributes; __u8 bMaxPower; } __attribute__ ((packed)); #define USB_DT_CONFIG_SIZE 9 /* from config descriptor bmAttributes */ #define USB_CONFIG_ATT_ONE (1 << 7) /* must be set */ #define USB_CONFIG_ATT_SELFPOWER (1 << 6) /* self powered */ #define USB_CONFIG_ATT_WAKEUP (1 << 5) /* can wakeup */ #define USB_CONFIG_ATT_BATTERY (1 << 4) /* battery powered */ /*-------------------------------------------------------------------------*/ /* USB String descriptors can contain at most 126 characters. */ #define USB_MAX_STRING_LEN 126 /* USB_DT_STRING: String descriptor */ struct usb_string_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wData[1]; /* UTF-16LE encoded */ } __attribute__ ((packed)); /* note that "string" zero is special, it holds language codes that * the device supports, not Unicode characters. */ /*-------------------------------------------------------------------------*/ /* USB_DT_INTERFACE: Interface descriptor */ struct usb_interface_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bInterfaceNumber; __u8 bAlternateSetting; __u8 bNumEndpoints; __u8 bInterfaceClass; __u8 bInterfaceSubClass; __u8 bInterfaceProtocol; __u8 iInterface; } __attribute__ ((packed)); #define USB_DT_INTERFACE_SIZE 9 /*-------------------------------------------------------------------------*/ /* USB_DT_ENDPOINT: Endpoint descriptor */ struct usb_endpoint_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bEndpointAddress; __u8 bmAttributes; __le16 wMaxPacketSize; __u8 bInterval; /* NOTE: these two are _only_ in audio endpoints. */ /* use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. */ __u8 bRefresh; __u8 bSynchAddress; } __attribute__ ((packed)); #define USB_DT_ENDPOINT_SIZE 7 #define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */ /* * Endpoints */ #define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */ #define USB_ENDPOINT_DIR_MASK 0x80 #define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */ #define USB_ENDPOINT_XFER_CONTROL 0 #define USB_ENDPOINT_XFER_ISOC 1 #define USB_ENDPOINT_XFER_BULK 2 #define USB_ENDPOINT_XFER_INT 3 #define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 #define USB_ENDPOINT_MAXP_MASK 0x07ff #define USB_EP_MAXP_MULT_SHIFT 11 #define USB_EP_MAXP_MULT_MASK (3 << USB_EP_MAXP_MULT_SHIFT) #define USB_EP_MAXP_MULT(m) \ (((m) & USB_EP_MAXP_MULT_MASK) >> USB_EP_MAXP_MULT_SHIFT) /* The USB 3.0 spec redefines bits 5:4 of bmAttributes as interrupt ep type. */ #define USB_ENDPOINT_INTRTYPE 0x30 #define USB_ENDPOINT_INTR_PERIODIC (0 << 4) #define USB_ENDPOINT_INTR_NOTIFICATION (1 << 4) #define USB_ENDPOINT_SYNCTYPE 0x0c #define USB_ENDPOINT_SYNC_NONE (0 << 2) #define USB_ENDPOINT_SYNC_ASYNC (1 << 2) #define USB_ENDPOINT_SYNC_ADAPTIVE (2 << 2) #define USB_ENDPOINT_SYNC_SYNC (3 << 2) #define USB_ENDPOINT_USAGE_MASK 0x30 #define USB_ENDPOINT_USAGE_DATA 0x00 #define USB_ENDPOINT_USAGE_FEEDBACK 0x10 #define USB_ENDPOINT_USAGE_IMPLICIT_FB 0x20 /* Implicit feedback Data endpoint */ /*-------------------------------------------------------------------------*/ /** * usb_endpoint_num - get the endpoint's number * @epd: endpoint to be checked * * Returns @epd's number: 0 to 15. */ static __inline__ int usb_endpoint_num(const struct usb_endpoint_descriptor *epd) { return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; } /** * usb_endpoint_type - get the endpoint's transfer type * @epd: endpoint to be checked * * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according * to @epd's transfer type. */ static __inline__ int usb_endpoint_type(const struct usb_endpoint_descriptor *epd) { return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; } /** * usb_endpoint_dir_in - check if the endpoint has IN direction * @epd: endpoint to be checked * * Returns true if the endpoint is of type IN, otherwise it returns false. */ static __inline__ int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd) { return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN); } /** * usb_endpoint_dir_out - check if the endpoint has OUT direction * @epd: endpoint to be checked * * Returns true if the endpoint is of type OUT, otherwise it returns false. */ static __inline__ int usb_endpoint_dir_out( const struct usb_endpoint_descriptor *epd) { return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT); } /** * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type * @epd: endpoint to be checked * * Returns true if the endpoint is of type bulk, otherwise it returns false. */ static __inline__ int usb_endpoint_xfer_bulk( const struct usb_endpoint_descriptor *epd) { return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK); } /** * usb_endpoint_xfer_control - check if the endpoint has control transfer type * @epd: endpoint to be checked * * Returns true if the endpoint is of type control, otherwise it returns false. */ static __inline__ int usb_endpoint_xfer_control( const struct usb_endpoint_descriptor *epd) { return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_CONTROL); } /** * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type * @epd: endpoint to be checked * * Returns true if the endpoint is of type interrupt, otherwise it returns * false. */ static __inline__ int usb_endpoint_xfer_int( const struct usb_endpoint_descriptor *epd) { return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT); } /** * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type * @epd: endpoint to be checked * * Returns true if the endpoint is of type isochronous, otherwise it returns * false. */ static __inline__ int usb_endpoint_xfer_isoc( const struct usb_endpoint_descriptor *epd) { return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_ISOC); } /** * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN * @epd: endpoint to be checked * * Returns true if the endpoint has bulk transfer type and IN direction, * otherwise it returns false. */ static __inline__ int usb_endpoint_is_bulk_in( const struct usb_endpoint_descriptor *epd) { return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd); } /** * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT * @epd: endpoint to be checked * * Returns true if the endpoint has bulk transfer type and OUT direction, * otherwise it returns false. */ static __inline__ int usb_endpoint_is_bulk_out( const struct usb_endpoint_descriptor *epd) { return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd); } /** * usb_endpoint_is_int_in - check if the endpoint is interrupt IN * @epd: endpoint to be checked * * Returns true if the endpoint has interrupt transfer type and IN direction, * otherwise it returns false. */ static __inline__ int usb_endpoint_is_int_in( const struct usb_endpoint_descriptor *epd) { return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd); } /** * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT * @epd: endpoint to be checked * * Returns true if the endpoint has interrupt transfer type and OUT direction, * otherwise it returns false. */ static __inline__ int usb_endpoint_is_int_out( const struct usb_endpoint_descriptor *epd) { return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd); } /** * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN * @epd: endpoint to be checked * * Returns true if the endpoint has isochronous transfer type and IN direction, * otherwise it returns false. */ static __inline__ int usb_endpoint_is_isoc_in( const struct usb_endpoint_descriptor *epd) { return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd); } /** * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT * @epd: endpoint to be checked * * Returns true if the endpoint has isochronous transfer type and OUT direction, * otherwise it returns false. */ static __inline__ int usb_endpoint_is_isoc_out( const struct usb_endpoint_descriptor *epd) { return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd); } /** * usb_endpoint_maxp - get endpoint's max packet size * @epd: endpoint to be checked * * Returns @epd's max packet bits [10:0] */ static __inline__ int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd) { return __le16_to_cpu(epd->wMaxPacketSize) & USB_ENDPOINT_MAXP_MASK; } /** * usb_endpoint_maxp_mult - get endpoint's transactional opportunities * @epd: endpoint to be checked * * Return @epd's wMaxPacketSize[12:11] + 1 */ static __inline__ int usb_endpoint_maxp_mult(const struct usb_endpoint_descriptor *epd) { int maxp = __le16_to_cpu(epd->wMaxPacketSize); return USB_EP_MAXP_MULT(maxp) + 1; } static __inline__ int usb_endpoint_interrupt_type( const struct usb_endpoint_descriptor *epd) { return epd->bmAttributes & USB_ENDPOINT_INTRTYPE; } /*-------------------------------------------------------------------------*/ /* USB_DT_SSP_ISOC_ENDPOINT_COMP: SuperSpeedPlus Isochronous Endpoint Companion * descriptor */ struct usb_ssp_isoc_ep_comp_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wReseved; __le32 dwBytesPerInterval; } __attribute__ ((packed)); #define USB_DT_SSP_ISOC_EP_COMP_SIZE 8 /*-------------------------------------------------------------------------*/ /* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */ struct usb_ss_ep_comp_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bMaxBurst; __u8 bmAttributes; __le16 wBytesPerInterval; } __attribute__ ((packed)); #define USB_DT_SS_EP_COMP_SIZE 6 /* Bits 4:0 of bmAttributes if this is a bulk endpoint */ static __inline__ int usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp) { int max_streams; if (!comp) return 0; max_streams = comp->bmAttributes & 0x1f; if (!max_streams) return 0; max_streams = 1 << max_streams; return max_streams; } /* Bits 1:0 of bmAttributes if this is an isoc endpoint */ #define USB_SS_MULT(p) (1 + ((p) & 0x3)) /* Bit 7 of bmAttributes if a SSP isoc endpoint companion descriptor exists */ #define USB_SS_SSP_ISOC_COMP(p) ((p) & (1 << 7)) /*-------------------------------------------------------------------------*/ /* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */ struct usb_qualifier_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 bcdUSB; __u8 bDeviceClass; __u8 bDeviceSubClass; __u8 bDeviceProtocol; __u8 bMaxPacketSize0; __u8 bNumConfigurations; __u8 bRESERVED; } __attribute__ ((packed)); /*-------------------------------------------------------------------------*/ /* USB_DT_OTG (from OTG 1.0a supplement) */ struct usb_otg_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bmAttributes; /* support for HNP, SRP, etc */ } __attribute__ ((packed)); /* USB_DT_OTG (from OTG 2.0 supplement) */ struct usb_otg20_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bmAttributes; /* support for HNP, SRP and ADP, etc */ __le16 bcdOTG; /* OTG and EH supplement release number * in binary-coded decimal(i.e. 2.0 is 0200H) */ } __attribute__ ((packed)); /* from usb_otg_descriptor.bmAttributes */ #define USB_OTG_SRP (1 << 0) #define USB_OTG_HNP (1 << 1) /* swap host/device roles */ #define USB_OTG_ADP (1 << 2) /* support ADP */ #define OTG_STS_SELECTOR 0xF000 /* OTG status selector */ /*-------------------------------------------------------------------------*/ /* USB_DT_DEBUG: for special highspeed devices, replacing serial console */ struct usb_debug_descriptor { __u8 bLength; __u8 bDescriptorType; /* bulk endpoints with 8 byte maxpacket */ __u8 bDebugInEndpoint; __u8 bDebugOutEndpoint; } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB_DT_INTERFACE_ASSOCIATION: groups interfaces */ struct usb_interface_assoc_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bFirstInterface; __u8 bInterfaceCount; __u8 bFunctionClass; __u8 bFunctionSubClass; __u8 bFunctionProtocol; __u8 iFunction; } __attribute__ ((packed)); #define USB_DT_INTERFACE_ASSOCIATION_SIZE 8 /*-------------------------------------------------------------------------*/ /* USB_DT_SECURITY: group of wireless security descriptors, including * encryption types available for setting up a CC/association. */ struct usb_security_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wTotalLength; __u8 bNumEncryptionTypes; } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB_DT_KEY: used with {GET,SET}_SECURITY_DATA; only public keys * may be retrieved. */ struct usb_key_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 tTKID[3]; __u8 bReserved; __u8 bKeyData[0]; } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB_DT_ENCRYPTION_TYPE: bundled in DT_SECURITY groups */ struct usb_encryption_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bEncryptionType; #define USB_ENC_TYPE_UNSECURE 0 #define USB_ENC_TYPE_WIRED 1 /* non-wireless mode */ #define USB_ENC_TYPE_CCM_1 2 /* aes128/cbc session */ #define USB_ENC_TYPE_RSA_1 3 /* rsa3072/sha1 auth */ __u8 bEncryptionValue; /* use in SET_ENCRYPTION */ __u8 bAuthKeyIndex; } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB_DT_BOS: group of device-level capabilities */ struct usb_bos_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wTotalLength; __u8 bNumDeviceCaps; } __attribute__((packed)); #define USB_DT_BOS_SIZE 5 /*-------------------------------------------------------------------------*/ /* USB_DT_DEVICE_CAPABILITY: grouped with BOS */ struct usb_dev_cap_header { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; } __attribute__((packed)); #define USB_CAP_TYPE_WIRELESS_USB 1 struct usb_wireless_cap_descriptor { /* Ultra Wide Band */ __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __u8 bmAttributes; #define USB_WIRELESS_P2P_DRD (1 << 1) #define USB_WIRELESS_BEACON_MASK (3 << 2) #define USB_WIRELESS_BEACON_SELF (1 << 2) #define USB_WIRELESS_BEACON_DIRECTED (2 << 2) #define USB_WIRELESS_BEACON_NONE (3 << 2) __le16 wPHYRates; /* bit rates, Mbps */ #define USB_WIRELESS_PHY_53 (1 << 0) /* always set */ #define USB_WIRELESS_PHY_80 (1 << 1) #define USB_WIRELESS_PHY_107 (1 << 2) /* always set */ #define USB_WIRELESS_PHY_160 (1 << 3) #define USB_WIRELESS_PHY_200 (1 << 4) /* always set */ #define USB_WIRELESS_PHY_320 (1 << 5) #define USB_WIRELESS_PHY_400 (1 << 6) #define USB_WIRELESS_PHY_480 (1 << 7) __u8 bmTFITXPowerInfo; /* TFI power levels */ __u8 bmFFITXPowerInfo; /* FFI power levels */ __le16 bmBandGroup; __u8 bReserved; } __attribute__((packed)); #define USB_DT_USB_WIRELESS_CAP_SIZE 11 /* USB 2.0 Extension descriptor */ #define USB_CAP_TYPE_EXT 2 struct usb_ext_cap_descriptor { /* Link Power Management */ __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __le32 bmAttributes; #define USB_LPM_SUPPORT (1 << 1) /* supports LPM */ #define USB_BESL_SUPPORT (1 << 2) /* supports BESL */ #define USB_BESL_BASELINE_VALID (1 << 3) /* Baseline BESL valid*/ #define USB_BESL_DEEP_VALID (1 << 4) /* Deep BESL valid */ #define USB_GET_BESL_BASELINE(p) (((p) & (0xf << 8)) >> 8) #define USB_GET_BESL_DEEP(p) (((p) & (0xf << 12)) >> 12) } __attribute__((packed)); #define USB_DT_USB_EXT_CAP_SIZE 7 /* * SuperSpeed USB Capability descriptor: Defines the set of SuperSpeed USB * specific device level capabilities */ #define USB_SS_CAP_TYPE 3 struct usb_ss_cap_descriptor { /* Link Power Management */ __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __u8 bmAttributes; #define USB_LTM_SUPPORT (1 << 1) /* supports LTM */ __le16 wSpeedSupported; #define USB_LOW_SPEED_OPERATION (1) /* Low speed operation */ #define USB_FULL_SPEED_OPERATION (1 << 1) /* Full speed operation */ #define USB_HIGH_SPEED_OPERATION (1 << 2) /* High speed operation */ #define USB_5GBPS_OPERATION (1 << 3) /* Operation at 5Gbps */ __u8 bFunctionalitySupport; __u8 bU1devExitLat; __le16 bU2DevExitLat; } __attribute__((packed)); #define USB_DT_USB_SS_CAP_SIZE 10 /* * Container ID Capability descriptor: Defines the instance unique ID used to * identify the instance across all operating modes */ #define CONTAINER_ID_TYPE 4 struct usb_ss_container_id_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __u8 bReserved; __u8 ContainerID[16]; /* 128-bit number */ } __attribute__((packed)); #define USB_DT_USB_SS_CONTN_ID_SIZE 20 /* * SuperSpeed Plus USB Capability descriptor: Defines the set of * SuperSpeed Plus USB specific device level capabilities */ #define USB_SSP_CAP_TYPE 0xa struct usb_ssp_cap_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __u8 bReserved; __le32 bmAttributes; #define USB_SSP_SUBLINK_SPEED_ATTRIBS (0x1f << 0) /* sublink speed entries */ #define USB_SSP_SUBLINK_SPEED_IDS (0xf << 5) /* speed ID entries */ __le16 wFunctionalitySupport; #define USB_SSP_MIN_SUBLINK_SPEED_ATTRIBUTE_ID (0xf) #define USB_SSP_MIN_RX_LANE_COUNT (0xf << 8) #define USB_SSP_MIN_TX_LANE_COUNT (0xf << 12) __le16 wReserved; __le32 bmSublinkSpeedAttr[1]; /* list of sublink speed attrib entries */ #define USB_SSP_SUBLINK_SPEED_SSID (0xf) /* sublink speed ID */ #define USB_SSP_SUBLINK_SPEED_LSE (0x3 << 4) /* Lanespeed exponent */ #define USB_SSP_SUBLINK_SPEED_ST (0x3 << 6) /* Sublink type */ #define USB_SSP_SUBLINK_SPEED_RSVD (0x3f << 8) /* Reserved */ #define USB_SSP_SUBLINK_SPEED_LP (0x3 << 14) /* Link protocol */ #define USB_SSP_SUBLINK_SPEED_LSM (0xff << 16) /* Lanespeed mantissa */ } __attribute__((packed)); /* * USB Power Delivery Capability Descriptor: * Defines capabilities for PD */ /* Defines the various PD Capabilities of this device */ #define USB_PD_POWER_DELIVERY_CAPABILITY 0x06 /* Provides information on each battery supported by the device */ #define USB_PD_BATTERY_INFO_CAPABILITY 0x07 /* The Consumer characteristics of a Port on the device */ #define USB_PD_PD_CONSUMER_PORT_CAPABILITY 0x08 /* The provider characteristics of a Port on the device */ #define USB_PD_PD_PROVIDER_PORT_CAPABILITY 0x09 struct usb_pd_cap_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; /* set to USB_PD_POWER_DELIVERY_CAPABILITY */ __u8 bReserved; __le32 bmAttributes; #define USB_PD_CAP_BATTERY_CHARGING (1 << 1) /* supports Battery Charging specification */ #define USB_PD_CAP_USB_PD (1 << 2) /* supports USB Power Delivery specification */ #define USB_PD_CAP_PROVIDER (1 << 3) /* can provide power */ #define USB_PD_CAP_CONSUMER (1 << 4) /* can consume power */ #define USB_PD_CAP_CHARGING_POLICY (1 << 5) /* supports CHARGING_POLICY feature */ #define USB_PD_CAP_TYPE_C_CURRENT (1 << 6) /* supports power capabilities defined in the USB Type-C Specification */ #define USB_PD_CAP_PWR_AC (1 << 8) #define USB_PD_CAP_PWR_BAT (1 << 9) #define USB_PD_CAP_PWR_USE_V_BUS (1 << 14) __le16 bmProviderPorts; /* Bit zero refers to the UFP of the device */ __le16 bmConsumerPorts; __le16 bcdBCVersion; __le16 bcdPDVersion; __le16 bcdUSBTypeCVersion; } __attribute__((packed)); struct usb_pd_cap_battery_info_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; /* Index of string descriptor shall contain the user friendly name for this battery */ __u8 iBattery; /* Index of string descriptor shall contain the Serial Number String for this battery */ __u8 iSerial; __u8 iManufacturer; __u8 bBatteryId; /* uniquely identifies this battery in status Messages */ __u8 bReserved; /* * Shall contain the Battery Charge value above which this * battery is considered to be fully charged but not necessarily * “topped off.” */ __le32 dwChargedThreshold; /* in mWh */ /* * Shall contain the minimum charge level of this battery such * that above this threshold, a device can be assured of being * able to power up successfully (see Battery Charging 1.2). */ __le32 dwWeakThreshold; /* in mWh */ __le32 dwBatteryDesignCapacity; /* in mWh */ __le32 dwBatteryLastFullchargeCapacity; /* in mWh */ } __attribute__((packed)); struct usb_pd_cap_consumer_port_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __u8 bReserved; __u8 bmCapabilities; /* port will oerate under: */ #define USB_PD_CAP_CONSUMER_BC (1 << 0) /* BC */ #define USB_PD_CAP_CONSUMER_PD (1 << 1) /* PD */ #define USB_PD_CAP_CONSUMER_TYPE_C (1 << 2) /* USB Type-C Current */ __le16 wMinVoltage; /* in 50mV units */ __le16 wMaxVoltage; /* in 50mV units */ __u16 wReserved; __le32 dwMaxOperatingPower; /* in 10 mW - operating at steady state */ __le32 dwMaxPeakPower; /* in 10mW units - operating at peak power */ __le32 dwMaxPeakPowerTime; /* in 100ms units - duration of peak */ #define USB_PD_CAP_CONSUMER_UNKNOWN_PEAK_POWER_TIME 0xffff } __attribute__((packed)); struct usb_pd_cap_provider_port_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __u8 bReserved1; __u8 bmCapabilities; /* port will oerate under: */ #define USB_PD_CAP_PROVIDER_BC (1 << 0) /* BC */ #define USB_PD_CAP_PROVIDER_PD (1 << 1) /* PD */ #define USB_PD_CAP_PROVIDER_TYPE_C (1 << 2) /* USB Type-C Current */ __u8 bNumOfPDObjects; __u8 bReserved2; __le32 wPowerDataObject[]; } __attribute__((packed)); /* * Precision time measurement capability descriptor: advertised by devices and * hubs that support PTM */ #define USB_PTM_CAP_TYPE 0xb struct usb_ptm_cap_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; } __attribute__((packed)); #define USB_DT_USB_PTM_ID_SIZE 3 /* * The size of the descriptor for the Sublink Speed Attribute Count * (SSAC) specified in bmAttributes[4:0]. SSAC is zero-based */ #define USB_DT_USB_SSP_CAP_SIZE(ssac) (12 + (ssac + 1) * 4) /*-------------------------------------------------------------------------*/ /* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with * each endpoint descriptor for a wireless device */ struct usb_wireless_ep_comp_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bMaxBurst; __u8 bMaxSequence; __le16 wMaxStreamDelay; __le16 wOverTheAirPacketSize; __u8 bOverTheAirInterval; __u8 bmCompAttributes; #define USB_ENDPOINT_SWITCH_MASK 0x03 /* in bmCompAttributes */ #define USB_ENDPOINT_SWITCH_NO 0 #define USB_ENDPOINT_SWITCH_SWITCH 1 #define USB_ENDPOINT_SWITCH_SCALE 2 } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB_REQ_SET_HANDSHAKE is a four-way handshake used between a wireless * host and a device for connection set up, mutual authentication, and * exchanging short lived session keys. The handshake depends on a CC. */ struct usb_handshake { __u8 bMessageNumber; __u8 bStatus; __u8 tTKID[3]; __u8 bReserved; __u8 CDID[16]; __u8 nonce[16]; __u8 MIC[8]; } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB_REQ_SET_CONNECTION modifies or revokes a connection context (CC). * A CC may also be set up using non-wireless secure channels (including * wired USB!), and some devices may support CCs with multiple hosts. */ struct usb_connection_context { __u8 CHID[16]; /* persistent host id */ __u8 CDID[16]; /* device id (unique w/in host context) */ __u8 CK[16]; /* connection key */ } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB 2.0 defines three speeds, here's how Linux identifies them */ enum usb_device_speed { USB_SPEED_UNKNOWN = 0, /* enumerating */ USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ USB_SPEED_HIGH, /* usb 2.0 */ USB_SPEED_WIRELESS, /* wireless (usb 2.5) */ USB_SPEED_SUPER, /* usb 3.0 */ USB_SPEED_SUPER_PLUS, /* usb 3.1 */ }; enum usb_device_state { /* NOTATTACHED isn't in the USB spec, and this state acts * the same as ATTACHED ... but it's clearer this way. */ USB_STATE_NOTATTACHED = 0, /* chapter 9 and authentication (wireless) device states */ USB_STATE_ATTACHED, USB_STATE_POWERED, /* wired */ USB_STATE_RECONNECTING, /* auth */ USB_STATE_UNAUTHENTICATED, /* auth */ USB_STATE_DEFAULT, /* limited function */ USB_STATE_ADDRESS, USB_STATE_CONFIGURED, /* most functions */ USB_STATE_SUSPENDED /* NOTE: there are actually four different SUSPENDED * states, returning to POWERED, DEFAULT, ADDRESS, or * CONFIGURED respectively when SOF tokens flow again. * At this level there's no difference between L1 and L2 * suspend states. (L2 being original USB 1.1 suspend.) */ }; enum usb3_link_state { USB3_LPM_U0 = 0, USB3_LPM_U1, USB3_LPM_U2, USB3_LPM_U3 }; /* * A U1 timeout of 0x0 means the parent hub will reject any transitions to U1. * 0xff means the parent hub will accept transitions to U1, but will not * initiate a transition. * * A U1 timeout of 0x1 to 0x7F also causes the hub to initiate a transition to * U1 after that many microseconds. Timeouts of 0x80 to 0xFE are reserved * values. * * A U2 timeout of 0x0 means the parent hub will reject any transitions to U2. * 0xff means the parent hub will accept transitions to U2, but will not * initiate a transition. * * A U2 timeout of 0x1 to 0xFE also causes the hub to initiate a transition to * U2 after N*256 microseconds. Therefore a U2 timeout value of 0x1 means a U2 * idle timer of 256 microseconds, 0x2 means 512 microseconds, 0xFE means * 65.024ms. */ #define USB3_LPM_DISABLED 0x0 #define USB3_LPM_U1_MAX_TIMEOUT 0x7F #define USB3_LPM_U2_MAX_TIMEOUT 0xFE #define USB3_LPM_DEVICE_INITIATED 0xFF struct usb_set_sel_req { __u8 u1_sel; __u8 u1_pel; __le16 u2_sel; __le16 u2_pel; } __attribute__ ((packed)); /* * The Set System Exit Latency control transfer provides one byte each for * U1 SEL and U1 PEL, so the max exit latency is 0xFF. U2 SEL and U2 PEL each * are two bytes long. */ #define USB3_LPM_MAX_U1_SEL_PEL 0xFF #define USB3_LPM_MAX_U2_SEL_PEL 0xFFFF /*-------------------------------------------------------------------------*/ /* * As per USB compliance update, a device that is actively drawing * more than 100mA from USB must report itself as bus-powered in * the GetStatus(DEVICE) call. * http://compliance.usb.org/index.asp?UpdateFile=Electrical&Format=Standard#34 */ #define USB_SELF_POWER_VBUS_MAX_DRAW 100 #endif /* __LINUX_USB_CH9_H */ �������������������������������������������������������������������linux/usb/tmc.h�������������������������������������������������������������������������������������0000644�����������������00000006277�14763166027�0007460 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2007 Stefan Kopp, Gechingen, Germany * Copyright (C) 2008 Novell, Inc. * Copyright (C) 2008 Greg Kroah-Hartman <gregkh@suse.de> * Copyright (C) 2015 Dave Penkler <dpenkler@gmail.com> * * This file holds USB constants defined by the USB Device Class * and USB488 Subclass Definitions for Test and Measurement devices * published by the USB-IF. * * It also has the ioctl and capability definitions for the * usbtmc kernel driver that userspace needs to know about. */ #ifndef __LINUX_USB_TMC_H #define __LINUX_USB_TMC_H #include <linux/types.h> /* __u8 etc */ /* USB TMC status values */ #define USBTMC_STATUS_SUCCESS 0x01 #define USBTMC_STATUS_PENDING 0x02 #define USBTMC_STATUS_FAILED 0x80 #define USBTMC_STATUS_TRANSFER_NOT_IN_PROGRESS 0x81 #define USBTMC_STATUS_SPLIT_NOT_IN_PROGRESS 0x82 #define USBTMC_STATUS_SPLIT_IN_PROGRESS 0x83 /* USB TMC requests values */ #define USBTMC_REQUEST_INITIATE_ABORT_BULK_OUT 1 #define USBTMC_REQUEST_CHECK_ABORT_BULK_OUT_STATUS 2 #define USBTMC_REQUEST_INITIATE_ABORT_BULK_IN 3 #define USBTMC_REQUEST_CHECK_ABORT_BULK_IN_STATUS 4 #define USBTMC_REQUEST_INITIATE_CLEAR 5 #define USBTMC_REQUEST_CHECK_CLEAR_STATUS 6 #define USBTMC_REQUEST_GET_CAPABILITIES 7 #define USBTMC_REQUEST_INDICATOR_PULSE 64 #define USBTMC488_REQUEST_READ_STATUS_BYTE 128 #define USBTMC488_REQUEST_REN_CONTROL 160 #define USBTMC488_REQUEST_GOTO_LOCAL 161 #define USBTMC488_REQUEST_LOCAL_LOCKOUT 162 struct usbtmc_termchar { __u8 term_char; __u8 term_char_enabled; } __attribute__ ((packed)); /* Request values for USBTMC driver's ioctl entry point */ #define USBTMC_IOC_NR 91 #define USBTMC_IOCTL_INDICATOR_PULSE _IO(USBTMC_IOC_NR, 1) #define USBTMC_IOCTL_CLEAR _IO(USBTMC_IOC_NR, 2) #define USBTMC_IOCTL_ABORT_BULK_OUT _IO(USBTMC_IOC_NR, 3) #define USBTMC_IOCTL_ABORT_BULK_IN _IO(USBTMC_IOC_NR, 4) #define USBTMC_IOCTL_CLEAR_OUT_HALT _IO(USBTMC_IOC_NR, 6) #define USBTMC_IOCTL_CLEAR_IN_HALT _IO(USBTMC_IOC_NR, 7) #define USBTMC_IOCTL_GET_TIMEOUT _IOR(USBTMC_IOC_NR, 9, __u32) #define USBTMC_IOCTL_SET_TIMEOUT _IOW(USBTMC_IOC_NR, 10, __u32) #define USBTMC_IOCTL_EOM_ENABLE _IOW(USBTMC_IOC_NR, 11, __u8) #define USBTMC_IOCTL_CONFIG_TERMCHAR _IOW(USBTMC_IOC_NR, 12, struct usbtmc_termchar) #define USBTMC488_IOCTL_GET_CAPS _IOR(USBTMC_IOC_NR, 17, unsigned char) #define USBTMC488_IOCTL_READ_STB _IOR(USBTMC_IOC_NR, 18, unsigned char) #define USBTMC488_IOCTL_REN_CONTROL _IOW(USBTMC_IOC_NR, 19, unsigned char) #define USBTMC488_IOCTL_GOTO_LOCAL _IO(USBTMC_IOC_NR, 20) #define USBTMC488_IOCTL_LOCAL_LOCKOUT _IO(USBTMC_IOC_NR, 21) #define USBTMC488_IOCTL_TRIGGER _IO(USBTMC_IOC_NR, 22) /* Driver encoded usb488 capabilities */ #define USBTMC488_CAPABILITY_TRIGGER 1 #define USBTMC488_CAPABILITY_SIMPLE 2 #define USBTMC488_CAPABILITY_REN_CONTROL 2 #define USBTMC488_CAPABILITY_GOTO_LOCAL 2 #define USBTMC488_CAPABILITY_LOCAL_LOCKOUT 2 #define USBTMC488_CAPABILITY_488_DOT_2 4 #define USBTMC488_CAPABILITY_DT1 16 #define USBTMC488_CAPABILITY_RL1 32 #define USBTMC488_CAPABILITY_SR1 64 #define USBTMC488_CAPABILITY_FULL_SCPI 128 #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/vfio.h����������������������������������������������������������������������������������������0000644�����������������00000071775�14763166027�0007054 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * VFIO API definition * * Copyright (C) 2012 Red Hat, Inc. All rights reserved. * Author: Alex Williamson <alex.williamson@redhat.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef VFIO_H #define VFIO_H #include <linux/types.h> #include <linux/ioctl.h> #define VFIO_API_VERSION 0 /* Kernel & User level defines for VFIO IOCTLs. */ /* Extensions */ #define VFIO_TYPE1_IOMMU 1 #define VFIO_SPAPR_TCE_IOMMU 2 #define VFIO_TYPE1v2_IOMMU 3 /* * IOMMU enforces DMA cache coherence (ex. PCIe NoSnoop stripping). This * capability is subject to change as groups are added or removed. */ #define VFIO_DMA_CC_IOMMU 4 /* Check if EEH is supported */ #define VFIO_EEH 5 /* Two-stage IOMMU */ #define VFIO_TYPE1_NESTING_IOMMU 6 /* Implies v2 */ #define VFIO_SPAPR_TCE_v2_IOMMU 7 /* * The No-IOMMU IOMMU offers no translation or isolation for devices and * supports no ioctls outside of VFIO_CHECK_EXTENSION. Use of VFIO's No-IOMMU * code will taint the host kernel and should be used with extreme caution. */ #define VFIO_NOIOMMU_IOMMU 8 /* * The IOCTL interface is designed for extensibility by embedding the * structure length (argsz) and flags into structures passed between * kernel and userspace. We therefore use the _IO() macro for these * defines to avoid implicitly embedding a size into the ioctl request. * As structure fields are added, argsz will increase to match and flag * bits will be defined to indicate additional fields with valid data. * It's *always* the caller's responsibility to indicate the size of * the structure passed by setting argsz appropriately. */ #define VFIO_TYPE (';') #define VFIO_BASE 100 /* * For extension of INFO ioctls, VFIO makes use of a capability chain * designed after PCI/e capabilities. A flag bit indicates whether * this capability chain is supported and a field defined in the fixed * structure defines the offset of the first capability in the chain. * This field is only valid when the corresponding bit in the flags * bitmap is set. This offset field is relative to the start of the * INFO buffer, as is the next field within each capability header. * The id within the header is a shared address space per INFO ioctl, * while the version field is specific to the capability id. The * contents following the header are specific to the capability id. */ struct vfio_info_cap_header { __u16 id; /* Identifies capability */ __u16 version; /* Version specific to the capability ID */ __u32 next; /* Offset of next capability */ }; /* * Callers of INFO ioctls passing insufficiently sized buffers will see * the capability chain flag bit set, a zero value for the first capability * offset (if available within the provided argsz), and argsz will be * updated to report the necessary buffer size. For compatibility, the * INFO ioctl will not report error in this case, but the capability chain * will not be available. */ /* -------- IOCTLs for VFIO file descriptor (/dev/vfio/vfio) -------- */ /** * VFIO_GET_API_VERSION - _IO(VFIO_TYPE, VFIO_BASE + 0) * * Report the version of the VFIO API. This allows us to bump the entire * API version should we later need to add or change features in incompatible * ways. * Return: VFIO_API_VERSION * Availability: Always */ #define VFIO_GET_API_VERSION _IO(VFIO_TYPE, VFIO_BASE + 0) /** * VFIO_CHECK_EXTENSION - _IOW(VFIO_TYPE, VFIO_BASE + 1, __u32) * * Check whether an extension is supported. * Return: 0 if not supported, 1 (or some other positive integer) if supported. * Availability: Always */ #define VFIO_CHECK_EXTENSION _IO(VFIO_TYPE, VFIO_BASE + 1) /** * VFIO_SET_IOMMU - _IOW(VFIO_TYPE, VFIO_BASE + 2, __s32) * * Set the iommu to the given type. The type must be supported by an * iommu driver as verified by calling CHECK_EXTENSION using the same * type. A group must be set to this file descriptor before this * ioctl is available. The IOMMU interfaces enabled by this call are * specific to the value set. * Return: 0 on success, -errno on failure * Availability: When VFIO group attached */ #define VFIO_SET_IOMMU _IO(VFIO_TYPE, VFIO_BASE + 2) /* -------- IOCTLs for GROUP file descriptors (/dev/vfio/$GROUP) -------- */ /** * VFIO_GROUP_GET_STATUS - _IOR(VFIO_TYPE, VFIO_BASE + 3, * struct vfio_group_status) * * Retrieve information about the group. Fills in provided * struct vfio_group_info. Caller sets argsz. * Return: 0 on succes, -errno on failure. * Availability: Always */ struct vfio_group_status { __u32 argsz; __u32 flags; #define VFIO_GROUP_FLAGS_VIABLE (1 << 0) #define VFIO_GROUP_FLAGS_CONTAINER_SET (1 << 1) }; #define VFIO_GROUP_GET_STATUS _IO(VFIO_TYPE, VFIO_BASE + 3) /** * VFIO_GROUP_SET_CONTAINER - _IOW(VFIO_TYPE, VFIO_BASE + 4, __s32) * * Set the container for the VFIO group to the open VFIO file * descriptor provided. Groups may only belong to a single * container. Containers may, at their discretion, support multiple * groups. Only when a container is set are all of the interfaces * of the VFIO file descriptor and the VFIO group file descriptor * available to the user. * Return: 0 on success, -errno on failure. * Availability: Always */ #define VFIO_GROUP_SET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 4) /** * VFIO_GROUP_UNSET_CONTAINER - _IO(VFIO_TYPE, VFIO_BASE + 5) * * Remove the group from the attached container. This is the * opposite of the SET_CONTAINER call and returns the group to * an initial state. All device file descriptors must be released * prior to calling this interface. When removing the last group * from a container, the IOMMU will be disabled and all state lost, * effectively also returning the VFIO file descriptor to an initial * state. * Return: 0 on success, -errno on failure. * Availability: When attached to container */ #define VFIO_GROUP_UNSET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 5) /** * VFIO_GROUP_GET_DEVICE_FD - _IOW(VFIO_TYPE, VFIO_BASE + 6, char) * * Return a new file descriptor for the device object described by * the provided string. The string should match a device listed in * the devices subdirectory of the IOMMU group sysfs entry. The * group containing the device must already be added to this context. * Return: new file descriptor on success, -errno on failure. * Availability: When attached to container */ #define VFIO_GROUP_GET_DEVICE_FD _IO(VFIO_TYPE, VFIO_BASE + 6) /* --------------- IOCTLs for DEVICE file descriptors --------------- */ /** * VFIO_DEVICE_GET_INFO - _IOR(VFIO_TYPE, VFIO_BASE + 7, * struct vfio_device_info) * * Retrieve information about the device. Fills in provided * struct vfio_device_info. Caller sets argsz. * Return: 0 on success, -errno on failure. */ struct vfio_device_info { __u32 argsz; __u32 flags; #define VFIO_DEVICE_FLAGS_RESET (1 << 0) /* Device supports reset */ #define VFIO_DEVICE_FLAGS_PCI (1 << 1) /* vfio-pci device */ #define VFIO_DEVICE_FLAGS_PLATFORM (1 << 2) /* vfio-platform device */ #define VFIO_DEVICE_FLAGS_AMBA (1 << 3) /* vfio-amba device */ #define VFIO_DEVICE_FLAGS_CCW (1 << 4) /* vfio-ccw device */ __u32 num_regions; /* Max region index + 1 */ __u32 num_irqs; /* Max IRQ index + 1 */ }; #define VFIO_DEVICE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 7) /* * Vendor driver using Mediated device framework should provide device_api * attribute in supported type attribute groups. Device API string should be one * of the following corresponding to device flags in vfio_device_info structure. */ #define VFIO_DEVICE_API_PCI_STRING "vfio-pci" #define VFIO_DEVICE_API_PLATFORM_STRING "vfio-platform" #define VFIO_DEVICE_API_AMBA_STRING "vfio-amba" #define VFIO_DEVICE_API_CCW_STRING "vfio-ccw" /** * VFIO_DEVICE_GET_REGION_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 8, * struct vfio_region_info) * * Retrieve information about a device region. Caller provides * struct vfio_region_info with index value set. Caller sets argsz. * Implementation of region mapping is bus driver specific. This is * intended to describe MMIO, I/O port, as well as bus specific * regions (ex. PCI config space). Zero sized regions may be used * to describe unimplemented regions (ex. unimplemented PCI BARs). * Return: 0 on success, -errno on failure. */ struct vfio_region_info { __u32 argsz; __u32 flags; #define VFIO_REGION_INFO_FLAG_READ (1 << 0) /* Region supports read */ #define VFIO_REGION_INFO_FLAG_WRITE (1 << 1) /* Region supports write */ #define VFIO_REGION_INFO_FLAG_MMAP (1 << 2) /* Region supports mmap */ #define VFIO_REGION_INFO_FLAG_CAPS (1 << 3) /* Info supports caps */ __u32 index; /* Region index */ __u32 cap_offset; /* Offset within info struct of first cap */ __u64 size; /* Region size (bytes) */ __u64 offset; /* Region offset from start of device fd */ }; #define VFIO_DEVICE_GET_REGION_INFO _IO(VFIO_TYPE, VFIO_BASE + 8) /* * The sparse mmap capability allows finer granularity of specifying areas * within a region with mmap support. When specified, the user should only * mmap the offset ranges specified by the areas array. mmaps outside of the * areas specified may fail (such as the range covering a PCI MSI-X table) or * may result in improper device behavior. * * The structures below define version 1 of this capability. */ #define VFIO_REGION_INFO_CAP_SPARSE_MMAP 1 struct vfio_region_sparse_mmap_area { __u64 offset; /* Offset of mmap'able area within region */ __u64 size; /* Size of mmap'able area */ }; struct vfio_region_info_cap_sparse_mmap { struct vfio_info_cap_header header; __u32 nr_areas; __u32 reserved; struct vfio_region_sparse_mmap_area areas[]; }; /* * The device specific type capability allows regions unique to a specific * device or class of devices to be exposed. This helps solve the problem for * vfio bus drivers of defining which region indexes correspond to which region * on the device, without needing to resort to static indexes, as done by * vfio-pci. For instance, if we were to go back in time, we might remove * VFIO_PCI_VGA_REGION_INDEX and let vfio-pci simply define that all indexes * greater than or equal to VFIO_PCI_NUM_REGIONS are device specific and we'd * make a "VGA" device specific type to describe the VGA access space. This * means that non-VGA devices wouldn't need to waste this index, and thus the * address space associated with it due to implementation of device file * descriptor offsets in vfio-pci. * * The current implementation is now part of the user ABI, so we can't use this * for VGA, but there are other upcoming use cases, such as opregions for Intel * IGD devices and framebuffers for vGPU devices. We missed VGA, but we'll * use this for future additions. * * The structure below defines version 1 of this capability. */ #define VFIO_REGION_INFO_CAP_TYPE 2 struct vfio_region_info_cap_type { struct vfio_info_cap_header header; __u32 type; /* global per bus driver */ __u32 subtype; /* type specific */ }; #define VFIO_REGION_TYPE_PCI_VENDOR_TYPE (1 << 31) #define VFIO_REGION_TYPE_PCI_VENDOR_MASK (0xffff) /* 8086 Vendor sub-types */ #define VFIO_REGION_SUBTYPE_INTEL_IGD_OPREGION (1) #define VFIO_REGION_SUBTYPE_INTEL_IGD_HOST_CFG (2) #define VFIO_REGION_SUBTYPE_INTEL_IGD_LPC_CFG (3) /* * The MSIX mappable capability informs that MSIX data of a BAR can be mmapped * which allows direct access to non-MSIX registers which happened to be within * the same system page. * * Even though the userspace gets direct access to the MSIX data, the existing * VFIO_DEVICE_SET_IRQS interface must still be used for MSIX configuration. */ #define VFIO_REGION_INFO_CAP_MSIX_MAPPABLE 3 /** * VFIO_DEVICE_GET_IRQ_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 9, * struct vfio_irq_info) * * Retrieve information about a device IRQ. Caller provides * struct vfio_irq_info with index value set. Caller sets argsz. * Implementation of IRQ mapping is bus driver specific. Indexes * using multiple IRQs are primarily intended to support MSI-like * interrupt blocks. Zero count irq blocks may be used to describe * unimplemented interrupt types. * * The EVENTFD flag indicates the interrupt index supports eventfd based * signaling. * * The MASKABLE flags indicates the index supports MASK and UNMASK * actions described below. * * AUTOMASKED indicates that after signaling, the interrupt line is * automatically masked by VFIO and the user needs to unmask the line * to receive new interrupts. This is primarily intended to distinguish * level triggered interrupts. * * The NORESIZE flag indicates that the interrupt lines within the index * are setup as a set and new subindexes cannot be enabled without first * disabling the entire index. This is used for interrupts like PCI MSI * and MSI-X where the driver may only use a subset of the available * indexes, but VFIO needs to enable a specific number of vectors * upfront. In the case of MSI-X, where the user can enable MSI-X and * then add and unmask vectors, it's up to userspace to make the decision * whether to allocate the maximum supported number of vectors or tear * down setup and incrementally increase the vectors as each is enabled. */ struct vfio_irq_info { __u32 argsz; __u32 flags; #define VFIO_IRQ_INFO_EVENTFD (1 << 0) #define VFIO_IRQ_INFO_MASKABLE (1 << 1) #define VFIO_IRQ_INFO_AUTOMASKED (1 << 2) #define VFIO_IRQ_INFO_NORESIZE (1 << 3) __u32 index; /* IRQ index */ __u32 count; /* Number of IRQs within this index */ }; #define VFIO_DEVICE_GET_IRQ_INFO _IO(VFIO_TYPE, VFIO_BASE + 9) /** * VFIO_DEVICE_SET_IRQS - _IOW(VFIO_TYPE, VFIO_BASE + 10, struct vfio_irq_set) * * Set signaling, masking, and unmasking of interrupts. Caller provides * struct vfio_irq_set with all fields set. 'start' and 'count' indicate * the range of subindexes being specified. * * The DATA flags specify the type of data provided. If DATA_NONE, the * operation performs the specified action immediately on the specified * interrupt(s). For example, to unmask AUTOMASKED interrupt [0,0]: * flags = (DATA_NONE|ACTION_UNMASK), index = 0, start = 0, count = 1. * * DATA_BOOL allows sparse support for the same on arrays of interrupts. * For example, to mask interrupts [0,1] and [0,3] (but not [0,2]): * flags = (DATA_BOOL|ACTION_MASK), index = 0, start = 1, count = 3, * data = {1,0,1} * * DATA_EVENTFD binds the specified ACTION to the provided __s32 eventfd. * A value of -1 can be used to either de-assign interrupts if already * assigned or skip un-assigned interrupts. For example, to set an eventfd * to be trigger for interrupts [0,0] and [0,2]: * flags = (DATA_EVENTFD|ACTION_TRIGGER), index = 0, start = 0, count = 3, * data = {fd1, -1, fd2} * If index [0,1] is previously set, two count = 1 ioctls calls would be * required to set [0,0] and [0,2] without changing [0,1]. * * Once a signaling mechanism is set, DATA_BOOL or DATA_NONE can be used * with ACTION_TRIGGER to perform kernel level interrupt loopback testing * from userspace (ie. simulate hardware triggering). * * Setting of an event triggering mechanism to userspace for ACTION_TRIGGER * enables the interrupt index for the device. Individual subindex interrupts * can be disabled using the -1 value for DATA_EVENTFD or the index can be * disabled as a whole with: flags = (DATA_NONE|ACTION_TRIGGER), count = 0. * * Note that ACTION_[UN]MASK specify user->kernel signaling (irqfds) while * ACTION_TRIGGER specifies kernel->user signaling. */ struct vfio_irq_set { __u32 argsz; __u32 flags; #define VFIO_IRQ_SET_DATA_NONE (1 << 0) /* Data not present */ #define VFIO_IRQ_SET_DATA_BOOL (1 << 1) /* Data is bool (u8) */ #define VFIO_IRQ_SET_DATA_EVENTFD (1 << 2) /* Data is eventfd (s32) */ #define VFIO_IRQ_SET_ACTION_MASK (1 << 3) /* Mask interrupt */ #define VFIO_IRQ_SET_ACTION_UNMASK (1 << 4) /* Unmask interrupt */ #define VFIO_IRQ_SET_ACTION_TRIGGER (1 << 5) /* Trigger interrupt */ __u32 index; __u32 start; __u32 count; __u8 data[]; }; #define VFIO_DEVICE_SET_IRQS _IO(VFIO_TYPE, VFIO_BASE + 10) #define VFIO_IRQ_SET_DATA_TYPE_MASK (VFIO_IRQ_SET_DATA_NONE | \ VFIO_IRQ_SET_DATA_BOOL | \ VFIO_IRQ_SET_DATA_EVENTFD) #define VFIO_IRQ_SET_ACTION_TYPE_MASK (VFIO_IRQ_SET_ACTION_MASK | \ VFIO_IRQ_SET_ACTION_UNMASK | \ VFIO_IRQ_SET_ACTION_TRIGGER) /** * VFIO_DEVICE_RESET - _IO(VFIO_TYPE, VFIO_BASE + 11) * * Reset a device. */ #define VFIO_DEVICE_RESET _IO(VFIO_TYPE, VFIO_BASE + 11) /* * The VFIO-PCI bus driver makes use of the following fixed region and * IRQ index mapping. Unimplemented regions return a size of zero. * Unimplemented IRQ types return a count of zero. */ enum { VFIO_PCI_BAR0_REGION_INDEX, VFIO_PCI_BAR1_REGION_INDEX, VFIO_PCI_BAR2_REGION_INDEX, VFIO_PCI_BAR3_REGION_INDEX, VFIO_PCI_BAR4_REGION_INDEX, VFIO_PCI_BAR5_REGION_INDEX, VFIO_PCI_ROM_REGION_INDEX, VFIO_PCI_CONFIG_REGION_INDEX, /* * Expose VGA regions defined for PCI base class 03, subclass 00. * This includes I/O port ranges 0x3b0 to 0x3bb and 0x3c0 to 0x3df * as well as the MMIO range 0xa0000 to 0xbffff. Each implemented * range is found at it's identity mapped offset from the region * offset, for example 0x3b0 is region_info.offset + 0x3b0. Areas * between described ranges are unimplemented. */ VFIO_PCI_VGA_REGION_INDEX, VFIO_PCI_NUM_REGIONS = 9 /* Fixed user ABI, region indexes >=9 use */ /* device specific cap to define content. */ }; enum { VFIO_PCI_INTX_IRQ_INDEX, VFIO_PCI_MSI_IRQ_INDEX, VFIO_PCI_MSIX_IRQ_INDEX, VFIO_PCI_ERR_IRQ_INDEX, VFIO_PCI_REQ_IRQ_INDEX, VFIO_PCI_NUM_IRQS }; /* * The vfio-ccw bus driver makes use of the following fixed region and * IRQ index mapping. Unimplemented regions return a size of zero. * Unimplemented IRQ types return a count of zero. */ enum { VFIO_CCW_CONFIG_REGION_INDEX, VFIO_CCW_NUM_REGIONS }; enum { VFIO_CCW_IO_IRQ_INDEX, VFIO_CCW_NUM_IRQS }; /** * VFIO_DEVICE_GET_PCI_HOT_RESET_INFO - _IORW(VFIO_TYPE, VFIO_BASE + 12, * struct vfio_pci_hot_reset_info) * * Return: 0 on success, -errno on failure: * -enospc = insufficient buffer, -enodev = unsupported for device. */ struct vfio_pci_dependent_device { __u32 group_id; __u16 segment; __u8 bus; __u8 devfn; /* Use PCI_SLOT/PCI_FUNC */ }; struct vfio_pci_hot_reset_info { __u32 argsz; __u32 flags; __u32 count; struct vfio_pci_dependent_device devices[]; }; #define VFIO_DEVICE_GET_PCI_HOT_RESET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) /** * VFIO_DEVICE_PCI_HOT_RESET - _IOW(VFIO_TYPE, VFIO_BASE + 13, * struct vfio_pci_hot_reset) * * Return: 0 on success, -errno on failure. */ struct vfio_pci_hot_reset { __u32 argsz; __u32 flags; __u32 count; __s32 group_fds[]; }; #define VFIO_DEVICE_PCI_HOT_RESET _IO(VFIO_TYPE, VFIO_BASE + 13) /** * VFIO_DEVICE_QUERY_GFX_PLANE - _IOW(VFIO_TYPE, VFIO_BASE + 14, * struct vfio_device_query_gfx_plane) * * Set the drm_plane_type and flags, then retrieve the gfx plane info. * * flags supported: * - VFIO_GFX_PLANE_TYPE_PROBE and VFIO_GFX_PLANE_TYPE_DMABUF are set * to ask if the mdev supports dma-buf. 0 on support, -EINVAL on no * support for dma-buf. * - VFIO_GFX_PLANE_TYPE_PROBE and VFIO_GFX_PLANE_TYPE_REGION are set * to ask if the mdev supports region. 0 on support, -EINVAL on no * support for region. * - VFIO_GFX_PLANE_TYPE_DMABUF or VFIO_GFX_PLANE_TYPE_REGION is set * with each call to query the plane info. * - Others are invalid and return -EINVAL. * * Note: * 1. Plane could be disabled by guest. In that case, success will be * returned with zero-initialized drm_format, size, width and height * fields. * 2. x_hot/y_hot is set to 0xFFFFFFFF if no hotspot information available * * Return: 0 on success, -errno on other failure. */ struct vfio_device_gfx_plane_info { __u32 argsz; __u32 flags; #define VFIO_GFX_PLANE_TYPE_PROBE (1 << 0) #define VFIO_GFX_PLANE_TYPE_DMABUF (1 << 1) #define VFIO_GFX_PLANE_TYPE_REGION (1 << 2) /* in */ __u32 drm_plane_type; /* type of plane: DRM_PLANE_TYPE_* */ /* out */ __u32 drm_format; /* drm format of plane */ __u64 drm_format_mod; /* tiled mode */ __u32 width; /* width of plane */ __u32 height; /* height of plane */ __u32 stride; /* stride of plane */ __u32 size; /* size of plane in bytes, align on page*/ __u32 x_pos; /* horizontal position of cursor plane */ __u32 y_pos; /* vertical position of cursor plane*/ __u32 x_hot; /* horizontal position of cursor hotspot */ __u32 y_hot; /* vertical position of cursor hotspot */ union { __u32 region_index; /* region index */ __u32 dmabuf_id; /* dma-buf id */ }; }; #define VFIO_DEVICE_QUERY_GFX_PLANE _IO(VFIO_TYPE, VFIO_BASE + 14) /** * VFIO_DEVICE_GET_GFX_DMABUF - _IOW(VFIO_TYPE, VFIO_BASE + 15, __u32) * * Return a new dma-buf file descriptor for an exposed guest framebuffer * described by the provided dmabuf_id. The dmabuf_id is returned from VFIO_ * DEVICE_QUERY_GFX_PLANE as a token of the exposed guest framebuffer. */ #define VFIO_DEVICE_GET_GFX_DMABUF _IO(VFIO_TYPE, VFIO_BASE + 15) /** * VFIO_DEVICE_IOEVENTFD - _IOW(VFIO_TYPE, VFIO_BASE + 16, * struct vfio_device_ioeventfd) * * Perform a write to the device at the specified device fd offset, with * the specified data and width when the provided eventfd is triggered. * vfio bus drivers may not support this for all regions, for all widths, * or at all. vfio-pci currently only enables support for BAR regions, * excluding the MSI-X vector table. * * Return: 0 on success, -errno on failure. */ struct vfio_device_ioeventfd { __u32 argsz; __u32 flags; #define VFIO_DEVICE_IOEVENTFD_8 (1 << 0) /* 1-byte write */ #define VFIO_DEVICE_IOEVENTFD_16 (1 << 1) /* 2-byte write */ #define VFIO_DEVICE_IOEVENTFD_32 (1 << 2) /* 4-byte write */ #define VFIO_DEVICE_IOEVENTFD_64 (1 << 3) /* 8-byte write */ #define VFIO_DEVICE_IOEVENTFD_SIZE_MASK (0xf) __u64 offset; /* device fd offset of write */ __u64 data; /* data to be written */ __s32 fd; /* -1 for de-assignment */ }; #define VFIO_DEVICE_IOEVENTFD _IO(VFIO_TYPE, VFIO_BASE + 16) /* -------- API for Type1 VFIO IOMMU -------- */ /** * VFIO_IOMMU_GET_INFO - _IOR(VFIO_TYPE, VFIO_BASE + 12, struct vfio_iommu_info) * * Retrieve information about the IOMMU object. Fills in provided * struct vfio_iommu_info. Caller sets argsz. * * XXX Should we do these by CHECK_EXTENSION too? */ struct vfio_iommu_type1_info { __u32 argsz; __u32 flags; #define VFIO_IOMMU_INFO_PGSIZES (1 << 0) /* supported page sizes info */ __u64 iova_pgsizes; /* Bitmap of supported page sizes */ }; #define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) /** * VFIO_IOMMU_MAP_DMA - _IOW(VFIO_TYPE, VFIO_BASE + 13, struct vfio_dma_map) * * Map process virtual addresses to IO virtual addresses using the * provided struct vfio_dma_map. Caller sets argsz. READ &/ WRITE required. */ struct vfio_iommu_type1_dma_map { __u32 argsz; __u32 flags; #define VFIO_DMA_MAP_FLAG_READ (1 << 0) /* readable from device */ #define VFIO_DMA_MAP_FLAG_WRITE (1 << 1) /* writable from device */ __u64 vaddr; /* Process virtual address */ __u64 iova; /* IO virtual address */ __u64 size; /* Size of mapping (bytes) */ }; #define VFIO_IOMMU_MAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 13) /** * VFIO_IOMMU_UNMAP_DMA - _IOWR(VFIO_TYPE, VFIO_BASE + 14, * struct vfio_dma_unmap) * * Unmap IO virtual addresses using the provided struct vfio_dma_unmap. * Caller sets argsz. The actual unmapped size is returned in the size * field. No guarantee is made to the user that arbitrary unmaps of iova * or size different from those used in the original mapping call will * succeed. */ struct vfio_iommu_type1_dma_unmap { __u32 argsz; __u32 flags; __u64 iova; /* IO virtual address */ __u64 size; /* Size of mapping (bytes) */ }; #define VFIO_IOMMU_UNMAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 14) /* * IOCTLs to enable/disable IOMMU container usage. * No parameters are supported. */ #define VFIO_IOMMU_ENABLE _IO(VFIO_TYPE, VFIO_BASE + 15) #define VFIO_IOMMU_DISABLE _IO(VFIO_TYPE, VFIO_BASE + 16) /* -------- Additional API for SPAPR TCE (Server POWERPC) IOMMU -------- */ /* * The SPAPR TCE DDW info struct provides the information about * the details of Dynamic DMA window capability. * * @pgsizes contains a page size bitmask, 4K/64K/16M are supported. * @max_dynamic_windows_supported tells the maximum number of windows * which the platform can create. * @levels tells the maximum number of levels in multi-level IOMMU tables; * this allows splitting a table into smaller chunks which reduces * the amount of physically contiguous memory required for the table. */ struct vfio_iommu_spapr_tce_ddw_info { __u64 pgsizes; /* Bitmap of supported page sizes */ __u32 max_dynamic_windows_supported; __u32 levels; }; /* * The SPAPR TCE info struct provides the information about the PCI bus * address ranges available for DMA, these values are programmed into * the hardware so the guest has to know that information. * * The DMA 32 bit window start is an absolute PCI bus address. * The IOVA address passed via map/unmap ioctls are absolute PCI bus * addresses too so the window works as a filter rather than an offset * for IOVA addresses. * * Flags supported: * - VFIO_IOMMU_SPAPR_INFO_DDW: informs the userspace that dynamic DMA windows * (DDW) support is present. @ddw is only supported when DDW is present. */ struct vfio_iommu_spapr_tce_info { __u32 argsz; __u32 flags; #define VFIO_IOMMU_SPAPR_INFO_DDW (1 << 0) /* DDW supported */ __u32 dma32_window_start; /* 32 bit window start (bytes) */ __u32 dma32_window_size; /* 32 bit window size (bytes) */ struct vfio_iommu_spapr_tce_ddw_info ddw; }; #define VFIO_IOMMU_SPAPR_TCE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) /* * EEH PE operation struct provides ways to: * - enable/disable EEH functionality; * - unfreeze IO/DMA for frozen PE; * - read PE state; * - reset PE; * - configure PE; * - inject EEH error. */ struct vfio_eeh_pe_err { __u32 type; __u32 func; __u64 addr; __u64 mask; }; struct vfio_eeh_pe_op { __u32 argsz; __u32 flags; __u32 op; union { struct vfio_eeh_pe_err err; }; }; #define VFIO_EEH_PE_DISABLE 0 /* Disable EEH functionality */ #define VFIO_EEH_PE_ENABLE 1 /* Enable EEH functionality */ #define VFIO_EEH_PE_UNFREEZE_IO 2 /* Enable IO for frozen PE */ #define VFIO_EEH_PE_UNFREEZE_DMA 3 /* Enable DMA for frozen PE */ #define VFIO_EEH_PE_GET_STATE 4 /* PE state retrieval */ #define VFIO_EEH_PE_STATE_NORMAL 0 /* PE in functional state */ #define VFIO_EEH_PE_STATE_RESET 1 /* PE reset in progress */ #define VFIO_EEH_PE_STATE_STOPPED 2 /* Stopped DMA and IO */ #define VFIO_EEH_PE_STATE_STOPPED_DMA 4 /* Stopped DMA only */ #define VFIO_EEH_PE_STATE_UNAVAIL 5 /* State unavailable */ #define VFIO_EEH_PE_RESET_DEACTIVATE 5 /* Deassert PE reset */ #define VFIO_EEH_PE_RESET_HOT 6 /* Assert hot reset */ #define VFIO_EEH_PE_RESET_FUNDAMENTAL 7 /* Assert fundamental reset */ #define VFIO_EEH_PE_CONFIGURE 8 /* PE configuration */ #define VFIO_EEH_PE_INJECT_ERR 9 /* Inject EEH error */ #define VFIO_EEH_PE_OP _IO(VFIO_TYPE, VFIO_BASE + 21) /** * VFIO_IOMMU_SPAPR_REGISTER_MEMORY - _IOW(VFIO_TYPE, VFIO_BASE + 17, struct vfio_iommu_spapr_register_memory) * * Registers user space memory where DMA is allowed. It pins * user pages and does the locked memory accounting so * subsequent VFIO_IOMMU_MAP_DMA/VFIO_IOMMU_UNMAP_DMA calls * get faster. */ struct vfio_iommu_spapr_register_memory { __u32 argsz; __u32 flags; __u64 vaddr; /* Process virtual address */ __u64 size; /* Size of mapping (bytes) */ }; #define VFIO_IOMMU_SPAPR_REGISTER_MEMORY _IO(VFIO_TYPE, VFIO_BASE + 17) /** * VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY - _IOW(VFIO_TYPE, VFIO_BASE + 18, struct vfio_iommu_spapr_register_memory) * * Unregisters user space memory registered with * VFIO_IOMMU_SPAPR_REGISTER_MEMORY. * Uses vfio_iommu_spapr_register_memory for parameters. */ #define VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY _IO(VFIO_TYPE, VFIO_BASE + 18) /** * VFIO_IOMMU_SPAPR_TCE_CREATE - _IOWR(VFIO_TYPE, VFIO_BASE + 19, struct vfio_iommu_spapr_tce_create) * * Creates an additional TCE table and programs it (sets a new DMA window) * to every IOMMU group in the container. It receives page shift, window * size and number of levels in the TCE table being created. * * It allocates and returns an offset on a PCI bus of the new DMA window. */ struct vfio_iommu_spapr_tce_create { __u32 argsz; __u32 flags; /* in */ __u32 page_shift; __u32 __resv1; __u64 window_size; __u32 levels; __u32 __resv2; /* out */ __u64 start_addr; }; #define VFIO_IOMMU_SPAPR_TCE_CREATE _IO(VFIO_TYPE, VFIO_BASE + 19) /** * VFIO_IOMMU_SPAPR_TCE_REMOVE - _IOW(VFIO_TYPE, VFIO_BASE + 20, struct vfio_iommu_spapr_tce_remove) * * Unprograms a TCE table from all groups in the container and destroys it. * It receives a PCI bus offset as a window id. */ struct vfio_iommu_spapr_tce_remove { __u32 argsz; __u32 flags; /* in */ __u64 start_addr; }; #define VFIO_IOMMU_SPAPR_TCE_REMOVE _IO(VFIO_TYPE, VFIO_BASE + 20) /* ***************************************************************** */ #endif /* VFIO_H */ ���linux/atmlec.h��������������������������������������������������������������������������������������0000644�����������������00000004515�14763166027�0007342 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ATM Lan Emulation Daemon driver interface * * Marko Kiiskila <mkiiskila@yahoo.com> */ #ifndef _ATMLEC_H_ #define _ATMLEC_H_ #include <linux/atmapi.h> #include <linux/atmioc.h> #include <linux/atm.h> #include <linux/if_ether.h> #include <linux/types.h> /* ATM lec daemon control socket */ #define ATMLEC_CTRL _IO('a', ATMIOC_LANE) #define ATMLEC_DATA _IO('a', ATMIOC_LANE+1) #define ATMLEC_MCAST _IO('a', ATMIOC_LANE+2) /* Maximum number of LEC interfaces (tweakable) */ #define MAX_LEC_ITF 48 typedef enum { l_set_mac_addr, l_del_mac_addr, l_svc_setup, l_addr_delete, l_topology_change, l_flush_complete, l_arp_update, l_narp_req, /* LANE2 mandates the use of this */ l_config, l_flush_tran_id, l_set_lecid, l_arp_xmt, l_rdesc_arp_xmt, l_associate_req, l_should_bridge /* should we bridge this MAC? */ } atmlec_msg_type; #define ATMLEC_MSG_TYPE_MAX l_should_bridge struct atmlec_config_msg { unsigned int maximum_unknown_frame_count; unsigned int max_unknown_frame_time; unsigned short max_retry_count; unsigned int aging_time; unsigned int forward_delay_time; unsigned int arp_response_time; unsigned int flush_timeout; unsigned int path_switching_delay; unsigned int lane_version; /* LANE2: 1 for LANEv1, 2 for LANEv2 */ int mtu; int is_proxy; }; struct atmlec_msg { atmlec_msg_type type; int sizeoftlvs; /* LANE2: if != 0, tlvs follow */ union { struct { unsigned char mac_addr[ETH_ALEN]; unsigned char atm_addr[ATM_ESA_LEN]; unsigned int flag; /* * Topology_change flag, * remoteflag, permanent flag, * lecid, transaction id */ unsigned int targetless_le_arp; /* LANE2 */ unsigned int no_source_le_narp; /* LANE2 */ } normal; struct atmlec_config_msg config; struct { __u16 lec_id; /* requestor lec_id */ __u32 tran_id; /* transaction id */ unsigned char mac_addr[ETH_ALEN]; /* dst mac addr */ unsigned char atm_addr[ATM_ESA_LEN]; /* reqestor ATM addr */ } proxy; /* * For mapping LE_ARP requests to responses. Filled by * zeppelin, returned by kernel. Used only when proxying */ } content; } __ATM_API_ALIGN; struct atmlec_ioc { int dev_num; unsigned char atm_addr[ATM_ESA_LEN]; unsigned char receive; /* 1= receive vcc, 0 = send vcc */ }; #endif /* _ATMLEC_H_ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/adfs_fs.h�������������������������������������������������������������������������������������0000644�����������������00000001650�14763166027�0007477 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ADFS_FS_H #define _ADFS_FS_H #include <linux/types.h> #include <linux/magic.h> /* * Disc Record at disc address 0xc00 */ struct adfs_discrecord { __u8 log2secsize; __u8 secspertrack; __u8 heads; __u8 density; __u8 idlen; __u8 log2bpmb; __u8 skew; __u8 bootoption; __u8 lowsector; __u8 nzones; __le16 zone_spare; __le32 root; __le32 disc_size; __le16 disc_id; __u8 disc_name[10]; __le32 disc_type; __le32 disc_size_high; __u8 log2sharesize:4; __u8 unused40:4; __u8 big_flag:1; __u8 unused41:1; __u8 nzones_high; __le32 format_version; __le32 root_size; __u8 unused52[60 - 52]; }; #define ADFS_DISCRECORD (0xc00) #define ADFS_DR_OFFSET (0x1c0) #define ADFS_DR_SIZE 60 #define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3) #endif /* _ADFS_FS_H */ ����������������������������������������������������������������������������������������linux/hdlcdrv.h�������������������������������������������������������������������������������������0000644�����������������00000005534�14763166027�0007525 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * hdlcdrv.h -- HDLC packet radio network driver. * The Linux soundcard driver for 1200 baud and 9600 baud packet radio * (C) 1996-1998 by Thomas Sailer, HB9JNX/AE4WA */ #ifndef _HDLCDRV_H #define _HDLCDRV_H /* -------------------------------------------------------------------- */ /* * structs for the IOCTL commands */ struct hdlcdrv_params { int iobase; int irq; int dma; int dma2; int seriobase; int pariobase; int midiiobase; }; struct hdlcdrv_channel_params { int tx_delay; /* the transmitter keyup delay in 10ms units */ int tx_tail; /* the transmitter keyoff delay in 10ms units */ int slottime; /* the slottime in 10ms; usually 10 = 100ms */ int ppersist; /* the p-persistence 0..255 */ int fulldup; /* some driver do not support full duplex, setting */ /* this just makes them send even if DCD is on */ }; struct hdlcdrv_old_channel_state { int ptt; int dcd; int ptt_keyed; }; struct hdlcdrv_channel_state { int ptt; int dcd; int ptt_keyed; unsigned long tx_packets; unsigned long tx_errors; unsigned long rx_packets; unsigned long rx_errors; }; struct hdlcdrv_ioctl { int cmd; union { struct hdlcdrv_params mp; struct hdlcdrv_channel_params cp; struct hdlcdrv_channel_state cs; struct hdlcdrv_old_channel_state ocs; unsigned int calibrate; unsigned char bits; char modename[128]; char drivername[32]; } data; }; /* -------------------------------------------------------------------- */ /* * ioctl values */ #define HDLCDRVCTL_GETMODEMPAR 0 #define HDLCDRVCTL_SETMODEMPAR 1 #define HDLCDRVCTL_MODEMPARMASK 2 /* not handled by hdlcdrv */ #define HDLCDRVCTL_GETCHANNELPAR 10 #define HDLCDRVCTL_SETCHANNELPAR 11 #define HDLCDRVCTL_OLDGETSTAT 20 #define HDLCDRVCTL_CALIBRATE 21 #define HDLCDRVCTL_GETSTAT 22 /* * these are mainly for debugging purposes */ #define HDLCDRVCTL_GETSAMPLES 30 #define HDLCDRVCTL_GETBITS 31 /* * not handled by hdlcdrv, but by its depending drivers */ #define HDLCDRVCTL_GETMODE 40 #define HDLCDRVCTL_SETMODE 41 #define HDLCDRVCTL_MODELIST 42 #define HDLCDRVCTL_DRIVERNAME 43 /* * mask of needed modem parameters, returned by HDLCDRVCTL_MODEMPARMASK */ #define HDLCDRV_PARMASK_IOBASE (1<<0) #define HDLCDRV_PARMASK_IRQ (1<<1) #define HDLCDRV_PARMASK_DMA (1<<2) #define HDLCDRV_PARMASK_DMA2 (1<<3) #define HDLCDRV_PARMASK_SERIOBASE (1<<4) #define HDLCDRV_PARMASK_PARIOBASE (1<<5) #define HDLCDRV_PARMASK_MIDIIOBASE (1<<6) /* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */ #endif /* _HDLCDRV_H */ /* -------------------------------------------------------------------- */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/ife.h�����������������������������������������������������������������������������������������0000644�����������������00000000537�14763166027�0006640 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __UAPI_IFE_H #define __UAPI_IFE_H #define IFE_METAHDRLEN 2 enum { IFE_META_SKBMARK = 1, IFE_META_HASHID, IFE_META_PRIO, IFE_META_QMAP, IFE_META_TCINDEX, __IFE_META_MAX }; /*Can be overridden at runtime by module option*/ #define IFE_META_MAX (__IFE_META_MAX - 1) #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������linux/kdev_t.h��������������������������������������������������������������������������������������0000644�����������������00000000577�14763166027�0007355 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_KDEV_T_H #define _LINUX_KDEV_T_H /* Some programs want their definitions of MAJOR and MINOR and MKDEV from the kernel sources. These must be the externally visible ones. */ #define MAJOR(dev) ((dev)>>8) #define MINOR(dev) ((dev) & 0xff) #define MKDEV(ma,mi) ((ma)<<8 | (mi)) #endif /* _LINUX_KDEV_T_H */ ���������������������������������������������������������������������������������������������������������������������������������linux/falloc.h��������������������������������������������������������������������������������������0000644�����������������00000007000�14763166027�0007325 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _FALLOC_H_ #define _FALLOC_H_ #define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */ #define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */ #define FALLOC_FL_NO_HIDE_STALE 0x04 /* reserved codepoint */ /* * FALLOC_FL_COLLAPSE_RANGE is used to remove a range of a file * without leaving a hole in the file. The contents of the file beyond * the range being removed is appended to the start offset of the range * being removed (i.e. the hole that was punched is "collapsed"), * resulting in a file layout that looks like the range that was * removed never existed. As such collapsing a range of a file changes * the size of the file, reducing it by the same length of the range * that has been removed by the operation. * * Different filesystems may implement different limitations on the * granularity of the operation. Most will limit operations to * filesystem block size boundaries, but this boundary may be larger or * smaller depending on the filesystem and/or the configuration of the * filesystem or file. * * Attempting to collapse a range that crosses the end of the file is * considered an illegal operation - just use ftruncate(2) if you need * to collapse a range that crosses EOF. */ #define FALLOC_FL_COLLAPSE_RANGE 0x08 /* * FALLOC_FL_ZERO_RANGE is used to convert a range of file to zeros preferably * without issuing data IO. Blocks should be preallocated for the regions that * span holes in the file, and the entire range is preferable converted to * unwritten extents - even though file system may choose to zero out the * extent or do whatever which will result in reading zeros from the range * while the range remains allocated for the file. * * This can be also used to preallocate blocks past EOF in the same way as * with fallocate. Flag FALLOC_FL_KEEP_SIZE should cause the inode * size to remain the same. */ #define FALLOC_FL_ZERO_RANGE 0x10 /* * FALLOC_FL_INSERT_RANGE is use to insert space within the file size without * overwriting any existing data. The contents of the file beyond offset are * shifted towards right by len bytes to create a hole. As such, this * operation will increase the size of the file by len bytes. * * Different filesystems may implement different limitations on the granularity * of the operation. Most will limit operations to filesystem block size * boundaries, but this boundary may be larger or smaller depending on * the filesystem and/or the configuration of the filesystem or file. * * Attempting to insert space using this flag at OR beyond the end of * the file is considered an illegal operation - just use ftruncate(2) or * fallocate(2) with mode 0 for such type of operations. */ #define FALLOC_FL_INSERT_RANGE 0x20 /* * FALLOC_FL_UNSHARE_RANGE is used to unshare shared blocks within the * file size without overwriting any existing data. The purpose of this * call is to preemptively reallocate any blocks that are subject to * copy-on-write. * * Different filesystems may implement different limitations on the * granularity of the operation. Most will limit operations to filesystem * block size boundaries, but this boundary may be larger or smaller * depending on the filesystem and/or the configuration of the filesystem * or file. * * This flag can only be used with allocate-mode fallocate, which is * to say that it cannot be used with the punch, zero, collapse, or * insert range modes. */ #define FALLOC_FL_UNSHARE_RANGE 0x40 #endif /* _FALLOC_H_ */ linux/openvswitch.h���������������������������������������������������������������������������������0000644�����������������00000106601�14763166027�0010445 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (c) 2007-2017 Nicira, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * 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., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA */ #ifndef __LINUX_OPENVSWITCH_H #define __LINUX_OPENVSWITCH_H 1 #include <linux/types.h> #include <linux/if_ether.h> /** * struct ovs_header - header for OVS Generic Netlink messages. * @dp_ifindex: ifindex of local port for datapath (0 to make a request not * specific to a datapath). * * Attributes following the header are specific to a particular OVS Generic * Netlink family, but all of the OVS families use this header. */ struct ovs_header { int dp_ifindex; }; /* Datapaths. */ #define OVS_DATAPATH_FAMILY "ovs_datapath" #define OVS_DATAPATH_MCGROUP "ovs_datapath" /* V2: * - API users are expected to provide OVS_DP_ATTR_USER_FEATURES * when creating the datapath. */ #define OVS_DATAPATH_VERSION 2 /* First OVS datapath version to support features */ #define OVS_DP_VER_FEATURES 2 enum ovs_datapath_cmd { OVS_DP_CMD_UNSPEC, OVS_DP_CMD_NEW, OVS_DP_CMD_DEL, OVS_DP_CMD_GET, OVS_DP_CMD_SET }; /** * enum ovs_datapath_attr - attributes for %OVS_DP_* commands. * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local * port". This is the name of the network device whose dp_ifindex is given in * the &struct ovs_header. Always present in notifications. Required in * %OVS_DP_NEW requests. May be used as an alternative to specifying * dp_ifindex in other requests (with a dp_ifindex of 0). * @OVS_DP_ATTR_UPCALL_PID: The Netlink socket in userspace that is initially * set on the datapath port (for OVS_ACTION_ATTR_MISS). Only valid on * %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should * not be sent. * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the * datapath. Always present in notifications. * @OVS_DP_ATTR_MEGAFLOW_STATS: Statistics about mega flow masks usage for the * datapath. Always present in notifications. * * These attributes follow the &struct ovs_header within the Generic Netlink * payload for %OVS_DP_* commands. */ enum ovs_datapath_attr { OVS_DP_ATTR_UNSPEC, OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */ OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */ OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */ OVS_DP_ATTR_MEGAFLOW_STATS, /* struct ovs_dp_megaflow_stats */ OVS_DP_ATTR_USER_FEATURES, /* OVS_DP_F_* */ OVS_DP_ATTR_PAD, __OVS_DP_ATTR_MAX }; #define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1) struct ovs_dp_stats { __u64 n_hit; /* Number of flow table matches. */ __u64 n_missed; /* Number of flow table misses. */ __u64 n_lost; /* Number of misses not sent to userspace. */ __u64 n_flows; /* Number of flows present */ }; struct ovs_dp_megaflow_stats { __u64 n_mask_hit; /* Number of masks used for flow lookups. */ __u32 n_masks; /* Number of masks for the datapath. */ __u32 pad0; /* Pad for future expension. */ __u64 pad1; /* Pad for future expension. */ __u64 pad2; /* Pad for future expension. */ }; struct ovs_vport_stats { __u64 rx_packets; /* total packets received */ __u64 tx_packets; /* total packets transmitted */ __u64 rx_bytes; /* total bytes received */ __u64 tx_bytes; /* total bytes transmitted */ __u64 rx_errors; /* bad packets received */ __u64 tx_errors; /* packet transmit problems */ __u64 rx_dropped; /* no space in linux buffers */ __u64 tx_dropped; /* no space available in linux */ }; /* Allow last Netlink attribute to be unaligned */ #define OVS_DP_F_UNALIGNED (1 << 0) /* Allow datapath to associate multiple Netlink PIDs to each vport */ #define OVS_DP_F_VPORT_PIDS (1 << 1) /* Fixed logical ports. */ #define OVSP_LOCAL ((__u32)0) /* Packet transfer. */ #define OVS_PACKET_FAMILY "ovs_packet" #define OVS_PACKET_VERSION 0x1 enum ovs_packet_cmd { OVS_PACKET_CMD_UNSPEC, /* Kernel-to-user notifications. */ OVS_PACKET_CMD_MISS, /* Flow table miss. */ OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */ /* Userspace commands. */ OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */ }; /** * enum ovs_packet_attr - attributes for %OVS_PACKET_* commands. * @OVS_PACKET_ATTR_PACKET: Present for all notifications. Contains the entire * packet as received, from the start of the Ethernet header onward. For * %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by * actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_PACKET_ATTR_KEY is * the flow key extracted from the packet as originally received. * @OVS_PACKET_ATTR_KEY: Present for all notifications. Contains the flow key * extracted from the packet as nested %OVS_KEY_ATTR_* attributes. This allows * userspace to adapt its flow setup strategy by comparing its notion of the * flow key against the kernel's. * @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet. Used * for %OVS_PACKET_CMD_EXECUTE. It has nested %OVS_ACTION_ATTR_* attributes. * Also used in upcall when %OVS_ACTION_ATTR_USERSPACE has optional * %OVS_USERSPACE_ATTR_ACTIONS attribute. * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an * %OVS_USERSPACE_ATTR_USERDATA attribute, with the same length and content * specified there. * @OVS_PACKET_ATTR_EGRESS_TUN_KEY: Present for an %OVS_PACKET_CMD_ACTION * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an * %OVS_USERSPACE_ATTR_EGRESS_TUN_PORT attribute, which is sent only if the * output port is actually a tunnel port. Contains the output tunnel key * extracted from the packet as nested %OVS_TUNNEL_KEY_ATTR_* attributes. * @OVS_PACKET_ATTR_MRU: Present for an %OVS_PACKET_CMD_ACTION and * @OVS_PACKET_ATTR_LEN: Packet size before truncation. * %OVS_PACKET_ATTR_USERSPACE action specify the Maximum received fragment * size. * * These attributes follow the &struct ovs_header within the Generic Netlink * payload for %OVS_PACKET_* commands. */ enum ovs_packet_attr { OVS_PACKET_ATTR_UNSPEC, OVS_PACKET_ATTR_PACKET, /* Packet data. */ OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */ OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ OVS_PACKET_ATTR_USERDATA, /* OVS_ACTION_ATTR_USERSPACE arg. */ OVS_PACKET_ATTR_EGRESS_TUN_KEY, /* Nested OVS_TUNNEL_KEY_ATTR_* attributes. */ OVS_PACKET_ATTR_UNUSED1, OVS_PACKET_ATTR_UNUSED2, OVS_PACKET_ATTR_PROBE, /* Packet operation is a feature probe, error logging should be suppressed. */ OVS_PACKET_ATTR_MRU, /* Maximum received IP fragment size. */ OVS_PACKET_ATTR_LEN, /* Packet size before truncation. */ __OVS_PACKET_ATTR_MAX }; #define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1) /* Virtual ports. */ #define OVS_VPORT_FAMILY "ovs_vport" #define OVS_VPORT_MCGROUP "ovs_vport" #define OVS_VPORT_VERSION 0x1 enum ovs_vport_cmd { OVS_VPORT_CMD_UNSPEC, OVS_VPORT_CMD_NEW, OVS_VPORT_CMD_DEL, OVS_VPORT_CMD_GET, OVS_VPORT_CMD_SET }; enum ovs_vport_type { OVS_VPORT_TYPE_UNSPEC, OVS_VPORT_TYPE_NETDEV, /* network device */ OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */ OVS_VPORT_TYPE_GRE, /* GRE tunnel. */ OVS_VPORT_TYPE_VXLAN, /* VXLAN tunnel. */ OVS_VPORT_TYPE_GENEVE, /* Geneve tunnel. */ __OVS_VPORT_TYPE_MAX }; #define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1) /** * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands. * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath. * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type * of vport. * @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes * plus a null terminator. * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information. * @OVS_VPORT_ATTR_UPCALL_PID: The array of Netlink socket pids in userspace * among which OVS_PACKET_CMD_MISS upcalls will be distributed for packets * received on this port. If this is a single-element array of value 0, * upcalls should not be sent. * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for * packets sent or received through the vport. * * These attributes follow the &struct ovs_header within the Generic Netlink * payload for %OVS_VPORT_* commands. * * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is * optional; if not specified a free port number is automatically selected. * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type * of vport. * * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to * look up the vport to operate on; otherwise dp_idx from the &struct * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport. */ enum ovs_vport_attr { OVS_VPORT_ATTR_UNSPEC, OVS_VPORT_ATTR_PORT_NO, /* u32 port number within datapath */ OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */ OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */ OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */ OVS_VPORT_ATTR_UPCALL_PID, /* array of u32 Netlink socket PIDs for */ /* receiving upcalls */ OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */ OVS_VPORT_ATTR_PAD, OVS_VPORT_ATTR_IFINDEX, OVS_VPORT_ATTR_NETNSID, __OVS_VPORT_ATTR_MAX }; #define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1) enum { OVS_VXLAN_EXT_UNSPEC, OVS_VXLAN_EXT_GBP, /* Flag or __u32 */ __OVS_VXLAN_EXT_MAX, }; #define OVS_VXLAN_EXT_MAX (__OVS_VXLAN_EXT_MAX - 1) /* OVS_VPORT_ATTR_OPTIONS attributes for tunnels. */ enum { OVS_TUNNEL_ATTR_UNSPEC, OVS_TUNNEL_ATTR_DST_PORT, /* 16-bit UDP port, used by L4 tunnels. */ OVS_TUNNEL_ATTR_EXTENSION, __OVS_TUNNEL_ATTR_MAX }; #define OVS_TUNNEL_ATTR_MAX (__OVS_TUNNEL_ATTR_MAX - 1) /* Flows. */ #define OVS_FLOW_FAMILY "ovs_flow" #define OVS_FLOW_MCGROUP "ovs_flow" #define OVS_FLOW_VERSION 0x1 enum ovs_flow_cmd { OVS_FLOW_CMD_UNSPEC, OVS_FLOW_CMD_NEW, OVS_FLOW_CMD_DEL, OVS_FLOW_CMD_GET, OVS_FLOW_CMD_SET }; struct ovs_flow_stats { __u64 n_packets; /* Number of matched packets. */ __u64 n_bytes; /* Number of matched bytes. */ }; enum ovs_key_attr { OVS_KEY_ATTR_UNSPEC, OVS_KEY_ATTR_ENCAP, /* Nested set of encapsulated attributes. */ OVS_KEY_ATTR_PRIORITY, /* u32 skb->priority */ OVS_KEY_ATTR_IN_PORT, /* u32 OVS dp port number */ OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */ OVS_KEY_ATTR_VLAN, /* be16 VLAN TCI */ OVS_KEY_ATTR_ETHERTYPE, /* be16 Ethernet type */ OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */ OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */ OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */ OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */ OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */ OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */ OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */ OVS_KEY_ATTR_ND, /* struct ovs_key_nd */ OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */ OVS_KEY_ATTR_TUNNEL, /* Nested set of ovs_tunnel attributes */ OVS_KEY_ATTR_SCTP, /* struct ovs_key_sctp */ OVS_KEY_ATTR_TCP_FLAGS, /* be16 TCP flags. */ OVS_KEY_ATTR_DP_HASH, /* u32 hash value. Value 0 indicates the hash is not computed by the datapath. */ OVS_KEY_ATTR_RECIRC_ID, /* u32 recirc id */ OVS_KEY_ATTR_MPLS, /* array of struct ovs_key_mpls. * The implementation may restrict * the accepted length of the array. */ OVS_KEY_ATTR_CT_STATE, /* u32 bitmask of OVS_CS_F_* */ OVS_KEY_ATTR_CT_ZONE, /* u16 connection tracking zone. */ OVS_KEY_ATTR_CT_MARK, /* u32 connection tracking mark */ OVS_KEY_ATTR_CT_LABELS, /* 16-octet connection tracking label */ OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV4, /* struct ovs_key_ct_tuple_ipv4 */ OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV6, /* struct ovs_key_ct_tuple_ipv6 */ OVS_KEY_ATTR_NSH, /* Nested set of ovs_nsh_key_* */ __OVS_KEY_ATTR_MAX }; #define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1) enum ovs_tunnel_key_attr { /* OVS_TUNNEL_KEY_ATTR_NONE, standard nl API requires this attribute! */ OVS_TUNNEL_KEY_ATTR_ID, /* be64 Tunnel ID */ OVS_TUNNEL_KEY_ATTR_IPV4_SRC, /* be32 src IP address. */ OVS_TUNNEL_KEY_ATTR_IPV4_DST, /* be32 dst IP address. */ OVS_TUNNEL_KEY_ATTR_TOS, /* u8 Tunnel IP ToS. */ OVS_TUNNEL_KEY_ATTR_TTL, /* u8 Tunnel IP TTL. */ OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT, /* No argument, set DF. */ OVS_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */ OVS_TUNNEL_KEY_ATTR_OAM, /* No argument. OAM frame. */ OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS, /* Array of Geneve options. */ OVS_TUNNEL_KEY_ATTR_TP_SRC, /* be16 src Transport Port. */ OVS_TUNNEL_KEY_ATTR_TP_DST, /* be16 dst Transport Port. */ OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS, /* Nested OVS_VXLAN_EXT_* */ OVS_TUNNEL_KEY_ATTR_IPV6_SRC, /* struct in6_addr src IPv6 address. */ OVS_TUNNEL_KEY_ATTR_IPV6_DST, /* struct in6_addr dst IPv6 address. */ OVS_TUNNEL_KEY_ATTR_PAD, OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS, /* struct erspan_metadata */ __OVS_TUNNEL_KEY_ATTR_MAX }; #define OVS_TUNNEL_KEY_ATTR_MAX (__OVS_TUNNEL_KEY_ATTR_MAX - 1) /** * enum ovs_frag_type - IPv4 and IPv6 fragment type * @OVS_FRAG_TYPE_NONE: Packet is not a fragment. * @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0. * @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset. * * Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct * ovs_key_ipv6. */ enum ovs_frag_type { OVS_FRAG_TYPE_NONE, OVS_FRAG_TYPE_FIRST, OVS_FRAG_TYPE_LATER, __OVS_FRAG_TYPE_MAX }; #define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1) struct ovs_key_ethernet { __u8 eth_src[ETH_ALEN]; __u8 eth_dst[ETH_ALEN]; }; struct ovs_key_mpls { __be32 mpls_lse; }; struct ovs_key_ipv4 { __be32 ipv4_src; __be32 ipv4_dst; __u8 ipv4_proto; __u8 ipv4_tos; __u8 ipv4_ttl; __u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */ }; struct ovs_key_ipv6 { __be32 ipv6_src[4]; __be32 ipv6_dst[4]; __be32 ipv6_label; /* 20-bits in least-significant bits. */ __u8 ipv6_proto; __u8 ipv6_tclass; __u8 ipv6_hlimit; __u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */ }; struct ovs_key_tcp { __be16 tcp_src; __be16 tcp_dst; }; struct ovs_key_udp { __be16 udp_src; __be16 udp_dst; }; struct ovs_key_sctp { __be16 sctp_src; __be16 sctp_dst; }; struct ovs_key_icmp { __u8 icmp_type; __u8 icmp_code; }; struct ovs_key_icmpv6 { __u8 icmpv6_type; __u8 icmpv6_code; }; struct ovs_key_arp { __be32 arp_sip; __be32 arp_tip; __be16 arp_op; __u8 arp_sha[ETH_ALEN]; __u8 arp_tha[ETH_ALEN]; }; struct ovs_key_nd { __be32 nd_target[4]; __u8 nd_sll[ETH_ALEN]; __u8 nd_tll[ETH_ALEN]; }; #define OVS_CT_LABELS_LEN_32 4 #define OVS_CT_LABELS_LEN (OVS_CT_LABELS_LEN_32 * sizeof(__u32)) struct ovs_key_ct_labels { union { __u8 ct_labels[OVS_CT_LABELS_LEN]; __u32 ct_labels_32[OVS_CT_LABELS_LEN_32]; }; }; /* OVS_KEY_ATTR_CT_STATE flags */ #define OVS_CS_F_NEW 0x01 /* Beginning of a new connection. */ #define OVS_CS_F_ESTABLISHED 0x02 /* Part of an existing connection. */ #define OVS_CS_F_RELATED 0x04 /* Related to an established * connection. */ #define OVS_CS_F_REPLY_DIR 0x08 /* Flow is in the reply direction. */ #define OVS_CS_F_INVALID 0x10 /* Could not track connection. */ #define OVS_CS_F_TRACKED 0x20 /* Conntrack has occurred. */ #define OVS_CS_F_SRC_NAT 0x40 /* Packet's source address/port was * mangled by NAT. */ #define OVS_CS_F_DST_NAT 0x80 /* Packet's destination address/port * was mangled by NAT. */ #define OVS_CS_F_NAT_MASK (OVS_CS_F_SRC_NAT | OVS_CS_F_DST_NAT) struct ovs_key_ct_tuple_ipv4 { __be32 ipv4_src; __be32 ipv4_dst; __be16 src_port; __be16 dst_port; __u8 ipv4_proto; }; struct ovs_key_ct_tuple_ipv6 { __be32 ipv6_src[4]; __be32 ipv6_dst[4]; __be16 src_port; __be16 dst_port; __u8 ipv6_proto; }; enum ovs_nsh_key_attr { OVS_NSH_KEY_ATTR_UNSPEC, OVS_NSH_KEY_ATTR_BASE, /* struct ovs_nsh_key_base. */ OVS_NSH_KEY_ATTR_MD1, /* struct ovs_nsh_key_md1. */ OVS_NSH_KEY_ATTR_MD2, /* variable-length octets for MD type 2. */ __OVS_NSH_KEY_ATTR_MAX }; #define OVS_NSH_KEY_ATTR_MAX (__OVS_NSH_KEY_ATTR_MAX - 1) struct ovs_nsh_key_base { __u8 flags; __u8 ttl; __u8 mdtype; __u8 np; __be32 path_hdr; }; #define NSH_MD1_CONTEXT_SIZE 4 struct ovs_nsh_key_md1 { __be32 context[NSH_MD1_CONTEXT_SIZE]; }; /** * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands. * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow * key. Always present in notifications. Required for all requests (except * dumps). * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying * the actions to take for packets that match the key. Always present in * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for * %OVS_FLOW_CMD_SET requests. An %OVS_FLOW_CMD_SET without * %OVS_FLOW_ATTR_ACTIONS will not modify the actions. To clear the actions, * an %OVS_FLOW_ATTR_ACTIONS without any nested attributes must be given. * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this * flow. Present in notifications if the stats would be nonzero. Ignored in * requests. * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the * TCP flags seen on packets in this flow. Only present in notifications for * TCP flows, and only if it would be nonzero. Ignored in requests. * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on * the system monotonic clock, at which a packet was last processed for this * flow. Only present in notifications if a packet has been processed for this * flow. Ignored in requests. * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the * last-used time, accumulated TCP flags, and statistics for this flow. * Otherwise ignored in requests. Never present in notifications. * @OVS_FLOW_ATTR_MASK: Nested %OVS_KEY_ATTR_* attributes specifying the * mask bits for wildcarded flow match. Mask bit value '1' specifies exact * match with corresponding flow key bit, while mask bit value '0' specifies * a wildcarded match. Omitting attribute is treated as wildcarding all * corresponding fields. Optional for all requests. If not present, * all flow key bits are exact match bits. * @OVS_FLOW_ATTR_UFID: A value between 1-16 octets specifying a unique * identifier for the flow. Causes the flow to be indexed by this value rather * than the value of the %OVS_FLOW_ATTR_KEY attribute. Optional for all * requests. Present in notifications if the flow was created with this * attribute. * @OVS_FLOW_ATTR_UFID_FLAGS: A 32-bit value of OR'd %OVS_UFID_F_* * flags that provide alternative semantics for flow installation and * retrieval. Optional for all requests. * * These attributes follow the &struct ovs_header within the Generic Netlink * payload for %OVS_FLOW_* commands. */ enum ovs_flow_attr { OVS_FLOW_ATTR_UNSPEC, OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */ OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */ OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */ OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */ OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */ OVS_FLOW_ATTR_MASK, /* Sequence of OVS_KEY_ATTR_* attributes. */ OVS_FLOW_ATTR_PROBE, /* Flow operation is a feature probe, error * logging should be suppressed. */ OVS_FLOW_ATTR_UFID, /* Variable length unique flow identifier. */ OVS_FLOW_ATTR_UFID_FLAGS,/* u32 of OVS_UFID_F_*. */ OVS_FLOW_ATTR_PAD, __OVS_FLOW_ATTR_MAX }; #define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1) /** * Omit attributes for notifications. * * If a datapath request contains an %OVS_UFID_F_OMIT_* flag, then the datapath * may omit the corresponding %OVS_FLOW_ATTR_* from the response. */ #define OVS_UFID_F_OMIT_KEY (1 << 0) #define OVS_UFID_F_OMIT_MASK (1 << 1) #define OVS_UFID_F_OMIT_ACTIONS (1 << 2) /** * enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action. * @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with * @OVS_ACTION_ATTR_SAMPLE. A value of 0 samples no packets, a value of * %UINT32_MAX samples all packets and intermediate values sample intermediate * fractions of packets. * @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event. * Actions are passed as nested attributes. * * Executes the specified actions with the given probability on a per-packet * basis. */ enum ovs_sample_attr { OVS_SAMPLE_ATTR_UNSPEC, OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */ OVS_SAMPLE_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ __OVS_SAMPLE_ATTR_MAX, }; #define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1) /** * enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action. * @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION * message should be sent. Required. * @OVS_USERSPACE_ATTR_USERDATA: If present, its variable-length argument is * copied to the %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA. * @OVS_USERSPACE_ATTR_EGRESS_TUN_PORT: If present, u32 output port to get * tunnel info. * @OVS_USERSPACE_ATTR_ACTIONS: If present, send actions with upcall. */ enum ovs_userspace_attr { OVS_USERSPACE_ATTR_UNSPEC, OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */ OVS_USERSPACE_ATTR_USERDATA, /* Optional user-specified cookie. */ OVS_USERSPACE_ATTR_EGRESS_TUN_PORT, /* Optional, u32 output port * to get tunnel info. */ OVS_USERSPACE_ATTR_ACTIONS, /* Optional flag to get actions. */ __OVS_USERSPACE_ATTR_MAX }; #define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1) struct ovs_action_trunc { __u32 max_len; /* Max packet size in bytes. */ }; /** * struct ovs_action_push_mpls - %OVS_ACTION_ATTR_PUSH_MPLS action argument. * @mpls_lse: MPLS label stack entry to push. * @mpls_ethertype: Ethertype to set in the encapsulating ethernet frame. * * The only values @mpls_ethertype should ever be given are %ETH_P_MPLS_UC and * %ETH_P_MPLS_MC, indicating MPLS unicast or multicast. Other are rejected. */ struct ovs_action_push_mpls { __be32 mpls_lse; __be16 mpls_ethertype; /* Either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC */ }; /** * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument. * @vlan_tpid: Tag protocol identifier (TPID) to push. * @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set * (but it will not be set in the 802.1Q header that is pushed). * * The @vlan_tpid value is typically %ETH_P_8021Q or %ETH_P_8021AD. * The only acceptable TPID values are those that the kernel module also parses * as 802.1Q or 802.1AD headers, to prevent %OVS_ACTION_ATTR_PUSH_VLAN followed * by %OVS_ACTION_ATTR_POP_VLAN from having surprising results. */ struct ovs_action_push_vlan { __be16 vlan_tpid; /* 802.1Q or 802.1ad TPID. */ __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */ }; /* Data path hash algorithm for computing Datapath hash. * * The algorithm type only specifies the fields in a flow * will be used as part of the hash. Each datapath is free * to use its own hash algorithm. The hash value will be * opaque to the user space daemon. */ enum ovs_hash_alg { OVS_HASH_ALG_L4, }; /* * struct ovs_action_hash - %OVS_ACTION_ATTR_HASH action argument. * @hash_alg: Algorithm used to compute hash prior to recirculation. * @hash_basis: basis used for computing hash. */ struct ovs_action_hash { __u32 hash_alg; /* One of ovs_hash_alg. */ __u32 hash_basis; }; /** * enum ovs_ct_attr - Attributes for %OVS_ACTION_ATTR_CT action. * @OVS_CT_ATTR_COMMIT: If present, commits the connection to the conntrack * table. This allows future packets for the same connection to be identified * as 'established' or 'related'. The flow key for the current packet will * retain the pre-commit connection state. * @OVS_CT_ATTR_ZONE: u16 connection tracking zone. * @OVS_CT_ATTR_MARK: u32 value followed by u32 mask. For each bit set in the * mask, the corresponding bit in the value is copied to the connection * tracking mark field in the connection. * @OVS_CT_ATTR_LABELS: %OVS_CT_LABELS_LEN value followed by %OVS_CT_LABELS_LEN * mask. For each bit set in the mask, the corresponding bit in the value is * copied to the connection tracking label field in the connection. * @OVS_CT_ATTR_HELPER: variable length string defining conntrack ALG. * @OVS_CT_ATTR_NAT: Nested OVS_NAT_ATTR_* for performing L3 network address * translation (NAT) on the packet. * @OVS_CT_ATTR_FORCE_COMMIT: Like %OVS_CT_ATTR_COMMIT, but instead of doing * nothing if the connection is already committed will check that the current * packet is in conntrack entry's original direction. If directionality does * not match, will delete the existing conntrack entry and commit a new one. * @OVS_CT_ATTR_EVENTMASK: Mask of bits indicating which conntrack event types * (enum ip_conntrack_events IPCT_*) should be reported. For any bit set to * zero, the corresponding event type is not generated. Default behavior * depends on system configuration, but typically all event types are * generated, hence listening on NFNLGRP_CONNTRACK_UPDATE events may get a lot * of events. Explicitly passing this attribute allows limiting the updates * received to the events of interest. The bit 1 << IPCT_NEW, 1 << * IPCT_RELATED, and 1 << IPCT_DESTROY must be set to ones for those events to * be received on NFNLGRP_CONNTRACK_NEW and NFNLGRP_CONNTRACK_DESTROY groups, * respectively. Remaining bits control the changes for which an event is * delivered on the NFNLGRP_CONNTRACK_UPDATE group. */ enum ovs_ct_attr { OVS_CT_ATTR_UNSPEC, OVS_CT_ATTR_COMMIT, /* No argument, commits connection. */ OVS_CT_ATTR_ZONE, /* u16 zone id. */ OVS_CT_ATTR_MARK, /* mark to associate with this connection. */ OVS_CT_ATTR_LABELS, /* labels to associate with this connection. */ OVS_CT_ATTR_HELPER, /* netlink helper to assist detection of related connections. */ OVS_CT_ATTR_NAT, /* Nested OVS_NAT_ATTR_* */ OVS_CT_ATTR_FORCE_COMMIT, /* No argument */ OVS_CT_ATTR_EVENTMASK, /* u32 mask of IPCT_* events. */ __OVS_CT_ATTR_MAX }; #define OVS_CT_ATTR_MAX (__OVS_CT_ATTR_MAX - 1) /** * enum ovs_nat_attr - Attributes for %OVS_CT_ATTR_NAT. * * @OVS_NAT_ATTR_SRC: Flag for Source NAT (mangle source address/port). * @OVS_NAT_ATTR_DST: Flag for Destination NAT (mangle destination * address/port). Only one of (@OVS_NAT_ATTR_SRC, @OVS_NAT_ATTR_DST) may be * specified. Effective only for packets for ct_state NEW connections. * Packets of committed connections are mangled by the NAT action according to * the committed NAT type regardless of the flags specified. As a corollary, a * NAT action without a NAT type flag will only mangle packets of committed * connections. The following NAT attributes only apply for NEW * (non-committed) connections, and they may be included only when the CT * action has the @OVS_CT_ATTR_COMMIT flag and either @OVS_NAT_ATTR_SRC or * @OVS_NAT_ATTR_DST is also included. * @OVS_NAT_ATTR_IP_MIN: struct in_addr or struct in6_addr * @OVS_NAT_ATTR_IP_MAX: struct in_addr or struct in6_addr * @OVS_NAT_ATTR_PROTO_MIN: u16 L4 protocol specific lower boundary (port) * @OVS_NAT_ATTR_PROTO_MAX: u16 L4 protocol specific upper boundary (port) * @OVS_NAT_ATTR_PERSISTENT: Flag for persistent IP mapping across reboots * @OVS_NAT_ATTR_PROTO_HASH: Flag for pseudo random L4 port mapping (MD5) * @OVS_NAT_ATTR_PROTO_RANDOM: Flag for fully randomized L4 port mapping */ enum ovs_nat_attr { OVS_NAT_ATTR_UNSPEC, OVS_NAT_ATTR_SRC, OVS_NAT_ATTR_DST, OVS_NAT_ATTR_IP_MIN, OVS_NAT_ATTR_IP_MAX, OVS_NAT_ATTR_PROTO_MIN, OVS_NAT_ATTR_PROTO_MAX, OVS_NAT_ATTR_PERSISTENT, OVS_NAT_ATTR_PROTO_HASH, OVS_NAT_ATTR_PROTO_RANDOM, __OVS_NAT_ATTR_MAX, }; #define OVS_NAT_ATTR_MAX (__OVS_NAT_ATTR_MAX - 1) /* * struct ovs_action_push_eth - %OVS_ACTION_ATTR_PUSH_ETH action argument. * @addresses: Source and destination MAC addresses. * @eth_type: Ethernet type */ struct ovs_action_push_eth { struct ovs_key_ethernet addresses; }; /** * enum ovs_action_attr - Action types. * * @OVS_ACTION_ATTR_OUTPUT: Output packet to port. * @OVS_ACTION_ATTR_TRUNC: Output packet to port with truncated packet size. * @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested * %OVS_USERSPACE_ATTR_* attributes. * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header. The * single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its * value. * @OVS_ACTION_ATTR_SET_MASKED: Replaces the contents of an existing header. A * nested %OVS_KEY_ATTR_* attribute specifies a header to modify, its value, * and a mask. For every bit set in the mask, the corresponding bit value * is copied from the value to the packet header field, rest of the bits are * left unchanged. The non-masked value bits must be passed in as zeroes. * Masking is not supported for the %OVS_KEY_ATTR_TUNNEL attribute. * @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q or 802.1ad header * onto the packet. * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q or 802.1ad header * from the packet. * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in * the nested %OVS_SAMPLE_ATTR_* attributes. * @OVS_ACTION_ATTR_PUSH_MPLS: Push a new MPLS label stack entry onto the * top of the packets MPLS label stack. Set the ethertype of the * encapsulating frame to either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC to * indicate the new packet contents. * @OVS_ACTION_ATTR_POP_MPLS: Pop an MPLS label stack entry off of the * packet's MPLS label stack. Set the encapsulating frame's ethertype to * indicate the new packet contents. This could potentially still be * %ETH_P_MPLS if the resulting MPLS label stack is not empty. If there * is no MPLS label stack, as determined by ethertype, no action is taken. * @OVS_ACTION_ATTR_CT: Track the connection. Populate the conntrack-related * entries in the flow key. * @OVS_ACTION_ATTR_PUSH_ETH: Push a new outermost Ethernet header onto the * packet. * @OVS_ACTION_ATTR_POP_ETH: Pop the outermost Ethernet header off the * packet. * @OVS_ACTION_ATTR_CT_CLEAR: Clear conntrack state from the packet. * @OVS_ACTION_ATTR_PUSH_NSH: push NSH header to the packet. * @OVS_ACTION_ATTR_POP_NSH: pop the outermost NSH header off the packet. * @OVS_ACTION_ATTR_METER: Run packet through a meter, which may drop the * packet, or modify the packet (e.g., change the DSCP field). * @OVS_ACTION_ATTR_CLONE: make a copy of the packet and execute a list of * actions without affecting the original packet and key. * * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all * fields within a header are modifiable, e.g. the IPv4 protocol and fragment * type may not be changed. * * @OVS_ACTION_ATTR_SET_TO_MASKED: Kernel internal masked set action translated * from the @OVS_ACTION_ATTR_SET. */ enum ovs_action_attr { OVS_ACTION_ATTR_UNSPEC, OVS_ACTION_ATTR_OUTPUT, /* u32 port number. */ OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */ OVS_ACTION_ATTR_SET, /* One nested OVS_KEY_ATTR_*. */ OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */ OVS_ACTION_ATTR_POP_VLAN, /* No argument. */ OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */ OVS_ACTION_ATTR_RECIRC, /* u32 recirc_id. */ OVS_ACTION_ATTR_HASH, /* struct ovs_action_hash. */ OVS_ACTION_ATTR_PUSH_MPLS, /* struct ovs_action_push_mpls. */ OVS_ACTION_ATTR_POP_MPLS, /* __be16 ethertype. */ OVS_ACTION_ATTR_SET_MASKED, /* One nested OVS_KEY_ATTR_* including * data immediately followed by a mask. * The data must be zero for the unmasked * bits. */ OVS_ACTION_ATTR_CT, /* Nested OVS_CT_ATTR_* . */ OVS_ACTION_ATTR_TRUNC, /* u32 struct ovs_action_trunc. */ OVS_ACTION_ATTR_PUSH_ETH, /* struct ovs_action_push_eth. */ OVS_ACTION_ATTR_POP_ETH, /* No argument. */ OVS_ACTION_ATTR_CT_CLEAR, /* No argument. */ OVS_ACTION_ATTR_PUSH_NSH, /* Nested OVS_NSH_KEY_ATTR_*. */ OVS_ACTION_ATTR_POP_NSH, /* No argument. */ OVS_ACTION_ATTR_METER, /* u32 meter ID. */ OVS_ACTION_ATTR_CLONE, /* Nested OVS_CLONE_ATTR_*. */ __OVS_ACTION_ATTR_MAX, /* Nothing past this will be accepted * from userspace. */ }; #define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1) /* Meters. */ #define OVS_METER_FAMILY "ovs_meter" #define OVS_METER_MCGROUP "ovs_meter" #define OVS_METER_VERSION 0x1 enum ovs_meter_cmd { OVS_METER_CMD_UNSPEC, OVS_METER_CMD_FEATURES, /* Get features supported by the datapath. */ OVS_METER_CMD_SET, /* Add or modify a meter. */ OVS_METER_CMD_DEL, /* Delete a meter. */ OVS_METER_CMD_GET /* Get meter stats. */ }; enum ovs_meter_attr { OVS_METER_ATTR_UNSPEC, OVS_METER_ATTR_ID, /* u32 meter ID within datapath. */ OVS_METER_ATTR_KBPS, /* No argument. If set, units in kilobits * per second. Otherwise, units in * packets per second. */ OVS_METER_ATTR_STATS, /* struct ovs_flow_stats for the meter. */ OVS_METER_ATTR_BANDS, /* Nested attributes for meter bands. */ OVS_METER_ATTR_USED, /* u64 msecs last used in monotonic time. */ OVS_METER_ATTR_CLEAR, /* Flag to clear stats, used. */ OVS_METER_ATTR_MAX_METERS, /* u32 number of meters supported. */ OVS_METER_ATTR_MAX_BANDS, /* u32 max number of bands per meter. */ OVS_METER_ATTR_PAD, __OVS_METER_ATTR_MAX }; #define OVS_METER_ATTR_MAX (__OVS_METER_ATTR_MAX - 1) enum ovs_band_attr { OVS_BAND_ATTR_UNSPEC, OVS_BAND_ATTR_TYPE, /* u32 OVS_METER_BAND_TYPE_* constant. */ OVS_BAND_ATTR_RATE, /* u32 band rate in meter units (see above). */ OVS_BAND_ATTR_BURST, /* u32 burst size in meter units. */ OVS_BAND_ATTR_STATS, /* struct ovs_flow_stats for the band. */ __OVS_BAND_ATTR_MAX }; #define OVS_BAND_ATTR_MAX (__OVS_BAND_ATTR_MAX - 1) enum ovs_meter_band_type { OVS_METER_BAND_TYPE_UNSPEC, OVS_METER_BAND_TYPE_DROP, /* Drop exceeding packets. */ __OVS_METER_BAND_TYPE_MAX }; #define OVS_METER_BAND_TYPE_MAX (__OVS_METER_BAND_TYPE_MAX - 1) /* Conntrack limit */ #define OVS_CT_LIMIT_FAMILY "ovs_ct_limit" #define OVS_CT_LIMIT_MCGROUP "ovs_ct_limit" #define OVS_CT_LIMIT_VERSION 0x1 enum ovs_ct_limit_cmd { OVS_CT_LIMIT_CMD_UNSPEC, OVS_CT_LIMIT_CMD_SET, /* Add or modify ct limit. */ OVS_CT_LIMIT_CMD_DEL, /* Delete ct limit. */ OVS_CT_LIMIT_CMD_GET /* Get ct limit. */ }; enum ovs_ct_limit_attr { OVS_CT_LIMIT_ATTR_UNSPEC, OVS_CT_LIMIT_ATTR_ZONE_LIMIT, /* Nested struct ovs_zone_limit. */ __OVS_CT_LIMIT_ATTR_MAX }; #define OVS_CT_LIMIT_ATTR_MAX (__OVS_CT_LIMIT_ATTR_MAX - 1) #define OVS_ZONE_LIMIT_DEFAULT_ZONE -1 struct ovs_zone_limit { int zone_id; __u32 limit; __u32 count; }; #endif /* _LINUX_OPENVSWITCH_H */ �������������������������������������������������������������������������������������������������������������������������������linux/virtio_9p.h�����������������������������������������������������������������������������������0000644�����������������00000003771�14763166027�0010024 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _LINUX_VIRTIO_9P_H #define _LINUX_VIRTIO_9P_H /* This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <linux/types.h> #include <linux/virtio_ids.h> #include <linux/virtio_config.h> /* The feature bitmap for virtio 9P */ /* The mount point is specified in a config variable */ #define VIRTIO_9P_MOUNT_TAG 0 struct virtio_9p_config { /* length of the tag name */ __u16 tag_len; /* non-NULL terminated tag name */ __u8 tag[0]; } __attribute__((packed)); #endif /* _LINUX_VIRTIO_9P_H */ �������linux/flat.h����������������������������������������������������������������������������������������0000644�����������������00000004144�14763166027�0007021 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2002-2003 David McCullough <davidm@snapgear.com> * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com> * The Silver Hammer Group, Ltd. * * This file provides the definitions and structures needed to * support uClinux flat-format executables. */ #ifndef _LINUX_FLAT_H #define _LINUX_FLAT_H #define FLAT_VERSION 0x00000004L #ifdef CONFIG_BINFMT_SHARED_FLAT #define MAX_SHARED_LIBS (4) #else #define MAX_SHARED_LIBS (1) #endif /* * To make everything easier to port and manage cross platform * development, all fields are in network byte order. */ struct flat_hdr { char magic[4]; unsigned long rev; /* version (as above) */ unsigned long entry; /* Offset of first executable instruction with text segment from beginning of file */ unsigned long data_start; /* Offset of data segment from beginning of file */ unsigned long data_end; /* Offset of end of data segment from beginning of file */ unsigned long bss_end; /* Offset of end of bss segment from beginning of file */ /* (It is assumed that data_end through bss_end forms the bss segment.) */ unsigned long stack_size; /* Size of stack, in bytes */ unsigned long reloc_start; /* Offset of relocation records from beginning of file */ unsigned long reloc_count; /* Number of relocation records */ unsigned long flags; unsigned long build_date; /* When the program/library was built */ unsigned long filler[5]; /* Reservered, set to zero */ }; #define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ #define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */ #define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */ #define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */ #define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */ #endif /* _LINUX_FLAT_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/ip_vs.h���������������������������������������������������������������������������������������0000644�����������������00000032477�14763166027�0007225 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * IP Virtual Server * data structure and functionality definitions */ #ifndef _IP_VS_H #define _IP_VS_H #include <linux/types.h> /* For __beXX types in userland */ #define IP_VS_VERSION_CODE 0x010201 #define NVERSION(version) \ (version >> 16) & 0xFF, \ (version >> 8) & 0xFF, \ version & 0xFF /* * Virtual Service Flags */ #define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */ #define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */ #define IP_VS_SVC_F_ONEPACKET 0x0004 /* one-packet scheduling */ #define IP_VS_SVC_F_SCHED1 0x0008 /* scheduler flag 1 */ #define IP_VS_SVC_F_SCHED2 0x0010 /* scheduler flag 2 */ #define IP_VS_SVC_F_SCHED3 0x0020 /* scheduler flag 3 */ #define IP_VS_SVC_F_SCHED_SH_FALLBACK IP_VS_SVC_F_SCHED1 /* SH fallback */ #define IP_VS_SVC_F_SCHED_SH_PORT IP_VS_SVC_F_SCHED2 /* SH use port */ /* * Destination Server Flags */ #define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */ #define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */ /* * IPVS sync daemon states */ #define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */ #define IP_VS_STATE_MASTER 0x0001 /* started as master */ #define IP_VS_STATE_BACKUP 0x0002 /* started as backup */ /* * IPVS socket options */ #define IP_VS_BASE_CTL (64+1024+64) /* base */ #define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */ #define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1) #define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2) #define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3) #define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4) #define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5) #define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6) #define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7) #define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8) #define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9) #define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10) #define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11) #define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12) #define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13) #define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14) #define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15) #define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO #define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL #define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1) #define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2) #define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3) #define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4) #define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */ #define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6) #define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7) #define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON /* * IPVS Connection Flags * Only flags 0..15 are sent to backup server */ #define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */ #define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */ #define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */ #define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */ #define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */ #define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */ #define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */ #define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */ #define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */ #define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */ #define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */ #define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */ #define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */ #define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */ #define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */ #define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */ /* Initial bits allowed in backup server */ #define IP_VS_CONN_F_BACKUP_MASK (IP_VS_CONN_F_FWD_MASK | \ IP_VS_CONN_F_NOOUTPUT | \ IP_VS_CONN_F_INACTIVE | \ IP_VS_CONN_F_SEQ_MASK | \ IP_VS_CONN_F_NO_CPORT | \ IP_VS_CONN_F_TEMPLATE \ ) /* Bits allowed to update in backup server */ #define IP_VS_CONN_F_BACKUP_UPD_MASK (IP_VS_CONN_F_INACTIVE | \ IP_VS_CONN_F_SEQ_MASK) /* Flags that are not sent to backup server start from bit 16 */ #define IP_VS_CONN_F_NFCT (1 << 16) /* use netfilter conntrack */ /* Connection flags from destination that can be changed by user space */ #define IP_VS_CONN_F_DEST_MASK (IP_VS_CONN_F_FWD_MASK | \ IP_VS_CONN_F_ONE_PACKET | \ IP_VS_CONN_F_NFCT | \ 0) #define IP_VS_SCHEDNAME_MAXLEN 16 #define IP_VS_PENAME_MAXLEN 16 #define IP_VS_IFNAME_MAXLEN 16 #define IP_VS_PEDATA_MAXLEN 255 /* * The struct ip_vs_service_user and struct ip_vs_dest_user are * used to set IPVS rules through setsockopt. */ struct ip_vs_service_user { /* virtual service addresses */ __u16 protocol; __be32 addr; /* virtual ip address */ __be16 port; __u32 fwmark; /* firwall mark of service */ /* virtual service options */ char sched_name[IP_VS_SCHEDNAME_MAXLEN]; unsigned int flags; /* virtual service flags */ unsigned int timeout; /* persistent timeout in sec */ __be32 netmask; /* persistent netmask */ }; struct ip_vs_dest_user { /* destination server address */ __be32 addr; __be16 port; /* real server options */ unsigned int conn_flags; /* connection flags */ int weight; /* destination weight */ /* thresholds for active connections */ __u32 u_threshold; /* upper threshold */ __u32 l_threshold; /* lower threshold */ }; /* * IPVS statistics object (for user space) */ struct ip_vs_stats_user { __u32 conns; /* connections scheduled */ __u32 inpkts; /* incoming packets */ __u32 outpkts; /* outgoing packets */ __u64 inbytes; /* incoming bytes */ __u64 outbytes; /* outgoing bytes */ __u32 cps; /* current connection rate */ __u32 inpps; /* current in packet rate */ __u32 outpps; /* current out packet rate */ __u32 inbps; /* current in byte rate */ __u32 outbps; /* current out byte rate */ }; /* The argument to IP_VS_SO_GET_INFO */ struct ip_vs_getinfo { /* version number */ unsigned int version; /* size of connection hash table */ unsigned int size; /* number of virtual services */ unsigned int num_services; }; /* The argument to IP_VS_SO_GET_SERVICE */ struct ip_vs_service_entry { /* which service: user fills in these */ __u16 protocol; __be32 addr; /* virtual address */ __be16 port; __u32 fwmark; /* firwall mark of service */ /* service options */ char sched_name[IP_VS_SCHEDNAME_MAXLEN]; unsigned int flags; /* virtual service flags */ unsigned int timeout; /* persistent timeout */ __be32 netmask; /* persistent netmask */ /* number of real servers */ unsigned int num_dests; /* statistics */ struct ip_vs_stats_user stats; }; struct ip_vs_dest_entry { __be32 addr; /* destination address */ __be16 port; unsigned int conn_flags; /* connection flags */ int weight; /* destination weight */ __u32 u_threshold; /* upper threshold */ __u32 l_threshold; /* lower threshold */ __u32 activeconns; /* active connections */ __u32 inactconns; /* inactive connections */ __u32 persistconns; /* persistent connections */ /* statistics */ struct ip_vs_stats_user stats; }; /* The argument to IP_VS_SO_GET_DESTS */ struct ip_vs_get_dests { /* which service: user fills in these */ __u16 protocol; __be32 addr; /* virtual address */ __be16 port; __u32 fwmark; /* firwall mark of service */ /* number of real servers */ unsigned int num_dests; /* the real servers */ struct ip_vs_dest_entry entrytable[0]; }; /* The argument to IP_VS_SO_GET_SERVICES */ struct ip_vs_get_services { /* number of virtual services */ unsigned int num_services; /* service table */ struct ip_vs_service_entry entrytable[0]; }; /* The argument to IP_VS_SO_GET_TIMEOUT */ struct ip_vs_timeout_user { int tcp_timeout; int tcp_fin_timeout; int udp_timeout; }; /* The argument to IP_VS_SO_GET_DAEMON */ struct ip_vs_daemon_user { /* sync daemon state (master/backup) */ int state; /* multicast interface name */ char mcast_ifn[IP_VS_IFNAME_MAXLEN]; /* SyncID we belong to */ int syncid; }; /* * * IPVS Generic Netlink interface definitions * */ /* Generic Netlink family info */ #define IPVS_GENL_NAME "IPVS" #define IPVS_GENL_VERSION 0x1 struct ip_vs_flags { __u32 flags; __u32 mask; }; /* Generic Netlink command attributes */ enum { IPVS_CMD_UNSPEC = 0, IPVS_CMD_NEW_SERVICE, /* add service */ IPVS_CMD_SET_SERVICE, /* modify service */ IPVS_CMD_DEL_SERVICE, /* delete service */ IPVS_CMD_GET_SERVICE, /* get service info */ IPVS_CMD_NEW_DEST, /* add destination */ IPVS_CMD_SET_DEST, /* modify destination */ IPVS_CMD_DEL_DEST, /* delete destination */ IPVS_CMD_GET_DEST, /* get destination info */ IPVS_CMD_NEW_DAEMON, /* start sync daemon */ IPVS_CMD_DEL_DAEMON, /* stop sync daemon */ IPVS_CMD_GET_DAEMON, /* get sync daemon status */ IPVS_CMD_SET_CONFIG, /* set config settings */ IPVS_CMD_GET_CONFIG, /* get config settings */ IPVS_CMD_SET_INFO, /* only used in GET_INFO reply */ IPVS_CMD_GET_INFO, /* get general IPVS info */ IPVS_CMD_ZERO, /* zero all counters and stats */ IPVS_CMD_FLUSH, /* flush services and dests */ __IPVS_CMD_MAX, }; #define IPVS_CMD_MAX (__IPVS_CMD_MAX - 1) /* Attributes used in the first level of commands */ enum { IPVS_CMD_ATTR_UNSPEC = 0, IPVS_CMD_ATTR_SERVICE, /* nested service attribute */ IPVS_CMD_ATTR_DEST, /* nested destination attribute */ IPVS_CMD_ATTR_DAEMON, /* nested sync daemon attribute */ IPVS_CMD_ATTR_TIMEOUT_TCP, /* TCP connection timeout */ IPVS_CMD_ATTR_TIMEOUT_TCP_FIN, /* TCP FIN wait timeout */ IPVS_CMD_ATTR_TIMEOUT_UDP, /* UDP timeout */ __IPVS_CMD_ATTR_MAX, }; #define IPVS_CMD_ATTR_MAX (__IPVS_CMD_ATTR_MAX - 1) /* * Attributes used to describe a service * * Used inside nested attribute IPVS_CMD_ATTR_SERVICE */ enum { IPVS_SVC_ATTR_UNSPEC = 0, IPVS_SVC_ATTR_AF, /* address family */ IPVS_SVC_ATTR_PROTOCOL, /* virtual service protocol */ IPVS_SVC_ATTR_ADDR, /* virtual service address */ IPVS_SVC_ATTR_PORT, /* virtual service port */ IPVS_SVC_ATTR_FWMARK, /* firewall mark of service */ IPVS_SVC_ATTR_SCHED_NAME, /* name of scheduler */ IPVS_SVC_ATTR_FLAGS, /* virtual service flags */ IPVS_SVC_ATTR_TIMEOUT, /* persistent timeout */ IPVS_SVC_ATTR_NETMASK, /* persistent netmask */ IPVS_SVC_ATTR_STATS, /* nested attribute for service stats */ IPVS_SVC_ATTR_PE_NAME, /* name of ct retriever */ IPVS_SVC_ATTR_STATS64, /* nested attribute for service stats */ __IPVS_SVC_ATTR_MAX, }; #define IPVS_SVC_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1) /* * Attributes used to describe a destination (real server) * * Used inside nested attribute IPVS_CMD_ATTR_DEST */ enum { IPVS_DEST_ATTR_UNSPEC = 0, IPVS_DEST_ATTR_ADDR, /* real server address */ IPVS_DEST_ATTR_PORT, /* real server port */ IPVS_DEST_ATTR_FWD_METHOD, /* forwarding method */ IPVS_DEST_ATTR_WEIGHT, /* destination weight */ IPVS_DEST_ATTR_U_THRESH, /* upper threshold */ IPVS_DEST_ATTR_L_THRESH, /* lower threshold */ IPVS_DEST_ATTR_ACTIVE_CONNS, /* active connections */ IPVS_DEST_ATTR_INACT_CONNS, /* inactive connections */ IPVS_DEST_ATTR_PERSIST_CONNS, /* persistent connections */ IPVS_DEST_ATTR_STATS, /* nested attribute for dest stats */ IPVS_DEST_ATTR_ADDR_FAMILY, /* Address family of address */ IPVS_DEST_ATTR_STATS64, /* nested attribute for dest stats */ __IPVS_DEST_ATTR_MAX, }; #define IPVS_DEST_ATTR_MAX (__IPVS_DEST_ATTR_MAX - 1) /* * Attributes describing a sync daemon * * Used inside nested attribute IPVS_CMD_ATTR_DAEMON */ enum { IPVS_DAEMON_ATTR_UNSPEC = 0, IPVS_DAEMON_ATTR_STATE, /* sync daemon state (master/backup) */ IPVS_DAEMON_ATTR_MCAST_IFN, /* multicast interface name */ IPVS_DAEMON_ATTR_SYNC_ID, /* SyncID we belong to */ IPVS_DAEMON_ATTR_SYNC_MAXLEN, /* UDP Payload Size */ IPVS_DAEMON_ATTR_MCAST_GROUP, /* IPv4 Multicast Address */ IPVS_DAEMON_ATTR_MCAST_GROUP6, /* IPv6 Multicast Address */ IPVS_DAEMON_ATTR_MCAST_PORT, /* Multicast Port (base) */ IPVS_DAEMON_ATTR_MCAST_TTL, /* Multicast TTL */ __IPVS_DAEMON_ATTR_MAX, }; #define IPVS_DAEMON_ATTR_MAX (__IPVS_DAEMON_ATTR_MAX - 1) /* * Attributes used to describe service or destination entry statistics * * Used inside nested attributes IPVS_SVC_ATTR_STATS, IPVS_DEST_ATTR_STATS, * IPVS_SVC_ATTR_STATS64 and IPVS_DEST_ATTR_STATS64. */ enum { IPVS_STATS_ATTR_UNSPEC = 0, IPVS_STATS_ATTR_CONNS, /* connections scheduled */ IPVS_STATS_ATTR_INPKTS, /* incoming packets */ IPVS_STATS_ATTR_OUTPKTS, /* outgoing packets */ IPVS_STATS_ATTR_INBYTES, /* incoming bytes */ IPVS_STATS_ATTR_OUTBYTES, /* outgoing bytes */ IPVS_STATS_ATTR_CPS, /* current connection rate */ IPVS_STATS_ATTR_INPPS, /* current in packet rate */ IPVS_STATS_ATTR_OUTPPS, /* current out packet rate */ IPVS_STATS_ATTR_INBPS, /* current in byte rate */ IPVS_STATS_ATTR_OUTBPS, /* current out byte rate */ IPVS_STATS_ATTR_PAD, __IPVS_STATS_ATTR_MAX, }; #define IPVS_STATS_ATTR_MAX (__IPVS_STATS_ATTR_MAX - 1) /* Attributes used in response to IPVS_CMD_GET_INFO command */ enum { IPVS_INFO_ATTR_UNSPEC = 0, IPVS_INFO_ATTR_VERSION, /* IPVS version number */ IPVS_INFO_ATTR_CONN_TAB_SIZE, /* size of connection hash table */ __IPVS_INFO_ATTR_MAX, }; #define IPVS_INFO_ATTR_MAX (__IPVS_INFO_ATTR_MAX - 1) #endif /* _IP_VS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/mic_common.h����������������������������������������������������������������������������������0000644�����������������00000014567�14763166027�0010225 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Intel MIC Platform Software Stack (MPSS) * * Copyright(c) 2013 Intel Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * 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. * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Intel MIC driver. * */ #ifndef __MIC_COMMON_H_ #define __MIC_COMMON_H_ #include <linux/virtio_ring.h> #define __mic_align(a, x) (((a) + (x) - 1) & ~((x) - 1)) /** * struct mic_device_desc: Virtio device information shared between the * virtio driver and userspace backend * * @type: Device type: console/network/disk etc. Type 0/-1 terminates. * @num_vq: Number of virtqueues. * @feature_len: Number of bytes of feature bits. Multiply by 2: one for host features and one for guest acknowledgements. * @config_len: Number of bytes of the config array after virtqueues. * @status: A status byte, written by the Guest. * @config: Start of the following variable length config. */ struct mic_device_desc { __s8 type; __u8 num_vq; __u8 feature_len; __u8 config_len; __u8 status; __le64 config[0]; } __attribute__ ((aligned(8))); /** * struct mic_device_ctrl: Per virtio device information in the device page * used internally by the host and card side drivers. * * @vdev: Used for storing MIC vdev information by the guest. * @config_change: Set to 1 by host when a config change is requested. * @vdev_reset: Set to 1 by guest to indicate virtio device has been reset. * @guest_ack: Set to 1 by guest to ack a command. * @host_ack: Set to 1 by host to ack a command. * @used_address_updated: Set to 1 by guest when the used address should be * updated. * @c2h_vdev_db: The doorbell number to be used by guest. Set by host. * @h2c_vdev_db: The doorbell number to be used by host. Set by guest. */ struct mic_device_ctrl { __le64 vdev; __u8 config_change; __u8 vdev_reset; __u8 guest_ack; __u8 host_ack; __u8 used_address_updated; __s8 c2h_vdev_db; __s8 h2c_vdev_db; } __attribute__ ((aligned(8))); /** * struct mic_bootparam: Virtio device independent information in device page * * @magic: A magic value used by the card to ensure it can see the host * @h2c_config_db: Host to Card Virtio config doorbell set by card * @node_id: Unique id of the node * @h2c_scif_db - Host to card SCIF doorbell set by card * @c2h_scif_db - Card to host SCIF doorbell set by host * @scif_host_dma_addr - SCIF host queue pair DMA address * @scif_card_dma_addr - SCIF card queue pair DMA address */ struct mic_bootparam { __le32 magic; __s8 h2c_config_db; __u8 node_id; __u8 h2c_scif_db; __u8 c2h_scif_db; __u64 scif_host_dma_addr; __u64 scif_card_dma_addr; } __attribute__ ((aligned(8))); /** * struct mic_device_page: High level representation of the device page * * @bootparam: The bootparam structure is used for sharing information and * status updates between MIC host and card drivers. * @desc: Array of MIC virtio device descriptors. */ struct mic_device_page { struct mic_bootparam bootparam; struct mic_device_desc desc[0]; }; /** * struct mic_vqconfig: This is how we expect the device configuration field * for a virtqueue to be laid out in config space. * * @address: Guest/MIC physical address of the virtio ring * (avail and desc rings) * @used_address: Guest/MIC physical address of the used ring * @num: The number of entries in the virtio_ring */ struct mic_vqconfig { __le64 address; __le64 used_address; __le16 num; } __attribute__ ((aligned(8))); /* * The alignment to use between consumer and producer parts of vring. * This is pagesize for historical reasons. */ #define MIC_VIRTIO_RING_ALIGN 4096 #define MIC_MAX_VRINGS 4 #define MIC_VRING_ENTRIES 128 /* * Max vring entries (power of 2) to ensure desc and avail rings * fit in a single page */ #define MIC_MAX_VRING_ENTRIES 128 /** * Max size of the desc block in bytes: includes: * - struct mic_device_desc * - struct mic_vqconfig (num_vq of these) * - host and guest features * - virtio device config space */ #define MIC_MAX_DESC_BLK_SIZE 256 /** * struct _mic_vring_info - Host vring info exposed to userspace backend * for the avail index and magic for the card. * * @avail_idx: host avail idx * @magic: A magic debug cookie. */ struct _mic_vring_info { __u16 avail_idx; __le32 magic; }; /** * struct mic_vring - Vring information. * * @vr: The virtio ring. * @info: Host vring information exposed to the userspace backend for the * avail index and magic for the card. * @va: The va for the buffer allocated for vr and info. * @len: The length of the buffer required for allocating vr and info. */ struct mic_vring { struct vring vr; struct _mic_vring_info *info; void *va; int len; }; #define mic_aligned_desc_size(d) __mic_align(mic_desc_size(d), 8) #ifndef INTEL_MIC_CARD static __inline__ unsigned mic_desc_size(const struct mic_device_desc *desc) { return sizeof(*desc) + desc->num_vq * sizeof(struct mic_vqconfig) + desc->feature_len * 2 + desc->config_len; } static __inline__ struct mic_vqconfig * mic_vq_config(const struct mic_device_desc *desc) { return (struct mic_vqconfig *)(desc + 1); } static __inline__ __u8 *mic_vq_features(const struct mic_device_desc *desc) { return (__u8 *)(mic_vq_config(desc) + desc->num_vq); } static __inline__ __u8 *mic_vq_configspace(const struct mic_device_desc *desc) { return mic_vq_features(desc) + desc->feature_len * 2; } static __inline__ unsigned mic_total_desc_size(struct mic_device_desc *desc) { return mic_aligned_desc_size(desc) + sizeof(struct mic_device_ctrl); } #endif /* Device page size */ #define MIC_DP_SIZE 4096 #define MIC_MAGIC 0xc0ffee00 /** * enum mic_states - MIC states. */ enum mic_states { MIC_READY = 0, MIC_BOOTING, MIC_ONLINE, MIC_SHUTTING_DOWN, MIC_RESETTING, MIC_RESET_FAILED, MIC_LAST }; /** * enum mic_status - MIC status reported by card after * a host or card initiated shutdown or a card crash. */ enum mic_status { MIC_NOP = 0, MIC_CRASHED, MIC_HALTED, MIC_POWER_OFF, MIC_RESTART, MIC_STATUS_LAST }; #endif �����������������������������������������������������������������������������������������������������������������������������������������linux/ppdev.h���������������������������������������������������������������������������������������0000644�����������������00000006213�14763166027�0007210 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * linux/include/linux/ppdev.h * * User-space parallel port device driver (header file). * * Copyright (C) 1998-9 Tim Waugh <tim@cyberelk.demon.co.uk> * * 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. * * Added PPGETTIME/PPSETTIME, Fred Barnes, 1999 * Added PPGETMODES/PPGETMODE/PPGETPHASE, Fred Barnes <frmb2@ukc.ac.uk>, 03/01/2001 */ #define PP_IOCTL 'p' /* Set mode for read/write (e.g. IEEE1284_MODE_EPP) */ #define PPSETMODE _IOW(PP_IOCTL, 0x80, int) /* Read status */ #define PPRSTATUS _IOR(PP_IOCTL, 0x81, unsigned char) #define PPWSTATUS OBSOLETE__IOW(PP_IOCTL, 0x82, unsigned char) /* Read/write control */ #define PPRCONTROL _IOR(PP_IOCTL, 0x83, unsigned char) #define PPWCONTROL _IOW(PP_IOCTL, 0x84, unsigned char) struct ppdev_frob_struct { unsigned char mask; unsigned char val; }; #define PPFCONTROL _IOW(PP_IOCTL, 0x8e, struct ppdev_frob_struct) /* Read/write data */ #define PPRDATA _IOR(PP_IOCTL, 0x85, unsigned char) #define PPWDATA _IOW(PP_IOCTL, 0x86, unsigned char) /* Read/write econtrol (not used) */ #define PPRECONTROL OBSOLETE__IOR(PP_IOCTL, 0x87, unsigned char) #define PPWECONTROL OBSOLETE__IOW(PP_IOCTL, 0x88, unsigned char) /* Read/write FIFO (not used) */ #define PPRFIFO OBSOLETE__IOR(PP_IOCTL, 0x89, unsigned char) #define PPWFIFO OBSOLETE__IOW(PP_IOCTL, 0x8a, unsigned char) /* Claim the port to start using it */ #define PPCLAIM _IO(PP_IOCTL, 0x8b) /* Release the port when you aren't using it */ #define PPRELEASE _IO(PP_IOCTL, 0x8c) /* Yield the port (release it if another driver is waiting, * then reclaim) */ #define PPYIELD _IO(PP_IOCTL, 0x8d) /* Register device exclusively (must be before PPCLAIM). */ #define PPEXCL _IO(PP_IOCTL, 0x8f) /* Data line direction: non-zero for input mode. */ #define PPDATADIR _IOW(PP_IOCTL, 0x90, int) /* Negotiate a particular IEEE 1284 mode. */ #define PPNEGOT _IOW(PP_IOCTL, 0x91, int) /* Set control lines when an interrupt occurs. */ #define PPWCTLONIRQ _IOW(PP_IOCTL, 0x92, unsigned char) /* Clear (and return) interrupt count. */ #define PPCLRIRQ _IOR(PP_IOCTL, 0x93, int) /* Set the IEEE 1284 phase that we're in (e.g. IEEE1284_PH_FWD_IDLE) */ #define PPSETPHASE _IOW(PP_IOCTL, 0x94, int) /* Set and get port timeout (struct timeval's) */ #define PPGETTIME _IOR(PP_IOCTL, 0x95, struct timeval) #define PPSETTIME _IOW(PP_IOCTL, 0x96, struct timeval) /* Get available modes (what the hardware can do) */ #define PPGETMODES _IOR(PP_IOCTL, 0x97, unsigned int) /* Get the current mode and phaze */ #define PPGETMODE _IOR(PP_IOCTL, 0x98, int) #define PPGETPHASE _IOR(PP_IOCTL, 0x99, int) /* get/set flags */ #define PPGETFLAGS _IOR(PP_IOCTL, 0x9a, int) #define PPSETFLAGS _IOW(PP_IOCTL, 0x9b, int) /* flags visible to the world */ #define PP_FASTWRITE (1<<2) #define PP_FASTREAD (1<<3) #define PP_W91284PIC (1<<4) /* only masks user-visible flags */ #define PP_FLAGMASK (PP_FASTWRITE | PP_FASTREAD | PP_W91284PIC) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/virtio_mmio.h���������������������������������������������������������������������������������0000644�����������������00000010752�14763166027�0010432 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Virtio platform device driver * * Copyright 2011, ARM Ltd. * * Based on Virtio PCI driver by Anthony Liguori, copyright IBM Corp. 2007 * * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _LINUX_VIRTIO_MMIO_H #define _LINUX_VIRTIO_MMIO_H /* * Control registers */ /* Magic value ("virt" string) - Read Only */ #define VIRTIO_MMIO_MAGIC_VALUE 0x000 /* Virtio device version - Read Only */ #define VIRTIO_MMIO_VERSION 0x004 /* Virtio device ID - Read Only */ #define VIRTIO_MMIO_DEVICE_ID 0x008 /* Virtio vendor ID - Read Only */ #define VIRTIO_MMIO_VENDOR_ID 0x00c /* Bitmask of the features supported by the device (host) * (32 bits per set) - Read Only */ #define VIRTIO_MMIO_DEVICE_FEATURES 0x010 /* Device (host) features set selector - Write Only */ #define VIRTIO_MMIO_DEVICE_FEATURES_SEL 0x014 /* Bitmask of features activated by the driver (guest) * (32 bits per set) - Write Only */ #define VIRTIO_MMIO_DRIVER_FEATURES 0x020 /* Activated features set selector - Write Only */ #define VIRTIO_MMIO_DRIVER_FEATURES_SEL 0x024 #ifndef VIRTIO_MMIO_NO_LEGACY /* LEGACY DEVICES ONLY! */ /* Guest's memory page size in bytes - Write Only */ #define VIRTIO_MMIO_GUEST_PAGE_SIZE 0x028 #endif /* Queue selector - Write Only */ #define VIRTIO_MMIO_QUEUE_SEL 0x030 /* Maximum size of the currently selected queue - Read Only */ #define VIRTIO_MMIO_QUEUE_NUM_MAX 0x034 /* Queue size for the currently selected queue - Write Only */ #define VIRTIO_MMIO_QUEUE_NUM 0x038 #ifndef VIRTIO_MMIO_NO_LEGACY /* LEGACY DEVICES ONLY! */ /* Used Ring alignment for the currently selected queue - Write Only */ #define VIRTIO_MMIO_QUEUE_ALIGN 0x03c /* Guest's PFN for the currently selected queue - Read Write */ #define VIRTIO_MMIO_QUEUE_PFN 0x040 #endif /* Ready bit for the currently selected queue - Read Write */ #define VIRTIO_MMIO_QUEUE_READY 0x044 /* Queue notifier - Write Only */ #define VIRTIO_MMIO_QUEUE_NOTIFY 0x050 /* Interrupt status - Read Only */ #define VIRTIO_MMIO_INTERRUPT_STATUS 0x060 /* Interrupt acknowledge - Write Only */ #define VIRTIO_MMIO_INTERRUPT_ACK 0x064 /* Device status register - Read Write */ #define VIRTIO_MMIO_STATUS 0x070 /* Selected queue's Descriptor Table address, 64 bits in two halves */ #define VIRTIO_MMIO_QUEUE_DESC_LOW 0x080 #define VIRTIO_MMIO_QUEUE_DESC_HIGH 0x084 /* Selected queue's Available Ring address, 64 bits in two halves */ #define VIRTIO_MMIO_QUEUE_AVAIL_LOW 0x090 #define VIRTIO_MMIO_QUEUE_AVAIL_HIGH 0x094 /* Selected queue's Used Ring address, 64 bits in two halves */ #define VIRTIO_MMIO_QUEUE_USED_LOW 0x0a0 #define VIRTIO_MMIO_QUEUE_USED_HIGH 0x0a4 /* Configuration atomicity value */ #define VIRTIO_MMIO_CONFIG_GENERATION 0x0fc /* The config space is defined by each driver as * the per-driver configuration space - Read Write */ #define VIRTIO_MMIO_CONFIG 0x100 /* * Interrupt flags (re: interrupt status & acknowledge registers) */ #define VIRTIO_MMIO_INT_VRING (1 << 0) #define VIRTIO_MMIO_INT_CONFIG (1 << 1) #endif ����������������������linux/atmdev.h��������������������������������������������������������������������������������������0000644�����������������00000016775�14763166027�0007370 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atmdev.h - ATM device driver declarations and various related items */ /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ #ifndef LINUX_ATMDEV_H #define LINUX_ATMDEV_H #include <linux/atmapi.h> #include <linux/atm.h> #include <linux/atmioc.h> #define ESI_LEN 6 #define ATM_OC3_PCR (155520000/270*260/8/53) /* OC3 link rate: 155520000 bps SONET overhead: /270*260 (9 section, 1 path) bits per cell: /8/53 max cell rate: 353207.547 cells/sec */ #define ATM_25_PCR ((25600000/8-8000)/54) /* 25 Mbps ATM cell rate (59111) */ #define ATM_OC12_PCR (622080000/1080*1040/8/53) /* OC12 link rate: 622080000 bps SONET overhead: /1080*1040 bits per cell: /8/53 max cell rate: 1412830.188 cells/sec */ #define ATM_DS3_PCR (8000*12) /* DS3: 12 cells in a 125 usec time slot */ #define __AAL_STAT_ITEMS \ __HANDLE_ITEM(tx); /* TX okay */ \ __HANDLE_ITEM(tx_err); /* TX errors */ \ __HANDLE_ITEM(rx); /* RX okay */ \ __HANDLE_ITEM(rx_err); /* RX errors */ \ __HANDLE_ITEM(rx_drop); /* RX out of memory */ struct atm_aal_stats { #define __HANDLE_ITEM(i) int i __AAL_STAT_ITEMS #undef __HANDLE_ITEM }; struct atm_dev_stats { struct atm_aal_stats aal0; struct atm_aal_stats aal34; struct atm_aal_stats aal5; } __ATM_API_ALIGN; #define ATM_GETLINKRATE _IOW('a',ATMIOC_ITF+1,struct atmif_sioc) /* get link rate */ #define ATM_GETNAMES _IOW('a',ATMIOC_ITF+3,struct atm_iobuf) /* get interface names (numbers) */ #define ATM_GETTYPE _IOW('a',ATMIOC_ITF+4,struct atmif_sioc) /* get interface type name */ #define ATM_GETESI _IOW('a',ATMIOC_ITF+5,struct atmif_sioc) /* get interface ESI */ #define ATM_GETADDR _IOW('a',ATMIOC_ITF+6,struct atmif_sioc) /* get itf's local ATM addr. list */ #define ATM_RSTADDR _IOW('a',ATMIOC_ITF+7,struct atmif_sioc) /* reset itf's ATM address list */ #define ATM_ADDADDR _IOW('a',ATMIOC_ITF+8,struct atmif_sioc) /* add a local ATM address */ #define ATM_DELADDR _IOW('a',ATMIOC_ITF+9,struct atmif_sioc) /* remove a local ATM address */ #define ATM_GETCIRANGE _IOW('a',ATMIOC_ITF+10,struct atmif_sioc) /* get connection identifier range */ #define ATM_SETCIRANGE _IOW('a',ATMIOC_ITF+11,struct atmif_sioc) /* set connection identifier range */ #define ATM_SETESI _IOW('a',ATMIOC_ITF+12,struct atmif_sioc) /* set interface ESI */ #define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc) /* force interface ESI */ #define ATM_ADDLECSADDR _IOW('a', ATMIOC_ITF+14, struct atmif_sioc) /* register a LECS address */ #define ATM_DELLECSADDR _IOW('a', ATMIOC_ITF+15, struct atmif_sioc) /* unregister a LECS address */ #define ATM_GETLECSADDR _IOW('a', ATMIOC_ITF+16, struct atmif_sioc) /* retrieve LECS address(es) */ #define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc) /* get AAL layer statistics */ #define ATM_GETSTATZ _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc) /* get AAL layer statistics and zero */ #define ATM_GETLOOP _IOW('a',ATMIOC_SARCOM+2,struct atmif_sioc) /* get loopback mode */ #define ATM_SETLOOP _IOW('a',ATMIOC_SARCOM+3,struct atmif_sioc) /* set loopback mode */ #define ATM_QUERYLOOP _IOW('a',ATMIOC_SARCOM+4,struct atmif_sioc) /* query supported loopback modes */ #define ATM_SETSC _IOW('a',ATMIOC_SPECIAL+1,int) /* enable or disable single-copy */ #define ATM_SETBACKEND _IOW('a',ATMIOC_SPECIAL+2,atm_backend_t) /* set backend handler */ #define ATM_NEWBACKENDIF _IOW('a',ATMIOC_SPECIAL+3,atm_backend_t) /* use backend to make new if */ #define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf) /* add party to p2mp call */ #ifdef CONFIG_COMPAT /* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */ #define COMPAT_ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct compat_atm_iobuf) #endif #define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int) /* drop party from p2mp call */ /* * These are backend handkers that can be set via the ATM_SETBACKEND call * above. In the future we may support dynamic loading of these - for now, * they're just being used to share the ATMIOC_BACKEND ioctls */ #define ATM_BACKEND_RAW 0 #define ATM_BACKEND_PPP 1 /* PPPoATM - RFC2364 */ #define ATM_BACKEND_BR2684 2 /* Bridged RFC1483/2684 */ /* for ATM_GETTYPE */ #define ATM_ITFTYP_LEN 8 /* maximum length of interface type name */ /* * Loopback modes for ATM_{PHY,SAR}_{GET,SET}LOOP */ /* Point of loopback CPU-->SAR-->PHY-->line--> ... */ #define __ATM_LM_NONE 0 /* no loop back ^ ^ ^ ^ */ #define __ATM_LM_AAL 1 /* loop back PDUs --' | | | */ #define __ATM_LM_ATM 2 /* loop back ATM cells ---' | | */ /* RESERVED 4 loop back on PHY side ---' */ #define __ATM_LM_PHY 8 /* loop back bits (digital) ----' | */ #define __ATM_LM_ANALOG 16 /* loop back the analog signal --------' */ /* Direction of loopback */ #define __ATM_LM_MKLOC(n) ((n)) /* Local (i.e. loop TX to RX) */ #define __ATM_LM_MKRMT(n) ((n) << 8) /* Remote (i.e. loop RX to TX) */ #define __ATM_LM_XTLOC(n) ((n) & 0xff) #define __ATM_LM_XTRMT(n) (((n) >> 8) & 0xff) #define ATM_LM_NONE 0 /* no loopback */ #define ATM_LM_LOC_AAL __ATM_LM_MKLOC(__ATM_LM_AAL) #define ATM_LM_LOC_ATM __ATM_LM_MKLOC(__ATM_LM_ATM) #define ATM_LM_LOC_PHY __ATM_LM_MKLOC(__ATM_LM_PHY) #define ATM_LM_LOC_ANALOG __ATM_LM_MKLOC(__ATM_LM_ANALOG) #define ATM_LM_RMT_AAL __ATM_LM_MKRMT(__ATM_LM_AAL) #define ATM_LM_RMT_ATM __ATM_LM_MKRMT(__ATM_LM_ATM) #define ATM_LM_RMT_PHY __ATM_LM_MKRMT(__ATM_LM_PHY) #define ATM_LM_RMT_ANALOG __ATM_LM_MKRMT(__ATM_LM_ANALOG) /* * Note: ATM_LM_LOC_* and ATM_LM_RMT_* can be combined, provided that * __ATM_LM_XTLOC(x) <= __ATM_LM_XTRMT(x) */ struct atm_iobuf { int length; void *buffer; }; /* for ATM_GETCIRANGE / ATM_SETCIRANGE */ #define ATM_CI_MAX -1 /* use maximum range of VPI/VCI */ struct atm_cirange { signed char vpi_bits; /* 1..8, ATM_CI_MAX (-1) for maximum */ signed char vci_bits; /* 1..16, ATM_CI_MAX (-1) for maximum */ }; /* for ATM_SETSC; actually taken from the ATM_VF number space */ #define ATM_SC_RX 1024 /* enable RX single-copy */ #define ATM_SC_TX 2048 /* enable TX single-copy */ #define ATM_BACKLOG_DEFAULT 32 /* if we get more, we're likely to time out anyway */ /* MF: change_qos (Modify) flags */ #define ATM_MF_IMMED 1 /* Block until change is effective */ #define ATM_MF_INC_RSV 2 /* Change reservation on increase */ #define ATM_MF_INC_SHP 4 /* Change shaping on increase */ #define ATM_MF_DEC_RSV 8 /* Change reservation on decrease */ #define ATM_MF_DEC_SHP 16 /* Change shaping on decrease */ #define ATM_MF_BWD 32 /* Set the backward direction parameters */ #define ATM_MF_SET (ATM_MF_INC_RSV | ATM_MF_INC_SHP | ATM_MF_DEC_RSV | \ ATM_MF_DEC_SHP | ATM_MF_BWD) /* * ATM_VS_* are used to express VC state in a human-friendly way. */ #define ATM_VS_IDLE 0 /* VC is not used */ #define ATM_VS_CONNECTED 1 /* VC is connected */ #define ATM_VS_CLOSING 2 /* VC is closing */ #define ATM_VS_LISTEN 3 /* VC is listening for incoming setups */ #define ATM_VS_INUSE 4 /* VC is in use (registered with atmsigd) */ #define ATM_VS_BOUND 5 /* VC is bound */ #define ATM_VS2TXT_MAP \ "IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND" #define ATM_VF2TXT_MAP \ "ADDR", "READY", "PARTIAL", "REGIS", \ "RELEASED", "HASQOS", "LISTEN", "META", \ "256", "512", "1024", "2048", \ "SESSION", "HASSAP", "BOUND", "CLOSE" #endif /* LINUX_ATMDEV_H */ ���linux/tee.h�����������������������������������������������������������������������������������������0000644�����������������00000030445�14763166027�0006653 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2015-2016, Linaro Limited * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef __TEE_H #define __TEE_H #include <linux/ioctl.h> #include <linux/types.h> /* * This file describes the API provided by a TEE driver to user space. * * Each TEE driver defines a TEE specific protocol which is used for the * data passed back and forth using TEE_IOC_CMD. */ /* Helpers to make the ioctl defines */ #define TEE_IOC_MAGIC 0xa4 #define TEE_IOC_BASE 0 /* Flags relating to shared memory */ #define TEE_IOCTL_SHM_MAPPED 0x1 /* memory mapped in normal world */ #define TEE_IOCTL_SHM_DMA_BUF 0x2 /* dma-buf handle on shared memory */ #define TEE_MAX_ARG_SIZE 1024 #define TEE_GEN_CAP_GP (1 << 0)/* GlobalPlatform compliant TEE */ #define TEE_GEN_CAP_PRIVILEGED (1 << 1)/* Privileged device (for supplicant) */ #define TEE_GEN_CAP_REG_MEM (1 << 2)/* Supports registering shared memory */ /* * TEE Implementation ID */ #define TEE_IMPL_ID_OPTEE 1 /* * OP-TEE specific capabilities */ #define TEE_OPTEE_CAP_TZ (1 << 0) /** * struct tee_ioctl_version_data - TEE version * @impl_id: [out] TEE implementation id * @impl_caps: [out] Implementation specific capabilities * @gen_caps: [out] Generic capabilities, defined by TEE_GEN_CAPS_* above * * Identifies the TEE implementation, @impl_id is one of TEE_IMPL_ID_* above. * @impl_caps is implementation specific, for example TEE_OPTEE_CAP_* * is valid when @impl_id == TEE_IMPL_ID_OPTEE. */ struct tee_ioctl_version_data { __u32 impl_id; __u32 impl_caps; __u32 gen_caps; }; /** * TEE_IOC_VERSION - query version of TEE * * Takes a tee_ioctl_version_data struct and returns with the TEE version * data filled in. */ #define TEE_IOC_VERSION _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 0, \ struct tee_ioctl_version_data) /** * struct tee_ioctl_shm_alloc_data - Shared memory allocate argument * @size: [in/out] Size of shared memory to allocate * @flags: [in/out] Flags to/from allocation. * @id: [out] Identifier of the shared memory * * The flags field should currently be zero as input. Updated by the call * with actual flags as defined by TEE_IOCTL_SHM_* above. * This structure is used as argument for TEE_IOC_SHM_ALLOC below. */ struct tee_ioctl_shm_alloc_data { __u64 size; __u32 flags; __s32 id; }; /** * TEE_IOC_SHM_ALLOC - allocate shared memory * * Allocates shared memory between the user space process and secure OS. * * Returns a file descriptor on success or < 0 on failure * * The returned file descriptor is used to map the shared memory into user * space. The shared memory is freed when the descriptor is closed and the * memory is unmapped. */ #define TEE_IOC_SHM_ALLOC _IOWR(TEE_IOC_MAGIC, TEE_IOC_BASE + 1, \ struct tee_ioctl_shm_alloc_data) /** * struct tee_ioctl_buf_data - Variable sized buffer * @buf_ptr: [in] A pointer to a buffer * @buf_len: [in] Length of the buffer above * * Used as argument for TEE_IOC_OPEN_SESSION, TEE_IOC_INVOKE, * TEE_IOC_SUPPL_RECV, and TEE_IOC_SUPPL_SEND below. */ struct tee_ioctl_buf_data { __u64 buf_ptr; __u64 buf_len; }; /* * Attributes for struct tee_ioctl_param, selects field in the union */ #define TEE_IOCTL_PARAM_ATTR_TYPE_NONE 0 /* parameter not used */ /* * These defines value parameters (struct tee_ioctl_param_value) */ #define TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT 1 #define TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_OUTPUT 2 #define TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INOUT 3 /* input and output */ /* * These defines shared memory reference parameters (struct * tee_ioctl_param_memref) */ #define TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT 5 #define TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_OUTPUT 6 #define TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INOUT 7 /* input and output */ /* * Mask for the type part of the attribute, leaves room for more types */ #define TEE_IOCTL_PARAM_ATTR_TYPE_MASK 0xff /* Meta parameter carrying extra information about the message. */ #define TEE_IOCTL_PARAM_ATTR_META 0x100 /* Mask of all known attr bits */ #define TEE_IOCTL_PARAM_ATTR_MASK \ (TEE_IOCTL_PARAM_ATTR_TYPE_MASK | TEE_IOCTL_PARAM_ATTR_META) /* * Matches TEEC_LOGIN_* in GP TEE Client API * Are only defined for GP compliant TEEs */ #define TEE_IOCTL_LOGIN_PUBLIC 0 #define TEE_IOCTL_LOGIN_USER 1 #define TEE_IOCTL_LOGIN_GROUP 2 #define TEE_IOCTL_LOGIN_APPLICATION 4 #define TEE_IOCTL_LOGIN_USER_APPLICATION 5 #define TEE_IOCTL_LOGIN_GROUP_APPLICATION 6 /** * struct tee_ioctl_param - parameter * @attr: attributes * @a: if a memref, offset into the shared memory object, else a value parameter * @b: if a memref, size of the buffer, else a value parameter * @c: if a memref, shared memory identifier, else a value parameter * * @attr & TEE_PARAM_ATTR_TYPE_MASK indicates if memref or value is used in * the union. TEE_PARAM_ATTR_TYPE_VALUE_* indicates value and * TEE_PARAM_ATTR_TYPE_MEMREF_* indicates memref. TEE_PARAM_ATTR_TYPE_NONE * indicates that none of the members are used. * * Shared memory is allocated with TEE_IOC_SHM_ALLOC which returns an * identifier representing the shared memory object. A memref can reference * a part of a shared memory by specifying an offset (@a) and size (@b) of * the object. To supply the entire shared memory object set the offset * (@a) to 0 and size (@b) to the previously returned size of the object. */ struct tee_ioctl_param { __u64 attr; __u64 a; __u64 b; __u64 c; }; #define TEE_IOCTL_UUID_LEN 16 /** * struct tee_ioctl_open_session_arg - Open session argument * @uuid: [in] UUID of the Trusted Application * @clnt_uuid: [in] UUID of client * @clnt_login: [in] Login class of client, TEE_IOCTL_LOGIN_* above * @cancel_id: [in] Cancellation id, a unique value to identify this request * @session: [out] Session id * @ret: [out] return value * @ret_origin [out] origin of the return value * @num_params [in] number of parameters following this struct */ struct tee_ioctl_open_session_arg { __u8 uuid[TEE_IOCTL_UUID_LEN]; __u8 clnt_uuid[TEE_IOCTL_UUID_LEN]; __u32 clnt_login; __u32 cancel_id; __u32 session; __u32 ret; __u32 ret_origin; __u32 num_params; /* num_params tells the actual number of element in params */ struct tee_ioctl_param params[]; }; /** * TEE_IOC_OPEN_SESSION - opens a session to a Trusted Application * * Takes a struct tee_ioctl_buf_data which contains a struct * tee_ioctl_open_session_arg followed by any array of struct * tee_ioctl_param */ #define TEE_IOC_OPEN_SESSION _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 2, \ struct tee_ioctl_buf_data) /** * struct tee_ioctl_invoke_func_arg - Invokes a function in a Trusted * Application * @func: [in] Trusted Application function, specific to the TA * @session: [in] Session id * @cancel_id: [in] Cancellation id, a unique value to identify this request * @ret: [out] return value * @ret_origin [out] origin of the return value * @num_params [in] number of parameters following this struct */ struct tee_ioctl_invoke_arg { __u32 func; __u32 session; __u32 cancel_id; __u32 ret; __u32 ret_origin; __u32 num_params; /* num_params tells the actual number of element in params */ struct tee_ioctl_param params[]; }; /** * TEE_IOC_INVOKE - Invokes a function in a Trusted Application * * Takes a struct tee_ioctl_buf_data which contains a struct * tee_invoke_func_arg followed by any array of struct tee_param */ #define TEE_IOC_INVOKE _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 3, \ struct tee_ioctl_buf_data) /** * struct tee_ioctl_cancel_arg - Cancels an open session or invoke ioctl * @cancel_id: [in] Cancellation id, a unique value to identify this request * @session: [in] Session id, if the session is opened, else set to 0 */ struct tee_ioctl_cancel_arg { __u32 cancel_id; __u32 session; }; /** * TEE_IOC_CANCEL - Cancels an open session or invoke */ #define TEE_IOC_CANCEL _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 4, \ struct tee_ioctl_cancel_arg) /** * struct tee_ioctl_close_session_arg - Closes an open session * @session: [in] Session id */ struct tee_ioctl_close_session_arg { __u32 session; }; /** * TEE_IOC_CLOSE_SESSION - Closes a session */ #define TEE_IOC_CLOSE_SESSION _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 5, \ struct tee_ioctl_close_session_arg) /** * struct tee_iocl_supp_recv_arg - Receive a request for a supplicant function * @func: [in] supplicant function * @num_params [in/out] number of parameters following this struct * * @num_params is the number of params that tee-supplicant has room to * receive when input, @num_params is the number of actual params * tee-supplicant receives when output. */ struct tee_iocl_supp_recv_arg { __u32 func; __u32 num_params; /* num_params tells the actual number of element in params */ struct tee_ioctl_param params[]; }; /** * TEE_IOC_SUPPL_RECV - Receive a request for a supplicant function * * Takes a struct tee_ioctl_buf_data which contains a struct * tee_iocl_supp_recv_arg followed by any array of struct tee_param */ #define TEE_IOC_SUPPL_RECV _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 6, \ struct tee_ioctl_buf_data) /** * struct tee_iocl_supp_send_arg - Send a response to a received request * @ret: [out] return value * @num_params [in] number of parameters following this struct */ struct tee_iocl_supp_send_arg { __u32 ret; __u32 num_params; /* num_params tells the actual number of element in params */ struct tee_ioctl_param params[]; }; /** * TEE_IOC_SUPPL_SEND - Receive a request for a supplicant function * * Takes a struct tee_ioctl_buf_data which contains a struct * tee_iocl_supp_send_arg followed by any array of struct tee_param */ #define TEE_IOC_SUPPL_SEND _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 7, \ struct tee_ioctl_buf_data) /** * struct tee_ioctl_shm_register_data - Shared memory register argument * @addr: [in] Start address of shared memory to register * @length: [in/out] Length of shared memory to register * @flags: [in/out] Flags to/from registration. * @id: [out] Identifier of the shared memory * * The flags field should currently be zero as input. Updated by the call * with actual flags as defined by TEE_IOCTL_SHM_* above. * This structure is used as argument for TEE_IOC_SHM_REGISTER below. */ struct tee_ioctl_shm_register_data { __u64 addr; __u64 length; __u32 flags; __s32 id; }; /** * TEE_IOC_SHM_REGISTER - Register shared memory argument * * Registers shared memory between the user space process and secure OS. * * Returns a file descriptor on success or < 0 on failure * * The shared memory is unregisterred when the descriptor is closed. */ #define TEE_IOC_SHM_REGISTER _IOWR(TEE_IOC_MAGIC, TEE_IOC_BASE + 9, \ struct tee_ioctl_shm_register_data) /* * Five syscalls are used when communicating with the TEE driver. * open(): opens the device associated with the driver * ioctl(): as described above operating on the file descriptor from open() * close(): two cases * - closes the device file descriptor * - closes a file descriptor connected to allocated shared memory * mmap(): maps shared memory into user space using information from struct * tee_ioctl_shm_alloc_data * munmap(): unmaps previously shared memory */ #endif /*__TEE_H*/ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/hsi/cs-protocol.h�����������������������������������������������������������������������������0000644�����������������00000007110�14763166027�0011116 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * cmt-speech interface definitions * * Copyright (C) 2008,2009,2010 Nokia Corporation. All rights reserved. * * Contact: Kai Vehmanen <kai.vehmanen@nokia.com> * Original author: Peter Ujfalusi <peter.ujfalusi@nokia.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * 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., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #ifndef _CS_PROTOCOL_H #define _CS_PROTOCOL_H #include <linux/types.h> #include <linux/ioctl.h> /* chardev parameters */ #define CS_DEV_FILE_NAME "/dev/cmt_speech" /* user-space API versioning */ #define CS_IF_VERSION 2 /* APE kernel <-> user space messages */ #define CS_CMD_SHIFT 28 #define CS_DOMAIN_SHIFT 24 #define CS_CMD_MASK 0xff000000 #define CS_PARAM_MASK 0xffffff #define CS_CMD(id, dom) \ (((id) << CS_CMD_SHIFT) | ((dom) << CS_DOMAIN_SHIFT)) #define CS_ERROR CS_CMD(1, 0) #define CS_RX_DATA_RECEIVED CS_CMD(2, 0) #define CS_TX_DATA_READY CS_CMD(3, 0) #define CS_TX_DATA_SENT CS_CMD(4, 0) /* params to CS_ERROR indication */ #define CS_ERR_PEER_RESET 0 /* ioctl interface */ /* parameters to CS_CONFIG_BUFS ioctl */ #define CS_FEAT_TSTAMP_RX_CTRL (1 << 0) #define CS_FEAT_ROLLING_RX_COUNTER (2 << 0) /* parameters to CS_GET_STATE ioctl */ #define CS_STATE_CLOSED 0 #define CS_STATE_OPENED 1 /* resource allocated */ #define CS_STATE_CONFIGURED 2 /* data path active */ /* maximum number of TX/RX buffers */ #define CS_MAX_BUFFERS_SHIFT 4 #define CS_MAX_BUFFERS (1 << CS_MAX_BUFFERS_SHIFT) /* Parameters for setting up the data buffers */ struct cs_buffer_config { __u32 rx_bufs; /* number of RX buffer slots */ __u32 tx_bufs; /* number of TX buffer slots */ __u32 buf_size; /* bytes */ __u32 flags; /* see CS_FEAT_* */ __u32 reserved[4]; }; /* * struct for monotonic timestamp taken when the * last control command was received */ struct cs_timestamp { __u32 tv_sec; /* seconds */ __u32 tv_nsec; /* nanoseconds */ }; /* * Struct describing the layout and contents of the driver mmap area. * This information is meant as read-only information for the application. */ struct cs_mmap_config_block { __u32 reserved1; __u32 buf_size; /* 0=disabled, otherwise the transfer size */ __u32 rx_bufs; /* # of RX buffers */ __u32 tx_bufs; /* # of TX buffers */ __u32 reserved2; /* array of offsets within the mmap area for each RX and TX buffer */ __u32 rx_offsets[CS_MAX_BUFFERS]; __u32 tx_offsets[CS_MAX_BUFFERS]; __u32 rx_ptr; __u32 rx_ptr_boundary; __u32 reserved3[2]; /* enabled with CS_FEAT_TSTAMP_RX_CTRL */ struct cs_timestamp tstamp_rx_ctrl; }; #define CS_IO_MAGIC 'C' #define CS_IOW(num, dtype) _IOW(CS_IO_MAGIC, num, dtype) #define CS_IOR(num, dtype) _IOR(CS_IO_MAGIC, num, dtype) #define CS_IOWR(num, dtype) _IOWR(CS_IO_MAGIC, num, dtype) #define CS_IO(num) _IO(CS_IO_MAGIC, num) #define CS_GET_STATE CS_IOR(21, unsigned int) #define CS_SET_WAKELINE CS_IOW(23, unsigned int) #define CS_GET_IF_VERSION CS_IOR(30, unsigned int) #define CS_CONFIG_BUFS CS_IOW(31, struct cs_buffer_config) #endif /* _CS_PROTOCOL_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/hsi/hsi_char.h��������������������������������������������������������������������������������0000644�����������������00000003547�14763166027�0010444 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Part of the HSI character device driver. * * Copyright (C) 2010 Nokia Corporation. All rights reserved. * * Contact: Andras Domokos <andras.domokos at nokia.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * 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., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #ifndef __HSI_CHAR_H #define __HSI_CHAR_H #include <linux/types.h> #define HSI_CHAR_MAGIC 'k' #define HSC_IOW(num, dtype) _IOW(HSI_CHAR_MAGIC, num, dtype) #define HSC_IOR(num, dtype) _IOR(HSI_CHAR_MAGIC, num, dtype) #define HSC_IOWR(num, dtype) _IOWR(HSI_CHAR_MAGIC, num, dtype) #define HSC_IO(num) _IO(HSI_CHAR_MAGIC, num) #define HSC_RESET HSC_IO(16) #define HSC_SET_PM HSC_IO(17) #define HSC_SEND_BREAK HSC_IO(18) #define HSC_SET_RX HSC_IOW(19, struct hsc_rx_config) #define HSC_GET_RX HSC_IOW(20, struct hsc_rx_config) #define HSC_SET_TX HSC_IOW(21, struct hsc_tx_config) #define HSC_GET_TX HSC_IOW(22, struct hsc_tx_config) #define HSC_PM_DISABLE 0 #define HSC_PM_ENABLE 1 #define HSC_MODE_STREAM 1 #define HSC_MODE_FRAME 2 #define HSC_FLOW_SYNC 0 #define HSC_ARB_RR 0 #define HSC_ARB_PRIO 1 struct hsc_rx_config { __u32 mode; __u32 flow; __u32 channels; }; struct hsc_tx_config { __u32 mode; __u32 channels; __u32 speed; __u32 arb_mode; }; #endif /* __HSI_CHAR_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������linux/zorro_ids.h�����������������������������������������������������������������������������������0000644�����������������00000072413�14763166027�0010111 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Zorro board IDs * * Please keep sorted. */ #define ZORRO_MANUF_PACIFIC_PERIPHERALS 0x00D3 #define ZORRO_PROD_PACIFIC_PERIPHERALS_SE_2000_A500 ZORRO_ID(PACIFIC_PERIPHERALS, 0x00, 0) #define ZORRO_PROD_PACIFIC_PERIPHERALS_SCSI ZORRO_ID(PACIFIC_PERIPHERALS, 0x0A, 0) #define ZORRO_MANUF_MACROSYSTEMS_USA_2 0x0100 #define ZORRO_PROD_MACROSYSTEMS_WARP_ENGINE ZORRO_ID(MACROSYSTEMS_USA_2, 0x13, 0) #define ZORRO_MANUF_KUPKE_1 0x00DD #define ZORRO_PROD_KUPKE_GOLEM_RAM_BOX_2MB ZORRO_ID(KUPKE_1, 0x00, 0) #define ZORRO_MANUF_MEMPHIS 0x0100 #define ZORRO_PROD_MEMPHIS_STORMBRINGER ZORRO_ID(MEMPHIS, 0x00, 0) #define ZORRO_MANUF_3_STATE 0x0200 #define ZORRO_PROD_3_STATE_MEGAMIX_2000 ZORRO_ID(3_STATE, 0x02, 0) #define ZORRO_MANUF_COMMODORE_BRAUNSCHWEIG 0x0201 #define ZORRO_PROD_CBM_A2088_A2286 ZORRO_ID(COMMODORE_BRAUNSCHWEIG, 0x01, 0) #define ZORRO_PROD_CBM_A2286 ZORRO_ID(COMMODORE_BRAUNSCHWEIG, 0x02, 0) #define ZORRO_PROD_CBM_A4091_1 ZORRO_ID(COMMODORE_BRAUNSCHWEIG, 0x54, 0) #define ZORRO_PROD_CBM_A2386SX_1 ZORRO_ID(COMMODORE_BRAUNSCHWEIG, 0x67, 0) #define ZORRO_MANUF_COMMODORE_WEST_CHESTER_1 0x0202 #define ZORRO_PROD_CBM_A2090A ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x01, 0) #define ZORRO_PROD_CBM_A590_A2091_1 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x02, 0) #define ZORRO_PROD_CBM_A590_A2091_2 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x03, 0) #define ZORRO_PROD_CBM_A2090B ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x04, 0) #define ZORRO_PROD_CBM_A2060 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x09, 0) #define ZORRO_PROD_CBM_A590_A2052_A2058_A2091 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x0A, 0) #define ZORRO_PROD_CBM_A560_RAM ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x20, 0) #define ZORRO_PROD_CBM_A2232_PROTOTYPE ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x45, 0) #define ZORRO_PROD_CBM_A2232 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x46, 0) #define ZORRO_PROD_CBM_A2620 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x50, 0) #define ZORRO_PROD_CBM_A2630 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x51, 0) #define ZORRO_PROD_CBM_A4091_2 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x54, 0) #define ZORRO_PROD_CBM_A2065_1 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x5A, 0) #define ZORRO_PROD_CBM_ROMULATOR ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x60, 0) #define ZORRO_PROD_CBM_A3000_TEST_FIXTURE ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x61, 0) #define ZORRO_PROD_CBM_A2386SX_2 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x67, 0) #define ZORRO_PROD_CBM_A2065_2 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x70, 0) #define ZORRO_MANUF_COMMODORE_WEST_CHESTER_2 0x0203 #define ZORRO_PROD_CBM_A2090A_CM ZORRO_ID(COMMODORE_WEST_CHESTER_2, 0x03, 0) #define ZORRO_MANUF_PROGRESSIVE_PERIPHERALS_AND_SYSTEMS_2 0x02F4 #define ZORRO_PROD_PPS_EXP8000 ZORRO_ID(PROGRESSIVE_PERIPHERALS_AND_SYSTEMS_2, 0x02, 0) #define ZORRO_MANUF_KOLFF_COMPUTER_SUPPLIES 0x02FF #define ZORRO_PROD_KCS_POWER_PC_BOARD ZORRO_ID(KOLFF_COMPUTER_SUPPLIES, 0x00, 0) #define ZORRO_MANUF_CARDCO_1 0x03EC #define ZORRO_PROD_CARDCO_KRONOS_2000_1 ZORRO_ID(CARDCO_1, 0x04, 0) #define ZORRO_PROD_CARDCO_A1000_1 ZORRO_ID(CARDCO_1, 0x0C, 0) #define ZORRO_PROD_CARDCO_ESCORT ZORRO_ID(CARDCO_1, 0x0E, 0) #define ZORRO_PROD_CARDCO_A2410 ZORRO_ID(CARDCO_1, 0xF5, 0) #define ZORRO_MANUF_A_SQUARED 0x03ED #define ZORRO_PROD_A_SQUARED_LIVE_2000 ZORRO_ID(A_SQUARED, 0x01, 0) #define ZORRO_MANUF_COMSPEC_COMMUNICATIONS 0x03EE #define ZORRO_PROD_COMSPEC_COMMUNICATIONS_AX2000 ZORRO_ID(COMSPEC_COMMUNICATIONS, 0x01, 0) #define ZORRO_MANUF_ANAKIN_RESEARCH 0x03F1 #define ZORRO_PROD_ANAKIN_RESEARCH_EASYL ZORRO_ID(ANAKIN_RESEARCH, 0x01, 0) #define ZORRO_MANUF_MICROBOTICS 0x03F2 #define ZORRO_PROD_MICROBOTICS_STARBOARD_II ZORRO_ID(MICROBOTICS, 0x00, 0) #define ZORRO_PROD_MICROBOTICS_STARDRIVE ZORRO_ID(MICROBOTICS, 0x02, 0) #define ZORRO_PROD_MICROBOTICS_8_UP_A ZORRO_ID(MICROBOTICS, 0x03, 0) #define ZORRO_PROD_MICROBOTICS_8_UP_Z ZORRO_ID(MICROBOTICS, 0x04, 0) #define ZORRO_PROD_MICROBOTICS_DELTA_RAM ZORRO_ID(MICROBOTICS, 0x20, 0) #define ZORRO_PROD_MICROBOTICS_8_STAR_RAM ZORRO_ID(MICROBOTICS, 0x40, 0) #define ZORRO_PROD_MICROBOTICS_8_STAR ZORRO_ID(MICROBOTICS, 0x41, 0) #define ZORRO_PROD_MICROBOTICS_VXL_RAM_32 ZORRO_ID(MICROBOTICS, 0x44, 0) #define ZORRO_PROD_MICROBOTICS_VXL_68030 ZORRO_ID(MICROBOTICS, 0x45, 0) #define ZORRO_PROD_MICROBOTICS_DELTA ZORRO_ID(MICROBOTICS, 0x60, 0) #define ZORRO_PROD_MICROBOTICS_MBX_1200_1200Z_RAM ZORRO_ID(MICROBOTICS, 0x81, 0) #define ZORRO_PROD_MICROBOTICS_HARDFRAME_2000_1 ZORRO_ID(MICROBOTICS, 0x96, 0) #define ZORRO_PROD_MICROBOTICS_HARDFRAME_2000_2 ZORRO_ID(MICROBOTICS, 0x9E, 0) #define ZORRO_PROD_MICROBOTICS_MBX_1200_1200Z ZORRO_ID(MICROBOTICS, 0xC1, 0) #define ZORRO_MANUF_ACCESS_ASSOCIATES_ALEGRA 0x03F4 #define ZORRO_MANUF_EXPANSION_TECHNOLOGIES 0x03F6 #define ZORRO_MANUF_ASDG 0x03FF #define ZORRO_PROD_ASDG_MEMORY_1 ZORRO_ID(ASDG, 0x01, 0) #define ZORRO_PROD_ASDG_MEMORY_2 ZORRO_ID(ASDG, 0x02, 0) #define ZORRO_PROD_ASDG_EB920_LAN_ROVER ZORRO_ID(ASDG, 0xFE, 0) #define ZORRO_PROD_ASDG_GPIB_DUALIEEE488_TWIN_X ZORRO_ID(ASDG, 0xFF, 0) #define ZORRO_MANUF_IMTRONICS_1 0x0404 #define ZORRO_PROD_IMTRONICS_HURRICANE_2800_1 ZORRO_ID(IMTRONICS_1, 0x39, 0) #define ZORRO_PROD_IMTRONICS_HURRICANE_2800_2 ZORRO_ID(IMTRONICS_1, 0x57, 0) #define ZORRO_MANUF_CBM_UNIVERSITY_OF_LOWELL 0x0406 #define ZORRO_PROD_CBM_A2410 ZORRO_ID(CBM_UNIVERSITY_OF_LOWELL, 0x00, 0) #define ZORRO_MANUF_AMERISTAR 0x041D #define ZORRO_PROD_AMERISTAR_A2065 ZORRO_ID(AMERISTAR, 0x01, 0) #define ZORRO_PROD_AMERISTAR_A560 ZORRO_ID(AMERISTAR, 0x09, 0) #define ZORRO_PROD_AMERISTAR_A4066 ZORRO_ID(AMERISTAR, 0x0A, 0) #define ZORRO_MANUF_SUPRA 0x0420 #define ZORRO_PROD_SUPRA_SUPRADRIVE_4x4 ZORRO_ID(SUPRA, 0x01, 0) #define ZORRO_PROD_SUPRA_1000_RAM ZORRO_ID(SUPRA, 0x02, 0) #define ZORRO_PROD_SUPRA_2000_DMA ZORRO_ID(SUPRA, 0x03, 0) #define ZORRO_PROD_SUPRA_500 ZORRO_ID(SUPRA, 0x05, 0) #define ZORRO_PROD_SUPRA_500_SCSI ZORRO_ID(SUPRA, 0x08, 0) #define ZORRO_PROD_SUPRA_500XP_2000_RAM ZORRO_ID(SUPRA, 0x09, 0) #define ZORRO_PROD_SUPRA_500RX_2000_RAM ZORRO_ID(SUPRA, 0x0A, 0) #define ZORRO_PROD_SUPRA_2400ZI ZORRO_ID(SUPRA, 0x0B, 0) #define ZORRO_PROD_SUPRA_500XP_SUPRADRIVE_WORDSYNC ZORRO_ID(SUPRA, 0x0C, 0) #define ZORRO_PROD_SUPRA_SUPRADRIVE_WORDSYNC_II ZORRO_ID(SUPRA, 0x0D, 0) #define ZORRO_PROD_SUPRA_2400ZIPLUS ZORRO_ID(SUPRA, 0x10, 0) #define ZORRO_MANUF_COMPUTER_SYSTEMS_ASSOCIATES 0x0422 #define ZORRO_PROD_CSA_MAGNUM ZORRO_ID(COMPUTER_SYSTEMS_ASSOCIATES, 0x11, 0) #define ZORRO_PROD_CSA_12_GAUGE ZORRO_ID(COMPUTER_SYSTEMS_ASSOCIATES, 0x15, 0) #define ZORRO_MANUF_MARC_MICHAEL_GROTH 0x0439 #define ZORRO_MANUF_M_TECH 0x0502 #define ZORRO_PROD_MTEC_AT500_1 ZORRO_ID(M_TECH, 0x03, 0) #define ZORRO_MANUF_GREAT_VALLEY_PRODUCTS_1 0x06E1 #define ZORRO_PROD_GVP_IMPACT_SERIES_I ZORRO_ID(GREAT_VALLEY_PRODUCTS_1, 0x08, 0) #define ZORRO_MANUF_BYTEBOX 0x07DA #define ZORRO_PROD_BYTEBOX_A500 ZORRO_ID(BYTEBOX, 0x00, 0) #define ZORRO_MANUF_DKB_POWER_COMPUTING 0x07DC #define ZORRO_PROD_DKB_POWER_COMPUTING_SECUREKEY ZORRO_ID(DKB_POWER_COMPUTING, 0x09, 0) #define ZORRO_PROD_DKB_POWER_COMPUTING_DKM_3128 ZORRO_ID(DKB_POWER_COMPUTING, 0x0E, 0) #define ZORRO_PROD_DKB_POWER_COMPUTING_RAPID_FIRE ZORRO_ID(DKB_POWER_COMPUTING, 0x0F, 0) #define ZORRO_PROD_DKB_POWER_COMPUTING_DKM_1202 ZORRO_ID(DKB_POWER_COMPUTING, 0x10, 0) #define ZORRO_PROD_DKB_POWER_COMPUTING_COBRA_VIPER_II_68EC030 ZORRO_ID(DKB_POWER_COMPUTING, 0x12, 0) #define ZORRO_PROD_DKB_POWER_COMPUTING_WILDFIRE_060_1 ZORRO_ID(DKB_POWER_COMPUTING, 0x17, 0) #define ZORRO_PROD_DKB_POWER_COMPUTING_WILDFIRE_060_2 ZORRO_ID(DKB_POWER_COMPUTING, 0xFF, 0) #define ZORRO_MANUF_GREAT_VALLEY_PRODUCTS_2 0x07E1 #define ZORRO_PROD_GVP_IMPACT_SERIES_I_4K ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x01, 0) #define ZORRO_PROD_GVP_IMPACT_SERIES_I_16K_2 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x02, 0) #define ZORRO_PROD_GVP_IMPACT_SERIES_I_16K_3 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x03, 0) #define ZORRO_PROD_GVP_IMPACT_3001_IDE_1 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x08, 0) #define ZORRO_PROD_GVP_IMPACT_3001_RAM ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x09, 0) #define ZORRO_PROD_GVP_IMPACT_SERIES_II_RAM_1 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0A, 0) #define ZORRO_PROD_GVP_EPC_BASE ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0) #define ZORRO_PROD_GVP_GFORCE_040_1 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x20) #define ZORRO_PROD_GVP_GFORCE_040_SCSI_1 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x30) #define ZORRO_PROD_GVP_A1291 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x40) #define ZORRO_PROD_GVP_COMBO_030_R4 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x60) #define ZORRO_PROD_GVP_COMBO_030_R4_SCSI ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x70) #define ZORRO_PROD_GVP_PHONEPAK ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x78) #define ZORRO_PROD_GVP_IO_EXTENDER ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x98) #define ZORRO_PROD_GVP_GFORCE_030 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xa0) #define ZORRO_PROD_GVP_GFORCE_030_SCSI ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xb0) #define ZORRO_PROD_GVP_A530 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xc0) #define ZORRO_PROD_GVP_A530_SCSI ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xd0) #define ZORRO_PROD_GVP_COMBO_030_R3 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xe0) #define ZORRO_PROD_GVP_COMBO_030_R3_SCSI ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xf0) #define ZORRO_PROD_GVP_SERIES_II ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xf8) #define ZORRO_PROD_GVP_IMPACT_3001_IDE_2 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0D, 0) /*#define ZORRO_PROD_GVP_A2000_030 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0D, 0)*/ /*#define ZORRO_PROD_GVP_GFORCE_040_SCSI_2 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0D, 0)*/ #define ZORRO_PROD_GVP_GFORCE_040_060 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x16, 0) #define ZORRO_PROD_GVP_IMPACT_VISION_24 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x20, 0) #define ZORRO_PROD_GVP_GFORCE_040_2 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0xFF, 0) #define ZORRO_MANUF_CALIFORNIA_ACCESS_SYNERGY 0x07E5 #define ZORRO_PROD_CALIFORNIA_ACCESS_SYNERGY_MALIBU ZORRO_ID(CALIFORNIA_ACCESS_SYNERGY, 0x01, 0) #define ZORRO_MANUF_XETEC 0x07E6 #define ZORRO_PROD_XETEC_FASTCARD ZORRO_ID(XETEC, 0x01, 0) #define ZORRO_PROD_XETEC_FASTCARD_RAM ZORRO_ID(XETEC, 0x02, 0) #define ZORRO_PROD_XETEC_FASTCARD_PLUS ZORRO_ID(XETEC, 0x03, 0) #define ZORRO_MANUF_PROGRESSIVE_PERIPHERALS_AND_SYSTEMS 0x07EA #define ZORRO_PROD_PPS_MERCURY ZORRO_ID(PROGRESSIVE_PERIPHERALS_AND_SYSTEMS, 0x00, 0) #define ZORRO_PROD_PPS_A3000_68040 ZORRO_ID(PROGRESSIVE_PERIPHERALS_AND_SYSTEMS, 0x01, 0) #define ZORRO_PROD_PPS_A2000_68040 ZORRO_ID(PROGRESSIVE_PERIPHERALS_AND_SYSTEMS, 0x69, 0) #define ZORRO_PROD_PPS_ZEUS ZORRO_ID(PROGRESSIVE_PERIPHERALS_AND_SYSTEMS, 0x96, 0) #define ZORRO_PROD_PPS_A500_68040 ZORRO_ID(PROGRESSIVE_PERIPHERALS_AND_SYSTEMS, 0xBB, 0) #define ZORRO_MANUF_XEBEC 0x07EC #define ZORRO_MANUF_SPIRIT_TECHNOLOGY 0x07F2 #define ZORRO_PROD_SPIRIT_TECHNOLOGY_INSIDER_IN1000 ZORRO_ID(SPIRIT_TECHNOLOGY, 0x01, 0) #define ZORRO_PROD_SPIRIT_TECHNOLOGY_INSIDER_IN500 ZORRO_ID(SPIRIT_TECHNOLOGY, 0x02, 0) #define ZORRO_PROD_SPIRIT_TECHNOLOGY_SIN500 ZORRO_ID(SPIRIT_TECHNOLOGY, 0x03, 0) #define ZORRO_PROD_SPIRIT_TECHNOLOGY_HDA_506 ZORRO_ID(SPIRIT_TECHNOLOGY, 0x04, 0) #define ZORRO_PROD_SPIRIT_TECHNOLOGY_AX_S ZORRO_ID(SPIRIT_TECHNOLOGY, 0x05, 0) #define ZORRO_PROD_SPIRIT_TECHNOLOGY_OCTABYTE ZORRO_ID(SPIRIT_TECHNOLOGY, 0x06, 0) #define ZORRO_PROD_SPIRIT_TECHNOLOGY_INMATE ZORRO_ID(SPIRIT_TECHNOLOGY, 0x08, 0) #define ZORRO_MANUF_SPIRIT_TECHNOLOGY_2 0x07F3 #define ZORRO_MANUF_BSC_ALFADATA_1 0x07FE #define ZORRO_PROD_BSC_ALF_3_1 ZORRO_ID(BSC_ALFADATA_1, 0x03, 0) #define ZORRO_MANUF_BSC_ALFADATA_2 0x0801 #define ZORRO_PROD_BSC_ALF_2_1 ZORRO_ID(BSC_ALFADATA_2, 0x01, 0) #define ZORRO_PROD_BSC_ALF_2_2 ZORRO_ID(BSC_ALFADATA_2, 0x02, 0) #define ZORRO_PROD_BSC_ALF_3_2 ZORRO_ID(BSC_ALFADATA_2, 0x03, 0) #define ZORRO_MANUF_CARDCO_2 0x0802 #define ZORRO_PROD_CARDCO_KRONOS_2000_2 ZORRO_ID(CARDCO_2, 0x04, 0) #define ZORRO_PROD_CARDCO_A1000_2 ZORRO_ID(CARDCO_2, 0x0C, 0) #define ZORRO_MANUF_JOCHHEIM 0x0804 #define ZORRO_PROD_JOCHHEIM_RAM ZORRO_ID(JOCHHEIM, 0x01, 0) #define ZORRO_MANUF_CHECKPOINT_TECHNOLOGIES 0x0807 #define ZORRO_PROD_CHECKPOINT_TECHNOLOGIES_SERIAL_SOLUTION ZORRO_ID(CHECKPOINT_TECHNOLOGIES, 0x00, 0) #define ZORRO_MANUF_EDOTRONIK 0x0810 #define ZORRO_PROD_EDOTRONIK_IEEE_488 ZORRO_ID(EDOTRONIK, 0x01, 0) #define ZORRO_PROD_EDOTRONIK_8032 ZORRO_ID(EDOTRONIK, 0x02, 0) #define ZORRO_PROD_EDOTRONIK_MULTISERIAL ZORRO_ID(EDOTRONIK, 0x03, 0) #define ZORRO_PROD_EDOTRONIK_VIDEODIGITIZER ZORRO_ID(EDOTRONIK, 0x04, 0) #define ZORRO_PROD_EDOTRONIK_PARALLEL_IO ZORRO_ID(EDOTRONIK, 0x05, 0) #define ZORRO_PROD_EDOTRONIK_PIC_PROTOYPING ZORRO_ID(EDOTRONIK, 0x06, 0) #define ZORRO_PROD_EDOTRONIK_ADC ZORRO_ID(EDOTRONIK, 0x07, 0) #define ZORRO_PROD_EDOTRONIK_VME ZORRO_ID(EDOTRONIK, 0x08, 0) #define ZORRO_PROD_EDOTRONIK_DSP96000 ZORRO_ID(EDOTRONIK, 0x09, 0) #define ZORRO_MANUF_NES_INC 0x0813 #define ZORRO_PROD_NES_INC_RAM ZORRO_ID(NES_INC, 0x00, 0) #define ZORRO_MANUF_ICD 0x0817 #define ZORRO_PROD_ICD_ADVANTAGE_2000_SCSI ZORRO_ID(ICD, 0x01, 0) #define ZORRO_PROD_ICD_ADVANTAGE_IDE ZORRO_ID(ICD, 0x03, 0) #define ZORRO_PROD_ICD_ADVANTAGE_2080_RAM ZORRO_ID(ICD, 0x04, 0) #define ZORRO_MANUF_KUPKE_2 0x0819 #define ZORRO_PROD_KUPKE_OMTI ZORRO_ID(KUPKE_2, 0x01, 0) #define ZORRO_PROD_KUPKE_SCSI_II ZORRO_ID(KUPKE_2, 0x02, 0) #define ZORRO_PROD_KUPKE_GOLEM_BOX ZORRO_ID(KUPKE_2, 0x03, 0) #define ZORRO_PROD_KUPKE_030_882 ZORRO_ID(KUPKE_2, 0x04, 0) #define ZORRO_PROD_KUPKE_SCSI_AT ZORRO_ID(KUPKE_2, 0x05, 0) #define ZORRO_MANUF_GREAT_VALLEY_PRODUCTS_3 0x081D #define ZORRO_PROD_GVP_A2000_RAM8 ZORRO_ID(GREAT_VALLEY_PRODUCTS_3, 0x09, 0) #define ZORRO_PROD_GVP_IMPACT_SERIES_II_RAM_2 ZORRO_ID(GREAT_VALLEY_PRODUCTS_3, 0x0A, 0) #define ZORRO_MANUF_INTERWORKS_NETWORK 0x081E #define ZORRO_MANUF_HARDITAL_SYNTHESIS 0x0820 #define ZORRO_PROD_HARDITAL_SYNTHESIS_TQM_68030_68882 ZORRO_ID(HARDITAL_SYNTHESIS, 0x14, 0) #define ZORRO_MANUF_APPLIED_ENGINEERING 0x0828 #define ZORRO_PROD_APPLIED_ENGINEERING_DL2000 ZORRO_ID(APPLIED_ENGINEERING, 0x10, 0) #define ZORRO_PROD_APPLIED_ENGINEERING_RAM_WORKS ZORRO_ID(APPLIED_ENGINEERING, 0xE0, 0) #define ZORRO_MANUF_BSC_ALFADATA_3 0x082C #define ZORRO_PROD_BSC_OKTAGON_2008 ZORRO_ID(BSC_ALFADATA_3, 0x05, 0) #define ZORRO_PROD_BSC_TANDEM_AT_2008_508 ZORRO_ID(BSC_ALFADATA_3, 0x06, 0) #define ZORRO_PROD_BSC_ALFA_RAM_1200 ZORRO_ID(BSC_ALFADATA_3, 0x07, 0) #define ZORRO_PROD_BSC_OKTAGON_2008_RAM ZORRO_ID(BSC_ALFADATA_3, 0x08, 0) #define ZORRO_PROD_BSC_MULTIFACE_I ZORRO_ID(BSC_ALFADATA_3, 0x10, 0) #define ZORRO_PROD_BSC_MULTIFACE_II ZORRO_ID(BSC_ALFADATA_3, 0x11, 0) #define ZORRO_PROD_BSC_MULTIFACE_III ZORRO_ID(BSC_ALFADATA_3, 0x12, 0) #define ZORRO_PROD_BSC_FRAMEMASTER_II ZORRO_ID(BSC_ALFADATA_3, 0x20, 0) #define ZORRO_PROD_BSC_GRAFFITI_RAM ZORRO_ID(BSC_ALFADATA_3, 0x21, 0) #define ZORRO_PROD_BSC_GRAFFITI_REG ZORRO_ID(BSC_ALFADATA_3, 0x22, 0) #define ZORRO_PROD_BSC_ISDN_MASTERCARD ZORRO_ID(BSC_ALFADATA_3, 0x40, 0) #define ZORRO_PROD_BSC_ISDN_MASTERCARD_II ZORRO_ID(BSC_ALFADATA_3, 0x41, 0) #define ZORRO_MANUF_PHOENIX 0x0835 #define ZORRO_PROD_PHOENIX_ST506 ZORRO_ID(PHOENIX, 0x21, 0) #define ZORRO_PROD_PHOENIX_SCSI ZORRO_ID(PHOENIX, 0x22, 0) #define ZORRO_PROD_PHOENIX_RAM ZORRO_ID(PHOENIX, 0xBE, 0) #define ZORRO_MANUF_ADVANCED_STORAGE_SYSTEMS 0x0836 #define ZORRO_PROD_ADVANCED_STORAGE_SYSTEMS_NEXUS ZORRO_ID(ADVANCED_STORAGE_SYSTEMS, 0x01, 0) #define ZORRO_PROD_ADVANCED_STORAGE_SYSTEMS_NEXUS_RAM ZORRO_ID(ADVANCED_STORAGE_SYSTEMS, 0x08, 0) #define ZORRO_MANUF_IMPULSE 0x0838 #define ZORRO_PROD_IMPULSE_FIRECRACKER_24 ZORRO_ID(IMPULSE, 0x00, 0) #define ZORRO_MANUF_IVS 0x0840 #define ZORRO_PROD_IVS_GRANDSLAM_PIC_2 ZORRO_ID(IVS, 0x02, 0) #define ZORRO_PROD_IVS_GRANDSLAM_PIC_1 ZORRO_ID(IVS, 0x04, 0) #define ZORRO_PROD_IVS_OVERDRIVE ZORRO_ID(IVS, 0x10, 0) #define ZORRO_PROD_IVS_TRUMPCARD_CLASSIC ZORRO_ID(IVS, 0x30, 0) #define ZORRO_PROD_IVS_TRUMPCARD_PRO_GRANDSLAM ZORRO_ID(IVS, 0x34, 0) #define ZORRO_PROD_IVS_META_4 ZORRO_ID(IVS, 0x40, 0) #define ZORRO_PROD_IVS_WAVETOOLS ZORRO_ID(IVS, 0xBF, 0) #define ZORRO_PROD_IVS_VECTOR_1 ZORRO_ID(IVS, 0xF3, 0) #define ZORRO_PROD_IVS_VECTOR_2 ZORRO_ID(IVS, 0xF4, 0) #define ZORRO_MANUF_VECTOR_1 0x0841 #define ZORRO_PROD_VECTOR_CONNECTION_1 ZORRO_ID(VECTOR_1, 0xE3, 0) #define ZORRO_MANUF_XPERT_PRODEV 0x0845 #define ZORRO_PROD_XPERT_PRODEV_VISIONA_RAM ZORRO_ID(XPERT_PRODEV, 0x01, 0) #define ZORRO_PROD_XPERT_PRODEV_VISIONA_REG ZORRO_ID(XPERT_PRODEV, 0x02, 0) #define ZORRO_PROD_XPERT_PRODEV_MERLIN_RAM ZORRO_ID(XPERT_PRODEV, 0x03, 0) #define ZORRO_PROD_XPERT_PRODEV_MERLIN_REG_1 ZORRO_ID(XPERT_PRODEV, 0x04, 0) #define ZORRO_PROD_XPERT_PRODEV_MERLIN_REG_2 ZORRO_ID(XPERT_PRODEV, 0xC9, 0) #define ZORRO_MANUF_HYDRA_SYSTEMS 0x0849 #define ZORRO_PROD_HYDRA_SYSTEMS_AMIGANET ZORRO_ID(HYDRA_SYSTEMS, 0x01, 0) #define ZORRO_MANUF_SUNRIZE_INDUSTRIES 0x084F #define ZORRO_PROD_SUNRIZE_INDUSTRIES_AD1012 ZORRO_ID(SUNRIZE_INDUSTRIES, 0x01, 0) #define ZORRO_PROD_SUNRIZE_INDUSTRIES_AD516 ZORRO_ID(SUNRIZE_INDUSTRIES, 0x02, 0) #define ZORRO_PROD_SUNRIZE_INDUSTRIES_DD512 ZORRO_ID(SUNRIZE_INDUSTRIES, 0x03, 0) #define ZORRO_MANUF_TRICERATOPS 0x0850 #define ZORRO_PROD_TRICERATOPS_MULTI_IO ZORRO_ID(TRICERATOPS, 0x01, 0) #define ZORRO_MANUF_APPLIED_MAGIC 0x0851 #define ZORRO_PROD_APPLIED_MAGIC_DMI_RESOLVER ZORRO_ID(APPLIED_MAGIC, 0x01, 0) #define ZORRO_PROD_APPLIED_MAGIC_DIGITAL_BROADCASTER ZORRO_ID(APPLIED_MAGIC, 0x06, 0) #define ZORRO_MANUF_GFX_BASE 0x085E #define ZORRO_PROD_GFX_BASE_GDA_1_VRAM ZORRO_ID(GFX_BASE, 0x00, 0) #define ZORRO_PROD_GFX_BASE_GDA_1 ZORRO_ID(GFX_BASE, 0x01, 0) #define ZORRO_MANUF_ROCTEC 0x0860 #define ZORRO_PROD_ROCTEC_RH_800C ZORRO_ID(ROCTEC, 0x01, 0) #define ZORRO_PROD_ROCTEC_RH_800C_RAM ZORRO_ID(ROCTEC, 0x01, 0) #define ZORRO_MANUF_KATO 0x0861 #define ZORRO_PROD_KATO_MELODY ZORRO_ID(KATO, 0x80, 0) /* ID clash!! */ #define ZORRO_MANUF_HELFRICH_1 0x0861 #define ZORRO_PROD_HELFRICH_RAINBOW_II ZORRO_ID(HELFRICH_1, 0x20, 0) #define ZORRO_PROD_HELFRICH_RAINBOW_III ZORRO_ID(HELFRICH_1, 0x21, 0) #define ZORRO_MANUF_ATLANTIS 0x0862 #define ZORRO_MANUF_PROTAR 0x0864 #define ZORRO_MANUF_ACS 0x0865 #define ZORRO_MANUF_SOFTWARE_RESULTS_ENTERPRISES 0x0866 #define ZORRO_PROD_SOFTWARE_RESULTS_ENTERPRISES_GOLDEN_GATE_2_BUS_PLUS ZORRO_ID(SOFTWARE_RESULTS_ENTERPRISES, 0x01, 0) #define ZORRO_MANUF_MASOBOSHI 0x086D #define ZORRO_PROD_MASOBOSHI_MASTER_CARD_SC201 ZORRO_ID(MASOBOSHI, 0x03, 0) #define ZORRO_PROD_MASOBOSHI_MASTER_CARD_MC702 ZORRO_ID(MASOBOSHI, 0x04, 0) #define ZORRO_PROD_MASOBOSHI_MVD_819 ZORRO_ID(MASOBOSHI, 0x07, 0) #define ZORRO_MANUF_MAINHATTAN_DATA 0x086F #define ZORRO_PROD_MAINHATTAN_DATA_IDE ZORRO_ID(MAINHATTAN_DATA, 0x01, 0) #define ZORRO_MANUF_VILLAGE_TRONIC 0x0877 #define ZORRO_PROD_VILLAGE_TRONIC_DOMINO_RAM ZORRO_ID(VILLAGE_TRONIC, 0x01, 0) #define ZORRO_PROD_VILLAGE_TRONIC_DOMINO_REG ZORRO_ID(VILLAGE_TRONIC, 0x02, 0) #define ZORRO_PROD_VILLAGE_TRONIC_DOMINO_16M_PROTOTYPE ZORRO_ID(VILLAGE_TRONIC, 0x03, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_RAM ZORRO_ID(VILLAGE_TRONIC, 0x0B, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_REG ZORRO_ID(VILLAGE_TRONIC, 0x0C, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_SEGMENTED_MODE ZORRO_ID(VILLAGE_TRONIC, 0x0D, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_RAM1 ZORRO_ID(VILLAGE_TRONIC, 0x15, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_RAM2 ZORRO_ID(VILLAGE_TRONIC, 0x16, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_REG ZORRO_ID(VILLAGE_TRONIC, 0x17, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z3 ZORRO_ID(VILLAGE_TRONIC, 0x18, 0) #define ZORRO_PROD_VILLAGE_TRONIC_ARIADNE ZORRO_ID(VILLAGE_TRONIC, 0xC9, 0) #define ZORRO_PROD_VILLAGE_TRONIC_ARIADNE2 ZORRO_ID(VILLAGE_TRONIC, 0xCA, 0) #define ZORRO_MANUF_UTILITIES_UNLIMITED 0x087B #define ZORRO_PROD_UTILITIES_UNLIMITED_EMPLANT_DELUXE ZORRO_ID(UTILITIES_UNLIMITED, 0x15, 0) #define ZORRO_PROD_UTILITIES_UNLIMITED_EMPLANT_DELUXE2 ZORRO_ID(UTILITIES_UNLIMITED, 0x20, 0) #define ZORRO_MANUF_AMITRIX 0x0880 #define ZORRO_PROD_AMITRIX_MULTI_IO ZORRO_ID(AMITRIX, 0x01, 0) #define ZORRO_PROD_AMITRIX_CD_RAM ZORRO_ID(AMITRIX, 0x02, 0) #define ZORRO_MANUF_ARMAX 0x0885 #define ZORRO_PROD_ARMAX_OMNIBUS ZORRO_ID(ARMAX, 0x00, 0) #define ZORRO_MANUF_ZEUS 0x088D #define ZORRO_PROD_ZEUS_SPIDER ZORRO_ID(ZEUS, 0x04, 0) #define ZORRO_MANUF_NEWTEK 0x088F #define ZORRO_PROD_NEWTEK_VIDEOTOASTER ZORRO_ID(NEWTEK, 0x00, 0) #define ZORRO_MANUF_M_TECH_GERMANY 0x0890 #define ZORRO_PROD_MTEC_AT500_2 ZORRO_ID(M_TECH_GERMANY, 0x01, 0) #define ZORRO_PROD_MTEC_68030 ZORRO_ID(M_TECH_GERMANY, 0x03, 0) #define ZORRO_PROD_MTEC_68020I ZORRO_ID(M_TECH_GERMANY, 0x06, 0) #define ZORRO_PROD_MTEC_A1200_T68030_RTC ZORRO_ID(M_TECH_GERMANY, 0x20, 0) #define ZORRO_PROD_MTEC_VIPER_MK_V_E_MATRIX_530 ZORRO_ID(M_TECH_GERMANY, 0x21, 0) #define ZORRO_PROD_MTEC_8_MB_RAM ZORRO_ID(M_TECH_GERMANY, 0x22, 0) #define ZORRO_PROD_MTEC_VIPER_MK_V_E_MATRIX_530_SCSI_IDE ZORRO_ID(M_TECH_GERMANY, 0x24, 0) #define ZORRO_MANUF_GREAT_VALLEY_PRODUCTS_4 0x0891 #define ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_RAM ZORRO_ID(GREAT_VALLEY_PRODUCTS_4, 0x01, 0) #define ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_REG ZORRO_ID(GREAT_VALLEY_PRODUCTS_4, 0x02, 0) #define ZORRO_MANUF_APOLLO_1 0x0892 #define ZORRO_PROD_APOLLO_A1200 ZORRO_ID(APOLLO_1, 0x01, 0) #define ZORRO_MANUF_HELFRICH_2 0x0893 #define ZORRO_PROD_HELFRICH_PICCOLO_RAM ZORRO_ID(HELFRICH_2, 0x05, 0) #define ZORRO_PROD_HELFRICH_PICCOLO_REG ZORRO_ID(HELFRICH_2, 0x06, 0) #define ZORRO_PROD_HELFRICH_PEGGY_PLUS_MPEG ZORRO_ID(HELFRICH_2, 0x07, 0) #define ZORRO_PROD_HELFRICH_VIDEOCRUNCHER ZORRO_ID(HELFRICH_2, 0x08, 0) #define ZORRO_PROD_HELFRICH_SD64_RAM ZORRO_ID(HELFRICH_2, 0x0A, 0) #define ZORRO_PROD_HELFRICH_SD64_REG ZORRO_ID(HELFRICH_2, 0x0B, 0) #define ZORRO_MANUF_MACROSYSTEMS_USA 0x089B #define ZORRO_PROD_MACROSYSTEMS_WARP_ENGINE_40xx ZORRO_ID(MACROSYSTEMS_USA, 0x13, 0) #define ZORRO_MANUF_ELBOX_COMPUTER 0x089E #define ZORRO_PROD_ELBOX_COMPUTER_1200_4 ZORRO_ID(ELBOX_COMPUTER, 0x06, 0) #define ZORRO_MANUF_HARMS_PROFESSIONAL 0x0A00 #define ZORRO_PROD_HARMS_PROFESSIONAL_030_PLUS ZORRO_ID(HARMS_PROFESSIONAL, 0x10, 0) #define ZORRO_PROD_HARMS_PROFESSIONAL_3500 ZORRO_ID(HARMS_PROFESSIONAL, 0xD0, 0) #define ZORRO_MANUF_MICRONIK 0x0A50 #define ZORRO_PROD_MICRONIK_RCA_120 ZORRO_ID(MICRONIK, 0x0A, 0) #define ZORRO_MANUF_MICRONIK2 0x0F0F #define ZORRO_PROD_MICRONIK2_Z3I ZORRO_ID(MICRONIK2, 0x01, 0) #define ZORRO_MANUF_MEGAMICRO 0x1000 #define ZORRO_PROD_MEGAMICRO_SCRAM_500 ZORRO_ID(MEGAMICRO, 0x03, 0) #define ZORRO_PROD_MEGAMICRO_SCRAM_500_RAM ZORRO_ID(MEGAMICRO, 0x04, 0) #define ZORRO_MANUF_IMTRONICS_2 0x1028 #define ZORRO_PROD_IMTRONICS_HURRICANE_2800_3 ZORRO_ID(IMTRONICS_2, 0x39, 0) #define ZORRO_PROD_IMTRONICS_HURRICANE_2800_4 ZORRO_ID(IMTRONICS_2, 0x57, 0) /* unofficial ID */ #define ZORRO_MANUF_INDIVIDUAL_COMPUTERS 0x1212 #define ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA ZORRO_ID(INDIVIDUAL_COMPUTERS, 0x00, 0) #define ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF ZORRO_ID(INDIVIDUAL_COMPUTERS, 0x17, 0) #define ZORRO_PROD_INDIVIDUAL_COMPUTERS_CATWEASEL ZORRO_ID(INDIVIDUAL_COMPUTERS, 0x2A, 0) #define ZORRO_MANUF_KUPKE_3 0x1248 #define ZORRO_PROD_KUPKE_GOLEM_HD_3000 ZORRO_ID(KUPKE_3, 0x01, 0) #define ZORRO_MANUF_ITH 0x1388 #define ZORRO_PROD_ITH_ISDN_MASTER_II ZORRO_ID(ITH, 0x01, 0) #define ZORRO_MANUF_VMC 0x1389 #define ZORRO_PROD_VMC_ISDN_BLASTER_Z2 ZORRO_ID(VMC, 0x01, 0) #define ZORRO_PROD_VMC_HYPERCOM_4 ZORRO_ID(VMC, 0x02, 0) #define ZORRO_MANUF_INFORMATION 0x157C #define ZORRO_PROD_INFORMATION_ISDN_ENGINE_I ZORRO_ID(INFORMATION, 0x64, 0) #define ZORRO_MANUF_VORTEX 0x2017 #define ZORRO_PROD_VORTEX_GOLDEN_GATE_80386SX ZORRO_ID(VORTEX, 0x07, 0) #define ZORRO_PROD_VORTEX_GOLDEN_GATE_RAM ZORRO_ID(VORTEX, 0x08, 0) #define ZORRO_PROD_VORTEX_GOLDEN_GATE_80486 ZORRO_ID(VORTEX, 0x09, 0) #define ZORRO_MANUF_EXPANSION_SYSTEMS 0x2062 #define ZORRO_PROD_EXPANSION_SYSTEMS_DATAFLYER_4000SX ZORRO_ID(EXPANSION_SYSTEMS, 0x01, 0) #define ZORRO_PROD_EXPANSION_SYSTEMS_DATAFLYER_4000SX_RAM ZORRO_ID(EXPANSION_SYSTEMS, 0x02, 0) #define ZORRO_MANUF_READYSOFT 0x2100 #define ZORRO_PROD_READYSOFT_AMAX_II_IV ZORRO_ID(READYSOFT, 0x01, 0) #define ZORRO_MANUF_PHASE5 0x2140 #define ZORRO_PROD_PHASE5_BLIZZARD_RAM ZORRO_ID(PHASE5, 0x01, 0) #define ZORRO_PROD_PHASE5_BLIZZARD ZORRO_ID(PHASE5, 0x02, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_1220_IV ZORRO_ID(PHASE5, 0x06, 0) #define ZORRO_PROD_PHASE5_FASTLANE_Z3_RAM ZORRO_ID(PHASE5, 0x0A, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_1230_II_FASTLANE_Z3_CYBERSCSI_CYBERSTORM060 ZORRO_ID(PHASE5, 0x0B, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_1220_CYBERSTORM ZORRO_ID(PHASE5, 0x0C, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_1230 ZORRO_ID(PHASE5, 0x0D, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_1230_IV_1260 ZORRO_ID(PHASE5, 0x11, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_2060 ZORRO_ID(PHASE5, 0x18, 0) #define ZORRO_PROD_PHASE5_CYBERSTORM_MK_II ZORRO_ID(PHASE5, 0x19, 0) #define ZORRO_PROD_PHASE5_CYBERVISION64 ZORRO_ID(PHASE5, 0x22, 0) #define ZORRO_PROD_PHASE5_CYBERVISION64_3D_PROTOTYPE ZORRO_ID(PHASE5, 0x32, 0) #define ZORRO_PROD_PHASE5_CYBERVISION64_3D ZORRO_ID(PHASE5, 0x43, 0) #define ZORRO_PROD_PHASE5_CYBERSTORM_MK_III ZORRO_ID(PHASE5, 0x64, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_603E_PLUS ZORRO_ID(PHASE5, 0x6e, 0) #define ZORRO_MANUF_DPS 0x2169 #define ZORRO_PROD_DPS_PERSONAL_ANIMATION_RECORDER ZORRO_ID(DPS, 0x01, 0) #define ZORRO_MANUF_APOLLO_2 0x2200 #define ZORRO_PROD_APOLLO_A620_68020_1 ZORRO_ID(APOLLO_2, 0x00, 0) #define ZORRO_PROD_APOLLO_A620_68020_2 ZORRO_ID(APOLLO_2, 0x01, 0) #define ZORRO_MANUF_APOLLO_3 0x2222 #define ZORRO_PROD_APOLLO_AT_APOLLO ZORRO_ID(APOLLO_3, 0x22, 0) #define ZORRO_PROD_APOLLO_1230_1240_1260_2030_4040_4060 ZORRO_ID(APOLLO_3, 0x23, 0) #define ZORRO_MANUF_PETSOFF_LP 0x38A5 #define ZORRO_PROD_PETSOFF_LP_DELFINA ZORRO_ID(PETSOFF_LP, 0x00, 0) #define ZORRO_PROD_PETSOFF_LP_DELFINA_LITE ZORRO_ID(PETSOFF_LP, 0x01, 0) #define ZORRO_MANUF_UWE_GERLACH 0x3FF7 #define ZORRO_PROD_UWE_GERLACH_RAM_ROM ZORRO_ID(UWE_GERLACH, 0xd4, 0) #define ZORRO_MANUF_ACT 0x4231 #define ZORRO_PROD_ACT_PRELUDE ZORRO_ID(ACT, 0x01, 0) #define ZORRO_MANUF_MACROSYSTEMS_GERMANY 0x4754 #define ZORRO_PROD_MACROSYSTEMS_MAESTRO ZORRO_ID(MACROSYSTEMS_GERMANY, 0x03, 0) #define ZORRO_PROD_MACROSYSTEMS_VLAB ZORRO_ID(MACROSYSTEMS_GERMANY, 0x04, 0) #define ZORRO_PROD_MACROSYSTEMS_MAESTRO_PRO ZORRO_ID(MACROSYSTEMS_GERMANY, 0x05, 0) #define ZORRO_PROD_MACROSYSTEMS_RETINA ZORRO_ID(MACROSYSTEMS_GERMANY, 0x06, 0) #define ZORRO_PROD_MACROSYSTEMS_MULTI_EVOLUTION ZORRO_ID(MACROSYSTEMS_GERMANY, 0x08, 0) #define ZORRO_PROD_MACROSYSTEMS_TOCCATA ZORRO_ID(MACROSYSTEMS_GERMANY, 0x0C, 0) #define ZORRO_PROD_MACROSYSTEMS_RETINA_Z3 ZORRO_ID(MACROSYSTEMS_GERMANY, 0x10, 0) #define ZORRO_PROD_MACROSYSTEMS_VLAB_MOTION ZORRO_ID(MACROSYSTEMS_GERMANY, 0x12, 0) #define ZORRO_PROD_MACROSYSTEMS_ALTAIS ZORRO_ID(MACROSYSTEMS_GERMANY, 0x13, 0) #define ZORRO_PROD_MACROSYSTEMS_FALCON_040 ZORRO_ID(MACROSYSTEMS_GERMANY, 0xFD, 0) #define ZORRO_MANUF_COMBITEC 0x6766 #define ZORRO_MANUF_SKI_PERIPHERALS 0x8000 #define ZORRO_PROD_SKI_PERIPHERALS_MAST_FIREBALL ZORRO_ID(SKI_PERIPHERALS, 0x08, 0) #define ZORRO_PROD_SKI_PERIPHERALS_SCSI_DUAL_SERIAL ZORRO_ID(SKI_PERIPHERALS, 0x80, 0) #define ZORRO_MANUF_REIS_WARE_2 0xA9AD #define ZORRO_PROD_REIS_WARE_SCAN_KING ZORRO_ID(REIS_WARE_2, 0x11, 0) #define ZORRO_MANUF_CAMERON 0xAA01 #define ZORRO_PROD_CAMERON_PERSONAL_A4 ZORRO_ID(CAMERON, 0x10, 0) #define ZORRO_MANUF_REIS_WARE 0xAA11 #define ZORRO_PROD_REIS_WARE_HANDYSCANNER ZORRO_ID(REIS_WARE, 0x11, 0) #define ZORRO_MANUF_PHOENIX_2 0xB5A8 #define ZORRO_PROD_PHOENIX_ST506_2 ZORRO_ID(PHOENIX_2, 0x21, 0) #define ZORRO_PROD_PHOENIX_SCSI_2 ZORRO_ID(PHOENIX_2, 0x22, 0) #define ZORRO_PROD_PHOENIX_RAM_2 ZORRO_ID(PHOENIX_2, 0xBE, 0) #define ZORRO_MANUF_COMBITEC_2 0xC008 #define ZORRO_PROD_COMBITEC_HD ZORRO_ID(COMBITEC_2, 0x2A, 0) #define ZORRO_PROD_COMBITEC_SRAM ZORRO_ID(COMBITEC_2, 0x2B, 0) /* * Test and illegal Manufacturer IDs. */ #define ZORRO_MANUF_HACKER 0x07DB #define ZORRO_PROD_GENERAL_PROTOTYPE ZORRO_ID(HACKER, 0x00, 0) #define ZORRO_PROD_HACKER_SCSI ZORRO_ID(HACKER, 0x01, 0) #define ZORRO_PROD_RESOURCE_MANAGEMENT_FORCE_QUICKNET_QN2000 ZORRO_ID(HACKER, 0x02, 0) #define ZORRO_PROD_VECTOR_CONNECTION_2 ZORRO_ID(HACKER, 0xE0, 0) #define ZORRO_PROD_VECTOR_CONNECTION_3 ZORRO_ID(HACKER, 0xE1, 0) #define ZORRO_PROD_VECTOR_CONNECTION_4 ZORRO_ID(HACKER, 0xE2, 0) #define ZORRO_PROD_VECTOR_CONNECTION_5 ZORRO_ID(HACKER, 0xE3, 0) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/sonypi.h��������������������������������������������������������������������������������������0000644�����������������00000012275�14763166027�0007420 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Sony Programmable I/O Control Device driver for VAIO * * Copyright (C) 2001-2005 Stelian Pop <stelian@popies.net> * * Copyright (C) 2005 Narayanan R S <nars@kadamba.org> * Copyright (C) 2001-2002 Alcôve <www.alcove.com> * * Copyright (C) 2001 Michael Ashley <m.ashley@unsw.edu.au> * * Copyright (C) 2001 Junichi Morita <jun1m@mars.dti.ne.jp> * * Copyright (C) 2000 Takaya Kinjo <t-kinjo@tc4.so-net.ne.jp> * * Copyright (C) 2000 Andrew Tridgell <tridge@valinux.com> * * Earlier work by Werner Almesberger, Paul `Rusty' Russell and Paul Mackerras. * * 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. * */ #ifndef _SONYPI_H_ #define _SONYPI_H_ #include <linux/types.h> /* events the user application reading /dev/sonypi can use */ #define SONYPI_EVENT_IGNORE 0 #define SONYPI_EVENT_JOGDIAL_DOWN 1 #define SONYPI_EVENT_JOGDIAL_UP 2 #define SONYPI_EVENT_JOGDIAL_DOWN_PRESSED 3 #define SONYPI_EVENT_JOGDIAL_UP_PRESSED 4 #define SONYPI_EVENT_JOGDIAL_PRESSED 5 #define SONYPI_EVENT_JOGDIAL_RELEASED 6 /* obsolete */ #define SONYPI_EVENT_CAPTURE_PRESSED 7 #define SONYPI_EVENT_CAPTURE_RELEASED 8 /* obsolete */ #define SONYPI_EVENT_CAPTURE_PARTIALPRESSED 9 #define SONYPI_EVENT_CAPTURE_PARTIALRELEASED 10 #define SONYPI_EVENT_FNKEY_ESC 11 #define SONYPI_EVENT_FNKEY_F1 12 #define SONYPI_EVENT_FNKEY_F2 13 #define SONYPI_EVENT_FNKEY_F3 14 #define SONYPI_EVENT_FNKEY_F4 15 #define SONYPI_EVENT_FNKEY_F5 16 #define SONYPI_EVENT_FNKEY_F6 17 #define SONYPI_EVENT_FNKEY_F7 18 #define SONYPI_EVENT_FNKEY_F8 19 #define SONYPI_EVENT_FNKEY_F9 20 #define SONYPI_EVENT_FNKEY_F10 21 #define SONYPI_EVENT_FNKEY_F11 22 #define SONYPI_EVENT_FNKEY_F12 23 #define SONYPI_EVENT_FNKEY_1 24 #define SONYPI_EVENT_FNKEY_2 25 #define SONYPI_EVENT_FNKEY_D 26 #define SONYPI_EVENT_FNKEY_E 27 #define SONYPI_EVENT_FNKEY_F 28 #define SONYPI_EVENT_FNKEY_S 29 #define SONYPI_EVENT_FNKEY_B 30 #define SONYPI_EVENT_BLUETOOTH_PRESSED 31 #define SONYPI_EVENT_PKEY_P1 32 #define SONYPI_EVENT_PKEY_P2 33 #define SONYPI_EVENT_PKEY_P3 34 #define SONYPI_EVENT_BACK_PRESSED 35 #define SONYPI_EVENT_LID_CLOSED 36 #define SONYPI_EVENT_LID_OPENED 37 #define SONYPI_EVENT_BLUETOOTH_ON 38 #define SONYPI_EVENT_BLUETOOTH_OFF 39 #define SONYPI_EVENT_HELP_PRESSED 40 #define SONYPI_EVENT_FNKEY_ONLY 41 #define SONYPI_EVENT_JOGDIAL_FAST_DOWN 42 #define SONYPI_EVENT_JOGDIAL_FAST_UP 43 #define SONYPI_EVENT_JOGDIAL_FAST_DOWN_PRESSED 44 #define SONYPI_EVENT_JOGDIAL_FAST_UP_PRESSED 45 #define SONYPI_EVENT_JOGDIAL_VFAST_DOWN 46 #define SONYPI_EVENT_JOGDIAL_VFAST_UP 47 #define SONYPI_EVENT_JOGDIAL_VFAST_DOWN_PRESSED 48 #define SONYPI_EVENT_JOGDIAL_VFAST_UP_PRESSED 49 #define SONYPI_EVENT_ZOOM_PRESSED 50 #define SONYPI_EVENT_THUMBPHRASE_PRESSED 51 #define SONYPI_EVENT_MEYE_FACE 52 #define SONYPI_EVENT_MEYE_OPPOSITE 53 #define SONYPI_EVENT_MEMORYSTICK_INSERT 54 #define SONYPI_EVENT_MEMORYSTICK_EJECT 55 #define SONYPI_EVENT_ANYBUTTON_RELEASED 56 #define SONYPI_EVENT_BATTERY_INSERT 57 #define SONYPI_EVENT_BATTERY_REMOVE 58 #define SONYPI_EVENT_FNKEY_RELEASED 59 #define SONYPI_EVENT_WIRELESS_ON 60 #define SONYPI_EVENT_WIRELESS_OFF 61 #define SONYPI_EVENT_ZOOM_IN_PRESSED 62 #define SONYPI_EVENT_ZOOM_OUT_PRESSED 63 #define SONYPI_EVENT_CD_EJECT_PRESSED 64 #define SONYPI_EVENT_MODEKEY_PRESSED 65 #define SONYPI_EVENT_PKEY_P4 66 #define SONYPI_EVENT_PKEY_P5 67 #define SONYPI_EVENT_SETTINGKEY_PRESSED 68 #define SONYPI_EVENT_VOLUME_INC_PRESSED 69 #define SONYPI_EVENT_VOLUME_DEC_PRESSED 70 #define SONYPI_EVENT_BRIGHTNESS_PRESSED 71 #define SONYPI_EVENT_MEDIA_PRESSED 72 #define SONYPI_EVENT_VENDOR_PRESSED 73 /* get/set brightness */ #define SONYPI_IOCGBRT _IOR('v', 0, __u8) #define SONYPI_IOCSBRT _IOW('v', 0, __u8) /* get battery full capacity/remaining capacity */ #define SONYPI_IOCGBAT1CAP _IOR('v', 2, __u16) #define SONYPI_IOCGBAT1REM _IOR('v', 3, __u16) #define SONYPI_IOCGBAT2CAP _IOR('v', 4, __u16) #define SONYPI_IOCGBAT2REM _IOR('v', 5, __u16) /* get battery flags: battery1/battery2/ac adapter present */ #define SONYPI_BFLAGS_B1 0x01 #define SONYPI_BFLAGS_B2 0x02 #define SONYPI_BFLAGS_AC 0x04 #define SONYPI_IOCGBATFLAGS _IOR('v', 7, __u8) /* get/set bluetooth subsystem state on/off */ #define SONYPI_IOCGBLUE _IOR('v', 8, __u8) #define SONYPI_IOCSBLUE _IOW('v', 9, __u8) /* get/set fan state on/off */ #define SONYPI_IOCGFAN _IOR('v', 10, __u8) #define SONYPI_IOCSFAN _IOW('v', 11, __u8) /* get temperature (C) */ #define SONYPI_IOCGTEMP _IOR('v', 12, __u8) #endif /* _SONYPI_H_ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/firewire-cdev.h�������������������������������������������������������������������������������0000644�����������������00000125556�14763166027�0010641 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Char device interface. * * Copyright (C) 2005-2007 Kristian Hoegsberg <krh@bitplanet.net> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef _LINUX_FIREWIRE_CDEV_H #define _LINUX_FIREWIRE_CDEV_H #include <linux/ioctl.h> #include <linux/types.h> #include <linux/firewire-constants.h> /* available since kernel version 2.6.22 */ #define FW_CDEV_EVENT_BUS_RESET 0x00 #define FW_CDEV_EVENT_RESPONSE 0x01 #define FW_CDEV_EVENT_REQUEST 0x02 #define FW_CDEV_EVENT_ISO_INTERRUPT 0x03 /* available since kernel version 2.6.30 */ #define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED 0x04 #define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 0x05 /* available since kernel version 2.6.36 */ #define FW_CDEV_EVENT_REQUEST2 0x06 #define FW_CDEV_EVENT_PHY_PACKET_SENT 0x07 #define FW_CDEV_EVENT_PHY_PACKET_RECEIVED 0x08 #define FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL 0x09 /** * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types * @closure: For arbitrary use by userspace * @type: Discriminates the fw_cdev_event_ types * * This struct may be used to access generic members of all fw_cdev_event_ * types regardless of the specific type. * * Data passed in the @closure field for a request will be returned in the * corresponding event. It is big enough to hold a pointer on all platforms. * The ioctl used to set @closure depends on the @type of event. */ struct fw_cdev_event_common { __u64 closure; __u32 type; }; /** * struct fw_cdev_event_bus_reset - Sent when a bus reset occurred * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_GET_INFO ioctl * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_BUS_RESET * @node_id: New node ID of this node * @local_node_id: Node ID of the local node, i.e. of the controller * @bm_node_id: Node ID of the bus manager * @irm_node_id: Node ID of the iso resource manager * @root_node_id: Node ID of the root node * @generation: New bus generation * * This event is sent when the bus the device belongs to goes through a bus * reset. It provides information about the new bus configuration, such as * new node ID for this device, new root ID, and others. * * If @bm_node_id is 0xffff right after bus reset it can be reread by an * %FW_CDEV_IOC_GET_INFO ioctl after bus manager selection was finished. * Kernels with ABI version < 4 do not set @bm_node_id. */ struct fw_cdev_event_bus_reset { __u64 closure; __u32 type; __u32 node_id; __u32 local_node_id; __u32 bm_node_id; __u32 irm_node_id; __u32 root_node_id; __u32 generation; }; /** * struct fw_cdev_event_response - Sent when a response packet was received * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_REQUEST * or %FW_CDEV_IOC_SEND_BROADCAST_REQUEST * or %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_RESPONSE * @rcode: Response code returned by the remote node * @length: Data length, i.e. the response's payload size in bytes * @data: Payload data, if any * * This event is sent when the stack receives a response to an outgoing request * sent by %FW_CDEV_IOC_SEND_REQUEST ioctl. The payload data for responses * carrying data (read and lock responses) follows immediately and can be * accessed through the @data field. * * The event is also generated after conclusions of transactions that do not * involve response packets. This includes unified write transactions, * broadcast write transactions, and transmission of asynchronous stream * packets. @rcode indicates success or failure of such transmissions. */ struct fw_cdev_event_response { __u64 closure; __u32 type; __u32 rcode; __u32 length; __u32 data[0]; }; /** * struct fw_cdev_event_request - Old version of &fw_cdev_event_request2 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST * * This event is sent instead of &fw_cdev_event_request2 if the kernel or * the client implements ABI version <= 3. &fw_cdev_event_request lacks * essential information; use &fw_cdev_event_request2 instead. */ struct fw_cdev_event_request { __u64 closure; __u32 type; __u32 tcode; __u64 offset; __u32 handle; __u32 length; __u32 data[0]; }; /** * struct fw_cdev_event_request2 - Sent on incoming request to an address region * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST2 * @tcode: Transaction code of the incoming request * @offset: The offset into the 48-bit per-node address space * @source_node_id: Sender node ID * @destination_node_id: Destination node ID * @card: The index of the card from which the request came * @generation: Bus generation in which the request is valid * @handle: Reference to the kernel-side pending request * @length: Data length, i.e. the request's payload size in bytes * @data: Incoming data, if any * * This event is sent when the stack receives an incoming request to an address * region registered using the %FW_CDEV_IOC_ALLOCATE ioctl. The request is * guaranteed to be completely contained in the specified region. Userspace is * responsible for sending the response by %FW_CDEV_IOC_SEND_RESPONSE ioctl, * using the same @handle. * * The payload data for requests carrying data (write and lock requests) * follows immediately and can be accessed through the @data field. * * Unlike &fw_cdev_event_request, @tcode of lock requests is one of the * firewire-core specific %TCODE_LOCK_MASK_SWAP...%TCODE_LOCK_VENDOR_DEPENDENT, * i.e. encodes the extended transaction code. * * @card may differ from &fw_cdev_get_info.card because requests are received * from all cards of the Linux host. @source_node_id, @destination_node_id, and * @generation pertain to that card. Destination node ID and bus generation may * therefore differ from the corresponding fields of the last * &fw_cdev_event_bus_reset. * * @destination_node_id may also differ from the current node ID because of a * non-local bus ID part or in case of a broadcast write request. Note, a * client must call an %FW_CDEV_IOC_SEND_RESPONSE ioctl even in case of a * broadcast write request; the kernel will then release the kernel-side pending * request but will not actually send a response packet. * * In case of a write request to FCP_REQUEST or FCP_RESPONSE, the kernel already * sent a write response immediately after the request was received; in this * case the client must still call an %FW_CDEV_IOC_SEND_RESPONSE ioctl to * release the kernel-side pending request, though another response won't be * sent. * * If the client subsequently needs to initiate requests to the sender node of * an &fw_cdev_event_request2, it needs to use a device file with matching * card index, node ID, and generation for outbound requests. */ struct fw_cdev_event_request2 { __u64 closure; __u32 type; __u32 tcode; __u64 offset; __u32 source_node_id; __u32 destination_node_id; __u32 card; __u32 generation; __u32 handle; __u32 length; __u32 data[0]; }; /** * struct fw_cdev_event_iso_interrupt - Sent when an iso packet was completed * @closure: See &fw_cdev_event_common; * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_ISO_INTERRUPT * @cycle: Cycle counter of the last completed packet * @header_length: Total length of following headers, in bytes * @header: Stripped headers, if any * * This event is sent when the controller has completed an &fw_cdev_iso_packet * with the %FW_CDEV_ISO_INTERRUPT bit set, when explicitly requested with * %FW_CDEV_IOC_FLUSH_ISO, or when there have been so many completed packets * without the interrupt bit set that the kernel's internal buffer for @header * is about to overflow. (In the last case, ABI versions < 5 drop header data * up to the next interrupt packet.) * * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT): * * In version 3 and some implementations of version 2 of the ABI, &header_length * is a multiple of 4 and &header contains timestamps of all packets up until * the interrupt packet. The format of the timestamps is as described below for * isochronous reception. In version 1 of the ABI, &header_length was 0. * * Isochronous receive events (context type %FW_CDEV_ISO_CONTEXT_RECEIVE): * * The headers stripped of all packets up until and including the interrupt * packet are returned in the @header field. The amount of header data per * packet is as specified at iso context creation by * &fw_cdev_create_iso_context.header_size. * * Hence, _interrupt.header_length / _context.header_size is the number of * packets received in this interrupt event. The client can now iterate * through the mmap()'ed DMA buffer according to this number of packets and * to the buffer sizes as the client specified in &fw_cdev_queue_iso. * * Since version 2 of this ABI, the portion for each packet in _interrupt.header * consists of the 1394 isochronous packet header, followed by a timestamp * quadlet if &fw_cdev_create_iso_context.header_size > 4, followed by quadlets * from the packet payload if &fw_cdev_create_iso_context.header_size > 8. * * Format of 1394 iso packet header: 16 bits data_length, 2 bits tag, 6 bits * channel, 4 bits tcode, 4 bits sy, in big endian byte order. * data_length is the actual received size of the packet without the four * 1394 iso packet header bytes. * * Format of timestamp: 16 bits invalid, 3 bits cycleSeconds, 13 bits * cycleCount, in big endian byte order. * * In version 1 of the ABI, no timestamp quadlet was inserted; instead, payload * data followed directly after the 1394 is header if header_size > 4. * Behaviour of ver. 1 of this ABI is no longer available since ABI ver. 2. */ struct fw_cdev_event_iso_interrupt { __u64 closure; __u32 type; __u32 cycle; __u32 header_length; __u32 header[0]; }; /** * struct fw_cdev_event_iso_interrupt_mc - An iso buffer chunk was completed * @closure: See &fw_cdev_event_common; * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl * @type: %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL * @completed: Offset into the receive buffer; data before this offset is valid * * This event is sent in multichannel contexts (context type * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer * chunks that have been completely filled and that have the * %FW_CDEV_ISO_INTERRUPT bit set, or when explicitly requested with * %FW_CDEV_IOC_FLUSH_ISO. * * The buffer is continuously filled with the following data, per packet: * - the 1394 iso packet header as described at &fw_cdev_event_iso_interrupt, * but in little endian byte order, * - packet payload (as many bytes as specified in the data_length field of * the 1394 iso packet header) in big endian byte order, * - 0...3 padding bytes as needed to align the following trailer quadlet, * - trailer quadlet, containing the reception timestamp as described at * &fw_cdev_event_iso_interrupt, but in little endian byte order. * * Hence the per-packet size is data_length (rounded up to a multiple of 4) + 8. * When processing the data, stop before a packet that would cross the * @completed offset. * * A packet near the end of a buffer chunk will typically spill over into the * next queued buffer chunk. It is the responsibility of the client to check * for this condition, assemble a broken-up packet from its parts, and not to * re-queue any buffer chunks in which as yet unread packet parts reside. */ struct fw_cdev_event_iso_interrupt_mc { __u64 closure; __u32 type; __u32 completed; }; /** * struct fw_cdev_event_iso_resource - Iso resources were allocated or freed * @closure: See &fw_cdev_event_common; * set by %FW_CDEV_IOC_(DE)ALLOCATE_ISO_RESOURCE(_ONCE) ioctl * @type: %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED * @handle: Reference by which an allocated resource can be deallocated * @channel: Isochronous channel which was (de)allocated, if any * @bandwidth: Bandwidth allocation units which were (de)allocated, if any * * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event is sent after an isochronous * resource was allocated at the IRM. The client has to check @channel and * @bandwidth for whether the allocation actually succeeded. * * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event is sent after an isochronous * resource was deallocated at the IRM. It is also sent when automatic * reallocation after a bus reset failed. * * @channel is <0 if no channel was (de)allocated or if reallocation failed. * @bandwidth is 0 if no bandwidth was (de)allocated or if reallocation failed. */ struct fw_cdev_event_iso_resource { __u64 closure; __u32 type; __u32 handle; __s32 channel; __s32 bandwidth; }; /** * struct fw_cdev_event_phy_packet - A PHY packet was transmitted or received * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_PHY_PACKET * or %FW_CDEV_IOC_RECEIVE_PHY_PACKETS ioctl * @type: %FW_CDEV_EVENT_PHY_PACKET_SENT or %..._RECEIVED * @rcode: %RCODE_..., indicates success or failure of transmission * @length: Data length in bytes * @data: Incoming data * * If @type is %FW_CDEV_EVENT_PHY_PACKET_SENT, @length is 0 and @data empty, * except in case of a ping packet: Then, @length is 4, and @data[0] is the * ping time in 49.152MHz clocks if @rcode is %RCODE_COMPLETE. * * If @type is %FW_CDEV_EVENT_PHY_PACKET_RECEIVED, @length is 8 and @data * consists of the two PHY packet quadlets, in host byte order. */ struct fw_cdev_event_phy_packet { __u64 closure; __u32 type; __u32 rcode; __u32 length; __u32 data[0]; }; /** * union fw_cdev_event - Convenience union of fw_cdev_event_ types * @common: Valid for all types * @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET * @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST * @request2: Valid if @common.type == %FW_CDEV_EVENT_REQUEST2 * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT * @iso_interrupt_mc: Valid if @common.type == * %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL * @iso_resource: Valid if @common.type == * %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED * @phy_packet: Valid if @common.type == * %FW_CDEV_EVENT_PHY_PACKET_SENT or * %FW_CDEV_EVENT_PHY_PACKET_RECEIVED * * Convenience union for userspace use. Events could be read(2) into an * appropriately aligned char buffer and then cast to this union for further * processing. Note that for a request, response or iso_interrupt event, * the data[] or header[] may make the size of the full event larger than * sizeof(union fw_cdev_event). Also note that if you attempt to read(2) * an event into a buffer that is not large enough for it, the data that does * not fit will be discarded so that the next read(2) will return a new event. */ union fw_cdev_event { struct fw_cdev_event_common common; struct fw_cdev_event_bus_reset bus_reset; struct fw_cdev_event_response response; struct fw_cdev_event_request request; struct fw_cdev_event_request2 request2; /* added in 2.6.36 */ struct fw_cdev_event_iso_interrupt iso_interrupt; struct fw_cdev_event_iso_interrupt_mc iso_interrupt_mc; /* added in 2.6.36 */ struct fw_cdev_event_iso_resource iso_resource; /* added in 2.6.30 */ struct fw_cdev_event_phy_packet phy_packet; /* added in 2.6.36 */ }; /* available since kernel version 2.6.22 */ #define FW_CDEV_IOC_GET_INFO _IOWR('#', 0x00, struct fw_cdev_get_info) #define FW_CDEV_IOC_SEND_REQUEST _IOW('#', 0x01, struct fw_cdev_send_request) #define FW_CDEV_IOC_ALLOCATE _IOWR('#', 0x02, struct fw_cdev_allocate) #define FW_CDEV_IOC_DEALLOCATE _IOW('#', 0x03, struct fw_cdev_deallocate) #define FW_CDEV_IOC_SEND_RESPONSE _IOW('#', 0x04, struct fw_cdev_send_response) #define FW_CDEV_IOC_INITIATE_BUS_RESET _IOW('#', 0x05, struct fw_cdev_initiate_bus_reset) #define FW_CDEV_IOC_ADD_DESCRIPTOR _IOWR('#', 0x06, struct fw_cdev_add_descriptor) #define FW_CDEV_IOC_REMOVE_DESCRIPTOR _IOW('#', 0x07, struct fw_cdev_remove_descriptor) #define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOWR('#', 0x08, struct fw_cdev_create_iso_context) #define FW_CDEV_IOC_QUEUE_ISO _IOWR('#', 0x09, struct fw_cdev_queue_iso) #define FW_CDEV_IOC_START_ISO _IOW('#', 0x0a, struct fw_cdev_start_iso) #define FW_CDEV_IOC_STOP_ISO _IOW('#', 0x0b, struct fw_cdev_stop_iso) /* available since kernel version 2.6.24 */ #define FW_CDEV_IOC_GET_CYCLE_TIMER _IOR('#', 0x0c, struct fw_cdev_get_cycle_timer) /* available since kernel version 2.6.30 */ #define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE _IOWR('#', 0x0d, struct fw_cdev_allocate_iso_resource) #define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE _IOW('#', 0x0e, struct fw_cdev_deallocate) #define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x0f, struct fw_cdev_allocate_iso_resource) #define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x10, struct fw_cdev_allocate_iso_resource) #define FW_CDEV_IOC_GET_SPEED _IO('#', 0x11) /* returns speed code */ #define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request) #define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet) /* available since kernel version 2.6.34 */ #define FW_CDEV_IOC_GET_CYCLE_TIMER2 _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2) /* available since kernel version 2.6.36 */ #define FW_CDEV_IOC_SEND_PHY_PACKET _IOWR('#', 0x15, struct fw_cdev_send_phy_packet) #define FW_CDEV_IOC_RECEIVE_PHY_PACKETS _IOW('#', 0x16, struct fw_cdev_receive_phy_packets) #define FW_CDEV_IOC_SET_ISO_CHANNELS _IOW('#', 0x17, struct fw_cdev_set_iso_channels) /* available since kernel version 3.4 */ #define FW_CDEV_IOC_FLUSH_ISO _IOW('#', 0x18, struct fw_cdev_flush_iso) /* * ABI version history * 1 (2.6.22) - initial version * (2.6.24) - added %FW_CDEV_IOC_GET_CYCLE_TIMER * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if * &fw_cdev_create_iso_context.header_size is 8 or more * - added %FW_CDEV_IOC_*_ISO_RESOURCE*, * %FW_CDEV_IOC_GET_SPEED, %FW_CDEV_IOC_SEND_BROADCAST_REQUEST, * %FW_CDEV_IOC_SEND_STREAM_PACKET * (2.6.32) - added time stamp to xmit &fw_cdev_event_iso_interrupt * (2.6.33) - IR has always packet-per-buffer semantics now, not one of * dual-buffer or packet-per-buffer depending on hardware * - shared use and auto-response for FCP registers * 3 (2.6.34) - made &fw_cdev_get_cycle_timer reliable * - added %FW_CDEV_IOC_GET_CYCLE_TIMER2 * 4 (2.6.36) - added %FW_CDEV_EVENT_REQUEST2, %FW_CDEV_EVENT_PHY_PACKET_*, * and &fw_cdev_allocate.region_end * - implemented &fw_cdev_event_bus_reset.bm_node_id * - added %FW_CDEV_IOC_SEND_PHY_PACKET, _RECEIVE_PHY_PACKETS * - added %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL, * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and * %FW_CDEV_IOC_SET_ISO_CHANNELS * 5 (3.4) - send %FW_CDEV_EVENT_ISO_INTERRUPT events when needed to * avoid dropping data * - added %FW_CDEV_IOC_FLUSH_ISO */ /** * struct fw_cdev_get_info - General purpose information ioctl * @version: The version field is just a running serial number. Both an * input parameter (ABI version implemented by the client) and * output parameter (ABI version implemented by the kernel). * A client shall fill in the ABI @version for which the client * was implemented. This is necessary for forward compatibility. * @rom_length: If @rom is non-zero, up to @rom_length bytes of Configuration * ROM will be copied into that user space address. In either * case, @rom_length is updated with the actual length of the * Configuration ROM. * @rom: If non-zero, address of a buffer to be filled by a copy of the * device's Configuration ROM * @bus_reset: If non-zero, address of a buffer to be filled by a * &struct fw_cdev_event_bus_reset with the current state * of the bus. This does not cause a bus reset to happen. * @bus_reset_closure: Value of &closure in this and subsequent bus reset events * @card: The index of the card this device belongs to * * The %FW_CDEV_IOC_GET_INFO ioctl is usually the very first one which a client * performs right after it opened a /dev/fw* file. * * As a side effect, reception of %FW_CDEV_EVENT_BUS_RESET events to be read(2) * is started by this ioctl. */ struct fw_cdev_get_info { __u32 version; __u32 rom_length; __u64 rom; __u64 bus_reset; __u64 bus_reset_closure; __u32 card; }; /** * struct fw_cdev_send_request - Send an asynchronous request packet * @tcode: Transaction code of the request * @length: Length of outgoing payload, in bytes * @offset: 48-bit offset at destination node * @closure: Passed back to userspace in the response event * @data: Userspace pointer to payload * @generation: The bus generation where packet is valid * * Send a request to the device. This ioctl implements all outgoing requests. * Both quadlet and block request specify the payload as a pointer to the data * in the @data field. Once the transaction completes, the kernel writes an * &fw_cdev_event_response event back. The @closure field is passed back to * user space in the response event. */ struct fw_cdev_send_request { __u32 tcode; __u32 length; __u64 offset; __u64 closure; __u64 data; __u32 generation; }; /** * struct fw_cdev_send_response - Send an asynchronous response packet * @rcode: Response code as determined by the userspace handler * @length: Length of outgoing payload, in bytes * @data: Userspace pointer to payload * @handle: The handle from the &fw_cdev_event_request * * Send a response to an incoming request. By setting up an address range using * the %FW_CDEV_IOC_ALLOCATE ioctl, userspace can listen for incoming requests. An * incoming request will generate an %FW_CDEV_EVENT_REQUEST, and userspace must * send a reply using this ioctl. The event has a handle to the kernel-side * pending transaction, which should be used with this ioctl. */ struct fw_cdev_send_response { __u32 rcode; __u32 length; __u64 data; __u32 handle; }; /** * struct fw_cdev_allocate - Allocate a CSR in an address range * @offset: Start offset of the address range * @closure: To be passed back to userspace in request events * @length: Length of the CSR, in bytes * @handle: Handle to the allocation, written by the kernel * @region_end: First address above the address range (added in ABI v4, 2.6.36) * * Allocate an address range in the 48-bit address space on the local node * (the controller). This allows userspace to listen for requests with an * offset within that address range. Every time when the kernel receives a * request within the range, an &fw_cdev_event_request2 event will be emitted. * (If the kernel or the client implements ABI version <= 3, an * &fw_cdev_event_request will be generated instead.) * * The @closure field is passed back to userspace in these request events. * The @handle field is an out parameter, returning a handle to the allocated * range to be used for later deallocation of the range. * * The address range is allocated on all local nodes. The address allocation * is exclusive except for the FCP command and response registers. If an * exclusive address region is already in use, the ioctl fails with errno set * to %EBUSY. * * If kernel and client implement ABI version >= 4, the kernel looks up a free * spot of size @length inside [@offset..@region_end) and, if found, writes * the start address of the new CSR back in @offset. I.e. @offset is an * in and out parameter. If this automatic placement of a CSR in a bigger * address range is not desired, the client simply needs to set @region_end * = @offset + @length. * * If the kernel or the client implements ABI version <= 3, @region_end is * ignored and effectively assumed to be @offset + @length. * * @region_end is only present in a kernel header >= 2.6.36. If necessary, * this can for example be tested by #ifdef FW_CDEV_EVENT_REQUEST2. */ struct fw_cdev_allocate { __u64 offset; __u64 closure; __u32 length; __u32 handle; __u64 region_end; /* available since kernel version 2.6.36 */ }; /** * struct fw_cdev_deallocate - Free a CSR address range or isochronous resource * @handle: Handle to the address range or iso resource, as returned by the * kernel when the range or resource was allocated */ struct fw_cdev_deallocate { __u32 handle; }; #define FW_CDEV_LONG_RESET 0 #define FW_CDEV_SHORT_RESET 1 /** * struct fw_cdev_initiate_bus_reset - Initiate a bus reset * @type: %FW_CDEV_SHORT_RESET or %FW_CDEV_LONG_RESET * * Initiate a bus reset for the bus this device is on. The bus reset can be * either the original (long) bus reset or the arbitrated (short) bus reset * introduced in 1394a-2000. * * The ioctl returns immediately. A subsequent &fw_cdev_event_bus_reset * indicates when the reset actually happened. Since ABI v4, this may be * considerably later than the ioctl because the kernel ensures a grace period * between subsequent bus resets as per IEEE 1394 bus management specification. */ struct fw_cdev_initiate_bus_reset { __u32 type; }; /** * struct fw_cdev_add_descriptor - Add contents to the local node's config ROM * @immediate: If non-zero, immediate key to insert before pointer * @key: Upper 8 bits of root directory pointer * @data: Userspace pointer to contents of descriptor block * @length: Length of descriptor block data, in quadlets * @handle: Handle to the descriptor, written by the kernel * * Add a descriptor block and optionally a preceding immediate key to the local * node's Configuration ROM. * * The @key field specifies the upper 8 bits of the descriptor root directory * pointer and the @data and @length fields specify the contents. The @key * should be of the form 0xXX000000. The offset part of the root directory entry * will be filled in by the kernel. * * If not 0, the @immediate field specifies an immediate key which will be * inserted before the root directory pointer. * * @immediate, @key, and @data array elements are CPU-endian quadlets. * * If successful, the kernel adds the descriptor and writes back a @handle to * the kernel-side object to be used for later removal of the descriptor block * and immediate key. The kernel will also generate a bus reset to signal the * change of the Configuration ROM to other nodes. * * This ioctl affects the Configuration ROMs of all local nodes. * The ioctl only succeeds on device files which represent a local node. */ struct fw_cdev_add_descriptor { __u32 immediate; __u32 key; __u64 data; __u32 length; __u32 handle; }; /** * struct fw_cdev_remove_descriptor - Remove contents from the Configuration ROM * @handle: Handle to the descriptor, as returned by the kernel when the * descriptor was added * * Remove a descriptor block and accompanying immediate key from the local * nodes' Configuration ROMs. The kernel will also generate a bus reset to * signal the change of the Configuration ROM to other nodes. */ struct fw_cdev_remove_descriptor { __u32 handle; }; #define FW_CDEV_ISO_CONTEXT_TRANSMIT 0 #define FW_CDEV_ISO_CONTEXT_RECEIVE 1 #define FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL 2 /* added in 2.6.36 */ /** * struct fw_cdev_create_iso_context - Create a context for isochronous I/O * @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE or * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL * @header_size: Header size to strip in single-channel reception * @channel: Channel to bind to in single-channel reception or transmission * @speed: Transmission speed * @closure: To be returned in &fw_cdev_event_iso_interrupt or * &fw_cdev_event_iso_interrupt_multichannel * @handle: Handle to context, written back by kernel * * Prior to sending or receiving isochronous I/O, a context must be created. * The context records information about the transmit or receive configuration * and typically maps to an underlying hardware resource. A context is set up * for either sending or receiving. It is bound to a specific isochronous * @channel. * * In case of multichannel reception, @header_size and @channel are ignored * and the channels are selected by %FW_CDEV_IOC_SET_ISO_CHANNELS. * * For %FW_CDEV_ISO_CONTEXT_RECEIVE contexts, @header_size must be at least 4 * and must be a multiple of 4. It is ignored in other context types. * * @speed is ignored in receive context types. * * If a context was successfully created, the kernel writes back a handle to the * context, which must be passed in for subsequent operations on that context. * * Limitations: * No more than one iso context can be created per fd. * The total number of contexts that all userspace and kernelspace drivers can * create on a card at a time is a hardware limit, typically 4 or 8 contexts per * direction, and of them at most one multichannel receive context. */ struct fw_cdev_create_iso_context { __u32 type; __u32 header_size; __u32 channel; __u32 speed; __u64 closure; __u32 handle; }; /** * struct fw_cdev_set_iso_channels - Select channels in multichannel reception * @channels: Bitmask of channels to listen to * @handle: Handle of the mutichannel receive context * * @channels is the bitwise or of 1ULL << n for each channel n to listen to. * * The ioctl fails with errno %EBUSY if there is already another receive context * on a channel in @channels. In that case, the bitmask of all unoccupied * channels is returned in @channels. */ struct fw_cdev_set_iso_channels { __u64 channels; __u32 handle; }; #define FW_CDEV_ISO_PAYLOAD_LENGTH(v) (v) #define FW_CDEV_ISO_INTERRUPT (1 << 16) #define FW_CDEV_ISO_SKIP (1 << 17) #define FW_CDEV_ISO_SYNC (1 << 17) #define FW_CDEV_ISO_TAG(v) ((v) << 18) #define FW_CDEV_ISO_SY(v) ((v) << 20) #define FW_CDEV_ISO_HEADER_LENGTH(v) ((v) << 24) /** * struct fw_cdev_iso_packet - Isochronous packet * @control: Contains the header length (8 uppermost bits), * the sy field (4 bits), the tag field (2 bits), a sync flag * or a skip flag (1 bit), an interrupt flag (1 bit), and the * payload length (16 lowermost bits) * @header: Header and payload in case of a transmit context. * * &struct fw_cdev_iso_packet is used to describe isochronous packet queues. * Use the FW_CDEV_ISO_ macros to fill in @control. * The @header array is empty in case of receive contexts. * * Context type %FW_CDEV_ISO_CONTEXT_TRANSMIT: * * @control.HEADER_LENGTH must be a multiple of 4. It specifies the numbers of * bytes in @header that will be prepended to the packet's payload. These bytes * are copied into the kernel and will not be accessed after the ioctl has * returned. * * The @control.SY and TAG fields are copied to the iso packet header. These * fields are specified by IEEE 1394a and IEC 61883-1. * * The @control.SKIP flag specifies that no packet is to be sent in a frame. * When using this, all other fields except @control.INTERRUPT must be zero. * * When a packet with the @control.INTERRUPT flag set has been completed, an * &fw_cdev_event_iso_interrupt event will be sent. * * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE: * * @control.HEADER_LENGTH must be a multiple of the context's header_size. * If the HEADER_LENGTH is larger than the context's header_size, multiple * packets are queued for this entry. * * The @control.SY and TAG fields are ignored. * * If the @control.SYNC flag is set, the context drops all packets until a * packet with a sy field is received which matches &fw_cdev_start_iso.sync. * * @control.PAYLOAD_LENGTH defines how many payload bytes can be received for * one packet (in addition to payload quadlets that have been defined as headers * and are stripped and returned in the &fw_cdev_event_iso_interrupt structure). * If more bytes are received, the additional bytes are dropped. If less bytes * are received, the remaining bytes in this part of the payload buffer will not * be written to, not even by the next packet. I.e., packets received in * consecutive frames will not necessarily be consecutive in memory. If an * entry has queued multiple packets, the PAYLOAD_LENGTH is divided equally * among them. * * When a packet with the @control.INTERRUPT flag set has been completed, an * &fw_cdev_event_iso_interrupt event will be sent. An entry that has queued * multiple receive packets is completed when its last packet is completed. * * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL: * * Here, &fw_cdev_iso_packet would be more aptly named _iso_buffer_chunk since * it specifies a chunk of the mmap()'ed buffer, while the number and alignment * of packets to be placed into the buffer chunk is not known beforehand. * * @control.PAYLOAD_LENGTH is the size of the buffer chunk and specifies room * for header, payload, padding, and trailer bytes of one or more packets. * It must be a multiple of 4. * * @control.HEADER_LENGTH, TAG and SY are ignored. SYNC is treated as described * for single-channel reception. * * When a buffer chunk with the @control.INTERRUPT flag set has been filled * entirely, an &fw_cdev_event_iso_interrupt_mc event will be sent. */ struct fw_cdev_iso_packet { __u32 control; __u32 header[0]; }; /** * struct fw_cdev_queue_iso - Queue isochronous packets for I/O * @packets: Userspace pointer to an array of &fw_cdev_iso_packet * @data: Pointer into mmap()'ed payload buffer * @size: Size of the @packets array, in bytes * @handle: Isochronous context handle * * Queue a number of isochronous packets for reception or transmission. * This ioctl takes a pointer to an array of &fw_cdev_iso_packet structs, * which describe how to transmit from or receive into a contiguous region * of a mmap()'ed payload buffer. As part of transmit packet descriptors, * a series of headers can be supplied, which will be prepended to the * payload during DMA. * * The kernel may or may not queue all packets, but will write back updated * values of the @packets, @data and @size fields, so the ioctl can be * resubmitted easily. * * In case of a multichannel receive context, @data must be quadlet-aligned * relative to the buffer start. */ struct fw_cdev_queue_iso { __u64 packets; __u64 data; __u32 size; __u32 handle; }; #define FW_CDEV_ISO_CONTEXT_MATCH_TAG0 1 #define FW_CDEV_ISO_CONTEXT_MATCH_TAG1 2 #define FW_CDEV_ISO_CONTEXT_MATCH_TAG2 4 #define FW_CDEV_ISO_CONTEXT_MATCH_TAG3 8 #define FW_CDEV_ISO_CONTEXT_MATCH_ALL_TAGS 15 /** * struct fw_cdev_start_iso - Start an isochronous transmission or reception * @cycle: Cycle in which to start I/O. If @cycle is greater than or * equal to 0, the I/O will start on that cycle. * @sync: Determines the value to wait for for receive packets that have * the %FW_CDEV_ISO_SYNC bit set * @tags: Tag filter bit mask. Only valid for isochronous reception. * Determines the tag values for which packets will be accepted. * Use FW_CDEV_ISO_CONTEXT_MATCH_ macros to set @tags. * @handle: Isochronous context handle within which to transmit or receive */ struct fw_cdev_start_iso { __s32 cycle; __u32 sync; __u32 tags; __u32 handle; }; /** * struct fw_cdev_stop_iso - Stop an isochronous transmission or reception * @handle: Handle of isochronous context to stop */ struct fw_cdev_stop_iso { __u32 handle; }; /** * struct fw_cdev_flush_iso - flush completed iso packets * @handle: handle of isochronous context to flush * * For %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE contexts, * report any completed packets. * * For %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL contexts, report the current * offset in the receive buffer, if it has changed; this is typically in the * middle of some buffer chunk. * * Any %FW_CDEV_EVENT_ISO_INTERRUPT or %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL * events generated by this ioctl are sent synchronously, i.e., are available * for reading from the file descriptor when this ioctl returns. */ struct fw_cdev_flush_iso { __u32 handle; }; /** * struct fw_cdev_get_cycle_timer - read cycle timer register * @local_time: system time, in microseconds since the Epoch * @cycle_timer: Cycle Time register contents * * Same as %FW_CDEV_IOC_GET_CYCLE_TIMER2, but fixed to use %CLOCK_REALTIME * and only with microseconds resolution. * * In version 1 and 2 of the ABI, this ioctl returned unreliable (non- * monotonic) @cycle_timer values on certain controllers. */ struct fw_cdev_get_cycle_timer { __u64 local_time; __u32 cycle_timer; }; /** * struct fw_cdev_get_cycle_timer2 - read cycle timer register * @tv_sec: system time, seconds * @tv_nsec: system time, sub-seconds part in nanoseconds * @clk_id: input parameter, clock from which to get the system time * @cycle_timer: Cycle Time register contents * * The %FW_CDEV_IOC_GET_CYCLE_TIMER2 ioctl reads the isochronous cycle timer * and also the system clock. This allows to correlate reception time of * isochronous packets with system time. * * @clk_id lets you choose a clock like with POSIX' clock_gettime function. * Supported @clk_id values are POSIX' %CLOCK_REALTIME and %CLOCK_MONOTONIC * and Linux' %CLOCK_MONOTONIC_RAW. * * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and * 12 bits cycleOffset, in host byte order. Cf. the Cycle Time register * per IEEE 1394 or Isochronous Cycle Timer register per OHCI-1394. */ struct fw_cdev_get_cycle_timer2 { __s64 tv_sec; __s32 tv_nsec; __s32 clk_id; __u32 cycle_timer; }; /** * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth * @closure: Passed back to userspace in corresponding iso resource events * @channels: Isochronous channels of which one is to be (de)allocated * @bandwidth: Isochronous bandwidth units to be (de)allocated * @handle: Handle to the allocation, written by the kernel (only valid in * case of %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctls) * * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctl initiates allocation of an * isochronous channel and/or of isochronous bandwidth at the isochronous * resource manager (IRM). Only one of the channels specified in @channels is * allocated. An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED is sent after * communication with the IRM, indicating success or failure in the event data. * The kernel will automatically reallocate the resources after bus resets. * Should a reallocation fail, an %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event * will be sent. The kernel will also automatically deallocate the resources * when the file descriptor is closed. * * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE ioctl can be used to initiate * deallocation of resources which were allocated as described above. * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation. * * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE ioctl is a variant of allocation * without automatic re- or deallocation. * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event concludes this operation, * indicating success or failure in its data. * * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE ioctl works like * %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE except that resources are freed * instead of allocated. * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation. * * To summarize, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE allocates iso resources * for the lifetime of the fd or @handle. * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources * for the duration of a bus generation. * * @channels is a host-endian bitfield with the least significant bit * representing channel 0 and the most significant bit representing channel 63: * 1ULL << c for each channel c that is a candidate for (de)allocation. * * @bandwidth is expressed in bandwidth allocation units, i.e. the time to send * one quadlet of data (payload or header data) at speed S1600. */ struct fw_cdev_allocate_iso_resource { __u64 closure; __u64 channels; __u32 bandwidth; __u32 handle; }; /** * struct fw_cdev_send_stream_packet - send an asynchronous stream packet * @length: Length of outgoing payload, in bytes * @tag: Data format tag * @channel: Isochronous channel to transmit to * @sy: Synchronization code * @closure: Passed back to userspace in the response event * @data: Userspace pointer to payload * @generation: The bus generation where packet is valid * @speed: Speed to transmit at * * The %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl sends an asynchronous stream packet * to every device which is listening to the specified channel. The kernel * writes an &fw_cdev_event_response event which indicates success or failure of * the transmission. */ struct fw_cdev_send_stream_packet { __u32 length; __u32 tag; __u32 channel; __u32 sy; __u64 closure; __u64 data; __u32 generation; __u32 speed; }; /** * struct fw_cdev_send_phy_packet - send a PHY packet * @closure: Passed back to userspace in the PHY-packet-sent event * @data: First and second quadlet of the PHY packet * @generation: The bus generation where packet is valid * * The %FW_CDEV_IOC_SEND_PHY_PACKET ioctl sends a PHY packet to all nodes * on the same card as this device. After transmission, an * %FW_CDEV_EVENT_PHY_PACKET_SENT event is generated. * * The payload @data[] shall be specified in host byte order. Usually, * @data[1] needs to be the bitwise inverse of @data[0]. VersaPHY packets * are an exception to this rule. * * The ioctl is only permitted on device files which represent a local node. */ struct fw_cdev_send_phy_packet { __u64 closure; __u32 data[2]; __u32 generation; }; /** * struct fw_cdev_receive_phy_packets - start reception of PHY packets * @closure: Passed back to userspace in phy packet events * * This ioctl activates issuing of %FW_CDEV_EVENT_PHY_PACKET_RECEIVED due to * incoming PHY packets from any node on the same bus as the device. * * The ioctl is only permitted on device files which represent a local node. */ struct fw_cdev_receive_phy_packets { __u64 closure; }; #define FW_CDEV_VERSION 3 /* Meaningless legacy macro; don't use it. */ #endif /* _LINUX_FIREWIRE_CDEV_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������linux/dlm_device.h����������������������������������������������������������������������������������0000644�����������������00000004757�14763166027�0010200 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /****************************************************************************** ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. ** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions ** of the GNU General Public License v.2. ** ******************************************************************************* ******************************************************************************/ #ifndef _LINUX_DLM_DEVICE_H #define _LINUX_DLM_DEVICE_H /* This is the device interface for dlm, most users will use a library * interface. */ #include <linux/dlm.h> #include <linux/types.h> #define DLM_USER_LVB_LEN 32 /* Version of the device interface */ #define DLM_DEVICE_VERSION_MAJOR 6 #define DLM_DEVICE_VERSION_MINOR 0 #define DLM_DEVICE_VERSION_PATCH 2 /* struct passed to the lock write */ struct dlm_lock_params { __u8 mode; __u8 namelen; __u16 unused; __u32 flags; __u32 lkid; __u32 parent; __u64 xid; __u64 timeout; void *castparam; void *castaddr; void *bastparam; void *bastaddr; struct dlm_lksb *lksb; char lvb[DLM_USER_LVB_LEN]; char name[0]; }; struct dlm_lspace_params { __u32 flags; __u32 minor; char name[0]; }; struct dlm_purge_params { __u32 nodeid; __u32 pid; }; struct dlm_write_request { __u32 version[3]; __u8 cmd; __u8 is64bit; __u8 unused[2]; union { struct dlm_lock_params lock; struct dlm_lspace_params lspace; struct dlm_purge_params purge; } i; }; struct dlm_device_version { __u32 version[3]; }; /* struct read from the "device" fd, consists mainly of userspace pointers for the library to use */ struct dlm_lock_result { __u32 version[3]; __u32 length; void * user_astaddr; void * user_astparam; struct dlm_lksb * user_lksb; struct dlm_lksb lksb; __u8 bast_mode; __u8 unused[3]; /* Offsets may be zero if no data is present */ __u32 lvb_offset; }; /* Commands passed to the device */ #define DLM_USER_LOCK 1 #define DLM_USER_UNLOCK 2 #define DLM_USER_QUERY 3 #define DLM_USER_CREATE_LOCKSPACE 4 #define DLM_USER_REMOVE_LOCKSPACE 5 #define DLM_USER_PURGE 6 #define DLM_USER_DEADLOCK 7 /* Lockspace flags */ #define DLM_USER_LSFLG_AUTOFREE 1 #define DLM_USER_LSFLG_FORCEFREE 2 #endif �����������������linux/tipc_netlink.h��������������������������������������������������������������������������������0000644�����������������00000021566�14763166027�0010565 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * Copyright (c) 2014, Ericsson AB * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the names of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL") version 2 as published by the Free * Software Foundation. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _LINUX_TIPC_NETLINK_H_ #define _LINUX_TIPC_NETLINK_H_ #define TIPC_GENL_V2_NAME "TIPCv2" #define TIPC_GENL_V2_VERSION 0x1 /* Netlink commands */ enum { TIPC_NL_UNSPEC, TIPC_NL_LEGACY, TIPC_NL_BEARER_DISABLE, TIPC_NL_BEARER_ENABLE, TIPC_NL_BEARER_GET, TIPC_NL_BEARER_SET, TIPC_NL_SOCK_GET, TIPC_NL_PUBL_GET, TIPC_NL_LINK_GET, TIPC_NL_LINK_SET, TIPC_NL_LINK_RESET_STATS, TIPC_NL_MEDIA_GET, TIPC_NL_MEDIA_SET, TIPC_NL_NODE_GET, TIPC_NL_NET_GET, TIPC_NL_NET_SET, TIPC_NL_NAME_TABLE_GET, TIPC_NL_MON_SET, TIPC_NL_MON_GET, TIPC_NL_MON_PEER_GET, TIPC_NL_PEER_REMOVE, TIPC_NL_BEARER_ADD, TIPC_NL_UDP_GET_REMOTEIP, __TIPC_NL_CMD_MAX, TIPC_NL_CMD_MAX = __TIPC_NL_CMD_MAX - 1 }; /* Top level netlink attributes */ enum { TIPC_NLA_UNSPEC, TIPC_NLA_BEARER, /* nest */ TIPC_NLA_SOCK, /* nest */ TIPC_NLA_PUBL, /* nest */ TIPC_NLA_LINK, /* nest */ TIPC_NLA_MEDIA, /* nest */ TIPC_NLA_NODE, /* nest */ TIPC_NLA_NET, /* nest */ TIPC_NLA_NAME_TABLE, /* nest */ TIPC_NLA_MON, /* nest */ TIPC_NLA_MON_PEER, /* nest */ __TIPC_NLA_MAX, TIPC_NLA_MAX = __TIPC_NLA_MAX - 1 }; /* Bearer info */ enum { TIPC_NLA_BEARER_UNSPEC, TIPC_NLA_BEARER_NAME, /* string */ TIPC_NLA_BEARER_PROP, /* nest */ TIPC_NLA_BEARER_DOMAIN, /* u32 */ TIPC_NLA_BEARER_UDP_OPTS, /* nest */ __TIPC_NLA_BEARER_MAX, TIPC_NLA_BEARER_MAX = __TIPC_NLA_BEARER_MAX - 1 }; enum { TIPC_NLA_UDP_UNSPEC, TIPC_NLA_UDP_LOCAL, /* sockaddr_storage */ TIPC_NLA_UDP_REMOTE, /* sockaddr_storage */ TIPC_NLA_UDP_MULTI_REMOTEIP, /* flag */ __TIPC_NLA_UDP_MAX, TIPC_NLA_UDP_MAX = __TIPC_NLA_UDP_MAX - 1 }; /* Socket info */ enum { TIPC_NLA_SOCK_UNSPEC, TIPC_NLA_SOCK_ADDR, /* u32 */ TIPC_NLA_SOCK_REF, /* u32 */ TIPC_NLA_SOCK_CON, /* nest */ TIPC_NLA_SOCK_HAS_PUBL, /* flag */ TIPC_NLA_SOCK_STAT, /* nest */ TIPC_NLA_SOCK_TYPE, /* u32 */ TIPC_NLA_SOCK_INO, /* u32 */ TIPC_NLA_SOCK_UID, /* u32 */ TIPC_NLA_SOCK_TIPC_STATE, /* u32 */ TIPC_NLA_SOCK_COOKIE, /* u64 */ TIPC_NLA_SOCK_PAD, /* flag */ TIPC_NLA_SOCK_GROUP, /* nest */ __TIPC_NLA_SOCK_MAX, TIPC_NLA_SOCK_MAX = __TIPC_NLA_SOCK_MAX - 1 }; /* Link info */ enum { TIPC_NLA_LINK_UNSPEC, TIPC_NLA_LINK_NAME, /* string */ TIPC_NLA_LINK_DEST, /* u32 */ TIPC_NLA_LINK_MTU, /* u32 */ TIPC_NLA_LINK_BROADCAST, /* flag */ TIPC_NLA_LINK_UP, /* flag */ TIPC_NLA_LINK_ACTIVE, /* flag */ TIPC_NLA_LINK_PROP, /* nest */ TIPC_NLA_LINK_STATS, /* nest */ TIPC_NLA_LINK_RX, /* u32 */ TIPC_NLA_LINK_TX, /* u32 */ __TIPC_NLA_LINK_MAX, TIPC_NLA_LINK_MAX = __TIPC_NLA_LINK_MAX - 1 }; /* Media info */ enum { TIPC_NLA_MEDIA_UNSPEC, TIPC_NLA_MEDIA_NAME, /* string */ TIPC_NLA_MEDIA_PROP, /* nest */ __TIPC_NLA_MEDIA_MAX, TIPC_NLA_MEDIA_MAX = __TIPC_NLA_MEDIA_MAX - 1 }; /* Node info */ enum { TIPC_NLA_NODE_UNSPEC, TIPC_NLA_NODE_ADDR, /* u32 */ TIPC_NLA_NODE_UP, /* flag */ __TIPC_NLA_NODE_MAX, TIPC_NLA_NODE_MAX = __TIPC_NLA_NODE_MAX - 1 }; /* Net info */ enum { TIPC_NLA_NET_UNSPEC, TIPC_NLA_NET_ID, /* u32 */ TIPC_NLA_NET_ADDR, /* u32 */ TIPC_NLA_NET_NODEID, /* u64 */ TIPC_NLA_NET_NODEID_W1, /* u64 */ __TIPC_NLA_NET_MAX, TIPC_NLA_NET_MAX = __TIPC_NLA_NET_MAX - 1 }; /* Name table info */ enum { TIPC_NLA_NAME_TABLE_UNSPEC, TIPC_NLA_NAME_TABLE_PUBL, /* nest */ __TIPC_NLA_NAME_TABLE_MAX, TIPC_NLA_NAME_TABLE_MAX = __TIPC_NLA_NAME_TABLE_MAX - 1 }; /* Monitor info */ enum { TIPC_NLA_MON_UNSPEC, TIPC_NLA_MON_ACTIVATION_THRESHOLD, /* u32 */ TIPC_NLA_MON_REF, /* u32 */ TIPC_NLA_MON_ACTIVE, /* flag */ TIPC_NLA_MON_BEARER_NAME, /* string */ TIPC_NLA_MON_PEERCNT, /* u32 */ TIPC_NLA_MON_LISTGEN, /* u32 */ __TIPC_NLA_MON_MAX, TIPC_NLA_MON_MAX = __TIPC_NLA_MON_MAX - 1 }; /* Publication info */ enum { TIPC_NLA_PUBL_UNSPEC, TIPC_NLA_PUBL_TYPE, /* u32 */ TIPC_NLA_PUBL_LOWER, /* u32 */ TIPC_NLA_PUBL_UPPER, /* u32 */ TIPC_NLA_PUBL_SCOPE, /* u32 */ TIPC_NLA_PUBL_NODE, /* u32 */ TIPC_NLA_PUBL_REF, /* u32 */ TIPC_NLA_PUBL_KEY, /* u32 */ __TIPC_NLA_PUBL_MAX, TIPC_NLA_PUBL_MAX = __TIPC_NLA_PUBL_MAX - 1 }; /* Monitor peer info */ enum { TIPC_NLA_MON_PEER_UNSPEC, TIPC_NLA_MON_PEER_ADDR, /* u32 */ TIPC_NLA_MON_PEER_DOMGEN, /* u32 */ TIPC_NLA_MON_PEER_APPLIED, /* u32 */ TIPC_NLA_MON_PEER_UPMAP, /* u64 */ TIPC_NLA_MON_PEER_MEMBERS, /* tlv */ TIPC_NLA_MON_PEER_UP, /* flag */ TIPC_NLA_MON_PEER_HEAD, /* flag */ TIPC_NLA_MON_PEER_LOCAL, /* flag */ TIPC_NLA_MON_PEER_PAD, /* flag */ __TIPC_NLA_MON_PEER_MAX, TIPC_NLA_MON_PEER_MAX = __TIPC_NLA_MON_PEER_MAX - 1 }; /* Nest, socket group info */ enum { TIPC_NLA_SOCK_GROUP_ID, /* u32 */ TIPC_NLA_SOCK_GROUP_OPEN, /* flag */ TIPC_NLA_SOCK_GROUP_NODE_SCOPE, /* flag */ TIPC_NLA_SOCK_GROUP_CLUSTER_SCOPE, /* flag */ TIPC_NLA_SOCK_GROUP_INSTANCE, /* u32 */ TIPC_NLA_SOCK_GROUP_BC_SEND_NEXT, /* u32 */ __TIPC_NLA_SOCK_GROUP_MAX, TIPC_NLA_SOCK_GROUP_MAX = __TIPC_NLA_SOCK_GROUP_MAX - 1 }; /* Nest, connection info */ enum { TIPC_NLA_CON_UNSPEC, TIPC_NLA_CON_FLAG, /* flag */ TIPC_NLA_CON_NODE, /* u32 */ TIPC_NLA_CON_SOCK, /* u32 */ TIPC_NLA_CON_TYPE, /* u32 */ TIPC_NLA_CON_INST, /* u32 */ __TIPC_NLA_CON_MAX, TIPC_NLA_CON_MAX = __TIPC_NLA_CON_MAX - 1 }; /* Nest, socket statistics info */ enum { TIPC_NLA_SOCK_STAT_RCVQ, /* u32 */ TIPC_NLA_SOCK_STAT_SENDQ, /* u32 */ TIPC_NLA_SOCK_STAT_LINK_CONG, /* flag */ TIPC_NLA_SOCK_STAT_CONN_CONG, /* flag */ TIPC_NLA_SOCK_STAT_DROP, /* u32 */ __TIPC_NLA_SOCK_STAT_MAX, TIPC_NLA_SOCK_STAT_MAX = __TIPC_NLA_SOCK_STAT_MAX - 1 }; /* Nest, link propreties. Valid for link, media and bearer */ enum { TIPC_NLA_PROP_UNSPEC, TIPC_NLA_PROP_PRIO, /* u32 */ TIPC_NLA_PROP_TOL, /* u32 */ TIPC_NLA_PROP_WIN, /* u32 */ TIPC_NLA_PROP_MTU, /* u32 */ __TIPC_NLA_PROP_MAX, TIPC_NLA_PROP_MAX = __TIPC_NLA_PROP_MAX - 1 }; /* Nest, statistics info */ enum { TIPC_NLA_STATS_UNSPEC, TIPC_NLA_STATS_RX_INFO, /* u32 */ TIPC_NLA_STATS_RX_FRAGMENTS, /* u32 */ TIPC_NLA_STATS_RX_FRAGMENTED, /* u32 */ TIPC_NLA_STATS_RX_BUNDLES, /* u32 */ TIPC_NLA_STATS_RX_BUNDLED, /* u32 */ TIPC_NLA_STATS_TX_INFO, /* u32 */ TIPC_NLA_STATS_TX_FRAGMENTS, /* u32 */ TIPC_NLA_STATS_TX_FRAGMENTED, /* u32 */ TIPC_NLA_STATS_TX_BUNDLES, /* u32 */ TIPC_NLA_STATS_TX_BUNDLED, /* u32 */ TIPC_NLA_STATS_MSG_PROF_TOT, /* u32 */ TIPC_NLA_STATS_MSG_LEN_CNT, /* u32 */ TIPC_NLA_STATS_MSG_LEN_TOT, /* u32 */ TIPC_NLA_STATS_MSG_LEN_P0, /* u32 */ TIPC_NLA_STATS_MSG_LEN_P1, /* u32 */ TIPC_NLA_STATS_MSG_LEN_P2, /* u32 */ TIPC_NLA_STATS_MSG_LEN_P3, /* u32 */ TIPC_NLA_STATS_MSG_LEN_P4, /* u32 */ TIPC_NLA_STATS_MSG_LEN_P5, /* u32 */ TIPC_NLA_STATS_MSG_LEN_P6, /* u32 */ TIPC_NLA_STATS_RX_STATES, /* u32 */ TIPC_NLA_STATS_RX_PROBES, /* u32 */ TIPC_NLA_STATS_RX_NACKS, /* u32 */ TIPC_NLA_STATS_RX_DEFERRED, /* u32 */ TIPC_NLA_STATS_TX_STATES, /* u32 */ TIPC_NLA_STATS_TX_PROBES, /* u32 */ TIPC_NLA_STATS_TX_NACKS, /* u32 */ TIPC_NLA_STATS_TX_ACKS, /* u32 */ TIPC_NLA_STATS_RETRANSMITTED, /* u32 */ TIPC_NLA_STATS_DUPLICATES, /* u32 */ TIPC_NLA_STATS_LINK_CONGS, /* u32 */ TIPC_NLA_STATS_MAX_QUEUE, /* u32 */ TIPC_NLA_STATS_AVG_QUEUE, /* u32 */ __TIPC_NLA_STATS_MAX, TIPC_NLA_STATS_MAX = __TIPC_NLA_STATS_MAX - 1 }; #endif ������������������������������������������������������������������������������������������������������������������������������������������linux/ptp_clock.h�����������������������������������������������������������������������������������0000644�����������������00000011404�14763166027�0010046 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * PTP 1588 clock support - user space interface * * Copyright (C) 2010 OMICRON electronics GmbH * * 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. */ #ifndef _PTP_CLOCK_H_ #define _PTP_CLOCK_H_ #include <linux/ioctl.h> #include <linux/types.h> /* PTP_xxx bits, for the flags field within the request structures. */ #define PTP_ENABLE_FEATURE (1<<0) #define PTP_RISING_EDGE (1<<1) #define PTP_FALLING_EDGE (1<<2) /* * struct ptp_clock_time - represents a time value * * The sign of the seconds field applies to the whole value. The * nanoseconds field is always unsigned. The reserved field is * included for sub-nanosecond resolution, should the demand for * this ever appear. * */ struct ptp_clock_time { __s64 sec; /* seconds */ __u32 nsec; /* nanoseconds */ __u32 reserved; }; struct ptp_clock_caps { int max_adj; /* Maximum frequency adjustment in parts per billon. */ int n_alarm; /* Number of programmable alarms. */ int n_ext_ts; /* Number of external time stamp channels. */ int n_per_out; /* Number of programmable periodic signals. */ int pps; /* Whether the clock supports a PPS callback. */ int n_pins; /* Number of input/output pins. */ /* Whether the clock supports precise system-device cross timestamps */ int cross_timestamping; int rsv[13]; /* Reserved for future use. */ }; struct ptp_extts_request { unsigned int index; /* Which channel to configure. */ unsigned int flags; /* Bit field for PTP_xxx flags. */ unsigned int rsv[2]; /* Reserved for future use. */ }; struct ptp_perout_request { struct ptp_clock_time start; /* Absolute start time. */ struct ptp_clock_time period; /* Desired period, zero means disable. */ unsigned int index; /* Which channel to configure. */ unsigned int flags; /* Reserved for future use. */ unsigned int rsv[4]; /* Reserved for future use. */ }; #define PTP_MAX_SAMPLES 25 /* Maximum allowed offset measurement samples. */ struct ptp_sys_offset { unsigned int n_samples; /* Desired number of measurements. */ unsigned int rsv[3]; /* Reserved for future use. */ /* * Array of interleaved system/phc time stamps. The kernel * will provide 2*n_samples + 1 time stamps, with the last * one as a system time stamp. */ struct ptp_clock_time ts[2 * PTP_MAX_SAMPLES + 1]; }; struct ptp_sys_offset_precise { struct ptp_clock_time device; struct ptp_clock_time sys_realtime; struct ptp_clock_time sys_monoraw; unsigned int rsv[4]; /* Reserved for future use. */ }; enum ptp_pin_function { PTP_PF_NONE, PTP_PF_EXTTS, PTP_PF_PEROUT, PTP_PF_PHYSYNC, }; struct ptp_pin_desc { /* * Hardware specific human readable pin name. This field is * set by the kernel during the PTP_PIN_GETFUNC ioctl and is * ignored for the PTP_PIN_SETFUNC ioctl. */ char name[64]; /* * Pin index in the range of zero to ptp_clock_caps.n_pins - 1. */ unsigned int index; /* * Which of the PTP_PF_xxx functions to use on this pin. */ unsigned int func; /* * The specific channel to use for this function. * This corresponds to the 'index' field of the * PTP_EXTTS_REQUEST and PTP_PEROUT_REQUEST ioctls. */ unsigned int chan; /* * Reserved for future use. */ unsigned int rsv[5]; }; #define PTP_CLK_MAGIC '=' #define PTP_CLOCK_GETCAPS _IOR(PTP_CLK_MAGIC, 1, struct ptp_clock_caps) #define PTP_EXTTS_REQUEST _IOW(PTP_CLK_MAGIC, 2, struct ptp_extts_request) #define PTP_PEROUT_REQUEST _IOW(PTP_CLK_MAGIC, 3, struct ptp_perout_request) #define PTP_ENABLE_PPS _IOW(PTP_CLK_MAGIC, 4, int) #define PTP_SYS_OFFSET _IOW(PTP_CLK_MAGIC, 5, struct ptp_sys_offset) #define PTP_PIN_GETFUNC _IOWR(PTP_CLK_MAGIC, 6, struct ptp_pin_desc) #define PTP_PIN_SETFUNC _IOW(PTP_CLK_MAGIC, 7, struct ptp_pin_desc) #define PTP_SYS_OFFSET_PRECISE \ _IOWR(PTP_CLK_MAGIC, 8, struct ptp_sys_offset_precise) struct ptp_extts_event { struct ptp_clock_time t; /* Time event occured. */ unsigned int index; /* Which channel produced the event. */ unsigned int flags; /* Reserved for future use. */ unsigned int rsv[2]; /* Reserved for future use. */ }; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/atalk.h���������������������������������������������������������������������������������������0000644�����������������00000001777�14763166027�0007200 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_ATALK_H__ #define __LINUX_ATALK_H__ #include <linux/types.h> #include <asm/byteorder.h> #include <linux/socket.h> /* * AppleTalk networking structures * * The following are directly referenced from the University Of Michigan * netatalk for compatibility reasons. */ #define ATPORT_FIRST 1 #define ATPORT_RESERVED 128 #define ATPORT_LAST 254 /* 254 is only legal on localtalk */ #define ATADDR_ANYNET (__u16)0 #define ATADDR_ANYNODE (__u8)0 #define ATADDR_ANYPORT (__u8)0 #define ATADDR_BCAST (__u8)255 #define DDP_MAXSZ 587 #define DDP_MAXHOPS 15 /* 4 bits of hop counter */ #define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0) struct atalk_addr { __be16 s_net; __u8 s_node; }; struct sockaddr_at { __kernel_sa_family_t sat_family; __u8 sat_port; struct atalk_addr sat_addr; char sat_zero[8]; }; struct atalk_netrange { __u8 nr_phase; __be16 nr_firstnet; __be16 nr_lastnet; }; #endif /* __LINUX_ATALK_H__ */ �linux/sem.h�����������������������������������������������������������������������������������������0000644�����������������00000005743�14763166027�0006665 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SEM_H #define _LINUX_SEM_H #include <linux/ipc.h> /* semop flags */ #define SEM_UNDO 0x1000 /* undo the operation on exit */ /* semctl Command Definitions. */ #define GETPID 11 /* get sempid */ #define GETVAL 12 /* get semval */ #define GETALL 13 /* get all semval's */ #define GETNCNT 14 /* get semncnt */ #define GETZCNT 15 /* get semzcnt */ #define SETVAL 16 /* set semval */ #define SETALL 17 /* set all semval's */ /* ipcs ctl cmds */ #define SEM_STAT 18 #define SEM_INFO 19 #define SEM_STAT_ANY 20 /* Obsolete, used only for backwards compatibility and libc5 compiles */ struct semid_ds { struct ipc_perm sem_perm; /* permissions .. see ipc.h */ __kernel_time_t sem_otime; /* last semop time */ __kernel_time_t sem_ctime; /* create/last semctl() time */ struct sem *sem_base; /* ptr to first semaphore in array */ struct sem_queue *sem_pending; /* pending operations to be processed */ struct sem_queue **sem_pending_last; /* last pending operation */ struct sem_undo *undo; /* undo requests on this array */ unsigned short sem_nsems; /* no. of semaphores in array */ }; /* Include the definition of semid64_ds */ #include <asm/sembuf.h> /* semop system calls takes an array of these. */ struct sembuf { unsigned short sem_num; /* semaphore index in array */ short sem_op; /* semaphore operation */ short sem_flg; /* operation flags */ }; /* arg for semctl system calls. */ union semun { int val; /* value for SETVAL */ struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */ unsigned short *array; /* array for GETALL & SETALL */ struct seminfo *__buf; /* buffer for IPC_INFO */ void *__pad; }; struct seminfo { int semmap; int semmni; int semmns; int semmnu; int semmsl; int semopm; int semume; int semusz; int semvmx; int semaem; }; /* * SEMMNI, SEMMSL and SEMMNS are default values which can be * modified by sysctl. * The values has been chosen to be larger than necessary for any * known configuration. * * SEMOPM should not be increased beyond 1000, otherwise there is the * risk that semop()/semtimedop() fails due to kernel memory fragmentation when * allocating the sop array. */ #define SEMMNI 32000 /* <= IPCMNI max # of semaphore identifiers */ #define SEMMSL 32000 /* <= INT_MAX max num of semaphores per id */ #define SEMMNS (SEMMNI*SEMMSL) /* <= INT_MAX max # of semaphores in system */ #define SEMOPM 500 /* <= 1 000 max num of ops per semop call */ #define SEMVMX 32767 /* <= 32767 semaphore maximum value */ #define SEMAEM SEMVMX /* adjust on exit max value */ /* unused */ #define SEMUME SEMOPM /* max num of undo entries per process */ #define SEMMNU SEMMNS /* num of undo structures system wide */ #define SEMMAP SEMMNS /* # of entries in semaphore map */ #define SEMUSZ 20 /* sizeof struct sem_undo */ #endif /* _LINUX_SEM_H */ �����������������������������linux/tc_ematch/tc_em_cmp.h�������������������������������������������������������������������������0000644�����������������00000000636�14763166027�0011752 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_EM_CMP_H #define __LINUX_TC_EM_CMP_H #include <linux/types.h> #include <linux/pkt_cls.h> struct tcf_em_cmp { __u32 val; __u32 mask; __u16 off; __u8 align:4; __u8 flags:4; __u8 layer:4; __u8 opnd:4; }; enum { TCF_EM_ALIGN_U8 = 1, TCF_EM_ALIGN_U16 = 2, TCF_EM_ALIGN_U32 = 4 }; #define TCF_EM_CMP_TRANS 1 #endif ��������������������������������������������������������������������������������������������������linux/tc_ematch/tc_em_meta.h������������������������������������������������������������������������0000644�����������������00000004104�14763166027�0012113 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_EM_META_H #define __LINUX_TC_EM_META_H #include <linux/types.h> #include <linux/pkt_cls.h> enum { TCA_EM_META_UNSPEC, TCA_EM_META_HDR, TCA_EM_META_LVALUE, TCA_EM_META_RVALUE, __TCA_EM_META_MAX }; #define TCA_EM_META_MAX (__TCA_EM_META_MAX - 1) struct tcf_meta_val { __u16 kind; __u8 shift; __u8 op; }; #define TCF_META_TYPE_MASK (0xf << 12) #define TCF_META_TYPE(kind) (((kind) & TCF_META_TYPE_MASK) >> 12) #define TCF_META_ID_MASK 0x7ff #define TCF_META_ID(kind) ((kind) & TCF_META_ID_MASK) enum { TCF_META_TYPE_VAR, TCF_META_TYPE_INT, __TCF_META_TYPE_MAX }; #define TCF_META_TYPE_MAX (__TCF_META_TYPE_MAX - 1) enum { TCF_META_ID_VALUE, TCF_META_ID_RANDOM, TCF_META_ID_LOADAVG_0, TCF_META_ID_LOADAVG_1, TCF_META_ID_LOADAVG_2, TCF_META_ID_DEV, TCF_META_ID_PRIORITY, TCF_META_ID_PROTOCOL, TCF_META_ID_PKTTYPE, TCF_META_ID_PKTLEN, TCF_META_ID_DATALEN, TCF_META_ID_MACLEN, TCF_META_ID_NFMARK, TCF_META_ID_TCINDEX, TCF_META_ID_RTCLASSID, TCF_META_ID_RTIIF, TCF_META_ID_SK_FAMILY, TCF_META_ID_SK_STATE, TCF_META_ID_SK_REUSE, TCF_META_ID_SK_BOUND_IF, TCF_META_ID_SK_REFCNT, TCF_META_ID_SK_SHUTDOWN, TCF_META_ID_SK_PROTO, TCF_META_ID_SK_TYPE, TCF_META_ID_SK_RCVBUF, TCF_META_ID_SK_RMEM_ALLOC, TCF_META_ID_SK_WMEM_ALLOC, TCF_META_ID_SK_OMEM_ALLOC, TCF_META_ID_SK_WMEM_QUEUED, TCF_META_ID_SK_RCV_QLEN, TCF_META_ID_SK_SND_QLEN, TCF_META_ID_SK_ERR_QLEN, TCF_META_ID_SK_FORWARD_ALLOCS, TCF_META_ID_SK_SNDBUF, TCF_META_ID_SK_ALLOCS, __TCF_META_ID_SK_ROUTE_CAPS, /* unimplemented but in ABI already */ TCF_META_ID_SK_HASH, TCF_META_ID_SK_LINGERTIME, TCF_META_ID_SK_ACK_BACKLOG, TCF_META_ID_SK_MAX_ACK_BACKLOG, TCF_META_ID_SK_PRIO, TCF_META_ID_SK_RCVLOWAT, TCF_META_ID_SK_RCVTIMEO, TCF_META_ID_SK_SNDTIMEO, TCF_META_ID_SK_SENDMSG_OFF, TCF_META_ID_SK_WRITE_PENDING, TCF_META_ID_VLAN_TAG, TCF_META_ID_RXHASH, __TCF_META_ID_MAX }; #define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1) struct tcf_meta_hdr { struct tcf_meta_val left; struct tcf_meta_val right; }; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/tc_ematch/tc_em_ipt.h�������������������������������������������������������������������������0000644�����������������00000000607�14763166027�0011765 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_EM_IPT_H #define __LINUX_TC_EM_IPT_H #include <linux/types.h> #include <linux/pkt_cls.h> enum { TCA_EM_IPT_UNSPEC, TCA_EM_IPT_HOOK, TCA_EM_IPT_MATCH_NAME, TCA_EM_IPT_MATCH_REVISION, TCA_EM_IPT_NFPROTO, TCA_EM_IPT_MATCH_DATA, __TCA_EM_IPT_MAX }; #define TCA_EM_IPT_MAX (__TCA_EM_IPT_MAX - 1) #endif �������������������������������������������������������������������������������������������������������������������������linux/tc_ematch/tc_em_text.h������������������������������������������������������������������������0000644�����������������00000000600�14763166027�0012146 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_EM_TEXT_H #define __LINUX_TC_EM_TEXT_H #include <linux/types.h> #include <linux/pkt_cls.h> #define TC_EM_TEXT_ALGOSIZ 16 struct tcf_em_text { char algo[TC_EM_TEXT_ALGOSIZ]; __u16 from_offset; __u16 to_offset; __u16 pattern_len; __u8 from_layer:4; __u8 to_layer:4; __u8 pad; }; #endif ��������������������������������������������������������������������������������������������������������������������������������linux/tc_ematch/tc_em_nbyte.h�����������������������������������������������������������������������0000644�����������������00000000377�14763166027�0012316 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_EM_NBYTE_H #define __LINUX_TC_EM_NBYTE_H #include <linux/types.h> #include <linux/pkt_cls.h> struct tcf_em_nbyte { __u16 off; __u16 len:12; __u8 layer:4; }; #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/l2tp.h����������������������������������������������������������������������������������������0000644�����������������00000013050�14763166027�0006750 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * L2TP-over-IP socket for L2TPv3. * * Author: James Chapman <jchapman@katalix.com> */ #ifndef _LINUX_L2TP_H_ #define _LINUX_L2TP_H_ #include <linux/types.h> #include <linux/socket.h> #include <linux/in.h> #include <linux/in6.h> #define IPPROTO_L2TP 115 /** * struct sockaddr_l2tpip - the sockaddr structure for L2TP-over-IP sockets * @l2tp_family: address family number AF_L2TPIP. * @l2tp_addr: protocol specific address information * @l2tp_conn_id: connection id of tunnel */ #define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ struct sockaddr_l2tpip { /* The first fields must match struct sockaddr_in */ __kernel_sa_family_t l2tp_family; /* AF_INET */ __be16 l2tp_unused; /* INET port number (unused) */ struct in_addr l2tp_addr; /* Internet address */ __u32 l2tp_conn_id; /* Connection ID of tunnel */ /* Pad to size of `struct sockaddr'. */ unsigned char __pad[__SOCK_SIZE__ - sizeof(__kernel_sa_family_t) - sizeof(__be16) - sizeof(struct in_addr) - sizeof(__u32)]; }; /** * struct sockaddr_l2tpip6 - the sockaddr structure for L2TP-over-IPv6 sockets * @l2tp_family: address family number AF_L2TPIP. * @l2tp_addr: protocol specific address information * @l2tp_conn_id: connection id of tunnel */ struct sockaddr_l2tpip6 { /* The first fields must match struct sockaddr_in6 */ __kernel_sa_family_t l2tp_family; /* AF_INET6 */ __be16 l2tp_unused; /* INET port number (unused) */ __be32 l2tp_flowinfo; /* IPv6 flow information */ struct in6_addr l2tp_addr; /* IPv6 address */ __u32 l2tp_scope_id; /* scope id (new in RFC2553) */ __u32 l2tp_conn_id; /* Connection ID of tunnel */ }; /***************************************************************************** * NETLINK_GENERIC netlink family. *****************************************************************************/ /* * Commands. * Valid TLVs of each command are:- * TUNNEL_CREATE - CONN_ID, pw_type, netns, ifname, ipinfo, udpinfo, udpcsum * TUNNEL_DELETE - CONN_ID * TUNNEL_MODIFY - CONN_ID, udpcsum * TUNNEL_GETSTATS - CONN_ID, (stats) * TUNNEL_GET - CONN_ID, (...) * SESSION_CREATE - SESSION_ID, PW_TYPE, cookie, peer_cookie, l2spec * SESSION_DELETE - SESSION_ID * SESSION_MODIFY - SESSION_ID * SESSION_GET - SESSION_ID, (...) * SESSION_GETSTATS - SESSION_ID, (stats) * */ enum { L2TP_CMD_NOOP, L2TP_CMD_TUNNEL_CREATE, L2TP_CMD_TUNNEL_DELETE, L2TP_CMD_TUNNEL_MODIFY, L2TP_CMD_TUNNEL_GET, L2TP_CMD_SESSION_CREATE, L2TP_CMD_SESSION_DELETE, L2TP_CMD_SESSION_MODIFY, L2TP_CMD_SESSION_GET, __L2TP_CMD_MAX, }; #define L2TP_CMD_MAX (__L2TP_CMD_MAX - 1) /* * ATTR types defined for L2TP */ enum { L2TP_ATTR_NONE, /* no data */ L2TP_ATTR_PW_TYPE, /* u16, enum l2tp_pwtype */ L2TP_ATTR_ENCAP_TYPE, /* u16, enum l2tp_encap_type */ L2TP_ATTR_OFFSET, /* u16 (not used) */ L2TP_ATTR_DATA_SEQ, /* u16 (not used) */ L2TP_ATTR_L2SPEC_TYPE, /* u8, enum l2tp_l2spec_type */ L2TP_ATTR_L2SPEC_LEN, /* u8 (not used) */ L2TP_ATTR_PROTO_VERSION, /* u8 */ L2TP_ATTR_IFNAME, /* string */ L2TP_ATTR_CONN_ID, /* u32 */ L2TP_ATTR_PEER_CONN_ID, /* u32 */ L2TP_ATTR_SESSION_ID, /* u32 */ L2TP_ATTR_PEER_SESSION_ID, /* u32 */ L2TP_ATTR_UDP_CSUM, /* u8 */ L2TP_ATTR_VLAN_ID, /* u16 (not used) */ L2TP_ATTR_COOKIE, /* 0, 4 or 8 bytes */ L2TP_ATTR_PEER_COOKIE, /* 0, 4 or 8 bytes */ L2TP_ATTR_DEBUG, /* u32, enum l2tp_debug_flags */ L2TP_ATTR_RECV_SEQ, /* u8 */ L2TP_ATTR_SEND_SEQ, /* u8 */ L2TP_ATTR_LNS_MODE, /* u8 */ L2TP_ATTR_USING_IPSEC, /* u8 */ L2TP_ATTR_RECV_TIMEOUT, /* msec */ L2TP_ATTR_FD, /* int */ L2TP_ATTR_IP_SADDR, /* u32 */ L2TP_ATTR_IP_DADDR, /* u32 */ L2TP_ATTR_UDP_SPORT, /* u16 */ L2TP_ATTR_UDP_DPORT, /* u16 */ L2TP_ATTR_MTU, /* u16 (not used) */ L2TP_ATTR_MRU, /* u16 (not used) */ L2TP_ATTR_STATS, /* nested */ L2TP_ATTR_IP6_SADDR, /* struct in6_addr */ L2TP_ATTR_IP6_DADDR, /* struct in6_addr */ L2TP_ATTR_UDP_ZERO_CSUM6_TX, /* flag */ L2TP_ATTR_UDP_ZERO_CSUM6_RX, /* flag */ L2TP_ATTR_PAD, __L2TP_ATTR_MAX, }; #define L2TP_ATTR_MAX (__L2TP_ATTR_MAX - 1) /* Nested in L2TP_ATTR_STATS */ enum { L2TP_ATTR_STATS_NONE, /* no data */ L2TP_ATTR_TX_PACKETS, /* u64 */ L2TP_ATTR_TX_BYTES, /* u64 */ L2TP_ATTR_TX_ERRORS, /* u64 */ L2TP_ATTR_RX_PACKETS, /* u64 */ L2TP_ATTR_RX_BYTES, /* u64 */ L2TP_ATTR_RX_SEQ_DISCARDS, /* u64 */ L2TP_ATTR_RX_OOS_PACKETS, /* u64 */ L2TP_ATTR_RX_ERRORS, /* u64 */ L2TP_ATTR_STATS_PAD, __L2TP_ATTR_STATS_MAX, }; #define L2TP_ATTR_STATS_MAX (__L2TP_ATTR_STATS_MAX - 1) enum l2tp_pwtype { L2TP_PWTYPE_NONE = 0x0000, L2TP_PWTYPE_ETH_VLAN = 0x0004, L2TP_PWTYPE_ETH = 0x0005, L2TP_PWTYPE_PPP = 0x0007, L2TP_PWTYPE_PPP_AC = 0x0008, L2TP_PWTYPE_IP = 0x000b, __L2TP_PWTYPE_MAX }; enum l2tp_l2spec_type { L2TP_L2SPECTYPE_NONE, L2TP_L2SPECTYPE_DEFAULT, }; enum l2tp_encap_type { L2TP_ENCAPTYPE_UDP, L2TP_ENCAPTYPE_IP, }; /* For L2TP_ATTR_DATA_SEQ. Unused. */ enum l2tp_seqmode { L2TP_SEQ_NONE = 0, L2TP_SEQ_IP = 1, L2TP_SEQ_ALL = 2, }; /** * enum l2tp_debug_flags - debug message categories for L2TP tunnels/sessions * * @L2TP_MSG_DEBUG: verbose debug (if compiled in) * @L2TP_MSG_CONTROL: userspace - kernel interface * @L2TP_MSG_SEQ: sequence numbers * @L2TP_MSG_DATA: data packets */ enum l2tp_debug_flags { L2TP_MSG_DEBUG = (1 << 0), L2TP_MSG_CONTROL = (1 << 1), L2TP_MSG_SEQ = (1 << 2), L2TP_MSG_DATA = (1 << 3), }; /* * NETLINK_GENERIC related info */ #define L2TP_GENL_NAME "l2tp" #define L2TP_GENL_VERSION 0x1 #define L2TP_GENL_MCGROUP "l2tp" #endif /* _LINUX_L2TP_H_ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/vboxguest.h�����������������������������������������������������������������������������������0000644�����������������00000020741�14763166027�0010122 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: (GPL-2.0 OR CDDL-1.0) */ /* * VBoxGuest - VirtualBox Guest Additions Driver Interface. * * Copyright (C) 2006-2016 Oracle Corporation */ #ifndef __UAPI_VBOXGUEST_H__ #define __UAPI_VBOXGUEST_H__ #include <asm/bitsperlong.h> #include <linux/ioctl.h> #include <linux/vbox_err.h> #include <linux/vbox_vmmdev_types.h> /* Version of vbg_ioctl_hdr structure. */ #define VBG_IOCTL_HDR_VERSION 0x10001 /* Default request type. Use this for non-VMMDev requests. */ #define VBG_IOCTL_HDR_TYPE_DEFAULT 0 /** * Common ioctl header. * * This is a mirror of vmmdev_request_header to prevent duplicating data and * needing to verify things multiple times. */ struct vbg_ioctl_hdr { /** IN: The request input size, and output size if size_out is zero. */ __u32 size_in; /** IN: Structure version (VBG_IOCTL_HDR_VERSION) */ __u32 version; /** IN: The VMMDev request type or VBG_IOCTL_HDR_TYPE_DEFAULT. */ __u32 type; /** * OUT: The VBox status code of the operation, out direction only. * This is a VINF_ or VERR_ value as defined in vbox_err.h. */ __s32 rc; /** IN: Output size. Set to zero to use size_in as output size. */ __u32 size_out; /** Reserved, MBZ. */ __u32 reserved; }; VMMDEV_ASSERT_SIZE(vbg_ioctl_hdr, 24); /* * The VBoxGuest I/O control version. * * As usual, the high word contains the major version and changes to it * signifies incompatible changes. * * The lower word is the minor version number, it is increased when new * functions are added or existing changed in a backwards compatible manner. */ #define VBG_IOC_VERSION 0x00010000u /** * VBG_IOCTL_DRIVER_VERSION_INFO data structure * * Note VBG_IOCTL_DRIVER_VERSION_INFO may switch the session to a backwards * compatible interface version if uClientVersion indicates older client code. */ struct vbg_ioctl_driver_version_info { /** The header. */ struct vbg_ioctl_hdr hdr; union { struct { /** Requested interface version (VBG_IOC_VERSION). */ __u32 req_version; /** * Minimum interface version number (typically the * major version part of VBG_IOC_VERSION). */ __u32 min_version; /** Reserved, MBZ. */ __u32 reserved1; /** Reserved, MBZ. */ __u32 reserved2; } in; struct { /** Version for this session (typ. VBG_IOC_VERSION). */ __u32 session_version; /** Version of the IDC interface (VBG_IOC_VERSION). */ __u32 driver_version; /** The SVN revision of the driver, or 0. */ __u32 driver_revision; /** Reserved \#1 (zero until defined). */ __u32 reserved1; /** Reserved \#2 (zero until defined). */ __u32 reserved2; } out; } u; }; VMMDEV_ASSERT_SIZE(vbg_ioctl_driver_version_info, 24 + 20); #define VBG_IOCTL_DRIVER_VERSION_INFO \ _IOWR('V', 0, struct vbg_ioctl_driver_version_info) /* IOCTL to perform a VMM Device request less than 1KB in size. */ #define VBG_IOCTL_VMMDEV_REQUEST(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 2, s) /* IOCTL to perform a VMM Device request larger then 1KB. */ #define VBG_IOCTL_VMMDEV_REQUEST_BIG _IO('V', 3) /** VBG_IOCTL_HGCM_CONNECT data structure. */ struct vbg_ioctl_hgcm_connect { struct vbg_ioctl_hdr hdr; union { struct { struct vmmdev_hgcm_service_location loc; } in; struct { __u32 client_id; } out; } u; }; VMMDEV_ASSERT_SIZE(vbg_ioctl_hgcm_connect, 24 + 132); #define VBG_IOCTL_HGCM_CONNECT \ _IOWR('V', 4, struct vbg_ioctl_hgcm_connect) /** VBG_IOCTL_HGCM_DISCONNECT data structure. */ struct vbg_ioctl_hgcm_disconnect { struct vbg_ioctl_hdr hdr; union { struct { __u32 client_id; } in; } u; }; VMMDEV_ASSERT_SIZE(vbg_ioctl_hgcm_disconnect, 24 + 4); #define VBG_IOCTL_HGCM_DISCONNECT \ _IOWR('V', 5, struct vbg_ioctl_hgcm_disconnect) /** VBG_IOCTL_HGCM_CALL data structure. */ struct vbg_ioctl_hgcm_call { /** The header. */ struct vbg_ioctl_hdr hdr; /** Input: The id of the caller. */ __u32 client_id; /** Input: Function number. */ __u32 function; /** * Input: How long to wait (milliseconds) for completion before * cancelling the call. Set to -1 to wait indefinitely. */ __u32 timeout_ms; /** Interruptable flag, ignored for userspace calls. */ __u8 interruptible; /** Explicit padding, MBZ. */ __u8 reserved; /** * Input: How many parameters following this structure. * * The parameters are either HGCMFunctionParameter64 or 32, * depending on whether we're receiving a 64-bit or 32-bit request. * * The current maximum is 61 parameters (given a 1KB max request size, * and a 64-bit parameter size of 16 bytes). */ __u16 parm_count; /* * Parameters follow in form: * struct hgcm_function_parameter<32|64> parms[parm_count] */ }; VMMDEV_ASSERT_SIZE(vbg_ioctl_hgcm_call, 24 + 16); #define VBG_IOCTL_HGCM_CALL_32(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 6, s) #define VBG_IOCTL_HGCM_CALL_64(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 7, s) #if __BITS_PER_LONG == 64 #define VBG_IOCTL_HGCM_CALL(s) VBG_IOCTL_HGCM_CALL_64(s) #else #define VBG_IOCTL_HGCM_CALL(s) VBG_IOCTL_HGCM_CALL_32(s) #endif /** VBG_IOCTL_LOG data structure. */ struct vbg_ioctl_log { /** The header. */ struct vbg_ioctl_hdr hdr; union { struct { /** * The log message, this may be zero terminated. If it * is not zero terminated then the length is determined * from the input size. */ char msg[1]; } in; } u; }; #define VBG_IOCTL_LOG(s) _IO('V', 9) /** VBG_IOCTL_WAIT_FOR_EVENTS data structure. */ struct vbg_ioctl_wait_for_events { /** The header. */ struct vbg_ioctl_hdr hdr; union { struct { /** Timeout in milliseconds. */ __u32 timeout_ms; /** Events to wait for. */ __u32 events; } in; struct { /** Events that occurred. */ __u32 events; } out; } u; }; VMMDEV_ASSERT_SIZE(vbg_ioctl_wait_for_events, 24 + 8); #define VBG_IOCTL_WAIT_FOR_EVENTS \ _IOWR('V', 10, struct vbg_ioctl_wait_for_events) /* * IOCTL to VBoxGuest to interrupt (cancel) any pending * VBG_IOCTL_WAIT_FOR_EVENTS and return. * * Handled inside the vboxguest driver and not seen by the host at all. * After calling this, VBG_IOCTL_WAIT_FOR_EVENTS should no longer be called in * the same session. Any VBOXGUEST_IOCTL_WAITEVENT calls in the same session * done after calling this will directly exit with -EINTR. */ #define VBG_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS \ _IOWR('V', 11, struct vbg_ioctl_hdr) /** VBG_IOCTL_CHANGE_FILTER_MASK data structure. */ struct vbg_ioctl_change_filter { /** The header. */ struct vbg_ioctl_hdr hdr; union { struct { /** Flags to set. */ __u32 or_mask; /** Flags to remove. */ __u32 not_mask; } in; } u; }; VMMDEV_ASSERT_SIZE(vbg_ioctl_change_filter, 24 + 8); /* IOCTL to VBoxGuest to control the event filter mask. */ #define VBG_IOCTL_CHANGE_FILTER_MASK \ _IOWR('V', 12, struct vbg_ioctl_change_filter) /** VBG_IOCTL_CHANGE_GUEST_CAPABILITIES data structure. */ struct vbg_ioctl_set_guest_caps { /** The header. */ struct vbg_ioctl_hdr hdr; union { struct { /** Capabilities to set (VMMDEV_GUEST_SUPPORTS_XXX). */ __u32 or_mask; /** Capabilities to drop (VMMDEV_GUEST_SUPPORTS_XXX). */ __u32 not_mask; } in; struct { /** Capabilities held by the session after the call. */ __u32 session_caps; /** Capabilities for all the sessions after the call. */ __u32 global_caps; } out; } u; }; VMMDEV_ASSERT_SIZE(vbg_ioctl_set_guest_caps, 24 + 8); #define VBG_IOCTL_CHANGE_GUEST_CAPABILITIES \ _IOWR('V', 14, struct vbg_ioctl_set_guest_caps) /** VBG_IOCTL_CHECK_BALLOON data structure. */ struct vbg_ioctl_check_balloon { /** The header. */ struct vbg_ioctl_hdr hdr; union { struct { /** The size of the balloon in chunks of 1MB. */ __u32 balloon_chunks; /** * false = handled in R0, no further action required. * true = allocate balloon memory in R3. */ __u8 handle_in_r3; /** Explicit padding, MBZ. */ __u8 padding[3]; } out; } u; }; VMMDEV_ASSERT_SIZE(vbg_ioctl_check_balloon, 24 + 8); /* * IOCTL to check memory ballooning. * * The guest kernel module will ask the host for the current size of the * balloon and adjust the size. Or it will set handle_in_r3 = true and R3 is * responsible for allocating memory and calling VBG_IOCTL_CHANGE_BALLOON. */ #define VBG_IOCTL_CHECK_BALLOON \ _IOWR('V', 17, struct vbg_ioctl_check_balloon) /** VBG_IOCTL_WRITE_CORE_DUMP data structure. */ struct vbg_ioctl_write_coredump { struct vbg_ioctl_hdr hdr; union { struct { __u32 flags; /** Flags (reserved, MBZ). */ } in; } u; }; VMMDEV_ASSERT_SIZE(vbg_ioctl_write_coredump, 24 + 4); #define VBG_IOCTL_WRITE_CORE_DUMP \ _IOWR('V', 19, struct vbg_ioctl_write_coredump) #endif �������������������������������linux/wimax/i2400m.h��������������������������������������������������������������������������������0000644�����������������00000037072�14763166027�0010141 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Intel Wireless WiMax Connection 2400m * Host-Device protocol interface definitions * * * Copyright (C) 2007-2008 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name of Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * Intel Corporation <linux-wimax@intel.com> * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> * - Initial implementation * * * This header defines the data structures and constants used to * communicate with the device. * * BOOTMODE/BOOTROM/FIRMWARE UPLOAD PROTOCOL * * The firmware upload protocol is quite simple and only requires a * handful of commands. See drivers/net/wimax/i2400m/fw.c for more * details. * * The BCF data structure is for the firmware file header. * * * THE DATA / CONTROL PROTOCOL * * This is the normal protocol spoken with the device once the * firmware is uploaded. It transports data payloads and control * messages back and forth. * * It consists 'messages' that pack one or more payloads each. The * format is described in detail in drivers/net/wimax/i2400m/rx.c and * tx.c. * * * THE L3L4 PROTOCOL * * The term L3L4 refers to Layer 3 (the device), Layer 4 (the * driver/host software). * * This is the control protocol used by the host to control the i2400m * device (scan, connect, disconnect...). This is sent to / received * as control frames. These frames consist of a header and zero or * more TLVs with information. We call each control frame a "message". * * Each message is composed of: * * HEADER * [TLV0 + PAYLOAD0] * [TLV1 + PAYLOAD1] * [...] * [TLVN + PAYLOADN] * * The HEADER is defined by 'struct i2400m_l3l4_hdr'. The payloads are * defined by a TLV structure (Type Length Value) which is a 'header' * (struct i2400m_tlv_hdr) and then the payload. * * All integers are represented as Little Endian. * * - REQUESTS AND EVENTS * * The requests can be clasified as follows: * * COMMAND: implies a request from the host to the device requesting * an action being performed. The device will reply with a * message (with the same type as the command), status and * no (TLV) payload. Execution of a command might cause * events (of different type) to be sent later on as * device's state changes. * * GET/SET: similar to COMMAND, but will not cause other * EVENTs. The reply, in the case of GET, will contain * TLVs with the requested information. * * EVENT: asynchronous messages sent from the device, maybe as a * consequence of previous COMMANDs but disassociated from * them. * * Only one request might be pending at the same time (ie: don't * parallelize nor post another GET request before the previous * COMMAND has been acknowledged with it's corresponding reply by the * device). * * The different requests and their formats are described below: * * I2400M_MT_* Message types * I2400M_MS_* Message status (for replies, events) * i2400m_tlv_* TLVs * * data types are named 'struct i2400m_msg_OPNAME', OPNAME matching the * operation. */ #ifndef __LINUX__WIMAX__I2400M_H__ #define __LINUX__WIMAX__I2400M_H__ #include <linux/types.h> #include <linux/if_ether.h> /* * Host Device Interface (HDI) common to all busses */ /* Boot-mode (firmware upload mode) commands */ /* Header for the firmware file */ struct i2400m_bcf_hdr { __le32 module_type; __le32 header_len; __le32 header_version; __le32 module_id; __le32 module_vendor; __le32 date; /* BCD YYYMMDD */ __le32 size; /* in dwords */ __le32 key_size; /* in dwords */ __le32 modulus_size; /* in dwords */ __le32 exponent_size; /* in dwords */ __u8 reserved[88]; } __attribute__ ((packed)); /* Boot mode opcodes */ enum i2400m_brh_opcode { I2400M_BRH_READ = 1, I2400M_BRH_WRITE = 2, I2400M_BRH_JUMP = 3, I2400M_BRH_SIGNED_JUMP = 8, I2400M_BRH_HASH_PAYLOAD_ONLY = 9, }; /* Boot mode command masks and stuff */ enum i2400m_brh { I2400M_BRH_SIGNATURE = 0xcbbc0000, I2400M_BRH_SIGNATURE_MASK = 0xffff0000, I2400M_BRH_SIGNATURE_SHIFT = 16, I2400M_BRH_OPCODE_MASK = 0x0000000f, I2400M_BRH_RESPONSE_MASK = 0x000000f0, I2400M_BRH_RESPONSE_SHIFT = 4, I2400M_BRH_DIRECT_ACCESS = 0x00000400, I2400M_BRH_RESPONSE_REQUIRED = 0x00000200, I2400M_BRH_USE_CHECKSUM = 0x00000100, }; /** * i2400m_bootrom_header - Header for a boot-mode command * * @cmd: the above command descriptor * @target_addr: where on the device memory should the action be performed. * @data_size: for read/write, amount of data to be read/written * @block_checksum: checksum value (if applicable) * @payload: the beginning of data attached to this header */ struct i2400m_bootrom_header { __le32 command; /* Compose with enum i2400_brh */ __le32 target_addr; __le32 data_size; __le32 block_checksum; char payload[0]; } __attribute__ ((packed)); /* * Data / control protocol */ /* Packet types for the host-device interface */ enum i2400m_pt { I2400M_PT_DATA = 0, I2400M_PT_CTRL, I2400M_PT_TRACE, /* For device debug */ I2400M_PT_RESET_WARM, /* device reset */ I2400M_PT_RESET_COLD, /* USB[transport] reset, like reconnect */ I2400M_PT_EDATA, /* Extended RX data */ I2400M_PT_ILLEGAL }; /* * Payload for a data packet * * This is prefixed to each and every outgoing DATA type. */ struct i2400m_pl_data_hdr { __le32 reserved; } __attribute__((packed)); /* * Payload for an extended data packet * * New in fw v1.4 * * @reorder: if this payload has to be reorder or not (and how) * @cs: the type of data in the packet, as defined per (802.16e * T11.13.19.1). Currently only 2 (IPv4 packet) supported. * * This is prefixed to each and every INCOMING DATA packet. */ struct i2400m_pl_edata_hdr { __le32 reorder; /* bits defined in i2400m_ro */ __u8 cs; __u8 reserved[11]; } __attribute__((packed)); enum i2400m_cs { I2400M_CS_IPV4_0 = 0, I2400M_CS_IPV4 = 2, }; enum i2400m_ro { I2400M_RO_NEEDED = 0x01, I2400M_RO_TYPE = 0x03, I2400M_RO_TYPE_SHIFT = 1, I2400M_RO_CIN = 0x0f, I2400M_RO_CIN_SHIFT = 4, I2400M_RO_FBN = 0x07ff, I2400M_RO_FBN_SHIFT = 8, I2400M_RO_SN = 0x07ff, I2400M_RO_SN_SHIFT = 21, }; enum i2400m_ro_type { I2400M_RO_TYPE_RESET = 0, I2400M_RO_TYPE_PACKET, I2400M_RO_TYPE_WS, I2400M_RO_TYPE_PACKET_WS, }; /* Misc constants */ enum { I2400M_PL_ALIGN = 16, /* Payload data size alignment */ I2400M_PL_SIZE_MAX = 0x3EFF, I2400M_MAX_PLS_IN_MSG = 60, /* protocol barkers: sync sequences; for notifications they * are sent in groups of four. */ I2400M_H2D_PREVIEW_BARKER = 0xcafe900d, I2400M_COLD_RESET_BARKER = 0xc01dc01d, I2400M_WARM_RESET_BARKER = 0x50f750f7, I2400M_NBOOT_BARKER = 0xdeadbeef, I2400M_SBOOT_BARKER = 0x0ff1c1a1, I2400M_SBOOT_BARKER_6050 = 0x80000001, I2400M_ACK_BARKER = 0xfeedbabe, I2400M_D2H_MSG_BARKER = 0xbeefbabe, }; /* * Hardware payload descriptor * * Bitfields encoded in a struct to enforce typing semantics. * * Look in rx.c and tx.c for a full description of the format. */ struct i2400m_pld { __le32 val; } __attribute__ ((packed)); #define I2400M_PLD_SIZE_MASK 0x00003fff #define I2400M_PLD_TYPE_SHIFT 16 #define I2400M_PLD_TYPE_MASK 0x000f0000 /* * Header for a TX message or RX message * * @barker: preamble * @size: used for management of the FIFO queue buffer; before * sending, this is converted to be a real preamble. This * indicates the real size of the TX message that starts at this * point. If the highest bit is set, then this message is to be * skipped. * @sequence: sequence number of this message * @offset: offset where the message itself starts -- see the comments * in the file header about message header and payload descriptor * alignment. * @num_pls: number of payloads in this message * @padding: amount of padding bytes at the end of the message to make * it be of block-size aligned * * Look in rx.c and tx.c for a full description of the format. */ struct i2400m_msg_hdr { union { __le32 barker; __u32 size; /* same size type as barker!! */ }; union { __le32 sequence; __u32 offset; /* same size type as barker!! */ }; __le16 num_pls; __le16 rsv1; __le16 padding; __le16 rsv2; struct i2400m_pld pld[0]; } __attribute__ ((packed)); /* * L3/L4 control protocol */ enum { /* Interface version */ I2400M_L3L4_VERSION = 0x0100, }; /* Message types */ enum i2400m_mt { I2400M_MT_RESERVED = 0x0000, I2400M_MT_INVALID = 0xffff, I2400M_MT_REPORT_MASK = 0x8000, I2400M_MT_GET_SCAN_RESULT = 0x4202, I2400M_MT_SET_SCAN_PARAM = 0x4402, I2400M_MT_CMD_RF_CONTROL = 0x4602, I2400M_MT_CMD_SCAN = 0x4603, I2400M_MT_CMD_CONNECT = 0x4604, I2400M_MT_CMD_DISCONNECT = 0x4605, I2400M_MT_CMD_EXIT_IDLE = 0x4606, I2400M_MT_GET_LM_VERSION = 0x5201, I2400M_MT_GET_DEVICE_INFO = 0x5202, I2400M_MT_GET_LINK_STATUS = 0x5203, I2400M_MT_GET_STATISTICS = 0x5204, I2400M_MT_GET_STATE = 0x5205, I2400M_MT_GET_MEDIA_STATUS = 0x5206, I2400M_MT_SET_INIT_CONFIG = 0x5404, I2400M_MT_CMD_INIT = 0x5601, I2400M_MT_CMD_TERMINATE = 0x5602, I2400M_MT_CMD_MODE_OF_OP = 0x5603, I2400M_MT_CMD_RESET_DEVICE = 0x5604, I2400M_MT_CMD_MONITOR_CONTROL = 0x5605, I2400M_MT_CMD_ENTER_POWERSAVE = 0x5606, I2400M_MT_GET_TLS_OPERATION_RESULT = 0x6201, I2400M_MT_SET_EAP_SUCCESS = 0x6402, I2400M_MT_SET_EAP_FAIL = 0x6403, I2400M_MT_SET_EAP_KEY = 0x6404, I2400M_MT_CMD_SEND_EAP_RESPONSE = 0x6602, I2400M_MT_REPORT_SCAN_RESULT = 0xc002, I2400M_MT_REPORT_STATE = 0xd002, I2400M_MT_REPORT_POWERSAVE_READY = 0xd005, I2400M_MT_REPORT_EAP_REQUEST = 0xe002, I2400M_MT_REPORT_EAP_RESTART = 0xe003, I2400M_MT_REPORT_ALT_ACCEPT = 0xe004, I2400M_MT_REPORT_KEY_REQUEST = 0xe005, }; /* * Message Ack Status codes * * When a message is replied-to, this status is reported. */ enum i2400m_ms { I2400M_MS_DONE_OK = 0, I2400M_MS_DONE_IN_PROGRESS = 1, I2400M_MS_INVALID_OP = 2, I2400M_MS_BAD_STATE = 3, I2400M_MS_ILLEGAL_VALUE = 4, I2400M_MS_MISSING_PARAMS = 5, I2400M_MS_VERSION_ERROR = 6, I2400M_MS_ACCESSIBILITY_ERROR = 7, I2400M_MS_BUSY = 8, I2400M_MS_CORRUPTED_TLV = 9, I2400M_MS_UNINITIALIZED = 10, I2400M_MS_UNKNOWN_ERROR = 11, I2400M_MS_PRODUCTION_ERROR = 12, I2400M_MS_NO_RF = 13, I2400M_MS_NOT_READY_FOR_POWERSAVE = 14, I2400M_MS_THERMAL_CRITICAL = 15, I2400M_MS_MAX }; /** * i2400m_tlv - enumeration of the different types of TLVs * * TLVs stand for type-length-value and are the header for a payload * composed of almost anything. Each payload has a type assigned * and a length. */ enum i2400m_tlv { I2400M_TLV_L4_MESSAGE_VERSIONS = 129, I2400M_TLV_SYSTEM_STATE = 141, I2400M_TLV_MEDIA_STATUS = 161, I2400M_TLV_RF_OPERATION = 162, I2400M_TLV_RF_STATUS = 163, I2400M_TLV_DEVICE_RESET_TYPE = 132, I2400M_TLV_CONFIG_IDLE_PARAMETERS = 601, I2400M_TLV_CONFIG_IDLE_TIMEOUT = 611, I2400M_TLV_CONFIG_D2H_DATA_FORMAT = 614, I2400M_TLV_CONFIG_DL_HOST_REORDER = 615, }; struct i2400m_tlv_hdr { __le16 type; __le16 length; /* payload's */ __u8 pl[0]; } __attribute__((packed)); struct i2400m_l3l4_hdr { __le16 type; __le16 length; /* payload's */ __le16 version; __le16 resv1; __le16 status; __le16 resv2; struct i2400m_tlv_hdr pl[0]; } __attribute__((packed)); /** * i2400m_system_state - different states of the device */ enum i2400m_system_state { I2400M_SS_UNINITIALIZED = 1, I2400M_SS_INIT, I2400M_SS_READY, I2400M_SS_SCAN, I2400M_SS_STANDBY, I2400M_SS_CONNECTING, I2400M_SS_WIMAX_CONNECTED, I2400M_SS_DATA_PATH_CONNECTED, I2400M_SS_IDLE, I2400M_SS_DISCONNECTING, I2400M_SS_OUT_OF_ZONE, I2400M_SS_SLEEPACTIVE, I2400M_SS_PRODUCTION, I2400M_SS_CONFIG, I2400M_SS_RF_OFF, I2400M_SS_RF_SHUTDOWN, I2400M_SS_DEVICE_DISCONNECT, I2400M_SS_MAX, }; /** * i2400m_tlv_system_state - report on the state of the system * * @state: see enum i2400m_system_state */ struct i2400m_tlv_system_state { struct i2400m_tlv_hdr hdr; __le32 state; } __attribute__((packed)); struct i2400m_tlv_l4_message_versions { struct i2400m_tlv_hdr hdr; __le16 major; __le16 minor; __le16 branch; __le16 reserved; } __attribute__((packed)); struct i2400m_tlv_detailed_device_info { struct i2400m_tlv_hdr hdr; __u8 reserved1[400]; __u8 mac_address[ETH_ALEN]; __u8 reserved2[2]; } __attribute__((packed)); enum i2400m_rf_switch_status { I2400M_RF_SWITCH_ON = 1, I2400M_RF_SWITCH_OFF = 2, }; struct i2400m_tlv_rf_switches_status { struct i2400m_tlv_hdr hdr; __u8 sw_rf_switch; /* 1 ON, 2 OFF */ __u8 hw_rf_switch; /* 1 ON, 2 OFF */ __u8 reserved[2]; } __attribute__((packed)); enum { i2400m_rf_operation_on = 1, i2400m_rf_operation_off = 2 }; struct i2400m_tlv_rf_operation { struct i2400m_tlv_hdr hdr; __le32 status; /* 1 ON, 2 OFF */ } __attribute__((packed)); enum i2400m_tlv_reset_type { I2400M_RESET_TYPE_COLD = 1, I2400M_RESET_TYPE_WARM }; struct i2400m_tlv_device_reset_type { struct i2400m_tlv_hdr hdr; __le32 reset_type; } __attribute__((packed)); struct i2400m_tlv_config_idle_parameters { struct i2400m_tlv_hdr hdr; __le32 idle_timeout; /* 100 to 300000 ms [5min], 100 increments * 0 disabled */ __le32 idle_paging_interval; /* frames */ } __attribute__((packed)); enum i2400m_media_status { I2400M_MEDIA_STATUS_LINK_UP = 1, I2400M_MEDIA_STATUS_LINK_DOWN, I2400M_MEDIA_STATUS_LINK_RENEW, }; struct i2400m_tlv_media_status { struct i2400m_tlv_hdr hdr; __le32 media_status; } __attribute__((packed)); /* New in v1.4 */ struct i2400m_tlv_config_idle_timeout { struct i2400m_tlv_hdr hdr; __le32 timeout; /* 100 to 300000 ms [5min], 100 increments * 0 disabled */ } __attribute__((packed)); /* New in v1.4 -- for backward compat, will be removed */ struct i2400m_tlv_config_d2h_data_format { struct i2400m_tlv_hdr hdr; __u8 format; /* 0 old format, 1 enhanced */ __u8 reserved[3]; } __attribute__((packed)); /* New in v1.4 */ struct i2400m_tlv_config_dl_host_reorder { struct i2400m_tlv_hdr hdr; __u8 reorder; /* 0 disabled, 1 enabled */ __u8 reserved[3]; } __attribute__((packed)); #endif /* #ifndef __LINUX__WIMAX__I2400M_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/ipv6.h����������������������������������������������������������������������������������������0000644�����������������00000007577�14763166027�0006774 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IPV6_H #define _IPV6_H #include <linux/libc-compat.h> #include <linux/types.h> #include <linux/in6.h> #include <asm/byteorder.h> /* The latest drafts declared increase in minimal mtu up to 1280. */ #define IPV6_MIN_MTU 1280 /* * Advanced API * source interface/address selection, source routing, etc... * *under construction* */ #if __UAPI_DEF_IN6_PKTINFO struct in6_pktinfo { struct in6_addr ipi6_addr; int ipi6_ifindex; }; #endif #if __UAPI_DEF_IP6_MTUINFO struct ip6_mtuinfo { struct sockaddr_in6 ip6m_addr; __u32 ip6m_mtu; }; #endif struct in6_ifreq { struct in6_addr ifr6_addr; __u32 ifr6_prefixlen; int ifr6_ifindex; }; #define IPV6_SRCRT_STRICT 0x01 /* Deprecated; will be removed */ #define IPV6_SRCRT_TYPE_0 0 /* Deprecated; will be removed */ #define IPV6_SRCRT_TYPE_2 2 /* IPv6 type 2 Routing Header */ #define IPV6_SRCRT_TYPE_4 4 /* Segment Routing with IPv6 */ /* * routing header */ struct ipv6_rt_hdr { __u8 nexthdr; __u8 hdrlen; __u8 type; __u8 segments_left; /* * type specific data * variable length field */ }; struct ipv6_opt_hdr { __u8 nexthdr; __u8 hdrlen; /* * TLV encoded option data follows. */ } __attribute__((packed)); /* required for some archs */ #define ipv6_destopt_hdr ipv6_opt_hdr #define ipv6_hopopt_hdr ipv6_opt_hdr /* Router Alert option values (RFC2711) */ #define IPV6_OPT_ROUTERALERT_MLD 0x0000 /* MLD(RFC2710) */ /* * routing header type 0 (used in cmsghdr struct) */ struct rt0_hdr { struct ipv6_rt_hdr rt_hdr; __u32 reserved; struct in6_addr addr[0]; #define rt0_type rt_hdr.type }; /* * routing header type 2 */ struct rt2_hdr { struct ipv6_rt_hdr rt_hdr; __u32 reserved; struct in6_addr addr; #define rt2_type rt_hdr.type }; /* * home address option in destination options header */ struct ipv6_destopt_hao { __u8 type; __u8 length; struct in6_addr addr; } __attribute__((packed)); /* * IPv6 fixed header * * BEWARE, it is incorrect. The first 4 bits of flow_lbl * are glued to priority now, forming "class". */ struct ipv6hdr { #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 priority:4, version:4; #elif defined(__BIG_ENDIAN_BITFIELD) __u8 version:4, priority:4; #else #error "Please fix <asm/byteorder.h>" #endif __u8 flow_lbl[3]; __be16 payload_len; __u8 nexthdr; __u8 hop_limit; struct in6_addr saddr; struct in6_addr daddr; }; /* index values for the variables in ipv6_devconf */ enum { DEVCONF_FORWARDING = 0, DEVCONF_HOPLIMIT, DEVCONF_MTU6, DEVCONF_ACCEPT_RA, DEVCONF_ACCEPT_REDIRECTS, DEVCONF_AUTOCONF, DEVCONF_DAD_TRANSMITS, DEVCONF_RTR_SOLICITS, DEVCONF_RTR_SOLICIT_INTERVAL, DEVCONF_RTR_SOLICIT_DELAY, DEVCONF_USE_TEMPADDR, DEVCONF_TEMP_VALID_LFT, DEVCONF_TEMP_PREFERED_LFT, DEVCONF_REGEN_MAX_RETRY, DEVCONF_MAX_DESYNC_FACTOR, DEVCONF_MAX_ADDRESSES, DEVCONF_FORCE_MLD_VERSION, DEVCONF_ACCEPT_RA_DEFRTR, DEVCONF_ACCEPT_RA_PINFO, DEVCONF_ACCEPT_RA_RTR_PREF, DEVCONF_RTR_PROBE_INTERVAL, DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, DEVCONF_PROXY_NDP, DEVCONF_OPTIMISTIC_DAD, DEVCONF_ACCEPT_SOURCE_ROUTE, DEVCONF_MC_FORWARDING, DEVCONF_DISABLE_IPV6, DEVCONF_ACCEPT_DAD, DEVCONF_FORCE_TLLAO, DEVCONF_NDISC_NOTIFY, DEVCONF_MLDV1_UNSOLICITED_REPORT_INTERVAL, DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL, DEVCONF_SUPPRESS_FRAG_NDISC, DEVCONF_ACCEPT_RA_FROM_LOCAL, DEVCONF_USE_OPTIMISTIC, DEVCONF_ACCEPT_RA_MTU, DEVCONF_STABLE_SECRET, DEVCONF_USE_OIF_ADDRS_ONLY, DEVCONF_ACCEPT_RA_MIN_HOP_LIMIT, DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN, DEVCONF_DROP_UNICAST_IN_L2_MULTICAST, DEVCONF_DROP_UNSOLICITED_NA, DEVCONF_KEEP_ADDR_ON_DOWN, DEVCONF_RTR_SOLICIT_MAX_INTERVAL, DEVCONF_SEG6_ENABLED, DEVCONF_SEG6_REQUIRE_HMAC, DEVCONF_ENHANCED_DAD, DEVCONF_ADDR_GEN_MODE, DEVCONF_DISABLE_POLICY, DEVCONF_ACCEPT_RA_RT_INFO_MIN_PLEN, DEVCONF_NDISC_TCLASS, DEVCONF_MAX }; #endif /* _IPV6_H */ ���������������������������������������������������������������������������������������������������������������������������������linux/string.h��������������������������������������������������������������������������������������0000644�����������������00000000356�14763166027�0007402 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_STRING_H_ #define _LINUX_STRING_H_ /* We don't want strings.h stuff being used by user stuff by accident */ #include <string.h> #endif /* _LINUX_STRING_H_ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/poll.h����������������������������������������������������������������������������������������0000644�����������������00000000026�14763166027�0007034 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <asm/poll.h> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/dm-log-userspace.h����������������������������������������������������������������������������0000644�����������������00000035527�14763166027�0011253 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (C) 2006-2009 Red Hat, Inc. * * This file is released under the LGPL. */ #ifndef __DM_LOG_USERSPACE_H__ #define __DM_LOG_USERSPACE_H__ #include <linux/types.h> #include <linux/dm-ioctl.h> /* For DM_UUID_LEN */ /* * The device-mapper userspace log module consists of a kernel component and * a user-space component. The kernel component implements the API defined * in dm-dirty-log.h. Its purpose is simply to pass the parameters and * return values of those API functions between kernel and user-space. * * Below are defined the 'request_types' - DM_ULOG_CTR, DM_ULOG_DTR, etc. * These request types represent the different functions in the device-mapper * dirty log API. Each of these is described in more detail below. * * The user-space program must listen for requests from the kernel (representing * the various API functions) and process them. * * User-space begins by setting up the communication link (error checking * removed for clarity): * fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); * addr.nl_family = AF_NETLINK; * addr.nl_groups = CN_IDX_DM; * addr.nl_pid = 0; * r = bind(fd, (struct sockaddr *) &addr, sizeof(addr)); * opt = addr.nl_groups; * setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &opt, sizeof(opt)); * * User-space will then wait to receive requests form the kernel, which it * will process as described below. The requests are received in the form, * ((struct dm_ulog_request) + (additional data)). Depending on the request * type, there may or may not be 'additional data'. In the descriptions below, * you will see 'Payload-to-userspace' and 'Payload-to-kernel'. The * 'Payload-to-userspace' is what the kernel sends in 'additional data' as * necessary parameters to complete the request. The 'Payload-to-kernel' is * the 'additional data' returned to the kernel that contains the necessary * results of the request. The 'data_size' field in the dm_ulog_request * structure denotes the availability and amount of payload data. */ /* * DM_ULOG_CTR corresponds to (found in dm-dirty-log.h): * int (*ctr)(struct dm_dirty_log *log, struct dm_target *ti, * unsigned argc, char **argv); * * Payload-to-userspace: * A single string containing all the argv arguments separated by ' 's * Payload-to-kernel: * A NUL-terminated string that is the name of the device that is used * as the backing store for the log data. 'dm_get_device' will be called * on this device. ('dm_put_device' will be called on this device * automatically after calling DM_ULOG_DTR.) If there is no device needed * for log data, 'data_size' in the dm_ulog_request struct should be 0. * * The UUID contained in the dm_ulog_request structure is the reference that * will be used by all request types to a specific log. The constructor must * record this association with the instance created. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field, filling the * data field with the log device if necessary, and setting 'data_size' * appropriately. */ #define DM_ULOG_CTR 1 /* * DM_ULOG_DTR corresponds to (found in dm-dirty-log.h): * void (*dtr)(struct dm_dirty_log *log); * * Payload-to-userspace: * A single string containing all the argv arguments separated by ' 's * Payload-to-kernel: * None. ('data_size' in the dm_ulog_request struct should be 0.) * * The UUID contained in the dm_ulog_request structure is all that is * necessary to identify the log instance being destroyed. There is no * payload data. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and clearing * 'data_size' appropriately. */ #define DM_ULOG_DTR 2 /* * DM_ULOG_PRESUSPEND corresponds to (found in dm-dirty-log.h): * int (*presuspend)(struct dm_dirty_log *log); * * Payload-to-userspace: * None. * Payload-to-kernel: * None. * * The UUID contained in the dm_ulog_request structure is all that is * necessary to identify the log instance being presuspended. There is no * payload data. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and * 'data_size' appropriately. */ #define DM_ULOG_PRESUSPEND 3 /* * DM_ULOG_POSTSUSPEND corresponds to (found in dm-dirty-log.h): * int (*postsuspend)(struct dm_dirty_log *log); * * Payload-to-userspace: * None. * Payload-to-kernel: * None. * * The UUID contained in the dm_ulog_request structure is all that is * necessary to identify the log instance being postsuspended. There is no * payload data. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and * 'data_size' appropriately. */ #define DM_ULOG_POSTSUSPEND 4 /* * DM_ULOG_RESUME corresponds to (found in dm-dirty-log.h): * int (*resume)(struct dm_dirty_log *log); * * Payload-to-userspace: * None. * Payload-to-kernel: * None. * * The UUID contained in the dm_ulog_request structure is all that is * necessary to identify the log instance being resumed. There is no * payload data. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and * 'data_size' appropriately. */ #define DM_ULOG_RESUME 5 /* * DM_ULOG_GET_REGION_SIZE corresponds to (found in dm-dirty-log.h): * __u32 (*get_region_size)(struct dm_dirty_log *log); * * Payload-to-userspace: * None. * Payload-to-kernel: * __u64 - contains the region size * * The region size is something that was determined at constructor time. * It is returned in the payload area and 'data_size' is set to * reflect this. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field appropriately. */ #define DM_ULOG_GET_REGION_SIZE 6 /* * DM_ULOG_IS_CLEAN corresponds to (found in dm-dirty-log.h): * int (*is_clean)(struct dm_dirty_log *log, region_t region); * * Payload-to-userspace: * __u64 - the region to get clean status on * Payload-to-kernel: * __s64 - 1 if clean, 0 otherwise * * Payload is sizeof(__u64) and contains the region for which the clean * status is being made. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - filling the payload with 0 (not clean) or * 1 (clean), setting 'data_size' and 'error' appropriately. */ #define DM_ULOG_IS_CLEAN 7 /* * DM_ULOG_IN_SYNC corresponds to (found in dm-dirty-log.h): * int (*in_sync)(struct dm_dirty_log *log, region_t region, * int can_block); * * Payload-to-userspace: * __u64 - the region to get sync status on * Payload-to-kernel: * __s64 - 1 if in-sync, 0 otherwise * * Exactly the same as 'is_clean' above, except this time asking "has the * region been recovered?" vs. "is the region not being modified?" */ #define DM_ULOG_IN_SYNC 8 /* * DM_ULOG_FLUSH corresponds to (found in dm-dirty-log.h): * int (*flush)(struct dm_dirty_log *log); * * Payload-to-userspace: * If the 'integrated_flush' directive is present in the constructor * table, the payload is as same as DM_ULOG_MARK_REGION: * __u64 [] - region(s) to mark * else * None * Payload-to-kernel: * None. * * If the 'integrated_flush' option was used during the creation of the * log, mark region requests are carried as payload in the flush request. * Piggybacking the mark requests in this way allows for fewer communications * between kernel and userspace. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and clearing * 'data_size' appropriately. */ #define DM_ULOG_FLUSH 9 /* * DM_ULOG_MARK_REGION corresponds to (found in dm-dirty-log.h): * void (*mark_region)(struct dm_dirty_log *log, region_t region); * * Payload-to-userspace: * __u64 [] - region(s) to mark * Payload-to-kernel: * None. * * Incoming payload contains the one or more regions to mark dirty. * The number of regions contained in the payload can be determined from * 'data_size/sizeof(__u64)'. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and clearing * 'data_size' appropriately. */ #define DM_ULOG_MARK_REGION 10 /* * DM_ULOG_CLEAR_REGION corresponds to (found in dm-dirty-log.h): * void (*clear_region)(struct dm_dirty_log *log, region_t region); * * Payload-to-userspace: * __u64 [] - region(s) to clear * Payload-to-kernel: * None. * * Incoming payload contains the one or more regions to mark clean. * The number of regions contained in the payload can be determined from * 'data_size/sizeof(__u64)'. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and clearing * 'data_size' appropriately. */ #define DM_ULOG_CLEAR_REGION 11 /* * DM_ULOG_GET_RESYNC_WORK corresponds to (found in dm-dirty-log.h): * int (*get_resync_work)(struct dm_dirty_log *log, region_t *region); * * Payload-to-userspace: * None. * Payload-to-kernel: * { * __s64 i; -- 1 if recovery necessary, 0 otherwise * __u64 r; -- The region to recover if i=1 * } * 'data_size' should be set appropriately. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field appropriately. */ #define DM_ULOG_GET_RESYNC_WORK 12 /* * DM_ULOG_SET_REGION_SYNC corresponds to (found in dm-dirty-log.h): * void (*set_region_sync)(struct dm_dirty_log *log, * region_t region, int in_sync); * * Payload-to-userspace: * { * __u64 - region to set sync state on * __s64 - 0 if not-in-sync, 1 if in-sync * } * Payload-to-kernel: * None. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and clearing * 'data_size' appropriately. */ #define DM_ULOG_SET_REGION_SYNC 13 /* * DM_ULOG_GET_SYNC_COUNT corresponds to (found in dm-dirty-log.h): * region_t (*get_sync_count)(struct dm_dirty_log *log); * * Payload-to-userspace: * None. * Payload-to-kernel: * __u64 - the number of in-sync regions * * No incoming payload. Kernel-bound payload contains the number of * regions that are in-sync (in a size_t). * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and * 'data_size' appropriately. */ #define DM_ULOG_GET_SYNC_COUNT 14 /* * DM_ULOG_STATUS_INFO corresponds to (found in dm-dirty-log.h): * int (*status)(struct dm_dirty_log *log, STATUSTYPE_INFO, * char *result, unsigned maxlen); * * Payload-to-userspace: * None. * Payload-to-kernel: * Character string containing STATUSTYPE_INFO * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and * 'data_size' appropriately. */ #define DM_ULOG_STATUS_INFO 15 /* * DM_ULOG_STATUS_TABLE corresponds to (found in dm-dirty-log.h): * int (*status)(struct dm_dirty_log *log, STATUSTYPE_TABLE, * char *result, unsigned maxlen); * * Payload-to-userspace: * None. * Payload-to-kernel: * Character string containing STATUSTYPE_TABLE * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and * 'data_size' appropriately. */ #define DM_ULOG_STATUS_TABLE 16 /* * DM_ULOG_IS_REMOTE_RECOVERING corresponds to (found in dm-dirty-log.h): * int (*is_remote_recovering)(struct dm_dirty_log *log, region_t region); * * Payload-to-userspace: * __u64 - region to determine recovery status on * Payload-to-kernel: * { * __s64 is_recovering; -- 0 if no, 1 if yes * __u64 in_sync_hint; -- lowest region still needing resync * } * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and * 'data_size' appropriately. */ #define DM_ULOG_IS_REMOTE_RECOVERING 17 /* * (DM_ULOG_REQUEST_MASK & request_type) to get the request type * * Payload-to-userspace: * A single string containing all the argv arguments separated by ' 's * Payload-to-kernel: * None. ('data_size' in the dm_ulog_request struct should be 0.) * * We are reserving 8 bits of the 32-bit 'request_type' field for the * various request types above. The remaining 24-bits are currently * set to zero and are reserved for future use and compatibility concerns. * * User-space should always use DM_ULOG_REQUEST_TYPE to acquire the * request type from the 'request_type' field to maintain forward compatibility. */ #define DM_ULOG_REQUEST_MASK 0xFF #define DM_ULOG_REQUEST_TYPE(request_type) \ (DM_ULOG_REQUEST_MASK & (request_type)) /* * DM_ULOG_REQUEST_VERSION is incremented when there is a * change to the way information is passed between kernel * and userspace. This could be a structure change of * dm_ulog_request or a change in the way requests are * issued/handled. Changes are outlined here: * version 1: Initial implementation * version 2: DM_ULOG_CTR allowed to return a string containing a * device name that is to be registered with DM via * 'dm_get_device'. * version 3: DM_ULOG_FLUSH is capable of carrying payload for marking * regions. This "integrated flush" reduces the number of * requests between the kernel and userspace by effectively * merging 'mark' and 'flush' requests. A constructor table * argument ('integrated_flush') is required to turn this * feature on, so it is backwards compatible with older * userspace versions. */ #define DM_ULOG_REQUEST_VERSION 3 struct dm_ulog_request { /* * The local unique identifier (luid) and the universally unique * identifier (uuid) are used to tie a request to a specific * mirror log. A single machine log could probably make due with * just the 'luid', but a cluster-aware log must use the 'uuid' and * the 'luid'. The uuid is what is required for node to node * communication concerning a particular log, but the 'luid' helps * differentiate between logs that are being swapped and have the * same 'uuid'. (Think "live" and "inactive" device-mapper tables.) */ __u64 luid; char uuid[DM_UUID_LEN]; char padding[3]; /* Padding because DM_UUID_LEN = 129 */ __u32 version; /* See DM_ULOG_REQUEST_VERSION */ __s32 error; /* Used to report back processing errors */ __u32 seq; /* Sequence number for request */ __u32 request_type; /* DM_ULOG_* defined above */ __u32 data_size; /* How much data (not including this struct) */ char data[0]; }; #endif /* __DM_LOG_USERSPACE_H__ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/scc.h�����������������������������������������������������������������������������������������0000644�����������������00000010765�14763166027�0006651 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* $Id: scc.h,v 1.29 1997/04/02 14:56:45 jreuter Exp jreuter $ */ #ifndef _SCC_H #define _SCC_H /* selection of hardware types */ #define PA0HZP 0x00 /* hardware type for PA0HZP SCC card and compatible */ #define EAGLE 0x01 /* hardware type for EAGLE card */ #define PC100 0x02 /* hardware type for PC100 card */ #define PRIMUS 0x04 /* hardware type for PRIMUS-PC (DG9BL) card */ #define DRSI 0x08 /* hardware type for DRSI PC*Packet card */ #define BAYCOM 0x10 /* hardware type for BayCom (U)SCC */ /* DEV ioctl() commands */ enum SCC_ioctl_cmds { SIOCSCCRESERVED = SIOCDEVPRIVATE, SIOCSCCCFG, SIOCSCCINI, SIOCSCCCHANINI, SIOCSCCSMEM, SIOCSCCGKISS, SIOCSCCSKISS, SIOCSCCGSTAT, SIOCSCCCAL }; /* Device parameter control (from WAMPES) */ enum L1_params { PARAM_DATA, PARAM_TXDELAY, PARAM_PERSIST, PARAM_SLOTTIME, PARAM_TXTAIL, PARAM_FULLDUP, PARAM_SOFTDCD, /* was: PARAM_HW */ PARAM_MUTE, /* ??? */ PARAM_DTR, PARAM_RTS, PARAM_SPEED, PARAM_ENDDELAY, /* ??? */ PARAM_GROUP, PARAM_IDLE, PARAM_MIN, PARAM_MAXKEY, PARAM_WAIT, PARAM_MAXDEFER, PARAM_TX, PARAM_HWEVENT = 31, PARAM_RETURN = 255 /* reset kiss mode */ }; /* fulldup parameter */ enum FULLDUP_modes { KISS_DUPLEX_HALF, /* normal CSMA operation */ KISS_DUPLEX_FULL, /* fullduplex, key down trx after transmission */ KISS_DUPLEX_LINK, /* fullduplex, key down trx after 'idletime' sec */ KISS_DUPLEX_OPTIMA /* fullduplex, let the protocol layer control the hw */ }; /* misc. parameters */ #define TIMER_OFF 65535U /* to switch off timers */ #define NO_SUCH_PARAM 65534U /* param not implemented */ /* HWEVENT parameter */ enum HWEVENT_opts { HWEV_DCD_ON, HWEV_DCD_OFF, HWEV_ALL_SENT }; /* channel grouping */ #define RXGROUP 0100 /* if set, only tx when all channels clear */ #define TXGROUP 0200 /* if set, don't transmit simultaneously */ /* Tx/Rx clock sources */ enum CLOCK_sources { CLK_DPLL, /* normal halfduplex operation */ CLK_EXTERNAL, /* external clocking (G3RUH/DF9IC modems) */ CLK_DIVIDER, /* Rx = DPLL, Tx = divider (fullduplex with */ /* modems without clock regeneration */ CLK_BRG /* experimental fullduplex mode with DPLL/BRG for */ /* MODEMs without clock recovery */ }; /* Tx state */ enum TX_state { TXS_IDLE, /* Transmitter off, no data pending */ TXS_BUSY, /* waiting for permission to send / tailtime */ TXS_ACTIVE, /* Transmitter on, sending data */ TXS_NEWFRAME, /* reset CRC and send (next) frame */ TXS_IDLE2, /* Transmitter on, no data pending */ TXS_WAIT, /* Waiting for Mintime to expire */ TXS_TIMEOUT /* We had a transmission timeout */ }; typedef unsigned long io_port; /* type definition for an 'io port address' */ /* SCC statistical information */ struct scc_stat { long rxints; /* Receiver interrupts */ long txints; /* Transmitter interrupts */ long exints; /* External/status interrupts */ long spints; /* Special receiver interrupts */ long txframes; /* Packets sent */ long rxframes; /* Number of Frames Actually Received */ long rxerrs; /* CRC Errors */ long txerrs; /* KISS errors */ unsigned int nospace; /* "Out of buffers" */ unsigned int rx_over; /* Receiver Overruns */ unsigned int tx_under; /* Transmitter Underruns */ unsigned int tx_state; /* Transmitter state */ int tx_queued; /* tx frames enqueued */ unsigned int maxqueue; /* allocated tx_buffers */ unsigned int bufsize; /* used buffersize */ }; struct scc_modem { long speed; /* Line speed, bps */ char clocksrc; /* 0 = DPLL, 1 = external, 2 = divider */ char nrz; /* NRZ instead of NRZI */ }; struct scc_kiss_cmd { int command; /* one of the KISS-Commands defined above */ unsigned param; /* KISS-Param */ }; struct scc_hw_config { io_port data_a; /* data port channel A */ io_port ctrl_a; /* control port channel A */ io_port data_b; /* data port channel B */ io_port ctrl_b; /* control port channel B */ io_port vector_latch; /* INTACK-Latch (#) */ io_port special; /* special function port */ int irq; /* irq */ long clock; /* clock */ char option; /* command for function port */ char brand; /* hardware type */ char escc; /* use ext. features of a 8580/85180/85280 */ }; /* (#) only one INTACK latch allowed. */ struct scc_mem_config { unsigned int dummy; unsigned int bufsize; }; struct scc_calibrate { unsigned int time; unsigned char pattern; }; #endif /* _SCC_H */ �����������linux/scif_ioctl.h����������������������������������������������������������������������������������0000644�����������������00000014356�14763166027�0010217 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * Intel MIC Platform Software Stack (MPSS) * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license. * * GPL LICENSE SUMMARY * * Copyright(c) 2014 Intel Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * 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. * * BSD LICENSE * * Copyright(c) 2014 Intel Corporation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name of Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Intel SCIF driver. * */ /* * ----------------------------------------- * SCIF IOCTL interface information * ----------------------------------------- */ #ifndef SCIF_IOCTL_H #define SCIF_IOCTL_H #include <linux/types.h> /** * struct scif_port_id - SCIF port information * @node: node on which port resides * @port: local port number */ struct scif_port_id { __u16 node; __u16 port; }; /** * struct scifioctl_connect - used for SCIF_CONNECT IOCTL * @self: used to read back the assigned port_id * @peer: destination node and port to connect to */ struct scifioctl_connect { struct scif_port_id self; struct scif_port_id peer; }; /** * struct scifioctl_accept - used for SCIF_ACCEPTREQ IOCTL * @flags: flags * @peer: global id of peer endpoint * @endpt: new connected endpoint descriptor */ struct scifioctl_accept { __s32 flags; struct scif_port_id peer; __u64 endpt; }; /** * struct scifioctl_msg - used for SCIF_SEND/SCIF_RECV IOCTL * @msg: message buffer address * @len: message length * @flags: flags * @out_len: number of bytes sent/received */ struct scifioctl_msg { __u64 msg; __s32 len; __s32 flags; __s32 out_len; }; /** * struct scifioctl_reg - used for SCIF_REG IOCTL * @addr: starting virtual address * @len: length of range * @offset: offset of window * @prot: read/write protection * @flags: flags * @out_offset: offset returned */ struct scifioctl_reg { __u64 addr; __u64 len; __s64 offset; __s32 prot; __s32 flags; __s64 out_offset; }; /** * struct scifioctl_unreg - used for SCIF_UNREG IOCTL * @offset: start of range to unregister * @len: length of range to unregister */ struct scifioctl_unreg { __s64 offset; __u64 len; }; /** * struct scifioctl_copy - used for SCIF DMA copy IOCTLs * * @loffset: offset in local registered address space to/from * which to copy * @len: length of range to copy * @roffset: offset in remote registered address space to/from * which to copy * @addr: user virtual address to/from which to copy * @flags: flags * * This structure is used for SCIF_READFROM, SCIF_WRITETO, SCIF_VREADFROM * and SCIF_VREADFROM IOCTL's. */ struct scifioctl_copy { __s64 loffset; __u64 len; __s64 roffset; __u64 addr; __s32 flags; }; /** * struct scifioctl_fence_mark - used for SCIF_FENCE_MARK IOCTL * @flags: flags * @mark: fence handle which is a pointer to a __s32 */ struct scifioctl_fence_mark { __s32 flags; __u64 mark; }; /** * struct scifioctl_fence_signal - used for SCIF_FENCE_SIGNAL IOCTL * @loff: local offset * @lval: value to write to loffset * @roff: remote offset * @rval: value to write to roffset * @flags: flags */ struct scifioctl_fence_signal { __s64 loff; __u64 lval; __s64 roff; __u64 rval; __s32 flags; }; /** * struct scifioctl_node_ids - used for SCIF_GET_NODEIDS IOCTL * @nodes: pointer to an array of node_ids * @self: ID of the current node * @len: length of array */ struct scifioctl_node_ids { __u64 nodes; __u64 self; __s32 len; }; #define SCIF_BIND _IOWR('s', 1, __u64) #define SCIF_LISTEN _IOW('s', 2, __s32) #define SCIF_CONNECT _IOWR('s', 3, struct scifioctl_connect) #define SCIF_ACCEPTREQ _IOWR('s', 4, struct scifioctl_accept) #define SCIF_ACCEPTREG _IOWR('s', 5, __u64) #define SCIF_SEND _IOWR('s', 6, struct scifioctl_msg) #define SCIF_RECV _IOWR('s', 7, struct scifioctl_msg) #define SCIF_REG _IOWR('s', 8, struct scifioctl_reg) #define SCIF_UNREG _IOWR('s', 9, struct scifioctl_unreg) #define SCIF_READFROM _IOWR('s', 10, struct scifioctl_copy) #define SCIF_WRITETO _IOWR('s', 11, struct scifioctl_copy) #define SCIF_VREADFROM _IOWR('s', 12, struct scifioctl_copy) #define SCIF_VWRITETO _IOWR('s', 13, struct scifioctl_copy) #define SCIF_GET_NODEIDS _IOWR('s', 14, struct scifioctl_node_ids) #define SCIF_FENCE_MARK _IOWR('s', 15, struct scifioctl_fence_mark) #define SCIF_FENCE_WAIT _IOWR('s', 16, __s32) #define SCIF_FENCE_SIGNAL _IOWR('s', 17, struct scifioctl_fence_signal) #endif /* SCIF_IOCTL_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/magic.h���������������������������������������������������������������������������������������0000644�����������������00000006511�14763166027�0007153 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_MAGIC_H__ #define __LINUX_MAGIC_H__ #define ADFS_SUPER_MAGIC 0xadf5 #define AFFS_SUPER_MAGIC 0xadff #define AFS_SUPER_MAGIC 0x5346414F #define AUTOFS_SUPER_MAGIC 0x0187 #define CODA_SUPER_MAGIC 0x73757245 #define CRAMFS_MAGIC 0x28cd3d45 /* some random number */ #define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */ #define DEBUGFS_MAGIC 0x64626720 #define SECURITYFS_MAGIC 0x73636673 #define SELINUX_MAGIC 0xf97cff8c #define SMACK_MAGIC 0x43415d53 /* "SMAC" */ #define RAMFS_MAGIC 0x858458f6 /* some random number */ #define TMPFS_MAGIC 0x01021994 #define HUGETLBFS_MAGIC 0x958458f6 /* some random number */ #define SQUASHFS_MAGIC 0x73717368 #define ECRYPTFS_SUPER_MAGIC 0xf15f #define EFS_SUPER_MAGIC 0x414A53 #define EXT2_SUPER_MAGIC 0xEF53 #define EXT3_SUPER_MAGIC 0xEF53 #define XENFS_SUPER_MAGIC 0xabba1974 #define EXT4_SUPER_MAGIC 0xEF53 #define BTRFS_SUPER_MAGIC 0x9123683E #define NILFS_SUPER_MAGIC 0x3434 #define F2FS_SUPER_MAGIC 0xF2F52010 #define HPFS_SUPER_MAGIC 0xf995e849 #define ISOFS_SUPER_MAGIC 0x9660 #define JFFS2_SUPER_MAGIC 0x72b6 #define PSTOREFS_MAGIC 0x6165676C #define EFIVARFS_MAGIC 0xde5e81e4 #define HOSTFS_SUPER_MAGIC 0x00c0ffee #define OVERLAYFS_SUPER_MAGIC 0x794c7630 #define MINIX_SUPER_MAGIC 0x137F /* minix v1 fs, 14 char names */ #define MINIX_SUPER_MAGIC2 0x138F /* minix v1 fs, 30 char names */ #define MINIX2_SUPER_MAGIC 0x2468 /* minix v2 fs, 14 char names */ #define MINIX2_SUPER_MAGIC2 0x2478 /* minix v2 fs, 30 char names */ #define MINIX3_SUPER_MAGIC 0x4d5a /* minix v3 fs, 60 char names */ #define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ #define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ #define NFS_SUPER_MAGIC 0x6969 #define OCFS2_SUPER_MAGIC 0x7461636f #define OPENPROM_SUPER_MAGIC 0x9fa1 #define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ #define QNX6_SUPER_MAGIC 0x68191122 /* qnx6 fs detection */ #define AFS_FS_MAGIC 0x6B414653 #define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ /* used by file system utilities that look at the superblock, etc. */ #define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" #define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" #define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" #define SMB_SUPER_MAGIC 0x517B #define CGROUP_SUPER_MAGIC 0x27e0eb #define CGROUP2_SUPER_MAGIC 0x63677270 #define RDTGROUP_SUPER_MAGIC 0x7655821 #define STACK_END_MAGIC 0x57AC6E9D #define TRACEFS_MAGIC 0x74726163 #define V9FS_MAGIC 0x01021997 #define BDEVFS_MAGIC 0x62646576 #define DAXFS_MAGIC 0x64646178 #define BINFMTFS_MAGIC 0x42494e4d #define DEVPTS_SUPER_MAGIC 0x1cd1 #define FUTEXFS_SUPER_MAGIC 0xBAD1DEA #define PIPEFS_MAGIC 0x50495045 #define PROC_SUPER_MAGIC 0x9fa0 #define SOCKFS_MAGIC 0x534F434B #define SYSFS_MAGIC 0x62656572 #define USBDEVICE_SUPER_MAGIC 0x9fa2 #define MTD_INODE_FS_MAGIC 0x11307854 #define ANON_INODE_FS_MAGIC 0x09041934 #define BTRFS_TEST_MAGIC 0x73727279 #define NSFS_MAGIC 0x6e736673 #define BPF_FS_MAGIC 0xcafe4a11 #define AAFS_MAGIC 0x5a3c69f0 /* Since UDF 2.01 is ISO 13346 based... */ #define UDF_SUPER_MAGIC 0x15013346 #define BALLOON_KVM_MAGIC 0x13661366 #define ZSMALLOC_MAGIC 0x58295829 #endif /* __LINUX_MAGIC_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/auto_fs4.h������������������������������������������������������������������������������������0000644�����������������00000000703�14763166027�0007614 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org> * * This file is part of the Linux kernel and is made available under * the terms of the GNU General Public License, version 2, or at your * option, any later version, incorporated herein by reference. */ #ifndef _LINUX_AUTO_FS4_H #define _LINUX_AUTO_FS4_H #include <linux/auto_fs.h> #endif /* _LINUX_AUTO_FS4_H */ �������������������������������������������������������������linux/bpqether.h������������������������������������������������������������������������������������0000644�����������������00000001725�14763166027�0007707 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __BPQETHER_H #define __BPQETHER_H /* * Defines for the BPQETHER pseudo device driver */ #include <linux/if_ether.h> #define SIOCSBPQETHOPT (SIOCDEVPRIVATE+0) /* reserved */ #define SIOCSBPQETHADDR (SIOCDEVPRIVATE+1) struct bpq_ethaddr { unsigned char destination[ETH_ALEN]; unsigned char accept[ETH_ALEN]; }; /* * For SIOCSBPQETHOPT - this is compatible with PI2/PacketTwin card drivers, * currently not implemented, though. If someone wants to hook a radio * to his Ethernet card he may find this useful. ;-) */ #define SIOCGBPQETHPARAM 0x5000 /* get Level 1 parameters */ #define SIOCSBPQETHPARAM 0x5001 /* set */ struct bpq_req { int cmd; int speed; /* unused */ int clockmode; /* unused */ int txdelay; unsigned char persist; /* unused */ int slotime; /* unused */ int squeldelay; int dmachan; /* unused */ int irq; /* unused */ }; #endif �������������������������������������������linux/coff.h����������������������������������������������������������������������������������������0000644�����������������00000030274�14763166027�0007013 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* This file is derived from the GAS 2.1.4 assembler control file. The GAS product is under the GNU General Public License, version 2 or later. As such, this file is also under that license. If the file format changes in the COFF object, this file should be subsequently updated to reflect the changes. The actual loader module only uses a few of these structures. The full set is documented here because I received the full set. If you wish more information about COFF, then O'Reilly has a very excellent book. */ #define E_SYMNMLEN 8 /* Number of characters in a symbol name */ #define E_FILNMLEN 14 /* Number of characters in a file name */ #define E_DIMNUM 4 /* Number of array dimensions in auxiliary entry */ /* * These defines are byte order independent. There is no alignment of fields * permitted in the structures. Therefore they are declared as characters * and the values loaded from the character positions. It also makes it * nice to have it "endian" independent. */ /* Load a short int from the following tables with little-endian formats */ #define COFF_SHORT_L(ps) ((short)(((unsigned short)((unsigned char)ps[1])<<8)|\ ((unsigned short)((unsigned char)ps[0])))) /* Load a long int from the following tables with little-endian formats */ #define COFF_LONG_L(ps) (((long)(((unsigned long)((unsigned char)ps[3])<<24) |\ ((unsigned long)((unsigned char)ps[2])<<16) |\ ((unsigned long)((unsigned char)ps[1])<<8) |\ ((unsigned long)((unsigned char)ps[0]))))) /* Load a short int from the following tables with big-endian formats */ #define COFF_SHORT_H(ps) ((short)(((unsigned short)((unsigned char)ps[0])<<8)|\ ((unsigned short)((unsigned char)ps[1])))) /* Load a long int from the following tables with big-endian formats */ #define COFF_LONG_H(ps) (((long)(((unsigned long)((unsigned char)ps[0])<<24) |\ ((unsigned long)((unsigned char)ps[1])<<16) |\ ((unsigned long)((unsigned char)ps[2])<<8) |\ ((unsigned long)((unsigned char)ps[3]))))) /* These may be overridden later by brain dead implementations which generate a big-endian header with little-endian data. In that case, generate a replacement macro which tests a flag and uses either of the two above as appropriate. */ #define COFF_LONG(v) COFF_LONG_L(v) #define COFF_SHORT(v) COFF_SHORT_L(v) /*** coff information for Intel 386/486. */ /********************** FILE HEADER **********************/ struct COFF_filehdr { char f_magic[2]; /* magic number */ char f_nscns[2]; /* number of sections */ char f_timdat[4]; /* time & date stamp */ char f_symptr[4]; /* file pointer to symtab */ char f_nsyms[4]; /* number of symtab entries */ char f_opthdr[2]; /* sizeof(optional hdr) */ char f_flags[2]; /* flags */ }; /* * Bits for f_flags: * * F_RELFLG relocation info stripped from file * F_EXEC file is executable (i.e. no unresolved external * references) * F_LNNO line numbers stripped from file * F_LSYMS local symbols stripped from file * F_MINMAL this is a minimal object file (".m") output of fextract * F_UPDATE this is a fully bound update file, output of ogen * F_SWABD this file has had its bytes swabbed (in names) * F_AR16WR this file has the byte ordering of an AR16WR * (e.g. 11/70) machine * F_AR32WR this file has the byte ordering of an AR32WR machine * (e.g. vax and iNTEL 386) * F_AR32W this file has the byte ordering of an AR32W machine * (e.g. 3b,maxi) * F_PATCH file contains "patch" list in optional header * F_NODF (minimal file only) no decision functions for * replaced functions */ #define COFF_F_RELFLG 0000001 #define COFF_F_EXEC 0000002 #define COFF_F_LNNO 0000004 #define COFF_F_LSYMS 0000010 #define COFF_F_MINMAL 0000020 #define COFF_F_UPDATE 0000040 #define COFF_F_SWABD 0000100 #define COFF_F_AR16WR 0000200 #define COFF_F_AR32WR 0000400 #define COFF_F_AR32W 0001000 #define COFF_F_PATCH 0002000 #define COFF_F_NODF 0002000 #define COFF_I386MAGIC 0x14c /* Linux's system */ #if 0 /* Perhaps, someday, these formats may be used. */ #define COFF_I386PTXMAGIC 0x154 #define COFF_I386AIXMAGIC 0x175 /* IBM's AIX system */ #define COFF_I386BADMAG(x) ((COFF_SHORT((x).f_magic) != COFF_I386MAGIC) \ && COFF_SHORT((x).f_magic) != COFF_I386PTXMAGIC \ && COFF_SHORT((x).f_magic) != COFF_I386AIXMAGIC) #else #define COFF_I386BADMAG(x) (COFF_SHORT((x).f_magic) != COFF_I386MAGIC) #endif #define COFF_FILHDR struct COFF_filehdr #define COFF_FILHSZ sizeof(COFF_FILHDR) /********************** AOUT "OPTIONAL HEADER" **********************/ /* Linux COFF must have this "optional" header. Standard COFF has no entry location for the "entry" point. They normally would start with the first location of the .text section. This is not a good idea for linux. So, the use of this "optional" header is not optional. It is required. Do not be tempted to assume that the size of the optional header is a constant and simply index the next byte by the size of this structure. Use the 'f_opthdr' field in the main coff header for the size of the structure actually written to the file!! */ typedef struct { char magic[2]; /* type of file */ char vstamp[2]; /* version stamp */ char tsize[4]; /* text size in bytes, padded to FW bdry */ char dsize[4]; /* initialized data " " */ char bsize[4]; /* uninitialized data " " */ char entry[4]; /* entry pt. */ char text_start[4]; /* base of text used for this file */ char data_start[4]; /* base of data used for this file */ } COFF_AOUTHDR; #define COFF_AOUTSZ (sizeof(COFF_AOUTHDR)) #define COFF_STMAGIC 0401 #define COFF_OMAGIC 0404 #define COFF_JMAGIC 0407 /* dirty text and data image, can't share */ #define COFF_DMAGIC 0410 /* dirty text segment, data aligned */ #define COFF_ZMAGIC 0413 /* The proper magic number for executables */ #define COFF_SHMAGIC 0443 /* shared library header */ /********************** SECTION HEADER **********************/ struct COFF_scnhdr { char s_name[8]; /* section name */ char s_paddr[4]; /* physical address, aliased s_nlib */ char s_vaddr[4]; /* virtual address */ char s_size[4]; /* section size */ char s_scnptr[4]; /* file ptr to raw data for section */ char s_relptr[4]; /* file ptr to relocation */ char s_lnnoptr[4]; /* file ptr to line numbers */ char s_nreloc[2]; /* number of relocation entries */ char s_nlnno[2]; /* number of line number entries */ char s_flags[4]; /* flags */ }; #define COFF_SCNHDR struct COFF_scnhdr #define COFF_SCNHSZ sizeof(COFF_SCNHDR) /* * names of "special" sections */ #define COFF_TEXT ".text" #define COFF_DATA ".data" #define COFF_BSS ".bss" #define COFF_COMMENT ".comment" #define COFF_LIB ".lib" #define COFF_SECT_TEXT 0 /* Section for instruction code */ #define COFF_SECT_DATA 1 /* Section for initialized globals */ #define COFF_SECT_BSS 2 /* Section for un-initialized globals */ #define COFF_SECT_REQD 3 /* Minimum number of sections for good file */ #define COFF_STYP_REG 0x00 /* regular segment */ #define COFF_STYP_DSECT 0x01 /* dummy segment */ #define COFF_STYP_NOLOAD 0x02 /* no-load segment */ #define COFF_STYP_GROUP 0x04 /* group segment */ #define COFF_STYP_PAD 0x08 /* .pad segment */ #define COFF_STYP_COPY 0x10 /* copy section */ #define COFF_STYP_TEXT 0x20 /* .text segment */ #define COFF_STYP_DATA 0x40 /* .data segment */ #define COFF_STYP_BSS 0x80 /* .bss segment */ #define COFF_STYP_INFO 0x200 /* .comment section */ #define COFF_STYP_OVER 0x400 /* overlay section */ #define COFF_STYP_LIB 0x800 /* library section */ /* * Shared libraries have the following section header in the data field for * each library. */ struct COFF_slib { char sl_entsz[4]; /* Size of this entry */ char sl_pathndx[4]; /* size of the header field */ }; #define COFF_SLIBHD struct COFF_slib #define COFF_SLIBSZ sizeof(COFF_SLIBHD) /********************** LINE NUMBERS **********************/ /* 1 line number entry for every "breakpointable" source line in a section. * Line numbers are grouped on a per function basis; first entry in a function * grouping will have l_lnno = 0 and in place of physical address will be the * symbol table index of the function name. */ struct COFF_lineno { union { char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ char l_paddr[4]; /* (physical) address of line number */ } l_addr; char l_lnno[2]; /* line number */ }; #define COFF_LINENO struct COFF_lineno #define COFF_LINESZ 6 /********************** SYMBOLS **********************/ #define COFF_E_SYMNMLEN 8 /* # characters in a short symbol name */ #define COFF_E_FILNMLEN 14 /* # characters in a file name */ #define COFF_E_DIMNUM 4 /* # array dimensions in auxiliary entry */ /* * All symbols and sections have the following definition */ struct COFF_syment { union { char e_name[E_SYMNMLEN]; /* Symbol name (first 8 characters) */ struct { char e_zeroes[4]; /* Leading zeros */ char e_offset[4]; /* Offset if this is a header section */ } e; } e; char e_value[4]; /* Value (address) of the segment */ char e_scnum[2]; /* Section number */ char e_type[2]; /* Type of section */ char e_sclass[1]; /* Loader class */ char e_numaux[1]; /* Number of auxiliary entries which follow */ }; #define COFF_N_BTMASK (0xf) /* Mask for important class bits */ #define COFF_N_TMASK (0x30) /* Mask for important type bits */ #define COFF_N_BTSHFT (4) /* # bits to shift class field */ #define COFF_N_TSHIFT (2) /* # bits to shift type field */ /* * Auxiliary entries because the main table is too limiting. */ union COFF_auxent { /* * Debugger information */ struct { char x_tagndx[4]; /* str, un, or enum tag indx */ union { struct { char x_lnno[2]; /* declaration line number */ char x_size[2]; /* str/union/array size */ } x_lnsz; char x_fsize[4]; /* size of function */ } x_misc; union { struct { /* if ISFCN, tag, or .bb */ char x_lnnoptr[4]; /* ptr to fcn line # */ char x_endndx[4]; /* entry ndx past block end */ } x_fcn; struct { /* if ISARY, up to 4 dimen. */ char x_dimen[E_DIMNUM][2]; } x_ary; } x_fcnary; char x_tvndx[2]; /* tv index */ } x_sym; /* * Source file names (debugger information) */ union { char x_fname[E_FILNMLEN]; struct { char x_zeroes[4]; char x_offset[4]; } x_n; } x_file; /* * Section information */ struct { char x_scnlen[4]; /* section length */ char x_nreloc[2]; /* # relocation entries */ char x_nlinno[2]; /* # line numbers */ } x_scn; /* * Transfer vector (branch table) */ struct { char x_tvfill[4]; /* tv fill value */ char x_tvlen[2]; /* length of .tv */ char x_tvran[2][2]; /* tv range */ } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ }; #define COFF_SYMENT struct COFF_syment #define COFF_SYMESZ 18 #define COFF_AUXENT union COFF_auxent #define COFF_AUXESZ 18 #define COFF_ETEXT "etext" /********************** RELOCATION DIRECTIVES **********************/ struct COFF_reloc { char r_vaddr[4]; /* Virtual address of item */ char r_symndx[4]; /* Symbol index in the symtab */ char r_type[2]; /* Relocation type */ }; #define COFF_RELOC struct COFF_reloc #define COFF_RELSZ 10 #define COFF_DEF_DATA_SECTION_ALIGNMENT 4 #define COFF_DEF_BSS_SECTION_ALIGNMENT 4 #define COFF_DEF_TEXT_SECTION_ALIGNMENT 4 /* For new sections we haven't heard of before */ #define COFF_DEF_SECTION_ALIGNMENT 4 ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/elf-em.h��������������������������������������������������������������������������������������0000644�����������������00000004213�14763166027�0007235 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_ELF_EM_H #define _LINUX_ELF_EM_H /* These constants define the various ELF target machines */ #define EM_NONE 0 #define EM_M32 1 #define EM_SPARC 2 #define EM_386 3 #define EM_68K 4 #define EM_88K 5 #define EM_486 6 /* Perhaps disused */ #define EM_860 7 #define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */ /* Next two are historical and binaries and modules of these types will be rejected by Linux. */ #define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ #define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */ #define EM_PARISC 15 /* HPPA */ #define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ #define EM_PPC 20 /* PowerPC */ #define EM_PPC64 21 /* PowerPC64 */ #define EM_SPU 23 /* Cell BE SPU */ #define EM_ARM 40 /* ARM 32 bit */ #define EM_SH 42 /* SuperH */ #define EM_SPARCV9 43 /* SPARC v9 64-bit */ #define EM_H8_300 46 /* Renesas H8/300 */ #define EM_IA_64 50 /* HP/Intel IA-64 */ #define EM_X86_64 62 /* AMD x86-64 */ #define EM_S390 22 /* IBM S/390 */ #define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ #define EM_M32R 88 /* Renesas M32R */ #define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ #define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ #define EM_BLACKFIN 106 /* ADI Blackfin Processor */ #define EM_ALTERA_NIOS2 113 /* Altera Nios II soft-core processor */ #define EM_TI_C6000 140 /* TI C6X DSPs */ #define EM_AARCH64 183 /* ARM 64 bit */ #define EM_TILEPRO 188 /* Tilera TILEPro */ #define EM_MICROBLAZE 189 /* Xilinx MicroBlaze */ #define EM_TILEGX 191 /* Tilera TILE-Gx */ #define EM_BPF 247 /* Linux BPF - in-kernel virtual machine */ #define EM_FRV 0x5441 /* Fujitsu FR-V */ /* * This is an interim value that we will use until the committee comes * up with a final number. */ #define EM_ALPHA 0x9026 /* Bogus old m32r magic number, used by old tools. */ #define EM_CYGNUS_M32R 0x9041 /* This is the old interim value for S/390 architecture */ #define EM_S390_OLD 0xA390 /* Also Panasonic/MEI MN10300, AM33 */ #define EM_CYGNUS_MN10300 0xbeef #endif /* _LINUX_ELF_EM_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/hw_breakpoint.h�������������������������������������������������������������������������������0000644�����������������00000001346�14763166027�0010730 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_HW_BREAKPOINT_H #define _LINUX_HW_BREAKPOINT_H enum { HW_BREAKPOINT_LEN_1 = 1, HW_BREAKPOINT_LEN_2 = 2, HW_BREAKPOINT_LEN_3 = 3, HW_BREAKPOINT_LEN_4 = 4, HW_BREAKPOINT_LEN_5 = 5, HW_BREAKPOINT_LEN_6 = 6, HW_BREAKPOINT_LEN_7 = 7, HW_BREAKPOINT_LEN_8 = 8, }; enum { HW_BREAKPOINT_EMPTY = 0, HW_BREAKPOINT_R = 1, HW_BREAKPOINT_W = 2, HW_BREAKPOINT_RW = HW_BREAKPOINT_R | HW_BREAKPOINT_W, HW_BREAKPOINT_X = 4, HW_BREAKPOINT_INVALID = HW_BREAKPOINT_RW | HW_BREAKPOINT_X, }; enum bp_type_idx { TYPE_INST = 0, #ifdef CONFIG_HAVE_MIXED_BREAKPOINTS_REGS TYPE_DATA = 0, #else TYPE_DATA = 1, #endif TYPE_MAX }; #endif /* _LINUX_HW_BREAKPOINT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/hid.h�����������������������������������������������������������������������������������������0000644�����������������00000003555�14763166027�0006644 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 1999 Andreas Gal * Copyright (c) 2000-2001 Vojtech Pavlik * Copyright (c) 2006-2007 Jiri Kosina */ /* * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic */ #ifndef __HID_H #define __HID_H /* * USB HID (Human Interface Device) interface class code */ #define USB_INTERFACE_CLASS_HID 3 /* * USB HID interface subclass and protocol codes */ #define USB_INTERFACE_SUBCLASS_BOOT 1 #define USB_INTERFACE_PROTOCOL_KEYBOARD 1 #define USB_INTERFACE_PROTOCOL_MOUSE 2 /* * HID class requests */ #define HID_REQ_GET_REPORT 0x01 #define HID_REQ_GET_IDLE 0x02 #define HID_REQ_GET_PROTOCOL 0x03 #define HID_REQ_SET_REPORT 0x09 #define HID_REQ_SET_IDLE 0x0A #define HID_REQ_SET_PROTOCOL 0x0B /* * HID class descriptor types */ #define HID_DT_HID (USB_TYPE_CLASS | 0x01) #define HID_DT_REPORT (USB_TYPE_CLASS | 0x02) #define HID_DT_PHYSICAL (USB_TYPE_CLASS | 0x03) #define HID_MAX_DESCRIPTOR_SIZE 4096 #endif /* __HID_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������linux/reiserfs_xattr.h������������������������������������������������������������������������������0000644�����������������00000001025�14763166027�0011132 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* File: linux/reiserfs_xattr.h */ #ifndef _LINUX_REISERFS_XATTR_H #define _LINUX_REISERFS_XATTR_H #include <linux/types.h> /* Magic value in header */ #define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */ struct reiserfs_xattr_header { __le32 h_magic; /* magic number for identification */ __le32 h_hash; /* hash of the value */ }; struct reiserfs_security_handle { const char *name; void *value; size_t length; }; #endif /* _LINUX_REISERFS_XATTR_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/membarrier.h����������������������������������������������������������������������������������0000644�����������������00000017333�14763166027�0010224 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _LINUX_MEMBARRIER_H #define _LINUX_MEMBARRIER_H /* * linux/membarrier.h * * membarrier system call API * * Copyright (c) 2010, 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * enum membarrier_cmd - membarrier system call command * @MEMBARRIER_CMD_QUERY: Query the set of supported commands. It returns * a bitmask of valid commands. * @MEMBARRIER_CMD_GLOBAL: Execute a memory barrier on all running threads. * Upon return from system call, the caller thread * is ensured that all running threads have passed * through a state where all memory accesses to * user-space addresses match program order between * entry to and return from the system call * (non-running threads are de facto in such a * state). This covers threads from all processes * running on the system. This command returns 0. * @MEMBARRIER_CMD_GLOBAL_EXPEDITED: * Execute a memory barrier on all running threads * of all processes which previously registered * with MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED. * Upon return from system call, the caller thread * is ensured that all running threads have passed * through a state where all memory accesses to * user-space addresses match program order between * entry to and return from the system call * (non-running threads are de facto in such a * state). This only covers threads from processes * which registered with * MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED. * This command returns 0. Given that * registration is about the intent to receive * the barriers, it is valid to invoke * MEMBARRIER_CMD_GLOBAL_EXPEDITED from a * non-registered process. * @MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED: * Register the process intent to receive * MEMBARRIER_CMD_GLOBAL_EXPEDITED memory * barriers. Always returns 0. * @MEMBARRIER_CMD_PRIVATE_EXPEDITED: * Execute a memory barrier on each running * thread belonging to the same process as the current * thread. Upon return from system call, the * caller thread is ensured that all its running * threads siblings have passed through a state * where all memory accesses to user-space * addresses match program order between entry * to and return from the system call * (non-running threads are de facto in such a * state). This only covers threads from the * same process as the caller thread. This * command returns 0 on success. The * "expedited" commands complete faster than * the non-expedited ones, they never block, * but have the downside of causing extra * overhead. A process needs to register its * intent to use the private expedited command * prior to using it, otherwise this command * returns -EPERM. * @MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED: * Register the process intent to use * MEMBARRIER_CMD_PRIVATE_EXPEDITED. Always * returns 0. * @MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE: * In addition to provide memory ordering * guarantees described in * MEMBARRIER_CMD_PRIVATE_EXPEDITED, ensure * the caller thread, upon return from system * call, that all its running threads siblings * have executed a core serializing * instruction. (architectures are required to * guarantee that non-running threads issue * core serializing instructions before they * resume user-space execution). This only * covers threads from the same process as the * caller thread. This command returns 0 on * success. The "expedited" commands complete * faster than the non-expedited ones, they * never block, but have the downside of * causing extra overhead. If this command is * not implemented by an architecture, -EINVAL * is returned. A process needs to register its * intent to use the private expedited sync * core command prior to using it, otherwise * this command returns -EPERM. * @MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE: * Register the process intent to use * MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE. * If this command is not implemented by an * architecture, -EINVAL is returned. * Returns 0 on success. * @MEMBARRIER_CMD_SHARED: * Alias to MEMBARRIER_CMD_GLOBAL. Provided for * header backward compatibility. * * Command to be passed to the membarrier system call. The commands need to * be a single bit each, except for MEMBARRIER_CMD_QUERY which is assigned to * the value 0. */ enum membarrier_cmd { MEMBARRIER_CMD_QUERY = 0, MEMBARRIER_CMD_GLOBAL = (1 << 0), MEMBARRIER_CMD_GLOBAL_EXPEDITED = (1 << 1), MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED = (1 << 2), MEMBARRIER_CMD_PRIVATE_EXPEDITED = (1 << 3), MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED = (1 << 4), MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE = (1 << 5), MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE = (1 << 6), /* Alias for header backward compatibility. */ MEMBARRIER_CMD_SHARED = MEMBARRIER_CMD_GLOBAL, }; #endif /* _LINUX_MEMBARRIER_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_hippi.h������������������������������������������������������������������������������������0000644�����������������00000010213�14763166027�0007654 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Global definitions for the HIPPI interface. * * Version: @(#)if_hippi.h 1.0.0 05/26/97 * * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Donald Becker, <becker@super.org> * Alan Cox, <alan@lxorguk.ukuu.org.uk> * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> * Jes Sorensen, <Jes.Sorensen@cern.ch> * * 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. */ #ifndef _LINUX_IF_HIPPI_H #define _LINUX_IF_HIPPI_H #include <linux/types.h> #include <asm/byteorder.h> /* * HIPPI magic constants. */ #define HIPPI_ALEN 6 /* Bytes in one HIPPI hw-addr */ #define HIPPI_HLEN sizeof(struct hippi_hdr) #define HIPPI_ZLEN 0 /* Min. bytes in frame without FCS */ #define HIPPI_DATA_LEN 65280 /* Max. bytes in payload */ #define HIPPI_FRAME_LEN (HIPPI_DATA_LEN + HIPPI_HLEN) /* Max. bytes in frame without FCS */ /* * Define LLC and SNAP constants. */ #define HIPPI_EXTENDED_SAP 0xAA #define HIPPI_UI_CMD 0x03 /* * Do we need to list some sort of ID's here? */ /* * HIPPI statistics collection data. */ struct hipnet_statistics { int rx_packets; /* total packets received */ int tx_packets; /* total packets transmitted */ int rx_errors; /* bad packets received */ int tx_errors; /* packet transmit problems */ int rx_dropped; /* no space in linux buffers */ int tx_dropped; /* no space available in linux */ /* detailed rx_errors: */ int rx_length_errors; int rx_over_errors; /* receiver ring buff overflow */ int rx_crc_errors; /* recved pkt with crc error */ int rx_frame_errors; /* recv'd frame alignment error */ int rx_fifo_errors; /* recv'r fifo overrun */ int rx_missed_errors; /* receiver missed packet */ /* detailed tx_errors */ int tx_aborted_errors; int tx_carrier_errors; int tx_fifo_errors; int tx_heartbeat_errors; int tx_window_errors; }; struct hippi_fp_hdr { #if 0 __u8 ulp; /* must contain 4 */ #if defined (__BIG_ENDIAN_BITFIELD) __u8 d1_data_present:1; /* must be 1 */ __u8 start_d2_burst_boundary:1; /* must be zero */ __u8 reserved:6; /* must be zero */ #if 0 __u16 reserved1:5; __u16 d1_area_size:8; /* must be 3 */ __u16 d2_offset:3; /* must be zero */ #endif #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 reserved:6; /* must be zero */ __u8 start_d2_burst_boundary:1; /* must be zero */ __u8 d1_data_present:1; /* must be 1 */ #if 0 __u16 d2_offset:3; /* must be zero */ __u16 d1_area_size:8; /* must be 3 */ __u16 reserved1:5; /* must be zero */ #endif #else #error "Please fix <asm/byteorder.h>" #endif #else __be32 fixed; #endif __be32 d2_size; } __attribute__((packed)); struct hippi_le_hdr { #if defined (__BIG_ENDIAN_BITFIELD) __u8 fc:3; __u8 double_wide:1; __u8 message_type:4; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 message_type:4; __u8 double_wide:1; __u8 fc:3; #endif __u8 dest_switch_addr[3]; #if defined (__BIG_ENDIAN_BITFIELD) __u8 dest_addr_type:4, src_addr_type:4; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 src_addr_type:4, dest_addr_type:4; #endif __u8 src_switch_addr[3]; __u16 reserved; __u8 daddr[HIPPI_ALEN]; __u16 locally_administered; __u8 saddr[HIPPI_ALEN]; } __attribute__((packed)); #define HIPPI_OUI_LEN 3 /* * Looks like the dsap and ssap fields have been swapped by mistake in * RFC 2067 "IP over HIPPI". */ struct hippi_snap_hdr { __u8 dsap; /* always 0xAA */ __u8 ssap; /* always 0xAA */ __u8 ctrl; /* always 0x03 */ __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/ __be16 ethertype; /* packet type ID field */ } __attribute__((packed)); struct hippi_hdr { struct hippi_fp_hdr fp; struct hippi_le_hdr le; struct hippi_snap_hdr snap; } __attribute__((packed)); #endif /* _LINUX_IF_HIPPI_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/virtio_vsock.h��������������������������������������������������������������������������������0000644�����������������00000006016�14763166027�0010614 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so * anyone can use the definitions to implement compatible drivers/servers: * * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Copyright (C) Red Hat, Inc., 2013-2015 * Copyright (C) Asias He <asias@redhat.com>, 2013 * Copyright (C) Stefan Hajnoczi <stefanha@redhat.com>, 2015 */ #ifndef _LINUX_VIRTIO_VSOCK_H #define _LINUX_VIRTIO_VSOCK_H #include <linux/types.h> #include <linux/virtio_ids.h> #include <linux/virtio_config.h> struct virtio_vsock_config { __le64 guest_cid; } __attribute__((packed)); enum virtio_vsock_event_id { VIRTIO_VSOCK_EVENT_TRANSPORT_RESET = 0, }; struct virtio_vsock_event { __le32 id; } __attribute__((packed)); struct virtio_vsock_hdr { __le64 src_cid; __le64 dst_cid; __le32 src_port; __le32 dst_port; __le32 len; __le16 type; /* enum virtio_vsock_type */ __le16 op; /* enum virtio_vsock_op */ __le32 flags; __le32 buf_alloc; __le32 fwd_cnt; } __attribute__((packed)); enum virtio_vsock_type { VIRTIO_VSOCK_TYPE_STREAM = 1, }; enum virtio_vsock_op { VIRTIO_VSOCK_OP_INVALID = 0, /* Connect operations */ VIRTIO_VSOCK_OP_REQUEST = 1, VIRTIO_VSOCK_OP_RESPONSE = 2, VIRTIO_VSOCK_OP_RST = 3, VIRTIO_VSOCK_OP_SHUTDOWN = 4, /* To send payload */ VIRTIO_VSOCK_OP_RW = 5, /* Tell the peer our credit info */ VIRTIO_VSOCK_OP_CREDIT_UPDATE = 6, /* Request the peer to send the credit info to us */ VIRTIO_VSOCK_OP_CREDIT_REQUEST = 7, }; /* VIRTIO_VSOCK_OP_SHUTDOWN flags values */ enum virtio_vsock_shutdown { VIRTIO_VSOCK_SHUTDOWN_RCV = 1, VIRTIO_VSOCK_SHUTDOWN_SEND = 2, }; #endif /* _LINUX_VIRTIO_VSOCK_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/bpf_common.h����������������������������������������������������������������������������������0000644�����������������00000002527�14763166027�0010215 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BPF_COMMON_H__ #define __LINUX_BPF_COMMON_H__ /* Instruction classes */ #define BPF_CLASS(code) ((code) & 0x07) #define BPF_LD 0x00 #define BPF_LDX 0x01 #define BPF_ST 0x02 #define BPF_STX 0x03 #define BPF_ALU 0x04 #define BPF_JMP 0x05 #define BPF_RET 0x06 #define BPF_MISC 0x07 /* ld/ldx fields */ #define BPF_SIZE(code) ((code) & 0x18) #define BPF_W 0x00 /* 32-bit */ #define BPF_H 0x08 /* 16-bit */ #define BPF_B 0x10 /* 8-bit */ /* eBPF BPF_DW 0x18 64-bit */ #define BPF_MODE(code) ((code) & 0xe0) #define BPF_IMM 0x00 #define BPF_ABS 0x20 #define BPF_IND 0x40 #define BPF_MEM 0x60 #define BPF_LEN 0x80 #define BPF_MSH 0xa0 /* alu/jmp fields */ #define BPF_OP(code) ((code) & 0xf0) #define BPF_ADD 0x00 #define BPF_SUB 0x10 #define BPF_MUL 0x20 #define BPF_DIV 0x30 #define BPF_OR 0x40 #define BPF_AND 0x50 #define BPF_LSH 0x60 #define BPF_RSH 0x70 #define BPF_NEG 0x80 #define BPF_MOD 0x90 #define BPF_XOR 0xa0 #define BPF_JA 0x00 #define BPF_JEQ 0x10 #define BPF_JGT 0x20 #define BPF_JGE 0x30 #define BPF_JSET 0x40 #define BPF_SRC(code) ((code) & 0x08) #define BPF_K 0x00 #define BPF_X 0x08 #ifndef BPF_MAXINSNS #define BPF_MAXINSNS 4096 #endif #endif /* __LINUX_BPF_COMMON_H__ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_link.h�������������������������������������������������������������������������������������0000644�����������������00000055027�14763166027�0007514 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_IF_LINK_H #define _LINUX_IF_LINK_H #include <linux/types.h> #include <linux/netlink.h> /* This struct should be in sync with struct rtnl_link_stats64 */ struct rtnl_link_stats { __u32 rx_packets; /* total packets received */ __u32 tx_packets; /* total packets transmitted */ __u32 rx_bytes; /* total bytes received */ __u32 tx_bytes; /* total bytes transmitted */ __u32 rx_errors; /* bad packets received */ __u32 tx_errors; /* packet transmit problems */ __u32 rx_dropped; /* no space in linux buffers */ __u32 tx_dropped; /* no space available in linux */ __u32 multicast; /* multicast packets received */ __u32 collisions; /* detailed rx_errors: */ __u32 rx_length_errors; __u32 rx_over_errors; /* receiver ring buff overflow */ __u32 rx_crc_errors; /* recved pkt with crc error */ __u32 rx_frame_errors; /* recv'd frame alignment error */ __u32 rx_fifo_errors; /* recv'r fifo overrun */ __u32 rx_missed_errors; /* receiver missed packet */ /* detailed tx_errors */ __u32 tx_aborted_errors; __u32 tx_carrier_errors; __u32 tx_fifo_errors; __u32 tx_heartbeat_errors; __u32 tx_window_errors; /* for cslip etc */ __u32 rx_compressed; __u32 tx_compressed; __u32 rx_nohandler; /* dropped, no handler found */ }; /* The main device statistics structure */ struct rtnl_link_stats64 { __u64 rx_packets; /* total packets received */ __u64 tx_packets; /* total packets transmitted */ __u64 rx_bytes; /* total bytes received */ __u64 tx_bytes; /* total bytes transmitted */ __u64 rx_errors; /* bad packets received */ __u64 tx_errors; /* packet transmit problems */ __u64 rx_dropped; /* no space in linux buffers */ __u64 tx_dropped; /* no space available in linux */ __u64 multicast; /* multicast packets received */ __u64 collisions; /* detailed rx_errors: */ __u64 rx_length_errors; __u64 rx_over_errors; /* receiver ring buff overflow */ __u64 rx_crc_errors; /* recved pkt with crc error */ __u64 rx_frame_errors; /* recv'd frame alignment error */ __u64 rx_fifo_errors; /* recv'r fifo overrun */ __u64 rx_missed_errors; /* receiver missed packet */ /* detailed tx_errors */ __u64 tx_aborted_errors; __u64 tx_carrier_errors; __u64 tx_fifo_errors; __u64 tx_heartbeat_errors; __u64 tx_window_errors; /* for cslip etc */ __u64 rx_compressed; __u64 tx_compressed; __u64 rx_nohandler; /* dropped, no handler found */ }; /* The struct should be in sync with struct ifmap */ struct rtnl_link_ifmap { __u64 mem_start; __u64 mem_end; __u64 base_addr; __u16 irq; __u8 dma; __u8 port; }; /* * IFLA_AF_SPEC * Contains nested attributes for address family specific attributes. * Each address family may create a attribute with the address family * number as type and create its own attribute structure in it. * * Example: * [IFLA_AF_SPEC] = { * [AF_INET] = { * [IFLA_INET_CONF] = ..., * }, * [AF_INET6] = { * [IFLA_INET6_FLAGS] = ..., * [IFLA_INET6_CONF] = ..., * } * } */ enum { IFLA_UNSPEC, IFLA_ADDRESS, IFLA_BROADCAST, IFLA_IFNAME, IFLA_MTU, IFLA_LINK, IFLA_QDISC, IFLA_STATS, IFLA_COST, #define IFLA_COST IFLA_COST IFLA_PRIORITY, #define IFLA_PRIORITY IFLA_PRIORITY IFLA_MASTER, #define IFLA_MASTER IFLA_MASTER IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */ #define IFLA_WIRELESS IFLA_WIRELESS IFLA_PROTINFO, /* Protocol specific information for a link */ #define IFLA_PROTINFO IFLA_PROTINFO IFLA_TXQLEN, #define IFLA_TXQLEN IFLA_TXQLEN IFLA_MAP, #define IFLA_MAP IFLA_MAP IFLA_WEIGHT, #define IFLA_WEIGHT IFLA_WEIGHT IFLA_OPERSTATE, IFLA_LINKMODE, IFLA_LINKINFO, #define IFLA_LINKINFO IFLA_LINKINFO IFLA_NET_NS_PID, IFLA_IFALIAS, IFLA_NUM_VF, /* Number of VFs if device is SR-IOV PF */ IFLA_VFINFO_LIST, IFLA_STATS64, IFLA_VF_PORTS, IFLA_PORT_SELF, IFLA_AF_SPEC, IFLA_GROUP, /* Group the device belongs to */ IFLA_NET_NS_FD, IFLA_EXT_MASK, /* Extended info mask, VFs, etc */ IFLA_PROMISCUITY, /* Promiscuity count: > 0 means acts PROMISC */ #define IFLA_PROMISCUITY IFLA_PROMISCUITY IFLA_NUM_TX_QUEUES, IFLA_NUM_RX_QUEUES, IFLA_CARRIER, IFLA_PHYS_PORT_ID, IFLA_CARRIER_CHANGES, IFLA_PHYS_SWITCH_ID, IFLA_LINK_NETNSID, IFLA_PHYS_PORT_NAME, IFLA_PROTO_DOWN, IFLA_GSO_MAX_SEGS, IFLA_GSO_MAX_SIZE, IFLA_PAD, IFLA_XDP, IFLA_EVENT, IFLA_NEW_NETNSID, IFLA_IF_NETNSID, IFLA_CARRIER_UP_COUNT, IFLA_CARRIER_DOWN_COUNT, IFLA_NEW_IFINDEX, IFLA_MIN_MTU, IFLA_MAX_MTU, __IFLA_MAX }; #define IFLA_MAX (__IFLA_MAX - 1) /* backwards compatibility for userspace */ #define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg)))) #define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg)) enum { IFLA_INET_UNSPEC, IFLA_INET_CONF, __IFLA_INET_MAX, }; #define IFLA_INET_MAX (__IFLA_INET_MAX - 1) /* ifi_flags. IFF_* flags. The only change is: IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are more not changeable by user. They describe link media characteristics and set by device driver. Comments: - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid - If neither of these three flags are set; the interface is NBMA. - IFF_MULTICAST does not mean anything special: multicasts can be used on all not-NBMA links. IFF_MULTICAST means that this media uses special encapsulation for multicast frames. Apparently, all IFF_POINTOPOINT and IFF_BROADCAST devices are able to use multicasts too. */ /* IFLA_LINK. For usual devices it is equal ifi_index. If it is a "virtual interface" (f.e. tunnel), ifi_link can point to real physical interface (f.e. for bandwidth calculations), or maybe 0, what means, that real media is unknown (usual for IPIP tunnels, when route to endpoint is allowed to change) */ /* Subtype attributes for IFLA_PROTINFO */ enum { IFLA_INET6_UNSPEC, IFLA_INET6_FLAGS, /* link flags */ IFLA_INET6_CONF, /* sysctl parameters */ IFLA_INET6_STATS, /* statistics */ IFLA_INET6_MCAST, /* MC things. What of them? */ IFLA_INET6_CACHEINFO, /* time values and max reasm size */ IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */ IFLA_INET6_TOKEN, /* device token */ IFLA_INET6_ADDR_GEN_MODE, /* implicit address generator mode */ __IFLA_INET6_MAX }; #define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1) enum in6_addr_gen_mode { IN6_ADDR_GEN_MODE_EUI64, IN6_ADDR_GEN_MODE_NONE, IN6_ADDR_GEN_MODE_STABLE_PRIVACY, IN6_ADDR_GEN_MODE_RANDOM, }; /* Bridge section */ enum { IFLA_BR_UNSPEC, IFLA_BR_FORWARD_DELAY, IFLA_BR_HELLO_TIME, IFLA_BR_MAX_AGE, IFLA_BR_AGEING_TIME, IFLA_BR_STP_STATE, IFLA_BR_PRIORITY, IFLA_BR_VLAN_FILTERING, IFLA_BR_VLAN_PROTOCOL, IFLA_BR_GROUP_FWD_MASK, IFLA_BR_ROOT_ID, IFLA_BR_BRIDGE_ID, IFLA_BR_ROOT_PORT, IFLA_BR_ROOT_PATH_COST, IFLA_BR_TOPOLOGY_CHANGE, IFLA_BR_TOPOLOGY_CHANGE_DETECTED, IFLA_BR_HELLO_TIMER, IFLA_BR_TCN_TIMER, IFLA_BR_TOPOLOGY_CHANGE_TIMER, IFLA_BR_GC_TIMER, IFLA_BR_GROUP_ADDR, IFLA_BR_FDB_FLUSH, IFLA_BR_MCAST_ROUTER, IFLA_BR_MCAST_SNOOPING, IFLA_BR_MCAST_QUERY_USE_IFADDR, IFLA_BR_MCAST_QUERIER, IFLA_BR_MCAST_HASH_ELASTICITY, IFLA_BR_MCAST_HASH_MAX, IFLA_BR_MCAST_LAST_MEMBER_CNT, IFLA_BR_MCAST_STARTUP_QUERY_CNT, IFLA_BR_MCAST_LAST_MEMBER_INTVL, IFLA_BR_MCAST_MEMBERSHIP_INTVL, IFLA_BR_MCAST_QUERIER_INTVL, IFLA_BR_MCAST_QUERY_INTVL, IFLA_BR_MCAST_QUERY_RESPONSE_INTVL, IFLA_BR_MCAST_STARTUP_QUERY_INTVL, IFLA_BR_NF_CALL_IPTABLES, IFLA_BR_NF_CALL_IP6TABLES, IFLA_BR_NF_CALL_ARPTABLES, IFLA_BR_VLAN_DEFAULT_PVID, IFLA_BR_PAD, IFLA_BR_VLAN_STATS_ENABLED, IFLA_BR_MCAST_STATS_ENABLED, IFLA_BR_MCAST_IGMP_VERSION, IFLA_BR_MCAST_MLD_VERSION, __IFLA_BR_MAX, }; #define IFLA_BR_MAX (__IFLA_BR_MAX - 1) struct ifla_bridge_id { __u8 prio[2]; __u8 addr[6]; /* ETH_ALEN */ }; enum { BRIDGE_MODE_UNSPEC, BRIDGE_MODE_HAIRPIN, }; enum { IFLA_BRPORT_UNSPEC, IFLA_BRPORT_STATE, /* Spanning tree state */ IFLA_BRPORT_PRIORITY, /* " priority */ IFLA_BRPORT_COST, /* " cost */ IFLA_BRPORT_MODE, /* mode (hairpin) */ IFLA_BRPORT_GUARD, /* bpdu guard */ IFLA_BRPORT_PROTECT, /* root port protection */ IFLA_BRPORT_FAST_LEAVE, /* multicast fast leave */ IFLA_BRPORT_LEARNING, /* mac learning */ IFLA_BRPORT_UNICAST_FLOOD, /* flood unicast traffic */ IFLA_BRPORT_PROXYARP, /* proxy ARP */ IFLA_BRPORT_LEARNING_SYNC, /* mac learning sync from device */ IFLA_BRPORT_PROXYARP_WIFI, /* proxy ARP for Wi-Fi */ IFLA_BRPORT_ROOT_ID, /* designated root */ IFLA_BRPORT_BRIDGE_ID, /* designated bridge */ IFLA_BRPORT_DESIGNATED_PORT, IFLA_BRPORT_DESIGNATED_COST, IFLA_BRPORT_ID, IFLA_BRPORT_NO, IFLA_BRPORT_TOPOLOGY_CHANGE_ACK, IFLA_BRPORT_CONFIG_PENDING, IFLA_BRPORT_MESSAGE_AGE_TIMER, IFLA_BRPORT_FORWARD_DELAY_TIMER, IFLA_BRPORT_HOLD_TIMER, IFLA_BRPORT_FLUSH, IFLA_BRPORT_MULTICAST_ROUTER, IFLA_BRPORT_PAD, IFLA_BRPORT_MCAST_FLOOD, IFLA_BRPORT_MCAST_TO_UCAST, IFLA_BRPORT_VLAN_TUNNEL, IFLA_BRPORT_BCAST_FLOOD, IFLA_BRPORT_GROUP_FWD_MASK, IFLA_BRPORT_NEIGH_SUPPRESS, IFLA_BRPORT_ISOLATED, IFLA_BRPORT_BACKUP_PORT, __IFLA_BRPORT_MAX }; #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) struct ifla_cacheinfo { __u32 max_reasm_len; __u32 tstamp; /* ipv6InterfaceTable updated timestamp */ __u32 reachable_time; __u32 retrans_time; }; enum { IFLA_INFO_UNSPEC, IFLA_INFO_KIND, IFLA_INFO_DATA, IFLA_INFO_XSTATS, IFLA_INFO_SLAVE_KIND, IFLA_INFO_SLAVE_DATA, __IFLA_INFO_MAX, }; #define IFLA_INFO_MAX (__IFLA_INFO_MAX - 1) /* VLAN section */ enum { IFLA_VLAN_UNSPEC, IFLA_VLAN_ID, IFLA_VLAN_FLAGS, IFLA_VLAN_EGRESS_QOS, IFLA_VLAN_INGRESS_QOS, IFLA_VLAN_PROTOCOL, __IFLA_VLAN_MAX, }; #define IFLA_VLAN_MAX (__IFLA_VLAN_MAX - 1) struct ifla_vlan_flags { __u32 flags; __u32 mask; }; enum { IFLA_VLAN_QOS_UNSPEC, IFLA_VLAN_QOS_MAPPING, __IFLA_VLAN_QOS_MAX }; #define IFLA_VLAN_QOS_MAX (__IFLA_VLAN_QOS_MAX - 1) struct ifla_vlan_qos_mapping { __u32 from; __u32 to; }; /* MACVLAN section */ enum { IFLA_MACVLAN_UNSPEC, IFLA_MACVLAN_MODE, IFLA_MACVLAN_FLAGS, IFLA_MACVLAN_MACADDR_MODE, IFLA_MACVLAN_MACADDR, IFLA_MACVLAN_MACADDR_DATA, IFLA_MACVLAN_MACADDR_COUNT, __IFLA_MACVLAN_MAX, }; #define IFLA_MACVLAN_MAX (__IFLA_MACVLAN_MAX - 1) enum macvlan_mode { MACVLAN_MODE_PRIVATE = 1, /* don't talk to other macvlans */ MACVLAN_MODE_VEPA = 2, /* talk to other ports through ext bridge */ MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */ MACVLAN_MODE_PASSTHRU = 8,/* take over the underlying device */ MACVLAN_MODE_SOURCE = 16,/* use source MAC address list to assign */ }; enum macvlan_macaddr_mode { MACVLAN_MACADDR_ADD, MACVLAN_MACADDR_DEL, MACVLAN_MACADDR_FLUSH, MACVLAN_MACADDR_SET, }; #define MACVLAN_FLAG_NOPROMISC 1 /* VRF section */ enum { IFLA_VRF_UNSPEC, IFLA_VRF_TABLE, __IFLA_VRF_MAX }; #define IFLA_VRF_MAX (__IFLA_VRF_MAX - 1) enum { IFLA_VRF_PORT_UNSPEC, IFLA_VRF_PORT_TABLE, __IFLA_VRF_PORT_MAX }; #define IFLA_VRF_PORT_MAX (__IFLA_VRF_PORT_MAX - 1) /* MACSEC section */ enum { IFLA_MACSEC_UNSPEC, IFLA_MACSEC_SCI, IFLA_MACSEC_PORT, IFLA_MACSEC_ICV_LEN, IFLA_MACSEC_CIPHER_SUITE, IFLA_MACSEC_WINDOW, IFLA_MACSEC_ENCODING_SA, IFLA_MACSEC_ENCRYPT, IFLA_MACSEC_PROTECT, IFLA_MACSEC_INC_SCI, IFLA_MACSEC_ES, IFLA_MACSEC_SCB, IFLA_MACSEC_REPLAY_PROTECT, IFLA_MACSEC_VALIDATION, IFLA_MACSEC_PAD, __IFLA_MACSEC_MAX, }; #define IFLA_MACSEC_MAX (__IFLA_MACSEC_MAX - 1) /* XFRM section */ enum { IFLA_XFRM_UNSPEC, IFLA_XFRM_LINK, IFLA_XFRM_IF_ID, __IFLA_XFRM_MAX }; #define IFLA_XFRM_MAX (__IFLA_XFRM_MAX - 1) enum macsec_validation_type { MACSEC_VALIDATE_DISABLED = 0, MACSEC_VALIDATE_CHECK = 1, MACSEC_VALIDATE_STRICT = 2, __MACSEC_VALIDATE_END, MACSEC_VALIDATE_MAX = __MACSEC_VALIDATE_END - 1, }; /* IPVLAN section */ enum { IFLA_IPVLAN_UNSPEC, IFLA_IPVLAN_MODE, IFLA_IPVLAN_FLAGS, __IFLA_IPVLAN_MAX }; #define IFLA_IPVLAN_MAX (__IFLA_IPVLAN_MAX - 1) enum ipvlan_mode { IPVLAN_MODE_L2 = 0, IPVLAN_MODE_L3, IPVLAN_MODE_L3S, IPVLAN_MODE_MAX }; #define IPVLAN_F_PRIVATE 0x01 #define IPVLAN_F_VEPA 0x02 /* VXLAN section */ enum { IFLA_VXLAN_UNSPEC, IFLA_VXLAN_ID, IFLA_VXLAN_GROUP, /* group or remote address */ IFLA_VXLAN_LINK, IFLA_VXLAN_LOCAL, IFLA_VXLAN_TTL, IFLA_VXLAN_TOS, IFLA_VXLAN_LEARNING, IFLA_VXLAN_AGEING, IFLA_VXLAN_LIMIT, IFLA_VXLAN_PORT_RANGE, /* source port */ IFLA_VXLAN_PROXY, IFLA_VXLAN_RSC, IFLA_VXLAN_L2MISS, IFLA_VXLAN_L3MISS, IFLA_VXLAN_PORT, /* destination port */ IFLA_VXLAN_GROUP6, IFLA_VXLAN_LOCAL6, IFLA_VXLAN_UDP_CSUM, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, IFLA_VXLAN_REMCSUM_TX, IFLA_VXLAN_REMCSUM_RX, IFLA_VXLAN_GBP, IFLA_VXLAN_REMCSUM_NOPARTIAL, IFLA_VXLAN_COLLECT_METADATA, IFLA_VXLAN_LABEL, IFLA_VXLAN_GPE, IFLA_VXLAN_TTL_INHERIT, __IFLA_VXLAN_MAX }; #define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1) struct ifla_vxlan_port_range { __be16 low; __be16 high; }; /* GENEVE section */ enum { IFLA_GENEVE_UNSPEC, IFLA_GENEVE_ID, IFLA_GENEVE_REMOTE, IFLA_GENEVE_TTL, IFLA_GENEVE_TOS, IFLA_GENEVE_PORT, /* destination port */ IFLA_GENEVE_COLLECT_METADATA, IFLA_GENEVE_REMOTE6, IFLA_GENEVE_UDP_CSUM, IFLA_GENEVE_UDP_ZERO_CSUM6_TX, IFLA_GENEVE_UDP_ZERO_CSUM6_RX, IFLA_GENEVE_LABEL, __IFLA_GENEVE_MAX }; #define IFLA_GENEVE_MAX (__IFLA_GENEVE_MAX - 1) /* PPP section */ enum { IFLA_PPP_UNSPEC, IFLA_PPP_DEV_FD, __IFLA_PPP_MAX }; #define IFLA_PPP_MAX (__IFLA_PPP_MAX - 1) /* GTP section */ enum ifla_gtp_role { GTP_ROLE_GGSN = 0, GTP_ROLE_SGSN, }; enum { IFLA_GTP_UNSPEC, IFLA_GTP_FD0, IFLA_GTP_FD1, IFLA_GTP_PDP_HASHSIZE, IFLA_GTP_ROLE, __IFLA_GTP_MAX, }; #define IFLA_GTP_MAX (__IFLA_GTP_MAX - 1) /* Bonding section */ enum { IFLA_BOND_UNSPEC, IFLA_BOND_MODE, IFLA_BOND_ACTIVE_SLAVE, IFLA_BOND_MIIMON, IFLA_BOND_UPDELAY, IFLA_BOND_DOWNDELAY, IFLA_BOND_USE_CARRIER, IFLA_BOND_ARP_INTERVAL, IFLA_BOND_ARP_IP_TARGET, IFLA_BOND_ARP_VALIDATE, IFLA_BOND_ARP_ALL_TARGETS, IFLA_BOND_PRIMARY, IFLA_BOND_PRIMARY_RESELECT, IFLA_BOND_FAIL_OVER_MAC, IFLA_BOND_XMIT_HASH_POLICY, IFLA_BOND_RESEND_IGMP, IFLA_BOND_NUM_PEER_NOTIF, IFLA_BOND_ALL_SLAVES_ACTIVE, IFLA_BOND_MIN_LINKS, IFLA_BOND_LP_INTERVAL, IFLA_BOND_PACKETS_PER_SLAVE, IFLA_BOND_AD_LACP_RATE, IFLA_BOND_AD_SELECT, IFLA_BOND_AD_INFO, IFLA_BOND_AD_ACTOR_SYS_PRIO, IFLA_BOND_AD_USER_PORT_KEY, IFLA_BOND_AD_ACTOR_SYSTEM, IFLA_BOND_TLB_DYNAMIC_LB, __IFLA_BOND_MAX, }; #define IFLA_BOND_MAX (__IFLA_BOND_MAX - 1) enum { IFLA_BOND_AD_INFO_UNSPEC, IFLA_BOND_AD_INFO_AGGREGATOR, IFLA_BOND_AD_INFO_NUM_PORTS, IFLA_BOND_AD_INFO_ACTOR_KEY, IFLA_BOND_AD_INFO_PARTNER_KEY, IFLA_BOND_AD_INFO_PARTNER_MAC, __IFLA_BOND_AD_INFO_MAX, }; #define IFLA_BOND_AD_INFO_MAX (__IFLA_BOND_AD_INFO_MAX - 1) enum { IFLA_BOND_SLAVE_UNSPEC, IFLA_BOND_SLAVE_STATE, IFLA_BOND_SLAVE_MII_STATUS, IFLA_BOND_SLAVE_LINK_FAILURE_COUNT, IFLA_BOND_SLAVE_PERM_HWADDR, IFLA_BOND_SLAVE_QUEUE_ID, IFLA_BOND_SLAVE_AD_AGGREGATOR_ID, IFLA_BOND_SLAVE_AD_ACTOR_OPER_PORT_STATE, IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE, __IFLA_BOND_SLAVE_MAX, }; #define IFLA_BOND_SLAVE_MAX (__IFLA_BOND_SLAVE_MAX - 1) /* SR-IOV virtual function management section */ enum { IFLA_VF_INFO_UNSPEC, IFLA_VF_INFO, __IFLA_VF_INFO_MAX, }; #define IFLA_VF_INFO_MAX (__IFLA_VF_INFO_MAX - 1) enum { IFLA_VF_UNSPEC, IFLA_VF_MAC, /* Hardware queue specific attributes */ IFLA_VF_VLAN, /* VLAN ID and QoS */ IFLA_VF_TX_RATE, /* Max TX Bandwidth Allocation */ IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */ IFLA_VF_LINK_STATE, /* link state enable/disable/auto switch */ IFLA_VF_RATE, /* Min and Max TX Bandwidth Allocation */ IFLA_VF_RSS_QUERY_EN, /* RSS Redirection Table and Hash Key query * on/off switch */ IFLA_VF_STATS, /* network device statistics */ IFLA_VF_TRUST, /* Trust VF */ IFLA_VF_IB_NODE_GUID, /* VF Infiniband node GUID */ IFLA_VF_IB_PORT_GUID, /* VF Infiniband port GUID */ IFLA_VF_VLAN_LIST, /* nested list of vlans, option for QinQ */ __IFLA_VF_MAX, }; #define IFLA_VF_MAX (__IFLA_VF_MAX - 1) struct ifla_vf_mac { __u32 vf; __u8 mac[32]; /* MAX_ADDR_LEN */ }; struct ifla_vf_vlan { __u32 vf; __u32 vlan; /* 0 - 4095, 0 disables VLAN filter */ __u32 qos; }; enum { IFLA_VF_VLAN_INFO_UNSPEC, IFLA_VF_VLAN_INFO, /* VLAN ID, QoS and VLAN protocol */ __IFLA_VF_VLAN_INFO_MAX, }; #define IFLA_VF_VLAN_INFO_MAX (__IFLA_VF_VLAN_INFO_MAX - 1) #define MAX_VLAN_LIST_LEN 1 struct ifla_vf_vlan_info { __u32 vf; __u32 vlan; /* 0 - 4095, 0 disables VLAN filter */ __u32 qos; __be16 vlan_proto; /* VLAN protocol either 802.1Q or 802.1ad */ }; struct ifla_vf_tx_rate { __u32 vf; __u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */ }; struct ifla_vf_rate { __u32 vf; __u32 min_tx_rate; /* Min Bandwidth in Mbps */ __u32 max_tx_rate; /* Max Bandwidth in Mbps */ }; struct ifla_vf_spoofchk { __u32 vf; __u32 setting; }; struct ifla_vf_guid { __u32 vf; __u64 guid; }; enum { IFLA_VF_LINK_STATE_AUTO, /* link state of the uplink */ IFLA_VF_LINK_STATE_ENABLE, /* link always up */ IFLA_VF_LINK_STATE_DISABLE, /* link always down */ __IFLA_VF_LINK_STATE_MAX, }; struct ifla_vf_link_state { __u32 vf; __u32 link_state; }; struct ifla_vf_rss_query_en { __u32 vf; __u32 setting; }; enum { IFLA_VF_STATS_RX_PACKETS, IFLA_VF_STATS_TX_PACKETS, IFLA_VF_STATS_RX_BYTES, IFLA_VF_STATS_TX_BYTES, IFLA_VF_STATS_BROADCAST, IFLA_VF_STATS_MULTICAST, IFLA_VF_STATS_PAD, IFLA_VF_STATS_RX_DROPPED, IFLA_VF_STATS_TX_DROPPED, __IFLA_VF_STATS_MAX, }; #define IFLA_VF_STATS_MAX (__IFLA_VF_STATS_MAX - 1) struct ifla_vf_trust { __u32 vf; __u32 setting; }; /* VF ports management section * * Nested layout of set/get msg is: * * [IFLA_NUM_VF] * [IFLA_VF_PORTS] * [IFLA_VF_PORT] * [IFLA_PORT_*], ... * [IFLA_VF_PORT] * [IFLA_PORT_*], ... * ... * [IFLA_PORT_SELF] * [IFLA_PORT_*], ... */ enum { IFLA_VF_PORT_UNSPEC, IFLA_VF_PORT, /* nest */ __IFLA_VF_PORT_MAX, }; #define IFLA_VF_PORT_MAX (__IFLA_VF_PORT_MAX - 1) enum { IFLA_PORT_UNSPEC, IFLA_PORT_VF, /* __u32 */ IFLA_PORT_PROFILE, /* string */ IFLA_PORT_VSI_TYPE, /* 802.1Qbg (pre-)standard VDP */ IFLA_PORT_INSTANCE_UUID, /* binary UUID */ IFLA_PORT_HOST_UUID, /* binary UUID */ IFLA_PORT_REQUEST, /* __u8 */ IFLA_PORT_RESPONSE, /* __u16, output only */ __IFLA_PORT_MAX, }; #define IFLA_PORT_MAX (__IFLA_PORT_MAX - 1) #define PORT_PROFILE_MAX 40 #define PORT_UUID_MAX 16 #define PORT_SELF_VF -1 enum { PORT_REQUEST_PREASSOCIATE = 0, PORT_REQUEST_PREASSOCIATE_RR, PORT_REQUEST_ASSOCIATE, PORT_REQUEST_DISASSOCIATE, }; enum { PORT_VDP_RESPONSE_SUCCESS = 0, PORT_VDP_RESPONSE_INVALID_FORMAT, PORT_VDP_RESPONSE_INSUFFICIENT_RESOURCES, PORT_VDP_RESPONSE_UNUSED_VTID, PORT_VDP_RESPONSE_VTID_VIOLATION, PORT_VDP_RESPONSE_VTID_VERSION_VIOALTION, PORT_VDP_RESPONSE_OUT_OF_SYNC, /* 0x08-0xFF reserved for future VDP use */ PORT_PROFILE_RESPONSE_SUCCESS = 0x100, PORT_PROFILE_RESPONSE_INPROGRESS, PORT_PROFILE_RESPONSE_INVALID, PORT_PROFILE_RESPONSE_BADSTATE, PORT_PROFILE_RESPONSE_INSUFFICIENT_RESOURCES, PORT_PROFILE_RESPONSE_ERROR, }; struct ifla_port_vsi { __u8 vsi_mgr_id; __u8 vsi_type_id[3]; __u8 vsi_type_version; __u8 pad[3]; }; /* IPoIB section */ enum { IFLA_IPOIB_UNSPEC, IFLA_IPOIB_PKEY, IFLA_IPOIB_MODE, IFLA_IPOIB_UMCAST, __IFLA_IPOIB_MAX }; enum { IPOIB_MODE_DATAGRAM = 0, /* using unreliable datagram QPs */ IPOIB_MODE_CONNECTED = 1, /* using connected QPs */ }; #define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1) /* HSR section */ enum { IFLA_HSR_UNSPEC, IFLA_HSR_SLAVE1, IFLA_HSR_SLAVE2, IFLA_HSR_MULTICAST_SPEC, /* Last byte of supervision addr */ IFLA_HSR_SUPERVISION_ADDR, /* Supervision frame multicast addr */ IFLA_HSR_SEQ_NR, IFLA_HSR_VERSION, /* HSR version */ __IFLA_HSR_MAX, }; #define IFLA_HSR_MAX (__IFLA_HSR_MAX - 1) /* STATS section */ struct if_stats_msg { __u8 family; __u8 pad1; __u16 pad2; __u32 ifindex; __u32 filter_mask; }; /* A stats attribute can be netdev specific or a global stat. * For netdev stats, lets use the prefix IFLA_STATS_LINK_* */ enum { IFLA_STATS_UNSPEC, /* also used as 64bit pad attribute */ IFLA_STATS_LINK_64, IFLA_STATS_LINK_XSTATS, IFLA_STATS_LINK_XSTATS_SLAVE, IFLA_STATS_LINK_OFFLOAD_XSTATS, IFLA_STATS_AF_SPEC, __IFLA_STATS_MAX, }; #define IFLA_STATS_MAX (__IFLA_STATS_MAX - 1) #define IFLA_STATS_FILTER_BIT(ATTR) (1 << (ATTR - 1)) /* These are embedded into IFLA_STATS_LINK_XSTATS: * [IFLA_STATS_LINK_XSTATS] * -> [LINK_XSTATS_TYPE_xxx] * -> [rtnl link type specific attributes] */ enum { LINK_XSTATS_TYPE_UNSPEC, LINK_XSTATS_TYPE_BRIDGE, __LINK_XSTATS_TYPE_MAX }; #define LINK_XSTATS_TYPE_MAX (__LINK_XSTATS_TYPE_MAX - 1) /* These are stats embedded into IFLA_STATS_LINK_OFFLOAD_XSTATS */ enum { IFLA_OFFLOAD_XSTATS_UNSPEC, IFLA_OFFLOAD_XSTATS_CPU_HIT, /* struct rtnl_link_stats64 */ __IFLA_OFFLOAD_XSTATS_MAX }; #define IFLA_OFFLOAD_XSTATS_MAX (__IFLA_OFFLOAD_XSTATS_MAX - 1) /* XDP section */ #define XDP_FLAGS_UPDATE_IF_NOEXIST (1U << 0) #define XDP_FLAGS_SKB_MODE (1U << 1) #define XDP_FLAGS_DRV_MODE (1U << 2) #define XDP_FLAGS_HW_MODE (1U << 3) #define XDP_FLAGS_MODES (XDP_FLAGS_SKB_MODE | \ XDP_FLAGS_DRV_MODE | \ XDP_FLAGS_HW_MODE) #define XDP_FLAGS_MASK (XDP_FLAGS_UPDATE_IF_NOEXIST | \ XDP_FLAGS_MODES) /* These are stored into IFLA_XDP_ATTACHED on dump. */ enum { XDP_ATTACHED_NONE = 0, XDP_ATTACHED_DRV, XDP_ATTACHED_SKB, XDP_ATTACHED_HW, XDP_ATTACHED_MULTI, }; enum { IFLA_XDP_UNSPEC, IFLA_XDP_FD, IFLA_XDP_ATTACHED, IFLA_XDP_FLAGS, IFLA_XDP_PROG_ID, IFLA_XDP_DRV_PROG_ID, IFLA_XDP_SKB_PROG_ID, IFLA_XDP_HW_PROG_ID, __IFLA_XDP_MAX, }; #define IFLA_XDP_MAX (__IFLA_XDP_MAX - 1) enum { IFLA_EVENT_NONE, IFLA_EVENT_REBOOT, /* internal reset / reboot */ IFLA_EVENT_FEATURES, /* change in offload features */ IFLA_EVENT_BONDING_FAILOVER, /* change in active slave */ IFLA_EVENT_NOTIFY_PEERS, /* re-sent grat. arp/ndisc */ IFLA_EVENT_IGMP_RESEND, /* re-sent IGMP JOIN */ IFLA_EVENT_BONDING_OPTIONS, /* change in bonding options */ }; /* tun section */ enum { IFLA_TUN_UNSPEC, IFLA_TUN_OWNER, IFLA_TUN_GROUP, IFLA_TUN_TYPE, IFLA_TUN_PI, IFLA_TUN_VNET_HDR, IFLA_TUN_PERSIST, IFLA_TUN_MULTI_QUEUE, IFLA_TUN_NUM_QUEUES, IFLA_TUN_NUM_DISABLED_QUEUES, __IFLA_TUN_MAX, }; #define IFLA_TUN_MAX (__IFLA_TUN_MAX - 1) /* rmnet section */ #define RMNET_FLAGS_INGRESS_DEAGGREGATION (1U << 0) #define RMNET_FLAGS_INGRESS_MAP_COMMANDS (1U << 1) #define RMNET_FLAGS_INGRESS_MAP_CKSUMV4 (1U << 2) #define RMNET_FLAGS_EGRESS_MAP_CKSUMV4 (1U << 3) enum { IFLA_RMNET_UNSPEC, IFLA_RMNET_MUX_ID, IFLA_RMNET_FLAGS, __IFLA_RMNET_MAX, }; #define IFLA_RMNET_MAX (__IFLA_RMNET_MAX - 1) struct ifla_rmnet_flags { __u32 flags; __u32 mask; }; #endif /* _LINUX_IF_LINK_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/coda_psdev.h����������������������������������������������������������������������������������0000644�����������������00000000550�14763166027�0010177 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __CODA_PSDEV_H #define __CODA_PSDEV_H #include <linux/magic.h> #define CODA_PSDEV_MAJOR 67 #define MAX_CODADEVS 5 /* how many do we allow */ #define CODA_REQ_ASYNC 0x1 #define CODA_REQ_READ 0x2 #define CODA_REQ_WRITE 0x4 #define CODA_REQ_ABORT 0x8 #endif /* __CODA_PSDEV_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������linux/wimax.h���������������������������������������������������������������������������������������0000644�����������������00000020263�14763166027�0007220 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Linux WiMax * API for user space * * * Copyright (C) 2007-2008 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name of Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * Intel Corporation <linux-wimax@intel.com> * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> * - Initial implementation * * * This file declares the user/kernel protocol that is spoken over * Generic Netlink, as well as any type declaration that is to be used * by kernel and user space. * * It is intended for user space to clone it verbatim to use it as a * primary reference for definitions. * * Stuff intended for kernel usage as well as full protocol and stack * documentation is rooted in include/net/wimax.h. */ #ifndef __LINUX__WIMAX_H__ #define __LINUX__WIMAX_H__ #include <linux/types.h> enum { /** * Version of the interface (unsigned decimal, MMm, max 25.5) * M - Major: change if removing or modifying an existing call. * m - minor: change when adding a new call */ WIMAX_GNL_VERSION = 01, /* Generic NetLink attributes */ WIMAX_GNL_ATTR_INVALID = 0x00, WIMAX_GNL_ATTR_MAX = 10, }; /* * Generic NetLink operations * * Most of these map to an API call; _OP_ stands for operation, _RP_ * for reply and _RE_ for report (aka: signal). */ enum { WIMAX_GNL_OP_MSG_FROM_USER, /* User to kernel message */ WIMAX_GNL_OP_MSG_TO_USER, /* Kernel to user message */ WIMAX_GNL_OP_RFKILL, /* Run wimax_rfkill() */ WIMAX_GNL_OP_RESET, /* Run wimax_rfkill() */ WIMAX_GNL_RE_STATE_CHANGE, /* Report: status change */ WIMAX_GNL_OP_STATE_GET, /* Request for current state */ }; /* Message from user / to user */ enum { WIMAX_GNL_MSG_IFIDX = 1, WIMAX_GNL_MSG_PIPE_NAME, WIMAX_GNL_MSG_DATA, }; /* * wimax_rfkill() * * The state of the radio (ON/OFF) is mapped to the rfkill subsystem's * switch state (DISABLED/ENABLED). */ enum wimax_rf_state { WIMAX_RF_OFF = 0, /* Radio is off, rfkill on/enabled */ WIMAX_RF_ON = 1, /* Radio is on, rfkill off/disabled */ WIMAX_RF_QUERY = 2, }; /* Attributes */ enum { WIMAX_GNL_RFKILL_IFIDX = 1, WIMAX_GNL_RFKILL_STATE, }; /* Attributes for wimax_reset() */ enum { WIMAX_GNL_RESET_IFIDX = 1, }; /* Attributes for wimax_state_get() */ enum { WIMAX_GNL_STGET_IFIDX = 1, }; /* * Attributes for the Report State Change * * For now we just have the old and new states; new attributes might * be added later on. */ enum { WIMAX_GNL_STCH_IFIDX = 1, WIMAX_GNL_STCH_STATE_OLD, WIMAX_GNL_STCH_STATE_NEW, }; /** * enum wimax_st - The different states of a WiMAX device * @__WIMAX_ST_NULL: The device structure has been allocated and zeroed, * but still wimax_dev_add() hasn't been called. There is no state. * * @WIMAX_ST_DOWN: The device has been registered with the WiMAX and * networking stacks, but it is not initialized (normally that is * done with 'ifconfig DEV up' [or equivalent], which can upload * firmware and enable communications with the device). * In this state, the device is powered down and using as less * power as possible. * This state is the default after a call to wimax_dev_add(). It * is ok to have drivers move directly to %WIMAX_ST_UNINITIALIZED * or %WIMAX_ST_RADIO_OFF in _probe() after the call to * wimax_dev_add(). * It is recommended that the driver leaves this state when * calling 'ifconfig DEV up' and enters it back on 'ifconfig DEV * down'. * * @__WIMAX_ST_QUIESCING: The device is being torn down, so no API * operations are allowed to proceed except the ones needed to * complete the device clean up process. * * @WIMAX_ST_UNINITIALIZED: [optional] Communication with the device * is setup, but the device still requires some configuration * before being operational. * Some WiMAX API calls might work. * * @WIMAX_ST_RADIO_OFF: The device is fully up; radio is off (wether * by hardware or software switches). * It is recommended to always leave the device in this state * after initialization. * * @WIMAX_ST_READY: The device is fully up and radio is on. * * @WIMAX_ST_SCANNING: [optional] The device has been instructed to * scan. In this state, the device cannot be actively connected to * a network. * * @WIMAX_ST_CONNECTING: The device is connecting to a network. This * state exists because in some devices, the connect process can * include a number of negotiations between user space, kernel * space and the device. User space needs to know what the device * is doing. If the connect sequence in a device is atomic and * fast, the device can transition directly to CONNECTED * * @WIMAX_ST_CONNECTED: The device is connected to a network. * * @__WIMAX_ST_INVALID: This is an invalid state used to mark the * maximum numeric value of states. * * Description: * * Transitions from one state to another one are atomic and can only * be caused in kernel space with wimax_state_change(). To read the * state, use wimax_state_get(). * * States starting with __ are internal and shall not be used or * referred to by drivers or userspace. They look ugly, but that's the * point -- if any use is made non-internal to the stack, it is easier * to catch on review. * * All API operations [with well defined exceptions] will take the * device mutex before starting and then check the state. If the state * is %__WIMAX_ST_NULL, %WIMAX_ST_DOWN, %WIMAX_ST_UNINITIALIZED or * %__WIMAX_ST_QUIESCING, it will drop the lock and quit with * -%EINVAL, -%ENOMEDIUM, -%ENOTCONN or -%ESHUTDOWN. * * The order of the definitions is important, so we can do numerical * comparisons (eg: < %WIMAX_ST_RADIO_OFF means the device is not ready * to operate). */ /* * The allowed state transitions are described in the table below * (states in rows can go to states in columns where there is an X): * * UNINI RADIO READY SCAN CONNEC CONNEC * NULL DOWN QUIESCING TIALIZED OFF NING TING TED * NULL - x * DOWN - x x x * QUIESCING x - * UNINITIALIZED x - x * RADIO_OFF x - x * READY x x - x x x * SCANNING x x x - x x * CONNECTING x x x x - x * CONNECTED x x x - * * This table not available in kernel-doc because the formatting messes it up. */ enum wimax_st { __WIMAX_ST_NULL = 0, WIMAX_ST_DOWN, __WIMAX_ST_QUIESCING, WIMAX_ST_UNINITIALIZED, WIMAX_ST_RADIO_OFF, WIMAX_ST_READY, WIMAX_ST_SCANNING, WIMAX_ST_CONNECTING, WIMAX_ST_CONNECTED, __WIMAX_ST_INVALID /* Always keep last */ }; #endif /* #ifndef __LINUX__WIMAX_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/posix_types.h���������������������������������������������������������������������������������0000644�����������������00000002112�14763166027�0010452 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_POSIX_TYPES_H #define _LINUX_POSIX_TYPES_H #include <linux/stddef.h> /* * This allows for 1024 file descriptors: if NR_OPEN is ever grown * beyond that you'll have to change this too. But 1024 fd's seem to be * enough even for such "real" unices like OSF/1, so hopefully this is * one limit that doesn't have to be changed [again]. * * Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in * <sys/time.h> (and thus <linux/time.h>) - but this is a more logical * place for them. Solved by having dummy defines in <sys/time.h>. */ /* * This macro may have been defined in <gnu/types.h>. But we always * use the one here. */ #undef __FD_SETSIZE #define __FD_SETSIZE 1024 typedef struct { unsigned long fds_bits[__FD_SETSIZE / (8 * sizeof(long))]; } __kernel_fd_set; /* Type of a signal handler. */ typedef void (*__kernel_sighandler_t)(int); /* Type of a SYSV IPC key. */ typedef int __kernel_key_t; typedef int __kernel_mqd_t; #include <asm/posix_types.h> #endif /* _LINUX_POSIX_TYPES_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/pg.h������������������������������������������������������������������������������������������0000644�����������������00000004452�14763166027�0006503 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* pg.h (c) 1998 Grant R. Guenther <grant@torque.net> Under the terms of the GNU General Public License pg.h defines the user interface to the generic ATAPI packet command driver for parallel port ATAPI devices (pg). The driver is loosely modelled after the generic SCSI driver, sg, although the actual interface is different. The pg driver provides a simple character device interface for sending ATAPI commands to a device. With the exception of the ATAPI reset operation, all operations are performed by a pair of read and write operations to the appropriate /dev/pgN device. A write operation delivers a command and any outbound data in a single buffer. Normally, the write will succeed unless the device is offline or malfunctioning, or there is already another command pending. If the write succeeds, it should be followed immediately by a read operation, to obtain any returned data and status information. A read will fail if there is no operation in progress. As a special case, the device can be reset with a write operation, and in this case, no following read is expected, or permitted. There are no ioctl() operations. Any single operation may transfer at most PG_MAX_DATA bytes. Note that the driver must copy the data through an internal buffer. In keeping with all current ATAPI devices, command packets are assumed to be exactly 12 bytes in length. To permit future changes to this interface, the headers in the read and write buffers contain a single character "magic" flag. Currently this flag must be the character "P". */ #define PG_MAGIC 'P' #define PG_RESET 'Z' #define PG_COMMAND 'C' #define PG_MAX_DATA 32768 struct pg_write_hdr { char magic; /* == PG_MAGIC */ char func; /* PG_RESET or PG_COMMAND */ int dlen; /* number of bytes expected to transfer */ int timeout; /* number of seconds before timeout */ char packet[12]; /* packet command */ }; struct pg_read_hdr { char magic; /* == PG_MAGIC */ char scsi; /* "scsi" status == sense key */ int dlen; /* size of device transfer request */ int duration; /* time in seconds command took */ char pad[12]; /* not used */ }; /* end of pg.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/genwqe/genwqe_card.h��������������������������������������������������������������������������0000644�����������������00000042612�14763166027�0011642 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __GENWQE_CARD_H__ #define __GENWQE_CARD_H__ /** * IBM Accelerator Family 'GenWQE' * * (C) Copyright IBM Corp. 2013 * * Author: Frank Haverkamp <haver@linux.vnet.ibm.com> * Author: Joerg-Stephan Vogt <jsvogt@de.ibm.com> * Author: Michael Jung <mijung@gmx.net> * Author: Michael Ruettger <michael@ibmra.de> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License (version 2 only) * as published by the Free Software Foundation. * * 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. */ /* * User-space API for the GenWQE card. For debugging and test purposes * the register addresses are included here too. */ #include <linux/types.h> #include <linux/ioctl.h> /* Basename of sysfs, debugfs and /dev interfaces */ #define GENWQE_DEVNAME "genwqe" #define GENWQE_TYPE_ALTERA_230 0x00 /* GenWQE4 Stratix-IV-230 */ #define GENWQE_TYPE_ALTERA_530 0x01 /* GenWQE4 Stratix-IV-530 */ #define GENWQE_TYPE_ALTERA_A4 0x02 /* GenWQE5 A4 Stratix-V-A4 */ #define GENWQE_TYPE_ALTERA_A7 0x03 /* GenWQE5 A7 Stratix-V-A7 */ /* MMIO Unit offsets: Each UnitID occupies a defined address range */ #define GENWQE_UID_OFFS(uid) ((uid) << 24) #define GENWQE_SLU_OFFS GENWQE_UID_OFFS(0) #define GENWQE_HSU_OFFS GENWQE_UID_OFFS(1) #define GENWQE_APP_OFFS GENWQE_UID_OFFS(2) #define GENWQE_MAX_UNITS 3 /* Common offsets per UnitID */ #define IO_EXTENDED_ERROR_POINTER 0x00000048 #define IO_ERROR_INJECT_SELECTOR 0x00000060 #define IO_EXTENDED_DIAG_SELECTOR 0x00000070 #define IO_EXTENDED_DIAG_READ_MBX 0x00000078 #define IO_EXTENDED_DIAG_MAP(ring) (0x00000500 | ((ring) << 3)) #define GENWQE_EXTENDED_DIAG_SELECTOR(ring, trace) (((ring) << 8) | (trace)) /* UnitID 0: Service Layer Unit (SLU) */ /* SLU: Unit Configuration Register */ #define IO_SLU_UNITCFG 0x00000000 #define IO_SLU_UNITCFG_TYPE_MASK 0x000000000ff00000 /* 27:20 */ /* SLU: Fault Isolation Register (FIR) (ac_slu_fir) */ #define IO_SLU_FIR 0x00000008 /* read only, wr direct */ #define IO_SLU_FIR_CLR 0x00000010 /* read and clear */ /* SLU: First Error Capture Register (FEC/WOF) */ #define IO_SLU_FEC 0x00000018 #define IO_SLU_ERR_ACT_MASK 0x00000020 #define IO_SLU_ERR_ATTN_MASK 0x00000028 #define IO_SLU_FIRX1_ACT_MASK 0x00000030 #define IO_SLU_FIRX0_ACT_MASK 0x00000038 #define IO_SLU_SEC_LEM_DEBUG_OVR 0x00000040 #define IO_SLU_EXTENDED_ERR_PTR 0x00000048 #define IO_SLU_COMMON_CONFIG 0x00000060 #define IO_SLU_FLASH_FIR 0x00000108 #define IO_SLU_SLC_FIR 0x00000110 #define IO_SLU_RIU_TRAP 0x00000280 #define IO_SLU_FLASH_FEC 0x00000308 #define IO_SLU_SLC_FEC 0x00000310 /* * The Virtual Function's Access is from offset 0x00010000 * The Physical Function's Access is from offset 0x00050000 * Single Shared Registers exists only at offset 0x00060000 * * SLC: Queue Virtual Window Window for accessing into a specific VF * queue. When accessing the 0x10000 space using the 0x50000 address * segment, the value indicated here is used to specify which VF * register is decoded. This register, and the 0x50000 register space * can only be accessed by the PF. Example, if this register is set to * 0x2, then a read from 0x50000 is the same as a read from 0x10000 * from VF=2. */ /* SLC: Queue Segment */ #define IO_SLC_QUEUE_SEGMENT 0x00010000 #define IO_SLC_VF_QUEUE_SEGMENT 0x00050000 /* SLC: Queue Offset */ #define IO_SLC_QUEUE_OFFSET 0x00010008 #define IO_SLC_VF_QUEUE_OFFSET 0x00050008 /* SLC: Queue Configuration */ #define IO_SLC_QUEUE_CONFIG 0x00010010 #define IO_SLC_VF_QUEUE_CONFIG 0x00050010 /* SLC: Job Timout/Only accessible for the PF */ #define IO_SLC_APPJOB_TIMEOUT 0x00010018 #define IO_SLC_VF_APPJOB_TIMEOUT 0x00050018 #define TIMEOUT_250MS 0x0000000f #define HEARTBEAT_DISABLE 0x0000ff00 /* SLC: Queue InitSequence Register */ #define IO_SLC_QUEUE_INITSQN 0x00010020 #define IO_SLC_VF_QUEUE_INITSQN 0x00050020 /* SLC: Queue Wrap */ #define IO_SLC_QUEUE_WRAP 0x00010028 #define IO_SLC_VF_QUEUE_WRAP 0x00050028 /* SLC: Queue Status */ #define IO_SLC_QUEUE_STATUS 0x00010100 #define IO_SLC_VF_QUEUE_STATUS 0x00050100 /* SLC: Queue Working Time */ #define IO_SLC_QUEUE_WTIME 0x00010030 #define IO_SLC_VF_QUEUE_WTIME 0x00050030 /* SLC: Queue Error Counts */ #define IO_SLC_QUEUE_ERRCNTS 0x00010038 #define IO_SLC_VF_QUEUE_ERRCNTS 0x00050038 /* SLC: Queue Loast Response Word */ #define IO_SLC_QUEUE_LRW 0x00010040 #define IO_SLC_VF_QUEUE_LRW 0x00050040 /* SLC: Freerunning Timer */ #define IO_SLC_FREE_RUNNING_TIMER 0x00010108 #define IO_SLC_VF_FREE_RUNNING_TIMER 0x00050108 /* SLC: Queue Virtual Access Region */ #define IO_PF_SLC_VIRTUAL_REGION 0x00050000 /* SLC: Queue Virtual Window */ #define IO_PF_SLC_VIRTUAL_WINDOW 0x00060000 /* SLC: DDCB Application Job Pending [n] (n=0:63) */ #define IO_PF_SLC_JOBPEND(n) (0x00061000 + 8*(n)) #define IO_SLC_JOBPEND(n) IO_PF_SLC_JOBPEND(n) /* SLC: Parser Trap RAM [n] (n=0:31) */ #define IO_SLU_SLC_PARSE_TRAP(n) (0x00011000 + 8*(n)) /* SLC: Dispatcher Trap RAM [n] (n=0:31) */ #define IO_SLU_SLC_DISP_TRAP(n) (0x00011200 + 8*(n)) /* Global Fault Isolation Register (GFIR) */ #define IO_SLC_CFGREG_GFIR 0x00020000 #define GFIR_ERR_TRIGGER 0x0000ffff /* SLU: Soft Reset Register */ #define IO_SLC_CFGREG_SOFTRESET 0x00020018 /* SLU: Misc Debug Register */ #define IO_SLC_MISC_DEBUG 0x00020060 #define IO_SLC_MISC_DEBUG_CLR 0x00020068 #define IO_SLC_MISC_DEBUG_SET 0x00020070 /* Temperature Sensor Reading */ #define IO_SLU_TEMPERATURE_SENSOR 0x00030000 #define IO_SLU_TEMPERATURE_CONFIG 0x00030008 /* Voltage Margining Control */ #define IO_SLU_VOLTAGE_CONTROL 0x00030080 #define IO_SLU_VOLTAGE_NOMINAL 0x00000000 #define IO_SLU_VOLTAGE_DOWN5 0x00000006 #define IO_SLU_VOLTAGE_UP5 0x00000007 /* Direct LED Control Register */ #define IO_SLU_LEDCONTROL 0x00030100 /* SLU: Flashbus Direct Access -A5 */ #define IO_SLU_FLASH_DIRECTACCESS 0x00040010 /* SLU: Flashbus Direct Access2 -A5 */ #define IO_SLU_FLASH_DIRECTACCESS2 0x00040020 /* SLU: Flashbus Command Interface -A5 */ #define IO_SLU_FLASH_CMDINTF 0x00040030 /* SLU: BitStream Loaded */ #define IO_SLU_BITSTREAM 0x00040040 /* This Register has a switch which will change the CAs to UR */ #define IO_HSU_ERR_BEHAVIOR 0x01001010 #define IO_SLC2_SQB_TRAP 0x00062000 #define IO_SLC2_QUEUE_MANAGER_TRAP 0x00062008 #define IO_SLC2_FLS_MASTER_TRAP 0x00062010 /* UnitID 1: HSU Registers */ #define IO_HSU_UNITCFG 0x01000000 #define IO_HSU_FIR 0x01000008 #define IO_HSU_FIR_CLR 0x01000010 #define IO_HSU_FEC 0x01000018 #define IO_HSU_ERR_ACT_MASK 0x01000020 #define IO_HSU_ERR_ATTN_MASK 0x01000028 #define IO_HSU_FIRX1_ACT_MASK 0x01000030 #define IO_HSU_FIRX0_ACT_MASK 0x01000038 #define IO_HSU_SEC_LEM_DEBUG_OVR 0x01000040 #define IO_HSU_EXTENDED_ERR_PTR 0x01000048 #define IO_HSU_COMMON_CONFIG 0x01000060 /* UnitID 2: Application Unit (APP) */ #define IO_APP_UNITCFG 0x02000000 #define IO_APP_FIR 0x02000008 #define IO_APP_FIR_CLR 0x02000010 #define IO_APP_FEC 0x02000018 #define IO_APP_ERR_ACT_MASK 0x02000020 #define IO_APP_ERR_ATTN_MASK 0x02000028 #define IO_APP_FIRX1_ACT_MASK 0x02000030 #define IO_APP_FIRX0_ACT_MASK 0x02000038 #define IO_APP_SEC_LEM_DEBUG_OVR 0x02000040 #define IO_APP_EXTENDED_ERR_PTR 0x02000048 #define IO_APP_COMMON_CONFIG 0x02000060 #define IO_APP_DEBUG_REG_01 0x02010000 #define IO_APP_DEBUG_REG_02 0x02010008 #define IO_APP_DEBUG_REG_03 0x02010010 #define IO_APP_DEBUG_REG_04 0x02010018 #define IO_APP_DEBUG_REG_05 0x02010020 #define IO_APP_DEBUG_REG_06 0x02010028 #define IO_APP_DEBUG_REG_07 0x02010030 #define IO_APP_DEBUG_REG_08 0x02010038 #define IO_APP_DEBUG_REG_09 0x02010040 #define IO_APP_DEBUG_REG_10 0x02010048 #define IO_APP_DEBUG_REG_11 0x02010050 #define IO_APP_DEBUG_REG_12 0x02010058 #define IO_APP_DEBUG_REG_13 0x02010060 #define IO_APP_DEBUG_REG_14 0x02010068 #define IO_APP_DEBUG_REG_15 0x02010070 #define IO_APP_DEBUG_REG_16 0x02010078 #define IO_APP_DEBUG_REG_17 0x02010080 #define IO_APP_DEBUG_REG_18 0x02010088 /* Read/write from/to registers */ struct genwqe_reg_io { __u64 num; /* register offset/address */ __u64 val64; }; /* * All registers of our card will return values not equal this values. * If we see IO_ILLEGAL_VALUE on any of our MMIO register reads, the * card can be considered as unusable. It will need recovery. */ #define IO_ILLEGAL_VALUE 0xffffffffffffffffull /* * Generic DDCB execution interface. * * This interface is a first prototype resulting from discussions we * had with other teams which wanted to use the Genwqe card. It allows * to issue a DDCB request in a generic way. The request will block * until it finishes or time out with error. * * Some DDCBs require DMA addresses to be specified in the ASIV * block. The interface provies the capability to let the kernel * driver know where those addresses are by specifying the ATS field, * such that it can replace the user-space addresses with appropriate * DMA addresses or DMA addresses of a scatter gather list which is * dynamically created. * * Our hardware will refuse DDCB execution if the ATS field is not as * expected. That means the DDCB execution engine in the chip knows * where it expects DMA addresses within the ASIV part of the DDCB and * will check that against the ATS field definition. Any invalid or * unknown ATS content will lead to DDCB refusal. */ /* Genwqe chip Units */ #define DDCB_ACFUNC_SLU 0x00 /* chip service layer unit */ #define DDCB_ACFUNC_APP 0x01 /* chip application */ /* DDCB return codes (RETC) */ #define DDCB_RETC_IDLE 0x0000 /* Unexecuted/DDCB created */ #define DDCB_RETC_PENDING 0x0101 /* Pending Execution */ #define DDCB_RETC_COMPLETE 0x0102 /* Cmd complete. No error */ #define DDCB_RETC_FAULT 0x0104 /* App Err, recoverable */ #define DDCB_RETC_ERROR 0x0108 /* App Err, non-recoverable */ #define DDCB_RETC_FORCED_ERROR 0x01ff /* overwritten by driver */ #define DDCB_RETC_UNEXEC 0x0110 /* Unexe/Removed from queue */ #define DDCB_RETC_TERM 0x0120 /* Terminated */ #define DDCB_RETC_RES0 0x0140 /* Reserved */ #define DDCB_RETC_RES1 0x0180 /* Reserved */ /* DDCB Command Options (CMDOPT) */ #define DDCB_OPT_ECHO_FORCE_NO 0x0000 /* ECHO DDCB */ #define DDCB_OPT_ECHO_FORCE_102 0x0001 /* force return code */ #define DDCB_OPT_ECHO_FORCE_104 0x0002 #define DDCB_OPT_ECHO_FORCE_108 0x0003 #define DDCB_OPT_ECHO_FORCE_110 0x0004 /* only on PF ! */ #define DDCB_OPT_ECHO_FORCE_120 0x0005 #define DDCB_OPT_ECHO_FORCE_140 0x0006 #define DDCB_OPT_ECHO_FORCE_180 0x0007 #define DDCB_OPT_ECHO_COPY_NONE (0 << 5) #define DDCB_OPT_ECHO_COPY_ALL (1 << 5) /* Definitions of Service Layer Commands */ #define SLCMD_ECHO_SYNC 0x00 /* PF/VF */ #define SLCMD_MOVE_FLASH 0x06 /* PF only */ #define SLCMD_MOVE_FLASH_FLAGS_MODE 0x03 /* bit 0 and 1 used for mode */ #define SLCMD_MOVE_FLASH_FLAGS_DLOAD 0 /* mode: download */ #define SLCMD_MOVE_FLASH_FLAGS_EMUL 1 /* mode: emulation */ #define SLCMD_MOVE_FLASH_FLAGS_UPLOAD 2 /* mode: upload */ #define SLCMD_MOVE_FLASH_FLAGS_VERIFY 3 /* mode: verify */ #define SLCMD_MOVE_FLASH_FLAG_NOTAP (1 << 2)/* just dump DDCB and exit */ #define SLCMD_MOVE_FLASH_FLAG_POLL (1 << 3)/* wait for RETC >= 0102 */ #define SLCMD_MOVE_FLASH_FLAG_PARTITION (1 << 4) #define SLCMD_MOVE_FLASH_FLAG_ERASE (1 << 5) enum genwqe_card_state { GENWQE_CARD_UNUSED = 0, GENWQE_CARD_USED = 1, GENWQE_CARD_FATAL_ERROR = 2, GENWQE_CARD_RELOAD_BITSTREAM = 3, GENWQE_CARD_STATE_MAX, }; /* common struct for chip image exchange */ struct genwqe_bitstream { __u64 data_addr; /* pointer to image data */ __u32 size; /* size of image file */ __u32 crc; /* crc of this image */ __u64 target_addr; /* starting address in Flash */ __u32 partition; /* '0', '1', or 'v' */ __u32 uid; /* 1=host/x=dram */ __u64 slu_id; /* informational/sim: SluID */ __u64 app_id; /* informational/sim: AppID */ __u16 retc; /* returned from processing */ __u16 attn; /* attention code from processing */ __u32 progress; /* progress code from processing */ }; /* Issuing a specific DDCB command */ #define DDCB_LENGTH 256 /* for debug data */ #define DDCB_ASIV_LENGTH 104 /* len of the DDCB ASIV array */ #define DDCB_ASIV_LENGTH_ATS 96 /* ASIV in ATS architecture */ #define DDCB_ASV_LENGTH 64 /* len of the DDCB ASV array */ #define DDCB_FIXUPS 12 /* maximum number of fixups */ struct genwqe_debug_data { char driver_version[64]; __u64 slu_unitcfg; __u64 app_unitcfg; __u8 ddcb_before[DDCB_LENGTH]; __u8 ddcb_prev[DDCB_LENGTH]; __u8 ddcb_finished[DDCB_LENGTH]; }; /* * Address Translation Specification (ATS) definitions * * Each 4 bit within the ATS 64-bit word specify the required address * translation at the defined offset. * * 63 LSB * 6666.5555.5555.5544.4444.4443.3333.3333 ... 11 * 3210.9876.5432.1098.7654.3210.9876.5432 ... 1098.7654.3210 * * offset: 0x00 0x08 0x10 0x18 0x20 0x28 0x30 0x38 ... 0x68 0x70 0x78 * res res res res ASIV ... * The first 4 entries in the ATS word are reserved. The following nibbles * each describe at an 8 byte offset the format of the required data. */ #define ATS_TYPE_DATA 0x0ull /* data */ #define ATS_TYPE_FLAT_RD 0x4ull /* flat buffer read only */ #define ATS_TYPE_FLAT_RDWR 0x5ull /* flat buffer read/write */ #define ATS_TYPE_SGL_RD 0x6ull /* sgl read only */ #define ATS_TYPE_SGL_RDWR 0x7ull /* sgl read/write */ #define ATS_SET_FLAGS(_struct, _field, _flags) \ (((_flags) & 0xf) << (44 - (4 * (offsetof(_struct, _field) / 8)))) #define ATS_GET_FLAGS(_ats, _byte_offs) \ (((_ats) >> (44 - (4 * ((_byte_offs) / 8)))) & 0xf) /** * struct genwqe_ddcb_cmd - User parameter for generic DDCB commands * * On the way into the kernel the driver will read the whole data * structure. On the way out the driver will not copy the ASIV data * back to user-space. */ struct genwqe_ddcb_cmd { /* START of data copied to/from driver */ __u64 next_addr; /* chaining genwqe_ddcb_cmd */ __u64 flags; /* reserved */ __u8 acfunc; /* accelerators functional unit */ __u8 cmd; /* command to execute */ __u8 asiv_length; /* used parameter length */ __u8 asv_length; /* length of valid return values */ __u16 cmdopts; /* command options */ __u16 retc; /* return code from processing */ __u16 attn; /* attention code from processing */ __u16 vcrc; /* variant crc16 */ __u32 progress; /* progress code from processing */ __u64 deque_ts; /* dequeue time stamp */ __u64 cmplt_ts; /* completion time stamp */ __u64 disp_ts; /* SW processing start */ /* move to end and avoid copy-back */ __u64 ddata_addr; /* collect debug data */ /* command specific values */ __u8 asv[DDCB_ASV_LENGTH]; /* END of data copied from driver */ union { struct { __u64 ats; __u8 asiv[DDCB_ASIV_LENGTH_ATS]; }; /* used for flash update to keep it backward compatible */ __u8 __asiv[DDCB_ASIV_LENGTH]; }; /* END of data copied to driver */ }; #define GENWQE_IOC_CODE 0xa5 /* Access functions */ #define GENWQE_READ_REG64 _IOR(GENWQE_IOC_CODE, 30, struct genwqe_reg_io) #define GENWQE_WRITE_REG64 _IOW(GENWQE_IOC_CODE, 31, struct genwqe_reg_io) #define GENWQE_READ_REG32 _IOR(GENWQE_IOC_CODE, 32, struct genwqe_reg_io) #define GENWQE_WRITE_REG32 _IOW(GENWQE_IOC_CODE, 33, struct genwqe_reg_io) #define GENWQE_READ_REG16 _IOR(GENWQE_IOC_CODE, 34, struct genwqe_reg_io) #define GENWQE_WRITE_REG16 _IOW(GENWQE_IOC_CODE, 35, struct genwqe_reg_io) #define GENWQE_GET_CARD_STATE _IOR(GENWQE_IOC_CODE, 36, enum genwqe_card_state) /** * struct genwqe_mem - Memory pinning/unpinning information * @addr: virtual user space address * @size: size of the area pin/dma-map/unmap * direction: 0: read/1: read and write * * Avoid pinning and unpinning of memory pages dynamically. Instead * the idea is to pin the whole buffer space required for DDCB * opertionas in advance. The driver will reuse this pinning and the * memory associated with it to setup the sglists for the DDCB * requests without the need to allocate and free memory or map and * unmap to get the DMA addresses. * * The inverse operation needs to be called after the pinning is not * needed anymore. The pinnings else the pinnings will get removed * after the device is closed. Note that pinnings will required * memory. */ struct genwqe_mem { __u64 addr; __u64 size; __u64 direction; __u64 flags; }; #define GENWQE_PIN_MEM _IOWR(GENWQE_IOC_CODE, 40, struct genwqe_mem) #define GENWQE_UNPIN_MEM _IOWR(GENWQE_IOC_CODE, 41, struct genwqe_mem) /* * Generic synchronous DDCB execution interface. * Synchronously execute a DDCB. * * Return: 0 on success or negative error code. * -EINVAL: Invalid parameters (ASIV_LEN, ASV_LEN, illegal fixups * no mappings found/could not create mappings * -EFAULT: illegal addresses in fixups, purging failed * -EBADMSG: enqueing failed, retc != DDCB_RETC_COMPLETE */ #define GENWQE_EXECUTE_DDCB \ _IOWR(GENWQE_IOC_CODE, 50, struct genwqe_ddcb_cmd) #define GENWQE_EXECUTE_RAW_DDCB \ _IOWR(GENWQE_IOC_CODE, 51, struct genwqe_ddcb_cmd) /* Service Layer functions (PF only) */ #define GENWQE_SLU_UPDATE _IOWR(GENWQE_IOC_CODE, 80, struct genwqe_bitstream) #define GENWQE_SLU_READ _IOWR(GENWQE_IOC_CODE, 81, struct genwqe_bitstream) #endif /* __GENWQE_CARD_H__ */ ����������������������������������������������������������������������������������������������������������������������linux/soundcard.h�����������������������������������������������������������������������������������0000644�����������������00000131726�14763166027�0010064 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright by Hannu Savolainen 1993-1997 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. 2. * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef SOUNDCARD_H #define SOUNDCARD_H /* * OSS interface version. With versions earlier than 3.6 this value is * an integer with value less than 361. In versions 3.6 and later * it's a six digit hexadecimal value. For example value * of 0x030600 represents OSS version 3.6.0. * Use ioctl(fd, OSS_GETVERSION, &int) to get the version number of * the currently active driver. */ #define SOUND_VERSION 0x030802 #define OPEN_SOUND_SYSTEM /* In Linux we need to be prepared for cross compiling */ #include <linux/ioctl.h> /* Endian macros. */ # include <endian.h> /* * Supported card ID numbers (Should be somewhere else?) */ #define SNDCARD_ADLIB 1 #define SNDCARD_SB 2 #define SNDCARD_PAS 3 #define SNDCARD_GUS 4 #define SNDCARD_MPU401 5 #define SNDCARD_SB16 6 #define SNDCARD_SB16MIDI 7 #define SNDCARD_UART6850 8 #define SNDCARD_GUS16 9 #define SNDCARD_MSS 10 #define SNDCARD_PSS 11 #define SNDCARD_SSCAPE 12 #define SNDCARD_PSS_MPU 13 #define SNDCARD_PSS_MSS 14 #define SNDCARD_SSCAPE_MSS 15 #define SNDCARD_TRXPRO 16 #define SNDCARD_TRXPRO_SB 17 #define SNDCARD_TRXPRO_MPU 18 #define SNDCARD_MAD16 19 #define SNDCARD_MAD16_MPU 20 #define SNDCARD_CS4232 21 #define SNDCARD_CS4232_MPU 22 #define SNDCARD_MAUI 23 #define SNDCARD_PSEUDO_MSS 24 #define SNDCARD_GUSPNP 25 #define SNDCARD_UART401 26 /* Sound card numbers 27 to N are reserved. Don't add more numbers here. */ /*********************************** * IOCTL Commands for /dev/sequencer */ #ifndef _SIOWR #if defined(_IOWR) && (defined(_AIX) || (!defined(sun) && !defined(sparc) && !defined(__sparc__) && !defined(__INCioctlh) && !defined(__Lynx__))) /* Use already defined ioctl defines if they exist (except with Sun or Sparc) */ #define SIOCPARM_MASK IOCPARM_MASK #define SIOC_VOID IOC_VOID #define SIOC_OUT IOC_OUT #define SIOC_IN IOC_IN #define SIOC_INOUT IOC_INOUT #define _SIOC_SIZE _IOC_SIZE #define _SIOC_DIR _IOC_DIR #define _SIOC_NONE _IOC_NONE #define _SIOC_READ _IOC_READ #define _SIOC_WRITE _IOC_WRITE #define _SIO _IO #define _SIOR _IOR #define _SIOW _IOW #define _SIOWR _IOWR #else /* Ioctl's have the command encoded in the lower word, * and the size of any in or out parameters in the upper * word. The high 2 bits of the upper word are used * to encode the in/out status of the parameter; for now * we restrict parameters to at most 8191 bytes. */ /* #define SIOCTYPE (0xff<<8) */ #define SIOCPARM_MASK 0x1fff /* parameters must be < 8192 bytes */ #define SIOC_VOID 0x00000000 /* no parameters */ #define SIOC_OUT 0x20000000 /* copy out parameters */ #define SIOC_IN 0x40000000 /* copy in parameters */ #define SIOC_INOUT (SIOC_IN|SIOC_OUT) /* the 0x20000000 is so we can distinguish new ioctl's from old */ #define _SIO(x,y) ((int)(SIOC_VOID|(x<<8)|y)) #define _SIOR(x,y,t) ((int)(SIOC_OUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) #define _SIOW(x,y,t) ((int)(SIOC_IN|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) /* this should be _SIORW, but stdio got there first */ #define _SIOWR(x,y,t) ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) #define _SIOC_SIZE(x) ((x>>16)&SIOCPARM_MASK) #define _SIOC_DIR(x) (x & 0xf0000000) #define _SIOC_NONE SIOC_VOID #define _SIOC_READ SIOC_OUT #define _SIOC_WRITE SIOC_IN # endif /* _IOWR */ #endif /* !_SIOWR */ #define SNDCTL_SEQ_RESET _SIO ('Q', 0) #define SNDCTL_SEQ_SYNC _SIO ('Q', 1) #define SNDCTL_SYNTH_INFO _SIOWR('Q', 2, struct synth_info) #define SNDCTL_SEQ_CTRLRATE _SIOWR('Q', 3, int) /* Set/get timer resolution (HZ) */ #define SNDCTL_SEQ_GETOUTCOUNT _SIOR ('Q', 4, int) #define SNDCTL_SEQ_GETINCOUNT _SIOR ('Q', 5, int) #define SNDCTL_SEQ_PERCMODE _SIOW ('Q', 6, int) #define SNDCTL_FM_LOAD_INSTR _SIOW ('Q', 7, struct sbi_instrument) /* Obsolete. Don't use!!!!!! */ #define SNDCTL_SEQ_TESTMIDI _SIOW ('Q', 8, int) #define SNDCTL_SEQ_RESETSAMPLES _SIOW ('Q', 9, int) #define SNDCTL_SEQ_NRSYNTHS _SIOR ('Q',10, int) #define SNDCTL_SEQ_NRMIDIS _SIOR ('Q',11, int) #define SNDCTL_MIDI_INFO _SIOWR('Q',12, struct midi_info) #define SNDCTL_SEQ_THRESHOLD _SIOW ('Q',13, int) #define SNDCTL_SYNTH_MEMAVL _SIOWR('Q',14, int) /* in=dev#, out=memsize */ #define SNDCTL_FM_4OP_ENABLE _SIOW ('Q',15, int) /* in=dev# */ #define SNDCTL_SEQ_PANIC _SIO ('Q',17) #define SNDCTL_SEQ_OUTOFBAND _SIOW ('Q',18, struct seq_event_rec) #define SNDCTL_SEQ_GETTIME _SIOR ('Q',19, int) #define SNDCTL_SYNTH_ID _SIOWR('Q',20, struct synth_info) #define SNDCTL_SYNTH_CONTROL _SIOWR('Q',21, struct synth_control) #define SNDCTL_SYNTH_REMOVESAMPLE _SIOWR('Q',22, struct remove_sample) typedef struct synth_control { int devno; /* Synthesizer # */ char data[4000]; /* Device spesific command/data record */ }synth_control; typedef struct remove_sample { int devno; /* Synthesizer # */ int bankno; /* MIDI bank # (0=General MIDI) */ int instrno; /* MIDI instrument number */ } remove_sample; typedef struct seq_event_rec { unsigned char arr[8]; } seq_event_rec; #define SNDCTL_TMR_TIMEBASE _SIOWR('T', 1, int) #define SNDCTL_TMR_START _SIO ('T', 2) #define SNDCTL_TMR_STOP _SIO ('T', 3) #define SNDCTL_TMR_CONTINUE _SIO ('T', 4) #define SNDCTL_TMR_TEMPO _SIOWR('T', 5, int) #define SNDCTL_TMR_SOURCE _SIOWR('T', 6, int) # define TMR_INTERNAL 0x00000001 # define TMR_EXTERNAL 0x00000002 # define TMR_MODE_MIDI 0x00000010 # define TMR_MODE_FSK 0x00000020 # define TMR_MODE_CLS 0x00000040 # define TMR_MODE_SMPTE 0x00000080 #define SNDCTL_TMR_METRONOME _SIOW ('T', 7, int) #define SNDCTL_TMR_SELECT _SIOW ('T', 8, int) /* * Some big endian/little endian handling macros */ #define _LINUX_PATCHKEY_H_INDIRECT #include <linux/patchkey.h> #undef _LINUX_PATCHKEY_H_INDIRECT # if defined(__BYTE_ORDER) # if __BYTE_ORDER == __BIG_ENDIAN # define AFMT_S16_NE AFMT_S16_BE # elif __BYTE_ORDER == __LITTLE_ENDIAN # define AFMT_S16_NE AFMT_S16_LE # else # error "could not determine byte order" # endif # endif /* * Sample loading mechanism for internal synthesizers (/dev/sequencer) * The following patch_info structure has been designed to support * Gravis UltraSound. It tries to be universal format for uploading * sample based patches but is probably too limited. * * (PBD) As Hannu guessed, the GUS structure is too limited for * the WaveFront, but this is the right place for a constant definition. */ struct patch_info { unsigned short key; /* Use WAVE_PATCH here */ #define WAVE_PATCH _PATCHKEY(0x04) #define GUS_PATCH WAVE_PATCH #define WAVEFRONT_PATCH _PATCHKEY(0x06) short device_no; /* Synthesizer number */ short instr_no; /* Midi pgm# */ unsigned int mode; /* * The least significant byte has the same format than the GUS .PAT * files */ #define WAVE_16_BITS 0x01 /* bit 0 = 8 or 16 bit wave data. */ #define WAVE_UNSIGNED 0x02 /* bit 1 = Signed - Unsigned data. */ #define WAVE_LOOPING 0x04 /* bit 2 = looping enabled-1. */ #define WAVE_BIDIR_LOOP 0x08 /* bit 3 = Set is bidirectional looping. */ #define WAVE_LOOP_BACK 0x10 /* bit 4 = Set is looping backward. */ #define WAVE_SUSTAIN_ON 0x20 /* bit 5 = Turn sustaining on. (Env. pts. 3)*/ #define WAVE_ENVELOPES 0x40 /* bit 6 = Enable envelopes - 1 */ #define WAVE_FAST_RELEASE 0x80 /* bit 7 = Shut off immediately after note off */ /* (use the env_rate/env_offs fields). */ /* Linux specific bits */ #define WAVE_VIBRATO 0x00010000 /* The vibrato info is valid */ #define WAVE_TREMOLO 0x00020000 /* The tremolo info is valid */ #define WAVE_SCALE 0x00040000 /* The scaling info is valid */ #define WAVE_FRACTIONS 0x00080000 /* Fraction information is valid */ /* Reserved bits */ #define WAVE_ROM 0x40000000 /* For future use */ #define WAVE_MULAW 0x20000000 /* For future use */ /* Other bits must be zeroed */ int len; /* Size of the wave data in bytes */ int loop_start, loop_end; /* Byte offsets from the beginning */ /* * The base_freq and base_note fields are used when computing the * playback speed for a note. The base_note defines the tone frequency * which is heard if the sample is played using the base_freq as the * playback speed. * * The low_note and high_note fields define the minimum and maximum note * frequencies for which this sample is valid. It is possible to define * more than one samples for an instrument number at the same time. The * low_note and high_note fields are used to select the most suitable one. * * The fields base_note, high_note and low_note should contain * the note frequency multiplied by 1000. For example value for the * middle A is 440*1000. */ unsigned int base_freq; unsigned int base_note; unsigned int high_note; unsigned int low_note; int panning; /* -128=left, 127=right */ int detuning; /* New fields introduced in version 1.99.5 */ /* Envelope. Enabled by mode bit WAVE_ENVELOPES */ unsigned char env_rate[ 6 ]; /* GUS HW ramping rate */ unsigned char env_offset[ 6 ]; /* 255 == 100% */ /* * The tremolo, vibrato and scale info are not supported yet. * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or * WAVE_SCALE */ unsigned char tremolo_sweep; unsigned char tremolo_rate; unsigned char tremolo_depth; unsigned char vibrato_sweep; unsigned char vibrato_rate; unsigned char vibrato_depth; int scale_frequency; unsigned int scale_factor; /* from 0 to 2048 or 0 to 2 */ int volume; int fractions; int reserved1; int spare[2]; char data[1]; /* The waveform data starts here */ }; struct sysex_info { short key; /* Use SYSEX_PATCH or MAUI_PATCH here */ #define SYSEX_PATCH _PATCHKEY(0x05) #define MAUI_PATCH _PATCHKEY(0x06) short device_no; /* Synthesizer number */ int len; /* Size of the sysex data in bytes */ unsigned char data[1]; /* Sysex data starts here */ }; /* * /dev/sequencer input events. * * The data written to the /dev/sequencer is a stream of events. Events * are records of 4 or 8 bytes. The first byte defines the size. * Any number of events can be written with a write call. There * is a set of macros for sending these events. Use these macros if you * want to maximize portability of your program. * * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events. * (All input events are currently 4 bytes long. Be prepared to support * 8 byte events also. If you receive any event having first byte >= 128, * it's a 8 byte event. * * The events are documented at the end of this file. * * Normal events (4 bytes) * There is also a 8 byte version of most of the 4 byte events. The * 8 byte one is recommended. */ #define SEQ_NOTEOFF 0 #define SEQ_FMNOTEOFF SEQ_NOTEOFF /* Just old name */ #define SEQ_NOTEON 1 #define SEQ_FMNOTEON SEQ_NOTEON #define SEQ_WAIT TMR_WAIT_ABS #define SEQ_PGMCHANGE 3 #define SEQ_FMPGMCHANGE SEQ_PGMCHANGE #define SEQ_SYNCTIMER TMR_START #define SEQ_MIDIPUTC 5 #define SEQ_DRUMON 6 /*** OBSOLETE ***/ #define SEQ_DRUMOFF 7 /*** OBSOLETE ***/ #define SEQ_ECHO TMR_ECHO /* For synching programs with output */ #define SEQ_AFTERTOUCH 9 #define SEQ_CONTROLLER 10 /******************************************* * Midi controller numbers ******************************************* * Controllers 0 to 31 (0x00 to 0x1f) and * 32 to 63 (0x20 to 0x3f) are continuous * controllers. * In the MIDI 1.0 these controllers are sent using * two messages. Controller numbers 0 to 31 are used * to send the MSB and the controller numbers 32 to 63 * are for the LSB. Note that just 7 bits are used in MIDI bytes. */ #define CTL_BANK_SELECT 0x00 #define CTL_MODWHEEL 0x01 #define CTL_BREATH 0x02 /* undefined 0x03 */ #define CTL_FOOT 0x04 #define CTL_PORTAMENTO_TIME 0x05 #define CTL_DATA_ENTRY 0x06 #define CTL_MAIN_VOLUME 0x07 #define CTL_BALANCE 0x08 /* undefined 0x09 */ #define CTL_PAN 0x0a #define CTL_EXPRESSION 0x0b /* undefined 0x0c */ /* undefined 0x0d */ /* undefined 0x0e */ /* undefined 0x0f */ #define CTL_GENERAL_PURPOSE1 0x10 #define CTL_GENERAL_PURPOSE2 0x11 #define CTL_GENERAL_PURPOSE3 0x12 #define CTL_GENERAL_PURPOSE4 0x13 /* undefined 0x14 - 0x1f */ /* undefined 0x20 */ /* The controller numbers 0x21 to 0x3f are reserved for the */ /* least significant bytes of the controllers 0x00 to 0x1f. */ /* These controllers are not recognised by the driver. */ /* Controllers 64 to 69 (0x40 to 0x45) are on/off switches. */ /* 0=OFF and 127=ON (intermediate values are possible) */ #define CTL_DAMPER_PEDAL 0x40 #define CTL_SUSTAIN 0x40 /* Alias */ #define CTL_HOLD 0x40 /* Alias */ #define CTL_PORTAMENTO 0x41 #define CTL_SOSTENUTO 0x42 #define CTL_SOFT_PEDAL 0x43 /* undefined 0x44 */ #define CTL_HOLD2 0x45 /* undefined 0x46 - 0x4f */ #define CTL_GENERAL_PURPOSE5 0x50 #define CTL_GENERAL_PURPOSE6 0x51 #define CTL_GENERAL_PURPOSE7 0x52 #define CTL_GENERAL_PURPOSE8 0x53 /* undefined 0x54 - 0x5a */ #define CTL_EXT_EFF_DEPTH 0x5b #define CTL_TREMOLO_DEPTH 0x5c #define CTL_CHORUS_DEPTH 0x5d #define CTL_DETUNE_DEPTH 0x5e #define CTL_CELESTE_DEPTH 0x5e /* Alias for the above one */ #define CTL_PHASER_DEPTH 0x5f #define CTL_DATA_INCREMENT 0x60 #define CTL_DATA_DECREMENT 0x61 #define CTL_NONREG_PARM_NUM_LSB 0x62 #define CTL_NONREG_PARM_NUM_MSB 0x63 #define CTL_REGIST_PARM_NUM_LSB 0x64 #define CTL_REGIST_PARM_NUM_MSB 0x65 /* undefined 0x66 - 0x78 */ /* reserved 0x79 - 0x7f */ /* Pseudo controllers (not midi compatible) */ #define CTRL_PITCH_BENDER 255 #define CTRL_PITCH_BENDER_RANGE 254 #define CTRL_EXPRESSION 253 /* Obsolete */ #define CTRL_MAIN_VOLUME 252 /* Obsolete */ #define SEQ_BALANCE 11 #define SEQ_VOLMODE 12 /* * Volume mode decides how volumes are used */ #define VOL_METHOD_ADAGIO 1 #define VOL_METHOD_LINEAR 2 /* * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as * input events. */ /* * Event codes 0xf0 to 0xfc are reserved for future extensions. */ #define SEQ_FULLSIZE 0xfd /* Long events */ /* * SEQ_FULLSIZE events are used for loading patches/samples to the * synthesizer devices. These events are passed directly to the driver * of the associated synthesizer device. There is no limit to the size * of the extended events. These events are not queued but executed * immediately when the write() is called (execution can take several * seconds of time). * * When a SEQ_FULLSIZE message is written to the device, it must * be written using exactly one write() call. Other events cannot * be mixed to the same write. * * For FM synths (YM3812/OPL3) use struct sbi_instrument and write it to the * /dev/sequencer. Don't write other data together with the instrument structure * Set the key field of the structure to FM_PATCH. The device field is used to * route the patch to the corresponding device. * * For wave table use struct patch_info. Initialize the key field * to WAVE_PATCH. */ #define SEQ_PRIVATE 0xfe /* Low level HW dependent events (8 bytes) */ #define SEQ_EXTENDED 0xff /* Extended events (8 bytes) OBSOLETE */ /* * Record for FM patches */ typedef unsigned char sbi_instr_data[32]; struct sbi_instrument { unsigned short key; /* FM_PATCH or OPL3_PATCH */ #define FM_PATCH _PATCHKEY(0x01) #define OPL3_PATCH _PATCHKEY(0x03) short device; /* Synth# (0-4) */ int channel; /* Program# to be initialized */ sbi_instr_data operators; /* Register settings for operator cells (.SBI format) */ }; struct synth_info { /* Read only */ char name[30]; int device; /* 0-N. INITIALIZE BEFORE CALLING */ int synth_type; #define SYNTH_TYPE_FM 0 #define SYNTH_TYPE_SAMPLE 1 #define SYNTH_TYPE_MIDI 2 /* Midi interface */ int synth_subtype; #define FM_TYPE_ADLIB 0x00 #define FM_TYPE_OPL3 0x01 #define MIDI_TYPE_MPU401 0x401 #define SAMPLE_TYPE_BASIC 0x10 #define SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC #define SAMPLE_TYPE_WAVEFRONT 0x11 int perc_mode; /* No longer supported */ int nr_voices; int nr_drums; /* Obsolete field */ int instr_bank_size; unsigned int capabilities; #define SYNTH_CAP_PERCMODE 0x00000001 /* No longer used */ #define SYNTH_CAP_OPL3 0x00000002 /* Set if OPL3 supported */ #define SYNTH_CAP_INPUT 0x00000004 /* Input (MIDI) device */ int dummies[19]; /* Reserve space */ }; struct sound_timer_info { char name[32]; int caps; }; #define MIDI_CAP_MPU401 1 /* MPU-401 intelligent mode */ struct midi_info { char name[30]; int device; /* 0-N. INITIALIZE BEFORE CALLING */ unsigned int capabilities; /* To be defined later */ int dev_type; int dummies[18]; /* Reserve space */ }; /******************************************** * ioctl commands for the /dev/midi## */ typedef struct { unsigned char cmd; char nr_args, nr_returns; unsigned char data[30]; } mpu_command_rec; #define SNDCTL_MIDI_PRETIME _SIOWR('m', 0, int) #define SNDCTL_MIDI_MPUMODE _SIOWR('m', 1, int) #define SNDCTL_MIDI_MPUCMD _SIOWR('m', 2, mpu_command_rec) /******************************************** * IOCTL commands for /dev/dsp and /dev/audio */ #define SNDCTL_DSP_RESET _SIO ('P', 0) #define SNDCTL_DSP_SYNC _SIO ('P', 1) #define SNDCTL_DSP_SPEED _SIOWR('P', 2, int) #define SNDCTL_DSP_STEREO _SIOWR('P', 3, int) #define SNDCTL_DSP_GETBLKSIZE _SIOWR('P', 4, int) #define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT #define SNDCTL_DSP_CHANNELS _SIOWR('P', 6, int) #define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS #define SOUND_PCM_WRITE_FILTER _SIOWR('P', 7, int) #define SNDCTL_DSP_POST _SIO ('P', 8) #define SNDCTL_DSP_SUBDIVIDE _SIOWR('P', 9, int) #define SNDCTL_DSP_SETFRAGMENT _SIOWR('P',10, int) /* Audio data formats (Note! U8=8 and S16_LE=16 for compatibility) */ #define SNDCTL_DSP_GETFMTS _SIOR ('P',11, int) /* Returns a mask */ #define SNDCTL_DSP_SETFMT _SIOWR('P',5, int) /* Selects ONE fmt*/ # define AFMT_QUERY 0x00000000 /* Return current fmt */ # define AFMT_MU_LAW 0x00000001 # define AFMT_A_LAW 0x00000002 # define AFMT_IMA_ADPCM 0x00000004 # define AFMT_U8 0x00000008 # define AFMT_S16_LE 0x00000010 /* Little endian signed 16*/ # define AFMT_S16_BE 0x00000020 /* Big endian signed 16 */ # define AFMT_S8 0x00000040 # define AFMT_U16_LE 0x00000080 /* Little endian U16 */ # define AFMT_U16_BE 0x00000100 /* Big endian U16 */ # define AFMT_MPEG 0x00000200 /* MPEG (2) audio */ # define AFMT_AC3 0x00000400 /* Dolby Digital AC3 */ /* * Buffer status queries. */ typedef struct audio_buf_info { int fragments; /* # of available fragments (partially usend ones not counted) */ int fragstotal; /* Total # of fragments allocated */ int fragsize; /* Size of a fragment in bytes */ int bytes; /* Available space in bytes (includes partially used fragments) */ /* Note! 'bytes' could be more than fragments*fragsize */ } audio_buf_info; #define SNDCTL_DSP_GETOSPACE _SIOR ('P',12, audio_buf_info) #define SNDCTL_DSP_GETISPACE _SIOR ('P',13, audio_buf_info) #define SNDCTL_DSP_NONBLOCK _SIO ('P',14) #define SNDCTL_DSP_GETCAPS _SIOR ('P',15, int) # define DSP_CAP_REVISION 0x000000ff /* Bits for revision level (0 to 255) */ # define DSP_CAP_DUPLEX 0x00000100 /* Full duplex record/playback */ # define DSP_CAP_REALTIME 0x00000200 /* Real time capability */ # define DSP_CAP_BATCH 0x00000400 /* Device has some kind of */ /* internal buffers which may */ /* cause some delays and */ /* decrease precision of timing */ # define DSP_CAP_COPROC 0x00000800 /* Has a coprocessor */ /* Sometimes it's a DSP */ /* but usually not */ # define DSP_CAP_TRIGGER 0x00001000 /* Supports SETTRIGGER */ # define DSP_CAP_MMAP 0x00002000 /* Supports mmap() */ # define DSP_CAP_MULTI 0x00004000 /* support multiple open */ # define DSP_CAP_BIND 0x00008000 /* channel binding to front/rear/cneter/lfe */ #define SNDCTL_DSP_GETTRIGGER _SIOR ('P',16, int) #define SNDCTL_DSP_SETTRIGGER _SIOW ('P',16, int) # define PCM_ENABLE_INPUT 0x00000001 # define PCM_ENABLE_OUTPUT 0x00000002 typedef struct count_info { int bytes; /* Total # of bytes processed */ int blocks; /* # of fragment transitions since last time */ int ptr; /* Current DMA pointer value */ } count_info; #define SNDCTL_DSP_GETIPTR _SIOR ('P',17, count_info) #define SNDCTL_DSP_GETOPTR _SIOR ('P',18, count_info) typedef struct buffmem_desc { unsigned *buffer; int size; } buffmem_desc; #define SNDCTL_DSP_MAPINBUF _SIOR ('P', 19, buffmem_desc) #define SNDCTL_DSP_MAPOUTBUF _SIOR ('P', 20, buffmem_desc) #define SNDCTL_DSP_SETSYNCRO _SIO ('P', 21) #define SNDCTL_DSP_SETDUPLEX _SIO ('P', 22) #define SNDCTL_DSP_GETODELAY _SIOR ('P', 23, int) #define SNDCTL_DSP_GETCHANNELMASK _SIOWR('P', 64, int) #define SNDCTL_DSP_BIND_CHANNEL _SIOWR('P', 65, int) # define DSP_BIND_QUERY 0x00000000 # define DSP_BIND_FRONT 0x00000001 # define DSP_BIND_SURR 0x00000002 # define DSP_BIND_CENTER_LFE 0x00000004 # define DSP_BIND_HANDSET 0x00000008 # define DSP_BIND_MIC 0x00000010 # define DSP_BIND_MODEM1 0x00000020 # define DSP_BIND_MODEM2 0x00000040 # define DSP_BIND_I2S 0x00000080 # define DSP_BIND_SPDIF 0x00000100 #define SNDCTL_DSP_SETSPDIF _SIOW ('P', 66, int) #define SNDCTL_DSP_GETSPDIF _SIOR ('P', 67, int) # define SPDIF_PRO 0x0001 # define SPDIF_N_AUD 0x0002 # define SPDIF_COPY 0x0004 # define SPDIF_PRE 0x0008 # define SPDIF_CC 0x07f0 # define SPDIF_L 0x0800 # define SPDIF_DRS 0x4000 # define SPDIF_V 0x8000 /* * Application's profile defines the way how playback underrun situations should be handled. * * APF_NORMAL (the default) and APF_NETWORK make the driver to cleanup the * playback buffer whenever an underrun occurs. This consumes some time * prevents looping the existing buffer. * APF_CPUINTENS is intended to be set by CPU intensive applications which * are likely to run out of time occasionally. In this mode the buffer cleanup is * disabled which saves CPU time but also let's the previous buffer content to * be played during the "pause" after the underrun. */ #define SNDCTL_DSP_PROFILE _SIOW ('P', 23, int) #define APF_NORMAL 0 /* Normal applications */ #define APF_NETWORK 1 /* Underruns probably caused by an "external" delay */ #define APF_CPUINTENS 2 /* Underruns probably caused by "overheating" the CPU */ #define SOUND_PCM_READ_RATE _SIOR ('P', 2, int) #define SOUND_PCM_READ_CHANNELS _SIOR ('P', 6, int) #define SOUND_PCM_READ_BITS _SIOR ('P', 5, int) #define SOUND_PCM_READ_FILTER _SIOR ('P', 7, int) /* Some alias names */ #define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT #define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED #define SOUND_PCM_POST SNDCTL_DSP_POST #define SOUND_PCM_RESET SNDCTL_DSP_RESET #define SOUND_PCM_SYNC SNDCTL_DSP_SYNC #define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE #define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT #define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS #define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT #define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE #define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE #define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK #define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS #define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER #define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER #define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO #define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR #define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR #define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF #define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF /* * ioctl calls to be used in communication with coprocessors and * DSP chips. */ typedef struct copr_buffer { int command; /* Set to 0 if not used */ int flags; #define CPF_NONE 0x0000 #define CPF_FIRST 0x0001 /* First block */ #define CPF_LAST 0x0002 /* Last block */ int len; int offs; /* If required by the device (0 if not used) */ unsigned char data[4000]; /* NOTE! 4000 is not 4k */ } copr_buffer; typedef struct copr_debug_buf { int command; /* Used internally. Set to 0 */ int parm1; int parm2; int flags; int len; /* Length of data in bytes */ } copr_debug_buf; typedef struct copr_msg { int len; unsigned char data[4000]; } copr_msg; #define SNDCTL_COPR_RESET _SIO ('C', 0) #define SNDCTL_COPR_LOAD _SIOWR('C', 1, copr_buffer) #define SNDCTL_COPR_RDATA _SIOWR('C', 2, copr_debug_buf) #define SNDCTL_COPR_RCODE _SIOWR('C', 3, copr_debug_buf) #define SNDCTL_COPR_WDATA _SIOW ('C', 4, copr_debug_buf) #define SNDCTL_COPR_WCODE _SIOW ('C', 5, copr_debug_buf) #define SNDCTL_COPR_RUN _SIOWR('C', 6, copr_debug_buf) #define SNDCTL_COPR_HALT _SIOWR('C', 7, copr_debug_buf) #define SNDCTL_COPR_SENDMSG _SIOWR('C', 8, copr_msg) #define SNDCTL_COPR_RCVMSG _SIOR ('C', 9, copr_msg) /********************************************* * IOCTL commands for /dev/mixer */ /* * Mixer devices * * There can be up to 20 different analog mixer channels. The * SOUND_MIXER_NRDEVICES gives the currently supported maximum. * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells * the devices supported by the particular mixer. */ #define SOUND_MIXER_NRDEVICES 25 #define SOUND_MIXER_VOLUME 0 #define SOUND_MIXER_BASS 1 #define SOUND_MIXER_TREBLE 2 #define SOUND_MIXER_SYNTH 3 #define SOUND_MIXER_PCM 4 #define SOUND_MIXER_SPEAKER 5 #define SOUND_MIXER_LINE 6 #define SOUND_MIXER_MIC 7 #define SOUND_MIXER_CD 8 #define SOUND_MIXER_IMIX 9 /* Recording monitor */ #define SOUND_MIXER_ALTPCM 10 #define SOUND_MIXER_RECLEV 11 /* Recording level */ #define SOUND_MIXER_IGAIN 12 /* Input gain */ #define SOUND_MIXER_OGAIN 13 /* Output gain */ /* * The AD1848 codec and compatibles have three line level inputs * (line, aux1 and aux2). Since each card manufacturer have assigned * different meanings to these inputs, it's inpractical to assign * specific meanings (line, cd, synth etc.) to them. */ #define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */ #define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */ #define SOUND_MIXER_LINE3 16 /* Input source 3 (line) */ #define SOUND_MIXER_DIGITAL1 17 /* Digital (input) 1 */ #define SOUND_MIXER_DIGITAL2 18 /* Digital (input) 2 */ #define SOUND_MIXER_DIGITAL3 19 /* Digital (input) 3 */ #define SOUND_MIXER_PHONEIN 20 /* Phone input */ #define SOUND_MIXER_PHONEOUT 21 /* Phone output */ #define SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */ #define SOUND_MIXER_RADIO 23 /* Radio in */ #define SOUND_MIXER_MONITOR 24 /* Monitor (usually mic) volume */ /* Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) */ /* Not counted to SOUND_MIXER_NRDEVICES, but use the same number space */ #define SOUND_ONOFF_MIN 28 #define SOUND_ONOFF_MAX 30 /* Note! Number 31 cannot be used since the sign bit is reserved */ #define SOUND_MIXER_NONE 31 /* * The following unsupported macros are no longer functional. * Use SOUND_MIXER_PRIVATE# macros in future. */ #define SOUND_MIXER_ENHANCE SOUND_MIXER_NONE #define SOUND_MIXER_MUTE SOUND_MIXER_NONE #define SOUND_MIXER_LOUD SOUND_MIXER_NONE #define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \ "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \ "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \ "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor"} #define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \ "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \ "line1", "line2", "line3", "dig1", "dig2", "dig3", \ "phin", "phout", "video", "radio", "monitor"} /* Device bitmask identifiers */ #define SOUND_MIXER_RECSRC 0xff /* Arg contains a bit for each recording source */ #define SOUND_MIXER_DEVMASK 0xfe /* Arg contains a bit for each supported device */ #define SOUND_MIXER_RECMASK 0xfd /* Arg contains a bit for each supported recording source */ #define SOUND_MIXER_CAPS 0xfc # define SOUND_CAP_EXCL_INPUT 0x00000001 /* Only one recording source at a time */ #define SOUND_MIXER_STEREODEVS 0xfb /* Mixer channels supporting stereo */ #define SOUND_MIXER_OUTSRC 0xfa /* Arg contains a bit for each input source to output */ #define SOUND_MIXER_OUTMASK 0xf9 /* Arg contains a bit for each supported input source to output */ /* Device mask bits */ #define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME) #define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS) #define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE) #define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH) #define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM) #define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER) #define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE) #define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC) #define SOUND_MASK_CD (1 << SOUND_MIXER_CD) #define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX) #define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM) #define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV) #define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN) #define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN) #define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1) #define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2) #define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3) #define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1) #define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2) #define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3) #define SOUND_MASK_PHONEIN (1 << SOUND_MIXER_PHONEIN) #define SOUND_MASK_PHONEOUT (1 << SOUND_MIXER_PHONEOUT) #define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO) #define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO) #define SOUND_MASK_MONITOR (1 << SOUND_MIXER_MONITOR) /* Obsolete macros */ #define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE) #define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE) #define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD) #define MIXER_READ(dev) _SIOR('M', dev, int) #define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME) #define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS) #define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE) #define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH) #define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM) #define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER) #define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE) #define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC) #define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD) #define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX) #define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM) #define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV) #define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN) #define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN) #define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1) #define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2) #define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3) /* Obsolete macros */ #define SOUND_MIXER_READ_MUTE MIXER_READ(SOUND_MIXER_MUTE) #define SOUND_MIXER_READ_ENHANCE MIXER_READ(SOUND_MIXER_ENHANCE) #define SOUND_MIXER_READ_LOUD MIXER_READ(SOUND_MIXER_LOUD) #define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC) #define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK) #define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK) #define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS) #define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS) #define MIXER_WRITE(dev) _SIOWR('M', dev, int) #define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME) #define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS) #define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE) #define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH) #define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM) #define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER) #define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE) #define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC) #define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD) #define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX) #define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM) #define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV) #define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN) #define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN) #define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1) #define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2) #define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3) /* Obsolete macros */ #define SOUND_MIXER_WRITE_MUTE MIXER_WRITE(SOUND_MIXER_MUTE) #define SOUND_MIXER_WRITE_ENHANCE MIXER_WRITE(SOUND_MIXER_ENHANCE) #define SOUND_MIXER_WRITE_LOUD MIXER_WRITE(SOUND_MIXER_LOUD) #define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC) typedef struct mixer_info { char id[16]; char name[32]; int modify_counter; int fillers[10]; } mixer_info; typedef struct _old_mixer_info /* Obsolete */ { char id[16]; char name[32]; } _old_mixer_info; #define SOUND_MIXER_INFO _SIOR ('M', 101, mixer_info) #define SOUND_OLD_MIXER_INFO _SIOR ('M', 101, _old_mixer_info) /* * A mechanism for accessing "proprietary" mixer features. This method * permits passing 128 bytes of arbitrary data between a mixer application * and the mixer driver. Interpretation of the record is defined by * the particular mixer driver. */ typedef unsigned char mixer_record[128]; #define SOUND_MIXER_ACCESS _SIOWR('M', 102, mixer_record) /* * Two ioctls for special souncard function */ #define SOUND_MIXER_AGC _SIOWR('M', 103, int) #define SOUND_MIXER_3DSE _SIOWR('M', 104, int) /* * The SOUND_MIXER_PRIVATE# commands can be redefined by low level drivers. * These features can be used when accessing device specific features. */ #define SOUND_MIXER_PRIVATE1 _SIOWR('M', 111, int) #define SOUND_MIXER_PRIVATE2 _SIOWR('M', 112, int) #define SOUND_MIXER_PRIVATE3 _SIOWR('M', 113, int) #define SOUND_MIXER_PRIVATE4 _SIOWR('M', 114, int) #define SOUND_MIXER_PRIVATE5 _SIOWR('M', 115, int) /* * SOUND_MIXER_GETLEVELS and SOUND_MIXER_SETLEVELS calls can be used * for querying current mixer settings from the driver and for loading * default volume settings _prior_ activating the mixer (loading * doesn't affect current state of the mixer hardware). These calls * are for internal use only. */ typedef struct mixer_vol_table { int num; /* Index to volume table */ char name[32]; int levels[32]; } mixer_vol_table; #define SOUND_MIXER_GETLEVELS _SIOWR('M', 116, mixer_vol_table) #define SOUND_MIXER_SETLEVELS _SIOWR('M', 117, mixer_vol_table) /* * An ioctl for identifying the driver version. It will return value * of the SOUND_VERSION macro used when compiling the driver. * This call was introduced in OSS version 3.6 and it will not work * with earlier versions (returns EINVAL). */ #define OSS_GETVERSION _SIOR ('M', 118, int) /* * Level 2 event types for /dev/sequencer */ /* * The 4 most significant bits of byte 0 specify the class of * the event: * * 0x8X = system level events, * 0x9X = device/port specific events, event[1] = device/port, * The last 4 bits give the subtype: * 0x02 = Channel event (event[3] = chn). * 0x01 = note event (event[4] = note). * (0x01 is not used alone but always with bit 0x02). * event[2] = MIDI message code (0x80=note off etc.) * */ #define EV_SEQ_LOCAL 0x80 #define EV_TIMING 0x81 #define EV_CHN_COMMON 0x92 #define EV_CHN_VOICE 0x93 #define EV_SYSEX 0x94 /* * Event types 200 to 220 are reserved for application use. * These numbers will not be used by the driver. */ /* * Events for event type EV_CHN_VOICE */ #define MIDI_NOTEOFF 0x80 #define MIDI_NOTEON 0x90 #define MIDI_KEY_PRESSURE 0xA0 /* * Events for event type EV_CHN_COMMON */ #define MIDI_CTL_CHANGE 0xB0 #define MIDI_PGM_CHANGE 0xC0 #define MIDI_CHN_PRESSURE 0xD0 #define MIDI_PITCH_BEND 0xE0 #define MIDI_SYSTEM_PREFIX 0xF0 /* * Timer event types */ #define TMR_WAIT_REL 1 /* Time relative to the prev time */ #define TMR_WAIT_ABS 2 /* Absolute time since TMR_START */ #define TMR_STOP 3 #define TMR_START 4 #define TMR_CONTINUE 5 #define TMR_TEMPO 6 #define TMR_ECHO 8 #define TMR_CLOCK 9 /* MIDI clock */ #define TMR_SPP 10 /* Song position pointer */ #define TMR_TIMESIG 11 /* Time signature */ /* * Local event types */ #define LOCL_STARTAUDIO 1 /* * Some convenience macros to simplify programming of the * /dev/sequencer interface * * This is a legacy interface for applications written against * the OSSlib-3.8 style interface. It is no longer possible * to actually link against OSSlib with this header, but we * still provide these macros for programs using them. * * If you want to use OSSlib, it is recommended that you get * the GPL version of OSS-4.x and build against that version * of the header. * * We redefine the extern keyword so that make headers_check * does not complain about SEQ_USE_EXTBUF. */ #define SEQ_DECLAREBUF() SEQ_USE_EXTBUF() void seqbuf_dump(void); /* This function must be provided by programs */ #define SEQ_PM_DEFINES int __foo_bar___ #define SEQ_LOAD_GMINSTR(dev, instr) #define SEQ_LOAD_GMDRUM(dev, drum) #define _SEQ_EXTERN extern #define SEQ_USE_EXTBUF() \ _SEQ_EXTERN unsigned char _seqbuf[]; \ _SEQ_EXTERN int _seqbuflen; _SEQ_EXTERN int _seqbufptr #ifndef USE_SIMPLE_MACROS /* Sample seqbuf_dump() implementation: * * SEQ_DEFINEBUF (2048); -- Defines a buffer for 2048 bytes * * int seqfd; -- The file descriptor for /dev/sequencer. * * void * seqbuf_dump () * { * if (_seqbufptr) * if (write (seqfd, _seqbuf, _seqbufptr) == -1) * { * perror ("write /dev/sequencer"); * exit (-1); * } * _seqbufptr = 0; * } */ #define SEQ_DEFINEBUF(len) unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0 #define _SEQ_NEEDBUF(len) if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump() #define _SEQ_ADVBUF(len) _seqbufptr += len #define SEQ_DUMPBUF seqbuf_dump #else /* * This variation of the sequencer macros is used just to format one event * using fixed buffer. * * The program using the macro library must define the following macros before * using this library. * * #define _seqbuf name of the buffer (unsigned char[]) * #define _SEQ_ADVBUF(len) If the applic needs to know the exact * size of the event, this macro can be used. * Otherwise this must be defined as empty. * #define _seqbufptr Define the name of index variable or 0 if * not required. */ #define _SEQ_NEEDBUF(len) /* empty */ #endif #define SEQ_VOLUME_MODE(dev, mode) {_SEQ_NEEDBUF(8);\ _seqbuf[_seqbufptr] = SEQ_EXTENDED;\ _seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\ _seqbuf[_seqbufptr+2] = (dev);\ _seqbuf[_seqbufptr+3] = (mode);\ _seqbuf[_seqbufptr+4] = 0;\ _seqbuf[_seqbufptr+5] = 0;\ _seqbuf[_seqbufptr+6] = 0;\ _seqbuf[_seqbufptr+7] = 0;\ _SEQ_ADVBUF(8);} /* * Midi voice messages */ #define _CHN_VOICE(dev, event, chn, note, parm) \ {_SEQ_NEEDBUF(8);\ _seqbuf[_seqbufptr] = EV_CHN_VOICE;\ _seqbuf[_seqbufptr+1] = (dev);\ _seqbuf[_seqbufptr+2] = (event);\ _seqbuf[_seqbufptr+3] = (chn);\ _seqbuf[_seqbufptr+4] = (note);\ _seqbuf[_seqbufptr+5] = (parm);\ _seqbuf[_seqbufptr+6] = (0);\ _seqbuf[_seqbufptr+7] = 0;\ _SEQ_ADVBUF(8);} #define SEQ_START_NOTE(dev, chn, note, vol) \ _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol) #define SEQ_STOP_NOTE(dev, chn, note, vol) \ _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol) #define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \ _CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure) /* * Midi channel messages */ #define _CHN_COMMON(dev, event, chn, p1, p2, w14) \ {_SEQ_NEEDBUF(8);\ _seqbuf[_seqbufptr] = EV_CHN_COMMON;\ _seqbuf[_seqbufptr+1] = (dev);\ _seqbuf[_seqbufptr+2] = (event);\ _seqbuf[_seqbufptr+3] = (chn);\ _seqbuf[_seqbufptr+4] = (p1);\ _seqbuf[_seqbufptr+5] = (p2);\ *(short *)&_seqbuf[_seqbufptr+6] = (w14);\ _SEQ_ADVBUF(8);} /* * SEQ_SYSEX permits sending of sysex messages. (It may look that it permits * sending any MIDI bytes but it's absolutely not possible. Trying to do * so _will_ cause problems with MPU401 intelligent mode). * * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be * sent by calling SEQ_SYSEX() several times (there must be no other events * between them). First sysex fragment must have 0xf0 in the first byte * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte * between these sysex start and end markers cannot be larger than 0x7f. Also * lengths of each fragments (except the last one) must be 6. * * Breaking the above rules may work with some MIDI ports but is likely to * cause fatal problems with some other devices (such as MPU401). */ #define SEQ_SYSEX(dev, buf, len) \ {int ii, ll=(len); \ unsigned char *bufp=buf;\ if (ll>6)ll=6;\ _SEQ_NEEDBUF(8);\ _seqbuf[_seqbufptr] = EV_SYSEX;\ _seqbuf[_seqbufptr+1] = (dev);\ for(ii=0;ii<ll;ii++)\ _seqbuf[_seqbufptr+ii+2] = bufp[ii];\ for(ii=ll;ii<6;ii++)\ _seqbuf[_seqbufptr+ii+2] = 0xff;\ _SEQ_ADVBUF(8);} #define SEQ_CHN_PRESSURE(dev, chn, pressure) \ _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0) #define SEQ_SET_PATCH SEQ_PGM_CHANGE #define SEQ_PGM_CHANGE(dev, chn, patch) \ _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0) #define SEQ_CONTROL(dev, chn, controller, value) \ _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value) #define SEQ_BENDER(dev, chn, value) \ _CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value) #define SEQ_V2_X_CONTROL(dev, voice, controller, value) {_SEQ_NEEDBUF(8);\ _seqbuf[_seqbufptr] = SEQ_EXTENDED;\ _seqbuf[_seqbufptr+1] = SEQ_CONTROLLER;\ _seqbuf[_seqbufptr+2] = (dev);\ _seqbuf[_seqbufptr+3] = (voice);\ _seqbuf[_seqbufptr+4] = (controller);\ _seqbuf[_seqbufptr+5] = ((value)&0xff);\ _seqbuf[_seqbufptr+6] = ((value>>8)&0xff);\ _seqbuf[_seqbufptr+7] = 0;\ _SEQ_ADVBUF(8);} /* * The following 5 macros are incorrectly implemented and obsolete. * Use SEQ_BENDER and SEQ_CONTROL (with proper controller) instead. */ #define SEQ_PITCHBEND(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value) #define SEQ_BENDER_RANGE(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value) #define SEQ_EXPRESSION(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128) #define SEQ_MAIN_VOLUME(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100) #define SEQ_PANNING(dev, voice, pos) SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2) /* * Timing and synchronization macros */ #define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\ _seqbuf[_seqbufptr+0] = EV_TIMING; \ _seqbuf[_seqbufptr+1] = (ev); \ _seqbuf[_seqbufptr+2] = 0;\ _seqbuf[_seqbufptr+3] = 0;\ *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \ _SEQ_ADVBUF(8);} #define SEQ_START_TIMER() _TIMER_EVENT(TMR_START, 0) #define SEQ_STOP_TIMER() _TIMER_EVENT(TMR_STOP, 0) #define SEQ_CONTINUE_TIMER() _TIMER_EVENT(TMR_CONTINUE, 0) #define SEQ_WAIT_TIME(ticks) _TIMER_EVENT(TMR_WAIT_ABS, ticks) #define SEQ_DELTA_TIME(ticks) _TIMER_EVENT(TMR_WAIT_REL, ticks) #define SEQ_ECHO_BACK(key) _TIMER_EVENT(TMR_ECHO, key) #define SEQ_SET_TEMPO(value) _TIMER_EVENT(TMR_TEMPO, value) #define SEQ_SONGPOS(pos) _TIMER_EVENT(TMR_SPP, pos) #define SEQ_TIME_SIGNATURE(sig) _TIMER_EVENT(TMR_TIMESIG, sig) /* * Local control events */ #define _LOCAL_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\ _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \ _seqbuf[_seqbufptr+1] = (ev); \ _seqbuf[_seqbufptr+2] = 0;\ _seqbuf[_seqbufptr+3] = 0;\ *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \ _SEQ_ADVBUF(8);} #define SEQ_PLAYAUDIO(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO, devmask) /* * Events for the level 1 interface only */ #define SEQ_MIDIOUT(device, byte) {_SEQ_NEEDBUF(4);\ _seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\ _seqbuf[_seqbufptr+1] = (byte);\ _seqbuf[_seqbufptr+2] = (device);\ _seqbuf[_seqbufptr+3] = 0;\ _SEQ_ADVBUF(4);} /* * Patch loading. */ #define SEQ_WRPATCH(patchx, len) \ {if (_seqbufptr) SEQ_DUMPBUF();\ if (write(seqfd, (char*)(patchx), len)==-1) \ perror("Write patch: /dev/sequencer");} #define SEQ_WRPATCH2(patchx, len) \ (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len)) #endif /* SOUNDCARD_H */ ������������������������������������������linux/vbox_err.h������������������������������������������������������������������������������������0000644�����������������00000016131�14763166027�0007720 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: MIT */ /* Copyright (C) 2017 Oracle Corporation */ #ifndef __UAPI_VBOX_ERR_H__ #define __UAPI_VBOX_ERR_H__ #define VINF_SUCCESS 0 #define VERR_GENERAL_FAILURE (-1) #define VERR_INVALID_PARAMETER (-2) #define VERR_INVALID_MAGIC (-3) #define VERR_INVALID_HANDLE (-4) #define VERR_LOCK_FAILED (-5) #define VERR_INVALID_POINTER (-6) #define VERR_IDT_FAILED (-7) #define VERR_NO_MEMORY (-8) #define VERR_ALREADY_LOADED (-9) #define VERR_PERMISSION_DENIED (-10) #define VERR_VERSION_MISMATCH (-11) #define VERR_NOT_IMPLEMENTED (-12) #define VERR_INVALID_FLAGS (-13) #define VERR_NOT_EQUAL (-18) #define VERR_NOT_SYMLINK (-19) #define VERR_NO_TMP_MEMORY (-20) #define VERR_INVALID_FMODE (-21) #define VERR_WRONG_ORDER (-22) #define VERR_NO_TLS_FOR_SELF (-23) #define VERR_FAILED_TO_SET_SELF_TLS (-24) #define VERR_NO_CONT_MEMORY (-26) #define VERR_NO_PAGE_MEMORY (-27) #define VERR_THREAD_IS_DEAD (-29) #define VERR_THREAD_NOT_WAITABLE (-30) #define VERR_PAGE_TABLE_NOT_PRESENT (-31) #define VERR_INVALID_CONTEXT (-32) #define VERR_TIMER_BUSY (-33) #define VERR_ADDRESS_CONFLICT (-34) #define VERR_UNRESOLVED_ERROR (-35) #define VERR_INVALID_FUNCTION (-36) #define VERR_NOT_SUPPORTED (-37) #define VERR_ACCESS_DENIED (-38) #define VERR_INTERRUPTED (-39) #define VERR_TIMEOUT (-40) #define VERR_BUFFER_OVERFLOW (-41) #define VERR_TOO_MUCH_DATA (-42) #define VERR_MAX_THRDS_REACHED (-43) #define VERR_MAX_PROCS_REACHED (-44) #define VERR_SIGNAL_REFUSED (-45) #define VERR_SIGNAL_PENDING (-46) #define VERR_SIGNAL_INVALID (-47) #define VERR_STATE_CHANGED (-48) #define VERR_INVALID_UUID_FORMAT (-49) #define VERR_PROCESS_NOT_FOUND (-50) #define VERR_PROCESS_RUNNING (-51) #define VERR_TRY_AGAIN (-52) #define VERR_PARSE_ERROR (-53) #define VERR_OUT_OF_RANGE (-54) #define VERR_NUMBER_TOO_BIG (-55) #define VERR_NO_DIGITS (-56) #define VERR_NEGATIVE_UNSIGNED (-57) #define VERR_NO_TRANSLATION (-58) #define VERR_NOT_FOUND (-78) #define VERR_INVALID_STATE (-79) #define VERR_OUT_OF_RESOURCES (-80) #define VERR_FILE_NOT_FOUND (-102) #define VERR_PATH_NOT_FOUND (-103) #define VERR_INVALID_NAME (-104) #define VERR_ALREADY_EXISTS (-105) #define VERR_TOO_MANY_OPEN_FILES (-106) #define VERR_SEEK (-107) #define VERR_NEGATIVE_SEEK (-108) #define VERR_SEEK_ON_DEVICE (-109) #define VERR_EOF (-110) #define VERR_READ_ERROR (-111) #define VERR_WRITE_ERROR (-112) #define VERR_WRITE_PROTECT (-113) #define VERR_SHARING_VIOLATION (-114) #define VERR_FILE_LOCK_FAILED (-115) #define VERR_FILE_LOCK_VIOLATION (-116) #define VERR_CANT_CREATE (-117) #define VERR_CANT_DELETE_DIRECTORY (-118) #define VERR_NOT_SAME_DEVICE (-119) #define VERR_FILENAME_TOO_LONG (-120) #define VERR_MEDIA_NOT_PRESENT (-121) #define VERR_MEDIA_NOT_RECOGNIZED (-122) #define VERR_FILE_NOT_LOCKED (-123) #define VERR_FILE_LOCK_LOST (-124) #define VERR_DIR_NOT_EMPTY (-125) #define VERR_NOT_A_DIRECTORY (-126) #define VERR_IS_A_DIRECTORY (-127) #define VERR_FILE_TOO_BIG (-128) #define VERR_NET_IO_ERROR (-400) #define VERR_NET_OUT_OF_RESOURCES (-401) #define VERR_NET_HOST_NOT_FOUND (-402) #define VERR_NET_PATH_NOT_FOUND (-403) #define VERR_NET_PRINT_ERROR (-404) #define VERR_NET_NO_NETWORK (-405) #define VERR_NET_NOT_UNIQUE_NAME (-406) #define VERR_NET_IN_PROGRESS (-436) #define VERR_NET_ALREADY_IN_PROGRESS (-437) #define VERR_NET_NOT_SOCKET (-438) #define VERR_NET_DEST_ADDRESS_REQUIRED (-439) #define VERR_NET_MSG_SIZE (-440) #define VERR_NET_PROTOCOL_TYPE (-441) #define VERR_NET_PROTOCOL_NOT_AVAILABLE (-442) #define VERR_NET_PROTOCOL_NOT_SUPPORTED (-443) #define VERR_NET_SOCKET_TYPE_NOT_SUPPORTED (-444) #define VERR_NET_OPERATION_NOT_SUPPORTED (-445) #define VERR_NET_PROTOCOL_FAMILY_NOT_SUPPORTED (-446) #define VERR_NET_ADDRESS_FAMILY_NOT_SUPPORTED (-447) #define VERR_NET_ADDRESS_IN_USE (-448) #define VERR_NET_ADDRESS_NOT_AVAILABLE (-449) #define VERR_NET_DOWN (-450) #define VERR_NET_UNREACHABLE (-451) #define VERR_NET_CONNECTION_RESET (-452) #define VERR_NET_CONNECTION_ABORTED (-453) #define VERR_NET_CONNECTION_RESET_BY_PEER (-454) #define VERR_NET_NO_BUFFER_SPACE (-455) #define VERR_NET_ALREADY_CONNECTED (-456) #define VERR_NET_NOT_CONNECTED (-457) #define VERR_NET_SHUTDOWN (-458) #define VERR_NET_TOO_MANY_REFERENCES (-459) #define VERR_NET_CONNECTION_TIMED_OUT (-460) #define VERR_NET_CONNECTION_REFUSED (-461) #define VERR_NET_HOST_DOWN (-464) #define VERR_NET_HOST_UNREACHABLE (-465) #define VERR_NET_PROTOCOL_ERROR (-466) #define VERR_NET_INCOMPLETE_TX_PACKET (-467) /* misc. unsorted codes */ #define VERR_RESOURCE_BUSY (-138) #define VERR_DISK_FULL (-152) #define VERR_TOO_MANY_SYMLINKS (-156) #define VERR_NO_MORE_FILES (-201) #define VERR_INTERNAL_ERROR (-225) #define VERR_INTERNAL_ERROR_2 (-226) #define VERR_INTERNAL_ERROR_3 (-227) #define VERR_INTERNAL_ERROR_4 (-228) #define VERR_DEV_IO_ERROR (-250) #define VERR_IO_BAD_LENGTH (-255) #define VERR_BROKEN_PIPE (-301) #define VERR_NO_DATA (-304) #define VERR_SEM_DESTROYED (-363) #define VERR_DEADLOCK (-365) #define VERR_BAD_EXE_FORMAT (-608) #define VINF_HGCM_ASYNC_EXECUTE (2903) #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/kexec.h���������������������������������������������������������������������������������������0000644�����������������00000003453�14763166027�0007174 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef LINUX_KEXEC_H #define LINUX_KEXEC_H /* kexec system call - It loads the new kernel to boot into. * kexec does not sync, or unmount filesystems so if you need * that to happen you need to do that yourself. */ #include <linux/types.h> /* kexec flags for different usage scenarios */ #define KEXEC_ON_CRASH 0x00000001 #define KEXEC_PRESERVE_CONTEXT 0x00000002 #define KEXEC_ARCH_MASK 0xffff0000 /* * Kexec file load interface flags. * KEXEC_FILE_UNLOAD : Unload already loaded kexec/kdump image. * KEXEC_FILE_ON_CRASH : Load/unload operation belongs to kdump image. * KEXEC_FILE_NO_INITRAMFS : No initramfs is being loaded. Ignore the initrd * fd field. */ #define KEXEC_FILE_UNLOAD 0x00000001 #define KEXEC_FILE_ON_CRASH 0x00000002 #define KEXEC_FILE_NO_INITRAMFS 0x00000004 /* These values match the ELF architecture values. * Unless there is a good reason that should continue to be the case. */ #define KEXEC_ARCH_DEFAULT ( 0 << 16) #define KEXEC_ARCH_386 ( 3 << 16) #define KEXEC_ARCH_68K ( 4 << 16) #define KEXEC_ARCH_X86_64 (62 << 16) #define KEXEC_ARCH_PPC (20 << 16) #define KEXEC_ARCH_PPC64 (21 << 16) #define KEXEC_ARCH_IA_64 (50 << 16) #define KEXEC_ARCH_ARM (40 << 16) #define KEXEC_ARCH_S390 (22 << 16) #define KEXEC_ARCH_SH (42 << 16) #define KEXEC_ARCH_MIPS_LE (10 << 16) #define KEXEC_ARCH_MIPS ( 8 << 16) #define KEXEC_ARCH_AARCH64 (183 << 16) /* The artificial cap on the number of segments passed to kexec_load. */ #define KEXEC_SEGMENT_MAX 16 /* * This structure is used to hold the arguments that are used when * loading kernel binaries. */ struct kexec_segment { const void *buf; size_t bufsz; const void *mem; size_t memsz; }; #endif /* LINUX_KEXEC_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/tty_flags.h�����������������������������������������������������������������������������������0000644�����������������00000010577�14763166027�0010076 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_TTY_FLAGS_H #define _LINUX_TTY_FLAGS_H /* * Definitions for async_struct (and serial_struct) flags field also * shared by the tty_port flags structures. * * Define ASYNCB_* for convenient use with {test,set,clear}_bit. * * Bits [0..ASYNCB_LAST_USER] are userspace defined/visible/changeable * [x] in the bit comments indicates the flag is defunct and no longer used. */ #define ASYNCB_HUP_NOTIFY 0 /* Notify getty on hangups and closes * on the callout port */ #define ASYNCB_FOURPORT 1 /* Set OUT1, OUT2 per AST Fourport settings */ #define ASYNCB_SAK 2 /* Secure Attention Key (Orange book) */ #define ASYNCB_SPLIT_TERMIOS 3 /* [x] Separate termios for dialin/callout */ #define ASYNCB_SPD_HI 4 /* Use 57600 instead of 38400 bps */ #define ASYNCB_SPD_VHI 5 /* Use 115200 instead of 38400 bps */ #define ASYNCB_SKIP_TEST 6 /* Skip UART test during autoconfiguration */ #define ASYNCB_AUTO_IRQ 7 /* Do automatic IRQ during * autoconfiguration */ #define ASYNCB_SESSION_LOCKOUT 8 /* [x] Lock out cua opens based on session */ #define ASYNCB_PGRP_LOCKOUT 9 /* [x] Lock out cua opens based on pgrp */ #define ASYNCB_CALLOUT_NOHUP 10 /* [x] Don't do hangups for cua device */ #define ASYNCB_HARDPPS_CD 11 /* Call hardpps when CD goes high */ #define ASYNCB_SPD_SHI 12 /* Use 230400 instead of 38400 bps */ #define ASYNCB_LOW_LATENCY 13 /* Request low latency behaviour */ #define ASYNCB_BUGGY_UART 14 /* This is a buggy UART, skip some safety * checks. Note: can be dangerous! */ #define ASYNCB_AUTOPROBE 15 /* [x] Port was autoprobed by PCI/PNP code */ #define ASYNCB_MAGIC_MULTIPLIER 16 /* Use special CLK or divisor */ #define ASYNCB_LAST_USER 16 /* * Internal flags used only by kernel (read-only) * * WARNING: These flags are no longer used and have been superceded by the * TTY_PORT_ flags in the iflags field (and not userspace-visible) */ #define ASYNCB_INITIALIZED 31 /* Serial port was initialized */ #define ASYNCB_SUSPENDED 30 /* Serial port is suspended */ #define ASYNCB_NORMAL_ACTIVE 29 /* Normal device is active */ #define ASYNCB_BOOT_AUTOCONF 28 /* Autoconfigure port on bootup */ #define ASYNCB_CLOSING 27 /* Serial port is closing */ #define ASYNCB_CTS_FLOW 26 /* Do CTS flow control */ #define ASYNCB_CHECK_CD 25 /* i.e., CLOCAL */ #define ASYNCB_SHARE_IRQ 24 /* for multifunction cards, no longer used */ #define ASYNCB_CONS_FLOW 23 /* flow control for console */ #define ASYNCB_FIRST_KERNEL 22 /* Masks */ #define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY) #define ASYNC_SUSPENDED (1U << ASYNCB_SUSPENDED) #define ASYNC_FOURPORT (1U << ASYNCB_FOURPORT) #define ASYNC_SAK (1U << ASYNCB_SAK) #define ASYNC_SPLIT_TERMIOS (1U << ASYNCB_SPLIT_TERMIOS) #define ASYNC_SPD_HI (1U << ASYNCB_SPD_HI) #define ASYNC_SPD_VHI (1U << ASYNCB_SPD_VHI) #define ASYNC_SKIP_TEST (1U << ASYNCB_SKIP_TEST) #define ASYNC_AUTO_IRQ (1U << ASYNCB_AUTO_IRQ) #define ASYNC_SESSION_LOCKOUT (1U << ASYNCB_SESSION_LOCKOUT) #define ASYNC_PGRP_LOCKOUT (1U << ASYNCB_PGRP_LOCKOUT) #define ASYNC_CALLOUT_NOHUP (1U << ASYNCB_CALLOUT_NOHUP) #define ASYNC_HARDPPS_CD (1U << ASYNCB_HARDPPS_CD) #define ASYNC_SPD_SHI (1U << ASYNCB_SPD_SHI) #define ASYNC_LOW_LATENCY (1U << ASYNCB_LOW_LATENCY) #define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART) #define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE) #define ASYNC_MAGIC_MULTIPLIER (1U << ASYNCB_MAGIC_MULTIPLIER) #define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1) #define ASYNC_DEPRECATED (ASYNC_SESSION_LOCKOUT | ASYNC_PGRP_LOCKOUT | \ ASYNC_CALLOUT_NOHUP | ASYNC_AUTOPROBE) #define ASYNC_USR_MASK (ASYNC_SPD_MASK|ASYNC_CALLOUT_NOHUP| \ ASYNC_LOW_LATENCY) #define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI) #define ASYNC_SPD_WARP (ASYNC_SPD_HI|ASYNC_SPD_SHI) #define ASYNC_SPD_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI|ASYNC_SPD_SHI) /* These flags are no longer used (and were always masked from userspace) */ #define ASYNC_INITIALIZED (1U << ASYNCB_INITIALIZED) #define ASYNC_NORMAL_ACTIVE (1U << ASYNCB_NORMAL_ACTIVE) #define ASYNC_BOOT_AUTOCONF (1U << ASYNCB_BOOT_AUTOCONF) #define ASYNC_CLOSING (1U << ASYNCB_CLOSING) #define ASYNC_CTS_FLOW (1U << ASYNCB_CTS_FLOW) #define ASYNC_CHECK_CD (1U << ASYNCB_CHECK_CD) #define ASYNC_SHARE_IRQ (1U << ASYNCB_SHARE_IRQ) #define ASYNC_CONS_FLOW (1U << ASYNCB_CONS_FLOW) #define ASYNC_INTERNAL_FLAGS (~((1U << ASYNCB_FIRST_KERNEL) - 1)) #endif ���������������������������������������������������������������������������������������������������������������������������������linux/shm.h�����������������������������������������������������������������������������������������0000644�����������������00000007311�14763166027�0006661 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SHM_H_ #define _LINUX_SHM_H_ #include <linux/ipc.h> #include <linux/errno.h> #include <asm-generic/hugetlb_encode.h> #include <unistd.h> /* * SHMMNI, SHMMAX and SHMALL are default upper limits which can be * modified by sysctl. The SHMMAX and SHMALL values have been chosen to * be as large possible without facilitating scenarios where userspace * causes overflows when adjusting the limits via operations of the form * "retrieve current limit; add X; update limit". It is therefore not * advised to make SHMMAX and SHMALL any larger. These limits are * suitable for both 32 and 64-bit systems. */ #define SHMMIN 1 /* min shared seg size (bytes) */ #define SHMMNI 4096 /* max num of segs system wide */ #define SHMMAX (ULONG_MAX - (1UL << 24)) /* max shared seg size (bytes) */ #define SHMALL (ULONG_MAX - (1UL << 24)) /* max shm system wide (pages) */ #define SHMSEG SHMMNI /* max shared segs per process */ /* Obsolete, used only for backwards compatibility and libc5 compiles */ struct shmid_ds { struct ipc_perm shm_perm; /* operation perms */ int shm_segsz; /* size of segment (bytes) */ __kernel_time_t shm_atime; /* last attach time */ __kernel_time_t shm_dtime; /* last detach time */ __kernel_time_t shm_ctime; /* last change time */ __kernel_ipc_pid_t shm_cpid; /* pid of creator */ __kernel_ipc_pid_t shm_lpid; /* pid of last operator */ unsigned short shm_nattch; /* no. of current attaches */ unsigned short shm_unused; /* compatibility */ void *shm_unused2; /* ditto - used by DIPC */ void *shm_unused3; /* unused */ }; /* Include the definition of shmid64_ds and shminfo64 */ #include <asm/shmbuf.h> /* * shmget() shmflg values. */ /* The bottom nine bits are the same as open(2) mode flags */ #define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */ #define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */ /* Bits 9 & 10 are IPC_CREAT and IPC_EXCL */ #define SHM_HUGETLB 04000 /* segment will use huge TLB pages */ #define SHM_NORESERVE 010000 /* don't check for reservations */ /* * Huge page size encoding when SHM_HUGETLB is specified, and a huge page * size other than the default is desired. See hugetlb_encode.h */ #define SHM_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT #define SHM_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK #define SHM_HUGE_64KB HUGETLB_FLAG_ENCODE_64KB #define SHM_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB #define SHM_HUGE_1MB HUGETLB_FLAG_ENCODE_1MB #define SHM_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB #define SHM_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB #define SHM_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB #define SHM_HUGE_32MB HUGETLB_FLAG_ENCODE_32MB #define SHM_HUGE_256MB HUGETLB_FLAG_ENCODE_256MB #define SHM_HUGE_512MB HUGETLB_FLAG_ENCODE_512MB #define SHM_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB #define SHM_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB #define SHM_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB /* * shmat() shmflg values */ #define SHM_RDONLY 010000 /* read-only access */ #define SHM_RND 020000 /* round attach address to SHMLBA boundary */ #define SHM_REMAP 040000 /* take-over region on attach */ #define SHM_EXEC 0100000 /* execution access */ /* super user shmctl commands */ #define SHM_LOCK 11 #define SHM_UNLOCK 12 /* ipcs ctl commands */ #define SHM_STAT 13 #define SHM_INFO 14 #define SHM_STAT_ANY 15 /* Obsolete, used only for backwards compatibility */ struct shminfo { int shmmax; int shmmin; int shmmni; int shmseg; int shmall; }; struct shm_info { int used_ids; __kernel_ulong_t shm_tot; /* total allocated shm */ __kernel_ulong_t shm_rss; /* total resident shm */ __kernel_ulong_t shm_swp; /* total swapped shm */ __kernel_ulong_t swap_attempts; __kernel_ulong_t swap_successes; }; #endif /* _LINUX_SHM_H_ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/sonet.h���������������������������������������������������������������������������������������0000644�����������������00000004362�14763166027�0007225 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* sonet.h - SONET/SHD physical layer control */ /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ #ifndef LINUX_SONET_H #define LINUX_SONET_H #define __SONET_ITEMS \ __HANDLE_ITEM(section_bip); /* section parity errors (B1) */ \ __HANDLE_ITEM(line_bip); /* line parity errors (B2) */ \ __HANDLE_ITEM(path_bip); /* path parity errors (B3) */ \ __HANDLE_ITEM(line_febe); /* line parity errors at remote */ \ __HANDLE_ITEM(path_febe); /* path parity errors at remote */ \ __HANDLE_ITEM(corr_hcs); /* correctable header errors */ \ __HANDLE_ITEM(uncorr_hcs); /* uncorrectable header errors */ \ __HANDLE_ITEM(tx_cells); /* cells sent */ \ __HANDLE_ITEM(rx_cells); /* cells received */ struct sonet_stats { #define __HANDLE_ITEM(i) int i __SONET_ITEMS #undef __HANDLE_ITEM } __attribute__ ((packed)); #define SONET_GETSTAT _IOR('a',ATMIOC_PHYTYP,struct sonet_stats) /* get statistics */ #define SONET_GETSTATZ _IOR('a',ATMIOC_PHYTYP+1,struct sonet_stats) /* ... and zero counters */ #define SONET_SETDIAG _IOWR('a',ATMIOC_PHYTYP+2,int) /* set error insertion */ #define SONET_CLRDIAG _IOWR('a',ATMIOC_PHYTYP+3,int) /* clear error insertion */ #define SONET_GETDIAG _IOR('a',ATMIOC_PHYTYP+4,int) /* query error insertion */ #define SONET_SETFRAMING _IOW('a',ATMIOC_PHYTYP+5,int) /* set framing mode (SONET/SDH) */ #define SONET_GETFRAMING _IOR('a',ATMIOC_PHYTYP+6,int) /* get framing mode */ #define SONET_GETFRSENSE _IOR('a',ATMIOC_PHYTYP+7, \ unsigned char[SONET_FRSENSE_SIZE]) /* get framing sense information */ #define SONET_INS_SBIP 1 /* section BIP */ #define SONET_INS_LBIP 2 /* line BIP */ #define SONET_INS_PBIP 4 /* path BIP */ #define SONET_INS_FRAME 8 /* out of frame */ #define SONET_INS_LOS 16 /* set line to zero */ #define SONET_INS_LAIS 32 /* line alarm indication signal */ #define SONET_INS_PAIS 64 /* path alarm indication signal */ #define SONET_INS_HCS 128 /* insert HCS error */ #define SONET_FRAME_SONET 0 /* SONET STS-3 framing */ #define SONET_FRAME_SDH 1 /* SDH STM-1 framing */ #define SONET_FRSENSE_SIZE 6 /* C1[3],H1[3] (0xff for unknown) */ #endif /* LINUX_SONET_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/radeonfb.h������������������������������������������������������������������������������������0000644�����������������00000000550�14763166027�0007650 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_RADEONFB_H__ #define __LINUX_RADEONFB_H__ #include <asm/ioctl.h> #include <linux/types.h> #define ATY_RADEON_LCD_ON 0x00000001 #define ATY_RADEON_CRT_ON 0x00000002 #define FBIO_RADEON_GET_MIRROR _IOR('@', 3, size_t) #define FBIO_RADEON_SET_MIRROR _IOW('@', 4, size_t) #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������linux/in6.h�����������������������������������������������������������������������������������������0000644�����������������00000016416�14763166027�0006574 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Types and definitions for AF_INET6 * Linux INET6 implementation * * Authors: * Pedro Roque <roque@di.fc.ul.pt> * * Sources: * IPv6 Program Interfaces for BSD Systems * <draft-ietf-ipngwg-bsd-api-05.txt> * * Advanced Sockets API for IPv6 * <draft-stevens-advanced-api-00.txt> * * 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. */ #ifndef _LINUX_IN6_H #define _LINUX_IN6_H #include <linux/types.h> #include <linux/libc-compat.h> /* * IPv6 address structure */ #if __UAPI_DEF_IN6_ADDR struct in6_addr { union { __u8 u6_addr8[16]; #if __UAPI_DEF_IN6_ADDR_ALT __be16 u6_addr16[8]; __be32 u6_addr32[4]; #endif } in6_u; #define s6_addr in6_u.u6_addr8 #if __UAPI_DEF_IN6_ADDR_ALT #define s6_addr16 in6_u.u6_addr16 #define s6_addr32 in6_u.u6_addr32 #endif }; #endif /* __UAPI_DEF_IN6_ADDR */ #if __UAPI_DEF_SOCKADDR_IN6 struct sockaddr_in6 { unsigned short int sin6_family; /* AF_INET6 */ __be16 sin6_port; /* Transport layer port # */ __be32 sin6_flowinfo; /* IPv6 flow information */ struct in6_addr sin6_addr; /* IPv6 address */ __u32 sin6_scope_id; /* scope id (new in RFC2553) */ }; #endif /* __UAPI_DEF_SOCKADDR_IN6 */ #if __UAPI_DEF_IPV6_MREQ struct ipv6_mreq { /* IPv6 multicast address of group */ struct in6_addr ipv6mr_multiaddr; /* local IPv6 address of interface */ int ipv6mr_ifindex; }; #endif /* __UAPI_DEF_IVP6_MREQ */ #define ipv6mr_acaddr ipv6mr_multiaddr struct in6_flowlabel_req { struct in6_addr flr_dst; __be32 flr_label; __u8 flr_action; __u8 flr_share; __u16 flr_flags; __u16 flr_expires; __u16 flr_linger; __u32 __flr_pad; /* Options in format of IPV6_PKTOPTIONS */ }; #define IPV6_FL_A_GET 0 #define IPV6_FL_A_PUT 1 #define IPV6_FL_A_RENEW 2 #define IPV6_FL_F_CREATE 1 #define IPV6_FL_F_EXCL 2 #define IPV6_FL_F_REFLECT 4 #define IPV6_FL_F_REMOTE 8 #define IPV6_FL_S_NONE 0 #define IPV6_FL_S_EXCL 1 #define IPV6_FL_S_PROCESS 2 #define IPV6_FL_S_USER 3 #define IPV6_FL_S_ANY 255 /* * Bitmask constant declarations to help applications select out the * flow label and priority fields. * * Note that this are in host byte order while the flowinfo field of * sockaddr_in6 is in network byte order. */ #define IPV6_FLOWINFO_FLOWLABEL 0x000fffff #define IPV6_FLOWINFO_PRIORITY 0x0ff00000 /* These definitions are obsolete */ #define IPV6_PRIORITY_UNCHARACTERIZED 0x0000 #define IPV6_PRIORITY_FILLER 0x0100 #define IPV6_PRIORITY_UNATTENDED 0x0200 #define IPV6_PRIORITY_RESERVED1 0x0300 #define IPV6_PRIORITY_BULK 0x0400 #define IPV6_PRIORITY_RESERVED2 0x0500 #define IPV6_PRIORITY_INTERACTIVE 0x0600 #define IPV6_PRIORITY_CONTROL 0x0700 #define IPV6_PRIORITY_8 0x0800 #define IPV6_PRIORITY_9 0x0900 #define IPV6_PRIORITY_10 0x0a00 #define IPV6_PRIORITY_11 0x0b00 #define IPV6_PRIORITY_12 0x0c00 #define IPV6_PRIORITY_13 0x0d00 #define IPV6_PRIORITY_14 0x0e00 #define IPV6_PRIORITY_15 0x0f00 /* * IPV6 extension headers */ #if __UAPI_DEF_IPPROTO_V6 #define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */ #define IPPROTO_ROUTING 43 /* IPv6 routing header */ #define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */ #define IPPROTO_ICMPV6 58 /* ICMPv6 */ #define IPPROTO_NONE 59 /* IPv6 no next header */ #define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ #define IPPROTO_MH 135 /* IPv6 mobility header */ #endif /* __UAPI_DEF_IPPROTO_V6 */ /* * IPv6 TLV options. */ #define IPV6_TLV_PAD1 0 #define IPV6_TLV_PADN 1 #define IPV6_TLV_ROUTERALERT 5 #define IPV6_TLV_CALIPSO 7 /* RFC 5570 */ #define IPV6_TLV_JUMBO 194 #define IPV6_TLV_HAO 201 /* home address option */ /* * IPV6 socket options */ #if __UAPI_DEF_IPV6_OPTIONS #define IPV6_ADDRFORM 1 #define IPV6_2292PKTINFO 2 #define IPV6_2292HOPOPTS 3 #define IPV6_2292DSTOPTS 4 #define IPV6_2292RTHDR 5 #define IPV6_2292PKTOPTIONS 6 #define IPV6_CHECKSUM 7 #define IPV6_2292HOPLIMIT 8 #define IPV6_NEXTHOP 9 #define IPV6_AUTHHDR 10 /* obsolete */ #define IPV6_FLOWINFO 11 #define IPV6_UNICAST_HOPS 16 #define IPV6_MULTICAST_IF 17 #define IPV6_MULTICAST_HOPS 18 #define IPV6_MULTICAST_LOOP 19 #define IPV6_ADD_MEMBERSHIP 20 #define IPV6_DROP_MEMBERSHIP 21 #define IPV6_ROUTER_ALERT 22 #define IPV6_MTU_DISCOVER 23 #define IPV6_MTU 24 #define IPV6_RECVERR 25 #define IPV6_V6ONLY 26 #define IPV6_JOIN_ANYCAST 27 #define IPV6_LEAVE_ANYCAST 28 /* IPV6_MTU_DISCOVER values */ #define IPV6_PMTUDISC_DONT 0 #define IPV6_PMTUDISC_WANT 1 #define IPV6_PMTUDISC_DO 2 #define IPV6_PMTUDISC_PROBE 3 /* same as IPV6_PMTUDISC_PROBE, provided for symetry with IPv4 * also see comments on IP_PMTUDISC_INTERFACE */ #define IPV6_PMTUDISC_INTERFACE 4 /* weaker version of IPV6_PMTUDISC_INTERFACE, which allows packets to * get fragmented if they exceed the interface mtu */ #define IPV6_PMTUDISC_OMIT 5 /* Flowlabel */ #define IPV6_FLOWLABEL_MGR 32 #define IPV6_FLOWINFO_SEND 33 #define IPV6_IPSEC_POLICY 34 #define IPV6_XFRM_POLICY 35 #define IPV6_HDRINCL 36 #endif /* * Multicast: * Following socket options are shared between IPv4 and IPv6. * * MCAST_JOIN_GROUP 42 * MCAST_BLOCK_SOURCE 43 * MCAST_UNBLOCK_SOURCE 44 * MCAST_LEAVE_GROUP 45 * MCAST_JOIN_SOURCE_GROUP 46 * MCAST_LEAVE_SOURCE_GROUP 47 * MCAST_MSFILTER 48 */ /* * Advanced API (RFC3542) (1) * * Note: IPV6_RECVRTHDRDSTOPTS does not exist. see net/ipv6/datagram.c. */ #define IPV6_RECVPKTINFO 49 #define IPV6_PKTINFO 50 #define IPV6_RECVHOPLIMIT 51 #define IPV6_HOPLIMIT 52 #define IPV6_RECVHOPOPTS 53 #define IPV6_HOPOPTS 54 #define IPV6_RTHDRDSTOPTS 55 #define IPV6_RECVRTHDR 56 #define IPV6_RTHDR 57 #define IPV6_RECVDSTOPTS 58 #define IPV6_DSTOPTS 59 #define IPV6_RECVPATHMTU 60 #define IPV6_PATHMTU 61 #define IPV6_DONTFRAG 62 #if 0 /* not yet */ #define IPV6_USE_MIN_MTU 63 #endif /* * Netfilter (1) * * Following socket options are used in ip6_tables; * see include/linux/netfilter_ipv6/ip6_tables.h. * * IP6T_SO_SET_REPLACE / IP6T_SO_GET_INFO 64 * IP6T_SO_SET_ADD_COUNTERS / IP6T_SO_GET_ENTRIES 65 */ /* * Advanced API (RFC3542) (2) */ #define IPV6_RECVTCLASS 66 #define IPV6_TCLASS 67 /* * Netfilter (2) * * Following socket options are used in ip6_tables; * see include/linux/netfilter_ipv6/ip6_tables.h. * * IP6T_SO_GET_REVISION_MATCH 68 * IP6T_SO_GET_REVISION_TARGET 69 * IP6T_SO_ORIGINAL_DST 80 */ #define IPV6_AUTOFLOWLABEL 70 /* RFC5014: Source address selection */ #define IPV6_ADDR_PREFERENCES 72 #define IPV6_PREFER_SRC_TMP 0x0001 #define IPV6_PREFER_SRC_PUBLIC 0x0002 #define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100 #define IPV6_PREFER_SRC_COA 0x0004 #define IPV6_PREFER_SRC_HOME 0x0400 #define IPV6_PREFER_SRC_CGA 0x0008 #define IPV6_PREFER_SRC_NONCGA 0x0800 /* RFC5082: Generalized Ttl Security Mechanism */ #define IPV6_MINHOPCOUNT 73 #define IPV6_ORIGDSTADDR 74 #define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR #define IPV6_TRANSPARENT 75 #define IPV6_UNICAST_IF 76 #define IPV6_RECVFRAGSIZE 77 #define IPV6_FREEBIND 78 /* * Multicast Routing: * see include/uapi/linux/mroute6.h. * * MRT6_BASE 200 * ... * MRT6_MAX */ #endif /* _LINUX_IN6_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/rpmsg.h���������������������������������������������������������������������������������������0000644�����������������00000001040�14763166027�0007213 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (c) 2016, Linaro Ltd. */ #ifndef _RPMSG_H_ #define _RPMSG_H_ #include <linux/ioctl.h> #include <linux/types.h> /** * struct rpmsg_endpoint_info - endpoint info representation * @name: name of service * @src: local address * @dst: destination address */ struct rpmsg_endpoint_info { char name[32]; __u32 src; __u32 dst; }; #define RPMSG_CREATE_EPT_IOCTL _IOW(0xb5, 0x1, struct rpmsg_endpoint_info) #define RPMSG_DESTROY_EPT_IOCTL _IO(0xb5, 0x2) #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_tun.h��������������������������������������������������������������������������������������0000644�����������������00000007663�14763166027�0007370 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Universal TUN/TAP device driver. * Copyright (C) 1999-2000 Maxim Krasnyansky <max_mk@yahoo.com> * * 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. */ #ifndef __IF_TUN_H #define __IF_TUN_H #include <linux/types.h> #include <linux/if_ether.h> #include <linux/filter.h> /* Read queue size */ #define TUN_READQ_SIZE 500 /* TUN device type flags: deprecated. Use IFF_TUN/IFF_TAP instead. */ #define TUN_TUN_DEV IFF_TUN #define TUN_TAP_DEV IFF_TAP #define TUN_TYPE_MASK 0x000f /* Ioctl defines */ #define TUNSETNOCSUM _IOW('T', 200, int) #define TUNSETDEBUG _IOW('T', 201, int) #define TUNSETIFF _IOW('T', 202, int) #define TUNSETPERSIST _IOW('T', 203, int) #define TUNSETOWNER _IOW('T', 204, int) #define TUNSETLINK _IOW('T', 205, int) #define TUNSETGROUP _IOW('T', 206, int) #define TUNGETFEATURES _IOR('T', 207, unsigned int) #define TUNSETOFFLOAD _IOW('T', 208, unsigned int) #define TUNSETTXFILTER _IOW('T', 209, unsigned int) #define TUNGETIFF _IOR('T', 210, unsigned int) #define TUNGETSNDBUF _IOR('T', 211, int) #define TUNSETSNDBUF _IOW('T', 212, int) #define TUNATTACHFILTER _IOW('T', 213, struct sock_fprog) #define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog) #define TUNGETVNETHDRSZ _IOR('T', 215, int) #define TUNSETVNETHDRSZ _IOW('T', 216, int) #define TUNSETQUEUE _IOW('T', 217, int) #define TUNSETIFINDEX _IOW('T', 218, unsigned int) #define TUNGETFILTER _IOR('T', 219, struct sock_fprog) #define TUNSETVNETLE _IOW('T', 220, int) #define TUNGETVNETLE _IOR('T', 221, int) /* The TUNSETVNETBE and TUNGETVNETBE ioctls are for cross-endian support on * little-endian hosts. Not all kernel configurations support them, but all * configurations that support SET also support GET. */ #define TUNSETVNETBE _IOW('T', 222, int) #define TUNGETVNETBE _IOR('T', 223, int) #define TUNSETSTEERINGEBPF _IOR('T', 224, int) #define TUNSETFILTEREBPF _IOR('T', 225, int) /* TUNSETIFF ifr flags */ #define IFF_TUN 0x0001 #define IFF_TAP 0x0002 #define IFF_NAPI 0x0010 #define IFF_NAPI_FRAGS 0x0020 #define IFF_NO_PI 0x1000 /* This flag has no real effect */ #define IFF_ONE_QUEUE 0x2000 #define IFF_VNET_HDR 0x4000 #define IFF_TUN_EXCL 0x8000 #define IFF_MULTI_QUEUE 0x0100 #define IFF_ATTACH_QUEUE 0x0200 #define IFF_DETACH_QUEUE 0x0400 /* read-only flag */ #define IFF_PERSIST 0x0800 #define IFF_NOFILTER 0x1000 /* Socket options */ #define TUN_TX_TIMESTAMP 1 /* Features for GSO (TUNSETOFFLOAD). */ #define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */ #define TUN_F_TSO4 0x02 /* I can handle TSO for IPv4 packets */ #define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */ #define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */ #define TUN_F_UFO 0x10 /* I can handle UFO packets */ /* Protocol info prepended to the packets (when IFF_NO_PI is not set) */ #define TUN_PKT_STRIP 0x0001 struct tun_pi { __u16 flags; __be16 proto; }; /* * Filter spec (used for SETXXFILTER ioctls) * This stuff is applicable only to the TAP (Ethernet) devices. * If the count is zero the filter is disabled and the driver accepts * all packets (promisc mode). * If the filter is enabled in order to accept broadcast packets * broadcast addr must be explicitly included in the addr list. */ #define TUN_FLT_ALLMULTI 0x0001 /* Accept all multicast packets */ struct tun_filter { __u16 flags; /* TUN_FLT_ flags see above */ __u16 count; /* Number of addresses */ __u8 addr[0][ETH_ALEN]; }; #endif /* __IF_TUN_H */ �����������������������������������������������������������������������������linux/fou.h�����������������������������������������������������������������������������������������0000644�����������������00000001266�14763166027�0006666 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* fou.h - FOU Interface */ #ifndef _LINUX_FOU_H #define _LINUX_FOU_H /* NETLINK_GENERIC related info */ #define FOU_GENL_NAME "fou" #define FOU_GENL_VERSION 0x1 enum { FOU_ATTR_UNSPEC, FOU_ATTR_PORT, /* u16 */ FOU_ATTR_AF, /* u8 */ FOU_ATTR_IPPROTO, /* u8 */ FOU_ATTR_TYPE, /* u8 */ FOU_ATTR_REMCSUM_NOPARTIAL, /* flag */ __FOU_ATTR_MAX, }; #define FOU_ATTR_MAX (__FOU_ATTR_MAX - 1) enum { FOU_CMD_UNSPEC, FOU_CMD_ADD, FOU_CMD_DEL, FOU_CMD_GET, __FOU_CMD_MAX, }; enum { FOU_ENCAP_UNSPEC, FOU_ENCAP_DIRECT, FOU_ENCAP_GUE, }; #define FOU_CMD_MAX (__FOU_CMD_MAX - 1) #endif /* _LINUX_FOU_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/vsockmon.h������������������������������������������������������������������������������������0000644�����������������00000003535�14763166027�0007735 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _VSOCKMON_H #define _VSOCKMON_H #include <linux/virtio_vsock.h> /* * vsockmon is the AF_VSOCK packet capture device. Packets captured have the * following layout: * * +-----------------------------------+ * | vsockmon header | * | (struct af_vsockmon_hdr) | * +-----------------------------------+ * | transport header | * | (af_vsockmon_hdr->len bytes long) | * +-----------------------------------+ * | payload | * | (until end of packet) | * +-----------------------------------+ * * The vsockmon header is a transport-independent description of the packet. * It duplicates some of the information from the transport header so that * no transport-specific knowledge is necessary to process packets. * * The transport header is useful for low-level transport-specific packet * analysis. Transport type is given in af_vsockmon_hdr->transport and * transport header length is given in af_vsockmon_hdr->len. * * If af_vsockmon_hdr->op is AF_VSOCK_OP_PAYLOAD then the payload follows the * transport header. Other ops do not have a payload. */ struct af_vsockmon_hdr { __le64 src_cid; __le64 dst_cid; __le32 src_port; __le32 dst_port; __le16 op; /* enum af_vsockmon_op */ __le16 transport; /* enum af_vsockmon_transport */ __le16 len; /* Transport header length */ __u8 reserved[2]; }; enum af_vsockmon_op { AF_VSOCK_OP_UNKNOWN = 0, AF_VSOCK_OP_CONNECT = 1, AF_VSOCK_OP_DISCONNECT = 2, AF_VSOCK_OP_CONTROL = 3, AF_VSOCK_OP_PAYLOAD = 4, }; enum af_vsockmon_transport { AF_VSOCK_TRANSPORT_UNKNOWN = 0, AF_VSOCK_TRANSPORT_NO_INFO = 1, /* No transport information */ /* Transport header type: struct virtio_vsock_hdr */ AF_VSOCK_TRANSPORT_VIRTIO = 2, }; #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_pppox.h������������������������������������������������������������������������������������0000644�����������������00000011417�14763166027�0007720 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /*************************************************************************** * Linux PPP over X - Generic PPP transport layer sockets * Linux PPP over Ethernet (PPPoE) Socket Implementation (RFC 2516) * * This file supplies definitions required by the PPP over Ethernet driver * (pppox.c). All version information wrt this file is located in pppox.c * * License: * 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. * */ #ifndef __LINUX_IF_PPPOX_H #define __LINUX_IF_PPPOX_H #include <linux/types.h> #include <asm/byteorder.h> #include <linux/socket.h> #include <linux/if.h> #include <linux/if_ether.h> #include <linux/if_pppol2tp.h> #include <linux/in.h> #include <linux/in6.h> /* For user-space programs to pick up these definitions * which they wouldn't get otherwise without defining __KERNEL__ */ #ifndef AF_PPPOX #define AF_PPPOX 24 #define PF_PPPOX AF_PPPOX #endif /* !(AF_PPPOX) */ /************************************************************************ * PPPoE addressing definition */ typedef __be16 sid_t; struct pppoe_addr { sid_t sid; /* Session identifier */ unsigned char remote[ETH_ALEN]; /* Remote address */ char dev[IFNAMSIZ]; /* Local device to use */ }; /************************************************************************ * PPTP addressing definition */ struct pptp_addr { __u16 call_id; struct in_addr sin_addr; }; /************************************************************************ * Protocols supported by AF_PPPOX */ #define PX_PROTO_OE 0 /* Currently just PPPoE */ #define PX_PROTO_OL2TP 1 /* Now L2TP also */ #define PX_PROTO_PPTP 2 #define PX_MAX_PROTO 3 struct sockaddr_pppox { __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ unsigned int sa_protocol; /* protocol identifier */ union { struct pppoe_addr pppoe; struct pptp_addr pptp; } sa_addr; } __attribute__((packed)); /* The use of the above union isn't viable because the size of this * struct must stay fixed over time -- applications use sizeof(struct * sockaddr_pppox) to fill it. We use a protocol specific sockaddr * type instead. */ struct sockaddr_pppol2tp { __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ unsigned int sa_protocol; /* protocol identifier */ struct pppol2tp_addr pppol2tp; } __attribute__((packed)); struct sockaddr_pppol2tpin6 { __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ unsigned int sa_protocol; /* protocol identifier */ struct pppol2tpin6_addr pppol2tp; } __attribute__((packed)); /* The L2TPv3 protocol changes tunnel and session ids from 16 to 32 * bits. So we need a different sockaddr structure. */ struct sockaddr_pppol2tpv3 { __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ unsigned int sa_protocol; /* protocol identifier */ struct pppol2tpv3_addr pppol2tp; } __attribute__((packed)); struct sockaddr_pppol2tpv3in6 { __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ unsigned int sa_protocol; /* protocol identifier */ struct pppol2tpv3in6_addr pppol2tp; } __attribute__((packed)); /********************************************************************* * * ioctl interface for defining forwarding of connections * ********************************************************************/ #define PPPOEIOCSFWD _IOW(0xB1 ,0, size_t) #define PPPOEIOCDFWD _IO(0xB1 ,1) /*#define PPPOEIOCGFWD _IOWR(0xB1,2, size_t)*/ /* Codes to identify message types */ #define PADI_CODE 0x09 #define PADO_CODE 0x07 #define PADR_CODE 0x19 #define PADS_CODE 0x65 #define PADT_CODE 0xa7 struct pppoe_tag { __be16 tag_type; __be16 tag_len; char tag_data[0]; } __attribute__ ((packed)); /* Tag identifiers */ #define PTT_EOL __cpu_to_be16(0x0000) #define PTT_SRV_NAME __cpu_to_be16(0x0101) #define PTT_AC_NAME __cpu_to_be16(0x0102) #define PTT_HOST_UNIQ __cpu_to_be16(0x0103) #define PTT_AC_COOKIE __cpu_to_be16(0x0104) #define PTT_VENDOR __cpu_to_be16(0x0105) #define PTT_RELAY_SID __cpu_to_be16(0x0110) #define PTT_SRV_ERR __cpu_to_be16(0x0201) #define PTT_SYS_ERR __cpu_to_be16(0x0202) #define PTT_GEN_ERR __cpu_to_be16(0x0203) struct pppoe_hdr { #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 type : 4; __u8 ver : 4; #elif defined(__BIG_ENDIAN_BITFIELD) __u8 ver : 4; __u8 type : 4; #else #error "Please fix <asm/byteorder.h>" #endif __u8 code; __be16 sid; __be16 length; struct pppoe_tag tag[0]; } __attribute__((packed)); /* Length of entire PPPoE + PPP header */ #define PPPOE_SES_HLEN 8 #endif /* __LINUX_IF_PPPOX_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/virtio_crypto.h�������������������������������������������������������������������������������0000644�����������������00000033062�14763166027�0011010 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _VIRTIO_CRYPTO_H #define _VIRTIO_CRYPTO_H /* This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <linux/types.h> #include <linux/virtio_types.h> #include <linux/virtio_ids.h> #include <linux/virtio_config.h> #define VIRTIO_CRYPTO_SERVICE_CIPHER 0 #define VIRTIO_CRYPTO_SERVICE_HASH 1 #define VIRTIO_CRYPTO_SERVICE_MAC 2 #define VIRTIO_CRYPTO_SERVICE_AEAD 3 #define VIRTIO_CRYPTO_OPCODE(service, op) (((service) << 8) | (op)) struct virtio_crypto_ctrl_header { #define VIRTIO_CRYPTO_CIPHER_CREATE_SESSION \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x02) #define VIRTIO_CRYPTO_CIPHER_DESTROY_SESSION \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x03) #define VIRTIO_CRYPTO_HASH_CREATE_SESSION \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_HASH, 0x02) #define VIRTIO_CRYPTO_HASH_DESTROY_SESSION \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_HASH, 0x03) #define VIRTIO_CRYPTO_MAC_CREATE_SESSION \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_MAC, 0x02) #define VIRTIO_CRYPTO_MAC_DESTROY_SESSION \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_MAC, 0x03) #define VIRTIO_CRYPTO_AEAD_CREATE_SESSION \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x02) #define VIRTIO_CRYPTO_AEAD_DESTROY_SESSION \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x03) __le32 opcode; __le32 algo; __le32 flag; /* data virtqueue id */ __le32 queue_id; }; struct virtio_crypto_cipher_session_para { #define VIRTIO_CRYPTO_NO_CIPHER 0 #define VIRTIO_CRYPTO_CIPHER_ARC4 1 #define VIRTIO_CRYPTO_CIPHER_AES_ECB 2 #define VIRTIO_CRYPTO_CIPHER_AES_CBC 3 #define VIRTIO_CRYPTO_CIPHER_AES_CTR 4 #define VIRTIO_CRYPTO_CIPHER_DES_ECB 5 #define VIRTIO_CRYPTO_CIPHER_DES_CBC 6 #define VIRTIO_CRYPTO_CIPHER_3DES_ECB 7 #define VIRTIO_CRYPTO_CIPHER_3DES_CBC 8 #define VIRTIO_CRYPTO_CIPHER_3DES_CTR 9 #define VIRTIO_CRYPTO_CIPHER_KASUMI_F8 10 #define VIRTIO_CRYPTO_CIPHER_SNOW3G_UEA2 11 #define VIRTIO_CRYPTO_CIPHER_AES_F8 12 #define VIRTIO_CRYPTO_CIPHER_AES_XTS 13 #define VIRTIO_CRYPTO_CIPHER_ZUC_EEA3 14 __le32 algo; /* length of key */ __le32 keylen; #define VIRTIO_CRYPTO_OP_ENCRYPT 1 #define VIRTIO_CRYPTO_OP_DECRYPT 2 /* encrypt or decrypt */ __le32 op; __le32 padding; }; struct virtio_crypto_session_input { /* Device-writable part */ __le64 session_id; __le32 status; __le32 padding; }; struct virtio_crypto_cipher_session_req { struct virtio_crypto_cipher_session_para para; __u8 padding[32]; }; struct virtio_crypto_hash_session_para { #define VIRTIO_CRYPTO_NO_HASH 0 #define VIRTIO_CRYPTO_HASH_MD5 1 #define VIRTIO_CRYPTO_HASH_SHA1 2 #define VIRTIO_CRYPTO_HASH_SHA_224 3 #define VIRTIO_CRYPTO_HASH_SHA_256 4 #define VIRTIO_CRYPTO_HASH_SHA_384 5 #define VIRTIO_CRYPTO_HASH_SHA_512 6 #define VIRTIO_CRYPTO_HASH_SHA3_224 7 #define VIRTIO_CRYPTO_HASH_SHA3_256 8 #define VIRTIO_CRYPTO_HASH_SHA3_384 9 #define VIRTIO_CRYPTO_HASH_SHA3_512 10 #define VIRTIO_CRYPTO_HASH_SHA3_SHAKE128 11 #define VIRTIO_CRYPTO_HASH_SHA3_SHAKE256 12 __le32 algo; /* hash result length */ __le32 hash_result_len; __u8 padding[8]; }; struct virtio_crypto_hash_create_session_req { struct virtio_crypto_hash_session_para para; __u8 padding[40]; }; struct virtio_crypto_mac_session_para { #define VIRTIO_CRYPTO_NO_MAC 0 #define VIRTIO_CRYPTO_MAC_HMAC_MD5 1 #define VIRTIO_CRYPTO_MAC_HMAC_SHA1 2 #define VIRTIO_CRYPTO_MAC_HMAC_SHA_224 3 #define VIRTIO_CRYPTO_MAC_HMAC_SHA_256 4 #define VIRTIO_CRYPTO_MAC_HMAC_SHA_384 5 #define VIRTIO_CRYPTO_MAC_HMAC_SHA_512 6 #define VIRTIO_CRYPTO_MAC_CMAC_3DES 25 #define VIRTIO_CRYPTO_MAC_CMAC_AES 26 #define VIRTIO_CRYPTO_MAC_KASUMI_F9 27 #define VIRTIO_CRYPTO_MAC_SNOW3G_UIA2 28 #define VIRTIO_CRYPTO_MAC_GMAC_AES 41 #define VIRTIO_CRYPTO_MAC_GMAC_TWOFISH 42 #define VIRTIO_CRYPTO_MAC_CBCMAC_AES 49 #define VIRTIO_CRYPTO_MAC_CBCMAC_KASUMI_F9 50 #define VIRTIO_CRYPTO_MAC_XCBC_AES 53 __le32 algo; /* hash result length */ __le32 hash_result_len; /* length of authenticated key */ __le32 auth_key_len; __le32 padding; }; struct virtio_crypto_mac_create_session_req { struct virtio_crypto_mac_session_para para; __u8 padding[40]; }; struct virtio_crypto_aead_session_para { #define VIRTIO_CRYPTO_NO_AEAD 0 #define VIRTIO_CRYPTO_AEAD_GCM 1 #define VIRTIO_CRYPTO_AEAD_CCM 2 #define VIRTIO_CRYPTO_AEAD_CHACHA20_POLY1305 3 __le32 algo; /* length of key */ __le32 key_len; /* hash result length */ __le32 hash_result_len; /* length of the additional authenticated data (AAD) in bytes */ __le32 aad_len; /* encrypt or decrypt, See above VIRTIO_CRYPTO_OP_* */ __le32 op; __le32 padding; }; struct virtio_crypto_aead_create_session_req { struct virtio_crypto_aead_session_para para; __u8 padding[32]; }; struct virtio_crypto_alg_chain_session_para { #define VIRTIO_CRYPTO_SYM_ALG_CHAIN_ORDER_HASH_THEN_CIPHER 1 #define VIRTIO_CRYPTO_SYM_ALG_CHAIN_ORDER_CIPHER_THEN_HASH 2 __le32 alg_chain_order; /* Plain hash */ #define VIRTIO_CRYPTO_SYM_HASH_MODE_PLAIN 1 /* Authenticated hash (mac) */ #define VIRTIO_CRYPTO_SYM_HASH_MODE_AUTH 2 /* Nested hash */ #define VIRTIO_CRYPTO_SYM_HASH_MODE_NESTED 3 __le32 hash_mode; struct virtio_crypto_cipher_session_para cipher_param; union { struct virtio_crypto_hash_session_para hash_param; struct virtio_crypto_mac_session_para mac_param; __u8 padding[16]; } u; /* length of the additional authenticated data (AAD) in bytes */ __le32 aad_len; __le32 padding; }; struct virtio_crypto_alg_chain_session_req { struct virtio_crypto_alg_chain_session_para para; }; struct virtio_crypto_sym_create_session_req { union { struct virtio_crypto_cipher_session_req cipher; struct virtio_crypto_alg_chain_session_req chain; __u8 padding[48]; } u; /* Device-readable part */ /* No operation */ #define VIRTIO_CRYPTO_SYM_OP_NONE 0 /* Cipher only operation on the data */ #define VIRTIO_CRYPTO_SYM_OP_CIPHER 1 /* * Chain any cipher with any hash or mac operation. The order * depends on the value of alg_chain_order param */ #define VIRTIO_CRYPTO_SYM_OP_ALGORITHM_CHAINING 2 __le32 op_type; __le32 padding; }; struct virtio_crypto_destroy_session_req { /* Device-readable part */ __le64 session_id; __u8 padding[48]; }; /* The request of the control virtqueue's packet */ struct virtio_crypto_op_ctrl_req { struct virtio_crypto_ctrl_header header; union { struct virtio_crypto_sym_create_session_req sym_create_session; struct virtio_crypto_hash_create_session_req hash_create_session; struct virtio_crypto_mac_create_session_req mac_create_session; struct virtio_crypto_aead_create_session_req aead_create_session; struct virtio_crypto_destroy_session_req destroy_session; __u8 padding[56]; } u; }; struct virtio_crypto_op_header { #define VIRTIO_CRYPTO_CIPHER_ENCRYPT \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x00) #define VIRTIO_CRYPTO_CIPHER_DECRYPT \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x01) #define VIRTIO_CRYPTO_HASH \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_HASH, 0x00) #define VIRTIO_CRYPTO_MAC \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_MAC, 0x00) #define VIRTIO_CRYPTO_AEAD_ENCRYPT \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x00) #define VIRTIO_CRYPTO_AEAD_DECRYPT \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x01) __le32 opcode; /* algo should be service-specific algorithms */ __le32 algo; /* session_id should be service-specific algorithms */ __le64 session_id; /* control flag to control the request */ __le32 flag; __le32 padding; }; struct virtio_crypto_cipher_para { /* * Byte Length of valid IV/Counter * * For block ciphers in CBC or F8 mode, or for Kasumi in F8 mode, or for * SNOW3G in UEA2 mode, this is the length of the IV (which * must be the same as the block length of the cipher). * For block ciphers in CTR mode, this is the length of the counter * (which must be the same as the block length of the cipher). * For AES-XTS, this is the 128bit tweak, i, from IEEE Std 1619-2007. * * The IV/Counter will be updated after every partial cryptographic * operation. */ __le32 iv_len; /* length of source data */ __le32 src_data_len; /* length of dst data */ __le32 dst_data_len; __le32 padding; }; struct virtio_crypto_hash_para { /* length of source data */ __le32 src_data_len; /* hash result length */ __le32 hash_result_len; }; struct virtio_crypto_mac_para { struct virtio_crypto_hash_para hash; }; struct virtio_crypto_aead_para { /* * Byte Length of valid IV data pointed to by the below iv_addr * parameter. * * For GCM mode, this is either 12 (for 96-bit IVs) or 16, in which * case iv_addr points to J0. * For CCM mode, this is the length of the nonce, which can be in the * range 7 to 13 inclusive. */ __le32 iv_len; /* length of additional auth data */ __le32 aad_len; /* length of source data */ __le32 src_data_len; /* length of dst data */ __le32 dst_data_len; }; struct virtio_crypto_cipher_data_req { /* Device-readable part */ struct virtio_crypto_cipher_para para; __u8 padding[24]; }; struct virtio_crypto_hash_data_req { /* Device-readable part */ struct virtio_crypto_hash_para para; __u8 padding[40]; }; struct virtio_crypto_mac_data_req { /* Device-readable part */ struct virtio_crypto_mac_para para; __u8 padding[40]; }; struct virtio_crypto_alg_chain_data_para { __le32 iv_len; /* Length of source data */ __le32 src_data_len; /* Length of destination data */ __le32 dst_data_len; /* Starting point for cipher processing in source data */ __le32 cipher_start_src_offset; /* Length of the source data that the cipher will be computed on */ __le32 len_to_cipher; /* Starting point for hash processing in source data */ __le32 hash_start_src_offset; /* Length of the source data that the hash will be computed on */ __le32 len_to_hash; /* Length of the additional auth data */ __le32 aad_len; /* Length of the hash result */ __le32 hash_result_len; __le32 reserved; }; struct virtio_crypto_alg_chain_data_req { /* Device-readable part */ struct virtio_crypto_alg_chain_data_para para; }; struct virtio_crypto_sym_data_req { union { struct virtio_crypto_cipher_data_req cipher; struct virtio_crypto_alg_chain_data_req chain; __u8 padding[40]; } u; /* See above VIRTIO_CRYPTO_SYM_OP_* */ __le32 op_type; __le32 padding; }; struct virtio_crypto_aead_data_req { /* Device-readable part */ struct virtio_crypto_aead_para para; __u8 padding[32]; }; /* The request of the data virtqueue's packet */ struct virtio_crypto_op_data_req { struct virtio_crypto_op_header header; union { struct virtio_crypto_sym_data_req sym_req; struct virtio_crypto_hash_data_req hash_req; struct virtio_crypto_mac_data_req mac_req; struct virtio_crypto_aead_data_req aead_req; __u8 padding[48]; } u; }; #define VIRTIO_CRYPTO_OK 0 #define VIRTIO_CRYPTO_ERR 1 #define VIRTIO_CRYPTO_BADMSG 2 #define VIRTIO_CRYPTO_NOTSUPP 3 #define VIRTIO_CRYPTO_INVSESS 4 /* Invalid session id */ /* The accelerator hardware is ready */ #define VIRTIO_CRYPTO_S_HW_READY (1 << 0) struct virtio_crypto_config { /* See VIRTIO_CRYPTO_OP_* above */ __u32 status; /* * Maximum number of data queue */ __u32 max_dataqueues; /* * Specifies the services mask which the device support, * see VIRTIO_CRYPTO_SERVICE_* above */ __u32 crypto_services; /* Detailed algorithms mask */ __u32 cipher_algo_l; __u32 cipher_algo_h; __u32 hash_algo; __u32 mac_algo_l; __u32 mac_algo_h; __u32 aead_algo; /* Maximum length of cipher key */ __u32 max_cipher_key_len; /* Maximum length of authenticated key */ __u32 max_auth_key_len; __u32 reserve; /* Maximum size of each crypto request's content */ __u64 max_size; }; struct virtio_crypto_inhdr { /* See VIRTIO_CRYPTO_* above */ __u8 status; }; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_addr.h�������������������������������������������������������������������������������������0000644�����������������00000003511�14763166027�0007460 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_IF_ADDR_H #define __LINUX_IF_ADDR_H #include <linux/types.h> #include <linux/netlink.h> struct ifaddrmsg { __u8 ifa_family; __u8 ifa_prefixlen; /* The prefix length */ __u8 ifa_flags; /* Flags */ __u8 ifa_scope; /* Address scope */ __u32 ifa_index; /* Link index */ }; /* * Important comment: * IFA_ADDRESS is prefix address, rather than local interface address. * It makes no difference for normally configured broadcast interfaces, * but for point-to-point IFA_ADDRESS is DESTINATION address, * local address is supplied in IFA_LOCAL attribute. * * IFA_FLAGS is a u32 attribute that extends the u8 field ifa_flags. * If present, the value from struct ifaddrmsg will be ignored. */ enum { IFA_UNSPEC, IFA_ADDRESS, IFA_LOCAL, IFA_LABEL, IFA_BROADCAST, IFA_ANYCAST, IFA_CACHEINFO, IFA_MULTICAST, IFA_FLAGS, IFA_RT_PRIORITY, /* u32, priority/metric for prefix route */ __IFA_MAX, }; #define IFA_MAX (__IFA_MAX - 1) /* ifa_flags */ #define IFA_F_SECONDARY 0x01 #define IFA_F_TEMPORARY IFA_F_SECONDARY #define IFA_F_NODAD 0x02 #define IFA_F_OPTIMISTIC 0x04 #define IFA_F_DADFAILED 0x08 #define IFA_F_HOMEADDRESS 0x10 #define IFA_F_DEPRECATED 0x20 #define IFA_F_TENTATIVE 0x40 #define IFA_F_PERMANENT 0x80 #define IFA_F_MANAGETEMPADDR 0x100 #define IFA_F_NOPREFIXROUTE 0x200 #define IFA_F_MCAUTOJOIN 0x400 #define IFA_F_STABLE_PRIVACY 0x800 struct ifa_cacheinfo { __u32 ifa_prefered; __u32 ifa_valid; __u32 cstamp; /* created timestamp, hundredths of seconds */ __u32 tstamp; /* updated timestamp, hundredths of seconds */ }; /* backwards compatibility for userspace */ #define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg)))) #define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg)) #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/memfd.h���������������������������������������������������������������������������������������0000644�����������������00000002454�14763166027�0007165 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_MEMFD_H #define _LINUX_MEMFD_H #include <asm-generic/hugetlb_encode.h> /* flags for memfd_create(2) (unsigned int) */ #define MFD_CLOEXEC 0x0001U #define MFD_ALLOW_SEALING 0x0002U #define MFD_HUGETLB 0x0004U /* * Huge page size encoding when MFD_HUGETLB is specified, and a huge page * size other than the default is desired. See hugetlb_encode.h. * All known huge page size encodings are provided here. It is the * responsibility of the application to know which sizes are supported on * the running system. See mmap(2) man page for details. */ #define MFD_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT #define MFD_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK #define MFD_HUGE_64KB HUGETLB_FLAG_ENCODE_64KB #define MFD_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB #define MFD_HUGE_1MB HUGETLB_FLAG_ENCODE_1MB #define MFD_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB #define MFD_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB #define MFD_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB #define MFD_HUGE_32MB HUGETLB_FLAG_ENCODE_32MB #define MFD_HUGE_256MB HUGETLB_FLAG_ENCODE_256MB #define MFD_HUGE_512MB HUGETLB_FLAG_ENCODE_512MB #define MFD_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB #define MFD_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB #define MFD_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB #endif /* _LINUX_MEMFD_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/times.h���������������������������������������������������������������������������������������0000644�����������������00000000426�14763166027�0007213 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_TIMES_H #define _LINUX_TIMES_H #include <linux/types.h> struct tms { __kernel_clock_t tms_utime; __kernel_clock_t tms_stime; __kernel_clock_t tms_cutime; __kernel_clock_t tms_cstime; }; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/blkpg.h���������������������������������������������������������������������������������������0000644�����������������00000003142�14763166027�0007167 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BLKPG_H #define __LINUX_BLKPG_H /* * Partition table and disk geometry handling * * A single ioctl with lots of subfunctions: * * Device number stuff: * get_whole_disk() (given the device number of a partition, * find the device number of the encompassing disk) * get_all_partitions() (given the device number of a disk, return the * device numbers of all its known partitions) * * Partition stuff: * add_partition() * delete_partition() * test_partition_in_use() (also for test_disk_in_use) * * Geometry stuff: * get_geometry() * set_geometry() * get_bios_drivedata() * * For today, only the partition stuff - aeb, 990515 */ #include <linux/ioctl.h> #define BLKPG _IO(0x12,105) /* The argument structure */ struct blkpg_ioctl_arg { int op; int flags; int datalen; void *data; }; /* The subfunctions (for the op field) */ #define BLKPG_ADD_PARTITION 1 #define BLKPG_DEL_PARTITION 2 #define BLKPG_RESIZE_PARTITION 3 /* Sizes of name fields. Unused at present. */ #define BLKPG_DEVNAMELTH 64 #define BLKPG_VOLNAMELTH 64 /* The data structure for ADD_PARTITION and DEL_PARTITION */ struct blkpg_partition { long long start; /* starting offset in bytes */ long long length; /* length in bytes */ int pno; /* partition number */ char devname[BLKPG_DEVNAMELTH]; /* partition name, like sda5 or c0d1p2, to be used in kernel messages */ char volname[BLKPG_VOLNAMELTH]; /* volume label */ }; #endif /* __LINUX_BLKPG_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_slip.h�������������������������������������������������������������������������������������0000644�����������������00000001550�14763166027�0007516 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Swansea University Computer Society NET3 * * This file declares the constants of special use with the SLIP/CSLIP/ * KISS TNC driver. */ #ifndef __LINUX_SLIP_H #define __LINUX_SLIP_H #define SL_MODE_SLIP 0 #define SL_MODE_CSLIP 1 #define SL_MODE_KISS 4 #define SL_OPT_SIXBIT 2 #define SL_OPT_ADAPTIVE 8 /* * VSV = ioctl for keepalive & outfill in SLIP driver */ #define SIOCSKEEPALIVE (SIOCDEVPRIVATE) /* Set keepalive timeout in sec */ #define SIOCGKEEPALIVE (SIOCDEVPRIVATE+1) /* Get keepalive timeout */ #define SIOCSOUTFILL (SIOCDEVPRIVATE+2) /* Set outfill timeout */ #define SIOCGOUTFILL (SIOCDEVPRIVATE+3) /* Get outfill timeout */ #define SIOCSLEASE (SIOCDEVPRIVATE+4) /* Set "leased" line type */ #define SIOCGLEASE (SIOCDEVPRIVATE+5) /* Get line type */ #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������linux/wait.h����������������������������������������������������������������������������������������0000644�����������������00000001227�14763166027�0007036 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_WAIT_H #define _LINUX_WAIT_H #define WNOHANG 0x00000001 #define WUNTRACED 0x00000002 #define WSTOPPED WUNTRACED #define WEXITED 0x00000004 #define WCONTINUED 0x00000008 #define WNOWAIT 0x01000000 /* Don't reap, just poll status. */ #define __WNOTHREAD 0x20000000 /* Don't wait on children of other threads in this group */ #define __WALL 0x40000000 /* Wait on all children, regardless of type */ #define __WCLONE 0x80000000 /* Wait only on non-SIGCHLD children */ /* First argument to waitid: */ #define P_ALL 0 #define P_PID 1 #define P_PGID 2 #endif /* _LINUX_WAIT_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_bridge.h�����������������������������������������������������������������������������������0000644�����������������00000015065�14763166027�0010011 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Linux ethernet bridge * * Authors: * Lennert Buytenhek <buytenh@gnu.org> * * 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. */ #ifndef _LINUX_IF_BRIDGE_H #define _LINUX_IF_BRIDGE_H #include <linux/types.h> #include <linux/if_ether.h> #include <linux/in6.h> #define SYSFS_BRIDGE_ATTR "bridge" #define SYSFS_BRIDGE_FDB "brforward" #define SYSFS_BRIDGE_PORT_SUBDIR "brif" #define SYSFS_BRIDGE_PORT_ATTR "brport" #define SYSFS_BRIDGE_PORT_LINK "bridge" #define BRCTL_VERSION 1 #define BRCTL_GET_VERSION 0 #define BRCTL_GET_BRIDGES 1 #define BRCTL_ADD_BRIDGE 2 #define BRCTL_DEL_BRIDGE 3 #define BRCTL_ADD_IF 4 #define BRCTL_DEL_IF 5 #define BRCTL_GET_BRIDGE_INFO 6 #define BRCTL_GET_PORT_LIST 7 #define BRCTL_SET_BRIDGE_FORWARD_DELAY 8 #define BRCTL_SET_BRIDGE_HELLO_TIME 9 #define BRCTL_SET_BRIDGE_MAX_AGE 10 #define BRCTL_SET_AGEING_TIME 11 #define BRCTL_SET_GC_INTERVAL 12 #define BRCTL_GET_PORT_INFO 13 #define BRCTL_SET_BRIDGE_STP_STATE 14 #define BRCTL_SET_BRIDGE_PRIORITY 15 #define BRCTL_SET_PORT_PRIORITY 16 #define BRCTL_SET_PATH_COST 17 #define BRCTL_GET_FDB_ENTRIES 18 #define BR_STATE_DISABLED 0 #define BR_STATE_LISTENING 1 #define BR_STATE_LEARNING 2 #define BR_STATE_FORWARDING 3 #define BR_STATE_BLOCKING 4 struct __bridge_info { __u64 designated_root; __u64 bridge_id; __u32 root_path_cost; __u32 max_age; __u32 hello_time; __u32 forward_delay; __u32 bridge_max_age; __u32 bridge_hello_time; __u32 bridge_forward_delay; __u8 topology_change; __u8 topology_change_detected; __u8 root_port; __u8 stp_enabled; __u32 ageing_time; __u32 gc_interval; __u32 hello_timer_value; __u32 tcn_timer_value; __u32 topology_change_timer_value; __u32 gc_timer_value; }; struct __port_info { __u64 designated_root; __u64 designated_bridge; __u16 port_id; __u16 designated_port; __u32 path_cost; __u32 designated_cost; __u8 state; __u8 top_change_ack; __u8 config_pending; __u8 unused0; __u32 message_age_timer_value; __u32 forward_delay_timer_value; __u32 hold_timer_value; }; struct __fdb_entry { __u8 mac_addr[ETH_ALEN]; __u8 port_no; __u8 is_local; __u32 ageing_timer_value; __u8 port_hi; __u8 pad0; __u16 unused; }; /* Bridge Flags */ #define BRIDGE_FLAGS_MASTER 1 /* Bridge command to/from master */ #define BRIDGE_FLAGS_SELF 2 /* Bridge command to/from lowerdev */ #define BRIDGE_MODE_VEB 0 /* Default loopback mode */ #define BRIDGE_MODE_VEPA 1 /* 802.1Qbg defined VEPA mode */ #define BRIDGE_MODE_UNDEF 0xFFFF /* mode undefined */ /* Bridge management nested attributes * [IFLA_AF_SPEC] = { * [IFLA_BRIDGE_FLAGS] * [IFLA_BRIDGE_MODE] * [IFLA_BRIDGE_VLAN_INFO] * } */ enum { IFLA_BRIDGE_FLAGS, IFLA_BRIDGE_MODE, IFLA_BRIDGE_VLAN_INFO, IFLA_BRIDGE_VLAN_TUNNEL_INFO, __IFLA_BRIDGE_MAX, }; #define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1) #define BRIDGE_VLAN_INFO_MASTER (1<<0) /* Operate on Bridge device as well */ #define BRIDGE_VLAN_INFO_PVID (1<<1) /* VLAN is PVID, ingress untagged */ #define BRIDGE_VLAN_INFO_UNTAGGED (1<<2) /* VLAN egresses untagged */ #define BRIDGE_VLAN_INFO_RANGE_BEGIN (1<<3) /* VLAN is start of vlan range */ #define BRIDGE_VLAN_INFO_RANGE_END (1<<4) /* VLAN is end of vlan range */ #define BRIDGE_VLAN_INFO_BRENTRY (1<<5) /* Global bridge VLAN entry */ struct bridge_vlan_info { __u16 flags; __u16 vid; }; enum { IFLA_BRIDGE_VLAN_TUNNEL_UNSPEC, IFLA_BRIDGE_VLAN_TUNNEL_ID, IFLA_BRIDGE_VLAN_TUNNEL_VID, IFLA_BRIDGE_VLAN_TUNNEL_FLAGS, __IFLA_BRIDGE_VLAN_TUNNEL_MAX, }; #define IFLA_BRIDGE_VLAN_TUNNEL_MAX (__IFLA_BRIDGE_VLAN_TUNNEL_MAX - 1) struct bridge_vlan_xstats { __u64 rx_bytes; __u64 rx_packets; __u64 tx_bytes; __u64 tx_packets; __u16 vid; __u16 flags; __u32 pad2; }; /* Bridge multicast database attributes * [MDBA_MDB] = { * [MDBA_MDB_ENTRY] = { * [MDBA_MDB_ENTRY_INFO] { * struct br_mdb_entry * [MDBA_MDB_EATTR attributes] * } * } * } * [MDBA_ROUTER] = { * [MDBA_ROUTER_PORT] = { * u32 ifindex * [MDBA_ROUTER_PATTR attributes] * } * } */ enum { MDBA_UNSPEC, MDBA_MDB, MDBA_ROUTER, __MDBA_MAX, }; #define MDBA_MAX (__MDBA_MAX - 1) enum { MDBA_MDB_UNSPEC, MDBA_MDB_ENTRY, __MDBA_MDB_MAX, }; #define MDBA_MDB_MAX (__MDBA_MDB_MAX - 1) enum { MDBA_MDB_ENTRY_UNSPEC, MDBA_MDB_ENTRY_INFO, __MDBA_MDB_ENTRY_MAX, }; #define MDBA_MDB_ENTRY_MAX (__MDBA_MDB_ENTRY_MAX - 1) /* per mdb entry additional attributes */ enum { MDBA_MDB_EATTR_UNSPEC, MDBA_MDB_EATTR_TIMER, __MDBA_MDB_EATTR_MAX }; #define MDBA_MDB_EATTR_MAX (__MDBA_MDB_EATTR_MAX - 1) /* multicast router types */ enum { MDB_RTR_TYPE_DISABLED, MDB_RTR_TYPE_TEMP_QUERY, MDB_RTR_TYPE_PERM, MDB_RTR_TYPE_TEMP }; enum { MDBA_ROUTER_UNSPEC, MDBA_ROUTER_PORT, __MDBA_ROUTER_MAX, }; #define MDBA_ROUTER_MAX (__MDBA_ROUTER_MAX - 1) /* router port attributes */ enum { MDBA_ROUTER_PATTR_UNSPEC, MDBA_ROUTER_PATTR_TIMER, MDBA_ROUTER_PATTR_TYPE, __MDBA_ROUTER_PATTR_MAX }; #define MDBA_ROUTER_PATTR_MAX (__MDBA_ROUTER_PATTR_MAX - 1) struct br_port_msg { __u8 family; __u32 ifindex; }; struct br_mdb_entry { __u32 ifindex; #define MDB_TEMPORARY 0 #define MDB_PERMANENT 1 __u8 state; #define MDB_FLAGS_OFFLOAD (1 << 0) __u8 flags; __u16 vid; struct { union { __be32 ip4; struct in6_addr ip6; } u; __be16 proto; } addr; }; enum { MDBA_SET_ENTRY_UNSPEC, MDBA_SET_ENTRY, __MDBA_SET_ENTRY_MAX, }; #define MDBA_SET_ENTRY_MAX (__MDBA_SET_ENTRY_MAX - 1) /* Embedded inside LINK_XSTATS_TYPE_BRIDGE */ enum { BRIDGE_XSTATS_UNSPEC, BRIDGE_XSTATS_VLAN, BRIDGE_XSTATS_MCAST, BRIDGE_XSTATS_PAD, __BRIDGE_XSTATS_MAX }; #define BRIDGE_XSTATS_MAX (__BRIDGE_XSTATS_MAX - 1) enum { BR_MCAST_DIR_RX, BR_MCAST_DIR_TX, BR_MCAST_DIR_SIZE }; /* IGMP/MLD statistics */ struct br_mcast_stats { __u64 igmp_v1queries[BR_MCAST_DIR_SIZE]; __u64 igmp_v2queries[BR_MCAST_DIR_SIZE]; __u64 igmp_v3queries[BR_MCAST_DIR_SIZE]; __u64 igmp_leaves[BR_MCAST_DIR_SIZE]; __u64 igmp_v1reports[BR_MCAST_DIR_SIZE]; __u64 igmp_v2reports[BR_MCAST_DIR_SIZE]; __u64 igmp_v3reports[BR_MCAST_DIR_SIZE]; __u64 igmp_parse_errors; __u64 mld_v1queries[BR_MCAST_DIR_SIZE]; __u64 mld_v2queries[BR_MCAST_DIR_SIZE]; __u64 mld_leaves[BR_MCAST_DIR_SIZE]; __u64 mld_v1reports[BR_MCAST_DIR_SIZE]; __u64 mld_v2reports[BR_MCAST_DIR_SIZE]; __u64 mld_parse_errors; __u64 mcast_bytes[BR_MCAST_DIR_SIZE]; __u64 mcast_packets[BR_MCAST_DIR_SIZE]; }; #endif /* _LINUX_IF_BRIDGE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/switchtec_ioctl.h�����������������������������������������������������������������������������0000644�����������������00000010631�14763166027�0011260 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Microsemi Switchtec PCIe Driver * Copyright (c) 2017, Microsemi Corporation * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope 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. * */ #ifndef _LINUX_SWITCHTEC_IOCTL_H #define _LINUX_SWITCHTEC_IOCTL_H #include <linux/types.h> #define SWITCHTEC_IOCTL_PART_CFG0 0 #define SWITCHTEC_IOCTL_PART_CFG1 1 #define SWITCHTEC_IOCTL_PART_IMG0 2 #define SWITCHTEC_IOCTL_PART_IMG1 3 #define SWITCHTEC_IOCTL_PART_NVLOG 4 #define SWITCHTEC_IOCTL_PART_VENDOR0 5 #define SWITCHTEC_IOCTL_PART_VENDOR1 6 #define SWITCHTEC_IOCTL_PART_VENDOR2 7 #define SWITCHTEC_IOCTL_PART_VENDOR3 8 #define SWITCHTEC_IOCTL_PART_VENDOR4 9 #define SWITCHTEC_IOCTL_PART_VENDOR5 10 #define SWITCHTEC_IOCTL_PART_VENDOR6 11 #define SWITCHTEC_IOCTL_PART_VENDOR7 12 #define SWITCHTEC_IOCTL_NUM_PARTITIONS 13 struct switchtec_ioctl_flash_info { __u64 flash_length; __u32 num_partitions; __u32 padding; }; #define SWITCHTEC_IOCTL_PART_ACTIVE 1 #define SWITCHTEC_IOCTL_PART_RUNNING 2 struct switchtec_ioctl_flash_part_info { __u32 flash_partition; __u32 address; __u32 length; __u32 active; }; struct switchtec_ioctl_event_summary { __u64 global; __u64 part_bitmap; __u32 local_part; __u32 padding; __u32 part[48]; __u32 pff[48]; }; #define SWITCHTEC_IOCTL_EVENT_STACK_ERROR 0 #define SWITCHTEC_IOCTL_EVENT_PPU_ERROR 1 #define SWITCHTEC_IOCTL_EVENT_ISP_ERROR 2 #define SWITCHTEC_IOCTL_EVENT_SYS_RESET 3 #define SWITCHTEC_IOCTL_EVENT_FW_EXC 4 #define SWITCHTEC_IOCTL_EVENT_FW_NMI 5 #define SWITCHTEC_IOCTL_EVENT_FW_NON_FATAL 6 #define SWITCHTEC_IOCTL_EVENT_FW_FATAL 7 #define SWITCHTEC_IOCTL_EVENT_TWI_MRPC_COMP 8 #define SWITCHTEC_IOCTL_EVENT_TWI_MRPC_COMP_ASYNC 9 #define SWITCHTEC_IOCTL_EVENT_CLI_MRPC_COMP 10 #define SWITCHTEC_IOCTL_EVENT_CLI_MRPC_COMP_ASYNC 11 #define SWITCHTEC_IOCTL_EVENT_GPIO_INT 12 #define SWITCHTEC_IOCTL_EVENT_PART_RESET 13 #define SWITCHTEC_IOCTL_EVENT_MRPC_COMP 14 #define SWITCHTEC_IOCTL_EVENT_MRPC_COMP_ASYNC 15 #define SWITCHTEC_IOCTL_EVENT_DYN_PART_BIND_COMP 16 #define SWITCHTEC_IOCTL_EVENT_AER_IN_P2P 17 #define SWITCHTEC_IOCTL_EVENT_AER_IN_VEP 18 #define SWITCHTEC_IOCTL_EVENT_DPC 19 #define SWITCHTEC_IOCTL_EVENT_CTS 20 #define SWITCHTEC_IOCTL_EVENT_HOTPLUG 21 #define SWITCHTEC_IOCTL_EVENT_IER 22 #define SWITCHTEC_IOCTL_EVENT_THRESH 23 #define SWITCHTEC_IOCTL_EVENT_POWER_MGMT 24 #define SWITCHTEC_IOCTL_EVENT_TLP_THROTTLING 25 #define SWITCHTEC_IOCTL_EVENT_FORCE_SPEED 26 #define SWITCHTEC_IOCTL_EVENT_CREDIT_TIMEOUT 27 #define SWITCHTEC_IOCTL_EVENT_LINK_STATE 28 #define SWITCHTEC_IOCTL_EVENT_GFMS 29 #define SWITCHTEC_IOCTL_MAX_EVENTS 30 #define SWITCHTEC_IOCTL_EVENT_LOCAL_PART_IDX -1 #define SWITCHTEC_IOCTL_EVENT_IDX_ALL -2 #define SWITCHTEC_IOCTL_EVENT_FLAG_CLEAR (1 << 0) #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_POLL (1 << 1) #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_LOG (1 << 2) #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_CLI (1 << 3) #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_FATAL (1 << 4) #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_POLL (1 << 5) #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_LOG (1 << 6) #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_CLI (1 << 7) #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_FATAL (1 << 8) #define SWITCHTEC_IOCTL_EVENT_FLAG_UNUSED (~0x1ff) struct switchtec_ioctl_event_ctl { __u32 event_id; __s32 index; __u32 flags; __u32 occurred; __u32 count; __u32 data[5]; }; #define SWITCHTEC_IOCTL_PFF_VEP 100 struct switchtec_ioctl_pff_port { __u32 pff; __u32 partition; __u32 port; }; #define SWITCHTEC_IOCTL_FLASH_INFO \ _IOR('W', 0x40, struct switchtec_ioctl_flash_info) #define SWITCHTEC_IOCTL_FLASH_PART_INFO \ _IOWR('W', 0x41, struct switchtec_ioctl_flash_part_info) #define SWITCHTEC_IOCTL_EVENT_SUMMARY \ _IOR('W', 0x42, struct switchtec_ioctl_event_summary) #define SWITCHTEC_IOCTL_EVENT_CTL \ _IOWR('W', 0x43, struct switchtec_ioctl_event_ctl) #define SWITCHTEC_IOCTL_PFF_TO_PORT \ _IOWR('W', 0x44, struct switchtec_ioctl_pff_port) #define SWITCHTEC_IOCTL_PORT_TO_PFF \ _IOWR('W', 0x45, struct switchtec_ioctl_pff_port) #endif �������������������������������������������������������������������������������������������������������linux/stat.h����������������������������������������������������������������������������������������0000644�����������������00000013724�14763166027�0007052 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_STAT_H #define _LINUX_STAT_H #include <linux/types.h> #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) #define S_IFMT 00170000 #define S_IFSOCK 0140000 #define S_IFLNK 0120000 #define S_IFREG 0100000 #define S_IFBLK 0060000 #define S_IFDIR 0040000 #define S_IFCHR 0020000 #define S_IFIFO 0010000 #define S_ISUID 0004000 #define S_ISGID 0002000 #define S_ISVTX 0001000 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) #define S_IRWXU 00700 #define S_IRUSR 00400 #define S_IWUSR 00200 #define S_IXUSR 00100 #define S_IRWXG 00070 #define S_IRGRP 00040 #define S_IWGRP 00020 #define S_IXGRP 00010 #define S_IRWXO 00007 #define S_IROTH 00004 #define S_IWOTH 00002 #define S_IXOTH 00001 #endif /* * Timestamp structure for the timestamps in struct statx. * * tv_sec holds the number of seconds before (negative) or after (positive) * 00:00:00 1st January 1970 UTC. * * tv_nsec holds a number of nanoseconds (0..999,999,999) after the tv_sec time. * * __reserved is held in case we need a yet finer resolution. */ struct statx_timestamp { __s64 tv_sec; __u32 tv_nsec; __s32 __reserved; }; /* * Structures for the extended file attribute retrieval system call * (statx()). * * The caller passes a mask of what they're specifically interested in as a * parameter to statx(). What statx() actually got will be indicated in * st_mask upon return. * * For each bit in the mask argument: * * - if the datum is not supported: * * - the bit will be cleared, and * * - the datum will be set to an appropriate fabricated value if one is * available (eg. CIFS can take a default uid and gid), otherwise * * - the field will be cleared; * * - otherwise, if explicitly requested: * * - the datum will be synchronised to the server if AT_STATX_FORCE_SYNC is * set or if the datum is considered out of date, and * * - the field will be filled in and the bit will be set; * * - otherwise, if not requested, but available in approximate form without any * effort, it will be filled in anyway, and the bit will be set upon return * (it might not be up to date, however, and no attempt will be made to * synchronise the internal state first); * * - otherwise the field and the bit will be cleared before returning. * * Items in STATX_BASIC_STATS may be marked unavailable on return, but they * will have values installed for compatibility purposes so that stat() and * co. can be emulated in userspace. */ struct statx { /* 0x00 */ __u32 stx_mask; /* What results were written [uncond] */ __u32 stx_blksize; /* Preferred general I/O size [uncond] */ __u64 stx_attributes; /* Flags conveying information about the file [uncond] */ /* 0x10 */ __u32 stx_nlink; /* Number of hard links */ __u32 stx_uid; /* User ID of owner */ __u32 stx_gid; /* Group ID of owner */ __u16 stx_mode; /* File mode */ __u16 __spare0[1]; /* 0x20 */ __u64 stx_ino; /* Inode number */ __u64 stx_size; /* File size */ __u64 stx_blocks; /* Number of 512-byte blocks allocated */ __u64 stx_attributes_mask; /* Mask to show what's supported in stx_attributes */ /* 0x40 */ struct statx_timestamp stx_atime; /* Last access time */ struct statx_timestamp stx_btime; /* File creation time */ struct statx_timestamp stx_ctime; /* Last attribute change time */ struct statx_timestamp stx_mtime; /* Last data modification time */ /* 0x80 */ __u32 stx_rdev_major; /* Device ID of special file [if bdev/cdev] */ __u32 stx_rdev_minor; __u32 stx_dev_major; /* ID of device containing file [uncond] */ __u32 stx_dev_minor; /* 0x90 */ __u64 __spare2[14]; /* Spare space for future expansion */ /* 0x100 */ }; /* * Flags to be stx_mask * * Query request/result mask for statx() and struct statx::stx_mask. * * These bits should be set in the mask argument of statx() to request * particular items when calling statx(). */ #define STATX_TYPE 0x00000001U /* Want/got stx_mode & S_IFMT */ #define STATX_MODE 0x00000002U /* Want/got stx_mode & ~S_IFMT */ #define STATX_NLINK 0x00000004U /* Want/got stx_nlink */ #define STATX_UID 0x00000008U /* Want/got stx_uid */ #define STATX_GID 0x00000010U /* Want/got stx_gid */ #define STATX_ATIME 0x00000020U /* Want/got stx_atime */ #define STATX_MTIME 0x00000040U /* Want/got stx_mtime */ #define STATX_CTIME 0x00000080U /* Want/got stx_ctime */ #define STATX_INO 0x00000100U /* Want/got stx_ino */ #define STATX_SIZE 0x00000200U /* Want/got stx_size */ #define STATX_BLOCKS 0x00000400U /* Want/got stx_blocks */ #define STATX_BASIC_STATS 0x000007ffU /* The stuff in the normal stat struct */ #define STATX_BTIME 0x00000800U /* Want/got stx_btime */ #define STATX_ALL 0x00000fffU /* All currently supported flags */ #define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */ /* * Attributes to be found in stx_attributes and masked in stx_attributes_mask. * * These give information about the features or the state of a file that might * be of use to ordinary userspace programs such as GUIs or ls rather than * specialised tools. * * Note that the flags marked [I] correspond to generic FS_IOC_FLAGS * semantically. Where possible, the numerical value is picked to correspond * also. */ #define STATX_ATTR_COMPRESSED 0x00000004 /* [I] File is compressed by the fs */ #define STATX_ATTR_IMMUTABLE 0x00000010 /* [I] File is marked immutable */ #define STATX_ATTR_APPEND 0x00000020 /* [I] File is append-only */ #define STATX_ATTR_NODUMP 0x00000040 /* [I] File is not to be dumped */ #define STATX_ATTR_ENCRYPTED 0x00000800 /* [I] File requires key to decrypt in fs */ #define STATX_ATTR_AUTOMOUNT 0x00001000 /* Dir: Automount trigger */ #endif /* _LINUX_STAT_H */ ��������������������������������������������linux/hsr_netlink.h���������������������������������������������������������������������������������0000644�����������������00000002071�14763166027�0010410 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright 2011-2013 Autronica Fire and Security AS * * 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. * * Author(s): * 2011-2013 Arvid Brodin, arvid.brodin@xdin.com */ #ifndef __UAPI_HSR_NETLINK_H #define __UAPI_HSR_NETLINK_H /* Generic Netlink HSR family definition */ /* attributes */ enum { HSR_A_UNSPEC, HSR_A_NODE_ADDR, HSR_A_IFINDEX, HSR_A_IF1_AGE, HSR_A_IF2_AGE, HSR_A_NODE_ADDR_B, HSR_A_IF1_SEQ, HSR_A_IF2_SEQ, HSR_A_IF1_IFINDEX, HSR_A_IF2_IFINDEX, HSR_A_ADDR_B_IFINDEX, __HSR_A_MAX, }; #define HSR_A_MAX (__HSR_A_MAX - 1) /* commands */ enum { HSR_C_UNSPEC, HSR_C_RING_ERROR, HSR_C_NODE_DOWN, HSR_C_GET_NODE_STATUS, HSR_C_SET_NODE_STATUS, HSR_C_GET_NODE_LIST, HSR_C_SET_NODE_LIST, __HSR_C_MAX, }; #define HSR_C_MAX (__HSR_C_MAX - 1) #endif /* __UAPI_HSR_NETLINK_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/route.h���������������������������������������������������������������������������������������0000644�����������������00000004434�14763166027�0007233 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Global definitions for the IP router interface. * * Version: @(#)route.h 1.0.3 05/27/93 * * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1986-1988 * for the purposes of compatibility only. * * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * * Changes: * Mike McLagan : Routing by source * * 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. */ #ifndef _LINUX_ROUTE_H #define _LINUX_ROUTE_H #include <linux/if.h> /* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */ struct rtentry { unsigned long rt_pad1; struct sockaddr rt_dst; /* target address */ struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */ struct sockaddr rt_genmask; /* target network mask (IP) */ unsigned short rt_flags; short rt_pad2; unsigned long rt_pad3; void *rt_pad4; short rt_metric; /* +1 for binary compatibility! */ char *rt_dev; /* forcing the device at add */ unsigned long rt_mtu; /* per route MTU/Window */ #define rt_mss rt_mtu /* Compatibility :-( */ unsigned long rt_window; /* Window clamping */ unsigned short rt_irtt; /* Initial RTT */ }; #define RTF_UP 0x0001 /* route usable */ #define RTF_GATEWAY 0x0002 /* destination is a gateway */ #define RTF_HOST 0x0004 /* host entry (net otherwise) */ #define RTF_REINSTATE 0x0008 /* reinstate route after tmout */ #define RTF_DYNAMIC 0x0010 /* created dyn. (by redirect) */ #define RTF_MODIFIED 0x0020 /* modified dyn. (by redirect) */ #define RTF_MTU 0x0040 /* specific MTU for this route */ #define RTF_MSS RTF_MTU /* Compatibility :-( */ #define RTF_WINDOW 0x0080 /* per route window clamping */ #define RTF_IRTT 0x0100 /* Initial round trip time */ #define RTF_REJECT 0x0200 /* Reject route */ /* * <linux/ipv6_route.h> uses RTF values >= 64k */ #endif /* _LINUX_ROUTE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/tipc_sockets_diag.h���������������������������������������������������������������������������0000644�����������������00000000724�14763166027�0011551 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* AF_TIPC sock_diag interface for querying open sockets */ #ifndef __TIPC_SOCKETS_DIAG_H__ #define __TIPC_SOCKETS_DIAG_H__ #include <linux/types.h> #include <linux/sock_diag.h> /* Request */ struct tipc_sock_diag_req { __u8 sdiag_family; /* must be AF_TIPC */ __u8 sdiag_protocol; /* must be 0 */ __u16 pad; /* must be 0 */ __u32 tidiag_states; /* query*/ }; #endif /* __TIPC_SOCKETS_DIAG_H__ */ ��������������������������������������������linux/if_macsec.h�����������������������������������������������������������������������������������0000644�����������������00000013310�14763166027�0007777 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * include/uapi/linux/if_macsec.h - MACsec device * * Copyright (c) 2015 Sabrina Dubroca <sd@queasysnail.net> * * 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. */ #ifndef _MACSEC_H #define _MACSEC_H #include <linux/types.h> #define MACSEC_GENL_NAME "macsec" #define MACSEC_GENL_VERSION 1 #define MACSEC_MAX_KEY_LEN 128 #define MACSEC_KEYID_LEN 16 /* cipher IDs as per IEEE802.1AEbn-2011 */ #define MACSEC_CIPHER_ID_GCM_AES_128 0x0080C20001000001ULL #define MACSEC_CIPHER_ID_GCM_AES_256 0x0080C20001000002ULL /* deprecated cipher ID for GCM-AES-128 */ #define MACSEC_DEFAULT_CIPHER_ID 0x0080020001000001ULL #define MACSEC_DEFAULT_CIPHER_ALT MACSEC_CIPHER_ID_GCM_AES_128 #define MACSEC_MIN_ICV_LEN 8 #define MACSEC_MAX_ICV_LEN 32 /* upper limit for ICV length as recommended by IEEE802.1AE-2006 */ #define MACSEC_STD_ICV_LEN 16 enum macsec_attrs { MACSEC_ATTR_UNSPEC, MACSEC_ATTR_IFINDEX, /* u32, ifindex of the MACsec netdevice */ MACSEC_ATTR_RXSC_CONFIG, /* config, nested macsec_rxsc_attrs */ MACSEC_ATTR_SA_CONFIG, /* config, nested macsec_sa_attrs */ MACSEC_ATTR_SECY, /* dump, nested macsec_secy_attrs */ MACSEC_ATTR_TXSA_LIST, /* dump, nested, macsec_sa_attrs for each TXSA */ MACSEC_ATTR_RXSC_LIST, /* dump, nested, macsec_rxsc_attrs for each RXSC */ MACSEC_ATTR_TXSC_STATS, /* dump, nested, macsec_txsc_stats_attr */ MACSEC_ATTR_SECY_STATS, /* dump, nested, macsec_secy_stats_attr */ __MACSEC_ATTR_END, NUM_MACSEC_ATTR = __MACSEC_ATTR_END, MACSEC_ATTR_MAX = __MACSEC_ATTR_END - 1, }; enum macsec_secy_attrs { MACSEC_SECY_ATTR_UNSPEC, MACSEC_SECY_ATTR_SCI, MACSEC_SECY_ATTR_ENCODING_SA, MACSEC_SECY_ATTR_WINDOW, MACSEC_SECY_ATTR_CIPHER_SUITE, MACSEC_SECY_ATTR_ICV_LEN, MACSEC_SECY_ATTR_PROTECT, MACSEC_SECY_ATTR_REPLAY, MACSEC_SECY_ATTR_OPER, MACSEC_SECY_ATTR_VALIDATE, MACSEC_SECY_ATTR_ENCRYPT, MACSEC_SECY_ATTR_INC_SCI, MACSEC_SECY_ATTR_ES, MACSEC_SECY_ATTR_SCB, MACSEC_SECY_ATTR_PAD, __MACSEC_SECY_ATTR_END, NUM_MACSEC_SECY_ATTR = __MACSEC_SECY_ATTR_END, MACSEC_SECY_ATTR_MAX = __MACSEC_SECY_ATTR_END - 1, }; enum macsec_rxsc_attrs { MACSEC_RXSC_ATTR_UNSPEC, MACSEC_RXSC_ATTR_SCI, /* config/dump, u64 */ MACSEC_RXSC_ATTR_ACTIVE, /* config/dump, u8 0..1 */ MACSEC_RXSC_ATTR_SA_LIST, /* dump, nested */ MACSEC_RXSC_ATTR_STATS, /* dump, nested, macsec_rxsc_stats_attr */ MACSEC_RXSC_ATTR_PAD, __MACSEC_RXSC_ATTR_END, NUM_MACSEC_RXSC_ATTR = __MACSEC_RXSC_ATTR_END, MACSEC_RXSC_ATTR_MAX = __MACSEC_RXSC_ATTR_END - 1, }; enum macsec_sa_attrs { MACSEC_SA_ATTR_UNSPEC, MACSEC_SA_ATTR_AN, /* config/dump, u8 0..3 */ MACSEC_SA_ATTR_ACTIVE, /* config/dump, u8 0..1 */ MACSEC_SA_ATTR_PN, /* config/dump, u32 */ MACSEC_SA_ATTR_KEY, /* config, data */ MACSEC_SA_ATTR_KEYID, /* config/dump, 128-bit */ MACSEC_SA_ATTR_STATS, /* dump, nested, macsec_sa_stats_attr */ MACSEC_SA_ATTR_PAD, __MACSEC_SA_ATTR_END, NUM_MACSEC_SA_ATTR = __MACSEC_SA_ATTR_END, MACSEC_SA_ATTR_MAX = __MACSEC_SA_ATTR_END - 1, }; enum macsec_nl_commands { MACSEC_CMD_GET_TXSC, MACSEC_CMD_ADD_RXSC, MACSEC_CMD_DEL_RXSC, MACSEC_CMD_UPD_RXSC, MACSEC_CMD_ADD_TXSA, MACSEC_CMD_DEL_TXSA, MACSEC_CMD_UPD_TXSA, MACSEC_CMD_ADD_RXSA, MACSEC_CMD_DEL_RXSA, MACSEC_CMD_UPD_RXSA, }; /* u64 per-RXSC stats */ enum macsec_rxsc_stats_attr { MACSEC_RXSC_STATS_ATTR_UNSPEC, MACSEC_RXSC_STATS_ATTR_IN_OCTETS_VALIDATED, MACSEC_RXSC_STATS_ATTR_IN_OCTETS_DECRYPTED, MACSEC_RXSC_STATS_ATTR_IN_PKTS_UNCHECKED, MACSEC_RXSC_STATS_ATTR_IN_PKTS_DELAYED, MACSEC_RXSC_STATS_ATTR_IN_PKTS_OK, MACSEC_RXSC_STATS_ATTR_IN_PKTS_INVALID, MACSEC_RXSC_STATS_ATTR_IN_PKTS_LATE, MACSEC_RXSC_STATS_ATTR_IN_PKTS_NOT_VALID, MACSEC_RXSC_STATS_ATTR_IN_PKTS_NOT_USING_SA, MACSEC_RXSC_STATS_ATTR_IN_PKTS_UNUSED_SA, MACSEC_RXSC_STATS_ATTR_PAD, __MACSEC_RXSC_STATS_ATTR_END, NUM_MACSEC_RXSC_STATS_ATTR = __MACSEC_RXSC_STATS_ATTR_END, MACSEC_RXSC_STATS_ATTR_MAX = __MACSEC_RXSC_STATS_ATTR_END - 1, }; /* u32 per-{RX,TX}SA stats */ enum macsec_sa_stats_attr { MACSEC_SA_STATS_ATTR_UNSPEC, MACSEC_SA_STATS_ATTR_IN_PKTS_OK, MACSEC_SA_STATS_ATTR_IN_PKTS_INVALID, MACSEC_SA_STATS_ATTR_IN_PKTS_NOT_VALID, MACSEC_SA_STATS_ATTR_IN_PKTS_NOT_USING_SA, MACSEC_SA_STATS_ATTR_IN_PKTS_UNUSED_SA, MACSEC_SA_STATS_ATTR_OUT_PKTS_PROTECTED, MACSEC_SA_STATS_ATTR_OUT_PKTS_ENCRYPTED, __MACSEC_SA_STATS_ATTR_END, NUM_MACSEC_SA_STATS_ATTR = __MACSEC_SA_STATS_ATTR_END, MACSEC_SA_STATS_ATTR_MAX = __MACSEC_SA_STATS_ATTR_END - 1, }; /* u64 per-TXSC stats */ enum macsec_txsc_stats_attr { MACSEC_TXSC_STATS_ATTR_UNSPEC, MACSEC_TXSC_STATS_ATTR_OUT_PKTS_PROTECTED, MACSEC_TXSC_STATS_ATTR_OUT_PKTS_ENCRYPTED, MACSEC_TXSC_STATS_ATTR_OUT_OCTETS_PROTECTED, MACSEC_TXSC_STATS_ATTR_OUT_OCTETS_ENCRYPTED, MACSEC_TXSC_STATS_ATTR_PAD, __MACSEC_TXSC_STATS_ATTR_END, NUM_MACSEC_TXSC_STATS_ATTR = __MACSEC_TXSC_STATS_ATTR_END, MACSEC_TXSC_STATS_ATTR_MAX = __MACSEC_TXSC_STATS_ATTR_END - 1, }; /* u64 per-SecY stats */ enum macsec_secy_stats_attr { MACSEC_SECY_STATS_ATTR_UNSPEC, MACSEC_SECY_STATS_ATTR_OUT_PKTS_UNTAGGED, MACSEC_SECY_STATS_ATTR_IN_PKTS_UNTAGGED, MACSEC_SECY_STATS_ATTR_OUT_PKTS_TOO_LONG, MACSEC_SECY_STATS_ATTR_IN_PKTS_NO_TAG, MACSEC_SECY_STATS_ATTR_IN_PKTS_BAD_TAG, MACSEC_SECY_STATS_ATTR_IN_PKTS_UNKNOWN_SCI, MACSEC_SECY_STATS_ATTR_IN_PKTS_NO_SCI, MACSEC_SECY_STATS_ATTR_IN_PKTS_OVERRUN, MACSEC_SECY_STATS_ATTR_PAD, __MACSEC_SECY_STATS_ATTR_END, NUM_MACSEC_SECY_STATS_ATTR = __MACSEC_SECY_STATS_ATTR_END, MACSEC_SECY_STATS_ATTR_MAX = __MACSEC_SECY_STATS_ATTR_END - 1, }; #endif /* _MACSEC_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/bt-bmc.h��������������������������������������������������������������������������������������0000644�����������������00000001074�14763166027�0007236 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 2015-2016, IBM Corporation. * * 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. */ #ifndef _LINUX_BT_BMC_H #define _LINUX_BT_BMC_H #include <linux/ioctl.h> #define __BT_BMC_IOCTL_MAGIC 0xb1 #define BT_BMC_IOCTL_SMS_ATN _IO(__BT_BMC_IOCTL_MAGIC, 0x00) #endif /* _LINUX_BT_BMC_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/kfd_ioctl.h�����������������������������������������������������������������������������������0000644�����������������00000034450�14763166027�0010034 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef KFD_IOCTL_H_INCLUDED #define KFD_IOCTL_H_INCLUDED #include <drm/drm.h> #include <linux/ioctl.h> #define KFD_IOCTL_MAJOR_VERSION 1 #define KFD_IOCTL_MINOR_VERSION 1 struct kfd_ioctl_get_version_args { __u32 major_version; /* from KFD */ __u32 minor_version; /* from KFD */ }; /* For kfd_ioctl_create_queue_args.queue_type. */ #define KFD_IOC_QUEUE_TYPE_COMPUTE 0 #define KFD_IOC_QUEUE_TYPE_SDMA 1 #define KFD_IOC_QUEUE_TYPE_COMPUTE_AQL 2 #define KFD_MAX_QUEUE_PERCENTAGE 100 #define KFD_MAX_QUEUE_PRIORITY 15 struct kfd_ioctl_create_queue_args { __u64 ring_base_address; /* to KFD */ __u64 write_pointer_address; /* from KFD */ __u64 read_pointer_address; /* from KFD */ __u64 doorbell_offset; /* from KFD */ __u32 ring_size; /* to KFD */ __u32 gpu_id; /* to KFD */ __u32 queue_type; /* to KFD */ __u32 queue_percentage; /* to KFD */ __u32 queue_priority; /* to KFD */ __u32 queue_id; /* from KFD */ __u64 eop_buffer_address; /* to KFD */ __u64 eop_buffer_size; /* to KFD */ __u64 ctx_save_restore_address; /* to KFD */ __u32 ctx_save_restore_size; /* to KFD */ __u32 ctl_stack_size; /* to KFD */ }; struct kfd_ioctl_destroy_queue_args { __u32 queue_id; /* to KFD */ __u32 pad; }; struct kfd_ioctl_update_queue_args { __u64 ring_base_address; /* to KFD */ __u32 queue_id; /* to KFD */ __u32 ring_size; /* to KFD */ __u32 queue_percentage; /* to KFD */ __u32 queue_priority; /* to KFD */ }; struct kfd_ioctl_set_cu_mask_args { __u32 queue_id; /* to KFD */ __u32 num_cu_mask; /* to KFD */ __u64 cu_mask_ptr; /* to KFD */ }; /* For kfd_ioctl_set_memory_policy_args.default_policy and alternate_policy */ #define KFD_IOC_CACHE_POLICY_COHERENT 0 #define KFD_IOC_CACHE_POLICY_NONCOHERENT 1 struct kfd_ioctl_set_memory_policy_args { __u64 alternate_aperture_base; /* to KFD */ __u64 alternate_aperture_size; /* to KFD */ __u32 gpu_id; /* to KFD */ __u32 default_policy; /* to KFD */ __u32 alternate_policy; /* to KFD */ __u32 pad; }; /* * All counters are monotonic. They are used for profiling of compute jobs. * The profiling is done by userspace. * * In case of GPU reset, the counter should not be affected. */ struct kfd_ioctl_get_clock_counters_args { __u64 gpu_clock_counter; /* from KFD */ __u64 cpu_clock_counter; /* from KFD */ __u64 system_clock_counter; /* from KFD */ __u64 system_clock_freq; /* from KFD */ __u32 gpu_id; /* to KFD */ __u32 pad; }; struct kfd_process_device_apertures { __u64 lds_base; /* from KFD */ __u64 lds_limit; /* from KFD */ __u64 scratch_base; /* from KFD */ __u64 scratch_limit; /* from KFD */ __u64 gpuvm_base; /* from KFD */ __u64 gpuvm_limit; /* from KFD */ __u32 gpu_id; /* from KFD */ __u32 pad; }; /* * AMDKFD_IOC_GET_PROCESS_APERTURES is deprecated. Use * AMDKFD_IOC_GET_PROCESS_APERTURES_NEW instead, which supports an * unlimited number of GPUs. */ #define NUM_OF_SUPPORTED_GPUS 7 struct kfd_ioctl_get_process_apertures_args { struct kfd_process_device_apertures process_apertures[NUM_OF_SUPPORTED_GPUS];/* from KFD */ /* from KFD, should be in the range [1 - NUM_OF_SUPPORTED_GPUS] */ __u32 num_of_nodes; __u32 pad; }; struct kfd_ioctl_get_process_apertures_new_args { /* User allocated. Pointer to struct kfd_process_device_apertures * filled in by Kernel */ __u64 kfd_process_device_apertures_ptr; /* to KFD - indicates amount of memory present in * kfd_process_device_apertures_ptr * from KFD - Number of entries filled by KFD. */ __u32 num_of_nodes; __u32 pad; }; #define MAX_ALLOWED_NUM_POINTS 100 #define MAX_ALLOWED_AW_BUFF_SIZE 4096 #define MAX_ALLOWED_WAC_BUFF_SIZE 128 struct kfd_ioctl_dbg_register_args { __u32 gpu_id; /* to KFD */ __u32 pad; }; struct kfd_ioctl_dbg_unregister_args { __u32 gpu_id; /* to KFD */ __u32 pad; }; struct kfd_ioctl_dbg_address_watch_args { __u64 content_ptr; /* a pointer to the actual content */ __u32 gpu_id; /* to KFD */ __u32 buf_size_in_bytes; /*including gpu_id and buf_size */ }; struct kfd_ioctl_dbg_wave_control_args { __u64 content_ptr; /* a pointer to the actual content */ __u32 gpu_id; /* to KFD */ __u32 buf_size_in_bytes; /*including gpu_id and buf_size */ }; /* Matching HSA_EVENTTYPE */ #define KFD_IOC_EVENT_SIGNAL 0 #define KFD_IOC_EVENT_NODECHANGE 1 #define KFD_IOC_EVENT_DEVICESTATECHANGE 2 #define KFD_IOC_EVENT_HW_EXCEPTION 3 #define KFD_IOC_EVENT_SYSTEM_EVENT 4 #define KFD_IOC_EVENT_DEBUG_EVENT 5 #define KFD_IOC_EVENT_PROFILE_EVENT 6 #define KFD_IOC_EVENT_QUEUE_EVENT 7 #define KFD_IOC_EVENT_MEMORY 8 #define KFD_IOC_WAIT_RESULT_COMPLETE 0 #define KFD_IOC_WAIT_RESULT_TIMEOUT 1 #define KFD_IOC_WAIT_RESULT_FAIL 2 #define KFD_SIGNAL_EVENT_LIMIT 4096 /* For kfd_event_data.hw_exception_data.reset_type. */ #define KFD_HW_EXCEPTION_WHOLE_GPU_RESET 0 #define KFD_HW_EXCEPTION_PER_ENGINE_RESET 1 /* For kfd_event_data.hw_exception_data.reset_cause. */ #define KFD_HW_EXCEPTION_GPU_HANG 0 #define KFD_HW_EXCEPTION_ECC 1 struct kfd_ioctl_create_event_args { __u64 event_page_offset; /* from KFD */ __u32 event_trigger_data; /* from KFD - signal events only */ __u32 event_type; /* to KFD */ __u32 auto_reset; /* to KFD */ __u32 node_id; /* to KFD - only valid for certain event types */ __u32 event_id; /* from KFD */ __u32 event_slot_index; /* from KFD */ }; struct kfd_ioctl_destroy_event_args { __u32 event_id; /* to KFD */ __u32 pad; }; struct kfd_ioctl_set_event_args { __u32 event_id; /* to KFD */ __u32 pad; }; struct kfd_ioctl_reset_event_args { __u32 event_id; /* to KFD */ __u32 pad; }; struct kfd_memory_exception_failure { __u32 NotPresent; /* Page not present or supervisor privilege */ __u32 ReadOnly; /* Write access to a read-only page */ __u32 NoExecute; /* Execute access to a page marked NX */ __u32 imprecise; /* Can't determine the exact fault address */ }; /* memory exception data*/ struct kfd_hsa_memory_exception_data { struct kfd_memory_exception_failure failure; __u64 va; __u32 gpu_id; __u32 pad; }; /* hw exception data */ struct kfd_hsa_hw_exception_data { __u32 reset_type; __u32 reset_cause; __u32 memory_lost; __u32 gpu_id; }; /* Event data */ struct kfd_event_data { union { struct kfd_hsa_memory_exception_data memory_exception_data; struct kfd_hsa_hw_exception_data hw_exception_data; }; /* From KFD */ __u64 kfd_event_data_ext; /* pointer to an extension structure for future exception types */ __u32 event_id; /* to KFD */ __u32 pad; }; struct kfd_ioctl_wait_events_args { __u64 events_ptr; /* pointed to struct kfd_event_data array, to KFD */ __u32 num_events; /* to KFD */ __u32 wait_for_all; /* to KFD */ __u32 timeout; /* to KFD */ __u32 wait_result; /* from KFD */ }; struct kfd_ioctl_set_scratch_backing_va_args { __u64 va_addr; /* to KFD */ __u32 gpu_id; /* to KFD */ __u32 pad; }; struct kfd_ioctl_get_tile_config_args { /* to KFD: pointer to tile array */ __u64 tile_config_ptr; /* to KFD: pointer to macro tile array */ __u64 macro_tile_config_ptr; /* to KFD: array size allocated by user mode * from KFD: array size filled by kernel */ __u32 num_tile_configs; /* to KFD: array size allocated by user mode * from KFD: array size filled by kernel */ __u32 num_macro_tile_configs; __u32 gpu_id; /* to KFD */ __u32 gb_addr_config; /* from KFD */ __u32 num_banks; /* from KFD */ __u32 num_ranks; /* from KFD */ /* struct size can be extended later if needed * without breaking ABI compatibility */ }; struct kfd_ioctl_set_trap_handler_args { __u64 tba_addr; /* to KFD */ __u64 tma_addr; /* to KFD */ __u32 gpu_id; /* to KFD */ __u32 pad; }; struct kfd_ioctl_acquire_vm_args { __u32 drm_fd; /* to KFD */ __u32 gpu_id; /* to KFD */ }; /* Allocation flags: memory types */ #define KFD_IOC_ALLOC_MEM_FLAGS_VRAM (1 << 0) #define KFD_IOC_ALLOC_MEM_FLAGS_GTT (1 << 1) #define KFD_IOC_ALLOC_MEM_FLAGS_USERPTR (1 << 2) #define KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL (1 << 3) /* Allocation flags: attributes/access options */ #define KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE (1 << 31) #define KFD_IOC_ALLOC_MEM_FLAGS_EXECUTABLE (1 << 30) #define KFD_IOC_ALLOC_MEM_FLAGS_PUBLIC (1 << 29) #define KFD_IOC_ALLOC_MEM_FLAGS_NO_SUBSTITUTE (1 << 28) #define KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM (1 << 27) #define KFD_IOC_ALLOC_MEM_FLAGS_COHERENT (1 << 26) /* Allocate memory for later SVM (shared virtual memory) mapping. * * @va_addr: virtual address of the memory to be allocated * all later mappings on all GPUs will use this address * @size: size in bytes * @handle: buffer handle returned to user mode, used to refer to * this allocation for mapping, unmapping and freeing * @mmap_offset: for CPU-mapping the allocation by mmapping a render node * for userptrs this is overloaded to specify the CPU address * @gpu_id: device identifier * @flags: memory type and attributes. See KFD_IOC_ALLOC_MEM_FLAGS above */ struct kfd_ioctl_alloc_memory_of_gpu_args { __u64 va_addr; /* to KFD */ __u64 size; /* to KFD */ __u64 handle; /* from KFD */ __u64 mmap_offset; /* to KFD (userptr), from KFD (mmap offset) */ __u32 gpu_id; /* to KFD */ __u32 flags; }; /* Free memory allocated with kfd_ioctl_alloc_memory_of_gpu * * @handle: memory handle returned by alloc */ struct kfd_ioctl_free_memory_of_gpu_args { __u64 handle; /* to KFD */ }; /* Map memory to one or more GPUs * * @handle: memory handle returned by alloc * @device_ids_array_ptr: array of gpu_ids (__u32 per device) * @n_devices: number of devices in the array * @n_success: number of devices mapped successfully * * @n_success returns information to the caller how many devices from * the start of the array have mapped the buffer successfully. It can * be passed into a subsequent retry call to skip those devices. For * the first call the caller should initialize it to 0. * * If the ioctl completes with return code 0 (success), n_success == * n_devices. */ struct kfd_ioctl_map_memory_to_gpu_args { __u64 handle; /* to KFD */ __u64 device_ids_array_ptr; /* to KFD */ __u32 n_devices; /* to KFD */ __u32 n_success; /* to/from KFD */ }; /* Unmap memory from one or more GPUs * * same arguments as for mapping */ struct kfd_ioctl_unmap_memory_from_gpu_args { __u64 handle; /* to KFD */ __u64 device_ids_array_ptr; /* to KFD */ __u32 n_devices; /* to KFD */ __u32 n_success; /* to/from KFD */ }; #define AMDKFD_IOCTL_BASE 'K' #define AMDKFD_IO(nr) _IO(AMDKFD_IOCTL_BASE, nr) #define AMDKFD_IOR(nr, type) _IOR(AMDKFD_IOCTL_BASE, nr, type) #define AMDKFD_IOW(nr, type) _IOW(AMDKFD_IOCTL_BASE, nr, type) #define AMDKFD_IOWR(nr, type) _IOWR(AMDKFD_IOCTL_BASE, nr, type) #define AMDKFD_IOC_GET_VERSION \ AMDKFD_IOR(0x01, struct kfd_ioctl_get_version_args) #define AMDKFD_IOC_CREATE_QUEUE \ AMDKFD_IOWR(0x02, struct kfd_ioctl_create_queue_args) #define AMDKFD_IOC_DESTROY_QUEUE \ AMDKFD_IOWR(0x03, struct kfd_ioctl_destroy_queue_args) #define AMDKFD_IOC_SET_MEMORY_POLICY \ AMDKFD_IOW(0x04, struct kfd_ioctl_set_memory_policy_args) #define AMDKFD_IOC_GET_CLOCK_COUNTERS \ AMDKFD_IOWR(0x05, struct kfd_ioctl_get_clock_counters_args) #define AMDKFD_IOC_GET_PROCESS_APERTURES \ AMDKFD_IOR(0x06, struct kfd_ioctl_get_process_apertures_args) #define AMDKFD_IOC_UPDATE_QUEUE \ AMDKFD_IOW(0x07, struct kfd_ioctl_update_queue_args) #define AMDKFD_IOC_CREATE_EVENT \ AMDKFD_IOWR(0x08, struct kfd_ioctl_create_event_args) #define AMDKFD_IOC_DESTROY_EVENT \ AMDKFD_IOW(0x09, struct kfd_ioctl_destroy_event_args) #define AMDKFD_IOC_SET_EVENT \ AMDKFD_IOW(0x0A, struct kfd_ioctl_set_event_args) #define AMDKFD_IOC_RESET_EVENT \ AMDKFD_IOW(0x0B, struct kfd_ioctl_reset_event_args) #define AMDKFD_IOC_WAIT_EVENTS \ AMDKFD_IOWR(0x0C, struct kfd_ioctl_wait_events_args) #define AMDKFD_IOC_DBG_REGISTER \ AMDKFD_IOW(0x0D, struct kfd_ioctl_dbg_register_args) #define AMDKFD_IOC_DBG_UNREGISTER \ AMDKFD_IOW(0x0E, struct kfd_ioctl_dbg_unregister_args) #define AMDKFD_IOC_DBG_ADDRESS_WATCH \ AMDKFD_IOW(0x0F, struct kfd_ioctl_dbg_address_watch_args) #define AMDKFD_IOC_DBG_WAVE_CONTROL \ AMDKFD_IOW(0x10, struct kfd_ioctl_dbg_wave_control_args) #define AMDKFD_IOC_SET_SCRATCH_BACKING_VA \ AMDKFD_IOWR(0x11, struct kfd_ioctl_set_scratch_backing_va_args) #define AMDKFD_IOC_GET_TILE_CONFIG \ AMDKFD_IOWR(0x12, struct kfd_ioctl_get_tile_config_args) #define AMDKFD_IOC_SET_TRAP_HANDLER \ AMDKFD_IOW(0x13, struct kfd_ioctl_set_trap_handler_args) #define AMDKFD_IOC_GET_PROCESS_APERTURES_NEW \ AMDKFD_IOWR(0x14, \ struct kfd_ioctl_get_process_apertures_new_args) #define AMDKFD_IOC_ACQUIRE_VM \ AMDKFD_IOW(0x15, struct kfd_ioctl_acquire_vm_args) #define AMDKFD_IOC_ALLOC_MEMORY_OF_GPU \ AMDKFD_IOWR(0x16, struct kfd_ioctl_alloc_memory_of_gpu_args) #define AMDKFD_IOC_FREE_MEMORY_OF_GPU \ AMDKFD_IOW(0x17, struct kfd_ioctl_free_memory_of_gpu_args) #define AMDKFD_IOC_MAP_MEMORY_TO_GPU \ AMDKFD_IOWR(0x18, struct kfd_ioctl_map_memory_to_gpu_args) #define AMDKFD_IOC_UNMAP_MEMORY_FROM_GPU \ AMDKFD_IOWR(0x19, struct kfd_ioctl_unmap_memory_from_gpu_args) #define AMDKFD_IOC_SET_CU_MASK \ AMDKFD_IOW(0x1A, struct kfd_ioctl_set_cu_mask_args) #define AMDKFD_COMMAND_START 0x01 #define AMDKFD_COMMAND_END 0x1B #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/v4l2-mediabus.h�������������������������������������������������������������������������������0000644�����������������00000011755�14763166027�0010457 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Media Bus API header * * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef __LINUX_V4L2_MEDIABUS_H #define __LINUX_V4L2_MEDIABUS_H #include <linux/media-bus-format.h> #include <linux/types.h> #include <linux/videodev2.h> /** * struct v4l2_mbus_framefmt - frame format on the media bus * @width: image width * @height: image height * @code: data format code (from enum v4l2_mbus_pixelcode) * @field: used interlacing type (from enum v4l2_field) * @colorspace: colorspace of the data (from enum v4l2_colorspace) * @ycbcr_enc: YCbCr encoding of the data (from enum v4l2_ycbcr_encoding) * @quantization: quantization of the data (from enum v4l2_quantization) * @xfer_func: transfer function of the data (from enum v4l2_xfer_func) */ struct v4l2_mbus_framefmt { __u32 width; __u32 height; __u32 code; __u32 field; __u32 colorspace; __u16 ycbcr_enc; __u16 quantization; __u16 xfer_func; __u16 reserved[11]; }; /* * enum v4l2_mbus_pixelcode and its definitions are now deprecated, and * MEDIA_BUS_FMT_ definitions (defined in media-bus-format.h) should be * used instead. * * New defines should only be added to media-bus-format.h. The * v4l2_mbus_pixelcode enum is frozen. */ #define V4L2_MBUS_FROM_MEDIA_BUS_FMT(name) \ V4L2_MBUS_FMT_ ## name = MEDIA_BUS_FMT_ ## name enum v4l2_mbus_pixelcode { V4L2_MBUS_FROM_MEDIA_BUS_FMT(FIXED), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB444_2X8_PADHI_BE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB444_2X8_PADHI_LE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB555_2X8_PADHI_BE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB555_2X8_PADHI_LE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(BGR565_2X8_BE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(BGR565_2X8_LE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB565_2X8_BE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB565_2X8_LE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB666_1X18), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB888_1X24), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB888_2X12_BE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB888_2X12_LE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(ARGB8888_1X32), V4L2_MBUS_FROM_MEDIA_BUS_FMT(Y8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(UV8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY8_1_5X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY8_1_5X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV8_1_5X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU8_1_5X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY8_2X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY8_2X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV8_2X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU8_2X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(Y10_1X10), V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY10_2X10), V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY10_2X10), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV10_2X10), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU10_2X10), V4L2_MBUS_FROM_MEDIA_BUS_FMT(Y12_1X12), V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY8_1X16), V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY8_1X16), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV8_1X16), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU8_1X16), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YDYUYDYV8_1X16), V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY10_1X20), V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY10_1X20), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV10_1X20), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU10_1X20), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUV10_1X30), V4L2_MBUS_FROM_MEDIA_BUS_FMT(AYUV8_1X32), V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY12_2X12), V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY12_2X12), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV12_2X12), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU12_2X12), V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY12_1X24), V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY12_1X24), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV12_1X24), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU12_1X24), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_ALAW8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG10_ALAW8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG10_ALAW8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB10_ALAW8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_DPCM8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG10_DPCM8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG10_DPCM8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB10_DPCM8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_2X8_PADHI_BE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_2X8_PADHI_LE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_2X8_PADLO_BE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_2X8_PADLO_LE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_1X10), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG10_1X10), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG10_1X10), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB10_1X10), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR12_1X12), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG12_1X12), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG12_1X12), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB12_1X12), V4L2_MBUS_FROM_MEDIA_BUS_FMT(JPEG_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(S5C_UYVY_JPEG_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(AHSV8888_1X32), }; #endif �������������������linux/xfrm.h����������������������������������������������������������������������������������������0000644�����������������00000027332�14763166027�0007053 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_XFRM_H #define _LINUX_XFRM_H #include <linux/in6.h> #include <linux/types.h> /* All of the structures in this file may not change size as they are * passed into the kernel from userspace via netlink sockets. */ /* Structure to encapsulate addresses. I do not want to use * "standard" structure. My apologies. */ typedef union { __be32 a4; __be32 a6[4]; struct in6_addr in6; } xfrm_address_t; /* Ident of a specific xfrm_state. It is used on input to lookup * the state by (spi,daddr,ah/esp) or to store information about * spi, protocol and tunnel address on output. */ struct xfrm_id { xfrm_address_t daddr; __be32 spi; __u8 proto; }; struct xfrm_sec_ctx { __u8 ctx_doi; __u8 ctx_alg; __u16 ctx_len; __u32 ctx_sid; char ctx_str[0]; }; /* Security Context Domains of Interpretation */ #define XFRM_SC_DOI_RESERVED 0 #define XFRM_SC_DOI_LSM 1 /* Security Context Algorithms */ #define XFRM_SC_ALG_RESERVED 0 #define XFRM_SC_ALG_SELINUX 1 /* Selector, used as selector both on policy rules (SPD) and SAs. */ struct xfrm_selector { xfrm_address_t daddr; xfrm_address_t saddr; __be16 dport; __be16 dport_mask; __be16 sport; __be16 sport_mask; __u16 family; __u8 prefixlen_d; __u8 prefixlen_s; __u8 proto; int ifindex; __kernel_uid32_t user; }; #define XFRM_INF (~(__u64)0) struct xfrm_lifetime_cfg { __u64 soft_byte_limit; __u64 hard_byte_limit; __u64 soft_packet_limit; __u64 hard_packet_limit; __u64 soft_add_expires_seconds; __u64 hard_add_expires_seconds; __u64 soft_use_expires_seconds; __u64 hard_use_expires_seconds; }; struct xfrm_lifetime_cur { __u64 bytes; __u64 packets; __u64 add_time; __u64 use_time; }; struct xfrm_replay_state { __u32 oseq; __u32 seq; __u32 bitmap; }; #define XFRMA_REPLAY_ESN_MAX 4096 struct xfrm_replay_state_esn { unsigned int bmp_len; __u32 oseq; __u32 seq; __u32 oseq_hi; __u32 seq_hi; __u32 replay_window; __u32 bmp[0]; }; struct xfrm_algo { char alg_name[64]; unsigned int alg_key_len; /* in bits */ char alg_key[0]; }; struct xfrm_algo_auth { char alg_name[64]; unsigned int alg_key_len; /* in bits */ unsigned int alg_trunc_len; /* in bits */ char alg_key[0]; }; struct xfrm_algo_aead { char alg_name[64]; unsigned int alg_key_len; /* in bits */ unsigned int alg_icv_len; /* in bits */ char alg_key[0]; }; struct xfrm_stats { __u32 replay_window; __u32 replay; __u32 integrity_failed; }; enum { XFRM_POLICY_TYPE_MAIN = 0, XFRM_POLICY_TYPE_SUB = 1, XFRM_POLICY_TYPE_MAX = 2, XFRM_POLICY_TYPE_ANY = 255 }; enum { XFRM_POLICY_IN = 0, XFRM_POLICY_OUT = 1, XFRM_POLICY_FWD = 2, XFRM_POLICY_MASK = 3, XFRM_POLICY_MAX = 3 }; enum { XFRM_SHARE_ANY, /* No limitations */ XFRM_SHARE_SESSION, /* For this session only */ XFRM_SHARE_USER, /* For this user only */ XFRM_SHARE_UNIQUE /* Use once */ }; #define XFRM_MODE_TRANSPORT 0 #define XFRM_MODE_TUNNEL 1 #define XFRM_MODE_ROUTEOPTIMIZATION 2 #define XFRM_MODE_IN_TRIGGER 3 #define XFRM_MODE_BEET 4 #define XFRM_MODE_MAX 5 /* Netlink configuration messages. */ enum { XFRM_MSG_BASE = 0x10, XFRM_MSG_NEWSA = 0x10, #define XFRM_MSG_NEWSA XFRM_MSG_NEWSA XFRM_MSG_DELSA, #define XFRM_MSG_DELSA XFRM_MSG_DELSA XFRM_MSG_GETSA, #define XFRM_MSG_GETSA XFRM_MSG_GETSA XFRM_MSG_NEWPOLICY, #define XFRM_MSG_NEWPOLICY XFRM_MSG_NEWPOLICY XFRM_MSG_DELPOLICY, #define XFRM_MSG_DELPOLICY XFRM_MSG_DELPOLICY XFRM_MSG_GETPOLICY, #define XFRM_MSG_GETPOLICY XFRM_MSG_GETPOLICY XFRM_MSG_ALLOCSPI, #define XFRM_MSG_ALLOCSPI XFRM_MSG_ALLOCSPI XFRM_MSG_ACQUIRE, #define XFRM_MSG_ACQUIRE XFRM_MSG_ACQUIRE XFRM_MSG_EXPIRE, #define XFRM_MSG_EXPIRE XFRM_MSG_EXPIRE XFRM_MSG_UPDPOLICY, #define XFRM_MSG_UPDPOLICY XFRM_MSG_UPDPOLICY XFRM_MSG_UPDSA, #define XFRM_MSG_UPDSA XFRM_MSG_UPDSA XFRM_MSG_POLEXPIRE, #define XFRM_MSG_POLEXPIRE XFRM_MSG_POLEXPIRE XFRM_MSG_FLUSHSA, #define XFRM_MSG_FLUSHSA XFRM_MSG_FLUSHSA XFRM_MSG_FLUSHPOLICY, #define XFRM_MSG_FLUSHPOLICY XFRM_MSG_FLUSHPOLICY XFRM_MSG_NEWAE, #define XFRM_MSG_NEWAE XFRM_MSG_NEWAE XFRM_MSG_GETAE, #define XFRM_MSG_GETAE XFRM_MSG_GETAE XFRM_MSG_REPORT, #define XFRM_MSG_REPORT XFRM_MSG_REPORT XFRM_MSG_MIGRATE, #define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE XFRM_MSG_NEWSADINFO, #define XFRM_MSG_NEWSADINFO XFRM_MSG_NEWSADINFO XFRM_MSG_GETSADINFO, #define XFRM_MSG_GETSADINFO XFRM_MSG_GETSADINFO XFRM_MSG_NEWSPDINFO, #define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO XFRM_MSG_GETSPDINFO, #define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO XFRM_MSG_MAPPING, #define XFRM_MSG_MAPPING XFRM_MSG_MAPPING __XFRM_MSG_MAX }; #define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) #define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE) /* * Generic LSM security context for comunicating to user space * NOTE: Same format as sadb_x_sec_ctx */ struct xfrm_user_sec_ctx { __u16 len; __u16 exttype; __u8 ctx_alg; /* LSMs: e.g., selinux == 1 */ __u8 ctx_doi; __u16 ctx_len; }; struct xfrm_user_tmpl { struct xfrm_id id; __u16 family; xfrm_address_t saddr; __u32 reqid; __u8 mode; __u8 share; __u8 optional; __u32 aalgos; __u32 ealgos; __u32 calgos; }; struct xfrm_encap_tmpl { __u16 encap_type; __be16 encap_sport; __be16 encap_dport; xfrm_address_t encap_oa; }; /* AEVENT flags */ enum xfrm_ae_ftype_t { XFRM_AE_UNSPEC, XFRM_AE_RTHR=1, /* replay threshold*/ XFRM_AE_RVAL=2, /* replay value */ XFRM_AE_LVAL=4, /* lifetime value */ XFRM_AE_ETHR=8, /* expiry timer threshold */ XFRM_AE_CR=16, /* Event cause is replay update */ XFRM_AE_CE=32, /* Event cause is timer expiry */ XFRM_AE_CU=64, /* Event cause is policy update */ __XFRM_AE_MAX #define XFRM_AE_MAX (__XFRM_AE_MAX - 1) }; struct xfrm_userpolicy_type { __u8 type; __u16 reserved1; __u8 reserved2; }; /* Netlink message attributes. */ enum xfrm_attr_type_t { XFRMA_UNSPEC, XFRMA_ALG_AUTH, /* struct xfrm_algo */ XFRMA_ALG_CRYPT, /* struct xfrm_algo */ XFRMA_ALG_COMP, /* struct xfrm_algo */ XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */ XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ XFRMA_SA, /* struct xfrm_usersa_info */ XFRMA_POLICY, /*struct xfrm_userpolicy_info */ XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */ XFRMA_LTIME_VAL, XFRMA_REPLAY_VAL, XFRMA_REPLAY_THRESH, XFRMA_ETIMER_THRESH, XFRMA_SRCADDR, /* xfrm_address_t */ XFRMA_COADDR, /* xfrm_address_t */ XFRMA_LASTUSED, /* unsigned long */ XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ XFRMA_MIGRATE, XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */ XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */ XFRMA_MARK, /* struct xfrm_mark */ XFRMA_TFCPAD, /* __u32 */ XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_state_esn */ XFRMA_SA_EXTRA_FLAGS, /* __u32 */ XFRMA_PROTO, /* __u8 */ XFRMA_ADDRESS_FILTER, /* struct xfrm_address_filter */ XFRMA_PAD, XFRMA_OFFLOAD_DEV, /* struct xfrm_user_offload */ XFRMA_SET_MARK, /* __u32 */ XFRMA_SET_MARK_MASK, /* __u32 */ XFRMA_IF_ID, /* __u32 */ __XFRMA_MAX #define XFRMA_OUTPUT_MARK XFRMA_SET_MARK /* Compatibility */ #define XFRMA_MAX (__XFRMA_MAX - 1) }; struct xfrm_mark { __u32 v; /* value */ __u32 m; /* mask */ }; enum xfrm_sadattr_type_t { XFRMA_SAD_UNSPEC, XFRMA_SAD_CNT, XFRMA_SAD_HINFO, __XFRMA_SAD_MAX #define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1) }; struct xfrmu_sadhinfo { __u32 sadhcnt; /* current hash bkts */ __u32 sadhmcnt; /* max allowed hash bkts */ }; enum xfrm_spdattr_type_t { XFRMA_SPD_UNSPEC, XFRMA_SPD_INFO, XFRMA_SPD_HINFO, XFRMA_SPD_IPV4_HTHRESH, XFRMA_SPD_IPV6_HTHRESH, __XFRMA_SPD_MAX #define XFRMA_SPD_MAX (__XFRMA_SPD_MAX - 1) }; struct xfrmu_spdinfo { __u32 incnt; __u32 outcnt; __u32 fwdcnt; __u32 inscnt; __u32 outscnt; __u32 fwdscnt; }; struct xfrmu_spdhinfo { __u32 spdhcnt; __u32 spdhmcnt; }; struct xfrmu_spdhthresh { __u8 lbits; __u8 rbits; }; struct xfrm_usersa_info { struct xfrm_selector sel; struct xfrm_id id; xfrm_address_t saddr; struct xfrm_lifetime_cfg lft; struct xfrm_lifetime_cur curlft; struct xfrm_stats stats; __u32 seq; __u32 reqid; __u16 family; __u8 mode; /* XFRM_MODE_xxx */ __u8 replay_window; __u8 flags; #define XFRM_STATE_NOECN 1 #define XFRM_STATE_DECAP_DSCP 2 #define XFRM_STATE_NOPMTUDISC 4 #define XFRM_STATE_WILDRECV 8 #define XFRM_STATE_ICMP 16 #define XFRM_STATE_AF_UNSPEC 32 #define XFRM_STATE_ALIGN4 64 #define XFRM_STATE_ESN 128 }; #define XFRM_SA_XFLAG_DONT_ENCAP_DSCP 1 struct xfrm_usersa_id { xfrm_address_t daddr; __be32 spi; __u16 family; __u8 proto; }; struct xfrm_aevent_id { struct xfrm_usersa_id sa_id; xfrm_address_t saddr; __u32 flags; __u32 reqid; }; struct xfrm_userspi_info { struct xfrm_usersa_info info; __u32 min; __u32 max; }; struct xfrm_userpolicy_info { struct xfrm_selector sel; struct xfrm_lifetime_cfg lft; struct xfrm_lifetime_cur curlft; __u32 priority; __u32 index; __u8 dir; __u8 action; #define XFRM_POLICY_ALLOW 0 #define XFRM_POLICY_BLOCK 1 __u8 flags; #define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */ /* Automatically expand selector to include matching ICMP payloads. */ #define XFRM_POLICY_ICMP 2 __u8 share; }; struct xfrm_userpolicy_id { struct xfrm_selector sel; __u32 index; __u8 dir; }; struct xfrm_user_acquire { struct xfrm_id id; xfrm_address_t saddr; struct xfrm_selector sel; struct xfrm_userpolicy_info policy; __u32 aalgos; __u32 ealgos; __u32 calgos; __u32 seq; }; struct xfrm_user_expire { struct xfrm_usersa_info state; __u8 hard; }; struct xfrm_user_polexpire { struct xfrm_userpolicy_info pol; __u8 hard; }; struct xfrm_usersa_flush { __u8 proto; }; struct xfrm_user_report { __u8 proto; struct xfrm_selector sel; }; /* Used by MIGRATE to pass addresses IKE should use to perform * SA negotiation with the peer */ struct xfrm_user_kmaddress { xfrm_address_t local; xfrm_address_t remote; __u32 reserved; __u16 family; }; struct xfrm_user_migrate { xfrm_address_t old_daddr; xfrm_address_t old_saddr; xfrm_address_t new_daddr; xfrm_address_t new_saddr; __u8 proto; __u8 mode; __u16 reserved; __u32 reqid; __u16 old_family; __u16 new_family; }; struct xfrm_user_mapping { struct xfrm_usersa_id id; __u32 reqid; xfrm_address_t old_saddr; xfrm_address_t new_saddr; __be16 old_sport; __be16 new_sport; }; struct xfrm_address_filter { xfrm_address_t saddr; xfrm_address_t daddr; __u16 family; __u8 splen; __u8 dplen; }; struct xfrm_user_offload { int ifindex; __u8 flags; }; /* This flag was exposed without any kernel code that supporting it. * Unfortunately, strongswan has the code that uses sets this flag, * which makes impossible to reuse this bit. * * So leave it here to make sure that it won't be reused by mistake. */ #define XFRM_OFFLOAD_IPV6 1 #define XFRM_OFFLOAD_INBOUND 2 /* backwards compatibility for userspace */ #define XFRMGRP_ACQUIRE 1 #define XFRMGRP_EXPIRE 2 #define XFRMGRP_SA 4 #define XFRMGRP_POLICY 8 #define XFRMGRP_REPORT 0x20 enum xfrm_nlgroups { XFRMNLGRP_NONE, #define XFRMNLGRP_NONE XFRMNLGRP_NONE XFRMNLGRP_ACQUIRE, #define XFRMNLGRP_ACQUIRE XFRMNLGRP_ACQUIRE XFRMNLGRP_EXPIRE, #define XFRMNLGRP_EXPIRE XFRMNLGRP_EXPIRE XFRMNLGRP_SA, #define XFRMNLGRP_SA XFRMNLGRP_SA XFRMNLGRP_POLICY, #define XFRMNLGRP_POLICY XFRMNLGRP_POLICY XFRMNLGRP_AEVENTS, #define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS XFRMNLGRP_REPORT, #define XFRMNLGRP_REPORT XFRMNLGRP_REPORT XFRMNLGRP_MIGRATE, #define XFRMNLGRP_MIGRATE XFRMNLGRP_MIGRATE XFRMNLGRP_MAPPING, #define XFRMNLGRP_MAPPING XFRMNLGRP_MAPPING __XFRMNLGRP_MAX }; #define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) #endif /* _LINUX_XFRM_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/cgroupstats.h���������������������������������������������������������������������������������0000644�����������������00000004253�14763166027�0010452 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.1 WITH Linux-syscall-note */ /* cgroupstats.h - exporting per-cgroup statistics * * Copyright IBM Corporation, 2007 * Author Balbir Singh <balbir@linux.vnet.ibm.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2.1 of the GNU Lesser General Public License * as published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ #ifndef _LINUX_CGROUPSTATS_H #define _LINUX_CGROUPSTATS_H #include <linux/types.h> #include <linux/taskstats.h> /* * Data shared between user space and kernel space on a per cgroup * basis. This data is shared using taskstats. * * Most of these states are derived by looking at the task->state value * For the nr_io_wait state, a flag in the delay accounting structure * indicates that the task is waiting on IO * * Each member is aligned to a 8 byte boundary. */ struct cgroupstats { __u64 nr_sleeping; /* Number of tasks sleeping */ __u64 nr_running; /* Number of tasks running */ __u64 nr_stopped; /* Number of tasks in stopped state */ __u64 nr_uninterruptible; /* Number of tasks in uninterruptible */ /* state */ __u64 nr_io_wait; /* Number of tasks waiting on IO */ }; /* * Commands sent from userspace * Not versioned. New commands should only be inserted at the enum's end * prior to __CGROUPSTATS_CMD_MAX */ enum { CGROUPSTATS_CMD_UNSPEC = __TASKSTATS_CMD_MAX, /* Reserved */ CGROUPSTATS_CMD_GET, /* user->kernel request/get-response */ CGROUPSTATS_CMD_NEW, /* kernel->user event */ __CGROUPSTATS_CMD_MAX, }; #define CGROUPSTATS_CMD_MAX (__CGROUPSTATS_CMD_MAX - 1) enum { CGROUPSTATS_TYPE_UNSPEC = 0, /* Reserved */ CGROUPSTATS_TYPE_CGROUP_STATS, /* contains name + stats */ __CGROUPSTATS_TYPE_MAX, }; #define CGROUPSTATS_TYPE_MAX (__CGROUPSTATS_TYPE_MAX - 1) enum { CGROUPSTATS_CMD_ATTR_UNSPEC = 0, CGROUPSTATS_CMD_ATTR_FD, __CGROUPSTATS_CMD_ATTR_MAX, }; #define CGROUPSTATS_CMD_ATTR_MAX (__CGROUPSTATS_CMD_ATTR_MAX - 1) #endif /* _LINUX_CGROUPSTATS_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/dcbnl.h���������������������������������������������������������������������������������������0000644�����������������00000061313�14763166027�0007156 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (c) 2008-2011, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope 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., 59 Temple * Place - Suite 330, Boston, MA 02111-1307 USA. * * Author: Lucy Liu <lucy.liu@intel.com> */ #ifndef __LINUX_DCBNL_H__ #define __LINUX_DCBNL_H__ #include <linux/types.h> /* IEEE 802.1Qaz std supported values */ #define IEEE_8021QAZ_MAX_TCS 8 #define IEEE_8021QAZ_TSA_STRICT 0 #define IEEE_8021QAZ_TSA_CB_SHAPER 1 #define IEEE_8021QAZ_TSA_ETS 2 #define IEEE_8021QAZ_TSA_VENDOR 255 /* This structure contains the IEEE 802.1Qaz ETS managed object * * @willing: willing bit in ETS configuration TLV * @ets_cap: indicates supported capacity of ets feature * @cbs: credit based shaper ets algorithm supported * @tc_tx_bw: tc tx bandwidth indexed by traffic class * @tc_rx_bw: tc rx bandwidth indexed by traffic class * @tc_tsa: TSA Assignment table, indexed by traffic class * @prio_tc: priority assignment table mapping 8021Qp to traffic class * @tc_reco_bw: recommended tc bandwidth indexed by traffic class for TLV * @tc_reco_tsa: recommended tc bandwidth indexed by traffic class for TLV * @reco_prio_tc: recommended tc tx bandwidth indexed by traffic class for TLV * * Recommended values are used to set fields in the ETS recommendation TLV * with hardware offloaded LLDP. * * ---- * TSA Assignment 8 bit identifiers * 0 strict priority * 1 credit-based shaper * 2 enhanced transmission selection * 3-254 reserved * 255 vendor specific */ struct ieee_ets { __u8 willing; __u8 ets_cap; __u8 cbs; __u8 tc_tx_bw[IEEE_8021QAZ_MAX_TCS]; __u8 tc_rx_bw[IEEE_8021QAZ_MAX_TCS]; __u8 tc_tsa[IEEE_8021QAZ_MAX_TCS]; __u8 prio_tc[IEEE_8021QAZ_MAX_TCS]; __u8 tc_reco_bw[IEEE_8021QAZ_MAX_TCS]; __u8 tc_reco_tsa[IEEE_8021QAZ_MAX_TCS]; __u8 reco_prio_tc[IEEE_8021QAZ_MAX_TCS]; }; /* This structure contains rate limit extension to the IEEE 802.1Qaz ETS * managed object. * Values are 64 bits long and specified in Kbps to enable usage over both * slow and very fast networks. * * @tc_maxrate: maximal tc tx bandwidth indexed by traffic class */ struct ieee_maxrate { __u64 tc_maxrate[IEEE_8021QAZ_MAX_TCS]; }; enum dcbnl_cndd_states { DCB_CNDD_RESET = 0, DCB_CNDD_EDGE, DCB_CNDD_INTERIOR, DCB_CNDD_INTERIOR_READY, }; /* This structure contains the IEEE 802.1Qau QCN managed object. * *@rpg_enable: enable QCN RP *@rppp_max_rps: maximum number of RPs allowed for this CNPV on this port *@rpg_time_reset: time between rate increases if no CNMs received. * given in u-seconds *@rpg_byte_reset: transmitted data between rate increases if no CNMs received. * given in Bytes *@rpg_threshold: The number of times rpByteStage or rpTimeStage can count * before RP rate control state machine advances states *@rpg_max_rate: the maxinun rate, in Mbits per second, * at which an RP can transmit *@rpg_ai_rate: The rate, in Mbits per second, * used to increase rpTargetRate in the RPR_ACTIVE_INCREASE *@rpg_hai_rate: The rate, in Mbits per second, * used to increase rpTargetRate in the RPR_HYPER_INCREASE state *@rpg_gd: Upon CNM receive, flow rate is limited to (Fb/Gd)*CurrentRate. * rpgGd is given as log2(Gd), where Gd may only be powers of 2 *@rpg_min_dec_fac: The minimum factor by which the current transmit rate * can be changed by reception of a CNM. * value is given as percentage (1-100) *@rpg_min_rate: The minimum value, in bits per second, for rate to limit *@cndd_state_machine: The state of the congestion notification domain * defense state machine, as defined by IEEE 802.3Qau * section 32.1.1. In the interior ready state, * the QCN capable hardware may add CN-TAG TLV to the * outgoing traffic, to specifically identify outgoing * flows. */ struct ieee_qcn { __u8 rpg_enable[IEEE_8021QAZ_MAX_TCS]; __u32 rppp_max_rps[IEEE_8021QAZ_MAX_TCS]; __u32 rpg_time_reset[IEEE_8021QAZ_MAX_TCS]; __u32 rpg_byte_reset[IEEE_8021QAZ_MAX_TCS]; __u32 rpg_threshold[IEEE_8021QAZ_MAX_TCS]; __u32 rpg_max_rate[IEEE_8021QAZ_MAX_TCS]; __u32 rpg_ai_rate[IEEE_8021QAZ_MAX_TCS]; __u32 rpg_hai_rate[IEEE_8021QAZ_MAX_TCS]; __u32 rpg_gd[IEEE_8021QAZ_MAX_TCS]; __u32 rpg_min_dec_fac[IEEE_8021QAZ_MAX_TCS]; __u32 rpg_min_rate[IEEE_8021QAZ_MAX_TCS]; __u32 cndd_state_machine[IEEE_8021QAZ_MAX_TCS]; }; /* This structure contains the IEEE 802.1Qau QCN statistics. * *@rppp_rp_centiseconds: the number of RP-centiseconds accumulated * by RPs at this priority level on this Port *@rppp_created_rps: number of active RPs(flows) that react to CNMs */ struct ieee_qcn_stats { __u64 rppp_rp_centiseconds[IEEE_8021QAZ_MAX_TCS]; __u32 rppp_created_rps[IEEE_8021QAZ_MAX_TCS]; }; /* This structure contains the IEEE 802.1Qaz PFC managed object * * @pfc_cap: Indicates the number of traffic classes on the local device * that may simultaneously have PFC enabled. * @pfc_en: bitmap indicating pfc enabled traffic classes * @mbc: enable macsec bypass capability * @delay: the allowance made for a round-trip propagation delay of the * link in bits. * @requests: count of the sent pfc frames * @indications: count of the received pfc frames */ struct ieee_pfc { __u8 pfc_cap; __u8 pfc_en; __u8 mbc; __u16 delay; __u64 requests[IEEE_8021QAZ_MAX_TCS]; __u64 indications[IEEE_8021QAZ_MAX_TCS]; }; #define IEEE_8021Q_MAX_PRIORITIES 8 #define DCBX_MAX_BUFFERS 8 struct dcbnl_buffer { /* priority to buffer mapping */ __u8 prio2buffer[IEEE_8021Q_MAX_PRIORITIES]; /* buffer size in Bytes */ __u32 buffer_size[DCBX_MAX_BUFFERS]; __u32 total_size; }; /* CEE DCBX std supported values */ #define CEE_DCBX_MAX_PGS 8 #define CEE_DCBX_MAX_PRIO 8 /** * struct cee_pg - CEE Priority-Group managed object * * @willing: willing bit in the PG tlv * @error: error bit in the PG tlv * @pg_en: enable bit of the PG feature * @tcs_supported: number of traffic classes supported * @pg_bw: bandwidth percentage for each priority group * @prio_pg: priority to PG mapping indexed by priority */ struct cee_pg { __u8 willing; __u8 error; __u8 pg_en; __u8 tcs_supported; __u8 pg_bw[CEE_DCBX_MAX_PGS]; __u8 prio_pg[CEE_DCBX_MAX_PGS]; }; /** * struct cee_pfc - CEE PFC managed object * * @willing: willing bit in the PFC tlv * @error: error bit in the PFC tlv * @pfc_en: bitmap indicating pfc enabled traffic classes * @tcs_supported: number of traffic classes supported */ struct cee_pfc { __u8 willing; __u8 error; __u8 pfc_en; __u8 tcs_supported; }; /* IEEE 802.1Qaz std supported values */ #define IEEE_8021QAZ_APP_SEL_ETHERTYPE 1 #define IEEE_8021QAZ_APP_SEL_STREAM 2 #define IEEE_8021QAZ_APP_SEL_DGRAM 3 #define IEEE_8021QAZ_APP_SEL_ANY 4 #define IEEE_8021QAZ_APP_SEL_DSCP 5 /* This structure contains the IEEE 802.1Qaz APP managed object. This * object is also used for the CEE std as well. * * @selector: protocol identifier type * @protocol: protocol of type indicated * @priority: 3-bit unsigned integer indicating priority for IEEE * 8-bit 802.1p user priority bitmap for CEE * * ---- * Selector field values for IEEE 802.1Qaz * 0 Reserved * 1 Ethertype * 2 Well known port number over TCP or SCTP * 3 Well known port number over UDP or DCCP * 4 Well known port number over TCP, SCTP, UDP, or DCCP * 5 Differentiated Services Code Point (DSCP) value * 6-7 Reserved * * Selector field values for CEE * 0 Ethertype * 1 Well known port number over TCP or UDP * 2-3 Reserved */ struct dcb_app { __u8 selector; __u8 priority; __u16 protocol; }; /** * struct dcb_peer_app_info - APP feature information sent by the peer * * @willing: willing bit in the peer APP tlv * @error: error bit in the peer APP tlv * * In addition to this information the full peer APP tlv also contains * a table of 'app_count' APP objects defined above. */ struct dcb_peer_app_info { __u8 willing; __u8 error; }; struct dcbmsg { __u8 dcb_family; __u8 cmd; __u16 dcb_pad; }; /** * enum dcbnl_commands - supported DCB commands * * @DCB_CMD_UNDEFINED: unspecified command to catch errors * @DCB_CMD_GSTATE: request the state of DCB in the device * @DCB_CMD_SSTATE: set the state of DCB in the device * @DCB_CMD_PGTX_GCFG: request the priority group configuration for Tx * @DCB_CMD_PGTX_SCFG: set the priority group configuration for Tx * @DCB_CMD_PGRX_GCFG: request the priority group configuration for Rx * @DCB_CMD_PGRX_SCFG: set the priority group configuration for Rx * @DCB_CMD_PFC_GCFG: request the priority flow control configuration * @DCB_CMD_PFC_SCFG: set the priority flow control configuration * @DCB_CMD_SET_ALL: apply all changes to the underlying device * @DCB_CMD_GPERM_HWADDR: get the permanent MAC address of the underlying * device. Only useful when using bonding. * @DCB_CMD_GCAP: request the DCB capabilities of the device * @DCB_CMD_GNUMTCS: get the number of traffic classes currently supported * @DCB_CMD_SNUMTCS: set the number of traffic classes * @DCB_CMD_GBCN: set backward congestion notification configuration * @DCB_CMD_SBCN: get backward congestion notification configration. * @DCB_CMD_GAPP: get application protocol configuration * @DCB_CMD_SAPP: set application protocol configuration * @DCB_CMD_IEEE_SET: set IEEE 802.1Qaz configuration * @DCB_CMD_IEEE_GET: get IEEE 802.1Qaz configuration * @DCB_CMD_GDCBX: get DCBX engine configuration * @DCB_CMD_SDCBX: set DCBX engine configuration * @DCB_CMD_GFEATCFG: get DCBX features flags * @DCB_CMD_SFEATCFG: set DCBX features negotiation flags * @DCB_CMD_CEE_GET: get CEE aggregated configuration * @DCB_CMD_IEEE_DEL: delete IEEE 802.1Qaz configuration */ enum dcbnl_commands { DCB_CMD_UNDEFINED, DCB_CMD_GSTATE, DCB_CMD_SSTATE, DCB_CMD_PGTX_GCFG, DCB_CMD_PGTX_SCFG, DCB_CMD_PGRX_GCFG, DCB_CMD_PGRX_SCFG, DCB_CMD_PFC_GCFG, DCB_CMD_PFC_SCFG, DCB_CMD_SET_ALL, DCB_CMD_GPERM_HWADDR, DCB_CMD_GCAP, DCB_CMD_GNUMTCS, DCB_CMD_SNUMTCS, DCB_CMD_PFC_GSTATE, DCB_CMD_PFC_SSTATE, DCB_CMD_BCN_GCFG, DCB_CMD_BCN_SCFG, DCB_CMD_GAPP, DCB_CMD_SAPP, DCB_CMD_IEEE_SET, DCB_CMD_IEEE_GET, DCB_CMD_GDCBX, DCB_CMD_SDCBX, DCB_CMD_GFEATCFG, DCB_CMD_SFEATCFG, DCB_CMD_CEE_GET, DCB_CMD_IEEE_DEL, __DCB_CMD_ENUM_MAX, DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1, }; /** * enum dcbnl_attrs - DCB top-level netlink attributes * * @DCB_ATTR_UNDEFINED: unspecified attribute to catch errors * @DCB_ATTR_IFNAME: interface name of the underlying device (NLA_STRING) * @DCB_ATTR_STATE: enable state of DCB in the device (NLA_U8) * @DCB_ATTR_PFC_STATE: enable state of PFC in the device (NLA_U8) * @DCB_ATTR_PFC_CFG: priority flow control configuration (NLA_NESTED) * @DCB_ATTR_NUM_TC: number of traffic classes supported in the device (NLA_U8) * @DCB_ATTR_PG_CFG: priority group configuration (NLA_NESTED) * @DCB_ATTR_SET_ALL: bool to commit changes to hardware or not (NLA_U8) * @DCB_ATTR_PERM_HWADDR: MAC address of the physical device (NLA_NESTED) * @DCB_ATTR_CAP: DCB capabilities of the device (NLA_NESTED) * @DCB_ATTR_NUMTCS: number of traffic classes supported (NLA_NESTED) * @DCB_ATTR_BCN: backward congestion notification configuration (NLA_NESTED) * @DCB_ATTR_IEEE: IEEE 802.1Qaz supported attributes (NLA_NESTED) * @DCB_ATTR_DCBX: DCBX engine configuration in the device (NLA_U8) * @DCB_ATTR_FEATCFG: DCBX features flags (NLA_NESTED) * @DCB_ATTR_CEE: CEE std supported attributes (NLA_NESTED) */ enum dcbnl_attrs { DCB_ATTR_UNDEFINED, DCB_ATTR_IFNAME, DCB_ATTR_STATE, DCB_ATTR_PFC_STATE, DCB_ATTR_PFC_CFG, DCB_ATTR_NUM_TC, DCB_ATTR_PG_CFG, DCB_ATTR_SET_ALL, DCB_ATTR_PERM_HWADDR, DCB_ATTR_CAP, DCB_ATTR_NUMTCS, DCB_ATTR_BCN, DCB_ATTR_APP, /* IEEE std attributes */ DCB_ATTR_IEEE, DCB_ATTR_DCBX, DCB_ATTR_FEATCFG, /* CEE nested attributes */ DCB_ATTR_CEE, __DCB_ATTR_ENUM_MAX, DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1, }; /** * enum ieee_attrs - IEEE 802.1Qaz get/set attributes * * @DCB_ATTR_IEEE_UNSPEC: unspecified * @DCB_ATTR_IEEE_ETS: negotiated ETS configuration * @DCB_ATTR_IEEE_PFC: negotiated PFC configuration * @DCB_ATTR_IEEE_APP_TABLE: negotiated APP configuration * @DCB_ATTR_IEEE_PEER_ETS: peer ETS configuration - get only * @DCB_ATTR_IEEE_PEER_PFC: peer PFC configuration - get only * @DCB_ATTR_IEEE_PEER_APP: peer APP tlv - get only */ enum ieee_attrs { DCB_ATTR_IEEE_UNSPEC, DCB_ATTR_IEEE_ETS, DCB_ATTR_IEEE_PFC, DCB_ATTR_IEEE_APP_TABLE, DCB_ATTR_IEEE_PEER_ETS, DCB_ATTR_IEEE_PEER_PFC, DCB_ATTR_IEEE_PEER_APP, DCB_ATTR_IEEE_MAXRATE, DCB_ATTR_IEEE_QCN, DCB_ATTR_IEEE_QCN_STATS, DCB_ATTR_DCB_BUFFER, __DCB_ATTR_IEEE_MAX }; #define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1) enum ieee_attrs_app { DCB_ATTR_IEEE_APP_UNSPEC, DCB_ATTR_IEEE_APP, __DCB_ATTR_IEEE_APP_MAX }; #define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1) /** * enum cee_attrs - CEE DCBX get attributes. * * @DCB_ATTR_CEE_UNSPEC: unspecified * @DCB_ATTR_CEE_PEER_PG: peer PG configuration - get only * @DCB_ATTR_CEE_PEER_PFC: peer PFC configuration - get only * @DCB_ATTR_CEE_PEER_APP_TABLE: peer APP tlv - get only * @DCB_ATTR_CEE_TX_PG: TX PG configuration (DCB_CMD_PGTX_GCFG) * @DCB_ATTR_CEE_RX_PG: RX PG configuration (DCB_CMD_PGRX_GCFG) * @DCB_ATTR_CEE_PFC: PFC configuration (DCB_CMD_PFC_GCFG) * @DCB_ATTR_CEE_APP_TABLE: APP configuration (multi DCB_CMD_GAPP) * @DCB_ATTR_CEE_FEAT: DCBX features flags (DCB_CMD_GFEATCFG) * * An aggregated collection of the cee std negotiated parameters. */ enum cee_attrs { DCB_ATTR_CEE_UNSPEC, DCB_ATTR_CEE_PEER_PG, DCB_ATTR_CEE_PEER_PFC, DCB_ATTR_CEE_PEER_APP_TABLE, DCB_ATTR_CEE_TX_PG, DCB_ATTR_CEE_RX_PG, DCB_ATTR_CEE_PFC, DCB_ATTR_CEE_APP_TABLE, DCB_ATTR_CEE_FEAT, __DCB_ATTR_CEE_MAX }; #define DCB_ATTR_CEE_MAX (__DCB_ATTR_CEE_MAX - 1) enum peer_app_attr { DCB_ATTR_CEE_PEER_APP_UNSPEC, DCB_ATTR_CEE_PEER_APP_INFO, DCB_ATTR_CEE_PEER_APP, __DCB_ATTR_CEE_PEER_APP_MAX }; #define DCB_ATTR_CEE_PEER_APP_MAX (__DCB_ATTR_CEE_PEER_APP_MAX - 1) enum cee_attrs_app { DCB_ATTR_CEE_APP_UNSPEC, DCB_ATTR_CEE_APP, __DCB_ATTR_CEE_APP_MAX }; #define DCB_ATTR_CEE_APP_MAX (__DCB_ATTR_CEE_APP_MAX - 1) /** * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs * * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors * @DCB_PFC_UP_ATTR_0: Priority Flow Control value for User Priority 0 (NLA_U8) * @DCB_PFC_UP_ATTR_1: Priority Flow Control value for User Priority 1 (NLA_U8) * @DCB_PFC_UP_ATTR_2: Priority Flow Control value for User Priority 2 (NLA_U8) * @DCB_PFC_UP_ATTR_3: Priority Flow Control value for User Priority 3 (NLA_U8) * @DCB_PFC_UP_ATTR_4: Priority Flow Control value for User Priority 4 (NLA_U8) * @DCB_PFC_UP_ATTR_5: Priority Flow Control value for User Priority 5 (NLA_U8) * @DCB_PFC_UP_ATTR_6: Priority Flow Control value for User Priority 6 (NLA_U8) * @DCB_PFC_UP_ATTR_7: Priority Flow Control value for User Priority 7 (NLA_U8) * @DCB_PFC_UP_ATTR_MAX: highest attribute number currently defined * @DCB_PFC_UP_ATTR_ALL: apply to all priority flow control attrs (NLA_FLAG) * */ enum dcbnl_pfc_up_attrs { DCB_PFC_UP_ATTR_UNDEFINED, DCB_PFC_UP_ATTR_0, DCB_PFC_UP_ATTR_1, DCB_PFC_UP_ATTR_2, DCB_PFC_UP_ATTR_3, DCB_PFC_UP_ATTR_4, DCB_PFC_UP_ATTR_5, DCB_PFC_UP_ATTR_6, DCB_PFC_UP_ATTR_7, DCB_PFC_UP_ATTR_ALL, __DCB_PFC_UP_ATTR_ENUM_MAX, DCB_PFC_UP_ATTR_MAX = __DCB_PFC_UP_ATTR_ENUM_MAX - 1, }; /** * enum dcbnl_pg_attrs - DCB Priority Group attributes * * @DCB_PG_ATTR_UNDEFINED: unspecified attribute to catch errors * @DCB_PG_ATTR_TC_0: Priority Group Traffic Class 0 configuration (NLA_NESTED) * @DCB_PG_ATTR_TC_1: Priority Group Traffic Class 1 configuration (NLA_NESTED) * @DCB_PG_ATTR_TC_2: Priority Group Traffic Class 2 configuration (NLA_NESTED) * @DCB_PG_ATTR_TC_3: Priority Group Traffic Class 3 configuration (NLA_NESTED) * @DCB_PG_ATTR_TC_4: Priority Group Traffic Class 4 configuration (NLA_NESTED) * @DCB_PG_ATTR_TC_5: Priority Group Traffic Class 5 configuration (NLA_NESTED) * @DCB_PG_ATTR_TC_6: Priority Group Traffic Class 6 configuration (NLA_NESTED) * @DCB_PG_ATTR_TC_7: Priority Group Traffic Class 7 configuration (NLA_NESTED) * @DCB_PG_ATTR_TC_MAX: highest attribute number currently defined * @DCB_PG_ATTR_TC_ALL: apply to all traffic classes (NLA_NESTED) * @DCB_PG_ATTR_BW_ID_0: Percent of link bandwidth for Priority Group 0 (NLA_U8) * @DCB_PG_ATTR_BW_ID_1: Percent of link bandwidth for Priority Group 1 (NLA_U8) * @DCB_PG_ATTR_BW_ID_2: Percent of link bandwidth for Priority Group 2 (NLA_U8) * @DCB_PG_ATTR_BW_ID_3: Percent of link bandwidth for Priority Group 3 (NLA_U8) * @DCB_PG_ATTR_BW_ID_4: Percent of link bandwidth for Priority Group 4 (NLA_U8) * @DCB_PG_ATTR_BW_ID_5: Percent of link bandwidth for Priority Group 5 (NLA_U8) * @DCB_PG_ATTR_BW_ID_6: Percent of link bandwidth for Priority Group 6 (NLA_U8) * @DCB_PG_ATTR_BW_ID_7: Percent of link bandwidth for Priority Group 7 (NLA_U8) * @DCB_PG_ATTR_BW_ID_MAX: highest attribute number currently defined * @DCB_PG_ATTR_BW_ID_ALL: apply to all priority groups (NLA_FLAG) * */ enum dcbnl_pg_attrs { DCB_PG_ATTR_UNDEFINED, DCB_PG_ATTR_TC_0, DCB_PG_ATTR_TC_1, DCB_PG_ATTR_TC_2, DCB_PG_ATTR_TC_3, DCB_PG_ATTR_TC_4, DCB_PG_ATTR_TC_5, DCB_PG_ATTR_TC_6, DCB_PG_ATTR_TC_7, DCB_PG_ATTR_TC_MAX, DCB_PG_ATTR_TC_ALL, DCB_PG_ATTR_BW_ID_0, DCB_PG_ATTR_BW_ID_1, DCB_PG_ATTR_BW_ID_2, DCB_PG_ATTR_BW_ID_3, DCB_PG_ATTR_BW_ID_4, DCB_PG_ATTR_BW_ID_5, DCB_PG_ATTR_BW_ID_6, DCB_PG_ATTR_BW_ID_7, DCB_PG_ATTR_BW_ID_MAX, DCB_PG_ATTR_BW_ID_ALL, __DCB_PG_ATTR_ENUM_MAX, DCB_PG_ATTR_MAX = __DCB_PG_ATTR_ENUM_MAX - 1, }; /** * enum dcbnl_tc_attrs - DCB Traffic Class attributes * * @DCB_TC_ATTR_PARAM_UNDEFINED: unspecified attribute to catch errors * @DCB_TC_ATTR_PARAM_PGID: (NLA_U8) Priority group the traffic class belongs to * Valid values are: 0-7 * @DCB_TC_ATTR_PARAM_UP_MAPPING: (NLA_U8) Traffic class to user priority map * Some devices may not support changing the * user priority map of a TC. * @DCB_TC_ATTR_PARAM_STRICT_PRIO: (NLA_U8) Strict priority setting * 0 - none * 1 - group strict * 2 - link strict * @DCB_TC_ATTR_PARAM_BW_PCT: optional - (NLA_U8) If supported by the device and * not configured to use link strict priority, * this is the percentage of bandwidth of the * priority group this traffic class belongs to * @DCB_TC_ATTR_PARAM_ALL: (NLA_FLAG) all traffic class parameters * */ enum dcbnl_tc_attrs { DCB_TC_ATTR_PARAM_UNDEFINED, DCB_TC_ATTR_PARAM_PGID, DCB_TC_ATTR_PARAM_UP_MAPPING, DCB_TC_ATTR_PARAM_STRICT_PRIO, DCB_TC_ATTR_PARAM_BW_PCT, DCB_TC_ATTR_PARAM_ALL, __DCB_TC_ATTR_PARAM_ENUM_MAX, DCB_TC_ATTR_PARAM_MAX = __DCB_TC_ATTR_PARAM_ENUM_MAX - 1, }; /** * enum dcbnl_cap_attrs - DCB Capability attributes * * @DCB_CAP_ATTR_UNDEFINED: unspecified attribute to catch errors * @DCB_CAP_ATTR_ALL: (NLA_FLAG) all capability parameters * @DCB_CAP_ATTR_PG: (NLA_U8) device supports Priority Groups * @DCB_CAP_ATTR_PFC: (NLA_U8) device supports Priority Flow Control * @DCB_CAP_ATTR_UP2TC: (NLA_U8) device supports user priority to * traffic class mapping * @DCB_CAP_ATTR_PG_TCS: (NLA_U8) bitmap where each bit represents a * number of traffic classes the device * can be configured to use for Priority Groups * @DCB_CAP_ATTR_PFC_TCS: (NLA_U8) bitmap where each bit represents a * number of traffic classes the device can be * configured to use for Priority Flow Control * @DCB_CAP_ATTR_GSP: (NLA_U8) device supports group strict priority * @DCB_CAP_ATTR_BCN: (NLA_U8) device supports Backwards Congestion * Notification * @DCB_CAP_ATTR_DCBX: (NLA_U8) device supports DCBX engine * */ enum dcbnl_cap_attrs { DCB_CAP_ATTR_UNDEFINED, DCB_CAP_ATTR_ALL, DCB_CAP_ATTR_PG, DCB_CAP_ATTR_PFC, DCB_CAP_ATTR_UP2TC, DCB_CAP_ATTR_PG_TCS, DCB_CAP_ATTR_PFC_TCS, DCB_CAP_ATTR_GSP, DCB_CAP_ATTR_BCN, DCB_CAP_ATTR_DCBX, __DCB_CAP_ATTR_ENUM_MAX, DCB_CAP_ATTR_MAX = __DCB_CAP_ATTR_ENUM_MAX - 1, }; /** * DCBX capability flags * * @DCB_CAP_DCBX_HOST: DCBX negotiation is performed by the host LLDP agent. * 'set' routines are used to configure the device with * the negotiated parameters * * @DCB_CAP_DCBX_LLD_MANAGED: DCBX negotiation is not performed in the host but * by another entity * 'get' routines are used to retrieve the * negotiated parameters * 'set' routines can be used to set the initial * negotiation configuration * * @DCB_CAP_DCBX_VER_CEE: for a non-host DCBX engine, indicates the engine * supports the CEE protocol flavor * * @DCB_CAP_DCBX_VER_IEEE: for a non-host DCBX engine, indicates the engine * supports the IEEE protocol flavor * * @DCB_CAP_DCBX_STATIC: for a non-host DCBX engine, indicates the engine * supports static configuration (i.e no actual * negotiation is performed negotiated parameters equal * the initial configuration) * */ #define DCB_CAP_DCBX_HOST 0x01 #define DCB_CAP_DCBX_LLD_MANAGED 0x02 #define DCB_CAP_DCBX_VER_CEE 0x04 #define DCB_CAP_DCBX_VER_IEEE 0x08 #define DCB_CAP_DCBX_STATIC 0x10 /** * enum dcbnl_numtcs_attrs - number of traffic classes * * @DCB_NUMTCS_ATTR_UNDEFINED: unspecified attribute to catch errors * @DCB_NUMTCS_ATTR_ALL: (NLA_FLAG) all traffic class attributes * @DCB_NUMTCS_ATTR_PG: (NLA_U8) number of traffic classes used for * priority groups * @DCB_NUMTCS_ATTR_PFC: (NLA_U8) number of traffic classes which can * support priority flow control */ enum dcbnl_numtcs_attrs { DCB_NUMTCS_ATTR_UNDEFINED, DCB_NUMTCS_ATTR_ALL, DCB_NUMTCS_ATTR_PG, DCB_NUMTCS_ATTR_PFC, __DCB_NUMTCS_ATTR_ENUM_MAX, DCB_NUMTCS_ATTR_MAX = __DCB_NUMTCS_ATTR_ENUM_MAX - 1, }; enum dcbnl_bcn_attrs{ DCB_BCN_ATTR_UNDEFINED = 0, DCB_BCN_ATTR_RP_0, DCB_BCN_ATTR_RP_1, DCB_BCN_ATTR_RP_2, DCB_BCN_ATTR_RP_3, DCB_BCN_ATTR_RP_4, DCB_BCN_ATTR_RP_5, DCB_BCN_ATTR_RP_6, DCB_BCN_ATTR_RP_7, DCB_BCN_ATTR_RP_ALL, DCB_BCN_ATTR_BCNA_0, DCB_BCN_ATTR_BCNA_1, DCB_BCN_ATTR_ALPHA, DCB_BCN_ATTR_BETA, DCB_BCN_ATTR_GD, DCB_BCN_ATTR_GI, DCB_BCN_ATTR_TMAX, DCB_BCN_ATTR_TD, DCB_BCN_ATTR_RMIN, DCB_BCN_ATTR_W, DCB_BCN_ATTR_RD, DCB_BCN_ATTR_RU, DCB_BCN_ATTR_WRTT, DCB_BCN_ATTR_RI, DCB_BCN_ATTR_C, DCB_BCN_ATTR_ALL, __DCB_BCN_ATTR_ENUM_MAX, DCB_BCN_ATTR_MAX = __DCB_BCN_ATTR_ENUM_MAX - 1, }; /** * enum dcb_general_attr_values - general DCB attribute values * * @DCB_ATTR_UNDEFINED: value used to indicate an attribute is not supported * */ enum dcb_general_attr_values { DCB_ATTR_VALUE_UNDEFINED = 0xff }; #define DCB_APP_IDTYPE_ETHTYPE 0x00 #define DCB_APP_IDTYPE_PORTNUM 0x01 enum dcbnl_app_attrs { DCB_APP_ATTR_UNDEFINED, DCB_APP_ATTR_IDTYPE, DCB_APP_ATTR_ID, DCB_APP_ATTR_PRIORITY, __DCB_APP_ATTR_ENUM_MAX, DCB_APP_ATTR_MAX = __DCB_APP_ATTR_ENUM_MAX - 1, }; /** * enum dcbnl_featcfg_attrs - features conifiguration flags * * @DCB_FEATCFG_ATTR_UNDEFINED: unspecified attribute to catch errors * @DCB_FEATCFG_ATTR_ALL: (NLA_FLAG) all features configuration attributes * @DCB_FEATCFG_ATTR_PG: (NLA_U8) configuration flags for priority groups * @DCB_FEATCFG_ATTR_PFC: (NLA_U8) configuration flags for priority * flow control * @DCB_FEATCFG_ATTR_APP: (NLA_U8) configuration flags for application TLV * */ #define DCB_FEATCFG_ERROR 0x01 /* error in feature resolution */ #define DCB_FEATCFG_ENABLE 0x02 /* enable feature */ #define DCB_FEATCFG_WILLING 0x04 /* feature is willing */ #define DCB_FEATCFG_ADVERTISE 0x08 /* advertise feature */ enum dcbnl_featcfg_attrs { DCB_FEATCFG_ATTR_UNDEFINED, DCB_FEATCFG_ATTR_ALL, DCB_FEATCFG_ATTR_PG, DCB_FEATCFG_ATTR_PFC, DCB_FEATCFG_ATTR_APP, __DCB_FEATCFG_ATTR_ENUM_MAX, DCB_FEATCFG_ATTR_MAX = __DCB_FEATCFG_ATTR_ENUM_MAX - 1, }; #endif /* __LINUX_DCBNL_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/smc.h�����������������������������������������������������������������������������������������0000644�����������������00000001414�14763166027�0006652 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Shared Memory Communications over RDMA (SMC-R) and RoCE * * Definitions for generic netlink based configuration of an SMC-R PNET table * * Copyright IBM Corp. 2016 * * Author(s): Thomas Richter <tmricht@linux.vnet.ibm.com> */ #ifndef _LINUX_SMC_H_ #define _LINUX_SMC_H_ /* Netlink SMC_PNETID attributes */ enum { SMC_PNETID_UNSPEC, SMC_PNETID_NAME, SMC_PNETID_ETHNAME, SMC_PNETID_IBNAME, SMC_PNETID_IBPORT, __SMC_PNETID_MAX, SMC_PNETID_MAX = __SMC_PNETID_MAX - 1 }; enum { /* SMC PNET Table commands */ SMC_PNETID_GET = 1, SMC_PNETID_ADD, SMC_PNETID_DEL, SMC_PNETID_FLUSH }; #define SMCR_GENL_FAMILY_NAME "SMC_PNETID" #define SMCR_GENL_FAMILY_VERSION 1 #endif /* _LINUX_SMC_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/v4l2-controls.h�������������������������������������������������������������������������������0000644�����������������00000142500�14763166027�0010522 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * Video for Linux Two controls header file * * Copyright (C) 1999-2012 the contributors * * 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. * * Alternatively you can redistribute this file under the terms of the * BSD license as stated below: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of its contributors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The contents of this header was split off from videodev2.h. All control * definitions should be added to this header, which is included by * videodev2.h. */ #ifndef __LINUX_V4L2_CONTROLS_H #define __LINUX_V4L2_CONTROLS_H /* Control classes */ #define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */ #define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */ #define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ #define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator controls */ #define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */ #define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */ #define V4L2_CTRL_CLASS_IMAGE_SOURCE 0x009e0000 /* Image source controls */ #define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f0000 /* Image processing controls */ #define V4L2_CTRL_CLASS_DV 0x00a00000 /* Digital Video controls */ #define V4L2_CTRL_CLASS_FM_RX 0x00a10000 /* FM Receiver controls */ #define V4L2_CTRL_CLASS_RF_TUNER 0x00a20000 /* RF tuner controls */ #define V4L2_CTRL_CLASS_DETECT 0x00a30000 /* Detection controls */ /* User-class control IDs */ #define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900) #define V4L2_CID_USER_BASE V4L2_CID_BASE #define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1) #define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0) #define V4L2_CID_CONTRAST (V4L2_CID_BASE+1) #define V4L2_CID_SATURATION (V4L2_CID_BASE+2) #define V4L2_CID_HUE (V4L2_CID_BASE+3) #define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5) #define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6) #define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7) #define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8) #define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9) #define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10) #define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) /* Deprecated */ #define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12) #define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13) #define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14) #define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15) #define V4L2_CID_GAMMA (V4L2_CID_BASE+16) #define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* Deprecated */ #define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17) #define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18) #define V4L2_CID_GAIN (V4L2_CID_BASE+19) #define V4L2_CID_HFLIP (V4L2_CID_BASE+20) #define V4L2_CID_VFLIP (V4L2_CID_BASE+21) #define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24) enum v4l2_power_line_frequency { V4L2_CID_POWER_LINE_FREQUENCY_DISABLED = 0, V4L2_CID_POWER_LINE_FREQUENCY_50HZ = 1, V4L2_CID_POWER_LINE_FREQUENCY_60HZ = 2, V4L2_CID_POWER_LINE_FREQUENCY_AUTO = 3, }; #define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25) #define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26) #define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27) #define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28) #define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29) #define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30) #define V4L2_CID_COLORFX (V4L2_CID_BASE+31) enum v4l2_colorfx { V4L2_COLORFX_NONE = 0, V4L2_COLORFX_BW = 1, V4L2_COLORFX_SEPIA = 2, V4L2_COLORFX_NEGATIVE = 3, V4L2_COLORFX_EMBOSS = 4, V4L2_COLORFX_SKETCH = 5, V4L2_COLORFX_SKY_BLUE = 6, V4L2_COLORFX_GRASS_GREEN = 7, V4L2_COLORFX_SKIN_WHITEN = 8, V4L2_COLORFX_VIVID = 9, V4L2_COLORFX_AQUA = 10, V4L2_COLORFX_ART_FREEZE = 11, V4L2_COLORFX_SILHOUETTE = 12, V4L2_COLORFX_SOLARIZATION = 13, V4L2_COLORFX_ANTIQUE = 14, V4L2_COLORFX_SET_CBCR = 15, }; #define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) #define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) #define V4L2_CID_ROTATE (V4L2_CID_BASE+34) #define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35) #define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36) #define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+37) #define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+38) #define V4L2_CID_MIN_BUFFERS_FOR_CAPTURE (V4L2_CID_BASE+39) #define V4L2_CID_MIN_BUFFERS_FOR_OUTPUT (V4L2_CID_BASE+40) #define V4L2_CID_ALPHA_COMPONENT (V4L2_CID_BASE+41) #define V4L2_CID_COLORFX_CBCR (V4L2_CID_BASE+42) /* last CID + 1 */ #define V4L2_CID_LASTP1 (V4L2_CID_BASE+43) /* USER-class private control IDs */ /* The base for the meye driver controls. See linux/meye.h for the list * of controls. We reserve 16 controls for this driver. */ #define V4L2_CID_USER_MEYE_BASE (V4L2_CID_USER_BASE + 0x1000) /* The base for the bttv driver controls. * We reserve 32 controls for this driver. */ #define V4L2_CID_USER_BTTV_BASE (V4L2_CID_USER_BASE + 0x1010) /* The base for the s2255 driver controls. * We reserve 16 controls for this driver. */ #define V4L2_CID_USER_S2255_BASE (V4L2_CID_USER_BASE + 0x1030) /* * The base for the si476x driver controls. See include/media/drv-intf/si476x.h * for the list of controls. Total of 16 controls is reserved for this driver */ #define V4L2_CID_USER_SI476X_BASE (V4L2_CID_USER_BASE + 0x1040) /* The base for the TI VPE driver controls. Total of 16 controls is reserved for * this driver */ #define V4L2_CID_USER_TI_VPE_BASE (V4L2_CID_USER_BASE + 0x1050) /* The base for the saa7134 driver controls. * We reserve 16 controls for this driver. */ #define V4L2_CID_USER_SAA7134_BASE (V4L2_CID_USER_BASE + 0x1060) /* The base for the adv7180 driver controls. * We reserve 16 controls for this driver. */ #define V4L2_CID_USER_ADV7180_BASE (V4L2_CID_USER_BASE + 0x1070) /* The base for the tc358743 driver controls. * We reserve 16 controls for this driver. */ #define V4L2_CID_USER_TC358743_BASE (V4L2_CID_USER_BASE + 0x1080) /* The base for the max217x driver controls. * We reserve 32 controls for this driver */ #define V4L2_CID_USER_MAX217X_BASE (V4L2_CID_USER_BASE + 0x1090) /* The base for the imx driver controls. * We reserve 16 controls for this driver. */ #define V4L2_CID_USER_IMX_BASE (V4L2_CID_USER_BASE + 0x10b0) /* MPEG-class control IDs */ /* The MPEG controls are applicable to all codec controls * and the 'MPEG' part of the define is historical */ #define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) #define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1) /* MPEG streams, specific to multiplexed streams */ #define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0) enum v4l2_mpeg_stream_type { V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */ V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */ V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, /* MPEG-1 system stream */ V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, /* MPEG-2 DVD-compatible stream */ V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */ V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */ }; #define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1) #define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2) #define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3) #define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4) #define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5) #define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6) #define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7) enum v4l2_mpeg_stream_vbi_fmt { V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */ V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */ }; /* MPEG audio controls specific to multiplexed streams */ #define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100) enum v4l2_mpeg_audio_sampling_freq { V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0, V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1, V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2, }; #define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101) enum v4l2_mpeg_audio_encoding { V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0, V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1, V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2, V4L2_MPEG_AUDIO_ENCODING_AAC = 3, V4L2_MPEG_AUDIO_ENCODING_AC3 = 4, }; #define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102) enum v4l2_mpeg_audio_l1_bitrate { V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0, V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1, V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2, V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3, V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4, V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5, V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6, V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7, V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8, V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9, V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10, V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11, V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12, V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13, }; #define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103) enum v4l2_mpeg_audio_l2_bitrate { V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0, V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1, V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2, V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3, V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4, V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5, V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6, V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7, V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8, V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9, V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10, V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11, V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12, V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13, }; #define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104) enum v4l2_mpeg_audio_l3_bitrate { V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0, V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1, V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2, V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3, V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4, V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5, V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6, V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7, V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8, V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9, V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10, V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11, V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12, V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13, }; #define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105) enum v4l2_mpeg_audio_mode { V4L2_MPEG_AUDIO_MODE_STEREO = 0, V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1, V4L2_MPEG_AUDIO_MODE_DUAL = 2, V4L2_MPEG_AUDIO_MODE_MONO = 3, }; #define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106) enum v4l2_mpeg_audio_mode_extension { V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0, V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1, V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2, V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3, }; #define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107) enum v4l2_mpeg_audio_emphasis { V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0, V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1, V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2, }; #define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108) enum v4l2_mpeg_audio_crc { V4L2_MPEG_AUDIO_CRC_NONE = 0, V4L2_MPEG_AUDIO_CRC_CRC16 = 1, }; #define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) #define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110) #define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111) enum v4l2_mpeg_audio_ac3_bitrate { V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0, V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1, V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2, V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3, V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4, V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5, V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6, V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7, V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8, V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9, V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10, V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11, V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12, V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13, V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14, V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15, V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16, V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17, V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, }; #define V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK (V4L2_CID_MPEG_BASE+112) enum v4l2_mpeg_audio_dec_playback { V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO = 0, V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO = 1, V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT = 2, V4L2_MPEG_AUDIO_DEC_PLAYBACK_RIGHT = 3, V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO = 4, V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO = 5, }; #define V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK (V4L2_CID_MPEG_BASE+113) /* MPEG video controls specific to multiplexed streams */ #define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) enum v4l2_mpeg_video_encoding { V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0, V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1, V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2, }; #define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201) enum v4l2_mpeg_video_aspect { V4L2_MPEG_VIDEO_ASPECT_1x1 = 0, V4L2_MPEG_VIDEO_ASPECT_4x3 = 1, V4L2_MPEG_VIDEO_ASPECT_16x9 = 2, V4L2_MPEG_VIDEO_ASPECT_221x100 = 3, }; #define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202) #define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203) #define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204) #define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205) #define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206) enum v4l2_mpeg_video_bitrate_mode { V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0, V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1, }; #define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207) #define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208) #define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209) #define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210) #define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211) #define V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE (V4L2_CID_MPEG_BASE+212) #define V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER (V4L2_CID_MPEG_BASE+213) #define V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB (V4L2_CID_MPEG_BASE+214) #define V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE (V4L2_CID_MPEG_BASE+215) #define V4L2_CID_MPEG_VIDEO_HEADER_MODE (V4L2_CID_MPEG_BASE+216) enum v4l2_mpeg_video_header_mode { V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE = 0, V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME = 1, }; #define V4L2_CID_MPEG_VIDEO_MAX_REF_PIC (V4L2_CID_MPEG_BASE+217) #define V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE (V4L2_CID_MPEG_BASE+218) #define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES (V4L2_CID_MPEG_BASE+219) #define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB (V4L2_CID_MPEG_BASE+220) #define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE (V4L2_CID_MPEG_BASE+221) enum v4l2_mpeg_video_multi_slice_mode { V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE = 0, V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB = 1, V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2, }; #define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222) #define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE+223) #define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224) #define V4L2_CID_MPEG_VIDEO_VBV_DELAY (V4L2_CID_MPEG_BASE+225) #define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER (V4L2_CID_MPEG_BASE+226) #define V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE (V4L2_CID_MPEG_BASE+227) #define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE (V4L2_CID_MPEG_BASE+228) #define V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME (V4L2_CID_MPEG_BASE+229) #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300) #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301) #define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302) #define V4L2_CID_MPEG_VIDEO_H263_MIN_QP (V4L2_CID_MPEG_BASE+303) #define V4L2_CID_MPEG_VIDEO_H263_MAX_QP (V4L2_CID_MPEG_BASE+304) #define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP (V4L2_CID_MPEG_BASE+350) #define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP (V4L2_CID_MPEG_BASE+351) #define V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP (V4L2_CID_MPEG_BASE+352) #define V4L2_CID_MPEG_VIDEO_H264_MIN_QP (V4L2_CID_MPEG_BASE+353) #define V4L2_CID_MPEG_VIDEO_H264_MAX_QP (V4L2_CID_MPEG_BASE+354) #define V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM (V4L2_CID_MPEG_BASE+355) #define V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE (V4L2_CID_MPEG_BASE+356) #define V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE (V4L2_CID_MPEG_BASE+357) enum v4l2_mpeg_video_h264_entropy_mode { V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC = 0, V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC = 1, }; #define V4L2_CID_MPEG_VIDEO_H264_I_PERIOD (V4L2_CID_MPEG_BASE+358) #define V4L2_CID_MPEG_VIDEO_H264_LEVEL (V4L2_CID_MPEG_BASE+359) enum v4l2_mpeg_video_h264_level { V4L2_MPEG_VIDEO_H264_LEVEL_1_0 = 0, V4L2_MPEG_VIDEO_H264_LEVEL_1B = 1, V4L2_MPEG_VIDEO_H264_LEVEL_1_1 = 2, V4L2_MPEG_VIDEO_H264_LEVEL_1_2 = 3, V4L2_MPEG_VIDEO_H264_LEVEL_1_3 = 4, V4L2_MPEG_VIDEO_H264_LEVEL_2_0 = 5, V4L2_MPEG_VIDEO_H264_LEVEL_2_1 = 6, V4L2_MPEG_VIDEO_H264_LEVEL_2_2 = 7, V4L2_MPEG_VIDEO_H264_LEVEL_3_0 = 8, V4L2_MPEG_VIDEO_H264_LEVEL_3_1 = 9, V4L2_MPEG_VIDEO_H264_LEVEL_3_2 = 10, V4L2_MPEG_VIDEO_H264_LEVEL_4_0 = 11, V4L2_MPEG_VIDEO_H264_LEVEL_4_1 = 12, V4L2_MPEG_VIDEO_H264_LEVEL_4_2 = 13, V4L2_MPEG_VIDEO_H264_LEVEL_5_0 = 14, V4L2_MPEG_VIDEO_H264_LEVEL_5_1 = 15, }; #define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA (V4L2_CID_MPEG_BASE+360) #define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA (V4L2_CID_MPEG_BASE+361) #define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE (V4L2_CID_MPEG_BASE+362) enum v4l2_mpeg_video_h264_loop_filter_mode { V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED = 0, V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED = 1, V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY = 2, }; #define V4L2_CID_MPEG_VIDEO_H264_PROFILE (V4L2_CID_MPEG_BASE+363) enum v4l2_mpeg_video_h264_profile { V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE = 0, V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE = 1, V4L2_MPEG_VIDEO_H264_PROFILE_MAIN = 2, V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED = 3, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH = 4, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10 = 5, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422 = 6, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE = 7, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10_INTRA = 8, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422_INTRA = 9, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_INTRA = 10, V4L2_MPEG_VIDEO_H264_PROFILE_CAVLC_444_INTRA = 11, V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_BASELINE = 12, V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH = 13, V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH_INTRA = 14, V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH = 15, V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH = 16, }; #define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT (V4L2_CID_MPEG_BASE+364) #define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH (V4L2_CID_MPEG_BASE+365) #define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE (V4L2_CID_MPEG_BASE+366) #define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC (V4L2_CID_MPEG_BASE+367) enum v4l2_mpeg_video_h264_vui_sar_idc { V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED = 0, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_1x1 = 1, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_12x11 = 2, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_10x11 = 3, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_16x11 = 4, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_40x33 = 5, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_24x11 = 6, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_20x11 = 7, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_32x11 = 8, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_80x33 = 9, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_18x11 = 10, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_15x11 = 11, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_64x33 = 12, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_160x99 = 13, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_4x3 = 14, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_3x2 = 15, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_2x1 = 16, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED = 17, }; #define V4L2_CID_MPEG_VIDEO_H264_SEI_FRAME_PACKING (V4L2_CID_MPEG_BASE+368) #define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_CURRENT_FRAME_0 (V4L2_CID_MPEG_BASE+369) #define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE (V4L2_CID_MPEG_BASE+370) enum v4l2_mpeg_video_h264_sei_fp_arrangement_type { V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_CHECKERBOARD = 0, V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_COLUMN = 1, V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_ROW = 2, V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_SIDE_BY_SIDE = 3, V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_TOP_BOTTOM = 4, V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_TEMPORAL = 5, }; #define V4L2_CID_MPEG_VIDEO_H264_FMO (V4L2_CID_MPEG_BASE+371) #define V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE (V4L2_CID_MPEG_BASE+372) enum v4l2_mpeg_video_h264_fmo_map_type { V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_INTERLEAVED_SLICES = 0, V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_SCATTERED_SLICES = 1, V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_FOREGROUND_WITH_LEFT_OVER = 2, V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_BOX_OUT = 3, V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_RASTER_SCAN = 4, V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_WIPE_SCAN = 5, V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_EXPLICIT = 6, }; #define V4L2_CID_MPEG_VIDEO_H264_FMO_SLICE_GROUP (V4L2_CID_MPEG_BASE+373) #define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_DIRECTION (V4L2_CID_MPEG_BASE+374) enum v4l2_mpeg_video_h264_fmo_change_dir { V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_RIGHT = 0, V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_LEFT = 1, }; #define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_RATE (V4L2_CID_MPEG_BASE+375) #define V4L2_CID_MPEG_VIDEO_H264_FMO_RUN_LENGTH (V4L2_CID_MPEG_BASE+376) #define V4L2_CID_MPEG_VIDEO_H264_ASO (V4L2_CID_MPEG_BASE+377) #define V4L2_CID_MPEG_VIDEO_H264_ASO_SLICE_ORDER (V4L2_CID_MPEG_BASE+378) #define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING (V4L2_CID_MPEG_BASE+379) #define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_TYPE (V4L2_CID_MPEG_BASE+380) enum v4l2_mpeg_video_h264_hierarchical_coding_type { V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_B = 0, V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_P = 1, }; #define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER (V4L2_CID_MPEG_BASE+381) #define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER_QP (V4L2_CID_MPEG_BASE+382) #define V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP (V4L2_CID_MPEG_BASE+400) #define V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP (V4L2_CID_MPEG_BASE+401) #define V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP (V4L2_CID_MPEG_BASE+402) #define V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP (V4L2_CID_MPEG_BASE+403) #define V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP (V4L2_CID_MPEG_BASE+404) #define V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL (V4L2_CID_MPEG_BASE+405) enum v4l2_mpeg_video_mpeg4_level { V4L2_MPEG_VIDEO_MPEG4_LEVEL_0 = 0, V4L2_MPEG_VIDEO_MPEG4_LEVEL_0B = 1, V4L2_MPEG_VIDEO_MPEG4_LEVEL_1 = 2, V4L2_MPEG_VIDEO_MPEG4_LEVEL_2 = 3, V4L2_MPEG_VIDEO_MPEG4_LEVEL_3 = 4, V4L2_MPEG_VIDEO_MPEG4_LEVEL_3B = 5, V4L2_MPEG_VIDEO_MPEG4_LEVEL_4 = 6, V4L2_MPEG_VIDEO_MPEG4_LEVEL_5 = 7, }; #define V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE (V4L2_CID_MPEG_BASE+406) enum v4l2_mpeg_video_mpeg4_profile { V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE = 0, V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE = 1, V4L2_MPEG_VIDEO_MPEG4_PROFILE_CORE = 2, V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE_SCALABLE = 3, V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY = 4, }; #define V4L2_CID_MPEG_VIDEO_MPEG4_QPEL (V4L2_CID_MPEG_BASE+407) /* Control IDs for VP8 streams * Although VP8 is not part of MPEG we add these controls to the MPEG class * as that class is already handling other video compression standards */ #define V4L2_CID_MPEG_VIDEO_VPX_NUM_PARTITIONS (V4L2_CID_MPEG_BASE+500) enum v4l2_vp8_num_partitions { V4L2_CID_MPEG_VIDEO_VPX_1_PARTITION = 0, V4L2_CID_MPEG_VIDEO_VPX_2_PARTITIONS = 1, V4L2_CID_MPEG_VIDEO_VPX_4_PARTITIONS = 2, V4L2_CID_MPEG_VIDEO_VPX_8_PARTITIONS = 3, }; #define V4L2_CID_MPEG_VIDEO_VPX_IMD_DISABLE_4X4 (V4L2_CID_MPEG_BASE+501) #define V4L2_CID_MPEG_VIDEO_VPX_NUM_REF_FRAMES (V4L2_CID_MPEG_BASE+502) enum v4l2_vp8_num_ref_frames { V4L2_CID_MPEG_VIDEO_VPX_1_REF_FRAME = 0, V4L2_CID_MPEG_VIDEO_VPX_2_REF_FRAME = 1, V4L2_CID_MPEG_VIDEO_VPX_3_REF_FRAME = 2, }; #define V4L2_CID_MPEG_VIDEO_VPX_FILTER_LEVEL (V4L2_CID_MPEG_BASE+503) #define V4L2_CID_MPEG_VIDEO_VPX_FILTER_SHARPNESS (V4L2_CID_MPEG_BASE+504) #define V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD (V4L2_CID_MPEG_BASE+505) #define V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_SEL (V4L2_CID_MPEG_BASE+506) enum v4l2_vp8_golden_frame_sel { V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_USE_PREV = 0, V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_USE_REF_PERIOD = 1, }; #define V4L2_CID_MPEG_VIDEO_VPX_MIN_QP (V4L2_CID_MPEG_BASE+507) #define V4L2_CID_MPEG_VIDEO_VPX_MAX_QP (V4L2_CID_MPEG_BASE+508) #define V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP (V4L2_CID_MPEG_BASE+509) #define V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP (V4L2_CID_MPEG_BASE+510) #define V4L2_CID_MPEG_VIDEO_VP8_PROFILE (V4L2_CID_MPEG_BASE+511) enum v4l2_mpeg_video_vp8_profile { V4L2_MPEG_VIDEO_VP8_PROFILE_0 = 0, V4L2_MPEG_VIDEO_VP8_PROFILE_1 = 1, V4L2_MPEG_VIDEO_VP8_PROFILE_2 = 2, V4L2_MPEG_VIDEO_VP8_PROFILE_3 = 3, }; /* Deprecated alias for compatibility reasons. */ #define V4L2_CID_MPEG_VIDEO_VPX_PROFILE V4L2_CID_MPEG_VIDEO_VP8_PROFILE #define V4L2_CID_MPEG_VIDEO_VP9_PROFILE (V4L2_CID_MPEG_BASE+512) enum v4l2_mpeg_video_vp9_profile { V4L2_MPEG_VIDEO_VP9_PROFILE_0 = 0, V4L2_MPEG_VIDEO_VP9_PROFILE_1 = 1, V4L2_MPEG_VIDEO_VP9_PROFILE_2 = 2, V4L2_MPEG_VIDEO_VP9_PROFILE_3 = 3, }; /* CIDs for HEVC encoding. */ #define V4L2_CID_MPEG_VIDEO_HEVC_MIN_QP (V4L2_CID_MPEG_BASE + 600) #define V4L2_CID_MPEG_VIDEO_HEVC_MAX_QP (V4L2_CID_MPEG_BASE + 601) #define V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QP (V4L2_CID_MPEG_BASE + 602) #define V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_QP (V4L2_CID_MPEG_BASE + 603) #define V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_QP (V4L2_CID_MPEG_BASE + 604) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_QP (V4L2_CID_MPEG_BASE + 605) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_TYPE (V4L2_CID_MPEG_BASE + 606) enum v4l2_mpeg_video_hevc_hier_coding_type { V4L2_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_B = 0, V4L2_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_P = 1, }; #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER (V4L2_CID_MPEG_BASE + 607) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L0_QP (V4L2_CID_MPEG_BASE + 608) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L1_QP (V4L2_CID_MPEG_BASE + 609) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L2_QP (V4L2_CID_MPEG_BASE + 610) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L3_QP (V4L2_CID_MPEG_BASE + 611) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L4_QP (V4L2_CID_MPEG_BASE + 612) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L5_QP (V4L2_CID_MPEG_BASE + 613) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L6_QP (V4L2_CID_MPEG_BASE + 614) #define V4L2_CID_MPEG_VIDEO_HEVC_PROFILE (V4L2_CID_MPEG_BASE + 615) enum v4l2_mpeg_video_hevc_profile { V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN = 0, V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE = 1, V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10 = 2, }; #define V4L2_CID_MPEG_VIDEO_HEVC_LEVEL (V4L2_CID_MPEG_BASE + 616) enum v4l2_mpeg_video_hevc_level { V4L2_MPEG_VIDEO_HEVC_LEVEL_1 = 0, V4L2_MPEG_VIDEO_HEVC_LEVEL_2 = 1, V4L2_MPEG_VIDEO_HEVC_LEVEL_2_1 = 2, V4L2_MPEG_VIDEO_HEVC_LEVEL_3 = 3, V4L2_MPEG_VIDEO_HEVC_LEVEL_3_1 = 4, V4L2_MPEG_VIDEO_HEVC_LEVEL_4 = 5, V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1 = 6, V4L2_MPEG_VIDEO_HEVC_LEVEL_5 = 7, V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1 = 8, V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2 = 9, V4L2_MPEG_VIDEO_HEVC_LEVEL_6 = 10, V4L2_MPEG_VIDEO_HEVC_LEVEL_6_1 = 11, V4L2_MPEG_VIDEO_HEVC_LEVEL_6_2 = 12, }; #define V4L2_CID_MPEG_VIDEO_HEVC_FRAME_RATE_RESOLUTION (V4L2_CID_MPEG_BASE + 617) #define V4L2_CID_MPEG_VIDEO_HEVC_TIER (V4L2_CID_MPEG_BASE + 618) enum v4l2_mpeg_video_hevc_tier { V4L2_MPEG_VIDEO_HEVC_TIER_MAIN = 0, V4L2_MPEG_VIDEO_HEVC_TIER_HIGH = 1, }; #define V4L2_CID_MPEG_VIDEO_HEVC_MAX_PARTITION_DEPTH (V4L2_CID_MPEG_BASE + 619) #define V4L2_CID_MPEG_VIDEO_HEVC_LOOP_FILTER_MODE (V4L2_CID_MPEG_BASE + 620) enum v4l2_cid_mpeg_video_hevc_loop_filter_mode { V4L2_MPEG_VIDEO_HEVC_LOOP_FILTER_MODE_DISABLED = 0, V4L2_MPEG_VIDEO_HEVC_LOOP_FILTER_MODE_ENABLED = 1, V4L2_MPEG_VIDEO_HEVC_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY = 2, }; #define V4L2_CID_MPEG_VIDEO_HEVC_LF_BETA_OFFSET_DIV2 (V4L2_CID_MPEG_BASE + 621) #define V4L2_CID_MPEG_VIDEO_HEVC_LF_TC_OFFSET_DIV2 (V4L2_CID_MPEG_BASE + 622) #define V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_TYPE (V4L2_CID_MPEG_BASE + 623) enum v4l2_cid_mpeg_video_hevc_refresh_type { V4L2_MPEG_VIDEO_HEVC_REFRESH_NONE = 0, V4L2_MPEG_VIDEO_HEVC_REFRESH_CRA = 1, V4L2_MPEG_VIDEO_HEVC_REFRESH_IDR = 2, }; #define V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_PERIOD (V4L2_CID_MPEG_BASE + 624) #define V4L2_CID_MPEG_VIDEO_HEVC_LOSSLESS_CU (V4L2_CID_MPEG_BASE + 625) #define V4L2_CID_MPEG_VIDEO_HEVC_CONST_INTRA_PRED (V4L2_CID_MPEG_BASE + 626) #define V4L2_CID_MPEG_VIDEO_HEVC_WAVEFRONT (V4L2_CID_MPEG_BASE + 627) #define V4L2_CID_MPEG_VIDEO_HEVC_GENERAL_PB (V4L2_CID_MPEG_BASE + 628) #define V4L2_CID_MPEG_VIDEO_HEVC_TEMPORAL_ID (V4L2_CID_MPEG_BASE + 629) #define V4L2_CID_MPEG_VIDEO_HEVC_STRONG_SMOOTHING (V4L2_CID_MPEG_BASE + 630) #define V4L2_CID_MPEG_VIDEO_HEVC_MAX_NUM_MERGE_MV_MINUS1 (V4L2_CID_MPEG_BASE + 631) #define V4L2_CID_MPEG_VIDEO_HEVC_INTRA_PU_SPLIT (V4L2_CID_MPEG_BASE + 632) #define V4L2_CID_MPEG_VIDEO_HEVC_TMV_PREDICTION (V4L2_CID_MPEG_BASE + 633) #define V4L2_CID_MPEG_VIDEO_HEVC_WITHOUT_STARTCODE (V4L2_CID_MPEG_BASE + 634) #define V4L2_CID_MPEG_VIDEO_HEVC_SIZE_OF_LENGTH_FIELD (V4L2_CID_MPEG_BASE + 635) enum v4l2_cid_mpeg_video_hevc_size_of_length_field { V4L2_MPEG_VIDEO_HEVC_SIZE_0 = 0, V4L2_MPEG_VIDEO_HEVC_SIZE_1 = 1, V4L2_MPEG_VIDEO_HEVC_SIZE_2 = 2, V4L2_MPEG_VIDEO_HEVC_SIZE_4 = 3, }; #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L0_BR (V4L2_CID_MPEG_BASE + 636) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L1_BR (V4L2_CID_MPEG_BASE + 637) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L2_BR (V4L2_CID_MPEG_BASE + 638) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L3_BR (V4L2_CID_MPEG_BASE + 639) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L4_BR (V4L2_CID_MPEG_BASE + 640) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L5_BR (V4L2_CID_MPEG_BASE + 641) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L6_BR (V4L2_CID_MPEG_BASE + 642) #define V4L2_CID_MPEG_VIDEO_REF_NUMBER_FOR_PFRAMES (V4L2_CID_MPEG_BASE + 643) #define V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR (V4L2_CID_MPEG_BASE + 644) /* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */ #define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) #define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0) enum v4l2_mpeg_cx2341x_video_spatial_filter_mode { V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0, V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1) #define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2) enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type { V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3) enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type { V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0, V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4) enum v4l2_mpeg_cx2341x_video_temporal_filter_mode { V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0, V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5) #define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6) enum v4l2_mpeg_cx2341x_video_median_filter_type { V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7) #define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8) #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9) #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10) #define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11) /* MPEG-class control IDs specific to the Samsung MFC 5.1 driver as defined by V4L2 */ #define V4L2_CID_MPEG_MFC51_BASE (V4L2_CTRL_CLASS_MPEG | 0x1100) #define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY (V4L2_CID_MPEG_MFC51_BASE+0) #define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE (V4L2_CID_MPEG_MFC51_BASE+1) #define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE (V4L2_CID_MPEG_MFC51_BASE+2) enum v4l2_mpeg_mfc51_video_frame_skip_mode { V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_DISABLED = 0, V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_LEVEL_LIMIT = 1, V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT = 2, }; #define V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE (V4L2_CID_MPEG_MFC51_BASE+3) enum v4l2_mpeg_mfc51_video_force_frame_type { V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_DISABLED = 0, V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_I_FRAME = 1, V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_NOT_CODED = 2, }; #define V4L2_CID_MPEG_MFC51_VIDEO_PADDING (V4L2_CID_MPEG_MFC51_BASE+4) #define V4L2_CID_MPEG_MFC51_VIDEO_PADDING_YUV (V4L2_CID_MPEG_MFC51_BASE+5) #define V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT (V4L2_CID_MPEG_MFC51_BASE+6) #define V4L2_CID_MPEG_MFC51_VIDEO_RC_REACTION_COEFF (V4L2_CID_MPEG_MFC51_BASE+7) #define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_ACTIVITY (V4L2_CID_MPEG_MFC51_BASE+50) #define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_DARK (V4L2_CID_MPEG_MFC51_BASE+51) #define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_SMOOTH (V4L2_CID_MPEG_MFC51_BASE+52) #define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_STATIC (V4L2_CID_MPEG_MFC51_BASE+53) #define V4L2_CID_MPEG_MFC51_VIDEO_H264_NUM_REF_PIC_FOR_P (V4L2_CID_MPEG_MFC51_BASE+54) /* Camera class control IDs */ #define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900) #define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1) #define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1) enum v4l2_exposure_auto_type { V4L2_EXPOSURE_AUTO = 0, V4L2_EXPOSURE_MANUAL = 1, V4L2_EXPOSURE_SHUTTER_PRIORITY = 2, V4L2_EXPOSURE_APERTURE_PRIORITY = 3 }; #define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2) #define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3) #define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4) #define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5) #define V4L2_CID_PAN_RESET (V4L2_CID_CAMERA_CLASS_BASE+6) #define V4L2_CID_TILT_RESET (V4L2_CID_CAMERA_CLASS_BASE+7) #define V4L2_CID_PAN_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+8) #define V4L2_CID_TILT_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+9) #define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10) #define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11) #define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12) #define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13) #define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14) #define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE+15) #define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16) #define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17) #define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18) #define V4L2_CID_AUTO_EXPOSURE_BIAS (V4L2_CID_CAMERA_CLASS_BASE+19) #define V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE (V4L2_CID_CAMERA_CLASS_BASE+20) enum v4l2_auto_n_preset_white_balance { V4L2_WHITE_BALANCE_MANUAL = 0, V4L2_WHITE_BALANCE_AUTO = 1, V4L2_WHITE_BALANCE_INCANDESCENT = 2, V4L2_WHITE_BALANCE_FLUORESCENT = 3, V4L2_WHITE_BALANCE_FLUORESCENT_H = 4, V4L2_WHITE_BALANCE_HORIZON = 5, V4L2_WHITE_BALANCE_DAYLIGHT = 6, V4L2_WHITE_BALANCE_FLASH = 7, V4L2_WHITE_BALANCE_CLOUDY = 8, V4L2_WHITE_BALANCE_SHADE = 9, }; #define V4L2_CID_WIDE_DYNAMIC_RANGE (V4L2_CID_CAMERA_CLASS_BASE+21) #define V4L2_CID_IMAGE_STABILIZATION (V4L2_CID_CAMERA_CLASS_BASE+22) #define V4L2_CID_ISO_SENSITIVITY (V4L2_CID_CAMERA_CLASS_BASE+23) #define V4L2_CID_ISO_SENSITIVITY_AUTO (V4L2_CID_CAMERA_CLASS_BASE+24) enum v4l2_iso_sensitivity_auto_type { V4L2_ISO_SENSITIVITY_MANUAL = 0, V4L2_ISO_SENSITIVITY_AUTO = 1, }; #define V4L2_CID_EXPOSURE_METERING (V4L2_CID_CAMERA_CLASS_BASE+25) enum v4l2_exposure_metering { V4L2_EXPOSURE_METERING_AVERAGE = 0, V4L2_EXPOSURE_METERING_CENTER_WEIGHTED = 1, V4L2_EXPOSURE_METERING_SPOT = 2, V4L2_EXPOSURE_METERING_MATRIX = 3, }; #define V4L2_CID_SCENE_MODE (V4L2_CID_CAMERA_CLASS_BASE+26) enum v4l2_scene_mode { V4L2_SCENE_MODE_NONE = 0, V4L2_SCENE_MODE_BACKLIGHT = 1, V4L2_SCENE_MODE_BEACH_SNOW = 2, V4L2_SCENE_MODE_CANDLE_LIGHT = 3, V4L2_SCENE_MODE_DAWN_DUSK = 4, V4L2_SCENE_MODE_FALL_COLORS = 5, V4L2_SCENE_MODE_FIREWORKS = 6, V4L2_SCENE_MODE_LANDSCAPE = 7, V4L2_SCENE_MODE_NIGHT = 8, V4L2_SCENE_MODE_PARTY_INDOOR = 9, V4L2_SCENE_MODE_PORTRAIT = 10, V4L2_SCENE_MODE_SPORTS = 11, V4L2_SCENE_MODE_SUNSET = 12, V4L2_SCENE_MODE_TEXT = 13, }; #define V4L2_CID_3A_LOCK (V4L2_CID_CAMERA_CLASS_BASE+27) #define V4L2_LOCK_EXPOSURE (1 << 0) #define V4L2_LOCK_WHITE_BALANCE (1 << 1) #define V4L2_LOCK_FOCUS (1 << 2) #define V4L2_CID_AUTO_FOCUS_START (V4L2_CID_CAMERA_CLASS_BASE+28) #define V4L2_CID_AUTO_FOCUS_STOP (V4L2_CID_CAMERA_CLASS_BASE+29) #define V4L2_CID_AUTO_FOCUS_STATUS (V4L2_CID_CAMERA_CLASS_BASE+30) #define V4L2_AUTO_FOCUS_STATUS_IDLE (0 << 0) #define V4L2_AUTO_FOCUS_STATUS_BUSY (1 << 0) #define V4L2_AUTO_FOCUS_STATUS_REACHED (1 << 1) #define V4L2_AUTO_FOCUS_STATUS_FAILED (1 << 2) #define V4L2_CID_AUTO_FOCUS_RANGE (V4L2_CID_CAMERA_CLASS_BASE+31) enum v4l2_auto_focus_range { V4L2_AUTO_FOCUS_RANGE_AUTO = 0, V4L2_AUTO_FOCUS_RANGE_NORMAL = 1, V4L2_AUTO_FOCUS_RANGE_MACRO = 2, V4L2_AUTO_FOCUS_RANGE_INFINITY = 3, }; #define V4L2_CID_PAN_SPEED (V4L2_CID_CAMERA_CLASS_BASE+32) #define V4L2_CID_TILT_SPEED (V4L2_CID_CAMERA_CLASS_BASE+33) /* FM Modulator class control IDs */ #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) #define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) #define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1) #define V4L2_CID_RDS_TX_PI (V4L2_CID_FM_TX_CLASS_BASE + 2) #define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3) #define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5) #define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6) #define V4L2_CID_RDS_TX_MONO_STEREO (V4L2_CID_FM_TX_CLASS_BASE + 7) #define V4L2_CID_RDS_TX_ARTIFICIAL_HEAD (V4L2_CID_FM_TX_CLASS_BASE + 8) #define V4L2_CID_RDS_TX_COMPRESSED (V4L2_CID_FM_TX_CLASS_BASE + 9) #define V4L2_CID_RDS_TX_DYNAMIC_PTY (V4L2_CID_FM_TX_CLASS_BASE + 10) #define V4L2_CID_RDS_TX_TRAFFIC_ANNOUNCEMENT (V4L2_CID_FM_TX_CLASS_BASE + 11) #define V4L2_CID_RDS_TX_TRAFFIC_PROGRAM (V4L2_CID_FM_TX_CLASS_BASE + 12) #define V4L2_CID_RDS_TX_MUSIC_SPEECH (V4L2_CID_FM_TX_CLASS_BASE + 13) #define V4L2_CID_RDS_TX_ALT_FREQS_ENABLE (V4L2_CID_FM_TX_CLASS_BASE + 14) #define V4L2_CID_RDS_TX_ALT_FREQS (V4L2_CID_FM_TX_CLASS_BASE + 15) #define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64) #define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 65) #define V4L2_CID_AUDIO_LIMITER_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 66) #define V4L2_CID_AUDIO_COMPRESSION_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 80) #define V4L2_CID_AUDIO_COMPRESSION_GAIN (V4L2_CID_FM_TX_CLASS_BASE + 81) #define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD (V4L2_CID_FM_TX_CLASS_BASE + 82) #define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME (V4L2_CID_FM_TX_CLASS_BASE + 83) #define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 84) #define V4L2_CID_PILOT_TONE_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 96) #define V4L2_CID_PILOT_TONE_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 97) #define V4L2_CID_PILOT_TONE_FREQUENCY (V4L2_CID_FM_TX_CLASS_BASE + 98) #define V4L2_CID_TUNE_PREEMPHASIS (V4L2_CID_FM_TX_CLASS_BASE + 112) enum v4l2_preemphasis { V4L2_PREEMPHASIS_DISABLED = 0, V4L2_PREEMPHASIS_50_uS = 1, V4L2_PREEMPHASIS_75_uS = 2, }; #define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113) #define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114) /* Flash and privacy (indicator) light controls */ #define V4L2_CID_FLASH_CLASS_BASE (V4L2_CTRL_CLASS_FLASH | 0x900) #define V4L2_CID_FLASH_CLASS (V4L2_CTRL_CLASS_FLASH | 1) #define V4L2_CID_FLASH_LED_MODE (V4L2_CID_FLASH_CLASS_BASE + 1) enum v4l2_flash_led_mode { V4L2_FLASH_LED_MODE_NONE, V4L2_FLASH_LED_MODE_FLASH, V4L2_FLASH_LED_MODE_TORCH, }; #define V4L2_CID_FLASH_STROBE_SOURCE (V4L2_CID_FLASH_CLASS_BASE + 2) enum v4l2_flash_strobe_source { V4L2_FLASH_STROBE_SOURCE_SOFTWARE, V4L2_FLASH_STROBE_SOURCE_EXTERNAL, }; #define V4L2_CID_FLASH_STROBE (V4L2_CID_FLASH_CLASS_BASE + 3) #define V4L2_CID_FLASH_STROBE_STOP (V4L2_CID_FLASH_CLASS_BASE + 4) #define V4L2_CID_FLASH_STROBE_STATUS (V4L2_CID_FLASH_CLASS_BASE + 5) #define V4L2_CID_FLASH_TIMEOUT (V4L2_CID_FLASH_CLASS_BASE + 6) #define V4L2_CID_FLASH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 7) #define V4L2_CID_FLASH_TORCH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 8) #define V4L2_CID_FLASH_INDICATOR_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 9) #define V4L2_CID_FLASH_FAULT (V4L2_CID_FLASH_CLASS_BASE + 10) #define V4L2_FLASH_FAULT_OVER_VOLTAGE (1 << 0) #define V4L2_FLASH_FAULT_TIMEOUT (1 << 1) #define V4L2_FLASH_FAULT_OVER_TEMPERATURE (1 << 2) #define V4L2_FLASH_FAULT_SHORT_CIRCUIT (1 << 3) #define V4L2_FLASH_FAULT_OVER_CURRENT (1 << 4) #define V4L2_FLASH_FAULT_INDICATOR (1 << 5) #define V4L2_FLASH_FAULT_UNDER_VOLTAGE (1 << 6) #define V4L2_FLASH_FAULT_INPUT_VOLTAGE (1 << 7) #define V4L2_FLASH_FAULT_LED_OVER_TEMPERATURE (1 << 8) #define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11) #define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12) /* JPEG-class control IDs */ #define V4L2_CID_JPEG_CLASS_BASE (V4L2_CTRL_CLASS_JPEG | 0x900) #define V4L2_CID_JPEG_CLASS (V4L2_CTRL_CLASS_JPEG | 1) #define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE + 1) enum v4l2_jpeg_chroma_subsampling { V4L2_JPEG_CHROMA_SUBSAMPLING_444 = 0, V4L2_JPEG_CHROMA_SUBSAMPLING_422 = 1, V4L2_JPEG_CHROMA_SUBSAMPLING_420 = 2, V4L2_JPEG_CHROMA_SUBSAMPLING_411 = 3, V4L2_JPEG_CHROMA_SUBSAMPLING_410 = 4, V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY = 5, }; #define V4L2_CID_JPEG_RESTART_INTERVAL (V4L2_CID_JPEG_CLASS_BASE + 2) #define V4L2_CID_JPEG_COMPRESSION_QUALITY (V4L2_CID_JPEG_CLASS_BASE + 3) #define V4L2_CID_JPEG_ACTIVE_MARKER (V4L2_CID_JPEG_CLASS_BASE + 4) #define V4L2_JPEG_ACTIVE_MARKER_APP0 (1 << 0) #define V4L2_JPEG_ACTIVE_MARKER_APP1 (1 << 1) #define V4L2_JPEG_ACTIVE_MARKER_COM (1 << 16) #define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17) #define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18) /* Image source controls */ #define V4L2_CID_IMAGE_SOURCE_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_SOURCE | 0x900) #define V4L2_CID_IMAGE_SOURCE_CLASS (V4L2_CTRL_CLASS_IMAGE_SOURCE | 1) #define V4L2_CID_VBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 1) #define V4L2_CID_HBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 2) #define V4L2_CID_ANALOGUE_GAIN (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 3) #define V4L2_CID_TEST_PATTERN_RED (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 4) #define V4L2_CID_TEST_PATTERN_GREENR (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 5) #define V4L2_CID_TEST_PATTERN_BLUE (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 6) #define V4L2_CID_TEST_PATTERN_GREENB (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 7) /* Image processing controls */ #define V4L2_CID_IMAGE_PROC_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_PROC | 0x900) #define V4L2_CID_IMAGE_PROC_CLASS (V4L2_CTRL_CLASS_IMAGE_PROC | 1) #define V4L2_CID_LINK_FREQ (V4L2_CID_IMAGE_PROC_CLASS_BASE + 1) #define V4L2_CID_PIXEL_RATE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 2) #define V4L2_CID_TEST_PATTERN (V4L2_CID_IMAGE_PROC_CLASS_BASE + 3) #define V4L2_CID_DEINTERLACING_MODE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 4) #define V4L2_CID_DIGITAL_GAIN (V4L2_CID_IMAGE_PROC_CLASS_BASE + 5) /* DV-class control IDs defined by V4L2 */ #define V4L2_CID_DV_CLASS_BASE (V4L2_CTRL_CLASS_DV | 0x900) #define V4L2_CID_DV_CLASS (V4L2_CTRL_CLASS_DV | 1) #define V4L2_CID_DV_TX_HOTPLUG (V4L2_CID_DV_CLASS_BASE + 1) #define V4L2_CID_DV_TX_RXSENSE (V4L2_CID_DV_CLASS_BASE + 2) #define V4L2_CID_DV_TX_EDID_PRESENT (V4L2_CID_DV_CLASS_BASE + 3) #define V4L2_CID_DV_TX_MODE (V4L2_CID_DV_CLASS_BASE + 4) enum v4l2_dv_tx_mode { V4L2_DV_TX_MODE_DVI_D = 0, V4L2_DV_TX_MODE_HDMI = 1, }; #define V4L2_CID_DV_TX_RGB_RANGE (V4L2_CID_DV_CLASS_BASE + 5) enum v4l2_dv_rgb_range { V4L2_DV_RGB_RANGE_AUTO = 0, V4L2_DV_RGB_RANGE_LIMITED = 1, V4L2_DV_RGB_RANGE_FULL = 2, }; #define V4L2_CID_DV_TX_IT_CONTENT_TYPE (V4L2_CID_DV_CLASS_BASE + 6) enum v4l2_dv_it_content_type { V4L2_DV_IT_CONTENT_TYPE_GRAPHICS = 0, V4L2_DV_IT_CONTENT_TYPE_PHOTO = 1, V4L2_DV_IT_CONTENT_TYPE_CINEMA = 2, V4L2_DV_IT_CONTENT_TYPE_GAME = 3, V4L2_DV_IT_CONTENT_TYPE_NO_ITC = 4, }; #define V4L2_CID_DV_RX_POWER_PRESENT (V4L2_CID_DV_CLASS_BASE + 100) #define V4L2_CID_DV_RX_RGB_RANGE (V4L2_CID_DV_CLASS_BASE + 101) #define V4L2_CID_DV_RX_IT_CONTENT_TYPE (V4L2_CID_DV_CLASS_BASE + 102) #define V4L2_CID_FM_RX_CLASS_BASE (V4L2_CTRL_CLASS_FM_RX | 0x900) #define V4L2_CID_FM_RX_CLASS (V4L2_CTRL_CLASS_FM_RX | 1) #define V4L2_CID_TUNE_DEEMPHASIS (V4L2_CID_FM_RX_CLASS_BASE + 1) enum v4l2_deemphasis { V4L2_DEEMPHASIS_DISABLED = V4L2_PREEMPHASIS_DISABLED, V4L2_DEEMPHASIS_50_uS = V4L2_PREEMPHASIS_50_uS, V4L2_DEEMPHASIS_75_uS = V4L2_PREEMPHASIS_75_uS, }; #define V4L2_CID_RDS_RECEPTION (V4L2_CID_FM_RX_CLASS_BASE + 2) #define V4L2_CID_RDS_RX_PTY (V4L2_CID_FM_RX_CLASS_BASE + 3) #define V4L2_CID_RDS_RX_PS_NAME (V4L2_CID_FM_RX_CLASS_BASE + 4) #define V4L2_CID_RDS_RX_RADIO_TEXT (V4L2_CID_FM_RX_CLASS_BASE + 5) #define V4L2_CID_RDS_RX_TRAFFIC_ANNOUNCEMENT (V4L2_CID_FM_RX_CLASS_BASE + 6) #define V4L2_CID_RDS_RX_TRAFFIC_PROGRAM (V4L2_CID_FM_RX_CLASS_BASE + 7) #define V4L2_CID_RDS_RX_MUSIC_SPEECH (V4L2_CID_FM_RX_CLASS_BASE + 8) #define V4L2_CID_RF_TUNER_CLASS_BASE (V4L2_CTRL_CLASS_RF_TUNER | 0x900) #define V4L2_CID_RF_TUNER_CLASS (V4L2_CTRL_CLASS_RF_TUNER | 1) #define V4L2_CID_RF_TUNER_BANDWIDTH_AUTO (V4L2_CID_RF_TUNER_CLASS_BASE + 11) #define V4L2_CID_RF_TUNER_BANDWIDTH (V4L2_CID_RF_TUNER_CLASS_BASE + 12) #define V4L2_CID_RF_TUNER_RF_GAIN (V4L2_CID_RF_TUNER_CLASS_BASE + 32) #define V4L2_CID_RF_TUNER_LNA_GAIN_AUTO (V4L2_CID_RF_TUNER_CLASS_BASE + 41) #define V4L2_CID_RF_TUNER_LNA_GAIN (V4L2_CID_RF_TUNER_CLASS_BASE + 42) #define V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO (V4L2_CID_RF_TUNER_CLASS_BASE + 51) #define V4L2_CID_RF_TUNER_MIXER_GAIN (V4L2_CID_RF_TUNER_CLASS_BASE + 52) #define V4L2_CID_RF_TUNER_IF_GAIN_AUTO (V4L2_CID_RF_TUNER_CLASS_BASE + 61) #define V4L2_CID_RF_TUNER_IF_GAIN (V4L2_CID_RF_TUNER_CLASS_BASE + 62) #define V4L2_CID_RF_TUNER_PLL_LOCK (V4L2_CID_RF_TUNER_CLASS_BASE + 91) /* Detection-class control IDs defined by V4L2 */ #define V4L2_CID_DETECT_CLASS_BASE (V4L2_CTRL_CLASS_DETECT | 0x900) #define V4L2_CID_DETECT_CLASS (V4L2_CTRL_CLASS_DETECT | 1) #define V4L2_CID_DETECT_MD_MODE (V4L2_CID_DETECT_CLASS_BASE + 1) enum v4l2_detect_md_mode { V4L2_DETECT_MD_MODE_DISABLED = 0, V4L2_DETECT_MD_MODE_GLOBAL = 1, V4L2_DETECT_MD_MODE_THRESHOLD_GRID = 2, V4L2_DETECT_MD_MODE_REGION_GRID = 3, }; #define V4L2_CID_DETECT_MD_GLOBAL_THRESHOLD (V4L2_CID_DETECT_CLASS_BASE + 2) #define V4L2_CID_DETECT_MD_THRESHOLD_GRID (V4L2_CID_DETECT_CLASS_BASE + 3) #define V4L2_CID_DETECT_MD_REGION_GRID (V4L2_CID_DETECT_CLASS_BASE + 4) #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/hdlc/ioctl.h����������������������������������������������������������������������������������0000644�����������������00000005141�14763166027�0010115 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __HDLC_IOCTL_H__ #define __HDLC_IOCTL_H__ #define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */ #define CLOCK_DEFAULT 0 /* Default setting */ #define CLOCK_EXT 1 /* External TX and RX clock - DTE */ #define CLOCK_INT 2 /* Internal TX and RX clock - DCE */ #define CLOCK_TXINT 3 /* Internal TX and external RX clock */ #define CLOCK_TXFROMRX 4 /* TX clock derived from external RX clock */ #define ENCODING_DEFAULT 0 /* Default setting */ #define ENCODING_NRZ 1 #define ENCODING_NRZI 2 #define ENCODING_FM_MARK 3 #define ENCODING_FM_SPACE 4 #define ENCODING_MANCHESTER 5 #define PARITY_DEFAULT 0 /* Default setting */ #define PARITY_NONE 1 /* No parity */ #define PARITY_CRC16_PR0 2 /* CRC16, initial value 0x0000 */ #define PARITY_CRC16_PR1 3 /* CRC16, initial value 0xFFFF */ #define PARITY_CRC16_PR0_CCITT 4 /* CRC16, initial 0x0000, ITU-T version */ #define PARITY_CRC16_PR1_CCITT 5 /* CRC16, initial 0xFFFF, ITU-T version */ #define PARITY_CRC32_PR0_CCITT 6 /* CRC32, initial value 0x00000000 */ #define PARITY_CRC32_PR1_CCITT 7 /* CRC32, initial value 0xFFFFFFFF */ #define LMI_DEFAULT 0 /* Default setting */ #define LMI_NONE 1 /* No LMI, all PVCs are static */ #define LMI_ANSI 2 /* ANSI Annex D */ #define LMI_CCITT 3 /* ITU-T Annex A */ #define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */ #ifndef __ASSEMBLY__ typedef struct { unsigned int clock_rate; /* bits per second */ unsigned int clock_type; /* internal, external, TX-internal etc. */ unsigned short loopback; } sync_serial_settings; /* V.35, V.24, X.21 */ typedef struct { unsigned int clock_rate; /* bits per second */ unsigned int clock_type; /* internal, external, TX-internal etc. */ unsigned short loopback; unsigned int slot_map; } te1_settings; /* T1, E1 */ typedef struct { unsigned short encoding; unsigned short parity; } raw_hdlc_proto; typedef struct { unsigned int t391; unsigned int t392; unsigned int n391; unsigned int n392; unsigned int n393; unsigned short lmi; unsigned short dce; /* 1 for DCE (network side) operation */ } fr_proto; typedef struct { unsigned int dlci; } fr_proto_pvc; /* for creating/deleting FR PVCs */ typedef struct { unsigned int dlci; char master[IFNAMSIZ]; /* Name of master FRAD device */ }fr_proto_pvc_info; /* for returning PVC information only */ typedef struct { unsigned int interval; unsigned int timeout; } cisco_proto; /* PPP doesn't need any info now - supply length = 0 to ioctl */ #endif /* __ASSEMBLY__ */ #endif /* __HDLC_IOCTL_H__ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/v4l2-subdev.h���������������������������������������������������������������������������������0000644�����������������00000014303�14763166027�0010146 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * V4L2 subdev userspace API * * Copyright (C) 2010 Nokia Corporation * * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> * Sakari Ailus <sakari.ailus@iki.fi> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __LINUX_V4L2_SUBDEV_H #define __LINUX_V4L2_SUBDEV_H #include <linux/ioctl.h> #include <linux/types.h> #include <linux/v4l2-common.h> #include <linux/v4l2-mediabus.h> /** * enum v4l2_subdev_format_whence - Media bus format type * @V4L2_SUBDEV_FORMAT_TRY: try format, for negotiation only * @V4L2_SUBDEV_FORMAT_ACTIVE: active format, applied to the device */ enum v4l2_subdev_format_whence { V4L2_SUBDEV_FORMAT_TRY = 0, V4L2_SUBDEV_FORMAT_ACTIVE = 1, }; /** * struct v4l2_subdev_format - Pad-level media bus format * @which: format type (from enum v4l2_subdev_format_whence) * @pad: pad number, as reported by the media API * @format: media bus format (format code and frame size) */ struct v4l2_subdev_format { __u32 which; __u32 pad; struct v4l2_mbus_framefmt format; __u32 reserved[8]; }; /** * struct v4l2_subdev_crop - Pad-level crop settings * @which: format type (from enum v4l2_subdev_format_whence) * @pad: pad number, as reported by the media API * @rect: pad crop rectangle boundaries */ struct v4l2_subdev_crop { __u32 which; __u32 pad; struct v4l2_rect rect; __u32 reserved[8]; }; /** * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration * @pad: pad number, as reported by the media API * @index: format index during enumeration * @code: format code (MEDIA_BUS_FMT_ definitions) * @which: format type (from enum v4l2_subdev_format_whence) */ struct v4l2_subdev_mbus_code_enum { __u32 pad; __u32 index; __u32 code; __u32 which; __u32 reserved[8]; }; /** * struct v4l2_subdev_frame_size_enum - Media bus format enumeration * @pad: pad number, as reported by the media API * @index: format index during enumeration * @code: format code (MEDIA_BUS_FMT_ definitions) * @which: format type (from enum v4l2_subdev_format_whence) */ struct v4l2_subdev_frame_size_enum { __u32 index; __u32 pad; __u32 code; __u32 min_width; __u32 max_width; __u32 min_height; __u32 max_height; __u32 which; __u32 reserved[8]; }; /** * struct v4l2_subdev_frame_interval - Pad-level frame rate * @pad: pad number, as reported by the media API * @interval: frame interval in seconds */ struct v4l2_subdev_frame_interval { __u32 pad; struct v4l2_fract interval; __u32 reserved[9]; }; /** * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration * @pad: pad number, as reported by the media API * @index: frame interval index during enumeration * @code: format code (MEDIA_BUS_FMT_ definitions) * @width: frame width in pixels * @height: frame height in pixels * @interval: frame interval in seconds * @which: format type (from enum v4l2_subdev_format_whence) */ struct v4l2_subdev_frame_interval_enum { __u32 index; __u32 pad; __u32 code; __u32 width; __u32 height; struct v4l2_fract interval; __u32 which; __u32 reserved[8]; }; /** * struct v4l2_subdev_selection - selection info * * @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY * @pad: pad number, as reported by the media API * @target: Selection target, used to choose one of possible rectangles, * defined in v4l2-common.h; V4L2_SEL_TGT_* . * @flags: constraint flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*. * @r: coordinates of the selection window * @reserved: for future use, set to zero for now * * Hardware may use multiple helper windows to process a video stream. * The structure is used to exchange this selection areas between * an application and a driver. */ struct v4l2_subdev_selection { __u32 which; __u32 pad; __u32 target; __u32 flags; struct v4l2_rect r; __u32 reserved[8]; }; /* Backwards compatibility define --- to be removed */ #define v4l2_subdev_edid v4l2_edid #define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format) #define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format) #define VIDIOC_SUBDEV_G_FRAME_INTERVAL _IOWR('V', 21, struct v4l2_subdev_frame_interval) #define VIDIOC_SUBDEV_S_FRAME_INTERVAL _IOWR('V', 22, struct v4l2_subdev_frame_interval) #define VIDIOC_SUBDEV_ENUM_MBUS_CODE _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum) #define VIDIOC_SUBDEV_ENUM_FRAME_SIZE _IOWR('V', 74, struct v4l2_subdev_frame_size_enum) #define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum) #define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop) #define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop) #define VIDIOC_SUBDEV_G_SELECTION _IOWR('V', 61, struct v4l2_subdev_selection) #define VIDIOC_SUBDEV_S_SELECTION _IOWR('V', 62, struct v4l2_subdev_selection) /* The following ioctls are identical to the ioctls in videodev2.h */ #define VIDIOC_SUBDEV_G_STD _IOR('V', 23, v4l2_std_id) #define VIDIOC_SUBDEV_S_STD _IOW('V', 24, v4l2_std_id) #define VIDIOC_SUBDEV_ENUMSTD _IOWR('V', 25, struct v4l2_standard) #define VIDIOC_SUBDEV_G_EDID _IOWR('V', 40, struct v4l2_edid) #define VIDIOC_SUBDEV_S_EDID _IOWR('V', 41, struct v4l2_edid) #define VIDIOC_SUBDEV_QUERYSTD _IOR('V', 63, v4l2_std_id) #define VIDIOC_SUBDEV_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) #define VIDIOC_SUBDEV_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) #define VIDIOC_SUBDEV_ENUM_DV_TIMINGS _IOWR('V', 98, struct v4l2_enum_dv_timings) #define VIDIOC_SUBDEV_QUERY_DV_TIMINGS _IOR('V', 99, struct v4l2_dv_timings) #define VIDIOC_SUBDEV_DV_TIMINGS_CAP _IOWR('V', 100, struct v4l2_dv_timings_cap) #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/tc_act/tc_tunnel_key.h������������������������������������������������������������������������0000644�����������������00000003611�14763166027�0012171 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 2016, Amir Vadai <amir@vadai.me> * Copyright (c) 2016, Mellanox Technologies. 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. */ #ifndef __LINUX_TC_TUNNEL_KEY_H #define __LINUX_TC_TUNNEL_KEY_H #include <linux/pkt_cls.h> #define TCA_ACT_TUNNEL_KEY 17 #define TCA_TUNNEL_KEY_ACT_SET 1 #define TCA_TUNNEL_KEY_ACT_RELEASE 2 struct tc_tunnel_key { tc_gen; int t_action; }; enum { TCA_TUNNEL_KEY_UNSPEC, TCA_TUNNEL_KEY_TM, TCA_TUNNEL_KEY_PARMS, TCA_TUNNEL_KEY_ENC_IPV4_SRC, /* be32 */ TCA_TUNNEL_KEY_ENC_IPV4_DST, /* be32 */ TCA_TUNNEL_KEY_ENC_IPV6_SRC, /* struct in6_addr */ TCA_TUNNEL_KEY_ENC_IPV6_DST, /* struct in6_addr */ TCA_TUNNEL_KEY_ENC_KEY_ID, /* be64 */ TCA_TUNNEL_KEY_PAD, TCA_TUNNEL_KEY_ENC_DST_PORT, /* be16 */ TCA_TUNNEL_KEY_NO_CSUM, /* u8 */ TCA_TUNNEL_KEY_ENC_OPTS, /* Nested TCA_TUNNEL_KEY_ENC_OPTS_ * attributes */ TCA_TUNNEL_KEY_ENC_TOS, /* u8 */ TCA_TUNNEL_KEY_ENC_TTL, /* u8 */ __TCA_TUNNEL_KEY_MAX, }; #define TCA_TUNNEL_KEY_MAX (__TCA_TUNNEL_KEY_MAX - 1) enum { TCA_TUNNEL_KEY_ENC_OPTS_UNSPEC, TCA_TUNNEL_KEY_ENC_OPTS_GENEVE, /* Nested * TCA_TUNNEL_KEY_ENC_OPTS_ * attributes */ __TCA_TUNNEL_KEY_ENC_OPTS_MAX, }; #define TCA_TUNNEL_KEY_ENC_OPTS_MAX (__TCA_TUNNEL_KEY_ENC_OPTS_MAX - 1) enum { TCA_TUNNEL_KEY_ENC_OPT_GENEVE_UNSPEC, TCA_TUNNEL_KEY_ENC_OPT_GENEVE_CLASS, /* be16 */ TCA_TUNNEL_KEY_ENC_OPT_GENEVE_TYPE, /* u8 */ TCA_TUNNEL_KEY_ENC_OPT_GENEVE_DATA, /* 4 to 128 bytes */ __TCA_TUNNEL_KEY_ENC_OPT_GENEVE_MAX, }; #define TCA_TUNNEL_KEY_ENC_OPT_GENEVE_MAX \ (__TCA_TUNNEL_KEY_ENC_OPT_GENEVE_MAX - 1) #endif �����������������������������������������������������������������������������������������������������������������������linux/tc_act/tc_csum.h������������������������������������������������������������������������������0000644�����������������00000001235�14763166027�0010763 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_CSUM_H #define __LINUX_TC_CSUM_H #include <linux/types.h> #include <linux/pkt_cls.h> #define TCA_ACT_CSUM 16 enum { TCA_CSUM_UNSPEC, TCA_CSUM_PARMS, TCA_CSUM_TM, TCA_CSUM_PAD, __TCA_CSUM_MAX }; #define TCA_CSUM_MAX (__TCA_CSUM_MAX - 1) enum { TCA_CSUM_UPDATE_FLAG_IPV4HDR = 1, TCA_CSUM_UPDATE_FLAG_ICMP = 2, TCA_CSUM_UPDATE_FLAG_IGMP = 4, TCA_CSUM_UPDATE_FLAG_TCP = 8, TCA_CSUM_UPDATE_FLAG_UDP = 16, TCA_CSUM_UPDATE_FLAG_UDPLITE = 32, TCA_CSUM_UPDATE_FLAG_SCTP = 64, }; struct tc_csum { tc_gen; __u32 update_flags; }; #endif /* __LINUX_TC_CSUM_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/tc_act/tc_gact.h������������������������������������������������������������������������������0000644�����������������00000001211�14763166027�0010724 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_GACT_H #define __LINUX_TC_GACT_H #include <linux/types.h> #include <linux/pkt_cls.h> #define TCA_ACT_GACT 5 struct tc_gact { tc_gen; }; struct tc_gact_p { #define PGACT_NONE 0 #define PGACT_NETRAND 1 #define PGACT_DETERM 2 #define MAX_RAND (PGACT_DETERM + 1 ) __u16 ptype; __u16 pval; int paction; }; enum { TCA_GACT_UNSPEC, TCA_GACT_TM, TCA_GACT_PARMS, TCA_GACT_PROB, TCA_GACT_PAD, __TCA_GACT_MAX }; #define TCA_GACT_MAX (__TCA_GACT_MAX - 1) #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/tc_act/tc_sample.h����������������������������������������������������������������������������0000644�����������������00000000743�14763166027�0011300 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_SAMPLE_H #define __LINUX_TC_SAMPLE_H #include <linux/types.h> #include <linux/pkt_cls.h> #include <linux/if_ether.h> #define TCA_ACT_SAMPLE 26 struct tc_sample { tc_gen; }; enum { TCA_SAMPLE_UNSPEC, TCA_SAMPLE_TM, TCA_SAMPLE_PARMS, TCA_SAMPLE_RATE, TCA_SAMPLE_TRUNC_SIZE, TCA_SAMPLE_PSAMPLE_GROUP, TCA_SAMPLE_PAD, __TCA_SAMPLE_MAX }; #define TCA_SAMPLE_MAX (__TCA_SAMPLE_MAX - 1) #endif �����������������������������linux/tc_act/tc_vlan.h������������������������������������������������������������������������������0000644�����������������00000001511�14763166027�0010751 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us> * * 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. */ #ifndef __LINUX_TC_VLAN_H #define __LINUX_TC_VLAN_H #include <linux/pkt_cls.h> #define TCA_ACT_VLAN 12 #define TCA_VLAN_ACT_POP 1 #define TCA_VLAN_ACT_PUSH 2 #define TCA_VLAN_ACT_MODIFY 3 struct tc_vlan { tc_gen; int v_action; }; enum { TCA_VLAN_UNSPEC, TCA_VLAN_TM, TCA_VLAN_PARMS, TCA_VLAN_PUSH_VLAN_ID, TCA_VLAN_PUSH_VLAN_PROTOCOL, TCA_VLAN_PAD, TCA_VLAN_PUSH_VLAN_PRIORITY, __TCA_VLAN_MAX, }; #define TCA_VLAN_MAX (__TCA_VLAN_MAX - 1) #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/tc_act/tc_ife.h�������������������������������������������������������������������������������0000644�����������������00000001157�14763166027�0010562 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __UAPI_TC_IFE_H #define __UAPI_TC_IFE_H #include <linux/types.h> #include <linux/pkt_cls.h> #include <linux/ife.h> #define TCA_ACT_IFE 25 /* Flag bits for now just encoding/decoding; mutually exclusive */ #define IFE_ENCODE 1 #define IFE_DECODE 0 struct tc_ife { tc_gen; __u16 flags; }; /*XXX: We need to encode the total number of bytes consumed */ enum { TCA_IFE_UNSPEC, TCA_IFE_PARMS, TCA_IFE_TM, TCA_IFE_DMAC, TCA_IFE_SMAC, TCA_IFE_TYPE, TCA_IFE_METALST, TCA_IFE_PAD, __TCA_IFE_MAX }; #define TCA_IFE_MAX (__TCA_IFE_MAX - 1) #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/tc_act/tc_connmark.h��������������������������������������������������������������������������0000644�����������������00000000643�14763166027�0011626 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __UAPI_TC_CONNMARK_H #define __UAPI_TC_CONNMARK_H #include <linux/types.h> #include <linux/pkt_cls.h> #define TCA_ACT_CONNMARK 14 struct tc_connmark { tc_gen; __u16 zone; }; enum { TCA_CONNMARK_UNSPEC, TCA_CONNMARK_PARMS, TCA_CONNMARK_TM, TCA_CONNMARK_PAD, __TCA_CONNMARK_MAX }; #define TCA_CONNMARK_MAX (__TCA_CONNMARK_MAX - 1) #endif ���������������������������������������������������������������������������������������������linux/tc_act/tc_skbedit.h���������������������������������������������������������������������������0000644�����������������00000002677�14763166027�0011454 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (c) 2008, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope 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., 59 Temple * Place - Suite 330, Boston, MA 02111-1307 USA. * * Author: Alexander Duyck <alexander.h.duyck@intel.com> */ #ifndef __LINUX_TC_SKBEDIT_H #define __LINUX_TC_SKBEDIT_H #include <linux/pkt_cls.h> #define TCA_ACT_SKBEDIT 11 #define SKBEDIT_F_PRIORITY 0x1 #define SKBEDIT_F_QUEUE_MAPPING 0x2 #define SKBEDIT_F_MARK 0x4 #define SKBEDIT_F_PTYPE 0x8 #define SKBEDIT_F_MASK 0x10 #define SKBEDIT_F_INHERITDSFIELD 0x20 struct tc_skbedit { tc_gen; }; enum { TCA_SKBEDIT_UNSPEC, TCA_SKBEDIT_TM, TCA_SKBEDIT_PARMS, TCA_SKBEDIT_PRIORITY, TCA_SKBEDIT_QUEUE_MAPPING, TCA_SKBEDIT_MARK, TCA_SKBEDIT_PAD, TCA_SKBEDIT_PTYPE, TCA_SKBEDIT_MASK, TCA_SKBEDIT_FLAGS, __TCA_SKBEDIT_MAX }; #define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1) #endif �����������������������������������������������������������������linux/tc_act/tc_ipt.h�������������������������������������������������������������������������������0000644�����������������00000000714�14763166027�0010611 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_IPT_H #define __LINUX_TC_IPT_H #include <linux/pkt_cls.h> #define TCA_ACT_IPT 6 #define TCA_ACT_XT 10 enum { TCA_IPT_UNSPEC, TCA_IPT_TABLE, TCA_IPT_HOOK, TCA_IPT_INDEX, TCA_IPT_CNT, TCA_IPT_TM, TCA_IPT_TARG, TCA_IPT_PAD, __TCA_IPT_MAX }; #define TCA_IPT_MAX (__TCA_IPT_MAX - 1) #endif ����������������������������������������������������linux/tc_act/tc_defact.h����������������������������������������������������������������������������0000644�����������������00000000502�14763166027�0011236 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_DEF_H #define __LINUX_TC_DEF_H #include <linux/pkt_cls.h> struct tc_defact { tc_gen; }; enum { TCA_DEF_UNSPEC, TCA_DEF_TM, TCA_DEF_PARMS, TCA_DEF_DATA, TCA_DEF_PAD, __TCA_DEF_MAX }; #define TCA_DEF_MAX (__TCA_DEF_MAX - 1) #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/tc_act/tc_skbmod.h����������������������������������������������������������������������������0000644�����������������00000001512�14763166027�0011271 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 2016, Jamal Hadi Salim * * 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. */ #ifndef __LINUX_TC_SKBMOD_H #define __LINUX_TC_SKBMOD_H #include <linux/pkt_cls.h> #define TCA_ACT_SKBMOD 15 #define SKBMOD_F_DMAC 0x1 #define SKBMOD_F_SMAC 0x2 #define SKBMOD_F_ETYPE 0x4 #define SKBMOD_F_SWAPMAC 0x8 struct tc_skbmod { tc_gen; __u64 flags; }; enum { TCA_SKBMOD_UNSPEC, TCA_SKBMOD_TM, TCA_SKBMOD_PARMS, TCA_SKBMOD_DMAC, TCA_SKBMOD_SMAC, TCA_SKBMOD_ETYPE, TCA_SKBMOD_PAD, __TCA_SKBMOD_MAX }; #define TCA_SKBMOD_MAX (__TCA_SKBMOD_MAX - 1) #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/tc_act/tc_mirred.h����������������������������������������������������������������������������0000644�����������������00000001361�14763166027�0011276 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_MIR_H #define __LINUX_TC_MIR_H #include <linux/types.h> #include <linux/pkt_cls.h> #define TCA_ACT_MIRRED 8 #define TCA_EGRESS_REDIR 1 /* packet redirect to EGRESS*/ #define TCA_EGRESS_MIRROR 2 /* mirror packet to EGRESS */ #define TCA_INGRESS_REDIR 3 /* packet redirect to INGRESS*/ #define TCA_INGRESS_MIRROR 4 /* mirror packet to INGRESS */ struct tc_mirred { tc_gen; int eaction; /* one of IN/EGRESS_MIRROR/REDIR */ __u32 ifindex; /* ifindex of egress port */ }; enum { TCA_MIRRED_UNSPEC, TCA_MIRRED_TM, TCA_MIRRED_PARMS, TCA_MIRRED_PAD, __TCA_MIRRED_MAX }; #define TCA_MIRRED_MAX (__TCA_MIRRED_MAX - 1) #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/tc_act/tc_pedit.h�����������������������������������������������������������������������������0000644�����������������00000003020�14763166027�0011113 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_PED_H #define __LINUX_TC_PED_H #include <linux/types.h> #include <linux/pkt_cls.h> #define TCA_ACT_PEDIT 7 enum { TCA_PEDIT_UNSPEC, TCA_PEDIT_TM, TCA_PEDIT_PARMS, TCA_PEDIT_PAD, TCA_PEDIT_PARMS_EX, TCA_PEDIT_KEYS_EX, TCA_PEDIT_KEY_EX, __TCA_PEDIT_MAX }; #define TCA_PEDIT_MAX (__TCA_PEDIT_MAX - 1) enum { TCA_PEDIT_KEY_EX_HTYPE = 1, TCA_PEDIT_KEY_EX_CMD = 2, __TCA_PEDIT_KEY_EX_MAX }; #define TCA_PEDIT_KEY_EX_MAX (__TCA_PEDIT_KEY_EX_MAX - 1) /* TCA_PEDIT_KEY_EX_HDR_TYPE_NETWROK is a special case for legacy users. It * means no specific header type - offset is relative to the network layer */ enum pedit_header_type { TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK = 0, TCA_PEDIT_KEY_EX_HDR_TYPE_ETH = 1, TCA_PEDIT_KEY_EX_HDR_TYPE_IP4 = 2, TCA_PEDIT_KEY_EX_HDR_TYPE_IP6 = 3, TCA_PEDIT_KEY_EX_HDR_TYPE_TCP = 4, TCA_PEDIT_KEY_EX_HDR_TYPE_UDP = 5, __PEDIT_HDR_TYPE_MAX, }; #define TCA_PEDIT_HDR_TYPE_MAX (__PEDIT_HDR_TYPE_MAX - 1) enum pedit_cmd { TCA_PEDIT_KEY_EX_CMD_SET = 0, TCA_PEDIT_KEY_EX_CMD_ADD = 1, __PEDIT_CMD_MAX, }; #define TCA_PEDIT_CMD_MAX (__PEDIT_CMD_MAX - 1) struct tc_pedit_key { __u32 mask; /* AND */ __u32 val; /*XOR */ __u32 off; /*offset */ __u32 at; __u32 offmask; __u32 shift; }; struct tc_pedit_sel { tc_gen; unsigned char nkeys; unsigned char flags; struct tc_pedit_key keys[0]; }; #define tc_pedit tc_pedit_sel #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/tc_act/tc_bpf.h�������������������������������������������������������������������������������0000644�����������������00000001424�14763166027�0010563 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 2015 Jiri Pirko <jiri@resnulli.us> * * 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. */ #ifndef __LINUX_TC_BPF_H #define __LINUX_TC_BPF_H #include <linux/pkt_cls.h> #define TCA_ACT_BPF 13 struct tc_act_bpf { tc_gen; }; enum { TCA_ACT_BPF_UNSPEC, TCA_ACT_BPF_TM, TCA_ACT_BPF_PARMS, TCA_ACT_BPF_OPS_LEN, TCA_ACT_BPF_OPS, TCA_ACT_BPF_FD, TCA_ACT_BPF_NAME, TCA_ACT_BPF_PAD, TCA_ACT_BPF_TAG, TCA_ACT_BPF_ID, __TCA_ACT_BPF_MAX, }; #define TCA_ACT_BPF_MAX (__TCA_ACT_BPF_MAX - 1) #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/tc_act/tc_nat.h�������������������������������������������������������������������������������0000644�����������������00000000677�14763166027�0010607 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_NAT_H #define __LINUX_TC_NAT_H #include <linux/pkt_cls.h> #include <linux/types.h> #define TCA_ACT_NAT 9 enum { TCA_NAT_UNSPEC, TCA_NAT_PARMS, TCA_NAT_TM, TCA_NAT_PAD, __TCA_NAT_MAX }; #define TCA_NAT_MAX (__TCA_NAT_MAX - 1) #define TCA_NAT_FLAG_EGRESS 1 struct tc_nat { tc_gen; __be32 old_addr; __be32 new_addr; __be32 mask; __u32 flags; }; #endif �����������������������������������������������������������������linux/netfilter_arp/arpt_mangle.h�������������������������������������������������������������������0000644�����������������00000001136�14763166027�0013220 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ARPT_MANGLE_H #define _ARPT_MANGLE_H #include <linux/netfilter_arp/arp_tables.h> #define ARPT_MANGLE_ADDR_LEN_MAX sizeof(struct in_addr) struct arpt_mangle { char src_devaddr[ARPT_DEV_ADDR_LEN_MAX]; char tgt_devaddr[ARPT_DEV_ADDR_LEN_MAX]; union { struct in_addr src_ip; } u_s; union { struct in_addr tgt_ip; } u_t; __u8 flags; int target; }; #define ARPT_MANGLE_SDEV 0x01 #define ARPT_MANGLE_TDEV 0x02 #define ARPT_MANGLE_SIP 0x04 #define ARPT_MANGLE_TIP 0x08 #define ARPT_MANGLE_MASK 0x0f #endif /* _ARPT_MANGLE_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_arp/arp_tables.h��������������������������������������������������������������������0000644�����������������00000013557�14763166027�0013055 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Format of an ARP firewall descriptor * * src, tgt, src_mask, tgt_mask, arpop, arpop_mask are always stored in * network byte order. * flags are stored in host byte order (of course). */ #ifndef _ARPTABLES_H #define _ARPTABLES_H #include <linux/types.h> #include <linux/if.h> #include <linux/netfilter_arp.h> #include <linux/netfilter/x_tables.h> #define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN #define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN #define arpt_entry_target xt_entry_target #define arpt_standard_target xt_standard_target #define arpt_error_target xt_error_target #define ARPT_CONTINUE XT_CONTINUE #define ARPT_RETURN XT_RETURN #define arpt_counters_info xt_counters_info #define arpt_counters xt_counters #define ARPT_STANDARD_TARGET XT_STANDARD_TARGET #define ARPT_ERROR_TARGET XT_ERROR_TARGET #define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \ XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args) #define ARPT_DEV_ADDR_LEN_MAX 16 struct arpt_devaddr_info { char addr[ARPT_DEV_ADDR_LEN_MAX]; char mask[ARPT_DEV_ADDR_LEN_MAX]; }; /* Yes, Virginia, you have to zero the padding. */ struct arpt_arp { /* Source and target IP addr */ struct in_addr src, tgt; /* Mask for src and target IP addr */ struct in_addr smsk, tmsk; /* Device hw address length, src+target device addresses */ __u8 arhln, arhln_mask; struct arpt_devaddr_info src_devaddr; struct arpt_devaddr_info tgt_devaddr; /* ARP operation code. */ __be16 arpop, arpop_mask; /* ARP hardware address and protocol address format. */ __be16 arhrd, arhrd_mask; __be16 arpro, arpro_mask; /* The protocol address length is only accepted if it is 4 * so there is no use in offering a way to do filtering on it. */ char iniface[IFNAMSIZ], outiface[IFNAMSIZ]; unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ]; /* Flags word */ __u8 flags; /* Inverse flags */ __u16 invflags; }; /* Values for "flag" field in struct arpt_ip (general arp structure). * No flags defined yet. */ #define ARPT_F_MASK 0x00 /* All possible flag bits mask. */ /* Values for "inv" field in struct arpt_arp. */ #define ARPT_INV_VIA_IN 0x0001 /* Invert the sense of IN IFACE. */ #define ARPT_INV_VIA_OUT 0x0002 /* Invert the sense of OUT IFACE */ #define ARPT_INV_SRCIP 0x0004 /* Invert the sense of SRC IP. */ #define ARPT_INV_TGTIP 0x0008 /* Invert the sense of TGT IP. */ #define ARPT_INV_SRCDEVADDR 0x0010 /* Invert the sense of SRC DEV ADDR. */ #define ARPT_INV_TGTDEVADDR 0x0020 /* Invert the sense of TGT DEV ADDR. */ #define ARPT_INV_ARPOP 0x0040 /* Invert the sense of ARP OP. */ #define ARPT_INV_ARPHRD 0x0080 /* Invert the sense of ARP HRD. */ #define ARPT_INV_ARPPRO 0x0100 /* Invert the sense of ARP PRO. */ #define ARPT_INV_ARPHLN 0x0200 /* Invert the sense of ARP HLN. */ #define ARPT_INV_MASK 0x03FF /* All possible flag bits mask. */ /* This structure defines each of the firewall rules. Consists of 3 parts which are 1) general ARP header stuff 2) match specific stuff 3) the target to perform if the rule matches */ struct arpt_entry { struct arpt_arp arp; /* Size of arpt_entry + matches */ __u16 target_offset; /* Size of arpt_entry + matches + target */ __u16 next_offset; /* Back pointer */ unsigned int comefrom; /* Packet and byte counters. */ struct xt_counters counters; /* The matches (if any), then the target. */ unsigned char elems[0]; }; /* * New IP firewall options for [gs]etsockopt at the RAW IP level. * Unlike BSD Linux inherits IP options so you don't have to use a raw * socket for this. Instead we check rights in the calls. * * ATTENTION: check linux/in.h before adding new number here. */ #define ARPT_BASE_CTL 96 #define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL) #define ARPT_SO_SET_ADD_COUNTERS (ARPT_BASE_CTL + 1) #define ARPT_SO_SET_MAX ARPT_SO_SET_ADD_COUNTERS #define ARPT_SO_GET_INFO (ARPT_BASE_CTL) #define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1) /* #define ARPT_SO_GET_REVISION_MATCH (APRT_BASE_CTL + 2) */ #define ARPT_SO_GET_REVISION_TARGET (ARPT_BASE_CTL + 3) #define ARPT_SO_GET_MAX (ARPT_SO_GET_REVISION_TARGET) /* The argument to ARPT_SO_GET_INFO */ struct arpt_getinfo { /* Which table: caller fills this in. */ char name[XT_TABLE_MAXNAMELEN]; /* Kernel fills these in. */ /* Which hook entry points are valid: bitmask */ unsigned int valid_hooks; /* Hook entry points: one per netfilter hook. */ unsigned int hook_entry[NF_ARP_NUMHOOKS]; /* Underflow points. */ unsigned int underflow[NF_ARP_NUMHOOKS]; /* Number of entries */ unsigned int num_entries; /* Size of entries. */ unsigned int size; }; /* The argument to ARPT_SO_SET_REPLACE. */ struct arpt_replace { /* Which table. */ char name[XT_TABLE_MAXNAMELEN]; /* Which hook entry points are valid: bitmask. You can't change this. */ unsigned int valid_hooks; /* Number of entries */ unsigned int num_entries; /* Total size of new entries */ unsigned int size; /* Hook entry points. */ unsigned int hook_entry[NF_ARP_NUMHOOKS]; /* Underflow points. */ unsigned int underflow[NF_ARP_NUMHOOKS]; /* Information about old entries: */ /* Number of counters (must be equal to current number of entries). */ unsigned int num_counters; /* The old entries' counters. */ struct xt_counters *counters; /* The entries (hang off end: not really an array). */ struct arpt_entry entries[0]; }; /* The argument to ARPT_SO_GET_ENTRIES. */ struct arpt_get_entries { /* Which table: user fills this in. */ char name[XT_TABLE_MAXNAMELEN]; /* User fills this in: total entry size. */ unsigned int size; /* The entries. */ struct arpt_entry entrytable[0]; }; /* Helper functions */ static __inline__ struct xt_entry_target *arpt_get_target(struct arpt_entry *e) { return (void *)e + e->target_offset; } /* * Main firewall chains definitions and global var's definitions. */ #endif /* _ARPTABLES_H */ �������������������������������������������������������������������������������������������������������������������������������������������������linux/coda.h����������������������������������������������������������������������������������������0000644�����������������00000042141�14763166027�0007000 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* You may distribute this file under either of the two licenses that follow at your discretion. */ /* BLURB lgpl Coda File System Release 5 Copyright (c) 1987-1999 Carnegie Mellon University Additional copyrights listed below This code is distributed "AS IS" without warranty of any kind under the terms of the GNU Library General Public Licence Version 2, as shown in the file LICENSE, or under the license shown below. The technical and financial contributors to Coda are listed in the file CREDITS. Additional copyrights */ /* Coda: an Experimental Distributed File System Release 4.0 Copyright (c) 1987-1999 Carnegie Mellon University All Rights Reserved Permission to use, copy, modify and distribute this software and its documentation is hereby granted, provided that both the copyright notice and this permission notice appear in all copies of the software, derivative works or modified versions, and any portions thereof, and that both notices appear in supporting documentation, and that credit is given to Carnegie Mellon University in all documents and publicity pertaining to direct or indirect use of this code or its derivatives. CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF ANY DERIVATIVE WORK. Carnegie Mellon encourages users of this software to return any improvements or extensions that they make, and to grant Carnegie Mellon the rights to redistribute these changes without encumbrance. */ /* * * Based on cfs.h from Mach, but revamped for increased simplicity. * Linux modifications by * Peter Braam, Aug 1996 */ #ifndef _CODA_HEADER_ #define _CODA_HEADER_ /* Catch new _KERNEL defn for NetBSD and DJGPP/__CYGWIN32__ */ #if defined(__NetBSD__) || \ ((defined(DJGPP) || defined(__CYGWIN32__)) && !defined(KERNEL)) #include <sys/types.h> #endif #ifndef CODA_MAXSYMLINKS #define CODA_MAXSYMLINKS 10 #endif #if defined(DJGPP) || defined(__CYGWIN32__) #ifdef KERNEL typedef unsigned long u_long; typedef unsigned int u_int; typedef unsigned short u_short; typedef u_long ino_t; typedef u_long dev_t; typedef void * caddr_t; #ifdef DOS typedef unsigned __int64 u_quad_t; #else typedef unsigned long long u_quad_t; #endif #define __inline__ struct timespec { long ts_sec; long ts_nsec; }; #else /* DJGPP but not KERNEL */ #include <sys/time.h> typedef unsigned long long u_quad_t; #endif /* !KERNEL */ #endif /* !DJGPP */ #if defined(__linux__) #include <linux/time.h> #define cdev_t u_quad_t #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2) #define _UQUAD_T_ 1 typedef unsigned long long u_quad_t; #endif #else #define cdev_t dev_t #endif #ifdef __CYGWIN32__ struct timespec { time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; #endif #ifndef __BIT_TYPES_DEFINED__ #define __BIT_TYPES_DEFINED__ typedef signed char int8_t; typedef unsigned char u_int8_t; typedef short int16_t; typedef unsigned short u_int16_t; typedef int int32_t; typedef unsigned int u_int32_t; #endif /* * Cfs constants */ #define CODA_MAXNAMLEN 255 #define CODA_MAXPATHLEN 1024 #define CODA_MAXSYMLINK 10 /* these are Coda's version of O_RDONLY etc combinations * to deal with VFS open modes */ #define C_O_READ 0x001 #define C_O_WRITE 0x002 #define C_O_TRUNC 0x010 #define C_O_EXCL 0x100 #define C_O_CREAT 0x200 /* these are to find mode bits in Venus */ #define C_M_READ 00400 #define C_M_WRITE 00200 /* for access Venus will use */ #define C_A_C_OK 8 /* Test for writing upon create. */ #define C_A_R_OK 4 /* Test for read permission. */ #define C_A_W_OK 2 /* Test for write permission. */ #define C_A_X_OK 1 /* Test for execute permission. */ #define C_A_F_OK 0 /* Test for existence. */ #ifndef _VENUS_DIRENT_T_ #define _VENUS_DIRENT_T_ 1 struct venus_dirent { u_int32_t d_fileno; /* file number of entry */ u_int16_t d_reclen; /* length of this record */ u_int8_t d_type; /* file type, see below */ u_int8_t d_namlen; /* length of string in d_name */ char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */ }; #undef DIRSIZ #define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \ (((dp)->d_namlen+1 + 3) &~ 3)) /* * File types */ #define CDT_UNKNOWN 0 #define CDT_FIFO 1 #define CDT_CHR 2 #define CDT_DIR 4 #define CDT_BLK 6 #define CDT_REG 8 #define CDT_LNK 10 #define CDT_SOCK 12 #define CDT_WHT 14 /* * Convert between stat structure types and directory types. */ #define IFTOCDT(mode) (((mode) & 0170000) >> 12) #define CDTTOIF(dirtype) ((dirtype) << 12) #endif #ifndef _VUID_T_ #define _VUID_T_ typedef u_int32_t vuid_t; typedef u_int32_t vgid_t; #endif /*_VUID_T_ */ struct CodaFid { u_int32_t opaque[4]; }; #define coda_f2i(fid)\ (fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0) #ifndef _VENUS_VATTR_T_ #define _VENUS_VATTR_T_ /* * Vnode types. VNON means no type. */ enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD }; struct coda_vattr { long va_type; /* vnode type (for create) */ u_short va_mode; /* files access mode and type */ short va_nlink; /* number of references to file */ vuid_t va_uid; /* owner user id */ vgid_t va_gid; /* owner group id */ long va_fileid; /* file id */ u_quad_t va_size; /* file size in bytes */ long va_blocksize; /* blocksize preferred for i/o */ struct timespec va_atime; /* time of last access */ struct timespec va_mtime; /* time of last modification */ struct timespec va_ctime; /* time file changed */ u_long va_gen; /* generation number of file */ u_long va_flags; /* flags defined for file */ cdev_t va_rdev; /* device special file represents */ u_quad_t va_bytes; /* bytes of disk space held by file */ u_quad_t va_filerev; /* file modification number */ }; #endif /* structure used by CODA_STATFS for getting cache information from venus */ struct coda_statfs { int32_t f_blocks; int32_t f_bfree; int32_t f_bavail; int32_t f_files; int32_t f_ffree; }; /* * Kernel <--> Venus communications. */ #define CODA_ROOT 2 #define CODA_OPEN_BY_FD 3 #define CODA_OPEN 4 #define CODA_CLOSE 5 #define CODA_IOCTL 6 #define CODA_GETATTR 7 #define CODA_SETATTR 8 #define CODA_ACCESS 9 #define CODA_LOOKUP 10 #define CODA_CREATE 11 #define CODA_REMOVE 12 #define CODA_LINK 13 #define CODA_RENAME 14 #define CODA_MKDIR 15 #define CODA_RMDIR 16 #define CODA_SYMLINK 18 #define CODA_READLINK 19 #define CODA_FSYNC 20 #define CODA_VGET 22 #define CODA_SIGNAL 23 #define CODA_REPLACE 24 /* DOWNCALL */ #define CODA_FLUSH 25 /* DOWNCALL */ #define CODA_PURGEUSER 26 /* DOWNCALL */ #define CODA_ZAPFILE 27 /* DOWNCALL */ #define CODA_ZAPDIR 28 /* DOWNCALL */ #define CODA_PURGEFID 30 /* DOWNCALL */ #define CODA_OPEN_BY_PATH 31 #define CODA_RESOLVE 32 #define CODA_REINTEGRATE 33 #define CODA_STATFS 34 #define CODA_STORE 35 #define CODA_RELEASE 36 #define CODA_NCALLS 37 #define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID) #define VC_MAXDATASIZE 8192 #define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\ VC_MAXDATASIZE #define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t) #define CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */ /* * Venus <-> Coda RPC arguments */ struct coda_in_hdr { u_int32_t opcode; u_int32_t unique; /* Keep multiple outstanding msgs distinct */ pid_t pid; pid_t pgid; vuid_t uid; }; /* Really important that opcode and unique are 1st two fields! */ struct coda_out_hdr { u_int32_t opcode; u_int32_t unique; u_int32_t result; }; /* coda_root: NO_IN */ struct coda_root_out { struct coda_out_hdr oh; struct CodaFid VFid; }; struct coda_root_in { struct coda_in_hdr in; }; /* coda_open: */ struct coda_open_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_open_out { struct coda_out_hdr oh; cdev_t dev; ino_t inode; }; /* coda_store: */ struct coda_store_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_store_out { struct coda_out_hdr out; }; /* coda_release: */ struct coda_release_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_release_out { struct coda_out_hdr out; }; /* coda_close: */ struct coda_close_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_close_out { struct coda_out_hdr out; }; /* coda_ioctl: */ struct coda_ioctl_in { struct coda_in_hdr ih; struct CodaFid VFid; int cmd; int len; int rwflag; char *data; /* Place holder for data. */ }; struct coda_ioctl_out { struct coda_out_hdr oh; int len; caddr_t data; /* Place holder for data. */ }; /* coda_getattr: */ struct coda_getattr_in { struct coda_in_hdr ih; struct CodaFid VFid; }; struct coda_getattr_out { struct coda_out_hdr oh; struct coda_vattr attr; }; /* coda_setattr: NO_OUT */ struct coda_setattr_in { struct coda_in_hdr ih; struct CodaFid VFid; struct coda_vattr attr; }; struct coda_setattr_out { struct coda_out_hdr out; }; /* coda_access: NO_OUT */ struct coda_access_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_access_out { struct coda_out_hdr out; }; /* lookup flags */ #define CLU_CASE_SENSITIVE 0x01 #define CLU_CASE_INSENSITIVE 0x02 /* coda_lookup: */ struct coda_lookup_in { struct coda_in_hdr ih; struct CodaFid VFid; int name; /* Place holder for data. */ int flags; }; struct coda_lookup_out { struct coda_out_hdr oh; struct CodaFid VFid; int vtype; }; /* coda_create: */ struct coda_create_in { struct coda_in_hdr ih; struct CodaFid VFid; struct coda_vattr attr; int excl; int mode; int name; /* Place holder for data. */ }; struct coda_create_out { struct coda_out_hdr oh; struct CodaFid VFid; struct coda_vattr attr; }; /* coda_remove: NO_OUT */ struct coda_remove_in { struct coda_in_hdr ih; struct CodaFid VFid; int name; /* Place holder for data. */ }; struct coda_remove_out { struct coda_out_hdr out; }; /* coda_link: NO_OUT */ struct coda_link_in { struct coda_in_hdr ih; struct CodaFid sourceFid; /* cnode to link *to* */ struct CodaFid destFid; /* Directory in which to place link */ int tname; /* Place holder for data. */ }; struct coda_link_out { struct coda_out_hdr out; }; /* coda_rename: NO_OUT */ struct coda_rename_in { struct coda_in_hdr ih; struct CodaFid sourceFid; int srcname; struct CodaFid destFid; int destname; }; struct coda_rename_out { struct coda_out_hdr out; }; /* coda_mkdir: */ struct coda_mkdir_in { struct coda_in_hdr ih; struct CodaFid VFid; struct coda_vattr attr; int name; /* Place holder for data. */ }; struct coda_mkdir_out { struct coda_out_hdr oh; struct CodaFid VFid; struct coda_vattr attr; }; /* coda_rmdir: NO_OUT */ struct coda_rmdir_in { struct coda_in_hdr ih; struct CodaFid VFid; int name; /* Place holder for data. */ }; struct coda_rmdir_out { struct coda_out_hdr out; }; /* coda_symlink: NO_OUT */ struct coda_symlink_in { struct coda_in_hdr ih; struct CodaFid VFid; /* Directory to put symlink in */ int srcname; struct coda_vattr attr; int tname; }; struct coda_symlink_out { struct coda_out_hdr out; }; /* coda_readlink: */ struct coda_readlink_in { struct coda_in_hdr ih; struct CodaFid VFid; }; struct coda_readlink_out { struct coda_out_hdr oh; int count; caddr_t data; /* Place holder for data. */ }; /* coda_fsync: NO_OUT */ struct coda_fsync_in { struct coda_in_hdr ih; struct CodaFid VFid; }; struct coda_fsync_out { struct coda_out_hdr out; }; /* coda_vget: */ struct coda_vget_in { struct coda_in_hdr ih; struct CodaFid VFid; }; struct coda_vget_out { struct coda_out_hdr oh; struct CodaFid VFid; int vtype; }; /* CODA_SIGNAL is out-of-band, doesn't need data. */ /* CODA_INVALIDATE is a venus->kernel call */ /* CODA_FLUSH is a venus->kernel call */ /* coda_purgeuser: */ /* CODA_PURGEUSER is a venus->kernel call */ struct coda_purgeuser_out { struct coda_out_hdr oh; vuid_t uid; }; /* coda_zapfile: */ /* CODA_ZAPFILE is a venus->kernel call */ struct coda_zapfile_out { struct coda_out_hdr oh; struct CodaFid CodaFid; }; /* coda_zapdir: */ /* CODA_ZAPDIR is a venus->kernel call */ struct coda_zapdir_out { struct coda_out_hdr oh; struct CodaFid CodaFid; }; /* coda_purgefid: */ /* CODA_PURGEFID is a venus->kernel call */ struct coda_purgefid_out { struct coda_out_hdr oh; struct CodaFid CodaFid; }; /* coda_replace: */ /* CODA_REPLACE is a venus->kernel call */ struct coda_replace_out { /* coda_replace is a venus->kernel call */ struct coda_out_hdr oh; struct CodaFid NewFid; struct CodaFid OldFid; }; /* coda_open_by_fd: */ struct coda_open_by_fd_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_open_by_fd_out { struct coda_out_hdr oh; int fd; }; /* coda_open_by_path: */ struct coda_open_by_path_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_open_by_path_out { struct coda_out_hdr oh; int path; }; /* coda_statfs: NO_IN */ struct coda_statfs_in { struct coda_in_hdr in; }; struct coda_statfs_out { struct coda_out_hdr oh; struct coda_statfs stat; }; /* * Occasionally, we don't cache the fid returned by CODA_LOOKUP. * For instance, if the fid is inconsistent. * This case is handled by setting the top bit of the type result parameter. */ #define CODA_NOCACHE 0x80000000 union inputArgs { struct coda_in_hdr ih; /* NB: every struct below begins with an ih */ struct coda_open_in coda_open; struct coda_store_in coda_store; struct coda_release_in coda_release; struct coda_close_in coda_close; struct coda_ioctl_in coda_ioctl; struct coda_getattr_in coda_getattr; struct coda_setattr_in coda_setattr; struct coda_access_in coda_access; struct coda_lookup_in coda_lookup; struct coda_create_in coda_create; struct coda_remove_in coda_remove; struct coda_link_in coda_link; struct coda_rename_in coda_rename; struct coda_mkdir_in coda_mkdir; struct coda_rmdir_in coda_rmdir; struct coda_symlink_in coda_symlink; struct coda_readlink_in coda_readlink; struct coda_fsync_in coda_fsync; struct coda_vget_in coda_vget; struct coda_open_by_fd_in coda_open_by_fd; struct coda_open_by_path_in coda_open_by_path; struct coda_statfs_in coda_statfs; }; union outputArgs { struct coda_out_hdr oh; /* NB: every struct below begins with an oh */ struct coda_root_out coda_root; struct coda_open_out coda_open; struct coda_ioctl_out coda_ioctl; struct coda_getattr_out coda_getattr; struct coda_lookup_out coda_lookup; struct coda_create_out coda_create; struct coda_mkdir_out coda_mkdir; struct coda_readlink_out coda_readlink; struct coda_vget_out coda_vget; struct coda_purgeuser_out coda_purgeuser; struct coda_zapfile_out coda_zapfile; struct coda_zapdir_out coda_zapdir; struct coda_purgefid_out coda_purgefid; struct coda_replace_out coda_replace; struct coda_open_by_fd_out coda_open_by_fd; struct coda_open_by_path_out coda_open_by_path; struct coda_statfs_out coda_statfs; }; union coda_downcalls { /* CODA_INVALIDATE is a venus->kernel call */ /* CODA_FLUSH is a venus->kernel call */ struct coda_purgeuser_out purgeuser; struct coda_zapfile_out zapfile; struct coda_zapdir_out zapdir; struct coda_purgefid_out purgefid; struct coda_replace_out replace; }; /* * Used for identifying usage of "Control" and pioctls */ #define PIOCPARM_MASK 0x0000ffff struct ViceIoctl { void *in; /* Data to be transferred in */ void *out; /* Data to be transferred out */ u_short in_size; /* Size of input buffer <= 2K */ u_short out_size; /* Maximum size of output buffer, <= 2K */ }; struct PioctlData { const char *path; int follow; struct ViceIoctl vi; }; #define CODA_CONTROL ".CONTROL" #define CODA_CONTROLLEN 8 #define CTL_INO -1 /* Data passed to mount */ #define CODA_MOUNT_VERSION 1 struct coda_mount_data { int version; int fd; /* Opened device */ }; #endif /* _CODA_HEADER_ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/bfs_fs.h��������������������������������������������������������������������������������������0000644�����������������00000003545�14763166027�0007341 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/linux/bfs_fs.h - BFS data structures on disk. * Copyright (C) 1999 Tigran Aivazian <tigran@veritas.com> */ #ifndef _LINUX_BFS_FS_H #define _LINUX_BFS_FS_H #include <linux/types.h> #define BFS_BSIZE_BITS 9 #define BFS_BSIZE (1<<BFS_BSIZE_BITS) #define BFS_MAGIC 0x1BADFACE #define BFS_ROOT_INO 2 #define BFS_INODES_PER_BLOCK 8 /* SVR4 vnode type values (bfs_inode->i_vtype) */ #define BFS_VDIR 2L #define BFS_VREG 1L /* BFS inode layout on disk */ struct bfs_inode { __le16 i_ino; __u16 i_unused; __le32 i_sblock; __le32 i_eblock; __le32 i_eoffset; __le32 i_vtype; __le32 i_mode; __le32 i_uid; __le32 i_gid; __le32 i_nlink; __le32 i_atime; __le32 i_mtime; __le32 i_ctime; __u32 i_padding[4]; }; #define BFS_NAMELEN 14 #define BFS_DIRENT_SIZE 16 #define BFS_DIRS_PER_BLOCK 32 struct bfs_dirent { __le16 ino; char name[BFS_NAMELEN]; }; /* BFS superblock layout on disk */ struct bfs_super_block { __le32 s_magic; __le32 s_start; __le32 s_end; __le32 s_from; __le32 s_to; __s32 s_bfrom; __s32 s_bto; char s_fsname[6]; char s_volume[6]; __u32 s_padding[118]; }; #define BFS_OFF2INO(offset) \ ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO) #define BFS_INO2OFF(ino) \ ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE) #define BFS_NZFILESIZE(ip) \ ((le32_to_cpu((ip)->i_eoffset) + 1) - le32_to_cpu((ip)->i_sblock) * BFS_BSIZE) #define BFS_FILESIZE(ip) \ ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip)) #define BFS_FILEBLOCKS(ip) \ ((ip)->i_sblock == 0 ? 0 : (le32_to_cpu((ip)->i_eblock) + 1) - le32_to_cpu((ip)->i_sblock)) #define BFS_UNCLEAN(bfs_sb, sb) \ ((le32_to_cpu(bfs_sb->s_from) != -1) && (le32_to_cpu(bfs_sb->s_to) != -1) && !(sb->s_flags & SB_RDONLY)) #endif /* _LINUX_BFS_FS_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������linux/xilinx-v4l2-controls.h������������������������������������������������������������������������0000644�����������������00000005640�14763166027�0012036 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Xilinx Controls Header * * Copyright (C) 2013-2015 Ideas on Board * Copyright (C) 2013-2015 Xilinx, Inc. * * Contacts: Hyun Kwon <hyun.kwon@xilinx.com> * Laurent Pinchart <laurent.pinchart@ideasonboard.com> * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * 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. */ #ifndef __UAPI_XILINX_V4L2_CONTROLS_H__ #define __UAPI_XILINX_V4L2_CONTROLS_H__ #include <linux/v4l2-controls.h> #define V4L2_CID_XILINX_OFFSET 0xc000 #define V4L2_CID_XILINX_BASE (V4L2_CID_USER_BASE + V4L2_CID_XILINX_OFFSET) /* * Private Controls for Xilinx Video IPs */ /* * Xilinx TPG Video IP */ #define V4L2_CID_XILINX_TPG (V4L2_CID_USER_BASE + 0xc000) /* Draw cross hairs */ #define V4L2_CID_XILINX_TPG_CROSS_HAIRS (V4L2_CID_XILINX_TPG + 1) /* Enable a moving box */ #define V4L2_CID_XILINX_TPG_MOVING_BOX (V4L2_CID_XILINX_TPG + 2) /* Mask out a color component */ #define V4L2_CID_XILINX_TPG_COLOR_MASK (V4L2_CID_XILINX_TPG + 3) /* Enable a stuck pixel feature */ #define V4L2_CID_XILINX_TPG_STUCK_PIXEL (V4L2_CID_XILINX_TPG + 4) /* Enable a noisy output */ #define V4L2_CID_XILINX_TPG_NOISE (V4L2_CID_XILINX_TPG + 5) /* Enable the motion feature */ #define V4L2_CID_XILINX_TPG_MOTION (V4L2_CID_XILINX_TPG + 6) /* Configure the motion speed of moving patterns */ #define V4L2_CID_XILINX_TPG_MOTION_SPEED (V4L2_CID_XILINX_TPG + 7) /* The row of horizontal cross hair location */ #define V4L2_CID_XILINX_TPG_CROSS_HAIR_ROW (V4L2_CID_XILINX_TPG + 8) /* The colum of vertical cross hair location */ #define V4L2_CID_XILINX_TPG_CROSS_HAIR_COLUMN (V4L2_CID_XILINX_TPG + 9) /* Set starting point of sine wave for horizontal component */ #define V4L2_CID_XILINX_TPG_ZPLATE_HOR_START (V4L2_CID_XILINX_TPG + 10) /* Set speed of the horizontal component */ #define V4L2_CID_XILINX_TPG_ZPLATE_HOR_SPEED (V4L2_CID_XILINX_TPG + 11) /* Set starting point of sine wave for vertical component */ #define V4L2_CID_XILINX_TPG_ZPLATE_VER_START (V4L2_CID_XILINX_TPG + 12) /* Set speed of the vertical component */ #define V4L2_CID_XILINX_TPG_ZPLATE_VER_SPEED (V4L2_CID_XILINX_TPG + 13) /* Moving box size */ #define V4L2_CID_XILINX_TPG_BOX_SIZE (V4L2_CID_XILINX_TPG + 14) /* Moving box color */ #define V4L2_CID_XILINX_TPG_BOX_COLOR (V4L2_CID_XILINX_TPG + 15) /* Upper limit count of generated stuck pixels */ #define V4L2_CID_XILINX_TPG_STUCK_PIXEL_THRESH (V4L2_CID_XILINX_TPG + 16) /* Noise level */ #define V4L2_CID_XILINX_TPG_NOISE_GAIN (V4L2_CID_XILINX_TPG + 17) #endif /* __UAPI_XILINX_V4L2_CONTROLS_H__ */ ������������������������������������������������������������������������������������������������linux/cec.h�����������������������������������������������������������������������������������������0000644�����������������00000107003�14763166027�0006623 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * cec - HDMI Consumer Electronics Control public header * * Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved. */ #ifndef _CEC_UAPI_H #define _CEC_UAPI_H #include <linux/types.h> #include <linux/string.h> #define CEC_MAX_MSG_SIZE 16 /** * struct cec_msg - CEC message structure. * @tx_ts: Timestamp in nanoseconds using CLOCK_MONOTONIC. Set by the * driver when the message transmission has finished. * @rx_ts: Timestamp in nanoseconds using CLOCK_MONOTONIC. Set by the * driver when the message was received. * @len: Length in bytes of the message. * @timeout: The timeout (in ms) that is used to timeout CEC_RECEIVE. * Set to 0 if you want to wait forever. This timeout can also be * used with CEC_TRANSMIT as the timeout for waiting for a reply. * If 0, then it will use a 1 second timeout instead of waiting * forever as is done with CEC_RECEIVE. * @sequence: The framework assigns a sequence number to messages that are * sent. This can be used to track replies to previously sent * messages. * @flags: Set to 0. * @msg: The message payload. * @reply: This field is ignored with CEC_RECEIVE and is only used by * CEC_TRANSMIT. If non-zero, then wait for a reply with this * opcode. Set to CEC_MSG_FEATURE_ABORT if you want to wait for * a possible ABORT reply. If there was an error when sending the * msg or FeatureAbort was returned, then reply is set to 0. * If reply is non-zero upon return, then len/msg are set to * the received message. * If reply is zero upon return and status has the * CEC_TX_STATUS_FEATURE_ABORT bit set, then len/msg are set to * the received feature abort message. * If reply is zero upon return and status has the * CEC_TX_STATUS_MAX_RETRIES bit set, then no reply was seen at * all. If reply is non-zero for CEC_TRANSMIT and the message is a * broadcast, then -EINVAL is returned. * if reply is non-zero, then timeout is set to 1000 (the required * maximum response time). * @rx_status: The message receive status bits. Set by the driver. * @tx_status: The message transmit status bits. Set by the driver. * @tx_arb_lost_cnt: The number of 'Arbitration Lost' events. Set by the driver. * @tx_nack_cnt: The number of 'Not Acknowledged' events. Set by the driver. * @tx_low_drive_cnt: The number of 'Low Drive Detected' events. Set by the * driver. * @tx_error_cnt: The number of 'Error' events. Set by the driver. */ struct cec_msg { __u64 tx_ts; __u64 rx_ts; __u32 len; __u32 timeout; __u32 sequence; __u32 flags; __u8 msg[CEC_MAX_MSG_SIZE]; __u8 reply; __u8 rx_status; __u8 tx_status; __u8 tx_arb_lost_cnt; __u8 tx_nack_cnt; __u8 tx_low_drive_cnt; __u8 tx_error_cnt; }; /** * cec_msg_initiator - return the initiator's logical address. * @msg: the message structure */ static __inline__ __u8 cec_msg_initiator(const struct cec_msg *msg) { return msg->msg[0] >> 4; } /** * cec_msg_destination - return the destination's logical address. * @msg: the message structure */ static __inline__ __u8 cec_msg_destination(const struct cec_msg *msg) { return msg->msg[0] & 0xf; } /** * cec_msg_opcode - return the opcode of the message, -1 for poll * @msg: the message structure */ static __inline__ int cec_msg_opcode(const struct cec_msg *msg) { return msg->len > 1 ? msg->msg[1] : -1; } /** * cec_msg_is_broadcast - return true if this is a broadcast message. * @msg: the message structure */ static __inline__ int cec_msg_is_broadcast(const struct cec_msg *msg) { return (msg->msg[0] & 0xf) == 0xf; } /** * cec_msg_init - initialize the message structure. * @msg: the message structure * @initiator: the logical address of the initiator * @destination:the logical address of the destination (0xf for broadcast) * * The whole structure is zeroed, the len field is set to 1 (i.e. a poll * message) and the initiator and destination are filled in. */ static __inline__ void cec_msg_init(struct cec_msg *msg, __u8 initiator, __u8 destination) { memset(msg, 0, sizeof(*msg)); msg->msg[0] = (initiator << 4) | destination; msg->len = 1; } /** * cec_msg_set_reply_to - fill in destination/initiator in a reply message. * @msg: the message structure for the reply * @orig: the original message structure * * Set the msg destination to the orig initiator and the msg initiator to the * orig destination. Note that msg and orig may be the same pointer, in which * case the change is done in place. */ static __inline__ void cec_msg_set_reply_to(struct cec_msg *msg, struct cec_msg *orig) { /* The destination becomes the initiator and vice versa */ msg->msg[0] = (cec_msg_destination(orig) << 4) | cec_msg_initiator(orig); msg->reply = msg->timeout = 0; } /* cec_msg flags field */ #define CEC_MSG_FL_REPLY_TO_FOLLOWERS (1 << 0) /* cec_msg tx/rx_status field */ #define CEC_TX_STATUS_OK (1 << 0) #define CEC_TX_STATUS_ARB_LOST (1 << 1) #define CEC_TX_STATUS_NACK (1 << 2) #define CEC_TX_STATUS_LOW_DRIVE (1 << 3) #define CEC_TX_STATUS_ERROR (1 << 4) #define CEC_TX_STATUS_MAX_RETRIES (1 << 5) #define CEC_TX_STATUS_ABORTED (1 << 6) #define CEC_TX_STATUS_TIMEOUT (1 << 7) #define CEC_RX_STATUS_OK (1 << 0) #define CEC_RX_STATUS_TIMEOUT (1 << 1) #define CEC_RX_STATUS_FEATURE_ABORT (1 << 2) #define CEC_RX_STATUS_ABORTED (1 << 3) static __inline__ int cec_msg_status_is_ok(const struct cec_msg *msg) { if (msg->tx_status && !(msg->tx_status & CEC_TX_STATUS_OK)) return 0; if (msg->rx_status && !(msg->rx_status & CEC_RX_STATUS_OK)) return 0; if (!msg->tx_status && !msg->rx_status) return 0; return !(msg->rx_status & CEC_RX_STATUS_FEATURE_ABORT); } #define CEC_LOG_ADDR_INVALID 0xff #define CEC_PHYS_ADDR_INVALID 0xffff /* * The maximum number of logical addresses one device can be assigned to. * The CEC 2.0 spec allows for only 2 logical addresses at the moment. The * Analog Devices CEC hardware supports 3. So let's go wild and go for 4. */ #define CEC_MAX_LOG_ADDRS 4 /* The logical addresses defined by CEC 2.0 */ #define CEC_LOG_ADDR_TV 0 #define CEC_LOG_ADDR_RECORD_1 1 #define CEC_LOG_ADDR_RECORD_2 2 #define CEC_LOG_ADDR_TUNER_1 3 #define CEC_LOG_ADDR_PLAYBACK_1 4 #define CEC_LOG_ADDR_AUDIOSYSTEM 5 #define CEC_LOG_ADDR_TUNER_2 6 #define CEC_LOG_ADDR_TUNER_3 7 #define CEC_LOG_ADDR_PLAYBACK_2 8 #define CEC_LOG_ADDR_RECORD_3 9 #define CEC_LOG_ADDR_TUNER_4 10 #define CEC_LOG_ADDR_PLAYBACK_3 11 #define CEC_LOG_ADDR_BACKUP_1 12 #define CEC_LOG_ADDR_BACKUP_2 13 #define CEC_LOG_ADDR_SPECIFIC 14 #define CEC_LOG_ADDR_UNREGISTERED 15 /* as initiator address */ #define CEC_LOG_ADDR_BROADCAST 15 /* as destination address */ /* The logical address types that the CEC device wants to claim */ #define CEC_LOG_ADDR_TYPE_TV 0 #define CEC_LOG_ADDR_TYPE_RECORD 1 #define CEC_LOG_ADDR_TYPE_TUNER 2 #define CEC_LOG_ADDR_TYPE_PLAYBACK 3 #define CEC_LOG_ADDR_TYPE_AUDIOSYSTEM 4 #define CEC_LOG_ADDR_TYPE_SPECIFIC 5 #define CEC_LOG_ADDR_TYPE_UNREGISTERED 6 /* * Switches should use UNREGISTERED. * Processors should use SPECIFIC. */ #define CEC_LOG_ADDR_MASK_TV (1 << CEC_LOG_ADDR_TV) #define CEC_LOG_ADDR_MASK_RECORD ((1 << CEC_LOG_ADDR_RECORD_1) | \ (1 << CEC_LOG_ADDR_RECORD_2) | \ (1 << CEC_LOG_ADDR_RECORD_3)) #define CEC_LOG_ADDR_MASK_TUNER ((1 << CEC_LOG_ADDR_TUNER_1) | \ (1 << CEC_LOG_ADDR_TUNER_2) | \ (1 << CEC_LOG_ADDR_TUNER_3) | \ (1 << CEC_LOG_ADDR_TUNER_4)) #define CEC_LOG_ADDR_MASK_PLAYBACK ((1 << CEC_LOG_ADDR_PLAYBACK_1) | \ (1 << CEC_LOG_ADDR_PLAYBACK_2) | \ (1 << CEC_LOG_ADDR_PLAYBACK_3)) #define CEC_LOG_ADDR_MASK_AUDIOSYSTEM (1 << CEC_LOG_ADDR_AUDIOSYSTEM) #define CEC_LOG_ADDR_MASK_BACKUP ((1 << CEC_LOG_ADDR_BACKUP_1) | \ (1 << CEC_LOG_ADDR_BACKUP_2)) #define CEC_LOG_ADDR_MASK_SPECIFIC (1 << CEC_LOG_ADDR_SPECIFIC) #define CEC_LOG_ADDR_MASK_UNREGISTERED (1 << CEC_LOG_ADDR_UNREGISTERED) static __inline__ int cec_has_tv(__u16 log_addr_mask) { return log_addr_mask & CEC_LOG_ADDR_MASK_TV; } static __inline__ int cec_has_record(__u16 log_addr_mask) { return log_addr_mask & CEC_LOG_ADDR_MASK_RECORD; } static __inline__ int cec_has_tuner(__u16 log_addr_mask) { return log_addr_mask & CEC_LOG_ADDR_MASK_TUNER; } static __inline__ int cec_has_playback(__u16 log_addr_mask) { return log_addr_mask & CEC_LOG_ADDR_MASK_PLAYBACK; } static __inline__ int cec_has_audiosystem(__u16 log_addr_mask) { return log_addr_mask & CEC_LOG_ADDR_MASK_AUDIOSYSTEM; } static __inline__ int cec_has_backup(__u16 log_addr_mask) { return log_addr_mask & CEC_LOG_ADDR_MASK_BACKUP; } static __inline__ int cec_has_specific(__u16 log_addr_mask) { return log_addr_mask & CEC_LOG_ADDR_MASK_SPECIFIC; } static __inline__ int cec_is_unregistered(__u16 log_addr_mask) { return log_addr_mask & CEC_LOG_ADDR_MASK_UNREGISTERED; } static __inline__ int cec_is_unconfigured(__u16 log_addr_mask) { return log_addr_mask == 0; } /* * Use this if there is no vendor ID (CEC_G_VENDOR_ID) or if the vendor ID * should be disabled (CEC_S_VENDOR_ID) */ #define CEC_VENDOR_ID_NONE 0xffffffff /* The message handling modes */ /* Modes for initiator */ #define CEC_MODE_NO_INITIATOR (0x0 << 0) #define CEC_MODE_INITIATOR (0x1 << 0) #define CEC_MODE_EXCL_INITIATOR (0x2 << 0) #define CEC_MODE_INITIATOR_MSK 0x0f /* Modes for follower */ #define CEC_MODE_NO_FOLLOWER (0x0 << 4) #define CEC_MODE_FOLLOWER (0x1 << 4) #define CEC_MODE_EXCL_FOLLOWER (0x2 << 4) #define CEC_MODE_EXCL_FOLLOWER_PASSTHRU (0x3 << 4) #define CEC_MODE_MONITOR_PIN (0xd << 4) #define CEC_MODE_MONITOR (0xe << 4) #define CEC_MODE_MONITOR_ALL (0xf << 4) #define CEC_MODE_FOLLOWER_MSK 0xf0 /* Userspace has to configure the physical address */ #define CEC_CAP_PHYS_ADDR (1 << 0) /* Userspace has to configure the logical addresses */ #define CEC_CAP_LOG_ADDRS (1 << 1) /* Userspace can transmit messages (and thus become follower as well) */ #define CEC_CAP_TRANSMIT (1 << 2) /* * Passthrough all messages instead of processing them. */ #define CEC_CAP_PASSTHROUGH (1 << 3) /* Supports remote control */ #define CEC_CAP_RC (1 << 4) /* Hardware can monitor all messages, not just directed and broadcast. */ #define CEC_CAP_MONITOR_ALL (1 << 5) /* Hardware can use CEC only if the HDMI HPD pin is high. */ #define CEC_CAP_NEEDS_HPD (1 << 6) /* Hardware can monitor CEC pin transitions */ #define CEC_CAP_MONITOR_PIN (1 << 7) /** * struct cec_caps - CEC capabilities structure. * @driver: name of the CEC device driver. * @name: name of the CEC device. @driver + @name must be unique. * @available_log_addrs: number of available logical addresses. * @capabilities: capabilities of the CEC adapter. * @version: version of the CEC adapter framework. */ struct cec_caps { char driver[32]; char name[32]; __u32 available_log_addrs; __u32 capabilities; __u32 version; }; /** * struct cec_log_addrs - CEC logical addresses structure. * @log_addr: the claimed logical addresses. Set by the driver. * @log_addr_mask: current logical address mask. Set by the driver. * @cec_version: the CEC version that the adapter should implement. Set by the * caller. * @num_log_addrs: how many logical addresses should be claimed. Set by the * caller. * @vendor_id: the vendor ID of the device. Set by the caller. * @flags: flags. * @osd_name: the OSD name of the device. Set by the caller. * @primary_device_type: the primary device type for each logical address. * Set by the caller. * @log_addr_type: the logical address types. Set by the caller. * @all_device_types: CEC 2.0: all device types represented by the logical * address. Set by the caller. * @features: CEC 2.0: The logical address features. Set by the caller. */ struct cec_log_addrs { __u8 log_addr[CEC_MAX_LOG_ADDRS]; __u16 log_addr_mask; __u8 cec_version; __u8 num_log_addrs; __u32 vendor_id; __u32 flags; char osd_name[15]; __u8 primary_device_type[CEC_MAX_LOG_ADDRS]; __u8 log_addr_type[CEC_MAX_LOG_ADDRS]; /* CEC 2.0 */ __u8 all_device_types[CEC_MAX_LOG_ADDRS]; __u8 features[CEC_MAX_LOG_ADDRS][12]; }; /* Allow a fallback to unregistered */ #define CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK (1 << 0) /* Passthrough RC messages to the input subsystem */ #define CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU (1 << 1) /* CDC-Only device: supports only CDC messages */ #define CEC_LOG_ADDRS_FL_CDC_ONLY (1 << 2) /* Events */ /* Event that occurs when the adapter state changes */ #define CEC_EVENT_STATE_CHANGE 1 /* * This event is sent when messages are lost because the application * didn't empty the message queue in time */ #define CEC_EVENT_LOST_MSGS 2 #define CEC_EVENT_PIN_CEC_LOW 3 #define CEC_EVENT_PIN_CEC_HIGH 4 #define CEC_EVENT_PIN_HPD_LOW 5 #define CEC_EVENT_PIN_HPD_HIGH 6 #define CEC_EVENT_PIN_5V_LOW 7 #define CEC_EVENT_PIN_5V_HIGH 8 #define CEC_EVENT_FL_INITIAL_STATE (1 << 0) #define CEC_EVENT_FL_DROPPED_EVENTS (1 << 1) /** * struct cec_event_state_change - used when the CEC adapter changes state. * @phys_addr: the current physical address * @log_addr_mask: the current logical address mask */ struct cec_event_state_change { __u16 phys_addr; __u16 log_addr_mask; }; /** * struct cec_event_lost_msgs - tells you how many messages were lost. * @lost_msgs: how many messages were lost. */ struct cec_event_lost_msgs { __u32 lost_msgs; }; /** * struct cec_event - CEC event structure * @ts: the timestamp of when the event was sent. * @event: the event. * array. * @state_change: the event payload for CEC_EVENT_STATE_CHANGE. * @lost_msgs: the event payload for CEC_EVENT_LOST_MSGS. * @raw: array to pad the union. */ struct cec_event { __u64 ts; __u32 event; __u32 flags; union { struct cec_event_state_change state_change; struct cec_event_lost_msgs lost_msgs; __u32 raw[16]; }; }; /* ioctls */ /* Adapter capabilities */ #define CEC_ADAP_G_CAPS _IOWR('a', 0, struct cec_caps) /* * phys_addr is either 0 (if this is the CEC root device) * or a valid physical address obtained from the sink's EDID * as read by this CEC device (if this is a source device) * or a physical address obtained and modified from a sink * EDID and used for a sink CEC device. * If nothing is connected, then phys_addr is 0xffff. * See HDMI 1.4b, section 8.7 (Physical Address). * * The CEC_ADAP_S_PHYS_ADDR ioctl may not be available if that is handled * internally. */ #define CEC_ADAP_G_PHYS_ADDR _IOR('a', 1, __u16) #define CEC_ADAP_S_PHYS_ADDR _IOW('a', 2, __u16) /* * Configure the CEC adapter. It sets the device type and which * logical types it will try to claim. It will return which * logical addresses it could actually claim. * An error is returned if the adapter is disabled or if there * is no physical address assigned. */ #define CEC_ADAP_G_LOG_ADDRS _IOR('a', 3, struct cec_log_addrs) #define CEC_ADAP_S_LOG_ADDRS _IOWR('a', 4, struct cec_log_addrs) /* Transmit/receive a CEC command */ #define CEC_TRANSMIT _IOWR('a', 5, struct cec_msg) #define CEC_RECEIVE _IOWR('a', 6, struct cec_msg) /* Dequeue CEC events */ #define CEC_DQEVENT _IOWR('a', 7, struct cec_event) /* * Get and set the message handling mode for this filehandle. */ #define CEC_G_MODE _IOR('a', 8, __u32) #define CEC_S_MODE _IOW('a', 9, __u32) /* * The remainder of this header defines all CEC messages and operands. * The format matters since it the cec-ctl utility parses it to generate * code for implementing all these messages. * * Comments ending with 'Feature' group messages for each feature. * If messages are part of multiple features, then the "Has also" * comment is used to list the previously defined messages that are * supported by the feature. * * Before operands are defined a comment is added that gives the * name of the operand and in brackets the variable name of the * corresponding argument in the cec-funcs.h function. */ /* Messages */ /* One Touch Play Feature */ #define CEC_MSG_ACTIVE_SOURCE 0x82 #define CEC_MSG_IMAGE_VIEW_ON 0x04 #define CEC_MSG_TEXT_VIEW_ON 0x0d /* Routing Control Feature */ /* * Has also: * CEC_MSG_ACTIVE_SOURCE */ #define CEC_MSG_INACTIVE_SOURCE 0x9d #define CEC_MSG_REQUEST_ACTIVE_SOURCE 0x85 #define CEC_MSG_ROUTING_CHANGE 0x80 #define CEC_MSG_ROUTING_INFORMATION 0x81 #define CEC_MSG_SET_STREAM_PATH 0x86 /* Standby Feature */ #define CEC_MSG_STANDBY 0x36 /* One Touch Record Feature */ #define CEC_MSG_RECORD_OFF 0x0b #define CEC_MSG_RECORD_ON 0x09 /* Record Source Type Operand (rec_src_type) */ #define CEC_OP_RECORD_SRC_OWN 1 #define CEC_OP_RECORD_SRC_DIGITAL 2 #define CEC_OP_RECORD_SRC_ANALOG 3 #define CEC_OP_RECORD_SRC_EXT_PLUG 4 #define CEC_OP_RECORD_SRC_EXT_PHYS_ADDR 5 /* Service Identification Method Operand (service_id_method) */ #define CEC_OP_SERVICE_ID_METHOD_BY_DIG_ID 0 #define CEC_OP_SERVICE_ID_METHOD_BY_CHANNEL 1 /* Digital Service Broadcast System Operand (dig_bcast_system) */ #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ARIB_GEN 0x00 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_GEN 0x01 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_GEN 0x02 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ARIB_BS 0x08 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ARIB_CS 0x09 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ARIB_T 0x0a #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_CABLE 0x10 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_SAT 0x11 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_T 0x12 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_C 0x18 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_S 0x19 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_S2 0x1a #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_T 0x1b /* Analogue Broadcast Type Operand (ana_bcast_type) */ #define CEC_OP_ANA_BCAST_TYPE_CABLE 0 #define CEC_OP_ANA_BCAST_TYPE_SATELLITE 1 #define CEC_OP_ANA_BCAST_TYPE_TERRESTRIAL 2 /* Broadcast System Operand (bcast_system) */ #define CEC_OP_BCAST_SYSTEM_PAL_BG 0x00 #define CEC_OP_BCAST_SYSTEM_SECAM_LQ 0x01 /* SECAM L' */ #define CEC_OP_BCAST_SYSTEM_PAL_M 0x02 #define CEC_OP_BCAST_SYSTEM_NTSC_M 0x03 #define CEC_OP_BCAST_SYSTEM_PAL_I 0x04 #define CEC_OP_BCAST_SYSTEM_SECAM_DK 0x05 #define CEC_OP_BCAST_SYSTEM_SECAM_BG 0x06 #define CEC_OP_BCAST_SYSTEM_SECAM_L 0x07 #define CEC_OP_BCAST_SYSTEM_PAL_DK 0x08 #define CEC_OP_BCAST_SYSTEM_OTHER 0x1f /* Channel Number Format Operand (channel_number_fmt) */ #define CEC_OP_CHANNEL_NUMBER_FMT_1_PART 0x01 #define CEC_OP_CHANNEL_NUMBER_FMT_2_PART 0x02 #define CEC_MSG_RECORD_STATUS 0x0a /* Record Status Operand (rec_status) */ #define CEC_OP_RECORD_STATUS_CUR_SRC 0x01 #define CEC_OP_RECORD_STATUS_DIG_SERVICE 0x02 #define CEC_OP_RECORD_STATUS_ANA_SERVICE 0x03 #define CEC_OP_RECORD_STATUS_EXT_INPUT 0x04 #define CEC_OP_RECORD_STATUS_NO_DIG_SERVICE 0x05 #define CEC_OP_RECORD_STATUS_NO_ANA_SERVICE 0x06 #define CEC_OP_RECORD_STATUS_NO_SERVICE 0x07 #define CEC_OP_RECORD_STATUS_INVALID_EXT_PLUG 0x09 #define CEC_OP_RECORD_STATUS_INVALID_EXT_PHYS_ADDR 0x0a #define CEC_OP_RECORD_STATUS_UNSUP_CA 0x0b #define CEC_OP_RECORD_STATUS_NO_CA_ENTITLEMENTS 0x0c #define CEC_OP_RECORD_STATUS_CANT_COPY_SRC 0x0d #define CEC_OP_RECORD_STATUS_NO_MORE_COPIES 0x0e #define CEC_OP_RECORD_STATUS_NO_MEDIA 0x10 #define CEC_OP_RECORD_STATUS_PLAYING 0x11 #define CEC_OP_RECORD_STATUS_ALREADY_RECORDING 0x12 #define CEC_OP_RECORD_STATUS_MEDIA_PROT 0x13 #define CEC_OP_RECORD_STATUS_NO_SIGNAL 0x14 #define CEC_OP_RECORD_STATUS_MEDIA_PROBLEM 0x15 #define CEC_OP_RECORD_STATUS_NO_SPACE 0x16 #define CEC_OP_RECORD_STATUS_PARENTAL_LOCK 0x17 #define CEC_OP_RECORD_STATUS_TERMINATED_OK 0x1a #define CEC_OP_RECORD_STATUS_ALREADY_TERM 0x1b #define CEC_OP_RECORD_STATUS_OTHER 0x1f #define CEC_MSG_RECORD_TV_SCREEN 0x0f /* Timer Programming Feature */ #define CEC_MSG_CLEAR_ANALOGUE_TIMER 0x33 /* Recording Sequence Operand (recording_seq) */ #define CEC_OP_REC_SEQ_SUNDAY 0x01 #define CEC_OP_REC_SEQ_MONDAY 0x02 #define CEC_OP_REC_SEQ_TUESDAY 0x04 #define CEC_OP_REC_SEQ_WEDNESDAY 0x08 #define CEC_OP_REC_SEQ_THURSDAY 0x10 #define CEC_OP_REC_SEQ_FRIDAY 0x20 #define CEC_OP_REC_SEQ_SATERDAY 0x40 #define CEC_OP_REC_SEQ_ONCE_ONLY 0x00 #define CEC_MSG_CLEAR_DIGITAL_TIMER 0x99 #define CEC_MSG_CLEAR_EXT_TIMER 0xa1 /* External Source Specifier Operand (ext_src_spec) */ #define CEC_OP_EXT_SRC_PLUG 0x04 #define CEC_OP_EXT_SRC_PHYS_ADDR 0x05 #define CEC_MSG_SET_ANALOGUE_TIMER 0x34 #define CEC_MSG_SET_DIGITAL_TIMER 0x97 #define CEC_MSG_SET_EXT_TIMER 0xa2 #define CEC_MSG_SET_TIMER_PROGRAM_TITLE 0x67 #define CEC_MSG_TIMER_CLEARED_STATUS 0x43 /* Timer Cleared Status Data Operand (timer_cleared_status) */ #define CEC_OP_TIMER_CLR_STAT_RECORDING 0x00 #define CEC_OP_TIMER_CLR_STAT_NO_MATCHING 0x01 #define CEC_OP_TIMER_CLR_STAT_NO_INFO 0x02 #define CEC_OP_TIMER_CLR_STAT_CLEARED 0x80 #define CEC_MSG_TIMER_STATUS 0x35 /* Timer Overlap Warning Operand (timer_overlap_warning) */ #define CEC_OP_TIMER_OVERLAP_WARNING_NO_OVERLAP 0 #define CEC_OP_TIMER_OVERLAP_WARNING_OVERLAP 1 /* Media Info Operand (media_info) */ #define CEC_OP_MEDIA_INFO_UNPROT_MEDIA 0 #define CEC_OP_MEDIA_INFO_PROT_MEDIA 1 #define CEC_OP_MEDIA_INFO_NO_MEDIA 2 /* Programmed Indicator Operand (prog_indicator) */ #define CEC_OP_PROG_IND_NOT_PROGRAMMED 0 #define CEC_OP_PROG_IND_PROGRAMMED 1 /* Programmed Info Operand (prog_info) */ #define CEC_OP_PROG_INFO_ENOUGH_SPACE 0x08 #define CEC_OP_PROG_INFO_NOT_ENOUGH_SPACE 0x09 #define CEC_OP_PROG_INFO_MIGHT_NOT_BE_ENOUGH_SPACE 0x0b #define CEC_OP_PROG_INFO_NONE_AVAILABLE 0x0a /* Not Programmed Error Info Operand (prog_error) */ #define CEC_OP_PROG_ERROR_NO_FREE_TIMER 0x01 #define CEC_OP_PROG_ERROR_DATE_OUT_OF_RANGE 0x02 #define CEC_OP_PROG_ERROR_REC_SEQ_ERROR 0x03 #define CEC_OP_PROG_ERROR_INV_EXT_PLUG 0x04 #define CEC_OP_PROG_ERROR_INV_EXT_PHYS_ADDR 0x05 #define CEC_OP_PROG_ERROR_CA_UNSUPP 0x06 #define CEC_OP_PROG_ERROR_INSUF_CA_ENTITLEMENTS 0x07 #define CEC_OP_PROG_ERROR_RESOLUTION_UNSUPP 0x08 #define CEC_OP_PROG_ERROR_PARENTAL_LOCK 0x09 #define CEC_OP_PROG_ERROR_CLOCK_FAILURE 0x0a #define CEC_OP_PROG_ERROR_DUPLICATE 0x0e /* System Information Feature */ #define CEC_MSG_CEC_VERSION 0x9e /* CEC Version Operand (cec_version) */ #define CEC_OP_CEC_VERSION_1_3A 4 #define CEC_OP_CEC_VERSION_1_4 5 #define CEC_OP_CEC_VERSION_2_0 6 #define CEC_MSG_GET_CEC_VERSION 0x9f #define CEC_MSG_GIVE_PHYSICAL_ADDR 0x83 #define CEC_MSG_GET_MENU_LANGUAGE 0x91 #define CEC_MSG_REPORT_PHYSICAL_ADDR 0x84 /* Primary Device Type Operand (prim_devtype) */ #define CEC_OP_PRIM_DEVTYPE_TV 0 #define CEC_OP_PRIM_DEVTYPE_RECORD 1 #define CEC_OP_PRIM_DEVTYPE_TUNER 3 #define CEC_OP_PRIM_DEVTYPE_PLAYBACK 4 #define CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM 5 #define CEC_OP_PRIM_DEVTYPE_SWITCH 6 #define CEC_OP_PRIM_DEVTYPE_PROCESSOR 7 #define CEC_MSG_SET_MENU_LANGUAGE 0x32 #define CEC_MSG_REPORT_FEATURES 0xa6 /* HDMI 2.0 */ /* All Device Types Operand (all_device_types) */ #define CEC_OP_ALL_DEVTYPE_TV 0x80 #define CEC_OP_ALL_DEVTYPE_RECORD 0x40 #define CEC_OP_ALL_DEVTYPE_TUNER 0x20 #define CEC_OP_ALL_DEVTYPE_PLAYBACK 0x10 #define CEC_OP_ALL_DEVTYPE_AUDIOSYSTEM 0x08 #define CEC_OP_ALL_DEVTYPE_SWITCH 0x04 /* * And if you wondering what happened to PROCESSOR devices: those should * be mapped to a SWITCH. */ /* Valid for RC Profile and Device Feature operands */ #define CEC_OP_FEAT_EXT 0x80 /* Extension bit */ /* RC Profile Operand (rc_profile) */ #define CEC_OP_FEAT_RC_TV_PROFILE_NONE 0x00 #define CEC_OP_FEAT_RC_TV_PROFILE_1 0x02 #define CEC_OP_FEAT_RC_TV_PROFILE_2 0x06 #define CEC_OP_FEAT_RC_TV_PROFILE_3 0x0a #define CEC_OP_FEAT_RC_TV_PROFILE_4 0x0e #define CEC_OP_FEAT_RC_SRC_HAS_DEV_ROOT_MENU 0x50 #define CEC_OP_FEAT_RC_SRC_HAS_DEV_SETUP_MENU 0x48 #define CEC_OP_FEAT_RC_SRC_HAS_CONTENTS_MENU 0x44 #define CEC_OP_FEAT_RC_SRC_HAS_MEDIA_TOP_MENU 0x42 #define CEC_OP_FEAT_RC_SRC_HAS_MEDIA_CONTEXT_MENU 0x41 /* Device Feature Operand (dev_features) */ #define CEC_OP_FEAT_DEV_HAS_RECORD_TV_SCREEN 0x40 #define CEC_OP_FEAT_DEV_HAS_SET_OSD_STRING 0x20 #define CEC_OP_FEAT_DEV_HAS_DECK_CONTROL 0x10 #define CEC_OP_FEAT_DEV_HAS_SET_AUDIO_RATE 0x08 #define CEC_OP_FEAT_DEV_SINK_HAS_ARC_TX 0x04 #define CEC_OP_FEAT_DEV_SOURCE_HAS_ARC_RX 0x02 #define CEC_MSG_GIVE_FEATURES 0xa5 /* HDMI 2.0 */ /* Deck Control Feature */ #define CEC_MSG_DECK_CONTROL 0x42 /* Deck Control Mode Operand (deck_control_mode) */ #define CEC_OP_DECK_CTL_MODE_SKIP_FWD 1 #define CEC_OP_DECK_CTL_MODE_SKIP_REV 2 #define CEC_OP_DECK_CTL_MODE_STOP 3 #define CEC_OP_DECK_CTL_MODE_EJECT 4 #define CEC_MSG_DECK_STATUS 0x1b /* Deck Info Operand (deck_info) */ #define CEC_OP_DECK_INFO_PLAY 0x11 #define CEC_OP_DECK_INFO_RECORD 0x12 #define CEC_OP_DECK_INFO_PLAY_REV 0x13 #define CEC_OP_DECK_INFO_STILL 0x14 #define CEC_OP_DECK_INFO_SLOW 0x15 #define CEC_OP_DECK_INFO_SLOW_REV 0x16 #define CEC_OP_DECK_INFO_FAST_FWD 0x17 #define CEC_OP_DECK_INFO_FAST_REV 0x18 #define CEC_OP_DECK_INFO_NO_MEDIA 0x19 #define CEC_OP_DECK_INFO_STOP 0x1a #define CEC_OP_DECK_INFO_SKIP_FWD 0x1b #define CEC_OP_DECK_INFO_SKIP_REV 0x1c #define CEC_OP_DECK_INFO_INDEX_SEARCH_FWD 0x1d #define CEC_OP_DECK_INFO_INDEX_SEARCH_REV 0x1e #define CEC_OP_DECK_INFO_OTHER 0x1f #define CEC_MSG_GIVE_DECK_STATUS 0x1a /* Status Request Operand (status_req) */ #define CEC_OP_STATUS_REQ_ON 1 #define CEC_OP_STATUS_REQ_OFF 2 #define CEC_OP_STATUS_REQ_ONCE 3 #define CEC_MSG_PLAY 0x41 /* Play Mode Operand (play_mode) */ #define CEC_OP_PLAY_MODE_PLAY_FWD 0x24 #define CEC_OP_PLAY_MODE_PLAY_REV 0x20 #define CEC_OP_PLAY_MODE_PLAY_STILL 0x25 #define CEC_OP_PLAY_MODE_PLAY_FAST_FWD_MIN 0x05 #define CEC_OP_PLAY_MODE_PLAY_FAST_FWD_MED 0x06 #define CEC_OP_PLAY_MODE_PLAY_FAST_FWD_MAX 0x07 #define CEC_OP_PLAY_MODE_PLAY_FAST_REV_MIN 0x09 #define CEC_OP_PLAY_MODE_PLAY_FAST_REV_MED 0x0a #define CEC_OP_PLAY_MODE_PLAY_FAST_REV_MAX 0x0b #define CEC_OP_PLAY_MODE_PLAY_SLOW_FWD_MIN 0x15 #define CEC_OP_PLAY_MODE_PLAY_SLOW_FWD_MED 0x16 #define CEC_OP_PLAY_MODE_PLAY_SLOW_FWD_MAX 0x17 #define CEC_OP_PLAY_MODE_PLAY_SLOW_REV_MIN 0x19 #define CEC_OP_PLAY_MODE_PLAY_SLOW_REV_MED 0x1a #define CEC_OP_PLAY_MODE_PLAY_SLOW_REV_MAX 0x1b /* Tuner Control Feature */ #define CEC_MSG_GIVE_TUNER_DEVICE_STATUS 0x08 #define CEC_MSG_SELECT_ANALOGUE_SERVICE 0x92 #define CEC_MSG_SELECT_DIGITAL_SERVICE 0x93 #define CEC_MSG_TUNER_DEVICE_STATUS 0x07 /* Recording Flag Operand (rec_flag) */ #define CEC_OP_REC_FLAG_NOT_USED 0 #define CEC_OP_REC_FLAG_USED 1 /* Tuner Display Info Operand (tuner_display_info) */ #define CEC_OP_TUNER_DISPLAY_INFO_DIGITAL 0 #define CEC_OP_TUNER_DISPLAY_INFO_NONE 1 #define CEC_OP_TUNER_DISPLAY_INFO_ANALOGUE 2 #define CEC_MSG_TUNER_STEP_DECREMENT 0x06 #define CEC_MSG_TUNER_STEP_INCREMENT 0x05 /* Vendor Specific Commands Feature */ /* * Has also: * CEC_MSG_CEC_VERSION * CEC_MSG_GET_CEC_VERSION */ #define CEC_MSG_DEVICE_VENDOR_ID 0x87 #define CEC_MSG_GIVE_DEVICE_VENDOR_ID 0x8c #define CEC_MSG_VENDOR_COMMAND 0x89 #define CEC_MSG_VENDOR_COMMAND_WITH_ID 0xa0 #define CEC_MSG_VENDOR_REMOTE_BUTTON_DOWN 0x8a #define CEC_MSG_VENDOR_REMOTE_BUTTON_UP 0x8b /* OSD Display Feature */ #define CEC_MSG_SET_OSD_STRING 0x64 /* Display Control Operand (disp_ctl) */ #define CEC_OP_DISP_CTL_DEFAULT 0x00 #define CEC_OP_DISP_CTL_UNTIL_CLEARED 0x40 #define CEC_OP_DISP_CTL_CLEAR 0x80 /* Device OSD Transfer Feature */ #define CEC_MSG_GIVE_OSD_NAME 0x46 #define CEC_MSG_SET_OSD_NAME 0x47 /* Device Menu Control Feature */ #define CEC_MSG_MENU_REQUEST 0x8d /* Menu Request Type Operand (menu_req) */ #define CEC_OP_MENU_REQUEST_ACTIVATE 0x00 #define CEC_OP_MENU_REQUEST_DEACTIVATE 0x01 #define CEC_OP_MENU_REQUEST_QUERY 0x02 #define CEC_MSG_MENU_STATUS 0x8e /* Menu State Operand (menu_state) */ #define CEC_OP_MENU_STATE_ACTIVATED 0x00 #define CEC_OP_MENU_STATE_DEACTIVATED 0x01 #define CEC_MSG_USER_CONTROL_PRESSED 0x44 /* UI Broadcast Type Operand (ui_bcast_type) */ #define CEC_OP_UI_BCAST_TYPE_TOGGLE_ALL 0x00 #define CEC_OP_UI_BCAST_TYPE_TOGGLE_DIG_ANA 0x01 #define CEC_OP_UI_BCAST_TYPE_ANALOGUE 0x10 #define CEC_OP_UI_BCAST_TYPE_ANALOGUE_T 0x20 #define CEC_OP_UI_BCAST_TYPE_ANALOGUE_CABLE 0x30 #define CEC_OP_UI_BCAST_TYPE_ANALOGUE_SAT 0x40 #define CEC_OP_UI_BCAST_TYPE_DIGITAL 0x50 #define CEC_OP_UI_BCAST_TYPE_DIGITAL_T 0x60 #define CEC_OP_UI_BCAST_TYPE_DIGITAL_CABLE 0x70 #define CEC_OP_UI_BCAST_TYPE_DIGITAL_SAT 0x80 #define CEC_OP_UI_BCAST_TYPE_DIGITAL_COM_SAT 0x90 #define CEC_OP_UI_BCAST_TYPE_DIGITAL_COM_SAT2 0x91 #define CEC_OP_UI_BCAST_TYPE_IP 0xa0 /* UI Sound Presentation Control Operand (ui_snd_pres_ctl) */ #define CEC_OP_UI_SND_PRES_CTL_DUAL_MONO 0x10 #define CEC_OP_UI_SND_PRES_CTL_KARAOKE 0x20 #define CEC_OP_UI_SND_PRES_CTL_DOWNMIX 0x80 #define CEC_OP_UI_SND_PRES_CTL_REVERB 0x90 #define CEC_OP_UI_SND_PRES_CTL_EQUALIZER 0xa0 #define CEC_OP_UI_SND_PRES_CTL_BASS_UP 0xb1 #define CEC_OP_UI_SND_PRES_CTL_BASS_NEUTRAL 0xb2 #define CEC_OP_UI_SND_PRES_CTL_BASS_DOWN 0xb3 #define CEC_OP_UI_SND_PRES_CTL_TREBLE_UP 0xc1 #define CEC_OP_UI_SND_PRES_CTL_TREBLE_NEUTRAL 0xc2 #define CEC_OP_UI_SND_PRES_CTL_TREBLE_DOWN 0xc3 #define CEC_MSG_USER_CONTROL_RELEASED 0x45 /* Remote Control Passthrough Feature */ /* * Has also: * CEC_MSG_USER_CONTROL_PRESSED * CEC_MSG_USER_CONTROL_RELEASED */ /* Power Status Feature */ #define CEC_MSG_GIVE_DEVICE_POWER_STATUS 0x8f #define CEC_MSG_REPORT_POWER_STATUS 0x90 /* Power Status Operand (pwr_state) */ #define CEC_OP_POWER_STATUS_ON 0 #define CEC_OP_POWER_STATUS_STANDBY 1 #define CEC_OP_POWER_STATUS_TO_ON 2 #define CEC_OP_POWER_STATUS_TO_STANDBY 3 /* General Protocol Messages */ #define CEC_MSG_FEATURE_ABORT 0x00 /* Abort Reason Operand (reason) */ #define CEC_OP_ABORT_UNRECOGNIZED_OP 0 #define CEC_OP_ABORT_INCORRECT_MODE 1 #define CEC_OP_ABORT_NO_SOURCE 2 #define CEC_OP_ABORT_INVALID_OP 3 #define CEC_OP_ABORT_REFUSED 4 #define CEC_OP_ABORT_UNDETERMINED 5 #define CEC_MSG_ABORT 0xff /* System Audio Control Feature */ /* * Has also: * CEC_MSG_USER_CONTROL_PRESSED * CEC_MSG_USER_CONTROL_RELEASED */ #define CEC_MSG_GIVE_AUDIO_STATUS 0x71 #define CEC_MSG_GIVE_SYSTEM_AUDIO_MODE_STATUS 0x7d #define CEC_MSG_REPORT_AUDIO_STATUS 0x7a /* Audio Mute Status Operand (aud_mute_status) */ #define CEC_OP_AUD_MUTE_STATUS_OFF 0 #define CEC_OP_AUD_MUTE_STATUS_ON 1 #define CEC_MSG_REPORT_SHORT_AUDIO_DESCRIPTOR 0xa3 #define CEC_MSG_REQUEST_SHORT_AUDIO_DESCRIPTOR 0xa4 #define CEC_MSG_SET_SYSTEM_AUDIO_MODE 0x72 /* System Audio Status Operand (sys_aud_status) */ #define CEC_OP_SYS_AUD_STATUS_OFF 0 #define CEC_OP_SYS_AUD_STATUS_ON 1 #define CEC_MSG_SYSTEM_AUDIO_MODE_REQUEST 0x70 #define CEC_MSG_SYSTEM_AUDIO_MODE_STATUS 0x7e /* Audio Format ID Operand (audio_format_id) */ #define CEC_OP_AUD_FMT_ID_CEA861 0 #define CEC_OP_AUD_FMT_ID_CEA861_CXT 1 /* Audio Rate Control Feature */ #define CEC_MSG_SET_AUDIO_RATE 0x9a /* Audio Rate Operand (audio_rate) */ #define CEC_OP_AUD_RATE_OFF 0 #define CEC_OP_AUD_RATE_WIDE_STD 1 #define CEC_OP_AUD_RATE_WIDE_FAST 2 #define CEC_OP_AUD_RATE_WIDE_SLOW 3 #define CEC_OP_AUD_RATE_NARROW_STD 4 #define CEC_OP_AUD_RATE_NARROW_FAST 5 #define CEC_OP_AUD_RATE_NARROW_SLOW 6 /* Audio Return Channel Control Feature */ #define CEC_MSG_INITIATE_ARC 0xc0 #define CEC_MSG_REPORT_ARC_INITIATED 0xc1 #define CEC_MSG_REPORT_ARC_TERMINATED 0xc2 #define CEC_MSG_REQUEST_ARC_INITIATION 0xc3 #define CEC_MSG_REQUEST_ARC_TERMINATION 0xc4 #define CEC_MSG_TERMINATE_ARC 0xc5 /* Dynamic Audio Lipsync Feature */ /* Only for CEC 2.0 and up */ #define CEC_MSG_REQUEST_CURRENT_LATENCY 0xa7 #define CEC_MSG_REPORT_CURRENT_LATENCY 0xa8 /* Low Latency Mode Operand (low_latency_mode) */ #define CEC_OP_LOW_LATENCY_MODE_OFF 0 #define CEC_OP_LOW_LATENCY_MODE_ON 1 /* Audio Output Compensated Operand (audio_out_compensated) */ #define CEC_OP_AUD_OUT_COMPENSATED_NA 0 #define CEC_OP_AUD_OUT_COMPENSATED_DELAY 1 #define CEC_OP_AUD_OUT_COMPENSATED_NO_DELAY 2 #define CEC_OP_AUD_OUT_COMPENSATED_PARTIAL_DELAY 3 /* Capability Discovery and Control Feature */ #define CEC_MSG_CDC_MESSAGE 0xf8 /* Ethernet-over-HDMI: nobody ever does this... */ #define CEC_MSG_CDC_HEC_INQUIRE_STATE 0x00 #define CEC_MSG_CDC_HEC_REPORT_STATE 0x01 /* HEC Functionality State Operand (hec_func_state) */ #define CEC_OP_HEC_FUNC_STATE_NOT_SUPPORTED 0 #define CEC_OP_HEC_FUNC_STATE_INACTIVE 1 #define CEC_OP_HEC_FUNC_STATE_ACTIVE 2 #define CEC_OP_HEC_FUNC_STATE_ACTIVATION_FIELD 3 /* Host Functionality State Operand (host_func_state) */ #define CEC_OP_HOST_FUNC_STATE_NOT_SUPPORTED 0 #define CEC_OP_HOST_FUNC_STATE_INACTIVE 1 #define CEC_OP_HOST_FUNC_STATE_ACTIVE 2 /* ENC Functionality State Operand (enc_func_state) */ #define CEC_OP_ENC_FUNC_STATE_EXT_CON_NOT_SUPPORTED 0 #define CEC_OP_ENC_FUNC_STATE_EXT_CON_INACTIVE 1 #define CEC_OP_ENC_FUNC_STATE_EXT_CON_ACTIVE 2 /* CDC Error Code Operand (cdc_errcode) */ #define CEC_OP_CDC_ERROR_CODE_NONE 0 #define CEC_OP_CDC_ERROR_CODE_CAP_UNSUPPORTED 1 #define CEC_OP_CDC_ERROR_CODE_WRONG_STATE 2 #define CEC_OP_CDC_ERROR_CODE_OTHER 3 /* HEC Support Operand (hec_support) */ #define CEC_OP_HEC_SUPPORT_NO 0 #define CEC_OP_HEC_SUPPORT_YES 1 /* HEC Activation Operand (hec_activation) */ #define CEC_OP_HEC_ACTIVATION_ON 0 #define CEC_OP_HEC_ACTIVATION_OFF 1 #define CEC_MSG_CDC_HEC_SET_STATE_ADJACENT 0x02 #define CEC_MSG_CDC_HEC_SET_STATE 0x03 /* HEC Set State Operand (hec_set_state) */ #define CEC_OP_HEC_SET_STATE_DEACTIVATE 0 #define CEC_OP_HEC_SET_STATE_ACTIVATE 1 #define CEC_MSG_CDC_HEC_REQUEST_DEACTIVATION 0x04 #define CEC_MSG_CDC_HEC_NOTIFY_ALIVE 0x05 #define CEC_MSG_CDC_HEC_DISCOVER 0x06 /* Hotplug Detect messages */ #define CEC_MSG_CDC_HPD_SET_STATE 0x10 /* HPD State Operand (hpd_state) */ #define CEC_OP_HPD_STATE_CP_EDID_DISABLE 0 #define CEC_OP_HPD_STATE_CP_EDID_ENABLE 1 #define CEC_OP_HPD_STATE_CP_EDID_DISABLE_ENABLE 2 #define CEC_OP_HPD_STATE_EDID_DISABLE 3 #define CEC_OP_HPD_STATE_EDID_ENABLE 4 #define CEC_OP_HPD_STATE_EDID_DISABLE_ENABLE 5 #define CEC_MSG_CDC_HPD_REPORT_STATE 0x11 /* HPD Error Code Operand (hpd_error) */ #define CEC_OP_HPD_ERROR_NONE 0 #define CEC_OP_HPD_ERROR_INITIATOR_NOT_CAPABLE 1 #define CEC_OP_HPD_ERROR_INITIATOR_WRONG_STATE 2 #define CEC_OP_HPD_ERROR_OTHER 3 #define CEC_OP_HPD_ERROR_NONE_NO_VIDEO 4 /* End of Messages */ /* Helper functions to identify the 'special' CEC devices */ static __inline__ int cec_is_2nd_tv(const struct cec_log_addrs *las) { /* * It is a second TV if the logical address is 14 or 15 and the * primary device type is a TV. */ return las->num_log_addrs && las->log_addr[0] >= CEC_LOG_ADDR_SPECIFIC && las->primary_device_type[0] == CEC_OP_PRIM_DEVTYPE_TV; } static __inline__ int cec_is_processor(const struct cec_log_addrs *las) { /* * It is a processor if the logical address is 12-15 and the * primary device type is a Processor. */ return las->num_log_addrs && las->log_addr[0] >= CEC_LOG_ADDR_BACKUP_1 && las->primary_device_type[0] == CEC_OP_PRIM_DEVTYPE_PROCESSOR; } static __inline__ int cec_is_switch(const struct cec_log_addrs *las) { /* * It is a switch if the logical address is 15 and the * primary device type is a Switch and the CDC-Only flag is not set. */ return las->num_log_addrs == 1 && las->log_addr[0] == CEC_LOG_ADDR_UNREGISTERED && las->primary_device_type[0] == CEC_OP_PRIM_DEVTYPE_SWITCH && !(las->flags & CEC_LOG_ADDRS_FL_CDC_ONLY); } static __inline__ int cec_is_cdc_only(const struct cec_log_addrs *las) { /* * It is a CDC-only device if the logical address is 15 and the * primary device type is a Switch and the CDC-Only flag is set. */ return las->num_log_addrs == 1 && las->log_addr[0] == CEC_LOG_ADDR_UNREGISTERED && las->primary_device_type[0] == CEC_OP_PRIM_DEVTYPE_SWITCH && (las->flags & CEC_LOG_ADDRS_FL_CDC_ONLY); } #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/sound.h���������������������������������������������������������������������������������������0000644�����������������00000002325�14763166027�0007222 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SOUND_H #define _LINUX_SOUND_H /* * Minor numbers for the sound driver. */ #include <linux/fs.h> #define SND_DEV_CTL 0 /* Control port /dev/mixer */ #define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM synthesizer and MIDI output) */ #define SND_DEV_MIDIN 2 /* Raw midi access */ #define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */ #define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */ #define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */ /* #define SND_DEV_STATUS 6 */ /* /dev/sndstat (obsolete) */ #define SND_DEV_UNUSED 6 #define SND_DEV_AWFM 7 /* Reserved */ #define SND_DEV_SEQ2 8 /* /dev/sequencer, level 2 interface */ /* #define SND_DEV_SNDPROC 9 */ /* /dev/sndproc for programmable devices (not used) */ /* #define SND_DEV_DMMIDI 9 */ #define SND_DEV_SYNTH 9 /* Raw synth access /dev/synth (same as /dev/dmfm) */ #define SND_DEV_DMFM 10 /* Raw synth access /dev/dmfm */ #define SND_DEV_UNKNOWN11 11 #define SND_DEV_ADSP 12 /* Like /dev/dsp (obsolete) */ #define SND_DEV_AMIDI 13 /* Like /dev/midi (obsolete) */ #define SND_DEV_ADMMIDI 14 /* Like /dev/dmmidi (onsolete) */ #endif /* _LINUX_SOUND_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/isdn_ppp.h������������������������������������������������������������������������������������0000644�����������������00000003603�14763166027�0007706 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* Linux ISDN subsystem, sync PPP, interface to ipppd * * Copyright 1994-1999 by Fritz Elfert (fritz@isdn4linux.de) * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg * Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de) * Copyright 2000-2002 by Kai Germaschewski (kai@germaschewski.name) * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * */ #ifndef _LINUX_ISDN_PPP_H #define _LINUX_ISDN_PPP_H #define CALLTYPE_INCOMING 0x1 #define CALLTYPE_OUTGOING 0x2 #define CALLTYPE_CALLBACK 0x4 #define IPPP_VERSION "2.2.0" struct pppcallinfo { int calltype; unsigned char local_num[64]; unsigned char remote_num[64]; int charge_units; }; #define PPPIOCGCALLINFO _IOWR('t',128,struct pppcallinfo) #define PPPIOCBUNDLE _IOW('t',129,int) #define PPPIOCGMPFLAGS _IOR('t',130,int) #define PPPIOCSMPFLAGS _IOW('t',131,int) #define PPPIOCSMPMTU _IOW('t',132,int) #define PPPIOCSMPMRU _IOW('t',133,int) #define PPPIOCGCOMPRESSORS _IOR('t',134,unsigned long [8]) #define PPPIOCSCOMPRESSOR _IOW('t',135,int) #define PPPIOCGIFNAME _IOR('t',136, char [IFNAMSIZ] ) #define SC_MP_PROT 0x00000200 #define SC_REJ_MP_PROT 0x00000400 #define SC_OUT_SHORT_SEQ 0x00000800 #define SC_IN_SHORT_SEQ 0x00004000 #define SC_DECOMP_ON 0x01 #define SC_COMP_ON 0x02 #define SC_DECOMP_DISCARD 0x04 #define SC_COMP_DISCARD 0x08 #define SC_LINK_DECOMP_ON 0x10 #define SC_LINK_COMP_ON 0x20 #define SC_LINK_DECOMP_DISCARD 0x40 #define SC_LINK_COMP_DISCARD 0x80 #define ISDN_PPP_COMP_MAX_OPTIONS 16 #define IPPP_COMP_FLAG_XMIT 0x1 #define IPPP_COMP_FLAG_LINK 0x2 struct isdn_ppp_comp_data { int num; unsigned char options[ISDN_PPP_COMP_MAX_OPTIONS]; int optlen; int flags; }; #endif /* _LINUX_ISDN_PPP_H */ �����������������������������������������������������������������������������������������������������������������������������linux/mii.h�����������������������������������������������������������������������������������������0000644�����������������00000017721�14763166027�0006656 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/mii.h: definitions for MII-compatible transceivers * Originally drivers/net/sunhme.h. * * Copyright (C) 1996, 1999, 2001 David S. Miller (davem@redhat.com) */ #ifndef __LINUX_MII_H__ #define __LINUX_MII_H__ #include <linux/types.h> #include <linux/ethtool.h> /* Generic MII registers. */ #define MII_BMCR 0x00 /* Basic mode control register */ #define MII_BMSR 0x01 /* Basic mode status register */ #define MII_PHYSID1 0x02 /* PHYS ID 1 */ #define MII_PHYSID2 0x03 /* PHYS ID 2 */ #define MII_ADVERTISE 0x04 /* Advertisement control reg */ #define MII_LPA 0x05 /* Link partner ability reg */ #define MII_EXPANSION 0x06 /* Expansion register */ #define MII_CTRL1000 0x09 /* 1000BASE-T control */ #define MII_STAT1000 0x0a /* 1000BASE-T status */ #define MII_MMD_CTRL 0x0d /* MMD Access Control Register */ #define MII_MMD_DATA 0x0e /* MMD Access Data Register */ #define MII_ESTATUS 0x0f /* Extended Status */ #define MII_DCOUNTER 0x12 /* Disconnect counter */ #define MII_FCSCOUNTER 0x13 /* False carrier counter */ #define MII_NWAYTEST 0x14 /* N-way auto-neg test reg */ #define MII_RERRCOUNTER 0x15 /* Receive error counter */ #define MII_SREVISION 0x16 /* Silicon revision */ #define MII_RESV1 0x17 /* Reserved... */ #define MII_LBRERROR 0x18 /* Lpback, rx, bypass error */ #define MII_PHYADDR 0x19 /* PHY address */ #define MII_RESV2 0x1a /* Reserved... */ #define MII_TPISTATUS 0x1b /* TPI status for 10mbps */ #define MII_NCONFIG 0x1c /* Network interface config */ /* Basic mode control register. */ #define BMCR_RESV 0x003f /* Unused... */ #define BMCR_SPEED1000 0x0040 /* MSB of Speed (1000) */ #define BMCR_CTST 0x0080 /* Collision test */ #define BMCR_FULLDPLX 0x0100 /* Full duplex */ #define BMCR_ANRESTART 0x0200 /* Auto negotiation restart */ #define BMCR_ISOLATE 0x0400 /* Isolate data paths from MII */ #define BMCR_PDOWN 0x0800 /* Enable low power state */ #define BMCR_ANENABLE 0x1000 /* Enable auto negotiation */ #define BMCR_SPEED100 0x2000 /* Select 100Mbps */ #define BMCR_LOOPBACK 0x4000 /* TXD loopback bits */ #define BMCR_RESET 0x8000 /* Reset to default state */ #define BMCR_SPEED10 0x0000 /* Select 10Mbps */ /* Basic mode status register. */ #define BMSR_ERCAP 0x0001 /* Ext-reg capability */ #define BMSR_JCD 0x0002 /* Jabber detected */ #define BMSR_LSTATUS 0x0004 /* Link status */ #define BMSR_ANEGCAPABLE 0x0008 /* Able to do auto-negotiation */ #define BMSR_RFAULT 0x0010 /* Remote fault detected */ #define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */ #define BMSR_RESV 0x00c0 /* Unused... */ #define BMSR_ESTATEN 0x0100 /* Extended Status in R15 */ #define BMSR_100HALF2 0x0200 /* Can do 100BASE-T2 HDX */ #define BMSR_100FULL2 0x0400 /* Can do 100BASE-T2 FDX */ #define BMSR_10HALF 0x0800 /* Can do 10mbps, half-duplex */ #define BMSR_10FULL 0x1000 /* Can do 10mbps, full-duplex */ #define BMSR_100HALF 0x2000 /* Can do 100mbps, half-duplex */ #define BMSR_100FULL 0x4000 /* Can do 100mbps, full-duplex */ #define BMSR_100BASE4 0x8000 /* Can do 100mbps, 4k packets */ /* Advertisement control register. */ #define ADVERTISE_SLCT 0x001f /* Selector bits */ #define ADVERTISE_CSMA 0x0001 /* Only selector supported */ #define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */ #define ADVERTISE_1000XFULL 0x0020 /* Try for 1000BASE-X full-duplex */ #define ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */ #define ADVERTISE_1000XHALF 0x0040 /* Try for 1000BASE-X half-duplex */ #define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */ #define ADVERTISE_1000XPAUSE 0x0080 /* Try for 1000BASE-X pause */ #define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */ #define ADVERTISE_1000XPSE_ASYM 0x0100 /* Try for 1000BASE-X asym pause */ #define ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */ #define ADVERTISE_PAUSE_CAP 0x0400 /* Try for pause */ #define ADVERTISE_PAUSE_ASYM 0x0800 /* Try for asymetric pause */ #define ADVERTISE_RESV 0x1000 /* Unused... */ #define ADVERTISE_RFAULT 0x2000 /* Say we can detect faults */ #define ADVERTISE_LPACK 0x4000 /* Ack link partners response */ #define ADVERTISE_NPAGE 0x8000 /* Next page bit */ #define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \ ADVERTISE_CSMA) #define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \ ADVERTISE_100HALF | ADVERTISE_100FULL) /* Link partner ability register. */ #define LPA_SLCT 0x001f /* Same as advertise selector */ #define LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */ #define LPA_1000XFULL 0x0020 /* Can do 1000BASE-X full-duplex */ #define LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */ #define LPA_1000XHALF 0x0040 /* Can do 1000BASE-X half-duplex */ #define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */ #define LPA_1000XPAUSE 0x0080 /* Can do 1000BASE-X pause */ #define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */ #define LPA_1000XPAUSE_ASYM 0x0100 /* Can do 1000BASE-X pause asym*/ #define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */ #define LPA_PAUSE_CAP 0x0400 /* Can pause */ #define LPA_PAUSE_ASYM 0x0800 /* Can pause asymetrically */ #define LPA_RESV 0x1000 /* Unused... */ #define LPA_RFAULT 0x2000 /* Link partner faulted */ #define LPA_LPACK 0x4000 /* Link partner acked us */ #define LPA_NPAGE 0x8000 /* Next page bit */ #define LPA_DUPLEX (LPA_10FULL | LPA_100FULL) #define LPA_100 (LPA_100FULL | LPA_100HALF | LPA_100BASE4) /* Expansion register for auto-negotiation. */ #define EXPANSION_NWAY 0x0001 /* Can do N-way auto-nego */ #define EXPANSION_LCWP 0x0002 /* Got new RX page code word */ #define EXPANSION_ENABLENPAGE 0x0004 /* This enables npage words */ #define EXPANSION_NPCAPABLE 0x0008 /* Link partner supports npage */ #define EXPANSION_MFAULTS 0x0010 /* Multiple faults detected */ #define EXPANSION_RESV 0xffe0 /* Unused... */ #define ESTATUS_1000_TFULL 0x2000 /* Can do 1000BT Full */ #define ESTATUS_1000_THALF 0x1000 /* Can do 1000BT Half */ /* N-way test register. */ #define NWAYTEST_RESV1 0x00ff /* Unused... */ #define NWAYTEST_LOOPBACK 0x0100 /* Enable loopback for N-way */ #define NWAYTEST_RESV2 0xfe00 /* Unused... */ /* 1000BASE-T Control register */ #define ADVERTISE_1000FULL 0x0200 /* Advertise 1000BASE-T full duplex */ #define ADVERTISE_1000HALF 0x0100 /* Advertise 1000BASE-T half duplex */ #define CTL1000_AS_MASTER 0x0800 #define CTL1000_ENABLE_MASTER 0x1000 /* 1000BASE-T Status register */ #define LPA_1000MSFAIL 0x8000 /* Master/Slave resolution failure */ #define LPA_1000LOCALRXOK 0x2000 /* Link partner local receiver status */ #define LPA_1000REMRXOK 0x1000 /* Link partner remote receiver status */ #define LPA_1000FULL 0x0800 /* Link partner 1000BASE-T full duplex */ #define LPA_1000HALF 0x0400 /* Link partner 1000BASE-T half duplex */ /* Flow control flags */ #define FLOW_CTRL_TX 0x01 #define FLOW_CTRL_RX 0x02 /* MMD Access Control register fields */ #define MII_MMD_CTRL_DEVAD_MASK 0x1f /* Mask MMD DEVAD*/ #define MII_MMD_CTRL_ADDR 0x0000 /* Address */ #define MII_MMD_CTRL_NOINCR 0x4000 /* no post increment */ #define MII_MMD_CTRL_INCR_RDWT 0x8000 /* post increment on reads & writes */ #define MII_MMD_CTRL_INCR_ON_WT 0xC000 /* post increment on writes only */ /* This structure is used in all SIOCxMIIxxx ioctl calls */ struct mii_ioctl_data { __u16 phy_id; __u16 reg_num; __u16 val_in; __u16 val_out; }; #endif /* __LINUX_MII_H__ */ �����������������������������������������������linux/serial_reg.h����������������������������������������������������������������������������������0000644�����������������00000036300�14763166027�0010206 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* * include/linux/serial_reg.h * * Copyright (C) 1992, 1994 by Theodore Ts'o. * * Redistribution of this file is permitted under the terms of the GNU * Public License (GPL) * * These are the UART port assignments, expressed as offsets from the base * register. These assignments should hold for any serial port based on * a 8250, 16450, or 16550(A). */ #ifndef _LINUX_SERIAL_REG_H #define _LINUX_SERIAL_REG_H /* * DLAB=0 */ #define UART_RX 0 /* In: Receive buffer */ #define UART_TX 0 /* Out: Transmit buffer */ #define UART_IER 1 /* Out: Interrupt Enable Register */ #define UART_IER_MSI 0x08 /* Enable Modem status interrupt */ #define UART_IER_RLSI 0x04 /* Enable receiver line status interrupt */ #define UART_IER_THRI 0x02 /* Enable Transmitter holding register int. */ #define UART_IER_RDI 0x01 /* Enable receiver data interrupt */ /* * Sleep mode for ST16650 and TI16750. For the ST16650, EFR[4]=1 */ #define UART_IERX_SLEEP 0x10 /* Enable sleep mode */ #define UART_IIR 2 /* In: Interrupt ID Register */ #define UART_IIR_NO_INT 0x01 /* No interrupts pending */ #define UART_IIR_ID 0x0e /* Mask for the interrupt ID */ #define UART_IIR_MSI 0x00 /* Modem status interrupt */ #define UART_IIR_THRI 0x02 /* Transmitter holding register empty */ #define UART_IIR_RDI 0x04 /* Receiver data interrupt */ #define UART_IIR_RLSI 0x06 /* Receiver line status interrupt */ #define UART_IIR_BUSY 0x07 /* DesignWare APB Busy Detect */ #define UART_IIR_RX_TIMEOUT 0x0c /* OMAP RX Timeout interrupt */ #define UART_IIR_XOFF 0x10 /* OMAP XOFF/Special Character */ #define UART_IIR_CTS_RTS_DSR 0x20 /* OMAP CTS/RTS/DSR Change */ #define UART_FCR 2 /* Out: FIFO Control Register */ #define UART_FCR_ENABLE_FIFO 0x01 /* Enable the FIFO */ #define UART_FCR_CLEAR_RCVR 0x02 /* Clear the RCVR FIFO */ #define UART_FCR_CLEAR_XMIT 0x04 /* Clear the XMIT FIFO */ #define UART_FCR_DMA_SELECT 0x08 /* For DMA applications */ /* * Note: The FIFO trigger levels are chip specific: * RX:76 = 00 01 10 11 TX:54 = 00 01 10 11 * PC16550D: 1 4 8 14 xx xx xx xx * TI16C550A: 1 4 8 14 xx xx xx xx * TI16C550C: 1 4 8 14 xx xx xx xx * ST16C550: 1 4 8 14 xx xx xx xx * ST16C650: 8 16 24 28 16 8 24 30 PORT_16650V2 * NS16C552: 1 4 8 14 xx xx xx xx * ST16C654: 8 16 56 60 8 16 32 56 PORT_16654 * TI16C750: 1 16 32 56 xx xx xx xx PORT_16750 * TI16C752: 8 16 56 60 8 16 32 56 * OX16C950: 16 32 112 120 16 32 64 112 PORT_16C950 * Tegra: 1 4 8 14 16 8 4 1 PORT_TEGRA */ #define UART_FCR_R_TRIG_00 0x00 #define UART_FCR_R_TRIG_01 0x40 #define UART_FCR_R_TRIG_10 0x80 #define UART_FCR_R_TRIG_11 0xc0 #define UART_FCR_T_TRIG_00 0x00 #define UART_FCR_T_TRIG_01 0x10 #define UART_FCR_T_TRIG_10 0x20 #define UART_FCR_T_TRIG_11 0x30 #define UART_FCR_TRIGGER_MASK 0xC0 /* Mask for the FIFO trigger range */ #define UART_FCR_TRIGGER_1 0x00 /* Mask for trigger set at 1 */ #define UART_FCR_TRIGGER_4 0x40 /* Mask for trigger set at 4 */ #define UART_FCR_TRIGGER_8 0x80 /* Mask for trigger set at 8 */ #define UART_FCR_TRIGGER_14 0xC0 /* Mask for trigger set at 14 */ /* 16650 definitions */ #define UART_FCR6_R_TRIGGER_8 0x00 /* Mask for receive trigger set at 1 */ #define UART_FCR6_R_TRIGGER_16 0x40 /* Mask for receive trigger set at 4 */ #define UART_FCR6_R_TRIGGER_24 0x80 /* Mask for receive trigger set at 8 */ #define UART_FCR6_R_TRIGGER_28 0xC0 /* Mask for receive trigger set at 14 */ #define UART_FCR6_T_TRIGGER_16 0x00 /* Mask for transmit trigger set at 16 */ #define UART_FCR6_T_TRIGGER_8 0x10 /* Mask for transmit trigger set at 8 */ #define UART_FCR6_T_TRIGGER_24 0x20 /* Mask for transmit trigger set at 24 */ #define UART_FCR6_T_TRIGGER_30 0x30 /* Mask for transmit trigger set at 30 */ #define UART_FCR7_64BYTE 0x20 /* Go into 64 byte mode (TI16C750 and some Freescale UARTs) */ #define UART_FCR_R_TRIG_SHIFT 6 #define UART_FCR_R_TRIG_BITS(x) \ (((x) & UART_FCR_TRIGGER_MASK) >> UART_FCR_R_TRIG_SHIFT) #define UART_FCR_R_TRIG_MAX_STATE 4 #define UART_LCR 3 /* Out: Line Control Register */ /* * Note: if the word length is 5 bits (UART_LCR_WLEN5), then setting * UART_LCR_STOP will select 1.5 stop bits, not 2 stop bits. */ #define UART_LCR_DLAB 0x80 /* Divisor latch access bit */ #define UART_LCR_SBC 0x40 /* Set break control */ #define UART_LCR_SPAR 0x20 /* Stick parity (?) */ #define UART_LCR_EPAR 0x10 /* Even parity select */ #define UART_LCR_PARITY 0x08 /* Parity Enable */ #define UART_LCR_STOP 0x04 /* Stop bits: 0=1 bit, 1=2 bits */ #define UART_LCR_WLEN5 0x00 /* Wordlength: 5 bits */ #define UART_LCR_WLEN6 0x01 /* Wordlength: 6 bits */ #define UART_LCR_WLEN7 0x02 /* Wordlength: 7 bits */ #define UART_LCR_WLEN8 0x03 /* Wordlength: 8 bits */ /* * Access to some registers depends on register access / configuration * mode. */ #define UART_LCR_CONF_MODE_A UART_LCR_DLAB /* Configutation mode A */ #define UART_LCR_CONF_MODE_B 0xBF /* Configutation mode B */ #define UART_MCR 4 /* Out: Modem Control Register */ #define UART_MCR_CLKSEL 0x80 /* Divide clock by 4 (TI16C752, EFR[4]=1) */ #define UART_MCR_TCRTLR 0x40 /* Access TCR/TLR (TI16C752, EFR[4]=1) */ #define UART_MCR_XONANY 0x20 /* Enable Xon Any (TI16C752, EFR[4]=1) */ #define UART_MCR_AFE 0x20 /* Enable auto-RTS/CTS (TI16C550C/TI16C750) */ #define UART_MCR_LOOP 0x10 /* Enable loopback test mode */ #define UART_MCR_OUT2 0x08 /* Out2 complement */ #define UART_MCR_OUT1 0x04 /* Out1 complement */ #define UART_MCR_RTS 0x02 /* RTS complement */ #define UART_MCR_DTR 0x01 /* DTR complement */ #define UART_LSR 5 /* In: Line Status Register */ #define UART_LSR_FIFOE 0x80 /* Fifo error */ #define UART_LSR_TEMT 0x40 /* Transmitter empty */ #define UART_LSR_THRE 0x20 /* Transmit-hold-register empty */ #define UART_LSR_BI 0x10 /* Break interrupt indicator */ #define UART_LSR_FE 0x08 /* Frame error indicator */ #define UART_LSR_PE 0x04 /* Parity error indicator */ #define UART_LSR_OE 0x02 /* Overrun error indicator */ #define UART_LSR_DR 0x01 /* Receiver data ready */ #define UART_LSR_BRK_ERROR_BITS 0x1E /* BI, FE, PE, OE bits */ #define UART_MSR 6 /* In: Modem Status Register */ #define UART_MSR_DCD 0x80 /* Data Carrier Detect */ #define UART_MSR_RI 0x40 /* Ring Indicator */ #define UART_MSR_DSR 0x20 /* Data Set Ready */ #define UART_MSR_CTS 0x10 /* Clear to Send */ #define UART_MSR_DDCD 0x08 /* Delta DCD */ #define UART_MSR_TERI 0x04 /* Trailing edge ring indicator */ #define UART_MSR_DDSR 0x02 /* Delta DSR */ #define UART_MSR_DCTS 0x01 /* Delta CTS */ #define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */ #define UART_SCR 7 /* I/O: Scratch Register */ /* * DLAB=1 */ #define UART_DLL 0 /* Out: Divisor Latch Low */ #define UART_DLM 1 /* Out: Divisor Latch High */ #define UART_DIV_MAX 0xFFFF /* Max divisor value */ /* * LCR=0xBF (or DLAB=1 for 16C660) */ #define UART_EFR 2 /* I/O: Extended Features Register */ #define UART_XR_EFR 9 /* I/O: Extended Features Register (XR17D15x) */ #define UART_EFR_CTS 0x80 /* CTS flow control */ #define UART_EFR_RTS 0x40 /* RTS flow control */ #define UART_EFR_SCD 0x20 /* Special character detect */ #define UART_EFR_ECB 0x10 /* Enhanced control bit */ /* * the low four bits control software flow control */ /* * LCR=0xBF, TI16C752, ST16650, ST16650A, ST16654 */ #define UART_XON1 4 /* I/O: Xon character 1 */ #define UART_XON2 5 /* I/O: Xon character 2 */ #define UART_XOFF1 6 /* I/O: Xoff character 1 */ #define UART_XOFF2 7 /* I/O: Xoff character 2 */ /* * EFR[4]=1 MCR[6]=1, TI16C752 */ #define UART_TI752_TCR 6 /* I/O: transmission control register */ #define UART_TI752_TLR 7 /* I/O: trigger level register */ /* * LCR=0xBF, XR16C85x */ #define UART_TRG 0 /* FCTR bit 7 selects Rx or Tx * In: Fifo count * Out: Fifo custom trigger levels */ /* * These are the definitions for the Programmable Trigger Register */ #define UART_TRG_1 0x01 #define UART_TRG_4 0x04 #define UART_TRG_8 0x08 #define UART_TRG_16 0x10 #define UART_TRG_32 0x20 #define UART_TRG_64 0x40 #define UART_TRG_96 0x60 #define UART_TRG_120 0x78 #define UART_TRG_128 0x80 #define UART_FCTR 1 /* Feature Control Register */ #define UART_FCTR_RTS_NODELAY 0x00 /* RTS flow control delay */ #define UART_FCTR_RTS_4DELAY 0x01 #define UART_FCTR_RTS_6DELAY 0x02 #define UART_FCTR_RTS_8DELAY 0x03 #define UART_FCTR_IRDA 0x04 /* IrDa data encode select */ #define UART_FCTR_TX_INT 0x08 /* Tx interrupt type select */ #define UART_FCTR_TRGA 0x00 /* Tx/Rx 550 trigger table select */ #define UART_FCTR_TRGB 0x10 /* Tx/Rx 650 trigger table select */ #define UART_FCTR_TRGC 0x20 /* Tx/Rx 654 trigger table select */ #define UART_FCTR_TRGD 0x30 /* Tx/Rx 850 programmable trigger select */ #define UART_FCTR_SCR_SWAP 0x40 /* Scratch pad register swap */ #define UART_FCTR_RX 0x00 /* Programmable trigger mode select */ #define UART_FCTR_TX 0x80 /* Programmable trigger mode select */ /* * LCR=0xBF, FCTR[6]=1 */ #define UART_EMSR 7 /* Extended Mode Select Register */ #define UART_EMSR_FIFO_COUNT 0x01 /* Rx/Tx select */ #define UART_EMSR_ALT_COUNT 0x02 /* Alternating count select */ /* * The Intel XScale on-chip UARTs define these bits */ #define UART_IER_DMAE 0x80 /* DMA Requests Enable */ #define UART_IER_UUE 0x40 /* UART Unit Enable */ #define UART_IER_NRZE 0x20 /* NRZ coding Enable */ #define UART_IER_RTOIE 0x10 /* Receiver Time Out Interrupt Enable */ #define UART_IIR_TOD 0x08 /* Character Timeout Indication Detected */ #define UART_FCR_PXAR1 0x00 /* receive FIFO threshold = 1 */ #define UART_FCR_PXAR8 0x40 /* receive FIFO threshold = 8 */ #define UART_FCR_PXAR16 0x80 /* receive FIFO threshold = 16 */ #define UART_FCR_PXAR32 0xc0 /* receive FIFO threshold = 32 */ /* * These register definitions are for the 16C950 */ #define UART_ASR 0x01 /* Additional Status Register */ #define UART_RFL 0x03 /* Receiver FIFO level */ #define UART_TFL 0x04 /* Transmitter FIFO level */ #define UART_ICR 0x05 /* Index Control Register */ /* The 16950 ICR registers */ #define UART_ACR 0x00 /* Additional Control Register */ #define UART_CPR 0x01 /* Clock Prescalar Register */ #define UART_TCR 0x02 /* Times Clock Register */ #define UART_CKS 0x03 /* Clock Select Register */ #define UART_TTL 0x04 /* Transmitter Interrupt Trigger Level */ #define UART_RTL 0x05 /* Receiver Interrupt Trigger Level */ #define UART_FCL 0x06 /* Flow Control Level Lower */ #define UART_FCH 0x07 /* Flow Control Level Higher */ #define UART_ID1 0x08 /* ID #1 */ #define UART_ID2 0x09 /* ID #2 */ #define UART_ID3 0x0A /* ID #3 */ #define UART_REV 0x0B /* Revision */ #define UART_CSR 0x0C /* Channel Software Reset */ #define UART_NMR 0x0D /* Nine-bit Mode Register */ #define UART_CTR 0xFF /* * The 16C950 Additional Control Register */ #define UART_ACR_RXDIS 0x01 /* Receiver disable */ #define UART_ACR_TXDIS 0x02 /* Transmitter disable */ #define UART_ACR_DSRFC 0x04 /* DSR Flow Control */ #define UART_ACR_TLENB 0x20 /* 950 trigger levels enable */ #define UART_ACR_ICRRD 0x40 /* ICR Read enable */ #define UART_ACR_ASREN 0x80 /* Additional status enable */ /* * These definitions are for the RSA-DV II/S card, from * * Kiyokazu SUTO <suto@ks-and-ks.ne.jp> */ #define UART_RSA_BASE (-8) #define UART_RSA_MSR ((UART_RSA_BASE) + 0) /* I/O: Mode Select Register */ #define UART_RSA_MSR_SWAP (1 << 0) /* Swap low/high 8 bytes in I/O port addr */ #define UART_RSA_MSR_FIFO (1 << 2) /* Enable the external FIFO */ #define UART_RSA_MSR_FLOW (1 << 3) /* Enable the auto RTS/CTS flow control */ #define UART_RSA_MSR_ITYP (1 << 4) /* Level (1) / Edge triger (0) */ #define UART_RSA_IER ((UART_RSA_BASE) + 1) /* I/O: Interrupt Enable Register */ #define UART_RSA_IER_Rx_FIFO_H (1 << 0) /* Enable Rx FIFO half full int. */ #define UART_RSA_IER_Tx_FIFO_H (1 << 1) /* Enable Tx FIFO half full int. */ #define UART_RSA_IER_Tx_FIFO_E (1 << 2) /* Enable Tx FIFO empty int. */ #define UART_RSA_IER_Rx_TOUT (1 << 3) /* Enable char receive timeout int */ #define UART_RSA_IER_TIMER (1 << 4) /* Enable timer interrupt */ #define UART_RSA_SRR ((UART_RSA_BASE) + 2) /* IN: Status Read Register */ #define UART_RSA_SRR_Tx_FIFO_NEMP (1 << 0) /* Tx FIFO is not empty (1) */ #define UART_RSA_SRR_Tx_FIFO_NHFL (1 << 1) /* Tx FIFO is not half full (1) */ #define UART_RSA_SRR_Tx_FIFO_NFUL (1 << 2) /* Tx FIFO is not full (1) */ #define UART_RSA_SRR_Rx_FIFO_NEMP (1 << 3) /* Rx FIFO is not empty (1) */ #define UART_RSA_SRR_Rx_FIFO_NHFL (1 << 4) /* Rx FIFO is not half full (1) */ #define UART_RSA_SRR_Rx_FIFO_NFUL (1 << 5) /* Rx FIFO is not full (1) */ #define UART_RSA_SRR_Rx_TOUT (1 << 6) /* Character reception timeout occurred (1) */ #define UART_RSA_SRR_TIMER (1 << 7) /* Timer interrupt occurred */ #define UART_RSA_FRR ((UART_RSA_BASE) + 2) /* OUT: FIFO Reset Register */ #define UART_RSA_TIVSR ((UART_RSA_BASE) + 3) /* I/O: Timer Interval Value Set Register */ #define UART_RSA_TCR ((UART_RSA_BASE) + 4) /* OUT: Timer Control Register */ #define UART_RSA_TCR_SWITCH (1 << 0) /* Timer on */ /* * The RSA DSV/II board has two fixed clock frequencies. One is the * standard rate, and the other is 8 times faster. */ #define SERIAL_RSA_BAUD_BASE (921600) #define SERIAL_RSA_BAUD_BASE_LO (SERIAL_RSA_BAUD_BASE / 8) /* Extra registers for TI DA8xx/66AK2x */ #define UART_DA830_PWREMU_MGMT 12 /* PWREMU_MGMT register bits */ #define UART_DA830_PWREMU_MGMT_FREE (1 << 0) /* Free-running mode */ #define UART_DA830_PWREMU_MGMT_URRST (1 << 13) /* Receiver reset/enable */ #define UART_DA830_PWREMU_MGMT_UTRST (1 << 14) /* Transmitter reset/enable */ /* * Extra serial register definitions for the internal UARTs * in TI OMAP processors. */ #define OMAP1_UART1_BASE 0xfffb0000 #define OMAP1_UART2_BASE 0xfffb0800 #define OMAP1_UART3_BASE 0xfffb9800 #define UART_OMAP_MDR1 0x08 /* Mode definition register */ #define UART_OMAP_MDR2 0x09 /* Mode definition register 2 */ #define UART_OMAP_SCR 0x10 /* Supplementary control register */ #define UART_OMAP_SSR 0x11 /* Supplementary status register */ #define UART_OMAP_EBLR 0x12 /* BOF length register */ #define UART_OMAP_OSC_12M_SEL 0x13 /* OMAP1510 12MHz osc select */ #define UART_OMAP_MVER 0x14 /* Module version register */ #define UART_OMAP_SYSC 0x15 /* System configuration register */ #define UART_OMAP_SYSS 0x16 /* System status register */ #define UART_OMAP_WER 0x17 /* Wake-up enable register */ #define UART_OMAP_TX_LVL 0x1a /* TX FIFO level register */ /* * These are the definitions for the MDR1 register */ #define UART_OMAP_MDR1_16X_MODE 0x00 /* UART 16x mode */ #define UART_OMAP_MDR1_SIR_MODE 0x01 /* SIR mode */ #define UART_OMAP_MDR1_16X_ABAUD_MODE 0x02 /* UART 16x auto-baud */ #define UART_OMAP_MDR1_13X_MODE 0x03 /* UART 13x mode */ #define UART_OMAP_MDR1_MIR_MODE 0x04 /* MIR mode */ #define UART_OMAP_MDR1_FIR_MODE 0x05 /* FIR mode */ #define UART_OMAP_MDR1_CIR_MODE 0x06 /* CIR mode */ #define UART_OMAP_MDR1_DISABLE 0x07 /* Disable (default state) */ /* * These are definitions for the Altera ALTR_16550_F32/F64/F128 * Normalized from 0x100 to 0x40 because of shift by 2 (32 bit regs). */ #define UART_ALTR_AFR 0x40 /* Additional Features Register */ #define UART_ALTR_EN_TXFIFO_LW 0x01 /* Enable the TX FIFO Low Watermark */ #define UART_ALTR_TX_LOW 0x41 /* Tx FIFO Low Watermark */ #endif /* _LINUX_SERIAL_REG_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_bridge.h����������������������������������������������������������������������������0000644�����������������00000002220�14763166027�0011374 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_NETFILTER_H #define __LINUX_BRIDGE_NETFILTER_H /* bridge-specific defines for netfilter. */ #include <linux/in.h> #include <linux/netfilter.h> #include <linux/if_ether.h> #include <linux/if_vlan.h> #include <linux/if_pppox.h> #include <limits.h> /* for INT_MIN, INT_MAX */ /* Bridge Hooks */ /* After promisc drops, checksum checks. */ #define NF_BR_PRE_ROUTING 0 /* If the packet is destined for this box. */ #define NF_BR_LOCAL_IN 1 /* If the packet is destined for another interface. */ #define NF_BR_FORWARD 2 /* Packets coming from a local process. */ #define NF_BR_LOCAL_OUT 3 /* Packets about to hit the wire. */ #define NF_BR_POST_ROUTING 4 /* Not really a hook, but used for the ebtables broute table */ #define NF_BR_BROUTING 5 #define NF_BR_NUMHOOKS 6 enum nf_br_hook_priorities { NF_BR_PRI_FIRST = INT_MIN, NF_BR_PRI_NAT_DST_BRIDGED = -300, NF_BR_PRI_FILTER_BRIDGED = -200, NF_BR_PRI_BRNF = 0, NF_BR_PRI_NAT_DST_OTHER = 100, NF_BR_PRI_FILTER_OTHER = 200, NF_BR_PRI_NAT_SRC = 300, NF_BR_PRI_LAST = INT_MAX, }; #endif /* __LINUX_BRIDGE_NETFILTER_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/tcp_metrics.h���������������������������������������������������������������������������������0000644�����������������00000003015�14763166027�0010403 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* tcp_metrics.h - TCP Metrics Interface */ #ifndef _LINUX_TCP_METRICS_H #define _LINUX_TCP_METRICS_H #include <linux/types.h> /* NETLINK_GENERIC related info */ #define TCP_METRICS_GENL_NAME "tcp_metrics" #define TCP_METRICS_GENL_VERSION 0x1 enum tcp_metric_index { TCP_METRIC_RTT, /* in ms units */ TCP_METRIC_RTTVAR, /* in ms units */ TCP_METRIC_SSTHRESH, TCP_METRIC_CWND, TCP_METRIC_REORDERING, TCP_METRIC_RTT_US, /* in usec units */ TCP_METRIC_RTTVAR_US, /* in usec units */ /* Always last. */ __TCP_METRIC_MAX, }; #define TCP_METRIC_MAX (__TCP_METRIC_MAX - 1) enum { TCP_METRICS_ATTR_UNSPEC, TCP_METRICS_ATTR_ADDR_IPV4, /* u32 */ TCP_METRICS_ATTR_ADDR_IPV6, /* binary */ TCP_METRICS_ATTR_AGE, /* msecs */ TCP_METRICS_ATTR_TW_TSVAL, /* u32, raw, rcv tsval */ TCP_METRICS_ATTR_TW_TS_STAMP, /* s32, sec age */ TCP_METRICS_ATTR_VALS, /* nested +1, u32 */ TCP_METRICS_ATTR_FOPEN_MSS, /* u16 */ TCP_METRICS_ATTR_FOPEN_SYN_DROPS, /* u16, count of drops */ TCP_METRICS_ATTR_FOPEN_SYN_DROP_TS, /* msecs age */ TCP_METRICS_ATTR_FOPEN_COOKIE, /* binary */ TCP_METRICS_ATTR_SADDR_IPV4, /* u32 */ TCP_METRICS_ATTR_SADDR_IPV6, /* binary */ TCP_METRICS_ATTR_PAD, __TCP_METRICS_ATTR_MAX, }; #define TCP_METRICS_ATTR_MAX (__TCP_METRICS_ATTR_MAX - 1) enum { TCP_METRICS_CMD_UNSPEC, TCP_METRICS_CMD_GET, TCP_METRICS_CMD_DEL, __TCP_METRICS_CMD_MAX, }; #define TCP_METRICS_CMD_MAX (__TCP_METRICS_CMD_MAX - 1) #endif /* _LINUX_TCP_METRICS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_ipv4.h������������������������������������������������������������������������������0000644�����������������00000004171�14763166027�0011031 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* IPv4-specific defines for netfilter. * (C)1998 Rusty Russell -- This code is GPL. */ #ifndef __LINUX_IP_NETFILTER_H #define __LINUX_IP_NETFILTER_H #include <linux/netfilter.h> /* only for userspace compatibility */ #include <limits.h> /* for INT_MIN, INT_MAX */ /* IP Cache bits. */ /* Src IP address. */ #define NFC_IP_SRC 0x0001 /* Dest IP address. */ #define NFC_IP_DST 0x0002 /* Input device. */ #define NFC_IP_IF_IN 0x0004 /* Output device. */ #define NFC_IP_IF_OUT 0x0008 /* TOS. */ #define NFC_IP_TOS 0x0010 /* Protocol. */ #define NFC_IP_PROTO 0x0020 /* IP options. */ #define NFC_IP_OPTIONS 0x0040 /* Frag & flags. */ #define NFC_IP_FRAG 0x0080 /* Per-protocol information: only matters if proto match. */ /* TCP flags. */ #define NFC_IP_TCPFLAGS 0x0100 /* Source port. */ #define NFC_IP_SRC_PT 0x0200 /* Dest port. */ #define NFC_IP_DST_PT 0x0400 /* Something else about the proto */ #define NFC_IP_PROTO_UNKNOWN 0x2000 /* IP Hooks */ /* After promisc drops, checksum checks. */ #define NF_IP_PRE_ROUTING 0 /* If the packet is destined for this box. */ #define NF_IP_LOCAL_IN 1 /* If the packet is destined for another interface. */ #define NF_IP_FORWARD 2 /* Packets coming from a local process. */ #define NF_IP_LOCAL_OUT 3 /* Packets about to hit the wire. */ #define NF_IP_POST_ROUTING 4 #define NF_IP_NUMHOOKS 5 enum nf_ip_hook_priorities { NF_IP_PRI_FIRST = INT_MIN, NF_IP_PRI_RAW_BEFORE_DEFRAG = -450, NF_IP_PRI_CONNTRACK_DEFRAG = -400, NF_IP_PRI_RAW = -300, NF_IP_PRI_SELINUX_FIRST = -225, NF_IP_PRI_CONNTRACK = -200, NF_IP_PRI_MANGLE = -150, NF_IP_PRI_NAT_DST = -100, NF_IP_PRI_FILTER = 0, NF_IP_PRI_SECURITY = 50, NF_IP_PRI_NAT_SRC = 100, NF_IP_PRI_SELINUX_LAST = 225, NF_IP_PRI_CONNTRACK_HELPER = 300, NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX, NF_IP_PRI_LAST = INT_MAX, }; /* Arguments for setsockopt SOL_IP: */ /* 2.0 firewalling went from 64 through 71 (and +256, +512, etc). */ /* 2.2 firewalling (+ masq) went from 64 through 76 */ /* 2.4 firewalling went 64 through 67. */ #define SO_ORIGINAL_DST 80 #endif /* __LINUX_IP_NETFILTER_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/zorro.h���������������������������������������������������������������������������������������0000644�����������������00000006340�14763166027�0007246 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/zorro.h -- Amiga AutoConfig (Zorro) Bus Definitions * * Copyright (C) 1995--2003 Geert Uytterhoeven * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive * for more details. */ #ifndef _LINUX_ZORRO_H #define _LINUX_ZORRO_H #include <linux/types.h> /* * Each Zorro board has a 32-bit ID of the form * * mmmmmmmmmmmmmmmmppppppppeeeeeeee * * with * * mmmmmmmmmmmmmmmm 16-bit Manufacturer ID (assigned by CBM (sigh)) * pppppppp 8-bit Product ID (assigned by manufacturer) * eeeeeeee 8-bit Extended Product ID (currently only used * for some GVP boards) */ #define ZORRO_MANUF(id) ((id) >> 16) #define ZORRO_PROD(id) (((id) >> 8) & 0xff) #define ZORRO_EPC(id) ((id) & 0xff) #define ZORRO_ID(manuf, prod, epc) \ ((ZORRO_MANUF_##manuf << 16) | ((prod) << 8) | (epc)) typedef __u32 zorro_id; /* Include the ID list */ #include <linux/zorro_ids.h> /* * GVP identifies most of its products through the 'extended product code' * (epc). The epc has to be ANDed with the GVP_PRODMASK before the * identification. */ #define GVP_PRODMASK (0xf8) #define GVP_SCSICLKMASK (0x01) enum GVP_flags { GVP_IO = 0x01, GVP_ACCEL = 0x02, GVP_SCSI = 0x04, GVP_24BITDMA = 0x08, GVP_25BITDMA = 0x10, GVP_NOBANK = 0x20, GVP_14MHZ = 0x40, }; struct Node { __be32 ln_Succ; /* Pointer to next (successor) */ __be32 ln_Pred; /* Pointer to previous (predecessor) */ __u8 ln_Type; __s8 ln_Pri; /* Priority, for sorting */ __be32 ln_Name; /* ID string, null terminated */ } __attribute__((packed)); struct ExpansionRom { /* -First 16 bytes of the expansion ROM */ __u8 er_Type; /* Board type, size and flags */ __u8 er_Product; /* Product number, assigned by manufacturer */ __u8 er_Flags; /* Flags */ __u8 er_Reserved03; /* Must be zero ($ff inverted) */ __be16 er_Manufacturer; /* Unique ID, ASSIGNED BY COMMODORE-AMIGA! */ __be32 er_SerialNumber; /* Available for use by manufacturer */ __be16 er_InitDiagVec; /* Offset to optional "DiagArea" structure */ __u8 er_Reserved0c; __u8 er_Reserved0d; __u8 er_Reserved0e; __u8 er_Reserved0f; } __attribute__((packed)); /* er_Type board type bits */ #define ERT_TYPEMASK 0xc0 #define ERT_ZORROII 0xc0 #define ERT_ZORROIII 0x80 /* other bits defined in er_Type */ #define ERTB_MEMLIST 5 /* Link RAM into free memory list */ #define ERTF_MEMLIST (1<<5) struct ConfigDev { struct Node cd_Node; __u8 cd_Flags; /* (read/write) */ __u8 cd_Pad; /* reserved */ struct ExpansionRom cd_Rom; /* copy of board's expansion ROM */ __be32 cd_BoardAddr; /* where in memory the board was placed */ __be32 cd_BoardSize; /* size of board in bytes */ __be16 cd_SlotAddr; /* which slot number (PRIVATE) */ __be16 cd_SlotSize; /* number of slots (PRIVATE) */ __be32 cd_Driver; /* pointer to node of driver */ __be32 cd_NextCD; /* linked list of drivers to config */ __be32 cd_Unused[4]; /* for whatever the driver wants */ } __attribute__((packed)); #define ZORRO_NUM_AUTO 16 #endif /* _LINUX_ZORRO_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/nfsd/debug.h����������������������������������������������������������������������������������0000644�����������������00000001340�14763166027�0010106 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/include/linux/nfsd/debug.h * * Debugging-related stuff for nfsd * * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de> */ #ifndef LINUX_NFSD_DEBUG_H #define LINUX_NFSD_DEBUG_H #include <linux/sunrpc/debug.h> /* * knfsd debug flags */ #define NFSDDBG_SOCK 0x0001 #define NFSDDBG_FH 0x0002 #define NFSDDBG_EXPORT 0x0004 #define NFSDDBG_SVC 0x0008 #define NFSDDBG_PROC 0x0010 #define NFSDDBG_FILEOP 0x0020 #define NFSDDBG_AUTH 0x0040 #define NFSDDBG_REPCACHE 0x0080 #define NFSDDBG_XDR 0x0100 #define NFSDDBG_LOCKD 0x0200 #define NFSDDBG_PNFS 0x0400 #define NFSDDBG_ALL 0x7FFF #define NFSDDBG_NOCHANGE 0xFFFF #endif /* LINUX_NFSD_DEBUG_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/nfsd/stats.h����������������������������������������������������������������������������������0000644�����������������00000000645�14763166027�0010165 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/include/linux/nfsd/stats.h * * Statistics for NFS server. * * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> */ #ifndef LINUX_NFSD_STATS_H #define LINUX_NFSD_STATS_H #include <linux/nfs4.h> /* thread usage wraps very million seconds (approx one fortnight) */ #define NFSD_USAGE_WRAP (HZ*1000000) #endif /* LINUX_NFSD_STATS_H */ �������������������������������������������������������������������������������������������linux/nfsd/export.h���������������������������������������������������������������������������������0000644�����������������00000004101�14763166027�0010337 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/linux/nfsd/export.h * * Public declarations for NFS exports. The definitions for the * syscall interface are in nfsctl.h * * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> */ #ifndef NFSD_EXPORT_H #define NFSD_EXPORT_H # include <linux/types.h> /* * Important limits for the exports stuff. */ #define NFSCLNT_IDMAX 1024 #define NFSCLNT_ADDRMAX 16 #define NFSCLNT_KEYMAX 32 /* * Export flags. * * Please update the expflags[] array in fs/nfsd/export.c when adding * a new flag. */ #define NFSEXP_READONLY 0x0001 #define NFSEXP_INSECURE_PORT 0x0002 #define NFSEXP_ROOTSQUASH 0x0004 #define NFSEXP_ALLSQUASH 0x0008 #define NFSEXP_ASYNC 0x0010 #define NFSEXP_GATHERED_WRITES 0x0020 #define NFSEXP_NOREADDIRPLUS 0x0040 #define NFSEXP_SECURITY_LABEL 0x0080 /* 0x100 currently unused */ #define NFSEXP_NOHIDE 0x0200 #define NFSEXP_NOSUBTREECHECK 0x0400 #define NFSEXP_NOAUTHNLM 0x0800 /* Don't authenticate NLM requests - just trust */ #define NFSEXP_MSNFS 0x1000 /* do silly things that MS clients expect; no longer supported */ #define NFSEXP_FSID 0x2000 #define NFSEXP_CROSSMOUNT 0x4000 #define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */ /* * The NFSEXP_V4ROOT flag causes the kernel to give access only to NFSv4 * clients, and only to the single directory that is the root of the * export; further lookup and readdir operations are treated as if every * subdirectory was a mountpoint, and ignored if they are not themselves * exported. This is used by nfsd and mountd to construct the NFSv4 * pseudofilesystem, which provides access only to paths leading to each * exported filesystem. */ #define NFSEXP_V4ROOT 0x10000 #define NFSEXP_PNFS 0x20000 /* All flags that we claim to support. (Note we don't support NOACL.) */ #define NFSEXP_ALLFLAGS 0x3FEFF /* The flags that may vary depending on security flavor: */ #define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \ | NFSEXP_ALLSQUASH \ | NFSEXP_INSECURE_PORT) #endif /* NFSD_EXPORT_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/nfsd/nfsfh.h����������������������������������������������������������������������������������0000644�����������������00000006675�14763166027�0010144 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * This file describes the layout of the file handles as passed * over the wire. * * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> */ #ifndef _LINUX_NFSD_FH_H #define _LINUX_NFSD_FH_H #include <linux/types.h> #include <linux/nfs.h> #include <linux/nfs2.h> #include <linux/nfs3.h> #include <linux/nfs4.h> /* * This is the old "dentry style" Linux NFSv2 file handle. * * The xino and xdev fields are currently used to transport the * ino/dev of the exported inode. */ struct nfs_fhbase_old { __u32 fb_dcookie; /* dentry cookie - always 0xfeebbaca */ __u32 fb_ino; /* our inode number */ __u32 fb_dirino; /* dir inode number, 0 for directories */ __u32 fb_dev; /* our device */ __u32 fb_xdev; __u32 fb_xino; __u32 fb_generation; }; /* * This is the new flexible, extensible style NFSv2/v3/v4 file handle. * by Neil Brown <neilb@cse.unsw.edu.au> - March 2000 * * The file handle starts with a sequence of four-byte words. * The first word contains a version number (1) and three descriptor bytes * that tell how the remaining 3 variable length fields should be handled. * These three bytes are auth_type, fsid_type and fileid_type. * * All four-byte values are in host-byte-order. * * The auth_type field is deprecated and must be set to 0. * * The fsid_type identifies how the filesystem (or export point) is * encoded. * Current values: * 0 - 4 byte device id (ms-2-bytes major, ls-2-bytes minor), 4byte inode number * NOTE: we cannot use the kdev_t device id value, because kdev_t.h * says we mustn't. We must break it up and reassemble. * 1 - 4 byte user specified identifier * 2 - 4 byte major, 4 byte minor, 4 byte inode number - DEPRECATED * 3 - 4 byte device id, encoded for user-space, 4 byte inode number * 4 - 4 byte inode number and 4 byte uuid * 5 - 8 byte uuid * 6 - 16 byte uuid * 7 - 8 byte inode number and 16 byte uuid * * The fileid_type identified how the file within the filesystem is encoded. * The values for this field are filesystem specific, exccept that * filesystems must not use the values '0' or '0xff'. 'See enum fid_type' * in include/linux/exportfs.h for currently registered values. */ struct nfs_fhbase_new { __u8 fb_version; /* == 1, even => nfs_fhbase_old */ __u8 fb_auth_type; __u8 fb_fsid_type; __u8 fb_fileid_type; __u32 fb_auth[1]; /* __u32 fb_fsid[0]; floating */ /* __u32 fb_fileid[0]; floating */ }; struct knfsd_fh { unsigned int fh_size; /* significant for NFSv3. * Points to the current size while building * a new file handle */ union { struct nfs_fhbase_old fh_old; __u32 fh_pad[NFS4_FHSIZE/4]; struct nfs_fhbase_new fh_new; } fh_base; }; #define ofh_dcookie fh_base.fh_old.fb_dcookie #define ofh_ino fh_base.fh_old.fb_ino #define ofh_dirino fh_base.fh_old.fb_dirino #define ofh_dev fh_base.fh_old.fb_dev #define ofh_xdev fh_base.fh_old.fb_xdev #define ofh_xino fh_base.fh_old.fb_xino #define ofh_generation fh_base.fh_old.fb_generation #define fh_version fh_base.fh_new.fb_version #define fh_fsid_type fh_base.fh_new.fb_fsid_type #define fh_auth_type fh_base.fh_new.fb_auth_type #define fh_fileid_type fh_base.fh_new.fb_fileid_type #define fh_fsid fh_base.fh_new.fb_auth /* Do not use, provided for userspace compatiblity. */ #define fh_auth fh_base.fh_new.fb_auth #endif /* _LINUX_NFSD_FH_H */ �������������������������������������������������������������������linux/nfsd/cld.h������������������������������������������������������������������������������������0000644�����������������00000003601�14763166027�0007564 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Upcall description for nfsdcld communication * * Copyright (c) 2012 Red Hat, Inc. * Author(s): Jeff Layton <jlayton@redhat.com> * * 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. */ #ifndef _NFSD_CLD_H #define _NFSD_CLD_H #include <linux/types.h> /* latest upcall version available */ #define CLD_UPCALL_VERSION 1 /* defined by RFC3530 */ #define NFS4_OPAQUE_LIMIT 1024 enum cld_command { Cld_Create, /* create a record for this cm_id */ Cld_Remove, /* remove record of this cm_id */ Cld_Check, /* is this cm_id allowed? */ Cld_GraceDone, /* grace period is complete */ }; /* representation of long-form NFSv4 client ID */ struct cld_name { __u16 cn_len; /* length of cm_id */ unsigned char cn_id[NFS4_OPAQUE_LIMIT]; /* client-provided */ } __attribute__((packed)); /* message struct for communication with userspace */ struct cld_msg { __u8 cm_vers; /* upcall version */ __u8 cm_cmd; /* upcall command */ __s16 cm_status; /* return code */ __u32 cm_xid; /* transaction id */ union { __s64 cm_gracetime; /* grace period start time */ struct cld_name cm_name; } __attribute__((packed)) cm_u; } __attribute__((packed)); #endif /* !_NFSD_CLD_H */ �������������������������������������������������������������������������������������������������������������������������������linux/wmi.h�����������������������������������������������������������������������������������������0000644�����������������00000003536�14763166027�0006673 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * User API methods for ACPI-WMI mapping driver * * Copyright (C) 2017 Dell, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef _LINUX_WMI_H #define _LINUX_WMI_H #include <linux/ioctl.h> #include <linux/types.h> /* WMI bus will filter all WMI vendor driver requests through this IOC */ #define WMI_IOC 'W' /* All ioctl requests through WMI should declare their size followed by * relevant data objects */ struct wmi_ioctl_buffer { __u64 length; __u8 data[]; }; /* This structure may be modified by the firmware when we enter * system management mode through SMM, hence the volatiles */ struct calling_interface_buffer { __u16 cmd_class; __u16 cmd_select; __volatile__ __u32 input[4]; __volatile__ __u32 output[4]; } __attribute__((packed)); struct dell_wmi_extensions { __u32 argattrib; __u32 blength; __u8 data[]; } __attribute__((packed)); struct dell_wmi_smbios_buffer { __u64 length; struct calling_interface_buffer std; struct dell_wmi_extensions ext; } __attribute__((packed)); /* Whitelisted smbios class/select commands */ #define CLASS_TOKEN_READ 0 #define CLASS_TOKEN_WRITE 1 #define SELECT_TOKEN_STD 0 #define SELECT_TOKEN_BAT 1 #define SELECT_TOKEN_AC 2 #define CLASS_FLASH_INTERFACE 7 #define SELECT_FLASH_INTERFACE 3 #define CLASS_ADMIN_PROP 10 #define SELECT_ADMIN_PROP 3 #define CLASS_INFO 17 #define SELECT_RFKILL 11 #define SELECT_APP_REGISTRATION 3 #define SELECT_DOCK 22 /* whitelisted tokens */ #define CAPSULE_EN_TOKEN 0x0461 #define CAPSULE_DIS_TOKEN 0x0462 #define WSMT_EN_TOKEN 0x04EC #define WSMT_DIS_TOKEN 0x04ED /* Dell SMBIOS calling IOCTL command used by dell-smbios-wmi */ #define DELL_WMI_SMBIOS_CMD _IOWR(WMI_IOC, 0, struct dell_wmi_smbios_buffer) #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/dccp.h����������������������������������������������������������������������������������������0000644�����������������00000014444�14763166027�0007010 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_DCCP_H #define _LINUX_DCCP_H #include <linux/types.h> #include <asm/byteorder.h> /** * struct dccp_hdr - generic part of DCCP packet header * * @dccph_sport - Relevant port on the endpoint that sent this packet * @dccph_dport - Relevant port on the other endpoint * @dccph_doff - Data Offset from the start of the DCCP header, in 32-bit words * @dccph_ccval - Used by the HC-Sender CCID * @dccph_cscov - Parts of the packet that are covered by the Checksum field * @dccph_checksum - Internet checksum, depends on dccph_cscov * @dccph_x - 0 = 24 bit sequence number, 1 = 48 * @dccph_type - packet type, see DCCP_PKT_ prefixed macros * @dccph_seq - sequence number high or low order 24 bits, depends on dccph_x */ struct dccp_hdr { __be16 dccph_sport, dccph_dport; __u8 dccph_doff; #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 dccph_cscov:4, dccph_ccval:4; #elif defined(__BIG_ENDIAN_BITFIELD) __u8 dccph_ccval:4, dccph_cscov:4; #else #error "Adjust your <asm/byteorder.h> defines" #endif __sum16 dccph_checksum; #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 dccph_x:1, dccph_type:4, dccph_reserved:3; #elif defined(__BIG_ENDIAN_BITFIELD) __u8 dccph_reserved:3, dccph_type:4, dccph_x:1; #else #error "Adjust your <asm/byteorder.h> defines" #endif __u8 dccph_seq2; __be16 dccph_seq; }; /** * struct dccp_hdr_ext - the low bits of a 48 bit seq packet * * @dccph_seq_low - low 24 bits of a 48 bit seq packet */ struct dccp_hdr_ext { __be32 dccph_seq_low; }; /** * struct dccp_hdr_request - Connection initiation request header * * @dccph_req_service - Service to which the client app wants to connect */ struct dccp_hdr_request { __be32 dccph_req_service; }; /** * struct dccp_hdr_ack_bits - acknowledgment bits common to most packets * * @dccph_resp_ack_nr_high - 48 bit ack number high order bits, contains GSR * @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR */ struct dccp_hdr_ack_bits { __be16 dccph_reserved1; __be16 dccph_ack_nr_high; __be32 dccph_ack_nr_low; }; /** * struct dccp_hdr_response - Connection initiation response header * * @dccph_resp_ack - 48 bit Acknowledgment Number Subheader (5.3) * @dccph_resp_service - Echoes the Service Code on a received DCCP-Request */ struct dccp_hdr_response { struct dccp_hdr_ack_bits dccph_resp_ack; __be32 dccph_resp_service; }; /** * struct dccp_hdr_reset - Unconditionally shut down a connection * * @dccph_reset_ack - 48 bit Acknowledgment Number Subheader (5.6) * @dccph_reset_code - one of %dccp_reset_codes * @dccph_reset_data - the Data 1 ... Data 3 fields from 5.6 */ struct dccp_hdr_reset { struct dccp_hdr_ack_bits dccph_reset_ack; __u8 dccph_reset_code, dccph_reset_data[3]; }; enum dccp_pkt_type { DCCP_PKT_REQUEST = 0, DCCP_PKT_RESPONSE, DCCP_PKT_DATA, DCCP_PKT_ACK, DCCP_PKT_DATAACK, DCCP_PKT_CLOSEREQ, DCCP_PKT_CLOSE, DCCP_PKT_RESET, DCCP_PKT_SYNC, DCCP_PKT_SYNCACK, DCCP_PKT_INVALID, }; #define DCCP_NR_PKT_TYPES DCCP_PKT_INVALID static __inline__ unsigned int dccp_packet_hdr_len(const __u8 type) { if (type == DCCP_PKT_DATA) return 0; if (type == DCCP_PKT_DATAACK || type == DCCP_PKT_ACK || type == DCCP_PKT_SYNC || type == DCCP_PKT_SYNCACK || type == DCCP_PKT_CLOSE || type == DCCP_PKT_CLOSEREQ) return sizeof(struct dccp_hdr_ack_bits); if (type == DCCP_PKT_REQUEST) return sizeof(struct dccp_hdr_request); if (type == DCCP_PKT_RESPONSE) return sizeof(struct dccp_hdr_response); return sizeof(struct dccp_hdr_reset); } enum dccp_reset_codes { DCCP_RESET_CODE_UNSPECIFIED = 0, DCCP_RESET_CODE_CLOSED, DCCP_RESET_CODE_ABORTED, DCCP_RESET_CODE_NO_CONNECTION, DCCP_RESET_CODE_PACKET_ERROR, DCCP_RESET_CODE_OPTION_ERROR, DCCP_RESET_CODE_MANDATORY_ERROR, DCCP_RESET_CODE_CONNECTION_REFUSED, DCCP_RESET_CODE_BAD_SERVICE_CODE, DCCP_RESET_CODE_TOO_BUSY, DCCP_RESET_CODE_BAD_INIT_COOKIE, DCCP_RESET_CODE_AGGRESSION_PENALTY, DCCP_MAX_RESET_CODES /* Leave at the end! */ }; /* DCCP options */ enum { DCCPO_PADDING = 0, DCCPO_MANDATORY = 1, DCCPO_MIN_RESERVED = 3, DCCPO_MAX_RESERVED = 31, DCCPO_CHANGE_L = 32, DCCPO_CONFIRM_L = 33, DCCPO_CHANGE_R = 34, DCCPO_CONFIRM_R = 35, DCCPO_NDP_COUNT = 37, DCCPO_ACK_VECTOR_0 = 38, DCCPO_ACK_VECTOR_1 = 39, DCCPO_TIMESTAMP = 41, DCCPO_TIMESTAMP_ECHO = 42, DCCPO_ELAPSED_TIME = 43, DCCPO_MAX = 45, DCCPO_MIN_RX_CCID_SPECIFIC = 128, /* from sender to receiver */ DCCPO_MAX_RX_CCID_SPECIFIC = 191, DCCPO_MIN_TX_CCID_SPECIFIC = 192, /* from receiver to sender */ DCCPO_MAX_TX_CCID_SPECIFIC = 255, }; /* maximum size of a single TLV-encoded DCCP option (sans type/len bytes) */ #define DCCP_SINGLE_OPT_MAXLEN 253 /* DCCP CCIDS */ enum { DCCPC_CCID2 = 2, DCCPC_CCID3 = 3, }; /* DCCP features (RFC 4340 section 6.4) */ enum dccp_feature_numbers { DCCPF_RESERVED = 0, DCCPF_CCID = 1, DCCPF_SHORT_SEQNOS = 2, DCCPF_SEQUENCE_WINDOW = 3, DCCPF_ECN_INCAPABLE = 4, DCCPF_ACK_RATIO = 5, DCCPF_SEND_ACK_VECTOR = 6, DCCPF_SEND_NDP_COUNT = 7, DCCPF_MIN_CSUM_COVER = 8, DCCPF_DATA_CHECKSUM = 9, /* 10-127 reserved */ DCCPF_MIN_CCID_SPECIFIC = 128, DCCPF_SEND_LEV_RATE = 192, /* RFC 4342, sec. 8.4 */ DCCPF_MAX_CCID_SPECIFIC = 255, }; /* DCCP socket control message types for cmsg */ enum dccp_cmsg_type { DCCP_SCM_PRIORITY = 1, DCCP_SCM_QPOLICY_MAX = 0xFFFF, /* ^-- Up to here reserved exclusively for qpolicy parameters */ DCCP_SCM_MAX }; /* DCCP priorities for outgoing/queued packets */ enum dccp_packet_dequeueing_policy { DCCPQ_POLICY_SIMPLE, DCCPQ_POLICY_PRIO, DCCPQ_POLICY_MAX }; /* DCCP socket options */ #define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */ #define DCCP_SOCKOPT_SERVICE 2 #define DCCP_SOCKOPT_CHANGE_L 3 #define DCCP_SOCKOPT_CHANGE_R 4 #define DCCP_SOCKOPT_GET_CUR_MPS 5 #define DCCP_SOCKOPT_SERVER_TIMEWAIT 6 #define DCCP_SOCKOPT_SEND_CSCOV 10 #define DCCP_SOCKOPT_RECV_CSCOV 11 #define DCCP_SOCKOPT_AVAILABLE_CCIDS 12 #define DCCP_SOCKOPT_CCID 13 #define DCCP_SOCKOPT_TX_CCID 14 #define DCCP_SOCKOPT_RX_CCID 15 #define DCCP_SOCKOPT_QPOLICY_ID 16 #define DCCP_SOCKOPT_QPOLICY_TXQLEN 17 #define DCCP_SOCKOPT_CCID_RX_INFO 128 #define DCCP_SOCKOPT_CCID_TX_INFO 192 /* maximum number of services provided on the same listening port */ #define DCCP_SERVICE_LIST_MAX_LEN 32 #endif /* _LINUX_DCCP_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/securebits.h����������������������������������������������������������������������������������0000644�����������������00000005220�14763166027�0010237 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SECUREBITS_H #define _LINUX_SECUREBITS_H /* Each securesetting is implemented using two bits. One bit specifies whether the setting is on or off. The other bit specify whether the setting is locked or not. A setting which is locked cannot be changed from user-level. */ #define issecure_mask(X) (1 << (X)) #define SECUREBITS_DEFAULT 0x00000000 /* When set UID 0 has no special privileges. When unset, we support inheritance of root-permissions and suid-root executable under compatibility mode. We raise the effective and inheritable bitmasks *of the executable file* if the effective uid of the new process is 0. If the real uid is 0, we raise the effective (legacy) bit of the executable file. */ #define SECURE_NOROOT 0 #define SECURE_NOROOT_LOCKED 1 /* make bit-0 immutable */ #define SECBIT_NOROOT (issecure_mask(SECURE_NOROOT)) #define SECBIT_NOROOT_LOCKED (issecure_mask(SECURE_NOROOT_LOCKED)) /* When set, setuid to/from uid 0 does not trigger capability-"fixup". When unset, to provide compatiblility with old programs relying on set*uid to gain/lose privilege, transitions to/from uid 0 cause capabilities to be gained/lost. */ #define SECURE_NO_SETUID_FIXUP 2 #define SECURE_NO_SETUID_FIXUP_LOCKED 3 /* make bit-2 immutable */ #define SECBIT_NO_SETUID_FIXUP (issecure_mask(SECURE_NO_SETUID_FIXUP)) #define SECBIT_NO_SETUID_FIXUP_LOCKED \ (issecure_mask(SECURE_NO_SETUID_FIXUP_LOCKED)) /* When set, a process can retain its capabilities even after transitioning to a non-root user (the set-uid fixup suppressed by bit 2). Bit-4 is cleared when a process calls exec(); setting both bit 4 and 5 will create a barrier through exec that no exec()'d child can use this feature again. */ #define SECURE_KEEP_CAPS 4 #define SECURE_KEEP_CAPS_LOCKED 5 /* make bit-4 immutable */ #define SECBIT_KEEP_CAPS (issecure_mask(SECURE_KEEP_CAPS)) #define SECBIT_KEEP_CAPS_LOCKED (issecure_mask(SECURE_KEEP_CAPS_LOCKED)) /* When set, a process cannot add new capabilities to its ambient set. */ #define SECURE_NO_CAP_AMBIENT_RAISE 6 #define SECURE_NO_CAP_AMBIENT_RAISE_LOCKED 7 /* make bit-6 immutable */ #define SECBIT_NO_CAP_AMBIENT_RAISE (issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE)) #define SECBIT_NO_CAP_AMBIENT_RAISE_LOCKED \ (issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE_LOCKED)) #define SECURE_ALL_BITS (issecure_mask(SECURE_NOROOT) | \ issecure_mask(SECURE_NO_SETUID_FIXUP) | \ issecure_mask(SECURE_KEEP_CAPS) | \ issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE)) #define SECURE_ALL_LOCKS (SECURE_ALL_BITS << 1) #endif /* _LINUX_SECUREBITS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/utime.h���������������������������������������������������������������������������������������0000644�����������������00000000327�14763166027�0007215 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_UTIME_H #define _LINUX_UTIME_H #include <linux/types.h> struct utimbuf { __kernel_time_t actime; __kernel_time_t modtime; }; #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_bridge/ebt_vlan.h�������������������������������������������������������������������0000644�����������������00000001317�14763166027�0013174 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_VLAN_H #define __LINUX_BRIDGE_EBT_VLAN_H #include <linux/types.h> #define EBT_VLAN_ID 0x01 #define EBT_VLAN_PRIO 0x02 #define EBT_VLAN_ENCAP 0x04 #define EBT_VLAN_MASK (EBT_VLAN_ID | EBT_VLAN_PRIO | EBT_VLAN_ENCAP) #define EBT_VLAN_MATCH "vlan" struct ebt_vlan_info { __u16 id; /* VLAN ID {1-4095} */ __u8 prio; /* VLAN User Priority {0-7} */ __be16 encap; /* VLAN Encapsulated frame code {0-65535} */ __u8 bitmask; /* Args bitmask bit 1=1 - ID arg, bit 2=1 User-Priority arg, bit 3=1 encap*/ __u8 invflags; /* Inverse bitmask bit 1=1 - inversed ID arg, bit 2=1 - inversed Pirority arg */ }; #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_bridge/ebt_stp.h��������������������������������������������������������������������0000644�����������������00000002126�14763166027�0013041 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_STP_H #define __LINUX_BRIDGE_EBT_STP_H #include <linux/types.h> #define EBT_STP_TYPE 0x0001 #define EBT_STP_FLAGS 0x0002 #define EBT_STP_ROOTPRIO 0x0004 #define EBT_STP_ROOTADDR 0x0008 #define EBT_STP_ROOTCOST 0x0010 #define EBT_STP_SENDERPRIO 0x0020 #define EBT_STP_SENDERADDR 0x0040 #define EBT_STP_PORT 0x0080 #define EBT_STP_MSGAGE 0x0100 #define EBT_STP_MAXAGE 0x0200 #define EBT_STP_HELLOTIME 0x0400 #define EBT_STP_FWDD 0x0800 #define EBT_STP_MASK 0x0fff #define EBT_STP_CONFIG_MASK 0x0ffe #define EBT_STP_MATCH "stp" struct ebt_stp_config_info { __u8 flags; __u16 root_priol, root_priou; char root_addr[6], root_addrmsk[6]; __u32 root_costl, root_costu; __u16 sender_priol, sender_priou; char sender_addr[6], sender_addrmsk[6]; __u16 portl, portu; __u16 msg_agel, msg_ageu; __u16 max_agel, max_ageu; __u16 hello_timel, hello_timeu; __u16 forward_delayl, forward_delayu; }; struct ebt_stp_info { __u8 type; struct ebt_stp_config_info config; __u16 bitmask; __u16 invflags; }; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_bridge/ebt_mark_t.h�����������������������������������������������������������������0000644�����������������00000001477�14763166027�0013520 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_MARK_T_H #define __LINUX_BRIDGE_EBT_MARK_T_H /* The target member is reused for adding new actions, the * value of the real target is -1 to -NUM_STANDARD_TARGETS. * For backward compatibility, the 4 lsb (2 would be enough, * but let's play it safe) are kept to designate this target. * The remaining bits designate the action. By making the set * action 0xfffffff0, the result will look ok for older * versions. [September 2006] */ #define MARK_SET_VALUE (0xfffffff0) #define MARK_OR_VALUE (0xffffffe0) #define MARK_AND_VALUE (0xffffffd0) #define MARK_XOR_VALUE (0xffffffc0) struct ebt_mark_t_info { unsigned long mark; /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */ int target; }; #define EBT_MARK_TARGET "mark" #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_bridge/ebtables.h�������������������������������������������������������������������0000644�����������������00000022145�14763166027�0013165 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ebtables * * Authors: * Bart De Schuymer <bdschuym@pandora.be> * * ebtables.c,v 2.0, April, 2002 * * This code is strongly inspired by the iptables code which is * Copyright (C) 1999 Paul `Rusty' Russell & Michael J. Neuling */ #ifndef __LINUX_BRIDGE_EFF_H #define __LINUX_BRIDGE_EFF_H #include <linux/types.h> #include <linux/if.h> #include <linux/netfilter_bridge.h> #define EBT_TABLE_MAXNAMELEN 32 #define EBT_CHAIN_MAXNAMELEN EBT_TABLE_MAXNAMELEN #define EBT_FUNCTION_MAXNAMELEN EBT_TABLE_MAXNAMELEN #define EBT_EXTENSION_MAXNAMELEN 31 /* verdicts >0 are "branches" */ #define EBT_ACCEPT -1 #define EBT_DROP -2 #define EBT_CONTINUE -3 #define EBT_RETURN -4 #define NUM_STANDARD_TARGETS 4 /* ebtables target modules store the verdict inside an int. We can * reclaim a part of this int for backwards compatible extensions. * The 4 lsb are more than enough to store the verdict. */ #define EBT_VERDICT_BITS 0x0000000F struct xt_match; struct xt_target; struct ebt_counter { __u64 pcnt; __u64 bcnt; }; struct ebt_replace { char name[EBT_TABLE_MAXNAMELEN]; unsigned int valid_hooks; /* nr of rules in the table */ unsigned int nentries; /* total size of the entries */ unsigned int entries_size; /* start of the chains */ struct ebt_entries *hook_entry[NF_BR_NUMHOOKS]; /* nr of counters userspace expects back */ unsigned int num_counters; /* where the kernel will put the old counters */ struct ebt_counter *counters; char *entries; }; struct ebt_replace_kernel { char name[EBT_TABLE_MAXNAMELEN]; unsigned int valid_hooks; /* nr of rules in the table */ unsigned int nentries; /* total size of the entries */ unsigned int entries_size; /* start of the chains */ struct ebt_entries *hook_entry[NF_BR_NUMHOOKS]; /* nr of counters userspace expects back */ unsigned int num_counters; /* where the kernel will put the old counters */ struct ebt_counter *counters; char *entries; }; struct ebt_entries { /* this field is always set to zero * See EBT_ENTRY_OR_ENTRIES. * Must be same size as ebt_entry.bitmask */ unsigned int distinguisher; /* the chain name */ char name[EBT_CHAIN_MAXNAMELEN]; /* counter offset for this chain */ unsigned int counter_offset; /* one standard (accept, drop, return) per hook */ int policy; /* nr. of entries */ unsigned int nentries; /* entry list */ char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); }; /* used for the bitmask of struct ebt_entry */ /* This is a hack to make a difference between an ebt_entry struct and an * ebt_entries struct when traversing the entries from start to end. * Using this simplifies the code a lot, while still being able to use * ebt_entries. * Contrary, iptables doesn't use something like ebt_entries and therefore uses * different techniques for naming the policy and such. So, iptables doesn't * need a hack like this. */ #define EBT_ENTRY_OR_ENTRIES 0x01 /* these are the normal masks */ #define EBT_NOPROTO 0x02 #define EBT_802_3 0x04 #define EBT_SOURCEMAC 0x08 #define EBT_DESTMAC 0x10 #define EBT_F_MASK (EBT_NOPROTO | EBT_802_3 | EBT_SOURCEMAC | EBT_DESTMAC \ | EBT_ENTRY_OR_ENTRIES) #define EBT_IPROTO 0x01 #define EBT_IIN 0x02 #define EBT_IOUT 0x04 #define EBT_ISOURCE 0x8 #define EBT_IDEST 0x10 #define EBT_ILOGICALIN 0x20 #define EBT_ILOGICALOUT 0x40 #define EBT_INV_MASK (EBT_IPROTO | EBT_IIN | EBT_IOUT | EBT_ILOGICALIN \ | EBT_ILOGICALOUT | EBT_ISOURCE | EBT_IDEST) struct ebt_entry_match { union { struct { char name[EBT_EXTENSION_MAXNAMELEN]; uint8_t revision; }; struct xt_match *match; } u; /* size of data */ unsigned int match_size; unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); }; struct ebt_entry_watcher { union { struct { char name[EBT_EXTENSION_MAXNAMELEN]; uint8_t revision; }; struct xt_target *watcher; } u; /* size of data */ unsigned int watcher_size; unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); }; struct ebt_entry_target { union { struct { char name[EBT_EXTENSION_MAXNAMELEN]; uint8_t revision; }; struct xt_target *target; } u; /* size of data */ unsigned int target_size; unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); }; #define EBT_STANDARD_TARGET "standard" struct ebt_standard_target { struct ebt_entry_target target; int verdict; }; /* one entry */ struct ebt_entry { /* this needs to be the first field */ unsigned int bitmask; unsigned int invflags; __be16 ethproto; /* the physical in-dev */ char in[IFNAMSIZ]; /* the logical in-dev */ char logical_in[IFNAMSIZ]; /* the physical out-dev */ char out[IFNAMSIZ]; /* the logical out-dev */ char logical_out[IFNAMSIZ]; unsigned char sourcemac[ETH_ALEN]; unsigned char sourcemsk[ETH_ALEN]; unsigned char destmac[ETH_ALEN]; unsigned char destmsk[ETH_ALEN]; /* sizeof ebt_entry + matches */ unsigned int watchers_offset; /* sizeof ebt_entry + matches + watchers */ unsigned int target_offset; /* sizeof ebt_entry + matches + watchers + target */ unsigned int next_offset; unsigned char elems[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); }; static __inline__ struct ebt_entry_target * ebt_get_target(struct ebt_entry *e) { return (void *)e + e->target_offset; } /* {g,s}etsockopt numbers */ #define EBT_BASE_CTL 128 #define EBT_SO_SET_ENTRIES (EBT_BASE_CTL) #define EBT_SO_SET_COUNTERS (EBT_SO_SET_ENTRIES+1) #define EBT_SO_SET_MAX (EBT_SO_SET_COUNTERS+1) #define EBT_SO_GET_INFO (EBT_BASE_CTL) #define EBT_SO_GET_ENTRIES (EBT_SO_GET_INFO+1) #define EBT_SO_GET_INIT_INFO (EBT_SO_GET_ENTRIES+1) #define EBT_SO_GET_INIT_ENTRIES (EBT_SO_GET_INIT_INFO+1) #define EBT_SO_GET_MAX (EBT_SO_GET_INIT_ENTRIES+1) /* blatently stolen from ip_tables.h * fn returns 0 to continue iteration */ #define EBT_MATCH_ITERATE(e, fn, args...) \ ({ \ unsigned int __i; \ int __ret = 0; \ struct ebt_entry_match *__match; \ \ for (__i = sizeof(struct ebt_entry); \ __i < (e)->watchers_offset; \ __i += __match->match_size + \ sizeof(struct ebt_entry_match)) { \ __match = (void *)(e) + __i; \ \ __ret = fn(__match , ## args); \ if (__ret != 0) \ break; \ } \ if (__ret == 0) { \ if (__i != (e)->watchers_offset) \ __ret = -EINVAL; \ } \ __ret; \ }) #define EBT_WATCHER_ITERATE(e, fn, args...) \ ({ \ unsigned int __i; \ int __ret = 0; \ struct ebt_entry_watcher *__watcher; \ \ for (__i = e->watchers_offset; \ __i < (e)->target_offset; \ __i += __watcher->watcher_size + \ sizeof(struct ebt_entry_watcher)) { \ __watcher = (void *)(e) + __i; \ \ __ret = fn(__watcher , ## args); \ if (__ret != 0) \ break; \ } \ if (__ret == 0) { \ if (__i != (e)->target_offset) \ __ret = -EINVAL; \ } \ __ret; \ }) #define EBT_ENTRY_ITERATE(entries, size, fn, args...) \ ({ \ unsigned int __i; \ int __ret = 0; \ struct ebt_entry *__entry; \ \ for (__i = 0; __i < (size);) { \ __entry = (void *)(entries) + __i; \ __ret = fn(__entry , ## args); \ if (__ret != 0) \ break; \ if (__entry->bitmask != 0) \ __i += __entry->next_offset; \ else \ __i += sizeof(struct ebt_entries); \ } \ if (__ret == 0) { \ if (__i != (size)) \ __ret = -EINVAL; \ } \ __ret; \ }) #endif /* __LINUX_BRIDGE_EFF_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_bridge/ebt_limit.h������������������������������������������������������������������0000644�����������������00000001150�14763166027�0013345 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_LIMIT_H #define __LINUX_BRIDGE_EBT_LIMIT_H #include <linux/types.h> #define EBT_LIMIT_MATCH "limit" /* timings are in milliseconds. */ #define EBT_LIMIT_SCALE 10000 /* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 seconds, or one every 59 hours. */ struct ebt_limit_info { __u32 avg; /* Average secs between packets * scale */ __u32 burst; /* Period multiplier for upper limit. */ /* Used internally by the kernel */ unsigned long prev; __u32 credit; __u32 credit_cap, cost; }; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_bridge/ebt_arpreply.h���������������������������������������������������������������0000644�����������������00000000441�14763166027�0014067 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_ARPREPLY_H #define __LINUX_BRIDGE_EBT_ARPREPLY_H #include <linux/if_ether.h> struct ebt_arpreply_info { unsigned char mac[ETH_ALEN]; int target; }; #define EBT_ARPREPLY_TARGET "arpreply" #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_bridge/ebt_mark_m.h�����������������������������������������������������������������0000644�����������������00000000604�14763166027�0013500 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_MARK_M_H #define __LINUX_BRIDGE_EBT_MARK_M_H #include <linux/types.h> #define EBT_MARK_AND 0x01 #define EBT_MARK_OR 0x02 #define EBT_MARK_MASK (EBT_MARK_AND | EBT_MARK_OR) struct ebt_mark_m_info { unsigned long mark, mask; __u8 invert; __u8 bitmask; }; #define EBT_MARK_MATCH "mark_m" #endif ����������������������������������������������������������������������������������������������������������������������������linux/netfilter_bridge/ebt_redirect.h���������������������������������������������������������������0000644�����������������00000000436�14763166027�0014036 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_REDIRECT_H #define __LINUX_BRIDGE_EBT_REDIRECT_H struct ebt_redirect_info { /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */ int target; }; #define EBT_REDIRECT_TARGET "redirect" #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_bridge/ebt_ip.h���������������������������������������������������������������������0000644�����������������00000002106�14763166027�0012641 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ebt_ip * * Authors: * Bart De Schuymer <bart.de.schuymer@pandora.be> * * April, 2002 * * Changes: * added ip-sport and ip-dport * Innominate Security Technologies AG <mhopf@innominate.com> * September, 2002 */ #ifndef __LINUX_BRIDGE_EBT_IP_H #define __LINUX_BRIDGE_EBT_IP_H #include <linux/types.h> #define EBT_IP_SOURCE 0x01 #define EBT_IP_DEST 0x02 #define EBT_IP_TOS 0x04 #define EBT_IP_PROTO 0x08 #define EBT_IP_SPORT 0x10 #define EBT_IP_DPORT 0x20 #define EBT_IP_ICMP 0x40 #define EBT_IP_IGMP 0x80 #define EBT_IP_MASK (EBT_IP_SOURCE | EBT_IP_DEST | EBT_IP_TOS | EBT_IP_PROTO |\ EBT_IP_SPORT | EBT_IP_DPORT | EBT_IP_ICMP | EBT_IP_IGMP) #define EBT_IP_MATCH "ip" /* the same values are used for the invflags */ struct ebt_ip_info { __be32 saddr; __be32 daddr; __be32 smsk; __be32 dmsk; __u8 tos; __u8 protocol; __u8 bitmask; __u8 invflags; union { __u16 sport[2]; __u8 icmp_type[2]; __u8 igmp_type[2]; }; union { __u16 dport[2]; __u8 icmp_code[2]; }; }; #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_bridge/ebt_802_3.h������������������������������������������������������������������0000644�����������������00000002372�14763166027�0012771 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_802_3_H #define __LINUX_BRIDGE_EBT_802_3_H #include <linux/types.h> #include <linux/if_ether.h> #define EBT_802_3_SAP 0x01 #define EBT_802_3_TYPE 0x02 #define EBT_802_3_MATCH "802_3" /* * If frame has DSAP/SSAP value 0xaa you must check the SNAP type * to discover what kind of packet we're carrying. */ #define CHECK_TYPE 0xaa /* * Control field may be one or two bytes. If the first byte has * the value 0x03 then the entire length is one byte, otherwise it is two. * One byte controls are used in Unnumbered Information frames. * Two byte controls are used in Numbered Information frames. */ #define IS_UI 0x03 #define EBT_802_3_MASK (EBT_802_3_SAP | EBT_802_3_TYPE | EBT_802_3) /* ui has one byte ctrl, ni has two */ struct hdr_ui { __u8 dsap; __u8 ssap; __u8 ctrl; __u8 orig[3]; __be16 type; }; struct hdr_ni { __u8 dsap; __u8 ssap; __be16 ctrl; __u8 orig[3]; __be16 type; }; struct ebt_802_3_hdr { __u8 daddr[ETH_ALEN]; __u8 saddr[ETH_ALEN]; __be16 len; union { struct hdr_ui ui; struct hdr_ni ni; } llc; }; struct ebt_802_3_info { __u8 sap; __be16 type; __u8 bitmask; __u8 invflags; }; #endif /* __LINUX_BRIDGE_EBT_802_3_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_bridge/ebt_nflog.h������������������������������������������������������������������0000644�����������������00000000776�14763166027�0013351 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_NFLOG_H #define __LINUX_BRIDGE_EBT_NFLOG_H #include <linux/types.h> #define EBT_NFLOG_MASK 0x0 #define EBT_NFLOG_PREFIX_SIZE 64 #define EBT_NFLOG_WATCHER "nflog" #define EBT_NFLOG_DEFAULT_GROUP 0x1 #define EBT_NFLOG_DEFAULT_THRESHOLD 1 struct ebt_nflog_info { __u32 len; __u16 group; __u16 threshold; __u16 flags; __u16 pad; char prefix[EBT_NFLOG_PREFIX_SIZE]; }; #endif /* __LINUX_BRIDGE_EBT_NFLOG_H */ ��linux/netfilter_bridge/ebt_nat.h��������������������������������������������������������������������0000644�����������������00000000603�14763166027�0013013 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_NAT_H #define __LINUX_BRIDGE_EBT_NAT_H #include <linux/if_ether.h> #define NAT_ARP_BIT (0x00000010) struct ebt_nat_info { unsigned char mac[ETH_ALEN]; /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */ int target; }; #define EBT_SNAT_TARGET "snat" #define EBT_DNAT_TARGET "dnat" #endif �����������������������������������������������������������������������������������������������������������������������������linux/netfilter_bridge/ebt_arp.h��������������������������������������������������������������������0000644�����������������00000001604�14763166027�0013015 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_ARP_H #define __LINUX_BRIDGE_EBT_ARP_H #include <linux/types.h> #include <linux/if_ether.h> #define EBT_ARP_OPCODE 0x01 #define EBT_ARP_HTYPE 0x02 #define EBT_ARP_PTYPE 0x04 #define EBT_ARP_SRC_IP 0x08 #define EBT_ARP_DST_IP 0x10 #define EBT_ARP_SRC_MAC 0x20 #define EBT_ARP_DST_MAC 0x40 #define EBT_ARP_GRAT 0x80 #define EBT_ARP_MASK (EBT_ARP_OPCODE | EBT_ARP_HTYPE | EBT_ARP_PTYPE | \ EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC | \ EBT_ARP_GRAT) #define EBT_ARP_MATCH "arp" struct ebt_arp_info { __be16 htype; __be16 ptype; __be16 opcode; __be32 saddr; __be32 smsk; __be32 daddr; __be32 dmsk; unsigned char smaddr[ETH_ALEN]; unsigned char smmsk[ETH_ALEN]; unsigned char dmaddr[ETH_ALEN]; unsigned char dmmsk[ETH_ALEN]; __u8 bitmask; __u8 invflags; }; #endif ����������������������������������������������������������������������������������������������������������������������������linux/netfilter_bridge/ebt_among.h������������������������������������������������������������������0000644�����������������00000003773�14763166027�0013345 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_AMONG_H #define __LINUX_BRIDGE_EBT_AMONG_H #include <linux/types.h> #define EBT_AMONG_DST 0x01 #define EBT_AMONG_SRC 0x02 /* Grzegorz Borowiak <grzes@gnu.univ.gda.pl> 2003 * * Write-once-read-many hash table, used for checking if a given * MAC address belongs to a set or not and possibly for checking * if it is related with a given IPv4 address. * * The hash value of an address is its last byte. * * In real-world ethernet addresses, values of the last byte are * evenly distributed and there is no need to consider other bytes. * It would only slow the routines down. * * For MAC address comparison speedup reasons, we introduce a trick. * MAC address is mapped onto an array of two 32-bit integers. * This pair of integers is compared with MAC addresses in the * hash table, which are stored also in form of pairs of integers * (in `cmp' array). This is quick as it requires only two elementary * number comparisons in worst case. Further, we take advantage of * fact that entropy of 3 last bytes of address is larger than entropy * of 3 first bytes. So first we compare 4 last bytes of addresses and * if they are the same we compare 2 first. * * Yes, it is a memory overhead, but in 2003 AD, who cares? */ struct ebt_mac_wormhash_tuple { __u32 cmp[2]; __be32 ip; }; struct ebt_mac_wormhash { int table[257]; int poolsize; struct ebt_mac_wormhash_tuple pool[0]; }; #define ebt_mac_wormhash_size(x) ((x) ? sizeof(struct ebt_mac_wormhash) \ + (x)->poolsize * sizeof(struct ebt_mac_wormhash_tuple) : 0) struct ebt_among_info { int wh_dst_ofs; int wh_src_ofs; int bitmask; }; #define EBT_AMONG_DST_NEG 0x1 #define EBT_AMONG_SRC_NEG 0x2 #define ebt_among_wh_dst(x) ((x)->wh_dst_ofs ? \ (struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_dst_ofs) : NULL) #define ebt_among_wh_src(x) ((x)->wh_src_ofs ? \ (struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_src_ofs) : NULL) #define EBT_AMONG_MATCH "among" #endif �����linux/netfilter_bridge/ebt_log.h��������������������������������������������������������������������0000644�����������������00000001032�14763166027�0013007 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_LOG_H #define __LINUX_BRIDGE_EBT_LOG_H #include <linux/types.h> #define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */ #define EBT_LOG_ARP 0x02 #define EBT_LOG_NFLOG 0x04 #define EBT_LOG_IP6 0x08 #define EBT_LOG_MASK (EBT_LOG_IP | EBT_LOG_ARP | EBT_LOG_IP6) #define EBT_LOG_PREFIX_SIZE 30 #define EBT_LOG_WATCHER "log" struct ebt_log_info { __u8 loglevel; __u8 prefix[EBT_LOG_PREFIX_SIZE]; __u32 bitmask; }; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_bridge/ebt_ip6.h��������������������������������������������������������������������0000644�����������������00000002040�14763166027�0012724 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ebt_ip6 * * Authors: * Kuo-Lang Tseng <kuo-lang.tseng@intel.com> * Manohar Castelino <manohar.r.castelino@intel.com> * * Jan 11, 2008 * */ #ifndef __LINUX_BRIDGE_EBT_IP6_H #define __LINUX_BRIDGE_EBT_IP6_H #include <linux/types.h> #include <linux/in6.h> #define EBT_IP6_SOURCE 0x01 #define EBT_IP6_DEST 0x02 #define EBT_IP6_TCLASS 0x04 #define EBT_IP6_PROTO 0x08 #define EBT_IP6_SPORT 0x10 #define EBT_IP6_DPORT 0x20 #define EBT_IP6_ICMP6 0x40 #define EBT_IP6_MASK (EBT_IP6_SOURCE | EBT_IP6_DEST | EBT_IP6_TCLASS |\ EBT_IP6_PROTO | EBT_IP6_SPORT | EBT_IP6_DPORT | \ EBT_IP6_ICMP6) #define EBT_IP6_MATCH "ip6" /* the same values are used for the invflags */ struct ebt_ip6_info { struct in6_addr saddr; struct in6_addr daddr; struct in6_addr smsk; struct in6_addr dmsk; __u8 tclass; __u8 protocol; __u8 bitmask; __u8 invflags; union { __u16 sport[2]; __u8 icmpv6_type[2]; }; union { __u16 dport[2]; __u8 icmpv6_code[2]; }; }; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_bridge/ebt_pkttype.h����������������������������������������������������������������0000644�����������������00000000413�14763166027�0013730 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_PKTTYPE_H #define __LINUX_BRIDGE_EBT_PKTTYPE_H #include <linux/types.h> struct ebt_pkttype_info { __u8 pkt_type; __u8 invert; }; #define EBT_PKTTYPE_MATCH "pkttype" #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/max2175.h�������������������������������������������������������������������������������������0000644�����������������00000002013�14763166027�0007170 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * max2175.h * * Maxim Integrated MAX2175 RF to Bits tuner driver - user space header file. * * Copyright (C) 2016 Maxim Integrated Products * Copyright (C) 2017 Renesas Electronics Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation. * * 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. */ #ifndef __UAPI_MAX2175_H_ #define __UAPI_MAX2175_H_ #include <linux/v4l2-controls.h> #define V4L2_CID_MAX2175_I2S_ENABLE (V4L2_CID_USER_MAX217X_BASE + 0x01) #define V4L2_CID_MAX2175_HSLS (V4L2_CID_USER_MAX217X_BASE + 0x02) #define V4L2_CID_MAX2175_RX_MODE (V4L2_CID_USER_MAX217X_BASE + 0x03) #endif /* __UAPI_MAX2175_H_ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/nvram.h���������������������������������������������������������������������������������������0000644�����������������00000001024�14763166027�0007210 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_NVRAM_H #define _LINUX_NVRAM_H #include <linux/ioctl.h> /* /dev/nvram ioctls */ #define NVRAM_INIT _IO('p', 0x40) /* initialize NVRAM and set checksum */ #define NVRAM_SETCKS _IO('p', 0x41) /* recalculate checksum */ /* for all current systems, this is where NVRAM starts */ #define NVRAM_FIRST_BYTE 14 /* all these functions expect an NVRAM offset, not an absolute */ #define NVRAM_OFFSET(x) ((x)-NVRAM_FIRST_BYTE) #endif /* _LINUX_NVRAM_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/snmp.h����������������������������������������������������������������������������������������0000644�����������������00000031131�14763166027�0007044 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Definitions for MIBs * * Author: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org> */ #ifndef _LINUX_SNMP_H #define _LINUX_SNMP_H /* ipstats mib definitions */ /* * RFC 1213: MIB-II * RFC 2011 (updates 1213): SNMPv2-MIB-IP * RFC 2863: Interfaces Group MIB * RFC 2465: IPv6 MIB: General Group * draft-ietf-ipv6-rfc2011-update-10.txt: MIB for IP: IP Statistics Tables */ enum { IPSTATS_MIB_NUM = 0, /* frequently written fields in fast path, kept in same cache line */ IPSTATS_MIB_INPKTS, /* InReceives */ IPSTATS_MIB_INOCTETS, /* InOctets */ IPSTATS_MIB_INDELIVERS, /* InDelivers */ IPSTATS_MIB_OUTFORWDATAGRAMS, /* OutForwDatagrams */ IPSTATS_MIB_OUTPKTS, /* OutRequests */ IPSTATS_MIB_OUTOCTETS, /* OutOctets */ /* other fields */ IPSTATS_MIB_INHDRERRORS, /* InHdrErrors */ IPSTATS_MIB_INTOOBIGERRORS, /* InTooBigErrors */ IPSTATS_MIB_INNOROUTES, /* InNoRoutes */ IPSTATS_MIB_INADDRERRORS, /* InAddrErrors */ IPSTATS_MIB_INUNKNOWNPROTOS, /* InUnknownProtos */ IPSTATS_MIB_INTRUNCATEDPKTS, /* InTruncatedPkts */ IPSTATS_MIB_INDISCARDS, /* InDiscards */ IPSTATS_MIB_OUTDISCARDS, /* OutDiscards */ IPSTATS_MIB_OUTNOROUTES, /* OutNoRoutes */ IPSTATS_MIB_REASMTIMEOUT, /* ReasmTimeout */ IPSTATS_MIB_REASMREQDS, /* ReasmReqds */ IPSTATS_MIB_REASMOKS, /* ReasmOKs */ IPSTATS_MIB_REASMFAILS, /* ReasmFails */ IPSTATS_MIB_FRAGOKS, /* FragOKs */ IPSTATS_MIB_FRAGFAILS, /* FragFails */ IPSTATS_MIB_FRAGCREATES, /* FragCreates */ IPSTATS_MIB_INMCASTPKTS, /* InMcastPkts */ IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */ IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */ IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */ IPSTATS_MIB_INMCASTOCTETS, /* InMcastOctets */ IPSTATS_MIB_OUTMCASTOCTETS, /* OutMcastOctets */ IPSTATS_MIB_INBCASTOCTETS, /* InBcastOctets */ IPSTATS_MIB_OUTBCASTOCTETS, /* OutBcastOctets */ IPSTATS_MIB_CSUMERRORS, /* InCsumErrors */ IPSTATS_MIB_NOECTPKTS, /* InNoECTPkts */ IPSTATS_MIB_ECT1PKTS, /* InECT1Pkts */ IPSTATS_MIB_ECT0PKTS, /* InECT0Pkts */ IPSTATS_MIB_CEPKTS, /* InCEPkts */ IPSTATS_MIB_REASM_OVERLAPS, /* ReasmOverlaps */ __IPSTATS_MIB_MAX }; /* icmp mib definitions */ /* * RFC 1213: MIB-II ICMP Group * RFC 2011 (updates 1213): SNMPv2 MIB for IP: ICMP group */ enum { ICMP_MIB_NUM = 0, ICMP_MIB_INMSGS, /* InMsgs */ ICMP_MIB_INERRORS, /* InErrors */ ICMP_MIB_INDESTUNREACHS, /* InDestUnreachs */ ICMP_MIB_INTIMEEXCDS, /* InTimeExcds */ ICMP_MIB_INPARMPROBS, /* InParmProbs */ ICMP_MIB_INSRCQUENCHS, /* InSrcQuenchs */ ICMP_MIB_INREDIRECTS, /* InRedirects */ ICMP_MIB_INECHOS, /* InEchos */ ICMP_MIB_INECHOREPS, /* InEchoReps */ ICMP_MIB_INTIMESTAMPS, /* InTimestamps */ ICMP_MIB_INTIMESTAMPREPS, /* InTimestampReps */ ICMP_MIB_INADDRMASKS, /* InAddrMasks */ ICMP_MIB_INADDRMASKREPS, /* InAddrMaskReps */ ICMP_MIB_OUTMSGS, /* OutMsgs */ ICMP_MIB_OUTERRORS, /* OutErrors */ ICMP_MIB_OUTDESTUNREACHS, /* OutDestUnreachs */ ICMP_MIB_OUTTIMEEXCDS, /* OutTimeExcds */ ICMP_MIB_OUTPARMPROBS, /* OutParmProbs */ ICMP_MIB_OUTSRCQUENCHS, /* OutSrcQuenchs */ ICMP_MIB_OUTREDIRECTS, /* OutRedirects */ ICMP_MIB_OUTECHOS, /* OutEchos */ ICMP_MIB_OUTECHOREPS, /* OutEchoReps */ ICMP_MIB_OUTTIMESTAMPS, /* OutTimestamps */ ICMP_MIB_OUTTIMESTAMPREPS, /* OutTimestampReps */ ICMP_MIB_OUTADDRMASKS, /* OutAddrMasks */ ICMP_MIB_OUTADDRMASKREPS, /* OutAddrMaskReps */ ICMP_MIB_CSUMERRORS, /* InCsumErrors */ __ICMP_MIB_MAX }; #define __ICMPMSG_MIB_MAX 512 /* Out+In for all 8-bit ICMP types */ /* icmp6 mib definitions */ /* * RFC 2466: ICMPv6-MIB */ enum { ICMP6_MIB_NUM = 0, ICMP6_MIB_INMSGS, /* InMsgs */ ICMP6_MIB_INERRORS, /* InErrors */ ICMP6_MIB_OUTMSGS, /* OutMsgs */ ICMP6_MIB_OUTERRORS, /* OutErrors */ ICMP6_MIB_CSUMERRORS, /* InCsumErrors */ __ICMP6_MIB_MAX }; #define __ICMP6MSG_MIB_MAX 512 /* Out+In for all 8-bit ICMPv6 types */ /* tcp mib definitions */ /* * RFC 1213: MIB-II TCP group * RFC 2012 (updates 1213): SNMPv2-MIB-TCP */ enum { TCP_MIB_NUM = 0, TCP_MIB_RTOALGORITHM, /* RtoAlgorithm */ TCP_MIB_RTOMIN, /* RtoMin */ TCP_MIB_RTOMAX, /* RtoMax */ TCP_MIB_MAXCONN, /* MaxConn */ TCP_MIB_ACTIVEOPENS, /* ActiveOpens */ TCP_MIB_PASSIVEOPENS, /* PassiveOpens */ TCP_MIB_ATTEMPTFAILS, /* AttemptFails */ TCP_MIB_ESTABRESETS, /* EstabResets */ TCP_MIB_CURRESTAB, /* CurrEstab */ TCP_MIB_INSEGS, /* InSegs */ TCP_MIB_OUTSEGS, /* OutSegs */ TCP_MIB_RETRANSSEGS, /* RetransSegs */ TCP_MIB_INERRS, /* InErrs */ TCP_MIB_OUTRSTS, /* OutRsts */ TCP_MIB_CSUMERRORS, /* InCsumErrors */ __TCP_MIB_MAX }; /* udp mib definitions */ /* * RFC 1213: MIB-II UDP group * RFC 2013 (updates 1213): SNMPv2-MIB-UDP */ enum { UDP_MIB_NUM = 0, UDP_MIB_INDATAGRAMS, /* InDatagrams */ UDP_MIB_NOPORTS, /* NoPorts */ UDP_MIB_INERRORS, /* InErrors */ UDP_MIB_OUTDATAGRAMS, /* OutDatagrams */ UDP_MIB_RCVBUFERRORS, /* RcvbufErrors */ UDP_MIB_SNDBUFERRORS, /* SndbufErrors */ UDP_MIB_CSUMERRORS, /* InCsumErrors */ UDP_MIB_IGNOREDMULTI, /* IgnoredMulti */ __UDP_MIB_MAX }; /* linux mib definitions */ enum { LINUX_MIB_NUM = 0, LINUX_MIB_SYNCOOKIESSENT, /* SyncookiesSent */ LINUX_MIB_SYNCOOKIESRECV, /* SyncookiesRecv */ LINUX_MIB_SYNCOOKIESFAILED, /* SyncookiesFailed */ LINUX_MIB_EMBRYONICRSTS, /* EmbryonicRsts */ LINUX_MIB_PRUNECALLED, /* PruneCalled */ LINUX_MIB_RCVPRUNED, /* RcvPruned */ LINUX_MIB_OFOPRUNED, /* OfoPruned */ LINUX_MIB_OUTOFWINDOWICMPS, /* OutOfWindowIcmps */ LINUX_MIB_LOCKDROPPEDICMPS, /* LockDroppedIcmps */ LINUX_MIB_ARPFILTER, /* ArpFilter */ LINUX_MIB_TIMEWAITED, /* TimeWaited */ LINUX_MIB_TIMEWAITRECYCLED, /* TimeWaitRecycled */ LINUX_MIB_TIMEWAITKILLED, /* TimeWaitKilled */ LINUX_MIB_PAWSACTIVEREJECTED, /* PAWSActiveRejected */ LINUX_MIB_PAWSESTABREJECTED, /* PAWSEstabRejected */ LINUX_MIB_DELAYEDACKS, /* DelayedACKs */ LINUX_MIB_DELAYEDACKLOCKED, /* DelayedACKLocked */ LINUX_MIB_DELAYEDACKLOST, /* DelayedACKLost */ LINUX_MIB_LISTENOVERFLOWS, /* ListenOverflows */ LINUX_MIB_LISTENDROPS, /* ListenDrops */ LINUX_MIB_TCPHPHITS, /* TCPHPHits */ LINUX_MIB_TCPPUREACKS, /* TCPPureAcks */ LINUX_MIB_TCPHPACKS, /* TCPHPAcks */ LINUX_MIB_TCPRENORECOVERY, /* TCPRenoRecovery */ LINUX_MIB_TCPSACKRECOVERY, /* TCPSackRecovery */ LINUX_MIB_TCPSACKRENEGING, /* TCPSACKReneging */ LINUX_MIB_TCPSACKREORDER, /* TCPSACKReorder */ LINUX_MIB_TCPRENOREORDER, /* TCPRenoReorder */ LINUX_MIB_TCPTSREORDER, /* TCPTSReorder */ LINUX_MIB_TCPFULLUNDO, /* TCPFullUndo */ LINUX_MIB_TCPPARTIALUNDO, /* TCPPartialUndo */ LINUX_MIB_TCPDSACKUNDO, /* TCPDSACKUndo */ LINUX_MIB_TCPLOSSUNDO, /* TCPLossUndo */ LINUX_MIB_TCPLOSTRETRANSMIT, /* TCPLostRetransmit */ LINUX_MIB_TCPRENOFAILURES, /* TCPRenoFailures */ LINUX_MIB_TCPSACKFAILURES, /* TCPSackFailures */ LINUX_MIB_TCPLOSSFAILURES, /* TCPLossFailures */ LINUX_MIB_TCPFASTRETRANS, /* TCPFastRetrans */ LINUX_MIB_TCPSLOWSTARTRETRANS, /* TCPSlowStartRetrans */ LINUX_MIB_TCPTIMEOUTS, /* TCPTimeouts */ LINUX_MIB_TCPLOSSPROBES, /* TCPLossProbes */ LINUX_MIB_TCPLOSSPROBERECOVERY, /* TCPLossProbeRecovery */ LINUX_MIB_TCPRENORECOVERYFAIL, /* TCPRenoRecoveryFail */ LINUX_MIB_TCPSACKRECOVERYFAIL, /* TCPSackRecoveryFail */ LINUX_MIB_TCPRCVCOLLAPSED, /* TCPRcvCollapsed */ LINUX_MIB_TCPDSACKOLDSENT, /* TCPDSACKOldSent */ LINUX_MIB_TCPDSACKOFOSENT, /* TCPDSACKOfoSent */ LINUX_MIB_TCPDSACKRECV, /* TCPDSACKRecv */ LINUX_MIB_TCPDSACKOFORECV, /* TCPDSACKOfoRecv */ LINUX_MIB_TCPABORTONDATA, /* TCPAbortOnData */ LINUX_MIB_TCPABORTONCLOSE, /* TCPAbortOnClose */ LINUX_MIB_TCPABORTONMEMORY, /* TCPAbortOnMemory */ LINUX_MIB_TCPABORTONTIMEOUT, /* TCPAbortOnTimeout */ LINUX_MIB_TCPABORTONLINGER, /* TCPAbortOnLinger */ LINUX_MIB_TCPABORTFAILED, /* TCPAbortFailed */ LINUX_MIB_TCPMEMORYPRESSURES, /* TCPMemoryPressures */ LINUX_MIB_TCPMEMORYPRESSURESCHRONO, /* TCPMemoryPressuresChrono */ LINUX_MIB_TCPSACKDISCARD, /* TCPSACKDiscard */ LINUX_MIB_TCPDSACKIGNOREDOLD, /* TCPSACKIgnoredOld */ LINUX_MIB_TCPDSACKIGNOREDNOUNDO, /* TCPSACKIgnoredNoUndo */ LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */ LINUX_MIB_TCPMD5NOTFOUND, /* TCPMD5NotFound */ LINUX_MIB_TCPMD5UNEXPECTED, /* TCPMD5Unexpected */ LINUX_MIB_TCPMD5FAILURE, /* TCPMD5Failure */ LINUX_MIB_SACKSHIFTED, LINUX_MIB_SACKMERGED, LINUX_MIB_SACKSHIFTFALLBACK, LINUX_MIB_TCPBACKLOGDROP, LINUX_MIB_PFMEMALLOCDROP, LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */ LINUX_MIB_TCPDEFERACCEPTDROP, LINUX_MIB_IPRPFILTER, /* IP Reverse Path Filter (rp_filter) */ LINUX_MIB_TCPTIMEWAITOVERFLOW, /* TCPTimeWaitOverflow */ LINUX_MIB_TCPREQQFULLDOCOOKIES, /* TCPReqQFullDoCookies */ LINUX_MIB_TCPREQQFULLDROP, /* TCPReqQFullDrop */ LINUX_MIB_TCPRETRANSFAIL, /* TCPRetransFail */ LINUX_MIB_TCPRCVCOALESCE, /* TCPRcvCoalesce */ LINUX_MIB_TCPOFOQUEUE, /* TCPOFOQueue */ LINUX_MIB_TCPOFODROP, /* TCPOFODrop */ LINUX_MIB_TCPOFOMERGE, /* TCPOFOMerge */ LINUX_MIB_TCPCHALLENGEACK, /* TCPChallengeACK */ LINUX_MIB_TCPSYNCHALLENGE, /* TCPSYNChallenge */ LINUX_MIB_TCPFASTOPENACTIVE, /* TCPFastOpenActive */ LINUX_MIB_TCPFASTOPENACTIVEFAIL, /* TCPFastOpenActiveFail */ LINUX_MIB_TCPFASTOPENPASSIVE, /* TCPFastOpenPassive*/ LINUX_MIB_TCPFASTOPENPASSIVEFAIL, /* TCPFastOpenPassiveFail */ LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */ LINUX_MIB_TCPFASTOPENCOOKIEREQD, /* TCPFastOpenCookieReqd */ LINUX_MIB_TCPFASTOPENBLACKHOLE, /* TCPFastOpenBlackholeDetect */ LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */ LINUX_MIB_BUSYPOLLRXPACKETS, /* BusyPollRxPackets */ LINUX_MIB_TCPAUTOCORKING, /* TCPAutoCorking */ LINUX_MIB_TCPFROMZEROWINDOWADV, /* TCPFromZeroWindowAdv */ LINUX_MIB_TCPTOZEROWINDOWADV, /* TCPToZeroWindowAdv */ LINUX_MIB_TCPWANTZEROWINDOWADV, /* TCPWantZeroWindowAdv */ LINUX_MIB_TCPSYNRETRANS, /* TCPSynRetrans */ LINUX_MIB_TCPORIGDATASENT, /* TCPOrigDataSent */ LINUX_MIB_TCPHYSTARTTRAINDETECT, /* TCPHystartTrainDetect */ LINUX_MIB_TCPHYSTARTTRAINCWND, /* TCPHystartTrainCwnd */ LINUX_MIB_TCPHYSTARTDELAYDETECT, /* TCPHystartDelayDetect */ LINUX_MIB_TCPHYSTARTDELAYCWND, /* TCPHystartDelayCwnd */ LINUX_MIB_TCPACKSKIPPEDSYNRECV, /* TCPACKSkippedSynRecv */ LINUX_MIB_TCPACKSKIPPEDPAWS, /* TCPACKSkippedPAWS */ LINUX_MIB_TCPACKSKIPPEDSEQ, /* TCPACKSkippedSeq */ LINUX_MIB_TCPACKSKIPPEDFINWAIT2, /* TCPACKSkippedFinWait2 */ LINUX_MIB_TCPACKSKIPPEDTIMEWAIT, /* TCPACKSkippedTimeWait */ LINUX_MIB_TCPACKSKIPPEDCHALLENGE, /* TCPACKSkippedChallenge */ LINUX_MIB_TCPWINPROBE, /* TCPWinProbe */ LINUX_MIB_TCPKEEPALIVE, /* TCPKeepAlive */ LINUX_MIB_TCPMTUPFAIL, /* TCPMTUPFail */ LINUX_MIB_TCPMTUPSUCCESS, /* TCPMTUPSuccess */ LINUX_MIB_TCPDELIVERED, /* TCPDelivered */ LINUX_MIB_TCPDELIVEREDCE, /* TCPDeliveredCE */ LINUX_MIB_TCPACKCOMPRESSED, /* TCPAckCompressed */ LINUX_MIB_TCPZEROWINDOWDROP, /* TCPZeroWindowDrop */ LINUX_MIB_TCPRCVQDROP, /* TCPRcvQDrop */ LINUX_MIB_TCPWQUEUETOOBIG, /* TCPWqueueTooBig */ __LINUX_MIB_MAX }; /* linux Xfrm mib definitions */ enum { LINUX_MIB_XFRMNUM = 0, LINUX_MIB_XFRMINERROR, /* XfrmInError */ LINUX_MIB_XFRMINBUFFERERROR, /* XfrmInBufferError */ LINUX_MIB_XFRMINHDRERROR, /* XfrmInHdrError */ LINUX_MIB_XFRMINNOSTATES, /* XfrmInNoStates */ LINUX_MIB_XFRMINSTATEPROTOERROR, /* XfrmInStateProtoError */ LINUX_MIB_XFRMINSTATEMODEERROR, /* XfrmInStateModeError */ LINUX_MIB_XFRMINSTATESEQERROR, /* XfrmInStateSeqError */ LINUX_MIB_XFRMINSTATEEXPIRED, /* XfrmInStateExpired */ LINUX_MIB_XFRMINSTATEMISMATCH, /* XfrmInStateMismatch */ LINUX_MIB_XFRMINSTATEINVALID, /* XfrmInStateInvalid */ LINUX_MIB_XFRMINTMPLMISMATCH, /* XfrmInTmplMismatch */ LINUX_MIB_XFRMINNOPOLS, /* XfrmInNoPols */ LINUX_MIB_XFRMINPOLBLOCK, /* XfrmInPolBlock */ LINUX_MIB_XFRMINPOLERROR, /* XfrmInPolError */ LINUX_MIB_XFRMOUTERROR, /* XfrmOutError */ LINUX_MIB_XFRMOUTBUNDLEGENERROR, /* XfrmOutBundleGenError */ LINUX_MIB_XFRMOUTBUNDLECHECKERROR, /* XfrmOutBundleCheckError */ LINUX_MIB_XFRMOUTNOSTATES, /* XfrmOutNoStates */ LINUX_MIB_XFRMOUTSTATEPROTOERROR, /* XfrmOutStateProtoError */ LINUX_MIB_XFRMOUTSTATEMODEERROR, /* XfrmOutStateModeError */ LINUX_MIB_XFRMOUTSTATESEQERROR, /* XfrmOutStateSeqError */ LINUX_MIB_XFRMOUTSTATEEXPIRED, /* XfrmOutStateExpired */ LINUX_MIB_XFRMOUTPOLBLOCK, /* XfrmOutPolBlock */ LINUX_MIB_XFRMOUTPOLDEAD, /* XfrmOutPolDead */ LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */ LINUX_MIB_XFRMFWDHDRERROR, /* XfrmFwdHdrError*/ LINUX_MIB_XFRMOUTSTATEINVALID, /* XfrmOutStateInvalid */ LINUX_MIB_XFRMACQUIREERROR, /* XfrmAcquireError */ __LINUX_MIB_XFRMMAX }; #endif /* _LINUX_SNMP_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/kvm.h�����������������������������������������������������������������������������������������0000644�����������������00000126242�14763166027�0006674 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_KVM_H #define __LINUX_KVM_H /* * Userspace interface for /dev/kvm - kernel based virtual machine * * Note: you must update KVM_API_VERSION if you change this interface. */ #include <linux/types.h> #include <linux/ioctl.h> #include <asm/kvm.h> #define KVM_API_VERSION 12 /* *** Deprecated interfaces *** */ #define KVM_TRC_SHIFT 16 #define KVM_TRC_ENTRYEXIT (1 << KVM_TRC_SHIFT) #define KVM_TRC_HANDLER (1 << (KVM_TRC_SHIFT + 1)) #define KVM_TRC_VMENTRY (KVM_TRC_ENTRYEXIT + 0x01) #define KVM_TRC_VMEXIT (KVM_TRC_ENTRYEXIT + 0x02) #define KVM_TRC_PAGE_FAULT (KVM_TRC_HANDLER + 0x01) #define KVM_TRC_HEAD_SIZE 12 #define KVM_TRC_CYCLE_SIZE 8 #define KVM_TRC_EXTRA_MAX 7 #define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02) #define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03) #define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04) #define KVM_TRC_IO_READ (KVM_TRC_HANDLER + 0x05) #define KVM_TRC_IO_WRITE (KVM_TRC_HANDLER + 0x06) #define KVM_TRC_CR_READ (KVM_TRC_HANDLER + 0x07) #define KVM_TRC_CR_WRITE (KVM_TRC_HANDLER + 0x08) #define KVM_TRC_DR_READ (KVM_TRC_HANDLER + 0x09) #define KVM_TRC_DR_WRITE (KVM_TRC_HANDLER + 0x0A) #define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B) #define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C) #define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D) #define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E) #define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F) #define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10) #define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11) #define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12) #define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13) #define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14) #define KVM_TRC_TDP_FAULT (KVM_TRC_HANDLER + 0x15) #define KVM_TRC_GTLB_WRITE (KVM_TRC_HANDLER + 0x16) #define KVM_TRC_STLB_WRITE (KVM_TRC_HANDLER + 0x17) #define KVM_TRC_STLB_INVAL (KVM_TRC_HANDLER + 0x18) #define KVM_TRC_PPC_INSTR (KVM_TRC_HANDLER + 0x19) struct kvm_user_trace_setup { __u32 buf_size; __u32 buf_nr; }; #define __KVM_DEPRECATED_MAIN_W_0x06 \ _IOW(KVMIO, 0x06, struct kvm_user_trace_setup) #define __KVM_DEPRECATED_MAIN_0x07 _IO(KVMIO, 0x07) #define __KVM_DEPRECATED_MAIN_0x08 _IO(KVMIO, 0x08) #define __KVM_DEPRECATED_VM_R_0x70 _IOR(KVMIO, 0x70, struct kvm_assigned_irq) struct kvm_breakpoint { __u32 enabled; __u32 padding; __u64 address; }; struct kvm_debug_guest { __u32 enabled; __u32 pad; struct kvm_breakpoint breakpoints[4]; __u32 singlestep; }; #define __KVM_DEPRECATED_VCPU_W_0x87 _IOW(KVMIO, 0x87, struct kvm_debug_guest) /* *** End of deprecated interfaces *** */ /* for KVM_CREATE_MEMORY_REGION */ struct kvm_memory_region { __u32 slot; __u32 flags; __u64 guest_phys_addr; __u64 memory_size; /* bytes */ }; /* for KVM_SET_USER_MEMORY_REGION */ struct kvm_userspace_memory_region { __u32 slot; __u32 flags; __u64 guest_phys_addr; __u64 memory_size; /* bytes */ __u64 userspace_addr; /* start of the userspace allocated memory */ }; /* * The bit 0 ~ bit 15 of kvm_memory_region::flags are visible for userspace, * other bits are reserved for kvm internal use which are defined in * include/linux/kvm_host.h. */ #define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0) #define KVM_MEM_READONLY (1UL << 1) /* for KVM_IRQ_LINE */ struct kvm_irq_level { /* * ACPI gsi notion of irq. * For IA-64 (APIC model) IOAPIC0: irq 0-23; IOAPIC1: irq 24-47.. * For X86 (standard AT mode) PIC0/1: irq 0-15. IOAPIC0: 0-23.. * For ARM: See Documentation/virtual/kvm/api.txt */ union { __u32 irq; __s32 status; }; __u32 level; }; struct kvm_irqchip { __u32 chip_id; __u32 pad; union { char dummy[512]; /* reserving space */ #ifdef __KVM_HAVE_PIT struct kvm_pic_state pic; #endif #ifdef __KVM_HAVE_IOAPIC struct kvm_ioapic_state ioapic; #endif } chip; }; /* for KVM_CREATE_PIT2 */ struct kvm_pit_config { __u32 flags; __u32 pad[15]; }; #define KVM_PIT_SPEAKER_DUMMY 1 struct kvm_s390_skeys { __u64 start_gfn; __u64 count; __u64 skeydata_addr; __u32 flags; __u32 reserved[9]; }; #define KVM_S390_CMMA_PEEK (1 << 0) /** * kvm_s390_cmma_log - Used for CMMA migration. * * Used both for input and output. * * @start_gfn: Guest page number to start from. * @count: Size of the result buffer. * @flags: Control operation mode via KVM_S390_CMMA_* flags * @remaining: Used with KVM_S390_GET_CMMA_BITS. Indicates how many dirty * pages are still remaining. * @mask: Used with KVM_S390_SET_CMMA_BITS. Bitmap of bits to actually set * in the PGSTE. * @values: Pointer to the values buffer. * * Used in KVM_S390_{G,S}ET_CMMA_BITS ioctls. */ struct kvm_s390_cmma_log { __u64 start_gfn; __u32 count; __u32 flags; union { __u64 remaining; __u64 mask; }; __u64 values; }; struct kvm_hyperv_exit { #define KVM_EXIT_HYPERV_SYNIC 1 #define KVM_EXIT_HYPERV_HCALL 2 __u32 type; __u32 pad1; union { struct { __u32 msr; __u32 pad2; __u64 control; __u64 evt_page; __u64 msg_page; } synic; struct { __u64 input; __u64 result; __u64 params[2]; } hcall; } u; }; #define KVM_S390_GET_SKEYS_NONE 1 #define KVM_S390_SKEYS_MAX 1048576 #define KVM_EXIT_UNKNOWN 0 #define KVM_EXIT_EXCEPTION 1 #define KVM_EXIT_IO 2 #define KVM_EXIT_HYPERCALL 3 #define KVM_EXIT_DEBUG 4 #define KVM_EXIT_HLT 5 #define KVM_EXIT_MMIO 6 #define KVM_EXIT_IRQ_WINDOW_OPEN 7 #define KVM_EXIT_SHUTDOWN 8 #define KVM_EXIT_FAIL_ENTRY 9 #define KVM_EXIT_INTR 10 #define KVM_EXIT_SET_TPR 11 #define KVM_EXIT_TPR_ACCESS 12 #define KVM_EXIT_S390_SIEIC 13 #define KVM_EXIT_S390_RESET 14 #define KVM_EXIT_DCR 15 /* deprecated */ #define KVM_EXIT_NMI 16 #define KVM_EXIT_INTERNAL_ERROR 17 #define KVM_EXIT_OSI 18 #define KVM_EXIT_PAPR_HCALL 19 #define KVM_EXIT_S390_UCONTROL 20 #define KVM_EXIT_WATCHDOG 21 #define KVM_EXIT_S390_TSCH 22 #define KVM_EXIT_EPR 23 #define KVM_EXIT_SYSTEM_EVENT 24 #define KVM_EXIT_S390_STSI 25 #define KVM_EXIT_IOAPIC_EOI 26 #define KVM_EXIT_HYPERV 27 /* For KVM_EXIT_INTERNAL_ERROR */ /* Emulate instruction failed. */ #define KVM_INTERNAL_ERROR_EMULATION 1 /* Encounter unexpected simultaneous exceptions. */ #define KVM_INTERNAL_ERROR_SIMUL_EX 2 /* Encounter unexpected vm-exit due to delivery event. */ #define KVM_INTERNAL_ERROR_DELIVERY_EV 3 /* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ struct kvm_run { /* in */ __u8 request_interrupt_window; __u8 immediate_exit; __u8 padding1[6]; /* out */ __u32 exit_reason; __u8 ready_for_interrupt_injection; __u8 if_flag; __u16 flags; /* in (pre_kvm_run), out (post_kvm_run) */ __u64 cr8; __u64 apic_base; #ifdef __KVM_S390 /* the processor status word for s390 */ __u64 psw_mask; /* psw upper half */ __u64 psw_addr; /* psw lower half */ #endif union { /* KVM_EXIT_UNKNOWN */ struct { __u64 hardware_exit_reason; } hw; /* KVM_EXIT_FAIL_ENTRY */ struct { __u64 hardware_entry_failure_reason; } fail_entry; /* KVM_EXIT_EXCEPTION */ struct { __u32 exception; __u32 error_code; } ex; /* KVM_EXIT_IO */ struct { #define KVM_EXIT_IO_IN 0 #define KVM_EXIT_IO_OUT 1 __u8 direction; __u8 size; /* bytes */ __u16 port; __u32 count; __u64 data_offset; /* relative to kvm_run start */ } io; /* KVM_EXIT_DEBUG */ struct { struct kvm_debug_exit_arch arch; } debug; /* KVM_EXIT_MMIO */ struct { __u64 phys_addr; __u8 data[8]; __u32 len; __u8 is_write; } mmio; /* KVM_EXIT_HYPERCALL */ struct { __u64 nr; __u64 args[6]; __u64 ret; __u32 longmode; __u32 pad; } hypercall; /* KVM_EXIT_TPR_ACCESS */ struct { __u64 rip; __u32 is_write; __u32 pad; } tpr_access; /* KVM_EXIT_S390_SIEIC */ struct { __u8 icptcode; __u16 ipa; __u32 ipb; } s390_sieic; /* KVM_EXIT_S390_RESET */ #define KVM_S390_RESET_POR 1 #define KVM_S390_RESET_CLEAR 2 #define KVM_S390_RESET_SUBSYSTEM 4 #define KVM_S390_RESET_CPU_INIT 8 #define KVM_S390_RESET_IPL 16 __u64 s390_reset_flags; /* KVM_EXIT_S390_UCONTROL */ struct { __u64 trans_exc_code; __u32 pgm_code; } s390_ucontrol; /* KVM_EXIT_DCR (deprecated) */ struct { __u32 dcrn; __u32 data; __u8 is_write; } dcr; /* KVM_EXIT_INTERNAL_ERROR */ struct { __u32 suberror; /* Available with KVM_CAP_INTERNAL_ERROR_DATA: */ __u32 ndata; __u64 data[16]; } internal; /* KVM_EXIT_OSI */ struct { __u64 gprs[32]; } osi; /* KVM_EXIT_PAPR_HCALL */ struct { __u64 nr; __u64 ret; __u64 args[9]; } papr_hcall; /* KVM_EXIT_S390_TSCH */ struct { __u16 subchannel_id; __u16 subchannel_nr; __u32 io_int_parm; __u32 io_int_word; __u32 ipb; __u8 dequeued; } s390_tsch; /* KVM_EXIT_EPR */ struct { __u32 epr; } epr; /* KVM_EXIT_SYSTEM_EVENT */ struct { #define KVM_SYSTEM_EVENT_SHUTDOWN 1 #define KVM_SYSTEM_EVENT_RESET 2 #define KVM_SYSTEM_EVENT_CRASH 3 __u32 type; __u64 flags; } system_event; /* KVM_EXIT_S390_STSI */ struct { __u64 addr; __u8 ar; __u8 reserved; __u8 fc; __u8 sel1; __u16 sel2; } s390_stsi; /* KVM_EXIT_IOAPIC_EOI */ struct { __u8 vector; } eoi; /* KVM_EXIT_HYPERV */ struct kvm_hyperv_exit hyperv; /* Fix the size of the union. */ char padding[256]; }; /* 2048 is the size of the char array used to bound/pad the size * of the union that holds sync regs. */ #define SYNC_REGS_SIZE_BYTES 2048 /* * shared registers between kvm and userspace. * kvm_valid_regs specifies the register classes set by the host * kvm_dirty_regs specified the register classes dirtied by userspace * struct kvm_sync_regs is architecture specific, as well as the * bits for kvm_valid_regs and kvm_dirty_regs */ __u64 kvm_valid_regs; __u64 kvm_dirty_regs; union { struct kvm_sync_regs regs; char padding[SYNC_REGS_SIZE_BYTES]; } s; }; /* for KVM_REGISTER_COALESCED_MMIO / KVM_UNREGISTER_COALESCED_MMIO */ struct kvm_coalesced_mmio_zone { __u64 addr; __u32 size; __u32 pad; }; struct kvm_coalesced_mmio { __u64 phys_addr; __u32 len; __u32 pad; __u8 data[8]; }; struct kvm_coalesced_mmio_ring { __u32 first, last; struct kvm_coalesced_mmio coalesced_mmio[0]; }; #define KVM_COALESCED_MMIO_MAX \ ((PAGE_SIZE - sizeof(struct kvm_coalesced_mmio_ring)) / \ sizeof(struct kvm_coalesced_mmio)) /* for KVM_TRANSLATE */ struct kvm_translation { /* in */ __u64 linear_address; /* out */ __u64 physical_address; __u8 valid; __u8 writeable; __u8 usermode; __u8 pad[5]; }; /* for KVM_S390_MEM_OP */ struct kvm_s390_mem_op { /* in */ __u64 gaddr; /* the guest address */ __u64 flags; /* flags */ __u32 size; /* amount of bytes */ __u32 op; /* type of operation */ __u64 buf; /* buffer in userspace */ __u8 ar; /* the access register number */ __u8 reserved[31]; /* should be set to 0 */ }; /* types for kvm_s390_mem_op->op */ #define KVM_S390_MEMOP_LOGICAL_READ 0 #define KVM_S390_MEMOP_LOGICAL_WRITE 1 /* flags for kvm_s390_mem_op->flags */ #define KVM_S390_MEMOP_F_CHECK_ONLY (1ULL << 0) #define KVM_S390_MEMOP_F_INJECT_EXCEPTION (1ULL << 1) /* for KVM_INTERRUPT */ struct kvm_interrupt { /* in */ __u32 irq; }; /* for KVM_GET_DIRTY_LOG */ struct kvm_dirty_log { __u32 slot; __u32 padding1; union { void *dirty_bitmap; /* one bit per page */ __u64 padding2; }; }; /* for KVM_SET_SIGNAL_MASK */ struct kvm_signal_mask { __u32 len; __u8 sigset[0]; }; /* for KVM_TPR_ACCESS_REPORTING */ struct kvm_tpr_access_ctl { __u32 enabled; __u32 flags; __u32 reserved[8]; }; /* for KVM_SET_VAPIC_ADDR */ struct kvm_vapic_addr { __u64 vapic_addr; }; /* for KVM_SET_MP_STATE */ /* not all states are valid on all architectures */ #define KVM_MP_STATE_RUNNABLE 0 #define KVM_MP_STATE_UNINITIALIZED 1 #define KVM_MP_STATE_INIT_RECEIVED 2 #define KVM_MP_STATE_HALTED 3 #define KVM_MP_STATE_SIPI_RECEIVED 4 #define KVM_MP_STATE_STOPPED 5 #define KVM_MP_STATE_CHECK_STOP 6 #define KVM_MP_STATE_OPERATING 7 #define KVM_MP_STATE_LOAD 8 struct kvm_mp_state { __u32 mp_state; }; struct kvm_s390_psw { __u64 mask; __u64 addr; }; /* valid values for type in kvm_s390_interrupt */ #define KVM_S390_SIGP_STOP 0xfffe0000u #define KVM_S390_PROGRAM_INT 0xfffe0001u #define KVM_S390_SIGP_SET_PREFIX 0xfffe0002u #define KVM_S390_RESTART 0xfffe0003u #define KVM_S390_INT_PFAULT_INIT 0xfffe0004u #define KVM_S390_INT_PFAULT_DONE 0xfffe0005u #define KVM_S390_MCHK 0xfffe1000u #define KVM_S390_INT_CLOCK_COMP 0xffff1004u #define KVM_S390_INT_CPU_TIMER 0xffff1005u #define KVM_S390_INT_VIRTIO 0xffff2603u #define KVM_S390_INT_SERVICE 0xffff2401u #define KVM_S390_INT_EMERGENCY 0xffff1201u #define KVM_S390_INT_EXTERNAL_CALL 0xffff1202u /* Anything below 0xfffe0000u is taken by INT_IO */ #define KVM_S390_INT_IO(ai,cssid,ssid,schid) \ (((schid)) | \ ((ssid) << 16) | \ ((cssid) << 18) | \ ((ai) << 26)) #define KVM_S390_INT_IO_MIN 0x00000000u #define KVM_S390_INT_IO_MAX 0xfffdffffu #define KVM_S390_INT_IO_AI_MASK 0x04000000u struct kvm_s390_interrupt { __u32 type; __u32 parm; __u64 parm64; }; struct kvm_s390_io_info { __u16 subchannel_id; __u16 subchannel_nr; __u32 io_int_parm; __u32 io_int_word; }; struct kvm_s390_ext_info { __u32 ext_params; __u32 pad; __u64 ext_params2; }; struct kvm_s390_pgm_info { __u64 trans_exc_code; __u64 mon_code; __u64 per_address; __u32 data_exc_code; __u16 code; __u16 mon_class_nr; __u8 per_code; __u8 per_atmid; __u8 exc_access_id; __u8 per_access_id; __u8 op_access_id; #define KVM_S390_PGM_FLAGS_ILC_VALID 0x01 #define KVM_S390_PGM_FLAGS_ILC_0 0x02 #define KVM_S390_PGM_FLAGS_ILC_1 0x04 #define KVM_S390_PGM_FLAGS_ILC_MASK 0x06 #define KVM_S390_PGM_FLAGS_NO_REWIND 0x08 __u8 flags; __u8 pad[2]; }; struct kvm_s390_prefix_info { __u32 address; }; struct kvm_s390_extcall_info { __u16 code; }; struct kvm_s390_emerg_info { __u16 code; }; #define KVM_S390_STOP_FLAG_STORE_STATUS 0x01 struct kvm_s390_stop_info { __u32 flags; }; struct kvm_s390_mchk_info { __u64 cr14; __u64 mcic; __u64 failing_storage_address; __u32 ext_damage_code; __u32 pad; __u8 fixed_logout[16]; }; struct kvm_s390_irq { __u64 type; union { struct kvm_s390_io_info io; struct kvm_s390_ext_info ext; struct kvm_s390_pgm_info pgm; struct kvm_s390_emerg_info emerg; struct kvm_s390_extcall_info extcall; struct kvm_s390_prefix_info prefix; struct kvm_s390_stop_info stop; struct kvm_s390_mchk_info mchk; char reserved[64]; } u; }; struct kvm_s390_irq_state { __u64 buf; __u32 flags; /* will stay unused for compatibility reasons */ __u32 len; __u32 reserved[4]; /* will stay unused for compatibility reasons */ }; /* for KVM_SET_GUEST_DEBUG */ #define KVM_GUESTDBG_ENABLE 0x00000001 #define KVM_GUESTDBG_SINGLESTEP 0x00000002 struct kvm_guest_debug { __u32 control; __u32 pad; struct kvm_guest_debug_arch arch; }; enum { kvm_ioeventfd_flag_nr_datamatch, kvm_ioeventfd_flag_nr_pio, kvm_ioeventfd_flag_nr_deassign, kvm_ioeventfd_flag_nr_virtio_ccw_notify, kvm_ioeventfd_flag_nr_fast_mmio, kvm_ioeventfd_flag_nr_max, }; #define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch) #define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio) #define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign) #define KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY \ (1 << kvm_ioeventfd_flag_nr_virtio_ccw_notify) #define KVM_IOEVENTFD_VALID_FLAG_MASK ((1 << kvm_ioeventfd_flag_nr_max) - 1) struct kvm_ioeventfd { __u64 datamatch; __u64 addr; /* legal pio/mmio address */ __u32 len; /* 1, 2, 4, or 8 bytes; or 0 to ignore length */ __s32 fd; __u32 flags; __u8 pad[36]; }; #define KVM_X86_DISABLE_EXITS_MWAIT (1 << 0) #define KVM_X86_DISABLE_EXITS_HLT (1 << 1) #define KVM_X86_DISABLE_EXITS_PAUSE (1 << 2) #define KVM_X86_DISABLE_VALID_EXITS (KVM_X86_DISABLE_EXITS_MWAIT | \ KVM_X86_DISABLE_EXITS_HLT | \ KVM_X86_DISABLE_EXITS_PAUSE) /* for KVM_ENABLE_CAP */ struct kvm_enable_cap { /* in */ __u32 cap; __u32 flags; __u64 args[4]; __u8 pad[64]; }; /* for KVM_PPC_GET_PVINFO */ #define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1<<0) struct kvm_ppc_pvinfo { /* out */ __u32 flags; __u32 hcall[4]; __u8 pad[108]; }; /* for KVM_PPC_GET_SMMU_INFO */ #define KVM_PPC_PAGE_SIZES_MAX_SZ 8 struct kvm_ppc_one_page_size { __u32 page_shift; /* Page shift (or 0) */ __u32 pte_enc; /* Encoding in the HPTE (>>12) */ }; struct kvm_ppc_one_seg_page_size { __u32 page_shift; /* Base page shift of segment (or 0) */ __u32 slb_enc; /* SLB encoding for BookS */ struct kvm_ppc_one_page_size enc[KVM_PPC_PAGE_SIZES_MAX_SZ]; }; #define KVM_PPC_PAGE_SIZES_REAL 0x00000001 #define KVM_PPC_1T_SEGMENTS 0x00000002 struct kvm_ppc_smmu_info { __u64 flags; __u32 slb_size; __u16 data_keys; /* # storage keys supported for data */ __u16 instr_keys; /* # storage keys supported for instructions */ struct kvm_ppc_one_seg_page_size sps[KVM_PPC_PAGE_SIZES_MAX_SZ]; }; /* for KVM_PPC_RESIZE_HPT_{PREPARE,COMMIT} */ struct kvm_ppc_resize_hpt { __u64 flags; __u32 shift; __u32 pad; }; #define KVMIO 0xAE /* machine type bits, to be used as argument to KVM_CREATE_VM */ #define KVM_VM_S390_UCONTROL 1 /* on ppc, 0 indicate default, 1 should force HV and 2 PR */ #define KVM_VM_PPC_HV 1 #define KVM_VM_PPC_PR 2 /* on MIPS, 0 indicates auto, 1 forces VZ ASE, 2 forces trap & emulate */ #define KVM_VM_MIPS_AUTO 0 #define KVM_VM_MIPS_VZ 1 #define KVM_VM_MIPS_TE 2 #define KVM_S390_SIE_PAGE_OFFSET 1 /* * ioctls for /dev/kvm fds: */ #define KVM_GET_API_VERSION _IO(KVMIO, 0x00) #define KVM_CREATE_VM _IO(KVMIO, 0x01) /* returns a VM fd */ #define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 0x02, struct kvm_msr_list) #define KVM_S390_ENABLE_SIE _IO(KVMIO, 0x06) /* * Check if a kvm extension is available. Argument is extension number, * return is 1 (yes) or 0 (no, sorry). */ #define KVM_CHECK_EXTENSION _IO(KVMIO, 0x03) /* * Get size for mmap(vcpu_fd) */ #define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */ #define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2) #define KVM_TRACE_ENABLE __KVM_DEPRECATED_MAIN_W_0x06 #define KVM_TRACE_PAUSE __KVM_DEPRECATED_MAIN_0x07 #define KVM_TRACE_DISABLE __KVM_DEPRECATED_MAIN_0x08 #define KVM_GET_EMULATED_CPUID _IOWR(KVMIO, 0x09, struct kvm_cpuid2) #define KVM_GET_MSR_FEATURE_INDEX_LIST _IOWR(KVMIO, 0x0a, struct kvm_msr_list) /* * Extension capability list. */ #define KVM_CAP_IRQCHIP 0 #define KVM_CAP_HLT 1 #define KVM_CAP_MMU_SHADOW_CACHE_CONTROL 2 #define KVM_CAP_USER_MEMORY 3 #define KVM_CAP_SET_TSS_ADDR 4 #define KVM_CAP_VAPIC 6 #define KVM_CAP_EXT_CPUID 7 #define KVM_CAP_CLOCKSOURCE 8 #define KVM_CAP_NR_VCPUS 9 /* returns recommended max vcpus per vm */ #define KVM_CAP_NR_MEMSLOTS 10 /* returns max memory slots per vm */ #define KVM_CAP_PIT 11 #define KVM_CAP_NOP_IO_DELAY 12 #define KVM_CAP_PV_MMU 13 #define KVM_CAP_MP_STATE 14 #define KVM_CAP_COALESCED_MMIO 15 #define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */ #define KVM_CAP_IOMMU 18 /* Bug in KVM_SET_USER_MEMORY_REGION fixed: */ #define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21 #define KVM_CAP_USER_NMI 22 #ifdef __KVM_HAVE_GUEST_DEBUG #define KVM_CAP_SET_GUEST_DEBUG 23 #endif #ifdef __KVM_HAVE_PIT #define KVM_CAP_REINJECT_CONTROL 24 #endif #define KVM_CAP_IRQ_ROUTING 25 #define KVM_CAP_IRQ_INJECT_STATUS 26 #define KVM_CAP_ASSIGN_DEV_IRQ 29 /* Another bug in KVM_SET_USER_MEMORY_REGION fixed: */ #define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30 #ifdef __KVM_HAVE_MCE #define KVM_CAP_MCE 31 #endif #define KVM_CAP_IRQFD 32 #ifdef __KVM_HAVE_PIT #define KVM_CAP_PIT2 33 #endif #define KVM_CAP_SET_BOOT_CPU_ID 34 #ifdef __KVM_HAVE_PIT_STATE2 #define KVM_CAP_PIT_STATE2 35 #endif #define KVM_CAP_IOEVENTFD 36 #define KVM_CAP_SET_IDENTITY_MAP_ADDR 37 #ifdef __KVM_HAVE_XEN_HVM #define KVM_CAP_XEN_HVM 38 #endif #define KVM_CAP_ADJUST_CLOCK 39 #define KVM_CAP_INTERNAL_ERROR_DATA 40 #ifdef __KVM_HAVE_VCPU_EVENTS #define KVM_CAP_VCPU_EVENTS 41 #endif #define KVM_CAP_S390_PSW 42 #define KVM_CAP_PPC_SEGSTATE 43 #define KVM_CAP_HYPERV 44 #define KVM_CAP_HYPERV_VAPIC 45 #define KVM_CAP_HYPERV_SPIN 46 #define KVM_CAP_PCI_SEGMENT 47 #define KVM_CAP_PPC_PAIRED_SINGLES 48 #define KVM_CAP_INTR_SHADOW 49 #ifdef __KVM_HAVE_DEBUGREGS #define KVM_CAP_DEBUGREGS 50 #endif #define KVM_CAP_X86_ROBUST_SINGLESTEP 51 #define KVM_CAP_PPC_OSI 52 #define KVM_CAP_PPC_UNSET_IRQ 53 #define KVM_CAP_ENABLE_CAP 54 #ifdef __KVM_HAVE_XSAVE #define KVM_CAP_XSAVE 55 #endif #ifdef __KVM_HAVE_XCRS #define KVM_CAP_XCRS 56 #endif #define KVM_CAP_PPC_GET_PVINFO 57 #define KVM_CAP_PPC_IRQ_LEVEL 58 #define KVM_CAP_ASYNC_PF 59 #define KVM_CAP_TSC_CONTROL 60 #define KVM_CAP_GET_TSC_KHZ 61 #define KVM_CAP_PPC_BOOKE_SREGS 62 #define KVM_CAP_SPAPR_TCE 63 #define KVM_CAP_PPC_SMT 64 #define KVM_CAP_PPC_RMA 65 #define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */ #define KVM_CAP_PPC_HIOR 67 #define KVM_CAP_PPC_PAPR 68 #define KVM_CAP_SW_TLB 69 #define KVM_CAP_ONE_REG 70 #define KVM_CAP_S390_GMAP 71 #define KVM_CAP_TSC_DEADLINE_TIMER 72 #define KVM_CAP_S390_UCONTROL 73 #define KVM_CAP_SYNC_REGS 74 #define KVM_CAP_PCI_2_3 75 #define KVM_CAP_KVMCLOCK_CTRL 76 #define KVM_CAP_SIGNAL_MSI 77 #define KVM_CAP_PPC_GET_SMMU_INFO 78 #define KVM_CAP_S390_COW 79 #define KVM_CAP_PPC_ALLOC_HTAB 80 #define KVM_CAP_READONLY_MEM 81 #define KVM_CAP_IRQFD_RESAMPLE 82 #define KVM_CAP_PPC_BOOKE_WATCHDOG 83 #define KVM_CAP_PPC_HTAB_FD 84 #define KVM_CAP_S390_CSS_SUPPORT 85 #define KVM_CAP_PPC_EPR 86 #define KVM_CAP_ARM_PSCI 87 #define KVM_CAP_ARM_SET_DEVICE_ADDR 88 #define KVM_CAP_DEVICE_CTRL 89 #define KVM_CAP_IRQ_MPIC 90 #define KVM_CAP_PPC_RTAS 91 #define KVM_CAP_IRQ_XICS 92 #define KVM_CAP_ARM_EL1_32BIT 93 #define KVM_CAP_SPAPR_MULTITCE 94 #define KVM_CAP_EXT_EMUL_CPUID 95 #define KVM_CAP_HYPERV_TIME 96 #define KVM_CAP_IOAPIC_POLARITY_IGNORED 97 #define KVM_CAP_ENABLE_CAP_VM 98 #define KVM_CAP_S390_IRQCHIP 99 #define KVM_CAP_IOEVENTFD_NO_LENGTH 100 #define KVM_CAP_VM_ATTRIBUTES 101 #define KVM_CAP_ARM_PSCI_0_2 102 #define KVM_CAP_PPC_FIXUP_HCALL 103 #define KVM_CAP_PPC_ENABLE_HCALL 104 #define KVM_CAP_CHECK_EXTENSION_VM 105 #define KVM_CAP_S390_USER_SIGP 106 #define KVM_CAP_S390_VECTOR_REGISTERS 107 #define KVM_CAP_S390_MEM_OP 108 #define KVM_CAP_S390_USER_STSI 109 #define KVM_CAP_S390_SKEYS 110 #define KVM_CAP_MIPS_FPU 111 #define KVM_CAP_MIPS_MSA 112 #define KVM_CAP_S390_INJECT_IRQ 113 #define KVM_CAP_S390_IRQ_STATE 114 #define KVM_CAP_PPC_HWRNG 115 #define KVM_CAP_DISABLE_QUIRKS 116 #define KVM_CAP_X86_SMM 117 #define KVM_CAP_MULTI_ADDRESS_SPACE 118 #define KVM_CAP_GUEST_DEBUG_HW_BPS 119 #define KVM_CAP_GUEST_DEBUG_HW_WPS 120 #define KVM_CAP_SPLIT_IRQCHIP 121 #define KVM_CAP_IOEVENTFD_ANY_LENGTH 122 #define KVM_CAP_HYPERV_SYNIC 123 #define KVM_CAP_S390_RI 124 #define KVM_CAP_SPAPR_TCE_64 125 #define KVM_CAP_ARM_PMU_V3 126 #define KVM_CAP_VCPU_ATTRIBUTES 127 #define KVM_CAP_MAX_VCPU_ID 128 #define KVM_CAP_X2APIC_API 129 #define KVM_CAP_S390_USER_INSTR0 130 #define KVM_CAP_MSI_DEVID 131 #define KVM_CAP_PPC_HTM 132 #define KVM_CAP_SPAPR_RESIZE_HPT 133 #define KVM_CAP_PPC_MMU_RADIX 134 #define KVM_CAP_PPC_MMU_HASH_V3 135 #define KVM_CAP_IMMEDIATE_EXIT 136 #define KVM_CAP_MIPS_VZ 137 #define KVM_CAP_MIPS_TE 138 #define KVM_CAP_MIPS_64BIT 139 #define KVM_CAP_S390_GS 140 #define KVM_CAP_S390_AIS 141 #define KVM_CAP_SPAPR_TCE_VFIO 142 #define KVM_CAP_X86_DISABLE_EXITS 143 #define KVM_CAP_ARM_USER_IRQ 144 #define KVM_CAP_S390_CMMA_MIGRATION 145 #define KVM_CAP_PPC_FWNMI 146 #define KVM_CAP_PPC_SMT_POSSIBLE 147 #define KVM_CAP_HYPERV_SYNIC2 148 #define KVM_CAP_HYPERV_VP_INDEX 149 #define KVM_CAP_S390_AIS_MIGRATION 150 #define KVM_CAP_PPC_GET_CPU_CHAR 151 #define KVM_CAP_S390_BPB 152 #define KVM_CAP_GET_MSR_FEATURES 153 #define KVM_CAP_HYPERV_EVENTFD 154 #define KVM_CAP_HYPERV_TLBFLUSH 155 #define KVM_CAP_S390_HPAGE_1M 156 #define KVM_CAP_NESTED_STATE 157 #define KVM_CAP_ARM_INJECT_SERROR_ESR 158 #define KVM_CAP_MSR_PLATFORM_INFO 159 #ifdef KVM_CAP_IRQ_ROUTING struct kvm_irq_routing_irqchip { __u32 irqchip; __u32 pin; }; struct kvm_irq_routing_msi { __u32 address_lo; __u32 address_hi; __u32 data; union { __u32 pad; __u32 devid; }; }; struct kvm_irq_routing_s390_adapter { __u64 ind_addr; __u64 summary_addr; __u64 ind_offset; __u32 summary_offset; __u32 adapter_id; }; struct kvm_irq_routing_hv_sint { __u32 vcpu; __u32 sint; }; /* gsi routing entry types */ #define KVM_IRQ_ROUTING_IRQCHIP 1 #define KVM_IRQ_ROUTING_MSI 2 #define KVM_IRQ_ROUTING_S390_ADAPTER 3 #define KVM_IRQ_ROUTING_HV_SINT 4 struct kvm_irq_routing_entry { __u32 gsi; __u32 type; __u32 flags; __u32 pad; union { struct kvm_irq_routing_irqchip irqchip; struct kvm_irq_routing_msi msi; struct kvm_irq_routing_s390_adapter adapter; struct kvm_irq_routing_hv_sint hv_sint; __u32 pad[8]; } u; }; struct kvm_irq_routing { __u32 nr; __u32 flags; struct kvm_irq_routing_entry entries[0]; }; #endif #ifdef KVM_CAP_MCE /* x86 MCE */ struct kvm_x86_mce { __u64 status; __u64 addr; __u64 misc; __u64 mcg_status; __u8 bank; __u8 pad1[7]; __u64 pad2[3]; }; #endif #ifdef KVM_CAP_XEN_HVM struct kvm_xen_hvm_config { __u32 flags; __u32 msr; __u64 blob_addr_32; __u64 blob_addr_64; __u8 blob_size_32; __u8 blob_size_64; __u8 pad2[30]; }; #endif #define KVM_IRQFD_FLAG_DEASSIGN (1 << 0) /* * Available with KVM_CAP_IRQFD_RESAMPLE * * KVM_IRQFD_FLAG_RESAMPLE indicates resamplefd is valid and specifies * the irqfd to operate in resampling mode for level triggered interrupt * emulation. See Documentation/virtual/kvm/api.txt. */ #define KVM_IRQFD_FLAG_RESAMPLE (1 << 1) struct kvm_irqfd { __u32 fd; __u32 gsi; __u32 flags; __u32 resamplefd; __u8 pad[16]; }; /* For KVM_CAP_ADJUST_CLOCK */ /* Do not use 1, KVM_CHECK_EXTENSION returned it before we had flags. */ #define KVM_CLOCK_TSC_STABLE 2 struct kvm_clock_data { __u64 clock; __u32 flags; __u32 pad[9]; }; /* For KVM_CAP_SW_TLB */ #define KVM_MMU_FSL_BOOKE_NOHV 0 #define KVM_MMU_FSL_BOOKE_HV 1 struct kvm_config_tlb { __u64 params; __u64 array; __u32 mmu_type; __u32 array_len; }; struct kvm_dirty_tlb { __u64 bitmap; __u32 num_dirty; }; /* Available with KVM_CAP_ONE_REG */ #define KVM_REG_ARCH_MASK 0xff00000000000000ULL #define KVM_REG_GENERIC 0x0000000000000000ULL /* * Architecture specific registers are to be defined in arch headers and * ORed with the arch identifier. */ #define KVM_REG_PPC 0x1000000000000000ULL #define KVM_REG_X86 0x2000000000000000ULL #define KVM_REG_IA64 0x3000000000000000ULL #define KVM_REG_ARM 0x4000000000000000ULL #define KVM_REG_S390 0x5000000000000000ULL #define KVM_REG_ARM64 0x6000000000000000ULL #define KVM_REG_MIPS 0x7000000000000000ULL #define KVM_REG_SIZE_SHIFT 52 #define KVM_REG_SIZE_MASK 0x00f0000000000000ULL #define KVM_REG_SIZE_U8 0x0000000000000000ULL #define KVM_REG_SIZE_U16 0x0010000000000000ULL #define KVM_REG_SIZE_U32 0x0020000000000000ULL #define KVM_REG_SIZE_U64 0x0030000000000000ULL #define KVM_REG_SIZE_U128 0x0040000000000000ULL #define KVM_REG_SIZE_U256 0x0050000000000000ULL #define KVM_REG_SIZE_U512 0x0060000000000000ULL #define KVM_REG_SIZE_U1024 0x0070000000000000ULL struct kvm_reg_list { __u64 n; /* number of regs */ __u64 reg[0]; }; struct kvm_one_reg { __u64 id; __u64 addr; }; #define KVM_MSI_VALID_DEVID (1U << 0) struct kvm_msi { __u32 address_lo; __u32 address_hi; __u32 data; __u32 flags; __u32 devid; __u8 pad[12]; }; struct kvm_arm_device_addr { __u64 id; __u64 addr; }; /* * Device control API, available with KVM_CAP_DEVICE_CTRL */ #define KVM_CREATE_DEVICE_TEST 1 struct kvm_create_device { __u32 type; /* in: KVM_DEV_TYPE_xxx */ __u32 fd; /* out: device handle */ __u32 flags; /* in: KVM_CREATE_DEVICE_xxx */ }; struct kvm_device_attr { __u32 flags; /* no flags currently defined */ __u32 group; /* device-defined */ __u64 attr; /* group-defined */ __u64 addr; /* userspace address of attr data */ }; #define KVM_DEV_VFIO_GROUP 1 #define KVM_DEV_VFIO_GROUP_ADD 1 #define KVM_DEV_VFIO_GROUP_DEL 2 #define KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE 3 enum kvm_device_type { KVM_DEV_TYPE_FSL_MPIC_20 = 1, #define KVM_DEV_TYPE_FSL_MPIC_20 KVM_DEV_TYPE_FSL_MPIC_20 KVM_DEV_TYPE_FSL_MPIC_42, #define KVM_DEV_TYPE_FSL_MPIC_42 KVM_DEV_TYPE_FSL_MPIC_42 KVM_DEV_TYPE_XICS, #define KVM_DEV_TYPE_XICS KVM_DEV_TYPE_XICS KVM_DEV_TYPE_VFIO, #define KVM_DEV_TYPE_VFIO KVM_DEV_TYPE_VFIO KVM_DEV_TYPE_ARM_VGIC_V2, #define KVM_DEV_TYPE_ARM_VGIC_V2 KVM_DEV_TYPE_ARM_VGIC_V2 KVM_DEV_TYPE_FLIC, #define KVM_DEV_TYPE_FLIC KVM_DEV_TYPE_FLIC KVM_DEV_TYPE_ARM_VGIC_V3, #define KVM_DEV_TYPE_ARM_VGIC_V3 KVM_DEV_TYPE_ARM_VGIC_V3 KVM_DEV_TYPE_ARM_VGIC_ITS, #define KVM_DEV_TYPE_ARM_VGIC_ITS KVM_DEV_TYPE_ARM_VGIC_ITS KVM_DEV_TYPE_MAX, }; struct kvm_vfio_spapr_tce { __s32 groupfd; __s32 tablefd; }; /* * ioctls for VM fds */ #define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region) /* * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns * a vcpu fd. */ #define KVM_CREATE_VCPU _IO(KVMIO, 0x41) #define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log) /* KVM_SET_MEMORY_ALIAS is obsolete: */ #define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias) #define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44) #define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) #define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46, \ struct kvm_userspace_memory_region) #define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47) #define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64) /* enable ucontrol for s390 */ struct kvm_s390_ucas_mapping { __u64 user_addr; __u64 vcpu_addr; __u64 length; }; #define KVM_S390_UCAS_MAP _IOW(KVMIO, 0x50, struct kvm_s390_ucas_mapping) #define KVM_S390_UCAS_UNMAP _IOW(KVMIO, 0x51, struct kvm_s390_ucas_mapping) #define KVM_S390_VCPU_FAULT _IOW(KVMIO, 0x52, unsigned long) /* Device model IOC */ #define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60) #define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) #define KVM_GET_IRQCHIP _IOWR(KVMIO, 0x62, struct kvm_irqchip) #define KVM_SET_IRQCHIP _IOR(KVMIO, 0x63, struct kvm_irqchip) #define KVM_CREATE_PIT _IO(KVMIO, 0x64) #define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state) #define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state) #define KVM_IRQ_LINE_STATUS _IOWR(KVMIO, 0x67, struct kvm_irq_level) #define KVM_REGISTER_COALESCED_MMIO \ _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone) #define KVM_UNREGISTER_COALESCED_MMIO \ _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone) #define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \ struct kvm_assigned_pci_dev) #define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing) /* deprecated, replaced by KVM_ASSIGN_DEV_IRQ */ #define KVM_ASSIGN_IRQ __KVM_DEPRECATED_VM_R_0x70 #define KVM_ASSIGN_DEV_IRQ _IOW(KVMIO, 0x70, struct kvm_assigned_irq) #define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71) #define KVM_DEASSIGN_PCI_DEVICE _IOW(KVMIO, 0x72, \ struct kvm_assigned_pci_dev) #define KVM_ASSIGN_SET_MSIX_NR _IOW(KVMIO, 0x73, \ struct kvm_assigned_msix_nr) #define KVM_ASSIGN_SET_MSIX_ENTRY _IOW(KVMIO, 0x74, \ struct kvm_assigned_msix_entry) #define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq) #define KVM_IRQFD _IOW(KVMIO, 0x76, struct kvm_irqfd) #define KVM_CREATE_PIT2 _IOW(KVMIO, 0x77, struct kvm_pit_config) #define KVM_SET_BOOT_CPU_ID _IO(KVMIO, 0x78) #define KVM_IOEVENTFD _IOW(KVMIO, 0x79, struct kvm_ioeventfd) #define KVM_XEN_HVM_CONFIG _IOW(KVMIO, 0x7a, struct kvm_xen_hvm_config) #define KVM_SET_CLOCK _IOW(KVMIO, 0x7b, struct kvm_clock_data) #define KVM_GET_CLOCK _IOR(KVMIO, 0x7c, struct kvm_clock_data) /* Available with KVM_CAP_PIT_STATE2 */ #define KVM_GET_PIT2 _IOR(KVMIO, 0x9f, struct kvm_pit_state2) #define KVM_SET_PIT2 _IOW(KVMIO, 0xa0, struct kvm_pit_state2) /* Available with KVM_CAP_PPC_GET_PVINFO */ #define KVM_PPC_GET_PVINFO _IOW(KVMIO, 0xa1, struct kvm_ppc_pvinfo) /* Available with KVM_CAP_TSC_CONTROL */ #define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2) #define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3) /* Available with KVM_CAP_PCI_2_3 */ #define KVM_ASSIGN_SET_INTX_MASK _IOW(KVMIO, 0xa4, \ struct kvm_assigned_pci_dev) /* Available with KVM_CAP_SIGNAL_MSI */ #define KVM_SIGNAL_MSI _IOW(KVMIO, 0xa5, struct kvm_msi) /* Available with KVM_CAP_PPC_GET_SMMU_INFO */ #define KVM_PPC_GET_SMMU_INFO _IOR(KVMIO, 0xa6, struct kvm_ppc_smmu_info) /* Available with KVM_CAP_PPC_ALLOC_HTAB */ #define KVM_PPC_ALLOCATE_HTAB _IOWR(KVMIO, 0xa7, __u32) #define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce) #define KVM_CREATE_SPAPR_TCE_64 _IOW(KVMIO, 0xa8, \ struct kvm_create_spapr_tce_64) /* Available with KVM_CAP_RMA */ #define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma) /* Available with KVM_CAP_PPC_HTAB_FD */ #define KVM_PPC_GET_HTAB_FD _IOW(KVMIO, 0xaa, struct kvm_get_htab_fd) /* Available with KVM_CAP_ARM_SET_DEVICE_ADDR */ #define KVM_ARM_SET_DEVICE_ADDR _IOW(KVMIO, 0xab, struct kvm_arm_device_addr) /* Available with KVM_CAP_PPC_RTAS */ #define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO, 0xac, struct kvm_rtas_token_args) /* Available with KVM_CAP_SPAPR_RESIZE_HPT */ #define KVM_PPC_RESIZE_HPT_PREPARE _IOR(KVMIO, 0xad, struct kvm_ppc_resize_hpt) #define KVM_PPC_RESIZE_HPT_COMMIT _IOR(KVMIO, 0xae, struct kvm_ppc_resize_hpt) /* Available with KVM_CAP_PPC_RADIX_MMU or KVM_CAP_PPC_HASH_MMU_V3 */ #define KVM_PPC_CONFIGURE_V3_MMU _IOW(KVMIO, 0xaf, struct kvm_ppc_mmuv3_cfg) /* Available with KVM_CAP_PPC_RADIX_MMU */ #define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_info) /* Available with KVM_CAP_PPC_GET_CPU_CHAR */ #define KVM_PPC_GET_CPU_CHAR _IOR(KVMIO, 0xb1, struct kvm_ppc_cpu_char) /* ioctl for vm fd */ #define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device) /* ioctls for fds returned by KVM_CREATE_DEVICE */ #define KVM_SET_DEVICE_ATTR _IOW(KVMIO, 0xe1, struct kvm_device_attr) #define KVM_GET_DEVICE_ATTR _IOW(KVMIO, 0xe2, struct kvm_device_attr) #define KVM_HAS_DEVICE_ATTR _IOW(KVMIO, 0xe3, struct kvm_device_attr) /* * ioctls for vcpu fds */ #define KVM_RUN _IO(KVMIO, 0x80) #define KVM_GET_REGS _IOR(KVMIO, 0x81, struct kvm_regs) #define KVM_SET_REGS _IOW(KVMIO, 0x82, struct kvm_regs) #define KVM_GET_SREGS _IOR(KVMIO, 0x83, struct kvm_sregs) #define KVM_SET_SREGS _IOW(KVMIO, 0x84, struct kvm_sregs) #define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation) #define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt) /* KVM_DEBUG_GUEST is no longer supported, use KVM_SET_GUEST_DEBUG instead */ #define KVM_DEBUG_GUEST __KVM_DEPRECATED_VCPU_W_0x87 #define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs) #define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs) #define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid) #define KVM_SET_SIGNAL_MASK _IOW(KVMIO, 0x8b, struct kvm_signal_mask) #define KVM_GET_FPU _IOR(KVMIO, 0x8c, struct kvm_fpu) #define KVM_SET_FPU _IOW(KVMIO, 0x8d, struct kvm_fpu) #define KVM_GET_LAPIC _IOR(KVMIO, 0x8e, struct kvm_lapic_state) #define KVM_SET_LAPIC _IOW(KVMIO, 0x8f, struct kvm_lapic_state) #define KVM_SET_CPUID2 _IOW(KVMIO, 0x90, struct kvm_cpuid2) #define KVM_GET_CPUID2 _IOWR(KVMIO, 0x91, struct kvm_cpuid2) /* Available with KVM_CAP_VAPIC */ #define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl) /* Available with KVM_CAP_VAPIC */ #define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr) /* valid for virtual machine (for floating interrupt)_and_ vcpu */ #define KVM_S390_INTERRUPT _IOW(KVMIO, 0x94, struct kvm_s390_interrupt) /* store status for s390 */ #define KVM_S390_STORE_STATUS_NOADDR (-1ul) #define KVM_S390_STORE_STATUS_PREFIXED (-2ul) #define KVM_S390_STORE_STATUS _IOW(KVMIO, 0x95, unsigned long) /* initial ipl psw for s390 */ #define KVM_S390_SET_INITIAL_PSW _IOW(KVMIO, 0x96, struct kvm_s390_psw) /* initial reset for s390 */ #define KVM_S390_INITIAL_RESET _IO(KVMIO, 0x97) #define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state) #define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state) /* Available with KVM_CAP_USER_NMI */ #define KVM_NMI _IO(KVMIO, 0x9a) /* Available with KVM_CAP_SET_GUEST_DEBUG */ #define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug) /* MCE for x86 */ #define KVM_X86_SETUP_MCE _IOW(KVMIO, 0x9c, __u64) #define KVM_X86_GET_MCE_CAP_SUPPORTED _IOR(KVMIO, 0x9d, __u64) #define KVM_X86_SET_MCE _IOW(KVMIO, 0x9e, struct kvm_x86_mce) /* Available with KVM_CAP_VCPU_EVENTS */ #define KVM_GET_VCPU_EVENTS _IOR(KVMIO, 0x9f, struct kvm_vcpu_events) #define KVM_SET_VCPU_EVENTS _IOW(KVMIO, 0xa0, struct kvm_vcpu_events) /* Available with KVM_CAP_DEBUGREGS */ #define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs) #define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs) /* * vcpu version available with KVM_ENABLE_CAP * vm version available with KVM_CAP_ENABLE_CAP_VM */ #define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap) /* Available with KVM_CAP_XSAVE */ #define KVM_GET_XSAVE _IOR(KVMIO, 0xa4, struct kvm_xsave) #define KVM_SET_XSAVE _IOW(KVMIO, 0xa5, struct kvm_xsave) /* Available with KVM_CAP_XCRS */ #define KVM_GET_XCRS _IOR(KVMIO, 0xa6, struct kvm_xcrs) #define KVM_SET_XCRS _IOW(KVMIO, 0xa7, struct kvm_xcrs) /* Available with KVM_CAP_SW_TLB */ #define KVM_DIRTY_TLB _IOW(KVMIO, 0xaa, struct kvm_dirty_tlb) /* Available with KVM_CAP_ONE_REG */ #define KVM_GET_ONE_REG _IOW(KVMIO, 0xab, struct kvm_one_reg) #define KVM_SET_ONE_REG _IOW(KVMIO, 0xac, struct kvm_one_reg) /* VM is being stopped by host */ #define KVM_KVMCLOCK_CTRL _IO(KVMIO, 0xad) #define KVM_ARM_VCPU_INIT _IOW(KVMIO, 0xae, struct kvm_vcpu_init) #define KVM_ARM_PREFERRED_TARGET _IOR(KVMIO, 0xaf, struct kvm_vcpu_init) #define KVM_GET_REG_LIST _IOWR(KVMIO, 0xb0, struct kvm_reg_list) /* Available with KVM_CAP_S390_MEM_OP */ #define KVM_S390_MEM_OP _IOW(KVMIO, 0xb1, struct kvm_s390_mem_op) /* Available with KVM_CAP_S390_SKEYS */ #define KVM_S390_GET_SKEYS _IOW(KVMIO, 0xb2, struct kvm_s390_skeys) #define KVM_S390_SET_SKEYS _IOW(KVMIO, 0xb3, struct kvm_s390_skeys) /* Available with KVM_CAP_S390_INJECT_IRQ */ #define KVM_S390_IRQ _IOW(KVMIO, 0xb4, struct kvm_s390_irq) /* Available with KVM_CAP_S390_IRQ_STATE */ #define KVM_S390_SET_IRQ_STATE _IOW(KVMIO, 0xb5, struct kvm_s390_irq_state) #define KVM_S390_GET_IRQ_STATE _IOW(KVMIO, 0xb6, struct kvm_s390_irq_state) /* Available with KVM_CAP_X86_SMM */ #define KVM_SMI _IO(KVMIO, 0xb7) /* Available with KVM_CAP_S390_CMMA_MIGRATION */ #define KVM_S390_GET_CMMA_BITS _IOWR(KVMIO, 0xb8, struct kvm_s390_cmma_log) #define KVM_S390_SET_CMMA_BITS _IOW(KVMIO, 0xb9, struct kvm_s390_cmma_log) /* Memory Encryption Commands */ #define KVM_MEMORY_ENCRYPT_OP _IOWR(KVMIO, 0xba, unsigned long) struct kvm_enc_region { __u64 addr; __u64 size; }; #define KVM_MEMORY_ENCRYPT_REG_REGION _IOR(KVMIO, 0xbb, struct kvm_enc_region) #define KVM_MEMORY_ENCRYPT_UNREG_REGION _IOR(KVMIO, 0xbc, struct kvm_enc_region) /* Available with KVM_CAP_HYPERV_EVENTFD */ #define KVM_HYPERV_EVENTFD _IOW(KVMIO, 0xbd, struct kvm_hyperv_eventfd) /* Available with KVM_CAP_NESTED_STATE */ #define KVM_GET_NESTED_STATE _IOWR(KVMIO, 0xbe, struct kvm_nested_state) #define KVM_SET_NESTED_STATE _IOW(KVMIO, 0xbf, struct kvm_nested_state) /* Secure Encrypted Virtualization command */ enum sev_cmd_id { /* Guest initialization commands */ KVM_SEV_INIT = 0, KVM_SEV_ES_INIT, /* Guest launch commands */ KVM_SEV_LAUNCH_START, KVM_SEV_LAUNCH_UPDATE_DATA, KVM_SEV_LAUNCH_UPDATE_VMSA, KVM_SEV_LAUNCH_SECRET, KVM_SEV_LAUNCH_MEASURE, KVM_SEV_LAUNCH_FINISH, /* Guest migration commands (outgoing) */ KVM_SEV_SEND_START, KVM_SEV_SEND_UPDATE_DATA, KVM_SEV_SEND_UPDATE_VMSA, KVM_SEV_SEND_FINISH, /* Guest migration commands (incoming) */ KVM_SEV_RECEIVE_START, KVM_SEV_RECEIVE_UPDATE_DATA, KVM_SEV_RECEIVE_UPDATE_VMSA, KVM_SEV_RECEIVE_FINISH, /* Guest status and debug commands */ KVM_SEV_GUEST_STATUS, KVM_SEV_DBG_DECRYPT, KVM_SEV_DBG_ENCRYPT, /* Guest certificates commands */ KVM_SEV_CERT_EXPORT, KVM_SEV_NR_MAX, }; struct kvm_sev_cmd { __u32 id; __u64 data; __u32 error; __u32 sev_fd; }; struct kvm_sev_launch_start { __u32 handle; __u32 policy; __u64 dh_uaddr; __u32 dh_len; __u64 session_uaddr; __u32 session_len; }; struct kvm_sev_launch_update_data { __u64 uaddr; __u32 len; }; struct kvm_sev_launch_secret { __u64 hdr_uaddr; __u32 hdr_len; __u64 guest_uaddr; __u32 guest_len; __u64 trans_uaddr; __u32 trans_len; }; struct kvm_sev_launch_measure { __u64 uaddr; __u32 len; }; struct kvm_sev_guest_status { __u32 handle; __u32 policy; __u32 state; }; struct kvm_sev_dbg { __u64 src_uaddr; __u64 dst_uaddr; __u32 len; }; #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) #define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1) #define KVM_DEV_ASSIGN_MASK_INTX (1 << 2) struct kvm_assigned_pci_dev { __u32 assigned_dev_id; __u32 busnr; __u32 devfn; __u32 flags; __u32 segnr; union { __u32 reserved[11]; }; }; #define KVM_DEV_IRQ_HOST_INTX (1 << 0) #define KVM_DEV_IRQ_HOST_MSI (1 << 1) #define KVM_DEV_IRQ_HOST_MSIX (1 << 2) #define KVM_DEV_IRQ_GUEST_INTX (1 << 8) #define KVM_DEV_IRQ_GUEST_MSI (1 << 9) #define KVM_DEV_IRQ_GUEST_MSIX (1 << 10) #define KVM_DEV_IRQ_HOST_MASK 0x00ff #define KVM_DEV_IRQ_GUEST_MASK 0xff00 struct kvm_assigned_irq { __u32 assigned_dev_id; __u32 host_irq; /* ignored (legacy field) */ __u32 guest_irq; __u32 flags; union { __u32 reserved[12]; }; }; struct kvm_assigned_msix_nr { __u32 assigned_dev_id; __u16 entry_nr; __u16 padding; }; #define KVM_MAX_MSIX_PER_DEV 256 struct kvm_assigned_msix_entry { __u32 assigned_dev_id; __u32 gsi; __u16 entry; /* The index of entry in the MSI-X table */ __u16 padding[3]; }; #define KVM_X2APIC_API_USE_32BIT_IDS (1ULL << 0) #define KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK (1ULL << 1) /* Available with KVM_CAP_ARM_USER_IRQ */ /* Bits for run->s.regs.device_irq_level */ #define KVM_ARM_DEV_EL1_VTIMER (1 << 0) #define KVM_ARM_DEV_EL1_PTIMER (1 << 1) #define KVM_ARM_DEV_PMU (1 << 2) struct kvm_hyperv_eventfd { __u32 conn_id; __s32 fd; __u32 flags; __u32 padding[3]; }; #define KVM_HYPERV_CONN_ID_MASK 0x00ffffff #define KVM_HYPERV_EVENTFD_DEASSIGN (1 << 0) #endif /* __LINUX_KVM_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/limits.h��������������������������������������������������������������������������������������0000644�����������������00000001651�14763166027�0007374 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_LIMITS_H #define _LINUX_LIMITS_H #define NR_OPEN 1024 #define NGROUPS_MAX 65536 /* supplemental group IDs are available */ #define ARG_MAX 131072 /* # bytes of args + environ for exec() */ #define LINK_MAX 127 /* # links a file may have */ #define MAX_CANON 255 /* size of the canonical input queue */ #define MAX_INPUT 255 /* size of the type-ahead buffer */ #define NAME_MAX 255 /* # chars in a file name */ #define PATH_MAX 4096 /* # chars in a path name including nul */ #define PIPE_BUF 4096 /* # bytes in atomic write to a pipe */ #define XATTR_NAME_MAX 255 /* # chars in an extended attribute name */ #define XATTR_SIZE_MAX 65536 /* size of an extended attribute value (64k) */ #define XATTR_LIST_MAX 65536 /* size of extended attribute namelist (64k) */ #define RTSIG_MAX 32 #endif ���������������������������������������������������������������������������������������linux/kd.h������������������������������������������������������������������������������������������0000644�����������������00000014155�14763166027�0006474 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_KD_H #define _LINUX_KD_H #include <linux/types.h> /* 0x4B is 'K', to avoid collision with termios and vt */ #define GIO_FONT 0x4B60 /* gets font in expanded form */ #define PIO_FONT 0x4B61 /* use font in expanded form */ #define GIO_FONTX 0x4B6B /* get font using struct consolefontdesc */ #define PIO_FONTX 0x4B6C /* set font using struct consolefontdesc */ struct consolefontdesc { unsigned short charcount; /* characters in font (256 or 512) */ unsigned short charheight; /* scan lines per character (1-32) */ char *chardata; /* font data in expanded form */ }; #define PIO_FONTRESET 0x4B6D /* reset to default font */ #define GIO_CMAP 0x4B70 /* gets colour palette on VGA+ */ #define PIO_CMAP 0x4B71 /* sets colour palette on VGA+ */ #define KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ #define KDMKTONE 0x4B30 /* generate tone */ #define KDGETLED 0x4B31 /* return current led state */ #define KDSETLED 0x4B32 /* set led state [lights, not flags] */ #define LED_SCR 0x01 /* scroll lock led */ #define LED_NUM 0x02 /* num lock led */ #define LED_CAP 0x04 /* caps lock led */ #define KDGKBTYPE 0x4B33 /* get keyboard type */ #define KB_84 0x01 #define KB_101 0x02 /* this is what we always answer */ #define KB_OTHER 0x03 #define KDADDIO 0x4B34 /* add i/o port as valid */ #define KDDELIO 0x4B35 /* del i/o port as valid */ #define KDENABIO 0x4B36 /* enable i/o to video board */ #define KDDISABIO 0x4B37 /* disable i/o to video board */ #define KDSETMODE 0x4B3A /* set text/graphics mode */ #define KD_TEXT 0x00 #define KD_GRAPHICS 0x01 #define KD_TEXT0 0x02 /* obsolete */ #define KD_TEXT1 0x03 /* obsolete */ #define KDGETMODE 0x4B3B /* get current mode */ #define KDMAPDISP 0x4B3C /* map display into address space */ #define KDUNMAPDISP 0x4B3D /* unmap display from address space */ typedef char scrnmap_t; #define E_TABSZ 256 #define GIO_SCRNMAP 0x4B40 /* get screen mapping from kernel */ #define PIO_SCRNMAP 0x4B41 /* put screen mapping table in kernel */ #define GIO_UNISCRNMAP 0x4B69 /* get full Unicode screen mapping */ #define PIO_UNISCRNMAP 0x4B6A /* set full Unicode screen mapping */ #define GIO_UNIMAP 0x4B66 /* get unicode-to-font mapping from kernel */ struct unipair { unsigned short unicode; unsigned short fontpos; }; struct unimapdesc { unsigned short entry_ct; struct unipair *entries; }; #define PIO_UNIMAP 0x4B67 /* put unicode-to-font mapping in kernel */ #define PIO_UNIMAPCLR 0x4B68 /* clear table, possibly advise hash algorithm */ struct unimapinit { unsigned short advised_hashsize; /* 0 if no opinion */ unsigned short advised_hashstep; /* 0 if no opinion */ unsigned short advised_hashlevel; /* 0 if no opinion */ }; #define UNI_DIRECT_BASE 0xF000 /* start of Direct Font Region */ #define UNI_DIRECT_MASK 0x01FF /* Direct Font Region bitmask */ #define K_RAW 0x00 #define K_XLATE 0x01 #define K_MEDIUMRAW 0x02 #define K_UNICODE 0x03 #define K_OFF 0x04 #define KDGKBMODE 0x4B44 /* gets current keyboard mode */ #define KDSKBMODE 0x4B45 /* sets current keyboard mode */ #define K_METABIT 0x03 #define K_ESCPREFIX 0x04 #define KDGKBMETA 0x4B62 /* gets meta key handling mode */ #define KDSKBMETA 0x4B63 /* sets meta key handling mode */ #define K_SCROLLLOCK 0x01 #define K_NUMLOCK 0x02 #define K_CAPSLOCK 0x04 #define KDGKBLED 0x4B64 /* get led flags (not lights) */ #define KDSKBLED 0x4B65 /* set led flags (not lights) */ struct kbentry { unsigned char kb_table; unsigned char kb_index; unsigned short kb_value; }; #define K_NORMTAB 0x00 #define K_SHIFTTAB 0x01 #define K_ALTTAB 0x02 #define K_ALTSHIFTTAB 0x03 #define KDGKBENT 0x4B46 /* gets one entry in translation table */ #define KDSKBENT 0x4B47 /* sets one entry in translation table */ struct kbsentry { unsigned char kb_func; unsigned char kb_string[512]; }; #define KDGKBSENT 0x4B48 /* gets one function key string entry */ #define KDSKBSENT 0x4B49 /* sets one function key string entry */ struct kbdiacr { unsigned char diacr, base, result; }; struct kbdiacrs { unsigned int kb_cnt; /* number of entries in following array */ struct kbdiacr kbdiacr[256]; /* MAX_DIACR from keyboard.h */ }; #define KDGKBDIACR 0x4B4A /* read kernel accent table */ #define KDSKBDIACR 0x4B4B /* write kernel accent table */ struct kbdiacruc { unsigned int diacr, base, result; }; struct kbdiacrsuc { unsigned int kb_cnt; /* number of entries in following array */ struct kbdiacruc kbdiacruc[256]; /* MAX_DIACR from keyboard.h */ }; #define KDGKBDIACRUC 0x4BFA /* read kernel accent table - UCS */ #define KDSKBDIACRUC 0x4BFB /* write kernel accent table - UCS */ struct kbkeycode { unsigned int scancode, keycode; }; #define KDGETKEYCODE 0x4B4C /* read kernel keycode table entry */ #define KDSETKEYCODE 0x4B4D /* write kernel keycode table entry */ #define KDSIGACCEPT 0x4B4E /* accept kbd generated signals */ struct kbd_repeat { int delay; /* in msec; <= 0: don't change */ int period; /* in msec; <= 0: don't change */ /* earlier this field was misnamed "rate" */ }; #define KDKBDREP 0x4B52 /* set keyboard delay/repeat rate; * actually used values are returned */ #define KDFONTOP 0x4B72 /* font operations */ struct console_font_op { unsigned int op; /* operation code KD_FONT_OP_* */ unsigned int flags; /* KD_FONT_FLAG_* */ unsigned int width, height; /* font size */ unsigned int charcount; unsigned char *data; /* font data with height fixed to 32 */ }; struct console_font { unsigned int width, height; /* font size */ unsigned int charcount; unsigned char *data; /* font data with height fixed to 32 */ }; #define KD_FONT_OP_SET 0 /* Set font */ #define KD_FONT_OP_GET 1 /* Get font */ #define KD_FONT_OP_SET_DEFAULT 2 /* Set font to default, data points to name / NULL */ #define KD_FONT_OP_COPY 3 /* Copy from another console */ #define KD_FONT_FLAG_DONT_RECALC 1 /* Don't recalculate hw charcell size [compat] */ /* note: 0x4B00-0x4B4E all have had a value at some time; don't reuse for the time being */ /* note: 0x4B60-0x4B6D, 0x4B70-0x4B72 used above */ #endif /* _LINUX_KD_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/baycom.h��������������������������������������������������������������������������������������0000644�����������������00000001563�14763166027�0007347 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * The Linux BAYCOM driver for the Baycom serial 1200 baud modem * and the parallel 9600 baud modem * (C) 1997-1998 by Thomas Sailer, HB9JNX/AE4WA */ #ifndef _BAYCOM_H #define _BAYCOM_H /* -------------------------------------------------------------------- */ /* * structs for the IOCTL commands */ struct baycom_debug_data { unsigned long debug1; unsigned long debug2; long debug3; }; struct baycom_ioctl { int cmd; union { struct baycom_debug_data dbg; } data; }; /* -------------------------------------------------------------------- */ /* * ioctl values change for baycom */ #define BAYCOMCTL_GETDEBUG 0x92 /* -------------------------------------------------------------------- */ #endif /* _BAYCOM_H */ /* --------------------------------------------------------------------- */ ���������������������������������������������������������������������������������������������������������������������������������������������linux/audit.h���������������������������������������������������������������������������������������0000644�����������������00000046550�14763166027�0007210 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* audit.h -- Auditing support * * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina. * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Written by Rickard E. (Rik) Faith <faith@redhat.com> * */ #ifndef _LINUX_AUDIT_H_ #define _LINUX_AUDIT_H_ #include <linux/types.h> #include <linux/elf-em.h> /* The netlink messages for the audit system is divided into blocks: * 1000 - 1099 are for commanding the audit system * 1100 - 1199 user space trusted application messages * 1200 - 1299 messages internal to the audit daemon * 1300 - 1399 audit event messages * 1400 - 1499 SE Linux use * 1500 - 1599 kernel LSPP events * 1600 - 1699 kernel crypto events * 1700 - 1799 kernel anomaly records * 1800 - 1899 kernel integrity events * 1900 - 1999 future kernel use * 2000 is for otherwise unclassified kernel audit messages (legacy) * 2001 - 2099 unused (kernel) * 2100 - 2199 user space anomaly records * 2200 - 2299 user space actions taken in response to anomalies * 2300 - 2399 user space generated LSPP events * 2400 - 2499 user space crypto events * 2500 - 2999 future user space (maybe integrity labels and related events) * * Messages from 1000-1199 are bi-directional. 1200-1299 & 2100 - 2999 are * exclusively user space. 1300-2099 is kernel --> user space * communication. */ #define AUDIT_GET 1000 /* Get status */ #define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */ #define AUDIT_LIST 1002 /* List syscall rules -- deprecated */ #define AUDIT_ADD 1003 /* Add syscall rule -- deprecated */ #define AUDIT_DEL 1004 /* Delete syscall rule -- deprecated */ #define AUDIT_USER 1005 /* Message from userspace -- deprecated */ #define AUDIT_LOGIN 1006 /* Define the login id and information */ #define AUDIT_WATCH_INS 1007 /* Insert file/dir watch entry */ #define AUDIT_WATCH_REM 1008 /* Remove file/dir watch entry */ #define AUDIT_WATCH_LIST 1009 /* List all file/dir watches */ #define AUDIT_SIGNAL_INFO 1010 /* Get info about sender of signal to auditd */ #define AUDIT_ADD_RULE 1011 /* Add syscall filtering rule */ #define AUDIT_DEL_RULE 1012 /* Delete syscall filtering rule */ #define AUDIT_LIST_RULES 1013 /* List syscall filtering rules */ #define AUDIT_TRIM 1014 /* Trim junk from watched tree */ #define AUDIT_MAKE_EQUIV 1015 /* Append to watched tree */ #define AUDIT_TTY_GET 1016 /* Get TTY auditing status */ #define AUDIT_TTY_SET 1017 /* Set TTY auditing status */ #define AUDIT_SET_FEATURE 1018 /* Turn an audit feature on or off */ #define AUDIT_GET_FEATURE 1019 /* Get which features are enabled */ #define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */ #define AUDIT_USER_AVC 1107 /* We filter this differently */ #define AUDIT_USER_TTY 1124 /* Non-ICANON TTY input meaning */ #define AUDIT_LAST_USER_MSG 1199 #define AUDIT_FIRST_USER_MSG2 2100 /* More user space messages */ #define AUDIT_LAST_USER_MSG2 2999 #define AUDIT_DAEMON_START 1200 /* Daemon startup record */ #define AUDIT_DAEMON_END 1201 /* Daemon normal stop record */ #define AUDIT_DAEMON_ABORT 1202 /* Daemon error stop record */ #define AUDIT_DAEMON_CONFIG 1203 /* Daemon config change */ #define AUDIT_SYSCALL 1300 /* Syscall event */ /* #define AUDIT_FS_WATCH 1301 * Deprecated */ #define AUDIT_PATH 1302 /* Filename path information */ #define AUDIT_IPC 1303 /* IPC record */ #define AUDIT_SOCKETCALL 1304 /* sys_socketcall arguments */ #define AUDIT_CONFIG_CHANGE 1305 /* Audit system configuration change */ #define AUDIT_SOCKADDR 1306 /* sockaddr copied as syscall arg */ #define AUDIT_CWD 1307 /* Current working directory */ #define AUDIT_EXECVE 1309 /* execve arguments */ #define AUDIT_IPC_SET_PERM 1311 /* IPC new permissions record type */ #define AUDIT_MQ_OPEN 1312 /* POSIX MQ open record type */ #define AUDIT_MQ_SENDRECV 1313 /* POSIX MQ send/receive record type */ #define AUDIT_MQ_NOTIFY 1314 /* POSIX MQ notify record type */ #define AUDIT_MQ_GETSETATTR 1315 /* POSIX MQ get/set attribute record type */ #define AUDIT_KERNEL_OTHER 1316 /* For use by 3rd party modules */ #define AUDIT_FD_PAIR 1317 /* audit record for pipe/socketpair */ #define AUDIT_OBJ_PID 1318 /* ptrace target */ #define AUDIT_TTY 1319 /* Input on an administrative TTY */ #define AUDIT_EOE 1320 /* End of multi-record event */ #define AUDIT_BPRM_FCAPS 1321 /* Information about fcaps increasing perms */ #define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */ #define AUDIT_MMAP 1323 /* Record showing descriptor and flags in mmap */ #define AUDIT_NETFILTER_PKT 1324 /* Packets traversing netfilter chains */ #define AUDIT_NETFILTER_CFG 1325 /* Netfilter chain modifications */ #define AUDIT_SECCOMP 1326 /* Secure Computing event */ #define AUDIT_PROCTITLE 1327 /* Proctitle emit event */ #define AUDIT_FEATURE_CHANGE 1328 /* audit log listing feature changes */ #define AUDIT_REPLACE 1329 /* Replace auditd if this packet unanswerd */ #define AUDIT_KERN_MODULE 1330 /* Kernel Module events */ #define AUDIT_FANOTIFY 1331 /* Fanotify access decision */ #define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ #define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ #define AUDIT_AVC_PATH 1402 /* dentry, vfsmount pair from avc */ #define AUDIT_MAC_POLICY_LOAD 1403 /* Policy file load */ #define AUDIT_MAC_STATUS 1404 /* Changed enforcing,permissive,off */ #define AUDIT_MAC_CONFIG_CHANGE 1405 /* Changes to booleans */ #define AUDIT_MAC_UNLBL_ALLOW 1406 /* NetLabel: allow unlabeled traffic */ #define AUDIT_MAC_CIPSOV4_ADD 1407 /* NetLabel: add CIPSOv4 DOI entry */ #define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */ #define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */ #define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */ #define AUDIT_MAC_IPSEC_ADDSA 1411 /* Not used */ #define AUDIT_MAC_IPSEC_DELSA 1412 /* Not used */ #define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Not used */ #define AUDIT_MAC_IPSEC_DELSPD 1414 /* Not used */ #define AUDIT_MAC_IPSEC_EVENT 1415 /* Audit an IPSec event */ #define AUDIT_MAC_UNLBL_STCADD 1416 /* NetLabel: add a static label */ #define AUDIT_MAC_UNLBL_STCDEL 1417 /* NetLabel: del a static label */ #define AUDIT_MAC_CALIPSO_ADD 1418 /* NetLabel: add CALIPSO DOI entry */ #define AUDIT_MAC_CALIPSO_DEL 1419 /* NetLabel: del CALIPSO DOI entry */ #define AUDIT_FIRST_KERN_ANOM_MSG 1700 #define AUDIT_LAST_KERN_ANOM_MSG 1799 #define AUDIT_ANOM_PROMISCUOUS 1700 /* Device changed promiscuous mode */ #define AUDIT_ANOM_ABEND 1701 /* Process ended abnormally */ #define AUDIT_ANOM_LINK 1702 /* Suspicious use of file links */ #define AUDIT_INTEGRITY_DATA 1800 /* Data integrity verification */ #define AUDIT_INTEGRITY_METADATA 1801 /* Metadata integrity verification */ #define AUDIT_INTEGRITY_STATUS 1802 /* Integrity enable status */ #define AUDIT_INTEGRITY_HASH 1803 /* Integrity HASH type */ #define AUDIT_INTEGRITY_PCR 1804 /* PCR invalidation msgs */ #define AUDIT_INTEGRITY_RULE 1805 /* policy rule */ #define AUDIT_INTEGRITY_EVM_XATTR 1806 /* New EVM-covered xattr */ #define AUDIT_INTEGRITY_POLICY_RULE 1807 /* IMA policy rules */ #define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */ /* Rule flags */ #define AUDIT_FILTER_USER 0x00 /* Apply rule to user-generated messages */ #define AUDIT_FILTER_TASK 0x01 /* Apply rule at task creation (not syscall) */ #define AUDIT_FILTER_ENTRY 0x02 /* Apply rule at syscall entry */ #define AUDIT_FILTER_WATCH 0x03 /* Apply rule to file system watches */ #define AUDIT_FILTER_EXIT 0x04 /* Apply rule at syscall exit */ #define AUDIT_FILTER_EXCLUDE 0x05 /* Apply rule before record creation */ #define AUDIT_FILTER_TYPE AUDIT_FILTER_EXCLUDE /* obsolete misleading naming */ #define AUDIT_FILTER_FS 0x06 /* Apply rule at __audit_inode_child */ #define AUDIT_NR_FILTERS 7 #define AUDIT_FILTER_PREPEND 0x10 /* Prepend to front of list */ /* Rule actions */ #define AUDIT_NEVER 0 /* Do not build context if rule matches */ #define AUDIT_POSSIBLE 1 /* Build context if rule matches */ #define AUDIT_ALWAYS 2 /* Generate audit record if rule matches */ /* Rule structure sizes -- if these change, different AUDIT_ADD and * AUDIT_LIST commands must be implemented. */ #define AUDIT_MAX_FIELDS 64 #define AUDIT_MAX_KEY_LEN 256 #define AUDIT_BITMASK_SIZE 64 #define AUDIT_WORD(nr) ((__u32)((nr)/32)) #define AUDIT_BIT(nr) (1U << ((nr) - AUDIT_WORD(nr)*32)) #define AUDIT_SYSCALL_CLASSES 16 #define AUDIT_CLASS_DIR_WRITE 0 #define AUDIT_CLASS_DIR_WRITE_32 1 #define AUDIT_CLASS_CHATTR 2 #define AUDIT_CLASS_CHATTR_32 3 #define AUDIT_CLASS_READ 4 #define AUDIT_CLASS_READ_32 5 #define AUDIT_CLASS_WRITE 6 #define AUDIT_CLASS_WRITE_32 7 #define AUDIT_CLASS_SIGNAL 8 #define AUDIT_CLASS_SIGNAL_32 9 /* This bitmask is used to validate user input. It represents all bits that * are currently used in an audit field constant understood by the kernel. * If you are adding a new #define AUDIT_<whatever>, please ensure that * AUDIT_UNUSED_BITS is updated if need be. */ #define AUDIT_UNUSED_BITS 0x07FFFC00 /* AUDIT_FIELD_COMPARE rule list */ #define AUDIT_COMPARE_UID_TO_OBJ_UID 1 #define AUDIT_COMPARE_GID_TO_OBJ_GID 2 #define AUDIT_COMPARE_EUID_TO_OBJ_UID 3 #define AUDIT_COMPARE_EGID_TO_OBJ_GID 4 #define AUDIT_COMPARE_AUID_TO_OBJ_UID 5 #define AUDIT_COMPARE_SUID_TO_OBJ_UID 6 #define AUDIT_COMPARE_SGID_TO_OBJ_GID 7 #define AUDIT_COMPARE_FSUID_TO_OBJ_UID 8 #define AUDIT_COMPARE_FSGID_TO_OBJ_GID 9 #define AUDIT_COMPARE_UID_TO_AUID 10 #define AUDIT_COMPARE_UID_TO_EUID 11 #define AUDIT_COMPARE_UID_TO_FSUID 12 #define AUDIT_COMPARE_UID_TO_SUID 13 #define AUDIT_COMPARE_AUID_TO_FSUID 14 #define AUDIT_COMPARE_AUID_TO_SUID 15 #define AUDIT_COMPARE_AUID_TO_EUID 16 #define AUDIT_COMPARE_EUID_TO_SUID 17 #define AUDIT_COMPARE_EUID_TO_FSUID 18 #define AUDIT_COMPARE_SUID_TO_FSUID 19 #define AUDIT_COMPARE_GID_TO_EGID 20 #define AUDIT_COMPARE_GID_TO_FSGID 21 #define AUDIT_COMPARE_GID_TO_SGID 22 #define AUDIT_COMPARE_EGID_TO_FSGID 23 #define AUDIT_COMPARE_EGID_TO_SGID 24 #define AUDIT_COMPARE_SGID_TO_FSGID 25 #define AUDIT_MAX_FIELD_COMPARE AUDIT_COMPARE_SGID_TO_FSGID /* Rule fields */ /* These are useful when checking the * task structure at task creation time * (AUDIT_PER_TASK). */ #define AUDIT_PID 0 #define AUDIT_UID 1 #define AUDIT_EUID 2 #define AUDIT_SUID 3 #define AUDIT_FSUID 4 #define AUDIT_GID 5 #define AUDIT_EGID 6 #define AUDIT_SGID 7 #define AUDIT_FSGID 8 #define AUDIT_LOGINUID 9 #define AUDIT_PERS 10 #define AUDIT_ARCH 11 #define AUDIT_MSGTYPE 12 #define AUDIT_SUBJ_USER 13 /* security label user */ #define AUDIT_SUBJ_ROLE 14 /* security label role */ #define AUDIT_SUBJ_TYPE 15 /* security label type */ #define AUDIT_SUBJ_SEN 16 /* security label sensitivity label */ #define AUDIT_SUBJ_CLR 17 /* security label clearance label */ #define AUDIT_PPID 18 #define AUDIT_OBJ_USER 19 #define AUDIT_OBJ_ROLE 20 #define AUDIT_OBJ_TYPE 21 #define AUDIT_OBJ_LEV_LOW 22 #define AUDIT_OBJ_LEV_HIGH 23 #define AUDIT_LOGINUID_SET 24 #define AUDIT_SESSIONID 25 /* Session ID */ #define AUDIT_FSTYPE 26 /* FileSystem Type */ /* These are ONLY useful when checking * at syscall exit time (AUDIT_AT_EXIT). */ #define AUDIT_DEVMAJOR 100 #define AUDIT_DEVMINOR 101 #define AUDIT_INODE 102 #define AUDIT_EXIT 103 #define AUDIT_SUCCESS 104 /* exit >= 0; value ignored */ #define AUDIT_WATCH 105 #define AUDIT_PERM 106 #define AUDIT_DIR 107 #define AUDIT_FILETYPE 108 #define AUDIT_OBJ_UID 109 #define AUDIT_OBJ_GID 110 #define AUDIT_FIELD_COMPARE 111 #define AUDIT_EXE 112 #define AUDIT_ARG0 200 #define AUDIT_ARG1 (AUDIT_ARG0+1) #define AUDIT_ARG2 (AUDIT_ARG0+2) #define AUDIT_ARG3 (AUDIT_ARG0+3) #define AUDIT_FILTERKEY 210 #define AUDIT_NEGATE 0x80000000 /* These are the supported operators. * 4 2 1 8 * = > < ? * ---------- * 0 0 0 0 00 nonsense * 0 0 0 1 08 & bit mask * 0 0 1 0 10 < * 0 1 0 0 20 > * 0 1 1 0 30 != * 1 0 0 0 40 = * 1 0 0 1 48 &= bit test * 1 0 1 0 50 <= * 1 1 0 0 60 >= * 1 1 1 1 78 all operators */ #define AUDIT_BIT_MASK 0x08000000 #define AUDIT_LESS_THAN 0x10000000 #define AUDIT_GREATER_THAN 0x20000000 #define AUDIT_NOT_EQUAL 0x30000000 #define AUDIT_EQUAL 0x40000000 #define AUDIT_BIT_TEST (AUDIT_BIT_MASK|AUDIT_EQUAL) #define AUDIT_LESS_THAN_OR_EQUAL (AUDIT_LESS_THAN|AUDIT_EQUAL) #define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL) #define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL|AUDIT_BIT_MASK) enum { Audit_equal, Audit_not_equal, Audit_bitmask, Audit_bittest, Audit_lt, Audit_gt, Audit_le, Audit_ge, Audit_bad }; /* Status symbols */ /* Mask values */ #define AUDIT_STATUS_ENABLED 0x0001 #define AUDIT_STATUS_FAILURE 0x0002 #define AUDIT_STATUS_PID 0x0004 #define AUDIT_STATUS_RATE_LIMIT 0x0008 #define AUDIT_STATUS_BACKLOG_LIMIT 0x0010 #define AUDIT_STATUS_BACKLOG_WAIT_TIME 0x0020 #define AUDIT_STATUS_LOST 0x0040 #define AUDIT_FEATURE_BITMAP_BACKLOG_LIMIT 0x00000001 #define AUDIT_FEATURE_BITMAP_BACKLOG_WAIT_TIME 0x00000002 #define AUDIT_FEATURE_BITMAP_EXECUTABLE_PATH 0x00000004 #define AUDIT_FEATURE_BITMAP_EXCLUDE_EXTEND 0x00000008 #define AUDIT_FEATURE_BITMAP_SESSIONID_FILTER 0x00000010 #define AUDIT_FEATURE_BITMAP_LOST_RESET 0x00000020 #define AUDIT_FEATURE_BITMAP_FILTER_FS 0x00000040 #define AUDIT_FEATURE_BITMAP_ALL (AUDIT_FEATURE_BITMAP_BACKLOG_LIMIT | \ AUDIT_FEATURE_BITMAP_BACKLOG_WAIT_TIME | \ AUDIT_FEATURE_BITMAP_EXECUTABLE_PATH | \ AUDIT_FEATURE_BITMAP_EXCLUDE_EXTEND | \ AUDIT_FEATURE_BITMAP_SESSIONID_FILTER | \ AUDIT_FEATURE_BITMAP_LOST_RESET | \ AUDIT_FEATURE_BITMAP_FILTER_FS) /* deprecated: AUDIT_VERSION_* */ #define AUDIT_VERSION_LATEST AUDIT_FEATURE_BITMAP_ALL #define AUDIT_VERSION_BACKLOG_LIMIT AUDIT_FEATURE_BITMAP_BACKLOG_LIMIT #define AUDIT_VERSION_BACKLOG_WAIT_TIME AUDIT_FEATURE_BITMAP_BACKLOG_WAIT_TIME /* Failure-to-log actions */ #define AUDIT_FAIL_SILENT 0 #define AUDIT_FAIL_PRINTK 1 #define AUDIT_FAIL_PANIC 2 /* * These bits disambiguate different calling conventions that share an * ELF machine type, bitness, and endianness */ #define __AUDIT_ARCH_CONVENTION_MASK 0x30000000 #define __AUDIT_ARCH_CONVENTION_MIPS64_N32 0x20000000 /* distinguish syscall tables */ #define __AUDIT_ARCH_64BIT 0x80000000 #define __AUDIT_ARCH_LE 0x40000000 #define AUDIT_ARCH_AARCH64 (EM_AARCH64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_ALPHA (EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_ARM (EM_ARM|__AUDIT_ARCH_LE) #define AUDIT_ARCH_ARMEB (EM_ARM) #define AUDIT_ARCH_CRIS (EM_CRIS|__AUDIT_ARCH_LE) #define AUDIT_ARCH_FRV (EM_FRV) #define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE) #define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_M32R (EM_M32R) #define AUDIT_ARCH_M68K (EM_68K) #define AUDIT_ARCH_MICROBLAZE (EM_MICROBLAZE) #define AUDIT_ARCH_MIPS (EM_MIPS) #define AUDIT_ARCH_MIPSEL (EM_MIPS|__AUDIT_ARCH_LE) #define AUDIT_ARCH_MIPS64 (EM_MIPS|__AUDIT_ARCH_64BIT) #define AUDIT_ARCH_MIPS64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|\ __AUDIT_ARCH_CONVENTION_MIPS64_N32) #define AUDIT_ARCH_MIPSEL64 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_MIPSEL64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE|\ __AUDIT_ARCH_CONVENTION_MIPS64_N32) #define AUDIT_ARCH_OPENRISC (EM_OPENRISC) #define AUDIT_ARCH_PARISC (EM_PARISC) #define AUDIT_ARCH_PARISC64 (EM_PARISC|__AUDIT_ARCH_64BIT) #define AUDIT_ARCH_PPC (EM_PPC) /* do not define AUDIT_ARCH_PPCLE since it is not supported by audit */ #define AUDIT_ARCH_PPC64 (EM_PPC64|__AUDIT_ARCH_64BIT) #define AUDIT_ARCH_PPC64LE (EM_PPC64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_S390 (EM_S390) #define AUDIT_ARCH_S390X (EM_S390|__AUDIT_ARCH_64BIT) #define AUDIT_ARCH_SH (EM_SH) #define AUDIT_ARCH_SHEL (EM_SH|__AUDIT_ARCH_LE) #define AUDIT_ARCH_SH64 (EM_SH|__AUDIT_ARCH_64BIT) #define AUDIT_ARCH_SHEL64 (EM_SH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_SPARC (EM_SPARC) #define AUDIT_ARCH_SPARC64 (EM_SPARCV9|__AUDIT_ARCH_64BIT) #define AUDIT_ARCH_TILEGX (EM_TILEGX|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_TILEGX32 (EM_TILEGX|__AUDIT_ARCH_LE) #define AUDIT_ARCH_TILEPRO (EM_TILEPRO|__AUDIT_ARCH_LE) #define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_PERM_EXEC 1 #define AUDIT_PERM_WRITE 2 #define AUDIT_PERM_READ 4 #define AUDIT_PERM_ATTR 8 /* MAX_AUDIT_MESSAGE_LENGTH is set in audit:lib/libaudit.h as: * 8970 // PATH_MAX*2+CONTEXT_SIZE*2+11+256+1 * max header+body+tailer: 44 + 29 + 32 + 262 + 7 + pad */ #define AUDIT_MESSAGE_TEXT_MAX 8560 /* Multicast Netlink socket groups (default up to 32) */ enum audit_nlgrps { AUDIT_NLGRP_NONE, /* Group 0 not used */ AUDIT_NLGRP_READLOG, /* "best effort" read only socket */ __AUDIT_NLGRP_MAX }; #define AUDIT_NLGRP_MAX (__AUDIT_NLGRP_MAX - 1) struct audit_status { __u32 mask; /* Bit mask for valid entries */ __u32 enabled; /* 1 = enabled, 0 = disabled */ __u32 failure; /* Failure-to-log action */ __u32 pid; /* pid of auditd process */ __u32 rate_limit; /* messages rate limit (per second) */ __u32 backlog_limit; /* waiting messages limit */ __u32 lost; /* messages lost */ __u32 backlog; /* messages waiting in queue */ union { __u32 version; /* deprecated: audit api version num */ __u32 feature_bitmap; /* bitmap of kernel audit features */ }; __u32 backlog_wait_time;/* message queue wait timeout */ }; struct audit_features { #define AUDIT_FEATURE_VERSION 1 __u32 vers; __u32 mask; /* which bits we are dealing with */ __u32 features; /* which feature to enable/disable */ __u32 lock; /* which features to lock */ }; #define AUDIT_FEATURE_ONLY_UNSET_LOGINUID 0 #define AUDIT_FEATURE_LOGINUID_IMMUTABLE 1 #define AUDIT_LAST_FEATURE AUDIT_FEATURE_LOGINUID_IMMUTABLE #define audit_feature_valid(x) ((x) >= 0 && (x) <= AUDIT_LAST_FEATURE) #define AUDIT_FEATURE_TO_MASK(x) (1 << ((x) & 31)) /* mask for __u32 */ struct audit_tty_status { __u32 enabled; /* 1 = enabled, 0 = disabled */ __u32 log_passwd; /* 1 = enabled, 0 = disabled */ }; #define AUDIT_UID_UNSET (unsigned int)-1 #define AUDIT_SID_UNSET ((unsigned int)-1) /* audit_rule_data supports filter rules with both integer and string * fields. It corresponds with AUDIT_ADD_RULE, AUDIT_DEL_RULE and * AUDIT_LIST_RULES requests. */ struct audit_rule_data { __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */ __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */ __u32 field_count; __u32 mask[AUDIT_BITMASK_SIZE]; /* syscall(s) affected */ __u32 fields[AUDIT_MAX_FIELDS]; __u32 values[AUDIT_MAX_FIELDS]; __u32 fieldflags[AUDIT_MAX_FIELDS]; __u32 buflen; /* total length of string fields */ char buf[0]; /* string fields buffer */ }; #endif /* _LINUX_AUDIT_H_ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������linux/cifs/cifs_mount.h�����������������������������������������������������������������������������0000644�����������������00000002311�14763166027�0011157 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * include/uapi/linux/cifs/cifs_mount.h * * Author(s): Scott Lovenberg (scott.lovenberg@gmail.com) * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library 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 Lesser General Public License for more details. */ #ifndef _CIFS_MOUNT_H #define _CIFS_MOUNT_H /* Max string lengths for cifs mounting options. */ #define CIFS_MAX_DOMAINNAME_LEN 256 /* max fully qualified domain name */ #define CIFS_MAX_USERNAME_LEN 256 /* reasonable max for current servers */ #define CIFS_MAX_PASSWORD_LEN 512 /* Windows max seems to be 256 wide chars */ #define CIFS_MAX_SHARE_LEN 256 /* reasonable max share name length */ #define CIFS_NI_MAXHOST 1024 /* max host name length (256 * 4 bytes) */ #endif /* _CIFS_MOUNT_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/atmbr2684.h�����������������������������������������������������������������������������������0000644�����������������00000006307�14763166027�0007527 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_ATMBR2684_H #define _LINUX_ATMBR2684_H #include <linux/types.h> #include <linux/atm.h> #include <linux/if.h> /* For IFNAMSIZ */ /* * Type of media we're bridging (ethernet, token ring, etc) Currently only * ethernet is supported */ #define BR2684_MEDIA_ETHERNET (0) /* 802.3 */ #define BR2684_MEDIA_802_4 (1) /* 802.4 */ #define BR2684_MEDIA_TR (2) /* 802.5 - token ring */ #define BR2684_MEDIA_FDDI (3) #define BR2684_MEDIA_802_6 (4) /* 802.6 */ /* used only at device creation: */ #define BR2684_FLAG_ROUTED (1<<16) /* payload is routed, not bridged */ /* * Is there FCS inbound on this VC? This currently isn't supported. */ #define BR2684_FCSIN_NO (0) #define BR2684_FCSIN_IGNORE (1) #define BR2684_FCSIN_VERIFY (2) /* * Is there FCS outbound on this VC? This currently isn't supported. */ #define BR2684_FCSOUT_NO (0) #define BR2684_FCSOUT_SENDZERO (1) #define BR2684_FCSOUT_GENERATE (2) /* * Does this VC include LLC encapsulation? */ #define BR2684_ENCAPS_VC (0) /* VC-mux */ #define BR2684_ENCAPS_LLC (1) #define BR2684_ENCAPS_AUTODETECT (2) /* Unsuported */ /* * Is this VC bridged or routed? */ #define BR2684_PAYLOAD_ROUTED (0) #define BR2684_PAYLOAD_BRIDGED (1) /* * This is for the ATM_NEWBACKENDIF call - these are like socket families: * the first element of the structure is the backend number and the rest * is per-backend specific */ struct atm_newif_br2684 { atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ int media; /* BR2684_MEDIA_*, flags in upper bits */ char ifname[IFNAMSIZ]; int mtu; }; /* * This structure is used to specify a br2684 interface - either by a * positive integer (returned by ATM_NEWBACKENDIF) or the interfaces name */ #define BR2684_FIND_BYNOTHING (0) #define BR2684_FIND_BYNUM (1) #define BR2684_FIND_BYIFNAME (2) struct br2684_if_spec { int method; /* BR2684_FIND_* */ union { char ifname[IFNAMSIZ]; int devnum; } spec; }; /* * This is for the ATM_SETBACKEND call - these are like socket families: * the first element of the structure is the backend number and the rest * is per-backend specific */ struct atm_backend_br2684 { atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ struct br2684_if_spec ifspec; int fcs_in; /* BR2684_FCSIN_* */ int fcs_out; /* BR2684_FCSOUT_* */ int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */ int encaps; /* BR2684_ENCAPS_* */ int has_vpiid; /* 1: use vpn_id - Unsupported */ __u8 vpn_id[7]; int send_padding; /* unsupported */ int min_size; /* we will pad smaller packets than this */ }; /* * The BR2684_SETFILT ioctl is an experimental mechanism for folks * terminating a large number of IP-only vcc's. When netfilter allows * efficient per-if in/out filters, this support will be removed */ struct br2684_filter { __be32 prefix; /* network byte order */ __be32 netmask; /* 0 = disable filter */ }; struct br2684_filter_set { struct br2684_if_spec ifspec; struct br2684_filter filter; }; enum br2684_payload { p_routed = BR2684_PAYLOAD_ROUTED, p_bridged = BR2684_PAYLOAD_BRIDGED, }; #define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \ struct br2684_filter_set) #endif /* _LINUX_ATMBR2684_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/iio/types.h�����������������������������������������������������������������������������������0000644�����������������00000003720�14763166027�0010016 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* industrial I/O data types needed both in and out of kernel * * Copyright (c) 2008 Jonathan Cameron * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #ifndef _IIO_TYPES_H_ #define _IIO_TYPES_H_ enum iio_chan_type { IIO_VOLTAGE, IIO_CURRENT, IIO_POWER, IIO_ACCEL, IIO_ANGL_VEL, IIO_MAGN, IIO_LIGHT, IIO_INTENSITY, IIO_PROXIMITY, IIO_TEMP, IIO_INCLI, IIO_ROT, IIO_ANGL, IIO_TIMESTAMP, IIO_CAPACITANCE, IIO_ALTVOLTAGE, IIO_CCT, IIO_PRESSURE, IIO_HUMIDITYRELATIVE, IIO_ACTIVITY, IIO_STEPS, IIO_ENERGY, IIO_DISTANCE, IIO_VELOCITY, IIO_CONCENTRATION, IIO_RESISTANCE, IIO_PH, IIO_UVINDEX, IIO_ELECTRICALCONDUCTIVITY, IIO_COUNT, IIO_INDEX, IIO_GRAVITY, IIO_POSITIONRELATIVE, IIO_PHASE, }; enum iio_modifier { IIO_NO_MOD, IIO_MOD_X, IIO_MOD_Y, IIO_MOD_Z, IIO_MOD_X_AND_Y, IIO_MOD_X_AND_Z, IIO_MOD_Y_AND_Z, IIO_MOD_X_AND_Y_AND_Z, IIO_MOD_X_OR_Y, IIO_MOD_X_OR_Z, IIO_MOD_Y_OR_Z, IIO_MOD_X_OR_Y_OR_Z, IIO_MOD_LIGHT_BOTH, IIO_MOD_LIGHT_IR, IIO_MOD_ROOT_SUM_SQUARED_X_Y, IIO_MOD_SUM_SQUARED_X_Y_Z, IIO_MOD_LIGHT_CLEAR, IIO_MOD_LIGHT_RED, IIO_MOD_LIGHT_GREEN, IIO_MOD_LIGHT_BLUE, IIO_MOD_QUATERNION, IIO_MOD_TEMP_AMBIENT, IIO_MOD_TEMP_OBJECT, IIO_MOD_NORTH_MAGN, IIO_MOD_NORTH_TRUE, IIO_MOD_NORTH_MAGN_TILT_COMP, IIO_MOD_NORTH_TRUE_TILT_COMP, IIO_MOD_RUNNING, IIO_MOD_JOGGING, IIO_MOD_WALKING, IIO_MOD_STILL, IIO_MOD_ROOT_SUM_SQUARED_X_Y_Z, IIO_MOD_I, IIO_MOD_Q, IIO_MOD_CO2, IIO_MOD_VOC, IIO_MOD_LIGHT_UV, IIO_MOD_LIGHT_DUV, }; enum iio_event_type { IIO_EV_TYPE_THRESH, IIO_EV_TYPE_MAG, IIO_EV_TYPE_ROC, IIO_EV_TYPE_THRESH_ADAPTIVE, IIO_EV_TYPE_MAG_ADAPTIVE, IIO_EV_TYPE_CHANGE, }; enum iio_event_direction { IIO_EV_DIR_EITHER, IIO_EV_DIR_RISING, IIO_EV_DIR_FALLING, IIO_EV_DIR_NONE, }; #endif /* _IIO_TYPES_H_ */ ������������������������������������������������linux/iio/events.h����������������������������������������������������������������������������������0000644�����������������00000002556�14763166027�0010164 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* The industrial I/O - event passing to userspace * * Copyright (c) 2008-2011 Jonathan Cameron * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #ifndef _IIO_EVENTS_H_ #define _IIO_EVENTS_H_ #include <linux/ioctl.h> #include <linux/types.h> /** * struct iio_event_data - The actual event being pushed to userspace * @id: event identifier * @timestamp: best estimate of time of event occurrence (often from * the interrupt handler) */ struct iio_event_data { __u64 id; __s64 timestamp; }; #define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int) #define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF) #define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0x7F) #define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF) /* Event code number extraction depends on which type of event we have. * Perhaps review this function in the future*/ #define IIO_EVENT_CODE_EXTRACT_CHAN(mask) ((__s16)(mask & 0xFFFF)) #define IIO_EVENT_CODE_EXTRACT_CHAN2(mask) ((__s16)(((mask) >> 16) & 0xFFFF)) #define IIO_EVENT_CODE_EXTRACT_MODIFIER(mask) ((mask >> 40) & 0xFF) #define IIO_EVENT_CODE_EXTRACT_DIFF(mask) (((mask) >> 55) & 0x1) #endif /* _IIO_EVENTS_H_ */ ��������������������������������������������������������������������������������������������������������������������������������������������������linux/udp.h�����������������������������������������������������������������������������������������0000644�����������������00000003012�14763166027�0006654 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Definitions for the UDP protocol. * * Version: @(#)udp.h 1.0.2 04/28/93 * * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * * 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. */ #ifndef _LINUX_UDP_H #define _LINUX_UDP_H #include <linux/types.h> struct udphdr { __be16 source; __be16 dest; __be16 len; __sum16 check; }; /* UDP socket options */ #define UDP_CORK 1 /* Never send partially complete segments */ #define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ #define UDP_NO_CHECK6_TX 101 /* Disable sending checksum for UDP6X */ #define UDP_NO_CHECK6_RX 102 /* Disable accpeting checksum for UDP6 */ #define UDP_SEGMENT 103 /* Set GSO segmentation size */ /* UDP encapsulation types */ #define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */ #define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */ #define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */ #define UDP_ENCAP_GTP0 4 /* GSM TS 09.60 */ #define UDP_ENCAP_GTP1U 5 /* 3GPP TS 29.060 */ #define UDP_ENCAP_RXRPC 6 #endif /* _LINUX_UDP_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/dvb/version.h���������������������������������������������������������������������������������0000644�����������������00000002072�14763166027�0010331 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * version.h * * Copyright (C) 2000 Holger Waechtler <holger@convergence.de> * for convergence integrated media GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * 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 Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef _DVBVERSION_H_ #define _DVBVERSION_H_ #define DVB_API_VERSION 5 #define DVB_API_VERSION_MINOR 11 #endif /*_DVBVERSION_H_*/ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/dvb/video.h�����������������������������������������������������������������������������������0000644�����������������00000015552�14763166027�0007761 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * video.h * * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> * & Ralph Metzler <ralph@convergence.de> * for convergence integrated media GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * 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 Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef _DVBVIDEO_H_ #define _DVBVIDEO_H_ #include <linux/types.h> #include <time.h> typedef enum { VIDEO_FORMAT_4_3, /* Select 4:3 format */ VIDEO_FORMAT_16_9, /* Select 16:9 format. */ VIDEO_FORMAT_221_1 /* 2.21:1 */ } video_format_t; typedef enum { VIDEO_PAN_SCAN, /* use pan and scan format */ VIDEO_LETTER_BOX, /* use letterbox format */ VIDEO_CENTER_CUT_OUT /* use center cut out format */ } video_displayformat_t; typedef struct { int w; int h; video_format_t aspect_ratio; } video_size_t; typedef enum { VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */ VIDEO_SOURCE_MEMORY /* If this source is selected, the stream comes from the user through the write system call */ } video_stream_source_t; typedef enum { VIDEO_STOPPED, /* Video is stopped */ VIDEO_PLAYING, /* Video is currently playing */ VIDEO_FREEZED /* Video is freezed */ } video_play_state_t; /* Decoder commands */ #define VIDEO_CMD_PLAY (0) #define VIDEO_CMD_STOP (1) #define VIDEO_CMD_FREEZE (2) #define VIDEO_CMD_CONTINUE (3) /* Flags for VIDEO_CMD_FREEZE */ #define VIDEO_CMD_FREEZE_TO_BLACK (1 << 0) /* Flags for VIDEO_CMD_STOP */ #define VIDEO_CMD_STOP_TO_BLACK (1 << 0) #define VIDEO_CMD_STOP_IMMEDIATELY (1 << 1) /* Play input formats: */ /* The decoder has no special format requirements */ #define VIDEO_PLAY_FMT_NONE (0) /* The decoder requires full GOPs */ #define VIDEO_PLAY_FMT_GOP (1) /* The structure must be zeroed before use by the application This ensures it can be extended safely in the future. */ struct video_command { __u32 cmd; __u32 flags; union { struct { __u64 pts; } stop; struct { /* 0 or 1000 specifies normal speed, 1 specifies forward single stepping, -1 specifies backward single stepping, >1: playback at speed/1000 of the normal speed, <-1: reverse playback at (-speed/1000) of the normal speed. */ __s32 speed; __u32 format; } play; struct { __u32 data[16]; } raw; }; }; /* FIELD_UNKNOWN can be used if the hardware does not know whether the Vsync is for an odd, even or progressive (i.e. non-interlaced) field. */ #define VIDEO_VSYNC_FIELD_UNKNOWN (0) #define VIDEO_VSYNC_FIELD_ODD (1) #define VIDEO_VSYNC_FIELD_EVEN (2) #define VIDEO_VSYNC_FIELD_PROGRESSIVE (3) struct video_event { __s32 type; #define VIDEO_EVENT_SIZE_CHANGED 1 #define VIDEO_EVENT_FRAME_RATE_CHANGED 2 #define VIDEO_EVENT_DECODER_STOPPED 3 #define VIDEO_EVENT_VSYNC 4 /* unused, make sure to use atomic time for y2038 if it ever gets used */ long timestamp; union { video_size_t size; unsigned int frame_rate; /* in frames per 1000sec */ unsigned char vsync_field; /* unknown/odd/even/progressive */ } u; }; struct video_status { int video_blank; /* blank video on freeze? */ video_play_state_t play_state; /* current state of playback */ video_stream_source_t stream_source; /* current source (demux/memory) */ video_format_t video_format; /* current aspect ratio of stream*/ video_displayformat_t display_format;/* selected cropping mode */ }; struct video_still_picture { char *iFrame; /* pointer to a single iframe in memory */ __s32 size; }; typedef __u16 video_attributes_t; /* bits: descr. */ /* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */ /* 13-12 TV system (0=525/60, 1=625/50) */ /* 11-10 Aspect ratio (0=4:3, 3=16:9) */ /* 9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca */ /* 7 line 21-1 data present in GOP (1=yes, 0=no) */ /* 6 line 21-2 data present in GOP (1=yes, 0=no) */ /* 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */ /* 2 source letterboxed (1=yes, 0=no) */ /* 0 film/camera mode (0= *camera, 1=film (625/50 only)) */ /* bit definitions for capabilities: */ /* can the hardware decode MPEG1 and/or MPEG2? */ #define VIDEO_CAP_MPEG1 1 #define VIDEO_CAP_MPEG2 2 /* can you send a system and/or program stream to video device? (you still have to open the video and the audio device but only send the stream to the video device) */ #define VIDEO_CAP_SYS 4 #define VIDEO_CAP_PROG 8 /* can the driver also handle SPU, NAVI and CSS encoded data? (CSS API is not present yet) */ #define VIDEO_CAP_SPU 16 #define VIDEO_CAP_NAVI 32 #define VIDEO_CAP_CSS 64 #define VIDEO_STOP _IO('o', 21) #define VIDEO_PLAY _IO('o', 22) #define VIDEO_FREEZE _IO('o', 23) #define VIDEO_CONTINUE _IO('o', 24) #define VIDEO_SELECT_SOURCE _IO('o', 25) #define VIDEO_SET_BLANK _IO('o', 26) #define VIDEO_GET_STATUS _IOR('o', 27, struct video_status) #define VIDEO_GET_EVENT _IOR('o', 28, struct video_event) #define VIDEO_SET_DISPLAY_FORMAT _IO('o', 29) #define VIDEO_STILLPICTURE _IOW('o', 30, struct video_still_picture) #define VIDEO_FAST_FORWARD _IO('o', 31) #define VIDEO_SLOWMOTION _IO('o', 32) #define VIDEO_GET_CAPABILITIES _IOR('o', 33, unsigned int) #define VIDEO_CLEAR_BUFFER _IO('o', 34) #define VIDEO_SET_STREAMTYPE _IO('o', 36) #define VIDEO_SET_FORMAT _IO('o', 37) #define VIDEO_GET_SIZE _IOR('o', 55, video_size_t) /** * VIDEO_GET_PTS * * Read the 33 bit presentation time stamp as defined * in ITU T-REC-H.222.0 / ISO/IEC 13818-1. * * The PTS should belong to the currently played * frame if possible, but may also be a value close to it * like the PTS of the last decoded frame or the last PTS * extracted by the PES parser. */ #define VIDEO_GET_PTS _IOR('o', 57, __u64) /* Read the number of displayed frames since the decoder was started */ #define VIDEO_GET_FRAME_COUNT _IOR('o', 58, __u64) #define VIDEO_COMMAND _IOWR('o', 59, struct video_command) #define VIDEO_TRY_COMMAND _IOWR('o', 60, struct video_command) #endif /* _DVBVIDEO_H_ */ ������������������������������������������������������������������������������������������������������������������������������������������������������linux/dvb/audio.h�����������������������������������������������������������������������������������0000644�����������������00000006603�14763166027�0007751 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * audio.h * * Copyright (C) 2000 Ralph Metzler <ralph@convergence.de> * & Marcus Metzler <marcus@convergence.de> * for convergence integrated media GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Lesser Public License * as published by the Free Software Foundation; either version 2.1 * 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 Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef _DVBAUDIO_H_ #define _DVBAUDIO_H_ #include <linux/types.h> typedef enum { AUDIO_SOURCE_DEMUX, /* Select the demux as the main source */ AUDIO_SOURCE_MEMORY /* Select internal memory as the main source */ } audio_stream_source_t; typedef enum { AUDIO_STOPPED, /* Device is stopped */ AUDIO_PLAYING, /* Device is currently playing */ AUDIO_PAUSED /* Device is paused */ } audio_play_state_t; typedef enum { AUDIO_STEREO, AUDIO_MONO_LEFT, AUDIO_MONO_RIGHT, AUDIO_MONO, AUDIO_STEREO_SWAPPED } audio_channel_select_t; typedef struct audio_mixer { unsigned int volume_left; unsigned int volume_right; // what else do we need? bass, pass-through, ... } audio_mixer_t; typedef struct audio_status { int AV_sync_state; /* sync audio and video? */ int mute_state; /* audio is muted */ audio_play_state_t play_state; /* current playback state */ audio_stream_source_t stream_source; /* current stream source */ audio_channel_select_t channel_select; /* currently selected channel */ int bypass_mode; /* pass on audio data to */ audio_mixer_t mixer_state; /* current mixer state */ } audio_status_t; /* separate decoder hardware */ /* for GET_CAPABILITIES and SET_FORMAT, the latter should only set one bit */ #define AUDIO_CAP_DTS 1 #define AUDIO_CAP_LPCM 2 #define AUDIO_CAP_MP1 4 #define AUDIO_CAP_MP2 8 #define AUDIO_CAP_MP3 16 #define AUDIO_CAP_AAC 32 #define AUDIO_CAP_OGG 64 #define AUDIO_CAP_SDDS 128 #define AUDIO_CAP_AC3 256 #define AUDIO_STOP _IO('o', 1) #define AUDIO_PLAY _IO('o', 2) #define AUDIO_PAUSE _IO('o', 3) #define AUDIO_CONTINUE _IO('o', 4) #define AUDIO_SELECT_SOURCE _IO('o', 5) #define AUDIO_SET_MUTE _IO('o', 6) #define AUDIO_SET_AV_SYNC _IO('o', 7) #define AUDIO_SET_BYPASS_MODE _IO('o', 8) #define AUDIO_CHANNEL_SELECT _IO('o', 9) #define AUDIO_GET_STATUS _IOR('o', 10, audio_status_t) #define AUDIO_GET_CAPABILITIES _IOR('o', 11, unsigned int) #define AUDIO_CLEAR_BUFFER _IO('o', 12) #define AUDIO_SET_ID _IO('o', 13) #define AUDIO_SET_MIXER _IOW('o', 14, audio_mixer_t) #define AUDIO_SET_STREAMTYPE _IO('o', 15) #define AUDIO_BILINGUAL_CHANNEL_SELECT _IO('o', 20) #endif /* _DVBAUDIO_H_ */ �����������������������������������������������������������������������������������������������������������������������������linux/dvb/ca.h��������������������������������������������������������������������������������������0000644�����������������00000010227�14763166027�0007230 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * ca.h * * Copyright (C) 2000 Ralph Metzler <ralph@convergence.de> * & Marcus Metzler <marcus@convergence.de> * for convergence integrated media GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Lesser Public License * as published by the Free Software Foundation; either version 2.1 * 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 Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef _DVBCA_H_ #define _DVBCA_H_ /** * struct ca_slot_info - CA slot interface types and info. * * @num: slot number. * @type: slot type. * @flags: flags applicable to the slot. * * This struct stores the CA slot information. * * @type can be: * * - %CA_CI - CI high level interface; * - %CA_CI_LINK - CI link layer level interface; * - %CA_CI_PHYS - CI physical layer level interface; * - %CA_DESCR - built-in descrambler; * - %CA_SC -simple smart card interface. * * @flags can be: * * - %CA_CI_MODULE_PRESENT - module (or card) inserted; * - %CA_CI_MODULE_READY - module is ready for usage. */ struct ca_slot_info { int num; int type; #define CA_CI 1 #define CA_CI_LINK 2 #define CA_CI_PHYS 4 #define CA_DESCR 8 #define CA_SC 128 unsigned int flags; #define CA_CI_MODULE_PRESENT 1 #define CA_CI_MODULE_READY 2 }; /** * struct ca_descr_info - descrambler types and info. * * @num: number of available descramblers (keys). * @type: type of supported scrambling system. * * Identifies the number of descramblers and their type. * * @type can be: * * - %CA_ECD - European Common Descrambler (ECD) hardware; * - %CA_NDS - Videoguard (NDS) hardware; * - %CA_DSS - Distributed Sample Scrambling (DSS) hardware. */ struct ca_descr_info { unsigned int num; unsigned int type; #define CA_ECD 1 #define CA_NDS 2 #define CA_DSS 4 }; /** * struct ca_caps - CA slot interface capabilities. * * @slot_num: total number of CA card and module slots. * @slot_type: bitmap with all supported types as defined at * &struct ca_slot_info (e. g. %CA_CI, %CA_CI_LINK, etc). * @descr_num: total number of descrambler slots (keys) * @descr_type: bitmap with all supported types as defined at * &struct ca_descr_info (e. g. %CA_ECD, %CA_NDS, etc). */ struct ca_caps { unsigned int slot_num; unsigned int slot_type; unsigned int descr_num; unsigned int descr_type; }; /** * struct ca_msg - a message to/from a CI-CAM * * @index: unused * @type: unused * @length: length of the message * @msg: message * * This struct carries a message to be send/received from a CI CA module. */ struct ca_msg { unsigned int index; unsigned int type; unsigned int length; unsigned char msg[256]; }; /** * struct ca_descr - CA descrambler control words info * * @index: CA Descrambler slot * @parity: control words parity, where 0 means even and 1 means odd * @cw: CA Descrambler control words */ struct ca_descr { unsigned int index; unsigned int parity; unsigned char cw[8]; }; #define CA_RESET _IO('o', 128) #define CA_GET_CAP _IOR('o', 129, struct ca_caps) #define CA_GET_SLOT_INFO _IOR('o', 130, struct ca_slot_info) #define CA_GET_DESCR_INFO _IOR('o', 131, struct ca_descr_info) #define CA_GET_MSG _IOR('o', 132, struct ca_msg) #define CA_SEND_MSG _IOW('o', 133, struct ca_msg) #define CA_SET_DESCR _IOW('o', 134, struct ca_descr) /* This is needed for legacy userspace support */ typedef struct ca_slot_info ca_slot_info_t; typedef struct ca_descr_info ca_descr_info_t; typedef struct ca_caps ca_caps_t; typedef struct ca_msg ca_msg_t; typedef struct ca_descr ca_descr_t; #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/dvb/osd.h�������������������������������������������������������������������������������������0000644�����������������00000013201�14763166027�0007425 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * osd.h * * Copyright (C) 2001 Ralph Metzler <ralph@convergence.de> * & Marcus Metzler <marcus@convergence.de> * for convergence integrated media GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Lesser Public License * as published by the Free Software Foundation; either version 2.1 * 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 Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef _DVBOSD_H_ #define _DVBOSD_H_ typedef enum { // All functions return -2 on "not open" OSD_Close=1, // () // Disables OSD and releases the buffers // returns 0 on success OSD_Open, // (x0,y0,x1,y1,BitPerPixel[2/4/8](color&0x0F),mix[0..15](color&0xF0)) // Opens OSD with this size and bit depth // returns 0 on success, -1 on DRAM allocation error, -2 on "already open" OSD_Show, // () // enables OSD mode // returns 0 on success OSD_Hide, // () // disables OSD mode // returns 0 on success OSD_Clear, // () // Sets all pixel to color 0 // returns 0 on success OSD_Fill, // (color) // Sets all pixel to color <col> // returns 0 on success OSD_SetColor, // (color,R{x0},G{y0},B{x1},opacity{y1}) // set palette entry <num> to <r,g,b>, <mix> and <trans> apply // R,G,B: 0..255 // R=Red, G=Green, B=Blue // opacity=0: pixel opacity 0% (only video pixel shows) // opacity=1..254: pixel opacity as specified in header // opacity=255: pixel opacity 100% (only OSD pixel shows) // returns 0 on success, -1 on error OSD_SetPalette, // (firstcolor{color},lastcolor{x0},data) // Set a number of entries in the palette // sets the entries "firstcolor" through "lastcolor" from the array "data" // data has 4 byte for each color: // R,G,B, and a opacity value: 0->transparent, 1..254->mix, 255->pixel OSD_SetTrans, // (transparency{color}) // Sets transparency of mixed pixel (0..15) // returns 0 on success OSD_SetPixel, // (x0,y0,color) // sets pixel <x>,<y> to color number <col> // returns 0 on success, -1 on error OSD_GetPixel, // (x0,y0) // returns color number of pixel <x>,<y>, or -1 OSD_SetRow, // (x0,y0,x1,data) // fills pixels x0,y through x1,y with the content of data[] // returns 0 on success, -1 on clipping all pixel (no pixel drawn) OSD_SetBlock, // (x0,y0,x1,y1,increment{color},data) // fills pixels x0,y0 through x1,y1 with the content of data[] // inc contains the width of one line in the data block, // inc<=0 uses blockwidth as linewidth // returns 0 on success, -1 on clipping all pixel OSD_FillRow, // (x0,y0,x1,color) // fills pixels x0,y through x1,y with the color <col> // returns 0 on success, -1 on clipping all pixel OSD_FillBlock, // (x0,y0,x1,y1,color) // fills pixels x0,y0 through x1,y1 with the color <col> // returns 0 on success, -1 on clipping all pixel OSD_Line, // (x0,y0,x1,y1,color) // draw a line from x0,y0 to x1,y1 with the color <col> // returns 0 on success OSD_Query, // (x0,y0,x1,y1,xasp{color}}), yasp=11 // fills parameters with the picture dimensions and the pixel aspect ratio // returns 0 on success OSD_Test, // () // draws a test picture. for debugging purposes only // returns 0 on success // TODO: remove "test" in final version OSD_Text, // (x0,y0,size,color,text) OSD_SetWindow, // (x0) set window with number 0<x0<8 as current OSD_MoveWindow, // move current window to (x0, y0) OSD_OpenRaw, // Open other types of OSD windows } OSD_Command; typedef struct osd_cmd_s { OSD_Command cmd; int x0; int y0; int x1; int y1; int color; void *data; } osd_cmd_t; /* OSD_OpenRaw: set 'color' to desired window type */ typedef enum { OSD_BITMAP1, /* 1 bit bitmap */ OSD_BITMAP2, /* 2 bit bitmap */ OSD_BITMAP4, /* 4 bit bitmap */ OSD_BITMAP8, /* 8 bit bitmap */ OSD_BITMAP1HR, /* 1 Bit bitmap half resolution */ OSD_BITMAP2HR, /* 2 bit bitmap half resolution */ OSD_BITMAP4HR, /* 4 bit bitmap half resolution */ OSD_BITMAP8HR, /* 8 bit bitmap half resolution */ OSD_YCRCB422, /* 4:2:2 YCRCB Graphic Display */ OSD_YCRCB444, /* 4:4:4 YCRCB Graphic Display */ OSD_YCRCB444HR, /* 4:4:4 YCRCB graphic half resolution */ OSD_VIDEOTSIZE, /* True Size Normal MPEG Video Display */ OSD_VIDEOHSIZE, /* MPEG Video Display Half Resolution */ OSD_VIDEOQSIZE, /* MPEG Video Display Quarter Resolution */ OSD_VIDEODSIZE, /* MPEG Video Display Double Resolution */ OSD_VIDEOTHSIZE, /* True Size MPEG Video Display Half Resolution */ OSD_VIDEOTQSIZE, /* True Size MPEG Video Display Quarter Resolution*/ OSD_VIDEOTDSIZE, /* True Size MPEG Video Display Double Resolution */ OSD_VIDEONSIZE, /* Full Size MPEG Video Display */ OSD_CURSOR /* Cursor */ } osd_raw_window_t; typedef struct osd_cap_s { int cmd; #define OSD_CAP_MEMSIZE 1 /* memory size */ long val; } osd_cap_t; #define OSD_SEND_CMD _IOW('o', 160, osd_cmd_t) #define OSD_GET_CAPABILITY _IOR('o', 161, osd_cap_t) #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/dvb/dmx.h�������������������������������������������������������������������������������������0000644�����������������00000023701�14763166027�0007436 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * dmx.h * * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> * & Ralph Metzler <ralph@convergence.de> * for convergence integrated media GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * 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 Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef _DVBDMX_H_ #define _DVBDMX_H_ #include <linux/types.h> #include <time.h> #define DMX_FILTER_SIZE 16 /** * enum dmx_output - Output for the demux. * * @DMX_OUT_DECODER: * Streaming directly to decoder. * @DMX_OUT_TAP: * Output going to a memory buffer (to be retrieved via the read command). * Delivers the stream output to the demux device on which the ioctl * is called. * @DMX_OUT_TS_TAP: * Output multiplexed into a new TS (to be retrieved by reading from the * logical DVR device). Routes output to the logical DVR device * ``/dev/dvb/adapter?/dvr?``, which delivers a TS multiplexed from all * filters for which @DMX_OUT_TS_TAP was specified. * @DMX_OUT_TSDEMUX_TAP: * Like @DMX_OUT_TS_TAP but retrieved from the DMX device. */ enum dmx_output { DMX_OUT_DECODER, DMX_OUT_TAP, DMX_OUT_TS_TAP, DMX_OUT_TSDEMUX_TAP }; /** * enum dmx_input - Input from the demux. * * @DMX_IN_FRONTEND: Input from a front-end device. * @DMX_IN_DVR: Input from the logical DVR device. */ enum dmx_input { DMX_IN_FRONTEND, DMX_IN_DVR }; /** * enum dmx_ts_pes - type of the PES filter. * * @DMX_PES_AUDIO0: first audio PID. Also referred as @DMX_PES_AUDIO. * @DMX_PES_VIDEO0: first video PID. Also referred as @DMX_PES_VIDEO. * @DMX_PES_TELETEXT0: first teletext PID. Also referred as @DMX_PES_TELETEXT. * @DMX_PES_SUBTITLE0: first subtitle PID. Also referred as @DMX_PES_SUBTITLE. * @DMX_PES_PCR0: first Program Clock Reference PID. * Also referred as @DMX_PES_PCR. * * @DMX_PES_AUDIO1: second audio PID. * @DMX_PES_VIDEO1: second video PID. * @DMX_PES_TELETEXT1: second teletext PID. * @DMX_PES_SUBTITLE1: second subtitle PID. * @DMX_PES_PCR1: second Program Clock Reference PID. * * @DMX_PES_AUDIO2: third audio PID. * @DMX_PES_VIDEO2: third video PID. * @DMX_PES_TELETEXT2: third teletext PID. * @DMX_PES_SUBTITLE2: third subtitle PID. * @DMX_PES_PCR2: third Program Clock Reference PID. * * @DMX_PES_AUDIO3: fourth audio PID. * @DMX_PES_VIDEO3: fourth video PID. * @DMX_PES_TELETEXT3: fourth teletext PID. * @DMX_PES_SUBTITLE3: fourth subtitle PID. * @DMX_PES_PCR3: fourth Program Clock Reference PID. * * @DMX_PES_OTHER: any other PID. */ enum dmx_ts_pes { DMX_PES_AUDIO0, DMX_PES_VIDEO0, DMX_PES_TELETEXT0, DMX_PES_SUBTITLE0, DMX_PES_PCR0, DMX_PES_AUDIO1, DMX_PES_VIDEO1, DMX_PES_TELETEXT1, DMX_PES_SUBTITLE1, DMX_PES_PCR1, DMX_PES_AUDIO2, DMX_PES_VIDEO2, DMX_PES_TELETEXT2, DMX_PES_SUBTITLE2, DMX_PES_PCR2, DMX_PES_AUDIO3, DMX_PES_VIDEO3, DMX_PES_TELETEXT3, DMX_PES_SUBTITLE3, DMX_PES_PCR3, DMX_PES_OTHER }; #define DMX_PES_AUDIO DMX_PES_AUDIO0 #define DMX_PES_VIDEO DMX_PES_VIDEO0 #define DMX_PES_TELETEXT DMX_PES_TELETEXT0 #define DMX_PES_SUBTITLE DMX_PES_SUBTITLE0 #define DMX_PES_PCR DMX_PES_PCR0 /** * struct dmx_filter - Specifies a section header filter. * * @filter: bit array with bits to be matched at the section header. * @mask: bits that are valid at the filter bit array. * @mode: mode of match: if bit is zero, it will match if equal (positive * match); if bit is one, it will match if the bit is negated. * * Note: All arrays in this struct have a size of DMX_FILTER_SIZE (16 bytes). */ struct dmx_filter { __u8 filter[DMX_FILTER_SIZE]; __u8 mask[DMX_FILTER_SIZE]; __u8 mode[DMX_FILTER_SIZE]; }; /** * struct dmx_sct_filter_params - Specifies a section filter. * * @pid: PID to be filtered. * @filter: section header filter, as defined by &struct dmx_filter. * @timeout: maximum time to filter, in milliseconds. * @flags: extra flags for the section filter. * * Carries the configuration for a MPEG-TS section filter. * * The @flags can be: * * - %DMX_CHECK_CRC - only deliver sections where the CRC check succeeded; * - %DMX_ONESHOT - disable the section filter after one section * has been delivered; * - %DMX_IMMEDIATE_START - Start filter immediately without requiring a * :ref:`DMX_START`. */ struct dmx_sct_filter_params { __u16 pid; struct dmx_filter filter; __u32 timeout; __u32 flags; #define DMX_CHECK_CRC 1 #define DMX_ONESHOT 2 #define DMX_IMMEDIATE_START 4 }; /** * struct dmx_pes_filter_params - Specifies Packetized Elementary Stream (PES) * filter parameters. * * @pid: PID to be filtered. * @input: Demux input, as specified by &enum dmx_input. * @output: Demux output, as specified by &enum dmx_output. * @pes_type: Type of the pes filter, as specified by &enum dmx_pes_type. * @flags: Demux PES flags. */ struct dmx_pes_filter_params { __u16 pid; enum dmx_input input; enum dmx_output output; enum dmx_ts_pes pes_type; __u32 flags; }; /** * struct dmx_stc - Stores System Time Counter (STC) information. * * @num: input data: number of the STC, from 0 to N. * @base: output: divisor for STC to get 90 kHz clock. * @stc: output: stc in @base * 90 kHz units. */ struct dmx_stc { unsigned int num; unsigned int base; __u64 stc; }; /** * enum dmx_buffer_flags - DMX memory-mapped buffer flags * * @DMX_BUFFER_FLAG_HAD_CRC32_DISCARD: * Indicates that the Kernel discarded one or more frames due to wrong * CRC32 checksum. * @DMX_BUFFER_FLAG_TEI: * Indicates that the Kernel has detected a Transport Error indicator * (TEI) on a filtered pid. * @DMX_BUFFER_PKT_COUNTER_MISMATCH: * Indicates that the Kernel has detected a packet counter mismatch * on a filtered pid. * @DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED: * Indicates that the Kernel has detected one or more frame discontinuity. * @DMX_BUFFER_FLAG_DISCONTINUITY_INDICATOR: * Received at least one packet with a frame discontinuity indicator. */ enum dmx_buffer_flags { DMX_BUFFER_FLAG_HAD_CRC32_DISCARD = 1 << 0, DMX_BUFFER_FLAG_TEI = 1 << 1, DMX_BUFFER_PKT_COUNTER_MISMATCH = 1 << 2, DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED = 1 << 3, DMX_BUFFER_FLAG_DISCONTINUITY_INDICATOR = 1 << 4, }; /** * struct dmx_buffer - dmx buffer info * * @index: id number of the buffer * @bytesused: number of bytes occupied by data in the buffer (payload); * @offset: for buffers with memory == DMX_MEMORY_MMAP; * offset from the start of the device memory for this plane, * (or a "cookie" that should be passed to mmap() as offset) * @length: size in bytes of the buffer * @flags: bit array of buffer flags as defined by &enum dmx_buffer_flags. * Filled only at &DMX_DQBUF. * @count: monotonic counter for filled buffers. Helps to identify * data stream loses. Filled only at &DMX_DQBUF. * * Contains data exchanged by application and driver using one of the streaming * I/O methods. * * Please notice that, for &DMX_QBUF, only @index should be filled. * On &DMX_DQBUF calls, all fields will be filled by the Kernel. */ struct dmx_buffer { __u32 index; __u32 bytesused; __u32 offset; __u32 length; __u32 flags; __u32 count; }; /** * struct dmx_requestbuffers - request dmx buffer information * * @count: number of requested buffers, * @size: size in bytes of the requested buffer * * Contains data used for requesting a dmx buffer. * All reserved fields must be set to zero. */ struct dmx_requestbuffers { __u32 count; __u32 size; }; /** * struct dmx_exportbuffer - export of dmx buffer as DMABUF file descriptor * * @index: id number of the buffer * @flags: flags for newly created file, currently only O_CLOEXEC is * supported, refer to manual of open syscall for more details * @fd: file descriptor associated with DMABUF (set by driver) * * Contains data used for exporting a dmx buffer as DMABUF file descriptor. * The buffer is identified by a 'cookie' returned by DMX_QUERYBUF * (identical to the cookie used to mmap() the buffer to userspace). All * reserved fields must be set to zero. The field reserved0 is expected to * become a structure 'type' allowing an alternative layout of the structure * content. Therefore this field should not be used for any other extensions. */ struct dmx_exportbuffer { __u32 index; __u32 flags; __s32 fd; }; #define DMX_START _IO('o', 41) #define DMX_STOP _IO('o', 42) #define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params) #define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params) #define DMX_SET_BUFFER_SIZE _IO('o', 45) #define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5]) #define DMX_GET_STC _IOWR('o', 50, struct dmx_stc) #define DMX_ADD_PID _IOW('o', 51, __u16) #define DMX_REMOVE_PID _IOW('o', 52, __u16) /* This is needed for legacy userspace support */ typedef enum dmx_output dmx_output_t; typedef enum dmx_input dmx_input_t; typedef enum dmx_ts_pes dmx_pes_type_t; typedef struct dmx_filter dmx_filter_t; #define DMX_REQBUFS _IOWR('o', 60, struct dmx_requestbuffers) #define DMX_QUERYBUF _IOWR('o', 61, struct dmx_buffer) #define DMX_EXPBUF _IOWR('o', 62, struct dmx_exportbuffer) #define DMX_QBUF _IOWR('o', 63, struct dmx_buffer) #define DMX_DQBUF _IOWR('o', 64, struct dmx_buffer) #endif /* _DVBDMX_H_ */ ���������������������������������������������������������������linux/dvb/net.h�������������������������������������������������������������������������������������0000644�����������������00000004117�14763166027�0007434 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * net.h * * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> * & Ralph Metzler <ralph@convergence.de> * for convergence integrated media GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * 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 Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef _DVBNET_H_ #define _DVBNET_H_ #include <linux/types.h> /** * struct dvb_net_if - describes a DVB network interface * * @pid: Packet ID (PID) of the MPEG-TS that contains data * @if_num: number of the Digital TV interface. * @feedtype: Encapsulation type of the feed. * * A MPEG-TS stream may contain packet IDs with IP packages on it. * This struct describes it, and the type of encoding. * * @feedtype can be: * * - %DVB_NET_FEEDTYPE_MPE for MPE encoding * - %DVB_NET_FEEDTYPE_ULE for ULE encoding. */ struct dvb_net_if { __u16 pid; __u16 if_num; __u8 feedtype; #define DVB_NET_FEEDTYPE_MPE 0 /* multi protocol encapsulation */ #define DVB_NET_FEEDTYPE_ULE 1 /* ultra lightweight encapsulation */ }; #define NET_ADD_IF _IOWR('o', 52, struct dvb_net_if) #define NET_REMOVE_IF _IO('o', 53) #define NET_GET_IF _IOWR('o', 54, struct dvb_net_if) /* binary compatibility cruft: */ struct __dvb_net_if_old { __u16 pid; __u16 if_num; }; #define __NET_ADD_IF_OLD _IOWR('o', 52, struct __dvb_net_if_old) #define __NET_GET_IF_OLD _IOWR('o', 54, struct __dvb_net_if_old) #endif /*_DVBNET_H_*/ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/dvb/frontend.h��������������������������������������������������������������������������������0000644�����������������00000071074�14763166027�0010473 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * frontend.h * * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> * Ralph Metzler <ralph@convergence.de> * Holger Waechtler <holger@convergence.de> * Andre Draszik <ad@convergence.de> * for convergence integrated media GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * 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 Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef _DVBFRONTEND_H_ #define _DVBFRONTEND_H_ #include <linux/types.h> /** * enum fe_caps - Frontend capabilities * * @FE_IS_STUPID: There's something wrong at the * frontend, and it can't report its * capabilities. * @FE_CAN_INVERSION_AUTO: Can auto-detect frequency spectral * band inversion * @FE_CAN_FEC_1_2: Supports FEC 1/2 * @FE_CAN_FEC_2_3: Supports FEC 2/3 * @FE_CAN_FEC_3_4: Supports FEC 3/4 * @FE_CAN_FEC_4_5: Supports FEC 4/5 * @FE_CAN_FEC_5_6: Supports FEC 5/6 * @FE_CAN_FEC_6_7: Supports FEC 6/7 * @FE_CAN_FEC_7_8: Supports FEC 7/8 * @FE_CAN_FEC_8_9: Supports FEC 8/9 * @FE_CAN_FEC_AUTO: Can auto-detect FEC * @FE_CAN_QPSK: Supports QPSK modulation * @FE_CAN_QAM_16: Supports 16-QAM modulation * @FE_CAN_QAM_32: Supports 32-QAM modulation * @FE_CAN_QAM_64: Supports 64-QAM modulation * @FE_CAN_QAM_128: Supports 128-QAM modulation * @FE_CAN_QAM_256: Supports 256-QAM modulation * @FE_CAN_QAM_AUTO: Can auto-detect QAM modulation * @FE_CAN_TRANSMISSION_MODE_AUTO: Can auto-detect transmission mode * @FE_CAN_BANDWIDTH_AUTO: Can auto-detect bandwidth * @FE_CAN_GUARD_INTERVAL_AUTO: Can auto-detect guard interval * @FE_CAN_HIERARCHY_AUTO: Can auto-detect hierarchy * @FE_CAN_8VSB: Supports 8-VSB modulation * @FE_CAN_16VSB: Supporta 16-VSB modulation * @FE_HAS_EXTENDED_CAPS: Unused * @FE_CAN_MULTISTREAM: Supports multistream filtering * @FE_CAN_TURBO_FEC: Supports "turbo FEC" modulation * @FE_CAN_2G_MODULATION: Supports "2nd generation" modulation, * e. g. DVB-S2, DVB-T2, DVB-C2 * @FE_NEEDS_BENDING: Unused * @FE_CAN_RECOVER: Can recover from a cable unplug * automatically * @FE_CAN_MUTE_TS: Can stop spurious TS data output */ enum fe_caps { FE_IS_STUPID = 0, FE_CAN_INVERSION_AUTO = 0x1, FE_CAN_FEC_1_2 = 0x2, FE_CAN_FEC_2_3 = 0x4, FE_CAN_FEC_3_4 = 0x8, FE_CAN_FEC_4_5 = 0x10, FE_CAN_FEC_5_6 = 0x20, FE_CAN_FEC_6_7 = 0x40, FE_CAN_FEC_7_8 = 0x80, FE_CAN_FEC_8_9 = 0x100, FE_CAN_FEC_AUTO = 0x200, FE_CAN_QPSK = 0x400, FE_CAN_QAM_16 = 0x800, FE_CAN_QAM_32 = 0x1000, FE_CAN_QAM_64 = 0x2000, FE_CAN_QAM_128 = 0x4000, FE_CAN_QAM_256 = 0x8000, FE_CAN_QAM_AUTO = 0x10000, FE_CAN_TRANSMISSION_MODE_AUTO = 0x20000, FE_CAN_BANDWIDTH_AUTO = 0x40000, FE_CAN_GUARD_INTERVAL_AUTO = 0x80000, FE_CAN_HIERARCHY_AUTO = 0x100000, FE_CAN_8VSB = 0x200000, FE_CAN_16VSB = 0x400000, FE_HAS_EXTENDED_CAPS = 0x800000, FE_CAN_MULTISTREAM = 0x4000000, FE_CAN_TURBO_FEC = 0x8000000, FE_CAN_2G_MODULATION = 0x10000000, FE_NEEDS_BENDING = 0x20000000, FE_CAN_RECOVER = 0x40000000, FE_CAN_MUTE_TS = 0x80000000 }; /* * DEPRECATED: Should be kept just due to backward compatibility. */ enum fe_type { FE_QPSK, FE_QAM, FE_OFDM, FE_ATSC }; /** * struct dvb_frontend_info - Frontend properties and capabilities * * @name: Name of the frontend * @type: **DEPRECATED**. * Should not be used on modern programs, * as a frontend may have more than one type. * In order to get the support types of a given * frontend, use :c:type:`DTV_ENUM_DELSYS` * instead. * @frequency_min: Minimal frequency supported by the frontend. * @frequency_max: Minimal frequency supported by the frontend. * @frequency_stepsize: All frequencies are multiple of this value. * @frequency_tolerance: Frequency tolerance. * @symbol_rate_min: Minimal symbol rate, in bauds * (for Cable/Satellite systems). * @symbol_rate_max: Maximal symbol rate, in bauds * (for Cable/Satellite systems). * @symbol_rate_tolerance: Maximal symbol rate tolerance, in ppm * (for Cable/Satellite systems). * @notifier_delay: **DEPRECATED**. Not used by any driver. * @caps: Capabilities supported by the frontend, * as specified in &enum fe_caps. * * .. note: * * #. The frequencies are specified in Hz for Terrestrial and Cable * systems. * #. The frequencies are specified in kHz for Satellite systems. */ struct dvb_frontend_info { char name[128]; enum fe_type type; /* DEPRECATED. Use DTV_ENUM_DELSYS instead */ __u32 frequency_min; __u32 frequency_max; __u32 frequency_stepsize; __u32 frequency_tolerance; __u32 symbol_rate_min; __u32 symbol_rate_max; __u32 symbol_rate_tolerance; __u32 notifier_delay; /* DEPRECATED */ enum fe_caps caps; }; /** * struct dvb_diseqc_master_cmd - DiSEqC master command * * @msg: * DiSEqC message to be sent. It contains a 3 bytes header with: * framing + address + command, and an optional argument * of up to 3 bytes of data. * @msg_len: * Length of the DiSEqC message. Valid values are 3 to 6. * * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for * the possible messages that can be used. */ struct dvb_diseqc_master_cmd { __u8 msg[6]; __u8 msg_len; }; /** * struct dvb_diseqc_slave_reply - DiSEqC received data * * @msg: * DiSEqC message buffer to store a message received via DiSEqC. * It contains one byte header with: framing and * an optional argument of up to 3 bytes of data. * @msg_len: * Length of the DiSEqC message. Valid values are 0 to 4, * where 0 means no message. * @timeout: * Return from ioctl after timeout ms with errorcode when * no message was received. * * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for * the possible messages that can be used. */ struct dvb_diseqc_slave_reply { __u8 msg[4]; __u8 msg_len; int timeout; }; /** * enum fe_sec_voltage - DC Voltage used to feed the LNBf * * @SEC_VOLTAGE_13: Output 13V to the LNBf * @SEC_VOLTAGE_18: Output 18V to the LNBf * @SEC_VOLTAGE_OFF: Don't feed the LNBf with a DC voltage */ enum fe_sec_voltage { SEC_VOLTAGE_13, SEC_VOLTAGE_18, SEC_VOLTAGE_OFF }; /** * enum fe_sec_tone_mode - Type of tone to be send to the LNBf. * @SEC_TONE_ON: Sends a 22kHz tone burst to the antenna. * @SEC_TONE_OFF: Don't send a 22kHz tone to the antenna (except * if the ``FE_DISEQC_*`` ioctls are called). */ enum fe_sec_tone_mode { SEC_TONE_ON, SEC_TONE_OFF }; /** * enum fe_sec_mini_cmd - Type of mini burst to be sent * * @SEC_MINI_A: Sends a mini-DiSEqC 22kHz '0' Tone Burst to select * satellite-A * @SEC_MINI_B: Sends a mini-DiSEqC 22kHz '1' Data Burst to select * satellite-B */ enum fe_sec_mini_cmd { SEC_MINI_A, SEC_MINI_B }; /** * enum fe_status - Enumerates the possible frontend status. * @FE_NONE: The frontend doesn't have any kind of lock. * That's the initial frontend status * @FE_HAS_SIGNAL: Has found something above the noise level. * @FE_HAS_CARRIER: Has found a signal. * @FE_HAS_VITERBI: FEC inner coding (Viterbi, LDPC or other inner code). * is stable. * @FE_HAS_SYNC: Synchronization bytes was found. * @FE_HAS_LOCK: Digital TV were locked and everything is working. * @FE_TIMEDOUT: Fo lock within the last about 2 seconds. * @FE_REINIT: Frontend was reinitialized, application is recommended * to reset DiSEqC, tone and parameters. */ enum fe_status { FE_NONE = 0x00, FE_HAS_SIGNAL = 0x01, FE_HAS_CARRIER = 0x02, FE_HAS_VITERBI = 0x04, FE_HAS_SYNC = 0x08, FE_HAS_LOCK = 0x10, FE_TIMEDOUT = 0x20, FE_REINIT = 0x40, }; /** * enum fe_spectral_inversion - Type of inversion band * * @INVERSION_OFF: Don't do spectral band inversion. * @INVERSION_ON: Do spectral band inversion. * @INVERSION_AUTO: Autodetect spectral band inversion. * * This parameter indicates if spectral inversion should be presumed or * not. In the automatic setting (``INVERSION_AUTO``) the hardware will try * to figure out the correct setting by itself. If the hardware doesn't * support, the %dvb_frontend will try to lock at the carrier first with * inversion off. If it fails, it will try to enable inversion. */ enum fe_spectral_inversion { INVERSION_OFF, INVERSION_ON, INVERSION_AUTO }; /** * enum fe_code_rate - Type of Forward Error Correction (FEC) * * * @FEC_NONE: No Forward Error Correction Code * @FEC_1_2: Forward Error Correction Code 1/2 * @FEC_2_3: Forward Error Correction Code 2/3 * @FEC_3_4: Forward Error Correction Code 3/4 * @FEC_4_5: Forward Error Correction Code 4/5 * @FEC_5_6: Forward Error Correction Code 5/6 * @FEC_6_7: Forward Error Correction Code 6/7 * @FEC_7_8: Forward Error Correction Code 7/8 * @FEC_8_9: Forward Error Correction Code 8/9 * @FEC_AUTO: Autodetect Error Correction Code * @FEC_3_5: Forward Error Correction Code 3/5 * @FEC_9_10: Forward Error Correction Code 9/10 * @FEC_2_5: Forward Error Correction Code 2/5 * * Please note that not all FEC types are supported by a given standard. */ enum fe_code_rate { FEC_NONE = 0, FEC_1_2, FEC_2_3, FEC_3_4, FEC_4_5, FEC_5_6, FEC_6_7, FEC_7_8, FEC_8_9, FEC_AUTO, FEC_3_5, FEC_9_10, FEC_2_5, }; /** * enum fe_modulation - Type of modulation/constellation * @QPSK: QPSK modulation * @QAM_16: 16-QAM modulation * @QAM_32: 32-QAM modulation * @QAM_64: 64-QAM modulation * @QAM_128: 128-QAM modulation * @QAM_256: 256-QAM modulation * @QAM_AUTO: Autodetect QAM modulation * @VSB_8: 8-VSB modulation * @VSB_16: 16-VSB modulation * @PSK_8: 8-PSK modulation * @APSK_16: 16-APSK modulation * @APSK_32: 32-APSK modulation * @DQPSK: DQPSK modulation * @QAM_4_NR: 4-QAM-NR modulation * * Please note that not all modulations are supported by a given standard. * */ enum fe_modulation { QPSK, QAM_16, QAM_32, QAM_64, QAM_128, QAM_256, QAM_AUTO, VSB_8, VSB_16, PSK_8, APSK_16, APSK_32, DQPSK, QAM_4_NR, }; /** * enum fe_transmit_mode - Transmission mode * * @TRANSMISSION_MODE_AUTO: * Autodetect transmission mode. The hardware will try to find the * correct FFT-size (if capable) to fill in the missing parameters. * @TRANSMISSION_MODE_1K: * Transmission mode 1K * @TRANSMISSION_MODE_2K: * Transmission mode 2K * @TRANSMISSION_MODE_8K: * Transmission mode 8K * @TRANSMISSION_MODE_4K: * Transmission mode 4K * @TRANSMISSION_MODE_16K: * Transmission mode 16K * @TRANSMISSION_MODE_32K: * Transmission mode 32K * @TRANSMISSION_MODE_C1: * Single Carrier (C=1) transmission mode (DTMB only) * @TRANSMISSION_MODE_C3780: * Multi Carrier (C=3780) transmission mode (DTMB only) * * Please note that not all transmission modes are supported by a given * standard. */ enum fe_transmit_mode { TRANSMISSION_MODE_2K, TRANSMISSION_MODE_8K, TRANSMISSION_MODE_AUTO, TRANSMISSION_MODE_4K, TRANSMISSION_MODE_1K, TRANSMISSION_MODE_16K, TRANSMISSION_MODE_32K, TRANSMISSION_MODE_C1, TRANSMISSION_MODE_C3780, }; /** * enum fe_guard_interval - Guard interval * * @GUARD_INTERVAL_AUTO: Autodetect the guard interval * @GUARD_INTERVAL_1_128: Guard interval 1/128 * @GUARD_INTERVAL_1_32: Guard interval 1/32 * @GUARD_INTERVAL_1_16: Guard interval 1/16 * @GUARD_INTERVAL_1_8: Guard interval 1/8 * @GUARD_INTERVAL_1_4: Guard interval 1/4 * @GUARD_INTERVAL_19_128: Guard interval 19/128 * @GUARD_INTERVAL_19_256: Guard interval 19/256 * @GUARD_INTERVAL_PN420: PN length 420 (1/4) * @GUARD_INTERVAL_PN595: PN length 595 (1/6) * @GUARD_INTERVAL_PN945: PN length 945 (1/9) * * Please note that not all guard intervals are supported by a given standard. */ enum fe_guard_interval { GUARD_INTERVAL_1_32, GUARD_INTERVAL_1_16, GUARD_INTERVAL_1_8, GUARD_INTERVAL_1_4, GUARD_INTERVAL_AUTO, GUARD_INTERVAL_1_128, GUARD_INTERVAL_19_128, GUARD_INTERVAL_19_256, GUARD_INTERVAL_PN420, GUARD_INTERVAL_PN595, GUARD_INTERVAL_PN945, }; /** * enum fe_hierarchy - Hierarchy * @HIERARCHY_NONE: No hierarchy * @HIERARCHY_AUTO: Autodetect hierarchy (if supported) * @HIERARCHY_1: Hierarchy 1 * @HIERARCHY_2: Hierarchy 2 * @HIERARCHY_4: Hierarchy 4 * * Please note that not all hierarchy types are supported by a given standard. */ enum fe_hierarchy { HIERARCHY_NONE, HIERARCHY_1, HIERARCHY_2, HIERARCHY_4, HIERARCHY_AUTO }; /** * enum fe_interleaving - Interleaving * @INTERLEAVING_NONE: No interleaving. * @INTERLEAVING_AUTO: Auto-detect interleaving. * @INTERLEAVING_240: Interleaving of 240 symbols. * @INTERLEAVING_720: Interleaving of 720 symbols. * * Please note that, currently, only DTMB uses it. */ enum fe_interleaving { INTERLEAVING_NONE, INTERLEAVING_AUTO, INTERLEAVING_240, INTERLEAVING_720, }; /* DVBv5 property Commands */ #define DTV_UNDEFINED 0 #define DTV_TUNE 1 #define DTV_CLEAR 2 #define DTV_FREQUENCY 3 #define DTV_MODULATION 4 #define DTV_BANDWIDTH_HZ 5 #define DTV_INVERSION 6 #define DTV_DISEQC_MASTER 7 #define DTV_SYMBOL_RATE 8 #define DTV_INNER_FEC 9 #define DTV_VOLTAGE 10 #define DTV_TONE 11 #define DTV_PILOT 12 #define DTV_ROLLOFF 13 #define DTV_DISEQC_SLAVE_REPLY 14 /* Basic enumeration set for querying unlimited capabilities */ #define DTV_FE_CAPABILITY_COUNT 15 #define DTV_FE_CAPABILITY 16 #define DTV_DELIVERY_SYSTEM 17 /* ISDB-T and ISDB-Tsb */ #define DTV_ISDBT_PARTIAL_RECEPTION 18 #define DTV_ISDBT_SOUND_BROADCASTING 19 #define DTV_ISDBT_SB_SUBCHANNEL_ID 20 #define DTV_ISDBT_SB_SEGMENT_IDX 21 #define DTV_ISDBT_SB_SEGMENT_COUNT 22 #define DTV_ISDBT_LAYERA_FEC 23 #define DTV_ISDBT_LAYERA_MODULATION 24 #define DTV_ISDBT_LAYERA_SEGMENT_COUNT 25 #define DTV_ISDBT_LAYERA_TIME_INTERLEAVING 26 #define DTV_ISDBT_LAYERB_FEC 27 #define DTV_ISDBT_LAYERB_MODULATION 28 #define DTV_ISDBT_LAYERB_SEGMENT_COUNT 29 #define DTV_ISDBT_LAYERB_TIME_INTERLEAVING 30 #define DTV_ISDBT_LAYERC_FEC 31 #define DTV_ISDBT_LAYERC_MODULATION 32 #define DTV_ISDBT_LAYERC_SEGMENT_COUNT 33 #define DTV_ISDBT_LAYERC_TIME_INTERLEAVING 34 #define DTV_API_VERSION 35 #define DTV_CODE_RATE_HP 36 #define DTV_CODE_RATE_LP 37 #define DTV_GUARD_INTERVAL 38 #define DTV_TRANSMISSION_MODE 39 #define DTV_HIERARCHY 40 #define DTV_ISDBT_LAYER_ENABLED 41 #define DTV_STREAM_ID 42 #define DTV_ISDBS_TS_ID_LEGACY DTV_STREAM_ID #define DTV_DVBT2_PLP_ID_LEGACY 43 #define DTV_ENUM_DELSYS 44 /* ATSC-MH */ #define DTV_ATSCMH_FIC_VER 45 #define DTV_ATSCMH_PARADE_ID 46 #define DTV_ATSCMH_NOG 47 #define DTV_ATSCMH_TNOG 48 #define DTV_ATSCMH_SGN 49 #define DTV_ATSCMH_PRC 50 #define DTV_ATSCMH_RS_FRAME_MODE 51 #define DTV_ATSCMH_RS_FRAME_ENSEMBLE 52 #define DTV_ATSCMH_RS_CODE_MODE_PRI 53 #define DTV_ATSCMH_RS_CODE_MODE_SEC 54 #define DTV_ATSCMH_SCCC_BLOCK_MODE 55 #define DTV_ATSCMH_SCCC_CODE_MODE_A 56 #define DTV_ATSCMH_SCCC_CODE_MODE_B 57 #define DTV_ATSCMH_SCCC_CODE_MODE_C 58 #define DTV_ATSCMH_SCCC_CODE_MODE_D 59 #define DTV_INTERLEAVING 60 #define DTV_LNA 61 /* Quality parameters */ #define DTV_STAT_SIGNAL_STRENGTH 62 #define DTV_STAT_CNR 63 #define DTV_STAT_PRE_ERROR_BIT_COUNT 64 #define DTV_STAT_PRE_TOTAL_BIT_COUNT 65 #define DTV_STAT_POST_ERROR_BIT_COUNT 66 #define DTV_STAT_POST_TOTAL_BIT_COUNT 67 #define DTV_STAT_ERROR_BLOCK_COUNT 68 #define DTV_STAT_TOTAL_BLOCK_COUNT 69 /* Physical layer scrambling */ #define DTV_SCRAMBLING_SEQUENCE_INDEX 70 #define DTV_MAX_COMMAND DTV_SCRAMBLING_SEQUENCE_INDEX /** * enum fe_pilot - Type of pilot tone * * @PILOT_ON: Pilot tones enabled * @PILOT_OFF: Pilot tones disabled * @PILOT_AUTO: Autodetect pilot tones */ enum fe_pilot { PILOT_ON, PILOT_OFF, PILOT_AUTO, }; /** * enum fe_rolloff - Rolloff factor * @ROLLOFF_35: Roloff factor: α=35% * @ROLLOFF_20: Roloff factor: α=20% * @ROLLOFF_25: Roloff factor: α=25% * @ROLLOFF_AUTO: Auto-detect the roloff factor. * * .. note: * * Roloff factor of 35% is implied on DVB-S. On DVB-S2, it is default. */ enum fe_rolloff { ROLLOFF_35, ROLLOFF_20, ROLLOFF_25, ROLLOFF_AUTO, }; /** * enum fe_delivery_system - Type of the delivery system * * @SYS_UNDEFINED: * Undefined standard. Generally, indicates an error * @SYS_DVBC_ANNEX_A: * Cable TV: DVB-C following ITU-T J.83 Annex A spec * @SYS_DVBC_ANNEX_B: * Cable TV: DVB-C following ITU-T J.83 Annex B spec (ClearQAM) * @SYS_DVBC_ANNEX_C: * Cable TV: DVB-C following ITU-T J.83 Annex C spec * @SYS_ISDBC: * Cable TV: ISDB-C (no drivers yet) * @SYS_DVBT: * Terrestrial TV: DVB-T * @SYS_DVBT2: * Terrestrial TV: DVB-T2 * @SYS_ISDBT: * Terrestrial TV: ISDB-T * @SYS_ATSC: * Terrestrial TV: ATSC * @SYS_ATSCMH: * Terrestrial TV (mobile): ATSC-M/H * @SYS_DTMB: * Terrestrial TV: DTMB * @SYS_DVBS: * Satellite TV: DVB-S * @SYS_DVBS2: * Satellite TV: DVB-S2 * @SYS_TURBO: * Satellite TV: DVB-S Turbo * @SYS_ISDBS: * Satellite TV: ISDB-S * @SYS_DAB: * Digital audio: DAB (not fully supported) * @SYS_DSS: * Satellite TV: DSS (not fully supported) * @SYS_CMMB: * Terrestrial TV (mobile): CMMB (not fully supported) * @SYS_DVBH: * Terrestrial TV (mobile): DVB-H (standard deprecated) */ enum fe_delivery_system { SYS_UNDEFINED, SYS_DVBC_ANNEX_A, SYS_DVBC_ANNEX_B, SYS_DVBT, SYS_DSS, SYS_DVBS, SYS_DVBS2, SYS_DVBH, SYS_ISDBT, SYS_ISDBS, SYS_ISDBC, SYS_ATSC, SYS_ATSCMH, SYS_DTMB, SYS_CMMB, SYS_DAB, SYS_DVBT2, SYS_TURBO, SYS_DVBC_ANNEX_C, }; /* backward compatibility definitions for delivery systems */ #define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A #define SYS_DMBTH SYS_DTMB /* DMB-TH is legacy name, use DTMB */ /* ATSC-MH specific parameters */ /** * enum atscmh_sccc_block_mode - Type of Series Concatenated Convolutional * Code Block Mode. * * @ATSCMH_SCCC_BLK_SEP: * Separate SCCC: the SCCC outer code mode shall be set independently * for each Group Region (A, B, C, D) * @ATSCMH_SCCC_BLK_COMB: * Combined SCCC: all four Regions shall have the same SCCC outer * code mode. * @ATSCMH_SCCC_BLK_RES: * Reserved. Shouldn't be used. */ enum atscmh_sccc_block_mode { ATSCMH_SCCC_BLK_SEP = 0, ATSCMH_SCCC_BLK_COMB = 1, ATSCMH_SCCC_BLK_RES = 2, }; /** * enum atscmh_sccc_code_mode - Type of Series Concatenated Convolutional * Code Rate. * * @ATSCMH_SCCC_CODE_HLF: * The outer code rate of a SCCC Block is 1/2 rate. * @ATSCMH_SCCC_CODE_QTR: * The outer code rate of a SCCC Block is 1/4 rate. * @ATSCMH_SCCC_CODE_RES: * Reserved. Should not be used. */ enum atscmh_sccc_code_mode { ATSCMH_SCCC_CODE_HLF = 0, ATSCMH_SCCC_CODE_QTR = 1, ATSCMH_SCCC_CODE_RES = 2, }; /** * enum atscmh_rs_frame_ensemble - Reed Solomon(RS) frame ensemble. * * @ATSCMH_RSFRAME_ENS_PRI: Primary Ensemble. * @ATSCMH_RSFRAME_ENS_SEC: Secondary Ensemble. */ enum atscmh_rs_frame_ensemble { ATSCMH_RSFRAME_ENS_PRI = 0, ATSCMH_RSFRAME_ENS_SEC = 1, }; /** * enum atscmh_rs_frame_mode - Reed Solomon (RS) frame mode. * * @ATSCMH_RSFRAME_PRI_ONLY: * Single Frame: There is only a primary RS Frame for all Group * Regions. * @ATSCMH_RSFRAME_PRI_SEC: * Dual Frame: There are two separate RS Frames: Primary RS Frame for * Group Region A and B and Secondary RS Frame for Group Region C and * D. * @ATSCMH_RSFRAME_RES: * Reserved. Shouldn't be used. */ enum atscmh_rs_frame_mode { ATSCMH_RSFRAME_PRI_ONLY = 0, ATSCMH_RSFRAME_PRI_SEC = 1, ATSCMH_RSFRAME_RES = 2, }; /** * enum atscmh_rs_code_mode * @ATSCMH_RSCODE_211_187: Reed Solomon code (211,187). * @ATSCMH_RSCODE_223_187: Reed Solomon code (223,187). * @ATSCMH_RSCODE_235_187: Reed Solomon code (235,187). * @ATSCMH_RSCODE_RES: Reserved. Shouldn't be used. */ enum atscmh_rs_code_mode { ATSCMH_RSCODE_211_187 = 0, ATSCMH_RSCODE_223_187 = 1, ATSCMH_RSCODE_235_187 = 2, ATSCMH_RSCODE_RES = 3, }; #define NO_STREAM_ID_FILTER (~0U) #define LNA_AUTO (~0U) /** * enum fecap_scale_params - scale types for the quality parameters. * * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That * could indicate a temporary or a permanent * condition. * @FE_SCALE_DECIBEL: The scale is measured in 0.001 dB steps, typically * used on signal measures. * @FE_SCALE_RELATIVE: The scale is a relative percentual measure, * ranging from 0 (0%) to 0xffff (100%). * @FE_SCALE_COUNTER: The scale counts the occurrence of an event, like * bit error, block error, lapsed time. */ enum fecap_scale_params { FE_SCALE_NOT_AVAILABLE = 0, FE_SCALE_DECIBEL, FE_SCALE_RELATIVE, FE_SCALE_COUNTER }; /** * struct dtv_stats - Used for reading a DTV status property * * @scale: * Filled with enum fecap_scale_params - the scale in usage * for that parameter * * @svalue: * integer value of the measure, for %FE_SCALE_DECIBEL, * used for dB measures. The unit is 0.001 dB. * * @uvalue: * unsigned integer value of the measure, used when @scale is * either %FE_SCALE_RELATIVE or %FE_SCALE_COUNTER. * * For most delivery systems, this will return a single value for each * parameter. * * It should be noticed, however, that new OFDM delivery systems like * ISDB can use different modulation types for each group of carriers. * On such standards, up to 8 groups of statistics can be provided, one * for each carrier group (called "layer" on ISDB). * * In order to be consistent with other delivery systems, the first * value refers to the entire set of carriers ("global"). * * @scale should use the value %FE_SCALE_NOT_AVAILABLE when * the value for the entire group of carriers or from one specific layer * is not provided by the hardware. * * @len should be filled with the latest filled status + 1. * * In other words, for ISDB, those values should be filled like:: * * u.st.stat.svalue[0] = global statistics; * u.st.stat.scale[0] = FE_SCALE_DECIBEL; * u.st.stat.value[1] = layer A statistics; * u.st.stat.scale[1] = FE_SCALE_NOT_AVAILABLE (if not available); * u.st.stat.svalue[2] = layer B statistics; * u.st.stat.scale[2] = FE_SCALE_DECIBEL; * u.st.stat.svalue[3] = layer C statistics; * u.st.stat.scale[3] = FE_SCALE_DECIBEL; * u.st.len = 4; */ struct dtv_stats { __u8 scale; /* enum fecap_scale_params type */ union { __u64 uvalue; /* for counters and relative scales */ __s64 svalue; /* for 0.001 dB measures */ }; } __attribute__ ((packed)); #define MAX_DTV_STATS 4 /** * struct dtv_fe_stats - store Digital TV frontend statistics * * @len: length of the statistics - if zero, stats is disabled. * @stat: array with digital TV statistics. * * On most standards, @len can either be 0 or 1. However, for ISDB, each * layer is modulated in separate. So, each layer may have its own set * of statistics. If so, stat[0] carries on a global value for the property. * Indexes 1 to 3 means layer A to B. */ struct dtv_fe_stats { __u8 len; struct dtv_stats stat[MAX_DTV_STATS]; } __attribute__ ((packed)); /** * struct dtv_property - store one of frontend command and its value * * @cmd: Digital TV command. * @reserved: Not used. * @u: Union with the values for the command. * @u.data: A unsigned 32 bits integer with command value. * @u.buffer: Struct to store bigger properties. * Currently unused. * @u.buffer.data: an unsigned 32-bits array. * @u.buffer.len: number of elements of the buffer. * @u.buffer.reserved1: Reserved. * @u.buffer.reserved2: Reserved. * @u.st: a &struct dtv_fe_stats array of statistics. * @result: Currently unused. * */ struct dtv_property { __u32 cmd; __u32 reserved[3]; union { __u32 data; struct dtv_fe_stats st; struct { __u8 data[32]; __u32 len; __u32 reserved1[3]; void *reserved2; } buffer; } u; int result; } __attribute__ ((packed)); /* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */ #define DTV_IOCTL_MAX_MSGS 64 /** * struct dtv_properties - a set of command/value pairs. * * @num: amount of commands stored at the struct. * @props: a pointer to &struct dtv_property. */ struct dtv_properties { __u32 num; struct dtv_property *props; }; /* * When set, this flag will disable any zigzagging or other "normal" tuning * behavior. Additionally, there will be no automatic monitoring of the lock * status, and hence no frontend events will be generated. If a frontend device * is closed, this flag will be automatically turned off when the device is * reopened read-write. */ #define FE_TUNE_MODE_ONESHOT 0x01 /* Digital TV Frontend API calls */ #define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) #define FE_DISEQC_RESET_OVERLOAD _IO('o', 62) #define FE_DISEQC_SEND_MASTER_CMD _IOW('o', 63, struct dvb_diseqc_master_cmd) #define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply) #define FE_DISEQC_SEND_BURST _IO('o', 65) /* fe_sec_mini_cmd_t */ #define FE_SET_TONE _IO('o', 66) /* fe_sec_tone_mode_t */ #define FE_SET_VOLTAGE _IO('o', 67) /* fe_sec_voltage_t */ #define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */ #define FE_READ_STATUS _IOR('o', 69, fe_status_t) #define FE_READ_BER _IOR('o', 70, __u32) #define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16) #define FE_READ_SNR _IOR('o', 72, __u16) #define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32) #define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */ #define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) #define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ #define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties) #define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties) /* * DEPRECATED: Everything below is deprecated in favor of DVBv5 API * * The DVBv3 only ioctls, structs and enums should not be used on * newer programs, as it doesn't support the second generation of * digital TV standards, nor supports newer delivery systems. * They also don't support modern frontends with usually support multiple * delivery systems. * * Drivers shouldn't use them. * * New applications should use DVBv5 delivery system instead */ /* */ enum fe_bandwidth { BANDWIDTH_8_MHZ, BANDWIDTH_7_MHZ, BANDWIDTH_6_MHZ, BANDWIDTH_AUTO, BANDWIDTH_5_MHZ, BANDWIDTH_10_MHZ, BANDWIDTH_1_712_MHZ, }; /* This is kept for legacy userspace support */ typedef enum fe_sec_voltage fe_sec_voltage_t; typedef enum fe_caps fe_caps_t; typedef enum fe_type fe_type_t; typedef enum fe_sec_tone_mode fe_sec_tone_mode_t; typedef enum fe_sec_mini_cmd fe_sec_mini_cmd_t; typedef enum fe_status fe_status_t; typedef enum fe_spectral_inversion fe_spectral_inversion_t; typedef enum fe_code_rate fe_code_rate_t; typedef enum fe_modulation fe_modulation_t; typedef enum fe_transmit_mode fe_transmit_mode_t; typedef enum fe_bandwidth fe_bandwidth_t; typedef enum fe_guard_interval fe_guard_interval_t; typedef enum fe_hierarchy fe_hierarchy_t; typedef enum fe_pilot fe_pilot_t; typedef enum fe_rolloff fe_rolloff_t; typedef enum fe_delivery_system fe_delivery_system_t; /* DVBv3 structs */ struct dvb_qpsk_parameters { __u32 symbol_rate; /* symbol rate in Symbols per second */ fe_code_rate_t fec_inner; /* forward error correction (see above) */ }; struct dvb_qam_parameters { __u32 symbol_rate; /* symbol rate in Symbols per second */ fe_code_rate_t fec_inner; /* forward error correction (see above) */ fe_modulation_t modulation; /* modulation type (see above) */ }; struct dvb_vsb_parameters { fe_modulation_t modulation; /* modulation type (see above) */ }; struct dvb_ofdm_parameters { fe_bandwidth_t bandwidth; fe_code_rate_t code_rate_HP; /* high priority stream code rate */ fe_code_rate_t code_rate_LP; /* low priority stream code rate */ fe_modulation_t constellation; /* modulation type (see above) */ fe_transmit_mode_t transmission_mode; fe_guard_interval_t guard_interval; fe_hierarchy_t hierarchy_information; }; struct dvb_frontend_parameters { __u32 frequency; /* (absolute) frequency in Hz for DVB-C/DVB-T/ATSC */ /* intermediate frequency in kHz for DVB-S */ fe_spectral_inversion_t inversion; union { struct dvb_qpsk_parameters qpsk; /* DVB-S */ struct dvb_qam_parameters qam; /* DVB-C */ struct dvb_ofdm_parameters ofdm; /* DVB-T */ struct dvb_vsb_parameters vsb; /* ATSC */ } u; }; struct dvb_frontend_event { fe_status_t status; struct dvb_frontend_parameters parameters; }; /* DVBv3 API calls */ #define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters) #define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) #endif /*_DVBFRONTEND_H_*/ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/timex.h���������������������������������������������������������������������������������������0000644�����������������00000014403�14763166027�0007220 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************** * * * Copyright (c) David L. Mills 1993 * * * * Permission to use, copy, modify, and distribute this software and its * * documentation for any purpose and without fee is hereby granted, provided * * that the above copyright notice appears in all copies and that both the * * copyright notice and this permission notice appear in supporting * * documentation, and that the name University of Delaware not be used in * * advertising or publicity pertaining to distribution of the software * * without specific, written prior permission. The University of Delaware * * makes no representations about the suitability this software for any * * purpose. It is provided "as is" without express or implied warranty. * * * *****************************************************************************/ /* * Modification history timex.h * * 29 Dec 97 Russell King * Moved CLOCK_TICK_RATE, CLOCK_TICK_FACTOR and FINETUNE to asm/timex.h * for ARM machines * * 9 Jan 97 Adrian Sun * Shifted LATCH define to allow access to alpha machines. * * 26 Sep 94 David L. Mills * Added defines for hybrid phase/frequency-lock loop. * * 19 Mar 94 David L. Mills * Moved defines from kernel routines to header file and added new * defines for PPS phase-lock loop. * * 20 Feb 94 David L. Mills * Revised status codes and structures for external clock and PPS * signal discipline. * * 28 Nov 93 David L. Mills * Adjusted parameters to improve stability and increase poll * interval. * * 17 Sep 93 David L. Mills * Created file $NTP/include/sys/timex.h * 07 Oct 93 Torsten Duwe * Derived linux/timex.h * 1995-08-13 Torsten Duwe * kernel PLL updated to 1994-12-13 specs (rfc-1589) * 1997-08-30 Ulrich Windl * Added new constant NTP_PHASE_LIMIT * 2004-08-12 Christoph Lameter * Reworked time interpolation logic */ #ifndef _LINUX_TIMEX_H #define _LINUX_TIMEX_H #include <linux/time.h> #define NTP_API 4 /* NTP API version */ /* * syscall interface - used (mainly by NTP daemon) * to discipline kernel clock oscillator */ struct timex { unsigned int modes; /* mode selector */ __kernel_long_t offset; /* time offset (usec) */ __kernel_long_t freq; /* frequency offset (scaled ppm) */ __kernel_long_t maxerror;/* maximum error (usec) */ __kernel_long_t esterror;/* estimated error (usec) */ int status; /* clock command/status */ __kernel_long_t constant;/* pll time constant */ __kernel_long_t precision;/* clock precision (usec) (read only) */ __kernel_long_t tolerance;/* clock frequency tolerance (ppm) * (read only) */ struct timeval time; /* (read only, except for ADJ_SETOFFSET) */ __kernel_long_t tick; /* (modified) usecs between clock ticks */ __kernel_long_t ppsfreq;/* pps frequency (scaled ppm) (ro) */ __kernel_long_t jitter; /* pps jitter (us) (ro) */ int shift; /* interval duration (s) (shift) (ro) */ __kernel_long_t stabil; /* pps stability (scaled ppm) (ro) */ __kernel_long_t jitcnt; /* jitter limit exceeded (ro) */ __kernel_long_t calcnt; /* calibration intervals (ro) */ __kernel_long_t errcnt; /* calibration errors (ro) */ __kernel_long_t stbcnt; /* stability limit exceeded (ro) */ int tai; /* TAI offset (ro) */ int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; }; /* * Mode codes (timex.mode) */ #define ADJ_OFFSET 0x0001 /* time offset */ #define ADJ_FREQUENCY 0x0002 /* frequency offset */ #define ADJ_MAXERROR 0x0004 /* maximum time error */ #define ADJ_ESTERROR 0x0008 /* estimated time error */ #define ADJ_STATUS 0x0010 /* clock status */ #define ADJ_TIMECONST 0x0020 /* pll time constant */ #define ADJ_TAI 0x0080 /* set TAI offset */ #define ADJ_SETOFFSET 0x0100 /* add 'time' to current time */ #define ADJ_MICRO 0x1000 /* select microsecond resolution */ #define ADJ_NANO 0x2000 /* select nanosecond resolution */ #define ADJ_TICK 0x4000 /* tick value */ #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ #define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ /* NTP userland likes the MOD_ prefix better */ #define MOD_OFFSET ADJ_OFFSET #define MOD_FREQUENCY ADJ_FREQUENCY #define MOD_MAXERROR ADJ_MAXERROR #define MOD_ESTERROR ADJ_ESTERROR #define MOD_STATUS ADJ_STATUS #define MOD_TIMECONST ADJ_TIMECONST #define MOD_TAI ADJ_TAI #define MOD_MICRO ADJ_MICRO #define MOD_NANO ADJ_NANO /* * Status codes (timex.status) */ #define STA_PLL 0x0001 /* enable PLL updates (rw) */ #define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */ #define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */ #define STA_FLL 0x0008 /* select frequency-lock mode (rw) */ #define STA_INS 0x0010 /* insert leap (rw) */ #define STA_DEL 0x0020 /* delete leap (rw) */ #define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */ #define STA_FREQHOLD 0x0080 /* hold frequency (rw) */ #define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */ #define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */ #define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */ #define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ #define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ #define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */ #define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */ #define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */ /* read-only bits */ #define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK) /* * Clock states (time_state) */ #define TIME_OK 0 /* clock synchronized, no leap second */ #define TIME_INS 1 /* insert leap second */ #define TIME_DEL 2 /* delete leap second */ #define TIME_OOP 3 /* leap second in progress */ #define TIME_WAIT 4 /* leap second has occurred */ #define TIME_ERROR 5 /* clock not synchronized */ #define TIME_BAD TIME_ERROR /* bw compat */ #endif /* _LINUX_TIMEX_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_ether.h������������������������������������������������������������������������������������0000644�����������������00000017601�14763166027�0007662 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Global definitions for the Ethernet IEEE 802.3 interface. * * Version: @(#)if_ether.h 1.0.1a 02/08/94 * * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Donald Becker, <becker@super.org> * Alan Cox, <alan@lxorguk.ukuu.org.uk> * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> * * 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. */ #ifndef _LINUX_IF_ETHER_H #define _LINUX_IF_ETHER_H #include <linux/types.h> /* * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble * and FCS/CRC (frame check sequence). */ #define ETH_ALEN 6 /* Octets in one ethernet addr */ #define ETH_TLEN 2 /* Octets in ethernet type field */ #define ETH_HLEN 14 /* Total octets in header. */ #define ETH_ZLEN 60 /* Min. octets in frame sans FCS */ #define ETH_DATA_LEN 1500 /* Max. octets in payload */ #define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */ #define ETH_FCS_LEN 4 /* Octets in the FCS */ #define ETH_MIN_MTU 68 /* Min IPv4 MTU per RFC791 */ #define ETH_MAX_MTU 0xFFFFU /* 65535, same as IP_MAX_MTU */ /* * These are the defined Ethernet Protocol ID's. */ #define ETH_P_LOOP 0x0060 /* Ethernet Loopback packet */ #define ETH_P_PUP 0x0200 /* Xerox PUP packet */ #define ETH_P_PUPAT 0x0201 /* Xerox PUP Addr Trans packet */ #define ETH_P_TSN 0x22F0 /* TSN (IEEE 1722) packet */ #define ETH_P_ERSPAN2 0x22EB /* ERSPAN version 2 (type III) */ #define ETH_P_IP 0x0800 /* Internet Protocol packet */ #define ETH_P_X25 0x0805 /* CCITT X.25 */ #define ETH_P_ARP 0x0806 /* Address Resolution packet */ #define ETH_P_BPQ 0x08FF /* G8BPQ AX.25 Ethernet Packet [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_IEEEPUP 0x0a00 /* Xerox IEEE802.3 PUP packet */ #define ETH_P_IEEEPUPAT 0x0a01 /* Xerox IEEE802.3 PUP Addr Trans packet */ #define ETH_P_BATMAN 0x4305 /* B.A.T.M.A.N.-Advanced packet [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_DEC 0x6000 /* DEC Assigned proto */ #define ETH_P_DNA_DL 0x6001 /* DEC DNA Dump/Load */ #define ETH_P_DNA_RC 0x6002 /* DEC DNA Remote Console */ #define ETH_P_DNA_RT 0x6003 /* DEC DNA Routing */ #define ETH_P_LAT 0x6004 /* DEC LAT */ #define ETH_P_DIAG 0x6005 /* DEC Diagnostics */ #define ETH_P_CUST 0x6006 /* DEC Customer use */ #define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */ #define ETH_P_TEB 0x6558 /* Trans Ether Bridging */ #define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */ #define ETH_P_ATALK 0x809B /* Appletalk DDP */ #define ETH_P_AARP 0x80F3 /* Appletalk AARP */ #define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */ #define ETH_P_ERSPAN 0x88BE /* ERSPAN type II */ #define ETH_P_IPX 0x8137 /* IPX over DIX */ #define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ #define ETH_P_PAUSE 0x8808 /* IEEE Pause frames. See 802.3 31B */ #define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */ #define ETH_P_WCCP 0x883E /* Web-cache coordination protocol * defined in draft-wilson-wrec-wccp-v2-00.txt */ #define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */ #define ETH_P_MPLS_MC 0x8848 /* MPLS Multicast traffic */ #define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */ #define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */ #define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */ #define ETH_P_LINK_CTL 0x886c /* HPNA, wlan link local tunnel */ #define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport * over Ethernet */ #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ #define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ #define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */ #define ETH_P_802_EX1 0x88B5 /* 802.1 Local Experimental 1. */ #define ETH_P_PREAUTH 0x88C7 /* 802.11 Preauthentication */ #define ETH_P_TIPC 0x88CA /* TIPC */ #define ETH_P_MACSEC 0x88E5 /* 802.1ae MACsec */ #define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */ #define ETH_P_MVRP 0x88F5 /* 802.1Q MVRP */ #define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */ #define ETH_P_NCSI 0x88F8 /* NCSI protocol */ #define ETH_P_PRP 0x88FB /* IEC 62439-3 PRP/HSRv0 */ #define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ #define ETH_P_IBOE 0x8915 /* Infiniband over Ethernet */ #define ETH_P_TDLS 0x890D /* TDLS */ #define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */ #define ETH_P_80221 0x8917 /* IEEE 802.21 Media Independent Handover Protocol */ #define ETH_P_HSR 0x892F /* IEC 62439-3 HSRv1 */ #define ETH_P_NSH 0x894F /* Network Service Header */ #define ETH_P_LOOPBACK 0x9000 /* Ethernet loopback packet, per IEEE 802.3 */ #define ETH_P_QINQ1 0x9100 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_QINQ2 0x9200 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_QINQ3 0x9300 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_IFE 0xED3E /* ForCES inter-FE LFB type */ #define ETH_P_AF_IUCV 0xFBFB /* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_802_3_MIN 0x0600 /* If the value in the ethernet type is less than this value * then the frame is Ethernet II. Else it is 802.3 */ /* * Non DIX types. Won't clash for 1500 types. */ #define ETH_P_802_3 0x0001 /* Dummy type for 802.3 frames */ #define ETH_P_AX25 0x0002 /* Dummy protocol id for AX.25 */ #define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */ #define ETH_P_802_2 0x0004 /* 802.2 frames */ #define ETH_P_SNAP 0x0005 /* Internal only */ #define ETH_P_DDCMP 0x0006 /* DEC DDCMP: Internal only */ #define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/ #define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */ #define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */ #define ETH_P_CAN 0x000C /* CAN: Controller Area Network */ #define ETH_P_CANFD 0x000D /* CANFD: CAN flexible data rate*/ #define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/ #define ETH_P_TR_802_2 0x0011 /* 802.2 frames */ #define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */ #define ETH_P_CONTROL 0x0016 /* Card specific control frames */ #define ETH_P_IRDA 0x0017 /* Linux-IrDA */ #define ETH_P_ECONET 0x0018 /* Acorn Econet */ #define ETH_P_HDLC 0x0019 /* HDLC frames */ #define ETH_P_ARCNET 0x001A /* 1A for ArcNet :-) */ #define ETH_P_DSA 0x001B /* Distributed Switch Arch. */ #define ETH_P_TRAILER 0x001C /* Trailer switch tagging */ #define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */ #define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */ #define ETH_P_CAIF 0x00F7 /* ST-Ericsson CAIF protocol */ #define ETH_P_XDSA 0x00F8 /* Multiplexed DSA protocol */ #define ETH_P_MAP 0x00F9 /* Qualcomm multiplexing and * aggregation protocol */ /* * This is an Ethernet frame header. */ /* allow libcs like musl to deactivate this, glibc does not implement this. */ #ifndef __UAPI_DEF_ETHHDR #define __UAPI_DEF_ETHHDR 1 #endif #if __UAPI_DEF_ETHHDR struct ethhdr { unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ unsigned char h_source[ETH_ALEN]; /* source ether addr */ __be16 h_proto; /* packet type ID field */ } __attribute__((packed)); #endif #endif /* _LINUX_IF_ETHER_H */ �������������������������������������������������������������������������������������������������������������������������������linux/atmapi.h��������������������������������������������������������������������������������������0000644�����������������00000001670�14763166027�0007347 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atmapi.h - ATM API user space/kernel compatibility */ /* Written 1999,2000 by Werner Almesberger, EPFL ICA */ #ifndef _LINUX_ATMAPI_H #define _LINUX_ATMAPI_H #if defined(__sparc__) || defined(__ia64__) /* such alignment is not required on 32 bit sparcs, but we can't figure that we are on a sparc64 while compiling user-space programs. */ #define __ATM_API_ALIGN __attribute__((aligned(8))) #else #define __ATM_API_ALIGN #endif /* * Opaque type for kernel pointers. Note that _ is never accessed. We need * the struct in order hide the array, so that we can make simple assignments * instead of being forced to use memcpy. It also improves error reporting for * code that still assumes that we're passing unsigned longs. * * Convention: NULL pointers are passed as a field of all zeroes. */ typedef struct { unsigned char _[8]; } __ATM_API_ALIGN atm_kptr_t; #endif ������������������������������������������������������������������������linux/if_packet.h�����������������������������������������������������������������������������������0000644�����������������00000017357�14763166027�0010032 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_IF_PACKET_H #define __LINUX_IF_PACKET_H #include <linux/types.h> struct sockaddr_pkt { unsigned short spkt_family; unsigned char spkt_device[14]; __be16 spkt_protocol; }; struct sockaddr_ll { unsigned short sll_family; __be16 sll_protocol; int sll_ifindex; unsigned short sll_hatype; unsigned char sll_pkttype; unsigned char sll_halen; unsigned char sll_addr[8]; }; /* Packet types */ #define PACKET_HOST 0 /* To us */ #define PACKET_BROADCAST 1 /* To all */ #define PACKET_MULTICAST 2 /* To group */ #define PACKET_OTHERHOST 3 /* To someone else */ #define PACKET_OUTGOING 4 /* Outgoing of any type */ #define PACKET_LOOPBACK 5 /* MC/BRD frame looped back */ #define PACKET_USER 6 /* To user space */ #define PACKET_KERNEL 7 /* To kernel space */ /* Unused, PACKET_FASTROUTE and PACKET_LOOPBACK are invisible to user space */ #define PACKET_FASTROUTE 6 /* Fastrouted frame */ /* Packet socket options */ #define PACKET_ADD_MEMBERSHIP 1 #define PACKET_DROP_MEMBERSHIP 2 #define PACKET_RECV_OUTPUT 3 /* Value 4 is still used by obsolete turbo-packet. */ #define PACKET_RX_RING 5 #define PACKET_STATISTICS 6 #define PACKET_COPY_THRESH 7 #define PACKET_AUXDATA 8 #define PACKET_ORIGDEV 9 #define PACKET_VERSION 10 #define PACKET_HDRLEN 11 #define PACKET_RESERVE 12 #define PACKET_TX_RING 13 #define PACKET_LOSS 14 #define PACKET_VNET_HDR 15 #define PACKET_TX_TIMESTAMP 16 #define PACKET_TIMESTAMP 17 #define PACKET_FANOUT 18 #define PACKET_TX_HAS_OFF 19 #define PACKET_QDISC_BYPASS 20 #define PACKET_ROLLOVER_STATS 21 #define PACKET_FANOUT_DATA 22 #define PACKET_FANOUT_HASH 0 #define PACKET_FANOUT_LB 1 #define PACKET_FANOUT_CPU 2 #define PACKET_FANOUT_ROLLOVER 3 #define PACKET_FANOUT_RND 4 #define PACKET_FANOUT_QM 5 #define PACKET_FANOUT_CBPF 6 #define PACKET_FANOUT_EBPF 7 #define PACKET_FANOUT_FLAG_ROLLOVER 0x1000 #define PACKET_FANOUT_FLAG_UNIQUEID 0x2000 #define PACKET_FANOUT_FLAG_DEFRAG 0x8000 struct tpacket_stats { unsigned int tp_packets; unsigned int tp_drops; }; struct tpacket_stats_v3 { unsigned int tp_packets; unsigned int tp_drops; unsigned int tp_freeze_q_cnt; }; struct tpacket_rollover_stats { __aligned_u64 tp_all; __aligned_u64 tp_huge; __aligned_u64 tp_failed; }; union tpacket_stats_u { struct tpacket_stats stats1; struct tpacket_stats_v3 stats3; }; struct tpacket_auxdata { __u32 tp_status; __u32 tp_len; __u32 tp_snaplen; __u16 tp_mac; __u16 tp_net; __u16 tp_vlan_tci; __u16 tp_vlan_tpid; }; /* Rx ring - header status */ #define TP_STATUS_KERNEL 0 #define TP_STATUS_USER (1 << 0) #define TP_STATUS_COPY (1 << 1) #define TP_STATUS_LOSING (1 << 2) #define TP_STATUS_CSUMNOTREADY (1 << 3) #define TP_STATUS_VLAN_VALID (1 << 4) /* auxdata has valid tp_vlan_tci */ #define TP_STATUS_BLK_TMO (1 << 5) #define TP_STATUS_VLAN_TPID_VALID (1 << 6) /* auxdata has valid tp_vlan_tpid */ #define TP_STATUS_CSUM_VALID (1 << 7) /* Tx ring - header status */ #define TP_STATUS_AVAILABLE 0 #define TP_STATUS_SEND_REQUEST (1 << 0) #define TP_STATUS_SENDING (1 << 1) #define TP_STATUS_WRONG_FORMAT (1 << 2) /* Rx and Tx ring - header status */ #define TP_STATUS_TS_SOFTWARE (1 << 29) #define TP_STATUS_TS_SYS_HARDWARE (1 << 30) /* deprecated, never set */ #define TP_STATUS_TS_RAW_HARDWARE (1 << 31) /* Rx ring - feature request bits */ #define TP_FT_REQ_FILL_RXHASH 0x1 struct tpacket_hdr { unsigned long tp_status; unsigned int tp_len; unsigned int tp_snaplen; unsigned short tp_mac; unsigned short tp_net; unsigned int tp_sec; unsigned int tp_usec; }; #define TPACKET_ALIGNMENT 16 #define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1)&~(TPACKET_ALIGNMENT-1)) #define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll)) struct tpacket2_hdr { __u32 tp_status; __u32 tp_len; __u32 tp_snaplen; __u16 tp_mac; __u16 tp_net; __u32 tp_sec; __u32 tp_nsec; __u16 tp_vlan_tci; __u16 tp_vlan_tpid; __u8 tp_padding[4]; }; struct tpacket_hdr_variant1 { __u32 tp_rxhash; __u32 tp_vlan_tci; __u16 tp_vlan_tpid; __u16 tp_padding; }; struct tpacket3_hdr { __u32 tp_next_offset; __u32 tp_sec; __u32 tp_nsec; __u32 tp_snaplen; __u32 tp_len; __u32 tp_status; __u16 tp_mac; __u16 tp_net; /* pkt_hdr variants */ union { struct tpacket_hdr_variant1 hv1; }; __u8 tp_padding[8]; }; struct tpacket_bd_ts { unsigned int ts_sec; union { unsigned int ts_usec; unsigned int ts_nsec; }; }; struct tpacket_hdr_v1 { __u32 block_status; __u32 num_pkts; __u32 offset_to_first_pkt; /* Number of valid bytes (including padding) * blk_len <= tp_block_size */ __u32 blk_len; /* * Quite a few uses of sequence number: * 1. Make sure cache flush etc worked. * Well, one can argue - why not use the increasing ts below? * But look at 2. below first. * 2. When you pass around blocks to other user space decoders, * you can see which blk[s] is[are] outstanding etc. * 3. Validate kernel code. */ __aligned_u64 seq_num; /* * ts_last_pkt: * * Case 1. Block has 'N'(N >=1) packets and TMO'd(timed out) * ts_last_pkt == 'time-stamp of last packet' and NOT the * time when the timer fired and the block was closed. * By providing the ts of the last packet we can absolutely * guarantee that time-stamp wise, the first packet in the * next block will never precede the last packet of the * previous block. * Case 2. Block has zero packets and TMO'd * ts_last_pkt = time when the timer fired and the block * was closed. * Case 3. Block has 'N' packets and NO TMO. * ts_last_pkt = time-stamp of the last pkt in the block. * * ts_first_pkt: * Is always the time-stamp when the block was opened. * Case a) ZERO packets * No packets to deal with but atleast you know the * time-interval of this block. * Case b) Non-zero packets * Use the ts of the first packet in the block. * */ struct tpacket_bd_ts ts_first_pkt, ts_last_pkt; }; union tpacket_bd_header_u { struct tpacket_hdr_v1 bh1; }; struct tpacket_block_desc { __u32 version; __u32 offset_to_priv; union tpacket_bd_header_u hdr; }; #define TPACKET2_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + sizeof(struct sockaddr_ll)) #define TPACKET3_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket3_hdr)) + sizeof(struct sockaddr_ll)) enum tpacket_versions { TPACKET_V1, TPACKET_V2, TPACKET_V3 }; /* Frame structure: - Start. Frame must be aligned to TPACKET_ALIGNMENT=16 - struct tpacket_hdr - pad to TPACKET_ALIGNMENT=16 - struct sockaddr_ll - Gap, chosen so that packet data (Start+tp_net) alignes to TPACKET_ALIGNMENT=16 - Start+tp_mac: [ Optional MAC header ] - Start+tp_net: Packet data, aligned to TPACKET_ALIGNMENT=16. - Pad to align to TPACKET_ALIGNMENT=16 */ struct tpacket_req { unsigned int tp_block_size; /* Minimal size of contiguous block */ unsigned int tp_block_nr; /* Number of blocks */ unsigned int tp_frame_size; /* Size of frame */ unsigned int tp_frame_nr; /* Total number of frames */ }; struct tpacket_req3 { unsigned int tp_block_size; /* Minimal size of contiguous block */ unsigned int tp_block_nr; /* Number of blocks */ unsigned int tp_frame_size; /* Size of frame */ unsigned int tp_frame_nr; /* Total number of frames */ unsigned int tp_retire_blk_tov; /* timeout in msecs */ unsigned int tp_sizeof_priv; /* offset to private data area */ unsigned int tp_feature_req_word; }; union tpacket_req_u { struct tpacket_req req; struct tpacket_req3 req3; }; struct packet_mreq { int mr_ifindex; unsigned short mr_type; unsigned short mr_alen; unsigned char mr_address[8]; }; #define PACKET_MR_MULTICAST 0 #define PACKET_MR_PROMISC 1 #define PACKET_MR_ALLMULTI 2 #define PACKET_MR_UNICAST 3 #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/auxvec.h��������������������������������������������������������������������������������������0000644�����������������00000002730�14763166027�0007365 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_AUXVEC_H #define _LINUX_AUXVEC_H #include <asm/auxvec.h> /* Symbolic values for the entries in the auxiliary table put on the initial stack */ #define AT_NULL 0 /* end of vector */ #define AT_IGNORE 1 /* entry should be ignored */ #define AT_EXECFD 2 /* file descriptor of program */ #define AT_PHDR 3 /* program headers for program */ #define AT_PHENT 4 /* size of program header entry */ #define AT_PHNUM 5 /* number of program headers */ #define AT_PAGESZ 6 /* system page size */ #define AT_BASE 7 /* base address of interpreter */ #define AT_FLAGS 8 /* flags */ #define AT_ENTRY 9 /* entry point of program */ #define AT_NOTELF 10 /* program is not ELF */ #define AT_UID 11 /* real uid */ #define AT_EUID 12 /* effective uid */ #define AT_GID 13 /* real gid */ #define AT_EGID 14 /* effective gid */ #define AT_PLATFORM 15 /* string identifying CPU for optimizations */ #define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ #define AT_CLKTCK 17 /* frequency at which times() increments */ /* AT_* values 18 through 22 are reserved */ #define AT_SECURE 23 /* secure mode boolean */ #define AT_BASE_PLATFORM 24 /* string identifying real platform, may * differ from AT_PLATFORM. */ #define AT_RANDOM 25 /* address of 16 random bytes */ #define AT_HWCAP2 26 /* extension of AT_HWCAP */ #define AT_EXECFN 31 /* filename of program */ #endif /* _LINUX_AUXVEC_H */ ����������������������������������������linux/videodev2.h�����������������������������������������������������������������������������������0000644�����������������00000251747�14763166027�0007777 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * Video for Linux Two header file * * Copyright (C) 1999-2012 the contributors * * 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. * * Alternatively you can redistribute this file under the terms of the * BSD license as stated below: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of its contributors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Header file for v4l or V4L2 drivers and applications * with public API. * All kernel-specific stuff were moved to media/v4l2-dev.h, so * no #if __KERNEL tests are allowed here * * See https://linuxtv.org for more info * * Author: Bill Dirks <bill@thedirks.org> * Justin Schoeman * Hans Verkuil <hverkuil@xs4all.nl> * et al. */ #ifndef __LINUX_VIDEODEV2_H #define __LINUX_VIDEODEV2_H #include <sys/time.h> #include <linux/ioctl.h> #include <linux/types.h> #include <linux/v4l2-common.h> #include <linux/v4l2-controls.h> /* * Common stuff for both V4L1 and V4L2 * Moved from videodev.h */ #define VIDEO_MAX_FRAME 32 #define VIDEO_MAX_PLANES 8 /* * M I S C E L L A N E O U S */ /* Four-character-code (FOURCC) */ #define v4l2_fourcc(a, b, c, d)\ ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24)) #define v4l2_fourcc_be(a, b, c, d) (v4l2_fourcc(a, b, c, d) | (1 << 31)) /* * E N U M S */ enum v4l2_field { V4L2_FIELD_ANY = 0, /* driver can choose from none, top, bottom, interlaced depending on whatever it thinks is approximate ... */ V4L2_FIELD_NONE = 1, /* this device has no fields ... */ V4L2_FIELD_TOP = 2, /* top field only */ V4L2_FIELD_BOTTOM = 3, /* bottom field only */ V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */ V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one buffer, top-bottom order */ V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */ V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into separate buffers */ V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field first and the top field is transmitted first */ V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field first and the bottom field is transmitted first */ }; #define V4L2_FIELD_HAS_TOP(field) \ ((field) == V4L2_FIELD_TOP ||\ (field) == V4L2_FIELD_INTERLACED ||\ (field) == V4L2_FIELD_INTERLACED_TB ||\ (field) == V4L2_FIELD_INTERLACED_BT ||\ (field) == V4L2_FIELD_SEQ_TB ||\ (field) == V4L2_FIELD_SEQ_BT) #define V4L2_FIELD_HAS_BOTTOM(field) \ ((field) == V4L2_FIELD_BOTTOM ||\ (field) == V4L2_FIELD_INTERLACED ||\ (field) == V4L2_FIELD_INTERLACED_TB ||\ (field) == V4L2_FIELD_INTERLACED_BT ||\ (field) == V4L2_FIELD_SEQ_TB ||\ (field) == V4L2_FIELD_SEQ_BT) #define V4L2_FIELD_HAS_BOTH(field) \ ((field) == V4L2_FIELD_INTERLACED ||\ (field) == V4L2_FIELD_INTERLACED_TB ||\ (field) == V4L2_FIELD_INTERLACED_BT ||\ (field) == V4L2_FIELD_SEQ_TB ||\ (field) == V4L2_FIELD_SEQ_BT) #define V4L2_FIELD_HAS_T_OR_B(field) \ ((field) == V4L2_FIELD_BOTTOM ||\ (field) == V4L2_FIELD_TOP ||\ (field) == V4L2_FIELD_ALTERNATE) enum v4l2_buf_type { V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, V4L2_BUF_TYPE_VIDEO_OUTPUT = 2, V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, V4L2_BUF_TYPE_VBI_CAPTURE = 4, V4L2_BUF_TYPE_VBI_OUTPUT = 5, V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10, V4L2_BUF_TYPE_SDR_CAPTURE = 11, V4L2_BUF_TYPE_SDR_OUTPUT = 12, V4L2_BUF_TYPE_META_CAPTURE = 13, /* Deprecated, do not use */ V4L2_BUF_TYPE_PRIVATE = 0x80, }; #define V4L2_TYPE_IS_MULTIPLANAR(type) \ ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE \ || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) #define V4L2_TYPE_IS_OUTPUT(type) \ ((type) == V4L2_BUF_TYPE_VIDEO_OUTPUT \ || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE \ || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY \ || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY \ || (type) == V4L2_BUF_TYPE_VBI_OUTPUT \ || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT \ || (type) == V4L2_BUF_TYPE_SDR_OUTPUT) enum v4l2_tuner_type { V4L2_TUNER_RADIO = 1, V4L2_TUNER_ANALOG_TV = 2, V4L2_TUNER_DIGITAL_TV = 3, V4L2_TUNER_SDR = 4, V4L2_TUNER_RF = 5, }; /* Deprecated, do not use */ #define V4L2_TUNER_ADC V4L2_TUNER_SDR enum v4l2_memory { V4L2_MEMORY_MMAP = 1, V4L2_MEMORY_USERPTR = 2, V4L2_MEMORY_OVERLAY = 3, V4L2_MEMORY_DMABUF = 4, }; /* see also http://vektor.theorem.ca/graphics/ycbcr/ */ enum v4l2_colorspace { /* * Default colorspace, i.e. let the driver figure it out. * Can only be used with video capture. */ V4L2_COLORSPACE_DEFAULT = 0, /* SMPTE 170M: used for broadcast NTSC/PAL SDTV */ V4L2_COLORSPACE_SMPTE170M = 1, /* Obsolete pre-1998 SMPTE 240M HDTV standard, superseded by Rec 709 */ V4L2_COLORSPACE_SMPTE240M = 2, /* Rec.709: used for HDTV */ V4L2_COLORSPACE_REC709 = 3, /* * Deprecated, do not use. No driver will ever return this. This was * based on a misunderstanding of the bt878 datasheet. */ V4L2_COLORSPACE_BT878 = 4, /* * NTSC 1953 colorspace. This only makes sense when dealing with * really, really old NTSC recordings. Superseded by SMPTE 170M. */ V4L2_COLORSPACE_470_SYSTEM_M = 5, /* * EBU Tech 3213 PAL/SECAM colorspace. This only makes sense when * dealing with really old PAL/SECAM recordings. Superseded by * SMPTE 170M. */ V4L2_COLORSPACE_470_SYSTEM_BG = 6, /* * Effectively shorthand for V4L2_COLORSPACE_SRGB, V4L2_YCBCR_ENC_601 * and V4L2_QUANTIZATION_FULL_RANGE. To be used for (Motion-)JPEG. */ V4L2_COLORSPACE_JPEG = 7, /* For RGB colorspaces such as produces by most webcams. */ V4L2_COLORSPACE_SRGB = 8, /* opRGB colorspace */ V4L2_COLORSPACE_OPRGB = 9, /* BT.2020 colorspace, used for UHDTV. */ V4L2_COLORSPACE_BT2020 = 10, /* Raw colorspace: for RAW unprocessed images */ V4L2_COLORSPACE_RAW = 11, /* DCI-P3 colorspace, used by cinema projectors */ V4L2_COLORSPACE_DCI_P3 = 12, }; /* * Determine how COLORSPACE_DEFAULT should map to a proper colorspace. * This depends on whether this is a SDTV image (use SMPTE 170M), an * HDTV image (use Rec. 709), or something else (use sRGB). */ #define V4L2_MAP_COLORSPACE_DEFAULT(is_sdtv, is_hdtv) \ ((is_sdtv) ? V4L2_COLORSPACE_SMPTE170M : \ ((is_hdtv) ? V4L2_COLORSPACE_REC709 : V4L2_COLORSPACE_SRGB)) enum v4l2_xfer_func { /* * Mapping of V4L2_XFER_FUNC_DEFAULT to actual transfer functions * for the various colorspaces: * * V4L2_COLORSPACE_SMPTE170M, V4L2_COLORSPACE_470_SYSTEM_M, * V4L2_COLORSPACE_470_SYSTEM_BG, V4L2_COLORSPACE_REC709 and * V4L2_COLORSPACE_BT2020: V4L2_XFER_FUNC_709 * * V4L2_COLORSPACE_SRGB, V4L2_COLORSPACE_JPEG: V4L2_XFER_FUNC_SRGB * * V4L2_COLORSPACE_OPRGB: V4L2_XFER_FUNC_OPRGB * * V4L2_COLORSPACE_SMPTE240M: V4L2_XFER_FUNC_SMPTE240M * * V4L2_COLORSPACE_RAW: V4L2_XFER_FUNC_NONE * * V4L2_COLORSPACE_DCI_P3: V4L2_XFER_FUNC_DCI_P3 */ V4L2_XFER_FUNC_DEFAULT = 0, V4L2_XFER_FUNC_709 = 1, V4L2_XFER_FUNC_SRGB = 2, V4L2_XFER_FUNC_OPRGB = 3, V4L2_XFER_FUNC_SMPTE240M = 4, V4L2_XFER_FUNC_NONE = 5, V4L2_XFER_FUNC_DCI_P3 = 6, V4L2_XFER_FUNC_SMPTE2084 = 7, }; /* * Determine how XFER_FUNC_DEFAULT should map to a proper transfer function. * This depends on the colorspace. */ #define V4L2_MAP_XFER_FUNC_DEFAULT(colsp) \ ((colsp) == V4L2_COLORSPACE_OPRGB ? V4L2_XFER_FUNC_OPRGB : \ ((colsp) == V4L2_COLORSPACE_SMPTE240M ? V4L2_XFER_FUNC_SMPTE240M : \ ((colsp) == V4L2_COLORSPACE_DCI_P3 ? V4L2_XFER_FUNC_DCI_P3 : \ ((colsp) == V4L2_COLORSPACE_RAW ? V4L2_XFER_FUNC_NONE : \ ((colsp) == V4L2_COLORSPACE_SRGB || (colsp) == V4L2_COLORSPACE_JPEG ? \ V4L2_XFER_FUNC_SRGB : V4L2_XFER_FUNC_709))))) enum v4l2_ycbcr_encoding { /* * Mapping of V4L2_YCBCR_ENC_DEFAULT to actual encodings for the * various colorspaces: * * V4L2_COLORSPACE_SMPTE170M, V4L2_COLORSPACE_470_SYSTEM_M, * V4L2_COLORSPACE_470_SYSTEM_BG, V4L2_COLORSPACE_SRGB, * V4L2_COLORSPACE_OPRGB and V4L2_COLORSPACE_JPEG: V4L2_YCBCR_ENC_601 * * V4L2_COLORSPACE_REC709 and V4L2_COLORSPACE_DCI_P3: V4L2_YCBCR_ENC_709 * * V4L2_COLORSPACE_BT2020: V4L2_YCBCR_ENC_BT2020 * * V4L2_COLORSPACE_SMPTE240M: V4L2_YCBCR_ENC_SMPTE240M */ V4L2_YCBCR_ENC_DEFAULT = 0, /* ITU-R 601 -- SDTV */ V4L2_YCBCR_ENC_601 = 1, /* Rec. 709 -- HDTV */ V4L2_YCBCR_ENC_709 = 2, /* ITU-R 601/EN 61966-2-4 Extended Gamut -- SDTV */ V4L2_YCBCR_ENC_XV601 = 3, /* Rec. 709/EN 61966-2-4 Extended Gamut -- HDTV */ V4L2_YCBCR_ENC_XV709 = 4, /* * sYCC (Y'CbCr encoding of sRGB), identical to ENC_601. It was added * originally due to a misunderstanding of the sYCC standard. It should * not be used, instead use V4L2_YCBCR_ENC_601. */ V4L2_YCBCR_ENC_SYCC = 5, /* BT.2020 Non-constant Luminance Y'CbCr */ V4L2_YCBCR_ENC_BT2020 = 6, /* BT.2020 Constant Luminance Y'CbcCrc */ V4L2_YCBCR_ENC_BT2020_CONST_LUM = 7, /* SMPTE 240M -- Obsolete HDTV */ V4L2_YCBCR_ENC_SMPTE240M = 8, }; /* * enum v4l2_hsv_encoding values should not collide with the ones from * enum v4l2_ycbcr_encoding. */ enum v4l2_hsv_encoding { /* Hue mapped to 0 - 179 */ V4L2_HSV_ENC_180 = 128, /* Hue mapped to 0-255 */ V4L2_HSV_ENC_256 = 129, }; /* * Determine how YCBCR_ENC_DEFAULT should map to a proper Y'CbCr encoding. * This depends on the colorspace. */ #define V4L2_MAP_YCBCR_ENC_DEFAULT(colsp) \ (((colsp) == V4L2_COLORSPACE_REC709 || \ (colsp) == V4L2_COLORSPACE_DCI_P3) ? V4L2_YCBCR_ENC_709 : \ ((colsp) == V4L2_COLORSPACE_BT2020 ? V4L2_YCBCR_ENC_BT2020 : \ ((colsp) == V4L2_COLORSPACE_SMPTE240M ? V4L2_YCBCR_ENC_SMPTE240M : \ V4L2_YCBCR_ENC_601))) enum v4l2_quantization { /* * The default for R'G'B' quantization is always full range. * For Y'CbCr the quantization is always limited range, except * for COLORSPACE_JPEG: this is full range. */ V4L2_QUANTIZATION_DEFAULT = 0, V4L2_QUANTIZATION_FULL_RANGE = 1, V4L2_QUANTIZATION_LIM_RANGE = 2, }; /* * Determine how QUANTIZATION_DEFAULT should map to a proper quantization. * This depends on whether the image is RGB or not, the colorspace. * The Y'CbCr encoding is not used anymore, but is still there for backwards * compatibility. */ #define V4L2_MAP_QUANTIZATION_DEFAULT(is_rgb_or_hsv, colsp, ycbcr_enc) \ (((is_rgb_or_hsv) || (colsp) == V4L2_COLORSPACE_JPEG) ? \ V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE) /* * Deprecated names for opRGB colorspace (IEC 61966-2-5) * * WARNING: Please don't use these deprecated defines in your code, as * there is a chance we have to remove them in the future. */ #define V4L2_COLORSPACE_ADOBERGB V4L2_COLORSPACE_OPRGB #define V4L2_XFER_FUNC_ADOBERGB V4L2_XFER_FUNC_OPRGB enum v4l2_priority { V4L2_PRIORITY_UNSET = 0, /* not initialized */ V4L2_PRIORITY_BACKGROUND = 1, V4L2_PRIORITY_INTERACTIVE = 2, V4L2_PRIORITY_RECORD = 3, V4L2_PRIORITY_DEFAULT = V4L2_PRIORITY_INTERACTIVE, }; struct v4l2_rect { __s32 left; __s32 top; __u32 width; __u32 height; }; struct v4l2_fract { __u32 numerator; __u32 denominator; }; /** * struct v4l2_capability - Describes V4L2 device caps returned by VIDIOC_QUERYCAP * * @driver: name of the driver module (e.g. "bttv") * @card: name of the card (e.g. "Hauppauge WinTV") * @bus_info: name of the bus (e.g. "PCI:" + pci_name(pci_dev) ) * @version: KERNEL_VERSION * @capabilities: capabilities of the physical device as a whole * @device_caps: capabilities accessed via this particular device (node) * @reserved: reserved fields for future extensions */ struct v4l2_capability { __u8 driver[16]; __u8 card[32]; __u8 bus_info[32]; __u32 version; __u32 capabilities; __u32 device_caps; __u32 reserved[3]; }; /* Values for 'capabilities' field */ #define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */ #define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */ #define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */ #define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */ #define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */ #define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ #define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ #define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ #define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */ #define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */ #define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */ /* Is a video capture device that supports multiplanar formats */ #define V4L2_CAP_VIDEO_CAPTURE_MPLANE 0x00001000 /* Is a video output device that supports multiplanar formats */ #define V4L2_CAP_VIDEO_OUTPUT_MPLANE 0x00002000 /* Is a video mem-to-mem device that supports multiplanar formats */ #define V4L2_CAP_VIDEO_M2M_MPLANE 0x00004000 /* Is a video mem-to-mem device */ #define V4L2_CAP_VIDEO_M2M 0x00008000 #define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ #define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ #define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ #define V4L2_CAP_MODULATOR 0x00080000 /* has a modulator */ #define V4L2_CAP_SDR_CAPTURE 0x00100000 /* Is a SDR capture device */ #define V4L2_CAP_EXT_PIX_FORMAT 0x00200000 /* Supports the extended pixel format */ #define V4L2_CAP_SDR_OUTPUT 0x00400000 /* Is a SDR output device */ #define V4L2_CAP_META_CAPTURE 0x00800000 /* Is a metadata capture device */ #define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ #define V4L2_CAP_TOUCH 0x10000000 /* Is a touch device */ #define V4L2_CAP_DEVICE_CAPS 0x80000000 /* sets device capabilities field */ /* * V I D E O I M A G E F O R M A T */ struct v4l2_pix_format { __u32 width; __u32 height; __u32 pixelformat; __u32 field; /* enum v4l2_field */ __u32 bytesperline; /* for padding, zero if unused */ __u32 sizeimage; __u32 colorspace; /* enum v4l2_colorspace */ __u32 priv; /* private data, depends on pixelformat */ __u32 flags; /* format flags (V4L2_PIX_FMT_FLAG_*) */ union { /* enum v4l2_ycbcr_encoding */ __u32 ycbcr_enc; /* enum v4l2_hsv_encoding */ __u32 hsv_enc; }; __u32 quantization; /* enum v4l2_quantization */ __u32 xfer_func; /* enum v4l2_xfer_func */ }; /* Pixel format FOURCC depth Description */ /* RGB formats */ #define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */ #define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */ #define V4L2_PIX_FMT_ARGB444 v4l2_fourcc('A', 'R', '1', '2') /* 16 aaaarrrr ggggbbbb */ #define V4L2_PIX_FMT_XRGB444 v4l2_fourcc('X', 'R', '1', '2') /* 16 xxxxrrrr ggggbbbb */ #define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */ #define V4L2_PIX_FMT_ARGB555 v4l2_fourcc('A', 'R', '1', '5') /* 16 ARGB-1-5-5-5 */ #define V4L2_PIX_FMT_XRGB555 v4l2_fourcc('X', 'R', '1', '5') /* 16 XRGB-1-5-5-5 */ #define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */ #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */ #define V4L2_PIX_FMT_ARGB555X v4l2_fourcc_be('A', 'R', '1', '5') /* 16 ARGB-5-5-5 BE */ #define V4L2_PIX_FMT_XRGB555X v4l2_fourcc_be('X', 'R', '1', '5') /* 16 XRGB-5-5-5 BE */ #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */ #define V4L2_PIX_FMT_BGR666 v4l2_fourcc('B', 'G', 'R', 'H') /* 18 BGR-6-6-6 */ #define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */ #define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */ #define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */ #define V4L2_PIX_FMT_ABGR32 v4l2_fourcc('A', 'R', '2', '4') /* 32 BGRA-8-8-8-8 */ #define V4L2_PIX_FMT_XBGR32 v4l2_fourcc('X', 'R', '2', '4') /* 32 BGRX-8-8-8-8 */ #define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */ #define V4L2_PIX_FMT_ARGB32 v4l2_fourcc('B', 'A', '2', '4') /* 32 ARGB-8-8-8-8 */ #define V4L2_PIX_FMT_XRGB32 v4l2_fourcc('B', 'X', '2', '4') /* 32 XRGB-8-8-8-8 */ /* Grey formats */ #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ #define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */ #define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */ #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ #define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ') /* 12 Greyscale */ #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ #define V4L2_PIX_FMT_Y16_BE v4l2_fourcc_be('Y', '1', '6', ' ') /* 16 Greyscale BE */ /* Grey bit-packed formats */ #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */ #define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale, MIPI RAW10 packed */ /* Palette formats */ #define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */ /* Chrominance formats */ #define V4L2_PIX_FMT_UV8 v4l2_fourcc('U', 'V', '8', ' ') /* 8 UV 4:4 */ /* Luminance+Chrominance formats */ #define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */ #define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */ #define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */ #define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */ #define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */ #define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */ #define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y', '4', '4', '4') /* 16 xxxxyyyy uuuuvvvv */ #define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */ #define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */ #define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */ #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */ #define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */ #define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0') /* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */ /* two planes -- one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ #define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */ #define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */ #define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */ #define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */ #define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */ /* two non contiguous planes - one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */ #define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1') /* 21 Y/CrCb 4:2:0 */ #define V4L2_PIX_FMT_NV16M v4l2_fourcc('N', 'M', '1', '6') /* 16 Y/CbCr 4:2:2 */ #define V4L2_PIX_FMT_NV61M v4l2_fourcc('N', 'M', '6', '1') /* 16 Y/CrCb 4:2:2 */ #define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */ #define V4L2_PIX_FMT_NV12MT_16X16 v4l2_fourcc('V', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 16x16 macroblocks */ /* three planes - Y Cb, Cr */ #define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */ #define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */ #define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 12 YVU411 planar */ #define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */ #define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */ #define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */ /* three non contiguous planes - Y, Cb, Cr */ #define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12 YUV420 planar */ #define V4L2_PIX_FMT_YVU420M v4l2_fourcc('Y', 'M', '2', '1') /* 12 YVU420 planar */ #define V4L2_PIX_FMT_YUV422M v4l2_fourcc('Y', 'M', '1', '6') /* 16 YUV422 planar */ #define V4L2_PIX_FMT_YVU422M v4l2_fourcc('Y', 'M', '6', '1') /* 16 YVU422 planar */ #define V4L2_PIX_FMT_YUV444M v4l2_fourcc('Y', 'M', '2', '4') /* 24 YUV444 planar */ #define V4L2_PIX_FMT_YVU444M v4l2_fourcc('Y', 'M', '4', '2') /* 24 YVU444 planar */ /* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */ #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ #define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ #define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */ #define V4L2_PIX_FMT_SRGGB8 v4l2_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */ #define V4L2_PIX_FMT_SBGGR10 v4l2_fourcc('B', 'G', '1', '0') /* 10 BGBG.. GRGR.. */ #define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */ #define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */ #define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */ /* 10bit raw bayer packed, 5 bytes for every 4 pixels */ #define V4L2_PIX_FMT_SBGGR10P v4l2_fourcc('p', 'B', 'A', 'A') #define V4L2_PIX_FMT_SGBRG10P v4l2_fourcc('p', 'G', 'A', 'A') #define V4L2_PIX_FMT_SGRBG10P v4l2_fourcc('p', 'g', 'A', 'A') #define V4L2_PIX_FMT_SRGGB10P v4l2_fourcc('p', 'R', 'A', 'A') /* 10bit raw bayer a-law compressed to 8 bits */ #define V4L2_PIX_FMT_SBGGR10ALAW8 v4l2_fourcc('a', 'B', 'A', '8') #define V4L2_PIX_FMT_SGBRG10ALAW8 v4l2_fourcc('a', 'G', 'A', '8') #define V4L2_PIX_FMT_SGRBG10ALAW8 v4l2_fourcc('a', 'g', 'A', '8') #define V4L2_PIX_FMT_SRGGB10ALAW8 v4l2_fourcc('a', 'R', 'A', '8') /* 10bit raw bayer DPCM compressed to 8 bits */ #define V4L2_PIX_FMT_SBGGR10DPCM8 v4l2_fourcc('b', 'B', 'A', '8') #define V4L2_PIX_FMT_SGBRG10DPCM8 v4l2_fourcc('b', 'G', 'A', '8') #define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') #define V4L2_PIX_FMT_SRGGB10DPCM8 v4l2_fourcc('b', 'R', 'A', '8') #define V4L2_PIX_FMT_SBGGR12 v4l2_fourcc('B', 'G', '1', '2') /* 12 BGBG.. GRGR.. */ #define V4L2_PIX_FMT_SGBRG12 v4l2_fourcc('G', 'B', '1', '2') /* 12 GBGB.. RGRG.. */ #define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12 GRGR.. BGBG.. */ #define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12 RGRG.. GBGB.. */ /* 12bit raw bayer packed, 6 bytes for every 4 pixels */ #define V4L2_PIX_FMT_SBGGR12P v4l2_fourcc('p', 'B', 'C', 'C') #define V4L2_PIX_FMT_SGBRG12P v4l2_fourcc('p', 'G', 'C', 'C') #define V4L2_PIX_FMT_SGRBG12P v4l2_fourcc('p', 'g', 'C', 'C') #define V4L2_PIX_FMT_SRGGB12P v4l2_fourcc('p', 'R', 'C', 'C') /* 14bit raw bayer packed, 7 bytes for every 4 pixels */ #define V4L2_PIX_FMT_SBGGR14P v4l2_fourcc('p', 'B', 'E', 'E') #define V4L2_PIX_FMT_SGBRG14P v4l2_fourcc('p', 'G', 'E', 'E') #define V4L2_PIX_FMT_SGRBG14P v4l2_fourcc('p', 'g', 'E', 'E') #define V4L2_PIX_FMT_SRGGB14P v4l2_fourcc('p', 'R', 'E', 'E') #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */ #define V4L2_PIX_FMT_SGBRG16 v4l2_fourcc('G', 'B', '1', '6') /* 16 GBGB.. RGRG.. */ #define V4L2_PIX_FMT_SGRBG16 v4l2_fourcc('G', 'R', '1', '6') /* 16 GRGR.. BGBG.. */ #define V4L2_PIX_FMT_SRGGB16 v4l2_fourcc('R', 'G', '1', '6') /* 16 RGRG.. GBGB.. */ /* HSV formats */ #define V4L2_PIX_FMT_HSV24 v4l2_fourcc('H', 'S', 'V', '3') #define V4L2_PIX_FMT_HSV32 v4l2_fourcc('H', 'S', 'V', '4') /* compressed formats */ #define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */ #define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */ #define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */ #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 Multiplexed */ #define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4') /* H264 with start codes */ #define V4L2_PIX_FMT_H264_NO_SC v4l2_fourcc('A', 'V', 'C', '1') /* H264 without start codes */ #define V4L2_PIX_FMT_H264_MVC v4l2_fourcc('M', '2', '6', '4') /* H264 MVC */ #define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263 */ #define V4L2_PIX_FMT_MPEG1 v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES */ #define V4L2_PIX_FMT_MPEG2 v4l2_fourcc('M', 'P', 'G', '2') /* MPEG-2 ES */ #define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 part 2 ES */ #define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid */ #define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */ #define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */ #define V4L2_PIX_FMT_VP8 v4l2_fourcc('V', 'P', '8', '0') /* VP8 */ #define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0') /* VP9 */ #define V4L2_PIX_FMT_HEVC v4l2_fourcc('H', 'E', 'V', 'C') /* HEVC aka H.265 */ #define V4L2_PIX_FMT_FWHT v4l2_fourcc('F', 'W', 'H', 'T') /* Fast Walsh Hadamard Transform (vicodec) */ /* Vendor-specific formats */ #define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */ #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */ #define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */ #define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */ #define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P', 'W', 'C', '1') /* pwc older webcam */ #define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P', 'W', 'C', '2') /* pwc newer webcam */ #define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5') /* ET61X251 compression */ #define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1') /* YUYV per line */ #define V4L2_PIX_FMT_SPCA505 v4l2_fourcc('S', '5', '0', '5') /* YYUV per line */ #define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */ #define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */ #define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */ #define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */ #define V4L2_PIX_FMT_JL2005BCD v4l2_fourcc('J', 'L', '2', '0') /* compressed RGGB bayer */ #define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */ #define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */ #define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ #define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */ #define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ #define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */ #define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */ #define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */ #define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */ #define V4L2_PIX_FMT_JPGL v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */ #define V4L2_PIX_FMT_SE401 v4l2_fourcc('S', '4', '0', '1') /* se401 janggu compressed rgb */ #define V4L2_PIX_FMT_S5C_UYVY_JPG v4l2_fourcc('S', '5', 'C', 'I') /* S5C73M3 interleaved UYVY/JPEG */ #define V4L2_PIX_FMT_Y8I v4l2_fourcc('Y', '8', 'I', ' ') /* Greyscale 8-bit L/R interleaved */ #define V4L2_PIX_FMT_Y12I v4l2_fourcc('Y', '1', '2', 'I') /* Greyscale 12-bit L/R interleaved */ #define V4L2_PIX_FMT_Z16 v4l2_fourcc('Z', '1', '6', ' ') /* Depth data 16-bit */ #define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1') /* Mediatek compressed block mode */ #define V4L2_PIX_FMT_INZI v4l2_fourcc('I', 'N', 'Z', 'I') /* Intel Planar Greyscale 10-bit and Depth 16-bit */ /* 10bit raw bayer packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */ #define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b') /* IPU3 packed 10-bit BGGR bayer */ #define V4L2_PIX_FMT_IPU3_SGBRG10 v4l2_fourcc('i', 'p', '3', 'g') /* IPU3 packed 10-bit GBRG bayer */ #define V4L2_PIX_FMT_IPU3_SGRBG10 v4l2_fourcc('i', 'p', '3', 'G') /* IPU3 packed 10-bit GRBG bayer */ #define V4L2_PIX_FMT_IPU3_SRGGB10 v4l2_fourcc('i', 'p', '3', 'r') /* IPU3 packed 10-bit RGGB bayer */ /* SDR formats - used only for Software Defined Radio devices */ #define V4L2_SDR_FMT_CU8 v4l2_fourcc('C', 'U', '0', '8') /* IQ u8 */ #define V4L2_SDR_FMT_CU16LE v4l2_fourcc('C', 'U', '1', '6') /* IQ u16le */ #define V4L2_SDR_FMT_CS8 v4l2_fourcc('C', 'S', '0', '8') /* complex s8 */ #define V4L2_SDR_FMT_CS14LE v4l2_fourcc('C', 'S', '1', '4') /* complex s14le */ #define V4L2_SDR_FMT_RU12LE v4l2_fourcc('R', 'U', '1', '2') /* real u12le */ #define V4L2_SDR_FMT_PCU16BE v4l2_fourcc('P', 'C', '1', '6') /* planar complex u16be */ #define V4L2_SDR_FMT_PCU18BE v4l2_fourcc('P', 'C', '1', '8') /* planar complex u18be */ #define V4L2_SDR_FMT_PCU20BE v4l2_fourcc('P', 'C', '2', '0') /* planar complex u20be */ /* Touch formats - used for Touch devices */ #define V4L2_TCH_FMT_DELTA_TD16 v4l2_fourcc('T', 'D', '1', '6') /* 16-bit signed deltas */ #define V4L2_TCH_FMT_DELTA_TD08 v4l2_fourcc('T', 'D', '0', '8') /* 8-bit signed deltas */ #define V4L2_TCH_FMT_TU16 v4l2_fourcc('T', 'U', '1', '6') /* 16-bit unsigned touch data */ #define V4L2_TCH_FMT_TU08 v4l2_fourcc('T', 'U', '0', '8') /* 8-bit unsigned touch data */ /* Meta-data formats */ #define V4L2_META_FMT_VSP1_HGO v4l2_fourcc('V', 'S', 'P', 'H') /* R-Car VSP1 1-D Histogram */ #define V4L2_META_FMT_VSP1_HGT v4l2_fourcc('V', 'S', 'P', 'T') /* R-Car VSP1 2-D Histogram */ #define V4L2_META_FMT_UVC v4l2_fourcc('U', 'V', 'C', 'H') /* UVC Payload Header metadata */ /* priv field value to indicates that subsequent fields are valid. */ #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe /* Flags */ #define V4L2_PIX_FMT_FLAG_PREMUL_ALPHA 0x00000001 /* * F O R M A T E N U M E R A T I O N */ struct v4l2_fmtdesc { __u32 index; /* Format number */ __u32 type; /* enum v4l2_buf_type */ __u32 flags; __u8 description[32]; /* Description string */ __u32 pixelformat; /* Format fourcc */ __u32 reserved[4]; }; #define V4L2_FMT_FLAG_COMPRESSED 0x0001 #define V4L2_FMT_FLAG_EMULATED 0x0002 /* Frame Size and frame rate enumeration */ /* * F R A M E S I Z E E N U M E R A T I O N */ enum v4l2_frmsizetypes { V4L2_FRMSIZE_TYPE_DISCRETE = 1, V4L2_FRMSIZE_TYPE_CONTINUOUS = 2, V4L2_FRMSIZE_TYPE_STEPWISE = 3, }; struct v4l2_frmsize_discrete { __u32 width; /* Frame width [pixel] */ __u32 height; /* Frame height [pixel] */ }; struct v4l2_frmsize_stepwise { __u32 min_width; /* Minimum frame width [pixel] */ __u32 max_width; /* Maximum frame width [pixel] */ __u32 step_width; /* Frame width step size [pixel] */ __u32 min_height; /* Minimum frame height [pixel] */ __u32 max_height; /* Maximum frame height [pixel] */ __u32 step_height; /* Frame height step size [pixel] */ }; struct v4l2_frmsizeenum { __u32 index; /* Frame size number */ __u32 pixel_format; /* Pixel format */ __u32 type; /* Frame size type the device supports. */ union { /* Frame size */ struct v4l2_frmsize_discrete discrete; struct v4l2_frmsize_stepwise stepwise; }; __u32 reserved[2]; /* Reserved space for future use */ }; /* * F R A M E R A T E E N U M E R A T I O N */ enum v4l2_frmivaltypes { V4L2_FRMIVAL_TYPE_DISCRETE = 1, V4L2_FRMIVAL_TYPE_CONTINUOUS = 2, V4L2_FRMIVAL_TYPE_STEPWISE = 3, }; struct v4l2_frmival_stepwise { struct v4l2_fract min; /* Minimum frame interval [s] */ struct v4l2_fract max; /* Maximum frame interval [s] */ struct v4l2_fract step; /* Frame interval step size [s] */ }; struct v4l2_frmivalenum { __u32 index; /* Frame format index */ __u32 pixel_format; /* Pixel format */ __u32 width; /* Frame width */ __u32 height; /* Frame height */ __u32 type; /* Frame interval type the device supports. */ union { /* Frame interval */ struct v4l2_fract discrete; struct v4l2_frmival_stepwise stepwise; }; __u32 reserved[2]; /* Reserved space for future use */ }; /* * T I M E C O D E */ struct v4l2_timecode { __u32 type; __u32 flags; __u8 frames; __u8 seconds; __u8 minutes; __u8 hours; __u8 userbits[4]; }; /* Type */ #define V4L2_TC_TYPE_24FPS 1 #define V4L2_TC_TYPE_25FPS 2 #define V4L2_TC_TYPE_30FPS 3 #define V4L2_TC_TYPE_50FPS 4 #define V4L2_TC_TYPE_60FPS 5 /* Flags */ #define V4L2_TC_FLAG_DROPFRAME 0x0001 /* "drop-frame" mode */ #define V4L2_TC_FLAG_COLORFRAME 0x0002 #define V4L2_TC_USERBITS_field 0x000C #define V4L2_TC_USERBITS_USERDEFINED 0x0000 #define V4L2_TC_USERBITS_8BITCHARS 0x0008 /* The above is based on SMPTE timecodes */ struct v4l2_jpegcompression { int quality; int APPn; /* Number of APP segment to be written, * must be 0..15 */ int APP_len; /* Length of data in JPEG APPn segment */ char APP_data[60]; /* Data in the JPEG APPn segment. */ int COM_len; /* Length of data in JPEG COM segment */ char COM_data[60]; /* Data in JPEG COM segment */ __u32 jpeg_markers; /* Which markers should go into the JPEG * output. Unless you exactly know what * you do, leave them untouched. * Including less markers will make the * resulting code smaller, but there will * be fewer applications which can read it. * The presence of the APP and COM marker * is influenced by APP_len and COM_len * ONLY, not by this property! */ #define V4L2_JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */ #define V4L2_JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */ #define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ #define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */ #define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will * always use APP0 */ }; /* * M E M O R Y - M A P P I N G B U F F E R S */ struct v4l2_requestbuffers { __u32 count; __u32 type; /* enum v4l2_buf_type */ __u32 memory; /* enum v4l2_memory */ __u32 reserved[2]; }; /** * struct v4l2_plane - plane info for multi-planar buffers * @bytesused: number of bytes occupied by data in the plane (payload) * @length: size of this plane (NOT the payload) in bytes * @mem_offset: when memory in the associated struct v4l2_buffer is * V4L2_MEMORY_MMAP, equals the offset from the start of * the device memory for this plane (or is a "cookie" that * should be passed to mmap() called on the video node) * @userptr: when memory is V4L2_MEMORY_USERPTR, a userspace pointer * pointing to this plane * @fd: when memory is V4L2_MEMORY_DMABUF, a userspace file * descriptor associated with this plane * @data_offset: offset in the plane to the start of data; usually 0, * unless there is a header in front of the data * * Multi-planar buffers consist of one or more planes, e.g. an YCbCr buffer * with two planes can have one plane for Y, and another for interleaved CbCr * components. Each plane can reside in a separate memory buffer, or even in * a completely separate memory node (e.g. in embedded devices). */ struct v4l2_plane { __u32 bytesused; __u32 length; union { __u32 mem_offset; unsigned long userptr; __s32 fd; } m; __u32 data_offset; __u32 reserved[11]; }; /** * struct v4l2_buffer - video buffer info * @index: id number of the buffer * @type: enum v4l2_buf_type; buffer type (type == *_MPLANE for * multiplanar buffers); * @bytesused: number of bytes occupied by data in the buffer (payload); * unused (set to 0) for multiplanar buffers * @flags: buffer informational flags * @field: enum v4l2_field; field order of the image in the buffer * @timestamp: frame timestamp * @timecode: frame timecode * @sequence: sequence count of this frame * @memory: enum v4l2_memory; the method, in which the actual video data is * passed * @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP; * offset from the start of the device memory for this plane, * (or a "cookie" that should be passed to mmap() as offset) * @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR; * a userspace pointer pointing to this buffer * @fd: for non-multiplanar buffers with memory == V4L2_MEMORY_DMABUF; * a userspace file descriptor associated with this buffer * @planes: for multiplanar buffers; userspace pointer to the array of plane * info structs for this buffer * @length: size in bytes of the buffer (NOT its payload) for single-plane * buffers (when type != *_MPLANE); number of elements in the * planes array for multi-plane buffers * * Contains data exchanged by application and driver using one of the Streaming * I/O methods. */ struct v4l2_buffer { __u32 index; __u32 type; __u32 bytesused; __u32 flags; __u32 field; struct timeval timestamp; struct v4l2_timecode timecode; __u32 sequence; /* memory location */ __u32 memory; union { __u32 offset; unsigned long userptr; struct v4l2_plane *planes; __s32 fd; } m; __u32 length; __u32 reserved2; __u32 reserved; }; /* Flags for 'flags' field */ /* Buffer is mapped (flag) */ #define V4L2_BUF_FLAG_MAPPED 0x00000001 /* Buffer is queued for processing */ #define V4L2_BUF_FLAG_QUEUED 0x00000002 /* Buffer is ready */ #define V4L2_BUF_FLAG_DONE 0x00000004 /* Image is a keyframe (I-frame) */ #define V4L2_BUF_FLAG_KEYFRAME 0x00000008 /* Image is a P-frame */ #define V4L2_BUF_FLAG_PFRAME 0x00000010 /* Image is a B-frame */ #define V4L2_BUF_FLAG_BFRAME 0x00000020 /* Buffer is ready, but the data contained within is corrupted. */ #define V4L2_BUF_FLAG_ERROR 0x00000040 /* timecode field is valid */ #define V4L2_BUF_FLAG_TIMECODE 0x00000100 /* Buffer is prepared for queuing */ #define V4L2_BUF_FLAG_PREPARED 0x00000400 /* Cache handling flags */ #define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x00000800 #define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x00001000 /* Timestamp type */ #define V4L2_BUF_FLAG_TIMESTAMP_MASK 0x0000e000 #define V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN 0x00000000 #define V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC 0x00002000 #define V4L2_BUF_FLAG_TIMESTAMP_COPY 0x00004000 /* Timestamp sources. */ #define V4L2_BUF_FLAG_TSTAMP_SRC_MASK 0x00070000 #define V4L2_BUF_FLAG_TSTAMP_SRC_EOF 0x00000000 #define V4L2_BUF_FLAG_TSTAMP_SRC_SOE 0x00010000 /* mem2mem encoder/decoder */ #define V4L2_BUF_FLAG_LAST 0x00100000 /** * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor * * @index: id number of the buffer * @type: enum v4l2_buf_type; buffer type (type == *_MPLANE for * multiplanar buffers); * @plane: index of the plane to be exported, 0 for single plane queues * @flags: flags for newly created file, currently only O_CLOEXEC is * supported, refer to manual of open syscall for more details * @fd: file descriptor associated with DMABUF (set by driver) * * Contains data used for exporting a video buffer as DMABUF file descriptor. * The buffer is identified by a 'cookie' returned by VIDIOC_QUERYBUF * (identical to the cookie used to mmap() the buffer to userspace). All * reserved fields must be set to zero. The field reserved0 is expected to * become a structure 'type' allowing an alternative layout of the structure * content. Therefore this field should not be used for any other extensions. */ struct v4l2_exportbuffer { __u32 type; /* enum v4l2_buf_type */ __u32 index; __u32 plane; __u32 flags; __s32 fd; __u32 reserved[11]; }; /* * O V E R L A Y P R E V I E W */ struct v4l2_framebuffer { __u32 capability; __u32 flags; /* FIXME: in theory we should pass something like PCI device + memory * region + offset instead of some physical address */ void *base; struct { __u32 width; __u32 height; __u32 pixelformat; __u32 field; /* enum v4l2_field */ __u32 bytesperline; /* for padding, zero if unused */ __u32 sizeimage; __u32 colorspace; /* enum v4l2_colorspace */ __u32 priv; /* reserved field, set to 0 */ } fmt; }; /* Flags for the 'capability' field. Read only */ #define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001 #define V4L2_FBUF_CAP_CHROMAKEY 0x0002 #define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004 #define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 #define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 #define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 #define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040 #define V4L2_FBUF_CAP_SRC_CHROMAKEY 0x0080 /* Flags for the 'flags' field. */ #define V4L2_FBUF_FLAG_PRIMARY 0x0001 #define V4L2_FBUF_FLAG_OVERLAY 0x0002 #define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 #define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 #define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 #define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 #define V4L2_FBUF_FLAG_SRC_CHROMAKEY 0x0040 struct v4l2_clip { struct v4l2_rect c; struct v4l2_clip *next; }; struct v4l2_window { struct v4l2_rect w; __u32 field; /* enum v4l2_field */ __u32 chromakey; struct v4l2_clip *clips; __u32 clipcount; void *bitmap; __u8 global_alpha; }; /* * C A P T U R E P A R A M E T E R S */ struct v4l2_captureparm { __u32 capability; /* Supported modes */ __u32 capturemode; /* Current mode */ struct v4l2_fract timeperframe; /* Time per frame in seconds */ __u32 extendedmode; /* Driver-specific extensions */ __u32 readbuffers; /* # of buffers for read */ __u32 reserved[4]; }; /* Flags for 'capability' and 'capturemode' fields */ #define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */ #define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */ struct v4l2_outputparm { __u32 capability; /* Supported modes */ __u32 outputmode; /* Current mode */ struct v4l2_fract timeperframe; /* Time per frame in seconds */ __u32 extendedmode; /* Driver-specific extensions */ __u32 writebuffers; /* # of buffers for write */ __u32 reserved[4]; }; /* * I N P U T I M A G E C R O P P I N G */ struct v4l2_cropcap { __u32 type; /* enum v4l2_buf_type */ struct v4l2_rect bounds; struct v4l2_rect defrect; struct v4l2_fract pixelaspect; }; struct v4l2_crop { __u32 type; /* enum v4l2_buf_type */ struct v4l2_rect c; }; /** * struct v4l2_selection - selection info * @type: buffer type (do not use *_MPLANE types) * @target: Selection target, used to choose one of possible rectangles; * defined in v4l2-common.h; V4L2_SEL_TGT_* . * @flags: constraints flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*. * @r: coordinates of selection window * @reserved: for future use, rounds structure size to 64 bytes, set to zero * * Hardware may use multiple helper windows to process a video stream. * The structure is used to exchange this selection areas between * an application and a driver. */ struct v4l2_selection { __u32 type; __u32 target; __u32 flags; struct v4l2_rect r; __u32 reserved[9]; }; /* * A N A L O G V I D E O S T A N D A R D */ typedef __u64 v4l2_std_id; /* one bit for each */ #define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001) #define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002) #define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004) #define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008) #define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010) #define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020) #define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040) #define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080) #define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100) #define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200) #define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400) #define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800) #define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) /* BTSC */ #define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) /* EIA-J */ #define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) #define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) /* FM A2 */ #define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) #define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) #define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000) #define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000) #define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000) #define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000) #define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000) #define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000) /* ATSC/HDTV */ #define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) #define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) /* FIXME: Although std_id is 64 bits, there is an issue on PPC32 architecture that makes switch(__u64) to break. So, there's a hack on v4l2-common.c rounding this value to 32 bits. As, currently, the max value is for V4L2_STD_ATSC_16_VSB (30 bits wide), it should work fine. However, if needed to add more than two standards, v4l2-common.c should be fixed. */ /* * Some macros to merge video standards in order to make live easier for the * drivers and V4L2 applications */ /* * "Common" NTSC/M - It should be noticed that V4L2_STD_NTSC_443 is * Missing here. */ #define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\ V4L2_STD_NTSC_M_JP |\ V4L2_STD_NTSC_M_KR) /* Secam macros */ #define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\ V4L2_STD_SECAM_K |\ V4L2_STD_SECAM_K1) /* All Secam Standards */ #define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\ V4L2_STD_SECAM_G |\ V4L2_STD_SECAM_H |\ V4L2_STD_SECAM_DK |\ V4L2_STD_SECAM_L |\ V4L2_STD_SECAM_LC) /* PAL macros */ #define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\ V4L2_STD_PAL_B1 |\ V4L2_STD_PAL_G) #define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\ V4L2_STD_PAL_D1 |\ V4L2_STD_PAL_K) /* * "Common" PAL - This macro is there to be compatible with the old * V4L1 concept of "PAL": /BGDKHI. * Several PAL standards are missing here: /M, /N and /Nc */ #define V4L2_STD_PAL (V4L2_STD_PAL_BG |\ V4L2_STD_PAL_DK |\ V4L2_STD_PAL_H |\ V4L2_STD_PAL_I) /* Chroma "agnostic" standards */ #define V4L2_STD_B (V4L2_STD_PAL_B |\ V4L2_STD_PAL_B1 |\ V4L2_STD_SECAM_B) #define V4L2_STD_G (V4L2_STD_PAL_G |\ V4L2_STD_SECAM_G) #define V4L2_STD_H (V4L2_STD_PAL_H |\ V4L2_STD_SECAM_H) #define V4L2_STD_L (V4L2_STD_SECAM_L |\ V4L2_STD_SECAM_LC) #define V4L2_STD_GH (V4L2_STD_G |\ V4L2_STD_H) #define V4L2_STD_DK (V4L2_STD_PAL_DK |\ V4L2_STD_SECAM_DK) #define V4L2_STD_BG (V4L2_STD_B |\ V4L2_STD_G) #define V4L2_STD_MN (V4L2_STD_PAL_M |\ V4L2_STD_PAL_N |\ V4L2_STD_PAL_Nc |\ V4L2_STD_NTSC) /* Standards where MTS/BTSC stereo could be found */ #define V4L2_STD_MTS (V4L2_STD_NTSC_M |\ V4L2_STD_PAL_M |\ V4L2_STD_PAL_N |\ V4L2_STD_PAL_Nc) /* Standards for Countries with 60Hz Line frequency */ #define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ V4L2_STD_PAL_60 |\ V4L2_STD_NTSC |\ V4L2_STD_NTSC_443) /* Standards for Countries with 50Hz Line frequency */ #define V4L2_STD_625_50 (V4L2_STD_PAL |\ V4L2_STD_PAL_N |\ V4L2_STD_PAL_Nc |\ V4L2_STD_SECAM) #define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\ V4L2_STD_ATSC_16_VSB) /* Macros with none and all analog standards */ #define V4L2_STD_UNKNOWN 0 #define V4L2_STD_ALL (V4L2_STD_525_60 |\ V4L2_STD_625_50) struct v4l2_standard { __u32 index; v4l2_std_id id; __u8 name[24]; struct v4l2_fract frameperiod; /* Frames, not fields */ __u32 framelines; __u32 reserved[4]; }; /* * D V B T T I M I N G S */ /** struct v4l2_bt_timings - BT.656/BT.1120 timing data * @width: total width of the active video in pixels * @height: total height of the active video in lines * @interlaced: Interlaced or progressive * @polarities: Positive or negative polarities * @pixelclock: Pixel clock in HZ. Ex. 74.25MHz->74250000 * @hfrontporch:Horizontal front porch in pixels * @hsync: Horizontal Sync length in pixels * @hbackporch: Horizontal back porch in pixels * @vfrontporch:Vertical front porch in lines * @vsync: Vertical Sync length in lines * @vbackporch: Vertical back porch in lines * @il_vfrontporch:Vertical front porch for the even field * (aka field 2) of interlaced field formats * @il_vsync: Vertical Sync length for the even field * (aka field 2) of interlaced field formats * @il_vbackporch:Vertical back porch for the even field * (aka field 2) of interlaced field formats * @standards: Standards the timing belongs to * @flags: Flags * @picture_aspect: The picture aspect ratio (hor/vert). * @cea861_vic: VIC code as per the CEA-861 standard. * @hdmi_vic: VIC code as per the HDMI standard. * @reserved: Reserved fields, must be zeroed. * * A note regarding vertical interlaced timings: height refers to the total * height of the active video frame (= two fields). The blanking timings refer * to the blanking of each field. So the height of the total frame is * calculated as follows: * * tot_height = height + vfrontporch + vsync + vbackporch + * il_vfrontporch + il_vsync + il_vbackporch * * The active height of each field is height / 2. */ struct v4l2_bt_timings { __u32 width; __u32 height; __u32 interlaced; __u32 polarities; __u64 pixelclock; __u32 hfrontporch; __u32 hsync; __u32 hbackporch; __u32 vfrontporch; __u32 vsync; __u32 vbackporch; __u32 il_vfrontporch; __u32 il_vsync; __u32 il_vbackporch; __u32 standards; __u32 flags; struct v4l2_fract picture_aspect; __u8 cea861_vic; __u8 hdmi_vic; __u8 reserved[46]; } __attribute__ ((packed)); /* Interlaced or progressive format */ #define V4L2_DV_PROGRESSIVE 0 #define V4L2_DV_INTERLACED 1 /* Polarities. If bit is not set, it is assumed to be negative polarity */ #define V4L2_DV_VSYNC_POS_POL 0x00000001 #define V4L2_DV_HSYNC_POS_POL 0x00000002 /* Timings standards */ #define V4L2_DV_BT_STD_CEA861 (1 << 0) /* CEA-861 Digital TV Profile */ #define V4L2_DV_BT_STD_DMT (1 << 1) /* VESA Discrete Monitor Timings */ #define V4L2_DV_BT_STD_CVT (1 << 2) /* VESA Coordinated Video Timings */ #define V4L2_DV_BT_STD_GTF (1 << 3) /* VESA Generalized Timings Formula */ #define V4L2_DV_BT_STD_SDI (1 << 4) /* SDI Timings */ /* Flags */ /* * CVT/GTF specific: timing uses reduced blanking (CVT) or the 'Secondary * GTF' curve (GTF). In both cases the horizontal and/or vertical blanking * intervals are reduced, allowing a higher resolution over the same * bandwidth. This is a read-only flag. */ #define V4L2_DV_FL_REDUCED_BLANKING (1 << 0) /* * CEA-861 specific: set for CEA-861 formats with a framerate of a multiple * of six. These formats can be optionally played at 1 / 1.001 speed. * This is a read-only flag. */ #define V4L2_DV_FL_CAN_REDUCE_FPS (1 << 1) /* * CEA-861 specific: only valid for video transmitters, the flag is cleared * by receivers. * If the framerate of the format is a multiple of six, then the pixelclock * used to set up the transmitter is divided by 1.001 to make it compatible * with 60 Hz based standards such as NTSC and PAL-M that use a framerate of * 29.97 Hz. Otherwise this flag is cleared. If the transmitter can't generate * such frequencies, then the flag will also be cleared. */ #define V4L2_DV_FL_REDUCED_FPS (1 << 2) /* * Specific to interlaced formats: if set, then field 1 is really one half-line * longer and field 2 is really one half-line shorter, so each field has * exactly the same number of half-lines. Whether half-lines can be detected * or used depends on the hardware. */ #define V4L2_DV_FL_HALF_LINE (1 << 3) /* * If set, then this is a Consumer Electronics (CE) video format. Such formats * differ from other formats (commonly called IT formats) in that if RGB * encoding is used then by default the RGB values use limited range (i.e. * use the range 16-235) as opposed to 0-255. All formats defined in CEA-861 * except for the 640x480 format are CE formats. */ #define V4L2_DV_FL_IS_CE_VIDEO (1 << 4) /* Some formats like SMPTE-125M have an interlaced signal with a odd * total height. For these formats, if this flag is set, the first * field has the extra line. If not, it is the second field. */ #define V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE (1 << 5) /* * If set, then the picture_aspect field is valid. Otherwise assume that the * pixels are square, so the picture aspect ratio is the same as the width to * height ratio. */ #define V4L2_DV_FL_HAS_PICTURE_ASPECT (1 << 6) /* * If set, then the cea861_vic field is valid and contains the Video * Identification Code as per the CEA-861 standard. */ #define V4L2_DV_FL_HAS_CEA861_VIC (1 << 7) /* * If set, then the hdmi_vic field is valid and contains the Video * Identification Code as per the HDMI standard (HDMI Vendor Specific * InfoFrame). */ #define V4L2_DV_FL_HAS_HDMI_VIC (1 << 8) /* A few useful defines to calculate the total blanking and frame sizes */ #define V4L2_DV_BT_BLANKING_WIDTH(bt) \ ((bt)->hfrontporch + (bt)->hsync + (bt)->hbackporch) #define V4L2_DV_BT_FRAME_WIDTH(bt) \ ((bt)->width + V4L2_DV_BT_BLANKING_WIDTH(bt)) #define V4L2_DV_BT_BLANKING_HEIGHT(bt) \ ((bt)->vfrontporch + (bt)->vsync + (bt)->vbackporch + \ ((bt)->interlaced ? \ ((bt)->il_vfrontporch + (bt)->il_vsync + (bt)->il_vbackporch) : 0)) #define V4L2_DV_BT_FRAME_HEIGHT(bt) \ ((bt)->height + V4L2_DV_BT_BLANKING_HEIGHT(bt)) /** struct v4l2_dv_timings - DV timings * @type: the type of the timings * @bt: BT656/1120 timings */ struct v4l2_dv_timings { __u32 type; union { struct v4l2_bt_timings bt; __u32 reserved[32]; }; } __attribute__ ((packed)); /* Values for the type field */ #define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */ /** struct v4l2_enum_dv_timings - DV timings enumeration * @index: enumeration index * @pad: the pad number for which to enumerate timings (used with * v4l-subdev nodes only) * @reserved: must be zeroed * @timings: the timings for the given index */ struct v4l2_enum_dv_timings { __u32 index; __u32 pad; __u32 reserved[2]; struct v4l2_dv_timings timings; }; /** struct v4l2_bt_timings_cap - BT.656/BT.1120 timing capabilities * @min_width: width in pixels * @max_width: width in pixels * @min_height: height in lines * @max_height: height in lines * @min_pixelclock: Pixel clock in HZ. Ex. 74.25MHz->74250000 * @max_pixelclock: Pixel clock in HZ. Ex. 74.25MHz->74250000 * @standards: Supported standards * @capabilities: Supported capabilities * @reserved: Must be zeroed */ struct v4l2_bt_timings_cap { __u32 min_width; __u32 max_width; __u32 min_height; __u32 max_height; __u64 min_pixelclock; __u64 max_pixelclock; __u32 standards; __u32 capabilities; __u32 reserved[16]; } __attribute__ ((packed)); /* Supports interlaced formats */ #define V4L2_DV_BT_CAP_INTERLACED (1 << 0) /* Supports progressive formats */ #define V4L2_DV_BT_CAP_PROGRESSIVE (1 << 1) /* Supports CVT/GTF reduced blanking */ #define V4L2_DV_BT_CAP_REDUCED_BLANKING (1 << 2) /* Supports custom formats */ #define V4L2_DV_BT_CAP_CUSTOM (1 << 3) /** struct v4l2_dv_timings_cap - DV timings capabilities * @type: the type of the timings (same as in struct v4l2_dv_timings) * @pad: the pad number for which to query capabilities (used with * v4l-subdev nodes only) * @bt: the BT656/1120 timings capabilities */ struct v4l2_dv_timings_cap { __u32 type; __u32 pad; __u32 reserved[2]; union { struct v4l2_bt_timings_cap bt; __u32 raw_data[32]; }; }; /* * V I D E O I N P U T S */ struct v4l2_input { __u32 index; /* Which input */ __u8 name[32]; /* Label */ __u32 type; /* Type of input */ __u32 audioset; /* Associated audios (bitfield) */ __u32 tuner; /* enum v4l2_tuner_type */ v4l2_std_id std; __u32 status; __u32 capabilities; __u32 reserved[3]; }; /* Values for the 'type' field */ #define V4L2_INPUT_TYPE_TUNER 1 #define V4L2_INPUT_TYPE_CAMERA 2 #define V4L2_INPUT_TYPE_TOUCH 3 /* field 'status' - general */ #define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */ #define V4L2_IN_ST_NO_SIGNAL 0x00000002 #define V4L2_IN_ST_NO_COLOR 0x00000004 /* field 'status' - sensor orientation */ /* If sensor is mounted upside down set both bits */ #define V4L2_IN_ST_HFLIP 0x00000010 /* Frames are flipped horizontally */ #define V4L2_IN_ST_VFLIP 0x00000020 /* Frames are flipped vertically */ /* field 'status' - analog */ #define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */ #define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */ #define V4L2_IN_ST_NO_V_LOCK 0x00000400 /* No vertical sync lock */ #define V4L2_IN_ST_NO_STD_LOCK 0x00000800 /* No standard format lock */ /* field 'status' - digital */ #define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */ #define V4L2_IN_ST_NO_EQU 0x00020000 /* No equalizer lock */ #define V4L2_IN_ST_NO_CARRIER 0x00040000 /* Carrier recovery failed */ /* field 'status' - VCR and set-top box */ #define V4L2_IN_ST_MACROVISION 0x01000000 /* Macrovision detected */ #define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */ #define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */ /* capabilities flags */ #define V4L2_IN_CAP_DV_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ #define V4L2_IN_CAP_CUSTOM_TIMINGS V4L2_IN_CAP_DV_TIMINGS /* For compatibility */ #define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */ #define V4L2_IN_CAP_NATIVE_SIZE 0x00000008 /* Supports setting native size */ /* * V I D E O O U T P U T S */ struct v4l2_output { __u32 index; /* Which output */ __u8 name[32]; /* Label */ __u32 type; /* Type of output */ __u32 audioset; /* Associated audios (bitfield) */ __u32 modulator; /* Associated modulator */ v4l2_std_id std; __u32 capabilities; __u32 reserved[3]; }; /* Values for the 'type' field */ #define V4L2_OUTPUT_TYPE_MODULATOR 1 #define V4L2_OUTPUT_TYPE_ANALOG 2 #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 /* capabilities flags */ #define V4L2_OUT_CAP_DV_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ #define V4L2_OUT_CAP_CUSTOM_TIMINGS V4L2_OUT_CAP_DV_TIMINGS /* For compatibility */ #define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */ #define V4L2_OUT_CAP_NATIVE_SIZE 0x00000008 /* Supports setting native size */ /* * C O N T R O L S */ struct v4l2_control { __u32 id; __s32 value; }; struct v4l2_ext_control { __u32 id; __u32 size; __u32 reserved2[1]; union { __s32 value; __s64 value64; char *string; __u8 *p_u8; __u16 *p_u16; __u32 *p_u32; void *ptr; }; } __attribute__ ((packed)); struct v4l2_ext_controls { union { __u32 ctrl_class; __u32 which; }; __u32 count; __u32 error_idx; __u32 reserved[2]; struct v4l2_ext_control *controls; }; #define V4L2_CTRL_ID_MASK (0x0fffffff) #define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) #define V4L2_CTRL_ID2WHICH(id) ((id) & 0x0fff0000UL) #define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) #define V4L2_CTRL_MAX_DIMS (4) #define V4L2_CTRL_WHICH_CUR_VAL 0 #define V4L2_CTRL_WHICH_DEF_VAL 0x0f000000 enum v4l2_ctrl_type { V4L2_CTRL_TYPE_INTEGER = 1, V4L2_CTRL_TYPE_BOOLEAN = 2, V4L2_CTRL_TYPE_MENU = 3, V4L2_CTRL_TYPE_BUTTON = 4, V4L2_CTRL_TYPE_INTEGER64 = 5, V4L2_CTRL_TYPE_CTRL_CLASS = 6, V4L2_CTRL_TYPE_STRING = 7, V4L2_CTRL_TYPE_BITMASK = 8, V4L2_CTRL_TYPE_INTEGER_MENU = 9, /* Compound types are >= 0x0100 */ V4L2_CTRL_COMPOUND_TYPES = 0x0100, V4L2_CTRL_TYPE_U8 = 0x0100, V4L2_CTRL_TYPE_U16 = 0x0101, V4L2_CTRL_TYPE_U32 = 0x0102, }; /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ struct v4l2_queryctrl { __u32 id; __u32 type; /* enum v4l2_ctrl_type */ __u8 name[32]; /* Whatever */ __s32 minimum; /* Note signedness */ __s32 maximum; __s32 step; __s32 default_value; __u32 flags; __u32 reserved[2]; }; /* Used in the VIDIOC_QUERY_EXT_CTRL ioctl for querying extended controls */ struct v4l2_query_ext_ctrl { __u32 id; __u32 type; char name[32]; __s64 minimum; __s64 maximum; __u64 step; __s64 default_value; __u32 flags; __u32 elem_size; __u32 elems; __u32 nr_of_dims; __u32 dims[V4L2_CTRL_MAX_DIMS]; __u32 reserved[32]; }; /* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */ struct v4l2_querymenu { __u32 id; __u32 index; union { __u8 name[32]; /* Whatever */ __s64 value; }; __u32 reserved; } __attribute__ ((packed)); /* Control flags */ #define V4L2_CTRL_FLAG_DISABLED 0x0001 #define V4L2_CTRL_FLAG_GRABBED 0x0002 #define V4L2_CTRL_FLAG_READ_ONLY 0x0004 #define V4L2_CTRL_FLAG_UPDATE 0x0008 #define V4L2_CTRL_FLAG_INACTIVE 0x0010 #define V4L2_CTRL_FLAG_SLIDER 0x0020 #define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040 #define V4L2_CTRL_FLAG_VOLATILE 0x0080 #define V4L2_CTRL_FLAG_HAS_PAYLOAD 0x0100 #define V4L2_CTRL_FLAG_EXECUTE_ON_WRITE 0x0200 #define V4L2_CTRL_FLAG_MODIFY_LAYOUT 0x0400 /* Query flags, to be ORed with the control ID */ #define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 #define V4L2_CTRL_FLAG_NEXT_COMPOUND 0x40000000 /* User-class control IDs defined by V4L2 */ #define V4L2_CID_MAX_CTRLS 1024 /* IDs reserved for driver specific controls */ #define V4L2_CID_PRIVATE_BASE 0x08000000 /* * T U N I N G */ struct v4l2_tuner { __u32 index; __u8 name[32]; __u32 type; /* enum v4l2_tuner_type */ __u32 capability; __u32 rangelow; __u32 rangehigh; __u32 rxsubchans; __u32 audmode; __s32 signal; __s32 afc; __u32 reserved[4]; }; struct v4l2_modulator { __u32 index; __u8 name[32]; __u32 capability; __u32 rangelow; __u32 rangehigh; __u32 txsubchans; __u32 type; /* enum v4l2_tuner_type */ __u32 reserved[3]; }; /* Flags for the 'capability' field */ #define V4L2_TUNER_CAP_LOW 0x0001 #define V4L2_TUNER_CAP_NORM 0x0002 #define V4L2_TUNER_CAP_HWSEEK_BOUNDED 0x0004 #define V4L2_TUNER_CAP_HWSEEK_WRAP 0x0008 #define V4L2_TUNER_CAP_STEREO 0x0010 #define V4L2_TUNER_CAP_LANG2 0x0020 #define V4L2_TUNER_CAP_SAP 0x0020 #define V4L2_TUNER_CAP_LANG1 0x0040 #define V4L2_TUNER_CAP_RDS 0x0080 #define V4L2_TUNER_CAP_RDS_BLOCK_IO 0x0100 #define V4L2_TUNER_CAP_RDS_CONTROLS 0x0200 #define V4L2_TUNER_CAP_FREQ_BANDS 0x0400 #define V4L2_TUNER_CAP_HWSEEK_PROG_LIM 0x0800 #define V4L2_TUNER_CAP_1HZ 0x1000 /* Flags for the 'rxsubchans' field */ #define V4L2_TUNER_SUB_MONO 0x0001 #define V4L2_TUNER_SUB_STEREO 0x0002 #define V4L2_TUNER_SUB_LANG2 0x0004 #define V4L2_TUNER_SUB_SAP 0x0004 #define V4L2_TUNER_SUB_LANG1 0x0008 #define V4L2_TUNER_SUB_RDS 0x0010 /* Values for the 'audmode' field */ #define V4L2_TUNER_MODE_MONO 0x0000 #define V4L2_TUNER_MODE_STEREO 0x0001 #define V4L2_TUNER_MODE_LANG2 0x0002 #define V4L2_TUNER_MODE_SAP 0x0002 #define V4L2_TUNER_MODE_LANG1 0x0003 #define V4L2_TUNER_MODE_LANG1_LANG2 0x0004 struct v4l2_frequency { __u32 tuner; __u32 type; /* enum v4l2_tuner_type */ __u32 frequency; __u32 reserved[8]; }; #define V4L2_BAND_MODULATION_VSB (1 << 1) #define V4L2_BAND_MODULATION_FM (1 << 2) #define V4L2_BAND_MODULATION_AM (1 << 3) struct v4l2_frequency_band { __u32 tuner; __u32 type; /* enum v4l2_tuner_type */ __u32 index; __u32 capability; __u32 rangelow; __u32 rangehigh; __u32 modulation; __u32 reserved[9]; }; struct v4l2_hw_freq_seek { __u32 tuner; __u32 type; /* enum v4l2_tuner_type */ __u32 seek_upward; __u32 wrap_around; __u32 spacing; __u32 rangelow; __u32 rangehigh; __u32 reserved[5]; }; /* * R D S */ struct v4l2_rds_data { __u8 lsb; __u8 msb; __u8 block; } __attribute__ ((packed)); #define V4L2_RDS_BLOCK_MSK 0x7 #define V4L2_RDS_BLOCK_A 0 #define V4L2_RDS_BLOCK_B 1 #define V4L2_RDS_BLOCK_C 2 #define V4L2_RDS_BLOCK_D 3 #define V4L2_RDS_BLOCK_C_ALT 4 #define V4L2_RDS_BLOCK_INVALID 7 #define V4L2_RDS_BLOCK_CORRECTED 0x40 #define V4L2_RDS_BLOCK_ERROR 0x80 /* * A U D I O */ struct v4l2_audio { __u32 index; __u8 name[32]; __u32 capability; __u32 mode; __u32 reserved[2]; }; /* Flags for the 'capability' field */ #define V4L2_AUDCAP_STEREO 0x00001 #define V4L2_AUDCAP_AVL 0x00002 /* Flags for the 'mode' field */ #define V4L2_AUDMODE_AVL 0x00001 struct v4l2_audioout { __u32 index; __u8 name[32]; __u32 capability; __u32 mode; __u32 reserved[2]; }; /* * M P E G S E R V I C E S */ #if 1 #define V4L2_ENC_IDX_FRAME_I (0) #define V4L2_ENC_IDX_FRAME_P (1) #define V4L2_ENC_IDX_FRAME_B (2) #define V4L2_ENC_IDX_FRAME_MASK (0xf) struct v4l2_enc_idx_entry { __u64 offset; __u64 pts; __u32 length; __u32 flags; __u32 reserved[2]; }; #define V4L2_ENC_IDX_ENTRIES (64) struct v4l2_enc_idx { __u32 entries; __u32 entries_cap; __u32 reserved[4]; struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES]; }; #define V4L2_ENC_CMD_START (0) #define V4L2_ENC_CMD_STOP (1) #define V4L2_ENC_CMD_PAUSE (2) #define V4L2_ENC_CMD_RESUME (3) /* Flags for V4L2_ENC_CMD_STOP */ #define V4L2_ENC_CMD_STOP_AT_GOP_END (1 << 0) struct v4l2_encoder_cmd { __u32 cmd; __u32 flags; union { struct { __u32 data[8]; } raw; }; }; /* Decoder commands */ #define V4L2_DEC_CMD_START (0) #define V4L2_DEC_CMD_STOP (1) #define V4L2_DEC_CMD_PAUSE (2) #define V4L2_DEC_CMD_RESUME (3) /* Flags for V4L2_DEC_CMD_START */ #define V4L2_DEC_CMD_START_MUTE_AUDIO (1 << 0) /* Flags for V4L2_DEC_CMD_PAUSE */ #define V4L2_DEC_CMD_PAUSE_TO_BLACK (1 << 0) /* Flags for V4L2_DEC_CMD_STOP */ #define V4L2_DEC_CMD_STOP_TO_BLACK (1 << 0) #define V4L2_DEC_CMD_STOP_IMMEDIATELY (1 << 1) /* Play format requirements (returned by the driver): */ /* The decoder has no special format requirements */ #define V4L2_DEC_START_FMT_NONE (0) /* The decoder requires full GOPs */ #define V4L2_DEC_START_FMT_GOP (1) /* The structure must be zeroed before use by the application This ensures it can be extended safely in the future. */ struct v4l2_decoder_cmd { __u32 cmd; __u32 flags; union { struct { __u64 pts; } stop; struct { /* 0 or 1000 specifies normal speed, 1 specifies forward single stepping, -1 specifies backward single stepping, >1: playback at speed/1000 of the normal speed, <-1: reverse playback at (-speed/1000) of the normal speed. */ __s32 speed; __u32 format; } start; struct { __u32 data[16]; } raw; }; }; #endif /* * D A T A S E R V I C E S ( V B I ) * * Data services API by Michael Schimek */ /* Raw VBI */ struct v4l2_vbi_format { __u32 sampling_rate; /* in 1 Hz */ __u32 offset; __u32 samples_per_line; __u32 sample_format; /* V4L2_PIX_FMT_* */ __s32 start[2]; __u32 count[2]; __u32 flags; /* V4L2_VBI_* */ __u32 reserved[2]; /* must be zero */ }; /* VBI flags */ #define V4L2_VBI_UNSYNC (1 << 0) #define V4L2_VBI_INTERLACED (1 << 1) /* ITU-R start lines for each field */ #define V4L2_VBI_ITU_525_F1_START (1) #define V4L2_VBI_ITU_525_F2_START (264) #define V4L2_VBI_ITU_625_F1_START (1) #define V4L2_VBI_ITU_625_F2_START (314) /* Sliced VBI * * This implements is a proposal V4L2 API to allow SLICED VBI * required for some hardware encoders. It should change without * notice in the definitive implementation. */ struct v4l2_sliced_vbi_format { __u16 service_set; /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field (equals frame lines 313-336 for 625 line video standards, 263-286 for 525 line standards) */ __u16 service_lines[2][24]; __u32 io_size; __u32 reserved[2]; /* must be zero */ }; /* Teletext World System Teletext (WST), defined on ITU-R BT.653-2 */ #define V4L2_SLICED_TELETEXT_B (0x0001) /* Video Program System, defined on ETS 300 231*/ #define V4L2_SLICED_VPS (0x0400) /* Closed Caption, defined on EIA-608 */ #define V4L2_SLICED_CAPTION_525 (0x1000) /* Wide Screen System, defined on ITU-R BT1119.1 */ #define V4L2_SLICED_WSS_625 (0x4000) #define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) #define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) struct v4l2_sliced_vbi_cap { __u16 service_set; /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field (equals frame lines 313-336 for 625 line video standards, 263-286 for 525 line standards) */ __u16 service_lines[2][24]; __u32 type; /* enum v4l2_buf_type */ __u32 reserved[3]; /* must be 0 */ }; struct v4l2_sliced_vbi_data { __u32 id; __u32 field; /* 0: first field, 1: second field */ __u32 line; /* 1-23 */ __u32 reserved; /* must be 0 */ __u8 data[48]; }; /* * Sliced VBI data inserted into MPEG Streams */ /* * V4L2_MPEG_STREAM_VBI_FMT_IVTV: * * Structure of payload contained in an MPEG 2 Private Stream 1 PES Packet in an * MPEG-2 Program Pack that contains V4L2_MPEG_STREAM_VBI_FMT_IVTV Sliced VBI * data * * Note, the MPEG-2 Program Pack and Private Stream 1 PES packet header * definitions are not included here. See the MPEG-2 specifications for details * on these headers. */ /* Line type IDs */ #define V4L2_MPEG_VBI_IVTV_TELETEXT_B (1) #define V4L2_MPEG_VBI_IVTV_CAPTION_525 (4) #define V4L2_MPEG_VBI_IVTV_WSS_625 (5) #define V4L2_MPEG_VBI_IVTV_VPS (7) struct v4l2_mpeg_vbi_itv0_line { __u8 id; /* One of V4L2_MPEG_VBI_IVTV_* above */ __u8 data[42]; /* Sliced VBI data for the line */ } __attribute__ ((packed)); struct v4l2_mpeg_vbi_itv0 { __le32 linemask[2]; /* Bitmasks of VBI service lines present */ struct v4l2_mpeg_vbi_itv0_line line[35]; } __attribute__ ((packed)); struct v4l2_mpeg_vbi_ITV0 { struct v4l2_mpeg_vbi_itv0_line line[36]; } __attribute__ ((packed)); #define V4L2_MPEG_VBI_IVTV_MAGIC0 "itv0" #define V4L2_MPEG_VBI_IVTV_MAGIC1 "ITV0" struct v4l2_mpeg_vbi_fmt_ivtv { __u8 magic[4]; union { struct v4l2_mpeg_vbi_itv0 itv0; struct v4l2_mpeg_vbi_ITV0 ITV0; }; } __attribute__ ((packed)); /* * A G G R E G A T E S T R U C T U R E S */ /** * struct v4l2_plane_pix_format - additional, per-plane format definition * @sizeimage: maximum size in bytes required for data, for which * this plane will be used * @bytesperline: distance in bytes between the leftmost pixels in two * adjacent lines */ struct v4l2_plane_pix_format { __u32 sizeimage; __u32 bytesperline; __u16 reserved[6]; } __attribute__ ((packed)); /** * struct v4l2_pix_format_mplane - multiplanar format definition * @width: image width in pixels * @height: image height in pixels * @pixelformat: little endian four character code (fourcc) * @field: enum v4l2_field; field order (for interlaced video) * @colorspace: enum v4l2_colorspace; supplemental to pixelformat * @plane_fmt: per-plane information * @num_planes: number of planes for this format * @flags: format flags (V4L2_PIX_FMT_FLAG_*) * @ycbcr_enc: enum v4l2_ycbcr_encoding, Y'CbCr encoding * @quantization: enum v4l2_quantization, colorspace quantization * @xfer_func: enum v4l2_xfer_func, colorspace transfer function */ struct v4l2_pix_format_mplane { __u32 width; __u32 height; __u32 pixelformat; __u32 field; __u32 colorspace; struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES]; __u8 num_planes; __u8 flags; union { __u8 ycbcr_enc; __u8 hsv_enc; }; __u8 quantization; __u8 xfer_func; __u8 reserved[7]; } __attribute__ ((packed)); /** * struct v4l2_sdr_format - SDR format definition * @pixelformat: little endian four character code (fourcc) * @buffersize: maximum size in bytes required for data */ struct v4l2_sdr_format { __u32 pixelformat; __u32 buffersize; __u8 reserved[24]; } __attribute__ ((packed)); /** * struct v4l2_meta_format - metadata format definition * @dataformat: little endian four character code (fourcc) * @buffersize: maximum size in bytes required for data */ struct v4l2_meta_format { __u32 dataformat; __u32 buffersize; } __attribute__ ((packed)); /** * struct v4l2_format - stream data format * @type: enum v4l2_buf_type; type of the data stream * @pix: definition of an image format * @pix_mp: definition of a multiplanar image format * @win: definition of an overlaid image * @vbi: raw VBI capture or output parameters * @sliced: sliced VBI capture or output parameters * @raw_data: placeholder for future extensions and custom formats */ struct v4l2_format { __u32 type; union { struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */ struct v4l2_pix_format_mplane pix_mp; /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */ struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */ struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */ struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */ struct v4l2_sdr_format sdr; /* V4L2_BUF_TYPE_SDR_CAPTURE */ struct v4l2_meta_format meta; /* V4L2_BUF_TYPE_META_CAPTURE */ __u8 raw_data[200]; /* user-defined */ } fmt; }; /* Stream type-dependent parameters */ struct v4l2_streamparm { __u32 type; /* enum v4l2_buf_type */ union { struct v4l2_captureparm capture; struct v4l2_outputparm output; __u8 raw_data[200]; /* user-defined */ } parm; }; /* * E V E N T S */ #define V4L2_EVENT_ALL 0 #define V4L2_EVENT_VSYNC 1 #define V4L2_EVENT_EOS 2 #define V4L2_EVENT_CTRL 3 #define V4L2_EVENT_FRAME_SYNC 4 #define V4L2_EVENT_SOURCE_CHANGE 5 #define V4L2_EVENT_MOTION_DET 6 #define V4L2_EVENT_PRIVATE_START 0x08000000 /* Payload for V4L2_EVENT_VSYNC */ struct v4l2_event_vsync { /* Can be V4L2_FIELD_ANY, _NONE, _TOP or _BOTTOM */ __u8 field; } __attribute__ ((packed)); /* Payload for V4L2_EVENT_CTRL */ #define V4L2_EVENT_CTRL_CH_VALUE (1 << 0) #define V4L2_EVENT_CTRL_CH_FLAGS (1 << 1) #define V4L2_EVENT_CTRL_CH_RANGE (1 << 2) struct v4l2_event_ctrl { __u32 changes; __u32 type; union { __s32 value; __s64 value64; }; __u32 flags; __s32 minimum; __s32 maximum; __s32 step; __s32 default_value; }; struct v4l2_event_frame_sync { __u32 frame_sequence; }; #define V4L2_EVENT_SRC_CH_RESOLUTION (1 << 0) struct v4l2_event_src_change { __u32 changes; }; #define V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ (1 << 0) /** * struct v4l2_event_motion_det - motion detection event * @flags: if V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ is set, then the * frame_sequence field is valid. * @frame_sequence: the frame sequence number associated with this event. * @region_mask: which regions detected motion. */ struct v4l2_event_motion_det { __u32 flags; __u32 frame_sequence; __u32 region_mask; }; struct v4l2_event { __u32 type; union { struct v4l2_event_vsync vsync; struct v4l2_event_ctrl ctrl; struct v4l2_event_frame_sync frame_sync; struct v4l2_event_src_change src_change; struct v4l2_event_motion_det motion_det; __u8 data[64]; } u; __u32 pending; __u32 sequence; struct timespec timestamp; __u32 id; __u32 reserved[8]; }; #define V4L2_EVENT_SUB_FL_SEND_INITIAL (1 << 0) #define V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK (1 << 1) struct v4l2_event_subscription { __u32 type; __u32 id; __u32 flags; __u32 reserved[5]; }; /* * A D V A N C E D D E B U G G I N G * * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS! * FOR DEBUGGING, TESTING AND INTERNAL USE ONLY! */ /* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ #define V4L2_CHIP_MATCH_BRIDGE 0 /* Match against chip ID on the bridge (0 for the bridge) */ #define V4L2_CHIP_MATCH_SUBDEV 4 /* Match against subdev index */ /* The following four defines are no longer in use */ #define V4L2_CHIP_MATCH_HOST V4L2_CHIP_MATCH_BRIDGE #define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */ #define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */ #define V4L2_CHIP_MATCH_AC97 3 /* Match against ancillary AC97 chip */ struct v4l2_dbg_match { __u32 type; /* Match type */ union { /* Match this chip, meaning determined by type */ __u32 addr; char name[32]; }; } __attribute__ ((packed)); struct v4l2_dbg_register { struct v4l2_dbg_match match; __u32 size; /* register size in bytes */ __u64 reg; __u64 val; } __attribute__ ((packed)); #define V4L2_CHIP_FL_READABLE (1 << 0) #define V4L2_CHIP_FL_WRITABLE (1 << 1) /* VIDIOC_DBG_G_CHIP_INFO */ struct v4l2_dbg_chip_info { struct v4l2_dbg_match match; char name[32]; __u32 flags; __u32 reserved[32]; } __attribute__ ((packed)); /** * struct v4l2_create_buffers - VIDIOC_CREATE_BUFS argument * @index: on return, index of the first created buffer * @count: entry: number of requested buffers, * return: number of created buffers * @memory: enum v4l2_memory; buffer memory type * @format: frame format, for which buffers are requested * @reserved: future extensions */ struct v4l2_create_buffers { __u32 index; __u32 count; __u32 memory; struct v4l2_format format; __u32 reserved[8]; }; /* * I O C T L C O D E S F O R V I D E O D E V I C E S * */ #define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability) #define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc) #define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format) #define VIDIOC_S_FMT _IOWR('V', 5, struct v4l2_format) #define VIDIOC_REQBUFS _IOWR('V', 8, struct v4l2_requestbuffers) #define VIDIOC_QUERYBUF _IOWR('V', 9, struct v4l2_buffer) #define VIDIOC_G_FBUF _IOR('V', 10, struct v4l2_framebuffer) #define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer) #define VIDIOC_OVERLAY _IOW('V', 14, int) #define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer) #define VIDIOC_EXPBUF _IOWR('V', 16, struct v4l2_exportbuffer) #define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer) #define VIDIOC_STREAMON _IOW('V', 18, int) #define VIDIOC_STREAMOFF _IOW('V', 19, int) #define VIDIOC_G_PARM _IOWR('V', 21, struct v4l2_streamparm) #define VIDIOC_S_PARM _IOWR('V', 22, struct v4l2_streamparm) #define VIDIOC_G_STD _IOR('V', 23, v4l2_std_id) #define VIDIOC_S_STD _IOW('V', 24, v4l2_std_id) #define VIDIOC_ENUMSTD _IOWR('V', 25, struct v4l2_standard) #define VIDIOC_ENUMINPUT _IOWR('V', 26, struct v4l2_input) #define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control) #define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control) #define VIDIOC_G_TUNER _IOWR('V', 29, struct v4l2_tuner) #define VIDIOC_S_TUNER _IOW('V', 30, struct v4l2_tuner) #define VIDIOC_G_AUDIO _IOR('V', 33, struct v4l2_audio) #define VIDIOC_S_AUDIO _IOW('V', 34, struct v4l2_audio) #define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl) #define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu) #define VIDIOC_G_INPUT _IOR('V', 38, int) #define VIDIOC_S_INPUT _IOWR('V', 39, int) #define VIDIOC_G_EDID _IOWR('V', 40, struct v4l2_edid) #define VIDIOC_S_EDID _IOWR('V', 41, struct v4l2_edid) #define VIDIOC_G_OUTPUT _IOR('V', 46, int) #define VIDIOC_S_OUTPUT _IOWR('V', 47, int) #define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output) #define VIDIOC_G_AUDOUT _IOR('V', 49, struct v4l2_audioout) #define VIDIOC_S_AUDOUT _IOW('V', 50, struct v4l2_audioout) #define VIDIOC_G_MODULATOR _IOWR('V', 54, struct v4l2_modulator) #define VIDIOC_S_MODULATOR _IOW('V', 55, struct v4l2_modulator) #define VIDIOC_G_FREQUENCY _IOWR('V', 56, struct v4l2_frequency) #define VIDIOC_S_FREQUENCY _IOW('V', 57, struct v4l2_frequency) #define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap) #define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop) #define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop) #define VIDIOC_G_JPEGCOMP _IOR('V', 61, struct v4l2_jpegcompression) #define VIDIOC_S_JPEGCOMP _IOW('V', 62, struct v4l2_jpegcompression) #define VIDIOC_QUERYSTD _IOR('V', 63, v4l2_std_id) #define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format) #define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio) #define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout) #define VIDIOC_G_PRIORITY _IOR('V', 67, __u32) /* enum v4l2_priority */ #define VIDIOC_S_PRIORITY _IOW('V', 68, __u32) /* enum v4l2_priority */ #define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap) #define VIDIOC_LOG_STATUS _IO('V', 70) #define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls) #define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls) #define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls) #define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum) #define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum) #define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx) #define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd) #define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd) /* * Experimental, meant for debugging, testing and internal use. * Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined. * You must be root to use these ioctls. Never use these in applications! */ #define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register) #define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register) #define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) #define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) #define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) #define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event) #define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription) #define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription) #define VIDIOC_CREATE_BUFS _IOWR('V', 92, struct v4l2_create_buffers) #define VIDIOC_PREPARE_BUF _IOWR('V', 93, struct v4l2_buffer) #define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection) #define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection) #define VIDIOC_DECODER_CMD _IOWR('V', 96, struct v4l2_decoder_cmd) #define VIDIOC_TRY_DECODER_CMD _IOWR('V', 97, struct v4l2_decoder_cmd) #define VIDIOC_ENUM_DV_TIMINGS _IOWR('V', 98, struct v4l2_enum_dv_timings) #define VIDIOC_QUERY_DV_TIMINGS _IOR('V', 99, struct v4l2_dv_timings) #define VIDIOC_DV_TIMINGS_CAP _IOWR('V', 100, struct v4l2_dv_timings_cap) #define VIDIOC_ENUM_FREQ_BANDS _IOWR('V', 101, struct v4l2_frequency_band) /* * Experimental, meant for debugging, testing and internal use. * Never use this in applications! */ #define VIDIOC_DBG_G_CHIP_INFO _IOWR('V', 102, struct v4l2_dbg_chip_info) #define VIDIOC_QUERY_EXT_CTRL _IOWR('V', 103, struct v4l2_query_ext_ctrl) /* Reminder: when adding new ioctls please add support for them to drivers/media/v4l2-core/v4l2-compat-ioctl32.c as well! */ #define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ #endif /* __LINUX_VIDEODEV2_H */ �������������������������linux/phantom.h�������������������������������������������������������������������������������������0000644�����������������00000003166�14763166027�0007544 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (C) 2005-2007 Jiri Slaby <jirislaby@gmail.com> * * 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. */ #ifndef __PHANTOM_H #define __PHANTOM_H #include <linux/types.h> /* PHN_(G/S)ET_REG param */ struct phm_reg { __u32 reg; __u32 value; }; /* PHN_(G/S)ET_REGS param */ struct phm_regs { __u32 count; __u32 mask; __u32 values[8]; }; #define PH_IOC_MAGIC 'p' #define PHN_GET_REG _IOWR(PH_IOC_MAGIC, 0, struct phm_reg *) #define PHN_SET_REG _IOW(PH_IOC_MAGIC, 1, struct phm_reg *) #define PHN_GET_REGS _IOWR(PH_IOC_MAGIC, 2, struct phm_regs *) #define PHN_SET_REGS _IOW(PH_IOC_MAGIC, 3, struct phm_regs *) /* this ioctl tells the driver, that the caller is not OpenHaptics and might * use improved registers update (no more phantom switchoffs when using * libphantom) */ #define PHN_NOT_OH _IO(PH_IOC_MAGIC, 4) #define PHN_GETREG _IOWR(PH_IOC_MAGIC, 5, struct phm_reg) #define PHN_SETREG _IOW(PH_IOC_MAGIC, 6, struct phm_reg) #define PHN_GETREGS _IOWR(PH_IOC_MAGIC, 7, struct phm_regs) #define PHN_SETREGS _IOW(PH_IOC_MAGIC, 8, struct phm_regs) #define PHN_CONTROL 0x6 /* control byte in iaddr space */ #define PHN_CTL_AMP 0x1 /* switch after torques change */ #define PHN_CTL_BUT 0x2 /* is button switched */ #define PHN_CTL_IRQ 0x10 /* is irq enabled */ #define PHN_ZERO_FORCE 2048 /* zero torque on motor */ #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/omapfb.h��������������������������������������������������������������������������������������0000644�����������������00000013436�14763166027�0007343 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * File: include/linux/omapfb.h * * Framebuffer driver for TI OMAP boards * * Copyright (C) 2004 Nokia Corporation * Author: Imre Deak <imre.deak@nokia.com> * * 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., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __LINUX_OMAPFB_H__ #define __LINUX_OMAPFB_H__ #include <linux/fb.h> #include <linux/ioctl.h> #include <linux/types.h> /* IOCTL commands. */ #define OMAP_IOW(num, dtype) _IOW('O', num, dtype) #define OMAP_IOR(num, dtype) _IOR('O', num, dtype) #define OMAP_IOWR(num, dtype) _IOWR('O', num, dtype) #define OMAP_IO(num) _IO('O', num) #define OMAPFB_MIRROR OMAP_IOW(31, int) #define OMAPFB_SYNC_GFX OMAP_IO(37) #define OMAPFB_VSYNC OMAP_IO(38) #define OMAPFB_SET_UPDATE_MODE OMAP_IOW(40, int) #define OMAPFB_GET_CAPS OMAP_IOR(42, struct omapfb_caps) #define OMAPFB_GET_UPDATE_MODE OMAP_IOW(43, int) #define OMAPFB_LCD_TEST OMAP_IOW(45, int) #define OMAPFB_CTRL_TEST OMAP_IOW(46, int) #define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(47, struct omapfb_update_window_old) #define OMAPFB_SET_COLOR_KEY OMAP_IOW(50, struct omapfb_color_key) #define OMAPFB_GET_COLOR_KEY OMAP_IOW(51, struct omapfb_color_key) #define OMAPFB_SETUP_PLANE OMAP_IOW(52, struct omapfb_plane_info) #define OMAPFB_QUERY_PLANE OMAP_IOW(53, struct omapfb_plane_info) #define OMAPFB_UPDATE_WINDOW OMAP_IOW(54, struct omapfb_update_window) #define OMAPFB_SETUP_MEM OMAP_IOW(55, struct omapfb_mem_info) #define OMAPFB_QUERY_MEM OMAP_IOW(56, struct omapfb_mem_info) #define OMAPFB_WAITFORVSYNC OMAP_IO(57) #define OMAPFB_MEMORY_READ OMAP_IOR(58, struct omapfb_memory_read) #define OMAPFB_GET_OVERLAY_COLORMODE OMAP_IOR(59, struct omapfb_ovl_colormode) #define OMAPFB_WAITFORGO OMAP_IO(60) #define OMAPFB_GET_VRAM_INFO OMAP_IOR(61, struct omapfb_vram_info) #define OMAPFB_SET_TEARSYNC OMAP_IOW(62, struct omapfb_tearsync_info) #define OMAPFB_GET_DISPLAY_INFO OMAP_IOR(63, struct omapfb_display_info) #define OMAPFB_CAPS_GENERIC_MASK 0x00000fff #define OMAPFB_CAPS_LCDC_MASK 0x00fff000 #define OMAPFB_CAPS_PANEL_MASK 0xff000000 #define OMAPFB_CAPS_MANUAL_UPDATE 0x00001000 #define OMAPFB_CAPS_TEARSYNC 0x00002000 #define OMAPFB_CAPS_PLANE_RELOCATE_MEM 0x00004000 #define OMAPFB_CAPS_PLANE_SCALE 0x00008000 #define OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE 0x00010000 #define OMAPFB_CAPS_WINDOW_SCALE 0x00020000 #define OMAPFB_CAPS_WINDOW_OVERLAY 0x00040000 #define OMAPFB_CAPS_WINDOW_ROTATE 0x00080000 #define OMAPFB_CAPS_SET_BACKLIGHT 0x01000000 /* Values from DSP must map to lower 16-bits */ #define OMAPFB_FORMAT_MASK 0x00ff #define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100 #define OMAPFB_FORMAT_FLAG_TEARSYNC 0x0200 #define OMAPFB_FORMAT_FLAG_FORCE_VSYNC 0x0400 #define OMAPFB_FORMAT_FLAG_ENABLE_OVERLAY 0x0800 #define OMAPFB_FORMAT_FLAG_DISABLE_OVERLAY 0x1000 #define OMAPFB_MEMTYPE_SDRAM 0 #define OMAPFB_MEMTYPE_SRAM 1 #define OMAPFB_MEMTYPE_MAX 1 #define OMAPFB_MEM_IDX_ENABLED 0x80 #define OMAPFB_MEM_IDX_MASK 0x7f enum omapfb_color_format { OMAPFB_COLOR_RGB565 = 0, OMAPFB_COLOR_YUV422, OMAPFB_COLOR_YUV420, OMAPFB_COLOR_CLUT_8BPP, OMAPFB_COLOR_CLUT_4BPP, OMAPFB_COLOR_CLUT_2BPP, OMAPFB_COLOR_CLUT_1BPP, OMAPFB_COLOR_RGB444, OMAPFB_COLOR_YUY422, OMAPFB_COLOR_ARGB16, OMAPFB_COLOR_RGB24U, /* RGB24, 32-bit container */ OMAPFB_COLOR_RGB24P, /* RGB24, 24-bit container */ OMAPFB_COLOR_ARGB32, OMAPFB_COLOR_RGBA32, OMAPFB_COLOR_RGBX32, }; struct omapfb_update_window { __u32 x, y; __u32 width, height; __u32 format; __u32 out_x, out_y; __u32 out_width, out_height; __u32 reserved[8]; }; struct omapfb_update_window_old { __u32 x, y; __u32 width, height; __u32 format; }; enum omapfb_plane { OMAPFB_PLANE_GFX = 0, OMAPFB_PLANE_VID1, OMAPFB_PLANE_VID2, }; enum omapfb_channel_out { OMAPFB_CHANNEL_OUT_LCD = 0, OMAPFB_CHANNEL_OUT_DIGIT, }; struct omapfb_plane_info { __u32 pos_x; __u32 pos_y; __u8 enabled; __u8 channel_out; __u8 mirror; __u8 mem_idx; __u32 out_width; __u32 out_height; __u32 reserved2[12]; }; struct omapfb_mem_info { __u32 size; __u8 type; __u8 reserved[3]; }; struct omapfb_caps { __u32 ctrl; __u32 plane_color; __u32 wnd_color; }; enum omapfb_color_key_type { OMAPFB_COLOR_KEY_DISABLED = 0, OMAPFB_COLOR_KEY_GFX_DST, OMAPFB_COLOR_KEY_VID_SRC, }; struct omapfb_color_key { __u8 channel_out; __u32 background; __u32 trans_key; __u8 key_type; }; enum omapfb_update_mode { OMAPFB_UPDATE_DISABLED = 0, OMAPFB_AUTO_UPDATE, OMAPFB_MANUAL_UPDATE }; struct omapfb_memory_read { __u16 x; __u16 y; __u16 w; __u16 h; size_t buffer_size; void *buffer; }; struct omapfb_ovl_colormode { __u8 overlay_idx; __u8 mode_idx; __u32 bits_per_pixel; __u32 nonstd; struct fb_bitfield red; struct fb_bitfield green; struct fb_bitfield blue; struct fb_bitfield transp; }; struct omapfb_vram_info { __u32 total; __u32 free; __u32 largest_free_block; __u32 reserved[5]; }; struct omapfb_tearsync_info { __u8 enabled; __u8 reserved1[3]; __u16 line; __u16 reserved2; }; struct omapfb_display_info { __u16 xres; __u16 yres; __u32 width; /* phys width of the display in micrometers */ __u32 height; /* phys height of the display in micrometers */ __u32 reserved[5]; }; #endif /* __LINUX_OMAPFB_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/hiddev.h��������������������������������������������������������������������������������������0000644�����������������00000014311�14763166027�0007333 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 1999-2000 Vojtech Pavlik * * Sponsored by SuSE */ /* * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail: * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic */ #ifndef _HIDDEV_H #define _HIDDEV_H #include <linux/types.h> /* * The event structure itself */ struct hiddev_event { unsigned hid; signed int value; }; struct hiddev_devinfo { __u32 bustype; __u32 busnum; __u32 devnum; __u32 ifnum; __s16 vendor; __s16 product; __s16 version; __u32 num_applications; }; struct hiddev_collection_info { __u32 index; __u32 type; __u32 usage; __u32 level; }; #define HID_STRING_SIZE 256 struct hiddev_string_descriptor { __s32 index; char value[HID_STRING_SIZE]; }; struct hiddev_report_info { __u32 report_type; __u32 report_id; __u32 num_fields; }; /* To do a GUSAGE/SUSAGE, fill in at least usage_code, report_type and * report_id. Set report_id to REPORT_ID_UNKNOWN if the rest of the fields * are unknown. Otherwise use a usage_ref struct filled in from a previous * successful GUSAGE call to save time. To actually send a value to the * device, perform a SUSAGE first, followed by a SREPORT. An INITREPORT or a * GREPORT isn't necessary for a GUSAGE to return valid data. */ #define HID_REPORT_ID_UNKNOWN 0xffffffff #define HID_REPORT_ID_FIRST 0x00000100 #define HID_REPORT_ID_NEXT 0x00000200 #define HID_REPORT_ID_MASK 0x000000ff #define HID_REPORT_ID_MAX 0x000000ff #define HID_REPORT_TYPE_INPUT 1 #define HID_REPORT_TYPE_OUTPUT 2 #define HID_REPORT_TYPE_FEATURE 3 #define HID_REPORT_TYPE_MIN 1 #define HID_REPORT_TYPE_MAX 3 struct hiddev_field_info { __u32 report_type; __u32 report_id; __u32 field_index; __u32 maxusage; __u32 flags; __u32 physical; /* physical usage for this field */ __u32 logical; /* logical usage for this field */ __u32 application; /* application usage for this field */ __s32 logical_minimum; __s32 logical_maximum; __s32 physical_minimum; __s32 physical_maximum; __u32 unit_exponent; __u32 unit; }; /* Fill in report_type, report_id and field_index to get the information on a * field. */ #define HID_FIELD_CONSTANT 0x001 #define HID_FIELD_VARIABLE 0x002 #define HID_FIELD_RELATIVE 0x004 #define HID_FIELD_WRAP 0x008 #define HID_FIELD_NONLINEAR 0x010 #define HID_FIELD_NO_PREFERRED 0x020 #define HID_FIELD_NULL_STATE 0x040 #define HID_FIELD_VOLATILE 0x080 #define HID_FIELD_BUFFERED_BYTE 0x100 struct hiddev_usage_ref { __u32 report_type; __u32 report_id; __u32 field_index; __u32 usage_index; __u32 usage_code; __s32 value; }; /* hiddev_usage_ref_multi is used for sending multiple bytes to a control. * It really manifests itself as setting the value of consecutive usages */ #define HID_MAX_MULTI_USAGES 1024 struct hiddev_usage_ref_multi { struct hiddev_usage_ref uref; __u32 num_values; __s32 values[HID_MAX_MULTI_USAGES]; }; /* FIELD_INDEX_NONE is returned in read() data from the kernel when flags * is set to (HIDDEV_FLAG_UREF | HIDDEV_FLAG_REPORT) and a new report has * been sent by the device */ #define HID_FIELD_INDEX_NONE 0xffffffff /* * Protocol version. */ #define HID_VERSION 0x010004 /* * IOCTLs (0x00 - 0x7f) */ #define HIDIOCGVERSION _IOR('H', 0x01, int) #define HIDIOCAPPLICATION _IO('H', 0x02) #define HIDIOCGDEVINFO _IOR('H', 0x03, struct hiddev_devinfo) #define HIDIOCGSTRING _IOR('H', 0x04, struct hiddev_string_descriptor) #define HIDIOCINITREPORT _IO('H', 0x05) #define HIDIOCGNAME(len) _IOC(_IOC_READ, 'H', 0x06, len) #define HIDIOCGREPORT _IOW('H', 0x07, struct hiddev_report_info) #define HIDIOCSREPORT _IOW('H', 0x08, struct hiddev_report_info) #define HIDIOCGREPORTINFO _IOWR('H', 0x09, struct hiddev_report_info) #define HIDIOCGFIELDINFO _IOWR('H', 0x0A, struct hiddev_field_info) #define HIDIOCGUSAGE _IOWR('H', 0x0B, struct hiddev_usage_ref) #define HIDIOCSUSAGE _IOW('H', 0x0C, struct hiddev_usage_ref) #define HIDIOCGUCODE _IOWR('H', 0x0D, struct hiddev_usage_ref) #define HIDIOCGFLAG _IOR('H', 0x0E, int) #define HIDIOCSFLAG _IOW('H', 0x0F, int) #define HIDIOCGCOLLECTIONINDEX _IOW('H', 0x10, struct hiddev_usage_ref) #define HIDIOCGCOLLECTIONINFO _IOWR('H', 0x11, struct hiddev_collection_info) #define HIDIOCGPHYS(len) _IOC(_IOC_READ, 'H', 0x12, len) /* For writing/reading to multiple/consecutive usages */ #define HIDIOCGUSAGES _IOWR('H', 0x13, struct hiddev_usage_ref_multi) #define HIDIOCSUSAGES _IOW('H', 0x14, struct hiddev_usage_ref_multi) /* * Flags to be used in HIDIOCSFLAG */ #define HIDDEV_FLAG_UREF 0x1 #define HIDDEV_FLAG_REPORT 0x2 #define HIDDEV_FLAGS 0x3 /* To traverse the input report descriptor info for a HID device, perform the * following: * * rinfo.report_type = HID_REPORT_TYPE_INPUT; * rinfo.report_id = HID_REPORT_ID_FIRST; * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); * * while (ret >= 0) { * for (i = 0; i < rinfo.num_fields; i++) { * finfo.report_type = rinfo.report_type; * finfo.report_id = rinfo.report_id; * finfo.field_index = i; * ioctl(fd, HIDIOCGFIELDINFO, &finfo); * for (j = 0; j < finfo.maxusage; j++) { * uref.report_type = rinfo.report_type; * uref.report_id = rinfo.report_id; * uref.field_index = i; * uref.usage_index = j; * ioctl(fd, HIDIOCGUCODE, &uref); * ioctl(fd, HIDIOCGUSAGE, &uref); * } * } * rinfo.report_id |= HID_REPORT_ID_NEXT; * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); * } */ #endif /* _HIDDEV_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/chio.h����������������������������������������������������������������������������������������0000644�����������������00000012340�14763166027�0007012 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ioctl interface for the scsi media changer driver */ /* changer element types */ #define CHET_MT 0 /* media transport element (robot) */ #define CHET_ST 1 /* storage element (media slots) */ #define CHET_IE 2 /* import/export element */ #define CHET_DT 3 /* data transfer element (tape/cdrom/whatever) */ #define CHET_V1 4 /* vendor specific #1 */ #define CHET_V2 5 /* vendor specific #2 */ #define CHET_V3 6 /* vendor specific #3 */ #define CHET_V4 7 /* vendor specific #4 */ /* * CHIOGPARAMS * query changer properties * * CHIOVGPARAMS * query vendor-specific element types * * accessing elements works by specifing type and unit of the element. * for example, storage elements are addressed with type = CHET_ST and * unit = 0 .. cp_nslots-1 * */ struct changer_params { int cp_curpicker; /* current transport element */ int cp_npickers; /* number of transport elements (CHET_MT) */ int cp_nslots; /* number of storage elements (CHET_ST) */ int cp_nportals; /* number of import/export elements (CHET_IE) */ int cp_ndrives; /* number of data transfer elements (CHET_DT) */ }; struct changer_vendor_params { int cvp_n1; /* number of vendor specific elems (CHET_V1) */ char cvp_label1[16]; int cvp_n2; /* number of vendor specific elems (CHET_V2) */ char cvp_label2[16]; int cvp_n3; /* number of vendor specific elems (CHET_V3) */ char cvp_label3[16]; int cvp_n4; /* number of vendor specific elems (CHET_V4) */ char cvp_label4[16]; int reserved[8]; }; /* * CHIOMOVE * move a medium from one element to another */ struct changer_move { int cm_fromtype; /* type/unit of source element */ int cm_fromunit; int cm_totype; /* type/unit of destination element */ int cm_tounit; int cm_flags; }; #define CM_INVERT 1 /* flag: rotate media (for double-sided like MOD) */ /* * CHIOEXCHANGE * move one medium from element #1 to element #2, * and another one from element #2 to element #3. * element #1 and #3 are allowed to be identical. */ struct changer_exchange { int ce_srctype; /* type/unit of element #1 */ int ce_srcunit; int ce_fdsttype; /* type/unit of element #2 */ int ce_fdstunit; int ce_sdsttype; /* type/unit of element #3 */ int ce_sdstunit; int ce_flags; }; #define CE_INVERT1 1 #define CE_INVERT2 2 /* * CHIOPOSITION * move the transport element (robot arm) to a specific element. */ struct changer_position { int cp_type; int cp_unit; int cp_flags; }; #define CP_INVERT 1 /* * CHIOGSTATUS * get element status for all elements of a specific type */ struct changer_element_status { int ces_type; unsigned char *ces_data; }; #define CESTATUS_FULL 0x01 /* full */ #define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */ #define CESTATUS_EXCEPT 0x04 /* error condition */ #define CESTATUS_ACCESS 0x08 /* access allowed */ #define CESTATUS_EXENAB 0x10 /* element can export media */ #define CESTATUS_INENAB 0x20 /* element can import media */ /* * CHIOGELEM * get more detailed status information for a single element */ struct changer_get_element { int cge_type; /* type/unit */ int cge_unit; int cge_status; /* status */ int cge_errno; /* errno */ int cge_srctype; /* source element of the last move/exchange */ int cge_srcunit; int cge_id; /* scsi id (for data transfer elements) */ int cge_lun; /* scsi lun (for data transfer elements) */ char cge_pvoltag[36]; /* primary volume tag */ char cge_avoltag[36]; /* alternate volume tag */ int cge_flags; }; /* flags */ #define CGE_ERRNO 0x01 /* errno available */ #define CGE_INVERT 0x02 /* media inverted */ #define CGE_SRC 0x04 /* media src available */ #define CGE_IDLUN 0x08 /* ID+LUN available */ #define CGE_PVOLTAG 0x10 /* primary volume tag available */ #define CGE_AVOLTAG 0x20 /* alternate volume tag available */ /* * CHIOSVOLTAG * set volume tag */ struct changer_set_voltag { int csv_type; /* type/unit */ int csv_unit; char csv_voltag[36]; /* volume tag */ int csv_flags; }; #define CSV_PVOLTAG 0x01 /* primary volume tag */ #define CSV_AVOLTAG 0x02 /* alternate volume tag */ #define CSV_CLEARTAG 0x04 /* clear volume tag */ /* ioctls */ #define CHIOMOVE _IOW('c', 1,struct changer_move) #define CHIOEXCHANGE _IOW('c', 2,struct changer_exchange) #define CHIOPOSITION _IOW('c', 3,struct changer_position) #define CHIOGPICKER _IOR('c', 4,int) /* not impl. */ #define CHIOSPICKER _IOW('c', 5,int) /* not impl. */ #define CHIOGPARAMS _IOR('c', 6,struct changer_params) #define CHIOGSTATUS _IOW('c', 8,struct changer_element_status) #define CHIOGELEM _IOW('c',16,struct changer_get_element) #define CHIOINITELEM _IO('c',17) #define CHIOSVOLTAG _IOW('c',18,struct changer_set_voltag) #define CHIOGVPARAMS _IOR('c',19,struct changer_vendor_params) /* ---------------------------------------------------------------------- */ /* * Local variables: * c-basic-offset: 8 * End: */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/ipsec.h���������������������������������������������������������������������������������������0000644�����������������00000001663�14763166027�0007201 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_IPSEC_H #define _LINUX_IPSEC_H /* The definitions, required to talk to KAME racoon IKE. */ #include <linux/pfkeyv2.h> #define IPSEC_PORT_ANY 0 #define IPSEC_ULPROTO_ANY 255 #define IPSEC_PROTO_ANY 255 enum { IPSEC_MODE_ANY = 0, /* We do not support this for SA */ IPSEC_MODE_TRANSPORT = 1, IPSEC_MODE_TUNNEL = 2, IPSEC_MODE_BEET = 3 }; enum { IPSEC_DIR_ANY = 0, IPSEC_DIR_INBOUND = 1, IPSEC_DIR_OUTBOUND = 2, IPSEC_DIR_FWD = 3, /* It is our own */ IPSEC_DIR_MAX = 4, IPSEC_DIR_INVALID = 5 }; enum { IPSEC_POLICY_DISCARD = 0, IPSEC_POLICY_NONE = 1, IPSEC_POLICY_IPSEC = 2, IPSEC_POLICY_ENTRUST = 3, IPSEC_POLICY_BYPASS = 4 }; enum { IPSEC_LEVEL_DEFAULT = 0, IPSEC_LEVEL_USE = 1, IPSEC_LEVEL_REQUIRE = 2, IPSEC_LEVEL_UNIQUE = 3 }; #define IPSEC_MANUAL_REQID_MAX 0x3fff #define IPSEC_REPLAYWSIZE 32 #endif /* _LINUX_IPSEC_H */ �����������������������������������������������������������������������������linux/tipc.h����������������������������������������������������������������������������������������0000644�����������������00000020010�14763166027�0007020 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * include/uapi/linux/tipc.h: Header for TIPC socket interface * * Copyright (c) 2003-2006, 2015-2016 Ericsson AB * Copyright (c) 2005, 2010-2011, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the names of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL") version 2 as published by the Free * Software Foundation. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _LINUX_TIPC_H_ #define _LINUX_TIPC_H_ #include <linux/types.h> #include <linux/sockios.h> /* * TIPC addressing primitives */ struct tipc_socket_addr { __u32 ref; __u32 node; }; struct tipc_service_addr { __u32 type; __u32 instance; }; struct tipc_service_range { __u32 type; __u32 lower; __u32 upper; }; /* * Application-accessible service types */ #define TIPC_NODE_STATE 0 /* node state service type */ #define TIPC_TOP_SRV 1 /* topology server service type */ #define TIPC_LINK_STATE 2 /* link state service type */ #define TIPC_RESERVED_TYPES 64 /* lowest user-allowed service type */ /* * Publication scopes when binding service / service range */ enum tipc_scope { TIPC_CLUSTER_SCOPE = 2, /* 0 can also be used */ TIPC_NODE_SCOPE = 3 }; /* * Limiting values for messages */ #define TIPC_MAX_USER_MSG_SIZE 66000U /* * Message importance levels */ #define TIPC_LOW_IMPORTANCE 0 #define TIPC_MEDIUM_IMPORTANCE 1 #define TIPC_HIGH_IMPORTANCE 2 #define TIPC_CRITICAL_IMPORTANCE 3 /* * Msg rejection/connection shutdown reasons */ #define TIPC_OK 0 #define TIPC_ERR_NO_NAME 1 #define TIPC_ERR_NO_PORT 2 #define TIPC_ERR_NO_NODE 3 #define TIPC_ERR_OVERLOAD 4 #define TIPC_CONN_SHUTDOWN 5 /* * TIPC topology subscription service definitions */ #define TIPC_SUB_PORTS 0x01 /* filter: evt at each match */ #define TIPC_SUB_SERVICE 0x02 /* filter: evt at first up/last down */ #define TIPC_SUB_CANCEL 0x04 /* filter: cancel a subscription */ #define TIPC_WAIT_FOREVER (~0) /* timeout for permanent subscription */ struct tipc_subscr { struct tipc_service_range seq; /* range of interest */ __u32 timeout; /* subscription duration (in ms) */ __u32 filter; /* bitmask of filter options */ char usr_handle[8]; /* available for subscriber use */ }; #define TIPC_PUBLISHED 1 /* publication event */ #define TIPC_WITHDRAWN 2 /* withdrawal event */ #define TIPC_SUBSCR_TIMEOUT 3 /* subscription timeout event */ struct tipc_event { __u32 event; /* event type */ __u32 found_lower; /* matching range */ __u32 found_upper; /* " " */ struct tipc_socket_addr port; /* associated socket */ struct tipc_subscr s; /* associated subscription */ }; /* * Socket API */ #ifndef AF_TIPC #define AF_TIPC 30 #endif #ifndef PF_TIPC #define PF_TIPC AF_TIPC #endif #ifndef SOL_TIPC #define SOL_TIPC 271 #endif #define TIPC_ADDR_MCAST 1 #define TIPC_SERVICE_RANGE 1 #define TIPC_SERVICE_ADDR 2 #define TIPC_SOCKET_ADDR 3 struct sockaddr_tipc { unsigned short family; unsigned char addrtype; signed char scope; union { struct tipc_socket_addr id; struct tipc_service_range nameseq; struct { struct tipc_service_addr name; __u32 domain; } name; } addr; }; /* * Ancillary data objects supported by recvmsg() */ #define TIPC_ERRINFO 1 /* error info */ #define TIPC_RETDATA 2 /* returned data */ #define TIPC_DESTNAME 3 /* destination name */ /* * TIPC-specific socket option names */ #define TIPC_IMPORTANCE 127 /* Default: TIPC_LOW_IMPORTANCE */ #define TIPC_SRC_DROPPABLE 128 /* Default: based on socket type */ #define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */ #define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */ #define TIPC_NODE_RECVQ_DEPTH 131 /* Default: none (read only) */ #define TIPC_SOCK_RECVQ_DEPTH 132 /* Default: none (read only) */ #define TIPC_MCAST_BROADCAST 133 /* Default: TIPC selects. No arg */ #define TIPC_MCAST_REPLICAST 134 /* Default: TIPC selects. No arg */ #define TIPC_GROUP_JOIN 135 /* Takes struct tipc_group_req* */ #define TIPC_GROUP_LEAVE 136 /* No argument */ /* * Flag values */ #define TIPC_GROUP_LOOPBACK 0x1 /* Receive copy of sent msg when match */ #define TIPC_GROUP_MEMBER_EVTS 0x2 /* Receive membership events in socket */ struct tipc_group_req { __u32 type; /* group id */ __u32 instance; /* member id */ __u32 scope; /* cluster/node */ __u32 flags; }; /* * Maximum sizes of TIPC bearer-related names (including terminating NULL) * The string formatting for each name element is: * media: media * interface: media:interface name * link: node:interface-node:interface */ #define TIPC_NODEID_LEN 16 #define TIPC_MAX_MEDIA_NAME 16 #define TIPC_MAX_IF_NAME 16 #define TIPC_MAX_BEARER_NAME 32 #define TIPC_MAX_LINK_NAME 68 #define SIOCGETLINKNAME SIOCPROTOPRIVATE #define SIOCGETNODEID (SIOCPROTOPRIVATE + 1) struct tipc_sioc_ln_req { __u32 peer; __u32 bearer_id; char linkname[TIPC_MAX_LINK_NAME]; }; struct tipc_sioc_nodeid_req { __u32 peer; char node_id[TIPC_NODEID_LEN]; }; /* The macros and functions below are deprecated: */ #define TIPC_CFG_SRV 0 #define TIPC_ZONE_SCOPE 1 #define TIPC_ADDR_NAMESEQ 1 #define TIPC_ADDR_NAME 2 #define TIPC_ADDR_ID 3 #define TIPC_NODE_BITS 12 #define TIPC_CLUSTER_BITS 12 #define TIPC_ZONE_BITS 8 #define TIPC_NODE_OFFSET 0 #define TIPC_CLUSTER_OFFSET TIPC_NODE_BITS #define TIPC_ZONE_OFFSET (TIPC_CLUSTER_OFFSET + TIPC_CLUSTER_BITS) #define TIPC_NODE_SIZE ((1UL << TIPC_NODE_BITS) - 1) #define TIPC_CLUSTER_SIZE ((1UL << TIPC_CLUSTER_BITS) - 1) #define TIPC_ZONE_SIZE ((1UL << TIPC_ZONE_BITS) - 1) #define TIPC_NODE_MASK (TIPC_NODE_SIZE << TIPC_NODE_OFFSET) #define TIPC_CLUSTER_MASK (TIPC_CLUSTER_SIZE << TIPC_CLUSTER_OFFSET) #define TIPC_ZONE_MASK (TIPC_ZONE_SIZE << TIPC_ZONE_OFFSET) #define TIPC_ZONE_CLUSTER_MASK (TIPC_ZONE_MASK | TIPC_CLUSTER_MASK) #define tipc_portid tipc_socket_addr #define tipc_name tipc_service_addr #define tipc_name_seq tipc_service_range static __inline__ __u32 tipc_addr(unsigned int zone, unsigned int cluster, unsigned int node) { return (zone << TIPC_ZONE_OFFSET) | (cluster << TIPC_CLUSTER_OFFSET) | node; } static __inline__ unsigned int tipc_zone(__u32 addr) { return addr >> TIPC_ZONE_OFFSET; } static __inline__ unsigned int tipc_cluster(__u32 addr) { return (addr & TIPC_CLUSTER_MASK) >> TIPC_CLUSTER_OFFSET; } static __inline__ unsigned int tipc_node(__u32 addr) { return addr & TIPC_NODE_MASK; } #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/userfaultfd.h���������������������������������������������������������������������������������0000644�����������������00000015233�14763166027�0010420 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/linux/userfaultfd.h * * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org> * Copyright (C) 2015 Red Hat, Inc. * */ #ifndef _LINUX_USERFAULTFD_H #define _LINUX_USERFAULTFD_H #include <linux/types.h> /* * If the UFFDIO_API is upgraded someday, the UFFDIO_UNREGISTER and * UFFDIO_WAKE ioctls should be defined as _IOW and not as _IOR. In * userfaultfd.h we assumed the kernel was reading (instead _IOC_READ * means the userland is reading). */ #define UFFD_API ((__u64)0xAA) #define UFFD_API_FEATURES (UFFD_FEATURE_EVENT_FORK | \ UFFD_FEATURE_EVENT_REMAP | \ UFFD_FEATURE_EVENT_REMOVE | \ UFFD_FEATURE_EVENT_UNMAP | \ UFFD_FEATURE_MISSING_HUGETLBFS | \ UFFD_FEATURE_MISSING_SHMEM | \ UFFD_FEATURE_SIGBUS | \ UFFD_FEATURE_THREAD_ID) #define UFFD_API_IOCTLS \ ((__u64)1 << _UFFDIO_REGISTER | \ (__u64)1 << _UFFDIO_UNREGISTER | \ (__u64)1 << _UFFDIO_API) #define UFFD_API_RANGE_IOCTLS \ ((__u64)1 << _UFFDIO_WAKE | \ (__u64)1 << _UFFDIO_COPY | \ (__u64)1 << _UFFDIO_ZEROPAGE) #define UFFD_API_RANGE_IOCTLS_BASIC \ ((__u64)1 << _UFFDIO_WAKE | \ (__u64)1 << _UFFDIO_COPY) /* * Valid ioctl command number range with this API is from 0x00 to * 0x3F. UFFDIO_API is the fixed number, everything else can be * changed by implementing a different UFFD_API. If sticking to the * same UFFD_API more ioctl can be added and userland will be aware of * which ioctl the running kernel implements through the ioctl command * bitmask written by the UFFDIO_API. */ #define _UFFDIO_REGISTER (0x00) #define _UFFDIO_UNREGISTER (0x01) #define _UFFDIO_WAKE (0x02) #define _UFFDIO_COPY (0x03) #define _UFFDIO_ZEROPAGE (0x04) #define _UFFDIO_API (0x3F) /* userfaultfd ioctl ids */ #define UFFDIO 0xAA #define UFFDIO_API _IOWR(UFFDIO, _UFFDIO_API, \ struct uffdio_api) #define UFFDIO_REGISTER _IOWR(UFFDIO, _UFFDIO_REGISTER, \ struct uffdio_register) #define UFFDIO_UNREGISTER _IOR(UFFDIO, _UFFDIO_UNREGISTER, \ struct uffdio_range) #define UFFDIO_WAKE _IOR(UFFDIO, _UFFDIO_WAKE, \ struct uffdio_range) #define UFFDIO_COPY _IOWR(UFFDIO, _UFFDIO_COPY, \ struct uffdio_copy) #define UFFDIO_ZEROPAGE _IOWR(UFFDIO, _UFFDIO_ZEROPAGE, \ struct uffdio_zeropage) /* read() structure */ struct uffd_msg { __u8 event; __u8 reserved1; __u16 reserved2; __u32 reserved3; union { struct { __u64 flags; __u64 address; union { __u32 ptid; } feat; } pagefault; struct { __u32 ufd; } fork; struct { __u64 from; __u64 to; __u64 len; } remap; struct { __u64 start; __u64 end; } remove; struct { /* unused reserved fields */ __u64 reserved1; __u64 reserved2; __u64 reserved3; } reserved; } arg; } __attribute__((packed)); /* * Start at 0x12 and not at 0 to be more strict against bugs. */ #define UFFD_EVENT_PAGEFAULT 0x12 #define UFFD_EVENT_FORK 0x13 #define UFFD_EVENT_REMAP 0x14 #define UFFD_EVENT_REMOVE 0x15 #define UFFD_EVENT_UNMAP 0x16 /* flags for UFFD_EVENT_PAGEFAULT */ #define UFFD_PAGEFAULT_FLAG_WRITE (1<<0) /* If this was a write fault */ #define UFFD_PAGEFAULT_FLAG_WP (1<<1) /* If reason is VM_UFFD_WP */ struct uffdio_api { /* userland asks for an API number and the features to enable */ __u64 api; /* * Kernel answers below with the all available features for * the API, this notifies userland of which events and/or * which flags for each event are enabled in the current * kernel. * * Note: UFFD_EVENT_PAGEFAULT and UFFD_PAGEFAULT_FLAG_WRITE * are to be considered implicitly always enabled in all kernels as * long as the uffdio_api.api requested matches UFFD_API. * * UFFD_FEATURE_MISSING_HUGETLBFS means an UFFDIO_REGISTER * with UFFDIO_REGISTER_MODE_MISSING mode will succeed on * hugetlbfs virtual memory ranges. Adding or not adding * UFFD_FEATURE_MISSING_HUGETLBFS to uffdio_api.features has * no real functional effect after UFFDIO_API returns, but * it's only useful for an initial feature set probe at * UFFDIO_API time. There are two ways to use it: * * 1) by adding UFFD_FEATURE_MISSING_HUGETLBFS to the * uffdio_api.features before calling UFFDIO_API, an error * will be returned by UFFDIO_API on a kernel without * hugetlbfs missing support * * 2) the UFFD_FEATURE_MISSING_HUGETLBFS can not be added in * uffdio_api.features and instead it will be set by the * kernel in the uffdio_api.features if the kernel supports * it, so userland can later check if the feature flag is * present in uffdio_api.features after UFFDIO_API * succeeded. * * UFFD_FEATURE_MISSING_SHMEM works the same as * UFFD_FEATURE_MISSING_HUGETLBFS, but it applies to shmem * (i.e. tmpfs and other shmem based APIs). * * UFFD_FEATURE_SIGBUS feature means no page-fault * (UFFD_EVENT_PAGEFAULT) event will be delivered, instead * a SIGBUS signal will be sent to the faulting process. * * UFFD_FEATURE_THREAD_ID pid of the page faulted task_struct will * be returned, if feature is not requested 0 will be returned. */ #define UFFD_FEATURE_PAGEFAULT_FLAG_WP (1<<0) #define UFFD_FEATURE_EVENT_FORK (1<<1) #define UFFD_FEATURE_EVENT_REMAP (1<<2) #define UFFD_FEATURE_EVENT_REMOVE (1<<3) #define UFFD_FEATURE_MISSING_HUGETLBFS (1<<4) #define UFFD_FEATURE_MISSING_SHMEM (1<<5) #define UFFD_FEATURE_EVENT_UNMAP (1<<6) #define UFFD_FEATURE_SIGBUS (1<<7) #define UFFD_FEATURE_THREAD_ID (1<<8) __u64 features; __u64 ioctls; }; struct uffdio_range { __u64 start; __u64 len; }; struct uffdio_register { struct uffdio_range range; #define UFFDIO_REGISTER_MODE_MISSING ((__u64)1<<0) #define UFFDIO_REGISTER_MODE_WP ((__u64)1<<1) __u64 mode; /* * kernel answers which ioctl commands are available for the * range, keep at the end as the last 8 bytes aren't read. */ __u64 ioctls; }; struct uffdio_copy { __u64 dst; __u64 src; __u64 len; /* * There will be a wrprotection flag later that allows to map * pages wrprotected on the fly. And such a flag will be * available if the wrprotection ioctl are implemented for the * range according to the uffdio_register.ioctls. */ #define UFFDIO_COPY_MODE_DONTWAKE ((__u64)1<<0) __u64 mode; /* * "copy" is written by the ioctl and must be at the end: the * copy_from_user will not read the last 8 bytes. */ __s64 copy; }; struct uffdio_zeropage { struct uffdio_range range; #define UFFDIO_ZEROPAGE_MODE_DONTWAKE ((__u64)1<<0) __u64 mode; /* * "zeropage" is written by the ioctl and must be at the end: * the copy_from_user will not read the last 8 bytes. */ __s64 zeropage; }; #endif /* _LINUX_USERFAULTFD_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/arcfb.h���������������������������������������������������������������������������������������0000644�����������������00000000325�14763166027�0007145 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_ARCFB_H__ #define __LINUX_ARCFB_H__ #define FBIO_WAITEVENT _IO('F', 0x88) #define FBIO_GETCONTROL2 _IOR('F', 0x89, size_t) #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/ipmi_msgdefs.h��������������������������������������������������������������������������������0000644�����������������00000006426�14763166027�0010546 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * ipmi_smi.h * * MontaVista IPMI system management interface * * Author: MontaVista Software, Inc. * Corey Minyard <minyard@mvista.com> * source@mvista.com * * Copyright 2002 MontaVista Software Inc. * */ #ifndef __LINUX_IPMI_MSGDEFS_H #define __LINUX_IPMI_MSGDEFS_H /* Various definitions for IPMI messages used by almost everything in the IPMI stack. */ /* NetFNs and commands used inside the IPMI stack. */ #define IPMI_NETFN_SENSOR_EVENT_REQUEST 0x04 #define IPMI_NETFN_SENSOR_EVENT_RESPONSE 0x05 #define IPMI_GET_EVENT_RECEIVER_CMD 0x01 #define IPMI_NETFN_APP_REQUEST 0x06 #define IPMI_NETFN_APP_RESPONSE 0x07 #define IPMI_GET_DEVICE_ID_CMD 0x01 #define IPMI_COLD_RESET_CMD 0x02 #define IPMI_WARM_RESET_CMD 0x03 #define IPMI_CLEAR_MSG_FLAGS_CMD 0x30 #define IPMI_GET_DEVICE_GUID_CMD 0x08 #define IPMI_GET_MSG_FLAGS_CMD 0x31 #define IPMI_SEND_MSG_CMD 0x34 #define IPMI_GET_MSG_CMD 0x33 #define IPMI_SET_BMC_GLOBAL_ENABLES_CMD 0x2e #define IPMI_GET_BMC_GLOBAL_ENABLES_CMD 0x2f #define IPMI_READ_EVENT_MSG_BUFFER_CMD 0x35 #define IPMI_GET_CHANNEL_INFO_CMD 0x42 /* Bit for BMC global enables. */ #define IPMI_BMC_RCV_MSG_INTR 0x01 #define IPMI_BMC_EVT_MSG_INTR 0x02 #define IPMI_BMC_EVT_MSG_BUFF 0x04 #define IPMI_BMC_SYS_LOG 0x08 #define IPMI_NETFN_STORAGE_REQUEST 0x0a #define IPMI_NETFN_STORAGE_RESPONSE 0x0b #define IPMI_ADD_SEL_ENTRY_CMD 0x44 #define IPMI_NETFN_FIRMWARE_REQUEST 0x08 #define IPMI_NETFN_FIRMWARE_RESPONSE 0x09 /* The default slave address */ #define IPMI_BMC_SLAVE_ADDR 0x20 /* The BT interface on high-end HP systems supports up to 255 bytes in * one transfer. Its "virtual" BMC supports some commands that are longer * than 128 bytes. Use the full 256, plus NetFn/LUN, Cmd, cCode, plus * some overhead; it's not worth the effort to dynamically size this based * on the results of the "Get BT Capabilities" command. */ #define IPMI_MAX_MSG_LENGTH 272 /* multiple of 16 */ #define IPMI_CC_NO_ERROR 0x00 #define IPMI_NODE_BUSY_ERR 0xc0 #define IPMI_INVALID_COMMAND_ERR 0xc1 #define IPMI_TIMEOUT_ERR 0xc3 #define IPMI_ERR_MSG_TRUNCATED 0xc6 #define IPMI_REQ_LEN_INVALID_ERR 0xc7 #define IPMI_REQ_LEN_EXCEEDED_ERR 0xc8 #define IPMI_NOT_IN_MY_STATE_ERR 0xd5 /* IPMI 2.0 */ #define IPMI_LOST_ARBITRATION_ERR 0x81 #define IPMI_BUS_ERR 0x82 #define IPMI_NAK_ON_WRITE_ERR 0x83 #define IPMI_ERR_UNSPECIFIED 0xff #define IPMI_CHANNEL_PROTOCOL_IPMB 1 #define IPMI_CHANNEL_PROTOCOL_ICMB 2 #define IPMI_CHANNEL_PROTOCOL_SMBUS 4 #define IPMI_CHANNEL_PROTOCOL_KCS 5 #define IPMI_CHANNEL_PROTOCOL_SMIC 6 #define IPMI_CHANNEL_PROTOCOL_BT10 7 #define IPMI_CHANNEL_PROTOCOL_BT15 8 #define IPMI_CHANNEL_PROTOCOL_TMODE 9 #define IPMI_CHANNEL_MEDIUM_IPMB 1 #define IPMI_CHANNEL_MEDIUM_ICMB10 2 #define IPMI_CHANNEL_MEDIUM_ICMB09 3 #define IPMI_CHANNEL_MEDIUM_8023LAN 4 #define IPMI_CHANNEL_MEDIUM_ASYNC 5 #define IPMI_CHANNEL_MEDIUM_OTHER_LAN 6 #define IPMI_CHANNEL_MEDIUM_PCI_SMBUS 7 #define IPMI_CHANNEL_MEDIUM_SMBUS1 8 #define IPMI_CHANNEL_MEDIUM_SMBUS2 9 #define IPMI_CHANNEL_MEDIUM_USB1 10 #define IPMI_CHANNEL_MEDIUM_USB2 11 #define IPMI_CHANNEL_MEDIUM_SYSINTF 12 #define IPMI_CHANNEL_MEDIUM_OEM_MIN 0x60 #define IPMI_CHANNEL_MEDIUM_OEM_MAX 0x7f #endif /* __LINUX_IPMI_MSGDEFS_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/vfio_ccw.h������������������������������������������������������������������������������������0000644�����������������00000000770�14763166027�0007673 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Interfaces for vfio-ccw * * Copyright IBM Corp. 2017 * * Author(s): Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com> */ #ifndef _VFIO_CCW_H_ #define _VFIO_CCW_H_ #include <linux/types.h> struct ccw_io_region { #define ORB_AREA_SIZE 12 __u8 orb_area[ORB_AREA_SIZE]; #define SCSW_AREA_SIZE 12 __u8 scsw_area[SCSW_AREA_SIZE]; #define IRB_AREA_SIZE 96 __u8 irb_area[IRB_AREA_SIZE]; __u32 ret_code; } __attribute__((packed)); #endif ��������linux/rtnetlink.h�����������������������������������������������������������������������������������0000644�����������������00000044574�14763166027�0010120 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_RTNETLINK_H #define __LINUX_RTNETLINK_H #include <linux/types.h> #include <linux/netlink.h> #include <linux/if_link.h> #include <linux/if_addr.h> #include <linux/neighbour.h> /* rtnetlink families. Values up to 127 are reserved for real address * families, values above 128 may be used arbitrarily. */ #define RTNL_FAMILY_IPMR 128 #define RTNL_FAMILY_IP6MR 129 #define RTNL_FAMILY_MAX 129 /**** * Routing/neighbour discovery messages. ****/ /* Types of messages */ enum { RTM_BASE = 16, #define RTM_BASE RTM_BASE RTM_NEWLINK = 16, #define RTM_NEWLINK RTM_NEWLINK RTM_DELLINK, #define RTM_DELLINK RTM_DELLINK RTM_GETLINK, #define RTM_GETLINK RTM_GETLINK RTM_SETLINK, #define RTM_SETLINK RTM_SETLINK RTM_NEWADDR = 20, #define RTM_NEWADDR RTM_NEWADDR RTM_DELADDR, #define RTM_DELADDR RTM_DELADDR RTM_GETADDR, #define RTM_GETADDR RTM_GETADDR RTM_NEWROUTE = 24, #define RTM_NEWROUTE RTM_NEWROUTE RTM_DELROUTE, #define RTM_DELROUTE RTM_DELROUTE RTM_GETROUTE, #define RTM_GETROUTE RTM_GETROUTE RTM_NEWNEIGH = 28, #define RTM_NEWNEIGH RTM_NEWNEIGH RTM_DELNEIGH, #define RTM_DELNEIGH RTM_DELNEIGH RTM_GETNEIGH, #define RTM_GETNEIGH RTM_GETNEIGH RTM_NEWRULE = 32, #define RTM_NEWRULE RTM_NEWRULE RTM_DELRULE, #define RTM_DELRULE RTM_DELRULE RTM_GETRULE, #define RTM_GETRULE RTM_GETRULE RTM_NEWQDISC = 36, #define RTM_NEWQDISC RTM_NEWQDISC RTM_DELQDISC, #define RTM_DELQDISC RTM_DELQDISC RTM_GETQDISC, #define RTM_GETQDISC RTM_GETQDISC RTM_NEWTCLASS = 40, #define RTM_NEWTCLASS RTM_NEWTCLASS RTM_DELTCLASS, #define RTM_DELTCLASS RTM_DELTCLASS RTM_GETTCLASS, #define RTM_GETTCLASS RTM_GETTCLASS RTM_NEWTFILTER = 44, #define RTM_NEWTFILTER RTM_NEWTFILTER RTM_DELTFILTER, #define RTM_DELTFILTER RTM_DELTFILTER RTM_GETTFILTER, #define RTM_GETTFILTER RTM_GETTFILTER RTM_NEWACTION = 48, #define RTM_NEWACTION RTM_NEWACTION RTM_DELACTION, #define RTM_DELACTION RTM_DELACTION RTM_GETACTION, #define RTM_GETACTION RTM_GETACTION RTM_NEWPREFIX = 52, #define RTM_NEWPREFIX RTM_NEWPREFIX RTM_GETMULTICAST = 58, #define RTM_GETMULTICAST RTM_GETMULTICAST RTM_GETANYCAST = 62, #define RTM_GETANYCAST RTM_GETANYCAST RTM_NEWNEIGHTBL = 64, #define RTM_NEWNEIGHTBL RTM_NEWNEIGHTBL RTM_GETNEIGHTBL = 66, #define RTM_GETNEIGHTBL RTM_GETNEIGHTBL RTM_SETNEIGHTBL, #define RTM_SETNEIGHTBL RTM_SETNEIGHTBL RTM_NEWNDUSEROPT = 68, #define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT RTM_NEWADDRLABEL = 72, #define RTM_NEWADDRLABEL RTM_NEWADDRLABEL RTM_DELADDRLABEL, #define RTM_DELADDRLABEL RTM_DELADDRLABEL RTM_GETADDRLABEL, #define RTM_GETADDRLABEL RTM_GETADDRLABEL RTM_GETDCB = 78, #define RTM_GETDCB RTM_GETDCB RTM_SETDCB, #define RTM_SETDCB RTM_SETDCB RTM_NEWNETCONF = 80, #define RTM_NEWNETCONF RTM_NEWNETCONF RTM_DELNETCONF, #define RTM_DELNETCONF RTM_DELNETCONF RTM_GETNETCONF = 82, #define RTM_GETNETCONF RTM_GETNETCONF RTM_NEWMDB = 84, #define RTM_NEWMDB RTM_NEWMDB RTM_DELMDB = 85, #define RTM_DELMDB RTM_DELMDB RTM_GETMDB = 86, #define RTM_GETMDB RTM_GETMDB RTM_NEWNSID = 88, #define RTM_NEWNSID RTM_NEWNSID RTM_DELNSID = 89, #define RTM_DELNSID RTM_DELNSID RTM_GETNSID = 90, #define RTM_GETNSID RTM_GETNSID RTM_NEWSTATS = 92, #define RTM_NEWSTATS RTM_NEWSTATS RTM_GETSTATS = 94, #define RTM_GETSTATS RTM_GETSTATS RTM_NEWCACHEREPORT = 96, #define RTM_NEWCACHEREPORT RTM_NEWCACHEREPORT RTM_NEWCHAIN = 100, #define RTM_NEWCHAIN RTM_NEWCHAIN RTM_DELCHAIN, #define RTM_DELCHAIN RTM_DELCHAIN RTM_GETCHAIN, #define RTM_GETCHAIN RTM_GETCHAIN __RTM_MAX, #define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) }; #define RTM_NR_MSGTYPES (RTM_MAX + 1 - RTM_BASE) #define RTM_NR_FAMILIES (RTM_NR_MSGTYPES >> 2) #define RTM_FAM(cmd) (((cmd) - RTM_BASE) >> 2) /* Generic structure for encapsulation of optional route information. It is reminiscent of sockaddr, but with sa_family replaced with attribute type. */ struct rtattr { unsigned short rta_len; unsigned short rta_type; }; /* Macros to handle rtattributes */ #define RTA_ALIGNTO 4U #define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) ) #define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \ (rta)->rta_len >= sizeof(struct rtattr) && \ (rta)->rta_len <= (len)) #define RTA_NEXT(rta,attrlen) ((attrlen) -= RTA_ALIGN((rta)->rta_len), \ (struct rtattr*)(((char*)(rta)) + RTA_ALIGN((rta)->rta_len))) #define RTA_LENGTH(len) (RTA_ALIGN(sizeof(struct rtattr)) + (len)) #define RTA_SPACE(len) RTA_ALIGN(RTA_LENGTH(len)) #define RTA_DATA(rta) ((void*)(((char*)(rta)) + RTA_LENGTH(0))) #define RTA_PAYLOAD(rta) ((int)((rta)->rta_len) - RTA_LENGTH(0)) /****************************************************************************** * Definitions used in routing table administration. ****/ struct rtmsg { unsigned char rtm_family; unsigned char rtm_dst_len; unsigned char rtm_src_len; unsigned char rtm_tos; unsigned char rtm_table; /* Routing table id */ unsigned char rtm_protocol; /* Routing protocol; see below */ unsigned char rtm_scope; /* See below */ unsigned char rtm_type; /* See below */ unsigned rtm_flags; }; /* rtm_type */ enum { RTN_UNSPEC, RTN_UNICAST, /* Gateway or direct route */ RTN_LOCAL, /* Accept locally */ RTN_BROADCAST, /* Accept locally as broadcast, send as broadcast */ RTN_ANYCAST, /* Accept locally as broadcast, but send as unicast */ RTN_MULTICAST, /* Multicast route */ RTN_BLACKHOLE, /* Drop */ RTN_UNREACHABLE, /* Destination is unreachable */ RTN_PROHIBIT, /* Administratively prohibited */ RTN_THROW, /* Not in this table */ RTN_NAT, /* Translate this address */ RTN_XRESOLVE, /* Use external resolver */ __RTN_MAX }; #define RTN_MAX (__RTN_MAX - 1) /* rtm_protocol */ #define RTPROT_UNSPEC 0 #define RTPROT_REDIRECT 1 /* Route installed by ICMP redirects; not used by current IPv4 */ #define RTPROT_KERNEL 2 /* Route installed by kernel */ #define RTPROT_BOOT 3 /* Route installed during boot */ #define RTPROT_STATIC 4 /* Route installed by administrator */ /* Values of protocol >= RTPROT_STATIC are not interpreted by kernel; they are just passed from user and back as is. It will be used by hypothetical multiple routing daemons. Note that protocol values should be standardized in order to avoid conflicts. */ #define RTPROT_GATED 8 /* Apparently, GateD */ #define RTPROT_RA 9 /* RDISC/ND router advertisements */ #define RTPROT_MRT 10 /* Merit MRT */ #define RTPROT_ZEBRA 11 /* Zebra */ #define RTPROT_BIRD 12 /* BIRD */ #define RTPROT_DNROUTED 13 /* DECnet routing daemon */ #define RTPROT_XORP 14 /* XORP */ #define RTPROT_NTK 15 /* Netsukuku */ #define RTPROT_DHCP 16 /* DHCP client */ #define RTPROT_MROUTED 17 /* Multicast daemon */ #define RTPROT_BABEL 42 /* Babel daemon */ #define RTPROT_BGP 186 /* BGP Routes */ #define RTPROT_ISIS 187 /* ISIS Routes */ #define RTPROT_OSPF 188 /* OSPF Routes */ #define RTPROT_RIP 189 /* RIP Routes */ #define RTPROT_EIGRP 192 /* EIGRP Routes */ /* rtm_scope Really it is not scope, but sort of distance to the destination. NOWHERE are reserved for not existing destinations, HOST is our local addresses, LINK are destinations, located on directly attached link and UNIVERSE is everywhere in the Universe. Intermediate values are also possible f.e. interior routes could be assigned a value between UNIVERSE and LINK. */ enum rt_scope_t { RT_SCOPE_UNIVERSE=0, /* User defined values */ RT_SCOPE_SITE=200, RT_SCOPE_LINK=253, RT_SCOPE_HOST=254, RT_SCOPE_NOWHERE=255 }; /* rtm_flags */ #define RTM_F_NOTIFY 0x100 /* Notify user of route change */ #define RTM_F_CLONED 0x200 /* This route is cloned */ #define RTM_F_EQUALIZE 0x400 /* Multipath equalizer: NI */ #define RTM_F_PREFIX 0x800 /* Prefix addresses */ #define RTM_F_LOOKUP_TABLE 0x1000 /* set rtm_table to FIB lookup result */ #define RTM_F_FIB_MATCH 0x2000 /* return full fib lookup match */ /* Reserved table identifiers */ enum rt_class_t { RT_TABLE_UNSPEC=0, /* User defined values */ RT_TABLE_COMPAT=252, RT_TABLE_DEFAULT=253, RT_TABLE_MAIN=254, RT_TABLE_LOCAL=255, RT_TABLE_MAX=0xFFFFFFFF }; /* Routing message attributes */ enum rtattr_type_t { RTA_UNSPEC, RTA_DST, RTA_SRC, RTA_IIF, RTA_OIF, RTA_GATEWAY, RTA_PRIORITY, RTA_PREFSRC, RTA_METRICS, RTA_MULTIPATH, RTA_PROTOINFO, /* no longer used */ RTA_FLOW, RTA_CACHEINFO, RTA_SESSION, /* no longer used */ RTA_MP_ALGO, /* no longer used */ RTA_TABLE, RTA_MARK, RTA_MFC_STATS, RTA_VIA, RTA_NEWDST, RTA_PREF, RTA_ENCAP_TYPE, RTA_ENCAP, RTA_EXPIRES, RTA_PAD, RTA_UID, RTA_TTL_PROPAGATE, RTA_IP_PROTO, RTA_SPORT, RTA_DPORT, __RTA_MAX }; #define RTA_MAX (__RTA_MAX - 1) #define RTM_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg)))) #define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg)) /* RTM_MULTIPATH --- array of struct rtnexthop. * * "struct rtnexthop" describes all necessary nexthop information, * i.e. parameters of path to a destination via this nexthop. * * At the moment it is impossible to set different prefsrc, mtu, window * and rtt for different paths from multipath. */ struct rtnexthop { unsigned short rtnh_len; unsigned char rtnh_flags; unsigned char rtnh_hops; int rtnh_ifindex; }; /* rtnh_flags */ #define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */ #define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */ #define RTNH_F_ONLINK 4 /* Gateway is forced on link */ #define RTNH_F_OFFLOAD 8 /* offloaded route */ #define RTNH_F_LINKDOWN 16 /* carrier-down on nexthop */ #define RTNH_F_UNRESOLVED 32 /* The entry is unresolved (ipmr) */ #define RTNH_COMPARE_MASK (RTNH_F_DEAD | RTNH_F_LINKDOWN | RTNH_F_OFFLOAD) /* Macros to handle hexthops */ #define RTNH_ALIGNTO 4 #define RTNH_ALIGN(len) ( ((len)+RTNH_ALIGNTO-1) & ~(RTNH_ALIGNTO-1) ) #define RTNH_OK(rtnh,len) ((rtnh)->rtnh_len >= sizeof(struct rtnexthop) && \ ((int)(rtnh)->rtnh_len) <= (len)) #define RTNH_NEXT(rtnh) ((struct rtnexthop*)(((char*)(rtnh)) + RTNH_ALIGN((rtnh)->rtnh_len))) #define RTNH_LENGTH(len) (RTNH_ALIGN(sizeof(struct rtnexthop)) + (len)) #define RTNH_SPACE(len) RTNH_ALIGN(RTNH_LENGTH(len)) #define RTNH_DATA(rtnh) ((struct rtattr*)(((char*)(rtnh)) + RTNH_LENGTH(0))) /* RTA_VIA */ struct rtvia { __kernel_sa_family_t rtvia_family; __u8 rtvia_addr[0]; }; /* RTM_CACHEINFO */ struct rta_cacheinfo { __u32 rta_clntref; __u32 rta_lastuse; __s32 rta_expires; __u32 rta_error; __u32 rta_used; #define RTNETLINK_HAVE_PEERINFO 1 __u32 rta_id; __u32 rta_ts; __u32 rta_tsage; }; /* RTM_METRICS --- array of struct rtattr with types of RTAX_* */ enum { RTAX_UNSPEC, #define RTAX_UNSPEC RTAX_UNSPEC RTAX_LOCK, #define RTAX_LOCK RTAX_LOCK RTAX_MTU, #define RTAX_MTU RTAX_MTU RTAX_WINDOW, #define RTAX_WINDOW RTAX_WINDOW RTAX_RTT, #define RTAX_RTT RTAX_RTT RTAX_RTTVAR, #define RTAX_RTTVAR RTAX_RTTVAR RTAX_SSTHRESH, #define RTAX_SSTHRESH RTAX_SSTHRESH RTAX_CWND, #define RTAX_CWND RTAX_CWND RTAX_ADVMSS, #define RTAX_ADVMSS RTAX_ADVMSS RTAX_REORDERING, #define RTAX_REORDERING RTAX_REORDERING RTAX_HOPLIMIT, #define RTAX_HOPLIMIT RTAX_HOPLIMIT RTAX_INITCWND, #define RTAX_INITCWND RTAX_INITCWND RTAX_FEATURES, #define RTAX_FEATURES RTAX_FEATURES RTAX_RTO_MIN, #define RTAX_RTO_MIN RTAX_RTO_MIN RTAX_INITRWND, #define RTAX_INITRWND RTAX_INITRWND RTAX_QUICKACK, #define RTAX_QUICKACK RTAX_QUICKACK RTAX_CC_ALGO, #define RTAX_CC_ALGO RTAX_CC_ALGO RTAX_FASTOPEN_NO_COOKIE, #define RTAX_FASTOPEN_NO_COOKIE RTAX_FASTOPEN_NO_COOKIE __RTAX_MAX }; #define RTAX_MAX (__RTAX_MAX - 1) #define RTAX_FEATURE_ECN (1 << 0) #define RTAX_FEATURE_SACK (1 << 1) #define RTAX_FEATURE_TIMESTAMP (1 << 2) #define RTAX_FEATURE_ALLFRAG (1 << 3) #define RTAX_FEATURE_MASK (RTAX_FEATURE_ECN | RTAX_FEATURE_SACK | \ RTAX_FEATURE_TIMESTAMP | RTAX_FEATURE_ALLFRAG) struct rta_session { __u8 proto; __u8 pad1; __u16 pad2; union { struct { __u16 sport; __u16 dport; } ports; struct { __u8 type; __u8 code; __u16 ident; } icmpt; __u32 spi; } u; }; struct rta_mfc_stats { __u64 mfcs_packets; __u64 mfcs_bytes; __u64 mfcs_wrong_if; }; /**** * General form of address family dependent message. ****/ struct rtgenmsg { unsigned char rtgen_family; }; /***************************************************************** * Link layer specific messages. ****/ /* struct ifinfomsg * passes link level specific information, not dependent * on network protocol. */ struct ifinfomsg { unsigned char ifi_family; unsigned char __ifi_pad; unsigned short ifi_type; /* ARPHRD_* */ int ifi_index; /* Link index */ unsigned ifi_flags; /* IFF_* flags */ unsigned ifi_change; /* IFF_* change mask */ }; /******************************************************************** * prefix information ****/ struct prefixmsg { unsigned char prefix_family; unsigned char prefix_pad1; unsigned short prefix_pad2; int prefix_ifindex; unsigned char prefix_type; unsigned char prefix_len; unsigned char prefix_flags; unsigned char prefix_pad3; }; enum { PREFIX_UNSPEC, PREFIX_ADDRESS, PREFIX_CACHEINFO, __PREFIX_MAX }; #define PREFIX_MAX (__PREFIX_MAX - 1) struct prefix_cacheinfo { __u32 preferred_time; __u32 valid_time; }; /***************************************************************** * Traffic control messages. ****/ struct tcmsg { unsigned char tcm_family; unsigned char tcm__pad1; unsigned short tcm__pad2; int tcm_ifindex; __u32 tcm_handle; __u32 tcm_parent; /* tcm_block_index is used instead of tcm_parent * in case tcm_ifindex == TCM_IFINDEX_MAGIC_BLOCK */ #define tcm_block_index tcm_parent __u32 tcm_info; }; /* For manipulation of filters in shared block, tcm_ifindex is set to * TCM_IFINDEX_MAGIC_BLOCK, and tcm_parent is aliased to tcm_block_index * which is the block index. */ #define TCM_IFINDEX_MAGIC_BLOCK (0xFFFFFFFFU) enum { TCA_UNSPEC, TCA_KIND, TCA_OPTIONS, TCA_STATS, TCA_XSTATS, TCA_RATE, TCA_FCNT, TCA_STATS2, TCA_STAB, TCA_PAD, TCA_DUMP_INVISIBLE, TCA_CHAIN, TCA_HW_OFFLOAD, TCA_INGRESS_BLOCK, TCA_EGRESS_BLOCK, __TCA_MAX }; #define TCA_MAX (__TCA_MAX - 1) #define TCA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg)))) #define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg)) /******************************************************************** * Neighbor Discovery userland options ****/ struct nduseroptmsg { unsigned char nduseropt_family; unsigned char nduseropt_pad1; unsigned short nduseropt_opts_len; /* Total length of options */ int nduseropt_ifindex; __u8 nduseropt_icmp_type; __u8 nduseropt_icmp_code; unsigned short nduseropt_pad2; unsigned int nduseropt_pad3; /* Followed by one or more ND options */ }; enum { NDUSEROPT_UNSPEC, NDUSEROPT_SRCADDR, __NDUSEROPT_MAX }; #define NDUSEROPT_MAX (__NDUSEROPT_MAX - 1) /* RTnetlink multicast groups - backwards compatibility for userspace */ #define RTMGRP_LINK 1 #define RTMGRP_NOTIFY 2 #define RTMGRP_NEIGH 4 #define RTMGRP_TC 8 #define RTMGRP_IPV4_IFADDR 0x10 #define RTMGRP_IPV4_MROUTE 0x20 #define RTMGRP_IPV4_ROUTE 0x40 #define RTMGRP_IPV4_RULE 0x80 #define RTMGRP_IPV6_IFADDR 0x100 #define RTMGRP_IPV6_MROUTE 0x200 #define RTMGRP_IPV6_ROUTE 0x400 #define RTMGRP_IPV6_IFINFO 0x800 #define RTMGRP_DECnet_IFADDR 0x1000 #define RTMGRP_DECnet_ROUTE 0x4000 #define RTMGRP_IPV6_PREFIX 0x20000 /* RTnetlink multicast groups */ enum rtnetlink_groups { RTNLGRP_NONE, #define RTNLGRP_NONE RTNLGRP_NONE RTNLGRP_LINK, #define RTNLGRP_LINK RTNLGRP_LINK RTNLGRP_NOTIFY, #define RTNLGRP_NOTIFY RTNLGRP_NOTIFY RTNLGRP_NEIGH, #define RTNLGRP_NEIGH RTNLGRP_NEIGH RTNLGRP_TC, #define RTNLGRP_TC RTNLGRP_TC RTNLGRP_IPV4_IFADDR, #define RTNLGRP_IPV4_IFADDR RTNLGRP_IPV4_IFADDR RTNLGRP_IPV4_MROUTE, #define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_ROUTE, #define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_RULE, #define RTNLGRP_IPV4_RULE RTNLGRP_IPV4_RULE RTNLGRP_IPV6_IFADDR, #define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_MROUTE, #define RTNLGRP_IPV6_MROUTE RTNLGRP_IPV6_MROUTE RTNLGRP_IPV6_ROUTE, #define RTNLGRP_IPV6_ROUTE RTNLGRP_IPV6_ROUTE RTNLGRP_IPV6_IFINFO, #define RTNLGRP_IPV6_IFINFO RTNLGRP_IPV6_IFINFO RTNLGRP_DECnet_IFADDR, #define RTNLGRP_DECnet_IFADDR RTNLGRP_DECnet_IFADDR RTNLGRP_NOP2, RTNLGRP_DECnet_ROUTE, #define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_RULE, #define RTNLGRP_DECnet_RULE RTNLGRP_DECnet_RULE RTNLGRP_NOP4, RTNLGRP_IPV6_PREFIX, #define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_RULE, #define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE RTNLGRP_ND_USEROPT, #define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT RTNLGRP_PHONET_IFADDR, #define RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_ROUTE, #define RTNLGRP_PHONET_ROUTE RTNLGRP_PHONET_ROUTE RTNLGRP_DCB, #define RTNLGRP_DCB RTNLGRP_DCB RTNLGRP_IPV4_NETCONF, #define RTNLGRP_IPV4_NETCONF RTNLGRP_IPV4_NETCONF RTNLGRP_IPV6_NETCONF, #define RTNLGRP_IPV6_NETCONF RTNLGRP_IPV6_NETCONF RTNLGRP_MDB, #define RTNLGRP_MDB RTNLGRP_MDB RTNLGRP_MPLS_ROUTE, #define RTNLGRP_MPLS_ROUTE RTNLGRP_MPLS_ROUTE RTNLGRP_NSID, #define RTNLGRP_NSID RTNLGRP_NSID RTNLGRP_MPLS_NETCONF, #define RTNLGRP_MPLS_NETCONF RTNLGRP_MPLS_NETCONF RTNLGRP_IPV4_MROUTE_R, #define RTNLGRP_IPV4_MROUTE_R RTNLGRP_IPV4_MROUTE_R RTNLGRP_IPV6_MROUTE_R, #define RTNLGRP_IPV6_MROUTE_R RTNLGRP_IPV6_MROUTE_R __RTNLGRP_MAX }; #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) /* TC action piece */ struct tcamsg { unsigned char tca_family; unsigned char tca__pad1; unsigned short tca__pad2; }; enum { TCA_ROOT_UNSPEC, TCA_ROOT_TAB, #define TCA_ACT_TAB TCA_ROOT_TAB #define TCAA_MAX TCA_ROOT_TAB TCA_ROOT_FLAGS, TCA_ROOT_COUNT, TCA_ROOT_TIME_DELTA, /* in msecs */ __TCA_ROOT_MAX, #define TCA_ROOT_MAX (__TCA_ROOT_MAX - 1) }; #define TA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcamsg)))) #define TA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcamsg)) /* tcamsg flags stored in attribute TCA_ROOT_FLAGS * * TCA_FLAG_LARGE_DUMP_ON user->kernel to request for larger than TCA_ACT_MAX_PRIO * actions in a dump. All dump responses will contain the number of actions * being dumped stored in for user app's consumption in TCA_ROOT_COUNT * */ #define TCA_FLAG_LARGE_DUMP_ON (1 << 0) /* New extended info filters for IFLA_EXT_MASK */ #define RTEXT_FILTER_VF (1 << 0) #define RTEXT_FILTER_BRVLAN (1 << 1) #define RTEXT_FILTER_BRVLAN_COMPRESSED (1 << 2) #define RTEXT_FILTER_SKIP_STATS (1 << 3) /* End of information exported to user level */ #endif /* __LINUX_RTNETLINK_H */ ������������������������������������������������������������������������������������������������������������������������������������linux/termios.h�������������������������������������������������������������������������������������0000644�����������������00000000772�14763166027�0007560 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_TERMIOS_H #define _LINUX_TERMIOS_H #include <linux/types.h> #include <asm/termios.h> #define NFF 5 struct termiox { __u16 x_hflag; __u16 x_cflag; __u16 x_rflag[NFF]; __u16 x_sflag; }; #define RTSXOFF 0x0001 /* RTS flow control on input */ #define CTSXON 0x0002 /* CTS flow control on output */ #define DTRXOFF 0x0004 /* DTR flow control on input */ #define DSRXON 0x0008 /* DCD flow control on output */ #endif ������linux/elfcore.h�������������������������������������������������������������������������������������0000644�����������������00000005663�14763166027�0007521 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_ELFCORE_H #define _LINUX_ELFCORE_H #include <linux/types.h> #include <linux/signal.h> #include <linux/time.h> #include <linux/ptrace.h> #include <linux/elf.h> #include <linux/fs.h> struct elf_siginfo { int si_signo; /* signal number */ int si_code; /* extra code */ int si_errno; /* errno */ }; typedef elf_greg_t greg_t; typedef elf_gregset_t gregset_t; typedef elf_fpregset_t fpregset_t; typedef elf_fpxregset_t fpxregset_t; #define NGREG ELF_NGREG /* * Definitions to generate Intel SVR4-like core files. * These mostly have the same names as the SVR4 types with "elf_" * tacked on the front to prevent clashes with linux definitions, * and the typedef forms have been avoided. This is mostly like * the SVR4 structure, but more Linuxy, with things that Linux does * not support and which gdb doesn't really use excluded. * Fields present but not used are marked with "XXX". */ struct elf_prstatus { #if 0 long pr_flags; /* XXX Process flags */ short pr_why; /* XXX Reason for process halt */ short pr_what; /* XXX More detailed reason */ #endif struct elf_siginfo pr_info; /* Info associated with signal */ short pr_cursig; /* Current signal */ unsigned long pr_sigpend; /* Set of pending signals */ unsigned long pr_sighold; /* Set of held signals */ #if 0 struct sigaltstack pr_altstack; /* Alternate stack info */ struct sigaction pr_action; /* Signal action for current sig */ #endif pid_t pr_pid; pid_t pr_ppid; pid_t pr_pgrp; pid_t pr_sid; struct timeval pr_utime; /* User time */ struct timeval pr_stime; /* System time */ struct timeval pr_cutime; /* Cumulative user time */ struct timeval pr_cstime; /* Cumulative system time */ #if 0 long pr_instr; /* Current instruction */ #endif elf_gregset_t pr_reg; /* GP registers */ #ifdef CONFIG_BINFMT_ELF_FDPIC /* When using FDPIC, the loadmap addresses need to be communicated * to GDB in order for GDB to do the necessary relocations. The * fields (below) used to communicate this information are placed * immediately after ``pr_reg'', so that the loadmap addresses may * be viewed as part of the register set if so desired. */ unsigned long pr_exec_fdpic_loadmap; unsigned long pr_interp_fdpic_loadmap; #endif int pr_fpvalid; /* True if math co-processor being used. */ }; #define ELF_PRARGSZ (80) /* Number of chars for args */ struct elf_prpsinfo { char pr_state; /* numeric process state */ char pr_sname; /* char for pr_state */ char pr_zomb; /* zombie */ char pr_nice; /* nice val */ unsigned long pr_flag; /* flags */ __kernel_uid_t pr_uid; __kernel_gid_t pr_gid; pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; /* Lots missing */ char pr_fname[16]; /* filename of executable */ char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ }; typedef struct elf_prstatus prstatus_t; typedef struct elf_prpsinfo prpsinfo_t; #define PRARGSZ ELF_PRARGSZ #endif /* _LINUX_ELFCORE_H */ �����������������������������������������������������������������������������linux/cuda.h����������������������������������������������������������������������������������������0000644�����������������00000001611�14763166027�0007003 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Definitions for talking to the CUDA. The CUDA is a microcontroller * which controls the ADB, system power, RTC, and various other things. * * Copyright (C) 1996 Paul Mackerras. */ #ifndef _LINUX_CUDA_H #define _LINUX_CUDA_H /* CUDA commands (2nd byte) */ #define CUDA_WARM_START 0 #define CUDA_AUTOPOLL 1 #define CUDA_GET_6805_ADDR 2 #define CUDA_GET_TIME 3 #define CUDA_GET_PRAM 7 #define CUDA_SET_6805_ADDR 8 #define CUDA_SET_TIME 9 #define CUDA_POWERDOWN 0xa #define CUDA_POWERUP_TIME 0xb #define CUDA_SET_PRAM 0xc #define CUDA_MS_RESET 0xd #define CUDA_SEND_DFAC 0xe #define CUDA_RESET_SYSTEM 0x11 #define CUDA_SET_IPL 0x12 #define CUDA_SET_AUTO_RATE 0x14 #define CUDA_GET_AUTO_RATE 0x16 #define CUDA_SET_DEVICE_LIST 0x19 #define CUDA_GET_DEVICE_LIST 0x1a #define CUDA_GET_SET_IIC 0x22 #endif /* _LINUX_CUDA_H */ �����������������������������������������������������������������������������������������������������������������������linux/seccomp.h�������������������������������������������������������������������������������������0000644�����������������00000004321�14763166027�0007521 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SECCOMP_H #define _LINUX_SECCOMP_H #include <linux/types.h> /* Valid values for seccomp.mode and prctl(PR_SET_SECCOMP, <mode>) */ #define SECCOMP_MODE_DISABLED 0 /* seccomp is not in use. */ #define SECCOMP_MODE_STRICT 1 /* uses hard-coded filter. */ #define SECCOMP_MODE_FILTER 2 /* uses user-supplied filter. */ /* Valid operations for seccomp syscall. */ #define SECCOMP_SET_MODE_STRICT 0 #define SECCOMP_SET_MODE_FILTER 1 #define SECCOMP_GET_ACTION_AVAIL 2 /* Valid flags for SECCOMP_SET_MODE_FILTER */ #define SECCOMP_FILTER_FLAG_TSYNC (1UL << 0) #define SECCOMP_FILTER_FLAG_LOG (1UL << 1) #define SECCOMP_FILTER_FLAG_SPEC_ALLOW (1UL << 2) /* * All BPF programs must return a 32-bit value. * The bottom 16-bits are for optional return data. * The upper 16-bits are ordered from least permissive values to most, * as a signed value (so 0x8000000 is negative). * * The ordering ensures that a min_t() over composed return values always * selects the least permissive choice. */ #define SECCOMP_RET_KILL_PROCESS 0x80000000U /* kill the process */ #define SECCOMP_RET_KILL_THREAD 0x00000000U /* kill the thread */ #define SECCOMP_RET_KILL SECCOMP_RET_KILL_THREAD #define SECCOMP_RET_TRAP 0x00030000U /* disallow and force a SIGSYS */ #define SECCOMP_RET_ERRNO 0x00050000U /* returns an errno */ #define SECCOMP_RET_TRACE 0x7ff00000U /* pass to a tracer or disallow */ #define SECCOMP_RET_LOG 0x7ffc0000U /* allow after logging */ #define SECCOMP_RET_ALLOW 0x7fff0000U /* allow */ /* Masks for the return value sections. */ #define SECCOMP_RET_ACTION_FULL 0xffff0000U #define SECCOMP_RET_ACTION 0x7fff0000U #define SECCOMP_RET_DATA 0x0000ffffU /** * struct seccomp_data - the format the BPF program executes over. * @nr: the system call number * @arch: indicates system call convention as an AUDIT_ARCH_* value * as defined in <linux/audit.h>. * @instruction_pointer: at the time of the system call. * @args: up to 6 system call arguments always stored as 64-bit values * regardless of the architecture. */ struct seccomp_data { int nr; __u32 arch; __u64 instruction_pointer; __u64 args[6]; }; #endif /* _LINUX_SECCOMP_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/btrfs.h���������������������������������������������������������������������������������������0000644�����������������00000070454�14763166027�0007222 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2007 Oracle. 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 v2 as published by the Free Software Foundation. * * 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., 59 Temple Place - Suite 330, * Boston, MA 021110-1307, USA. */ #ifndef _LINUX_BTRFS_H #define _LINUX_BTRFS_H #include <linux/types.h> #include <linux/ioctl.h> #define BTRFS_IOCTL_MAGIC 0x94 #define BTRFS_VOL_NAME_MAX 255 #define BTRFS_LABEL_SIZE 256 /* this should be 4k */ #define BTRFS_PATH_NAME_MAX 4087 struct btrfs_ioctl_vol_args { __s64 fd; char name[BTRFS_PATH_NAME_MAX + 1]; }; #define BTRFS_DEVICE_PATH_NAME_MAX 1024 #define BTRFS_SUBVOL_NAME_MAX 4039 #define BTRFS_SUBVOL_CREATE_ASYNC (1ULL << 0) #define BTRFS_SUBVOL_RDONLY (1ULL << 1) #define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2) #define BTRFS_DEVICE_SPEC_BY_ID (1ULL << 3) #define BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED \ (BTRFS_SUBVOL_CREATE_ASYNC | \ BTRFS_SUBVOL_RDONLY | \ BTRFS_SUBVOL_QGROUP_INHERIT | \ BTRFS_DEVICE_SPEC_BY_ID) #define BTRFS_FSID_SIZE 16 #define BTRFS_UUID_SIZE 16 #define BTRFS_UUID_UNPARSED_SIZE 37 /* * flags definition for qgroup limits * * Used by: * struct btrfs_qgroup_limit.flags * struct btrfs_qgroup_limit_item.flags */ #define BTRFS_QGROUP_LIMIT_MAX_RFER (1ULL << 0) #define BTRFS_QGROUP_LIMIT_MAX_EXCL (1ULL << 1) #define BTRFS_QGROUP_LIMIT_RSV_RFER (1ULL << 2) #define BTRFS_QGROUP_LIMIT_RSV_EXCL (1ULL << 3) #define BTRFS_QGROUP_LIMIT_RFER_CMPR (1ULL << 4) #define BTRFS_QGROUP_LIMIT_EXCL_CMPR (1ULL << 5) struct btrfs_qgroup_limit { __u64 flags; __u64 max_rfer; __u64 max_excl; __u64 rsv_rfer; __u64 rsv_excl; }; /* * flags definition for qgroup inheritance * * Used by: * struct btrfs_qgroup_inherit.flags */ #define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0) struct btrfs_qgroup_inherit { __u64 flags; __u64 num_qgroups; __u64 num_ref_copies; __u64 num_excl_copies; struct btrfs_qgroup_limit lim; __u64 qgroups[0]; }; struct btrfs_ioctl_qgroup_limit_args { __u64 qgroupid; struct btrfs_qgroup_limit lim; }; /* * flags for subvolumes * * Used by: * struct btrfs_ioctl_vol_args_v2.flags * * BTRFS_SUBVOL_RDONLY is also provided/consumed by the following ioctls: * - BTRFS_IOC_SUBVOL_GETFLAGS * - BTRFS_IOC_SUBVOL_SETFLAGS */ struct btrfs_ioctl_vol_args_v2 { __s64 fd; __u64 transid; __u64 flags; union { struct { __u64 size; struct btrfs_qgroup_inherit *qgroup_inherit; }; __u64 unused[4]; }; union { char name[BTRFS_SUBVOL_NAME_MAX + 1]; __u64 devid; }; }; /* * structure to report errors and progress to userspace, either as a * result of a finished scrub, a canceled scrub or a progress inquiry */ struct btrfs_scrub_progress { __u64 data_extents_scrubbed; /* # of data extents scrubbed */ __u64 tree_extents_scrubbed; /* # of tree extents scrubbed */ __u64 data_bytes_scrubbed; /* # of data bytes scrubbed */ __u64 tree_bytes_scrubbed; /* # of tree bytes scrubbed */ __u64 read_errors; /* # of read errors encountered (EIO) */ __u64 csum_errors; /* # of failed csum checks */ __u64 verify_errors; /* # of occurences, where the metadata * of a tree block did not match the * expected values, like generation or * logical */ __u64 no_csum; /* # of 4k data block for which no csum * is present, probably the result of * data written with nodatasum */ __u64 csum_discards; /* # of csum for which no data was found * in the extent tree. */ __u64 super_errors; /* # of bad super blocks encountered */ __u64 malloc_errors; /* # of internal kmalloc errors. These * will likely cause an incomplete * scrub */ __u64 uncorrectable_errors; /* # of errors where either no intact * copy was found or the writeback * failed */ __u64 corrected_errors; /* # of errors corrected */ __u64 last_physical; /* last physical address scrubbed. In * case a scrub was aborted, this can * be used to restart the scrub */ __u64 unverified_errors; /* # of occurences where a read for a * full (64k) bio failed, but the re- * check succeeded for each 4k piece. * Intermittent error. */ }; #define BTRFS_SCRUB_READONLY 1 #define BTRFS_SCRUB_SUPPORTED_FLAGS (BTRFS_SCRUB_READONLY) struct btrfs_ioctl_scrub_args { __u64 devid; /* in */ __u64 start; /* in */ __u64 end; /* in */ __u64 flags; /* in */ struct btrfs_scrub_progress progress; /* out */ /* pad to 1k */ __u64 unused[(1024-32-sizeof(struct btrfs_scrub_progress))/8]; }; #define BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_ALWAYS 0 #define BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID 1 struct btrfs_ioctl_dev_replace_start_params { __u64 srcdevid; /* in, if 0, use srcdev_name instead */ __u64 cont_reading_from_srcdev_mode; /* in, see #define * above */ __u8 srcdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1]; /* in */ __u8 tgtdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1]; /* in */ }; #define BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED 0 #define BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED 1 #define BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED 2 #define BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED 3 #define BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED 4 struct btrfs_ioctl_dev_replace_status_params { __u64 replace_state; /* out, see #define above */ __u64 progress_1000; /* out, 0 <= x <= 1000 */ __u64 time_started; /* out, seconds since 1-Jan-1970 */ __u64 time_stopped; /* out, seconds since 1-Jan-1970 */ __u64 num_write_errors; /* out */ __u64 num_uncorrectable_read_errors; /* out */ }; #define BTRFS_IOCTL_DEV_REPLACE_CMD_START 0 #define BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS 1 #define BTRFS_IOCTL_DEV_REPLACE_CMD_CANCEL 2 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR 0 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED 1 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED 2 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_SCRUB_INPROGRESS 3 struct btrfs_ioctl_dev_replace_args { __u64 cmd; /* in */ __u64 result; /* out */ union { struct btrfs_ioctl_dev_replace_start_params start; struct btrfs_ioctl_dev_replace_status_params status; }; /* in/out */ __u64 spare[64]; }; struct btrfs_ioctl_dev_info_args { __u64 devid; /* in/out */ __u8 uuid[BTRFS_UUID_SIZE]; /* in/out */ __u64 bytes_used; /* out */ __u64 total_bytes; /* out */ __u64 unused[379]; /* pad to 4k */ __u8 path[BTRFS_DEVICE_PATH_NAME_MAX]; /* out */ }; struct btrfs_ioctl_fs_info_args { __u64 max_id; /* out */ __u64 num_devices; /* out */ __u8 fsid[BTRFS_FSID_SIZE]; /* out */ __u32 nodesize; /* out */ __u32 sectorsize; /* out */ __u32 clone_alignment; /* out */ __u32 reserved32; __u64 reserved[122]; /* pad to 1k */ }; /* * feature flags * * Used by: * struct btrfs_ioctl_feature_flags */ #define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE (1ULL << 0) /* * Older kernels (< 4.9) on big-endian systems produced broken free space tree * bitmaps, and btrfs-progs also used to corrupt the free space tree (versions * < 4.7.3). If this bit is clear, then the free space tree cannot be trusted. * btrfs-progs can also intentionally clear this bit to ask the kernel to * rebuild the free space tree, however this might not work on older kernels * that do not know about this bit. If not sure, clear the cache manually on * first mount when booting older kernel versions. */ #define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID (1ULL << 1) #define BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF (1ULL << 0) #define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL (1ULL << 1) #define BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS (1ULL << 2) #define BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO (1ULL << 3) #define BTRFS_FEATURE_INCOMPAT_COMPRESS_ZSTD (1ULL << 4) /* * older kernels tried to do bigger metadata blocks, but the * code was pretty buggy. Lets not let them try anymore. */ #define BTRFS_FEATURE_INCOMPAT_BIG_METADATA (1ULL << 5) #define BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF (1ULL << 6) #define BTRFS_FEATURE_INCOMPAT_RAID56 (1ULL << 7) #define BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA (1ULL << 8) #define BTRFS_FEATURE_INCOMPAT_NO_HOLES (1ULL << 9) struct btrfs_ioctl_feature_flags { __u64 compat_flags; __u64 compat_ro_flags; __u64 incompat_flags; }; /* balance control ioctl modes */ #define BTRFS_BALANCE_CTL_PAUSE 1 #define BTRFS_BALANCE_CTL_CANCEL 2 /* * this is packed, because it should be exactly the same as its disk * byte order counterpart (struct btrfs_disk_balance_args) */ struct btrfs_balance_args { __u64 profiles; union { __u64 usage; struct { __u32 usage_min; __u32 usage_max; }; }; __u64 devid; __u64 pstart; __u64 pend; __u64 vstart; __u64 vend; __u64 target; __u64 flags; /* * BTRFS_BALANCE_ARGS_LIMIT with value 'limit' * BTRFS_BALANCE_ARGS_LIMIT_RANGE - the extend version can use minimum * and maximum */ union { __u64 limit; /* limit number of processed chunks */ struct { __u32 limit_min; __u32 limit_max; }; }; /* * Process chunks that cross stripes_min..stripes_max devices, * BTRFS_BALANCE_ARGS_STRIPES_RANGE */ __u32 stripes_min; __u32 stripes_max; __u64 unused[6]; } __attribute__ ((__packed__)); /* report balance progress to userspace */ struct btrfs_balance_progress { __u64 expected; /* estimated # of chunks that will be * relocated to fulfill the request */ __u64 considered; /* # of chunks we have considered so far */ __u64 completed; /* # of chunks relocated so far */ }; /* * flags definition for balance * * Restriper's general type filter * * Used by: * btrfs_ioctl_balance_args.flags * btrfs_balance_control.flags (internal) */ #define BTRFS_BALANCE_DATA (1ULL << 0) #define BTRFS_BALANCE_SYSTEM (1ULL << 1) #define BTRFS_BALANCE_METADATA (1ULL << 2) #define BTRFS_BALANCE_TYPE_MASK (BTRFS_BALANCE_DATA | \ BTRFS_BALANCE_SYSTEM | \ BTRFS_BALANCE_METADATA) #define BTRFS_BALANCE_FORCE (1ULL << 3) #define BTRFS_BALANCE_RESUME (1ULL << 4) /* * flags definitions for per-type balance args * * Balance filters * * Used by: * struct btrfs_balance_args */ #define BTRFS_BALANCE_ARGS_PROFILES (1ULL << 0) #define BTRFS_BALANCE_ARGS_USAGE (1ULL << 1) #define BTRFS_BALANCE_ARGS_DEVID (1ULL << 2) #define BTRFS_BALANCE_ARGS_DRANGE (1ULL << 3) #define BTRFS_BALANCE_ARGS_VRANGE (1ULL << 4) #define BTRFS_BALANCE_ARGS_LIMIT (1ULL << 5) #define BTRFS_BALANCE_ARGS_LIMIT_RANGE (1ULL << 6) #define BTRFS_BALANCE_ARGS_STRIPES_RANGE (1ULL << 7) #define BTRFS_BALANCE_ARGS_USAGE_RANGE (1ULL << 10) #define BTRFS_BALANCE_ARGS_MASK \ (BTRFS_BALANCE_ARGS_PROFILES | \ BTRFS_BALANCE_ARGS_USAGE | \ BTRFS_BALANCE_ARGS_DEVID | \ BTRFS_BALANCE_ARGS_DRANGE | \ BTRFS_BALANCE_ARGS_VRANGE | \ BTRFS_BALANCE_ARGS_LIMIT | \ BTRFS_BALANCE_ARGS_LIMIT_RANGE | \ BTRFS_BALANCE_ARGS_STRIPES_RANGE | \ BTRFS_BALANCE_ARGS_USAGE_RANGE) /* * Profile changing flags. When SOFT is set we won't relocate chunk if * it already has the target profile (even though it may be * half-filled). */ #define BTRFS_BALANCE_ARGS_CONVERT (1ULL << 8) #define BTRFS_BALANCE_ARGS_SOFT (1ULL << 9) /* * flags definition for balance state * * Used by: * struct btrfs_ioctl_balance_args.state */ #define BTRFS_BALANCE_STATE_RUNNING (1ULL << 0) #define BTRFS_BALANCE_STATE_PAUSE_REQ (1ULL << 1) #define BTRFS_BALANCE_STATE_CANCEL_REQ (1ULL << 2) struct btrfs_ioctl_balance_args { __u64 flags; /* in/out */ __u64 state; /* out */ struct btrfs_balance_args data; /* in/out */ struct btrfs_balance_args meta; /* in/out */ struct btrfs_balance_args sys; /* in/out */ struct btrfs_balance_progress stat; /* out */ __u64 unused[72]; /* pad to 1k */ }; #define BTRFS_INO_LOOKUP_PATH_MAX 4080 struct btrfs_ioctl_ino_lookup_args { __u64 treeid; __u64 objectid; char name[BTRFS_INO_LOOKUP_PATH_MAX]; }; #define BTRFS_INO_LOOKUP_USER_PATH_MAX (4080 - BTRFS_VOL_NAME_MAX - 1) struct btrfs_ioctl_ino_lookup_user_args { /* in, inode number containing the subvolume of 'subvolid' */ __u64 dirid; /* in */ __u64 treeid; /* out, name of the subvolume of 'treeid' */ char name[BTRFS_VOL_NAME_MAX + 1]; /* * out, constructed path from the directory with which the ioctl is * called to dirid */ char path[BTRFS_INO_LOOKUP_USER_PATH_MAX]; }; /* Search criteria for the btrfs SEARCH ioctl family. */ struct btrfs_ioctl_search_key { /* * The tree we're searching in. 1 is the tree of tree roots, 2 is the * extent tree, etc... * * A special tree_id value of 0 will cause a search in the subvolume * tree that the inode which is passed to the ioctl is part of. */ __u64 tree_id; /* in */ /* * When doing a tree search, we're actually taking a slice from a * linear search space of 136-bit keys. * * A full 136-bit tree key is composed as: * (objectid << 72) + (type << 64) + offset * * The individual min and max values for objectid, type and offset * define the min_key and max_key values for the search range. All * metadata items with a key in the interval [min_key, max_key] will be * returned. * * Additionally, we can filter the items returned on transaction id of * the metadata block they're stored in by specifying a transid range. * Be aware that this transaction id only denotes when the metadata * page that currently contains the item got written the last time as * result of a COW operation. The number does not have any meaning * related to the transaction in which an individual item that is being * returned was created or changed. */ __u64 min_objectid; /* in */ __u64 max_objectid; /* in */ __u64 min_offset; /* in */ __u64 max_offset; /* in */ __u64 min_transid; /* in */ __u64 max_transid; /* in */ __u32 min_type; /* in */ __u32 max_type; /* in */ /* * input: The maximum amount of results desired. * output: The actual amount of items returned, restricted by any of: * - reaching the upper bound of the search range * - reaching the input nr_items amount of items * - completely filling the supplied memory buffer */ __u32 nr_items; /* in/out */ /* align to 64 bits */ __u32 unused; /* some extra for later */ __u64 unused1; __u64 unused2; __u64 unused3; __u64 unused4; }; struct btrfs_ioctl_search_header { __u64 transid; __u64 objectid; __u64 offset; __u32 type; __u32 len; }; #define BTRFS_SEARCH_ARGS_BUFSIZE (4096 - sizeof(struct btrfs_ioctl_search_key)) /* * the buf is an array of search headers where * each header is followed by the actual item * the type field is expanded to 32 bits for alignment */ struct btrfs_ioctl_search_args { struct btrfs_ioctl_search_key key; char buf[BTRFS_SEARCH_ARGS_BUFSIZE]; }; struct btrfs_ioctl_search_args_v2 { struct btrfs_ioctl_search_key key; /* in/out - search parameters */ __u64 buf_size; /* in - size of buffer * out - on EOVERFLOW: needed size * to store item */ __u64 buf[0]; /* out - found items */ }; struct btrfs_ioctl_clone_range_args { __s64 src_fd; __u64 src_offset, src_length; __u64 dest_offset; }; /* * flags definition for the defrag range ioctl * * Used by: * struct btrfs_ioctl_defrag_range_args.flags */ #define BTRFS_DEFRAG_RANGE_COMPRESS 1 #define BTRFS_DEFRAG_RANGE_START_IO 2 struct btrfs_ioctl_defrag_range_args { /* start of the defrag operation */ __u64 start; /* number of bytes to defrag, use (u64)-1 to say all */ __u64 len; /* * flags for the operation, which can include turning * on compression for this one defrag */ __u64 flags; /* * any extent bigger than this will be considered * already defragged. Use 0 to take the kernel default * Use 1 to say every single extent must be rewritten */ __u32 extent_thresh; /* * which compression method to use if turning on compression * for this defrag operation. If unspecified, zlib will * be used */ __u32 compress_type; /* spare for later */ __u32 unused[4]; }; #define BTRFS_SAME_DATA_DIFFERS 1 /* For extent-same ioctl */ struct btrfs_ioctl_same_extent_info { __s64 fd; /* in - destination file */ __u64 logical_offset; /* in - start of extent in destination */ __u64 bytes_deduped; /* out - total # of bytes we were able * to dedupe from this file */ /* status of this dedupe operation: * 0 if dedup succeeds * < 0 for error * == BTRFS_SAME_DATA_DIFFERS if data differs */ __s32 status; /* out - see above description */ __u32 reserved; }; struct btrfs_ioctl_same_args { __u64 logical_offset; /* in - start of extent in source */ __u64 length; /* in - length of extent */ __u16 dest_count; /* in - total elements in info array */ __u16 reserved1; __u32 reserved2; struct btrfs_ioctl_same_extent_info info[0]; }; struct btrfs_ioctl_space_info { __u64 flags; __u64 total_bytes; __u64 used_bytes; }; struct btrfs_ioctl_space_args { __u64 space_slots; __u64 total_spaces; struct btrfs_ioctl_space_info spaces[0]; }; struct btrfs_data_container { __u32 bytes_left; /* out -- bytes not needed to deliver output */ __u32 bytes_missing; /* out -- additional bytes needed for result */ __u32 elem_cnt; /* out */ __u32 elem_missed; /* out */ __u64 val[0]; /* out */ }; struct btrfs_ioctl_ino_path_args { __u64 inum; /* in */ __u64 size; /* in */ __u64 reserved[4]; /* struct btrfs_data_container *fspath; out */ __u64 fspath; /* out */ }; struct btrfs_ioctl_logical_ino_args { __u64 logical; /* in */ __u64 size; /* in */ __u64 reserved[3]; /* must be 0 for now */ __u64 flags; /* in, v2 only */ /* struct btrfs_data_container *inodes; out */ __u64 inodes; }; /* Return every ref to the extent, not just those containing logical block. * Requires logical == extent bytenr. */ #define BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET (1ULL << 0) enum btrfs_dev_stat_values { /* disk I/O failure stats */ BTRFS_DEV_STAT_WRITE_ERRS, /* EIO or EREMOTEIO from lower layers */ BTRFS_DEV_STAT_READ_ERRS, /* EIO or EREMOTEIO from lower layers */ BTRFS_DEV_STAT_FLUSH_ERRS, /* EIO or EREMOTEIO from lower layers */ /* stats for indirect indications for I/O failures */ BTRFS_DEV_STAT_CORRUPTION_ERRS, /* checksum error, bytenr error or * contents is illegal: this is an * indication that the block was damaged * during read or write, or written to * wrong location or read from wrong * location */ BTRFS_DEV_STAT_GENERATION_ERRS, /* an indication that blocks have not * been written */ BTRFS_DEV_STAT_VALUES_MAX }; /* Reset statistics after reading; needs SYS_ADMIN capability */ #define BTRFS_DEV_STATS_RESET (1ULL << 0) struct btrfs_ioctl_get_dev_stats { __u64 devid; /* in */ __u64 nr_items; /* in/out */ __u64 flags; /* in/out */ /* out values: */ __u64 values[BTRFS_DEV_STAT_VALUES_MAX]; __u64 unused[128 - 2 - BTRFS_DEV_STAT_VALUES_MAX]; /* pad to 1k */ }; #define BTRFS_QUOTA_CTL_ENABLE 1 #define BTRFS_QUOTA_CTL_DISABLE 2 #define BTRFS_QUOTA_CTL_RESCAN__NOTUSED 3 struct btrfs_ioctl_quota_ctl_args { __u64 cmd; __u64 status; }; struct btrfs_ioctl_quota_rescan_args { __u64 flags; __u64 progress; __u64 reserved[6]; }; struct btrfs_ioctl_qgroup_assign_args { __u64 assign; __u64 src; __u64 dst; }; struct btrfs_ioctl_qgroup_create_args { __u64 create; __u64 qgroupid; }; struct btrfs_ioctl_timespec { __u64 sec; __u32 nsec; }; struct btrfs_ioctl_received_subvol_args { char uuid[BTRFS_UUID_SIZE]; /* in */ __u64 stransid; /* in */ __u64 rtransid; /* out */ struct btrfs_ioctl_timespec stime; /* in */ struct btrfs_ioctl_timespec rtime; /* out */ __u64 flags; /* in */ __u64 reserved[16]; /* in */ }; /* * Caller doesn't want file data in the send stream, even if the * search of clone sources doesn't find an extent. UPDATE_EXTENT * commands will be sent instead of WRITE commands. */ #define BTRFS_SEND_FLAG_NO_FILE_DATA 0x1 /* * Do not add the leading stream header. Used when multiple snapshots * are sent back to back. */ #define BTRFS_SEND_FLAG_OMIT_STREAM_HEADER 0x2 /* * Omit the command at the end of the stream that indicated the end * of the stream. This option is used when multiple snapshots are * sent back to back. */ #define BTRFS_SEND_FLAG_OMIT_END_CMD 0x4 #define BTRFS_SEND_FLAG_MASK \ (BTRFS_SEND_FLAG_NO_FILE_DATA | \ BTRFS_SEND_FLAG_OMIT_STREAM_HEADER | \ BTRFS_SEND_FLAG_OMIT_END_CMD) struct btrfs_ioctl_send_args { __s64 send_fd; /* in */ __u64 clone_sources_count; /* in */ __u64 *clone_sources; /* in */ __u64 parent_root; /* in */ __u64 flags; /* in */ __u64 reserved[4]; /* in */ }; /* * Information about a fs tree root. * * All items are filled by the ioctl */ struct btrfs_ioctl_get_subvol_info_args { /* Id of this subvolume */ __u64 treeid; /* Name of this subvolume, used to get the real name at mount point */ char name[BTRFS_VOL_NAME_MAX + 1]; /* * Id of the subvolume which contains this subvolume. * Zero for top-level subvolume or a deleted subvolume. */ __u64 parent_id; /* * Inode number of the directory which contains this subvolume. * Zero for top-level subvolume or a deleted subvolume */ __u64 dirid; /* Latest transaction id of this subvolume */ __u64 generation; /* Flags of this subvolume */ __u64 flags; /* UUID of this subvolume */ __u8 uuid[BTRFS_UUID_SIZE]; /* * UUID of the subvolume of which this subvolume is a snapshot. * All zero for a non-snapshot subvolume. */ __u8 parent_uuid[BTRFS_UUID_SIZE]; /* * UUID of the subvolume from which this subvolume was received. * All zero for non-received subvolume. */ __u8 received_uuid[BTRFS_UUID_SIZE]; /* Transaction id indicating when change/create/send/receive happened */ __u64 ctransid; __u64 otransid; __u64 stransid; __u64 rtransid; /* Time corresponding to c/o/s/rtransid */ struct btrfs_ioctl_timespec ctime; struct btrfs_ioctl_timespec otime; struct btrfs_ioctl_timespec stime; struct btrfs_ioctl_timespec rtime; /* Must be zero */ __u64 reserved[8]; }; #define BTRFS_MAX_ROOTREF_BUFFER_NUM 255 struct btrfs_ioctl_get_subvol_rootref_args { /* in/out, minimum id of rootref's treeid to be searched */ __u64 min_treeid; /* out */ struct { __u64 treeid; __u64 dirid; } rootref[BTRFS_MAX_ROOTREF_BUFFER_NUM]; /* out, number of found items */ __u8 num_items; __u8 align[7]; }; /* Error codes as returned by the kernel */ enum btrfs_err_code { BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET = 1, BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET, BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET, BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET, BTRFS_ERROR_DEV_TGT_REPLACE, BTRFS_ERROR_DEV_MISSING_NOT_FOUND, BTRFS_ERROR_DEV_ONLY_WRITABLE, BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS }; #define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_RESIZE _IOW(BTRFS_IOCTL_MAGIC, 3, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_SCAN_DEV _IOW(BTRFS_IOCTL_MAGIC, 4, \ struct btrfs_ioctl_vol_args) /* trans start and trans end are dangerous, and only for * use by applications that know how to avoid the * resulting deadlocks */ #define BTRFS_IOC_TRANS_START _IO(BTRFS_IOCTL_MAGIC, 6) #define BTRFS_IOC_TRANS_END _IO(BTRFS_IOCTL_MAGIC, 7) #define BTRFS_IOC_SYNC _IO(BTRFS_IOCTL_MAGIC, 8) #define BTRFS_IOC_CLONE _IOW(BTRFS_IOCTL_MAGIC, 9, int) #define BTRFS_IOC_ADD_DEV _IOW(BTRFS_IOCTL_MAGIC, 10, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_RM_DEV _IOW(BTRFS_IOCTL_MAGIC, 11, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_BALANCE _IOW(BTRFS_IOCTL_MAGIC, 12, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, \ struct btrfs_ioctl_clone_range_args) #define BTRFS_IOC_SUBVOL_CREATE _IOW(BTRFS_IOCTL_MAGIC, 14, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_DEFRAG_RANGE _IOW(BTRFS_IOCTL_MAGIC, 16, \ struct btrfs_ioctl_defrag_range_args) #define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, \ struct btrfs_ioctl_search_args) #define BTRFS_IOC_TREE_SEARCH_V2 _IOWR(BTRFS_IOCTL_MAGIC, 17, \ struct btrfs_ioctl_search_args_v2) #define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \ struct btrfs_ioctl_ino_lookup_args) #define BTRFS_IOC_DEFAULT_SUBVOL _IOW(BTRFS_IOCTL_MAGIC, 19, __u64) #define BTRFS_IOC_SPACE_INFO _IOWR(BTRFS_IOCTL_MAGIC, 20, \ struct btrfs_ioctl_space_args) #define BTRFS_IOC_START_SYNC _IOR(BTRFS_IOCTL_MAGIC, 24, __u64) #define BTRFS_IOC_WAIT_SYNC _IOW(BTRFS_IOCTL_MAGIC, 22, __u64) #define BTRFS_IOC_SNAP_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 23, \ struct btrfs_ioctl_vol_args_v2) #define BTRFS_IOC_SUBVOL_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 24, \ struct btrfs_ioctl_vol_args_v2) #define BTRFS_IOC_SUBVOL_GETFLAGS _IOR(BTRFS_IOCTL_MAGIC, 25, __u64) #define BTRFS_IOC_SUBVOL_SETFLAGS _IOW(BTRFS_IOCTL_MAGIC, 26, __u64) #define BTRFS_IOC_SCRUB _IOWR(BTRFS_IOCTL_MAGIC, 27, \ struct btrfs_ioctl_scrub_args) #define BTRFS_IOC_SCRUB_CANCEL _IO(BTRFS_IOCTL_MAGIC, 28) #define BTRFS_IOC_SCRUB_PROGRESS _IOWR(BTRFS_IOCTL_MAGIC, 29, \ struct btrfs_ioctl_scrub_args) #define BTRFS_IOC_DEV_INFO _IOWR(BTRFS_IOCTL_MAGIC, 30, \ struct btrfs_ioctl_dev_info_args) #define BTRFS_IOC_FS_INFO _IOR(BTRFS_IOCTL_MAGIC, 31, \ struct btrfs_ioctl_fs_info_args) #define BTRFS_IOC_BALANCE_V2 _IOWR(BTRFS_IOCTL_MAGIC, 32, \ struct btrfs_ioctl_balance_args) #define BTRFS_IOC_BALANCE_CTL _IOW(BTRFS_IOCTL_MAGIC, 33, int) #define BTRFS_IOC_BALANCE_PROGRESS _IOR(BTRFS_IOCTL_MAGIC, 34, \ struct btrfs_ioctl_balance_args) #define BTRFS_IOC_INO_PATHS _IOWR(BTRFS_IOCTL_MAGIC, 35, \ struct btrfs_ioctl_ino_path_args) #define BTRFS_IOC_LOGICAL_INO _IOWR(BTRFS_IOCTL_MAGIC, 36, \ struct btrfs_ioctl_logical_ino_args) #define BTRFS_IOC_SET_RECEIVED_SUBVOL _IOWR(BTRFS_IOCTL_MAGIC, 37, \ struct btrfs_ioctl_received_subvol_args) #define BTRFS_IOC_SEND _IOW(BTRFS_IOCTL_MAGIC, 38, struct btrfs_ioctl_send_args) #define BTRFS_IOC_DEVICES_READY _IOR(BTRFS_IOCTL_MAGIC, 39, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_QUOTA_CTL _IOWR(BTRFS_IOCTL_MAGIC, 40, \ struct btrfs_ioctl_quota_ctl_args) #define BTRFS_IOC_QGROUP_ASSIGN _IOW(BTRFS_IOCTL_MAGIC, 41, \ struct btrfs_ioctl_qgroup_assign_args) #define BTRFS_IOC_QGROUP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 42, \ struct btrfs_ioctl_qgroup_create_args) #define BTRFS_IOC_QGROUP_LIMIT _IOR(BTRFS_IOCTL_MAGIC, 43, \ struct btrfs_ioctl_qgroup_limit_args) #define BTRFS_IOC_QUOTA_RESCAN _IOW(BTRFS_IOCTL_MAGIC, 44, \ struct btrfs_ioctl_quota_rescan_args) #define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, \ struct btrfs_ioctl_quota_rescan_args) #define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46) #define BTRFS_IOC_GET_FSLABEL _IOR(BTRFS_IOCTL_MAGIC, 49, \ char[BTRFS_LABEL_SIZE]) #define BTRFS_IOC_SET_FSLABEL _IOW(BTRFS_IOCTL_MAGIC, 50, \ char[BTRFS_LABEL_SIZE]) #define BTRFS_IOC_GET_DEV_STATS _IOWR(BTRFS_IOCTL_MAGIC, 52, \ struct btrfs_ioctl_get_dev_stats) #define BTRFS_IOC_DEV_REPLACE _IOWR(BTRFS_IOCTL_MAGIC, 53, \ struct btrfs_ioctl_dev_replace_args) #define BTRFS_IOC_FILE_EXTENT_SAME _IOWR(BTRFS_IOCTL_MAGIC, 54, \ struct btrfs_ioctl_same_args) #define BTRFS_IOC_GET_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \ struct btrfs_ioctl_feature_flags) #define BTRFS_IOC_SET_FEATURES _IOW(BTRFS_IOCTL_MAGIC, 57, \ struct btrfs_ioctl_feature_flags[2]) #define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \ struct btrfs_ioctl_feature_flags[3]) #define BTRFS_IOC_RM_DEV_V2 _IOW(BTRFS_IOCTL_MAGIC, 58, \ struct btrfs_ioctl_vol_args_v2) #define BTRFS_IOC_LOGICAL_INO_V2 _IOWR(BTRFS_IOCTL_MAGIC, 59, \ struct btrfs_ioctl_logical_ino_args) #define BTRFS_IOC_GET_SUBVOL_INFO _IOR(BTRFS_IOCTL_MAGIC, 60, \ struct btrfs_ioctl_get_subvol_info_args) #define BTRFS_IOC_GET_SUBVOL_ROOTREF _IOWR(BTRFS_IOCTL_MAGIC, 61, \ struct btrfs_ioctl_get_subvol_rootref_args) #define BTRFS_IOC_INO_LOOKUP_USER _IOWR(BTRFS_IOCTL_MAGIC, 62, \ struct btrfs_ioctl_ino_lookup_user_args) #endif /* _LINUX_BTRFS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/uvcvideo.h������������������������������������������������������������������������������������0000644�����������������00000005036�14763166027�0007720 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_UVCVIDEO_H_ #define __LINUX_UVCVIDEO_H_ #include <linux/ioctl.h> #include <linux/types.h> /* * Dynamic controls */ /* Data types for UVC control data */ #define UVC_CTRL_DATA_TYPE_RAW 0 #define UVC_CTRL_DATA_TYPE_SIGNED 1 #define UVC_CTRL_DATA_TYPE_UNSIGNED 2 #define UVC_CTRL_DATA_TYPE_BOOLEAN 3 #define UVC_CTRL_DATA_TYPE_ENUM 4 #define UVC_CTRL_DATA_TYPE_BITMASK 5 /* Control flags */ #define UVC_CTRL_FLAG_SET_CUR (1 << 0) #define UVC_CTRL_FLAG_GET_CUR (1 << 1) #define UVC_CTRL_FLAG_GET_MIN (1 << 2) #define UVC_CTRL_FLAG_GET_MAX (1 << 3) #define UVC_CTRL_FLAG_GET_RES (1 << 4) #define UVC_CTRL_FLAG_GET_DEF (1 << 5) /* Control should be saved at suspend and restored at resume. */ #define UVC_CTRL_FLAG_RESTORE (1 << 6) /* Control can be updated by the camera. */ #define UVC_CTRL_FLAG_AUTO_UPDATE (1 << 7) /* Control supports asynchronous reporting */ #define UVC_CTRL_FLAG_ASYNCHRONOUS (1 << 8) #define UVC_CTRL_FLAG_GET_RANGE \ (UVC_CTRL_FLAG_GET_CUR | UVC_CTRL_FLAG_GET_MIN | \ UVC_CTRL_FLAG_GET_MAX | UVC_CTRL_FLAG_GET_RES | \ UVC_CTRL_FLAG_GET_DEF) struct uvc_menu_info { __u32 value; __u8 name[32]; }; struct uvc_xu_control_mapping { __u32 id; __u8 name[32]; __u8 entity[16]; __u8 selector; __u8 size; __u8 offset; __u32 v4l2_type; __u32 data_type; struct uvc_menu_info *menu_info; __u32 menu_count; __u32 reserved[4]; }; struct uvc_xu_control_query { __u8 unit; __u8 selector; __u8 query; /* Video Class-Specific Request Code, */ /* defined in linux/usb/video.h A.8. */ __u16 size; __u8 *data; }; #define UVCIOC_CTRL_MAP _IOWR('u', 0x20, struct uvc_xu_control_mapping) #define UVCIOC_CTRL_QUERY _IOWR('u', 0x21, struct uvc_xu_control_query) /* * Metadata node */ /** * struct uvc_meta_buf - metadata buffer building block * @ns - system timestamp of the payload in nanoseconds * @sof - USB Frame Number * @length - length of the payload header * @flags - payload header flags * @buf - optional device-specific header data * * UVC metadata nodes fill buffers with possibly multiple instances of this * struct. The first two fields are added by the driver, they can be used for * clock synchronisation. The rest is an exact copy of a UVC payload header. * Only complete objects with complete buffers are included. Therefore it's * always sizeof(meta->ns) + sizeof(meta->sof) + meta->length bytes large. */ struct uvc_meta_buf { __u64 ns; __u16 sof; __u8 length; __u8 flags; __u8 buf[]; } __attribute__((packed)); #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/unistd.h��������������������������������������������������������������������������������������0000644�����������������00000000334�14763166027�0007376 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_UNISTD_H_ #define _LINUX_UNISTD_H_ /* * Include machine specific syscall numbers */ #include <asm/unistd.h> #endif /* _LINUX_UNISTD_H_ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/virtio_gpu.h����������������������������������������������������������������������������������0000644�����������������00000017576�14763166027�0010277 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Virtio GPU Device * * Copyright Red Hat, Inc. 2013-2014 * * Authors: * Dave Airlie <airlied@redhat.com> * Gerd Hoffmann <kraxel@redhat.com> * * This header is BSD licensed so anyone can use the definitions * to implement compatible drivers/servers: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef VIRTIO_GPU_HW_H #define VIRTIO_GPU_HW_H #include <linux/types.h> #define VIRTIO_GPU_F_VIRGL 0 enum virtio_gpu_ctrl_type { VIRTIO_GPU_UNDEFINED = 0, /* 2d commands */ VIRTIO_GPU_CMD_GET_DISPLAY_INFO = 0x0100, VIRTIO_GPU_CMD_RESOURCE_CREATE_2D, VIRTIO_GPU_CMD_RESOURCE_UNREF, VIRTIO_GPU_CMD_SET_SCANOUT, VIRTIO_GPU_CMD_RESOURCE_FLUSH, VIRTIO_GPU_CMD_TRANSFER_TO_HOST_2D, VIRTIO_GPU_CMD_RESOURCE_ATTACH_BACKING, VIRTIO_GPU_CMD_RESOURCE_DETACH_BACKING, VIRTIO_GPU_CMD_GET_CAPSET_INFO, VIRTIO_GPU_CMD_GET_CAPSET, /* 3d commands */ VIRTIO_GPU_CMD_CTX_CREATE = 0x0200, VIRTIO_GPU_CMD_CTX_DESTROY, VIRTIO_GPU_CMD_CTX_ATTACH_RESOURCE, VIRTIO_GPU_CMD_CTX_DETACH_RESOURCE, VIRTIO_GPU_CMD_RESOURCE_CREATE_3D, VIRTIO_GPU_CMD_TRANSFER_TO_HOST_3D, VIRTIO_GPU_CMD_TRANSFER_FROM_HOST_3D, VIRTIO_GPU_CMD_SUBMIT_3D, /* cursor commands */ VIRTIO_GPU_CMD_UPDATE_CURSOR = 0x0300, VIRTIO_GPU_CMD_MOVE_CURSOR, /* success responses */ VIRTIO_GPU_RESP_OK_NODATA = 0x1100, VIRTIO_GPU_RESP_OK_DISPLAY_INFO, VIRTIO_GPU_RESP_OK_CAPSET_INFO, VIRTIO_GPU_RESP_OK_CAPSET, /* error responses */ VIRTIO_GPU_RESP_ERR_UNSPEC = 0x1200, VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY, VIRTIO_GPU_RESP_ERR_INVALID_SCANOUT_ID, VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID, VIRTIO_GPU_RESP_ERR_INVALID_CONTEXT_ID, VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER, }; #define VIRTIO_GPU_FLAG_FENCE (1 << 0) struct virtio_gpu_ctrl_hdr { __le32 type; __le32 flags; __le64 fence_id; __le32 ctx_id; __le32 padding; }; /* data passed in the cursor vq */ struct virtio_gpu_cursor_pos { __le32 scanout_id; __le32 x; __le32 y; __le32 padding; }; /* VIRTIO_GPU_CMD_UPDATE_CURSOR, VIRTIO_GPU_CMD_MOVE_CURSOR */ struct virtio_gpu_update_cursor { struct virtio_gpu_ctrl_hdr hdr; struct virtio_gpu_cursor_pos pos; /* update & move */ __le32 resource_id; /* update only */ __le32 hot_x; /* update only */ __le32 hot_y; /* update only */ __le32 padding; }; /* data passed in the control vq, 2d related */ struct virtio_gpu_rect { __le32 x; __le32 y; __le32 width; __le32 height; }; /* VIRTIO_GPU_CMD_RESOURCE_UNREF */ struct virtio_gpu_resource_unref { struct virtio_gpu_ctrl_hdr hdr; __le32 resource_id; __le32 padding; }; /* VIRTIO_GPU_CMD_RESOURCE_CREATE_2D: create a 2d resource with a format */ struct virtio_gpu_resource_create_2d { struct virtio_gpu_ctrl_hdr hdr; __le32 resource_id; __le32 format; __le32 width; __le32 height; }; /* VIRTIO_GPU_CMD_SET_SCANOUT */ struct virtio_gpu_set_scanout { struct virtio_gpu_ctrl_hdr hdr; struct virtio_gpu_rect r; __le32 scanout_id; __le32 resource_id; }; /* VIRTIO_GPU_CMD_RESOURCE_FLUSH */ struct virtio_gpu_resource_flush { struct virtio_gpu_ctrl_hdr hdr; struct virtio_gpu_rect r; __le32 resource_id; __le32 padding; }; /* VIRTIO_GPU_CMD_TRANSFER_TO_HOST_2D: simple transfer to_host */ struct virtio_gpu_transfer_to_host_2d { struct virtio_gpu_ctrl_hdr hdr; struct virtio_gpu_rect r; __le64 offset; __le32 resource_id; __le32 padding; }; struct virtio_gpu_mem_entry { __le64 addr; __le32 length; __le32 padding; }; /* VIRTIO_GPU_CMD_RESOURCE_ATTACH_BACKING */ struct virtio_gpu_resource_attach_backing { struct virtio_gpu_ctrl_hdr hdr; __le32 resource_id; __le32 nr_entries; }; /* VIRTIO_GPU_CMD_RESOURCE_DETACH_BACKING */ struct virtio_gpu_resource_detach_backing { struct virtio_gpu_ctrl_hdr hdr; __le32 resource_id; __le32 padding; }; /* VIRTIO_GPU_RESP_OK_DISPLAY_INFO */ #define VIRTIO_GPU_MAX_SCANOUTS 16 struct virtio_gpu_resp_display_info { struct virtio_gpu_ctrl_hdr hdr; struct virtio_gpu_display_one { struct virtio_gpu_rect r; __le32 enabled; __le32 flags; } pmodes[VIRTIO_GPU_MAX_SCANOUTS]; }; /* data passed in the control vq, 3d related */ struct virtio_gpu_box { __le32 x, y, z; __le32 w, h, d; }; /* VIRTIO_GPU_CMD_TRANSFER_TO_HOST_3D, VIRTIO_GPU_CMD_TRANSFER_FROM_HOST_3D */ struct virtio_gpu_transfer_host_3d { struct virtio_gpu_ctrl_hdr hdr; struct virtio_gpu_box box; __le64 offset; __le32 resource_id; __le32 level; __le32 stride; __le32 layer_stride; }; /* VIRTIO_GPU_CMD_RESOURCE_CREATE_3D */ #define VIRTIO_GPU_RESOURCE_FLAG_Y_0_TOP (1 << 0) struct virtio_gpu_resource_create_3d { struct virtio_gpu_ctrl_hdr hdr; __le32 resource_id; __le32 target; __le32 format; __le32 bind; __le32 width; __le32 height; __le32 depth; __le32 array_size; __le32 last_level; __le32 nr_samples; __le32 flags; __le32 padding; }; /* VIRTIO_GPU_CMD_CTX_CREATE */ struct virtio_gpu_ctx_create { struct virtio_gpu_ctrl_hdr hdr; __le32 nlen; __le32 padding; char debug_name[64]; }; /* VIRTIO_GPU_CMD_CTX_DESTROY */ struct virtio_gpu_ctx_destroy { struct virtio_gpu_ctrl_hdr hdr; }; /* VIRTIO_GPU_CMD_CTX_ATTACH_RESOURCE, VIRTIO_GPU_CMD_CTX_DETACH_RESOURCE */ struct virtio_gpu_ctx_resource { struct virtio_gpu_ctrl_hdr hdr; __le32 resource_id; __le32 padding; }; /* VIRTIO_GPU_CMD_SUBMIT_3D */ struct virtio_gpu_cmd_submit { struct virtio_gpu_ctrl_hdr hdr; __le32 size; __le32 padding; }; #define VIRTIO_GPU_CAPSET_VIRGL 1 #define VIRTIO_GPU_CAPSET_VIRGL2 2 /* VIRTIO_GPU_CMD_GET_CAPSET_INFO */ struct virtio_gpu_get_capset_info { struct virtio_gpu_ctrl_hdr hdr; __le32 capset_index; __le32 padding; }; /* VIRTIO_GPU_RESP_OK_CAPSET_INFO */ struct virtio_gpu_resp_capset_info { struct virtio_gpu_ctrl_hdr hdr; __le32 capset_id; __le32 capset_max_version; __le32 capset_max_size; __le32 padding; }; /* VIRTIO_GPU_CMD_GET_CAPSET */ struct virtio_gpu_get_capset { struct virtio_gpu_ctrl_hdr hdr; __le32 capset_id; __le32 capset_version; }; /* VIRTIO_GPU_RESP_OK_CAPSET */ struct virtio_gpu_resp_capset { struct virtio_gpu_ctrl_hdr hdr; __u8 capset_data[]; }; #define VIRTIO_GPU_EVENT_DISPLAY (1 << 0) struct virtio_gpu_config { __u32 events_read; __u32 events_clear; __u32 num_scanouts; __u32 num_capsets; }; /* simple formats for fbcon/X use */ enum virtio_gpu_formats { VIRTIO_GPU_FORMAT_B8G8R8A8_UNORM = 1, VIRTIO_GPU_FORMAT_B8G8R8X8_UNORM = 2, VIRTIO_GPU_FORMAT_A8R8G8B8_UNORM = 3, VIRTIO_GPU_FORMAT_X8R8G8B8_UNORM = 4, VIRTIO_GPU_FORMAT_R8G8B8A8_UNORM = 67, VIRTIO_GPU_FORMAT_X8B8G8R8_UNORM = 68, VIRTIO_GPU_FORMAT_A8B8G8R8_UNORM = 121, VIRTIO_GPU_FORMAT_R8G8B8X8_UNORM = 134, }; #endif ����������������������������������������������������������������������������������������������������������������������������������linux/nfsacl.h��������������������������������������������������������������������������������������0000644�����������������00000001234�14763166027�0007336 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * File: linux/nfsacl.h * * (C) 2003 Andreas Gruenbacher <agruen@suse.de> */ #ifndef __LINUX_NFSACL_H #define __LINUX_NFSACL_H #define NFS_ACL_PROGRAM 100227 #define ACLPROC2_GETACL 1 #define ACLPROC2_SETACL 2 #define ACLPROC2_GETATTR 3 #define ACLPROC2_ACCESS 4 #define ACLPROC3_GETACL 1 #define ACLPROC3_SETACL 2 /* Flags for the getacl/setacl mode */ #define NFS_ACL 0x0001 #define NFS_ACLCNT 0x0002 #define NFS_DFACL 0x0004 #define NFS_DFACLCNT 0x0008 #define NFS_ACL_MASK 0x000f /* Flag for Default ACL entries */ #define NFS_ACL_DEFAULT 0x1000 #endif /* __LINUX_NFSACL_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/libc-compat.h���������������������������������������������������������������������������������0000644�����������������00000020141�14763166027�0010260 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Compatibility interface for userspace libc header coordination: * * Define compatibility macros that are used to control the inclusion or * exclusion of UAPI structures and definitions in coordination with another * userspace C library. * * This header is intended to solve the problem of UAPI definitions that * conflict with userspace definitions. If a UAPI header has such conflicting * definitions then the solution is as follows: * * * Synchronize the UAPI header and the libc headers so either one can be * used and such that the ABI is preserved. If this is not possible then * no simple compatibility interface exists (you need to write translating * wrappers and rename things) and you can't use this interface. * * Then follow this process: * * (a) Include libc-compat.h in the UAPI header. * e.g. #include <linux/libc-compat.h> * This include must be as early as possible. * * (b) In libc-compat.h add enough code to detect that the comflicting * userspace libc header has been included first. * * (c) If the userspace libc header has been included first define a set of * guard macros of the form __UAPI_DEF_FOO and set their values to 1, else * set their values to 0. * * (d) Back in the UAPI header with the conflicting definitions, guard the * definitions with: * #if __UAPI_DEF_FOO * ... * #endif * * This fixes the situation where the linux headers are included *after* the * libc headers. To fix the problem with the inclusion in the other order the * userspace libc headers must be fixed like this: * * * For all definitions that conflict with kernel definitions wrap those * defines in the following: * #if !__UAPI_DEF_FOO * ... * #endif * * This prevents the redefinition of a construct already defined by the kernel. */ #ifndef _LIBC_COMPAT_H #define _LIBC_COMPAT_H /* We have included glibc headers... */ #if defined(__GLIBC__) /* Coordinate with glibc net/if.h header. */ #if defined(_NET_IF_H) && defined(__USE_MISC) /* GLIBC headers included first so don't define anything * that would already be defined. */ #define __UAPI_DEF_IF_IFCONF 0 #define __UAPI_DEF_IF_IFMAP 0 #define __UAPI_DEF_IF_IFNAMSIZ 0 #define __UAPI_DEF_IF_IFREQ 0 /* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 0 /* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */ #ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1 #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */ #else /* _NET_IF_H */ /* Linux headers included first, and we must define everything * we need. The expectation is that glibc will check the * __UAPI_DEF_* defines and adjust appropriately. */ #define __UAPI_DEF_IF_IFCONF 1 #define __UAPI_DEF_IF_IFMAP 1 #define __UAPI_DEF_IF_IFNAMSIZ 1 #define __UAPI_DEF_IF_IFREQ 1 /* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1 /* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1 #endif /* _NET_IF_H */ /* Coordinate with glibc netinet/in.h header. */ #if defined(_NETINET_IN_H) /* GLIBC headers included first so don't define anything * that would already be defined. */ #define __UAPI_DEF_IN_ADDR 0 #define __UAPI_DEF_IN_IPPROTO 0 #define __UAPI_DEF_IN_PKTINFO 0 #define __UAPI_DEF_IP_MREQ 0 #define __UAPI_DEF_SOCKADDR_IN 0 #define __UAPI_DEF_IN_CLASS 0 #define __UAPI_DEF_IN6_ADDR 0 /* The exception is the in6_addr macros which must be defined * if the glibc code didn't define them. This guard matches * the guard in glibc/inet/netinet/in.h which defines the * additional in6_addr macros e.g. s6_addr16, and s6_addr32. */ #if defined(__USE_MISC) || defined (__USE_GNU) #define __UAPI_DEF_IN6_ADDR_ALT 0 #else #define __UAPI_DEF_IN6_ADDR_ALT 1 #endif #define __UAPI_DEF_SOCKADDR_IN6 0 #define __UAPI_DEF_IPV6_MREQ 0 #define __UAPI_DEF_IPPROTO_V6 0 #define __UAPI_DEF_IPV6_OPTIONS 0 #define __UAPI_DEF_IN6_PKTINFO 0 #define __UAPI_DEF_IP6_MTUINFO 0 #else /* Linux headers included first, and we must define everything * we need. The expectation is that glibc will check the * __UAPI_DEF_* defines and adjust appropriately. */ #define __UAPI_DEF_IN_ADDR 1 #define __UAPI_DEF_IN_IPPROTO 1 #define __UAPI_DEF_IN_PKTINFO 1 #define __UAPI_DEF_IP_MREQ 1 #define __UAPI_DEF_SOCKADDR_IN 1 #define __UAPI_DEF_IN_CLASS 1 #define __UAPI_DEF_IN6_ADDR 1 /* We unconditionally define the in6_addr macros and glibc must * coordinate. */ #define __UAPI_DEF_IN6_ADDR_ALT 1 #define __UAPI_DEF_SOCKADDR_IN6 1 #define __UAPI_DEF_IPV6_MREQ 1 #define __UAPI_DEF_IPPROTO_V6 1 #define __UAPI_DEF_IPV6_OPTIONS 1 #define __UAPI_DEF_IN6_PKTINFO 1 #define __UAPI_DEF_IP6_MTUINFO 1 #endif /* _NETINET_IN_H */ /* Coordinate with glibc netipx/ipx.h header. */ #if defined(__NETIPX_IPX_H) #define __UAPI_DEF_SOCKADDR_IPX 0 #define __UAPI_DEF_IPX_ROUTE_DEFINITION 0 #define __UAPI_DEF_IPX_INTERFACE_DEFINITION 0 #define __UAPI_DEF_IPX_CONFIG_DATA 0 #define __UAPI_DEF_IPX_ROUTE_DEF 0 #else /* defined(__NETIPX_IPX_H) */ #define __UAPI_DEF_SOCKADDR_IPX 1 #define __UAPI_DEF_IPX_ROUTE_DEFINITION 1 #define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1 #define __UAPI_DEF_IPX_CONFIG_DATA 1 #define __UAPI_DEF_IPX_ROUTE_DEF 1 #endif /* defined(__NETIPX_IPX_H) */ /* Definitions for xattr.h */ #if defined(_SYS_XATTR_H) #define __UAPI_DEF_XATTR 0 #else #define __UAPI_DEF_XATTR 1 #endif /* If we did not see any headers from any supported C libraries, * or we are being included in the kernel, then define everything * that we need. Check for previous __UAPI_* definitions to give * unsupported C libraries a way to opt out of any kernel definition. */ #else /* !defined(__GLIBC__) */ /* Definitions for if.h */ #ifndef __UAPI_DEF_IF_IFCONF #define __UAPI_DEF_IF_IFCONF 1 #endif #ifndef __UAPI_DEF_IF_IFMAP #define __UAPI_DEF_IF_IFMAP 1 #endif #ifndef __UAPI_DEF_IF_IFNAMSIZ #define __UAPI_DEF_IF_IFNAMSIZ 1 #endif #ifndef __UAPI_DEF_IF_IFREQ #define __UAPI_DEF_IF_IFREQ 1 #endif /* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */ #ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1 #endif /* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */ #ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1 #endif /* Definitions for in.h */ #ifndef __UAPI_DEF_IN_ADDR #define __UAPI_DEF_IN_ADDR 1 #endif #ifndef __UAPI_DEF_IN_IPPROTO #define __UAPI_DEF_IN_IPPROTO 1 #endif #ifndef __UAPI_DEF_IN_PKTINFO #define __UAPI_DEF_IN_PKTINFO 1 #endif #ifndef __UAPI_DEF_IP_MREQ #define __UAPI_DEF_IP_MREQ 1 #endif #ifndef __UAPI_DEF_SOCKADDR_IN #define __UAPI_DEF_SOCKADDR_IN 1 #endif #ifndef __UAPI_DEF_IN_CLASS #define __UAPI_DEF_IN_CLASS 1 #endif /* Definitions for in6.h */ #ifndef __UAPI_DEF_IN6_ADDR #define __UAPI_DEF_IN6_ADDR 1 #endif #ifndef __UAPI_DEF_IN6_ADDR_ALT #define __UAPI_DEF_IN6_ADDR_ALT 1 #endif #ifndef __UAPI_DEF_SOCKADDR_IN6 #define __UAPI_DEF_SOCKADDR_IN6 1 #endif #ifndef __UAPI_DEF_IPV6_MREQ #define __UAPI_DEF_IPV6_MREQ 1 #endif #ifndef __UAPI_DEF_IPPROTO_V6 #define __UAPI_DEF_IPPROTO_V6 1 #endif #ifndef __UAPI_DEF_IPV6_OPTIONS #define __UAPI_DEF_IPV6_OPTIONS 1 #endif #ifndef __UAPI_DEF_IN6_PKTINFO #define __UAPI_DEF_IN6_PKTINFO 1 #endif #ifndef __UAPI_DEF_IP6_MTUINFO #define __UAPI_DEF_IP6_MTUINFO 1 #endif /* Definitions for ipx.h */ #ifndef __UAPI_DEF_SOCKADDR_IPX #define __UAPI_DEF_SOCKADDR_IPX 1 #endif #ifndef __UAPI_DEF_IPX_ROUTE_DEFINITION #define __UAPI_DEF_IPX_ROUTE_DEFINITION 1 #endif #ifndef __UAPI_DEF_IPX_INTERFACE_DEFINITION #define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1 #endif #ifndef __UAPI_DEF_IPX_CONFIG_DATA #define __UAPI_DEF_IPX_CONFIG_DATA 1 #endif #ifndef __UAPI_DEF_IPX_ROUTE_DEF #define __UAPI_DEF_IPX_ROUTE_DEF 1 #endif /* Definitions for xattr.h */ #ifndef __UAPI_DEF_XATTR #define __UAPI_DEF_XATTR 1 #endif #endif /* __GLIBC__ */ #endif /* _LIBC_COMPAT_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/cm4000_cs.h�����������������������������������������������������������������������������������0000644�����������������00000003416�14763166027�0007464 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _CM4000_H_ #define _CM4000_H_ #include <linux/types.h> #include <linux/ioctl.h> #define MAX_ATR 33 #define CM4000_MAX_DEV 4 /* those two structures are passed via ioctl() from/to userspace. They are * used by existing userspace programs, so I kepth the awkward "bIFSD" naming * not to break compilation of userspace apps. -HW */ typedef struct atreq { __s32 atr_len; unsigned char atr[64]; __s32 power_act; unsigned char bIFSD; unsigned char bIFSC; } atreq_t; /* what is particularly stupid in the original driver is the arch-dependent * member sizes. This leads to CONFIG_COMPAT breakage, since 32bit userspace * will lay out the structure members differently than the 64bit kernel. * * I've changed "ptsreq.protocol" from "unsigned long" to "__u32". * On 32bit this will make no difference. With 64bit kernels, it will make * 32bit apps work, too. */ typedef struct ptsreq { __u32 protocol; /*T=0: 2^0, T=1: 2^1*/ unsigned char flags; unsigned char pts1; unsigned char pts2; unsigned char pts3; } ptsreq_t; #define CM_IOC_MAGIC 'c' #define CM_IOC_MAXNR 255 #define CM_IOCGSTATUS _IOR (CM_IOC_MAGIC, 0, unsigned char *) #define CM_IOCGATR _IOWR(CM_IOC_MAGIC, 1, atreq_t *) #define CM_IOCSPTS _IOW (CM_IOC_MAGIC, 2, ptsreq_t *) #define CM_IOCSRDR _IO (CM_IOC_MAGIC, 3) #define CM_IOCARDOFF _IO (CM_IOC_MAGIC, 4) #define CM_IOSDBGLVL _IOW(CM_IOC_MAGIC, 250, int*) /* card and device states */ #define CM_CARD_INSERTED 0x01 #define CM_CARD_POWERED 0x02 #define CM_ATR_PRESENT 0x04 #define CM_ATR_VALID 0x08 #define CM_STATE_VALID 0x0f /* extra info only from CM4000 */ #define CM_NO_READER 0x10 #define CM_BAD_CARD 0x20 #endif /* _CM4000_H_ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/capi.h����������������������������������������������������������������������������������������0000644�����������������00000006064�14763166027�0007012 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* $Id: capi.h,v 1.4.6.1 2001/09/23 22:25:05 kai Exp $ * * CAPI 2.0 Interface for Linux * * Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de) * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * */ #ifndef __LINUX_CAPI_H__ #define __LINUX_CAPI_H__ #include <linux/types.h> #include <linux/ioctl.h> #include <linux/kernelcapi.h> /* * CAPI_REGISTER */ typedef struct capi_register_params { /* CAPI_REGISTER */ __u32 level3cnt; /* No. of simulatneous user data connections */ __u32 datablkcnt; /* No. of buffered data messages */ __u32 datablklen; /* Size of buffered data messages */ } capi_register_params; #define CAPI_REGISTER _IOW('C',0x01,struct capi_register_params) /* * CAPI_GET_MANUFACTURER */ #define CAPI_MANUFACTURER_LEN 64 #define CAPI_GET_MANUFACTURER _IOWR('C',0x06,int) /* broken: wanted size 64 (CAPI_MANUFACTURER_LEN) */ /* * CAPI_GET_VERSION */ typedef struct capi_version { __u32 majorversion; __u32 minorversion; __u32 majormanuversion; __u32 minormanuversion; } capi_version; #define CAPI_GET_VERSION _IOWR('C',0x07,struct capi_version) /* * CAPI_GET_SERIAL */ #define CAPI_SERIAL_LEN 8 #define CAPI_GET_SERIAL _IOWR('C',0x08,int) /* broken: wanted size 8 (CAPI_SERIAL_LEN) */ /* * CAPI_GET_PROFILE */ typedef struct capi_profile { __u16 ncontroller; /* number of installed controller */ __u16 nbchannel; /* number of B-Channels */ __u32 goptions; /* global options */ __u32 support1; /* B1 protocols support */ __u32 support2; /* B2 protocols support */ __u32 support3; /* B3 protocols support */ __u32 reserved[6]; /* reserved */ __u32 manu[5]; /* manufacturer specific information */ } capi_profile; #define CAPI_GET_PROFILE _IOWR('C',0x09,struct capi_profile) typedef struct capi_manufacturer_cmd { unsigned long cmd; void *data; } capi_manufacturer_cmd; /* * CAPI_MANUFACTURER_CMD */ #define CAPI_MANUFACTURER_CMD _IOWR('C',0x20, struct capi_manufacturer_cmd) /* * CAPI_GET_ERRCODE * capi errcode is set, * if read, write, or ioctl returns EIO, * ioctl returns errcode directly, and in arg, if != 0 */ #define CAPI_GET_ERRCODE _IOR('C',0x21, __u16) /* * CAPI_INSTALLED */ #define CAPI_INSTALLED _IOR('C',0x22, __u16) /* * member contr is input for * CAPI_GET_MANUFACTURER, CAPI_GET_VERSION, CAPI_GET_SERIAL * and CAPI_GET_PROFILE */ typedef union capi_ioctl_struct { __u32 contr; capi_register_params rparams; __u8 manufacturer[CAPI_MANUFACTURER_LEN]; capi_version version; __u8 serial[CAPI_SERIAL_LEN]; capi_profile profile; capi_manufacturer_cmd cmd; __u16 errcode; } capi_ioctl_struct; /* * Middleware extension */ #define CAPIFLAG_HIGHJACKING 0x0001 #define CAPI_GET_FLAGS _IOR('C',0x23, unsigned) #define CAPI_SET_FLAGS _IOR('C',0x24, unsigned) #define CAPI_CLR_FLAGS _IOR('C',0x25, unsigned) #define CAPI_NCCI_OPENCOUNT _IOR('C',0x26, unsigned) #define CAPI_NCCI_GETUNIT _IOR('C',0x27, unsigned) #endif /* __LINUX_CAPI_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/qrtr.h����������������������������������������������������������������������������������������0000644�����������������00000001575�14763166027�0007070 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_QRTR_H #define _LINUX_QRTR_H #include <linux/socket.h> #include <linux/types.h> #define QRTR_NODE_BCAST 0xffffffffu #define QRTR_PORT_CTRL 0xfffffffeu struct sockaddr_qrtr { __kernel_sa_family_t sq_family; __u32 sq_node; __u32 sq_port; }; enum qrtr_pkt_type { QRTR_TYPE_DATA = 1, QRTR_TYPE_HELLO = 2, QRTR_TYPE_BYE = 3, QRTR_TYPE_NEW_SERVER = 4, QRTR_TYPE_DEL_SERVER = 5, QRTR_TYPE_DEL_CLIENT = 6, QRTR_TYPE_RESUME_TX = 7, QRTR_TYPE_EXIT = 8, QRTR_TYPE_PING = 9, QRTR_TYPE_NEW_LOOKUP = 10, QRTR_TYPE_DEL_LOOKUP = 11, }; struct qrtr_ctrl_pkt { __le32 cmd; union { struct { __le32 service; __le32 instance; __le32 node; __le32 port; } server; struct { __le32 node; __le32 port; } client; }; } __attribute__((packed)); #endif /* _LINUX_QRTR_H */ �����������������������������������������������������������������������������������������������������������������������������������linux/net.h�����������������������������������������������������������������������������������������0000644�����������������00000004045�14763166027�0006661 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * NET An implementation of the SOCKET network access protocol. * This is the master header file for the Linux NET layer, * or, in plain English: the networking handling part of the * kernel. * * Version: @(#)net.h 1.0.3 05/25/93 * * Authors: Orest Zborowski, <obz@Kodak.COM> * Ross Biro * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * * 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. */ #ifndef _LINUX_NET_H #define _LINUX_NET_H #include <linux/socket.h> #include <asm/socket.h> #define NPROTO AF_MAX #define SYS_SOCKET 1 /* sys_socket(2) */ #define SYS_BIND 2 /* sys_bind(2) */ #define SYS_CONNECT 3 /* sys_connect(2) */ #define SYS_LISTEN 4 /* sys_listen(2) */ #define SYS_ACCEPT 5 /* sys_accept(2) */ #define SYS_GETSOCKNAME 6 /* sys_getsockname(2) */ #define SYS_GETPEERNAME 7 /* sys_getpeername(2) */ #define SYS_SOCKETPAIR 8 /* sys_socketpair(2) */ #define SYS_SEND 9 /* sys_send(2) */ #define SYS_RECV 10 /* sys_recv(2) */ #define SYS_SENDTO 11 /* sys_sendto(2) */ #define SYS_RECVFROM 12 /* sys_recvfrom(2) */ #define SYS_SHUTDOWN 13 /* sys_shutdown(2) */ #define SYS_SETSOCKOPT 14 /* sys_setsockopt(2) */ #define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */ #define SYS_SENDMSG 16 /* sys_sendmsg(2) */ #define SYS_RECVMSG 17 /* sys_recvmsg(2) */ #define SYS_ACCEPT4 18 /* sys_accept4(2) */ #define SYS_RECVMMSG 19 /* sys_recvmmsg(2) */ #define SYS_SENDMMSG 20 /* sys_sendmmsg(2) */ typedef enum { SS_FREE = 0, /* not allocated */ SS_UNCONNECTED, /* unconnected to any socket */ SS_CONNECTING, /* in process of connecting */ SS_CONNECTED, /* connected to socket */ SS_DISCONNECTING /* in process of disconnecting */ } socket_state; #define __SO_ACCEPTCON (1 << 16) /* performed a listen */ #endif /* _LINUX_NET_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/cciss_defs.h����������������������������������������������������������������������������������0000644�����������������00000006321�14763166027�0010177 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef CCISS_DEFS_H #define CCISS_DEFS_H #include <linux/types.h> /* general boundary definitions */ #define SENSEINFOBYTES 32 /* note that this value may vary between host implementations */ /* Command Status value */ #define CMD_SUCCESS 0x0000 #define CMD_TARGET_STATUS 0x0001 #define CMD_DATA_UNDERRUN 0x0002 #define CMD_DATA_OVERRUN 0x0003 #define CMD_INVALID 0x0004 #define CMD_PROTOCOL_ERR 0x0005 #define CMD_HARDWARE_ERR 0x0006 #define CMD_CONNECTION_LOST 0x0007 #define CMD_ABORTED 0x0008 #define CMD_ABORT_FAILED 0x0009 #define CMD_UNSOLICITED_ABORT 0x000A #define CMD_TIMEOUT 0x000B #define CMD_UNABORTABLE 0x000C /* transfer direction */ #define XFER_NONE 0x00 #define XFER_WRITE 0x01 #define XFER_READ 0x02 #define XFER_RSVD 0x03 /* task attribute */ #define ATTR_UNTAGGED 0x00 #define ATTR_SIMPLE 0x04 #define ATTR_HEADOFQUEUE 0x05 #define ATTR_ORDERED 0x06 #define ATTR_ACA 0x07 /* cdb type */ #define TYPE_CMD 0x00 #define TYPE_MSG 0x01 /* Type defs used in the following structs */ #define BYTE __u8 #define WORD __u16 #define HWORD __u16 #define DWORD __u32 #define CISS_MAX_LUN 1024 #define LEVEL2LUN 1 /* index into Target(x) structure, due to byte swapping */ #define LEVEL3LUN 0 #pragma pack(1) /* Command List Structure */ typedef union _SCSI3Addr_struct { struct { BYTE Dev; BYTE Bus:6; BYTE Mode:2; /* b00 */ } PeripDev; struct { BYTE DevLSB; BYTE DevMSB:6; BYTE Mode:2; /* b01 */ } LogDev; struct { BYTE Dev:5; BYTE Bus:3; BYTE Targ:6; BYTE Mode:2; /* b10 */ } LogUnit; } SCSI3Addr_struct; typedef struct _PhysDevAddr_struct { DWORD TargetId:24; DWORD Bus:6; DWORD Mode:2; SCSI3Addr_struct Target[2]; /* 2 level target device addr */ } PhysDevAddr_struct; typedef struct _LogDevAddr_struct { DWORD VolId:30; DWORD Mode:2; BYTE reserved[4]; } LogDevAddr_struct; typedef union _LUNAddr_struct { BYTE LunAddrBytes[8]; SCSI3Addr_struct SCSI3Lun[4]; PhysDevAddr_struct PhysDev; LogDevAddr_struct LogDev; } LUNAddr_struct; typedef struct _RequestBlock_struct { BYTE CDBLen; struct { BYTE Type:3; BYTE Attribute:3; BYTE Direction:2; } Type; HWORD Timeout; BYTE CDB[16]; } RequestBlock_struct; typedef union _MoreErrInfo_struct{ struct { BYTE Reserved[3]; BYTE Type; DWORD ErrorInfo; } Common_Info; struct{ BYTE Reserved[2]; BYTE offense_size; /* size of offending entry */ BYTE offense_num; /* byte # of offense 0-base */ DWORD offense_value; } Invalid_Cmd; } MoreErrInfo_struct; typedef struct _ErrorInfo_struct { BYTE ScsiStatus; BYTE SenseLen; HWORD CommandStatus; DWORD ResidualCnt; MoreErrInfo_struct MoreErrInfo; BYTE SenseInfo[SENSEINFOBYTES]; } ErrorInfo_struct; #pragma pack() #endif /* CCISS_DEFS_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/nilfs2_api.h����������������������������������������������������������������������������������0000644�����������������00000016645�14763166027�0010132 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * nilfs2_api.h - NILFS2 user space API * * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. */ #ifndef _LINUX_NILFS2_API_H #define _LINUX_NILFS2_API_H #include <linux/types.h> #include <linux/ioctl.h> /** * struct nilfs_cpinfo - checkpoint information * @ci_flags: flags * @ci_pad: padding * @ci_cno: checkpoint number * @ci_create: creation timestamp * @ci_nblk_inc: number of blocks incremented by this checkpoint * @ci_inodes_count: inodes count * @ci_blocks_count: blocks count * @ci_next: next checkpoint number in snapshot list */ struct nilfs_cpinfo { __u32 ci_flags; __u32 ci_pad; __u64 ci_cno; __u64 ci_create; __u64 ci_nblk_inc; __u64 ci_inodes_count; __u64 ci_blocks_count; __u64 ci_next; }; /* checkpoint flags */ enum { NILFS_CPINFO_SNAPSHOT, NILFS_CPINFO_INVALID, NILFS_CPINFO_SKETCH, NILFS_CPINFO_MINOR, }; #define NILFS_CPINFO_FNS(flag, name) \ static __inline__ int \ nilfs_cpinfo_##name(const struct nilfs_cpinfo *cpinfo) \ { \ return !!(cpinfo->ci_flags & (1UL << NILFS_CPINFO_##flag)); \ } NILFS_CPINFO_FNS(SNAPSHOT, snapshot) NILFS_CPINFO_FNS(INVALID, invalid) NILFS_CPINFO_FNS(MINOR, minor) /** * nilfs_suinfo - segment usage information * @sui_lastmod: timestamp of last modification * @sui_nblocks: number of written blocks in segment * @sui_flags: segment usage flags */ struct nilfs_suinfo { __u64 sui_lastmod; __u32 sui_nblocks; __u32 sui_flags; }; /* segment usage flags */ enum { NILFS_SUINFO_ACTIVE, NILFS_SUINFO_DIRTY, NILFS_SUINFO_ERROR, }; #define NILFS_SUINFO_FNS(flag, name) \ static __inline__ int \ nilfs_suinfo_##name(const struct nilfs_suinfo *si) \ { \ return si->sui_flags & (1UL << NILFS_SUINFO_##flag); \ } NILFS_SUINFO_FNS(ACTIVE, active) NILFS_SUINFO_FNS(DIRTY, dirty) NILFS_SUINFO_FNS(ERROR, error) static __inline__ int nilfs_suinfo_clean(const struct nilfs_suinfo *si) { return !si->sui_flags; } /** * nilfs_suinfo_update - segment usage information update * @sup_segnum: segment number * @sup_flags: flags for which fields are active in sup_sui * @sup_reserved: reserved necessary for alignment * @sup_sui: segment usage information */ struct nilfs_suinfo_update { __u64 sup_segnum; __u32 sup_flags; __u32 sup_reserved; struct nilfs_suinfo sup_sui; }; enum { NILFS_SUINFO_UPDATE_LASTMOD, NILFS_SUINFO_UPDATE_NBLOCKS, NILFS_SUINFO_UPDATE_FLAGS, __NR_NILFS_SUINFO_UPDATE_FIELDS, }; #define NILFS_SUINFO_UPDATE_FNS(flag, name) \ static __inline__ void \ nilfs_suinfo_update_set_##name(struct nilfs_suinfo_update *sup) \ { \ sup->sup_flags |= 1UL << NILFS_SUINFO_UPDATE_##flag; \ } \ static __inline__ void \ nilfs_suinfo_update_clear_##name(struct nilfs_suinfo_update *sup) \ { \ sup->sup_flags &= ~(1UL << NILFS_SUINFO_UPDATE_##flag); \ } \ static __inline__ int \ nilfs_suinfo_update_##name(const struct nilfs_suinfo_update *sup) \ { \ return !!(sup->sup_flags & (1UL << NILFS_SUINFO_UPDATE_##flag));\ } NILFS_SUINFO_UPDATE_FNS(LASTMOD, lastmod) NILFS_SUINFO_UPDATE_FNS(NBLOCKS, nblocks) NILFS_SUINFO_UPDATE_FNS(FLAGS, flags) enum { NILFS_CHECKPOINT, NILFS_SNAPSHOT, }; /** * struct nilfs_cpmode - change checkpoint mode structure * @cm_cno: checkpoint number * @cm_mode: mode of checkpoint * @cm_pad: padding */ struct nilfs_cpmode { __u64 cm_cno; __u32 cm_mode; __u32 cm_pad; }; /** * struct nilfs_argv - argument vector * @v_base: pointer on data array from userspace * @v_nmembs: number of members in data array * @v_size: size of data array in bytes * @v_flags: flags * @v_index: start number of target data items */ struct nilfs_argv { __u64 v_base; __u32 v_nmembs; /* number of members */ __u16 v_size; /* size of members */ __u16 v_flags; __u64 v_index; }; /** * struct nilfs_period - period of checkpoint numbers * @p_start: start checkpoint number (inclusive) * @p_end: end checkpoint number (exclusive) */ struct nilfs_period { __u64 p_start; __u64 p_end; }; /** * struct nilfs_cpstat - checkpoint statistics * @cs_cno: checkpoint number * @cs_ncps: number of checkpoints * @cs_nsss: number of snapshots */ struct nilfs_cpstat { __u64 cs_cno; __u64 cs_ncps; __u64 cs_nsss; }; /** * struct nilfs_sustat - segment usage statistics * @ss_nsegs: number of segments * @ss_ncleansegs: number of clean segments * @ss_ndirtysegs: number of dirty segments * @ss_ctime: creation time of the last segment * @ss_nongc_ctime: creation time of the last segment not for GC * @ss_prot_seq: least sequence number of segments which must not be reclaimed */ struct nilfs_sustat { __u64 ss_nsegs; __u64 ss_ncleansegs; __u64 ss_ndirtysegs; __u64 ss_ctime; __u64 ss_nongc_ctime; __u64 ss_prot_seq; }; /** * struct nilfs_vinfo - virtual block number information * @vi_vblocknr: virtual block number * @vi_start: start checkpoint number (inclusive) * @vi_end: end checkpoint number (exclusive) * @vi_blocknr: disk block number */ struct nilfs_vinfo { __u64 vi_vblocknr; __u64 vi_start; __u64 vi_end; __u64 vi_blocknr; }; /** * struct nilfs_vdesc - descriptor of virtual block number * @vd_ino: inode number * @vd_cno: checkpoint number * @vd_vblocknr: virtual block number * @vd_period: period of checkpoint numbers * @vd_blocknr: disk block number * @vd_offset: logical block offset inside a file * @vd_flags: flags (data or node block) * @vd_pad: padding */ struct nilfs_vdesc { __u64 vd_ino; __u64 vd_cno; __u64 vd_vblocknr; struct nilfs_period vd_period; __u64 vd_blocknr; __u64 vd_offset; __u32 vd_flags; __u32 vd_pad; }; /** * struct nilfs_bdesc - descriptor of disk block number * @bd_ino: inode number * @bd_oblocknr: disk block address (for skipping dead blocks) * @bd_blocknr: disk block address * @bd_offset: logical block offset inside a file * @bd_level: level in the b-tree organization * @bd_pad: padding */ struct nilfs_bdesc { __u64 bd_ino; __u64 bd_oblocknr; __u64 bd_blocknr; __u64 bd_offset; __u32 bd_level; __u32 bd_pad; }; #define NILFS_IOCTL_IDENT 'n' #define NILFS_IOCTL_CHANGE_CPMODE \ _IOW(NILFS_IOCTL_IDENT, 0x80, struct nilfs_cpmode) #define NILFS_IOCTL_DELETE_CHECKPOINT \ _IOW(NILFS_IOCTL_IDENT, 0x81, __u64) #define NILFS_IOCTL_GET_CPINFO \ _IOR(NILFS_IOCTL_IDENT, 0x82, struct nilfs_argv) #define NILFS_IOCTL_GET_CPSTAT \ _IOR(NILFS_IOCTL_IDENT, 0x83, struct nilfs_cpstat) #define NILFS_IOCTL_GET_SUINFO \ _IOR(NILFS_IOCTL_IDENT, 0x84, struct nilfs_argv) #define NILFS_IOCTL_GET_SUSTAT \ _IOR(NILFS_IOCTL_IDENT, 0x85, struct nilfs_sustat) #define NILFS_IOCTL_GET_VINFO \ _IOWR(NILFS_IOCTL_IDENT, 0x86, struct nilfs_argv) #define NILFS_IOCTL_GET_BDESCS \ _IOWR(NILFS_IOCTL_IDENT, 0x87, struct nilfs_argv) #define NILFS_IOCTL_CLEAN_SEGMENTS \ _IOW(NILFS_IOCTL_IDENT, 0x88, struct nilfs_argv[5]) #define NILFS_IOCTL_SYNC \ _IOR(NILFS_IOCTL_IDENT, 0x8A, __u64) #define NILFS_IOCTL_RESIZE \ _IOW(NILFS_IOCTL_IDENT, 0x8B, __u64) #define NILFS_IOCTL_SET_ALLOC_RANGE \ _IOW(NILFS_IOCTL_IDENT, 0x8C, __u64[2]) #define NILFS_IOCTL_SET_SUINFO \ _IOW(NILFS_IOCTL_IDENT, 0x8D, struct nilfs_argv) #endif /* _LINUX_NILFS2_API_H */ �������������������������������������������������������������������������������������������linux/nfc.h�����������������������������������������������������������������������������������������0000644�����������������00000025744�14763166027�0006652 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 2011 Instituto Nokia de Tecnologia * * Authors: * Lauro Ramos Venancio <lauro.venancio@openbossa.org> * Aloisio Almeida Jr <aloisio.almeida@openbossa.org> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef __LINUX_NFC_H #define __LINUX_NFC_H #include <linux/types.h> #include <linux/socket.h> #define NFC_GENL_NAME "nfc" #define NFC_GENL_VERSION 1 #define NFC_GENL_MCAST_EVENT_NAME "events" /** * enum nfc_commands - supported nfc commands * * @NFC_CMD_UNSPEC: unspecified command * * @NFC_CMD_GET_DEVICE: request information about a device (requires * %NFC_ATTR_DEVICE_INDEX) or dump request to get a list of all nfc devices * @NFC_CMD_DEV_UP: turn on the nfc device * (requires %NFC_ATTR_DEVICE_INDEX) * @NFC_CMD_DEV_DOWN: turn off the nfc device * (requires %NFC_ATTR_DEVICE_INDEX) * @NFC_CMD_START_POLL: start polling for targets using the given protocols * (requires %NFC_ATTR_DEVICE_INDEX and %NFC_ATTR_PROTOCOLS) * @NFC_CMD_STOP_POLL: stop polling for targets (requires * %NFC_ATTR_DEVICE_INDEX) * @NFC_CMD_GET_TARGET: dump all targets found by the previous poll (requires * %NFC_ATTR_DEVICE_INDEX) * @NFC_EVENT_TARGETS_FOUND: event emitted when a new target is found * (it sends %NFC_ATTR_DEVICE_INDEX) * @NFC_EVENT_DEVICE_ADDED: event emitted when a new device is registred * (it sends %NFC_ATTR_DEVICE_NAME, %NFC_ATTR_DEVICE_INDEX and * %NFC_ATTR_PROTOCOLS) * @NFC_EVENT_DEVICE_REMOVED: event emitted when a device is removed * (it sends %NFC_ATTR_DEVICE_INDEX) * @NFC_EVENT_TM_ACTIVATED: event emitted when the adapter is activated in * target mode. * @NFC_EVENT_DEVICE_DEACTIVATED: event emitted when the adapter is deactivated * from target mode. * @NFC_CMD_LLC_GET_PARAMS: request LTO, RW, and MIUX parameters for a device * @NFC_CMD_LLC_SET_PARAMS: set one or more of LTO, RW, and MIUX parameters for * a device. LTO must be set before the link is up otherwise -EINPROGRESS * is returned. RW and MIUX can be set at anytime and will be passed in * subsequent CONNECT and CC messages. * If one of the passed parameters is wrong none is set and -EINVAL is * returned. * @NFC_CMD_ENABLE_SE: Enable the physical link to a specific secure element. * Once enabled a secure element will handle card emulation mode, i.e. * starting a poll from a device which has a secure element enabled means * we want to do SE based card emulation. * @NFC_CMD_DISABLE_SE: Disable the physical link to a specific secure element. * @NFC_CMD_FW_DOWNLOAD: Request to Load/flash firmware, or event to inform * that some firmware was loaded * @NFC_EVENT_SE_ADDED: Event emitted when a new secure element is discovered. * This typically will be sent whenever a new NFC controller with either * an embedded SE or an UICC one connected to it through SWP. * @NFC_EVENT_SE_REMOVED: Event emitted when a secure element is removed from * the system, as a consequence of e.g. an NFC controller being unplugged. * @NFC_EVENT_SE_CONNECTIVITY: This event is emitted whenever a secure element * is requesting connectivity access. For example a UICC SE may need to * talk with a sleeping modem and will notify this need by sending this * event. It is then up to userspace to decide if it will wake the modem * up or not. * @NFC_EVENT_SE_TRANSACTION: This event is sent when an application running on * a specific SE notifies us about the end of a transaction. The parameter * for this event is the application ID (AID). * @NFC_CMD_GET_SE: Dump all discovered secure elements from an NFC controller. * @NFC_CMD_SE_IO: Send/Receive APDUs to/from the selected secure element. * @NFC_CMD_ACTIVATE_TARGET: Request NFC controller to reactivate target. * @NFC_CMD_VENDOR: Vendor specific command, to be implemented directly * from the driver in order to support hardware specific operations. * @NFC_CMD_DEACTIVATE_TARGET: Request NFC controller to deactivate target. */ enum nfc_commands { NFC_CMD_UNSPEC, NFC_CMD_GET_DEVICE, NFC_CMD_DEV_UP, NFC_CMD_DEV_DOWN, NFC_CMD_DEP_LINK_UP, NFC_CMD_DEP_LINK_DOWN, NFC_CMD_START_POLL, NFC_CMD_STOP_POLL, NFC_CMD_GET_TARGET, NFC_EVENT_TARGETS_FOUND, NFC_EVENT_DEVICE_ADDED, NFC_EVENT_DEVICE_REMOVED, NFC_EVENT_TARGET_LOST, NFC_EVENT_TM_ACTIVATED, NFC_EVENT_TM_DEACTIVATED, NFC_CMD_LLC_GET_PARAMS, NFC_CMD_LLC_SET_PARAMS, NFC_CMD_ENABLE_SE, NFC_CMD_DISABLE_SE, NFC_CMD_LLC_SDREQ, NFC_EVENT_LLC_SDRES, NFC_CMD_FW_DOWNLOAD, NFC_EVENT_SE_ADDED, NFC_EVENT_SE_REMOVED, NFC_EVENT_SE_CONNECTIVITY, NFC_EVENT_SE_TRANSACTION, NFC_CMD_GET_SE, NFC_CMD_SE_IO, NFC_CMD_ACTIVATE_TARGET, NFC_CMD_VENDOR, NFC_CMD_DEACTIVATE_TARGET, /* private: internal use only */ __NFC_CMD_AFTER_LAST }; #define NFC_CMD_MAX (__NFC_CMD_AFTER_LAST - 1) /** * enum nfc_attrs - supported nfc attributes * * @NFC_ATTR_UNSPEC: unspecified attribute * * @NFC_ATTR_DEVICE_INDEX: index of nfc device * @NFC_ATTR_DEVICE_NAME: device name, max 8 chars * @NFC_ATTR_PROTOCOLS: nfc protocols - bitwise or-ed combination from * NFC_PROTO_*_MASK constants * @NFC_ATTR_TARGET_INDEX: index of the nfc target * @NFC_ATTR_TARGET_SENS_RES: NFC-A targets extra information such as NFCID * @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the * target is not NFC-Forum compliant) * @NFC_ATTR_TARGET_NFCID1: NFC-A targets identifier, max 10 bytes * @NFC_ATTR_TARGET_SENSB_RES: NFC-B targets extra information, max 12 bytes * @NFC_ATTR_TARGET_SENSF_RES: NFC-F targets extra information, max 18 bytes * @NFC_ATTR_COMM_MODE: Passive or active mode * @NFC_ATTR_RF_MODE: Initiator or target * @NFC_ATTR_IM_PROTOCOLS: Initiator mode protocols to poll for * @NFC_ATTR_TM_PROTOCOLS: Target mode protocols to listen for * @NFC_ATTR_LLC_PARAM_LTO: Link TimeOut parameter * @NFC_ATTR_LLC_PARAM_RW: Receive Window size parameter * @NFC_ATTR_LLC_PARAM_MIUX: MIU eXtension parameter * @NFC_ATTR_SE: Available Secure Elements * @NFC_ATTR_FIRMWARE_NAME: Free format firmware version * @NFC_ATTR_SE_INDEX: Secure element index * @NFC_ATTR_SE_TYPE: Secure element type (UICC or EMBEDDED) * @NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS: Firmware download operation status * @NFC_ATTR_APDU: Secure element APDU * @NFC_ATTR_TARGET_ISO15693_DSFID: ISO 15693 Data Storage Format Identifier * @NFC_ATTR_TARGET_ISO15693_UID: ISO 15693 Unique Identifier * @NFC_ATTR_SE_PARAMS: Parameters data from an evt_transaction * @NFC_ATTR_VENDOR_ID: NFC manufacturer unique ID, typically an OUI * @NFC_ATTR_VENDOR_SUBCMD: Vendor specific sub command * @NFC_ATTR_VENDOR_DATA: Vendor specific data, to be optionally passed * to a vendor specific command implementation */ enum nfc_attrs { NFC_ATTR_UNSPEC, NFC_ATTR_DEVICE_INDEX, NFC_ATTR_DEVICE_NAME, NFC_ATTR_PROTOCOLS, NFC_ATTR_TARGET_INDEX, NFC_ATTR_TARGET_SENS_RES, NFC_ATTR_TARGET_SEL_RES, NFC_ATTR_TARGET_NFCID1, NFC_ATTR_TARGET_SENSB_RES, NFC_ATTR_TARGET_SENSF_RES, NFC_ATTR_COMM_MODE, NFC_ATTR_RF_MODE, NFC_ATTR_DEVICE_POWERED, NFC_ATTR_IM_PROTOCOLS, NFC_ATTR_TM_PROTOCOLS, NFC_ATTR_LLC_PARAM_LTO, NFC_ATTR_LLC_PARAM_RW, NFC_ATTR_LLC_PARAM_MIUX, NFC_ATTR_SE, NFC_ATTR_LLC_SDP, NFC_ATTR_FIRMWARE_NAME, NFC_ATTR_SE_INDEX, NFC_ATTR_SE_TYPE, NFC_ATTR_SE_AID, NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS, NFC_ATTR_SE_APDU, NFC_ATTR_TARGET_ISO15693_DSFID, NFC_ATTR_TARGET_ISO15693_UID, NFC_ATTR_SE_PARAMS, NFC_ATTR_VENDOR_ID, NFC_ATTR_VENDOR_SUBCMD, NFC_ATTR_VENDOR_DATA, /* private: internal use only */ __NFC_ATTR_AFTER_LAST }; #define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1) enum nfc_sdp_attr { NFC_SDP_ATTR_UNSPEC, NFC_SDP_ATTR_URI, NFC_SDP_ATTR_SAP, /* private: internal use only */ __NFC_SDP_ATTR_AFTER_LAST }; #define NFC_SDP_ATTR_MAX (__NFC_SDP_ATTR_AFTER_LAST - 1) #define NFC_DEVICE_NAME_MAXSIZE 8 #define NFC_NFCID1_MAXSIZE 10 #define NFC_NFCID2_MAXSIZE 8 #define NFC_NFCID3_MAXSIZE 10 #define NFC_SENSB_RES_MAXSIZE 12 #define NFC_SENSF_RES_MAXSIZE 18 #define NFC_ATR_REQ_MAXSIZE 64 #define NFC_ATR_RES_MAXSIZE 64 #define NFC_ATR_REQ_GB_MAXSIZE 48 #define NFC_ATR_RES_GB_MAXSIZE 47 #define NFC_GB_MAXSIZE 48 #define NFC_FIRMWARE_NAME_MAXSIZE 32 #define NFC_ISO15693_UID_MAXSIZE 8 /* NFC protocols */ #define NFC_PROTO_JEWEL 1 #define NFC_PROTO_MIFARE 2 #define NFC_PROTO_FELICA 3 #define NFC_PROTO_ISO14443 4 #define NFC_PROTO_NFC_DEP 5 #define NFC_PROTO_ISO14443_B 6 #define NFC_PROTO_ISO15693 7 #define NFC_PROTO_MAX 8 /* NFC communication modes */ #define NFC_COMM_ACTIVE 0 #define NFC_COMM_PASSIVE 1 /* NFC RF modes */ #define NFC_RF_INITIATOR 0 #define NFC_RF_TARGET 1 #define NFC_RF_NONE 2 /* NFC protocols masks used in bitsets */ #define NFC_PROTO_JEWEL_MASK (1 << NFC_PROTO_JEWEL) #define NFC_PROTO_MIFARE_MASK (1 << NFC_PROTO_MIFARE) #define NFC_PROTO_FELICA_MASK (1 << NFC_PROTO_FELICA) #define NFC_PROTO_ISO14443_MASK (1 << NFC_PROTO_ISO14443) #define NFC_PROTO_NFC_DEP_MASK (1 << NFC_PROTO_NFC_DEP) #define NFC_PROTO_ISO14443_B_MASK (1 << NFC_PROTO_ISO14443_B) #define NFC_PROTO_ISO15693_MASK (1 << NFC_PROTO_ISO15693) /* NFC Secure Elements */ #define NFC_SE_UICC 0x1 #define NFC_SE_EMBEDDED 0x2 #define NFC_SE_DISABLED 0x0 #define NFC_SE_ENABLED 0x1 struct sockaddr_nfc { __kernel_sa_family_t sa_family; __u32 dev_idx; __u32 target_idx; __u32 nfc_protocol; }; #define NFC_LLCP_MAX_SERVICE_NAME 63 struct sockaddr_nfc_llcp { __kernel_sa_family_t sa_family; __u32 dev_idx; __u32 target_idx; __u32 nfc_protocol; __u8 dsap; /* Destination SAP, if known */ __u8 ssap; /* Source SAP to be bound to */ char service_name[NFC_LLCP_MAX_SERVICE_NAME]; /* Service name URI */; __kernel_size_t service_name_len; }; /* NFC socket protocols */ #define NFC_SOCKPROTO_RAW 0 #define NFC_SOCKPROTO_LLCP 1 #define NFC_SOCKPROTO_MAX 2 #define NFC_HEADER_SIZE 1 /** * Pseudo-header info for raw socket packets * First byte is the adapter index * Second byte contains flags * - 0x01 - Direction (0=RX, 1=TX) * - 0x02-0x04 - Payload type (000=LLCP, 001=NCI, 010=HCI, 011=Digital, * 100=Proprietary) * - 0x05-0x80 - Reserved **/ #define NFC_RAW_HEADER_SIZE 2 #define NFC_DIRECTION_RX 0x00 #define NFC_DIRECTION_TX 0x01 #define RAW_PAYLOAD_LLCP 0 #define RAW_PAYLOAD_NCI 1 #define RAW_PAYLOAD_HCI 2 #define RAW_PAYLOAD_DIGITAL 3 #define RAW_PAYLOAD_PROPRIETARY 4 /* socket option names */ #define NFC_LLCP_RW 0 #define NFC_LLCP_MIUX 1 #define NFC_LLCP_REMOTE_MIU 2 #define NFC_LLCP_REMOTE_LTO 3 #define NFC_LLCP_REMOTE_RW 4 #endif /*__LINUX_NFC_H */ ����������������������������linux/sched/types.h���������������������������������������������������������������������������������0000644�����������������00000005200�14763166027�0010317 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SCHED_TYPES_H #define _LINUX_SCHED_TYPES_H #include <linux/types.h> struct sched_param { int sched_priority; }; #define SCHED_ATTR_SIZE_VER0 48 /* sizeof first published struct */ /* * Extended scheduling parameters data structure. * * This is needed because the original struct sched_param can not be * altered without introducing ABI issues with legacy applications * (e.g., in sched_getparam()). * * However, the possibility of specifying more than just a priority for * the tasks may be useful for a wide variety of application fields, e.g., * multimedia, streaming, automation and control, and many others. * * This variant (sched_attr) is meant at describing a so-called * sporadic time-constrained task. In such model a task is specified by: * - the activation period or minimum instance inter-arrival time; * - the maximum (or average, depending on the actual scheduling * discipline) computation time of all instances, a.k.a. runtime; * - the deadline (relative to the actual activation time) of each * instance. * Very briefly, a periodic (sporadic) task asks for the execution of * some specific computation --which is typically called an instance-- * (at most) every period. Moreover, each instance typically lasts no more * than the runtime and must be completed by time instant t equal to * the instance activation time + the deadline. * * This is reflected by the actual fields of the sched_attr structure: * * @size size of the structure, for fwd/bwd compat. * * @sched_policy task's scheduling policy * @sched_flags for customizing the scheduler behaviour * @sched_nice task's nice value (SCHED_NORMAL/BATCH) * @sched_priority task's static priority (SCHED_FIFO/RR) * @sched_deadline representative of the task's deadline * @sched_runtime representative of the task's runtime * @sched_period representative of the task's period * * Given this task model, there are a multiplicity of scheduling algorithms * and policies, that can be used to ensure all the tasks will make their * timing constraints. * * As of now, the SCHED_DEADLINE policy (sched_dl scheduling class) is the * only user of this new interface. More information about the algorithm * available in the scheduling class file or in Documentation/. */ struct sched_attr { __u32 size; __u32 sched_policy; __u64 sched_flags; /* SCHED_NORMAL, SCHED_BATCH */ __s32 sched_nice; /* SCHED_FIFO, SCHED_RR */ __u32 sched_priority; /* SCHED_DEADLINE */ __u64 sched_runtime; __u64 sched_deadline; __u64 sched_period; }; #endif /* _LINUX_SCHED_TYPES_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/kernel.h��������������������������������������������������������������������������������������0000644�����������������00000000302�14763166027�0007343 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_KERNEL_H #define _LINUX_KERNEL_H #include <linux/sysinfo.h> #include <linux/const.h> #endif /* _LINUX_KERNEL_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/x25.h�����������������������������������������������������������������������������������������0000644�����������������00000006752�14763166027�0006520 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * These are the public elements of the Linux kernel X.25 implementation. * * History * mar/20/00 Daniela Squassoni Disabling/enabling of facilities * negotiation. * apr/02/05 Shaun Pereira Selective sub address matching with * call user data */ #ifndef X25_KERNEL_H #define X25_KERNEL_H #include <linux/types.h> #include <linux/socket.h> #define SIOCX25GSUBSCRIP (SIOCPROTOPRIVATE + 0) #define SIOCX25SSUBSCRIP (SIOCPROTOPRIVATE + 1) #define SIOCX25GFACILITIES (SIOCPROTOPRIVATE + 2) #define SIOCX25SFACILITIES (SIOCPROTOPRIVATE + 3) #define SIOCX25GCALLUSERDATA (SIOCPROTOPRIVATE + 4) #define SIOCX25SCALLUSERDATA (SIOCPROTOPRIVATE + 5) #define SIOCX25GCAUSEDIAG (SIOCPROTOPRIVATE + 6) #define SIOCX25SCUDMATCHLEN (SIOCPROTOPRIVATE + 7) #define SIOCX25CALLACCPTAPPRV (SIOCPROTOPRIVATE + 8) #define SIOCX25SENDCALLACCPT (SIOCPROTOPRIVATE + 9) #define SIOCX25GDTEFACILITIES (SIOCPROTOPRIVATE + 10) #define SIOCX25SDTEFACILITIES (SIOCPROTOPRIVATE + 11) #define SIOCX25SCAUSEDIAG (SIOCPROTOPRIVATE + 12) /* * Values for {get,set}sockopt. */ #define X25_QBITINCL 1 /* * X.25 Packet Size values. */ #define X25_PS16 4 #define X25_PS32 5 #define X25_PS64 6 #define X25_PS128 7 #define X25_PS256 8 #define X25_PS512 9 #define X25_PS1024 10 #define X25_PS2048 11 #define X25_PS4096 12 /* * An X.121 address, it is held as ASCII text, null terminated, up to 15 * digits and a null terminator. */ struct x25_address { char x25_addr[16]; }; /* * Linux X.25 Address structure, used for bind, and connect mostly. */ struct sockaddr_x25 { __kernel_sa_family_t sx25_family; /* Must be AF_X25 */ struct x25_address sx25_addr; /* X.121 Address */ }; /* * DTE/DCE subscription options. * * As this is missing lots of options, user should expect major * changes of this structure in 2.5.x which might break compatibilty. * The somewhat ugly dimension 200-sizeof() is needed to maintain * backward compatibility. */ struct x25_subscrip_struct { char device[200-sizeof(unsigned long)]; unsigned long global_facil_mask; /* 0 to disable negotiation */ unsigned int extended; }; /* values for above global_facil_mask */ #define X25_MASK_REVERSE 0x01 #define X25_MASK_THROUGHPUT 0x02 #define X25_MASK_PACKET_SIZE 0x04 #define X25_MASK_WINDOW_SIZE 0x08 #define X25_MASK_CALLING_AE 0x10 #define X25_MASK_CALLED_AE 0x20 /* * Routing table control structure. */ struct x25_route_struct { struct x25_address address; unsigned int sigdigits; char device[200]; }; /* * Facilities structure. */ struct x25_facilities { unsigned int winsize_in, winsize_out; unsigned int pacsize_in, pacsize_out; unsigned int throughput; unsigned int reverse; }; /* * ITU DTE facilities * Only the called and calling address * extension are currently implemented. * The rest are in place to avoid the struct * changing size if someone needs them later */ struct x25_dte_facilities { __u16 delay_cumul; __u16 delay_target; __u16 delay_max; __u8 min_throughput; __u8 expedited; __u8 calling_len; __u8 called_len; __u8 calling_ae[20]; __u8 called_ae[20]; }; /* * Call User Data structure. */ struct x25_calluserdata { unsigned int cudlength; unsigned char cuddata[128]; }; /* * Call clearing Cause and Diagnostic structure. */ struct x25_causediag { unsigned char cause; unsigned char diagnostic; }; /* * Further optional call user data match length selection */ struct x25_subaddr { unsigned int cudmatchlength; }; #endif ����������������������linux/elf-fdpic.h�����������������������������������������������������������������������������������0000644�����������������00000002144�14763166027�0007722 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* elf-fdpic.h: FDPIC ELF load map * * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) * * 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. */ #ifndef _LINUX_ELF_FDPIC_H #define _LINUX_ELF_FDPIC_H #include <linux/elf.h> #define PT_GNU_STACK (PT_LOOS + 0x474e551) /* segment mappings for ELF FDPIC libraries/executables/interpreters */ struct elf32_fdpic_loadseg { Elf32_Addr addr; /* core address to which mapped */ Elf32_Addr p_vaddr; /* VMA recorded in file */ Elf32_Word p_memsz; /* allocation size recorded in file */ }; struct elf32_fdpic_loadmap { Elf32_Half version; /* version of these structures, just in case... */ Elf32_Half nsegs; /* number of segments */ struct elf32_fdpic_loadseg segs[]; }; #define ELF32_FDPIC_LOADMAP_VERSION 0x0000 #endif /* _LINUX_ELF_FDPIC_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/unix_diag.h�����������������������������������������������������������������������������������0000644�����������������00000002345�14763166027�0010043 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __UNIX_DIAG_H__ #define __UNIX_DIAG_H__ #include <linux/types.h> struct unix_diag_req { __u8 sdiag_family; __u8 sdiag_protocol; __u16 pad; __u32 udiag_states; __u32 udiag_ino; __u32 udiag_show; __u32 udiag_cookie[2]; }; #define UDIAG_SHOW_NAME 0x00000001 /* show name (not path) */ #define UDIAG_SHOW_VFS 0x00000002 /* show VFS inode info */ #define UDIAG_SHOW_PEER 0x00000004 /* show peer socket info */ #define UDIAG_SHOW_ICONS 0x00000008 /* show pending connections */ #define UDIAG_SHOW_RQLEN 0x00000010 /* show skb receive queue len */ #define UDIAG_SHOW_MEMINFO 0x00000020 /* show memory info of a socket */ struct unix_diag_msg { __u8 udiag_family; __u8 udiag_type; __u8 udiag_state; __u8 pad; __u32 udiag_ino; __u32 udiag_cookie[2]; }; enum { /* UNIX_DIAG_NONE, standard nl API requires this attribute! */ UNIX_DIAG_NAME, UNIX_DIAG_VFS, UNIX_DIAG_PEER, UNIX_DIAG_ICONS, UNIX_DIAG_RQLEN, UNIX_DIAG_MEMINFO, UNIX_DIAG_SHUTDOWN, __UNIX_DIAG_MAX, }; #define UNIX_DIAG_MAX (__UNIX_DIAG_MAX - 1) struct unix_diag_vfs { __u32 udiag_vfs_ino; __u32 udiag_vfs_dev; }; struct unix_diag_rqlen { __u32 udiag_rqueue; __u32 udiag_wqueue; }; #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/atm_idt77105.h��������������������������������������������������������������������������������0000644�����������������00000001673�14763166027�0010124 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atm_idt77105.h - Driver-specific declarations of the IDT77105 driver (for * use by driver-specific utilities) */ /* Written 1999 by Greg Banks <gnb@linuxfan.com>. Copied from atm_suni.h. */ #ifndef LINUX_ATM_IDT77105_H #define LINUX_ATM_IDT77105_H #include <linux/types.h> #include <linux/atmioc.h> #include <linux/atmdev.h> /* * Structure for IDT77105_GETSTAT and IDT77105_GETSTATZ ioctls. * Pointed to by `arg' in atmif_sioc. */ struct idt77105_stats { __u32 symbol_errors; /* wire symbol errors */ __u32 tx_cells; /* cells transmitted */ __u32 rx_cells; /* cells received */ __u32 rx_hec_errors; /* Header Error Check errors on receive */ }; #define IDT77105_GETSTAT _IOW('a',ATMIOC_PHYPRV+2,struct atmif_sioc) /* get stats */ #define IDT77105_GETSTATZ _IOW('a',ATMIOC_PHYPRV+3,struct atmif_sioc) /* get stats and zero */ #endif ���������������������������������������������������������������������linux/sunrpc/debug.h��������������������������������������������������������������������������������0000644�����������������00000002170�14763166027�0010470 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/include/linux/sunrpc/debug.h * * Debugging support for sunrpc module * * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> */ #ifndef _LINUX_SUNRPC_DEBUG_H_ #define _LINUX_SUNRPC_DEBUG_H_ /* * RPC debug facilities */ #define RPCDBG_XPRT 0x0001 #define RPCDBG_CALL 0x0002 #define RPCDBG_DEBUG 0x0004 #define RPCDBG_NFS 0x0008 #define RPCDBG_AUTH 0x0010 #define RPCDBG_BIND 0x0020 #define RPCDBG_SCHED 0x0040 #define RPCDBG_TRANS 0x0080 #define RPCDBG_SVCXPRT 0x0100 #define RPCDBG_SVCDSP 0x0200 #define RPCDBG_MISC 0x0400 #define RPCDBG_CACHE 0x0800 #define RPCDBG_ALL 0x7fff /* * Declarations for the sysctl debug interface, which allows to read or * change the debug flags for rpc, nfs, nfsd, and lockd. Since the sunrpc * module currently registers its sysctl table dynamically, the sysctl path * for module FOO is <CTL_SUNRPC, CTL_FOODEBUG>. */ enum { CTL_RPCDEBUG = 1, CTL_NFSDEBUG, CTL_NFSDDEBUG, CTL_NLMDEBUG, CTL_SLOTTABLE_UDP, CTL_SLOTTABLE_TCP, CTL_MIN_RESVPORT, CTL_MAX_RESVPORT, }; #endif /* _LINUX_SUNRPC_DEBUG_H_ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/bsg.h�����������������������������������������������������������������������������������������0000644�����������������00000004676�14763166027�0006660 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef BSG_H #define BSG_H #include <linux/types.h> #define BSG_PROTOCOL_SCSI 0 #define BSG_SUB_PROTOCOL_SCSI_CMD 0 #define BSG_SUB_PROTOCOL_SCSI_TMF 1 #define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2 /* * For flag constants below: * sg.h sg_io_hdr also has bits defined for it's flags member. These * two flag values (0x10 and 0x20) have the same meaning in sg.h . For * bsg the BSG_FLAG_Q_AT_HEAD flag is ignored since it is the deafult. */ #define BSG_FLAG_Q_AT_TAIL 0x10 /* default is Q_AT_HEAD */ #define BSG_FLAG_Q_AT_HEAD 0x20 struct sg_io_v4 { __s32 guard; /* [i] 'Q' to differentiate from v3 */ __u32 protocol; /* [i] 0 -> SCSI , .... */ __u32 subprotocol; /* [i] 0 -> SCSI command, 1 -> SCSI task management function, .... */ __u32 request_len; /* [i] in bytes */ __u64 request; /* [i], [*i] {SCSI: cdb} */ __u64 request_tag; /* [i] {SCSI: task tag (only if flagged)} */ __u32 request_attr; /* [i] {SCSI: task attribute} */ __u32 request_priority; /* [i] {SCSI: task priority} */ __u32 request_extra; /* [i] {spare, for padding} */ __u32 max_response_len; /* [i] in bytes */ __u64 response; /* [i], [*o] {SCSI: (auto)sense data} */ /* "dout_": data out (to device); "din_": data in (from device) */ __u32 dout_iovec_count; /* [i] 0 -> "flat" dout transfer else dout_xfer points to array of iovec */ __u32 dout_xfer_len; /* [i] bytes to be transferred to device */ __u32 din_iovec_count; /* [i] 0 -> "flat" din transfer */ __u32 din_xfer_len; /* [i] bytes to be transferred from device */ __u64 dout_xferp; /* [i], [*i] */ __u64 din_xferp; /* [i], [*o] */ __u32 timeout; /* [i] units: millisecond */ __u32 flags; /* [i] bit mask */ __u64 usr_ptr; /* [i->o] unused internally */ __u32 spare_in; /* [i] */ __u32 driver_status; /* [o] 0 -> ok */ __u32 transport_status; /* [o] 0 -> ok */ __u32 device_status; /* [o] {SCSI: command completion status} */ __u32 retry_delay; /* [o] {SCSI: status auxiliary information} */ __u32 info; /* [o] additional information */ __u32 duration; /* [o] time to complete, in milliseconds */ __u32 response_len; /* [o] bytes of response actually written */ __s32 din_resid; /* [o] din_xfer_len - actual_din_xfer_len */ __s32 dout_resid; /* [o] dout_xfer_len - actual_dout_xfer_len */ __u64 generated_tag; /* [o] {SCSI: transport generated task tag} */ __u32 spare_out; /* [o] */ __u32 padding; }; #endif /* BSG_H */ ������������������������������������������������������������������linux/sysinfo.h�������������������������������������������������������������������������������������0000644�����������������00000002031�14763166027�0007556 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SYSINFO_H #define _LINUX_SYSINFO_H #include <linux/types.h> #define SI_LOAD_SHIFT 16 struct sysinfo { __kernel_long_t uptime; /* Seconds since boot */ __kernel_ulong_t loads[3]; /* 1, 5, and 15 minute load averages */ __kernel_ulong_t totalram; /* Total usable main memory size */ __kernel_ulong_t freeram; /* Available memory size */ __kernel_ulong_t sharedram; /* Amount of shared memory */ __kernel_ulong_t bufferram; /* Memory used by buffers */ __kernel_ulong_t totalswap; /* Total swap space size */ __kernel_ulong_t freeswap; /* swap space still available */ __u16 procs; /* Number of current processes */ __u16 pad; /* Explicit padding for m68k */ __kernel_ulong_t totalhigh; /* Total high memory size */ __kernel_ulong_t freehigh; /* Available high memory size */ __u32 mem_unit; /* Memory unit size in bytes */ char _f[20-2*sizeof(__kernel_ulong_t)-sizeof(__u32)]; /* Padding: libc5 uses this.. */ }; #endif /* _LINUX_SYSINFO_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/lwtunnel.h������������������������������������������������������������������������������������0000644�����������������00000002371�14763166027�0007743 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LWTUNNEL_H_ #define _LWTUNNEL_H_ #include <linux/types.h> enum lwtunnel_encap_types { LWTUNNEL_ENCAP_NONE, LWTUNNEL_ENCAP_MPLS, LWTUNNEL_ENCAP_IP, LWTUNNEL_ENCAP_ILA, LWTUNNEL_ENCAP_IP6, LWTUNNEL_ENCAP_SEG6, LWTUNNEL_ENCAP_BPF, LWTUNNEL_ENCAP_SEG6_LOCAL, __LWTUNNEL_ENCAP_MAX, }; #define LWTUNNEL_ENCAP_MAX (__LWTUNNEL_ENCAP_MAX - 1) enum lwtunnel_ip_t { LWTUNNEL_IP_UNSPEC, LWTUNNEL_IP_ID, LWTUNNEL_IP_DST, LWTUNNEL_IP_SRC, LWTUNNEL_IP_TTL, LWTUNNEL_IP_TOS, LWTUNNEL_IP_FLAGS, LWTUNNEL_IP_PAD, __LWTUNNEL_IP_MAX, }; #define LWTUNNEL_IP_MAX (__LWTUNNEL_IP_MAX - 1) enum lwtunnel_ip6_t { LWTUNNEL_IP6_UNSPEC, LWTUNNEL_IP6_ID, LWTUNNEL_IP6_DST, LWTUNNEL_IP6_SRC, LWTUNNEL_IP6_HOPLIMIT, LWTUNNEL_IP6_TC, LWTUNNEL_IP6_FLAGS, LWTUNNEL_IP6_PAD, __LWTUNNEL_IP6_MAX, }; #define LWTUNNEL_IP6_MAX (__LWTUNNEL_IP6_MAX - 1) enum { LWT_BPF_PROG_UNSPEC, LWT_BPF_PROG_FD, LWT_BPF_PROG_NAME, __LWT_BPF_PROG_MAX, }; #define LWT_BPF_PROG_MAX (__LWT_BPF_PROG_MAX - 1) enum { LWT_BPF_UNSPEC, LWT_BPF_IN, LWT_BPF_OUT, LWT_BPF_XMIT, LWT_BPF_XMIT_HEADROOM, __LWT_BPF_MAX, }; #define LWT_BPF_MAX (__LWT_BPF_MAX - 1) #define LWT_BPF_MAX_HEADROOM 256 #endif /* _LWTUNNEL_H_ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/watchdog.h������������������������������������������������������������������������������������0000644�����������������00000004437�14763166027�0007700 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Generic watchdog defines. Derived from.. * * Berkshire PC Watchdog Defines * by Ken Hollis <khollis@bitgate.com> * */ #ifndef _LINUX_WATCHDOG_H #define _LINUX_WATCHDOG_H #include <linux/ioctl.h> #include <linux/types.h> #define WATCHDOG_IOCTL_BASE 'W' struct watchdog_info { __u32 options; /* Options the card/driver supports */ __u32 firmware_version; /* Firmware version of the card */ __u8 identity[32]; /* Identity of the board */ }; #define WDIOC_GETSUPPORT _IOR(WATCHDOG_IOCTL_BASE, 0, struct watchdog_info) #define WDIOC_GETSTATUS _IOR(WATCHDOG_IOCTL_BASE, 1, int) #define WDIOC_GETBOOTSTATUS _IOR(WATCHDOG_IOCTL_BASE, 2, int) #define WDIOC_GETTEMP _IOR(WATCHDOG_IOCTL_BASE, 3, int) #define WDIOC_SETOPTIONS _IOR(WATCHDOG_IOCTL_BASE, 4, int) #define WDIOC_KEEPALIVE _IOR(WATCHDOG_IOCTL_BASE, 5, int) #define WDIOC_SETTIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 6, int) #define WDIOC_GETTIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 7, int) #define WDIOC_SETPRETIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 8, int) #define WDIOC_GETPRETIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 9, int) #define WDIOC_GETTIMELEFT _IOR(WATCHDOG_IOCTL_BASE, 10, int) #define WDIOF_UNKNOWN -1 /* Unknown flag error */ #define WDIOS_UNKNOWN -1 /* Unknown status error */ #define WDIOF_OVERHEAT 0x0001 /* Reset due to CPU overheat */ #define WDIOF_FANFAULT 0x0002 /* Fan failed */ #define WDIOF_EXTERN1 0x0004 /* External relay 1 */ #define WDIOF_EXTERN2 0x0008 /* External relay 2 */ #define WDIOF_POWERUNDER 0x0010 /* Power bad/power fault */ #define WDIOF_CARDRESET 0x0020 /* Card previously reset the CPU */ #define WDIOF_POWEROVER 0x0040 /* Power over voltage */ #define WDIOF_SETTIMEOUT 0x0080 /* Set timeout (in seconds) */ #define WDIOF_MAGICCLOSE 0x0100 /* Supports magic close char */ #define WDIOF_PRETIMEOUT 0x0200 /* Pretimeout (in seconds), get/set */ #define WDIOF_ALARMONLY 0x0400 /* Watchdog triggers a management or other external alarm not a reboot */ #define WDIOF_KEEPALIVEPING 0x8000 /* Keep alive ping reply */ #define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */ #define WDIOS_ENABLECARD 0x0002 /* Turn on the watchdog timer */ #define WDIOS_TEMPPANIC 0x0004 /* Kernel panic on temperature trip */ #endif /* _LINUX_WATCHDOG_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/net_dropmon.h���������������������������������������������������������������������������������0000644�����������������00000002202�14763166027�0010410 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __NET_DROPMON_H #define __NET_DROPMON_H #include <linux/types.h> #include <linux/netlink.h> struct net_dm_drop_point { __u8 pc[8]; __u32 count; }; #define is_drop_point_hw(x) do {\ int ____i, ____j;\ for (____i = 0; ____i < 8; i ____i++)\ ____j |= x[____i];\ ____j;\ } while (0) #define NET_DM_CFG_VERSION 0 #define NET_DM_CFG_ALERT_COUNT 1 #define NET_DM_CFG_ALERT_DELAY 2 #define NET_DM_CFG_MAX 3 struct net_dm_config_entry { __u32 type; __u64 data __attribute__((aligned(8))); }; struct net_dm_config_msg { __u32 entries; struct net_dm_config_entry options[0]; }; struct net_dm_alert_msg { __u32 entries; struct net_dm_drop_point points[0]; }; struct net_dm_user_msg { union { struct net_dm_config_msg user; struct net_dm_alert_msg alert; } u; }; /* These are the netlink message types for this protocol */ enum { NET_DM_CMD_UNSPEC = 0, NET_DM_CMD_ALERT, NET_DM_CMD_CONFIG, NET_DM_CMD_START, NET_DM_CMD_STOP, _NET_DM_CMD_MAX, }; #define NET_DM_CMD_MAX (_NET_DM_CMD_MAX - 1) /* * Our group identifiers */ #define NET_DM_GRP_ALERT 1 #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/bpf.h�����������������������������������������������������������������������������������������0000644�����������������00000323170�14763166027�0006645 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. */ #ifndef __LINUX_BPF_H__ #define __LINUX_BPF_H__ #include <linux/types.h> #include <linux/bpf_common.h> /* Extended instruction set based on top of classic BPF */ /* instruction classes */ #define BPF_ALU64 0x07 /* alu mode in double word width */ /* ld/ldx fields */ #define BPF_DW 0x18 /* double word (64-bit) */ #define BPF_XADD 0xc0 /* exclusive add */ /* alu/jmp fields */ #define BPF_MOV 0xb0 /* mov reg to reg */ #define BPF_ARSH 0xc0 /* sign extending arithmetic shift right */ /* change endianness of a register */ #define BPF_END 0xd0 /* flags for endianness conversion: */ #define BPF_TO_LE 0x00 /* convert to little-endian */ #define BPF_TO_BE 0x08 /* convert to big-endian */ #define BPF_FROM_LE BPF_TO_LE #define BPF_FROM_BE BPF_TO_BE /* jmp encodings */ #define BPF_JNE 0x50 /* jump != */ #define BPF_JLT 0xa0 /* LT is unsigned, '<' */ #define BPF_JLE 0xb0 /* LE is unsigned, '<=' */ #define BPF_JSGT 0x60 /* SGT is signed '>', GT in x86 */ #define BPF_JSGE 0x70 /* SGE is signed '>=', GE in x86 */ #define BPF_JSLT 0xc0 /* SLT is signed, '<' */ #define BPF_JSLE 0xd0 /* SLE is signed, '<=' */ #define BPF_CALL 0x80 /* function call */ #define BPF_EXIT 0x90 /* function return */ /* Register numbers */ enum { BPF_REG_0 = 0, BPF_REG_1, BPF_REG_2, BPF_REG_3, BPF_REG_4, BPF_REG_5, BPF_REG_6, BPF_REG_7, BPF_REG_8, BPF_REG_9, BPF_REG_10, __MAX_BPF_REG, }; /* BPF has 10 general purpose 64-bit registers and stack frame. */ #define MAX_BPF_REG __MAX_BPF_REG struct bpf_insn { __u8 code; /* opcode */ __u8 dst_reg:4; /* dest register */ __u8 src_reg:4; /* source register */ __s16 off; /* signed offset */ __s32 imm; /* signed immediate constant */ }; /* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */ struct bpf_lpm_trie_key { __u32 prefixlen; /* up to 32 for AF_INET, 128 for AF_INET6 */ __u8 data[0]; /* Arbitrary size */ }; struct bpf_cgroup_storage_key { __u64 cgroup_inode_id; /* cgroup inode id */ __u32 attach_type; /* program attach type */ }; /* BPF syscall commands, see bpf(2) man-page for details. */ enum bpf_cmd { BPF_MAP_CREATE, BPF_MAP_LOOKUP_ELEM, BPF_MAP_UPDATE_ELEM, BPF_MAP_DELETE_ELEM, BPF_MAP_GET_NEXT_KEY, BPF_PROG_LOAD, BPF_OBJ_PIN, BPF_OBJ_GET, BPF_PROG_ATTACH, BPF_PROG_DETACH, BPF_PROG_TEST_RUN, BPF_PROG_GET_NEXT_ID, BPF_MAP_GET_NEXT_ID, BPF_PROG_GET_FD_BY_ID, BPF_MAP_GET_FD_BY_ID, BPF_OBJ_GET_INFO_BY_FD, BPF_PROG_QUERY, BPF_RAW_TRACEPOINT_OPEN, BPF_BTF_LOAD, BPF_BTF_GET_FD_BY_ID, BPF_TASK_FD_QUERY, }; enum bpf_map_type { BPF_MAP_TYPE_UNSPEC, BPF_MAP_TYPE_HASH, BPF_MAP_TYPE_ARRAY, BPF_MAP_TYPE_PROG_ARRAY, BPF_MAP_TYPE_PERF_EVENT_ARRAY, BPF_MAP_TYPE_PERCPU_HASH, BPF_MAP_TYPE_PERCPU_ARRAY, BPF_MAP_TYPE_STACK_TRACE, BPF_MAP_TYPE_CGROUP_ARRAY, BPF_MAP_TYPE_LRU_HASH, BPF_MAP_TYPE_LRU_PERCPU_HASH, BPF_MAP_TYPE_LPM_TRIE, BPF_MAP_TYPE_ARRAY_OF_MAPS, BPF_MAP_TYPE_HASH_OF_MAPS, BPF_MAP_TYPE_DEVMAP, BPF_MAP_TYPE_SOCKMAP, BPF_MAP_TYPE_CPUMAP, BPF_MAP_TYPE_XSKMAP, BPF_MAP_TYPE_SOCKHASH, BPF_MAP_TYPE_CGROUP_STORAGE, BPF_MAP_TYPE_REUSEPORT_SOCKARRAY, }; enum bpf_prog_type { BPF_PROG_TYPE_UNSPEC, BPF_PROG_TYPE_SOCKET_FILTER, BPF_PROG_TYPE_KPROBE, BPF_PROG_TYPE_SCHED_CLS, BPF_PROG_TYPE_SCHED_ACT, BPF_PROG_TYPE_TRACEPOINT, BPF_PROG_TYPE_XDP, BPF_PROG_TYPE_PERF_EVENT, BPF_PROG_TYPE_CGROUP_SKB, BPF_PROG_TYPE_CGROUP_SOCK, BPF_PROG_TYPE_LWT_IN, BPF_PROG_TYPE_LWT_OUT, BPF_PROG_TYPE_LWT_XMIT, BPF_PROG_TYPE_SOCK_OPS, BPF_PROG_TYPE_SK_SKB, BPF_PROG_TYPE_CGROUP_DEVICE, BPF_PROG_TYPE_SK_MSG, BPF_PROG_TYPE_RAW_TRACEPOINT, BPF_PROG_TYPE_CGROUP_SOCK_ADDR, BPF_PROG_TYPE_LWT_SEG6LOCAL, BPF_PROG_TYPE_LIRC_MODE2, BPF_PROG_TYPE_SK_REUSEPORT, }; enum bpf_attach_type { BPF_CGROUP_INET_INGRESS, BPF_CGROUP_INET_EGRESS, BPF_CGROUP_INET_SOCK_CREATE, BPF_CGROUP_SOCK_OPS, BPF_SK_SKB_STREAM_PARSER, BPF_SK_SKB_STREAM_VERDICT, BPF_CGROUP_DEVICE, BPF_SK_MSG_VERDICT, BPF_CGROUP_INET4_BIND, BPF_CGROUP_INET6_BIND, BPF_CGROUP_INET4_CONNECT, BPF_CGROUP_INET6_CONNECT, BPF_CGROUP_INET4_POST_BIND, BPF_CGROUP_INET6_POST_BIND, BPF_CGROUP_UDP4_SENDMSG, BPF_CGROUP_UDP6_SENDMSG, BPF_LIRC_MODE2, BPF_CGROUP_UDP4_RECVMSG = 19, BPF_CGROUP_UDP6_RECVMSG, __MAX_BPF_ATTACH_TYPE }; #define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE /* cgroup-bpf attach flags used in BPF_PROG_ATTACH command * * NONE(default): No further bpf programs allowed in the subtree. * * BPF_F_ALLOW_OVERRIDE: If a sub-cgroup installs some bpf program, * the program in this cgroup yields to sub-cgroup program. * * BPF_F_ALLOW_MULTI: If a sub-cgroup installs some bpf program, * that cgroup program gets run in addition to the program in this cgroup. * * Only one program is allowed to be attached to a cgroup with * NONE or BPF_F_ALLOW_OVERRIDE flag. * Attaching another program on top of NONE or BPF_F_ALLOW_OVERRIDE will * release old program and attach the new one. Attach flags has to match. * * Multiple programs are allowed to be attached to a cgroup with * BPF_F_ALLOW_MULTI flag. They are executed in FIFO order * (those that were attached first, run first) * The programs of sub-cgroup are executed first, then programs of * this cgroup and then programs of parent cgroup. * When children program makes decision (like picking TCP CA or sock bind) * parent program has a chance to override it. * * A cgroup with MULTI or OVERRIDE flag allows any attach flags in sub-cgroups. * A cgroup with NONE doesn't allow any programs in sub-cgroups. * Ex1: * cgrp1 (MULTI progs A, B) -> * cgrp2 (OVERRIDE prog C) -> * cgrp3 (MULTI prog D) -> * cgrp4 (OVERRIDE prog E) -> * cgrp5 (NONE prog F) * the event in cgrp5 triggers execution of F,D,A,B in that order. * if prog F is detached, the execution is E,D,A,B * if prog F and D are detached, the execution is E,A,B * if prog F, E and D are detached, the execution is C,A,B * * All eligible programs are executed regardless of return code from * earlier programs. */ #define BPF_F_ALLOW_OVERRIDE (1U << 0) #define BPF_F_ALLOW_MULTI (1U << 1) /* If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the * verifier will perform strict alignment checking as if the kernel * has been built with CONFIG_EFFICIENT_UNALIGNED_ACCESS not set, * and NET_IP_ALIGN defined to 2. */ #define BPF_F_STRICT_ALIGNMENT (1U << 0) /* If BPF_F_ANY_ALIGNMENT is used in BPF_PROF_LOAD command, the * verifier will allow any alignment whatsoever. On platforms * with strict alignment requirements for loads ands stores (such * as sparc and mips) the verifier validates that all loads and * stores provably follow this requirement. This flag turns that * checking and enforcement off. * * It is mostly used for testing when we want to validate the * context and memory access aspects of the verifier, but because * of an unaligned access the alignment check would trigger before * the one we are interested in. */ #define BPF_F_ANY_ALIGNMENT (1U << 1) /* when bpf_ldimm64->src_reg == BPF_PSEUDO_MAP_FD, bpf_ldimm64->imm == fd */ #define BPF_PSEUDO_MAP_FD 1 /* when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative * offset to another bpf function */ #define BPF_PSEUDO_CALL 1 /* flags for BPF_MAP_UPDATE_ELEM command */ #define BPF_ANY 0 /* create new element or update existing */ #define BPF_NOEXIST 1 /* create new element if it didn't exist */ #define BPF_EXIST 2 /* update existing element */ /* flags for BPF_MAP_CREATE command */ #define BPF_F_NO_PREALLOC (1U << 0) /* Instead of having one common LRU list in the * BPF_MAP_TYPE_LRU_[PERCPU_]HASH map, use a percpu LRU list * which can scale and perform better. * Note, the LRU nodes (including free nodes) cannot be moved * across different LRU lists. */ #define BPF_F_NO_COMMON_LRU (1U << 1) /* Specify numa node during map creation */ #define BPF_F_NUMA_NODE (1U << 2) /* flags for BPF_PROG_QUERY */ #define BPF_F_QUERY_EFFECTIVE (1U << 0) #define BPF_OBJ_NAME_LEN 16U /* Flags for accessing BPF object */ #define BPF_F_RDONLY (1U << 3) #define BPF_F_WRONLY (1U << 4) /* Flag for stack_map, store build_id+offset instead of pointer */ #define BPF_F_STACK_BUILD_ID (1U << 5) enum bpf_stack_build_id_status { /* user space need an empty entry to identify end of a trace */ BPF_STACK_BUILD_ID_EMPTY = 0, /* with valid build_id and offset */ BPF_STACK_BUILD_ID_VALID = 1, /* couldn't get build_id, fallback to ip */ BPF_STACK_BUILD_ID_IP = 2, }; #define BPF_BUILD_ID_SIZE 20 struct bpf_stack_build_id { __s32 status; unsigned char build_id[BPF_BUILD_ID_SIZE]; union { __u64 offset; __u64 ip; }; }; union bpf_attr { struct { /* anonymous struct used by BPF_MAP_CREATE command */ __u32 map_type; /* one of enum bpf_map_type */ __u32 key_size; /* size of key in bytes */ __u32 value_size; /* size of value in bytes */ __u32 max_entries; /* max number of entries in a map */ __u32 map_flags; /* BPF_MAP_CREATE related * flags defined above. */ __u32 inner_map_fd; /* fd pointing to the inner map */ __u32 numa_node; /* numa node (effective only if * BPF_F_NUMA_NODE is set). */ char map_name[BPF_OBJ_NAME_LEN]; __u32 map_ifindex; /* ifindex of netdev to create on */ __u32 btf_fd; /* fd pointing to a BTF type data */ __u32 btf_key_type_id; /* BTF type_id of the key */ __u32 btf_value_type_id; /* BTF type_id of the value */ }; struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ __u32 map_fd; __aligned_u64 key; union { __aligned_u64 value; __aligned_u64 next_key; }; __u64 flags; }; struct { /* anonymous struct used by BPF_PROG_LOAD command */ __u32 prog_type; /* one of enum bpf_prog_type */ __u32 insn_cnt; __aligned_u64 insns; __aligned_u64 license; __u32 log_level; /* verbosity level of verifier */ __u32 log_size; /* size of user buffer */ __aligned_u64 log_buf; /* user supplied buffer */ __u32 kern_version; /* checked when prog_type=kprobe */ __u32 prog_flags; char prog_name[BPF_OBJ_NAME_LEN]; __u32 prog_ifindex; /* ifindex of netdev to prep for */ /* For some prog types expected attach type must be known at * load time to verify attach type specific parts of prog * (context accesses, allowed helpers, etc). */ __u32 expected_attach_type; }; struct { /* anonymous struct used by BPF_OBJ_* commands */ __aligned_u64 pathname; __u32 bpf_fd; __u32 file_flags; }; struct { /* anonymous struct used by BPF_PROG_ATTACH/DETACH commands */ __u32 target_fd; /* container object to attach to */ __u32 attach_bpf_fd; /* eBPF program to attach */ __u32 attach_type; __u32 attach_flags; }; struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */ __u32 prog_fd; __u32 retval; __u32 data_size_in; __u32 data_size_out; __aligned_u64 data_in; __aligned_u64 data_out; __u32 repeat; __u32 duration; } test; struct { /* anonymous struct used by BPF_*_GET_*_ID */ union { __u32 start_id; __u32 prog_id; __u32 map_id; __u32 btf_id; }; __u32 next_id; __u32 open_flags; }; struct { /* anonymous struct used by BPF_OBJ_GET_INFO_BY_FD */ __u32 bpf_fd; __u32 info_len; __aligned_u64 info; } info; struct { /* anonymous struct used by BPF_PROG_QUERY command */ __u32 target_fd; /* container object to query */ __u32 attach_type; __u32 query_flags; __u32 attach_flags; __aligned_u64 prog_ids; __u32 prog_cnt; } query; struct { __u64 name; __u32 prog_fd; } raw_tracepoint; struct { /* anonymous struct for BPF_BTF_LOAD */ __aligned_u64 btf; __aligned_u64 btf_log_buf; __u32 btf_size; __u32 btf_log_size; __u32 btf_log_level; }; struct { __u32 pid; /* input: pid */ __u32 fd; /* input: fd */ __u32 flags; /* input: flags */ __u32 buf_len; /* input/output: buf len */ __aligned_u64 buf; /* input/output: * tp_name for tracepoint * symbol for kprobe * filename for uprobe */ __u32 prog_id; /* output: prod_id */ __u32 fd_type; /* output: BPF_FD_TYPE_* */ __u64 probe_offset; /* output: probe_offset */ __u64 probe_addr; /* output: probe_addr */ } task_fd_query; } __attribute__((aligned(8))); /* The description below is an attempt at providing documentation to eBPF * developers about the multiple available eBPF helper functions. It can be * parsed and used to produce a manual page. The workflow is the following, * and requires the rst2man utility: * * $ ./scripts/bpf_helpers_doc.py \ * --filename include/uapi/linux/bpf.h > /tmp/bpf-helpers.rst * $ rst2man /tmp/bpf-helpers.rst > /tmp/bpf-helpers.7 * $ man /tmp/bpf-helpers.7 * * Note that in order to produce this external documentation, some RST * formatting is used in the descriptions to get "bold" and "italics" in * manual pages. Also note that the few trailing white spaces are * intentional, removing them would break paragraphs for rst2man. * * Start of BPF helper function descriptions: * * void *bpf_map_lookup_elem(struct bpf_map *map, const void *key) * Description * Perform a lookup in *map* for an entry associated to *key*. * Return * Map value associated to *key*, or **NULL** if no entry was * found. * * int bpf_map_update_elem(struct bpf_map *map, const void *key, const void *value, u64 flags) * Description * Add or update the value of the entry associated to *key* in * *map* with *value*. *flags* is one of: * * **BPF_NOEXIST** * The entry for *key* must not exist in the map. * **BPF_EXIST** * The entry for *key* must already exist in the map. * **BPF_ANY** * No condition on the existence of the entry for *key*. * * Flag value **BPF_NOEXIST** cannot be used for maps of types * **BPF_MAP_TYPE_ARRAY** or **BPF_MAP_TYPE_PERCPU_ARRAY** (all * elements always exist), the helper would return an error. * Return * 0 on success, or a negative error in case of failure. * * int bpf_map_delete_elem(struct bpf_map *map, const void *key) * Description * Delete entry with *key* from *map*. * Return * 0 on success, or a negative error in case of failure. * * int bpf_probe_read(void *dst, u32 size, const void *src) * Description * For tracing programs, safely attempt to read *size* bytes from * address *src* and store the data in *dst*. * Return * 0 on success, or a negative error in case of failure. * * u64 bpf_ktime_get_ns(void) * Description * Return the time elapsed since system boot, in nanoseconds. * Return * Current *ktime*. * * int bpf_trace_printk(const char *fmt, u32 fmt_size, ...) * Description * This helper is a "printk()-like" facility for debugging. It * prints a message defined by format *fmt* (of size *fmt_size*) * to file *\/sys/kernel/debug/tracing/trace* from DebugFS, if * available. It can take up to three additional **u64** * arguments (as an eBPF helpers, the total number of arguments is * limited to five). * * Each time the helper is called, it appends a line to the trace. * The format of the trace is customizable, and the exact output * one will get depends on the options set in * *\/sys/kernel/debug/tracing/trace_options* (see also the * *README* file under the same directory). However, it usually * defaults to something like: * * :: * * telnet-470 [001] .N.. 419421.045894: 0x00000001: <formatted msg> * * In the above: * * * ``telnet`` is the name of the current task. * * ``470`` is the PID of the current task. * * ``001`` is the CPU number on which the task is * running. * * In ``.N..``, each character refers to a set of * options (whether irqs are enabled, scheduling * options, whether hard/softirqs are running, level of * preempt_disabled respectively). **N** means that * **TIF_NEED_RESCHED** and **PREEMPT_NEED_RESCHED** * are set. * * ``419421.045894`` is a timestamp. * * ``0x00000001`` is a fake value used by BPF for the * instruction pointer register. * * ``<formatted msg>`` is the message formatted with * *fmt*. * * The conversion specifiers supported by *fmt* are similar, but * more limited than for printk(). They are **%d**, **%i**, * **%u**, **%x**, **%ld**, **%li**, **%lu**, **%lx**, **%lld**, * **%lli**, **%llu**, **%llx**, **%p**, **%s**. No modifier (size * of field, padding with zeroes, etc.) is available, and the * helper will return **-EINVAL** (but print nothing) if it * encounters an unknown specifier. * * Also, note that **bpf_trace_printk**\ () is slow, and should * only be used for debugging purposes. For this reason, a notice * bloc (spanning several lines) is printed to kernel logs and * states that the helper should not be used "for production use" * the first time this helper is used (or more precisely, when * **trace_printk**\ () buffers are allocated). For passing values * to user space, perf events should be preferred. * Return * The number of bytes written to the buffer, or a negative error * in case of failure. * * u32 bpf_get_prandom_u32(void) * Description * Get a pseudo-random number. * * From a security point of view, this helper uses its own * pseudo-random internal state, and cannot be used to infer the * seed of other random functions in the kernel. However, it is * essential to note that the generator used by the helper is not * cryptographically secure. * Return * A random 32-bit unsigned value. * * u32 bpf_get_smp_processor_id(void) * Description * Get the SMP (symmetric multiprocessing) processor id. Note that * all programs run with preemption disabled, which means that the * SMP processor id is stable during all the execution of the * program. * Return * The SMP id of the processor running the program. * * int bpf_skb_store_bytes(struct sk_buff *skb, u32 offset, const void *from, u32 len, u64 flags) * Description * Store *len* bytes from address *from* into the packet * associated to *skb*, at *offset*. *flags* are a combination of * **BPF_F_RECOMPUTE_CSUM** (automatically recompute the * checksum for the packet after storing the bytes) and * **BPF_F_INVALIDATE_HASH** (set *skb*\ **->hash**, *skb*\ * **->swhash** and *skb*\ **->l4hash** to 0). * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * int bpf_l3_csum_replace(struct sk_buff *skb, u32 offset, u64 from, u64 to, u64 size) * Description * Recompute the layer 3 (e.g. IP) checksum for the packet * associated to *skb*. Computation is incremental, so the helper * must know the former value of the header field that was * modified (*from*), the new value of this field (*to*), and the * number of bytes (2 or 4) for this field, stored in *size*. * Alternatively, it is possible to store the difference between * the previous and the new values of the header field in *to*, by * setting *from* and *size* to 0. For both methods, *offset* * indicates the location of the IP checksum within the packet. * * This helper works in combination with **bpf_csum_diff**\ (), * which does not update the checksum in-place, but offers more * flexibility and can handle sizes larger than 2 or 4 for the * checksum to update. * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * int bpf_l4_csum_replace(struct sk_buff *skb, u32 offset, u64 from, u64 to, u64 flags) * Description * Recompute the layer 4 (e.g. TCP, UDP or ICMP) checksum for the * packet associated to *skb*. Computation is incremental, so the * helper must know the former value of the header field that was * modified (*from*), the new value of this field (*to*), and the * number of bytes (2 or 4) for this field, stored on the lowest * four bits of *flags*. Alternatively, it is possible to store * the difference between the previous and the new values of the * header field in *to*, by setting *from* and the four lowest * bits of *flags* to 0. For both methods, *offset* indicates the * location of the IP checksum within the packet. In addition to * the size of the field, *flags* can be added (bitwise OR) actual * flags. With **BPF_F_MARK_MANGLED_0**, a null checksum is left * untouched (unless **BPF_F_MARK_ENFORCE** is added as well), and * for updates resulting in a null checksum the value is set to * **CSUM_MANGLED_0** instead. Flag **BPF_F_PSEUDO_HDR** indicates * the checksum is to be computed against a pseudo-header. * * This helper works in combination with **bpf_csum_diff**\ (), * which does not update the checksum in-place, but offers more * flexibility and can handle sizes larger than 2 or 4 for the * checksum to update. * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * int bpf_tail_call(void *ctx, struct bpf_map *prog_array_map, u32 index) * Description * This special helper is used to trigger a "tail call", or in * other words, to jump into another eBPF program. The same stack * frame is used (but values on stack and in registers for the * caller are not accessible to the callee). This mechanism allows * for program chaining, either for raising the maximum number of * available eBPF instructions, or to execute given programs in * conditional blocks. For security reasons, there is an upper * limit to the number of successive tail calls that can be * performed. * * Upon call of this helper, the program attempts to jump into a * program referenced at index *index* in *prog_array_map*, a * special map of type **BPF_MAP_TYPE_PROG_ARRAY**, and passes * *ctx*, a pointer to the context. * * If the call succeeds, the kernel immediately runs the first * instruction of the new program. This is not a function call, * and it never returns to the previous program. If the call * fails, then the helper has no effect, and the caller continues * to run its subsequent instructions. A call can fail if the * destination program for the jump does not exist (i.e. *index* * is superior to the number of entries in *prog_array_map*), or * if the maximum number of tail calls has been reached for this * chain of programs. This limit is defined in the kernel by the * macro **MAX_TAIL_CALL_CNT** (not accessible to user space), * which is currently set to 32. * Return * 0 on success, or a negative error in case of failure. * * int bpf_clone_redirect(struct sk_buff *skb, u32 ifindex, u64 flags) * Description * Clone and redirect the packet associated to *skb* to another * net device of index *ifindex*. Both ingress and egress * interfaces can be used for redirection. The **BPF_F_INGRESS** * value in *flags* is used to make the distinction (ingress path * is selected if the flag is present, egress path otherwise). * This is the only flag supported for now. * * In comparison with **bpf_redirect**\ () helper, * **bpf_clone_redirect**\ () has the associated cost of * duplicating the packet buffer, but this can be executed out of * the eBPF program. Conversely, **bpf_redirect**\ () is more * efficient, but it is handled through an action code where the * redirection happens only after the eBPF program has returned. * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * u64 bpf_get_current_pid_tgid(void) * Return * A 64-bit integer containing the current tgid and pid, and * created as such: * *current_task*\ **->tgid << 32 \|** * *current_task*\ **->pid**. * * u64 bpf_get_current_uid_gid(void) * Return * A 64-bit integer containing the current GID and UID, and * created as such: *current_gid* **<< 32 \|** *current_uid*. * * int bpf_get_current_comm(char *buf, u32 size_of_buf) * Description * Copy the **comm** attribute of the current task into *buf* of * *size_of_buf*. The **comm** attribute contains the name of * the executable (excluding the path) for the current task. The * *size_of_buf* must be strictly positive. On success, the * helper makes sure that the *buf* is NUL-terminated. On failure, * it is filled with zeroes. * Return * 0 on success, or a negative error in case of failure. * * u32 bpf_get_cgroup_classid(struct sk_buff *skb) * Description * Retrieve the classid for the current task, i.e. for the net_cls * cgroup to which *skb* belongs. * * This helper can be used on TC egress path, but not on ingress. * * The net_cls cgroup provides an interface to tag network packets * based on a user-provided identifier for all traffic coming from * the tasks belonging to the related cgroup. See also the related * kernel documentation, available from the Linux sources in file * *Documentation/cgroup-v1/net_cls.txt*. * * The Linux kernel has two versions for cgroups: there are * cgroups v1 and cgroups v2. Both are available to users, who can * use a mixture of them, but note that the net_cls cgroup is for * cgroup v1 only. This makes it incompatible with BPF programs * run on cgroups, which is a cgroup-v2-only feature (a socket can * only hold data for one version of cgroups at a time). * * This helper is only available is the kernel was compiled with * the **CONFIG_CGROUP_NET_CLASSID** configuration option set to * "**y**" or to "**m**". * Return * The classid, or 0 for the default unconfigured classid. * * int bpf_skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci) * Description * Push a *vlan_tci* (VLAN tag control information) of protocol * *vlan_proto* to the packet associated to *skb*, then update * the checksum. Note that if *vlan_proto* is different from * **ETH_P_8021Q** and **ETH_P_8021AD**, it is considered to * be **ETH_P_8021Q**. * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * int bpf_skb_vlan_pop(struct sk_buff *skb) * Description * Pop a VLAN header from the packet associated to *skb*. * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * int bpf_skb_get_tunnel_key(struct sk_buff *skb, struct bpf_tunnel_key *key, u32 size, u64 flags) * Description * Get tunnel metadata. This helper takes a pointer *key* to an * empty **struct bpf_tunnel_key** of **size**, that will be * filled with tunnel metadata for the packet associated to *skb*. * The *flags* can be set to **BPF_F_TUNINFO_IPV6**, which * indicates that the tunnel is based on IPv6 protocol instead of * IPv4. * * The **struct bpf_tunnel_key** is an object that generalizes the * principal parameters used by various tunneling protocols into a * single struct. This way, it can be used to easily make a * decision based on the contents of the encapsulation header, * "summarized" in this struct. In particular, it holds the IP * address of the remote end (IPv4 or IPv6, depending on the case) * in *key*\ **->remote_ipv4** or *key*\ **->remote_ipv6**. Also, * this struct exposes the *key*\ **->tunnel_id**, which is * generally mapped to a VNI (Virtual Network Identifier), making * it programmable together with the **bpf_skb_set_tunnel_key**\ * () helper. * * Let's imagine that the following code is part of a program * attached to the TC ingress interface, on one end of a GRE * tunnel, and is supposed to filter out all messages coming from * remote ends with IPv4 address other than 10.0.0.1: * * :: * * int ret; * struct bpf_tunnel_key key = {}; * * ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0); * if (ret < 0) * return TC_ACT_SHOT; // drop packet * * if (key.remote_ipv4 != 0x0a000001) * return TC_ACT_SHOT; // drop packet * * return TC_ACT_OK; // accept packet * * This interface can also be used with all encapsulation devices * that can operate in "collect metadata" mode: instead of having * one network device per specific configuration, the "collect * metadata" mode only requires a single device where the * configuration can be extracted from this helper. * * This can be used together with various tunnels such as VXLan, * Geneve, GRE or IP in IP (IPIP). * Return * 0 on success, or a negative error in case of failure. * * int bpf_skb_set_tunnel_key(struct sk_buff *skb, struct bpf_tunnel_key *key, u32 size, u64 flags) * Description * Populate tunnel metadata for packet associated to *skb.* The * tunnel metadata is set to the contents of *key*, of *size*. The * *flags* can be set to a combination of the following values: * * **BPF_F_TUNINFO_IPV6** * Indicate that the tunnel is based on IPv6 protocol * instead of IPv4. * **BPF_F_ZERO_CSUM_TX** * For IPv4 packets, add a flag to tunnel metadata * indicating that checksum computation should be skipped * and checksum set to zeroes. * **BPF_F_DONT_FRAGMENT** * Add a flag to tunnel metadata indicating that the * packet should not be fragmented. * **BPF_F_SEQ_NUMBER** * Add a flag to tunnel metadata indicating that a * sequence number should be added to tunnel header before * sending the packet. This flag was added for GRE * encapsulation, but might be used with other protocols * as well in the future. * * Here is a typical usage on the transmit path: * * :: * * struct bpf_tunnel_key key; * populate key ... * bpf_skb_set_tunnel_key(skb, &key, sizeof(key), 0); * bpf_clone_redirect(skb, vxlan_dev_ifindex, 0); * * See also the description of the **bpf_skb_get_tunnel_key**\ () * helper for additional information. * Return * 0 on success, or a negative error in case of failure. * * u64 bpf_perf_event_read(struct bpf_map *map, u64 flags) * Description * Read the value of a perf event counter. This helper relies on a * *map* of type **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. The nature of * the perf event counter is selected when *map* is updated with * perf event file descriptors. The *map* is an array whose size * is the number of available CPUs, and each cell contains a value * relative to one CPU. The value to retrieve is indicated by * *flags*, that contains the index of the CPU to look up, masked * with **BPF_F_INDEX_MASK**. Alternatively, *flags* can be set to * **BPF_F_CURRENT_CPU** to indicate that the value for the * current CPU should be retrieved. * * Note that before Linux 4.13, only hardware perf event can be * retrieved. * * Also, be aware that the newer helper * **bpf_perf_event_read_value**\ () is recommended over * **bpf_perf_event_read**\ () in general. The latter has some ABI * quirks where error and counter value are used as a return code * (which is wrong to do since ranges may overlap). This issue is * fixed with **bpf_perf_event_read_value**\ (), which at the same * time provides more features over the **bpf_perf_event_read**\ * () interface. Please refer to the description of * **bpf_perf_event_read_value**\ () for details. * Return * The value of the perf event counter read from the map, or a * negative error code in case of failure. * * int bpf_redirect(u32 ifindex, u64 flags) * Description * Redirect the packet to another net device of index *ifindex*. * This helper is somewhat similar to **bpf_clone_redirect**\ * (), except that the packet is not cloned, which provides * increased performance. * * Except for XDP, both ingress and egress interfaces can be used * for redirection. The **BPF_F_INGRESS** value in *flags* is used * to make the distinction (ingress path is selected if the flag * is present, egress path otherwise). Currently, XDP only * supports redirection to the egress interface, and accepts no * flag at all. * * The same effect can be attained with the more generic * **bpf_redirect_map**\ (), which requires specific maps to be * used but offers better performance. * Return * For XDP, the helper returns **XDP_REDIRECT** on success or * **XDP_ABORTED** on error. For other program types, the values * are **TC_ACT_REDIRECT** on success or **TC_ACT_SHOT** on * error. * * u32 bpf_get_route_realm(struct sk_buff *skb) * Description * Retrieve the realm or the route, that is to say the * **tclassid** field of the destination for the *skb*. The * indentifier retrieved is a user-provided tag, similar to the * one used with the net_cls cgroup (see description for * **bpf_get_cgroup_classid**\ () helper), but here this tag is * held by a route (a destination entry), not by a task. * * Retrieving this identifier works with the clsact TC egress hook * (see also **tc-bpf(8)**), or alternatively on conventional * classful egress qdiscs, but not on TC ingress path. In case of * clsact TC egress hook, this has the advantage that, internally, * the destination entry has not been dropped yet in the transmit * path. Therefore, the destination entry does not need to be * artificially held via **netif_keep_dst**\ () for a classful * qdisc until the *skb* is freed. * * This helper is available only if the kernel was compiled with * **CONFIG_IP_ROUTE_CLASSID** configuration option. * Return * The realm of the route for the packet associated to *skb*, or 0 * if none was found. * * int bpf_perf_event_output(struct pt_reg *ctx, struct bpf_map *map, u64 flags, void *data, u64 size) * Description * Write raw *data* blob into a special BPF perf event held by * *map* of type **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. This perf * event must have the following attributes: **PERF_SAMPLE_RAW** * as **sample_type**, **PERF_TYPE_SOFTWARE** as **type**, and * **PERF_COUNT_SW_BPF_OUTPUT** as **config**. * * The *flags* are used to indicate the index in *map* for which * the value must be put, masked with **BPF_F_INDEX_MASK**. * Alternatively, *flags* can be set to **BPF_F_CURRENT_CPU** * to indicate that the index of the current CPU core should be * used. * * The value to write, of *size*, is passed through eBPF stack and * pointed by *data*. * * The context of the program *ctx* needs also be passed to the * helper. * * On user space, a program willing to read the values needs to * call **perf_event_open**\ () on the perf event (either for * one or for all CPUs) and to store the file descriptor into the * *map*. This must be done before the eBPF program can send data * into it. An example is available in file * *samples/bpf/trace_output_user.c* in the Linux kernel source * tree (the eBPF program counterpart is in * *samples/bpf/trace_output_kern.c*). * * **bpf_perf_event_output**\ () achieves better performance * than **bpf_trace_printk**\ () for sharing data with user * space, and is much better suitable for streaming data from eBPF * programs. * * Note that this helper is not restricted to tracing use cases * and can be used with programs attached to TC or XDP as well, * where it allows for passing data to user space listeners. Data * can be: * * * Only custom structs, * * Only the packet payload, or * * A combination of both. * Return * 0 on success, or a negative error in case of failure. * * int bpf_skb_load_bytes(const struct sk_buff *skb, u32 offset, void *to, u32 len) * Description * This helper was provided as an easy way to load data from a * packet. It can be used to load *len* bytes from *offset* from * the packet associated to *skb*, into the buffer pointed by * *to*. * * Since Linux 4.7, usage of this helper has mostly been replaced * by "direct packet access", enabling packet data to be * manipulated with *skb*\ **->data** and *skb*\ **->data_end** * pointing respectively to the first byte of packet data and to * the byte after the last byte of packet data. However, it * remains useful if one wishes to read large quantities of data * at once from a packet into the eBPF stack. * Return * 0 on success, or a negative error in case of failure. * * int bpf_get_stackid(struct pt_reg *ctx, struct bpf_map *map, u64 flags) * Description * Walk a user or a kernel stack and return its id. To achieve * this, the helper needs *ctx*, which is a pointer to the context * on which the tracing program is executed, and a pointer to a * *map* of type **BPF_MAP_TYPE_STACK_TRACE**. * * The last argument, *flags*, holds the number of stack frames to * skip (from 0 to 255), masked with * **BPF_F_SKIP_FIELD_MASK**. The next bits can be used to set * a combination of the following flags: * * **BPF_F_USER_STACK** * Collect a user space stack instead of a kernel stack. * **BPF_F_FAST_STACK_CMP** * Compare stacks by hash only. * **BPF_F_REUSE_STACKID** * If two different stacks hash into the same *stackid*, * discard the old one. * * The stack id retrieved is a 32 bit long integer handle which * can be further combined with other data (including other stack * ids) and used as a key into maps. This can be useful for * generating a variety of graphs (such as flame graphs or off-cpu * graphs). * * For walking a stack, this helper is an improvement over * **bpf_probe_read**\ (), which can be used with unrolled loops * but is not efficient and consumes a lot of eBPF instructions. * Instead, **bpf_get_stackid**\ () can collect up to * **PERF_MAX_STACK_DEPTH** both kernel and user frames. Note that * this limit can be controlled with the **sysctl** program, and * that it should be manually increased in order to profile long * user stacks (such as stacks for Java programs). To do so, use: * * :: * * # sysctl kernel.perf_event_max_stack=<new value> * Return * The positive or null stack id on success, or a negative error * in case of failure. * * s64 bpf_csum_diff(__be32 *from, u32 from_size, __be32 *to, u32 to_size, __wsum seed) * Description * Compute a checksum difference, from the raw buffer pointed by * *from*, of length *from_size* (that must be a multiple of 4), * towards the raw buffer pointed by *to*, of size *to_size* * (same remark). An optional *seed* can be added to the value * (this can be cascaded, the seed may come from a previous call * to the helper). * * This is flexible enough to be used in several ways: * * * With *from_size* == 0, *to_size* > 0 and *seed* set to * checksum, it can be used when pushing new data. * * With *from_size* > 0, *to_size* == 0 and *seed* set to * checksum, it can be used when removing data from a packet. * * With *from_size* > 0, *to_size* > 0 and *seed* set to 0, it * can be used to compute a diff. Note that *from_size* and * *to_size* do not need to be equal. * * This helper can be used in combination with * **bpf_l3_csum_replace**\ () and **bpf_l4_csum_replace**\ (), to * which one can feed in the difference computed with * **bpf_csum_diff**\ (). * Return * The checksum result, or a negative error code in case of * failure. * * int bpf_skb_get_tunnel_opt(struct sk_buff *skb, u8 *opt, u32 size) * Description * Retrieve tunnel options metadata for the packet associated to * *skb*, and store the raw tunnel option data to the buffer *opt* * of *size*. * * This helper can be used with encapsulation devices that can * operate in "collect metadata" mode (please refer to the related * note in the description of **bpf_skb_get_tunnel_key**\ () for * more details). A particular example where this can be used is * in combination with the Geneve encapsulation protocol, where it * allows for pushing (with **bpf_skb_get_tunnel_opt**\ () helper) * and retrieving arbitrary TLVs (Type-Length-Value headers) from * the eBPF program. This allows for full customization of these * headers. * Return * The size of the option data retrieved. * * int bpf_skb_set_tunnel_opt(struct sk_buff *skb, u8 *opt, u32 size) * Description * Set tunnel options metadata for the packet associated to *skb* * to the option data contained in the raw buffer *opt* of *size*. * * See also the description of the **bpf_skb_get_tunnel_opt**\ () * helper for additional information. * Return * 0 on success, or a negative error in case of failure. * * int bpf_skb_change_proto(struct sk_buff *skb, __be16 proto, u64 flags) * Description * Change the protocol of the *skb* to *proto*. Currently * supported are transition from IPv4 to IPv6, and from IPv6 to * IPv4. The helper takes care of the groundwork for the * transition, including resizing the socket buffer. The eBPF * program is expected to fill the new headers, if any, via * **skb_store_bytes**\ () and to recompute the checksums with * **bpf_l3_csum_replace**\ () and **bpf_l4_csum_replace**\ * (). The main case for this helper is to perform NAT64 * operations out of an eBPF program. * * Internally, the GSO type is marked as dodgy so that headers are * checked and segments are recalculated by the GSO/GRO engine. * The size for GSO target is adapted as well. * * All values for *flags* are reserved for future usage, and must * be left at zero. * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * int bpf_skb_change_type(struct sk_buff *skb, u32 type) * Description * Change the packet type for the packet associated to *skb*. This * comes down to setting *skb*\ **->pkt_type** to *type*, except * the eBPF program does not have a write access to *skb*\ * **->pkt_type** beside this helper. Using a helper here allows * for graceful handling of errors. * * The major use case is to change incoming *skb*s to * **PACKET_HOST** in a programmatic way instead of having to * recirculate via **redirect**\ (..., **BPF_F_INGRESS**), for * example. * * Note that *type* only allows certain values. At this time, they * are: * * **PACKET_HOST** * Packet is for us. * **PACKET_BROADCAST** * Send packet to all. * **PACKET_MULTICAST** * Send packet to group. * **PACKET_OTHERHOST** * Send packet to someone else. * Return * 0 on success, or a negative error in case of failure. * * int bpf_skb_under_cgroup(struct sk_buff *skb, struct bpf_map *map, u32 index) * Description * Check whether *skb* is a descendant of the cgroup2 held by * *map* of type **BPF_MAP_TYPE_CGROUP_ARRAY**, at *index*. * Return * The return value depends on the result of the test, and can be: * * * 0, if the *skb* failed the cgroup2 descendant test. * * 1, if the *skb* succeeded the cgroup2 descendant test. * * A negative error code, if an error occurred. * * u32 bpf_get_hash_recalc(struct sk_buff *skb) * Description * Retrieve the hash of the packet, *skb*\ **->hash**. If it is * not set, in particular if the hash was cleared due to mangling, * recompute this hash. Later accesses to the hash can be done * directly with *skb*\ **->hash**. * * Calling **bpf_set_hash_invalid**\ (), changing a packet * prototype with **bpf_skb_change_proto**\ (), or calling * **bpf_skb_store_bytes**\ () with the * **BPF_F_INVALIDATE_HASH** are actions susceptible to clear * the hash and to trigger a new computation for the next call to * **bpf_get_hash_recalc**\ (). * Return * The 32-bit hash. * * u64 bpf_get_current_task(void) * Return * A pointer to the current task struct. * * int bpf_probe_write_user(void *dst, const void *src, u32 len) * Description * Attempt in a safe way to write *len* bytes from the buffer * *src* to *dst* in memory. It only works for threads that are in * user context, and *dst* must be a valid user space address. * * This helper should not be used to implement any kind of * security mechanism because of TOC-TOU attacks, but rather to * debug, divert, and manipulate execution of semi-cooperative * processes. * * Keep in mind that this feature is meant for experiments, and it * has a risk of crashing the system and running programs. * Therefore, when an eBPF program using this helper is attached, * a warning including PID and process name is printed to kernel * logs. * Return * 0 on success, or a negative error in case of failure. * * int bpf_current_task_under_cgroup(struct bpf_map *map, u32 index) * Description * Check whether the probe is being run is the context of a given * subset of the cgroup2 hierarchy. The cgroup2 to test is held by * *map* of type **BPF_MAP_TYPE_CGROUP_ARRAY**, at *index*. * Return * The return value depends on the result of the test, and can be: * * * 1, if current task belongs to the cgroup2. * * 0, if current task does not belong to the cgroup2. * * A negative error code, if an error occurred. * * int bpf_skb_change_tail(struct sk_buff *skb, u32 len, u64 flags) * Description * Resize (trim or grow) the packet associated to *skb* to the * new *len*. The *flags* are reserved for future usage, and must * be left at zero. * * The basic idea is that the helper performs the needed work to * change the size of the packet, then the eBPF program rewrites * the rest via helpers like **bpf_skb_store_bytes**\ (), * **bpf_l3_csum_replace**\ (), **bpf_l3_csum_replace**\ () * and others. This helper is a slow path utility intended for * replies with control messages. And because it is targeted for * slow path, the helper itself can afford to be slow: it * implicitly linearizes, unclones and drops offloads from the * *skb*. * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * int bpf_skb_pull_data(struct sk_buff *skb, u32 len) * Description * Pull in non-linear data in case the *skb* is non-linear and not * all of *len* are part of the linear section. Make *len* bytes * from *skb* readable and writable. If a zero value is passed for * *len*, then the whole length of the *skb* is pulled. * * This helper is only needed for reading and writing with direct * packet access. * * For direct packet access, testing that offsets to access * are within packet boundaries (test on *skb*\ **->data_end**) is * susceptible to fail if offsets are invalid, or if the requested * data is in non-linear parts of the *skb*. On failure the * program can just bail out, or in the case of a non-linear * buffer, use a helper to make the data available. The * **bpf_skb_load_bytes**\ () helper is a first solution to access * the data. Another one consists in using **bpf_skb_pull_data** * to pull in once the non-linear parts, then retesting and * eventually access the data. * * At the same time, this also makes sure the *skb* is uncloned, * which is a necessary condition for direct write. As this needs * to be an invariant for the write part only, the verifier * detects writes and adds a prologue that is calling * **bpf_skb_pull_data()** to effectively unclone the *skb* from * the very beginning in case it is indeed cloned. * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * s64 bpf_csum_update(struct sk_buff *skb, __wsum csum) * Description * Add the checksum *csum* into *skb*\ **->csum** in case the * driver has supplied a checksum for the entire packet into that * field. Return an error otherwise. This helper is intended to be * used in combination with **bpf_csum_diff**\ (), in particular * when the checksum needs to be updated after data has been * written into the packet through direct packet access. * Return * The checksum on success, or a negative error code in case of * failure. * * void bpf_set_hash_invalid(struct sk_buff *skb) * Description * Invalidate the current *skb*\ **->hash**. It can be used after * mangling on headers through direct packet access, in order to * indicate that the hash is outdated and to trigger a * recalculation the next time the kernel tries to access this * hash or when the **bpf_get_hash_recalc**\ () helper is called. * * int bpf_get_numa_node_id(void) * Description * Return the id of the current NUMA node. The primary use case * for this helper is the selection of sockets for the local NUMA * node, when the program is attached to sockets using the * **SO_ATTACH_REUSEPORT_EBPF** option (see also **socket(7)**), * but the helper is also available to other eBPF program types, * similarly to **bpf_get_smp_processor_id**\ (). * Return * The id of current NUMA node. * * int bpf_skb_change_head(struct sk_buff *skb, u32 len, u64 flags) * Description * Grows headroom of packet associated to *skb* and adjusts the * offset of the MAC header accordingly, adding *len* bytes of * space. It automatically extends and reallocates memory as * required. * * This helper can be used on a layer 3 *skb* to push a MAC header * for redirection into a layer 2 device. * * All values for *flags* are reserved for future usage, and must * be left at zero. * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * int bpf_xdp_adjust_head(struct xdp_buff *xdp_md, int delta) * Description * Adjust (move) *xdp_md*\ **->data** by *delta* bytes. Note that * it is possible to use a negative value for *delta*. This helper * can be used to prepare the packet for pushing or popping * headers. * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * int bpf_probe_read_str(void *dst, int size, const void *unsafe_ptr) * Description * Copy a NUL terminated string from an unsafe address * *unsafe_ptr* to *dst*. The *size* should include the * terminating NUL byte. In case the string length is smaller than * *size*, the target is not padded with further NUL bytes. If the * string length is larger than *size*, just *size*-1 bytes are * copied and the last byte is set to NUL. * * On success, the length of the copied string is returned. This * makes this helper useful in tracing programs for reading * strings, and more importantly to get its length at runtime. See * the following snippet: * * :: * * SEC("kprobe/sys_open") * void bpf_sys_open(struct pt_regs *ctx) * { * char buf[PATHLEN]; // PATHLEN is defined to 256 * int res = bpf_probe_read_str(buf, sizeof(buf), * ctx->di); * * // Consume buf, for example push it to * // userspace via bpf_perf_event_output(); we * // can use res (the string length) as event * // size, after checking its boundaries. * } * * In comparison, using **bpf_probe_read()** helper here instead * to read the string would require to estimate the length at * compile time, and would often result in copying more memory * than necessary. * * Another useful use case is when parsing individual process * arguments or individual environment variables navigating * *current*\ **->mm->arg_start** and *current*\ * **->mm->env_start**: using this helper and the return value, * one can quickly iterate at the right offset of the memory area. * Return * On success, the strictly positive length of the string, * including the trailing NUL character. On error, a negative * value. * * u64 bpf_get_socket_cookie(struct sk_buff *skb) * Description * If the **struct sk_buff** pointed by *skb* has a known socket, * retrieve the cookie (generated by the kernel) of this socket. * If no cookie has been set yet, generate a new cookie. Once * generated, the socket cookie remains stable for the life of the * socket. This helper can be useful for monitoring per socket * networking traffic statistics as it provides a unique socket * identifier per namespace. * Return * A 8-byte long non-decreasing number on success, or 0 if the * socket field is missing inside *skb*. * * u64 bpf_get_socket_cookie(struct bpf_sock_addr *ctx) * Description * Equivalent to bpf_get_socket_cookie() helper that accepts * *skb*, but gets socket from **struct bpf_sock_addr** contex. * Return * A 8-byte long non-decreasing number. * * u64 bpf_get_socket_cookie(struct bpf_sock_ops *ctx) * Description * Equivalent to bpf_get_socket_cookie() helper that accepts * *skb*, but gets socket from **struct bpf_sock_ops** contex. * Return * A 8-byte long non-decreasing number. * * u32 bpf_get_socket_uid(struct sk_buff *skb) * Return * The owner UID of the socket associated to *skb*. If the socket * is **NULL**, or if it is not a full socket (i.e. if it is a * time-wait or a request socket instead), **overflowuid** value * is returned (note that **overflowuid** might also be the actual * UID value for the socket). * * u32 bpf_set_hash(struct sk_buff *skb, u32 hash) * Description * Set the full hash for *skb* (set the field *skb*\ **->hash**) * to value *hash*. * Return * 0 * * int bpf_setsockopt(struct bpf_sock_ops *bpf_socket, int level, int optname, char *optval, int optlen) * Description * Emulate a call to **setsockopt()** on the socket associated to * *bpf_socket*, which must be a full socket. The *level* at * which the option resides and the name *optname* of the option * must be specified, see **setsockopt(2)** for more information. * The option value of length *optlen* is pointed by *optval*. * * This helper actually implements a subset of **setsockopt()**. * It supports the following *level*\ s: * * * **SOL_SOCKET**, which supports the following *optname*\ s: * **SO_RCVBUF**, **SO_SNDBUF**, **SO_MAX_PACING_RATE**, * **SO_PRIORITY**, **SO_RCVLOWAT**, **SO_MARK**. * * **IPPROTO_TCP**, which supports the following *optname*\ s: * **TCP_CONGESTION**, **TCP_BPF_IW**, * **TCP_BPF_SNDCWND_CLAMP**. * * **IPPROTO_IP**, which supports *optname* **IP_TOS**. * * **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**. * Return * 0 on success, or a negative error in case of failure. * * int bpf_skb_adjust_room(struct sk_buff *skb, u32 len_diff, u32 mode, u64 flags) * Description * Grow or shrink the room for data in the packet associated to * *skb* by *len_diff*, and according to the selected *mode*. * * There is a single supported mode at this time: * * * **BPF_ADJ_ROOM_NET**: Adjust room at the network layer * (room space is added or removed below the layer 3 header). * * All values for *flags* are reserved for future usage, and must * be left at zero. * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * int bpf_redirect_map(struct bpf_map *map, u32 key, u64 flags) * Description * Redirect the packet to the endpoint referenced by *map* at * index *key*. Depending on its type, this *map* can contain * references to net devices (for forwarding packets through other * ports), or to CPUs (for redirecting XDP frames to another CPU; * but this is only implemented for native XDP (with driver * support) as of this writing). * * All values for *flags* are reserved for future usage, and must * be left at zero. * * When used to redirect packets to net devices, this helper * provides a high performance increase over **bpf_redirect**\ (). * This is due to various implementation details of the underlying * mechanisms, one of which is the fact that **bpf_redirect_map**\ * () tries to send packet as a "bulk" to the device. * Return * **XDP_REDIRECT** on success, or **XDP_ABORTED** on error. * * int bpf_sk_redirect_map(struct bpf_map *map, u32 key, u64 flags) * Description * Redirect the packet to the socket referenced by *map* (of type * **BPF_MAP_TYPE_SOCKMAP**) at index *key*. Both ingress and * egress interfaces can be used for redirection. The * **BPF_F_INGRESS** value in *flags* is used to make the * distinction (ingress path is selected if the flag is present, * egress path otherwise). This is the only flag supported for now. * Return * **SK_PASS** on success, or **SK_DROP** on error. * * int bpf_sock_map_update(struct bpf_sock_ops *skops, struct bpf_map *map, void *key, u64 flags) * Description * Add an entry to, or update a *map* referencing sockets. The * *skops* is used as a new value for the entry associated to * *key*. *flags* is one of: * * **BPF_NOEXIST** * The entry for *key* must not exist in the map. * **BPF_EXIST** * The entry for *key* must already exist in the map. * **BPF_ANY** * No condition on the existence of the entry for *key*. * * If the *map* has eBPF programs (parser and verdict), those will * be inherited by the socket being added. If the socket is * already attached to eBPF programs, this results in an error. * Return * 0 on success, or a negative error in case of failure. * * int bpf_xdp_adjust_meta(struct xdp_buff *xdp_md, int delta) * Description * Adjust the address pointed by *xdp_md*\ **->data_meta** by * *delta* (which can be positive or negative). Note that this * operation modifies the address stored in *xdp_md*\ **->data**, * so the latter must be loaded only after the helper has been * called. * * The use of *xdp_md*\ **->data_meta** is optional and programs * are not required to use it. The rationale is that when the * packet is processed with XDP (e.g. as DoS filter), it is * possible to push further meta data along with it before passing * to the stack, and to give the guarantee that an ingress eBPF * program attached as a TC classifier on the same device can pick * this up for further post-processing. Since TC works with socket * buffers, it remains possible to set from XDP the **mark** or * **priority** pointers, or other pointers for the socket buffer. * Having this scratch space generic and programmable allows for * more flexibility as the user is free to store whatever meta * data they need. * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * int bpf_perf_event_read_value(struct bpf_map *map, u64 flags, struct bpf_perf_event_value *buf, u32 buf_size) * Description * Read the value of a perf event counter, and store it into *buf* * of size *buf_size*. This helper relies on a *map* of type * **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. The nature of the perf event * counter is selected when *map* is updated with perf event file * descriptors. The *map* is an array whose size is the number of * available CPUs, and each cell contains a value relative to one * CPU. The value to retrieve is indicated by *flags*, that * contains the index of the CPU to look up, masked with * **BPF_F_INDEX_MASK**. Alternatively, *flags* can be set to * **BPF_F_CURRENT_CPU** to indicate that the value for the * current CPU should be retrieved. * * This helper behaves in a way close to * **bpf_perf_event_read**\ () helper, save that instead of * just returning the value observed, it fills the *buf* * structure. This allows for additional data to be retrieved: in * particular, the enabled and running times (in *buf*\ * **->enabled** and *buf*\ **->running**, respectively) are * copied. In general, **bpf_perf_event_read_value**\ () is * recommended over **bpf_perf_event_read**\ (), which has some * ABI issues and provides fewer functionalities. * * These values are interesting, because hardware PMU (Performance * Monitoring Unit) counters are limited resources. When there are * more PMU based perf events opened than available counters, * kernel will multiplex these events so each event gets certain * percentage (but not all) of the PMU time. In case that * multiplexing happens, the number of samples or counter value * will not reflect the case compared to when no multiplexing * occurs. This makes comparison between different runs difficult. * Typically, the counter value should be normalized before * comparing to other experiments. The usual normalization is done * as follows. * * :: * * normalized_counter = counter * t_enabled / t_running * * Where t_enabled is the time enabled for event and t_running is * the time running for event since last normalization. The * enabled and running times are accumulated since the perf event * open. To achieve scaling factor between two invocations of an * eBPF program, users can can use CPU id as the key (which is * typical for perf array usage model) to remember the previous * value and do the calculation inside the eBPF program. * Return * 0 on success, or a negative error in case of failure. * * int bpf_perf_prog_read_value(struct bpf_perf_event_data *ctx, struct bpf_perf_event_value *buf, u32 buf_size) * Description * For en eBPF program attached to a perf event, retrieve the * value of the event counter associated to *ctx* and store it in * the structure pointed by *buf* and of size *buf_size*. Enabled * and running times are also stored in the structure (see * description of helper **bpf_perf_event_read_value**\ () for * more details). * Return * 0 on success, or a negative error in case of failure. * * int bpf_getsockopt(struct bpf_sock_ops *bpf_socket, int level, int optname, char *optval, int optlen) * Description * Emulate a call to **getsockopt()** on the socket associated to * *bpf_socket*, which must be a full socket. The *level* at * which the option resides and the name *optname* of the option * must be specified, see **getsockopt(2)** for more information. * The retrieved value is stored in the structure pointed by * *opval* and of length *optlen*. * * This helper actually implements a subset of **getsockopt()**. * It supports the following *level*\ s: * * * **IPPROTO_TCP**, which supports *optname* * **TCP_CONGESTION**. * * **IPPROTO_IP**, which supports *optname* **IP_TOS**. * * **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**. * Return * 0 on success, or a negative error in case of failure. * * int bpf_override_return(struct pt_reg *regs, u64 rc) * Description * Used for error injection, this helper uses kprobes to override * the return value of the probed function, and to set it to *rc*. * The first argument is the context *regs* on which the kprobe * works. * * This helper works by setting setting the PC (program counter) * to an override function which is run in place of the original * probed function. This means the probed function is not run at * all. The replacement function just returns with the required * value. * * This helper has security implications, and thus is subject to * restrictions. It is only available if the kernel was compiled * with the **CONFIG_BPF_KPROBE_OVERRIDE** configuration * option, and in this case it only works on functions tagged with * **ALLOW_ERROR_INJECTION** in the kernel code. * * Also, the helper is only available for the architectures having * the CONFIG_FUNCTION_ERROR_INJECTION option. As of this writing, * x86 architecture is the only one to support this feature. * Return * 0 * * int bpf_sock_ops_cb_flags_set(struct bpf_sock_ops *bpf_sock, int argval) * Description * Attempt to set the value of the **bpf_sock_ops_cb_flags** field * for the full TCP socket associated to *bpf_sock_ops* to * *argval*. * * The primary use of this field is to determine if there should * be calls to eBPF programs of type * **BPF_PROG_TYPE_SOCK_OPS** at various points in the TCP * code. A program of the same type can change its value, per * connection and as necessary, when the connection is * established. This field is directly accessible for reading, but * this helper must be used for updates in order to return an * error if an eBPF program tries to set a callback that is not * supported in the current kernel. * * The supported callback values that *argval* can combine are: * * * **BPF_SOCK_OPS_RTO_CB_FLAG** (retransmission time out) * * **BPF_SOCK_OPS_RETRANS_CB_FLAG** (retransmission) * * **BPF_SOCK_OPS_STATE_CB_FLAG** (TCP state change) * * Here are some examples of where one could call such eBPF * program: * * * When RTO fires. * * When a packet is retransmitted. * * When the connection terminates. * * When a packet is sent. * * When a packet is received. * Return * Code **-EINVAL** if the socket is not a full TCP socket; * otherwise, a positive number containing the bits that could not * be set is returned (which comes down to 0 if all bits were set * as required). * * int bpf_msg_redirect_map(struct sk_msg_buff *msg, struct bpf_map *map, u32 key, u64 flags) * Description * This helper is used in programs implementing policies at the * socket level. If the message *msg* is allowed to pass (i.e. if * the verdict eBPF program returns **SK_PASS**), redirect it to * the socket referenced by *map* (of type * **BPF_MAP_TYPE_SOCKMAP**) at index *key*. Both ingress and * egress interfaces can be used for redirection. The * **BPF_F_INGRESS** value in *flags* is used to make the * distinction (ingress path is selected if the flag is present, * egress path otherwise). This is the only flag supported for now. * Return * **SK_PASS** on success, or **SK_DROP** on error. * * int bpf_msg_apply_bytes(struct sk_msg_buff *msg, u32 bytes) * Description * For socket policies, apply the verdict of the eBPF program to * the next *bytes* (number of bytes) of message *msg*. * * For example, this helper can be used in the following cases: * * * A single **sendmsg**\ () or **sendfile**\ () system call * contains multiple logical messages that the eBPF program is * supposed to read and for which it should apply a verdict. * * An eBPF program only cares to read the first *bytes* of a * *msg*. If the message has a large payload, then setting up * and calling the eBPF program repeatedly for all bytes, even * though the verdict is already known, would create unnecessary * overhead. * * When called from within an eBPF program, the helper sets a * counter internal to the BPF infrastructure, that is used to * apply the last verdict to the next *bytes*. If *bytes* is * smaller than the current data being processed from a * **sendmsg**\ () or **sendfile**\ () system call, the first * *bytes* will be sent and the eBPF program will be re-run with * the pointer for start of data pointing to byte number *bytes* * **+ 1**. If *bytes* is larger than the current data being * processed, then the eBPF verdict will be applied to multiple * **sendmsg**\ () or **sendfile**\ () calls until *bytes* are * consumed. * * Note that if a socket closes with the internal counter holding * a non-zero value, this is not a problem because data is not * being buffered for *bytes* and is sent as it is received. * Return * 0 * * int bpf_msg_cork_bytes(struct sk_msg_buff *msg, u32 bytes) * Description * For socket policies, prevent the execution of the verdict eBPF * program for message *msg* until *bytes* (byte number) have been * accumulated. * * This can be used when one needs a specific number of bytes * before a verdict can be assigned, even if the data spans * multiple **sendmsg**\ () or **sendfile**\ () calls. The extreme * case would be a user calling **sendmsg**\ () repeatedly with * 1-byte long message segments. Obviously, this is bad for * performance, but it is still valid. If the eBPF program needs * *bytes* bytes to validate a header, this helper can be used to * prevent the eBPF program to be called again until *bytes* have * been accumulated. * Return * 0 * * int bpf_msg_pull_data(struct sk_msg_buff *msg, u32 start, u32 end, u64 flags) * Description * For socket policies, pull in non-linear data from user space * for *msg* and set pointers *msg*\ **->data** and *msg*\ * **->data_end** to *start* and *end* bytes offsets into *msg*, * respectively. * * If a program of type **BPF_PROG_TYPE_SK_MSG** is run on a * *msg* it can only parse data that the (**data**, **data_end**) * pointers have already consumed. For **sendmsg**\ () hooks this * is likely the first scatterlist element. But for calls relying * on the **sendpage** handler (e.g. **sendfile**\ ()) this will * be the range (**0**, **0**) because the data is shared with * user space and by default the objective is to avoid allowing * user space to modify data while (or after) eBPF verdict is * being decided. This helper can be used to pull in data and to * set the start and end pointer to given values. Data will be * copied if necessary (i.e. if data was not linear and if start * and end pointers do not point to the same chunk). * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * * All values for *flags* are reserved for future usage, and must * be left at zero. * Return * 0 on success, or a negative error in case of failure. * * int bpf_bind(struct bpf_sock_addr *ctx, struct sockaddr *addr, int addr_len) * Description * Bind the socket associated to *ctx* to the address pointed by * *addr*, of length *addr_len*. This allows for making outgoing * connection from the desired IP address, which can be useful for * example when all processes inside a cgroup should use one * single IP address on a host that has multiple IP configured. * * This helper works for IPv4 and IPv6, TCP and UDP sockets. The * domain (*addr*\ **->sa_family**) must be **AF_INET** (or * **AF_INET6**). Looking for a free port to bind to can be * expensive, therefore binding to port is not permitted by the * helper: *addr*\ **->sin_port** (or **sin6_port**, respectively) * must be set to zero. * Return * 0 on success, or a negative error in case of failure. * * int bpf_xdp_adjust_tail(struct xdp_buff *xdp_md, int delta) * Description * Adjust (move) *xdp_md*\ **->data_end** by *delta* bytes. It is * only possible to shrink the packet as of this writing, * therefore *delta* must be a negative integer. * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * int bpf_skb_get_xfrm_state(struct sk_buff *skb, u32 index, struct bpf_xfrm_state *xfrm_state, u32 size, u64 flags) * Description * Retrieve the XFRM state (IP transform framework, see also * **ip-xfrm(8)**) at *index* in XFRM "security path" for *skb*. * * The retrieved value is stored in the **struct bpf_xfrm_state** * pointed by *xfrm_state* and of length *size*. * * All values for *flags* are reserved for future usage, and must * be left at zero. * * This helper is available only if the kernel was compiled with * **CONFIG_XFRM** configuration option. * Return * 0 on success, or a negative error in case of failure. * * int bpf_get_stack(struct pt_regs *regs, void *buf, u32 size, u64 flags) * Description * Return a user or a kernel stack in bpf program provided buffer. * To achieve this, the helper needs *ctx*, which is a pointer * to the context on which the tracing program is executed. * To store the stacktrace, the bpf program provides *buf* with * a nonnegative *size*. * * The last argument, *flags*, holds the number of stack frames to * skip (from 0 to 255), masked with * **BPF_F_SKIP_FIELD_MASK**. The next bits can be used to set * the following flags: * * **BPF_F_USER_STACK** * Collect a user space stack instead of a kernel stack. * **BPF_F_USER_BUILD_ID** * Collect buildid+offset instead of ips for user stack, * only valid if **BPF_F_USER_STACK** is also specified. * * **bpf_get_stack**\ () can collect up to * **PERF_MAX_STACK_DEPTH** both kernel and user frames, subject * to sufficient large buffer size. Note that * this limit can be controlled with the **sysctl** program, and * that it should be manually increased in order to profile long * user stacks (such as stacks for Java programs). To do so, use: * * :: * * # sysctl kernel.perf_event_max_stack=<new value> * Return * A non-negative value equal to or less than *size* on success, * or a negative error in case of failure. * * int bpf_skb_load_bytes_relative(const struct sk_buff *skb, u32 offset, void *to, u32 len, u32 start_header) * Description * This helper is similar to **bpf_skb_load_bytes**\ () in that * it provides an easy way to load *len* bytes from *offset* * from the packet associated to *skb*, into the buffer pointed * by *to*. The difference to **bpf_skb_load_bytes**\ () is that * a fifth argument *start_header* exists in order to select a * base offset to start from. *start_header* can be one of: * * **BPF_HDR_START_MAC** * Base offset to load data from is *skb*'s mac header. * **BPF_HDR_START_NET** * Base offset to load data from is *skb*'s network header. * * In general, "direct packet access" is the preferred method to * access packet data, however, this helper is in particular useful * in socket filters where *skb*\ **->data** does not always point * to the start of the mac header and where "direct packet access" * is not available. * Return * 0 on success, or a negative error in case of failure. * * int bpf_fib_lookup(void *ctx, struct bpf_fib_lookup *params, int plen, u32 flags) * Description * Do FIB lookup in kernel tables using parameters in *params*. * If lookup is successful and result shows packet is to be * forwarded, the neighbor tables are searched for the nexthop. * If successful (ie., FIB lookup shows forwarding and nexthop * is resolved), the nexthop address is returned in ipv4_dst * or ipv6_dst based on family, smac is set to mac address of * egress device, dmac is set to nexthop mac address, rt_metric * is set to metric from route (IPv4/IPv6 only), and ifindex * is set to the device index of the nexthop from the FIB lookup. * * *plen* argument is the size of the passed in struct. * *flags* argument can be a combination of one or more of the * following values: * * **BPF_FIB_LOOKUP_DIRECT** * Do a direct table lookup vs full lookup using FIB * rules. * **BPF_FIB_LOOKUP_OUTPUT** * Perform lookup from an egress perspective (default is * ingress). * * *ctx* is either **struct xdp_md** for XDP programs or * **struct sk_buff** tc cls_act programs. * Return * * < 0 if any input argument is invalid * * 0 on success (packet is forwarded, nexthop neighbor exists) * * > 0 one of **BPF_FIB_LKUP_RET_** codes explaining why the * packet is not forwarded or needs assist from full stack * * int bpf_sock_hash_update(struct bpf_sock_ops_kern *skops, struct bpf_map *map, void *key, u64 flags) * Description * Add an entry to, or update a sockhash *map* referencing sockets. * The *skops* is used as a new value for the entry associated to * *key*. *flags* is one of: * * **BPF_NOEXIST** * The entry for *key* must not exist in the map. * **BPF_EXIST** * The entry for *key* must already exist in the map. * **BPF_ANY** * No condition on the existence of the entry for *key*. * * If the *map* has eBPF programs (parser and verdict), those will * be inherited by the socket being added. If the socket is * already attached to eBPF programs, this results in an error. * Return * 0 on success, or a negative error in case of failure. * * int bpf_msg_redirect_hash(struct sk_msg_buff *msg, struct bpf_map *map, void *key, u64 flags) * Description * This helper is used in programs implementing policies at the * socket level. If the message *msg* is allowed to pass (i.e. if * the verdict eBPF program returns **SK_PASS**), redirect it to * the socket referenced by *map* (of type * **BPF_MAP_TYPE_SOCKHASH**) using hash *key*. Both ingress and * egress interfaces can be used for redirection. The * **BPF_F_INGRESS** value in *flags* is used to make the * distinction (ingress path is selected if the flag is present, * egress path otherwise). This is the only flag supported for now. * Return * **SK_PASS** on success, or **SK_DROP** on error. * * int bpf_sk_redirect_hash(struct sk_buff *skb, struct bpf_map *map, void *key, u64 flags) * Description * This helper is used in programs implementing policies at the * skb socket level. If the sk_buff *skb* is allowed to pass (i.e. * if the verdeict eBPF program returns **SK_PASS**), redirect it * to the socket referenced by *map* (of type * **BPF_MAP_TYPE_SOCKHASH**) using hash *key*. Both ingress and * egress interfaces can be used for redirection. The * **BPF_F_INGRESS** value in *flags* is used to make the * distinction (ingress path is selected if the flag is present, * egress otherwise). This is the only flag supported for now. * Return * **SK_PASS** on success, or **SK_DROP** on error. * * int bpf_lwt_push_encap(struct sk_buff *skb, u32 type, void *hdr, u32 len) * Description * Encapsulate the packet associated to *skb* within a Layer 3 * protocol header. This header is provided in the buffer at * address *hdr*, with *len* its size in bytes. *type* indicates * the protocol of the header and can be one of: * * **BPF_LWT_ENCAP_SEG6** * IPv6 encapsulation with Segment Routing Header * (**struct ipv6_sr_hdr**). *hdr* only contains the SRH, * the IPv6 header is computed by the kernel. * **BPF_LWT_ENCAP_SEG6_INLINE** * Only works if *skb* contains an IPv6 packet. Insert a * Segment Routing Header (**struct ipv6_sr_hdr**) inside * the IPv6 header. * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * int bpf_lwt_seg6_store_bytes(struct sk_buff *skb, u32 offset, const void *from, u32 len) * Description * Store *len* bytes from address *from* into the packet * associated to *skb*, at *offset*. Only the flags, tag and TLVs * inside the outermost IPv6 Segment Routing Header can be * modified through this helper. * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * int bpf_lwt_seg6_adjust_srh(struct sk_buff *skb, u32 offset, s32 delta) * Description * Adjust the size allocated to TLVs in the outermost IPv6 * Segment Routing Header contained in the packet associated to * *skb*, at position *offset* by *delta* bytes. Only offsets * after the segments are accepted. *delta* can be as well * positive (growing) as negative (shrinking). * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * int bpf_lwt_seg6_action(struct sk_buff *skb, u32 action, void *param, u32 param_len) * Description * Apply an IPv6 Segment Routing action of type *action* to the * packet associated to *skb*. Each action takes a parameter * contained at address *param*, and of length *param_len* bytes. * *action* can be one of: * * **SEG6_LOCAL_ACTION_END_X** * End.X action: Endpoint with Layer-3 cross-connect. * Type of *param*: **struct in6_addr**. * **SEG6_LOCAL_ACTION_END_T** * End.T action: Endpoint with specific IPv6 table lookup. * Type of *param*: **int**. * **SEG6_LOCAL_ACTION_END_B6** * End.B6 action: Endpoint bound to an SRv6 policy. * Type of param: **struct ipv6_sr_hdr**. * **SEG6_LOCAL_ACTION_END_B6_ENCAP** * End.B6.Encap action: Endpoint bound to an SRv6 * encapsulation policy. * Type of param: **struct ipv6_sr_hdr**. * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * int bpf_rc_keydown(void *ctx, u32 protocol, u64 scancode, u32 toggle) * Description * This helper is used in programs implementing IR decoding, to * report a successfully decoded key press with *scancode*, * *toggle* value in the given *protocol*. The scancode will be * translated to a keycode using the rc keymap, and reported as * an input key down event. After a period a key up event is * generated. This period can be extended by calling either * **bpf_rc_keydown** () again with the same values, or calling * **bpf_rc_repeat** (). * * Some protocols include a toggle bit, in case the button was * released and pressed again between consecutive scancodes. * * The *ctx* should point to the lirc sample as passed into * the program. * * The *protocol* is the decoded protocol number (see * **enum rc_proto** for some predefined values). * * This helper is only available is the kernel was compiled with * the **CONFIG_BPF_LIRC_MODE2** configuration option set to * "**y**". * Return * 0 * * int bpf_rc_repeat(void *ctx) * Description * This helper is used in programs implementing IR decoding, to * report a successfully decoded repeat key message. This delays * the generation of a key up event for previously generated * key down event. * * Some IR protocols like NEC have a special IR message for * repeating last button, for when a button is held down. * * The *ctx* should point to the lirc sample as passed into * the program. * * This helper is only available is the kernel was compiled with * the **CONFIG_BPF_LIRC_MODE2** configuration option set to * "**y**". * Return * 0 * * uint64_t bpf_skb_cgroup_id(struct sk_buff *skb) * Description * Return the cgroup v2 id of the socket associated with the *skb*. * This is roughly similar to the **bpf_get_cgroup_classid**\ () * helper for cgroup v1 by providing a tag resp. identifier that * can be matched on or used for map lookups e.g. to implement * policy. The cgroup v2 id of a given path in the hierarchy is * exposed in user space through the f_handle API in order to get * to the same 64-bit id. * * This helper can be used on TC egress path, but not on ingress, * and is available only if the kernel was compiled with the * **CONFIG_SOCK_CGROUP_DATA** configuration option. * Return * The id is returned or 0 in case the id could not be retrieved. * * u64 bpf_skb_ancestor_cgroup_id(struct sk_buff *skb, int ancestor_level) * Description * Return id of cgroup v2 that is ancestor of cgroup associated * with the *skb* at the *ancestor_level*. The root cgroup is at * *ancestor_level* zero and each step down the hierarchy * increments the level. If *ancestor_level* == level of cgroup * associated with *skb*, then return value will be same as that * of **bpf_skb_cgroup_id**\ (). * * The helper is useful to implement policies based on cgroups * that are upper in hierarchy than immediate cgroup associated * with *skb*. * * The format of returned id and helper limitations are same as in * **bpf_skb_cgroup_id**\ (). * Return * The id is returned or 0 in case the id could not be retrieved. * * u64 bpf_get_current_cgroup_id(void) * Return * A 64-bit integer containing the current cgroup id based * on the cgroup within which the current task is running. * * void* get_local_storage(void *map, u64 flags) * Description * Get the pointer to the local storage area. * The type and the size of the local storage is defined * by the *map* argument. * The *flags* meaning is specific for each map type, * and has to be 0 for cgroup local storage. * * Depending on the bpf program type, a local storage area * can be shared between multiple instances of the bpf program, * running simultaneously. * * A user should care about the synchronization by himself. * For example, by using the BPF_STX_XADD instruction to alter * the shared data. * Return * Pointer to the local storage area. * * int bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags) * Description * Select a SO_REUSEPORT sk from a BPF_MAP_TYPE_REUSEPORT_ARRAY map * It checks the selected sk is matching the incoming * request in the skb. * Return * 0 on success, or a negative error in case of failure. */ #define __BPF_FUNC_MAPPER(FN) \ FN(unspec), \ FN(map_lookup_elem), \ FN(map_update_elem), \ FN(map_delete_elem), \ FN(probe_read), \ FN(ktime_get_ns), \ FN(trace_printk), \ FN(get_prandom_u32), \ FN(get_smp_processor_id), \ FN(skb_store_bytes), \ FN(l3_csum_replace), \ FN(l4_csum_replace), \ FN(tail_call), \ FN(clone_redirect), \ FN(get_current_pid_tgid), \ FN(get_current_uid_gid), \ FN(get_current_comm), \ FN(get_cgroup_classid), \ FN(skb_vlan_push), \ FN(skb_vlan_pop), \ FN(skb_get_tunnel_key), \ FN(skb_set_tunnel_key), \ FN(perf_event_read), \ FN(redirect), \ FN(get_route_realm), \ FN(perf_event_output), \ FN(skb_load_bytes), \ FN(get_stackid), \ FN(csum_diff), \ FN(skb_get_tunnel_opt), \ FN(skb_set_tunnel_opt), \ FN(skb_change_proto), \ FN(skb_change_type), \ FN(skb_under_cgroup), \ FN(get_hash_recalc), \ FN(get_current_task), \ FN(probe_write_user), \ FN(current_task_under_cgroup), \ FN(skb_change_tail), \ FN(skb_pull_data), \ FN(csum_update), \ FN(set_hash_invalid), \ FN(get_numa_node_id), \ FN(skb_change_head), \ FN(xdp_adjust_head), \ FN(probe_read_str), \ FN(get_socket_cookie), \ FN(get_socket_uid), \ FN(set_hash), \ FN(setsockopt), \ FN(skb_adjust_room), \ FN(redirect_map), \ FN(sk_redirect_map), \ FN(sock_map_update), \ FN(xdp_adjust_meta), \ FN(perf_event_read_value), \ FN(perf_prog_read_value), \ FN(getsockopt), \ FN(override_return), \ FN(sock_ops_cb_flags_set), \ FN(msg_redirect_map), \ FN(msg_apply_bytes), \ FN(msg_cork_bytes), \ FN(msg_pull_data), \ FN(bind), \ FN(xdp_adjust_tail), \ FN(skb_get_xfrm_state), \ FN(get_stack), \ FN(skb_load_bytes_relative), \ FN(fib_lookup), \ FN(sock_hash_update), \ FN(msg_redirect_hash), \ FN(sk_redirect_hash), \ FN(lwt_push_encap), \ FN(lwt_seg6_store_bytes), \ FN(lwt_seg6_adjust_srh), \ FN(lwt_seg6_action), \ FN(rc_repeat), \ FN(rc_keydown), \ FN(skb_cgroup_id), \ FN(get_current_cgroup_id), \ FN(get_local_storage), \ FN(sk_select_reuseport), \ FN(skb_ancestor_cgroup_id), /* integer value in 'imm' field of BPF_CALL instruction selects which helper * function eBPF program intends to call */ #define __BPF_ENUM_FN(x) BPF_FUNC_ ## x enum bpf_func_id { __BPF_FUNC_MAPPER(__BPF_ENUM_FN) __BPF_FUNC_MAX_ID, }; #undef __BPF_ENUM_FN /* All flags used by eBPF helper functions, placed here. */ /* BPF_FUNC_skb_store_bytes flags. */ #define BPF_F_RECOMPUTE_CSUM (1ULL << 0) #define BPF_F_INVALIDATE_HASH (1ULL << 1) /* BPF_FUNC_l3_csum_replace and BPF_FUNC_l4_csum_replace flags. * First 4 bits are for passing the header field size. */ #define BPF_F_HDR_FIELD_MASK 0xfULL /* BPF_FUNC_l4_csum_replace flags. */ #define BPF_F_PSEUDO_HDR (1ULL << 4) #define BPF_F_MARK_MANGLED_0 (1ULL << 5) #define BPF_F_MARK_ENFORCE (1ULL << 6) /* BPF_FUNC_clone_redirect and BPF_FUNC_redirect flags. */ #define BPF_F_INGRESS (1ULL << 0) /* BPF_FUNC_skb_set_tunnel_key and BPF_FUNC_skb_get_tunnel_key flags. */ #define BPF_F_TUNINFO_IPV6 (1ULL << 0) /* flags for both BPF_FUNC_get_stackid and BPF_FUNC_get_stack. */ #define BPF_F_SKIP_FIELD_MASK 0xffULL #define BPF_F_USER_STACK (1ULL << 8) /* flags used by BPF_FUNC_get_stackid only. */ #define BPF_F_FAST_STACK_CMP (1ULL << 9) #define BPF_F_REUSE_STACKID (1ULL << 10) /* flags used by BPF_FUNC_get_stack only. */ #define BPF_F_USER_BUILD_ID (1ULL << 11) /* BPF_FUNC_skb_set_tunnel_key flags. */ #define BPF_F_ZERO_CSUM_TX (1ULL << 1) #define BPF_F_DONT_FRAGMENT (1ULL << 2) #define BPF_F_SEQ_NUMBER (1ULL << 3) /* BPF_FUNC_perf_event_output, BPF_FUNC_perf_event_read and * BPF_FUNC_perf_event_read_value flags. */ #define BPF_F_INDEX_MASK 0xffffffffULL #define BPF_F_CURRENT_CPU BPF_F_INDEX_MASK /* BPF_FUNC_perf_event_output for sk_buff input context. */ #define BPF_F_CTXLEN_MASK (0xfffffULL << 32) /* Mode for BPF_FUNC_skb_adjust_room helper. */ enum bpf_adj_room_mode { BPF_ADJ_ROOM_NET, }; /* Mode for BPF_FUNC_skb_load_bytes_relative helper. */ enum bpf_hdr_start_off { BPF_HDR_START_MAC, BPF_HDR_START_NET, }; /* Encapsulation type for BPF_FUNC_lwt_push_encap helper. */ enum bpf_lwt_encap_mode { BPF_LWT_ENCAP_SEG6, BPF_LWT_ENCAP_SEG6_INLINE }; /* user accessible mirror of in-kernel sk_buff. * new fields can only be added to the end of this structure */ struct __sk_buff { __u32 len; __u32 pkt_type; __u32 mark; __u32 queue_mapping; __u32 protocol; __u32 vlan_present; __u32 vlan_tci; __u32 vlan_proto; __u32 priority; __u32 ingress_ifindex; __u32 ifindex; __u32 tc_index; __u32 cb[5]; __u32 hash; __u32 tc_classid; __u32 data; __u32 data_end; __u32 napi_id; /* Accessed by BPF_PROG_TYPE_sk_skb types from here to ... */ __u32 family; __u32 remote_ip4; /* Stored in network byte order */ __u32 local_ip4; /* Stored in network byte order */ __u32 remote_ip6[4]; /* Stored in network byte order */ __u32 local_ip6[4]; /* Stored in network byte order */ __u32 remote_port; /* Stored in network byte order */ __u32 local_port; /* stored in host byte order */ /* ... here. */ __u32 data_meta; }; struct bpf_tunnel_key { __u32 tunnel_id; union { __u32 remote_ipv4; __u32 remote_ipv6[4]; }; __u8 tunnel_tos; __u8 tunnel_ttl; __u16 tunnel_ext; /* Padding, future use. */ __u32 tunnel_label; }; /* user accessible mirror of in-kernel xfrm_state. * new fields can only be added to the end of this structure */ struct bpf_xfrm_state { __u32 reqid; __u32 spi; /* Stored in network byte order */ __u16 family; __u16 ext; /* Padding, future use. */ union { __u32 remote_ipv4; /* Stored in network byte order */ __u32 remote_ipv6[4]; /* Stored in network byte order */ }; }; /* Generic BPF return codes which all BPF program types may support. * The values are binary compatible with their TC_ACT_* counter-part to * provide backwards compatibility with existing SCHED_CLS and SCHED_ACT * programs. * * XDP is handled seprately, see XDP_*. */ enum bpf_ret_code { BPF_OK = 0, /* 1 reserved */ BPF_DROP = 2, /* 3-6 reserved */ BPF_REDIRECT = 7, /* >127 are reserved for prog type specific return codes */ }; struct bpf_sock { __u32 bound_dev_if; __u32 family; __u32 type; __u32 protocol; __u32 mark; __u32 priority; __u32 src_ip4; /* Allows 1,2,4-byte read. * Stored in network byte order. */ __u32 src_ip6[4]; /* Allows 1,2,4-byte read. * Stored in network byte order. */ __u32 src_port; /* Allows 4-byte read. * Stored in host byte order */ }; #define XDP_PACKET_HEADROOM 256 /* User return codes for XDP prog type. * A valid XDP program must return one of these defined values. All other * return codes are reserved for future use. Unknown return codes will * result in packet drops and a warning via bpf_warn_invalid_xdp_action(). */ enum xdp_action { XDP_ABORTED = 0, XDP_DROP, XDP_PASS, XDP_TX, XDP_REDIRECT, }; /* user accessible metadata for XDP packet hook * new fields must be added to the end of this structure */ struct xdp_md { __u32 data; __u32 data_end; __u32 data_meta; /* Below access go through struct xdp_rxq_info */ __u32 ingress_ifindex; /* rxq->dev->ifindex */ __u32 rx_queue_index; /* rxq->queue_index */ }; enum sk_action { SK_DROP = 0, SK_PASS, }; /* user accessible metadata for SK_MSG packet hook, new fields must * be added to the end of this structure */ struct sk_msg_md { void *data; void *data_end; __u32 family; __u32 remote_ip4; /* Stored in network byte order */ __u32 local_ip4; /* Stored in network byte order */ __u32 remote_ip6[4]; /* Stored in network byte order */ __u32 local_ip6[4]; /* Stored in network byte order */ __u32 remote_port; /* Stored in network byte order */ __u32 local_port; /* stored in host byte order */ }; struct sk_reuseport_md { /* * Start of directly accessible data. It begins from * the tcp/udp header. */ void *data; void *data_end; /* End of directly accessible data */ /* * Total length of packet (starting from the tcp/udp header). * Note that the directly accessible bytes (data_end - data) * could be less than this "len". Those bytes could be * indirectly read by a helper "bpf_skb_load_bytes()". */ __u32 len; /* * Eth protocol in the mac header (network byte order). e.g. * ETH_P_IP(0x0800) and ETH_P_IPV6(0x86DD) */ __u32 eth_protocol; __u32 ip_protocol; /* IP protocol. e.g. IPPROTO_TCP, IPPROTO_UDP */ __u32 bind_inany; /* Is sock bound to an INANY address? */ __u32 hash; /* A hash of the packet 4 tuples */ }; #define BPF_TAG_SIZE 8 struct bpf_prog_info { __u32 type; __u32 id; __u8 tag[BPF_TAG_SIZE]; __u32 jited_prog_len; __u32 xlated_prog_len; __aligned_u64 jited_prog_insns; __aligned_u64 xlated_prog_insns; __u64 load_time; /* ns since boottime */ __u32 created_by_uid; __u32 nr_map_ids; __aligned_u64 map_ids; char name[BPF_OBJ_NAME_LEN]; __u32 ifindex; __u32 gpl_compatible:1; __u32 :31; /* alignment pad */ __u64 netns_dev; __u64 netns_ino; __u32 nr_jited_ksyms; __u32 nr_jited_func_lens; __aligned_u64 jited_ksyms; __aligned_u64 jited_func_lens; } __attribute__((aligned(8))); struct bpf_map_info { __u32 type; __u32 id; __u32 key_size; __u32 value_size; __u32 max_entries; __u32 map_flags; char name[BPF_OBJ_NAME_LEN]; __u32 ifindex; __u32 :32; __u64 netns_dev; __u64 netns_ino; __u32 btf_id; __u32 btf_key_type_id; __u32 btf_value_type_id; } __attribute__((aligned(8))); struct bpf_btf_info { __aligned_u64 btf; __u32 btf_size; __u32 id; } __attribute__((aligned(8))); /* User bpf_sock_addr struct to access socket fields and sockaddr struct passed * by user and intended to be used by socket (e.g. to bind to, depends on * attach attach type). */ struct bpf_sock_addr { __u32 user_family; /* Allows 4-byte read, but no write. */ __u32 user_ip4; /* Allows 1,2,4-byte read and 4-byte write. * Stored in network byte order. */ __u32 user_ip6[4]; /* Allows 1,2,4-byte read an 4-byte write. * Stored in network byte order. */ __u32 user_port; /* Allows 4-byte read and write. * Stored in network byte order */ __u32 family; /* Allows 4-byte read, but no write */ __u32 type; /* Allows 4-byte read, but no write */ __u32 protocol; /* Allows 4-byte read, but no write */ __u32 msg_src_ip4; /* Allows 1,2,4-byte read an 4-byte write. * Stored in network byte order. */ __u32 msg_src_ip6[4]; /* Allows 1,2,4-byte read an 4-byte write. * Stored in network byte order. */ }; /* User bpf_sock_ops struct to access socket values and specify request ops * and their replies. * Some of this fields are in network (bigendian) byte order and may need * to be converted before use (bpf_ntohl() defined in samples/bpf/bpf_endian.h). * New fields can only be added at the end of this structure */ struct bpf_sock_ops { __u32 op; union { __u32 args[4]; /* Optionally passed to bpf program */ __u32 reply; /* Returned by bpf program */ __u32 replylong[4]; /* Optionally returned by bpf prog */ }; __u32 family; __u32 remote_ip4; /* Stored in network byte order */ __u32 local_ip4; /* Stored in network byte order */ __u32 remote_ip6[4]; /* Stored in network byte order */ __u32 local_ip6[4]; /* Stored in network byte order */ __u32 remote_port; /* Stored in network byte order */ __u32 local_port; /* stored in host byte order */ __u32 is_fullsock; /* Some TCP fields are only valid if * there is a full socket. If not, the * fields read as zero. */ __u32 snd_cwnd; __u32 srtt_us; /* Averaged RTT << 3 in usecs */ __u32 bpf_sock_ops_cb_flags; /* flags defined in uapi/linux/tcp.h */ __u32 state; __u32 rtt_min; __u32 snd_ssthresh; __u32 rcv_nxt; __u32 snd_nxt; __u32 snd_una; __u32 mss_cache; __u32 ecn_flags; __u32 rate_delivered; __u32 rate_interval_us; __u32 packets_out; __u32 retrans_out; __u32 total_retrans; __u32 segs_in; __u32 data_segs_in; __u32 segs_out; __u32 data_segs_out; __u32 lost_out; __u32 sacked_out; __u32 sk_txhash; __u64 bytes_received; __u64 bytes_acked; }; /* Definitions for bpf_sock_ops_cb_flags */ #define BPF_SOCK_OPS_RTO_CB_FLAG (1<<0) #define BPF_SOCK_OPS_RETRANS_CB_FLAG (1<<1) #define BPF_SOCK_OPS_STATE_CB_FLAG (1<<2) #define BPF_SOCK_OPS_ALL_CB_FLAGS 0x7 /* Mask of all currently * supported cb flags */ /* List of known BPF sock_ops operators. * New entries can only be added at the end */ enum { BPF_SOCK_OPS_VOID, BPF_SOCK_OPS_TIMEOUT_INIT, /* Should return SYN-RTO value to use or * -1 if default value should be used */ BPF_SOCK_OPS_RWND_INIT, /* Should return initial advertized * window (in packets) or -1 if default * value should be used */ BPF_SOCK_OPS_TCP_CONNECT_CB, /* Calls BPF program right before an * active connection is initialized */ BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB, /* Calls BPF program when an * active connection is * established */ BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB, /* Calls BPF program when a * passive connection is * established */ BPF_SOCK_OPS_NEEDS_ECN, /* If connection's congestion control * needs ECN */ BPF_SOCK_OPS_BASE_RTT, /* Get base RTT. The correct value is * based on the path and may be * dependent on the congestion control * algorithm. In general it indicates * a congestion threshold. RTTs above * this indicate congestion */ BPF_SOCK_OPS_RTO_CB, /* Called when an RTO has triggered. * Arg1: value of icsk_retransmits * Arg2: value of icsk_rto * Arg3: whether RTO has expired */ BPF_SOCK_OPS_RETRANS_CB, /* Called when skb is retransmitted. * Arg1: sequence number of 1st byte * Arg2: # segments * Arg3: return value of * tcp_transmit_skb (0 => success) */ BPF_SOCK_OPS_STATE_CB, /* Called when TCP changes state. * Arg1: old_state * Arg2: new_state */ BPF_SOCK_OPS_TCP_LISTEN_CB, /* Called on listen(2), right after * socket transition to LISTEN state. */ }; /* List of TCP states. There is a build check in net/ipv4/tcp.c to detect * changes between the TCP and BPF versions. Ideally this should never happen. * If it does, we need to add code to convert them before calling * the BPF sock_ops function. */ enum { BPF_TCP_ESTABLISHED = 1, BPF_TCP_SYN_SENT, BPF_TCP_SYN_RECV, BPF_TCP_FIN_WAIT1, BPF_TCP_FIN_WAIT2, BPF_TCP_TIME_WAIT, BPF_TCP_CLOSE, BPF_TCP_CLOSE_WAIT, BPF_TCP_LAST_ACK, BPF_TCP_LISTEN, BPF_TCP_CLOSING, /* Now a valid state */ BPF_TCP_NEW_SYN_RECV, BPF_TCP_MAX_STATES /* Leave at the end! */ }; #define TCP_BPF_IW 1001 /* Set TCP initial congestion window */ #define TCP_BPF_SNDCWND_CLAMP 1002 /* Set sndcwnd_clamp */ struct bpf_perf_event_value { __u64 counter; __u64 enabled; __u64 running; }; #define BPF_DEVCG_ACC_MKNOD (1ULL << 0) #define BPF_DEVCG_ACC_READ (1ULL << 1) #define BPF_DEVCG_ACC_WRITE (1ULL << 2) #define BPF_DEVCG_DEV_BLOCK (1ULL << 0) #define BPF_DEVCG_DEV_CHAR (1ULL << 1) struct bpf_cgroup_dev_ctx { /* access_type encoded as (BPF_DEVCG_ACC_* << 16) | BPF_DEVCG_DEV_* */ __u32 access_type; __u32 major; __u32 minor; }; struct bpf_raw_tracepoint_args { __u64 args[0]; }; /* DIRECT: Skip the FIB rules and go to FIB table associated with device * OUTPUT: Do lookup from egress perspective; default is ingress */ #define BPF_FIB_LOOKUP_DIRECT (1U << 0) #define BPF_FIB_LOOKUP_OUTPUT (1U << 1) enum { BPF_FIB_LKUP_RET_SUCCESS, /* lookup successful */ BPF_FIB_LKUP_RET_BLACKHOLE, /* dest is blackholed; can be dropped */ BPF_FIB_LKUP_RET_UNREACHABLE, /* dest is unreachable; can be dropped */ BPF_FIB_LKUP_RET_PROHIBIT, /* dest not allowed; can be dropped */ BPF_FIB_LKUP_RET_NOT_FWDED, /* packet is not forwarded */ BPF_FIB_LKUP_RET_FWD_DISABLED, /* fwding is not enabled on ingress */ BPF_FIB_LKUP_RET_UNSUPP_LWT, /* fwd requires encapsulation */ BPF_FIB_LKUP_RET_NO_NEIGH, /* no neighbor entry for nh */ BPF_FIB_LKUP_RET_FRAG_NEEDED, /* fragmentation required to fwd */ }; struct bpf_fib_lookup { /* input: network family for lookup (AF_INET, AF_INET6) * output: network family of egress nexthop */ __u8 family; /* set if lookup is to consider L4 data - e.g., FIB rules */ __u8 l4_protocol; __be16 sport; __be16 dport; /* total length of packet from network header - used for MTU check */ __u16 tot_len; /* input: L3 device index for lookup * output: device index from FIB lookup */ __u32 ifindex; union { /* inputs to lookup */ __u8 tos; /* AF_INET */ __be32 flowinfo; /* AF_INET6, flow_label + priority */ /* output: metric of fib result (IPv4/IPv6 only) */ __u32 rt_metric; }; union { __be32 ipv4_src; __u32 ipv6_src[4]; /* in6_addr; network order */ }; /* input to bpf_fib_lookup, ipv{4,6}_dst is destination address in * network header. output: bpf_fib_lookup sets to gateway address * if FIB lookup returns gateway route */ union { __be32 ipv4_dst; __u32 ipv6_dst[4]; /* in6_addr; network order */ }; /* output */ __be16 h_vlan_proto; __be16 h_vlan_TCI; __u8 smac[6]; /* ETH_ALEN */ __u8 dmac[6]; /* ETH_ALEN */ }; enum bpf_task_fd_type { BPF_FD_TYPE_RAW_TRACEPOINT, /* tp name */ BPF_FD_TYPE_TRACEPOINT, /* tp name */ BPF_FD_TYPE_KPROBE, /* (symbol + offset) or addr */ BPF_FD_TYPE_KRETPROBE, /* (symbol + offset) or addr */ BPF_FD_TYPE_UPROBE, /* filename + offset */ BPF_FD_TYPE_URETPROBE, /* filename + offset */ }; #endif /* __LINUX_BPF_H__ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/keyctl.h��������������������������������������������������������������������������������������0000644�����������������00000006743�14763166027�0007375 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* keyctl.h: keyctl command IDs * * Copyright (C) 2004, 2008 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) * * 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. */ #ifndef _LINUX_KEYCTL_H #define _LINUX_KEYCTL_H #include <linux/types.h> /* special process keyring shortcut IDs */ #define KEY_SPEC_THREAD_KEYRING -1 /* - key ID for thread-specific keyring */ #define KEY_SPEC_PROCESS_KEYRING -2 /* - key ID for process-specific keyring */ #define KEY_SPEC_SESSION_KEYRING -3 /* - key ID for session-specific keyring */ #define KEY_SPEC_USER_KEYRING -4 /* - key ID for UID-specific keyring */ #define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */ #define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */ #define KEY_SPEC_REQKEY_AUTH_KEY -7 /* - key ID for assumed request_key auth key */ #define KEY_SPEC_REQUESTOR_KEYRING -8 /* - key ID for request_key() dest keyring */ /* request-key default keyrings */ #define KEY_REQKEY_DEFL_NO_CHANGE -1 #define KEY_REQKEY_DEFL_DEFAULT 0 #define KEY_REQKEY_DEFL_THREAD_KEYRING 1 #define KEY_REQKEY_DEFL_PROCESS_KEYRING 2 #define KEY_REQKEY_DEFL_SESSION_KEYRING 3 #define KEY_REQKEY_DEFL_USER_KEYRING 4 #define KEY_REQKEY_DEFL_USER_SESSION_KEYRING 5 #define KEY_REQKEY_DEFL_GROUP_KEYRING 6 #define KEY_REQKEY_DEFL_REQUESTOR_KEYRING 7 /* keyctl commands */ #define KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */ #define KEYCTL_JOIN_SESSION_KEYRING 1 /* join or start named session keyring */ #define KEYCTL_UPDATE 2 /* update a key */ #define KEYCTL_REVOKE 3 /* revoke a key */ #define KEYCTL_CHOWN 4 /* set ownership of a key */ #define KEYCTL_SETPERM 5 /* set perms on a key */ #define KEYCTL_DESCRIBE 6 /* describe a key */ #define KEYCTL_CLEAR 7 /* clear contents of a keyring */ #define KEYCTL_LINK 8 /* link a key into a keyring */ #define KEYCTL_UNLINK 9 /* unlink a key from a keyring */ #define KEYCTL_SEARCH 10 /* search for a key in a keyring */ #define KEYCTL_READ 11 /* read a key or keyring's contents */ #define KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */ #define KEYCTL_NEGATE 13 /* negate a partially constructed key */ #define KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */ #define KEYCTL_SET_TIMEOUT 15 /* set key timeout */ #define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */ #define KEYCTL_GET_SECURITY 17 /* get key security label */ #define KEYCTL_SESSION_TO_PARENT 18 /* apply session keyring to parent process */ #define KEYCTL_REJECT 19 /* reject a partially constructed key */ #define KEYCTL_INSTANTIATE_IOV 20 /* instantiate a partially constructed key */ #define KEYCTL_INVALIDATE 21 /* invalidate a key */ #define KEYCTL_GET_PERSISTENT 22 /* get a user's persistent keyring */ #define KEYCTL_DH_COMPUTE 23 /* Compute Diffie-Hellman values */ #define KEYCTL_RESTRICT_KEYRING 29 /* Restrict keys allowed to link to a keyring */ /* keyctl structures */ struct keyctl_dh_params { union { #ifndef __cplusplus __s32 private; #endif __s32 priv; }; __s32 prime; __s32 base; }; struct keyctl_kdf_params { char *hashname; char *otherinfo; __u32 otherinfolen; __u32 __spare[8]; }; #endif /* _LINUX_KEYCTL_H */ �����������������������������linux/fpga-dfl.h������������������������������������������������������������������������������������0000644�����������������00000012625�14763166027�0007556 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Header File for FPGA DFL User API * * Copyright (C) 2017-2018 Intel Corporation, Inc. * * Authors: * Kang Luwei <luwei.kang@intel.com> * Zhang Yi <yi.z.zhang@intel.com> * Wu Hao <hao.wu@intel.com> * Xiao Guangrong <guangrong.xiao@linux.intel.com> */ #ifndef _LINUX_FPGA_DFL_H #define _LINUX_FPGA_DFL_H #include <linux/types.h> #include <linux/ioctl.h> #define DFL_FPGA_API_VERSION 0 /* * The IOCTL interface for DFL based FPGA is designed for extensibility by * embedding the structure length (argsz) and flags into structures passed * between kernel and userspace. This design referenced the VFIO IOCTL * interface (include/uapi/linux/vfio.h). */ #define DFL_FPGA_MAGIC 0xB6 #define DFL_FPGA_BASE 0 #define DFL_PORT_BASE 0x40 #define DFL_FME_BASE 0x80 /* Common IOCTLs for both FME and AFU file descriptor */ /** * DFL_FPGA_GET_API_VERSION - _IO(DFL_FPGA_MAGIC, DFL_FPGA_BASE + 0) * * Report the version of the driver API. * Return: Driver API Version. */ #define DFL_FPGA_GET_API_VERSION _IO(DFL_FPGA_MAGIC, DFL_FPGA_BASE + 0) /** * DFL_FPGA_CHECK_EXTENSION - _IO(DFL_FPGA_MAGIC, DFL_FPGA_BASE + 1) * * Check whether an extension is supported. * Return: 0 if not supported, otherwise the extension is supported. */ #define DFL_FPGA_CHECK_EXTENSION _IO(DFL_FPGA_MAGIC, DFL_FPGA_BASE + 1) /* IOCTLs for AFU file descriptor */ /** * DFL_FPGA_PORT_RESET - _IO(DFL_FPGA_MAGIC, DFL_PORT_BASE + 0) * * Reset the FPGA Port and its AFU. No parameters are supported. * Userspace can do Port reset at any time, e.g. during DMA or PR. But * it should never cause any system level issue, only functional failure * (e.g. DMA or PR operation failure) and be recoverable from the failure. * Return: 0 on success, -errno of failure */ #define DFL_FPGA_PORT_RESET _IO(DFL_FPGA_MAGIC, DFL_PORT_BASE + 0) /** * DFL_FPGA_PORT_GET_INFO - _IOR(DFL_FPGA_MAGIC, DFL_PORT_BASE + 1, * struct dfl_fpga_port_info) * * Retrieve information about the fpga port. * Driver fills the info in provided struct dfl_fpga_port_info. * Return: 0 on success, -errno on failure. */ struct dfl_fpga_port_info { /* Input */ __u32 argsz; /* Structure length */ /* Output */ __u32 flags; /* Zero for now */ __u32 num_regions; /* The number of supported regions */ __u32 num_umsgs; /* The number of allocated umsgs */ }; #define DFL_FPGA_PORT_GET_INFO _IO(DFL_FPGA_MAGIC, DFL_PORT_BASE + 1) /** * FPGA_PORT_GET_REGION_INFO - _IOWR(FPGA_MAGIC, PORT_BASE + 2, * struct dfl_fpga_port_region_info) * * Retrieve information about a device memory region. * Caller provides struct dfl_fpga_port_region_info with index value set. * Driver returns the region info in other fields. * Return: 0 on success, -errno on failure. */ struct dfl_fpga_port_region_info { /* input */ __u32 argsz; /* Structure length */ /* Output */ __u32 flags; /* Access permission */ #define DFL_PORT_REGION_READ (1 << 0) /* Region is readable */ #define DFL_PORT_REGION_WRITE (1 << 1) /* Region is writable */ #define DFL_PORT_REGION_MMAP (1 << 2) /* Can be mmaped to userspace */ /* Input */ __u32 index; /* Region index */ #define DFL_PORT_REGION_INDEX_AFU 0 /* AFU */ #define DFL_PORT_REGION_INDEX_STP 1 /* Signal Tap */ __u32 padding; /* Output */ __u64 size; /* Region size (bytes) */ __u64 offset; /* Region offset from start of device fd */ }; #define DFL_FPGA_PORT_GET_REGION_INFO _IO(DFL_FPGA_MAGIC, DFL_PORT_BASE + 2) /** * DFL_FPGA_PORT_DMA_MAP - _IOWR(DFL_FPGA_MAGIC, DFL_PORT_BASE + 3, * struct dfl_fpga_port_dma_map) * * Map the dma memory per user_addr and length which are provided by caller. * Driver fills the iova in provided struct afu_port_dma_map. * This interface only accepts page-size aligned user memory for dma mapping. * Return: 0 on success, -errno on failure. */ struct dfl_fpga_port_dma_map { /* Input */ __u32 argsz; /* Structure length */ __u32 flags; /* Zero for now */ __u64 user_addr; /* Process virtual address */ __u64 length; /* Length of mapping (bytes)*/ /* Output */ __u64 iova; /* IO virtual address */ }; #define DFL_FPGA_PORT_DMA_MAP _IO(DFL_FPGA_MAGIC, DFL_PORT_BASE + 3) /** * DFL_FPGA_PORT_DMA_UNMAP - _IOW(FPGA_MAGIC, PORT_BASE + 4, * struct dfl_fpga_port_dma_unmap) * * Unmap the dma memory per iova provided by caller. * Return: 0 on success, -errno on failure. */ struct dfl_fpga_port_dma_unmap { /* Input */ __u32 argsz; /* Structure length */ __u32 flags; /* Zero for now */ __u64 iova; /* IO virtual address */ }; #define DFL_FPGA_PORT_DMA_UNMAP _IO(DFL_FPGA_MAGIC, DFL_PORT_BASE + 4) /* IOCTLs for FME file descriptor */ /** * DFL_FPGA_FME_PORT_PR - _IOW(DFL_FPGA_MAGIC, DFL_FME_BASE + 0, * struct dfl_fpga_fme_port_pr) * * Driver does Partial Reconfiguration based on Port ID and Buffer (Image) * provided by caller. * Return: 0 on success, -errno on failure. * If DFL_FPGA_FME_PORT_PR returns -EIO, that indicates the HW has detected * some errors during PR, under this case, the user can fetch HW error info * from the status of FME's fpga manager. */ struct dfl_fpga_fme_port_pr { /* Input */ __u32 argsz; /* Structure length */ __u32 flags; /* Zero for now */ __u32 port_id; __u32 buffer_size; __u64 buffer_address; /* Userspace address to the buffer for PR */ }; #define DFL_FPGA_FME_PORT_PR _IO(DFL_FPGA_MAGIC, DFL_FME_BASE + 0) #endif /* _LINUX_FPGA_DFL_H */ �����������������������������������������������������������������������������������������������������������linux/ppp_defs.h������������������������������������������������������������������������������������0000644�����������������00000011763�14763166027�0007700 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ppp_defs.h - PPP definitions. * * Copyright 1994-2000 Paul Mackerras. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. */ #include <linux/types.h> #ifndef _PPP_DEFS_H_ #define _PPP_DEFS_H_ /* * The basic PPP frame. */ #define PPP_HDRLEN 4 /* octets for standard ppp header */ #define PPP_FCSLEN 2 /* octets for FCS */ #define PPP_MRU 1500 /* default MRU = max length of info field */ #define PPP_ADDRESS(p) (((__u8 *)(p))[0]) #define PPP_CONTROL(p) (((__u8 *)(p))[1]) #define PPP_PROTOCOL(p) ((((__u8 *)(p))[2] << 8) + ((__u8 *)(p))[3]) /* * Significant octet values. */ #define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */ #define PPP_UI 0x03 /* Unnumbered Information */ #define PPP_FLAG 0x7e /* Flag Sequence */ #define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */ #define PPP_TRANS 0x20 /* Asynchronous transparency modifier */ /* * Protocol field values. */ #define PPP_IP 0x21 /* Internet Protocol */ #define PPP_AT 0x29 /* AppleTalk Protocol */ #define PPP_IPX 0x2b /* IPX protocol */ #define PPP_VJC_COMP 0x2d /* VJ compressed TCP */ #define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */ #define PPP_MP 0x3d /* Multilink protocol */ #define PPP_IPV6 0x57 /* Internet Protocol Version 6 */ #define PPP_COMPFRAG 0xfb /* fragment compressed below bundle */ #define PPP_COMP 0xfd /* compressed packet */ #define PPP_MPLS_UC 0x0281 /* Multi Protocol Label Switching - Unicast */ #define PPP_MPLS_MC 0x0283 /* Multi Protocol Label Switching - Multicast */ #define PPP_IPCP 0x8021 /* IP Control Protocol */ #define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */ #define PPP_IPXCP 0x802b /* IPX Control Protocol */ #define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */ #define PPP_CCPFRAG 0x80fb /* CCP at link level (below MP bundle) */ #define PPP_CCP 0x80fd /* Compression Control Protocol */ #define PPP_MPLSCP 0x80fd /* MPLS Control Protocol */ #define PPP_LCP 0xc021 /* Link Control Protocol */ #define PPP_PAP 0xc023 /* Password Authentication Protocol */ #define PPP_LQR 0xc025 /* Link Quality Report protocol */ #define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */ #define PPP_CBCP 0xc029 /* Callback Control Protocol */ /* * Values for FCS calculations. */ #define PPP_INITFCS 0xffff /* Initial FCS value */ #define PPP_GOODFCS 0xf0b8 /* Good final FCS value */ /* * Extended asyncmap - allows any character to be escaped. */ typedef __u32 ext_accm[8]; /* * What to do with network protocol (NP) packets. */ enum NPmode { NPMODE_PASS, /* pass the packet through */ NPMODE_DROP, /* silently drop the packet */ NPMODE_ERROR, /* return an error */ NPMODE_QUEUE /* save it up for later. */ }; /* * Statistics for LQRP and pppstats */ struct pppstat { __u32 ppp_discards; /* # frames discarded */ __u32 ppp_ibytes; /* bytes received */ __u32 ppp_ioctects; /* bytes received not in error */ __u32 ppp_ipackets; /* packets received */ __u32 ppp_ierrors; /* receive errors */ __u32 ppp_ilqrs; /* # LQR frames received */ __u32 ppp_obytes; /* raw bytes sent */ __u32 ppp_ooctects; /* frame bytes sent */ __u32 ppp_opackets; /* packets sent */ __u32 ppp_oerrors; /* transmit errors */ __u32 ppp_olqrs; /* # LQR frames sent */ }; struct vjstat { __u32 vjs_packets; /* outbound packets */ __u32 vjs_compressed; /* outbound compressed packets */ __u32 vjs_searches; /* searches for connection state */ __u32 vjs_misses; /* times couldn't find conn. state */ __u32 vjs_uncompressedin; /* inbound uncompressed packets */ __u32 vjs_compressedin; /* inbound compressed packets */ __u32 vjs_errorin; /* inbound unknown type packets */ __u32 vjs_tossed; /* inbound packets tossed because of error */ }; struct compstat { __u32 unc_bytes; /* total uncompressed bytes */ __u32 unc_packets; /* total uncompressed packets */ __u32 comp_bytes; /* compressed bytes */ __u32 comp_packets; /* compressed packets */ __u32 inc_bytes; /* incompressible bytes */ __u32 inc_packets; /* incompressible packets */ /* the compression ratio is defined as in_count / bytes_out */ __u32 in_count; /* Bytes received */ __u32 bytes_out; /* Bytes transmitted */ double ratio; /* not computed in kernel. */ }; struct ppp_stats { struct pppstat p; /* basic PPP statistics */ struct vjstat vj; /* VJ header compression statistics */ }; struct ppp_comp_stats { struct compstat c; /* packet compression statistics */ struct compstat d; /* packet decompression statistics */ }; /* * The following structure records the time in seconds since * the last NP packet was sent or received. */ struct ppp_idle { __kernel_time_t xmit_idle; /* time since last NP packet sent */ __kernel_time_t recv_idle; /* time since last NP packet received */ }; #endif /* _PPP_DEFS_H_ */ �������������linux/param.h���������������������������������������������������������������������������������������0000644�����������������00000000215�14763166027�0007166 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_PARAM_H #define _LINUX_PARAM_H #include <asm/param.h> #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/random.h��������������������������������������������������������������������������������������0000644�����������������00000002607�14763166027�0007355 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/linux/random.h * * Include file for the random number generator. */ #ifndef _LINUX_RANDOM_H #define _LINUX_RANDOM_H #include <linux/types.h> #include <linux/ioctl.h> #include <linux/irqnr.h> /* ioctl()'s for the random number generator */ /* Get the entropy count. */ #define RNDGETENTCNT _IOR( 'R', 0x00, int ) /* Add to (or subtract from) the entropy count. (Superuser only.) */ #define RNDADDTOENTCNT _IOW( 'R', 0x01, int ) /* Get the contents of the entropy pool. (Superuser only.) */ #define RNDGETPOOL _IOR( 'R', 0x02, int [2] ) /* * Write bytes into the entropy pool and add to the entropy count. * (Superuser only.) */ #define RNDADDENTROPY _IOW( 'R', 0x03, int [2] ) /* Clear entropy count to 0. (Superuser only.) */ #define RNDZAPENTCNT _IO( 'R', 0x04 ) /* Clear the entropy pool and associated counters. (Superuser only.) */ #define RNDCLEARPOOL _IO( 'R', 0x06 ) /* Reseed CRNG. (Superuser only.) */ #define RNDRESEEDCRNG _IO( 'R', 0x07 ) struct rand_pool_info { int entropy_count; int buf_size; __u32 buf[0]; }; /* * Flags for getrandom(2) * * GRND_NONBLOCK Don't block and return EAGAIN instead * GRND_RANDOM No effect * GRND_INSECURE Return non-cryptographic random bytes */ #define GRND_NONBLOCK 0x0001 #define GRND_RANDOM 0x0002 #define GRND_INSECURE 0x0004 #endif /* _LINUX_RANDOM_H */ �������������������������������������������������������������������������������������������������������������������������linux/nubus.h���������������������������������������������������������������������������������������0000644�����������������00000017777�14763166027�0007247 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* nubus.h: various definitions and prototypes for NuBus drivers to use. Originally written by Alan Cox. Hacked to death by C. Scott Ananian and David Huggins-Daines. Some of the constants in here are from the corresponding NetBSD/OpenBSD header file, by Allen Briggs. We figured out the rest of them on our own. */ #ifndef LINUX_NUBUS_H #define LINUX_NUBUS_H #include <linux/types.h> enum nubus_category { NUBUS_CAT_BOARD = 0x0001, NUBUS_CAT_DISPLAY = 0x0003, NUBUS_CAT_NETWORK = 0x0004, NUBUS_CAT_COMMUNICATIONS = 0x0006, NUBUS_CAT_FONT = 0x0009, NUBUS_CAT_CPU = 0x000A, /* For lack of a better name */ NUBUS_CAT_DUODOCK = 0x0020 }; enum nubus_type_network { NUBUS_TYPE_ETHERNET = 0x0001, NUBUS_TYPE_RS232 = 0x0002 }; enum nubus_type_display { NUBUS_TYPE_VIDEO = 0x0001 }; enum nubus_type_cpu { NUBUS_TYPE_68020 = 0x0003, NUBUS_TYPE_68030 = 0x0004, NUBUS_TYPE_68040 = 0x0005 }; /* Known <Cat,Type,SW,HW> tuples: (according to TattleTech and Slots) * 68030 motherboards: <10,4,0,24> * 68040 motherboards: <10,5,0,24> * DuoDock Plus: <32,1,1,2> * * Toby Frame Buffer card: <3,1,1,1> * RBV built-in video (IIci): <3,1,1,24> * Valkyrie built-in video (Q630): <3,1,1,46> * Macintosh Display Card: <3,1,1,25> * Sonora built-in video (P460): <3,1,1,34> * Jet framebuffer (DuoDock Plus): <3,1,1,41> * * SONIC comm-slot/on-board and DuoDock Ethernet: <4,1,1,272> * SONIC LC-PDS Ethernet (Dayna, but like Apple 16-bit, sort of): <4,1,1,271> * Apple SONIC LC-PDS Ethernet ("Apple Ethernet LC Twisted-Pair Card"): <4,1,0,281> * Sonic Systems Ethernet A-Series Card: <4,1,268,256> * Asante MacCon NuBus-A: <4,1,260,256> (alpha-1.0,1.1 revision) * ROM on the above card: <2,1,0,0> * Cabletron ethernet card: <4,1,1,265> * Farallon ethernet card: <4,1,268,256> (identical to Sonic Systems card) * Kinetics EtherPort IIN: <4,1,259,262> * API Engineering EtherRun_LCa PDS enet card: <4,1,282,256> * * Add your devices to the list! You can obtain the "Slots" utility * from Apple's FTP site at: * ftp://dev.apple.com/devworld/Tool_Chest/Devices_-_Hardware/NuBus_Slot_Manager/ * * Alternately, TattleTech can be found at any Info-Mac mirror site. * or from its distribution site: ftp://ftp.decismkr.com/dms */ /* DrSW: Uniquely identifies the software interface to a board. This is usually the one you want to look at when writing a driver. It's not as useful as you think, though, because as we should know by now (duh), "Apple Compatible" can mean a lot of things... */ /* Add known DrSW values here */ enum nubus_drsw { /* NUBUS_CAT_DISPLAY */ NUBUS_DRSW_APPLE = 0x0001, NUBUS_DRSW_APPLE_HIRES = 0x0013, /* MacII HiRes card driver */ /* NUBUS_CAT_NETWORK */ NUBUS_DRSW_3COM = 0x0000, NUBUS_DRSW_CABLETRON = 0x0001, NUBUS_DRSW_SONIC_LC = 0x0001, NUBUS_DRSW_KINETICS = 0x0103, NUBUS_DRSW_ASANTE = 0x0104, NUBUS_DRSW_TECHWORKS = 0x0109, NUBUS_DRSW_DAYNA = 0x010b, NUBUS_DRSW_FARALLON = 0x010c, NUBUS_DRSW_APPLE_SN = 0x010f, NUBUS_DRSW_DAYNA2 = 0x0115, NUBUS_DRSW_FOCUS = 0x011a, NUBUS_DRSW_ASANTE_CS = 0x011d, /* use asante SMC9194 driver */ NUBUS_DRSW_DAYNA_LC = 0x011e, /* NUBUS_CAT_CPU */ NUBUS_DRSW_NONE = 0x0000, }; /* DrHW: Uniquely identifies the hardware interface to a board (or at least, it should... some video cards are known to incorrectly identify themselves as Toby cards) */ /* Add known DrHW values here */ enum nubus_drhw { /* NUBUS_CAT_DISPLAY */ NUBUS_DRHW_APPLE_TFB = 0x0001, /* Toby frame buffer card */ NUBUS_DRHW_APPLE_WVC = 0x0006, /* Apple Workstation Video Card */ NUBUS_DRHW_SIGMA_CLRMAX = 0x0007, /* Sigma Design ColorMax */ NUBUS_DRHW_APPLE_SE30 = 0x0009, /* Apple SE/30 video */ NUBUS_DRHW_APPLE_HRVC = 0x0013, /* Mac II High-Res Video Card */ NUBUS_DRHW_APPLE_MVC = 0x0014, /* Mac II Monochrome Video Card */ NUBUS_DRHW_APPLE_PVC = 0x0017, /* Mac II Portrait Video Card */ NUBUS_DRHW_APPLE_RBV1 = 0x0018, /* IIci RBV video */ NUBUS_DRHW_APPLE_MDC = 0x0019, /* Macintosh Display Card */ NUBUS_DRHW_APPLE_VSC = 0x0020, /* Duo MiniDock ViSC framebuffer */ NUBUS_DRHW_APPLE_SONORA = 0x0022, /* Sonora built-in video */ NUBUS_DRHW_APPLE_JET = 0x0029, /* Jet framebuffer (DuoDock) */ NUBUS_DRHW_APPLE_24AC = 0x002b, /* Mac 24AC Video Card */ NUBUS_DRHW_APPLE_VALKYRIE = 0x002e, NUBUS_DRHW_SMAC_GFX = 0x0105, /* SuperMac GFX */ NUBUS_DRHW_RASTER_CB264 = 0x013B, /* RasterOps ColorBoard 264 */ NUBUS_DRHW_MICRON_XCEED = 0x0146, /* Micron Exceed color */ NUBUS_DRHW_RDIUS_GSC = 0x0153, /* Radius GS/C */ NUBUS_DRHW_SMAC_SPEC8 = 0x017B, /* SuperMac Spectrum/8 */ NUBUS_DRHW_SMAC_SPEC24 = 0x017C, /* SuperMac Spectrum/24 */ NUBUS_DRHW_RASTER_CB364 = 0x026F, /* RasterOps ColorBoard 364 */ NUBUS_DRHW_RDIUS_DCGX = 0x027C, /* Radius DirectColor/GX */ NUBUS_DRHW_RDIUS_PC8 = 0x0291, /* Radius PrecisionColor 8 */ NUBUS_DRHW_LAPIS_PCS8 = 0x0292, /* Lapis ProColorServer 8 */ NUBUS_DRHW_RASTER_24XLI = 0x02A0, /* RasterOps 8/24 XLi */ NUBUS_DRHW_RASTER_PBPGT = 0x02A5, /* RasterOps PaintBoard Prism GT */ NUBUS_DRHW_EMACH_FSX = 0x02AE, /* E-Machines Futura SX */ NUBUS_DRHW_RASTER_24XLTV = 0x02B7, /* RasterOps 24XLTV */ NUBUS_DRHW_SMAC_THUND24 = 0x02CB, /* SuperMac Thunder/24 */ NUBUS_DRHW_SMAC_THUNDLGHT = 0x03D9, /* SuperMac ThunderLight */ NUBUS_DRHW_RDIUS_PC24XP = 0x0406, /* Radius PrecisionColor 24Xp */ NUBUS_DRHW_RDIUS_PC24X = 0x040A, /* Radius PrecisionColor 24X */ NUBUS_DRHW_RDIUS_PC8XJ = 0x040B, /* Radius PrecisionColor 8XJ */ /* NUBUS_CAT_NETWORK */ NUBUS_DRHW_INTERLAN = 0x0100, NUBUS_DRHW_SMC9194 = 0x0101, NUBUS_DRHW_KINETICS = 0x0106, NUBUS_DRHW_CABLETRON = 0x0109, NUBUS_DRHW_ASANTE_LC = 0x010f, NUBUS_DRHW_SONIC = 0x0110, NUBUS_DRHW_TECHWORKS = 0x0112, NUBUS_DRHW_APPLE_SONIC_NB = 0x0118, NUBUS_DRHW_APPLE_SONIC_LC = 0x0119, NUBUS_DRHW_FOCUS = 0x011c, NUBUS_DRHW_SONNET = 0x011d, }; /* Resource IDs: These are the identifiers for the various weird and wonderful tidbits of information that may or may not reside in the NuBus ROM directory. */ enum nubus_res_id { NUBUS_RESID_TYPE = 0x0001, NUBUS_RESID_NAME = 0x0002, NUBUS_RESID_ICON = 0x0003, NUBUS_RESID_DRVRDIR = 0x0004, NUBUS_RESID_LOADREC = 0x0005, NUBUS_RESID_BOOTREC = 0x0006, NUBUS_RESID_FLAGS = 0x0007, NUBUS_RESID_HWDEVID = 0x0008, NUBUS_RESID_MINOR_BASEOS = 0x000a, NUBUS_RESID_MINOR_LENGTH = 0x000b, NUBUS_RESID_MAJOR_BASEOS = 0x000c, NUBUS_RESID_MAJOR_LENGTH = 0x000d, NUBUS_RESID_CICN = 0x000f, NUBUS_RESID_ICL8 = 0x0010, NUBUS_RESID_ICL4 = 0x0011, }; /* Category-specific resources. */ enum nubus_board_res_id { NUBUS_RESID_BOARDID = 0x0020, NUBUS_RESID_PRAMINITDATA = 0x0021, NUBUS_RESID_PRIMARYINIT = 0x0022, NUBUS_RESID_TIMEOUTCONST = 0x0023, NUBUS_RESID_VENDORINFO = 0x0024, NUBUS_RESID_BOARDFLAGS = 0x0025, NUBUS_RESID_SECONDINIT = 0x0026, /* Not sure why Apple put these next two in here */ NUBUS_RESID_VIDNAMES = 0x0041, NUBUS_RESID_VIDMODES = 0x007e }; /* Fields within the vendor info directory */ enum nubus_vendor_res_id { NUBUS_RESID_VEND_ID = 0x0001, NUBUS_RESID_VEND_SERIAL = 0x0002, NUBUS_RESID_VEND_REV = 0x0003, NUBUS_RESID_VEND_PART = 0x0004, NUBUS_RESID_VEND_DATE = 0x0005 }; enum nubus_net_res_id { NUBUS_RESID_MAC_ADDRESS = 0x0080 }; enum nubus_cpu_res_id { NUBUS_RESID_MEMINFO = 0x0081, NUBUS_RESID_ROMINFO = 0x0082 }; enum nubus_display_res_id { NUBUS_RESID_GAMMADIR = 0x0040, NUBUS_RESID_FIRSTMODE = 0x0080, NUBUS_RESID_SECONDMODE = 0x0081, NUBUS_RESID_THIRDMODE = 0x0082, NUBUS_RESID_FOURTHMODE = 0x0083, NUBUS_RESID_FIFTHMODE = 0x0084, NUBUS_RESID_SIXTHMODE = 0x0085 }; #endif /* LINUX_NUBUS_H */ �linux/dma-buf.h�������������������������������������������������������������������������������������0000644�����������������00000002516�14763166027�0007407 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Framework for buffer objects that can be shared across devices/subsystems. * * Copyright(C) 2015 Intel Ltd * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. * * 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, see <http://www.gnu.org/licenses/>. */ #ifndef _DMA_BUF_UAPI_H_ #define _DMA_BUF_UAPI_H_ #include <linux/types.h> /* begin/end dma-buf functions used for userspace mmap. */ struct dma_buf_sync { __u64 flags; }; #define DMA_BUF_SYNC_READ (1 << 0) #define DMA_BUF_SYNC_WRITE (2 << 0) #define DMA_BUF_SYNC_RW (DMA_BUF_SYNC_READ | DMA_BUF_SYNC_WRITE) #define DMA_BUF_SYNC_START (0 << 2) #define DMA_BUF_SYNC_END (1 << 2) #define DMA_BUF_SYNC_VALID_FLAGS_MASK \ (DMA_BUF_SYNC_RW | DMA_BUF_SYNC_END) #define DMA_BUF_BASE 'b' #define DMA_BUF_IOCTL_SYNC _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync) #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/bpf_perf_event.h������������������������������������������������������������������������������0000644�����������������00000001021�14763166027�0011046 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Copyright (c) 2016 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. */ #ifndef __LINUX_BPF_PERF_EVENT_H__ #define __LINUX_BPF_PERF_EVENT_H__ #include <asm/bpf_perf_event.h> struct bpf_perf_event_data { bpf_user_pt_regs_t regs; __u64 sample_period; __u64 addr; }; #endif /* __LINUX_BPF_PERF_EVENT_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/hpet.h����������������������������������������������������������������������������������������0000644�����������������00000001347�14763166027�0007035 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __HPET__ #define __HPET__ struct hpet_info { unsigned long hi_ireqfreq; /* Hz */ unsigned long hi_flags; /* information */ unsigned short hi_hpet; unsigned short hi_timer; }; #define HPET_INFO_PERIODIC 0x0010 /* periodic-capable comparator */ #define HPET_IE_ON _IO('h', 0x01) /* interrupt on */ #define HPET_IE_OFF _IO('h', 0x02) /* interrupt off */ #define HPET_INFO _IOR('h', 0x03, struct hpet_info) #define HPET_EPI _IO('h', 0x04) /* enable periodic */ #define HPET_DPI _IO('h', 0x05) /* disable periodic */ #define HPET_IRQFREQ _IOW('h', 0x6, unsigned long) /* IRQFREQ usec */ #define MAX_HPET_TBS 8 /* maximum hpet timer blocks */ #endif /* __HPET__ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/sockios.h�������������������������������������������������������������������������������������0000644�����������������00000013732�14763166027�0007550 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Definitions of the socket-level I/O control calls. * * Version: @(#)sockios.h 1.0.2 03/09/93 * * Authors: Ross Biro * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * * 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. */ #ifndef _LINUX_SOCKIOS_H #define _LINUX_SOCKIOS_H #include <asm/sockios.h> /* Linux-specific socket ioctls */ #define SIOCINQ FIONREAD #define SIOCOUTQ TIOCOUTQ /* output queue size (not sent + not acked) */ #define SOCK_IOC_TYPE 0x89 /* Routing table calls. */ #define SIOCADDRT 0x890B /* add routing table entry */ #define SIOCDELRT 0x890C /* delete routing table entry */ #define SIOCRTMSG 0x890D /* unused */ /* Socket configuration controls. */ #define SIOCGIFNAME 0x8910 /* get iface name */ #define SIOCSIFLINK 0x8911 /* set iface channel */ #define SIOCGIFCONF 0x8912 /* get iface list */ #define SIOCGIFFLAGS 0x8913 /* get flags */ #define SIOCSIFFLAGS 0x8914 /* set flags */ #define SIOCGIFADDR 0x8915 /* get PA address */ #define SIOCSIFADDR 0x8916 /* set PA address */ #define SIOCGIFDSTADDR 0x8917 /* get remote PA address */ #define SIOCSIFDSTADDR 0x8918 /* set remote PA address */ #define SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ #define SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ #define SIOCGIFNETMASK 0x891b /* get network PA mask */ #define SIOCSIFNETMASK 0x891c /* set network PA mask */ #define SIOCGIFMETRIC 0x891d /* get metric */ #define SIOCSIFMETRIC 0x891e /* set metric */ #define SIOCGIFMEM 0x891f /* get memory address (BSD) */ #define SIOCSIFMEM 0x8920 /* set memory address (BSD) */ #define SIOCGIFMTU 0x8921 /* get MTU size */ #define SIOCSIFMTU 0x8922 /* set MTU size */ #define SIOCSIFNAME 0x8923 /* set interface name */ #define SIOCSIFHWADDR 0x8924 /* set hardware address */ #define SIOCGIFENCAP 0x8925 /* get/set encapsulations */ #define SIOCSIFENCAP 0x8926 #define SIOCGIFHWADDR 0x8927 /* Get hardware address */ #define SIOCGIFSLAVE 0x8929 /* Driver slaving support */ #define SIOCSIFSLAVE 0x8930 #define SIOCADDMULTI 0x8931 /* Multicast address lists */ #define SIOCDELMULTI 0x8932 #define SIOCGIFINDEX 0x8933 /* name -> if_index mapping */ #define SIOGIFINDEX SIOCGIFINDEX /* misprint compatibility :-) */ #define SIOCSIFPFLAGS 0x8934 /* set/get extended flags set */ #define SIOCGIFPFLAGS 0x8935 #define SIOCDIFADDR 0x8936 /* delete PA address */ #define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */ #define SIOCGIFCOUNT 0x8938 /* get number of devices */ #define SIOCGIFBR 0x8940 /* Bridging support */ #define SIOCSIFBR 0x8941 /* Set bridging options */ #define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ #define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ /* SIOCGIFDIVERT was: 0x8944 Frame diversion support */ /* SIOCSIFDIVERT was: 0x8945 Set frame diversion options */ #define SIOCETHTOOL 0x8946 /* Ethtool interface */ #define SIOCGMIIPHY 0x8947 /* Get address of MII PHY in use. */ #define SIOCGMIIREG 0x8948 /* Read MII PHY register. */ #define SIOCSMIIREG 0x8949 /* Write MII PHY register. */ #define SIOCWANDEV 0x894A /* get/set netdev parameters */ #define SIOCOUTQNSD 0x894B /* output queue size (not sent only) */ #define SIOCGSKNS 0x894C /* get socket network namespace */ /* ARP cache control calls. */ /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ #define SIOCDARP 0x8953 /* delete ARP table entry */ #define SIOCGARP 0x8954 /* get ARP table entry */ #define SIOCSARP 0x8955 /* set ARP table entry */ /* RARP cache control calls. */ #define SIOCDRARP 0x8960 /* delete RARP table entry */ #define SIOCGRARP 0x8961 /* get RARP table entry */ #define SIOCSRARP 0x8962 /* set RARP table entry */ /* Driver configuration calls */ #define SIOCGIFMAP 0x8970 /* Get device parameters */ #define SIOCSIFMAP 0x8971 /* Set device parameters */ /* DLCI configuration calls */ #define SIOCADDDLCI 0x8980 /* Create new DLCI device */ #define SIOCDELDLCI 0x8981 /* Delete DLCI device */ #define SIOCGIFVLAN 0x8982 /* 802.1Q VLAN support */ #define SIOCSIFVLAN 0x8983 /* Set 802.1Q VLAN options */ /* bonding calls */ #define SIOCBONDENSLAVE 0x8990 /* enslave a device to the bond */ #define SIOCBONDRELEASE 0x8991 /* release a slave from the bond*/ #define SIOCBONDSETHWADDR 0x8992 /* set the hw addr of the bond */ #define SIOCBONDSLAVEINFOQUERY 0x8993 /* rtn info about slave state */ #define SIOCBONDINFOQUERY 0x8994 /* rtn info about bond state */ #define SIOCBONDCHANGEACTIVE 0x8995 /* update to a new active slave */ /* bridge calls */ #define SIOCBRADDBR 0x89a0 /* create new bridge device */ #define SIOCBRDELBR 0x89a1 /* remove bridge device */ #define SIOCBRADDIF 0x89a2 /* add interface to bridge */ #define SIOCBRDELIF 0x89a3 /* remove interface from bridge */ /* hardware time stamping: parameters in linux/net_tstamp.h */ #define SIOCSHWTSTAMP 0x89b0 /* set and get config */ #define SIOCGHWTSTAMP 0x89b1 /* get config */ /* Device private ioctl calls */ /* * These 16 ioctls are available to devices via the do_ioctl() device * vector. Each device should include this file and redefine these names * as their own. Because these are device dependent it is a good idea * _NOT_ to issue them to random objects and hope. * * THESE IOCTLS ARE _DEPRECATED_ AND WILL DISAPPEAR IN 2.5.X -DaveM */ #define SIOCDEVPRIVATE 0x89F0 /* to 89FF */ /* * These 16 ioctl calls are protocol private */ #define SIOCPROTOPRIVATE 0x89E0 /* to 89EF */ #endif /* _LINUX_SOCKIOS_H */ ��������������������������������������linux/ivtvfb.h��������������������������������������������������������������������������������������0000644�����������������00000002267�14763166027�0007377 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* On Screen Display cx23415 Framebuffer driver Copyright (C) 2006, 2007 Ian Armstrong <ian@iarmst.demon.co.uk> 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __LINUX_IVTVFB_H__ #define __LINUX_IVTVFB_H__ #include <linux/types.h> /* Framebuffer external API */ struct ivtvfb_dma_frame { void *source; unsigned long dest_offset; int count; }; #define IVTVFB_IOC_DMA_FRAME _IOW('V', BASE_VIDIOC_PRIVATE+0, struct ivtvfb_dma_frame) #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/ethtool.h�������������������������������������������������������������������������������������0000644�����������������00000216376�14763166027�0007565 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ethtool.h: Defines for Linux ethtool. * * Copyright (C) 1998 David S. Miller (davem@redhat.com) * Copyright 2001 Jeff Garzik <jgarzik@pobox.com> * Portions Copyright 2001 Sun Microsystems (thockin@sun.com) * Portions Copyright 2002 Intel (eli.kupermann@intel.com, * christopher.leech@intel.com, * scott.feldman@intel.com) * Portions Copyright (C) Sun Microsystems 2008 */ #ifndef _LINUX_ETHTOOL_H #define _LINUX_ETHTOOL_H #include <linux/const.h> #include <linux/types.h> #include <linux/if_ether.h> #include <limits.h> /* for INT_MAX */ /* All structures exposed to userland should be defined such that they * have the same layout for 32-bit and 64-bit userland. */ /** * struct ethtool_cmd - DEPRECATED, link control and status * This structure is DEPRECATED, please use struct ethtool_link_settings. * @cmd: Command number = %ETHTOOL_GSET or %ETHTOOL_SSET * @supported: Bitmask of %SUPPORTED_* flags for the link modes, * physical connectors and other link features for which the * interface supports autonegotiation or auto-detection. * Read-only. * @advertising: Bitmask of %ADVERTISED_* flags for the link modes, * physical connectors and other link features that are * advertised through autonegotiation or enabled for * auto-detection. * @speed: Low bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN * @duplex: Duplex mode; one of %DUPLEX_* * @port: Physical connector type; one of %PORT_* * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not * applicable. For clause 45 PHYs this is the PRTAD. * @transceiver: Historically used to distinguish different possible * PHY types, but not in a consistent way. Deprecated. * @autoneg: Enable/disable autonegotiation and auto-detection; * either %AUTONEG_DISABLE or %AUTONEG_ENABLE * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO * protocols supported by the interface; 0 if unknown. * Read-only. * @maxtxpkt: Historically used to report TX IRQ coalescing; now * obsoleted by &struct ethtool_coalesce. Read-only; deprecated. * @maxrxpkt: Historically used to report RX IRQ coalescing; now * obsoleted by &struct ethtool_coalesce. Read-only; deprecated. * @speed_hi: High bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of * %ETH_TP_MDI_*. If the status is unknown or not applicable, the * value will be %ETH_TP_MDI_INVALID. Read-only. * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of * %ETH_TP_MDI_*. If MDI(-X) control is not implemented, reads * yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected. * When written successfully, the link should be renegotiated if * necessary. * @lp_advertising: Bitmask of %ADVERTISED_* flags for the link modes * and other link features that the link partner advertised * through autonegotiation; 0 if unknown or not applicable. * Read-only. * * The link speed in Mbps is split between @speed and @speed_hi. Use * the ethtool_cmd_speed() and ethtool_cmd_speed_set() functions to * access it. * * If autonegotiation is disabled, the speed and @duplex represent the * fixed link mode and are writable if the driver supports multiple * link modes. If it is enabled then they are read-only; if the link * is up they represent the negotiated link mode; if the link is down, * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode. * * Some hardware interfaces may have multiple PHYs and/or physical * connectors fitted or do not allow the driver to detect which are * fitted. For these interfaces @port and/or @phy_address may be * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE. * Otherwise, attempts to write different values may be ignored or * rejected. * * Users should assume that all fields not marked read-only are * writable and subject to validation by the driver. They should use * %ETHTOOL_GSET to get the current values before making specific * changes and then applying them with %ETHTOOL_SSET. * * Drivers that implement set_settings() should validate all fields * other than @cmd that are not described as read-only or deprecated, * and must ignore all fields described as read-only. * * Deprecated fields should be ignored by both users and drivers. */ struct ethtool_cmd { __u32 cmd; __u32 supported; __u32 advertising; __u16 speed; __u8 duplex; __u8 port; __u8 phy_address; __u8 transceiver; __u8 autoneg; __u8 mdio_support; __u32 maxtxpkt; __u32 maxrxpkt; __u16 speed_hi; __u8 eth_tp_mdix; __u8 eth_tp_mdix_ctrl; __u32 lp_advertising; __u32 reserved[2]; }; static __inline__ void ethtool_cmd_speed_set(struct ethtool_cmd *ep, __u32 speed) { ep->speed = (__u16)(speed & 0xFFFF); ep->speed_hi = (__u16)(speed >> 16); } static __inline__ __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) { return (ep->speed_hi << 16) | ep->speed; } /* Device supports clause 22 register access to PHY or peripherals * using the interface defined in <linux/mii.h>. This should not be * set if there are known to be no such peripherals present or if * the driver only emulates clause 22 registers for compatibility. */ #define ETH_MDIO_SUPPORTS_C22 1 /* Device supports clause 45 register access to PHY or peripherals * using the interface defined in <linux/mii.h> and <linux/mdio.h>. * This should not be set if there are known to be no such peripherals * present. */ #define ETH_MDIO_SUPPORTS_C45 2 #define ETHTOOL_FWVERS_LEN 32 #define ETHTOOL_BUSINFO_LEN 32 #define ETHTOOL_EROMVERS_LEN 32 /** * struct ethtool_drvinfo - general driver and device information * @cmd: Command number = %ETHTOOL_GDRVINFO * @driver: Driver short name. This should normally match the name * in its bus driver structure (e.g. pci_driver::name). Must * not be an empty string. * @version: Driver version string; may be an empty string * @fw_version: Firmware version string; may be an empty string * @erom_version: Expansion ROM version string; may be an empty string * @bus_info: Device bus address. This should match the dev_name() * string for the underlying bus device, if there is one. May be * an empty string. * @n_priv_flags: Number of flags valid for %ETHTOOL_GPFLAGS and * %ETHTOOL_SPFLAGS commands; also the number of strings in the * %ETH_SS_PRIV_FLAGS set * @n_stats: Number of u64 statistics returned by the %ETHTOOL_GSTATS * command; also the number of strings in the %ETH_SS_STATS set * @testinfo_len: Number of results returned by the %ETHTOOL_TEST * command; also the number of strings in the %ETH_SS_TEST set * @eedump_len: Size of EEPROM accessible through the %ETHTOOL_GEEPROM * and %ETHTOOL_SEEPROM commands, in bytes * @regdump_len: Size of register dump returned by the %ETHTOOL_GREGS * command, in bytes * * Users can use the %ETHTOOL_GSSET_INFO command to get the number of * strings in any string set (from Linux 2.6.34). * * Drivers should set at most @driver, @version, @fw_version and * @bus_info in their get_drvinfo() implementation. The ethtool * core fills in the other fields using other driver operations. */ struct ethtool_drvinfo { __u32 cmd; char driver[32]; char version[32]; char fw_version[ETHTOOL_FWVERS_LEN]; char bus_info[ETHTOOL_BUSINFO_LEN]; char erom_version[ETHTOOL_EROMVERS_LEN]; char reserved2[12]; __u32 n_priv_flags; __u32 n_stats; __u32 testinfo_len; __u32 eedump_len; __u32 regdump_len; }; #define SOPASS_MAX 6 /** * struct ethtool_wolinfo - Wake-On-Lan configuration * @cmd: Command number = %ETHTOOL_GWOL or %ETHTOOL_SWOL * @supported: Bitmask of %WAKE_* flags for supported Wake-On-Lan modes. * Read-only. * @wolopts: Bitmask of %WAKE_* flags for enabled Wake-On-Lan modes. * @sopass: SecureOn(tm) password; meaningful only if %WAKE_MAGICSECURE * is set in @wolopts. */ struct ethtool_wolinfo { __u32 cmd; __u32 supported; __u32 wolopts; __u8 sopass[SOPASS_MAX]; }; /* for passing single values */ struct ethtool_value { __u32 cmd; __u32 data; }; #define PFC_STORM_PREVENTION_AUTO 0xffff #define PFC_STORM_PREVENTION_DISABLE 0 enum tunable_id { ETHTOOL_ID_UNSPEC, ETHTOOL_RX_COPYBREAK, ETHTOOL_TX_COPYBREAK, ETHTOOL_PFC_PREVENTION_TOUT, /* timeout in msecs */ /* * Add your fresh new tunable attribute above and remember to update * tunable_strings[] in net/ethtool/common.c */ __ETHTOOL_TUNABLE_COUNT, }; enum tunable_type_id { ETHTOOL_TUNABLE_UNSPEC, ETHTOOL_TUNABLE_U8, ETHTOOL_TUNABLE_U16, ETHTOOL_TUNABLE_U32, ETHTOOL_TUNABLE_U64, ETHTOOL_TUNABLE_STRING, ETHTOOL_TUNABLE_S8, ETHTOOL_TUNABLE_S16, ETHTOOL_TUNABLE_S32, ETHTOOL_TUNABLE_S64, }; struct ethtool_tunable { __u32 cmd; __u32 id; __u32 type_id; __u32 len; void *data[0]; }; #define DOWNSHIFT_DEV_DEFAULT_COUNT 0xff #define DOWNSHIFT_DEV_DISABLE 0 enum phy_tunable_id { ETHTOOL_PHY_ID_UNSPEC, ETHTOOL_PHY_DOWNSHIFT, /* * Add your fresh new phy tunable attribute above and remember to update * phy_tunable_strings[] in net/ethtool/common.c */ __ETHTOOL_PHY_TUNABLE_COUNT, }; /** * struct ethtool_regs - hardware register dump * @cmd: Command number = %ETHTOOL_GREGS * @version: Dump format version. This is driver-specific and may * distinguish different chips/revisions. Drivers must use new * version numbers whenever the dump format changes in an * incompatible way. * @len: On entry, the real length of @data. On return, the number of * bytes used. * @data: Buffer for the register dump * * Users should use %ETHTOOL_GDRVINFO to find the maximum length of * a register dump for the interface. They must allocate the buffer * immediately following this structure. */ struct ethtool_regs { __u32 cmd; __u32 version; __u32 len; __u8 data[0]; }; /** * struct ethtool_eeprom - EEPROM dump * @cmd: Command number = %ETHTOOL_GEEPROM, %ETHTOOL_GMODULEEEPROM or * %ETHTOOL_SEEPROM * @magic: A 'magic cookie' value to guard against accidental changes. * The value passed in to %ETHTOOL_SEEPROM must match the value * returned by %ETHTOOL_GEEPROM for the same device. This is * unused when @cmd is %ETHTOOL_GMODULEEEPROM. * @offset: Offset within the EEPROM to begin reading/writing, in bytes * @len: On entry, number of bytes to read/write. On successful * return, number of bytes actually read/written. In case of * error, this may indicate at what point the error occurred. * @data: Buffer to read/write from * * Users may use %ETHTOOL_GDRVINFO or %ETHTOOL_GMODULEINFO to find * the length of an on-board or module EEPROM, respectively. They * must allocate the buffer immediately following this structure. */ struct ethtool_eeprom { __u32 cmd; __u32 magic; __u32 offset; __u32 len; __u8 data[0]; }; /** * struct ethtool_eee - Energy Efficient Ethernet information * @cmd: ETHTOOL_{G,S}EEE * @supported: Mask of %SUPPORTED_* flags for the speed/duplex combinations * for which there is EEE support. * @advertised: Mask of %ADVERTISED_* flags for the speed/duplex combinations * advertised as eee capable. * @lp_advertised: Mask of %ADVERTISED_* flags for the speed/duplex * combinations advertised by the link partner as eee capable. * @eee_active: Result of the eee auto negotiation. * @eee_enabled: EEE configured mode (enabled/disabled). * @tx_lpi_enabled: Whether the interface should assert its tx lpi, given * that eee was negotiated. * @tx_lpi_timer: Time in microseconds the interface delays prior to asserting * its tx lpi (after reaching 'idle' state). Effective only when eee * was negotiated and tx_lpi_enabled was set. */ struct ethtool_eee { __u32 cmd; __u32 supported; __u32 advertised; __u32 lp_advertised; __u32 eee_active; __u32 eee_enabled; __u32 tx_lpi_enabled; __u32 tx_lpi_timer; __u32 reserved[2]; }; /** * struct ethtool_modinfo - plugin module eeprom information * @cmd: %ETHTOOL_GMODULEINFO * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx * @eeprom_len: Length of the eeprom * * This structure is used to return the information to * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM. * The type code indicates the eeprom data format */ struct ethtool_modinfo { __u32 cmd; __u32 type; __u32 eeprom_len; __u32 reserved[8]; }; /** * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates * @cmd: ETHTOOL_{G,S}COALESCE * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after * a packet arrives. * @rx_max_coalesced_frames: Maximum number of packets to receive * before an RX interrupt. * @rx_coalesce_usecs_irq: Same as @rx_coalesce_usecs, except that * this value applies while an IRQ is being serviced by the host. * @rx_max_coalesced_frames_irq: Same as @rx_max_coalesced_frames, * except that this value applies while an IRQ is being serviced * by the host. * @tx_coalesce_usecs: How many usecs to delay a TX interrupt after * a packet is sent. * @tx_max_coalesced_frames: Maximum number of packets to be sent * before a TX interrupt. * @tx_coalesce_usecs_irq: Same as @tx_coalesce_usecs, except that * this value applies while an IRQ is being serviced by the host. * @tx_max_coalesced_frames_irq: Same as @tx_max_coalesced_frames, * except that this value applies while an IRQ is being serviced * by the host. * @stats_block_coalesce_usecs: How many usecs to delay in-memory * statistics block updates. Some drivers do not have an * in-memory statistic block, and in such cases this value is * ignored. This value must not be zero. * @use_adaptive_rx_coalesce: Enable adaptive RX coalescing. * @use_adaptive_tx_coalesce: Enable adaptive TX coalescing. * @pkt_rate_low: Threshold for low packet rate (packets per second). * @rx_coalesce_usecs_low: How many usecs to delay an RX interrupt after * a packet arrives, when the packet rate is below @pkt_rate_low. * @rx_max_coalesced_frames_low: Maximum number of packets to be received * before an RX interrupt, when the packet rate is below @pkt_rate_low. * @tx_coalesce_usecs_low: How many usecs to delay a TX interrupt after * a packet is sent, when the packet rate is below @pkt_rate_low. * @tx_max_coalesced_frames_low: Maximum nuumber of packets to be sent before * a TX interrupt, when the packet rate is below @pkt_rate_low. * @pkt_rate_high: Threshold for high packet rate (packets per second). * @rx_coalesce_usecs_high: How many usecs to delay an RX interrupt after * a packet arrives, when the packet rate is above @pkt_rate_high. * @rx_max_coalesced_frames_high: Maximum number of packets to be received * before an RX interrupt, when the packet rate is above @pkt_rate_high. * @tx_coalesce_usecs_high: How many usecs to delay a TX interrupt after * a packet is sent, when the packet rate is above @pkt_rate_high. * @tx_max_coalesced_frames_high: Maximum number of packets to be sent before * a TX interrupt, when the packet rate is above @pkt_rate_high. * @rate_sample_interval: How often to do adaptive coalescing packet rate * sampling, measured in seconds. Must not be zero. * * Each pair of (usecs, max_frames) fields specifies that interrupts * should be coalesced until * (usecs > 0 && time_since_first_completion >= usecs) || * (max_frames > 0 && completed_frames >= max_frames) * * It is illegal to set both usecs and max_frames to zero as this * would cause interrupts to never be generated. To disable * coalescing, set usecs = 0 and max_frames = 1. * * Some implementations ignore the value of max_frames and use the * condition time_since_first_completion >= usecs * * This is deprecated. Drivers for hardware that does not support * counting completions should validate that max_frames == !rx_usecs. * * Adaptive RX/TX coalescing is an algorithm implemented by some * drivers to improve latency under low packet rates and improve * throughput under high packet rates. Some drivers only implement * one of RX or TX adaptive coalescing. Anything not implemented by * the driver causes these values to be silently ignored. * * When the packet rate is below @pkt_rate_high but above * @pkt_rate_low (both measured in packets per second) the * normal {rx,tx}_* coalescing parameters are used. */ struct ethtool_coalesce { __u32 cmd; __u32 rx_coalesce_usecs; __u32 rx_max_coalesced_frames; __u32 rx_coalesce_usecs_irq; __u32 rx_max_coalesced_frames_irq; __u32 tx_coalesce_usecs; __u32 tx_max_coalesced_frames; __u32 tx_coalesce_usecs_irq; __u32 tx_max_coalesced_frames_irq; __u32 stats_block_coalesce_usecs; __u32 use_adaptive_rx_coalesce; __u32 use_adaptive_tx_coalesce; __u32 pkt_rate_low; __u32 rx_coalesce_usecs_low; __u32 rx_max_coalesced_frames_low; __u32 tx_coalesce_usecs_low; __u32 tx_max_coalesced_frames_low; __u32 pkt_rate_high; __u32 rx_coalesce_usecs_high; __u32 rx_max_coalesced_frames_high; __u32 tx_coalesce_usecs_high; __u32 tx_max_coalesced_frames_high; __u32 rate_sample_interval; }; /** * struct ethtool_ringparam - RX/TX ring parameters * @cmd: Command number = %ETHTOOL_GRINGPARAM or %ETHTOOL_SRINGPARAM * @rx_max_pending: Maximum supported number of pending entries per * RX ring. Read-only. * @rx_mini_max_pending: Maximum supported number of pending entries * per RX mini ring. Read-only. * @rx_jumbo_max_pending: Maximum supported number of pending entries * per RX jumbo ring. Read-only. * @tx_max_pending: Maximum supported number of pending entries per * TX ring. Read-only. * @rx_pending: Current maximum number of pending entries per RX ring * @rx_mini_pending: Current maximum number of pending entries per RX * mini ring * @rx_jumbo_pending: Current maximum number of pending entries per RX * jumbo ring * @tx_pending: Current maximum supported number of pending entries * per TX ring * * If the interface does not have separate RX mini and/or jumbo rings, * @rx_mini_max_pending and/or @rx_jumbo_max_pending will be 0. * * There may also be driver-dependent minimum values for the number * of entries per ring. */ struct ethtool_ringparam { __u32 cmd; __u32 rx_max_pending; __u32 rx_mini_max_pending; __u32 rx_jumbo_max_pending; __u32 tx_max_pending; __u32 rx_pending; __u32 rx_mini_pending; __u32 rx_jumbo_pending; __u32 tx_pending; }; /** * struct ethtool_channels - configuring number of network channel * @cmd: ETHTOOL_{G,S}CHANNELS * @max_rx: Read only. Maximum number of receive channel the driver support. * @max_tx: Read only. Maximum number of transmit channel the driver support. * @max_other: Read only. Maximum number of other channel the driver support. * @max_combined: Read only. Maximum number of combined channel the driver * support. Set of queues RX, TX or other. * @rx_count: Valid values are in the range 1 to the max_rx. * @tx_count: Valid values are in the range 1 to the max_tx. * @other_count: Valid values are in the range 1 to the max_other. * @combined_count: Valid values are in the range 1 to the max_combined. * * This can be used to configure RX, TX and other channels. */ struct ethtool_channels { __u32 cmd; __u32 max_rx; __u32 max_tx; __u32 max_other; __u32 max_combined; __u32 rx_count; __u32 tx_count; __u32 other_count; __u32 combined_count; }; /** * struct ethtool_pauseparam - Ethernet pause (flow control) parameters * @cmd: Command number = %ETHTOOL_GPAUSEPARAM or %ETHTOOL_SPAUSEPARAM * @autoneg: Flag to enable autonegotiation of pause frame use * @rx_pause: Flag to enable reception of pause frames * @tx_pause: Flag to enable transmission of pause frames * * Drivers should reject a non-zero setting of @autoneg when * autoneogotiation is disabled (or not supported) for the link. * * If the link is autonegotiated, drivers should use * mii_advertise_flowctrl() or similar code to set the advertised * pause frame capabilities based on the @rx_pause and @tx_pause flags, * even if @autoneg is zero. They should also allow the advertised * pause frame capabilities to be controlled directly through the * advertising field of &struct ethtool_cmd. * * If @autoneg is non-zero, the MAC is configured to send and/or * receive pause frames according to the result of autonegotiation. * Otherwise, it is configured directly based on the @rx_pause and * @tx_pause flags. */ struct ethtool_pauseparam { __u32 cmd; __u32 autoneg; __u32 rx_pause; __u32 tx_pause; }; #define ETH_GSTRING_LEN 32 /** * enum ethtool_stringset - string set ID * @ETH_SS_TEST: Self-test result names, for use with %ETHTOOL_TEST * @ETH_SS_STATS: Statistic names, for use with %ETHTOOL_GSTATS * @ETH_SS_PRIV_FLAGS: Driver private flag names, for use with * %ETHTOOL_GPFLAGS and %ETHTOOL_SPFLAGS * @ETH_SS_NTUPLE_FILTERS: Previously used with %ETHTOOL_GRXNTUPLE; * now deprecated * @ETH_SS_FEATURES: Device feature names * @ETH_SS_RSS_HASH_FUNCS: RSS hush function names * @ETH_SS_PHY_STATS: Statistic names, for use with %ETHTOOL_GPHYSTATS * @ETH_SS_PHY_TUNABLES: PHY tunable names */ enum ethtool_stringset { ETH_SS_TEST = 0, ETH_SS_STATS, ETH_SS_PRIV_FLAGS, ETH_SS_NTUPLE_FILTERS, ETH_SS_FEATURES, ETH_SS_RSS_HASH_FUNCS, ETH_SS_TUNABLES, ETH_SS_PHY_STATS, ETH_SS_PHY_TUNABLES, }; /** * struct ethtool_gstrings - string set for data tagging * @cmd: Command number = %ETHTOOL_GSTRINGS * @string_set: String set ID; one of &enum ethtool_stringset * @len: On return, the number of strings in the string set * @data: Buffer for strings. Each string is null-padded to a size of * %ETH_GSTRING_LEN. * * Users must use %ETHTOOL_GSSET_INFO to find the number of strings in * the string set. They must allocate a buffer of the appropriate * size immediately following this structure. */ struct ethtool_gstrings { __u32 cmd; __u32 string_set; __u32 len; __u8 data[0]; }; /** * struct ethtool_sset_info - string set information * @cmd: Command number = %ETHTOOL_GSSET_INFO * @sset_mask: On entry, a bitmask of string sets to query, with bits * numbered according to &enum ethtool_stringset. On return, a * bitmask of those string sets queried that are supported. * @data: Buffer for string set sizes. On return, this contains the * size of each string set that was queried and supported, in * order of ID. * * Example: The user passes in @sset_mask = 0x7 (sets 0, 1, 2) and on * return @sset_mask == 0x6 (sets 1, 2). Then @data[0] contains the * size of set 1 and @data[1] contains the size of set 2. * * Users must allocate a buffer of the appropriate size (4 * number of * sets queried) immediately following this structure. */ struct ethtool_sset_info { __u32 cmd; __u32 reserved; __u64 sset_mask; __u32 data[0]; }; /** * enum ethtool_test_flags - flags definition of ethtool_test * @ETH_TEST_FL_OFFLINE: if set perform online and offline tests, otherwise * only online tests. * @ETH_TEST_FL_FAILED: Driver set this flag if test fails. * @ETH_TEST_FL_EXTERNAL_LB: Application request to perform external loopback * test. * @ETH_TEST_FL_EXTERNAL_LB_DONE: Driver performed the external loopback test */ enum ethtool_test_flags { ETH_TEST_FL_OFFLINE = (1 << 0), ETH_TEST_FL_FAILED = (1 << 1), ETH_TEST_FL_EXTERNAL_LB = (1 << 2), ETH_TEST_FL_EXTERNAL_LB_DONE = (1 << 3), }; /** * struct ethtool_test - device self-test invocation * @cmd: Command number = %ETHTOOL_TEST * @flags: A bitmask of flags from &enum ethtool_test_flags. Some * flags may be set by the user on entry; others may be set by * the driver on return. * @len: On return, the number of test results * @data: Array of test results * * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the * number of test results that will be returned. They must allocate a * buffer of the appropriate size (8 * number of results) immediately * following this structure. */ struct ethtool_test { __u32 cmd; __u32 flags; __u32 reserved; __u32 len; __u64 data[0]; }; /** * struct ethtool_stats - device-specific statistics * @cmd: Command number = %ETHTOOL_GSTATS * @n_stats: On return, the number of statistics * @data: Array of statistics * * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the * number of statistics that will be returned. They must allocate a * buffer of the appropriate size (8 * number of statistics) * immediately following this structure. */ struct ethtool_stats { __u32 cmd; __u32 n_stats; __u64 data[0]; }; /** * struct ethtool_perm_addr - permanent hardware address * @cmd: Command number = %ETHTOOL_GPERMADDR * @size: On entry, the size of the buffer. On return, the size of the * address. The command fails if the buffer is too small. * @data: Buffer for the address * * Users must allocate the buffer immediately following this structure. * A buffer size of %MAX_ADDR_LEN should be sufficient for any address * type. */ struct ethtool_perm_addr { __u32 cmd; __u32 size; __u8 data[0]; }; /* boolean flags controlling per-interface behavior characteristics. * When reading, the flag indicates whether or not a certain behavior * is enabled/present. When writing, the flag indicates whether * or not the driver should turn on (set) or off (clear) a behavior. * * Some behaviors may read-only (unconditionally absent or present). * If such is the case, return EINVAL in the set-flags operation if the * flag differs from the read-only value. */ enum ethtool_flags { ETH_FLAG_TXVLAN = (1 << 7), /* TX VLAN offload enabled */ ETH_FLAG_RXVLAN = (1 << 8), /* RX VLAN offload enabled */ ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */ ETH_FLAG_RXHASH = (1 << 28), }; /* The following structures are for supporting RX network flow * classification and RX n-tuple configuration. Note, all multibyte * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to * be in network byte order. */ /** * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc. * @ip4src: Source host * @ip4dst: Destination host * @psrc: Source port * @pdst: Destination port * @tos: Type-of-service * * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow. */ struct ethtool_tcpip4_spec { __be32 ip4src; __be32 ip4dst; __be16 psrc; __be16 pdst; __u8 tos; }; /** * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4 * @ip4src: Source host * @ip4dst: Destination host * @spi: Security parameters index * @tos: Type-of-service * * This can be used to specify an IPsec transport or tunnel over IPv4. */ struct ethtool_ah_espip4_spec { __be32 ip4src; __be32 ip4dst; __be32 spi; __u8 tos; }; #define ETH_RX_NFC_IP4 1 /** * struct ethtool_usrip4_spec - general flow specification for IPv4 * @ip4src: Source host * @ip4dst: Destination host * @l4_4_bytes: First 4 bytes of transport (layer 4) header * @tos: Type-of-service * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0 * @proto: Transport protocol number; mask must be 0 */ struct ethtool_usrip4_spec { __be32 ip4src; __be32 ip4dst; __be32 l4_4_bytes; __u8 tos; __u8 ip_ver; __u8 proto; }; /** * struct ethtool_tcpip6_spec - flow specification for TCP/IPv6 etc. * @ip6src: Source host * @ip6dst: Destination host * @psrc: Source port * @pdst: Destination port * @tclass: Traffic Class * * This can be used to specify a TCP/IPv6, UDP/IPv6 or SCTP/IPv6 flow. */ struct ethtool_tcpip6_spec { __be32 ip6src[4]; __be32 ip6dst[4]; __be16 psrc; __be16 pdst; __u8 tclass; }; /** * struct ethtool_ah_espip6_spec - flow specification for IPsec/IPv6 * @ip6src: Source host * @ip6dst: Destination host * @spi: Security parameters index * @tclass: Traffic Class * * This can be used to specify an IPsec transport or tunnel over IPv6. */ struct ethtool_ah_espip6_spec { __be32 ip6src[4]; __be32 ip6dst[4]; __be32 spi; __u8 tclass; }; /** * struct ethtool_usrip6_spec - general flow specification for IPv6 * @ip6src: Source host * @ip6dst: Destination host * @l4_4_bytes: First 4 bytes of transport (layer 4) header * @tclass: Traffic Class * @l4_proto: Transport protocol number (nexthdr after any Extension Headers) */ struct ethtool_usrip6_spec { __be32 ip6src[4]; __be32 ip6dst[4]; __be32 l4_4_bytes; __u8 tclass; __u8 l4_proto; }; union ethtool_flow_union { struct ethtool_tcpip4_spec tcp_ip4_spec; struct ethtool_tcpip4_spec udp_ip4_spec; struct ethtool_tcpip4_spec sctp_ip4_spec; struct ethtool_ah_espip4_spec ah_ip4_spec; struct ethtool_ah_espip4_spec esp_ip4_spec; struct ethtool_usrip4_spec usr_ip4_spec; struct ethtool_tcpip6_spec tcp_ip6_spec; struct ethtool_tcpip6_spec udp_ip6_spec; struct ethtool_tcpip6_spec sctp_ip6_spec; struct ethtool_ah_espip6_spec ah_ip6_spec; struct ethtool_ah_espip6_spec esp_ip6_spec; struct ethtool_usrip6_spec usr_ip6_spec; struct ethhdr ether_spec; __u8 hdata[52]; }; /** * struct ethtool_flow_ext - additional RX flow fields * @h_dest: destination MAC address * @vlan_etype: VLAN EtherType * @vlan_tci: VLAN tag control information * @data: user defined data * * Note, @vlan_etype, @vlan_tci, and @data are only valid if %FLOW_EXT * is set in &struct ethtool_rx_flow_spec @flow_type. * @h_dest is valid if %FLOW_MAC_EXT is set. */ struct ethtool_flow_ext { __u8 padding[2]; unsigned char h_dest[ETH_ALEN]; __be16 vlan_etype; __be16 vlan_tci; __be32 data[2]; }; /** * struct ethtool_rx_flow_spec - classification rule for RX flows * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW * @h_u: Flow fields to match (dependent on @flow_type) * @h_ext: Additional fields to match * @m_u: Masks for flow field bits to be matched * @m_ext: Masks for additional field bits to be matched * Note, all additional fields must be ignored unless @flow_type * includes the %FLOW_EXT or %FLOW_MAC_EXT flag * (see &struct ethtool_flow_ext description). * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC * if packets should be discarded, or %RX_CLS_FLOW_WAKE if the * packets should be used for Wake-on-LAN with %WAKE_FILTER * @location: Location of rule in the table. Locations must be * numbered such that a flow matching multiple rules will be * classified according to the first (lowest numbered) rule. */ struct ethtool_rx_flow_spec { __u32 flow_type; union ethtool_flow_union h_u; struct ethtool_flow_ext h_ext; union ethtool_flow_union m_u; struct ethtool_flow_ext m_ext; __u64 ring_cookie; __u32 location; }; /* How rings are layed out when accessing virtual functions or * offloaded queues is device specific. To allow users to do flow * steering and specify these queues the ring cookie is partitioned * into a 32bit queue index with an 8 bit virtual function id. * This also leaves the 3bytes for further specifiers. It is possible * future devices may support more than 256 virtual functions if * devices start supporting PCIe w/ARI. However at the moment I * do not know of any devices that support this so I do not reserve * space for this at this time. If a future patch consumes the next * byte it should be aware of this possiblity. */ #define ETHTOOL_RX_FLOW_SPEC_RING 0x00000000FFFFFFFFLL #define ETHTOOL_RX_FLOW_SPEC_RING_VF 0x000000FF00000000LL #define ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF 32 static __inline__ __u64 ethtool_get_flow_spec_ring(__u64 ring_cookie) { return ETHTOOL_RX_FLOW_SPEC_RING & ring_cookie; } static __inline__ __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie) { return (ETHTOOL_RX_FLOW_SPEC_RING_VF & ring_cookie) >> ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF; } /** * struct ethtool_rxnfc - command to get or set RX flow classification rules * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH, * %ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE, * %ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW * @data: Command-dependent value * @fs: Flow classification rule * @rss_context: RSS context to be affected * @rule_cnt: Number of rules to be affected * @rule_locs: Array of used rule locations * * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating * the fields included in the flow hash, e.g. %RXH_IP_SRC. The following * structure fields must not be used, except that if @flow_type includes * the %FLOW_RSS flag, then @rss_context determines which RSS context to * act on. * * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues * on return. * * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined * rules on return. If @data is non-zero on return then it is the * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the * driver supports any special location values. If that flag is not * set in @data then special location values should not be used. * * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an * existing rule on entry and @fs contains the rule on return; if * @fs.@flow_type includes the %FLOW_RSS flag, then @rss_context is * filled with the RSS context ID associated with the rule. * * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the * user buffer for @rule_locs on entry. On return, @data is the size * of the rule table, @rule_cnt is the number of defined rules, and * @rule_locs contains the locations of the defined rules. Drivers * must use the second parameter to get_rxnfc() instead of @rule_locs. * * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update. * @fs.@location either specifies the location to use or is a special * location value with %RX_CLS_LOC_SPECIAL flag set. On return, * @fs.@location is the actual rule location. If @fs.@flow_type * includes the %FLOW_RSS flag, @rss_context is the RSS context ID to * use for flow spreading traffic which matches this rule. The value * from the rxfh indirection table will be added to @fs.@ring_cookie * to choose which ring to deliver to. * * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an * existing rule on entry. * * A driver supporting the special location values for * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused * location, and may remove a rule at a later location (lower * priority) that matches exactly the same set of flows. The special * values are %RX_CLS_LOC_ANY, selecting any location; * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum * priority); and %RX_CLS_LOC_LAST, selecting the last suitable * location (minimum priority). Additional special values may be * defined in future and drivers must return -%EINVAL for any * unrecognised value. */ struct ethtool_rxnfc { __u32 cmd; __u32 flow_type; __u64 data; struct ethtool_rx_flow_spec fs; union { __u32 rule_cnt; __u32 rss_context; }; __u32 rule_locs[0]; }; /** * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR * @size: On entry, the array size of the user buffer, which may be zero. * On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware * indirection table. * @ring_index: RX ring/queue index for each hash value * * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size * should be returned. For %ETHTOOL_SRXFHINDIR, a @size of zero means * the table should be reset to default values. This last feature * is not supported by the original implementations. */ struct ethtool_rxfh_indir { __u32 cmd; __u32 size; __u32 ring_index[0]; }; /** * struct ethtool_rxfh - command to get/set RX flow hash indir or/and hash key. * @cmd: Specific command number - %ETHTOOL_GRSSH or %ETHTOOL_SRSSH * @rss_context: RSS context identifier. Context 0 is the default for normal * traffic; other contexts can be referenced as the destination for RX flow * classification rules. %ETH_RXFH_CONTEXT_ALLOC is used with command * %ETHTOOL_SRSSH to allocate a new RSS context; on return this field will * contain the ID of the newly allocated context. * @indir_size: On entry, the array size of the user buffer for the * indirection table, which may be zero, or (for %ETHTOOL_SRSSH), * %ETH_RXFH_INDIR_NO_CHANGE. On return from %ETHTOOL_GRSSH, * the array size of the hardware indirection table. * @key_size: On entry, the array size of the user buffer for the hash key, * which may be zero. On return from %ETHTOOL_GRSSH, the size of the * hardware hash key. * @hfunc: Defines the current RSS hash function used by HW (or to be set to). * Valid values are one of the %ETH_RSS_HASH_*. * @rsvd: Reserved for future extensions. * @rss_config: RX ring/queue index for each hash value i.e., indirection table * of @indir_size __u32 elements, followed by hash key of @key_size * bytes. * * For %ETHTOOL_GRSSH, a @indir_size and key_size of zero means that only the * size should be returned. For %ETHTOOL_SRSSH, an @indir_size of * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested * and a @indir_size of zero means the indir table should be reset to default * values (if @rss_context == 0) or that the RSS context should be deleted. * An hfunc of zero means that hash function setting is not requested. */ struct ethtool_rxfh { __u32 cmd; __u32 rss_context; __u32 indir_size; __u32 key_size; __u8 hfunc; __u8 rsvd8[3]; __u32 rsvd32; __u32 rss_config[0]; }; #define ETH_RXFH_CONTEXT_ALLOC 0xffffffff #define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff /** * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW * @h_u: Flow field values to match (dependent on @flow_type) * @m_u: Masks for flow field value bits to be ignored * @vlan_tag: VLAN tag to match * @vlan_tag_mask: Mask for VLAN tag bits to be ignored * @data: Driver-dependent data to match * @data_mask: Mask for driver-dependent data bits to be ignored * @action: RX ring/queue index to deliver to (non-negative) or other action * (negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP) * * For flow types %TCP_V4_FLOW, %UDP_V4_FLOW and %SCTP_V4_FLOW, where * a field value and mask are both zero this is treated as if all mask * bits are set i.e. the field is ignored. */ struct ethtool_rx_ntuple_flow_spec { __u32 flow_type; union { struct ethtool_tcpip4_spec tcp_ip4_spec; struct ethtool_tcpip4_spec udp_ip4_spec; struct ethtool_tcpip4_spec sctp_ip4_spec; struct ethtool_ah_espip4_spec ah_ip4_spec; struct ethtool_ah_espip4_spec esp_ip4_spec; struct ethtool_usrip4_spec usr_ip4_spec; struct ethhdr ether_spec; __u8 hdata[72]; } h_u, m_u; __u16 vlan_tag; __u16 vlan_tag_mask; __u64 data; __u64 data_mask; __s32 action; #define ETHTOOL_RXNTUPLE_ACTION_DROP (-1) /* drop packet */ #define ETHTOOL_RXNTUPLE_ACTION_CLEAR (-2) /* clear filter */ }; /** * struct ethtool_rx_ntuple - command to set or clear RX flow filter * @cmd: Command number - %ETHTOOL_SRXNTUPLE * @fs: Flow filter specification */ struct ethtool_rx_ntuple { __u32 cmd; struct ethtool_rx_ntuple_flow_spec fs; }; #define ETHTOOL_FLASH_MAX_FILENAME 128 enum ethtool_flash_op_type { ETHTOOL_FLASH_ALL_REGIONS = 0, }; /* for passing firmware flashing related parameters */ struct ethtool_flash { __u32 cmd; __u32 region; char data[ETHTOOL_FLASH_MAX_FILENAME]; }; /** * struct ethtool_dump - used for retrieving, setting device dump * @cmd: Command number - %ETHTOOL_GET_DUMP_FLAG, %ETHTOOL_GET_DUMP_DATA, or * %ETHTOOL_SET_DUMP * @version: FW version of the dump, filled in by driver * @flag: driver dependent flag for dump setting, filled in by driver during * get and filled in by ethtool for set operation. * flag must be initialized by macro ETH_FW_DUMP_DISABLE value when * firmware dump is disabled. * @len: length of dump data, used as the length of the user buffer on entry to * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver * for %ETHTOOL_GET_DUMP_FLAG command * @data: data collected for get dump data operation */ struct ethtool_dump { __u32 cmd; __u32 version; __u32 flag; __u32 len; __u8 data[0]; }; #define ETH_FW_DUMP_DISABLE 0 /* for returning and changing feature sets */ /** * struct ethtool_get_features_block - block with state of 32 features * @available: mask of changeable features * @requested: mask of features requested to be enabled if possible * @active: mask of currently enabled features * @never_changed: mask of features not changeable for any device */ struct ethtool_get_features_block { __u32 available; __u32 requested; __u32 active; __u32 never_changed; }; /** * struct ethtool_gfeatures - command to get state of device's features * @cmd: command number = %ETHTOOL_GFEATURES * @size: On entry, the number of elements in the features[] array; * on return, the number of elements in features[] needed to hold * all features * @features: state of features */ struct ethtool_gfeatures { __u32 cmd; __u32 size; struct ethtool_get_features_block features[0]; }; /** * struct ethtool_set_features_block - block with request for 32 features * @valid: mask of features to be changed * @requested: values of features to be changed */ struct ethtool_set_features_block { __u32 valid; __u32 requested; }; /** * struct ethtool_sfeatures - command to request change in device's features * @cmd: command number = %ETHTOOL_SFEATURES * @size: array size of the features[] array * @features: feature change masks */ struct ethtool_sfeatures { __u32 cmd; __u32 size; struct ethtool_set_features_block features[0]; }; /** * struct ethtool_ts_info - holds a device's timestamping and PHC association * @cmd: command number = %ETHTOOL_GET_TS_INFO * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags * @phc_index: device index of the associated PHC, or -1 if there is none * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values * * The bits in the 'tx_types' and 'rx_filters' fields correspond to * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values, * respectively. For example, if the device supports HWTSTAMP_TX_ON, * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set. * * Drivers should only report the filters they actually support without * upscaling in the SIOCSHWTSTAMP ioctl. If the SIOCSHWSTAMP request for * HWTSTAMP_FILTER_V1_SYNC is supported by HWTSTAMP_FILTER_V1_EVENT, then the * driver should only report HWTSTAMP_FILTER_V1_EVENT in this op. */ struct ethtool_ts_info { __u32 cmd; __u32 so_timestamping; __s32 phc_index; __u32 tx_types; __u32 tx_reserved[3]; __u32 rx_filters; __u32 rx_reserved[3]; }; /* * %ETHTOOL_SFEATURES changes features present in features[].valid to the * values of corresponding bits in features[].requested. Bits in .requested * not set in .valid or not changeable are ignored. * * Returns %EINVAL when .valid contains undefined or never-changeable bits * or size is not equal to required number of features words (32-bit blocks). * Returns >= 0 if request was completed; bits set in the value mean: * %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not * changeable (not present in %ETHTOOL_GFEATURES' features[].available) * those bits were ignored. * %ETHTOOL_F_WISH - some or all changes requested were recorded but the * resulting state of bits masked by .valid is not equal to .requested. * Probably there are other device-specific constraints on some features * in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered * here as though ignored bits were cleared. * %ETHTOOL_F_COMPAT - some or all changes requested were made by calling * compatibility functions. Requested offload state cannot be properly * managed by kernel. * * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands * for ETH_SS_FEATURES string set. First entry in the table corresponds to least * significant bit in features[0] fields. Empty strings mark undefined features. */ enum ethtool_sfeatures_retval_bits { ETHTOOL_F_UNSUPPORTED__BIT, ETHTOOL_F_WISH__BIT, ETHTOOL_F_COMPAT__BIT, }; #define ETHTOOL_F_UNSUPPORTED (1 << ETHTOOL_F_UNSUPPORTED__BIT) #define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT) #define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT) #define MAX_NUM_QUEUE 4096 /** * struct ethtool_per_queue_op - apply sub command to the queues in mask. * @cmd: ETHTOOL_PERQUEUE * @sub_command: the sub command which apply to each queues * @queue_mask: Bitmap of the queues which sub command apply to * @data: A complete command structure following for each of the queues addressed */ struct ethtool_per_queue_op { __u32 cmd; __u32 sub_command; __u32 queue_mask[__KERNEL_DIV_ROUND_UP(MAX_NUM_QUEUE, 32)]; char data[]; }; /** * struct ethtool_fecparam - Ethernet forward error correction(fec) parameters * @cmd: Command number = %ETHTOOL_GFECPARAM or %ETHTOOL_SFECPARAM * @active_fec: FEC mode which is active on porte * @fec: Bitmask of supported/configured FEC modes * @rsvd: Reserved for future extensions. i.e FEC bypass feature. * * Drivers should reject a non-zero setting of @autoneg when * autoneogotiation is disabled (or not supported) for the link. * */ struct ethtool_fecparam { __u32 cmd; /* bitmask of FEC modes */ __u32 active_fec; __u32 fec; __u32 reserved; }; /** * enum ethtool_fec_config_bits - flags definition of ethtool_fec_configuration * @ETHTOOL_FEC_NONE: FEC mode configuration is not supported * @ETHTOOL_FEC_AUTO: Default/Best FEC mode provided by driver * @ETHTOOL_FEC_OFF: No FEC Mode * @ETHTOOL_FEC_RS: Reed-Solomon Forward Error Detection mode * @ETHTOOL_FEC_BASER: Base-R/Reed-Solomon Forward Error Detection mode */ enum ethtool_fec_config_bits { ETHTOOL_FEC_NONE_BIT, ETHTOOL_FEC_AUTO_BIT, ETHTOOL_FEC_OFF_BIT, ETHTOOL_FEC_RS_BIT, ETHTOOL_FEC_BASER_BIT, }; #define ETHTOOL_FEC_NONE (1 << ETHTOOL_FEC_NONE_BIT) #define ETHTOOL_FEC_AUTO (1 << ETHTOOL_FEC_AUTO_BIT) #define ETHTOOL_FEC_OFF (1 << ETHTOOL_FEC_OFF_BIT) #define ETHTOOL_FEC_RS (1 << ETHTOOL_FEC_RS_BIT) #define ETHTOOL_FEC_BASER (1 << ETHTOOL_FEC_BASER_BIT) /* CMDs currently supported */ #define ETHTOOL_GSET 0x00000001 /* DEPRECATED, Get settings. * Please use ETHTOOL_GLINKSETTINGS */ #define ETHTOOL_SSET 0x00000002 /* DEPRECATED, Set settings. * Please use ETHTOOL_SLINKSETTINGS */ #define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */ #define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */ #define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */ #define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */ #define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */ #define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */ #define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */ /* Get link status for host, i.e. whether the interface *and* the * physical port (if there is one) are up (ethtool_value). */ #define ETHTOOL_GLINK 0x0000000a #define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */ #define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */ #define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */ #define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */ #define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */ #define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */ #define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */ #define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */ #define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */ #define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */ #define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */ #define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */ #define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable * (ethtool_value) */ #define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable * (ethtool_value). */ #define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */ #define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */ #define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */ #define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */ #define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */ #define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */ #define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */ #define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */ #define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */ #define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */ #define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */ #define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */ #define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */ #define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */ #define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */ #define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ #define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ #define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */ #define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */ #define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */ #define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */ #define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */ #define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */ #define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */ #define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */ #define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */ #define ETHTOOL_RESET 0x00000034 /* Reset hardware */ #define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */ #define ETHTOOL_GRXNTUPLE 0x00000036 /* deprecated */ #define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */ #define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */ #define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */ #define ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */ #define ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */ #define ETHTOOL_GCHANNELS 0x0000003c /* Get no of channels */ #define ETHTOOL_SCHANNELS 0x0000003d /* Set no of channels */ #define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */ #define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */ #define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */ #define ETHTOOL_GET_TS_INFO 0x00000041 /* Get time stamping and PHC info */ #define ETHTOOL_GMODULEINFO 0x00000042 /* Get plug-in module information */ #define ETHTOOL_GMODULEEEPROM 0x00000043 /* Get plug-in module eeprom */ #define ETHTOOL_GEEE 0x00000044 /* Get EEE settings */ #define ETHTOOL_SEEE 0x00000045 /* Set EEE settings */ #define ETHTOOL_GRSSH 0x00000046 /* Get RX flow hash configuration */ #define ETHTOOL_SRSSH 0x00000047 /* Set RX flow hash configuration */ #define ETHTOOL_GTUNABLE 0x00000048 /* Get tunable configuration */ #define ETHTOOL_STUNABLE 0x00000049 /* Set tunable configuration */ #define ETHTOOL_GPHYSTATS 0x0000004a /* get PHY-specific statistics */ #define ETHTOOL_PERQUEUE 0x0000004b /* Set per queue options */ #define ETHTOOL_GLINKSETTINGS 0x0000004c /* Get ethtool_link_settings */ #define ETHTOOL_SLINKSETTINGS 0x0000004d /* Set ethtool_link_settings */ #define ETHTOOL_PHY_GTUNABLE 0x0000004e /* Get PHY tunable configuration */ #define ETHTOOL_PHY_STUNABLE 0x0000004f /* Set PHY tunable configuration */ #define ETHTOOL_GFECPARAM 0x00000050 /* Get FEC settings */ #define ETHTOOL_SFECPARAM 0x00000051 /* Set FEC settings */ /* compatibility with older code */ #define SPARC_ETH_GSET ETHTOOL_GSET #define SPARC_ETH_SSET ETHTOOL_SSET /* Link mode bit indices */ enum ethtool_link_mode_bit_indices { ETHTOOL_LINK_MODE_10baseT_Half_BIT = 0, ETHTOOL_LINK_MODE_10baseT_Full_BIT = 1, ETHTOOL_LINK_MODE_100baseT_Half_BIT = 2, ETHTOOL_LINK_MODE_100baseT_Full_BIT = 3, ETHTOOL_LINK_MODE_1000baseT_Half_BIT = 4, ETHTOOL_LINK_MODE_1000baseT_Full_BIT = 5, ETHTOOL_LINK_MODE_Autoneg_BIT = 6, ETHTOOL_LINK_MODE_TP_BIT = 7, ETHTOOL_LINK_MODE_AUI_BIT = 8, ETHTOOL_LINK_MODE_MII_BIT = 9, ETHTOOL_LINK_MODE_FIBRE_BIT = 10, ETHTOOL_LINK_MODE_BNC_BIT = 11, ETHTOOL_LINK_MODE_10000baseT_Full_BIT = 12, ETHTOOL_LINK_MODE_Pause_BIT = 13, ETHTOOL_LINK_MODE_Asym_Pause_BIT = 14, ETHTOOL_LINK_MODE_2500baseX_Full_BIT = 15, ETHTOOL_LINK_MODE_Backplane_BIT = 16, ETHTOOL_LINK_MODE_1000baseKX_Full_BIT = 17, ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT = 18, ETHTOOL_LINK_MODE_10000baseKR_Full_BIT = 19, ETHTOOL_LINK_MODE_10000baseR_FEC_BIT = 20, ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT = 21, ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT = 22, ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT = 23, ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT = 24, ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT = 25, ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT = 26, ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT = 27, ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT = 28, ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT = 29, ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT = 30, ETHTOOL_LINK_MODE_25000baseCR_Full_BIT = 31, ETHTOOL_LINK_MODE_25000baseKR_Full_BIT = 32, ETHTOOL_LINK_MODE_25000baseSR_Full_BIT = 33, ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT = 34, ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT = 35, ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT = 36, ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT = 37, ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT = 38, ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT = 39, ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT = 40, ETHTOOL_LINK_MODE_1000baseX_Full_BIT = 41, ETHTOOL_LINK_MODE_10000baseCR_Full_BIT = 42, ETHTOOL_LINK_MODE_10000baseSR_Full_BIT = 43, ETHTOOL_LINK_MODE_10000baseLR_Full_BIT = 44, ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT = 45, ETHTOOL_LINK_MODE_10000baseER_Full_BIT = 46, ETHTOOL_LINK_MODE_2500baseT_Full_BIT = 47, ETHTOOL_LINK_MODE_5000baseT_Full_BIT = 48, ETHTOOL_LINK_MODE_FEC_NONE_BIT = 49, ETHTOOL_LINK_MODE_FEC_RS_BIT = 50, ETHTOOL_LINK_MODE_FEC_BASER_BIT = 51, /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit * 31. Please do NOT define any SUPPORTED_* or ADVERTISED_* * macro for bits > 31. The only way to use indices > 31 is to * use the new ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. */ __ETHTOOL_LINK_MODE_LAST = ETHTOOL_LINK_MODE_FEC_BASER_BIT, }; #define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) \ (1UL << (ETHTOOL_LINK_MODE_ ## base_name ## _BIT)) /* DEPRECATED macros. Please migrate to * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT * define any new SUPPORTED_* macro for bits > 31. */ #define SUPPORTED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half) #define SUPPORTED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full) #define SUPPORTED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half) #define SUPPORTED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full) #define SUPPORTED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half) #define SUPPORTED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full) #define SUPPORTED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg) #define SUPPORTED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP) #define SUPPORTED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI) #define SUPPORTED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII) #define SUPPORTED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE) #define SUPPORTED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC) #define SUPPORTED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full) #define SUPPORTED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause) #define SUPPORTED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause) #define SUPPORTED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full) #define SUPPORTED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane) #define SUPPORTED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full) #define SUPPORTED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full) #define SUPPORTED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full) #define SUPPORTED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC) #define SUPPORTED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full) #define SUPPORTED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full) #define SUPPORTED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full) #define SUPPORTED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full) #define SUPPORTED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full) #define SUPPORTED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full) #define SUPPORTED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full) #define SUPPORTED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full) #define SUPPORTED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full) #define SUPPORTED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full) /* Please do not define any new SUPPORTED_* macro for bits > 31, see * notice above. */ /* * DEPRECATED macros. Please migrate to * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT * define any new ADERTISE_* macro for bits > 31. */ #define ADVERTISED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half) #define ADVERTISED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full) #define ADVERTISED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half) #define ADVERTISED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full) #define ADVERTISED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half) #define ADVERTISED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full) #define ADVERTISED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg) #define ADVERTISED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP) #define ADVERTISED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI) #define ADVERTISED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII) #define ADVERTISED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE) #define ADVERTISED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC) #define ADVERTISED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full) #define ADVERTISED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause) #define ADVERTISED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause) #define ADVERTISED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full) #define ADVERTISED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane) #define ADVERTISED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full) #define ADVERTISED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full) #define ADVERTISED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full) #define ADVERTISED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC) #define ADVERTISED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full) #define ADVERTISED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full) #define ADVERTISED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full) #define ADVERTISED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full) #define ADVERTISED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full) #define ADVERTISED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full) #define ADVERTISED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full) #define ADVERTISED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full) #define ADVERTISED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full) #define ADVERTISED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full) /* Please do not define any new ADVERTISED_* macro for bits > 31, see * notice above. */ /* The following are all involved in forcing a particular link * mode for the device for setting things. When getting the * devices settings, these indicate the current mode and whether * it was forced up into this mode or autonegotiated. */ /* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. * Update drivers/net/phy/phy.c:phy_speed_to_str() and * drivers/net/bonding/bond_3ad.c:__get_link_speed() when adding new values. */ #define SPEED_10 10 #define SPEED_100 100 #define SPEED_1000 1000 #define SPEED_2500 2500 #define SPEED_5000 5000 #define SPEED_10000 10000 #define SPEED_14000 14000 #define SPEED_20000 20000 #define SPEED_25000 25000 #define SPEED_40000 40000 #define SPEED_50000 50000 #define SPEED_56000 56000 #define SPEED_100000 100000 #define SPEED_UNKNOWN -1 static __inline__ int ethtool_validate_speed(__u32 speed) { return speed <= INT_MAX || speed == SPEED_UNKNOWN; } /* Duplex, half or full. */ #define DUPLEX_HALF 0x00 #define DUPLEX_FULL 0x01 #define DUPLEX_UNKNOWN 0xff static __inline__ int ethtool_validate_duplex(__u8 duplex) { switch (duplex) { case DUPLEX_HALF: case DUPLEX_FULL: case DUPLEX_UNKNOWN: return 1; } return 0; } /* Which connector port. */ #define PORT_TP 0x00 #define PORT_AUI 0x01 #define PORT_MII 0x02 #define PORT_FIBRE 0x03 #define PORT_BNC 0x04 #define PORT_DA 0x05 #define PORT_NONE 0xef #define PORT_OTHER 0xff /* Which transceiver to use. */ #define XCVR_INTERNAL 0x00 /* PHY and MAC are in the same package */ #define XCVR_EXTERNAL 0x01 /* PHY and MAC are in different packages */ #define XCVR_DUMMY1 0x02 #define XCVR_DUMMY2 0x03 #define XCVR_DUMMY3 0x04 /* Enable or disable autonegotiation. */ #define AUTONEG_DISABLE 0x00 #define AUTONEG_ENABLE 0x01 /* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then * the driver is required to renegotiate link */ #define ETH_TP_MDI_INVALID 0x00 /* status: unknown; control: unsupported */ #define ETH_TP_MDI 0x01 /* status: MDI; control: force MDI */ #define ETH_TP_MDI_X 0x02 /* status: MDI-X; control: force MDI-X */ #define ETH_TP_MDI_AUTO 0x03 /* control: auto-select */ /* Wake-On-Lan options. */ #define WAKE_PHY (1 << 0) #define WAKE_UCAST (1 << 1) #define WAKE_MCAST (1 << 2) #define WAKE_BCAST (1 << 3) #define WAKE_ARP (1 << 4) #define WAKE_MAGIC (1 << 5) #define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */ #define WAKE_FILTER (1 << 7) /* L2-L4 network traffic flow types */ #define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */ #define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */ #define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */ #define AH_ESP_V4_FLOW 0x04 /* hash only */ #define TCP_V6_FLOW 0x05 /* hash or spec (tcp_ip6_spec; nfc only) */ #define UDP_V6_FLOW 0x06 /* hash or spec (udp_ip6_spec; nfc only) */ #define SCTP_V6_FLOW 0x07 /* hash or spec (sctp_ip6_spec; nfc only) */ #define AH_ESP_V6_FLOW 0x08 /* hash only */ #define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */ #define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */ #define AH_V6_FLOW 0x0b /* hash or spec (ah_ip6_spec; nfc only) */ #define ESP_V6_FLOW 0x0c /* hash or spec (esp_ip6_spec; nfc only) */ #define IPV4_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */ #define IP_USER_FLOW IPV4_USER_FLOW #define IPV6_USER_FLOW 0x0e /* spec only (usr_ip6_spec; nfc only) */ #define IPV4_FLOW 0x10 /* hash only */ #define IPV6_FLOW 0x11 /* hash only */ #define ETHER_FLOW 0x12 /* spec only (ether_spec) */ /* Flag to enable additional fields in struct ethtool_rx_flow_spec */ #define FLOW_EXT 0x80000000 #define FLOW_MAC_EXT 0x40000000 /* Flag to enable RSS spreading of traffic matching rule (nfc only) */ #define FLOW_RSS 0x20000000 /* L3-L4 network traffic flow hash options */ #define RXH_L2DA (1 << 1) #define RXH_VLAN (1 << 2) #define RXH_L3_PROTO (1 << 3) #define RXH_IP_SRC (1 << 4) #define RXH_IP_DST (1 << 5) #define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */ #define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */ #define RXH_DISCARD (1 << 31) #define RX_CLS_FLOW_DISC 0xffffffffffffffffULL #define RX_CLS_FLOW_WAKE 0xfffffffffffffffeULL /* Special RX classification rule insert location values */ #define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */ #define RX_CLS_LOC_ANY 0xffffffff #define RX_CLS_LOC_FIRST 0xfffffffe #define RX_CLS_LOC_LAST 0xfffffffd /* EEPROM Standards for plug in modules */ #define ETH_MODULE_SFF_8079 0x1 #define ETH_MODULE_SFF_8079_LEN 256 #define ETH_MODULE_SFF_8472 0x2 #define ETH_MODULE_SFF_8472_LEN 512 #define ETH_MODULE_SFF_8636 0x3 #define ETH_MODULE_SFF_8636_LEN 256 #define ETH_MODULE_SFF_8436 0x4 #define ETH_MODULE_SFF_8436_LEN 256 /* Reset flags */ /* The reset() operation must clear the flags for the components which * were actually reset. On successful return, the flags indicate the * components which were not reset, either because they do not exist * in the hardware or because they cannot be reset independently. The * driver must never reset any components that were not requested. */ enum ethtool_reset_flags { /* These flags represent components dedicated to the interface * the command is addressed to. Shift any flag left by * ETH_RESET_SHARED_SHIFT to reset a shared component of the * same type. */ ETH_RESET_MGMT = 1 << 0, /* Management processor */ ETH_RESET_IRQ = 1 << 1, /* Interrupt requester */ ETH_RESET_DMA = 1 << 2, /* DMA engine */ ETH_RESET_FILTER = 1 << 3, /* Filtering/flow direction */ ETH_RESET_OFFLOAD = 1 << 4, /* Protocol offload */ ETH_RESET_MAC = 1 << 5, /* Media access controller */ ETH_RESET_PHY = 1 << 6, /* Transceiver/PHY */ ETH_RESET_RAM = 1 << 7, /* RAM shared between * multiple components */ ETH_RESET_AP = 1 << 8, /* Application processor */ ETH_RESET_DEDICATED = 0x0000ffff, /* All components dedicated to * this interface */ ETH_RESET_ALL = 0xffffffff, /* All components used by this * interface, even if shared */ }; #define ETH_RESET_SHARED_SHIFT 16 /** * struct ethtool_link_settings - link control and status * * IMPORTANT, Backward compatibility notice: When implementing new * user-space tools, please first try %ETHTOOL_GLINKSETTINGS, and * if it succeeds use %ETHTOOL_SLINKSETTINGS to change link * settings; do not use %ETHTOOL_SSET if %ETHTOOL_GLINKSETTINGS * succeeded: stick to %ETHTOOL_GLINKSETTINGS/%SLINKSETTINGS in * that case. Conversely, if %ETHTOOL_GLINKSETTINGS fails, use * %ETHTOOL_GSET to query and %ETHTOOL_SSET to change link * settings; do not use %ETHTOOL_SLINKSETTINGS if * %ETHTOOL_GLINKSETTINGS failed: stick to * %ETHTOOL_GSET/%ETHTOOL_SSET in that case. * * @cmd: Command number = %ETHTOOL_GLINKSETTINGS or %ETHTOOL_SLINKSETTINGS * @speed: Link speed (Mbps) * @duplex: Duplex mode; one of %DUPLEX_* * @port: Physical connector type; one of %PORT_* * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not * applicable. For clause 45 PHYs this is the PRTAD. * @autoneg: Enable/disable autonegotiation and auto-detection; * either %AUTONEG_DISABLE or %AUTONEG_ENABLE * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO * protocols supported by the interface; 0 if unknown. * Read-only. * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of * %ETH_TP_MDI_*. If the status is unknown or not applicable, the * value will be %ETH_TP_MDI_INVALID. Read-only. * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of * %ETH_TP_MDI_*. If MDI(-X) control is not implemented, reads * yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected. * When written successfully, the link should be renegotiated if * necessary. * @link_mode_masks_nwords: Number of 32-bit words for each of the * supported, advertising, lp_advertising link mode bitmaps. For * %ETHTOOL_GLINKSETTINGS: on entry, number of words passed by user * (>= 0); on return, if handshake in progress, negative if * request size unsupported by kernel: absolute value indicates * kernel expected size and all the other fields but cmd * are 0; otherwise (handshake completed), strictly positive * to indicate size used by kernel and cmd field stays * %ETHTOOL_GLINKSETTINGS, all other fields populated by driver. For * %ETHTOOL_SLINKSETTINGS: must be valid on entry, ie. a positive * value returned previously by %ETHTOOL_GLINKSETTINGS, otherwise * refused. For drivers: ignore this field (use kernel's * __ETHTOOL_LINK_MODE_MASK_NBITS instead), any change to it will * be overwritten by kernel. * @supported: Bitmap with each bit meaning given by * %ethtool_link_mode_bit_indices for the link modes, physical * connectors and other link features for which the interface * supports autonegotiation or auto-detection. Read-only. * @advertising: Bitmap with each bit meaning given by * %ethtool_link_mode_bit_indices for the link modes, physical * connectors and other link features that are advertised through * autonegotiation or enabled for auto-detection. * @lp_advertising: Bitmap with each bit meaning given by * %ethtool_link_mode_bit_indices for the link modes, and other * link features that the link partner advertised through * autonegotiation; 0 if unknown or not applicable. Read-only. * @transceiver: Used to distinguish different possible PHY types, * reported consistently by PHYLIB. Read-only. * * If autonegotiation is disabled, the speed and @duplex represent the * fixed link mode and are writable if the driver supports multiple * link modes. If it is enabled then they are read-only; if the link * is up they represent the negotiated link mode; if the link is down, * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode. * * Some hardware interfaces may have multiple PHYs and/or physical * connectors fitted or do not allow the driver to detect which are * fitted. For these interfaces @port and/or @phy_address may be * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE. * Otherwise, attempts to write different values may be ignored or * rejected. * * Deprecated %ethtool_cmd fields transceiver, maxtxpkt and maxrxpkt * are not available in %ethtool_link_settings. Until all drivers are * converted to ignore them or to the new %ethtool_link_settings API, * for both queries and changes, users should always try * %ETHTOOL_GLINKSETTINGS first, and if it fails with -ENOTSUPP stick * only to %ETHTOOL_GSET and %ETHTOOL_SSET consistently. If it * succeeds, then users should stick to %ETHTOOL_GLINKSETTINGS and * %ETHTOOL_SLINKSETTINGS (which would support drivers implementing * either %ethtool_cmd or %ethtool_link_settings). * * Users should assume that all fields not marked read-only are * writable and subject to validation by the driver. They should use * %ETHTOOL_GLINKSETTINGS to get the current values before making specific * changes and then applying them with %ETHTOOL_SLINKSETTINGS. * * Drivers that implement %get_link_ksettings and/or * %set_link_ksettings should ignore the @cmd * and @link_mode_masks_nwords fields (any change to them overwritten * by kernel), and rely only on kernel's internal * %__ETHTOOL_LINK_MODE_MASK_NBITS and * %ethtool_link_mode_mask_t. Drivers that implement * %set_link_ksettings() should validate all fields other than @cmd * and @link_mode_masks_nwords that are not described as read-only or * deprecated, and must ignore all fields described as read-only. */ struct ethtool_link_settings { __u32 cmd; __u32 speed; __u8 duplex; __u8 port; __u8 phy_address; __u8 autoneg; __u8 mdio_support; __u8 eth_tp_mdix; __u8 eth_tp_mdix_ctrl; __s8 link_mode_masks_nwords; __u8 transceiver; __u8 reserved1[3]; __u32 reserved[7]; __u32 link_mode_masks[0]; /* layout of link_mode_masks fields: * __u32 map_supported[link_mode_masks_nwords]; * __u32 map_advertising[link_mode_masks_nwords]; * __u32 map_lp_advertising[link_mode_masks_nwords]; */ }; #endif /* _LINUX_ETHTOOL_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/resource.h������������������������������������������������������������������������������������0000644�����������������00000004453�14763166027�0007725 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_RESOURCE_H #define _LINUX_RESOURCE_H #include <linux/time.h> #include <linux/types.h> /* * Resource control/accounting header file for linux */ /* * Definition of struct rusage taken from BSD 4.3 Reno * * We don't support all of these yet, but we might as well have them.... * Otherwise, each time we add new items, programs which depend on this * structure will lose. This reduces the chances of that happening. */ #define RUSAGE_SELF 0 #define RUSAGE_CHILDREN (-1) #define RUSAGE_BOTH (-2) /* sys_wait4() uses this */ #define RUSAGE_THREAD 1 /* only the calling thread */ struct rusage { struct timeval ru_utime; /* user time used */ struct timeval ru_stime; /* system time used */ __kernel_long_t ru_maxrss; /* maximum resident set size */ __kernel_long_t ru_ixrss; /* integral shared memory size */ __kernel_long_t ru_idrss; /* integral unshared data size */ __kernel_long_t ru_isrss; /* integral unshared stack size */ __kernel_long_t ru_minflt; /* page reclaims */ __kernel_long_t ru_majflt; /* page faults */ __kernel_long_t ru_nswap; /* swaps */ __kernel_long_t ru_inblock; /* block input operations */ __kernel_long_t ru_oublock; /* block output operations */ __kernel_long_t ru_msgsnd; /* messages sent */ __kernel_long_t ru_msgrcv; /* messages received */ __kernel_long_t ru_nsignals; /* signals received */ __kernel_long_t ru_nvcsw; /* voluntary context switches */ __kernel_long_t ru_nivcsw; /* involuntary " */ }; struct rlimit { __kernel_ulong_t rlim_cur; __kernel_ulong_t rlim_max; }; #define RLIM64_INFINITY (~0ULL) struct rlimit64 { __u64 rlim_cur; __u64 rlim_max; }; #define PRIO_MIN (-20) #define PRIO_MAX 20 #define PRIO_PROCESS 0 #define PRIO_PGRP 1 #define PRIO_USER 2 /* * Limit the stack by to some sane default: root can always * increase this limit if needed.. 8MB seems reasonable. */ #define _STK_LIM (8*1024*1024) /* * GPG2 wants 64kB of mlocked memory, to make sure pass phrases * and other sensitive information are never written to disk. */ #define MLOCK_LIMIT ((PAGE_SIZE > 64*1024) ? PAGE_SIZE : 64*1024) /* * Due to binary compatibility, the actual resource numbers * may be different for different linux versions.. */ #include <asm/resource.h> #endif /* _LINUX_RESOURCE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/mtio.h����������������������������������������������������������������������������������������0000644�����������������00000017757�14763166027�0007061 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/mtio.h header file for Linux. Written by H. Bergman * * Modified for special ioctls provided by zftape in September 1997 * by C.-J. Heine. */ #ifndef _LINUX_MTIO_H #define _LINUX_MTIO_H #include <linux/types.h> #include <linux/ioctl.h> /* * Structures and definitions for mag tape io control commands */ /* structure for MTIOCTOP - mag tape op command */ struct mtop { short mt_op; /* operations defined below */ int mt_count; /* how many of them */ }; /* Magnetic Tape operations [Not all operations supported by all drivers]: */ #define MTRESET 0 /* +reset drive in case of problems */ #define MTFSF 1 /* forward space over FileMark, * position at first record of next file */ #define MTBSF 2 /* backward space FileMark (position before FM) */ #define MTFSR 3 /* forward space record */ #define MTBSR 4 /* backward space record */ #define MTWEOF 5 /* write an end-of-file record (mark) */ #define MTREW 6 /* rewind */ #define MTOFFL 7 /* rewind and put the drive offline (eject?) */ #define MTNOP 8 /* no op, set status only (read with MTIOCGET) */ #define MTRETEN 9 /* retension tape */ #define MTBSFM 10 /* +backward space FileMark, position at FM */ #define MTFSFM 11 /* +forward space FileMark, position at FM */ #define MTEOM 12 /* goto end of recorded media (for appending files). * MTEOM positions after the last FM, ready for * appending another file. */ #define MTERASE 13 /* erase tape -- be careful! */ #define MTRAS1 14 /* run self test 1 (nondestructive) */ #define MTRAS2 15 /* run self test 2 (destructive) */ #define MTRAS3 16 /* reserved for self test 3 */ #define MTSETBLK 20 /* set block length (SCSI) */ #define MTSETDENSITY 21 /* set tape density (SCSI) */ #define MTSEEK 22 /* seek to block (Tandberg, etc.) */ #define MTTELL 23 /* tell block (Tandberg, etc.) */ #define MTSETDRVBUFFER 24 /* set the drive buffering according to SCSI-2 */ /* ordinary buffered operation with code 1 */ #define MTFSS 25 /* space forward over setmarks */ #define MTBSS 26 /* space backward over setmarks */ #define MTWSM 27 /* write setmarks */ #define MTLOCK 28 /* lock the drive door */ #define MTUNLOCK 29 /* unlock the drive door */ #define MTLOAD 30 /* execute the SCSI load command */ #define MTUNLOAD 31 /* execute the SCSI unload command */ #define MTCOMPRESSION 32/* control compression with SCSI mode page 15 */ #define MTSETPART 33 /* Change the active tape partition */ #define MTMKPART 34 /* Format the tape with one or two partitions */ #define MTWEOFI 35 /* write an end-of-file record (mark) in immediate mode */ /* structure for MTIOCGET - mag tape get status command */ struct mtget { long mt_type; /* type of magtape device */ long mt_resid; /* residual count: (not sure) * number of bytes ignored, or * number of files not skipped, or * number of records not skipped. */ /* the following registers are device dependent */ long mt_dsreg; /* status register */ long mt_gstat; /* generic (device independent) status */ long mt_erreg; /* error register */ /* The next two fields are not always used */ __kernel_daddr_t mt_fileno; /* number of current file on tape */ __kernel_daddr_t mt_blkno; /* current block number */ }; /* * Constants for mt_type. Not all of these are supported, * and these are not all of the ones that are supported. */ #define MT_ISUNKNOWN 0x01 #define MT_ISQIC02 0x02 /* Generic QIC-02 tape streamer */ #define MT_ISWT5150 0x03 /* Wangtek 5150EQ, QIC-150, QIC-02 */ #define MT_ISARCHIVE_5945L2 0x04 /* Archive 5945L-2, QIC-24, QIC-02? */ #define MT_ISCMSJ500 0x05 /* CMS Jumbo 500 (QIC-02?) */ #define MT_ISTDC3610 0x06 /* Tandberg 6310, QIC-24 */ #define MT_ISARCHIVE_VP60I 0x07 /* Archive VP60i, QIC-02 */ #define MT_ISARCHIVE_2150L 0x08 /* Archive Viper 2150L */ #define MT_ISARCHIVE_2060L 0x09 /* Archive Viper 2060L */ #define MT_ISARCHIVESC499 0x0A /* Archive SC-499 QIC-36 controller */ #define MT_ISQIC02_ALL_FEATURES 0x0F /* Generic QIC-02 with all features */ #define MT_ISWT5099EEN24 0x11 /* Wangtek 5099-een24, 60MB, QIC-24 */ #define MT_ISTEAC_MT2ST 0x12 /* Teac MT-2ST 155mb drive, Teac DC-1 card (Wangtek type) */ #define MT_ISEVEREX_FT40A 0x32 /* Everex FT40A (QIC-40) */ #define MT_ISDDS1 0x51 /* DDS device without partitions */ #define MT_ISDDS2 0x52 /* DDS device with partitions */ #define MT_ISONSTREAM_SC 0x61 /* OnStream SCSI tape drives (SC-x0) and SCSI emulated (DI, DP, USB) */ #define MT_ISSCSI1 0x71 /* Generic ANSI SCSI-1 tape unit */ #define MT_ISSCSI2 0x72 /* Generic ANSI SCSI-2 tape unit */ /* QIC-40/80/3010/3020 ftape supported drives. * 20bit vendor ID + 0x800000 (see ftape-vendors.h) */ #define MT_ISFTAPE_UNKNOWN 0x800000 /* obsolete */ #define MT_ISFTAPE_FLAG 0x800000 /* structure for MTIOCPOS - mag tape get position command */ struct mtpos { long mt_blkno; /* current block number */ }; /* mag tape io control commands */ #define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */ #define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */ #define MTIOCPOS _IOR('m', 3, struct mtpos) /* get tape position */ /* Generic Mag Tape (device independent) status macros for examining * mt_gstat -- HP-UX compatible. * There is room for more generic status bits here, but I don't * know which of them are reserved. At least three or so should * be added to make this really useful. */ #define GMT_EOF(x) ((x) & 0x80000000) #define GMT_BOT(x) ((x) & 0x40000000) #define GMT_EOT(x) ((x) & 0x20000000) #define GMT_SM(x) ((x) & 0x10000000) /* DDS setmark */ #define GMT_EOD(x) ((x) & 0x08000000) /* DDS EOD */ #define GMT_WR_PROT(x) ((x) & 0x04000000) /* #define GMT_ ? ((x) & 0x02000000) */ #define GMT_ONLINE(x) ((x) & 0x01000000) #define GMT_D_6250(x) ((x) & 0x00800000) #define GMT_D_1600(x) ((x) & 0x00400000) #define GMT_D_800(x) ((x) & 0x00200000) /* #define GMT_ ? ((x) & 0x00100000) */ /* #define GMT_ ? ((x) & 0x00080000) */ #define GMT_DR_OPEN(x) ((x) & 0x00040000) /* door open (no tape) */ /* #define GMT_ ? ((x) & 0x00020000) */ #define GMT_IM_REP_EN(x) ((x) & 0x00010000) /* immediate report mode */ #define GMT_CLN(x) ((x) & 0x00008000) /* cleaning requested */ /* 15 generic status bits unused */ /* SCSI-tape specific definitions */ /* Bitfield shifts in the status */ #define MT_ST_BLKSIZE_SHIFT 0 #define MT_ST_BLKSIZE_MASK 0xffffff #define MT_ST_DENSITY_SHIFT 24 #define MT_ST_DENSITY_MASK 0xff000000 #define MT_ST_SOFTERR_SHIFT 0 #define MT_ST_SOFTERR_MASK 0xffff /* Bitfields for the MTSETDRVBUFFER ioctl */ #define MT_ST_OPTIONS 0xf0000000 #define MT_ST_BOOLEANS 0x10000000 #define MT_ST_SETBOOLEANS 0x30000000 #define MT_ST_CLEARBOOLEANS 0x40000000 #define MT_ST_WRITE_THRESHOLD 0x20000000 #define MT_ST_DEF_BLKSIZE 0x50000000 #define MT_ST_DEF_OPTIONS 0x60000000 #define MT_ST_TIMEOUTS 0x70000000 #define MT_ST_SET_TIMEOUT (MT_ST_TIMEOUTS | 0x000000) #define MT_ST_SET_LONG_TIMEOUT (MT_ST_TIMEOUTS | 0x100000) #define MT_ST_SET_CLN 0x80000000 #define MT_ST_BUFFER_WRITES 0x1 #define MT_ST_ASYNC_WRITES 0x2 #define MT_ST_READ_AHEAD 0x4 #define MT_ST_DEBUGGING 0x8 #define MT_ST_TWO_FM 0x10 #define MT_ST_FAST_MTEOM 0x20 #define MT_ST_AUTO_LOCK 0x40 #define MT_ST_DEF_WRITES 0x80 #define MT_ST_CAN_BSR 0x100 #define MT_ST_NO_BLKLIMS 0x200 #define MT_ST_CAN_PARTITIONS 0x400 #define MT_ST_SCSI2LOGICAL 0x800 #define MT_ST_SYSV 0x1000 #define MT_ST_NOWAIT 0x2000 #define MT_ST_SILI 0x4000 #define MT_ST_NOWAIT_EOF 0x8000 /* The mode parameters to be controlled. Parameter chosen with bits 20-28 */ #define MT_ST_CLEAR_DEFAULT 0xfffff #define MT_ST_DEF_DENSITY (MT_ST_DEF_OPTIONS | 0x100000) #define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000) #define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000) /* The offset for the arguments for the special HP changer load command. */ #define MT_ST_HPLOADER_OFFSET 10000 #endif /* _LINUX_MTIO_H */ �����������������linux/minix_fs.h������������������������������������������������������������������������������������0000644�����������������00000004112�14763166027�0007702 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_MINIX_FS_H #define _LINUX_MINIX_FS_H #include <linux/types.h> #include <linux/magic.h> /* * The minix filesystem constants/structures */ /* * Thanks to Kees J Bot for sending me the definitions of the new * minix filesystem (aka V2) with bigger inodes and 32-bit block * pointers. */ #define MINIX_ROOT_INO 1 /* Not the same as the bogus LINK_MAX in <linux/limits.h>. Oh well. */ #define MINIX_LINK_MAX 250 #define MINIX2_LINK_MAX 65530 #define MINIX_I_MAP_SLOTS 8 #define MINIX_Z_MAP_SLOTS 64 #define MINIX_VALID_FS 0x0001 /* Clean fs. */ #define MINIX_ERROR_FS 0x0002 /* fs has errors. */ #define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode))) /* * This is the original minix inode layout on disk. * Note the 8-bit gid and atime and ctime. */ struct minix_inode { __u16 i_mode; __u16 i_uid; __u32 i_size; __u32 i_time; __u8 i_gid; __u8 i_nlinks; __u16 i_zone[9]; }; /* * The new minix inode has all the time entries, as well as * long block numbers and a third indirect block (7+1+1+1 * instead of 7+1+1). Also, some previously 8-bit values are * now 16-bit. The inode is now 64 bytes instead of 32. */ struct minix2_inode { __u16 i_mode; __u16 i_nlinks; __u16 i_uid; __u16 i_gid; __u32 i_size; __u32 i_atime; __u32 i_mtime; __u32 i_ctime; __u32 i_zone[10]; }; /* * minix super-block data on disk */ struct minix_super_block { __u16 s_ninodes; __u16 s_nzones; __u16 s_imap_blocks; __u16 s_zmap_blocks; __u16 s_firstdatazone; __u16 s_log_zone_size; __u32 s_max_size; __u16 s_magic; __u16 s_state; __u32 s_zones; }; /* * V3 minix super-block data on disk */ struct minix3_super_block { __u32 s_ninodes; __u16 s_pad0; __u16 s_imap_blocks; __u16 s_zmap_blocks; __u16 s_firstdatazone; __u16 s_log_zone_size; __u16 s_pad1; __u32 s_max_size; __u32 s_zones; __u16 s_magic; __u16 s_pad2; __u16 s_blocksize; __u8 s_disk_version; }; struct minix_dir_entry { __u16 inode; char name[0]; }; struct minix3_dir_entry { __u32 inode; char name[0]; }; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/pr.h������������������������������������������������������������������������������������������0000644�����������������00000002061�14763166027�0006510 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _PR_H #define _PR_H #include <linux/types.h> enum pr_type { PR_WRITE_EXCLUSIVE = 1, PR_EXCLUSIVE_ACCESS = 2, PR_WRITE_EXCLUSIVE_REG_ONLY = 3, PR_EXCLUSIVE_ACCESS_REG_ONLY = 4, PR_WRITE_EXCLUSIVE_ALL_REGS = 5, PR_EXCLUSIVE_ACCESS_ALL_REGS = 6, }; struct pr_reservation { __u64 key; __u32 type; __u32 flags; }; struct pr_registration { __u64 old_key; __u64 new_key; __u32 flags; __u32 __pad; }; struct pr_preempt { __u64 old_key; __u64 new_key; __u32 type; __u32 flags; }; struct pr_clear { __u64 key; __u32 flags; __u32 __pad; }; #define PR_FL_IGNORE_KEY (1 << 0) /* ignore existing key */ #define IOC_PR_REGISTER _IOW('p', 200, struct pr_registration) #define IOC_PR_RESERVE _IOW('p', 201, struct pr_reservation) #define IOC_PR_RELEASE _IOW('p', 202, struct pr_reservation) #define IOC_PR_PREEMPT _IOW('p', 203, struct pr_preempt) #define IOC_PR_PREEMPT_ABORT _IOW('p', 204, struct pr_preempt) #define IOC_PR_CLEAR _IOW('p', 205, struct pr_clear) #endif /* _PR_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/seg6_local.h����������������������������������������������������������������������������������0000644�����������������00000004014�14763166027�0010105 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * SR-IPv6 implementation * * Author: * David Lebrun <david.lebrun@uclouvain.be> * * * 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. */ #ifndef _LINUX_SEG6_LOCAL_H #define _LINUX_SEG6_LOCAL_H #include <linux/seg6.h> enum { SEG6_LOCAL_UNSPEC, SEG6_LOCAL_ACTION, SEG6_LOCAL_SRH, SEG6_LOCAL_TABLE, SEG6_LOCAL_NH4, SEG6_LOCAL_NH6, SEG6_LOCAL_IIF, SEG6_LOCAL_OIF, SEG6_LOCAL_BPF, __SEG6_LOCAL_MAX, }; #define SEG6_LOCAL_MAX (__SEG6_LOCAL_MAX - 1) enum { SEG6_LOCAL_ACTION_UNSPEC = 0, /* node segment */ SEG6_LOCAL_ACTION_END = 1, /* adjacency segment (IPv6 cross-connect) */ SEG6_LOCAL_ACTION_END_X = 2, /* lookup of next seg NH in table */ SEG6_LOCAL_ACTION_END_T = 3, /* decap and L2 cross-connect */ SEG6_LOCAL_ACTION_END_DX2 = 4, /* decap and IPv6 cross-connect */ SEG6_LOCAL_ACTION_END_DX6 = 5, /* decap and IPv4 cross-connect */ SEG6_LOCAL_ACTION_END_DX4 = 6, /* decap and lookup of DA in v6 table */ SEG6_LOCAL_ACTION_END_DT6 = 7, /* decap and lookup of DA in v4 table */ SEG6_LOCAL_ACTION_END_DT4 = 8, /* binding segment with insertion */ SEG6_LOCAL_ACTION_END_B6 = 9, /* binding segment with encapsulation */ SEG6_LOCAL_ACTION_END_B6_ENCAP = 10, /* binding segment with MPLS encap */ SEG6_LOCAL_ACTION_END_BM = 11, /* lookup last seg in table */ SEG6_LOCAL_ACTION_END_S = 12, /* forward to SR-unaware VNF with static proxy */ SEG6_LOCAL_ACTION_END_AS = 13, /* forward to SR-unaware VNF with masquerading */ SEG6_LOCAL_ACTION_END_AM = 14, /* custom BPF action */ SEG6_LOCAL_ACTION_END_BPF = 15, __SEG6_LOCAL_ACTION_MAX, }; #define SEG6_LOCAL_ACTION_MAX (__SEG6_LOCAL_ACTION_MAX - 1) enum { SEG6_LOCAL_BPF_PROG_UNSPEC, SEG6_LOCAL_BPF_PROG, SEG6_LOCAL_BPF_PROG_NAME, __SEG6_LOCAL_BPF_PROG_MAX, }; #define SEG6_LOCAL_BPF_PROG_MAX (__SEG6_LOCAL_BPF_PROG_MAX - 1) #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/i2o-dev.h�������������������������������������������������������������������������������������0000644�����������������00000026443�14763166027�0007346 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * I2O user space accessible structures/APIs * * (c) Copyright 1999, 2000 Red Hat Software * * 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 header file defines the I2O APIs that are available to both * the kernel and user level applications. Kernel specific structures * are defined in i2o_osm. OSMs should include _only_ i2o_osm.h which * automatically includes this file. * */ #ifndef _I2O_DEV_H #define _I2O_DEV_H /* How many controllers are we allowing */ #define MAX_I2O_CONTROLLERS 32 #include <linux/ioctl.h> #include <linux/types.h> /* * I2O Control IOCTLs and structures */ #define I2O_MAGIC_NUMBER 'i' #define I2OGETIOPS _IOR(I2O_MAGIC_NUMBER,0,__u8[MAX_I2O_CONTROLLERS]) #define I2OHRTGET _IOWR(I2O_MAGIC_NUMBER,1,struct i2o_cmd_hrtlct) #define I2OLCTGET _IOWR(I2O_MAGIC_NUMBER,2,struct i2o_cmd_hrtlct) #define I2OPARMSET _IOWR(I2O_MAGIC_NUMBER,3,struct i2o_cmd_psetget) #define I2OPARMGET _IOWR(I2O_MAGIC_NUMBER,4,struct i2o_cmd_psetget) #define I2OSWDL _IOWR(I2O_MAGIC_NUMBER,5,struct i2o_sw_xfer) #define I2OSWUL _IOWR(I2O_MAGIC_NUMBER,6,struct i2o_sw_xfer) #define I2OSWDEL _IOWR(I2O_MAGIC_NUMBER,7,struct i2o_sw_xfer) #define I2OVALIDATE _IOR(I2O_MAGIC_NUMBER,8,__u32) #define I2OHTML _IOWR(I2O_MAGIC_NUMBER,9,struct i2o_html) #define I2OEVTREG _IOW(I2O_MAGIC_NUMBER,10,struct i2o_evt_id) #define I2OEVTGET _IOR(I2O_MAGIC_NUMBER,11,struct i2o_evt_info) #define I2OPASSTHRU _IOR(I2O_MAGIC_NUMBER,12,struct i2o_cmd_passthru) #define I2OPASSTHRU32 _IOR(I2O_MAGIC_NUMBER,12,struct i2o_cmd_passthru32) struct i2o_cmd_passthru32 { unsigned int iop; /* IOP unit number */ __u32 msg; /* message */ }; struct i2o_cmd_passthru { unsigned int iop; /* IOP unit number */ void *msg; /* message */ }; struct i2o_cmd_hrtlct { unsigned int iop; /* IOP unit number */ void *resbuf; /* Buffer for result */ unsigned int *reslen; /* Buffer length in bytes */ }; struct i2o_cmd_psetget { unsigned int iop; /* IOP unit number */ unsigned int tid; /* Target device TID */ void *opbuf; /* Operation List buffer */ unsigned int oplen; /* Operation List buffer length in bytes */ void *resbuf; /* Result List buffer */ unsigned int *reslen; /* Result List buffer length in bytes */ }; struct i2o_sw_xfer { unsigned int iop; /* IOP unit number */ unsigned char flags; /* Flags field */ unsigned char sw_type; /* Software type */ unsigned int sw_id; /* Software ID */ void *buf; /* Pointer to software buffer */ unsigned int *swlen; /* Length of software data */ unsigned int *maxfrag; /* Maximum fragment count */ unsigned int *curfrag; /* Current fragment count */ }; struct i2o_html { unsigned int iop; /* IOP unit number */ unsigned int tid; /* Target device ID */ unsigned int page; /* HTML page */ void *resbuf; /* Buffer for reply HTML page */ unsigned int *reslen; /* Length in bytes of reply buffer */ void *qbuf; /* Pointer to HTTP query string */ unsigned int qlen; /* Length in bytes of query string buffer */ }; #define I2O_EVT_Q_LEN 32 struct i2o_evt_id { unsigned int iop; unsigned int tid; unsigned int evt_mask; }; /* Event data size = frame size - message header + evt indicator */ #define I2O_EVT_DATA_SIZE 88 struct i2o_evt_info { struct i2o_evt_id id; unsigned char evt_data[I2O_EVT_DATA_SIZE]; unsigned int data_size; }; struct i2o_evt_get { struct i2o_evt_info info; int pending; int lost; }; typedef struct i2o_sg_io_hdr { unsigned int flags; /* see I2O_DPT_SG_IO_FLAGS */ } i2o_sg_io_hdr_t; /************************************************************************** * HRT related constants and structures **************************************************************************/ #define I2O_BUS_LOCAL 0 #define I2O_BUS_ISA 1 #define I2O_BUS_EISA 2 /* was I2O_BUS_MCA 3 */ #define I2O_BUS_PCI 4 #define I2O_BUS_PCMCIA 5 #define I2O_BUS_NUBUS 6 #define I2O_BUS_CARDBUS 7 #define I2O_BUS_UNKNOWN 0x80 typedef struct _i2o_pci_bus { __u8 PciFunctionNumber; __u8 PciDeviceNumber; __u8 PciBusNumber; __u8 reserved; __u16 PciVendorID; __u16 PciDeviceID; } i2o_pci_bus; typedef struct _i2o_local_bus { __u16 LbBaseIOPort; __u16 reserved; __u32 LbBaseMemoryAddress; } i2o_local_bus; typedef struct _i2o_isa_bus { __u16 IsaBaseIOPort; __u8 CSN; __u8 reserved; __u32 IsaBaseMemoryAddress; } i2o_isa_bus; typedef struct _i2o_eisa_bus_info { __u16 EisaBaseIOPort; __u8 reserved; __u8 EisaSlotNumber; __u32 EisaBaseMemoryAddress; } i2o_eisa_bus; typedef struct _i2o_mca_bus { __u16 McaBaseIOPort; __u8 reserved; __u8 McaSlotNumber; __u32 McaBaseMemoryAddress; } i2o_mca_bus; typedef struct _i2o_other_bus { __u16 BaseIOPort; __u16 reserved; __u32 BaseMemoryAddress; } i2o_other_bus; typedef struct _i2o_hrt_entry { __u32 adapter_id; __u32 parent_tid:12; __u32 state:4; __u32 bus_num:8; __u32 bus_type:8; union { i2o_pci_bus pci_bus; i2o_local_bus local_bus; i2o_isa_bus isa_bus; i2o_eisa_bus eisa_bus; i2o_mca_bus mca_bus; i2o_other_bus other_bus; } bus; } i2o_hrt_entry; typedef struct _i2o_hrt { __u16 num_entries; __u8 entry_len; __u8 hrt_version; __u32 change_ind; i2o_hrt_entry hrt_entry[1]; } i2o_hrt; typedef struct _i2o_lct_entry { __u32 entry_size:16; __u32 tid:12; __u32 reserved:4; __u32 change_ind; __u32 device_flags; __u32 class_id:12; __u32 version:4; __u32 vendor_id:16; __u32 sub_class; __u32 user_tid:12; __u32 parent_tid:12; __u32 bios_info:8; __u8 identity_tag[8]; __u32 event_capabilities; } i2o_lct_entry; typedef struct _i2o_lct { __u32 table_size:16; __u32 boot_tid:12; __u32 lct_ver:4; __u32 iop_flags; __u32 change_ind; i2o_lct_entry lct_entry[1]; } i2o_lct; typedef struct _i2o_status_block { __u16 org_id; __u16 reserved; __u16 iop_id:12; __u16 reserved1:4; __u16 host_unit_id; __u16 segment_number:12; __u16 i2o_version:4; __u8 iop_state; __u8 msg_type; __u16 inbound_frame_size; __u8 init_code; __u8 reserved2; __u32 max_inbound_frames; __u32 cur_inbound_frames; __u32 max_outbound_frames; char product_id[24]; __u32 expected_lct_size; __u32 iop_capabilities; __u32 desired_mem_size; __u32 current_mem_size; __u32 current_mem_base; __u32 desired_io_size; __u32 current_io_size; __u32 current_io_base; __u32 reserved3:24; __u32 cmd_status:8; } i2o_status_block; /* Event indicator mask flags */ #define I2O_EVT_IND_STATE_CHANGE 0x80000000 #define I2O_EVT_IND_GENERAL_WARNING 0x40000000 #define I2O_EVT_IND_CONFIGURATION_FLAG 0x20000000 #define I2O_EVT_IND_LOCK_RELEASE 0x10000000 #define I2O_EVT_IND_CAPABILITY_CHANGE 0x08000000 #define I2O_EVT_IND_DEVICE_RESET 0x04000000 #define I2O_EVT_IND_EVT_MASK_MODIFIED 0x02000000 #define I2O_EVT_IND_FIELD_MODIFIED 0x01000000 #define I2O_EVT_IND_VENDOR_EVT 0x00800000 #define I2O_EVT_IND_DEVICE_STATE 0x00400000 /* Executive event indicitors */ #define I2O_EVT_IND_EXEC_RESOURCE_LIMITS 0x00000001 #define I2O_EVT_IND_EXEC_CONNECTION_FAIL 0x00000002 #define I2O_EVT_IND_EXEC_ADAPTER_FAULT 0x00000004 #define I2O_EVT_IND_EXEC_POWER_FAIL 0x00000008 #define I2O_EVT_IND_EXEC_RESET_PENDING 0x00000010 #define I2O_EVT_IND_EXEC_RESET_IMMINENT 0x00000020 #define I2O_EVT_IND_EXEC_HW_FAIL 0x00000040 #define I2O_EVT_IND_EXEC_XCT_CHANGE 0x00000080 #define I2O_EVT_IND_EXEC_NEW_LCT_ENTRY 0x00000100 #define I2O_EVT_IND_EXEC_MODIFIED_LCT 0x00000200 #define I2O_EVT_IND_EXEC_DDM_AVAILABILITY 0x00000400 /* Random Block Storage Event Indicators */ #define I2O_EVT_IND_BSA_VOLUME_LOAD 0x00000001 #define I2O_EVT_IND_BSA_VOLUME_UNLOAD 0x00000002 #define I2O_EVT_IND_BSA_VOLUME_UNLOAD_REQ 0x00000004 #define I2O_EVT_IND_BSA_CAPACITY_CHANGE 0x00000008 #define I2O_EVT_IND_BSA_SCSI_SMART 0x00000010 /* Event data for generic events */ #define I2O_EVT_STATE_CHANGE_NORMAL 0x00 #define I2O_EVT_STATE_CHANGE_SUSPENDED 0x01 #define I2O_EVT_STATE_CHANGE_RESTART 0x02 #define I2O_EVT_STATE_CHANGE_NA_RECOVER 0x03 #define I2O_EVT_STATE_CHANGE_NA_NO_RECOVER 0x04 #define I2O_EVT_STATE_CHANGE_QUIESCE_REQUEST 0x05 #define I2O_EVT_STATE_CHANGE_FAILED 0x10 #define I2O_EVT_STATE_CHANGE_FAULTED 0x11 #define I2O_EVT_GEN_WARNING_NORMAL 0x00 #define I2O_EVT_GEN_WARNING_ERROR_THRESHOLD 0x01 #define I2O_EVT_GEN_WARNING_MEDIA_FAULT 0x02 #define I2O_EVT_CAPABILITY_OTHER 0x01 #define I2O_EVT_CAPABILITY_CHANGED 0x02 #define I2O_EVT_SENSOR_STATE_CHANGED 0x01 /* * I2O classes / subclasses */ /* Class ID and Code Assignments * (LCT.ClassID.Version field) */ #define I2O_CLASS_VERSION_10 0x00 #define I2O_CLASS_VERSION_11 0x01 /* Class code names * (from v1.5 Table 6-1 Class Code Assignments.) */ #define I2O_CLASS_EXECUTIVE 0x000 #define I2O_CLASS_DDM 0x001 #define I2O_CLASS_RANDOM_BLOCK_STORAGE 0x010 #define I2O_CLASS_SEQUENTIAL_STORAGE 0x011 #define I2O_CLASS_LAN 0x020 #define I2O_CLASS_WAN 0x030 #define I2O_CLASS_FIBRE_CHANNEL_PORT 0x040 #define I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL 0x041 #define I2O_CLASS_SCSI_PERIPHERAL 0x051 #define I2O_CLASS_ATE_PORT 0x060 #define I2O_CLASS_ATE_PERIPHERAL 0x061 #define I2O_CLASS_FLOPPY_CONTROLLER 0x070 #define I2O_CLASS_FLOPPY_DEVICE 0x071 #define I2O_CLASS_BUS_ADAPTER 0x080 #define I2O_CLASS_PEER_TRANSPORT_AGENT 0x090 #define I2O_CLASS_PEER_TRANSPORT 0x091 #define I2O_CLASS_END 0xfff /* * Rest of 0x092 - 0x09f reserved for peer-to-peer classes */ #define I2O_CLASS_MATCH_ANYCLASS 0xffffffff /* * Subclasses */ #define I2O_SUBCLASS_i960 0x001 #define I2O_SUBCLASS_HDM 0x020 #define I2O_SUBCLASS_ISM 0x021 /* Operation functions */ #define I2O_PARAMS_FIELD_GET 0x0001 #define I2O_PARAMS_LIST_GET 0x0002 #define I2O_PARAMS_MORE_GET 0x0003 #define I2O_PARAMS_SIZE_GET 0x0004 #define I2O_PARAMS_TABLE_GET 0x0005 #define I2O_PARAMS_FIELD_SET 0x0006 #define I2O_PARAMS_LIST_SET 0x0007 #define I2O_PARAMS_ROW_ADD 0x0008 #define I2O_PARAMS_ROW_DELETE 0x0009 #define I2O_PARAMS_TABLE_CLEAR 0x000A /* * I2O serial number conventions / formats * (circa v1.5) */ #define I2O_SNFORMAT_UNKNOWN 0 #define I2O_SNFORMAT_BINARY 1 #define I2O_SNFORMAT_ASCII 2 #define I2O_SNFORMAT_UNICODE 3 #define I2O_SNFORMAT_LAN48_MAC 4 #define I2O_SNFORMAT_WAN 5 /* * Plus new in v2.0 (Yellowstone pdf doc) */ #define I2O_SNFORMAT_LAN64_MAC 6 #define I2O_SNFORMAT_DDM 7 #define I2O_SNFORMAT_IEEE_REG64 8 #define I2O_SNFORMAT_IEEE_REG128 9 #define I2O_SNFORMAT_UNKNOWN2 0xff /* * I2O Get Status State values */ #define ADAPTER_STATE_INITIALIZING 0x01 #define ADAPTER_STATE_RESET 0x02 #define ADAPTER_STATE_HOLD 0x04 #define ADAPTER_STATE_READY 0x05 #define ADAPTER_STATE_OPERATIONAL 0x08 #define ADAPTER_STATE_FAILED 0x10 #define ADAPTER_STATE_FAULTED 0x11 /* * Software module types */ #define I2O_SOFTWARE_MODULE_IRTOS 0x11 #define I2O_SOFTWARE_MODULE_IOP_PRIVATE 0x22 #define I2O_SOFTWARE_MODULE_IOP_CONFIG 0x23 /* * Vendors */ #define I2O_VENDOR_DPT 0x001b /* * DPT / Adaptec specific values for i2o_sg_io_hdr flags. */ #define I2O_DPT_SG_FLAG_INTERPRET 0x00010000 #define I2O_DPT_SG_FLAG_PHYSICAL 0x00020000 #define I2O_DPT_FLASH_FRAG_SIZE 0x10000 #define I2O_DPT_FLASH_READ 0x0101 #define I2O_DPT_FLASH_WRITE 0x0102 #endif /* _I2O_DEV_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/mempolicy.h�����������������������������������������������������������������������������������0000644�����������������00000004152�14763166027�0010070 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * NUMA memory policies for Linux. * Copyright 2003,2004 Andi Kleen SuSE Labs */ #ifndef _LINUX_MEMPOLICY_H #define _LINUX_MEMPOLICY_H #include <linux/errno.h> /* * Both the MPOL_* mempolicy mode and the MPOL_F_* optional mode flags are * passed by the user to either set_mempolicy() or mbind() in an 'int' actual. * The MPOL_MODE_FLAGS macro determines the legal set of optional mode flags. */ /* Policies */ enum { MPOL_DEFAULT, MPOL_PREFERRED, MPOL_BIND, MPOL_INTERLEAVE, MPOL_LOCAL, MPOL_MAX, /* always last member of enum */ }; /* Flags for set_mempolicy */ #define MPOL_F_STATIC_NODES (1 << 15) #define MPOL_F_RELATIVE_NODES (1 << 14) /* * MPOL_MODE_FLAGS is the union of all possible optional mode flags passed to * either set_mempolicy() or mbind(). */ #define MPOL_MODE_FLAGS (MPOL_F_STATIC_NODES | MPOL_F_RELATIVE_NODES) /* Flags for get_mempolicy */ #define MPOL_F_NODE (1<<0) /* return next IL mode instead of node mask */ #define MPOL_F_ADDR (1<<1) /* look up vma using address */ #define MPOL_F_MEMS_ALLOWED (1<<2) /* return allowed memories */ /* Flags for mbind */ #define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */ #define MPOL_MF_MOVE (1<<1) /* Move pages owned by this process to conform to policy */ #define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to policy */ #define MPOL_MF_LAZY (1<<3) /* Modifies '_MOVE: lazy migrate on fault */ #define MPOL_MF_INTERNAL (1<<4) /* Internal flags start here */ #define MPOL_MF_VALID (MPOL_MF_STRICT | \ MPOL_MF_MOVE | \ MPOL_MF_MOVE_ALL) /* * Internal flags that share the struct mempolicy flags word with * "mode flags". These flags are allocated from bit 0 up, as they * are never OR'ed into the mode in mempolicy API arguments. */ #define MPOL_F_SHARED (1 << 0) /* identify shared policies */ #define MPOL_F_LOCAL (1 << 1) /* preferred local allocation */ #define MPOL_F_MOF (1 << 3) /* this policy wants migrate on fault */ #define MPOL_F_MORON (1 << 4) /* Migrate On protnone Reference On Node */ #endif /* _LINUX_MEMPOLICY_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/affs_hardblocks.h�����������������������������������������������������������������������������0000644�����������������00000003010�14763166027�0011175 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef AFFS_HARDBLOCKS_H #define AFFS_HARDBLOCKS_H #include <linux/types.h> /* Just the needed definitions for the RDB of an Amiga HD. */ struct RigidDiskBlock { __u32 rdb_ID; __be32 rdb_SummedLongs; __s32 rdb_ChkSum; __u32 rdb_HostID; __be32 rdb_BlockBytes; __u32 rdb_Flags; __u32 rdb_BadBlockList; __be32 rdb_PartitionList; __u32 rdb_FileSysHeaderList; __u32 rdb_DriveInit; __u32 rdb_Reserved1[6]; __u32 rdb_Cylinders; __u32 rdb_Sectors; __u32 rdb_Heads; __u32 rdb_Interleave; __u32 rdb_Park; __u32 rdb_Reserved2[3]; __u32 rdb_WritePreComp; __u32 rdb_ReducedWrite; __u32 rdb_StepRate; __u32 rdb_Reserved3[5]; __u32 rdb_RDBBlocksLo; __u32 rdb_RDBBlocksHi; __u32 rdb_LoCylinder; __u32 rdb_HiCylinder; __u32 rdb_CylBlocks; __u32 rdb_AutoParkSeconds; __u32 rdb_HighRDSKBlock; __u32 rdb_Reserved4; char rdb_DiskVendor[8]; char rdb_DiskProduct[16]; char rdb_DiskRevision[4]; char rdb_ControllerVendor[8]; char rdb_ControllerProduct[16]; char rdb_ControllerRevision[4]; __u32 rdb_Reserved5[10]; }; #define IDNAME_RIGIDDISK 0x5244534B /* "RDSK" */ struct PartitionBlock { __be32 pb_ID; __be32 pb_SummedLongs; __s32 pb_ChkSum; __u32 pb_HostID; __be32 pb_Next; __u32 pb_Flags; __u32 pb_Reserved1[2]; __u32 pb_DevFlags; __u8 pb_DriveName[32]; __u32 pb_Reserved2[15]; __be32 pb_Environment[17]; __u32 pb_EReserved[15]; }; #define IDNAME_PARTITION 0x50415254 /* "PART" */ #define RDB_ALLOCATION_LIMIT 16 #endif /* AFFS_HARDBLOCKS_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/dlm_netlink.h���������������������������������������������������������������������������������0000644�����������������00000002207�14763166027�0010371 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2007 Red Hat, Inc. All rights reserved. * * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions * of the GNU General Public License v.2. */ #ifndef _DLM_NETLINK_H #define _DLM_NETLINK_H #include <linux/types.h> #include <linux/dlmconstants.h> enum { DLM_STATUS_WAITING = 1, DLM_STATUS_GRANTED = 2, DLM_STATUS_CONVERT = 3, }; #define DLM_LOCK_DATA_VERSION 1 struct dlm_lock_data { __u16 version; __u32 lockspace_id; int nodeid; int ownpid; __u32 id; __u32 remid; __u64 xid; __s8 status; __s8 grmode; __s8 rqmode; unsigned long timestamp; int resource_namelen; char resource_name[DLM_RESNAME_MAXLEN]; }; enum { DLM_CMD_UNSPEC = 0, DLM_CMD_HELLO, /* user->kernel */ DLM_CMD_TIMEOUT, /* kernel->user */ __DLM_CMD_MAX, }; #define DLM_CMD_MAX (__DLM_CMD_MAX - 1) enum { DLM_TYPE_UNSPEC = 0, DLM_TYPE_LOCK, __DLM_TYPE_MAX, }; #define DLM_TYPE_MAX (__DLM_TYPE_MAX - 1) #define DLM_GENL_VERSION 0x1 #define DLM_GENL_NAME "DLM" #endif /* _DLM_NETLINK_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/acct.h����������������������������������������������������������������������������������������0000644�����������������00000007225�14763166027�0007010 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * BSD Process Accounting for Linux - Definitions * * Author: Marco van Wieringen (mvw@planets.elm.net) * * This header file contains the definitions needed to implement * BSD-style process accounting. The kernel accounting code and all * user-level programs that try to do something useful with the * process accounting log must include this file. * * Copyright (C) 1995 - 1997 Marco van Wieringen - ELM Consultancy B.V. * */ #ifndef _LINUX_ACCT_H #define _LINUX_ACCT_H #include <linux/types.h> #include <asm/param.h> #include <asm/byteorder.h> /* * comp_t is a 16-bit "floating" point number with a 3-bit base 8 * exponent and a 13-bit fraction. * comp2_t is 24-bit with 5-bit base 2 exponent and 20 bit fraction * (leading 1 not stored). * See linux/kernel/acct.c for the specific encoding systems used. */ typedef __u16 comp_t; typedef __u32 comp2_t; /* * accounting file record * * This structure contains all of the information written out to the * process accounting file whenever a process exits. */ #define ACCT_COMM 16 struct acct { char ac_flag; /* Flags */ char ac_version; /* Always set to ACCT_VERSION */ /* for binary compatibility back until 2.0 */ __u16 ac_uid16; /* LSB of Real User ID */ __u16 ac_gid16; /* LSB of Real Group ID */ __u16 ac_tty; /* Control Terminal */ __u32 ac_btime; /* Process Creation Time */ comp_t ac_utime; /* User Time */ comp_t ac_stime; /* System Time */ comp_t ac_etime; /* Elapsed Time */ comp_t ac_mem; /* Average Memory Usage */ comp_t ac_io; /* Chars Transferred */ comp_t ac_rw; /* Blocks Read or Written */ comp_t ac_minflt; /* Minor Pagefaults */ comp_t ac_majflt; /* Major Pagefaults */ comp_t ac_swaps; /* Number of Swaps */ /* m68k had no padding here. */ __u16 ac_ahz; /* AHZ */ __u32 ac_exitcode; /* Exitcode */ char ac_comm[ACCT_COMM + 1]; /* Command Name */ __u8 ac_etime_hi; /* Elapsed Time MSB */ __u16 ac_etime_lo; /* Elapsed Time LSB */ __u32 ac_uid; /* Real User ID */ __u32 ac_gid; /* Real Group ID */ }; struct acct_v3 { char ac_flag; /* Flags */ char ac_version; /* Always set to ACCT_VERSION */ __u16 ac_tty; /* Control Terminal */ __u32 ac_exitcode; /* Exitcode */ __u32 ac_uid; /* Real User ID */ __u32 ac_gid; /* Real Group ID */ __u32 ac_pid; /* Process ID */ __u32 ac_ppid; /* Parent Process ID */ __u32 ac_btime; /* Process Creation Time */ float ac_etime; /* Elapsed Time */ comp_t ac_utime; /* User Time */ comp_t ac_stime; /* System Time */ comp_t ac_mem; /* Average Memory Usage */ comp_t ac_io; /* Chars Transferred */ comp_t ac_rw; /* Blocks Read or Written */ comp_t ac_minflt; /* Minor Pagefaults */ comp_t ac_majflt; /* Major Pagefaults */ comp_t ac_swaps; /* Number of Swaps */ char ac_comm[ACCT_COMM]; /* Command Name */ }; /* * accounting flags */ /* bit set when the process ... */ #define AFORK 0x01 /* ... executed fork, but did not exec */ #define ASU 0x02 /* ... used super-user privileges */ #define ACOMPAT 0x04 /* ... used compatibility mode (VAX only not used) */ #define ACORE 0x08 /* ... dumped core */ #define AXSIG 0x10 /* ... was killed by a signal */ #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN) #define ACCT_BYTEORDER 0x80 /* accounting file is big endian */ #elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN) #define ACCT_BYTEORDER 0x00 /* accounting file is little endian */ #else #error unspecified endianness #endif #define ACCT_VERSION 2 #define AHZ (HZ) #endif /* _LINUX_ACCT_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/wireless.h������������������������������������������������������������������������������������0000644�����������������00000123333�14763166027�0007732 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * This file define a set of standard wireless extensions * * Version : 22 16.3.07 * * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved. */ #ifndef _LINUX_WIRELESS_H #define _LINUX_WIRELESS_H /************************** DOCUMENTATION **************************/ /* * Initial APIs (1996 -> onward) : * ----------------------------- * Basically, the wireless extensions are for now a set of standard ioctl * call + /proc/net/wireless * * The entry /proc/net/wireless give statistics and information on the * driver. * This is better than having each driver having its entry because * its centralised and we may remove the driver module safely. * * Ioctl are used to configure the driver and issue commands. This is * better than command line options of insmod because we may want to * change dynamically (while the driver is running) some parameters. * * The ioctl mechanimsm are copied from standard devices ioctl. * We have the list of command plus a structure descibing the * data exchanged... * Note that to add these ioctl, I was obliged to modify : * # net/core/dev.c (two place + add include) * # net/ipv4/af_inet.c (one place + add include) * * /proc/net/wireless is a copy of /proc/net/dev. * We have a structure for data passed from the driver to /proc/net/wireless * Too add this, I've modified : * # net/core/dev.c (two other places) * # include/linux/netdevice.h (one place) * # include/linux/proc_fs.h (one place) * * New driver API (2002 -> onward) : * ------------------------------- * This file is only concerned with the user space API and common definitions. * The new driver API is defined and documented in : * # include/net/iw_handler.h * * Note as well that /proc/net/wireless implementation has now moved in : * # net/core/wireless.c * * Wireless Events (2002 -> onward) : * -------------------------------- * Events are defined at the end of this file, and implemented in : * # net/core/wireless.c * * Other comments : * -------------- * Do not add here things that are redundant with other mechanisms * (drivers init, ifconfig, /proc/net/dev, ...) and with are not * wireless specific. * * These wireless extensions are not magic : each driver has to provide * support for them... * * IMPORTANT NOTE : As everything in the kernel, this is very much a * work in progress. Contact me if you have ideas of improvements... */ /***************************** INCLUDES *****************************/ #include <linux/types.h> /* for __u* and __s* typedefs */ #include <linux/socket.h> /* for "struct sockaddr" et al */ #include <linux/if.h> /* for IFNAMSIZ and co... */ # include <stddef.h> /* for offsetof */ /***************************** VERSION *****************************/ /* * This constant is used to know the availability of the wireless * extensions and to know which version of wireless extensions it is * (there is some stuff that will be added in the future...) * I just plan to increment with each new version. */ #define WIRELESS_EXT 22 /* * Changes : * * V2 to V3 * -------- * Alan Cox start some incompatibles changes. I've integrated a bit more. * - Encryption renamed to Encode to avoid US regulation problems * - Frequency changed from float to struct to avoid problems on old 386 * * V3 to V4 * -------- * - Add sensitivity * * V4 to V5 * -------- * - Missing encoding definitions in range * - Access points stuff * * V5 to V6 * -------- * - 802.11 support (ESSID ioctls) * * V6 to V7 * -------- * - define IW_ESSID_MAX_SIZE and IW_MAX_AP * * V7 to V8 * -------- * - Changed my e-mail address * - More 802.11 support (nickname, rate, rts, frag) * - List index in frequencies * * V8 to V9 * -------- * - Support for 'mode of operation' (ad-hoc, managed...) * - Support for unicast and multicast power saving * - Change encoding to support larger tokens (>64 bits) * - Updated iw_params (disable, flags) and use it for NWID * - Extracted iw_point from iwreq for clarity * * V9 to V10 * --------- * - Add PM capability to range structure * - Add PM modifier : MAX/MIN/RELATIVE * - Add encoding option : IW_ENCODE_NOKEY * - Add TxPower ioctls (work like TxRate) * * V10 to V11 * ---------- * - Add WE version in range (help backward/forward compatibility) * - Add retry ioctls (work like PM) * * V11 to V12 * ---------- * - Add SIOCSIWSTATS to get /proc/net/wireless programatically * - Add DEV PRIVATE IOCTL to avoid collisions in SIOCDEVPRIVATE space * - Add new statistics (frag, retry, beacon) * - Add average quality (for user space calibration) * * V12 to V13 * ---------- * - Document creation of new driver API. * - Extract union iwreq_data from struct iwreq (for new driver API). * - Rename SIOCSIWNAME as SIOCSIWCOMMIT * * V13 to V14 * ---------- * - Wireless Events support : define struct iw_event * - Define additional specific event numbers * - Add "addr" and "param" fields in union iwreq_data * - AP scanning stuff (SIOCSIWSCAN and friends) * * V14 to V15 * ---------- * - Add IW_PRIV_TYPE_ADDR for struct sockaddr private arg * - Make struct iw_freq signed (both m & e), add explicit padding * - Add IWEVCUSTOM for driver specific event/scanning token * - Add IW_MAX_GET_SPY for driver returning a lot of addresses * - Add IW_TXPOW_RANGE for range of Tx Powers * - Add IWEVREGISTERED & IWEVEXPIRED events for Access Points * - Add IW_MODE_MONITOR for passive monitor * * V15 to V16 * ---------- * - Increase the number of bitrates in iw_range to 32 (for 802.11g) * - Increase the number of frequencies in iw_range to 32 (for 802.11b+a) * - Reshuffle struct iw_range for increases, add filler * - Increase IW_MAX_AP to 64 for driver returning a lot of addresses * - Remove IW_MAX_GET_SPY because conflict with enhanced spy support * - Add SIOCSIWTHRSPY/SIOCGIWTHRSPY and "struct iw_thrspy" * - Add IW_ENCODE_TEMP and iw_range->encoding_login_index * * V16 to V17 * ---------- * - Add flags to frequency -> auto/fixed * - Document (struct iw_quality *)->updated, add new flags (INVALID) * - Wireless Event capability in struct iw_range * - Add support for relative TxPower (yick !) * * V17 to V18 (From Jouni Malinen <j@w1.fi>) * ---------- * - Add support for WPA/WPA2 * - Add extended encoding configuration (SIOCSIWENCODEEXT and * SIOCGIWENCODEEXT) * - Add SIOCSIWGENIE/SIOCGIWGENIE * - Add SIOCSIWMLME * - Add SIOCSIWPMKSA * - Add struct iw_range bit field for supported encoding capabilities * - Add optional scan request parameters for SIOCSIWSCAN * - Add SIOCSIWAUTH/SIOCGIWAUTH for setting authentication and WPA * related parameters (extensible up to 4096 parameter values) * - Add wireless events: IWEVGENIE, IWEVMICHAELMICFAILURE, * IWEVASSOCREQIE, IWEVASSOCRESPIE, IWEVPMKIDCAND * * V18 to V19 * ---------- * - Remove (struct iw_point *)->pointer from events and streams * - Remove header includes to help user space * - Increase IW_ENCODING_TOKEN_MAX from 32 to 64 * - Add IW_QUAL_ALL_UPDATED and IW_QUAL_ALL_INVALID macros * - Add explicit flag to tell stats are in dBm : IW_QUAL_DBM * - Add IW_IOCTL_IDX() and IW_EVENT_IDX() macros * * V19 to V20 * ---------- * - RtNetlink requests support (SET/GET) * * V20 to V21 * ---------- * - Remove (struct net_device *)->get_wireless_stats() * - Change length in ESSID and NICK to strlen() instead of strlen()+1 * - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers * - Power/Retry relative values no longer * 100000 * - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI * * V21 to V22 * ---------- * - Prevent leaking of kernel space in stream on 64 bits. */ /**************************** CONSTANTS ****************************/ /* -------------------------- IOCTL LIST -------------------------- */ /* Wireless Identification */ #define SIOCSIWCOMMIT 0x8B00 /* Commit pending changes to driver */ #define SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ /* SIOCGIWNAME is used to verify the presence of Wireless Extensions. * Common values : "IEEE 802.11-DS", "IEEE 802.11-FH", "IEEE 802.11b"... * Don't put the name of your driver there, it's useless. */ /* Basic operations */ #define SIOCSIWNWID 0x8B02 /* set network id (pre-802.11) */ #define SIOCGIWNWID 0x8B03 /* get network id (the cell) */ #define SIOCSIWFREQ 0x8B04 /* set channel/frequency (Hz) */ #define SIOCGIWFREQ 0x8B05 /* get channel/frequency (Hz) */ #define SIOCSIWMODE 0x8B06 /* set operation mode */ #define SIOCGIWMODE 0x8B07 /* get operation mode */ #define SIOCSIWSENS 0x8B08 /* set sensitivity (dBm) */ #define SIOCGIWSENS 0x8B09 /* get sensitivity (dBm) */ /* Informative stuff */ #define SIOCSIWRANGE 0x8B0A /* Unused */ #define SIOCGIWRANGE 0x8B0B /* Get range of parameters */ #define SIOCSIWPRIV 0x8B0C /* Unused */ #define SIOCGIWPRIV 0x8B0D /* get private ioctl interface info */ #define SIOCSIWSTATS 0x8B0E /* Unused */ #define SIOCGIWSTATS 0x8B0F /* Get /proc/net/wireless stats */ /* SIOCGIWSTATS is strictly used between user space and the kernel, and * is never passed to the driver (i.e. the driver will never see it). */ /* Spy support (statistics per MAC address - used for Mobile IP support) */ #define SIOCSIWSPY 0x8B10 /* set spy addresses */ #define SIOCGIWSPY 0x8B11 /* get spy info (quality of link) */ #define SIOCSIWTHRSPY 0x8B12 /* set spy threshold (spy event) */ #define SIOCGIWTHRSPY 0x8B13 /* get spy threshold */ /* Access Point manipulation */ #define SIOCSIWAP 0x8B14 /* set access point MAC addresses */ #define SIOCGIWAP 0x8B15 /* get access point MAC addresses */ #define SIOCGIWAPLIST 0x8B17 /* Deprecated in favor of scanning */ #define SIOCSIWSCAN 0x8B18 /* trigger scanning (list cells) */ #define SIOCGIWSCAN 0x8B19 /* get scanning results */ /* 802.11 specific support */ #define SIOCSIWESSID 0x8B1A /* set ESSID (network name) */ #define SIOCGIWESSID 0x8B1B /* get ESSID */ #define SIOCSIWNICKN 0x8B1C /* set node name/nickname */ #define SIOCGIWNICKN 0x8B1D /* get node name/nickname */ /* As the ESSID and NICKN are strings up to 32 bytes long, it doesn't fit * within the 'iwreq' structure, so we need to use the 'data' member to * point to a string in user space, like it is done for RANGE... */ /* Other parameters useful in 802.11 and some other devices */ #define SIOCSIWRATE 0x8B20 /* set default bit rate (bps) */ #define SIOCGIWRATE 0x8B21 /* get default bit rate (bps) */ #define SIOCSIWRTS 0x8B22 /* set RTS/CTS threshold (bytes) */ #define SIOCGIWRTS 0x8B23 /* get RTS/CTS threshold (bytes) */ #define SIOCSIWFRAG 0x8B24 /* set fragmentation thr (bytes) */ #define SIOCGIWFRAG 0x8B25 /* get fragmentation thr (bytes) */ #define SIOCSIWTXPOW 0x8B26 /* set transmit power (dBm) */ #define SIOCGIWTXPOW 0x8B27 /* get transmit power (dBm) */ #define SIOCSIWRETRY 0x8B28 /* set retry limits and lifetime */ #define SIOCGIWRETRY 0x8B29 /* get retry limits and lifetime */ /* Encoding stuff (scrambling, hardware security, WEP...) */ #define SIOCSIWENCODE 0x8B2A /* set encoding token & mode */ #define SIOCGIWENCODE 0x8B2B /* get encoding token & mode */ /* Power saving stuff (power management, unicast and multicast) */ #define SIOCSIWPOWER 0x8B2C /* set Power Management settings */ #define SIOCGIWPOWER 0x8B2D /* get Power Management settings */ /* WPA : Generic IEEE 802.11 informatiom element (e.g., for WPA/RSN/WMM). * This ioctl uses struct iw_point and data buffer that includes IE id and len * fields. More than one IE may be included in the request. Setting the generic * IE to empty buffer (len=0) removes the generic IE from the driver. Drivers * are allowed to generate their own WPA/RSN IEs, but in these cases, drivers * are required to report the used IE as a wireless event, e.g., when * associating with an AP. */ #define SIOCSIWGENIE 0x8B30 /* set generic IE */ #define SIOCGIWGENIE 0x8B31 /* get generic IE */ /* WPA : IEEE 802.11 MLME requests */ #define SIOCSIWMLME 0x8B16 /* request MLME operation; uses * struct iw_mlme */ /* WPA : Authentication mode parameters */ #define SIOCSIWAUTH 0x8B32 /* set authentication mode params */ #define SIOCGIWAUTH 0x8B33 /* get authentication mode params */ /* WPA : Extended version of encoding configuration */ #define SIOCSIWENCODEEXT 0x8B34 /* set encoding token & mode */ #define SIOCGIWENCODEEXT 0x8B35 /* get encoding token & mode */ /* WPA2 : PMKSA cache management */ #define SIOCSIWPMKSA 0x8B36 /* PMKSA cache operation */ /* -------------------- DEV PRIVATE IOCTL LIST -------------------- */ /* These 32 ioctl are wireless device private, for 16 commands. * Each driver is free to use them for whatever purpose it chooses, * however the driver *must* export the description of those ioctls * with SIOCGIWPRIV and *must* use arguments as defined below. * If you don't follow those rules, DaveM is going to hate you (reason : * it make mixed 32/64bit operation impossible). */ #define SIOCIWFIRSTPRIV 0x8BE0 #define SIOCIWLASTPRIV 0x8BFF /* Previously, we were using SIOCDEVPRIVATE, but we now have our * separate range because of collisions with other tools such as * 'mii-tool'. * We now have 32 commands, so a bit more space ;-). * Also, all 'even' commands are only usable by root and don't return the * content of ifr/iwr to user (but you are not obliged to use the set/get * convention, just use every other two command). More details in iwpriv.c. * And I repeat : you are not forced to use them with iwpriv, but you * must be compliant with it. */ /* ------------------------- IOCTL STUFF ------------------------- */ /* The first and the last (range) */ #define SIOCIWFIRST 0x8B00 #define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */ #define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST) #define IW_HANDLER(id, func) \ [IW_IOCTL_IDX(id)] = func /* Odd : get (world access), even : set (root access) */ #define IW_IS_SET(cmd) (!((cmd) & 0x1)) #define IW_IS_GET(cmd) ((cmd) & 0x1) /* ----------------------- WIRELESS EVENTS ----------------------- */ /* Those are *NOT* ioctls, do not issue request on them !!! */ /* Most events use the same identifier as ioctl requests */ #define IWEVTXDROP 0x8C00 /* Packet dropped to excessive retry */ #define IWEVQUAL 0x8C01 /* Quality part of statistics (scan) */ #define IWEVCUSTOM 0x8C02 /* Driver specific ascii string */ #define IWEVREGISTERED 0x8C03 /* Discovered a new node (AP mode) */ #define IWEVEXPIRED 0x8C04 /* Expired a node (AP mode) */ #define IWEVGENIE 0x8C05 /* Generic IE (WPA, RSN, WMM, ..) * (scan results); This includes id and * length fields. One IWEVGENIE may * contain more than one IE. Scan * results may contain one or more * IWEVGENIE events. */ #define IWEVMICHAELMICFAILURE 0x8C06 /* Michael MIC failure * (struct iw_michaelmicfailure) */ #define IWEVASSOCREQIE 0x8C07 /* IEs used in (Re)Association Request. * The data includes id and length * fields and may contain more than one * IE. This event is required in * Managed mode if the driver * generates its own WPA/RSN IE. This * should be sent just before * IWEVREGISTERED event for the * association. */ #define IWEVASSOCRESPIE 0x8C08 /* IEs used in (Re)Association * Response. The data includes id and * length fields and may contain more * than one IE. This may be sent * between IWEVASSOCREQIE and * IWEVREGISTERED events for the * association. */ #define IWEVPMKIDCAND 0x8C09 /* PMKID candidate for RSN * pre-authentication * (struct iw_pmkid_cand) */ #define IWEVFIRST 0x8C00 #define IW_EVENT_IDX(cmd) ((cmd) - IWEVFIRST) /* ------------------------- PRIVATE INFO ------------------------- */ /* * The following is used with SIOCGIWPRIV. It allow a driver to define * the interface (name, type of data) for its private ioctl. * Privates ioctl are SIOCIWFIRSTPRIV -> SIOCIWLASTPRIV */ #define IW_PRIV_TYPE_MASK 0x7000 /* Type of arguments */ #define IW_PRIV_TYPE_NONE 0x0000 #define IW_PRIV_TYPE_BYTE 0x1000 /* Char as number */ #define IW_PRIV_TYPE_CHAR 0x2000 /* Char as character */ #define IW_PRIV_TYPE_INT 0x4000 /* 32 bits int */ #define IW_PRIV_TYPE_FLOAT 0x5000 /* struct iw_freq */ #define IW_PRIV_TYPE_ADDR 0x6000 /* struct sockaddr */ #define IW_PRIV_SIZE_FIXED 0x0800 /* Variable or fixed number of args */ #define IW_PRIV_SIZE_MASK 0x07FF /* Max number of those args */ /* * Note : if the number of args is fixed and the size < 16 octets, * instead of passing a pointer we will put args in the iwreq struct... */ /* ----------------------- OTHER CONSTANTS ----------------------- */ /* Maximum frequencies in the range struct */ #define IW_MAX_FREQUENCIES 32 /* Note : if you have something like 80 frequencies, * don't increase this constant and don't fill the frequency list. * The user will be able to set by channel anyway... */ /* Maximum bit rates in the range struct */ #define IW_MAX_BITRATES 32 /* Maximum tx powers in the range struct */ #define IW_MAX_TXPOWER 8 /* Note : if you more than 8 TXPowers, just set the max and min or * a few of them in the struct iw_range. */ /* Maximum of address that you may set with SPY */ #define IW_MAX_SPY 8 /* Maximum of address that you may get in the list of access points in range */ #define IW_MAX_AP 64 /* Maximum size of the ESSID and NICKN strings */ #define IW_ESSID_MAX_SIZE 32 /* Modes of operation */ #define IW_MODE_AUTO 0 /* Let the driver decides */ #define IW_MODE_ADHOC 1 /* Single cell network */ #define IW_MODE_INFRA 2 /* Multi cell network, roaming, ... */ #define IW_MODE_MASTER 3 /* Synchronisation master or Access Point */ #define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */ #define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */ #define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */ #define IW_MODE_MESH 7 /* Mesh (IEEE 802.11s) network */ /* Statistics flags (bitmask in updated) */ #define IW_QUAL_QUAL_UPDATED 0x01 /* Value was updated since last read */ #define IW_QUAL_LEVEL_UPDATED 0x02 #define IW_QUAL_NOISE_UPDATED 0x04 #define IW_QUAL_ALL_UPDATED 0x07 #define IW_QUAL_DBM 0x08 /* Level + Noise are dBm */ #define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */ #define IW_QUAL_LEVEL_INVALID 0x20 #define IW_QUAL_NOISE_INVALID 0x40 #define IW_QUAL_RCPI 0x80 /* Level + Noise are 802.11k RCPI */ #define IW_QUAL_ALL_INVALID 0x70 /* Frequency flags */ #define IW_FREQ_AUTO 0x00 /* Let the driver decides */ #define IW_FREQ_FIXED 0x01 /* Force a specific value */ /* Maximum number of size of encoding token available * they are listed in the range structure */ #define IW_MAX_ENCODING_SIZES 8 /* Maximum size of the encoding token in bytes */ #define IW_ENCODING_TOKEN_MAX 64 /* 512 bits (for now) */ /* Flags for encoding (along with the token) */ #define IW_ENCODE_INDEX 0x00FF /* Token index (if needed) */ #define IW_ENCODE_FLAGS 0xFF00 /* Flags defined below */ #define IW_ENCODE_MODE 0xF000 /* Modes defined below */ #define IW_ENCODE_DISABLED 0x8000 /* Encoding disabled */ #define IW_ENCODE_ENABLED 0x0000 /* Encoding enabled */ #define IW_ENCODE_RESTRICTED 0x4000 /* Refuse non-encoded packets */ #define IW_ENCODE_OPEN 0x2000 /* Accept non-encoded packets */ #define IW_ENCODE_NOKEY 0x0800 /* Key is write only, so not present */ #define IW_ENCODE_TEMP 0x0400 /* Temporary key */ /* Power management flags available (along with the value, if any) */ #define IW_POWER_ON 0x0000 /* No details... */ #define IW_POWER_TYPE 0xF000 /* Type of parameter */ #define IW_POWER_PERIOD 0x1000 /* Value is a period/duration of */ #define IW_POWER_TIMEOUT 0x2000 /* Value is a timeout (to go asleep) */ #define IW_POWER_MODE 0x0F00 /* Power Management mode */ #define IW_POWER_UNICAST_R 0x0100 /* Receive only unicast messages */ #define IW_POWER_MULTICAST_R 0x0200 /* Receive only multicast messages */ #define IW_POWER_ALL_R 0x0300 /* Receive all messages though PM */ #define IW_POWER_FORCE_S 0x0400 /* Force PM procedure for sending unicast */ #define IW_POWER_REPEATER 0x0800 /* Repeat broadcast messages in PM period */ #define IW_POWER_MODIFIER 0x000F /* Modify a parameter */ #define IW_POWER_MIN 0x0001 /* Value is a minimum */ #define IW_POWER_MAX 0x0002 /* Value is a maximum */ #define IW_POWER_RELATIVE 0x0004 /* Value is not in seconds/ms/us */ /* Transmit Power flags available */ #define IW_TXPOW_TYPE 0x00FF /* Type of value */ #define IW_TXPOW_DBM 0x0000 /* Value is in dBm */ #define IW_TXPOW_MWATT 0x0001 /* Value is in mW */ #define IW_TXPOW_RELATIVE 0x0002 /* Value is in arbitrary units */ #define IW_TXPOW_RANGE 0x1000 /* Range of value between min/max */ /* Retry limits and lifetime flags available */ #define IW_RETRY_ON 0x0000 /* No details... */ #define IW_RETRY_TYPE 0xF000 /* Type of parameter */ #define IW_RETRY_LIMIT 0x1000 /* Maximum number of retries*/ #define IW_RETRY_LIFETIME 0x2000 /* Maximum duration of retries in us */ #define IW_RETRY_MODIFIER 0x00FF /* Modify a parameter */ #define IW_RETRY_MIN 0x0001 /* Value is a minimum */ #define IW_RETRY_MAX 0x0002 /* Value is a maximum */ #define IW_RETRY_RELATIVE 0x0004 /* Value is not in seconds/ms/us */ #define IW_RETRY_SHORT 0x0010 /* Value is for short packets */ #define IW_RETRY_LONG 0x0020 /* Value is for long packets */ /* Scanning request flags */ #define IW_SCAN_DEFAULT 0x0000 /* Default scan of the driver */ #define IW_SCAN_ALL_ESSID 0x0001 /* Scan all ESSIDs */ #define IW_SCAN_THIS_ESSID 0x0002 /* Scan only this ESSID */ #define IW_SCAN_ALL_FREQ 0x0004 /* Scan all Frequencies */ #define IW_SCAN_THIS_FREQ 0x0008 /* Scan only this Frequency */ #define IW_SCAN_ALL_MODE 0x0010 /* Scan all Modes */ #define IW_SCAN_THIS_MODE 0x0020 /* Scan only this Mode */ #define IW_SCAN_ALL_RATE 0x0040 /* Scan all Bit-Rates */ #define IW_SCAN_THIS_RATE 0x0080 /* Scan only this Bit-Rate */ /* struct iw_scan_req scan_type */ #define IW_SCAN_TYPE_ACTIVE 0 #define IW_SCAN_TYPE_PASSIVE 1 /* Maximum size of returned data */ #define IW_SCAN_MAX_DATA 4096 /* In bytes */ /* Scan capability flags - in (struct iw_range *)->scan_capa */ #define IW_SCAN_CAPA_NONE 0x00 #define IW_SCAN_CAPA_ESSID 0x01 #define IW_SCAN_CAPA_BSSID 0x02 #define IW_SCAN_CAPA_CHANNEL 0x04 #define IW_SCAN_CAPA_MODE 0x08 #define IW_SCAN_CAPA_RATE 0x10 #define IW_SCAN_CAPA_TYPE 0x20 #define IW_SCAN_CAPA_TIME 0x40 /* Max number of char in custom event - use multiple of them if needed */ #define IW_CUSTOM_MAX 256 /* In bytes */ /* Generic information element */ #define IW_GENERIC_IE_MAX 1024 /* MLME requests (SIOCSIWMLME / struct iw_mlme) */ #define IW_MLME_DEAUTH 0 #define IW_MLME_DISASSOC 1 #define IW_MLME_AUTH 2 #define IW_MLME_ASSOC 3 /* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */ #define IW_AUTH_INDEX 0x0FFF #define IW_AUTH_FLAGS 0xF000 /* SIOCSIWAUTH/SIOCGIWAUTH parameters (0 .. 4095) * (IW_AUTH_INDEX mask in struct iw_param flags; this is the index of the * parameter that is being set/get to; value will be read/written to * struct iw_param value field) */ #define IW_AUTH_WPA_VERSION 0 #define IW_AUTH_CIPHER_PAIRWISE 1 #define IW_AUTH_CIPHER_GROUP 2 #define IW_AUTH_KEY_MGMT 3 #define IW_AUTH_TKIP_COUNTERMEASURES 4 #define IW_AUTH_DROP_UNENCRYPTED 5 #define IW_AUTH_80211_AUTH_ALG 6 #define IW_AUTH_WPA_ENABLED 7 #define IW_AUTH_RX_UNENCRYPTED_EAPOL 8 #define IW_AUTH_ROAMING_CONTROL 9 #define IW_AUTH_PRIVACY_INVOKED 10 #define IW_AUTH_CIPHER_GROUP_MGMT 11 #define IW_AUTH_MFP 12 /* IW_AUTH_WPA_VERSION values (bit field) */ #define IW_AUTH_WPA_VERSION_DISABLED 0x00000001 #define IW_AUTH_WPA_VERSION_WPA 0x00000002 #define IW_AUTH_WPA_VERSION_WPA2 0x00000004 /* IW_AUTH_PAIRWISE_CIPHER, IW_AUTH_GROUP_CIPHER, and IW_AUTH_CIPHER_GROUP_MGMT * values (bit field) */ #define IW_AUTH_CIPHER_NONE 0x00000001 #define IW_AUTH_CIPHER_WEP40 0x00000002 #define IW_AUTH_CIPHER_TKIP 0x00000004 #define IW_AUTH_CIPHER_CCMP 0x00000008 #define IW_AUTH_CIPHER_WEP104 0x00000010 #define IW_AUTH_CIPHER_AES_CMAC 0x00000020 /* IW_AUTH_KEY_MGMT values (bit field) */ #define IW_AUTH_KEY_MGMT_802_1X 1 #define IW_AUTH_KEY_MGMT_PSK 2 /* IW_AUTH_80211_AUTH_ALG values (bit field) */ #define IW_AUTH_ALG_OPEN_SYSTEM 0x00000001 #define IW_AUTH_ALG_SHARED_KEY 0x00000002 #define IW_AUTH_ALG_LEAP 0x00000004 /* IW_AUTH_ROAMING_CONTROL values */ #define IW_AUTH_ROAMING_ENABLE 0 /* driver/firmware based roaming */ #define IW_AUTH_ROAMING_DISABLE 1 /* user space program used for roaming * control */ /* IW_AUTH_MFP (management frame protection) values */ #define IW_AUTH_MFP_DISABLED 0 /* MFP disabled */ #define IW_AUTH_MFP_OPTIONAL 1 /* MFP optional */ #define IW_AUTH_MFP_REQUIRED 2 /* MFP required */ /* SIOCSIWENCODEEXT definitions */ #define IW_ENCODE_SEQ_MAX_SIZE 8 /* struct iw_encode_ext ->alg */ #define IW_ENCODE_ALG_NONE 0 #define IW_ENCODE_ALG_WEP 1 #define IW_ENCODE_ALG_TKIP 2 #define IW_ENCODE_ALG_CCMP 3 #define IW_ENCODE_ALG_PMK 4 #define IW_ENCODE_ALG_AES_CMAC 5 /* struct iw_encode_ext ->ext_flags */ #define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001 #define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002 #define IW_ENCODE_EXT_GROUP_KEY 0x00000004 #define IW_ENCODE_EXT_SET_TX_KEY 0x00000008 /* IWEVMICHAELMICFAILURE : struct iw_michaelmicfailure ->flags */ #define IW_MICFAILURE_KEY_ID 0x00000003 /* Key ID 0..3 */ #define IW_MICFAILURE_GROUP 0x00000004 #define IW_MICFAILURE_PAIRWISE 0x00000008 #define IW_MICFAILURE_STAKEY 0x00000010 #define IW_MICFAILURE_COUNT 0x00000060 /* 1 or 2 (0 = count not supported) */ /* Bit field values for enc_capa in struct iw_range */ #define IW_ENC_CAPA_WPA 0x00000001 #define IW_ENC_CAPA_WPA2 0x00000002 #define IW_ENC_CAPA_CIPHER_TKIP 0x00000004 #define IW_ENC_CAPA_CIPHER_CCMP 0x00000008 #define IW_ENC_CAPA_4WAY_HANDSHAKE 0x00000010 /* Event capability macros - in (struct iw_range *)->event_capa * Because we have more than 32 possible events, we use an array of * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */ #define IW_EVENT_CAPA_BASE(cmd) ((cmd >= SIOCIWFIRSTPRIV) ? \ (cmd - SIOCIWFIRSTPRIV + 0x60) : \ (cmd - SIOCIWFIRST)) #define IW_EVENT_CAPA_INDEX(cmd) (IW_EVENT_CAPA_BASE(cmd) >> 5) #define IW_EVENT_CAPA_MASK(cmd) (1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F)) /* Event capability constants - event autogenerated by the kernel * This list is valid for most 802.11 devices, customise as needed... */ #define IW_EVENT_CAPA_K_0 (IW_EVENT_CAPA_MASK(0x8B04) | \ IW_EVENT_CAPA_MASK(0x8B06) | \ IW_EVENT_CAPA_MASK(0x8B1A)) #define IW_EVENT_CAPA_K_1 (IW_EVENT_CAPA_MASK(0x8B2A)) /* "Easy" macro to set events in iw_range (less efficient) */ #define IW_EVENT_CAPA_SET(event_capa, cmd) (event_capa[IW_EVENT_CAPA_INDEX(cmd)] |= IW_EVENT_CAPA_MASK(cmd)) #define IW_EVENT_CAPA_SET_KERNEL(event_capa) {event_capa[0] |= IW_EVENT_CAPA_K_0; event_capa[1] |= IW_EVENT_CAPA_K_1; } /****************************** TYPES ******************************/ /* --------------------------- SUBTYPES --------------------------- */ /* * Generic format for most parameters that fit in an int */ struct iw_param { __s32 value; /* The value of the parameter itself */ __u8 fixed; /* Hardware should not use auto select */ __u8 disabled; /* Disable the feature */ __u16 flags; /* Various specifc flags (if any) */ }; /* * For all data larger than 16 octets, we need to use a * pointer to memory allocated in user space. */ struct iw_point { void *pointer; /* Pointer to the data (in user space) */ __u16 length; /* number of fields or size in bytes */ __u16 flags; /* Optional params */ }; /* * A frequency * For numbers lower than 10^9, we encode the number in 'm' and * set 'e' to 0 * For number greater than 10^9, we divide it by the lowest power * of 10 to get 'm' lower than 10^9, with 'm'= f / (10^'e')... * The power of 10 is in 'e', the result of the division is in 'm'. */ struct iw_freq { __s32 m; /* Mantissa */ __s16 e; /* Exponent */ __u8 i; /* List index (when in range struct) */ __u8 flags; /* Flags (fixed/auto) */ }; /* * Quality of the link */ struct iw_quality { __u8 qual; /* link quality (%retries, SNR, %missed beacons or better...) */ __u8 level; /* signal level (dBm) */ __u8 noise; /* noise level (dBm) */ __u8 updated; /* Flags to know if updated */ }; /* * Packet discarded in the wireless adapter due to * "wireless" specific problems... * Note : the list of counter and statistics in net_device_stats * is already pretty exhaustive, and you should use that first. * This is only additional stats... */ struct iw_discarded { __u32 nwid; /* Rx : Wrong nwid/essid */ __u32 code; /* Rx : Unable to code/decode (WEP) */ __u32 fragment; /* Rx : Can't perform MAC reassembly */ __u32 retries; /* Tx : Max MAC retries num reached */ __u32 misc; /* Others cases */ }; /* * Packet/Time period missed in the wireless adapter due to * "wireless" specific problems... */ struct iw_missed { __u32 beacon; /* Missed beacons/superframe */ }; /* * Quality range (for spy threshold) */ struct iw_thrspy { struct sockaddr addr; /* Source address (hw/mac) */ struct iw_quality qual; /* Quality of the link */ struct iw_quality low; /* Low threshold */ struct iw_quality high; /* High threshold */ }; /* * Optional data for scan request * * Note: these optional parameters are controlling parameters for the * scanning behavior, these do not apply to getting scan results * (SIOCGIWSCAN). Drivers are expected to keep a local BSS table and * provide a merged results with all BSSes even if the previous scan * request limited scanning to a subset, e.g., by specifying an SSID. * Especially, scan results are required to include an entry for the * current BSS if the driver is in Managed mode and associated with an AP. */ struct iw_scan_req { __u8 scan_type; /* IW_SCAN_TYPE_{ACTIVE,PASSIVE} */ __u8 essid_len; __u8 num_channels; /* num entries in channel_list; * 0 = scan all allowed channels */ __u8 flags; /* reserved as padding; use zero, this may * be used in the future for adding flags * to request different scan behavior */ struct sockaddr bssid; /* ff:ff:ff:ff:ff:ff for broadcast BSSID or * individual address of a specific BSS */ /* * Use this ESSID if IW_SCAN_THIS_ESSID flag is used instead of using * the current ESSID. This allows scan requests for specific ESSID * without having to change the current ESSID and potentially breaking * the current association. */ __u8 essid[IW_ESSID_MAX_SIZE]; /* * Optional parameters for changing the default scanning behavior. * These are based on the MLME-SCAN.request from IEEE Std 802.11. * TU is 1.024 ms. If these are set to 0, driver is expected to use * reasonable default values. min_channel_time defines the time that * will be used to wait for the first reply on each channel. If no * replies are received, next channel will be scanned after this. If * replies are received, total time waited on the channel is defined by * max_channel_time. */ __u32 min_channel_time; /* in TU */ __u32 max_channel_time; /* in TU */ struct iw_freq channel_list[IW_MAX_FREQUENCIES]; }; /* ------------------------- WPA SUPPORT ------------------------- */ /* * Extended data structure for get/set encoding (this is used with * SIOCSIWENCODEEXT/SIOCGIWENCODEEXT. struct iw_point and IW_ENCODE_* * flags are used in the same way as with SIOCSIWENCODE/SIOCGIWENCODE and * only the data contents changes (key data -> this structure, including * key data). * * If the new key is the first group key, it will be set as the default * TX key. Otherwise, default TX key index is only changed if * IW_ENCODE_EXT_SET_TX_KEY flag is set. * * Key will be changed with SIOCSIWENCODEEXT in all cases except for * special "change TX key index" operation which is indicated by setting * key_len = 0 and ext_flags |= IW_ENCODE_EXT_SET_TX_KEY. * * tx_seq/rx_seq are only used when respective * IW_ENCODE_EXT_{TX,RX}_SEQ_VALID flag is set in ext_flags. Normal * TKIP/CCMP operation is to set RX seq with SIOCSIWENCODEEXT and start * TX seq from zero whenever key is changed. SIOCGIWENCODEEXT is normally * used only by an Authenticator (AP or an IBSS station) to get the * current TX sequence number. Using TX_SEQ_VALID for SIOCSIWENCODEEXT and * RX_SEQ_VALID for SIOCGIWENCODEEXT are optional, but can be useful for * debugging/testing. */ struct iw_encode_ext { __u32 ext_flags; /* IW_ENCODE_EXT_* */ __u8 tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ __u8 rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ struct sockaddr addr; /* ff:ff:ff:ff:ff:ff for broadcast/multicast * (group) keys or unicast address for * individual keys */ __u16 alg; /* IW_ENCODE_ALG_* */ __u16 key_len; __u8 key[0]; }; /* SIOCSIWMLME data */ struct iw_mlme { __u16 cmd; /* IW_MLME_* */ __u16 reason_code; struct sockaddr addr; }; /* SIOCSIWPMKSA data */ #define IW_PMKSA_ADD 1 #define IW_PMKSA_REMOVE 2 #define IW_PMKSA_FLUSH 3 #define IW_PMKID_LEN 16 struct iw_pmksa { __u32 cmd; /* IW_PMKSA_* */ struct sockaddr bssid; __u8 pmkid[IW_PMKID_LEN]; }; /* IWEVMICHAELMICFAILURE data */ struct iw_michaelmicfailure { __u32 flags; struct sockaddr src_addr; __u8 tsc[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ }; /* IWEVPMKIDCAND data */ #define IW_PMKID_CAND_PREAUTH 0x00000001 /* RNS pre-authentication enabled */ struct iw_pmkid_cand { __u32 flags; /* IW_PMKID_CAND_* */ __u32 index; /* the smaller the index, the higher the * priority */ struct sockaddr bssid; }; /* ------------------------ WIRELESS STATS ------------------------ */ /* * Wireless statistics (used for /proc/net/wireless) */ struct iw_statistics { __u16 status; /* Status * - device dependent for now */ struct iw_quality qual; /* Quality of the link * (instant/mean/max) */ struct iw_discarded discard; /* Packet discarded counts */ struct iw_missed miss; /* Packet missed counts */ }; /* ------------------------ IOCTL REQUEST ------------------------ */ /* * This structure defines the payload of an ioctl, and is used * below. * * Note that this structure should fit on the memory footprint * of iwreq (which is the same as ifreq), which mean a max size of * 16 octets = 128 bits. Warning, pointers might be 64 bits wide... * You should check this when increasing the structures defined * above in this file... */ union iwreq_data { /* Config - generic */ char name[IFNAMSIZ]; /* Name : used to verify the presence of wireless extensions. * Name of the protocol/provider... */ struct iw_point essid; /* Extended network name */ struct iw_param nwid; /* network id (or domain - the cell) */ struct iw_freq freq; /* frequency or channel : * 0-1000 = channel * > 1000 = frequency in Hz */ struct iw_param sens; /* signal level threshold */ struct iw_param bitrate; /* default bit rate */ struct iw_param txpower; /* default transmit power */ struct iw_param rts; /* RTS threshold threshold */ struct iw_param frag; /* Fragmentation threshold */ __u32 mode; /* Operation mode */ struct iw_param retry; /* Retry limits & lifetime */ struct iw_point encoding; /* Encoding stuff : tokens */ struct iw_param power; /* PM duration/timeout */ struct iw_quality qual; /* Quality part of statistics */ struct sockaddr ap_addr; /* Access point address */ struct sockaddr addr; /* Destination address (hw/mac) */ struct iw_param param; /* Other small parameters */ struct iw_point data; /* Other large parameters */ }; /* * The structure to exchange data for ioctl. * This structure is the same as 'struct ifreq', but (re)defined for * convenience... * Do I need to remind you about structure size (32 octets) ? */ struct iwreq { union { char ifrn_name[IFNAMSIZ]; /* if name, e.g. "eth0" */ } ifr_ifrn; /* Data part (defined just above) */ union iwreq_data u; }; /* -------------------------- IOCTL DATA -------------------------- */ /* * For those ioctl which want to exchange mode data that what could * fit in the above structure... */ /* * Range of parameters */ struct iw_range { /* Informative stuff (to choose between different interface) */ __u32 throughput; /* To give an idea... */ /* In theory this value should be the maximum benchmarked * TCP/IP throughput, because with most of these devices the * bit rate is meaningless (overhead an co) to estimate how * fast the connection will go and pick the fastest one. * I suggest people to play with Netperf or any benchmark... */ /* NWID (or domain id) */ __u32 min_nwid; /* Minimal NWID we are able to set */ __u32 max_nwid; /* Maximal NWID we are able to set */ /* Old Frequency (backward compat - moved lower ) */ __u16 old_num_channels; __u8 old_num_frequency; /* Scan capabilities */ __u8 scan_capa; /* IW_SCAN_CAPA_* bit field */ /* Wireless event capability bitmasks */ __u32 event_capa[6]; /* signal level threshold range */ __s32 sensitivity; /* Quality of link & SNR stuff */ /* Quality range (link, level, noise) * If the quality is absolute, it will be in the range [0 ; max_qual], * if the quality is dBm, it will be in the range [max_qual ; 0]. * Don't forget that we use 8 bit arithmetics... */ struct iw_quality max_qual; /* Quality of the link */ /* This should contain the average/typical values of the quality * indicator. This should be the threshold between a "good" and * a "bad" link (example : monitor going from green to orange). * Currently, user space apps like quality monitors don't have any * way to calibrate the measurement. With this, they can split * the range between 0 and max_qual in different quality level * (using a geometric subdivision centered on the average). * I expect that people doing the user space apps will feedback * us on which value we need to put in each driver... */ struct iw_quality avg_qual; /* Quality of the link */ /* Rates */ __u8 num_bitrates; /* Number of entries in the list */ __s32 bitrate[IW_MAX_BITRATES]; /* list, in bps */ /* RTS threshold */ __s32 min_rts; /* Minimal RTS threshold */ __s32 max_rts; /* Maximal RTS threshold */ /* Frag threshold */ __s32 min_frag; /* Minimal frag threshold */ __s32 max_frag; /* Maximal frag threshold */ /* Power Management duration & timeout */ __s32 min_pmp; /* Minimal PM period */ __s32 max_pmp; /* Maximal PM period */ __s32 min_pmt; /* Minimal PM timeout */ __s32 max_pmt; /* Maximal PM timeout */ __u16 pmp_flags; /* How to decode max/min PM period */ __u16 pmt_flags; /* How to decode max/min PM timeout */ __u16 pm_capa; /* What PM options are supported */ /* Encoder stuff */ __u16 encoding_size[IW_MAX_ENCODING_SIZES]; /* Different token sizes */ __u8 num_encoding_sizes; /* Number of entry in the list */ __u8 max_encoding_tokens; /* Max number of tokens */ /* For drivers that need a "login/passwd" form */ __u8 encoding_login_index; /* token index for login token */ /* Transmit power */ __u16 txpower_capa; /* What options are supported */ __u8 num_txpower; /* Number of entries in the list */ __s32 txpower[IW_MAX_TXPOWER]; /* list, in bps */ /* Wireless Extension version info */ __u8 we_version_compiled; /* Must be WIRELESS_EXT */ __u8 we_version_source; /* Last update of source */ /* Retry limits and lifetime */ __u16 retry_capa; /* What retry options are supported */ __u16 retry_flags; /* How to decode max/min retry limit */ __u16 r_time_flags; /* How to decode max/min retry life */ __s32 min_retry; /* Minimal number of retries */ __s32 max_retry; /* Maximal number of retries */ __s32 min_r_time; /* Minimal retry lifetime */ __s32 max_r_time; /* Maximal retry lifetime */ /* Frequency */ __u16 num_channels; /* Number of channels [0; num - 1] */ __u8 num_frequency; /* Number of entry in the list */ struct iw_freq freq[IW_MAX_FREQUENCIES]; /* list */ /* Note : this frequency list doesn't need to fit channel numbers, * because each entry contain its channel index */ __u32 enc_capa; /* IW_ENC_CAPA_* bit field */ }; /* * Private ioctl interface information */ struct iw_priv_args { __u32 cmd; /* Number of the ioctl to issue */ __u16 set_args; /* Type and number of args */ __u16 get_args; /* Type and number of args */ char name[IFNAMSIZ]; /* Name of the extension */ }; /* ----------------------- WIRELESS EVENTS ----------------------- */ /* * Wireless events are carried through the rtnetlink socket to user * space. They are encapsulated in the IFLA_WIRELESS field of * a RTM_NEWLINK message. */ /* * A Wireless Event. Contains basically the same data as the ioctl... */ struct iw_event { __u16 len; /* Real length of this stuff */ __u16 cmd; /* Wireless IOCTL */ union iwreq_data u; /* IOCTL fixed payload */ }; /* Size of the Event prefix (including padding and alignement junk) */ #define IW_EV_LCP_LEN (sizeof(struct iw_event) - sizeof(union iwreq_data)) /* Size of the various events */ #define IW_EV_CHAR_LEN (IW_EV_LCP_LEN + IFNAMSIZ) #define IW_EV_UINT_LEN (IW_EV_LCP_LEN + sizeof(__u32)) #define IW_EV_FREQ_LEN (IW_EV_LCP_LEN + sizeof(struct iw_freq)) #define IW_EV_PARAM_LEN (IW_EV_LCP_LEN + sizeof(struct iw_param)) #define IW_EV_ADDR_LEN (IW_EV_LCP_LEN + sizeof(struct sockaddr)) #define IW_EV_QUAL_LEN (IW_EV_LCP_LEN + sizeof(struct iw_quality)) /* iw_point events are special. First, the payload (extra data) come at * the end of the event, so they are bigger than IW_EV_POINT_LEN. Second, * we omit the pointer, so start at an offset. */ #define IW_EV_POINT_OFF offsetof(struct iw_point, length) #define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \ IW_EV_POINT_OFF) /* Size of the Event prefix when packed in stream */ #define IW_EV_LCP_PK_LEN (4) /* Size of the various events when packed in stream */ #define IW_EV_CHAR_PK_LEN (IW_EV_LCP_PK_LEN + IFNAMSIZ) #define IW_EV_UINT_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(__u32)) #define IW_EV_FREQ_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_freq)) #define IW_EV_PARAM_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_param)) #define IW_EV_ADDR_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct sockaddr)) #define IW_EV_QUAL_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_quality)) #define IW_EV_POINT_PK_LEN (IW_EV_LCP_PK_LEN + 4) #endif /* _LINUX_WIRELESS_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/binfmts.h�������������������������������������������������������������������������������������0000644�����������������00000001164�14763166027�0007534 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_BINFMTS_H #define _LINUX_BINFMTS_H #include <linux/capability.h> struct pt_regs; /* * These are the maximum length and maximum number of strings passed to the * execve() system call. MAX_ARG_STRLEN is essentially random but serves to * prevent the kernel from being unduly impacted by misaddressed pointers. * MAX_ARG_STRINGS is chosen to fit in a signed 32-bit integer. */ #define MAX_ARG_STRLEN (PAGE_SIZE * 32) #define MAX_ARG_STRINGS 0x7FFFFFFF /* sizeof(linux_binprm->buf) */ #define BINPRM_BUF_SIZE 128 #endif /* _LINUX_BINFMTS_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/socket.h��������������������������������������������������������������������������������������0000644�����������������00000001441�14763166027�0007360 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SOCKET_H #define _LINUX_SOCKET_H /* * Desired design of maximum size and alignment (see RFC2553) */ #define _K_SS_MAXSIZE 128 /* Implementation specific max size */ #define _K_SS_ALIGNSIZE (__alignof__ (struct sockaddr *)) /* Implementation specific desired alignment */ typedef unsigned short __kernel_sa_family_t; struct __kernel_sockaddr_storage { __kernel_sa_family_t ss_family; /* address family */ /* Following field(s) are implementation specific */ char __data[_K_SS_MAXSIZE - sizeof(unsigned short)]; /* space to achieve desired size, */ /* _SS_MAXSIZE value minus size of ss_family */ } __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */ #endif /* _LINUX_SOCKET_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/nfs3.h����������������������������������������������������������������������������������������0000644�����������������00000004467�14763166027�0006754 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * NFSv3 protocol definitions */ #ifndef _LINUX_NFS3_H #define _LINUX_NFS3_H #define NFS3_PORT 2049 #define NFS3_MAXDATA 32768 #define NFS3_MAXPATHLEN PATH_MAX #define NFS3_MAXNAMLEN NAME_MAX #define NFS3_MAXGROUPS 16 #define NFS3_FHSIZE 64 #define NFS3_COOKIESIZE 4 #define NFS3_CREATEVERFSIZE 8 #define NFS3_COOKIEVERFSIZE 8 #define NFS3_WRITEVERFSIZE 8 #define NFS3_FIFO_DEV (-1) #define NFS3MODE_FMT 0170000 #define NFS3MODE_DIR 0040000 #define NFS3MODE_CHR 0020000 #define NFS3MODE_BLK 0060000 #define NFS3MODE_REG 0100000 #define NFS3MODE_LNK 0120000 #define NFS3MODE_SOCK 0140000 #define NFS3MODE_FIFO 0010000 /* Flags for access() call */ #define NFS3_ACCESS_READ 0x0001 #define NFS3_ACCESS_LOOKUP 0x0002 #define NFS3_ACCESS_MODIFY 0x0004 #define NFS3_ACCESS_EXTEND 0x0008 #define NFS3_ACCESS_DELETE 0x0010 #define NFS3_ACCESS_EXECUTE 0x0020 #define NFS3_ACCESS_FULL 0x003f /* Flags for create mode */ enum nfs3_createmode { NFS3_CREATE_UNCHECKED = 0, NFS3_CREATE_GUARDED = 1, NFS3_CREATE_EXCLUSIVE = 2 }; /* NFSv3 file system properties */ #define NFS3_FSF_LINK 0x0001 #define NFS3_FSF_SYMLINK 0x0002 #define NFS3_FSF_HOMOGENEOUS 0x0008 #define NFS3_FSF_CANSETTIME 0x0010 /* Some shorthands. See fs/nfsd/nfs3proc.c */ #define NFS3_FSF_DEFAULT 0x001B #define NFS3_FSF_BILLYBOY 0x0018 #define NFS3_FSF_READONLY 0x0008 enum nfs3_ftype { NF3NON = 0, NF3REG = 1, NF3DIR = 2, NF3BLK = 3, NF3CHR = 4, NF3LNK = 5, NF3SOCK = 6, NF3FIFO = 7, /* changed from NFSv2 (was 8) */ NF3BAD = 8 }; struct nfs3_fh { unsigned short size; unsigned char data[NFS3_FHSIZE]; }; #define NFS3_VERSION 3 #define NFS3PROC_NULL 0 #define NFS3PROC_GETATTR 1 #define NFS3PROC_SETATTR 2 #define NFS3PROC_LOOKUP 3 #define NFS3PROC_ACCESS 4 #define NFS3PROC_READLINK 5 #define NFS3PROC_READ 6 #define NFS3PROC_WRITE 7 #define NFS3PROC_CREATE 8 #define NFS3PROC_MKDIR 9 #define NFS3PROC_SYMLINK 10 #define NFS3PROC_MKNOD 11 #define NFS3PROC_REMOVE 12 #define NFS3PROC_RMDIR 13 #define NFS3PROC_RENAME 14 #define NFS3PROC_LINK 15 #define NFS3PROC_READDIR 16 #define NFS3PROC_READDIRPLUS 17 #define NFS3PROC_FSSTAT 18 #define NFS3PROC_FSINFO 19 #define NFS3PROC_PATHCONF 20 #define NFS3PROC_COMMIT 21 #define NFS_MNT3_VERSION 3 #endif /* _LINUX_NFS3_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_decnet.h����������������������������������������������������������������������������0000644�����������������00000003673�14763166027�0011417 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_DECNET_NETFILTER_H #define __LINUX_DECNET_NETFILTER_H /* DECnet-specific defines for netfilter. * This file (C) Steve Whitehouse 1999 derived from the * ipv4 netfilter header file which is * (C)1998 Rusty Russell -- This code is GPL. */ #include <linux/netfilter.h> /* only for userspace compatibility */ #include <limits.h> /* for INT_MIN, INT_MAX */ /* IP Cache bits. */ /* Src IP address. */ #define NFC_DN_SRC 0x0001 /* Dest IP address. */ #define NFC_DN_DST 0x0002 /* Input device. */ #define NFC_DN_IF_IN 0x0004 /* Output device. */ #define NFC_DN_IF_OUT 0x0008 /* kernel define is in netfilter_defs.h */ #define NF_DN_NUMHOOKS 7 /* DECnet Hooks */ /* After promisc drops, checksum checks. */ #define NF_DN_PRE_ROUTING 0 /* If the packet is destined for this box. */ #define NF_DN_LOCAL_IN 1 /* If the packet is destined for another interface. */ #define NF_DN_FORWARD 2 /* Packets coming from a local process. */ #define NF_DN_LOCAL_OUT 3 /* Packets about to hit the wire. */ #define NF_DN_POST_ROUTING 4 /* Input Hello Packets */ #define NF_DN_HELLO 5 /* Input Routing Packets */ #define NF_DN_ROUTE 6 enum nf_dn_hook_priorities { NF_DN_PRI_FIRST = INT_MIN, NF_DN_PRI_CONNTRACK = -200, NF_DN_PRI_MANGLE = -150, NF_DN_PRI_NAT_DST = -100, NF_DN_PRI_FILTER = 0, NF_DN_PRI_NAT_SRC = 100, NF_DN_PRI_DNRTMSG = 200, NF_DN_PRI_LAST = INT_MAX, }; struct nf_dn_rtmsg { int nfdn_ifindex; }; #define NFDN_RTMSG(r) ((unsigned char *)(r) + NLMSG_ALIGN(sizeof(struct nf_dn_rtmsg))) /* backwards compatibility for userspace */ #define DNRMG_L1_GROUP 0x01 #define DNRMG_L2_GROUP 0x02 enum { DNRNG_NLGRP_NONE, #define DNRNG_NLGRP_NONE DNRNG_NLGRP_NONE DNRNG_NLGRP_L1, #define DNRNG_NLGRP_L1 DNRNG_NLGRP_L1 DNRNG_NLGRP_L2, #define DNRNG_NLGRP_L2 DNRNG_NLGRP_L2 __DNRNG_NLGRP_MAX }; #define DNRNG_NLGRP_MAX (__DNRNG_NLGRP_MAX - 1) #endif /*__LINUX_DECNET_NETFILTER_H*/ ���������������������������������������������������������������������linux/mpls_iptunnel.h�������������������������������������������������������������������������������0000644�����������������00000001371�14763166027�0010763 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * mpls tunnel api * * Authors: * Roopa Prabhu <roopa@cumulusnetworks.com> * * 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. */ #ifndef _LINUX_MPLS_IPTUNNEL_H #define _LINUX_MPLS_IPTUNNEL_H /* MPLS tunnel attributes * [RTA_ENCAP] = { * [MPLS_IPTUNNEL_DST] * [MPLS_IPTUNNEL_TTL] * } */ enum { MPLS_IPTUNNEL_UNSPEC, MPLS_IPTUNNEL_DST, MPLS_IPTUNNEL_TTL, __MPLS_IPTUNNEL_MAX, }; #define MPLS_IPTUNNEL_MAX (__MPLS_IPTUNNEL_MAX - 1) #endif /* _LINUX_MPLS_IPTUNNEL_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/blkzoned.h������������������������������������������������������������������������������������0000644�����������������00000012030�14763166027�0007674 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Zoned block devices handling. * * Copyright (C) 2015 Seagate Technology PLC * * Written by: Shaun Tancheff <shaun.tancheff@seagate.com> * * Modified by: Damien Le Moal <damien.lemoal@hgst.com> * Copyright (C) 2016 Western Digital * * This file is licensed under the terms of the GNU General Public * License version 2. This program is licensed "as is" without any * warranty of any kind, whether express or implied. */ #ifndef _BLKZONED_H #define _BLKZONED_H #include <linux/types.h> #include <linux/ioctl.h> /** * enum blk_zone_type - Types of zones allowed in a zoned device. * * @BLK_ZONE_TYPE_CONVENTIONAL: The zone has no write pointer and can be writen * randomly. Zone reset has no effect on the zone. * @BLK_ZONE_TYPE_SEQWRITE_REQ: The zone must be written sequentially * @BLK_ZONE_TYPE_SEQWRITE_PREF: The zone can be written non-sequentially * * Any other value not defined is reserved and must be considered as invalid. */ enum blk_zone_type { BLK_ZONE_TYPE_CONVENTIONAL = 0x1, BLK_ZONE_TYPE_SEQWRITE_REQ = 0x2, BLK_ZONE_TYPE_SEQWRITE_PREF = 0x3, }; /** * enum blk_zone_cond - Condition [state] of a zone in a zoned device. * * @BLK_ZONE_COND_NOT_WP: The zone has no write pointer, it is conventional. * @BLK_ZONE_COND_EMPTY: The zone is empty. * @BLK_ZONE_COND_IMP_OPEN: The zone is open, but not explicitly opened. * @BLK_ZONE_COND_EXP_OPEN: The zones was explicitly opened by an * OPEN ZONE command. * @BLK_ZONE_COND_CLOSED: The zone was [explicitly] closed after writing. * @BLK_ZONE_COND_FULL: The zone is marked as full, possibly by a zone * FINISH ZONE command. * @BLK_ZONE_COND_READONLY: The zone is read-only. * @BLK_ZONE_COND_OFFLINE: The zone is offline (sectors cannot be read/written). * * The Zone Condition state machine in the ZBC/ZAC standards maps the above * deinitions as: * - ZC1: Empty | BLK_ZONE_EMPTY * - ZC2: Implicit Open | BLK_ZONE_COND_IMP_OPEN * - ZC3: Explicit Open | BLK_ZONE_COND_EXP_OPEN * - ZC4: Closed | BLK_ZONE_CLOSED * - ZC5: Full | BLK_ZONE_FULL * - ZC6: Read Only | BLK_ZONE_READONLY * - ZC7: Offline | BLK_ZONE_OFFLINE * * Conditions 0x5 to 0xC are reserved by the current ZBC/ZAC spec and should * be considered invalid. */ enum blk_zone_cond { BLK_ZONE_COND_NOT_WP = 0x0, BLK_ZONE_COND_EMPTY = 0x1, BLK_ZONE_COND_IMP_OPEN = 0x2, BLK_ZONE_COND_EXP_OPEN = 0x3, BLK_ZONE_COND_CLOSED = 0x4, BLK_ZONE_COND_READONLY = 0xD, BLK_ZONE_COND_FULL = 0xE, BLK_ZONE_COND_OFFLINE = 0xF, }; /** * struct blk_zone - Zone descriptor for BLKREPORTZONE ioctl. * * @start: Zone start in 512 B sector units * @len: Zone length in 512 B sector units * @wp: Zone write pointer location in 512 B sector units * @type: see enum blk_zone_type for possible values * @cond: see enum blk_zone_cond for possible values * @non_seq: Flag indicating that the zone is using non-sequential resources * (for host-aware zoned block devices only). * @reset: Flag indicating that a zone reset is recommended. * @reserved: Padding to 64 B to match the ZBC/ZAC defined zone descriptor size. * * start, len and wp use the regular 512 B sector unit, regardless of the * device logical block size. The overall structure size is 64 B to match the * ZBC/ZAC defined zone descriptor and allow support for future additional * zone information. */ struct blk_zone { __u64 start; /* Zone start sector */ __u64 len; /* Zone length in number of sectors */ __u64 wp; /* Zone write pointer position */ __u8 type; /* Zone type */ __u8 cond; /* Zone condition */ __u8 non_seq; /* Non-sequential write resources active */ __u8 reset; /* Reset write pointer recommended */ __u8 reserved[36]; }; /** * struct blk_zone_report - BLKREPORTZONE ioctl request/reply * * @sector: starting sector of report * @nr_zones: IN maximum / OUT actual * @reserved: padding to 16 byte alignment * @zones: Space to hold @nr_zones @zones entries on reply. * * The array of at most @nr_zones must follow this structure in memory. */ struct blk_zone_report { __u64 sector; __u32 nr_zones; __u8 reserved[4]; struct blk_zone zones[0]; }; /** * struct blk_zone_range - BLKRESETZONE ioctl request * @sector: starting sector of the first zone to issue reset write pointer * @nr_sectors: Total number of sectors of 1 or more zones to reset */ struct blk_zone_range { __u64 sector; __u64 nr_sectors; }; /** * Zoned block device ioctl's: * * @BLKREPORTZONE: Get zone information. Takes a zone report as argument. * The zone report will start from the zone containing the * sector specified in the report request structure. * @BLKRESETZONE: Reset the write pointer of the zones in the specified * sector range. The sector range must be zone aligned. */ #define BLKREPORTZONE _IOWR(0x12, 130, struct blk_zone_report) #define BLKRESETZONE _IOW(0x12, 131, struct blk_zone_range) #endif /* _BLKZONED_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/nfs_fs.h��������������������������������������������������������������������������������������0000644�����������������00000003110�14763166027�0007341 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/include/linux/nfs_fs.h * * Copyright (C) 1992 Rick Sladkey * * OS-specific nfs filesystem definitions and declarations */ #ifndef _LINUX_NFS_FS_H #define _LINUX_NFS_FS_H #include <linux/magic.h> /* Default timeout values */ #define NFS_DEF_UDP_TIMEO (11) #define NFS_DEF_UDP_RETRANS (3) #define NFS_DEF_TCP_TIMEO (600) #define NFS_DEF_TCP_RETRANS (2) #define NFS_MAX_UDP_TIMEOUT (60*HZ) #define NFS_MAX_TCP_TIMEOUT (600*HZ) #define NFS_DEF_ACREGMIN (3) #define NFS_DEF_ACREGMAX (60) #define NFS_DEF_ACDIRMIN (30) #define NFS_DEF_ACDIRMAX (60) /* * When flushing a cluster of dirty pages, there can be different * strategies: */ #define FLUSH_SYNC 1 /* file being synced, or contention */ #define FLUSH_STABLE 4 /* commit to stable storage */ #define FLUSH_LOWPRI 8 /* low priority background flush */ #define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ #define FLUSH_COND_STABLE 32 /* conditional stable write - only stable * if everything fits in one RPC */ /* * NFS debug flags */ #define NFSDBG_VFS 0x0001 #define NFSDBG_DIRCACHE 0x0002 #define NFSDBG_LOOKUPCACHE 0x0004 #define NFSDBG_PAGECACHE 0x0008 #define NFSDBG_PROC 0x0010 #define NFSDBG_XDR 0x0020 #define NFSDBG_FILE 0x0040 #define NFSDBG_ROOT 0x0080 #define NFSDBG_CALLBACK 0x0100 #define NFSDBG_CLIENT 0x0200 #define NFSDBG_MOUNT 0x0400 #define NFSDBG_FSCACHE 0x0800 #define NFSDBG_PNFS 0x1000 #define NFSDBG_PNFS_LD 0x2000 #define NFSDBG_STATE 0x4000 #define NFSDBG_ALL 0xFFFF #endif /* _LINUX_NFS_FS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/uhid.h����������������������������������������������������������������������������������������0000644�����������������00000011050�14763166027�0007016 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef __UHID_H_ #define __UHID_H_ /* * User-space I/O driver support for HID subsystem * Copyright (c) 2012 David Herrmann */ /* * 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. */ /* * Public header for user-space communication. We try to keep every structure * aligned but to be safe we also use __attribute__((__packed__)). Therefore, * the communication should be ABI compatible even between architectures. */ #include <linux/input.h> #include <linux/types.h> #include <linux/hid.h> enum uhid_event_type { __UHID_LEGACY_CREATE, UHID_DESTROY, UHID_START, UHID_STOP, UHID_OPEN, UHID_CLOSE, UHID_OUTPUT, __UHID_LEGACY_OUTPUT_EV, __UHID_LEGACY_INPUT, UHID_GET_REPORT, UHID_GET_REPORT_REPLY, UHID_CREATE2, UHID_INPUT2, UHID_SET_REPORT, UHID_SET_REPORT_REPLY, }; struct uhid_create2_req { __u8 name[128]; __u8 phys[64]; __u8 uniq[64]; __u16 rd_size; __u16 bus; __u32 vendor; __u32 product; __u32 version; __u32 country; __u8 rd_data[HID_MAX_DESCRIPTOR_SIZE]; } __attribute__((__packed__)); enum uhid_dev_flag { UHID_DEV_NUMBERED_FEATURE_REPORTS = (1ULL << 0), UHID_DEV_NUMBERED_OUTPUT_REPORTS = (1ULL << 1), UHID_DEV_NUMBERED_INPUT_REPORTS = (1ULL << 2), }; struct uhid_start_req { __u64 dev_flags; }; #define UHID_DATA_MAX 4096 enum uhid_report_type { UHID_FEATURE_REPORT, UHID_OUTPUT_REPORT, UHID_INPUT_REPORT, }; struct uhid_input2_req { __u16 size; __u8 data[UHID_DATA_MAX]; } __attribute__((__packed__)); struct uhid_output_req { __u8 data[UHID_DATA_MAX]; __u16 size; __u8 rtype; } __attribute__((__packed__)); struct uhid_get_report_req { __u32 id; __u8 rnum; __u8 rtype; } __attribute__((__packed__)); struct uhid_get_report_reply_req { __u32 id; __u16 err; __u16 size; __u8 data[UHID_DATA_MAX]; } __attribute__((__packed__)); struct uhid_set_report_req { __u32 id; __u8 rnum; __u8 rtype; __u16 size; __u8 data[UHID_DATA_MAX]; } __attribute__((__packed__)); struct uhid_set_report_reply_req { __u32 id; __u16 err; } __attribute__((__packed__)); /* * Compat Layer * All these commands and requests are obsolete. You should avoid using them in * new code. We support them for backwards-compatibility, but you might not get * access to new feature in case you use them. */ enum uhid_legacy_event_type { UHID_CREATE = __UHID_LEGACY_CREATE, UHID_OUTPUT_EV = __UHID_LEGACY_OUTPUT_EV, UHID_INPUT = __UHID_LEGACY_INPUT, UHID_FEATURE = UHID_GET_REPORT, UHID_FEATURE_ANSWER = UHID_GET_REPORT_REPLY, }; /* Obsolete! Use UHID_CREATE2. */ struct uhid_create_req { __u8 name[128]; __u8 phys[64]; __u8 uniq[64]; __u8 *rd_data; __u16 rd_size; __u16 bus; __u32 vendor; __u32 product; __u32 version; __u32 country; } __attribute__((__packed__)); /* Obsolete! Use UHID_INPUT2. */ struct uhid_input_req { __u8 data[UHID_DATA_MAX]; __u16 size; } __attribute__((__packed__)); /* Obsolete! Kernel uses UHID_OUTPUT exclusively now. */ struct uhid_output_ev_req { __u16 type; __u16 code; __s32 value; } __attribute__((__packed__)); /* Obsolete! Kernel uses ABI compatible UHID_GET_REPORT. */ struct uhid_feature_req { __u32 id; __u8 rnum; __u8 rtype; } __attribute__((__packed__)); /* Obsolete! Use ABI compatible UHID_GET_REPORT_REPLY. */ struct uhid_feature_answer_req { __u32 id; __u16 err; __u16 size; __u8 data[UHID_DATA_MAX]; } __attribute__((__packed__)); /* * UHID Events * All UHID events from and to the kernel are encoded as "struct uhid_event". * The "type" field contains a UHID_* type identifier. All payload depends on * that type and can be accessed via ev->u.XYZ accordingly. * If user-space writes short events, they're extended with 0s by the kernel. If * the kernel writes short events, user-space shall extend them with 0s. */ struct uhid_event { __u32 type; union { struct uhid_create_req create; struct uhid_input_req input; struct uhid_output_req output; struct uhid_output_ev_req output_ev; struct uhid_feature_req feature; struct uhid_get_report_req get_report; struct uhid_feature_answer_req feature_answer; struct uhid_get_report_reply_req get_report_reply; struct uhid_create2_req create2; struct uhid_input2_req input2; struct uhid_set_report_req set_report; struct uhid_set_report_reply_req set_report_reply; struct uhid_start_req start; } u; } __attribute__((__packed__)); #endif /* __UHID_H_ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/pci.h�����������������������������������������������������������������������������������������0000644�����������������00000002544�14763166027�0006650 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * pci.h * * PCI defines and function prototypes * Copyright 1994, Drew Eckhardt * Copyright 1997--1999 Martin Mares <mj@ucw.cz> * * For more information, please consult the following manuals (look at * http://www.pcisig.com/ for how to get them): * * PCI BIOS Specification * PCI Local Bus Specification * PCI to PCI Bridge Specification * PCI System Design Guide */ #ifndef LINUX_PCI_H #define LINUX_PCI_H #include <linux/pci_regs.h> /* The pci register defines */ /* * The PCI interface treats multi-function devices as independent * devices. The slot/function address of each device is encoded * in a single byte as follows: * * 7:3 = slot * 2:0 = function */ #define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) #define PCI_FUNC(devfn) ((devfn) & 0x07) /* Ioctls for /proc/bus/pci/X/Y nodes. */ #define PCIIOC_BASE ('P' << 24 | 'C' << 16 | 'I' << 8) #define PCIIOC_CONTROLLER (PCIIOC_BASE | 0x00) /* Get controller for PCI device. */ #define PCIIOC_MMAP_IS_IO (PCIIOC_BASE | 0x01) /* Set mmap state to I/O space. */ #define PCIIOC_MMAP_IS_MEM (PCIIOC_BASE | 0x02) /* Set mmap state to MEM space. */ #define PCIIOC_WRITE_COMBINE (PCIIOC_BASE | 0x03) /* Enable/disable write-combining. */ #endif /* LINUX_PCI_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������linux/virtio_types.h��������������������������������������������������������������������������������0000644�����������������00000004151�14763166027�0010631 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _LINUX_VIRTIO_TYPES_H #define _LINUX_VIRTIO_TYPES_H /* Type definitions for virtio implementations. * * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Copyright (C) 2014 Red Hat, Inc. * Author: Michael S. Tsirkin <mst@redhat.com> */ #include <linux/types.h> /* * __virtio{16,32,64} have the following meaning: * - __u{16,32,64} for virtio devices in legacy mode, accessed in native endian * - __le{16,32,64} for standard-compliant virtio devices */ typedef __u16 __bitwise __virtio16; typedef __u32 __bitwise __virtio32; typedef __u64 __bitwise __virtio64; #endif /* _LINUX_VIRTIO_TYPES_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/filter.h��������������������������������������������������������������������������������������0000644�����������������00000004250�14763166027�0007356 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Linux Socket Filter Data Structures */ #ifndef __LINUX_FILTER_H__ #define __LINUX_FILTER_H__ #include <linux/types.h> #include <linux/bpf_common.h> /* * Current version of the filter code architecture. */ #define BPF_MAJOR_VERSION 1 #define BPF_MINOR_VERSION 1 /* * Try and keep these values and structures similar to BSD, especially * the BPF code definitions which need to match so you can share filters */ struct sock_filter { /* Filter block */ __u16 code; /* Actual filter code */ __u8 jt; /* Jump true */ __u8 jf; /* Jump false */ __u32 k; /* Generic multiuse field */ }; struct sock_fprog { /* Required for SO_ATTACH_FILTER. */ unsigned short len; /* Number of filter blocks */ struct sock_filter *filter; }; /* ret - BPF_K and BPF_X also apply */ #define BPF_RVAL(code) ((code) & 0x18) #define BPF_A 0x10 /* misc */ #define BPF_MISCOP(code) ((code) & 0xf8) #define BPF_TAX 0x00 #define BPF_TXA 0x80 /* * Macros for filter block array initializers. */ #ifndef BPF_STMT #define BPF_STMT(code, k) { (unsigned short)(code), 0, 0, k } #endif #ifndef BPF_JUMP #define BPF_JUMP(code, k, jt, jf) { (unsigned short)(code), jt, jf, k } #endif /* * Number of scratch memory words for: BPF_ST and BPF_STX */ #define BPF_MEMWORDS 16 /* RATIONALE. Negative offsets are invalid in BPF. We use them to reference ancillary data. Unlike introduction new instructions, it does not break existing compilers/optimizers. */ #define SKF_AD_OFF (-0x1000) #define SKF_AD_PROTOCOL 0 #define SKF_AD_PKTTYPE 4 #define SKF_AD_IFINDEX 8 #define SKF_AD_NLATTR 12 #define SKF_AD_NLATTR_NEST 16 #define SKF_AD_MARK 20 #define SKF_AD_QUEUE 24 #define SKF_AD_HATYPE 28 #define SKF_AD_RXHASH 32 #define SKF_AD_CPU 36 #define SKF_AD_ALU_XOR_X 40 #define SKF_AD_VLAN_TAG 44 #define SKF_AD_VLAN_TAG_PRESENT 48 #define SKF_AD_PAY_OFFSET 52 #define SKF_AD_RANDOM 56 #define SKF_AD_VLAN_TPID 60 #define SKF_AD_MAX 64 #define SKF_NET_OFF (-0x100000) #define SKF_LL_OFF (-0x200000) #define BPF_NET_OFF SKF_NET_OFF #define BPF_LL_OFF SKF_LL_OFF #endif /* __LINUX_FILTER_H__ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/ipv6_route.h����������������������������������������������������������������������������������0000644�����������������00000003564�14763166027�0010202 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Linux INET6 implementation * * Authors: * Pedro Roque <roque@di.fc.ul.pt> * * 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. */ #ifndef _LINUX_IPV6_ROUTE_H #define _LINUX_IPV6_ROUTE_H #include <linux/types.h> #include <linux/in6.h> /* For struct in6_addr. */ #define RTF_DEFAULT 0x00010000 /* default - learned via ND */ #define RTF_ALLONLINK 0x00020000 /* (deprecated and will be removed) fallback, no routers on link */ #define RTF_ADDRCONF 0x00040000 /* addrconf route - RA */ #define RTF_PREFIX_RT 0x00080000 /* A prefix only route - RA */ #define RTF_ANYCAST 0x00100000 /* Anycast */ #define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */ #define RTF_EXPIRES 0x00400000 #define RTF_ROUTEINFO 0x00800000 /* route information - RA */ #define RTF_CACHE 0x01000000 /* read-only: can not be set by user */ #define RTF_FLOW 0x02000000 /* flow significant route */ #define RTF_POLICY 0x04000000 /* policy route */ #define RTF_PREF(pref) ((pref) << 27) #define RTF_PREF_MASK 0x18000000 #define RTF_PCPU 0x40000000 /* read-only: can not be set by user */ #define RTF_LOCAL 0x80000000 struct in6_rtmsg { struct in6_addr rtmsg_dst; struct in6_addr rtmsg_src; struct in6_addr rtmsg_gateway; __u32 rtmsg_type; __u16 rtmsg_dst_len; __u16 rtmsg_src_len; __u32 rtmsg_metric; unsigned long rtmsg_info; __u32 rtmsg_flags; int rtmsg_ifindex; }; #define RTMSG_NEWDEVICE 0x11 #define RTMSG_DELDEVICE 0x12 #define RTMSG_NEWROUTE 0x21 #define RTMSG_DELROUTE 0x22 #define IP6_RT_PRIO_USER 1024 #define IP6_RT_PRIO_ADDRCONF 256 #endif /* _LINUX_IPV6_ROUTE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������linux/fiemap.h��������������������������������������������������������������������������������������0000644�����������������00000005327�14763166027�0007340 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * FS_IOC_FIEMAP ioctl infrastructure. * * Some portions copyright (C) 2007 Cluster File Systems, Inc * * Authors: Mark Fasheh <mfasheh@suse.com> * Kalpak Shah <kalpak.shah@sun.com> * Andreas Dilger <adilger@sun.com> */ #ifndef _LINUX_FIEMAP_H #define _LINUX_FIEMAP_H #include <linux/types.h> struct fiemap_extent { __u64 fe_logical; /* logical offset in bytes for the start of * the extent from the beginning of the file */ __u64 fe_physical; /* physical offset in bytes for the start * of the extent from the beginning of the disk */ __u64 fe_length; /* length in bytes for this extent */ __u64 fe_reserved64[2]; __u32 fe_flags; /* FIEMAP_EXTENT_* flags for this extent */ __u32 fe_reserved[3]; }; struct fiemap { __u64 fm_start; /* logical offset (inclusive) at * which to start mapping (in) */ __u64 fm_length; /* logical length of mapping which * userspace wants (in) */ __u32 fm_flags; /* FIEMAP_FLAG_* flags for request (in/out) */ __u32 fm_mapped_extents;/* number of extents that were mapped (out) */ __u32 fm_extent_count; /* size of fm_extents array (in) */ __u32 fm_reserved; struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */ }; #define FIEMAP_MAX_OFFSET (~0ULL) #define FIEMAP_FLAG_SYNC 0x00000001 /* sync file data before map */ #define FIEMAP_FLAG_XATTR 0x00000002 /* map extended attribute tree */ #define FIEMAP_FLAG_CACHE 0x00000004 /* request caching of the extents */ #define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR) #define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent in file. */ #define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data location unknown. */ #define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location still pending. * Sets EXTENT_UNKNOWN. */ #define FIEMAP_EXTENT_ENCODED 0x00000008 /* Data can not be read * while fs is unmounted */ #define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs. * Sets EXTENT_NO_BYPASS. */ #define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be * block aligned. */ #define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata. * Sets EXTENT_NOT_ALIGNED.*/ #define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block. * Sets EXTENT_NOT_ALIGNED.*/ #define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but * no data (i.e. zero). */ #define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively * support extents. Result * merged for efficiency. */ #define FIEMAP_EXTENT_SHARED 0x00002000 /* Space shared with other * files. */ #endif /* _LINUX_FIEMAP_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/fsl_hypervisor.h������������������������������������������������������������������������������0000644�����������������00000016205�14763166027�0011152 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * Freescale hypervisor ioctl and kernel interface * * Copyright (C) 2008-2011 Freescale Semiconductor, Inc. * Author: Timur Tabi <timur@freescale.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Freescale Semiconductor nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * * ALTERNATIVELY, this software may be distributed under the terms of the * GNU General Public License ("GPL") as published by the Free Software * Foundation, either version 2 of that License or (at your option) any * later version. * * This software is provided by Freescale Semiconductor "as is" and any * express or implied warranties, including, but not limited to, the implied * warranties of merchantability and fitness for a particular purpose are * disclaimed. In no event shall Freescale Semiconductor be liable for any * direct, indirect, incidental, special, exemplary, or consequential damages * (including, but not limited to, procurement of substitute goods or services; * loss of use, data, or profits; or business interruption) however caused and * on any theory of liability, whether in contract, strict liability, or tort * (including negligence or otherwise) arising in any way out of the use of this * software, even if advised of the possibility of such damage. * * This file is used by the Freescale hypervisor management driver. It can * also be included by applications that need to communicate with the driver * via the ioctl interface. */ #ifndef FSL_HYPERVISOR_H #define FSL_HYPERVISOR_H #include <linux/types.h> /** * struct fsl_hv_ioctl_restart - restart a partition * @ret: return error code from the hypervisor * @partition: the ID of the partition to restart, or -1 for the * calling partition * * Used by FSL_HV_IOCTL_PARTITION_RESTART */ struct fsl_hv_ioctl_restart { __u32 ret; __u32 partition; }; /** * struct fsl_hv_ioctl_status - get a partition's status * @ret: return error code from the hypervisor * @partition: the ID of the partition to query, or -1 for the * calling partition * @status: The returned status of the partition * * Used by FSL_HV_IOCTL_PARTITION_GET_STATUS * * Values of 'status': * 0 = Stopped * 1 = Running * 2 = Starting * 3 = Stopping */ struct fsl_hv_ioctl_status { __u32 ret; __u32 partition; __u32 status; }; /** * struct fsl_hv_ioctl_start - start a partition * @ret: return error code from the hypervisor * @partition: the ID of the partition to control * @entry_point: The offset within the guest IMA to start execution * @load: If non-zero, reload the partition's images before starting * * Used by FSL_HV_IOCTL_PARTITION_START */ struct fsl_hv_ioctl_start { __u32 ret; __u32 partition; __u32 entry_point; __u32 load; }; /** * struct fsl_hv_ioctl_stop - stop a partition * @ret: return error code from the hypervisor * @partition: the ID of the partition to stop, or -1 for the calling * partition * * Used by FSL_HV_IOCTL_PARTITION_STOP */ struct fsl_hv_ioctl_stop { __u32 ret; __u32 partition; }; /** * struct fsl_hv_ioctl_memcpy - copy memory between partitions * @ret: return error code from the hypervisor * @source: the partition ID of the source partition, or -1 for this * partition * @target: the partition ID of the target partition, or -1 for this * partition * @reserved: reserved, must be set to 0 * @local_addr: user-space virtual address of a buffer in the local * partition * @remote_addr: guest physical address of a buffer in the * remote partition * @count: the number of bytes to copy. Both the local and remote * buffers must be at least 'count' bytes long * * Used by FSL_HV_IOCTL_MEMCPY * * The 'local' partition is the partition that calls this ioctl. The * 'remote' partition is a different partition. The data is copied from * the 'source' paritition' to the 'target' partition. * * The buffer in the remote partition must be guest physically * contiguous. * * This ioctl does not support copying memory between two remote * partitions or within the same partition, so either 'source' or * 'target' (but not both) must be -1. In other words, either * * source == local and target == remote * or * source == remote and target == local */ struct fsl_hv_ioctl_memcpy { __u32 ret; __u32 source; __u32 target; __u32 reserved; /* padding to ensure local_vaddr is aligned */ __u64 local_vaddr; __u64 remote_paddr; __u64 count; }; /** * struct fsl_hv_ioctl_doorbell - ring a doorbell * @ret: return error code from the hypervisor * @doorbell: the handle of the doorbell to ring doorbell * * Used by FSL_HV_IOCTL_DOORBELL */ struct fsl_hv_ioctl_doorbell { __u32 ret; __u32 doorbell; }; /** * struct fsl_hv_ioctl_prop - get/set a device tree property * @ret: return error code from the hypervisor * @handle: handle of partition whose tree to access * @path: virtual address of path name of node to access * @propname: virtual address of name of property to access * @propval: virtual address of property data buffer * @proplen: Size of property data buffer * @reserved: reserved, must be set to 0 * * Used by FSL_HV_IOCTL_DOORBELL */ struct fsl_hv_ioctl_prop { __u32 ret; __u32 handle; __u64 path; __u64 propname; __u64 propval; __u32 proplen; __u32 reserved; /* padding to ensure structure is aligned */ }; /* The ioctl type, documented in ioctl-number.txt */ #define FSL_HV_IOCTL_TYPE 0xAF /* Restart another partition */ #define FSL_HV_IOCTL_PARTITION_RESTART \ _IOWR(FSL_HV_IOCTL_TYPE, 1, struct fsl_hv_ioctl_restart) /* Get a partition's status */ #define FSL_HV_IOCTL_PARTITION_GET_STATUS \ _IOWR(FSL_HV_IOCTL_TYPE, 2, struct fsl_hv_ioctl_status) /* Boot another partition */ #define FSL_HV_IOCTL_PARTITION_START \ _IOWR(FSL_HV_IOCTL_TYPE, 3, struct fsl_hv_ioctl_start) /* Stop this or another partition */ #define FSL_HV_IOCTL_PARTITION_STOP \ _IOWR(FSL_HV_IOCTL_TYPE, 4, struct fsl_hv_ioctl_stop) /* Copy data from one partition to another */ #define FSL_HV_IOCTL_MEMCPY \ _IOWR(FSL_HV_IOCTL_TYPE, 5, struct fsl_hv_ioctl_memcpy) /* Ring a doorbell */ #define FSL_HV_IOCTL_DOORBELL \ _IOWR(FSL_HV_IOCTL_TYPE, 6, struct fsl_hv_ioctl_doorbell) /* Get a property from another guest's device tree */ #define FSL_HV_IOCTL_GETPROP \ _IOWR(FSL_HV_IOCTL_TYPE, 7, struct fsl_hv_ioctl_prop) /* Set a property in another guest's device tree */ #define FSL_HV_IOCTL_SETPROP \ _IOWR(FSL_HV_IOCTL_TYPE, 8, struct fsl_hv_ioctl_prop) #endif /* FSL_HYPERVISOR_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/elf.h�����������������������������������������������������������������������������������������0000644�����������������00000032061�14763166027�0006640 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_ELF_H #define _LINUX_ELF_H #include <linux/types.h> #include <linux/elf-em.h> /* 32-bit ELF base types. */ typedef __u32 Elf32_Addr; typedef __u16 Elf32_Half; typedef __u32 Elf32_Off; typedef __s32 Elf32_Sword; typedef __u32 Elf32_Word; /* 64-bit ELF base types. */ typedef __u64 Elf64_Addr; typedef __u16 Elf64_Half; typedef __s16 Elf64_SHalf; typedef __u64 Elf64_Off; typedef __s32 Elf64_Sword; typedef __u32 Elf64_Word; typedef __u64 Elf64_Xword; typedef __s64 Elf64_Sxword; /* These constants are for the segment types stored in the image headers */ #define PT_NULL 0 #define PT_LOAD 1 #define PT_DYNAMIC 2 #define PT_INTERP 3 #define PT_NOTE 4 #define PT_SHLIB 5 #define PT_PHDR 6 #define PT_TLS 7 /* Thread local storage segment */ #define PT_LOOS 0x60000000 /* OS-specific */ #define PT_HIOS 0x6fffffff /* OS-specific */ #define PT_LOPROC 0x70000000 #define PT_HIPROC 0x7fffffff #define PT_GNU_EH_FRAME 0x6474e550 #define PT_GNU_STACK (PT_LOOS + 0x474e551) /* * Extended Numbering * * If the real number of program header table entries is larger than * or equal to PN_XNUM(0xffff), it is set to sh_info field of the * section header at index 0, and PN_XNUM is set to e_phnum * field. Otherwise, the section header at index 0 is zero * initialized, if it exists. * * Specifications are available in: * * - Oracle: Linker and Libraries. * Part No: 817–1984–19, August 2011. * http://docs.oracle.com/cd/E18752_01/pdf/817-1984.pdf * * - System V ABI AMD64 Architecture Processor Supplement * Draft Version 0.99.4, * January 13, 2010. * http://www.cs.washington.edu/education/courses/cse351/12wi/supp-docs/abi.pdf */ #define PN_XNUM 0xffff /* These constants define the different elf file types */ #define ET_NONE 0 #define ET_REL 1 #define ET_EXEC 2 #define ET_DYN 3 #define ET_CORE 4 #define ET_LOPROC 0xff00 #define ET_HIPROC 0xffff /* This is the info that is needed to parse the dynamic section of the file */ #define DT_NULL 0 #define DT_NEEDED 1 #define DT_PLTRELSZ 2 #define DT_PLTGOT 3 #define DT_HASH 4 #define DT_STRTAB 5 #define DT_SYMTAB 6 #define DT_RELA 7 #define DT_RELASZ 8 #define DT_RELAENT 9 #define DT_STRSZ 10 #define DT_SYMENT 11 #define DT_INIT 12 #define DT_FINI 13 #define DT_SONAME 14 #define DT_RPATH 15 #define DT_SYMBOLIC 16 #define DT_REL 17 #define DT_RELSZ 18 #define DT_RELENT 19 #define DT_PLTREL 20 #define DT_DEBUG 21 #define DT_TEXTREL 22 #define DT_JMPREL 23 #define DT_ENCODING 32 #define OLD_DT_LOOS 0x60000000 #define DT_LOOS 0x6000000d #define DT_HIOS 0x6ffff000 #define DT_VALRNGLO 0x6ffffd00 #define DT_VALRNGHI 0x6ffffdff #define DT_ADDRRNGLO 0x6ffffe00 #define DT_ADDRRNGHI 0x6ffffeff #define DT_VERSYM 0x6ffffff0 #define DT_RELACOUNT 0x6ffffff9 #define DT_RELCOUNT 0x6ffffffa #define DT_FLAGS_1 0x6ffffffb #define DT_VERDEF 0x6ffffffc #define DT_VERDEFNUM 0x6ffffffd #define DT_VERNEED 0x6ffffffe #define DT_VERNEEDNUM 0x6fffffff #define OLD_DT_HIOS 0x6fffffff #define DT_LOPROC 0x70000000 #define DT_HIPROC 0x7fffffff /* This info is needed when parsing the symbol table */ #define STB_LOCAL 0 #define STB_GLOBAL 1 #define STB_WEAK 2 #define STT_NOTYPE 0 #define STT_OBJECT 1 #define STT_FUNC 2 #define STT_SECTION 3 #define STT_FILE 4 #define STT_COMMON 5 #define STT_TLS 6 #define ELF_ST_BIND(x) ((x) >> 4) #define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf) #define ELF32_ST_BIND(x) ELF_ST_BIND(x) #define ELF32_ST_TYPE(x) ELF_ST_TYPE(x) #define ELF64_ST_BIND(x) ELF_ST_BIND(x) #define ELF64_ST_TYPE(x) ELF_ST_TYPE(x) typedef struct dynamic{ Elf32_Sword d_tag; union{ Elf32_Sword d_val; Elf32_Addr d_ptr; } d_un; } Elf32_Dyn; typedef struct { Elf64_Sxword d_tag; /* entry tag value */ union { Elf64_Xword d_val; Elf64_Addr d_ptr; } d_un; } Elf64_Dyn; /* The following are used with relocations */ #define ELF32_R_SYM(x) ((x) >> 8) #define ELF32_R_TYPE(x) ((x) & 0xff) #define ELF64_R_SYM(i) ((i) >> 32) #define ELF64_R_TYPE(i) ((i) & 0xffffffff) typedef struct elf32_rel { Elf32_Addr r_offset; Elf32_Word r_info; } Elf32_Rel; typedef struct elf64_rel { Elf64_Addr r_offset; /* Location at which to apply the action */ Elf64_Xword r_info; /* index and type of relocation */ } Elf64_Rel; typedef struct elf32_rela{ Elf32_Addr r_offset; Elf32_Word r_info; Elf32_Sword r_addend; } Elf32_Rela; typedef struct elf64_rela { Elf64_Addr r_offset; /* Location at which to apply the action */ Elf64_Xword r_info; /* index and type of relocation */ Elf64_Sxword r_addend; /* Constant addend used to compute value */ } Elf64_Rela; typedef struct elf32_sym{ Elf32_Word st_name; Elf32_Addr st_value; Elf32_Word st_size; unsigned char st_info; unsigned char st_other; Elf32_Half st_shndx; } Elf32_Sym; typedef struct elf64_sym { Elf64_Word st_name; /* Symbol name, index in string tbl */ unsigned char st_info; /* Type and binding attributes */ unsigned char st_other; /* No defined meaning, 0 */ Elf64_Half st_shndx; /* Associated section index */ Elf64_Addr st_value; /* Value of the symbol */ Elf64_Xword st_size; /* Associated symbol size */ } Elf64_Sym; #define EI_NIDENT 16 typedef struct elf32_hdr{ unsigned char e_ident[EI_NIDENT]; Elf32_Half e_type; Elf32_Half e_machine; Elf32_Word e_version; Elf32_Addr e_entry; /* Entry point */ Elf32_Off e_phoff; Elf32_Off e_shoff; Elf32_Word e_flags; Elf32_Half e_ehsize; Elf32_Half e_phentsize; Elf32_Half e_phnum; Elf32_Half e_shentsize; Elf32_Half e_shnum; Elf32_Half e_shstrndx; } Elf32_Ehdr; typedef struct elf64_hdr { unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */ Elf64_Half e_type; Elf64_Half e_machine; Elf64_Word e_version; Elf64_Addr e_entry; /* Entry point virtual address */ Elf64_Off e_phoff; /* Program header table file offset */ Elf64_Off e_shoff; /* Section header table file offset */ Elf64_Word e_flags; Elf64_Half e_ehsize; Elf64_Half e_phentsize; Elf64_Half e_phnum; Elf64_Half e_shentsize; Elf64_Half e_shnum; Elf64_Half e_shstrndx; } Elf64_Ehdr; /* These constants define the permissions on sections in the program header, p_flags. */ #define PF_R 0x4 #define PF_W 0x2 #define PF_X 0x1 typedef struct elf32_phdr{ Elf32_Word p_type; Elf32_Off p_offset; Elf32_Addr p_vaddr; Elf32_Addr p_paddr; Elf32_Word p_filesz; Elf32_Word p_memsz; Elf32_Word p_flags; Elf32_Word p_align; } Elf32_Phdr; typedef struct elf64_phdr { Elf64_Word p_type; Elf64_Word p_flags; Elf64_Off p_offset; /* Segment file offset */ Elf64_Addr p_vaddr; /* Segment virtual address */ Elf64_Addr p_paddr; /* Segment physical address */ Elf64_Xword p_filesz; /* Segment size in file */ Elf64_Xword p_memsz; /* Segment size in memory */ Elf64_Xword p_align; /* Segment alignment, file & memory */ } Elf64_Phdr; /* sh_type */ #define SHT_NULL 0 #define SHT_PROGBITS 1 #define SHT_SYMTAB 2 #define SHT_STRTAB 3 #define SHT_RELA 4 #define SHT_HASH 5 #define SHT_DYNAMIC 6 #define SHT_NOTE 7 #define SHT_NOBITS 8 #define SHT_REL 9 #define SHT_SHLIB 10 #define SHT_DYNSYM 11 #define SHT_NUM 12 #define SHT_LOPROC 0x70000000 #define SHT_HIPROC 0x7fffffff #define SHT_LOUSER 0x80000000 #define SHT_HIUSER 0xffffffff /* sh_flags */ #define SHF_WRITE 0x1 #define SHF_ALLOC 0x2 #define SHF_EXECINSTR 0x4 #define SHF_RELA_LIVEPATCH 0x00100000 #define SHF_RO_AFTER_INIT 0x00200000 #define SHF_MASKPROC 0xf0000000 /* special section indexes */ #define SHN_UNDEF 0 #define SHN_LORESERVE 0xff00 #define SHN_LOPROC 0xff00 #define SHN_HIPROC 0xff1f #define SHN_LIVEPATCH 0xff20 #define SHN_ABS 0xfff1 #define SHN_COMMON 0xfff2 #define SHN_HIRESERVE 0xffff typedef struct elf32_shdr { Elf32_Word sh_name; Elf32_Word sh_type; Elf32_Word sh_flags; Elf32_Addr sh_addr; Elf32_Off sh_offset; Elf32_Word sh_size; Elf32_Word sh_link; Elf32_Word sh_info; Elf32_Word sh_addralign; Elf32_Word sh_entsize; } Elf32_Shdr; typedef struct elf64_shdr { Elf64_Word sh_name; /* Section name, index in string tbl */ Elf64_Word sh_type; /* Type of section */ Elf64_Xword sh_flags; /* Miscellaneous section attributes */ Elf64_Addr sh_addr; /* Section virtual addr at execution */ Elf64_Off sh_offset; /* Section file offset */ Elf64_Xword sh_size; /* Size of section in bytes */ Elf64_Word sh_link; /* Index of another section */ Elf64_Word sh_info; /* Additional section information */ Elf64_Xword sh_addralign; /* Section alignment */ Elf64_Xword sh_entsize; /* Entry size if section holds table */ } Elf64_Shdr; #define EI_MAG0 0 /* e_ident[] indexes */ #define EI_MAG1 1 #define EI_MAG2 2 #define EI_MAG3 3 #define EI_CLASS 4 #define EI_DATA 5 #define EI_VERSION 6 #define EI_OSABI 7 #define EI_PAD 8 #define ELFMAG0 0x7f /* EI_MAG */ #define ELFMAG1 'E' #define ELFMAG2 'L' #define ELFMAG3 'F' #define ELFMAG "\177ELF" #define SELFMAG 4 #define ELFCLASSNONE 0 /* EI_CLASS */ #define ELFCLASS32 1 #define ELFCLASS64 2 #define ELFCLASSNUM 3 #define ELFDATANONE 0 /* e_ident[EI_DATA] */ #define ELFDATA2LSB 1 #define ELFDATA2MSB 2 #define EV_NONE 0 /* e_version, EI_VERSION */ #define EV_CURRENT 1 #define EV_NUM 2 #define ELFOSABI_NONE 0 #define ELFOSABI_LINUX 3 #ifndef ELF_OSABI #define ELF_OSABI ELFOSABI_NONE #endif /* * Notes used in ET_CORE. Architectures export some of the arch register sets * using the corresponding note types via the PTRACE_GETREGSET and * PTRACE_SETREGSET requests. */ #define NT_PRSTATUS 1 #define NT_PRFPREG 2 #define NT_PRPSINFO 3 #define NT_TASKSTRUCT 4 #define NT_AUXV 6 /* * Note to userspace developers: size of NT_SIGINFO note may increase * in the future to accomodate more fields, don't assume it is fixed! */ #define NT_SIGINFO 0x53494749 #define NT_FILE 0x46494c45 #define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ #define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ #define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ #define NT_PPC_TAR 0x103 /* Target Address Register */ #define NT_PPC_PPR 0x104 /* Program Priority Register */ #define NT_PPC_DSCR 0x105 /* Data Stream Control Register */ #define NT_PPC_EBB 0x106 /* Event Based Branch Registers */ #define NT_PPC_PMU 0x107 /* Performance Monitor Registers */ #define NT_PPC_TM_CGPR 0x108 /* TM checkpointed GPR Registers */ #define NT_PPC_TM_CFPR 0x109 /* TM checkpointed FPR Registers */ #define NT_PPC_TM_CVMX 0x10a /* TM checkpointed VMX Registers */ #define NT_PPC_TM_CVSX 0x10b /* TM checkpointed VSX Registers */ #define NT_PPC_TM_SPR 0x10c /* TM Special Purpose Registers */ #define NT_PPC_TM_CTAR 0x10d /* TM checkpointed Target Address Register */ #define NT_PPC_TM_CPPR 0x10e /* TM checkpointed Program Priority Register */ #define NT_PPC_TM_CDSCR 0x10f /* TM checkpointed Data Stream Control Register */ #define NT_PPC_PKEY 0x110 /* Memory Protection Keys registers */ #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ #define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */ #define NT_S390_TIMER 0x301 /* s390 timer register */ #define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */ #define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */ #define NT_S390_CTRS 0x304 /* s390 control registers */ #define NT_S390_PREFIX 0x305 /* s390 prefix register */ #define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */ #define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */ #define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */ #define NT_S390_VXRS_LOW 0x309 /* s390 vector registers 0-15 upper half */ #define NT_S390_VXRS_HIGH 0x30a /* s390 vector registers 16-31 */ #define NT_S390_GS_CB 0x30b /* s390 guarded storage registers */ #define NT_S390_GS_BC 0x30c /* s390 guarded storage broadcast control block */ #define NT_S390_RI_CB 0x30d /* s390 runtime instrumentation */ #define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */ #define NT_ARM_TLS 0x401 /* ARM TLS register */ #define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */ #define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */ #define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */ #define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension registers */ #define NT_ARC_V2 0x600 /* ARCv2 accumulator/extra registers */ #define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note */ #define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers */ #define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode */ /* Note header in a PT_NOTE section */ typedef struct elf32_note { Elf32_Word n_namesz; /* Name size */ Elf32_Word n_descsz; /* Content size */ Elf32_Word n_type; /* Content type */ } Elf32_Nhdr; /* Note header in a PT_NOTE section */ typedef struct elf64_note { Elf64_Word n_namesz; /* Name size */ Elf64_Word n_descsz; /* Content size */ Elf64_Word n_type; /* Content type */ } Elf64_Nhdr; #endif /* _LINUX_ELF_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/capability.h����������������������������������������������������������������������������������0000644�����������������00000027005�14763166027�0010215 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * This is <linux/capability.h> * * Andrew G. Morgan <morgan@kernel.org> * Alexander Kjeldaas <astor@guardian.no> * with help from Aleph1, Roland Buresund and Andrew Main. * * See here for the libcap library ("POSIX draft" compliance): * * ftp://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/ */ #ifndef _LINUX_CAPABILITY_H #define _LINUX_CAPABILITY_H #include <linux/types.h> /* User-level do most of the mapping between kernel and user capabilities based on the version tag given by the kernel. The kernel might be somewhat backwards compatible, but don't bet on it. */ /* Note, cap_t, is defined by POSIX (draft) to be an "opaque" pointer to a set of three capability sets. The transposition of 3*the following structure to such a composite is better handled in a user library since the draft standard requires the use of malloc/free etc.. */ #define _LINUX_CAPABILITY_VERSION_1 0x19980330 #define _LINUX_CAPABILITY_U32S_1 1 #define _LINUX_CAPABILITY_VERSION_2 0x20071026 /* deprecated - use v3 */ #define _LINUX_CAPABILITY_U32S_2 2 #define _LINUX_CAPABILITY_VERSION_3 0x20080522 #define _LINUX_CAPABILITY_U32S_3 2 typedef struct __user_cap_header_struct { __u32 version; int pid; } *cap_user_header_t; typedef struct __user_cap_data_struct { __u32 effective; __u32 permitted; __u32 inheritable; } *cap_user_data_t; #define VFS_CAP_REVISION_MASK 0xFF000000 #define VFS_CAP_REVISION_SHIFT 24 #define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK #define VFS_CAP_FLAGS_EFFECTIVE 0x000001 #define VFS_CAP_REVISION_1 0x01000000 #define VFS_CAP_U32_1 1 #define XATTR_CAPS_SZ_1 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_1)) #define VFS_CAP_REVISION_2 0x02000000 #define VFS_CAP_U32_2 2 #define XATTR_CAPS_SZ_2 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_2)) #define VFS_CAP_REVISION_3 0x03000000 #define VFS_CAP_U32_3 2 #define XATTR_CAPS_SZ_3 (sizeof(__le32)*(2 + 2*VFS_CAP_U32_3)) #define XATTR_CAPS_SZ XATTR_CAPS_SZ_3 #define VFS_CAP_U32 VFS_CAP_U32_3 #define VFS_CAP_REVISION VFS_CAP_REVISION_3 struct vfs_cap_data { __le32 magic_etc; /* Little endian */ struct { __le32 permitted; /* Little endian */ __le32 inheritable; /* Little endian */ } data[VFS_CAP_U32]; }; /* * same as vfs_cap_data but with a rootid at the end */ struct vfs_ns_cap_data { __le32 magic_etc; struct { __le32 permitted; /* Little endian */ __le32 inheritable; /* Little endian */ } data[VFS_CAP_U32]; __le32 rootid; }; /* * Backwardly compatible definition for source code - trapped in a * 32-bit world. If you find you need this, please consider using * libcap to untrap yourself... */ #define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_1 #define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_1 /** ** POSIX-draft defined capabilities. **/ /* In a system with the [_POSIX_CHOWN_RESTRICTED] option defined, this overrides the restriction of changing file ownership and group ownership. */ #define CAP_CHOWN 0 /* Override all DAC access, including ACL execute access if [_POSIX_ACL] is defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */ #define CAP_DAC_OVERRIDE 1 /* Overrides all DAC restrictions regarding read and search on files and directories, including ACL restrictions if [_POSIX_ACL] is defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */ #define CAP_DAC_READ_SEARCH 2 /* Overrides all restrictions about allowed operations on files, where file owner ID must be equal to the user ID, except where CAP_FSETID is applicable. It doesn't override MAC and DAC restrictions. */ #define CAP_FOWNER 3 /* Overrides the following restrictions that the effective user ID shall match the file owner ID when setting the S_ISUID and S_ISGID bits on that file; that the effective group ID (or one of the supplementary group IDs) shall match the file owner ID when setting the S_ISGID bit on that file; that the S_ISUID and S_ISGID bits are cleared on successful return from chown(2) (not implemented). */ #define CAP_FSETID 4 /* Overrides the restriction that the real or effective user ID of a process sending a signal must match the real or effective user ID of the process receiving the signal. */ #define CAP_KILL 5 /* Allows setgid(2) manipulation */ /* Allows setgroups(2) */ /* Allows forged gids on socket credentials passing. */ #define CAP_SETGID 6 /* Allows set*uid(2) manipulation (including fsuid). */ /* Allows forged pids on socket credentials passing. */ #define CAP_SETUID 7 /** ** Linux-specific capabilities **/ /* Without VFS support for capabilities: * Transfer any capability in your permitted set to any pid, * remove any capability in your permitted set from any pid * With VFS support for capabilities (neither of above, but) * Add any capability from current's capability bounding set * to the current process' inheritable set * Allow taking bits out of capability bounding set * Allow modification of the securebits for a process */ #define CAP_SETPCAP 8 /* Allow modification of S_IMMUTABLE and S_APPEND file attributes */ #define CAP_LINUX_IMMUTABLE 9 /* Allows binding to TCP/UDP sockets below 1024 */ /* Allows binding to ATM VCIs below 32 */ #define CAP_NET_BIND_SERVICE 10 /* Allow broadcasting, listen to multicast */ #define CAP_NET_BROADCAST 11 /* Allow interface configuration */ /* Allow administration of IP firewall, masquerading and accounting */ /* Allow setting debug option on sockets */ /* Allow modification of routing tables */ /* Allow setting arbitrary process / process group ownership on sockets */ /* Allow binding to any address for transparent proxying (also via NET_RAW) */ /* Allow setting TOS (type of service) */ /* Allow setting promiscuous mode */ /* Allow clearing driver statistics */ /* Allow multicasting */ /* Allow read/write of device-specific registers */ /* Allow activation of ATM control sockets */ #define CAP_NET_ADMIN 12 /* Allow use of RAW sockets */ /* Allow use of PACKET sockets */ /* Allow binding to any address for transparent proxying (also via NET_ADMIN) */ #define CAP_NET_RAW 13 /* Allow locking of shared memory segments */ /* Allow mlock and mlockall (which doesn't really have anything to do with IPC) */ #define CAP_IPC_LOCK 14 /* Override IPC ownership checks */ #define CAP_IPC_OWNER 15 /* Insert and remove kernel modules - modify kernel without limit */ #define CAP_SYS_MODULE 16 /* Allow ioperm/iopl access */ /* Allow sending USB messages to any device via /dev/bus/usb */ #define CAP_SYS_RAWIO 17 /* Allow use of chroot() */ #define CAP_SYS_CHROOT 18 /* Allow ptrace() of any process */ #define CAP_SYS_PTRACE 19 /* Allow configuration of process accounting */ #define CAP_SYS_PACCT 20 /* Allow configuration of the secure attention key */ /* Allow administration of the random device */ /* Allow examination and configuration of disk quotas */ /* Allow setting the domainname */ /* Allow setting the hostname */ /* Allow calling bdflush() */ /* Allow mount() and umount(), setting up new smb connection */ /* Allow some autofs root ioctls */ /* Allow nfsservctl */ /* Allow VM86_REQUEST_IRQ */ /* Allow to read/write pci config on alpha */ /* Allow irix_prctl on mips (setstacksize) */ /* Allow flushing all cache on m68k (sys_cacheflush) */ /* Allow removing semaphores */ /* Used instead of CAP_CHOWN to "chown" IPC message queues, semaphores and shared memory */ /* Allow locking/unlocking of shared memory segment */ /* Allow turning swap on/off */ /* Allow forged pids on socket credentials passing */ /* Allow setting readahead and flushing buffers on block devices */ /* Allow setting geometry in floppy driver */ /* Allow turning DMA on/off in xd driver */ /* Allow administration of md devices (mostly the above, but some extra ioctls) */ /* Allow tuning the ide driver */ /* Allow access to the nvram device */ /* Allow administration of apm_bios, serial and bttv (TV) device */ /* Allow manufacturer commands in isdn CAPI support driver */ /* Allow reading non-standardized portions of pci configuration space */ /* Allow DDI debug ioctl on sbpcd driver */ /* Allow setting up serial ports */ /* Allow sending raw qic-117 commands */ /* Allow enabling/disabling tagged queuing on SCSI controllers and sending arbitrary SCSI commands */ /* Allow setting encryption key on loopback filesystem */ /* Allow setting zone reclaim policy */ #define CAP_SYS_ADMIN 21 /* Allow use of reboot() */ #define CAP_SYS_BOOT 22 /* Allow raising priority and setting priority on other (different UID) processes */ /* Allow use of FIFO and round-robin (realtime) scheduling on own processes and setting the scheduling algorithm used by another process. */ /* Allow setting cpu affinity on other processes */ #define CAP_SYS_NICE 23 /* Override resource limits. Set resource limits. */ /* Override quota limits. */ /* Override reserved space on ext2 filesystem */ /* Modify data journaling mode on ext3 filesystem (uses journaling resources) */ /* NOTE: ext2 honors fsuid when checking for resource overrides, so you can override using fsuid too */ /* Override size restrictions on IPC message queues */ /* Allow more than 64hz interrupts from the real-time clock */ /* Override max number of consoles on console allocation */ /* Override max number of keymaps */ #define CAP_SYS_RESOURCE 24 /* Allow manipulation of system clock */ /* Allow irix_stime on mips */ /* Allow setting the real-time clock */ #define CAP_SYS_TIME 25 /* Allow configuration of tty devices */ /* Allow vhangup() of tty */ #define CAP_SYS_TTY_CONFIG 26 /* Allow the privileged aspects of mknod() */ #define CAP_MKNOD 27 /* Allow taking of leases on files */ #define CAP_LEASE 28 /* Allow writing the audit log via unicast netlink socket */ #define CAP_AUDIT_WRITE 29 /* Allow configuration of audit via unicast netlink socket */ #define CAP_AUDIT_CONTROL 30 #define CAP_SETFCAP 31 /* Override MAC access. The base kernel enforces no MAC policy. An LSM may enforce a MAC policy, and if it does and it chooses to implement capability based overrides of that policy, this is the capability it should use to do so. */ #define CAP_MAC_OVERRIDE 32 /* Allow MAC configuration or state changes. The base kernel requires no MAC configuration. An LSM may enforce a MAC policy, and if it does and it chooses to implement capability based checks on modifications to that policy or the data required to maintain it, this is the capability it should use to do so. */ #define CAP_MAC_ADMIN 33 /* Allow configuring the kernel's syslog (printk behaviour) */ #define CAP_SYSLOG 34 /* Allow triggering something that will wake the system */ #define CAP_WAKE_ALARM 35 /* Allow preventing system suspends */ #define CAP_BLOCK_SUSPEND 36 /* Allow reading the audit log via multicast netlink socket */ #define CAP_AUDIT_READ 37 #define CAP_LAST_CAP CAP_AUDIT_READ #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP) /* * Bit location of each capability (used by user-space library and kernel) */ #define CAP_TO_INDEX(x) ((x) >> 5) /* 1 << 5 == bits in __u32 */ #define CAP_TO_MASK(x) (1U << ((x) & 31)) /* mask for indexed __u32 */ #endif /* _LINUX_CAPABILITY_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/vm_sockets_diag.h�����������������������������������������������������������������������������0000644�����������������00000001703�14763166027�0011232 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* AF_VSOCK sock_diag(7) interface for querying open sockets */ #ifndef __VM_SOCKETS_DIAG_H__ #define __VM_SOCKETS_DIAG_H__ #include <linux/types.h> /* Request */ struct vsock_diag_req { __u8 sdiag_family; /* must be AF_VSOCK */ __u8 sdiag_protocol; /* must be 0 */ __u16 pad; /* must be 0 */ __u32 vdiag_states; /* query bitmap (e.g. 1 << TCP_LISTEN) */ __u32 vdiag_ino; /* must be 0 (reserved) */ __u32 vdiag_show; /* must be 0 (reserved) */ __u32 vdiag_cookie[2]; }; /* Response */ struct vsock_diag_msg { __u8 vdiag_family; /* AF_VSOCK */ __u8 vdiag_type; /* SOCK_STREAM or SOCK_DGRAM */ __u8 vdiag_state; /* sk_state (e.g. TCP_LISTEN) */ __u8 vdiag_shutdown; /* local RCV_SHUTDOWN | SEND_SHUTDOWN */ __u32 vdiag_src_cid; __u32 vdiag_src_port; __u32 vdiag_dst_cid; __u32 vdiag_dst_port; __u32 vdiag_ino; __u32 vdiag_cookie[2]; }; #endif /* __VM_SOCKETS_DIAG_H__ */ �������������������������������������������������������������linux/msg.h�����������������������������������������������������������������������������������������0000644�����������������00000006456�14763166027�0006671 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_MSG_H #define _LINUX_MSG_H #include <linux/ipc.h> /* ipcs ctl commands */ #define MSG_STAT 11 #define MSG_INFO 12 #define MSG_STAT_ANY 13 /* msgrcv options */ #define MSG_NOERROR 010000 /* no error if message is too big */ #define MSG_EXCEPT 020000 /* recv any msg except of specified type.*/ #define MSG_COPY 040000 /* copy (not remove) all queue messages */ /* Obsolete, used only for backwards compatibility and libc5 compiles */ struct msqid_ds { struct ipc_perm msg_perm; struct msg *msg_first; /* first message on queue,unused */ struct msg *msg_last; /* last message in queue,unused */ __kernel_time_t msg_stime; /* last msgsnd time */ __kernel_time_t msg_rtime; /* last msgrcv time */ __kernel_time_t msg_ctime; /* last change time */ unsigned long msg_lcbytes; /* Reuse junk fields for 32 bit */ unsigned long msg_lqbytes; /* ditto */ unsigned short msg_cbytes; /* current number of bytes on queue */ unsigned short msg_qnum; /* number of messages in queue */ unsigned short msg_qbytes; /* max number of bytes on queue */ __kernel_ipc_pid_t msg_lspid; /* pid of last msgsnd */ __kernel_ipc_pid_t msg_lrpid; /* last receive pid */ }; /* Include the definition of msqid64_ds */ #include <asm/msgbuf.h> /* message buffer for msgsnd and msgrcv calls */ struct msgbuf { __kernel_long_t mtype; /* type of message */ char mtext[1]; /* message text */ }; /* buffer for msgctl calls IPC_INFO, MSG_INFO */ struct msginfo { int msgpool; int msgmap; int msgmax; int msgmnb; int msgmni; int msgssz; int msgtql; unsigned short msgseg; }; /* * MSGMNI, MSGMAX and MSGMNB are default values which can be * modified by sysctl. * * MSGMNI is the upper limit for the number of messages queues per * namespace. * It has been chosen to be as large possible without facilitating * scenarios where userspace causes overflows when adjusting the limits via * operations of the form retrieve current limit; add X; update limit". * * MSGMNB is the default size of a new message queue. Non-root tasks can * decrease the size with msgctl(IPC_SET), root tasks * (actually: CAP_SYS_RESOURCE) can both increase and decrease the queue * size. The optimal value is application dependent. * 16384 is used because it was always used (since 0.99.10) * * MAXMAX is the maximum size of an individual message, it's a global * (per-namespace) limit that applies for all message queues. * It's set to 1/2 of MSGMNB, to ensure that at least two messages fit into * the queue. This is also an arbitrary choice (since 2.6.0). */ #define MSGMNI 32000 /* <= IPCMNI */ /* max # of msg queue identifiers */ #define MSGMAX 8192 /* <= INT_MAX */ /* max size of message (bytes) */ #define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */ /* unused */ #define MSGPOOL (MSGMNI * MSGMNB / 1024) /* size in kbytes of message pool */ #define MSGTQL MSGMNB /* number of system message headers */ #define MSGMAP MSGMNB /* number of entries in message map */ #define MSGSSZ 16 /* message segment size */ #define __MSGSEG ((MSGPOOL * 1024) / MSGSSZ) /* max no. of segments */ #define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff) #endif /* _LINUX_MSG_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/qnx4_fs.h�������������������������������������������������������������������������������������0000644�����������������00000004430�14763166027�0007453 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Name : qnx4_fs.h * Author : Richard Frowijn * Function : qnx4 global filesystem definitions * History : 23-03-1998 created */ #ifndef _LINUX_QNX4_FS_H #define _LINUX_QNX4_FS_H #include <linux/types.h> #include <linux/qnxtypes.h> #include <linux/magic.h> #define QNX4_ROOT_INO 1 #define QNX4_MAX_XTNTS_PER_XBLK 60 /* for di_status */ #define QNX4_FILE_USED 0x01 #define QNX4_FILE_MODIFIED 0x02 #define QNX4_FILE_BUSY 0x04 #define QNX4_FILE_LINK 0x08 #define QNX4_FILE_INODE 0x10 #define QNX4_FILE_FSYSCLEAN 0x20 #define QNX4_I_MAP_SLOTS 8 #define QNX4_Z_MAP_SLOTS 64 #define QNX4_VALID_FS 0x0001 /* Clean fs. */ #define QNX4_ERROR_FS 0x0002 /* fs has errors. */ #define QNX4_BLOCK_SIZE 0x200 /* blocksize of 512 bytes */ #define QNX4_BLOCK_SIZE_BITS 9 /* blocksize shift */ #define QNX4_DIR_ENTRY_SIZE 0x040 /* dir entry size of 64 bytes */ #define QNX4_DIR_ENTRY_SIZE_BITS 6 /* dir entry size shift */ #define QNX4_XBLK_ENTRY_SIZE 0x200 /* xblk entry size */ #define QNX4_INODES_PER_BLOCK 0x08 /* 512 / 64 */ /* for filenames */ #define QNX4_SHORT_NAME_MAX 16 #define QNX4_NAME_MAX 48 /* * This is the original qnx4 inode layout on disk. */ struct qnx4_inode_entry { char di_fname[QNX4_SHORT_NAME_MAX]; qnx4_off_t di_size; qnx4_xtnt_t di_first_xtnt; __le32 di_xblk; __le32 di_ftime; __le32 di_mtime; __le32 di_atime; __le32 di_ctime; qnx4_nxtnt_t di_num_xtnts; qnx4_mode_t di_mode; qnx4_muid_t di_uid; qnx4_mgid_t di_gid; qnx4_nlink_t di_nlink; __u8 di_zero[4]; qnx4_ftype_t di_type; __u8 di_status; }; struct qnx4_link_info { char dl_fname[QNX4_NAME_MAX]; __le32 dl_inode_blk; __u8 dl_inode_ndx; __u8 dl_spare[10]; __u8 dl_status; }; struct qnx4_xblk { __le32 xblk_next_xblk; __le32 xblk_prev_xblk; __u8 xblk_num_xtnts; __u8 xblk_spare[3]; __le32 xblk_num_blocks; qnx4_xtnt_t xblk_xtnts[QNX4_MAX_XTNTS_PER_XBLK]; char xblk_signature[8]; qnx4_xtnt_t xblk_first_xtnt; }; struct qnx4_super_block { struct qnx4_inode_entry RootDir; struct qnx4_inode_entry Inode; struct qnx4_inode_entry Boot; struct qnx4_inode_entry AltBoot; }; #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/spi/spidev.h����������������������������������������������������������������������������������0000644�����������������00000011724�14763166027�0010162 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * include/linux/spi/spidev.h * * Copyright (C) 2006 SWAPP * Andrea Paterniani <a.paterniani@swapp-eng.it> * * 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. */ #ifndef SPIDEV_H #define SPIDEV_H #include <linux/types.h> #include <linux/ioctl.h> /* User space versions of kernel symbols for SPI clocking modes, * matching <linux/spi/spi.h> */ #define SPI_CPHA 0x01 #define SPI_CPOL 0x02 #define SPI_MODE_0 (0|0) #define SPI_MODE_1 (0|SPI_CPHA) #define SPI_MODE_2 (SPI_CPOL|0) #define SPI_MODE_3 (SPI_CPOL|SPI_CPHA) #define SPI_CS_HIGH 0x04 #define SPI_LSB_FIRST 0x08 #define SPI_3WIRE 0x10 #define SPI_LOOP 0x20 #define SPI_NO_CS 0x40 #define SPI_READY 0x80 #define SPI_TX_DUAL 0x100 #define SPI_TX_QUAD 0x200 #define SPI_RX_DUAL 0x400 #define SPI_RX_QUAD 0x800 /*---------------------------------------------------------------------------*/ /* IOCTL commands */ #define SPI_IOC_MAGIC 'k' /** * struct spi_ioc_transfer - describes a single SPI transfer * @tx_buf: Holds pointer to userspace buffer with transmit data, or null. * If no data is provided, zeroes are shifted out. * @rx_buf: Holds pointer to userspace buffer for receive data, or null. * @len: Length of tx and rx buffers, in bytes. * @speed_hz: Temporary override of the device's bitrate. * @bits_per_word: Temporary override of the device's wordsize. * @delay_usecs: If nonzero, how long to delay after the last bit transfer * before optionally deselecting the device before the next transfer. * @cs_change: True to deselect device before starting the next transfer. * * This structure is mapped directly to the kernel spi_transfer structure; * the fields have the same meanings, except of course that the pointers * are in a different address space (and may be of different sizes in some * cases, such as 32-bit i386 userspace over a 64-bit x86_64 kernel). * Zero-initialize the structure, including currently unused fields, to * accommodate potential future updates. * * SPI_IOC_MESSAGE gives userspace the equivalent of kernel spi_sync(). * Pass it an array of related transfers, they'll execute together. * Each transfer may be half duplex (either direction) or full duplex. * * struct spi_ioc_transfer mesg[4]; * ... * status = ioctl(fd, SPI_IOC_MESSAGE(4), mesg); * * So for example one transfer might send a nine bit command (right aligned * in a 16-bit word), the next could read a block of 8-bit data before * terminating that command by temporarily deselecting the chip; the next * could send a different nine bit command (re-selecting the chip), and the * last transfer might write some register values. */ struct spi_ioc_transfer { __u64 tx_buf; __u64 rx_buf; __u32 len; __u32 speed_hz; __u16 delay_usecs; __u8 bits_per_word; __u8 cs_change; __u8 tx_nbits; __u8 rx_nbits; __u16 pad; /* If the contents of 'struct spi_ioc_transfer' ever change * incompatibly, then the ioctl number (currently 0) must change; * ioctls with constant size fields get a bit more in the way of * error checking than ones (like this) where that field varies. * * NOTE: struct layout is the same in 64bit and 32bit userspace. */ }; /* not all platforms use <asm-generic/ioctl.h> or _IOC_TYPECHECK() ... */ #define SPI_MSGSIZE(N) \ ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \ ? ((N)*(sizeof (struct spi_ioc_transfer))) : 0) #define SPI_IOC_MESSAGE(N) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(N)]) /* Read / Write of SPI mode (SPI_MODE_0..SPI_MODE_3) (limited to 8 bits) */ #define SPI_IOC_RD_MODE _IOR(SPI_IOC_MAGIC, 1, __u8) #define SPI_IOC_WR_MODE _IOW(SPI_IOC_MAGIC, 1, __u8) /* Read / Write SPI bit justification */ #define SPI_IOC_RD_LSB_FIRST _IOR(SPI_IOC_MAGIC, 2, __u8) #define SPI_IOC_WR_LSB_FIRST _IOW(SPI_IOC_MAGIC, 2, __u8) /* Read / Write SPI device word length (1..N) */ #define SPI_IOC_RD_BITS_PER_WORD _IOR(SPI_IOC_MAGIC, 3, __u8) #define SPI_IOC_WR_BITS_PER_WORD _IOW(SPI_IOC_MAGIC, 3, __u8) /* Read / Write SPI device default max speed hz */ #define SPI_IOC_RD_MAX_SPEED_HZ _IOR(SPI_IOC_MAGIC, 4, __u32) #define SPI_IOC_WR_MAX_SPEED_HZ _IOW(SPI_IOC_MAGIC, 4, __u32) /* Read / Write of the SPI mode field */ #define SPI_IOC_RD_MODE32 _IOR(SPI_IOC_MAGIC, 5, __u32) #define SPI_IOC_WR_MODE32 _IOW(SPI_IOC_MAGIC, 5, __u32) #endif /* SPIDEV_H */ ��������������������������������������������linux/can.h�����������������������������������������������������������������������������������������0000644�����������������00000017316�14763166027�0006641 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * linux/can.h * * Definitions for CAN network layer (socket addr / CAN frame / CAN filter) * * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> * Urs Thuermann <urs.thuermann@volkswagen.de> * Copyright (c) 2002-2007 Volkswagen Group Electronic Research * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Volkswagen nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * Alternatively, provided that this notice is retained in full, this * software may be distributed under the terms of the GNU General * Public License ("GPL") version 2, in which case the provisions of the * GPL apply INSTEAD OF those given above. * * The provided data structures and external interfaces from this code * are not restricted to be used by modules with a GPL compatible license. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ #ifndef _CAN_H #define _CAN_H #include <linux/types.h> #include <linux/socket.h> /* controller area network (CAN) kernel definitions */ /* special address description flags for the CAN_ID */ #define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */ #define CAN_RTR_FLAG 0x40000000U /* remote transmission request */ #define CAN_ERR_FLAG 0x20000000U /* error message frame */ /* valid bits in CAN ID for frame formats */ #define CAN_SFF_MASK 0x000007FFU /* standard frame format (SFF) */ #define CAN_EFF_MASK 0x1FFFFFFFU /* extended frame format (EFF) */ #define CAN_ERR_MASK 0x1FFFFFFFU /* omit EFF, RTR, ERR flags */ /* * Controller Area Network Identifier structure * * bit 0-28 : CAN identifier (11/29 bit) * bit 29 : error message frame flag (0 = data frame, 1 = error message) * bit 30 : remote transmission request flag (1 = rtr frame) * bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit) */ typedef __u32 canid_t; #define CAN_SFF_ID_BITS 11 #define CAN_EFF_ID_BITS 29 /* * Controller Area Network Error Message Frame Mask structure * * bit 0-28 : error class mask (see include/uapi/linux/can/error.h) * bit 29-31 : set to zero */ typedef __u32 can_err_mask_t; /* CAN payload length and DLC definitions according to ISO 11898-1 */ #define CAN_MAX_DLC 8 #define CAN_MAX_DLEN 8 /* CAN FD payload length and DLC definitions according to ISO 11898-7 */ #define CANFD_MAX_DLC 15 #define CANFD_MAX_DLEN 64 /** * struct can_frame - basic CAN frame structure * @can_id: CAN ID of the frame and CAN_*_FLAG flags, see canid_t definition * @can_dlc: frame payload length in byte (0 .. 8) aka data length code * N.B. the DLC field from ISO 11898-1 Chapter 8.4.2.3 has a 1:1 * mapping of the 'data length code' to the real payload length * @__pad: padding * @__res0: reserved / padding * @__res1: reserved / padding * @data: CAN frame payload (up to 8 byte) */ struct can_frame { canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ __u8 can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */ __u8 __pad; /* padding */ __u8 __res0; /* reserved / padding */ __u8 __res1; /* reserved / padding */ __u8 data[CAN_MAX_DLEN] __attribute__((aligned(8))); }; /* * defined bits for canfd_frame.flags * * The use of struct canfd_frame implies the Extended Data Length (EDL) bit to * be set in the CAN frame bitstream on the wire. The EDL bit switch turns * the CAN controllers bitstream processor into the CAN FD mode which creates * two new options within the CAN FD frame specification: * * Bit Rate Switch - to indicate a second bitrate is/was used for the payload * Error State Indicator - represents the error state of the transmitting node * * As the CANFD_ESI bit is internally generated by the transmitting CAN * controller only the CANFD_BRS bit is relevant for real CAN controllers when * building a CAN FD frame for transmission. Setting the CANFD_ESI bit can make * sense for virtual CAN interfaces to test applications with echoed frames. */ #define CANFD_BRS 0x01 /* bit rate switch (second bitrate for payload data) */ #define CANFD_ESI 0x02 /* error state indicator of the transmitting node */ /** * struct canfd_frame - CAN flexible data rate frame structure * @can_id: CAN ID of the frame and CAN_*_FLAG flags, see canid_t definition * @len: frame payload length in byte (0 .. CANFD_MAX_DLEN) * @flags: additional flags for CAN FD * @__res0: reserved / padding * @__res1: reserved / padding * @data: CAN FD frame payload (up to CANFD_MAX_DLEN byte) */ struct canfd_frame { canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ __u8 len; /* frame payload length in byte */ __u8 flags; /* additional flags for CAN FD */ __u8 __res0; /* reserved / padding */ __u8 __res1; /* reserved / padding */ __u8 data[CANFD_MAX_DLEN] __attribute__((aligned(8))); }; #define CAN_MTU (sizeof(struct can_frame)) #define CANFD_MTU (sizeof(struct canfd_frame)) /* particular protocols of the protocol family PF_CAN */ #define CAN_RAW 1 /* RAW sockets */ #define CAN_BCM 2 /* Broadcast Manager */ #define CAN_TP16 3 /* VAG Transport Protocol v1.6 */ #define CAN_TP20 4 /* VAG Transport Protocol v2.0 */ #define CAN_MCNET 5 /* Bosch MCNet */ #define CAN_ISOTP 6 /* ISO 15765-2 Transport Protocol */ #define CAN_NPROTO 7 #define SOL_CAN_BASE 100 /** * struct sockaddr_can - the sockaddr structure for CAN sockets * @can_family: address family number AF_CAN. * @can_ifindex: CAN network interface index. * @can_addr: protocol specific address information */ struct sockaddr_can { __kernel_sa_family_t can_family; int can_ifindex; union { /* transport protocol class address information (e.g. ISOTP) */ struct { canid_t rx_id, tx_id; } tp; /* reserved for future CAN protocols address information */ } can_addr; }; /** * struct can_filter - CAN ID based filter in can_register(). * @can_id: relevant bits of CAN ID which are not masked out. * @can_mask: CAN mask (see description) * * Description: * A filter matches, when * * <received_can_id> & mask == can_id & mask * * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can * filter for error message frames (CAN_ERR_FLAG bit set in mask). */ struct can_filter { canid_t can_id; canid_t can_mask; }; #define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */ #define CAN_RAW_FILTER_MAX 512 /* maximum number of can_filter set via setsockopt() */ #endif /* !_UAPI_CAN_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/input.h���������������������������������������������������������������������������������������0000644�����������������00000037161�14763166027�0007237 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (c) 1999-2002 Vojtech Pavlik * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #ifndef _INPUT_H #define _INPUT_H #include <sys/time.h> #include <sys/ioctl.h> #include <sys/types.h> #include <linux/types.h> #include "input-event-codes.h" /* * The event structure itself * Note that __USE_TIME_BITS64 is defined by libc based on * application's request to use 64 bit time_t. */ struct input_event { #if (__BITS_PER_LONG != 32 || !defined(__USE_TIME_BITS64)) && !defined(__KERNEL__) struct timeval time; #define input_event_sec time.tv_sec #define input_event_usec time.tv_usec #else __kernel_ulong_t __sec; #if defined(__sparc__) && defined(__arch64__) unsigned int __usec; unsigned int __pad; #else __kernel_ulong_t __usec; #endif #define input_event_sec __sec #define input_event_usec __usec #endif __u16 type; __u16 code; __s32 value; }; /* * Protocol version. */ #define EV_VERSION 0x010001 /* * IOCTLs (0x00 - 0x7f) */ struct input_id { __u16 bustype; __u16 vendor; __u16 product; __u16 version; }; /** * struct input_absinfo - used by EVIOCGABS/EVIOCSABS ioctls * @value: latest reported value for the axis. * @minimum: specifies minimum value for the axis. * @maximum: specifies maximum value for the axis. * @fuzz: specifies fuzz value that is used to filter noise from * the event stream. * @flat: values that are within this value will be discarded by * joydev interface and reported as 0 instead. * @resolution: specifies resolution for the values reported for * the axis. * * Note that input core does not clamp reported values to the * [minimum, maximum] limits, such task is left to userspace. * * The default resolution for main axes (ABS_X, ABS_Y, ABS_Z) * is reported in units per millimeter (units/mm), resolution * for rotational axes (ABS_RX, ABS_RY, ABS_RZ) is reported * in units per radian. * When INPUT_PROP_ACCELEROMETER is set the resolution changes. * The main axes (ABS_X, ABS_Y, ABS_Z) are then reported in * in units per g (units/g) and in units per degree per second * (units/deg/s) for rotational axes (ABS_RX, ABS_RY, ABS_RZ). */ struct input_absinfo { __s32 value; __s32 minimum; __s32 maximum; __s32 fuzz; __s32 flat; __s32 resolution; }; /** * struct input_keymap_entry - used by EVIOCGKEYCODE/EVIOCSKEYCODE ioctls * @scancode: scancode represented in machine-endian form. * @len: length of the scancode that resides in @scancode buffer. * @index: index in the keymap, may be used instead of scancode * @flags: allows to specify how kernel should handle the request. For * example, setting INPUT_KEYMAP_BY_INDEX flag indicates that kernel * should perform lookup in keymap by @index instead of @scancode * @keycode: key code assigned to this scancode * * The structure is used to retrieve and modify keymap data. Users have * option of performing lookup either by @scancode itself or by @index * in keymap entry. EVIOCGKEYCODE will also return scancode or index * (depending on which element was used to perform lookup). */ struct input_keymap_entry { #define INPUT_KEYMAP_BY_INDEX (1 << 0) __u8 flags; __u8 len; __u16 index; __u32 keycode; __u8 scancode[32]; }; struct input_mask { __u32 type; __u32 codes_size; __u64 codes_ptr; }; #define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ #define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ #define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */ #define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */ #define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2]) /* get keycode */ #define EVIOCGKEYCODE_V2 _IOR('E', 0x04, struct input_keymap_entry) #define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2]) /* set keycode */ #define EVIOCSKEYCODE_V2 _IOW('E', 0x04, struct input_keymap_entry) #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ #define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ #define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */ #define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */ /** * EVIOCGMTSLOTS(len) - get MT slot values * @len: size of the data buffer in bytes * * The ioctl buffer argument should be binary equivalent to * * struct input_mt_request_layout { * __u32 code; * __s32 values[num_slots]; * }; * * where num_slots is the (arbitrary) number of MT slots to extract. * * The ioctl size argument (len) is the size of the buffer, which * should satisfy len = (num_slots + 1) * sizeof(__s32). If len is * too small to fit all available slots, the first num_slots are * returned. * * Before the call, code is set to the wanted ABS_MT event type. On * return, values[] is filled with the slot values for the specified * ABS_MT code. * * If the request code is not an ABS_MT value, -EINVAL is returned. */ #define EVIOCGMTSLOTS(len) _IOC(_IOC_READ, 'E', 0x0a, len) #define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */ #define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */ #define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */ #define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */ #define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + (ev), len) /* get event bits */ #define EVIOCGABS(abs) _IOR('E', 0x40 + (abs), struct input_absinfo) /* get abs value/limits */ #define EVIOCSABS(abs) _IOW('E', 0xc0 + (abs), struct input_absinfo) /* set abs value/limits */ #define EVIOCSFF _IOW('E', 0x80, struct ff_effect) /* send a force effect to a force feedback device */ #define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */ #define EVIOCGEFFECTS _IOR('E', 0x84, int) /* Report number of effects playable at the same time */ #define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ #define EVIOCREVOKE _IOW('E', 0x91, int) /* Revoke device access */ /** * EVIOCGMASK - Retrieve current event mask * * This ioctl allows user to retrieve the current event mask for specific * event type. The argument must be of type "struct input_mask" and * specifies the event type to query, the address of the receive buffer and * the size of the receive buffer. * * The event mask is a per-client mask that specifies which events are * forwarded to the client. Each event code is represented by a single bit * in the event mask. If the bit is set, the event is passed to the client * normally. Otherwise, the event is filtered and will never be queued on * the client's receive buffer. * * Event masks do not affect global state of the input device. They only * affect the file descriptor they are applied to. * * The default event mask for a client has all bits set, i.e. all events * are forwarded to the client. If the kernel is queried for an unknown * event type or if the receive buffer is larger than the number of * event codes known to the kernel, the kernel returns all zeroes for those * codes. * * At maximum, codes_size bytes are copied. * * This ioctl may fail with ENODEV in case the file is revoked, EFAULT * if the receive-buffer points to invalid memory, or EINVAL if the kernel * does not implement the ioctl. */ #define EVIOCGMASK _IOR('E', 0x92, struct input_mask) /* Get event-masks */ /** * EVIOCSMASK - Set event mask * * This ioctl is the counterpart to EVIOCGMASK. Instead of receiving the * current event mask, this changes the client's event mask for a specific * type. See EVIOCGMASK for a description of event-masks and the * argument-type. * * This ioctl provides full forward compatibility. If the passed event type * is unknown to the kernel, or if the number of event codes specified in * the mask is bigger than what is known to the kernel, the ioctl is still * accepted and applied. However, any unknown codes are left untouched and * stay cleared. That means, the kernel always filters unknown codes * regardless of what the client requests. If the new mask doesn't cover * all known event-codes, all remaining codes are automatically cleared and * thus filtered. * * This ioctl may fail with ENODEV in case the file is revoked. EFAULT is * returned if the receive-buffer points to invalid memory. EINVAL is returned * if the kernel does not implement the ioctl. */ #define EVIOCSMASK _IOW('E', 0x93, struct input_mask) /* Set event-masks */ #define EVIOCSCLOCKID _IOW('E', 0xa0, int) /* Set clockid to be used for timestamps */ /* * IDs. */ #define ID_BUS 0 #define ID_VENDOR 1 #define ID_PRODUCT 2 #define ID_VERSION 3 #define BUS_PCI 0x01 #define BUS_ISAPNP 0x02 #define BUS_USB 0x03 #define BUS_HIL 0x04 #define BUS_BLUETOOTH 0x05 #define BUS_VIRTUAL 0x06 #define BUS_ISA 0x10 #define BUS_I8042 0x11 #define BUS_XTKBD 0x12 #define BUS_RS232 0x13 #define BUS_GAMEPORT 0x14 #define BUS_PARPORT 0x15 #define BUS_AMIGA 0x16 #define BUS_ADB 0x17 #define BUS_I2C 0x18 #define BUS_HOST 0x19 #define BUS_GSC 0x1A #define BUS_ATARI 0x1B #define BUS_SPI 0x1C #define BUS_RMI 0x1D #define BUS_CEC 0x1E #define BUS_INTEL_ISHTP 0x1F /* * MT_TOOL types */ #define MT_TOOL_FINGER 0x00 #define MT_TOOL_PEN 0x01 #define MT_TOOL_PALM 0x02 #define MT_TOOL_DIAL 0x0a #define MT_TOOL_MAX 0x0f /* * Values describing the status of a force-feedback effect */ #define FF_STATUS_STOPPED 0x00 #define FF_STATUS_PLAYING 0x01 #define FF_STATUS_MAX 0x01 /* * Structures used in ioctls to upload effects to a device * They are pieces of a bigger structure (called ff_effect) */ /* * All duration values are expressed in ms. Values above 32767 ms (0x7fff) * should not be used and have unspecified results. */ /** * struct ff_replay - defines scheduling of the force-feedback effect * @length: duration of the effect * @delay: delay before effect should start playing */ struct ff_replay { __u16 length; __u16 delay; }; /** * struct ff_trigger - defines what triggers the force-feedback effect * @button: number of the button triggering the effect * @interval: controls how soon the effect can be re-triggered */ struct ff_trigger { __u16 button; __u16 interval; }; /** * struct ff_envelope - generic force-feedback effect envelope * @attack_length: duration of the attack (ms) * @attack_level: level at the beginning of the attack * @fade_length: duration of fade (ms) * @fade_level: level at the end of fade * * The @attack_level and @fade_level are absolute values; when applying * envelope force-feedback core will convert to positive/negative * value based on polarity of the default level of the effect. * Valid range for the attack and fade levels is 0x0000 - 0x7fff */ struct ff_envelope { __u16 attack_length; __u16 attack_level; __u16 fade_length; __u16 fade_level; }; /** * struct ff_constant_effect - defines parameters of a constant force-feedback effect * @level: strength of the effect; may be negative * @envelope: envelope data */ struct ff_constant_effect { __s16 level; struct ff_envelope envelope; }; /** * struct ff_ramp_effect - defines parameters of a ramp force-feedback effect * @start_level: beginning strength of the effect; may be negative * @end_level: final strength of the effect; may be negative * @envelope: envelope data */ struct ff_ramp_effect { __s16 start_level; __s16 end_level; struct ff_envelope envelope; }; /** * struct ff_condition_effect - defines a spring or friction force-feedback effect * @right_saturation: maximum level when joystick moved all way to the right * @left_saturation: same for the left side * @right_coeff: controls how fast the force grows when the joystick moves * to the right * @left_coeff: same for the left side * @deadband: size of the dead zone, where no force is produced * @center: position of the dead zone */ struct ff_condition_effect { __u16 right_saturation; __u16 left_saturation; __s16 right_coeff; __s16 left_coeff; __u16 deadband; __s16 center; }; /** * struct ff_periodic_effect - defines parameters of a periodic force-feedback effect * @waveform: kind of the effect (wave) * @period: period of the wave (ms) * @magnitude: peak value * @offset: mean value of the wave (roughly) * @phase: 'horizontal' shift * @envelope: envelope data * @custom_len: number of samples (FF_CUSTOM only) * @custom_data: buffer of samples (FF_CUSTOM only) * * Known waveforms - FF_SQUARE, FF_TRIANGLE, FF_SINE, FF_SAW_UP, * FF_SAW_DOWN, FF_CUSTOM. The exact syntax FF_CUSTOM is undefined * for the time being as no driver supports it yet. * * Note: the data pointed by custom_data is copied by the driver. * You can therefore dispose of the memory after the upload/update. */ struct ff_periodic_effect { __u16 waveform; __u16 period; __s16 magnitude; __s16 offset; __u16 phase; struct ff_envelope envelope; __u32 custom_len; __s16 *custom_data; }; /** * struct ff_rumble_effect - defines parameters of a periodic force-feedback effect * @strong_magnitude: magnitude of the heavy motor * @weak_magnitude: magnitude of the light one * * Some rumble pads have two motors of different weight. Strong_magnitude * represents the magnitude of the vibration generated by the heavy one. */ struct ff_rumble_effect { __u16 strong_magnitude; __u16 weak_magnitude; }; /** * struct ff_effect - defines force feedback effect * @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING, * FF_FRICTION, FF_DAMPER, FF_RUMBLE, FF_INERTIA, or FF_CUSTOM) * @id: an unique id assigned to an effect * @direction: direction of the effect * @trigger: trigger conditions (struct ff_trigger) * @replay: scheduling of the effect (struct ff_replay) * @u: effect-specific structure (one of ff_constant_effect, ff_ramp_effect, * ff_periodic_effect, ff_condition_effect, ff_rumble_effect) further * defining effect parameters * * This structure is sent through ioctl from the application to the driver. * To create a new effect application should set its @id to -1; the kernel * will return assigned @id which can later be used to update or delete * this effect. * * Direction of the effect is encoded as follows: * 0 deg -> 0x0000 (down) * 90 deg -> 0x4000 (left) * 180 deg -> 0x8000 (up) * 270 deg -> 0xC000 (right) */ struct ff_effect { __u16 type; __s16 id; __u16 direction; struct ff_trigger trigger; struct ff_replay replay; union { struct ff_constant_effect constant; struct ff_ramp_effect ramp; struct ff_periodic_effect periodic; struct ff_condition_effect condition[2]; /* One for each axis */ struct ff_rumble_effect rumble; } u; }; /* * Force feedback effect types */ #define FF_RUMBLE 0x50 #define FF_PERIODIC 0x51 #define FF_CONSTANT 0x52 #define FF_SPRING 0x53 #define FF_FRICTION 0x54 #define FF_DAMPER 0x55 #define FF_INERTIA 0x56 #define FF_RAMP 0x57 #define FF_EFFECT_MIN FF_RUMBLE #define FF_EFFECT_MAX FF_RAMP /* * Force feedback periodic effect types */ #define FF_SQUARE 0x58 #define FF_TRIANGLE 0x59 #define FF_SINE 0x5a #define FF_SAW_UP 0x5b #define FF_SAW_DOWN 0x5c #define FF_CUSTOM 0x5d #define FF_WAVEFORM_MIN FF_SQUARE #define FF_WAVEFORM_MAX FF_CUSTOM /* * Set ff device properties */ #define FF_GAIN 0x60 #define FF_AUTOCENTER 0x61 /* * ff->playback(effect_id = FF_GAIN) is the first effect_id to * cause a collision with another ff method, in this case ff->set_gain(). * Therefore the greatest safe value for effect_id is FF_GAIN - 1, * and thus the total number of effects should never exceed FF_GAIN. */ #define FF_MAX_EFFECTS FF_GAIN #define FF_MAX 0x7f #define FF_CNT (FF_MAX+1) #endif /* _INPUT_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/nilfs2_ondisk.h�������������������������������������������������������������������������������0000644�����������������00000043245�14763166027�0010644 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * nilfs2_ondisk.h - NILFS2 on-disk structures * * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. */ /* * linux/include/linux/ext2_fs.h * * Copyright (C) 1992, 1993, 1994, 1995 * Remy Card (card@masi.ibp.fr) * Laboratoire MASI - Institut Blaise Pascal * Universite Pierre et Marie Curie (Paris VI) * * from * * linux/include/linux/minix_fs.h * * Copyright (C) 1991, 1992 Linus Torvalds */ #ifndef _LINUX_NILFS2_ONDISK_H #define _LINUX_NILFS2_ONDISK_H #include <linux/types.h> #include <linux/magic.h> #include <asm/byteorder.h> #define NILFS_INODE_BMAP_SIZE 7 /** * struct nilfs_inode - structure of an inode on disk * @i_blocks: blocks count * @i_size: size in bytes * @i_ctime: creation time (seconds) * @i_mtime: modification time (seconds) * @i_ctime_nsec: creation time (nano seconds) * @i_mtime_nsec: modification time (nano seconds) * @i_uid: user id * @i_gid: group id * @i_mode: file mode * @i_links_count: links count * @i_flags: file flags * @i_bmap: block mapping * @i_xattr: extended attributes * @i_generation: file generation (for NFS) * @i_pad: padding */ struct nilfs_inode { __le64 i_blocks; __le64 i_size; __le64 i_ctime; __le64 i_mtime; __le32 i_ctime_nsec; __le32 i_mtime_nsec; __le32 i_uid; __le32 i_gid; __le16 i_mode; __le16 i_links_count; __le32 i_flags; __le64 i_bmap[NILFS_INODE_BMAP_SIZE]; #define i_device_code i_bmap[0] __le64 i_xattr; __le32 i_generation; __le32 i_pad; }; #define NILFS_MIN_INODE_SIZE 128 /** * struct nilfs_super_root - structure of super root * @sr_sum: check sum * @sr_bytes: byte count of the structure * @sr_flags: flags (reserved) * @sr_nongc_ctime: write time of the last segment not for cleaner operation * @sr_dat: DAT file inode * @sr_cpfile: checkpoint file inode * @sr_sufile: segment usage file inode */ struct nilfs_super_root { __le32 sr_sum; __le16 sr_bytes; __le16 sr_flags; __le64 sr_nongc_ctime; struct nilfs_inode sr_dat; struct nilfs_inode sr_cpfile; struct nilfs_inode sr_sufile; }; #define NILFS_SR_MDT_OFFSET(inode_size, i) \ ((unsigned long)&((struct nilfs_super_root *)0)->sr_dat + \ (inode_size) * (i)) #define NILFS_SR_DAT_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 0) #define NILFS_SR_CPFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 1) #define NILFS_SR_SUFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 2) #define NILFS_SR_BYTES(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 3) /* * Maximal mount counts */ #define NILFS_DFL_MAX_MNT_COUNT 50 /* 50 mounts */ /* * File system states (sbp->s_state, nilfs->ns_mount_state) */ #define NILFS_VALID_FS 0x0001 /* Unmounted cleanly */ #define NILFS_ERROR_FS 0x0002 /* Errors detected */ #define NILFS_RESIZE_FS 0x0004 /* Resize required */ /* * Mount flags (sbi->s_mount_opt) */ #define NILFS_MOUNT_ERROR_MODE 0x0070 /* Error mode mask */ #define NILFS_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */ #define NILFS_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */ #define NILFS_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */ #define NILFS_MOUNT_BARRIER 0x1000 /* Use block barriers */ #define NILFS_MOUNT_STRICT_ORDER 0x2000 /* * Apply strict in-order * semantics also for data */ #define NILFS_MOUNT_NORECOVERY 0x4000 /* * Disable write access during * mount-time recovery */ #define NILFS_MOUNT_DISCARD 0x8000 /* Issue DISCARD requests */ /** * struct nilfs_super_block - structure of super block on disk */ struct nilfs_super_block { /*00*/ __le32 s_rev_level; /* Revision level */ __le16 s_minor_rev_level; /* minor revision level */ __le16 s_magic; /* Magic signature */ __le16 s_bytes; /* * Bytes count of CRC calculation * for this structure. s_reserved * is excluded. */ __le16 s_flags; /* flags */ __le32 s_crc_seed; /* Seed value of CRC calculation */ /*10*/ __le32 s_sum; /* Check sum of super block */ __le32 s_log_block_size; /* * Block size represented as follows * blocksize = * 1 << (s_log_block_size + 10) */ __le64 s_nsegments; /* Number of segments in filesystem */ /*20*/ __le64 s_dev_size; /* block device size in bytes */ __le64 s_first_data_block; /* 1st seg disk block number */ /*30*/ __le32 s_blocks_per_segment; /* number of blocks per full segment */ __le32 s_r_segments_percentage; /* Reserved segments percentage */ __le64 s_last_cno; /* Last checkpoint number */ /*40*/ __le64 s_last_pseg; /* disk block addr pseg written last */ __le64 s_last_seq; /* seq. number of seg written last */ /*50*/ __le64 s_free_blocks_count; /* Free blocks count */ __le64 s_ctime; /* * Creation time (execution time of * newfs) */ /*60*/ __le64 s_mtime; /* Mount time */ __le64 s_wtime; /* Write time */ /*70*/ __le16 s_mnt_count; /* Mount count */ __le16 s_max_mnt_count; /* Maximal mount count */ __le16 s_state; /* File system state */ __le16 s_errors; /* Behaviour when detecting errors */ __le64 s_lastcheck; /* time of last check */ /*80*/ __le32 s_checkinterval; /* max. time between checks */ __le32 s_creator_os; /* OS */ __le16 s_def_resuid; /* Default uid for reserved blocks */ __le16 s_def_resgid; /* Default gid for reserved blocks */ __le32 s_first_ino; /* First non-reserved inode */ /*90*/ __le16 s_inode_size; /* Size of an inode */ __le16 s_dat_entry_size; /* Size of a dat entry */ __le16 s_checkpoint_size; /* Size of a checkpoint */ __le16 s_segment_usage_size; /* Size of a segment usage */ /*98*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */ /*A8*/ char s_volume_name[80]; /* volume name */ /*F8*/ __le32 s_c_interval; /* Commit interval of segment */ __le32 s_c_block_max; /* * Threshold of data amount for * the segment construction */ /*100*/ __le64 s_feature_compat; /* Compatible feature set */ __le64 s_feature_compat_ro; /* Read-only compatible feature set */ __le64 s_feature_incompat; /* Incompatible feature set */ __u32 s_reserved[186]; /* padding to the end of the block */ }; /* * Codes for operating systems */ #define NILFS_OS_LINUX 0 /* Codes from 1 to 4 are reserved to keep compatibility with ext2 creator-OS */ /* * Revision levels */ #define NILFS_CURRENT_REV 2 /* current major revision */ #define NILFS_MINOR_REV 0 /* minor revision */ #define NILFS_MIN_SUPP_REV 2 /* minimum supported revision */ /* * Feature set definitions * * If there is a bit set in the incompatible feature set that the kernel * doesn't know about, it should refuse to mount the filesystem. */ #define NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT 0x00000001ULL #define NILFS_FEATURE_COMPAT_SUPP 0ULL #define NILFS_FEATURE_COMPAT_RO_SUPP NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT #define NILFS_FEATURE_INCOMPAT_SUPP 0ULL /* * Bytes count of super_block for CRC-calculation */ #define NILFS_SB_BYTES \ ((long)&((struct nilfs_super_block *)0)->s_reserved) /* * Special inode number */ #define NILFS_ROOT_INO 2 /* Root file inode */ #define NILFS_DAT_INO 3 /* DAT file */ #define NILFS_CPFILE_INO 4 /* checkpoint file */ #define NILFS_SUFILE_INO 5 /* segment usage file */ #define NILFS_IFILE_INO 6 /* ifile */ #define NILFS_ATIME_INO 7 /* Atime file (reserved) */ #define NILFS_XATTR_INO 8 /* Xattribute file (reserved) */ #define NILFS_SKETCH_INO 10 /* Sketch file */ #define NILFS_USER_INO 11 /* Fisrt user's file inode number */ #define NILFS_SB_OFFSET_BYTES 1024 /* byte offset of nilfs superblock */ #define NILFS_SEG_MIN_BLOCKS 16 /* * Minimum number of blocks in * a full segment */ #define NILFS_PSEG_MIN_BLOCKS 2 /* * Minimum number of blocks in * a partial segment */ #define NILFS_MIN_NRSVSEGS 8 /* * Minimum number of reserved * segments */ /* * We call DAT, cpfile, and sufile root metadata files. Inodes of * these files are written in super root block instead of ifile, and * garbage collector doesn't keep any past versions of these files. */ #define NILFS_ROOT_METADATA_FILE(ino) \ ((ino) >= NILFS_DAT_INO && (ino) <= NILFS_SUFILE_INO) /* * bytes offset of secondary super block */ #define NILFS_SB2_OFFSET_BYTES(devsize) ((((devsize) >> 12) - 1) << 12) /* * Maximal count of links to a file */ #define NILFS_LINK_MAX 32000 /* * Structure of a directory entry * (Same as ext2) */ #define NILFS_NAME_LEN 255 /* * Block size limitations */ #define NILFS_MIN_BLOCK_SIZE 1024 #define NILFS_MAX_BLOCK_SIZE 65536 /* * The new version of the directory entry. Since V0 structures are * stored in intel byte order, and the name_len field could never be * bigger than 255 chars, it's safe to reclaim the extra byte for the * file_type field. */ struct nilfs_dir_entry { __le64 inode; /* Inode number */ __le16 rec_len; /* Directory entry length */ __u8 name_len; /* Name length */ __u8 file_type; /* Dir entry type (file, dir, etc) */ char name[NILFS_NAME_LEN]; /* File name */ char pad; }; /* * NILFS directory file types. Only the low 3 bits are used. The * other bits are reserved for now. */ enum { NILFS_FT_UNKNOWN, NILFS_FT_REG_FILE, NILFS_FT_DIR, NILFS_FT_CHRDEV, NILFS_FT_BLKDEV, NILFS_FT_FIFO, NILFS_FT_SOCK, NILFS_FT_SYMLINK, NILFS_FT_MAX }; /* * NILFS_DIR_PAD defines the directory entries boundaries * * NOTE: It must be a multiple of 8 */ #define NILFS_DIR_PAD 8 #define NILFS_DIR_ROUND (NILFS_DIR_PAD - 1) #define NILFS_DIR_REC_LEN(name_len) (((name_len) + 12 + NILFS_DIR_ROUND) & \ ~NILFS_DIR_ROUND) #define NILFS_MAX_REC_LEN ((1 << 16) - 1) /** * struct nilfs_finfo - file information * @fi_ino: inode number * @fi_cno: checkpoint number * @fi_nblocks: number of blocks (including intermediate blocks) * @fi_ndatablk: number of file data blocks */ struct nilfs_finfo { __le64 fi_ino; __le64 fi_cno; __le32 fi_nblocks; __le32 fi_ndatablk; }; /** * struct nilfs_binfo_v - information on a data block (except DAT) * @bi_vblocknr: virtual block number * @bi_blkoff: block offset */ struct nilfs_binfo_v { __le64 bi_vblocknr; __le64 bi_blkoff; }; /** * struct nilfs_binfo_dat - information on a DAT node block * @bi_blkoff: block offset * @bi_level: level * @bi_pad: padding */ struct nilfs_binfo_dat { __le64 bi_blkoff; __u8 bi_level; __u8 bi_pad[7]; }; /** * union nilfs_binfo: block information * @bi_v: nilfs_binfo_v structure * @bi_dat: nilfs_binfo_dat structure */ union nilfs_binfo { struct nilfs_binfo_v bi_v; struct nilfs_binfo_dat bi_dat; }; /** * struct nilfs_segment_summary - segment summary header * @ss_datasum: checksum of data * @ss_sumsum: checksum of segment summary * @ss_magic: magic number * @ss_bytes: size of this structure in bytes * @ss_flags: flags * @ss_seq: sequence number * @ss_create: creation timestamp * @ss_next: next segment * @ss_nblocks: number of blocks * @ss_nfinfo: number of finfo structures * @ss_sumbytes: total size of segment summary in bytes * @ss_pad: padding * @ss_cno: checkpoint number */ struct nilfs_segment_summary { __le32 ss_datasum; __le32 ss_sumsum; __le32 ss_magic; __le16 ss_bytes; __le16 ss_flags; __le64 ss_seq; __le64 ss_create; __le64 ss_next; __le32 ss_nblocks; __le32 ss_nfinfo; __le32 ss_sumbytes; __le32 ss_pad; __le64 ss_cno; /* array of finfo structures */ }; #define NILFS_SEGSUM_MAGIC 0x1eaffa11 /* segment summary magic number */ /* * Segment summary flags */ #define NILFS_SS_LOGBGN 0x0001 /* begins a logical segment */ #define NILFS_SS_LOGEND 0x0002 /* ends a logical segment */ #define NILFS_SS_SR 0x0004 /* has super root */ #define NILFS_SS_SYNDT 0x0008 /* includes data only updates */ #define NILFS_SS_GC 0x0010 /* segment written for cleaner operation */ /** * struct nilfs_btree_node - header of B-tree node block * @bn_flags: flags * @bn_level: level * @bn_nchildren: number of children * @bn_pad: padding */ struct nilfs_btree_node { __u8 bn_flags; __u8 bn_level; __le16 bn_nchildren; __le32 bn_pad; }; /* flags */ #define NILFS_BTREE_NODE_ROOT 0x01 /* level */ #define NILFS_BTREE_LEVEL_DATA 0 #define NILFS_BTREE_LEVEL_NODE_MIN (NILFS_BTREE_LEVEL_DATA + 1) #define NILFS_BTREE_LEVEL_MAX 14 /* Max level (exclusive) */ /** * struct nilfs_direct_node - header of built-in bmap array * @dn_flags: flags * @dn_pad: padding */ struct nilfs_direct_node { __u8 dn_flags; __u8 pad[7]; }; /** * struct nilfs_palloc_group_desc - block group descriptor * @pg_nfrees: number of free entries in block group */ struct nilfs_palloc_group_desc { __le32 pg_nfrees; }; /** * struct nilfs_dat_entry - disk address translation entry * @de_blocknr: block number * @de_start: start checkpoint number * @de_end: end checkpoint number * @de_rsv: reserved for future use */ struct nilfs_dat_entry { __le64 de_blocknr; __le64 de_start; __le64 de_end; __le64 de_rsv; }; #define NILFS_MIN_DAT_ENTRY_SIZE 32 /** * struct nilfs_snapshot_list - snapshot list * @ssl_next: next checkpoint number on snapshot list * @ssl_prev: previous checkpoint number on snapshot list */ struct nilfs_snapshot_list { __le64 ssl_next; __le64 ssl_prev; }; /** * struct nilfs_checkpoint - checkpoint structure * @cp_flags: flags * @cp_checkpoints_count: checkpoints count in a block * @cp_snapshot_list: snapshot list * @cp_cno: checkpoint number * @cp_create: creation timestamp * @cp_nblk_inc: number of blocks incremented by this checkpoint * @cp_inodes_count: inodes count * @cp_blocks_count: blocks count * @cp_ifile_inode: inode of ifile */ struct nilfs_checkpoint { __le32 cp_flags; __le32 cp_checkpoints_count; struct nilfs_snapshot_list cp_snapshot_list; __le64 cp_cno; __le64 cp_create; __le64 cp_nblk_inc; __le64 cp_inodes_count; __le64 cp_blocks_count; /* * Do not change the byte offset of ifile inode. * To keep the compatibility of the disk format, * additional fields should be added behind cp_ifile_inode. */ struct nilfs_inode cp_ifile_inode; }; #define NILFS_MIN_CHECKPOINT_SIZE (64 + NILFS_MIN_INODE_SIZE) /* checkpoint flags */ enum { NILFS_CHECKPOINT_SNAPSHOT, NILFS_CHECKPOINT_INVALID, NILFS_CHECKPOINT_SKETCH, NILFS_CHECKPOINT_MINOR, }; #define NILFS_CHECKPOINT_FNS(flag, name) \ static __inline__ void \ nilfs_checkpoint_set_##name(struct nilfs_checkpoint *cp) \ { \ cp->cp_flags = __cpu_to_le32(__le32_to_cpu(cp->cp_flags) | \ (1UL << NILFS_CHECKPOINT_##flag)); \ } \ static __inline__ void \ nilfs_checkpoint_clear_##name(struct nilfs_checkpoint *cp) \ { \ cp->cp_flags = __cpu_to_le32(__le32_to_cpu(cp->cp_flags) & \ ~(1UL << NILFS_CHECKPOINT_##flag)); \ } \ static __inline__ int \ nilfs_checkpoint_##name(const struct nilfs_checkpoint *cp) \ { \ return !!(__le32_to_cpu(cp->cp_flags) & \ (1UL << NILFS_CHECKPOINT_##flag)); \ } NILFS_CHECKPOINT_FNS(SNAPSHOT, snapshot) NILFS_CHECKPOINT_FNS(INVALID, invalid) NILFS_CHECKPOINT_FNS(MINOR, minor) /** * struct nilfs_cpfile_header - checkpoint file header * @ch_ncheckpoints: number of checkpoints * @ch_nsnapshots: number of snapshots * @ch_snapshot_list: snapshot list */ struct nilfs_cpfile_header { __le64 ch_ncheckpoints; __le64 ch_nsnapshots; struct nilfs_snapshot_list ch_snapshot_list; }; #define NILFS_CPFILE_FIRST_CHECKPOINT_OFFSET \ ((sizeof(struct nilfs_cpfile_header) + \ sizeof(struct nilfs_checkpoint) - 1) / \ sizeof(struct nilfs_checkpoint)) /** * struct nilfs_segment_usage - segment usage * @su_lastmod: last modified timestamp * @su_nblocks: number of blocks in segment * @su_flags: flags */ struct nilfs_segment_usage { __le64 su_lastmod; __le32 su_nblocks; __le32 su_flags; }; #define NILFS_MIN_SEGMENT_USAGE_SIZE 16 /* segment usage flag */ enum { NILFS_SEGMENT_USAGE_ACTIVE, NILFS_SEGMENT_USAGE_DIRTY, NILFS_SEGMENT_USAGE_ERROR, }; #define NILFS_SEGMENT_USAGE_FNS(flag, name) \ static __inline__ void \ nilfs_segment_usage_set_##name(struct nilfs_segment_usage *su) \ { \ su->su_flags = __cpu_to_le32(__le32_to_cpu(su->su_flags) | \ (1UL << NILFS_SEGMENT_USAGE_##flag));\ } \ static __inline__ void \ nilfs_segment_usage_clear_##name(struct nilfs_segment_usage *su) \ { \ su->su_flags = \ __cpu_to_le32(__le32_to_cpu(su->su_flags) & \ ~(1UL << NILFS_SEGMENT_USAGE_##flag)); \ } \ static __inline__ int \ nilfs_segment_usage_##name(const struct nilfs_segment_usage *su) \ { \ return !!(__le32_to_cpu(su->su_flags) & \ (1UL << NILFS_SEGMENT_USAGE_##flag)); \ } NILFS_SEGMENT_USAGE_FNS(ACTIVE, active) NILFS_SEGMENT_USAGE_FNS(DIRTY, dirty) NILFS_SEGMENT_USAGE_FNS(ERROR, error) static __inline__ void nilfs_segment_usage_set_clean(struct nilfs_segment_usage *su) { su->su_lastmod = __cpu_to_le64(0); su->su_nblocks = __cpu_to_le32(0); su->su_flags = __cpu_to_le32(0); } static __inline__ int nilfs_segment_usage_clean(const struct nilfs_segment_usage *su) { return !__le32_to_cpu(su->su_flags); } /** * struct nilfs_sufile_header - segment usage file header * @sh_ncleansegs: number of clean segments * @sh_ndirtysegs: number of dirty segments * @sh_last_alloc: last allocated segment number */ struct nilfs_sufile_header { __le64 sh_ncleansegs; __le64 sh_ndirtysegs; __le64 sh_last_alloc; /* ... */ }; #define NILFS_SUFILE_FIRST_SEGMENT_USAGE_OFFSET \ ((sizeof(struct nilfs_sufile_header) + \ sizeof(struct nilfs_segment_usage) - 1) / \ sizeof(struct nilfs_segment_usage)) #endif /* _LINUX_NILFS2_ONDISK_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/fs.h������������������������������������������������������������������������������������������0000644�����������������00000035624�14763166027�0006512 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_FS_H #define _LINUX_FS_H /* * This file has definitions for some important file table structures * and constants and structures used by various generic file system * ioctl's. Please do not make any changes in this file before * sending patches for review to linux-fsdevel@vger.kernel.org and * linux-api@vger.kernel.org. */ #include <linux/limits.h> #include <linux/ioctl.h> #include <linux/types.h> /* * It's silly to have NR_OPEN bigger than NR_FILE, but you can change * the file limit at runtime and only root can increase the per-process * nr_file rlimit, so it's safe to set up a ridiculously high absolute * upper limit on files-per-process. * * Some programs (notably those using select()) may have to be * recompiled to take full advantage of the new limits.. */ /* Fixed constants first: */ #undef NR_OPEN #define INR_OPEN_CUR 1024 /* Initial setting for nfile rlimits */ #define INR_OPEN_MAX 4096 /* Hard limit for nfile rlimits */ #define BLOCK_SIZE_BITS 10 #define BLOCK_SIZE (1<<BLOCK_SIZE_BITS) #define SEEK_SET 0 /* seek relative to beginning of file */ #define SEEK_CUR 1 /* seek relative to current file position */ #define SEEK_END 2 /* seek relative to end of file */ #define SEEK_DATA 3 /* seek to the next data */ #define SEEK_HOLE 4 /* seek to the next hole */ #define SEEK_MAX SEEK_HOLE #define RENAME_NOREPLACE (1 << 0) /* Don't overwrite target */ #define RENAME_EXCHANGE (1 << 1) /* Exchange source and dest */ #define RENAME_WHITEOUT (1 << 2) /* Whiteout source */ struct file_clone_range { __s64 src_fd; __u64 src_offset; __u64 src_length; __u64 dest_offset; }; struct fstrim_range { __u64 start; __u64 len; __u64 minlen; }; /* extent-same (dedupe) ioctls; these MUST match the btrfs ioctl definitions */ #define FILE_DEDUPE_RANGE_SAME 0 #define FILE_DEDUPE_RANGE_DIFFERS 1 /* from struct btrfs_ioctl_file_extent_same_info */ struct file_dedupe_range_info { __s64 dest_fd; /* in - destination file */ __u64 dest_offset; /* in - start of extent in destination */ __u64 bytes_deduped; /* out - total # of bytes we were able * to dedupe from this file. */ /* status of this dedupe operation: * < 0 for error * == FILE_DEDUPE_RANGE_SAME if dedupe succeeds * == FILE_DEDUPE_RANGE_DIFFERS if data differs */ __s32 status; /* out - see above description */ __u32 reserved; /* must be zero */ }; /* from struct btrfs_ioctl_file_extent_same_args */ struct file_dedupe_range { __u64 src_offset; /* in - start of extent in source */ __u64 src_length; /* in - length of extent */ __u16 dest_count; /* in - total elements in info array */ __u16 reserved1; /* must be zero */ __u32 reserved2; /* must be zero */ struct file_dedupe_range_info info[0]; }; /* And dynamically-tunable limits and defaults: */ struct files_stat_struct { unsigned long nr_files; /* read only */ unsigned long nr_free_files; /* read only */ unsigned long max_files; /* tunable */ }; struct inodes_stat_t { long nr_inodes; long nr_unused; long dummy[5]; /* padding for sysctl ABI compatibility */ }; #define NR_FILE 8192 /* this can well be larger on a larger system */ /* * These are the fs-independent mount-flags: up to 32 flags are supported */ #define MS_RDONLY 1 /* Mount read-only */ #define MS_NOSUID 2 /* Ignore suid and sgid bits */ #define MS_NODEV 4 /* Disallow access to device special files */ #define MS_NOEXEC 8 /* Disallow program execution */ #define MS_SYNCHRONOUS 16 /* Writes are synced at once */ #define MS_REMOUNT 32 /* Alter flags of a mounted FS */ #define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ #define MS_DIRSYNC 128 /* Directory modifications are synchronous */ #define MS_NOATIME 1024 /* Do not update access times. */ #define MS_NODIRATIME 2048 /* Do not update directory access times */ #define MS_BIND 4096 #define MS_MOVE 8192 #define MS_REC 16384 #define MS_VERBOSE 32768 /* War is peace. Verbosity is silence. MS_VERBOSE is deprecated. */ #define MS_SILENT 32768 #define MS_POSIXACL (1<<16) /* VFS does not apply the umask */ #define MS_UNBINDABLE (1<<17) /* change to unbindable */ #define MS_PRIVATE (1<<18) /* change to private */ #define MS_SLAVE (1<<19) /* change to slave */ #define MS_SHARED (1<<20) /* change to shared */ #define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */ #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ #define MS_I_VERSION (1<<23) /* Update inode I_version field */ #define MS_STRICTATIME (1<<24) /* Always perform atime updates */ #define MS_LAZYTIME (1<<25) /* Update the on-disk [acm]times lazily */ /* These sb flags are internal to the kernel */ #define MS_SUBMOUNT (1<<26) #define MS_NOREMOTELOCK (1<<27) #define MS_NOSEC (1<<28) #define MS_BORN (1<<29) #define MS_ACTIVE (1<<30) #define MS_NOUSER (1<<31) /* * Superblock flags that can be altered by MS_REMOUNT */ #define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|\ MS_LAZYTIME) /* * Old magic mount flag and mask */ #define MS_MGC_VAL 0xC0ED0000 #define MS_MGC_MSK 0xffff0000 /* * Structure for FS_IOC_FSGETXATTR[A] and FS_IOC_FSSETXATTR. */ struct fsxattr { __u32 fsx_xflags; /* xflags field value (get/set) */ __u32 fsx_extsize; /* extsize field value (get/set)*/ __u32 fsx_nextents; /* nextents field value (get) */ __u32 fsx_projid; /* project identifier (get/set) */ __u32 fsx_cowextsize; /* CoW extsize field value (get/set)*/ unsigned char fsx_pad[8]; }; /* * Flags for the fsx_xflags field */ #define FS_XFLAG_REALTIME 0x00000001 /* data in realtime volume */ #define FS_XFLAG_PREALLOC 0x00000002 /* preallocated file extents */ #define FS_XFLAG_IMMUTABLE 0x00000008 /* file cannot be modified */ #define FS_XFLAG_APPEND 0x00000010 /* all writes append */ #define FS_XFLAG_SYNC 0x00000020 /* all writes synchronous */ #define FS_XFLAG_NOATIME 0x00000040 /* do not update access time */ #define FS_XFLAG_NODUMP 0x00000080 /* do not include in backups */ #define FS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */ #define FS_XFLAG_PROJINHERIT 0x00000200 /* create with parents projid */ #define FS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */ #define FS_XFLAG_EXTSIZE 0x00000800 /* extent size allocator hint */ #define FS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */ #define FS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */ #define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */ #define FS_XFLAG_DAX 0x00008000 /* use DAX for IO */ #define FS_XFLAG_COWEXTSIZE 0x00010000 /* CoW extent size allocator hint */ #define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */ /* the read-only stuff doesn't really belong here, but any other place is probably as bad and I don't want to create yet another include file. */ #define BLKROSET _IO(0x12,93) /* set device read-only (0 = read-write) */ #define BLKROGET _IO(0x12,94) /* get read-only status (0 = read_write) */ #define BLKRRPART _IO(0x12,95) /* re-read partition table */ #define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */ #define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */ #define BLKRASET _IO(0x12,98) /* set read ahead for block device */ #define BLKRAGET _IO(0x12,99) /* get current read ahead setting */ #define BLKFRASET _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ #define BLKFRAGET _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ #define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ #define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ #define BLKSSZGET _IO(0x12,104)/* get block device sector size */ #if 0 #define BLKPG _IO(0x12,105)/* See blkpg.h */ /* Some people are morons. Do not use sizeof! */ #define BLKELVGET _IOR(0x12,106,size_t)/* elevator get */ #define BLKELVSET _IOW(0x12,107,size_t)/* elevator set */ /* This was here just to show that the number is taken - probably all these _IO(0x12,*) ioctls should be moved to blkpg.h. */ #endif /* A jump here: 108-111 have been used for various private purposes. */ #define BLKBSZGET _IOR(0x12,112,size_t) #define BLKBSZSET _IOW(0x12,113,size_t) #define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */ #define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup) #define BLKTRACESTART _IO(0x12,116) #define BLKTRACESTOP _IO(0x12,117) #define BLKTRACETEARDOWN _IO(0x12,118) #define BLKDISCARD _IO(0x12,119) #define BLKIOMIN _IO(0x12,120) #define BLKIOOPT _IO(0x12,121) #define BLKALIGNOFF _IO(0x12,122) #define BLKPBSZGET _IO(0x12,123) #define BLKDISCARDZEROES _IO(0x12,124) #define BLKSECDISCARD _IO(0x12,125) #define BLKROTATIONAL _IO(0x12,126) #define BLKZEROOUT _IO(0x12,127) /* * A jump here: 130-131 are reserved for zoned block devices * (see uapi/linux/blkzoned.h) */ #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ #define FIBMAP _IO(0x00,1) /* bmap access */ #define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */ #define FIFREEZE _IOWR('X', 119, int) /* Freeze */ #define FITHAW _IOWR('X', 120, int) /* Thaw */ #define FITRIM _IOWR('X', 121, struct fstrim_range) /* Trim */ #define FICLONE _IOW(0x94, 9, int) #define FICLONERANGE _IOW(0x94, 13, struct file_clone_range) #define FIDEDUPERANGE _IOWR(0x94, 54, struct file_dedupe_range) #define FSLABEL_MAX 256 /* Max chars for the interface; each fs may differ */ #define FS_IOC_GETFLAGS _IOR('f', 1, long) #define FS_IOC_SETFLAGS _IOW('f', 2, long) #define FS_IOC_GETVERSION _IOR('v', 1, long) #define FS_IOC_SETVERSION _IOW('v', 2, long) #define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap) #define FS_IOC32_GETFLAGS _IOR('f', 1, int) #define FS_IOC32_SETFLAGS _IOW('f', 2, int) #define FS_IOC32_GETVERSION _IOR('v', 1, int) #define FS_IOC32_SETVERSION _IOW('v', 2, int) #define FS_IOC_FSGETXATTR _IOR('X', 31, struct fsxattr) #define FS_IOC_FSSETXATTR _IOW('X', 32, struct fsxattr) #define FS_IOC_GETFSLABEL _IOR(0x94, 49, char[FSLABEL_MAX]) #define FS_IOC_SETFSLABEL _IOW(0x94, 50, char[FSLABEL_MAX]) /* * File system encryption support */ /* Policy provided via an ioctl on the topmost directory */ #define FS_KEY_DESCRIPTOR_SIZE 8 #define FS_POLICY_FLAGS_PAD_4 0x00 #define FS_POLICY_FLAGS_PAD_8 0x01 #define FS_POLICY_FLAGS_PAD_16 0x02 #define FS_POLICY_FLAGS_PAD_32 0x03 #define FS_POLICY_FLAGS_PAD_MASK 0x03 #define FS_POLICY_FLAGS_VALID 0x03 /* Encryption algorithms */ #define FS_ENCRYPTION_MODE_INVALID 0 #define FS_ENCRYPTION_MODE_AES_256_XTS 1 #define FS_ENCRYPTION_MODE_AES_256_GCM 2 #define FS_ENCRYPTION_MODE_AES_256_CBC 3 #define FS_ENCRYPTION_MODE_AES_256_CTS 4 #define FS_ENCRYPTION_MODE_AES_128_CBC 5 #define FS_ENCRYPTION_MODE_AES_128_CTS 6 #define FS_ENCRYPTION_MODE_SPECK128_256_XTS 7 /* Removed, do not use. */ #define FS_ENCRYPTION_MODE_SPECK128_256_CTS 8 /* Removed, do not use. */ struct fscrypt_policy { __u8 version; __u8 contents_encryption_mode; __u8 filenames_encryption_mode; __u8 flags; __u8 master_key_descriptor[FS_KEY_DESCRIPTOR_SIZE]; }; #define FS_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct fscrypt_policy) #define FS_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16]) #define FS_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct fscrypt_policy) /* Parameters for passing an encryption key into the kernel keyring */ #define FS_KEY_DESC_PREFIX "fscrypt:" #define FS_KEY_DESC_PREFIX_SIZE 8 /* Structure that userspace passes to the kernel keyring */ #define FS_MAX_KEY_SIZE 64 struct fscrypt_key { __u32 mode; __u8 raw[FS_MAX_KEY_SIZE]; __u32 size; }; /* * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) * * Note: for historical reasons, these flags were originally used and * defined for use by ext2/ext3, and then other file systems started * using these flags so they wouldn't need to write their own version * of chattr/lsattr (which was shipped as part of e2fsprogs). You * should think twice before trying to use these flags in new * contexts, or trying to assign these flags, since they are used both * as the UAPI and the on-disk encoding for ext2/3/4. Also, we are * almost out of 32-bit flags. :-) * * We have recently hoisted FS_IOC_FSGETXATTR / FS_IOC_FSSETXATTR from * XFS to the generic FS level interface. This uses a structure that * has padding and hence has more room to grow, so it may be more * appropriate for many new use cases. * * Please do not change these flags or interfaces before checking with * linux-fsdevel@vger.kernel.org and linux-api@vger.kernel.org. */ #define FS_SECRM_FL 0x00000001 /* Secure deletion */ #define FS_UNRM_FL 0x00000002 /* Undelete */ #define FS_COMPR_FL 0x00000004 /* Compress file */ #define FS_SYNC_FL 0x00000008 /* Synchronous updates */ #define FS_IMMUTABLE_FL 0x00000010 /* Immutable file */ #define FS_APPEND_FL 0x00000020 /* writes to file may only append */ #define FS_NODUMP_FL 0x00000040 /* do not dump file */ #define FS_NOATIME_FL 0x00000080 /* do not update atime */ /* Reserved for compression usage... */ #define FS_DIRTY_FL 0x00000100 #define FS_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */ #define FS_NOCOMP_FL 0x00000400 /* Don't compress */ /* End compression flags --- maybe not all used */ #define FS_ENCRYPT_FL 0x00000800 /* Encrypted file */ #define FS_BTREE_FL 0x00001000 /* btree format dir */ #define FS_INDEX_FL 0x00001000 /* hash-indexed directory */ #define FS_IMAGIC_FL 0x00002000 /* AFS directory */ #define FS_JOURNAL_DATA_FL 0x00004000 /* Reserved for ext3 */ #define FS_NOTAIL_FL 0x00008000 /* file tail should not be merged */ #define FS_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */ #define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ #define FS_HUGE_FILE_FL 0x00040000 /* Reserved for ext4 */ #define FS_EXTENT_FL 0x00080000 /* Extents */ #define FS_EA_INODE_FL 0x00200000 /* Inode used for large EA */ #define FS_EOFBLOCKS_FL 0x00400000 /* Reserved for ext4 */ #define FS_NOCOW_FL 0x00800000 /* Do not cow file */ #define FS_INLINE_DATA_FL 0x10000000 /* Reserved for ext4 */ #define FS_PROJINHERIT_FL 0x20000000 /* Create with parents projid */ #define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ #define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ #define FS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ #define SYNC_FILE_RANGE_WAIT_BEFORE 1 #define SYNC_FILE_RANGE_WRITE 2 #define SYNC_FILE_RANGE_WAIT_AFTER 4 /* * Flags for preadv2/pwritev2: */ typedef int __bitwise __kernel_rwf_t; /* high priority request, poll if possible */ #define RWF_HIPRI ((__kernel_rwf_t)0x00000001) /* per-IO O_DSYNC */ #define RWF_DSYNC ((__kernel_rwf_t)0x00000002) /* per-IO O_SYNC */ #define RWF_SYNC ((__kernel_rwf_t)0x00000004) /* per-IO, return -EAGAIN if operation would block */ #define RWF_NOWAIT ((__kernel_rwf_t)0x00000008) /* per-IO O_APPEND */ #define RWF_APPEND ((__kernel_rwf_t)0x00000010) /* mask of flags supported by the kernel */ #define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\ RWF_APPEND) #endif /* _LINUX_FS_H */ ������������������������������������������������������������������������������������������������������������linux/kcmp.h����������������������������������������������������������������������������������������0000644�����������������00000001012�14763166027�0007014 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_KCMP_H #define _LINUX_KCMP_H #include <linux/types.h> /* Comparison type */ enum kcmp_type { KCMP_FILE, KCMP_VM, KCMP_FILES, KCMP_FS, KCMP_SIGHAND, KCMP_IO, KCMP_SYSVSEM, KCMP_EPOLL_TFD, KCMP_TYPES, }; /* Slot for KCMP_EPOLL_TFD */ struct kcmp_epoll_slot { __u32 efd; /* epoll file descriptor */ __u32 tfd; /* target file number */ __u32 toff; /* target offset within same numbered sequence */ }; #endif /* _LINUX_KCMP_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/udf_fs_i.h������������������������������������������������������������������������������������0000644�����������������00000001271�14763166027�0007647 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * udf_fs_i.h * * This file is intended for the Linux kernel/module. * * COPYRIGHT * This file is distributed under the terms of the GNU General Public * License (GPL). Copies of the GPL can be obtained from: * ftp://prep.ai.mit.edu/pub/gnu/GPL * Each contributing author retains all rights to their own work. */ #ifndef _UDF_FS_I_H #define _UDF_FS_I_H 1 /* exported IOCTLs, we have 'l', 0x40-0x7f */ #define UDF_GETEASIZE _IOR('l', 0x40, int) #define UDF_GETEABLOCK _IOR('l', 0x41, void *) #define UDF_GETVOLIDENT _IOR('l', 0x42, void *) #define UDF_RELOCATE_BLOCKS _IOWR('l', 0x43, long) #endif /* _UDF_FS_I_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_ipv4/ipt_LOG.h����������������������������������������������������������������������0000644�����������������00000001322�14763166027�0012321 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IPT_LOG_H #define _IPT_LOG_H #warning "Please update iptables, this file will be removed soon!" /* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ #define IPT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ #define IPT_LOG_TCPOPT 0x02 /* Log TCP options */ #define IPT_LOG_IPOPT 0x04 /* Log IP options */ #define IPT_LOG_UID 0x08 /* Log UID owning local socket */ #define IPT_LOG_NFLOG 0x10 /* Unsupported, don't reuse */ #define IPT_LOG_MACDECODE 0x20 /* Decode MAC header */ #define IPT_LOG_MASK 0x2f struct ipt_log_info { unsigned char level; unsigned char logflags; char prefix[30]; }; #endif /*_IPT_LOG_H*/ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_ipv4/ipt_TTL.h����������������������������������������������������������������������0000644�����������������00000000567�14763166027�0012355 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* TTL modification module for IP tables * (C) 2000 by Harald Welte <laforge@netfilter.org> */ #ifndef _IPT_TTL_H #define _IPT_TTL_H #include <linux/types.h> enum { IPT_TTL_SET = 0, IPT_TTL_INC, IPT_TTL_DEC }; #define IPT_TTL_MAXMODE IPT_TTL_DEC struct ipt_TTL_info { __u8 mode; __u8 ttl; }; #endif �����������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_ipv4/ipt_ECN.h����������������������������������������������������������������������0000644�����������������00000001605�14763166027�0012311 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Header file for iptables ipt_ECN target * * (C) 2002 by Harald Welte <laforge@gnumonks.org> * * This software is distributed under GNU GPL v2, 1991 * * ipt_ECN.h,v 1.3 2002/05/29 12:17:40 laforge Exp */ #ifndef _IPT_ECN_TARGET_H #define _IPT_ECN_TARGET_H #include <linux/types.h> #include <linux/netfilter/xt_DSCP.h> #define IPT_ECN_IP_MASK (~XT_DSCP_MASK) #define IPT_ECN_OP_SET_IP 0x01 /* set ECN bits of IPv4 header */ #define IPT_ECN_OP_SET_ECE 0x10 /* set ECE bit of TCP header */ #define IPT_ECN_OP_SET_CWR 0x20 /* set CWR bit of TCP header */ #define IPT_ECN_OP_MASK 0xce struct ipt_ECN_info { __u8 operation; /* bitset of operations */ __u8 ip_ect; /* ECT codepoint of IPv4 header, pre-shifted */ union { struct { __u8 ece:1, cwr:1; /* TCP ECT bits */ } tcp; } proto; }; #endif /* _IPT_ECN_TARGET_H */ ���������������������������������������������������������������������������������������������������������������������������linux/netfilter_ipv4/ipt_REJECT.h�������������������������������������������������������������������0000644�����������������00000000724�14763166027�0012661 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IPT_REJECT_H #define _IPT_REJECT_H enum ipt_reject_with { IPT_ICMP_NET_UNREACHABLE, IPT_ICMP_HOST_UNREACHABLE, IPT_ICMP_PROT_UNREACHABLE, IPT_ICMP_PORT_UNREACHABLE, IPT_ICMP_ECHOREPLY, IPT_ICMP_NET_PROHIBITED, IPT_ICMP_HOST_PROHIBITED, IPT_TCP_RESET, IPT_ICMP_ADMIN_PROHIBITED }; struct ipt_reject_info { enum ipt_reject_with with; /* reject type */ }; #endif /*_IPT_REJECT_H*/ ��������������������������������������������linux/netfilter_ipv4/ipt_ah.h�����������������������������������������������������������������������0000644�����������������00000000651�14763166027�0012274 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IPT_AH_H #define _IPT_AH_H #include <linux/types.h> struct ipt_ah { __u32 spis[2]; /* Security Parameter Index */ __u8 invflags; /* Inverse flags */ }; /* Values for "invflags" field in struct ipt_ah. */ #define IPT_AH_INV_SPI 0x01 /* Invert the sense of spi. */ #define IPT_AH_INV_MASK 0x01 /* All possible flags. */ #endif /*_IPT_AH_H*/ ���������������������������������������������������������������������������������������linux/netfilter_ipv4/ipt_CLUSTERIP.h����������������������������������������������������������������0000644�����������������00000001465�14763166027�0013262 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IPT_CLUSTERIP_H_target #define _IPT_CLUSTERIP_H_target #include <linux/types.h> #include <linux/if_ether.h> enum clusterip_hashmode { CLUSTERIP_HASHMODE_SIP = 0, CLUSTERIP_HASHMODE_SIP_SPT, CLUSTERIP_HASHMODE_SIP_SPT_DPT, }; #define CLUSTERIP_HASHMODE_MAX CLUSTERIP_HASHMODE_SIP_SPT_DPT #define CLUSTERIP_MAX_NODES 16 #define CLUSTERIP_FLAG_NEW 0x00000001 struct clusterip_config; struct ipt_clusterip_tgt_info { __u32 flags; /* only relevant for new ones */ __u8 clustermac[ETH_ALEN]; __u16 num_total_nodes; __u16 num_local_nodes; __u16 local_nodes[CLUSTERIP_MAX_NODES]; __u32 hash_mode; __u32 hash_initval; /* Used internally by the kernel */ struct clusterip_config *config; }; #endif /*_IPT_CLUSTERIP_H_target*/ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_ipv4/ipt_ttl.h����������������������������������������������������������������������0000644�����������������00000000657�14763166027�0012515 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* IP tables module for matching the value of the TTL * (C) 2000 by Harald Welte <laforge@gnumonks.org> */ #ifndef _IPT_TTL_H #define _IPT_TTL_H #include <linux/types.h> enum { IPT_TTL_EQ = 0, /* equals */ IPT_TTL_NE, /* not equals */ IPT_TTL_LT, /* less than */ IPT_TTL_GT, /* greater than */ }; struct ipt_ttl_info { __u8 mode; __u8 ttl; }; #endif ���������������������������������������������������������������������������������linux/netfilter_ipv4/ip_tables.h��������������������������������������������������������������������0000644�����������������00000014767�14763166027�0013007 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * 25-Jul-1998 Major changes to allow for ip chain table * * 3-Jan-2000 Named tables to allow packet selection for different uses. */ /* * Format of an IP firewall descriptor * * src, dst, src_mask, dst_mask are always stored in network byte order. * flags are stored in host byte order (of course). * Port numbers are stored in HOST byte order. */ #ifndef _IPTABLES_H #define _IPTABLES_H #include <linux/types.h> #include <linux/if.h> #include <linux/netfilter_ipv4.h> #include <linux/netfilter/x_tables.h> #define IPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN #define IPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN #define ipt_match xt_match #define ipt_target xt_target #define ipt_table xt_table #define ipt_get_revision xt_get_revision #define ipt_entry_match xt_entry_match #define ipt_entry_target xt_entry_target #define ipt_standard_target xt_standard_target #define ipt_error_target xt_error_target #define ipt_counters xt_counters #define IPT_CONTINUE XT_CONTINUE #define IPT_RETURN XT_RETURN /* This group is older than old (iptables < v1.4.0-rc1~89) */ #include <linux/netfilter/xt_tcpudp.h> #define ipt_udp xt_udp #define ipt_tcp xt_tcp #define IPT_TCP_INV_SRCPT XT_TCP_INV_SRCPT #define IPT_TCP_INV_DSTPT XT_TCP_INV_DSTPT #define IPT_TCP_INV_FLAGS XT_TCP_INV_FLAGS #define IPT_TCP_INV_OPTION XT_TCP_INV_OPTION #define IPT_TCP_INV_MASK XT_TCP_INV_MASK #define IPT_UDP_INV_SRCPT XT_UDP_INV_SRCPT #define IPT_UDP_INV_DSTPT XT_UDP_INV_DSTPT #define IPT_UDP_INV_MASK XT_UDP_INV_MASK /* The argument to IPT_SO_ADD_COUNTERS. */ #define ipt_counters_info xt_counters_info /* Standard return verdict, or do jump. */ #define IPT_STANDARD_TARGET XT_STANDARD_TARGET /* Error verdict. */ #define IPT_ERROR_TARGET XT_ERROR_TARGET /* fn returns 0 to continue iteration */ #define IPT_MATCH_ITERATE(e, fn, args...) \ XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args) /* fn returns 0 to continue iteration */ #define IPT_ENTRY_ITERATE(entries, size, fn, args...) \ XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args) /* Yes, Virginia, you have to zero the padding. */ struct ipt_ip { /* Source and destination IP addr */ struct in_addr src, dst; /* Mask for src and dest IP addr */ struct in_addr smsk, dmsk; char iniface[IFNAMSIZ], outiface[IFNAMSIZ]; unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ]; /* Protocol, 0 = ANY */ __u16 proto; /* Flags word */ __u8 flags; /* Inverse flags */ __u8 invflags; }; /* Values for "flag" field in struct ipt_ip (general ip structure). */ #define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */ #define IPT_F_GOTO 0x02 /* Set if jump is a goto */ #define IPT_F_MASK 0x03 /* All possible flag bits mask. */ /* Values for "inv" field in struct ipt_ip. */ #define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ #define IPT_INV_VIA_OUT 0x02 /* Invert the sense of OUT IFACE */ #define IPT_INV_TOS 0x04 /* Invert the sense of TOS. */ #define IPT_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */ #define IPT_INV_DSTIP 0x10 /* Invert the sense of DST OP. */ #define IPT_INV_FRAG 0x20 /* Invert the sense of FRAG. */ #define IPT_INV_PROTO XT_INV_PROTO #define IPT_INV_MASK 0x7F /* All possible flag bits mask. */ /* This structure defines each of the firewall rules. Consists of 3 parts which are 1) general IP header stuff 2) match specific stuff 3) the target to perform if the rule matches */ struct ipt_entry { struct ipt_ip ip; /* Mark with fields that we care about. */ unsigned int nfcache; /* Size of ipt_entry + matches */ __u16 target_offset; /* Size of ipt_entry + matches + target */ __u16 next_offset; /* Back pointer */ unsigned int comefrom; /* Packet and byte counters. */ struct xt_counters counters; /* The matches (if any), then the target. */ unsigned char elems[0]; }; /* * New IP firewall options for [gs]etsockopt at the RAW IP level. * Unlike BSD Linux inherits IP options so you don't have to use a raw * socket for this. Instead we check rights in the calls. * * ATTENTION: check linux/in.h before adding new number here. */ #define IPT_BASE_CTL 64 #define IPT_SO_SET_REPLACE (IPT_BASE_CTL) #define IPT_SO_SET_ADD_COUNTERS (IPT_BASE_CTL + 1) #define IPT_SO_SET_MAX IPT_SO_SET_ADD_COUNTERS #define IPT_SO_GET_INFO (IPT_BASE_CTL) #define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1) #define IPT_SO_GET_REVISION_MATCH (IPT_BASE_CTL + 2) #define IPT_SO_GET_REVISION_TARGET (IPT_BASE_CTL + 3) #define IPT_SO_GET_MAX IPT_SO_GET_REVISION_TARGET /* ICMP matching stuff */ struct ipt_icmp { __u8 type; /* type to match */ __u8 code[2]; /* range of code */ __u8 invflags; /* Inverse flags */ }; /* Values for "inv" field for struct ipt_icmp. */ #define IPT_ICMP_INV 0x01 /* Invert the sense of type/code test */ /* The argument to IPT_SO_GET_INFO */ struct ipt_getinfo { /* Which table: caller fills this in. */ char name[XT_TABLE_MAXNAMELEN]; /* Kernel fills these in. */ /* Which hook entry points are valid: bitmask */ unsigned int valid_hooks; /* Hook entry points: one per netfilter hook. */ unsigned int hook_entry[NF_INET_NUMHOOKS]; /* Underflow points. */ unsigned int underflow[NF_INET_NUMHOOKS]; /* Number of entries */ unsigned int num_entries; /* Size of entries. */ unsigned int size; }; /* The argument to IPT_SO_SET_REPLACE. */ struct ipt_replace { /* Which table. */ char name[XT_TABLE_MAXNAMELEN]; /* Which hook entry points are valid: bitmask. You can't change this. */ unsigned int valid_hooks; /* Number of entries */ unsigned int num_entries; /* Total size of new entries */ unsigned int size; /* Hook entry points. */ unsigned int hook_entry[NF_INET_NUMHOOKS]; /* Underflow points. */ unsigned int underflow[NF_INET_NUMHOOKS]; /* Information about old entries: */ /* Number of counters (must be equal to current number of entries). */ unsigned int num_counters; /* The old entries' counters. */ struct xt_counters *counters; /* The entries (hang off end: not really an array). */ struct ipt_entry entries[0]; }; /* The argument to IPT_SO_GET_ENTRIES. */ struct ipt_get_entries { /* Which table: user fills this in. */ char name[XT_TABLE_MAXNAMELEN]; /* User fills this in: total entry size. */ unsigned int size; /* The entries. */ struct ipt_entry entrytable[0]; }; /* Helper functions */ static __inline__ struct xt_entry_target * ipt_get_target(struct ipt_entry *e) { return (void *)e + e->target_offset; } /* * Main firewall chains definitions and global var's definitions. */ #endif /* _IPTABLES_H */ ���������linux/netfilter_ipv4/ipt_ecn.h����������������������������������������������������������������������0000644�����������������00000000657�14763166027�0012457 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IPT_ECN_H #define _IPT_ECN_H #include <linux/netfilter/xt_ecn.h> #define ipt_ecn_info xt_ecn_info enum { IPT_ECN_IP_MASK = XT_ECN_IP_MASK, IPT_ECN_OP_MATCH_IP = XT_ECN_OP_MATCH_IP, IPT_ECN_OP_MATCH_ECE = XT_ECN_OP_MATCH_ECE, IPT_ECN_OP_MATCH_CWR = XT_ECN_OP_MATCH_CWR, IPT_ECN_OP_MATCH_MASK = XT_ECN_OP_MATCH_MASK, }; #endif /* IPT_ECN_H */ ���������������������������������������������������������������������������������linux/ppp-comp.h������������������������������������������������������������������������������������0000644�����������������00000004737�14763166027�0007636 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ppp-comp.h - Definitions for doing PPP packet compression. * * Copyright 1994-1998 Paul Mackerras. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. */ #ifndef _NET_PPP_COMP_H #define _NET_PPP_COMP_H /* * CCP codes. */ #define CCP_CONFREQ 1 #define CCP_CONFACK 2 #define CCP_TERMREQ 5 #define CCP_TERMACK 6 #define CCP_RESETREQ 14 #define CCP_RESETACK 15 /* * Max # bytes for a CCP option */ #define CCP_MAX_OPTION_LENGTH 32 /* * Parts of a CCP packet. */ #define CCP_CODE(dp) ((dp)[0]) #define CCP_ID(dp) ((dp)[1]) #define CCP_LENGTH(dp) (((dp)[2] << 8) + (dp)[3]) #define CCP_HDRLEN 4 #define CCP_OPT_CODE(dp) ((dp)[0]) #define CCP_OPT_LENGTH(dp) ((dp)[1]) #define CCP_OPT_MINLEN 2 /* * Definitions for BSD-Compress. */ #define CI_BSD_COMPRESS 21 /* config. option for BSD-Compress */ #define CILEN_BSD_COMPRESS 3 /* length of config. option */ /* Macros for handling the 3rd byte of the BSD-Compress config option. */ #define BSD_NBITS(x) ((x) & 0x1F) /* number of bits requested */ #define BSD_VERSION(x) ((x) >> 5) /* version of option format */ #define BSD_CURRENT_VERSION 1 /* current version number */ #define BSD_MAKE_OPT(v, n) (((v) << 5) | (n)) #define BSD_MIN_BITS 9 /* smallest code size supported */ #define BSD_MAX_BITS 15 /* largest code size supported */ /* * Definitions for Deflate. */ #define CI_DEFLATE 26 /* config option for Deflate */ #define CI_DEFLATE_DRAFT 24 /* value used in original draft RFC */ #define CILEN_DEFLATE 4 /* length of its config option */ #define DEFLATE_MIN_SIZE 9 #define DEFLATE_MAX_SIZE 15 #define DEFLATE_METHOD_VAL 8 #define DEFLATE_SIZE(x) (((x) >> 4) + 8) #define DEFLATE_METHOD(x) ((x) & 0x0F) #define DEFLATE_MAKE_OPT(w) ((((w) - 8) << 4) + DEFLATE_METHOD_VAL) #define DEFLATE_CHK_SEQUENCE 0 /* * Definitions for MPPE. */ #define CI_MPPE 18 /* config option for MPPE */ #define CILEN_MPPE 6 /* length of config option */ /* * Definitions for other, as yet unsupported, compression methods. */ #define CI_PREDICTOR_1 1 /* config option for Predictor-1 */ #define CILEN_PREDICTOR_1 2 /* length of its config option */ #define CI_PREDICTOR_2 2 /* config option for Predictor-2 */ #define CILEN_PREDICTOR_2 2 /* length of its config option */ #endif /* _NET_PPP_COMP_H */ ���������������������������������linux/dqblk_xfs.h�����������������������������������������������������������������������������������0000644�����������������00000021447�14763166027�0010055 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * Copyright (c) 1995-2001,2004 Silicon Graphics, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesset General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _LINUX_DQBLK_XFS_H #define _LINUX_DQBLK_XFS_H #include <linux/types.h> /* * Disk quota - quotactl(2) commands for the XFS Quota Manager (XQM). */ #define XQM_CMD(x) (('X'<<8)+(x)) /* note: forms first QCMD argument */ #define XQM_COMMAND(x) (((x) & (0xff<<8)) == ('X'<<8)) /* test if for XFS */ #define XQM_USRQUOTA 0 /* system call user quota type */ #define XQM_GRPQUOTA 1 /* system call group quota type */ #define XQM_PRJQUOTA 2 /* system call project quota type */ #define XQM_MAXQUOTAS 3 #define Q_XQUOTAON XQM_CMD(1) /* enable accounting/enforcement */ #define Q_XQUOTAOFF XQM_CMD(2) /* disable accounting/enforcement */ #define Q_XGETQUOTA XQM_CMD(3) /* get disk limits and usage */ #define Q_XSETQLIM XQM_CMD(4) /* set disk limits */ #define Q_XGETQSTAT XQM_CMD(5) /* get quota subsystem status */ #define Q_XQUOTARM XQM_CMD(6) /* free disk space used by dquots */ #define Q_XQUOTASYNC XQM_CMD(7) /* delalloc flush, updates dquots */ #define Q_XGETQSTATV XQM_CMD(8) /* newer version of get quota */ #define Q_XGETNEXTQUOTA XQM_CMD(9) /* get disk limits and usage >= ID */ /* * fs_disk_quota structure: * * This contains the current quota information regarding a user/proj/group. * It is 64-bit aligned, and all the blk units are in BBs (Basic Blocks) of * 512 bytes. */ #define FS_DQUOT_VERSION 1 /* fs_disk_quota.d_version */ typedef struct fs_disk_quota { __s8 d_version; /* version of this structure */ __s8 d_flags; /* FS_{USER,PROJ,GROUP}_QUOTA */ __u16 d_fieldmask; /* field specifier */ __u32 d_id; /* user, project, or group ID */ __u64 d_blk_hardlimit;/* absolute limit on disk blks */ __u64 d_blk_softlimit;/* preferred limit on disk blks */ __u64 d_ino_hardlimit;/* maximum # allocated inodes */ __u64 d_ino_softlimit;/* preferred inode limit */ __u64 d_bcount; /* # disk blocks owned by the user */ __u64 d_icount; /* # inodes owned by the user */ __s32 d_itimer; /* zero if within inode limits */ /* if not, we refuse service */ __s32 d_btimer; /* similar to above; for disk blocks */ __u16 d_iwarns; /* # warnings issued wrt num inodes */ __u16 d_bwarns; /* # warnings issued wrt disk blocks */ __s32 d_padding2; /* padding2 - for future use */ __u64 d_rtb_hardlimit;/* absolute limit on realtime blks */ __u64 d_rtb_softlimit;/* preferred limit on RT disk blks */ __u64 d_rtbcount; /* # realtime blocks owned */ __s32 d_rtbtimer; /* similar to above; for RT disk blks */ __u16 d_rtbwarns; /* # warnings issued wrt RT disk blks */ __s16 d_padding3; /* padding3 - for future use */ char d_padding4[8]; /* yet more padding */ } fs_disk_quota_t; /* * These fields are sent to Q_XSETQLIM to specify fields that need to change. */ #define FS_DQ_ISOFT (1<<0) #define FS_DQ_IHARD (1<<1) #define FS_DQ_BSOFT (1<<2) #define FS_DQ_BHARD (1<<3) #define FS_DQ_RTBSOFT (1<<4) #define FS_DQ_RTBHARD (1<<5) #define FS_DQ_LIMIT_MASK (FS_DQ_ISOFT | FS_DQ_IHARD | FS_DQ_BSOFT | \ FS_DQ_BHARD | FS_DQ_RTBSOFT | FS_DQ_RTBHARD) /* * These timers can only be set in super user's dquot. For others, timers are * automatically started and stopped. Superusers timer values set the limits * for the rest. In case these values are zero, the DQ_{F,B}TIMELIMIT values * defined below are used. * These values also apply only to the d_fieldmask field for Q_XSETQLIM. */ #define FS_DQ_BTIMER (1<<6) #define FS_DQ_ITIMER (1<<7) #define FS_DQ_RTBTIMER (1<<8) #define FS_DQ_TIMER_MASK (FS_DQ_BTIMER | FS_DQ_ITIMER | FS_DQ_RTBTIMER) /* * Warning counts are set in both super user's dquot and others. For others, * warnings are set/cleared by the administrators (or automatically by going * below the soft limit). Superusers warning values set the warning limits * for the rest. In case these values are zero, the DQ_{F,B}WARNLIMIT values * defined below are used. * These values also apply only to the d_fieldmask field for Q_XSETQLIM. */ #define FS_DQ_BWARNS (1<<9) #define FS_DQ_IWARNS (1<<10) #define FS_DQ_RTBWARNS (1<<11) #define FS_DQ_WARNS_MASK (FS_DQ_BWARNS | FS_DQ_IWARNS | FS_DQ_RTBWARNS) /* * Accounting values. These can only be set for filesystem with * non-transactional quotas that require quotacheck(8) in userspace. */ #define FS_DQ_BCOUNT (1<<12) #define FS_DQ_ICOUNT (1<<13) #define FS_DQ_RTBCOUNT (1<<14) #define FS_DQ_ACCT_MASK (FS_DQ_BCOUNT | FS_DQ_ICOUNT | FS_DQ_RTBCOUNT) /* * Various flags related to quotactl(2). */ #define FS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */ #define FS_QUOTA_UDQ_ENFD (1<<1) /* user quota limits enforcement */ #define FS_QUOTA_GDQ_ACCT (1<<2) /* group quota accounting */ #define FS_QUOTA_GDQ_ENFD (1<<3) /* group quota limits enforcement */ #define FS_QUOTA_PDQ_ACCT (1<<4) /* project quota accounting */ #define FS_QUOTA_PDQ_ENFD (1<<5) /* project quota limits enforcement */ #define FS_USER_QUOTA (1<<0) /* user quota type */ #define FS_PROJ_QUOTA (1<<1) /* project quota type */ #define FS_GROUP_QUOTA (1<<2) /* group quota type */ /* * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system. * Provides a centralized way to get meta information about the quota subsystem. * eg. space taken up for user and group quotas, number of dquots currently * incore. */ #define FS_QSTAT_VERSION 1 /* fs_quota_stat.qs_version */ /* * Some basic information about 'quota files'. */ typedef struct fs_qfilestat { __u64 qfs_ino; /* inode number */ __u64 qfs_nblks; /* number of BBs 512-byte-blks */ __u32 qfs_nextents; /* number of extents */ } fs_qfilestat_t; typedef struct fs_quota_stat { __s8 qs_version; /* version number for future changes */ __u16 qs_flags; /* FS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */ __s8 qs_pad; /* unused */ fs_qfilestat_t qs_uquota; /* user quota storage information */ fs_qfilestat_t qs_gquota; /* group quota storage information */ __u32 qs_incoredqs; /* number of dquots incore */ __s32 qs_btimelimit; /* limit for blks timer */ __s32 qs_itimelimit; /* limit for inodes timer */ __s32 qs_rtbtimelimit;/* limit for rt blks timer */ __u16 qs_bwarnlimit; /* limit for num warnings */ __u16 qs_iwarnlimit; /* limit for num warnings */ } fs_quota_stat_t; /* * fs_quota_statv is used by Q_XGETQSTATV for a given file system. It provides * a centralized way to get meta information about the quota subsystem. eg. * space taken up for user, group, and project quotas, number of dquots * currently incore. * * This version has proper versioning support with appropriate padding for * future expansions, and ability to expand for future without creating any * backward compatibility issues. * * Q_XGETQSTATV uses the passed in value of the requested version via * fs_quota_statv.qs_version to determine the return data layout of * fs_quota_statv. The kernel will fill the data fields relevant to that * version. * * If kernel does not support user space caller specified version, EINVAL will * be returned. User space caller can then reduce the version number and retry * the same command. */ #define FS_QSTATV_VERSION1 1 /* fs_quota_statv.qs_version */ /* * Some basic information about 'quota files' for Q_XGETQSTATV command */ struct fs_qfilestatv { __u64 qfs_ino; /* inode number */ __u64 qfs_nblks; /* number of BBs 512-byte-blks */ __u32 qfs_nextents; /* number of extents */ __u32 qfs_pad; /* pad for 8-byte alignment */ }; struct fs_quota_statv { __s8 qs_version; /* version for future changes */ __u8 qs_pad1; /* pad for 16bit alignment */ __u16 qs_flags; /* FS_QUOTA_.* flags */ __u32 qs_incoredqs; /* number of dquots incore */ struct fs_qfilestatv qs_uquota; /* user quota information */ struct fs_qfilestatv qs_gquota; /* group quota information */ struct fs_qfilestatv qs_pquota; /* project quota information */ __s32 qs_btimelimit; /* limit for blks timer */ __s32 qs_itimelimit; /* limit for inodes timer */ __s32 qs_rtbtimelimit;/* limit for rt blks timer */ __u16 qs_bwarnlimit; /* limit for num warnings */ __u16 qs_iwarnlimit; /* limit for num warnings */ __u64 qs_pad2[8]; /* for future proofing */ }; #endif /* _LINUX_DQBLK_XFS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/in.h������������������������������������������������������������������������������������������0000644�����������������00000023244�14763166027�0006503 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Definitions of the Internet Protocol. * * Version: @(#)in.h 1.0.1 04/21/93 * * Authors: Original taken from the GNU Project <netinet/in.h> file. * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * * 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. */ #ifndef _LINUX_IN_H #define _LINUX_IN_H #include <linux/types.h> #include <linux/libc-compat.h> #include <linux/socket.h> #if __UAPI_DEF_IN_IPPROTO /* Standard well-defined IP protocols. */ enum { IPPROTO_IP = 0, /* Dummy protocol for TCP */ #define IPPROTO_IP IPPROTO_IP IPPROTO_ICMP = 1, /* Internet Control Message Protocol */ #define IPPROTO_ICMP IPPROTO_ICMP IPPROTO_IGMP = 2, /* Internet Group Management Protocol */ #define IPPROTO_IGMP IPPROTO_IGMP IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94) */ #define IPPROTO_IPIP IPPROTO_IPIP IPPROTO_TCP = 6, /* Transmission Control Protocol */ #define IPPROTO_TCP IPPROTO_TCP IPPROTO_EGP = 8, /* Exterior Gateway Protocol */ #define IPPROTO_EGP IPPROTO_EGP IPPROTO_PUP = 12, /* PUP protocol */ #define IPPROTO_PUP IPPROTO_PUP IPPROTO_UDP = 17, /* User Datagram Protocol */ #define IPPROTO_UDP IPPROTO_UDP IPPROTO_IDP = 22, /* XNS IDP protocol */ #define IPPROTO_IDP IPPROTO_IDP IPPROTO_TP = 29, /* SO Transport Protocol Class 4 */ #define IPPROTO_TP IPPROTO_TP IPPROTO_DCCP = 33, /* Datagram Congestion Control Protocol */ #define IPPROTO_DCCP IPPROTO_DCCP IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling */ #define IPPROTO_IPV6 IPPROTO_IPV6 IPPROTO_RSVP = 46, /* RSVP Protocol */ #define IPPROTO_RSVP IPPROTO_RSVP IPPROTO_GRE = 47, /* Cisco GRE tunnels (rfc 1701,1702) */ #define IPPROTO_GRE IPPROTO_GRE IPPROTO_ESP = 50, /* Encapsulation Security Payload protocol */ #define IPPROTO_ESP IPPROTO_ESP IPPROTO_AH = 51, /* Authentication Header protocol */ #define IPPROTO_AH IPPROTO_AH IPPROTO_MTP = 92, /* Multicast Transport Protocol */ #define IPPROTO_MTP IPPROTO_MTP IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET */ #define IPPROTO_BEETPH IPPROTO_BEETPH IPPROTO_ENCAP = 98, /* Encapsulation Header */ #define IPPROTO_ENCAP IPPROTO_ENCAP IPPROTO_PIM = 103, /* Protocol Independent Multicast */ #define IPPROTO_PIM IPPROTO_PIM IPPROTO_COMP = 108, /* Compression Header Protocol */ #define IPPROTO_COMP IPPROTO_COMP IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */ #define IPPROTO_SCTP IPPROTO_SCTP IPPROTO_UDPLITE = 136, /* UDP-Lite (RFC 3828) */ #define IPPROTO_UDPLITE IPPROTO_UDPLITE IPPROTO_MPLS = 137, /* MPLS in IP (RFC 4023) */ #define IPPROTO_MPLS IPPROTO_MPLS IPPROTO_RAW = 255, /* Raw IP packets */ #define IPPROTO_RAW IPPROTO_RAW IPPROTO_MAX }; #endif #if __UAPI_DEF_IN_ADDR /* Internet address. */ struct in_addr { __be32 s_addr; }; #endif #define IP_TOS 1 #define IP_TTL 2 #define IP_HDRINCL 3 #define IP_OPTIONS 4 #define IP_ROUTER_ALERT 5 #define IP_RECVOPTS 6 #define IP_RETOPTS 7 #define IP_PKTINFO 8 #define IP_PKTOPTIONS 9 #define IP_MTU_DISCOVER 10 #define IP_RECVERR 11 #define IP_RECVTTL 12 #define IP_RECVTOS 13 #define IP_MTU 14 #define IP_FREEBIND 15 #define IP_IPSEC_POLICY 16 #define IP_XFRM_POLICY 17 #define IP_PASSSEC 18 #define IP_TRANSPARENT 19 /* BSD compatibility */ #define IP_RECVRETOPTS IP_RETOPTS /* TProxy original addresses */ #define IP_ORIGDSTADDR 20 #define IP_RECVORIGDSTADDR IP_ORIGDSTADDR #define IP_MINTTL 21 #define IP_NODEFRAG 22 #define IP_CHECKSUM 23 #define IP_BIND_ADDRESS_NO_PORT 24 #define IP_RECVFRAGSIZE 25 /* IP_MTU_DISCOVER values */ #define IP_PMTUDISC_DONT 0 /* Never send DF frames */ #define IP_PMTUDISC_WANT 1 /* Use per route hints */ #define IP_PMTUDISC_DO 2 /* Always DF */ #define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu */ /* Always use interface mtu (ignores dst pmtu) but don't set DF flag. * Also incoming ICMP frag_needed notifications will be ignored on * this socket to prevent accepting spoofed ones. */ #define IP_PMTUDISC_INTERFACE 4 /* weaker version of IP_PMTUDISC_INTERFACE, which allos packets to get * fragmented if they exeed the interface mtu */ #define IP_PMTUDISC_OMIT 5 #define IP_MULTICAST_IF 32 #define IP_MULTICAST_TTL 33 #define IP_MULTICAST_LOOP 34 #define IP_ADD_MEMBERSHIP 35 #define IP_DROP_MEMBERSHIP 36 #define IP_UNBLOCK_SOURCE 37 #define IP_BLOCK_SOURCE 38 #define IP_ADD_SOURCE_MEMBERSHIP 39 #define IP_DROP_SOURCE_MEMBERSHIP 40 #define IP_MSFILTER 41 #define MCAST_JOIN_GROUP 42 #define MCAST_BLOCK_SOURCE 43 #define MCAST_UNBLOCK_SOURCE 44 #define MCAST_LEAVE_GROUP 45 #define MCAST_JOIN_SOURCE_GROUP 46 #define MCAST_LEAVE_SOURCE_GROUP 47 #define MCAST_MSFILTER 48 #define IP_MULTICAST_ALL 49 #define IP_UNICAST_IF 50 #define IP_LOCAL_PORT_RANGE 51 #define IP_PROTOCOL 52 #define MCAST_EXCLUDE 0 #define MCAST_INCLUDE 1 /* These need to appear somewhere around here */ #define IP_DEFAULT_MULTICAST_TTL 1 #define IP_DEFAULT_MULTICAST_LOOP 1 /* Request struct for multicast socket ops */ #if __UAPI_DEF_IP_MREQ struct ip_mreq { struct in_addr imr_multiaddr; /* IP multicast address of group */ struct in_addr imr_interface; /* local IP address of interface */ }; struct ip_mreqn { struct in_addr imr_multiaddr; /* IP multicast address of group */ struct in_addr imr_address; /* local IP address of interface */ int imr_ifindex; /* Interface index */ }; struct ip_mreq_source { __be32 imr_multiaddr; __be32 imr_interface; __be32 imr_sourceaddr; }; struct ip_msfilter { __be32 imsf_multiaddr; __be32 imsf_interface; __u32 imsf_fmode; __u32 imsf_numsrc; __be32 imsf_slist[1]; }; #define IP_MSFILTER_SIZE(numsrc) \ (sizeof(struct ip_msfilter) - sizeof(__u32) \ + (numsrc) * sizeof(__u32)) struct group_req { __u32 gr_interface; /* interface index */ struct __kernel_sockaddr_storage gr_group; /* group address */ }; struct group_source_req { __u32 gsr_interface; /* interface index */ struct __kernel_sockaddr_storage gsr_group; /* group address */ struct __kernel_sockaddr_storage gsr_source; /* source address */ }; struct group_filter { __u32 gf_interface; /* interface index */ struct __kernel_sockaddr_storage gf_group; /* multicast address */ __u32 gf_fmode; /* filter mode */ __u32 gf_numsrc; /* number of sources */ struct __kernel_sockaddr_storage gf_slist[1]; /* interface index */ }; #define GROUP_FILTER_SIZE(numsrc) \ (sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage) \ + (numsrc) * sizeof(struct __kernel_sockaddr_storage)) #endif #if __UAPI_DEF_IN_PKTINFO struct in_pktinfo { int ipi_ifindex; struct in_addr ipi_spec_dst; struct in_addr ipi_addr; }; #endif /* Structure describing an Internet (IP) socket address. */ #if __UAPI_DEF_SOCKADDR_IN #define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ struct sockaddr_in { __kernel_sa_family_t sin_family; /* Address family */ __be16 sin_port; /* Port number */ struct in_addr sin_addr; /* Internet address */ /* Pad to size of `struct sockaddr'. */ unsigned char __pad[__SOCK_SIZE__ - sizeof(short int) - sizeof(unsigned short int) - sizeof(struct in_addr)]; }; #define sin_zero __pad /* for BSD UNIX comp. -FvK */ #endif #if __UAPI_DEF_IN_CLASS /* * Definitions of the bits in an Internet address integer. * On subnets, host and network parts are found according * to the subnet mask, not these masks. */ #define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0) #define IN_CLASSA_NET 0xff000000 #define IN_CLASSA_NSHIFT 24 #define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) #define IN_CLASSA_MAX 128 #define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000) #define IN_CLASSB_NET 0xffff0000 #define IN_CLASSB_NSHIFT 16 #define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) #define IN_CLASSB_MAX 65536 #define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000) #define IN_CLASSC_NET 0xffffff00 #define IN_CLASSC_NSHIFT 8 #define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) #define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000) #define IN_MULTICAST(a) IN_CLASSD(a) #define IN_MULTICAST_NET 0xF0000000 #define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) #define IN_BADCLASS(a) IN_EXPERIMENTAL((a)) /* Address to accept any incoming messages. */ #define INADDR_ANY ((unsigned long int) 0x00000000) /* Address to send to all hosts. */ #define INADDR_BROADCAST ((unsigned long int) 0xffffffff) /* Address indicating an error return. */ #define INADDR_NONE ((unsigned long int) 0xffffffff) /* Dummy address for src of ICMP replies if no real address is set (RFC7600). */ #define INADDR_DUMMY ((unsigned long int) 0xc0000008) /* Network number for local host loopback. */ #define IN_LOOPBACKNET 127 /* Address to loopback in software to local host. */ #define INADDR_LOOPBACK 0x7f000001 /* 127.0.0.1 */ #define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000) /* Defines for Multicast INADDR */ #define INADDR_UNSPEC_GROUP 0xe0000000U /* 224.0.0.0 */ #define INADDR_ALLHOSTS_GROUP 0xe0000001U /* 224.0.0.1 */ #define INADDR_ALLRTRS_GROUP 0xe0000002U /* 224.0.0.2 */ #define INADDR_MAX_LOCAL_GROUP 0xe00000ffU /* 224.0.0.255 */ #endif /* <asm/byteorder.h> contains the htonl type stuff.. */ #include <asm/byteorder.h> #endif /* _LINUX_IN_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/omap3isp.h������������������������������������������������������������������������������������0000644�����������������00000050565�14763166027�0007636 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * omap3isp.h * * TI OMAP3 ISP - User-space API * * Copyright (C) 2010 Nokia Corporation * Copyright (C) 2009 Texas Instruments, Inc. * * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> * Sakari Ailus <sakari.ailus@iki.fi> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * 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., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #ifndef OMAP3_ISP_USER_H #define OMAP3_ISP_USER_H #include <linux/types.h> #include <linux/videodev2.h> /* * Private IOCTLs * * VIDIOC_OMAP3ISP_CCDC_CFG: Set CCDC configuration * VIDIOC_OMAP3ISP_PRV_CFG: Set preview engine configuration * VIDIOC_OMAP3ISP_AEWB_CFG: Set AEWB module configuration * VIDIOC_OMAP3ISP_HIST_CFG: Set histogram module configuration * VIDIOC_OMAP3ISP_AF_CFG: Set auto-focus module configuration * VIDIOC_OMAP3ISP_STAT_REQ: Read statistics (AEWB/AF/histogram) data * VIDIOC_OMAP3ISP_STAT_EN: Enable/disable a statistics module */ #define VIDIOC_OMAP3ISP_CCDC_CFG \ _IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct omap3isp_ccdc_update_config) #define VIDIOC_OMAP3ISP_PRV_CFG \ _IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct omap3isp_prev_update_config) #define VIDIOC_OMAP3ISP_AEWB_CFG \ _IOWR('V', BASE_VIDIOC_PRIVATE + 3, struct omap3isp_h3a_aewb_config) #define VIDIOC_OMAP3ISP_HIST_CFG \ _IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct omap3isp_hist_config) #define VIDIOC_OMAP3ISP_AF_CFG \ _IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct omap3isp_h3a_af_config) #define VIDIOC_OMAP3ISP_STAT_REQ \ _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct omap3isp_stat_data) #define VIDIOC_OMAP3ISP_STAT_REQ_TIME32 \ _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct omap3isp_stat_data_time32) #define VIDIOC_OMAP3ISP_STAT_EN \ _IOWR('V', BASE_VIDIOC_PRIVATE + 7, unsigned long) /* * Events * * V4L2_EVENT_OMAP3ISP_AEWB: AEWB statistics data ready * V4L2_EVENT_OMAP3ISP_AF: AF statistics data ready * V4L2_EVENT_OMAP3ISP_HIST: Histogram statistics data ready */ #define V4L2_EVENT_OMAP3ISP_CLASS (V4L2_EVENT_PRIVATE_START | 0x100) #define V4L2_EVENT_OMAP3ISP_AEWB (V4L2_EVENT_OMAP3ISP_CLASS | 0x1) #define V4L2_EVENT_OMAP3ISP_AF (V4L2_EVENT_OMAP3ISP_CLASS | 0x2) #define V4L2_EVENT_OMAP3ISP_HIST (V4L2_EVENT_OMAP3ISP_CLASS | 0x3) struct omap3isp_stat_event_status { __u32 frame_number; __u16 config_counter; __u8 buf_err; }; /* AE/AWB related structures and flags*/ /* H3A Range Constants */ #define OMAP3ISP_AEWB_MAX_SATURATION_LIM 1023 #define OMAP3ISP_AEWB_MIN_WIN_H 2 #define OMAP3ISP_AEWB_MAX_WIN_H 256 #define OMAP3ISP_AEWB_MIN_WIN_W 6 #define OMAP3ISP_AEWB_MAX_WIN_W 256 #define OMAP3ISP_AEWB_MIN_WINVC 1 #define OMAP3ISP_AEWB_MIN_WINHC 1 #define OMAP3ISP_AEWB_MAX_WINVC 128 #define OMAP3ISP_AEWB_MAX_WINHC 36 #define OMAP3ISP_AEWB_MAX_WINSTART 4095 #define OMAP3ISP_AEWB_MIN_SUB_INC 2 #define OMAP3ISP_AEWB_MAX_SUB_INC 32 #define OMAP3ISP_AEWB_MAX_BUF_SIZE 83600 #define OMAP3ISP_AF_IIRSH_MIN 0 #define OMAP3ISP_AF_IIRSH_MAX 4095 #define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MIN 1 #define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MAX 36 #define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MIN 1 #define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MAX 128 #define OMAP3ISP_AF_PAXEL_INCREMENT_MIN 2 #define OMAP3ISP_AF_PAXEL_INCREMENT_MAX 32 #define OMAP3ISP_AF_PAXEL_HEIGHT_MIN 2 #define OMAP3ISP_AF_PAXEL_HEIGHT_MAX 256 #define OMAP3ISP_AF_PAXEL_WIDTH_MIN 16 #define OMAP3ISP_AF_PAXEL_WIDTH_MAX 256 #define OMAP3ISP_AF_PAXEL_HZSTART_MIN 1 #define OMAP3ISP_AF_PAXEL_HZSTART_MAX 4095 #define OMAP3ISP_AF_PAXEL_VTSTART_MIN 0 #define OMAP3ISP_AF_PAXEL_VTSTART_MAX 4095 #define OMAP3ISP_AF_THRESHOLD_MAX 255 #define OMAP3ISP_AF_COEF_MAX 4095 #define OMAP3ISP_AF_PAXEL_SIZE 48 #define OMAP3ISP_AF_MAX_BUF_SIZE 221184 /** * struct omap3isp_h3a_aewb_config - AE AWB configuration reset values * saturation_limit: Saturation limit. * @win_height: Window Height. Range 2 - 256, even values only. * @win_width: Window Width. Range 6 - 256, even values only. * @ver_win_count: Vertical Window Count. Range 1 - 128. * @hor_win_count: Horizontal Window Count. Range 1 - 36. * @ver_win_start: Vertical Window Start. Range 0 - 4095. * @hor_win_start: Horizontal Window Start. Range 0 - 4095. * @blk_ver_win_start: Black Vertical Windows Start. Range 0 - 4095. * @blk_win_height: Black Window Height. Range 2 - 256, even values only. * @subsample_ver_inc: Subsample Vertical points increment Range 2 - 32, even * values only. * @subsample_hor_inc: Subsample Horizontal points increment Range 2 - 32, even * values only. * @alaw_enable: AEW ALAW EN flag. */ struct omap3isp_h3a_aewb_config { /* * Common fields. * They should be the first ones and must be in the same order as in * ispstat_generic_config struct. */ __u32 buf_size; __u16 config_counter; /* Private fields */ __u16 saturation_limit; __u16 win_height; __u16 win_width; __u16 ver_win_count; __u16 hor_win_count; __u16 ver_win_start; __u16 hor_win_start; __u16 blk_ver_win_start; __u16 blk_win_height; __u16 subsample_ver_inc; __u16 subsample_hor_inc; __u8 alaw_enable; }; /** * struct omap3isp_stat_data - Statistic data sent to or received from user * @ts: Timestamp of returned framestats. * @buf: Pointer to pass to user. * @frame_number: Frame number of requested stats. * @cur_frame: Current frame number being processed. * @config_counter: Number of the configuration associated with the data. */ struct omap3isp_stat_data { struct timeval ts; void *buf; __u32 buf_size; __u16 frame_number; __u16 cur_frame; __u16 config_counter; }; /* Histogram related structs */ /* Flags for number of bins */ #define OMAP3ISP_HIST_BINS_32 0 #define OMAP3ISP_HIST_BINS_64 1 #define OMAP3ISP_HIST_BINS_128 2 #define OMAP3ISP_HIST_BINS_256 3 /* Number of bins * 4 colors * 4-bytes word */ #define OMAP3ISP_HIST_MEM_SIZE_BINS(n) ((1 << ((n)+5))*4*4) #define OMAP3ISP_HIST_MEM_SIZE 1024 #define OMAP3ISP_HIST_MIN_REGIONS 1 #define OMAP3ISP_HIST_MAX_REGIONS 4 #define OMAP3ISP_HIST_MAX_WB_GAIN 255 #define OMAP3ISP_HIST_MIN_WB_GAIN 0 #define OMAP3ISP_HIST_MAX_BIT_WIDTH 14 #define OMAP3ISP_HIST_MIN_BIT_WIDTH 8 #define OMAP3ISP_HIST_MAX_WG 4 #define OMAP3ISP_HIST_MAX_BUF_SIZE 4096 /* Source */ #define OMAP3ISP_HIST_SOURCE_CCDC 0 #define OMAP3ISP_HIST_SOURCE_MEM 1 /* CFA pattern */ #define OMAP3ISP_HIST_CFA_BAYER 0 #define OMAP3ISP_HIST_CFA_FOVEONX3 1 struct omap3isp_hist_region { __u16 h_start; __u16 h_end; __u16 v_start; __u16 v_end; }; struct omap3isp_hist_config { /* * Common fields. * They should be the first ones and must be in the same order as in * ispstat_generic_config struct. */ __u32 buf_size; __u16 config_counter; __u8 num_acc_frames; /* Num of image frames to be processed and accumulated for each histogram frame */ __u16 hist_bins; /* number of bins: 32, 64, 128, or 256 */ __u8 cfa; /* BAYER or FOVEON X3 */ __u8 wg[OMAP3ISP_HIST_MAX_WG]; /* White Balance Gain */ __u8 num_regions; /* number of regions to be configured */ struct omap3isp_hist_region region[OMAP3ISP_HIST_MAX_REGIONS]; }; /* Auto Focus related structs */ #define OMAP3ISP_AF_NUM_COEF 11 enum omap3isp_h3a_af_fvmode { OMAP3ISP_AF_MODE_SUMMED = 0, OMAP3ISP_AF_MODE_PEAK = 1 }; /* Red, Green, and blue pixel location in the AF windows */ enum omap3isp_h3a_af_rgbpos { OMAP3ISP_AF_GR_GB_BAYER = 0, /* GR and GB as Bayer pattern */ OMAP3ISP_AF_RG_GB_BAYER = 1, /* RG and GB as Bayer pattern */ OMAP3ISP_AF_GR_BG_BAYER = 2, /* GR and BG as Bayer pattern */ OMAP3ISP_AF_RG_BG_BAYER = 3, /* RG and BG as Bayer pattern */ OMAP3ISP_AF_GG_RB_CUSTOM = 4, /* GG and RB as custom pattern */ OMAP3ISP_AF_RB_GG_CUSTOM = 5 /* RB and GG as custom pattern */ }; /* Contains the information regarding the Horizontal Median Filter */ struct omap3isp_h3a_af_hmf { __u8 enable; /* Status of Horizontal Median Filter */ __u8 threshold; /* Threshold Value for Horizontal Median Filter */ }; /* Contains the information regarding the IIR Filters */ struct omap3isp_h3a_af_iir { __u16 h_start; /* IIR horizontal start */ __u16 coeff_set0[OMAP3ISP_AF_NUM_COEF]; /* Filter coefficient, set 0 */ __u16 coeff_set1[OMAP3ISP_AF_NUM_COEF]; /* Filter coefficient, set 1 */ }; /* Contains the information regarding the Paxels Structure in AF Engine */ struct omap3isp_h3a_af_paxel { __u16 h_start; /* Horizontal Start Position */ __u16 v_start; /* Vertical Start Position */ __u8 width; /* Width of the Paxel */ __u8 height; /* Height of the Paxel */ __u8 h_cnt; /* Horizontal Count */ __u8 v_cnt; /* vertical Count */ __u8 line_inc; /* Line Increment */ }; /* Contains the parameters required for hardware set up of AF Engine */ struct omap3isp_h3a_af_config { /* * Common fields. * They should be the first ones and must be in the same order as in * ispstat_generic_config struct. */ __u32 buf_size; __u16 config_counter; struct omap3isp_h3a_af_hmf hmf; /* HMF configurations */ struct omap3isp_h3a_af_iir iir; /* IIR filter configurations */ struct omap3isp_h3a_af_paxel paxel; /* Paxel parameters */ enum omap3isp_h3a_af_rgbpos rgb_pos; /* RGB Positions */ enum omap3isp_h3a_af_fvmode fvmode; /* Accumulator mode */ __u8 alaw_enable; /* AF ALAW status */ }; /* ISP CCDC structs */ /* Abstraction layer CCDC configurations */ #define OMAP3ISP_CCDC_ALAW (1 << 0) #define OMAP3ISP_CCDC_LPF (1 << 1) #define OMAP3ISP_CCDC_BLCLAMP (1 << 2) #define OMAP3ISP_CCDC_BCOMP (1 << 3) #define OMAP3ISP_CCDC_FPC (1 << 4) #define OMAP3ISP_CCDC_CULL (1 << 5) #define OMAP3ISP_CCDC_CONFIG_LSC (1 << 7) #define OMAP3ISP_CCDC_TBL_LSC (1 << 8) #define OMAP3ISP_RGB_MAX 3 /* Enumeration constants for Alaw input width */ enum omap3isp_alaw_ipwidth { OMAP3ISP_ALAW_BIT12_3 = 0x3, OMAP3ISP_ALAW_BIT11_2 = 0x4, OMAP3ISP_ALAW_BIT10_1 = 0x5, OMAP3ISP_ALAW_BIT9_0 = 0x6 }; /** * struct omap3isp_ccdc_lsc_config - LSC configuration * @offset: Table Offset of the gain table. * @gain_mode_n: Vertical dimension of a paxel in LSC configuration. * @gain_mode_m: Horizontal dimension of a paxel in LSC configuration. * @gain_format: Gain table format. * @fmtsph: Start pixel horizontal from start of the HS sync pulse. * @fmtlnh: Number of pixels in horizontal direction to use for the data * reformatter. * @fmtslv: Start line from start of VS sync pulse for the data reformatter. * @fmtlnv: Number of lines in vertical direction for the data reformatter. * @initial_x: X position, in pixels, of the first active pixel in reference * to the first active paxel. Must be an even number. * @initial_y: Y position, in pixels, of the first active pixel in reference * to the first active paxel. Must be an even number. * @size: Size of LSC gain table. Filled when loaded from userspace. */ struct omap3isp_ccdc_lsc_config { __u16 offset; __u8 gain_mode_n; __u8 gain_mode_m; __u8 gain_format; __u16 fmtsph; __u16 fmtlnh; __u16 fmtslv; __u16 fmtlnv; __u8 initial_x; __u8 initial_y; __u32 size; }; /** * struct omap3isp_ccdc_bclamp - Optical & Digital black clamp subtract * @obgain: Optical black average gain. * @obstpixel: Start Pixel w.r.t. HS pulse in Optical black sample. * @oblines: Optical Black Sample lines. * @oblen: Optical Black Sample Length. * @dcsubval: Digital Black Clamp subtract value. */ struct omap3isp_ccdc_bclamp { __u8 obgain; __u8 obstpixel; __u8 oblines; __u8 oblen; __u16 dcsubval; }; /** * struct omap3isp_ccdc_fpc - Faulty Pixels Correction * @fpnum: Number of faulty pixels to be corrected in the frame. * @fpcaddr: Memory address of the FPC Table */ struct omap3isp_ccdc_fpc { __u16 fpnum; __u32 fpcaddr; }; /** * struct omap3isp_ccdc_blcomp - Black Level Compensation parameters * @b_mg: B/Mg pixels. 2's complement. -128 to +127. * @gb_g: Gb/G pixels. 2's complement. -128 to +127. * @gr_cy: Gr/Cy pixels. 2's complement. -128 to +127. * @r_ye: R/Ye pixels. 2's complement. -128 to +127. */ struct omap3isp_ccdc_blcomp { __u8 b_mg; __u8 gb_g; __u8 gr_cy; __u8 r_ye; }; /** * omap3isp_ccdc_culling - Culling parameters * @v_pattern: Vertical culling pattern. * @h_odd: Horizontal Culling pattern for odd lines. * @h_even: Horizontal Culling pattern for even lines. */ struct omap3isp_ccdc_culling { __u8 v_pattern; __u16 h_odd; __u16 h_even; }; /** * omap3isp_ccdc_update_config - CCDC configuration * @update: Specifies which CCDC registers should be updated. * @flag: Specifies which CCDC functions should be enabled. * @alawip: Enable/Disable A-Law compression. * @bclamp: Black clamp control register. * @blcomp: Black level compensation value for RGrGbB Pixels. 2's complement. * @fpc: Number of faulty pixels corrected in the frame, address of FPC table. * @cull: Cull control register. * @lsc: Pointer to LSC gain table. */ struct omap3isp_ccdc_update_config { __u16 update; __u16 flag; enum omap3isp_alaw_ipwidth alawip; struct omap3isp_ccdc_bclamp *bclamp; struct omap3isp_ccdc_blcomp *blcomp; struct omap3isp_ccdc_fpc *fpc; struct omap3isp_ccdc_lsc_config *lsc_cfg; struct omap3isp_ccdc_culling *cull; __u8 *lsc; }; /* Preview configurations */ #define OMAP3ISP_PREV_LUMAENH (1 << 0) #define OMAP3ISP_PREV_INVALAW (1 << 1) #define OMAP3ISP_PREV_HRZ_MED (1 << 2) #define OMAP3ISP_PREV_CFA (1 << 3) #define OMAP3ISP_PREV_CHROMA_SUPP (1 << 4) #define OMAP3ISP_PREV_WB (1 << 5) #define OMAP3ISP_PREV_BLKADJ (1 << 6) #define OMAP3ISP_PREV_RGB2RGB (1 << 7) #define OMAP3ISP_PREV_COLOR_CONV (1 << 8) #define OMAP3ISP_PREV_YC_LIMIT (1 << 9) #define OMAP3ISP_PREV_DEFECT_COR (1 << 10) /* Bit 11 was OMAP3ISP_PREV_GAMMABYPASS, now merged with OMAP3ISP_PREV_GAMMA */ #define OMAP3ISP_PREV_DRK_FRM_CAPTURE (1 << 12) #define OMAP3ISP_PREV_DRK_FRM_SUBTRACT (1 << 13) #define OMAP3ISP_PREV_LENS_SHADING (1 << 14) #define OMAP3ISP_PREV_NF (1 << 15) #define OMAP3ISP_PREV_GAMMA (1 << 16) #define OMAP3ISP_PREV_NF_TBL_SIZE 64 #define OMAP3ISP_PREV_CFA_TBL_SIZE 576 #define OMAP3ISP_PREV_CFA_BLK_SIZE (OMAP3ISP_PREV_CFA_TBL_SIZE / 4) #define OMAP3ISP_PREV_GAMMA_TBL_SIZE 1024 #define OMAP3ISP_PREV_YENH_TBL_SIZE 128 #define OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS 4 /** * struct omap3isp_prev_hmed - Horizontal Median Filter * @odddist: Distance between consecutive pixels of same color in the odd line. * @evendist: Distance between consecutive pixels of same color in the even * line. * @thres: Horizontal median filter threshold. */ struct omap3isp_prev_hmed { __u8 odddist; __u8 evendist; __u8 thres; }; /* * Enumeration for CFA Formats supported by preview */ enum omap3isp_cfa_fmt { OMAP3ISP_CFAFMT_BAYER, OMAP3ISP_CFAFMT_SONYVGA, OMAP3ISP_CFAFMT_RGBFOVEON, OMAP3ISP_CFAFMT_DNSPL, OMAP3ISP_CFAFMT_HONEYCOMB, OMAP3ISP_CFAFMT_RRGGBBFOVEON }; /** * struct omap3isp_prev_cfa - CFA Interpolation * @format: CFA Format Enum value supported by preview. * @gradthrs_vert: CFA Gradient Threshold - Vertical. * @gradthrs_horz: CFA Gradient Threshold - Horizontal. * @table: Pointer to the CFA table. */ struct omap3isp_prev_cfa { enum omap3isp_cfa_fmt format; __u8 gradthrs_vert; __u8 gradthrs_horz; __u32 table[4][OMAP3ISP_PREV_CFA_BLK_SIZE]; }; /** * struct omap3isp_prev_csup - Chrominance Suppression * @gain: Gain. * @thres: Threshold. * @hypf_en: Flag to enable/disable the High Pass Filter. */ struct omap3isp_prev_csup { __u8 gain; __u8 thres; __u8 hypf_en; }; /** * struct omap3isp_prev_wbal - White Balance * @dgain: Digital gain (U10Q8). * @coef3: White balance gain - COEF 3 (U8Q5). * @coef2: White balance gain - COEF 2 (U8Q5). * @coef1: White balance gain - COEF 1 (U8Q5). * @coef0: White balance gain - COEF 0 (U8Q5). */ struct omap3isp_prev_wbal { __u16 dgain; __u8 coef3; __u8 coef2; __u8 coef1; __u8 coef0; }; /** * struct omap3isp_prev_blkadj - Black Level Adjustment * @red: Black level offset adjustment for Red in 2's complement format * @green: Black level offset adjustment for Green in 2's complement format * @blue: Black level offset adjustment for Blue in 2's complement format */ struct omap3isp_prev_blkadj { /*Black level offset adjustment for Red in 2's complement format */ __u8 red; /*Black level offset adjustment for Green in 2's complement format */ __u8 green; /* Black level offset adjustment for Blue in 2's complement format */ __u8 blue; }; /** * struct omap3isp_prev_rgbtorgb - RGB to RGB Blending * @matrix: Blending values(S12Q8 format) * [RR] [GR] [BR] * [RG] [GG] [BG] * [RB] [GB] [BB] * @offset: Blending offset value for R,G,B in 2's complement integer format. */ struct omap3isp_prev_rgbtorgb { __u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX]; __u16 offset[OMAP3ISP_RGB_MAX]; }; /** * struct omap3isp_prev_csc - Color Space Conversion from RGB-YCbYCr * @matrix: Color space conversion coefficients(S10Q8) * [CSCRY] [CSCGY] [CSCBY] * [CSCRCB] [CSCGCB] [CSCBCB] * [CSCRCR] [CSCGCR] [CSCBCR] * @offset: CSC offset values for Y offset, CB offset and CR offset respectively */ struct omap3isp_prev_csc { __u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX]; __s16 offset[OMAP3ISP_RGB_MAX]; }; /** * struct omap3isp_prev_yclimit - Y, C Value Limit * @minC: Minimum C value * @maxC: Maximum C value * @minY: Minimum Y value * @maxY: Maximum Y value */ struct omap3isp_prev_yclimit { __u8 minC; __u8 maxC; __u8 minY; __u8 maxY; }; /** * struct omap3isp_prev_dcor - Defect correction * @couplet_mode_en: Flag to enable or disable the couplet dc Correction in NF * @detect_correct: Thresholds for correction bit 0:10 detect 16:25 correct */ struct omap3isp_prev_dcor { __u8 couplet_mode_en; __u32 detect_correct[OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS]; }; /** * struct omap3isp_prev_nf - Noise Filter * @spread: Spread value to be used in Noise Filter * @table: Pointer to the Noise Filter table */ struct omap3isp_prev_nf { __u8 spread; __u32 table[OMAP3ISP_PREV_NF_TBL_SIZE]; }; /** * struct omap3isp_prev_gtables - Gamma correction tables * @red: Array for red gamma table. * @green: Array for green gamma table. * @blue: Array for blue gamma table. */ struct omap3isp_prev_gtables { __u32 red[OMAP3ISP_PREV_GAMMA_TBL_SIZE]; __u32 green[OMAP3ISP_PREV_GAMMA_TBL_SIZE]; __u32 blue[OMAP3ISP_PREV_GAMMA_TBL_SIZE]; }; /** * struct omap3isp_prev_luma - Luma enhancement * @table: Array for luma enhancement table. */ struct omap3isp_prev_luma { __u32 table[OMAP3ISP_PREV_YENH_TBL_SIZE]; }; /** * struct omap3isp_prev_update_config - Preview engine configuration (user) * @update: Specifies which ISP Preview registers should be updated. * @flag: Specifies which ISP Preview functions should be enabled. * @shading_shift: 3bit value of shift used in shading compensation. * @luma: Pointer to luma enhancement structure. * @hmed: Pointer to structure containing the odd and even distance. * between the pixels in the image along with the filter threshold. * @cfa: Pointer to structure containing the CFA interpolation table, CFA. * format in the image, vertical and horizontal gradient threshold. * @csup: Pointer to Structure for Chrominance Suppression coefficients. * @wbal: Pointer to structure for White Balance. * @blkadj: Pointer to structure for Black Adjustment. * @rgb2rgb: Pointer to structure for RGB to RGB Blending. * @csc: Pointer to structure for Color Space Conversion from RGB-YCbYCr. * @yclimit: Pointer to structure for Y, C Value Limit. * @dcor: Pointer to structure for defect correction. * @nf: Pointer to structure for Noise Filter * @gamma: Pointer to gamma structure. */ struct omap3isp_prev_update_config { __u32 update; __u32 flag; __u32 shading_shift; struct omap3isp_prev_luma *luma; struct omap3isp_prev_hmed *hmed; struct omap3isp_prev_cfa *cfa; struct omap3isp_prev_csup *csup; struct omap3isp_prev_wbal *wbal; struct omap3isp_prev_blkadj *blkadj; struct omap3isp_prev_rgbtorgb *rgb2rgb; struct omap3isp_prev_csc *csc; struct omap3isp_prev_yclimit *yclimit; struct omap3isp_prev_dcor *dcor; struct omap3isp_prev_nf *nf; struct omap3isp_prev_gtables *gamma; }; #endif /* OMAP3_ISP_USER_H */ �������������������������������������������������������������������������������������������������������������������������������������������linux/i8k.h�����������������������������������������������������������������������������������������0000644�����������������00000002770�14763166027�0006571 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * i8k.h -- Linux driver for accessing the SMM BIOS on Dell laptops * * Copyright (C) 2001 Massimo Dal Zotto <dz@debian.org> * * 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, 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. */ #ifndef _LINUX_I8K_H #define _LINUX_I8K_H #define I8K_PROC "/proc/i8k" #define I8K_PROC_FMT "1.0" #define I8K_BIOS_VERSION _IOR ('i', 0x80, int) /* broken: meant 4 bytes */ #define I8K_MACHINE_ID _IOR ('i', 0x81, int) /* broken: meant 16 bytes */ #define I8K_POWER_STATUS _IOR ('i', 0x82, size_t) #define I8K_FN_STATUS _IOR ('i', 0x83, size_t) #define I8K_GET_TEMP _IOR ('i', 0x84, size_t) #define I8K_GET_SPEED _IOWR('i', 0x85, size_t) #define I8K_GET_FAN _IOWR('i', 0x86, size_t) #define I8K_SET_FAN _IOWR('i', 0x87, size_t) #define I8K_FAN_LEFT 1 #define I8K_FAN_RIGHT 0 #define I8K_FAN_OFF 0 #define I8K_FAN_LOW 1 #define I8K_FAN_HIGH 2 #define I8K_FAN_TURBO 3 #define I8K_FAN_MAX I8K_FAN_TURBO #define I8K_VOL_UP 1 #define I8K_VOL_DOWN 2 #define I8K_VOL_MUTE 4 #define I8K_AC 1 #define I8K_BATTERY 0 #endif ��������linux/input-event-codes.h���������������������������������������������������������������������������0000644�����������������00000060266�14763166027�0011453 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Input event codes * * *** IMPORTANT *** * This file is not only included from C-code but also from devicetree source * files. As such this file MUST only contain comments and defines. * * Copyright (c) 1999-2002 Vojtech Pavlik * Copyright (c) 2015 Hans de Goede <hdegoede@redhat.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #ifndef _INPUT_EVENT_CODES_H #define _INPUT_EVENT_CODES_H /* * Device properties and quirks */ #define INPUT_PROP_POINTER 0x00 /* needs a pointer */ #define INPUT_PROP_DIRECT 0x01 /* direct input devices */ #define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */ #define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */ #define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */ #define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */ #define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */ #define INPUT_PROP_MAX 0x1f #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) /* * Event types */ #define EV_SYN 0x00 #define EV_KEY 0x01 #define EV_REL 0x02 #define EV_ABS 0x03 #define EV_MSC 0x04 #define EV_SW 0x05 #define EV_LED 0x11 #define EV_SND 0x12 #define EV_REP 0x14 #define EV_FF 0x15 #define EV_PWR 0x16 #define EV_FF_STATUS 0x17 #define EV_MAX 0x1f #define EV_CNT (EV_MAX+1) /* * Synchronization events. */ #define SYN_REPORT 0 #define SYN_CONFIG 1 #define SYN_MT_REPORT 2 #define SYN_DROPPED 3 #define SYN_MAX 0xf #define SYN_CNT (SYN_MAX+1) /* * Keys and buttons * * Most of the keys/buttons are modeled after USB HUT 1.12 * (see http://www.usb.org/developers/hidpage). * Abbreviations in the comments: * AC - Application Control * AL - Application Launch Button * SC - System Control */ #define KEY_RESERVED 0 #define KEY_ESC 1 #define KEY_1 2 #define KEY_2 3 #define KEY_3 4 #define KEY_4 5 #define KEY_5 6 #define KEY_6 7 #define KEY_7 8 #define KEY_8 9 #define KEY_9 10 #define KEY_0 11 #define KEY_MINUS 12 #define KEY_EQUAL 13 #define KEY_BACKSPACE 14 #define KEY_TAB 15 #define KEY_Q 16 #define KEY_W 17 #define KEY_E 18 #define KEY_R 19 #define KEY_T 20 #define KEY_Y 21 #define KEY_U 22 #define KEY_I 23 #define KEY_O 24 #define KEY_P 25 #define KEY_LEFTBRACE 26 #define KEY_RIGHTBRACE 27 #define KEY_ENTER 28 #define KEY_LEFTCTRL 29 #define KEY_A 30 #define KEY_S 31 #define KEY_D 32 #define KEY_F 33 #define KEY_G 34 #define KEY_H 35 #define KEY_J 36 #define KEY_K 37 #define KEY_L 38 #define KEY_SEMICOLON 39 #define KEY_APOSTROPHE 40 #define KEY_GRAVE 41 #define KEY_LEFTSHIFT 42 #define KEY_BACKSLASH 43 #define KEY_Z 44 #define KEY_X 45 #define KEY_C 46 #define KEY_V 47 #define KEY_B 48 #define KEY_N 49 #define KEY_M 50 #define KEY_COMMA 51 #define KEY_DOT 52 #define KEY_SLASH 53 #define KEY_RIGHTSHIFT 54 #define KEY_KPASTERISK 55 #define KEY_LEFTALT 56 #define KEY_SPACE 57 #define KEY_CAPSLOCK 58 #define KEY_F1 59 #define KEY_F2 60 #define KEY_F3 61 #define KEY_F4 62 #define KEY_F5 63 #define KEY_F6 64 #define KEY_F7 65 #define KEY_F8 66 #define KEY_F9 67 #define KEY_F10 68 #define KEY_NUMLOCK 69 #define KEY_SCROLLLOCK 70 #define KEY_KP7 71 #define KEY_KP8 72 #define KEY_KP9 73 #define KEY_KPMINUS 74 #define KEY_KP4 75 #define KEY_KP5 76 #define KEY_KP6 77 #define KEY_KPPLUS 78 #define KEY_KP1 79 #define KEY_KP2 80 #define KEY_KP3 81 #define KEY_KP0 82 #define KEY_KPDOT 83 #define KEY_ZENKAKUHANKAKU 85 #define KEY_102ND 86 #define KEY_F11 87 #define KEY_F12 88 #define KEY_RO 89 #define KEY_KATAKANA 90 #define KEY_HIRAGANA 91 #define KEY_HENKAN 92 #define KEY_KATAKANAHIRAGANA 93 #define KEY_MUHENKAN 94 #define KEY_KPJPCOMMA 95 #define KEY_KPENTER 96 #define KEY_RIGHTCTRL 97 #define KEY_KPSLASH 98 #define KEY_SYSRQ 99 #define KEY_RIGHTALT 100 #define KEY_LINEFEED 101 #define KEY_HOME 102 #define KEY_UP 103 #define KEY_PAGEUP 104 #define KEY_LEFT 105 #define KEY_RIGHT 106 #define KEY_END 107 #define KEY_DOWN 108 #define KEY_PAGEDOWN 109 #define KEY_INSERT 110 #define KEY_DELETE 111 #define KEY_MACRO 112 #define KEY_MUTE 113 #define KEY_VOLUMEDOWN 114 #define KEY_VOLUMEUP 115 #define KEY_POWER 116 /* SC System Power Down */ #define KEY_KPEQUAL 117 #define KEY_KPPLUSMINUS 118 #define KEY_PAUSE 119 #define KEY_SCALE 120 /* AL Compiz Scale (Expose) */ #define KEY_KPCOMMA 121 #define KEY_HANGEUL 122 #define KEY_HANGUEL KEY_HANGEUL #define KEY_HANJA 123 #define KEY_YEN 124 #define KEY_LEFTMETA 125 #define KEY_RIGHTMETA 126 #define KEY_COMPOSE 127 #define KEY_STOP 128 /* AC Stop */ #define KEY_AGAIN 129 #define KEY_PROPS 130 /* AC Properties */ #define KEY_UNDO 131 /* AC Undo */ #define KEY_FRONT 132 #define KEY_COPY 133 /* AC Copy */ #define KEY_OPEN 134 /* AC Open */ #define KEY_PASTE 135 /* AC Paste */ #define KEY_FIND 136 /* AC Search */ #define KEY_CUT 137 /* AC Cut */ #define KEY_HELP 138 /* AL Integrated Help Center */ #define KEY_MENU 139 /* Menu (show menu) */ #define KEY_CALC 140 /* AL Calculator */ #define KEY_SETUP 141 #define KEY_SLEEP 142 /* SC System Sleep */ #define KEY_WAKEUP 143 /* System Wake Up */ #define KEY_FILE 144 /* AL Local Machine Browser */ #define KEY_SENDFILE 145 #define KEY_DELETEFILE 146 #define KEY_XFER 147 #define KEY_PROG1 148 #define KEY_PROG2 149 #define KEY_WWW 150 /* AL Internet Browser */ #define KEY_MSDOS 151 #define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */ #define KEY_SCREENLOCK KEY_COFFEE #define KEY_ROTATE_DISPLAY 153 /* Display orientation for e.g. tablets */ #define KEY_DIRECTION KEY_ROTATE_DISPLAY #define KEY_CYCLEWINDOWS 154 #define KEY_MAIL 155 #define KEY_BOOKMARKS 156 /* AC Bookmarks */ #define KEY_COMPUTER 157 #define KEY_BACK 158 /* AC Back */ #define KEY_FORWARD 159 /* AC Forward */ #define KEY_CLOSECD 160 #define KEY_EJECTCD 161 #define KEY_EJECTCLOSECD 162 #define KEY_NEXTSONG 163 #define KEY_PLAYPAUSE 164 #define KEY_PREVIOUSSONG 165 #define KEY_STOPCD 166 #define KEY_RECORD 167 #define KEY_REWIND 168 #define KEY_PHONE 169 /* Media Select Telephone */ #define KEY_ISO 170 #define KEY_CONFIG 171 /* AL Consumer Control Configuration */ #define KEY_HOMEPAGE 172 /* AC Home */ #define KEY_REFRESH 173 /* AC Refresh */ #define KEY_EXIT 174 /* AC Exit */ #define KEY_MOVE 175 #define KEY_EDIT 176 #define KEY_SCROLLUP 177 #define KEY_SCROLLDOWN 178 #define KEY_KPLEFTPAREN 179 #define KEY_KPRIGHTPAREN 180 #define KEY_NEW 181 /* AC New */ #define KEY_REDO 182 /* AC Redo/Repeat */ #define KEY_F13 183 #define KEY_F14 184 #define KEY_F15 185 #define KEY_F16 186 #define KEY_F17 187 #define KEY_F18 188 #define KEY_F19 189 #define KEY_F20 190 #define KEY_F21 191 #define KEY_F22 192 #define KEY_F23 193 #define KEY_F24 194 #define KEY_PLAYCD 200 #define KEY_PAUSECD 201 #define KEY_PROG3 202 #define KEY_PROG4 203 #define KEY_ALL_APPLICATIONS 204 /* AC Desktop Show All Applications */ #define KEY_DASHBOARD KEY_ALL_APPLICATIONS #define KEY_SUSPEND 205 #define KEY_CLOSE 206 /* AC Close */ #define KEY_PLAY 207 #define KEY_FASTFORWARD 208 #define KEY_BASSBOOST 209 #define KEY_PRINT 210 /* AC Print */ #define KEY_HP 211 #define KEY_CAMERA 212 #define KEY_SOUND 213 #define KEY_QUESTION 214 #define KEY_EMAIL 215 #define KEY_CHAT 216 #define KEY_SEARCH 217 #define KEY_CONNECT 218 #define KEY_FINANCE 219 /* AL Checkbook/Finance */ #define KEY_SPORT 220 #define KEY_SHOP 221 #define KEY_ALTERASE 222 #define KEY_CANCEL 223 /* AC Cancel */ #define KEY_BRIGHTNESSDOWN 224 #define KEY_BRIGHTNESSUP 225 #define KEY_MEDIA 226 #define KEY_SWITCHVIDEOMODE 227 /* Cycle between available video outputs (Monitor/LCD/TV-out/etc) */ #define KEY_KBDILLUMTOGGLE 228 #define KEY_KBDILLUMDOWN 229 #define KEY_KBDILLUMUP 230 #define KEY_SEND 231 /* AC Send */ #define KEY_REPLY 232 /* AC Reply */ #define KEY_FORWARDMAIL 233 /* AC Forward Msg */ #define KEY_SAVE 234 /* AC Save */ #define KEY_DOCUMENTS 235 #define KEY_BATTERY 236 #define KEY_BLUETOOTH 237 #define KEY_WLAN 238 #define KEY_UWB 239 #define KEY_UNKNOWN 240 #define KEY_VIDEO_NEXT 241 /* drive next video source */ #define KEY_VIDEO_PREV 242 /* drive previous video source */ #define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */ #define KEY_BRIGHTNESS_AUTO 244 /* Set Auto Brightness: manual brightness control is off, rely on ambient */ #define KEY_BRIGHTNESS_ZERO KEY_BRIGHTNESS_AUTO #define KEY_DISPLAY_OFF 245 /* display device to off state */ #define KEY_WWAN 246 /* Wireless WAN (LTE, UMTS, GSM, etc.) */ #define KEY_WIMAX KEY_WWAN #define KEY_RFKILL 247 /* Key that controls all radios */ #define KEY_MICMUTE 248 /* Mute / unmute the microphone */ /* Code 255 is reserved for special needs of AT keyboard driver */ #define BTN_MISC 0x100 #define BTN_0 0x100 #define BTN_1 0x101 #define BTN_2 0x102 #define BTN_3 0x103 #define BTN_4 0x104 #define BTN_5 0x105 #define BTN_6 0x106 #define BTN_7 0x107 #define BTN_8 0x108 #define BTN_9 0x109 #define BTN_MOUSE 0x110 #define BTN_LEFT 0x110 #define BTN_RIGHT 0x111 #define BTN_MIDDLE 0x112 #define BTN_SIDE 0x113 #define BTN_EXTRA 0x114 #define BTN_FORWARD 0x115 #define BTN_BACK 0x116 #define BTN_TASK 0x117 #define BTN_JOYSTICK 0x120 #define BTN_TRIGGER 0x120 #define BTN_THUMB 0x121 #define BTN_THUMB2 0x122 #define BTN_TOP 0x123 #define BTN_TOP2 0x124 #define BTN_PINKIE 0x125 #define BTN_BASE 0x126 #define BTN_BASE2 0x127 #define BTN_BASE3 0x128 #define BTN_BASE4 0x129 #define BTN_BASE5 0x12a #define BTN_BASE6 0x12b #define BTN_DEAD 0x12f #define BTN_GAMEPAD 0x130 #define BTN_SOUTH 0x130 #define BTN_A BTN_SOUTH #define BTN_EAST 0x131 #define BTN_B BTN_EAST #define BTN_C 0x132 #define BTN_NORTH 0x133 #define BTN_X BTN_NORTH #define BTN_WEST 0x134 #define BTN_Y BTN_WEST #define BTN_Z 0x135 #define BTN_TL 0x136 #define BTN_TR 0x137 #define BTN_TL2 0x138 #define BTN_TR2 0x139 #define BTN_SELECT 0x13a #define BTN_START 0x13b #define BTN_MODE 0x13c #define BTN_THUMBL 0x13d #define BTN_THUMBR 0x13e #define BTN_DIGI 0x140 #define BTN_TOOL_PEN 0x140 #define BTN_TOOL_RUBBER 0x141 #define BTN_TOOL_BRUSH 0x142 #define BTN_TOOL_PENCIL 0x143 #define BTN_TOOL_AIRBRUSH 0x144 #define BTN_TOOL_FINGER 0x145 #define BTN_TOOL_MOUSE 0x146 #define BTN_TOOL_LENS 0x147 #define BTN_TOOL_QUINTTAP 0x148 /* Five fingers on trackpad */ #define BTN_STYLUS3 0x149 #define BTN_TOUCH 0x14a #define BTN_STYLUS 0x14b #define BTN_STYLUS2 0x14c #define BTN_TOOL_DOUBLETAP 0x14d #define BTN_TOOL_TRIPLETAP 0x14e #define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */ #define BTN_WHEEL 0x150 #define BTN_GEAR_DOWN 0x150 #define BTN_GEAR_UP 0x151 #define KEY_OK 0x160 #define KEY_SELECT 0x161 #define KEY_GOTO 0x162 #define KEY_CLEAR 0x163 #define KEY_POWER2 0x164 #define KEY_OPTION 0x165 #define KEY_INFO 0x166 /* AL OEM Features/Tips/Tutorial */ #define KEY_TIME 0x167 #define KEY_VENDOR 0x168 #define KEY_ARCHIVE 0x169 #define KEY_PROGRAM 0x16a /* Media Select Program Guide */ #define KEY_CHANNEL 0x16b #define KEY_FAVORITES 0x16c #define KEY_EPG 0x16d #define KEY_PVR 0x16e /* Media Select Home */ #define KEY_MHP 0x16f #define KEY_LANGUAGE 0x170 #define KEY_TITLE 0x171 #define KEY_SUBTITLE 0x172 #define KEY_ANGLE 0x173 #define KEY_ZOOM 0x174 #define KEY_MODE 0x175 #define KEY_KEYBOARD 0x176 #define KEY_SCREEN 0x177 #define KEY_PC 0x178 /* Media Select Computer */ #define KEY_TV 0x179 /* Media Select TV */ #define KEY_TV2 0x17a /* Media Select Cable */ #define KEY_VCR 0x17b /* Media Select VCR */ #define KEY_VCR2 0x17c /* VCR Plus */ #define KEY_SAT 0x17d /* Media Select Satellite */ #define KEY_SAT2 0x17e #define KEY_CD 0x17f /* Media Select CD */ #define KEY_TAPE 0x180 /* Media Select Tape */ #define KEY_RADIO 0x181 #define KEY_TUNER 0x182 /* Media Select Tuner */ #define KEY_PLAYER 0x183 #define KEY_TEXT 0x184 #define KEY_DVD 0x185 /* Media Select DVD */ #define KEY_AUX 0x186 #define KEY_MP3 0x187 #define KEY_AUDIO 0x188 /* AL Audio Browser */ #define KEY_VIDEO 0x189 /* AL Movie Browser */ #define KEY_DIRECTORY 0x18a #define KEY_LIST 0x18b #define KEY_MEMO 0x18c /* Media Select Messages */ #define KEY_CALENDAR 0x18d #define KEY_RED 0x18e #define KEY_GREEN 0x18f #define KEY_YELLOW 0x190 #define KEY_BLUE 0x191 #define KEY_CHANNELUP 0x192 /* Channel Increment */ #define KEY_CHANNELDOWN 0x193 /* Channel Decrement */ #define KEY_FIRST 0x194 #define KEY_LAST 0x195 /* Recall Last */ #define KEY_AB 0x196 #define KEY_NEXT 0x197 #define KEY_RESTART 0x198 #define KEY_SLOW 0x199 #define KEY_SHUFFLE 0x19a #define KEY_BREAK 0x19b #define KEY_PREVIOUS 0x19c #define KEY_DIGITS 0x19d #define KEY_TEEN 0x19e #define KEY_TWEN 0x19f #define KEY_VIDEOPHONE 0x1a0 /* Media Select Video Phone */ #define KEY_GAMES 0x1a1 /* Media Select Games */ #define KEY_ZOOMIN 0x1a2 /* AC Zoom In */ #define KEY_ZOOMOUT 0x1a3 /* AC Zoom Out */ #define KEY_ZOOMRESET 0x1a4 /* AC Zoom */ #define KEY_WORDPROCESSOR 0x1a5 /* AL Word Processor */ #define KEY_EDITOR 0x1a6 /* AL Text Editor */ #define KEY_SPREADSHEET 0x1a7 /* AL Spreadsheet */ #define KEY_GRAPHICSEDITOR 0x1a8 /* AL Graphics Editor */ #define KEY_PRESENTATION 0x1a9 /* AL Presentation App */ #define KEY_DATABASE 0x1aa /* AL Database App */ #define KEY_NEWS 0x1ab /* AL Newsreader */ #define KEY_VOICEMAIL 0x1ac /* AL Voicemail */ #define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */ #define KEY_MESSENGER 0x1ae /* AL Instant Messaging */ #define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */ #define KEY_BRIGHTNESS_TOGGLE KEY_DISPLAYTOGGLE #define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */ #define KEY_LOGOFF 0x1b1 /* AL Logoff */ #define KEY_DOLLAR 0x1b2 #define KEY_EURO 0x1b3 #define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */ #define KEY_FRAMEFORWARD 0x1b5 #define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */ #define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */ #define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */ #define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */ #define KEY_IMAGES 0x1ba /* AL Image Browser */ #define KEY_DEL_EOL 0x1c0 #define KEY_DEL_EOS 0x1c1 #define KEY_INS_LINE 0x1c2 #define KEY_DEL_LINE 0x1c3 #define KEY_FN 0x1d0 #define KEY_FN_ESC 0x1d1 #define KEY_FN_F1 0x1d2 #define KEY_FN_F2 0x1d3 #define KEY_FN_F3 0x1d4 #define KEY_FN_F4 0x1d5 #define KEY_FN_F5 0x1d6 #define KEY_FN_F6 0x1d7 #define KEY_FN_F7 0x1d8 #define KEY_FN_F8 0x1d9 #define KEY_FN_F9 0x1da #define KEY_FN_F10 0x1db #define KEY_FN_F11 0x1dc #define KEY_FN_F12 0x1dd #define KEY_FN_1 0x1de #define KEY_FN_2 0x1df #define KEY_FN_D 0x1e0 #define KEY_FN_E 0x1e1 #define KEY_FN_F 0x1e2 #define KEY_FN_S 0x1e3 #define KEY_FN_B 0x1e4 #define KEY_BRL_DOT1 0x1f1 #define KEY_BRL_DOT2 0x1f2 #define KEY_BRL_DOT3 0x1f3 #define KEY_BRL_DOT4 0x1f4 #define KEY_BRL_DOT5 0x1f5 #define KEY_BRL_DOT6 0x1f6 #define KEY_BRL_DOT7 0x1f7 #define KEY_BRL_DOT8 0x1f8 #define KEY_BRL_DOT9 0x1f9 #define KEY_BRL_DOT10 0x1fa #define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */ #define KEY_NUMERIC_1 0x201 /* and other keypads */ #define KEY_NUMERIC_2 0x202 #define KEY_NUMERIC_3 0x203 #define KEY_NUMERIC_4 0x204 #define KEY_NUMERIC_5 0x205 #define KEY_NUMERIC_6 0x206 #define KEY_NUMERIC_7 0x207 #define KEY_NUMERIC_8 0x208 #define KEY_NUMERIC_9 0x209 #define KEY_NUMERIC_STAR 0x20a #define KEY_NUMERIC_POUND 0x20b #define KEY_NUMERIC_A 0x20c /* Phone key A - HUT Telephony 0xb9 */ #define KEY_NUMERIC_B 0x20d #define KEY_NUMERIC_C 0x20e #define KEY_NUMERIC_D 0x20f #define KEY_CAMERA_FOCUS 0x210 #define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */ #define KEY_TOUCHPAD_TOGGLE 0x212 /* Request switch touchpad on or off */ #define KEY_TOUCHPAD_ON 0x213 #define KEY_TOUCHPAD_OFF 0x214 #define KEY_CAMERA_ZOOMIN 0x215 #define KEY_CAMERA_ZOOMOUT 0x216 #define KEY_CAMERA_UP 0x217 #define KEY_CAMERA_DOWN 0x218 #define KEY_CAMERA_LEFT 0x219 #define KEY_CAMERA_RIGHT 0x21a #define KEY_ATTENDANT_ON 0x21b #define KEY_ATTENDANT_OFF 0x21c #define KEY_ATTENDANT_TOGGLE 0x21d /* Attendant call on or off */ #define KEY_LIGHTS_TOGGLE 0x21e /* Reading light on or off */ #define BTN_DPAD_UP 0x220 #define BTN_DPAD_DOWN 0x221 #define BTN_DPAD_LEFT 0x222 #define BTN_DPAD_RIGHT 0x223 #define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */ #define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */ #define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */ #define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */ #define KEY_JOURNAL 0x242 /* AL Log/Journal/Timecard */ #define KEY_CONTROLPANEL 0x243 /* AL Control Panel */ #define KEY_APPSELECT 0x244 /* AL Select Task/Application */ #define KEY_SCREENSAVER 0x245 /* AL Screen Saver */ #define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */ #define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */ #define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */ #define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */ #define KEY_KBDINPUTASSIST_PREV 0x260 #define KEY_KBDINPUTASSIST_NEXT 0x261 #define KEY_KBDINPUTASSIST_PREVGROUP 0x262 #define KEY_KBDINPUTASSIST_NEXTGROUP 0x263 #define KEY_KBDINPUTASSIST_ACCEPT 0x264 #define KEY_KBDINPUTASSIST_CANCEL 0x265 /* Diagonal movement keys */ #define KEY_RIGHT_UP 0x266 #define KEY_RIGHT_DOWN 0x267 #define KEY_LEFT_UP 0x268 #define KEY_LEFT_DOWN 0x269 #define KEY_ROOT_MENU 0x26a /* Show Device's Root Menu */ /* Show Top Menu of the Media (e.g. DVD) */ #define KEY_MEDIA_TOP_MENU 0x26b #define KEY_NUMERIC_11 0x26c #define KEY_NUMERIC_12 0x26d /* * Toggle Audio Description: refers to an audio service that helps blind and * visually impaired consumers understand the action in a program. Note: in * some countries this is referred to as "Video Description". */ #define KEY_AUDIO_DESC 0x26e #define KEY_3D_MODE 0x26f #define KEY_NEXT_FAVORITE 0x270 #define KEY_STOP_RECORD 0x271 #define KEY_PAUSE_RECORD 0x272 #define KEY_VOD 0x273 /* Video on Demand */ #define KEY_UNMUTE 0x274 #define KEY_FASTREVERSE 0x275 #define KEY_SLOWREVERSE 0x276 /* * Control a data application associated with the currently viewed channel, * e.g. teletext or data broadcast application (MHEG, MHP, HbbTV, etc.) */ #define KEY_DATA 0x277 #define KEY_ONSCREEN_KEYBOARD 0x278 #define BTN_TRIGGER_HAPPY 0x2c0 #define BTN_TRIGGER_HAPPY1 0x2c0 #define BTN_TRIGGER_HAPPY2 0x2c1 #define BTN_TRIGGER_HAPPY3 0x2c2 #define BTN_TRIGGER_HAPPY4 0x2c3 #define BTN_TRIGGER_HAPPY5 0x2c4 #define BTN_TRIGGER_HAPPY6 0x2c5 #define BTN_TRIGGER_HAPPY7 0x2c6 #define BTN_TRIGGER_HAPPY8 0x2c7 #define BTN_TRIGGER_HAPPY9 0x2c8 #define BTN_TRIGGER_HAPPY10 0x2c9 #define BTN_TRIGGER_HAPPY11 0x2ca #define BTN_TRIGGER_HAPPY12 0x2cb #define BTN_TRIGGER_HAPPY13 0x2cc #define BTN_TRIGGER_HAPPY14 0x2cd #define BTN_TRIGGER_HAPPY15 0x2ce #define BTN_TRIGGER_HAPPY16 0x2cf #define BTN_TRIGGER_HAPPY17 0x2d0 #define BTN_TRIGGER_HAPPY18 0x2d1 #define BTN_TRIGGER_HAPPY19 0x2d2 #define BTN_TRIGGER_HAPPY20 0x2d3 #define BTN_TRIGGER_HAPPY21 0x2d4 #define BTN_TRIGGER_HAPPY22 0x2d5 #define BTN_TRIGGER_HAPPY23 0x2d6 #define BTN_TRIGGER_HAPPY24 0x2d7 #define BTN_TRIGGER_HAPPY25 0x2d8 #define BTN_TRIGGER_HAPPY26 0x2d9 #define BTN_TRIGGER_HAPPY27 0x2da #define BTN_TRIGGER_HAPPY28 0x2db #define BTN_TRIGGER_HAPPY29 0x2dc #define BTN_TRIGGER_HAPPY30 0x2dd #define BTN_TRIGGER_HAPPY31 0x2de #define BTN_TRIGGER_HAPPY32 0x2df #define BTN_TRIGGER_HAPPY33 0x2e0 #define BTN_TRIGGER_HAPPY34 0x2e1 #define BTN_TRIGGER_HAPPY35 0x2e2 #define BTN_TRIGGER_HAPPY36 0x2e3 #define BTN_TRIGGER_HAPPY37 0x2e4 #define BTN_TRIGGER_HAPPY38 0x2e5 #define BTN_TRIGGER_HAPPY39 0x2e6 #define BTN_TRIGGER_HAPPY40 0x2e7 /* We avoid low common keys in module aliases so they don't get huge. */ #define KEY_MIN_INTERESTING KEY_MUTE #define KEY_MAX 0x2ff #define KEY_CNT (KEY_MAX+1) /* * Relative axes */ #define REL_X 0x00 #define REL_Y 0x01 #define REL_Z 0x02 #define REL_RX 0x03 #define REL_RY 0x04 #define REL_RZ 0x05 #define REL_HWHEEL 0x06 #define REL_DIAL 0x07 #define REL_WHEEL 0x08 #define REL_MISC 0x09 #define REL_MAX 0x0f #define REL_CNT (REL_MAX+1) /* * Absolute axes */ #define ABS_X 0x00 #define ABS_Y 0x01 #define ABS_Z 0x02 #define ABS_RX 0x03 #define ABS_RY 0x04 #define ABS_RZ 0x05 #define ABS_THROTTLE 0x06 #define ABS_RUDDER 0x07 #define ABS_WHEEL 0x08 #define ABS_GAS 0x09 #define ABS_BRAKE 0x0a #define ABS_HAT0X 0x10 #define ABS_HAT0Y 0x11 #define ABS_HAT1X 0x12 #define ABS_HAT1Y 0x13 #define ABS_HAT2X 0x14 #define ABS_HAT2Y 0x15 #define ABS_HAT3X 0x16 #define ABS_HAT3Y 0x17 #define ABS_PRESSURE 0x18 #define ABS_DISTANCE 0x19 #define ABS_TILT_X 0x1a #define ABS_TILT_Y 0x1b #define ABS_TOOL_WIDTH 0x1c #define ABS_VOLUME 0x20 #define ABS_MISC 0x28 /* * 0x2e is reserved and should not be used in input drivers. * It was used by HID as ABS_MISC+6 and userspace needs to detect if * the next ABS_* event is correct or is just ABS_MISC + n. * We define here ABS_RESERVED so userspace can rely on it and detect * the situation described above. */ #define ABS_RESERVED 0x2e #define ABS_MT_SLOT 0x2f /* MT slot being modified */ #define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ #define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ #define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ #define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */ #define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */ #define ABS_MT_POSITION_X 0x35 /* Center X touch position */ #define ABS_MT_POSITION_Y 0x36 /* Center Y touch position */ #define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ #define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ #define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ #define ABS_MT_DISTANCE 0x3b /* Contact hover distance */ #define ABS_MT_TOOL_X 0x3c /* Center X tool position */ #define ABS_MT_TOOL_Y 0x3d /* Center Y tool position */ #define ABS_MAX 0x3f #define ABS_CNT (ABS_MAX+1) /* * Switch events */ #define SW_LID 0x00 /* set = lid shut */ #define SW_TABLET_MODE 0x01 /* set = tablet mode */ #define SW_HEADPHONE_INSERT 0x02 /* set = inserted */ #define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any" set = radio enabled */ #define SW_RADIO SW_RFKILL_ALL /* deprecated */ #define SW_MICROPHONE_INSERT 0x04 /* set = inserted */ #define SW_DOCK 0x05 /* set = plugged into dock */ #define SW_LINEOUT_INSERT 0x06 /* set = inserted */ #define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */ #define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */ #define SW_CAMERA_LENS_COVER 0x09 /* set = lens covered */ #define SW_KEYPAD_SLIDE 0x0a /* set = keypad slide out */ #define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */ #define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */ #define SW_LINEIN_INSERT 0x0d /* set = inserted */ #define SW_MUTE_DEVICE 0x0e /* set = device disabled */ #define SW_PEN_INSERTED 0x0f /* set = pen inserted */ #define SW_MACHINE_COVER 0x10 /* set = cover closed */ #define SW_MAX 0x10 #define SW_CNT (SW_MAX+1) /* * Misc events */ #define MSC_SERIAL 0x00 #define MSC_PULSELED 0x01 #define MSC_GESTURE 0x02 #define MSC_RAW 0x03 #define MSC_SCAN 0x04 #define MSC_TIMESTAMP 0x05 #define MSC_MAX 0x07 #define MSC_CNT (MSC_MAX+1) /* * LEDs */ #define LED_NUML 0x00 #define LED_CAPSL 0x01 #define LED_SCROLLL 0x02 #define LED_COMPOSE 0x03 #define LED_KANA 0x04 #define LED_SLEEP 0x05 #define LED_SUSPEND 0x06 #define LED_MUTE 0x07 #define LED_MISC 0x08 #define LED_MAIL 0x09 #define LED_CHARGING 0x0a #define LED_MAX 0x0f #define LED_CNT (LED_MAX+1) /* * Autorepeat values */ #define REP_DELAY 0x00 #define REP_PERIOD 0x01 #define REP_MAX 0x01 #define REP_CNT (REP_MAX+1) /* * Sounds */ #define SND_CLICK 0x00 #define SND_BELL 0x01 #define SND_TONE 0x02 #define SND_MAX 0x07 #define SND_CNT (SND_MAX+1) #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/kvm_para.h������������������������������������������������������������������������������������0000644�����������������00000001651�14763166027�0007673 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_KVM_PARA_H #define __LINUX_KVM_PARA_H /* * This header file provides a method for making a hypercall to the host * Architectures should define: * - kvm_hypercall0, kvm_hypercall1... * - kvm_arch_para_features * - kvm_para_available */ /* Return values for hypercalls */ #define KVM_ENOSYS 1000 #define KVM_EFAULT EFAULT #define KVM_EINVAL EINVAL #define KVM_E2BIG E2BIG #define KVM_EPERM EPERM #define KVM_EOPNOTSUPP 95 #define KVM_HC_VAPIC_POLL_IRQ 1 #define KVM_HC_MMU_OP 2 #define KVM_HC_FEATURES 3 #define KVM_HC_PPC_MAP_MAGIC_PAGE 4 #define KVM_HC_KICK_CPU 5 #define KVM_HC_MIPS_GET_CLOCK_FREQ 6 #define KVM_HC_MIPS_EXIT_VM 7 #define KVM_HC_MIPS_CONSOLE_OUTPUT 8 #define KVM_HC_CLOCK_PAIRING 9 #define KVM_HC_SEND_IPI 10 /* * hypercalls use architecture specific */ #include <asm/kvm_para.h> #endif /* __LINUX_KVM_PARA_H */ ���������������������������������������������������������������������������������������linux/sdla.h����������������������������������������������������������������������������������������0000644�����������������00000005427�14763166027�0007023 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Global definitions for the Frame relay interface. * * Version: @(#)if_ifrad.h 0.20 13 Apr 96 * * Author: Mike McLagan <mike.mclagan@linux.org> * * Changes: * 0.15 Mike McLagan Structure packing * * 0.20 Mike McLagan New flags for S508 buffer handling * * 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. */ #ifndef SDLA_H #define SDLA_H /* adapter type */ #define SDLA_TYPES #define SDLA_S502A 5020 #define SDLA_S502E 5021 #define SDLA_S503 5030 #define SDLA_S507 5070 #define SDLA_S508 5080 #define SDLA_S509 5090 #define SDLA_UNKNOWN -1 /* port selection flags for the S508 */ #define SDLA_S508_PORT_V35 0x00 #define SDLA_S508_PORT_RS232 0x02 /* Z80 CPU speeds */ #define SDLA_CPU_3M 0x00 #define SDLA_CPU_5M 0x01 #define SDLA_CPU_7M 0x02 #define SDLA_CPU_8M 0x03 #define SDLA_CPU_10M 0x04 #define SDLA_CPU_16M 0x05 #define SDLA_CPU_12M 0x06 /* some private IOCTLs */ #define SDLA_IDENTIFY (FRAD_LAST_IOCTL + 1) #define SDLA_CPUSPEED (FRAD_LAST_IOCTL + 2) #define SDLA_PROTOCOL (FRAD_LAST_IOCTL + 3) #define SDLA_CLEARMEM (FRAD_LAST_IOCTL + 4) #define SDLA_WRITEMEM (FRAD_LAST_IOCTL + 5) #define SDLA_READMEM (FRAD_LAST_IOCTL + 6) struct sdla_mem { int addr; int len; void *data; }; #define SDLA_START (FRAD_LAST_IOCTL + 7) #define SDLA_STOP (FRAD_LAST_IOCTL + 8) /* some offsets in the Z80's memory space */ #define SDLA_NMIADDR 0x0000 #define SDLA_CONF_ADDR 0x0010 #define SDLA_S502A_NMIADDR 0x0066 #define SDLA_CODE_BASEADDR 0x0100 #define SDLA_WINDOW_SIZE 0x2000 #define SDLA_ADDR_MASK 0x1FFF /* largest handleable block of data */ #define SDLA_MAX_DATA 4080 #define SDLA_MAX_MTU 4072 /* MAX_DATA - sizeof(fradhdr) */ #define SDLA_MAX_DLCI 24 /* this should be the same as frad_conf */ struct sdla_conf { short station; short config; short kbaud; short clocking; short max_frm; short T391; short T392; short N391; short N392; short N393; short CIR_fwd; short Bc_fwd; short Be_fwd; short CIR_bwd; short Bc_bwd; short Be_bwd; }; /* this should be the same as dlci_conf */ struct sdla_dlci_conf { short config; short CIR_fwd; short Bc_fwd; short Be_fwd; short CIR_bwd; short Bc_bwd; short Be_bwd; short Tc_fwd; short Tc_bwd; short Tf_max; short Tb_max; }; #endif /* SDLA_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/fsi.h�����������������������������������������������������������������������������������������0000644�����������������00000004317�14763166027�0006656 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef _LINUX_FSI_H #define _LINUX_FSI_H #include <linux/types.h> #include <linux/ioctl.h> /* * /dev/scom "raw" ioctl interface * * The driver supports a high level "read/write" interface which * handles retries and converts the status to Linux error codes, * however low level tools an debugger need to access the "raw" * HW status information and interpret it themselves, so this * ioctl interface is also provided for their use case. */ /* Structure for SCOM read/write */ struct scom_access { __u64 addr; /* SCOM address, supports indirect */ __u64 data; /* SCOM data (in for write, out for read) */ __u64 mask; /* Data mask for writes */ __u32 intf_errors; /* Interface error flags */ #define SCOM_INTF_ERR_PARITY 0x00000001 /* Parity error */ #define SCOM_INTF_ERR_PROTECTION 0x00000002 /* Blocked by secure boot */ #define SCOM_INTF_ERR_ABORT 0x00000004 /* PIB reset during access */ #define SCOM_INTF_ERR_UNKNOWN 0x80000000 /* Unknown error */ /* * Note: Any other bit set in intf_errors need to be considered as an * error. Future implementations may define new error conditions. The * pib_status below is only valid if intf_errors is 0. */ __u8 pib_status; /* 3-bit PIB status */ #define SCOM_PIB_SUCCESS 0 /* Access successful */ #define SCOM_PIB_BLOCKED 1 /* PIB blocked, pls retry */ #define SCOM_PIB_OFFLINE 2 /* Chiplet offline */ #define SCOM_PIB_PARTIAL 3 /* Partial good */ #define SCOM_PIB_BAD_ADDR 4 /* Invalid address */ #define SCOM_PIB_CLK_ERR 5 /* Clock error */ #define SCOM_PIB_PARITY_ERR 6 /* Parity error on the PIB bus */ #define SCOM_PIB_TIMEOUT 7 /* Bus timeout */ __u8 pad; }; /* Flags for SCOM check */ #define SCOM_CHECK_SUPPORTED 0x00000001 /* Interface supported */ #define SCOM_CHECK_PROTECTED 0x00000002 /* Interface blocked by secure boot */ /* Flags for SCOM reset */ #define SCOM_RESET_INTF 0x00000001 /* Reset interface */ #define SCOM_RESET_PIB 0x00000002 /* Reset PIB */ #define FSI_SCOM_CHECK _IOR('s', 0x00, __u32) #define FSI_SCOM_READ _IOWR('s', 0x01, struct scom_access) #define FSI_SCOM_WRITE _IOWR('s', 0x02, struct scom_access) #define FSI_SCOM_RESET _IOW('s', 0x03, __u32) #endif /* _LINUX_FSI_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/lightnvm.h������������������������������������������������������������������������������������0000644�����������������00000011662�14763166027�0007726 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2015 CNEX Labs. 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 version * 2 as published by the Free Software Foundation. * * 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; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, * USA. */ #ifndef _LINUX_LIGHTNVM_H #define _LINUX_LIGHTNVM_H #include <stdio.h> #include <sys/ioctl.h> #define DISK_NAME_LEN 32 #include <linux/types.h> #include <linux/ioctl.h> #define NVM_TTYPE_NAME_MAX 48 #define NVM_TTYPE_MAX 63 #define NVM_MMTYPE_LEN 8 #define NVM_CTRL_FILE "/dev/lightnvm/control" struct nvm_ioctl_info_tgt { __u32 version[3]; __u32 reserved; char tgtname[NVM_TTYPE_NAME_MAX]; }; struct nvm_ioctl_info { __u32 version[3]; /* in/out - major, minor, patch */ __u16 tgtsize; /* number of targets */ __u16 reserved16; /* pad to 4K page */ __u32 reserved[12]; struct nvm_ioctl_info_tgt tgts[NVM_TTYPE_MAX]; }; enum { NVM_DEVICE_ACTIVE = 1 << 0, }; struct nvm_ioctl_device_info { char devname[DISK_NAME_LEN]; char bmname[NVM_TTYPE_NAME_MAX]; __u32 bmversion[3]; __u32 flags; __u32 reserved[8]; }; struct nvm_ioctl_get_devices { __u32 nr_devices; __u32 reserved[31]; struct nvm_ioctl_device_info info[31]; }; struct nvm_ioctl_create_simple { __u32 lun_begin; __u32 lun_end; }; struct nvm_ioctl_create_extended { __u16 lun_begin; __u16 lun_end; __u16 op; __u16 rsv; }; enum { NVM_CONFIG_TYPE_SIMPLE = 0, NVM_CONFIG_TYPE_EXTENDED = 1, }; struct nvm_ioctl_create_conf { __u32 type; union { struct nvm_ioctl_create_simple s; struct nvm_ioctl_create_extended e; }; }; enum { NVM_TARGET_FACTORY = 1 << 0, /* Init target in factory mode */ }; struct nvm_ioctl_create { char dev[DISK_NAME_LEN]; /* open-channel SSD device */ char tgttype[NVM_TTYPE_NAME_MAX]; /* target type name */ char tgtname[DISK_NAME_LEN]; /* dev to expose target as */ __u32 flags; struct nvm_ioctl_create_conf conf; }; struct nvm_ioctl_remove { char tgtname[DISK_NAME_LEN]; __u32 flags; }; struct nvm_ioctl_dev_init { char dev[DISK_NAME_LEN]; /* open-channel SSD device */ char mmtype[NVM_MMTYPE_LEN]; /* register to media manager */ __u32 flags; }; enum { NVM_FACTORY_ERASE_ONLY_USER = 1 << 0, /* erase only blocks used as * host blks or grown blks */ NVM_FACTORY_RESET_HOST_BLKS = 1 << 1, /* remove host blk marks */ NVM_FACTORY_RESET_GRWN_BBLKS = 1 << 2, /* remove grown blk marks */ NVM_FACTORY_NR_BITS = 1 << 3, /* stops here */ }; struct nvm_ioctl_dev_factory { char dev[DISK_NAME_LEN]; __u32 flags; }; struct nvm_user_vio { __u8 opcode; __u8 flags; __u16 control; __u16 nppas; __u16 rsvd; __u64 metadata; __u64 addr; __u64 ppa_list; __u32 metadata_len; __u32 data_len; __u64 status; __u32 result; __u32 rsvd3[3]; }; struct nvm_passthru_vio { __u8 opcode; __u8 flags; __u8 rsvd[2]; __u32 nsid; __u32 cdw2; __u32 cdw3; __u64 metadata; __u64 addr; __u32 metadata_len; __u32 data_len; __u64 ppa_list; __u16 nppas; __u16 control; __u32 cdw13; __u32 cdw14; __u32 cdw15; __u64 status; __u32 result; __u32 timeout_ms; }; /* The ioctl type, 'L', 0x20 - 0x2F documented in ioctl-number.txt */ enum { /* top level cmds */ NVM_INFO_CMD = 0x20, NVM_GET_DEVICES_CMD, /* device level cmds */ NVM_DEV_CREATE_CMD, NVM_DEV_REMOVE_CMD, /* Init a device to support LightNVM media managers */ NVM_DEV_INIT_CMD, /* Factory reset device */ NVM_DEV_FACTORY_CMD, /* Vector user I/O */ NVM_DEV_VIO_ADMIN_CMD = 0x41, NVM_DEV_VIO_CMD = 0x42, NVM_DEV_VIO_USER_CMD = 0x43, }; #define NVM_IOCTL 'L' /* 0x4c */ #define NVM_INFO _IOWR(NVM_IOCTL, NVM_INFO_CMD, \ struct nvm_ioctl_info) #define NVM_GET_DEVICES _IOR(NVM_IOCTL, NVM_GET_DEVICES_CMD, \ struct nvm_ioctl_get_devices) #define NVM_DEV_CREATE _IOW(NVM_IOCTL, NVM_DEV_CREATE_CMD, \ struct nvm_ioctl_create) #define NVM_DEV_REMOVE _IOW(NVM_IOCTL, NVM_DEV_REMOVE_CMD, \ struct nvm_ioctl_remove) #define NVM_DEV_INIT _IOW(NVM_IOCTL, NVM_DEV_INIT_CMD, \ struct nvm_ioctl_dev_init) #define NVM_DEV_FACTORY _IOW(NVM_IOCTL, NVM_DEV_FACTORY_CMD, \ struct nvm_ioctl_dev_factory) #define NVME_NVM_IOCTL_IO_VIO _IOWR(NVM_IOCTL, NVM_DEV_VIO_USER_CMD, \ struct nvm_passthru_vio) #define NVME_NVM_IOCTL_ADMIN_VIO _IOWR(NVM_IOCTL, NVM_DEV_VIO_ADMIN_CMD,\ struct nvm_passthru_vio) #define NVME_NVM_IOCTL_SUBMIT_VIO _IOWR(NVM_IOCTL, NVM_DEV_VIO_CMD,\ struct nvm_user_vio) #define NVM_VERSION_MAJOR 1 #define NVM_VERSION_MINOR 0 #define NVM_VERSION_PATCHLEVEL 0 #endif ������������������������������������������������������������������������������linux/lirc.h����������������������������������������������������������������������������������������0000644�����������������00000017205�14763166027�0007026 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * lirc.h - linux infrared remote control header file * last modified 2010/07/13 by Jarod Wilson */ #ifndef _LINUX_LIRC_H #define _LINUX_LIRC_H #include <linux/types.h> #include <linux/ioctl.h> #define PULSE_BIT 0x01000000 #define PULSE_MASK 0x00FFFFFF #define LIRC_MODE2_SPACE 0x00000000 #define LIRC_MODE2_PULSE 0x01000000 #define LIRC_MODE2_FREQUENCY 0x02000000 #define LIRC_MODE2_TIMEOUT 0x03000000 #define LIRC_VALUE_MASK 0x00FFFFFF #define LIRC_MODE2_MASK 0xFF000000 #define LIRC_SPACE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_SPACE) #define LIRC_PULSE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_PULSE) #define LIRC_FREQUENCY(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_FREQUENCY) #define LIRC_TIMEOUT(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_TIMEOUT) #define LIRC_VALUE(val) ((val)&LIRC_VALUE_MASK) #define LIRC_MODE2(val) ((val)&LIRC_MODE2_MASK) #define LIRC_IS_SPACE(val) (LIRC_MODE2(val) == LIRC_MODE2_SPACE) #define LIRC_IS_PULSE(val) (LIRC_MODE2(val) == LIRC_MODE2_PULSE) #define LIRC_IS_FREQUENCY(val) (LIRC_MODE2(val) == LIRC_MODE2_FREQUENCY) #define LIRC_IS_TIMEOUT(val) (LIRC_MODE2(val) == LIRC_MODE2_TIMEOUT) /* used heavily by lirc userspace */ #define lirc_t int /*** lirc compatible hardware features ***/ #define LIRC_MODE2SEND(x) (x) #define LIRC_SEND2MODE(x) (x) #define LIRC_MODE2REC(x) ((x) << 16) #define LIRC_REC2MODE(x) ((x) >> 16) #define LIRC_MODE_RAW 0x00000001 #define LIRC_MODE_PULSE 0x00000002 #define LIRC_MODE_MODE2 0x00000004 #define LIRC_MODE_SCANCODE 0x00000008 #define LIRC_MODE_LIRCCODE 0x00000010 #define LIRC_CAN_SEND_RAW LIRC_MODE2SEND(LIRC_MODE_RAW) #define LIRC_CAN_SEND_PULSE LIRC_MODE2SEND(LIRC_MODE_PULSE) #define LIRC_CAN_SEND_MODE2 LIRC_MODE2SEND(LIRC_MODE_MODE2) #define LIRC_CAN_SEND_LIRCCODE LIRC_MODE2SEND(LIRC_MODE_LIRCCODE) #define LIRC_CAN_SEND_MASK 0x0000003f #define LIRC_CAN_SET_SEND_CARRIER 0x00000100 #define LIRC_CAN_SET_SEND_DUTY_CYCLE 0x00000200 #define LIRC_CAN_SET_TRANSMITTER_MASK 0x00000400 #define LIRC_CAN_REC_RAW LIRC_MODE2REC(LIRC_MODE_RAW) #define LIRC_CAN_REC_PULSE LIRC_MODE2REC(LIRC_MODE_PULSE) #define LIRC_CAN_REC_MODE2 LIRC_MODE2REC(LIRC_MODE_MODE2) #define LIRC_CAN_REC_SCANCODE LIRC_MODE2REC(LIRC_MODE_SCANCODE) #define LIRC_CAN_REC_LIRCCODE LIRC_MODE2REC(LIRC_MODE_LIRCCODE) #define LIRC_CAN_REC_MASK LIRC_MODE2REC(LIRC_CAN_SEND_MASK) #define LIRC_CAN_SET_REC_CARRIER (LIRC_CAN_SET_SEND_CARRIER << 16) #define LIRC_CAN_SET_REC_DUTY_CYCLE (LIRC_CAN_SET_SEND_DUTY_CYCLE << 16) #define LIRC_CAN_SET_REC_DUTY_CYCLE_RANGE 0x40000000 #define LIRC_CAN_SET_REC_CARRIER_RANGE 0x80000000 #define LIRC_CAN_GET_REC_RESOLUTION 0x20000000 #define LIRC_CAN_SET_REC_TIMEOUT 0x10000000 #define LIRC_CAN_SET_REC_FILTER 0x08000000 #define LIRC_CAN_MEASURE_CARRIER 0x02000000 #define LIRC_CAN_USE_WIDEBAND_RECEIVER 0x04000000 #define LIRC_CAN_SEND(x) ((x)&LIRC_CAN_SEND_MASK) #define LIRC_CAN_REC(x) ((x)&LIRC_CAN_REC_MASK) #define LIRC_CAN_NOTIFY_DECODE 0x01000000 /*** IOCTL commands for lirc driver ***/ #define LIRC_GET_FEATURES _IOR('i', 0x00000000, __u32) #define LIRC_GET_SEND_MODE _IOR('i', 0x00000001, __u32) #define LIRC_GET_REC_MODE _IOR('i', 0x00000002, __u32) #define LIRC_GET_REC_RESOLUTION _IOR('i', 0x00000007, __u32) #define LIRC_GET_MIN_TIMEOUT _IOR('i', 0x00000008, __u32) #define LIRC_GET_MAX_TIMEOUT _IOR('i', 0x00000009, __u32) /* code length in bits, currently only for LIRC_MODE_LIRCCODE */ #define LIRC_GET_LENGTH _IOR('i', 0x0000000f, __u32) #define LIRC_SET_SEND_MODE _IOW('i', 0x00000011, __u32) #define LIRC_SET_REC_MODE _IOW('i', 0x00000012, __u32) /* Note: these can reset the according pulse_width */ #define LIRC_SET_SEND_CARRIER _IOW('i', 0x00000013, __u32) #define LIRC_SET_REC_CARRIER _IOW('i', 0x00000014, __u32) #define LIRC_SET_SEND_DUTY_CYCLE _IOW('i', 0x00000015, __u32) #define LIRC_SET_TRANSMITTER_MASK _IOW('i', 0x00000017, __u32) /* * when a timeout != 0 is set the driver will send a * LIRC_MODE2_TIMEOUT data packet, otherwise LIRC_MODE2_TIMEOUT is * never sent, timeout is disabled by default */ #define LIRC_SET_REC_TIMEOUT _IOW('i', 0x00000018, __u32) /* 1 enables, 0 disables timeout reports in MODE2 */ #define LIRC_SET_REC_TIMEOUT_REPORTS _IOW('i', 0x00000019, __u32) /* * if enabled from the next key press on the driver will send * LIRC_MODE2_FREQUENCY packets */ #define LIRC_SET_MEASURE_CARRIER_MODE _IOW('i', 0x0000001d, __u32) /* * to set a range use LIRC_SET_REC_CARRIER_RANGE with the * lower bound first and later LIRC_SET_REC_CARRIER with the upper bound */ #define LIRC_SET_REC_CARRIER_RANGE _IOW('i', 0x0000001f, __u32) #define LIRC_SET_WIDEBAND_RECEIVER _IOW('i', 0x00000023, __u32) /* * Return the recording timeout, which is either set by * the ioctl LIRC_SET_REC_TIMEOUT or by the kernel after setting the protocols. */ #define LIRC_GET_REC_TIMEOUT _IOR('i', 0x00000024, __u32) /* * struct lirc_scancode - decoded scancode with protocol for use with * LIRC_MODE_SCANCODE * * @timestamp: Timestamp in nanoseconds using CLOCK_MONOTONIC when IR * was decoded. * @flags: should be 0 for transmit. When receiving scancodes, * LIRC_SCANCODE_FLAG_TOGGLE or LIRC_SCANCODE_FLAG_REPEAT can be set * depending on the protocol * @rc_proto: see enum rc_proto * @keycode: the translated keycode. Set to 0 for transmit. * @scancode: the scancode received or to be sent */ struct lirc_scancode { __u64 timestamp; __u16 flags; __u16 rc_proto; __u32 keycode; __u64 scancode; }; /* Set if the toggle bit of rc-5 or rc-6 is enabled */ #define LIRC_SCANCODE_FLAG_TOGGLE 1 /* Set if this is a nec or sanyo repeat */ #define LIRC_SCANCODE_FLAG_REPEAT 2 /** * enum rc_proto - the Remote Controller protocol * * @RC_PROTO_UNKNOWN: Protocol not known * @RC_PROTO_OTHER: Protocol known but proprietary * @RC_PROTO_RC5: Philips RC5 protocol * @RC_PROTO_RC5X_20: Philips RC5x 20 bit protocol * @RC_PROTO_RC5_SZ: StreamZap variant of RC5 * @RC_PROTO_JVC: JVC protocol * @RC_PROTO_SONY12: Sony 12 bit protocol * @RC_PROTO_SONY15: Sony 15 bit protocol * @RC_PROTO_SONY20: Sony 20 bit protocol * @RC_PROTO_NEC: NEC protocol * @RC_PROTO_NECX: Extended NEC protocol * @RC_PROTO_NEC32: NEC 32 bit protocol * @RC_PROTO_SANYO: Sanyo protocol * @RC_PROTO_MCIR2_KBD: RC6-ish MCE keyboard * @RC_PROTO_MCIR2_MSE: RC6-ish MCE mouse * @RC_PROTO_RC6_0: Philips RC6-0-16 protocol * @RC_PROTO_RC6_6A_20: Philips RC6-6A-20 protocol * @RC_PROTO_RC6_6A_24: Philips RC6-6A-24 protocol * @RC_PROTO_RC6_6A_32: Philips RC6-6A-32 protocol * @RC_PROTO_RC6_MCE: MCE (Philips RC6-6A-32 subtype) protocol * @RC_PROTO_SHARP: Sharp protocol * @RC_PROTO_XMP: XMP protocol * @RC_PROTO_CEC: CEC protocol * @RC_PROTO_IMON: iMon Pad protocol */ enum rc_proto { RC_PROTO_UNKNOWN = 0, RC_PROTO_OTHER = 1, RC_PROTO_RC5 = 2, RC_PROTO_RC5X_20 = 3, RC_PROTO_RC5_SZ = 4, RC_PROTO_JVC = 5, RC_PROTO_SONY12 = 6, RC_PROTO_SONY15 = 7, RC_PROTO_SONY20 = 8, RC_PROTO_NEC = 9, RC_PROTO_NECX = 10, RC_PROTO_NEC32 = 11, RC_PROTO_SANYO = 12, RC_PROTO_MCIR2_KBD = 13, RC_PROTO_MCIR2_MSE = 14, RC_PROTO_RC6_0 = 15, RC_PROTO_RC6_6A_20 = 16, RC_PROTO_RC6_6A_24 = 17, RC_PROTO_RC6_6A_32 = 18, RC_PROTO_RC6_MCE = 19, RC_PROTO_SHARP = 20, RC_PROTO_XMP = 21, RC_PROTO_CEC = 22, RC_PROTO_IMON = 23, }; #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/rose.h����������������������������������������������������������������������������������������0000644�����������������00000004270�14763166027�0007043 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * These are the public elements of the Linux kernel Rose implementation. * For kernel AX.25 see the file ax25.h. This file requires ax25.h for the * definition of the ax25_address structure. */ #ifndef ROSE_KERNEL_H #define ROSE_KERNEL_H #include <linux/socket.h> #include <linux/ax25.h> #define ROSE_MTU 251 #define ROSE_MAX_DIGIS 6 #define ROSE_DEFER 1 #define ROSE_T1 2 #define ROSE_T2 3 #define ROSE_T3 4 #define ROSE_IDLE 5 #define ROSE_QBITINCL 6 #define ROSE_HOLDBACK 7 #define SIOCRSGCAUSE (SIOCPROTOPRIVATE+0) #define SIOCRSSCAUSE (SIOCPROTOPRIVATE+1) #define SIOCRSL2CALL (SIOCPROTOPRIVATE+2) #define SIOCRSSL2CALL (SIOCPROTOPRIVATE+2) #define SIOCRSACCEPT (SIOCPROTOPRIVATE+3) #define SIOCRSCLRRT (SIOCPROTOPRIVATE+4) #define SIOCRSGL2CALL (SIOCPROTOPRIVATE+5) #define SIOCRSGFACILITIES (SIOCPROTOPRIVATE+6) #define ROSE_DTE_ORIGINATED 0x00 #define ROSE_NUMBER_BUSY 0x01 #define ROSE_INVALID_FACILITY 0x03 #define ROSE_NETWORK_CONGESTION 0x05 #define ROSE_OUT_OF_ORDER 0x09 #define ROSE_ACCESS_BARRED 0x0B #define ROSE_NOT_OBTAINABLE 0x0D #define ROSE_REMOTE_PROCEDURE 0x11 #define ROSE_LOCAL_PROCEDURE 0x13 #define ROSE_SHIP_ABSENT 0x39 typedef struct { char rose_addr[5]; } rose_address; struct sockaddr_rose { __kernel_sa_family_t srose_family; rose_address srose_addr; ax25_address srose_call; int srose_ndigis; ax25_address srose_digi; }; struct full_sockaddr_rose { __kernel_sa_family_t srose_family; rose_address srose_addr; ax25_address srose_call; unsigned int srose_ndigis; ax25_address srose_digis[ROSE_MAX_DIGIS]; }; struct rose_route_struct { rose_address address; unsigned short mask; ax25_address neighbour; char device[16]; unsigned char ndigis; ax25_address digipeaters[AX25_MAX_DIGIS]; }; struct rose_cause_struct { unsigned char cause; unsigned char diagnostic; }; struct rose_facilities_struct { rose_address source_addr, dest_addr; ax25_address source_call, dest_call; unsigned char source_ndigis, dest_ndigis; ax25_address source_digis[ROSE_MAX_DIGIS]; ax25_address dest_digis[ROSE_MAX_DIGIS]; unsigned int rand; rose_address fail_addr; ax25_address fail_call; }; #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/fsmap.h���������������������������������������������������������������������������������������0000644�����������������00000010451�14763166027�0007177 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * FS_IOC_GETFSMAP ioctl infrastructure. * * Copyright (C) 2017 Oracle. All Rights Reserved. * * Author: Darrick J. Wong <darrick.wong@oracle.com> */ #ifndef _LINUX_FSMAP_H #define _LINUX_FSMAP_H #include <linux/types.h> /* * Structure for FS_IOC_GETFSMAP. * * The memory layout for this call are the scalar values defined in * struct fsmap_head, followed by two struct fsmap that describe * the lower and upper bound of mappings to return, followed by an * array of struct fsmap mappings. * * fmh_iflags control the output of the call, whereas fmh_oflags report * on the overall record output. fmh_count should be set to the * length of the fmh_recs array, and fmh_entries will be set to the * number of entries filled out during each call. If fmh_count is * zero, the number of reverse mappings will be returned in * fmh_entries, though no mappings will be returned. fmh_reserved * must be set to zero. * * The two elements in the fmh_keys array are used to constrain the * output. The first element in the array should represent the * lowest disk mapping ("low key") that the user wants to learn * about. If this value is all zeroes, the filesystem will return * the first entry it knows about. For a subsequent call, the * contents of fsmap_head.fmh_recs[fsmap_head.fmh_count - 1] should be * copied into fmh_keys[0] to have the kernel start where it left off. * * The second element in the fmh_keys array should represent the * highest disk mapping ("high key") that the user wants to learn * about. If this value is all ones, the filesystem will not stop * until it runs out of mapping to return or runs out of space in * fmh_recs. * * fmr_device can be either a 32-bit cookie representing a device, or * a 32-bit dev_t if the FMH_OF_DEV_T flag is set. fmr_physical, * fmr_offset, and fmr_length are expressed in units of bytes. * fmr_owner is either an inode number, or a special value if * FMR_OF_SPECIAL_OWNER is set in fmr_flags. */ struct fsmap { __u32 fmr_device; /* device id */ __u32 fmr_flags; /* mapping flags */ __u64 fmr_physical; /* device offset of segment */ __u64 fmr_owner; /* owner id */ __u64 fmr_offset; /* file offset of segment */ __u64 fmr_length; /* length of segment */ __u64 fmr_reserved[3]; /* must be zero */ }; struct fsmap_head { __u32 fmh_iflags; /* control flags */ __u32 fmh_oflags; /* output flags */ __u32 fmh_count; /* # of entries in array incl. input */ __u32 fmh_entries; /* # of entries filled in (output). */ __u64 fmh_reserved[6]; /* must be zero */ struct fsmap fmh_keys[2]; /* low and high keys for the mapping search */ struct fsmap fmh_recs[]; /* returned records */ }; /* Size of an fsmap_head with room for nr records. */ static __inline__ size_t fsmap_sizeof( unsigned int nr) { return sizeof(struct fsmap_head) + nr * sizeof(struct fsmap); } /* Start the next fsmap query at the end of the current query results. */ static __inline__ void fsmap_advance( struct fsmap_head *head) { head->fmh_keys[0] = head->fmh_recs[head->fmh_entries - 1]; } /* fmh_iflags values - set by FS_IOC_GETFSMAP caller in the header. */ /* no flags defined yet */ #define FMH_IF_VALID 0 /* fmh_oflags values - returned in the header segment only. */ #define FMH_OF_DEV_T 0x1 /* fmr_device values will be dev_t */ /* fmr_flags values - returned for each non-header segment */ #define FMR_OF_PREALLOC 0x1 /* segment = unwritten pre-allocation */ #define FMR_OF_ATTR_FORK 0x2 /* segment = attribute fork */ #define FMR_OF_EXTENT_MAP 0x4 /* segment = extent map */ #define FMR_OF_SHARED 0x8 /* segment = shared with another file */ #define FMR_OF_SPECIAL_OWNER 0x10 /* owner is a special value */ #define FMR_OF_LAST 0x20 /* segment is the last in the dataset */ /* Each FS gets to define its own special owner codes. */ #define FMR_OWNER(type, code) (((__u64)type << 32) | \ ((__u64)code & 0xFFFFFFFFULL)) #define FMR_OWNER_TYPE(owner) ((__u32)((__u64)owner >> 32)) #define FMR_OWNER_CODE(owner) ((__u32)(((__u64)owner & 0xFFFFFFFFULL))) #define FMR_OWN_FREE FMR_OWNER(0, 1) /* free space */ #define FMR_OWN_UNKNOWN FMR_OWNER(0, 2) /* unknown owner */ #define FMR_OWN_METADATA FMR_OWNER(0, 3) /* metadata */ #define FS_IOC_GETFSMAP _IOWR('X', 59, struct fsmap_head) #endif /* _LINUX_FSMAP_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/atm_nicstar.h���������������������������������������������������������������������������������0000644�����������������00000002376�14763166027�0010404 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /****************************************************************************** * * atm_nicstar.h * * Driver-specific declarations for use by NICSTAR driver specific utils. * * Author: Rui Prior * * (C) INESC 1998 * ******************************************************************************/ #ifndef LINUX_ATM_NICSTAR_H #define LINUX_ATM_NICSTAR_H /* Note: non-kernel programs including this file must also include * sys/types.h for struct timeval */ #include <linux/atmapi.h> #include <linux/atmioc.h> #define NS_GETPSTAT _IOWR('a',ATMIOC_SARPRV+1,struct atmif_sioc) /* get pool statistics */ #define NS_SETBUFLEV _IOW('a',ATMIOC_SARPRV+2,struct atmif_sioc) /* set buffer level markers */ #define NS_ADJBUFLEV _IO('a',ATMIOC_SARPRV+3) /* adjust buffer level */ typedef struct buf_nr { unsigned min; unsigned init; unsigned max; }buf_nr; typedef struct pool_levels { int buftype; int count; /* (At least for now) only used in NS_GETPSTAT */ buf_nr level; } pool_levels; /* type must be one of the following: */ #define NS_BUFTYPE_SMALL 1 #define NS_BUFTYPE_LARGE 2 #define NS_BUFTYPE_HUGE 3 #define NS_BUFTYPE_IOVEC 4 #endif /* LINUX_ATM_NICSTAR_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_bonding.h����������������������������������������������������������������������������������0000644�����������������00000010254�14763166027�0010170 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* * Bond several ethernet interfaces into a Cisco, running 'Etherchannel'. * * * Portions are (c) Copyright 1995 Simon "Guru Aleph-Null" Janes * NCM: Network and Communications Management, Inc. * * BUT, I'm the one who modified it for ethernet, so: * (c) Copyright 1999, Thomas Davis, tadavis@lbl.gov * * This software may be used and distributed according to the terms * of the GNU Public License, incorporated herein by reference. * * 2003/03/18 - Amir Noam <amir.noam at intel dot com> * - Added support for getting slave's speed and duplex via ethtool. * Needed for 802.3ad and other future modes. * * 2003/03/18 - Tsippy Mendelson <tsippy.mendelson at intel dot com> and * Shmulik Hen <shmulik.hen at intel dot com> * - Enable support of modes that need to use the unique mac address of * each slave. * * 2003/03/18 - Tsippy Mendelson <tsippy.mendelson at intel dot com> and * Amir Noam <amir.noam at intel dot com> * - Moved driver's private data types to bonding.h * * 2003/03/18 - Amir Noam <amir.noam at intel dot com>, * Tsippy Mendelson <tsippy.mendelson at intel dot com> and * Shmulik Hen <shmulik.hen at intel dot com> * - Added support for IEEE 802.3ad Dynamic link aggregation mode. * * 2003/05/01 - Amir Noam <amir.noam at intel dot com> * - Added ABI version control to restore compatibility between * new/old ifenslave and new/old bonding. * * 2003/12/01 - Shmulik Hen <shmulik.hen at intel dot com> * - Code cleanup and style changes * * 2005/05/05 - Jason Gabler <jygabler at lbl dot gov> * - added definitions for various XOR hashing policies */ #ifndef _LINUX_IF_BONDING_H #define _LINUX_IF_BONDING_H #include <linux/if.h> #include <linux/types.h> #include <linux/if_ether.h> /* userland - kernel ABI version (2003/05/08) */ #define BOND_ABI_VERSION 2 /* * We can remove these ioctl definitions in 2.5. People should use the * SIOC*** versions of them instead */ #define BOND_ENSLAVE_OLD (SIOCDEVPRIVATE) #define BOND_RELEASE_OLD (SIOCDEVPRIVATE + 1) #define BOND_SETHWADDR_OLD (SIOCDEVPRIVATE + 2) #define BOND_SLAVE_INFO_QUERY_OLD (SIOCDEVPRIVATE + 11) #define BOND_INFO_QUERY_OLD (SIOCDEVPRIVATE + 12) #define BOND_CHANGE_ACTIVE_OLD (SIOCDEVPRIVATE + 13) #define BOND_CHECK_MII_STATUS (SIOCGMIIPHY) #define BOND_MODE_ROUNDROBIN 0 #define BOND_MODE_ACTIVEBACKUP 1 #define BOND_MODE_XOR 2 #define BOND_MODE_BROADCAST 3 #define BOND_MODE_8023AD 4 #define BOND_MODE_TLB 5 #define BOND_MODE_ALB 6 /* TLB + RLB (receive load balancing) */ /* each slave's link has 4 states */ #define BOND_LINK_UP 0 /* link is up and running */ #define BOND_LINK_FAIL 1 /* link has just gone down */ #define BOND_LINK_DOWN 2 /* link has been down for too long time */ #define BOND_LINK_BACK 3 /* link is going back */ /* each slave has several states */ #define BOND_STATE_ACTIVE 0 /* link is active */ #define BOND_STATE_BACKUP 1 /* link is backup */ #define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */ #define BOND_DEFAULT_TX_QUEUES 16 /* Default number of tx queues per device */ #define BOND_DEFAULT_RESEND_IGMP 1 /* Default number of IGMP membership reports */ /* hashing types */ #define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */ #define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */ #define BOND_XMIT_POLICY_LAYER23 2 /* layer 2+3 (IP ^ MAC) */ #define BOND_XMIT_POLICY_ENCAP23 3 /* encapsulated layer 2+3 */ #define BOND_XMIT_POLICY_ENCAP34 4 /* encapsulated layer 3+4 */ typedef struct ifbond { __s32 bond_mode; __s32 num_slaves; __s32 miimon; } ifbond; typedef struct ifslave { __s32 slave_id; /* Used as an IN param to the BOND_SLAVE_INFO_QUERY ioctl */ char slave_name[IFNAMSIZ]; __s8 link; __s8 state; __u32 link_failure_count; } ifslave; struct ad_info { __u16 aggregator_id; __u16 ports; __u16 actor_key; __u16 partner_key; __u8 partner_system[ETH_ALEN]; }; #endif /* _LINUX_IF_BONDING_H */ /* * Local variables: * version-control: t * kept-new-versions: 5 * c-indent-level: 8 * c-basic-offset: 8 * tab-width: 8 * End: */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/seg6_genl.h�����������������������������������������������������������������������������������0000644�����������������00000001115�14763166027�0007737 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SEG6_GENL_H #define _LINUX_SEG6_GENL_H #define SEG6_GENL_NAME "SEG6" #define SEG6_GENL_VERSION 0x1 enum { SEG6_ATTR_UNSPEC, SEG6_ATTR_DST, SEG6_ATTR_DSTLEN, SEG6_ATTR_HMACKEYID, SEG6_ATTR_SECRET, SEG6_ATTR_SECRETLEN, SEG6_ATTR_ALGID, SEG6_ATTR_HMACINFO, __SEG6_ATTR_MAX, }; #define SEG6_ATTR_MAX (__SEG6_ATTR_MAX - 1) enum { SEG6_CMD_UNSPEC, SEG6_CMD_SETHMAC, SEG6_CMD_DUMPHMAC, SEG6_CMD_SET_TUNSRC, SEG6_CMD_GET_TUNSRC, __SEG6_CMD_MAX, }; #define SEG6_CMD_MAX (__SEG6_CMD_MAX - 1) #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/auto_dev-ioctl.h������������������������������������������������������������������������������0000644�����������������00000011572�14763166027�0011014 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright 2008 Red Hat, Inc. All rights reserved. * Copyright 2008 Ian Kent <raven@themaw.net> * * This file is part of the Linux kernel and is made available under * the terms of the GNU General Public License, version 2, or at your * option, any later version, incorporated herein by reference. */ #ifndef _LINUX_AUTO_DEV_IOCTL_H #define _LINUX_AUTO_DEV_IOCTL_H #include <linux/auto_fs.h> #include <linux/string.h> #define AUTOFS_DEVICE_NAME "autofs" #define AUTOFS_DEV_IOCTL_VERSION_MAJOR 1 #define AUTOFS_DEV_IOCTL_VERSION_MINOR 1 #define AUTOFS_DEV_IOCTL_SIZE sizeof(struct autofs_dev_ioctl) /* * An ioctl interface for autofs mount point control. */ struct args_protover { __u32 version; }; struct args_protosubver { __u32 sub_version; }; struct args_openmount { __u32 devid; }; struct args_ready { __u32 token; }; struct args_fail { __u32 token; __s32 status; }; struct args_setpipefd { __s32 pipefd; }; struct args_timeout { __u64 timeout; }; struct args_requester { __u32 uid; __u32 gid; }; struct args_expire { __u32 how; }; struct args_askumount { __u32 may_umount; }; struct args_ismountpoint { union { struct args_in { __u32 type; } in; struct args_out { __u32 devid; __u32 magic; } out; }; }; /* * All the ioctls use this structure. * When sending a path size must account for the total length * of the chunk of memory otherwise is is the size of the * structure. */ struct autofs_dev_ioctl { __u32 ver_major; __u32 ver_minor; __u32 size; /* total size of data passed in * including this struct */ __s32 ioctlfd; /* automount command fd */ /* Command parameters */ union { struct args_protover protover; struct args_protosubver protosubver; struct args_openmount openmount; struct args_ready ready; struct args_fail fail; struct args_setpipefd setpipefd; struct args_timeout timeout; struct args_requester requester; struct args_expire expire; struct args_askumount askumount; struct args_ismountpoint ismountpoint; }; char path[0]; }; static __inline__ void init_autofs_dev_ioctl(struct autofs_dev_ioctl *in) { memset(in, 0, AUTOFS_DEV_IOCTL_SIZE); in->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR; in->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR; in->size = AUTOFS_DEV_IOCTL_SIZE; in->ioctlfd = -1; } enum { /* Get various version info */ AUTOFS_DEV_IOCTL_VERSION_CMD = 0x71, AUTOFS_DEV_IOCTL_PROTOVER_CMD, AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD, /* Open mount ioctl fd */ AUTOFS_DEV_IOCTL_OPENMOUNT_CMD, /* Close mount ioctl fd */ AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD, /* Mount/expire status returns */ AUTOFS_DEV_IOCTL_READY_CMD, AUTOFS_DEV_IOCTL_FAIL_CMD, /* Activate/deactivate autofs mount */ AUTOFS_DEV_IOCTL_SETPIPEFD_CMD, AUTOFS_DEV_IOCTL_CATATONIC_CMD, /* Expiry timeout */ AUTOFS_DEV_IOCTL_TIMEOUT_CMD, /* Get mount last requesting uid and gid */ AUTOFS_DEV_IOCTL_REQUESTER_CMD, /* Check for eligible expire candidates */ AUTOFS_DEV_IOCTL_EXPIRE_CMD, /* Request busy status */ AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD, /* Check if path is a mountpoint */ AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD, }; #define AUTOFS_DEV_IOCTL_VERSION \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_VERSION_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_PROTOVER \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_PROTOVER_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_PROTOSUBVER \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_OPENMOUNT \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_OPENMOUNT_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_CLOSEMOUNT \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_READY \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_READY_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_FAIL \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_FAIL_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_SETPIPEFD \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_SETPIPEFD_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_CATATONIC \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_CATATONIC_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_TIMEOUT \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_TIMEOUT_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_REQUESTER \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_REQUESTER_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_EXPIRE \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_EXPIRE_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_ASKUMOUNT \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_ISMOUNTPOINT \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD, struct autofs_dev_ioctl) #endif /* _LINUX_AUTO_DEV_IOCTL_H */ ��������������������������������������������������������������������������������������������������������������������������������������linux/devlink.h�������������������������������������������������������������������������������������0000644�����������������00000023344�14763166027�0007532 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * include/uapi/linux/devlink.h - Network physical device Netlink interface * Copyright (c) 2016 Mellanox Technologies. All rights reserved. * Copyright (c) 2016 Jiri Pirko <jiri@mellanox.com> * * 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. */ #ifndef _LINUX_DEVLINK_H_ #define _LINUX_DEVLINK_H_ #define DEVLINK_GENL_NAME "devlink" #define DEVLINK_GENL_VERSION 0x1 #define DEVLINK_GENL_MCGRP_CONFIG_NAME "config" enum devlink_command { /* don't change the order or add anything between, this is ABI! */ DEVLINK_CMD_UNSPEC, DEVLINK_CMD_GET, /* can dump */ DEVLINK_CMD_SET, DEVLINK_CMD_NEW, DEVLINK_CMD_DEL, DEVLINK_CMD_PORT_GET, /* can dump */ DEVLINK_CMD_PORT_SET, DEVLINK_CMD_PORT_NEW, DEVLINK_CMD_PORT_DEL, DEVLINK_CMD_PORT_SPLIT, DEVLINK_CMD_PORT_UNSPLIT, DEVLINK_CMD_SB_GET, /* can dump */ DEVLINK_CMD_SB_SET, DEVLINK_CMD_SB_NEW, DEVLINK_CMD_SB_DEL, DEVLINK_CMD_SB_POOL_GET, /* can dump */ DEVLINK_CMD_SB_POOL_SET, DEVLINK_CMD_SB_POOL_NEW, DEVLINK_CMD_SB_POOL_DEL, DEVLINK_CMD_SB_PORT_POOL_GET, /* can dump */ DEVLINK_CMD_SB_PORT_POOL_SET, DEVLINK_CMD_SB_PORT_POOL_NEW, DEVLINK_CMD_SB_PORT_POOL_DEL, DEVLINK_CMD_SB_TC_POOL_BIND_GET, /* can dump */ DEVLINK_CMD_SB_TC_POOL_BIND_SET, DEVLINK_CMD_SB_TC_POOL_BIND_NEW, DEVLINK_CMD_SB_TC_POOL_BIND_DEL, /* Shared buffer occupancy monitoring commands */ DEVLINK_CMD_SB_OCC_SNAPSHOT, DEVLINK_CMD_SB_OCC_MAX_CLEAR, DEVLINK_CMD_ESWITCH_GET, #define DEVLINK_CMD_ESWITCH_MODE_GET /* obsolete, never use this! */ \ DEVLINK_CMD_ESWITCH_GET DEVLINK_CMD_ESWITCH_SET, #define DEVLINK_CMD_ESWITCH_MODE_SET /* obsolete, never use this! */ \ DEVLINK_CMD_ESWITCH_SET DEVLINK_CMD_DPIPE_TABLE_GET, DEVLINK_CMD_DPIPE_ENTRIES_GET, DEVLINK_CMD_DPIPE_HEADERS_GET, DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET, DEVLINK_CMD_RESOURCE_SET, DEVLINK_CMD_RESOURCE_DUMP, /* Hot driver reload, makes configuration changes take place. The * devlink instance is not released during the process. */ DEVLINK_CMD_RELOAD, DEVLINK_CMD_PARAM_GET, /* can dump */ DEVLINK_CMD_PARAM_SET, DEVLINK_CMD_PARAM_NEW, DEVLINK_CMD_PARAM_DEL, DEVLINK_CMD_REGION_GET, DEVLINK_CMD_REGION_SET, DEVLINK_CMD_REGION_NEW, DEVLINK_CMD_REGION_DEL, DEVLINK_CMD_REGION_READ, /* add new commands above here */ __DEVLINK_CMD_MAX, DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1 }; enum devlink_port_type { DEVLINK_PORT_TYPE_NOTSET, DEVLINK_PORT_TYPE_AUTO, DEVLINK_PORT_TYPE_ETH, DEVLINK_PORT_TYPE_IB, }; enum devlink_sb_pool_type { DEVLINK_SB_POOL_TYPE_INGRESS, DEVLINK_SB_POOL_TYPE_EGRESS, }; /* static threshold - limiting the maximum number of bytes. * dynamic threshold - limiting the maximum number of bytes * based on the currently available free space in the shared buffer pool. * In this mode, the maximum quota is calculated based * on the following formula: * max_quota = alpha / (1 + alpha) * Free_Buffer * While Free_Buffer is the amount of none-occupied buffer associated to * the relevant pool. * The value range which can be passed is 0-20 and serves * for computation of alpha by following formula: * alpha = 2 ^ (passed_value - 10) */ enum devlink_sb_threshold_type { DEVLINK_SB_THRESHOLD_TYPE_STATIC, DEVLINK_SB_THRESHOLD_TYPE_DYNAMIC, }; #define DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX 20 enum devlink_eswitch_mode { DEVLINK_ESWITCH_MODE_LEGACY, DEVLINK_ESWITCH_MODE_SWITCHDEV, }; enum devlink_eswitch_inline_mode { DEVLINK_ESWITCH_INLINE_MODE_NONE, DEVLINK_ESWITCH_INLINE_MODE_LINK, DEVLINK_ESWITCH_INLINE_MODE_NETWORK, DEVLINK_ESWITCH_INLINE_MODE_TRANSPORT, }; enum devlink_eswitch_encap_mode { DEVLINK_ESWITCH_ENCAP_MODE_NONE, DEVLINK_ESWITCH_ENCAP_MODE_BASIC, }; enum devlink_port_flavour { DEVLINK_PORT_FLAVOUR_PHYSICAL, /* Any kind of a port physically * facing the user. */ DEVLINK_PORT_FLAVOUR_CPU, /* CPU port */ DEVLINK_PORT_FLAVOUR_DSA, /* Distributed switch architecture * interconnect port. */ }; enum devlink_param_cmode { DEVLINK_PARAM_CMODE_RUNTIME, DEVLINK_PARAM_CMODE_DRIVERINIT, DEVLINK_PARAM_CMODE_PERMANENT, /* Add new configuration modes above */ __DEVLINK_PARAM_CMODE_MAX, DEVLINK_PARAM_CMODE_MAX = __DEVLINK_PARAM_CMODE_MAX - 1 }; enum devlink_attr { /* don't change the order or add anything between, this is ABI! */ DEVLINK_ATTR_UNSPEC, /* bus name + dev name together are a handle for devlink entity */ DEVLINK_ATTR_BUS_NAME, /* string */ DEVLINK_ATTR_DEV_NAME, /* string */ DEVLINK_ATTR_PORT_INDEX, /* u32 */ DEVLINK_ATTR_PORT_TYPE, /* u16 */ DEVLINK_ATTR_PORT_DESIRED_TYPE, /* u16 */ DEVLINK_ATTR_PORT_NETDEV_IFINDEX, /* u32 */ DEVLINK_ATTR_PORT_NETDEV_NAME, /* string */ DEVLINK_ATTR_PORT_IBDEV_NAME, /* string */ DEVLINK_ATTR_PORT_SPLIT_COUNT, /* u32 */ DEVLINK_ATTR_PORT_SPLIT_GROUP, /* u32 */ DEVLINK_ATTR_SB_INDEX, /* u32 */ DEVLINK_ATTR_SB_SIZE, /* u32 */ DEVLINK_ATTR_SB_INGRESS_POOL_COUNT, /* u16 */ DEVLINK_ATTR_SB_EGRESS_POOL_COUNT, /* u16 */ DEVLINK_ATTR_SB_INGRESS_TC_COUNT, /* u16 */ DEVLINK_ATTR_SB_EGRESS_TC_COUNT, /* u16 */ DEVLINK_ATTR_SB_POOL_INDEX, /* u16 */ DEVLINK_ATTR_SB_POOL_TYPE, /* u8 */ DEVLINK_ATTR_SB_POOL_SIZE, /* u32 */ DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE, /* u8 */ DEVLINK_ATTR_SB_THRESHOLD, /* u32 */ DEVLINK_ATTR_SB_TC_INDEX, /* u16 */ DEVLINK_ATTR_SB_OCC_CUR, /* u32 */ DEVLINK_ATTR_SB_OCC_MAX, /* u32 */ DEVLINK_ATTR_ESWITCH_MODE, /* u16 */ DEVLINK_ATTR_ESWITCH_INLINE_MODE, /* u8 */ DEVLINK_ATTR_DPIPE_TABLES, /* nested */ DEVLINK_ATTR_DPIPE_TABLE, /* nested */ DEVLINK_ATTR_DPIPE_TABLE_NAME, /* string */ DEVLINK_ATTR_DPIPE_TABLE_SIZE, /* u64 */ DEVLINK_ATTR_DPIPE_TABLE_MATCHES, /* nested */ DEVLINK_ATTR_DPIPE_TABLE_ACTIONS, /* nested */ DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED, /* u8 */ DEVLINK_ATTR_DPIPE_ENTRIES, /* nested */ DEVLINK_ATTR_DPIPE_ENTRY, /* nested */ DEVLINK_ATTR_DPIPE_ENTRY_INDEX, /* u64 */ DEVLINK_ATTR_DPIPE_ENTRY_MATCH_VALUES, /* nested */ DEVLINK_ATTR_DPIPE_ENTRY_ACTION_VALUES, /* nested */ DEVLINK_ATTR_DPIPE_ENTRY_COUNTER, /* u64 */ DEVLINK_ATTR_DPIPE_MATCH, /* nested */ DEVLINK_ATTR_DPIPE_MATCH_VALUE, /* nested */ DEVLINK_ATTR_DPIPE_MATCH_TYPE, /* u32 */ DEVLINK_ATTR_DPIPE_ACTION, /* nested */ DEVLINK_ATTR_DPIPE_ACTION_VALUE, /* nested */ DEVLINK_ATTR_DPIPE_ACTION_TYPE, /* u32 */ DEVLINK_ATTR_DPIPE_VALUE, DEVLINK_ATTR_DPIPE_VALUE_MASK, DEVLINK_ATTR_DPIPE_VALUE_MAPPING, /* u32 */ DEVLINK_ATTR_DPIPE_HEADERS, /* nested */ DEVLINK_ATTR_DPIPE_HEADER, /* nested */ DEVLINK_ATTR_DPIPE_HEADER_NAME, /* string */ DEVLINK_ATTR_DPIPE_HEADER_ID, /* u32 */ DEVLINK_ATTR_DPIPE_HEADER_FIELDS, /* nested */ DEVLINK_ATTR_DPIPE_HEADER_GLOBAL, /* u8 */ DEVLINK_ATTR_DPIPE_HEADER_INDEX, /* u32 */ DEVLINK_ATTR_DPIPE_FIELD, /* nested */ DEVLINK_ATTR_DPIPE_FIELD_NAME, /* string */ DEVLINK_ATTR_DPIPE_FIELD_ID, /* u32 */ DEVLINK_ATTR_DPIPE_FIELD_BITWIDTH, /* u32 */ DEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE, /* u32 */ DEVLINK_ATTR_PAD, DEVLINK_ATTR_ESWITCH_ENCAP_MODE, /* u8 */ DEVLINK_ATTR_RESOURCE_LIST, /* nested */ DEVLINK_ATTR_RESOURCE, /* nested */ DEVLINK_ATTR_RESOURCE_NAME, /* string */ DEVLINK_ATTR_RESOURCE_ID, /* u64 */ DEVLINK_ATTR_RESOURCE_SIZE, /* u64 */ DEVLINK_ATTR_RESOURCE_SIZE_NEW, /* u64 */ DEVLINK_ATTR_RESOURCE_SIZE_VALID, /* u8 */ DEVLINK_ATTR_RESOURCE_SIZE_MIN, /* u64 */ DEVLINK_ATTR_RESOURCE_SIZE_MAX, /* u64 */ DEVLINK_ATTR_RESOURCE_SIZE_GRAN, /* u64 */ DEVLINK_ATTR_RESOURCE_UNIT, /* u8 */ DEVLINK_ATTR_RESOURCE_OCC, /* u64 */ DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID, /* u64 */ DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_UNITS,/* u64 */ DEVLINK_ATTR_PORT_FLAVOUR, /* u16 */ DEVLINK_ATTR_PORT_NUMBER, /* u32 */ DEVLINK_ATTR_PORT_SPLIT_SUBPORT_NUMBER, /* u32 */ DEVLINK_ATTR_PARAM, /* nested */ DEVLINK_ATTR_PARAM_NAME, /* string */ DEVLINK_ATTR_PARAM_GENERIC, /* flag */ DEVLINK_ATTR_PARAM_TYPE, /* u8 */ DEVLINK_ATTR_PARAM_VALUES_LIST, /* nested */ DEVLINK_ATTR_PARAM_VALUE, /* nested */ DEVLINK_ATTR_PARAM_VALUE_DATA, /* dynamic */ DEVLINK_ATTR_PARAM_VALUE_CMODE, /* u8 */ DEVLINK_ATTR_REGION_NAME, /* string */ DEVLINK_ATTR_REGION_SIZE, /* u64 */ DEVLINK_ATTR_REGION_SNAPSHOTS, /* nested */ DEVLINK_ATTR_REGION_SNAPSHOT, /* nested */ DEVLINK_ATTR_REGION_SNAPSHOT_ID, /* u32 */ DEVLINK_ATTR_REGION_CHUNKS, /* nested */ DEVLINK_ATTR_REGION_CHUNK, /* nested */ DEVLINK_ATTR_REGION_CHUNK_DATA, /* binary */ DEVLINK_ATTR_REGION_CHUNK_ADDR, /* u64 */ DEVLINK_ATTR_REGION_CHUNK_LEN, /* u64 */ /* add new attributes above here, update the policy in devlink.c */ __DEVLINK_ATTR_MAX, DEVLINK_ATTR_MAX = __DEVLINK_ATTR_MAX - 1 }; /* Mapping between internal resource described by the field and system * structure */ enum devlink_dpipe_field_mapping_type { DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE, DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX, }; /* Match type - specify the type of the match */ enum devlink_dpipe_match_type { DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT, }; /* Action type - specify the action type */ enum devlink_dpipe_action_type { DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY, }; enum devlink_dpipe_field_ethernet_id { DEVLINK_DPIPE_FIELD_ETHERNET_DST_MAC, }; enum devlink_dpipe_field_ipv4_id { DEVLINK_DPIPE_FIELD_IPV4_DST_IP, }; enum devlink_dpipe_field_ipv6_id { DEVLINK_DPIPE_FIELD_IPV6_DST_IP, }; enum devlink_dpipe_header_id { DEVLINK_DPIPE_HEADER_ETHERNET, DEVLINK_DPIPE_HEADER_IPV4, DEVLINK_DPIPE_HEADER_IPV6, }; enum devlink_resource_unit { DEVLINK_RESOURCE_UNIT_ENTRY, }; #endif /* _LINUX_DEVLINK_H_ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/smiapp.h��������������������������������������������������������������������������������������0000644�����������������00000002042�14763166027�0007357 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/uapi/linux/smiapp.h * * Generic driver for SMIA/SMIA++ compliant camera modules * * Copyright (C) 2014 Intel Corporation * Contact: Sakari Ailus <sakari.ailus@iki.fi> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * 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. * */ #ifndef __UAPI_LINUX_SMIAPP_H_ #define __UAPI_LINUX_SMIAPP_H_ #define V4L2_SMIAPP_TEST_PATTERN_MODE_DISABLED 0 #define V4L2_SMIAPP_TEST_PATTERN_MODE_SOLID_COLOUR 1 #define V4L2_SMIAPP_TEST_PATTERN_MODE_COLOUR_BARS 2 #define V4L2_SMIAPP_TEST_PATTERN_MODE_COLOUR_BARS_GREY 3 #define V4L2_SMIAPP_TEST_PATTERN_MODE_PN9 4 #endif /* __UAPI_LINUX_SMIAPP_H_ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/erspan.h��������������������������������������������������������������������������������������0000644�����������������00000002043�14763166027�0007357 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ERSPAN Tunnel Metadata * * Copyright (c) 2018 VMware * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation. * * Userspace API for metadata mode ERSPAN tunnel */ #ifndef _ERSPAN_H #define _ERSPAN_H #include <linux/types.h> /* For __beXX in userspace */ #include <asm/byteorder.h> /* ERSPAN version 2 metadata header */ struct erspan_md2 { __be32 timestamp; __be16 sgt; /* security group tag */ #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 hwid_upper:2, ft:5, p:1; __u8 o:1, gra:2, dir:1, hwid:4; #elif defined(__BIG_ENDIAN_BITFIELD) __u8 p:1, ft:5, hwid_upper:2; __u8 hwid:4, dir:1, gra:2, o:1; #else #error "Please fix <asm/byteorder.h>" #endif }; struct erspan_metadata { int version; union { __be32 index; /* Version 1 (type II)*/ struct erspan_md2 md2; /* Version 2 (type III) */ } u; }; #endif /* _ERSPAN_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/btrfs_tree.h����������������������������������������������������������������������������������0000644�����������������00000061305�14763166027�0010234 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _BTRFS_CTREE_H_ #define _BTRFS_CTREE_H_ #include <linux/btrfs.h> #include <linux/types.h> /* * This header contains the structure definitions and constants used * by file system objects that can be retrieved using * the BTRFS_IOC_SEARCH_TREE ioctl. That means basically anything that * is needed to describe a leaf node's key or item contents. */ /* holds pointers to all of the tree roots */ #define BTRFS_ROOT_TREE_OBJECTID 1ULL /* stores information about which extents are in use, and reference counts */ #define BTRFS_EXTENT_TREE_OBJECTID 2ULL /* * chunk tree stores translations from logical -> physical block numbering * the super block points to the chunk tree */ #define BTRFS_CHUNK_TREE_OBJECTID 3ULL /* * stores information about which areas of a given device are in use. * one per device. The tree of tree roots points to the device tree */ #define BTRFS_DEV_TREE_OBJECTID 4ULL /* one per subvolume, storing files and directories */ #define BTRFS_FS_TREE_OBJECTID 5ULL /* directory objectid inside the root tree */ #define BTRFS_ROOT_TREE_DIR_OBJECTID 6ULL /* holds checksums of all the data extents */ #define BTRFS_CSUM_TREE_OBJECTID 7ULL /* holds quota configuration and tracking */ #define BTRFS_QUOTA_TREE_OBJECTID 8ULL /* for storing items that use the BTRFS_UUID_KEY* types */ #define BTRFS_UUID_TREE_OBJECTID 9ULL /* tracks free space in block groups. */ #define BTRFS_FREE_SPACE_TREE_OBJECTID 10ULL /* device stats in the device tree */ #define BTRFS_DEV_STATS_OBJECTID 0ULL /* for storing balance parameters in the root tree */ #define BTRFS_BALANCE_OBJECTID -4ULL /* orhpan objectid for tracking unlinked/truncated files */ #define BTRFS_ORPHAN_OBJECTID -5ULL /* does write ahead logging to speed up fsyncs */ #define BTRFS_TREE_LOG_OBJECTID -6ULL #define BTRFS_TREE_LOG_FIXUP_OBJECTID -7ULL /* for space balancing */ #define BTRFS_TREE_RELOC_OBJECTID -8ULL #define BTRFS_DATA_RELOC_TREE_OBJECTID -9ULL /* * extent checksums all have this objectid * this allows them to share the logging tree * for fsyncs */ #define BTRFS_EXTENT_CSUM_OBJECTID -10ULL /* For storing free space cache */ #define BTRFS_FREE_SPACE_OBJECTID -11ULL /* * The inode number assigned to the special inode for storing * free ino cache */ #define BTRFS_FREE_INO_OBJECTID -12ULL /* dummy objectid represents multiple objectids */ #define BTRFS_MULTIPLE_OBJECTIDS -255ULL /* * All files have objectids in this range. */ #define BTRFS_FIRST_FREE_OBJECTID 256ULL #define BTRFS_LAST_FREE_OBJECTID -256ULL #define BTRFS_FIRST_CHUNK_TREE_OBJECTID 256ULL /* * the device items go into the chunk tree. The key is in the form * [ 1 BTRFS_DEV_ITEM_KEY device_id ] */ #define BTRFS_DEV_ITEMS_OBJECTID 1ULL #define BTRFS_BTREE_INODE_OBJECTID 1 #define BTRFS_EMPTY_SUBVOL_DIR_OBJECTID 2 #define BTRFS_DEV_REPLACE_DEVID 0ULL /* * inode items have the data typically returned from stat and store other * info about object characteristics. There is one for every file and dir in * the FS */ #define BTRFS_INODE_ITEM_KEY 1 #define BTRFS_INODE_REF_KEY 12 #define BTRFS_INODE_EXTREF_KEY 13 #define BTRFS_XATTR_ITEM_KEY 24 #define BTRFS_ORPHAN_ITEM_KEY 48 /* reserve 2-15 close to the inode for later flexibility */ /* * dir items are the name -> inode pointers in a directory. There is one * for every name in a directory. */ #define BTRFS_DIR_LOG_ITEM_KEY 60 #define BTRFS_DIR_LOG_INDEX_KEY 72 #define BTRFS_DIR_ITEM_KEY 84 #define BTRFS_DIR_INDEX_KEY 96 /* * extent data is for file data */ #define BTRFS_EXTENT_DATA_KEY 108 /* * extent csums are stored in a separate tree and hold csums for * an entire extent on disk. */ #define BTRFS_EXTENT_CSUM_KEY 128 /* * root items point to tree roots. They are typically in the root * tree used by the super block to find all the other trees */ #define BTRFS_ROOT_ITEM_KEY 132 /* * root backrefs tie subvols and snapshots to the directory entries that * reference them */ #define BTRFS_ROOT_BACKREF_KEY 144 /* * root refs make a fast index for listing all of the snapshots and * subvolumes referenced by a given root. They point directly to the * directory item in the root that references the subvol */ #define BTRFS_ROOT_REF_KEY 156 /* * extent items are in the extent map tree. These record which blocks * are used, and how many references there are to each block */ #define BTRFS_EXTENT_ITEM_KEY 168 /* * The same as the BTRFS_EXTENT_ITEM_KEY, except it's metadata we already know * the length, so we save the level in key->offset instead of the length. */ #define BTRFS_METADATA_ITEM_KEY 169 #define BTRFS_TREE_BLOCK_REF_KEY 176 #define BTRFS_EXTENT_DATA_REF_KEY 178 #define BTRFS_EXTENT_REF_V0_KEY 180 #define BTRFS_SHARED_BLOCK_REF_KEY 182 #define BTRFS_SHARED_DATA_REF_KEY 184 /* * block groups give us hints into the extent allocation trees. Which * blocks are free etc etc */ #define BTRFS_BLOCK_GROUP_ITEM_KEY 192 /* * Every block group is represented in the free space tree by a free space info * item, which stores some accounting information. It is keyed on * (block_group_start, FREE_SPACE_INFO, block_group_length). */ #define BTRFS_FREE_SPACE_INFO_KEY 198 /* * A free space extent tracks an extent of space that is free in a block group. * It is keyed on (start, FREE_SPACE_EXTENT, length). */ #define BTRFS_FREE_SPACE_EXTENT_KEY 199 /* * When a block group becomes very fragmented, we convert it to use bitmaps * instead of extents. A free space bitmap is keyed on * (start, FREE_SPACE_BITMAP, length); the corresponding item is a bitmap with * (length / sectorsize) bits. */ #define BTRFS_FREE_SPACE_BITMAP_KEY 200 #define BTRFS_DEV_EXTENT_KEY 204 #define BTRFS_DEV_ITEM_KEY 216 #define BTRFS_CHUNK_ITEM_KEY 228 /* * Records the overall state of the qgroups. * There's only one instance of this key present, * (0, BTRFS_QGROUP_STATUS_KEY, 0) */ #define BTRFS_QGROUP_STATUS_KEY 240 /* * Records the currently used space of the qgroup. * One key per qgroup, (0, BTRFS_QGROUP_INFO_KEY, qgroupid). */ #define BTRFS_QGROUP_INFO_KEY 242 /* * Contains the user configured limits for the qgroup. * One key per qgroup, (0, BTRFS_QGROUP_LIMIT_KEY, qgroupid). */ #define BTRFS_QGROUP_LIMIT_KEY 244 /* * Records the child-parent relationship of qgroups. For * each relation, 2 keys are present: * (childid, BTRFS_QGROUP_RELATION_KEY, parentid) * (parentid, BTRFS_QGROUP_RELATION_KEY, childid) */ #define BTRFS_QGROUP_RELATION_KEY 246 /* * Obsolete name, see BTRFS_TEMPORARY_ITEM_KEY. */ #define BTRFS_BALANCE_ITEM_KEY 248 /* * The key type for tree items that are stored persistently, but do not need to * exist for extended period of time. The items can exist in any tree. * * [subtype, BTRFS_TEMPORARY_ITEM_KEY, data] * * Existing items: * * - balance status item * (BTRFS_BALANCE_OBJECTID, BTRFS_TEMPORARY_ITEM_KEY, 0) */ #define BTRFS_TEMPORARY_ITEM_KEY 248 /* * Obsolete name, see BTRFS_PERSISTENT_ITEM_KEY */ #define BTRFS_DEV_STATS_KEY 249 /* * The key type for tree items that are stored persistently and usually exist * for a long period, eg. filesystem lifetime. The item kinds can be status * information, stats or preference values. The item can exist in any tree. * * [subtype, BTRFS_PERSISTENT_ITEM_KEY, data] * * Existing items: * * - device statistics, store IO stats in the device tree, one key for all * stats * (BTRFS_DEV_STATS_OBJECTID, BTRFS_DEV_STATS_KEY, 0) */ #define BTRFS_PERSISTENT_ITEM_KEY 249 /* * Persistantly stores the device replace state in the device tree. * The key is built like this: (0, BTRFS_DEV_REPLACE_KEY, 0). */ #define BTRFS_DEV_REPLACE_KEY 250 /* * Stores items that allow to quickly map UUIDs to something else. * These items are part of the filesystem UUID tree. * The key is built like this: * (UUID_upper_64_bits, BTRFS_UUID_KEY*, UUID_lower_64_bits). */ #if BTRFS_UUID_SIZE != 16 #error "UUID items require BTRFS_UUID_SIZE == 16!" #endif #define BTRFS_UUID_KEY_SUBVOL 251 /* for UUIDs assigned to subvols */ #define BTRFS_UUID_KEY_RECEIVED_SUBVOL 252 /* for UUIDs assigned to * received subvols */ /* * string items are for debugging. They just store a short string of * data in the FS */ #define BTRFS_STRING_ITEM_KEY 253 /* 32 bytes in various csum fields */ #define BTRFS_CSUM_SIZE 32 /* csum types */ #define BTRFS_CSUM_TYPE_CRC32 0 /* * flags definitions for directory entry item type * * Used by: * struct btrfs_dir_item.type */ #define BTRFS_FT_UNKNOWN 0 #define BTRFS_FT_REG_FILE 1 #define BTRFS_FT_DIR 2 #define BTRFS_FT_CHRDEV 3 #define BTRFS_FT_BLKDEV 4 #define BTRFS_FT_FIFO 5 #define BTRFS_FT_SOCK 6 #define BTRFS_FT_SYMLINK 7 #define BTRFS_FT_XATTR 8 #define BTRFS_FT_MAX 9 /* * The key defines the order in the tree, and so it also defines (optimal) * block layout. * * objectid corresponds to the inode number. * * type tells us things about the object, and is a kind of stream selector. * so for a given inode, keys with type of 1 might refer to the inode data, * type of 2 may point to file data in the btree and type == 3 may point to * extents. * * offset is the starting byte offset for this key in the stream. * * btrfs_disk_key is in disk byte order. struct btrfs_key is always * in cpu native order. Otherwise they are identical and their sizes * should be the same (ie both packed) */ struct btrfs_disk_key { __le64 objectid; __u8 type; __le64 offset; } __attribute__ ((__packed__)); struct btrfs_key { __u64 objectid; __u8 type; __u64 offset; } __attribute__ ((__packed__)); struct btrfs_dev_item { /* the internal btrfs device id */ __le64 devid; /* size of the device */ __le64 total_bytes; /* bytes used */ __le64 bytes_used; /* optimal io alignment for this device */ __le32 io_align; /* optimal io width for this device */ __le32 io_width; /* minimal io size for this device */ __le32 sector_size; /* type and info about this device */ __le64 type; /* expected generation for this device */ __le64 generation; /* * starting byte of this partition on the device, * to allow for stripe alignment in the future */ __le64 start_offset; /* grouping information for allocation decisions */ __le32 dev_group; /* seek speed 0-100 where 100 is fastest */ __u8 seek_speed; /* bandwidth 0-100 where 100 is fastest */ __u8 bandwidth; /* btrfs generated uuid for this device */ __u8 uuid[BTRFS_UUID_SIZE]; /* uuid of FS who owns this device */ __u8 fsid[BTRFS_UUID_SIZE]; } __attribute__ ((__packed__)); struct btrfs_stripe { __le64 devid; __le64 offset; __u8 dev_uuid[BTRFS_UUID_SIZE]; } __attribute__ ((__packed__)); struct btrfs_chunk { /* size of this chunk in bytes */ __le64 length; /* objectid of the root referencing this chunk */ __le64 owner; __le64 stripe_len; __le64 type; /* optimal io alignment for this chunk */ __le32 io_align; /* optimal io width for this chunk */ __le32 io_width; /* minimal io size for this chunk */ __le32 sector_size; /* 2^16 stripes is quite a lot, a second limit is the size of a single * item in the btree */ __le16 num_stripes; /* sub stripes only matter for raid10 */ __le16 sub_stripes; struct btrfs_stripe stripe; /* additional stripes go here */ } __attribute__ ((__packed__)); #define BTRFS_FREE_SPACE_EXTENT 1 #define BTRFS_FREE_SPACE_BITMAP 2 struct btrfs_free_space_entry { __le64 offset; __le64 bytes; __u8 type; } __attribute__ ((__packed__)); struct btrfs_free_space_header { struct btrfs_disk_key location; __le64 generation; __le64 num_entries; __le64 num_bitmaps; } __attribute__ ((__packed__)); #define BTRFS_HEADER_FLAG_WRITTEN (1ULL << 0) #define BTRFS_HEADER_FLAG_RELOC (1ULL << 1) /* Super block flags */ /* Errors detected */ #define BTRFS_SUPER_FLAG_ERROR (1ULL << 2) #define BTRFS_SUPER_FLAG_SEEDING (1ULL << 32) #define BTRFS_SUPER_FLAG_METADUMP (1ULL << 33) #define BTRFS_SUPER_FLAG_METADUMP_V2 (1ULL << 34) #define BTRFS_SUPER_FLAG_CHANGING_FSID (1ULL << 35) /* * items in the extent btree are used to record the objectid of the * owner of the block and the number of references */ struct btrfs_extent_item { __le64 refs; __le64 generation; __le64 flags; } __attribute__ ((__packed__)); struct btrfs_extent_item_v0 { __le32 refs; } __attribute__ ((__packed__)); #define BTRFS_EXTENT_FLAG_DATA (1ULL << 0) #define BTRFS_EXTENT_FLAG_TREE_BLOCK (1ULL << 1) /* following flags only apply to tree blocks */ /* use full backrefs for extent pointers in the block */ #define BTRFS_BLOCK_FLAG_FULL_BACKREF (1ULL << 8) /* * this flag is only used internally by scrub and may be changed at any time * it is only declared here to avoid collisions */ #define BTRFS_EXTENT_FLAG_SUPER (1ULL << 48) struct btrfs_tree_block_info { struct btrfs_disk_key key; __u8 level; } __attribute__ ((__packed__)); struct btrfs_extent_data_ref { __le64 root; __le64 objectid; __le64 offset; __le32 count; } __attribute__ ((__packed__)); struct btrfs_shared_data_ref { __le32 count; } __attribute__ ((__packed__)); struct btrfs_extent_inline_ref { __u8 type; __le64 offset; } __attribute__ ((__packed__)); /* old style backrefs item */ struct btrfs_extent_ref_v0 { __le64 root; __le64 generation; __le64 objectid; __le32 count; } __attribute__ ((__packed__)); /* dev extents record free space on individual devices. The owner * field points back to the chunk allocation mapping tree that allocated * the extent. The chunk tree uuid field is a way to double check the owner */ struct btrfs_dev_extent { __le64 chunk_tree; __le64 chunk_objectid; __le64 chunk_offset; __le64 length; __u8 chunk_tree_uuid[BTRFS_UUID_SIZE]; } __attribute__ ((__packed__)); struct btrfs_inode_ref { __le64 index; __le16 name_len; /* name goes here */ } __attribute__ ((__packed__)); struct btrfs_inode_extref { __le64 parent_objectid; __le64 index; __le16 name_len; __u8 name[0]; /* name goes here */ } __attribute__ ((__packed__)); struct btrfs_timespec { __le64 sec; __le32 nsec; } __attribute__ ((__packed__)); struct btrfs_inode_item { /* nfs style generation number */ __le64 generation; /* transid that last touched this inode */ __le64 transid; __le64 size; __le64 nbytes; __le64 block_group; __le32 nlink; __le32 uid; __le32 gid; __le32 mode; __le64 rdev; __le64 flags; /* modification sequence number for NFS */ __le64 sequence; /* * a little future expansion, for more than this we can * just grow the inode item and version it */ __le64 reserved[4]; struct btrfs_timespec atime; struct btrfs_timespec ctime; struct btrfs_timespec mtime; struct btrfs_timespec otime; } __attribute__ ((__packed__)); struct btrfs_dir_log_item { __le64 end; } __attribute__ ((__packed__)); struct btrfs_dir_item { struct btrfs_disk_key location; __le64 transid; __le16 data_len; __le16 name_len; __u8 type; } __attribute__ ((__packed__)); #define BTRFS_ROOT_SUBVOL_RDONLY (1ULL << 0) /* * Internal in-memory flag that a subvolume has been marked for deletion but * still visible as a directory */ #define BTRFS_ROOT_SUBVOL_DEAD (1ULL << 48) struct btrfs_root_item { struct btrfs_inode_item inode; __le64 generation; __le64 root_dirid; __le64 bytenr; __le64 byte_limit; __le64 bytes_used; __le64 last_snapshot; __le64 flags; __le32 refs; struct btrfs_disk_key drop_progress; __u8 drop_level; __u8 level; /* * The following fields appear after subvol_uuids+subvol_times * were introduced. */ /* * This generation number is used to test if the new fields are valid * and up to date while reading the root item. Every time the root item * is written out, the "generation" field is copied into this field. If * anyone ever mounted the fs with an older kernel, we will have * mismatching generation values here and thus must invalidate the * new fields. See btrfs_update_root and btrfs_find_last_root for * details. * the offset of generation_v2 is also used as the start for the memset * when invalidating the fields. */ __le64 generation_v2; __u8 uuid[BTRFS_UUID_SIZE]; __u8 parent_uuid[BTRFS_UUID_SIZE]; __u8 received_uuid[BTRFS_UUID_SIZE]; __le64 ctransid; /* updated when an inode changes */ __le64 otransid; /* trans when created */ __le64 stransid; /* trans when sent. non-zero for received subvol */ __le64 rtransid; /* trans when received. non-zero for received subvol */ struct btrfs_timespec ctime; struct btrfs_timespec otime; struct btrfs_timespec stime; struct btrfs_timespec rtime; __le64 reserved[8]; /* for future */ } __attribute__ ((__packed__)); /* * this is used for both forward and backward root refs */ struct btrfs_root_ref { __le64 dirid; __le64 sequence; __le16 name_len; } __attribute__ ((__packed__)); struct btrfs_disk_balance_args { /* * profiles to operate on, single is denoted by * BTRFS_AVAIL_ALLOC_BIT_SINGLE */ __le64 profiles; /* * usage filter * BTRFS_BALANCE_ARGS_USAGE with a single value means '0..N' * BTRFS_BALANCE_ARGS_USAGE_RANGE - range syntax, min..max */ union { __le64 usage; struct { __le32 usage_min; __le32 usage_max; }; }; /* devid filter */ __le64 devid; /* devid subset filter [pstart..pend) */ __le64 pstart; __le64 pend; /* btrfs virtual address space subset filter [vstart..vend) */ __le64 vstart; __le64 vend; /* * profile to convert to, single is denoted by * BTRFS_AVAIL_ALLOC_BIT_SINGLE */ __le64 target; /* BTRFS_BALANCE_ARGS_* */ __le64 flags; /* * BTRFS_BALANCE_ARGS_LIMIT with value 'limit' * BTRFS_BALANCE_ARGS_LIMIT_RANGE - the extend version can use minimum * and maximum */ union { __le64 limit; struct { __le32 limit_min; __le32 limit_max; }; }; /* * Process chunks that cross stripes_min..stripes_max devices, * BTRFS_BALANCE_ARGS_STRIPES_RANGE */ __le32 stripes_min; __le32 stripes_max; __le64 unused[6]; } __attribute__ ((__packed__)); /* * store balance parameters to disk so that balance can be properly * resumed after crash or unmount */ struct btrfs_balance_item { /* BTRFS_BALANCE_* */ __le64 flags; struct btrfs_disk_balance_args data; struct btrfs_disk_balance_args meta; struct btrfs_disk_balance_args sys; __le64 unused[4]; } __attribute__ ((__packed__)); #define BTRFS_FILE_EXTENT_INLINE 0 #define BTRFS_FILE_EXTENT_REG 1 #define BTRFS_FILE_EXTENT_PREALLOC 2 #define BTRFS_FILE_EXTENT_TYPES 2 struct btrfs_file_extent_item { /* * transaction id that created this extent */ __le64 generation; /* * max number of bytes to hold this extent in ram * when we split a compressed extent we can't know how big * each of the resulting pieces will be. So, this is * an upper limit on the size of the extent in ram instead of * an exact limit. */ __le64 ram_bytes; /* * 32 bits for the various ways we might encode the data, * including compression and encryption. If any of these * are set to something a given disk format doesn't understand * it is treated like an incompat flag for reading and writing, * but not for stat. */ __u8 compression; __u8 encryption; __le16 other_encoding; /* spare for later use */ /* are we __inline__ data or a real extent? */ __u8 type; /* * disk space consumed by the extent, checksum blocks are included * in these numbers * * At this offset in the structure, the __inline__ extent data start. */ __le64 disk_bytenr; __le64 disk_num_bytes; /* * the logical offset in file blocks (no csums) * this extent record is for. This allows a file extent to point * into the middle of an existing extent on disk, sharing it * between two snapshots (useful if some bytes in the middle of the * extent have changed */ __le64 offset; /* * the logical number of file blocks (no csums included). This * always reflects the size uncompressed and without encoding. */ __le64 num_bytes; } __attribute__ ((__packed__)); struct btrfs_csum_item { __u8 csum; } __attribute__ ((__packed__)); struct btrfs_dev_stats_item { /* * grow this item struct at the end for future enhancements and keep * the existing values unchanged */ __le64 values[BTRFS_DEV_STAT_VALUES_MAX]; } __attribute__ ((__packed__)); #define BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_ALWAYS 0 #define BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_AVOID 1 #define BTRFS_DEV_REPLACE_ITEM_STATE_NEVER_STARTED 0 #define BTRFS_DEV_REPLACE_ITEM_STATE_STARTED 1 #define BTRFS_DEV_REPLACE_ITEM_STATE_SUSPENDED 2 #define BTRFS_DEV_REPLACE_ITEM_STATE_FINISHED 3 #define BTRFS_DEV_REPLACE_ITEM_STATE_CANCELED 4 struct btrfs_dev_replace_item { /* * grow this item struct at the end for future enhancements and keep * the existing values unchanged */ __le64 src_devid; __le64 cursor_left; __le64 cursor_right; __le64 cont_reading_from_srcdev_mode; __le64 replace_state; __le64 time_started; __le64 time_stopped; __le64 num_write_errors; __le64 num_uncorrectable_read_errors; } __attribute__ ((__packed__)); /* different types of block groups (and chunks) */ #define BTRFS_BLOCK_GROUP_DATA (1ULL << 0) #define BTRFS_BLOCK_GROUP_SYSTEM (1ULL << 1) #define BTRFS_BLOCK_GROUP_METADATA (1ULL << 2) #define BTRFS_BLOCK_GROUP_RAID0 (1ULL << 3) #define BTRFS_BLOCK_GROUP_RAID1 (1ULL << 4) #define BTRFS_BLOCK_GROUP_DUP (1ULL << 5) #define BTRFS_BLOCK_GROUP_RAID10 (1ULL << 6) #define BTRFS_BLOCK_GROUP_RAID5 (1ULL << 7) #define BTRFS_BLOCK_GROUP_RAID6 (1ULL << 8) #define BTRFS_BLOCK_GROUP_RESERVED (BTRFS_AVAIL_ALLOC_BIT_SINGLE | \ BTRFS_SPACE_INFO_GLOBAL_RSV) enum btrfs_raid_types { BTRFS_RAID_RAID10, BTRFS_RAID_RAID1, BTRFS_RAID_DUP, BTRFS_RAID_RAID0, BTRFS_RAID_SINGLE, BTRFS_RAID_RAID5, BTRFS_RAID_RAID6, BTRFS_NR_RAID_TYPES }; #define BTRFS_BLOCK_GROUP_TYPE_MASK (BTRFS_BLOCK_GROUP_DATA | \ BTRFS_BLOCK_GROUP_SYSTEM | \ BTRFS_BLOCK_GROUP_METADATA) #define BTRFS_BLOCK_GROUP_PROFILE_MASK (BTRFS_BLOCK_GROUP_RAID0 | \ BTRFS_BLOCK_GROUP_RAID1 | \ BTRFS_BLOCK_GROUP_RAID5 | \ BTRFS_BLOCK_GROUP_RAID6 | \ BTRFS_BLOCK_GROUP_DUP | \ BTRFS_BLOCK_GROUP_RAID10) #define BTRFS_BLOCK_GROUP_RAID56_MASK (BTRFS_BLOCK_GROUP_RAID5 | \ BTRFS_BLOCK_GROUP_RAID6) /* * We need a bit for restriper to be able to tell when chunks of type * SINGLE are available. This "extended" profile format is used in * fs_info->avail_*_alloc_bits (in-memory) and balance item fields * (on-disk). The corresponding on-disk bit in chunk.type is reserved * to avoid remappings between two formats in future. */ #define BTRFS_AVAIL_ALLOC_BIT_SINGLE (1ULL << 48) /* * A fake block group type that is used to communicate global block reserve * size to userspace via the SPACE_INFO ioctl. */ #define BTRFS_SPACE_INFO_GLOBAL_RSV (1ULL << 49) #define BTRFS_EXTENDED_PROFILE_MASK (BTRFS_BLOCK_GROUP_PROFILE_MASK | \ BTRFS_AVAIL_ALLOC_BIT_SINGLE) static __inline__ __u64 chunk_to_extended(__u64 flags) { if ((flags & BTRFS_BLOCK_GROUP_PROFILE_MASK) == 0) flags |= BTRFS_AVAIL_ALLOC_BIT_SINGLE; return flags; } static __inline__ __u64 extended_to_chunk(__u64 flags) { return flags & ~BTRFS_AVAIL_ALLOC_BIT_SINGLE; } struct btrfs_block_group_item { __le64 used; __le64 chunk_objectid; __le64 flags; } __attribute__ ((__packed__)); struct btrfs_free_space_info { __le32 extent_count; __le32 flags; } __attribute__ ((__packed__)); #define BTRFS_FREE_SPACE_USING_BITMAPS (1ULL << 0) #define BTRFS_QGROUP_LEVEL_SHIFT 48 static __inline__ __u64 btrfs_qgroup_level(__u64 qgroupid) { return qgroupid >> BTRFS_QGROUP_LEVEL_SHIFT; } /* * is subvolume quota turned on? */ #define BTRFS_QGROUP_STATUS_FLAG_ON (1ULL << 0) /* * RESCAN is set during the initialization phase */ #define BTRFS_QGROUP_STATUS_FLAG_RESCAN (1ULL << 1) /* * Some qgroup entries are known to be out of date, * either because the configuration has changed in a way that * makes a rescan necessary, or because the fs has been mounted * with a non-qgroup-aware version. * Turning qouta off and on again makes it inconsistent, too. */ #define BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT (1ULL << 2) #define BTRFS_QGROUP_STATUS_VERSION 1 struct btrfs_qgroup_status_item { __le64 version; /* * the generation is updated during every commit. As older * versions of btrfs are not aware of qgroups, it will be * possible to detect inconsistencies by checking the * generation on mount time */ __le64 generation; /* flag definitions see above */ __le64 flags; /* * only used during scanning to record the progress * of the scan. It contains a logical address */ __le64 rescan; } __attribute__ ((__packed__)); struct btrfs_qgroup_info_item { __le64 generation; __le64 rfer; __le64 rfer_cmpr; __le64 excl; __le64 excl_cmpr; } __attribute__ ((__packed__)); struct btrfs_qgroup_limit_item { /* * only updated when any of the other values change */ __le64 flags; __le64 max_rfer; __le64 max_excl; __le64 rsv_rfer; __le64 rsv_excl; } __attribute__ ((__packed__)); #endif /* _BTRFS_CTREE_H_ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/ipmi_bmc.h������������������������������������������������������������������������������������0000644�����������������00000000720�14763166027�0007646 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (c) 2015-2018, Intel Corporation. */ #ifndef _LINUX_IPMI_BMC_H #define _LINUX_IPMI_BMC_H #include <linux/ioctl.h> #define __IPMI_BMC_IOCTL_MAGIC 0xB1 #define IPMI_BMC_IOCTL_SET_SMS_ATN _IO(__IPMI_BMC_IOCTL_MAGIC, 0x00) #define IPMI_BMC_IOCTL_CLEAR_SMS_ATN _IO(__IPMI_BMC_IOCTL_MAGIC, 0x01) #define IPMI_BMC_IOCTL_FORCE_ABORT _IO(__IPMI_BMC_IOCTL_MAGIC, 0x02) #endif /* _LINUX_IPMI_BMC_H */ ������������������������������������������������linux/icmp.h����������������������������������������������������������������������������������������0000644�����������������00000005637�14763166027�0007033 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Definitions for the ICMP protocol. * * Version: @(#)icmp.h 1.0.3 04/28/93 * * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * * 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. */ #ifndef _LINUX_ICMP_H #define _LINUX_ICMP_H #include <linux/types.h> #define ICMP_ECHOREPLY 0 /* Echo Reply */ #define ICMP_DEST_UNREACH 3 /* Destination Unreachable */ #define ICMP_SOURCE_QUENCH 4 /* Source Quench */ #define ICMP_REDIRECT 5 /* Redirect (change route) */ #define ICMP_ECHO 8 /* Echo Request */ #define ICMP_TIME_EXCEEDED 11 /* Time Exceeded */ #define ICMP_PARAMETERPROB 12 /* Parameter Problem */ #define ICMP_TIMESTAMP 13 /* Timestamp Request */ #define ICMP_TIMESTAMPREPLY 14 /* Timestamp Reply */ #define ICMP_INFO_REQUEST 15 /* Information Request */ #define ICMP_INFO_REPLY 16 /* Information Reply */ #define ICMP_ADDRESS 17 /* Address Mask Request */ #define ICMP_ADDRESSREPLY 18 /* Address Mask Reply */ #define NR_ICMP_TYPES 18 /* Codes for UNREACH. */ #define ICMP_NET_UNREACH 0 /* Network Unreachable */ #define ICMP_HOST_UNREACH 1 /* Host Unreachable */ #define ICMP_PROT_UNREACH 2 /* Protocol Unreachable */ #define ICMP_PORT_UNREACH 3 /* Port Unreachable */ #define ICMP_FRAG_NEEDED 4 /* Fragmentation Needed/DF set */ #define ICMP_SR_FAILED 5 /* Source Route failed */ #define ICMP_NET_UNKNOWN 6 #define ICMP_HOST_UNKNOWN 7 #define ICMP_HOST_ISOLATED 8 #define ICMP_NET_ANO 9 #define ICMP_HOST_ANO 10 #define ICMP_NET_UNR_TOS 11 #define ICMP_HOST_UNR_TOS 12 #define ICMP_PKT_FILTERED 13 /* Packet filtered */ #define ICMP_PREC_VIOLATION 14 /* Precedence violation */ #define ICMP_PREC_CUTOFF 15 /* Precedence cut off */ #define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */ /* Codes for REDIRECT. */ #define ICMP_REDIR_NET 0 /* Redirect Net */ #define ICMP_REDIR_HOST 1 /* Redirect Host */ #define ICMP_REDIR_NETTOS 2 /* Redirect Net for TOS */ #define ICMP_REDIR_HOSTTOS 3 /* Redirect Host for TOS */ /* Codes for TIME_EXCEEDED. */ #define ICMP_EXC_TTL 0 /* TTL count exceeded */ #define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */ struct icmphdr { __u8 type; __u8 code; __sum16 checksum; union { struct { __be16 id; __be16 sequence; } echo; __be32 gateway; struct { __be16 __unused; __be16 mtu; } frag; __u8 reserved[4]; } un; }; /* * constants for (set|get)sockopt */ #define ICMP_FILTER 1 struct icmp_filter { __u32 data; }; #endif /* _LINUX_ICMP_H */ �������������������������������������������������������������������������������������������������linux/bcache.h��������������������������������������������������������������������������������������0000644�����������������00000020351�14763166027�0007276 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_BCACHE_H #define _LINUX_BCACHE_H /* * Bcache on disk data structures */ #include <linux/types.h> #define BITMASK(name, type, field, offset, size) \ static __inline__ __u64 name(const type *k) \ { return (k->field >> offset) & ~(~0ULL << size); } \ \ static __inline__ void SET_##name(type *k, __u64 v) \ { \ k->field &= ~(~(~0ULL << size) << offset); \ k->field |= (v & ~(~0ULL << size)) << offset; \ } /* Btree keys - all units are in sectors */ struct bkey { __u64 high; __u64 low; __u64 ptr[]; }; #define KEY_FIELD(name, field, offset, size) \ BITMASK(name, struct bkey, field, offset, size) #define PTR_FIELD(name, offset, size) \ static __inline__ __u64 name(const struct bkey *k, unsigned int i) \ { return (k->ptr[i] >> offset) & ~(~0ULL << size); } \ \ static __inline__ void SET_##name(struct bkey *k, unsigned int i, __u64 v) \ { \ k->ptr[i] &= ~(~(~0ULL << size) << offset); \ k->ptr[i] |= (v & ~(~0ULL << size)) << offset; \ } #define KEY_SIZE_BITS 16 #define KEY_MAX_U64S 8 KEY_FIELD(KEY_PTRS, high, 60, 3) KEY_FIELD(HEADER_SIZE, high, 58, 2) KEY_FIELD(KEY_CSUM, high, 56, 2) KEY_FIELD(KEY_PINNED, high, 55, 1) KEY_FIELD(KEY_DIRTY, high, 36, 1) KEY_FIELD(KEY_SIZE, high, 20, KEY_SIZE_BITS) KEY_FIELD(KEY_INODE, high, 0, 20) /* Next time I change the on disk format, KEY_OFFSET() won't be 64 bits */ static __inline__ __u64 KEY_OFFSET(const struct bkey *k) { return k->low; } static __inline__ void SET_KEY_OFFSET(struct bkey *k, __u64 v) { k->low = v; } /* * The high bit being set is a relic from when we used it to do binary * searches - it told you where a key started. It's not used anymore, * and can probably be safely dropped. */ #define KEY(inode, offset, size) \ ((struct bkey) { \ .high = (1ULL << 63) | ((__u64) (size) << 20) | (inode), \ .low = (offset) \ }) #define ZERO_KEY KEY(0, 0, 0) #define MAX_KEY_INODE (~(~0 << 20)) #define MAX_KEY_OFFSET (~0ULL >> 1) #define MAX_KEY KEY(MAX_KEY_INODE, MAX_KEY_OFFSET, 0) #define KEY_START(k) (KEY_OFFSET(k) - KEY_SIZE(k)) #define START_KEY(k) KEY(KEY_INODE(k), KEY_START(k), 0) #define PTR_DEV_BITS 12 PTR_FIELD(PTR_DEV, 51, PTR_DEV_BITS) PTR_FIELD(PTR_OFFSET, 8, 43) PTR_FIELD(PTR_GEN, 0, 8) #define PTR_CHECK_DEV ((1 << PTR_DEV_BITS) - 1) #define MAKE_PTR(gen, offset, dev) \ ((((__u64) dev) << 51) | ((__u64) offset) << 8 | gen) /* Bkey utility code */ static __inline__ unsigned long bkey_u64s(const struct bkey *k) { return (sizeof(struct bkey) / sizeof(__u64)) + KEY_PTRS(k); } static __inline__ unsigned long bkey_bytes(const struct bkey *k) { return bkey_u64s(k) * sizeof(__u64); } #define bkey_copy(_dest, _src) memcpy(_dest, _src, bkey_bytes(_src)) static __inline__ void bkey_copy_key(struct bkey *dest, const struct bkey *src) { SET_KEY_INODE(dest, KEY_INODE(src)); SET_KEY_OFFSET(dest, KEY_OFFSET(src)); } static __inline__ struct bkey *bkey_next(const struct bkey *k) { __u64 *d = (void *) k; return (struct bkey *) (d + bkey_u64s(k)); } static __inline__ struct bkey *bkey_idx(const struct bkey *k, unsigned int nr_keys) { __u64 *d = (void *) k; return (struct bkey *) (d + nr_keys); } /* Enough for a key with 6 pointers */ #define BKEY_PAD 8 #define BKEY_PADDED(key) \ union { struct bkey key; __u64 key ## _pad[BKEY_PAD]; } /* Superblock */ /* Version 0: Cache device * Version 1: Backing device * Version 2: Seed pointer into btree node checksum * Version 3: Cache device with new UUID format * Version 4: Backing device with data offset */ #define BCACHE_SB_VERSION_CDEV 0 #define BCACHE_SB_VERSION_BDEV 1 #define BCACHE_SB_VERSION_CDEV_WITH_UUID 3 #define BCACHE_SB_VERSION_BDEV_WITH_OFFSET 4 #define BCACHE_SB_MAX_VERSION 4 #define SB_SECTOR 8 #define SB_SIZE 4096 #define SB_LABEL_SIZE 32 #define SB_JOURNAL_BUCKETS 256U /* SB_JOURNAL_BUCKETS must be divisible by BITS_PER_LONG */ #define MAX_CACHES_PER_SET 8 #define BDEV_DATA_START_DEFAULT 16 /* sectors */ struct cache_sb { __u64 csum; __u64 offset; /* sector where this sb was written */ __u64 version; __u8 magic[16]; __u8 uuid[16]; union { __u8 set_uuid[16]; __u64 set_magic; }; __u8 label[SB_LABEL_SIZE]; __u64 flags; __u64 seq; __u64 pad[8]; union { struct { /* Cache devices */ __u64 nbuckets; /* device size */ __u16 block_size; /* sectors */ __u16 bucket_size; /* sectors */ __u16 nr_in_set; __u16 nr_this_dev; }; struct { /* Backing devices */ __u64 data_offset; /* * block_size from the cache device section is still used by * backing devices, so don't add anything here until we fix * things to not need it for backing devices anymore */ }; }; __u32 last_mount; /* time overflow in y2106 */ __u16 first_bucket; union { __u16 njournal_buckets; __u16 keys; }; __u64 d[SB_JOURNAL_BUCKETS]; /* journal buckets */ }; static __inline__ _Bool SB_IS_BDEV(const struct cache_sb *sb) { return sb->version == BCACHE_SB_VERSION_BDEV || sb->version == BCACHE_SB_VERSION_BDEV_WITH_OFFSET; } BITMASK(CACHE_SYNC, struct cache_sb, flags, 0, 1); BITMASK(CACHE_DISCARD, struct cache_sb, flags, 1, 1); BITMASK(CACHE_REPLACEMENT, struct cache_sb, flags, 2, 3); #define CACHE_REPLACEMENT_LRU 0U #define CACHE_REPLACEMENT_FIFO 1U #define CACHE_REPLACEMENT_RANDOM 2U BITMASK(BDEV_CACHE_MODE, struct cache_sb, flags, 0, 4); #define CACHE_MODE_WRITETHROUGH 0U #define CACHE_MODE_WRITEBACK 1U #define CACHE_MODE_WRITEAROUND 2U #define CACHE_MODE_NONE 3U BITMASK(BDEV_STATE, struct cache_sb, flags, 61, 2); #define BDEV_STATE_NONE 0U #define BDEV_STATE_CLEAN 1U #define BDEV_STATE_DIRTY 2U #define BDEV_STATE_STALE 3U /* * Magic numbers * * The various other data structures have their own magic numbers, which are * xored with the first part of the cache set's UUID */ #define JSET_MAGIC 0x245235c1a3625032ULL #define PSET_MAGIC 0x6750e15f87337f91ULL #define BSET_MAGIC 0x90135c78b99e07f5ULL static __inline__ __u64 jset_magic(struct cache_sb *sb) { return sb->set_magic ^ JSET_MAGIC; } static __inline__ __u64 pset_magic(struct cache_sb *sb) { return sb->set_magic ^ PSET_MAGIC; } static __inline__ __u64 bset_magic(struct cache_sb *sb) { return sb->set_magic ^ BSET_MAGIC; } /* * Journal * * On disk format for a journal entry: * seq is monotonically increasing; every journal entry has its own unique * sequence number. * * last_seq is the oldest journal entry that still has keys the btree hasn't * flushed to disk yet. * * version is for on disk format changes. */ #define BCACHE_JSET_VERSION_UUIDv1 1 #define BCACHE_JSET_VERSION_UUID 1 /* Always latest UUID format */ #define BCACHE_JSET_VERSION 1 struct jset { __u64 csum; __u64 magic; __u64 seq; __u32 version; __u32 keys; __u64 last_seq; BKEY_PADDED(uuid_bucket); BKEY_PADDED(btree_root); __u16 btree_level; __u16 pad[3]; __u64 prio_bucket[MAX_CACHES_PER_SET]; union { struct bkey start[0]; __u64 d[0]; }; }; /* Bucket prios/gens */ struct prio_set { __u64 csum; __u64 magic; __u64 seq; __u32 version; __u32 pad; __u64 next_bucket; struct bucket_disk { __u16 prio; __u8 gen; } __attribute((packed)) data[]; }; /* UUIDS - per backing device/flash only volume metadata */ struct uuid_entry { union { struct { __u8 uuid[16]; __u8 label[32]; __u32 first_reg; /* time overflow in y2106 */ __u32 last_reg; __u32 invalidated; __u32 flags; /* Size of flash only volumes */ __u64 sectors; }; __u8 pad[128]; }; }; BITMASK(UUID_FLASH_ONLY, struct uuid_entry, flags, 0, 1); /* Btree nodes */ /* Version 1: Seed pointer into btree node checksum */ #define BCACHE_BSET_CSUM 1 #define BCACHE_BSET_VERSION 1 /* * Btree nodes * * On disk a btree node is a list/log of these; within each set the keys are * sorted */ struct bset { __u64 csum; __u64 magic; __u64 seq; __u32 version; __u32 keys; union { struct bkey start[0]; __u64 d[0]; }; }; /* OBSOLETE */ /* UUIDS - per backing device/flash only volume metadata */ struct uuid_entry_v0 { __u8 uuid[16]; __u8 label[32]; __u32 first_reg; __u32 last_reg; __u32 invalidated; __u32 pad; }; #endif /* _LINUX_BCACHE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_ltalk.h������������������������������������������������������������������������������������0000644�����������������00000000322�14763166027�0007652 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_LTALK_H #define __LINUX_LTALK_H #define LTALK_HLEN 1 #define LTALK_MTU 600 #define LTALK_ALEN 1 #endif /* __LINUX_LTALK_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/mroute6.h�������������������������������������������������������������������������������������0000644�����������������00000010740�14763166027�0007473 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_MROUTE6_H #define __LINUX_MROUTE6_H #include <linux/const.h> #include <linux/types.h> #include <linux/sockios.h> #include <linux/in6.h> /* For struct sockaddr_in6. */ /* * Based on the MROUTING 3.5 defines primarily to keep * source compatibility with BSD. * * See the pim6sd code for the original history. * * Protocol Independent Multicast (PIM) data structures included * Carlos Picoto (cap@di.fc.ul.pt) * */ #define MRT6_BASE 200 #define MRT6_INIT (MRT6_BASE) /* Activate the kernel mroute code */ #define MRT6_DONE (MRT6_BASE+1) /* Shutdown the kernel mroute */ #define MRT6_ADD_MIF (MRT6_BASE+2) /* Add a virtual interface */ #define MRT6_DEL_MIF (MRT6_BASE+3) /* Delete a virtual interface */ #define MRT6_ADD_MFC (MRT6_BASE+4) /* Add a multicast forwarding entry */ #define MRT6_DEL_MFC (MRT6_BASE+5) /* Delete a multicast forwarding entry */ #define MRT6_VERSION (MRT6_BASE+6) /* Get the kernel multicast version */ #define MRT6_ASSERT (MRT6_BASE+7) /* Activate PIM assert mode */ #define MRT6_PIM (MRT6_BASE+8) /* enable PIM code */ #define MRT6_TABLE (MRT6_BASE+9) /* Specify mroute table ID */ #define MRT6_ADD_MFC_PROXY (MRT6_BASE+10) /* Add a (*,*|G) mfc entry */ #define MRT6_DEL_MFC_PROXY (MRT6_BASE+11) /* Del a (*,*|G) mfc entry */ #define MRT6_MAX (MRT6_BASE+11) #define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */ #define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1) #define SIOCGETRPF (SIOCPROTOPRIVATE+2) #define MAXMIFS 32 typedef unsigned long mifbitmap_t; /* User mode code depends on this lot */ typedef unsigned short mifi_t; #define ALL_MIFS ((mifi_t)(-1)) #ifndef IF_SETSIZE #define IF_SETSIZE 256 #endif typedef __u32 if_mask; #define NIFBITS (sizeof(if_mask) * 8) /* bits per mask */ typedef struct if_set { if_mask ifs_bits[__KERNEL_DIV_ROUND_UP(IF_SETSIZE, NIFBITS)]; } if_set; #define IF_SET(n, p) ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS))) #define IF_CLR(n, p) ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS))) #define IF_ISSET(n, p) ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS))) #define IF_COPY(f, t) bcopy(f, t, sizeof(*(f))) #define IF_ZERO(p) bzero(p, sizeof(*(p))) /* * Passed by mrouted for an MRT_ADD_MIF - again we use the * mrouted 3.6 structures for compatibility */ struct mif6ctl { mifi_t mif6c_mifi; /* Index of MIF */ unsigned char mif6c_flags; /* MIFF_ flags */ unsigned char vifc_threshold; /* ttl limit */ __u16 mif6c_pifi; /* the index of the physical IF */ unsigned int vifc_rate_limit; /* Rate limiter values (NI) */ }; #define MIFF_REGISTER 0x1 /* register vif */ /* * Cache manipulation structures for mrouted and PIMd */ struct mf6cctl { struct sockaddr_in6 mf6cc_origin; /* Origin of mcast */ struct sockaddr_in6 mf6cc_mcastgrp; /* Group in question */ mifi_t mf6cc_parent; /* Where it arrived */ struct if_set mf6cc_ifset; /* Where it is going */ }; /* * Group count retrieval for pim6sd */ struct sioc_sg_req6 { struct sockaddr_in6 src; struct sockaddr_in6 grp; unsigned long pktcnt; unsigned long bytecnt; unsigned long wrong_if; }; /* * To get vif packet counts */ struct sioc_mif_req6 { mifi_t mifi; /* Which iface */ unsigned long icount; /* In packets */ unsigned long ocount; /* Out packets */ unsigned long ibytes; /* In bytes */ unsigned long obytes; /* Out bytes */ }; /* * That's all usermode folks */ /* * Structure used to communicate from kernel to multicast router. * We'll overlay the structure onto an MLD header (not an IPv6 heder like igmpmsg{} * used for IPv4 implementation). This is because this structure will be passed via an * IPv6 raw socket, on which an application will only receiver the payload i.e the data after * the IPv6 header and all the extension headers. (See section 3 of RFC 3542) */ struct mrt6msg { #define MRT6MSG_NOCACHE 1 #define MRT6MSG_WRONGMIF 2 #define MRT6MSG_WHOLEPKT 3 /* used for use level encap */ __u8 im6_mbz; /* must be zero */ __u8 im6_msgtype; /* what type of message */ __u16 im6_mif; /* mif rec'd on */ __u32 im6_pad; /* padding for 64 bit arch */ struct in6_addr im6_src, im6_dst; }; /* ip6mr netlink cache report attributes */ enum { IP6MRA_CREPORT_UNSPEC, IP6MRA_CREPORT_MSGTYPE, IP6MRA_CREPORT_MIF_ID, IP6MRA_CREPORT_SRC_ADDR, IP6MRA_CREPORT_DST_ADDR, IP6MRA_CREPORT_PKT, __IP6MRA_CREPORT_MAX }; #define IP6MRA_CREPORT_MAX (__IP6MRA_CREPORT_MAX - 1) #endif /* __LINUX_MROUTE6_H */ ��������������������������������linux/raw.h�����������������������������������������������������������������������������������������0000644�����������������00000000555�14763166027�0006666 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_RAW_H #define __LINUX_RAW_H #include <linux/types.h> #define RAW_SETBIND _IO( 0xac, 0 ) #define RAW_GETBIND _IO( 0xac, 1 ) struct raw_config_request { int raw_minor; __u64 block_major; __u64 block_minor; }; #define MAX_RAW_MINORS CONFIG_MAX_RAW_DEVS #endif /* __LINUX_RAW_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_ipv6/ip6t_ipv6header.h��������������������������������������������������������������0000644�����������������00000001205�14763166027�0014025 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* ipv6header match - matches IPv6 packets based on whether they contain certain headers */ /* Original idea: Brad Chapman * Rewritten by: Andras Kis-Szabo <kisza@sch.bme.hu> */ #ifndef __IPV6HEADER_H #define __IPV6HEADER_H #include <linux/types.h> struct ip6t_ipv6header_info { __u8 matchflags; __u8 invflags; __u8 modeflag; }; #define MASK_HOPOPTS 128 #define MASK_DSTOPTS 64 #define MASK_ROUTING 32 #define MASK_FRAGMENT 16 #define MASK_AH 8 #define MASK_ESP 4 #define MASK_NONE 2 #define MASK_PROTO 1 #endif /* __IPV6HEADER_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_ipv6/ip6t_LOG.h���������������������������������������������������������������������0000644�����������������00000001332�14763166027�0012412 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IP6T_LOG_H #define _IP6T_LOG_H #warning "Please update iptables, this file will be removed soon!" /* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ #define IP6T_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ #define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */ #define IP6T_LOG_IPOPT 0x04 /* Log IP options */ #define IP6T_LOG_UID 0x08 /* Log UID owning local socket */ #define IP6T_LOG_NFLOG 0x10 /* Unsupported, don't use */ #define IP6T_LOG_MACDECODE 0x20 /* Decode MAC header */ #define IP6T_LOG_MASK 0x2f struct ip6t_log_info { unsigned char level; unsigned char logflags; char prefix[30]; }; #endif /*_IPT_LOG_H*/ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_ipv6/ip6t_frag.h��������������������������������������������������������������������0000644�����������������00000001350�14763166027�0012710 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IP6T_FRAG_H #define _IP6T_FRAG_H #include <linux/types.h> struct ip6t_frag { __u32 ids[2]; /* Identification range */ __u32 hdrlen; /* Header Length */ __u8 flags; /* Flags */ __u8 invflags; /* Inverse flags */ }; #define IP6T_FRAG_IDS 0x01 #define IP6T_FRAG_LEN 0x02 #define IP6T_FRAG_RES 0x04 #define IP6T_FRAG_FST 0x08 #define IP6T_FRAG_MF 0x10 #define IP6T_FRAG_NMF 0x20 /* Values for "invflags" field in struct ip6t_frag. */ #define IP6T_FRAG_INV_IDS 0x01 /* Invert the sense of ids. */ #define IP6T_FRAG_INV_LEN 0x02 /* Invert the sense of length. */ #define IP6T_FRAG_INV_MASK 0x03 /* All possible flags. */ #endif /*_IP6T_FRAG_H*/ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_ipv6/ip6_tables.h�������������������������������������������������������������������0000644�����������������00000017513�14763166027�0013067 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * 25-Jul-1998 Major changes to allow for ip chain table * * 3-Jan-2000 Named tables to allow packet selection for different uses. */ /* * Format of an IP6 firewall descriptor * * src, dst, src_mask, dst_mask are always stored in network byte order. * flags are stored in host byte order (of course). * Port numbers are stored in HOST byte order. */ #ifndef _IP6_TABLES_H #define _IP6_TABLES_H #include <linux/types.h> #include <linux/if.h> #include <linux/netfilter_ipv6.h> #include <linux/netfilter/x_tables.h> #define IP6T_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN #define IP6T_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN #define ip6t_match xt_match #define ip6t_target xt_target #define ip6t_table xt_table #define ip6t_get_revision xt_get_revision #define ip6t_entry_match xt_entry_match #define ip6t_entry_target xt_entry_target #define ip6t_standard_target xt_standard_target #define ip6t_error_target xt_error_target #define ip6t_counters xt_counters #define IP6T_CONTINUE XT_CONTINUE #define IP6T_RETURN XT_RETURN /* Pre-iptables-1.4.0 */ #include <linux/netfilter/xt_tcpudp.h> #define ip6t_tcp xt_tcp #define ip6t_udp xt_udp #define IP6T_TCP_INV_SRCPT XT_TCP_INV_SRCPT #define IP6T_TCP_INV_DSTPT XT_TCP_INV_DSTPT #define IP6T_TCP_INV_FLAGS XT_TCP_INV_FLAGS #define IP6T_TCP_INV_OPTION XT_TCP_INV_OPTION #define IP6T_TCP_INV_MASK XT_TCP_INV_MASK #define IP6T_UDP_INV_SRCPT XT_UDP_INV_SRCPT #define IP6T_UDP_INV_DSTPT XT_UDP_INV_DSTPT #define IP6T_UDP_INV_MASK XT_UDP_INV_MASK #define ip6t_counters_info xt_counters_info #define IP6T_STANDARD_TARGET XT_STANDARD_TARGET #define IP6T_ERROR_TARGET XT_ERROR_TARGET #define IP6T_MATCH_ITERATE(e, fn, args...) \ XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args) #define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \ XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args) /* Yes, Virginia, you have to zero the padding. */ struct ip6t_ip6 { /* Source and destination IP6 addr */ struct in6_addr src, dst; /* Mask for src and dest IP6 addr */ struct in6_addr smsk, dmsk; char iniface[IFNAMSIZ], outiface[IFNAMSIZ]; unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ]; /* Upper protocol number * - The allowed value is 0 (any) or protocol number of last parsable * header, which is 50 (ESP), 59 (No Next Header), 135 (MH), or * the non IPv6 extension headers. * - The protocol numbers of IPv6 extension headers except of ESP and * MH do not match any packets. * - You also need to set IP6T_FLAGS_PROTO to "flags" to check protocol. */ __u16 proto; /* TOS to match iff flags & IP6T_F_TOS */ __u8 tos; /* Flags word */ __u8 flags; /* Inverse flags */ __u8 invflags; }; /* Values for "flag" field in struct ip6t_ip6 (general ip6 structure). */ #define IP6T_F_PROTO 0x01 /* Set if rule cares about upper protocols */ #define IP6T_F_TOS 0x02 /* Match the TOS. */ #define IP6T_F_GOTO 0x04 /* Set if jump is a goto */ #define IP6T_F_MASK 0x07 /* All possible flag bits mask. */ /* Values for "inv" field in struct ip6t_ip6. */ #define IP6T_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ #define IP6T_INV_VIA_OUT 0x02 /* Invert the sense of OUT IFACE */ #define IP6T_INV_TOS 0x04 /* Invert the sense of TOS. */ #define IP6T_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */ #define IP6T_INV_DSTIP 0x10 /* Invert the sense of DST OP. */ #define IP6T_INV_FRAG 0x20 /* Invert the sense of FRAG. */ #define IP6T_INV_PROTO XT_INV_PROTO #define IP6T_INV_MASK 0x7F /* All possible flag bits mask. */ /* This structure defines each of the firewall rules. Consists of 3 parts which are 1) general IP header stuff 2) match specific stuff 3) the target to perform if the rule matches */ struct ip6t_entry { struct ip6t_ip6 ipv6; /* Mark with fields that we care about. */ unsigned int nfcache; /* Size of ipt_entry + matches */ __u16 target_offset; /* Size of ipt_entry + matches + target */ __u16 next_offset; /* Back pointer */ unsigned int comefrom; /* Packet and byte counters. */ struct xt_counters counters; /* The matches (if any), then the target. */ unsigned char elems[0]; }; /* Standard entry */ struct ip6t_standard { struct ip6t_entry entry; struct xt_standard_target target; }; struct ip6t_error { struct ip6t_entry entry; struct xt_error_target target; }; #define IP6T_ENTRY_INIT(__size) \ { \ .target_offset = sizeof(struct ip6t_entry), \ .next_offset = (__size), \ } #define IP6T_STANDARD_INIT(__verdict) \ { \ .entry = IP6T_ENTRY_INIT(sizeof(struct ip6t_standard)), \ .target = XT_TARGET_INIT(XT_STANDARD_TARGET, \ sizeof(struct xt_standard_target)), \ .target.verdict = -(__verdict) - 1, \ } #define IP6T_ERROR_INIT \ { \ .entry = IP6T_ENTRY_INIT(sizeof(struct ip6t_error)), \ .target = XT_TARGET_INIT(XT_ERROR_TARGET, \ sizeof(struct xt_error_target)), \ .target.errorname = "ERROR", \ } /* * New IP firewall options for [gs]etsockopt at the RAW IP level. * Unlike BSD Linux inherits IP options so you don't have to use * a raw socket for this. Instead we check rights in the calls. * * ATTENTION: check linux/in6.h before adding new number here. */ #define IP6T_BASE_CTL 64 #define IP6T_SO_SET_REPLACE (IP6T_BASE_CTL) #define IP6T_SO_SET_ADD_COUNTERS (IP6T_BASE_CTL + 1) #define IP6T_SO_SET_MAX IP6T_SO_SET_ADD_COUNTERS #define IP6T_SO_GET_INFO (IP6T_BASE_CTL) #define IP6T_SO_GET_ENTRIES (IP6T_BASE_CTL + 1) #define IP6T_SO_GET_REVISION_MATCH (IP6T_BASE_CTL + 4) #define IP6T_SO_GET_REVISION_TARGET (IP6T_BASE_CTL + 5) #define IP6T_SO_GET_MAX IP6T_SO_GET_REVISION_TARGET /* obtain original address if REDIRECT'd connection */ #define IP6T_SO_ORIGINAL_DST 80 /* ICMP matching stuff */ struct ip6t_icmp { __u8 type; /* type to match */ __u8 code[2]; /* range of code */ __u8 invflags; /* Inverse flags */ }; /* Values for "inv" field for struct ipt_icmp. */ #define IP6T_ICMP_INV 0x01 /* Invert the sense of type/code test */ /* The argument to IP6T_SO_GET_INFO */ struct ip6t_getinfo { /* Which table: caller fills this in. */ char name[XT_TABLE_MAXNAMELEN]; /* Kernel fills these in. */ /* Which hook entry points are valid: bitmask */ unsigned int valid_hooks; /* Hook entry points: one per netfilter hook. */ unsigned int hook_entry[NF_INET_NUMHOOKS]; /* Underflow points. */ unsigned int underflow[NF_INET_NUMHOOKS]; /* Number of entries */ unsigned int num_entries; /* Size of entries. */ unsigned int size; }; /* The argument to IP6T_SO_SET_REPLACE. */ struct ip6t_replace { /* Which table. */ char name[XT_TABLE_MAXNAMELEN]; /* Which hook entry points are valid: bitmask. You can't change this. */ unsigned int valid_hooks; /* Number of entries */ unsigned int num_entries; /* Total size of new entries */ unsigned int size; /* Hook entry points. */ unsigned int hook_entry[NF_INET_NUMHOOKS]; /* Underflow points. */ unsigned int underflow[NF_INET_NUMHOOKS]; /* Information about old entries: */ /* Number of counters (must be equal to current number of entries). */ unsigned int num_counters; /* The old entries' counters. */ struct xt_counters *counters; /* The entries (hang off end: not really an array). */ struct ip6t_entry entries[0]; }; /* The argument to IP6T_SO_GET_ENTRIES. */ struct ip6t_get_entries { /* Which table: user fills this in. */ char name[XT_TABLE_MAXNAMELEN]; /* User fills this in: total entry size. */ unsigned int size; /* The entries. */ struct ip6t_entry entrytable[0]; }; /* Helper functions */ static __inline__ struct xt_entry_target * ip6t_get_target(struct ip6t_entry *e) { return (void *)e + e->target_offset; } /* * Main firewall chains definitions and global var's definitions. */ #endif /* _IP6_TABLES_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_ipv6/ip6t_srh.h���������������������������������������������������������������������0000644�����������������00000006351�14763166027�0012573 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IP6T_SRH_H #define _IP6T_SRH_H #include <linux/types.h> #include <linux/netfilter.h> /* Values for "mt_flags" field in struct ip6t_srh */ #define IP6T_SRH_NEXTHDR 0x0001 #define IP6T_SRH_LEN_EQ 0x0002 #define IP6T_SRH_LEN_GT 0x0004 #define IP6T_SRH_LEN_LT 0x0008 #define IP6T_SRH_SEGS_EQ 0x0010 #define IP6T_SRH_SEGS_GT 0x0020 #define IP6T_SRH_SEGS_LT 0x0040 #define IP6T_SRH_LAST_EQ 0x0080 #define IP6T_SRH_LAST_GT 0x0100 #define IP6T_SRH_LAST_LT 0x0200 #define IP6T_SRH_TAG 0x0400 #define IP6T_SRH_PSID 0x0800 #define IP6T_SRH_NSID 0x1000 #define IP6T_SRH_LSID 0x2000 #define IP6T_SRH_MASK 0x3FFF /* Values for "mt_invflags" field in struct ip6t_srh */ #define IP6T_SRH_INV_NEXTHDR 0x0001 #define IP6T_SRH_INV_LEN_EQ 0x0002 #define IP6T_SRH_INV_LEN_GT 0x0004 #define IP6T_SRH_INV_LEN_LT 0x0008 #define IP6T_SRH_INV_SEGS_EQ 0x0010 #define IP6T_SRH_INV_SEGS_GT 0x0020 #define IP6T_SRH_INV_SEGS_LT 0x0040 #define IP6T_SRH_INV_LAST_EQ 0x0080 #define IP6T_SRH_INV_LAST_GT 0x0100 #define IP6T_SRH_INV_LAST_LT 0x0200 #define IP6T_SRH_INV_TAG 0x0400 #define IP6T_SRH_INV_PSID 0x0800 #define IP6T_SRH_INV_NSID 0x1000 #define IP6T_SRH_INV_LSID 0x2000 #define IP6T_SRH_INV_MASK 0x3FFF /** * struct ip6t_srh - SRH match options * @ next_hdr: Next header field of SRH * @ hdr_len: Extension header length field of SRH * @ segs_left: Segments left field of SRH * @ last_entry: Last entry field of SRH * @ tag: Tag field of SRH * @ mt_flags: match options * @ mt_invflags: Invert the sense of match options */ struct ip6t_srh { __u8 next_hdr; __u8 hdr_len; __u8 segs_left; __u8 last_entry; __u16 tag; __u16 mt_flags; __u16 mt_invflags; }; /** * struct ip6t_srh1 - SRH match options (revision 1) * @ next_hdr: Next header field of SRH * @ hdr_len: Extension header length field of SRH * @ segs_left: Segments left field of SRH * @ last_entry: Last entry field of SRH * @ tag: Tag field of SRH * @ psid_addr: Address of previous SID in SRH SID list * @ nsid_addr: Address of NEXT SID in SRH SID list * @ lsid_addr: Address of LAST SID in SRH SID list * @ psid_msk: Mask of previous SID in SRH SID list * @ nsid_msk: Mask of next SID in SRH SID list * @ lsid_msk: MAsk of last SID in SRH SID list * @ mt_flags: match options * @ mt_invflags: Invert the sense of match options */ struct ip6t_srh1 { __u8 next_hdr; __u8 hdr_len; __u8 segs_left; __u8 last_entry; __u16 tag; struct in6_addr psid_addr; struct in6_addr nsid_addr; struct in6_addr lsid_addr; struct in6_addr psid_msk; struct in6_addr nsid_msk; struct in6_addr lsid_msk; __u16 mt_flags; __u16 mt_invflags; }; #endif /*_IP6T_SRH_H*/ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_ipv6/ip6t_HL.h����������������������������������������������������������������������0000644�����������������00000000630�14763166027�0012274 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Hop Limit modification module for ip6tables * Maciej Soltysiak <solt@dns.toxicfilms.tv> * Based on HW's TTL module */ #ifndef _IP6T_HL_H #define _IP6T_HL_H #include <linux/types.h> enum { IP6T_HL_SET = 0, IP6T_HL_INC, IP6T_HL_DEC }; #define IP6T_HL_MAXMODE IP6T_HL_DEC struct ip6t_HL_info { __u8 mode; __u8 hop_limit; }; #endif ��������������������������������������������������������������������������������������������������������linux/netfilter_ipv6/ip6t_opts.h��������������������������������������������������������������������0000644�����������������00000001211�14763166027�0012752 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IP6T_OPTS_H #define _IP6T_OPTS_H #include <linux/types.h> #define IP6T_OPTS_OPTSNR 16 struct ip6t_opts { __u32 hdrlen; /* Header Length */ __u8 flags; /* */ __u8 invflags; /* Inverse flags */ __u16 opts[IP6T_OPTS_OPTSNR]; /* opts */ __u8 optsnr; /* Nr of OPts */ }; #define IP6T_OPTS_LEN 0x01 #define IP6T_OPTS_OPTS 0x02 #define IP6T_OPTS_NSTRICT 0x04 /* Values for "invflags" field in struct ip6t_rt. */ #define IP6T_OPTS_INV_LEN 0x01 /* Invert the sense of length. */ #define IP6T_OPTS_INV_MASK 0x01 /* All possible flags. */ #endif /*_IP6T_OPTS_H*/ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_ipv6/ip6t_NPT.h���������������������������������������������������������������������0000644�����������������00000000620�14763166027�0012431 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __NETFILTER_IP6T_NPT #define __NETFILTER_IP6T_NPT #include <linux/types.h> #include <linux/netfilter.h> struct ip6t_npt_tginfo { union nf_inet_addr src_pfx; union nf_inet_addr dst_pfx; __u8 src_pfx_len; __u8 dst_pfx_len; /* Used internally by the kernel */ __sum16 adjustment; }; #endif /* __NETFILTER_IP6T_NPT */ ����������������������������������������������������������������������������������������������������������������linux/netfilter_ipv6/ip6t_rt.h����������������������������������������������������������������������0000644�����������������00000001731�14763166027�0012421 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IP6T_RT_H #define _IP6T_RT_H #include <linux/types.h> #include <linux/in6.h> #define IP6T_RT_HOPS 16 struct ip6t_rt { __u32 rt_type; /* Routing Type */ __u32 segsleft[2]; /* Segments Left */ __u32 hdrlen; /* Header Length */ __u8 flags; /* */ __u8 invflags; /* Inverse flags */ struct in6_addr addrs[IP6T_RT_HOPS]; /* Hops */ __u8 addrnr; /* Nr of Addresses */ }; #define IP6T_RT_TYP 0x01 #define IP6T_RT_SGS 0x02 #define IP6T_RT_LEN 0x04 #define IP6T_RT_RES 0x08 #define IP6T_RT_FST_MASK 0x30 #define IP6T_RT_FST 0x10 #define IP6T_RT_FST_NSTRICT 0x20 /* Values for "invflags" field in struct ip6t_rt. */ #define IP6T_RT_INV_TYP 0x01 /* Invert the sense of type. */ #define IP6T_RT_INV_SGS 0x02 /* Invert the sense of Segments. */ #define IP6T_RT_INV_LEN 0x04 /* Invert the sense of length. */ #define IP6T_RT_INV_MASK 0x07 /* All possible flags. */ #endif /*_IP6T_RT_H*/ ���������������������������������������linux/netfilter_ipv6/ip6t_mh.h����������������������������������������������������������������������0000644�����������������00000000667�14763166027�0012407 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IP6T_MH_H #define _IP6T_MH_H #include <linux/types.h> /* MH matching stuff */ struct ip6t_mh { __u8 types[2]; /* MH type range */ __u8 invflags; /* Inverse flags */ }; /* Values for "invflags" field in struct ip6t_mh. */ #define IP6T_MH_INV_TYPE 0x01 /* Invert the sense of type. */ #define IP6T_MH_INV_MASK 0x01 /* All possible flags. */ #endif /*_IP6T_MH_H*/ �������������������������������������������������������������������������linux/netfilter_ipv6/ip6t_hl.h����������������������������������������������������������������������0000644�����������������00000000712�14763166027�0012375 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* ip6tables module for matching the Hop Limit value * Maciej Soltysiak <solt@dns.toxicfilms.tv> * Based on HW's ttl module */ #ifndef _IP6T_HL_H #define _IP6T_HL_H #include <linux/types.h> enum { IP6T_HL_EQ = 0, /* equals */ IP6T_HL_NE, /* not equals */ IP6T_HL_LT, /* less than */ IP6T_HL_GT, /* greater than */ }; struct ip6t_hl_info { __u8 mode; __u8 hop_limit; }; #endif ������������������������������������������������������linux/netfilter_ipv6/ip6t_ah.h����������������������������������������������������������������������0000644�����������������00000001221�14763166027�0012356 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IP6T_AH_H #define _IP6T_AH_H #include <linux/types.h> struct ip6t_ah { __u32 spis[2]; /* Security Parameter Index */ __u32 hdrlen; /* Header Length */ __u8 hdrres; /* Test of the Reserved Filed */ __u8 invflags; /* Inverse flags */ }; #define IP6T_AH_SPI 0x01 #define IP6T_AH_LEN 0x02 #define IP6T_AH_RES 0x04 /* Values for "invflags" field in struct ip6t_ah. */ #define IP6T_AH_INV_SPI 0x01 /* Invert the sense of spi. */ #define IP6T_AH_INV_LEN 0x02 /* Invert the sense of length. */ #define IP6T_AH_INV_MASK 0x03 /* All possible flags. */ #endif /*_IP6T_AH_H*/ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter_ipv6/ip6t_REJECT.h������������������������������������������������������������������0000644�����������������00000000726�14763166027�0012753 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IP6T_REJECT_H #define _IP6T_REJECT_H #include <linux/types.h> enum ip6t_reject_with { IP6T_ICMP6_NO_ROUTE, IP6T_ICMP6_ADM_PROHIBITED, IP6T_ICMP6_NOT_NEIGHBOUR, IP6T_ICMP6_ADDR_UNREACH, IP6T_ICMP6_PORT_UNREACH, IP6T_ICMP6_ECHOREPLY, IP6T_TCP_RESET, IP6T_ICMP6_POLICY_FAIL, IP6T_ICMP6_REJECT_ROUTE }; struct ip6t_reject_info { __u32 with; /* reject type */ }; #endif /*_IP6T_REJECT_H*/ ������������������������������������������linux/virtio_rng.h����������������������������������������������������������������������������������0000644�����������������00000000411�14763166027�0010246 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _LINUX_VIRTIO_RNG_H #define _LINUX_VIRTIO_RNG_H /* This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. */ #include <linux/virtio_ids.h> #include <linux/virtio_config.h> #endif /* _LINUX_VIRTIO_RNG_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/batadv_packet.h�������������������������������������������������������������������������������0000644�����������������00000050017�14763166027�0010663 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) */ /* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors: * * Marek Lindner, Simon Wunderlich * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * 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, see <http://www.gnu.org/licenses/>. */ #ifndef _LINUX_BATADV_PACKET_H_ #define _LINUX_BATADV_PACKET_H_ #include <asm/byteorder.h> #include <linux/if_ether.h> #include <linux/types.h> /** * batadv_tp_is_error() - Check throughput meter return code for error * @n: throughput meter return code * * Return: 0 when not error was detected, != 0 otherwise */ #define batadv_tp_is_error(n) ((__u8)(n) > 127 ? 1 : 0) /** * enum batadv_packettype - types for batman-adv encapsulated packets * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV * @BATADV_BCAST: broadcast packets carrying broadcast payload * @BATADV_CODED: network coded packets * @BATADV_ELP: echo location packets for B.A.T.M.A.N. V * @BATADV_OGM2: originator messages for B.A.T.M.A.N. V * * @BATADV_UNICAST: unicast packets carrying unicast payload traffic * @BATADV_UNICAST_FRAG: unicast packets carrying a fragment of the original * payload packet * @BATADV_UNICAST_4ADDR: unicast packet including the originator address of * the sender * @BATADV_ICMP: unicast packet like IP ICMP used for ping or traceroute * @BATADV_UNICAST_TVLV: unicast packet carrying TVLV containers */ enum batadv_packettype { /* 0x00 - 0x3f: local packets or special rules for handling */ BATADV_IV_OGM = 0x00, BATADV_BCAST = 0x01, BATADV_CODED = 0x02, BATADV_ELP = 0x03, BATADV_OGM2 = 0x04, /* 0x40 - 0x7f: unicast */ #define BATADV_UNICAST_MIN 0x40 BATADV_UNICAST = 0x40, BATADV_UNICAST_FRAG = 0x41, BATADV_UNICAST_4ADDR = 0x42, BATADV_ICMP = 0x43, BATADV_UNICAST_TVLV = 0x44, #define BATADV_UNICAST_MAX 0x7f /* 0x80 - 0xff: reserved */ }; /** * enum batadv_subtype - packet subtype for unicast4addr * @BATADV_P_DATA: user payload * @BATADV_P_DAT_DHT_GET: DHT request message * @BATADV_P_DAT_DHT_PUT: DHT store message * @BATADV_P_DAT_CACHE_REPLY: ARP reply generated by DAT */ enum batadv_subtype { BATADV_P_DATA = 0x01, BATADV_P_DAT_DHT_GET = 0x02, BATADV_P_DAT_DHT_PUT = 0x03, BATADV_P_DAT_CACHE_REPLY = 0x04, }; /* this file is included by batctl which needs these defines */ #define BATADV_COMPAT_VERSION 15 /** * enum batadv_iv_flags - flags used in B.A.T.M.A.N. IV OGM packets * @BATADV_NOT_BEST_NEXT_HOP: flag is set when ogm packet is forwarded and was * previously received from someone else than the best neighbor. * @BATADV_PRIMARIES_FIRST_HOP: flag unused. * @BATADV_DIRECTLINK: flag is for the first hop or if rebroadcasted from a * one hop neighbor on the interface where it was originally received. */ enum batadv_iv_flags { BATADV_NOT_BEST_NEXT_HOP = 1UL << 0, BATADV_PRIMARIES_FIRST_HOP = 1UL << 1, BATADV_DIRECTLINK = 1UL << 2, }; /** * enum batadv_icmp_packettype - ICMP message types * @BATADV_ECHO_REPLY: success reply to BATADV_ECHO_REQUEST * @BATADV_DESTINATION_UNREACHABLE: failure when route to destination not found * @BATADV_ECHO_REQUEST: request BATADV_ECHO_REPLY from destination * @BATADV_TTL_EXCEEDED: error after BATADV_ECHO_REQUEST traversed too many hops * @BATADV_PARAMETER_PROBLEM: return code for malformed messages * @BATADV_TP: throughput meter packet */ enum batadv_icmp_packettype { BATADV_ECHO_REPLY = 0, BATADV_DESTINATION_UNREACHABLE = 3, BATADV_ECHO_REQUEST = 8, BATADV_TTL_EXCEEDED = 11, BATADV_PARAMETER_PROBLEM = 12, BATADV_TP = 15, }; /** * enum batadv_mcast_flags - flags for multicast capabilities and settings * @BATADV_MCAST_WANT_ALL_UNSNOOPABLES: we want all packets destined for * 224.0.0.0/24 or ff02::1 * @BATADV_MCAST_WANT_ALL_IPV4: we want all IPv4 multicast packets * @BATADV_MCAST_WANT_ALL_IPV6: we want all IPv6 multicast packets */ enum batadv_mcast_flags { BATADV_MCAST_WANT_ALL_UNSNOOPABLES = 1UL << 0, BATADV_MCAST_WANT_ALL_IPV4 = 1UL << 1, BATADV_MCAST_WANT_ALL_IPV6 = 1UL << 2, }; /* tt data subtypes */ #define BATADV_TT_DATA_TYPE_MASK 0x0F /** * enum batadv_tt_data_flags - flags for tt data tvlv * @BATADV_TT_OGM_DIFF: TT diff propagated through OGM * @BATADV_TT_REQUEST: TT request message * @BATADV_TT_RESPONSE: TT response message * @BATADV_TT_FULL_TABLE: contains full table to replace existing table */ enum batadv_tt_data_flags { BATADV_TT_OGM_DIFF = 1UL << 0, BATADV_TT_REQUEST = 1UL << 1, BATADV_TT_RESPONSE = 1UL << 2, BATADV_TT_FULL_TABLE = 1UL << 4, }; /** * enum batadv_vlan_flags - flags for the four MSB of any vlan ID field * @BATADV_VLAN_HAS_TAG: whether the field contains a valid vlan tag or not */ enum batadv_vlan_flags { BATADV_VLAN_HAS_TAG = 1UL << 15, }; /** * enum batadv_bla_claimframe - claim frame types for the bridge loop avoidance * @BATADV_CLAIM_TYPE_CLAIM: claim of a client mac address * @BATADV_CLAIM_TYPE_UNCLAIM: unclaim of a client mac address * @BATADV_CLAIM_TYPE_ANNOUNCE: announcement of backbone with current crc * @BATADV_CLAIM_TYPE_REQUEST: request of full claim table * @BATADV_CLAIM_TYPE_LOOPDETECT: mesh-traversing loop detect packet */ enum batadv_bla_claimframe { BATADV_CLAIM_TYPE_CLAIM = 0x00, BATADV_CLAIM_TYPE_UNCLAIM = 0x01, BATADV_CLAIM_TYPE_ANNOUNCE = 0x02, BATADV_CLAIM_TYPE_REQUEST = 0x03, BATADV_CLAIM_TYPE_LOOPDETECT = 0x04, }; /** * enum batadv_tvlv_type - tvlv type definitions * @BATADV_TVLV_GW: gateway tvlv * @BATADV_TVLV_DAT: distributed arp table tvlv * @BATADV_TVLV_NC: network coding tvlv * @BATADV_TVLV_TT: translation table tvlv * @BATADV_TVLV_ROAM: roaming advertisement tvlv * @BATADV_TVLV_MCAST: multicast capability tvlv */ enum batadv_tvlv_type { BATADV_TVLV_GW = 0x01, BATADV_TVLV_DAT = 0x02, BATADV_TVLV_NC = 0x03, BATADV_TVLV_TT = 0x04, BATADV_TVLV_ROAM = 0x05, BATADV_TVLV_MCAST = 0x06, }; #pragma pack(2) /* the destination hardware field in the ARP frame is used to * transport the claim type and the group id */ struct batadv_bla_claim_dst { __u8 magic[3]; /* FF:43:05 */ __u8 type; /* bla_claimframe */ __be16 group; /* group id */ }; /** * struct batadv_ogm_packet - ogm (routing protocol) packet * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @flags: contains routing relevant flags - see enum batadv_iv_flags * @seqno: sequence identification * @orig: address of the source node * @prev_sender: address of the previous sender * @reserved: reserved byte for alignment * @tq: transmission quality * @tvlv_len: length of tvlv data following the ogm header */ struct batadv_ogm_packet { __u8 packet_type; __u8 version; __u8 ttl; __u8 flags; __be32 seqno; __u8 orig[ETH_ALEN]; __u8 prev_sender[ETH_ALEN]; __u8 reserved; __u8 tq; __be16 tvlv_len; }; #define BATADV_OGM_HLEN sizeof(struct batadv_ogm_packet) /** * struct batadv_ogm2_packet - ogm2 (routing protocol) packet * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the general header * @ttl: time to live for this packet, part of the general header * @flags: reseved for routing relevant flags - currently always 0 * @seqno: sequence number * @orig: originator mac address * @tvlv_len: length of the appended tvlv buffer (in bytes) * @throughput: the currently flooded path throughput */ struct batadv_ogm2_packet { __u8 packet_type; __u8 version; __u8 ttl; __u8 flags; __be32 seqno; __u8 orig[ETH_ALEN]; __be16 tvlv_len; __be32 throughput; }; #define BATADV_OGM2_HLEN sizeof(struct batadv_ogm2_packet) /** * struct batadv_elp_packet - elp (neighbor discovery) packet * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @orig: originator mac address * @seqno: sequence number * @elp_interval: currently used ELP sending interval in ms */ struct batadv_elp_packet { __u8 packet_type; __u8 version; __u8 orig[ETH_ALEN]; __be32 seqno; __be32 elp_interval; }; #define BATADV_ELP_HLEN sizeof(struct batadv_elp_packet) /** * struct batadv_icmp_header - common members among all the ICMP packets * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @msg_type: ICMP packet type * @dst: address of the destination node * @orig: address of the source node * @uid: local ICMP socket identifier * @align: not used - useful for alignment purposes only * * This structure is used for ICMP packets parsing only and it is never sent * over the wire. The alignment field at the end is there to ensure that * members are padded the same way as they are in real packets. */ struct batadv_icmp_header { __u8 packet_type; __u8 version; __u8 ttl; __u8 msg_type; /* see ICMP message types above */ __u8 dst[ETH_ALEN]; __u8 orig[ETH_ALEN]; __u8 uid; __u8 align[3]; }; /** * struct batadv_icmp_packet - ICMP packet * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @msg_type: ICMP packet type * @dst: address of the destination node * @orig: address of the source node * @uid: local ICMP socket identifier * @reserved: not used - useful for alignment * @seqno: ICMP sequence number */ struct batadv_icmp_packet { __u8 packet_type; __u8 version; __u8 ttl; __u8 msg_type; /* see ICMP message types above */ __u8 dst[ETH_ALEN]; __u8 orig[ETH_ALEN]; __u8 uid; __u8 reserved; __be16 seqno; }; /** * struct batadv_icmp_tp_packet - ICMP TP Meter packet * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @msg_type: ICMP packet type * @dst: address of the destination node * @orig: address of the source node * @uid: local ICMP socket identifier * @subtype: TP packet subtype (see batadv_icmp_tp_subtype) * @session: TP session identifier * @seqno: the TP sequence number * @timestamp: time when the packet has been sent. This value is filled in a * TP_MSG and echoed back in the next TP_ACK so that the sender can compute the * RTT. Since it is read only by the host which wrote it, there is no need to * store it using network order */ struct batadv_icmp_tp_packet { __u8 packet_type; __u8 version; __u8 ttl; __u8 msg_type; /* see ICMP message types above */ __u8 dst[ETH_ALEN]; __u8 orig[ETH_ALEN]; __u8 uid; __u8 subtype; __u8 session[2]; __be32 seqno; __be32 timestamp; }; /** * enum batadv_icmp_tp_subtype - ICMP TP Meter packet subtypes * @BATADV_TP_MSG: Msg from sender to receiver * @BATADV_TP_ACK: acknowledgment from receiver to sender */ enum batadv_icmp_tp_subtype { BATADV_TP_MSG = 0, BATADV_TP_ACK, }; #define BATADV_RR_LEN 16 /** * struct batadv_icmp_packet_rr - ICMP RouteRecord packet * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @msg_type: ICMP packet type * @dst: address of the destination node * @orig: address of the source node * @uid: local ICMP socket identifier * @rr_cur: number of entries the rr array * @seqno: ICMP sequence number * @rr: route record array */ struct batadv_icmp_packet_rr { __u8 packet_type; __u8 version; __u8 ttl; __u8 msg_type; /* see ICMP message types above */ __u8 dst[ETH_ALEN]; __u8 orig[ETH_ALEN]; __u8 uid; __u8 rr_cur; __be16 seqno; __u8 rr[BATADV_RR_LEN][ETH_ALEN]; }; #define BATADV_ICMP_MAX_PACKET_SIZE sizeof(struct batadv_icmp_packet_rr) /* All packet headers in front of an ethernet header have to be completely * divisible by 2 but not by 4 to make the payload after the ethernet * header again 4 bytes boundary aligned. * * A packing of 2 is necessary to avoid extra padding at the end of the struct * caused by a structure member which is larger than two bytes. Otherwise * the structure would not fulfill the previously mentioned rule to avoid the * misalignment of the payload after the ethernet header. It may also lead to * leakage of information when the padding it not initialized before sending. */ /** * struct batadv_unicast_packet - unicast packet for network payload * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @ttvn: translation table version number * @dest: originator destination of the unicast packet */ struct batadv_unicast_packet { __u8 packet_type; __u8 version; __u8 ttl; __u8 ttvn; /* destination translation table version number */ __u8 dest[ETH_ALEN]; /* "4 bytes boundary + 2 bytes" long to make the payload after the * following ethernet header again 4 bytes boundary aligned */ }; /** * struct batadv_unicast_4addr_packet - extended unicast packet * @u: common unicast packet header * @src: address of the source * @subtype: packet subtype * @reserved: reserved byte for alignment */ struct batadv_unicast_4addr_packet { struct batadv_unicast_packet u; __u8 src[ETH_ALEN]; __u8 subtype; __u8 reserved; /* "4 bytes boundary + 2 bytes" long to make the payload after the * following ethernet header again 4 bytes boundary aligned */ }; /** * struct batadv_frag_packet - fragmented packet * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @dest: final destination used when routing fragments * @orig: originator of the fragment used when merging the packet * @no: fragment number within this sequence * @priority: priority of frame, from ToS IP precedence or 802.1p * @reserved: reserved byte for alignment * @seqno: sequence identification * @total_size: size of the merged packet */ struct batadv_frag_packet { __u8 packet_type; __u8 version; /* batman version field */ __u8 ttl; #if defined(__BIG_ENDIAN_BITFIELD) __u8 no:4; __u8 priority:3; __u8 reserved:1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 reserved:1; __u8 priority:3; __u8 no:4; #else #error "unknown bitfield endianness" #endif __u8 dest[ETH_ALEN]; __u8 orig[ETH_ALEN]; __be16 seqno; __be16 total_size; }; /** * struct batadv_bcast_packet - broadcast packet for network payload * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @reserved: reserved byte for alignment * @seqno: sequence identification * @orig: originator of the broadcast packet */ struct batadv_bcast_packet { __u8 packet_type; __u8 version; /* batman version field */ __u8 ttl; __u8 reserved; __be32 seqno; __u8 orig[ETH_ALEN]; /* "4 bytes boundary + 2 bytes" long to make the payload after the * following ethernet header again 4 bytes boundary aligned */ }; /** * struct batadv_coded_packet - network coded packet * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @first_source: original source of first included packet * @first_orig_dest: original destinal of first included packet * @first_crc: checksum of first included packet * @first_ttvn: tt-version number of first included packet * @second_ttl: ttl of second packet * @second_dest: second receiver of this coded packet * @second_source: original source of second included packet * @second_orig_dest: original destination of second included packet * @second_crc: checksum of second included packet * @second_ttvn: tt version number of second included packet * @coded_len: length of network coded part of the payload */ struct batadv_coded_packet { __u8 packet_type; __u8 version; /* batman version field */ __u8 ttl; __u8 first_ttvn; /* __u8 first_dest[ETH_ALEN]; - saved in mac header destination */ __u8 first_source[ETH_ALEN]; __u8 first_orig_dest[ETH_ALEN]; __be32 first_crc; __u8 second_ttl; __u8 second_ttvn; __u8 second_dest[ETH_ALEN]; __u8 second_source[ETH_ALEN]; __u8 second_orig_dest[ETH_ALEN]; __be32 second_crc; __be16 coded_len; }; /** * struct batadv_unicast_tvlv_packet - generic unicast packet with tvlv payload * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @reserved: reserved field (for packet alignment) * @src: address of the source * @dst: address of the destination * @tvlv_len: length of tvlv data following the unicast tvlv header * @align: 2 bytes to align the header to a 4 byte boundary */ struct batadv_unicast_tvlv_packet { __u8 packet_type; __u8 version; /* batman version field */ __u8 ttl; __u8 reserved; __u8 dst[ETH_ALEN]; __u8 src[ETH_ALEN]; __be16 tvlv_len; __u16 align; }; /** * struct batadv_tvlv_hdr - base tvlv header struct * @type: tvlv container type (see batadv_tvlv_type) * @version: tvlv container version * @len: tvlv container length */ struct batadv_tvlv_hdr { __u8 type; __u8 version; __be16 len; }; /** * struct batadv_tvlv_gateway_data - gateway data propagated through gw tvlv * container * @bandwidth_down: advertised uplink download bandwidth * @bandwidth_up: advertised uplink upload bandwidth */ struct batadv_tvlv_gateway_data { __be32 bandwidth_down; __be32 bandwidth_up; }; /** * struct batadv_tvlv_tt_data - tt data propagated through the tt tvlv container * @flags: translation table flags (see batadv_tt_data_flags) * @ttvn: translation table version number * @num_vlan: number of announced VLANs. In the TVLV this struct is followed by * one batadv_tvlv_tt_vlan_data object per announced vlan */ struct batadv_tvlv_tt_data { __u8 flags; __u8 ttvn; __be16 num_vlan; }; /** * struct batadv_tvlv_tt_vlan_data - vlan specific tt data propagated through * the tt tvlv container * @crc: crc32 checksum of the entries belonging to this vlan * @vid: vlan identifier * @reserved: unused, useful for alignment purposes */ struct batadv_tvlv_tt_vlan_data { __be32 crc; __be16 vid; __u16 reserved; }; /** * struct batadv_tvlv_tt_change - translation table diff data * @flags: status indicators concerning the non-mesh client (see * batadv_tt_client_flags) * @reserved: reserved field - useful for alignment purposes only * @addr: mac address of non-mesh client that triggered this tt change * @vid: VLAN identifier */ struct batadv_tvlv_tt_change { __u8 flags; __u8 reserved[3]; __u8 addr[ETH_ALEN]; __be16 vid; }; /** * struct batadv_tvlv_roam_adv - roaming advertisement * @client: mac address of roaming client * @vid: VLAN identifier */ struct batadv_tvlv_roam_adv { __u8 client[ETH_ALEN]; __be16 vid; }; /** * struct batadv_tvlv_mcast_data - payload of a multicast tvlv * @flags: multicast flags announced by the orig node * @reserved: reserved field */ struct batadv_tvlv_mcast_data { __u8 flags; __u8 reserved[3]; }; #pragma pack() #endif /* _LINUX_BATADV_PACKET_H_ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_x25.h��������������������������������������������������������������������������������������0000644�����������������00000001561�14763166027�0007167 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Linux X.25 packet to device interface * * 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. */ #ifndef _IF_X25_H #define _IF_X25_H #include <linux/types.h> /* Documentation/networking/x25-iface.txt */ #define X25_IFACE_DATA 0x00 #define X25_IFACE_CONNECT 0x01 #define X25_IFACE_DISCONNECT 0x02 #define X25_IFACE_PARAMS 0x03 #endif /* _IF_X25_H */ �����������������������������������������������������������������������������������������������������������������������������������������������linux/eventpoll.h�����������������������������������������������������������������������������������0000644�����������������00000005267�14763166027�0010112 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * include/linux/eventpoll.h ( Efficient event polling implementation ) * Copyright (C) 2001,...,2006 Davide Libenzi * * 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. * * Davide Libenzi <davidel@xmailserver.org> * */ #ifndef _LINUX_EVENTPOLL_H #define _LINUX_EVENTPOLL_H /* For O_CLOEXEC */ #include <linux/fcntl.h> #include <linux/types.h> /* Flags for epoll_create1. */ #define EPOLL_CLOEXEC O_CLOEXEC /* Valid opcodes to issue to sys_epoll_ctl() */ #define EPOLL_CTL_ADD 1 #define EPOLL_CTL_DEL 2 #define EPOLL_CTL_MOD 3 /* Epoll event masks */ #define EPOLLIN (__poll_t)0x00000001 #define EPOLLPRI (__poll_t)0x00000002 #define EPOLLOUT (__poll_t)0x00000004 #define EPOLLERR (__poll_t)0x00000008 #define EPOLLHUP (__poll_t)0x00000010 #define EPOLLNVAL (__poll_t)0x00000020 #define EPOLLRDNORM (__poll_t)0x00000040 #define EPOLLRDBAND (__poll_t)0x00000080 #define EPOLLWRNORM (__poll_t)0x00000100 #define EPOLLWRBAND (__poll_t)0x00000200 #define EPOLLMSG (__poll_t)0x00000400 #define EPOLLRDHUP (__poll_t)0x00002000 /* Set exclusive wakeup mode for the target file descriptor */ #define EPOLLEXCLUSIVE ((__poll_t)(1U << 28)) /* * Request the handling of system wakeup events so as to prevent system suspends * from happening while those events are being processed. * * Assuming neither EPOLLET nor EPOLLONESHOT is set, system suspends will not be * re-allowed until epoll_wait is called again after consuming the wakeup * event(s). * * Requires CAP_BLOCK_SUSPEND */ #define EPOLLWAKEUP ((__poll_t)(1U << 29)) /* Set the One Shot behaviour for the target file descriptor */ #define EPOLLONESHOT ((__poll_t)(1U << 30)) /* Set the Edge Triggered behaviour for the target file descriptor */ #define EPOLLET ((__poll_t)(1U << 31)) /* * On x86-64 make the 64bit structure have the same alignment as the * 32bit structure. This makes 32bit emulation easier. * * UML/x86_64 needs the same packing as x86_64 */ #ifdef __x86_64__ #define EPOLL_PACKED __attribute__((packed)) #else #define EPOLL_PACKED #endif struct epoll_event { __poll_t events; __u64 data; } EPOLL_PACKED; #ifdef CONFIG_PM_SLEEP static __inline__ void ep_take_care_of_epollwakeup(struct epoll_event *epev) { if ((epev->events & EPOLLWAKEUP) && !capable(CAP_BLOCK_SUSPEND)) epev->events &= ~EPOLLWAKEUP; } #else static __inline__ void ep_take_care_of_epollwakeup(struct epoll_event *epev) { epev->events &= ~EPOLLWAKEUP; } #endif #endif /* _LINUX_EVENTPOLL_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/errno.h���������������������������������������������������������������������������������������0000644�����������������00000000027�14763166027�0007214 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <asm/errno.h> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/atmclip.h�������������������������������������������������������������������������������������0000644�����������������00000001100�14763166027�0007511 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atmclip.h - Classical IP over ATM */ /* Written 1995-1998 by Werner Almesberger, EPFL LRC/ICA */ #ifndef LINUX_ATMCLIP_H #define LINUX_ATMCLIP_H #include <linux/sockios.h> #include <linux/atmioc.h> #define RFC1483LLC_LEN 8 /* LLC+OUI+PID = 8 */ #define RFC1626_MTU 9180 /* RFC1626 default MTU */ #define CLIP_DEFAULT_IDLETIMER 1200 /* 20 minutes, see RFC1755 */ #define CLIP_CHECK_INTERVAL 10 /* check every ten seconds */ #define SIOCMKCLIP _IO('a',ATMIOC_CLIP) /* create IP interface */ #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_cablemodem.h�������������������������������������������������������������������������������0000644�����������������00000001732�14763166027�0010641 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef _LINUX_CABLEMODEM_H_ #define _LINUX_CABLEMODEM_H_ /* * Author: Franco Venturi <fventuri@mediaone.net> * Copyright 1998 Franco Venturi * * 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. */ /* some useful defines for sb1000.c e cmconfig.c - fv */ #define SIOCGCMSTATS (SIOCDEVPRIVATE+0) /* get cable modem stats */ #define SIOCGCMFIRMWARE (SIOCDEVPRIVATE+1) /* get cm firmware version */ #define SIOCGCMFREQUENCY (SIOCDEVPRIVATE+2) /* get cable modem frequency */ #define SIOCSCMFREQUENCY (SIOCDEVPRIVATE+3) /* set cable modem frequency */ #define SIOCGCMPIDS (SIOCDEVPRIVATE+4) /* get cable modem PIDs */ #define SIOCSCMPIDS (SIOCDEVPRIVATE+5) /* set cable modem PIDs */ #endif ��������������������������������������linux/atm_zatm.h������������������������������������������������������������������������������������0000644�����������������00000003004�14763166027�0007701 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atm_zatm.h - Driver-specific declarations of the ZATM driver (for use by driver-specific utilities) */ /* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ #ifndef LINUX_ATM_ZATM_H #define LINUX_ATM_ZATM_H /* * Note: non-kernel programs including this file must also include * sys/types.h for struct timeval */ #include <linux/atmapi.h> #include <linux/atmioc.h> #define ZATM_GETPOOL _IOW('a',ATMIOC_SARPRV+1,struct atmif_sioc) /* get pool statistics */ #define ZATM_GETPOOLZ _IOW('a',ATMIOC_SARPRV+2,struct atmif_sioc) /* get statistics and zero */ #define ZATM_SETPOOL _IOW('a',ATMIOC_SARPRV+3,struct atmif_sioc) /* set pool parameters */ struct zatm_pool_info { int ref_count; /* free buffer pool usage counters */ int low_water,high_water; /* refill parameters */ int rqa_count,rqu_count; /* queue condition counters */ int offset,next_off; /* alignment optimizations: offset */ int next_cnt,next_thres; /* repetition counter and threshold */ }; struct zatm_pool_req { int pool_num; /* pool number */ struct zatm_pool_info info; /* actual information */ }; #define ZATM_OAM_POOL 0 /* free buffer pool for OAM cells */ #define ZATM_AAL0_POOL 1 /* free buffer pool for AAL0 cells */ #define ZATM_AAL5_POOL_BASE 2 /* first AAL5 free buffer pool */ #define ZATM_LAST_POOL ZATM_AAL5_POOL_BASE+10 /* max. 64 kB */ #define ZATM_TIMER_HISTORY_SIZE 16 /* number of timer adjustments to record; must be 2^n */ #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/can/netlink.h���������������������������������������������������������������������������������0000644�����������������00000007625�14763166027�0010307 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/can/netlink.h * * Definitions for the CAN netlink interface * * Copyright (c) 2009 Wolfgang Grandegger <wg@grandegger.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the version 2 of the GNU General Public License * as published by the Free Software Foundation * * 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. */ #ifndef _CAN_NETLINK_H #define _CAN_NETLINK_H #include <linux/types.h> /* * CAN bit-timing parameters * * For further information, please read chapter "8 BIT TIMING * REQUIREMENTS" of the "Bosch CAN Specification version 2.0" * at http://www.semiconductors.bosch.de/pdf/can2spec.pdf. */ struct can_bittiming { __u32 bitrate; /* Bit-rate in bits/second */ __u32 sample_point; /* Sample point in one-tenth of a percent */ __u32 tq; /* Time quanta (TQ) in nanoseconds */ __u32 prop_seg; /* Propagation segment in TQs */ __u32 phase_seg1; /* Phase buffer segment 1 in TQs */ __u32 phase_seg2; /* Phase buffer segment 2 in TQs */ __u32 sjw; /* Synchronisation jump width in TQs */ __u32 brp; /* Bit-rate prescaler */ }; /* * CAN harware-dependent bit-timing constant * * Used for calculating and checking bit-timing parameters */ struct can_bittiming_const { char name[16]; /* Name of the CAN controller hardware */ __u32 tseg1_min; /* Time segement 1 = prop_seg + phase_seg1 */ __u32 tseg1_max; __u32 tseg2_min; /* Time segement 2 = phase_seg2 */ __u32 tseg2_max; __u32 sjw_max; /* Synchronisation jump width */ __u32 brp_min; /* Bit-rate prescaler */ __u32 brp_max; __u32 brp_inc; }; /* * CAN clock parameters */ struct can_clock { __u32 freq; /* CAN system clock frequency in Hz */ }; /* * CAN operational and error states */ enum can_state { CAN_STATE_ERROR_ACTIVE = 0, /* RX/TX error count < 96 */ CAN_STATE_ERROR_WARNING, /* RX/TX error count < 128 */ CAN_STATE_ERROR_PASSIVE, /* RX/TX error count < 256 */ CAN_STATE_BUS_OFF, /* RX/TX error count >= 256 */ CAN_STATE_STOPPED, /* Device is stopped */ CAN_STATE_SLEEPING, /* Device is sleeping */ CAN_STATE_MAX }; /* * CAN bus error counters */ struct can_berr_counter { __u16 txerr; __u16 rxerr; }; /* * CAN controller mode */ struct can_ctrlmode { __u32 mask; __u32 flags; }; #define CAN_CTRLMODE_LOOPBACK 0x01 /* Loopback mode */ #define CAN_CTRLMODE_LISTENONLY 0x02 /* Listen-only mode */ #define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */ #define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */ #define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */ #define CAN_CTRLMODE_FD 0x20 /* CAN FD mode */ #define CAN_CTRLMODE_PRESUME_ACK 0x40 /* Ignore missing CAN ACKs */ #define CAN_CTRLMODE_FD_NON_ISO 0x80 /* CAN FD in non-ISO mode */ /* * CAN device statistics */ struct can_device_stats { __u32 bus_error; /* Bus errors */ __u32 error_warning; /* Changes to error warning state */ __u32 error_passive; /* Changes to error passive state */ __u32 bus_off; /* Changes to bus off state */ __u32 arbitration_lost; /* Arbitration lost errors */ __u32 restarts; /* CAN controller re-starts */ }; /* * CAN netlink interface */ enum { IFLA_CAN_UNSPEC, IFLA_CAN_BITTIMING, IFLA_CAN_BITTIMING_CONST, IFLA_CAN_CLOCK, IFLA_CAN_STATE, IFLA_CAN_CTRLMODE, IFLA_CAN_RESTART_MS, IFLA_CAN_RESTART, IFLA_CAN_BERR_COUNTER, IFLA_CAN_DATA_BITTIMING, IFLA_CAN_DATA_BITTIMING_CONST, IFLA_CAN_TERMINATION, IFLA_CAN_TERMINATION_CONST, IFLA_CAN_BITRATE_CONST, IFLA_CAN_DATA_BITRATE_CONST, IFLA_CAN_BITRATE_MAX, __IFLA_CAN_MAX }; #define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1) /* u16 termination range: 1..65535 Ohms */ #define CAN_TERMINATION_DISABLED 0 #endif /* !_UAPI_CAN_NETLINK_H */ �����������������������������������������������������������������������������������������������������������linux/can/gw.h��������������������������������������������������������������������������������������0000644�����������������00000016416�14763166027�0007256 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * linux/can/gw.h * * Definitions for CAN frame Gateway/Router/Bridge * * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> * Copyright (c) 2011 Volkswagen Group Electronic Research * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Volkswagen nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * Alternatively, provided that this notice is retained in full, this * software may be distributed under the terms of the GNU General * Public License ("GPL") version 2, in which case the provisions of the * GPL apply INSTEAD OF those given above. * * The provided data structures and external interfaces from this code * are not restricted to be used by modules with a GPL compatible license. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ #ifndef _CAN_GW_H #define _CAN_GW_H #include <linux/types.h> #include <linux/can.h> struct rtcanmsg { __u8 can_family; __u8 gwtype; __u16 flags; }; /* CAN gateway types */ enum { CGW_TYPE_UNSPEC, CGW_TYPE_CAN_CAN, /* CAN->CAN routing */ __CGW_TYPE_MAX }; #define CGW_TYPE_MAX (__CGW_TYPE_MAX - 1) /* CAN rtnetlink attribute definitions */ enum { CGW_UNSPEC, CGW_MOD_AND, /* CAN frame modification binary AND */ CGW_MOD_OR, /* CAN frame modification binary OR */ CGW_MOD_XOR, /* CAN frame modification binary XOR */ CGW_MOD_SET, /* CAN frame modification set alternate values */ CGW_CS_XOR, /* set data[] XOR checksum into data[index] */ CGW_CS_CRC8, /* set data[] CRC8 checksum into data[index] */ CGW_HANDLED, /* number of handled CAN frames */ CGW_DROPPED, /* number of dropped CAN frames */ CGW_SRC_IF, /* ifindex of source network interface */ CGW_DST_IF, /* ifindex of destination network interface */ CGW_FILTER, /* specify struct can_filter on source CAN device */ CGW_DELETED, /* number of deleted CAN frames (see max_hops param) */ CGW_LIM_HOPS, /* limit the number of hops of this specific rule */ CGW_MOD_UID, /* user defined identifier for modification updates */ __CGW_MAX }; #define CGW_MAX (__CGW_MAX - 1) #define CGW_FLAGS_CAN_ECHO 0x01 #define CGW_FLAGS_CAN_SRC_TSTAMP 0x02 #define CGW_FLAGS_CAN_IIF_TX_OK 0x04 #define CGW_MOD_FUNCS 4 /* AND OR XOR SET */ /* CAN frame elements that are affected by curr. 3 CAN frame modifications */ #define CGW_MOD_ID 0x01 #define CGW_MOD_DLC 0x02 #define CGW_MOD_DATA 0x04 #define CGW_FRAME_MODS 3 /* ID DLC DATA */ #define MAX_MODFUNCTIONS (CGW_MOD_FUNCS * CGW_FRAME_MODS) struct cgw_frame_mod { struct can_frame cf; __u8 modtype; } __attribute__((packed)); #define CGW_MODATTR_LEN sizeof(struct cgw_frame_mod) struct cgw_csum_xor { __s8 from_idx; __s8 to_idx; __s8 result_idx; __u8 init_xor_val; } __attribute__((packed)); struct cgw_csum_crc8 { __s8 from_idx; __s8 to_idx; __s8 result_idx; __u8 init_crc_val; __u8 final_xor_val; __u8 crctab[256]; __u8 profile; __u8 profile_data[20]; } __attribute__((packed)); /* length of checksum operation parameters. idx = index in CAN frame data[] */ #define CGW_CS_XOR_LEN sizeof(struct cgw_csum_xor) #define CGW_CS_CRC8_LEN sizeof(struct cgw_csum_crc8) /* CRC8 profiles (compute CRC for additional data elements - see below) */ enum { CGW_CRC8PRF_UNSPEC, CGW_CRC8PRF_1U8, /* compute one additional u8 value */ CGW_CRC8PRF_16U8, /* u8 value table indexed by data[1] & 0xF */ CGW_CRC8PRF_SFFID_XOR, /* (can_id & 0xFF) ^ (can_id >> 8 & 0xFF) */ __CGW_CRC8PRF_MAX }; #define CGW_CRC8PRF_MAX (__CGW_CRC8PRF_MAX - 1) /* * CAN rtnetlink attribute contents in detail * * CGW_XXX_IF (length 4 bytes): * Sets an interface index for source/destination network interfaces. * For the CAN->CAN gwtype the indices of _two_ CAN interfaces are mandatory. * * CGW_FILTER (length 8 bytes): * Sets a CAN receive filter for the gateway job specified by the * struct can_filter described in include/linux/can.h * * CGW_MOD_(AND|OR|XOR|SET) (length 17 bytes): * Specifies a modification that's done to a received CAN frame before it is * send out to the destination interface. * * <struct can_frame> data used as operator * <u8> affected CAN frame elements * * CGW_LIM_HOPS (length 1 byte): * Limit the number of hops of this specific rule. Usually the received CAN * frame can be processed as much as 'max_hops' times (which is given at module * load time of the can-gw module). This value is used to reduce the number of * possible hops for this gateway rule to a value smaller then max_hops. * * CGW_MOD_UID (length 4 bytes): * Optional non-zero user defined routing job identifier to alter existing * modification settings at runtime. * * CGW_CS_XOR (length 4 bytes): * Set a simple XOR checksum starting with an initial value into * data[result-idx] using data[start-idx] .. data[end-idx] * * The XOR checksum is calculated like this: * * xor = init_xor_val * * for (i = from_idx .. to_idx) * xor ^= can_frame.data[i] * * can_frame.data[ result_idx ] = xor * * CGW_CS_CRC8 (length 282 bytes): * Set a CRC8 value into data[result-idx] using a given 256 byte CRC8 table, * a given initial value and a defined input data[start-idx] .. data[end-idx]. * Finally the result value is XOR'ed with the final_xor_val. * * The CRC8 checksum is calculated like this: * * crc = init_crc_val * * for (i = from_idx .. to_idx) * crc = crctab[ crc ^ can_frame.data[i] ] * * can_frame.data[ result_idx ] = crc ^ final_xor_val * * The calculated CRC may contain additional source data elements that can be * defined in the handling of 'checksum profiles' e.g. shown in AUTOSAR specs * like http://www.autosar.org/download/R4.0/AUTOSAR_SWS_E2ELibrary.pdf * E.g. the profile_data[] may contain additional u8 values (called DATA_IDs) * that are used depending on counter values inside the CAN frame data[]. * So far only three profiles have been implemented for illustration. * * Remark: In general the attribute data is a linear buffer. * Beware of sending unpacked or aligned structs! */ #endif /* !_UAPI_CAN_GW_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/can/bcm.h�������������������������������������������������������������������������������������0000644�����������������00000010017�14763166027�0007371 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * linux/can/bcm.h * * Definitions for CAN Broadcast Manager (BCM) * * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> * Copyright (c) 2002-2007 Volkswagen Group Electronic Research * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Volkswagen nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * Alternatively, provided that this notice is retained in full, this * software may be distributed under the terms of the GNU General * Public License ("GPL") version 2, in which case the provisions of the * GPL apply INSTEAD OF those given above. * * The provided data structures and external interfaces from this code * are not restricted to be used by modules with a GPL compatible license. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ #ifndef _CAN_BCM_H #define _CAN_BCM_H #include <linux/types.h> #include <linux/can.h> struct bcm_timeval { long tv_sec; long tv_usec; }; /** * struct bcm_msg_head - head of messages to/from the broadcast manager * @opcode: opcode, see enum below. * @flags: special flags, see below. * @count: number of frames to send before changing interval. * @ival1: interval for the first @count frames. * @ival2: interval for the following frames. * @can_id: CAN ID of frames to be sent or received. * @nframes: number of frames appended to the message head. * @frames: array of CAN frames. */ struct bcm_msg_head { __u32 opcode; __u32 flags; __u32 count; struct bcm_timeval ival1, ival2; canid_t can_id; __u32 nframes; struct can_frame frames[0]; }; enum { TX_SETUP = 1, /* create (cyclic) transmission task */ TX_DELETE, /* remove (cyclic) transmission task */ TX_READ, /* read properties of (cyclic) transmission task */ TX_SEND, /* send one CAN frame */ RX_SETUP, /* create RX content filter subscription */ RX_DELETE, /* remove RX content filter subscription */ RX_READ, /* read properties of RX content filter subscription */ TX_STATUS, /* reply to TX_READ request */ TX_EXPIRED, /* notification on performed transmissions (count=0) */ RX_STATUS, /* reply to RX_READ request */ RX_TIMEOUT, /* cyclic message is absent */ RX_CHANGED /* updated CAN frame (detected content change) */ }; #define SETTIMER 0x0001 #define STARTTIMER 0x0002 #define TX_COUNTEVT 0x0004 #define TX_ANNOUNCE 0x0008 #define TX_CP_CAN_ID 0x0010 #define RX_FILTER_ID 0x0020 #define RX_CHECK_DLC 0x0040 #define RX_NO_AUTOTIMER 0x0080 #define RX_ANNOUNCE_RESUME 0x0100 #define TX_RESET_MULTI_IDX 0x0200 #define RX_RTR_FRAME 0x0400 #define CAN_FD_FRAME 0x0800 #endif /* !_UAPI_CAN_BCM_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/can/vxcan.h�����������������������������������������������������������������������������������0000644�����������������00000000343�14763166027�0007750 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _CAN_VXCAN_H #define _CAN_VXCAN_H enum { VXCAN_INFO_UNSPEC, VXCAN_INFO_PEER, __VXCAN_INFO_MAX #define VXCAN_INFO_MAX (__VXCAN_INFO_MAX - 1) }; #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/can/error.h�����������������������������������������������������������������������������������0000644�����������������00000014771�14763166027�0007774 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * linux/can/error.h * * Definitions of the CAN error messages to be filtered and passed to the user. * * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> * Copyright (c) 2002-2007 Volkswagen Group Electronic Research * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Volkswagen nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * Alternatively, provided that this notice is retained in full, this * software may be distributed under the terms of the GNU General * Public License ("GPL") version 2, in which case the provisions of the * GPL apply INSTEAD OF those given above. * * The provided data structures and external interfaces from this code * are not restricted to be used by modules with a GPL compatible license. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ #ifndef _CAN_ERROR_H #define _CAN_ERROR_H #define CAN_ERR_DLC 8 /* dlc for error message frames */ /* error class (mask) in can_id */ #define CAN_ERR_TX_TIMEOUT 0x00000001U /* TX timeout (by netdevice driver) */ #define CAN_ERR_LOSTARB 0x00000002U /* lost arbitration / data[0] */ #define CAN_ERR_CRTL 0x00000004U /* controller problems / data[1] */ #define CAN_ERR_PROT 0x00000008U /* protocol violations / data[2..3] */ #define CAN_ERR_TRX 0x00000010U /* transceiver status / data[4] */ #define CAN_ERR_ACK 0x00000020U /* received no ACK on transmission */ #define CAN_ERR_BUSOFF 0x00000040U /* bus off */ #define CAN_ERR_BUSERROR 0x00000080U /* bus error (may flood!) */ #define CAN_ERR_RESTARTED 0x00000100U /* controller restarted */ /* arbitration lost in bit ... / data[0] */ #define CAN_ERR_LOSTARB_UNSPEC 0x00 /* unspecified */ /* else bit number in bitstream */ /* error status of CAN-controller / data[1] */ #define CAN_ERR_CRTL_UNSPEC 0x00 /* unspecified */ #define CAN_ERR_CRTL_RX_OVERFLOW 0x01 /* RX buffer overflow */ #define CAN_ERR_CRTL_TX_OVERFLOW 0x02 /* TX buffer overflow */ #define CAN_ERR_CRTL_RX_WARNING 0x04 /* reached warning level for RX errors */ #define CAN_ERR_CRTL_TX_WARNING 0x08 /* reached warning level for TX errors */ #define CAN_ERR_CRTL_RX_PASSIVE 0x10 /* reached error passive status RX */ #define CAN_ERR_CRTL_TX_PASSIVE 0x20 /* reached error passive status TX */ /* (at least one error counter exceeds */ /* the protocol-defined level of 127) */ #define CAN_ERR_CRTL_ACTIVE 0x40 /* recovered to error active state */ /* error in CAN protocol (type) / data[2] */ #define CAN_ERR_PROT_UNSPEC 0x00 /* unspecified */ #define CAN_ERR_PROT_BIT 0x01 /* single bit error */ #define CAN_ERR_PROT_FORM 0x02 /* frame format error */ #define CAN_ERR_PROT_STUFF 0x04 /* bit stuffing error */ #define CAN_ERR_PROT_BIT0 0x08 /* unable to send dominant bit */ #define CAN_ERR_PROT_BIT1 0x10 /* unable to send recessive bit */ #define CAN_ERR_PROT_OVERLOAD 0x20 /* bus overload */ #define CAN_ERR_PROT_ACTIVE 0x40 /* active error announcement */ #define CAN_ERR_PROT_TX 0x80 /* error occurred on transmission */ /* error in CAN protocol (location) / data[3] */ #define CAN_ERR_PROT_LOC_UNSPEC 0x00 /* unspecified */ #define CAN_ERR_PROT_LOC_SOF 0x03 /* start of frame */ #define CAN_ERR_PROT_LOC_ID28_21 0x02 /* ID bits 28 - 21 (SFF: 10 - 3) */ #define CAN_ERR_PROT_LOC_ID20_18 0x06 /* ID bits 20 - 18 (SFF: 2 - 0 )*/ #define CAN_ERR_PROT_LOC_SRTR 0x04 /* substitute RTR (SFF: RTR) */ #define CAN_ERR_PROT_LOC_IDE 0x05 /* identifier extension */ #define CAN_ERR_PROT_LOC_ID17_13 0x07 /* ID bits 17-13 */ #define CAN_ERR_PROT_LOC_ID12_05 0x0F /* ID bits 12-5 */ #define CAN_ERR_PROT_LOC_ID04_00 0x0E /* ID bits 4-0 */ #define CAN_ERR_PROT_LOC_RTR 0x0C /* RTR */ #define CAN_ERR_PROT_LOC_RES1 0x0D /* reserved bit 1 */ #define CAN_ERR_PROT_LOC_RES0 0x09 /* reserved bit 0 */ #define CAN_ERR_PROT_LOC_DLC 0x0B /* data length code */ #define CAN_ERR_PROT_LOC_DATA 0x0A /* data section */ #define CAN_ERR_PROT_LOC_CRC_SEQ 0x08 /* CRC sequence */ #define CAN_ERR_PROT_LOC_CRC_DEL 0x18 /* CRC delimiter */ #define CAN_ERR_PROT_LOC_ACK 0x19 /* ACK slot */ #define CAN_ERR_PROT_LOC_ACK_DEL 0x1B /* ACK delimiter */ #define CAN_ERR_PROT_LOC_EOF 0x1A /* end of frame */ #define CAN_ERR_PROT_LOC_INTERM 0x12 /* intermission */ /* error status of CAN-transceiver / data[4] */ /* CANH CANL */ #define CAN_ERR_TRX_UNSPEC 0x00 /* 0000 0000 */ #define CAN_ERR_TRX_CANH_NO_WIRE 0x04 /* 0000 0100 */ #define CAN_ERR_TRX_CANH_SHORT_TO_BAT 0x05 /* 0000 0101 */ #define CAN_ERR_TRX_CANH_SHORT_TO_VCC 0x06 /* 0000 0110 */ #define CAN_ERR_TRX_CANH_SHORT_TO_GND 0x07 /* 0000 0111 */ #define CAN_ERR_TRX_CANL_NO_WIRE 0x40 /* 0100 0000 */ #define CAN_ERR_TRX_CANL_SHORT_TO_BAT 0x50 /* 0101 0000 */ #define CAN_ERR_TRX_CANL_SHORT_TO_VCC 0x60 /* 0110 0000 */ #define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70 /* 0111 0000 */ #define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /* 1000 0000 */ /* data[5] is reserved (do not use) */ /* TX error counter / data[6] */ /* RX error counter / data[7] */ #endif /* _CAN_ERROR_H */ �������linux/can/raw.h�������������������������������������������������������������������������������������0000644�����������������00000005445�14763166027�0007432 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * linux/can/raw.h * * Definitions for raw CAN sockets * * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> * Urs Thuermann <urs.thuermann@volkswagen.de> * Copyright (c) 2002-2007 Volkswagen Group Electronic Research * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Volkswagen nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * Alternatively, provided that this notice is retained in full, this * software may be distributed under the terms of the GNU General * Public License ("GPL") version 2, in which case the provisions of the * GPL apply INSTEAD OF those given above. * * The provided data structures and external interfaces from this code * are not restricted to be used by modules with a GPL compatible license. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ #ifndef _CAN_RAW_H #define _CAN_RAW_H #include <linux/can.h> #define SOL_CAN_RAW (SOL_CAN_BASE + CAN_RAW) /* for socket options affecting the socket (not the global system) */ enum { CAN_RAW_FILTER = 1, /* set 0 .. n can_filter(s) */ CAN_RAW_ERR_FILTER, /* set filter for error frames */ CAN_RAW_LOOPBACK, /* local loopback (default:on) */ CAN_RAW_RECV_OWN_MSGS, /* receive my own msgs (default:off) */ CAN_RAW_FD_FRAMES, /* allow CAN FD frames (default:off) */ CAN_RAW_JOIN_FILTERS, /* all filters must match to trigger */ }; #endif /* !_UAPI_CAN_RAW_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/ipc.h�����������������������������������������������������������������������������������������0000644�����������������00000004065�14763166027�0006650 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_IPC_H #define _LINUX_IPC_H #include <linux/types.h> #define IPC_PRIVATE ((__kernel_key_t) 0) /* Obsolete, used only for backwards compatibility and libc5 compiles */ struct ipc_perm { __kernel_key_t key; __kernel_uid_t uid; __kernel_gid_t gid; __kernel_uid_t cuid; __kernel_gid_t cgid; __kernel_mode_t mode; unsigned short seq; }; /* Include the definition of ipc64_perm */ #include <asm/ipcbuf.h> /* resource get request flags */ #define IPC_CREAT 00001000 /* create if key is nonexistent */ #define IPC_EXCL 00002000 /* fail if key exists */ #define IPC_NOWAIT 00004000 /* return error on wait */ /* these fields are used by the DIPC package so the kernel as standard should avoid using them if possible */ #define IPC_DIPC 00010000 /* make it distributed */ #define IPC_OWN 00020000 /* this machine is the DIPC owner */ /* * Control commands used with semctl, msgctl and shmctl * see also specific commands in sem.h, msg.h and shm.h */ #define IPC_RMID 0 /* remove resource */ #define IPC_SET 1 /* set ipc_perm options */ #define IPC_STAT 2 /* get ipc_perm options */ #define IPC_INFO 3 /* see ipcs */ /* * Version flags for semctl, msgctl, and shmctl commands * These are passed as bitflags or-ed with the actual command */ #define IPC_OLD 0 /* Old version (no 32-bit UID support on many architectures) */ #define IPC_64 0x0100 /* New version (support 32-bit UIDs, bigger message sizes, etc. */ /* * These are used to wrap system calls. * * See architecture code for ugly details.. */ struct ipc_kludge { struct msgbuf *msgp; long msgtyp; }; #define SEMOP 1 #define SEMGET 2 #define SEMCTL 3 #define SEMTIMEDOP 4 #define MSGSND 11 #define MSGRCV 12 #define MSGGET 13 #define MSGCTL 14 #define SHMAT 21 #define SHMDT 22 #define SHMGET 23 #define SHMCTL 24 /* Used by the DIPC package, try and avoid reusing it */ #define DIPC 25 #define IPCCALL(version,op) ((version)<<16 | (op)) #endif /* _LINUX_IPC_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/atm_tcp.h�������������������������������������������������������������������������������������0000644�����������������00000003126�14763166027�0007521 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atm_tcp.h - Driver-specific declarations of the ATMTCP driver (for use by driver-specific utilities) */ /* Written 1997-2000 by Werner Almesberger, EPFL LRC/ICA */ #ifndef LINUX_ATM_TCP_H #define LINUX_ATM_TCP_H #include <linux/atmapi.h> #include <linux/atm.h> #include <linux/atmioc.h> #include <linux/types.h> /* * All values in struct atmtcp_hdr are in network byte order */ struct atmtcp_hdr { __u16 vpi; __u16 vci; __u32 length; /* ... of data part */ }; /* * All values in struct atmtcp_command are in host byte order */ #define ATMTCP_HDR_MAGIC (~0) /* this length indicates a command */ #define ATMTCP_CTRL_OPEN 1 /* request/reply */ #define ATMTCP_CTRL_CLOSE 2 /* request/reply */ struct atmtcp_control { struct atmtcp_hdr hdr; /* must be first */ int type; /* message type; both directions */ atm_kptr_t vcc; /* both directions */ struct sockaddr_atmpvc addr; /* suggested value from kernel */ struct atm_qos qos; /* both directions */ int result; /* to kernel only */ } __ATM_API_ALIGN; /* * Field usage: * Messge type dir. hdr.v?i type addr qos vcc result * ----------- ---- ------- ---- ---- --- --- ------ * OPEN K->D Y Y Y Y Y 0 * OPEN D->K - Y Y Y Y Y * CLOSE K->D - - Y - Y 0 * CLOSE D->K - - - - Y Y */ #define SIOCSIFATMTCP _IO('a',ATMIOC_ITF) /* set ATMTCP mode */ #define ATMTCP_CREATE _IO('a',ATMIOC_ITF+14) /* create persistent ATMTCP interface */ #define ATMTCP_REMOVE _IO('a',ATMIOC_ITF+15) /* destroy persistent ATMTCP interface */ #endif /* LINUX_ATM_TCP_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/netfilter.h�����������������������������������������������������������������������������������0000644�����������������00000003434�14763166027�0010070 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_NETFILTER_H #define __LINUX_NETFILTER_H #include <linux/types.h> #include <linux/in.h> #include <linux/in6.h> /* Responses from hook functions. */ #define NF_DROP 0 #define NF_ACCEPT 1 #define NF_STOLEN 2 #define NF_QUEUE 3 #define NF_REPEAT 4 #define NF_STOP 5 /* Deprecated, for userspace nf_queue compatibility. */ #define NF_MAX_VERDICT NF_STOP /* we overload the higher bits for encoding auxiliary data such as the queue * number or errno values. Not nice, but better than additional function * arguments. */ #define NF_VERDICT_MASK 0x000000ff /* extra verdict flags have mask 0x0000ff00 */ #define NF_VERDICT_FLAG_QUEUE_BYPASS 0x00008000 /* queue number (NF_QUEUE) or errno (NF_DROP) */ #define NF_VERDICT_QMASK 0xffff0000 #define NF_VERDICT_QBITS 16 #define NF_QUEUE_NR(x) ((((x) << 16) & NF_VERDICT_QMASK) | NF_QUEUE) #define NF_DROP_ERR(x) (((-x) << 16) | NF_DROP) /* only for userspace compatibility */ /* Generic cache responses from hook functions. <= 0x2000 is used for protocol-flags. */ #define NFC_UNKNOWN 0x4000 #define NFC_ALTERED 0x8000 /* NF_VERDICT_BITS should be 8 now, but userspace might break if this changes */ #define NF_VERDICT_BITS 16 enum nf_inet_hooks { NF_INET_PRE_ROUTING, NF_INET_LOCAL_IN, NF_INET_FORWARD, NF_INET_LOCAL_OUT, NF_INET_POST_ROUTING, NF_INET_NUMHOOKS }; enum nf_dev_hooks { NF_NETDEV_INGRESS, NF_NETDEV_NUMHOOKS }; enum { NFPROTO_UNSPEC = 0, NFPROTO_INET = 1, NFPROTO_IPV4 = 2, NFPROTO_ARP = 3, NFPROTO_NETDEV = 5, NFPROTO_BRIDGE = 7, NFPROTO_IPV6 = 10, NFPROTO_DECNET = 12, NFPROTO_NUMPROTO, }; union nf_inet_addr { __u32 all[4]; __be32 ip; __be32 ip6[4]; struct in_addr in; struct in6_addr in6; }; #endif /* __LINUX_NETFILTER_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/if_frad.h�������������������������������������������������������������������������������������0000644�����������������00000005713�14763166027�0007470 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * DLCI/FRAD Definitions for Frame Relay Access Devices. DLCI devices are * created for each DLCI associated with a FRAD. The FRAD driver * is not truly a network device, but the lower level device * handler. This allows other FRAD manufacturers to use the DLCI * code, including its RFC1490 encapsulation alongside the current * implementation for the Sangoma cards. * * Version: @(#)if_ifrad.h 0.15 31 Mar 96 * * Author: Mike McLagan <mike.mclagan@linux.org> * * Changes: * 0.15 Mike McLagan changed structure defs (packed) * re-arranged flags * added DLCI_RET vars * * 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. */ #ifndef _FRAD_H_ #define _FRAD_H_ #include <linux/if.h> /* Structures and constants associated with the DLCI device driver */ struct dlci_add { char devname[IFNAMSIZ]; short dlci; }; #define DLCI_GET_CONF (SIOCDEVPRIVATE + 2) #define DLCI_SET_CONF (SIOCDEVPRIVATE + 3) /* * These are related to the Sangoma SDLA and should remain in order. * Code within the SDLA module is based on the specifics of this * structure. Change at your own peril. */ struct dlci_conf { short flags; short CIR_fwd; short Bc_fwd; short Be_fwd; short CIR_bwd; short Bc_bwd; short Be_bwd; /* these are part of the status read */ short Tc_fwd; short Tc_bwd; short Tf_max; short Tb_max; /* add any new fields here above is a mirror of sdla_dlci_conf */ }; #define DLCI_GET_SLAVE (SIOCDEVPRIVATE + 4) /* configuration flags for DLCI */ #define DLCI_IGNORE_CIR_OUT 0x0001 #define DLCI_ACCOUNT_CIR_IN 0x0002 #define DLCI_BUFFER_IF 0x0008 #define DLCI_VALID_FLAGS 0x000B /* defines for the actual Frame Relay hardware */ #define FRAD_GET_CONF (SIOCDEVPRIVATE) #define FRAD_SET_CONF (SIOCDEVPRIVATE + 1) #define FRAD_LAST_IOCTL FRAD_SET_CONF /* * Based on the setup for the Sangoma SDLA. If changes are * necessary to this structure, a routine will need to be * added to that module to copy fields. */ struct frad_conf { short station; short flags; short kbaud; short clocking; short mtu; short T391; short T392; short N391; short N392; short N393; short CIR_fwd; short Bc_fwd; short Be_fwd; short CIR_bwd; short Bc_bwd; short Be_bwd; /* Add new fields here, above is a mirror of the sdla_conf */ }; #define FRAD_STATION_CPE 0x0000 #define FRAD_STATION_NODE 0x0001 #define FRAD_TX_IGNORE_CIR 0x0001 #define FRAD_RX_ACCOUNT_CIR 0x0002 #define FRAD_DROP_ABORTED 0x0004 #define FRAD_BUFFERIF 0x0008 #define FRAD_STATS 0x0010 #define FRAD_MCI 0x0100 #define FRAD_AUTODLCI 0x8000 #define FRAD_VALID_FLAGS 0x811F #define FRAD_CLOCK_INT 0x0001 #define FRAD_CLOCK_EXT 0x0000 #endif /* _FRAD_H_ */ �����������������������������������������������������linux/tcp.h�����������������������������������������������������������������������������������������0000644�����������������00000022644�14763166027�0006666 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Definitions for the TCP protocol. * * Version: @(#)tcp.h 1.0.2 04/28/93 * * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * * 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. */ #ifndef _LINUX_TCP_H #define _LINUX_TCP_H #include <linux/types.h> #include <asm/byteorder.h> #include <linux/socket.h> struct tcphdr { __be16 source; __be16 dest; __be32 seq; __be32 ack_seq; #if defined(__LITTLE_ENDIAN_BITFIELD) __u16 res1:4, doff:4, fin:1, syn:1, rst:1, psh:1, ack:1, urg:1, ece:1, cwr:1; #elif defined(__BIG_ENDIAN_BITFIELD) __u16 doff:4, res1:4, cwr:1, ece:1, urg:1, ack:1, psh:1, rst:1, syn:1, fin:1; #else #error "Adjust your <asm/byteorder.h> defines" #endif __be16 window; __sum16 check; __be16 urg_ptr; }; /* * The union cast uses a gcc extension to avoid aliasing problems * (union is compatible to any of its members) * This means this part of the code is -fstrict-aliasing safe now. */ union tcp_word_hdr { struct tcphdr hdr; __be32 words[5]; }; #define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3]) enum { TCP_FLAG_CWR = __constant_cpu_to_be32(0x00800000), TCP_FLAG_ECE = __constant_cpu_to_be32(0x00400000), TCP_FLAG_URG = __constant_cpu_to_be32(0x00200000), TCP_FLAG_ACK = __constant_cpu_to_be32(0x00100000), TCP_FLAG_PSH = __constant_cpu_to_be32(0x00080000), TCP_FLAG_RST = __constant_cpu_to_be32(0x00040000), TCP_FLAG_SYN = __constant_cpu_to_be32(0x00020000), TCP_FLAG_FIN = __constant_cpu_to_be32(0x00010000), TCP_RESERVED_BITS = __constant_cpu_to_be32(0x0F000000), TCP_DATA_OFFSET = __constant_cpu_to_be32(0xF0000000) }; /* * TCP general constants */ #define TCP_MSS_DEFAULT 536U /* IPv4 (RFC1122, RFC2581) */ #define TCP_MSS_DESIRED 1220U /* IPv6 (tunneled), EDNS0 (RFC3226) */ /* TCP socket options */ #define TCP_NODELAY 1 /* Turn off Nagle's algorithm. */ #define TCP_MAXSEG 2 /* Limit MSS */ #define TCP_CORK 3 /* Never send partially complete segments */ #define TCP_KEEPIDLE 4 /* Start keeplives after this period */ #define TCP_KEEPINTVL 5 /* Interval between keepalives */ #define TCP_KEEPCNT 6 /* Number of keepalives before death */ #define TCP_SYNCNT 7 /* Number of SYN retransmits */ #define TCP_LINGER2 8 /* Life time of orphaned FIN-WAIT-2 state */ #define TCP_DEFER_ACCEPT 9 /* Wake up listener only when data arrive */ #define TCP_WINDOW_CLAMP 10 /* Bound advertised window */ #define TCP_INFO 11 /* Information about this connection. */ #define TCP_QUICKACK 12 /* Block/reenable quick acks */ #define TCP_CONGESTION 13 /* Congestion control algorithm */ #define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */ #define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/ #define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */ #define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */ #define TCP_REPAIR 19 /* TCP sock is under repair right now */ #define TCP_REPAIR_QUEUE 20 #define TCP_QUEUE_SEQ 21 #define TCP_REPAIR_OPTIONS 22 #define TCP_FASTOPEN 23 /* Enable FastOpen on listeners */ #define TCP_TIMESTAMP 24 #define TCP_NOTSENT_LOWAT 25 /* limit number of unsent bytes in write queue */ #define TCP_CC_INFO 26 /* Get Congestion Control (optional) info */ #define TCP_SAVE_SYN 27 /* Record SYN headers for new connections */ #define TCP_SAVED_SYN 28 /* Get SYN headers recorded for connection */ #define TCP_REPAIR_WINDOW 29 /* Get/set window parameters */ #define TCP_FASTOPEN_CONNECT 30 /* Attempt FastOpen with connect */ #define TCP_ULP 31 /* Attach a ULP to a TCP connection */ #define TCP_MD5SIG_EXT 32 /* TCP MD5 Signature with extensions */ #define TCP_FASTOPEN_KEY 33 /* Set the key for Fast Open (cookie) */ #define TCP_FASTOPEN_NO_COOKIE 34 /* Enable TFO without a TFO cookie */ #define TCP_ZEROCOPY_RECEIVE 35 #define TCP_INQ 36 /* Notify bytes available to read as a cmsg on read */ #define TCP_CM_INQ TCP_INQ #define TCP_REPAIR_ON 1 #define TCP_REPAIR_OFF 0 #define TCP_REPAIR_OFF_NO_WP -1 /* Turn off without window probes */ struct tcp_repair_opt { __u32 opt_code; __u32 opt_val; }; struct tcp_repair_window { __u32 snd_wl1; __u32 snd_wnd; __u32 max_window; __u32 rcv_wnd; __u32 rcv_wup; }; enum { TCP_NO_QUEUE, TCP_RECV_QUEUE, TCP_SEND_QUEUE, TCP_QUEUES_NR, }; /* for TCP_INFO socket option */ #define TCPI_OPT_TIMESTAMPS 1 #define TCPI_OPT_SACK 2 #define TCPI_OPT_WSCALE 4 #define TCPI_OPT_ECN 8 /* ECN was negociated at TCP session init */ #define TCPI_OPT_ECN_SEEN 16 /* we received at least one packet with ECT */ #define TCPI_OPT_SYN_DATA 32 /* SYN-ACK acked data in SYN sent or rcvd */ enum tcp_ca_state { TCP_CA_Open = 0, #define TCPF_CA_Open (1<<TCP_CA_Open) TCP_CA_Disorder = 1, #define TCPF_CA_Disorder (1<<TCP_CA_Disorder) TCP_CA_CWR = 2, #define TCPF_CA_CWR (1<<TCP_CA_CWR) TCP_CA_Recovery = 3, #define TCPF_CA_Recovery (1<<TCP_CA_Recovery) TCP_CA_Loss = 4 #define TCPF_CA_Loss (1<<TCP_CA_Loss) }; struct tcp_info { __u8 tcpi_state; __u8 tcpi_ca_state; __u8 tcpi_retransmits; __u8 tcpi_probes; __u8 tcpi_backoff; __u8 tcpi_options; __u8 tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4; __u8 tcpi_delivery_rate_app_limited:1; __u32 tcpi_rto; __u32 tcpi_ato; __u32 tcpi_snd_mss; __u32 tcpi_rcv_mss; __u32 tcpi_unacked; __u32 tcpi_sacked; __u32 tcpi_lost; __u32 tcpi_retrans; __u32 tcpi_fackets; /* Times. */ __u32 tcpi_last_data_sent; __u32 tcpi_last_ack_sent; /* Not remembered, sorry. */ __u32 tcpi_last_data_recv; __u32 tcpi_last_ack_recv; /* Metrics. */ __u32 tcpi_pmtu; __u32 tcpi_rcv_ssthresh; __u32 tcpi_rtt; __u32 tcpi_rttvar; __u32 tcpi_snd_ssthresh; __u32 tcpi_snd_cwnd; __u32 tcpi_advmss; __u32 tcpi_reordering; __u32 tcpi_rcv_rtt; __u32 tcpi_rcv_space; __u32 tcpi_total_retrans; __u64 tcpi_pacing_rate; __u64 tcpi_max_pacing_rate; __u64 tcpi_bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked */ __u64 tcpi_bytes_received; /* RFC4898 tcpEStatsAppHCThruOctetsReceived */ __u32 tcpi_segs_out; /* RFC4898 tcpEStatsPerfSegsOut */ __u32 tcpi_segs_in; /* RFC4898 tcpEStatsPerfSegsIn */ __u32 tcpi_notsent_bytes; __u32 tcpi_min_rtt; __u32 tcpi_data_segs_in; /* RFC4898 tcpEStatsDataSegsIn */ __u32 tcpi_data_segs_out; /* RFC4898 tcpEStatsDataSegsOut */ __u64 tcpi_delivery_rate; __u64 tcpi_busy_time; /* Time (usec) busy sending data */ __u64 tcpi_rwnd_limited; /* Time (usec) limited by receive window */ __u64 tcpi_sndbuf_limited; /* Time (usec) limited by send buffer */ __u32 tcpi_delivered; __u32 tcpi_delivered_ce; __u64 tcpi_bytes_sent; /* RFC4898 tcpEStatsPerfHCDataOctetsOut */ __u64 tcpi_bytes_retrans; /* RFC4898 tcpEStatsPerfOctetsRetrans */ __u32 tcpi_dsack_dups; /* RFC4898 tcpEStatsStackDSACKDups */ __u32 tcpi_reord_seen; /* reordering events seen */ }; /* netlink attributes types for SCM_TIMESTAMPING_OPT_STATS */ enum { TCP_NLA_PAD, TCP_NLA_BUSY, /* Time (usec) busy sending data */ TCP_NLA_RWND_LIMITED, /* Time (usec) limited by receive window */ TCP_NLA_SNDBUF_LIMITED, /* Time (usec) limited by send buffer */ TCP_NLA_DATA_SEGS_OUT, /* Data pkts sent including retransmission */ TCP_NLA_TOTAL_RETRANS, /* Data pkts retransmitted */ TCP_NLA_PACING_RATE, /* Pacing rate in bytes per second */ TCP_NLA_DELIVERY_RATE, /* Delivery rate in bytes per second */ TCP_NLA_SND_CWND, /* Sending congestion window */ TCP_NLA_REORDERING, /* Reordering metric */ TCP_NLA_MIN_RTT, /* minimum RTT */ TCP_NLA_RECUR_RETRANS, /* Recurring retransmits for the current pkt */ TCP_NLA_DELIVERY_RATE_APP_LMT, /* delivery rate application limited ? */ TCP_NLA_SNDQ_SIZE, /* Data (bytes) pending in send queue */ TCP_NLA_CA_STATE, /* ca_state of socket */ TCP_NLA_SND_SSTHRESH, /* Slow start size threshold */ TCP_NLA_DELIVERED, /* Data pkts delivered incl. out-of-order */ TCP_NLA_DELIVERED_CE, /* Like above but only ones w/ CE marks */ TCP_NLA_BYTES_SENT, /* Data bytes sent including retransmission */ TCP_NLA_BYTES_RETRANS, /* Data bytes retransmitted */ TCP_NLA_DSACK_DUPS, /* DSACK blocks received */ TCP_NLA_REORD_SEEN, /* reordering events seen */ }; /* for TCP_MD5SIG socket option */ #define TCP_MD5SIG_MAXKEYLEN 80 /* tcp_md5sig extension flags for TCP_MD5SIG_EXT */ #define TCP_MD5SIG_FLAG_PREFIX 1 /* address prefix length */ struct tcp_md5sig { struct __kernel_sockaddr_storage tcpm_addr; /* address associated */ __u8 tcpm_flags; /* extension flags */ __u8 tcpm_prefixlen; /* address prefix */ __u16 tcpm_keylen; /* key length */ __u32 __tcpm_pad; /* zero */ __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* key (binary) */ }; /* INET_DIAG_MD5SIG */ struct tcp_diag_md5sig { __u8 tcpm_family; __u8 tcpm_prefixlen; __u16 tcpm_keylen; __be32 tcpm_addr[4]; __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; }; /* setsockopt(fd, IPPROTO_TCP, TCP_ZEROCOPY_RECEIVE, ...) */ struct tcp_zerocopy_receive { __u64 address; /* in: address of mapping */ __u32 length; /* in/out: number of bytes to map/mapped */ __u32 recv_skip_hint; /* out: amount of bytes to skip */ }; #endif /* _LINUX_TCP_H */ ��������������������������������������������������������������������������������������������linux/virtio_config.h�������������������������������������������������������������������������������0000644�����������������00000006751�14763166027�0010742 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _LINUX_VIRTIO_CONFIG_H #define _LINUX_VIRTIO_CONFIG_H /* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so * anyone can use the definitions to implement compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /* Virtio devices use a standardized configuration space to define their * features and pass configuration information, but each implementation can * store and access that space differently. */ #include <linux/types.h> /* Status byte for guest to report progress, and synchronize features. */ /* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */ #define VIRTIO_CONFIG_S_ACKNOWLEDGE 1 /* We have found a driver for the device. */ #define VIRTIO_CONFIG_S_DRIVER 2 /* Driver has used its parts of the config, and is happy */ #define VIRTIO_CONFIG_S_DRIVER_OK 4 /* Driver has finished configuring features */ #define VIRTIO_CONFIG_S_FEATURES_OK 8 /* Device entered invalid state, driver must reset it */ #define VIRTIO_CONFIG_S_NEEDS_RESET 0x40 /* We've given up on this device. */ #define VIRTIO_CONFIG_S_FAILED 0x80 /* * Virtio feature bits VIRTIO_TRANSPORT_F_START through * VIRTIO_TRANSPORT_F_END are reserved for the transport * being used (e.g. virtio_ring, virtio_pci etc.), the * rest are per-device feature bits. */ #define VIRTIO_TRANSPORT_F_START 28 #define VIRTIO_TRANSPORT_F_END 38 #ifndef VIRTIO_CONFIG_NO_LEGACY /* Do we get callbacks when the ring is completely used, even if we've * suppressed them? */ #define VIRTIO_F_NOTIFY_ON_EMPTY 24 /* Can the device handle any descriptor layout? */ #define VIRTIO_F_ANY_LAYOUT 27 #endif /* VIRTIO_CONFIG_NO_LEGACY */ /* v1.0 compliant. */ #define VIRTIO_F_VERSION_1 32 /* * If clear - device has the IOMMU bypass quirk feature. * If set - use platform tools to detect the IOMMU. * * Note the reverse polarity (compared to most other features), * this is for compatibility with legacy systems. */ #define VIRTIO_F_IOMMU_PLATFORM 33 /* * Does the device support Single Root I/O Virtualization? */ #define VIRTIO_F_SR_IOV 37 #endif /* _LINUX_VIRTIO_CONFIG_H */ �����������������������linux/thermal.h�������������������������������������������������������������������������������������0000644�����������������00000001634�14763166027�0007530 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_THERMAL_H #define _LINUX_THERMAL_H #define THERMAL_NAME_LENGTH 20 /* Adding event notification support elements */ #define THERMAL_GENL_FAMILY_NAME "thermal_event" #define THERMAL_GENL_VERSION 0x01 #define THERMAL_GENL_MCAST_GROUP_NAME "thermal_mc_grp" /* Events supported by Thermal Netlink */ enum events { THERMAL_AUX0, THERMAL_AUX1, THERMAL_CRITICAL, THERMAL_DEV_FAULT, }; /* attributes of thermal_genl_family */ enum { THERMAL_GENL_ATTR_UNSPEC, THERMAL_GENL_ATTR_EVENT, __THERMAL_GENL_ATTR_MAX, }; #define THERMAL_GENL_ATTR_MAX (__THERMAL_GENL_ATTR_MAX - 1) /* commands supported by the thermal_genl_family */ enum { THERMAL_GENL_CMD_UNSPEC, THERMAL_GENL_CMD_EVENT, __THERMAL_GENL_CMD_MAX, }; #define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1) #endif /* _LINUX_THERMAL_H */ ����������������������������������������������������������������������������������������������������linux/hidraw.h��������������������������������������������������������������������������������������0000644�����������������00000002747�14763166027�0007360 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (c) 2007 Jiri Kosina */ /* * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * 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., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef _HIDRAW_H #define _HIDRAW_H #include <linux/hid.h> #include <linux/types.h> struct hidraw_report_descriptor { __u32 size; __u8 value[HID_MAX_DESCRIPTOR_SIZE]; }; struct hidraw_devinfo { __u32 bustype; __s16 vendor; __s16 product; }; /* ioctl interface */ #define HIDIOCGRDESCSIZE _IOR('H', 0x01, int) #define HIDIOCGRDESC _IOR('H', 0x02, struct hidraw_report_descriptor) #define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo) #define HIDIOCGRAWNAME(len) _IOC(_IOC_READ, 'H', 0x04, len) #define HIDIOCGRAWPHYS(len) _IOC(_IOC_READ, 'H', 0x05, len) /* The first byte of SFEATURE and GFEATURE is the report number */ #define HIDIOCSFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len) #define HIDIOCGFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len) #define HIDRAW_FIRST_MINOR 0 #define HIDRAW_MAX_DEVICES 64 /* number of reports to buffer */ #define HIDRAW_BUFFER_SIZE 64 /* kernel-only API declarations */ #endif /* _HIDRAW_H */ �������������������������linux/nfs_idmap.h�����������������������������������������������������������������������������������0000644�����������������00000004303�14763166027�0010030 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * include/uapi/linux/nfs_idmap.h * * UID and GID to name mapping for clients. * * Copyright (c) 2002 The Regents of the University of Michigan. * All rights reserved. * * Marius Aamodt Eriksen <marius@umich.edu> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef NFS_IDMAP_H #define NFS_IDMAP_H #include <linux/types.h> /* XXX from bits/utmp.h */ #define IDMAP_NAMESZ 128 #define IDMAP_TYPE_USER 0 #define IDMAP_TYPE_GROUP 1 #define IDMAP_CONV_IDTONAME 0 #define IDMAP_CONV_NAMETOID 1 #define IDMAP_STATUS_INVALIDMSG 0x01 #define IDMAP_STATUS_AGAIN 0x02 #define IDMAP_STATUS_LOOKUPFAIL 0x04 #define IDMAP_STATUS_SUCCESS 0x08 struct idmap_msg { __u8 im_type; __u8 im_conv; char im_name[IDMAP_NAMESZ]; __u32 im_id; __u8 im_status; }; #endif /* NFS_IDMAP_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/nfs.h�����������������������������������������������������������������������������������������0000644�����������������00000010624�14763166027�0006661 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * NFS protocol definitions * * This file contains constants mostly for Version 2 of the protocol, * but also has a couple of NFSv3 bits in (notably the error codes). */ #ifndef _LINUX_NFS_H #define _LINUX_NFS_H #include <linux/types.h> #define NFS_PROGRAM 100003 #define NFS_PORT 2049 #define NFS_RDMA_PORT 20049 #define NFS_MAXDATA 8192 #define NFS_MAXPATHLEN 1024 #define NFS_MAXNAMLEN 255 #define NFS_MAXGROUPS 16 #define NFS_FHSIZE 32 #define NFS_COOKIESIZE 4 #define NFS_FIFO_DEV (-1) #define NFSMODE_FMT 0170000 #define NFSMODE_DIR 0040000 #define NFSMODE_CHR 0020000 #define NFSMODE_BLK 0060000 #define NFSMODE_REG 0100000 #define NFSMODE_LNK 0120000 #define NFSMODE_SOCK 0140000 #define NFSMODE_FIFO 0010000 #define NFS_MNT_PROGRAM 100005 #define NFS_MNT_VERSION 1 #define NFS_MNT3_VERSION 3 #define NFS_PIPE_DIRNAME "nfs" /* * NFS stats. The good thing with these values is that NFSv3 errors are * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which * no-one uses anyway), so we can happily mix code as long as we make sure * no NFSv3 errors are returned to NFSv2 clients. * Error codes that have a `--' in the v2 column are not part of the * standard, but seem to be widely used nevertheless. */ enum nfs_stat { NFS_OK = 0, /* v2 v3 v4 */ NFSERR_PERM = 1, /* v2 v3 v4 */ NFSERR_NOENT = 2, /* v2 v3 v4 */ NFSERR_IO = 5, /* v2 v3 v4 */ NFSERR_NXIO = 6, /* v2 v3 v4 */ NFSERR_EAGAIN = 11, /* v2 v3 */ NFSERR_ACCES = 13, /* v2 v3 v4 */ NFSERR_EXIST = 17, /* v2 v3 v4 */ NFSERR_XDEV = 18, /* v3 v4 */ NFSERR_NODEV = 19, /* v2 v3 v4 */ NFSERR_NOTDIR = 20, /* v2 v3 v4 */ NFSERR_ISDIR = 21, /* v2 v3 v4 */ NFSERR_INVAL = 22, /* v2 v3 v4 */ NFSERR_FBIG = 27, /* v2 v3 v4 */ NFSERR_NOSPC = 28, /* v2 v3 v4 */ NFSERR_ROFS = 30, /* v2 v3 v4 */ NFSERR_MLINK = 31, /* v3 v4 */ NFSERR_OPNOTSUPP = 45, /* v2 v3 */ NFSERR_NAMETOOLONG = 63, /* v2 v3 v4 */ NFSERR_NOTEMPTY = 66, /* v2 v3 v4 */ NFSERR_DQUOT = 69, /* v2 v3 v4 */ NFSERR_STALE = 70, /* v2 v3 v4 */ NFSERR_REMOTE = 71, /* v2 v3 */ NFSERR_WFLUSH = 99, /* v2 */ NFSERR_BADHANDLE = 10001, /* v3 v4 */ NFSERR_NOT_SYNC = 10002, /* v3 */ NFSERR_BAD_COOKIE = 10003, /* v3 v4 */ NFSERR_NOTSUPP = 10004, /* v3 v4 */ NFSERR_TOOSMALL = 10005, /* v3 v4 */ NFSERR_SERVERFAULT = 10006, /* v3 v4 */ NFSERR_BADTYPE = 10007, /* v3 v4 */ NFSERR_JUKEBOX = 10008, /* v3 v4 */ NFSERR_SAME = 10009, /* v4 */ NFSERR_DENIED = 10010, /* v4 */ NFSERR_EXPIRED = 10011, /* v4 */ NFSERR_LOCKED = 10012, /* v4 */ NFSERR_GRACE = 10013, /* v4 */ NFSERR_FHEXPIRED = 10014, /* v4 */ NFSERR_SHARE_DENIED = 10015, /* v4 */ NFSERR_WRONGSEC = 10016, /* v4 */ NFSERR_CLID_INUSE = 10017, /* v4 */ NFSERR_RESOURCE = 10018, /* v4 */ NFSERR_MOVED = 10019, /* v4 */ NFSERR_NOFILEHANDLE = 10020, /* v4 */ NFSERR_MINOR_VERS_MISMATCH = 10021, /* v4 */ NFSERR_STALE_CLIENTID = 10022, /* v4 */ NFSERR_STALE_STATEID = 10023, /* v4 */ NFSERR_OLD_STATEID = 10024, /* v4 */ NFSERR_BAD_STATEID = 10025, /* v4 */ NFSERR_BAD_SEQID = 10026, /* v4 */ NFSERR_NOT_SAME = 10027, /* v4 */ NFSERR_LOCK_RANGE = 10028, /* v4 */ NFSERR_SYMLINK = 10029, /* v4 */ NFSERR_RESTOREFH = 10030, /* v4 */ NFSERR_LEASE_MOVED = 10031, /* v4 */ NFSERR_ATTRNOTSUPP = 10032, /* v4 */ NFSERR_NO_GRACE = 10033, /* v4 */ NFSERR_RECLAIM_BAD = 10034, /* v4 */ NFSERR_RECLAIM_CONFLICT = 10035,/* v4 */ NFSERR_BAD_XDR = 10036, /* v4 */ NFSERR_LOCKS_HELD = 10037, /* v4 */ NFSERR_OPENMODE = 10038, /* v4 */ NFSERR_BADOWNER = 10039, /* v4 */ NFSERR_BADCHAR = 10040, /* v4 */ NFSERR_BADNAME = 10041, /* v4 */ NFSERR_BAD_RANGE = 10042, /* v4 */ NFSERR_LOCK_NOTSUPP = 10043, /* v4 */ NFSERR_OP_ILLEGAL = 10044, /* v4 */ NFSERR_DEADLOCK = 10045, /* v4 */ NFSERR_FILE_OPEN = 10046, /* v4 */ NFSERR_ADMIN_REVOKED = 10047, /* v4 */ NFSERR_CB_PATH_DOWN = 10048, /* v4 */ }; /* NFSv2 file types - beware, these are not the same in NFSv3 */ enum nfs_ftype { NFNON = 0, NFREG = 1, NFDIR = 2, NFBLK = 3, NFCHR = 4, NFLNK = 5, NFSOCK = 6, NFBAD = 7, NFFIFO = 8 }; #endif /* _LINUX_NFS_H */ ������������������������������������������������������������������������������������������������������������linux/cycx_cfm.h������������������������������������������������������������������������������������0000644�����������������00000005656�14763166027�0007677 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * cycx_cfm.h Cyclom 2X WAN Link Driver. * Definitions for the Cyclom 2X Firmware Module (CFM). * * Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br> * * Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo * * Based on sdlasfm.h by Gene Kozin <74604.152@compuserve.com> * * 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. * ============================================================================ * 1998/08/08 acme Initial version. */ #ifndef _CYCX_CFM_H #define _CYCX_CFM_H /* Defines */ #define CFM_VERSION 2 #define CFM_SIGNATURE "CFM - Cyclades CYCX Firmware Module" /* min/max */ #define CFM_IMAGE_SIZE 0x20000 /* max size of CYCX code image file */ #define CFM_DESCR_LEN 256 /* max length of description string */ #define CFM_MAX_CYCX 1 /* max number of compatible adapters */ #define CFM_LOAD_BUFSZ 0x400 /* buffer size for reset code (buffer_load) */ /* Firmware Commands */ #define GEN_POWER_ON 0x1280 #define GEN_SET_SEG 0x1401 /* boot segment setting. */ #define GEN_BOOT_DAT 0x1402 /* boot data. */ #define GEN_START 0x1403 /* board start. */ #define GEN_DEFPAR 0x1404 /* buffer length for boot. */ /* Adapter Types */ #define CYCX_2X 2 /* for now only the 2X is supported, no plans to support 8X or 16X */ #define CYCX_8X 8 #define CYCX_16X 16 #define CFID_X25_2X 5200 /** * struct cycx_fw_info - firmware module information. * @codeid - firmware ID * @version - firmware version number * @adapter - compatible adapter types * @memsize - minimum memory size * @reserved - reserved * @startoffs - entry point offset * @winoffs - dual-port memory window offset * @codeoffs - code load offset * @codesize - code size * @dataoffs - configuration data load offset * @datasize - configuration data size */ struct cycx_fw_info { unsigned short codeid; unsigned short version; unsigned short adapter[CFM_MAX_CYCX]; unsigned long memsize; unsigned short reserved[2]; unsigned short startoffs; unsigned short winoffs; unsigned short codeoffs; unsigned long codesize; unsigned short dataoffs; unsigned long datasize; }; /** * struct cycx_firmware - CYCX firmware file structure * @signature - CFM file signature * @version - file format version * @checksum - info + image * @reserved - reserved * @descr - description string * @info - firmware module info * @image - code image (variable size) */ struct cycx_firmware { char signature[80]; unsigned short version; unsigned short checksum; unsigned short reserved[6]; char descr[CFM_DESCR_LEN]; struct cycx_fw_info info; unsigned char image[0]; }; struct cycx_fw_header { unsigned long reset_size; unsigned long data_size; unsigned long code_size; }; #endif /* _CYCX_CFM_H */ ����������������������������������������������������������������������������������linux/rio_mport_cdev.h������������������������������������������������������������������������������0000644�����������������00000022162�14763166027�0011106 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * Copyright (c) 2015-2016, Integrated Device Technology Inc. * Copyright (c) 2015, Prodrive Technologies * Copyright (c) 2015, Texas Instruments Incorporated * Copyright (c) 2015, RapidIO Trade Association * All rights reserved. * * This software is available to you under a choice of one of two licenses. * You may choose to be licensed under the terms of the GNU General Public * License(GPL) Version 2, or the BSD-3 Clause license below: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors * may be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RIO_MPORT_CDEV_H_ #define _RIO_MPORT_CDEV_H_ #include <linux/ioctl.h> #include <linux/types.h> struct rio_mport_maint_io { __u16 rioid; /* destID of remote device */ __u8 hopcount; /* hopcount to remote device */ __u8 pad0[5]; __u32 offset; /* offset in register space */ __u32 length; /* length in bytes */ __u64 buffer; /* pointer to data buffer */ }; /* * Definitions for RapidIO data transfers: * - memory mapped (MAPPED) * - packet generation from memory (TRANSFER) */ #define RIO_TRANSFER_MODE_MAPPED (1 << 0) #define RIO_TRANSFER_MODE_TRANSFER (1 << 1) #define RIO_CAP_DBL_SEND (1 << 2) #define RIO_CAP_DBL_RECV (1 << 3) #define RIO_CAP_PW_SEND (1 << 4) #define RIO_CAP_PW_RECV (1 << 5) #define RIO_CAP_MAP_OUTB (1 << 6) #define RIO_CAP_MAP_INB (1 << 7) struct rio_mport_properties { __u16 hdid; __u8 id; /* Physical port ID */ __u8 index; __u32 flags; __u32 sys_size; /* Default addressing size */ __u8 port_ok; __u8 link_speed; __u8 link_width; __u8 pad0; __u32 dma_max_sge; __u32 dma_max_size; __u32 dma_align; __u32 transfer_mode; /* Default transfer mode */ __u32 cap_sys_size; /* Capable system sizes */ __u32 cap_addr_size; /* Capable addressing sizes */ __u32 cap_transfer_mode; /* Capable transfer modes */ __u32 cap_mport; /* Mport capabilities */ }; /* * Definitions for RapidIO events; * - incoming port-writes * - incoming doorbells */ #define RIO_DOORBELL (1 << 0) #define RIO_PORTWRITE (1 << 1) struct rio_doorbell { __u16 rioid; __u16 payload; }; struct rio_doorbell_filter { __u16 rioid; /* Use RIO_INVALID_DESTID to match all ids */ __u16 low; __u16 high; __u16 pad0; }; struct rio_portwrite { __u32 payload[16]; }; struct rio_pw_filter { __u32 mask; __u32 low; __u32 high; __u32 pad0; }; /* RapidIO base address for inbound requests set to value defined below * indicates that no specific RIO-to-local address translation is requested * and driver should use direct (one-to-one) address mapping. */ #define RIO_MAP_ANY_ADDR (__u64)(~((__u64) 0)) struct rio_mmap { __u16 rioid; __u16 pad0[3]; __u64 rio_addr; __u64 length; __u64 handle; __u64 address; }; struct rio_dma_mem { __u64 length; /* length of DMA memory */ __u64 dma_handle; /* handle associated with this memory */ __u64 address; }; struct rio_event { __u32 header; /* event type RIO_DOORBELL or RIO_PORTWRITE */ union { struct rio_doorbell doorbell; /* header for RIO_DOORBELL */ struct rio_portwrite portwrite; /* header for RIO_PORTWRITE */ } u; __u32 pad0; }; enum rio_transfer_sync { RIO_TRANSFER_SYNC, /* synchronous transfer */ RIO_TRANSFER_ASYNC, /* asynchronous transfer */ RIO_TRANSFER_FAF, /* fire-and-forget transfer */ }; enum rio_transfer_dir { RIO_TRANSFER_DIR_READ, /* Read operation */ RIO_TRANSFER_DIR_WRITE, /* Write operation */ }; /* * RapidIO data exchange transactions are lists of individual transfers. Each * transfer exchanges data between two RapidIO devices by remote direct memory * access and has its own completion code. * * The RapidIO specification defines four types of data exchange requests: * NREAD, NWRITE, SWRITE and NWRITE_R. The RapidIO DMA channel interface allows * to specify the required type of write operation or combination of them when * only the last data packet requires response. * * NREAD: read up to 256 bytes from remote device memory into local memory * NWRITE: write up to 256 bytes from local memory to remote device memory * without confirmation * SWRITE: as NWRITE, but all addresses and payloads must be 64-bit aligned * NWRITE_R: as NWRITE, but expect acknowledgment from remote device. * * The default exchange is chosen from NREAD and any of the WRITE modes as the * driver sees fit. For write requests the user can explicitly choose between * any of the write modes for each transaction. */ enum rio_exchange { RIO_EXCHANGE_DEFAULT, /* Default method */ RIO_EXCHANGE_NWRITE, /* All packets using NWRITE */ RIO_EXCHANGE_SWRITE, /* All packets using SWRITE */ RIO_EXCHANGE_NWRITE_R, /* Last packet NWRITE_R, others NWRITE */ RIO_EXCHANGE_SWRITE_R, /* Last packet NWRITE_R, others SWRITE */ RIO_EXCHANGE_NWRITE_R_ALL, /* All packets using NWRITE_R */ }; struct rio_transfer_io { __u64 rio_addr; /* Address in target's RIO mem space */ __u64 loc_addr; __u64 handle; __u64 offset; /* Offset in buffer */ __u64 length; /* Length in bytes */ __u16 rioid; /* Target destID */ __u16 method; /* Data exchange method, one of rio_exchange enum */ __u32 completion_code; /* Completion code for this transfer */ }; struct rio_transaction { __u64 block; /* Pointer to array of <count> transfers */ __u32 count; /* Number of transfers */ __u32 transfer_mode; /* Data transfer mode */ __u16 sync; /* Synch method, one of rio_transfer_sync enum */ __u16 dir; /* Transfer direction, one of rio_transfer_dir enum */ __u32 pad0; }; struct rio_async_tx_wait { __u32 token; /* DMA transaction ID token */ __u32 timeout; /* Wait timeout in msec, if 0 use default TO */ }; #define RIO_MAX_DEVNAME_SZ 20 struct rio_rdev_info { __u16 destid; __u8 hopcount; __u8 pad0; __u32 comptag; char name[RIO_MAX_DEVNAME_SZ + 1]; }; /* Driver IOCTL codes */ #define RIO_MPORT_DRV_MAGIC 'm' #define RIO_MPORT_MAINT_HDID_SET \ _IOW(RIO_MPORT_DRV_MAGIC, 1, __u16) #define RIO_MPORT_MAINT_COMPTAG_SET \ _IOW(RIO_MPORT_DRV_MAGIC, 2, __u32) #define RIO_MPORT_MAINT_PORT_IDX_GET \ _IOR(RIO_MPORT_DRV_MAGIC, 3, __u32) #define RIO_MPORT_GET_PROPERTIES \ _IOR(RIO_MPORT_DRV_MAGIC, 4, struct rio_mport_properties) #define RIO_MPORT_MAINT_READ_LOCAL \ _IOR(RIO_MPORT_DRV_MAGIC, 5, struct rio_mport_maint_io) #define RIO_MPORT_MAINT_WRITE_LOCAL \ _IOW(RIO_MPORT_DRV_MAGIC, 6, struct rio_mport_maint_io) #define RIO_MPORT_MAINT_READ_REMOTE \ _IOR(RIO_MPORT_DRV_MAGIC, 7, struct rio_mport_maint_io) #define RIO_MPORT_MAINT_WRITE_REMOTE \ _IOW(RIO_MPORT_DRV_MAGIC, 8, struct rio_mport_maint_io) #define RIO_ENABLE_DOORBELL_RANGE \ _IOW(RIO_MPORT_DRV_MAGIC, 9, struct rio_doorbell_filter) #define RIO_DISABLE_DOORBELL_RANGE \ _IOW(RIO_MPORT_DRV_MAGIC, 10, struct rio_doorbell_filter) #define RIO_ENABLE_PORTWRITE_RANGE \ _IOW(RIO_MPORT_DRV_MAGIC, 11, struct rio_pw_filter) #define RIO_DISABLE_PORTWRITE_RANGE \ _IOW(RIO_MPORT_DRV_MAGIC, 12, struct rio_pw_filter) #define RIO_SET_EVENT_MASK \ _IOW(RIO_MPORT_DRV_MAGIC, 13, __u32) #define RIO_GET_EVENT_MASK \ _IOR(RIO_MPORT_DRV_MAGIC, 14, __u32) #define RIO_MAP_OUTBOUND \ _IOWR(RIO_MPORT_DRV_MAGIC, 15, struct rio_mmap) #define RIO_UNMAP_OUTBOUND \ _IOW(RIO_MPORT_DRV_MAGIC, 16, struct rio_mmap) #define RIO_MAP_INBOUND \ _IOWR(RIO_MPORT_DRV_MAGIC, 17, struct rio_mmap) #define RIO_UNMAP_INBOUND \ _IOW(RIO_MPORT_DRV_MAGIC, 18, __u64) #define RIO_ALLOC_DMA \ _IOWR(RIO_MPORT_DRV_MAGIC, 19, struct rio_dma_mem) #define RIO_FREE_DMA \ _IOW(RIO_MPORT_DRV_MAGIC, 20, __u64) #define RIO_TRANSFER \ _IOWR(RIO_MPORT_DRV_MAGIC, 21, struct rio_transaction) #define RIO_WAIT_FOR_ASYNC \ _IOW(RIO_MPORT_DRV_MAGIC, 22, struct rio_async_tx_wait) #define RIO_DEV_ADD \ _IOW(RIO_MPORT_DRV_MAGIC, 23, struct rio_rdev_info) #define RIO_DEV_DEL \ _IOW(RIO_MPORT_DRV_MAGIC, 24, struct rio_rdev_info) #endif /* _RIO_MPORT_CDEV_H_ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/packet_diag.h���������������������������������������������������������������������������������0000644�����������������00000003210�14763166027�0010317 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __PACKET_DIAG_H__ #define __PACKET_DIAG_H__ #include <linux/types.h> struct packet_diag_req { __u8 sdiag_family; __u8 sdiag_protocol; __u16 pad; __u32 pdiag_ino; __u32 pdiag_show; __u32 pdiag_cookie[2]; }; #define PACKET_SHOW_INFO 0x00000001 /* Basic packet_sk information */ #define PACKET_SHOW_MCLIST 0x00000002 /* A set of packet_diag_mclist-s */ #define PACKET_SHOW_RING_CFG 0x00000004 /* Rings configuration parameters */ #define PACKET_SHOW_FANOUT 0x00000008 #define PACKET_SHOW_MEMINFO 0x00000010 #define PACKET_SHOW_FILTER 0x00000020 struct packet_diag_msg { __u8 pdiag_family; __u8 pdiag_type; __u16 pdiag_num; __u32 pdiag_ino; __u32 pdiag_cookie[2]; }; enum { /* PACKET_DIAG_NONE, standard nl API requires this attribute! */ PACKET_DIAG_INFO, PACKET_DIAG_MCLIST, PACKET_DIAG_RX_RING, PACKET_DIAG_TX_RING, PACKET_DIAG_FANOUT, PACKET_DIAG_UID, PACKET_DIAG_MEMINFO, PACKET_DIAG_FILTER, __PACKET_DIAG_MAX, }; #define PACKET_DIAG_MAX (__PACKET_DIAG_MAX - 1) struct packet_diag_info { __u32 pdi_index; __u32 pdi_version; __u32 pdi_reserve; __u32 pdi_copy_thresh; __u32 pdi_tstamp; __u32 pdi_flags; #define PDI_RUNNING 0x1 #define PDI_AUXDATA 0x2 #define PDI_ORIGDEV 0x4 #define PDI_VNETHDR 0x8 #define PDI_LOSS 0x10 }; struct packet_diag_mclist { __u32 pdmc_index; __u32 pdmc_count; __u16 pdmc_type; __u16 pdmc_alen; __u8 pdmc_addr[32]; /* MAX_ADDR_LEN */ }; struct packet_diag_ring { __u32 pdr_block_size; __u32 pdr_block_nr; __u32 pdr_frame_size; __u32 pdr_frame_nr; __u32 pdr_retire_tmo; __u32 pdr_sizeof_priv; __u32 pdr_features; }; #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/net_tstamp.h����������������������������������������������������������������������������������0000644�����������������00000011462�14763166027�0010252 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Userspace API for hardware time stamping of network packets * * Copyright (C) 2008,2009 Intel Corporation * Author: Patrick Ohly <patrick.ohly@intel.com> * */ #ifndef _NET_TIMESTAMPING_H #define _NET_TIMESTAMPING_H #include <linux/types.h> #include <linux/socket.h> /* for SO_TIMESTAMPING */ /* SO_TIMESTAMPING gets an integer bit field comprised of these values */ enum { SOF_TIMESTAMPING_TX_HARDWARE = (1<<0), SOF_TIMESTAMPING_TX_SOFTWARE = (1<<1), SOF_TIMESTAMPING_RX_HARDWARE = (1<<2), SOF_TIMESTAMPING_RX_SOFTWARE = (1<<3), SOF_TIMESTAMPING_SOFTWARE = (1<<4), SOF_TIMESTAMPING_SYS_HARDWARE = (1<<5), SOF_TIMESTAMPING_RAW_HARDWARE = (1<<6), SOF_TIMESTAMPING_OPT_ID = (1<<7), SOF_TIMESTAMPING_TX_SCHED = (1<<8), SOF_TIMESTAMPING_TX_ACK = (1<<9), SOF_TIMESTAMPING_OPT_CMSG = (1<<10), SOF_TIMESTAMPING_OPT_TSONLY = (1<<11), SOF_TIMESTAMPING_OPT_STATS = (1<<12), SOF_TIMESTAMPING_OPT_PKTINFO = (1<<13), SOF_TIMESTAMPING_OPT_TX_SWHW = (1<<14), SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_OPT_TX_SWHW, SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) | SOF_TIMESTAMPING_LAST }; /* * SO_TIMESTAMPING flags are either for recording a packet timestamp or for * reporting the timestamp to user space. * Recording flags can be set both via socket options and control messages. */ #define SOF_TIMESTAMPING_TX_RECORD_MASK (SOF_TIMESTAMPING_TX_HARDWARE | \ SOF_TIMESTAMPING_TX_SOFTWARE | \ SOF_TIMESTAMPING_TX_SCHED | \ SOF_TIMESTAMPING_TX_ACK) /** * struct hwtstamp_config - %SIOCGHWTSTAMP and %SIOCSHWTSTAMP parameter * * @flags: no flags defined right now, must be zero for %SIOCSHWTSTAMP * @tx_type: one of HWTSTAMP_TX_* * @rx_filter: one of HWTSTAMP_FILTER_* * * %SIOCGHWTSTAMP and %SIOCSHWTSTAMP expect a &struct ifreq with a * ifr_data pointer to this structure. For %SIOCSHWTSTAMP, if the * driver or hardware does not support the requested @rx_filter value, * the driver may use a more general filter mode. In this case * @rx_filter will indicate the actual mode on return. */ struct hwtstamp_config { int flags; int tx_type; int rx_filter; }; /* possible values for hwtstamp_config->tx_type */ enum hwtstamp_tx_types { /* * No outgoing packet will need hardware time stamping; * should a packet arrive which asks for it, no hardware * time stamping will be done. */ HWTSTAMP_TX_OFF, /* * Enables hardware time stamping for outgoing packets; * the sender of the packet decides which are to be * time stamped by setting %SOF_TIMESTAMPING_TX_SOFTWARE * before sending the packet. */ HWTSTAMP_TX_ON, /* * Enables time stamping for outgoing packets just as * HWTSTAMP_TX_ON does, but also enables time stamp insertion * directly into Sync packets. In this case, transmitted Sync * packets will not received a time stamp via the socket error * queue. */ HWTSTAMP_TX_ONESTEP_SYNC, }; /* possible values for hwtstamp_config->rx_filter */ enum hwtstamp_rx_filters { /* time stamp no incoming packet at all */ HWTSTAMP_FILTER_NONE, /* time stamp any incoming packet */ HWTSTAMP_FILTER_ALL, /* return value: time stamp all packets requested plus some others */ HWTSTAMP_FILTER_SOME, /* PTP v1, UDP, any kind of event packet */ HWTSTAMP_FILTER_PTP_V1_L4_EVENT, /* PTP v1, UDP, Sync packet */ HWTSTAMP_FILTER_PTP_V1_L4_SYNC, /* PTP v1, UDP, Delay_req packet */ HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ, /* PTP v2, UDP, any kind of event packet */ HWTSTAMP_FILTER_PTP_V2_L4_EVENT, /* PTP v2, UDP, Sync packet */ HWTSTAMP_FILTER_PTP_V2_L4_SYNC, /* PTP v2, UDP, Delay_req packet */ HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ, /* 802.AS1, Ethernet, any kind of event packet */ HWTSTAMP_FILTER_PTP_V2_L2_EVENT, /* 802.AS1, Ethernet, Sync packet */ HWTSTAMP_FILTER_PTP_V2_L2_SYNC, /* 802.AS1, Ethernet, Delay_req packet */ HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ, /* PTP v2/802.AS1, any layer, any kind of event packet */ HWTSTAMP_FILTER_PTP_V2_EVENT, /* PTP v2/802.AS1, any layer, Sync packet */ HWTSTAMP_FILTER_PTP_V2_SYNC, /* PTP v2/802.AS1, any layer, Delay_req packet */ HWTSTAMP_FILTER_PTP_V2_DELAY_REQ, /* NTP, UDP, all versions and packet modes */ HWTSTAMP_FILTER_NTP_ALL, }; /* SCM_TIMESTAMPING_PKTINFO control message */ struct scm_ts_pktinfo { __u32 if_index; __u32 pkt_length; __u32 reserved[2]; }; /* * SO_TXTIME gets a struct sock_txtime with flags being an integer bit * field comprised of these values. */ enum txtime_flags { SOF_TXTIME_DEADLINE_MODE = (1 << 0), SOF_TXTIME_REPORT_ERRORS = (1 << 1), SOF_TXTIME_FLAGS_LAST = SOF_TXTIME_REPORT_ERRORS, SOF_TXTIME_FLAGS_MASK = (SOF_TXTIME_FLAGS_LAST - 1) | SOF_TXTIME_FLAGS_LAST }; struct sock_txtime { __kernel_clockid_t clockid;/* reference clockid */ __u32 flags; /* as defined by enum txtime_flags */ }; #endif /* _NET_TIMESTAMPING_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/vmcore.h��������������������������������������������������������������������������������������0000644�����������������00000000657�14763166027�0007373 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _VMCORE_H #define _VMCORE_H #include <linux/types.h> #define VMCOREDD_NOTE_NAME "LINUX" #define VMCOREDD_MAX_NAME_BYTES 44 struct vmcoredd_header { __u32 n_namesz; /* Name size */ __u32 n_descsz; /* Content size */ __u32 n_type; /* NT_VMCOREDD */ __u8 name[8]; /* LINUX\0\0\0 */ __u8 dump_name[VMCOREDD_MAX_NAME_BYTES]; /* Device dump's name */ }; #endif /* _VMCORE_H */ ���������������������������������������������������������������������������������linux/seg6.h����������������������������������������������������������������������������������������0000644�����������������00000002222�14763166027�0006732 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * SR-IPv6 implementation * * Author: * David Lebrun <david.lebrun@uclouvain.be> * * * 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. */ #ifndef _LINUX_SEG6_H #define _LINUX_SEG6_H #include <linux/types.h> #include <linux/in6.h> /* For struct in6_addr. */ /* * SRH */ struct ipv6_sr_hdr { __u8 nexthdr; __u8 hdrlen; __u8 type; __u8 segments_left; __u8 first_segment; /* Represents the last_entry field of SRH */ __u8 flags; __u16 tag; struct in6_addr segments[0]; }; #define SR6_FLAG1_PROTECTED (1 << 6) #define SR6_FLAG1_OAM (1 << 5) #define SR6_FLAG1_ALERT (1 << 4) #define SR6_FLAG1_HMAC (1 << 3) #define SR6_TLV_INGRESS 1 #define SR6_TLV_EGRESS 2 #define SR6_TLV_OPAQUE 3 #define SR6_TLV_PADDING 4 #define SR6_TLV_HMAC 5 #define sr_has_hmac(srh) ((srh)->flags & SR6_FLAG1_HMAC) struct sr6_tlv { __u8 type; __u8 len; __u8 data[0]; }; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/sock_diag.h�����������������������������������������������������������������������������������0000644�����������������00000001327�14763166027�0010016 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __SOCK_DIAG_H__ #define __SOCK_DIAG_H__ #include <linux/types.h> #define SOCK_DIAG_BY_FAMILY 20 #define SOCK_DESTROY 21 struct sock_diag_req { __u8 sdiag_family; __u8 sdiag_protocol; }; enum { SK_MEMINFO_RMEM_ALLOC, SK_MEMINFO_RCVBUF, SK_MEMINFO_WMEM_ALLOC, SK_MEMINFO_SNDBUF, SK_MEMINFO_FWD_ALLOC, SK_MEMINFO_WMEM_QUEUED, SK_MEMINFO_OPTMEM, SK_MEMINFO_BACKLOG, SK_MEMINFO_DROPS, SK_MEMINFO_VARS, }; enum sknetlink_groups { SKNLGRP_NONE, SKNLGRP_INET_TCP_DESTROY, SKNLGRP_INET_UDP_DESTROY, SKNLGRP_INET6_TCP_DESTROY, SKNLGRP_INET6_UDP_DESTROY, __SKNLGRP_MAX, }; #define SKNLGRP_MAX (__SKNLGRP_MAX - 1) #endif /* __SOCK_DIAG_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/i2c.h�����������������������������������������������������������������������������������������0000644�����������������00000015734�14763166027�0006557 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* ------------------------------------------------------------------------- */ /* */ /* i2c.h - definitions for the i2c-bus interface */ /* */ /* ------------------------------------------------------------------------- */ /* Copyright (C) 1995-2000 Simon G. Vogl 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /* ------------------------------------------------------------------------- */ /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and Frodo Looijaard <frodol@dds.nl> */ #ifndef _LINUX_I2C_H #define _LINUX_I2C_H #include <linux/types.h> /** * struct i2c_msg - an I2C transaction segment beginning with START * @addr: Slave address, either seven or ten bits. When this is a ten * bit address, I2C_M_TEN must be set in @flags and the adapter * must support I2C_FUNC_10BIT_ADDR. * @flags: I2C_M_RD is handled by all adapters. No other flags may be * provided unless the adapter exported the relevant I2C_FUNC_* * flags through i2c_check_functionality(). * @len: Number of data bytes in @buf being read from or written to the * I2C slave address. For read transactions where I2C_M_RECV_LEN * is set, the caller guarantees that this buffer can hold up to * 32 bytes in addition to the initial length byte sent by the * slave (plus, if used, the SMBus PEC); and this value will be * incremented by the number of block data bytes received. * @buf: The buffer into which data is read, or from which it's written. * * An i2c_msg is the low level representation of one segment of an I2C * transaction. It is visible to drivers in the @i2c_transfer() procedure, * to userspace from i2c-dev, and to I2C adapter drivers through the * @i2c_adapter.@master_xfer() method. * * Except when I2C "protocol mangling" is used, all I2C adapters implement * the standard rules for I2C transactions. Each transaction begins with a * START. That is followed by the slave address, and a bit encoding read * versus write. Then follow all the data bytes, possibly including a byte * with SMBus PEC. The transfer terminates with a NAK, or when all those * bytes have been transferred and ACKed. If this is the last message in a * group, it is followed by a STOP. Otherwise it is followed by the next * @i2c_msg transaction segment, beginning with a (repeated) START. * * Alternatively, when the adapter supports I2C_FUNC_PROTOCOL_MANGLING then * passing certain @flags may have changed those standard protocol behaviors. * Those flags are only for use with broken/nonconforming slaves, and with * adapters which are known to support the specific mangling options they * need (one or more of IGNORE_NAK, NO_RD_ACK, NOSTART, and REV_DIR_ADDR). */ struct i2c_msg { __u16 addr; /* slave address */ __u16 flags; #define I2C_M_RD 0x0001 /* read data, from slave to master */ /* I2C_M_RD is guaranteed to be 0x0001! */ #define I2C_M_TEN 0x0010 /* this is a ten bit chip address */ #define I2C_M_DMA_SAFE 0x0200 /* the buffer of this message is DMA safe */ /* makes only sense in kernelspace */ /* userspace buffers are copied anyway */ #define I2C_M_RECV_LEN 0x0400 /* length will be first received byte */ #define I2C_M_NO_RD_ACK 0x0800 /* if I2C_FUNC_PROTOCOL_MANGLING */ #define I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */ #define I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */ #define I2C_M_NOSTART 0x4000 /* if I2C_FUNC_NOSTART */ #define I2C_M_STOP 0x8000 /* if I2C_FUNC_PROTOCOL_MANGLING */ __u16 len; /* msg length */ __u8 *buf; /* pointer to msg data */ }; /* To determine what functionality is present */ #define I2C_FUNC_I2C 0x00000001 #define I2C_FUNC_10BIT_ADDR 0x00000002 #define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_IGNORE_NAK etc. */ #define I2C_FUNC_SMBUS_PEC 0x00000008 #define I2C_FUNC_NOSTART 0x00000010 /* I2C_M_NOSTART */ #define I2C_FUNC_SLAVE 0x00000020 #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ #define I2C_FUNC_SMBUS_QUICK 0x00010000 #define I2C_FUNC_SMBUS_READ_BYTE 0x00020000 #define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000 #define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000 #define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000 #define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000 #define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000 #define I2C_FUNC_SMBUS_PROC_CALL 0x00800000 #define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000 #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 #define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ #define I2C_FUNC_SMBUS_HOST_NOTIFY 0x10000000 #define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \ I2C_FUNC_SMBUS_WRITE_BYTE) #define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \ I2C_FUNC_SMBUS_WRITE_BYTE_DATA) #define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \ I2C_FUNC_SMBUS_WRITE_WORD_DATA) #define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \ I2C_FUNC_SMBUS_WRITE_BLOCK_DATA) #define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \ I2C_FUNC_SMBUS_WRITE_I2C_BLOCK) #define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \ I2C_FUNC_SMBUS_BYTE | \ I2C_FUNC_SMBUS_BYTE_DATA | \ I2C_FUNC_SMBUS_WORD_DATA | \ I2C_FUNC_SMBUS_PROC_CALL | \ I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \ I2C_FUNC_SMBUS_I2C_BLOCK | \ I2C_FUNC_SMBUS_PEC) /* * Data for SMBus Messages */ #define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */ union i2c_smbus_data { __u8 byte; __u16 word; __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */ /* and one more for user-space compatibility */ }; /* i2c_smbus_xfer read or write markers */ #define I2C_SMBUS_READ 1 #define I2C_SMBUS_WRITE 0 /* SMBus transaction types (size parameter in the above functions) Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */ #define I2C_SMBUS_QUICK 0 #define I2C_SMBUS_BYTE 1 #define I2C_SMBUS_BYTE_DATA 2 #define I2C_SMBUS_WORD_DATA 3 #define I2C_SMBUS_PROC_CALL 4 #define I2C_SMBUS_BLOCK_DATA 5 #define I2C_SMBUS_I2C_BLOCK_BROKEN 6 #define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */ #define I2C_SMBUS_I2C_BLOCK_DATA 8 #endif /* _LINUX_I2C_H */ ������������������������������������linux/psp-sev.h�������������������������������������������������������������������������������������0000644�����������������00000007415�14763166027�0007474 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Userspace interface for AMD Secure Encrypted Virtualization (SEV) * platform management commands. * * Copyright (C) 2016-2017 Advanced Micro Devices, Inc. * * Author: Brijesh Singh <brijesh.singh@amd.com> * * SEV spec 0.14 is available at: * http://support.amd.com/TechDocs/55766_SEV-KM%20API_Specification.pdf * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef __PSP_SEV_USER_H__ #define __PSP_SEV_USER_H__ #include <linux/types.h> /** * SEV platform commands */ enum { SEV_FACTORY_RESET = 0, SEV_PLATFORM_STATUS, SEV_PEK_GEN, SEV_PEK_CSR, SEV_PDH_GEN, SEV_PDH_CERT_EXPORT, SEV_PEK_CERT_IMPORT, SEV_GET_ID, SEV_MAX, }; /** * SEV Firmware status code */ typedef enum { SEV_RET_SUCCESS = 0, SEV_RET_INVALID_PLATFORM_STATE, SEV_RET_INVALID_GUEST_STATE, SEV_RET_INAVLID_CONFIG, SEV_RET_INVALID_LEN, SEV_RET_ALREADY_OWNED, SEV_RET_INVALID_CERTIFICATE, SEV_RET_POLICY_FAILURE, SEV_RET_INACTIVE, SEV_RET_INVALID_ADDRESS, SEV_RET_BAD_SIGNATURE, SEV_RET_BAD_MEASUREMENT, SEV_RET_ASID_OWNED, SEV_RET_INVALID_ASID, SEV_RET_WBINVD_REQUIRED, SEV_RET_DFFLUSH_REQUIRED, SEV_RET_INVALID_GUEST, SEV_RET_INVALID_COMMAND, SEV_RET_ACTIVE, SEV_RET_HWSEV_RET_PLATFORM, SEV_RET_HWSEV_RET_UNSAFE, SEV_RET_UNSUPPORTED, SEV_RET_MAX, } sev_ret_code; /** * struct sev_user_data_status - PLATFORM_STATUS command parameters * * @major: major API version * @minor: minor API version * @state: platform state * @flags: platform config flags * @build: firmware build id for API version * @guest_count: number of active guests */ struct sev_user_data_status { __u8 api_major; /* Out */ __u8 api_minor; /* Out */ __u8 state; /* Out */ __u32 flags; /* Out */ __u8 build; /* Out */ __u32 guest_count; /* Out */ } __attribute__((packed)); /** * struct sev_user_data_pek_csr - PEK_CSR command parameters * * @address: PEK certificate chain * @length: length of certificate */ struct sev_user_data_pek_csr { __u64 address; /* In */ __u32 length; /* In/Out */ } __attribute__((packed)); /** * struct sev_user_data_cert_import - PEK_CERT_IMPORT command parameters * * @pek_address: PEK certificate chain * @pek_len: length of PEK certificate * @oca_address: OCA certificate chain * @oca_len: length of OCA certificate */ struct sev_user_data_pek_cert_import { __u64 pek_cert_address; /* In */ __u32 pek_cert_len; /* In */ __u64 oca_cert_address; /* In */ __u32 oca_cert_len; /* In */ } __attribute__((packed)); /** * struct sev_user_data_pdh_cert_export - PDH_CERT_EXPORT command parameters * * @pdh_address: PDH certificate address * @pdh_len: length of PDH certificate * @cert_chain_address: PDH certificate chain * @cert_chain_len: length of PDH certificate chain */ struct sev_user_data_pdh_cert_export { __u64 pdh_cert_address; /* In */ __u32 pdh_cert_len; /* In/Out */ __u64 cert_chain_address; /* In */ __u32 cert_chain_len; /* In/Out */ } __attribute__((packed)); /** * struct sev_user_data_get_id - GET_ID command parameters * * @socket1: Buffer to pass unique ID of first socket * @socket2: Buffer to pass unique ID of second socket */ struct sev_user_data_get_id { __u8 socket1[64]; /* Out */ __u8 socket2[64]; /* Out */ } __attribute__((packed)); /** * struct sev_issue_cmd - SEV ioctl parameters * * @cmd: SEV commands to execute * @opaque: pointer to the command structure * @error: SEV FW return code on failure */ struct sev_issue_cmd { __u32 cmd; /* In */ __u64 data; /* In */ __u32 error; /* Out */ } __attribute__((packed)); #define SEV_IOC_TYPE 'S' #define SEV_ISSUE_CMD _IOWR(SEV_IOC_TYPE, 0x0, struct sev_issue_cmd) #endif /* __PSP_USER_SEV_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������linux/vtpm_proxy.h����������������������������������������������������������������������������������0000644�����������������00000003267�14763166027�0010327 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Definitions for the VTPM proxy driver * Copyright (c) 2015, 2016, IBM Corporation * Copyright (C) 2016 Intel Corporation * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope 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. */ #ifndef _LINUX_VTPM_PROXY_H #define _LINUX_VTPM_PROXY_H #include <linux/types.h> #include <linux/ioctl.h> /** * enum vtpm_proxy_flags - flags for the proxy TPM * @VTPM_PROXY_FLAG_TPM2: the proxy TPM uses TPM 2.0 protocol */ enum vtpm_proxy_flags { VTPM_PROXY_FLAG_TPM2 = 1, }; /** * struct vtpm_proxy_new_dev - parameter structure for the * %VTPM_PROXY_IOC_NEW_DEV ioctl * @flags: flags for the proxy TPM * @tpm_num: index of the TPM device * @fd: the file descriptor used by the proxy TPM * @major: the major number of the TPM device * @minor: the minor number of the TPM device */ struct vtpm_proxy_new_dev { __u32 flags; /* input */ __u32 tpm_num; /* output */ __u32 fd; /* output */ __u32 major; /* output */ __u32 minor; /* output */ }; #define VTPM_PROXY_IOC_NEW_DEV _IOWR(0xa1, 0x00, struct vtpm_proxy_new_dev) /* vendor specific commands to set locality */ #define TPM2_CC_SET_LOCALITY 0x20001000 #define TPM_ORD_SET_LOCALITY 0x20001000 #endif /* _LINUX_VTPM_PROXY_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gnu-versions.h��������������������������������������������������������������������������������������0000644�����������������00000004455�14763166027�0007400 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Header with interface version macros for library pieces copied elsewhere. Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _GNU_VERSIONS_H #define _GNU_VERSIONS_H 1 /* This file exists to define these few macros. Each specifies a version number associated with the library interface of a piece of the C library which is also distributed with other GNU packages. These pieces are both part of the GNU C library and also distributed with other GNU packages so those packages may use their facilities on systems lacking the GNU C library. The source files for each piece surround all their code with `#ifndef ELIDE_CODE' after defining it with this: #define OBSTACK_INTERFACE_VERSION 1 #if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1 #include <gnu-versions.h> #if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION #define ELIDE_CODE #endif #endif This allows those one to avoid compiling those files when part of a GNU package not libc, on a system using a GNU C library that supports the same interface. Please preserve the format of the comments after each macro. And remember, if any of these versions change, the libc.so major version number must change too (so avoid it)! */ #define _GNU_OBSTACK_INTERFACE_VERSION 1 /* vs malloc/obstack.c */ #define _GNU_REGEX_INTERFACE_VERSION 1 /* vs posix/regex.c */ #define _GNU_GLOB_INTERFACE_VERSION 1 /* vs posix/glob.c */ #define _GNU_GETOPT_INTERFACE_VERSION 2 /* vs posix/getopt.c and posix/getopt1.c */ #endif /* gnu-versions.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gpg-error.h�����������������������������������������������������������������������������������������0000644�����������������00000057240�14763166027�0006645 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Output of mkheader.awk. DO NOT EDIT. -*- buffer-read-only: t -*- */ /* gpg-error.h - Public interface to libgpg-error. Copyright (C) 2003, 2004, 2010, 2013 g10 Code GmbH This file is part of libgpg-error. libgpg-error is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. libgpg-error 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. */ #ifndef GPG_ERROR_H #define GPG_ERROR_H 1 #include <stddef.h> #ifdef __GNUC__ #define GPG_ERR_INLINE __inline__ #elif _MSC_VER >= 1300 #define GPG_ERR_INLINE __inline #elif __STDC_VERSION__ >= 199901L #define GPG_ERR_INLINE inline #else #ifndef GPG_ERR_INLINE #define GPG_ERR_INLINE #endif #endif #ifdef __cplusplus extern "C" { #if 0 /* just to make Emacs auto-indent happy */ } #endif #endif /* __cplusplus */ /* The GnuPG project consists of many components. Error codes are exchanged between all components. The common error codes and their user-presentable descriptions are kept into a shared library to allow adding new error codes and components without recompiling any of the other components. The interface will not change in a backward incompatible way. An error code together with an error source build up an error value. As the error value is been passed from one component to another, it preserver the information about the source and nature of the error. A component of the GnuPG project can define the following macros to tune the behaviour of the library: GPG_ERR_SOURCE_DEFAULT: Define to an error source of type gpg_err_source_t to make that source the default for gpg_error(). Otherwise GPG_ERR_SOURCE_UNKNOWN is used as default. GPG_ERR_ENABLE_GETTEXT_MACROS: Define to provide macros to map the internal gettext API to standard names. This has only an effect on Windows platforms. */ /* The error source type gpg_err_source_t. Where as the Poo out of a welle small Taketh his firste springing and his sours. --Chaucer. */ /* Only use free slots, never change or reorder the existing entries. */ typedef enum { GPG_ERR_SOURCE_UNKNOWN = 0, GPG_ERR_SOURCE_GCRYPT = 1, GPG_ERR_SOURCE_GPG = 2, GPG_ERR_SOURCE_GPGSM = 3, GPG_ERR_SOURCE_GPGAGENT = 4, GPG_ERR_SOURCE_PINENTRY = 5, GPG_ERR_SOURCE_SCD = 6, GPG_ERR_SOURCE_GPGME = 7, GPG_ERR_SOURCE_KEYBOX = 8, GPG_ERR_SOURCE_KSBA = 9, GPG_ERR_SOURCE_DIRMNGR = 10, GPG_ERR_SOURCE_GSTI = 11, GPG_ERR_SOURCE_GPA = 12, GPG_ERR_SOURCE_KLEO = 13, GPG_ERR_SOURCE_G13 = 14, GPG_ERR_SOURCE_ASSUAN = 15, GPG_ERR_SOURCE_ANY = 31, GPG_ERR_SOURCE_USER_1 = 32, GPG_ERR_SOURCE_USER_2 = 33, GPG_ERR_SOURCE_USER_3 = 34, GPG_ERR_SOURCE_USER_4 = 35, /* This is one more than the largest allowed entry. */ GPG_ERR_SOURCE_DIM = 128 } gpg_err_source_t; /* The error code type gpg_err_code_t. */ /* Only use free slots, never change or reorder the existing entries. */ typedef enum { GPG_ERR_NO_ERROR = 0, GPG_ERR_GENERAL = 1, GPG_ERR_UNKNOWN_PACKET = 2, GPG_ERR_UNKNOWN_VERSION = 3, GPG_ERR_PUBKEY_ALGO = 4, GPG_ERR_DIGEST_ALGO = 5, GPG_ERR_BAD_PUBKEY = 6, GPG_ERR_BAD_SECKEY = 7, GPG_ERR_BAD_SIGNATURE = 8, GPG_ERR_NO_PUBKEY = 9, GPG_ERR_CHECKSUM = 10, GPG_ERR_BAD_PASSPHRASE = 11, GPG_ERR_CIPHER_ALGO = 12, GPG_ERR_KEYRING_OPEN = 13, GPG_ERR_INV_PACKET = 14, GPG_ERR_INV_ARMOR = 15, GPG_ERR_NO_USER_ID = 16, GPG_ERR_NO_SECKEY = 17, GPG_ERR_WRONG_SECKEY = 18, GPG_ERR_BAD_KEY = 19, GPG_ERR_COMPR_ALGO = 20, GPG_ERR_NO_PRIME = 21, GPG_ERR_NO_ENCODING_METHOD = 22, GPG_ERR_NO_ENCRYPTION_SCHEME = 23, GPG_ERR_NO_SIGNATURE_SCHEME = 24, GPG_ERR_INV_ATTR = 25, GPG_ERR_NO_VALUE = 26, GPG_ERR_NOT_FOUND = 27, GPG_ERR_VALUE_NOT_FOUND = 28, GPG_ERR_SYNTAX = 29, GPG_ERR_BAD_MPI = 30, GPG_ERR_INV_PASSPHRASE = 31, GPG_ERR_SIG_CLASS = 32, GPG_ERR_RESOURCE_LIMIT = 33, GPG_ERR_INV_KEYRING = 34, GPG_ERR_TRUSTDB = 35, GPG_ERR_BAD_CERT = 36, GPG_ERR_INV_USER_ID = 37, GPG_ERR_UNEXPECTED = 38, GPG_ERR_TIME_CONFLICT = 39, GPG_ERR_KEYSERVER = 40, GPG_ERR_WRONG_PUBKEY_ALGO = 41, GPG_ERR_TRIBUTE_TO_D_A = 42, GPG_ERR_WEAK_KEY = 43, GPG_ERR_INV_KEYLEN = 44, GPG_ERR_INV_ARG = 45, GPG_ERR_BAD_URI = 46, GPG_ERR_INV_URI = 47, GPG_ERR_NETWORK = 48, GPG_ERR_UNKNOWN_HOST = 49, GPG_ERR_SELFTEST_FAILED = 50, GPG_ERR_NOT_ENCRYPTED = 51, GPG_ERR_NOT_PROCESSED = 52, GPG_ERR_UNUSABLE_PUBKEY = 53, GPG_ERR_UNUSABLE_SECKEY = 54, GPG_ERR_INV_VALUE = 55, GPG_ERR_BAD_CERT_CHAIN = 56, GPG_ERR_MISSING_CERT = 57, GPG_ERR_NO_DATA = 58, GPG_ERR_BUG = 59, GPG_ERR_NOT_SUPPORTED = 60, GPG_ERR_INV_OP = 61, GPG_ERR_TIMEOUT = 62, GPG_ERR_INTERNAL = 63, GPG_ERR_EOF_GCRYPT = 64, GPG_ERR_INV_OBJ = 65, GPG_ERR_TOO_SHORT = 66, GPG_ERR_TOO_LARGE = 67, GPG_ERR_NO_OBJ = 68, GPG_ERR_NOT_IMPLEMENTED = 69, GPG_ERR_CONFLICT = 70, GPG_ERR_INV_CIPHER_MODE = 71, GPG_ERR_INV_FLAG = 72, GPG_ERR_INV_HANDLE = 73, GPG_ERR_TRUNCATED = 74, GPG_ERR_INCOMPLETE_LINE = 75, GPG_ERR_INV_RESPONSE = 76, GPG_ERR_NO_AGENT = 77, GPG_ERR_AGENT = 78, GPG_ERR_INV_DATA = 79, GPG_ERR_ASSUAN_SERVER_FAULT = 80, GPG_ERR_ASSUAN = 81, GPG_ERR_INV_SESSION_KEY = 82, GPG_ERR_INV_SEXP = 83, GPG_ERR_UNSUPPORTED_ALGORITHM = 84, GPG_ERR_NO_PIN_ENTRY = 85, GPG_ERR_PIN_ENTRY = 86, GPG_ERR_BAD_PIN = 87, GPG_ERR_INV_NAME = 88, GPG_ERR_BAD_DATA = 89, GPG_ERR_INV_PARAMETER = 90, GPG_ERR_WRONG_CARD = 91, GPG_ERR_NO_DIRMNGR = 92, GPG_ERR_DIRMNGR = 93, GPG_ERR_CERT_REVOKED = 94, GPG_ERR_NO_CRL_KNOWN = 95, GPG_ERR_CRL_TOO_OLD = 96, GPG_ERR_LINE_TOO_LONG = 97, GPG_ERR_NOT_TRUSTED = 98, GPG_ERR_CANCELED = 99, GPG_ERR_BAD_CA_CERT = 100, GPG_ERR_CERT_EXPIRED = 101, GPG_ERR_CERT_TOO_YOUNG = 102, GPG_ERR_UNSUPPORTED_CERT = 103, GPG_ERR_UNKNOWN_SEXP = 104, GPG_ERR_UNSUPPORTED_PROTECTION = 105, GPG_ERR_CORRUPTED_PROTECTION = 106, GPG_ERR_AMBIGUOUS_NAME = 107, GPG_ERR_CARD = 108, GPG_ERR_CARD_RESET = 109, GPG_ERR_CARD_REMOVED = 110, GPG_ERR_INV_CARD = 111, GPG_ERR_CARD_NOT_PRESENT = 112, GPG_ERR_NO_PKCS15_APP = 113, GPG_ERR_NOT_CONFIRMED = 114, GPG_ERR_CONFIGURATION = 115, GPG_ERR_NO_POLICY_MATCH = 116, GPG_ERR_INV_INDEX = 117, GPG_ERR_INV_ID = 118, GPG_ERR_NO_SCDAEMON = 119, GPG_ERR_SCDAEMON = 120, GPG_ERR_UNSUPPORTED_PROTOCOL = 121, GPG_ERR_BAD_PIN_METHOD = 122, GPG_ERR_CARD_NOT_INITIALIZED = 123, GPG_ERR_UNSUPPORTED_OPERATION = 124, GPG_ERR_WRONG_KEY_USAGE = 125, GPG_ERR_NOTHING_FOUND = 126, GPG_ERR_WRONG_BLOB_TYPE = 127, GPG_ERR_MISSING_VALUE = 128, GPG_ERR_HARDWARE = 129, GPG_ERR_PIN_BLOCKED = 130, GPG_ERR_USE_CONDITIONS = 131, GPG_ERR_PIN_NOT_SYNCED = 132, GPG_ERR_INV_CRL = 133, GPG_ERR_BAD_BER = 134, GPG_ERR_INV_BER = 135, GPG_ERR_ELEMENT_NOT_FOUND = 136, GPG_ERR_IDENTIFIER_NOT_FOUND = 137, GPG_ERR_INV_TAG = 138, GPG_ERR_INV_LENGTH = 139, GPG_ERR_INV_KEYINFO = 140, GPG_ERR_UNEXPECTED_TAG = 141, GPG_ERR_NOT_DER_ENCODED = 142, GPG_ERR_NO_CMS_OBJ = 143, GPG_ERR_INV_CMS_OBJ = 144, GPG_ERR_UNKNOWN_CMS_OBJ = 145, GPG_ERR_UNSUPPORTED_CMS_OBJ = 146, GPG_ERR_UNSUPPORTED_ENCODING = 147, GPG_ERR_UNSUPPORTED_CMS_VERSION = 148, GPG_ERR_UNKNOWN_ALGORITHM = 149, GPG_ERR_INV_ENGINE = 150, GPG_ERR_PUBKEY_NOT_TRUSTED = 151, GPG_ERR_DECRYPT_FAILED = 152, GPG_ERR_KEY_EXPIRED = 153, GPG_ERR_SIG_EXPIRED = 154, GPG_ERR_ENCODING_PROBLEM = 155, GPG_ERR_INV_STATE = 156, GPG_ERR_DUP_VALUE = 157, GPG_ERR_MISSING_ACTION = 158, GPG_ERR_MODULE_NOT_FOUND = 159, GPG_ERR_INV_OID_STRING = 160, GPG_ERR_INV_TIME = 161, GPG_ERR_INV_CRL_OBJ = 162, GPG_ERR_UNSUPPORTED_CRL_VERSION = 163, GPG_ERR_INV_CERT_OBJ = 164, GPG_ERR_UNKNOWN_NAME = 165, GPG_ERR_LOCALE_PROBLEM = 166, GPG_ERR_NOT_LOCKED = 167, GPG_ERR_PROTOCOL_VIOLATION = 168, GPG_ERR_INV_MAC = 169, GPG_ERR_INV_REQUEST = 170, GPG_ERR_UNKNOWN_EXTN = 171, GPG_ERR_UNKNOWN_CRIT_EXTN = 172, GPG_ERR_LOCKED = 173, GPG_ERR_UNKNOWN_OPTION = 174, GPG_ERR_UNKNOWN_COMMAND = 175, GPG_ERR_NOT_OPERATIONAL = 176, GPG_ERR_NO_PASSPHRASE = 177, GPG_ERR_NO_PIN = 178, GPG_ERR_NOT_ENABLED = 179, GPG_ERR_NO_ENGINE = 180, GPG_ERR_MISSING_KEY = 181, GPG_ERR_TOO_MANY = 182, GPG_ERR_LIMIT_REACHED = 183, GPG_ERR_NOT_INITIALIZED = 184, GPG_ERR_MISSING_ISSUER_CERT = 185, GPG_ERR_NO_KEYSERVER = 186, GPG_ERR_INV_CURVE = 187, GPG_ERR_UNKNOWN_CURVE = 188, GPG_ERR_DUP_KEY = 189, GPG_ERR_AMBIGUOUS = 190, GPG_ERR_NO_CRYPT_CTX = 191, GPG_ERR_WRONG_CRYPT_CTX = 192, GPG_ERR_BAD_CRYPT_CTX = 193, GPG_ERR_CRYPT_CTX_CONFLICT = 194, GPG_ERR_BROKEN_PUBKEY = 195, GPG_ERR_BROKEN_SECKEY = 196, GPG_ERR_FULLY_CANCELED = 198, GPG_ERR_UNFINISHED = 199, GPG_ERR_BUFFER_TOO_SHORT = 200, GPG_ERR_SEXP_INV_LEN_SPEC = 201, GPG_ERR_SEXP_STRING_TOO_LONG = 202, GPG_ERR_SEXP_UNMATCHED_PAREN = 203, GPG_ERR_SEXP_NOT_CANONICAL = 204, GPG_ERR_SEXP_BAD_CHARACTER = 205, GPG_ERR_SEXP_BAD_QUOTATION = 206, GPG_ERR_SEXP_ZERO_PREFIX = 207, GPG_ERR_SEXP_NESTED_DH = 208, GPG_ERR_SEXP_UNMATCHED_DH = 209, GPG_ERR_SEXP_UNEXPECTED_PUNC = 210, GPG_ERR_SEXP_BAD_HEX_CHAR = 211, GPG_ERR_SEXP_ODD_HEX_NUMBERS = 212, GPG_ERR_SEXP_BAD_OCT_CHAR = 213, GPG_ERR_ASS_GENERAL = 257, GPG_ERR_ASS_ACCEPT_FAILED = 258, GPG_ERR_ASS_CONNECT_FAILED = 259, GPG_ERR_ASS_INV_RESPONSE = 260, GPG_ERR_ASS_INV_VALUE = 261, GPG_ERR_ASS_INCOMPLETE_LINE = 262, GPG_ERR_ASS_LINE_TOO_LONG = 263, GPG_ERR_ASS_NESTED_COMMANDS = 264, GPG_ERR_ASS_NO_DATA_CB = 265, GPG_ERR_ASS_NO_INQUIRE_CB = 266, GPG_ERR_ASS_NOT_A_SERVER = 267, GPG_ERR_ASS_NOT_A_CLIENT = 268, GPG_ERR_ASS_SERVER_START = 269, GPG_ERR_ASS_READ_ERROR = 270, GPG_ERR_ASS_WRITE_ERROR = 271, GPG_ERR_ASS_TOO_MUCH_DATA = 273, GPG_ERR_ASS_UNEXPECTED_CMD = 274, GPG_ERR_ASS_UNKNOWN_CMD = 275, GPG_ERR_ASS_SYNTAX = 276, GPG_ERR_ASS_CANCELED = 277, GPG_ERR_ASS_NO_INPUT = 278, GPG_ERR_ASS_NO_OUTPUT = 279, GPG_ERR_ASS_PARAMETER = 280, GPG_ERR_ASS_UNKNOWN_INQUIRE = 281, GPG_ERR_USER_1 = 1024, GPG_ERR_USER_2 = 1025, GPG_ERR_USER_3 = 1026, GPG_ERR_USER_4 = 1027, GPG_ERR_USER_5 = 1028, GPG_ERR_USER_6 = 1029, GPG_ERR_USER_7 = 1030, GPG_ERR_USER_8 = 1031, GPG_ERR_USER_9 = 1032, GPG_ERR_USER_10 = 1033, GPG_ERR_USER_11 = 1034, GPG_ERR_USER_12 = 1035, GPG_ERR_USER_13 = 1036, GPG_ERR_USER_14 = 1037, GPG_ERR_USER_15 = 1038, GPG_ERR_USER_16 = 1039, GPG_ERR_MISSING_ERRNO = 16381, GPG_ERR_UNKNOWN_ERRNO = 16382, GPG_ERR_EOF = 16383, /* The following error codes are used to map system errors. */ #define GPG_ERR_SYSTEM_ERROR (1 << 15) GPG_ERR_E2BIG = GPG_ERR_SYSTEM_ERROR | 0, GPG_ERR_EACCES = GPG_ERR_SYSTEM_ERROR | 1, GPG_ERR_EADDRINUSE = GPG_ERR_SYSTEM_ERROR | 2, GPG_ERR_EADDRNOTAVAIL = GPG_ERR_SYSTEM_ERROR | 3, GPG_ERR_EADV = GPG_ERR_SYSTEM_ERROR | 4, GPG_ERR_EAFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 5, GPG_ERR_EAGAIN = GPG_ERR_SYSTEM_ERROR | 6, GPG_ERR_EALREADY = GPG_ERR_SYSTEM_ERROR | 7, GPG_ERR_EAUTH = GPG_ERR_SYSTEM_ERROR | 8, GPG_ERR_EBACKGROUND = GPG_ERR_SYSTEM_ERROR | 9, GPG_ERR_EBADE = GPG_ERR_SYSTEM_ERROR | 10, GPG_ERR_EBADF = GPG_ERR_SYSTEM_ERROR | 11, GPG_ERR_EBADFD = GPG_ERR_SYSTEM_ERROR | 12, GPG_ERR_EBADMSG = GPG_ERR_SYSTEM_ERROR | 13, GPG_ERR_EBADR = GPG_ERR_SYSTEM_ERROR | 14, GPG_ERR_EBADRPC = GPG_ERR_SYSTEM_ERROR | 15, GPG_ERR_EBADRQC = GPG_ERR_SYSTEM_ERROR | 16, GPG_ERR_EBADSLT = GPG_ERR_SYSTEM_ERROR | 17, GPG_ERR_EBFONT = GPG_ERR_SYSTEM_ERROR | 18, GPG_ERR_EBUSY = GPG_ERR_SYSTEM_ERROR | 19, GPG_ERR_ECANCELED = GPG_ERR_SYSTEM_ERROR | 20, GPG_ERR_ECHILD = GPG_ERR_SYSTEM_ERROR | 21, GPG_ERR_ECHRNG = GPG_ERR_SYSTEM_ERROR | 22, GPG_ERR_ECOMM = GPG_ERR_SYSTEM_ERROR | 23, GPG_ERR_ECONNABORTED = GPG_ERR_SYSTEM_ERROR | 24, GPG_ERR_ECONNREFUSED = GPG_ERR_SYSTEM_ERROR | 25, GPG_ERR_ECONNRESET = GPG_ERR_SYSTEM_ERROR | 26, GPG_ERR_ED = GPG_ERR_SYSTEM_ERROR | 27, GPG_ERR_EDEADLK = GPG_ERR_SYSTEM_ERROR | 28, GPG_ERR_EDEADLOCK = GPG_ERR_SYSTEM_ERROR | 29, GPG_ERR_EDESTADDRREQ = GPG_ERR_SYSTEM_ERROR | 30, GPG_ERR_EDIED = GPG_ERR_SYSTEM_ERROR | 31, GPG_ERR_EDOM = GPG_ERR_SYSTEM_ERROR | 32, GPG_ERR_EDOTDOT = GPG_ERR_SYSTEM_ERROR | 33, GPG_ERR_EDQUOT = GPG_ERR_SYSTEM_ERROR | 34, GPG_ERR_EEXIST = GPG_ERR_SYSTEM_ERROR | 35, GPG_ERR_EFAULT = GPG_ERR_SYSTEM_ERROR | 36, GPG_ERR_EFBIG = GPG_ERR_SYSTEM_ERROR | 37, GPG_ERR_EFTYPE = GPG_ERR_SYSTEM_ERROR | 38, GPG_ERR_EGRATUITOUS = GPG_ERR_SYSTEM_ERROR | 39, GPG_ERR_EGREGIOUS = GPG_ERR_SYSTEM_ERROR | 40, GPG_ERR_EHOSTDOWN = GPG_ERR_SYSTEM_ERROR | 41, GPG_ERR_EHOSTUNREACH = GPG_ERR_SYSTEM_ERROR | 42, GPG_ERR_EIDRM = GPG_ERR_SYSTEM_ERROR | 43, GPG_ERR_EIEIO = GPG_ERR_SYSTEM_ERROR | 44, GPG_ERR_EILSEQ = GPG_ERR_SYSTEM_ERROR | 45, GPG_ERR_EINPROGRESS = GPG_ERR_SYSTEM_ERROR | 46, GPG_ERR_EINTR = GPG_ERR_SYSTEM_ERROR | 47, GPG_ERR_EINVAL = GPG_ERR_SYSTEM_ERROR | 48, GPG_ERR_EIO = GPG_ERR_SYSTEM_ERROR | 49, GPG_ERR_EISCONN = GPG_ERR_SYSTEM_ERROR | 50, GPG_ERR_EISDIR = GPG_ERR_SYSTEM_ERROR | 51, GPG_ERR_EISNAM = GPG_ERR_SYSTEM_ERROR | 52, GPG_ERR_EL2HLT = GPG_ERR_SYSTEM_ERROR | 53, GPG_ERR_EL2NSYNC = GPG_ERR_SYSTEM_ERROR | 54, GPG_ERR_EL3HLT = GPG_ERR_SYSTEM_ERROR | 55, GPG_ERR_EL3RST = GPG_ERR_SYSTEM_ERROR | 56, GPG_ERR_ELIBACC = GPG_ERR_SYSTEM_ERROR | 57, GPG_ERR_ELIBBAD = GPG_ERR_SYSTEM_ERROR | 58, GPG_ERR_ELIBEXEC = GPG_ERR_SYSTEM_ERROR | 59, GPG_ERR_ELIBMAX = GPG_ERR_SYSTEM_ERROR | 60, GPG_ERR_ELIBSCN = GPG_ERR_SYSTEM_ERROR | 61, GPG_ERR_ELNRNG = GPG_ERR_SYSTEM_ERROR | 62, GPG_ERR_ELOOP = GPG_ERR_SYSTEM_ERROR | 63, GPG_ERR_EMEDIUMTYPE = GPG_ERR_SYSTEM_ERROR | 64, GPG_ERR_EMFILE = GPG_ERR_SYSTEM_ERROR | 65, GPG_ERR_EMLINK = GPG_ERR_SYSTEM_ERROR | 66, GPG_ERR_EMSGSIZE = GPG_ERR_SYSTEM_ERROR | 67, GPG_ERR_EMULTIHOP = GPG_ERR_SYSTEM_ERROR | 68, GPG_ERR_ENAMETOOLONG = GPG_ERR_SYSTEM_ERROR | 69, GPG_ERR_ENAVAIL = GPG_ERR_SYSTEM_ERROR | 70, GPG_ERR_ENEEDAUTH = GPG_ERR_SYSTEM_ERROR | 71, GPG_ERR_ENETDOWN = GPG_ERR_SYSTEM_ERROR | 72, GPG_ERR_ENETRESET = GPG_ERR_SYSTEM_ERROR | 73, GPG_ERR_ENETUNREACH = GPG_ERR_SYSTEM_ERROR | 74, GPG_ERR_ENFILE = GPG_ERR_SYSTEM_ERROR | 75, GPG_ERR_ENOANO = GPG_ERR_SYSTEM_ERROR | 76, GPG_ERR_ENOBUFS = GPG_ERR_SYSTEM_ERROR | 77, GPG_ERR_ENOCSI = GPG_ERR_SYSTEM_ERROR | 78, GPG_ERR_ENODATA = GPG_ERR_SYSTEM_ERROR | 79, GPG_ERR_ENODEV = GPG_ERR_SYSTEM_ERROR | 80, GPG_ERR_ENOENT = GPG_ERR_SYSTEM_ERROR | 81, GPG_ERR_ENOEXEC = GPG_ERR_SYSTEM_ERROR | 82, GPG_ERR_ENOLCK = GPG_ERR_SYSTEM_ERROR | 83, GPG_ERR_ENOLINK = GPG_ERR_SYSTEM_ERROR | 84, GPG_ERR_ENOMEDIUM = GPG_ERR_SYSTEM_ERROR | 85, GPG_ERR_ENOMEM = GPG_ERR_SYSTEM_ERROR | 86, GPG_ERR_ENOMSG = GPG_ERR_SYSTEM_ERROR | 87, GPG_ERR_ENONET = GPG_ERR_SYSTEM_ERROR | 88, GPG_ERR_ENOPKG = GPG_ERR_SYSTEM_ERROR | 89, GPG_ERR_ENOPROTOOPT = GPG_ERR_SYSTEM_ERROR | 90, GPG_ERR_ENOSPC = GPG_ERR_SYSTEM_ERROR | 91, GPG_ERR_ENOSR = GPG_ERR_SYSTEM_ERROR | 92, GPG_ERR_ENOSTR = GPG_ERR_SYSTEM_ERROR | 93, GPG_ERR_ENOSYS = GPG_ERR_SYSTEM_ERROR | 94, GPG_ERR_ENOTBLK = GPG_ERR_SYSTEM_ERROR | 95, GPG_ERR_ENOTCONN = GPG_ERR_SYSTEM_ERROR | 96, GPG_ERR_ENOTDIR = GPG_ERR_SYSTEM_ERROR | 97, GPG_ERR_ENOTEMPTY = GPG_ERR_SYSTEM_ERROR | 98, GPG_ERR_ENOTNAM = GPG_ERR_SYSTEM_ERROR | 99, GPG_ERR_ENOTSOCK = GPG_ERR_SYSTEM_ERROR | 100, GPG_ERR_ENOTSUP = GPG_ERR_SYSTEM_ERROR | 101, GPG_ERR_ENOTTY = GPG_ERR_SYSTEM_ERROR | 102, GPG_ERR_ENOTUNIQ = GPG_ERR_SYSTEM_ERROR | 103, GPG_ERR_ENXIO = GPG_ERR_SYSTEM_ERROR | 104, GPG_ERR_EOPNOTSUPP = GPG_ERR_SYSTEM_ERROR | 105, GPG_ERR_EOVERFLOW = GPG_ERR_SYSTEM_ERROR | 106, GPG_ERR_EPERM = GPG_ERR_SYSTEM_ERROR | 107, GPG_ERR_EPFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 108, GPG_ERR_EPIPE = GPG_ERR_SYSTEM_ERROR | 109, GPG_ERR_EPROCLIM = GPG_ERR_SYSTEM_ERROR | 110, GPG_ERR_EPROCUNAVAIL = GPG_ERR_SYSTEM_ERROR | 111, GPG_ERR_EPROGMISMATCH = GPG_ERR_SYSTEM_ERROR | 112, GPG_ERR_EPROGUNAVAIL = GPG_ERR_SYSTEM_ERROR | 113, GPG_ERR_EPROTO = GPG_ERR_SYSTEM_ERROR | 114, GPG_ERR_EPROTONOSUPPORT = GPG_ERR_SYSTEM_ERROR | 115, GPG_ERR_EPROTOTYPE = GPG_ERR_SYSTEM_ERROR | 116, GPG_ERR_ERANGE = GPG_ERR_SYSTEM_ERROR | 117, GPG_ERR_EREMCHG = GPG_ERR_SYSTEM_ERROR | 118, GPG_ERR_EREMOTE = GPG_ERR_SYSTEM_ERROR | 119, GPG_ERR_EREMOTEIO = GPG_ERR_SYSTEM_ERROR | 120, GPG_ERR_ERESTART = GPG_ERR_SYSTEM_ERROR | 121, GPG_ERR_EROFS = GPG_ERR_SYSTEM_ERROR | 122, GPG_ERR_ERPCMISMATCH = GPG_ERR_SYSTEM_ERROR | 123, GPG_ERR_ESHUTDOWN = GPG_ERR_SYSTEM_ERROR | 124, GPG_ERR_ESOCKTNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 125, GPG_ERR_ESPIPE = GPG_ERR_SYSTEM_ERROR | 126, GPG_ERR_ESRCH = GPG_ERR_SYSTEM_ERROR | 127, GPG_ERR_ESRMNT = GPG_ERR_SYSTEM_ERROR | 128, GPG_ERR_ESTALE = GPG_ERR_SYSTEM_ERROR | 129, GPG_ERR_ESTRPIPE = GPG_ERR_SYSTEM_ERROR | 130, GPG_ERR_ETIME = GPG_ERR_SYSTEM_ERROR | 131, GPG_ERR_ETIMEDOUT = GPG_ERR_SYSTEM_ERROR | 132, GPG_ERR_ETOOMANYREFS = GPG_ERR_SYSTEM_ERROR | 133, GPG_ERR_ETXTBSY = GPG_ERR_SYSTEM_ERROR | 134, GPG_ERR_EUCLEAN = GPG_ERR_SYSTEM_ERROR | 135, GPG_ERR_EUNATCH = GPG_ERR_SYSTEM_ERROR | 136, GPG_ERR_EUSERS = GPG_ERR_SYSTEM_ERROR | 137, GPG_ERR_EWOULDBLOCK = GPG_ERR_SYSTEM_ERROR | 138, GPG_ERR_EXDEV = GPG_ERR_SYSTEM_ERROR | 139, GPG_ERR_EXFULL = GPG_ERR_SYSTEM_ERROR | 140, /* This is one more than the largest allowed entry. */ GPG_ERR_CODE_DIM = 65536 } gpg_err_code_t; /* The error value type gpg_error_t. */ /* We would really like to use bit-fields in a struct, but using structs as return values can cause binary compatibility issues, in particular if you want to do it effeciently (also see -freg-struct-return option to GCC). */ typedef unsigned int gpg_error_t; /* We use the lowest 16 bits of gpg_error_t for error codes. The 16th bit indicates system errors. */ #define GPG_ERR_CODE_MASK (GPG_ERR_CODE_DIM - 1) /* Bits 17 to 24 are reserved. */ /* We use the upper 7 bits of gpg_error_t for error sources. */ #define GPG_ERR_SOURCE_MASK (GPG_ERR_SOURCE_DIM - 1) #define GPG_ERR_SOURCE_SHIFT 24 /* The highest bit is reserved. It shouldn't be used to prevent potential negative numbers when transmitting error values as text. */ /* GCC feature test. */ #undef _GPG_ERR_HAVE_CONSTRUCTOR #if __GNUC__ #define _GPG_ERR_GCC_VERSION (__GNUC__ * 10000 \ + __GNUC_MINOR__ * 100 \ + __GNUC_PATCHLEVEL__) #if _GPG_ERR_GCC_VERSION > 30100 #define _GPG_ERR_CONSTRUCTOR __attribute__ ((__constructor__)) #define _GPG_ERR_HAVE_CONSTRUCTOR #endif #endif #ifndef _GPG_ERR_CONSTRUCTOR #define _GPG_ERR_CONSTRUCTOR #endif /* Initialization function. */ /* Initialize the library. This function should be run early. */ gpg_error_t gpg_err_init (void) _GPG_ERR_CONSTRUCTOR; /* If this is defined, the library is already initialized by the constructor and does not need to be initialized explicitely. */ #undef GPG_ERR_INITIALIZED #ifdef _GPG_ERR_HAVE_CONSTRUCTOR #define GPG_ERR_INITIALIZED 1 #endif /* See the source on how to use the deinit function; it is usually not required. */ void gpg_err_deinit (int mode); /* Constructor and accessor functions. */ /* Construct an error value from an error code and source. Within a subsystem, use gpg_error. */ static GPG_ERR_INLINE gpg_error_t gpg_err_make (gpg_err_source_t source, gpg_err_code_t code) { return code == GPG_ERR_NO_ERROR ? GPG_ERR_NO_ERROR : (((source & GPG_ERR_SOURCE_MASK) << GPG_ERR_SOURCE_SHIFT) | (code & GPG_ERR_CODE_MASK)); } /* The user should define GPG_ERR_SOURCE_DEFAULT before including this file to specify a default source for gpg_error. */ #ifndef GPG_ERR_SOURCE_DEFAULT #define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_UNKNOWN #endif static GPG_ERR_INLINE gpg_error_t gpg_error (gpg_err_code_t code) { return gpg_err_make (GPG_ERR_SOURCE_DEFAULT, code); } /* Retrieve the error code from an error value. */ static GPG_ERR_INLINE gpg_err_code_t gpg_err_code (gpg_error_t err) { return (gpg_err_code_t) (err & GPG_ERR_CODE_MASK); } /* Retrieve the error source from an error value. */ static GPG_ERR_INLINE gpg_err_source_t gpg_err_source (gpg_error_t err) { return (gpg_err_source_t) ((err >> GPG_ERR_SOURCE_SHIFT) & GPG_ERR_SOURCE_MASK); } /* String functions. */ /* Return a pointer to a string containing a description of the error code in the error value ERR. This function is not thread-safe. */ const char *gpg_strerror (gpg_error_t err); /* Return the error string for ERR in the user-supplied buffer BUF of size BUFLEN. This function is, in contrast to gpg_strerror, thread-safe if a thread-safe strerror_r() function is provided by the system. If the function succeeds, 0 is returned and BUF contains the string describing the error. If the buffer was not large enough, ERANGE is returned and BUF contains as much of the beginning of the error string as fits into the buffer. */ int gpg_strerror_r (gpg_error_t err, char *buf, size_t buflen); /* Return a pointer to a string containing a description of the error source in the error value ERR. */ const char *gpg_strsource (gpg_error_t err); /* Mapping of system errors (errno). */ /* Retrieve the error code for the system error ERR. This returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report this). */ gpg_err_code_t gpg_err_code_from_errno (int err); /* Retrieve the system error for the error code CODE. This returns 0 if CODE is not a system error code. */ int gpg_err_code_to_errno (gpg_err_code_t code); /* Retrieve the error code directly from the ERRNO variable. This returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report this) and GPG_ERR_MISSING_ERRNO if ERRNO has the value 0. */ gpg_err_code_t gpg_err_code_from_syserror (void); /* Set the ERRNO variable. This function is the preferred way to set ERRNO due to peculiarities on WindowsCE. */ void gpg_err_set_errno (int err); /* Return or check the version. */ const char *gpg_error_check_version (const char *req_version); /* The version string of this header. */ #define GPG_ERROR_VERSION "1.12" /* The version number of this header. */ #define GPG_ERROR_VERSION_NUMBER 0x010c00 /* Self-documenting convenience functions. */ static GPG_ERR_INLINE gpg_error_t gpg_err_make_from_errno (gpg_err_source_t source, int err) { return gpg_err_make (source, gpg_err_code_from_errno (err)); } static GPG_ERR_INLINE gpg_error_t gpg_error_from_errno (int err) { return gpg_error (gpg_err_code_from_errno (err)); } static GPG_ERR_INLINE gpg_error_t gpg_error_from_syserror (void) { return gpg_error (gpg_err_code_from_syserror ()); } #ifdef __cplusplus } #endif #endif /* GPG_ERROR_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������uuid/uuid.h�����������������������������������������������������������������������������������������0000644�����������������00000006341�14763166027�0006651 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Public include file for the UUID library * * Copyright (C) 1996, 1997, 1998 Theodore Ts'o. * * %Begin-Header% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, and the entire permission notice in its entirety, * including the disclaimer of warranties. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. * %End-Header% */ #ifndef _UUID_UUID_H #define _UUID_UUID_H #include <sys/types.h> #ifndef _WIN32 #include <sys/time.h> #endif #include <time.h> typedef unsigned char uuid_t[16]; /* UUID Variant definitions */ #define UUID_VARIANT_NCS 0 #define UUID_VARIANT_DCE 1 #define UUID_VARIANT_MICROSOFT 2 #define UUID_VARIANT_OTHER 3 /* UUID Type definitions */ #define UUID_TYPE_DCE_TIME 1 #define UUID_TYPE_DCE_RANDOM 4 /* Allow UUID constants to be defined */ #ifdef __GNUC__ #define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \ static const uuid_t name __attribute__ ((unused)) = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15} #else #define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \ static const uuid_t name = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15} #endif #ifdef __cplusplus extern "C" { #endif /* clear.c */ void uuid_clear(uuid_t uu); /* compare.c */ int uuid_compare(const uuid_t uu1, const uuid_t uu2); /* copy.c */ void uuid_copy(uuid_t dst, const uuid_t src); /* gen_uuid.c */ void uuid_generate(uuid_t out); void uuid_generate_random(uuid_t out); void uuid_generate_time(uuid_t out); int uuid_generate_time_safe(uuid_t out); /* isnull.c */ int uuid_is_null(const uuid_t uu); /* parse.c */ int uuid_parse(const char *in, uuid_t uu); /* unparse.c */ void uuid_unparse(const uuid_t uu, char *out); void uuid_unparse_lower(const uuid_t uu, char *out); void uuid_unparse_upper(const uuid_t uu, char *out); /* uuid_time.c */ time_t uuid_time(const uuid_t uu, struct timeval *ret_tv); int uuid_type(const uuid_t uu); int uuid_variant(const uuid_t uu); #ifdef __cplusplus } #endif #endif /* _UUID_UUID_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gettext-po.h����������������������������������������������������������������������������������������0000644�����������������00000036256�14763166027�0007045 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Public API for GNU gettext PO files - contained in libgettextpo. Copyright (C) 2003-2008, 2010, 2015-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. 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 3 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, see <http://www.gnu.org/licenses/>. */ #ifndef _GETTEXT_PO_H #define _GETTEXT_PO_H 1 #include <stdlib.h> #ifdef __cplusplus extern "C" { #endif /* =========================== Meta Information ============================ */ /* Version number: (major<<16) + (minor<<8) + subminor */ #define LIBGETTEXTPO_VERSION 0x001308 extern int libgettextpo_version; /* ================================= Types ================================= */ /* A po_file_t represents the contents of a PO file. */ typedef struct po_file *po_file_t; /* A po_message_iterator_t represents an iterator through a domain of a PO file. */ typedef struct po_message_iterator *po_message_iterator_t; /* A po_message_t represents a message in a PO file. */ typedef struct po_message *po_message_t; /* A po_filepos_t represents a string's position within a source file. */ typedef struct po_filepos *po_filepos_t; /* A po_error_handler handles error situations. */ struct po_error_handler { /* Signal an error. The error message is built from FORMAT and the following arguments. ERRNUM, if nonzero, is an errno value. Must increment the error_message_count variable declared in error.h. Must not return if STATUS is nonzero. */ void (*error) (int status, int errnum, const char *format, ...) #if ((__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3) && !__STRICT_ANSI__ __attribute__ ((__format__ (__printf__, 3, 4))) #endif ; /* Signal an error. The error message is built from FORMAT and the following arguments. The error location is at FILENAME line LINENO. ERRNUM, if nonzero, is an errno value. Must increment the error_message_count variable declared in error.h. Must not return if STATUS is nonzero. */ void (*error_at_line) (int status, int errnum, const char *filename, unsigned int lineno, const char *format, ...) #if ((__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3) && !__STRICT_ANSI__ __attribute__ ((__format__ (__printf__, 5, 6))) #endif ; /* Signal a multiline warning. The PREFIX applies to all lines of the MESSAGE. Free the PREFIX and MESSAGE when done. */ void (*multiline_warning) (char *prefix, char *message); /* Signal a multiline error. The PREFIX applies to all lines of the MESSAGE. Free the PREFIX and MESSAGE when done. Must increment the error_message_count variable declared in error.h if PREFIX is non-NULL. */ void (*multiline_error) (char *prefix, char *message); }; typedef const struct po_error_handler *po_error_handler_t; /* A po_xerror_handler handles warnings, error and fatal error situations. */ #define PO_SEVERITY_WARNING 0 /* just a warning, tell the user */ #define PO_SEVERITY_ERROR 1 /* an error, the operation cannot complete */ #define PO_SEVERITY_FATAL_ERROR 2 /* an error, the operation must be aborted */ struct po_xerror_handler { /* Signal a problem of the given severity. MESSAGE and/or FILENAME + LINENO indicate where the problem occurred. If FILENAME is NULL, FILENAME and LINENO and COLUMN should be ignored. If LINENO is (size_t)(-1), LINENO and COLUMN should be ignored. If COLUMN is (size_t)(-1), it should be ignored. MESSAGE_TEXT is the problem description (if MULTILINE_P is true, multiple lines of text, each terminated with a newline, otherwise usually a single line). Must not return if SEVERITY is PO_SEVERITY_FATAL_ERROR. */ void (*xerror) (int severity, po_message_t message, const char *filename, size_t lineno, size_t column, int multiline_p, const char *message_text); /* Signal a problem that refers to two messages. Similar to two calls to xerror. If possible, a "..." can be appended to MESSAGE_TEXT1 and prepended to MESSAGE_TEXT2. */ void (*xerror2) (int severity, po_message_t message1, const char *filename1, size_t lineno1, size_t column1, int multiline_p1, const char *message_text1, po_message_t message2, const char *filename2, size_t lineno2, size_t column2, int multiline_p2, const char *message_text2); }; typedef const struct po_xerror_handler *po_xerror_handler_t; /* Memory allocation: The memory allocations performed by these functions use xmalloc(), therefore will cause a program exit if memory is exhausted. The memory allocated by po_file_read, and implicitly returned through the po_message_* functions, lasts until freed with po_file_free. */ /* ============================= po_file_t API ============================= */ /* Create an empty PO file representation in memory. */ extern po_file_t po_file_create (void); /* Read a PO file into memory. Return its contents. Upon failure, return NULL and set errno. */ #define po_file_read po_file_read_v3 extern po_file_t po_file_read (const char *filename, po_xerror_handler_t handler); /* Write an in-memory PO file to a file. Upon failure, return NULL and set errno. */ #define po_file_write po_file_write_v2 extern po_file_t po_file_write (po_file_t file, const char *filename, po_xerror_handler_t handler); /* Free a PO file from memory. */ extern void po_file_free (po_file_t file); /* Return the names of the domains covered by a PO file in memory. */ extern const char * const * po_file_domains (po_file_t file); /* =========================== Header entry API ============================ */ /* Return the header entry of a domain of a PO file in memory. The domain NULL denotes the default domain. Return NULL if there is no header entry. */ extern const char * po_file_domain_header (po_file_t file, const char *domain); /* Return the value of a field in a header entry. The return value is either a freshly allocated string, to be freed by the caller, or NULL. */ extern char * po_header_field (const char *header, const char *field); /* Return the header entry with a given field set to a given value. The field is added if necessary. The return value is a freshly allocated string. */ extern char * po_header_set_field (const char *header, const char *field, const char *value); /* ======================= po_message_iterator_t API ======================= */ /* Create an iterator for traversing a domain of a PO file in memory. The domain NULL denotes the default domain. */ extern po_message_iterator_t po_message_iterator (po_file_t file, const char *domain); /* Free an iterator. */ extern void po_message_iterator_free (po_message_iterator_t iterator); /* Return the next message, and advance the iterator. Return NULL at the end of the message list. */ extern po_message_t po_next_message (po_message_iterator_t iterator); /* Insert a message in a PO file in memory, in the domain and at the position indicated by the iterator. The iterator thereby advances past the freshly inserted message. */ extern void po_message_insert (po_message_iterator_t iterator, po_message_t message); /* =========================== po_message_t API ============================ */ /* Return a freshly constructed message. To finish initializing the message, you must set the msgid and msgstr. */ extern po_message_t po_message_create (void); /* Return the context of a message, or NULL for a message not restricted to a context. */ extern const char * po_message_msgctxt (po_message_t message); /* Change the context of a message. NULL means a message not restricted to a context. */ extern void po_message_set_msgctxt (po_message_t message, const char *msgctxt); /* Return the msgid (untranslated English string) of a message. */ extern const char * po_message_msgid (po_message_t message); /* Change the msgid (untranslated English string) of a message. */ extern void po_message_set_msgid (po_message_t message, const char *msgid); /* Return the msgid_plural (untranslated English plural string) of a message, or NULL for a message without plural. */ extern const char * po_message_msgid_plural (po_message_t message); /* Change the msgid_plural (untranslated English plural string) of a message. NULL means a message without plural. */ extern void po_message_set_msgid_plural (po_message_t message, const char *msgid_plural); /* Return the msgstr (translation) of a message. Return the empty string for an untranslated message. */ extern const char * po_message_msgstr (po_message_t message); /* Change the msgstr (translation) of a message. Use an empty string to denote an untranslated message. */ extern void po_message_set_msgstr (po_message_t message, const char *msgstr); /* Return the msgstr[index] for a message with plural handling, or NULL when the index is out of range or for a message without plural. */ extern const char * po_message_msgstr_plural (po_message_t message, int index); /* Change the msgstr[index] for a message with plural handling. Use a NULL value at the end to reduce the number of plural forms. */ extern void po_message_set_msgstr_plural (po_message_t message, int index, const char *msgstr); /* Return the comments for a message. */ extern const char * po_message_comments (po_message_t message); /* Change the comments for a message. comments should be a multiline string, ending in a newline, or empty. */ extern void po_message_set_comments (po_message_t message, const char *comments); /* Return the extracted comments for a message. */ extern const char * po_message_extracted_comments (po_message_t message); /* Change the extracted comments for a message. comments should be a multiline string, ending in a newline, or empty. */ extern void po_message_set_extracted_comments (po_message_t message, const char *comments); /* Return the i-th file position for a message, or NULL if i is out of range. */ extern po_filepos_t po_message_filepos (po_message_t message, int i); /* Remove the i-th file position from a message. The indices of all following file positions for the message are decremented by one. */ extern void po_message_remove_filepos (po_message_t message, int i); /* Add a file position to a message, if it is not already present for the message. file is the file name. start_line is the line number where the string starts, or (size_t)(-1) if no line number is available. */ extern void po_message_add_filepos (po_message_t message, const char *file, size_t start_line); /* Return the previous context of a message, or NULL for none. */ extern const char * po_message_prev_msgctxt (po_message_t message); /* Change the previous context of a message. NULL is allowed. */ extern void po_message_set_prev_msgctxt (po_message_t message, const char *prev_msgctxt); /* Return the previous msgid (untranslated English string) of a message, or NULL for none. */ extern const char * po_message_prev_msgid (po_message_t message); /* Change the previous msgid (untranslated English string) of a message. NULL is allowed. */ extern void po_message_set_prev_msgid (po_message_t message, const char *prev_msgid); /* Return the previous msgid_plural (untranslated English plural string) of a message, or NULL for none. */ extern const char * po_message_prev_msgid_plural (po_message_t message); /* Change the previous msgid_plural (untranslated English plural string) of a message. NULL is allowed. */ extern void po_message_set_prev_msgid_plural (po_message_t message, const char *prev_msgid_plural); /* Return true if the message is marked obsolete. */ extern int po_message_is_obsolete (po_message_t message); /* Change the obsolete mark of a message. */ extern void po_message_set_obsolete (po_message_t message, int obsolete); /* Return true if the message is marked fuzzy. */ extern int po_message_is_fuzzy (po_message_t message); /* Change the fuzzy mark of a message. */ extern void po_message_set_fuzzy (po_message_t message, int fuzzy); /* Return true if the message is marked as being a format string of the given type (e.g. "c-format"). */ extern int po_message_is_format (po_message_t message, const char *format_type); /* Change the format string mark for a given type of a message. */ extern void po_message_set_format (po_message_t message, const char *format_type, /*bool*/int value); /* If a numeric range of a message is set, return true and store the minimum and maximum value in *MINP and *MAXP. */ extern int po_message_is_range (po_message_t message, int *minp, int *maxp); /* Change the numeric range of a message. MIN and MAX must be non-negative, with MIN < MAX. Use MIN = MAX = -1 to remove the numeric range of a message. */ extern void po_message_set_range (po_message_t message, int min, int max); /* =========================== po_filepos_t API ============================ */ /* Return the file name. */ extern const char * po_filepos_file (po_filepos_t filepos); /* Return the line number where the string starts, or (size_t)(-1) if no line number is available. */ extern size_t po_filepos_start_line (po_filepos_t filepos); /* ============================ Format type API ============================= */ /* Return a NULL terminated array of the supported format types. */ extern const char * const * po_format_list (void); /* Return the pretty name associated with a format type. For example, for "csharp-format", return "C#". Return NULL if the argument is not a supported format type. */ extern const char * po_format_pretty_name (const char *format_type); /* ============================= Checking API ============================== */ /* Test whether an entire file PO file is valid, like msgfmt does it. If it is invalid, pass the reasons to the handler. */ extern void po_file_check_all (po_file_t file, po_xerror_handler_t handler); /* Test a single message, to be inserted in a PO file in memory, like msgfmt does it. If it is invalid, pass the reasons to the handler. The iterator is not modified by this call; it only specifies the file and the domain. */ extern void po_message_check_all (po_message_t message, po_message_iterator_t iterator, po_xerror_handler_t handler); /* Test whether the message translation is a valid format string if the message is marked as being a format string. If it is invalid, pass the reasons to the handler. */ #define po_message_check_format po_message_check_format_v2 extern void po_message_check_format (po_message_t message, po_xerror_handler_t handler); #ifdef __cplusplus } #endif #endif /* _GETTEXT_PO_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������wctype.h��������������������������������������������������������������������������������������������0000644�����������������00000025623�14763166027�0006254 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996-2002,2005,2007-2009,2010,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 Standard: 7.25 * Wide character classification and mapping utilities <wctype.h> */ #ifndef _WCTYPE_H #include <features.h> #include <bits/types.h> #ifndef __need_iswxxx # define _WCTYPE_H 1 /* Get wint_t from <wchar.h>. */ # define __need_wint_t # include <wchar.h> /* Constant expression of type `wint_t' whose value does not correspond to any member of the extended character set. */ # ifndef WEOF # define WEOF (0xffffffffu) # endif #endif #undef __need_iswxxx /* The following part is also used in the <wcsmbs.h> header when compiled in the Unix98 compatibility mode. */ #ifndef __iswxxx_defined # define __iswxxx_defined 1 __BEGIN_NAMESPACE_C99 /* Scalar type that can hold values which represent locale-specific character classifications. */ typedef unsigned long int wctype_t; __END_NAMESPACE_C99 # ifndef _ISwbit /* The characteristics are stored always in network byte order (big endian). We define the bit value interpretations here dependent on the machine's byte order. */ # include <endian.h> # if __BYTE_ORDER == __BIG_ENDIAN # define _ISwbit(bit) (1 << (bit)) # else /* __BYTE_ORDER == __LITTLE_ENDIAN */ # define _ISwbit(bit) \ ((bit) < 8 ? (int) ((1UL << (bit)) << 24) \ : ((bit) < 16 ? (int) ((1UL << (bit)) << 8) \ : ((bit) < 24 ? (int) ((1UL << (bit)) >> 8) \ : (int) ((1UL << (bit)) >> 24)))) # endif enum { __ISwupper = 0, /* UPPERCASE. */ __ISwlower = 1, /* lowercase. */ __ISwalpha = 2, /* Alphabetic. */ __ISwdigit = 3, /* Numeric. */ __ISwxdigit = 4, /* Hexadecimal numeric. */ __ISwspace = 5, /* Whitespace. */ __ISwprint = 6, /* Printing. */ __ISwgraph = 7, /* Graphical. */ __ISwblank = 8, /* Blank (usually SPC and TAB). */ __ISwcntrl = 9, /* Control character. */ __ISwpunct = 10, /* Punctuation. */ __ISwalnum = 11, /* Alphanumeric. */ _ISwupper = _ISwbit (__ISwupper), /* UPPERCASE. */ _ISwlower = _ISwbit (__ISwlower), /* lowercase. */ _ISwalpha = _ISwbit (__ISwalpha), /* Alphabetic. */ _ISwdigit = _ISwbit (__ISwdigit), /* Numeric. */ _ISwxdigit = _ISwbit (__ISwxdigit), /* Hexadecimal numeric. */ _ISwspace = _ISwbit (__ISwspace), /* Whitespace. */ _ISwprint = _ISwbit (__ISwprint), /* Printing. */ _ISwgraph = _ISwbit (__ISwgraph), /* Graphical. */ _ISwblank = _ISwbit (__ISwblank), /* Blank (usually SPC and TAB). */ _ISwcntrl = _ISwbit (__ISwcntrl), /* Control character. */ _ISwpunct = _ISwbit (__ISwpunct), /* Punctuation. */ _ISwalnum = _ISwbit (__ISwalnum) /* Alphanumeric. */ }; # endif /* Not _ISwbit */ __BEGIN_DECLS __BEGIN_NAMESPACE_C99 /* * Wide-character classification functions: 7.15.2.1. */ /* Test for any wide character for which `iswalpha' or `iswdigit' is true. */ extern int iswalnum (wint_t __wc) __THROW; /* Test for any wide character for which `iswupper' or 'iswlower' is true, or any wide character that is one of a locale-specific set of wide-characters for which none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ extern int iswalpha (wint_t __wc) __THROW; /* Test for any control wide character. */ extern int iswcntrl (wint_t __wc) __THROW; /* Test for any wide character that corresponds to a decimal-digit character. */ extern int iswdigit (wint_t __wc) __THROW; /* Test for any wide character for which `iswprint' is true and `iswspace' is false. */ extern int iswgraph (wint_t __wc) __THROW; /* Test for any wide character that corresponds to a lowercase letter or is one of a locale-specific set of wide characters for which none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ extern int iswlower (wint_t __wc) __THROW; /* Test for any printing wide character. */ extern int iswprint (wint_t __wc) __THROW; /* Test for any printing wide character that is one of a locale-specific et of wide characters for which neither `iswspace' nor `iswalnum' is true. */ extern int iswpunct (wint_t __wc) __THROW; /* Test for any wide character that corresponds to a locale-specific set of wide characters for which none of `iswalnum', `iswgraph', or `iswpunct' is true. */ extern int iswspace (wint_t __wc) __THROW; /* Test for any wide character that corresponds to an uppercase letter or is one of a locale-specific set of wide character for which none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ extern int iswupper (wint_t __wc) __THROW; /* Test for any wide character that corresponds to a hexadecimal-digit character equivalent to that performed be the functions described in the previous subclause. */ extern int iswxdigit (wint_t __wc) __THROW; /* Test for any wide character that corresponds to a standard blank wide character or a locale-specific set of wide characters for which `iswalnum' is false. */ # ifdef __USE_ISOC99 extern int iswblank (wint_t __wc) __THROW; # endif /* * Extensible wide-character classification functions: 7.15.2.2. */ /* Construct value that describes a class of wide characters identified by the string argument PROPERTY. */ extern wctype_t wctype (const char *__property) __THROW; /* Determine whether the wide-character WC has the property described by DESC. */ extern int iswctype (wint_t __wc, wctype_t __desc) __THROW; __END_NAMESPACE_C99 /* * Wide-character case-mapping functions: 7.15.3.1. */ __BEGIN_NAMESPACE_C99 /* Scalar type that can hold values which represent locale-specific character mappings. */ typedef const __int32_t *wctrans_t; __END_NAMESPACE_C99 #ifdef __USE_GNU __USING_NAMESPACE_C99(wctrans_t) #endif __BEGIN_NAMESPACE_C99 /* Converts an uppercase letter to the corresponding lowercase letter. */ extern wint_t towlower (wint_t __wc) __THROW; /* Converts an lowercase letter to the corresponding uppercase letter. */ extern wint_t towupper (wint_t __wc) __THROW; __END_NAMESPACE_C99 __END_DECLS #endif /* need iswxxx. */ /* The remaining definitions and declarations must not appear in the <wchar.h> header. */ #ifdef _WCTYPE_H /* * Extensible wide-character mapping functions: 7.15.3.2. */ __BEGIN_DECLS __BEGIN_NAMESPACE_C99 /* Construct value that describes a mapping between wide characters identified by the string argument PROPERTY. */ extern wctrans_t wctrans (const char *__property) __THROW; /* Map the wide character WC using the mapping described by DESC. */ extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW; __END_NAMESPACE_C99 # ifdef __USE_XOPEN2K8 /* Declare the interface to extended locale model. */ # include <xlocale.h> /* Test for any wide character for which `iswalpha' or `iswdigit' is true. */ extern int iswalnum_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any wide character for which `iswupper' or 'iswlower' is true, or any wide character that is one of a locale-specific set of wide-characters for which none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ extern int iswalpha_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any control wide character. */ extern int iswcntrl_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any wide character that corresponds to a decimal-digit character. */ extern int iswdigit_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any wide character for which `iswprint' is true and `iswspace' is false. */ extern int iswgraph_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any wide character that corresponds to a lowercase letter or is one of a locale-specific set of wide characters for which none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ extern int iswlower_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any printing wide character. */ extern int iswprint_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any printing wide character that is one of a locale-specific et of wide characters for which neither `iswspace' nor `iswalnum' is true. */ extern int iswpunct_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any wide character that corresponds to a locale-specific set of wide characters for which none of `iswalnum', `iswgraph', or `iswpunct' is true. */ extern int iswspace_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any wide character that corresponds to an uppercase letter or is one of a locale-specific set of wide character for which none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ extern int iswupper_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any wide character that corresponds to a hexadecimal-digit character equivalent to that performed be the functions described in the previous subclause. */ extern int iswxdigit_l (wint_t __wc, __locale_t __locale) __THROW; /* Test for any wide character that corresponds to a standard blank wide character or a locale-specific set of wide characters for which `iswalnum' is false. */ extern int iswblank_l (wint_t __wc, __locale_t __locale) __THROW; /* Construct value that describes a class of wide characters identified by the string argument PROPERTY. */ extern wctype_t wctype_l (const char *__property, __locale_t __locale) __THROW; /* Determine whether the wide-character WC has the property described by DESC. */ extern int iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale) __THROW; /* * Wide-character case-mapping functions. */ /* Converts an uppercase letter to the corresponding lowercase letter. */ extern wint_t towlower_l (wint_t __wc, __locale_t __locale) __THROW; /* Converts an lowercase letter to the corresponding uppercase letter. */ extern wint_t towupper_l (wint_t __wc, __locale_t __locale) __THROW; /* Construct value that describes a mapping between wide characters identified by the string argument PROPERTY. */ extern wctrans_t wctrans_l (const char *__property, __locale_t __locale) __THROW; /* Map the wide character WC using the mapping described by DESC. */ extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc, __locale_t __locale) __THROW; # endif /* Use POSIX 2008. */ __END_DECLS #endif /* __WCTYPE_H defined. */ #endif /* wctype.h */ �������������������������������������������������������������������������������������������������������������jpeglib.h�������������������������������������������������������������������������������������������0000644�����������������00000142172�14763166027�0006354 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * jpeglib.h * * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1998, Thomas G. Lane. * Modified 2002-2009 by Guido Vollbeding. * Modifications: * Copyright (C) 2009-2011, 2013, D. R. Commander. * For conditions of distribution and use, see the accompanying README file. * * This file defines the application interface for the JPEG library. * Most applications using the library need only include this file, * and perhaps jerror.h if they want to know the exact error codes. */ #ifndef JPEGLIB_H #define JPEGLIB_H /* * First we include the configuration files that record how this * installation of the JPEG library is set up. jconfig.h can be * generated automatically for many systems. jmorecfg.h contains * manual configuration options that most people need not worry about. */ #ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */ #include "jconfig.h" /* widely used configuration options */ #endif #include "jmorecfg.h" /* seldom changed options */ #ifdef __cplusplus #ifndef DONT_USE_EXTERN_C extern "C" { #endif #endif /* Various constants determining the sizes of things. * All of these are specified by the JPEG standard, so don't change them * if you want to be compatible. */ #define DCTSIZE 8 /* The basic DCT block is 8x8 samples */ #define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */ #define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */ #define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */ #define NUM_ARITH_TBLS 16 /* Arith-coding tables are numbered 0..15 */ #define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */ #define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */ /* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard; * the PostScript DCT filter can emit files with many more than 10 blocks/MCU. * If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU * to handle it. We even let you do this from the jconfig.h file. However, * we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe * sometimes emits noncompliant files doesn't mean you should too. */ #define C_MAX_BLOCKS_IN_MCU 10 /* compressor's limit on blocks per MCU */ #ifndef D_MAX_BLOCKS_IN_MCU #define D_MAX_BLOCKS_IN_MCU 10 /* decompressor's limit on blocks per MCU */ #endif /* Data structures for images (arrays of samples and of DCT coefficients). * On 80x86 machines, the image arrays are too big for near pointers, * but the pointer arrays can fit in near memory. */ typedef JSAMPLE FAR *JSAMPROW; /* ptr to one image row of pixel samples. */ typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */ typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */ typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */ typedef JBLOCK FAR *JBLOCKROW; /* pointer to one row of coefficient blocks */ typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */ typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */ typedef JCOEF FAR *JCOEFPTR; /* useful in a couple of places */ /* Types for JPEG compression parameters and working tables. */ /* DCT coefficient quantization tables. */ typedef struct { /* This array gives the coefficient quantizers in natural array order * (not the zigzag order in which they are stored in a JPEG DQT marker). * CAUTION: IJG versions prior to v6a kept this array in zigzag order. */ UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */ /* This field is used only during compression. It's initialized FALSE when * the table is created, and set TRUE when it's been output to the file. * You could suppress output of a table by setting this to TRUE. * (See jpeg_suppress_tables for an example.) */ boolean sent_table; /* TRUE when table has been output */ } JQUANT_TBL; /* Huffman coding tables. */ typedef struct { /* These two fields directly represent the contents of a JPEG DHT marker */ UINT8 bits[17]; /* bits[k] = # of symbols with codes of */ /* length k bits; bits[0] is unused */ UINT8 huffval[256]; /* The symbols, in order of incr code length */ /* This field is used only during compression. It's initialized FALSE when * the table is created, and set TRUE when it's been output to the file. * You could suppress output of a table by setting this to TRUE. * (See jpeg_suppress_tables for an example.) */ boolean sent_table; /* TRUE when table has been output */ } JHUFF_TBL; /* Basic info about one component (color channel). */ typedef struct { /* These values are fixed over the whole image. */ /* For compression, they must be supplied by parameter setup; */ /* for decompression, they are read from the SOF marker. */ int component_id; /* identifier for this component (0..255) */ int component_index; /* its index in SOF or cinfo->comp_info[] */ int h_samp_factor; /* horizontal sampling factor (1..4) */ int v_samp_factor; /* vertical sampling factor (1..4) */ int quant_tbl_no; /* quantization table selector (0..3) */ /* These values may vary between scans. */ /* For compression, they must be supplied by parameter setup; */ /* for decompression, they are read from the SOS marker. */ /* The decompressor output side may not use these variables. */ int dc_tbl_no; /* DC entropy table selector (0..3) */ int ac_tbl_no; /* AC entropy table selector (0..3) */ /* Remaining fields should be treated as private by applications. */ /* These values are computed during compression or decompression startup: */ /* Component's size in DCT blocks. * Any dummy blocks added to complete an MCU are not counted; therefore * these values do not depend on whether a scan is interleaved or not. */ JDIMENSION width_in_blocks; JDIMENSION height_in_blocks; /* Size of a DCT block in samples. Always DCTSIZE for compression. * For decompression this is the size of the output from one DCT block, * reflecting any scaling we choose to apply during the IDCT step. * Values of 1,2,4,8 are likely to be supported. Note that different * components may receive different IDCT scalings. */ #if JPEG_LIB_VERSION >= 70 int DCT_h_scaled_size; int DCT_v_scaled_size; #else int DCT_scaled_size; #endif /* The downsampled dimensions are the component's actual, unpadded number * of samples at the main buffer (preprocessing/compression interface), thus * downsampled_width = ceil(image_width * Hi/Hmax) * and similarly for height. For decompression, IDCT scaling is included, so * downsampled_width = ceil(image_width * Hi/Hmax * DCT_[h_]scaled_size/DCTSIZE) */ JDIMENSION downsampled_width; /* actual width in samples */ JDIMENSION downsampled_height; /* actual height in samples */ /* This flag is used only for decompression. In cases where some of the * components will be ignored (eg grayscale output from YCbCr image), * we can skip most computations for the unused components. */ boolean component_needed; /* do we need the value of this component? */ /* These values are computed before starting a scan of the component. */ /* The decompressor output side may not use these variables. */ int MCU_width; /* number of blocks per MCU, horizontally */ int MCU_height; /* number of blocks per MCU, vertically */ int MCU_blocks; /* MCU_width * MCU_height */ int MCU_sample_width; /* MCU width in samples, MCU_width*DCT_[h_]scaled_size */ int last_col_width; /* # of non-dummy blocks across in last MCU */ int last_row_height; /* # of non-dummy blocks down in last MCU */ /* Saved quantization table for component; NULL if none yet saved. * See jdinput.c comments about the need for this information. * This field is currently used only for decompression. */ JQUANT_TBL * quant_table; /* Private per-component storage for DCT or IDCT subsystem. */ void * dct_table; } jpeg_component_info; /* The script for encoding a multiple-scan file is an array of these: */ typedef struct { int comps_in_scan; /* number of components encoded in this scan */ int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */ int Ss, Se; /* progressive JPEG spectral selection parms */ int Ah, Al; /* progressive JPEG successive approx. parms */ } jpeg_scan_info; /* The decompressor can save APPn and COM markers in a list of these: */ typedef struct jpeg_marker_struct FAR * jpeg_saved_marker_ptr; struct jpeg_marker_struct { jpeg_saved_marker_ptr next; /* next in list, or NULL */ UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */ unsigned int original_length; /* # bytes of data in the file */ unsigned int data_length; /* # bytes of data saved at data[] */ JOCTET FAR * data; /* the data contained in the marker */ /* the marker length word is not counted in data_length or original_length */ }; /* Known color spaces. */ #define JCS_EXTENSIONS 1 #define JCS_ALPHA_EXTENSIONS 1 typedef enum { JCS_UNKNOWN, /* error/unspecified */ JCS_GRAYSCALE, /* monochrome */ JCS_RGB, /* red/green/blue as specified by the RGB_RED, RGB_GREEN, RGB_BLUE, and RGB_PIXELSIZE macros */ JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */ JCS_CMYK, /* C/M/Y/K */ JCS_YCCK, /* Y/Cb/Cr/K */ JCS_EXT_RGB, /* red/green/blue */ JCS_EXT_RGBX, /* red/green/blue/x */ JCS_EXT_BGR, /* blue/green/red */ JCS_EXT_BGRX, /* blue/green/red/x */ JCS_EXT_XBGR, /* x/blue/green/red */ JCS_EXT_XRGB, /* x/red/green/blue */ /* When out_color_space it set to JCS_EXT_RGBX, JCS_EXT_BGRX, JCS_EXT_XBGR, or JCS_EXT_XRGB during decompression, the X byte is undefined, and in order to ensure the best performance, libjpeg-turbo can set that byte to whatever value it wishes. Use the following colorspace constants to ensure that the X byte is set to 0xFF, so that it can be interpreted as an opaque alpha channel. */ JCS_EXT_RGBA, /* red/green/blue/alpha */ JCS_EXT_BGRA, /* blue/green/red/alpha */ JCS_EXT_ABGR, /* alpha/blue/green/red */ JCS_EXT_ARGB /* alpha/red/green/blue */ } J_COLOR_SPACE; /* DCT/IDCT algorithm options. */ typedef enum { JDCT_ISLOW, /* slow but accurate integer algorithm */ JDCT_IFAST, /* faster, less accurate integer method */ JDCT_FLOAT /* floating-point: accurate, fast on fast HW */ } J_DCT_METHOD; #ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */ #define JDCT_DEFAULT JDCT_ISLOW #endif #ifndef JDCT_FASTEST /* may be overridden in jconfig.h */ #define JDCT_FASTEST JDCT_IFAST #endif /* Dithering options for decompression. */ typedef enum { JDITHER_NONE, /* no dithering */ JDITHER_ORDERED, /* simple ordered dither */ JDITHER_FS /* Floyd-Steinberg error diffusion dither */ } J_DITHER_MODE; /* Common fields between JPEG compression and decompression master structs. */ #define jpeg_common_fields \ struct jpeg_error_mgr * err; /* Error handler module */\ struct jpeg_memory_mgr * mem; /* Memory manager module */\ struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\ void * client_data; /* Available for use by application */\ boolean is_decompressor; /* So common code can tell which is which */\ int global_state /* For checking call sequence validity */ /* Routines that are to be used by both halves of the library are declared * to receive a pointer to this structure. There are no actual instances of * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct. */ struct jpeg_common_struct { jpeg_common_fields; /* Fields common to both master struct types */ /* Additional fields follow in an actual jpeg_compress_struct or * jpeg_decompress_struct. All three structs must agree on these * initial fields! (This would be a lot cleaner in C++.) */ }; typedef struct jpeg_common_struct * j_common_ptr; typedef struct jpeg_compress_struct * j_compress_ptr; typedef struct jpeg_decompress_struct * j_decompress_ptr; /* Master record for a compression instance */ struct jpeg_compress_struct { jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */ /* Destination for compressed data */ struct jpeg_destination_mgr * dest; /* Description of source image --- these fields must be filled in by * outer application before starting compression. in_color_space must * be correct before you can even call jpeg_set_defaults(). */ JDIMENSION image_width; /* input image width */ JDIMENSION image_height; /* input image height */ int input_components; /* # of color components in input image */ J_COLOR_SPACE in_color_space; /* colorspace of input image */ double input_gamma; /* image gamma of input image */ /* Compression parameters --- these fields must be set before calling * jpeg_start_compress(). We recommend calling jpeg_set_defaults() to * initialize everything to reasonable defaults, then changing anything * the application specifically wants to change. That way you won't get * burnt when new parameters are added. Also note that there are several * helper routines to simplify changing parameters. */ #if JPEG_LIB_VERSION >= 70 unsigned int scale_num, scale_denom; /* fraction by which to scale image */ JDIMENSION jpeg_width; /* scaled JPEG image width */ JDIMENSION jpeg_height; /* scaled JPEG image height */ /* Dimensions of actual JPEG image that will be written to file, * derived from input dimensions by scaling factors above. * These fields are computed by jpeg_start_compress(). * You can also use jpeg_calc_jpeg_dimensions() to determine these values * in advance of calling jpeg_start_compress(). */ #endif int data_precision; /* bits of precision in image data */ int num_components; /* # of color components in JPEG image */ J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ jpeg_component_info * comp_info; /* comp_info[i] describes component that appears i'th in SOF */ JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]; #if JPEG_LIB_VERSION >= 70 int q_scale_factor[NUM_QUANT_TBLS]; #endif /* ptrs to coefficient quantization tables, or NULL if not defined, * and corresponding scale factors (percentage, initialized 100). */ JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; /* ptrs to Huffman coding tables, or NULL if not defined */ UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ int num_scans; /* # of entries in scan_info array */ const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */ /* The default value of scan_info is NULL, which causes a single-scan * sequential JPEG file to be emitted. To create a multi-scan file, * set num_scans and scan_info to point to an array of scan definitions. */ boolean raw_data_in; /* TRUE=caller supplies downsampled data */ boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ boolean optimize_coding; /* TRUE=optimize entropy encoding parms */ boolean CCIR601_sampling; /* TRUE=first samples are cosited */ #if JPEG_LIB_VERSION >= 70 boolean do_fancy_downsampling; /* TRUE=apply fancy downsampling */ #endif int smoothing_factor; /* 1..100, or 0 for no input smoothing */ J_DCT_METHOD dct_method; /* DCT algorithm selector */ /* The restart interval can be specified in absolute MCUs by setting * restart_interval, or in MCU rows by setting restart_in_rows * (in which case the correct restart_interval will be figured * for each scan). */ unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */ int restart_in_rows; /* if > 0, MCU rows per restart interval */ /* Parameters controlling emission of special markers. */ boolean write_JFIF_header; /* should a JFIF marker be written? */ UINT8 JFIF_major_version; /* What to write for the JFIF version number */ UINT8 JFIF_minor_version; /* These three values are not used by the JPEG code, merely copied */ /* into the JFIF APP0 marker. density_unit can be 0 for unknown, */ /* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */ /* ratio is defined by X_density/Y_density even when density_unit=0. */ UINT8 density_unit; /* JFIF code for pixel size units */ UINT16 X_density; /* Horizontal pixel density */ UINT16 Y_density; /* Vertical pixel density */ boolean write_Adobe_marker; /* should an Adobe marker be written? */ /* State variable: index of next scanline to be written to * jpeg_write_scanlines(). Application may use this to control its * processing loop, e.g., "while (next_scanline < image_height)". */ JDIMENSION next_scanline; /* 0 .. image_height-1 */ /* Remaining fields are known throughout compressor, but generally * should not be touched by a surrounding application. */ /* * These fields are computed during compression startup */ boolean progressive_mode; /* TRUE if scan script uses progressive mode */ int max_h_samp_factor; /* largest h_samp_factor */ int max_v_samp_factor; /* largest v_samp_factor */ #if JPEG_LIB_VERSION >= 70 int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */ int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */ #endif JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */ /* The coefficient controller receives data in units of MCU rows as defined * for fully interleaved scans (whether the JPEG file is interleaved or not). * There are v_samp_factor * DCTSIZE sample rows of each component in an * "iMCU" (interleaved MCU) row. */ /* * These fields are valid during any one scan. * They describe the components and MCUs actually appearing in the scan. */ int comps_in_scan; /* # of JPEG components in this scan */ jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; /* *cur_comp_info[i] describes component that appears i'th in SOS */ JDIMENSION MCUs_per_row; /* # of MCUs across the image */ JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ int blocks_in_MCU; /* # of DCT blocks per MCU */ int MCU_membership[C_MAX_BLOCKS_IN_MCU]; /* MCU_membership[i] is index in cur_comp_info of component owning */ /* i'th block in an MCU */ int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ #if JPEG_LIB_VERSION >= 80 int block_size; /* the basic DCT block size: 1..16 */ const int * natural_order; /* natural-order position array */ int lim_Se; /* min( Se, DCTSIZE2-1 ) */ #endif /* * Links to compression subobjects (methods and private variables of modules) */ struct jpeg_comp_master * master; struct jpeg_c_main_controller * main; struct jpeg_c_prep_controller * prep; struct jpeg_c_coef_controller * coef; struct jpeg_marker_writer * marker; struct jpeg_color_converter * cconvert; struct jpeg_downsampler * downsample; struct jpeg_forward_dct * fdct; struct jpeg_entropy_encoder * entropy; jpeg_scan_info * script_space; /* workspace for jpeg_simple_progression */ int script_space_size; }; /* Master record for a decompression instance */ struct jpeg_decompress_struct { jpeg_common_fields; /* Fields shared with jpeg_compress_struct */ /* Source of compressed data */ struct jpeg_source_mgr * src; /* Basic description of image --- filled in by jpeg_read_header(). */ /* Application may inspect these values to decide how to process image. */ JDIMENSION image_width; /* nominal image width (from SOF marker) */ JDIMENSION image_height; /* nominal image height */ int num_components; /* # of color components in JPEG image */ J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ /* Decompression processing parameters --- these fields must be set before * calling jpeg_start_decompress(). Note that jpeg_read_header() initializes * them to default values. */ J_COLOR_SPACE out_color_space; /* colorspace for output */ unsigned int scale_num, scale_denom; /* fraction by which to scale image */ double output_gamma; /* image gamma wanted in output */ boolean buffered_image; /* TRUE=multiple output passes */ boolean raw_data_out; /* TRUE=downsampled data wanted */ J_DCT_METHOD dct_method; /* IDCT algorithm selector */ boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */ boolean do_block_smoothing; /* TRUE=apply interblock smoothing */ boolean quantize_colors; /* TRUE=colormapped output wanted */ /* the following are ignored if not quantize_colors: */ J_DITHER_MODE dither_mode; /* type of color dithering to use */ boolean two_pass_quantize; /* TRUE=use two-pass color quantization */ int desired_number_of_colors; /* max # colors to use in created colormap */ /* these are significant only in buffered-image mode: */ boolean enable_1pass_quant; /* enable future use of 1-pass quantizer */ boolean enable_external_quant;/* enable future use of external colormap */ boolean enable_2pass_quant; /* enable future use of 2-pass quantizer */ /* Description of actual output image that will be returned to application. * These fields are computed by jpeg_start_decompress(). * You can also use jpeg_calc_output_dimensions() to determine these values * in advance of calling jpeg_start_decompress(). */ JDIMENSION output_width; /* scaled image width */ JDIMENSION output_height; /* scaled image height */ int out_color_components; /* # of color components in out_color_space */ int output_components; /* # of color components returned */ /* output_components is 1 (a colormap index) when quantizing colors; * otherwise it equals out_color_components. */ int rec_outbuf_height; /* min recommended height of scanline buffer */ /* If the buffer passed to jpeg_read_scanlines() is less than this many rows * high, space and time will be wasted due to unnecessary data copying. * Usually rec_outbuf_height will be 1 or 2, at most 4. */ /* When quantizing colors, the output colormap is described by these fields. * The application can supply a colormap by setting colormap non-NULL before * calling jpeg_start_decompress; otherwise a colormap is created during * jpeg_start_decompress or jpeg_start_output. * The map has out_color_components rows and actual_number_of_colors columns. */ int actual_number_of_colors; /* number of entries in use */ JSAMPARRAY colormap; /* The color map as a 2-D pixel array */ /* State variables: these variables indicate the progress of decompression. * The application may examine these but must not modify them. */ /* Row index of next scanline to be read from jpeg_read_scanlines(). * Application may use this to control its processing loop, e.g., * "while (output_scanline < output_height)". */ JDIMENSION output_scanline; /* 0 .. output_height-1 */ /* Current input scan number and number of iMCU rows completed in scan. * These indicate the progress of the decompressor input side. */ int input_scan_number; /* Number of SOS markers seen so far */ JDIMENSION input_iMCU_row; /* Number of iMCU rows completed */ /* The "output scan number" is the notional scan being displayed by the * output side. The decompressor will not allow output scan/row number * to get ahead of input scan/row, but it can fall arbitrarily far behind. */ int output_scan_number; /* Nominal scan number being displayed */ JDIMENSION output_iMCU_row; /* Number of iMCU rows read */ /* Current progression status. coef_bits[c][i] indicates the precision * with which component c's DCT coefficient i (in zigzag order) is known. * It is -1 when no data has yet been received, otherwise it is the point * transform (shift) value for the most recent scan of the coefficient * (thus, 0 at completion of the progression). * This pointer is NULL when reading a non-progressive file. */ int (*coef_bits)[DCTSIZE2]; /* -1 or current Al value for each coef */ /* Internal JPEG parameters --- the application usually need not look at * these fields. Note that the decompressor output side may not use * any parameters that can change between scans. */ /* Quantization and Huffman tables are carried forward across input * datastreams when processing abbreviated JPEG datastreams. */ JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]; /* ptrs to coefficient quantization tables, or NULL if not defined */ JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; /* ptrs to Huffman coding tables, or NULL if not defined */ /* These parameters are never carried across datastreams, since they * are given in SOF/SOS markers or defined to be reset by SOI. */ int data_precision; /* bits of precision in image data */ jpeg_component_info * comp_info; /* comp_info[i] describes component that appears i'th in SOF */ #if JPEG_LIB_VERSION >= 80 boolean is_baseline; /* TRUE if Baseline SOF0 encountered */ #endif boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */ boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */ /* These fields record data obtained from optional markers recognized by * the JPEG library. */ boolean saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */ /* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */ UINT8 JFIF_major_version; /* JFIF version number */ UINT8 JFIF_minor_version; UINT8 density_unit; /* JFIF code for pixel size units */ UINT16 X_density; /* Horizontal pixel density */ UINT16 Y_density; /* Vertical pixel density */ boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */ UINT8 Adobe_transform; /* Color transform code from Adobe marker */ boolean CCIR601_sampling; /* TRUE=first samples are cosited */ /* Aside from the specific data retained from APPn markers known to the * library, the uninterpreted contents of any or all APPn and COM markers * can be saved in a list for examination by the application. */ jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */ /* Remaining fields are known throughout decompressor, but generally * should not be touched by a surrounding application. */ /* * These fields are computed during decompression startup */ int max_h_samp_factor; /* largest h_samp_factor */ int max_v_samp_factor; /* largest v_samp_factor */ #if JPEG_LIB_VERSION >= 70 int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */ int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */ #else int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */ #endif JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */ /* The coefficient controller's input and output progress is measured in * units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows * in fully interleaved JPEG scans, but are used whether the scan is * interleaved or not. We define an iMCU row as v_samp_factor DCT block * rows of each component. Therefore, the IDCT output contains * v_samp_factor*DCT_[v_]scaled_size sample rows of a component per iMCU row. */ JSAMPLE * sample_range_limit; /* table for fast range-limiting */ /* * These fields are valid during any one scan. * They describe the components and MCUs actually appearing in the scan. * Note that the decompressor output side must not use these fields. */ int comps_in_scan; /* # of JPEG components in this scan */ jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; /* *cur_comp_info[i] describes component that appears i'th in SOS */ JDIMENSION MCUs_per_row; /* # of MCUs across the image */ JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ int blocks_in_MCU; /* # of DCT blocks per MCU */ int MCU_membership[D_MAX_BLOCKS_IN_MCU]; /* MCU_membership[i] is index in cur_comp_info of component owning */ /* i'th block in an MCU */ int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ #if JPEG_LIB_VERSION >= 80 /* These fields are derived from Se of first SOS marker. */ int block_size; /* the basic DCT block size: 1..16 */ const int * natural_order; /* natural-order position array for entropy decode */ int lim_Se; /* min( Se, DCTSIZE2-1 ) for entropy decode */ #endif /* This field is shared between entropy decoder and marker parser. * It is either zero or the code of a JPEG marker that has been * read from the data source, but has not yet been processed. */ int unread_marker; /* * Links to decompression subobjects (methods, private variables of modules) */ struct jpeg_decomp_master * master; struct jpeg_d_main_controller * main; struct jpeg_d_coef_controller * coef; struct jpeg_d_post_controller * post; struct jpeg_input_controller * inputctl; struct jpeg_marker_reader * marker; struct jpeg_entropy_decoder * entropy; struct jpeg_inverse_dct * idct; struct jpeg_upsampler * upsample; struct jpeg_color_deconverter * cconvert; struct jpeg_color_quantizer * cquantize; }; /* "Object" declarations for JPEG modules that may be supplied or called * directly by the surrounding application. * As with all objects in the JPEG library, these structs only define the * publicly visible methods and state variables of a module. Additional * private fields may exist after the public ones. */ /* Error handler object */ struct jpeg_error_mgr { /* Error exit handler: does not return to caller */ JMETHOD(void, error_exit, (j_common_ptr cinfo)); /* Conditionally emit a trace or warning message */ JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level)); /* Routine that actually outputs a trace or error message */ JMETHOD(void, output_message, (j_common_ptr cinfo)); /* Format a message string for the most recent JPEG error or message */ JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer)); #define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */ /* Reset error state variables at start of a new image */ JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo)); /* The message ID code and any parameters are saved here. * A message can have one string parameter or up to 8 int parameters. */ int msg_code; #define JMSG_STR_PARM_MAX 80 union { int i[8]; char s[JMSG_STR_PARM_MAX]; } msg_parm; /* Standard state variables for error facility */ int trace_level; /* max msg_level that will be displayed */ /* For recoverable corrupt-data errors, we emit a warning message, * but keep going unless emit_message chooses to abort. emit_message * should count warnings in num_warnings. The surrounding application * can check for bad data by seeing if num_warnings is nonzero at the * end of processing. */ long num_warnings; /* number of corrupt-data warnings */ /* These fields point to the table(s) of error message strings. * An application can change the table pointer to switch to a different * message list (typically, to change the language in which errors are * reported). Some applications may wish to add additional error codes * that will be handled by the JPEG library error mechanism; the second * table pointer is used for this purpose. * * First table includes all errors generated by JPEG library itself. * Error code 0 is reserved for a "no such error string" message. */ const char * const * jpeg_message_table; /* Library errors */ int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */ /* Second table can be added by application (see cjpeg/djpeg for example). * It contains strings numbered first_addon_message..last_addon_message. */ const char * const * addon_message_table; /* Non-library errors */ int first_addon_message; /* code for first string in addon table */ int last_addon_message; /* code for last string in addon table */ }; /* Progress monitor object */ struct jpeg_progress_mgr { JMETHOD(void, progress_monitor, (j_common_ptr cinfo)); long pass_counter; /* work units completed in this pass */ long pass_limit; /* total number of work units in this pass */ int completed_passes; /* passes completed so far */ int total_passes; /* total number of passes expected */ }; /* Data destination object for compression */ struct jpeg_destination_mgr { JOCTET * next_output_byte; /* => next byte to write in buffer */ size_t free_in_buffer; /* # of byte spaces remaining in buffer */ JMETHOD(void, init_destination, (j_compress_ptr cinfo)); JMETHOD(boolean, empty_output_buffer, (j_compress_ptr cinfo)); JMETHOD(void, term_destination, (j_compress_ptr cinfo)); }; /* Data source object for decompression */ struct jpeg_source_mgr { const JOCTET * next_input_byte; /* => next byte to read from buffer */ size_t bytes_in_buffer; /* # of bytes remaining in buffer */ JMETHOD(void, init_source, (j_decompress_ptr cinfo)); JMETHOD(boolean, fill_input_buffer, (j_decompress_ptr cinfo)); JMETHOD(void, skip_input_data, (j_decompress_ptr cinfo, long num_bytes)); JMETHOD(boolean, resync_to_restart, (j_decompress_ptr cinfo, int desired)); JMETHOD(void, term_source, (j_decompress_ptr cinfo)); }; /* Memory manager object. * Allocates "small" objects (a few K total), "large" objects (tens of K), * and "really big" objects (virtual arrays with backing store if needed). * The memory manager does not allow individual objects to be freed; rather, * each created object is assigned to a pool, and whole pools can be freed * at once. This is faster and more convenient than remembering exactly what * to free, especially where malloc()/free() are not too speedy. * NB: alloc routines never return NULL. They exit to error_exit if not * successful. */ #define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */ #define JPOOL_IMAGE 1 /* lasts until done with image/datastream */ #define JPOOL_NUMPOOLS 2 typedef struct jvirt_sarray_control * jvirt_sarray_ptr; typedef struct jvirt_barray_control * jvirt_barray_ptr; struct jpeg_memory_mgr { /* Method pointers */ JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id, size_t sizeofobject)); JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id, size_t sizeofobject)); JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id, JDIMENSION samplesperrow, JDIMENSION numrows)); JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id, JDIMENSION blocksperrow, JDIMENSION numrows)); JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo, int pool_id, boolean pre_zero, JDIMENSION samplesperrow, JDIMENSION numrows, JDIMENSION maxaccess)); JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo, int pool_id, boolean pre_zero, JDIMENSION blocksperrow, JDIMENSION numrows, JDIMENSION maxaccess)); JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo)); JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo, jvirt_sarray_ptr ptr, JDIMENSION start_row, JDIMENSION num_rows, boolean writable)); JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo, jvirt_barray_ptr ptr, JDIMENSION start_row, JDIMENSION num_rows, boolean writable)); JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id)); JMETHOD(void, self_destruct, (j_common_ptr cinfo)); /* Limit on memory allocation for this JPEG object. (Note that this is * merely advisory, not a guaranteed maximum; it only affects the space * used for virtual-array buffers.) May be changed by outer application * after creating the JPEG object. */ long max_memory_to_use; /* Maximum allocation request accepted by alloc_large. */ long max_alloc_chunk; }; /* Routine signature for application-supplied marker processing methods. * Need not pass marker code since it is stored in cinfo->unread_marker. */ typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo)); /* Declarations for routines called by application. * The JPP macro hides prototype parameters from compilers that can't cope. * Note JPP requires double parentheses. */ #ifdef HAVE_PROTOTYPES #define JPP(arglist) arglist #else #define JPP(arglist) () #endif /* Short forms of external names for systems with brain-damaged linkers. * We shorten external names to be unique in the first six letters, which * is good enough for all known systems. * (If your compiler itself needs names to be unique in less than 15 * characters, you are out of luck. Get a better compiler.) */ #ifdef NEED_SHORT_EXTERNAL_NAMES #define jpeg_std_error jStdError #define jpeg_CreateCompress jCreaCompress #define jpeg_CreateDecompress jCreaDecompress #define jpeg_destroy_compress jDestCompress #define jpeg_destroy_decompress jDestDecompress #define jpeg_stdio_dest jStdDest #define jpeg_stdio_src jStdSrc #if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED) #define jpeg_mem_dest jMemDest #define jpeg_mem_src jMemSrc #endif #define jpeg_set_defaults jSetDefaults #define jpeg_set_colorspace jSetColorspace #define jpeg_default_colorspace jDefColorspace #define jpeg_set_quality jSetQuality #define jpeg_set_linear_quality jSetLQuality #if JPEG_LIB_VERSION >= 70 #define jpeg_default_qtables jDefQTables #endif #define jpeg_add_quant_table jAddQuantTable #define jpeg_quality_scaling jQualityScaling #define jpeg_simple_progression jSimProgress #define jpeg_suppress_tables jSuppressTables #define jpeg_alloc_quant_table jAlcQTable #define jpeg_alloc_huff_table jAlcHTable #define jpeg_start_compress jStrtCompress #define jpeg_write_scanlines jWrtScanlines #define jpeg_finish_compress jFinCompress #if JPEG_LIB_VERSION >= 70 #define jpeg_calc_jpeg_dimensions jCjpegDimensions #endif #define jpeg_write_raw_data jWrtRawData #define jpeg_write_marker jWrtMarker #define jpeg_write_m_header jWrtMHeader #define jpeg_write_m_byte jWrtMByte #define jpeg_write_tables jWrtTables #define jpeg_read_header jReadHeader #define jpeg_start_decompress jStrtDecompress #define jpeg_read_scanlines jReadScanlines #define jpeg_finish_decompress jFinDecompress #define jpeg_read_raw_data jReadRawData #define jpeg_has_multiple_scans jHasMultScn #define jpeg_start_output jStrtOutput #define jpeg_finish_output jFinOutput #define jpeg_input_complete jInComplete #define jpeg_new_colormap jNewCMap #define jpeg_consume_input jConsumeInput #if JPEG_LIB_VERSION >= 80 #define jpeg_core_output_dimensions jCoreDimensions #endif #define jpeg_calc_output_dimensions jCalcDimensions #define jpeg_save_markers jSaveMarkers #define jpeg_set_marker_processor jSetMarker #define jpeg_read_coefficients jReadCoefs #define jpeg_write_coefficients jWrtCoefs #define jpeg_copy_critical_parameters jCopyCrit #define jpeg_abort_compress jAbrtCompress #define jpeg_abort_decompress jAbrtDecompress #define jpeg_abort jAbort #define jpeg_destroy jDestroy #define jpeg_resync_to_restart jResyncRestart #endif /* NEED_SHORT_EXTERNAL_NAMES */ /* Default error-management setup */ EXTERN(struct jpeg_error_mgr *) jpeg_std_error JPP((struct jpeg_error_mgr * err)); /* Initialization of JPEG compression objects. * jpeg_create_compress() and jpeg_create_decompress() are the exported * names that applications should call. These expand to calls on * jpeg_CreateCompress and jpeg_CreateDecompress with additional information * passed for version mismatch checking. * NB: you must set up the error-manager BEFORE calling jpeg_create_xxx. */ #define jpeg_create_compress(cinfo) \ jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \ (size_t) sizeof(struct jpeg_compress_struct)) #define jpeg_create_decompress(cinfo) \ jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \ (size_t) sizeof(struct jpeg_decompress_struct)) EXTERN(void) jpeg_CreateCompress JPP((j_compress_ptr cinfo, int version, size_t structsize)); EXTERN(void) jpeg_CreateDecompress JPP((j_decompress_ptr cinfo, int version, size_t structsize)); /* Destruction of JPEG compression objects */ EXTERN(void) jpeg_destroy_compress JPP((j_compress_ptr cinfo)); EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo)); /* Standard data source and destination managers: stdio streams. */ /* Caller is responsible for opening the file before and closing after. */ EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile)); EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile)); #if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED) /* Data source and destination managers: memory buffers. */ EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo, unsigned char ** outbuffer, unsigned long * outsize)); EXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo, unsigned char * inbuffer, unsigned long insize)); #endif /* Default parameter setup for compression */ EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo)); /* Compression parameter setup aids */ EXTERN(void) jpeg_set_colorspace JPP((j_compress_ptr cinfo, J_COLOR_SPACE colorspace)); EXTERN(void) jpeg_default_colorspace JPP((j_compress_ptr cinfo)); EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality, boolean force_baseline)); EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo, int scale_factor, boolean force_baseline)); #if JPEG_LIB_VERSION >= 70 EXTERN(void) jpeg_default_qtables JPP((j_compress_ptr cinfo, boolean force_baseline)); #endif EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl, const unsigned int *basic_table, int scale_factor, boolean force_baseline)); EXTERN(int) jpeg_quality_scaling JPP((int quality)); EXTERN(void) jpeg_simple_progression JPP((j_compress_ptr cinfo)); EXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo, boolean suppress)); EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table JPP((j_common_ptr cinfo)); EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table JPP((j_common_ptr cinfo)); /* Main entry points for compression */ EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo, boolean write_all_tables)); EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION num_lines)); EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo)); #if JPEG_LIB_VERSION >= 70 /* Precalculate JPEG dimensions for current compression parameters. */ EXTERN(void) jpeg_calc_jpeg_dimensions JPP((j_compress_ptr cinfo)); #endif /* Replaces jpeg_write_scanlines when writing raw downsampled data. */ EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo, JSAMPIMAGE data, JDIMENSION num_lines)); /* Write a special marker. See libjpeg.txt concerning safe usage. */ EXTERN(void) jpeg_write_marker JPP((j_compress_ptr cinfo, int marker, const JOCTET * dataptr, unsigned int datalen)); /* Same, but piecemeal. */ EXTERN(void) jpeg_write_m_header JPP((j_compress_ptr cinfo, int marker, unsigned int datalen)); EXTERN(void) jpeg_write_m_byte JPP((j_compress_ptr cinfo, int val)); /* Alternate compression function: just write an abbreviated table file */ EXTERN(void) jpeg_write_tables JPP((j_compress_ptr cinfo)); /* Decompression startup: read start of JPEG datastream to see what's there */ EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo, boolean require_image)); /* Return value is one of: */ #define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */ #define JPEG_HEADER_OK 1 /* Found valid image datastream */ #define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */ /* If you pass require_image = TRUE (normal case), you need not check for * a TABLES_ONLY return code; an abbreviated file will cause an error exit. * JPEG_SUSPENDED is only possible if you use a data source module that can * give a suspension return (the stdio source module doesn't). */ /* Main entry points for decompression */ EXTERN(boolean) jpeg_start_decompress JPP((j_decompress_ptr cinfo)); EXTERN(JDIMENSION) jpeg_read_scanlines JPP((j_decompress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION max_lines)); EXTERN(boolean) jpeg_finish_decompress JPP((j_decompress_ptr cinfo)); /* Replaces jpeg_read_scanlines when reading raw downsampled data. */ EXTERN(JDIMENSION) jpeg_read_raw_data JPP((j_decompress_ptr cinfo, JSAMPIMAGE data, JDIMENSION max_lines)); /* Additional entry points for buffered-image mode. */ EXTERN(boolean) jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo)); EXTERN(boolean) jpeg_start_output JPP((j_decompress_ptr cinfo, int scan_number)); EXTERN(boolean) jpeg_finish_output JPP((j_decompress_ptr cinfo)); EXTERN(boolean) jpeg_input_complete JPP((j_decompress_ptr cinfo)); EXTERN(void) jpeg_new_colormap JPP((j_decompress_ptr cinfo)); EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo)); /* Return value is one of: */ /* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */ #define JPEG_REACHED_SOS 1 /* Reached start of new scan */ #define JPEG_REACHED_EOI 2 /* Reached end of image */ #define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */ #define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */ /* Precalculate output dimensions for current decompression parameters. */ #if JPEG_LIB_VERSION >= 80 EXTERN(void) jpeg_core_output_dimensions JPP((j_decompress_ptr cinfo)); #endif EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo)); /* Control saving of COM and APPn markers into marker_list. */ EXTERN(void) jpeg_save_markers JPP((j_decompress_ptr cinfo, int marker_code, unsigned int length_limit)); /* Install a special processing method for COM or APPn markers. */ EXTERN(void) jpeg_set_marker_processor JPP((j_decompress_ptr cinfo, int marker_code, jpeg_marker_parser_method routine)); /* Read or write raw DCT coefficients --- useful for lossless transcoding. */ EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients JPP((j_decompress_ptr cinfo)); EXTERN(void) jpeg_write_coefficients JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)); EXTERN(void) jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo)); /* If you choose to abort compression or decompression before completing * jpeg_finish_(de)compress, then you need to clean up to release memory, * temporary files, etc. You can just call jpeg_destroy_(de)compress * if you're done with the JPEG object, but if you want to clean it up and * reuse it, call this: */ EXTERN(void) jpeg_abort_compress JPP((j_compress_ptr cinfo)); EXTERN(void) jpeg_abort_decompress JPP((j_decompress_ptr cinfo)); /* Generic versions of jpeg_abort and jpeg_destroy that work on either * flavor of JPEG object. These may be more convenient in some places. */ EXTERN(void) jpeg_abort JPP((j_common_ptr cinfo)); EXTERN(void) jpeg_destroy JPP((j_common_ptr cinfo)); /* Default restart-marker-resync procedure for use by data source modules */ EXTERN(boolean) jpeg_resync_to_restart JPP((j_decompress_ptr cinfo, int desired)); /* These marker codes are exported since applications and data source modules * are likely to want to use them. */ #define JPEG_RST0 0xD0 /* RST0 marker code */ #define JPEG_EOI 0xD9 /* EOI marker code */ #define JPEG_APP0 0xE0 /* APP0 marker code */ #define JPEG_COM 0xFE /* COM marker code */ /* If we have a brain-damaged compiler that emits warnings (or worse, errors) * for structure definitions that are never filled in, keep it quiet by * supplying dummy definitions for the various substructures. */ #ifdef INCOMPLETE_TYPES_BROKEN #ifndef JPEG_INTERNALS /* will be defined in jpegint.h */ struct jvirt_sarray_control { long dummy; }; struct jvirt_barray_control { long dummy; }; struct jpeg_comp_master { long dummy; }; struct jpeg_c_main_controller { long dummy; }; struct jpeg_c_prep_controller { long dummy; }; struct jpeg_c_coef_controller { long dummy; }; struct jpeg_marker_writer { long dummy; }; struct jpeg_color_converter { long dummy; }; struct jpeg_downsampler { long dummy; }; struct jpeg_forward_dct { long dummy; }; struct jpeg_entropy_encoder { long dummy; }; struct jpeg_decomp_master { long dummy; }; struct jpeg_d_main_controller { long dummy; }; struct jpeg_d_coef_controller { long dummy; }; struct jpeg_d_post_controller { long dummy; }; struct jpeg_input_controller { long dummy; }; struct jpeg_marker_reader { long dummy; }; struct jpeg_entropy_decoder { long dummy; }; struct jpeg_inverse_dct { long dummy; }; struct jpeg_upsampler { long dummy; }; struct jpeg_color_deconverter { long dummy; }; struct jpeg_color_quantizer { long dummy; }; #endif /* JPEG_INTERNALS */ #endif /* INCOMPLETE_TYPES_BROKEN */ /* * The JPEG library modules define JPEG_INTERNALS before including this file. * The internal structure declarations are read only when that is true. * Applications using the library should not include jpegint.h, but may wish * to include jerror.h. */ #ifdef JPEG_INTERNALS #include "jpegint.h" /* fetch private declarations */ #include "jerror.h" /* fetch error codes too */ #endif #ifdef __cplusplus #ifndef DONT_USE_EXTERN_C } #endif #endif #endif /* JPEGLIB_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pg_config_x86_64.h����������������������������������������������������������������������������������0000644�����������������00000064665�14763166027�0007723 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/pg_config.h. Generated from pg_config.h.in by configure. */ /* src/include/pg_config.h.in. Generated from configure.in by autoheader. */ /* Define to the type of arg 1 of 'accept' */ #define ACCEPT_TYPE_ARG1 int /* Define to the type of arg 2 of 'accept' */ #define ACCEPT_TYPE_ARG2 struct sockaddr * /* Define to the type of arg 3 of 'accept' */ #define ACCEPT_TYPE_ARG3 socklen_t /* Define to the return type of 'accept' */ #define ACCEPT_TYPE_RETURN int /* Define if building universal (internal helper macro) */ /* #undef AC_APPLE_UNIVERSAL_BUILD */ /* The normal alignment of `double', in bytes. */ #define ALIGNOF_DOUBLE 8 /* The normal alignment of `int', in bytes. */ #define ALIGNOF_INT 4 /* The normal alignment of `long', in bytes. */ #define ALIGNOF_LONG 8 /* The normal alignment of `long long int', in bytes. */ /* #undef ALIGNOF_LONG_LONG_INT */ /* The normal alignment of `short', in bytes. */ #define ALIGNOF_SHORT 2 /* Size of a disk block --- this also limits the size of a tuple. You can set it bigger if you need bigger tuples (although TOAST should reduce the need to have large tuples, since fields can be spread across multiple tuples). BLCKSZ must be a power of 2. The maximum possible value of BLCKSZ is currently 2^15 (32768). This is determined by the 15-bit widths of the lp_off and lp_len fields in ItemIdData (see include/storage/itemid.h). Changing BLCKSZ requires an initdb. */ #define BLCKSZ 8192 /* Define to the default TCP port number on which the server listens and to which clients will try to connect. This can be overridden at run-time, but it's convenient if your clients have the right default compiled in. (--with-pgport=PORTNUM) */ #define DEF_PGPORT 5432 /* Define to the default TCP port number as a string constant. */ #define DEF_PGPORT_STR "5432" /* Define to build with GSSAPI support. (--with-gssapi) */ #define ENABLE_GSS 1 /* Define to 1 if you want National Language Support. (--enable-nls) */ #define ENABLE_NLS 1 /* Define to 1 to build client libraries as thread-safe code. (--enable-thread-safety) */ #define ENABLE_THREAD_SAFETY 1 /* Define to nothing if C supports flexible array members, and to 1 if it does not. That way, with a declaration like `struct s { int n; double d[FLEXIBLE_ARRAY_MEMBER]; };', the struct hack can be used with pre-C99 compilers. When computing the size of such an object, don't use 'sizeof (struct s)' as it overestimates the size. Use 'offsetof (struct s, d)' instead. Don't use 'offsetof (struct s, d[0])', as this doesn't work with MSVC and with C++ compilers. */ #define FLEXIBLE_ARRAY_MEMBER /**/ /* float4 values are passed by value if 'true', by reference if 'false' */ #define FLOAT4PASSBYVAL true /* float8, int8, and related values are passed by value if 'true', by reference if 'false' */ #define FLOAT8PASSBYVAL true /* Define to 1 if getpwuid_r() takes a 5th argument. */ #define GETPWUID_R_5ARG /**/ /* Define to 1 if gettimeofday() takes only 1 argument. */ /* #undef GETTIMEOFDAY_1ARG */ #ifdef GETTIMEOFDAY_1ARG # define gettimeofday(a,b) gettimeofday(a) #endif /* Define to 1 if you have the `append_history' function. */ #define HAVE_APPEND_HISTORY 1 /* Define to 1 if you have the `ASN1_STRING_get0_data' function. */ /* #undef HAVE_ASN1_STRING_GET0_DATA */ /* Define to 1 if you have the `BIO_meth_new' function. */ /* #undef HAVE_BIO_METH_NEW */ /* Define to 1 if you have the `cbrt' function. */ #define HAVE_CBRT 1 /* Define to 1 if you have the `class' function. */ /* #undef HAVE_CLASS */ /* Define to 1 if you have the <crtdefs.h> header file. */ /* #undef HAVE_CRTDEFS_H */ /* Define to 1 if you have the `crypt' function. */ #define HAVE_CRYPT 1 /* Define to 1 if you have the `CRYPTO_lock' function. */ #define HAVE_CRYPTO_LOCK 1 /* Define to 1 if you have the <crypt.h> header file. */ #define HAVE_CRYPT_H 1 /* Define to 1 if you have the declaration of `fdatasync', and to 0 if you don't. */ #define HAVE_DECL_FDATASYNC 1 /* Define to 1 if you have the declaration of `F_FULLFSYNC', and to 0 if you don't. */ #define HAVE_DECL_F_FULLFSYNC 0 /* Define to 1 if you have the declaration of `posix_fadvise', and to 0 if you don't. */ #define HAVE_DECL_POSIX_FADVISE 1 /* Define to 1 if you have the declaration of `snprintf', and to 0 if you don't. */ #define HAVE_DECL_SNPRINTF 1 /* Define to 1 if you have the declaration of `strlcat', and to 0 if you don't. */ #define HAVE_DECL_STRLCAT 0 /* Define to 1 if you have the declaration of `strlcpy', and to 0 if you don't. */ #define HAVE_DECL_STRLCPY 0 /* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you don't. */ #define HAVE_DECL_SYS_SIGLIST 1 /* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you don't. */ #define HAVE_DECL_VSNPRINTF 1 /* Define to 1 if you have the <dld.h> header file. */ /* #undef HAVE_DLD_H */ /* Define to 1 if you have the `dlopen' function. */ #define HAVE_DLOPEN 1 /* Define to 1 if you have the <editline/history.h> header file. */ /* #undef HAVE_EDITLINE_HISTORY_H */ /* Define to 1 if you have the <editline/readline.h> header file. */ /* #undef HAVE_EDITLINE_READLINE_H */ /* Define to 1 if you have the `fdatasync' function. */ #define HAVE_FDATASYNC 1 /* Define to 1 if you have the `fls' function. */ /* #undef HAVE_FLS */ /* Define to 1 if you have the `fpclass' function. */ /* #undef HAVE_FPCLASS */ /* Define to 1 if you have the `fp_class' function. */ /* #undef HAVE_FP_CLASS */ /* Define to 1 if you have the `fp_class_d' function. */ /* #undef HAVE_FP_CLASS_D */ /* Define to 1 if you have the <fp_class.h> header file. */ /* #undef HAVE_FP_CLASS_H */ /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ #define HAVE_FSEEKO 1 /* Define to 1 if your compiler understands __func__. */ #define HAVE_FUNCNAME__FUNC 1 /* Define to 1 if your compiler understands __FUNCTION__. */ /* #undef HAVE_FUNCNAME__FUNCTION */ /* Define to 1 if you have __sync_lock_test_and_set(int *) and friends. */ #define HAVE_GCC_INT_ATOMICS 1 /* Define to 1 if you have the `getaddrinfo' function. */ #define HAVE_GETADDRINFO 1 /* Define to 1 if you have the `gethostbyname_r' function. */ #define HAVE_GETHOSTBYNAME_R 1 /* Define to 1 if you have the `getifaddrs' function. */ #define HAVE_GETIFADDRS 1 /* Define to 1 if you have the `getopt' function. */ #define HAVE_GETOPT 1 /* Define to 1 if you have the <getopt.h> header file. */ #define HAVE_GETOPT_H 1 /* Define to 1 if you have the `getopt_long' function. */ #define HAVE_GETOPT_LONG 1 /* Define to 1 if you have the `getpeereid' function. */ /* #undef HAVE_GETPEEREID */ /* Define to 1 if you have the `getpeerucred' function. */ /* #undef HAVE_GETPEERUCRED */ /* Define to 1 if you have the `getpwuid_r' function. */ #define HAVE_GETPWUID_R 1 /* Define to 1 if you have the `getrlimit' function. */ #define HAVE_GETRLIMIT 1 /* Define to 1 if you have the `getrusage' function. */ #define HAVE_GETRUSAGE 1 /* Define to 1 if you have the `gettimeofday' function. */ /* #undef HAVE_GETTIMEOFDAY */ /* Define to 1 if you have the <gssapi/gssapi.h> header file. */ #define HAVE_GSSAPI_GSSAPI_H 1 /* Define to 1 if you have the <gssapi.h> header file. */ /* #undef HAVE_GSSAPI_H */ /* Define to 1 if you have the <history.h> header file. */ /* #undef HAVE_HISTORY_H */ /* Define to 1 if you have the `history_truncate_file' function. */ #define HAVE_HISTORY_TRUNCATE_FILE 1 /* Define to 1 if you have the <ieeefp.h> header file. */ /* #undef HAVE_IEEEFP_H */ /* Define to 1 if you have the <ifaddrs.h> header file. */ #define HAVE_IFADDRS_H 1 /* Define to 1 if you have the `inet_aton' function. */ #define HAVE_INET_ATON 1 /* Define to 1 if the system has the type `int64'. */ /* #undef HAVE_INT64 */ /* Define to 1 if the system has the type `int8'. */ /* #undef HAVE_INT8 */ /* Define to 1 if the system has the type `intptr_t'. */ #define HAVE_INTPTR_T 1 /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the global variable 'int opterr'. */ #define HAVE_INT_OPTERR 1 /* Define to 1 if you have the global variable 'int optreset'. */ /* #undef HAVE_INT_OPTRESET */ /* Define to 1 if you have the global variable 'int timezone'. */ #define HAVE_INT_TIMEZONE /**/ /* Define to 1 if you have support for IPv6. */ #define HAVE_IPV6 1 /* Define to 1 if you have isinf(). */ #define HAVE_ISINF 1 /* Define to 1 if `e_data' is member of `krb5_error'. */ /* #undef HAVE_KRB5_ERROR_E_DATA */ /* Define to 1 if `text.data' is member of `krb5_error'. */ #define HAVE_KRB5_ERROR_TEXT_DATA 1 /* Define to 1 if you have krb5_free_unparsed_name. */ #define HAVE_KRB5_FREE_UNPARSED_NAME 1 /* Define to 1 if `client' is member of `krb5_ticket'. */ /* #undef HAVE_KRB5_TICKET_CLIENT */ /* Define to 1 if `enc_part2' is member of `krb5_ticket'. */ #define HAVE_KRB5_TICKET_ENC_PART2 1 /* Define to 1 if you have the <langinfo.h> header file. */ #define HAVE_LANGINFO_H 1 /* Define to 1 if you have the <ldap.h> header file. */ #define HAVE_LDAP_H 1 /* Define to 1 if you have the `crypto' library (-lcrypto). */ #define HAVE_LIBCRYPTO 1 /* Define to 1 if you have the `ldap' library (-lldap). */ #define HAVE_LIBLDAP 1 /* Define to 1 if you have the `ldap_r' library (-lldap_r). */ #define HAVE_LIBLDAP_R 1 /* Define to 1 if you have the `m' library (-lm). */ #define HAVE_LIBM 1 /* Define to 1 if you have the `pam' library (-lpam). */ #define HAVE_LIBPAM 1 /* Define if you have a function readline library */ #define HAVE_LIBREADLINE 1 /* Define to 1 if you have the `selinux' library (-lselinux). */ #define HAVE_LIBSELINUX 1 /* Define to 1 if you have the `ssl' library (-lssl). */ #define HAVE_LIBSSL 1 /* Define to 1 if you have the `wldap32' library (-lwldap32). */ /* #undef HAVE_LIBWLDAP32 */ /* Define to 1 if you have the `xml2' library (-lxml2). */ #define HAVE_LIBXML2 1 /* Define to 1 if you have the `xslt' library (-lxslt). */ #define HAVE_LIBXSLT 1 /* Define to 1 if you have the `z' library (-lz). */ #define HAVE_LIBZ 1 /* Define to 1 if the system has the type `locale_t'. */ #define HAVE_LOCALE_T 1 /* Define to 1 if `long int' works and is 64 bits. */ #define HAVE_LONG_INT_64 1 /* Define to 1 if the system has the type `long long int'. */ #define HAVE_LONG_LONG_INT 1 /* Define to 1 if `long long int' works and is 64 bits. */ /* #undef HAVE_LONG_LONG_INT_64 */ /* Define to 1 if you have the `mbstowcs_l' function. */ /* #undef HAVE_MBSTOWCS_L */ /* Define to 1 if you have the `memmove' function. */ #define HAVE_MEMMOVE 1 /* Define to 1 if you have the <memory.h> header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if the system has the type `MINIDUMP_TYPE'. */ /* #undef HAVE_MINIDUMP_TYPE */ /* Define to 1 if you have the `mkdtemp' function. */ #define HAVE_MKDTEMP 1 /* Define to 1 if you have the <netinet/in.h> header file. */ #define HAVE_NETINET_IN_H 1 /* Define to 1 if you have the <netinet/tcp.h> header file. */ #define HAVE_NETINET_TCP_H 1 /* Define to 1 if you have the <net/if.h> header file. */ #define HAVE_NET_IF_H 1 /* Define to 1 if you have the `OPENSSL_init_ssl' function. */ /* #undef HAVE_OPENSSL_INIT_SSL */ /* Define to 1 if you have the <ossp/uuid.h> header file. */ /* #undef HAVE_OSSP_UUID_H */ /* Define to 1 if you have the <pam/pam_appl.h> header file. */ /* #undef HAVE_PAM_PAM_APPL_H */ /* Define to 1 if you have the `poll' function. */ #define HAVE_POLL 1 /* Define to 1 if you have the <poll.h> header file. */ #define HAVE_POLL_H 1 /* Define to 1 if you have the `posix_fadvise' function. */ #define HAVE_POSIX_FADVISE 1 /* Define to 1 if you have the POSIX signal interface. */ #define HAVE_POSIX_SIGNALS /**/ /* Define to 1 if the assembler supports PPC's LWARX mutex hint bit. */ /* #undef HAVE_PPC_LWARX_MUTEX_HINT */ /* Define to 1 if you have the `pstat' function. */ /* #undef HAVE_PSTAT */ /* Define to 1 if the PS_STRINGS thing exists. */ /* #undef HAVE_PS_STRINGS */ /* Define if you have POSIX threads libraries and header files. */ /* #undef HAVE_PTHREAD */ /* Define to 1 if you have the `pthread_is_threaded_np' function. */ /* #undef HAVE_PTHREAD_IS_THREADED_NP */ /* Define to 1 if you have the <pwd.h> header file. */ #define HAVE_PWD_H 1 /* Define to 1 if you have the `random' function. */ #define HAVE_RANDOM 1 /* Define to 1 if you have the `RAND_OpenSSL' function. */ /* #undef HAVE_RAND_OPENSSL */ /* Define to 1 if you have the <readline.h> header file. */ /* #undef HAVE_READLINE_H */ /* Define to 1 if you have the <readline/history.h> header file. */ #define HAVE_READLINE_HISTORY_H 1 /* Define to 1 if you have the <readline/readline.h> header file. */ #define HAVE_READLINE_READLINE_H 1 /* Define to 1 if you have the `readlink' function. */ #define HAVE_READLINK 1 /* Define to 1 if you have the `rint' function. */ #define HAVE_RINT 1 /* Define to 1 if you have the global variable 'rl_completion_append_character'. */ #define HAVE_RL_COMPLETION_APPEND_CHARACTER 1 /* Define to 1 if you have the `rl_completion_matches' function. */ #define HAVE_RL_COMPLETION_MATCHES 1 /* Define to 1 if you have the `rl_filename_completion_function' function. */ #define HAVE_RL_FILENAME_COMPLETION_FUNCTION 1 /* Define to 1 if you have the `rl_reset_screen_size' function. */ #define HAVE_RL_RESET_SCREEN_SIZE 1 /* Define to 1 if you have the <security/pam_appl.h> header file. */ #define HAVE_SECURITY_PAM_APPL_H 1 /* Define to 1 if you have the `setproctitle' function. */ /* #undef HAVE_SETPROCTITLE */ /* Define to 1 if you have the `setsid' function. */ #define HAVE_SETSID 1 /* Define to 1 if you have the `sigprocmask' function. */ #define HAVE_SIGPROCMASK 1 /* Define to 1 if you have sigsetjmp(). */ #define HAVE_SIGSETJMP 1 /* Define to 1 if the system has the type `sig_atomic_t'. */ #define HAVE_SIG_ATOMIC_T 1 /* Define to 1 if you have the `snprintf' function. */ #define HAVE_SNPRINTF 1 /* Define to 1 if you have spinlocks. */ #define HAVE_SPINLOCKS 1 /* Define to 1 if you have the `srandom' function. */ #define HAVE_SRANDOM 1 /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the `strerror' function. */ #define HAVE_STRERROR 1 /* Define to 1 if you have the `strerror_r' function. */ #define HAVE_STRERROR_R 1 /* Define to 1 if cpp supports the ANSI # stringizing operator. */ #define HAVE_STRINGIZE 1 /* Define to 1 if you have the <strings.h> header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strlcat' function. */ /* #undef HAVE_STRLCAT */ /* Define to 1 if you have the `strlcpy' function. */ /* #undef HAVE_STRLCPY */ /* Define to 1 if you have the `strtoll' function. */ #define HAVE_STRTOLL 1 /* Define to 1 if you have the `strtoq' function. */ /* #undef HAVE_STRTOQ */ /* Define to 1 if you have the `strtoull' function. */ #define HAVE_STRTOULL 1 /* Define to 1 if you have the `strtouq' function. */ /* #undef HAVE_STRTOUQ */ /* Define to 1 if the system has the type `struct addrinfo'. */ #define HAVE_STRUCT_ADDRINFO 1 /* Define to 1 if the system has the type `struct cmsgcred'. */ /* #undef HAVE_STRUCT_CMSGCRED */ /* Define to 1 if the system has the type `struct option'. */ #define HAVE_STRUCT_OPTION 1 /* Define to 1 if `sa_len' is member of `struct sockaddr'. */ /* #undef HAVE_STRUCT_SOCKADDR_SA_LEN */ /* Define to 1 if the system has the type `struct sockaddr_storage'. */ #define HAVE_STRUCT_SOCKADDR_STORAGE 1 /* Define to 1 if `ss_family' is member of `struct sockaddr_storage'. */ #define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1 /* Define to 1 if `ss_len' is member of `struct sockaddr_storage'. */ /* #undef HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN */ /* Define to 1 if `__ss_family' is member of `struct sockaddr_storage'. */ /* #undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */ /* Define to 1 if `__ss_len' is member of `struct sockaddr_storage'. */ /* #undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_LEN */ /* Define to 1 if `tm_zone' is member of `struct tm'. */ #define HAVE_STRUCT_TM_TM_ZONE 1 /* Define to 1 if you have the `symlink' function. */ #define HAVE_SYMLINK 1 /* Define to 1 if you have the syslog interface. */ #define HAVE_SYSLOG 1 /* Define to 1 if you have the <sys/ioctl.h> header file. */ #define HAVE_SYS_IOCTL_H 1 /* Define to 1 if you have the <sys/ipc.h> header file. */ #define HAVE_SYS_IPC_H 1 /* Define to 1 if you have the <sys/poll.h> header file. */ #define HAVE_SYS_POLL_H 1 /* Define to 1 if you have the <sys/pstat.h> header file. */ /* #undef HAVE_SYS_PSTAT_H */ /* Define to 1 if you have the <sys/resource.h> header file. */ #define HAVE_SYS_RESOURCE_H 1 /* Define to 1 if you have the <sys/select.h> header file. */ #define HAVE_SYS_SELECT_H 1 /* Define to 1 if you have the <sys/sem.h> header file. */ #define HAVE_SYS_SEM_H 1 /* Define to 1 if you have the <sys/shm.h> header file. */ #define HAVE_SYS_SHM_H 1 /* Define to 1 if you have the <sys/socket.h> header file. */ #define HAVE_SYS_SOCKET_H 1 /* Define to 1 if you have the <sys/sockio.h> header file. */ /* #undef HAVE_SYS_SOCKIO_H */ /* Define to 1 if you have the <sys/stat.h> header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the <sys/tas.h> header file. */ /* #undef HAVE_SYS_TAS_H */ /* Define to 1 if you have the <sys/time.h> header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <sys/ucred.h> header file. */ /* #undef HAVE_SYS_UCRED_H */ /* Define to 1 if you have the <sys/un.h> header file. */ #define HAVE_SYS_UN_H 1 /* Define to 1 if you have the <termios.h> header file. */ #define HAVE_TERMIOS_H 1 /* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use `HAVE_STRUCT_TM_TM_ZONE' instead. */ #define HAVE_TM_ZONE 1 /* Define to 1 if you have the `towlower' function. */ #define HAVE_TOWLOWER 1 /* Define to 1 if you have the external array `tzname'. */ #define HAVE_TZNAME 1 /* Define to 1 if you have the <ucred.h> header file. */ /* #undef HAVE_UCRED_H */ /* Define to 1 if the system has the type `uint64'. */ /* #undef HAVE_UINT64 */ /* Define to 1 if the system has the type `uint8'. */ /* #undef HAVE_UINT8 */ /* Define to 1 if the system has the type `uintptr_t'. */ #define HAVE_UINTPTR_T 1 /* Define to 1 if the system has the type `union semun'. */ /* #undef HAVE_UNION_SEMUN */ /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have unix sockets. */ #define HAVE_UNIX_SOCKETS 1 /* Define to 1 if you have the `unsetenv' function. */ #define HAVE_UNSETENV 1 /* Define to 1 if you have the `utime' function. */ #define HAVE_UTIME 1 /* Define to 1 if you have the `utimes' function. */ #define HAVE_UTIMES 1 /* Define to 1 if you have the <utime.h> header file. */ #define HAVE_UTIME_H 1 /* Define to 1 if you have the <uuid.h> header file. */ #define HAVE_UUID_H 1 /* Define to 1 if you have the `vsnprintf' function. */ #define HAVE_VSNPRINTF 1 /* Define to 1 if you have the `waitpid' function. */ #define HAVE_WAITPID 1 /* Define to 1 if you have the <wchar.h> header file. */ #define HAVE_WCHAR_H 1 /* Define to 1 if you have the `wcstombs' function. */ #define HAVE_WCSTOMBS 1 /* Define to 1 if you have the `wcstombs_l' function. */ /* #undef HAVE_WCSTOMBS_L */ /* Define to 1 if you have the <wctype.h> header file. */ #define HAVE_WCTYPE_H 1 /* Define to 1 if you have the <winldap.h> header file. */ /* #undef HAVE_WINLDAP_H */ /* Define to the appropriate snprintf format for 64-bit ints. */ #define INT64_FORMAT "%ld" /* Define to build with Kerberos 5 support. (--with-krb5) */ #define KRB5 1 /* Define to 1 if `locale_t' requires <xlocale.h>. */ /* #undef LOCALE_T_IN_XLOCALE */ /* Define as the maximum alignment requirement of any C data type. */ #define MAXIMUM_ALIGNOF 8 /* Define bytes to use libc memset(). */ #define MEMSET_LOOP_LIMIT 1024 /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "pgsql-bugs@postgresql.org" /* Define to the full name of this package. */ #define PACKAGE_NAME "PostgreSQL" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "PostgreSQL 9.2.24" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "postgresql" /* Define to the version of this package. */ #define PACKAGE_VERSION "9.2.24" /* Define to the name of the default PostgreSQL service principal in Kerberos. (--with-krb-srvnam=NAME) */ #define PG_KRB_SRVNAM "postgres" /* PostgreSQL major version as a string */ #define PG_MAJORVERSION "9.2" /* PostgreSQL version as a string */ #define PG_VERSION "9.2.24" /* PostgreSQL version as a number */ #define PG_VERSION_NUM 90224 /* A string containing the version number, platform, and C compiler */ #define PG_VERSION_STR "PostgreSQL 9.2.24 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit" /* Define to 1 to allow profiling output to be saved separately for each process. */ /* #undef PROFILE_PID_DIR */ /* Define to the necessary symbol if this constant uses a non-standard name on your system. */ /* #undef PTHREAD_CREATE_JOINABLE */ /* RELSEG_SIZE is the maximum number of blocks allowed in one disk file. Thus, the maximum size of a single file is RELSEG_SIZE * BLCKSZ; relations bigger than that are divided into multiple files. RELSEG_SIZE * BLCKSZ must be less than your OS' limit on file size. This is often 2 GB or 4GB in a 32-bit operating system, unless you have large file support enabled. By default, we make the limit 1 GB to avoid any possible integer-overflow problems within the OS. A limit smaller than necessary only means we divide a large relation into more chunks than necessary, so it seems best to err in the direction of a small limit. A power-of-2 value is recommended to save a few cycles in md.c, but is not absolutely required. Changing RELSEG_SIZE requires an initdb. */ #define RELSEG_SIZE 131072 /* The size of `long', as computed by sizeof. */ #define SIZEOF_LONG 8 /* The size of `off_t', as computed by sizeof. */ #define SIZEOF_OFF_T 8 /* The size of `size_t', as computed by sizeof. */ #define SIZEOF_SIZE_T 8 /* The size of `void *', as computed by sizeof. */ #define SIZEOF_VOID_P 8 /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define to 1 if strerror_r() returns a int. */ /* #undef STRERROR_R_INT */ /* Define to 1 if your <sys/time.h> declares `struct tm'. */ /* #undef TM_IN_SYS_TIME */ /* Define to the appropriate snprintf format for unsigned 64-bit ints. */ #define UINT64_FORMAT "%lu" /* Define to 1 to build with assertion checks. (--enable-cassert) */ /* #undef USE_ASSERT_CHECKING */ /* Define to 1 to build with Bonjour support. (--with-bonjour) */ /* #undef USE_BONJOUR */ /* Define to 1 if you want float4 values to be passed by value. (--enable-float4-byval) */ #define USE_FLOAT4_BYVAL 1 /* Define to 1 if you want float8, int8, etc values to be passed by value. (--enable-float8-byval) */ #define USE_FLOAT8_BYVAL 1 /* Define to 1 if "static inline" works without unwanted warnings from compilations where static inline functions are defined but not called. */ #define USE_INLINE 1 /* Define to 1 if you want 64-bit integer timestamp and interval support. (--enable-integer-datetimes) */ #define USE_INTEGER_DATETIMES 1 /* Define to 1 to build with LDAP support. (--with-ldap) */ #define USE_LDAP 1 /* Define to 1 to build with XML support. (--with-libxml) */ #define USE_LIBXML 1 /* Define to 1 to use XSLT support when building contrib/xml2. (--with-libxslt) */ #define USE_LIBXSLT 1 /* Define to select named POSIX semaphores. */ /* #undef USE_NAMED_POSIX_SEMAPHORES */ /* Define to 1 to build with PAM support. (--with-pam) */ #define USE_PAM 1 /* Use replacement snprintf() functions. */ /* #undef USE_REPL_SNPRINTF */ /* Define to build with (Open)SSL support. (--with-openssl) */ #define USE_SSL 1 /* Define to select SysV-style semaphores. */ #define USE_SYSV_SEMAPHORES 1 /* Define to select SysV-style shared memory. */ #define USE_SYSV_SHARED_MEMORY 1 /* Define to select unnamed POSIX semaphores. */ /* #undef USE_UNNAMED_POSIX_SEMAPHORES */ /* Define to select Win32-style semaphores. */ /* #undef USE_WIN32_SEMAPHORES */ /* Define to select Win32-style shared memory. */ /* #undef USE_WIN32_SHARED_MEMORY */ /* Define to 1 if `wcstombs_l' requires <xlocale.h>. */ /* #undef WCSTOMBS_L_IN_XLOCALE */ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN /* # undef WORDS_BIGENDIAN */ # endif #endif /* Size of a WAL file block. This need have no particular relation to BLCKSZ. XLOG_BLCKSZ must be a power of 2, and if your system supports O_DIRECT I/O, XLOG_BLCKSZ must be a multiple of the alignment requirement for direct-I/O buffers, else direct I/O may fail. Changing XLOG_BLCKSZ requires an initdb. */ #define XLOG_BLCKSZ 8192 /* XLOG_SEG_SIZE is the size of a single WAL file. This must be a power of 2 and larger than XLOG_BLCKSZ (preferably, a great deal larger than XLOG_BLCKSZ). Changing XLOG_SEG_SIZE requires an initdb. */ #define XLOG_SEG_SIZE (16 * 1024 * 1024) /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ /* #undef _LARGEFILE_SOURCE */ /* Define for large files, on AIX-style hosts. */ /* #undef _LARGE_FILES */ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus /* #undef inline */ #endif /* Define to the type of a signed integer type wide enough to hold a pointer, if such a type exists, and if the system does not define it. */ /* #undef intptr_t */ /* Define to empty if the C compiler does not understand signed types. */ /* #undef signed */ /* Define to the type of an unsigned integer type wide enough to hold a pointer, if such a type exists, and if the system does not define it. */ /* #undef uintptr_t */ /* Define to empty if the keyword `volatile' does not work. Warning: valid code using `volatile' can become incorrect without. Disable with care. */ /* #undef volatile */ ���������������������������������������������������������������������������gconv.h���������������������������������������������������������������������������������������������0000644�����������������00000012243�14763166027�0006047 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997-1999, 2000-2002, 2007, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* This header provides no interface for a user to the internals of the gconv implementation in the libc. Therefore there is no use for these definitions beside for writing additional gconv modules. */ #ifndef _GCONV_H #define _GCONV_H 1 #include <features.h> #define __need_mbstate_t #define __need_wint_t #include <wchar.h> #define __need_size_t #define __need_wchar_t #include <stddef.h> /* ISO 10646 value used to signal invalid value. */ #define __UNKNOWN_10646_CHAR ((wchar_t) 0xfffd) /* Error codes for gconv functions. */ enum { __GCONV_OK = 0, __GCONV_NOCONV, __GCONV_NODB, __GCONV_NOMEM, __GCONV_EMPTY_INPUT, __GCONV_FULL_OUTPUT, __GCONV_ILLEGAL_INPUT, __GCONV_INCOMPLETE_INPUT, __GCONV_ILLEGAL_DESCRIPTOR, __GCONV_INTERNAL_ERROR }; /* Flags the `__gconv_open' function can set. */ enum { __GCONV_IS_LAST = 0x0001, __GCONV_IGNORE_ERRORS = 0x0002, __GCONV_SWAP = 0x0004 }; /* Forward declarations. */ struct __gconv_step; struct __gconv_step_data; struct __gconv_loaded_object; struct __gconv_trans_data; /* Type of a conversion function. */ typedef int (*__gconv_fct) (struct __gconv_step *, struct __gconv_step_data *, const unsigned char **, const unsigned char *, unsigned char **, size_t *, int, int); /* Type of a specialized conversion function for a single byte to INTERNAL. */ typedef wint_t (*__gconv_btowc_fct) (struct __gconv_step *, unsigned char); /* Constructor and destructor for local data for conversion step. */ typedef int (*__gconv_init_fct) (struct __gconv_step *); typedef void (*__gconv_end_fct) (struct __gconv_step *); /* Type of a transliteration/transscription function. */ typedef int (*__gconv_trans_fct) (struct __gconv_step *, struct __gconv_step_data *, void *, const unsigned char *, const unsigned char **, const unsigned char *, unsigned char **, size_t *); /* Function to call to provide transliteration module with context. */ typedef int (*__gconv_trans_context_fct) (void *, const unsigned char *, const unsigned char *, unsigned char *, unsigned char *); /* Function to query module about supported encoded character sets. */ typedef int (*__gconv_trans_query_fct) (const char *, const char ***, size_t *); /* Constructor and destructor for local data for transliteration. */ typedef int (*__gconv_trans_init_fct) (void **, const char *); typedef void (*__gconv_trans_end_fct) (void *); struct __gconv_trans_data { /* Transliteration/Transscription function. */ __gconv_trans_fct __trans_fct; __gconv_trans_context_fct __trans_context_fct; __gconv_trans_end_fct __trans_end_fct; void *__data; struct __gconv_trans_data *__next; }; /* Description of a conversion step. */ struct __gconv_step { struct __gconv_loaded_object *__shlib_handle; const char *__modname; int __counter; char *__from_name; char *__to_name; __gconv_fct __fct; __gconv_btowc_fct __btowc_fct; __gconv_init_fct __init_fct; __gconv_end_fct __end_fct; /* Information about the number of bytes needed or produced in this step. This helps optimizing the buffer sizes. */ int __min_needed_from; int __max_needed_from; int __min_needed_to; int __max_needed_to; /* Flag whether this is a stateful encoding or not. */ int __stateful; void *__data; /* Pointer to step-local data. */ }; /* Additional data for steps in use of conversion descriptor. This is allocated by the `init' function. */ struct __gconv_step_data { unsigned char *__outbuf; /* Output buffer for this step. */ unsigned char *__outbufend; /* Address of first byte after the output buffer. */ /* Is this the last module in the chain. */ int __flags; /* Counter for number of invocations of the module function for this descriptor. */ int __invocation_counter; /* Flag whether this is an internal use of the module (in the mb*towc* and wc*tomb* functions) or regular with iconv(3). */ int __internal_use; __mbstate_t *__statep; __mbstate_t __state; /* This element must not be used directly by any module; always use STATEP! */ /* Transliteration information. */ struct __gconv_trans_data *__trans; }; /* Combine conversion step description with data. */ typedef struct __gconv_info { size_t __nsteps; struct __gconv_step *__steps; __extension__ struct __gconv_step_data __data __flexarr; } *__gconv_t; #endif /* gconv.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������verto-module.h��������������������������������������������������������������������������������������0000644�����������������00000014760�14763166027�0007363 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright 2011 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation files * (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /*** THE FOLLOWING ARE FOR IMPLEMENTATION MODULES ONLY ***/ #ifndef VERTO_MODULE_H_ #define VERTO_MODULE_H_ #include <verto.h> #ifndef VERTO_MODULE_TYPES #define VERTO_MODULE_TYPES typedef void verto_mod_ctx; typedef void verto_mod_ev; #endif #define VERTO_MODULE_VERSION 3 #define VERTO_MODULE_TABLE(name) verto_module_table_ ## name #define VERTO_MODULE(name, symb, types) \ static verto_ctx_funcs name ## _funcs = { \ name ## _ctx_new, \ name ## _ctx_default, \ name ## _ctx_free, \ name ## _ctx_run, \ name ## _ctx_run_once, \ name ## _ctx_break, \ name ## _ctx_reinitialize, \ name ## _ctx_set_flags, \ name ## _ctx_add, \ name ## _ctx_del \ }; \ verto_module VERTO_MODULE_TABLE(name) = { \ VERTO_MODULE_VERSION, \ # name, \ # symb, \ types, \ &name ## _funcs, \ }; \ verto_ctx * \ verto_new_ ## name() \ { \ return verto_convert(name, 0, NULL); \ } \ verto_ctx * \ verto_default_ ## name() \ { \ return verto_convert(name, 1, NULL); \ } typedef struct { /* Required */ verto_mod_ctx *(*ctx_new)(); /* Optional */ verto_mod_ctx *(*ctx_default)(); /* Required */ void (*ctx_free)(verto_mod_ctx *ctx); /* Optional */ void (*ctx_run)(verto_mod_ctx *ctx); /* Required */ void (*ctx_run_once)(verto_mod_ctx *ctx); /* Optional */ void (*ctx_break)(verto_mod_ctx *ctx); /* Optional */ void (*ctx_reinitialize)(verto_mod_ctx *ctx); /* Optional */ void (*ctx_set_flags)(verto_mod_ctx *ctx, const verto_ev *ev, verto_mod_ev *modev); /* Required */ verto_mod_ev *(*ctx_add)(verto_mod_ctx *ctx, const verto_ev *ev, verto_ev_flag *flags); /* Required */ void (*ctx_del)(verto_mod_ctx *ctx, const verto_ev *ev, verto_mod_ev *modev); } verto_ctx_funcs; typedef struct { unsigned int vers; const char *name; const char *symb; verto_ev_type types; verto_ctx_funcs *funcs; } verto_module; /** * Converts an existing implementation specific loop to a verto_ctx. * * This function also sets the internal default implementation so that future * calls to verto_new(NULL) or verto_default(NULL) will use this specific * implementation if it was not already set. * * @param name The name of the module (unquoted) * @param deflt Whether the ctx is the default context or not * @param ctx The context to store * @return A new verto_ctx, or NULL on error. Call verto_free() when done. */ #define verto_convert(name, deflt, ctx) \ verto_convert_module(&VERTO_MODULE_TABLE(name), deflt, ctx) /** * Converts an existing implementation specific loop to a verto_ctx. * * If you are a module implementation, you probably want the macro above. This * function is generally used directly only when an application is attempting * to expose a home-grown event loop to verto. * * If deflt is non-zero and a default ctx was already defined for this module * and ctx is not NULL, than ctx will be free'd and the previously defined * default will be returned. * * If ctx is non-NULL, than the pre-existing verto_mod_ctx will be converted to * to a verto_ctx; if deflt is non-zero than this verto_mod_ctx will also be * marked as the default loop for this process. If ctx is NULL, than the * appropriate constructor will be called: either module->ctx_new() or * module->ctx_default() depending on the boolean value of deflt. If * module->ctx_default is NULL and deflt is non-zero, than module->ctx_new() * will be called and the resulting verto_mod_ctx will be utilized as the * default. * * This function also sets the internal default implementation so that future * calls to verto_new(NULL) or verto_default(NULL) will use this specific * implementation if it was not already set. * * @param name The name of the module (unquoted) * @param ctx The context private to store * @return A new verto_ctx, or NULL on error. Call verto_free() when done. */ verto_ctx * verto_convert_module(const verto_module *module, int deflt, verto_mod_ctx *ctx); /** * Calls the callback of the verto_ev and then frees it via verto_del(). * * The verto_ev is not freed (verto_del() is not called) if it is a signal event. * * @see verto_add_read() * @see verto_add_write() * @see verto_add_timeout() * @see verto_add_idle() * @see verto_add_signal() * @see verto_add_child() * @see verto_del() * @param ev The verto_ev */ void verto_fire(verto_ev *ev); /** * Sets the status of the pid/handle which caused this event to fire. * * This function does nothing if the verto_ev is not a child type. * * @see verto_add_child() * @param ev The verto_ev to set the status in. * @param status The pid/handle status. */ void verto_set_proc_status(verto_ev *ev, verto_proc_status status); /** * Sets the state of the fd which caused this event to fire. * * This function does nothing if the verto_ev is not a io type. * * Only the flags VERTO_EV_FLAG_IO_(READ|WRITE|ERROR) are supported. All other * flags are unset. * * @see verto_add_io() * @param ev The verto_ev to set the state in. * @param state The fd state. */ void verto_set_fd_state(verto_ev *ev, verto_ev_flag state); #endif /* VERTO_MODULE_H_ */ ����������������utmpx.h���������������������������������������������������������������������������������������������0000644�����������������00000010026�14763166027�0006105 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997, 1998, 1999, 2003, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _UTMPX_H #define _UTMPX_H 1 #include <features.h> #include <sys/time.h> /* Required according to Unix98. */ #ifndef __pid_t_defined typedef __pid_t pid_t; # define __pid_t_defined #endif /* Get system dependent values and data structures. */ #include <bits/utmpx.h> #ifdef __USE_GNU /* Compatibility names for the strings of the canonical file names. */ # define UTMPX_FILE _PATH_UTMPX # define UTMPX_FILENAME _PATH_UTMPX # define WTMPX_FILE _PATH_WTMPX # define WTMPX_FILENAME _PATH_WTMPX #endif /* For the getutmp{,x} functions we need the `struct utmp'. */ #ifdef __USE_GNU struct utmp; #endif __BEGIN_DECLS /* Open user accounting database. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void setutxent (void); /* Close user accounting database. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void endutxent (void); /* Get the next entry from the user accounting database. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct utmpx *getutxent (void); /* Get the user accounting database entry corresponding to ID. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct utmpx *getutxid (const struct utmpx *__id); /* Get the user accounting database entry corresponding to LINE. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct utmpx *getutxline (const struct utmpx *__line); /* Write the entry UTMPX into the user accounting database. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct utmpx *pututxline (const struct utmpx *__utmpx); #ifdef __USE_GNU /* Change name of the utmpx file to be examined. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int utmpxname (const char *__file); /* Append entry UTMP to the wtmpx-like file WTMPX_FILE. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern void updwtmpx (const char *__wtmpx_file, const struct utmpx *__utmpx); /* Copy the information in UTMPX to UTMP. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern void getutmp (const struct utmpx *__utmpx, struct utmp *__utmp); /* Copy the information in UTMP to UTMPX. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern void getutmpx (const struct utmp *__utmp, struct utmpx *__utmpx); #endif __END_DECLS #endif /* utmpx.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������re_comp.h�������������������������������������������������������������������������������������������0000644�����������������00000001675�14763166027�0006366 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _RE_COMP_H #define _RE_COMP_H 1 /* This is only a wrapper around the <regex.h> file. XPG4.2 mentions this name. */ #include <regex.h> #endif /* re_comp.h */ �������������������������������������������������������������������wchar.h���������������������������������������������������������������������������������������������0000644�����������������00000076567�14763166027�0006062 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1995-2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 Standard: 7.24 * Extended multibyte and wide character utilities <wchar.h> */ #ifndef _WCHAR_H #if !defined __need_mbstate_t && !defined __need_wint_t # define _WCHAR_H 1 # include <features.h> #endif #ifdef _WCHAR_H /* Get FILE definition. */ # define __need___FILE # if defined __USE_UNIX98 || defined __USE_XOPEN2K # define __need_FILE # endif # include <stdio.h> /* Get va_list definition. */ # define __need___va_list # include <stdarg.h> # include <bits/wchar.h> /* Get size_t, wchar_t, wint_t and NULL from <stddef.h>. */ # define __need_size_t # define __need_wchar_t # define __need_NULL #endif #if defined _WCHAR_H || defined __need_wint_t || !defined __WINT_TYPE__ # undef __need_wint_t # define __need_wint_t # include <stddef.h> /* We try to get wint_t from <stddef.h>, but not all GCC versions define it there. So define it ourselves if it remains undefined. */ # ifndef _WINT_T /* Integral type unchanged by default argument promotions that can hold any value corresponding to members of the extended character set, as well as at least one value that does not correspond to any member of the extended character set. */ # define _WINT_T typedef unsigned int wint_t; # else /* Work around problems with the <stddef.h> file which doesn't put wint_t in the std namespace. */ # if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES \ && defined __WINT_TYPE__ __BEGIN_NAMESPACE_STD typedef __WINT_TYPE__ wint_t; __END_NAMESPACE_STD # endif # endif /* Tell the caller that we provide correct C++ prototypes. */ # if defined __cplusplus && __GNUC_PREREQ (4, 4) # define __CORRECT_ISO_CPP_WCHAR_H_PROTO # endif #endif #if (defined _WCHAR_H || defined __need_mbstate_t) && !defined ____mbstate_t_defined # define ____mbstate_t_defined 1 /* Conversion state information. */ typedef struct { int __count; union { # ifdef __WINT_TYPE__ __WINT_TYPE__ __wch; # else wint_t __wch; # endif char __wchb[4]; } __value; /* Value so far. */ } __mbstate_t; #endif #undef __need_mbstate_t /* The rest of the file is only used if used if __need_mbstate_t is not defined. */ #ifdef _WCHAR_H # ifndef __mbstate_t_defined __BEGIN_NAMESPACE_C99 /* Public type. */ typedef __mbstate_t mbstate_t; __END_NAMESPACE_C99 # define __mbstate_t_defined 1 # endif #ifdef __USE_GNU __USING_NAMESPACE_C99(mbstate_t) #endif #ifndef WCHAR_MIN /* These constants might also be defined in <inttypes.h>. */ # define WCHAR_MIN __WCHAR_MIN # define WCHAR_MAX __WCHAR_MAX #endif #ifndef WEOF # define WEOF (0xffffffffu) #endif /* For XPG4 compliance we have to define the stuff from <wctype.h> here as well. */ #if defined __USE_XOPEN && !defined __USE_UNIX98 # include <wctype.h> #endif __BEGIN_DECLS __BEGIN_NAMESPACE_STD /* This incomplete type is defined in <time.h> but needed here because of `wcsftime'. */ struct tm; __END_NAMESPACE_STD /* XXX We have to clean this up at some point. Since tm is in the std namespace but wcsftime is in __c99 the type wouldn't be found without inserting it in the global namespace. */ __USING_NAMESPACE_STD(tm) __BEGIN_NAMESPACE_STD /* Copy SRC to DEST. */ extern wchar_t *wcscpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src) __THROW; /* Copy no more than N wide-characters of SRC to DEST. */ extern wchar_t *wcsncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n) __THROW; /* Append SRC onto DEST. */ extern wchar_t *wcscat (wchar_t *__restrict __dest, const wchar_t *__restrict __src) __THROW; /* Append no more than N wide-characters of SRC onto DEST. */ extern wchar_t *wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n) __THROW; /* Compare S1 and S2. */ extern int wcscmp (const wchar_t *__s1, const wchar_t *__s2) __THROW __attribute_pure__; /* Compare N wide-characters of S1 and S2. */ extern int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n) __THROW __attribute_pure__; __END_NAMESPACE_STD #ifdef __USE_XOPEN2K8 /* Compare S1 and S2, ignoring case. */ extern int wcscasecmp (const wchar_t *__s1, const wchar_t *__s2) __THROW; /* Compare no more than N chars of S1 and S2, ignoring case. */ extern int wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n) __THROW; /* Similar to the two functions above but take the information from the provided locale and not the global locale. */ # include <xlocale.h> extern int wcscasecmp_l (const wchar_t *__s1, const wchar_t *__s2, __locale_t __loc) __THROW; extern int wcsncasecmp_l (const wchar_t *__s1, const wchar_t *__s2, size_t __n, __locale_t __loc) __THROW; #endif __BEGIN_NAMESPACE_STD /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE category of the current locale. */ extern int wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW; /* Transform S2 into array pointed to by S1 such that if wcscmp is applied to two transformed strings the result is the as applying `wcscoll' to the original strings. */ extern size_t wcsxfrm (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n) __THROW; __END_NAMESPACE_STD #ifdef __USE_XOPEN2K8 /* Similar to the two functions above but take the information from the provided locale and not the global locale. */ /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE category of the given locale. */ extern int wcscoll_l (const wchar_t *__s1, const wchar_t *__s2, __locale_t __loc) __THROW; /* Transform S2 into array pointed to by S1 such that if wcscmp is applied to two transformed strings the result is the as applying `wcscoll' to the original strings. */ extern size_t wcsxfrm_l (wchar_t *__s1, const wchar_t *__s2, size_t __n, __locale_t __loc) __THROW; /* Duplicate S, returning an identical malloc'd string. */ extern wchar_t *wcsdup (const wchar_t *__s) __THROW __attribute_malloc__; #endif __BEGIN_NAMESPACE_STD /* Find the first occurrence of WC in WCS. */ #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO extern "C++" wchar_t *wcschr (wchar_t *__wcs, wchar_t __wc) __THROW __asm ("wcschr") __attribute_pure__; extern "C++" const wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc) __THROW __asm ("wcschr") __attribute_pure__; #else extern wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc) __THROW __attribute_pure__; #endif /* Find the last occurrence of WC in WCS. */ #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO extern "C++" wchar_t *wcsrchr (wchar_t *__wcs, wchar_t __wc) __THROW __asm ("wcsrchr") __attribute_pure__; extern "C++" const wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc) __THROW __asm ("wcsrchr") __attribute_pure__; #else extern wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc) __THROW __attribute_pure__; #endif __END_NAMESPACE_STD #ifdef __USE_GNU /* This function is similar to `wcschr'. But it returns a pointer to the closing NUL wide character in case C is not found in S. */ extern wchar_t *wcschrnul (const wchar_t *__s, wchar_t __wc) __THROW __attribute_pure__; #endif __BEGIN_NAMESPACE_STD /* Return the length of the initial segmet of WCS which consists entirely of wide characters not in REJECT. */ extern size_t wcscspn (const wchar_t *__wcs, const wchar_t *__reject) __THROW __attribute_pure__; /* Return the length of the initial segmet of WCS which consists entirely of wide characters in ACCEPT. */ extern size_t wcsspn (const wchar_t *__wcs, const wchar_t *__accept) __THROW __attribute_pure__; /* Find the first occurrence in WCS of any character in ACCEPT. */ #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO extern "C++" wchar_t *wcspbrk (wchar_t *__wcs, const wchar_t *__accept) __THROW __asm ("wcspbrk") __attribute_pure__; extern "C++" const wchar_t *wcspbrk (const wchar_t *__wcs, const wchar_t *__accept) __THROW __asm ("wcspbrk") __attribute_pure__; #else extern wchar_t *wcspbrk (const wchar_t *__wcs, const wchar_t *__accept) __THROW __attribute_pure__; #endif /* Find the first occurrence of NEEDLE in HAYSTACK. */ #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO extern "C++" wchar_t *wcsstr (wchar_t *__haystack, const wchar_t *__needle) __THROW __asm ("wcsstr") __attribute_pure__; extern "C++" const wchar_t *wcsstr (const wchar_t *__haystack, const wchar_t *__needle) __THROW __asm ("wcsstr") __attribute_pure__; #else extern wchar_t *wcsstr (const wchar_t *__haystack, const wchar_t *__needle) __THROW __attribute_pure__; #endif /* Divide WCS into tokens separated by characters in DELIM. */ extern wchar_t *wcstok (wchar_t *__restrict __s, const wchar_t *__restrict __delim, wchar_t **__restrict __ptr) __THROW; /* Return the number of wide characters in S. */ extern size_t wcslen (const wchar_t *__s) __THROW __attribute_pure__; __END_NAMESPACE_STD #ifdef __USE_XOPEN /* Another name for `wcsstr' from XPG4. */ # ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO extern "C++" wchar_t *wcswcs (wchar_t *__haystack, const wchar_t *__needle) __THROW __asm ("wcswcs") __attribute_pure__; extern "C++" const wchar_t *wcswcs (const wchar_t *__haystack, const wchar_t *__needle) __THROW __asm ("wcswcs") __attribute_pure__; # else extern wchar_t *wcswcs (const wchar_t *__haystack, const wchar_t *__needle) __THROW __attribute_pure__; # endif #endif #ifdef __USE_XOPEN2K8 /* Return the number of wide characters in S, but at most MAXLEN. */ extern size_t wcsnlen (const wchar_t *__s, size_t __maxlen) __THROW __attribute_pure__; #endif __BEGIN_NAMESPACE_STD /* Search N wide characters of S for C. */ #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO extern "C++" wchar_t *wmemchr (wchar_t *__s, wchar_t __c, size_t __n) __THROW __asm ("wmemchr") __attribute_pure__; extern "C++" const wchar_t *wmemchr (const wchar_t *__s, wchar_t __c, size_t __n) __THROW __asm ("wmemchr") __attribute_pure__; #else extern wchar_t *wmemchr (const wchar_t *__s, wchar_t __c, size_t __n) __THROW __attribute_pure__; #endif /* Compare N wide characters of S1 and S2. */ extern int wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n) __THROW __attribute_pure__; /* Copy N wide characters of SRC to DEST. */ extern wchar_t *wmemcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n) __THROW; /* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for overlapping strings. */ extern wchar_t *wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n) __THROW; /* Set N wide characters of S to C. */ extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW; __END_NAMESPACE_STD #ifdef __USE_GNU /* Copy N wide characters of SRC to DEST and return pointer to following wide character. */ extern wchar_t *wmempcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n) __THROW; #endif __BEGIN_NAMESPACE_STD /* Determine whether C constitutes a valid (one-byte) multibyte character. */ extern wint_t btowc (int __c) __THROW; /* Determine whether C corresponds to a member of the extended character set whose multibyte representation is a single byte. */ extern int wctob (wint_t __c) __THROW; /* Determine whether PS points to an object representing the initial state. */ extern int mbsinit (const mbstate_t *__ps) __THROW __attribute_pure__; /* Write wide character representation of multibyte character pointed to by S to PWC. */ extern size_t mbrtowc (wchar_t *__restrict __pwc, const char *__restrict __s, size_t __n, mbstate_t *__restrict __p) __THROW; /* Write multibyte representation of wide character WC to S. */ extern size_t wcrtomb (char *__restrict __s, wchar_t __wc, mbstate_t *__restrict __ps) __THROW; /* Return number of bytes in multibyte character pointed to by S. */ extern size_t __mbrlen (const char *__restrict __s, size_t __n, mbstate_t *__restrict __ps) __THROW; extern size_t mbrlen (const char *__restrict __s, size_t __n, mbstate_t *__restrict __ps) __THROW; __END_NAMESPACE_STD #ifdef __USE_EXTERN_INLINES /* Define inline function as optimization. */ /* We can use the BTOWC and WCTOB optimizations since we know that all locales must use ASCII encoding for the values in the ASCII range and because the wchar_t encoding is always ISO 10646. */ extern wint_t __btowc_alias (int __c) __asm ("btowc"); __extern_inline wint_t __NTH (btowc (int __c)) { return (__builtin_constant_p (__c) && __c >= '\0' && __c <= '\x7f' ? (wint_t) __c : __btowc_alias (__c)); } extern int __wctob_alias (wint_t __c) __asm ("wctob"); __extern_inline int __NTH (wctob (wint_t __wc)) { return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f' ? (int) __wc : __wctob_alias (__wc)); } __extern_inline size_t __NTH (mbrlen (const char *__restrict __s, size_t __n, mbstate_t *__restrict __ps)) { return (__ps != NULL ? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); } #endif __BEGIN_NAMESPACE_STD /* Write wide character representation of multibyte character string SRC to DST. */ extern size_t mbsrtowcs (wchar_t *__restrict __dst, const char **__restrict __src, size_t __len, mbstate_t *__restrict __ps) __THROW; /* Write multibyte character representation of wide character string SRC to DST. */ extern size_t wcsrtombs (char *__restrict __dst, const wchar_t **__restrict __src, size_t __len, mbstate_t *__restrict __ps) __THROW; __END_NAMESPACE_STD #ifdef __USE_XOPEN2K8 /* Write wide character representation of at most NMC bytes of the multibyte character string SRC to DST. */ extern size_t mbsnrtowcs (wchar_t *__restrict __dst, const char **__restrict __src, size_t __nmc, size_t __len, mbstate_t *__restrict __ps) __THROW; /* Write multibyte character representation of at most NWC characters from the wide character string SRC to DST. */ extern size_t wcsnrtombs (char *__restrict __dst, const wchar_t **__restrict __src, size_t __nwc, size_t __len, mbstate_t *__restrict __ps) __THROW; #endif /* use POSIX 2008 */ /* The following functions are extensions found in X/Open CAE. */ #ifdef __USE_XOPEN /* Determine number of column positions required for C. */ extern int wcwidth (wchar_t __c) __THROW; /* Determine number of column positions required for first N wide characters (or fewer if S ends before this) in S. */ extern int wcswidth (const wchar_t *__s, size_t __n) __THROW; #endif /* Use X/Open. */ __BEGIN_NAMESPACE_STD /* Convert initial portion of the wide string NPTR to `double' representation. */ extern double wcstod (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr) __THROW; __END_NAMESPACE_STD #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Likewise for `float' and `long double' sizes of floating-point numbers. */ extern float wcstof (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr) __THROW; extern long double wcstold (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr) __THROW; __END_NAMESPACE_C99 #endif /* C99 */ __BEGIN_NAMESPACE_STD /* Convert initial portion of wide string NPTR to `long int' representation. */ extern long int wcstol (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base) __THROW; /* Convert initial portion of wide string NPTR to `unsigned long int' representation. */ extern unsigned long int wcstoul (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base) __THROW; __END_NAMESPACE_STD #if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU) __BEGIN_NAMESPACE_C99 /* Convert initial portion of wide string NPTR to `long long int' representation. */ __extension__ extern long long int wcstoll (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base) __THROW; /* Convert initial portion of wide string NPTR to `unsigned long long int' representation. */ __extension__ extern unsigned long long int wcstoull (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base) __THROW; __END_NAMESPACE_C99 #endif /* ISO C99 or GCC and GNU. */ #if defined __GNUC__ && defined __USE_GNU /* Convert initial portion of wide string NPTR to `long long int' representation. */ __extension__ extern long long int wcstoq (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base) __THROW; /* Convert initial portion of wide string NPTR to `unsigned long long int' representation. */ __extension__ extern unsigned long long int wcstouq (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base) __THROW; #endif /* GCC and use GNU. */ #ifdef __USE_GNU /* The concept of one static locale per category is not very well thought out. Many applications will need to process its data using information from several different locales. Another application is the implementation of the internationalization handling in the upcoming ISO C++ standard library. To support this another set of the functions using locale data exist which have an additional argument. Attention: all these functions are *not* standardized in any form. This is a proof-of-concept implementation. */ /* Structure for reentrant locale using functions. This is an (almost) opaque type for the user level programs. */ # include <xlocale.h> /* Special versions of the functions above which take the locale to use as an additional parameter. */ extern long int wcstol_l (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base, __locale_t __loc) __THROW; extern unsigned long int wcstoul_l (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base, __locale_t __loc) __THROW; __extension__ extern long long int wcstoll_l (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base, __locale_t __loc) __THROW; __extension__ extern unsigned long long int wcstoull_l (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base, __locale_t __loc) __THROW; extern double wcstod_l (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, __locale_t __loc) __THROW; extern float wcstof_l (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, __locale_t __loc) __THROW; extern long double wcstold_l (const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, __locale_t __loc) __THROW; #endif /* use GNU */ #ifdef __USE_XOPEN2K8 /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */ extern wchar_t *wcpcpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src) __THROW; /* Copy no more than N characters of SRC to DEST, returning the address of the last character written into DEST. */ extern wchar_t *wcpncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n) __THROW; /* Wide character I/O functions. */ /* Like OPEN_MEMSTREAM, but the stream is wide oriented and produces a wide character string. */ extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW; #endif #if defined __USE_ISOC95 || defined __USE_UNIX98 __BEGIN_NAMESPACE_STD /* Select orientation for stream. */ extern int fwide (__FILE *__fp, int __mode) __THROW; /* Write formatted output to STREAM. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int fwprintf (__FILE *__restrict __stream, const wchar_t *__restrict __format, ...) /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */; /* Write formatted output to stdout. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int wprintf (const wchar_t *__restrict __format, ...) /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */; /* Write formatted output of at most N characters to S. */ extern int swprintf (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __format, ...) __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */; /* Write formatted output to S from argument list ARG. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int vfwprintf (__FILE *__restrict __s, const wchar_t *__restrict __format, __gnuc_va_list __arg) /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */; /* Write formatted output to stdout from argument list ARG. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int vwprintf (const wchar_t *__restrict __format, __gnuc_va_list __arg) /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */; /* Write formatted output of at most N character to S from argument list ARG. */ extern int vswprintf (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __format, __gnuc_va_list __arg) __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */; /* Read formatted input from STREAM. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int fwscanf (__FILE *__restrict __stream, const wchar_t *__restrict __format, ...) /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; /* Read formatted input from stdin. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int wscanf (const wchar_t *__restrict __format, ...) /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */; /* Read formatted input from S. */ extern int swscanf (const wchar_t *__restrict __s, const wchar_t *__restrict __format, ...) __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; # if defined __USE_ISOC99 && !defined __USE_GNU \ && (!defined __LDBL_COMPAT || !defined __REDIRECT) \ && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) # ifdef __REDIRECT /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[ GNU extension which conflicts with valid %a followed by letter s, S or [. */ extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream, const wchar_t *__restrict __format, ...), __isoc99_fwscanf) /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; extern int __REDIRECT (wscanf, (const wchar_t *__restrict __format, ...), __isoc99_wscanf) /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */; extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s, const wchar_t *__restrict __format, ...), __isoc99_swscanf) /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; # else extern int __isoc99_fwscanf (__FILE *__restrict __stream, const wchar_t *__restrict __format, ...); extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...); extern int __isoc99_swscanf (const wchar_t *__restrict __s, const wchar_t *__restrict __format, ...) __THROW; # define fwscanf __isoc99_fwscanf # define wscanf __isoc99_wscanf # define swscanf __isoc99_swscanf # endif # endif __END_NAMESPACE_STD #endif /* Use ISO C95, C99 and Unix98. */ #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Read formatted input from S into argument list ARG. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int vfwscanf (__FILE *__restrict __s, const wchar_t *__restrict __format, __gnuc_va_list __arg) /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; /* Read formatted input from stdin into argument list ARG. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int vwscanf (const wchar_t *__restrict __format, __gnuc_va_list __arg) /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */; /* Read formatted input from S into argument list ARG. */ extern int vswscanf (const wchar_t *__restrict __s, const wchar_t *__restrict __format, __gnuc_va_list __arg) __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; # if !defined __USE_GNU \ && (!defined __LDBL_COMPAT || !defined __REDIRECT) \ && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) # ifdef __REDIRECT extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s, const wchar_t *__restrict __format, __gnuc_va_list __arg), __isoc99_vfwscanf) /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format, __gnuc_va_list __arg), __isoc99_vwscanf) /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */; extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s, const wchar_t *__restrict __format, __gnuc_va_list __arg), __isoc99_vswscanf) /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; # else extern int __isoc99_vfwscanf (__FILE *__restrict __s, const wchar_t *__restrict __format, __gnuc_va_list __arg); extern int __isoc99_vwscanf (const wchar_t *__restrict __format, __gnuc_va_list __arg); extern int __isoc99_vswscanf (const wchar_t *__restrict __s, const wchar_t *__restrict __format, __gnuc_va_list __arg) __THROW; # define vfwscanf __isoc99_vfwscanf # define vwscanf __isoc99_vwscanf # define vswscanf __isoc99_vswscanf # endif # endif __END_NAMESPACE_C99 #endif /* Use ISO C99. */ __BEGIN_NAMESPACE_STD /* Read a character from STREAM. These functions are possible cancellation points and therefore not marked with __THROW. */ extern wint_t fgetwc (__FILE *__stream); extern wint_t getwc (__FILE *__stream); /* Read a character from stdin. This function is a possible cancellation point and therefore not marked with __THROW. */ extern wint_t getwchar (void); /* Write a character to STREAM. These functions are possible cancellation points and therefore not marked with __THROW. */ extern wint_t fputwc (wchar_t __wc, __FILE *__stream); extern wint_t putwc (wchar_t __wc, __FILE *__stream); /* Write a character to stdout. This function is a possible cancellation point and therefore not marked with __THROW. */ extern wint_t putwchar (wchar_t __wc); /* Get a newline-terminated wide character string of finite length from STREAM. This function is a possible cancellation point and therefore not marked with __THROW. */ extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n, __FILE *__restrict __stream); /* Write a string to STREAM. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int fputws (const wchar_t *__restrict __ws, __FILE *__restrict __stream); /* Push a character back onto the input buffer of STREAM. This function is a possible cancellation point and therefore not marked with __THROW. */ extern wint_t ungetwc (wint_t __wc, __FILE *__stream); __END_NAMESPACE_STD #ifdef __USE_GNU /* These are defined to be equivalent to the `char' functions defined in POSIX.1:1996. These functions are not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation they are cancellation points and therefore not marked with __THROW. */ extern wint_t getwc_unlocked (__FILE *__stream); extern wint_t getwchar_unlocked (void); /* This is the wide character version of a GNU extension. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern wint_t fgetwc_unlocked (__FILE *__stream); /* Faster version when locking is not necessary. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream); /* These are defined to be equivalent to the `char' functions defined in POSIX.1:1996. These functions are not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation they are cancellation points and therefore not marked with __THROW. */ extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream); extern wint_t putwchar_unlocked (wchar_t __wc); /* This function does the same as `fgetws' but does not lock the stream. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n, __FILE *__restrict __stream); /* This function does the same as `fputws' but does not lock the stream. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int fputws_unlocked (const wchar_t *__restrict __ws, __FILE *__restrict __stream); #endif __BEGIN_NAMESPACE_C99 /* Format TP into S according to FORMAT. Write no more than MAXSIZE wide characters and return the number of wide characters written, or 0 if it would exceed MAXSIZE. */ extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize, const wchar_t *__restrict __format, const struct tm *__restrict __tp) __THROW; __END_NAMESPACE_C99 # ifdef __USE_GNU # include <xlocale.h> /* Similar to `wcsftime' but takes the information from the provided locale and not the global locale. */ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize, const wchar_t *__restrict __format, const struct tm *__restrict __tp, __locale_t __loc) __THROW; # endif /* The X/Open standard demands that most of the functions defined in the <wctype.h> header must also appear here. This is probably because some X/Open members wrote their implementation before the ISO C standard was published and introduced the better solution. We have to provide these definitions for compliance reasons but we do this nonsense only if really necessary. */ #if defined __USE_UNIX98 && !defined __USE_GNU # define __need_iswxxx # include <wctype.h> #endif /* Define some macros helping to catch buffer overflows. */ #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function # include <bits/wchar2.h> #endif #ifdef __LDBL_COMPAT # include <bits/wchar-ldbl.h> #endif __END_DECLS #endif /* _WCHAR_H defined */ #endif /* wchar.h */ /* Undefine all __need_* constants in case we are included to get those constants but the whole file was already read. */ #undef __need_mbstate_t #undef __need_wint_t �����������������������������������������������������������������������������������������������������������������������������������������termio.h��������������������������������������������������������������������������������������������0000644�����������������00000000326�14763166027�0006231 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Compatible <termio.h> for old `struct termio' ioctl interface. This is obsolete; use the POSIX.1 `struct termios' interface defined in <termios.h> instead. */ #include <termios.h> #include <sys/ioctl.h> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netpacket/packet.h����������������������������������������������������������������������������������0000644�����������������00000003567�14763166027�0010171 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Definitions for use with Linux AF_PACKET sockets. Copyright (C) 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __NETPACKET_PACKET_H #define __NETPACKET_PACKET_H 1 struct sockaddr_ll { unsigned short int sll_family; unsigned short int sll_protocol; int sll_ifindex; unsigned short int sll_hatype; unsigned char sll_pkttype; unsigned char sll_halen; unsigned char sll_addr[8]; }; /* Packet types. */ #define PACKET_HOST 0 /* To us. */ #define PACKET_BROADCAST 1 /* To all. */ #define PACKET_MULTICAST 2 /* To group. */ #define PACKET_OTHERHOST 3 /* To someone else. */ #define PACKET_OUTGOING 4 /* Originated by us . */ #define PACKET_LOOPBACK 5 #define PACKET_FASTROUTE 6 /* Packet socket options. */ #define PACKET_ADD_MEMBERSHIP 1 #define PACKET_DROP_MEMBERSHIP 2 #define PACKET_RECV_OUTPUT 3 #define PACKET_RX_RING 5 #define PACKET_STATISTICS 6 struct packet_mreq { int mr_ifindex; unsigned short int mr_type; unsigned short int mr_alen; unsigned char mr_address[8]; }; #define PACKET_MR_MULTICAST 0 #define PACKET_MR_PROMISC 1 #define PACKET_MR_ALLMULTI 2 #endif /* netpacket/packet.h */ �����������������������������������������������������������������������������������������������������������������������������������������string.h��������������������������������������������������������������������������������������������0000644�����������������00000053400�14763166027�0006241 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 Standard: 7.21 String handling <string.h> */ #ifndef _STRING_H #define _STRING_H 1 #include <features.h> __BEGIN_DECLS /* Get size_t and NULL from <stddef.h>. */ #define __need_size_t #define __need_NULL #include <stddef.h> /* Tell the caller that we provide correct C++ prototypes. */ #if defined __cplusplus && __GNUC_PREREQ (4, 4) # define __CORRECT_ISO_CPP_STRING_H_PROTO #endif __BEGIN_NAMESPACE_STD /* Copy N bytes of SRC to DEST. */ extern void *memcpy (void *__restrict __dest, const void *__restrict __src, size_t __n) __THROW __nonnull ((1, 2)); /* Copy N bytes of SRC to DEST, guaranteeing correct behavior for overlapping strings. */ extern void *memmove (void *__dest, const void *__src, size_t __n) __THROW __nonnull ((1, 2)); __END_NAMESPACE_STD /* Copy no more than N bytes of SRC to DEST, stopping when C is found. Return the position in DEST one byte past where C was copied, or NULL if C was not found in the first N bytes of SRC. */ #if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN extern void *memccpy (void *__restrict __dest, const void *__restrict __src, int __c, size_t __n) __THROW __nonnull ((1, 2)); #endif /* SVID. */ __BEGIN_NAMESPACE_STD /* Set N bytes of S to C. */ extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); /* Compare N bytes of S1 and S2. */ extern int memcmp (const void *__s1, const void *__s2, size_t __n) __THROW __attribute_pure__ __nonnull ((1, 2)); /* Search N bytes of S for C. */ #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO extern "C++" { extern void *memchr (void *__s, int __c, size_t __n) __THROW __asm ("memchr") __attribute_pure__ __nonnull ((1)); extern const void *memchr (const void *__s, int __c, size_t __n) __THROW __asm ("memchr") __attribute_pure__ __nonnull ((1)); # ifdef __OPTIMIZE__ __extern_always_inline void * memchr (void *__s, int __c, size_t __n) __THROW { return __builtin_memchr (__s, __c, __n); } __extern_always_inline const void * memchr (const void *__s, int __c, size_t __n) __THROW { return __builtin_memchr (__s, __c, __n); } # endif } #else extern void *memchr (const void *__s, int __c, size_t __n) __THROW __attribute_pure__ __nonnull ((1)); #endif __END_NAMESPACE_STD #ifdef __USE_GNU /* Search in S for C. This is similar to `memchr' but there is no length limit. */ # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO extern "C++" void *rawmemchr (void *__s, int __c) __THROW __asm ("rawmemchr") __attribute_pure__ __nonnull ((1)); extern "C++" const void *rawmemchr (const void *__s, int __c) __THROW __asm ("rawmemchr") __attribute_pure__ __nonnull ((1)); # else extern void *rawmemchr (const void *__s, int __c) __THROW __attribute_pure__ __nonnull ((1)); # endif /* Search N bytes of S for the final occurrence of C. */ # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO extern "C++" void *memrchr (void *__s, int __c, size_t __n) __THROW __asm ("memrchr") __attribute_pure__ __nonnull ((1)); extern "C++" const void *memrchr (const void *__s, int __c, size_t __n) __THROW __asm ("memrchr") __attribute_pure__ __nonnull ((1)); # else extern void *memrchr (const void *__s, int __c, size_t __n) __THROW __attribute_pure__ __nonnull ((1)); # endif #endif __BEGIN_NAMESPACE_STD /* Copy SRC to DEST. */ extern char *strcpy (char *__restrict __dest, const char *__restrict __src) __THROW __nonnull ((1, 2)); /* Copy no more than N characters of SRC to DEST. */ extern char *strncpy (char *__restrict __dest, const char *__restrict __src, size_t __n) __THROW __nonnull ((1, 2)); /* Append SRC onto DEST. */ extern char *strcat (char *__restrict __dest, const char *__restrict __src) __THROW __nonnull ((1, 2)); /* Append no more than N characters from SRC onto DEST. */ extern char *strncat (char *__restrict __dest, const char *__restrict __src, size_t __n) __THROW __nonnull ((1, 2)); /* Compare S1 and S2. */ extern int strcmp (const char *__s1, const char *__s2) __THROW __attribute_pure__ __nonnull ((1, 2)); /* Compare N characters of S1 and S2. */ extern int strncmp (const char *__s1, const char *__s2, size_t __n) __THROW __attribute_pure__ __nonnull ((1, 2)); /* Compare the collated forms of S1 and S2. */ extern int strcoll (const char *__s1, const char *__s2) __THROW __attribute_pure__ __nonnull ((1, 2)); /* Put a transformation of SRC into no more than N bytes of DEST. */ extern size_t strxfrm (char *__restrict __dest, const char *__restrict __src, size_t __n) __THROW __nonnull ((2)); __END_NAMESPACE_STD #ifdef __USE_XOPEN2K8 /* The following functions are equivalent to the both above but they take the locale they use for the collation as an extra argument. This is not standardsized but something like will come. */ # include <xlocale.h> /* Compare the collated forms of S1 and S2 using rules from L. */ extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) __THROW __attribute_pure__ __nonnull ((1, 2, 3)); /* Put a transformation of SRC into no more than N bytes of DEST. */ extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, __locale_t __l) __THROW __nonnull ((2, 4)); #endif #if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED \ || defined __USE_XOPEN2K8 /* Duplicate S, returning an identical malloc'd string. */ extern char *strdup (const char *__s) __THROW __attribute_malloc__ __nonnull ((1)); #endif /* Return a malloc'd copy of at most N bytes of STRING. The resultant string is terminated even if no null terminator appears before STRING[N]. */ #if defined __USE_XOPEN2K8 extern char *strndup (const char *__string, size_t __n) __THROW __attribute_malloc__ __nonnull ((1)); #endif #if defined __USE_GNU && defined __GNUC__ /* Duplicate S, returning an identical alloca'd string. */ # define strdupa(s) \ (__extension__ \ ({ \ const char *__old = (s); \ size_t __len = strlen (__old) + 1; \ char *__new = (char *) __builtin_alloca (__len); \ (char *) memcpy (__new, __old, __len); \ })) /* Return an alloca'd copy of at most N bytes of string. */ # define strndupa(s, n) \ (__extension__ \ ({ \ const char *__old = (s); \ size_t __len = strnlen (__old, (n)); \ char *__new = (char *) __builtin_alloca (__len + 1); \ __new[__len] = '\0'; \ (char *) memcpy (__new, __old, __len); \ })) #endif __BEGIN_NAMESPACE_STD /* Find the first occurrence of C in S. */ #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO extern "C++" { extern char *strchr (char *__s, int __c) __THROW __asm ("strchr") __attribute_pure__ __nonnull ((1)); extern const char *strchr (const char *__s, int __c) __THROW __asm ("strchr") __attribute_pure__ __nonnull ((1)); # ifdef __OPTIMIZE__ __extern_always_inline char * strchr (char *__s, int __c) __THROW { return __builtin_strchr (__s, __c); } __extern_always_inline const char * strchr (const char *__s, int __c) __THROW { return __builtin_strchr (__s, __c); } # endif } #else extern char *strchr (const char *__s, int __c) __THROW __attribute_pure__ __nonnull ((1)); #endif /* Find the last occurrence of C in S. */ #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO extern "C++" { extern char *strrchr (char *__s, int __c) __THROW __asm ("strrchr") __attribute_pure__ __nonnull ((1)); extern const char *strrchr (const char *__s, int __c) __THROW __asm ("strrchr") __attribute_pure__ __nonnull ((1)); # ifdef __OPTIMIZE__ __extern_always_inline char * strrchr (char *__s, int __c) __THROW { return __builtin_strrchr (__s, __c); } __extern_always_inline const char * strrchr (const char *__s, int __c) __THROW { return __builtin_strrchr (__s, __c); } # endif } #else extern char *strrchr (const char *__s, int __c) __THROW __attribute_pure__ __nonnull ((1)); #endif __END_NAMESPACE_STD #ifdef __USE_GNU /* This function is similar to `strchr'. But it returns a pointer to the closing NUL byte in case C is not found in S. */ # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO extern "C++" char *strchrnul (char *__s, int __c) __THROW __asm ("strchrnul") __attribute_pure__ __nonnull ((1)); extern "C++" const char *strchrnul (const char *__s, int __c) __THROW __asm ("strchrnul") __attribute_pure__ __nonnull ((1)); # else extern char *strchrnul (const char *__s, int __c) __THROW __attribute_pure__ __nonnull ((1)); # endif #endif __BEGIN_NAMESPACE_STD /* Return the length of the initial segment of S which consists entirely of characters not in REJECT. */ extern size_t strcspn (const char *__s, const char *__reject) __THROW __attribute_pure__ __nonnull ((1, 2)); /* Return the length of the initial segment of S which consists entirely of characters in ACCEPT. */ extern size_t strspn (const char *__s, const char *__accept) __THROW __attribute_pure__ __nonnull ((1, 2)); /* Find the first occurrence in S of any character in ACCEPT. */ #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO extern "C++" { extern char *strpbrk (char *__s, const char *__accept) __THROW __asm ("strpbrk") __attribute_pure__ __nonnull ((1, 2)); extern const char *strpbrk (const char *__s, const char *__accept) __THROW __asm ("strpbrk") __attribute_pure__ __nonnull ((1, 2)); # ifdef __OPTIMIZE__ __extern_always_inline char * strpbrk (char *__s, const char *__accept) __THROW { return __builtin_strpbrk (__s, __accept); } __extern_always_inline const char * strpbrk (const char *__s, const char *__accept) __THROW { return __builtin_strpbrk (__s, __accept); } # endif } #else extern char *strpbrk (const char *__s, const char *__accept) __THROW __attribute_pure__ __nonnull ((1, 2)); #endif /* Find the first occurrence of NEEDLE in HAYSTACK. */ #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO extern "C++" { extern char *strstr (char *__haystack, const char *__needle) __THROW __asm ("strstr") __attribute_pure__ __nonnull ((1, 2)); extern const char *strstr (const char *__haystack, const char *__needle) __THROW __asm ("strstr") __attribute_pure__ __nonnull ((1, 2)); # ifdef __OPTIMIZE__ __extern_always_inline char * strstr (char *__haystack, const char *__needle) __THROW { return __builtin_strstr (__haystack, __needle); } __extern_always_inline const char * strstr (const char *__haystack, const char *__needle) __THROW { return __builtin_strstr (__haystack, __needle); } # endif } #else extern char *strstr (const char *__haystack, const char *__needle) __THROW __attribute_pure__ __nonnull ((1, 2)); #endif /* Divide S into tokens separated by characters in DELIM. */ extern char *strtok (char *__restrict __s, const char *__restrict __delim) __THROW __nonnull ((2)); __END_NAMESPACE_STD /* Divide S into tokens separated by characters in DELIM. Information passed between calls are stored in SAVE_PTR. */ extern char *__strtok_r (char *__restrict __s, const char *__restrict __delim, char **__restrict __save_ptr) __THROW __nonnull ((2, 3)); #if defined __USE_POSIX || defined __USE_MISC extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, char **__restrict __save_ptr) __THROW __nonnull ((2, 3)); #endif #ifdef __USE_GNU /* Similar to `strstr' but this function ignores the case of both strings. */ # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO extern "C++" char *strcasestr (char *__haystack, const char *__needle) __THROW __asm ("strcasestr") __attribute_pure__ __nonnull ((1, 2)); extern "C++" const char *strcasestr (const char *__haystack, const char *__needle) __THROW __asm ("strcasestr") __attribute_pure__ __nonnull ((1, 2)); # else extern char *strcasestr (const char *__haystack, const char *__needle) __THROW __attribute_pure__ __nonnull ((1, 2)); # endif #endif #ifdef __USE_GNU /* Find the first occurrence of NEEDLE in HAYSTACK. NEEDLE is NEEDLELEN bytes long; HAYSTACK is HAYSTACKLEN bytes long. */ extern void *memmem (const void *__haystack, size_t __haystacklen, const void *__needle, size_t __needlelen) __THROW __attribute_pure__ __nonnull ((1, 3)); /* Copy N bytes of SRC to DEST, return pointer to bytes after the last written byte. */ extern void *__mempcpy (void *__restrict __dest, const void *__restrict __src, size_t __n) __THROW __nonnull ((1, 2)); extern void *mempcpy (void *__restrict __dest, const void *__restrict __src, size_t __n) __THROW __nonnull ((1, 2)); #endif __BEGIN_NAMESPACE_STD /* Return the length of S. */ extern size_t strlen (const char *__s) __THROW __attribute_pure__ __nonnull ((1)); __END_NAMESPACE_STD #ifdef __USE_XOPEN2K8 /* Find the length of STRING, but scan at most MAXLEN characters. If no '\0' terminator is found in that many characters, return MAXLEN. */ extern size_t strnlen (const char *__string, size_t __maxlen) __THROW __attribute_pure__ __nonnull ((1)); #endif __BEGIN_NAMESPACE_STD /* Return a string describing the meaning of the `errno' code in ERRNUM. */ extern char *strerror (int __errnum) __THROW; __END_NAMESPACE_STD #if defined __USE_XOPEN2K || defined __USE_MISC /* Reentrant version of `strerror'. There are 2 flavors of `strerror_r', GNU which returns the string and may or may not use the supplied temporary buffer and POSIX one which fills the string into the buffer. To use the POSIX version, -D_XOPEN_SOURCE=600 or -D_POSIX_C_SOURCE=200112L without -D_GNU_SOURCE is needed, otherwise the GNU version is preferred. */ # if defined __USE_XOPEN2K && !defined __USE_GNU /* Fill BUF with a string describing the meaning of the `errno' code in ERRNUM. */ # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (strerror_r, (int __errnum, char *__buf, size_t __buflen), __xpg_strerror_r) __nonnull ((2)); # else extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen) __THROW __nonnull ((2)); # define strerror_r __xpg_strerror_r # endif # else /* If a temporary buffer is required, at most BUFLEN bytes of BUF will be used. */ extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) __THROW __nonnull ((2)) __wur; # endif #endif #ifdef __USE_XOPEN2K8 /* Translate error number to string according to the locale L. */ extern char *strerror_l (int __errnum, __locale_t __l) __THROW; #endif /* We define this function always since `bzero' is sometimes needed when the namespace rules does not allow this. */ extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1)); #ifdef __USE_BSD /* Copy N bytes of SRC to DEST (like memmove, but args reversed). */ extern void bcopy (const void *__src, void *__dest, size_t __n) __THROW __nonnull ((1, 2)); /* Set N bytes of S to 0. */ extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1)); /* Compare N bytes of S1 and S2 (same as memcmp). */ extern int bcmp (const void *__s1, const void *__s2, size_t __n) __THROW __attribute_pure__ __nonnull ((1, 2)); /* Find the first occurrence of C in S (same as strchr). */ # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO extern "C++" { extern char *index (char *__s, int __c) __THROW __asm ("index") __attribute_pure__ __nonnull ((1)); extern const char *index (const char *__s, int __c) __THROW __asm ("index") __attribute_pure__ __nonnull ((1)); # if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRINGS_H_PROTO __extern_always_inline char * index (char *__s, int __c) __THROW { return __builtin_index (__s, __c); } __extern_always_inline const char * index (const char *__s, int __c) __THROW { return __builtin_index (__s, __c); } # endif } # else extern char *index (const char *__s, int __c) __THROW __attribute_pure__ __nonnull ((1)); # endif /* Find the last occurrence of C in S (same as strrchr). */ # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO extern "C++" { extern char *rindex (char *__s, int __c) __THROW __asm ("rindex") __attribute_pure__ __nonnull ((1)); extern const char *rindex (const char *__s, int __c) __THROW __asm ("rindex") __attribute_pure__ __nonnull ((1)); # if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRINGS_H_PROTO __extern_always_inline char * rindex (char *__s, int __c) __THROW { return __builtin_rindex (__s, __c); } __extern_always_inline const char * rindex (const char *__s, int __c) __THROW { return __builtin_rindex (__s, __c); } #endif } # else extern char *rindex (const char *__s, int __c) __THROW __attribute_pure__ __nonnull ((1)); # endif /* Return the position of the first bit set in I, or 0 if none are set. The least-significant bit is position 1, the most-significant 32. */ extern int ffs (int __i) __THROW __attribute__ ((__const__)); /* The following two functions are non-standard but necessary for non-32 bit platforms. */ # ifdef __USE_GNU extern int ffsl (long int __l) __THROW __attribute__ ((__const__)); # ifdef __GNUC__ __extension__ extern int ffsll (long long int __ll) __THROW __attribute__ ((__const__)); # endif # endif /* Compare S1 and S2, ignoring case. */ extern int strcasecmp (const char *__s1, const char *__s2) __THROW __attribute_pure__ __nonnull ((1, 2)); /* Compare no more than N chars of S1 and S2, ignoring case. */ extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) __THROW __attribute_pure__ __nonnull ((1, 2)); #endif /* Use BSD. */ #ifdef __USE_GNU /* Again versions of a few functions which use the given locale instead of the global one. */ extern int strcasecmp_l (const char *__s1, const char *__s2, __locale_t __loc) __THROW __attribute_pure__ __nonnull ((1, 2, 3)); extern int strncasecmp_l (const char *__s1, const char *__s2, size_t __n, __locale_t __loc) __THROW __attribute_pure__ __nonnull ((1, 2, 4)); #endif #ifdef __USE_BSD /* Return the next DELIM-delimited token from *STRINGP, terminating it with a '\0', and update *STRINGP to point past it. */ extern char *strsep (char **__restrict __stringp, const char *__restrict __delim) __THROW __nonnull ((1, 2)); #endif #ifdef __USE_XOPEN2K8 /* Return a string describing the meaning of the signal number in SIG. */ extern char *strsignal (int __sig) __THROW; /* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */ extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) __THROW __nonnull ((1, 2)); extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) __THROW __nonnull ((1, 2)); /* Copy no more than N characters of SRC to DEST, returning the address of the last character written into DEST. */ extern char *__stpncpy (char *__restrict __dest, const char *__restrict __src, size_t __n) __THROW __nonnull ((1, 2)); extern char *stpncpy (char *__restrict __dest, const char *__restrict __src, size_t __n) __THROW __nonnull ((1, 2)); #endif #ifdef __USE_GNU /* Compare S1 and S2 as strings holding name & indices/version numbers. */ extern int strverscmp (const char *__s1, const char *__s2) __THROW __attribute_pure__ __nonnull ((1, 2)); /* Sautee STRING briskly. */ extern char *strfry (char *__string) __THROW __nonnull ((1)); /* Frobnicate N bytes of S. */ extern void *memfrob (void *__s, size_t __n) __THROW __nonnull ((1)); # ifndef basename /* Return the file name within directory of FILENAME. We don't declare the function if the `basename' macro is available (defined in <libgen.h>) which makes the XPG version of this function available. */ # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO extern "C++" char *basename (char *__filename) __THROW __asm ("basename") __nonnull ((1)); extern "C++" const char *basename (const char *__filename) __THROW __asm ("basename") __nonnull ((1)); # else extern char *basename (const char *__filename) __THROW __nonnull ((1)); # endif # endif #endif #if defined __GNUC__ && __GNUC__ >= 2 # if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \ && !defined __NO_INLINE__ && !defined __cplusplus /* When using GNU CC we provide some optimized versions of selected functions from this header. There are two kinds of optimizations: - machine-dependent optimizations, most probably using inline assembler code; these might be quite expensive since the code size can increase significantly. These optimizations are not used unless the symbol __USE_STRING_INLINES is defined before including this header. - machine-independent optimizations which do not increase the code size significantly and which optimize mainly situations where one or more arguments are compile-time constants. These optimizations are used always when the compiler is taught to optimize. One can inhibit all optimizations by defining __NO_STRING_INLINES. */ /* Get the machine-dependent optimizations (if any). */ # include <bits/string.h> /* These are generic optimizations which do not add too much inline code. */ # include <bits/string2.h> # endif # if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function /* Functions with security checks. */ # include <bits/string3.h> # endif #endif __END_DECLS #endif /* string.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������poll.h����������������������������������������������������������������������������������������������0000644�����������������00000000026�14763166027�0005675 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <sys/poll.h> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������features.h������������������������������������������������������������������������������������������0000644�����������������00000031576�14763166027�0006563 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _FEATURES_H #define _FEATURES_H 1 /* These are defined by the user (or the compiler) to specify the desired environment: __STRICT_ANSI__ ISO Standard C. _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. _POSIX_SOURCE IEEE Std 1003.1. _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2; if >=199309L, add IEEE Std 1003.1b-1993; if >=199506L, add IEEE Std 1003.1c-1995; if >=200112L, all of IEEE 1003.1-2004 if >=200809L, all of IEEE 1003.1-2008 _XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if Single Unix conformance is wanted, to 600 for the sixth revision, to 700 for the seventh revision. _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions. _LARGEFILE_SOURCE Some more functions for correct standard I/O. _LARGEFILE64_SOURCE Additional functionality from LFS for large files. _FILE_OFFSET_BITS=N Select default filesystem interface. _BSD_SOURCE ISO C, POSIX, and 4.3BSD things. _SVID_SOURCE ISO C, POSIX, and SVID things. _ATFILE_SOURCE Additional *at interfaces. _GNU_SOURCE All of the above, plus GNU extensions. _REENTRANT Select additionally reentrant object. _THREAD_SAFE Same as _REENTRANT, often used by other systems. _FORTIFY_SOURCE If set to numeric value > 0 additional security measures are defined, according to level. The `-ansi' switch to the GNU C compiler defines __STRICT_ANSI__. If none of these are defined, the default is to have _SVID_SOURCE, _BSD_SOURCE, and _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to 200112L. If more than one of these are defined, they accumulate. For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE together give you ISO C, 1003.1, and 1003.2, but nothing else. These are defined by this file and are used by the header files to decide what to declare or define: __USE_ISOC11 Define ISO C11 things. __USE_ISOC99 Define ISO C99 things. __USE_ISOC95 Define ISO C90 AMD1 (C95) things. __USE_POSIX Define IEEE Std 1003.1 things. __USE_POSIX2 Define IEEE Std 1003.2 things. __USE_POSIX199309 Define IEEE Std 1003.1, and .1b things. __USE_POSIX199506 Define IEEE Std 1003.1, .1b, .1c and .1i things. __USE_XOPEN Define XPG things. __USE_XOPEN_EXTENDED Define X/Open Unix things. __USE_UNIX98 Define Single Unix V2 things. __USE_XOPEN2K Define XPG6 things. __USE_XOPEN2KXSI Define XPG6 XSI things. __USE_XOPEN2K8 Define XPG7 things. __USE_XOPEN2K8XSI Define XPG7 XSI things. __USE_LARGEFILE Define correct standard I/O things. __USE_LARGEFILE64 Define LFS things with separate names. __USE_FILE_OFFSET64 Define 64bit interface as default. __USE_BSD Define 4.3BSD things. __USE_SVID Define SVID things. __USE_MISC Define things common to BSD and System V Unix. __USE_ATFILE Define *at interfaces and AT_* constants for them. __USE_GNU Define GNU extensions. __USE_REENTRANT Define reentrant/thread-safe *_r functions. __USE_FORTIFY_LEVEL Additional security measures used, according to level. __FAVOR_BSD Favor 4.3BSD things in cases of conflict. The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are defined by this file unconditionally. `__GNU_LIBRARY__' is provided only for compatibility. All new code should use the other symbols to test for features. All macros listed above as possibly being defined by this file are explicitly undefined if they are not explicitly defined. Feature-test macros that are not defined by the user or compiler but are implied by the other feature-test macros defined (or by the lack of any definitions) are defined by the file. */ /* Undefine everything, so we get a clean slate. */ #undef __USE_ISOC11 #undef __USE_ISOC99 #undef __USE_ISOC95 #undef __USE_ISOCXX11 #undef __USE_POSIX #undef __USE_POSIX2 #undef __USE_POSIX199309 #undef __USE_POSIX199506 #undef __USE_XOPEN #undef __USE_XOPEN_EXTENDED #undef __USE_UNIX98 #undef __USE_XOPEN2K #undef __USE_XOPEN2KXSI #undef __USE_XOPEN2K8 #undef __USE_XOPEN2K8XSI #undef __USE_LARGEFILE #undef __USE_LARGEFILE64 #undef __USE_FILE_OFFSET64 #undef __USE_BSD #undef __USE_SVID #undef __USE_MISC #undef __USE_ATFILE #undef __USE_GNU #undef __USE_REENTRANT #undef __USE_FORTIFY_LEVEL #undef __FAVOR_BSD #undef __KERNEL_STRICT_NAMES /* Suppress kernel-name space pollution unless user expressedly asks for it. */ #ifndef _LOOSE_KERNEL_NAMES # define __KERNEL_STRICT_NAMES #endif /* Always use ISO C things. */ #define __USE_ANSI 1 /* Convenience macros to test the versions of glibc and gcc. Use them like this: #if __GNUC_PREREQ (2,8) ... code requiring gcc 2.8 or later ... #endif Note - they won't work for gcc1 or glibc1, since the _MINOR macros were not defined then. */ #if defined __GNUC__ && defined __GNUC_MINOR__ # define __GNUC_PREREQ(maj, min) \ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) #else # define __GNUC_PREREQ(maj, min) 0 #endif /* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */ #if defined _BSD_SOURCE && \ !(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \ defined _XOPEN_SOURCE || defined _GNU_SOURCE || defined _SVID_SOURCE) # define __FAVOR_BSD 1 #endif /* If _GNU_SOURCE was defined by the user, turn on all the other features. */ #ifdef _GNU_SOURCE # undef _ISOC95_SOURCE # define _ISOC95_SOURCE 1 # undef _ISOC99_SOURCE # define _ISOC99_SOURCE 1 # undef _ISOC11_SOURCE # define _ISOC11_SOURCE 1 # undef _POSIX_SOURCE # define _POSIX_SOURCE 1 # undef _POSIX_C_SOURCE # define _POSIX_C_SOURCE 200809L # undef _XOPEN_SOURCE # define _XOPEN_SOURCE 700 # undef _XOPEN_SOURCE_EXTENDED # define _XOPEN_SOURCE_EXTENDED 1 # undef _LARGEFILE64_SOURCE # define _LARGEFILE64_SOURCE 1 # undef _BSD_SOURCE # define _BSD_SOURCE 1 # undef _SVID_SOURCE # define _SVID_SOURCE 1 # undef _ATFILE_SOURCE # define _ATFILE_SOURCE 1 #endif /* If nothing (other than _GNU_SOURCE) is defined, define _BSD_SOURCE and _SVID_SOURCE. */ #if (!defined __STRICT_ANSI__ && !defined _ISOC99_SOURCE && \ !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE && \ !defined _XOPEN_SOURCE && !defined _BSD_SOURCE && !defined _SVID_SOURCE) # define _BSD_SOURCE 1 # define _SVID_SOURCE 1 #endif /* This is to enable the ISO C11 extension. */ #if (defined _ISOC11_SOURCE \ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L)) # define __USE_ISOC11 1 #endif /* This is to enable the ISO C99 extension. */ #if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) # define __USE_ISOC99 1 #endif /* This is to enable the ISO C90 Amendment 1:1995 extension. */ #if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199409L)) # define __USE_ISOC95 1 #endif /* This is to enable compatibility for ISO C++11. So far g++ does not provide a macro. Check the temporary macro for now, too. */ #if ((defined __cplusplus && __cplusplus >= 201103L) \ || defined __GXX_EXPERIMENTAL_CXX0X__) # define __USE_ISOCXX11 1 #endif /* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2 (and IEEE Std 1003.1b-1993 unless _XOPEN_SOURCE is defined). */ #if ((!defined __STRICT_ANSI__ || (_XOPEN_SOURCE - 0) >= 500) && \ !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE) # define _POSIX_SOURCE 1 # if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500 # define _POSIX_C_SOURCE 2 # elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 600 # define _POSIX_C_SOURCE 199506L # elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 700 # define _POSIX_C_SOURCE 200112L # else # define _POSIX_C_SOURCE 200809L # endif # define __USE_POSIX_IMPLICITLY 1 #endif #if defined _POSIX_SOURCE || _POSIX_C_SOURCE >= 1 || defined _XOPEN_SOURCE # define __USE_POSIX 1 #endif #if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE # define __USE_POSIX2 1 #endif #if (_POSIX_C_SOURCE - 0) >= 199309L # define __USE_POSIX199309 1 #endif #if (_POSIX_C_SOURCE - 0) >= 199506L # define __USE_POSIX199506 1 #endif #if (_POSIX_C_SOURCE - 0) >= 200112L # define __USE_XOPEN2K 1 # undef __USE_ISOC95 # define __USE_ISOC95 1 # undef __USE_ISOC99 # define __USE_ISOC99 1 #endif #if (_POSIX_C_SOURCE - 0) >= 200809L # define __USE_XOPEN2K8 1 # undef _ATFILE_SOURCE # define _ATFILE_SOURCE 1 #endif #ifdef _XOPEN_SOURCE # define __USE_XOPEN 1 # if (_XOPEN_SOURCE - 0) >= 500 # define __USE_XOPEN_EXTENDED 1 # define __USE_UNIX98 1 # undef _LARGEFILE_SOURCE # define _LARGEFILE_SOURCE 1 # if (_XOPEN_SOURCE - 0) >= 600 # if (_XOPEN_SOURCE - 0) >= 700 # define __USE_XOPEN2K8 1 # define __USE_XOPEN2K8XSI 1 # endif # define __USE_XOPEN2K 1 # define __USE_XOPEN2KXSI 1 # undef __USE_ISOC95 # define __USE_ISOC95 1 # undef __USE_ISOC99 # define __USE_ISOC99 1 # endif # else # ifdef _XOPEN_SOURCE_EXTENDED # define __USE_XOPEN_EXTENDED 1 # endif # endif #endif #ifdef _LARGEFILE_SOURCE # define __USE_LARGEFILE 1 #endif #ifdef _LARGEFILE64_SOURCE # define __USE_LARGEFILE64 1 #endif #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64 # define __USE_FILE_OFFSET64 1 #endif #if defined _BSD_SOURCE || defined _SVID_SOURCE # define __USE_MISC 1 #endif #ifdef _BSD_SOURCE # define __USE_BSD 1 #endif #ifdef _SVID_SOURCE # define __USE_SVID 1 #endif #ifdef _ATFILE_SOURCE # define __USE_ATFILE 1 #endif #ifdef _GNU_SOURCE # define __USE_GNU 1 #endif #if defined _REENTRANT || defined _THREAD_SAFE # define __USE_REENTRANT 1 #endif #if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 # if !defined __OPTIMIZE__ || __OPTIMIZE__ <= 0 # warning _FORTIFY_SOURCE requires compiling with optimization (-O) # elif !__GNUC_PREREQ (4, 1) # warning _FORTIFY_SOURCE requires GCC 4.1 or later # elif _FORTIFY_SOURCE > 1 # define __USE_FORTIFY_LEVEL 2 # else # define __USE_FORTIFY_LEVEL 1 # endif #endif #ifndef __USE_FORTIFY_LEVEL # define __USE_FORTIFY_LEVEL 0 #endif /* Get definitions of __STDC_* predefined macros, if the compiler has not preincluded this header automatically. */ #include <stdc-predef.h> /* This macro indicates that the installed library is the GNU C Library. For historic reasons the value now is 6 and this will stay from now on. The use of this variable is deprecated. Use __GLIBC__ and __GLIBC_MINOR__ now (see below) when you want to test for a specific GNU C library version and use the values in <gnu/lib-names.h> to get the sonames of the shared libraries. */ #undef __GNU_LIBRARY__ #define __GNU_LIBRARY__ 6 /* Major and minor version number of the GNU C library package. Use these macros to test for features in specific releases. */ #define __GLIBC__ 2 #define __GLIBC_MINOR__ 17 #define __GLIBC_PREREQ(maj, min) \ ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)) /* Decide whether a compiler supports the long long datatypes. */ #if defined __GNUC__ \ || (defined __PGI && defined __i386__ ) \ || (defined __INTEL_COMPILER && (defined __i386__ || defined __ia64__)) \ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) # define __GLIBC_HAVE_LONG_LONG 1 #endif /* This is here only because every header file already includes this one. */ #ifndef __ASSEMBLER__ # ifndef _SYS_CDEFS_H # include <sys/cdefs.h> # endif /* If we don't have __REDIRECT, prototypes will be missing if __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64]. */ # if defined __USE_FILE_OFFSET64 && !defined __REDIRECT # define __USE_LARGEFILE 1 # define __USE_LARGEFILE64 1 # endif #endif /* !ASSEMBLER */ /* Decide whether we can define 'extern inline' functions in headers. */ #if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \ && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ \ && defined __extern_inline # define __USE_EXTERN_INLINES 1 #endif /* This is here only because every header file already includes this one. Get the definitions of all the appropriate `__stub_FUNCTION' symbols. <gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub that will always return failure (and set errno to ENOSYS). */ #include <gnu/stubs.h> #endif /* features.h */ ����������������������������������������������������������������������������������������������������������������������������������tgmath.h��������������������������������������������������������������������������������������������0000644�����������������00000044157�14763166027�0006230 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 Standard: 7.22 Type-generic math <tgmath.h> */ #ifndef _TGMATH_H #define _TGMATH_H 1 /* Include the needed headers. */ #include <math.h> #include <complex.h> /* Since `complex' is currently not really implemented in most C compilers and if it is implemented, the implementations differ. This makes it quite difficult to write a generic implementation of this header. We do not try this for now and instead concentrate only on GNU CC. Once we have more information support for other compilers might follow. */ #if __GNUC_PREREQ (2, 7) # ifdef __NO_LONG_DOUBLE_MATH # define __tgml(fct) fct # else # define __tgml(fct) fct ## l # endif /* This is ugly but unless gcc gets appropriate builtins we have to do something like this. Don't ask how it works. */ /* 1 if 'type' is a floating type, 0 if 'type' is an integer type. Allows for _Bool. Expands to an integer constant expression. */ # if __GNUC_PREREQ (3, 1) # define __floating_type(type) \ (__builtin_classify_type ((type) 0) == 8 \ || (__builtin_classify_type ((type) 0) == 9 \ && __builtin_classify_type (__real__ ((type) 0)) == 8)) # else # define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1)) # endif /* The tgmath real type for T, where E is 0 if T is an integer type and 1 for a floating type. */ # define __tgmath_real_type_sub(T, E) \ __typeof__ (*(0 ? (__typeof__ (0 ? (double *) 0 : (void *) (E))) 0 \ : (__typeof__ (0 ? (T *) 0 : (void *) (!(E)))) 0)) /* The tgmath real type of EXPR. */ # define __tgmath_real_type(expr) \ __tgmath_real_type_sub (__typeof__ ((__typeof__ (expr)) 0), \ __floating_type (__typeof__ (expr))) /* We have two kinds of generic macros: to support functions which are only defined on real valued parameters and those which are defined for complex functions as well. */ # define __TGMATH_UNARY_REAL_ONLY(Val, Fct) \ (__extension__ ((sizeof (Val) == sizeof (double) \ || __builtin_classify_type (Val) != 8) \ ? (__tgmath_real_type (Val)) Fct (Val) \ : (sizeof (Val) == sizeof (float)) \ ? (__tgmath_real_type (Val)) Fct##f (Val) \ : (__tgmath_real_type (Val)) __tgml(Fct) (Val))) # define __TGMATH_UNARY_REAL_RET_ONLY(Val, RetType, Fct) \ (__extension__ ((sizeof (Val) == sizeof (double) \ || __builtin_classify_type (Val) != 8) \ ? (RetType) Fct (Val) \ : (sizeof (Val) == sizeof (float)) \ ? (RetType) Fct##f (Val) \ : (RetType) __tgml(Fct) (Val))) # define __TGMATH_BINARY_FIRST_REAL_ONLY(Val1, Val2, Fct) \ (__extension__ ((sizeof (Val1) == sizeof (double) \ || __builtin_classify_type (Val1) != 8) \ ? (__tgmath_real_type (Val1)) Fct (Val1, Val2) \ : (sizeof (Val1) == sizeof (float)) \ ? (__tgmath_real_type (Val1)) Fct##f (Val1, Val2) \ : (__tgmath_real_type (Val1)) __tgml(Fct) (Val1, Val2))) # define __TGMATH_BINARY_REAL_ONLY(Val1, Val2, Fct) \ (__extension__ (((sizeof (Val1) > sizeof (double) \ || sizeof (Val2) > sizeof (double)) \ && __builtin_classify_type ((Val1) + (Val2)) == 8) \ ? (__typeof ((__tgmath_real_type (Val1)) 0 \ + (__tgmath_real_type (Val2)) 0)) \ __tgml(Fct) (Val1, Val2) \ : (sizeof (Val1) == sizeof (double) \ || sizeof (Val2) == sizeof (double) \ || __builtin_classify_type (Val1) != 8 \ || __builtin_classify_type (Val2) != 8) \ ? (__typeof ((__tgmath_real_type (Val1)) 0 \ + (__tgmath_real_type (Val2)) 0)) \ Fct (Val1, Val2) \ : (__typeof ((__tgmath_real_type (Val1)) 0 \ + (__tgmath_real_type (Val2)) 0)) \ Fct##f (Val1, Val2))) # define __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY(Val1, Val2, Val3, Fct) \ (__extension__ (((sizeof (Val1) > sizeof (double) \ || sizeof (Val2) > sizeof (double)) \ && __builtin_classify_type ((Val1) + (Val2)) == 8) \ ? (__typeof ((__tgmath_real_type (Val1)) 0 \ + (__tgmath_real_type (Val2)) 0)) \ __tgml(Fct) (Val1, Val2, Val3) \ : (sizeof (Val1) == sizeof (double) \ || sizeof (Val2) == sizeof (double) \ || __builtin_classify_type (Val1) != 8 \ || __builtin_classify_type (Val2) != 8) \ ? (__typeof ((__tgmath_real_type (Val1)) 0 \ + (__tgmath_real_type (Val2)) 0)) \ Fct (Val1, Val2, Val3) \ : (__typeof ((__tgmath_real_type (Val1)) 0 \ + (__tgmath_real_type (Val2)) 0)) \ Fct##f (Val1, Val2, Val3))) # define __TGMATH_TERNARY_REAL_ONLY(Val1, Val2, Val3, Fct) \ (__extension__ (((sizeof (Val1) > sizeof (double) \ || sizeof (Val2) > sizeof (double) \ || sizeof (Val3) > sizeof (double)) \ && __builtin_classify_type ((Val1) + (Val2) + (Val3)) \ == 8) \ ? (__typeof ((__tgmath_real_type (Val1)) 0 \ + (__tgmath_real_type (Val2)) 0 \ + (__tgmath_real_type (Val3)) 0)) \ __tgml(Fct) (Val1, Val2, Val3) \ : (sizeof (Val1) == sizeof (double) \ || sizeof (Val2) == sizeof (double) \ || sizeof (Val3) == sizeof (double) \ || __builtin_classify_type (Val1) != 8 \ || __builtin_classify_type (Val2) != 8 \ || __builtin_classify_type (Val3) != 8) \ ? (__typeof ((__tgmath_real_type (Val1)) 0 \ + (__tgmath_real_type (Val2)) 0 \ + (__tgmath_real_type (Val3)) 0)) \ Fct (Val1, Val2, Val3) \ : (__typeof ((__tgmath_real_type (Val1)) 0 \ + (__tgmath_real_type (Val2)) 0 \ + (__tgmath_real_type (Val3)) 0)) \ Fct##f (Val1, Val2, Val3))) /* XXX This definition has to be changed as soon as the compiler understands the imaginary keyword. */ # define __TGMATH_UNARY_REAL_IMAG(Val, Fct, Cfct) \ (__extension__ ((sizeof (__real__ (Val)) == sizeof (double) \ || __builtin_classify_type (__real__ (Val)) != 8) \ ? ((sizeof (__real__ (Val)) == sizeof (Val)) \ ? (__tgmath_real_type (Val)) Fct (Val) \ : (__tgmath_real_type (Val)) Cfct (Val)) \ : (sizeof (__real__ (Val)) == sizeof (float)) \ ? ((sizeof (__real__ (Val)) == sizeof (Val)) \ ? (__tgmath_real_type (Val)) Fct##f (Val) \ : (__tgmath_real_type (Val)) Cfct##f (Val)) \ : ((sizeof (__real__ (Val)) == sizeof (Val)) \ ? (__tgmath_real_type (Val)) __tgml(Fct) (Val) \ : (__tgmath_real_type (Val)) __tgml(Cfct) (Val)))) # define __TGMATH_UNARY_IMAG(Val, Cfct) \ (__extension__ ((sizeof (__real__ (Val)) == sizeof (double) \ || __builtin_classify_type (__real__ (Val)) != 8) \ ? (__typeof__ ((__tgmath_real_type (Val)) 0 \ + _Complex_I)) Cfct (Val) \ : (sizeof (__real__ (Val)) == sizeof (float)) \ ? (__typeof__ ((__tgmath_real_type (Val)) 0 \ + _Complex_I)) Cfct##f (Val) \ : (__typeof__ ((__tgmath_real_type (Val)) 0 \ + _Complex_I)) __tgml(Cfct) (Val))) /* XXX This definition has to be changed as soon as the compiler understands the imaginary keyword. */ # define __TGMATH_UNARY_REAL_IMAG_RET_REAL(Val, Fct, Cfct) \ (__extension__ ((sizeof (__real__ (Val)) == sizeof (double) \ || __builtin_classify_type (__real__ (Val)) != 8) \ ? ((sizeof (__real__ (Val)) == sizeof (Val)) \ ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\ Fct (Val) \ : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\ Cfct (Val)) \ : (sizeof (__real__ (Val)) == sizeof (float)) \ ? ((sizeof (__real__ (Val)) == sizeof (Val)) \ ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\ Fct##f (Val) \ : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\ Cfct##f (Val)) \ : ((sizeof (__real__ (Val)) == sizeof (Val)) \ ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\ __tgml(Fct) (Val) \ : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\ __tgml(Cfct) (Val)))) /* XXX This definition has to be changed as soon as the compiler understands the imaginary keyword. */ # define __TGMATH_BINARY_REAL_IMAG(Val1, Val2, Fct, Cfct) \ (__extension__ (((sizeof (__real__ (Val1)) > sizeof (double) \ || sizeof (__real__ (Val2)) > sizeof (double)) \ && __builtin_classify_type (__real__ (Val1) \ + __real__ (Val2)) == 8) \ ? ((sizeof (__real__ (Val1)) == sizeof (Val1) \ && sizeof (__real__ (Val2)) == sizeof (Val2)) \ ? (__typeof ((__tgmath_real_type (Val1)) 0 \ + (__tgmath_real_type (Val2)) 0)) \ __tgml(Fct) (Val1, Val2) \ : (__typeof ((__tgmath_real_type (Val1)) 0 \ + (__tgmath_real_type (Val2)) 0)) \ __tgml(Cfct) (Val1, Val2)) \ : (sizeof (__real__ (Val1)) == sizeof (double) \ || sizeof (__real__ (Val2)) == sizeof (double) \ || __builtin_classify_type (__real__ (Val1)) != 8 \ || __builtin_classify_type (__real__ (Val2)) != 8) \ ? ((sizeof (__real__ (Val1)) == sizeof (Val1) \ && sizeof (__real__ (Val2)) == sizeof (Val2)) \ ? (__typeof ((__tgmath_real_type (Val1)) 0 \ + (__tgmath_real_type (Val2)) 0)) \ Fct (Val1, Val2) \ : (__typeof ((__tgmath_real_type (Val1)) 0 \ + (__tgmath_real_type (Val2)) 0)) \ Cfct (Val1, Val2)) \ : ((sizeof (__real__ (Val1)) == sizeof (Val1) \ && sizeof (__real__ (Val2)) == sizeof (Val2)) \ ? (__typeof ((__tgmath_real_type (Val1)) 0 \ + (__tgmath_real_type (Val2)) 0)) \ Fct##f (Val1, Val2) \ : (__typeof ((__tgmath_real_type (Val1)) 0 \ + (__tgmath_real_type (Val2)) 0)) \ Cfct##f (Val1, Val2)))) #else # error "Unsupported compiler; you cannot use <tgmath.h>" #endif /* Unary functions defined for real and complex values. */ /* Trigonometric functions. */ /* Arc cosine of X. */ #define acos(Val) __TGMATH_UNARY_REAL_IMAG (Val, acos, cacos) /* Arc sine of X. */ #define asin(Val) __TGMATH_UNARY_REAL_IMAG (Val, asin, casin) /* Arc tangent of X. */ #define atan(Val) __TGMATH_UNARY_REAL_IMAG (Val, atan, catan) /* Arc tangent of Y/X. */ #define atan2(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, atan2) /* Cosine of X. */ #define cos(Val) __TGMATH_UNARY_REAL_IMAG (Val, cos, ccos) /* Sine of X. */ #define sin(Val) __TGMATH_UNARY_REAL_IMAG (Val, sin, csin) /* Tangent of X. */ #define tan(Val) __TGMATH_UNARY_REAL_IMAG (Val, tan, ctan) /* Hyperbolic functions. */ /* Hyperbolic arc cosine of X. */ #define acosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, acosh, cacosh) /* Hyperbolic arc sine of X. */ #define asinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, asinh, casinh) /* Hyperbolic arc tangent of X. */ #define atanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, atanh, catanh) /* Hyperbolic cosine of X. */ #define cosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, cosh, ccosh) /* Hyperbolic sine of X. */ #define sinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, sinh, csinh) /* Hyperbolic tangent of X. */ #define tanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, tanh, ctanh) /* Exponential and logarithmic functions. */ /* Exponential function of X. */ #define exp(Val) __TGMATH_UNARY_REAL_IMAG (Val, exp, cexp) /* Break VALUE into a normalized fraction and an integral power of 2. */ #define frexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, frexp) /* X times (two to the EXP power). */ #define ldexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, ldexp) /* Natural logarithm of X. */ #define log(Val) __TGMATH_UNARY_REAL_IMAG (Val, log, clog) /* Base-ten logarithm of X. */ #ifdef __USE_GNU # define log10(Val) __TGMATH_UNARY_REAL_IMAG (Val, log10, __clog10) #else # define log10(Val) __TGMATH_UNARY_REAL_ONLY (Val, log10) #endif /* Return exp(X) - 1. */ #define expm1(Val) __TGMATH_UNARY_REAL_ONLY (Val, expm1) /* Return log(1 + X). */ #define log1p(Val) __TGMATH_UNARY_REAL_ONLY (Val, log1p) /* Return the base 2 signed integral exponent of X. */ #define logb(Val) __TGMATH_UNARY_REAL_ONLY (Val, logb) /* Compute base-2 exponential of X. */ #define exp2(Val) __TGMATH_UNARY_REAL_ONLY (Val, exp2) /* Compute base-2 logarithm of X. */ #define log2(Val) __TGMATH_UNARY_REAL_ONLY (Val, log2) /* Power functions. */ /* Return X to the Y power. */ #define pow(Val1, Val2) __TGMATH_BINARY_REAL_IMAG (Val1, Val2, pow, cpow) /* Return the square root of X. */ #define sqrt(Val) __TGMATH_UNARY_REAL_IMAG (Val, sqrt, csqrt) /* Return `sqrt(X*X + Y*Y)'. */ #define hypot(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, hypot) /* Return the cube root of X. */ #define cbrt(Val) __TGMATH_UNARY_REAL_ONLY (Val, cbrt) /* Nearest integer, absolute value, and remainder functions. */ /* Smallest integral value not less than X. */ #define ceil(Val) __TGMATH_UNARY_REAL_ONLY (Val, ceil) /* Absolute value of X. */ #define fabs(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, fabs, cabs) /* Largest integer not greater than X. */ #define floor(Val) __TGMATH_UNARY_REAL_ONLY (Val, floor) /* Floating-point modulo remainder of X/Y. */ #define fmod(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmod) /* Round X to integral valuein floating-point format using current rounding direction, but do not raise inexact exception. */ #define nearbyint(Val) __TGMATH_UNARY_REAL_ONLY (Val, nearbyint) /* Round X to nearest integral value, rounding halfway cases away from zero. */ #define round(Val) __TGMATH_UNARY_REAL_ONLY (Val, round) /* Round X to the integral value in floating-point format nearest but not larger in magnitude. */ #define trunc(Val) __TGMATH_UNARY_REAL_ONLY (Val, trunc) /* Compute remainder of X and Y and put in *QUO a value with sign of x/y and magnitude congruent `mod 2^n' to the magnitude of the integral quotient x/y, with n >= 3. */ #define remquo(Val1, Val2, Val3) \ __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY (Val1, Val2, Val3, remquo) /* Round X to nearest integral value according to current rounding direction. */ #define lrint(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long int, lrint) #define llrint(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long long int, llrint) /* Round X to nearest integral value, rounding halfway cases away from zero. */ #define lround(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long int, lround) #define llround(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long long int, llround) /* Return X with its signed changed to Y's. */ #define copysign(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, copysign) /* Error and gamma functions. */ #define erf(Val) __TGMATH_UNARY_REAL_ONLY (Val, erf) #define erfc(Val) __TGMATH_UNARY_REAL_ONLY (Val, erfc) #define tgamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, tgamma) #define lgamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, lgamma) /* Return the integer nearest X in the direction of the prevailing rounding mode. */ #define rint(Val) __TGMATH_UNARY_REAL_ONLY (Val, rint) /* Return X + epsilon if X < Y, X - epsilon if X > Y. */ #define nextafter(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, nextafter) #define nexttoward(Val1, Val2) \ __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, nexttoward) /* Return the remainder of integer divison X / Y with infinite precision. */ #define remainder(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, remainder) /* Return X times (2 to the Nth power). */ #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED # define scalb(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, scalb) #endif /* Return X times (2 to the Nth power). */ #define scalbn(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbn) /* Return X times (2 to the Nth power). */ #define scalbln(Val1, Val2) \ __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbln) /* Return the binary exponent of X, which must be nonzero. */ #define ilogb(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, int, ilogb) /* Return positive difference between X and Y. */ #define fdim(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fdim) /* Return maximum numeric value from X and Y. */ #define fmax(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmax) /* Return minimum numeric value from X and Y. */ #define fmin(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmin) /* Multiply-add function computed as a ternary operation. */ #define fma(Val1, Val2, Val3) \ __TGMATH_TERNARY_REAL_ONLY (Val1, Val2, Val3, fma) /* Absolute value, conjugates, and projection. */ /* Argument value of Z. */ #define carg(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, carg, carg) /* Complex conjugate of Z. */ #define conj(Val) __TGMATH_UNARY_IMAG (Val, conj) /* Projection of Z onto the Riemann sphere. */ #define cproj(Val) __TGMATH_UNARY_IMAG (Val, cproj) /* Decomposing complex values. */ /* Imaginary part of Z. */ #define cimag(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, cimag, cimag) /* Real part of Z. */ #define creal(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, creal, creal) #endif /* tgmath.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������thread_db.h�����������������������������������������������������������������������������������������0000644�����������������00000037231�14763166027�0006653 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* thread_db.h -- interface to libthread_db.so library for debugging -lpthread Copyright (C) 1999,2001,2002,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _THREAD_DB_H #define _THREAD_DB_H 1 /* This is the debugger interface for the NPTL library. It is modelled closely after the interface with same names in Solaris with the goal to share the same code in the debugger. */ #include <pthread.h> #include <stdint.h> #include <sys/types.h> #include <sys/procfs.h> /* Error codes of the library. */ typedef enum { TD_OK, /* No error. */ TD_ERR, /* No further specified error. */ TD_NOTHR, /* No matching thread found. */ TD_NOSV, /* No matching synchronization handle found. */ TD_NOLWP, /* No matching light-weighted process found. */ TD_BADPH, /* Invalid process handle. */ TD_BADTH, /* Invalid thread handle. */ TD_BADSH, /* Invalid synchronization handle. */ TD_BADTA, /* Invalid thread agent. */ TD_BADKEY, /* Invalid key. */ TD_NOMSG, /* No event available. */ TD_NOFPREGS, /* No floating-point register content available. */ TD_NOLIBTHREAD, /* Application not linked with thread library. */ TD_NOEVENT, /* Requested event is not supported. */ TD_NOCAPAB, /* Capability not available. */ TD_DBERR, /* Internal debug library error. */ TD_NOAPLIC, /* Operation is not applicable. */ TD_NOTSD, /* No thread-specific data available. */ TD_MALLOC, /* Out of memory. */ TD_PARTIALREG, /* Not entire register set was read or written. */ TD_NOXREGS, /* X register set not available for given thread. */ TD_TLSDEFER, /* Thread has not yet allocated TLS for given module. */ TD_NOTALLOC = TD_TLSDEFER, TD_VERSION, /* Version if libpthread and libthread_db do not match. */ TD_NOTLS /* There is no TLS segment in the given module. */ } td_err_e; /* Possible thread states. TD_THR_ANY_STATE is a pseudo-state used to select threads regardless of state in td_ta_thr_iter(). */ typedef enum { TD_THR_ANY_STATE, TD_THR_UNKNOWN, TD_THR_STOPPED, TD_THR_RUN, TD_THR_ACTIVE, TD_THR_ZOMBIE, TD_THR_SLEEP, TD_THR_STOPPED_ASLEEP } td_thr_state_e; /* Thread type: user or system. TD_THR_ANY_TYPE is a pseudo-type used to select threads regardless of type in td_ta_thr_iter(). */ typedef enum { TD_THR_ANY_TYPE, TD_THR_USER, TD_THR_SYSTEM } td_thr_type_e; /* Types of the debugging library. */ /* Handle for a process. This type is opaque. */ typedef struct td_thragent td_thragent_t; /* The actual thread handle type. This is also opaque. */ typedef struct td_thrhandle { td_thragent_t *th_ta_p; psaddr_t th_unique; } td_thrhandle_t; /* Forward declaration of a type defined by and for the dynamic linker. */ struct link_map; /* Flags for `td_ta_thr_iter'. */ #define TD_THR_ANY_USER_FLAGS 0xffffffff #define TD_THR_LOWEST_PRIORITY -20 #define TD_SIGNO_MASK NULL #define TD_EVENTSIZE 2 #define BT_UISHIFT 5 /* log base 2 of BT_NBIPUI, to extract word index */ #define BT_NBIPUI (1 << BT_UISHIFT) /* n bits per uint */ #define BT_UIMASK (BT_NBIPUI - 1) /* to extract bit index */ /* Bitmask of enabled events. */ typedef struct td_thr_events { uint32_t event_bits[TD_EVENTSIZE]; } td_thr_events_t; /* Event set manipulation macros. */ #define __td_eventmask(n) \ (UINT32_C (1) << (((n) - 1) & BT_UIMASK)) #define __td_eventword(n) \ ((UINT32_C ((n) - 1)) >> BT_UISHIFT) #define td_event_emptyset(setp) \ do { \ int __i; \ for (__i = TD_EVENTSIZE; __i > 0; --__i) \ (setp)->event_bits[__i - 1] = 0; \ } while (0) #define td_event_fillset(setp) \ do { \ int __i; \ for (__i = TD_EVENTSIZE; __i > 0; --__i) \ (setp)->event_bits[__i - 1] = UINT32_C (0xffffffff); \ } while (0) #define td_event_addset(setp, n) \ (((setp)->event_bits[__td_eventword (n)]) |= __td_eventmask (n)) #define td_event_delset(setp, n) \ (((setp)->event_bits[__td_eventword (n)]) &= ~__td_eventmask (n)) #define td_eventismember(setp, n) \ (__td_eventmask (n) & ((setp)->event_bits[__td_eventword (n)])) #if TD_EVENTSIZE == 2 # define td_eventisempty(setp) \ (!((setp)->event_bits[0]) && !((setp)->event_bits[1])) #else # error "td_eventisempty must be changed to match TD_EVENTSIZE" #endif /* Events reportable by the thread implementation. */ typedef enum { TD_ALL_EVENTS, /* Pseudo-event number. */ TD_EVENT_NONE = TD_ALL_EVENTS, /* Depends on context. */ TD_READY, /* Is executable now. */ TD_SLEEP, /* Blocked in a synchronization obj. */ TD_SWITCHTO, /* Now assigned to a process. */ TD_SWITCHFROM, /* Not anymore assigned to a process. */ TD_LOCK_TRY, /* Trying to get an unavailable lock. */ TD_CATCHSIG, /* Signal posted to the thread. */ TD_IDLE, /* Process getting idle. */ TD_CREATE, /* New thread created. */ TD_DEATH, /* Thread terminated. */ TD_PREEMPT, /* Preempted. */ TD_PRI_INHERIT, /* Inherited elevated priority. */ TD_REAP, /* Reaped. */ TD_CONCURRENCY, /* Number of processes changing. */ TD_TIMEOUT, /* Conditional variable wait timed out. */ TD_MIN_EVENT_NUM = TD_READY, TD_MAX_EVENT_NUM = TD_TIMEOUT, TD_EVENTS_ENABLE = 31 /* Event reporting enabled. */ } td_event_e; /* Values representing the different ways events are reported. */ typedef enum { NOTIFY_BPT, /* User must insert breakpoint at u.bptaddr. */ NOTIFY_AUTOBPT, /* Breakpoint at u.bptaddr is automatically inserted. */ NOTIFY_SYSCALL /* System call u.syscallno will be invoked. */ } td_notify_e; /* Description how event type is reported. */ typedef struct td_notify { td_notify_e type; /* Way the event is reported. */ union { psaddr_t bptaddr; /* Address of breakpoint. */ int syscallno; /* Number of system call used. */ } u; } td_notify_t; /* Structure used to report event. */ typedef struct td_event_msg { td_event_e event; /* Event type being reported. */ const td_thrhandle_t *th_p; /* Thread reporting the event. */ union { # if 0 td_synchandle_t *sh; /* Handle of synchronization object. */ #endif uintptr_t data; /* Event specific data. */ } msg; } td_event_msg_t; /* Structure containing event data available in each thread structure. */ typedef struct { td_thr_events_t eventmask; /* Mask of enabled events. */ td_event_e eventnum; /* Number of last event. */ void *eventdata; /* Data associated with event. */ } td_eventbuf_t; /* Gathered statistics about the process. */ typedef struct td_ta_stats { int nthreads; /* Total number of threads in use. */ int r_concurrency; /* Concurrency level requested by user. */ int nrunnable_num; /* Average runnable threads, numerator. */ int nrunnable_den; /* Average runnable threads, denominator. */ int a_concurrency_num; /* Achieved concurrency level, numerator. */ int a_concurrency_den; /* Achieved concurrency level, denominator. */ int nlwps_num; /* Average number of processes in use, numerator. */ int nlwps_den; /* Average number of processes in use, denominator. */ int nidle_num; /* Average number of idling processes, numerator. */ int nidle_den; /* Average number of idling processes, denominator. */ } td_ta_stats_t; /* Since Sun's library is based on Solaris threads we have to define a few types to map them to POSIX threads. */ typedef pthread_t thread_t; typedef pthread_key_t thread_key_t; /* Callback for iteration over threads. */ typedef int td_thr_iter_f (const td_thrhandle_t *, void *); /* Callback for iteration over thread local data. */ typedef int td_key_iter_f (thread_key_t, void (*) (void *), void *); /* Forward declaration. This has to be defined by the user. */ struct ps_prochandle; /* Information about the thread. */ typedef struct td_thrinfo { td_thragent_t *ti_ta_p; /* Process handle. */ unsigned int ti_user_flags; /* Unused. */ thread_t ti_tid; /* Thread ID returned by pthread_create(). */ char *ti_tls; /* Pointer to thread-local data. */ psaddr_t ti_startfunc; /* Start function passed to pthread_create(). */ psaddr_t ti_stkbase; /* Base of thread's stack. */ long int ti_stksize; /* Size of thread's stack. */ psaddr_t ti_ro_area; /* Unused. */ int ti_ro_size; /* Unused. */ td_thr_state_e ti_state; /* Thread state. */ unsigned char ti_db_suspended; /* Nonzero if suspended by debugger. */ td_thr_type_e ti_type; /* Type of the thread (system vs user thread). */ intptr_t ti_pc; /* Unused. */ intptr_t ti_sp; /* Unused. */ short int ti_flags; /* Unused. */ int ti_pri; /* Thread priority. */ lwpid_t ti_lid; /* Kernel PID for this thread. */ sigset_t ti_sigmask; /* Signal mask. */ unsigned char ti_traceme; /* Nonzero if event reporting enabled. */ unsigned char ti_preemptflag; /* Unused. */ unsigned char ti_pirecflag; /* Unused. */ sigset_t ti_pending; /* Set of pending signals. */ td_thr_events_t ti_events; /* Set of enabled events. */ } td_thrinfo_t; /* Prototypes for exported library functions. */ /* Initialize the thread debug support library. */ extern td_err_e td_init (void); /* Historical relict. Should not be used anymore. */ extern td_err_e td_log (void); /* Return list of symbols the library can request. */ extern const char **td_symbol_list (void); /* Generate new thread debug library handle for process PS. */ extern td_err_e td_ta_new (struct ps_prochandle *__ps, td_thragent_t **__ta); /* Free resources allocated for TA. */ extern td_err_e td_ta_delete (td_thragent_t *__ta); /* Get number of currently running threads in process associated with TA. */ extern td_err_e td_ta_get_nthreads (const td_thragent_t *__ta, int *__np); /* Return process handle passed in `td_ta_new' for process associated with TA. */ extern td_err_e td_ta_get_ph (const td_thragent_t *__ta, struct ps_prochandle **__ph); /* Map thread library handle PT to thread debug library handle for process associated with TA and store result in *TH. */ extern td_err_e td_ta_map_id2thr (const td_thragent_t *__ta, pthread_t __pt, td_thrhandle_t *__th); /* Map process ID LWPID to thread debug library handle for process associated with TA and store result in *TH. */ extern td_err_e td_ta_map_lwp2thr (const td_thragent_t *__ta, lwpid_t __lwpid, td_thrhandle_t *__th); /* Call for each thread in a process associated with TA the callback function CALLBACK. */ extern td_err_e td_ta_thr_iter (const td_thragent_t *__ta, td_thr_iter_f *__callback, void *__cbdata_p, td_thr_state_e __state, int __ti_pri, sigset_t *__ti_sigmask_p, unsigned int __ti_user_flags); /* Call for each defined thread local data entry the callback function KI. */ extern td_err_e td_ta_tsd_iter (const td_thragent_t *__ta, td_key_iter_f *__ki, void *__p); /* Get event address for EVENT. */ extern td_err_e td_ta_event_addr (const td_thragent_t *__ta, td_event_e __event, td_notify_t *__ptr); /* Enable EVENT in global mask. */ extern td_err_e td_ta_set_event (const td_thragent_t *__ta, td_thr_events_t *__event); /* Disable EVENT in global mask. */ extern td_err_e td_ta_clear_event (const td_thragent_t *__ta, td_thr_events_t *__event); /* Return information about last event. */ extern td_err_e td_ta_event_getmsg (const td_thragent_t *__ta, td_event_msg_t *__msg); /* Set suggested concurrency level for process associated with TA. */ extern td_err_e td_ta_setconcurrency (const td_thragent_t *__ta, int __level); /* Enable collecting statistics for process associated with TA. */ extern td_err_e td_ta_enable_stats (const td_thragent_t *__ta, int __enable); /* Reset statistics. */ extern td_err_e td_ta_reset_stats (const td_thragent_t *__ta); /* Retrieve statistics from process associated with TA. */ extern td_err_e td_ta_get_stats (const td_thragent_t *__ta, td_ta_stats_t *__statsp); /* Validate that TH is a thread handle. */ extern td_err_e td_thr_validate (const td_thrhandle_t *__th); /* Return information about thread TH. */ extern td_err_e td_thr_get_info (const td_thrhandle_t *__th, td_thrinfo_t *__infop); /* Retrieve floating-point register contents of process running thread TH. */ extern td_err_e td_thr_getfpregs (const td_thrhandle_t *__th, prfpregset_t *__regset); /* Retrieve general register contents of process running thread TH. */ extern td_err_e td_thr_getgregs (const td_thrhandle_t *__th, prgregset_t __gregs); /* Retrieve extended register contents of process running thread TH. */ extern td_err_e td_thr_getxregs (const td_thrhandle_t *__th, void *__xregs); /* Get size of extended register set of process running thread TH. */ extern td_err_e td_thr_getxregsize (const td_thrhandle_t *__th, int *__sizep); /* Set floating-point register contents of process running thread TH. */ extern td_err_e td_thr_setfpregs (const td_thrhandle_t *__th, const prfpregset_t *__fpregs); /* Set general register contents of process running thread TH. */ extern td_err_e td_thr_setgregs (const td_thrhandle_t *__th, prgregset_t __gregs); /* Set extended register contents of process running thread TH. */ extern td_err_e td_thr_setxregs (const td_thrhandle_t *__th, const void *__addr); /* Get address of the given module's TLS storage area for the given thread. */ extern td_err_e td_thr_tlsbase (const td_thrhandle_t *__th, unsigned long int __modid, psaddr_t *__base); /* Get address of thread local variable. */ extern td_err_e td_thr_tls_get_addr (const td_thrhandle_t *__th, psaddr_t __map_address, size_t __offset, psaddr_t *__address); /* Enable reporting for EVENT for thread TH. */ extern td_err_e td_thr_event_enable (const td_thrhandle_t *__th, int __event); /* Enable EVENT for thread TH. */ extern td_err_e td_thr_set_event (const td_thrhandle_t *__th, td_thr_events_t *__event); /* Disable EVENT for thread TH. */ extern td_err_e td_thr_clear_event (const td_thrhandle_t *__th, td_thr_events_t *__event); /* Get event message for thread TH. */ extern td_err_e td_thr_event_getmsg (const td_thrhandle_t *__th, td_event_msg_t *__msg); /* Set priority of thread TH. */ extern td_err_e td_thr_setprio (const td_thrhandle_t *__th, int __prio); /* Set pending signals for thread TH. */ extern td_err_e td_thr_setsigpending (const td_thrhandle_t *__th, unsigned char __n, const sigset_t *__ss); /* Set signal mask for thread TH. */ extern td_err_e td_thr_sigsetmask (const td_thrhandle_t *__th, const sigset_t *__ss); /* Return thread local data associated with key TK in thread TH. */ extern td_err_e td_thr_tsd (const td_thrhandle_t *__th, const thread_key_t __tk, void **__data); /* Suspend execution of thread TH. */ extern td_err_e td_thr_dbsuspend (const td_thrhandle_t *__th); /* Resume execution of thread TH. */ extern td_err_e td_thr_dbresume (const td_thrhandle_t *__th); #endif /* thread_db.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pr29.h����������������������������������������������������������������������������������������������0000644�����������������00000004113�14763166027�0005524 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* pr29.h --- Detect strings which are non-idempotent under NFKC. Copyright (C) 2004-2013 Simon Josefsson This file is part of GNU Libidn. GNU Libidn is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * 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. or both in parallel, as here. GNU Libidn 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 copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PR29_H # define PR29_H # ifndef IDNAPI # if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY # define IDNAPI __attribute__((__visibility__("default"))) # elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC # define IDNAPI __declspec(dllexport) # elif defined _MSC_VER && ! defined LIBIDN_STATIC # define IDNAPI __declspec(dllimport) # else # define IDNAPI # endif # endif # ifdef __cplusplus extern "C" { # endif /* Get size_t. */ # include <stdlib.h> /* Get uint32_t. */ # include <idn-int.h> /* Error codes. */ typedef enum { PR29_SUCCESS = 0, PR29_PROBLEM = 1, /* String is a problem sequence. */ PR29_STRINGPREP_ERROR = 2 /* Charset conversion failed (p29_8*). */ } Pr29_rc; extern IDNAPI const char *pr29_strerror (Pr29_rc rc); extern IDNAPI int pr29_4 (const uint32_t * in, size_t len); extern IDNAPI int pr29_4z (const uint32_t * in); extern IDNAPI int pr29_8z (const char *in); # ifdef __cplusplus } # endif #endif /* PR29_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������stdc-predef.h���������������������������������������������������������������������������������������0000644�����������������00000003135�14763166027�0007133 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _STDC_PREDEF_H #define _STDC_PREDEF_H 1 /* This header is separate from features.h so that the compiler can include it implicitly at the start of every compilation. It must not itself include <features.h> or any other header that includes <features.h> because the implicit include comes before any feature test macros that may be defined in a source file before it first explicitly includes a system header. GCC knows the name of this header in order to preinclude it. */ /* We do support the IEC 559 math functionality, real and complex. */ #define __STDC_IEC_559__ 1 #define __STDC_IEC_559_COMPLEX__ 1 /* wchar_t uses ISO/IEC 10646 (2nd ed., published 2011-03-15) / Unicode 6.0. */ #define __STDC_ISO_10646__ 201103L /* We do not support C11 <threads.h>. */ #define __STDC_NO_THREADS__ 1 #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������idn-free.h������������������������������������������������������������������������������������������0000644�����������������00000004650�14763166027�0006427 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* idn-free.h --- Invoke the free function to release memory Copyright (C) 2004-2013 Simon Josefsson This file is part of GNU Libidn. GNU Libidn is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * 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. or both in parallel, as here. GNU Libidn 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 copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef IDN_FREE_H # define IDN_FREE_H # ifndef IDNAPI # if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY # define IDNAPI __attribute__((__visibility__("default"))) # elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC # define IDNAPI __declspec(dllexport) # elif defined _MSC_VER && ! defined LIBIDN_STATIC # define IDNAPI __declspec(dllimport) # else # define IDNAPI # endif # endif # ifdef __cplusplus extern "C" { # endif /* I don't recommend using this interface in general. Use `free'. * * I'm told Microsoft Windows may use one set of `malloc' and `free' * in a library, and another incompatible set in a statically compiled * application that link to the library, thus creating problems if the * application would invoke `free' on a pointer pointing to memory * allocated by the library. This motivated adding this function. * * The theory of isolating all memory allocations and de-allocations * within a code package (library) sounds good, to simplify hunting * down memory allocation related problems, but I'm not sure if it is * worth enough to motivate recommending this interface over calling * `free' directly, though. * * See the manual section 'Memory handling under Windows' for more * information. */ extern void IDNAPI idn_free (void *ptr); # ifdef __cplusplus } # endif #endif /* IDN_FREE_H */ ����������������������������������������������������������������������������������������autosprintf.h���������������������������������������������������������������������������������������0000644�����������������00000004517�14763166027�0007316 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Class autosprintf - formatted output to an ostream. Copyright (C) 2002, 2012-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _AUTOSPRINTF_H #define _AUTOSPRINTF_H /* This feature is available in gcc versions 2.5 and later. */ #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ # define _AUTOSPRINTF_ATTRIBUTE_FORMAT() /* empty */ #else /* The __-protected variants of 'format' and 'printf' attributes are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) # define _AUTOSPRINTF_ATTRIBUTE_FORMAT() \ __attribute__ ((__format__ (__printf__, 2, 3))) # else # define _AUTOSPRINTF_ATTRIBUTE_FORMAT() \ __attribute__ ((format (printf, 2, 3))) # endif #endif #include <string> #include <iostream> namespace gnu { /* A temporary object, usually allocated on the stack, representing the result of an asprintf() call. */ class autosprintf { public: /* Constructor: takes a format string and the printf arguments. */ autosprintf (const char *format, ...) _AUTOSPRINTF_ATTRIBUTE_FORMAT(); /* Copy constructor. */ autosprintf (const autosprintf& src); autosprintf& operator = (autosprintf copy); /* Destructor: frees the temporarily allocated string. */ ~autosprintf (); /* Conversion to string. */ operator char * () const; operator std::string () const; /* Output to an ostream. */ friend inline std::ostream& operator<< (std::ostream& stream, const autosprintf& tmp) { stream << (tmp.str ? tmp.str : "(error in autosprintf)"); return stream; } private: char *str; }; } #endif /* _AUTOSPRINTF_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������aliases.h�������������������������������������������������������������������������������������������0000644�����������������00000004002�14763166027�0006346 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996, 1997, 1998, 1999, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ALIASES_H #define _ALIASES_H 1 #include <features.h> #include <sys/types.h> __BEGIN_DECLS /* Structure to represent one entry of the alias data base. */ struct aliasent { char *alias_name; size_t alias_members_len; char **alias_members; int alias_local; }; /* Open alias data base files. */ extern void setaliasent (void) __THROW; /* Close alias data base files. */ extern void endaliasent (void) __THROW; /* Get the next entry from the alias data base. */ extern struct aliasent *getaliasent (void) __THROW; /* Get the next entry from the alias data base and put it in RESULT_BUF. */ extern int getaliasent_r (struct aliasent *__restrict __result_buf, char *__restrict __buffer, size_t __buflen, struct aliasent **__restrict __result) __THROW; /* Get alias entry corresponding to NAME. */ extern struct aliasent *getaliasbyname (const char *__name) __THROW; /* Get alias entry corresponding to NAME and put it in RESULT_BUF. */ extern int getaliasbyname_r (const char *__restrict __name, struct aliasent *__restrict __result_buf, char *__restrict __buffer, size_t __buflen, struct aliasent **__restrict __result) __THROW; __END_DECLS #endif /* aliases.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cpuidle.h�������������������������������������������������������������������������������������������0000644�����������������00000001514�14763166027�0006357 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __CPUPOWER_CPUIDLE_H__ #define __CPUPOWER_CPUIDLE_H__ int cpuidle_is_state_disabled(unsigned int cpu, unsigned int idlestate); int cpuidle_state_disable(unsigned int cpu, unsigned int idlestate, unsigned int disable); unsigned long cpuidle_state_latency(unsigned int cpu, unsigned int idlestate); unsigned long cpuidle_state_usage(unsigned int cpu, unsigned int idlestate); unsigned long long cpuidle_state_time(unsigned int cpu, unsigned int idlestate); char *cpuidle_state_name(unsigned int cpu, unsigned int idlestate); char *cpuidle_state_desc(unsigned int cpu, unsigned int idlestate); unsigned int cpuidle_state_count(unsigned int cpu); char *cpuidle_get_governor(void); char *cpuidle_get_driver(void); #endif /* __CPUPOWER_HELPERS_SYSFS_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������paths.h���������������������������������������������������������������������������������������������0000644�����������������00000005641�14763166027�0006056 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)paths.h 8.1 (Berkeley) 6/2/93 */ #ifndef _PATHS_H_ #define _PATHS_H_ /* Default search path. */ #define _PATH_DEFPATH "/usr/bin:/bin" /* All standard utilities path. */ #define _PATH_STDPATH \ "/usr/bin:/bin:/usr/sbin:/sbin" #define _PATH_BSHELL "/bin/sh" #define _PATH_CONSOLE "/dev/console" #define _PATH_CSHELL "/bin/csh" #define _PATH_DEVDB "/var/run/dev.db" #define _PATH_DEVNULL "/dev/null" #define _PATH_DRUM "/dev/drum" #define _PATH_GSHADOW "/etc/gshadow" #define _PATH_KLOG "/proc/kmsg" #define _PATH_KMEM "/dev/kmem" #define _PATH_LASTLOG "/var/log/lastlog" #define _PATH_MAILDIR "/var/mail" #define _PATH_MAN "/usr/share/man" #define _PATH_MEM "/dev/mem" #define _PATH_MNTTAB "/etc/fstab" #define _PATH_MOUNTED "/etc/mtab" #define _PATH_NOLOGIN "/etc/nologin" #define _PATH_PRESERVE "/var/lib" #define _PATH_RWHODIR "/var/spool/rwho" #define _PATH_SENDMAIL "/usr/sbin/sendmail" #define _PATH_SHADOW "/etc/shadow" #define _PATH_SHELLS "/etc/shells" #define _PATH_TTY "/dev/tty" #define _PATH_UNIX "/boot/vmlinux" #define _PATH_UTMP "/var/run/utmp" #define _PATH_VI "/usr/bin/vi" #define _PATH_WTMP "/var/log/wtmp" /* Provide trailing slash, since mostly used for building pathnames. */ #define _PATH_DEV "/dev/" #define _PATH_TMP "/tmp/" #define _PATH_VARDB "/var/db/" #define _PATH_VARRUN "/var/run/" #define _PATH_VARTMP "/var/tmp/" #endif /* !_PATHS_H_ */ �����������������������������������������������������������������������������������������������tiffconf.h������������������������������������������������������������������������������������������0000644�����������������00000000372�14763166027�0006531 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef TIFFCONF_H_MULTILIB #define TIFFCONF_H_MULTILIB #include <bits/wordsize.h> #if __WORDSIZE == 32 # include "tiffconf-32.h" #elif __WORDSIZE == 64 # include "tiffconf-64.h" #else # error "unexpected value for __WORDSIZE macro" #endif #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxslt/variables.h���������������������������������������������������������������������������������0000644�����������������00000005041�14763166027�0010362 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: interface for the variable matching and lookup. * Description: interface for the variable matching and lookup. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XSLT_VARIABLES_H__ #define __XML_XSLT_VARIABLES_H__ #include <libxml/xpath.h> #include <libxml/xpathInternals.h> #include "xsltexports.h" #include "xsltInternals.h" #include "functions.h" #ifdef __cplusplus extern "C" { #endif /** * XSLT_REGISTER_VARIABLE_LOOKUP: * * Registering macro, not general purpose at all but used in different modules. */ #define XSLT_REGISTER_VARIABLE_LOOKUP(ctxt) \ xmlXPathRegisterVariableLookup((ctxt)->xpathCtxt, \ xsltXPathVariableLookup, (void *)(ctxt)); \ xsltRegisterAllFunctions((ctxt)->xpathCtxt); \ xsltRegisterAllElement(ctxt); \ (ctxt)->xpathCtxt->extra = ctxt /* * Interfaces for the variable module. */ XSLTPUBFUN int XSLTCALL xsltEvalGlobalVariables (xsltTransformContextPtr ctxt); XSLTPUBFUN int XSLTCALL xsltEvalUserParams (xsltTransformContextPtr ctxt, const char **params); XSLTPUBFUN int XSLTCALL xsltQuoteUserParams (xsltTransformContextPtr ctxt, const char **params); XSLTPUBFUN int XSLTCALL xsltEvalOneUserParam (xsltTransformContextPtr ctxt, const xmlChar * name, const xmlChar * value); XSLTPUBFUN int XSLTCALL xsltQuoteOneUserParam (xsltTransformContextPtr ctxt, const xmlChar * name, const xmlChar * value); XSLTPUBFUN void XSLTCALL xsltParseGlobalVariable (xsltStylesheetPtr style, xmlNodePtr cur); XSLTPUBFUN void XSLTCALL xsltParseGlobalParam (xsltStylesheetPtr style, xmlNodePtr cur); XSLTPUBFUN void XSLTCALL xsltParseStylesheetVariable (xsltTransformContextPtr ctxt, xmlNodePtr cur); XSLTPUBFUN void XSLTCALL xsltParseStylesheetParam (xsltTransformContextPtr ctxt, xmlNodePtr cur); XSLTPUBFUN xsltStackElemPtr XSLTCALL xsltParseStylesheetCallerParam (xsltTransformContextPtr ctxt, xmlNodePtr cur); XSLTPUBFUN int XSLTCALL xsltAddStackElemList (xsltTransformContextPtr ctxt, xsltStackElemPtr elems); XSLTPUBFUN void XSLTCALL xsltFreeGlobalVariables (xsltTransformContextPtr ctxt); XSLTPUBFUN xmlXPathObjectPtr XSLTCALL xsltVariableLookup (xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *ns_uri); XSLTPUBFUN xmlXPathObjectPtr XSLTCALL xsltXPathVariableLookup (void *ctxt, const xmlChar *name, const xmlChar *ns_uri); #ifdef __cplusplus } #endif #endif /* __XML_XSLT_VARIABLES_H__ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxslt/imports.h�����������������������������������������������������������������������������������0000644�����������������00000003460�14763166027�0010112 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: interface for the XSLT import support * Description: macros and fuctions needed to implement and * access the import tree * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XSLT_IMPORTS_H__ #define __XML_XSLT_IMPORTS_H__ #include <libxml/tree.h> #include "xsltexports.h" #include "xsltInternals.h" #ifdef __cplusplus extern "C" { #endif /** * XSLT_GET_IMPORT_PTR: * * A macro to import pointers from the stylesheet cascading order. */ #define XSLT_GET_IMPORT_PTR(res, style, name) { \ xsltStylesheetPtr st = style; \ res = NULL; \ while (st != NULL) { \ if (st->name != NULL) { res = st->name; break; } \ st = xsltNextImport(st); \ }} /** * XSLT_GET_IMPORT_INT: * * A macro to import intergers from the stylesheet cascading order. */ #define XSLT_GET_IMPORT_INT(res, style, name) { \ xsltStylesheetPtr st = style; \ res = -1; \ while (st != NULL) { \ if (st->name != -1) { res = st->name; break; } \ st = xsltNextImport(st); \ }} /* * Module interfaces */ XSLTPUBFUN int XSLTCALL xsltParseStylesheetImport(xsltStylesheetPtr style, xmlNodePtr cur); XSLTPUBFUN int XSLTCALL xsltParseStylesheetInclude (xsltStylesheetPtr style, xmlNodePtr cur); XSLTPUBFUN xsltStylesheetPtr XSLTCALL xsltNextImport (xsltStylesheetPtr style); XSLTPUBFUN int XSLTCALL xsltNeedElemSpaceHandling(xsltTransformContextPtr ctxt); XSLTPUBFUN int XSLTCALL xsltFindElemSpaceHandling(xsltTransformContextPtr ctxt, xmlNodePtr node); XSLTPUBFUN xsltTemplatePtr XSLTCALL xsltFindTemplate (xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *nameURI); #ifdef __cplusplus } #endif #endif /* __XML_XSLT_IMPORTS_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxslt/numbersInternals.h��������������������������������������������������������������������������0000644�����������������00000003743�14763166027�0011754 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: Implementation of the XSLT number functions * Description: Implementation of the XSLT number functions * * Copy: See Copyright for the status of this software. * * Author: Bjorn Reese <breese@users.sourceforge.net> and Daniel Veillard */ #ifndef __XML_XSLT_NUMBERSINTERNALS_H__ #define __XML_XSLT_NUMBERSINTERNALS_H__ #include <libxml/tree.h> #include "xsltexports.h" #ifdef __cplusplus extern "C" { #endif struct _xsltCompMatch; /** * xsltNumberData: * * This data structure is just a wrapper to pass xsl:number data in. */ typedef struct _xsltNumberData xsltNumberData; typedef xsltNumberData *xsltNumberDataPtr; struct _xsltNumberData { const xmlChar *level; const xmlChar *count; const xmlChar *from; const xmlChar *value; const xmlChar *format; int has_format; int digitsPerGroup; int groupingCharacter; int groupingCharacterLen; xmlDocPtr doc; xmlNodePtr node; struct _xsltCompMatch *countPat; struct _xsltCompMatch *fromPat; /* * accelerators */ }; /** * xsltFormatNumberInfo,: * * This data structure lists the various parameters needed to format numbers. */ typedef struct _xsltFormatNumberInfo xsltFormatNumberInfo; typedef xsltFormatNumberInfo *xsltFormatNumberInfoPtr; struct _xsltFormatNumberInfo { int integer_hash; /* Number of '#' in integer part */ int integer_digits; /* Number of '0' in integer part */ int frac_digits; /* Number of '0' in fractional part */ int frac_hash; /* Number of '#' in fractional part */ int group; /* Number of chars per display 'group' */ int multiplier; /* Scaling for percent or permille */ char add_decimal; /* Flag for whether decimal point appears in pattern */ char is_multiplier_set; /* Flag to catch multiple occurences of percent/permille */ char is_negative_pattern;/* Flag for processing -ve prefix/suffix */ }; #ifdef __cplusplus } #endif #endif /* __XML_XSLT_NUMBERSINTERNALS_H__ */ �����������������������������libxslt/extra.h�������������������������������������������������������������������������������������0000644�����������������00000003452�14763166027�0007541 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: interface for the non-standard features * Description: implement some extension outside the XSLT namespace * but not EXSLT with is in a different library. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XSLT_EXTRA_H__ #define __XML_XSLT_EXTRA_H__ #include <libxml/xpath.h> #include "xsltexports.h" #include "xsltInternals.h" #ifdef __cplusplus extern "C" { #endif /** * XSLT_LIBXSLT_NAMESPACE: * * This is the libxslt namespace for specific extensions. */ #define XSLT_LIBXSLT_NAMESPACE ((xmlChar *) "http://xmlsoft.org/XSLT/namespace") /** * XSLT_SAXON_NAMESPACE: * * This is Michael Kay's Saxon processor namespace for extensions. */ #define XSLT_SAXON_NAMESPACE ((xmlChar *) "http://icl.com/saxon") /** * XSLT_XT_NAMESPACE: * * This is James Clark's XT processor namespace for extensions. */ #define XSLT_XT_NAMESPACE ((xmlChar *) "http://www.jclark.com/xt") /** * XSLT_XALAN_NAMESPACE: * * This is the Apache project XALAN processor namespace for extensions. */ #define XSLT_XALAN_NAMESPACE ((xmlChar *) \ "org.apache.xalan.xslt.extensions.Redirect") /** * XSLT_NORM_SAXON_NAMESPACE: * * This is Norm's namespace for SAXON extensions. */ #define XSLT_NORM_SAXON_NAMESPACE ((xmlChar *) \ "http://nwalsh.com/xslt/ext/com.nwalsh.saxon.CVS") XSLTPUBFUN void XSLTCALL xsltFunctionNodeSet (xmlXPathParserContextPtr ctxt, int nargs); XSLTPUBFUN void XSLTCALL xsltDebug (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); XSLTPUBFUN void XSLTCALL xsltRegisterExtras (xsltTransformContextPtr ctxt); XSLTPUBFUN void XSLTCALL xsltRegisterAllExtras (void); #ifdef __cplusplus } #endif #endif /* __XML_XSLT_EXTRA_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxslt/extensions.h��������������������������������������������������������������������������������0000644�����������������00000015367�14763166027�0010625 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: interface for the extension support * Description: This provide the API needed for simple and module * extension support. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XSLT_EXTENSION_H__ #define __XML_XSLT_EXTENSION_H__ #include <libxml/xpath.h> #include "xsltexports.h" #include "xsltInternals.h" #ifdef __cplusplus extern "C" { #endif /** * Extension Modules API. */ /** * xsltInitGlobals: * * Initialize the global variables for extensions * */ XSLTPUBFUN void XSLTCALL xsltInitGlobals (void); /** * xsltStyleExtInitFunction: * @ctxt: an XSLT stylesheet * @URI: the namespace URI for the extension * * A function called at initialization time of an XSLT extension module. * * Returns a pointer to the module specific data for this transformation. */ typedef void * (*xsltStyleExtInitFunction) (xsltStylesheetPtr style, const xmlChar *URI); /** * xsltStyleExtShutdownFunction: * @ctxt: an XSLT stylesheet * @URI: the namespace URI for the extension * @data: the data associated to this module * * A function called at shutdown time of an XSLT extension module. */ typedef void (*xsltStyleExtShutdownFunction) (xsltStylesheetPtr style, const xmlChar *URI, void *data); /** * xsltExtInitFunction: * @ctxt: an XSLT transformation context * @URI: the namespace URI for the extension * * A function called at initialization time of an XSLT extension module. * * Returns a pointer to the module specific data for this transformation. */ typedef void * (*xsltExtInitFunction) (xsltTransformContextPtr ctxt, const xmlChar *URI); /** * xsltExtShutdownFunction: * @ctxt: an XSLT transformation context * @URI: the namespace URI for the extension * @data: the data associated to this module * * A function called at shutdown time of an XSLT extension module. */ typedef void (*xsltExtShutdownFunction) (xsltTransformContextPtr ctxt, const xmlChar *URI, void *data); XSLTPUBFUN int XSLTCALL xsltRegisterExtModule (const xmlChar *URI, xsltExtInitFunction initFunc, xsltExtShutdownFunction shutdownFunc); XSLTPUBFUN int XSLTCALL xsltRegisterExtModuleFull (const xmlChar * URI, xsltExtInitFunction initFunc, xsltExtShutdownFunction shutdownFunc, xsltStyleExtInitFunction styleInitFunc, xsltStyleExtShutdownFunction styleShutdownFunc); XSLTPUBFUN int XSLTCALL xsltUnregisterExtModule (const xmlChar * URI); XSLTPUBFUN void * XSLTCALL xsltGetExtData (xsltTransformContextPtr ctxt, const xmlChar *URI); XSLTPUBFUN void * XSLTCALL xsltStyleGetExtData (xsltStylesheetPtr style, const xmlChar *URI); #ifdef XSLT_REFACTORED XSLTPUBFUN void * XSLTCALL xsltStyleStylesheetLevelGetExtData( xsltStylesheetPtr style, const xmlChar * URI); #endif XSLTPUBFUN void XSLTCALL xsltShutdownCtxtExts (xsltTransformContextPtr ctxt); XSLTPUBFUN void XSLTCALL xsltShutdownExts (xsltStylesheetPtr style); XSLTPUBFUN xsltTransformContextPtr XSLTCALL xsltXPathGetTransformContext (xmlXPathParserContextPtr ctxt); /* * extension functions */ XSLTPUBFUN int XSLTCALL xsltRegisterExtModuleFunction (const xmlChar *name, const xmlChar *URI, xmlXPathFunction function); XSLTPUBFUN xmlXPathFunction XSLTCALL xsltExtModuleFunctionLookup (const xmlChar *name, const xmlChar *URI); XSLTPUBFUN int XSLTCALL xsltUnregisterExtModuleFunction (const xmlChar *name, const xmlChar *URI); /* * extension elements */ typedef xsltElemPreCompPtr (*xsltPreComputeFunction) (xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function); XSLTPUBFUN xsltElemPreCompPtr XSLTCALL xsltNewElemPreComp (xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function); XSLTPUBFUN void XSLTCALL xsltInitElemPreComp (xsltElemPreCompPtr comp, xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function, xsltElemPreCompDeallocator freeFunc); XSLTPUBFUN int XSLTCALL xsltRegisterExtModuleElement (const xmlChar *name, const xmlChar *URI, xsltPreComputeFunction precomp, xsltTransformFunction transform); XSLTPUBFUN xsltTransformFunction XSLTCALL xsltExtElementLookup (xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *URI); XSLTPUBFUN xsltTransformFunction XSLTCALL xsltExtModuleElementLookup (const xmlChar *name, const xmlChar *URI); XSLTPUBFUN xsltPreComputeFunction XSLTCALL xsltExtModuleElementPreComputeLookup (const xmlChar *name, const xmlChar *URI); XSLTPUBFUN int XSLTCALL xsltUnregisterExtModuleElement (const xmlChar *name, const xmlChar *URI); /* * top-level elements */ typedef void (*xsltTopLevelFunction) (xsltStylesheetPtr style, xmlNodePtr inst); XSLTPUBFUN int XSLTCALL xsltRegisterExtModuleTopLevel (const xmlChar *name, const xmlChar *URI, xsltTopLevelFunction function); XSLTPUBFUN xsltTopLevelFunction XSLTCALL xsltExtModuleTopLevelLookup (const xmlChar *name, const xmlChar *URI); XSLTPUBFUN int XSLTCALL xsltUnregisterExtModuleTopLevel (const xmlChar *name, const xmlChar *URI); /* These 2 functions are deprecated for use within modules. */ XSLTPUBFUN int XSLTCALL xsltRegisterExtFunction (xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *URI, xmlXPathFunction function); XSLTPUBFUN int XSLTCALL xsltRegisterExtElement (xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *URI, xsltTransformFunction function); /* * Extension Prefix handling API. * Those are used by the XSLT (pre)processor. */ XSLTPUBFUN int XSLTCALL xsltRegisterExtPrefix (xsltStylesheetPtr style, const xmlChar *prefix, const xmlChar *URI); XSLTPUBFUN int XSLTCALL xsltCheckExtPrefix (xsltStylesheetPtr style, const xmlChar *URI); XSLTPUBFUN int XSLTCALL xsltCheckExtURI (xsltStylesheetPtr style, const xmlChar *URI); XSLTPUBFUN int XSLTCALL xsltInitCtxtExts (xsltTransformContextPtr ctxt); XSLTPUBFUN void XSLTCALL xsltFreeCtxtExts (xsltTransformContextPtr ctxt); XSLTPUBFUN void XSLTCALL xsltFreeExts (xsltStylesheetPtr style); XSLTPUBFUN xsltElemPreCompPtr XSLTCALL xsltPreComputeExtModuleElement (xsltStylesheetPtr style, xmlNodePtr inst); /* * Extension Infos access. * Used by exslt initialisation */ XSLTPUBFUN xmlHashTablePtr XSLTCALL xsltGetExtInfo (xsltStylesheetPtr style, const xmlChar *URI); /** * Test module http://xmlsoft.org/XSLT/ */ XSLTPUBFUN void XSLTCALL xsltRegisterTestModule (void); XSLTPUBFUN void XSLTCALL xsltDebugDumpExtensions (FILE * output); #ifdef __cplusplus } #endif #endif /* __XML_XSLT_EXTENSION_H__ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxslt/transform.h���������������������������������������������������������������������������������0000644�����������������00000014270�14763166027�0010431 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: the XSLT engine transformation part. * Description: This module implements the bulk of the actual * transformation processing. Most of the xsl: element * constructs are implemented in this module. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XSLT_TRANSFORM_H__ #define __XML_XSLT_TRANSFORM_H__ #include <libxml/parser.h> #include <libxml/xmlIO.h> #include "xsltexports.h" #include <libxslt/xsltInternals.h> #ifdef __cplusplus extern "C" { #endif /** * XInclude default processing. */ XSLTPUBFUN void XSLTCALL xsltSetXIncludeDefault (int xinclude); XSLTPUBFUN int XSLTCALL xsltGetXIncludeDefault (void); /** * Export context to users. */ XSLTPUBFUN xsltTransformContextPtr XSLTCALL xsltNewTransformContext (xsltStylesheetPtr style, xmlDocPtr doc); XSLTPUBFUN void XSLTCALL xsltFreeTransformContext(xsltTransformContextPtr ctxt); XSLTPUBFUN xmlDocPtr XSLTCALL xsltApplyStylesheetUser (xsltStylesheetPtr style, xmlDocPtr doc, const char **params, const char *output, FILE * profile, xsltTransformContextPtr userCtxt); XSLTPUBFUN void XSLTCALL xsltProcessOneNode (xsltTransformContextPtr ctxt, xmlNodePtr node, xsltStackElemPtr params); /** * Private Interfaces. */ XSLTPUBFUN void XSLTCALL xsltApplyStripSpaces (xsltTransformContextPtr ctxt, xmlNodePtr node); XSLTPUBFUN xmlDocPtr XSLTCALL xsltApplyStylesheet (xsltStylesheetPtr style, xmlDocPtr doc, const char **params); XSLTPUBFUN xmlDocPtr XSLTCALL xsltProfileStylesheet (xsltStylesheetPtr style, xmlDocPtr doc, const char **params, FILE * output); XSLTPUBFUN int XSLTCALL xsltRunStylesheet (xsltStylesheetPtr style, xmlDocPtr doc, const char **params, const char *output, xmlSAXHandlerPtr SAX, xmlOutputBufferPtr IObuf); XSLTPUBFUN int XSLTCALL xsltRunStylesheetUser (xsltStylesheetPtr style, xmlDocPtr doc, const char **params, const char *output, xmlSAXHandlerPtr SAX, xmlOutputBufferPtr IObuf, FILE * profile, xsltTransformContextPtr userCtxt); XSLTPUBFUN void XSLTCALL xsltApplyOneTemplate (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr list, xsltTemplatePtr templ, xsltStackElemPtr params); XSLTPUBFUN void XSLTCALL xsltDocumentElem (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); XSLTPUBFUN void XSLTCALL xsltSort (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); XSLTPUBFUN void XSLTCALL xsltCopy (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); XSLTPUBFUN void XSLTCALL xsltText (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); XSLTPUBFUN void XSLTCALL xsltElement (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); XSLTPUBFUN void XSLTCALL xsltComment (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); XSLTPUBFUN void XSLTCALL xsltAttribute (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); XSLTPUBFUN void XSLTCALL xsltProcessingInstruction(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); XSLTPUBFUN void XSLTCALL xsltCopyOf (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); XSLTPUBFUN void XSLTCALL xsltValueOf (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); XSLTPUBFUN void XSLTCALL xsltNumber (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); XSLTPUBFUN void XSLTCALL xsltApplyImports (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); XSLTPUBFUN void XSLTCALL xsltCallTemplate (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); XSLTPUBFUN void XSLTCALL xsltApplyTemplates (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); XSLTPUBFUN void XSLTCALL xsltChoose (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); XSLTPUBFUN void XSLTCALL xsltIf (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); XSLTPUBFUN void XSLTCALL xsltForEach (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); XSLTPUBFUN void XSLTCALL xsltRegisterAllElement (xsltTransformContextPtr ctxt); XSLTPUBFUN xmlNodePtr XSLTCALL xsltCopyTextString (xsltTransformContextPtr ctxt, xmlNodePtr target, const xmlChar *string, int noescape); /* Following 2 functions needed for libexslt/functions.c */ XSLTPUBFUN void XSLTCALL xsltLocalVariablePop (xsltTransformContextPtr ctxt, int limitNr, int level); XSLTPUBFUN int XSLTCALL xsltLocalVariablePush (xsltTransformContextPtr ctxt, xsltStackElemPtr variable, int level); /* * Hook for the debugger if activated. */ XSLTPUBFUN void XSLTCALL xslHandleDebugger (xmlNodePtr cur, xmlNodePtr node, xsltTemplatePtr templ, xsltTransformContextPtr ctxt); #ifdef __cplusplus } #endif #endif /* __XML_XSLT_TRANSFORM_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxslt/documents.h���������������������������������������������������������������������������������0000644�����������������00000005220�14763166027�0010412 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: interface for the document handling * Description: implements document loading and cache (multiple * document() reference for the same resources must * be equal. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XSLT_DOCUMENTS_H__ #define __XML_XSLT_DOCUMENTS_H__ #include <libxml/tree.h> #include "xsltexports.h" #include "xsltInternals.h" #ifdef __cplusplus extern "C" { #endif XSLTPUBFUN xsltDocumentPtr XSLTCALL xsltNewDocument (xsltTransformContextPtr ctxt, xmlDocPtr doc); XSLTPUBFUN xsltDocumentPtr XSLTCALL xsltLoadDocument (xsltTransformContextPtr ctxt, const xmlChar *URI); XSLTPUBFUN xsltDocumentPtr XSLTCALL xsltFindDocument (xsltTransformContextPtr ctxt, xmlDocPtr doc); XSLTPUBFUN void XSLTCALL xsltFreeDocuments (xsltTransformContextPtr ctxt); XSLTPUBFUN xsltDocumentPtr XSLTCALL xsltLoadStyleDocument (xsltStylesheetPtr style, const xmlChar *URI); XSLTPUBFUN xsltDocumentPtr XSLTCALL xsltNewStyleDocument (xsltStylesheetPtr style, xmlDocPtr doc); XSLTPUBFUN void XSLTCALL xsltFreeStyleDocuments (xsltStylesheetPtr style); /* * Hooks for document loading */ /** * xsltLoadType: * * Enum defining the kind of loader requirement. */ typedef enum { XSLT_LOAD_START = 0, /* loading for a top stylesheet */ XSLT_LOAD_STYLESHEET = 1, /* loading for a stylesheet include/import */ XSLT_LOAD_DOCUMENT = 2 /* loading document at transformation time */ } xsltLoadType; /** * xsltDocLoaderFunc: * @URI: the URI of the document to load * @dict: the dictionary to use when parsing that document * @options: parsing options, a set of xmlParserOption * @ctxt: the context, either a stylesheet or a transformation context * @type: the xsltLoadType indicating the kind of loading required * * An xsltDocLoaderFunc is a signature for a function which can be * registered to load document not provided by the compilation or * transformation API themselve, for example when an xsl:import, * xsl:include is found at compilation time or when a document() * call is made at runtime. * * Returns the pointer to the document (which will be modified and * freed by the engine later), or NULL in case of error. */ typedef xmlDocPtr (*xsltDocLoaderFunc) (const xmlChar *URI, xmlDictPtr dict, int options, void *ctxt, xsltLoadType type); XSLTPUBFUN void XSLTCALL xsltSetLoaderFunc (xsltDocLoaderFunc f); /* the loader may be needed by extension libraries so it is exported */ XSLTPUBVAR xsltDocLoaderFunc xsltDocDefaultLoader; #ifdef __cplusplus } #endif #endif /* __XML_XSLT_DOCUMENTS_H__ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxslt/xsltexports.h�������������������������������������������������������������������������������0000644�����������������00000006542�14763166027�0011040 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: macros for marking symbols as exportable/importable. * Description: macros for marking symbols as exportable/importable. * * Copy: See Copyright for the status of this software. * * Author: Igor Zlatkovic <igor@zlatkovic.com> */ #ifndef __XSLT_EXPORTS_H__ #define __XSLT_EXPORTS_H__ /** * XSLTPUBFUN: * XSLTPUBFUN, XSLTPUBVAR, XSLTCALL * * Macros which declare an exportable function, an exportable variable and * the calling convention used for functions. * * Please use an extra block for every platform/compiler combination when * modifying this, rather than overlong #ifdef lines. This helps * readability as well as the fact that different compilers on the same * platform might need different definitions. */ /** * XSLTPUBFUN: * * Macros which declare an exportable function */ #define XSLTPUBFUN /** * XSLTPUBVAR: * * Macros which declare an exportable variable */ #define XSLTPUBVAR extern /** * XSLTCALL: * * Macros which declare the called convention for exported functions */ #define XSLTCALL /** DOC_DISABLE */ /* Windows platform with MS compiler */ #if defined(_WIN32) && defined(_MSC_VER) #undef XSLTPUBFUN #undef XSLTPUBVAR #undef XSLTCALL #if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC) #define XSLTPUBFUN __declspec(dllexport) #define XSLTPUBVAR __declspec(dllexport) #else #define XSLTPUBFUN #if !defined(LIBXSLT_STATIC) #define XSLTPUBVAR __declspec(dllimport) extern #else #define XSLTPUBVAR extern #endif #endif #define XSLTCALL __cdecl #if !defined _REENTRANT #define _REENTRANT #endif #endif /* Windows platform with Borland compiler */ #if defined(_WIN32) && defined(__BORLANDC__) #undef XSLTPUBFUN #undef XSLTPUBVAR #undef XSLTCALL #if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC) #define XSLTPUBFUN __declspec(dllexport) #define XSLTPUBVAR __declspec(dllexport) extern #else #define XSLTPUBFUN #if !defined(LIBXSLT_STATIC) #define XSLTPUBVAR __declspec(dllimport) extern #else #define XSLTPUBVAR extern #endif #endif #define XSLTCALL __cdecl #if !defined _REENTRANT #define _REENTRANT #endif #endif /* Windows platform with GNU compiler (Mingw) */ #if defined(_WIN32) && defined(__MINGW32__) #undef XSLTPUBFUN #undef XSLTPUBVAR #undef XSLTCALL /* #if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC) */ #if !defined(LIBXSLT_STATIC) #define XSLTPUBFUN __declspec(dllexport) #define XSLTPUBVAR __declspec(dllexport) extern #else #define XSLTPUBFUN #if !defined(LIBXSLT_STATIC) #define XSLTPUBVAR __declspec(dllimport) extern #else #define XSLTPUBVAR extern #endif #endif #define XSLTCALL __cdecl #if !defined _REENTRANT #define _REENTRANT #endif #endif /* Cygwin platform, GNU compiler */ #if defined(_WIN32) && defined(__CYGWIN__) #undef XSLTPUBFUN #undef XSLTPUBVAR #undef XSLTCALL #if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC) #define XSLTPUBFUN __declspec(dllexport) #define XSLTPUBVAR __declspec(dllexport) #else #define XSLTPUBFUN #if !defined(LIBXSLT_STATIC) #define XSLTPUBVAR __declspec(dllimport) extern #else #define XSLTPUBVAR #endif #endif #define XSLTCALL __cdecl #endif /* Compatibility */ #if !defined(LIBXSLT_PUBLIC) #define LIBXSLT_PUBLIC XSLTPUBVAR #endif #endif /* __XSLT_EXPORTS_H__ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������libxslt/pattern.h�����������������������������������������������������������������������������������0000644�����������������00000003716�14763166027�0010076 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: interface for the pattern matching used in template matches. * Description: the implementation of the lookup of the right template * for a given node must be really fast in order to keep * decent performances. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XSLT_PATTERN_H__ #define __XML_XSLT_PATTERN_H__ #include "xsltInternals.h" #include "xsltexports.h" #ifdef __cplusplus extern "C" { #endif /** * xsltCompMatch: * * Data structure used for the implementation of patterns. * It is kept private (in pattern.c). */ typedef struct _xsltCompMatch xsltCompMatch; typedef xsltCompMatch *xsltCompMatchPtr; /* * Pattern related interfaces. */ XSLTPUBFUN xsltCompMatchPtr XSLTCALL xsltCompilePattern (const xmlChar *pattern, xmlDocPtr doc, xmlNodePtr node, xsltStylesheetPtr style, xsltTransformContextPtr runtime); XSLTPUBFUN void XSLTCALL xsltFreeCompMatchList (xsltCompMatchPtr comp); XSLTPUBFUN int XSLTCALL xsltTestCompMatchList (xsltTransformContextPtr ctxt, xmlNodePtr node, xsltCompMatchPtr comp); XSLTPUBFUN void XSLTCALL xsltNormalizeCompSteps (void *payload, void *data, const xmlChar *name); /* * Template related interfaces. */ XSLTPUBFUN int XSLTCALL xsltAddTemplate (xsltStylesheetPtr style, xsltTemplatePtr cur, const xmlChar *mode, const xmlChar *modeURI); XSLTPUBFUN xsltTemplatePtr XSLTCALL xsltGetTemplate (xsltTransformContextPtr ctxt, xmlNodePtr node, xsltStylesheetPtr style); XSLTPUBFUN void XSLTCALL xsltFreeTemplateHashes (xsltStylesheetPtr style); XSLTPUBFUN void XSLTCALL xsltCleanupTemplates (xsltStylesheetPtr style); #if 0 int xsltMatchPattern (xsltTransformContextPtr ctxt, xmlNodePtr node, const xmlChar *pattern, xmlDocPtr ctxtdoc, xmlNodePtr ctxtnode); #endif #ifdef __cplusplus } #endif #endif /* __XML_XSLT_PATTERN_H__ */ ��������������������������������������������������libxslt/preproc.h�����������������������������������������������������������������������������������0000644�����������������00000001574�14763166027�0010073 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: precomputing stylesheets * Description: this is the compilation phase, where most of the * stylesheet is "compiled" into faster to use data. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XSLT_PRECOMP_H__ #define __XML_XSLT_PRECOMP_H__ #include <libxml/tree.h> #include "xsltexports.h" #include "xsltInternals.h" #ifdef __cplusplus extern "C" { #endif /* * Interfaces */ extern const xmlChar *xsltExtMarker; XSLTPUBFUN xsltElemPreCompPtr XSLTCALL xsltDocumentComp (xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function); XSLTPUBFUN void XSLTCALL xsltStylePreCompute (xsltStylesheetPtr style, xmlNodePtr inst); XSLTPUBFUN void XSLTCALL xsltFreeStylePreComps (xsltStylesheetPtr style); #ifdef __cplusplus } #endif #endif /* __XML_XSLT_PRECOMP_H__ */ ������������������������������������������������������������������������������������������������������������������������������������libxslt/templates.h���������������������������������������������������������������������������������0000644�����������������00000004334�14763166027�0010414 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: interface for the template processing * Description: This set of routine encapsulates XPath calls * and Attribute Value Templates evaluation. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XSLT_TEMPLATES_H__ #define __XML_XSLT_TEMPLATES_H__ #include <libxml/xpath.h> #include <libxml/xpathInternals.h> #include "xsltexports.h" #include "xsltInternals.h" #ifdef __cplusplus extern "C" { #endif XSLTPUBFUN int XSLTCALL xsltEvalXPathPredicate (xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp, xmlNsPtr *nsList, int nsNr); XSLTPUBFUN xmlChar * XSLTCALL xsltEvalTemplateString (xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xmlNodePtr inst); XSLTPUBFUN xmlChar * XSLTCALL xsltEvalAttrValueTemplate (xsltTransformContextPtr ctxt, xmlNodePtr node, const xmlChar *name, const xmlChar *ns); XSLTPUBFUN const xmlChar * XSLTCALL xsltEvalStaticAttrValueTemplate (xsltStylesheetPtr style, xmlNodePtr node, const xmlChar *name, const xmlChar *ns, int *found); /* TODO: this is obviously broken ... the namespaces should be passed too ! */ XSLTPUBFUN xmlChar * XSLTCALL xsltEvalXPathString (xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp); XSLTPUBFUN xmlChar * XSLTCALL xsltEvalXPathStringNs (xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp, int nsNr, xmlNsPtr *nsList); XSLTPUBFUN xmlNodePtr * XSLTCALL xsltTemplateProcess (xsltTransformContextPtr ctxt, xmlNodePtr node); XSLTPUBFUN xmlAttrPtr XSLTCALL xsltAttrListTemplateProcess (xsltTransformContextPtr ctxt, xmlNodePtr target, xmlAttrPtr cur); XSLTPUBFUN xmlAttrPtr XSLTCALL xsltAttrTemplateProcess (xsltTransformContextPtr ctxt, xmlNodePtr target, xmlAttrPtr attr); XSLTPUBFUN xmlChar * XSLTCALL xsltAttrTemplateValueProcess (xsltTransformContextPtr ctxt, const xmlChar* attr); XSLTPUBFUN xmlChar * XSLTCALL xsltAttrTemplateValueProcessNode(xsltTransformContextPtr ctxt, const xmlChar* str, xmlNodePtr node); #ifdef __cplusplus } #endif #endif /* __XML_XSLT_TEMPLATES_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxslt/functions.h���������������������������������������������������������������������������������0000644�����������������00000003726�14763166027�0010432 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: interface for the XSLT functions not from XPath * Description: a set of extra functions coming from XSLT but not in XPath * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard and Bjorn Reese <breese@users.sourceforge.net> */ #ifndef __XML_XSLT_FUNCTIONS_H__ #define __XML_XSLT_FUNCTIONS_H__ #include <libxml/xpath.h> #include <libxml/xpathInternals.h> #include "xsltexports.h" #include "xsltInternals.h" #ifdef __cplusplus extern "C" { #endif /** * XSLT_REGISTER_FUNCTION_LOOKUP: * * Registering macro, not general purpose at all but used in different modules. */ #define XSLT_REGISTER_FUNCTION_LOOKUP(ctxt) \ xmlXPathRegisterFuncLookup((ctxt)->xpathCtxt, \ (xmlXPathFuncLookupFunc) xsltXPathFunctionLookup, \ (void *)(ctxt->xpathCtxt)); XSLTPUBFUN xmlXPathFunction XSLTCALL xsltXPathFunctionLookup (xmlXPathContextPtr ctxt, const xmlChar *name, const xmlChar *ns_uri); /* * Interfaces for the functions implementations. */ XSLTPUBFUN void XSLTCALL xsltDocumentFunction (xmlXPathParserContextPtr ctxt, int nargs); XSLTPUBFUN void XSLTCALL xsltKeyFunction (xmlXPathParserContextPtr ctxt, int nargs); XSLTPUBFUN void XSLTCALL xsltUnparsedEntityURIFunction (xmlXPathParserContextPtr ctxt, int nargs); XSLTPUBFUN void XSLTCALL xsltFormatNumberFunction (xmlXPathParserContextPtr ctxt, int nargs); XSLTPUBFUN void XSLTCALL xsltGenerateIdFunction (xmlXPathParserContextPtr ctxt, int nargs); XSLTPUBFUN void XSLTCALL xsltSystemPropertyFunction (xmlXPathParserContextPtr ctxt, int nargs); XSLTPUBFUN void XSLTCALL xsltElementAvailableFunction (xmlXPathParserContextPtr ctxt, int nargs); XSLTPUBFUN void XSLTCALL xsltFunctionAvailableFunction (xmlXPathParserContextPtr ctxt, int nargs); /* * And the registration */ XSLTPUBFUN void XSLTCALL xsltRegisterAllFunctions (xmlXPathContextPtr ctxt); #ifdef __cplusplus } #endif #endif /* __XML_XSLT_FUNCTIONS_H__ */ ������������������������������������������libxslt/xsltconfig.h��������������������������������������������������������������������������������0000644�����������������00000006510�14763166027�0010574 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: compile-time version informations for the XSLT engine * Description: compile-time version informations for the XSLT engine * this module is autogenerated. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XSLTCONFIG_H__ #define __XML_XSLTCONFIG_H__ #ifdef __cplusplus extern "C" { #endif /** * LIBXSLT_DOTTED_VERSION: * * the version string like "1.2.3" */ #define LIBXSLT_DOTTED_VERSION "1.1.28" /** * LIBXSLT_VERSION: * * the version number: 1.2.3 value is 10203 */ #define LIBXSLT_VERSION 10128 /** * LIBXSLT_VERSION_STRING: * * the version number string, 1.2.3 value is "10203" */ #define LIBXSLT_VERSION_STRING "10128" /** * LIBXSLT_VERSION_EXTRA: * * extra version information, used to show a CVS compilation */ #define LIBXSLT_VERSION_EXTRA "" /** * WITH_XSLT_DEBUG: * * Activate the compilation of the debug reporting. Speed penalty * is insignifiant and being able to run xsltpoc -v is useful. On * by default unless --without-debug is passed to configure */ #if 1 #define WITH_XSLT_DEBUG #endif #if 0 /** * DEBUG_MEMORY: * * should be activated only when debugging libxslt. It replaces the * allocator with a collect and debug shell to the libc allocator. * Use configure --with-mem-debug to activate it on both library */ #define DEBUG_MEMORY /** * DEBUG_MEMORY_LOCATION: * * should be activated only when debugging libxslt. * DEBUG_MEMORY_LOCATION should be activated only when libxml has * been configured with --with-debug-mem too */ #define DEBUG_MEMORY_LOCATION #endif /** * XSLT_NEED_TRIO: * * should be activated if the existing libc library lacks some of the * string formatting function, in that case reuse the Trio ones already * compiled in the libxml2 library. */ #if 0 #define XSLT_NEED_TRIO #endif #ifdef __VMS #define HAVE_MATH_H 1 #define HAVE_SYS_STAT_H 1 #ifndef XSLT_NEED_TRIO #define XSLT_NEED_TRIO #endif #endif #ifdef XSLT_NEED_TRIO #define TRIO_REPLACE_STDIO #endif /** * WITH_XSLT_DEBUGGER: * * Activate the compilation of the debugger support. Speed penalty * is insignifiant. * On by default unless --without-debugger is passed to configure */ #if 1 #ifndef WITH_DEBUGGER #define WITH_DEBUGGER #endif #endif /** * WITH_MODULES: * * Whether module support is configured into libxslt * Note: no default module path for win32 platforms */ #if 1 #ifndef WITH_MODULES #define WITH_MODULES #endif #define LIBXSLT_DEFAULT_PLUGINS_PATH() "/usr/lib/libxslt-plugins" #endif /** * Locale support */ #if 0 #ifndef XSLT_LOCALE_XLOCALE #define XSLT_LOCALE_XLOCALE #endif #elif 0 #ifndef XSLT_LOCALE_WINAPI #define XSLT_LOCALE_WINAPI #endif #endif /** * ATTRIBUTE_UNUSED: * * This macro is used to flag unused function parameters to GCC */ #ifdef __GNUC__ #ifdef HAVE_ANSIDECL_H #include <ansidecl.h> #endif #ifndef ATTRIBUTE_UNUSED #define ATTRIBUTE_UNUSED __attribute__((unused)) #endif #else #define ATTRIBUTE_UNUSED #endif /** * LIBXSLT_PUBLIC: * * This macro is used to declare PUBLIC variables for Cygwin and for MSC on Windows */ #if !defined LIBXSLT_PUBLIC #if (defined(__CYGWIN__) || defined _MSC_VER) && !defined IN_LIBXSLT && !defined LIBXSLT_STATIC #define LIBXSLT_PUBLIC __declspec(dllimport) #else #define LIBXSLT_PUBLIC #endif #endif #ifdef __cplusplus } #endif #endif /* __XML_XSLTCONFIG_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxslt/attributes.h��������������������������������������������������������������������������������0000644�����������������00000001642�14763166027�0010603 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: interface for the XSLT attribute handling * Description: this module handles the specificities of attribute * and attribute groups processing. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XSLT_ATTRIBUTES_H__ #define __XML_XSLT_ATTRIBUTES_H__ #include <libxml/tree.h> #include "xsltexports.h" #ifdef __cplusplus extern "C" { #endif XSLTPUBFUN void XSLTCALL xsltParseStylesheetAttributeSet (xsltStylesheetPtr style, xmlNodePtr cur); XSLTPUBFUN void XSLTCALL xsltFreeAttributeSetsHashes (xsltStylesheetPtr style); XSLTPUBFUN void XSLTCALL xsltApplyAttributeSet (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, const xmlChar *attributes); XSLTPUBFUN void XSLTCALL xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style); #ifdef __cplusplus } #endif #endif /* __XML_XSLT_ATTRIBUTES_H__ */ ����������������������������������������������������������������������������������������������libxslt/xsltInternals.h�����������������������������������������������������������������������������0000644�����������������00000157151�14763166027�0011276 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: internal data structures, constants and functions * Description: Internal data structures, constants and functions used * by the XSLT engine. * They are not part of the API or ABI, i.e. they can change * without prior notice, use carefully. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XSLT_INTERNALS_H__ #define __XML_XSLT_INTERNALS_H__ #include <libxml/tree.h> #include <libxml/hash.h> #include <libxml/xpath.h> #include <libxml/xmlerror.h> #include <libxml/dict.h> #include <libxml/xmlstring.h> #include <libxslt/xslt.h> #include "xsltexports.h" #include "xsltlocale.h" #include "numbersInternals.h" #ifdef __cplusplus extern "C" { #endif /* #define XSLT_DEBUG_PROFILE_CACHE */ /** * XSLT_IS_TEXT_NODE: * * check if the argument is a text node */ #define XSLT_IS_TEXT_NODE(n) ((n != NULL) && \ (((n)->type == XML_TEXT_NODE) || \ ((n)->type == XML_CDATA_SECTION_NODE))) /** * XSLT_MARK_RES_TREE_FRAG: * * internal macro to set up tree fragments */ #define XSLT_MARK_RES_TREE_FRAG(n) \ (n)->name = (char *) xmlStrdup(BAD_CAST " fake node libxslt"); /** * XSLT_IS_RES_TREE_FRAG: * * internal macro to test tree fragments */ #define XSLT_IS_RES_TREE_FRAG(n) \ ((n != NULL) && ((n)->type == XML_DOCUMENT_NODE) && \ ((n)->name != NULL) && ((n)->name[0] == ' ')) /** * XSLT_REFACTORED_KEYCOMP: * * Internal define to enable on-demand xsl:key computation. * That's the only mode now but the define is kept for compatibility */ #define XSLT_REFACTORED_KEYCOMP /** * XSLT_FAST_IF: * * Internal define to enable usage of xmlXPathCompiledEvalToBoolean() * for XSLT "tests"; e.g. in <xsl:if test="/foo/bar"> */ #define XSLT_FAST_IF /** * XSLT_REFACTORED: * * Internal define to enable the refactored parts of Libxslt. */ /* #define XSLT_REFACTORED */ /* ==================================================================== */ /** * XSLT_REFACTORED_VARS: * * Internal define to enable the refactored variable part of libxslt */ #define XSLT_REFACTORED_VARS #ifdef XSLT_REFACTORED extern const xmlChar *xsltXSLTAttrMarker; /* TODO: REMOVE: #define XSLT_REFACTORED_EXCLRESNS */ /* TODO: REMOVE: #define XSLT_REFACTORED_NSALIAS */ /** * XSLT_REFACTORED_XSLT_NSCOMP * * Internal define to enable the pointer-comparison of * namespaces of XSLT elements. */ /* #define XSLT_REFACTORED_XSLT_NSCOMP */ /** * XSLT_REFACTORED_XPATHCOMP: * * Internal define to enable the optimization of the * compilation of XPath expressions. */ #define XSLT_REFACTORED_XPATHCOMP #ifdef XSLT_REFACTORED_XSLT_NSCOMP extern const xmlChar *xsltConstNamespaceNameXSLT; /** * IS_XSLT_ELEM_FAST: * * quick test to detect XSLT elements */ #define IS_XSLT_ELEM_FAST(n) \ (((n) != NULL) && ((n)->ns != NULL) && \ ((n)->ns->href == xsltConstNamespaceNameXSLT)) /** * IS_XSLT_ATTR_FAST: * * quick test to detect XSLT attributes */ #define IS_XSLT_ATTR_FAST(a) \ (((a) != NULL) && ((a)->ns != NULL) && \ ((a)->ns->href == xsltConstNamespaceNameXSLT)) /** * XSLT_HAS_INTERNAL_NSMAP: * * check for namespace mapping */ #define XSLT_HAS_INTERNAL_NSMAP(s) \ (((s) != NULL) && ((s)->principal) && \ ((s)->principal->principalData) && \ ((s)->principal->principalData->nsMap)) /** * XSLT_GET_INTERNAL_NSMAP: * * get pointer to namespace map */ #define XSLT_GET_INTERNAL_NSMAP(s) ((s)->principal->principalData->nsMap) #else /* XSLT_REFACTORED_XSLT_NSCOMP */ /** * IS_XSLT_ELEM_FAST: * * quick check whether this is an xslt element */ #define IS_XSLT_ELEM_FAST(n) \ (((n) != NULL) && ((n)->ns != NULL) && \ (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE))) /** * IS_XSLT_ATTR_FAST: * * quick check for xslt namespace attribute */ #define IS_XSLT_ATTR_FAST(a) \ (((a) != NULL) && ((a)->ns != NULL) && \ (xmlStrEqual((a)->ns->href, XSLT_NAMESPACE))) #endif /* XSLT_REFACTORED_XSLT_NSCOMP */ /** * XSLT_REFACTORED_MANDATORY_VERSION: * * TODO: Currently disabled to surpress regression test failures, since * the old behaviour was that a missing version attribute * produced a only a warning and not an error, which was incerrect. * So the regression tests need to be fixed if this is enabled. */ /* #define XSLT_REFACTORED_MANDATORY_VERSION */ /** * xsltPointerList: * * Pointer-list for various purposes. */ typedef struct _xsltPointerList xsltPointerList; typedef xsltPointerList *xsltPointerListPtr; struct _xsltPointerList { void **items; int number; int size; }; #endif /** * XSLT_REFACTORED_PARSING: * * Internal define to enable the refactored parts of Libxslt * related to parsing. */ /* #define XSLT_REFACTORED_PARSING */ /** * XSLT_MAX_SORT: * * Max number of specified xsl:sort on an element. */ #define XSLT_MAX_SORT 15 /** * XSLT_PAT_NO_PRIORITY: * * Specific value for pattern without priority expressed. */ #define XSLT_PAT_NO_PRIORITY -12345789 /** * xsltRuntimeExtra: * * Extra information added to the transformation context. */ typedef struct _xsltRuntimeExtra xsltRuntimeExtra; typedef xsltRuntimeExtra *xsltRuntimeExtraPtr; struct _xsltRuntimeExtra { void *info; /* pointer to the extra data */ xmlFreeFunc deallocate; /* pointer to the deallocation routine */ union { /* dual-purpose field */ void *ptr; /* data not needing deallocation */ int ival; /* integer value storage */ } val; }; /** * XSLT_RUNTIME_EXTRA_LST: * @ctxt: the transformation context * @nr: the index * * Macro used to access extra information stored in the context */ #define XSLT_RUNTIME_EXTRA_LST(ctxt, nr) (ctxt)->extras[(nr)].info /** * XSLT_RUNTIME_EXTRA_FREE: * @ctxt: the transformation context * @nr: the index * * Macro used to free extra information stored in the context */ #define XSLT_RUNTIME_EXTRA_FREE(ctxt, nr) (ctxt)->extras[(nr)].deallocate /** * XSLT_RUNTIME_EXTRA: * @ctxt: the transformation context * @nr: the index * * Macro used to define extra information stored in the context */ #define XSLT_RUNTIME_EXTRA(ctxt, nr, typ) (ctxt)->extras[(nr)].val.typ /** * xsltTemplate: * * The in-memory structure corresponding to an XSLT Template. */ typedef struct _xsltTemplate xsltTemplate; typedef xsltTemplate *xsltTemplatePtr; struct _xsltTemplate { struct _xsltTemplate *next;/* chained list sorted by priority */ struct _xsltStylesheet *style;/* the containing stylesheet */ xmlChar *match; /* the matching string */ float priority; /* as given from the stylesheet, not computed */ const xmlChar *name; /* the local part of the name QName */ const xmlChar *nameURI; /* the URI part of the name QName */ const xmlChar *mode;/* the local part of the mode QName */ const xmlChar *modeURI;/* the URI part of the mode QName */ xmlNodePtr content; /* the template replacement value */ xmlNodePtr elem; /* the source element */ /* * TODO: @inheritedNsNr and @inheritedNs won't be used in the * refactored code. */ int inheritedNsNr; /* number of inherited namespaces */ xmlNsPtr *inheritedNs;/* inherited non-excluded namespaces */ /* Profiling informations */ int nbCalls; /* the number of time the template was called */ unsigned long time; /* the time spent in this template */ void *params; /* xsl:param instructions */ int templNr; /* Nb of templates in the stack */ int templMax; /* Size of the templtes stack */ xsltTemplatePtr *templCalledTab; /* templates called */ int *templCountTab; /* .. and how often */ }; /** * xsltDecimalFormat: * * Data structure of decimal-format. */ typedef struct _xsltDecimalFormat xsltDecimalFormat; typedef xsltDecimalFormat *xsltDecimalFormatPtr; struct _xsltDecimalFormat { struct _xsltDecimalFormat *next; /* chained list */ xmlChar *name; /* Used for interpretation of pattern */ xmlChar *digit; xmlChar *patternSeparator; /* May appear in result */ xmlChar *minusSign; xmlChar *infinity; xmlChar *noNumber; /* Not-a-number */ /* Used for interpretation of pattern and may appear in result */ xmlChar *decimalPoint; xmlChar *grouping; xmlChar *percent; xmlChar *permille; xmlChar *zeroDigit; }; /** * xsltDocument: * * Data structure associated to a parsed document. */ typedef struct _xsltDocument xsltDocument; typedef xsltDocument *xsltDocumentPtr; struct _xsltDocument { struct _xsltDocument *next; /* documents are kept in a chained list */ int main; /* is this the main document */ xmlDocPtr doc; /* the parsed document */ void *keys; /* key tables storage */ struct _xsltDocument *includes; /* subsidiary includes */ int preproc; /* pre-processing already done */ int nbKeysComputed; }; /** * xsltKeyDef: * * Representation of an xsl:key. */ typedef struct _xsltKeyDef xsltKeyDef; typedef xsltKeyDef *xsltKeyDefPtr; struct _xsltKeyDef { struct _xsltKeyDef *next; xmlNodePtr inst; xmlChar *name; xmlChar *nameURI; xmlChar *match; xmlChar *use; xmlXPathCompExprPtr comp; xmlXPathCompExprPtr usecomp; xmlNsPtr *nsList; /* the namespaces in scope */ int nsNr; /* the number of namespaces in scope */ }; /** * xsltKeyTable: * * Holds the computed keys for key definitions of the same QName. * Is owned by an xsltDocument. */ typedef struct _xsltKeyTable xsltKeyTable; typedef xsltKeyTable *xsltKeyTablePtr; struct _xsltKeyTable { struct _xsltKeyTable *next; xmlChar *name; xmlChar *nameURI; xmlHashTablePtr keys; }; /* * The in-memory structure corresponding to an XSLT Stylesheet. * NOTE: most of the content is simply linked from the doc tree * structure, no specific allocation is made. */ typedef struct _xsltStylesheet xsltStylesheet; typedef xsltStylesheet *xsltStylesheetPtr; typedef struct _xsltTransformContext xsltTransformContext; typedef xsltTransformContext *xsltTransformContextPtr; /** * xsltElemPreComp: * * The in-memory structure corresponding to element precomputed data, * designed to be extended by extension implementors. */ typedef struct _xsltElemPreComp xsltElemPreComp; typedef xsltElemPreComp *xsltElemPreCompPtr; /** * xsltTransformFunction: * @ctxt: the XSLT transformation context * @node: the input node * @inst: the stylesheet node * @comp: the compiled information from the stylesheet * * Signature of the function associated to elements part of the * stylesheet language like xsl:if or xsl:apply-templates. */ typedef void (*xsltTransformFunction) (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr comp); /** * xsltSortFunc: * @ctxt: a transformation context * @sorts: the node-set to sort * @nbsorts: the number of sorts * * Signature of the function to use during sorting */ typedef void (*xsltSortFunc) (xsltTransformContextPtr ctxt, xmlNodePtr *sorts, int nbsorts); typedef enum { XSLT_FUNC_COPY=1, XSLT_FUNC_SORT, XSLT_FUNC_TEXT, XSLT_FUNC_ELEMENT, XSLT_FUNC_ATTRIBUTE, XSLT_FUNC_COMMENT, XSLT_FUNC_PI, XSLT_FUNC_COPYOF, XSLT_FUNC_VALUEOF, XSLT_FUNC_NUMBER, XSLT_FUNC_APPLYIMPORTS, XSLT_FUNC_CALLTEMPLATE, XSLT_FUNC_APPLYTEMPLATES, XSLT_FUNC_CHOOSE, XSLT_FUNC_IF, XSLT_FUNC_FOREACH, XSLT_FUNC_DOCUMENT, XSLT_FUNC_WITHPARAM, XSLT_FUNC_PARAM, XSLT_FUNC_VARIABLE, XSLT_FUNC_WHEN, XSLT_FUNC_EXTENSION #ifdef XSLT_REFACTORED , XSLT_FUNC_OTHERWISE, XSLT_FUNC_FALLBACK, XSLT_FUNC_MESSAGE, XSLT_FUNC_INCLUDE, XSLT_FUNC_ATTRSET, XSLT_FUNC_LITERAL_RESULT_ELEMENT, XSLT_FUNC_UNKOWN_FORWARDS_COMPAT #endif } xsltStyleType; /** * xsltElemPreCompDeallocator: * @comp: the #xsltElemPreComp to free up * * Deallocates an #xsltElemPreComp structure. */ typedef void (*xsltElemPreCompDeallocator) (xsltElemPreCompPtr comp); /** * xsltElemPreComp: * * The basic structure for compiled items of the AST of the XSLT processor. * This structure is also intended to be extended by extension implementors. * TODO: This is somehow not nice, since it has a "free" field, which * derived stylesheet-structs do not have. */ struct _xsltElemPreComp { xsltElemPreCompPtr next; /* next item in the global chained list hold by xsltStylesheet. */ xsltStyleType type; /* type of the element */ xsltTransformFunction func; /* handling function */ xmlNodePtr inst; /* the node in the stylesheet's tree corresponding to this item */ /* end of common part */ xsltElemPreCompDeallocator free; /* the deallocator */ }; /** * xsltStylePreComp: * * The abstract basic structure for items of the XSLT processor. * This includes: * 1) compiled forms of XSLT instructions (xsl:if, xsl:attribute, etc.) * 2) compiled forms of literal result elements * 3) compiled forms of extension elements */ typedef struct _xsltStylePreComp xsltStylePreComp; typedef xsltStylePreComp *xsltStylePreCompPtr; #ifdef XSLT_REFACTORED /* * Some pointer-list utility functions. */ XSLTPUBFUN xsltPointerListPtr XSLTCALL xsltPointerListCreate (int initialSize); XSLTPUBFUN void XSLTCALL xsltPointerListFree (xsltPointerListPtr list); XSLTPUBFUN void XSLTCALL xsltPointerListClear (xsltPointerListPtr list); XSLTPUBFUN int XSLTCALL xsltPointerListAddSize (xsltPointerListPtr list, void *item, int initialSize); /************************************************************************ * * * Refactored structures * * * ************************************************************************/ typedef struct _xsltNsListContainer xsltNsListContainer; typedef xsltNsListContainer *xsltNsListContainerPtr; struct _xsltNsListContainer { xmlNsPtr *list; int totalNumber; int xpathNumber; }; /** * XSLT_ITEM_COMPATIBILITY_FIELDS: * * Fields for API compatibility to the structure * _xsltElemPreComp which is used for extension functions. * Note that @next is used for storage; it does not reflect a next * sibling in the tree. * TODO: Evaluate if we really need such a compatibility. */ #define XSLT_ITEM_COMPATIBILITY_FIELDS \ xsltElemPreCompPtr next;\ xsltStyleType type;\ xsltTransformFunction func;\ xmlNodePtr inst; /** * XSLT_ITEM_NAVIGATION_FIELDS: * * Currently empty. * TODO: It is intended to hold navigational fields in the future. */ #define XSLT_ITEM_NAVIGATION_FIELDS /* xsltStylePreCompPtr parent;\ xsltStylePreCompPtr children;\ xsltStylePreCompPtr nextItem; */ /** * XSLT_ITEM_NSINSCOPE_FIELDS: * * The in-scope namespaces. */ #define XSLT_ITEM_NSINSCOPE_FIELDS xsltNsListContainerPtr inScopeNs; /** * XSLT_ITEM_COMMON_FIELDS: * * Common fields used for all items. */ #define XSLT_ITEM_COMMON_FIELDS \ XSLT_ITEM_COMPATIBILITY_FIELDS \ XSLT_ITEM_NAVIGATION_FIELDS \ XSLT_ITEM_NSINSCOPE_FIELDS /** * _xsltStylePreComp: * * The abstract basic structure for items of the XSLT processor. * This includes: * 1) compiled forms of XSLT instructions (e.g. xsl:if, xsl:attribute, etc.) * 2) compiled forms of literal result elements * 3) various properties for XSLT instructions (e.g. xsl:when, * xsl:with-param) * * REVISIT TODO: Keep this structure equal to the fields * defined by XSLT_ITEM_COMMON_FIELDS */ struct _xsltStylePreComp { xsltElemPreCompPtr next; /* next item in the global chained list hold by xsltStylesheet */ xsltStyleType type; /* type of the item */ xsltTransformFunction func; /* handling function */ xmlNodePtr inst; /* the node in the stylesheet's tree corresponding to this item. */ /* Currently no navigational fields. */ xsltNsListContainerPtr inScopeNs; }; /** * xsltStyleBasicEmptyItem: * * Abstract structure only used as a short-cut for * XSLT items with no extra fields. * NOTE that it is intended that this structure looks the same as * _xsltStylePreComp. */ typedef struct _xsltStyleBasicEmptyItem xsltStyleBasicEmptyItem; typedef xsltStyleBasicEmptyItem *xsltStyleBasicEmptyItemPtr; struct _xsltStyleBasicEmptyItem { XSLT_ITEM_COMMON_FIELDS }; /** * xsltStyleBasicExpressionItem: * * Abstract structure only used as a short-cut for * XSLT items with just an expression. */ typedef struct _xsltStyleBasicExpressionItem xsltStyleBasicExpressionItem; typedef xsltStyleBasicExpressionItem *xsltStyleBasicExpressionItemPtr; struct _xsltStyleBasicExpressionItem { XSLT_ITEM_COMMON_FIELDS const xmlChar *select; /* TODO: Change this to "expression". */ xmlXPathCompExprPtr comp; /* TODO: Change this to compExpr. */ }; /************************************************************************ * * * XSLT-instructions/declarations * * * ************************************************************************/ /** * xsltStyleItemElement: * * <!-- Category: instruction --> * <xsl:element * name = { qname } * namespace = { uri-reference } * use-attribute-sets = qnames> * <!-- Content: template --> * </xsl:element> */ typedef struct _xsltStyleItemElement xsltStyleItemElement; typedef xsltStyleItemElement *xsltStyleItemElementPtr; struct _xsltStyleItemElement { XSLT_ITEM_COMMON_FIELDS const xmlChar *use; int has_use; const xmlChar *name; int has_name; const xmlChar *ns; const xmlChar *nsPrefix; int has_ns; }; /** * xsltStyleItemAttribute: * * <!-- Category: instruction --> * <xsl:attribute * name = { qname } * namespace = { uri-reference }> * <!-- Content: template --> * </xsl:attribute> */ typedef struct _xsltStyleItemAttribute xsltStyleItemAttribute; typedef xsltStyleItemAttribute *xsltStyleItemAttributePtr; struct _xsltStyleItemAttribute { XSLT_ITEM_COMMON_FIELDS const xmlChar *name; int has_name; const xmlChar *ns; const xmlChar *nsPrefix; int has_ns; }; /** * xsltStyleItemText: * * <!-- Category: instruction --> * <xsl:text * disable-output-escaping = "yes" | "no"> * <!-- Content: #PCDATA --> * </xsl:text> */ typedef struct _xsltStyleItemText xsltStyleItemText; typedef xsltStyleItemText *xsltStyleItemTextPtr; struct _xsltStyleItemText { XSLT_ITEM_COMMON_FIELDS int noescape; /* text */ }; /** * xsltStyleItemComment: * * <!-- Category: instruction --> * <xsl:comment> * <!-- Content: template --> * </xsl:comment> */ typedef xsltStyleBasicEmptyItem xsltStyleItemComment; typedef xsltStyleItemComment *xsltStyleItemCommentPtr; /** * xsltStyleItemPI: * * <!-- Category: instruction --> * <xsl:processing-instruction * name = { ncname }> * <!-- Content: template --> * </xsl:processing-instruction> */ typedef struct _xsltStyleItemPI xsltStyleItemPI; typedef xsltStyleItemPI *xsltStyleItemPIPtr; struct _xsltStyleItemPI { XSLT_ITEM_COMMON_FIELDS const xmlChar *name; int has_name; }; /** * xsltStyleItemApplyImports: * * <!-- Category: instruction --> * <xsl:apply-imports /> */ typedef xsltStyleBasicEmptyItem xsltStyleItemApplyImports; typedef xsltStyleItemApplyImports *xsltStyleItemApplyImportsPtr; /** * xsltStyleItemApplyTemplates: * * <!-- Category: instruction --> * <xsl:apply-templates * select = node-set-expression * mode = qname> * <!-- Content: (xsl:sort | xsl:with-param)* --> * </xsl:apply-templates> */ typedef struct _xsltStyleItemApplyTemplates xsltStyleItemApplyTemplates; typedef xsltStyleItemApplyTemplates *xsltStyleItemApplyTemplatesPtr; struct _xsltStyleItemApplyTemplates { XSLT_ITEM_COMMON_FIELDS const xmlChar *mode; /* apply-templates */ const xmlChar *modeURI; /* apply-templates */ const xmlChar *select; /* sort, copy-of, value-of, apply-templates */ xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ /* TODO: with-params */ }; /** * xsltStyleItemCallTemplate: * * <!-- Category: instruction --> * <xsl:call-template * name = qname> * <!-- Content: xsl:with-param* --> * </xsl:call-template> */ typedef struct _xsltStyleItemCallTemplate xsltStyleItemCallTemplate; typedef xsltStyleItemCallTemplate *xsltStyleItemCallTemplatePtr; struct _xsltStyleItemCallTemplate { XSLT_ITEM_COMMON_FIELDS xsltTemplatePtr templ; /* call-template */ const xmlChar *name; /* element, attribute, pi */ int has_name; /* element, attribute, pi */ const xmlChar *ns; /* element */ int has_ns; /* element */ /* TODO: with-params */ }; /** * xsltStyleItemCopy: * * <!-- Category: instruction --> * <xsl:copy * use-attribute-sets = qnames> * <!-- Content: template --> * </xsl:copy> */ typedef struct _xsltStyleItemCopy xsltStyleItemCopy; typedef xsltStyleItemCopy *xsltStyleItemCopyPtr; struct _xsltStyleItemCopy { XSLT_ITEM_COMMON_FIELDS const xmlChar *use; /* copy, element */ int has_use; /* copy, element */ }; /** * xsltStyleItemIf: * * <!-- Category: instruction --> * <xsl:if * test = boolean-expression> * <!-- Content: template --> * </xsl:if> */ typedef struct _xsltStyleItemIf xsltStyleItemIf; typedef xsltStyleItemIf *xsltStyleItemIfPtr; struct _xsltStyleItemIf { XSLT_ITEM_COMMON_FIELDS const xmlChar *test; /* if */ xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ }; /** * xsltStyleItemCopyOf: * * <!-- Category: instruction --> * <xsl:copy-of * select = expression /> */ typedef xsltStyleBasicExpressionItem xsltStyleItemCopyOf; typedef xsltStyleItemCopyOf *xsltStyleItemCopyOfPtr; /** * xsltStyleItemValueOf: * * <!-- Category: instruction --> * <xsl:value-of * select = string-expression * disable-output-escaping = "yes" | "no" /> */ typedef struct _xsltStyleItemValueOf xsltStyleItemValueOf; typedef xsltStyleItemValueOf *xsltStyleItemValueOfPtr; struct _xsltStyleItemValueOf { XSLT_ITEM_COMMON_FIELDS const xmlChar *select; xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ int noescape; }; /** * xsltStyleItemNumber: * * <!-- Category: instruction --> * <xsl:number * level = "single" | "multiple" | "any" * count = pattern * from = pattern * value = number-expression * format = { string } * lang = { nmtoken } * letter-value = { "alphabetic" | "traditional" } * grouping-separator = { char } * grouping-size = { number } /> */ typedef struct _xsltStyleItemNumber xsltStyleItemNumber; typedef xsltStyleItemNumber *xsltStyleItemNumberPtr; struct _xsltStyleItemNumber { XSLT_ITEM_COMMON_FIELDS xsltNumberData numdata; /* number */ }; /** * xsltStyleItemChoose: * * <!-- Category: instruction --> * <xsl:choose> * <!-- Content: (xsl:when+, xsl:otherwise?) --> * </xsl:choose> */ typedef xsltStyleBasicEmptyItem xsltStyleItemChoose; typedef xsltStyleItemChoose *xsltStyleItemChoosePtr; /** * xsltStyleItemFallback: * * <!-- Category: instruction --> * <xsl:fallback> * <!-- Content: template --> * </xsl:fallback> */ typedef xsltStyleBasicEmptyItem xsltStyleItemFallback; typedef xsltStyleItemFallback *xsltStyleItemFallbackPtr; /** * xsltStyleItemForEach: * * <!-- Category: instruction --> * <xsl:for-each * select = node-set-expression> * <!-- Content: (xsl:sort*, template) --> * </xsl:for-each> */ typedef xsltStyleBasicExpressionItem xsltStyleItemForEach; typedef xsltStyleItemForEach *xsltStyleItemForEachPtr; /** * xsltStyleItemMessage: * * <!-- Category: instruction --> * <xsl:message * terminate = "yes" | "no"> * <!-- Content: template --> * </xsl:message> */ typedef struct _xsltStyleItemMessage xsltStyleItemMessage; typedef xsltStyleItemMessage *xsltStyleItemMessagePtr; struct _xsltStyleItemMessage { XSLT_ITEM_COMMON_FIELDS int terminate; }; /** * xsltStyleItemDocument: * * NOTE: This is not an instruction of XSLT 1.0. */ typedef struct _xsltStyleItemDocument xsltStyleItemDocument; typedef xsltStyleItemDocument *xsltStyleItemDocumentPtr; struct _xsltStyleItemDocument { XSLT_ITEM_COMMON_FIELDS int ver11; /* assigned: in xsltDocumentComp; read: nowhere; TODO: Check if we need. */ const xmlChar *filename; /* document URL */ int has_filename; }; /************************************************************************ * * * Non-instructions (actually properties of instructions/declarations) * * * ************************************************************************/ /** * xsltStyleBasicItemVariable: * * Basic struct for xsl:variable, xsl:param and xsl:with-param. * It's currently important to have equal fields, since * xsltParseStylesheetCallerParam() is used with xsl:with-param from * the xslt side and with xsl:param from the exslt side (in * exsltFuncFunctionFunction()). * * FUTURE NOTE: In XSLT 2.0 xsl:param, xsl:variable and xsl:with-param * have additional different fields. */ typedef struct _xsltStyleBasicItemVariable xsltStyleBasicItemVariable; typedef xsltStyleBasicItemVariable *xsltStyleBasicItemVariablePtr; struct _xsltStyleBasicItemVariable { XSLT_ITEM_COMMON_FIELDS const xmlChar *select; xmlXPathCompExprPtr comp; const xmlChar *name; int has_name; const xmlChar *ns; int has_ns; }; /** * xsltStyleItemVariable: * * <!-- Category: top-level-element --> * <xsl:param * name = qname * select = expression> * <!-- Content: template --> * </xsl:param> */ typedef xsltStyleBasicItemVariable xsltStyleItemVariable; typedef xsltStyleItemVariable *xsltStyleItemVariablePtr; /** * xsltStyleItemParam: * * <!-- Category: top-level-element --> * <xsl:param * name = qname * select = expression> * <!-- Content: template --> * </xsl:param> */ typedef struct _xsltStyleItemParam xsltStyleItemParam; typedef xsltStyleItemParam *xsltStyleItemParamPtr; struct _xsltStyleItemParam { XSLT_ITEM_COMMON_FIELDS const xmlChar *select; xmlXPathCompExprPtr comp; const xmlChar *name; int has_name; const xmlChar *ns; int has_ns; }; /** * xsltStyleItemWithParam: * * <xsl:with-param * name = qname * select = expression> * <!-- Content: template --> * </xsl:with-param> */ typedef xsltStyleBasicItemVariable xsltStyleItemWithParam; typedef xsltStyleItemWithParam *xsltStyleItemWithParamPtr; /** * xsltStyleItemSort: * * Reflects the XSLT xsl:sort item. * Allowed parents: xsl:apply-templates, xsl:for-each * <xsl:sort * select = string-expression * lang = { nmtoken } * data-type = { "text" | "number" | qname-but-not-ncname } * order = { "ascending" | "descending" } * case-order = { "upper-first" | "lower-first" } /> */ typedef struct _xsltStyleItemSort xsltStyleItemSort; typedef xsltStyleItemSort *xsltStyleItemSortPtr; struct _xsltStyleItemSort { XSLT_ITEM_COMMON_FIELDS const xmlChar *stype; /* sort */ int has_stype; /* sort */ int number; /* sort */ const xmlChar *order; /* sort */ int has_order; /* sort */ int descending; /* sort */ const xmlChar *lang; /* sort */ int has_lang; /* sort */ xsltLocale locale; /* sort */ const xmlChar *case_order; /* sort */ int lower_first; /* sort */ const xmlChar *use; int has_use; const xmlChar *select; /* sort, copy-of, value-of, apply-templates */ xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ }; /** * xsltStyleItemWhen: * * <xsl:when * test = boolean-expression> * <!-- Content: template --> * </xsl:when> * Allowed parent: xsl:choose */ typedef struct _xsltStyleItemWhen xsltStyleItemWhen; typedef xsltStyleItemWhen *xsltStyleItemWhenPtr; struct _xsltStyleItemWhen { XSLT_ITEM_COMMON_FIELDS const xmlChar *test; xmlXPathCompExprPtr comp; }; /** * xsltStyleItemOtherwise: * * Allowed parent: xsl:choose * <xsl:otherwise> * <!-- Content: template --> * </xsl:otherwise> */ typedef struct _xsltStyleItemOtherwise xsltStyleItemOtherwise; typedef xsltStyleItemOtherwise *xsltStyleItemOtherwisePtr; struct _xsltStyleItemOtherwise { XSLT_ITEM_COMMON_FIELDS }; typedef struct _xsltStyleItemInclude xsltStyleItemInclude; typedef xsltStyleItemInclude *xsltStyleItemIncludePtr; struct _xsltStyleItemInclude { XSLT_ITEM_COMMON_FIELDS xsltDocumentPtr include; }; /************************************************************************ * * * XSLT elements in forwards-compatible mode * * * ************************************************************************/ typedef struct _xsltStyleItemUknown xsltStyleItemUknown; typedef xsltStyleItemUknown *xsltStyleItemUknownPtr; struct _xsltStyleItemUknown { XSLT_ITEM_COMMON_FIELDS }; /************************************************************************ * * * Extension elements * * * ************************************************************************/ /* * xsltStyleItemExtElement: * * Reflects extension elements. * * NOTE: Due to the fact that the structure xsltElemPreComp is most * probably already heavily in use out there by users, so we cannot * easily change it, we'll create an intermediate structure which will * hold an xsltElemPreCompPtr. * BIG NOTE: The only problem I see here is that the user processes the * content of the stylesheet tree, possibly he'll lookup the node->psvi * fields in order to find subsequent extension functions. * In this case, the user's code will break, since the node->psvi * field will hold now the xsltStyleItemExtElementPtr and not * the xsltElemPreCompPtr. * However the place where the structure is anchored in the node-tree, * namely node->psvi, has beed already once been moved from node->_private * to node->psvi, so we have a precedent here, which, I think, should allow * us to change such semantics without headaches. */ typedef struct _xsltStyleItemExtElement xsltStyleItemExtElement; typedef xsltStyleItemExtElement *xsltStyleItemExtElementPtr; struct _xsltStyleItemExtElement { XSLT_ITEM_COMMON_FIELDS xsltElemPreCompPtr item; }; /************************************************************************ * * * Literal result elements * * * ************************************************************************/ typedef struct _xsltEffectiveNs xsltEffectiveNs; typedef xsltEffectiveNs *xsltEffectiveNsPtr; struct _xsltEffectiveNs { xsltEffectiveNsPtr nextInStore; /* storage next */ xsltEffectiveNsPtr next; /* next item in the list */ const xmlChar *prefix; const xmlChar *nsName; /* * Indicates if eclared on the literal result element; dunno if really * needed. */ int holdByElem; }; /* * Info for literal result elements. * This will be set on the elem->psvi field and will be * shared by literal result elements, which have the same * excluded result namespaces; i.e., this *won't* be created uniquely * for every literal result element. */ typedef struct _xsltStyleItemLRElementInfo xsltStyleItemLRElementInfo; typedef xsltStyleItemLRElementInfo *xsltStyleItemLRElementInfoPtr; struct _xsltStyleItemLRElementInfo { XSLT_ITEM_COMMON_FIELDS /* * @effectiveNs is the set of effective ns-nodes * on the literal result element, which will be added to the result * element if not already existing in the result tree. * This means that excluded namespaces (via exclude-result-prefixes, * extension-element-prefixes and the XSLT namespace) not added * to the set. * Namespace-aliasing was applied on the @effectiveNs. */ xsltEffectiveNsPtr effectiveNs; }; #ifdef XSLT_REFACTORED typedef struct _xsltNsAlias xsltNsAlias; typedef xsltNsAlias *xsltNsAliasPtr; struct _xsltNsAlias { xsltNsAliasPtr next; /* next in the list */ xmlNsPtr literalNs; xmlNsPtr targetNs; xmlDocPtr docOfTargetNs; }; #endif #ifdef XSLT_REFACTORED_XSLT_NSCOMP typedef struct _xsltNsMap xsltNsMap; typedef xsltNsMap *xsltNsMapPtr; struct _xsltNsMap { xsltNsMapPtr next; /* next in the list */ xmlDocPtr doc; xmlNodePtr elem; /* the element holding the ns-decl */ xmlNsPtr ns; /* the xmlNs structure holding the XML namespace name */ const xmlChar *origNsName; /* the original XML namespace name */ const xmlChar *newNsName; /* the mapped XML namespace name */ }; #endif /************************************************************************ * * * Compile-time structures for *internal* use only * * * ************************************************************************/ typedef struct _xsltPrincipalStylesheetData xsltPrincipalStylesheetData; typedef xsltPrincipalStylesheetData *xsltPrincipalStylesheetDataPtr; typedef struct _xsltNsList xsltNsList; typedef xsltNsList *xsltNsListPtr; struct _xsltNsList { xsltNsListPtr next; /* next in the list */ xmlNsPtr ns; }; /* * xsltVarInfo: * * Used at compilation time for parameters and variables. */ typedef struct _xsltVarInfo xsltVarInfo; typedef xsltVarInfo *xsltVarInfoPtr; struct _xsltVarInfo { xsltVarInfoPtr next; /* next in the list */ xsltVarInfoPtr prev; int depth; /* the depth in the tree */ const xmlChar *name; const xmlChar *nsName; }; /** * xsltCompilerNodeInfo: * * Per-node information during compile-time. */ typedef struct _xsltCompilerNodeInfo xsltCompilerNodeInfo; typedef xsltCompilerNodeInfo *xsltCompilerNodeInfoPtr; struct _xsltCompilerNodeInfo { xsltCompilerNodeInfoPtr next; xsltCompilerNodeInfoPtr prev; xmlNodePtr node; int depth; xsltTemplatePtr templ; /* The owning template */ int category; /* XSLT element, LR-element or extension element */ xsltStyleType type; xsltElemPreCompPtr item; /* The compiled information */ /* The current in-scope namespaces */ xsltNsListContainerPtr inScopeNs; /* The current excluded result namespaces */ xsltPointerListPtr exclResultNs; /* The current extension instruction namespaces */ xsltPointerListPtr extElemNs; /* The current info for literal result elements. */ xsltStyleItemLRElementInfoPtr litResElemInfo; /* * Set to 1 if in-scope namespaces changed, * or excluded result namespaces changed, * or extension element namespaces changed. * This will trigger creation of new infos * for literal result elements. */ int nsChanged; int preserveWhitespace; int stripWhitespace; int isRoot; /* whether this is the stylesheet's root node */ int forwardsCompat; /* whether forwards-compatible mode is enabled */ /* whether the content of an extension element was processed */ int extContentHandled; /* the type of the current child */ xsltStyleType curChildType; }; /** * XSLT_CCTXT: * * get pointer to compiler context */ #define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt) typedef enum { XSLT_ERROR_SEVERITY_ERROR = 0, XSLT_ERROR_SEVERITY_WARNING } xsltErrorSeverityType; typedef struct _xsltCompilerCtxt xsltCompilerCtxt; typedef xsltCompilerCtxt *xsltCompilerCtxtPtr; struct _xsltCompilerCtxt { void *errorCtxt; /* user specific error context */ /* * used for error/warning reports; e.g. XSLT_ERROR_SEVERITY_WARNING */ xsltErrorSeverityType errSeverity; int warnings; /* TODO: number of warnings found at compilation */ int errors; /* TODO: number of errors found at compilation */ xmlDictPtr dict; xsltStylesheetPtr style; int simplified; /* whether this is a simplified stylesheet */ /* TODO: structured/unstructured error contexts. */ int depth; /* Current depth of processing */ xsltCompilerNodeInfoPtr inode; xsltCompilerNodeInfoPtr inodeList; xsltCompilerNodeInfoPtr inodeLast; xsltPointerListPtr tmpList; /* Used for various purposes */ /* * The XSLT version as specified by the stylesheet's root element. */ int isInclude; int hasForwardsCompat; /* whether forwards-compatible mode was used in a parsing episode */ int maxNodeInfos; /* TEMP TODO: just for the interest */ int maxLREs; /* TEMP TODO: just for the interest */ /* * In order to keep the old behaviour, applying strict rules of * the spec can be turned off. This has effect only on special * mechanisms like whitespace-stripping in the stylesheet. */ int strict; xsltPrincipalStylesheetDataPtr psData; #ifdef XSLT_REFACTORED_XPATHCOMP xmlXPathContextPtr xpathCtxt; #endif xsltStyleItemUknownPtr unknownItem; int hasNsAliases; /* Indicator if there was an xsl:namespace-alias. */ xsltNsAliasPtr nsAliases; xsltVarInfoPtr ivars; /* Storage of local in-scope variables/params. */ xsltVarInfoPtr ivar; /* topmost local variable/param. */ }; #else /* XSLT_REFACTORED */ /* * The old structures before refactoring. */ /** * _xsltStylePreComp: * * The in-memory structure corresponding to XSLT stylesheet constructs * precomputed data. */ struct _xsltStylePreComp { xsltElemPreCompPtr next; /* chained list */ xsltStyleType type; /* type of the element */ xsltTransformFunction func; /* handling function */ xmlNodePtr inst; /* the instruction */ /* * Pre computed values. */ const xmlChar *stype; /* sort */ int has_stype; /* sort */ int number; /* sort */ const xmlChar *order; /* sort */ int has_order; /* sort */ int descending; /* sort */ const xmlChar *lang; /* sort */ int has_lang; /* sort */ xsltLocale locale; /* sort */ const xmlChar *case_order; /* sort */ int lower_first; /* sort */ const xmlChar *use; /* copy, element */ int has_use; /* copy, element */ int noescape; /* text */ const xmlChar *name; /* element, attribute, pi */ int has_name; /* element, attribute, pi */ const xmlChar *ns; /* element */ int has_ns; /* element */ const xmlChar *mode; /* apply-templates */ const xmlChar *modeURI; /* apply-templates */ const xmlChar *test; /* if */ xsltTemplatePtr templ; /* call-template */ const xmlChar *select; /* sort, copy-of, value-of, apply-templates */ int ver11; /* document */ const xmlChar *filename; /* document URL */ int has_filename; /* document */ xsltNumberData numdata; /* number */ xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ xmlNsPtr *nsList; /* the namespaces in scope */ int nsNr; /* the number of namespaces in scope */ }; #endif /* XSLT_REFACTORED */ /* * The in-memory structure corresponding to an XSLT Variable * or Param. */ typedef struct _xsltStackElem xsltStackElem; typedef xsltStackElem *xsltStackElemPtr; struct _xsltStackElem { struct _xsltStackElem *next;/* chained list */ xsltStylePreCompPtr comp; /* the compiled form */ int computed; /* was the evaluation done */ const xmlChar *name; /* the local part of the name QName */ const xmlChar *nameURI; /* the URI part of the name QName */ const xmlChar *select; /* the eval string */ xmlNodePtr tree; /* the sequence constructor if no eval string or the location */ xmlXPathObjectPtr value; /* The value if computed */ xmlDocPtr fragment; /* The Result Tree Fragments (needed for XSLT 1.0) which are bound to the variable's lifetime. */ int level; /* the depth in the tree; -1 if persistent (e.g. a given xsl:with-param) */ xsltTransformContextPtr context; /* The transformation context; needed to cache the variables */ int flags; }; #ifdef XSLT_REFACTORED struct _xsltPrincipalStylesheetData { /* * Namespace dictionary for ns-prefixes and ns-names: * TODO: Shared between stylesheets, and XPath mechanisms. * Not used yet. */ xmlDictPtr namespaceDict; /* * Global list of in-scope namespaces. */ xsltPointerListPtr inScopeNamespaces; /* * Global list of information for [xsl:]excluded-result-prefixes. */ xsltPointerListPtr exclResultNamespaces; /* * Global list of information for [xsl:]extension-element-prefixes. */ xsltPointerListPtr extElemNamespaces; xsltEffectiveNsPtr effectiveNs; #ifdef XSLT_REFACTORED_XSLT_NSCOMP /* * Namespace name map to get rid of string comparison of namespace names. */ xsltNsMapPtr nsMap; #endif }; #endif /* * Note that we added a @compCtxt field to anchor an stylesheet compilation * context, since, due to historical reasons, various compile-time function * take only the stylesheet as argument and not a compilation context. */ struct _xsltStylesheet { /* * The stylesheet import relation is kept as a tree. */ struct _xsltStylesheet *parent; struct _xsltStylesheet *next; struct _xsltStylesheet *imports; xsltDocumentPtr docList; /* the include document list */ /* * General data on the style sheet document. */ xmlDocPtr doc; /* the parsed XML stylesheet */ xmlHashTablePtr stripSpaces;/* the hash table of the strip-space and preserve space elements */ int stripAll; /* strip-space * (1) preserve-space * (-1) */ xmlHashTablePtr cdataSection;/* the hash table of the cdata-section */ /* * Global variable or parameters. */ xsltStackElemPtr variables; /* linked list of param and variables */ /* * Template descriptions. */ xsltTemplatePtr templates; /* the ordered list of templates */ void *templatesHash; /* hash table or wherever compiled templates informations are stored */ void *rootMatch; /* template based on / */ void *keyMatch; /* template based on key() */ void *elemMatch; /* template based on * */ void *attrMatch; /* template based on @* */ void *parentMatch; /* template based on .. */ void *textMatch; /* template based on text() */ void *piMatch; /* template based on processing-instruction() */ void *commentMatch; /* template based on comment() */ /* * Namespace aliases. * NOTE: Not used in the refactored code. */ xmlHashTablePtr nsAliases; /* the namespace alias hash tables */ /* * Attribute sets. */ xmlHashTablePtr attributeSets;/* the attribute sets hash tables */ /* * Namespaces. * TODO: Eliminate this. */ xmlHashTablePtr nsHash; /* the set of namespaces in use: ATTENTION: This is used for execution of XPath expressions; unfortunately it restricts the stylesheet to have distinct prefixes. TODO: We need to get rid of this. */ void *nsDefs; /* ATTENTION TODO: This is currently used to store xsltExtDefPtr (in extensions.c) and *not* xmlNsPtr. */ /* * Key definitions. */ void *keys; /* key definitions */ /* * Output related stuff. */ xmlChar *method; /* the output method */ xmlChar *methodURI; /* associated namespace if any */ xmlChar *version; /* version string */ xmlChar *encoding; /* encoding string */ int omitXmlDeclaration; /* omit-xml-declaration = "yes" | "no" */ /* * Number formatting. */ xsltDecimalFormatPtr decimalFormat; int standalone; /* standalone = "yes" | "no" */ xmlChar *doctypePublic; /* doctype-public string */ xmlChar *doctypeSystem; /* doctype-system string */ int indent; /* should output being indented */ xmlChar *mediaType; /* media-type string */ /* * Precomputed blocks. */ xsltElemPreCompPtr preComps;/* list of precomputed blocks */ int warnings; /* number of warnings found at compilation */ int errors; /* number of errors found at compilation */ xmlChar *exclPrefix; /* last excluded prefixes */ xmlChar **exclPrefixTab; /* array of excluded prefixes */ int exclPrefixNr; /* number of excluded prefixes in scope */ int exclPrefixMax; /* size of the array */ void *_private; /* user defined data */ /* * Extensions. */ xmlHashTablePtr extInfos; /* the extension data */ int extrasNr; /* the number of extras required */ /* * For keeping track of nested includes */ xsltDocumentPtr includes; /* points to last nested include */ /* * dictionary: shared between stylesheet, context and documents. */ xmlDictPtr dict; /* * precompiled attribute value templates. */ void *attVTs; /* * if namespace-alias has an alias for the default stylesheet prefix * NOTE: Not used in the refactored code. */ const xmlChar *defaultAlias; /* * bypass pre-processing (already done) (used in imports) */ int nopreproc; /* * all document text strings were internalized */ int internalized; /* * Literal Result Element as Stylesheet c.f. section 2.3 */ int literal_result; /* * The principal stylesheet */ xsltStylesheetPtr principal; #ifdef XSLT_REFACTORED /* * Compilation context used during compile-time. */ xsltCompilerCtxtPtr compCtxt; /* TODO: Change this to (void *). */ xsltPrincipalStylesheetDataPtr principalData; #endif /* * Forwards-compatible processing */ int forwards_compatible; }; typedef struct _xsltTransformCache xsltTransformCache; typedef xsltTransformCache *xsltTransformCachePtr; struct _xsltTransformCache { xmlDocPtr RVT; int nbRVT; xsltStackElemPtr stackItems; int nbStackItems; #ifdef XSLT_DEBUG_PROFILE_CACHE int dbgCachedRVTs; int dbgReusedRVTs; int dbgCachedVars; int dbgReusedVars; #endif }; /* * The in-memory structure corresponding to an XSLT Transformation. */ typedef enum { XSLT_OUTPUT_XML = 0, XSLT_OUTPUT_HTML, XSLT_OUTPUT_TEXT } xsltOutputType; typedef enum { XSLT_STATE_OK = 0, XSLT_STATE_ERROR, XSLT_STATE_STOPPED } xsltTransformState; struct _xsltTransformContext { xsltStylesheetPtr style; /* the stylesheet used */ xsltOutputType type; /* the type of output */ xsltTemplatePtr templ; /* the current template */ int templNr; /* Nb of templates in the stack */ int templMax; /* Size of the templtes stack */ xsltTemplatePtr *templTab; /* the template stack */ xsltStackElemPtr vars; /* the current variable list */ int varsNr; /* Nb of variable list in the stack */ int varsMax; /* Size of the variable list stack */ xsltStackElemPtr *varsTab; /* the variable list stack */ int varsBase; /* the var base for current templ */ /* * Extensions */ xmlHashTablePtr extFunctions; /* the extension functions */ xmlHashTablePtr extElements; /* the extension elements */ xmlHashTablePtr extInfos; /* the extension data */ const xmlChar *mode; /* the current mode */ const xmlChar *modeURI; /* the current mode URI */ xsltDocumentPtr docList; /* the document list */ xsltDocumentPtr document; /* the current source document; can be NULL if an RTF */ xmlNodePtr node; /* the current node being processed */ xmlNodeSetPtr nodeList; /* the current node list */ /* xmlNodePtr current; the node */ xmlDocPtr output; /* the resulting document */ xmlNodePtr insert; /* the insertion node */ xmlXPathContextPtr xpathCtxt; /* the XPath context */ xsltTransformState state; /* the current state */ /* * Global variables */ xmlHashTablePtr globalVars; /* the global variables and params */ xmlNodePtr inst; /* the instruction in the stylesheet */ int xinclude; /* should XInclude be processed */ const char * outputFile; /* the output URI if known */ int profile; /* is this run profiled */ long prof; /* the current profiled value */ int profNr; /* Nb of templates in the stack */ int profMax; /* Size of the templtaes stack */ long *profTab; /* the profile template stack */ void *_private; /* user defined data */ int extrasNr; /* the number of extras used */ int extrasMax; /* the number of extras allocated */ xsltRuntimeExtraPtr extras; /* extra per runtime informations */ xsltDocumentPtr styleList; /* the stylesheet docs list */ void * sec; /* the security preferences if any */ xmlGenericErrorFunc error; /* a specific error handler */ void * errctx; /* context for the error handler */ xsltSortFunc sortfunc; /* a ctxt specific sort routine */ /* * handling of temporary Result Value Tree * (XSLT 1.0 term: "Result Tree Fragment") */ xmlDocPtr tmpRVT; /* list of RVT without persistance */ xmlDocPtr persistRVT; /* list of persistant RVTs */ int ctxtflags; /* context processing flags */ /* * Speed optimization when coalescing text nodes */ const xmlChar *lasttext; /* last text node content */ unsigned int lasttsize; /* last text node size */ unsigned int lasttuse; /* last text node use */ /* * Per Context Debugging */ int debugStatus; /* the context level debug status */ unsigned long* traceCode; /* pointer to the variable holding the mask */ int parserOptions; /* parser options xmlParserOption */ /* * dictionary: shared between stylesheet, context and documents. */ xmlDictPtr dict; xmlDocPtr tmpDoc; /* Obsolete; not used in the library. */ /* * all document text strings are internalized */ int internalized; int nbKeys; int hasTemplKeyPatterns; xsltTemplatePtr currentTemplateRule; /* the Current Template Rule */ xmlNodePtr initialContextNode; xmlDocPtr initialContextDoc; xsltTransformCachePtr cache; void *contextVariable; /* the current variable item */ xmlDocPtr localRVT; /* list of local tree fragments; will be freed when the instruction which created the fragment exits */ xmlDocPtr localRVTBase; int keyInitLevel; /* Needed to catch recursive keys issues */ int funcLevel; /* Needed to catch recursive functions issues */ int maxTemplateDepth; int maxTemplateVars; }; /** * CHECK_STOPPED: * * Macro to check if the XSLT processing should be stopped. * Will return from the function. */ #define CHECK_STOPPED if (ctxt->state == XSLT_STATE_STOPPED) return; /** * CHECK_STOPPEDE: * * Macro to check if the XSLT processing should be stopped. * Will goto the error: label. */ #define CHECK_STOPPEDE if (ctxt->state == XSLT_STATE_STOPPED) goto error; /** * CHECK_STOPPED0: * * Macro to check if the XSLT processing should be stopped. * Will return from the function with a 0 value. */ #define CHECK_STOPPED0 if (ctxt->state == XSLT_STATE_STOPPED) return(0); /* * The macro XML_CAST_FPTR is a hack to avoid a gcc warning about * possible incompatibilities between function pointers and object * pointers. It is defined in libxml/hash.h within recent versions * of libxml2, but is put here for compatibility. */ #ifndef XML_CAST_FPTR /** * XML_CAST_FPTR: * @fptr: pointer to a function * * Macro to do a casting from an object pointer to a * function pointer without encountering a warning from * gcc * * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr)) * This macro violated ISO C aliasing rules (gcc4 on s390 broke) * so it is disabled now */ #define XML_CAST_FPTR(fptr) fptr #endif /* * Functions associated to the internal types xsltDecimalFormatPtr xsltDecimalFormatGetByName(xsltStylesheetPtr sheet, xmlChar *name); */ XSLTPUBFUN xsltStylesheetPtr XSLTCALL xsltNewStylesheet (void); XSLTPUBFUN xsltStylesheetPtr XSLTCALL xsltParseStylesheetFile (const xmlChar* filename); XSLTPUBFUN void XSLTCALL xsltFreeStylesheet (xsltStylesheetPtr style); XSLTPUBFUN int XSLTCALL xsltIsBlank (xmlChar *str); XSLTPUBFUN void XSLTCALL xsltFreeStackElemList (xsltStackElemPtr elem); XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL xsltDecimalFormatGetByName(xsltStylesheetPtr style, xmlChar *name); XSLTPUBFUN xsltStylesheetPtr XSLTCALL xsltParseStylesheetProcess(xsltStylesheetPtr ret, xmlDocPtr doc); XSLTPUBFUN void XSLTCALL xsltParseStylesheetOutput(xsltStylesheetPtr style, xmlNodePtr cur); XSLTPUBFUN xsltStylesheetPtr XSLTCALL xsltParseStylesheetDoc (xmlDocPtr doc); XSLTPUBFUN xsltStylesheetPtr XSLTCALL xsltParseStylesheetImportedDoc(xmlDocPtr doc, xsltStylesheetPtr style); XSLTPUBFUN xsltStylesheetPtr XSLTCALL xsltLoadStylesheetPI (xmlDocPtr doc); XSLTPUBFUN void XSLTCALL xsltNumberFormat (xsltTransformContextPtr ctxt, xsltNumberDataPtr data, xmlNodePtr node); XSLTPUBFUN xmlXPathError XSLTCALL xsltFormatNumberConversion(xsltDecimalFormatPtr self, xmlChar *format, double number, xmlChar **result); XSLTPUBFUN void XSLTCALL xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ); XSLTPUBFUN int XSLTCALL xsltAllocateExtra (xsltStylesheetPtr style); XSLTPUBFUN int XSLTCALL xsltAllocateExtraCtxt (xsltTransformContextPtr ctxt); /* * Extra functions for Result Value Trees */ XSLTPUBFUN xmlDocPtr XSLTCALL xsltCreateRVT (xsltTransformContextPtr ctxt); XSLTPUBFUN int XSLTCALL xsltRegisterTmpRVT (xsltTransformContextPtr ctxt, xmlDocPtr RVT); XSLTPUBFUN int XSLTCALL xsltRegisterLocalRVT (xsltTransformContextPtr ctxt, xmlDocPtr RVT); XSLTPUBFUN int XSLTCALL xsltRegisterPersistRVT (xsltTransformContextPtr ctxt, xmlDocPtr RVT); XSLTPUBFUN int XSLTCALL xsltExtensionInstructionResultRegister( xsltTransformContextPtr ctxt, xmlXPathObjectPtr obj); XSLTPUBFUN int XSLTCALL xsltExtensionInstructionResultFinalize( xsltTransformContextPtr ctxt); XSLTPUBFUN void XSLTCALL xsltFreeRVTs (xsltTransformContextPtr ctxt); XSLTPUBFUN void XSLTCALL xsltReleaseRVT (xsltTransformContextPtr ctxt, xmlDocPtr RVT); /* * Extra functions for Attribute Value Templates */ XSLTPUBFUN void XSLTCALL xsltCompileAttr (xsltStylesheetPtr style, xmlAttrPtr attr); XSLTPUBFUN xmlChar * XSLTCALL xsltEvalAVT (xsltTransformContextPtr ctxt, void *avt, xmlNodePtr node); XSLTPUBFUN void XSLTCALL xsltFreeAVTList (void *avt); /* * Extra function for successful xsltCleanupGlobals / xsltInit sequence. */ XSLTPUBFUN void XSLTCALL xsltUninit (void); /************************************************************************ * * * Compile-time functions for *internal* use only * * * ************************************************************************/ #ifdef XSLT_REFACTORED XSLTPUBFUN void XSLTCALL xsltParseSequenceConstructor( xsltCompilerCtxtPtr cctxt, xmlNodePtr start); XSLTPUBFUN int XSLTCALL xsltParseAnyXSLTElem (xsltCompilerCtxtPtr cctxt, xmlNodePtr elem); #ifdef XSLT_REFACTORED_XSLT_NSCOMP XSLTPUBFUN int XSLTCALL xsltRestoreDocumentNamespaces( xsltNsMapPtr ns, xmlDocPtr doc); #endif #endif /* XSLT_REFACTORED */ /************************************************************************ * * * Transformation-time functions for *internal* use only * * * ************************************************************************/ XSLTPUBFUN int XSLTCALL xsltInitCtxtKey (xsltTransformContextPtr ctxt, xsltDocumentPtr doc, xsltKeyDefPtr keyd); XSLTPUBFUN int XSLTCALL xsltInitAllDocKeys (xsltTransformContextPtr ctxt); #ifdef __cplusplus } #endif #endif /* __XML_XSLT_H__ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxslt/xslt.h��������������������������������������������������������������������������������������0000644�����������������00000003654�14763166027�0007414 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: Interfaces, constants and types related to the XSLT engine * Description: Interfaces, constants and types related to the XSLT engine * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XSLT_H__ #define __XML_XSLT_H__ #include <libxml/tree.h> #include "xsltexports.h" #ifdef __cplusplus extern "C" { #endif /** * XSLT_DEFAULT_VERSION: * * The default version of XSLT supported. */ #define XSLT_DEFAULT_VERSION "1.0" /** * XSLT_DEFAULT_VENDOR: * * The XSLT "vendor" string for this processor. */ #define XSLT_DEFAULT_VENDOR "libxslt" /** * XSLT_DEFAULT_URL: * * The XSLT "vendor" URL for this processor. */ #define XSLT_DEFAULT_URL "http://xmlsoft.org/XSLT/" /** * XSLT_NAMESPACE: * * The XSLT specification namespace. */ #define XSLT_NAMESPACE ((const xmlChar *)"http://www.w3.org/1999/XSL/Transform") /** * XSLT_PARSE_OPTIONS: * * The set of options to pass to an xmlReadxxx when loading files for * XSLT consumption. */ #define XSLT_PARSE_OPTIONS \ XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_NOCDATA /** * xsltMaxDepth: * * This value is used to detect templates loops. */ XSLTPUBVAR int xsltMaxDepth; /** * * xsltMaxVars: * * * * This value is used to detect templates loops. * */ XSLTPUBVAR int xsltMaxVars; /** * xsltEngineVersion: * * The version string for libxslt. */ XSLTPUBVAR const char *xsltEngineVersion; /** * xsltLibxsltVersion: * * The version of libxslt compiled. */ XSLTPUBVAR const int xsltLibxsltVersion; /** * xsltLibxmlVersion: * * The version of libxml libxslt was compiled against. */ XSLTPUBVAR const int xsltLibxmlVersion; /* * Global initialization function. */ XSLTPUBFUN void XSLTCALL xsltInit (void); /* * Global cleanup function. */ XSLTPUBFUN void XSLTCALL xsltCleanupGlobals (void); #ifdef __cplusplus } #endif #endif /* __XML_XSLT_H__ */ ������������������������������������������������������������������������������������libxslt/keys.h��������������������������������������������������������������������������������������0000644�����������������00000002203�14763166027�0007362 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: interface for the key matching used in key() and template matches. * Description: implementation of the key mechanims. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XSLT_KEY_H__ #define __XML_XSLT_KEY_H__ #include <libxml/xpath.h> #include "xsltexports.h" #include "xsltInternals.h" #ifdef __cplusplus extern "C" { #endif /** * NODE_IS_KEYED: * * check for bit 15 set */ #define NODE_IS_KEYED (1 >> 15) XSLTPUBFUN int XSLTCALL xsltAddKey (xsltStylesheetPtr style, const xmlChar *name, const xmlChar *nameURI, const xmlChar *match, const xmlChar *use, xmlNodePtr inst); XSLTPUBFUN xmlNodeSetPtr XSLTCALL xsltGetKey (xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *nameURI, const xmlChar *value); XSLTPUBFUN void XSLTCALL xsltInitCtxtKeys (xsltTransformContextPtr ctxt, xsltDocumentPtr doc); XSLTPUBFUN void XSLTCALL xsltFreeKeys (xsltStylesheetPtr style); XSLTPUBFUN void XSLTCALL xsltFreeDocumentKeys (xsltDocumentPtr doc); #ifdef __cplusplus } #endif #endif /* __XML_XSLT_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxslt/namespaces.h��������������������������������������������������������������������������������0000644�����������������00000003202�14763166027�0010526 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: interface for the XSLT namespace handling * Description: set of function easing the processing and generation * of namespace nodes in XSLT. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XSLT_NAMESPACES_H__ #define __XML_XSLT_NAMESPACES_H__ #include <libxml/tree.h> #include "xsltexports.h" #ifdef __cplusplus extern "C" { #endif /* * Used within nsAliases hashtable when the default namespace is required * but it's not been explicitly defined */ /** * UNDEFINED_DEFAULT_NS: * * Special value for undefined namespace, internal */ #define UNDEFINED_DEFAULT_NS (const xmlChar *) -1L XSLTPUBFUN void XSLTCALL xsltNamespaceAlias (xsltStylesheetPtr style, xmlNodePtr node); XSLTPUBFUN xmlNsPtr XSLTCALL xsltGetNamespace (xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns, xmlNodePtr out); XSLTPUBFUN xmlNsPtr XSLTCALL xsltGetPlainNamespace (xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns, xmlNodePtr out); XSLTPUBFUN xmlNsPtr XSLTCALL xsltGetSpecialNamespace (xsltTransformContextPtr ctxt, xmlNodePtr cur, const xmlChar *URI, const xmlChar *prefix, xmlNodePtr out); XSLTPUBFUN xmlNsPtr XSLTCALL xsltCopyNamespace (xsltTransformContextPtr ctxt, xmlNodePtr elem, xmlNsPtr ns); XSLTPUBFUN xmlNsPtr XSLTCALL xsltCopyNamespaceList (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNsPtr cur); XSLTPUBFUN void XSLTCALL xsltFreeNamespaceAliasHashes (xsltStylesheetPtr style); #ifdef __cplusplus } #endif #endif /* __XML_XSLT_NAMESPACES_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxslt/xsltutils.h���������������������������������������������������������������������������������0000644�����������������00000020120�14763166027�0010460 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: set of utilities for the XSLT engine * Description: interfaces for the utilities module of the XSLT engine. * things like message handling, profiling, and other * generally useful routines. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XSLTUTILS_H__ #define __XML_XSLTUTILS_H__ #include <libxslt/xsltconfig.h> #ifdef HAVE_STDARG_H #include <stdarg.h> #endif #include <libxml/xpath.h> #include <libxml/dict.h> #include <libxml/xmlerror.h> #include "xsltexports.h" #include "xsltInternals.h" #ifdef __cplusplus extern "C" { #endif /** * XSLT_TODO: * * Macro to flag unimplemented blocks. */ #define XSLT_TODO \ xsltGenericError(xsltGenericErrorContext, \ "Unimplemented block at %s:%d\n", \ __FILE__, __LINE__); /** * XSLT_STRANGE: * * Macro to flag that a problem was detected internally. */ #define XSLT_STRANGE \ xsltGenericError(xsltGenericErrorContext, \ "Internal error at %s:%d\n", \ __FILE__, __LINE__); /** * IS_XSLT_ELEM: * * Checks that the element pertains to XSLT namespace. */ #define IS_XSLT_ELEM(n) \ (((n) != NULL) && ((n)->type == XML_ELEMENT_NODE) && \ ((n)->ns != NULL) && (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE))) /** * IS_XSLT_NAME: * * Checks the value of an element in XSLT namespace. */ #define IS_XSLT_NAME(n, val) \ (xmlStrEqual((n)->name, (const xmlChar *) (val))) /** * IS_XSLT_REAL_NODE: * * Check that a node is a 'real' one: document, element, text or attribute. */ #define IS_XSLT_REAL_NODE(n) \ (((n) != NULL) && \ (((n)->type == XML_ELEMENT_NODE) || \ ((n)->type == XML_TEXT_NODE) || \ ((n)->type == XML_CDATA_SECTION_NODE) || \ ((n)->type == XML_ATTRIBUTE_NODE) || \ ((n)->type == XML_DOCUMENT_NODE) || \ ((n)->type == XML_HTML_DOCUMENT_NODE) || \ ((n)->type == XML_COMMENT_NODE) || \ ((n)->type == XML_PI_NODE))) /* * Our own version of namespaced atributes lookup. */ XSLTPUBFUN xmlChar * XSLTCALL xsltGetNsProp (xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace); XSLTPUBFUN const xmlChar * XSLTCALL xsltGetCNsProp (xsltStylesheetPtr style, xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace); XSLTPUBFUN int XSLTCALL xsltGetUTF8Char (const unsigned char *utf, int *len); /* * XSLT Debug Tracing Tracing Types */ typedef enum { XSLT_TRACE_ALL = -1, XSLT_TRACE_NONE = 0, XSLT_TRACE_COPY_TEXT = 1<<0, XSLT_TRACE_PROCESS_NODE = 1<<1, XSLT_TRACE_APPLY_TEMPLATE = 1<<2, XSLT_TRACE_COPY = 1<<3, XSLT_TRACE_COMMENT = 1<<4, XSLT_TRACE_PI = 1<<5, XSLT_TRACE_COPY_OF = 1<<6, XSLT_TRACE_VALUE_OF = 1<<7, XSLT_TRACE_CALL_TEMPLATE = 1<<8, XSLT_TRACE_APPLY_TEMPLATES = 1<<9, XSLT_TRACE_CHOOSE = 1<<10, XSLT_TRACE_IF = 1<<11, XSLT_TRACE_FOR_EACH = 1<<12, XSLT_TRACE_STRIP_SPACES = 1<<13, XSLT_TRACE_TEMPLATES = 1<<14, XSLT_TRACE_KEYS = 1<<15, XSLT_TRACE_VARIABLES = 1<<16 } xsltDebugTraceCodes; /** * XSLT_TRACE: * * Control the type of xsl debugtrace messages emitted. */ #define XSLT_TRACE(ctxt,code,call) \ if (ctxt->traceCode && (*(ctxt->traceCode) & code)) \ call XSLTPUBFUN void XSLTCALL xsltDebugSetDefaultTrace(xsltDebugTraceCodes val); XSLTPUBFUN xsltDebugTraceCodes XSLTCALL xsltDebugGetDefaultTrace(void); /* * XSLT specific error and debug reporting functions. */ XSLTPUBVAR xmlGenericErrorFunc xsltGenericError; XSLTPUBVAR void *xsltGenericErrorContext; XSLTPUBVAR xmlGenericErrorFunc xsltGenericDebug; XSLTPUBVAR void *xsltGenericDebugContext; XSLTPUBFUN void XSLTCALL xsltPrintErrorContext (xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node); XSLTPUBFUN void XSLTCALL xsltMessage (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst); XSLTPUBFUN void XSLTCALL xsltSetGenericErrorFunc (void *ctx, xmlGenericErrorFunc handler); XSLTPUBFUN void XSLTCALL xsltSetGenericDebugFunc (void *ctx, xmlGenericErrorFunc handler); XSLTPUBFUN void XSLTCALL xsltSetTransformErrorFunc (xsltTransformContextPtr ctxt, void *ctx, xmlGenericErrorFunc handler); XSLTPUBFUN void XSLTCALL xsltTransformError (xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg, ...); XSLTPUBFUN int XSLTCALL xsltSetCtxtParseOptions (xsltTransformContextPtr ctxt, int options); /* * Sorting. */ XSLTPUBFUN void XSLTCALL xsltDocumentSortFunction (xmlNodeSetPtr list); XSLTPUBFUN void XSLTCALL xsltSetSortFunc (xsltSortFunc handler); XSLTPUBFUN void XSLTCALL xsltSetCtxtSortFunc (xsltTransformContextPtr ctxt, xsltSortFunc handler); XSLTPUBFUN void XSLTCALL xsltDefaultSortFunction (xsltTransformContextPtr ctxt, xmlNodePtr *sorts, int nbsorts); XSLTPUBFUN void XSLTCALL xsltDoSortFunction (xsltTransformContextPtr ctxt, xmlNodePtr * sorts, int nbsorts); XSLTPUBFUN xmlXPathObjectPtr * XSLTCALL xsltComputeSortResult (xsltTransformContextPtr ctxt, xmlNodePtr sort); /* * QNames handling. */ XSLTPUBFUN const xmlChar * XSLTCALL xsltSplitQName (xmlDictPtr dict, const xmlChar *name, const xmlChar **prefix); XSLTPUBFUN const xmlChar * XSLTCALL xsltGetQNameURI (xmlNodePtr node, xmlChar **name); XSLTPUBFUN const xmlChar * XSLTCALL xsltGetQNameURI2 (xsltStylesheetPtr style, xmlNodePtr node, const xmlChar **name); /* * Output, reuse libxml I/O buffers. */ XSLTPUBFUN int XSLTCALL xsltSaveResultTo (xmlOutputBufferPtr buf, xmlDocPtr result, xsltStylesheetPtr style); XSLTPUBFUN int XSLTCALL xsltSaveResultToFilename (const char *URI, xmlDocPtr result, xsltStylesheetPtr style, int compression); XSLTPUBFUN int XSLTCALL xsltSaveResultToFile (FILE *file, xmlDocPtr result, xsltStylesheetPtr style); XSLTPUBFUN int XSLTCALL xsltSaveResultToFd (int fd, xmlDocPtr result, xsltStylesheetPtr style); XSLTPUBFUN int XSLTCALL xsltSaveResultToString (xmlChar **doc_txt_ptr, int * doc_txt_len, xmlDocPtr result, xsltStylesheetPtr style); /* * XPath interface */ XSLTPUBFUN xmlXPathCompExprPtr XSLTCALL xsltXPathCompile (xsltStylesheetPtr style, const xmlChar *str); XSLTPUBFUN xmlXPathCompExprPtr XSLTCALL xsltXPathCompileFlags (xsltStylesheetPtr style, const xmlChar *str, int flags); /* * Profiling. */ XSLTPUBFUN void XSLTCALL xsltSaveProfiling (xsltTransformContextPtr ctxt, FILE *output); XSLTPUBFUN xmlDocPtr XSLTCALL xsltGetProfileInformation (xsltTransformContextPtr ctxt); XSLTPUBFUN long XSLTCALL xsltTimestamp (void); XSLTPUBFUN void XSLTCALL xsltCalibrateAdjust (long delta); /** * XSLT_TIMESTAMP_TICS_PER_SEC: * * Sampling precision for profiling */ #define XSLT_TIMESTAMP_TICS_PER_SEC 100000l /* * Hooks for the debugger. */ typedef enum { XSLT_DEBUG_NONE = 0, /* no debugging allowed */ XSLT_DEBUG_INIT, XSLT_DEBUG_STEP, XSLT_DEBUG_STEPOUT, XSLT_DEBUG_NEXT, XSLT_DEBUG_STOP, XSLT_DEBUG_CONT, XSLT_DEBUG_RUN, XSLT_DEBUG_RUN_RESTART, XSLT_DEBUG_QUIT } xsltDebugStatusCodes; XSLTPUBVAR int xslDebugStatus; typedef void (*xsltHandleDebuggerCallback) (xmlNodePtr cur, xmlNodePtr node, xsltTemplatePtr templ, xsltTransformContextPtr ctxt); typedef int (*xsltAddCallCallback) (xsltTemplatePtr templ, xmlNodePtr source); typedef void (*xsltDropCallCallback) (void); XSLTPUBFUN void XSLTCALL xsltSetDebuggerStatus (int value); XSLTPUBFUN int XSLTCALL xsltGetDebuggerStatus (void); XSLTPUBFUN int XSLTCALL xsltSetDebuggerCallbacks (int no, void *block); XSLTPUBFUN int XSLTCALL xslAddCall (xsltTemplatePtr templ, xmlNodePtr source); XSLTPUBFUN void XSLTCALL xslDropCall (void); #ifdef __cplusplus } #endif #endif /* __XML_XSLTUTILS_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxslt/security.h����������������������������������������������������������������������������������0000644�����������������00000005134�14763166027�0010264 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: interface for the libxslt security framework * Description: the libxslt security framework allow to restrict * the access to new resources (file or URL) from * the stylesheet at runtime. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XSLT_SECURITY_H__ #define __XML_XSLT_SECURITY_H__ #include <libxml/tree.h> #include "xsltexports.h" #include "xsltInternals.h" #ifdef __cplusplus extern "C" { #endif /** * xsltSecurityPref: * * structure to indicate the preferences for security in the XSLT * transformation. */ typedef struct _xsltSecurityPrefs xsltSecurityPrefs; typedef xsltSecurityPrefs *xsltSecurityPrefsPtr; /** * xsltSecurityOption: * * the set of option that can be configured */ typedef enum { XSLT_SECPREF_READ_FILE = 1, XSLT_SECPREF_WRITE_FILE, XSLT_SECPREF_CREATE_DIRECTORY, XSLT_SECPREF_READ_NETWORK, XSLT_SECPREF_WRITE_NETWORK } xsltSecurityOption; /** * xsltSecurityCheck: * * User provided function to check the value of a string like a file * path or an URL ... */ typedef int (*xsltSecurityCheck) (xsltSecurityPrefsPtr sec, xsltTransformContextPtr ctxt, const char *value); /* * Module interfaces */ XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL xsltNewSecurityPrefs (void); XSLTPUBFUN void XSLTCALL xsltFreeSecurityPrefs (xsltSecurityPrefsPtr sec); XSLTPUBFUN int XSLTCALL xsltSetSecurityPrefs (xsltSecurityPrefsPtr sec, xsltSecurityOption option, xsltSecurityCheck func); XSLTPUBFUN xsltSecurityCheck XSLTCALL xsltGetSecurityPrefs (xsltSecurityPrefsPtr sec, xsltSecurityOption option); XSLTPUBFUN void XSLTCALL xsltSetDefaultSecurityPrefs (xsltSecurityPrefsPtr sec); XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL xsltGetDefaultSecurityPrefs (void); XSLTPUBFUN int XSLTCALL xsltSetCtxtSecurityPrefs (xsltSecurityPrefsPtr sec, xsltTransformContextPtr ctxt); XSLTPUBFUN int XSLTCALL xsltSecurityAllow (xsltSecurityPrefsPtr sec, xsltTransformContextPtr ctxt, const char *value); XSLTPUBFUN int XSLTCALL xsltSecurityForbid (xsltSecurityPrefsPtr sec, xsltTransformContextPtr ctxt, const char *value); /* * internal interfaces */ XSLTPUBFUN int XSLTCALL xsltCheckWrite (xsltSecurityPrefsPtr sec, xsltTransformContextPtr ctxt, const xmlChar *URL); XSLTPUBFUN int XSLTCALL xsltCheckRead (xsltSecurityPrefsPtr sec, xsltTransformContextPtr ctxt, const xmlChar *URL); #ifdef __cplusplus } #endif #endif /* __XML_XSLT_SECURITY_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxslt/xsltlocale.h��������������������������������������������������������������������������������0000644�����������������00000002321�14763166027�0010562 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: Locale handling * Description: Interfaces for locale handling. Needed for language dependent * sorting. * * Copy: See Copyright for the status of this software. * * Author: Nick Wellnhofer */ #ifndef __XML_XSLTLOCALE_H__ #define __XML_XSLTLOCALE_H__ #include <libxml/xmlstring.h> #ifdef XSLT_LOCALE_XLOCALE #include <locale.h> #include <xlocale.h> #ifdef __GLIBC__ /*locale_t is defined only if _GNU_SOURCE is defined*/ typedef __locale_t xsltLocale; #else typedef locale_t xsltLocale; #endif typedef xmlChar xsltLocaleChar; #elif defined(XSLT_LOCALE_WINAPI) #include <windows.h> #include <winnls.h> typedef LCID xsltLocale; typedef wchar_t xsltLocaleChar; #else /* * XSLT_LOCALE_NONE: * Macro indicating that locale are not supported */ #ifndef XSLT_LOCALE_NONE #define XSLT_LOCALE_NONE #endif typedef void *xsltLocale; typedef xmlChar xsltLocaleChar; #endif xsltLocale xsltNewLocale(const xmlChar *langName); void xsltFreeLocale(xsltLocale locale); xsltLocaleChar *xsltStrxfrm(xsltLocale locale, const xmlChar *string); int xsltLocaleStrcmp(xsltLocale locale, const xsltLocaleChar *str1, const xsltLocaleChar *str2); void xsltFreeLocales(void); #endif /* __XML_XSLTLOCALE_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������resolv.h��������������������������������������������������������������������������������������������0000644�����������������00000035261�14763166027�0006252 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 1983, 1987, 1989 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /* * Portions Copyright (c) 1996-1999 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* * @(#)resolv.h 8.1 (Berkeley) 6/2/93 * $BINDId: resolv.h,v 8.31 2000/03/30 20:16:50 vixie Exp $ */ #ifndef _RESOLV_H_ /* These headers are needed for types used in the `struct res_state' declaration. */ #include <sys/types.h> #include <netinet/in.h> #ifndef __need_res_state # define _RESOLV_H_ # include <sys/param.h> # include <sys/cdefs.h> # include <stdio.h> # include <arpa/nameser.h> #endif #ifndef __res_state_defined # define __res_state_defined typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error } res_sendhookact; typedef res_sendhookact (*res_send_qhook) (struct sockaddr_in * const *__ns, const u_char **__query, int *__querylen, u_char *__ans, int __anssiz, int *__resplen); typedef res_sendhookact (*res_send_rhook) (const struct sockaddr_in *__ns, const u_char *__query, int __querylen, u_char *__ans, int __anssiz, int *__resplen); /* * Global defines and variables for resolver stub. */ # define MAXNS 3 /* max # name servers we'll track */ # define MAXDFLSRCH 3 /* # default domain levels to try */ # define MAXDNSRCH 6 /* max # domains in search path */ # define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ # define RES_TIMEOUT 5 /* min. seconds between retries */ # define MAXRESOLVSORT 10 /* number of net to sort on */ # define RES_MAXNDOTS 15 /* should reflect bit field size */ # define RES_MAXRETRANS 30 /* only for resolv.conf/RES_OPTIONS */ # define RES_MAXRETRY 5 /* only for resolv.conf/RES_OPTIONS */ # define RES_DFLRETRY 2 /* Default #/tries. */ # define RES_MAXTIME 65535 /* Infinity, in milliseconds. */ struct __res_state { int retrans; /* retransmition time interval */ int retry; /* number of times to retransmit */ u_long options; /* option flags - see below. */ int nscount; /* number of name servers */ struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */ # define nsaddr nsaddr_list[0] /* for backward compatibility */ u_short id; /* current message id */ /* 2 byte hole here. */ char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ char defdname[256]; /* default domain (deprecated) */ u_long pfcode; /* RES_PRF_ flags - see below. */ unsigned ndots:4; /* threshold for initial abs. query */ unsigned nsort:4; /* number of elements in sort_list[] */ unsigned ipv6_unavail:1; /* connecting to IPv6 server failed */ unsigned unused:23; struct { struct in_addr addr; u_int32_t mask; } sort_list[MAXRESOLVSORT]; /* 4 byte hole here on 64-bit architectures. */ res_send_qhook __glibc_unused_qhook; res_send_rhook __glibc_unused_rhook; int res_h_errno; /* last one set for this context */ int _vcsock; /* PRIVATE: for res_send VC i/o */ u_int _flags; /* PRIVATE: see below */ /* 4 byte hole here on 64-bit architectures. */ union { char pad[52]; /* On an i386 this means 512b total. */ struct { u_int16_t nscount; u_int16_t nsmap[MAXNS]; int nssocks[MAXNS]; u_int16_t nscount6; u_int16_t nsinit; struct sockaddr_in6 *nsaddrs[MAXNS]; #ifdef _LIBC unsigned long long int __glibc_extension_index __attribute__((packed)); #else unsigned int __glibc_reserved[2]; #endif } _ext; } _u; }; typedef struct __res_state *res_state; # undef __need_res_state #endif #ifdef _RESOLV_H_ /* * Revision information. This is the release date in YYYYMMDD format. * It can change every day so the right thing to do with it is use it * in preprocessor commands such as "#if (__RES > 19931104)". Do not * compare for equality; rather, use it to determine whether your resolver * is new enough to contain a certain feature. */ #define __RES 19991006 /* * Resolver configuration file. * Normally not present, but may contain the address of the * inital name server(s) to query and the domain search list. */ #ifndef _PATH_RESCONF #define _PATH_RESCONF "/etc/resolv.conf" #endif struct res_sym { int number; /* Identifying number, like T_MX */ char * name; /* Its symbolic name, like "MX" */ char * humanname; /* Its fun name, like "mail exchanger" */ }; /* * Resolver flags (used to be discrete per-module statics ints). */ #define RES_F_VC 0x00000001 /* socket is TCP */ #define RES_F_CONN 0x00000002 /* socket is connected */ #define RES_F_EDNS0ERR 0x00000004 /* EDNS0 caused errors */ /* res_findzonecut() options */ #define RES_EXHAUSTIVE 0x00000001 /* always do all queries */ /* * Resolver options (keep these in synch with res_debug.c, please) */ #define RES_INIT 0x00000001 /* address initialized */ #define RES_DEBUG 0x00000002 /* print debug messages */ #define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/ #define RES_USEVC 0x00000008 /* use virtual circuit */ #define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */ #define RES_IGNTC 0x00000020 /* ignore trucation errors */ #define RES_RECURSE 0x00000040 /* recursion desired */ #define RES_DEFNAMES 0x00000080 /* use default domain name */ #define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */ #define RES_DNSRCH 0x00000200 /* search up local domain tree */ #define RES_INSECURE1 0x00000400 /* type 1 security disabled */ #define RES_INSECURE2 0x00000800 /* type 2 security disabled */ #define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */ #define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */ #define RES_ROTATE 0x00004000 /* rotate ns list after each query */ #define RES_NOCHECKNAME 0x00008000 /* do not check names for sanity. */ #define RES_KEEPTSIG 0x00010000 /* do not strip TSIG records */ #define RES_BLAST 0x00020000 /* blast all recursive servers */ #define RES_USEBSTRING 0x00040000 /* IPv6 reverse lookup with byte strings */ #define RES_NOIP6DOTINT 0x00080000 /* Do not use .ip6.int in IPv6 reverse lookup */ #define RES_USE_EDNS0 0x00100000 /* Use EDNS0. */ #define RES_SNGLKUP 0x00200000 /* one outstanding request at a time */ #define RES_SNGLKUPREOP 0x00400000 /* -"-, but open new socket for each request */ #define RES_USE_DNSSEC 0x00800000 /* use DNSSEC using OK bit in OPT */ #define RES_NOTLDQUERY 0x01000000 /* Do not look up unqualified name as a TLD. */ #define RES_NORELOAD 0x02000000 /* No automatic configuration reload. */ #define RES_DEFAULT (RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT) /* * Resolver "pfcode" values. Used by dig. */ #define RES_PRF_STATS 0x00000001 #define RES_PRF_UPDATE 0x00000002 #define RES_PRF_CLASS 0x00000004 #define RES_PRF_CMD 0x00000008 #define RES_PRF_QUES 0x00000010 #define RES_PRF_ANS 0x00000020 #define RES_PRF_AUTH 0x00000040 #define RES_PRF_ADD 0x00000080 #define RES_PRF_HEAD1 0x00000100 #define RES_PRF_HEAD2 0x00000200 #define RES_PRF_TTLID 0x00000400 #define RES_PRF_HEADX 0x00000800 #define RES_PRF_QUERY 0x00001000 #define RES_PRF_REPLY 0x00002000 #define RES_PRF_INIT 0x00004000 /* 0x00008000 */ /* Things involving an internal (static) resolver context. */ __BEGIN_DECLS extern struct __res_state *__res_state(void) __attribute__ ((__const__)); __END_DECLS #define _res (*__res_state()) #define fp_nquery __fp_nquery #define fp_query __fp_query #define hostalias __hostalias #define p_query __p_query #define res_close __res_close #define res_init __res_init #define res_isourserver __res_isourserver #define res_mkquery __res_mkquery #define res_query __res_query #define res_querydomain __res_querydomain #define res_search __res_search #define res_send __res_send __BEGIN_DECLS void fp_nquery (const unsigned char *, int, FILE *) __THROW; void fp_query (const unsigned char *, FILE *) __THROW; const char * hostalias (const char *) __THROW; void p_query (const unsigned char *) __THROW; void res_close (void) __THROW; int res_init (void) __THROW; int res_isourserver (const struct sockaddr_in *) __THROW; int res_mkquery (int, const char *, int, int, const unsigned char *, int, const unsigned char *, unsigned char *, int) __THROW; int res_query (const char *, int, int, unsigned char *, int) __THROW; int res_querydomain (const char *, const char *, int, int, unsigned char *, int) __THROW; int res_search (const char *, int, int, unsigned char *, int) __THROW; int res_send (const unsigned char *, int, unsigned char *, int) __THROW; __END_DECLS #define b64_ntop __b64_ntop #define b64_pton __b64_pton #define dn_comp __dn_comp #define dn_count_labels __dn_count_labels #define dn_expand __dn_expand #define dn_skipname __dn_skipname #define fp_resstat __fp_resstat #define loc_aton __loc_aton #define loc_ntoa __loc_ntoa #define p_cdname __p_cdname #define p_cdnname __p_cdnname #define p_class __p_class #define p_fqname __p_fqname #define p_fqnname __p_fqnname #define p_option __p_option #define p_secstodate __p_secstodate #define p_time __p_time #define p_type __p_type #define p_rcode __p_rcode #define putlong __putlong #define putshort __putshort #define res_dnok __res_dnok #define res_hnok __res_hnok #define res_hostalias __res_hostalias #define res_mailok __res_mailok #define res_nameinquery __res_nameinquery #define res_nclose __res_nclose #define res_ninit __res_ninit #define res_nmkquery __res_nmkquery #define res_nquery __res_nquery #define res_nquerydomain __res_nquerydomain #define res_nsearch __res_nsearch #define res_nsend __res_nsend #define res_ownok __res_ownok #define res_queriesmatch __res_queriesmatch #define res_randomid __res_randomid #define sym_ntop __sym_ntop #define sym_ntos __sym_ntos #define sym_ston __sym_ston __BEGIN_DECLS int res_hnok (const char *) __THROW; int res_ownok (const char *) __THROW; int res_mailok (const char *) __THROW; int res_dnok (const char *) __THROW; int sym_ston (const struct res_sym *, const char *, int *) __THROW; const char * sym_ntos (const struct res_sym *, int, int *) __THROW; const char * sym_ntop (const struct res_sym *, int, int *) __THROW; int b64_ntop (const unsigned char *, size_t, char *, size_t) __THROW; int b64_pton (char const *, unsigned char *, size_t) __THROW; int loc_aton (const char *__ascii, unsigned char *__binary) __THROW; const char * loc_ntoa (const unsigned char *__binary, char *__ascii) __THROW; int dn_skipname (const unsigned char *, const unsigned char *) __THROW; void putlong (uint32_t, unsigned char *) __THROW; void putshort (uint16_t, unsigned char *) __THROW; const char * p_class (int) __THROW; const char * p_time (uint32_t) __THROW; const char * p_type (int) __THROW; const char * p_rcode (int) __THROW; const unsigned char * p_cdnname (const unsigned char *, const unsigned char *, int, FILE *) __THROW; const unsigned char * p_cdname (const unsigned char *, const unsigned char *, FILE *) __THROW; const unsigned char * p_fqnname (const unsigned char *__cp, const unsigned char *__msg, int, char *, int) __THROW; const unsigned char * p_fqname (const unsigned char *, const unsigned char *, FILE *) __THROW; const char * p_option (unsigned long __option) __THROW; char * p_secstodate (unsigned long) __THROW; int dn_count_labels (const char *) __THROW; int dn_comp (const char *, unsigned char *, int, unsigned char **, unsigned char **) __THROW; int dn_expand (const unsigned char *, const unsigned char *, const unsigned char *, char *, int) __THROW; unsigned int res_randomid (void) __THROW; int res_nameinquery (const char *, int, int, const unsigned char *, const unsigned char *) __THROW; int res_queriesmatch (const unsigned char *, const unsigned char *, const unsigned char *, const unsigned char *) __THROW; /* Things involving a resolver context. */ int res_ninit (res_state) __THROW; void fp_resstat (const res_state, FILE *) __THROW; const char * res_hostalias (const res_state, const char *, char *, size_t) __THROW; int res_nquery (res_state, const char *, int, int, unsigned char *, int) __THROW; int res_nsearch (res_state, const char *, int, int, unsigned char *, int) __THROW; int res_nquerydomain (res_state, const char *, const char *, int, int, unsigned char *, int) __THROW; int res_nmkquery (res_state, int, const char *, int, int, const unsigned char *, int, const unsigned char *, unsigned char *, int) __THROW; int res_nsend (res_state, const unsigned char *, int, unsigned char *, int) __THROW; void res_nclose (res_state) __THROW; __END_DECLS #endif #endif /* !_RESOLV_H_ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������expat.h���������������������������������������������������������������������������������������������0000644�����������������00000121661�14763166027�0006061 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ #ifndef Expat_INCLUDED #define Expat_INCLUDED 1 #ifdef __VMS /* 0 1 2 3 0 1 2 3 1234567890123456789012345678901 1234567890123456789012345678901 */ #define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler #define XML_SetUnparsedEntityDeclHandler XML_SetUnparsedEntDeclHandler #define XML_SetStartNamespaceDeclHandler XML_SetStartNamespcDeclHandler #define XML_SetExternalEntityRefHandlerArg XML_SetExternalEntRefHandlerArg #endif #include <stdlib.h> #include "expat_external.h" #ifdef __cplusplus extern "C" { #endif struct XML_ParserStruct; typedef struct XML_ParserStruct *XML_Parser; /* Should this be defined using stdbool.h when C99 is available? */ typedef unsigned char XML_Bool; #define XML_TRUE ((XML_Bool) 1) #define XML_FALSE ((XML_Bool) 0) /* The XML_Status enum gives the possible return values for several API functions. The preprocessor #defines are included so this stanza can be added to code that still needs to support older versions of Expat 1.95.x: #ifndef XML_STATUS_OK #define XML_STATUS_OK 1 #define XML_STATUS_ERROR 0 #endif Otherwise, the #define hackery is quite ugly and would have been dropped. */ enum XML_Status { XML_STATUS_ERROR = 0, #define XML_STATUS_ERROR XML_STATUS_ERROR XML_STATUS_OK = 1, #define XML_STATUS_OK XML_STATUS_OK XML_STATUS_SUSPENDED = 2 #define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED }; enum XML_Error { XML_ERROR_NONE, XML_ERROR_NO_MEMORY, XML_ERROR_SYNTAX, XML_ERROR_NO_ELEMENTS, XML_ERROR_INVALID_TOKEN, XML_ERROR_UNCLOSED_TOKEN, XML_ERROR_PARTIAL_CHAR, XML_ERROR_TAG_MISMATCH, XML_ERROR_DUPLICATE_ATTRIBUTE, XML_ERROR_JUNK_AFTER_DOC_ELEMENT, XML_ERROR_PARAM_ENTITY_REF, XML_ERROR_UNDEFINED_ENTITY, XML_ERROR_RECURSIVE_ENTITY_REF, XML_ERROR_ASYNC_ENTITY, XML_ERROR_BAD_CHAR_REF, XML_ERROR_BINARY_ENTITY_REF, XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, XML_ERROR_MISPLACED_XML_PI, XML_ERROR_UNKNOWN_ENCODING, XML_ERROR_INCORRECT_ENCODING, XML_ERROR_UNCLOSED_CDATA_SECTION, XML_ERROR_EXTERNAL_ENTITY_HANDLING, XML_ERROR_NOT_STANDALONE, XML_ERROR_UNEXPECTED_STATE, XML_ERROR_ENTITY_DECLARED_IN_PE, XML_ERROR_FEATURE_REQUIRES_XML_DTD, XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING, /* Added in 1.95.7. */ XML_ERROR_UNBOUND_PREFIX, /* Added in 1.95.8. */ XML_ERROR_UNDECLARING_PREFIX, XML_ERROR_INCOMPLETE_PE, XML_ERROR_XML_DECL, XML_ERROR_TEXT_DECL, XML_ERROR_PUBLICID, XML_ERROR_SUSPENDED, XML_ERROR_NOT_SUSPENDED, XML_ERROR_ABORTED, XML_ERROR_FINISHED, XML_ERROR_SUSPEND_PE, /* Added in 2.0. */ XML_ERROR_RESERVED_PREFIX_XML, XML_ERROR_RESERVED_PREFIX_XMLNS, XML_ERROR_RESERVED_NAMESPACE_URI, /* Added in 2.2.1, backported to close CVE-2024-45490 */ XML_ERROR_INVALID_ARGUMENT }; enum XML_Content_Type { XML_CTYPE_EMPTY = 1, XML_CTYPE_ANY, XML_CTYPE_MIXED, XML_CTYPE_NAME, XML_CTYPE_CHOICE, XML_CTYPE_SEQ }; enum XML_Content_Quant { XML_CQUANT_NONE, XML_CQUANT_OPT, XML_CQUANT_REP, XML_CQUANT_PLUS }; /* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be XML_CQUANT_NONE, and the other fields will be zero or NULL. If type == XML_CTYPE_MIXED, then quant will be NONE or REP and numchildren will contain number of elements that may be mixed in and children point to an array of XML_Content cells that will be all of XML_CTYPE_NAME type with no quantification. If type == XML_CTYPE_NAME, then the name points to the name, and the numchildren field will be zero and children will be NULL. The quant fields indicates any quantifiers placed on the name. CHOICE and SEQ will have name NULL, the number of children in numchildren and children will point, recursively, to an array of XML_Content cells. The EMPTY, ANY, and MIXED types will only occur at top level. */ typedef struct XML_cp XML_Content; struct XML_cp { enum XML_Content_Type type; enum XML_Content_Quant quant; XML_Char * name; unsigned int numchildren; XML_Content * children; }; /* This is called for an element declaration. See above for description of the model argument. It's the caller's responsibility to free model when finished with it. */ typedef void (XMLCALL *XML_ElementDeclHandler) (void *userData, const XML_Char *name, XML_Content *model); XMLPARSEAPI(void) XML_SetElementDeclHandler(XML_Parser parser, XML_ElementDeclHandler eldecl); /* The Attlist declaration handler is called for *each* attribute. So a single Attlist declaration with multiple attributes declared will generate multiple calls to this handler. The "default" parameter may be NULL in the case of the "#IMPLIED" or "#REQUIRED" keyword. The "isrequired" parameter will be true and the default value will be NULL in the case of "#REQUIRED". If "isrequired" is true and default is non-NULL, then this is a "#FIXED" default. */ typedef void (XMLCALL *XML_AttlistDeclHandler) ( void *userData, const XML_Char *elname, const XML_Char *attname, const XML_Char *att_type, const XML_Char *dflt, int isrequired); XMLPARSEAPI(void) XML_SetAttlistDeclHandler(XML_Parser parser, XML_AttlistDeclHandler attdecl); /* The XML declaration handler is called for *both* XML declarations and text declarations. The way to distinguish is that the version parameter will be NULL for text declarations. The encoding parameter may be NULL for XML declarations. The standalone parameter will be -1, 0, or 1 indicating respectively that there was no standalone parameter in the declaration, that it was given as no, or that it was given as yes. */ typedef void (XMLCALL *XML_XmlDeclHandler) (void *userData, const XML_Char *version, const XML_Char *encoding, int standalone); XMLPARSEAPI(void) XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler xmldecl); typedef struct { void *(*malloc_fcn)(size_t size); void *(*realloc_fcn)(void *ptr, size_t size); void (*free_fcn)(void *ptr); } XML_Memory_Handling_Suite; /* Constructs a new parser; encoding is the encoding specified by the external protocol or NULL if there is none specified. */ XMLPARSEAPI(XML_Parser) XML_ParserCreate(const XML_Char *encoding); /* Constructs a new parser and namespace processor. Element type names and attribute names that belong to a namespace will be expanded; unprefixed attribute names are never expanded; unprefixed element type names are expanded only if there is a default namespace. The expanded name is the concatenation of the namespace URI, the namespace separator character, and the local part of the name. If the namespace separator is '\0' then the namespace URI and the local part will be concatenated without any separator. It is a programming error to use the separator '\0' with namespace triplets (see XML_SetReturnNSTriplet). */ XMLPARSEAPI(XML_Parser) XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); /* Constructs a new parser using the memory management suite referred to by memsuite. If memsuite is NULL, then use the standard library memory suite. If namespaceSeparator is non-NULL it creates a parser with namespace processing as described above. The character pointed at will serve as the namespace separator. All further memory operations used for the created parser will come from the given suite. */ XMLPARSEAPI(XML_Parser) XML_ParserCreate_MM(const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite, const XML_Char *namespaceSeparator); /* Prepare a parser object to be re-used. This is particularly valuable when memory allocation overhead is disproportionatly high, such as when a large number of small documnents need to be parsed. All handlers are cleared from the parser, except for the unknownEncodingHandler. The parser's external state is re-initialized except for the values of ns and ns_triplets. Added in Expat 1.95.3. */ XMLPARSEAPI(XML_Bool) XML_ParserReset(XML_Parser parser, const XML_Char *encoding); /* atts is array of name/value pairs, terminated by 0; names and values are 0 terminated. */ typedef void (XMLCALL *XML_StartElementHandler) (void *userData, const XML_Char *name, const XML_Char **atts); typedef void (XMLCALL *XML_EndElementHandler) (void *userData, const XML_Char *name); /* s is not 0 terminated. */ typedef void (XMLCALL *XML_CharacterDataHandler) (void *userData, const XML_Char *s, int len); /* target and data are 0 terminated */ typedef void (XMLCALL *XML_ProcessingInstructionHandler) ( void *userData, const XML_Char *target, const XML_Char *data); /* data is 0 terminated */ typedef void (XMLCALL *XML_CommentHandler) (void *userData, const XML_Char *data); typedef void (XMLCALL *XML_StartCdataSectionHandler) (void *userData); typedef void (XMLCALL *XML_EndCdataSectionHandler) (void *userData); /* This is called for any characters in the XML document for which there is no applicable handler. This includes both characters that are part of markup which is of a kind that is not reported (comments, markup declarations), or characters that are part of a construct which could be reported but for which no handler has been supplied. The characters are passed exactly as they were in the XML document except that they will be encoded in UTF-8 or UTF-16. Line boundaries are not normalized. Note that a byte order mark character is not passed to the default handler. There are no guarantees about how characters are divided between calls to the default handler: for example, a comment might be split between multiple calls. */ typedef void (XMLCALL *XML_DefaultHandler) (void *userData, const XML_Char *s, int len); /* This is called for the start of the DOCTYPE declaration, before any DTD or internal subset is parsed. */ typedef void (XMLCALL *XML_StartDoctypeDeclHandler) ( void *userData, const XML_Char *doctypeName, const XML_Char *sysid, const XML_Char *pubid, int has_internal_subset); /* This is called for the start of the DOCTYPE declaration when the closing > is encountered, but after processing any external subset. */ typedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData); /* This is called for entity declarations. The is_parameter_entity argument will be non-zero if the entity is a parameter entity, zero otherwise. For internal entities (<!ENTITY foo "bar">), value will be non-NULL and systemId, publicID, and notationName will be NULL. The value string is NOT nul-terminated; the length is provided in the value_length argument. Since it is legal to have zero-length values, do not use this argument to test for internal entities. For external entities, value will be NULL and systemId will be non-NULL. The publicId argument will be NULL unless a public identifier was provided. The notationName argument will have a non-NULL value only for unparsed entity declarations. Note that is_parameter_entity can't be changed to XML_Bool, since that would break binary compatibility. */ typedef void (XMLCALL *XML_EntityDeclHandler) ( void *userData, const XML_Char *entityName, int is_parameter_entity, const XML_Char *value, int value_length, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId, const XML_Char *notationName); XMLPARSEAPI(void) XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler); /* OBSOLETE -- OBSOLETE -- OBSOLETE This handler has been superceded by the EntityDeclHandler above. It is provided here for backward compatibility. This is called for a declaration of an unparsed (NDATA) entity. The base argument is whatever was set by XML_SetBase. The entityName, systemId and notationName arguments will never be NULL. The other arguments may be. */ typedef void (XMLCALL *XML_UnparsedEntityDeclHandler) ( void *userData, const XML_Char *entityName, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId, const XML_Char *notationName); /* This is called for a declaration of notation. The base argument is whatever was set by XML_SetBase. The notationName will never be NULL. The other arguments can be. */ typedef void (XMLCALL *XML_NotationDeclHandler) ( void *userData, const XML_Char *notationName, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId); /* When namespace processing is enabled, these are called once for each namespace declaration. The call to the start and end element handlers occur between the calls to the start and end namespace declaration handlers. For an xmlns attribute, prefix will be NULL. For an xmlns="" attribute, uri will be NULL. */ typedef void (XMLCALL *XML_StartNamespaceDeclHandler) ( void *userData, const XML_Char *prefix, const XML_Char *uri); typedef void (XMLCALL *XML_EndNamespaceDeclHandler) ( void *userData, const XML_Char *prefix); /* This is called if the document is not standalone, that is, it has an external subset or a reference to a parameter entity, but does not have standalone="yes". If this handler returns XML_STATUS_ERROR, then processing will not continue, and the parser will return a XML_ERROR_NOT_STANDALONE error. If parameter entity parsing is enabled, then in addition to the conditions above this handler will only be called if the referenced entity was actually read. */ typedef int (XMLCALL *XML_NotStandaloneHandler) (void *userData); /* This is called for a reference to an external parsed general entity. The referenced entity is not automatically parsed. The application can parse it immediately or later using XML_ExternalEntityParserCreate. The parser argument is the parser parsing the entity containing the reference; it can be passed as the parser argument to XML_ExternalEntityParserCreate. The systemId argument is the system identifier as specified in the entity declaration; it will not be NULL. The base argument is the system identifier that should be used as the base for resolving systemId if systemId was relative; this is set by XML_SetBase; it may be NULL. The publicId argument is the public identifier as specified in the entity declaration, or NULL if none was specified; the whitespace in the public identifier will have been normalized as required by the XML spec. The context argument specifies the parsing context in the format expected by the context argument to XML_ExternalEntityParserCreate; context is valid only until the handler returns, so if the referenced entity is to be parsed later, it must be copied. context is NULL only when the entity is a parameter entity. The handler should return XML_STATUS_ERROR if processing should not continue because of a fatal error in the handling of the external entity. In this case the calling parser will return an XML_ERROR_EXTERNAL_ENTITY_HANDLING error. Note that unlike other handlers the first argument is the parser, not userData. */ typedef int (XMLCALL *XML_ExternalEntityRefHandler) ( XML_Parser parser, const XML_Char *context, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId); /* This is called in two situations: 1) An entity reference is encountered for which no declaration has been read *and* this is not an error. 2) An internal entity reference is read, but not expanded, because XML_SetDefaultHandler has been called. Note: skipped parameter entities in declarations and skipped general entities in attribute values cannot be reported, because the event would be out of sync with the reporting of the declarations or attribute values */ typedef void (XMLCALL *XML_SkippedEntityHandler) ( void *userData, const XML_Char *entityName, int is_parameter_entity); /* This structure is filled in by the XML_UnknownEncodingHandler to provide information to the parser about encodings that are unknown to the parser. The map[b] member gives information about byte sequences whose first byte is b. If map[b] is c where c is >= 0, then b by itself encodes the Unicode scalar value c. If map[b] is -1, then the byte sequence is malformed. If map[b] is -n, where n >= 2, then b is the first byte of an n-byte sequence that encodes a single Unicode scalar value. The data member will be passed as the first argument to the convert function. The convert function is used to convert multibyte sequences; s will point to a n-byte sequence where map[(unsigned char)*s] == -n. The convert function must return the Unicode scalar value represented by this byte sequence or -1 if the byte sequence is malformed. The convert function may be NULL if the encoding is a single-byte encoding, that is if map[b] >= -1 for all bytes b. When the parser is finished with the encoding, then if release is not NULL, it will call release passing it the data member; once release has been called, the convert function will not be called again. Expat places certain restrictions on the encodings that are supported using this mechanism. 1. Every ASCII character that can appear in a well-formed XML document, other than the characters $@\^`{}~ must be represented by a single byte, and that byte must be the same byte that represents that character in ASCII. 2. No character may require more than 4 bytes to encode. 3. All characters encoded must have Unicode scalar values <= 0xFFFF, (i.e., characters that would be encoded by surrogates in UTF-16 are not allowed). Note that this restriction doesn't apply to the built-in support for UTF-8 and UTF-16. 4. No Unicode character may be encoded by more than one distinct sequence of bytes. */ typedef struct { int map[256]; void *data; int (XMLCALL *convert)(void *data, const char *s); void (XMLCALL *release)(void *data); } XML_Encoding; /* This is called for an encoding that is unknown to the parser. The encodingHandlerData argument is that which was passed as the second argument to XML_SetUnknownEncodingHandler. The name argument gives the name of the encoding as specified in the encoding declaration. If the callback can provide information about the encoding, it must fill in the XML_Encoding structure, and return XML_STATUS_OK. Otherwise it must return XML_STATUS_ERROR. If info does not describe a suitable encoding, then the parser will return an XML_UNKNOWN_ENCODING error. */ typedef int (XMLCALL *XML_UnknownEncodingHandler) ( void *encodingHandlerData, const XML_Char *name, XML_Encoding *info); XMLPARSEAPI(void) XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end); XMLPARSEAPI(void) XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler handler); XMLPARSEAPI(void) XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler handler); XMLPARSEAPI(void) XML_SetCharacterDataHandler(XML_Parser parser, XML_CharacterDataHandler handler); XMLPARSEAPI(void) XML_SetProcessingInstructionHandler(XML_Parser parser, XML_ProcessingInstructionHandler handler); XMLPARSEAPI(void) XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler); XMLPARSEAPI(void) XML_SetCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end); XMLPARSEAPI(void) XML_SetStartCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start); XMLPARSEAPI(void) XML_SetEndCdataSectionHandler(XML_Parser parser, XML_EndCdataSectionHandler end); /* This sets the default handler and also inhibits expansion of internal entities. These entity references will be passed to the default handler, or to the skipped entity handler, if one is set. */ XMLPARSEAPI(void) XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler); /* This sets the default handler but does not inhibit expansion of internal entities. The entity reference will not be passed to the default handler. */ XMLPARSEAPI(void) XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler); XMLPARSEAPI(void) XML_SetDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end); XMLPARSEAPI(void) XML_SetStartDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start); XMLPARSEAPI(void) XML_SetEndDoctypeDeclHandler(XML_Parser parser, XML_EndDoctypeDeclHandler end); XMLPARSEAPI(void) XML_SetUnparsedEntityDeclHandler(XML_Parser parser, XML_UnparsedEntityDeclHandler handler); XMLPARSEAPI(void) XML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler); XMLPARSEAPI(void) XML_SetNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end); XMLPARSEAPI(void) XML_SetStartNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start); XMLPARSEAPI(void) XML_SetEndNamespaceDeclHandler(XML_Parser parser, XML_EndNamespaceDeclHandler end); XMLPARSEAPI(void) XML_SetNotStandaloneHandler(XML_Parser parser, XML_NotStandaloneHandler handler); XMLPARSEAPI(void) XML_SetExternalEntityRefHandler(XML_Parser parser, XML_ExternalEntityRefHandler handler); /* If a non-NULL value for arg is specified here, then it will be passed as the first argument to the external entity ref handler instead of the parser object. */ XMLPARSEAPI(void) XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg); XMLPARSEAPI(void) XML_SetSkippedEntityHandler(XML_Parser parser, XML_SkippedEntityHandler handler); XMLPARSEAPI(void) XML_SetUnknownEncodingHandler(XML_Parser parser, XML_UnknownEncodingHandler handler, void *encodingHandlerData); /* This can be called within a handler for a start element, end element, processing instruction or character data. It causes the corresponding markup to be passed to the default handler. */ XMLPARSEAPI(void) XML_DefaultCurrent(XML_Parser parser); /* If do_nst is non-zero, and namespace processing is in effect, and a name has a prefix (i.e. an explicit namespace qualifier) then that name is returned as a triplet in a single string separated by the separator character specified when the parser was created: URI + sep + local_name + sep + prefix. If do_nst is zero, then namespace information is returned in the default manner (URI + sep + local_name) whether or not the name has a prefix. Note: Calling XML_SetReturnNSTriplet after XML_Parse or XML_ParseBuffer has no effect. */ XMLPARSEAPI(void) XML_SetReturnNSTriplet(XML_Parser parser, int do_nst); /* This value is passed as the userData argument to callbacks. */ XMLPARSEAPI(void) XML_SetUserData(XML_Parser parser, void *userData); /* Returns the last value set by XML_SetUserData or NULL. */ #define XML_GetUserData(parser) (*(void **)(parser)) /* This is equivalent to supplying an encoding argument to XML_ParserCreate. On success XML_SetEncoding returns non-zero, zero otherwise. Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer has no effect and returns XML_STATUS_ERROR. */ XMLPARSEAPI(enum XML_Status) XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); /* If this function is called, then the parser will be passed as the first argument to callbacks instead of userData. The userData will still be accessible using XML_GetUserData. */ XMLPARSEAPI(void) XML_UseParserAsHandlerArg(XML_Parser parser); /* If useDTD == XML_TRUE is passed to this function, then the parser will assume that there is an external subset, even if none is specified in the document. In such a case the parser will call the externalEntityRefHandler with a value of NULL for the systemId argument (the publicId and context arguments will be NULL as well). Note: For the purpose of checking WFC: Entity Declared, passing useDTD == XML_TRUE will make the parser behave as if the document had a DTD with an external subset. Note: If this function is called, then this must be done before the first call to XML_Parse or XML_ParseBuffer, since it will have no effect after that. Returns XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING. Note: If the document does not have a DOCTYPE declaration at all, then startDoctypeDeclHandler and endDoctypeDeclHandler will not be called, despite an external subset being parsed. Note: If XML_DTD is not defined when Expat is compiled, returns XML_ERROR_FEATURE_REQUIRES_XML_DTD. Note: If parser == NULL, returns XML_ERROR_INVALID_ARGUMENT. */ XMLPARSEAPI(enum XML_Error) XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); /* Sets the base to be used for resolving relative URIs in system identifiers in declarations. Resolving relative identifiers is left to the application: this value will be passed through as the base argument to the XML_ExternalEntityRefHandler, XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base argument will be copied. Returns XML_STATUS_ERROR if out of memory, XML_STATUS_OK otherwise. */ XMLPARSEAPI(enum XML_Status) XML_SetBase(XML_Parser parser, const XML_Char *base); XMLPARSEAPI(const XML_Char *) XML_GetBase(XML_Parser parser); /* Returns the number of the attribute/value pairs passed in last call to the XML_StartElementHandler that were specified in the start-tag rather than defaulted. Each attribute/value pair counts as 2; thus this correspondds to an index into the atts array passed to the XML_StartElementHandler. */ XMLPARSEAPI(int) XML_GetSpecifiedAttributeCount(XML_Parser parser); /* Returns the index of the ID attribute passed in the last call to XML_StartElementHandler, or -1 if there is no ID attribute. Each attribute/value pair counts as 2; thus this correspondds to an index into the atts array passed to the XML_StartElementHandler. */ XMLPARSEAPI(int) XML_GetIdAttributeIndex(XML_Parser parser); #ifdef XML_ATTR_INFO /* Source file byte offsets for the start and end of attribute names and values. The value indices are exclusive of surrounding quotes; thus in a UTF-8 source file an attribute value of "blah" will yield: info->valueEnd - info->valueStart = 4 bytes. */ typedef struct { XML_Index nameStart; /* Offset to beginning of the attribute name. */ XML_Index nameEnd; /* Offset after the attribute name's last byte. */ XML_Index valueStart; /* Offset to beginning of the attribute value. */ XML_Index valueEnd; /* Offset after the attribute value's last byte. */ } XML_AttrInfo; /* Returns an array of XML_AttrInfo structures for the attribute/value pairs passed in last call to the XML_StartElementHandler that were specified in the start-tag rather than defaulted. Each attribute/value pair counts as 1; thus the number of entries in the array is XML_GetSpecifiedAttributeCount(parser) / 2. */ XMLPARSEAPI(const XML_AttrInfo *) XML_GetAttributeInfo(XML_Parser parser); #endif /* Parses some input. Returns XML_STATUS_ERROR if a fatal error is detected. The last call to XML_Parse must have isFinal true; len may be zero for this call (or any other). Though the return values for these functions has always been described as a Boolean value, the implementation, at least for the 1.95.x series, has always returned exactly one of the XML_Status values. */ XMLPARSEAPI(enum XML_Status) XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); XMLPARSEAPI(void *) XML_GetBuffer(XML_Parser parser, int len); XMLPARSEAPI(enum XML_Status) XML_ParseBuffer(XML_Parser parser, int len, int isFinal); /* Stops parsing, causing XML_Parse() or XML_ParseBuffer() to return. Must be called from within a call-back handler, except when aborting (resumable = 0) an already suspended parser. Some call-backs may still follow because they would otherwise get lost. Examples: - endElementHandler() for empty elements when stopped in startElementHandler(), - endNameSpaceDeclHandler() when stopped in endElementHandler(), and possibly others. Can be called from most handlers, including DTD related call-backs, except when parsing an external parameter entity and resumable != 0. Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise. Possible error codes: - XML_ERROR_SUSPENDED: when suspending an already suspended parser. - XML_ERROR_FINISHED: when the parser has already finished. - XML_ERROR_SUSPEND_PE: when suspending while parsing an external PE. When resumable != 0 (true) then parsing is suspended, that is, XML_Parse() and XML_ParseBuffer() return XML_STATUS_SUSPENDED. Otherwise, parsing is aborted, that is, XML_Parse() and XML_ParseBuffer() return XML_STATUS_ERROR with error code XML_ERROR_ABORTED. *Note*: This will be applied to the current parser instance only, that is, if there is a parent parser then it will continue parsing when the externalEntityRefHandler() returns. It is up to the implementation of the externalEntityRefHandler() to call XML_StopParser() on the parent parser (recursively), if one wants to stop parsing altogether. When suspended, parsing can be resumed by calling XML_ResumeParser(). */ XMLPARSEAPI(enum XML_Status) XML_StopParser(XML_Parser parser, XML_Bool resumable); /* Resumes parsing after it has been suspended with XML_StopParser(). Must not be called from within a handler call-back. Returns same status codes as XML_Parse() or XML_ParseBuffer(). Additional error code XML_ERROR_NOT_SUSPENDED possible. *Note*: This must be called on the most deeply nested child parser instance first, and on its parent parser only after the child parser has finished, to be applied recursively until the document entity's parser is restarted. That is, the parent parser will not resume by itself and it is up to the application to call XML_ResumeParser() on it at the appropriate moment. */ XMLPARSEAPI(enum XML_Status) XML_ResumeParser(XML_Parser parser); enum XML_Parsing { XML_INITIALIZED, XML_PARSING, XML_FINISHED, XML_SUSPENDED }; typedef struct { enum XML_Parsing parsing; XML_Bool finalBuffer; } XML_ParsingStatus; /* Returns status of parser with respect to being initialized, parsing, finished, or suspended and processing the final buffer. XXX XML_Parse() and XML_ParseBuffer() should return XML_ParsingStatus, XXX with XML_FINISHED_OK or XML_FINISHED_ERROR replacing XML_FINISHED */ XMLPARSEAPI(void) XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status); /* Creates an XML_Parser object that can parse an external general entity; context is a '\0'-terminated string specifying the parse context; encoding is a '\0'-terminated string giving the name of the externally specified encoding, or NULL if there is no externally specified encoding. The context string consists of a sequence of tokens separated by formfeeds (\f); a token consisting of a name specifies that the general entity of the name is open; a token of the form prefix=uri specifies the namespace for a particular prefix; a token of the form =uri specifies the default namespace. This can be called at any point after the first call to an ExternalEntityRefHandler so longer as the parser has not yet been freed. The new parser is completely independent and may safely be used in a separate thread. The handlers and userData are initialized from the parser argument. Returns NULL if out of memory. Otherwise returns a new XML_Parser object. */ XMLPARSEAPI(XML_Parser) XML_ExternalEntityParserCreate(XML_Parser parser, const XML_Char *context, const XML_Char *encoding); enum XML_ParamEntityParsing { XML_PARAM_ENTITY_PARSING_NEVER, XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, XML_PARAM_ENTITY_PARSING_ALWAYS }; /* Controls parsing of parameter entities (including the external DTD subset). If parsing of parameter entities is enabled, then references to external parameter entities (including the external DTD subset) will be passed to the handler set with XML_SetExternalEntityRefHandler. The context passed will be 0. Unlike external general entities, external parameter entities can only be parsed synchronously. If the external parameter entity is to be parsed, it must be parsed during the call to the external entity ref handler: the complete sequence of XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and XML_ParserFree calls must be made during this call. After XML_ExternalEntityParserCreate has been called to create the parser for the external parameter entity (context must be 0 for this call), it is illegal to make any calls on the old parser until XML_ParserFree has been called on the newly created parser. If the library has been compiled without support for parameter entity parsing (ie without XML_DTD being defined), then XML_SetParamEntityParsing will return 0 if parsing of parameter entities is requested; otherwise it will return non-zero. Note: If XML_SetParamEntityParsing is called after XML_Parse or XML_ParseBuffer, then it has no effect and will always return 0. */ XMLPARSEAPI(int) XML_SetParamEntityParsing(XML_Parser parser, enum XML_ParamEntityParsing parsing); /* Sets the hash salt to use for internal hash calculations. Helps in preventing DoS attacks based on predicting hash function behavior. This must be called before parsing is started. Returns 1 if successful, 0 when called after parsing has started. */ XMLPARSEAPI(int) XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt); /* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then XML_GetErrorCode returns information about the error. */ XMLPARSEAPI(enum XML_Error) XML_GetErrorCode(XML_Parser parser); /* These functions return information about the current parse location. They may be called from any callback called to report some parse event; in this case the location is the location of the first of the sequence of characters that generated the event. When called from callbacks generated by declarations in the document prologue, the location identified isn't as neatly defined, but will be within the relevant markup. When called outside of the callback functions, the position indicated will be just past the last parse event (regardless of whether there was an associated callback). They may also be called after returning from a call to XML_Parse or XML_ParseBuffer. If the return value is XML_STATUS_ERROR then the location is the location of the character at which the error was detected; otherwise the location is the location of the last parse event, as described above. */ XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser); XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser); XMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex(XML_Parser parser); /* Return the number of bytes in the current event. Returns 0 if the event is in an internal entity. */ XMLPARSEAPI(int) XML_GetCurrentByteCount(XML_Parser parser); /* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets the integer pointed to by offset to the offset within this buffer of the current parse position, and sets the integer pointed to by size to the size of this buffer (the number of input bytes). Otherwise returns a NULL pointer. Also returns a NULL pointer if a parse isn't active. NOTE: The character pointer returned should not be used outside the handler that makes the call. */ XMLPARSEAPI(const char *) XML_GetInputContext(XML_Parser parser, int *offset, int *size); /* For backwards compatibility with previous versions. */ #define XML_GetErrorLineNumber XML_GetCurrentLineNumber #define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber #define XML_GetErrorByteIndex XML_GetCurrentByteIndex /* Frees the content model passed to the element declaration handler */ XMLPARSEAPI(void) XML_FreeContentModel(XML_Parser parser, XML_Content *model); /* Exposing the memory handling functions used in Expat */ XMLPARSEAPI(void *) XML_MemMalloc(XML_Parser parser, size_t size); XMLPARSEAPI(void *) XML_MemRealloc(XML_Parser parser, void *ptr, size_t size); XMLPARSEAPI(void) XML_MemFree(XML_Parser parser, void *ptr); /* Frees memory used by the parser. */ XMLPARSEAPI(void) XML_ParserFree(XML_Parser parser); /* Returns a string describing the error. */ XMLPARSEAPI(const XML_LChar *) XML_ErrorString(enum XML_Error code); /* Return a string containing the version number of this expat */ XMLPARSEAPI(const XML_LChar *) XML_ExpatVersion(void); typedef struct { int major; int minor; int micro; } XML_Expat_Version; /* Return an XML_Expat_Version structure containing numeric version number information for this version of expat. */ XMLPARSEAPI(XML_Expat_Version) XML_ExpatVersionInfo(void); /* Added in Expat 1.95.5. */ enum XML_FeatureEnum { XML_FEATURE_END = 0, XML_FEATURE_UNICODE, XML_FEATURE_UNICODE_WCHAR_T, XML_FEATURE_DTD, XML_FEATURE_CONTEXT_BYTES, XML_FEATURE_MIN_SIZE, XML_FEATURE_SIZEOF_XML_CHAR, XML_FEATURE_SIZEOF_XML_LCHAR, XML_FEATURE_NS, XML_FEATURE_LARGE_SIZE, XML_FEATURE_ATTR_INFO /* Additional features must be added to the end of this enum. */ }; typedef struct { enum XML_FeatureEnum feature; const XML_LChar *name; long int value; } XML_Feature; XMLPARSEAPI(const XML_Feature *) XML_GetFeatureList(void); /* Expat follows the GNU/Linux convention of odd number minor version for beta/development releases and even number minor version for stable releases. Micro is bumped with each release, and set to 0 with each change to major or minor version. */ #define XML_MAJOR_VERSION 2 #define XML_MINOR_VERSION 1 #define XML_MICRO_VERSION 0 #ifdef __cplusplus } #endif #endif /* not Expat_INCLUDED */ �������������������������������������������������������������������������������gnu/stubs.h�����������������������������������������������������������������������������������������0000644�����������������00000000600�14763166027�0006656 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* This file is automatically generated. This file selects the right generated file of `__stub_FUNCTION' macros based on the architecture being compiled for. */ #if !defined __x86_64__ # include <gnu/stubs-32.h> #endif #if defined __x86_64__ && defined __LP64__ # include <gnu/stubs-64.h> #endif #if defined __x86_64__ && defined __ILP32__ # include <gnu/stubs-x32.h> #endif ��������������������������������������������������������������������������������������������������������������������������������gnu/lib-names.h�������������������������������������������������������������������������������������0000644�����������������00000011640�14763166027�0007373 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* This file is automatically generated. It defines macros to allow user program to find the shared library files which come as part of GNU libc. */ #ifndef __GNU_LIB_NAMES_H #define __GNU_LIB_NAMES_H 1 #if !defined __x86_64__ # define LD_LINUX_SO "ld-linux.so.2" # define LD_SO "ld-linux.so.2" # define LIBANL_SO "libanl.so.1" # define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" # define LIBCIDN_SO "libcidn.so.1" # define LIBCRYPT_SO "libcrypt.so.1" # define LIBC_SO "libc.so.6" # define LIBDL_SO "libdl.so.2" # define LIBGCC_S_SO "libgcc_s.so.1" # define LIBM_SO "libm.so.6" # define LIBNSL_SO "libnsl.so.1" # define LIBNSS_COMPAT_SO "libnss_compat.so.2" # define LIBNSS_DB_SO "libnss_db.so.2" # define LIBNSS_DNS_SO "libnss_dns.so.2" # define LIBNSS_FILES_SO "libnss_files.so.2" # define LIBNSS_HESIOD_SO "libnss_hesiod.so.2" # define LIBNSS_LDAP_SO "libnss_ldap.so.2" # define LIBNSS_NISPLUS_SO "libnss_nisplus.so.2" # define LIBNSS_NIS_SO "libnss_nis.so.2" # define LIBNSS_TEST1_SO "libnss_test1.so.2" # define LIBNSS_TEST2_SO "libnss_test2.so.2" # define LIBPTHREAD_SO "libpthread.so.0" # define LIBRESOLV_SO "libresolv.so.2" # define LIBRTKAIO_SO "librtkaio.so.1" # define LIBRT_SO "librt.so.1" # define LIBTHREAD_DB_SO "libthread_db.so.1" # define LIBUTIL_SO "libutil.so.1" #endif #if defined __x86_64__ && defined __LP64__ # define LD_LINUX_X86_64_SO "ld-linux-x86-64.so.2" # define LD_SO "ld-linux-x86-64.so.2" # define LIBANL_SO "libanl.so.1" # define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" # define LIBCIDN_SO "libcidn.so.1" # define LIBCRYPT_SO "libcrypt.so.1" # define LIBC_SO "libc.so.6" # define LIBDL_SO "libdl.so.2" # define LIBGCC_S_SO "libgcc_s.so.1" # define LIBM_SO "libm.so.6" # define LIBNSL_SO "libnsl.so.1" # define LIBNSS_COMPAT_SO "libnss_compat.so.2" # define LIBNSS_DB_SO "libnss_db.so.2" # define LIBNSS_DNS_SO "libnss_dns.so.2" # define LIBNSS_FILES_SO "libnss_files.so.2" # define LIBNSS_HESIOD_SO "libnss_hesiod.so.2" # define LIBNSS_LDAP_SO "libnss_ldap.so.2" # define LIBNSS_NISPLUS_SO "libnss_nisplus.so.2" # define LIBNSS_NIS_SO "libnss_nis.so.2" # define LIBNSS_TEST1_SO "libnss_test1.so.2" # define LIBNSS_TEST2_SO "libnss_test2.so.2" # define LIBPTHREAD_SO "libpthread.so.0" # define LIBRESOLV_SO "libresolv.so.2" # define LIBRTKAIO_SO "librtkaio.so.1" # define LIBRT_SO "librt.so.1" # define LIBTHREAD_DB_SO "libthread_db.so.1" # define LIBUTIL_SO "libutil.so.1" #endif #if defined __x86_64__ && defined __ILP32__ # define LD_LINUX_X32_SO "ld-linux-x32.so.2" # define LD_SO "ld-linux-x32.so.2" # define LIBANL_SO "libanl.so.1" # define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" # define LIBCIDN_SO "libcidn.so.1" # define LIBCRYPT_SO "libcrypt.so.1" # define LIBC_SO "libc.so.6" # define LIBDL_SO "libdl.so.2" # define LIBGCC_S_SO "libgcc_s.so.1" # define LIBM_SO "libm.so.6" # define LIBNSL_SO "libnsl.so.1" # define LIBNSS_COMPAT_SO "libnss_compat.so.2" # define LIBNSS_DB_SO "libnss_db.so.2" # define LIBNSS_DNS_SO "libnss_dns.so.2" # define LIBNSS_FILES_SO "libnss_files.so.2" # define LIBNSS_HESIOD_SO "libnss_hesiod.so.2" # define LIBNSS_LDAP_SO "libnss_ldap.so.2" # define LIBNSS_NISPLUS_SO "libnss_nisplus.so.2" # define LIBNSS_NIS_SO "libnss_nis.so.2" # define LIBNSS_TEST1_SO "libnss_test1.so.2" # define LIBNSS_TEST2_SO "libnss_test2.so.2" # define LIBPTHREAD_SO "libpthread.so.0" # define LIBRESOLV_SO "libresolv.so.2" # define LIBRTKAIO_SO "librtkaio.so.1" # define LIBRT_SO "librt.so.1" # define LIBTHREAD_DB_SO "libthread_db.so.1" # define LIBUTIL_SO "libutil.so.1" #endif #endif /* gnu/lib-names.h */ ������������������������������������������������������������������������������������������������gnu/stubs-64.h��������������������������������������������������������������������������������������0000644�����������������00000001134�14763166027�0007110 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* This file is automatically generated. It defines a symbol `__stub_FUNCTION' for each function in the C library which is a stub, meaning it will fail every time called, usually setting errno to ENOSYS. */ #ifdef _LIBC #error Applications may not define the macro _LIBC #endif #define __stub_bdflush #define __stub_chflags #define __stub_fattach #define __stub_fchflags #define __stub_fdetach #define __stub_getmsg #define __stub_gtty #define __stub_lchmod #define __stub_putmsg #define __stub_revoke #define __stub_setlogin #define __stub_sigreturn #define __stub_sstk #define __stub_stty ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gnu/libc-version.h����������������������������������������������������������������������������������0000644�����������������00000002366�14763166027�0010125 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Interface to GNU libc specific functions for version information. Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _GNU_LIBC_VERSION_H #define _GNU_LIBC_VERSION_H 1 #include <features.h> __BEGIN_DECLS /* Return string describing release status of currently running GNU libc. */ extern const char *gnu_get_libc_release (void) __THROW; /* Return string describing version of currently running GNU libc. */ extern const char *gnu_get_libc_version (void) __THROW; __END_DECLS #endif /* gnu/libc-version.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/etnaviv_drm.h�����������������������������������������������������������������������������������0000644�����������������00000026123�14763166027�0010035 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2015 Etnaviv Project * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. * * 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, see <http://www.gnu.org/licenses/>. */ #ifndef __ETNAVIV_DRM_H__ #define __ETNAVIV_DRM_H__ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* Please note that modifications to all structs defined here are * subject to backwards-compatibility constraints: * 1) Do not use pointers, use __u64 instead for 32 bit / 64 bit * user/kernel compatibility * 2) Keep fields aligned to their size * 3) Because of how drm_ioctl() works, we can add new fields at * the end of an ioctl if some care is taken: drm_ioctl() will * zero out the new fields at the tail of the ioctl, so a zero * value should have a backwards compatible meaning. And for * output params, userspace won't see the newly added output * fields.. so that has to be somehow ok. */ /* timeouts are specified in clock-monotonic absolute times (to simplify * restarting interrupted ioctls). The following struct is logically the * same as 'struct timespec' but 32/64b ABI safe. */ struct drm_etnaviv_timespec { __s64 tv_sec; /* seconds */ __s64 tv_nsec; /* nanoseconds */ }; #define ETNAVIV_PARAM_GPU_MODEL 0x01 #define ETNAVIV_PARAM_GPU_REVISION 0x02 #define ETNAVIV_PARAM_GPU_FEATURES_0 0x03 #define ETNAVIV_PARAM_GPU_FEATURES_1 0x04 #define ETNAVIV_PARAM_GPU_FEATURES_2 0x05 #define ETNAVIV_PARAM_GPU_FEATURES_3 0x06 #define ETNAVIV_PARAM_GPU_FEATURES_4 0x07 #define ETNAVIV_PARAM_GPU_FEATURES_5 0x08 #define ETNAVIV_PARAM_GPU_FEATURES_6 0x09 #define ETNAVIV_PARAM_GPU_FEATURES_7 0x0a #define ETNAVIV_PARAM_GPU_FEATURES_8 0x0b #define ETNAVIV_PARAM_GPU_FEATURES_9 0x0c #define ETNAVIV_PARAM_GPU_FEATURES_10 0x0d #define ETNAVIV_PARAM_GPU_FEATURES_11 0x0e #define ETNAVIV_PARAM_GPU_FEATURES_12 0x0f #define ETNAVIV_PARAM_GPU_STREAM_COUNT 0x10 #define ETNAVIV_PARAM_GPU_REGISTER_MAX 0x11 #define ETNAVIV_PARAM_GPU_THREAD_COUNT 0x12 #define ETNAVIV_PARAM_GPU_VERTEX_CACHE_SIZE 0x13 #define ETNAVIV_PARAM_GPU_SHADER_CORE_COUNT 0x14 #define ETNAVIV_PARAM_GPU_PIXEL_PIPES 0x15 #define ETNAVIV_PARAM_GPU_VERTEX_OUTPUT_BUFFER_SIZE 0x16 #define ETNAVIV_PARAM_GPU_BUFFER_SIZE 0x17 #define ETNAVIV_PARAM_GPU_INSTRUCTION_COUNT 0x18 #define ETNAVIV_PARAM_GPU_NUM_CONSTANTS 0x19 #define ETNAVIV_PARAM_GPU_NUM_VARYINGS 0x1a #define ETNA_MAX_PIPES 4 struct drm_etnaviv_param { __u32 pipe; /* in */ __u32 param; /* in, ETNAVIV_PARAM_x */ __u64 value; /* out (get_param) or in (set_param) */ }; /* * GEM buffers: */ #define ETNA_BO_CACHE_MASK 0x000f0000 /* cache modes */ #define ETNA_BO_CACHED 0x00010000 #define ETNA_BO_WC 0x00020000 #define ETNA_BO_UNCACHED 0x00040000 /* map flags */ #define ETNA_BO_FORCE_MMU 0x00100000 struct drm_etnaviv_gem_new { __u64 size; /* in */ __u32 flags; /* in, mask of ETNA_BO_x */ __u32 handle; /* out */ }; struct drm_etnaviv_gem_info { __u32 handle; /* in */ __u32 pad; __u64 offset; /* out, offset to pass to mmap() */ }; #define ETNA_PREP_READ 0x01 #define ETNA_PREP_WRITE 0x02 #define ETNA_PREP_NOSYNC 0x04 struct drm_etnaviv_gem_cpu_prep { __u32 handle; /* in */ __u32 op; /* in, mask of ETNA_PREP_x */ struct drm_etnaviv_timespec timeout; /* in */ }; struct drm_etnaviv_gem_cpu_fini { __u32 handle; /* in */ __u32 flags; /* in, placeholder for now, no defined values */ }; /* * Cmdstream Submission: */ /* The value written into the cmdstream is logically: * relocbuf->gpuaddr + reloc_offset * * NOTE that reloc's must be sorted by order of increasing submit_offset, * otherwise EINVAL. */ struct drm_etnaviv_gem_submit_reloc { __u32 submit_offset; /* in, offset from submit_bo */ __u32 reloc_idx; /* in, index of reloc_bo buffer */ __u64 reloc_offset; /* in, offset from start of reloc_bo */ __u32 flags; /* in, placeholder for now, no defined values */ }; /* Each buffer referenced elsewhere in the cmdstream submit (ie. the * cmdstream buffer(s) themselves or reloc entries) has one (and only * one) entry in the submit->bos[] table. * * As a optimization, the current buffer (gpu virtual address) can be * passed back through the 'presumed' field. If on a subsequent reloc, * userspace passes back a 'presumed' address that is still valid, * then patching the cmdstream for this entry is skipped. This can * avoid kernel needing to map/access the cmdstream bo in the common * case. */ #define ETNA_SUBMIT_BO_READ 0x0001 #define ETNA_SUBMIT_BO_WRITE 0x0002 struct drm_etnaviv_gem_submit_bo { __u32 flags; /* in, mask of ETNA_SUBMIT_BO_x */ __u32 handle; /* in, GEM handle */ __u64 presumed; /* in/out, presumed buffer address */ }; /* performance monitor request (pmr) */ #define ETNA_PM_PROCESS_PRE 0x0001 #define ETNA_PM_PROCESS_POST 0x0002 struct drm_etnaviv_gem_submit_pmr { __u32 flags; /* in, when to process request (ETNA_PM_PROCESS_x) */ __u8 domain; /* in, pm domain */ __u8 pad; __u16 signal; /* in, pm signal */ __u32 sequence; /* in, sequence number */ __u32 read_offset; /* in, offset from read_bo */ __u32 read_idx; /* in, index of read_bo buffer */ }; /* Each cmdstream submit consists of a table of buffers involved, and * one or more cmdstream buffers. This allows for conditional execution * (context-restore), and IB buffers needed for per tile/bin draw cmds. */ #define ETNA_SUBMIT_NO_IMPLICIT 0x0001 #define ETNA_SUBMIT_FENCE_FD_IN 0x0002 #define ETNA_SUBMIT_FENCE_FD_OUT 0x0004 #define ETNA_SUBMIT_FLAGS (ETNA_SUBMIT_NO_IMPLICIT | \ ETNA_SUBMIT_FENCE_FD_IN | \ ETNA_SUBMIT_FENCE_FD_OUT) #define ETNA_PIPE_3D 0x00 #define ETNA_PIPE_2D 0x01 #define ETNA_PIPE_VG 0x02 struct drm_etnaviv_gem_submit { __u32 fence; /* out */ __u32 pipe; /* in */ __u32 exec_state; /* in, initial execution state (ETNA_PIPE_x) */ __u32 nr_bos; /* in, number of submit_bo's */ __u32 nr_relocs; /* in, number of submit_reloc's */ __u32 stream_size; /* in, cmdstream size */ __u64 bos; /* in, ptr to array of submit_bo's */ __u64 relocs; /* in, ptr to array of submit_reloc's */ __u64 stream; /* in, ptr to cmdstream */ __u32 flags; /* in, mask of ETNA_SUBMIT_x */ __s32 fence_fd; /* in/out, fence fd (see ETNA_SUBMIT_FENCE_FD_x) */ __u64 pmrs; /* in, ptr to array of submit_pmr's */ __u32 nr_pmrs; /* in, number of submit_pmr's */ __u32 pad; }; /* The normal way to synchronize with the GPU is just to CPU_PREP on * a buffer if you need to access it from the CPU (other cmdstream * submission from same or other contexts, PAGE_FLIP ioctl, etc, all * handle the required synchronization under the hood). This ioctl * mainly just exists as a way to implement the gallium pipe_fence * APIs without requiring a dummy bo to synchronize on. */ #define ETNA_WAIT_NONBLOCK 0x01 struct drm_etnaviv_wait_fence { __u32 pipe; /* in */ __u32 fence; /* in */ __u32 flags; /* in, mask of ETNA_WAIT_x */ __u32 pad; struct drm_etnaviv_timespec timeout; /* in */ }; #define ETNA_USERPTR_READ 0x01 #define ETNA_USERPTR_WRITE 0x02 struct drm_etnaviv_gem_userptr { __u64 user_ptr; /* in, page aligned user pointer */ __u64 user_size; /* in, page aligned user size */ __u32 flags; /* in, flags */ __u32 handle; /* out, non-zero handle */ }; struct drm_etnaviv_gem_wait { __u32 pipe; /* in */ __u32 handle; /* in, bo to be waited for */ __u32 flags; /* in, mask of ETNA_WAIT_x */ __u32 pad; struct drm_etnaviv_timespec timeout; /* in */ }; /* * Performance Monitor (PM): */ struct drm_etnaviv_pm_domain { __u32 pipe; /* in */ __u8 iter; /* in/out, select pm domain at index iter */ __u8 id; /* out, id of domain */ __u16 nr_signals; /* out, how many signals does this domain provide */ char name[64]; /* out, name of domain */ }; struct drm_etnaviv_pm_signal { __u32 pipe; /* in */ __u8 domain; /* in, pm domain index */ __u8 pad; __u16 iter; /* in/out, select pm source at index iter */ __u16 id; /* out, id of signal */ char name[64]; /* out, name of domain */ }; #define DRM_ETNAVIV_GET_PARAM 0x00 /* placeholder: #define DRM_ETNAVIV_SET_PARAM 0x01 */ #define DRM_ETNAVIV_GEM_NEW 0x02 #define DRM_ETNAVIV_GEM_INFO 0x03 #define DRM_ETNAVIV_GEM_CPU_PREP 0x04 #define DRM_ETNAVIV_GEM_CPU_FINI 0x05 #define DRM_ETNAVIV_GEM_SUBMIT 0x06 #define DRM_ETNAVIV_WAIT_FENCE 0x07 #define DRM_ETNAVIV_GEM_USERPTR 0x08 #define DRM_ETNAVIV_GEM_WAIT 0x09 #define DRM_ETNAVIV_PM_QUERY_DOM 0x0a #define DRM_ETNAVIV_PM_QUERY_SIG 0x0b #define DRM_ETNAVIV_NUM_IOCTLS 0x0c #define DRM_IOCTL_ETNAVIV_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_GET_PARAM, struct drm_etnaviv_param) #define DRM_IOCTL_ETNAVIV_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_NEW, struct drm_etnaviv_gem_new) #define DRM_IOCTL_ETNAVIV_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_INFO, struct drm_etnaviv_gem_info) #define DRM_IOCTL_ETNAVIV_GEM_CPU_PREP DRM_IOW(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_CPU_PREP, struct drm_etnaviv_gem_cpu_prep) #define DRM_IOCTL_ETNAVIV_GEM_CPU_FINI DRM_IOW(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_CPU_FINI, struct drm_etnaviv_gem_cpu_fini) #define DRM_IOCTL_ETNAVIV_GEM_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_SUBMIT, struct drm_etnaviv_gem_submit) #define DRM_IOCTL_ETNAVIV_WAIT_FENCE DRM_IOW(DRM_COMMAND_BASE + DRM_ETNAVIV_WAIT_FENCE, struct drm_etnaviv_wait_fence) #define DRM_IOCTL_ETNAVIV_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_USERPTR, struct drm_etnaviv_gem_userptr) #define DRM_IOCTL_ETNAVIV_GEM_WAIT DRM_IOW(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_WAIT, struct drm_etnaviv_gem_wait) #define DRM_IOCTL_ETNAVIV_PM_QUERY_DOM DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_PM_QUERY_DOM, struct drm_etnaviv_pm_domain) #define DRM_IOCTL_ETNAVIV_PM_QUERY_SIG DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_PM_QUERY_SIG, struct drm_etnaviv_pm_signal) #if defined(__cplusplus) } #endif #endif /* __ETNAVIV_DRM_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/vmwgfx_drm.h������������������������������������������������������������������������������������0000644�����������������00000105100�14763166027�0007670 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/************************************************************************** * * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * **************************************************************************/ #ifndef __VMWGFX_DRM_H__ #define __VMWGFX_DRM_H__ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif #define DRM_VMW_MAX_SURFACE_FACES 6 #define DRM_VMW_MAX_MIP_LEVELS 24 #define DRM_VMW_GET_PARAM 0 #define DRM_VMW_ALLOC_DMABUF 1 #define DRM_VMW_ALLOC_BO 1 #define DRM_VMW_UNREF_DMABUF 2 #define DRM_VMW_HANDLE_CLOSE 2 #define DRM_VMW_CURSOR_BYPASS 3 /* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/ #define DRM_VMW_CONTROL_STREAM 4 #define DRM_VMW_CLAIM_STREAM 5 #define DRM_VMW_UNREF_STREAM 6 /* guarded by DRM_VMW_PARAM_3D == 1 */ #define DRM_VMW_CREATE_CONTEXT 7 #define DRM_VMW_UNREF_CONTEXT 8 #define DRM_VMW_CREATE_SURFACE 9 #define DRM_VMW_UNREF_SURFACE 10 #define DRM_VMW_REF_SURFACE 11 #define DRM_VMW_EXECBUF 12 #define DRM_VMW_GET_3D_CAP 13 #define DRM_VMW_FENCE_WAIT 14 #define DRM_VMW_FENCE_SIGNALED 15 #define DRM_VMW_FENCE_UNREF 16 #define DRM_VMW_FENCE_EVENT 17 #define DRM_VMW_PRESENT 18 #define DRM_VMW_PRESENT_READBACK 19 #define DRM_VMW_UPDATE_LAYOUT 20 #define DRM_VMW_CREATE_SHADER 21 #define DRM_VMW_UNREF_SHADER 22 #define DRM_VMW_GB_SURFACE_CREATE 23 #define DRM_VMW_GB_SURFACE_REF 24 #define DRM_VMW_SYNCCPU 25 #define DRM_VMW_CREATE_EXTENDED_CONTEXT 26 #define DRM_VMW_GB_SURFACE_CREATE_EXT 27 #define DRM_VMW_GB_SURFACE_REF_EXT 28 /*************************************************************************/ /** * DRM_VMW_GET_PARAM - get device information. * * DRM_VMW_PARAM_FIFO_OFFSET: * Offset to use to map the first page of the FIFO read-only. * The fifo is mapped using the mmap() system call on the drm device. * * DRM_VMW_PARAM_OVERLAY_IOCTL: * Does the driver support the overlay ioctl. * * DRM_VMW_PARAM_SM4_1 * SM4_1 support is enabled. */ #define DRM_VMW_PARAM_NUM_STREAMS 0 #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1 #define DRM_VMW_PARAM_3D 2 #define DRM_VMW_PARAM_HW_CAPS 3 #define DRM_VMW_PARAM_FIFO_CAPS 4 #define DRM_VMW_PARAM_MAX_FB_SIZE 5 #define DRM_VMW_PARAM_FIFO_HW_VERSION 6 #define DRM_VMW_PARAM_MAX_SURF_MEMORY 7 #define DRM_VMW_PARAM_3D_CAPS_SIZE 8 #define DRM_VMW_PARAM_MAX_MOB_MEMORY 9 #define DRM_VMW_PARAM_MAX_MOB_SIZE 10 #define DRM_VMW_PARAM_SCREEN_TARGET 11 #define DRM_VMW_PARAM_DX 12 #define DRM_VMW_PARAM_HW_CAPS2 13 #define DRM_VMW_PARAM_SM4_1 14 /** * enum drm_vmw_handle_type - handle type for ref ioctls * */ enum drm_vmw_handle_type { DRM_VMW_HANDLE_LEGACY = 0, DRM_VMW_HANDLE_PRIME = 1 }; /** * struct drm_vmw_getparam_arg * * @value: Returned value. //Out * @param: Parameter to query. //In. * * Argument to the DRM_VMW_GET_PARAM Ioctl. */ struct drm_vmw_getparam_arg { __u64 value; __u32 param; __u32 pad64; }; /*************************************************************************/ /** * DRM_VMW_CREATE_CONTEXT - Create a host context. * * Allocates a device unique context id, and queues a create context command * for the host. Does not wait for host completion. */ /** * struct drm_vmw_context_arg * * @cid: Device unique context ID. * * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl. * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl. */ struct drm_vmw_context_arg { __s32 cid; __u32 pad64; }; /*************************************************************************/ /** * DRM_VMW_UNREF_CONTEXT - Create a host context. * * Frees a global context id, and queues a destroy host command for the host. * Does not wait for host completion. The context ID can be used directly * in the command stream and shows up as the same context ID on the host. */ /*************************************************************************/ /** * DRM_VMW_CREATE_SURFACE - Create a host suface. * * Allocates a device unique surface id, and queues a create surface command * for the host. Does not wait for host completion. The surface ID can be * used directly in the command stream and shows up as the same surface * ID on the host. */ /** * struct drm_wmv_surface_create_req * * @flags: Surface flags as understood by the host. * @format: Surface format as understood by the host. * @mip_levels: Number of mip levels for each face. * An unused face should have 0 encoded. * @size_addr: Address of a user-space array of sruct drm_vmw_size * cast to an __u64 for 32-64 bit compatibility. * The size of the array should equal the total number of mipmap levels. * @shareable: Boolean whether other clients (as identified by file descriptors) * may reference this surface. * @scanout: Boolean whether the surface is intended to be used as a * scanout. * * Input data to the DRM_VMW_CREATE_SURFACE Ioctl. * Output data from the DRM_VMW_REF_SURFACE Ioctl. */ struct drm_vmw_surface_create_req { __u32 flags; __u32 format; __u32 mip_levels[DRM_VMW_MAX_SURFACE_FACES]; __u64 size_addr; __s32 shareable; __s32 scanout; }; /** * struct drm_wmv_surface_arg * * @sid: Surface id of created surface or surface to destroy or reference. * @handle_type: Handle type for DRM_VMW_REF_SURFACE Ioctl. * * Output data from the DRM_VMW_CREATE_SURFACE Ioctl. * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl. * Input argument to the DRM_VMW_REF_SURFACE Ioctl. */ struct drm_vmw_surface_arg { __s32 sid; enum drm_vmw_handle_type handle_type; }; /** * struct drm_vmw_size ioctl. * * @width - mip level width * @height - mip level height * @depth - mip level depth * * Description of a mip level. * Input data to the DRM_WMW_CREATE_SURFACE Ioctl. */ struct drm_vmw_size { __u32 width; __u32 height; __u32 depth; __u32 pad64; }; /** * union drm_vmw_surface_create_arg * * @rep: Output data as described above. * @req: Input data as described above. * * Argument to the DRM_VMW_CREATE_SURFACE Ioctl. */ union drm_vmw_surface_create_arg { struct drm_vmw_surface_arg rep; struct drm_vmw_surface_create_req req; }; /*************************************************************************/ /** * DRM_VMW_REF_SURFACE - Reference a host surface. * * Puts a reference on a host surface with a give sid, as previously * returned by the DRM_VMW_CREATE_SURFACE ioctl. * A reference will make sure the surface isn't destroyed while we hold * it and will allow the calling client to use the surface ID in the command * stream. * * On successful return, the Ioctl returns the surface information given * in the DRM_VMW_CREATE_SURFACE ioctl. */ /** * union drm_vmw_surface_reference_arg * * @rep: Output data as described above. * @req: Input data as described above. * * Argument to the DRM_VMW_REF_SURFACE Ioctl. */ union drm_vmw_surface_reference_arg { struct drm_vmw_surface_create_req rep; struct drm_vmw_surface_arg req; }; /*************************************************************************/ /** * DRM_VMW_UNREF_SURFACE - Unreference a host surface. * * Clear a reference previously put on a host surface. * When all references are gone, including the one implicitly placed * on creation, * a destroy surface command will be queued for the host. * Does not wait for completion. */ /*************************************************************************/ /** * DRM_VMW_EXECBUF * * Submit a command buffer for execution on the host, and return a * fence seqno that when signaled, indicates that the command buffer has * executed. */ /** * struct drm_vmw_execbuf_arg * * @commands: User-space address of a command buffer cast to an __u64. * @command-size: Size in bytes of the command buffer. * @throttle-us: Sleep until software is less than @throttle_us * microseconds ahead of hardware. The driver may round this value * to the nearest kernel tick. * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an * __u64. * @version: Allows expanding the execbuf ioctl parameters without breaking * backwards compatibility, since user-space will always tell the kernel * which version it uses. * @flags: Execbuf flags. * @imported_fence_fd: FD for a fence imported from another device * * Argument to the DRM_VMW_EXECBUF Ioctl. */ #define DRM_VMW_EXECBUF_VERSION 2 #define DRM_VMW_EXECBUF_FLAG_IMPORT_FENCE_FD (1 << 0) #define DRM_VMW_EXECBUF_FLAG_EXPORT_FENCE_FD (1 << 1) struct drm_vmw_execbuf_arg { __u64 commands; __u32 command_size; __u32 throttle_us; __u64 fence_rep; __u32 version; __u32 flags; __u32 context_handle; __s32 imported_fence_fd; }; /** * struct drm_vmw_fence_rep * * @handle: Fence object handle for fence associated with a command submission. * @mask: Fence flags relevant for this fence object. * @seqno: Fence sequence number in fifo. A fence object with a lower * seqno will signal the EXEC flag before a fence object with a higher * seqno. This can be used by user-space to avoid kernel calls to determine * whether a fence has signaled the EXEC flag. Note that @seqno will * wrap at 32-bit. * @passed_seqno: The highest seqno number processed by the hardware * so far. This can be used to mark user-space fence objects as signaled, and * to determine whether a fence seqno might be stale. * @fd: FD associated with the fence, -1 if not exported * @error: This member should've been set to -EFAULT on submission. * The following actions should be take on completion: * error == -EFAULT: Fence communication failed. The host is synchronized. * Use the last fence id read from the FIFO fence register. * error != 0 && error != -EFAULT: * Fence submission failed. The host is synchronized. Use the fence_seq member. * error == 0: All is OK, The host may not be synchronized. * Use the fence_seq member. * * Input / Output data to the DRM_VMW_EXECBUF Ioctl. */ struct drm_vmw_fence_rep { __u32 handle; __u32 mask; __u32 seqno; __u32 passed_seqno; __s32 fd; __s32 error; }; /*************************************************************************/ /** * DRM_VMW_ALLOC_BO * * Allocate a buffer object that is visible also to the host. * NOTE: The buffer is * identified by a handle and an offset, which are private to the guest, but * useable in the command stream. The guest kernel may translate these * and patch up the command stream accordingly. In the future, the offset may * be zero at all times, or it may disappear from the interface before it is * fixed. * * The buffer object may stay user-space mapped in the guest at all times, * and is thus suitable for sub-allocation. * * Buffer objects are mapped using the mmap() syscall on the drm device. */ /** * struct drm_vmw_alloc_bo_req * * @size: Required minimum size of the buffer. * * Input data to the DRM_VMW_ALLOC_BO Ioctl. */ struct drm_vmw_alloc_bo_req { __u32 size; __u32 pad64; }; #define drm_vmw_alloc_dmabuf_req drm_vmw_alloc_bo_req /** * struct drm_vmw_bo_rep * * @map_handle: Offset to use in the mmap() call used to map the buffer. * @handle: Handle unique to this buffer. Used for unreferencing. * @cur_gmr_id: GMR id to use in the command stream when this buffer is * referenced. See not above. * @cur_gmr_offset: Offset to use in the command stream when this buffer is * referenced. See note above. * * Output data from the DRM_VMW_ALLOC_BO Ioctl. */ struct drm_vmw_bo_rep { __u64 map_handle; __u32 handle; __u32 cur_gmr_id; __u32 cur_gmr_offset; __u32 pad64; }; #define drm_vmw_dmabuf_rep drm_vmw_bo_rep /** * union drm_vmw_alloc_bo_arg * * @req: Input data as described above. * @rep: Output data as described above. * * Argument to the DRM_VMW_ALLOC_BO Ioctl. */ union drm_vmw_alloc_bo_arg { struct drm_vmw_alloc_bo_req req; struct drm_vmw_bo_rep rep; }; #define drm_vmw_alloc_dmabuf_arg drm_vmw_alloc_bo_arg /*************************************************************************/ /** * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams. * * This IOCTL controls the overlay units of the svga device. * The SVGA overlay units does not work like regular hardware units in * that they do not automaticaly read back the contents of the given dma * buffer. But instead only read back for each call to this ioctl, and * at any point between this call being made and a following call that * either changes the buffer or disables the stream. */ /** * struct drm_vmw_rect * * Defines a rectangle. Used in the overlay ioctl to define * source and destination rectangle. */ struct drm_vmw_rect { __s32 x; __s32 y; __u32 w; __u32 h; }; /** * struct drm_vmw_control_stream_arg * * @stream_id: Stearm to control * @enabled: If false all following arguments are ignored. * @handle: Handle to buffer for getting data from. * @format: Format of the overlay as understood by the host. * @width: Width of the overlay. * @height: Height of the overlay. * @size: Size of the overlay in bytes. * @pitch: Array of pitches, the two last are only used for YUV12 formats. * @offset: Offset from start of dma buffer to overlay. * @src: Source rect, must be within the defined area above. * @dst: Destination rect, x and y may be negative. * * Argument to the DRM_VMW_CONTROL_STREAM Ioctl. */ struct drm_vmw_control_stream_arg { __u32 stream_id; __u32 enabled; __u32 flags; __u32 color_key; __u32 handle; __u32 offset; __s32 format; __u32 size; __u32 width; __u32 height; __u32 pitch[3]; __u32 pad64; struct drm_vmw_rect src; struct drm_vmw_rect dst; }; /*************************************************************************/ /** * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass. * */ #define DRM_VMW_CURSOR_BYPASS_ALL (1 << 0) #define DRM_VMW_CURSOR_BYPASS_FLAGS (1) /** * struct drm_vmw_cursor_bypass_arg * * @flags: Flags. * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed. * @xpos: X position of cursor. * @ypos: Y position of cursor. * @xhot: X hotspot. * @yhot: Y hotspot. * * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl. */ struct drm_vmw_cursor_bypass_arg { __u32 flags; __u32 crtc_id; __s32 xpos; __s32 ypos; __s32 xhot; __s32 yhot; }; /*************************************************************************/ /** * DRM_VMW_CLAIM_STREAM - Claim a single stream. */ /** * struct drm_vmw_context_arg * * @stream_id: Device unique context ID. * * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl. * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl. */ struct drm_vmw_stream_arg { __u32 stream_id; __u32 pad64; }; /*************************************************************************/ /** * DRM_VMW_UNREF_STREAM - Unclaim a stream. * * Return a single stream that was claimed by this process. Also makes * sure that the stream has been stopped. */ /*************************************************************************/ /** * DRM_VMW_GET_3D_CAP * * Read 3D capabilities from the FIFO * */ /** * struct drm_vmw_get_3d_cap_arg * * @buffer: Pointer to a buffer for capability data, cast to an __u64 * @size: Max size to copy * * Input argument to the DRM_VMW_GET_3D_CAP_IOCTL * ioctls. */ struct drm_vmw_get_3d_cap_arg { __u64 buffer; __u32 max_size; __u32 pad64; }; /*************************************************************************/ /** * DRM_VMW_FENCE_WAIT * * Waits for a fence object to signal. The wait is interruptible, so that * signals may be delivered during the interrupt. The wait may timeout, * in which case the calls returns -EBUSY. If the wait is restarted, * that is restarting without resetting @cookie_valid to zero, * the timeout is computed from the first call. * * The flags argument to the DRM_VMW_FENCE_WAIT ioctl indicates what to wait * on: * DRM_VMW_FENCE_FLAG_EXEC: All commands ahead of the fence in the command * stream * have executed. * DRM_VMW_FENCE_FLAG_QUERY: All query results resulting from query finish * commands * in the buffer given to the EXECBUF ioctl returning the fence object handle * are available to user-space. * * DRM_VMW_WAIT_OPTION_UNREF: If this wait option is given, and the * fenc wait ioctl returns 0, the fence object has been unreferenced after * the wait. */ #define DRM_VMW_FENCE_FLAG_EXEC (1 << 0) #define DRM_VMW_FENCE_FLAG_QUERY (1 << 1) #define DRM_VMW_WAIT_OPTION_UNREF (1 << 0) /** * struct drm_vmw_fence_wait_arg * * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl. * @cookie_valid: Must be reset to 0 on first call. Left alone on restart. * @kernel_cookie: Set to 0 on first call. Left alone on restart. * @timeout_us: Wait timeout in microseconds. 0 for indefinite timeout. * @lazy: Set to 1 if timing is not critical. Allow more than a kernel tick * before returning. * @flags: Fence flags to wait on. * @wait_options: Options that control the behaviour of the wait ioctl. * * Input argument to the DRM_VMW_FENCE_WAIT ioctl. */ struct drm_vmw_fence_wait_arg { __u32 handle; __s32 cookie_valid; __u64 kernel_cookie; __u64 timeout_us; __s32 lazy; __s32 flags; __s32 wait_options; __s32 pad64; }; /*************************************************************************/ /** * DRM_VMW_FENCE_SIGNALED * * Checks if a fence object is signaled.. */ /** * struct drm_vmw_fence_signaled_arg * * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl. * @flags: Fence object flags input to DRM_VMW_FENCE_SIGNALED ioctl * @signaled: Out: Flags signaled. * @sequence: Out: Highest sequence passed so far. Can be used to signal the * EXEC flag of user-space fence objects. * * Input/Output argument to the DRM_VMW_FENCE_SIGNALED and DRM_VMW_FENCE_UNREF * ioctls. */ struct drm_vmw_fence_signaled_arg { __u32 handle; __u32 flags; __s32 signaled; __u32 passed_seqno; __u32 signaled_flags; __u32 pad64; }; /*************************************************************************/ /** * DRM_VMW_FENCE_UNREF * * Unreferences a fence object, and causes it to be destroyed if there are no * other references to it. * */ /** * struct drm_vmw_fence_arg * * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl. * * Input/Output argument to the DRM_VMW_FENCE_UNREF ioctl.. */ struct drm_vmw_fence_arg { __u32 handle; __u32 pad64; }; /*************************************************************************/ /** * DRM_VMW_FENCE_EVENT * * Queues an event on a fence to be delivered on the drm character device * when the fence has signaled the DRM_VMW_FENCE_FLAG_EXEC flag. * Optionally the approximate time when the fence signaled is * given by the event. */ /* * The event type */ #define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000 struct drm_vmw_event_fence { struct drm_event base; __u64 user_data; __u32 tv_sec; __u32 tv_usec; }; /* * Flags that may be given to the command. */ /* Request fence signaled time on the event. */ #define DRM_VMW_FE_FLAG_REQ_TIME (1 << 0) /** * struct drm_vmw_fence_event_arg * * @fence_rep: Pointer to fence_rep structure cast to __u64 or 0 if * the fence is not supposed to be referenced by user-space. * @user_info: Info to be delivered with the event. * @handle: Attach the event to this fence only. * @flags: A set of flags as defined above. */ struct drm_vmw_fence_event_arg { __u64 fence_rep; __u64 user_data; __u32 handle; __u32 flags; }; /*************************************************************************/ /** * DRM_VMW_PRESENT * * Executes an SVGA present on a given fb for a given surface. The surface * is placed on the framebuffer. Cliprects are given relative to the given * point (the point disignated by dest_{x|y}). * */ /** * struct drm_vmw_present_arg * @fb_id: framebuffer id to present / read back from. * @sid: Surface id to present from. * @dest_x: X placement coordinate for surface. * @dest_y: Y placement coordinate for surface. * @clips_ptr: Pointer to an array of clip rects cast to an __u64. * @num_clips: Number of cliprects given relative to the framebuffer origin, * in the same coordinate space as the frame buffer. * @pad64: Unused 64-bit padding. * * Input argument to the DRM_VMW_PRESENT ioctl. */ struct drm_vmw_present_arg { __u32 fb_id; __u32 sid; __s32 dest_x; __s32 dest_y; __u64 clips_ptr; __u32 num_clips; __u32 pad64; }; /*************************************************************************/ /** * DRM_VMW_PRESENT_READBACK * * Executes an SVGA present readback from a given fb to the dma buffer * currently bound as the fb. If there is no dma buffer bound to the fb, * an error will be returned. * */ /** * struct drm_vmw_present_arg * @fb_id: fb_id to present / read back from. * @num_clips: Number of cliprects. * @clips_ptr: Pointer to an array of clip rects cast to an __u64. * @fence_rep: Pointer to a struct drm_vmw_fence_rep, cast to an __u64. * If this member is NULL, then the ioctl should not return a fence. */ struct drm_vmw_present_readback_arg { __u32 fb_id; __u32 num_clips; __u64 clips_ptr; __u64 fence_rep; }; /*************************************************************************/ /** * DRM_VMW_UPDATE_LAYOUT - Update layout * * Updates the preferred modes and connection status for connectors. The * command consists of one drm_vmw_update_layout_arg pointing to an array * of num_outputs drm_vmw_rect's. */ /** * struct drm_vmw_update_layout_arg * * @num_outputs: number of active connectors * @rects: pointer to array of drm_vmw_rect cast to an __u64 * * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl. */ struct drm_vmw_update_layout_arg { __u32 num_outputs; __u32 pad64; __u64 rects; }; /*************************************************************************/ /** * DRM_VMW_CREATE_SHADER - Create shader * * Creates a shader and optionally binds it to a dma buffer containing * the shader byte-code. */ /** * enum drm_vmw_shader_type - Shader types */ enum drm_vmw_shader_type { drm_vmw_shader_type_vs = 0, drm_vmw_shader_type_ps, }; /** * struct drm_vmw_shader_create_arg * * @shader_type: Shader type of the shader to create. * @size: Size of the byte-code in bytes. * where the shader byte-code starts * @buffer_handle: Buffer handle identifying the buffer containing the * shader byte-code * @shader_handle: On successful completion contains a handle that * can be used to subsequently identify the shader. * @offset: Offset in bytes into the buffer given by @buffer_handle, * * Input / Output argument to the DRM_VMW_CREATE_SHADER Ioctl. */ struct drm_vmw_shader_create_arg { enum drm_vmw_shader_type shader_type; __u32 size; __u32 buffer_handle; __u32 shader_handle; __u64 offset; }; /*************************************************************************/ /** * DRM_VMW_UNREF_SHADER - Unreferences a shader * * Destroys a user-space reference to a shader, optionally destroying * it. */ /** * struct drm_vmw_shader_arg * * @handle: Handle identifying the shader to destroy. * * Input argument to the DRM_VMW_UNREF_SHADER ioctl. */ struct drm_vmw_shader_arg { __u32 handle; __u32 pad64; }; /*************************************************************************/ /** * DRM_VMW_GB_SURFACE_CREATE - Create a host guest-backed surface. * * Allocates a surface handle and queues a create surface command * for the host on the first use of the surface. The surface ID can * be used as the surface ID in commands referencing the surface. */ /** * enum drm_vmw_surface_flags * * @drm_vmw_surface_flag_shareable: Whether the surface is shareable * @drm_vmw_surface_flag_scanout: Whether the surface is a scanout * surface. * @drm_vmw_surface_flag_create_buffer: Create a backup buffer if none is * given. */ enum drm_vmw_surface_flags { drm_vmw_surface_flag_shareable = (1 << 0), drm_vmw_surface_flag_scanout = (1 << 1), drm_vmw_surface_flag_create_buffer = (1 << 2) }; /** * struct drm_vmw_gb_surface_create_req * * @svga3d_flags: SVGA3d surface flags for the device. * @format: SVGA3d format. * @mip_level: Number of mip levels for all faces. * @drm_surface_flags Flags as described above. * @multisample_count Future use. Set to 0. * @autogen_filter Future use. Set to 0. * @buffer_handle Buffer handle of backup buffer. SVGA3D_INVALID_ID * if none. * @base_size Size of the base mip level for all faces. * @array_size Must be zero for non-DX hardware, and if non-zero * svga3d_flags must have proper bind flags setup. * * Input argument to the DRM_VMW_GB_SURFACE_CREATE Ioctl. * Part of output argument for the DRM_VMW_GB_SURFACE_REF Ioctl. */ struct drm_vmw_gb_surface_create_req { __u32 svga3d_flags; __u32 format; __u32 mip_levels; enum drm_vmw_surface_flags drm_surface_flags; __u32 multisample_count; __u32 autogen_filter; __u32 buffer_handle; __u32 array_size; struct drm_vmw_size base_size; }; /** * struct drm_vmw_gb_surface_create_rep * * @handle: Surface handle. * @backup_size: Size of backup buffers for this surface. * @buffer_handle: Handle of backup buffer. SVGA3D_INVALID_ID if none. * @buffer_size: Actual size of the buffer identified by * @buffer_handle * @buffer_map_handle: Offset into device address space for the buffer * identified by @buffer_handle. * * Part of output argument for the DRM_VMW_GB_SURFACE_REF ioctl. * Output argument for the DRM_VMW_GB_SURFACE_CREATE ioctl. */ struct drm_vmw_gb_surface_create_rep { __u32 handle; __u32 backup_size; __u32 buffer_handle; __u32 buffer_size; __u64 buffer_map_handle; }; /** * union drm_vmw_gb_surface_create_arg * * @req: Input argument as described above. * @rep: Output argument as described above. * * Argument to the DRM_VMW_GB_SURFACE_CREATE ioctl. */ union drm_vmw_gb_surface_create_arg { struct drm_vmw_gb_surface_create_rep rep; struct drm_vmw_gb_surface_create_req req; }; /*************************************************************************/ /** * DRM_VMW_GB_SURFACE_REF - Reference a host surface. * * Puts a reference on a host surface with a given handle, as previously * returned by the DRM_VMW_GB_SURFACE_CREATE ioctl. * A reference will make sure the surface isn't destroyed while we hold * it and will allow the calling client to use the surface handle in * the command stream. * * On successful return, the Ioctl returns the surface information given * to and returned from the DRM_VMW_GB_SURFACE_CREATE ioctl. */ /** * struct drm_vmw_gb_surface_reference_arg * * @creq: The data used as input when the surface was created, as described * above at "struct drm_vmw_gb_surface_create_req" * @crep: Additional data output when the surface was created, as described * above at "struct drm_vmw_gb_surface_create_rep" * * Output Argument to the DRM_VMW_GB_SURFACE_REF ioctl. */ struct drm_vmw_gb_surface_ref_rep { struct drm_vmw_gb_surface_create_req creq; struct drm_vmw_gb_surface_create_rep crep; }; /** * union drm_vmw_gb_surface_reference_arg * * @req: Input data as described above at "struct drm_vmw_surface_arg" * @rep: Output data as described above at "struct drm_vmw_gb_surface_ref_rep" * * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl. */ union drm_vmw_gb_surface_reference_arg { struct drm_vmw_gb_surface_ref_rep rep; struct drm_vmw_surface_arg req; }; /*************************************************************************/ /** * DRM_VMW_SYNCCPU - Sync a DMA buffer / MOB for CPU access. * * Idles any previously submitted GPU operations on the buffer and * by default blocks command submissions that reference the buffer. * If the file descriptor used to grab a blocking CPU sync is closed, the * cpu sync is released. * The flags argument indicates how the grab / release operation should be * performed: */ /** * enum drm_vmw_synccpu_flags - Synccpu flags: * * @drm_vmw_synccpu_read: Sync for read. If sync is done for read only, it's a * hint to the kernel to allow command submissions that references the buffer * for read-only. * @drm_vmw_synccpu_write: Sync for write. Block all command submissions * referencing this buffer. * @drm_vmw_synccpu_dontblock: Dont wait for GPU idle, but rather return * -EBUSY should the buffer be busy. * @drm_vmw_synccpu_allow_cs: Allow command submission that touches the buffer * while the buffer is synced for CPU. This is similar to the GEM bo idle * behavior. */ enum drm_vmw_synccpu_flags { drm_vmw_synccpu_read = (1 << 0), drm_vmw_synccpu_write = (1 << 1), drm_vmw_synccpu_dontblock = (1 << 2), drm_vmw_synccpu_allow_cs = (1 << 3) }; /** * enum drm_vmw_synccpu_op - Synccpu operations: * * @drm_vmw_synccpu_grab: Grab the buffer for CPU operations * @drm_vmw_synccpu_release: Release a previous grab. */ enum drm_vmw_synccpu_op { drm_vmw_synccpu_grab, drm_vmw_synccpu_release }; /** * struct drm_vmw_synccpu_arg * * @op: The synccpu operation as described above. * @handle: Handle identifying the buffer object. * @flags: Flags as described above. */ struct drm_vmw_synccpu_arg { enum drm_vmw_synccpu_op op; enum drm_vmw_synccpu_flags flags; __u32 handle; __u32 pad64; }; /*************************************************************************/ /** * DRM_VMW_CREATE_EXTENDED_CONTEXT - Create a host context. * * Allocates a device unique context id, and queues a create context command * for the host. Does not wait for host completion. */ enum drm_vmw_extended_context { drm_vmw_context_legacy, drm_vmw_context_dx }; /** * union drm_vmw_extended_context_arg * * @req: Context type. * @rep: Context identifier. * * Argument to the DRM_VMW_CREATE_EXTENDED_CONTEXT Ioctl. */ union drm_vmw_extended_context_arg { enum drm_vmw_extended_context req; struct drm_vmw_context_arg rep; }; /*************************************************************************/ /* * DRM_VMW_HANDLE_CLOSE - Close a user-space handle and release its * underlying resource. * * Note that this ioctl is overlaid on the deprecated DRM_VMW_UNREF_DMABUF * Ioctl. */ /** * struct drm_vmw_handle_close_arg * * @handle: Handle to close. * * Argument to the DRM_VMW_HANDLE_CLOSE Ioctl. */ struct drm_vmw_handle_close_arg { __u32 handle; __u32 pad64; }; #define drm_vmw_unref_dmabuf_arg drm_vmw_handle_close_arg /*************************************************************************/ /** * DRM_VMW_GB_SURFACE_CREATE_EXT - Create a host guest-backed surface. * * Allocates a surface handle and queues a create surface command * for the host on the first use of the surface. The surface ID can * be used as the surface ID in commands referencing the surface. * * This new command extends DRM_VMW_GB_SURFACE_CREATE by adding version * parameter and 64 bit svga flag. */ /** * enum drm_vmw_surface_version * * @drm_vmw_surface_gb_v1: Corresponds to current gb surface format with * svga3d surface flags split into 2, upper half and lower half. */ enum drm_vmw_surface_version { drm_vmw_gb_surface_v1 }; /** * struct drm_vmw_gb_surface_create_ext_req * * @base: Surface create parameters. * @version: Version of surface create ioctl. * @svga3d_flags_upper_32_bits: Upper 32 bits of svga3d flags. * @multisample_pattern: Multisampling pattern when msaa is supported. * @quality_level: Precision settings for each sample. * @must_be_zero: Reserved for future usage. * * Input argument to the DRM_VMW_GB_SURFACE_CREATE_EXT Ioctl. * Part of output argument for the DRM_VMW_GB_SURFACE_REF_EXT Ioctl. */ struct drm_vmw_gb_surface_create_ext_req { struct drm_vmw_gb_surface_create_req base; enum drm_vmw_surface_version version; uint32_t svga3d_flags_upper_32_bits; SVGA3dMSPattern multisample_pattern; SVGA3dMSQualityLevel quality_level; uint64_t must_be_zero; }; /** * union drm_vmw_gb_surface_create_ext_arg * * @req: Input argument as described above. * @rep: Output argument as described above. * * Argument to the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl. */ union drm_vmw_gb_surface_create_ext_arg { struct drm_vmw_gb_surface_create_rep rep; struct drm_vmw_gb_surface_create_ext_req req; }; /*************************************************************************/ /** * DRM_VMW_GB_SURFACE_REF_EXT - Reference a host surface. * * Puts a reference on a host surface with a given handle, as previously * returned by the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl. * A reference will make sure the surface isn't destroyed while we hold * it and will allow the calling client to use the surface handle in * the command stream. * * On successful return, the Ioctl returns the surface information given * to and returned from the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl. */ /** * struct drm_vmw_gb_surface_ref_ext_rep * * @creq: The data used as input when the surface was created, as described * above at "struct drm_vmw_gb_surface_create_ext_req" * @crep: Additional data output when the surface was created, as described * above at "struct drm_vmw_gb_surface_create_rep" * * Output Argument to the DRM_VMW_GB_SURFACE_REF_EXT ioctl. */ struct drm_vmw_gb_surface_ref_ext_rep { struct drm_vmw_gb_surface_create_ext_req creq; struct drm_vmw_gb_surface_create_rep crep; }; /** * union drm_vmw_gb_surface_reference_ext_arg * * @req: Input data as described above at "struct drm_vmw_surface_arg" * @rep: Output data as described above at * "struct drm_vmw_gb_surface_ref_ext_rep" * * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl. */ union drm_vmw_gb_surface_reference_ext_arg { struct drm_vmw_gb_surface_ref_ext_rep rep; struct drm_vmw_surface_arg req; }; #if defined(__cplusplus) } #endif #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/amdgpu_drm.h������������������������������������������������������������������������������������0000644�����������������00000071321�14763166027�0007636 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* amdgpu_drm.h -- Public header for the amdgpu driver -*- linux-c -*- * * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Fremont, California. * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. * Copyright 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Kevin E. Martin <martin@valinux.com> * Gareth Hughes <gareth@valinux.com> * Keith Whitwell <keith@tungstengraphics.com> */ #ifndef __AMDGPU_DRM_H__ #define __AMDGPU_DRM_H__ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif #define DRM_AMDGPU_GEM_CREATE 0x00 #define DRM_AMDGPU_GEM_MMAP 0x01 #define DRM_AMDGPU_CTX 0x02 #define DRM_AMDGPU_BO_LIST 0x03 #define DRM_AMDGPU_CS 0x04 #define DRM_AMDGPU_INFO 0x05 #define DRM_AMDGPU_GEM_METADATA 0x06 #define DRM_AMDGPU_GEM_WAIT_IDLE 0x07 #define DRM_AMDGPU_GEM_VA 0x08 #define DRM_AMDGPU_WAIT_CS 0x09 #define DRM_AMDGPU_GEM_OP 0x10 #define DRM_AMDGPU_GEM_USERPTR 0x11 #define DRM_AMDGPU_WAIT_FENCES 0x12 #define DRM_AMDGPU_VM 0x13 #define DRM_AMDGPU_FENCE_TO_HANDLE 0x14 #define DRM_AMDGPU_SCHED 0x15 #define DRM_IOCTL_AMDGPU_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create) #define DRM_IOCTL_AMDGPU_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap) #define DRM_IOCTL_AMDGPU_CTX DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CTX, union drm_amdgpu_ctx) #define DRM_IOCTL_AMDGPU_BO_LIST DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_BO_LIST, union drm_amdgpu_bo_list) #define DRM_IOCTL_AMDGPU_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CS, union drm_amdgpu_cs) #define DRM_IOCTL_AMDGPU_INFO DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_INFO, struct drm_amdgpu_info) #define DRM_IOCTL_AMDGPU_GEM_METADATA DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_METADATA, struct drm_amdgpu_gem_metadata) #define DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_WAIT_IDLE, union drm_amdgpu_gem_wait_idle) #define DRM_IOCTL_AMDGPU_GEM_VA DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_VA, struct drm_amdgpu_gem_va) #define DRM_IOCTL_AMDGPU_WAIT_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_CS, union drm_amdgpu_wait_cs) #define DRM_IOCTL_AMDGPU_GEM_OP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_OP, struct drm_amdgpu_gem_op) #define DRM_IOCTL_AMDGPU_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr) #define DRM_IOCTL_AMDGPU_WAIT_FENCES DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_FENCES, union drm_amdgpu_wait_fences) #define DRM_IOCTL_AMDGPU_VM DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_VM, union drm_amdgpu_vm) #define DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_FENCE_TO_HANDLE, union drm_amdgpu_fence_to_handle) #define DRM_IOCTL_AMDGPU_SCHED DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_SCHED, union drm_amdgpu_sched) /** * DOC: memory domains * * %AMDGPU_GEM_DOMAIN_CPU System memory that is not GPU accessible. * Memory in this pool could be swapped out to disk if there is pressure. * * %AMDGPU_GEM_DOMAIN_GTT GPU accessible system memory, mapped into the * GPU's virtual address space via gart. Gart memory linearizes non-contiguous * pages of system memory, allows GPU access system memory in a linezrized * fashion. * * %AMDGPU_GEM_DOMAIN_VRAM Local video memory. For APUs, it is memory * carved out by the BIOS. * * %AMDGPU_GEM_DOMAIN_GDS Global on-chip data storage used to share data * across shader threads. * * %AMDGPU_GEM_DOMAIN_GWS Global wave sync, used to synchronize the * execution of all the waves on a device. * * %AMDGPU_GEM_DOMAIN_OA Ordered append, used by 3D or Compute engines * for appending data. */ #define AMDGPU_GEM_DOMAIN_CPU 0x1 #define AMDGPU_GEM_DOMAIN_GTT 0x2 #define AMDGPU_GEM_DOMAIN_VRAM 0x4 #define AMDGPU_GEM_DOMAIN_GDS 0x8 #define AMDGPU_GEM_DOMAIN_GWS 0x10 #define AMDGPU_GEM_DOMAIN_OA 0x20 #define AMDGPU_GEM_DOMAIN_MASK (AMDGPU_GEM_DOMAIN_CPU | \ AMDGPU_GEM_DOMAIN_GTT | \ AMDGPU_GEM_DOMAIN_VRAM | \ AMDGPU_GEM_DOMAIN_GDS | \ AMDGPU_GEM_DOMAIN_GWS | \ AMDGPU_GEM_DOMAIN_OA) /* Flag that CPU access will be required for the case of VRAM domain */ #define AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED (1 << 0) /* Flag that CPU access will not work, this VRAM domain is invisible */ #define AMDGPU_GEM_CREATE_NO_CPU_ACCESS (1 << 1) /* Flag that USWC attributes should be used for GTT */ #define AMDGPU_GEM_CREATE_CPU_GTT_USWC (1 << 2) /* Flag that the memory should be in VRAM and cleared */ #define AMDGPU_GEM_CREATE_VRAM_CLEARED (1 << 3) /* Flag that create shadow bo(GTT) while allocating vram bo */ #define AMDGPU_GEM_CREATE_SHADOW (1 << 4) /* Flag that allocating the BO should use linear VRAM */ #define AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS (1 << 5) /* Flag that BO is always valid in this VM */ #define AMDGPU_GEM_CREATE_VM_ALWAYS_VALID (1 << 6) /* Flag that BO sharing will be explicitly synchronized */ #define AMDGPU_GEM_CREATE_EXPLICIT_SYNC (1 << 7) /* Flag that indicates allocating MQD gart on GFX9, where the mtype * for the second page onward should be set to NC. */ #define AMDGPU_GEM_CREATE_MQD_GFX9 (1 << 8) struct drm_amdgpu_gem_create_in { /** the requested memory size */ __u64 bo_size; /** physical start_addr alignment in bytes for some HW requirements */ __u64 alignment; /** the requested memory domains */ __u64 domains; /** allocation flags */ __u64 domain_flags; }; struct drm_amdgpu_gem_create_out { /** returned GEM object handle */ __u32 handle; __u32 _pad; }; union drm_amdgpu_gem_create { struct drm_amdgpu_gem_create_in in; struct drm_amdgpu_gem_create_out out; }; /** Opcode to create new residency list. */ #define AMDGPU_BO_LIST_OP_CREATE 0 /** Opcode to destroy previously created residency list */ #define AMDGPU_BO_LIST_OP_DESTROY 1 /** Opcode to update resource information in the list */ #define AMDGPU_BO_LIST_OP_UPDATE 2 struct drm_amdgpu_bo_list_in { /** Type of operation */ __u32 operation; /** Handle of list or 0 if we want to create one */ __u32 list_handle; /** Number of BOs in list */ __u32 bo_number; /** Size of each element describing BO */ __u32 bo_info_size; /** Pointer to array describing BOs */ __u64 bo_info_ptr; }; struct drm_amdgpu_bo_list_entry { /** Handle of BO */ __u32 bo_handle; /** New (if specified) BO priority to be used during migration */ __u32 bo_priority; }; struct drm_amdgpu_bo_list_out { /** Handle of resource list */ __u32 list_handle; __u32 _pad; }; union drm_amdgpu_bo_list { struct drm_amdgpu_bo_list_in in; struct drm_amdgpu_bo_list_out out; }; /* context related */ #define AMDGPU_CTX_OP_ALLOC_CTX 1 #define AMDGPU_CTX_OP_FREE_CTX 2 #define AMDGPU_CTX_OP_QUERY_STATE 3 #define AMDGPU_CTX_OP_QUERY_STATE2 4 /* GPU reset status */ #define AMDGPU_CTX_NO_RESET 0 /* this the context caused it */ #define AMDGPU_CTX_GUILTY_RESET 1 /* some other context caused it */ #define AMDGPU_CTX_INNOCENT_RESET 2 /* unknown cause */ #define AMDGPU_CTX_UNKNOWN_RESET 3 /* indicate gpu reset occured after ctx created */ #define AMDGPU_CTX_QUERY2_FLAGS_RESET (1<<0) /* indicate vram lost occured after ctx created */ #define AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST (1<<1) /* indicate some job from this context once cause gpu hang */ #define AMDGPU_CTX_QUERY2_FLAGS_GUILTY (1<<2) /* Context priority level */ #define AMDGPU_CTX_PRIORITY_UNSET -2048 #define AMDGPU_CTX_PRIORITY_VERY_LOW -1023 #define AMDGPU_CTX_PRIORITY_LOW -512 #define AMDGPU_CTX_PRIORITY_NORMAL 0 /* Selecting a priority above NORMAL requires CAP_SYS_NICE or DRM_MASTER */ #define AMDGPU_CTX_PRIORITY_HIGH 512 #define AMDGPU_CTX_PRIORITY_VERY_HIGH 1023 struct drm_amdgpu_ctx_in { /** AMDGPU_CTX_OP_* */ __u32 op; /** For future use, no flags defined so far */ __u32 flags; __u32 ctx_id; __s32 priority; }; union drm_amdgpu_ctx_out { struct { __u32 ctx_id; __u32 _pad; } alloc; struct { /** For future use, no flags defined so far */ __u64 flags; /** Number of resets caused by this context so far. */ __u32 hangs; /** Reset status since the last call of the ioctl. */ __u32 reset_status; } state; }; union drm_amdgpu_ctx { struct drm_amdgpu_ctx_in in; union drm_amdgpu_ctx_out out; }; /* vm ioctl */ #define AMDGPU_VM_OP_RESERVE_VMID 1 #define AMDGPU_VM_OP_UNRESERVE_VMID 2 struct drm_amdgpu_vm_in { /** AMDGPU_VM_OP_* */ __u32 op; __u32 flags; }; struct drm_amdgpu_vm_out { /** For future use, no flags defined so far */ __u64 flags; }; union drm_amdgpu_vm { struct drm_amdgpu_vm_in in; struct drm_amdgpu_vm_out out; }; /* sched ioctl */ #define AMDGPU_SCHED_OP_PROCESS_PRIORITY_OVERRIDE 1 #define AMDGPU_SCHED_OP_CONTEXT_PRIORITY_OVERRIDE 2 struct drm_amdgpu_sched_in { /* AMDGPU_SCHED_OP_* */ __u32 op; __u32 fd; __s32 priority; __u32 ctx_id; }; union drm_amdgpu_sched { struct drm_amdgpu_sched_in in; }; /* * This is not a reliable API and you should expect it to fail for any * number of reasons and have fallback path that do not use userptr to * perform any operation. */ #define AMDGPU_GEM_USERPTR_READONLY (1 << 0) #define AMDGPU_GEM_USERPTR_ANONONLY (1 << 1) #define AMDGPU_GEM_USERPTR_VALIDATE (1 << 2) #define AMDGPU_GEM_USERPTR_REGISTER (1 << 3) struct drm_amdgpu_gem_userptr { __u64 addr; __u64 size; /* AMDGPU_GEM_USERPTR_* */ __u32 flags; /* Resulting GEM handle */ __u32 handle; }; /* SI-CI-VI: */ /* same meaning as the GB_TILE_MODE and GL_MACRO_TILE_MODE fields */ #define AMDGPU_TILING_ARRAY_MODE_SHIFT 0 #define AMDGPU_TILING_ARRAY_MODE_MASK 0xf #define AMDGPU_TILING_PIPE_CONFIG_SHIFT 4 #define AMDGPU_TILING_PIPE_CONFIG_MASK 0x1f #define AMDGPU_TILING_TILE_SPLIT_SHIFT 9 #define AMDGPU_TILING_TILE_SPLIT_MASK 0x7 #define AMDGPU_TILING_MICRO_TILE_MODE_SHIFT 12 #define AMDGPU_TILING_MICRO_TILE_MODE_MASK 0x7 #define AMDGPU_TILING_BANK_WIDTH_SHIFT 15 #define AMDGPU_TILING_BANK_WIDTH_MASK 0x3 #define AMDGPU_TILING_BANK_HEIGHT_SHIFT 17 #define AMDGPU_TILING_BANK_HEIGHT_MASK 0x3 #define AMDGPU_TILING_MACRO_TILE_ASPECT_SHIFT 19 #define AMDGPU_TILING_MACRO_TILE_ASPECT_MASK 0x3 #define AMDGPU_TILING_NUM_BANKS_SHIFT 21 #define AMDGPU_TILING_NUM_BANKS_MASK 0x3 /* GFX9 and later: */ #define AMDGPU_TILING_SWIZZLE_MODE_SHIFT 0 #define AMDGPU_TILING_SWIZZLE_MODE_MASK 0x1f /* Set/Get helpers for tiling flags. */ #define AMDGPU_TILING_SET(field, value) \ (((__u64)(value) & AMDGPU_TILING_##field##_MASK) << AMDGPU_TILING_##field##_SHIFT) #define AMDGPU_TILING_GET(value, field) \ (((__u64)(value) >> AMDGPU_TILING_##field##_SHIFT) & AMDGPU_TILING_##field##_MASK) #define AMDGPU_GEM_METADATA_OP_SET_METADATA 1 #define AMDGPU_GEM_METADATA_OP_GET_METADATA 2 /** The same structure is shared for input/output */ struct drm_amdgpu_gem_metadata { /** GEM Object handle */ __u32 handle; /** Do we want get or set metadata */ __u32 op; struct { /** For future use, no flags defined so far */ __u64 flags; /** family specific tiling info */ __u64 tiling_info; __u32 data_size_bytes; __u32 data[64]; } data; }; struct drm_amdgpu_gem_mmap_in { /** the GEM object handle */ __u32 handle; __u32 _pad; }; struct drm_amdgpu_gem_mmap_out { /** mmap offset from the vma offset manager */ __u64 addr_ptr; }; union drm_amdgpu_gem_mmap { struct drm_amdgpu_gem_mmap_in in; struct drm_amdgpu_gem_mmap_out out; }; struct drm_amdgpu_gem_wait_idle_in { /** GEM object handle */ __u32 handle; /** For future use, no flags defined so far */ __u32 flags; /** Absolute timeout to wait */ __u64 timeout; }; struct drm_amdgpu_gem_wait_idle_out { /** BO status: 0 - BO is idle, 1 - BO is busy */ __u32 status; /** Returned current memory domain */ __u32 domain; }; union drm_amdgpu_gem_wait_idle { struct drm_amdgpu_gem_wait_idle_in in; struct drm_amdgpu_gem_wait_idle_out out; }; struct drm_amdgpu_wait_cs_in { /* Command submission handle * handle equals 0 means none to wait for * handle equals ~0ull means wait for the latest sequence number */ __u64 handle; /** Absolute timeout to wait */ __u64 timeout; __u32 ip_type; __u32 ip_instance; __u32 ring; __u32 ctx_id; }; struct drm_amdgpu_wait_cs_out { /** CS status: 0 - CS completed, 1 - CS still busy */ __u64 status; }; union drm_amdgpu_wait_cs { struct drm_amdgpu_wait_cs_in in; struct drm_amdgpu_wait_cs_out out; }; struct drm_amdgpu_fence { __u32 ctx_id; __u32 ip_type; __u32 ip_instance; __u32 ring; __u64 seq_no; }; struct drm_amdgpu_wait_fences_in { /** This points to uint64_t * which points to fences */ __u64 fences; __u32 fence_count; __u32 wait_all; __u64 timeout_ns; }; struct drm_amdgpu_wait_fences_out { __u32 status; __u32 first_signaled; }; union drm_amdgpu_wait_fences { struct drm_amdgpu_wait_fences_in in; struct drm_amdgpu_wait_fences_out out; }; #define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO 0 #define AMDGPU_GEM_OP_SET_PLACEMENT 1 /* Sets or returns a value associated with a buffer. */ struct drm_amdgpu_gem_op { /** GEM object handle */ __u32 handle; /** AMDGPU_GEM_OP_* */ __u32 op; /** Input or return value */ __u64 value; }; #define AMDGPU_VA_OP_MAP 1 #define AMDGPU_VA_OP_UNMAP 2 #define AMDGPU_VA_OP_CLEAR 3 #define AMDGPU_VA_OP_REPLACE 4 /* Delay the page table update till the next CS */ #define AMDGPU_VM_DELAY_UPDATE (1 << 0) /* Mapping flags */ /* readable mapping */ #define AMDGPU_VM_PAGE_READABLE (1 << 1) /* writable mapping */ #define AMDGPU_VM_PAGE_WRITEABLE (1 << 2) /* executable mapping, new for VI */ #define AMDGPU_VM_PAGE_EXECUTABLE (1 << 3) /* partially resident texture */ #define AMDGPU_VM_PAGE_PRT (1 << 4) /* MTYPE flags use bit 5 to 8 */ #define AMDGPU_VM_MTYPE_MASK (0xf << 5) /* Default MTYPE. Pre-AI must use this. Recommended for newer ASICs. */ #define AMDGPU_VM_MTYPE_DEFAULT (0 << 5) /* Use NC MTYPE instead of default MTYPE */ #define AMDGPU_VM_MTYPE_NC (1 << 5) /* Use WC MTYPE instead of default MTYPE */ #define AMDGPU_VM_MTYPE_WC (2 << 5) /* Use CC MTYPE instead of default MTYPE */ #define AMDGPU_VM_MTYPE_CC (3 << 5) /* Use UC MTYPE instead of default MTYPE */ #define AMDGPU_VM_MTYPE_UC (4 << 5) struct drm_amdgpu_gem_va { /** GEM object handle */ __u32 handle; __u32 _pad; /** AMDGPU_VA_OP_* */ __u32 operation; /** AMDGPU_VM_PAGE_* */ __u32 flags; /** va address to assign . Must be correctly aligned.*/ __u64 va_address; /** Specify offset inside of BO to assign. Must be correctly aligned.*/ __u64 offset_in_bo; /** Specify mapping size. Must be correctly aligned. */ __u64 map_size; }; #define AMDGPU_HW_IP_GFX 0 #define AMDGPU_HW_IP_COMPUTE 1 #define AMDGPU_HW_IP_DMA 2 #define AMDGPU_HW_IP_UVD 3 #define AMDGPU_HW_IP_VCE 4 #define AMDGPU_HW_IP_UVD_ENC 5 #define AMDGPU_HW_IP_VCN_DEC 6 #define AMDGPU_HW_IP_VCN_ENC 7 #define AMDGPU_HW_IP_VCN_JPEG 8 #define AMDGPU_HW_IP_NUM 9 #define AMDGPU_HW_IP_INSTANCE_MAX_COUNT 1 #define AMDGPU_CHUNK_ID_IB 0x01 #define AMDGPU_CHUNK_ID_FENCE 0x02 #define AMDGPU_CHUNK_ID_DEPENDENCIES 0x03 #define AMDGPU_CHUNK_ID_SYNCOBJ_IN 0x04 #define AMDGPU_CHUNK_ID_SYNCOBJ_OUT 0x05 #define AMDGPU_CHUNK_ID_BO_HANDLES 0x06 struct drm_amdgpu_cs_chunk { __u32 chunk_id; __u32 length_dw; __u64 chunk_data; }; struct drm_amdgpu_cs_in { /** Rendering context id */ __u32 ctx_id; /** Handle of resource list associated with CS */ __u32 bo_list_handle; __u32 num_chunks; __u32 _pad; /** this points to __u64 * which point to cs chunks */ __u64 chunks; }; struct drm_amdgpu_cs_out { __u64 handle; }; union drm_amdgpu_cs { struct drm_amdgpu_cs_in in; struct drm_amdgpu_cs_out out; }; /* Specify flags to be used for IB */ /* This IB should be submitted to CE */ #define AMDGPU_IB_FLAG_CE (1<<0) /* Preamble flag, which means the IB could be dropped if no context switch */ #define AMDGPU_IB_FLAG_PREAMBLE (1<<1) /* Preempt flag, IB should set Pre_enb bit if PREEMPT flag detected */ #define AMDGPU_IB_FLAG_PREEMPT (1<<2) /* The IB fence should do the L2 writeback but not invalidate any shader * caches (L2/vL1/sL1/I$). */ #define AMDGPU_IB_FLAG_TC_WB_NOT_INVALIDATE (1 << 3) struct drm_amdgpu_cs_chunk_ib { __u32 _pad; /** AMDGPU_IB_FLAG_* */ __u32 flags; /** Virtual address to begin IB execution */ __u64 va_start; /** Size of submission */ __u32 ib_bytes; /** HW IP to submit to */ __u32 ip_type; /** HW IP index of the same type to submit to */ __u32 ip_instance; /** Ring index to submit to */ __u32 ring; }; struct drm_amdgpu_cs_chunk_dep { __u32 ip_type; __u32 ip_instance; __u32 ring; __u32 ctx_id; __u64 handle; }; struct drm_amdgpu_cs_chunk_fence { __u32 handle; __u32 offset; }; struct drm_amdgpu_cs_chunk_sem { __u32 handle; }; #define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ 0 #define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ_FD 1 #define AMDGPU_FENCE_TO_HANDLE_GET_SYNC_FILE_FD 2 union drm_amdgpu_fence_to_handle { struct { struct drm_amdgpu_fence fence; __u32 what; __u32 pad; } in; struct { __u32 handle; } out; }; struct drm_amdgpu_cs_chunk_data { union { struct drm_amdgpu_cs_chunk_ib ib_data; struct drm_amdgpu_cs_chunk_fence fence_data; }; }; /** * Query h/w info: Flag that this is integrated (a.h.a. fusion) GPU * */ #define AMDGPU_IDS_FLAGS_FUSION 0x1 #define AMDGPU_IDS_FLAGS_PREEMPTION 0x2 /* indicate if acceleration can be working */ #define AMDGPU_INFO_ACCEL_WORKING 0x00 /* get the crtc_id from the mode object id? */ #define AMDGPU_INFO_CRTC_FROM_ID 0x01 /* query hw IP info */ #define AMDGPU_INFO_HW_IP_INFO 0x02 /* query hw IP instance count for the specified type */ #define AMDGPU_INFO_HW_IP_COUNT 0x03 /* timestamp for GL_ARB_timer_query */ #define AMDGPU_INFO_TIMESTAMP 0x05 /* Query the firmware version */ #define AMDGPU_INFO_FW_VERSION 0x0e /* Subquery id: Query VCE firmware version */ #define AMDGPU_INFO_FW_VCE 0x1 /* Subquery id: Query UVD firmware version */ #define AMDGPU_INFO_FW_UVD 0x2 /* Subquery id: Query GMC firmware version */ #define AMDGPU_INFO_FW_GMC 0x03 /* Subquery id: Query GFX ME firmware version */ #define AMDGPU_INFO_FW_GFX_ME 0x04 /* Subquery id: Query GFX PFP firmware version */ #define AMDGPU_INFO_FW_GFX_PFP 0x05 /* Subquery id: Query GFX CE firmware version */ #define AMDGPU_INFO_FW_GFX_CE 0x06 /* Subquery id: Query GFX RLC firmware version */ #define AMDGPU_INFO_FW_GFX_RLC 0x07 /* Subquery id: Query GFX MEC firmware version */ #define AMDGPU_INFO_FW_GFX_MEC 0x08 /* Subquery id: Query SMC firmware version */ #define AMDGPU_INFO_FW_SMC 0x0a /* Subquery id: Query SDMA firmware version */ #define AMDGPU_INFO_FW_SDMA 0x0b /* Subquery id: Query PSP SOS firmware version */ #define AMDGPU_INFO_FW_SOS 0x0c /* Subquery id: Query PSP ASD firmware version */ #define AMDGPU_INFO_FW_ASD 0x0d /* Subquery id: Query VCN firmware version */ #define AMDGPU_INFO_FW_VCN 0x0e /* Subquery id: Query GFX RLC SRLC firmware version */ #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_CNTL 0x0f /* Subquery id: Query GFX RLC SRLG firmware version */ #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_GPM_MEM 0x10 /* Subquery id: Query GFX RLC SRLS firmware version */ #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_SRM_MEM 0x11 /* number of bytes moved for TTM migration */ #define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f /* the used VRAM size */ #define AMDGPU_INFO_VRAM_USAGE 0x10 /* the used GTT size */ #define AMDGPU_INFO_GTT_USAGE 0x11 /* Information about GDS, etc. resource configuration */ #define AMDGPU_INFO_GDS_CONFIG 0x13 /* Query information about VRAM and GTT domains */ #define AMDGPU_INFO_VRAM_GTT 0x14 /* Query information about register in MMR address space*/ #define AMDGPU_INFO_READ_MMR_REG 0x15 /* Query information about device: rev id, family, etc. */ #define AMDGPU_INFO_DEV_INFO 0x16 /* visible vram usage */ #define AMDGPU_INFO_VIS_VRAM_USAGE 0x17 /* number of TTM buffer evictions */ #define AMDGPU_INFO_NUM_EVICTIONS 0x18 /* Query memory about VRAM and GTT domains */ #define AMDGPU_INFO_MEMORY 0x19 /* Query vce clock table */ #define AMDGPU_INFO_VCE_CLOCK_TABLE 0x1A /* Query vbios related information */ #define AMDGPU_INFO_VBIOS 0x1B /* Subquery id: Query vbios size */ #define AMDGPU_INFO_VBIOS_SIZE 0x1 /* Subquery id: Query vbios image */ #define AMDGPU_INFO_VBIOS_IMAGE 0x2 /* Query UVD handles */ #define AMDGPU_INFO_NUM_HANDLES 0x1C /* Query sensor related information */ #define AMDGPU_INFO_SENSOR 0x1D /* Subquery id: Query GPU shader clock */ #define AMDGPU_INFO_SENSOR_GFX_SCLK 0x1 /* Subquery id: Query GPU memory clock */ #define AMDGPU_INFO_SENSOR_GFX_MCLK 0x2 /* Subquery id: Query GPU temperature */ #define AMDGPU_INFO_SENSOR_GPU_TEMP 0x3 /* Subquery id: Query GPU load */ #define AMDGPU_INFO_SENSOR_GPU_LOAD 0x4 /* Subquery id: Query average GPU power */ #define AMDGPU_INFO_SENSOR_GPU_AVG_POWER 0x5 /* Subquery id: Query northbridge voltage */ #define AMDGPU_INFO_SENSOR_VDDNB 0x6 /* Subquery id: Query graphics voltage */ #define AMDGPU_INFO_SENSOR_VDDGFX 0x7 /* Subquery id: Query GPU stable pstate shader clock */ #define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_SCLK 0x8 /* Subquery id: Query GPU stable pstate memory clock */ #define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_MCLK 0x9 /* Number of VRAM page faults on CPU access. */ #define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS 0x1E #define AMDGPU_INFO_VRAM_LOST_COUNTER 0x1F #define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0 #define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff #define AMDGPU_INFO_MMR_SH_INDEX_SHIFT 8 #define AMDGPU_INFO_MMR_SH_INDEX_MASK 0xff struct drm_amdgpu_query_fw { /** AMDGPU_INFO_FW_* */ __u32 fw_type; /** * Index of the IP if there are more IPs of * the same type. */ __u32 ip_instance; /** * Index of the engine. Whether this is used depends * on the firmware type. (e.g. MEC, SDMA) */ __u32 index; __u32 _pad; }; /* Input structure for the INFO ioctl */ struct drm_amdgpu_info { /* Where the return value will be stored */ __u64 return_pointer; /* The size of the return value. Just like "size" in "snprintf", * it limits how many bytes the kernel can write. */ __u32 return_size; /* The query request id. */ __u32 query; union { struct { __u32 id; __u32 _pad; } mode_crtc; struct { /** AMDGPU_HW_IP_* */ __u32 type; /** * Index of the IP if there are more IPs of the same * type. Ignored by AMDGPU_INFO_HW_IP_COUNT. */ __u32 ip_instance; } query_hw_ip; struct { __u32 dword_offset; /** number of registers to read */ __u32 count; __u32 instance; /** For future use, no flags defined so far */ __u32 flags; } read_mmr_reg; struct drm_amdgpu_query_fw query_fw; struct { __u32 type; __u32 offset; } vbios_info; struct { __u32 type; } sensor_info; }; }; struct drm_amdgpu_info_gds { /** GDS GFX partition size */ __u32 gds_gfx_partition_size; /** GDS compute partition size */ __u32 compute_partition_size; /** total GDS memory size */ __u32 gds_total_size; /** GWS size per GFX partition */ __u32 gws_per_gfx_partition; /** GSW size per compute partition */ __u32 gws_per_compute_partition; /** OA size per GFX partition */ __u32 oa_per_gfx_partition; /** OA size per compute partition */ __u32 oa_per_compute_partition; __u32 _pad; }; struct drm_amdgpu_info_vram_gtt { __u64 vram_size; __u64 vram_cpu_accessible_size; __u64 gtt_size; }; struct drm_amdgpu_heap_info { /** max. physical memory */ __u64 total_heap_size; /** Theoretical max. available memory in the given heap */ __u64 usable_heap_size; /** * Number of bytes allocated in the heap. This includes all processes * and private allocations in the kernel. It changes when new buffers * are allocated, freed, and moved. It cannot be larger than * heap_size. */ __u64 heap_usage; /** * Theoretical possible max. size of buffer which * could be allocated in the given heap */ __u64 max_allocation; }; struct drm_amdgpu_memory_info { struct drm_amdgpu_heap_info vram; struct drm_amdgpu_heap_info cpu_accessible_vram; struct drm_amdgpu_heap_info gtt; }; struct drm_amdgpu_info_firmware { __u32 ver; __u32 feature; }; #define AMDGPU_VRAM_TYPE_UNKNOWN 0 #define AMDGPU_VRAM_TYPE_GDDR1 1 #define AMDGPU_VRAM_TYPE_DDR2 2 #define AMDGPU_VRAM_TYPE_GDDR3 3 #define AMDGPU_VRAM_TYPE_GDDR4 4 #define AMDGPU_VRAM_TYPE_GDDR5 5 #define AMDGPU_VRAM_TYPE_HBM 6 #define AMDGPU_VRAM_TYPE_DDR3 7 #define AMDGPU_VRAM_TYPE_DDR4 8 struct drm_amdgpu_info_device { /** PCI Device ID */ __u32 device_id; /** Internal chip revision: A0, A1, etc.) */ __u32 chip_rev; __u32 external_rev; /** Revision id in PCI Config space */ __u32 pci_rev; __u32 family; __u32 num_shader_engines; __u32 num_shader_arrays_per_engine; /* in KHz */ __u32 gpu_counter_freq; __u64 max_engine_clock; __u64 max_memory_clock; /* cu information */ __u32 cu_active_number; /* NOTE: cu_ao_mask is INVALID, DON'T use it */ __u32 cu_ao_mask; __u32 cu_bitmap[4][4]; /** Render backend pipe mask. One render backend is CB+DB. */ __u32 enabled_rb_pipes_mask; __u32 num_rb_pipes; __u32 num_hw_gfx_contexts; __u32 _pad; __u64 ids_flags; /** Starting virtual address for UMDs. */ __u64 virtual_address_offset; /** The maximum virtual address */ __u64 virtual_address_max; /** Required alignment of virtual addresses. */ __u32 virtual_address_alignment; /** Page table entry - fragment size */ __u32 pte_fragment_size; __u32 gart_page_size; /** constant engine ram size*/ __u32 ce_ram_size; /** video memory type info*/ __u32 vram_type; /** video memory bit width*/ __u32 vram_bit_width; /* vce harvesting instance */ __u32 vce_harvest_config; /* gfx double offchip LDS buffers */ __u32 gc_double_offchip_lds_buf; /* NGG Primitive Buffer */ __u64 prim_buf_gpu_addr; /* NGG Position Buffer */ __u64 pos_buf_gpu_addr; /* NGG Control Sideband */ __u64 cntl_sb_buf_gpu_addr; /* NGG Parameter Cache */ __u64 param_buf_gpu_addr; __u32 prim_buf_size; __u32 pos_buf_size; __u32 cntl_sb_buf_size; __u32 param_buf_size; /* wavefront size*/ __u32 wave_front_size; /* shader visible vgprs*/ __u32 num_shader_visible_vgprs; /* CU per shader array*/ __u32 num_cu_per_sh; /* number of tcc blocks*/ __u32 num_tcc_blocks; /* gs vgt table depth*/ __u32 gs_vgt_table_depth; /* gs primitive buffer depth*/ __u32 gs_prim_buffer_depth; /* max gs wavefront per vgt*/ __u32 max_gs_waves_per_vgt; __u32 _pad1; /* always on cu bitmap */ __u32 cu_ao_bitmap[4][4]; /** Starting high virtual address for UMDs. */ __u64 high_va_offset; /** The maximum high virtual address */ __u64 high_va_max; }; struct drm_amdgpu_info_hw_ip { /** Version of h/w IP */ __u32 hw_ip_version_major; __u32 hw_ip_version_minor; /** Capabilities */ __u64 capabilities_flags; /** command buffer address start alignment*/ __u32 ib_start_alignment; /** command buffer size alignment*/ __u32 ib_size_alignment; /** Bitmask of available rings. Bit 0 means ring 0, etc. */ __u32 available_rings; __u32 _pad; }; struct drm_amdgpu_info_num_handles { /** Max handles as supported by firmware for UVD */ __u32 uvd_max_handles; /** Handles currently in use for UVD */ __u32 uvd_used_handles; }; #define AMDGPU_VCE_CLOCK_TABLE_ENTRIES 6 struct drm_amdgpu_info_vce_clock_table_entry { /** System clock */ __u32 sclk; /** Memory clock */ __u32 mclk; /** VCE clock */ __u32 eclk; __u32 pad; }; struct drm_amdgpu_info_vce_clock_table { struct drm_amdgpu_info_vce_clock_table_entry entries[AMDGPU_VCE_CLOCK_TABLE_ENTRIES]; __u32 num_valid_entries; __u32 pad; }; /* * Supported GPU families */ #define AMDGPU_FAMILY_UNKNOWN 0 #define AMDGPU_FAMILY_SI 110 /* Hainan, Oland, Verde, Pitcairn, Tahiti */ #define AMDGPU_FAMILY_CI 120 /* Bonaire, Hawaii */ #define AMDGPU_FAMILY_KV 125 /* Kaveri, Kabini, Mullins */ #define AMDGPU_FAMILY_VI 130 /* Iceland, Tonga */ #define AMDGPU_FAMILY_CZ 135 /* Carrizo, Stoney */ #define AMDGPU_FAMILY_AI 141 /* Vega10 */ #define AMDGPU_FAMILY_RV 142 /* Raven */ #if defined(__cplusplus) } #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/exynos_drm.h������������������������������������������������������������������������������������0000644�����������������00000025574�14763166027�0007717 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* exynos_drm.h * * Copyright (c) 2011 Samsung Electronics Co., Ltd. * Authors: * Inki Dae <inki.dae@samsung.com> * Joonyoung Shim <jy0922.shim@samsung.com> * Seung-Woo Kim <sw0312.kim@samsung.com> * * 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. */ #ifndef _EXYNOS_DRM_H_ #define _EXYNOS_DRM_H_ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /** * User-desired buffer creation information structure. * * @size: user-desired memory allocation size. * - this size value would be page-aligned internally. * @flags: user request for setting memory type or cache attributes. * @handle: returned a handle to created gem object. * - this handle will be set by gem module of kernel side. */ struct drm_exynos_gem_create { __u64 size; __u32 flags; __u32 handle; }; /** * A structure for getting a fake-offset that can be used with mmap. * * @handle: handle of gem object. * @reserved: just padding to be 64-bit aligned. * @offset: a fake-offset of gem object. */ struct drm_exynos_gem_map { __u32 handle; __u32 reserved; __u64 offset; }; /** * A structure to gem information. * * @handle: a handle to gem object created. * @flags: flag value including memory type and cache attribute and * this value would be set by driver. * @size: size to memory region allocated by gem and this size would * be set by driver. */ struct drm_exynos_gem_info { __u32 handle; __u32 flags; __u64 size; }; /** * A structure for user connection request of virtual display. * * @connection: indicate whether doing connetion or not by user. * @extensions: if this value is 1 then the vidi driver would need additional * 128bytes edid data. * @edid: the edid data pointer from user side. */ struct drm_exynos_vidi_connection { __u32 connection; __u32 extensions; __u64 edid; }; /* memory type definitions. */ enum e_drm_exynos_gem_mem_type { /* Physically Continuous memory and used as default. */ EXYNOS_BO_CONTIG = 0 << 0, /* Physically Non-Continuous memory. */ EXYNOS_BO_NONCONTIG = 1 << 0, /* non-cachable mapping and used as default. */ EXYNOS_BO_NONCACHABLE = 0 << 1, /* cachable mapping. */ EXYNOS_BO_CACHABLE = 1 << 1, /* write-combine mapping. */ EXYNOS_BO_WC = 1 << 2, EXYNOS_BO_MASK = EXYNOS_BO_NONCONTIG | EXYNOS_BO_CACHABLE | EXYNOS_BO_WC }; struct drm_exynos_g2d_get_ver { __u32 major; __u32 minor; }; struct drm_exynos_g2d_cmd { __u32 offset; __u32 data; }; enum drm_exynos_g2d_buf_type { G2D_BUF_USERPTR = 1 << 31, }; enum drm_exynos_g2d_event_type { G2D_EVENT_NOT, G2D_EVENT_NONSTOP, G2D_EVENT_STOP, /* not yet */ }; struct drm_exynos_g2d_userptr { unsigned long userptr; unsigned long size; }; struct drm_exynos_g2d_set_cmdlist { __u64 cmd; __u64 cmd_buf; __u32 cmd_nr; __u32 cmd_buf_nr; /* for g2d event */ __u64 event_type; __u64 user_data; }; struct drm_exynos_g2d_exec { __u64 async; }; /* Exynos DRM IPP v2 API */ /** * Enumerate available IPP hardware modules. * * @count_ipps: size of ipp_id array / number of ipp modules (set by driver) * @reserved: padding * @ipp_id_ptr: pointer to ipp_id array or NULL */ struct drm_exynos_ioctl_ipp_get_res { __u32 count_ipps; __u32 reserved; __u64 ipp_id_ptr; }; enum drm_exynos_ipp_format_type { DRM_EXYNOS_IPP_FORMAT_SOURCE = 0x01, DRM_EXYNOS_IPP_FORMAT_DESTINATION = 0x02, }; struct drm_exynos_ipp_format { __u32 fourcc; __u32 type; __u64 modifier; }; enum drm_exynos_ipp_capability { DRM_EXYNOS_IPP_CAP_CROP = 0x01, DRM_EXYNOS_IPP_CAP_ROTATE = 0x02, DRM_EXYNOS_IPP_CAP_SCALE = 0x04, DRM_EXYNOS_IPP_CAP_CONVERT = 0x08, }; /** * Get IPP hardware capabilities and supported image formats. * * @ipp_id: id of IPP module to query * @capabilities: bitmask of drm_exynos_ipp_capability (set by driver) * @reserved: padding * @formats_count: size of formats array (in entries) / number of filled * formats (set by driver) * @formats_ptr: pointer to formats array or NULL */ struct drm_exynos_ioctl_ipp_get_caps { __u32 ipp_id; __u32 capabilities; __u32 reserved; __u32 formats_count; __u64 formats_ptr; }; enum drm_exynos_ipp_limit_type { /* size (horizontal/vertial) limits, in pixels (min, max, alignment) */ DRM_EXYNOS_IPP_LIMIT_TYPE_SIZE = 0x0001, /* scale ratio (horizonta/vertial), 16.16 fixed point (min, max) */ DRM_EXYNOS_IPP_LIMIT_TYPE_SCALE = 0x0002, /* image buffer area */ DRM_EXYNOS_IPP_LIMIT_SIZE_BUFFER = 0x0001 << 16, /* src/dst rectangle area */ DRM_EXYNOS_IPP_LIMIT_SIZE_AREA = 0x0002 << 16, /* src/dst rectangle area when rotation enabled */ DRM_EXYNOS_IPP_LIMIT_SIZE_ROTATED = 0x0003 << 16, DRM_EXYNOS_IPP_LIMIT_TYPE_MASK = 0x000f, DRM_EXYNOS_IPP_LIMIT_SIZE_MASK = 0x000f << 16, }; struct drm_exynos_ipp_limit_val { __u32 min; __u32 max; __u32 align; __u32 reserved; }; /** * IPP module limitation. * * @type: limit type (see drm_exynos_ipp_limit_type enum) * @reserved: padding * @h: horizontal limits * @v: vertical limits */ struct drm_exynos_ipp_limit { __u32 type; __u32 reserved; struct drm_exynos_ipp_limit_val h; struct drm_exynos_ipp_limit_val v; }; /** * Get IPP limits for given image format. * * @ipp_id: id of IPP module to query * @fourcc: image format code (see DRM_FORMAT_* in drm_fourcc.h) * @modifier: image format modifier (see DRM_FORMAT_MOD_* in drm_fourcc.h) * @type: source/destination identifier (drm_exynos_ipp_format_flag enum) * @limits_count: size of limits array (in entries) / number of filled entries * (set by driver) * @limits_ptr: pointer to limits array or NULL */ struct drm_exynos_ioctl_ipp_get_limits { __u32 ipp_id; __u32 fourcc; __u64 modifier; __u32 type; __u32 limits_count; __u64 limits_ptr; }; enum drm_exynos_ipp_task_id { /* buffer described by struct drm_exynos_ipp_task_buffer */ DRM_EXYNOS_IPP_TASK_BUFFER = 0x0001, /* rectangle described by struct drm_exynos_ipp_task_rect */ DRM_EXYNOS_IPP_TASK_RECTANGLE = 0x0002, /* transformation described by struct drm_exynos_ipp_task_transform */ DRM_EXYNOS_IPP_TASK_TRANSFORM = 0x0003, /* alpha configuration described by struct drm_exynos_ipp_task_alpha */ DRM_EXYNOS_IPP_TASK_ALPHA = 0x0004, /* source image data (for buffer and rectangle chunks) */ DRM_EXYNOS_IPP_TASK_TYPE_SOURCE = 0x0001 << 16, /* destination image data (for buffer and rectangle chunks) */ DRM_EXYNOS_IPP_TASK_TYPE_DESTINATION = 0x0002 << 16, }; /** * Memory buffer with image data. * * @id: must be DRM_EXYNOS_IPP_TASK_BUFFER * other parameters are same as for AddFB2 generic DRM ioctl */ struct drm_exynos_ipp_task_buffer { __u32 id; __u32 fourcc; __u32 width, height; __u32 gem_id[4]; __u32 offset[4]; __u32 pitch[4]; __u64 modifier; }; /** * Rectangle for processing. * * @id: must be DRM_EXYNOS_IPP_TASK_RECTANGLE * @reserved: padding * @x,@y: left corner in pixels * @w,@h: width/height in pixels */ struct drm_exynos_ipp_task_rect { __u32 id; __u32 reserved; __u32 x; __u32 y; __u32 w; __u32 h; }; /** * Image tranformation description. * * @id: must be DRM_EXYNOS_IPP_TASK_TRANSFORM * @rotation: DRM_MODE_ROTATE_* and DRM_MODE_REFLECT_* values */ struct drm_exynos_ipp_task_transform { __u32 id; __u32 rotation; }; /** * Image global alpha configuration for formats without alpha values. * * @id: must be DRM_EXYNOS_IPP_TASK_ALPHA * @value: global alpha value (0-255) */ struct drm_exynos_ipp_task_alpha { __u32 id; __u32 value; }; enum drm_exynos_ipp_flag { /* generate DRM event after processing */ DRM_EXYNOS_IPP_FLAG_EVENT = 0x01, /* dry run, only check task parameters */ DRM_EXYNOS_IPP_FLAG_TEST_ONLY = 0x02, /* non-blocking processing */ DRM_EXYNOS_IPP_FLAG_NONBLOCK = 0x04, }; #define DRM_EXYNOS_IPP_FLAGS (DRM_EXYNOS_IPP_FLAG_EVENT |\ DRM_EXYNOS_IPP_FLAG_TEST_ONLY | DRM_EXYNOS_IPP_FLAG_NONBLOCK) /** * Perform image processing described by array of drm_exynos_ipp_task_* * structures (parameters array). * * @ipp_id: id of IPP module to run the task * @flags: bitmask of drm_exynos_ipp_flag values * @reserved: padding * @params_size: size of parameters array (in bytes) * @params_ptr: pointer to parameters array or NULL * @user_data: (optional) data for drm event */ struct drm_exynos_ioctl_ipp_commit { __u32 ipp_id; __u32 flags; __u32 reserved; __u32 params_size; __u64 params_ptr; __u64 user_data; }; #define DRM_EXYNOS_GEM_CREATE 0x00 #define DRM_EXYNOS_GEM_MAP 0x01 /* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */ #define DRM_EXYNOS_GEM_GET 0x04 #define DRM_EXYNOS_VIDI_CONNECTION 0x07 /* G2D */ #define DRM_EXYNOS_G2D_GET_VER 0x20 #define DRM_EXYNOS_G2D_SET_CMDLIST 0x21 #define DRM_EXYNOS_G2D_EXEC 0x22 /* Reserved 0x30 ~ 0x33 for obsolete Exynos IPP ioctls */ /* IPP - Image Post Processing */ #define DRM_EXYNOS_IPP_GET_RESOURCES 0x40 #define DRM_EXYNOS_IPP_GET_CAPS 0x41 #define DRM_EXYNOS_IPP_GET_LIMITS 0x42 #define DRM_EXYNOS_IPP_COMMIT 0x43 #define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create) #define DRM_IOCTL_EXYNOS_GEM_MAP DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_GEM_MAP, struct drm_exynos_gem_map) #define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info) #define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection) #define DRM_IOCTL_EXYNOS_G2D_GET_VER DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_G2D_GET_VER, struct drm_exynos_g2d_get_ver) #define DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_G2D_SET_CMDLIST, struct drm_exynos_g2d_set_cmdlist) #define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec) #define DRM_IOCTL_EXYNOS_IPP_GET_RESOURCES DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_IPP_GET_RESOURCES, \ struct drm_exynos_ioctl_ipp_get_res) #define DRM_IOCTL_EXYNOS_IPP_GET_CAPS DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_IPP_GET_CAPS, struct drm_exynos_ioctl_ipp_get_caps) #define DRM_IOCTL_EXYNOS_IPP_GET_LIMITS DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_IPP_GET_LIMITS, \ struct drm_exynos_ioctl_ipp_get_limits) #define DRM_IOCTL_EXYNOS_IPP_COMMIT DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_IPP_COMMIT, struct drm_exynos_ioctl_ipp_commit) /* EXYNOS specific events */ #define DRM_EXYNOS_G2D_EVENT 0x80000000 #define DRM_EXYNOS_IPP_EVENT 0x80000002 struct drm_exynos_g2d_event { struct drm_event base; __u64 user_data; __u32 tv_sec; __u32 tv_usec; __u32 cmdlist_no; __u32 reserved; }; struct drm_exynos_ipp_event { struct drm_event base; __u64 user_data; __u32 tv_sec; __u32 tv_usec; __u32 ipp_id; __u32 sequence; __u64 reserved; }; #if defined(__cplusplus) } #endif #endif /* _EXYNOS_DRM_H_ */ ������������������������������������������������������������������������������������������������������������������������������������drm/omap_drm.h��������������������������������������������������������������������������������������0000644�����������������00000010055�14763166027�0007312 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/uapi/drm/omap_drm.h * * Copyright (C) 2011 Texas Instruments * Author: Rob Clark <rob@ti.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. * * 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, see <http://www.gnu.org/licenses/>. */ #ifndef __OMAP_DRM_H__ #define __OMAP_DRM_H__ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* Please note that modifications to all structs defined here are * subject to backwards-compatibility constraints. */ #define OMAP_PARAM_CHIPSET_ID 1 /* ie. 0x3430, 0x4430, etc */ struct drm_omap_param { __u64 param; /* in */ __u64 value; /* in (set_param), out (get_param) */ }; #define OMAP_BO_SCANOUT 0x00000001 /* scanout capable (phys contiguous) */ #define OMAP_BO_CACHE_MASK 0x00000006 /* cache type mask, see cache modes */ #define OMAP_BO_TILED_MASK 0x00000f00 /* tiled mapping mask, see tiled modes */ /* cache modes */ #define OMAP_BO_CACHED 0x00000000 /* default */ #define OMAP_BO_WC 0x00000002 /* write-combine */ #define OMAP_BO_UNCACHED 0x00000004 /* strongly-ordered (uncached) */ /* tiled modes */ #define OMAP_BO_TILED_8 0x00000100 #define OMAP_BO_TILED_16 0x00000200 #define OMAP_BO_TILED_32 0x00000300 #define OMAP_BO_TILED (OMAP_BO_TILED_8 | OMAP_BO_TILED_16 | OMAP_BO_TILED_32) union omap_gem_size { __u32 bytes; /* (for non-tiled formats) */ struct { __u16 width; __u16 height; } tiled; /* (for tiled formats) */ }; struct drm_omap_gem_new { union omap_gem_size size; /* in */ __u32 flags; /* in */ __u32 handle; /* out */ __u32 __pad; }; /* mask of operations: */ enum omap_gem_op { OMAP_GEM_READ = 0x01, OMAP_GEM_WRITE = 0x02, }; struct drm_omap_gem_cpu_prep { __u32 handle; /* buffer handle (in) */ __u32 op; /* mask of omap_gem_op (in) */ }; struct drm_omap_gem_cpu_fini { __u32 handle; /* buffer handle (in) */ __u32 op; /* mask of omap_gem_op (in) */ /* TODO maybe here we pass down info about what regions are touched * by sw so we can be clever about cache ops? For now a placeholder, * set to zero and we just do full buffer flush.. */ __u32 nregions; __u32 __pad; }; struct drm_omap_gem_info { __u32 handle; /* buffer handle (in) */ __u32 pad; __u64 offset; /* mmap offset (out) */ /* note: in case of tiled buffers, the user virtual size can be * different from the physical size (ie. how many pages are needed * to back the object) which is returned in DRM_IOCTL_GEM_OPEN.. * This size here is the one that should be used if you want to * mmap() the buffer: */ __u32 size; /* virtual size for mmap'ing (out) */ __u32 __pad; }; #define DRM_OMAP_GET_PARAM 0x00 #define DRM_OMAP_SET_PARAM 0x01 #define DRM_OMAP_GEM_NEW 0x03 #define DRM_OMAP_GEM_CPU_PREP 0x04 /* Deprecated, to be removed */ #define DRM_OMAP_GEM_CPU_FINI 0x05 /* Deprecated, to be removed */ #define DRM_OMAP_GEM_INFO 0x06 #define DRM_OMAP_NUM_IOCTLS 0x07 #define DRM_IOCTL_OMAP_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GET_PARAM, struct drm_omap_param) #define DRM_IOCTL_OMAP_SET_PARAM DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_SET_PARAM, struct drm_omap_param) #define DRM_IOCTL_OMAP_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_NEW, struct drm_omap_gem_new) #define DRM_IOCTL_OMAP_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_PREP, struct drm_omap_gem_cpu_prep) #define DRM_IOCTL_OMAP_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_FINI, struct drm_omap_gem_cpu_fini) #define DRM_IOCTL_OMAP_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_INFO, struct drm_omap_gem_info) #if defined(__cplusplus) } #endif #endif /* __OMAP_DRM_H__ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/r128_drm.h��������������������������������������������������������������������������������������0000644�����������������00000023420�14763166027�0007052 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* r128_drm.h -- Public header for the r128 driver -*- linux-c -*- * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com */ /* * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Authors: * Gareth Hughes <gareth@valinux.com> * Kevin E. Martin <martin@valinux.com> */ #ifndef __R128_DRM_H__ #define __R128_DRM_H__ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* WARNING: If you change any of these defines, make sure to change the * defines in the X server file (r128_sarea.h) */ #ifndef __R128_SAREA_DEFINES__ #define __R128_SAREA_DEFINES__ /* What needs to be changed for the current vertex buffer? */ #define R128_UPLOAD_CONTEXT 0x001 #define R128_UPLOAD_SETUP 0x002 #define R128_UPLOAD_TEX0 0x004 #define R128_UPLOAD_TEX1 0x008 #define R128_UPLOAD_TEX0IMAGES 0x010 #define R128_UPLOAD_TEX1IMAGES 0x020 #define R128_UPLOAD_CORE 0x040 #define R128_UPLOAD_MASKS 0x080 #define R128_UPLOAD_WINDOW 0x100 #define R128_UPLOAD_CLIPRECTS 0x200 /* handled client-side */ #define R128_REQUIRE_QUIESCENCE 0x400 #define R128_UPLOAD_ALL 0x7ff #define R128_FRONT 0x1 #define R128_BACK 0x2 #define R128_DEPTH 0x4 /* Primitive types */ #define R128_POINTS 0x1 #define R128_LINES 0x2 #define R128_LINE_STRIP 0x3 #define R128_TRIANGLES 0x4 #define R128_TRIANGLE_FAN 0x5 #define R128_TRIANGLE_STRIP 0x6 /* Vertex/indirect buffer size */ #define R128_BUFFER_SIZE 16384 /* Byte offsets for indirect buffer data */ #define R128_INDEX_PRIM_OFFSET 20 #define R128_HOSTDATA_BLIT_OFFSET 32 /* Keep these small for testing. */ #define R128_NR_SAREA_CLIPRECTS 12 /* There are 2 heaps (local/AGP). Each region within a heap is a * minimum of 64k, and there are at most 64 of them per heap. */ #define R128_LOCAL_TEX_HEAP 0 #define R128_AGP_TEX_HEAP 1 #define R128_NR_TEX_HEAPS 2 #define R128_NR_TEX_REGIONS 64 #define R128_LOG_TEX_GRANULARITY 16 #define R128_NR_CONTEXT_REGS 12 #define R128_MAX_TEXTURE_LEVELS 11 #define R128_MAX_TEXTURE_UNITS 2 #endif /* __R128_SAREA_DEFINES__ */ typedef struct { /* Context state - can be written in one large chunk */ unsigned int dst_pitch_offset_c; unsigned int dp_gui_master_cntl_c; unsigned int sc_top_left_c; unsigned int sc_bottom_right_c; unsigned int z_offset_c; unsigned int z_pitch_c; unsigned int z_sten_cntl_c; unsigned int tex_cntl_c; unsigned int misc_3d_state_cntl_reg; unsigned int texture_clr_cmp_clr_c; unsigned int texture_clr_cmp_msk_c; unsigned int fog_color_c; /* Texture state */ unsigned int tex_size_pitch_c; unsigned int constant_color_c; /* Setup state */ unsigned int pm4_vc_fpu_setup; unsigned int setup_cntl; /* Mask state */ unsigned int dp_write_mask; unsigned int sten_ref_mask_c; unsigned int plane_3d_mask_c; /* Window state */ unsigned int window_xy_offset; /* Core state */ unsigned int scale_3d_cntl; } drm_r128_context_regs_t; /* Setup registers for each texture unit */ typedef struct { unsigned int tex_cntl; unsigned int tex_combine_cntl; unsigned int tex_size_pitch; unsigned int tex_offset[R128_MAX_TEXTURE_LEVELS]; unsigned int tex_border_color; } drm_r128_texture_regs_t; typedef struct drm_r128_sarea { /* The channel for communication of state information to the kernel * on firing a vertex buffer. */ drm_r128_context_regs_t context_state; drm_r128_texture_regs_t tex_state[R128_MAX_TEXTURE_UNITS]; unsigned int dirty; unsigned int vertsize; unsigned int vc_format; /* The current cliprects, or a subset thereof. */ struct drm_clip_rect boxes[R128_NR_SAREA_CLIPRECTS]; unsigned int nbox; /* Counters for client-side throttling of rendering clients. */ unsigned int last_frame; unsigned int last_dispatch; struct drm_tex_region tex_list[R128_NR_TEX_HEAPS][R128_NR_TEX_REGIONS + 1]; unsigned int tex_age[R128_NR_TEX_HEAPS]; int ctx_owner; int pfAllowPageFlip; /* number of 3d windows (0,1,2 or more) */ int pfCurrentPage; /* which buffer is being displayed? */ } drm_r128_sarea_t; /* WARNING: If you change any of these defines, make sure to change the * defines in the Xserver file (xf86drmR128.h) */ /* Rage 128 specific ioctls * The device specific ioctl range is 0x40 to 0x79. */ #define DRM_R128_INIT 0x00 #define DRM_R128_CCE_START 0x01 #define DRM_R128_CCE_STOP 0x02 #define DRM_R128_CCE_RESET 0x03 #define DRM_R128_CCE_IDLE 0x04 /* 0x05 not used */ #define DRM_R128_RESET 0x06 #define DRM_R128_SWAP 0x07 #define DRM_R128_CLEAR 0x08 #define DRM_R128_VERTEX 0x09 #define DRM_R128_INDICES 0x0a #define DRM_R128_BLIT 0x0b #define DRM_R128_DEPTH 0x0c #define DRM_R128_STIPPLE 0x0d /* 0x0e not used */ #define DRM_R128_INDIRECT 0x0f #define DRM_R128_FULLSCREEN 0x10 #define DRM_R128_CLEAR2 0x11 #define DRM_R128_GETPARAM 0x12 #define DRM_R128_FLIP 0x13 #define DRM_IOCTL_R128_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_R128_INIT, drm_r128_init_t) #define DRM_IOCTL_R128_CCE_START DRM_IO( DRM_COMMAND_BASE + DRM_R128_CCE_START) #define DRM_IOCTL_R128_CCE_STOP DRM_IOW( DRM_COMMAND_BASE + DRM_R128_CCE_STOP, drm_r128_cce_stop_t) #define DRM_IOCTL_R128_CCE_RESET DRM_IO( DRM_COMMAND_BASE + DRM_R128_CCE_RESET) #define DRM_IOCTL_R128_CCE_IDLE DRM_IO( DRM_COMMAND_BASE + DRM_R128_CCE_IDLE) /* 0x05 not used */ #define DRM_IOCTL_R128_RESET DRM_IO( DRM_COMMAND_BASE + DRM_R128_RESET) #define DRM_IOCTL_R128_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_R128_SWAP) #define DRM_IOCTL_R128_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_R128_CLEAR, drm_r128_clear_t) #define DRM_IOCTL_R128_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_R128_VERTEX, drm_r128_vertex_t) #define DRM_IOCTL_R128_INDICES DRM_IOW( DRM_COMMAND_BASE + DRM_R128_INDICES, drm_r128_indices_t) #define DRM_IOCTL_R128_BLIT DRM_IOW( DRM_COMMAND_BASE + DRM_R128_BLIT, drm_r128_blit_t) #define DRM_IOCTL_R128_DEPTH DRM_IOW( DRM_COMMAND_BASE + DRM_R128_DEPTH, drm_r128_depth_t) #define DRM_IOCTL_R128_STIPPLE DRM_IOW( DRM_COMMAND_BASE + DRM_R128_STIPPLE, drm_r128_stipple_t) /* 0x0e not used */ #define DRM_IOCTL_R128_INDIRECT DRM_IOWR(DRM_COMMAND_BASE + DRM_R128_INDIRECT, drm_r128_indirect_t) #define DRM_IOCTL_R128_FULLSCREEN DRM_IOW( DRM_COMMAND_BASE + DRM_R128_FULLSCREEN, drm_r128_fullscreen_t) #define DRM_IOCTL_R128_CLEAR2 DRM_IOW( DRM_COMMAND_BASE + DRM_R128_CLEAR2, drm_r128_clear2_t) #define DRM_IOCTL_R128_GETPARAM DRM_IOWR( DRM_COMMAND_BASE + DRM_R128_GETPARAM, drm_r128_getparam_t) #define DRM_IOCTL_R128_FLIP DRM_IO( DRM_COMMAND_BASE + DRM_R128_FLIP) typedef struct drm_r128_init { enum { R128_INIT_CCE = 0x01, R128_CLEANUP_CCE = 0x02 } func; unsigned long sarea_priv_offset; int is_pci; int cce_mode; int cce_secure; int ring_size; int usec_timeout; unsigned int fb_bpp; unsigned int front_offset, front_pitch; unsigned int back_offset, back_pitch; unsigned int depth_bpp; unsigned int depth_offset, depth_pitch; unsigned int span_offset; unsigned long fb_offset; unsigned long mmio_offset; unsigned long ring_offset; unsigned long ring_rptr_offset; unsigned long buffers_offset; unsigned long agp_textures_offset; } drm_r128_init_t; typedef struct drm_r128_cce_stop { int flush; int idle; } drm_r128_cce_stop_t; typedef struct drm_r128_clear { unsigned int flags; unsigned int clear_color; unsigned int clear_depth; unsigned int color_mask; unsigned int depth_mask; } drm_r128_clear_t; typedef struct drm_r128_vertex { int prim; int idx; /* Index of vertex buffer */ int count; /* Number of vertices in buffer */ int discard; /* Client finished with buffer? */ } drm_r128_vertex_t; typedef struct drm_r128_indices { int prim; int idx; int start; int end; int discard; /* Client finished with buffer? */ } drm_r128_indices_t; typedef struct drm_r128_blit { int idx; int pitch; int offset; int format; unsigned short x, y; unsigned short width, height; } drm_r128_blit_t; typedef struct drm_r128_depth { enum { R128_WRITE_SPAN = 0x01, R128_WRITE_PIXELS = 0x02, R128_READ_SPAN = 0x03, R128_READ_PIXELS = 0x04 } func; int n; int *x; int *y; unsigned int *buffer; unsigned char *mask; } drm_r128_depth_t; typedef struct drm_r128_stipple { unsigned int *mask; } drm_r128_stipple_t; typedef struct drm_r128_indirect { int idx; int start; int end; int discard; } drm_r128_indirect_t; typedef struct drm_r128_fullscreen { enum { R128_INIT_FULLSCREEN = 0x01, R128_CLEANUP_FULLSCREEN = 0x02 } func; } drm_r128_fullscreen_t; /* 2.3: An ioctl to get parameters that aren't available to the 3d * client any other way. */ #define R128_PARAM_IRQ_NR 1 typedef struct drm_r128_getparam { int param; void *value; } drm_r128_getparam_t; #if defined(__cplusplus) } #endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/msm_drm.h���������������������������������������������������������������������������������������0000644�����������������00000027511�14763166027�0007157 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (C) 2013 Red Hat * Author: Rob Clark <robdclark@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef __MSM_DRM_H__ #define __MSM_DRM_H__ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* Please note that modifications to all structs defined here are * subject to backwards-compatibility constraints: * 1) Do not use pointers, use __u64 instead for 32 bit / 64 bit * user/kernel compatibility * 2) Keep fields aligned to their size * 3) Because of how drm_ioctl() works, we can add new fields at * the end of an ioctl if some care is taken: drm_ioctl() will * zero out the new fields at the tail of the ioctl, so a zero * value should have a backwards compatible meaning. And for * output params, userspace won't see the newly added output * fields.. so that has to be somehow ok. */ #define MSM_PIPE_NONE 0x00 #define MSM_PIPE_2D0 0x01 #define MSM_PIPE_2D1 0x02 #define MSM_PIPE_3D0 0x10 /* The pipe-id just uses the lower bits, so can be OR'd with flags in * the upper 16 bits (which could be extended further, if needed, maybe * we extend/overload the pipe-id some day to deal with multiple rings, * but even then I don't think we need the full lower 16 bits). */ #define MSM_PIPE_ID_MASK 0xffff #define MSM_PIPE_ID(x) ((x) & MSM_PIPE_ID_MASK) #define MSM_PIPE_FLAGS(x) ((x) & ~MSM_PIPE_ID_MASK) /* timeouts are specified in clock-monotonic absolute times (to simplify * restarting interrupted ioctls). The following struct is logically the * same as 'struct timespec' but 32/64b ABI safe. */ struct drm_msm_timespec { __s64 tv_sec; /* seconds */ __s64 tv_nsec; /* nanoseconds */ }; #define MSM_PARAM_GPU_ID 0x01 #define MSM_PARAM_GMEM_SIZE 0x02 #define MSM_PARAM_CHIP_ID 0x03 #define MSM_PARAM_MAX_FREQ 0x04 #define MSM_PARAM_TIMESTAMP 0x05 #define MSM_PARAM_GMEM_BASE 0x06 #define MSM_PARAM_NR_RINGS 0x07 struct drm_msm_param { __u32 pipe; /* in, MSM_PIPE_x */ __u32 param; /* in, MSM_PARAM_x */ __u64 value; /* out (get_param) or in (set_param) */ }; /* * GEM buffers: */ #define MSM_BO_SCANOUT 0x00000001 /* scanout capable */ #define MSM_BO_GPU_READONLY 0x00000002 #define MSM_BO_CACHE_MASK 0x000f0000 /* cache modes */ #define MSM_BO_CACHED 0x00010000 #define MSM_BO_WC 0x00020000 #define MSM_BO_UNCACHED 0x00040000 #define MSM_BO_FLAGS (MSM_BO_SCANOUT | \ MSM_BO_GPU_READONLY | \ MSM_BO_CACHED | \ MSM_BO_WC | \ MSM_BO_UNCACHED) struct drm_msm_gem_new { __u64 size; /* in */ __u32 flags; /* in, mask of MSM_BO_x */ __u32 handle; /* out */ }; #define MSM_INFO_IOVA 0x01 #define MSM_INFO_FLAGS (MSM_INFO_IOVA) struct drm_msm_gem_info { __u32 handle; /* in */ __u32 flags; /* in - combination of MSM_INFO_* flags */ __u64 offset; /* out, mmap() offset or iova */ }; #define MSM_PREP_READ 0x01 #define MSM_PREP_WRITE 0x02 #define MSM_PREP_NOSYNC 0x04 #define MSM_PREP_FLAGS (MSM_PREP_READ | MSM_PREP_WRITE | MSM_PREP_NOSYNC) struct drm_msm_gem_cpu_prep { __u32 handle; /* in */ __u32 op; /* in, mask of MSM_PREP_x */ struct drm_msm_timespec timeout; /* in */ }; struct drm_msm_gem_cpu_fini { __u32 handle; /* in */ }; /* * Cmdstream Submission: */ /* The value written into the cmdstream is logically: * * ((relocbuf->gpuaddr + reloc_offset) << shift) | or * * When we have GPU's w/ >32bit ptrs, it should be possible to deal * with this by emit'ing two reloc entries with appropriate shift * values. Or a new MSM_SUBMIT_CMD_x type would also be an option. * * NOTE that reloc's must be sorted by order of increasing submit_offset, * otherwise EINVAL. */ struct drm_msm_gem_submit_reloc { __u32 submit_offset; /* in, offset from submit_bo */ __u32 or; /* in, value OR'd with result */ __s32 shift; /* in, amount of left shift (can be negative) */ __u32 reloc_idx; /* in, index of reloc_bo buffer */ __u64 reloc_offset; /* in, offset from start of reloc_bo */ }; /* submit-types: * BUF - this cmd buffer is executed normally. * IB_TARGET_BUF - this cmd buffer is an IB target. Reloc's are * processed normally, but the kernel does not setup an IB to * this buffer in the first-level ringbuffer * CTX_RESTORE_BUF - only executed if there has been a GPU context * switch since the last SUBMIT ioctl */ #define MSM_SUBMIT_CMD_BUF 0x0001 #define MSM_SUBMIT_CMD_IB_TARGET_BUF 0x0002 #define MSM_SUBMIT_CMD_CTX_RESTORE_BUF 0x0003 struct drm_msm_gem_submit_cmd { __u32 type; /* in, one of MSM_SUBMIT_CMD_x */ __u32 submit_idx; /* in, index of submit_bo cmdstream buffer */ __u32 submit_offset; /* in, offset into submit_bo */ __u32 size; /* in, cmdstream size */ __u32 pad; __u32 nr_relocs; /* in, number of submit_reloc's */ __u64 relocs; /* in, ptr to array of submit_reloc's */ }; /* Each buffer referenced elsewhere in the cmdstream submit (ie. the * cmdstream buffer(s) themselves or reloc entries) has one (and only * one) entry in the submit->bos[] table. * * As a optimization, the current buffer (gpu virtual address) can be * passed back through the 'presumed' field. If on a subsequent reloc, * userspace passes back a 'presumed' address that is still valid, * then patching the cmdstream for this entry is skipped. This can * avoid kernel needing to map/access the cmdstream bo in the common * case. */ #define MSM_SUBMIT_BO_READ 0x0001 #define MSM_SUBMIT_BO_WRITE 0x0002 #define MSM_SUBMIT_BO_FLAGS (MSM_SUBMIT_BO_READ | MSM_SUBMIT_BO_WRITE) struct drm_msm_gem_submit_bo { __u32 flags; /* in, mask of MSM_SUBMIT_BO_x */ __u32 handle; /* in, GEM handle */ __u64 presumed; /* in/out, presumed buffer address */ }; /* Valid submit ioctl flags: */ #define MSM_SUBMIT_NO_IMPLICIT 0x80000000 /* disable implicit sync */ #define MSM_SUBMIT_FENCE_FD_IN 0x40000000 /* enable input fence_fd */ #define MSM_SUBMIT_FENCE_FD_OUT 0x20000000 /* enable output fence_fd */ #define MSM_SUBMIT_SUDO 0x10000000 /* run submitted cmds from RB */ #define MSM_SUBMIT_FLAGS ( \ MSM_SUBMIT_NO_IMPLICIT | \ MSM_SUBMIT_FENCE_FD_IN | \ MSM_SUBMIT_FENCE_FD_OUT | \ MSM_SUBMIT_SUDO | \ 0) /* Each cmdstream submit consists of a table of buffers involved, and * one or more cmdstream buffers. This allows for conditional execution * (context-restore), and IB buffers needed for per tile/bin draw cmds. */ struct drm_msm_gem_submit { __u32 flags; /* MSM_PIPE_x | MSM_SUBMIT_x */ __u32 fence; /* out */ __u32 nr_bos; /* in, number of submit_bo's */ __u32 nr_cmds; /* in, number of submit_cmd's */ __u64 bos; /* in, ptr to array of submit_bo's */ __u64 cmds; /* in, ptr to array of submit_cmd's */ __s32 fence_fd; /* in/out fence fd (see MSM_SUBMIT_FENCE_FD_IN/OUT) */ __u32 queueid; /* in, submitqueue id */ }; /* The normal way to synchronize with the GPU is just to CPU_PREP on * a buffer if you need to access it from the CPU (other cmdstream * submission from same or other contexts, PAGE_FLIP ioctl, etc, all * handle the required synchronization under the hood). This ioctl * mainly just exists as a way to implement the gallium pipe_fence * APIs without requiring a dummy bo to synchronize on. */ struct drm_msm_wait_fence { __u32 fence; /* in */ __u32 pad; struct drm_msm_timespec timeout; /* in */ __u32 queueid; /* in, submitqueue id */ }; /* madvise provides a way to tell the kernel in case a buffers contents * can be discarded under memory pressure, which is useful for userspace * bo cache where we want to optimistically hold on to buffer allocate * and potential mmap, but allow the pages to be discarded under memory * pressure. * * Typical usage would involve madvise(DONTNEED) when buffer enters BO * cache, and madvise(WILLNEED) if trying to recycle buffer from BO cache. * In the WILLNEED case, 'retained' indicates to userspace whether the * backing pages still exist. */ #define MSM_MADV_WILLNEED 0 /* backing pages are needed, status returned in 'retained' */ #define MSM_MADV_DONTNEED 1 /* backing pages not needed */ #define __MSM_MADV_PURGED 2 /* internal state */ struct drm_msm_gem_madvise { __u32 handle; /* in, GEM handle */ __u32 madv; /* in, MSM_MADV_x */ __u32 retained; /* out, whether backing store still exists */ }; /* * Draw queues allow the user to set specific submission parameter. Command * submissions specify a specific submitqueue to use. ID 0 is reserved for * backwards compatibility as a "default" submitqueue */ #define MSM_SUBMITQUEUE_FLAGS (0) struct drm_msm_submitqueue { __u32 flags; /* in, MSM_SUBMITQUEUE_x */ __u32 prio; /* in, Priority level */ __u32 id; /* out, identifier */ }; #define DRM_MSM_GET_PARAM 0x00 /* placeholder: #define DRM_MSM_SET_PARAM 0x01 */ #define DRM_MSM_GEM_NEW 0x02 #define DRM_MSM_GEM_INFO 0x03 #define DRM_MSM_GEM_CPU_PREP 0x04 #define DRM_MSM_GEM_CPU_FINI 0x05 #define DRM_MSM_GEM_SUBMIT 0x06 #define DRM_MSM_WAIT_FENCE 0x07 #define DRM_MSM_GEM_MADVISE 0x08 /* placeholder: #define DRM_MSM_GEM_SVM_NEW 0x09 */ #define DRM_MSM_SUBMITQUEUE_NEW 0x0A #define DRM_MSM_SUBMITQUEUE_CLOSE 0x0B #define DRM_IOCTL_MSM_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GET_PARAM, struct drm_msm_param) #define DRM_IOCTL_MSM_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_NEW, struct drm_msm_gem_new) #define DRM_IOCTL_MSM_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_INFO, struct drm_msm_gem_info) #define DRM_IOCTL_MSM_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_GEM_CPU_PREP, struct drm_msm_gem_cpu_prep) #define DRM_IOCTL_MSM_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_GEM_CPU_FINI, struct drm_msm_gem_cpu_fini) #define DRM_IOCTL_MSM_GEM_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_SUBMIT, struct drm_msm_gem_submit) #define DRM_IOCTL_MSM_WAIT_FENCE DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_WAIT_FENCE, struct drm_msm_wait_fence) #define DRM_IOCTL_MSM_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_MADVISE, struct drm_msm_gem_madvise) #define DRM_IOCTL_MSM_SUBMITQUEUE_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_NEW, struct drm_msm_submitqueue) #define DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_CLOSE, __u32) #if defined(__cplusplus) } #endif #endif /* __MSM_DRM_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/virtgpu_drm.h�����������������������������������������������������������������������������������0000644�����������������00000011251�14763166027�0010055 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright 2013 Red Hat * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef VIRTGPU_DRM_H #define VIRTGPU_DRM_H #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* Please note that modifications to all structs defined here are * subject to backwards-compatibility constraints. * * Do not use pointers, use __u64 instead for 32 bit / 64 bit user/kernel * compatibility Keep fields aligned to their size */ #define DRM_VIRTGPU_MAP 0x01 #define DRM_VIRTGPU_EXECBUFFER 0x02 #define DRM_VIRTGPU_GETPARAM 0x03 #define DRM_VIRTGPU_RESOURCE_CREATE 0x04 #define DRM_VIRTGPU_RESOURCE_INFO 0x05 #define DRM_VIRTGPU_TRANSFER_FROM_HOST 0x06 #define DRM_VIRTGPU_TRANSFER_TO_HOST 0x07 #define DRM_VIRTGPU_WAIT 0x08 #define DRM_VIRTGPU_GET_CAPS 0x09 struct drm_virtgpu_map { __u64 offset; /* use for mmap system call */ __u32 handle; __u32 pad; }; struct drm_virtgpu_execbuffer { __u32 flags; /* for future use */ __u32 size; __u64 command; /* void* */ __u64 bo_handles; __u32 num_bo_handles; __u32 pad; }; #define VIRTGPU_PARAM_3D_FEATURES 1 /* do we have 3D features in the hw */ #define VIRTGPU_PARAM_CAPSET_QUERY_FIX 2 /* do we have the capset fix */ struct drm_virtgpu_getparam { __u64 param; __u64 value; }; /* NO_BO flags? NO resource flag? */ /* resource flag for y_0_top */ struct drm_virtgpu_resource_create { __u32 target; __u32 format; __u32 bind; __u32 width; __u32 height; __u32 depth; __u32 array_size; __u32 last_level; __u32 nr_samples; __u32 flags; __u32 bo_handle; /* if this is set - recreate a new resource attached to this bo ? */ __u32 res_handle; /* returned by kernel */ __u32 size; /* validate transfer in the host */ __u32 stride; /* validate transfer in the host */ }; struct drm_virtgpu_resource_info { __u32 bo_handle; __u32 res_handle; __u32 size; __u32 stride; }; struct drm_virtgpu_3d_box { __u32 x; __u32 y; __u32 z; __u32 w; __u32 h; __u32 d; }; struct drm_virtgpu_3d_transfer_to_host { __u32 bo_handle; struct drm_virtgpu_3d_box box; __u32 level; __u32 offset; }; struct drm_virtgpu_3d_transfer_from_host { __u32 bo_handle; struct drm_virtgpu_3d_box box; __u32 level; __u32 offset; }; #define VIRTGPU_WAIT_NOWAIT 1 /* like it */ struct drm_virtgpu_3d_wait { __u32 handle; /* 0 is an invalid handle */ __u32 flags; }; struct drm_virtgpu_get_caps { __u32 cap_set_id; __u32 cap_set_ver; __u64 addr; __u32 size; __u32 pad; }; #define DRM_IOCTL_VIRTGPU_MAP \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_MAP, struct drm_virtgpu_map) #define DRM_IOCTL_VIRTGPU_EXECBUFFER \ DRM_IOW(DRM_COMMAND_BASE + DRM_VIRTGPU_EXECBUFFER,\ struct drm_virtgpu_execbuffer) #define DRM_IOCTL_VIRTGPU_GETPARAM \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_GETPARAM,\ struct drm_virtgpu_getparam) #define DRM_IOCTL_VIRTGPU_RESOURCE_CREATE \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_RESOURCE_CREATE, \ struct drm_virtgpu_resource_create) #define DRM_IOCTL_VIRTGPU_RESOURCE_INFO \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_RESOURCE_INFO, \ struct drm_virtgpu_resource_info) #define DRM_IOCTL_VIRTGPU_TRANSFER_FROM_HOST \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_TRANSFER_FROM_HOST, \ struct drm_virtgpu_3d_transfer_from_host) #define DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_TRANSFER_TO_HOST, \ struct drm_virtgpu_3d_transfer_to_host) #define DRM_IOCTL_VIRTGPU_WAIT \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_WAIT, \ struct drm_virtgpu_3d_wait) #define DRM_IOCTL_VIRTGPU_GET_CAPS \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_GET_CAPS, \ struct drm_virtgpu_get_caps) #if defined(__cplusplus) } #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/drm.h�������������������������������������������������������������������������������������������0000644�����������������00000074601�14763166027�0006305 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file drm.h * Header for the Direct Rendering Manager * * \author Rickard E. (Rik) Faith <faith@valinux.com> * * \par Acknowledgments: * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic \c cmpxchg. */ /* * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _DRM_H_ #define _DRM_H_ #if defined(__linux__) #include <linux/types.h> #include <asm/ioctl.h> typedef unsigned int drm_handle_t; #else /* One of the BSDs */ #include <sys/ioccom.h> #include <sys/types.h> typedef int8_t __s8; typedef uint8_t __u8; typedef int16_t __s16; typedef uint16_t __u16; typedef int32_t __s32; typedef uint32_t __u32; typedef int64_t __s64; typedef uint64_t __u64; typedef size_t __kernel_size_t; typedef unsigned long drm_handle_t; #endif #if defined(__cplusplus) extern "C" { #endif #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ #define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */ #define DRM_RAM_PERCENT 10 /**< How much system ram can we lock? */ #define _DRM_LOCK_HELD 0x80000000U /**< Hardware lock is held */ #define _DRM_LOCK_CONT 0x40000000U /**< Hardware lock is contended */ #define _DRM_LOCK_IS_HELD(lock) ((lock) & _DRM_LOCK_HELD) #define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) typedef unsigned int drm_context_t; typedef unsigned int drm_drawable_t; typedef unsigned int drm_magic_t; /** * Cliprect. * * \warning: If you change this structure, make sure you change * XF86DRIClipRectRec in the server as well * * \note KW: Actually it's illegal to change either for * backwards-compatibility reasons. */ struct drm_clip_rect { unsigned short x1; unsigned short y1; unsigned short x2; unsigned short y2; }; /** * Drawable information. */ struct drm_drawable_info { unsigned int num_rects; struct drm_clip_rect *rects; }; /** * Texture region, */ struct drm_tex_region { unsigned char next; unsigned char prev; unsigned char in_use; unsigned char padding; unsigned int age; }; /** * Hardware lock. * * The lock structure is a simple cache-line aligned integer. To avoid * processor bus contention on a multiprocessor system, there should not be any * other data stored in the same cache line. */ struct drm_hw_lock { __volatile__ unsigned int lock; /**< lock variable */ char padding[60]; /**< Pad to cache line */ }; /** * DRM_IOCTL_VERSION ioctl argument type. * * \sa drmGetVersion(). */ struct drm_version { int version_major; /**< Major version */ int version_minor; /**< Minor version */ int version_patchlevel; /**< Patch level */ __kernel_size_t name_len; /**< Length of name buffer */ char *name; /**< Name of driver */ __kernel_size_t date_len; /**< Length of date buffer */ char *date; /**< User-space buffer to hold date */ __kernel_size_t desc_len; /**< Length of desc buffer */ char *desc; /**< User-space buffer to hold desc */ }; /** * DRM_IOCTL_GET_UNIQUE ioctl argument type. * * \sa drmGetBusid() and drmSetBusId(). */ struct drm_unique { __kernel_size_t unique_len; /**< Length of unique */ char *unique; /**< Unique name for driver instantiation */ }; struct drm_list { int count; /**< Length of user-space structures */ struct drm_version *version; }; struct drm_block { int unused; }; /** * DRM_IOCTL_CONTROL ioctl argument type. * * \sa drmCtlInstHandler() and drmCtlUninstHandler(). */ struct drm_control { enum { DRM_ADD_COMMAND, DRM_RM_COMMAND, DRM_INST_HANDLER, DRM_UNINST_HANDLER } func; int irq; }; /** * Type of memory to map. */ enum drm_map_type { _DRM_FRAME_BUFFER = 0, /**< WC (no caching), no core dump */ _DRM_REGISTERS = 1, /**< no caching, no core dump */ _DRM_SHM = 2, /**< shared, cached */ _DRM_AGP = 3, /**< AGP/GART */ _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */ _DRM_CONSISTENT = 5 /**< Consistent memory for PCI DMA */ }; /** * Memory mapping flags. */ enum drm_map_flags { _DRM_RESTRICTED = 0x01, /**< Cannot be mapped to user-virtual */ _DRM_READ_ONLY = 0x02, _DRM_LOCKED = 0x04, /**< shared, cached, locked */ _DRM_KERNEL = 0x08, /**< kernel requires access */ _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */ _DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */ _DRM_REMOVABLE = 0x40, /**< Removable mapping */ _DRM_DRIVER = 0x80 /**< Managed by driver */ }; struct drm_ctx_priv_map { unsigned int ctx_id; /**< Context requesting private mapping */ void *handle; /**< Handle of map */ }; /** * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls * argument type. * * \sa drmAddMap(). */ struct drm_map { unsigned long offset; /**< Requested physical address (0 for SAREA)*/ unsigned long size; /**< Requested physical size (bytes) */ enum drm_map_type type; /**< Type of memory to map */ enum drm_map_flags flags; /**< Flags */ void *handle; /**< User-space: "Handle" to pass to mmap() */ /**< Kernel-space: kernel-virtual address */ int mtrr; /**< MTRR slot used */ /* Private data */ }; /** * DRM_IOCTL_GET_CLIENT ioctl argument type. */ struct drm_client { int idx; /**< Which client desired? */ int auth; /**< Is client authenticated? */ unsigned long pid; /**< Process ID */ unsigned long uid; /**< User ID */ unsigned long magic; /**< Magic */ unsigned long iocs; /**< Ioctl count */ }; enum drm_stat_type { _DRM_STAT_LOCK, _DRM_STAT_OPENS, _DRM_STAT_CLOSES, _DRM_STAT_IOCTLS, _DRM_STAT_LOCKS, _DRM_STAT_UNLOCKS, _DRM_STAT_VALUE, /**< Generic value */ _DRM_STAT_BYTE, /**< Generic byte counter (1024bytes/K) */ _DRM_STAT_COUNT, /**< Generic non-byte counter (1000/k) */ _DRM_STAT_IRQ, /**< IRQ */ _DRM_STAT_PRIMARY, /**< Primary DMA bytes */ _DRM_STAT_SECONDARY, /**< Secondary DMA bytes */ _DRM_STAT_DMA, /**< DMA */ _DRM_STAT_SPECIAL, /**< Special DMA (e.g., priority or polled) */ _DRM_STAT_MISSED /**< Missed DMA opportunity */ /* Add to the *END* of the list */ }; /** * DRM_IOCTL_GET_STATS ioctl argument type. */ struct drm_stats { unsigned long count; struct { unsigned long value; enum drm_stat_type type; } data[15]; }; /** * Hardware locking flags. */ enum drm_lock_flags { _DRM_LOCK_READY = 0x01, /**< Wait until hardware is ready for DMA */ _DRM_LOCK_QUIESCENT = 0x02, /**< Wait until hardware quiescent */ _DRM_LOCK_FLUSH = 0x04, /**< Flush this context's DMA queue first */ _DRM_LOCK_FLUSH_ALL = 0x08, /**< Flush all DMA queues first */ /* These *HALT* flags aren't supported yet -- they will be used to support the full-screen DGA-like mode. */ _DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */ _DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */ }; /** * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type. * * \sa drmGetLock() and drmUnlock(). */ struct drm_lock { int context; enum drm_lock_flags flags; }; /** * DMA flags * * \warning * These values \e must match xf86drm.h. * * \sa drm_dma. */ enum drm_dma_flags { /* Flags for DMA buffer dispatch */ _DRM_DMA_BLOCK = 0x01, /**< * Block until buffer dispatched. * * \note The buffer may not yet have * been processed by the hardware -- * getting a hardware lock with the * hardware quiescent will ensure * that the buffer has been * processed. */ _DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */ _DRM_DMA_PRIORITY = 0x04, /**< High priority dispatch */ /* Flags for DMA buffer request */ _DRM_DMA_WAIT = 0x10, /**< Wait for free buffers */ _DRM_DMA_SMALLER_OK = 0x20, /**< Smaller-than-requested buffers OK */ _DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */ }; /** * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type. * * \sa drmAddBufs(). */ struct drm_buf_desc { int count; /**< Number of buffers of this size */ int size; /**< Size in bytes */ int low_mark; /**< Low water mark */ int high_mark; /**< High water mark */ enum { _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */ _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */ _DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */ _DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */ _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */ } flags; unsigned long agp_start; /**< * Start address of where the AGP buffers are * in the AGP aperture */ }; /** * DRM_IOCTL_INFO_BUFS ioctl argument type. */ struct drm_buf_info { int count; /**< Entries in list */ struct drm_buf_desc *list; }; /** * DRM_IOCTL_FREE_BUFS ioctl argument type. */ struct drm_buf_free { int count; int *list; }; /** * Buffer information * * \sa drm_buf_map. */ struct drm_buf_pub { int idx; /**< Index into the master buffer list */ int total; /**< Buffer size */ int used; /**< Amount of buffer in use (for DMA) */ void *address; /**< Address of buffer */ }; /** * DRM_IOCTL_MAP_BUFS ioctl argument type. */ struct drm_buf_map { int count; /**< Length of the buffer list */ #ifdef __cplusplus void *virt; #else void *virtual; /**< Mmap'd area in user-virtual */ #endif struct drm_buf_pub *list; /**< Buffer information */ }; /** * DRM_IOCTL_DMA ioctl argument type. * * Indices here refer to the offset into the buffer list in drm_buf_get. * * \sa drmDMA(). */ struct drm_dma { int context; /**< Context handle */ int send_count; /**< Number of buffers to send */ int *send_indices; /**< List of handles to buffers */ int *send_sizes; /**< Lengths of data to send */ enum drm_dma_flags flags; /**< Flags */ int request_count; /**< Number of buffers requested */ int request_size; /**< Desired size for buffers */ int *request_indices; /**< Buffer information */ int *request_sizes; int granted_count; /**< Number of buffers granted */ }; enum drm_ctx_flags { _DRM_CONTEXT_PRESERVED = 0x01, _DRM_CONTEXT_2DONLY = 0x02 }; /** * DRM_IOCTL_ADD_CTX ioctl argument type. * * \sa drmCreateContext() and drmDestroyContext(). */ struct drm_ctx { drm_context_t handle; enum drm_ctx_flags flags; }; /** * DRM_IOCTL_RES_CTX ioctl argument type. */ struct drm_ctx_res { int count; struct drm_ctx *contexts; }; /** * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type. */ struct drm_draw { drm_drawable_t handle; }; /** * DRM_IOCTL_UPDATE_DRAW ioctl argument type. */ typedef enum { DRM_DRAWABLE_CLIPRECTS } drm_drawable_info_type_t; struct drm_update_draw { drm_drawable_t handle; unsigned int type; unsigned int num; unsigned long long data; }; /** * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type. */ struct drm_auth { drm_magic_t magic; }; /** * DRM_IOCTL_IRQ_BUSID ioctl argument type. * * \sa drmGetInterruptFromBusID(). */ struct drm_irq_busid { int irq; /**< IRQ number */ int busnum; /**< bus number */ int devnum; /**< device number */ int funcnum; /**< function number */ }; enum drm_vblank_seq_type { _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ /* bits 1-6 are reserved for high crtcs */ _DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e, _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */ _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */ }; #define _DRM_VBLANK_HIGH_CRTC_SHIFT 1 #define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) #define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \ _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS) struct drm_wait_vblank_request { enum drm_vblank_seq_type type; unsigned int sequence; unsigned long signal; }; struct drm_wait_vblank_reply { enum drm_vblank_seq_type type; unsigned int sequence; long tval_sec; long tval_usec; }; /** * DRM_IOCTL_WAIT_VBLANK ioctl argument type. * * \sa drmWaitVBlank(). */ union drm_wait_vblank { struct drm_wait_vblank_request request; struct drm_wait_vblank_reply reply; }; #define _DRM_PRE_MODESET 1 #define _DRM_POST_MODESET 2 /** * DRM_IOCTL_MODESET_CTL ioctl argument type * * \sa drmModesetCtl(). */ struct drm_modeset_ctl { __u32 crtc; __u32 cmd; }; /** * DRM_IOCTL_AGP_ENABLE ioctl argument type. * * \sa drmAgpEnable(). */ struct drm_agp_mode { unsigned long mode; /**< AGP mode */ }; /** * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type. * * \sa drmAgpAlloc() and drmAgpFree(). */ struct drm_agp_buffer { unsigned long size; /**< In bytes -- will round to page boundary */ unsigned long handle; /**< Used for binding / unbinding */ unsigned long type; /**< Type of memory to allocate */ unsigned long physical; /**< Physical used by i810 */ }; /** * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type. * * \sa drmAgpBind() and drmAgpUnbind(). */ struct drm_agp_binding { unsigned long handle; /**< From drm_agp_buffer */ unsigned long offset; /**< In bytes -- will round to page boundary */ }; /** * DRM_IOCTL_AGP_INFO ioctl argument type. * * \sa drmAgpVersionMajor(), drmAgpVersionMinor(), drmAgpGetMode(), * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(), * drmAgpVendorId() and drmAgpDeviceId(). */ struct drm_agp_info { int agp_version_major; int agp_version_minor; unsigned long mode; unsigned long aperture_base; /* physical address */ unsigned long aperture_size; /* bytes */ unsigned long memory_allowed; /* bytes */ unsigned long memory_used; /* PCI information */ unsigned short id_vendor; unsigned short id_device; }; /** * DRM_IOCTL_SG_ALLOC ioctl argument type. */ struct drm_scatter_gather { unsigned long size; /**< In bytes -- will round to page boundary */ unsigned long handle; /**< Used for mapping / unmapping */ }; /** * DRM_IOCTL_SET_VERSION ioctl argument type. */ struct drm_set_version { int drm_di_major; int drm_di_minor; int drm_dd_major; int drm_dd_minor; }; /** DRM_IOCTL_GEM_CLOSE ioctl argument type */ struct drm_gem_close { /** Handle of the object to be closed. */ __u32 handle; __u32 pad; }; /** DRM_IOCTL_GEM_FLINK ioctl argument type */ struct drm_gem_flink { /** Handle for the object being named */ __u32 handle; /** Returned global name */ __u32 name; }; /** DRM_IOCTL_GEM_OPEN ioctl argument type */ struct drm_gem_open { /** Name of object being opened */ __u32 name; /** Returned handle for the object */ __u32 handle; /** Returned size of the object */ __u64 size; }; #define DRM_CAP_DUMB_BUFFER 0x1 #define DRM_CAP_VBLANK_HIGH_CRTC 0x2 #define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3 #define DRM_CAP_DUMB_PREFER_SHADOW 0x4 #define DRM_CAP_PRIME 0x5 #define DRM_PRIME_CAP_IMPORT 0x1 #define DRM_PRIME_CAP_EXPORT 0x2 #define DRM_CAP_TIMESTAMP_MONOTONIC 0x6 #define DRM_CAP_ASYNC_PAGE_FLIP 0x7 /* * The CURSOR_WIDTH and CURSOR_HEIGHT capabilities return a valid widthxheight * combination for the hardware cursor. The intention is that a hardware * agnostic userspace can query a cursor plane size to use. * * Note that the cross-driver contract is to merely return a valid size; * drivers are free to attach another meaning on top, eg. i915 returns the * maximum plane size. */ #define DRM_CAP_CURSOR_WIDTH 0x8 #define DRM_CAP_CURSOR_HEIGHT 0x9 #define DRM_CAP_ADDFB2_MODIFIERS 0x10 #define DRM_CAP_PAGE_FLIP_TARGET 0x11 #define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12 #define DRM_CAP_SYNCOBJ 0x13 /** DRM_IOCTL_GET_CAP ioctl argument type */ struct drm_get_cap { __u64 capability; __u64 value; }; /** * DRM_CLIENT_CAP_STEREO_3D * * if set to 1, the DRM core will expose the stereo 3D capabilities of the * monitor by advertising the supported 3D layouts in the flags of struct * drm_mode_modeinfo. */ #define DRM_CLIENT_CAP_STEREO_3D 1 /** * DRM_CLIENT_CAP_UNIVERSAL_PLANES * * If set to 1, the DRM core will expose all planes (overlay, primary, and * cursor) to userspace. */ #define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2 /** * DRM_CLIENT_CAP_ATOMIC * * If set to 1, the DRM core will expose atomic properties to userspace */ #define DRM_CLIENT_CAP_ATOMIC 3 /** * DRM_CLIENT_CAP_ASPECT_RATIO * * If set to 1, the DRM core will provide aspect ratio information in modes. */ #define DRM_CLIENT_CAP_ASPECT_RATIO 4 /** * DRM_CLIENT_CAP_WRITEBACK_CONNECTORS * * If set to 1, the DRM core will expose special connectors to be used for * writing back to memory the scene setup in the commit. Depends on client * also supporting DRM_CLIENT_CAP_ATOMIC */ #define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 5 /** DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ struct drm_set_client_cap { __u64 capability; __u64 value; }; #define DRM_RDWR O_RDWR #define DRM_CLOEXEC O_CLOEXEC struct drm_prime_handle { __u32 handle; /** Flags.. only applicable for handle->fd */ __u32 flags; /** Returned dmabuf file descriptor */ __s32 fd; }; struct drm_syncobj_create { __u32 handle; #define DRM_SYNCOBJ_CREATE_SIGNALED (1 << 0) __u32 flags; }; struct drm_syncobj_destroy { __u32 handle; __u32 pad; }; #define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE (1 << 0) #define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE (1 << 0) struct drm_syncobj_handle { __u32 handle; __u32 flags; __s32 fd; __u32 pad; }; #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0) #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1) struct drm_syncobj_wait { __u64 handles; /* absolute timeout */ __s64 timeout_nsec; __u32 count_handles; __u32 flags; __u32 first_signaled; /* only valid when not waiting all */ __u32 pad; }; struct drm_syncobj_array { __u64 handles; __u32 count_handles; __u32 pad; }; /* Query current scanout sequence number */ struct drm_crtc_get_sequence { __u32 crtc_id; /* requested crtc_id */ __u32 active; /* return: crtc output is active */ __u64 sequence; /* return: most recent vblank sequence */ __s64 sequence_ns; /* return: most recent time of first pixel out */ }; /* Queue event to be delivered at specified sequence. Time stamp marks * when the first pixel of the refresh cycle leaves the display engine * for the display */ #define DRM_CRTC_SEQUENCE_RELATIVE 0x00000001 /* sequence is relative to current */ #define DRM_CRTC_SEQUENCE_NEXT_ON_MISS 0x00000002 /* Use next sequence if we've missed */ struct drm_crtc_queue_sequence { __u32 crtc_id; __u32 flags; __u64 sequence; /* on input, target sequence. on output, actual sequence */ __u64 user_data; /* user data passed to event */ }; #if defined(__cplusplus) } #endif #include "drm_mode.h" #if defined(__cplusplus) extern "C" { #endif #define DRM_IOCTL_BASE 'd' #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) #define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type) #define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type) #define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type) #define DRM_IOCTL_VERSION DRM_IOWR(0x00, struct drm_version) #define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, struct drm_unique) #define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, struct drm_auth) #define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, struct drm_irq_busid) #define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, struct drm_map) #define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client) #define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) #define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version) #define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl) #define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close) #define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink) #define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open) #define DRM_IOCTL_GET_CAP DRM_IOWR(0x0c, struct drm_get_cap) #define DRM_IOCTL_SET_CLIENT_CAP DRM_IOW( 0x0d, struct drm_set_client_cap) #define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) #define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) #define DRM_IOCTL_BLOCK DRM_IOWR(0x12, struct drm_block) #define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, struct drm_block) #define DRM_IOCTL_CONTROL DRM_IOW( 0x14, struct drm_control) #define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, struct drm_map) #define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, struct drm_buf_desc) #define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, struct drm_buf_desc) #define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, struct drm_buf_info) #define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, struct drm_buf_map) #define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, struct drm_buf_free) #define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, struct drm_map) #define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, struct drm_ctx_priv_map) #define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, struct drm_ctx_priv_map) #define DRM_IOCTL_SET_MASTER DRM_IO(0x1e) #define DRM_IOCTL_DROP_MASTER DRM_IO(0x1f) #define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, struct drm_ctx) #define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, struct drm_ctx) #define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, struct drm_ctx) #define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, struct drm_ctx) #define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, struct drm_ctx) #define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, struct drm_ctx) #define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, struct drm_ctx_res) #define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, struct drm_draw) #define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, struct drm_draw) #define DRM_IOCTL_DMA DRM_IOWR(0x29, struct drm_dma) #define DRM_IOCTL_LOCK DRM_IOW( 0x2a, struct drm_lock) #define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) #define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) #define DRM_IOCTL_PRIME_HANDLE_TO_FD DRM_IOWR(0x2d, struct drm_prime_handle) #define DRM_IOCTL_PRIME_FD_TO_HANDLE DRM_IOWR(0x2e, struct drm_prime_handle) #define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) #define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) #define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode) #define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, struct drm_agp_info) #define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, struct drm_agp_buffer) #define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, struct drm_agp_buffer) #define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, struct drm_agp_binding) #define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, struct drm_agp_binding) #define DRM_IOCTL_SG_ALLOC DRM_IOWR(0x38, struct drm_scatter_gather) #define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, struct drm_scatter_gather) #define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, union drm_wait_vblank) #define DRM_IOCTL_CRTC_GET_SEQUENCE DRM_IOWR(0x3b, struct drm_crtc_get_sequence) #define DRM_IOCTL_CRTC_QUEUE_SEQUENCE DRM_IOWR(0x3c, struct drm_crtc_queue_sequence) #define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw) #define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res) #define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc) #define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA2, struct drm_mode_crtc) #define DRM_IOCTL_MODE_CURSOR DRM_IOWR(0xA3, struct drm_mode_cursor) #define DRM_IOCTL_MODE_GETGAMMA DRM_IOWR(0xA4, struct drm_mode_crtc_lut) #define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut) #define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder) #define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector) #define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) /* deprecated (never worked) */ #define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) /* deprecated (never worked) */ #define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property) #define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property) #define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, struct drm_mode_get_blob) #define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) #define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) #define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip) #define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd) #define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb) #define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb) #define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb) #define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res) #define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane) #define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane) #define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2) #define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties) #define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property) #define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2) #define DRM_IOCTL_MODE_ATOMIC DRM_IOWR(0xBC, struct drm_mode_atomic) #define DRM_IOCTL_MODE_CREATEPROPBLOB DRM_IOWR(0xBD, struct drm_mode_create_blob) #define DRM_IOCTL_MODE_DESTROYPROPBLOB DRM_IOWR(0xBE, struct drm_mode_destroy_blob) #define DRM_IOCTL_SYNCOBJ_CREATE DRM_IOWR(0xBF, struct drm_syncobj_create) #define DRM_IOCTL_SYNCOBJ_DESTROY DRM_IOWR(0xC0, struct drm_syncobj_destroy) #define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD DRM_IOWR(0xC1, struct drm_syncobj_handle) #define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE DRM_IOWR(0xC2, struct drm_syncobj_handle) #define DRM_IOCTL_SYNCOBJ_WAIT DRM_IOWR(0xC3, struct drm_syncobj_wait) #define DRM_IOCTL_SYNCOBJ_RESET DRM_IOWR(0xC4, struct drm_syncobj_array) #define DRM_IOCTL_SYNCOBJ_SIGNAL DRM_IOWR(0xC5, struct drm_syncobj_array) #define DRM_IOCTL_MODE_CREATE_LEASE DRM_IOWR(0xC6, struct drm_mode_create_lease) #define DRM_IOCTL_MODE_LIST_LESSEES DRM_IOWR(0xC7, struct drm_mode_list_lessees) #define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease) #define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease) /** * Device specific ioctls should only be in their respective headers * The device specific ioctl range is from 0x40 to 0x9f. * Generic IOCTLS restart at 0xA0. * * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and * drmCommandReadWrite(). */ #define DRM_COMMAND_BASE 0x40 #define DRM_COMMAND_END 0xA0 /** * Header for events written back to userspace on the drm fd. The * type defines the type of event, the length specifies the total * length of the event (including the header), and user_data is * typically a 64 bit value passed with the ioctl that triggered the * event. A read on the drm fd will always only return complete * events, that is, if for example the read buffer is 100 bytes, and * there are two 64 byte events pending, only one will be returned. * * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and * up are chipset specific. */ struct drm_event { __u32 type; __u32 length; }; #define DRM_EVENT_VBLANK 0x01 #define DRM_EVENT_FLIP_COMPLETE 0x02 #define DRM_EVENT_CRTC_SEQUENCE 0x03 struct drm_event_vblank { struct drm_event base; __u64 user_data; __u32 tv_sec; __u32 tv_usec; __u32 sequence; __u32 crtc_id; /* 0 on older kernels that do not support this */ }; /* Event delivered at sequence. Time stamp marks when the first pixel * of the refresh cycle leaves the display engine for the display */ struct drm_event_crtc_sequence { struct drm_event base; __u64 user_data; __s64 time_ns; __u64 sequence; }; /* typedef area */ typedef struct drm_clip_rect drm_clip_rect_t; typedef struct drm_drawable_info drm_drawable_info_t; typedef struct drm_tex_region drm_tex_region_t; typedef struct drm_hw_lock drm_hw_lock_t; typedef struct drm_version drm_version_t; typedef struct drm_unique drm_unique_t; typedef struct drm_list drm_list_t; typedef struct drm_block drm_block_t; typedef struct drm_control drm_control_t; typedef enum drm_map_type drm_map_type_t; typedef enum drm_map_flags drm_map_flags_t; typedef struct drm_ctx_priv_map drm_ctx_priv_map_t; typedef struct drm_map drm_map_t; typedef struct drm_client drm_client_t; typedef enum drm_stat_type drm_stat_type_t; typedef struct drm_stats drm_stats_t; typedef enum drm_lock_flags drm_lock_flags_t; typedef struct drm_lock drm_lock_t; typedef enum drm_dma_flags drm_dma_flags_t; typedef struct drm_buf_desc drm_buf_desc_t; typedef struct drm_buf_info drm_buf_info_t; typedef struct drm_buf_free drm_buf_free_t; typedef struct drm_buf_pub drm_buf_pub_t; typedef struct drm_buf_map drm_buf_map_t; typedef struct drm_dma drm_dma_t; typedef union drm_wait_vblank drm_wait_vblank_t; typedef struct drm_agp_mode drm_agp_mode_t; typedef enum drm_ctx_flags drm_ctx_flags_t; typedef struct drm_ctx drm_ctx_t; typedef struct drm_ctx_res drm_ctx_res_t; typedef struct drm_draw drm_draw_t; typedef struct drm_update_draw drm_update_draw_t; typedef struct drm_auth drm_auth_t; typedef struct drm_irq_busid drm_irq_busid_t; typedef enum drm_vblank_seq_type drm_vblank_seq_type_t; typedef struct drm_agp_buffer drm_agp_buffer_t; typedef struct drm_agp_binding drm_agp_binding_t; typedef struct drm_agp_info drm_agp_info_t; typedef struct drm_scatter_gather drm_scatter_gather_t; typedef struct drm_set_version drm_set_version_t; #if defined(__cplusplus) } #endif #endif �������������������������������������������������������������������������������������������������������������������������������drm/sis_drm.h���������������������������������������������������������������������������������������0000644�����������������00000005115�14763166027�0007155 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* sis_drv.h -- Private header for sis driver -*- linux-c -*- */ /* * Copyright 2005 Eric Anholt * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ #ifndef __SIS_DRM_H__ #define __SIS_DRM_H__ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* SiS specific ioctls */ #define NOT_USED_0_3 #define DRM_SIS_FB_ALLOC 0x04 #define DRM_SIS_FB_FREE 0x05 #define NOT_USED_6_12 #define DRM_SIS_AGP_INIT 0x13 #define DRM_SIS_AGP_ALLOC 0x14 #define DRM_SIS_AGP_FREE 0x15 #define DRM_SIS_FB_INIT 0x16 #define DRM_IOCTL_SIS_FB_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_FB_ALLOC, drm_sis_mem_t) #define DRM_IOCTL_SIS_FB_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_FB_FREE, drm_sis_mem_t) #define DRM_IOCTL_SIS_AGP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_AGP_INIT, drm_sis_agp_t) #define DRM_IOCTL_SIS_AGP_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_AGP_ALLOC, drm_sis_mem_t) #define DRM_IOCTL_SIS_AGP_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_AGP_FREE, drm_sis_mem_t) #define DRM_IOCTL_SIS_FB_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_FB_INIT, drm_sis_fb_t) /* #define DRM_IOCTL_SIS_FLIP DRM_IOW( 0x48, drm_sis_flip_t) #define DRM_IOCTL_SIS_FLIP_INIT DRM_IO( 0x49) #define DRM_IOCTL_SIS_FLIP_FINAL DRM_IO( 0x50) */ typedef struct { int context; unsigned long offset; unsigned long size; unsigned long free; } drm_sis_mem_t; typedef struct { unsigned long offset, size; } drm_sis_agp_t; typedef struct { unsigned long offset, size; } drm_sis_fb_t; #if defined(__cplusplus) } #endif #endif /* __SIS_DRM_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/vgem_drm.h��������������������������������������������������������������������������������������0000644�����������������00000003663�14763166027�0007323 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright 2016 Intel Corporation * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #ifndef _VGEM_DRM_H_ #define _VGEM_DRM_H_ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* Please note that modifications to all structs defined here are * subject to backwards-compatibility constraints. */ #define DRM_VGEM_FENCE_ATTACH 0x1 #define DRM_VGEM_FENCE_SIGNAL 0x2 #define DRM_IOCTL_VGEM_FENCE_ATTACH DRM_IOWR( DRM_COMMAND_BASE + DRM_VGEM_FENCE_ATTACH, struct drm_vgem_fence_attach) #define DRM_IOCTL_VGEM_FENCE_SIGNAL DRM_IOW( DRM_COMMAND_BASE + DRM_VGEM_FENCE_SIGNAL, struct drm_vgem_fence_signal) struct drm_vgem_fence_attach { __u32 handle; __u32 flags; #define VGEM_FENCE_WRITE 0x1 __u32 out_fence; __u32 pad; }; struct drm_vgem_fence_signal { __u32 fence; __u32 flags; }; #if defined(__cplusplus) } #endif #endif /* _VGEM_DRM_H_ */ �����������������������������������������������������������������������������drm/drm_sarea.h�������������������������������������������������������������������������������������0000644�����������������00000005336�14763166027�0007457 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file drm_sarea.h * \brief SAREA definitions * * \author Michel Dänzer <michel@daenzer.net> */ /* * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _DRM_SAREA_H_ #define _DRM_SAREA_H_ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* SAREA area needs to be at least a page */ #if defined(__alpha__) #define SAREA_MAX 0x2000U #elif defined(__mips__) #define SAREA_MAX 0x4000U #elif defined(__ia64__) #define SAREA_MAX 0x10000U /* 64kB */ #else /* Intel 830M driver needs at least 8k SAREA */ #define SAREA_MAX 0x2000U #endif /** Maximum number of drawables in the SAREA */ #define SAREA_MAX_DRAWABLES 256 #define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000 /** SAREA drawable */ struct drm_sarea_drawable { unsigned int stamp; unsigned int flags; }; /** SAREA frame */ struct drm_sarea_frame { unsigned int x; unsigned int y; unsigned int width; unsigned int height; unsigned int fullscreen; }; /** SAREA */ struct drm_sarea { /** first thing is always the DRM locking structure */ struct drm_hw_lock lock; /** \todo Use readers/writer lock for drm_sarea::drawable_lock */ struct drm_hw_lock drawable_lock; struct drm_sarea_drawable drawableTable[SAREA_MAX_DRAWABLES]; /**< drawables */ struct drm_sarea_frame frame; /**< frame */ drm_context_t dummy_context; }; typedef struct drm_sarea_drawable drm_sarea_drawable_t; typedef struct drm_sarea_frame drm_sarea_frame_t; typedef struct drm_sarea drm_sarea_t; #if defined(__cplusplus) } #endif #endif /* _DRM_SAREA_H_ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/vc4_drm.h���������������������������������������������������������������������������������������0000644�����������������00000034171�14763166027�0007057 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright © 2014-2015 Broadcom * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef _VC4_DRM_H_ #define _VC4_DRM_H_ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif #define DRM_VC4_SUBMIT_CL 0x00 #define DRM_VC4_WAIT_SEQNO 0x01 #define DRM_VC4_WAIT_BO 0x02 #define DRM_VC4_CREATE_BO 0x03 #define DRM_VC4_MMAP_BO 0x04 #define DRM_VC4_CREATE_SHADER_BO 0x05 #define DRM_VC4_GET_HANG_STATE 0x06 #define DRM_VC4_GET_PARAM 0x07 #define DRM_VC4_SET_TILING 0x08 #define DRM_VC4_GET_TILING 0x09 #define DRM_VC4_LABEL_BO 0x0a #define DRM_VC4_GEM_MADVISE 0x0b #define DRM_VC4_PERFMON_CREATE 0x0c #define DRM_VC4_PERFMON_DESTROY 0x0d #define DRM_VC4_PERFMON_GET_VALUES 0x0e #define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl) #define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno) #define DRM_IOCTL_VC4_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_BO, struct drm_vc4_wait_bo) #define DRM_IOCTL_VC4_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_BO, struct drm_vc4_create_bo) #define DRM_IOCTL_VC4_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_MMAP_BO, struct drm_vc4_mmap_bo) #define DRM_IOCTL_VC4_CREATE_SHADER_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_SHADER_BO, struct drm_vc4_create_shader_bo) #define DRM_IOCTL_VC4_GET_HANG_STATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_HANG_STATE, struct drm_vc4_get_hang_state) #define DRM_IOCTL_VC4_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_PARAM, struct drm_vc4_get_param) #define DRM_IOCTL_VC4_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SET_TILING, struct drm_vc4_set_tiling) #define DRM_IOCTL_VC4_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_TILING, struct drm_vc4_get_tiling) #define DRM_IOCTL_VC4_LABEL_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_LABEL_BO, struct drm_vc4_label_bo) #define DRM_IOCTL_VC4_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GEM_MADVISE, struct drm_vc4_gem_madvise) #define DRM_IOCTL_VC4_PERFMON_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_CREATE, struct drm_vc4_perfmon_create) #define DRM_IOCTL_VC4_PERFMON_DESTROY DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_DESTROY, struct drm_vc4_perfmon_destroy) #define DRM_IOCTL_VC4_PERFMON_GET_VALUES DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_GET_VALUES, struct drm_vc4_perfmon_get_values) struct drm_vc4_submit_rcl_surface { __u32 hindex; /* Handle index, or ~0 if not present. */ __u32 offset; /* Offset to start of buffer. */ /* * Bits for either render config (color_write) or load/store packet. * Bits should all be 0 for MSAA load/stores. */ __u16 bits; #define VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES (1 << 0) __u16 flags; }; /** * struct drm_vc4_submit_cl - ioctl argument for submitting commands to the 3D * engine. * * Drivers typically use GPU BOs to store batchbuffers / command lists and * their associated state. However, because the VC4 lacks an MMU, we have to * do validation of memory accesses by the GPU commands. If we were to store * our commands in BOs, we'd need to do uncached readback from them to do the * validation process, which is too expensive. Instead, userspace accumulates * commands and associated state in plain memory, then the kernel copies the * data to its own address space, and then validates and stores it in a GPU * BO. */ struct drm_vc4_submit_cl { /* Pointer to the binner command list. * * This is the first set of commands executed, which runs the * coordinate shader to determine where primitives land on the screen, * then writes out the state updates and draw calls necessary per tile * to the tile allocation BO. */ __u64 bin_cl; /* Pointer to the shader records. * * Shader records are the structures read by the hardware that contain * pointers to uniforms, shaders, and vertex attributes. The * reference to the shader record has enough information to determine * how many pointers are necessary (fixed number for shaders/uniforms, * and an attribute count), so those BO indices into bo_handles are * just stored as __u32s before each shader record passed in. */ __u64 shader_rec; /* Pointer to uniform data and texture handles for the textures * referenced by the shader. * * For each shader state record, there is a set of uniform data in the * order referenced by the record (FS, VS, then CS). Each set of * uniform data has a __u32 index into bo_handles per texture * sample operation, in the order the QPU_W_TMUn_S writes appear in * the program. Following the texture BO handle indices is the actual * uniform data. * * The individual uniform state blocks don't have sizes passed in, * because the kernel has to determine the sizes anyway during shader * code validation. */ __u64 uniforms; __u64 bo_handles; /* Size in bytes of the binner command list. */ __u32 bin_cl_size; /* Size in bytes of the set of shader records. */ __u32 shader_rec_size; /* Number of shader records. * * This could just be computed from the contents of shader_records and * the address bits of references to them from the bin CL, but it * keeps the kernel from having to resize some allocations it makes. */ __u32 shader_rec_count; /* Size in bytes of the uniform state. */ __u32 uniforms_size; /* Number of BO handles passed in (size is that times 4). */ __u32 bo_handle_count; /* RCL setup: */ __u16 width; __u16 height; __u8 min_x_tile; __u8 min_y_tile; __u8 max_x_tile; __u8 max_y_tile; struct drm_vc4_submit_rcl_surface color_read; struct drm_vc4_submit_rcl_surface color_write; struct drm_vc4_submit_rcl_surface zs_read; struct drm_vc4_submit_rcl_surface zs_write; struct drm_vc4_submit_rcl_surface msaa_color_write; struct drm_vc4_submit_rcl_surface msaa_zs_write; __u32 clear_color[2]; __u32 clear_z; __u8 clear_s; __u32 pad:24; #define VC4_SUBMIT_CL_USE_CLEAR_COLOR (1 << 0) /* By default, the kernel gets to choose the order that the tiles are * rendered in. If this is set, then the tiles will be rendered in a * raster order, with the right-to-left vs left-to-right and * top-to-bottom vs bottom-to-top dictated by * VC4_SUBMIT_CL_RCL_ORDER_INCREASING_*. This allows overlapping * blits to be implemented using the 3D engine. */ #define VC4_SUBMIT_CL_FIXED_RCL_ORDER (1 << 1) #define VC4_SUBMIT_CL_RCL_ORDER_INCREASING_X (1 << 2) #define VC4_SUBMIT_CL_RCL_ORDER_INCREASING_Y (1 << 3) __u32 flags; /* Returned value of the seqno of this render job (for the * wait ioctl). */ __u64 seqno; /* ID of the perfmon to attach to this job. 0 means no perfmon. */ __u32 perfmonid; /* Syncobj handle to wait on. If set, processing of this render job * will not start until the syncobj is signaled. 0 means ignore. */ __u32 in_sync; /* Syncobj handle to export fence to. If set, the fence in the syncobj * will be replaced with a fence that signals upon completion of this * render job. 0 means ignore. */ __u32 out_sync; __u32 pad2; }; /** * struct drm_vc4_wait_seqno - ioctl argument for waiting for * DRM_VC4_SUBMIT_CL completion using its returned seqno. * * timeout_ns is the timeout in nanoseconds, where "0" means "don't * block, just return the status." */ struct drm_vc4_wait_seqno { __u64 seqno; __u64 timeout_ns; }; /** * struct drm_vc4_wait_bo - ioctl argument for waiting for * completion of the last DRM_VC4_SUBMIT_CL on a BO. * * This is useful for cases where multiple processes might be * rendering to a BO and you want to wait for all rendering to be * completed. */ struct drm_vc4_wait_bo { __u32 handle; __u32 pad; __u64 timeout_ns; }; /** * struct drm_vc4_create_bo - ioctl argument for creating VC4 BOs. * * There are currently no values for the flags argument, but it may be * used in a future extension. */ struct drm_vc4_create_bo { __u32 size; __u32 flags; /** Returned GEM handle for the BO. */ __u32 handle; __u32 pad; }; /** * struct drm_vc4_mmap_bo - ioctl argument for mapping VC4 BOs. * * This doesn't actually perform an mmap. Instead, it returns the * offset you need to use in an mmap on the DRM device node. This * means that tools like valgrind end up knowing about the mapped * memory. * * There are currently no values for the flags argument, but it may be * used in a future extension. */ struct drm_vc4_mmap_bo { /** Handle for the object being mapped. */ __u32 handle; __u32 flags; /** offset into the drm node to use for subsequent mmap call. */ __u64 offset; }; /** * struct drm_vc4_create_shader_bo - ioctl argument for creating VC4 * shader BOs. * * Since allowing a shader to be overwritten while it's also being * executed from would allow privlege escalation, shaders must be * created using this ioctl, and they can't be mmapped later. */ struct drm_vc4_create_shader_bo { /* Size of the data argument. */ __u32 size; /* Flags, currently must be 0. */ __u32 flags; /* Pointer to the data. */ __u64 data; /** Returned GEM handle for the BO. */ __u32 handle; /* Pad, must be 0. */ __u32 pad; }; struct drm_vc4_get_hang_state_bo { __u32 handle; __u32 paddr; __u32 size; __u32 pad; }; /** * struct drm_vc4_hang_state - ioctl argument for collecting state * from a GPU hang for analysis. */ struct drm_vc4_get_hang_state { /** Pointer to array of struct drm_vc4_get_hang_state_bo. */ __u64 bo; /** * On input, the size of the bo array. Output is the number * of bos to be returned. */ __u32 bo_count; __u32 start_bin, start_render; __u32 ct0ca, ct0ea; __u32 ct1ca, ct1ea; __u32 ct0cs, ct1cs; __u32 ct0ra0, ct1ra0; __u32 bpca, bpcs; __u32 bpoa, bpos; __u32 vpmbase; __u32 dbge; __u32 fdbgo; __u32 fdbgb; __u32 fdbgr; __u32 fdbgs; __u32 errstat; /* Pad that we may save more registers into in the future. */ __u32 pad[16]; }; #define DRM_VC4_PARAM_V3D_IDENT0 0 #define DRM_VC4_PARAM_V3D_IDENT1 1 #define DRM_VC4_PARAM_V3D_IDENT2 2 #define DRM_VC4_PARAM_SUPPORTS_BRANCHES 3 #define DRM_VC4_PARAM_SUPPORTS_ETC1 4 #define DRM_VC4_PARAM_SUPPORTS_THREADED_FS 5 #define DRM_VC4_PARAM_SUPPORTS_FIXED_RCL_ORDER 6 #define DRM_VC4_PARAM_SUPPORTS_MADVISE 7 #define DRM_VC4_PARAM_SUPPORTS_PERFMON 8 struct drm_vc4_get_param { __u32 param; __u32 pad; __u64 value; }; struct drm_vc4_get_tiling { __u32 handle; __u32 flags; __u64 modifier; }; struct drm_vc4_set_tiling { __u32 handle; __u32 flags; __u64 modifier; }; /** * struct drm_vc4_label_bo - Attach a name to a BO for debug purposes. */ struct drm_vc4_label_bo { __u32 handle; __u32 len; __u64 name; }; /* * States prefixed with '__' are internal states and cannot be passed to the * DRM_IOCTL_VC4_GEM_MADVISE ioctl. */ #define VC4_MADV_WILLNEED 0 #define VC4_MADV_DONTNEED 1 #define __VC4_MADV_PURGED 2 #define __VC4_MADV_NOTSUPP 3 struct drm_vc4_gem_madvise { __u32 handle; __u32 madv; __u32 retained; __u32 pad; }; enum { VC4_PERFCNT_FEP_VALID_PRIMS_NO_RENDER, VC4_PERFCNT_FEP_VALID_PRIMS_RENDER, VC4_PERFCNT_FEP_CLIPPED_QUADS, VC4_PERFCNT_FEP_VALID_QUADS, VC4_PERFCNT_TLB_QUADS_NOT_PASSING_STENCIL, VC4_PERFCNT_TLB_QUADS_NOT_PASSING_Z_AND_STENCIL, VC4_PERFCNT_TLB_QUADS_PASSING_Z_AND_STENCIL, VC4_PERFCNT_TLB_QUADS_ZERO_COVERAGE, VC4_PERFCNT_TLB_QUADS_NON_ZERO_COVERAGE, VC4_PERFCNT_TLB_QUADS_WRITTEN_TO_COLOR_BUF, VC4_PERFCNT_PLB_PRIMS_OUTSIDE_VIEWPORT, VC4_PERFCNT_PLB_PRIMS_NEED_CLIPPING, VC4_PERFCNT_PSE_PRIMS_REVERSED, VC4_PERFCNT_QPU_TOTAL_IDLE_CYCLES, VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_VERTEX_COORD_SHADING, VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_FRAGMENT_SHADING, VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_EXEC_VALID_INST, VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_TMUS, VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_SCOREBOARD, VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_VARYINGS, VC4_PERFCNT_QPU_TOTAL_INST_CACHE_HIT, VC4_PERFCNT_QPU_TOTAL_INST_CACHE_MISS, VC4_PERFCNT_QPU_TOTAL_UNIFORM_CACHE_HIT, VC4_PERFCNT_QPU_TOTAL_UNIFORM_CACHE_MISS, VC4_PERFCNT_TMU_TOTAL_TEXT_QUADS_PROCESSED, VC4_PERFCNT_TMU_TOTAL_TEXT_CACHE_MISS, VC4_PERFCNT_VPM_TOTAL_CLK_CYCLES_VDW_STALLED, VC4_PERFCNT_VPM_TOTAL_CLK_CYCLES_VCD_STALLED, VC4_PERFCNT_L2C_TOTAL_L2_CACHE_HIT, VC4_PERFCNT_L2C_TOTAL_L2_CACHE_MISS, VC4_PERFCNT_NUM_EVENTS, }; #define DRM_VC4_MAX_PERF_COUNTERS 16 struct drm_vc4_perfmon_create { __u32 id; __u32 ncounters; __u8 events[DRM_VC4_MAX_PERF_COUNTERS]; }; struct drm_vc4_perfmon_destroy { __u32 id; }; /* * Returns the values of the performance counters tracked by this * perfmon (as an array of ncounters u64 values). * * No implicit synchronization is performed, so the user has to * guarantee that any jobs using this perfmon have already been * completed (probably by blocking on the seqno returned by the * last exec that used the perfmon). */ struct drm_vc4_perfmon_get_values { __u32 id; __u64 values_ptr; }; #if defined(__cplusplus) } #endif #endif /* _VC4_DRM_H_ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/drm_mode.h��������������������������������������������������������������������������������������0000644�����������������00000057370�14763166027�0007315 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2007 Dave Airlie <airlied@linux.ie> * Copyright (c) 2007 Jakob Bornecrantz <wallbraker@gmail.com> * Copyright (c) 2008 Red Hat Inc. * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA * Copyright (c) 2007-2008 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef _DRM_MODE_H #define _DRM_MODE_H #include "drm.h" #if defined(__cplusplus) extern "C" { #endif #define DRM_DISPLAY_INFO_LEN 32 #define DRM_CONNECTOR_NAME_LEN 32 #define DRM_DISPLAY_MODE_LEN 32 #define DRM_PROP_NAME_LEN 32 #define DRM_MODE_TYPE_BUILTIN (1<<0) /* deprecated */ #define DRM_MODE_TYPE_CLOCK_C ((1<<1) | DRM_MODE_TYPE_BUILTIN) /* deprecated */ #define DRM_MODE_TYPE_CRTC_C ((1<<2) | DRM_MODE_TYPE_BUILTIN) /* deprecated */ #define DRM_MODE_TYPE_PREFERRED (1<<3) #define DRM_MODE_TYPE_DEFAULT (1<<4) /* deprecated */ #define DRM_MODE_TYPE_USERDEF (1<<5) #define DRM_MODE_TYPE_DRIVER (1<<6) #define DRM_MODE_TYPE_ALL (DRM_MODE_TYPE_PREFERRED | \ DRM_MODE_TYPE_USERDEF | \ DRM_MODE_TYPE_DRIVER) /* Video mode flags */ /* bit compatible with the xrandr RR_ definitions (bits 0-13) * * ABI warning: Existing userspace really expects * the mode flags to match the xrandr definitions. Any * changes that don't match the xrandr definitions will * likely need a new client cap or some other mechanism * to avoid breaking existing userspace. This includes * allocating new flags in the previously unused bits! */ #define DRM_MODE_FLAG_PHSYNC (1<<0) #define DRM_MODE_FLAG_NHSYNC (1<<1) #define DRM_MODE_FLAG_PVSYNC (1<<2) #define DRM_MODE_FLAG_NVSYNC (1<<3) #define DRM_MODE_FLAG_INTERLACE (1<<4) #define DRM_MODE_FLAG_DBLSCAN (1<<5) #define DRM_MODE_FLAG_CSYNC (1<<6) #define DRM_MODE_FLAG_PCSYNC (1<<7) #define DRM_MODE_FLAG_NCSYNC (1<<8) #define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */ #define DRM_MODE_FLAG_BCAST (1<<10) /* deprecated */ #define DRM_MODE_FLAG_PIXMUX (1<<11) /* deprecated */ #define DRM_MODE_FLAG_DBLCLK (1<<12) #define DRM_MODE_FLAG_CLKDIV2 (1<<13) /* * When adding a new stereo mode don't forget to adjust DRM_MODE_FLAGS_3D_MAX * (define not exposed to user space). */ #define DRM_MODE_FLAG_3D_MASK (0x1f<<14) #define DRM_MODE_FLAG_3D_NONE (0<<14) #define DRM_MODE_FLAG_3D_FRAME_PACKING (1<<14) #define DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE (2<<14) #define DRM_MODE_FLAG_3D_LINE_ALTERNATIVE (3<<14) #define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL (4<<14) #define DRM_MODE_FLAG_3D_L_DEPTH (5<<14) #define DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH (6<<14) #define DRM_MODE_FLAG_3D_TOP_AND_BOTTOM (7<<14) #define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF (8<<14) /* Picture aspect ratio options */ #define DRM_MODE_PICTURE_ASPECT_NONE 0 #define DRM_MODE_PICTURE_ASPECT_4_3 1 #define DRM_MODE_PICTURE_ASPECT_16_9 2 #define DRM_MODE_PICTURE_ASPECT_64_27 3 #define DRM_MODE_PICTURE_ASPECT_256_135 4 /* Content type options */ #define DRM_MODE_CONTENT_TYPE_NO_DATA 0 #define DRM_MODE_CONTENT_TYPE_GRAPHICS 1 #define DRM_MODE_CONTENT_TYPE_PHOTO 2 #define DRM_MODE_CONTENT_TYPE_CINEMA 3 #define DRM_MODE_CONTENT_TYPE_GAME 4 /* Aspect ratio flag bitmask (4 bits 22:19) */ #define DRM_MODE_FLAG_PIC_AR_MASK (0x0F<<19) #define DRM_MODE_FLAG_PIC_AR_NONE \ (DRM_MODE_PICTURE_ASPECT_NONE<<19) #define DRM_MODE_FLAG_PIC_AR_4_3 \ (DRM_MODE_PICTURE_ASPECT_4_3<<19) #define DRM_MODE_FLAG_PIC_AR_16_9 \ (DRM_MODE_PICTURE_ASPECT_16_9<<19) #define DRM_MODE_FLAG_PIC_AR_64_27 \ (DRM_MODE_PICTURE_ASPECT_64_27<<19) #define DRM_MODE_FLAG_PIC_AR_256_135 \ (DRM_MODE_PICTURE_ASPECT_256_135<<19) #define DRM_MODE_FLAG_ALL (DRM_MODE_FLAG_PHSYNC | \ DRM_MODE_FLAG_NHSYNC | \ DRM_MODE_FLAG_PVSYNC | \ DRM_MODE_FLAG_NVSYNC | \ DRM_MODE_FLAG_INTERLACE | \ DRM_MODE_FLAG_DBLSCAN | \ DRM_MODE_FLAG_CSYNC | \ DRM_MODE_FLAG_PCSYNC | \ DRM_MODE_FLAG_NCSYNC | \ DRM_MODE_FLAG_HSKEW | \ DRM_MODE_FLAG_DBLCLK | \ DRM_MODE_FLAG_CLKDIV2 | \ DRM_MODE_FLAG_3D_MASK) /* DPMS flags */ /* bit compatible with the xorg definitions. */ #define DRM_MODE_DPMS_ON 0 #define DRM_MODE_DPMS_STANDBY 1 #define DRM_MODE_DPMS_SUSPEND 2 #define DRM_MODE_DPMS_OFF 3 /* Scaling mode options */ #define DRM_MODE_SCALE_NONE 0 /* Unmodified timing (display or software can still scale) */ #define DRM_MODE_SCALE_FULLSCREEN 1 /* Full screen, ignore aspect */ #define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */ #define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */ /* Dithering mode options */ #define DRM_MODE_DITHERING_OFF 0 #define DRM_MODE_DITHERING_ON 1 #define DRM_MODE_DITHERING_AUTO 2 /* Dirty info options */ #define DRM_MODE_DIRTY_OFF 0 #define DRM_MODE_DIRTY_ON 1 #define DRM_MODE_DIRTY_ANNOTATE 2 /* Link Status options */ #define DRM_MODE_LINK_STATUS_GOOD 0 #define DRM_MODE_LINK_STATUS_BAD 1 /* * DRM_MODE_ROTATE_<degrees> * * Signals that a drm plane is been rotated <degrees> degrees in counter * clockwise direction. * * This define is provided as a convenience, looking up the property id * using the name->prop id lookup is the preferred method. */ #define DRM_MODE_ROTATE_0 (1<<0) #define DRM_MODE_ROTATE_90 (1<<1) #define DRM_MODE_ROTATE_180 (1<<2) #define DRM_MODE_ROTATE_270 (1<<3) /* * DRM_MODE_ROTATE_MASK * * Bitmask used to look for drm plane rotations. */ #define DRM_MODE_ROTATE_MASK (\ DRM_MODE_ROTATE_0 | \ DRM_MODE_ROTATE_90 | \ DRM_MODE_ROTATE_180 | \ DRM_MODE_ROTATE_270) /* * DRM_MODE_REFLECT_<axis> * * Signals that the contents of a drm plane is reflected in the <axis> axis, * in the same way as mirroring. * * This define is provided as a convenience, looking up the property id * using the name->prop id lookup is the preferred method. */ #define DRM_MODE_REFLECT_X (1<<4) #define DRM_MODE_REFLECT_Y (1<<5) /* * DRM_MODE_REFLECT_MASK * * Bitmask used to look for drm plane reflections. */ #define DRM_MODE_REFLECT_MASK (\ DRM_MODE_REFLECT_X | \ DRM_MODE_REFLECT_Y) /* Content Protection Flags */ #define DRM_MODE_CONTENT_PROTECTION_UNDESIRED 0 #define DRM_MODE_CONTENT_PROTECTION_DESIRED 1 #define DRM_MODE_CONTENT_PROTECTION_ENABLED 2 struct drm_mode_modeinfo { __u32 clock; __u16 hdisplay; __u16 hsync_start; __u16 hsync_end; __u16 htotal; __u16 hskew; __u16 vdisplay; __u16 vsync_start; __u16 vsync_end; __u16 vtotal; __u16 vscan; __u32 vrefresh; __u32 flags; __u32 type; char name[DRM_DISPLAY_MODE_LEN]; }; struct drm_mode_card_res { __u64 fb_id_ptr; __u64 crtc_id_ptr; __u64 connector_id_ptr; __u64 encoder_id_ptr; __u32 count_fbs; __u32 count_crtcs; __u32 count_connectors; __u32 count_encoders; __u32 min_width; __u32 max_width; __u32 min_height; __u32 max_height; }; struct drm_mode_crtc { __u64 set_connectors_ptr; __u32 count_connectors; __u32 crtc_id; /**< Id */ __u32 fb_id; /**< Id of framebuffer */ __u32 x; /**< x Position on the framebuffer */ __u32 y; /**< y Position on the framebuffer */ __u32 gamma_size; __u32 mode_valid; struct drm_mode_modeinfo mode; }; #define DRM_MODE_PRESENT_TOP_FIELD (1<<0) #define DRM_MODE_PRESENT_BOTTOM_FIELD (1<<1) /* Planes blend with or override other bits on the CRTC */ struct drm_mode_set_plane { __u32 plane_id; __u32 crtc_id; __u32 fb_id; /* fb object contains surface format type */ __u32 flags; /* see above flags */ /* Signed dest location allows it to be partially off screen */ __s32 crtc_x; __s32 crtc_y; __u32 crtc_w; __u32 crtc_h; /* Source values are 16.16 fixed point */ __u32 src_x; __u32 src_y; __u32 src_h; __u32 src_w; }; struct drm_mode_get_plane { __u32 plane_id; __u32 crtc_id; __u32 fb_id; __u32 possible_crtcs; __u32 gamma_size; __u32 count_format_types; __u64 format_type_ptr; }; struct drm_mode_get_plane_res { __u64 plane_id_ptr; __u32 count_planes; }; #define DRM_MODE_ENCODER_NONE 0 #define DRM_MODE_ENCODER_DAC 1 #define DRM_MODE_ENCODER_TMDS 2 #define DRM_MODE_ENCODER_LVDS 3 #define DRM_MODE_ENCODER_TVDAC 4 #define DRM_MODE_ENCODER_VIRTUAL 5 #define DRM_MODE_ENCODER_DSI 6 #define DRM_MODE_ENCODER_DPMST 7 #define DRM_MODE_ENCODER_DPI 8 struct drm_mode_get_encoder { __u32 encoder_id; __u32 encoder_type; __u32 crtc_id; /**< Id of crtc */ __u32 possible_crtcs; __u32 possible_clones; }; /* This is for connectors with multiple signal types. */ /* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */ enum drm_mode_subconnector { DRM_MODE_SUBCONNECTOR_Automatic = 0, DRM_MODE_SUBCONNECTOR_Unknown = 0, DRM_MODE_SUBCONNECTOR_DVID = 3, DRM_MODE_SUBCONNECTOR_DVIA = 4, DRM_MODE_SUBCONNECTOR_Composite = 5, DRM_MODE_SUBCONNECTOR_SVIDEO = 6, DRM_MODE_SUBCONNECTOR_Component = 8, DRM_MODE_SUBCONNECTOR_SCART = 9, }; #define DRM_MODE_CONNECTOR_Unknown 0 #define DRM_MODE_CONNECTOR_VGA 1 #define DRM_MODE_CONNECTOR_DVII 2 #define DRM_MODE_CONNECTOR_DVID 3 #define DRM_MODE_CONNECTOR_DVIA 4 #define DRM_MODE_CONNECTOR_Composite 5 #define DRM_MODE_CONNECTOR_SVIDEO 6 #define DRM_MODE_CONNECTOR_LVDS 7 #define DRM_MODE_CONNECTOR_Component 8 #define DRM_MODE_CONNECTOR_9PinDIN 9 #define DRM_MODE_CONNECTOR_DisplayPort 10 #define DRM_MODE_CONNECTOR_HDMIA 11 #define DRM_MODE_CONNECTOR_HDMIB 12 #define DRM_MODE_CONNECTOR_TV 13 #define DRM_MODE_CONNECTOR_eDP 14 #define DRM_MODE_CONNECTOR_VIRTUAL 15 #define DRM_MODE_CONNECTOR_DSI 16 #define DRM_MODE_CONNECTOR_DPI 17 #define DRM_MODE_CONNECTOR_WRITEBACK 18 struct drm_mode_get_connector { __u64 encoders_ptr; __u64 modes_ptr; __u64 props_ptr; __u64 prop_values_ptr; __u32 count_modes; __u32 count_props; __u32 count_encoders; __u32 encoder_id; /**< Current Encoder */ __u32 connector_id; /**< Id */ __u32 connector_type; __u32 connector_type_id; __u32 connection; __u32 mm_width; /**< width in millimeters */ __u32 mm_height; /**< height in millimeters */ __u32 subpixel; __u32 pad; }; #define DRM_MODE_PROP_PENDING (1<<0) /* deprecated, do not use */ #define DRM_MODE_PROP_RANGE (1<<1) #define DRM_MODE_PROP_IMMUTABLE (1<<2) #define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */ #define DRM_MODE_PROP_BLOB (1<<4) #define DRM_MODE_PROP_BITMASK (1<<5) /* bitmask of enumerated types */ /* non-extended types: legacy bitmask, one bit per type: */ #define DRM_MODE_PROP_LEGACY_TYPE ( \ DRM_MODE_PROP_RANGE | \ DRM_MODE_PROP_ENUM | \ DRM_MODE_PROP_BLOB | \ DRM_MODE_PROP_BITMASK) /* extended-types: rather than continue to consume a bit per type, * grab a chunk of the bits to use as integer type id. */ #define DRM_MODE_PROP_EXTENDED_TYPE 0x0000ffc0 #define DRM_MODE_PROP_TYPE(n) ((n) << 6) #define DRM_MODE_PROP_OBJECT DRM_MODE_PROP_TYPE(1) #define DRM_MODE_PROP_SIGNED_RANGE DRM_MODE_PROP_TYPE(2) /* the PROP_ATOMIC flag is used to hide properties from userspace that * is not aware of atomic properties. This is mostly to work around * older userspace (DDX drivers) that read/write each prop they find, * witout being aware that this could be triggering a lengthy modeset. */ #define DRM_MODE_PROP_ATOMIC 0x80000000 struct drm_mode_property_enum { __u64 value; char name[DRM_PROP_NAME_LEN]; }; struct drm_mode_get_property { __u64 values_ptr; /* values and blob lengths */ __u64 enum_blob_ptr; /* enum and blob id ptrs */ __u32 prop_id; __u32 flags; char name[DRM_PROP_NAME_LEN]; __u32 count_values; /* This is only used to count enum values, not blobs. The _blobs is * simply because of a historical reason, i.e. backwards compat. */ __u32 count_enum_blobs; }; struct drm_mode_connector_set_property { __u64 value; __u32 prop_id; __u32 connector_id; }; #define DRM_MODE_OBJECT_CRTC 0xcccccccc #define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0 #define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0 #define DRM_MODE_OBJECT_MODE 0xdededede #define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0 #define DRM_MODE_OBJECT_FB 0xfbfbfbfb #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee #define DRM_MODE_OBJECT_ANY 0 struct drm_mode_obj_get_properties { __u64 props_ptr; __u64 prop_values_ptr; __u32 count_props; __u32 obj_id; __u32 obj_type; }; struct drm_mode_obj_set_property { __u64 value; __u32 prop_id; __u32 obj_id; __u32 obj_type; }; struct drm_mode_get_blob { __u32 blob_id; __u32 length; __u64 data; }; struct drm_mode_fb_cmd { __u32 fb_id; __u32 width; __u32 height; __u32 pitch; __u32 bpp; __u32 depth; /* driver specific handle */ __u32 handle; }; #define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */ #define DRM_MODE_FB_MODIFIERS (1<<1) /* enables ->modifer[] */ struct drm_mode_fb_cmd2 { __u32 fb_id; __u32 width; __u32 height; __u32 pixel_format; /* fourcc code from drm_fourcc.h */ __u32 flags; /* see above flags */ /* * In case of planar formats, this ioctl allows up to 4 * buffer objects with offsets and pitches per plane. * The pitch and offset order is dictated by the fourcc, * e.g. NV12 (http://fourcc.org/yuv.php#NV12) is described as: * * YUV 4:2:0 image with a plane of 8 bit Y samples * followed by an interleaved U/V plane containing * 8 bit 2x2 subsampled colour difference samples. * * So it would consist of Y as offsets[0] and UV as * offsets[1]. Note that offsets[0] will generally * be 0 (but this is not required). * * To accommodate tiled, compressed, etc formats, a * modifier can be specified. The default value of zero * indicates "native" format as specified by the fourcc. * Vendor specific modifier token. Note that even though * it looks like we have a modifier per-plane, we in fact * do not. The modifier for each plane must be identical. * Thus all combinations of different data layouts for * multi plane formats must be enumerated as separate * modifiers. */ __u32 handles[4]; __u32 pitches[4]; /* pitch for each plane */ __u32 offsets[4]; /* offset of each plane */ __u64 modifier[4]; /* ie, tiling, compress */ }; #define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01 #define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02 #define DRM_MODE_FB_DIRTY_FLAGS 0x03 #define DRM_MODE_FB_DIRTY_MAX_CLIPS 256 /* * Mark a region of a framebuffer as dirty. * * Some hardware does not automatically update display contents * as a hardware or software draw to a framebuffer. This ioctl * allows userspace to tell the kernel and the hardware what * regions of the framebuffer have changed. * * The kernel or hardware is free to update more then just the * region specified by the clip rects. The kernel or hardware * may also delay and/or coalesce several calls to dirty into a * single update. * * Userspace may annotate the updates, the annotates are a * promise made by the caller that the change is either a copy * of pixels or a fill of a single color in the region specified. * * If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then * the number of updated regions are half of num_clips given, * where the clip rects are paired in src and dst. The width and * height of each one of the pairs must match. * * If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller * promises that the region specified of the clip rects is filled * completely with a single color as given in the color argument. */ struct drm_mode_fb_dirty_cmd { __u32 fb_id; __u32 flags; __u32 color; __u32 num_clips; __u64 clips_ptr; }; struct drm_mode_mode_cmd { __u32 connector_id; struct drm_mode_modeinfo mode; }; #define DRM_MODE_CURSOR_BO 0x01 #define DRM_MODE_CURSOR_MOVE 0x02 #define DRM_MODE_CURSOR_FLAGS 0x03 /* * depending on the value in flags different members are used. * * CURSOR_BO uses * crtc_id * width * height * handle - if 0 turns the cursor off * * CURSOR_MOVE uses * crtc_id * x * y */ struct drm_mode_cursor { __u32 flags; __u32 crtc_id; __s32 x; __s32 y; __u32 width; __u32 height; /* driver specific handle */ __u32 handle; }; struct drm_mode_cursor2 { __u32 flags; __u32 crtc_id; __s32 x; __s32 y; __u32 width; __u32 height; /* driver specific handle */ __u32 handle; __s32 hot_x; __s32 hot_y; }; struct drm_mode_crtc_lut { __u32 crtc_id; __u32 gamma_size; /* pointers to arrays */ __u64 red; __u64 green; __u64 blue; }; struct drm_color_ctm { /* * Conversion matrix in S31.32 sign-magnitude * (not two's complement!) format. */ __u64 matrix[9]; }; struct drm_color_lut { /* * Data is U0.16 fixed point format. */ __u16 red; __u16 green; __u16 blue; __u16 reserved; }; #define DRM_MODE_PAGE_FLIP_EVENT 0x01 #define DRM_MODE_PAGE_FLIP_ASYNC 0x02 #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4 #define DRM_MODE_PAGE_FLIP_TARGET_RELATIVE 0x8 #define DRM_MODE_PAGE_FLIP_TARGET (DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE | \ DRM_MODE_PAGE_FLIP_TARGET_RELATIVE) #define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT | \ DRM_MODE_PAGE_FLIP_ASYNC | \ DRM_MODE_PAGE_FLIP_TARGET) /* * Request a page flip on the specified crtc. * * This ioctl will ask KMS to schedule a page flip for the specified * crtc. Once any pending rendering targeting the specified fb (as of * ioctl time) has completed, the crtc will be reprogrammed to display * that fb after the next vertical refresh. The ioctl returns * immediately, but subsequent rendering to the current fb will block * in the execbuffer ioctl until the page flip happens. If a page * flip is already pending as the ioctl is called, EBUSY will be * returned. * * Flag DRM_MODE_PAGE_FLIP_EVENT requests that drm sends back a vblank * event (see drm.h: struct drm_event_vblank) when the page flip is * done. The user_data field passed in with this ioctl will be * returned as the user_data field in the vblank event struct. * * Flag DRM_MODE_PAGE_FLIP_ASYNC requests that the flip happen * 'as soon as possible', meaning that it not delay waiting for vblank. * This may cause tearing on the screen. * * The reserved field must be zero. */ struct drm_mode_crtc_page_flip { __u32 crtc_id; __u32 fb_id; __u32 flags; __u32 reserved; __u64 user_data; }; /* * Request a page flip on the specified crtc. * * Same as struct drm_mode_crtc_page_flip, but supports new flags and * re-purposes the reserved field: * * The sequence field must be zero unless either of the * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is specified. When * the ABSOLUTE flag is specified, the sequence field denotes the absolute * vblank sequence when the flip should take effect. When the RELATIVE * flag is specified, the sequence field denotes the relative (to the * current one when the ioctl is called) vblank sequence when the flip * should take effect. NOTE: DRM_IOCTL_WAIT_VBLANK must still be used to * make sure the vblank sequence before the target one has passed before * calling this ioctl. The purpose of the * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is merely to clarify * the target for when code dealing with a page flip runs during a * vertical blank period. */ struct drm_mode_crtc_page_flip_target { __u32 crtc_id; __u32 fb_id; __u32 flags; __u32 sequence; __u64 user_data; }; /* create a dumb scanout buffer */ struct drm_mode_create_dumb { __u32 height; __u32 width; __u32 bpp; __u32 flags; /* handle, pitch, size will be returned */ __u32 handle; __u32 pitch; __u64 size; }; /* set up for mmap of a dumb scanout buffer */ struct drm_mode_map_dumb { /** Handle for the object being mapped. */ __u32 handle; __u32 pad; /** * Fake offset to use for subsequent mmap call * * This is a fixed-size type for 32/64 compatibility. */ __u64 offset; }; struct drm_mode_destroy_dumb { __u32 handle; }; /* page-flip flags are valid, plus: */ #define DRM_MODE_ATOMIC_TEST_ONLY 0x0100 #define DRM_MODE_ATOMIC_NONBLOCK 0x0200 #define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400 #define DRM_MODE_ATOMIC_FLAGS (\ DRM_MODE_PAGE_FLIP_EVENT |\ DRM_MODE_PAGE_FLIP_ASYNC |\ DRM_MODE_ATOMIC_TEST_ONLY |\ DRM_MODE_ATOMIC_NONBLOCK |\ DRM_MODE_ATOMIC_ALLOW_MODESET) struct drm_mode_atomic { __u32 flags; __u32 count_objs; __u64 objs_ptr; __u64 count_props_ptr; __u64 props_ptr; __u64 prop_values_ptr; __u64 reserved; __u64 user_data; }; struct drm_format_modifier_blob { #define FORMAT_BLOB_CURRENT 1 /* Version of this blob format */ __u32 version; /* Flags */ __u32 flags; /* Number of fourcc formats supported */ __u32 count_formats; /* Where in this blob the formats exist (in bytes) */ __u32 formats_offset; /* Number of drm_format_modifiers */ __u32 count_modifiers; /* Where in this blob the modifiers exist (in bytes) */ __u32 modifiers_offset; /* __u32 formats[] */ /* struct drm_format_modifier modifiers[] */ }; struct drm_format_modifier { /* Bitmask of formats in get_plane format list this info applies to. The * offset allows a sliding window of which 64 formats (bits). * * Some examples: * In today's world with < 65 formats, and formats 0, and 2 are * supported * 0x0000000000000005 * ^-offset = 0, formats = 5 * * If the number formats grew to 128, and formats 98-102 are * supported with the modifier: * * 0x0000007c00000000 0000000000000000 * ^ * |__offset = 64, formats = 0x7c00000000 * */ __u64 formats; __u32 offset; __u32 pad; /* The modifier that applies to the >get_plane format list bitmask. */ __u64 modifier; }; /** * Create a new 'blob' data property, copying length bytes from data pointer, * and returning new blob ID. */ struct drm_mode_create_blob { /** Pointer to data to copy. */ __u64 data; /** Length of data to copy. */ __u32 length; /** Return: new property ID. */ __u32 blob_id; }; /** * Destroy a user-created blob property. */ struct drm_mode_destroy_blob { __u32 blob_id; }; /** * Lease mode resources, creating another drm_master. */ struct drm_mode_create_lease { /** Pointer to array of object ids (__u32) */ __u64 object_ids; /** Number of object ids */ __u32 object_count; /** flags for new FD (O_CLOEXEC, etc) */ __u32 flags; /** Return: unique identifier for lessee. */ __u32 lessee_id; /** Return: file descriptor to new drm_master file */ __u32 fd; }; /** * List lesses from a drm_master */ struct drm_mode_list_lessees { /** Number of lessees. * On input, provides length of the array. * On output, provides total number. No * more than the input number will be written * back, so two calls can be used to get * the size and then the data. */ __u32 count_lessees; __u32 pad; /** Pointer to lessees. * pointer to __u64 array of lessee ids */ __u64 lessees_ptr; }; /** * Get leased objects */ struct drm_mode_get_lease { /** Number of leased objects. * On input, provides length of the array. * On output, provides total number. No * more than the input number will be written * back, so two calls can be used to get * the size and then the data. */ __u32 count_objects; __u32 pad; /** Pointer to objects. * pointer to __u32 array of object ids */ __u64 objects_ptr; }; /** * Revoke lease */ struct drm_mode_revoke_lease { /** Unique ID of lessee */ __u32 lessee_id; }; #if defined(__cplusplus) } #endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/radeon_drm.h������������������������������������������������������������������������������������0000644�����������������00000112534�14763166027�0007633 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* radeon_drm.h -- Public header for the radeon driver -*- linux-c -*- * * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Fremont, California. * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Authors: * Kevin E. Martin <martin@valinux.com> * Gareth Hughes <gareth@valinux.com> * Keith Whitwell <keith@tungstengraphics.com> */ #ifndef __RADEON_DRM_H__ #define __RADEON_DRM_H__ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* WARNING: If you change any of these defines, make sure to change the * defines in the X server file (radeon_sarea.h) */ #ifndef __RADEON_SAREA_DEFINES__ #define __RADEON_SAREA_DEFINES__ /* Old style state flags, required for sarea interface (1.1 and 1.2 * clears) and 1.2 drm_vertex2 ioctl. */ #define RADEON_UPLOAD_CONTEXT 0x00000001 #define RADEON_UPLOAD_VERTFMT 0x00000002 #define RADEON_UPLOAD_LINE 0x00000004 #define RADEON_UPLOAD_BUMPMAP 0x00000008 #define RADEON_UPLOAD_MASKS 0x00000010 #define RADEON_UPLOAD_VIEWPORT 0x00000020 #define RADEON_UPLOAD_SETUP 0x00000040 #define RADEON_UPLOAD_TCL 0x00000080 #define RADEON_UPLOAD_MISC 0x00000100 #define RADEON_UPLOAD_TEX0 0x00000200 #define RADEON_UPLOAD_TEX1 0x00000400 #define RADEON_UPLOAD_TEX2 0x00000800 #define RADEON_UPLOAD_TEX0IMAGES 0x00001000 #define RADEON_UPLOAD_TEX1IMAGES 0x00002000 #define RADEON_UPLOAD_TEX2IMAGES 0x00004000 #define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */ #define RADEON_REQUIRE_QUIESCENCE 0x00010000 #define RADEON_UPLOAD_ZBIAS 0x00020000 /* version 1.2 and newer */ #define RADEON_UPLOAD_ALL 0x003effff #define RADEON_UPLOAD_CONTEXT_ALL 0x003e01ff /* New style per-packet identifiers for use in cmd_buffer ioctl with * the RADEON_EMIT_PACKET command. Comments relate new packets to old * state bits and the packet size: */ #define RADEON_EMIT_PP_MISC 0 /* context/7 */ #define RADEON_EMIT_PP_CNTL 1 /* context/3 */ #define RADEON_EMIT_RB3D_COLORPITCH 2 /* context/1 */ #define RADEON_EMIT_RE_LINE_PATTERN 3 /* line/2 */ #define RADEON_EMIT_SE_LINE_WIDTH 4 /* line/1 */ #define RADEON_EMIT_PP_LUM_MATRIX 5 /* bumpmap/1 */ #define RADEON_EMIT_PP_ROT_MATRIX_0 6 /* bumpmap/2 */ #define RADEON_EMIT_RB3D_STENCILREFMASK 7 /* masks/3 */ #define RADEON_EMIT_SE_VPORT_XSCALE 8 /* viewport/6 */ #define RADEON_EMIT_SE_CNTL 9 /* setup/2 */ #define RADEON_EMIT_SE_CNTL_STATUS 10 /* setup/1 */ #define RADEON_EMIT_RE_MISC 11 /* misc/1 */ #define RADEON_EMIT_PP_TXFILTER_0 12 /* tex0/6 */ #define RADEON_EMIT_PP_BORDER_COLOR_0 13 /* tex0/1 */ #define RADEON_EMIT_PP_TXFILTER_1 14 /* tex1/6 */ #define RADEON_EMIT_PP_BORDER_COLOR_1 15 /* tex1/1 */ #define RADEON_EMIT_PP_TXFILTER_2 16 /* tex2/6 */ #define RADEON_EMIT_PP_BORDER_COLOR_2 17 /* tex2/1 */ #define RADEON_EMIT_SE_ZBIAS_FACTOR 18 /* zbias/2 */ #define RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT 19 /* tcl/11 */ #define RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED 20 /* material/17 */ #define R200_EMIT_PP_TXCBLEND_0 21 /* tex0/4 */ #define R200_EMIT_PP_TXCBLEND_1 22 /* tex1/4 */ #define R200_EMIT_PP_TXCBLEND_2 23 /* tex2/4 */ #define R200_EMIT_PP_TXCBLEND_3 24 /* tex3/4 */ #define R200_EMIT_PP_TXCBLEND_4 25 /* tex4/4 */ #define R200_EMIT_PP_TXCBLEND_5 26 /* tex5/4 */ #define R200_EMIT_PP_TXCBLEND_6 27 /* /4 */ #define R200_EMIT_PP_TXCBLEND_7 28 /* /4 */ #define R200_EMIT_TCL_LIGHT_MODEL_CTL_0 29 /* tcl/7 */ #define R200_EMIT_TFACTOR_0 30 /* tf/7 */ #define R200_EMIT_VTX_FMT_0 31 /* vtx/5 */ #define R200_EMIT_VAP_CTL 32 /* vap/1 */ #define R200_EMIT_MATRIX_SELECT_0 33 /* msl/5 */ #define R200_EMIT_TEX_PROC_CTL_2 34 /* tcg/5 */ #define R200_EMIT_TCL_UCP_VERT_BLEND_CTL 35 /* tcl/1 */ #define R200_EMIT_PP_TXFILTER_0 36 /* tex0/6 */ #define R200_EMIT_PP_TXFILTER_1 37 /* tex1/6 */ #define R200_EMIT_PP_TXFILTER_2 38 /* tex2/6 */ #define R200_EMIT_PP_TXFILTER_3 39 /* tex3/6 */ #define R200_EMIT_PP_TXFILTER_4 40 /* tex4/6 */ #define R200_EMIT_PP_TXFILTER_5 41 /* tex5/6 */ #define R200_EMIT_PP_TXOFFSET_0 42 /* tex0/1 */ #define R200_EMIT_PP_TXOFFSET_1 43 /* tex1/1 */ #define R200_EMIT_PP_TXOFFSET_2 44 /* tex2/1 */ #define R200_EMIT_PP_TXOFFSET_3 45 /* tex3/1 */ #define R200_EMIT_PP_TXOFFSET_4 46 /* tex4/1 */ #define R200_EMIT_PP_TXOFFSET_5 47 /* tex5/1 */ #define R200_EMIT_VTE_CNTL 48 /* vte/1 */ #define R200_EMIT_OUTPUT_VTX_COMP_SEL 49 /* vtx/1 */ #define R200_EMIT_PP_TAM_DEBUG3 50 /* tam/1 */ #define R200_EMIT_PP_CNTL_X 51 /* cst/1 */ #define R200_EMIT_RB3D_DEPTHXY_OFFSET 52 /* cst/1 */ #define R200_EMIT_RE_AUX_SCISSOR_CNTL 53 /* cst/1 */ #define R200_EMIT_RE_SCISSOR_TL_0 54 /* cst/2 */ #define R200_EMIT_RE_SCISSOR_TL_1 55 /* cst/2 */ #define R200_EMIT_RE_SCISSOR_TL_2 56 /* cst/2 */ #define R200_EMIT_SE_VAP_CNTL_STATUS 57 /* cst/1 */ #define R200_EMIT_SE_VTX_STATE_CNTL 58 /* cst/1 */ #define R200_EMIT_RE_POINTSIZE 59 /* cst/1 */ #define R200_EMIT_TCL_INPUT_VTX_VECTOR_ADDR_0 60 /* cst/4 */ #define R200_EMIT_PP_CUBIC_FACES_0 61 #define R200_EMIT_PP_CUBIC_OFFSETS_0 62 #define R200_EMIT_PP_CUBIC_FACES_1 63 #define R200_EMIT_PP_CUBIC_OFFSETS_1 64 #define R200_EMIT_PP_CUBIC_FACES_2 65 #define R200_EMIT_PP_CUBIC_OFFSETS_2 66 #define R200_EMIT_PP_CUBIC_FACES_3 67 #define R200_EMIT_PP_CUBIC_OFFSETS_3 68 #define R200_EMIT_PP_CUBIC_FACES_4 69 #define R200_EMIT_PP_CUBIC_OFFSETS_4 70 #define R200_EMIT_PP_CUBIC_FACES_5 71 #define R200_EMIT_PP_CUBIC_OFFSETS_5 72 #define RADEON_EMIT_PP_TEX_SIZE_0 73 #define RADEON_EMIT_PP_TEX_SIZE_1 74 #define RADEON_EMIT_PP_TEX_SIZE_2 75 #define R200_EMIT_RB3D_BLENDCOLOR 76 #define R200_EMIT_TCL_POINT_SPRITE_CNTL 77 #define RADEON_EMIT_PP_CUBIC_FACES_0 78 #define RADEON_EMIT_PP_CUBIC_OFFSETS_T0 79 #define RADEON_EMIT_PP_CUBIC_FACES_1 80 #define RADEON_EMIT_PP_CUBIC_OFFSETS_T1 81 #define RADEON_EMIT_PP_CUBIC_FACES_2 82 #define RADEON_EMIT_PP_CUBIC_OFFSETS_T2 83 #define R200_EMIT_PP_TRI_PERF_CNTL 84 #define R200_EMIT_PP_AFS_0 85 #define R200_EMIT_PP_AFS_1 86 #define R200_EMIT_ATF_TFACTOR 87 #define R200_EMIT_PP_TXCTLALL_0 88 #define R200_EMIT_PP_TXCTLALL_1 89 #define R200_EMIT_PP_TXCTLALL_2 90 #define R200_EMIT_PP_TXCTLALL_3 91 #define R200_EMIT_PP_TXCTLALL_4 92 #define R200_EMIT_PP_TXCTLALL_5 93 #define R200_EMIT_VAP_PVS_CNTL 94 #define RADEON_MAX_STATE_PACKETS 95 /* Commands understood by cmd_buffer ioctl. More can be added but * obviously these can't be removed or changed: */ #define RADEON_CMD_PACKET 1 /* emit one of the register packets above */ #define RADEON_CMD_SCALARS 2 /* emit scalar data */ #define RADEON_CMD_VECTORS 3 /* emit vector data */ #define RADEON_CMD_DMA_DISCARD 4 /* discard current dma buf */ #define RADEON_CMD_PACKET3 5 /* emit hw packet */ #define RADEON_CMD_PACKET3_CLIP 6 /* emit hw packet wrapped in cliprects */ #define RADEON_CMD_SCALARS2 7 /* r200 stopgap */ #define RADEON_CMD_WAIT 8 /* emit hw wait commands -- note: * doesn't make the cpu wait, just * the graphics hardware */ #define RADEON_CMD_VECLINEAR 9 /* another r200 stopgap */ typedef union { int i; struct { unsigned char cmd_type, pad0, pad1, pad2; } header; struct { unsigned char cmd_type, packet_id, pad0, pad1; } packet; struct { unsigned char cmd_type, offset, stride, count; } scalars; struct { unsigned char cmd_type, offset, stride, count; } vectors; struct { unsigned char cmd_type, addr_lo, addr_hi, count; } veclinear; struct { unsigned char cmd_type, buf_idx, pad0, pad1; } dma; struct { unsigned char cmd_type, flags, pad0, pad1; } wait; } drm_radeon_cmd_header_t; #define RADEON_WAIT_2D 0x1 #define RADEON_WAIT_3D 0x2 /* Allowed parameters for R300_CMD_PACKET3 */ #define R300_CMD_PACKET3_CLEAR 0 #define R300_CMD_PACKET3_RAW 1 /* Commands understood by cmd_buffer ioctl for R300. * The interface has not been stabilized, so some of these may be removed * and eventually reordered before stabilization. */ #define R300_CMD_PACKET0 1 #define R300_CMD_VPU 2 /* emit vertex program upload */ #define R300_CMD_PACKET3 3 /* emit a packet3 */ #define R300_CMD_END3D 4 /* emit sequence ending 3d rendering */ #define R300_CMD_CP_DELAY 5 #define R300_CMD_DMA_DISCARD 6 #define R300_CMD_WAIT 7 # define R300_WAIT_2D 0x1 # define R300_WAIT_3D 0x2 /* these two defines are DOING IT WRONG - however * we have userspace which relies on using these. * The wait interface is backwards compat new * code should use the NEW_WAIT defines below * THESE ARE NOT BIT FIELDS */ # define R300_WAIT_2D_CLEAN 0x3 # define R300_WAIT_3D_CLEAN 0x4 # define R300_NEW_WAIT_2D_3D 0x3 # define R300_NEW_WAIT_2D_2D_CLEAN 0x4 # define R300_NEW_WAIT_3D_3D_CLEAN 0x6 # define R300_NEW_WAIT_2D_2D_CLEAN_3D_3D_CLEAN 0x8 #define R300_CMD_SCRATCH 8 #define R300_CMD_R500FP 9 typedef union { unsigned int u; struct { unsigned char cmd_type, pad0, pad1, pad2; } header; struct { unsigned char cmd_type, count, reglo, reghi; } packet0; struct { unsigned char cmd_type, count, adrlo, adrhi; } vpu; struct { unsigned char cmd_type, packet, pad0, pad1; } packet3; struct { unsigned char cmd_type, packet; unsigned short count; /* amount of packet2 to emit */ } delay; struct { unsigned char cmd_type, buf_idx, pad0, pad1; } dma; struct { unsigned char cmd_type, flags, pad0, pad1; } wait; struct { unsigned char cmd_type, reg, n_bufs, flags; } scratch; struct { unsigned char cmd_type, count, adrlo, adrhi_flags; } r500fp; } drm_r300_cmd_header_t; #define RADEON_FRONT 0x1 #define RADEON_BACK 0x2 #define RADEON_DEPTH 0x4 #define RADEON_STENCIL 0x8 #define RADEON_CLEAR_FASTZ 0x80000000 #define RADEON_USE_HIERZ 0x40000000 #define RADEON_USE_COMP_ZBUF 0x20000000 #define R500FP_CONSTANT_TYPE (1 << 1) #define R500FP_CONSTANT_CLAMP (1 << 2) /* Primitive types */ #define RADEON_POINTS 0x1 #define RADEON_LINES 0x2 #define RADEON_LINE_STRIP 0x3 #define RADEON_TRIANGLES 0x4 #define RADEON_TRIANGLE_FAN 0x5 #define RADEON_TRIANGLE_STRIP 0x6 /* Vertex/indirect buffer size */ #define RADEON_BUFFER_SIZE 65536 /* Byte offsets for indirect buffer data */ #define RADEON_INDEX_PRIM_OFFSET 20 #define RADEON_SCRATCH_REG_OFFSET 32 #define R600_SCRATCH_REG_OFFSET 256 #define RADEON_NR_SAREA_CLIPRECTS 12 /* There are 2 heaps (local/GART). Each region within a heap is a * minimum of 64k, and there are at most 64 of them per heap. */ #define RADEON_LOCAL_TEX_HEAP 0 #define RADEON_GART_TEX_HEAP 1 #define RADEON_NR_TEX_HEAPS 2 #define RADEON_NR_TEX_REGIONS 64 #define RADEON_LOG_TEX_GRANULARITY 16 #define RADEON_MAX_TEXTURE_LEVELS 12 #define RADEON_MAX_TEXTURE_UNITS 3 #define RADEON_MAX_SURFACES 8 /* Blits have strict offset rules. All blit offset must be aligned on * a 1K-byte boundary. */ #define RADEON_OFFSET_SHIFT 10 #define RADEON_OFFSET_ALIGN (1 << RADEON_OFFSET_SHIFT) #define RADEON_OFFSET_MASK (RADEON_OFFSET_ALIGN - 1) #endif /* __RADEON_SAREA_DEFINES__ */ typedef struct { unsigned int red; unsigned int green; unsigned int blue; unsigned int alpha; } radeon_color_regs_t; typedef struct { /* Context state */ unsigned int pp_misc; /* 0x1c14 */ unsigned int pp_fog_color; unsigned int re_solid_color; unsigned int rb3d_blendcntl; unsigned int rb3d_depthoffset; unsigned int rb3d_depthpitch; unsigned int rb3d_zstencilcntl; unsigned int pp_cntl; /* 0x1c38 */ unsigned int rb3d_cntl; unsigned int rb3d_coloroffset; unsigned int re_width_height; unsigned int rb3d_colorpitch; unsigned int se_cntl; /* Vertex format state */ unsigned int se_coord_fmt; /* 0x1c50 */ /* Line state */ unsigned int re_line_pattern; /* 0x1cd0 */ unsigned int re_line_state; unsigned int se_line_width; /* 0x1db8 */ /* Bumpmap state */ unsigned int pp_lum_matrix; /* 0x1d00 */ unsigned int pp_rot_matrix_0; /* 0x1d58 */ unsigned int pp_rot_matrix_1; /* Mask state */ unsigned int rb3d_stencilrefmask; /* 0x1d7c */ unsigned int rb3d_ropcntl; unsigned int rb3d_planemask; /* Viewport state */ unsigned int se_vport_xscale; /* 0x1d98 */ unsigned int se_vport_xoffset; unsigned int se_vport_yscale; unsigned int se_vport_yoffset; unsigned int se_vport_zscale; unsigned int se_vport_zoffset; /* Setup state */ unsigned int se_cntl_status; /* 0x2140 */ /* Misc state */ unsigned int re_top_left; /* 0x26c0 */ unsigned int re_misc; } drm_radeon_context_regs_t; typedef struct { /* Zbias state */ unsigned int se_zbias_factor; /* 0x1dac */ unsigned int se_zbias_constant; } drm_radeon_context2_regs_t; /* Setup registers for each texture unit */ typedef struct { unsigned int pp_txfilter; unsigned int pp_txformat; unsigned int pp_txoffset; unsigned int pp_txcblend; unsigned int pp_txablend; unsigned int pp_tfactor; unsigned int pp_border_color; } drm_radeon_texture_regs_t; typedef struct { unsigned int start; unsigned int finish; unsigned int prim:8; unsigned int stateidx:8; unsigned int numverts:16; /* overloaded as offset/64 for elt prims */ unsigned int vc_format; /* vertex format */ } drm_radeon_prim_t; typedef struct { drm_radeon_context_regs_t context; drm_radeon_texture_regs_t tex[RADEON_MAX_TEXTURE_UNITS]; drm_radeon_context2_regs_t context2; unsigned int dirty; } drm_radeon_state_t; typedef struct { /* The channel for communication of state information to the * kernel on firing a vertex buffer with either of the * obsoleted vertex/index ioctls. */ drm_radeon_context_regs_t context_state; drm_radeon_texture_regs_t tex_state[RADEON_MAX_TEXTURE_UNITS]; unsigned int dirty; unsigned int vertsize; unsigned int vc_format; /* The current cliprects, or a subset thereof. */ struct drm_clip_rect boxes[RADEON_NR_SAREA_CLIPRECTS]; unsigned int nbox; /* Counters for client-side throttling of rendering clients. */ unsigned int last_frame; unsigned int last_dispatch; unsigned int last_clear; struct drm_tex_region tex_list[RADEON_NR_TEX_HEAPS][RADEON_NR_TEX_REGIONS + 1]; unsigned int tex_age[RADEON_NR_TEX_HEAPS]; int ctx_owner; int pfState; /* number of 3d windows (0,1,2ormore) */ int pfCurrentPage; /* which buffer is being displayed? */ int crtc2_base; /* CRTC2 frame offset */ int tiling_enabled; /* set by drm, read by 2d + 3d clients */ } drm_radeon_sarea_t; /* WARNING: If you change any of these defines, make sure to change the * defines in the Xserver file (xf86drmRadeon.h) * * KW: actually it's illegal to change any of this (backwards compatibility). */ /* Radeon specific ioctls * The device specific ioctl range is 0x40 to 0x79. */ #define DRM_RADEON_CP_INIT 0x00 #define DRM_RADEON_CP_START 0x01 #define DRM_RADEON_CP_STOP 0x02 #define DRM_RADEON_CP_RESET 0x03 #define DRM_RADEON_CP_IDLE 0x04 #define DRM_RADEON_RESET 0x05 #define DRM_RADEON_FULLSCREEN 0x06 #define DRM_RADEON_SWAP 0x07 #define DRM_RADEON_CLEAR 0x08 #define DRM_RADEON_VERTEX 0x09 #define DRM_RADEON_INDICES 0x0A #define DRM_RADEON_NOT_USED #define DRM_RADEON_STIPPLE 0x0C #define DRM_RADEON_INDIRECT 0x0D #define DRM_RADEON_TEXTURE 0x0E #define DRM_RADEON_VERTEX2 0x0F #define DRM_RADEON_CMDBUF 0x10 #define DRM_RADEON_GETPARAM 0x11 #define DRM_RADEON_FLIP 0x12 #define DRM_RADEON_ALLOC 0x13 #define DRM_RADEON_FREE 0x14 #define DRM_RADEON_INIT_HEAP 0x15 #define DRM_RADEON_IRQ_EMIT 0x16 #define DRM_RADEON_IRQ_WAIT 0x17 #define DRM_RADEON_CP_RESUME 0x18 #define DRM_RADEON_SETPARAM 0x19 #define DRM_RADEON_SURF_ALLOC 0x1a #define DRM_RADEON_SURF_FREE 0x1b /* KMS ioctl */ #define DRM_RADEON_GEM_INFO 0x1c #define DRM_RADEON_GEM_CREATE 0x1d #define DRM_RADEON_GEM_MMAP 0x1e #define DRM_RADEON_GEM_PREAD 0x21 #define DRM_RADEON_GEM_PWRITE 0x22 #define DRM_RADEON_GEM_SET_DOMAIN 0x23 #define DRM_RADEON_GEM_WAIT_IDLE 0x24 #define DRM_RADEON_CS 0x26 #define DRM_RADEON_INFO 0x27 #define DRM_RADEON_GEM_SET_TILING 0x28 #define DRM_RADEON_GEM_GET_TILING 0x29 #define DRM_RADEON_GEM_BUSY 0x2a #define DRM_RADEON_GEM_VA 0x2b #define DRM_RADEON_GEM_OP 0x2c #define DRM_RADEON_GEM_USERPTR 0x2d #define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) #define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) #define DRM_IOCTL_RADEON_CP_STOP DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_STOP, drm_radeon_cp_stop_t) #define DRM_IOCTL_RADEON_CP_RESET DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_RESET) #define DRM_IOCTL_RADEON_CP_IDLE DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_IDLE) #define DRM_IOCTL_RADEON_RESET DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_RESET) #define DRM_IOCTL_RADEON_FULLSCREEN DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_FULLSCREEN, drm_radeon_fullscreen_t) #define DRM_IOCTL_RADEON_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_SWAP) #define DRM_IOCTL_RADEON_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CLEAR, drm_radeon_clear_t) #define DRM_IOCTL_RADEON_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_VERTEX, drm_radeon_vertex_t) #define DRM_IOCTL_RADEON_INDICES DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_INDICES, drm_radeon_indices_t) #define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_STIPPLE, drm_radeon_stipple_t) #define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INDIRECT, drm_radeon_indirect_t) #define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_TEXTURE, drm_radeon_texture_t) #define DRM_IOCTL_RADEON_VERTEX2 DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_VERTEX2, drm_radeon_vertex2_t) #define DRM_IOCTL_RADEON_CMDBUF DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CMDBUF, drm_radeon_cmd_buffer_t) #define DRM_IOCTL_RADEON_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GETPARAM, drm_radeon_getparam_t) #define DRM_IOCTL_RADEON_FLIP DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_FLIP) #define DRM_IOCTL_RADEON_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_ALLOC, drm_radeon_mem_alloc_t) #define DRM_IOCTL_RADEON_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_FREE, drm_radeon_mem_free_t) #define DRM_IOCTL_RADEON_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_INIT_HEAP, drm_radeon_mem_init_heap_t) #define DRM_IOCTL_RADEON_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_IRQ_EMIT, drm_radeon_irq_emit_t) #define DRM_IOCTL_RADEON_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_IRQ_WAIT, drm_radeon_irq_wait_t) #define DRM_IOCTL_RADEON_CP_RESUME DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_RESUME) #define DRM_IOCTL_RADEON_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t) #define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t) #define DRM_IOCTL_RADEON_SURF_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t) /* KMS */ #define DRM_IOCTL_RADEON_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_INFO, struct drm_radeon_gem_info) #define DRM_IOCTL_RADEON_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_CREATE, struct drm_radeon_gem_create) #define DRM_IOCTL_RADEON_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_MMAP, struct drm_radeon_gem_mmap) #define DRM_IOCTL_RADEON_GEM_PREAD DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PREAD, struct drm_radeon_gem_pread) #define DRM_IOCTL_RADEON_GEM_PWRITE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PWRITE, struct drm_radeon_gem_pwrite) #define DRM_IOCTL_RADEON_GEM_SET_DOMAIN DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_DOMAIN, struct drm_radeon_gem_set_domain) #define DRM_IOCTL_RADEON_GEM_WAIT_IDLE DRM_IOW(DRM_COMMAND_BASE + DRM_RADEON_GEM_WAIT_IDLE, struct drm_radeon_gem_wait_idle) #define DRM_IOCTL_RADEON_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_CS, struct drm_radeon_cs) #define DRM_IOCTL_RADEON_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INFO, struct drm_radeon_info) #define DRM_IOCTL_RADEON_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling) #define DRM_IOCTL_RADEON_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling) #define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy) #define DRM_IOCTL_RADEON_GEM_VA DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_VA, struct drm_radeon_gem_va) #define DRM_IOCTL_RADEON_GEM_OP DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_OP, struct drm_radeon_gem_op) #define DRM_IOCTL_RADEON_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_USERPTR, struct drm_radeon_gem_userptr) typedef struct drm_radeon_init { enum { RADEON_INIT_CP = 0x01, RADEON_CLEANUP_CP = 0x02, RADEON_INIT_R200_CP = 0x03, RADEON_INIT_R300_CP = 0x04, RADEON_INIT_R600_CP = 0x05 } func; unsigned long sarea_priv_offset; int is_pci; int cp_mode; int gart_size; int ring_size; int usec_timeout; unsigned int fb_bpp; unsigned int front_offset, front_pitch; unsigned int back_offset, back_pitch; unsigned int depth_bpp; unsigned int depth_offset, depth_pitch; unsigned long fb_offset; unsigned long mmio_offset; unsigned long ring_offset; unsigned long ring_rptr_offset; unsigned long buffers_offset; unsigned long gart_textures_offset; } drm_radeon_init_t; typedef struct drm_radeon_cp_stop { int flush; int idle; } drm_radeon_cp_stop_t; typedef struct drm_radeon_fullscreen { enum { RADEON_INIT_FULLSCREEN = 0x01, RADEON_CLEANUP_FULLSCREEN = 0x02 } func; } drm_radeon_fullscreen_t; #define CLEAR_X1 0 #define CLEAR_Y1 1 #define CLEAR_X2 2 #define CLEAR_Y2 3 #define CLEAR_DEPTH 4 typedef union drm_radeon_clear_rect { float f[5]; unsigned int ui[5]; } drm_radeon_clear_rect_t; typedef struct drm_radeon_clear { unsigned int flags; unsigned int clear_color; unsigned int clear_depth; unsigned int color_mask; unsigned int depth_mask; /* misnamed field: should be stencil */ drm_radeon_clear_rect_t *depth_boxes; } drm_radeon_clear_t; typedef struct drm_radeon_vertex { int prim; int idx; /* Index of vertex buffer */ int count; /* Number of vertices in buffer */ int discard; /* Client finished with buffer? */ } drm_radeon_vertex_t; typedef struct drm_radeon_indices { int prim; int idx; int start; int end; int discard; /* Client finished with buffer? */ } drm_radeon_indices_t; /* v1.2 - obsoletes drm_radeon_vertex and drm_radeon_indices * - allows multiple primitives and state changes in a single ioctl * - supports driver change to emit native primitives */ typedef struct drm_radeon_vertex2 { int idx; /* Index of vertex buffer */ int discard; /* Client finished with buffer? */ int nr_states; drm_radeon_state_t *state; int nr_prims; drm_radeon_prim_t *prim; } drm_radeon_vertex2_t; /* v1.3 - obsoletes drm_radeon_vertex2 * - allows arbitrarily large cliprect list * - allows updating of tcl packet, vector and scalar state * - allows memory-efficient description of state updates * - allows state to be emitted without a primitive * (for clears, ctx switches) * - allows more than one dma buffer to be referenced per ioctl * - supports tcl driver * - may be extended in future versions with new cmd types, packets */ typedef struct drm_radeon_cmd_buffer { int bufsz; char *buf; int nbox; struct drm_clip_rect *boxes; } drm_radeon_cmd_buffer_t; typedef struct drm_radeon_tex_image { unsigned int x, y; /* Blit coordinates */ unsigned int width, height; const void *data; } drm_radeon_tex_image_t; typedef struct drm_radeon_texture { unsigned int offset; int pitch; int format; int width; /* Texture image coordinates */ int height; drm_radeon_tex_image_t *image; } drm_radeon_texture_t; typedef struct drm_radeon_stipple { unsigned int *mask; } drm_radeon_stipple_t; typedef struct drm_radeon_indirect { int idx; int start; int end; int discard; } drm_radeon_indirect_t; /* enum for card type parameters */ #define RADEON_CARD_PCI 0 #define RADEON_CARD_AGP 1 #define RADEON_CARD_PCIE 2 /* 1.3: An ioctl to get parameters that aren't available to the 3d * client any other way. */ #define RADEON_PARAM_GART_BUFFER_OFFSET 1 /* card offset of 1st GART buffer */ #define RADEON_PARAM_LAST_FRAME 2 #define RADEON_PARAM_LAST_DISPATCH 3 #define RADEON_PARAM_LAST_CLEAR 4 /* Added with DRM version 1.6. */ #define RADEON_PARAM_IRQ_NR 5 #define RADEON_PARAM_GART_BASE 6 /* card offset of GART base */ /* Added with DRM version 1.8. */ #define RADEON_PARAM_REGISTER_HANDLE 7 /* for drmMap() */ #define RADEON_PARAM_STATUS_HANDLE 8 #define RADEON_PARAM_SAREA_HANDLE 9 #define RADEON_PARAM_GART_TEX_HANDLE 10 #define RADEON_PARAM_SCRATCH_OFFSET 11 #define RADEON_PARAM_CARD_TYPE 12 #define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */ #define RADEON_PARAM_FB_LOCATION 14 /* FB location */ #define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */ #define RADEON_PARAM_DEVICE_ID 16 #define RADEON_PARAM_NUM_Z_PIPES 17 /* num Z pipes */ typedef struct drm_radeon_getparam { int param; void *value; } drm_radeon_getparam_t; /* 1.6: Set up a memory manager for regions of shared memory: */ #define RADEON_MEM_REGION_GART 1 #define RADEON_MEM_REGION_FB 2 typedef struct drm_radeon_mem_alloc { int region; int alignment; int size; int *region_offset; /* offset from start of fb or GART */ } drm_radeon_mem_alloc_t; typedef struct drm_radeon_mem_free { int region; int region_offset; } drm_radeon_mem_free_t; typedef struct drm_radeon_mem_init_heap { int region; int size; int start; } drm_radeon_mem_init_heap_t; /* 1.6: Userspace can request & wait on irq's: */ typedef struct drm_radeon_irq_emit { int *irq_seq; } drm_radeon_irq_emit_t; typedef struct drm_radeon_irq_wait { int irq_seq; } drm_radeon_irq_wait_t; /* 1.10: Clients tell the DRM where they think the framebuffer is located in * the card's address space, via a new generic ioctl to set parameters */ typedef struct drm_radeon_setparam { unsigned int param; __s64 value; } drm_radeon_setparam_t; #define RADEON_SETPARAM_FB_LOCATION 1 /* determined framebuffer location */ #define RADEON_SETPARAM_SWITCH_TILING 2 /* enable/disable color tiling */ #define RADEON_SETPARAM_PCIGART_LOCATION 3 /* PCI Gart Location */ #define RADEON_SETPARAM_NEW_MEMMAP 4 /* Use new memory map */ #define RADEON_SETPARAM_PCIGART_TABLE_SIZE 5 /* PCI GART Table Size */ #define RADEON_SETPARAM_VBLANK_CRTC 6 /* VBLANK CRTC */ /* 1.14: Clients can allocate/free a surface */ typedef struct drm_radeon_surface_alloc { unsigned int address; unsigned int size; unsigned int flags; } drm_radeon_surface_alloc_t; typedef struct drm_radeon_surface_free { unsigned int address; } drm_radeon_surface_free_t; #define DRM_RADEON_VBLANK_CRTC1 1 #define DRM_RADEON_VBLANK_CRTC2 2 /* * Kernel modesetting world below. */ #define RADEON_GEM_DOMAIN_CPU 0x1 #define RADEON_GEM_DOMAIN_GTT 0x2 #define RADEON_GEM_DOMAIN_VRAM 0x4 struct drm_radeon_gem_info { __u64 gart_size; __u64 vram_size; __u64 vram_visible; }; #define RADEON_GEM_NO_BACKING_STORE (1 << 0) #define RADEON_GEM_GTT_UC (1 << 1) #define RADEON_GEM_GTT_WC (1 << 2) /* BO is expected to be accessed by the CPU */ #define RADEON_GEM_CPU_ACCESS (1 << 3) /* CPU access is not expected to work for this BO */ #define RADEON_GEM_NO_CPU_ACCESS (1 << 4) struct drm_radeon_gem_create { __u64 size; __u64 alignment; __u32 handle; __u32 initial_domain; __u32 flags; }; /* * This is not a reliable API and you should expect it to fail for any * number of reasons and have fallback path that do not use userptr to * perform any operation. */ #define RADEON_GEM_USERPTR_READONLY (1 << 0) #define RADEON_GEM_USERPTR_ANONONLY (1 << 1) #define RADEON_GEM_USERPTR_VALIDATE (1 << 2) #define RADEON_GEM_USERPTR_REGISTER (1 << 3) struct drm_radeon_gem_userptr { __u64 addr; __u64 size; __u32 flags; __u32 handle; }; #define RADEON_TILING_MACRO 0x1 #define RADEON_TILING_MICRO 0x2 #define RADEON_TILING_SWAP_16BIT 0x4 #define RADEON_TILING_SWAP_32BIT 0x8 /* this object requires a surface when mapped - i.e. front buffer */ #define RADEON_TILING_SURFACE 0x10 #define RADEON_TILING_MICRO_SQUARE 0x20 #define RADEON_TILING_EG_BANKW_SHIFT 8 #define RADEON_TILING_EG_BANKW_MASK 0xf #define RADEON_TILING_EG_BANKH_SHIFT 12 #define RADEON_TILING_EG_BANKH_MASK 0xf #define RADEON_TILING_EG_MACRO_TILE_ASPECT_SHIFT 16 #define RADEON_TILING_EG_MACRO_TILE_ASPECT_MASK 0xf #define RADEON_TILING_EG_TILE_SPLIT_SHIFT 24 #define RADEON_TILING_EG_TILE_SPLIT_MASK 0xf #define RADEON_TILING_EG_STENCIL_TILE_SPLIT_SHIFT 28 #define RADEON_TILING_EG_STENCIL_TILE_SPLIT_MASK 0xf struct drm_radeon_gem_set_tiling { __u32 handle; __u32 tiling_flags; __u32 pitch; }; struct drm_radeon_gem_get_tiling { __u32 handle; __u32 tiling_flags; __u32 pitch; }; struct drm_radeon_gem_mmap { __u32 handle; __u32 pad; __u64 offset; __u64 size; __u64 addr_ptr; }; struct drm_radeon_gem_set_domain { __u32 handle; __u32 read_domains; __u32 write_domain; }; struct drm_radeon_gem_wait_idle { __u32 handle; __u32 pad; }; struct drm_radeon_gem_busy { __u32 handle; __u32 domain; }; struct drm_radeon_gem_pread { /** Handle for the object being read. */ __u32 handle; __u32 pad; /** Offset into the object to read from */ __u64 offset; /** Length of data to read */ __u64 size; /** Pointer to write the data into. */ /* void *, but pointers are not 32/64 compatible */ __u64 data_ptr; }; struct drm_radeon_gem_pwrite { /** Handle for the object being written to. */ __u32 handle; __u32 pad; /** Offset into the object to write to */ __u64 offset; /** Length of data to write */ __u64 size; /** Pointer to read the data from. */ /* void *, but pointers are not 32/64 compatible */ __u64 data_ptr; }; /* Sets or returns a value associated with a buffer. */ struct drm_radeon_gem_op { __u32 handle; /* buffer */ __u32 op; /* RADEON_GEM_OP_* */ __u64 value; /* input or return value */ }; #define RADEON_GEM_OP_GET_INITIAL_DOMAIN 0 #define RADEON_GEM_OP_SET_INITIAL_DOMAIN 1 #define RADEON_VA_MAP 1 #define RADEON_VA_UNMAP 2 #define RADEON_VA_RESULT_OK 0 #define RADEON_VA_RESULT_ERROR 1 #define RADEON_VA_RESULT_VA_EXIST 2 #define RADEON_VM_PAGE_VALID (1 << 0) #define RADEON_VM_PAGE_READABLE (1 << 1) #define RADEON_VM_PAGE_WRITEABLE (1 << 2) #define RADEON_VM_PAGE_SYSTEM (1 << 3) #define RADEON_VM_PAGE_SNOOPED (1 << 4) struct drm_radeon_gem_va { __u32 handle; __u32 operation; __u32 vm_id; __u32 flags; __u64 offset; }; #define RADEON_CHUNK_ID_RELOCS 0x01 #define RADEON_CHUNK_ID_IB 0x02 #define RADEON_CHUNK_ID_FLAGS 0x03 #define RADEON_CHUNK_ID_CONST_IB 0x04 /* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */ #define RADEON_CS_KEEP_TILING_FLAGS 0x01 #define RADEON_CS_USE_VM 0x02 #define RADEON_CS_END_OF_FRAME 0x04 /* a hint from userspace which CS is the last one */ /* The second dword of RADEON_CHUNK_ID_FLAGS is a uint32 that sets the ring type */ #define RADEON_CS_RING_GFX 0 #define RADEON_CS_RING_COMPUTE 1 #define RADEON_CS_RING_DMA 2 #define RADEON_CS_RING_UVD 3 #define RADEON_CS_RING_VCE 4 /* The third dword of RADEON_CHUNK_ID_FLAGS is a sint32 that sets the priority */ /* 0 = normal, + = higher priority, - = lower priority */ struct drm_radeon_cs_chunk { __u32 chunk_id; __u32 length_dw; __u64 chunk_data; }; /* drm_radeon_cs_reloc.flags */ #define RADEON_RELOC_PRIO_MASK (0xf << 0) struct drm_radeon_cs_reloc { __u32 handle; __u32 read_domains; __u32 write_domain; __u32 flags; }; struct drm_radeon_cs { __u32 num_chunks; __u32 cs_id; /* this points to __u64 * which point to cs chunks */ __u64 chunks; /* updates to the limits after this CS ioctl */ __u64 gart_limit; __u64 vram_limit; }; #define RADEON_INFO_DEVICE_ID 0x00 #define RADEON_INFO_NUM_GB_PIPES 0x01 #define RADEON_INFO_NUM_Z_PIPES 0x02 #define RADEON_INFO_ACCEL_WORKING 0x03 #define RADEON_INFO_CRTC_FROM_ID 0x04 #define RADEON_INFO_ACCEL_WORKING2 0x05 #define RADEON_INFO_TILING_CONFIG 0x06 #define RADEON_INFO_WANT_HYPERZ 0x07 #define RADEON_INFO_WANT_CMASK 0x08 /* get access to CMASK on r300 */ #define RADEON_INFO_CLOCK_CRYSTAL_FREQ 0x09 /* clock crystal frequency */ #define RADEON_INFO_NUM_BACKENDS 0x0a /* DB/backends for r600+ - need for OQ */ #define RADEON_INFO_NUM_TILE_PIPES 0x0b /* tile pipes for r600+ */ #define RADEON_INFO_FUSION_GART_WORKING 0x0c /* fusion writes to GTT were broken before this */ #define RADEON_INFO_BACKEND_MAP 0x0d /* pipe to backend map, needed by mesa */ /* virtual address start, va < start are reserved by the kernel */ #define RADEON_INFO_VA_START 0x0e /* maximum size of ib using the virtual memory cs */ #define RADEON_INFO_IB_VM_MAX_SIZE 0x0f /* max pipes - needed for compute shaders */ #define RADEON_INFO_MAX_PIPES 0x10 /* timestamp for GL_ARB_timer_query (OpenGL), returns the current GPU clock */ #define RADEON_INFO_TIMESTAMP 0x11 /* max shader engines (SE) - needed for geometry shaders, etc. */ #define RADEON_INFO_MAX_SE 0x12 /* max SH per SE */ #define RADEON_INFO_MAX_SH_PER_SE 0x13 /* fast fb access is enabled */ #define RADEON_INFO_FASTFB_WORKING 0x14 /* query if a RADEON_CS_RING_* submission is supported */ #define RADEON_INFO_RING_WORKING 0x15 /* SI tile mode array */ #define RADEON_INFO_SI_TILE_MODE_ARRAY 0x16 /* query if CP DMA is supported on the compute ring */ #define RADEON_INFO_SI_CP_DMA_COMPUTE 0x17 /* CIK macrotile mode array */ #define RADEON_INFO_CIK_MACROTILE_MODE_ARRAY 0x18 /* query the number of render backends */ #define RADEON_INFO_SI_BACKEND_ENABLED_MASK 0x19 /* max engine clock - needed for OpenCL */ #define RADEON_INFO_MAX_SCLK 0x1a /* version of VCE firmware */ #define RADEON_INFO_VCE_FW_VERSION 0x1b /* version of VCE feedback */ #define RADEON_INFO_VCE_FB_VERSION 0x1c #define RADEON_INFO_NUM_BYTES_MOVED 0x1d #define RADEON_INFO_VRAM_USAGE 0x1e #define RADEON_INFO_GTT_USAGE 0x1f #define RADEON_INFO_ACTIVE_CU_COUNT 0x20 #define RADEON_INFO_CURRENT_GPU_TEMP 0x21 #define RADEON_INFO_CURRENT_GPU_SCLK 0x22 #define RADEON_INFO_CURRENT_GPU_MCLK 0x23 #define RADEON_INFO_READ_REG 0x24 #define RADEON_INFO_VA_UNMAP_WORKING 0x25 #define RADEON_INFO_GPU_RESET_COUNTER 0x26 struct drm_radeon_info { __u32 request; __u32 pad; __u64 value; }; /* Those correspond to the tile index to use, this is to explicitly state * the API that is implicitly defined by the tile mode array. */ #define SI_TILE_MODE_COLOR_LINEAR_ALIGNED 8 #define SI_TILE_MODE_COLOR_1D 13 #define SI_TILE_MODE_COLOR_1D_SCANOUT 9 #define SI_TILE_MODE_COLOR_2D_8BPP 14 #define SI_TILE_MODE_COLOR_2D_16BPP 15 #define SI_TILE_MODE_COLOR_2D_32BPP 16 #define SI_TILE_MODE_COLOR_2D_64BPP 17 #define SI_TILE_MODE_COLOR_2D_SCANOUT_16BPP 11 #define SI_TILE_MODE_COLOR_2D_SCANOUT_32BPP 12 #define SI_TILE_MODE_DEPTH_STENCIL_1D 4 #define SI_TILE_MODE_DEPTH_STENCIL_2D 0 #define SI_TILE_MODE_DEPTH_STENCIL_2D_2AA 3 #define SI_TILE_MODE_DEPTH_STENCIL_2D_4AA 3 #define SI_TILE_MODE_DEPTH_STENCIL_2D_8AA 2 #define CIK_TILE_MODE_DEPTH_STENCIL_1D 5 #if defined(__cplusplus) } #endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/i810_drm.h��������������������������������������������������������������������������������������0000644�����������������00000023515�14763166027�0007044 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _I810_DRM_H_ #define _I810_DRM_H_ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* WARNING: These defines must be the same as what the Xserver uses. * if you change them, you must change the defines in the Xserver. */ #ifndef _I810_DEFINES_ #define _I810_DEFINES_ #define I810_DMA_BUF_ORDER 12 #define I810_DMA_BUF_SZ (1<<I810_DMA_BUF_ORDER) #define I810_DMA_BUF_NR 256 #define I810_NR_SAREA_CLIPRECTS 8 /* Each region is a minimum of 64k, and there are at most 64 of them. */ #define I810_NR_TEX_REGIONS 64 #define I810_LOG_MIN_TEX_REGION_SIZE 16 #endif #define I810_UPLOAD_TEX0IMAGE 0x1 /* handled clientside */ #define I810_UPLOAD_TEX1IMAGE 0x2 /* handled clientside */ #define I810_UPLOAD_CTX 0x4 #define I810_UPLOAD_BUFFERS 0x8 #define I810_UPLOAD_TEX0 0x10 #define I810_UPLOAD_TEX1 0x20 #define I810_UPLOAD_CLIPRECTS 0x40 /* Indices into buf.Setup where various bits of state are mirrored per * context and per buffer. These can be fired at the card as a unit, * or in a piecewise fashion as required. */ /* Destbuffer state * - backbuffer linear offset and pitch -- invarient in the current dri * - zbuffer linear offset and pitch -- also invarient * - drawing origin in back and depth buffers. * * Keep the depth/back buffer state here to accommodate private buffers * in the future. */ #define I810_DESTREG_DI0 0 /* CMD_OP_DESTBUFFER_INFO (2 dwords) */ #define I810_DESTREG_DI1 1 #define I810_DESTREG_DV0 2 /* GFX_OP_DESTBUFFER_VARS (2 dwords) */ #define I810_DESTREG_DV1 3 #define I810_DESTREG_DR0 4 /* GFX_OP_DRAWRECT_INFO (4 dwords) */ #define I810_DESTREG_DR1 5 #define I810_DESTREG_DR2 6 #define I810_DESTREG_DR3 7 #define I810_DESTREG_DR4 8 #define I810_DEST_SETUP_SIZE 10 /* Context state */ #define I810_CTXREG_CF0 0 /* GFX_OP_COLOR_FACTOR */ #define I810_CTXREG_CF1 1 #define I810_CTXREG_ST0 2 /* GFX_OP_STIPPLE */ #define I810_CTXREG_ST1 3 #define I810_CTXREG_VF 4 /* GFX_OP_VERTEX_FMT */ #define I810_CTXREG_MT 5 /* GFX_OP_MAP_TEXELS */ #define I810_CTXREG_MC0 6 /* GFX_OP_MAP_COLOR_STAGES - stage 0 */ #define I810_CTXREG_MC1 7 /* GFX_OP_MAP_COLOR_STAGES - stage 1 */ #define I810_CTXREG_MC2 8 /* GFX_OP_MAP_COLOR_STAGES - stage 2 */ #define I810_CTXREG_MA0 9 /* GFX_OP_MAP_ALPHA_STAGES - stage 0 */ #define I810_CTXREG_MA1 10 /* GFX_OP_MAP_ALPHA_STAGES - stage 1 */ #define I810_CTXREG_MA2 11 /* GFX_OP_MAP_ALPHA_STAGES - stage 2 */ #define I810_CTXREG_SDM 12 /* GFX_OP_SRC_DEST_MONO */ #define I810_CTXREG_FOG 13 /* GFX_OP_FOG_COLOR */ #define I810_CTXREG_B1 14 /* GFX_OP_BOOL_1 */ #define I810_CTXREG_B2 15 /* GFX_OP_BOOL_2 */ #define I810_CTXREG_LCS 16 /* GFX_OP_LINEWIDTH_CULL_SHADE_MODE */ #define I810_CTXREG_PV 17 /* GFX_OP_PV_RULE -- Invarient! */ #define I810_CTXREG_ZA 18 /* GFX_OP_ZBIAS_ALPHAFUNC */ #define I810_CTXREG_AA 19 /* GFX_OP_ANTIALIAS */ #define I810_CTX_SETUP_SIZE 20 /* Texture state (per tex unit) */ #define I810_TEXREG_MI0 0 /* GFX_OP_MAP_INFO (4 dwords) */ #define I810_TEXREG_MI1 1 #define I810_TEXREG_MI2 2 #define I810_TEXREG_MI3 3 #define I810_TEXREG_MF 4 /* GFX_OP_MAP_FILTER */ #define I810_TEXREG_MLC 5 /* GFX_OP_MAP_LOD_CTL */ #define I810_TEXREG_MLL 6 /* GFX_OP_MAP_LOD_LIMITS */ #define I810_TEXREG_MCS 7 /* GFX_OP_MAP_COORD_SETS ??? */ #define I810_TEX_SETUP_SIZE 8 /* Flags for clear ioctl */ #define I810_FRONT 0x1 #define I810_BACK 0x2 #define I810_DEPTH 0x4 typedef enum _drm_i810_init_func { I810_INIT_DMA = 0x01, I810_CLEANUP_DMA = 0x02, I810_INIT_DMA_1_4 = 0x03 } drm_i810_init_func_t; /* This is the init structure after v1.2 */ typedef struct _drm_i810_init { drm_i810_init_func_t func; unsigned int mmio_offset; unsigned int buffers_offset; int sarea_priv_offset; unsigned int ring_start; unsigned int ring_end; unsigned int ring_size; unsigned int front_offset; unsigned int back_offset; unsigned int depth_offset; unsigned int overlay_offset; unsigned int overlay_physical; unsigned int w; unsigned int h; unsigned int pitch; unsigned int pitch_bits; } drm_i810_init_t; /* This is the init structure prior to v1.2 */ typedef struct _drm_i810_pre12_init { drm_i810_init_func_t func; unsigned int mmio_offset; unsigned int buffers_offset; int sarea_priv_offset; unsigned int ring_start; unsigned int ring_end; unsigned int ring_size; unsigned int front_offset; unsigned int back_offset; unsigned int depth_offset; unsigned int w; unsigned int h; unsigned int pitch; unsigned int pitch_bits; } drm_i810_pre12_init_t; /* Warning: If you change the SAREA structure you must change the Xserver * structure as well */ typedef struct _drm_i810_tex_region { unsigned char next, prev; /* indices to form a circular LRU */ unsigned char in_use; /* owned by a client, or free? */ int age; /* tracked by clients to update local LRU's */ } drm_i810_tex_region_t; typedef struct _drm_i810_sarea { unsigned int ContextState[I810_CTX_SETUP_SIZE]; unsigned int BufferState[I810_DEST_SETUP_SIZE]; unsigned int TexState[2][I810_TEX_SETUP_SIZE]; unsigned int dirty; unsigned int nbox; struct drm_clip_rect boxes[I810_NR_SAREA_CLIPRECTS]; /* Maintain an LRU of contiguous regions of texture space. If * you think you own a region of texture memory, and it has an * age different to the one you set, then you are mistaken and * it has been stolen by another client. If global texAge * hasn't changed, there is no need to walk the list. * * These regions can be used as a proxy for the fine-grained * texture information of other clients - by maintaining them * in the same lru which is used to age their own textures, * clients have an approximate lru for the whole of global * texture space, and can make informed decisions as to which * areas to kick out. There is no need to choose whether to * kick out your own texture or someone else's - simply eject * them all in LRU order. */ drm_i810_tex_region_t texList[I810_NR_TEX_REGIONS + 1]; /* Last elt is sentinal */ int texAge; /* last time texture was uploaded */ int last_enqueue; /* last time a buffer was enqueued */ int last_dispatch; /* age of the most recently dispatched buffer */ int last_quiescent; /* */ int ctxOwner; /* last context to upload state */ int vertex_prim; int pf_enabled; /* is pageflipping allowed? */ int pf_active; int pf_current_page; /* which buffer is being displayed? */ } drm_i810_sarea_t; /* WARNING: If you change any of these defines, make sure to change the * defines in the Xserver file (xf86drmMga.h) */ /* i810 specific ioctls * The device specific ioctl range is 0x40 to 0x79. */ #define DRM_I810_INIT 0x00 #define DRM_I810_VERTEX 0x01 #define DRM_I810_CLEAR 0x02 #define DRM_I810_FLUSH 0x03 #define DRM_I810_GETAGE 0x04 #define DRM_I810_GETBUF 0x05 #define DRM_I810_SWAP 0x06 #define DRM_I810_COPY 0x07 #define DRM_I810_DOCOPY 0x08 #define DRM_I810_OV0INFO 0x09 #define DRM_I810_FSTATUS 0x0a #define DRM_I810_OV0FLIP 0x0b #define DRM_I810_MC 0x0c #define DRM_I810_RSTATUS 0x0d #define DRM_I810_FLIP 0x0e #define DRM_IOCTL_I810_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I810_INIT, drm_i810_init_t) #define DRM_IOCTL_I810_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_I810_VERTEX, drm_i810_vertex_t) #define DRM_IOCTL_I810_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_I810_CLEAR, drm_i810_clear_t) #define DRM_IOCTL_I810_FLUSH DRM_IO( DRM_COMMAND_BASE + DRM_I810_FLUSH) #define DRM_IOCTL_I810_GETAGE DRM_IO( DRM_COMMAND_BASE + DRM_I810_GETAGE) #define DRM_IOCTL_I810_GETBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_I810_GETBUF, drm_i810_dma_t) #define DRM_IOCTL_I810_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_I810_SWAP) #define DRM_IOCTL_I810_COPY DRM_IOW( DRM_COMMAND_BASE + DRM_I810_COPY, drm_i810_copy_t) #define DRM_IOCTL_I810_DOCOPY DRM_IO( DRM_COMMAND_BASE + DRM_I810_DOCOPY) #define DRM_IOCTL_I810_OV0INFO DRM_IOR( DRM_COMMAND_BASE + DRM_I810_OV0INFO, drm_i810_overlay_t) #define DRM_IOCTL_I810_FSTATUS DRM_IO ( DRM_COMMAND_BASE + DRM_I810_FSTATUS) #define DRM_IOCTL_I810_OV0FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I810_OV0FLIP) #define DRM_IOCTL_I810_MC DRM_IOW( DRM_COMMAND_BASE + DRM_I810_MC, drm_i810_mc_t) #define DRM_IOCTL_I810_RSTATUS DRM_IO ( DRM_COMMAND_BASE + DRM_I810_RSTATUS) #define DRM_IOCTL_I810_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I810_FLIP) typedef struct _drm_i810_clear { int clear_color; int clear_depth; int flags; } drm_i810_clear_t; /* These may be placeholders if we have more cliprects than * I810_NR_SAREA_CLIPRECTS. In that case, the client sets discard to * false, indicating that the buffer will be dispatched again with a * new set of cliprects. */ typedef struct _drm_i810_vertex { int idx; /* buffer index */ int used; /* nr bytes in use */ int discard; /* client is finished with the buffer? */ } drm_i810_vertex_t; typedef struct _drm_i810_copy_t { int idx; /* buffer index */ int used; /* nr bytes in use */ void *address; /* Address to copy from */ } drm_i810_copy_t; #define PR_TRIANGLES (0x0<<18) #define PR_TRISTRIP_0 (0x1<<18) #define PR_TRISTRIP_1 (0x2<<18) #define PR_TRIFAN (0x3<<18) #define PR_POLYGON (0x4<<18) #define PR_LINES (0x5<<18) #define PR_LINESTRIP (0x6<<18) #define PR_RECTS (0x7<<18) #define PR_MASK (0x7<<18) typedef struct drm_i810_dma { void *virtual; int request_idx; int request_size; int granted; } drm_i810_dma_t; typedef struct _drm_i810_overlay_t { unsigned int offset; /* Address of the Overlay Regs */ unsigned int physical; } drm_i810_overlay_t; typedef struct _drm_i810_mc { int idx; /* buffer index */ int used; /* nr bytes in use */ int num_blocks; /* number of GFXBlocks */ int *length; /* List of lengths for GFXBlocks (FUTURE) */ unsigned int last_render; /* Last Render Request */ } drm_i810_mc_t; #if defined(__cplusplus) } #endif #endif /* _I810_DRM_H_ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/via_drm.h���������������������������������������������������������������������������������������0000644�����������������00000020231�14763166027�0007132 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sub license, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef _VIA_DRM_H_ #define _VIA_DRM_H_ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* WARNING: These defines must be the same as what the Xserver uses. * if you change them, you must change the defines in the Xserver. */ #ifndef _VIA_DEFINES_ #define _VIA_DEFINES_ #define VIA_NR_SAREA_CLIPRECTS 8 #define VIA_NR_XVMC_PORTS 10 #define VIA_NR_XVMC_LOCKS 5 #define VIA_MAX_CACHELINE_SIZE 64 #define XVMCLOCKPTR(saPriv,lockNo) \ ((__volatile__ struct drm_hw_lock *)(((((unsigned long) (saPriv)->XvMCLockArea) + \ (VIA_MAX_CACHELINE_SIZE - 1)) & \ ~(VIA_MAX_CACHELINE_SIZE - 1)) + \ VIA_MAX_CACHELINE_SIZE*(lockNo))) /* Each region is a minimum of 64k, and there are at most 64 of them. */ #define VIA_NR_TEX_REGIONS 64 #define VIA_LOG_MIN_TEX_REGION_SIZE 16 #endif #define VIA_UPLOAD_TEX0IMAGE 0x1 /* handled clientside */ #define VIA_UPLOAD_TEX1IMAGE 0x2 /* handled clientside */ #define VIA_UPLOAD_CTX 0x4 #define VIA_UPLOAD_BUFFERS 0x8 #define VIA_UPLOAD_TEX0 0x10 #define VIA_UPLOAD_TEX1 0x20 #define VIA_UPLOAD_CLIPRECTS 0x40 #define VIA_UPLOAD_ALL 0xff /* VIA specific ioctls */ #define DRM_VIA_ALLOCMEM 0x00 #define DRM_VIA_FREEMEM 0x01 #define DRM_VIA_AGP_INIT 0x02 #define DRM_VIA_FB_INIT 0x03 #define DRM_VIA_MAP_INIT 0x04 #define DRM_VIA_DEC_FUTEX 0x05 #define NOT_USED #define DRM_VIA_DMA_INIT 0x07 #define DRM_VIA_CMDBUFFER 0x08 #define DRM_VIA_FLUSH 0x09 #define DRM_VIA_PCICMD 0x0a #define DRM_VIA_CMDBUF_SIZE 0x0b #define NOT_USED #define DRM_VIA_WAIT_IRQ 0x0d #define DRM_VIA_DMA_BLIT 0x0e #define DRM_VIA_BLIT_SYNC 0x0f #define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_ALLOCMEM, drm_via_mem_t) #define DRM_IOCTL_VIA_FREEMEM DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_FREEMEM, drm_via_mem_t) #define DRM_IOCTL_VIA_AGP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_AGP_INIT, drm_via_agp_t) #define DRM_IOCTL_VIA_FB_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_FB_INIT, drm_via_fb_t) #define DRM_IOCTL_VIA_MAP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_MAP_INIT, drm_via_init_t) #define DRM_IOCTL_VIA_DEC_FUTEX DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_DEC_FUTEX, drm_via_futex_t) #define DRM_IOCTL_VIA_DMA_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_DMA_INIT, drm_via_dma_init_t) #define DRM_IOCTL_VIA_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_CMDBUFFER, drm_via_cmdbuffer_t) #define DRM_IOCTL_VIA_FLUSH DRM_IO( DRM_COMMAND_BASE + DRM_VIA_FLUSH) #define DRM_IOCTL_VIA_PCICMD DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_PCICMD, drm_via_cmdbuffer_t) #define DRM_IOCTL_VIA_CMDBUF_SIZE DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_CMDBUF_SIZE, \ drm_via_cmdbuf_size_t) #define DRM_IOCTL_VIA_WAIT_IRQ DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_WAIT_IRQ, drm_via_irqwait_t) #define DRM_IOCTL_VIA_DMA_BLIT DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_DMA_BLIT, drm_via_dmablit_t) #define DRM_IOCTL_VIA_BLIT_SYNC DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_BLIT_SYNC, drm_via_blitsync_t) /* Indices into buf.Setup where various bits of state are mirrored per * context and per buffer. These can be fired at the card as a unit, * or in a piecewise fashion as required. */ #define VIA_TEX_SETUP_SIZE 8 /* Flags for clear ioctl */ #define VIA_FRONT 0x1 #define VIA_BACK 0x2 #define VIA_DEPTH 0x4 #define VIA_STENCIL 0x8 #define VIA_MEM_VIDEO 0 /* matches drm constant */ #define VIA_MEM_AGP 1 /* matches drm constant */ #define VIA_MEM_SYSTEM 2 #define VIA_MEM_MIXED 3 #define VIA_MEM_UNKNOWN 4 typedef struct { __u32 offset; __u32 size; } drm_via_agp_t; typedef struct { __u32 offset; __u32 size; } drm_via_fb_t; typedef struct { __u32 context; __u32 type; __u32 size; unsigned long index; unsigned long offset; } drm_via_mem_t; typedef struct _drm_via_init { enum { VIA_INIT_MAP = 0x01, VIA_CLEANUP_MAP = 0x02 } func; unsigned long sarea_priv_offset; unsigned long fb_offset; unsigned long mmio_offset; unsigned long agpAddr; } drm_via_init_t; typedef struct _drm_via_futex { enum { VIA_FUTEX_WAIT = 0x00, VIA_FUTEX_WAKE = 0X01 } func; __u32 ms; __u32 lock; __u32 val; } drm_via_futex_t; typedef struct _drm_via_dma_init { enum { VIA_INIT_DMA = 0x01, VIA_CLEANUP_DMA = 0x02, VIA_DMA_INITIALIZED = 0x03 } func; unsigned long offset; unsigned long size; unsigned long reg_pause_addr; } drm_via_dma_init_t; typedef struct _drm_via_cmdbuffer { char *buf; unsigned long size; } drm_via_cmdbuffer_t; /* Warning: If you change the SAREA structure you must change the Xserver * structure as well */ typedef struct _drm_via_tex_region { unsigned char next, prev; /* indices to form a circular LRU */ unsigned char inUse; /* owned by a client, or free? */ int age; /* tracked by clients to update local LRU's */ } drm_via_tex_region_t; typedef struct _drm_via_sarea { unsigned int dirty; unsigned int nbox; struct drm_clip_rect boxes[VIA_NR_SAREA_CLIPRECTS]; drm_via_tex_region_t texList[VIA_NR_TEX_REGIONS + 1]; int texAge; /* last time texture was uploaded */ int ctxOwner; /* last context to upload state */ int vertexPrim; /* * Below is for XvMC. * We want the lock integers alone on, and aligned to, a cache line. * Therefore this somewhat strange construct. */ char XvMCLockArea[VIA_MAX_CACHELINE_SIZE * (VIA_NR_XVMC_LOCKS + 1)]; unsigned int XvMCDisplaying[VIA_NR_XVMC_PORTS]; unsigned int XvMCSubPicOn[VIA_NR_XVMC_PORTS]; unsigned int XvMCCtxNoGrabbed; /* Last context to hold decoder */ /* Used by the 3d driver only at this point, for pageflipping: */ unsigned int pfCurrentOffset; } drm_via_sarea_t; typedef struct _drm_via_cmdbuf_size { enum { VIA_CMDBUF_SPACE = 0x01, VIA_CMDBUF_LAG = 0x02 } func; int wait; __u32 size; } drm_via_cmdbuf_size_t; typedef enum { VIA_IRQ_ABSOLUTE = 0x0, VIA_IRQ_RELATIVE = 0x1, VIA_IRQ_SIGNAL = 0x10000000, VIA_IRQ_FORCE_SEQUENCE = 0x20000000 } via_irq_seq_type_t; #define VIA_IRQ_FLAGS_MASK 0xF0000000 enum drm_via_irqs { drm_via_irq_hqv0 = 0, drm_via_irq_hqv1, drm_via_irq_dma0_dd, drm_via_irq_dma0_td, drm_via_irq_dma1_dd, drm_via_irq_dma1_td, drm_via_irq_num }; struct drm_via_wait_irq_request { unsigned irq; via_irq_seq_type_t type; __u32 sequence; __u32 signal; }; typedef union drm_via_irqwait { struct drm_via_wait_irq_request request; struct drm_wait_vblank_reply reply; } drm_via_irqwait_t; typedef struct drm_via_blitsync { __u32 sync_handle; unsigned engine; } drm_via_blitsync_t; /* - * Below,"flags" is currently unused but will be used for possible future * extensions like kernel space bounce buffers for bad alignments and * blit engine busy-wait polling for better latency in the absence of * interrupts. */ typedef struct drm_via_dmablit { __u32 num_lines; __u32 line_length; __u32 fb_addr; __u32 fb_stride; unsigned char *mem_addr; __u32 mem_stride; __u32 flags; int to_fb; drm_via_blitsync_t sync; } drm_via_dmablit_t; #if defined(__cplusplus) } #endif #endif /* _VIA_DRM_H_ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/nouveau_drm.h�����������������������������������������������������������������������������������0000644�����������������00000011357�14763166027�0010046 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright 2005 Stephane Marchesin. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef __NOUVEAU_DRM_H__ #define __NOUVEAU_DRM_H__ #define DRM_NOUVEAU_EVENT_NVIF 0x80000000 #include "drm.h" #if defined(__cplusplus) extern "C" { #endif #define NOUVEAU_GEM_DOMAIN_CPU (1 << 0) #define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1) #define NOUVEAU_GEM_DOMAIN_GART (1 << 2) #define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3) #define NOUVEAU_GEM_DOMAIN_COHERENT (1 << 4) #define NOUVEAU_GEM_TILE_COMP 0x00030000 /* nv50-only */ #define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00 #define NOUVEAU_GEM_TILE_16BPP 0x00000001 #define NOUVEAU_GEM_TILE_32BPP 0x00000002 #define NOUVEAU_GEM_TILE_ZETA 0x00000004 #define NOUVEAU_GEM_TILE_NONCONTIG 0x00000008 struct drm_nouveau_gem_info { __u32 handle; __u32 domain; __u64 size; __u64 offset; __u64 map_handle; __u32 tile_mode; __u32 tile_flags; }; struct drm_nouveau_gem_new { struct drm_nouveau_gem_info info; __u32 channel_hint; __u32 align; }; #define NOUVEAU_GEM_MAX_BUFFERS 1024 struct drm_nouveau_gem_pushbuf_bo_presumed { __u32 valid; __u32 domain; __u64 offset; }; struct drm_nouveau_gem_pushbuf_bo { __u64 user_priv; __u32 handle; __u32 read_domains; __u32 write_domains; __u32 valid_domains; struct drm_nouveau_gem_pushbuf_bo_presumed presumed; }; #define NOUVEAU_GEM_RELOC_LOW (1 << 0) #define NOUVEAU_GEM_RELOC_HIGH (1 << 1) #define NOUVEAU_GEM_RELOC_OR (1 << 2) #define NOUVEAU_GEM_MAX_RELOCS 1024 struct drm_nouveau_gem_pushbuf_reloc { __u32 reloc_bo_index; __u32 reloc_bo_offset; __u32 bo_index; __u32 flags; __u32 data; __u32 vor; __u32 tor; }; #define NOUVEAU_GEM_MAX_PUSH 512 struct drm_nouveau_gem_pushbuf_push { __u32 bo_index; __u32 pad; __u64 offset; __u64 length; }; struct drm_nouveau_gem_pushbuf { __u32 channel; __u32 nr_buffers; __u64 buffers; __u32 nr_relocs; __u32 nr_push; __u64 relocs; __u64 push; __u32 suffix0; __u32 suffix1; __u64 vram_available; __u64 gart_available; }; #define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001 #define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004 struct drm_nouveau_gem_cpu_prep { __u32 handle; __u32 flags; }; struct drm_nouveau_gem_cpu_fini { __u32 handle; }; #define DRM_NOUVEAU_GETPARAM 0x00 /* deprecated */ #define DRM_NOUVEAU_SETPARAM 0x01 /* deprecated */ #define DRM_NOUVEAU_CHANNEL_ALLOC 0x02 /* deprecated */ #define DRM_NOUVEAU_CHANNEL_FREE 0x03 /* deprecated */ #define DRM_NOUVEAU_GROBJ_ALLOC 0x04 /* deprecated */ #define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x05 /* deprecated */ #define DRM_NOUVEAU_GPUOBJ_FREE 0x06 /* deprecated */ #define DRM_NOUVEAU_NVIF 0x07 #define DRM_NOUVEAU_GEM_NEW 0x40 #define DRM_NOUVEAU_GEM_PUSHBUF 0x41 #define DRM_NOUVEAU_GEM_CPU_PREP 0x42 #define DRM_NOUVEAU_GEM_CPU_FINI 0x43 #define DRM_NOUVEAU_GEM_INFO 0x44 #define DRM_IOCTL_NOUVEAU_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_NEW, struct drm_nouveau_gem_new) #define DRM_IOCTL_NOUVEAU_GEM_PUSHBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_PUSHBUF, struct drm_nouveau_gem_pushbuf) #define DRM_IOCTL_NOUVEAU_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_CPU_PREP, struct drm_nouveau_gem_cpu_prep) #define DRM_IOCTL_NOUVEAU_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_CPU_FINI, struct drm_nouveau_gem_cpu_fini) #define DRM_IOCTL_NOUVEAU_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_INFO, struct drm_nouveau_gem_info) #if defined(__cplusplus) } #endif #endif /* __NOUVEAU_DRM_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/v3d_drm.h���������������������������������������������������������������������������������������0000644�����������������00000013701�14763166027�0007053 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright © 2014-2018 Broadcom * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef _V3D_DRM_H_ #define _V3D_DRM_H_ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif #define DRM_V3D_SUBMIT_CL 0x00 #define DRM_V3D_WAIT_BO 0x01 #define DRM_V3D_CREATE_BO 0x02 #define DRM_V3D_MMAP_BO 0x03 #define DRM_V3D_GET_PARAM 0x04 #define DRM_V3D_GET_BO_OFFSET 0x05 #define DRM_IOCTL_V3D_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CL, struct drm_v3d_submit_cl) #define DRM_IOCTL_V3D_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_WAIT_BO, struct drm_v3d_wait_bo) #define DRM_IOCTL_V3D_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_CREATE_BO, struct drm_v3d_create_bo) #define DRM_IOCTL_V3D_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_MMAP_BO, struct drm_v3d_mmap_bo) #define DRM_IOCTL_V3D_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_PARAM, struct drm_v3d_get_param) #define DRM_IOCTL_V3D_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_BO_OFFSET, struct drm_v3d_get_bo_offset) /** * struct drm_v3d_submit_cl - ioctl argument for submitting commands to the 3D * engine. * * This asks the kernel to have the GPU execute an optional binner * command list, and a render command list. */ struct drm_v3d_submit_cl { /* Pointer to the binner command list. * * This is the first set of commands executed, which runs the * coordinate shader to determine where primitives land on the screen, * then writes out the state updates and draw calls necessary per tile * to the tile allocation BO. */ __u32 bcl_start; /** End address of the BCL (first byte after the BCL) */ __u32 bcl_end; /* Offset of the render command list. * * This is the second set of commands executed, which will either * execute the tiles that have been set up by the BCL, or a fixed set * of tiles (in the case of RCL-only blits). */ __u32 rcl_start; /** End address of the RCL (first byte after the RCL) */ __u32 rcl_end; /** An optional sync object to wait on before starting the BCL. */ __u32 in_sync_bcl; /** An optional sync object to wait on before starting the RCL. */ __u32 in_sync_rcl; /** An optional sync object to place the completion fence in. */ __u32 out_sync; /* Offset of the tile alloc memory * * This is optional on V3D 3.3 (where the CL can set the value) but * required on V3D 4.1. */ __u32 qma; /** Size of the tile alloc memory. */ __u32 qms; /** Offset of the tile state data array. */ __u32 qts; /* Pointer to a u32 array of the BOs that are referenced by the job. */ __u64 bo_handles; /* Number of BO handles passed in (size is that times 4). */ __u32 bo_handle_count; /* Pad, must be zero-filled. */ __u32 pad; }; /** * struct drm_v3d_wait_bo - ioctl argument for waiting for * completion of the last DRM_V3D_SUBMIT_CL on a BO. * * This is useful for cases where multiple processes might be * rendering to a BO and you want to wait for all rendering to be * completed. */ struct drm_v3d_wait_bo { __u32 handle; __u32 pad; __u64 timeout_ns; }; /** * struct drm_v3d_create_bo - ioctl argument for creating V3D BOs. * * There are currently no values for the flags argument, but it may be * used in a future extension. */ struct drm_v3d_create_bo { __u32 size; __u32 flags; /** Returned GEM handle for the BO. */ __u32 handle; /** * Returned offset for the BO in the V3D address space. This offset * is private to the DRM fd and is valid for the lifetime of the GEM * handle. * * This offset value will always be nonzero, since various HW * units treat 0 specially. */ __u32 offset; }; /** * struct drm_v3d_mmap_bo - ioctl argument for mapping V3D BOs. * * This doesn't actually perform an mmap. Instead, it returns the * offset you need to use in an mmap on the DRM device node. This * means that tools like valgrind end up knowing about the mapped * memory. * * There are currently no values for the flags argument, but it may be * used in a future extension. */ struct drm_v3d_mmap_bo { /** Handle for the object being mapped. */ __u32 handle; __u32 flags; /** offset into the drm node to use for subsequent mmap call. */ __u64 offset; }; enum drm_v3d_param { DRM_V3D_PARAM_V3D_UIFCFG, DRM_V3D_PARAM_V3D_HUB_IDENT1, DRM_V3D_PARAM_V3D_HUB_IDENT2, DRM_V3D_PARAM_V3D_HUB_IDENT3, DRM_V3D_PARAM_V3D_CORE0_IDENT0, DRM_V3D_PARAM_V3D_CORE0_IDENT1, DRM_V3D_PARAM_V3D_CORE0_IDENT2, }; struct drm_v3d_get_param { __u32 param; __u32 pad; __u64 value; }; /** * Returns the offset for the BO in the V3D address space for this DRM fd. * This is the same value returned by drm_v3d_create_bo, if that was called * from this DRM fd. */ struct drm_v3d_get_bo_offset { __u32 handle; __u32 offset; }; #if defined(__cplusplus) } #endif #endif /* _V3D_DRM_H_ */ ���������������������������������������������������������������drm/armada_drm.h������������������������������������������������������������������������������������0000644�����������������00000002274�14763166027�0007607 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2012 Russell King * With inspiration from the i915 driver * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef DRM_ARMADA_IOCTL_H #define DRM_ARMADA_IOCTL_H #include "drm.h" #if defined(__cplusplus) extern "C" { #endif #define DRM_ARMADA_GEM_CREATE 0x00 #define DRM_ARMADA_GEM_MMAP 0x02 #define DRM_ARMADA_GEM_PWRITE 0x03 #define ARMADA_IOCTL(dir, name, str) \ DRM_##dir(DRM_COMMAND_BASE + DRM_ARMADA_##name, struct drm_armada_##str) struct drm_armada_gem_create { __u32 handle; __u32 size; }; #define DRM_IOCTL_ARMADA_GEM_CREATE \ ARMADA_IOCTL(IOWR, GEM_CREATE, gem_create) struct drm_armada_gem_mmap { __u32 handle; __u32 pad; __u64 offset; __u64 size; __u64 addr; }; #define DRM_IOCTL_ARMADA_GEM_MMAP \ ARMADA_IOCTL(IOWR, GEM_MMAP, gem_mmap) struct drm_armada_gem_pwrite { __u64 ptr; __u32 handle; __u32 offset; __u32 size; }; #define DRM_IOCTL_ARMADA_GEM_PWRITE \ ARMADA_IOCTL(IOW, GEM_PWRITE, gem_pwrite) #if defined(__cplusplus) } #endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/drm_fourcc.h������������������������������������������������������������������������������������0000644�����������������00000060555�14763166027�0007651 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright 2011 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H #include "drm.h" #if defined(__cplusplus) extern "C" { #endif #define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \ ((__u32)(c) << 16) | ((__u32)(d) << 24)) #define DRM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */ /* color index */ #define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */ /* 8 bpp Red */ #define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') /* [7:0] R */ /* 16 bpp Red */ #define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ') /* [15:0] R little endian */ /* 16 bpp RG */ #define DRM_FORMAT_RG88 fourcc_code('R', 'G', '8', '8') /* [15:0] R:G 8:8 little endian */ #define DRM_FORMAT_GR88 fourcc_code('G', 'R', '8', '8') /* [15:0] G:R 8:8 little endian */ /* 32 bpp RG */ #define DRM_FORMAT_RG1616 fourcc_code('R', 'G', '3', '2') /* [31:0] R:G 16:16 little endian */ #define DRM_FORMAT_GR1616 fourcc_code('G', 'R', '3', '2') /* [31:0] G:R 16:16 little endian */ /* 8 bpp RGB */ #define DRM_FORMAT_RGB332 fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */ #define DRM_FORMAT_BGR233 fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */ /* 16 bpp RGB */ #define DRM_FORMAT_XRGB4444 fourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */ #define DRM_FORMAT_XBGR4444 fourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */ #define DRM_FORMAT_RGBX4444 fourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */ #define DRM_FORMAT_BGRX4444 fourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */ #define DRM_FORMAT_ARGB4444 fourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */ #define DRM_FORMAT_ABGR4444 fourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */ #define DRM_FORMAT_RGBA4444 fourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */ #define DRM_FORMAT_BGRA4444 fourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */ #define DRM_FORMAT_XRGB1555 fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */ #define DRM_FORMAT_XBGR1555 fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */ #define DRM_FORMAT_RGBX5551 fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */ #define DRM_FORMAT_BGRX5551 fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */ #define DRM_FORMAT_ARGB1555 fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */ #define DRM_FORMAT_ABGR1555 fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */ #define DRM_FORMAT_RGBA5551 fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */ #define DRM_FORMAT_BGRA5551 fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */ #define DRM_FORMAT_RGB565 fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */ #define DRM_FORMAT_BGR565 fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */ /* 24 bpp RGB */ #define DRM_FORMAT_RGB888 fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */ #define DRM_FORMAT_BGR888 fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */ /* 32 bpp RGB */ #define DRM_FORMAT_XRGB8888 fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */ #define DRM_FORMAT_XBGR8888 fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */ #define DRM_FORMAT_RGBX8888 fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */ #define DRM_FORMAT_BGRX8888 fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */ #define DRM_FORMAT_ARGB8888 fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */ #define DRM_FORMAT_ABGR8888 fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */ #define DRM_FORMAT_RGBA8888 fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */ #define DRM_FORMAT_BGRA8888 fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */ #define DRM_FORMAT_XRGB2101010 fourcc_code('X', 'R', '3', '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */ #define DRM_FORMAT_XBGR2101010 fourcc_code('X', 'B', '3', '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */ #define DRM_FORMAT_RGBX1010102 fourcc_code('R', 'X', '3', '0') /* [31:0] R:G:B:x 10:10:10:2 little endian */ #define DRM_FORMAT_BGRX1010102 fourcc_code('B', 'X', '3', '0') /* [31:0] B:G:R:x 10:10:10:2 little endian */ #define DRM_FORMAT_ARGB2101010 fourcc_code('A', 'R', '3', '0') /* [31:0] A:R:G:B 2:10:10:10 little endian */ #define DRM_FORMAT_ABGR2101010 fourcc_code('A', 'B', '3', '0') /* [31:0] A:B:G:R 2:10:10:10 little endian */ #define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */ #define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */ /* packed YCbCr */ #define DRM_FORMAT_YUYV fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */ #define DRM_FORMAT_YVYU fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */ #define DRM_FORMAT_UYVY fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */ #define DRM_FORMAT_VYUY fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */ #define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */ /* * 2 plane RGB + A * index 0 = RGB plane, same format as the corresponding non _A8 format has * index 1 = A plane, [7:0] A */ #define DRM_FORMAT_XRGB8888_A8 fourcc_code('X', 'R', 'A', '8') #define DRM_FORMAT_XBGR8888_A8 fourcc_code('X', 'B', 'A', '8') #define DRM_FORMAT_RGBX8888_A8 fourcc_code('R', 'X', 'A', '8') #define DRM_FORMAT_BGRX8888_A8 fourcc_code('B', 'X', 'A', '8') #define DRM_FORMAT_RGB888_A8 fourcc_code('R', '8', 'A', '8') #define DRM_FORMAT_BGR888_A8 fourcc_code('B', '8', 'A', '8') #define DRM_FORMAT_RGB565_A8 fourcc_code('R', '5', 'A', '8') #define DRM_FORMAT_BGR565_A8 fourcc_code('B', '5', 'A', '8') /* * 2 plane YCbCr * index 0 = Y plane, [7:0] Y * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian * or * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian */ #define DRM_FORMAT_NV12 fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */ #define DRM_FORMAT_NV21 fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */ #define DRM_FORMAT_NV16 fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */ #define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */ #define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4') /* non-subsampled Cr:Cb plane */ #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */ /* * 3 plane YCbCr * index 0: Y plane, [7:0] Y * index 1: Cb plane, [7:0] Cb * index 2: Cr plane, [7:0] Cr * or * index 1: Cr plane, [7:0] Cr * index 2: Cb plane, [7:0] Cb */ #define DRM_FORMAT_YUV410 fourcc_code('Y', 'U', 'V', '9') /* 4x4 subsampled Cb (1) and Cr (2) planes */ #define DRM_FORMAT_YVU410 fourcc_code('Y', 'V', 'U', '9') /* 4x4 subsampled Cr (1) and Cb (2) planes */ #define DRM_FORMAT_YUV411 fourcc_code('Y', 'U', '1', '1') /* 4x1 subsampled Cb (1) and Cr (2) planes */ #define DRM_FORMAT_YVU411 fourcc_code('Y', 'V', '1', '1') /* 4x1 subsampled Cr (1) and Cb (2) planes */ #define DRM_FORMAT_YUV420 fourcc_code('Y', 'U', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */ #define DRM_FORMAT_YVU420 fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */ #define DRM_FORMAT_YUV422 fourcc_code('Y', 'U', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes */ #define DRM_FORMAT_YVU422 fourcc_code('Y', 'V', '1', '6') /* 2x1 subsampled Cr (1) and Cb (2) planes */ #define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */ #define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */ /* * Format Modifiers: * * Format modifiers describe, typically, a re-ordering or modification * of the data in a plane of an FB. This can be used to express tiled/ * swizzled formats, or compression, or a combination of the two. * * The upper 8 bits of the format modifier are a vendor-id as assigned * below. The lower 56 bits are assigned as vendor sees fit. */ /* Vendor Ids: */ #define DRM_FORMAT_MOD_NONE 0 #define DRM_FORMAT_MOD_VENDOR_NONE 0 #define DRM_FORMAT_MOD_VENDOR_INTEL 0x01 #define DRM_FORMAT_MOD_VENDOR_AMD 0x02 #define DRM_FORMAT_MOD_VENDOR_NVIDIA 0x03 #define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04 #define DRM_FORMAT_MOD_VENDOR_QCOM 0x05 #define DRM_FORMAT_MOD_VENDOR_VIVANTE 0x06 #define DRM_FORMAT_MOD_VENDOR_BROADCOM 0x07 #define DRM_FORMAT_MOD_VENDOR_ARM 0x08 /* add more to the end as needed */ #define DRM_FORMAT_RESERVED ((1ULL << 56) - 1) #define fourcc_mod_code(vendor, val) \ ((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL)) /* * Format Modifier tokens: * * When adding a new token please document the layout with a code comment, * similar to the fourcc codes above. drm_fourcc.h is considered the * authoritative source for all of these. */ /* * Invalid Modifier * * This modifier can be used as a sentinel to terminate the format modifiers * list, or to initialize a variable with an invalid modifier. It might also be * used to report an error back to userspace for certain APIs. */ #define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED) /* * Linear Layout * * Just plain linear layout. Note that this is different from no specifying any * modifier (e.g. not setting DRM_MODE_FB_MODIFIERS in the DRM_ADDFB2 ioctl), * which tells the driver to also take driver-internal information into account * and so might actually result in a tiled framebuffer. */ #define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0) /* Intel framebuffer modifiers */ /* * Intel X-tiling layout * * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb) * in row-major layout. Within the tile bytes are laid out row-major, with * a platform-dependent stride. On top of that the memory can apply * platform-depending swizzling of some higher address bits into bit6. * * This format is highly platforms specific and not useful for cross-driver * sharing. It exists since on a given platform it does uniquely identify the * layout in a simple way for i915-specific userspace. */ #define I915_FORMAT_MOD_X_TILED fourcc_mod_code(INTEL, 1) /* * Intel Y-tiling layout * * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb) * in row-major layout. Within the tile bytes are laid out in OWORD (16 bytes) * chunks column-major, with a platform-dependent height. On top of that the * memory can apply platform-depending swizzling of some higher address bits * into bit6. * * This format is highly platforms specific and not useful for cross-driver * sharing. It exists since on a given platform it does uniquely identify the * layout in a simple way for i915-specific userspace. */ #define I915_FORMAT_MOD_Y_TILED fourcc_mod_code(INTEL, 2) /* * Intel Yf-tiling layout * * This is a tiled layout using 4Kb tiles in row-major layout. * Within the tile pixels are laid out in 16 256 byte units / sub-tiles which * are arranged in four groups (two wide, two high) with column-major layout. * Each group therefore consits out of four 256 byte units, which are also laid * out as 2x2 column-major. * 256 byte units are made out of four 64 byte blocks of pixels, producing * either a square block or a 2:1 unit. * 64 byte blocks of pixels contain four pixel rows of 16 bytes, where the width * in pixel depends on the pixel depth. */ #define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3) /* * Intel color control surface (CCS) for render compression * * The framebuffer format must be one of the 8:8:8:8 RGB formats. * The main surface will be plane index 0 and must be Y/Yf-tiled, * the CCS will be plane index 1. * * Each CCS tile matches a 1024x512 pixel area of the main surface. * To match certain aspects of the 3D hardware the CCS is * considered to be made up of normal 128Bx32 Y tiles, Thus * the CCS pitch must be specified in multiples of 128 bytes. * * In reality the CCS tile appears to be a 64Bx64 Y tile, composed * of QWORD (8 bytes) chunks instead of OWORD (16 bytes) chunks. * But that fact is not relevant unless the memory is accessed * directly. */ #define I915_FORMAT_MOD_Y_TILED_CCS fourcc_mod_code(INTEL, 4) #define I915_FORMAT_MOD_Yf_TILED_CCS fourcc_mod_code(INTEL, 5) /* * Tiled, NV12MT, grouped in 64 (pixels) x 32 (lines) -sized macroblocks * * Macroblocks are laid in a Z-shape, and each pixel data is following the * standard NV12 style. * As for NV12, an image is the result of two frame buffers: one for Y, * one for the interleaved Cb/Cr components (1/2 the height of the Y buffer). * Alignment requirements are (for each buffer): * - multiple of 128 pixels for the width * - multiple of 32 pixels for the height * * For more information: see https://linuxtv.org/downloads/v4l-dvb-apis/re32.html */ #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) /* * Qualcomm Compressed Format * * Refers to a compressed variant of the base format that is compressed. * Implementation may be platform and base-format specific. * * Each macrotile consists of m x n (mostly 4 x 4) tiles. * Pixel data pitch/stride is aligned with macrotile width. * Pixel data height is aligned with macrotile height. * Entire pixel data buffer is aligned with 4k(bytes). */ #define DRM_FORMAT_MOD_QCOM_COMPRESSED fourcc_mod_code(QCOM, 1) /* Vivante framebuffer modifiers */ /* * Vivante 4x4 tiling layout * * This is a simple tiled layout using tiles of 4x4 pixels in a row-major * layout. */ #define DRM_FORMAT_MOD_VIVANTE_TILED fourcc_mod_code(VIVANTE, 1) /* * Vivante 64x64 super-tiling layout * * This is a tiled layout using 64x64 pixel super-tiles, where each super-tile * contains 8x4 groups of 2x4 tiles of 4x4 pixels (like above) each, all in row- * major layout. * * For more information: see * https://github.com/etnaviv/etna_viv/blob/master/doc/hardware.md#texture-tiling */ #define DRM_FORMAT_MOD_VIVANTE_SUPER_TILED fourcc_mod_code(VIVANTE, 2) /* * Vivante 4x4 tiling layout for dual-pipe * * Same as the 4x4 tiling layout, except every second 4x4 pixel tile starts at a * different base address. Offsets from the base addresses are therefore halved * compared to the non-split tiled layout. */ #define DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED fourcc_mod_code(VIVANTE, 3) /* * Vivante 64x64 super-tiling layout for dual-pipe * * Same as the 64x64 super-tiling layout, except every second 4x4 pixel tile * starts at a different base address. Offsets from the base addresses are * therefore halved compared to the non-split super-tiled layout. */ #define DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED fourcc_mod_code(VIVANTE, 4) /* NVIDIA frame buffer modifiers */ /* * Tegra Tiled Layout, used by Tegra 2, 3 and 4. * * Pixels are arranged in simple tiles of 16 x 16 bytes. */ #define DRM_FORMAT_MOD_NVIDIA_TEGRA_TILED fourcc_mod_code(NVIDIA, 1) /* * 16Bx2 Block Linear layout, used by desktop GPUs, and Tegra K1 and later * * Pixels are arranged in 64x8 Groups Of Bytes (GOBs). GOBs are then stacked * vertically by a power of 2 (1 to 32 GOBs) to form a block. * * Within a GOB, data is ordered as 16B x 2 lines sectors laid in Z-shape. * * Parameter 'v' is the log2 encoding of the number of GOBs stacked vertically. * Valid values are: * * 0 == ONE_GOB * 1 == TWO_GOBS * 2 == FOUR_GOBS * 3 == EIGHT_GOBS * 4 == SIXTEEN_GOBS * 5 == THIRTYTWO_GOBS * * Chapter 20 "Pixel Memory Formats" of the Tegra X1 TRM describes this format * in full detail. */ #define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(v) \ fourcc_mod_code(NVIDIA, 0x10 | ((v) & 0xf)) #define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_ONE_GOB \ fourcc_mod_code(NVIDIA, 0x10) #define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_TWO_GOB \ fourcc_mod_code(NVIDIA, 0x11) #define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_FOUR_GOB \ fourcc_mod_code(NVIDIA, 0x12) #define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_EIGHT_GOB \ fourcc_mod_code(NVIDIA, 0x13) #define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_SIXTEEN_GOB \ fourcc_mod_code(NVIDIA, 0x14) #define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_THIRTYTWO_GOB \ fourcc_mod_code(NVIDIA, 0x15) /* * Some Broadcom modifiers take parameters, for example the number of * vertical lines in the image. Reserve the lower 32 bits for modifier * type, and the next 24 bits for parameters. Top 8 bits are the * vendor code. */ #define __fourcc_mod_broadcom_param_shift 8 #define __fourcc_mod_broadcom_param_bits 48 #define fourcc_mod_broadcom_code(val, params) \ fourcc_mod_code(BROADCOM, ((((__u64)params) << __fourcc_mod_broadcom_param_shift) | val)) #define fourcc_mod_broadcom_param(m) \ ((int)(((m) >> __fourcc_mod_broadcom_param_shift) & \ ((1ULL << __fourcc_mod_broadcom_param_bits) - 1))) #define fourcc_mod_broadcom_mod(m) \ ((m) & ~(((1ULL << __fourcc_mod_broadcom_param_bits) - 1) << \ __fourcc_mod_broadcom_param_shift)) /* * Broadcom VC4 "T" format * * This is the primary layout that the V3D GPU can texture from (it * can't do linear). The T format has: * * - 64b utiles of pixels in a raster-order grid according to cpp. It's 4x4 * pixels at 32 bit depth. * * - 1k subtiles made of a 4x4 raster-order grid of 64b utiles (so usually * 16x16 pixels). * * - 4k tiles made of a 2x2 grid of 1k subtiles (so usually 32x32 pixels). On * even 4k tile rows, they're arranged as (BL, TL, TR, BR), and on odd rows * they're (TR, BR, BL, TL), where bottom left is start of memory. * * - an image made of 4k tiles in rows either left-to-right (even rows of 4k * tiles) or right-to-left (odd rows of 4k tiles). */ #define DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED fourcc_mod_code(BROADCOM, 1) /* * Broadcom SAND format * * This is the native format that the H.264 codec block uses. For VC4 * HVS, it is only valid for H.264 (NV12/21) and RGBA modes. * * The image can be considered to be split into columns, and the * columns are placed consecutively into memory. The width of those * columns can be either 32, 64, 128, or 256 pixels, but in practice * only 128 pixel columns are used. * * The pitch between the start of each column is set to optimally * switch between SDRAM banks. This is passed as the number of lines * of column width in the modifier (we can't use the stride value due * to various core checks that look at it , so you should set the * stride to width*cpp). * * Note that the column height for this format modifier is the same * for all of the planes, assuming that each column contains both Y * and UV. Some SAND-using hardware stores UV in a separate tiled * image from Y to reduce the column height, which is not supported * with these modifiers. */ #define DRM_FORMAT_MOD_BROADCOM_SAND32_COL_HEIGHT(v) \ fourcc_mod_broadcom_code(2, v) #define DRM_FORMAT_MOD_BROADCOM_SAND64_COL_HEIGHT(v) \ fourcc_mod_broadcom_code(3, v) #define DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT(v) \ fourcc_mod_broadcom_code(4, v) #define DRM_FORMAT_MOD_BROADCOM_SAND256_COL_HEIGHT(v) \ fourcc_mod_broadcom_code(5, v) #define DRM_FORMAT_MOD_BROADCOM_SAND32 \ DRM_FORMAT_MOD_BROADCOM_SAND32_COL_HEIGHT(0) #define DRM_FORMAT_MOD_BROADCOM_SAND64 \ DRM_FORMAT_MOD_BROADCOM_SAND64_COL_HEIGHT(0) #define DRM_FORMAT_MOD_BROADCOM_SAND128 \ DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT(0) #define DRM_FORMAT_MOD_BROADCOM_SAND256 \ DRM_FORMAT_MOD_BROADCOM_SAND256_COL_HEIGHT(0) /* Broadcom UIF format * * This is the common format for the current Broadcom multimedia * blocks, including V3D 3.x and newer, newer video codecs, and * displays. * * The image consists of utiles (64b blocks), UIF blocks (2x2 utiles), * and macroblocks (4x4 UIF blocks). Those 4x4 UIF block groups are * stored in columns, with padding between the columns to ensure that * moving from one column to the next doesn't hit the same SDRAM page * bank. * * To calculate the padding, it is assumed that each hardware block * and the software driving it knows the platform's SDRAM page size, * number of banks, and XOR address, and that it's identical between * all blocks using the format. This tiling modifier will use XOR as * necessary to reduce the padding. If a hardware block can't do XOR, * the assumption is that a no-XOR tiling modifier will be created. */ #define DRM_FORMAT_MOD_BROADCOM_UIF fourcc_mod_code(BROADCOM, 6) /* * Arm Framebuffer Compression (AFBC) modifiers * * AFBC is a proprietary lossless image compression protocol and format. * It provides fine-grained random access and minimizes the amount of data * transferred between IP blocks. * * AFBC has several features which may be supported and/or used, which are * represented using bits in the modifier. Not all combinations are valid, * and different devices or use-cases may support different combinations. */ #define DRM_FORMAT_MOD_ARM_AFBC(__afbc_mode) fourcc_mod_code(ARM, __afbc_mode) /* * AFBC superblock size * * Indicates the superblock size(s) used for the AFBC buffer. The buffer * size (in pixels) must be aligned to a multiple of the superblock size. * Four lowest significant bits(LSBs) are reserved for block size. */ #define AFBC_FORMAT_MOD_BLOCK_SIZE_MASK 0xf #define AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 (1ULL) #define AFBC_FORMAT_MOD_BLOCK_SIZE_32x8 (2ULL) /* * AFBC lossless colorspace transform * * Indicates that the buffer makes use of the AFBC lossless colorspace * transform. */ #define AFBC_FORMAT_MOD_YTR (1ULL << 4) /* * AFBC block-split * * Indicates that the payload of each superblock is split. The second * half of the payload is positioned at a predefined offset from the start * of the superblock payload. */ #define AFBC_FORMAT_MOD_SPLIT (1ULL << 5) /* * AFBC sparse layout * * This flag indicates that the payload of each superblock must be stored at a * predefined position relative to the other superblocks in the same AFBC * buffer. This order is the same order used by the header buffer. In this mode * each superblock is given the same amount of space as an uncompressed * superblock of the particular format would require, rounding up to the next * multiple of 128 bytes in size. */ #define AFBC_FORMAT_MOD_SPARSE (1ULL << 6) /* * AFBC copy-block restrict * * Buffers with this flag must obey the copy-block restriction. The restriction * is such that there are no copy-blocks referring across the border of 8x8 * blocks. For the subsampled data the 8x8 limitation is also subsampled. */ #define AFBC_FORMAT_MOD_CBR (1ULL << 7) /* * AFBC tiled layout * * The tiled layout groups superblocks in 8x8 or 4x4 tiles, where all * superblocks inside a tile are stored together in memory. 8x8 tiles are used * for pixel formats up to and including 32 bpp while 4x4 tiles are used for * larger bpp formats. The order between the tiles is scan line. * When the tiled layout is used, the buffer size (in pixels) must be aligned * to the tile size. */ #define AFBC_FORMAT_MOD_TILED (1ULL << 8) /* * AFBC solid color blocks * * Indicates that the buffer makes use of solid-color blocks, whereby bandwidth * can be reduced if a whole superblock is a single color. */ #define AFBC_FORMAT_MOD_SC (1ULL << 9) #if defined(__cplusplus) } #endif #endif /* DRM_FOURCC_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������drm/tegra_drm.h�������������������������������������������������������������������������������������0000644�����������������00000035035�14763166027�0007465 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2012-2013, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _TEGRA_DRM_H_ #define _TEGRA_DRM_H_ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif #define DRM_TEGRA_GEM_CREATE_TILED (1 << 0) #define DRM_TEGRA_GEM_CREATE_BOTTOM_UP (1 << 1) /** * struct drm_tegra_gem_create - parameters for the GEM object creation IOCTL */ struct drm_tegra_gem_create { /** * @size: * * The size, in bytes, of the buffer object to be created. */ __u64 size; /** * @flags: * * A bitmask of flags that influence the creation of GEM objects: * * DRM_TEGRA_GEM_CREATE_TILED * Use the 16x16 tiling format for this buffer. * * DRM_TEGRA_GEM_CREATE_BOTTOM_UP * The buffer has a bottom-up layout. */ __u32 flags; /** * @handle: * * The handle of the created GEM object. Set by the kernel upon * successful completion of the IOCTL. */ __u32 handle; }; /** * struct drm_tegra_gem_mmap - parameters for the GEM mmap IOCTL */ struct drm_tegra_gem_mmap { /** * @handle: * * Handle of the GEM object to obtain an mmap offset for. */ __u32 handle; /** * @pad: * * Structure padding that may be used in the future. Must be 0. */ __u32 pad; /** * @offset: * * The mmap offset for the given GEM object. Set by the kernel upon * successful completion of the IOCTL. */ __u64 offset; }; /** * struct drm_tegra_syncpt_read - parameters for the read syncpoint IOCTL */ struct drm_tegra_syncpt_read { /** * @id: * * ID of the syncpoint to read the current value from. */ __u32 id; /** * @value: * * The current syncpoint value. Set by the kernel upon successful * completion of the IOCTL. */ __u32 value; }; /** * struct drm_tegra_syncpt_incr - parameters for the increment syncpoint IOCTL */ struct drm_tegra_syncpt_incr { /** * @id: * * ID of the syncpoint to increment. */ __u32 id; /** * @pad: * * Structure padding that may be used in the future. Must be 0. */ __u32 pad; }; /** * struct drm_tegra_syncpt_wait - parameters for the wait syncpoint IOCTL */ struct drm_tegra_syncpt_wait { /** * @id: * * ID of the syncpoint to wait on. */ __u32 id; /** * @thresh: * * Threshold value for which to wait. */ __u32 thresh; /** * @timeout: * * Timeout, in milliseconds, to wait. */ __u32 timeout; /** * @value: * * The new syncpoint value after the wait. Set by the kernel upon * successful completion of the IOCTL. */ __u32 value; }; #define DRM_TEGRA_NO_TIMEOUT (0xffffffff) /** * struct drm_tegra_open_channel - parameters for the open channel IOCTL */ struct drm_tegra_open_channel { /** * @client: * * The client ID for this channel. */ __u32 client; /** * @pad: * * Structure padding that may be used in the future. Must be 0. */ __u32 pad; /** * @context: * * The application context of this channel. Set by the kernel upon * successful completion of the IOCTL. This context needs to be passed * to the DRM_TEGRA_CHANNEL_CLOSE or the DRM_TEGRA_SUBMIT IOCTLs. */ __u64 context; }; /** * struct drm_tegra_close_channel - parameters for the close channel IOCTL */ struct drm_tegra_close_channel { /** * @context: * * The application context of this channel. This is obtained from the * DRM_TEGRA_OPEN_CHANNEL IOCTL. */ __u64 context; }; /** * struct drm_tegra_get_syncpt - parameters for the get syncpoint IOCTL */ struct drm_tegra_get_syncpt { /** * @context: * * The application context identifying the channel for which to obtain * the syncpoint ID. */ __u64 context; /** * @index: * * Index of the client syncpoint for which to obtain the ID. */ __u32 index; /** * @id: * * The ID of the given syncpoint. Set by the kernel upon successful * completion of the IOCTL. */ __u32 id; }; /** * struct drm_tegra_get_syncpt_base - parameters for the get wait base IOCTL */ struct drm_tegra_get_syncpt_base { /** * @context: * * The application context identifying for which channel to obtain the * wait base. */ __u64 context; /** * @syncpt: * * ID of the syncpoint for which to obtain the wait base. */ __u32 syncpt; /** * @id: * * The ID of the wait base corresponding to the client syncpoint. Set * by the kernel upon successful completion of the IOCTL. */ __u32 id; }; /** * struct drm_tegra_syncpt - syncpoint increment operation */ struct drm_tegra_syncpt { /** * @id: * * ID of the syncpoint to operate on. */ __u32 id; /** * @incrs: * * Number of increments to perform for the syncpoint. */ __u32 incrs; }; /** * struct drm_tegra_cmdbuf - structure describing a command buffer */ struct drm_tegra_cmdbuf { /** * @handle: * * Handle to a GEM object containing the command buffer. */ __u32 handle; /** * @offset: * * Offset, in bytes, into the GEM object identified by @handle at * which the command buffer starts. */ __u32 offset; /** * @words: * * Number of 32-bit words in this command buffer. */ __u32 words; /** * @pad: * * Structure padding that may be used in the future. Must be 0. */ __u32 pad; }; /** * struct drm_tegra_reloc - GEM object relocation structure */ struct drm_tegra_reloc { struct { /** * @cmdbuf.handle: * * Handle to the GEM object containing the command buffer for * which to perform this GEM object relocation. */ __u32 handle; /** * @cmdbuf.offset: * * Offset, in bytes, into the command buffer at which to * insert the relocated address. */ __u32 offset; } cmdbuf; struct { /** * @target.handle: * * Handle to the GEM object to be relocated. */ __u32 handle; /** * @target.offset: * * Offset, in bytes, into the target GEM object at which the * relocated data starts. */ __u32 offset; } target; /** * @shift: * * The number of bits by which to shift relocated addresses. */ __u32 shift; /** * @pad: * * Structure padding that may be used in the future. Must be 0. */ __u32 pad; }; /** * struct drm_tegra_waitchk - wait check structure */ struct drm_tegra_waitchk { /** * @handle: * * Handle to the GEM object containing a command stream on which to * perform the wait check. */ __u32 handle; /** * @offset: * * Offset, in bytes, of the location in the command stream to perform * the wait check on. */ __u32 offset; /** * @syncpt: * * ID of the syncpoint to wait check. */ __u32 syncpt; /** * @thresh: * * Threshold value for which to check. */ __u32 thresh; }; /** * struct drm_tegra_submit - job submission structure */ struct drm_tegra_submit { /** * @context: * * The application context identifying the channel to use for the * execution of this job. */ __u64 context; /** * @num_syncpts: * * The number of syncpoints operated on by this job. This defines the * length of the array pointed to by @syncpts. */ __u32 num_syncpts; /** * @num_cmdbufs: * * The number of command buffers to execute as part of this job. This * defines the length of the array pointed to by @cmdbufs. */ __u32 num_cmdbufs; /** * @num_relocs: * * The number of relocations to perform before executing this job. * This defines the length of the array pointed to by @relocs. */ __u32 num_relocs; /** * @num_waitchks: * * The number of wait checks to perform as part of this job. This * defines the length of the array pointed to by @waitchks. */ __u32 num_waitchks; /** * @waitchk_mask: * * Bitmask of valid wait checks. */ __u32 waitchk_mask; /** * @timeout: * * Timeout, in milliseconds, before this job is cancelled. */ __u32 timeout; /** * @syncpts: * * A pointer to an array of &struct drm_tegra_syncpt structures that * specify the syncpoint operations performed as part of this job. * The number of elements in the array must be equal to the value * given by @num_syncpts. */ __u64 syncpts; /** * @cmdbufs: * * A pointer to an array of &struct drm_tegra_cmdbuf structures that * define the command buffers to execute as part of this job. The * number of elements in the array must be equal to the value given * by @num_syncpts. */ __u64 cmdbufs; /** * @relocs: * * A pointer to an array of &struct drm_tegra_reloc structures that * specify the relocations that need to be performed before executing * this job. The number of elements in the array must be equal to the * value given by @num_relocs. */ __u64 relocs; /** * @waitchks: * * A pointer to an array of &struct drm_tegra_waitchk structures that * specify the wait checks to be performed while executing this job. * The number of elements in the array must be equal to the value * given by @num_waitchks. */ __u64 waitchks; /** * @fence: * * The threshold of the syncpoint associated with this job after it * has been completed. Set by the kernel upon successful completion of * the IOCTL. This can be used with the DRM_TEGRA_SYNCPT_WAIT IOCTL to * wait for this job to be finished. */ __u32 fence; /** * @reserved: * * This field is reserved for future use. Must be 0. */ __u32 reserved[5]; }; #define DRM_TEGRA_GEM_TILING_MODE_PITCH 0 #define DRM_TEGRA_GEM_TILING_MODE_TILED 1 #define DRM_TEGRA_GEM_TILING_MODE_BLOCK 2 /** * struct drm_tegra_gem_set_tiling - parameters for the set tiling IOCTL */ struct drm_tegra_gem_set_tiling { /** * @handle: * * Handle to the GEM object for which to set the tiling parameters. */ __u32 handle; /** * @mode: * * The tiling mode to set. Must be one of: * * DRM_TEGRA_GEM_TILING_MODE_PITCH * pitch linear format * * DRM_TEGRA_GEM_TILING_MODE_TILED * 16x16 tiling format * * DRM_TEGRA_GEM_TILING_MODE_BLOCK * 16Bx2 tiling format */ __u32 mode; /** * @value: * * The value to set for the tiling mode parameter. */ __u32 value; /** * @pad: * * Structure padding that may be used in the future. Must be 0. */ __u32 pad; }; /** * struct drm_tegra_gem_get_tiling - parameters for the get tiling IOCTL */ struct drm_tegra_gem_get_tiling { /** * @handle: * * Handle to the GEM object for which to query the tiling parameters. */ __u32 handle; /** * @mode: * * The tiling mode currently associated with the GEM object. Set by * the kernel upon successful completion of the IOCTL. */ __u32 mode; /** * @value: * * The tiling mode parameter currently associated with the GEM object. * Set by the kernel upon successful completion of the IOCTL. */ __u32 value; /** * @pad: * * Structure padding that may be used in the future. Must be 0. */ __u32 pad; }; #define DRM_TEGRA_GEM_BOTTOM_UP (1 << 0) #define DRM_TEGRA_GEM_FLAGS (DRM_TEGRA_GEM_BOTTOM_UP) /** * struct drm_tegra_gem_set_flags - parameters for the set flags IOCTL */ struct drm_tegra_gem_set_flags { /** * @handle: * * Handle to the GEM object for which to set the flags. */ __u32 handle; /** * @flags: * * The flags to set for the GEM object. */ __u32 flags; }; /** * struct drm_tegra_gem_get_flags - parameters for the get flags IOCTL */ struct drm_tegra_gem_get_flags { /** * @handle: * * Handle to the GEM object for which to query the flags. */ __u32 handle; /** * @flags: * * The flags currently associated with the GEM object. Set by the * kernel upon successful completion of the IOCTL. */ __u32 flags; }; #define DRM_TEGRA_GEM_CREATE 0x00 #define DRM_TEGRA_GEM_MMAP 0x01 #define DRM_TEGRA_SYNCPT_READ 0x02 #define DRM_TEGRA_SYNCPT_INCR 0x03 #define DRM_TEGRA_SYNCPT_WAIT 0x04 #define DRM_TEGRA_OPEN_CHANNEL 0x05 #define DRM_TEGRA_CLOSE_CHANNEL 0x06 #define DRM_TEGRA_GET_SYNCPT 0x07 #define DRM_TEGRA_SUBMIT 0x08 #define DRM_TEGRA_GET_SYNCPT_BASE 0x09 #define DRM_TEGRA_GEM_SET_TILING 0x0a #define DRM_TEGRA_GEM_GET_TILING 0x0b #define DRM_TEGRA_GEM_SET_FLAGS 0x0c #define DRM_TEGRA_GEM_GET_FLAGS 0x0d #define DRM_IOCTL_TEGRA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_CREATE, struct drm_tegra_gem_create) #define DRM_IOCTL_TEGRA_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_MMAP, struct drm_tegra_gem_mmap) #define DRM_IOCTL_TEGRA_SYNCPT_READ DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_READ, struct drm_tegra_syncpt_read) #define DRM_IOCTL_TEGRA_SYNCPT_INCR DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_INCR, struct drm_tegra_syncpt_incr) #define DRM_IOCTL_TEGRA_SYNCPT_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_WAIT, struct drm_tegra_syncpt_wait) #define DRM_IOCTL_TEGRA_OPEN_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_OPEN_CHANNEL, struct drm_tegra_open_channel) #define DRM_IOCTL_TEGRA_CLOSE_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_CLOSE_CHANNEL, struct drm_tegra_close_channel) #define DRM_IOCTL_TEGRA_GET_SYNCPT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT, struct drm_tegra_get_syncpt) #define DRM_IOCTL_TEGRA_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SUBMIT, struct drm_tegra_submit) #define DRM_IOCTL_TEGRA_GET_SYNCPT_BASE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT_BASE, struct drm_tegra_get_syncpt_base) #define DRM_IOCTL_TEGRA_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_TILING, struct drm_tegra_gem_set_tiling) #define DRM_IOCTL_TEGRA_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_TILING, struct drm_tegra_gem_get_tiling) #define DRM_IOCTL_TEGRA_GEM_SET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_FLAGS, struct drm_tegra_gem_set_flags) #define DRM_IOCTL_TEGRA_GEM_GET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_FLAGS, struct drm_tegra_gem_get_flags) #if defined(__cplusplus) } #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/mga_drm.h���������������������������������������������������������������������������������������0000644�����������������00000031322�14763166027�0007122 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* mga_drm.h -- Public header for the Matrox g200/g400 driver -*- linux-c -*- * Created: Tue Jan 25 01:50:01 1999 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Jeff Hartmann <jhartmann@valinux.com> * Keith Whitwell <keith@tungstengraphics.com> * * Rewritten by: * Gareth Hughes <gareth@valinux.com> */ #ifndef __MGA_DRM_H__ #define __MGA_DRM_H__ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* WARNING: If you change any of these defines, make sure to change the * defines in the Xserver file (mga_sarea.h) */ #ifndef __MGA_SAREA_DEFINES__ #define __MGA_SAREA_DEFINES__ /* WARP pipe flags */ #define MGA_F 0x1 /* fog */ #define MGA_A 0x2 /* alpha */ #define MGA_S 0x4 /* specular */ #define MGA_T2 0x8 /* multitexture */ #define MGA_WARP_TGZ 0 #define MGA_WARP_TGZF (MGA_F) #define MGA_WARP_TGZA (MGA_A) #define MGA_WARP_TGZAF (MGA_F|MGA_A) #define MGA_WARP_TGZS (MGA_S) #define MGA_WARP_TGZSF (MGA_S|MGA_F) #define MGA_WARP_TGZSA (MGA_S|MGA_A) #define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A) #define MGA_WARP_T2GZ (MGA_T2) #define MGA_WARP_T2GZF (MGA_T2|MGA_F) #define MGA_WARP_T2GZA (MGA_T2|MGA_A) #define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F) #define MGA_WARP_T2GZS (MGA_T2|MGA_S) #define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F) #define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A) #define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A) #define MGA_MAX_G200_PIPES 8 /* no multitex */ #define MGA_MAX_G400_PIPES 16 #define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES #define MGA_WARP_UCODE_SIZE 32768 /* in bytes */ #define MGA_CARD_TYPE_G200 1 #define MGA_CARD_TYPE_G400 2 #define MGA_CARD_TYPE_G450 3 /* not currently used */ #define MGA_CARD_TYPE_G550 4 #define MGA_FRONT 0x1 #define MGA_BACK 0x2 #define MGA_DEPTH 0x4 /* What needs to be changed for the current vertex dma buffer? */ #define MGA_UPLOAD_CONTEXT 0x1 #define MGA_UPLOAD_TEX0 0x2 #define MGA_UPLOAD_TEX1 0x4 #define MGA_UPLOAD_PIPE 0x8 #define MGA_UPLOAD_TEX0IMAGE 0x10 /* handled client-side */ #define MGA_UPLOAD_TEX1IMAGE 0x20 /* handled client-side */ #define MGA_UPLOAD_2D 0x40 #define MGA_WAIT_AGE 0x80 /* handled client-side */ #define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */ #if 0 #define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock quiescent */ #endif /* 32 buffers of 64k each, total 2 meg. */ #define MGA_BUFFER_SIZE (1 << 16) #define MGA_NUM_BUFFERS 128 /* Keep these small for testing. */ #define MGA_NR_SAREA_CLIPRECTS 8 /* 2 heaps (1 for card, 1 for agp), each divided into up to 128 * regions, subject to a minimum region size of (1<<16) == 64k. * * Clients may subdivide regions internally, but when sharing between * clients, the region size is the minimum granularity. */ #define MGA_CARD_HEAP 0 #define MGA_AGP_HEAP 1 #define MGA_NR_TEX_HEAPS 2 #define MGA_NR_TEX_REGIONS 16 #define MGA_LOG_MIN_TEX_REGION_SIZE 16 #define DRM_MGA_IDLE_RETRY 2048 #endif /* __MGA_SAREA_DEFINES__ */ /* Setup registers for 3D context */ typedef struct { unsigned int dstorg; unsigned int maccess; unsigned int plnwt; unsigned int dwgctl; unsigned int alphactrl; unsigned int fogcolor; unsigned int wflag; unsigned int tdualstage0; unsigned int tdualstage1; unsigned int fcol; unsigned int stencil; unsigned int stencilctl; } drm_mga_context_regs_t; /* Setup registers for 2D, X server */ typedef struct { unsigned int pitch; } drm_mga_server_regs_t; /* Setup registers for each texture unit */ typedef struct { unsigned int texctl; unsigned int texctl2; unsigned int texfilter; unsigned int texbordercol; unsigned int texorg; unsigned int texwidth; unsigned int texheight; unsigned int texorg1; unsigned int texorg2; unsigned int texorg3; unsigned int texorg4; } drm_mga_texture_regs_t; /* General aging mechanism */ typedef struct { unsigned int head; /* Position of head pointer */ unsigned int wrap; /* Primary DMA wrap count */ } drm_mga_age_t; typedef struct _drm_mga_sarea { /* The channel for communication of state information to the kernel * on firing a vertex dma buffer. */ drm_mga_context_regs_t context_state; drm_mga_server_regs_t server_state; drm_mga_texture_regs_t tex_state[2]; unsigned int warp_pipe; unsigned int dirty; unsigned int vertsize; /* The current cliprects, or a subset thereof. */ struct drm_clip_rect boxes[MGA_NR_SAREA_CLIPRECTS]; unsigned int nbox; /* Information about the most recently used 3d drawable. The * client fills in the req_* fields, the server fills in the * exported_ fields and puts the cliprects into boxes, above. * * The client clears the exported_drawable field before * clobbering the boxes data. */ unsigned int req_drawable; /* the X drawable id */ unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */ unsigned int exported_drawable; unsigned int exported_index; unsigned int exported_stamp; unsigned int exported_buffers; unsigned int exported_nfront; unsigned int exported_nback; int exported_back_x, exported_front_x, exported_w; int exported_back_y, exported_front_y, exported_h; struct drm_clip_rect exported_boxes[MGA_NR_SAREA_CLIPRECTS]; /* Counters for aging textures and for client-side throttling. */ unsigned int status[4]; unsigned int last_wrap; drm_mga_age_t last_frame; unsigned int last_enqueue; /* last time a buffer was enqueued */ unsigned int last_dispatch; /* age of the most recently dispatched buffer */ unsigned int last_quiescent; /* */ /* LRU lists for texture memory in agp space and on the card. */ struct drm_tex_region texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS + 1]; unsigned int texAge[MGA_NR_TEX_HEAPS]; /* Mechanism to validate card state. */ int ctxOwner; } drm_mga_sarea_t; /* MGA specific ioctls * The device specific ioctl range is 0x40 to 0x79. */ #define DRM_MGA_INIT 0x00 #define DRM_MGA_FLUSH 0x01 #define DRM_MGA_RESET 0x02 #define DRM_MGA_SWAP 0x03 #define DRM_MGA_CLEAR 0x04 #define DRM_MGA_VERTEX 0x05 #define DRM_MGA_INDICES 0x06 #define DRM_MGA_ILOAD 0x07 #define DRM_MGA_BLIT 0x08 #define DRM_MGA_GETPARAM 0x09 /* 3.2: * ioctls for operating on fences. */ #define DRM_MGA_SET_FENCE 0x0a #define DRM_MGA_WAIT_FENCE 0x0b #define DRM_MGA_DMA_BOOTSTRAP 0x0c #define DRM_IOCTL_MGA_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INIT, drm_mga_init_t) #define DRM_IOCTL_MGA_FLUSH DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_FLUSH, struct drm_lock) #define DRM_IOCTL_MGA_RESET DRM_IO( DRM_COMMAND_BASE + DRM_MGA_RESET) #define DRM_IOCTL_MGA_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_MGA_SWAP) #define DRM_IOCTL_MGA_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_CLEAR, drm_mga_clear_t) #define DRM_IOCTL_MGA_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_VERTEX, drm_mga_vertex_t) #define DRM_IOCTL_MGA_INDICES DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INDICES, drm_mga_indices_t) #define DRM_IOCTL_MGA_ILOAD DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_ILOAD, drm_mga_iload_t) #define DRM_IOCTL_MGA_BLIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_BLIT, drm_mga_blit_t) #define DRM_IOCTL_MGA_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_GETPARAM, drm_mga_getparam_t) #define DRM_IOCTL_MGA_SET_FENCE DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_SET_FENCE, __u32) #define DRM_IOCTL_MGA_WAIT_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_WAIT_FENCE, __u32) #define DRM_IOCTL_MGA_DMA_BOOTSTRAP DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_DMA_BOOTSTRAP, drm_mga_dma_bootstrap_t) typedef struct _drm_mga_warp_index { int installed; unsigned long phys_addr; int size; } drm_mga_warp_index_t; typedef struct drm_mga_init { enum { MGA_INIT_DMA = 0x01, MGA_CLEANUP_DMA = 0x02 } func; unsigned long sarea_priv_offset; int chipset; int sgram; unsigned int maccess; unsigned int fb_cpp; unsigned int front_offset, front_pitch; unsigned int back_offset, back_pitch; unsigned int depth_cpp; unsigned int depth_offset, depth_pitch; unsigned int texture_offset[MGA_NR_TEX_HEAPS]; unsigned int texture_size[MGA_NR_TEX_HEAPS]; unsigned long fb_offset; unsigned long mmio_offset; unsigned long status_offset; unsigned long warp_offset; unsigned long primary_offset; unsigned long buffers_offset; } drm_mga_init_t; typedef struct drm_mga_dma_bootstrap { /** * \name AGP texture region * * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, these fields will * be filled in with the actual AGP texture settings. * * \warning * If these fields are non-zero, but dma_mga_dma_bootstrap::agp_mode * is zero, it means that PCI memory (most likely through the use of * an IOMMU) is being used for "AGP" textures. */ /*@{ */ unsigned long texture_handle; /**< Handle used to map AGP textures. */ __u32 texture_size; /**< Size of the AGP texture region. */ /*@} */ /** * Requested size of the primary DMA region. * * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be * filled in with the actual AGP mode. If AGP was not available */ __u32 primary_size; /** * Requested number of secondary DMA buffers. * * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be * filled in with the actual number of secondary DMA buffers * allocated. Particularly when PCI DMA is used, this may be * (subtantially) less than the number requested. */ __u32 secondary_bin_count; /** * Requested size of each secondary DMA buffer. * * While the kernel \b is free to reduce * dma_mga_dma_bootstrap::secondary_bin_count, it is \b not allowed * to reduce dma_mga_dma_bootstrap::secondary_bin_size. */ __u32 secondary_bin_size; /** * Bit-wise mask of AGPSTAT2_* values. Currently only \c AGPSTAT2_1X, * \c AGPSTAT2_2X, and \c AGPSTAT2_4X are supported. If this value is * zero, it means that PCI DMA should be used, even if AGP is * possible. * * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be * filled in with the actual AGP mode. If AGP was not available * (i.e., PCI DMA was used), this value will be zero. */ __u32 agp_mode; /** * Desired AGP GART size, measured in megabytes. */ __u8 agp_size; } drm_mga_dma_bootstrap_t; typedef struct drm_mga_clear { unsigned int flags; unsigned int clear_color; unsigned int clear_depth; unsigned int color_mask; unsigned int depth_mask; } drm_mga_clear_t; typedef struct drm_mga_vertex { int idx; /* buffer to queue */ int used; /* bytes in use */ int discard; /* client finished with buffer? */ } drm_mga_vertex_t; typedef struct drm_mga_indices { int idx; /* buffer to queue */ unsigned int start; unsigned int end; int discard; /* client finished with buffer? */ } drm_mga_indices_t; typedef struct drm_mga_iload { int idx; unsigned int dstorg; unsigned int length; } drm_mga_iload_t; typedef struct _drm_mga_blit { unsigned int planemask; unsigned int srcorg; unsigned int dstorg; int src_pitch, dst_pitch; int delta_sx, delta_sy; int delta_dx, delta_dy; int height, ydir; /* flip image vertically */ int source_pitch, dest_pitch; } drm_mga_blit_t; /* 3.1: An ioctl to get parameters that aren't available to the 3d * client any other way. */ #define MGA_PARAM_IRQ_NR 1 /* 3.2: Query the actual card type. The DDX only distinguishes between * G200 chips and non-G200 chips, which it calls G400. It turns out that * there are some very sublte differences between the G4x0 chips and the G550 * chips. Using this parameter query, a client-side driver can detect the * difference between a G4x0 and a G550. */ #define MGA_PARAM_CARD_TYPE 2 typedef struct drm_mga_getparam { int param; void *value; } drm_mga_getparam_t; #if defined(__cplusplus) } #endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/savage_drm.h������������������������������������������������������������������������������������0000644�����������������00000016002�14763166027�0007622 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* savage_drm.h -- Public header for the savage driver * * Copyright 2004 Felix Kuehling * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sub license, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NON-INFRINGEMENT. IN NO EVENT SHALL FELIX KUEHLING BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef __SAVAGE_DRM_H__ #define __SAVAGE_DRM_H__ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif #ifndef __SAVAGE_SAREA_DEFINES__ #define __SAVAGE_SAREA_DEFINES__ /* 2 heaps (1 for card, 1 for agp), each divided into up to 128 * regions, subject to a minimum region size of (1<<16) == 64k. * * Clients may subdivide regions internally, but when sharing between * clients, the region size is the minimum granularity. */ #define SAVAGE_CARD_HEAP 0 #define SAVAGE_AGP_HEAP 1 #define SAVAGE_NR_TEX_HEAPS 2 #define SAVAGE_NR_TEX_REGIONS 16 #define SAVAGE_LOG_MIN_TEX_REGION_SIZE 16 #endif /* __SAVAGE_SAREA_DEFINES__ */ typedef struct _drm_savage_sarea { /* LRU lists for texture memory in agp space and on the card. */ struct drm_tex_region texList[SAVAGE_NR_TEX_HEAPS][SAVAGE_NR_TEX_REGIONS + 1]; unsigned int texAge[SAVAGE_NR_TEX_HEAPS]; /* Mechanism to validate card state. */ int ctxOwner; } drm_savage_sarea_t, *drm_savage_sarea_ptr; /* Savage-specific ioctls */ #define DRM_SAVAGE_BCI_INIT 0x00 #define DRM_SAVAGE_BCI_CMDBUF 0x01 #define DRM_SAVAGE_BCI_EVENT_EMIT 0x02 #define DRM_SAVAGE_BCI_EVENT_WAIT 0x03 #define DRM_IOCTL_SAVAGE_BCI_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_INIT, drm_savage_init_t) #define DRM_IOCTL_SAVAGE_BCI_CMDBUF DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_CMDBUF, drm_savage_cmdbuf_t) #define DRM_IOCTL_SAVAGE_BCI_EVENT_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_SAVAGE_BCI_EVENT_EMIT, drm_savage_event_emit_t) #define DRM_IOCTL_SAVAGE_BCI_EVENT_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_EVENT_WAIT, drm_savage_event_wait_t) #define SAVAGE_DMA_PCI 1 #define SAVAGE_DMA_AGP 3 typedef struct drm_savage_init { enum { SAVAGE_INIT_BCI = 1, SAVAGE_CLEANUP_BCI = 2 } func; unsigned int sarea_priv_offset; /* some parameters */ unsigned int cob_size; unsigned int bci_threshold_lo, bci_threshold_hi; unsigned int dma_type; /* frame buffer layout */ unsigned int fb_bpp; unsigned int front_offset, front_pitch; unsigned int back_offset, back_pitch; unsigned int depth_bpp; unsigned int depth_offset, depth_pitch; /* local textures */ unsigned int texture_offset; unsigned int texture_size; /* physical locations of non-permanent maps */ unsigned long status_offset; unsigned long buffers_offset; unsigned long agp_textures_offset; unsigned long cmd_dma_offset; } drm_savage_init_t; typedef union drm_savage_cmd_header drm_savage_cmd_header_t; typedef struct drm_savage_cmdbuf { /* command buffer in client's address space */ drm_savage_cmd_header_t *cmd_addr; unsigned int size; /* size of the command buffer in 64bit units */ unsigned int dma_idx; /* DMA buffer index to use */ int discard; /* discard DMA buffer when done */ /* vertex buffer in client's address space */ unsigned int *vb_addr; unsigned int vb_size; /* size of client vertex buffer in bytes */ unsigned int vb_stride; /* stride of vertices in 32bit words */ /* boxes in client's address space */ struct drm_clip_rect *box_addr; unsigned int nbox; /* number of clipping boxes */ } drm_savage_cmdbuf_t; #define SAVAGE_WAIT_2D 0x1 /* wait for 2D idle before updating event tag */ #define SAVAGE_WAIT_3D 0x2 /* wait for 3D idle before updating event tag */ #define SAVAGE_WAIT_IRQ 0x4 /* emit or wait for IRQ, not implemented yet */ typedef struct drm_savage_event { unsigned int count; unsigned int flags; } drm_savage_event_emit_t, drm_savage_event_wait_t; /* Commands for the cmdbuf ioctl */ #define SAVAGE_CMD_STATE 0 /* a range of state registers */ #define SAVAGE_CMD_DMA_PRIM 1 /* vertices from DMA buffer */ #define SAVAGE_CMD_VB_PRIM 2 /* vertices from client vertex buffer */ #define SAVAGE_CMD_DMA_IDX 3 /* indexed vertices from DMA buffer */ #define SAVAGE_CMD_VB_IDX 4 /* indexed vertices client vertex buffer */ #define SAVAGE_CMD_CLEAR 5 /* clear buffers */ #define SAVAGE_CMD_SWAP 6 /* swap buffers */ /* Primitive types */ #define SAVAGE_PRIM_TRILIST 0 /* triangle list */ #define SAVAGE_PRIM_TRISTRIP 1 /* triangle strip */ #define SAVAGE_PRIM_TRIFAN 2 /* triangle fan */ #define SAVAGE_PRIM_TRILIST_201 3 /* reorder verts for correct flat * shading on s3d */ /* Skip flags (vertex format) */ #define SAVAGE_SKIP_Z 0x01 #define SAVAGE_SKIP_W 0x02 #define SAVAGE_SKIP_C0 0x04 #define SAVAGE_SKIP_C1 0x08 #define SAVAGE_SKIP_S0 0x10 #define SAVAGE_SKIP_T0 0x20 #define SAVAGE_SKIP_ST0 0x30 #define SAVAGE_SKIP_S1 0x40 #define SAVAGE_SKIP_T1 0x80 #define SAVAGE_SKIP_ST1 0xc0 #define SAVAGE_SKIP_ALL_S3D 0x3f #define SAVAGE_SKIP_ALL_S4 0xff /* Buffer names for clear command */ #define SAVAGE_FRONT 0x1 #define SAVAGE_BACK 0x2 #define SAVAGE_DEPTH 0x4 /* 64-bit command header */ union drm_savage_cmd_header { struct { unsigned char cmd; /* command */ unsigned char pad0; unsigned short pad1; unsigned short pad2; unsigned short pad3; } cmd; /* generic */ struct { unsigned char cmd; unsigned char global; /* need idle engine? */ unsigned short count; /* number of consecutive registers */ unsigned short start; /* first register */ unsigned short pad3; } state; /* SAVAGE_CMD_STATE */ struct { unsigned char cmd; unsigned char prim; /* primitive type */ unsigned short skip; /* vertex format (skip flags) */ unsigned short count; /* number of vertices */ unsigned short start; /* first vertex in DMA/vertex buffer */ } prim; /* SAVAGE_CMD_DMA_PRIM, SAVAGE_CMD_VB_PRIM */ struct { unsigned char cmd; unsigned char prim; unsigned short skip; unsigned short count; /* number of indices that follow */ unsigned short pad3; } idx; /* SAVAGE_CMD_DMA_IDX, SAVAGE_CMD_VB_IDX */ struct { unsigned char cmd; unsigned char pad0; unsigned short pad1; unsigned int flags; } clear0; /* SAVAGE_CMD_CLEAR */ struct { unsigned int mask; unsigned int value; } clear1; /* SAVAGE_CMD_CLEAR data */ }; #if defined(__cplusplus) } #endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/qxl_drm.h���������������������������������������������������������������������������������������0000644�����������������00000010043�14763166027�0007157 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright 2013 Red Hat * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef QXL_DRM_H #define QXL_DRM_H #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* Please note that modifications to all structs defined here are * subject to backwards-compatibility constraints. * * Do not use pointers, use __u64 instead for 32 bit / 64 bit user/kernel * compatibility Keep fields aligned to their size */ #define QXL_GEM_DOMAIN_CPU 0 #define QXL_GEM_DOMAIN_VRAM 1 #define QXL_GEM_DOMAIN_SURFACE 2 #define DRM_QXL_ALLOC 0x00 #define DRM_QXL_MAP 0x01 #define DRM_QXL_EXECBUFFER 0x02 #define DRM_QXL_UPDATE_AREA 0x03 #define DRM_QXL_GETPARAM 0x04 #define DRM_QXL_CLIENTCAP 0x05 #define DRM_QXL_ALLOC_SURF 0x06 struct drm_qxl_alloc { __u32 size; __u32 handle; /* 0 is an invalid handle */ }; struct drm_qxl_map { __u64 offset; /* use for mmap system call */ __u32 handle; __u32 pad; }; /* * dest is the bo we are writing the relocation into * src is bo we are relocating. * *(dest_handle.base_addr + dest_offset) = physical_address(src_handle.addr + * src_offset) */ #define QXL_RELOC_TYPE_BO 1 #define QXL_RELOC_TYPE_SURF 2 struct drm_qxl_reloc { __u64 src_offset; /* offset into src_handle or src buffer */ __u64 dst_offset; /* offset in dest handle */ __u32 src_handle; /* dest handle to compute address from */ __u32 dst_handle; /* 0 if to command buffer */ __u32 reloc_type; __u32 pad; }; struct drm_qxl_command { __u64 command; /* void* */ __u64 relocs; /* struct drm_qxl_reloc* */ __u32 type; __u32 command_size; __u32 relocs_num; __u32 pad; }; struct drm_qxl_execbuffer { __u32 flags; /* for future use */ __u32 commands_num; __u64 commands; /* struct drm_qxl_command* */ }; struct drm_qxl_update_area { __u32 handle; __u32 top; __u32 left; __u32 bottom; __u32 right; __u32 pad; }; #define QXL_PARAM_NUM_SURFACES 1 /* rom->n_surfaces */ #define QXL_PARAM_MAX_RELOCS 2 struct drm_qxl_getparam { __u64 param; __u64 value; }; /* these are one bit values */ struct drm_qxl_clientcap { __u32 index; __u32 pad; }; struct drm_qxl_alloc_surf { __u32 format; __u32 width; __u32 height; __s32 stride; __u32 handle; __u32 pad; }; #define DRM_IOCTL_QXL_ALLOC \ DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_ALLOC, struct drm_qxl_alloc) #define DRM_IOCTL_QXL_MAP \ DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_MAP, struct drm_qxl_map) #define DRM_IOCTL_QXL_EXECBUFFER \ DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_EXECBUFFER,\ struct drm_qxl_execbuffer) #define DRM_IOCTL_QXL_UPDATE_AREA \ DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_UPDATE_AREA,\ struct drm_qxl_update_area) #define DRM_IOCTL_QXL_GETPARAM \ DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_GETPARAM,\ struct drm_qxl_getparam) #define DRM_IOCTL_QXL_CLIENTCAP \ DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_CLIENTCAP,\ struct drm_qxl_clientcap) #define DRM_IOCTL_QXL_ALLOC_SURF \ DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_ALLOC_SURF,\ struct drm_qxl_alloc_surf) #if defined(__cplusplus) } #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������drm/i915_drm.h��������������������������������������������������������������������������������������0000644�����������������00000155361�14763166027�0007057 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #ifndef _I915_DRM_H_ #define _I915_DRM_H_ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* Please note that modifications to all structs defined here are * subject to backwards-compatibility constraints. */ /** * DOC: uevents generated by i915 on it's device node * * I915_L3_PARITY_UEVENT - Generated when the driver receives a parity mismatch * event from the gpu l3 cache. Additional information supplied is ROW, * BANK, SUBBANK, SLICE of the affected cacheline. Userspace should keep * track of these events and if a specific cache-line seems to have a * persistent error remap it with the l3 remapping tool supplied in * intel-gpu-tools. The value supplied with the event is always 1. * * I915_ERROR_UEVENT - Generated upon error detection, currently only via * hangcheck. The error detection event is a good indicator of when things * began to go badly. The value supplied with the event is a 1 upon error * detection, and a 0 upon reset completion, signifying no more error * exists. NOTE: Disabling hangcheck or reset via module parameter will * cause the related events to not be seen. * * I915_RESET_UEVENT - Event is generated just before an attempt to reset the * the GPU. The value supplied with the event is always 1. NOTE: Disable * reset via module parameter will cause this event to not be seen. */ #define I915_L3_PARITY_UEVENT "L3_PARITY_ERROR" #define I915_ERROR_UEVENT "ERROR" #define I915_RESET_UEVENT "RESET" /* * MOCS indexes used for GPU surfaces, defining the cacheability of the * surface data and the coherency for this data wrt. CPU vs. GPU accesses. */ enum i915_mocs_table_index { /* * Not cached anywhere, coherency between CPU and GPU accesses is * guaranteed. */ I915_MOCS_UNCACHED, /* * Cacheability and coherency controlled by the kernel automatically * based on the DRM_I915_GEM_SET_CACHING IOCTL setting and the current * usage of the surface (used for display scanout or not). */ I915_MOCS_PTE, /* * Cached in all GPU caches available on the platform. * Coherency between CPU and GPU accesses to the surface is not * guaranteed without extra synchronization. */ I915_MOCS_CACHED, }; /* * Different engines serve different roles, and there may be more than one * engine serving each role. enum drm_i915_gem_engine_class provides a * classification of the role of the engine, which may be used when requesting * operations to be performed on a certain subset of engines, or for providing * information about that group. */ enum drm_i915_gem_engine_class { I915_ENGINE_CLASS_RENDER = 0, I915_ENGINE_CLASS_COPY = 1, I915_ENGINE_CLASS_VIDEO = 2, I915_ENGINE_CLASS_VIDEO_ENHANCE = 3, I915_ENGINE_CLASS_INVALID = -1 }; /** * DOC: perf_events exposed by i915 through /sys/bus/event_sources/drivers/i915 * */ enum drm_i915_pmu_engine_sample { I915_SAMPLE_BUSY = 0, I915_SAMPLE_WAIT = 1, I915_SAMPLE_SEMA = 2 }; #define I915_PMU_SAMPLE_BITS (4) #define I915_PMU_SAMPLE_MASK (0xf) #define I915_PMU_SAMPLE_INSTANCE_BITS (8) #define I915_PMU_CLASS_SHIFT \ (I915_PMU_SAMPLE_BITS + I915_PMU_SAMPLE_INSTANCE_BITS) #define __I915_PMU_ENGINE(class, instance, sample) \ ((class) << I915_PMU_CLASS_SHIFT | \ (instance) << I915_PMU_SAMPLE_BITS | \ (sample)) #define I915_PMU_ENGINE_BUSY(class, instance) \ __I915_PMU_ENGINE(class, instance, I915_SAMPLE_BUSY) #define I915_PMU_ENGINE_WAIT(class, instance) \ __I915_PMU_ENGINE(class, instance, I915_SAMPLE_WAIT) #define I915_PMU_ENGINE_SEMA(class, instance) \ __I915_PMU_ENGINE(class, instance, I915_SAMPLE_SEMA) #define __I915_PMU_OTHER(x) (__I915_PMU_ENGINE(0xff, 0xff, 0xf) + 1 + (x)) #define I915_PMU_ACTUAL_FREQUENCY __I915_PMU_OTHER(0) #define I915_PMU_REQUESTED_FREQUENCY __I915_PMU_OTHER(1) #define I915_PMU_INTERRUPTS __I915_PMU_OTHER(2) #define I915_PMU_RC6_RESIDENCY __I915_PMU_OTHER(3) #define I915_PMU_LAST I915_PMU_RC6_RESIDENCY /* Each region is a minimum of 16k, and there are at most 255 of them. */ #define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use * of chars for next/prev indices */ #define I915_LOG_MIN_TEX_REGION_SIZE 14 typedef struct _drm_i915_init { enum { I915_INIT_DMA = 0x01, I915_CLEANUP_DMA = 0x02, I915_RESUME_DMA = 0x03 } func; unsigned int mmio_offset; int sarea_priv_offset; unsigned int ring_start; unsigned int ring_end; unsigned int ring_size; unsigned int front_offset; unsigned int back_offset; unsigned int depth_offset; unsigned int w; unsigned int h; unsigned int pitch; unsigned int pitch_bits; unsigned int back_pitch; unsigned int depth_pitch; unsigned int cpp; unsigned int chipset; } drm_i915_init_t; typedef struct _drm_i915_sarea { struct drm_tex_region texList[I915_NR_TEX_REGIONS + 1]; int last_upload; /* last time texture was uploaded */ int last_enqueue; /* last time a buffer was enqueued */ int last_dispatch; /* age of the most recently dispatched buffer */ int ctxOwner; /* last context to upload state */ int texAge; int pf_enabled; /* is pageflipping allowed? */ int pf_active; int pf_current_page; /* which buffer is being displayed? */ int perf_boxes; /* performance boxes to be displayed */ int width, height; /* screen size in pixels */ drm_handle_t front_handle; int front_offset; int front_size; drm_handle_t back_handle; int back_offset; int back_size; drm_handle_t depth_handle; int depth_offset; int depth_size; drm_handle_t tex_handle; int tex_offset; int tex_size; int log_tex_granularity; int pitch; int rotation; /* 0, 90, 180 or 270 */ int rotated_offset; int rotated_size; int rotated_pitch; int virtualX, virtualY; unsigned int front_tiled; unsigned int back_tiled; unsigned int depth_tiled; unsigned int rotated_tiled; unsigned int rotated2_tiled; int pipeA_x; int pipeA_y; int pipeA_w; int pipeA_h; int pipeB_x; int pipeB_y; int pipeB_w; int pipeB_h; /* fill out some space for old userspace triple buffer */ drm_handle_t unused_handle; __u32 unused1, unused2, unused3; /* buffer object handles for static buffers. May change * over the lifetime of the client. */ __u32 front_bo_handle; __u32 back_bo_handle; __u32 unused_bo_handle; __u32 depth_bo_handle; } drm_i915_sarea_t; /* due to userspace building against these headers we need some compat here */ #define planeA_x pipeA_x #define planeA_y pipeA_y #define planeA_w pipeA_w #define planeA_h pipeA_h #define planeB_x pipeB_x #define planeB_y pipeB_y #define planeB_w pipeB_w #define planeB_h pipeB_h /* Flags for perf_boxes */ #define I915_BOX_RING_EMPTY 0x1 #define I915_BOX_FLIP 0x2 #define I915_BOX_WAIT 0x4 #define I915_BOX_TEXTURE_LOAD 0x8 #define I915_BOX_LOST_CONTEXT 0x10 /* * i915 specific ioctls. * * The device specific ioctl range is [DRM_COMMAND_BASE, DRM_COMMAND_END) ie * [0x40, 0xa0) (a0 is excluded). The numbers below are defined as offset * against DRM_COMMAND_BASE and should be between [0x0, 0x60). */ #define DRM_I915_INIT 0x00 #define DRM_I915_FLUSH 0x01 #define DRM_I915_FLIP 0x02 #define DRM_I915_BATCHBUFFER 0x03 #define DRM_I915_IRQ_EMIT 0x04 #define DRM_I915_IRQ_WAIT 0x05 #define DRM_I915_GETPARAM 0x06 #define DRM_I915_SETPARAM 0x07 #define DRM_I915_ALLOC 0x08 #define DRM_I915_FREE 0x09 #define DRM_I915_INIT_HEAP 0x0a #define DRM_I915_CMDBUFFER 0x0b #define DRM_I915_DESTROY_HEAP 0x0c #define DRM_I915_SET_VBLANK_PIPE 0x0d #define DRM_I915_GET_VBLANK_PIPE 0x0e #define DRM_I915_VBLANK_SWAP 0x0f #define DRM_I915_HWS_ADDR 0x11 #define DRM_I915_GEM_INIT 0x13 #define DRM_I915_GEM_EXECBUFFER 0x14 #define DRM_I915_GEM_PIN 0x15 #define DRM_I915_GEM_UNPIN 0x16 #define DRM_I915_GEM_BUSY 0x17 #define DRM_I915_GEM_THROTTLE 0x18 #define DRM_I915_GEM_ENTERVT 0x19 #define DRM_I915_GEM_LEAVEVT 0x1a #define DRM_I915_GEM_CREATE 0x1b #define DRM_I915_GEM_PREAD 0x1c #define DRM_I915_GEM_PWRITE 0x1d #define DRM_I915_GEM_MMAP 0x1e #define DRM_I915_GEM_SET_DOMAIN 0x1f #define DRM_I915_GEM_SW_FINISH 0x20 #define DRM_I915_GEM_SET_TILING 0x21 #define DRM_I915_GEM_GET_TILING 0x22 #define DRM_I915_GEM_GET_APERTURE 0x23 #define DRM_I915_GEM_MMAP_GTT 0x24 #define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25 #define DRM_I915_GEM_MADVISE 0x26 #define DRM_I915_OVERLAY_PUT_IMAGE 0x27 #define DRM_I915_OVERLAY_ATTRS 0x28 #define DRM_I915_GEM_EXECBUFFER2 0x29 #define DRM_I915_GEM_EXECBUFFER2_WR DRM_I915_GEM_EXECBUFFER2 #define DRM_I915_GET_SPRITE_COLORKEY 0x2a #define DRM_I915_SET_SPRITE_COLORKEY 0x2b #define DRM_I915_GEM_WAIT 0x2c #define DRM_I915_GEM_CONTEXT_CREATE 0x2d #define DRM_I915_GEM_CONTEXT_DESTROY 0x2e #define DRM_I915_GEM_SET_CACHING 0x2f #define DRM_I915_GEM_GET_CACHING 0x30 #define DRM_I915_REG_READ 0x31 #define DRM_I915_GET_RESET_STATS 0x32 #define DRM_I915_GEM_USERPTR 0x33 #define DRM_I915_GEM_CONTEXT_GETPARAM 0x34 #define DRM_I915_GEM_CONTEXT_SETPARAM 0x35 #define DRM_I915_PERF_OPEN 0x36 #define DRM_I915_PERF_ADD_CONFIG 0x37 #define DRM_I915_PERF_REMOVE_CONFIG 0x38 #define DRM_I915_QUERY 0x39 #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) #define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP) #define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t) #define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t) #define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t) #define DRM_IOCTL_I915_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t) #define DRM_IOCTL_I915_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t) #define DRM_IOCTL_I915_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t) #define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t) #define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t) #define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t) #define DRM_IOCTL_I915_DESTROY_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t) #define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t) #define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) #define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) #define DRM_IOCTL_I915_HWS_ADDR DRM_IOW(DRM_COMMAND_BASE + DRM_I915_HWS_ADDR, struct drm_i915_gem_init) #define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init) #define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer) #define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2) #define DRM_IOCTL_I915_GEM_EXECBUFFER2_WR DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2_WR, struct drm_i915_gem_execbuffer2) #define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin) #define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin) #define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy) #define DRM_IOCTL_I915_GEM_SET_CACHING DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_SET_CACHING, struct drm_i915_gem_caching) #define DRM_IOCTL_I915_GEM_GET_CACHING DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_GET_CACHING, struct drm_i915_gem_caching) #define DRM_IOCTL_I915_GEM_THROTTLE DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE) #define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT) #define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT) #define DRM_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create) #define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread) #define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite) #define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap) #define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt) #define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain) #define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish) #define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling) #define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling) #define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture) #define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_i915_get_pipe_from_crtc_id) #define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise) #define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image) #define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs) #define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) #define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) #define DRM_IOCTL_I915_GEM_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait) #define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create) #define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy) #define DRM_IOCTL_I915_REG_READ DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read) #define DRM_IOCTL_I915_GET_RESET_STATS DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats) #define DRM_IOCTL_I915_GEM_USERPTR DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_USERPTR, struct drm_i915_gem_userptr) #define DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_GETPARAM, struct drm_i915_gem_context_param) #define DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_SETPARAM, struct drm_i915_gem_context_param) #define DRM_IOCTL_I915_PERF_OPEN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_OPEN, struct drm_i915_perf_open_param) #define DRM_IOCTL_I915_PERF_ADD_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_ADD_CONFIG, struct drm_i915_perf_oa_config) #define DRM_IOCTL_I915_PERF_REMOVE_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_REMOVE_CONFIG, __u64) #define DRM_IOCTL_I915_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_QUERY, struct drm_i915_query) /* Allow drivers to submit batchbuffers directly to hardware, relying * on the security mechanisms provided by hardware. */ typedef struct drm_i915_batchbuffer { int start; /* agp offset */ int used; /* nr bytes in use */ int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ int num_cliprects; /* mulitpass with multiple cliprects? */ struct drm_clip_rect *cliprects; /* pointer to userspace cliprects */ } drm_i915_batchbuffer_t; /* As above, but pass a pointer to userspace buffer which can be * validated by the kernel prior to sending to hardware. */ typedef struct _drm_i915_cmdbuffer { char *buf; /* pointer to userspace command buffer */ int sz; /* nr bytes in buf */ int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ int num_cliprects; /* mulitpass with multiple cliprects? */ struct drm_clip_rect *cliprects; /* pointer to userspace cliprects */ } drm_i915_cmdbuffer_t; /* Userspace can request & wait on irq's: */ typedef struct drm_i915_irq_emit { int *irq_seq; } drm_i915_irq_emit_t; typedef struct drm_i915_irq_wait { int irq_seq; } drm_i915_irq_wait_t; /* Ioctl to query kernel params: */ #define I915_PARAM_IRQ_ACTIVE 1 #define I915_PARAM_ALLOW_BATCHBUFFER 2 #define I915_PARAM_LAST_DISPATCH 3 #define I915_PARAM_CHIPSET_ID 4 #define I915_PARAM_HAS_GEM 5 #define I915_PARAM_NUM_FENCES_AVAIL 6 #define I915_PARAM_HAS_OVERLAY 7 #define I915_PARAM_HAS_PAGEFLIPPING 8 #define I915_PARAM_HAS_EXECBUF2 9 #define I915_PARAM_HAS_BSD 10 #define I915_PARAM_HAS_BLT 11 #define I915_PARAM_HAS_RELAXED_FENCING 12 #define I915_PARAM_HAS_COHERENT_RINGS 13 #define I915_PARAM_HAS_EXEC_CONSTANTS 14 #define I915_PARAM_HAS_RELAXED_DELTA 15 #define I915_PARAM_HAS_GEN7_SOL_RESET 16 #define I915_PARAM_HAS_LLC 17 #define I915_PARAM_HAS_ALIASING_PPGTT 18 #define I915_PARAM_HAS_WAIT_TIMEOUT 19 #define I915_PARAM_HAS_SEMAPHORES 20 #define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21 #define I915_PARAM_HAS_VEBOX 22 #define I915_PARAM_HAS_SECURE_BATCHES 23 #define I915_PARAM_HAS_PINNED_BATCHES 24 #define I915_PARAM_HAS_EXEC_NO_RELOC 25 #define I915_PARAM_HAS_EXEC_HANDLE_LUT 26 #define I915_PARAM_HAS_WT 27 #define I915_PARAM_CMD_PARSER_VERSION 28 #define I915_PARAM_HAS_COHERENT_PHYS_GTT 29 #define I915_PARAM_MMAP_VERSION 30 #define I915_PARAM_HAS_BSD2 31 #define I915_PARAM_REVISION 32 #define I915_PARAM_SUBSLICE_TOTAL 33 #define I915_PARAM_EU_TOTAL 34 #define I915_PARAM_HAS_GPU_RESET 35 #define I915_PARAM_HAS_RESOURCE_STREAMER 36 #define I915_PARAM_HAS_EXEC_SOFTPIN 37 #define I915_PARAM_HAS_POOLED_EU 38 #define I915_PARAM_MIN_EU_IN_POOL 39 #define I915_PARAM_MMAP_GTT_VERSION 40 /* * Query whether DRM_I915_GEM_EXECBUFFER2 supports user defined execution * priorities and the driver will attempt to execute batches in priority order. * The param returns a capability bitmask, nonzero implies that the scheduler * is enabled, with different features present according to the mask. * * The initial priority for each batch is supplied by the context and is * controlled via I915_CONTEXT_PARAM_PRIORITY. */ #define I915_PARAM_HAS_SCHEDULER 41 #define I915_SCHEDULER_CAP_ENABLED (1ul << 0) #define I915_SCHEDULER_CAP_PRIORITY (1ul << 1) #define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2) #define I915_PARAM_HUC_STATUS 42 /* Query whether DRM_I915_GEM_EXECBUFFER2 supports the ability to opt-out of * synchronisation with implicit fencing on individual objects. * See EXEC_OBJECT_ASYNC. */ #define I915_PARAM_HAS_EXEC_ASYNC 43 /* Query whether DRM_I915_GEM_EXECBUFFER2 supports explicit fence support - * both being able to pass in a sync_file fd to wait upon before executing, * and being able to return a new sync_file fd that is signaled when the * current request is complete. See I915_EXEC_FENCE_IN and I915_EXEC_FENCE_OUT. */ #define I915_PARAM_HAS_EXEC_FENCE 44 /* Query whether DRM_I915_GEM_EXECBUFFER2 supports the ability to capture * user specified bufffers for post-mortem debugging of GPU hangs. See * EXEC_OBJECT_CAPTURE. */ #define I915_PARAM_HAS_EXEC_CAPTURE 45 #define I915_PARAM_SLICE_MASK 46 /* Assuming it's uniform for each slice, this queries the mask of subslices * per-slice for this system. */ #define I915_PARAM_SUBSLICE_MASK 47 /* * Query whether DRM_I915_GEM_EXECBUFFER2 supports supplying the batch buffer * as the first execobject as opposed to the last. See I915_EXEC_BATCH_FIRST. */ #define I915_PARAM_HAS_EXEC_BATCH_FIRST 48 /* Query whether DRM_I915_GEM_EXECBUFFER2 supports supplying an array of * drm_i915_gem_exec_fence structures. See I915_EXEC_FENCE_ARRAY. */ #define I915_PARAM_HAS_EXEC_FENCE_ARRAY 49 /* * Query whether every context (both per-file default and user created) is * isolated (insofar as HW supports). If this parameter is not true, then * freshly created contexts may inherit values from an existing context, * rather than default HW values. If true, it also ensures (insofar as HW * supports) that all state set by this context will not leak to any other * context. * * As not every engine across every gen support contexts, the returned * value reports the support of context isolation for individual engines by * returning a bitmask of each engine class set to true if that class supports * isolation. */ #define I915_PARAM_HAS_CONTEXT_ISOLATION 50 /* Frequency of the command streamer timestamps given by the *_TIMESTAMP * registers. This used to be fixed per platform but from CNL onwards, this * might vary depending on the parts. */ #define I915_PARAM_CS_TIMESTAMP_FREQUENCY 51 typedef struct drm_i915_getparam { __s32 param; /* * WARNING: Using pointers instead of fixed-size u64 means we need to write * compat32 code. Don't repeat this mistake. */ int *value; } drm_i915_getparam_t; /* Ioctl to set kernel params: */ #define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1 #define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2 #define I915_SETPARAM_ALLOW_BATCHBUFFER 3 #define I915_SETPARAM_NUM_USED_FENCES 4 typedef struct drm_i915_setparam { int param; int value; } drm_i915_setparam_t; /* A memory manager for regions of shared memory: */ #define I915_MEM_REGION_AGP 1 typedef struct drm_i915_mem_alloc { int region; int alignment; int size; int *region_offset; /* offset from start of fb or agp */ } drm_i915_mem_alloc_t; typedef struct drm_i915_mem_free { int region; int region_offset; } drm_i915_mem_free_t; typedef struct drm_i915_mem_init_heap { int region; int size; int start; } drm_i915_mem_init_heap_t; /* Allow memory manager to be torn down and re-initialized (eg on * rotate): */ typedef struct drm_i915_mem_destroy_heap { int region; } drm_i915_mem_destroy_heap_t; /* Allow X server to configure which pipes to monitor for vblank signals */ #define DRM_I915_VBLANK_PIPE_A 1 #define DRM_I915_VBLANK_PIPE_B 2 typedef struct drm_i915_vblank_pipe { int pipe; } drm_i915_vblank_pipe_t; /* Schedule buffer swap at given vertical blank: */ typedef struct drm_i915_vblank_swap { drm_drawable_t drawable; enum drm_vblank_seq_type seqtype; unsigned int sequence; } drm_i915_vblank_swap_t; typedef struct drm_i915_hws_addr { __u64 addr; } drm_i915_hws_addr_t; struct drm_i915_gem_init { /** * Beginning offset in the GTT to be managed by the DRM memory * manager. */ __u64 gtt_start; /** * Ending offset in the GTT to be managed by the DRM memory * manager. */ __u64 gtt_end; }; struct drm_i915_gem_create { /** * Requested size for the object. * * The (page-aligned) allocated size for the object will be returned. */ __u64 size; /** * Returned handle for the object. * * Object handles are nonzero. */ __u32 handle; __u32 pad; }; struct drm_i915_gem_pread { /** Handle for the object being read. */ __u32 handle; __u32 pad; /** Offset into the object to read from */ __u64 offset; /** Length of data to read */ __u64 size; /** * Pointer to write the data into. * * This is a fixed-size type for 32/64 compatibility. */ __u64 data_ptr; }; struct drm_i915_gem_pwrite { /** Handle for the object being written to. */ __u32 handle; __u32 pad; /** Offset into the object to write to */ __u64 offset; /** Length of data to write */ __u64 size; /** * Pointer to read the data from. * * This is a fixed-size type for 32/64 compatibility. */ __u64 data_ptr; }; struct drm_i915_gem_mmap { /** Handle for the object being mapped. */ __u32 handle; __u32 pad; /** Offset in the object to map. */ __u64 offset; /** * Length of data to map. * * The value will be page-aligned. */ __u64 size; /** * Returned pointer the data was mapped at. * * This is a fixed-size type for 32/64 compatibility. */ __u64 addr_ptr; /** * Flags for extended behaviour. * * Added in version 2. */ __u64 flags; #define I915_MMAP_WC 0x1 }; struct drm_i915_gem_mmap_gtt { /** Handle for the object being mapped. */ __u32 handle; __u32 pad; /** * Fake offset to use for subsequent mmap call * * This is a fixed-size type for 32/64 compatibility. */ __u64 offset; }; struct drm_i915_gem_set_domain { /** Handle for the object */ __u32 handle; /** New read domains */ __u32 read_domains; /** New write domain */ __u32 write_domain; }; struct drm_i915_gem_sw_finish { /** Handle for the object */ __u32 handle; }; struct drm_i915_gem_relocation_entry { /** * Handle of the buffer being pointed to by this relocation entry. * * It's appealing to make this be an index into the mm_validate_entry * list to refer to the buffer, but this allows the driver to create * a relocation list for state buffers and not re-write it per * exec using the buffer. */ __u32 target_handle; /** * Value to be added to the offset of the target buffer to make up * the relocation entry. */ __u32 delta; /** Offset in the buffer the relocation entry will be written into */ __u64 offset; /** * Offset value of the target buffer that the relocation entry was last * written as. * * If the buffer has the same offset as last time, we can skip syncing * and writing the relocation. This value is written back out by * the execbuffer ioctl when the relocation is written. */ __u64 presumed_offset; /** * Target memory domains read by this operation. */ __u32 read_domains; /** * Target memory domains written by this operation. * * Note that only one domain may be written by the whole * execbuffer operation, so that where there are conflicts, * the application will get -EINVAL back. */ __u32 write_domain; }; /** @{ * Intel memory domains * * Most of these just align with the various caches in * the system and are used to flush and invalidate as * objects end up cached in different domains. */ /** CPU cache */ #define I915_GEM_DOMAIN_CPU 0x00000001 /** Render cache, used by 2D and 3D drawing */ #define I915_GEM_DOMAIN_RENDER 0x00000002 /** Sampler cache, used by texture engine */ #define I915_GEM_DOMAIN_SAMPLER 0x00000004 /** Command queue, used to load batch buffers */ #define I915_GEM_DOMAIN_COMMAND 0x00000008 /** Instruction cache, used by shader programs */ #define I915_GEM_DOMAIN_INSTRUCTION 0x00000010 /** Vertex address cache */ #define I915_GEM_DOMAIN_VERTEX 0x00000020 /** GTT domain - aperture and scanout */ #define I915_GEM_DOMAIN_GTT 0x00000040 /** WC domain - uncached access */ #define I915_GEM_DOMAIN_WC 0x00000080 /** @} */ struct drm_i915_gem_exec_object { /** * User's handle for a buffer to be bound into the GTT for this * operation. */ __u32 handle; /** Number of relocations to be performed on this buffer */ __u32 relocation_count; /** * Pointer to array of struct drm_i915_gem_relocation_entry containing * the relocations to be performed in this buffer. */ __u64 relocs_ptr; /** Required alignment in graphics aperture */ __u64 alignment; /** * Returned value of the updated offset of the object, for future * presumed_offset writes. */ __u64 offset; }; struct drm_i915_gem_execbuffer { /** * List of buffers to be validated with their relocations to be * performend on them. * * This is a pointer to an array of struct drm_i915_gem_validate_entry. * * These buffers must be listed in an order such that all relocations * a buffer is performing refer to buffers that have already appeared * in the validate list. */ __u64 buffers_ptr; __u32 buffer_count; /** Offset in the batchbuffer to start execution from. */ __u32 batch_start_offset; /** Bytes used in batchbuffer from batch_start_offset */ __u32 batch_len; __u32 DR1; __u32 DR4; __u32 num_cliprects; /** This is a struct drm_clip_rect *cliprects */ __u64 cliprects_ptr; }; struct drm_i915_gem_exec_object2 { /** * User's handle for a buffer to be bound into the GTT for this * operation. */ __u32 handle; /** Number of relocations to be performed on this buffer */ __u32 relocation_count; /** * Pointer to array of struct drm_i915_gem_relocation_entry containing * the relocations to be performed in this buffer. */ __u64 relocs_ptr; /** Required alignment in graphics aperture */ __u64 alignment; /** * When the EXEC_OBJECT_PINNED flag is specified this is populated by * the user with the GTT offset at which this object will be pinned. * When the I915_EXEC_NO_RELOC flag is specified this must contain the * presumed_offset of the object. * During execbuffer2 the kernel populates it with the value of the * current GTT offset of the object, for future presumed_offset writes. */ __u64 offset; #define EXEC_OBJECT_NEEDS_FENCE (1<<0) #define EXEC_OBJECT_NEEDS_GTT (1<<1) #define EXEC_OBJECT_WRITE (1<<2) #define EXEC_OBJECT_SUPPORTS_48B_ADDRESS (1<<3) #define EXEC_OBJECT_PINNED (1<<4) #define EXEC_OBJECT_PAD_TO_SIZE (1<<5) /* The kernel implicitly tracks GPU activity on all GEM objects, and * synchronises operations with outstanding rendering. This includes * rendering on other devices if exported via dma-buf. However, sometimes * this tracking is too coarse and the user knows better. For example, * if the object is split into non-overlapping ranges shared between different * clients or engines (i.e. suballocating objects), the implicit tracking * by kernel assumes that each operation affects the whole object rather * than an individual range, causing needless synchronisation between clients. * The kernel will also forgo any CPU cache flushes prior to rendering from * the object as the client is expected to be also handling such domain * tracking. * * The kernel maintains the implicit tracking in order to manage resources * used by the GPU - this flag only disables the synchronisation prior to * rendering with this object in this execbuf. * * Opting out of implicit synhronisation requires the user to do its own * explicit tracking to avoid rendering corruption. See, for example, * I915_PARAM_HAS_EXEC_FENCE to order execbufs and execute them asynchronously. */ #define EXEC_OBJECT_ASYNC (1<<6) /* Request that the contents of this execobject be copied into the error * state upon a GPU hang involving this batch for post-mortem debugging. * These buffers are recorded in no particular order as "user" in * /sys/class/drm/cardN/error. Query I915_PARAM_HAS_EXEC_CAPTURE to see * if the kernel supports this flag. */ #define EXEC_OBJECT_CAPTURE (1<<7) /* All remaining bits are MBZ and RESERVED FOR FUTURE USE */ #define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_CAPTURE<<1) __u64 flags; union { __u64 rsvd1; __u64 pad_to_size; }; __u64 rsvd2; }; struct drm_i915_gem_exec_fence { /** * User's handle for a drm_syncobj to wait on or signal. */ __u32 handle; #define I915_EXEC_FENCE_WAIT (1<<0) #define I915_EXEC_FENCE_SIGNAL (1<<1) #define __I915_EXEC_FENCE_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SIGNAL << 1)) __u32 flags; }; struct drm_i915_gem_execbuffer2 { /** * List of gem_exec_object2 structs */ __u64 buffers_ptr; __u32 buffer_count; /** Offset in the batchbuffer to start execution from. */ __u32 batch_start_offset; /** Bytes used in batchbuffer from batch_start_offset */ __u32 batch_len; __u32 DR1; __u32 DR4; __u32 num_cliprects; /** * This is a struct drm_clip_rect *cliprects if I915_EXEC_FENCE_ARRAY * is not set. If I915_EXEC_FENCE_ARRAY is set, then this is a * struct drm_i915_gem_exec_fence *fences. */ __u64 cliprects_ptr; #define I915_EXEC_RING_MASK (0x3f) #define I915_EXEC_DEFAULT (0<<0) #define I915_EXEC_RENDER (1<<0) #define I915_EXEC_BSD (2<<0) #define I915_EXEC_BLT (3<<0) #define I915_EXEC_VEBOX (4<<0) /* Used for switching the constants addressing mode on gen4+ RENDER ring. * Gen6+ only supports relative addressing to dynamic state (default) and * absolute addressing. * * These flags are ignored for the BSD and BLT rings. */ #define I915_EXEC_CONSTANTS_MASK (3<<6) #define I915_EXEC_CONSTANTS_REL_GENERAL (0<<6) /* default */ #define I915_EXEC_CONSTANTS_ABSOLUTE (1<<6) #define I915_EXEC_CONSTANTS_REL_SURFACE (2<<6) /* gen4/5 only */ __u64 flags; __u64 rsvd1; /* now used for context info */ __u64 rsvd2; }; /** Resets the SO write offset registers for transform feedback on gen7. */ #define I915_EXEC_GEN7_SOL_RESET (1<<8) /** Request a privileged ("secure") batch buffer. Note only available for * DRM_ROOT_ONLY | DRM_MASTER processes. */ #define I915_EXEC_SECURE (1<<9) /** Inform the kernel that the batch is and will always be pinned. This * negates the requirement for a workaround to be performed to avoid * an incoherent CS (such as can be found on 830/845). If this flag is * not passed, the kernel will endeavour to make sure the batch is * coherent with the CS before execution. If this flag is passed, * userspace assumes the responsibility for ensuring the same. */ #define I915_EXEC_IS_PINNED (1<<10) /** Provide a hint to the kernel that the command stream and auxiliary * state buffers already holds the correct presumed addresses and so the * relocation process may be skipped if no buffers need to be moved in * preparation for the execbuffer. */ #define I915_EXEC_NO_RELOC (1<<11) /** Use the reloc.handle as an index into the exec object array rather * than as the per-file handle. */ #define I915_EXEC_HANDLE_LUT (1<<12) /** Used for switching BSD rings on the platforms with two BSD rings */ #define I915_EXEC_BSD_SHIFT (13) #define I915_EXEC_BSD_MASK (3 << I915_EXEC_BSD_SHIFT) /* default ping-pong mode */ #define I915_EXEC_BSD_DEFAULT (0 << I915_EXEC_BSD_SHIFT) #define I915_EXEC_BSD_RING1 (1 << I915_EXEC_BSD_SHIFT) #define I915_EXEC_BSD_RING2 (2 << I915_EXEC_BSD_SHIFT) /** Tell the kernel that the batchbuffer is processed by * the resource streamer. */ #define I915_EXEC_RESOURCE_STREAMER (1<<15) /* Setting I915_EXEC_FENCE_IN implies that lower_32_bits(rsvd2) represent * a sync_file fd to wait upon (in a nonblocking manner) prior to executing * the batch. * * Returns -EINVAL if the sync_file fd cannot be found. */ #define I915_EXEC_FENCE_IN (1<<16) /* Setting I915_EXEC_FENCE_OUT causes the ioctl to return a sync_file fd * in the upper_32_bits(rsvd2) upon success. Ownership of the fd is given * to the caller, and it should be close() after use. (The fd is a regular * file descriptor and will be cleaned up on process termination. It holds * a reference to the request, but nothing else.) * * The sync_file fd can be combined with other sync_file and passed either * to execbuf using I915_EXEC_FENCE_IN, to atomic KMS ioctls (so that a flip * will only occur after this request completes), or to other devices. * * Using I915_EXEC_FENCE_OUT requires use of * DRM_IOCTL_I915_GEM_EXECBUFFER2_WR ioctl so that the result is written * back to userspace. Failure to do so will cause the out-fence to always * be reported as zero, and the real fence fd to be leaked. */ #define I915_EXEC_FENCE_OUT (1<<17) /* * Traditionally the execbuf ioctl has only considered the final element in * the execobject[] to be the executable batch. Often though, the client * will known the batch object prior to construction and being able to place * it into the execobject[] array first can simplify the relocation tracking. * Setting I915_EXEC_BATCH_FIRST tells execbuf to use element 0 of the * execobject[] as the * batch instead (the default is to use the last * element). */ #define I915_EXEC_BATCH_FIRST (1<<18) /* Setting I915_FENCE_ARRAY implies that num_cliprects and cliprects_ptr * define an array of i915_gem_exec_fence structures which specify a set of * dma fences to wait upon or signal. */ #define I915_EXEC_FENCE_ARRAY (1<<19) #define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_ARRAY<<1)) #define I915_EXEC_CONTEXT_ID_MASK (0xffffffff) #define i915_execbuffer2_set_context_id(eb2, context) \ (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK #define i915_execbuffer2_get_context_id(eb2) \ ((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK) struct drm_i915_gem_pin { /** Handle of the buffer to be pinned. */ __u32 handle; __u32 pad; /** alignment required within the aperture */ __u64 alignment; /** Returned GTT offset of the buffer. */ __u64 offset; }; struct drm_i915_gem_unpin { /** Handle of the buffer to be unpinned. */ __u32 handle; __u32 pad; }; struct drm_i915_gem_busy { /** Handle of the buffer to check for busy */ __u32 handle; /** Return busy status * * A return of 0 implies that the object is idle (after * having flushed any pending activity), and a non-zero return that * the object is still in-flight on the GPU. (The GPU has not yet * signaled completion for all pending requests that reference the * object.) An object is guaranteed to become idle eventually (so * long as no new GPU commands are executed upon it). Due to the * asynchronous nature of the hardware, an object reported * as busy may become idle before the ioctl is completed. * * Furthermore, if the object is busy, which engine is busy is only * provided as a guide. There are race conditions which prevent the * report of which engines are busy from being always accurate. * However, the converse is not true. If the object is idle, the * result of the ioctl, that all engines are idle, is accurate. * * The returned dword is split into two fields to indicate both * the engines on which the object is being read, and the * engine on which it is currently being written (if any). * * The low word (bits 0:15) indicate if the object is being written * to by any engine (there can only be one, as the GEM implicit * synchronisation rules force writes to be serialised). Only the * engine for the last write is reported. * * The high word (bits 16:31) are a bitmask of which engines are * currently reading from the object. Multiple engines may be * reading from the object simultaneously. * * The value of each engine is the same as specified in the * EXECBUFFER2 ioctl, i.e. I915_EXEC_RENDER, I915_EXEC_BSD etc. * Note I915_EXEC_DEFAULT is a symbolic value and is mapped to * the I915_EXEC_RENDER engine for execution, and so it is never * reported as active itself. Some hardware may have parallel * execution engines, e.g. multiple media engines, which are * mapped to the same identifier in the EXECBUFFER2 ioctl and * so are not separately reported for busyness. * * Caveat emptor: * Only the boolean result of this query is reliable; that is whether * the object is idle or busy. The report of which engines are busy * should be only used as a heuristic. */ __u32 busy; }; /** * I915_CACHING_NONE * * GPU access is not coherent with cpu caches. Default for machines without an * LLC. */ #define I915_CACHING_NONE 0 /** * I915_CACHING_CACHED * * GPU access is coherent with cpu caches and furthermore the data is cached in * last-level caches shared between cpu cores and the gpu GT. Default on * machines with HAS_LLC. */ #define I915_CACHING_CACHED 1 /** * I915_CACHING_DISPLAY * * Special GPU caching mode which is coherent with the scanout engines. * Transparently falls back to I915_CACHING_NONE on platforms where no special * cache mode (like write-through or gfdt flushing) is available. The kernel * automatically sets this mode when using a buffer as a scanout target. * Userspace can manually set this mode to avoid a costly stall and clflush in * the hotpath of drawing the first frame. */ #define I915_CACHING_DISPLAY 2 struct drm_i915_gem_caching { /** * Handle of the buffer to set/get the caching level of. */ __u32 handle; /** * Cacheing level to apply or return value * * bits0-15 are for generic caching control (i.e. the above defined * values). bits16-31 are reserved for platform-specific variations * (e.g. l3$ caching on gen7). */ __u32 caching; }; #define I915_TILING_NONE 0 #define I915_TILING_X 1 #define I915_TILING_Y 2 #define I915_TILING_LAST I915_TILING_Y #define I915_BIT_6_SWIZZLE_NONE 0 #define I915_BIT_6_SWIZZLE_9 1 #define I915_BIT_6_SWIZZLE_9_10 2 #define I915_BIT_6_SWIZZLE_9_11 3 #define I915_BIT_6_SWIZZLE_9_10_11 4 /* Not seen by userland */ #define I915_BIT_6_SWIZZLE_UNKNOWN 5 /* Seen by userland. */ #define I915_BIT_6_SWIZZLE_9_17 6 #define I915_BIT_6_SWIZZLE_9_10_17 7 struct drm_i915_gem_set_tiling { /** Handle of the buffer to have its tiling state updated */ __u32 handle; /** * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X, * I915_TILING_Y). * * This value is to be set on request, and will be updated by the * kernel on successful return with the actual chosen tiling layout. * * The tiling mode may be demoted to I915_TILING_NONE when the system * has bit 6 swizzling that can't be managed correctly by GEM. * * Buffer contents become undefined when changing tiling_mode. */ __u32 tiling_mode; /** * Stride in bytes for the object when in I915_TILING_X or * I915_TILING_Y. */ __u32 stride; /** * Returned address bit 6 swizzling required for CPU access through * mmap mapping. */ __u32 swizzle_mode; }; struct drm_i915_gem_get_tiling { /** Handle of the buffer to get tiling state for. */ __u32 handle; /** * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X, * I915_TILING_Y). */ __u32 tiling_mode; /** * Returned address bit 6 swizzling required for CPU access through * mmap mapping. */ __u32 swizzle_mode; /** * Returned address bit 6 swizzling required for CPU access through * mmap mapping whilst bound. */ __u32 phys_swizzle_mode; }; struct drm_i915_gem_get_aperture { /** Total size of the aperture used by i915_gem_execbuffer, in bytes */ __u64 aper_size; /** * Available space in the aperture used by i915_gem_execbuffer, in * bytes */ __u64 aper_available_size; }; struct drm_i915_get_pipe_from_crtc_id { /** ID of CRTC being requested **/ __u32 crtc_id; /** pipe of requested CRTC **/ __u32 pipe; }; #define I915_MADV_WILLNEED 0 #define I915_MADV_DONTNEED 1 #define __I915_MADV_PURGED 2 /* internal state */ struct drm_i915_gem_madvise { /** Handle of the buffer to change the backing store advice */ __u32 handle; /* Advice: either the buffer will be needed again in the near future, * or wont be and could be discarded under memory pressure. */ __u32 madv; /** Whether the backing store still exists. */ __u32 retained; }; /* flags */ #define I915_OVERLAY_TYPE_MASK 0xff #define I915_OVERLAY_YUV_PLANAR 0x01 #define I915_OVERLAY_YUV_PACKED 0x02 #define I915_OVERLAY_RGB 0x03 #define I915_OVERLAY_DEPTH_MASK 0xff00 #define I915_OVERLAY_RGB24 0x1000 #define I915_OVERLAY_RGB16 0x2000 #define I915_OVERLAY_RGB15 0x3000 #define I915_OVERLAY_YUV422 0x0100 #define I915_OVERLAY_YUV411 0x0200 #define I915_OVERLAY_YUV420 0x0300 #define I915_OVERLAY_YUV410 0x0400 #define I915_OVERLAY_SWAP_MASK 0xff0000 #define I915_OVERLAY_NO_SWAP 0x000000 #define I915_OVERLAY_UV_SWAP 0x010000 #define I915_OVERLAY_Y_SWAP 0x020000 #define I915_OVERLAY_Y_AND_UV_SWAP 0x030000 #define I915_OVERLAY_FLAGS_MASK 0xff000000 #define I915_OVERLAY_ENABLE 0x01000000 struct drm_intel_overlay_put_image { /* various flags and src format description */ __u32 flags; /* source picture description */ __u32 bo_handle; /* stride values and offsets are in bytes, buffer relative */ __u16 stride_Y; /* stride for packed formats */ __u16 stride_UV; __u32 offset_Y; /* offset for packet formats */ __u32 offset_U; __u32 offset_V; /* in pixels */ __u16 src_width; __u16 src_height; /* to compensate the scaling factors for partially covered surfaces */ __u16 src_scan_width; __u16 src_scan_height; /* output crtc description */ __u32 crtc_id; __u16 dst_x; __u16 dst_y; __u16 dst_width; __u16 dst_height; }; /* flags */ #define I915_OVERLAY_UPDATE_ATTRS (1<<0) #define I915_OVERLAY_UPDATE_GAMMA (1<<1) #define I915_OVERLAY_DISABLE_DEST_COLORKEY (1<<2) struct drm_intel_overlay_attrs { __u32 flags; __u32 color_key; __s32 brightness; __u32 contrast; __u32 saturation; __u32 gamma0; __u32 gamma1; __u32 gamma2; __u32 gamma3; __u32 gamma4; __u32 gamma5; }; /* * Intel sprite handling * * Color keying works with a min/mask/max tuple. Both source and destination * color keying is allowed. * * Source keying: * Sprite pixels within the min & max values, masked against the color channels * specified in the mask field, will be transparent. All other pixels will * be displayed on top of the primary plane. For RGB surfaces, only the min * and mask fields will be used; ranged compares are not allowed. * * Destination keying: * Primary plane pixels that match the min value, masked against the color * channels specified in the mask field, will be replaced by corresponding * pixels from the sprite plane. * * Note that source & destination keying are exclusive; only one can be * active on a given plane. */ #define I915_SET_COLORKEY_NONE (1<<0) /* Deprecated. Instead set * flags==0 to disable colorkeying. */ #define I915_SET_COLORKEY_DESTINATION (1<<1) #define I915_SET_COLORKEY_SOURCE (1<<2) struct drm_intel_sprite_colorkey { __u32 plane_id; __u32 min_value; __u32 channel_mask; __u32 max_value; __u32 flags; }; struct drm_i915_gem_wait { /** Handle of BO we shall wait on */ __u32 bo_handle; __u32 flags; /** Number of nanoseconds to wait, Returns time remaining. */ __s64 timeout_ns; }; struct drm_i915_gem_context_create { /* output: id of new context*/ __u32 ctx_id; __u32 pad; }; struct drm_i915_gem_context_destroy { __u32 ctx_id; __u32 pad; }; struct drm_i915_reg_read { /* * Register offset. * For 64bit wide registers where the upper 32bits don't immediately * follow the lower 32bits, the offset of the lower 32bits must * be specified */ __u64 offset; #define I915_REG_READ_8B_WA (1ul << 0) __u64 val; /* Return value */ }; /* Known registers: * * Render engine timestamp - 0x2358 + 64bit - gen7+ * - Note this register returns an invalid value if using the default * single instruction 8byte read, in order to workaround that pass * flag I915_REG_READ_8B_WA in offset field. * */ struct drm_i915_reset_stats { __u32 ctx_id; __u32 flags; /* All resets since boot/module reload, for all contexts */ __u32 reset_count; /* Number of batches lost when active in GPU, for this context */ __u32 batch_active; /* Number of batches lost pending for execution, for this context */ __u32 batch_pending; __u32 pad; }; struct drm_i915_gem_userptr { __u64 user_ptr; __u64 user_size; __u32 flags; #define I915_USERPTR_READ_ONLY 0x1 #define I915_USERPTR_UNSYNCHRONIZED 0x80000000 /** * Returned handle for the object. * * Object handles are nonzero. */ __u32 handle; }; struct drm_i915_gem_context_param { __u32 ctx_id; __u32 size; __u64 param; #define I915_CONTEXT_PARAM_BAN_PERIOD 0x1 #define I915_CONTEXT_PARAM_NO_ZEROMAP 0x2 #define I915_CONTEXT_PARAM_GTT_SIZE 0x3 #define I915_CONTEXT_PARAM_NO_ERROR_CAPTURE 0x4 #define I915_CONTEXT_PARAM_BANNABLE 0x5 #define I915_CONTEXT_PARAM_PRIORITY 0x6 #define I915_CONTEXT_MAX_USER_PRIORITY 1023 /* inclusive */ #define I915_CONTEXT_DEFAULT_PRIORITY 0 #define I915_CONTEXT_MIN_USER_PRIORITY -1023 /* inclusive */ __u64 value; }; enum drm_i915_oa_format { I915_OA_FORMAT_A13 = 1, /* HSW only */ I915_OA_FORMAT_A29, /* HSW only */ I915_OA_FORMAT_A13_B8_C8, /* HSW only */ I915_OA_FORMAT_B4_C8, /* HSW only */ I915_OA_FORMAT_A45_B8_C8, /* HSW only */ I915_OA_FORMAT_B4_C8_A16, /* HSW only */ I915_OA_FORMAT_C4_B8, /* HSW+ */ /* Gen8+ */ I915_OA_FORMAT_A12, I915_OA_FORMAT_A12_B8_C8, I915_OA_FORMAT_A32u40_A4u32_B8_C8, I915_OA_FORMAT_MAX /* non-ABI */ }; enum drm_i915_perf_property_id { /** * Open the stream for a specific context handle (as used with * execbuffer2). A stream opened for a specific context this way * won't typically require root privileges. */ DRM_I915_PERF_PROP_CTX_HANDLE = 1, /** * A value of 1 requests the inclusion of raw OA unit reports as * part of stream samples. */ DRM_I915_PERF_PROP_SAMPLE_OA, /** * The value specifies which set of OA unit metrics should be * be configured, defining the contents of any OA unit reports. */ DRM_I915_PERF_PROP_OA_METRICS_SET, /** * The value specifies the size and layout of OA unit reports. */ DRM_I915_PERF_PROP_OA_FORMAT, /** * Specifying this property implicitly requests periodic OA unit * sampling and (at least on Haswell) the sampling frequency is derived * from this exponent as follows: * * 80ns * 2^(period_exponent + 1) */ DRM_I915_PERF_PROP_OA_EXPONENT, DRM_I915_PERF_PROP_MAX /* non-ABI */ }; struct drm_i915_perf_open_param { __u32 flags; #define I915_PERF_FLAG_FD_CLOEXEC (1<<0) #define I915_PERF_FLAG_FD_NONBLOCK (1<<1) #define I915_PERF_FLAG_DISABLED (1<<2) /** The number of u64 (id, value) pairs */ __u32 num_properties; /** * Pointer to array of u64 (id, value) pairs configuring the stream * to open. */ __u64 properties_ptr; }; /** * Enable data capture for a stream that was either opened in a disabled state * via I915_PERF_FLAG_DISABLED or was later disabled via * I915_PERF_IOCTL_DISABLE. * * It is intended to be cheaper to disable and enable a stream than it may be * to close and re-open a stream with the same configuration. * * It's undefined whether any pending data for the stream will be lost. */ #define I915_PERF_IOCTL_ENABLE _IO('i', 0x0) /** * Disable data capture for a stream. * * It is an error to try and read a stream that is disabled. */ #define I915_PERF_IOCTL_DISABLE _IO('i', 0x1) /** * Common to all i915 perf records */ struct drm_i915_perf_record_header { __u32 type; __u16 pad; __u16 size; }; enum drm_i915_perf_record_type { /** * Samples are the work horse record type whose contents are extensible * and defined when opening an i915 perf stream based on the given * properties. * * Boolean properties following the naming convention * DRM_I915_PERF_SAMPLE_xyz_PROP request the inclusion of 'xyz' data in * every sample. * * The order of these sample properties given by userspace has no * affect on the ordering of data within a sample. The order is * documented here. * * struct { * struct drm_i915_perf_record_header header; * * { u32 oa_report[]; } && DRM_I915_PERF_PROP_SAMPLE_OA * }; */ DRM_I915_PERF_RECORD_SAMPLE = 1, /* * Indicates that one or more OA reports were not written by the * hardware. This can happen for example if an MI_REPORT_PERF_COUNT * command collides with periodic sampling - which would be more likely * at higher sampling frequencies. */ DRM_I915_PERF_RECORD_OA_REPORT_LOST = 2, /** * An error occurred that resulted in all pending OA reports being lost. */ DRM_I915_PERF_RECORD_OA_BUFFER_LOST = 3, DRM_I915_PERF_RECORD_MAX /* non-ABI */ }; /** * Structure to upload perf dynamic configuration into the kernel. */ struct drm_i915_perf_oa_config { /** String formatted like "%08x-%04x-%04x-%04x-%012x" */ char uuid[36]; __u32 n_mux_regs; __u32 n_boolean_regs; __u32 n_flex_regs; /* * These fields are pointers to tuples of u32 values (register address, * value). For example the expected length of the buffer pointed by * mux_regs_ptr is (2 * sizeof(u32) * n_mux_regs). */ __u64 mux_regs_ptr; __u64 boolean_regs_ptr; __u64 flex_regs_ptr; }; struct drm_i915_query_item { __u64 query_id; #define DRM_I915_QUERY_TOPOLOGY_INFO 1 /* * When set to zero by userspace, this is filled with the size of the * data to be written at the data_ptr pointer. The kernel sets this * value to a negative value to signal an error on a particular query * item. */ __s32 length; /* * Unused for now. Must be cleared to zero. */ __u32 flags; /* * Data will be written at the location pointed by data_ptr when the * value of length matches the length of the data to be written by the * kernel. */ __u64 data_ptr; }; struct drm_i915_query { __u32 num_items; /* * Unused for now. Must be cleared to zero. */ __u32 flags; /* * This points to an array of num_items drm_i915_query_item structures. */ __u64 items_ptr; }; /* * Data written by the kernel with query DRM_I915_QUERY_TOPOLOGY_INFO : * * data: contains the 3 pieces of information : * * - the slice mask with one bit per slice telling whether a slice is * available. The availability of slice X can be queried with the following * formula : * * (data[X / 8] >> (X % 8)) & 1 * * - the subslice mask for each slice with one bit per subslice telling * whether a subslice is available. The availability of subslice Y in slice * X can be queried with the following formula : * * (data[subslice_offset + * X * subslice_stride + * Y / 8] >> (Y % 8)) & 1 * * - the EU mask for each subslice in each slice with one bit per EU telling * whether an EU is available. The availability of EU Z in subslice Y in * slice X can be queried with the following formula : * * (data[eu_offset + * (X * max_subslices + Y) * eu_stride + * Z / 8] >> (Z % 8)) & 1 */ struct drm_i915_query_topology_info { /* * Unused for now. Must be cleared to zero. */ __u16 flags; __u16 max_slices; __u16 max_subslices; __u16 max_eus_per_subslice; /* * Offset in data[] at which the subslice masks are stored. */ __u16 subslice_offset; /* * Stride at which each of the subslice masks for each slice are * stored. */ __u16 subslice_stride; /* * Offset in data[] at which the EU masks are stored. */ __u16 eu_offset; /* * Stride at which each of the EU masks for each subslice are stored. */ __u16 eu_stride; __u8 data[]; }; #if defined(__cplusplus) } #endif #endif /* _I915_DRM_H_ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������entities.h������������������������������������������������������������������������������������������0000644�����������������00000011101�14763166027�0006547 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Generated file - do not edit directly. * * This file was generated from: * http://www.w3.org/TR/REC-html40/sgml/entities.html * by means of the script: * entities.tcl */ #ifdef __cplusplus extern "C" { #endif static struct entities_s { char *name; int value; } entities[] = { {"AElig", 198}, {"Aacute", 193}, {"Acirc", 194}, {"Agrave", 192}, {"Alpha", 913}, {"Aring", 197}, {"Atilde", 195}, {"Auml", 196}, {"Beta", 914}, {"Ccedil", 199}, {"Chi", 935}, {"Dagger", 8225}, {"Delta", 916}, {"ETH", 208}, {"Eacute", 201}, {"Ecirc", 202}, {"Egrave", 200}, {"Epsilon", 917}, {"Eta", 919}, {"Euml", 203}, {"Gamma", 915}, {"Iacute", 205}, {"Icirc", 206}, {"Igrave", 204}, {"Iota", 921}, {"Iuml", 207}, {"Kappa", 922}, {"Lambda", 923}, {"Mu", 924}, {"Ntilde", 209}, {"Nu", 925}, {"OElig", 338}, {"Oacute", 211}, {"Ocirc", 212}, {"Ograve", 210}, {"Omega", 937}, {"Omicron", 927}, {"Oslash", 216}, {"Otilde", 213}, {"Ouml", 214}, {"Phi", 934}, {"Pi", 928}, {"Prime", 8243}, {"Psi", 936}, {"Rho", 929}, {"Scaron", 352}, {"Sigma", 931}, {"THORN", 222}, {"Tau", 932}, {"Theta", 920}, {"Uacute", 218}, {"Ucirc", 219}, {"Ugrave", 217}, {"Upsilon", 933}, {"Uuml", 220}, {"Xi", 926}, {"Yacute", 221}, {"Yuml", 376}, {"Zeta", 918}, {"aacute", 225}, {"acirc", 226}, {"acute", 180}, {"aelig", 230}, {"agrave", 224}, {"alefsym", 8501}, {"alpha", 945}, {"amp", 38}, {"and", 8743}, {"ang", 8736}, {"aring", 229}, {"asymp", 8776}, {"atilde", 227}, {"auml", 228}, {"bdquo", 8222}, {"beta", 946}, {"brvbar", 166}, {"bull", 8226}, {"cap", 8745}, {"ccedil", 231}, {"cedil", 184}, {"cent", 162}, {"chi", 967}, {"circ", 710}, {"clubs", 9827}, {"cong", 8773}, {"copy", 169}, {"crarr", 8629}, {"cup", 8746}, {"curren", 164}, {"dArr", 8659}, {"dagger", 8224}, {"darr", 8595}, {"deg", 176}, {"delta", 948}, {"diams", 9830}, {"divide", 247}, {"eacute", 233}, {"ecirc", 234}, {"egrave", 232}, {"empty", 8709}, {"emsp", 8195}, {"ensp", 8194}, {"epsilon", 949}, {"equiv", 8801}, {"eta", 951}, {"eth", 240}, {"euml", 235}, {"euro", 8364}, {"exist", 8707}, {"fnof", 402}, {"forall", 8704}, {"frac12", 189}, {"frac14", 188}, {"frac34", 190}, {"frasl", 8260}, {"gamma", 947}, {"ge", 8805}, {"gt", 62}, {"hArr", 8660}, {"harr", 8596}, {"hearts", 9829}, {"hellip", 8230}, {"iacute", 237}, {"icirc", 238}, {"iexcl", 161}, {"igrave", 236}, {"image", 8465}, {"infin", 8734}, {"int", 8747}, {"iota", 953}, {"iquest", 191}, {"isin", 8712}, {"iuml", 239}, {"kappa", 954}, {"lArr", 8656}, {"lambda", 955}, {"lang", 9001}, {"laquo", 171}, {"larr", 8592}, {"lceil", 8968}, {"ldquo", 8220}, {"le", 8804}, {"lfloor", 8970}, {"lowast", 8727}, {"loz", 9674}, {"lrm", 8206}, {"lsaquo", 8249}, {"lsquo", 8216}, {"lt", 60}, {"macr", 175}, {"mdash", 8212}, {"micro", 181}, {"middot", 183}, {"minus", 8722}, {"mu", 956}, {"nabla", 8711}, {"nbsp", 160}, {"ndash", 8211}, {"ne", 8800}, {"ni", 8715}, {"not", 172}, {"notin", 8713}, {"nsub", 8836}, {"ntilde", 241}, {"nu", 957}, {"oacute", 243}, {"ocirc", 244}, {"oelig", 339}, {"ograve", 242}, {"oline", 8254}, {"omega", 969}, {"omicron", 959}, {"oplus", 8853}, {"or", 8744}, {"ordf", 170}, {"ordm", 186}, {"oslash", 248}, {"otilde", 245}, {"otimes", 8855}, {"ouml", 246}, {"para", 182}, {"part", 8706}, {"permil", 8240}, {"perp", 8869}, {"phi", 966}, {"pi", 960}, {"piv", 982}, {"plusmn", 177}, {"pound", 163}, {"prime", 8242}, {"prod", 8719}, {"prop", 8733}, {"psi", 968}, {"quot", 34}, {"rArr", 8658}, {"radic", 8730}, {"rang", 9002}, {"raquo", 187}, {"rarr", 8594}, {"rceil", 8969}, {"rdquo", 8221}, {"real", 8476}, {"reg", 174}, {"rfloor", 8971}, {"rho", 961}, {"rlm", 8207}, {"rsaquo", 8250}, {"rsquo", 8217}, {"sbquo", 8218}, {"scaron", 353}, {"sdot", 8901}, {"sect", 167}, {"shy", 173}, {"sigma", 963}, {"sigmaf", 962}, {"sim", 8764}, {"spades", 9824}, {"sub", 8834}, {"sube", 8838}, {"sum", 8721}, {"sup", 8835}, {"sup1", 185}, {"sup2", 178}, {"sup3", 179}, {"supe", 8839}, {"szlig", 223}, {"tau", 964}, {"there4", 8756}, {"theta", 952}, {"thetasym", 977}, {"thinsp", 8201}, {"thorn", 254}, {"tilde", 732}, {"times", 215}, {"trade", 8482}, {"uArr", 8657}, {"uacute", 250}, {"uarr", 8593}, {"ucirc", 251}, {"ugrave", 249}, {"uml", 168}, {"upsih", 978}, {"upsilon", 965}, {"uuml", 252}, {"weierp", 8472}, {"xi", 958}, {"yacute", 253}, {"yen", 165}, {"yuml", 255}, {"zeta", 950}, {"zwj", 8205}, {"zwnj", 8204}, }; #define ENTITY_NAME_LENGTH_MAX 8 #define NR_OF_ENTITIES 252 #ifdef __cplusplus } #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sqlda-native.h��������������������������������������������������������������������������������������0000644�����������������00000001464�14763166027�0007326 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * src/interfaces/ecpg/include/sqlda-native.h */ #ifndef ECPG_SQLDA_NATIVE_H #define ECPG_SQLDA_NATIVE_H /* * Maximum length for identifiers (e.g. table names, column names, * function names). Names actually are limited to one less byte than this, * because the length must include a trailing zero byte. * * This should be at least as much as NAMEDATALEN of the database the * applications run against. */ #define NAMEDATALEN 64 struct sqlname { short length; char data[NAMEDATALEN]; }; struct sqlvar_struct { short sqltype; short sqllen; char *sqldata; short *sqlind; struct sqlname sqlname; }; struct sqlda_struct { char sqldaid[8]; long sqldabc; short sqln; short sqld; struct sqlda_struct *desc_next; struct sqlvar_struct sqlvar[1]; }; #endif /* ECPG_SQLDA_NATIVE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cpio.h����������������������������������������������������������������������������������������������0000644�����������������00000004334�14763166027�0005667 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Extended cpio format from POSIX.1. This file is part of the GNU C Library. Copyright (C) 1992, 1998 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU cpio. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _CPIO_H #define _CPIO_H 1 /* A cpio archive consists of a sequence of files. Each file has a 76 byte header, a variable length, NUL terminated filename, and variable length file data. A header for a filename "TRAILER!!!" indicates the end of the archive. */ /* All the fields in the header are ISO 646 (approximately ASCII) strings of octal numbers, left padded, not NUL terminated. Field Name Length in Bytes Notes c_magic 6 must be "070707" c_dev 6 c_ino 6 c_mode 6 see below for value c_uid 6 c_gid 6 c_nlink 6 c_rdev 6 only valid for chr and blk special files c_mtime 11 c_namesize 6 count includes terminating NUL in pathname c_filesize 11 must be 0 for FIFOs and directories */ /* Value for the field `c_magic'. */ #define MAGIC "070707" /* Values for c_mode, OR'd together: */ #define C_IRUSR 000400 #define C_IWUSR 000200 #define C_IXUSR 000100 #define C_IRGRP 000040 #define C_IWGRP 000020 #define C_IXGRP 000010 #define C_IROTH 000004 #define C_IWOTH 000002 #define C_IXOTH 000001 #define C_ISUID 004000 #define C_ISGID 002000 #define C_ISVTX 001000 #define C_ISBLK 060000 #define C_ISCHR 020000 #define C_ISDIR 040000 #define C_ISFIFO 010000 #define C_ISSOCK 0140000 #define C_ISLNK 0120000 #define C_ISCTG 0110000 #define C_ISREG 0100000 #endif /* cpio.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������keyutils.h������������������������������������������������������������������������������������������0000644�����������������00000016122�14763166027�0006604 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* keyutils.h: key utility library interface * * Copyright (C) 2005,2011 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef KEYUTILS_H #define KEYUTILS_H #include <stdint.h> extern const char keyutils_version_string[]; extern const char keyutils_build_string[]; /* key serial number */ typedef int32_t key_serial_t; /* special process keyring shortcut IDs */ #define KEY_SPEC_THREAD_KEYRING -1 /* - key ID for thread-specific keyring */ #define KEY_SPEC_PROCESS_KEYRING -2 /* - key ID for process-specific keyring */ #define KEY_SPEC_SESSION_KEYRING -3 /* - key ID for session-specific keyring */ #define KEY_SPEC_USER_KEYRING -4 /* - key ID for UID-specific keyring */ #define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */ #define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */ #define KEY_SPEC_REQKEY_AUTH_KEY -7 /* - key ID for assumed request_key auth key */ /* request-key default keyrings */ #define KEY_REQKEY_DEFL_NO_CHANGE -1 #define KEY_REQKEY_DEFL_DEFAULT 0 #define KEY_REQKEY_DEFL_THREAD_KEYRING 1 #define KEY_REQKEY_DEFL_PROCESS_KEYRING 2 #define KEY_REQKEY_DEFL_SESSION_KEYRING 3 #define KEY_REQKEY_DEFL_USER_KEYRING 4 #define KEY_REQKEY_DEFL_USER_SESSION_KEYRING 5 #define KEY_REQKEY_DEFL_GROUP_KEYRING 6 /* key handle permissions mask */ typedef uint32_t key_perm_t; #define KEY_POS_VIEW 0x01000000 /* possessor can view a key's attributes */ #define KEY_POS_READ 0x02000000 /* possessor can read key payload / view keyring */ #define KEY_POS_WRITE 0x04000000 /* possessor can update key payload / add link to keyring */ #define KEY_POS_SEARCH 0x08000000 /* possessor can find a key in search / search a keyring */ #define KEY_POS_LINK 0x10000000 /* possessor can create a link to a key/keyring */ #define KEY_POS_SETATTR 0x20000000 /* possessor can set key attributes */ #define KEY_POS_ALL 0x3f000000 #define KEY_USR_VIEW 0x00010000 /* user permissions... */ #define KEY_USR_READ 0x00020000 #define KEY_USR_WRITE 0x00040000 #define KEY_USR_SEARCH 0x00080000 #define KEY_USR_LINK 0x00100000 #define KEY_USR_SETATTR 0x00200000 #define KEY_USR_ALL 0x003f0000 #define KEY_GRP_VIEW 0x00000100 /* group permissions... */ #define KEY_GRP_READ 0x00000200 #define KEY_GRP_WRITE 0x00000400 #define KEY_GRP_SEARCH 0x00000800 #define KEY_GRP_LINK 0x00001000 #define KEY_GRP_SETATTR 0x00002000 #define KEY_GRP_ALL 0x00003f00 #define KEY_OTH_VIEW 0x00000001 /* third party permissions... */ #define KEY_OTH_READ 0x00000002 #define KEY_OTH_WRITE 0x00000004 #define KEY_OTH_SEARCH 0x00000008 #define KEY_OTH_LINK 0x00000010 #define KEY_OTH_SETATTR 0x00000010 #define KEY_OTH_ALL 0x0000003f /* keyctl commands */ #define KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */ #define KEYCTL_JOIN_SESSION_KEYRING 1 /* join or start named session keyring */ #define KEYCTL_UPDATE 2 /* update a key */ #define KEYCTL_REVOKE 3 /* revoke a key */ #define KEYCTL_CHOWN 4 /* set ownership of a key */ #define KEYCTL_SETPERM 5 /* set perms on a key */ #define KEYCTL_DESCRIBE 6 /* describe a key */ #define KEYCTL_CLEAR 7 /* clear contents of a keyring */ #define KEYCTL_LINK 8 /* link a key into a keyring */ #define KEYCTL_UNLINK 9 /* unlink a key from a keyring */ #define KEYCTL_SEARCH 10 /* search for a key in a keyring */ #define KEYCTL_READ 11 /* read a key or keyring's contents */ #define KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */ #define KEYCTL_NEGATE 13 /* negate a partially constructed key */ #define KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */ #define KEYCTL_SET_TIMEOUT 15 /* set timeout on a key */ #define KEYCTL_ASSUME_AUTHORITY 16 /* assume authority to instantiate key */ #define KEYCTL_GET_SECURITY 17 /* get key security label */ #define KEYCTL_SESSION_TO_PARENT 18 /* set my session keyring on my parent process */ #define KEYCTL_REJECT 19 /* reject a partially constructed key */ #define KEYCTL_INSTANTIATE_IOV 20 /* instantiate a partially constructed key */ #define KEYCTL_INVALIDATE 21 /* invalidate a key */ #define KEYCTL_GET_PERSISTENT 22 /* get a user's persistent keyring */ /* * syscall wrappers */ extern key_serial_t add_key(const char *type, const char *description, const void *payload, size_t plen, key_serial_t ringid); extern key_serial_t request_key(const char *type, const char *description, const char *callout_info, key_serial_t destringid); extern long keyctl(int cmd, ...); /* * keyctl function wrappers */ extern key_serial_t keyctl_get_keyring_ID(key_serial_t id, int create); extern key_serial_t keyctl_join_session_keyring(const char *name); extern long keyctl_update(key_serial_t id, const void *payload, size_t plen); extern long keyctl_revoke(key_serial_t id); extern long keyctl_chown(key_serial_t id, uid_t uid, gid_t gid); extern long keyctl_setperm(key_serial_t id, key_perm_t perm); extern long keyctl_describe(key_serial_t id, char *buffer, size_t buflen); extern long keyctl_clear(key_serial_t ringid); extern long keyctl_link(key_serial_t id, key_serial_t ringid); extern long keyctl_unlink(key_serial_t id, key_serial_t ringid); extern long keyctl_search(key_serial_t ringid, const char *type, const char *description, key_serial_t destringid); extern long keyctl_read(key_serial_t id, char *buffer, size_t buflen); extern long keyctl_instantiate(key_serial_t id, const void *payload, size_t plen, key_serial_t ringid); extern long keyctl_negate(key_serial_t id, unsigned timeout, key_serial_t ringid); extern long keyctl_set_reqkey_keyring(int reqkey_defl); extern long keyctl_set_timeout(key_serial_t key, unsigned timeout); extern long keyctl_assume_authority(key_serial_t key); extern long keyctl_get_security(key_serial_t key, char *buffer, size_t buflen); extern long keyctl_session_to_parent(void); extern long keyctl_reject(key_serial_t id, unsigned timeout, unsigned error, key_serial_t ringid); struct iovec; extern long keyctl_instantiate_iov(key_serial_t id, const struct iovec *payload_iov, unsigned ioc, key_serial_t ringid); extern long keyctl_invalidate(key_serial_t id); extern long keyctl_get_persistent(uid_t uid, key_serial_t id); /* * utilities */ extern int keyctl_describe_alloc(key_serial_t id, char **_buffer); extern int keyctl_read_alloc(key_serial_t id, void **_buffer); extern int keyctl_get_security_alloc(key_serial_t id, char **_buffer); typedef int (*recursive_key_scanner_t)(key_serial_t parent, key_serial_t key, char *desc, int desc_len, void *data); extern int recursive_key_scan(key_serial_t key, recursive_key_scanner_t func, void *data); extern int recursive_session_key_scan(recursive_key_scanner_t func, void *data); extern key_serial_t find_key_by_type_and_desc(const char *type, const char *desc, key_serial_t destringid); #endif /* KEYUTILS_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������idn-int.h�������������������������������������������������������������������������������������������0000644�����������������00000000024�14763166027�0006267 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <stdint.h> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ustat.h���������������������������������������������������������������������������������������������0000644�����������������00000000027�14763166027�0006070 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <sys/ustat.h> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������wait.h����������������������������������������������������������������������������������������������0000644�����������������00000000026�14763166027�0005673 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <sys/wait.h> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������locale.h��������������������������������������������������������������������������������������������0000644�����������������00000017441�14763166027�0006177 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991,1992,1995-2002,2007,2009,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 Standard: 7.11 Localization <locale.h> */ #ifndef _LOCALE_H #define _LOCALE_H 1 #include <features.h> #define __need_NULL #include <stddef.h> #include <bits/locale.h> __BEGIN_DECLS /* These are the possibilities for the first argument to setlocale. The code assumes that the lowest LC_* symbol has the value zero. */ #define LC_CTYPE __LC_CTYPE #define LC_NUMERIC __LC_NUMERIC #define LC_TIME __LC_TIME #define LC_COLLATE __LC_COLLATE #define LC_MONETARY __LC_MONETARY #define LC_MESSAGES __LC_MESSAGES #define LC_ALL __LC_ALL #define LC_PAPER __LC_PAPER #define LC_NAME __LC_NAME #define LC_ADDRESS __LC_ADDRESS #define LC_TELEPHONE __LC_TELEPHONE #define LC_MEASUREMENT __LC_MEASUREMENT #define LC_IDENTIFICATION __LC_IDENTIFICATION __BEGIN_NAMESPACE_STD /* Structure giving information about numeric and monetary notation. */ struct lconv { /* Numeric (non-monetary) information. */ char *decimal_point; /* Decimal point character. */ char *thousands_sep; /* Thousands separator. */ /* Each element is the number of digits in each group; elements with higher indices are farther left. An element with value CHAR_MAX means that no further grouping is done. An element with value 0 means that the previous element is used for all groups farther left. */ char *grouping; /* Monetary information. */ /* First three chars are a currency symbol from ISO 4217. Fourth char is the separator. Fifth char is '\0'. */ char *int_curr_symbol; char *currency_symbol; /* Local currency symbol. */ char *mon_decimal_point; /* Decimal point character. */ char *mon_thousands_sep; /* Thousands separator. */ char *mon_grouping; /* Like `grouping' element (above). */ char *positive_sign; /* Sign for positive values. */ char *negative_sign; /* Sign for negative values. */ char int_frac_digits; /* Int'l fractional digits. */ char frac_digits; /* Local fractional digits. */ /* 1 if currency_symbol precedes a positive value, 0 if succeeds. */ char p_cs_precedes; /* 1 iff a space separates currency_symbol from a positive value. */ char p_sep_by_space; /* 1 if currency_symbol precedes a negative value, 0 if succeeds. */ char n_cs_precedes; /* 1 iff a space separates currency_symbol from a negative value. */ char n_sep_by_space; /* Positive and negative sign positions: 0 Parentheses surround the quantity and currency_symbol. 1 The sign string precedes the quantity and currency_symbol. 2 The sign string follows the quantity and currency_symbol. 3 The sign string immediately precedes the currency_symbol. 4 The sign string immediately follows the currency_symbol. */ char p_sign_posn; char n_sign_posn; #ifdef __USE_ISOC99 /* 1 if int_curr_symbol precedes a positive value, 0 if succeeds. */ char int_p_cs_precedes; /* 1 iff a space separates int_curr_symbol from a positive value. */ char int_p_sep_by_space; /* 1 if int_curr_symbol precedes a negative value, 0 if succeeds. */ char int_n_cs_precedes; /* 1 iff a space separates int_curr_symbol from a negative value. */ char int_n_sep_by_space; /* Positive and negative sign positions: 0 Parentheses surround the quantity and int_curr_symbol. 1 The sign string precedes the quantity and int_curr_symbol. 2 The sign string follows the quantity and int_curr_symbol. 3 The sign string immediately precedes the int_curr_symbol. 4 The sign string immediately follows the int_curr_symbol. */ char int_p_sign_posn; char int_n_sign_posn; #else char __int_p_cs_precedes; char __int_p_sep_by_space; char __int_n_cs_precedes; char __int_n_sep_by_space; char __int_p_sign_posn; char __int_n_sign_posn; #endif }; /* Set and/or return the current locale. */ extern char *setlocale (int __category, const char *__locale) __THROW; /* Return the numeric/monetary information for the current locale. */ extern struct lconv *localeconv (void) __THROW; __END_NAMESPACE_STD #ifdef __USE_XOPEN2K8 /* The concept of one static locale per category is not very well thought out. Many applications will need to process its data using information from several different locales. Another application is the implementation of the internationalization handling in the upcoming ISO C++ standard library. To support this another set of the functions using locale data exist which have an additional argument. Attention: all these functions are *not* standardized in any form. This is a proof-of-concept implementation. */ /* Get locale datatype definition. */ # include <xlocale.h> /* Return a reference to a data structure representing a set of locale datasets. Unlike for the CATEGORY parameter for `setlocale' the CATEGORY_MASK parameter here uses a single bit for each category, made by OR'ing together LC_*_MASK bits above. */ extern __locale_t newlocale (int __category_mask, const char *__locale, __locale_t __base) __THROW; /* These are the bits that can be set in the CATEGORY_MASK argument to `newlocale'. In the GNU implementation, LC_FOO_MASK has the value of (1 << LC_FOO), but this is not a part of the interface that callers can assume will be true. */ # define LC_CTYPE_MASK (1 << __LC_CTYPE) # define LC_NUMERIC_MASK (1 << __LC_NUMERIC) # define LC_TIME_MASK (1 << __LC_TIME) # define LC_COLLATE_MASK (1 << __LC_COLLATE) # define LC_MONETARY_MASK (1 << __LC_MONETARY) # define LC_MESSAGES_MASK (1 << __LC_MESSAGES) # define LC_PAPER_MASK (1 << __LC_PAPER) # define LC_NAME_MASK (1 << __LC_NAME) # define LC_ADDRESS_MASK (1 << __LC_ADDRESS) # define LC_TELEPHONE_MASK (1 << __LC_TELEPHONE) # define LC_MEASUREMENT_MASK (1 << __LC_MEASUREMENT) # define LC_IDENTIFICATION_MASK (1 << __LC_IDENTIFICATION) # define LC_ALL_MASK (LC_CTYPE_MASK \ | LC_NUMERIC_MASK \ | LC_TIME_MASK \ | LC_COLLATE_MASK \ | LC_MONETARY_MASK \ | LC_MESSAGES_MASK \ | LC_PAPER_MASK \ | LC_NAME_MASK \ | LC_ADDRESS_MASK \ | LC_TELEPHONE_MASK \ | LC_MEASUREMENT_MASK \ | LC_IDENTIFICATION_MASK \ ) /* Return a duplicate of the set of locale in DATASET. All usage counters are increased if necessary. */ extern __locale_t duplocale (__locale_t __dataset) __THROW; /* Free the data associated with a locale dataset previously returned by a call to `setlocale_r'. */ extern void freelocale (__locale_t __dataset) __THROW; /* Switch the current thread's locale to DATASET. If DATASET is null, instead just return the current setting. The special value LC_GLOBAL_LOCALE is the initial setting for all threads and can also be installed any time, meaning the thread uses the global settings controlled by `setlocale'. */ extern __locale_t uselocale (__locale_t __dataset) __THROW; /* This value can be passed to `uselocale' and may be returned by it. Passing this value to any other function has undefined behavior. */ # define LC_GLOBAL_LOCALE ((__locale_t) -1L) #endif __END_DECLS #endif /* locale.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������syslog.h��������������������������������������������������������������������������������������������0000644�����������������00000000030�14763166027�0006242 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <sys/syslog.h> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pcreposix.h�����������������������������������������������������������������������������������������0000644�����������������00000012514�14763166027�0006750 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/************************************************* * Perl-Compatible Regular Expressions * *************************************************/ #ifndef _PCREPOSIX_H #define _PCREPOSIX_H /* This is the header for the POSIX wrapper interface to the PCRE Perl- Compatible Regular Expression library. It defines the things POSIX says should be there. I hope. Copyright (c) 1997-2012 University of Cambridge ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the University of Cambridge nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ /* Have to include stdlib.h in order to ensure that size_t is defined. */ #include <stdlib.h> /* Allow for C++ users */ #ifdef __cplusplus extern "C" { #endif /* Options, mostly defined by POSIX, but with some extras. */ #define REG_ICASE 0x0001 /* Maps to PCRE_CASELESS */ #define REG_NEWLINE 0x0002 /* Maps to PCRE_MULTILINE */ #define REG_NOTBOL 0x0004 /* Maps to PCRE_NOTBOL */ #define REG_NOTEOL 0x0008 /* Maps to PCRE_NOTEOL */ #define REG_DOTALL 0x0010 /* NOT defined by POSIX; maps to PCRE_DOTALL */ #define REG_NOSUB 0x0020 /* Maps to PCRE_NO_AUTO_CAPTURE */ #define REG_UTF8 0x0040 /* NOT defined by POSIX; maps to PCRE_UTF8 */ #define REG_STARTEND 0x0080 /* BSD feature: pass subject string by so,eo */ #define REG_NOTEMPTY 0x0100 /* NOT defined by POSIX; maps to PCRE_NOTEMPTY */ #define REG_UNGREEDY 0x0200 /* NOT defined by POSIX; maps to PCRE_UNGREEDY */ #define REG_UCP 0x0400 /* NOT defined by POSIX; maps to PCRE_UCP */ /* This is not used by PCRE, but by defining it we make it easier to slot PCRE into existing programs that make POSIX calls. */ #define REG_EXTENDED 0 /* Error values. Not all these are relevant or used by the wrapper. */ enum { REG_ASSERT = 1, /* internal error ? */ REG_BADBR, /* invalid repeat counts in {} */ REG_BADPAT, /* pattern error */ REG_BADRPT, /* ? * + invalid */ REG_EBRACE, /* unbalanced {} */ REG_EBRACK, /* unbalanced [] */ REG_ECOLLATE, /* collation error - not relevant */ REG_ECTYPE, /* bad class */ REG_EESCAPE, /* bad escape sequence */ REG_EMPTY, /* empty expression */ REG_EPAREN, /* unbalanced () */ REG_ERANGE, /* bad range inside [] */ REG_ESIZE, /* expression too big */ REG_ESPACE, /* failed to get memory */ REG_ESUBREG, /* bad back reference */ REG_INVARG, /* bad argument */ REG_NOMATCH /* match failed */ }; /* The structure representing a compiled regular expression. */ typedef struct { void *re_pcre; size_t re_nsub; size_t re_erroffset; } regex_t; /* The structure in which a captured offset is returned. */ typedef int regoff_t; typedef struct { regoff_t rm_so; regoff_t rm_eo; } regmatch_t; /* When an application links to a PCRE DLL in Windows, the symbols that are imported have to be identified as such. When building PCRE, the appropriate export settings are needed, and are set in pcreposix.c before including this file. */ #if defined(_WIN32) && !defined(PCRE_STATIC) && !defined(PCREPOSIX_EXP_DECL) # define PCREPOSIX_EXP_DECL extern __declspec(dllimport) # define PCREPOSIX_EXP_DEFN __declspec(dllimport) #endif /* By default, we use the standard "extern" declarations. */ #ifndef PCREPOSIX_EXP_DECL # ifdef __cplusplus # define PCREPOSIX_EXP_DECL extern "C" # define PCREPOSIX_EXP_DEFN extern "C" # else # define PCREPOSIX_EXP_DECL extern # define PCREPOSIX_EXP_DEFN extern # endif #endif /* The functions */ PCREPOSIX_EXP_DECL int regcomp(regex_t *, const char *, int); PCREPOSIX_EXP_DECL int regexec(const regex_t *, const char *, size_t, regmatch_t *, int); PCREPOSIX_EXP_DECL size_t regerror(int, const regex_t *, char *, size_t); PCREPOSIX_EXP_DECL void regfree(regex_t *); #ifdef __cplusplus } /* extern "C" */ #endif #endif /* End of pcreposix.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libio.h���������������������������������������������������������������������������������������������0000644�����������������00000041574�14763166027�0006042 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-1995,1997-2007,2009,2011,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Per Bothner <bothner@cygnus.com>. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. As a special exception, if you link the code in this file with files compiled with a GNU compiler to produce an executable, that does not cause the resulting executable to be covered by the GNU Lesser General Public License. This exception does not however invalidate any other reasons why the executable file might be covered by the GNU Lesser General Public License. This exception applies to code released by its copyright holders in files containing the exception. */ #ifndef _IO_STDIO_H #define _IO_STDIO_H #include <_G_config.h> /* ALL of these should be defined in _G_config.h */ #define _IO_fpos_t _G_fpos_t #define _IO_fpos64_t _G_fpos64_t #define _IO_size_t size_t #define _IO_ssize_t __ssize_t #define _IO_off_t __off_t #define _IO_off64_t __off64_t #define _IO_pid_t __pid_t #define _IO_uid_t __uid_t #define _IO_iconv_t _G_iconv_t #define _IO_HAVE_ST_BLKSIZE _G_HAVE_ST_BLKSIZE #define _IO_BUFSIZ _G_BUFSIZ #define _IO_va_list _G_va_list #define _IO_wint_t wint_t /* This define avoids name pollution if we're using GNU stdarg.h */ #define __need___va_list #include <stdarg.h> #ifdef __GNUC_VA_LIST # undef _IO_va_list # define _IO_va_list __gnuc_va_list #endif /* __GNUC_VA_LIST */ #ifndef __P # include <sys/cdefs.h> #endif /*!__P*/ #define _IO_UNIFIED_JUMPTABLES 1 #ifndef EOF # define EOF (-1) #endif #ifndef NULL # if defined __GNUG__ && \ (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)) # define NULL (__null) # else # if !defined(__cplusplus) # define NULL ((void*)0) # else # define NULL (0) # endif # endif #endif #define _IOS_INPUT 1 #define _IOS_OUTPUT 2 #define _IOS_ATEND 4 #define _IOS_APPEND 8 #define _IOS_TRUNC 16 #define _IOS_NOCREATE 32 #define _IOS_NOREPLACE 64 #define _IOS_BIN 128 /* Magic numbers and bits for the _flags field. The magic numbers use the high-order bits of _flags; the remaining bits are available for variable flags. Note: The magic numbers must all be negative if stdio emulation is desired. */ #define _IO_MAGIC 0xFBAD0000 /* Magic number */ #define _OLD_STDIO_MAGIC 0xFABC0000 /* Emulate old stdio. */ #define _IO_MAGIC_MASK 0xFFFF0000 #define _IO_USER_BUF 1 /* User owns buffer; don't delete it on close. */ #define _IO_UNBUFFERED 2 #define _IO_NO_READS 4 /* Reading not allowed */ #define _IO_NO_WRITES 8 /* Writing not allowd */ #define _IO_EOF_SEEN 0x10 #define _IO_ERR_SEEN 0x20 #define _IO_DELETE_DONT_CLOSE 0x40 /* Don't call close(_fileno) on cleanup. */ #define _IO_LINKED 0x80 /* Set if linked (using _chain) to streambuf::_list_all.*/ #define _IO_IN_BACKUP 0x100 #define _IO_LINE_BUF 0x200 #define _IO_TIED_PUT_GET 0x400 /* Set if put and get pointer logicly tied. */ #define _IO_CURRENTLY_PUTTING 0x800 #define _IO_IS_APPENDING 0x1000 #define _IO_IS_FILEBUF 0x2000 #define _IO_BAD_SEEN 0x4000 #define _IO_USER_LOCK 0x8000 #define _IO_FLAGS2_MMAP 1 #define _IO_FLAGS2_NOTCANCEL 2 #ifdef _LIBC # define _IO_FLAGS2_FORTIFY 4 #endif #define _IO_FLAGS2_USER_WBUF 8 #ifdef _LIBC # define _IO_FLAGS2_SCANF_STD 16 # define _IO_FLAGS2_NOCLOSE 32 # define _IO_FLAGS2_CLOEXEC 64 #endif /* These are "formatting flags" matching the iostream fmtflags enum values. */ #define _IO_SKIPWS 01 #define _IO_LEFT 02 #define _IO_RIGHT 04 #define _IO_INTERNAL 010 #define _IO_DEC 020 #define _IO_OCT 040 #define _IO_HEX 0100 #define _IO_SHOWBASE 0200 #define _IO_SHOWPOINT 0400 #define _IO_UPPERCASE 01000 #define _IO_SHOWPOS 02000 #define _IO_SCIENTIFIC 04000 #define _IO_FIXED 010000 #define _IO_UNITBUF 020000 #define _IO_STDIO 040000 #define _IO_DONT_CLOSE 0100000 #define _IO_BOOLALPHA 0200000 struct _IO_jump_t; struct _IO_FILE; /* Handle lock. */ #ifdef _IO_MTSAFE_IO # if defined __GLIBC__ && __GLIBC__ >= 2 # include <bits/stdio-lock.h> # else /*# include <comthread.h>*/ # endif #else typedef void _IO_lock_t; #endif /* A streammarker remembers a position in a buffer. */ struct _IO_marker { struct _IO_marker *_next; struct _IO_FILE *_sbuf; /* If _pos >= 0 it points to _buf->Gbase()+_pos. FIXME comment */ /* if _pos < 0, it points to _buf->eBptr()+_pos. FIXME comment */ int _pos; #if 0 void set_streampos(streampos sp) { _spos = sp; } void set_offset(int offset) { _pos = offset; _spos = (streampos)(-2); } public: streammarker(streambuf *sb); ~streammarker(); int saving() { return _spos == -2; } int delta(streammarker&); int delta(); #endif }; /* This is the structure from the libstdc++ codecvt class. */ enum __codecvt_result { __codecvt_ok, __codecvt_partial, __codecvt_error, __codecvt_noconv }; #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T /* The order of the elements in the following struct must match the order of the virtual functions in the libstdc++ codecvt class. */ struct _IO_codecvt { void (*__codecvt_destr) (struct _IO_codecvt *); enum __codecvt_result (*__codecvt_do_out) (struct _IO_codecvt *, __mbstate_t *, const wchar_t *, const wchar_t *, const wchar_t **, char *, char *, char **); enum __codecvt_result (*__codecvt_do_unshift) (struct _IO_codecvt *, __mbstate_t *, char *, char *, char **); enum __codecvt_result (*__codecvt_do_in) (struct _IO_codecvt *, __mbstate_t *, const char *, const char *, const char **, wchar_t *, wchar_t *, wchar_t **); int (*__codecvt_do_encoding) (struct _IO_codecvt *); int (*__codecvt_do_always_noconv) (struct _IO_codecvt *); int (*__codecvt_do_length) (struct _IO_codecvt *, __mbstate_t *, const char *, const char *, _IO_size_t); int (*__codecvt_do_max_length) (struct _IO_codecvt *); _IO_iconv_t __cd_in; _IO_iconv_t __cd_out; }; /* Extra data for wide character streams. */ struct _IO_wide_data { wchar_t *_IO_read_ptr; /* Current read pointer */ wchar_t *_IO_read_end; /* End of get area. */ wchar_t *_IO_read_base; /* Start of putback+get area. */ wchar_t *_IO_write_base; /* Start of put area. */ wchar_t *_IO_write_ptr; /* Current put pointer. */ wchar_t *_IO_write_end; /* End of put area. */ wchar_t *_IO_buf_base; /* Start of reserve area. */ wchar_t *_IO_buf_end; /* End of reserve area. */ /* The following fields are used to support backing up and undo. */ wchar_t *_IO_save_base; /* Pointer to start of non-current get area. */ wchar_t *_IO_backup_base; /* Pointer to first valid character of backup area */ wchar_t *_IO_save_end; /* Pointer to end of non-current get area. */ __mbstate_t _IO_state; __mbstate_t _IO_last_state; struct _IO_codecvt _codecvt; wchar_t _shortbuf[1]; const struct _IO_jump_t *_wide_vtable; }; #endif struct _IO_FILE { int _flags; /* High-order word is _IO_MAGIC; rest is flags. */ #define _IO_file_flags _flags /* The following pointers correspond to the C++ streambuf protocol. */ /* Note: Tk uses the _IO_read_ptr and _IO_read_end fields directly. */ char* _IO_read_ptr; /* Current read pointer */ char* _IO_read_end; /* End of get area. */ char* _IO_read_base; /* Start of putback+get area. */ char* _IO_write_base; /* Start of put area. */ char* _IO_write_ptr; /* Current put pointer. */ char* _IO_write_end; /* End of put area. */ char* _IO_buf_base; /* Start of reserve area. */ char* _IO_buf_end; /* End of reserve area. */ /* The following fields are used to support backing up and undo. */ char *_IO_save_base; /* Pointer to start of non-current get area. */ char *_IO_backup_base; /* Pointer to first valid character of backup area */ char *_IO_save_end; /* Pointer to end of non-current get area. */ struct _IO_marker *_markers; struct _IO_FILE *_chain; int _fileno; #if 0 int _blksize; #else int _flags2; #endif _IO_off_t _old_offset; /* This used to be _offset but it's too small. */ #define __HAVE_COLUMN /* temporary */ /* 1+column number of pbase(); 0 is unknown. */ unsigned short _cur_column; signed char _vtable_offset; char _shortbuf[1]; /* char* _save_gptr; char* _save_egptr; */ _IO_lock_t *_lock; #ifdef _IO_USE_OLD_IO_FILE }; struct _IO_FILE_complete { struct _IO_FILE _file; #endif #if defined _G_IO_IO_FILE_VERSION && _G_IO_IO_FILE_VERSION == 0x20001 _IO_off64_t _offset; # if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T /* Wide character stream stuff. */ struct _IO_codecvt *_codecvt; struct _IO_wide_data *_wide_data; struct _IO_FILE *_freeres_list; void *_freeres_buf; size_t _freeres_size; # else void *__pad1; void *__pad2; void *__pad3; void *__pad4; size_t __pad5; # endif int _mode; /* Make sure we don't get into trouble again. */ char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; #endif }; #ifndef __cplusplus typedef struct _IO_FILE _IO_FILE; #endif struct _IO_FILE_plus; extern struct _IO_FILE_plus _IO_2_1_stdin_; extern struct _IO_FILE_plus _IO_2_1_stdout_; extern struct _IO_FILE_plus _IO_2_1_stderr_; #ifndef _LIBC #define _IO_stdin ((_IO_FILE*)(&_IO_2_1_stdin_)) #define _IO_stdout ((_IO_FILE*)(&_IO_2_1_stdout_)) #define _IO_stderr ((_IO_FILE*)(&_IO_2_1_stderr_)) #else extern _IO_FILE *_IO_stdin attribute_hidden; extern _IO_FILE *_IO_stdout attribute_hidden; extern _IO_FILE *_IO_stderr attribute_hidden; #endif /* Functions to do I/O and file management for a stream. */ /* Read NBYTES bytes from COOKIE into a buffer pointed to by BUF. Return number of bytes read. */ typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); /* Write N bytes pointed to by BUF to COOKIE. Write all N bytes unless there is an error. Return number of bytes written. If there is an error, return 0 and do not write anything. If the file has been opened for append (__mode.__append set), then set the file pointer to the end of the file and then do the write; if not, just write at the current file pointer. */ typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, size_t __n); /* Move COOKIE's file position to *POS bytes from the beginning of the file (if W is SEEK_SET), the current position (if W is SEEK_CUR), or the end of the file (if W is SEEK_END). Set *POS to the new file position. Returns zero if successful, nonzero if not. */ typedef int __io_seek_fn (void *__cookie, _IO_off64_t *__pos, int __w); /* Close COOKIE. */ typedef int __io_close_fn (void *__cookie); #ifdef _GNU_SOURCE /* User-visible names for the above. */ typedef __io_read_fn cookie_read_function_t; typedef __io_write_fn cookie_write_function_t; typedef __io_seek_fn cookie_seek_function_t; typedef __io_close_fn cookie_close_function_t; /* The structure with the cookie function pointers. */ typedef struct { __io_read_fn *read; /* Read bytes. */ __io_write_fn *write; /* Write bytes. */ __io_seek_fn *seek; /* Seek/tell file position. */ __io_close_fn *close; /* Close file. */ } _IO_cookie_io_functions_t; typedef _IO_cookie_io_functions_t cookie_io_functions_t; struct _IO_cookie_file; /* Initialize one of those. */ extern void _IO_cookie_init (struct _IO_cookie_file *__cfile, int __read_write, void *__cookie, _IO_cookie_io_functions_t __fns); #endif #ifdef __cplusplus extern "C" { #endif extern int __underflow (_IO_FILE *); extern int __uflow (_IO_FILE *); extern int __overflow (_IO_FILE *, int); #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T extern _IO_wint_t __wunderflow (_IO_FILE *); extern _IO_wint_t __wuflow (_IO_FILE *); extern _IO_wint_t __woverflow (_IO_FILE *, _IO_wint_t); #endif #if __GNUC__ >= 3 # define _IO_BE(expr, res) __builtin_expect ((expr), res) #else # define _IO_BE(expr, res) (expr) #endif #define _IO_getc_unlocked(_fp) \ (_IO_BE ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end, 0) \ ? __uflow (_fp) : *(unsigned char *) (_fp)->_IO_read_ptr++) #define _IO_peekc_unlocked(_fp) \ (_IO_BE ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end, 0) \ && __underflow (_fp) == EOF ? EOF \ : *(unsigned char *) (_fp)->_IO_read_ptr) #define _IO_putc_unlocked(_ch, _fp) \ (_IO_BE ((_fp)->_IO_write_ptr >= (_fp)->_IO_write_end, 0) \ ? __overflow (_fp, (unsigned char) (_ch)) \ : (unsigned char) (*(_fp)->_IO_write_ptr++ = (_ch))) #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T # define _IO_getwc_unlocked(_fp) \ (_IO_BE ((_fp)->_wide_data == NULL \ || ((_fp)->_wide_data->_IO_read_ptr \ >= (_fp)->_wide_data->_IO_read_end), 0) \ ? __wuflow (_fp) : (_IO_wint_t) *(_fp)->_wide_data->_IO_read_ptr++) # define _IO_putwc_unlocked(_wch, _fp) \ (_IO_BE ((_fp)->_wide_data == NULL \ || ((_fp)->_wide_data->_IO_write_ptr \ >= (_fp)->_wide_data->_IO_write_end), 0) \ ? __woverflow (_fp, _wch) \ : (_IO_wint_t) (*(_fp)->_wide_data->_IO_write_ptr++ = (_wch))) #endif #define _IO_feof_unlocked(__fp) (((__fp)->_flags & _IO_EOF_SEEN) != 0) #define _IO_ferror_unlocked(__fp) (((__fp)->_flags & _IO_ERR_SEEN) != 0) extern int _IO_getc (_IO_FILE *__fp); extern int _IO_putc (int __c, _IO_FILE *__fp); extern int _IO_feof (_IO_FILE *__fp) __THROW; extern int _IO_ferror (_IO_FILE *__fp) __THROW; extern int _IO_peekc_locked (_IO_FILE *__fp); /* This one is for Emacs. */ #define _IO_PENDING_OUTPUT_COUNT(_fp) \ ((_fp)->_IO_write_ptr - (_fp)->_IO_write_base) extern void _IO_flockfile (_IO_FILE *) __THROW; extern void _IO_funlockfile (_IO_FILE *) __THROW; extern int _IO_ftrylockfile (_IO_FILE *) __THROW; #ifdef _IO_MTSAFE_IO # define _IO_peekc(_fp) _IO_peekc_locked (_fp) # define _IO_flockfile(_fp) \ if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_flockfile (_fp) # define _IO_funlockfile(_fp) \ if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_funlockfile (_fp) #else # define _IO_peekc(_fp) _IO_peekc_unlocked (_fp) # define _IO_flockfile(_fp) /**/ # define _IO_funlockfile(_fp) /**/ # define _IO_ftrylockfile(_fp) /**/ # define _IO_cleanup_region_start(_fct, _fp) /**/ # define _IO_cleanup_region_end(_Doit) /**/ #endif /* !_IO_MTSAFE_IO */ extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, _IO_va_list, int *__restrict); extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, _IO_va_list); extern _IO_ssize_t _IO_padn (_IO_FILE *, int, _IO_ssize_t); extern _IO_size_t _IO_sgetn (_IO_FILE *, void *, _IO_size_t); extern _IO_off64_t _IO_seekoff (_IO_FILE *, _IO_off64_t, int, int); extern _IO_off64_t _IO_seekpos (_IO_FILE *, _IO_off64_t, int); extern void _IO_free_backup_area (_IO_FILE *) __THROW; #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T extern _IO_wint_t _IO_getwc (_IO_FILE *__fp); extern _IO_wint_t _IO_putwc (wchar_t __wc, _IO_FILE *__fp); extern int _IO_fwide (_IO_FILE *__fp, int __mode) __THROW; # if __GNUC__ >= 2 /* While compiling glibc we have to handle compatibility with very old versions. */ # if defined _LIBC && defined SHARED # include <shlib-compat.h> # if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) # define _IO_fwide_maybe_incompatible \ (__builtin_expect (&_IO_stdin_used == NULL, 0)) extern const int _IO_stdin_used; weak_extern (_IO_stdin_used); # endif # endif # ifndef _IO_fwide_maybe_incompatible # define _IO_fwide_maybe_incompatible (0) # endif /* A special optimized version of the function above. It optimizes the case of initializing an unoriented byte stream. */ # define _IO_fwide(__fp, __mode) \ ({ int __result = (__mode); \ if (__result < 0 && ! _IO_fwide_maybe_incompatible) \ { \ if ((__fp)->_mode == 0) \ /* We know that all we have to do is to set the flag. */ \ (__fp)->_mode = -1; \ __result = (__fp)->_mode; \ } \ else if (__builtin_constant_p (__mode) && (__mode) == 0) \ __result = _IO_fwide_maybe_incompatible ? -1 : (__fp)->_mode; \ else \ __result = _IO_fwide (__fp, __result); \ __result; }) # endif extern int _IO_vfwscanf (_IO_FILE * __restrict, const wchar_t * __restrict, _IO_va_list, int *__restrict); extern int _IO_vfwprintf (_IO_FILE *__restrict, const wchar_t *__restrict, _IO_va_list); extern _IO_ssize_t _IO_wpadn (_IO_FILE *, wint_t, _IO_ssize_t); extern void _IO_free_wbackup_area (_IO_FILE *) __THROW; #endif #ifdef __LDBL_COMPAT # include <bits/libio-ldbl.h> #endif #ifdef __cplusplus } #endif #endif /* _IO_STDIO_H */ ������������������������������������������������������������������������������������������������������������������������������������FlexLexer.h�����������������������������������������������������������������������������������������0000644�����������������00000014111�14763166027�0006625 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*-C++-*- // FlexLexer.h -- define interfaces for lexical analyzer classes generated // by flex // Copyright (c) 1993 The Regents of the University of California. // All rights reserved. // // This code is derived from software contributed to Berkeley by // Kent Williams and Tom Epperly. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // Neither the name of the University nor the names of its contributors // may be used to endorse or promote products derived from this software // without specific prior written permission. // THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR // IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE. // This file defines FlexLexer, an abstract class which specifies the // external interface provided to flex C++ lexer objects, and yyFlexLexer, // which defines a particular lexer class. // // If you want to create multiple lexer classes, you use the -P flag // to rename each yyFlexLexer to some other xxFlexLexer. You then // include <FlexLexer.h> in your other sources once per lexer class: // // #undef yyFlexLexer // #define yyFlexLexer xxFlexLexer // #include <FlexLexer.h> // // #undef yyFlexLexer // #define yyFlexLexer zzFlexLexer // #include <FlexLexer.h> // ... #ifndef __FLEX_LEXER_H // Never included before - need to define base class. #define __FLEX_LEXER_H #include <iostream> # ifndef FLEX_STD # define FLEX_STD std:: # endif extern "C++" { struct yy_buffer_state; typedef int yy_state_type; class FlexLexer { public: virtual ~FlexLexer() { } const char* YYText() const { return yytext; } int YYLeng() const { return yyleng; } virtual void yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0; virtual struct yy_buffer_state* yy_create_buffer( FLEX_STD istream* s, int size ) = 0; virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0; virtual void yyrestart( FLEX_STD istream* s ) = 0; virtual int yylex() = 0; // Call yylex with new input/output sources. int yylex( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 ) { switch_streams( new_in, new_out ); return yylex(); } // Switch to new input/output streams. A nil stream pointer // indicates "keep the current one". virtual void switch_streams( FLEX_STD istream* new_in = 0, FLEX_STD ostream* new_out = 0 ) = 0; int lineno() const { return yylineno; } int debug() const { return yy_flex_debug; } void set_debug( int flag ) { yy_flex_debug = flag; } protected: char* yytext; int yyleng; int yylineno; // only maintained if you use %option yylineno int yy_flex_debug; // only has effect with -d or "%option debug" }; } #endif // FLEXLEXER_H #if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce) // Either this is the first time through (yyFlexLexerOnce not defined), // or this is a repeated include to define a different flavor of // yyFlexLexer, as discussed in the flex manual. #define yyFlexLexerOnce extern "C++" { class yyFlexLexer : public FlexLexer { public: // arg_yyin and arg_yyout default to the cin and cout, but we // only make that assignment when initializing in yylex(). yyFlexLexer( FLEX_STD istream* arg_yyin = 0, FLEX_STD ostream* arg_yyout = 0 ); virtual ~yyFlexLexer(); void yy_switch_to_buffer( struct yy_buffer_state* new_buffer ); struct yy_buffer_state* yy_create_buffer( FLEX_STD istream* s, int size ); void yy_delete_buffer( struct yy_buffer_state* b ); void yyrestart( FLEX_STD istream* s ); void yypush_buffer_state( struct yy_buffer_state* new_buffer ); void yypop_buffer_state(); virtual int yylex(); virtual void switch_streams( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 ); virtual int yywrap(); protected: virtual int LexerInput( char* buf, int max_size ); virtual void LexerOutput( const char* buf, int size ); virtual void LexerError( const char* msg ); void yyunput( int c, char* buf_ptr ); int yyinput(); void yy_load_buffer_state(); void yy_init_buffer( struct yy_buffer_state* b, FLEX_STD istream* s ); void yy_flush_buffer( struct yy_buffer_state* b ); int yy_start_stack_ptr; int yy_start_stack_depth; int* yy_start_stack; void yy_push_state( int new_state ); void yy_pop_state(); int yy_top_state(); yy_state_type yy_get_previous_state(); yy_state_type yy_try_NUL_trans( yy_state_type current_state ); int yy_get_next_buffer(); FLEX_STD istream* yyin; // input source for default LexerInput FLEX_STD ostream* yyout; // output sink for default LexerOutput // yy_hold_char holds the character lost when yytext is formed. char yy_hold_char; // Number of characters read into yy_ch_buf. int yy_n_chars; // Points to current character in buffer. char* yy_c_buf_p; int yy_init; // whether we need to initialize int yy_start; // start state number // Flag which is used to allow yywrap()'s to do buffer switches // instead of setting up a fresh yyin. A bit of a hack ... int yy_did_buffer_switch_on_eof; size_t yy_buffer_stack_top; /**< index of top of stack. */ size_t yy_buffer_stack_max; /**< capacity of stack. */ struct yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */ void yyensure_buffer_stack(void); // The following are not always needed, but may be depending // on use of certain flex features (like REJECT or yymore()). yy_state_type yy_last_accepting_state; char* yy_last_accepting_cpos; yy_state_type* yy_state_buf; yy_state_type* yy_state_ptr; char* yy_full_match; int* yy_full_state; int yy_full_lp; int yy_lp; int yy_looking_for_trail_begin; int yy_more_flag; int yy_more_len; int yy_more_offset; int yy_prev_more_offset; }; } #endif // yyFlexLexer || ! yyFlexLexerOnce �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tiffio.h��������������������������������������������������������������������������������������������0000644�����������������00000056223�14763166027�0006221 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tiffio.h,v 1.91 2012-07-29 15:45:29 tgl Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _TIFFIO_ #define _TIFFIO_ /* * TIFF I/O Library Definitions. */ #include "tiff.h" #include "tiffvers.h" /* * TIFF is defined as an incomplete type to hide the * library's internal data structures from clients. */ typedef struct tiff TIFF; /* * The following typedefs define the intrinsic size of * data types used in the *exported* interfaces. These * definitions depend on the proper definition of types * in tiff.h. Note also that the varargs interface used * to pass tag types and values uses the types defined in * tiff.h directly. * * NB: ttag_t is unsigned int and not unsigned short because * ANSI C requires that the type before the ellipsis be a * promoted type (i.e. one of int, unsigned int, pointer, * or double) and because we defined pseudo-tags that are * outside the range of legal Aldus-assigned tags. * NB: tsize_t is int32 and not uint32 because some functions * return -1. * NB: toff_t is not off_t for many reasons; TIFFs max out at * 32-bit file offsets, and BigTIFF maxes out at 64-bit * offsets being the most important, and to ensure use of * a consistently unsigned type across architectures. * Prior to libtiff 4.0, this was an unsigned 32 bit type. */ /* * this is the machine addressing size type, only it's signed, so make it * int32 on 32bit machines, int64 on 64bit machines */ typedef TIFF_SSIZE_T tmsize_t; typedef uint64 toff_t; /* file offset */ /* the following are deprecated and should be replaced by their defining counterparts */ typedef uint32 ttag_t; /* directory tag */ typedef uint16 tdir_t; /* directory index */ typedef uint16 tsample_t; /* sample number */ typedef uint32 tstrile_t; /* strip or tile number */ typedef tstrile_t tstrip_t; /* strip number */ typedef tstrile_t ttile_t; /* tile number */ typedef tmsize_t tsize_t; /* i/o size in bytes */ typedef void* tdata_t; /* image data ref */ #if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32)) #define __WIN32__ #endif /* * On windows you should define USE_WIN32_FILEIO if you are using tif_win32.c * or AVOID_WIN32_FILEIO if you are using something else (like tif_unix.c). * * By default tif_unix.c is assumed. */ #if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows) # if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO) # define AVOID_WIN32_FILEIO # endif #endif #if defined(USE_WIN32_FILEIO) # define VC_EXTRALEAN # include <windows.h> # ifdef __WIN32__ DECLARE_HANDLE(thandle_t); /* Win32 file handle */ # else typedef HFILE thandle_t; /* client data handle */ # endif /* __WIN32__ */ #else typedef void* thandle_t; /* client data handle */ #endif /* USE_WIN32_FILEIO */ /* * Flags to pass to TIFFPrintDirectory to control * printing of data structures that are potentially * very large. Bit-or these flags to enable printing * multiple items. */ #define TIFFPRINT_NONE 0x0 /* no extra info */ #define TIFFPRINT_STRIPS 0x1 /* strips/tiles info */ #define TIFFPRINT_CURVES 0x2 /* color/gray response curves */ #define TIFFPRINT_COLORMAP 0x4 /* colormap */ #define TIFFPRINT_JPEGQTABLES 0x100 /* JPEG Q matrices */ #define TIFFPRINT_JPEGACTABLES 0x200 /* JPEG AC tables */ #define TIFFPRINT_JPEGDCTABLES 0x200 /* JPEG DC tables */ /* * Colour conversion stuff */ /* reference white */ #define D65_X0 (95.0470F) #define D65_Y0 (100.0F) #define D65_Z0 (108.8827F) #define D50_X0 (96.4250F) #define D50_Y0 (100.0F) #define D50_Z0 (82.4680F) /* Structure for holding information about a display device. */ typedef unsigned char TIFFRGBValue; /* 8-bit samples */ typedef struct { float d_mat[3][3]; /* XYZ -> luminance matrix */ float d_YCR; /* Light o/p for reference white */ float d_YCG; float d_YCB; uint32 d_Vrwr; /* Pixel values for ref. white */ uint32 d_Vrwg; uint32 d_Vrwb; float d_Y0R; /* Residual light for black pixel */ float d_Y0G; float d_Y0B; float d_gammaR; /* Gamma values for the three guns */ float d_gammaG; float d_gammaB; } TIFFDisplay; typedef struct { /* YCbCr->RGB support */ TIFFRGBValue* clamptab; /* range clamping table */ int* Cr_r_tab; int* Cb_b_tab; int32* Cr_g_tab; int32* Cb_g_tab; int32* Y_tab; } TIFFYCbCrToRGB; typedef struct { /* CIE Lab 1976->RGB support */ int range; /* Size of conversion table */ #define CIELABTORGB_TABLE_RANGE 1500 float rstep, gstep, bstep; float X0, Y0, Z0; /* Reference white point */ TIFFDisplay display; float Yr2r[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yr to r */ float Yg2g[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yg to g */ float Yb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb to b */ } TIFFCIELabToRGB; /* * RGBA-style image support. */ typedef struct _TIFFRGBAImage TIFFRGBAImage; /* * The image reading and conversion routines invoke * ``put routines'' to copy/image/whatever tiles of * raw image data. A default set of routines are * provided to convert/copy raw image data to 8-bit * packed ABGR format rasters. Applications can supply * alternate routines that unpack the data into a * different format or, for example, unpack the data * and draw the unpacked raster on the display. */ typedef void (*tileContigRoutine) (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32, unsigned char*); typedef void (*tileSeparateRoutine) (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32, unsigned char*, unsigned char*, unsigned char*, unsigned char*); /* * RGBA-reader state. */ struct _TIFFRGBAImage { TIFF* tif; /* image handle */ int stoponerr; /* stop on read error */ int isContig; /* data is packed/separate */ int alpha; /* type of alpha data present */ uint32 width; /* image width */ uint32 height; /* image height */ uint16 bitspersample; /* image bits/sample */ uint16 samplesperpixel; /* image samples/pixel */ uint16 orientation; /* image orientation */ uint16 req_orientation; /* requested orientation */ uint16 photometric; /* image photometric interp */ uint16* redcmap; /* colormap pallete */ uint16* greencmap; uint16* bluecmap; /* get image data routine */ int (*get)(TIFFRGBAImage*, uint32*, uint32, uint32); /* put decoded strip/tile */ union { void (*any)(TIFFRGBAImage*); tileContigRoutine contig; tileSeparateRoutine separate; } put; TIFFRGBValue* Map; /* sample mapping array */ uint32** BWmap; /* black&white map */ uint32** PALmap; /* palette image map */ TIFFYCbCrToRGB* ycbcr; /* YCbCr conversion state */ TIFFCIELabToRGB* cielab; /* CIE L*a*b conversion state */ uint8* UaToAa; /* Unassociated alpha to associated alpha convertion LUT */ uint8* Bitdepth16To8; /* LUT for conversion from 16bit to 8bit values */ int row_offset; int col_offset; }; /* * Macros for extracting components from the * packed ABGR form returned by TIFFReadRGBAImage. */ #define TIFFGetR(abgr) ((abgr) & 0xff) #define TIFFGetG(abgr) (((abgr) >> 8) & 0xff) #define TIFFGetB(abgr) (((abgr) >> 16) & 0xff) #define TIFFGetA(abgr) (((abgr) >> 24) & 0xff) /* * A CODEC is a software package that implements decoding, * encoding, or decoding+encoding of a compression algorithm. * The library provides a collection of builtin codecs. * More codecs may be registered through calls to the library * and/or the builtin implementations may be overridden. */ typedef int (*TIFFInitMethod)(TIFF*, int); typedef struct { char* name; uint16 scheme; TIFFInitMethod init; } TIFFCodec; #include <stdio.h> #include <stdarg.h> /* share internal LogLuv conversion routines? */ #ifndef LOGLUV_PUBLIC #define LOGLUV_PUBLIC 1 #endif #if !defined(__GNUC__) && !defined(__attribute__) # define __attribute__(x) /*nothing*/ #endif #if defined(c_plusplus) || defined(__cplusplus) extern "C" { #endif typedef void (*TIFFErrorHandler)(const char*, const char*, va_list); typedef void (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list); typedef tmsize_t (*TIFFReadWriteProc)(thandle_t, void*, tmsize_t); typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int); typedef int (*TIFFCloseProc)(thandle_t); typedef toff_t (*TIFFSizeProc)(thandle_t); typedef int (*TIFFMapFileProc)(thandle_t, void** base, toff_t* size); typedef void (*TIFFUnmapFileProc)(thandle_t, void* base, toff_t size); typedef void (*TIFFExtendProc)(TIFF*); extern const char* TIFFGetVersion(void); extern const TIFFCodec* TIFFFindCODEC(uint16); extern TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod); extern void TIFFUnRegisterCODEC(TIFFCodec*); extern int TIFFIsCODECConfigured(uint16); extern TIFFCodec* TIFFGetConfiguredCODECs(void); /* * Auxiliary functions. */ extern void* _TIFFmalloc(tmsize_t s); extern void* _TIFFcalloc(tmsize_t nmemb, tmsize_t siz); extern void* _TIFFrealloc(void* p, tmsize_t s); extern void _TIFFmemset(void* p, int v, tmsize_t c); extern void _TIFFmemcpy(void* d, const void* s, tmsize_t c); extern int _TIFFmemcmp(const void* p1, const void* p2, tmsize_t c); extern void _TIFFfree(void* p); /* ** Stuff, related to tag handling and creating custom tags. */ extern int TIFFGetTagListCount( TIFF * ); extern uint32 TIFFGetTagListEntry( TIFF *, int tag_index ); #define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */ #define TIFF_VARIABLE -1 /* marker for variable length tags */ #define TIFF_SPP -2 /* marker for SamplesPerPixel tags */ #define TIFF_VARIABLE2 -3 /* marker for uint32 var-length tags */ #define FIELD_CUSTOM 65 typedef struct _TIFFField TIFFField; typedef struct _TIFFFieldArray TIFFFieldArray; extern const TIFFField* TIFFFindField(TIFF *, uint32, TIFFDataType); extern const TIFFField* TIFFFieldWithTag(TIFF*, uint32); extern const TIFFField* TIFFFieldWithName(TIFF*, const char *); extern uint32 TIFFFieldTag(const TIFFField*); extern const char* TIFFFieldName(const TIFFField*); extern TIFFDataType TIFFFieldDataType(const TIFFField*); extern int TIFFFieldPassCount(const TIFFField*); extern int TIFFFieldReadCount(const TIFFField*); extern int TIFFFieldWriteCount(const TIFFField*); typedef int (*TIFFVSetMethod)(TIFF*, uint32, va_list); typedef int (*TIFFVGetMethod)(TIFF*, uint32, va_list); typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long); typedef struct { TIFFVSetMethod vsetfield; /* tag set routine */ TIFFVGetMethod vgetfield; /* tag get routine */ TIFFPrintMethod printdir; /* directory print routine */ } TIFFTagMethods; extern TIFFTagMethods *TIFFAccessTagMethods(TIFF *); extern void *TIFFGetClientInfo(TIFF *, const char *); extern void TIFFSetClientInfo(TIFF *, void *, const char *); extern void TIFFCleanup(TIFF* tif); extern void TIFFClose(TIFF* tif); extern int TIFFFlush(TIFF* tif); extern int TIFFFlushData(TIFF* tif); extern int TIFFGetField(TIFF* tif, uint32 tag, ...); extern int TIFFVGetField(TIFF* tif, uint32 tag, va_list ap); extern int TIFFGetFieldDefaulted(TIFF* tif, uint32 tag, ...); extern int TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap); extern int TIFFReadDirectory(TIFF* tif); extern int TIFFReadCustomDirectory(TIFF* tif, toff_t diroff, const TIFFFieldArray* infoarray); extern int TIFFReadEXIFDirectory(TIFF* tif, toff_t diroff); extern uint64 TIFFScanlineSize64(TIFF* tif); extern tmsize_t TIFFScanlineSize(TIFF* tif); extern uint64 TIFFRasterScanlineSize64(TIFF* tif); extern tmsize_t TIFFRasterScanlineSize(TIFF* tif); extern uint64 TIFFStripSize64(TIFF* tif); extern tmsize_t TIFFStripSize(TIFF* tif); extern uint64 TIFFRawStripSize64(TIFF* tif, uint32 strip); extern tmsize_t TIFFRawStripSize(TIFF* tif, uint32 strip); extern uint64 TIFFVStripSize64(TIFF* tif, uint32 nrows); extern tmsize_t TIFFVStripSize(TIFF* tif, uint32 nrows); extern uint64 TIFFTileRowSize64(TIFF* tif); extern tmsize_t TIFFTileRowSize(TIFF* tif); extern uint64 TIFFTileSize64(TIFF* tif); extern tmsize_t TIFFTileSize(TIFF* tif); extern uint64 TIFFVTileSize64(TIFF* tif, uint32 nrows); extern tmsize_t TIFFVTileSize(TIFF* tif, uint32 nrows); extern uint32 TIFFDefaultStripSize(TIFF* tif, uint32 request); extern void TIFFDefaultTileSize(TIFF*, uint32*, uint32*); extern int TIFFFileno(TIFF*); extern int TIFFSetFileno(TIFF*, int); extern thandle_t TIFFClientdata(TIFF*); extern thandle_t TIFFSetClientdata(TIFF*, thandle_t); extern int TIFFGetMode(TIFF*); extern int TIFFSetMode(TIFF*, int); extern int TIFFIsTiled(TIFF*); extern int TIFFIsByteSwapped(TIFF*); extern int TIFFIsUpSampled(TIFF*); extern int TIFFIsMSB2LSB(TIFF*); extern int TIFFIsBigEndian(TIFF*); extern TIFFReadWriteProc TIFFGetReadProc(TIFF*); extern TIFFReadWriteProc TIFFGetWriteProc(TIFF*); extern TIFFSeekProc TIFFGetSeekProc(TIFF*); extern TIFFCloseProc TIFFGetCloseProc(TIFF*); extern TIFFSizeProc TIFFGetSizeProc(TIFF*); extern TIFFMapFileProc TIFFGetMapFileProc(TIFF*); extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*); extern uint32 TIFFCurrentRow(TIFF*); extern uint16 TIFFCurrentDirectory(TIFF*); extern uint16 TIFFNumberOfDirectories(TIFF*); extern uint64 TIFFCurrentDirOffset(TIFF*); extern uint32 TIFFCurrentStrip(TIFF*); extern uint32 TIFFCurrentTile(TIFF* tif); extern int TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size); extern int TIFFWriteBufferSetup(TIFF* tif, void* bp, tmsize_t size); extern int TIFFSetupStrips(TIFF *); extern int TIFFWriteCheck(TIFF*, int, const char *); extern void TIFFFreeDirectory(TIFF*); extern int TIFFCreateDirectory(TIFF*); extern int TIFFCreateCustomDirectory(TIFF*,const TIFFFieldArray*); extern int TIFFCreateEXIFDirectory(TIFF*); extern int TIFFLastDirectory(TIFF*); extern int TIFFSetDirectory(TIFF*, uint16); extern int TIFFSetSubDirectory(TIFF*, uint64); extern int TIFFUnlinkDirectory(TIFF*, uint16); extern int TIFFSetField(TIFF*, uint32, ...); extern int TIFFVSetField(TIFF*, uint32, va_list); extern int TIFFUnsetField(TIFF*, uint32); extern int TIFFWriteDirectory(TIFF *); extern int TIFFWriteCustomDirectory(TIFF *, uint64 *); extern int TIFFCheckpointDirectory(TIFF *); extern int TIFFRewriteDirectory(TIFF *); #if defined(c_plusplus) || defined(__cplusplus) extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0); extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0); extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0); extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0); extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int = ORIENTATION_BOTLEFT, int = 0); #else extern void TIFFPrintDirectory(TIFF*, FILE*, long); extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample); extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample); extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int); extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int); #endif extern int TIFFReadRGBAStrip(TIFF*, uint32, uint32 * ); extern int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * ); extern int TIFFRGBAImageOK(TIFF*, char [1024]); extern int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]); extern int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32); extern void TIFFRGBAImageEnd(TIFFRGBAImage*); typedef struct TIFFOpenOptions TIFFOpenOptions; extern TIFF* TIFFOpen(const char*, const char*); extern TIFF* TIFFOpenExt(const char*, const char*, TIFFOpenOptions* opts); # ifdef __WIN32__ extern TIFF* TIFFOpenW(const wchar_t*, const char*); # endif /* __WIN32__ */ extern TIFF* TIFFFdOpen(int, const char*, const char*); extern TIFF* TIFFFdOpenExt(int, const char*, const char*, TIFFOpenOptions* opts); extern TIFF* TIFFClientOpen(const char*, const char*, thandle_t, TIFFReadWriteProc, TIFFReadWriteProc, TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, TIFFMapFileProc, TIFFUnmapFileProc); extern TIFF* TIFFClientOpenExt(const char*, const char*, thandle_t, TIFFReadWriteProc, TIFFReadWriteProc, TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, TIFFMapFileProc, TIFFUnmapFileProc, TIFFOpenOptions*); extern TIFFOpenOptions* TIFFOpenOptionsAlloc(void); extern void TIFFOpenOptionsFree(TIFFOpenOptions*); extern void TIFFOpenOptionsSetMaxSingleMemAlloc(TIFFOpenOptions* opts, tmsize_t max_single_mem_alloc); extern const char* TIFFFileName(TIFF*); extern const char* TIFFSetFileName(TIFF*, const char *); extern void TIFFError(const char*, const char*, ...) __attribute__((__format__ (__printf__,2,3))); extern void TIFFErrorExt(thandle_t, const char*, const char*, ...) __attribute__((__format__ (__printf__,3,4))); extern void TIFFWarning(const char*, const char*, ...) __attribute__((__format__ (__printf__,2,3))); extern void TIFFWarningExt(thandle_t, const char*, const char*, ...) __attribute__((__format__ (__printf__,3,4))); extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler); extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt); extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler); extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt); extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc); extern uint32 TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s); extern int TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s); extern uint32 TIFFNumberOfTiles(TIFF*); extern tmsize_t TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s); extern tmsize_t TIFFWriteTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s); extern uint32 TIFFComputeStrip(TIFF*, uint32, uint16); extern uint32 TIFFNumberOfStrips(TIFF*); extern tmsize_t TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size); extern tmsize_t TIFFReadRawStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size); extern tmsize_t TIFFReadEncodedTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size); extern tmsize_t TIFFReadRawTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size); extern tmsize_t TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc); extern tmsize_t TIFFWriteRawStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc); extern tmsize_t TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc); extern tmsize_t TIFFWriteRawTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc); extern int TIFFDataWidth(TIFFDataType); /* table of tag datatype widths */ extern void TIFFSetWriteOffset(TIFF* tif, toff_t off); extern void TIFFSwabShort(uint16*); extern void TIFFSwabLong(uint32*); extern void TIFFSwabLong8(uint64*); extern void TIFFSwabFloat(float*); extern void TIFFSwabDouble(double*); extern void TIFFSwabArrayOfShort(uint16* wp, tmsize_t n); extern void TIFFSwabArrayOfTriples(uint8* tp, tmsize_t n); extern void TIFFSwabArrayOfLong(uint32* lp, tmsize_t n); extern void TIFFSwabArrayOfLong8(uint64* lp, tmsize_t n); extern void TIFFSwabArrayOfFloat(float* fp, tmsize_t n); extern void TIFFSwabArrayOfDouble(double* dp, tmsize_t n); extern void TIFFReverseBits(uint8* cp, tmsize_t n); extern const unsigned char* TIFFGetBitRevTable(int); #ifdef LOGLUV_PUBLIC #define U_NEU 0.210526316 #define V_NEU 0.473684211 #define UVSCALE 410. extern double LogL16toY(int); extern double LogL10toY(int); extern void XYZtoRGB24(float*, uint8*); extern int uv_decode(double*, double*, int); extern void LogLuv24toXYZ(uint32, float*); extern void LogLuv32toXYZ(uint32, float*); #if defined(c_plusplus) || defined(__cplusplus) extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER); extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER); extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER); extern uint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER); extern uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER); #else extern int LogL16fromY(double, int); extern int LogL10fromY(double, int); extern int uv_encode(double, double, int); extern uint32 LogLuv24fromXYZ(float*, int); extern uint32 LogLuv32fromXYZ(float*, int); #endif #endif /* LOGLUV_PUBLIC */ extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, const TIFFDisplay *, float*); extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32, float *, float *, float *); extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float, uint32 *, uint32 *, uint32 *); extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*); extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32, uint32 *, uint32 *, uint32 *); /**************************************************************************** * O B S O L E T E D I N T E R F A C E S * * Don't use this stuff in your applications, it may be removed in the future * libtiff versions. ****************************************************************************/ typedef struct { ttag_t field_tag; /* field's tag */ short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */ short field_writecount; /* write count/TIFF_VARIABLE */ TIFFDataType field_type; /* type of associated data */ unsigned short field_bit; /* bit in fieldsset bit vector */ unsigned char field_oktochange; /* if true, can change while writing */ unsigned char field_passcount; /* if true, pass dir count on set */ char *field_name; /* ASCII name */ } TIFFFieldInfo; extern int TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], uint32); #if defined(c_plusplus) || defined(__cplusplus) } #endif #endif /* _TIFFIO_ */ /* vim: set ts=8 sts=8 sw=8 noet: */ /* * Local Variables: * mode: c * c-basic-offset: 8 * fill-column: 78 * End: */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������neteconet/ec.h��������������������������������������������������������������������������������������0000644�����������������00000003176�14763166027�0007313 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Definitions for use with Linux AF_ECONET sockets. Copyright (C) 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _NETECONET_EC_H #define _NETECONET_EC_H 1 #include <features.h> #include <bits/sockaddr.h> struct ec_addr { unsigned char station; /* Station number. */ unsigned char net; /* Network number. */ }; struct sockaddr_ec { __SOCKADDR_COMMON (sec_); unsigned char port; /* Port number. */ unsigned char cb; /* Control/flag byte. */ unsigned char type; /* Type of message. */ struct ec_addr addr; unsigned long cookie; }; #define ECTYPE_PACKET_RECEIVED 0 /* Packet received */ #define ECTYPE_TRANSMIT_STATUS 0x10 /* Transmit completed */ #define ECTYPE_TRANSMIT_OK 1 #define ECTYPE_TRANSMIT_NOT_LISTENING 2 #define ECTYPE_TRANSMIT_NET_ERROR 3 #define ECTYPE_TRANSMIT_NO_CLOCK 4 #define ECTYPE_TRANSMIT_LINE_JAMMED 5 #define ECTYPE_TRANSMIT_NOT_PRESENT 6 #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ecpglib.h�������������������������������������������������������������������������������������������0000644�����������������00000005051�14763166027�0006337 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * this is a small part of c.h since we don't want to leak all postgres * definitions into ecpg programs * src/interfaces/ecpg/include/ecpglib.h */ #ifndef _ECPGLIB_H #define _ECPGLIB_H #include "libpq-fe.h" #include "ecpgtype.h" #include "sqlca.h" #include <string.h> #ifdef ENABLE_NLS extern char * ecpg_gettext(const char *msgid) __attribute__((format_arg(1))); #else #define ecpg_gettext(x) (x) #endif #ifndef __cplusplus #ifndef bool #define bool char #endif /* ndef bool */ #ifndef true #define true ((bool) 1) #endif /* ndef true */ #ifndef false #define false ((bool) 0) #endif /* ndef false */ #endif /* not C++ */ #ifndef TRUE #define TRUE 1 #endif /* TRUE */ #ifndef FALSE #define FALSE 0 #endif /* FALSE */ #ifdef __cplusplus extern "C" { #endif void ECPGdebug(int, FILE *); bool ECPGstatus(int, const char *); bool ECPGsetcommit(int, const char *, const char *); bool ECPGsetconn(int, const char *); bool ECPGconnect(int, int, const char *, const char *, const char *, const char *, int); bool ECPGdo(const int, const int, const int, const char *, const bool, const int, const char *,...); bool ECPGtrans(int, const char *, const char *); bool ECPGdisconnect(int, const char *); bool ECPGprepare(int, const char *, const bool, const char *, const char *); bool ECPGdeallocate(int, int, const char *, const char *); bool ECPGdeallocate_all(int, int, const char *); char *ECPGprepared_statement(const char *, const char *, int); PGconn *ECPGget_PGconn(const char *); PGTransactionStatusType ECPGtransactionStatus(const char *); char *ECPGerrmsg(void); /* print an error message */ void sqlprint(void); /* define this for simplicity as well as compatibility */ #define SQLCODE sqlca.sqlcode #define SQLSTATE sqlca.sqlstate /* dynamic SQL */ bool ECPGdo_descriptor(int, const char *, const char *, const char *); bool ECPGdeallocate_desc(int, const char *); bool ECPGallocate_desc(int, const char *); bool ECPGget_desc_header(int, const char *, int *); bool ECPGget_desc(int, const char *, int,...); bool ECPGset_desc_header(int, const char *, int); bool ECPGset_desc(int, const char *, int,...); void ECPGset_noind_null(enum ECPGttype, void *); bool ECPGis_noind_null(enum ECPGttype, void *); bool ECPGdescribe(int, int, bool, const char *, const char *,...); void ECPGset_var(int, void *, int); void *ECPGget_var(int number); /* dynamic result allocation */ void ECPGfree_auto_mem(void); #ifdef ENABLE_THREAD_SAFETY void ecpg_pthreads_init(void); #endif #ifdef __cplusplus } #endif #endif /* _ECPGLIB_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pg_config_os.h��������������������������������������������������������������������������������������0000644�����������������00000002034�14763166027�0007364 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/include/port/linux.h */ /* * As of July 2007, all known versions of the Linux kernel will sometimes * return EIDRM for a shmctl() operation when EINVAL is correct (it happens * when the low-order 15 bits of the supplied shm ID match the slot number * assigned to a newer shmem segment). We deal with this by assuming that * EIDRM means EINVAL in PGSharedMemoryIsInUse(). This is reasonably safe * since in fact Linux has no excuse for ever returning EIDRM; it doesn't * track removed segments in a way that would allow distinguishing them from * private ones. But someday that code might get upgraded, and we'd have * to have a kernel version test here. */ #define HAVE_LINUX_EIDRM_BUG /* * Set the default wal_sync_method to fdatasync. With recent Linux versions, * xlogdefs.h's normal rules will prefer open_datasync, which (a) doesn't * perform better and (b) causes outright failures on ext4 data=journal * filesystems, because those don't support O_DIRECT. */ #define PLATFORM_DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������quota/mkquota.h�������������������������������������������������������������������������������������0000644�����������������00000003747�14763166027�0007556 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** mkquota.h * * Interface to the quota library. * * The quota library provides interface for creating and updating the quota * files and the ext4 superblock fields. It supports the new VFS_V1 quota * format. The quota library also provides support for keeping track of quotas * in memory. * The typical way to use the quota library is as follows: * { * quota_ctx_t qctx; * * quota_init_context(&qctx, fs, -1); * { * quota_compute_usage(qctx, -1); * AND/OR * quota_data_add/quota_data_sub/quota_data_inodes(); * } * quota_write_inode(qctx, USRQUOTA); * quota_write_inode(qctx, GRPQUOTA); * quota_release_context(&qctx); * } * * This initial version does not support reading the quota files. This support * will be added in near future. * * Aditya Kali <adityakali@google.com> */ #ifndef __QUOTA_QUOTAIO_H__ #define __QUOTA_QUOTAIO_H__ #include "ext2fs/ext2_fs.h" #include "ext2fs/ext2fs.h" #include "quotaio.h" #include "../e2fsck/dict.h" typedef struct quota_ctx *quota_ctx_t; struct quota_ctx { ext2_filsys fs; dict_t *quota_dict[MAXQUOTAS]; }; /* In mkquota.c */ errcode_t quota_init_context(quota_ctx_t *qctx, ext2_filsys fs, int qtype); void quota_data_inodes(quota_ctx_t qctx, struct ext2_inode *inode, ext2_ino_t ino, int adjust); void quota_data_add(quota_ctx_t qctx, struct ext2_inode *inode, ext2_ino_t ino, qsize_t space); void quota_data_sub(quota_ctx_t qctx, struct ext2_inode *inode, ext2_ino_t ino, qsize_t space); errcode_t quota_write_inode(quota_ctx_t qctx, int qtype); errcode_t quota_update_limits(quota_ctx_t qctx, ext2_ino_t qf_ino, int type); errcode_t quota_compute_usage(quota_ctx_t qctx); void quota_release_context(quota_ctx_t *qctx); errcode_t quota_remove_inode(ext2_filsys fs, int qtype); int quota_file_exists(ext2_filsys fs, int qtype, int fmt); void quota_set_sb_inum(ext2_filsys fs, ext2_ino_t ino, int qtype); errcode_t quota_compare_and_update(quota_ctx_t qctx, int qtype, int *usage_inconsistent); #endif /* __QUOTA_QUOTAIO_H__ */ �������������������������stdint.h��������������������������������������������������������������������������������������������0000644�����������������00000017707�14763166027�0006252 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997,1998,1999,2000,2001,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99: 7.18 Integer types <stdint.h> */ #ifndef _STDINT_H #define _STDINT_H 1 #include <features.h> #include <bits/wchar.h> #include <bits/wordsize.h> /* Exact integral types. */ /* Signed. */ /* There is some amount of overlap with <sys/types.h> as known by inet code */ #ifndef __int8_t_defined # define __int8_t_defined typedef signed char int8_t; typedef short int int16_t; typedef int int32_t; # if __WORDSIZE == 64 typedef long int int64_t; # else __extension__ typedef long long int int64_t; # endif #endif /* Unsigned. */ typedef unsigned char uint8_t; typedef unsigned short int uint16_t; #ifndef __uint32_t_defined typedef unsigned int uint32_t; # define __uint32_t_defined #endif #if __WORDSIZE == 64 typedef unsigned long int uint64_t; #else __extension__ typedef unsigned long long int uint64_t; #endif /* Small types. */ /* Signed. */ typedef signed char int_least8_t; typedef short int int_least16_t; typedef int int_least32_t; #if __WORDSIZE == 64 typedef long int int_least64_t; #else __extension__ typedef long long int int_least64_t; #endif /* Unsigned. */ typedef unsigned char uint_least8_t; typedef unsigned short int uint_least16_t; typedef unsigned int uint_least32_t; #if __WORDSIZE == 64 typedef unsigned long int uint_least64_t; #else __extension__ typedef unsigned long long int uint_least64_t; #endif /* Fast types. */ /* Signed. */ typedef signed char int_fast8_t; #if __WORDSIZE == 64 typedef long int int_fast16_t; typedef long int int_fast32_t; typedef long int int_fast64_t; #else typedef int int_fast16_t; typedef int int_fast32_t; __extension__ typedef long long int int_fast64_t; #endif /* Unsigned. */ typedef unsigned char uint_fast8_t; #if __WORDSIZE == 64 typedef unsigned long int uint_fast16_t; typedef unsigned long int uint_fast32_t; typedef unsigned long int uint_fast64_t; #else typedef unsigned int uint_fast16_t; typedef unsigned int uint_fast32_t; __extension__ typedef unsigned long long int uint_fast64_t; #endif /* Types for `void *' pointers. */ #if __WORDSIZE == 64 # ifndef __intptr_t_defined typedef long int intptr_t; # define __intptr_t_defined # endif typedef unsigned long int uintptr_t; #else # ifndef __intptr_t_defined typedef int intptr_t; # define __intptr_t_defined # endif typedef unsigned int uintptr_t; #endif /* Largest integral types. */ #if __WORDSIZE == 64 typedef long int intmax_t; typedef unsigned long int uintmax_t; #else __extension__ typedef long long int intmax_t; __extension__ typedef unsigned long long int uintmax_t; #endif # if __WORDSIZE == 64 # define __INT64_C(c) c ## L # define __UINT64_C(c) c ## UL # else # define __INT64_C(c) c ## LL # define __UINT64_C(c) c ## ULL # endif /* Limits of integral types. */ /* Minimum of signed integral types. */ # define INT8_MIN (-128) # define INT16_MIN (-32767-1) # define INT32_MIN (-2147483647-1) # define INT64_MIN (-__INT64_C(9223372036854775807)-1) /* Maximum of signed integral types. */ # define INT8_MAX (127) # define INT16_MAX (32767) # define INT32_MAX (2147483647) # define INT64_MAX (__INT64_C(9223372036854775807)) /* Maximum of unsigned integral types. */ # define UINT8_MAX (255) # define UINT16_MAX (65535) # define UINT32_MAX (4294967295U) # define UINT64_MAX (__UINT64_C(18446744073709551615)) /* Minimum of signed integral types having a minimum size. */ # define INT_LEAST8_MIN (-128) # define INT_LEAST16_MIN (-32767-1) # define INT_LEAST32_MIN (-2147483647-1) # define INT_LEAST64_MIN (-__INT64_C(9223372036854775807)-1) /* Maximum of signed integral types having a minimum size. */ # define INT_LEAST8_MAX (127) # define INT_LEAST16_MAX (32767) # define INT_LEAST32_MAX (2147483647) # define INT_LEAST64_MAX (__INT64_C(9223372036854775807)) /* Maximum of unsigned integral types having a minimum size. */ # define UINT_LEAST8_MAX (255) # define UINT_LEAST16_MAX (65535) # define UINT_LEAST32_MAX (4294967295U) # define UINT_LEAST64_MAX (__UINT64_C(18446744073709551615)) /* Minimum of fast signed integral types having a minimum size. */ # define INT_FAST8_MIN (-128) # if __WORDSIZE == 64 # define INT_FAST16_MIN (-9223372036854775807L-1) # define INT_FAST32_MIN (-9223372036854775807L-1) # else # define INT_FAST16_MIN (-2147483647-1) # define INT_FAST32_MIN (-2147483647-1) # endif # define INT_FAST64_MIN (-__INT64_C(9223372036854775807)-1) /* Maximum of fast signed integral types having a minimum size. */ # define INT_FAST8_MAX (127) # if __WORDSIZE == 64 # define INT_FAST16_MAX (9223372036854775807L) # define INT_FAST32_MAX (9223372036854775807L) # else # define INT_FAST16_MAX (2147483647) # define INT_FAST32_MAX (2147483647) # endif # define INT_FAST64_MAX (__INT64_C(9223372036854775807)) /* Maximum of fast unsigned integral types having a minimum size. */ # define UINT_FAST8_MAX (255) # if __WORDSIZE == 64 # define UINT_FAST16_MAX (18446744073709551615UL) # define UINT_FAST32_MAX (18446744073709551615UL) # else # define UINT_FAST16_MAX (4294967295U) # define UINT_FAST32_MAX (4294967295U) # endif # define UINT_FAST64_MAX (__UINT64_C(18446744073709551615)) /* Values to test for integral types holding `void *' pointer. */ # if __WORDSIZE == 64 # define INTPTR_MIN (-9223372036854775807L-1) # define INTPTR_MAX (9223372036854775807L) # define UINTPTR_MAX (18446744073709551615UL) # else # define INTPTR_MIN (-2147483647-1) # define INTPTR_MAX (2147483647) # define UINTPTR_MAX (4294967295U) # endif /* Minimum for largest signed integral type. */ # define INTMAX_MIN (-__INT64_C(9223372036854775807)-1) /* Maximum for largest signed integral type. */ # define INTMAX_MAX (__INT64_C(9223372036854775807)) /* Maximum for largest unsigned integral type. */ # define UINTMAX_MAX (__UINT64_C(18446744073709551615)) /* Limits of other integer types. */ /* Limits of `ptrdiff_t' type. */ # if __WORDSIZE == 64 # define PTRDIFF_MIN (-9223372036854775807L-1) # define PTRDIFF_MAX (9223372036854775807L) # else # define PTRDIFF_MIN (-2147483647-1) # define PTRDIFF_MAX (2147483647) # endif /* Limits of `sig_atomic_t'. */ # define SIG_ATOMIC_MIN (-2147483647-1) # define SIG_ATOMIC_MAX (2147483647) /* Limit of `size_t' type. */ # if __WORDSIZE == 64 # define SIZE_MAX (18446744073709551615UL) # else # ifdef __WORDSIZE32_SIZE_ULONG # define SIZE_MAX (4294967295UL) # else # define SIZE_MAX (4294967295U) # endif # endif /* Limits of `wchar_t'. */ # ifndef WCHAR_MIN /* These constants might also be defined in <wchar.h>. */ # define WCHAR_MIN __WCHAR_MIN # define WCHAR_MAX __WCHAR_MAX # endif /* Limits of `wint_t'. */ # define WINT_MIN (0u) # define WINT_MAX (4294967295u) /* Signed. */ # define INT8_C(c) c # define INT16_C(c) c # define INT32_C(c) c # if __WORDSIZE == 64 # define INT64_C(c) c ## L # else # define INT64_C(c) c ## LL # endif /* Unsigned. */ # define UINT8_C(c) c # define UINT16_C(c) c # define UINT32_C(c) c ## U # if __WORDSIZE == 64 # define UINT64_C(c) c ## UL # else # define UINT64_C(c) c ## ULL # endif /* Maximal type. */ # if __WORDSIZE == 64 # define INTMAX_C(c) c ## L # define UINTMAX_C(c) c ## UL # else # define INTMAX_C(c) c ## LL # define UINTMAX_C(c) c ## ULL # endif #endif /* stdint.h */ ���������������������������������������������������������gdfontmb.h������������������������������������������������������������������������������������������0000644�����������������00000001116�14763166027�0006530 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifdef __cplusplus extern "C" { #endif #ifndef _GDFONTMB_H_ #define _GDFONTMB_H_ 1 #ifdef __cplusplus extern "C" { #endif /* This is a header file for gd font, generated using bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz from bdf font -misc-fixed-bold-r-normal-sans-13-94-100-100-c-70-iso8859-2 at Thu Jan 8 13:54:57 1998. No copyright info was found in the original bdf. */ #include "gd.h" BGD_EXPORT_DATA_PROT gdFontPtr gdFontMediumBold; BGD_DECLARE(gdFontPtr) gdFontGetMediumBold(void); #ifdef __cplusplus } #endif #endif #ifdef __cplusplus } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mtd/inftl-user.h������������������������������������������������������������������������������������0000644�����������������00000003154�14763166027�0007610 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Parts of INFTL headers shared with userspace * */ #ifndef __MTD_INFTL_USER_H__ #define __MTD_INFTL_USER_H__ #include <linux/types.h> #define OSAK_VERSION 0x5120 #define PERCENTUSED 98 #define SECTORSIZE 512 /* Block Control Information */ struct inftl_bci { __u8 ECCsig[6]; __u8 Status; __u8 Status1; } __attribute__((packed)); struct inftl_unithead1 { __u16 virtualUnitNo; __u16 prevUnitNo; __u8 ANAC; __u8 NACs; __u8 parityPerField; __u8 discarded; } __attribute__((packed)); struct inftl_unithead2 { __u8 parityPerField; __u8 ANAC; __u16 prevUnitNo; __u16 virtualUnitNo; __u8 NACs; __u8 discarded; } __attribute__((packed)); struct inftl_unittail { __u8 Reserved[4]; __u16 EraseMark; __u16 EraseMark1; } __attribute__((packed)); union inftl_uci { struct inftl_unithead1 a; struct inftl_unithead2 b; struct inftl_unittail c; }; struct inftl_oob { struct inftl_bci b; union inftl_uci u; }; /* INFTL Media Header */ struct INFTLPartition { __u32 virtualUnits; __u32 firstUnit; __u32 lastUnit; __u32 flags; __u32 spareUnits; __u32 Reserved0; __u32 Reserved1; } __attribute__((packed)); struct INFTLMediaHeader { char bootRecordID[8]; __u32 NoOfBootImageBlocks; __u32 NoOfBinaryPartitions; __u32 NoOfBDTLPartitions; __u32 BlockMultiplierBits; __u32 FormatFlags; __u32 OsakVersion; __u32 PercentUsed; struct INFTLPartition Partitions[4]; } __attribute__((packed)); /* Partition flag types */ #define INFTL_BINARY 0x20000000 #define INFTL_BDTL 0x40000000 #define INFTL_LAST 0x80000000 #endif /* __MTD_INFTL_USER_H__ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mtd/nftl-user.h�������������������������������������������������������������������������������������0000644�����������������00000004104�14763166027�0007433 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> * * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef __MTD_NFTL_USER_H__ #define __MTD_NFTL_USER_H__ #include <linux/types.h> /* Block Control Information */ struct nftl_bci { unsigned char ECCSig[6]; __u8 Status; __u8 Status1; }__attribute__((packed)); /* Unit Control Information */ struct nftl_uci0 { __u16 VirtUnitNum; __u16 ReplUnitNum; __u16 SpareVirtUnitNum; __u16 SpareReplUnitNum; } __attribute__((packed)); struct nftl_uci1 { __u32 WearInfo; __u16 EraseMark; __u16 EraseMark1; } __attribute__((packed)); struct nftl_uci2 { __u16 FoldMark; __u16 FoldMark1; __u32 unused; } __attribute__((packed)); union nftl_uci { struct nftl_uci0 a; struct nftl_uci1 b; struct nftl_uci2 c; }; struct nftl_oob { struct nftl_bci b; union nftl_uci u; }; /* NFTL Media Header */ struct NFTLMediaHeader { char DataOrgID[6]; __u16 NumEraseUnits; __u16 FirstPhysicalEUN; __u32 FormattedSize; unsigned char UnitSizeFactor; } __attribute__((packed)); #define MAX_ERASE_ZONES (8192 - 512) #define ERASE_MARK 0x3c69 #define SECTOR_FREE 0xff #define SECTOR_USED 0x55 #define SECTOR_IGNORE 0x11 #define SECTOR_DELETED 0x00 #define FOLD_MARK_IN_PROGRESS 0x5555 #define ZONE_GOOD 0xff #define ZONE_BAD_ORIGINAL 0 #define ZONE_BAD_MARKED 7 #endif /* __MTD_NFTL_USER_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mtd/mtd-abi.h���������������������������������������������������������������������������������������0000644�����������������00000022765�14763166027�0007046 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> et al. * * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef __MTD_ABI_H__ #define __MTD_ABI_H__ #include <linux/types.h> struct erase_info_user { __u32 start; __u32 length; }; struct erase_info_user64 { __u64 start; __u64 length; }; struct mtd_oob_buf { __u32 start; __u32 length; unsigned char *ptr; }; struct mtd_oob_buf64 { __u64 start; __u32 pad; __u32 length; __u64 usr_ptr; }; /** * MTD operation modes * * @MTD_OPS_PLACE_OOB: OOB data are placed at the given offset (default) * @MTD_OPS_AUTO_OOB: OOB data are automatically placed at the free areas * which are defined by the internal ecclayout * @MTD_OPS_RAW: data are transferred as-is, with no error correction; * this mode implies %MTD_OPS_PLACE_OOB * * These modes can be passed to ioctl(MEMWRITE) and are also used internally. * See notes on "MTD file modes" for discussion on %MTD_OPS_RAW vs. * %MTD_FILE_MODE_RAW. */ enum { MTD_OPS_PLACE_OOB = 0, MTD_OPS_AUTO_OOB = 1, MTD_OPS_RAW = 2, }; /** * struct mtd_write_req - data structure for requesting a write operation * * @start: start address * @len: length of data buffer * @ooblen: length of OOB buffer * @usr_data: user-provided data buffer * @usr_oob: user-provided OOB buffer * @mode: MTD mode (see "MTD operation modes") * @padding: reserved, must be set to 0 * * This structure supports ioctl(MEMWRITE) operations, allowing data and/or OOB * writes in various modes. To write to OOB-only, set @usr_data == NULL, and to * write data-only, set @usr_oob == NULL. However, setting both @usr_data and * @usr_oob to NULL is not allowed. */ struct mtd_write_req { __u64 start; __u64 len; __u64 ooblen; __u64 usr_data; __u64 usr_oob; __u8 mode; __u8 padding[7]; }; #define MTD_ABSENT 0 #define MTD_RAM 1 #define MTD_ROM 2 #define MTD_NORFLASH 3 #define MTD_NANDFLASH 4 /* SLC NAND */ #define MTD_DATAFLASH 6 #define MTD_UBIVOLUME 7 #define MTD_MLCNANDFLASH 8 /* MLC NAND (including TLC) */ #define MTD_WRITEABLE 0x400 /* Device is writeable */ #define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */ #define MTD_NO_ERASE 0x1000 /* No erase necessary */ #define MTD_POWERUP_LOCK 0x2000 /* Always locked after reset */ /* Some common devices / combinations of capabilities */ #define MTD_CAP_ROM 0 #define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE) #define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE) #define MTD_CAP_NANDFLASH (MTD_WRITEABLE) #define MTD_CAP_NVRAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE) /* Obsolete ECC byte placement modes (used with obsolete MEMGETOOBSEL) */ #define MTD_NANDECC_OFF 0 // Switch off ECC (Not recommended) #define MTD_NANDECC_PLACE 1 // Use the given placement in the structure (YAFFS1 legacy mode) #define MTD_NANDECC_AUTOPLACE 2 // Use the default placement scheme #define MTD_NANDECC_PLACEONLY 3 // Use the given placement in the structure (Do not store ecc result on read) #define MTD_NANDECC_AUTOPL_USR 4 // Use the given autoplacement scheme rather than using the default /* OTP mode selection */ #define MTD_OTP_OFF 0 #define MTD_OTP_FACTORY 1 #define MTD_OTP_USER 2 struct mtd_info_user { __u8 type; __u32 flags; __u32 size; /* Total size of the MTD */ __u32 erasesize; __u32 writesize; __u32 oobsize; /* Amount of OOB data per block (e.g. 16) */ __u64 padding; /* Old obsolete field; do not use */ }; struct region_info_user { __u32 offset; /* At which this region starts, * from the beginning of the MTD */ __u32 erasesize; /* For this region */ __u32 numblocks; /* Number of blocks in this region */ __u32 regionindex; }; struct otp_info { __u32 start; __u32 length; __u32 locked; }; /* * Note, the following ioctl existed in the past and was removed: * #define MEMSETOOBSEL _IOW('M', 9, struct nand_oobinfo) * Try to avoid adding a new ioctl with the same ioctl number. */ /* Get basic MTD characteristics info (better to use sysfs) */ #define MEMGETINFO _IOR('M', 1, struct mtd_info_user) /* Erase segment of MTD */ #define MEMERASE _IOW('M', 2, struct erase_info_user) /* Write out-of-band data from MTD */ #define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf) /* Read out-of-band data from MTD */ #define MEMREADOOB _IOWR('M', 4, struct mtd_oob_buf) /* Lock a chip (for MTD that supports it) */ #define MEMLOCK _IOW('M', 5, struct erase_info_user) /* Unlock a chip (for MTD that supports it) */ #define MEMUNLOCK _IOW('M', 6, struct erase_info_user) /* Get the number of different erase regions */ #define MEMGETREGIONCOUNT _IOR('M', 7, int) /* Get information about the erase region for a specific index */ #define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user) /* Get info about OOB modes (e.g., RAW, PLACE, AUTO) - legacy interface */ #define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo) /* Check if an eraseblock is bad */ #define MEMGETBADBLOCK _IOW('M', 11, __kernel_loff_t) /* Mark an eraseblock as bad */ #define MEMSETBADBLOCK _IOW('M', 12, __kernel_loff_t) /* Set OTP (One-Time Programmable) mode (factory vs. user) */ #define OTPSELECT _IOR('M', 13, int) /* Get number of OTP (One-Time Programmable) regions */ #define OTPGETREGIONCOUNT _IOW('M', 14, int) /* Get all OTP (One-Time Programmable) info about MTD */ #define OTPGETREGIONINFO _IOW('M', 15, struct otp_info) /* Lock a given range of user data (must be in mode %MTD_FILE_MODE_OTP_USER) */ #define OTPLOCK _IOR('M', 16, struct otp_info) /* Get ECC layout (deprecated) */ #define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout_user) /* Get statistics about corrected/uncorrected errors */ #define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats) /* Set MTD mode on a per-file-descriptor basis (see "MTD file modes") */ #define MTDFILEMODE _IO('M', 19) /* Erase segment of MTD (supports 64-bit address) */ #define MEMERASE64 _IOW('M', 20, struct erase_info_user64) /* Write data to OOB (64-bit version) */ #define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64) /* Read data from OOB (64-bit version) */ #define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64) /* Check if chip is locked (for MTD that supports it) */ #define MEMISLOCKED _IOR('M', 23, struct erase_info_user) /* * Most generic write interface; can write in-band and/or out-of-band in various * modes (see "struct mtd_write_req"). This ioctl is not supported for flashes * without OOB, e.g., NOR flash. */ #define MEMWRITE _IOWR('M', 24, struct mtd_write_req) /* * Obsolete legacy interface. Keep it in order not to break userspace * interfaces */ struct nand_oobinfo { __u32 useecc; __u32 eccbytes; __u32 oobfree[8][2]; __u32 eccpos[32]; }; struct nand_oobfree { __u32 offset; __u32 length; }; #define MTD_MAX_OOBFREE_ENTRIES 8 #define MTD_MAX_ECCPOS_ENTRIES 64 /* * OBSOLETE: ECC layout control structure. Exported to user-space via ioctl * ECCGETLAYOUT for backwards compatbility and should not be mistaken as a * complete set of ECC information. The ioctl truncates the larger internal * structure to retain binary compatibility with the static declaration of the * ioctl. Note that the "MTD_MAX_..._ENTRIES" macros represent the max size of * the user struct, not the MAX size of the internal OOB layout representation. */ struct nand_ecclayout_user { __u32 eccbytes; __u32 eccpos[MTD_MAX_ECCPOS_ENTRIES]; __u32 oobavail; struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES]; }; /** * struct mtd_ecc_stats - error correction stats * * @corrected: number of corrected bits * @failed: number of uncorrectable errors * @badblocks: number of bad blocks in this partition * @bbtblocks: number of blocks reserved for bad block tables */ struct mtd_ecc_stats { __u32 corrected; __u32 failed; __u32 badblocks; __u32 bbtblocks; }; /* * MTD file modes - for read/write access to MTD * * @MTD_FILE_MODE_NORMAL: OTP disabled, ECC enabled * @MTD_FILE_MODE_OTP_FACTORY: OTP enabled in factory mode * @MTD_FILE_MODE_OTP_USER: OTP enabled in user mode * @MTD_FILE_MODE_RAW: OTP disabled, ECC disabled * * These modes can be set via ioctl(MTDFILEMODE). The mode mode will be retained * separately for each open file descriptor. * * Note: %MTD_FILE_MODE_RAW provides the same functionality as %MTD_OPS_RAW - * raw access to the flash, without error correction or autoplacement schemes. * Wherever possible, the MTD_OPS_* mode will override the MTD_FILE_MODE_* mode * (e.g., when using ioctl(MEMWRITE)), but in some cases, the MTD_FILE_MODE is * used out of necessity (e.g., `write()', ioctl(MEMWRITEOOB64)). */ enum mtd_file_modes { MTD_FILE_MODE_NORMAL = MTD_OTP_OFF, MTD_FILE_MODE_OTP_FACTORY = MTD_OTP_FACTORY, MTD_FILE_MODE_OTP_USER = MTD_OTP_USER, MTD_FILE_MODE_RAW, }; static __inline__ int mtd_type_is_nand_user(const struct mtd_info_user *mtd) { return mtd->type == MTD_NANDFLASH || mtd->type == MTD_MLCNANDFLASH; } #endif /* __MTD_ABI_H__ */ �����������mtd/mtd-user.h��������������������������������������������������������������������������������������0000644�����������������00000002332�14763166027�0007255 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> * * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef __MTD_USER_H__ #define __MTD_USER_H__ /* This file is blessed for inclusion by userspace */ #include <mtd/mtd-abi.h> typedef struct mtd_info_user mtd_info_t; typedef struct erase_info_user erase_info_t; typedef struct region_info_user region_info_t; typedef struct nand_oobinfo nand_oobinfo_t; typedef struct nand_ecclayout_user nand_ecclayout_t; #endif /* __MTD_USER_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mtd/ubi-user.h��������������������������������������������������������������������������������������0000644�����������������00000043134�14763166027�0007255 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright © International Business Machines Corp., 2006 * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Artem Bityutskiy (Битюцкий Артём) */ #ifndef __UBI_USER_H__ #define __UBI_USER_H__ #include <linux/types.h> /* * UBI device creation (the same as MTD device attachment) * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * MTD devices may be attached using %UBI_IOCATT ioctl command of the UBI * control device. The caller has to properly fill and pass * &struct ubi_attach_req object - UBI will attach the MTD device specified in * the request and return the newly created UBI device number as the ioctl * return value. * * UBI device deletion (the same as MTD device detachment) * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * An UBI device maybe deleted with %UBI_IOCDET ioctl command of the UBI * control device. * * UBI volume creation * ~~~~~~~~~~~~~~~~~~~ * * UBI volumes are created via the %UBI_IOCMKVOL ioctl command of UBI character * device. A &struct ubi_mkvol_req object has to be properly filled and a * pointer to it has to be passed to the ioctl. * * UBI volume deletion * ~~~~~~~~~~~~~~~~~~~ * * To delete a volume, the %UBI_IOCRMVOL ioctl command of the UBI character * device should be used. A pointer to the 32-bit volume ID hast to be passed * to the ioctl. * * UBI volume re-size * ~~~~~~~~~~~~~~~~~~ * * To re-size a volume, the %UBI_IOCRSVOL ioctl command of the UBI character * device should be used. A &struct ubi_rsvol_req object has to be properly * filled and a pointer to it has to be passed to the ioctl. * * UBI volumes re-name * ~~~~~~~~~~~~~~~~~~~ * * To re-name several volumes atomically at one go, the %UBI_IOCRNVOL command * of the UBI character device should be used. A &struct ubi_rnvol_req object * has to be properly filled and a pointer to it has to be passed to the ioctl. * * UBI volume update * ~~~~~~~~~~~~~~~~~ * * Volume update should be done via the %UBI_IOCVOLUP ioctl command of the * corresponding UBI volume character device. A pointer to a 64-bit update * size should be passed to the ioctl. After this, UBI expects user to write * this number of bytes to the volume character device. The update is finished * when the claimed number of bytes is passed. So, the volume update sequence * is something like: * * fd = open("/dev/my_volume"); * ioctl(fd, UBI_IOCVOLUP, &image_size); * write(fd, buf, image_size); * close(fd); * * Logical eraseblock erase * ~~~~~~~~~~~~~~~~~~~~~~~~ * * To erase a logical eraseblock, the %UBI_IOCEBER ioctl command of the * corresponding UBI volume character device should be used. This command * unmaps the requested logical eraseblock, makes sure the corresponding * physical eraseblock is successfully erased, and returns. * * Atomic logical eraseblock change * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * Atomic logical eraseblock change operation is called using the %UBI_IOCEBCH * ioctl command of the corresponding UBI volume character device. A pointer to * a &struct ubi_leb_change_req object has to be passed to the ioctl. Then the * user is expected to write the requested amount of bytes (similarly to what * should be done in case of the "volume update" ioctl). * * Logical eraseblock map * ~~~~~~~~~~~~~~~~~~~~~ * * To map a logical eraseblock to a physical eraseblock, the %UBI_IOCEBMAP * ioctl command should be used. A pointer to a &struct ubi_map_req object is * expected to be passed. The ioctl maps the requested logical eraseblock to * a physical eraseblock and returns. Only non-mapped logical eraseblocks can * be mapped. If the logical eraseblock specified in the request is already * mapped to a physical eraseblock, the ioctl fails and returns error. * * Logical eraseblock unmap * ~~~~~~~~~~~~~~~~~~~~~~~~ * * To unmap a logical eraseblock to a physical eraseblock, the %UBI_IOCEBUNMAP * ioctl command should be used. The ioctl unmaps the logical eraseblocks, * schedules corresponding physical eraseblock for erasure, and returns. Unlike * the "LEB erase" command, it does not wait for the physical eraseblock being * erased. Note, the side effect of this is that if an unclean reboot happens * after the unmap ioctl returns, you may find the LEB mapped again to the same * physical eraseblock after the UBI is run again. * * Check if logical eraseblock is mapped * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * To check if a logical eraseblock is mapped to a physical eraseblock, the * %UBI_IOCEBISMAP ioctl command should be used. It returns %0 if the LEB is * not mapped, and %1 if it is mapped. * * Set an UBI volume property * ~~~~~~~~~~~~~~~~~~~~~~~~~ * * To set an UBI volume property the %UBI_IOCSETPROP ioctl command should be * used. A pointer to a &struct ubi_set_vol_prop_req object is expected to be * passed. The object describes which property should be set, and to which value * it should be set. * * Block devices on UBI volumes * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * To create a R/O block device on top of an UBI volume the %UBI_IOCVOLCRBLK * should be used. A pointer to a &struct ubi_blkcreate_req object is expected * to be passed, which is not used and reserved for future usage. * * Conversely, to remove a block device the %UBI_IOCVOLRMBLK should be used, * which takes no arguments. */ /* * When a new UBI volume or UBI device is created, users may either specify the * volume/device number they want to create or to let UBI automatically assign * the number using these constants. */ #define UBI_VOL_NUM_AUTO (-1) #define UBI_DEV_NUM_AUTO (-1) /* Maximum volume name length */ #define UBI_MAX_VOLUME_NAME 127 /* ioctl commands of UBI character devices */ #define UBI_IOC_MAGIC 'o' /* Create an UBI volume */ #define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req) /* Remove an UBI volume */ #define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, __s32) /* Re-size an UBI volume */ #define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req) /* Re-name volumes */ #define UBI_IOCRNVOL _IOW(UBI_IOC_MAGIC, 3, struct ubi_rnvol_req) /* ioctl commands of the UBI control character device */ #define UBI_CTRL_IOC_MAGIC 'o' /* Attach an MTD device */ #define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req) /* Detach an MTD device */ #define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, __s32) /* ioctl commands of UBI volume character devices */ #define UBI_VOL_IOC_MAGIC 'O' /* Start UBI volume update * Note: This actually takes a pointer (__s64*), but we can't change * that without breaking the ABI on 32bit systems */ #define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, __s64) /* LEB erasure command, used for debugging, disabled by default */ #define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, __s32) /* Atomic LEB change command */ #define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, __s32) /* Map LEB command */ #define UBI_IOCEBMAP _IOW(UBI_VOL_IOC_MAGIC, 3, struct ubi_map_req) /* Unmap LEB command */ #define UBI_IOCEBUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, __s32) /* Check if LEB is mapped command */ #define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, __s32) /* Set an UBI volume property */ #define UBI_IOCSETVOLPROP _IOW(UBI_VOL_IOC_MAGIC, 6, \ struct ubi_set_vol_prop_req) /* Create a R/O block device on top of an UBI volume */ #define UBI_IOCVOLCRBLK _IOW(UBI_VOL_IOC_MAGIC, 7, struct ubi_blkcreate_req) /* Remove the R/O block device */ #define UBI_IOCVOLRMBLK _IO(UBI_VOL_IOC_MAGIC, 8) /* Maximum MTD device name length supported by UBI */ #define MAX_UBI_MTD_NAME_LEN 127 /* Maximum amount of UBI volumes that can be re-named at one go */ #define UBI_MAX_RNVOL 32 /* * UBI volume type constants. * * @UBI_DYNAMIC_VOLUME: dynamic volume * @UBI_STATIC_VOLUME: static volume */ enum { UBI_DYNAMIC_VOLUME = 3, UBI_STATIC_VOLUME = 4, }; /* * UBI set volume property ioctl constants. * * @UBI_VOL_PROP_DIRECT_WRITE: allow (any non-zero value) or disallow (value 0) * user to directly write and erase individual * eraseblocks on dynamic volumes */ enum { UBI_VOL_PROP_DIRECT_WRITE = 1, }; /** * struct ubi_attach_req - attach MTD device request. * @ubi_num: UBI device number to create * @mtd_num: MTD device number to attach * @vid_hdr_offset: VID header offset (use defaults if %0) * @max_beb_per1024: maximum expected number of bad PEB per 1024 PEBs * @padding: reserved for future, not used, has to be zeroed * * This data structure is used to specify MTD device UBI has to attach and the * parameters it has to use. The number which should be assigned to the new UBI * device is passed in @ubi_num. UBI may automatically assign the number if * @UBI_DEV_NUM_AUTO is passed. In this case, the device number is returned in * @ubi_num. * * Most applications should pass %0 in @vid_hdr_offset to make UBI use default * offset of the VID header within physical eraseblocks. The default offset is * the next min. I/O unit after the EC header. For example, it will be offset * 512 in case of a 512 bytes page NAND flash with no sub-page support. Or * it will be 512 in case of a 2KiB page NAND flash with 4 512-byte sub-pages. * * But in rare cases, if this optimizes things, the VID header may be placed to * a different offset. For example, the boot-loader might do things faster if * the VID header sits at the end of the first 2KiB NAND page with 4 sub-pages. * As the boot-loader would not normally need to read EC headers (unless it * needs UBI in RW mode), it might be faster to calculate ECC. This is weird * example, but it real-life example. So, in this example, @vid_hdr_offer would * be 2KiB-64 bytes = 1984. Note, that this position is not even 512-bytes * aligned, which is OK, as UBI is clever enough to realize this is 4th * sub-page of the first page and add needed padding. * * The @max_beb_per1024 is the maximum amount of bad PEBs UBI expects on the * UBI device per 1024 eraseblocks. This value is often given in an other form * in the NAND datasheet (min NVB i.e. minimal number of valid blocks). The * maximum expected bad eraseblocks per 1024 is then: * 1024 * (1 - MinNVB / MaxNVB) * Which gives 20 for most NAND devices. This limit is used in order to derive * amount of eraseblock UBI reserves for handling new bad blocks. If the device * has more bad eraseblocks than this limit, UBI does not reserve any physical * eraseblocks for new bad eraseblocks, but attempts to use available * eraseblocks (if any). The accepted range is 0-768. If 0 is given, the * default kernel value of %CONFIG_MTD_UBI_BEB_LIMIT will be used. */ struct ubi_attach_req { __s32 ubi_num; __s32 mtd_num; __s32 vid_hdr_offset; __s16 max_beb_per1024; __s8 padding[10]; }; /* * UBI volume flags. * * @UBI_VOL_SKIP_CRC_CHECK_FLG: skip the CRC check done on a static volume at * open time. Only valid for static volumes and * should only be used if the volume user has a * way to verify data integrity */ enum { UBI_VOL_SKIP_CRC_CHECK_FLG = 0x1, }; #define UBI_VOL_VALID_FLGS (UBI_VOL_SKIP_CRC_CHECK_FLG) /** * struct ubi_mkvol_req - volume description data structure used in * volume creation requests. * @vol_id: volume number * @alignment: volume alignment * @bytes: volume size in bytes * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME) * @flags: volume flags (%UBI_VOL_SKIP_CRC_CHECK_FLG) * @name_len: volume name length * @padding2: reserved for future, not used, has to be zeroed * @name: volume name * * This structure is used by user-space programs when creating new volumes. The * @used_bytes field is only necessary when creating static volumes. * * The @alignment field specifies the required alignment of the volume logical * eraseblock. This means, that the size of logical eraseblocks will be aligned * to this number, i.e., * (UBI device logical eraseblock size) mod (@alignment) = 0. * * To put it differently, the logical eraseblock of this volume may be slightly * shortened in order to make it properly aligned. The alignment has to be * multiple of the flash minimal input/output unit, or %1 to utilize the entire * available space of logical eraseblocks. * * The @alignment field may be useful, for example, when one wants to maintain * a block device on top of an UBI volume. In this case, it is desirable to fit * an integer number of blocks in logical eraseblocks of this UBI volume. With * alignment it is possible to update this volume using plane UBI volume image * BLOBs, without caring about how to properly align them. */ struct ubi_mkvol_req { __s32 vol_id; __s32 alignment; __s64 bytes; __s8 vol_type; __u8 flags; __s16 name_len; __s8 padding2[4]; char name[UBI_MAX_VOLUME_NAME + 1]; } __attribute__((packed)); /** * struct ubi_rsvol_req - a data structure used in volume re-size requests. * @vol_id: ID of the volume to re-size * @bytes: new size of the volume in bytes * * Re-sizing is possible for both dynamic and static volumes. But while dynamic * volumes may be re-sized arbitrarily, static volumes cannot be made to be * smaller than the number of bytes they bear. To arbitrarily shrink a static * volume, it must be wiped out first (by means of volume update operation with * zero number of bytes). */ struct ubi_rsvol_req { __s64 bytes; __s32 vol_id; } __attribute__((packed)); /** * struct ubi_rnvol_req - volumes re-name request. * @count: count of volumes to re-name * @padding1: reserved for future, not used, has to be zeroed * @vol_id: ID of the volume to re-name * @name_len: name length * @padding2: reserved for future, not used, has to be zeroed * @name: new volume name * * UBI allows to re-name up to %32 volumes at one go. The count of volumes to * re-name is specified in the @count field. The ID of the volumes to re-name * and the new names are specified in the @vol_id and @name fields. * * The UBI volume re-name operation is atomic, which means that should power cut * happen, the volumes will have either old name or new name. So the possible * use-cases of this command is atomic upgrade. Indeed, to upgrade, say, volumes * A and B one may create temporary volumes %A1 and %B1 with the new contents, * then atomically re-name A1->A and B1->B, in which case old %A and %B will * be removed. * * If it is not desirable to remove old A and B, the re-name request has to * contain 4 entries: A1->A, A->A1, B1->B, B->B1, in which case old A1 and B1 * become A and B, and old A and B will become A1 and B1. * * It is also OK to request: A1->A, A1->X, B1->B, B->Y, in which case old A1 * and B1 become A and B, and old A and B become X and Y. * * In other words, in case of re-naming into an existing volume name, the * existing volume is removed, unless it is re-named as well at the same * re-name request. */ struct ubi_rnvol_req { __s32 count; __s8 padding1[12]; struct { __s32 vol_id; __s16 name_len; __s8 padding2[2]; char name[UBI_MAX_VOLUME_NAME + 1]; } ents[UBI_MAX_RNVOL]; } __attribute__((packed)); /** * struct ubi_leb_change_req - a data structure used in atomic LEB change * requests. * @lnum: logical eraseblock number to change * @bytes: how many bytes will be written to the logical eraseblock * @dtype: pass "3" for better compatibility with old kernels * @padding: reserved for future, not used, has to be zeroed * * The @dtype field used to inform UBI about what kind of data will be written * to the LEB: long term (value 1), short term (value 2), unknown (value 3). * UBI tried to pick a PEB with lower erase counter for short term data and a * PEB with higher erase counter for long term data. But this was not really * used because users usually do not know this and could easily mislead UBI. We * removed this feature in May 2012. UBI currently just ignores the @dtype * field. But for better compatibility with older kernels it is recommended to * set @dtype to 3 (unknown). */ struct ubi_leb_change_req { __s32 lnum; __s32 bytes; __s8 dtype; /* obsolete, do not use! */ __s8 padding[7]; } __attribute__((packed)); /** * struct ubi_map_req - a data structure used in map LEB requests. * @dtype: pass "3" for better compatibility with old kernels * @lnum: logical eraseblock number to unmap * @padding: reserved for future, not used, has to be zeroed */ struct ubi_map_req { __s32 lnum; __s8 dtype; /* obsolete, do not use! */ __s8 padding[3]; } __attribute__((packed)); /** * struct ubi_set_vol_prop_req - a data structure used to set an UBI volume * property. * @property: property to set (%UBI_VOL_PROP_DIRECT_WRITE) * @padding: reserved for future, not used, has to be zeroed * @value: value to set */ struct ubi_set_vol_prop_req { __u8 property; __u8 padding[7]; __u64 value; } __attribute__((packed)); /** * struct ubi_blkcreate_req - a data structure used in block creation requests. * @padding: reserved for future, not used, has to be zeroed */ struct ubi_blkcreate_req { __s8 padding[128]; } __attribute__((packed)); #endif /* __UBI_USER_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������fts.h�����������������������������������������������������������������������������������������������0000644�����������������00000012252�14763166027�0005527 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)fts.h 8.3 (Berkeley) 8/14/94 */ #ifndef _FTS_H #define _FTS_H 1 #include <features.h> #include <sys/types.h> /* The fts interface is incompatible with the LFS interface which transparently uses the 64-bit file access functions. */ #ifdef __USE_FILE_OFFSET64 # error "<fts.h> cannot be used with -D_FILE_OFFSET_BITS==64" #endif typedef struct { struct _ftsent *fts_cur; /* current node */ struct _ftsent *fts_child; /* linked list of children */ struct _ftsent **fts_array; /* sort array */ dev_t fts_dev; /* starting device # */ char *fts_path; /* path for this descent */ int fts_rfd; /* fd for root */ int fts_pathlen; /* sizeof(path) */ int fts_nitems; /* elements in the sort array */ int (*fts_compar) (const void *, const void *); /* compare fn */ #define FTS_COMFOLLOW 0x0001 /* follow command line symlinks */ #define FTS_LOGICAL 0x0002 /* logical walk */ #define FTS_NOCHDIR 0x0004 /* don't change directories */ #define FTS_NOSTAT 0x0008 /* don't get stat info */ #define FTS_PHYSICAL 0x0010 /* physical walk */ #define FTS_SEEDOT 0x0020 /* return dot and dot-dot */ #define FTS_XDEV 0x0040 /* don't cross devices */ #define FTS_WHITEOUT 0x0080 /* return whiteout information */ #define FTS_OPTIONMASK 0x00ff /* valid user option mask */ #define FTS_NAMEONLY 0x0100 /* (private) child names only */ #define FTS_STOP 0x0200 /* (private) unrecoverable error */ int fts_options; /* fts_open options, global flags */ } FTS; typedef struct _ftsent { struct _ftsent *fts_cycle; /* cycle node */ struct _ftsent *fts_parent; /* parent directory */ struct _ftsent *fts_link; /* next file in directory */ long fts_number; /* local numeric value */ void *fts_pointer; /* local address value */ char *fts_accpath; /* access path */ char *fts_path; /* root path */ int fts_errno; /* errno for this node */ int fts_symfd; /* fd for symlink */ u_short fts_pathlen; /* strlen(fts_path) */ u_short fts_namelen; /* strlen(fts_name) */ ino_t fts_ino; /* inode */ dev_t fts_dev; /* device */ nlink_t fts_nlink; /* link count */ #define FTS_ROOTPARENTLEVEL -1 #define FTS_ROOTLEVEL 0 short fts_level; /* depth (-1 to N) */ #define FTS_D 1 /* preorder directory */ #define FTS_DC 2 /* directory that causes cycles */ #define FTS_DEFAULT 3 /* none of the above */ #define FTS_DNR 4 /* unreadable directory */ #define FTS_DOT 5 /* dot or dot-dot */ #define FTS_DP 6 /* postorder directory */ #define FTS_ERR 7 /* error; errno is set */ #define FTS_F 8 /* regular file */ #define FTS_INIT 9 /* initialized only */ #define FTS_NS 10 /* stat(2) failed */ #define FTS_NSOK 11 /* no stat(2) requested */ #define FTS_SL 12 /* symbolic link */ #define FTS_SLNONE 13 /* symbolic link without target */ #define FTS_W 14 /* whiteout object */ u_short fts_info; /* user flags for FTSENT structure */ #define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */ #define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */ u_short fts_flags; /* private flags for FTSENT structure */ #define FTS_AGAIN 1 /* read node again */ #define FTS_FOLLOW 2 /* follow symbolic link */ #define FTS_NOINSTR 3 /* no instructions */ #define FTS_SKIP 4 /* discard node */ u_short fts_instr; /* fts_set() instructions */ struct stat *fts_statp; /* stat(2) information */ char fts_name[1]; /* file name */ } FTSENT; __BEGIN_DECLS FTSENT *fts_children (FTS *, int); int fts_close (FTS *); FTS *fts_open (char * const *, int, int (*)(const FTSENT **, const FTSENT **)); FTSENT *fts_read (FTS *); int fts_set (FTS *, FTSENT *, int) __THROW; __END_DECLS #endif /* fts.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tiffvers.h������������������������������������������������������������������������������������������0000644�����������������00000000632�14763166027�0006562 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.0.3\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc." /* * This define can be used in code that requires * compilation-related definitions specific to a * version or versions of the library. Runtime * version checking should be done based on the * string returned by TIFFGetVersion. */ #define TIFFLIB_VERSION 20120922 ������������������������������������������������������������������������������������������������������assert.h��������������������������������������������������������������������������������������������0000644�����������������00000007031�14763166027�0006233 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991,1992,1994-2001,2003,2004,2007,2011,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 Standard: 7.2 Diagnostics <assert.h> */ #ifdef _ASSERT_H # undef _ASSERT_H # undef assert # undef __ASSERT_VOID_CAST # ifdef __USE_GNU # undef assert_perror # endif #endif /* assert.h */ #define _ASSERT_H 1 #include <features.h> #if defined __cplusplus && __GNUC_PREREQ (2,95) # define __ASSERT_VOID_CAST static_cast<void> #else # define __ASSERT_VOID_CAST (void) #endif /* void assert (int expression); If NDEBUG is defined, do nothing. If not, and EXPRESSION is zero, print an error message and abort. */ #ifdef NDEBUG # define assert(expr) (__ASSERT_VOID_CAST (0)) /* void assert_perror (int errnum); If NDEBUG is defined, do nothing. If not, and ERRNUM is not zero, print an error message with the error text for ERRNUM and abort. (This is a GNU extension.) */ # ifdef __USE_GNU # define assert_perror(errnum) (__ASSERT_VOID_CAST (0)) # endif #else /* Not NDEBUG. */ __BEGIN_DECLS /* This prints an "Assertion failed" message and aborts. */ extern void __assert_fail (const char *__assertion, const char *__file, unsigned int __line, const char *__function) __THROW __attribute__ ((__noreturn__)); /* Likewise, but prints the error text for ERRNUM. */ extern void __assert_perror_fail (int __errnum, const char *__file, unsigned int __line, const char *__function) __THROW __attribute__ ((__noreturn__)); /* The following is not at all used here but needed for standard compliance. */ extern void __assert (const char *__assertion, const char *__file, int __line) __THROW __attribute__ ((__noreturn__)); __END_DECLS # define assert(expr) \ ((expr) \ ? __ASSERT_VOID_CAST (0) \ : __assert_fail (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCTION)) # ifdef __USE_GNU # define assert_perror(errnum) \ (!(errnum) \ ? __ASSERT_VOID_CAST (0) \ : __assert_perror_fail ((errnum), __FILE__, __LINE__, __ASSERT_FUNCTION)) # endif /* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__' which contains the name of the function currently being defined. This is broken in G++ before version 2.6. C9x has a similar variable called __func__, but prefer the GCC one since it demangles C++ function names. */ # if defined __cplusplus ? __GNUC_PREREQ (2, 6) : __GNUC_PREREQ (2, 4) # define __ASSERT_FUNCTION __PRETTY_FUNCTION__ # else # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L # define __ASSERT_FUNCTION __func__ # else # define __ASSERT_FUNCTION ((const char *) 0) # endif # endif #endif /* NDEBUG. */ #if defined __USE_ISOC11 && !defined __cplusplus /* Static assertion. Requires support in the compiler. */ # undef static_assert # define static_assert _Static_assert #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������utime.h���������������������������������������������������������������������������������������������0000644�����������������00000002773�14763166027�0006065 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-1992,1996-1999,2004,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 5.6.6 Set File Access and Modification Times <utime.h> */ #ifndef _UTIME_H #define _UTIME_H 1 #include <features.h> __BEGIN_DECLS #include <bits/types.h> #if defined __USE_XOPEN || defined __USE_XOPEN2K # define __need_time_t # include <time.h> #endif /* Structure describing file times. */ struct utimbuf { __time_t actime; /* Access time. */ __time_t modtime; /* Modification time. */ }; /* Set the access and modification times of FILE to those given in *FILE_TIMES. If FILE_TIMES is NULL, set them to the current time. */ extern int utime (const char *__file, const struct utimbuf *__file_times) __THROW __nonnull ((1)); __END_DECLS #endif /* utime.h */ �����ecpg_config.h���������������������������������������������������������������������������������������0000644�����������������00000002026�14763166027�0007174 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Kluge to support multilib installation of both 32- and 64-bit RPMS: * we need to arrange that header files that appear in both RPMs are * identical. Hence, this file is architecture-independent and calls * in an arch-dependent file that will appear in just one RPM. * * To avoid breaking arches not explicitly supported by Red Hat, we * use this indirection file *only* on known multilib arches. * * Note: this may well fail if user tries to use gcc's -I- option. * But that option is deprecated anyway. */ #if defined(__x86_64__) #include "ecpg_config_x86_64.h" #elif defined(__i386__) #include "ecpg_config_i386.h" #elif defined(__ppc64__) || defined(__powerpc64__) #include "ecpg_config_ppc64.h" #elif defined(__ppc__) || defined(__powerpc__) #include "ecpg_config_ppc.h" #elif defined(__s390x__) #include "ecpg_config_s390x.h" #elif defined(__s390__) #include "ecpg_config_s390.h" #elif defined(__sparc__) && defined(__arch64__) #include "ecpg_config_sparc64.h" #elif defined(__sparc__) #include "ecpg_config_sparc.h" #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������jconfig.h�������������������������������������������������������������������������������������������0000644�����������������00000003312�14763166027�0006347 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* jconfig.h. Generated from jconfig.h.in by configure. */ /* Version ID for the JPEG library. * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60". */ #define JPEG_LIB_VERSION 62 /* libjpeg-turbo version */ #define LIBJPEG_TURBO_VERSION 1.2.90 /* Support arithmetic encoding */ #define C_ARITH_CODING_SUPPORTED 1 /* Support arithmetic decoding */ #define D_ARITH_CODING_SUPPORTED 1 /* Support in-memory source/destination managers */ #define MEM_SRCDST_SUPPORTED 1 /* Compiler supports function prototypes. */ #define HAVE_PROTOTYPES 1 /* Define to 1 if you have the <stddef.h> header file. */ #define HAVE_STDDEF_H 1 /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 /* Compiler supports 'unsigned char'. */ #define HAVE_UNSIGNED_CHAR 1 /* Compiler supports 'unsigned short'. */ #define HAVE_UNSIGNED_SHORT 1 /* Compiler does not support pointers to unspecified structures. */ /* #undef INCOMPLETE_TYPES_BROKEN */ /* Compiler has <strings.h> rather than standard <string.h>. */ /* #undef NEED_BSD_STRINGS */ /* Linker requires that global names be unique in first 15 characters. */ /* #undef NEED_SHORT_EXTERNAL_NAMES */ /* Need to include <sys/types.h> in order to obtain size_t. */ #define NEED_SYS_TYPES_H 1 /* Broken compiler shifts signed values as an unsigned shift. */ /* #undef RIGHT_SHIFT_IS_UNSIGNED */ /* Use accelerated SIMD routines. */ #define WITH_SIMD 1 /* Define to 1 if type `char' is unsigned and you are not using gcc. */ #ifndef __CHAR_UNSIGNED__ /* # undef __CHAR_UNSIGNED__ */ #endif /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ /* Define to `unsigned int' if <sys/types.h> does not define. */ /* #undef size_t */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������limits.h��������������������������������������������������������������������������������������������0000644�����������������00000010661�14763166027�0006236 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991, 1992, 1996, 1997, 1998, 1999, 2000, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 Standard: 7.10/5.2.4.2.1 Sizes of integer types <limits.h> */ #ifndef _LIBC_LIMITS_H_ #define _LIBC_LIMITS_H_ 1 #include <features.h> /* Maximum length of any multibyte character in any locale. We define this value here since the gcc header does not define the correct value. */ #define MB_LEN_MAX 16 /* If we are not using GNU CC we have to define all the symbols ourself. Otherwise use gcc's definitions (see below). */ #if !defined __GNUC__ || __GNUC__ < 2 /* We only protect from multiple inclusion here, because all the other #include's protect themselves, and in GCC 2 we may #include_next through multiple copies of this file before we get to GCC's. */ # ifndef _LIMITS_H # define _LIMITS_H 1 #include <bits/wordsize.h> /* We don't have #include_next. Define ANSI <limits.h> for standard 32-bit words. */ /* These assume 8-bit `char's, 16-bit `short int's, and 32-bit `int's and `long int's. */ /* Number of bits in a `char'. */ # define CHAR_BIT 8 /* Minimum and maximum values a `signed char' can hold. */ # define SCHAR_MIN (-128) # define SCHAR_MAX 127 /* Maximum value an `unsigned char' can hold. (Minimum is 0.) */ # define UCHAR_MAX 255 /* Minimum and maximum values a `char' can hold. */ # ifdef __CHAR_UNSIGNED__ # define CHAR_MIN 0 # define CHAR_MAX UCHAR_MAX # else # define CHAR_MIN SCHAR_MIN # define CHAR_MAX SCHAR_MAX # endif /* Minimum and maximum values a `signed short int' can hold. */ # define SHRT_MIN (-32768) # define SHRT_MAX 32767 /* Maximum value an `unsigned short int' can hold. (Minimum is 0.) */ # define USHRT_MAX 65535 /* Minimum and maximum values a `signed int' can hold. */ # define INT_MIN (-INT_MAX - 1) # define INT_MAX 2147483647 /* Maximum value an `unsigned int' can hold. (Minimum is 0.) */ # define UINT_MAX 4294967295U /* Minimum and maximum values a `signed long int' can hold. */ # if __WORDSIZE == 64 # define LONG_MAX 9223372036854775807L # else # define LONG_MAX 2147483647L # endif # define LONG_MIN (-LONG_MAX - 1L) /* Maximum value an `unsigned long int' can hold. (Minimum is 0.) */ # if __WORDSIZE == 64 # define ULONG_MAX 18446744073709551615UL # else # define ULONG_MAX 4294967295UL # endif # ifdef __USE_ISOC99 /* Minimum and maximum values a `signed long long int' can hold. */ # define LLONG_MAX 9223372036854775807LL # define LLONG_MIN (-LLONG_MAX - 1LL) /* Maximum value an `unsigned long long int' can hold. (Minimum is 0.) */ # define ULLONG_MAX 18446744073709551615ULL # endif /* ISO C99 */ # endif /* limits.h */ #endif /* GCC 2. */ #endif /* !_LIBC_LIMITS_H_ */ /* Get the compiler's limits.h, which defines almost all the ISO constants. We put this #include_next outside the double inclusion check because it should be possible to include this file more than once and still get the definitions from gcc's header. */ #if defined __GNUC__ && !defined _GCC_LIMITS_H_ /* `_GCC_LIMITS_H_' is what GCC's file defines. */ # include_next <limits.h> #endif /* The <limits.h> files in some gcc versions don't define LLONG_MIN, LLONG_MAX, and ULLONG_MAX. Instead only the values gcc defined for ages are available. */ #if defined __USE_ISOC99 && defined __GNUC__ # ifndef LLONG_MIN # define LLONG_MIN (-LLONG_MAX-1) # endif # ifndef LLONG_MAX # define LLONG_MAX __LONG_LONG_MAX__ # endif # ifndef ULLONG_MAX # define ULLONG_MAX (LLONG_MAX * 2ULL + 1) # endif #endif #ifdef __USE_POSIX /* POSIX adds things to <limits.h>. */ # include <bits/posix1_lim.h> #endif #ifdef __USE_POSIX2 # include <bits/posix2_lim.h> #endif #ifdef __USE_XOPEN # include <bits/xopen_lim.h> #endif �������������������������������������������������������������������������������fenv.h����������������������������������������������������������������������������������������������0000644�����������������00000010773�14763166027�0005677 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997, 1999, 2000, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 7.6: Floating-point environment <fenv.h> */ #ifndef _FENV_H #define _FENV_H 1 #include <features.h> /* Get the architecture dependend definitions. The following definitions are expected to be done: fenv_t type for object representing an entire floating-point environment FE_DFL_ENV macro of type pointer to fenv_t to be used as the argument to functions taking an argument of type fenv_t; in this case the default environment will be used fexcept_t type for object representing the floating-point exception flags including status associated with the flags The following macros are defined iff the implementation supports this kind of exception. FE_INEXACT inexact result FE_DIVBYZERO division by zero FE_UNDERFLOW result not representable due to underflow FE_OVERFLOW result not representable due to overflow FE_INVALID invalid operation FE_ALL_EXCEPT bitwise OR of all supported exceptions The next macros are defined iff the appropriate rounding mode is supported by the implementation. FE_TONEAREST round to nearest FE_UPWARD round toward +Inf FE_DOWNWARD round toward -Inf FE_TOWARDZERO round toward 0 */ #include <bits/fenv.h> __BEGIN_DECLS /* Floating-point exception handling. */ /* Clear the supported exceptions represented by EXCEPTS. */ extern int feclearexcept (int __excepts) __THROW; /* Store implementation-defined representation of the exception flags indicated by EXCEPTS in the object pointed to by FLAGP. */ extern int fegetexceptflag (fexcept_t *__flagp, int __excepts) __THROW; /* Raise the supported exceptions represented by EXCEPTS. */ extern int feraiseexcept (int __excepts) __THROW; /* Set complete status for exceptions indicated by EXCEPTS according to the representation in the object pointed to by FLAGP. */ extern int fesetexceptflag (const fexcept_t *__flagp, int __excepts) __THROW; /* Determine which of subset of the exceptions specified by EXCEPTS are currently set. */ extern int fetestexcept (int __excepts) __THROW; /* Rounding control. */ /* Get current rounding direction. */ extern int fegetround (void) __THROW; /* Establish the rounding direction represented by ROUND. */ extern int fesetround (int __rounding_direction) __THROW; /* Floating-point environment. */ /* Store the current floating-point environment in the object pointed to by ENVP. */ extern int fegetenv (fenv_t *__envp) __THROW; /* Save the current environment in the object pointed to by ENVP, clear exception flags and install a non-stop mode (if available) for all exceptions. */ extern int feholdexcept (fenv_t *__envp) __THROW; /* Establish the floating-point environment represented by the object pointed to by ENVP. */ extern int fesetenv (const fenv_t *__envp) __THROW; /* Save current exceptions in temporary storage, install environment represented by object pointed to by ENVP and raise exceptions according to saved exceptions. */ extern int feupdateenv (const fenv_t *__envp) __THROW; /* Include optimization. */ #ifdef __OPTIMIZE__ # include <bits/fenvinline.h> #endif #ifdef __USE_GNU /* Enable individual exceptions. Will not enable more exceptions than EXCEPTS specifies. Returns the previous enabled exceptions if all exceptions are successfully set, otherwise returns -1. */ extern int feenableexcept (int __excepts) __THROW; /* Disable individual exceptions. Will not disable more exceptions than EXCEPTS specifies. Returns the previous enabled exceptions if all exceptions are successfully disabled, otherwise returns -1. */ extern int fedisableexcept (int __excepts) __THROW; /* Return enabled exceptions. */ extern int fegetexcept (void) __THROW; #endif __END_DECLS #endif /* fenv.h */ �����alloca.h��������������������������������������������������������������������������������������������0000644�����������������00000002306�14763166027�0006165 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1992, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ALLOCA_H #define _ALLOCA_H 1 #include <features.h> #define __need_size_t #include <stddef.h> __BEGIN_DECLS /* Remove any previous definitions. */ #undef alloca /* Allocate a block that will be freed when the calling function exits. */ extern void *alloca (size_t __size) __THROW; #ifdef __GNUC__ # define alloca(size) __builtin_alloca (size) #endif /* GCC. */ __END_DECLS #endif /* alloca.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgtypes_interval.h����������������������������������������������������������������������������������0000644�����������������00000002167�14763166027�0010336 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/interfaces/ecpg/include/pgtypes_interval.h */ #ifndef PGTYPES_INTERVAL #define PGTYPES_INTERVAL #include <ecpg_config.h> #ifndef C_H #ifdef HAVE_LONG_INT_64 #ifndef HAVE_INT64 typedef long int int64; #endif #elif defined(HAVE_LONG_LONG_INT_64) #ifndef HAVE_INT64 typedef long long int int64; #endif #else /* neither HAVE_LONG_INT_64 nor HAVE_LONG_LONG_INT_64 */ #error must have a working 64-bit integer datatype #endif #ifdef USE_INTEGER_DATETIMES #define HAVE_INT64_TIMESTAMP #endif #endif /* C_H */ typedef struct { #ifdef HAVE_INT64_TIMESTAMP int64 time; /* all time units other than months and years */ #else double time; /* all time units other than months and years */ #endif long month; /* months and years, after time for alignment */ } interval; #ifdef __cplusplus extern "C" { #endif extern interval *PGTYPESinterval_new(void); extern void PGTYPESinterval_free(interval *); extern interval *PGTYPESinterval_from_asc(char *, char **); extern char *PGTYPESinterval_to_asc(interval *); extern int PGTYPESinterval_copy(interval *, interval *); #ifdef __cplusplus } #endif #endif /* PGTYPES_INTERVAL */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������stab.h����������������������������������������������������������������������������������������������0000644�����������������00000000410�14763166027�0005655 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef __GNU_STAB__ /* Indicate the GNU stab.h is in use. */ #define __GNU_STAB__ #define __define_stab(NAME, CODE, STRING) NAME=CODE, enum __stab_debug_code { #include <bits/stab.def> LAST_UNUSED_STAB_CODE }; #undef __define_stab #endif /* __GNU_STAB_ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������values.h��������������������������������������������������������������������������������������������0000644�����������������00000003652�14763166027�0006236 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Old compatibility names for <limits.h> and <float.h> constants. Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* This interface is obsolete. New programs should use <limits.h> and/or <float.h> instead of <values.h>. */ #ifndef _VALUES_H #define _VALUES_H 1 #include <features.h> #include <limits.h> #define _TYPEBITS(type) (sizeof (type) * CHAR_BIT) #define CHARBITS _TYPEBITS (char) #define SHORTBITS _TYPEBITS (short int) #define INTBITS _TYPEBITS (int) #define LONGBITS _TYPEBITS (long int) #define PTRBITS _TYPEBITS (char *) #define DOUBLEBITS _TYPEBITS (double) #define FLOATBITS _TYPEBITS (float) #define MINSHORT SHRT_MIN #define MININT INT_MIN #define MINLONG LONG_MIN #define MAXSHORT SHRT_MAX #define MAXINT INT_MAX #define MAXLONG LONG_MAX #define HIBITS MINSHORT #define HIBITL MINLONG #include <float.h> #define MAXDOUBLE DBL_MAX #define MAXFLOAT FLT_MAX #define MINDOUBLE DBL_MIN #define MINFLOAT FLT_MIN #define DMINEXP DBL_MIN_EXP #define FMINEXP FLT_MIN_EXP #define DMAXEXP DBL_MAX_EXP #define FMAXEXP FLT_MAX_EXP #ifdef __USE_MISC /* Some systems define this name instead of CHAR_BIT or CHARBITS. */ # define BITSPERBYTE CHAR_BIT #endif #endif /* values.h */ ��������������������������������������������������������������������������������������syscall.h�������������������������������������������������������������������������������������������0000644�����������������00000000031�14763166027�0006375 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <sys/syscall.h> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libdb/db_185.h��������������������������������������������������������������������������������������0000444�����������������00000013537�14763166027�0006776 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*- * See the file LICENSE for redistribution information. * * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. */ /* * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $Id$ */ #ifndef _DB_185_H_ #define _DB_185_H_ #include <sys/types.h> #include <limits.h> #if defined(__cplusplus) extern "C" { #endif /* * XXX * Handle function prototypes and the keyword "const". This steps on name * space that DB doesn't control, but all of the other solutions are worse. */ #undef __P #if defined(__STDC__) || defined(__cplusplus) #define __P(protos) protos /* ANSI C prototypes */ #else #define const #define __P(protos) () /* K&R C preprocessor */ #endif #define RET_ERROR -1 /* Return values. */ #define RET_SUCCESS 0 #define RET_SPECIAL 1 #ifndef __BIT_TYPES_DEFINED__ #define __BIT_TYPES_DEFINED__ #endif /* * XXX * SGI/IRIX already has a pgno_t. */ #ifdef __sgi #define pgno_t db_pgno_t #endif #define MAX_PAGE_NUMBER 0xffffffff /* >= # of pages in a file */ typedef u_int32_t pgno_t; #define MAX_PAGE_OFFSET 65535 /* >= # of bytes in a page */ typedef u_int16_t indx_t; #define MAX_REC_NUMBER 0xffffffff /* >= # of records in a tree */ typedef u_int32_t recno_t; /* Key/data structure -- a Data-Base Thang. */ typedef struct { void *data; /* data */ size_t size; /* data length */ } DBT; /* Routine flags. */ #define R_CURSOR 1 /* del, put, seq */ #define __R_UNUSED 2 /* UNUSED */ #define R_FIRST 3 /* seq */ #define R_IAFTER 4 /* put (RECNO) */ #define R_IBEFORE 5 /* put (RECNO) */ #define R_LAST 6 /* seq (BTREE, RECNO) */ #define R_NEXT 7 /* seq */ #define R_NOOVERWRITE 8 /* put */ #define R_PREV 9 /* seq (BTREE, RECNO) */ #define R_SETCURSOR 10 /* put (RECNO) */ #define R_RECNOSYNC 11 /* sync (RECNO) */ typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE; /* Access method description structure. */ typedef struct __db { DBTYPE type; /* Underlying db type. */ int (*close) __P((struct __db *)); int (*del) __P((const struct __db *, const DBT *, u_int)); int (*get) __P((const struct __db *, const DBT *, DBT *, u_int)); int (*put) __P((const struct __db *, DBT *, const DBT *, u_int)); int (*seq) __P((const struct __db *, DBT *, DBT *, u_int)); int (*sync) __P((const struct __db *, u_int)); void *internal; /* Access method private. */ int (*fd) __P((const struct __db *)); } DB; #define BTREEMAGIC 0x053162 #define BTREEVERSION 3 /* Structure used to pass parameters to the btree routines. */ typedef struct { #define R_DUP 0x01 /* duplicate keys */ u_int32_t flags; u_int32_t cachesize; /* bytes to cache */ u_int32_t maxkeypage; /* maximum keys per page */ u_int32_t minkeypage; /* minimum keys per page */ u_int32_t psize; /* page size */ int (*compare) /* comparison function */ __P((const DBT *, const DBT *)); size_t (*prefix) /* prefix function */ __P((const DBT *, const DBT *)); int lorder; /* byte order */ } BTREEINFO; #define HASHMAGIC 0x061561 #define HASHVERSION 2 /* Structure used to pass parameters to the hashing routines. */ typedef struct { u_int32_t bsize; /* bucket size */ u_int32_t ffactor; /* fill factor */ u_int32_t nelem; /* number of elements */ u_int32_t cachesize; /* bytes to cache */ u_int32_t /* hash function */ (*hash) __P((const void *, size_t)); int lorder; /* byte order */ } HASHINFO; /* Structure used to pass parameters to the record routines. */ typedef struct { #define R_FIXEDLEN 0x01 /* fixed-length records */ #define R_NOKEY 0x02 /* key not required */ #define R_SNAPSHOT 0x04 /* snapshot the input */ u_int32_t flags; u_int32_t cachesize; /* bytes to cache */ u_int32_t psize; /* page size */ int lorder; /* byte order */ size_t reclen; /* record length (fixed-length records) */ u_char bval; /* delimiting byte (variable-length records */ char *bfname; /* btree file name */ } RECNOINFO; /* Re-define the user's dbopen calls. */ #define dbopen __db185_open #if defined(__cplusplus) } #endif #endif /* !_DB_185_H_ */ /* DO NOT EDIT: automatically built by dist/s_include. */ #ifndef _DB_EXT_185_PROT_IN_ #define _DB_EXT_185_PROT_IN_ #if defined(__cplusplus) extern "C" { #endif #ifdef _DB185_INT_H_ DB185 *__db185_open __P((const char *, int, int, DBTYPE, const void *)); #else DB *__db185_open __P((const char *, int, int, DBTYPE, const void *)); #endif #if defined(__cplusplus) } #endif #endif /* !_DB_EXT_185_PROT_IN_ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������lzma.h����������������������������������������������������������������������������������������������0000644�����������������00000023011�14763166027�0005671 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file api/lzma.h * \brief The public API of liblzma data compression library * * liblzma is a public domain general-purpose data compression library with * a zlib-like API. The native file format is .xz, but also the old .lzma * format and raw (no headers) streams are supported. Multiple compression * algorithms (filters) are supported. Currently LZMA2 is the primary filter. * * liblzma is part of XZ Utils <http://tukaani.org/xz/>. XZ Utils includes * a gzip-like command line tool named xz and some other tools. XZ Utils * is developed and maintained by Lasse Collin. * * Major parts of liblzma are based on Igor Pavlov's public domain LZMA SDK * <http://7-zip.org/sdk.html>. * * The SHA-256 implementation is based on the public domain code found from * 7-Zip <http://7-zip.org/>, which has a modified version of the public * domain SHA-256 code found from Crypto++ <http://www.cryptopp.com/>. * The SHA-256 code in Crypto++ was written by Kevin Springle and Wei Dai. */ /* * Author: Lasse Collin * * This file has been put into the public domain. * You can do whatever you want with this file. */ #ifndef LZMA_H #define LZMA_H /***************************** * Required standard headers * *****************************/ /* * liblzma API headers need some standard types and macros. To allow * including lzma.h without requiring the application to include other * headers first, lzma.h includes the required standard headers unless * they already seem to be included already or if LZMA_MANUAL_HEADERS * has been defined. * * Here's what types and macros are needed and from which headers: * - stddef.h: size_t, NULL * - stdint.h: uint8_t, uint32_t, uint64_t, UINT32_C(n), uint64_C(n), * UINT32_MAX, UINT64_MAX * * However, inttypes.h is a little more portable than stdint.h, although * inttypes.h declares some unneeded things compared to plain stdint.h. * * The hacks below aren't perfect, specifically they assume that inttypes.h * exists and that it typedefs at least uint8_t, uint32_t, and uint64_t, * and that, in case of incomplete inttypes.h, unsigned int is 32-bit. * If the application already takes care of setting up all the types and * macros properly (for example by using gnulib's stdint.h or inttypes.h), * we try to detect that the macros are already defined and don't include * inttypes.h here again. However, you may define LZMA_MANUAL_HEADERS to * force this file to never include any system headers. * * Some could argue that liblzma API should provide all the required types, * for example lzma_uint64, LZMA_UINT64_C(n), and LZMA_UINT64_MAX. This was * seen as an unnecessary mess, since most systems already provide all the * necessary types and macros in the standard headers. * * Note that liblzma API still has lzma_bool, because using stdbool.h would * break C89 and C++ programs on many systems. sizeof(bool) in C99 isn't * necessarily the same as sizeof(bool) in C++. */ #ifndef LZMA_MANUAL_HEADERS /* * I suppose this works portably also in C++. Note that in C++, * we need to get size_t into the global namespace. */ # include <stddef.h> /* * Skip inttypes.h if we already have all the required macros. If we * have the macros, we assume that we have the matching typedefs too. */ # if !defined(UINT32_C) || !defined(UINT64_C) \ || !defined(UINT32_MAX) || !defined(UINT64_MAX) /* * MSVC versions older than 2013 have no C99 support, and * thus they cannot be used to compile liblzma. Using an * existing liblzma.dll with old MSVC can work though(*), * but we need to define the required standard integer * types here in a MSVC-specific way. * * (*) If you do this, the existing liblzma.dll probably uses * a different runtime library than your MSVC-built * application. Mixing runtimes is generally bad, but * in this case it should work as long as you avoid * the few rarely-needed liblzma functions that allocate * memory and expect the caller to free it using free(). */ # if defined(_WIN32) && defined(_MSC_VER) && _MSC_VER < 1800 typedef unsigned __int8 uint8_t; typedef unsigned __int32 uint32_t; typedef unsigned __int64 uint64_t; # else /* Use the standard inttypes.h. */ # ifdef __cplusplus /* * C99 sections 7.18.2 and 7.18.4 specify * that C++ implementations define the limit * and constant macros only if specifically * requested. Note that if you want the * format macros (PRIu64 etc.) too, you need * to define __STDC_FORMAT_MACROS before * including lzma.h, since re-including * inttypes.h with __STDC_FORMAT_MACROS * defined doesn't necessarily work. */ # ifndef __STDC_LIMIT_MACROS # define __STDC_LIMIT_MACROS 1 # endif # ifndef __STDC_CONSTANT_MACROS # define __STDC_CONSTANT_MACROS 1 # endif # endif # include <inttypes.h> # endif /* * Some old systems have only the typedefs in inttypes.h, and * lack all the macros. For those systems, we need a few more * hacks. We assume that unsigned int is 32-bit and unsigned * long is either 32-bit or 64-bit. If these hacks aren't * enough, the application has to setup the types manually * before including lzma.h. */ # ifndef UINT32_C # if defined(_WIN32) && defined(_MSC_VER) # define UINT32_C(n) n ## UI32 # else # define UINT32_C(n) n ## U # endif # endif # ifndef UINT64_C # if defined(_WIN32) && defined(_MSC_VER) # define UINT64_C(n) n ## UI64 # else /* Get ULONG_MAX. */ # include <limits.h> # if ULONG_MAX == 4294967295UL # define UINT64_C(n) n ## ULL # else # define UINT64_C(n) n ## UL # endif # endif # endif # ifndef UINT32_MAX # define UINT32_MAX (UINT32_C(4294967295)) # endif # ifndef UINT64_MAX # define UINT64_MAX (UINT64_C(18446744073709551615)) # endif # endif #endif /* ifdef LZMA_MANUAL_HEADERS */ /****************** * LZMA_API macro * ******************/ /* * Some systems require that the functions and function pointers are * declared specially in the headers. LZMA_API_IMPORT is for importing * symbols and LZMA_API_CALL is to specify the calling convention. * * By default it is assumed that the application will link dynamically * against liblzma. #define LZMA_API_STATIC in your application if you * want to link against static liblzma. If you don't care about portability * to operating systems like Windows, or at least don't care about linking * against static liblzma on them, don't worry about LZMA_API_STATIC. That * is, most developers will never need to use LZMA_API_STATIC. * * The GCC variants are a special case on Windows (Cygwin and MinGW). * We rely on GCC doing the right thing with its auto-import feature, * and thus don't use __declspec(dllimport). This way developers don't * need to worry about LZMA_API_STATIC. Also the calling convention is * omitted on Cygwin but not on MinGW. */ #ifndef LZMA_API_IMPORT # if !defined(LZMA_API_STATIC) && defined(_WIN32) && !defined(__GNUC__) # define LZMA_API_IMPORT __declspec(dllimport) # else # define LZMA_API_IMPORT # endif #endif #ifndef LZMA_API_CALL # if defined(_WIN32) && !defined(__CYGWIN__) # define LZMA_API_CALL __cdecl # else # define LZMA_API_CALL # endif #endif #ifndef LZMA_API # define LZMA_API(type) LZMA_API_IMPORT type LZMA_API_CALL #endif /*********** * nothrow * ***********/ /* * None of the functions in liblzma may throw an exception. Even * the functions that use callback functions won't throw exceptions, * because liblzma would break if a callback function threw an exception. */ #ifndef lzma_nothrow # if defined(__cplusplus) # define lzma_nothrow throw() # elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) # define lzma_nothrow __attribute__((__nothrow__)) # else # define lzma_nothrow # endif #endif /******************** * GNU C extensions * ********************/ /* * GNU C extensions are used conditionally in the public API. It doesn't * break anything if these are sometimes enabled and sometimes not, only * affects warnings and optimizations. */ #if __GNUC__ >= 3 # ifndef lzma_attribute # define lzma_attribute(attr) __attribute__(attr) # endif /* warn_unused_result was added in GCC 3.4. */ # ifndef lzma_attr_warn_unused_result # if __GNUC__ == 3 && __GNUC_MINOR__ < 4 # define lzma_attr_warn_unused_result # endif # endif #else # ifndef lzma_attribute # define lzma_attribute(attr) # endif #endif #ifndef lzma_attr_pure # define lzma_attr_pure lzma_attribute((__pure__)) #endif #ifndef lzma_attr_const # define lzma_attr_const lzma_attribute((__const__)) #endif #ifndef lzma_attr_warn_unused_result # define lzma_attr_warn_unused_result \ lzma_attribute((__warn_unused_result__)) #endif /************** * Subheaders * **************/ #ifdef __cplusplus extern "C" { #endif /* * Subheaders check that this is defined. It is to prevent including * them directly from applications. */ #define LZMA_H_INTERNAL 1 /* Basic features */ #include "lzma/version.h" #include "lzma/base.h" #include "lzma/vli.h" #include "lzma/check.h" /* Filters */ #include "lzma/filter.h" #include "lzma/bcj.h" #include "lzma/delta.h" #include "lzma/lzma12.h" /* Container formats */ #include "lzma/container.h" /* Advanced features */ #include "lzma/stream_flags.h" #include "lzma/block.h" #include "lzma/index.h" #include "lzma/index_hash.h" /* Hardware information */ #include "lzma/hardware.h" /* * All subheaders included. Undefine LZMA_H_INTERNAL to prevent applications * re-including the subheaders. */ #undef LZMA_H_INTERNAL #ifdef __cplusplus } #endif #endif /* ifndef LZMA_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgtypes_date.h��������������������������������������������������������������������������������������0000644�����������������00000001376�14763166027�0007430 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/interfaces/ecpg/include/pgtypes_date.h */ #ifndef PGTYPES_DATETIME #define PGTYPES_DATETIME #include <pgtypes_timestamp.h> typedef long date; #ifdef __cplusplus extern "C" { #endif extern date *PGTYPESdate_new(void); extern void PGTYPESdate_free(date *); extern date PGTYPESdate_from_asc(char *, char **); extern char *PGTYPESdate_to_asc(date); extern date PGTYPESdate_from_timestamp(timestamp); extern void PGTYPESdate_julmdy(date, int *); extern void PGTYPESdate_mdyjul(int *, date *); extern int PGTYPESdate_dayofweek(date); extern void PGTYPESdate_today(date *); extern int PGTYPESdate_defmt_asc(date *, const char *, char *); extern int PGTYPESdate_fmt_asc(date, const char *, char *); #ifdef __cplusplus } #endif #endif /* PGTYPES_DATETIME */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ulimit.h��������������������������������������������������������������������������������������������0000644�����������������00000003066�14763166027�0006241 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ULIMIT_H #define _ULIMIT_H 1 #include <features.h> /* Constants used as the first parameter for `ulimit'. They denote limits which can be set or retrieved using this function. */ enum { UL_GETFSIZE = 1, /* Return limit on the size of a file, in units of 512 bytes. */ #define UL_GETFSIZE UL_GETFSIZE UL_SETFSIZE, /* Set limit on the size of a file to second argument. */ #define UL_SETFSIZE UL_SETFSIZE __UL_GETMAXBRK, /* Return the maximum possible address of the data segment. */ __UL_GETOPENMAX /* Return the maximum number of files that the calling process can open.*/ }; __BEGIN_DECLS /* Control process limits according to CMD. */ extern long int ulimit (int __cmd, ...) __THROW; __END_DECLS #endif /* ulimit.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pty.h�����������������������������������������������������������������������������������������������0000644�����������������00000003007�14763166027�0005545 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Functions for pseudo TTY handling. Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _PTY_H #define _PTY_H 1 #include <features.h> #include <termios.h> #include <sys/ioctl.h> __BEGIN_DECLS /* Create pseudo tty master slave pair with NAME and set terminal attributes according to TERMP and WINP and return handles for both ends in AMASTER and ASLAVE. */ extern int openpty (int *__amaster, int *__aslave, char *__name, const struct termios *__termp, const struct winsize *__winp) __THROW; /* Create child process and establish the slave pseudo terminal as the child's controlling terminal. */ extern int forkpty (int *__amaster, char *__name, const struct termios *__termp, const struct winsize *__winp) __THROW; __END_DECLS #endif /* pty.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������error.h���������������������������������������������������������������������������������������������0000644�����������������00000004013�14763166027�0006060 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Declaration for error-reporting function Copyright (C) 1995-1997,2003,2006,2007,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ERROR_H #define _ERROR_H 1 #include <features.h> __BEGIN_DECLS /* Print a message with `fprintf (stderr, FORMAT, ...)'; if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). If STATUS is nonzero, terminate the program with `exit (STATUS)'. */ extern void error (int __status, int __errnum, const char *__format, ...) __attribute__ ((__format__ (__printf__, 3, 4))); extern void error_at_line (int __status, int __errnum, const char *__fname, unsigned int __lineno, const char *__format, ...) __attribute__ ((__format__ (__printf__, 5, 6))); /* If NULL, error will flush stdout, then print on stderr the program name, a colon and a space. Otherwise, error will call this function without parameters instead. */ extern void (*error_print_progname) (void); /* This variable is incremented each time `error' is called. */ extern unsigned int error_message_count; /* Sometimes we want to have at most one error per line. This variable controls whether this mode is selected or not. */ extern int error_one_per_line; #if defined __extern_always_inline && defined __va_arg_pack # include <bits/error.h> #endif __END_DECLS #endif /* error.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������net/if.h��������������������������������������������������������������������������������������������0000644�����������������00000015525�14763166027�0006125 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* net/if.h -- declarations for inquiring about network interfaces Copyright (C) 1997,98,99,2000,2001,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _NET_IF_H #define _NET_IF_H 1 #include <features.h> #ifdef __USE_MISC # include <sys/types.h> # include <sys/socket.h> #endif /* Length of interface name. */ #define IF_NAMESIZE 16 struct if_nameindex { unsigned int if_index; /* 1, 2, ... */ char *if_name; /* null terminated name: "eth0", ... */ }; #ifdef __USE_MISC /* Standard interface flags. */ enum { IFF_UP = 0x1, /* Interface is up. */ # define IFF_UP IFF_UP IFF_BROADCAST = 0x2, /* Broadcast address valid. */ # define IFF_BROADCAST IFF_BROADCAST IFF_DEBUG = 0x4, /* Turn on debugging. */ # define IFF_DEBUG IFF_DEBUG IFF_LOOPBACK = 0x8, /* Is a loopback net. */ # define IFF_LOOPBACK IFF_LOOPBACK IFF_POINTOPOINT = 0x10, /* Interface is point-to-point link. */ # define IFF_POINTOPOINT IFF_POINTOPOINT IFF_NOTRAILERS = 0x20, /* Avoid use of trailers. */ # define IFF_NOTRAILERS IFF_NOTRAILERS IFF_RUNNING = 0x40, /* Resources allocated. */ # define IFF_RUNNING IFF_RUNNING IFF_NOARP = 0x80, /* No address resolution protocol. */ # define IFF_NOARP IFF_NOARP IFF_PROMISC = 0x100, /* Receive all packets. */ # define IFF_PROMISC IFF_PROMISC /* Not supported */ IFF_ALLMULTI = 0x200, /* Receive all multicast packets. */ # define IFF_ALLMULTI IFF_ALLMULTI IFF_MASTER = 0x400, /* Master of a load balancer. */ # define IFF_MASTER IFF_MASTER IFF_SLAVE = 0x800, /* Slave of a load balancer. */ # define IFF_SLAVE IFF_SLAVE IFF_MULTICAST = 0x1000, /* Supports multicast. */ # define IFF_MULTICAST IFF_MULTICAST IFF_PORTSEL = 0x2000, /* Can set media type. */ # define IFF_PORTSEL IFF_PORTSEL IFF_AUTOMEDIA = 0x4000, /* Auto media select active. */ # define IFF_AUTOMEDIA IFF_AUTOMEDIA IFF_DYNAMIC = 0x8000 /* Dialup device with changing addresses. */ # define IFF_DYNAMIC IFF_DYNAMIC }; /* The ifaddr structure contains information about one address of an interface. They are maintained by the different address families, are allocated and attached when an address is set, and are linked together so all addresses for an interface can be located. */ struct ifaddr { struct sockaddr ifa_addr; /* Address of interface. */ union { struct sockaddr ifu_broadaddr; struct sockaddr ifu_dstaddr; } ifa_ifu; struct iface *ifa_ifp; /* Back-pointer to interface. */ struct ifaddr *ifa_next; /* Next address for interface. */ }; # define ifa_broadaddr ifa_ifu.ifu_broadaddr /* broadcast address */ # define ifa_dstaddr ifa_ifu.ifu_dstaddr /* other end of link */ /* Device mapping structure. I'd just gone off and designed a beautiful scheme using only loadable modules with arguments for driver options and along come the PCMCIA people 8) Ah well. The get() side of this is good for WDSETUP, and it'll be handy for debugging things. The set side is fine for now and being very small might be worth keeping for clean configuration. */ struct ifmap { unsigned long int mem_start; unsigned long int mem_end; unsigned short int base_addr; unsigned char irq; unsigned char dma; unsigned char port; /* 3 bytes spare */ }; /* Interface request structure used for socket ioctl's. All interface ioctl's must have parameter definitions which begin with ifr_name. The remainder may be interface specific. */ struct ifreq { # define IFHWADDRLEN 6 # define IFNAMSIZ IF_NAMESIZE union { char ifrn_name[IFNAMSIZ]; /* Interface name, e.g. "en0". */ } ifr_ifrn; union { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; short int ifru_flags; int ifru_ivalue; int ifru_mtu; struct ifmap ifru_map; char ifru_slave[IFNAMSIZ]; /* Just fits the size */ char ifru_newname[IFNAMSIZ]; __caddr_t ifru_data; } ifr_ifru; }; # define ifr_name ifr_ifrn.ifrn_name /* interface name */ # define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ # define ifr_addr ifr_ifru.ifru_addr /* address */ # define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */ # define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ # define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ # define ifr_flags ifr_ifru.ifru_flags /* flags */ # define ifr_metric ifr_ifru.ifru_ivalue /* metric */ # define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ # define ifr_map ifr_ifru.ifru_map /* device map */ # define ifr_slave ifr_ifru.ifru_slave /* slave device */ # define ifr_data ifr_ifru.ifru_data /* for use by interface */ # define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */ # define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */ # define ifr_qlen ifr_ifru.ifru_ivalue /* queue length */ # define ifr_newname ifr_ifru.ifru_newname /* New name */ # define _IOT_ifreq _IOT(_IOTS(char),IFNAMSIZ,_IOTS(char),16,0,0) # define _IOT_ifreq_short _IOT(_IOTS(char),IFNAMSIZ,_IOTS(short),1,0,0) # define _IOT_ifreq_int _IOT(_IOTS(char),IFNAMSIZ,_IOTS(int),1,0,0) /* Structure used in SIOCGIFCONF request. Used to retrieve interface configuration for machine (useful for programs which must know all networks accessible). */ struct ifconf { int ifc_len; /* Size of buffer. */ union { __caddr_t ifcu_buf; struct ifreq *ifcu_req; } ifc_ifcu; }; # define ifc_buf ifc_ifcu.ifcu_buf /* Buffer address. */ # define ifc_req ifc_ifcu.ifcu_req /* Array of structures. */ # define _IOT_ifconf _IOT(_IOTS(struct ifconf),1,0,0,0,0) /* not right */ #endif /* Misc. */ __BEGIN_DECLS /* Convert an interface name to an index, and vice versa. */ extern unsigned int if_nametoindex (const char *__ifname) __THROW; extern char *if_indextoname (unsigned int __ifindex, char *__ifname) __THROW; /* Return a list of all interfaces and their indices. */ extern struct if_nameindex *if_nameindex (void) __THROW; /* Free the data returned from if_nameindex. */ extern void if_freenameindex (struct if_nameindex *__ptr) __THROW; __END_DECLS #endif /* net/if.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������net/if_arp.h����������������������������������������������������������������������������������������0000644�����������������00000015706�14763166027�0006770 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Definitions for Address Resolution Protocol. Copyright (C) 1997,1999,2001,2006,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* Based on the 4.4BSD and Linux version of this file. */ #ifndef _NET_IF_ARP_H #define _NET_IF_ARP_H 1 #include <sys/cdefs.h> #include <sys/types.h> #include <sys/socket.h> __BEGIN_DECLS /* Some internals from deep down in the kernel. */ #define MAX_ADDR_LEN 7 /* This structure defines an ethernet arp header. */ /* ARP protocol opcodes. */ #define ARPOP_REQUEST 1 /* ARP request. */ #define ARPOP_REPLY 2 /* ARP reply. */ #define ARPOP_RREQUEST 3 /* RARP request. */ #define ARPOP_RREPLY 4 /* RARP reply. */ #define ARPOP_InREQUEST 8 /* InARP request. */ #define ARPOP_InREPLY 9 /* InARP reply. */ #define ARPOP_NAK 10 /* (ATM)ARP NAK. */ /* See RFC 826 for protocol description. ARP packets are variable in size; the arphdr structure defines the fixed-length portion. Protocol type values are the same as those for 10 Mb/s Ethernet. It is followed by the variable-sized fields ar_sha, arp_spa, arp_tha and arp_tpa in that order, according to the lengths specified. Field names used correspond to RFC 826. */ struct arphdr { unsigned short int ar_hrd; /* Format of hardware address. */ unsigned short int ar_pro; /* Format of protocol address. */ unsigned char ar_hln; /* Length of hardware address. */ unsigned char ar_pln; /* Length of protocol address. */ unsigned short int ar_op; /* ARP opcode (command). */ #if 0 /* Ethernet looks like this : This bit is variable sized however... */ unsigned char __ar_sha[ETH_ALEN]; /* Sender hardware address. */ unsigned char __ar_sip[4]; /* Sender IP address. */ unsigned char __ar_tha[ETH_ALEN]; /* Target hardware address. */ unsigned char __ar_tip[4]; /* Target IP address. */ #endif }; /* ARP protocol HARDWARE identifiers. */ #define ARPHRD_NETROM 0 /* From KA9Q: NET/ROM pseudo. */ #define ARPHRD_ETHER 1 /* Ethernet 10/100Mbps. */ #define ARPHRD_EETHER 2 /* Experimental Ethernet. */ #define ARPHRD_AX25 3 /* AX.25 Level 2. */ #define ARPHRD_PRONET 4 /* PROnet token ring. */ #define ARPHRD_CHAOS 5 /* Chaosnet. */ #define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB. */ #define ARPHRD_ARCNET 7 /* ARCnet. */ #define ARPHRD_APPLETLK 8 /* APPLEtalk. */ #define ARPHRD_DLCI 15 /* Frame Relay DLCI. */ #define ARPHRD_ATM 19 /* ATM. */ #define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id). */ #define ARPHRD_IEEE1394 24 /* IEEE 1394 IPv4 - RFC 2734. */ #define ARPHRD_EUI64 27 /* EUI-64. */ #define ARPHRD_INFINIBAND 32 /* InfiniBand. */ /* Dummy types for non ARP hardware */ #define ARPHRD_SLIP 256 #define ARPHRD_CSLIP 257 #define ARPHRD_SLIP6 258 #define ARPHRD_CSLIP6 259 #define ARPHRD_RSRVD 260 /* Notional KISS type. */ #define ARPHRD_ADAPT 264 #define ARPHRD_ROSE 270 #define ARPHRD_X25 271 /* CCITT X.25. */ #define ARPHRD_HWX25 272 /* Boards with X.25 in firmware. */ #define ARPHRD_PPP 512 #define ARPHRD_CISCO 513 /* Cisco HDLC. */ #define ARPHRD_HDLC ARPHRD_CISCO #define ARPHRD_LAPB 516 /* LAPB. */ #define ARPHRD_DDCMP 517 /* Digital's DDCMP. */ #define ARPHRD_RAWHDLC 518 /* Raw HDLC. */ #define ARPHRD_TUNNEL 768 /* IPIP tunnel. */ #define ARPHRD_TUNNEL6 769 /* IPIP6 tunnel. */ #define ARPHRD_FRAD 770 /* Frame Relay Access Device. */ #define ARPHRD_SKIP 771 /* SKIP vif. */ #define ARPHRD_LOOPBACK 772 /* Loopback device. */ #define ARPHRD_LOCALTLK 773 /* Localtalk device. */ #define ARPHRD_FDDI 774 /* Fiber Distributed Data Interface. */ #define ARPHRD_BIF 775 /* AP1000 BIF. */ #define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4. */ #define ARPHRD_IPDDP 777 /* IP-in-DDP tunnel. */ #define ARPHRD_IPGRE 778 /* GRE over IP. */ #define ARPHRD_PIMREG 779 /* PIMSM register interface. */ #define ARPHRD_HIPPI 780 /* High Performance Parallel I'face. */ #define ARPHRD_ASH 781 /* (Nexus Electronics) Ash. */ #define ARPHRD_ECONET 782 /* Acorn Econet. */ #define ARPHRD_IRDA 783 /* Linux-IrDA. */ #define ARPHRD_FCPP 784 /* Point to point fibrechanel. */ #define ARPHRD_FCAL 785 /* Fibrechanel arbitrated loop. */ #define ARPHRD_FCPL 786 /* Fibrechanel public loop. */ #define ARPHRD_FCFABRIC 787 /* Fibrechanel fabric. */ #define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR. */ #define ARPHRD_IEEE80211 801 /* IEEE 802.11. */ #define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header. */ #define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header. */ #define ARPHRD_IEEE802154 804 /* IEEE 802.15.4 header. */ #define ARPHRD_IEEE802154_PHY 805 /* IEEE 802.15.4 PHY header. */ #define ARPHRD_VOID 0xFFFF /* Void type, nothing is known. */ #define ARPHRD_NONE 0xFFFE /* Zero header length. */ /* ARP ioctl request. */ struct arpreq { struct sockaddr arp_pa; /* Protocol address. */ struct sockaddr arp_ha; /* Hardware address. */ int arp_flags; /* Flags. */ struct sockaddr arp_netmask; /* Netmask (only for proxy arps). */ char arp_dev[16]; }; struct arpreq_old { struct sockaddr arp_pa; /* Protocol address. */ struct sockaddr arp_ha; /* Hardware address. */ int arp_flags; /* Flags. */ struct sockaddr arp_netmask; /* Netmask (only for proxy arps). */ }; /* ARP Flag values. */ #define ATF_COM 0x02 /* Completed entry (ha valid). */ #define ATF_PERM 0x04 /* Permanent entry. */ #define ATF_PUBL 0x08 /* Publish entry. */ #define ATF_USETRAILERS 0x10 /* Has requested trailers. */ #define ATF_NETMASK 0x20 /* Want to use a netmask (only for proxy entries). */ #define ATF_DONTPUB 0x40 /* Don't answer this addresses. */ #define ATF_MAGIC 0x80 /* Automatically added entry. */ /* Support for the user space arp daemon, arpd. */ #define ARPD_UPDATE 0x01 #define ARPD_LOOKUP 0x02 #define ARPD_FLUSH 0x03 struct arpd_request { unsigned short int req; /* Request type. */ u_int32_t ip; /* IP address of entry. */ unsigned long int dev; /* Device entry is tied to. */ unsigned long int stamp; unsigned long int updated; unsigned char ha[MAX_ADDR_LEN]; /* Hardware address. */ }; __END_DECLS #endif /* net/if_arp.h */ ����������������������������������������������������������net/if_ppp.h����������������������������������������������������������������������������������������0000644�����������������00000014741�14763166027�0007003 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* From: if_ppp.h,v 1.3 1995/06/12 11:36:50 paulus Exp */ /* * if_ppp.h - Point-to-Point Protocol definitions. * * Copyright (c) 1989 Carnegie Mellon University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /* * ==FILEVERSION 960926== * * NOTE TO MAINTAINERS: * If you modify this file at all, please set the above date. * if_ppp.h is shipped with a PPP distribution as well as with the kernel; * if everyone increases the FILEVERSION number above, then scripts * can do the right thing when deciding whether to install a new if_ppp.h * file. Don't change the format of that line otherwise, so the * installation script can recognize it. */ #ifndef __NET_IF_PPP_H #define __NET_IF_PPP_H 1 #include <sys/types.h> #include <sys/cdefs.h> #include <net/if.h> #include <sys/ioctl.h> #include <net/ppp_defs.h> __BEGIN_DECLS /* * Packet sizes */ #define PPP_MTU 1500 /* Default MTU (size of Info field) */ #define PPP_MAXMRU 65000 /* Largest MRU we allow */ #define PPP_VERSION "2.2.0" #define PPP_MAGIC 0x5002 /* Magic value for the ppp structure */ #define PROTO_IPX 0x002b /* protocol numbers */ #define PROTO_DNA_RT 0x0027 /* DNA Routing */ /* * Bit definitions for flags. */ #define SC_COMP_PROT 0x00000001 /* protocol compression (output) */ #define SC_COMP_AC 0x00000002 /* header compression (output) */ #define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */ #define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */ #define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */ #define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */ #define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */ #define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */ #define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */ #define SC_COMP_RUN 0x00001000 /* compressor has been inited */ #define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */ #define SC_DEBUG 0x00010000 /* enable debug messages */ #define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */ #define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ #define SC_LOG_RAWIN 0x00080000 /* log all chars received */ #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ #define SC_MASK 0x0fE0ffff /* bits that user can change */ /* state bits */ #define SC_ESCAPED 0x80000000 /* saw a PPP_ESCAPE */ #define SC_FLUSH 0x40000000 /* flush input until next PPP_FLAG */ #define SC_VJ_RESET 0x20000000 /* Need to reset the VJ decompressor */ #define SC_XMIT_BUSY 0x10000000 /* ppp_write_wakeup is active */ #define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ #define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ #define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */ #define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */ #define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */ #define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */ /* * Ioctl definitions. */ struct npioctl { int protocol; /* PPP protocol, e.g. PPP_IP */ enum NPmode mode; }; /* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */ struct ppp_option_data { u_int8_t *ptr; u_int32_t length; int transmit; }; struct ifpppstatsreq { struct ifreq b; struct ppp_stats stats; /* statistic information */ }; struct ifpppcstatsreq { struct ifreq b; struct ppp_comp_stats stats; }; #define ifr__name b.ifr_ifrn.ifrn_name #define stats_ptr b.ifr_ifru.ifru_data /* * Ioctl definitions. */ #define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */ #define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */ #define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */ #define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */ #define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */ #define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */ #define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */ #define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */ #define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */ #define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */ #define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */ #define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */ #define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */ #define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data) #define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */ #define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */ #define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */ #define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */ #define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */ #define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0) #define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */ #define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2) #if !defined(ifr_mtu) #define ifr_mtu ifr_ifru.ifru_metric #endif __END_DECLS #endif /* net/if_ppp.h */ �������������������������������net/if_slip.h���������������������������������������������������������������������������������������0000644�����������������00000001637�14763166027�0007153 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _NET_IF_SLIP_H #define _NET_IF_SLIP_H 1 /* We can use the kernel header. */ #include <linux/if_slip.h> #endif /* net/if_slip.h. */ �������������������������������������������������������������������������������������������������net/route.h�����������������������������������������������������������������������������������������0000644�����������������00000011150�14763166027�0006653 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* Based on the 4.4BSD and Linux version of this file. */ #ifndef _NET_ROUTE_H #define _NET_ROUTE_H 1 #include <features.h> #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <bits/wordsize.h> /* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */ struct rtentry { unsigned long int rt_pad1; struct sockaddr rt_dst; /* Target address. */ struct sockaddr rt_gateway; /* Gateway addr (RTF_GATEWAY). */ struct sockaddr rt_genmask; /* Target network mask (IP). */ unsigned short int rt_flags; short int rt_pad2; unsigned long int rt_pad3; unsigned char rt_tos; unsigned char rt_class; #if __WORDSIZE == 64 short int rt_pad4[3]; #else short int rt_pad4; #endif short int rt_metric; /* +1 for binary compatibility! */ char *rt_dev; /* Forcing the device at add. */ unsigned long int rt_mtu; /* Per route MTU/Window. */ unsigned long int rt_window; /* Window clamping. */ unsigned short int rt_irtt; /* Initial RTT. */ }; /* Compatibility hack. */ #define rt_mss rt_mtu struct in6_rtmsg { struct in6_addr rtmsg_dst; struct in6_addr rtmsg_src; struct in6_addr rtmsg_gateway; u_int32_t rtmsg_type; u_int16_t rtmsg_dst_len; u_int16_t rtmsg_src_len; u_int32_t rtmsg_metric; unsigned long int rtmsg_info; u_int32_t rtmsg_flags; int rtmsg_ifindex; }; #define RTF_UP 0x0001 /* Route usable. */ #define RTF_GATEWAY 0x0002 /* Destination is a gateway. */ #define RTF_HOST 0x0004 /* Host entry (net otherwise). */ #define RTF_REINSTATE 0x0008 /* Reinstate route after timeout. */ #define RTF_DYNAMIC 0x0010 /* Created dyn. (by redirect). */ #define RTF_MODIFIED 0x0020 /* Modified dyn. (by redirect). */ #define RTF_MTU 0x0040 /* Specific MTU for this route. */ #define RTF_MSS RTF_MTU /* Compatibility. */ #define RTF_WINDOW 0x0080 /* Per route window clamping. */ #define RTF_IRTT 0x0100 /* Initial round trip time. */ #define RTF_REJECT 0x0200 /* Reject route. */ #define RTF_STATIC 0x0400 /* Manually injected route. */ #define RTF_XRESOLVE 0x0800 /* External resolver. */ #define RTF_NOFORWARD 0x1000 /* Forwarding inhibited. */ #define RTF_THROW 0x2000 /* Go to next class. */ #define RTF_NOPMTUDISC 0x4000 /* Do not send packets with DF. */ /* for IPv6 */ #define RTF_DEFAULT 0x00010000 /* default - learned via ND */ #define RTF_ALLONLINK 0x00020000 /* fallback, no routers on link */ #define RTF_ADDRCONF 0x00040000 /* addrconf route - RA */ #define RTF_LINKRT 0x00100000 /* link specific - device match */ #define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */ #define RTF_CACHE 0x01000000 /* cache entry */ #define RTF_FLOW 0x02000000 /* flow significant route */ #define RTF_POLICY 0x04000000 /* policy route */ #define RTCF_VALVE 0x00200000 #define RTCF_MASQ 0x00400000 #define RTCF_NAT 0x00800000 #define RTCF_DOREDIRECT 0x01000000 #define RTCF_LOG 0x02000000 #define RTCF_DIRECTSRC 0x04000000 #define RTF_LOCAL 0x80000000 #define RTF_INTERFACE 0x40000000 #define RTF_MULTICAST 0x20000000 #define RTF_BROADCAST 0x10000000 #define RTF_NAT 0x08000000 #define RTF_ADDRCLASSMASK 0xF8000000 #define RT_ADDRCLASS(flags) ((__u_int32_t) flags >> 23) #define RT_TOS(tos) ((tos) & IPTOS_TOS_MASK) #define RT_LOCALADDR(flags) ((flags & RTF_ADDRCLASSMASK) \ == (RTF_LOCAL|RTF_INTERFACE)) #define RT_CLASS_UNSPEC 0 #define RT_CLASS_DEFAULT 253 #define RT_CLASS_MAIN 254 #define RT_CLASS_LOCAL 255 #define RT_CLASS_MAX 255 #define RTMSG_ACK NLMSG_ACK #define RTMSG_OVERRUN NLMSG_OVERRUN #define RTMSG_NEWDEVICE 0x11 #define RTMSG_DELDEVICE 0x12 #define RTMSG_NEWROUTE 0x21 #define RTMSG_DELROUTE 0x22 #define RTMSG_NEWRULE 0x31 #define RTMSG_DELRULE 0x32 #define RTMSG_CONTROL 0x40 #define RTMSG_AR_FAILED 0x51 /* Address Resolution failed. */ #endif /* net/route.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������net/if_shaper.h�������������������������������������������������������������������������������������0000644�����������������00000003127�14763166027�0007462 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _NET_IF_SHAPER_H #define _NET_IF_SHAPER_H 1 #include <features.h> #include <sys/types.h> #include <net/if.h> #include <sys/ioctl.h> __BEGIN_DECLS #define SHAPER_QLEN 10 /* * This is a bit speed dependant (read it shouldnt be a constant!) * * 5 is about right for 28.8 upwards. Below that double for every * halving of speed or so. - ie about 20 for 9600 baud. */ #define SHAPER_LATENCY (5 * HZ) #define SHAPER_MAXSLIP 2 #define SHAPER_BURST (HZ / 50) /* Good for >128K then */ #define SHAPER_SET_DEV 0x0001 #define SHAPER_SET_SPEED 0x0002 #define SHAPER_GET_DEV 0x0003 #define SHAPER_GET_SPEED 0x0004 struct shaperconf { u_int16_t ss_cmd; union { char ssu_name[14]; u_int32_t ssu_speed; } ss_u; #define ss_speed ss_u.ssu_speed #define ss_name ss_u.ssu_name }; __END_DECLS #endif /* net/if_shaper.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������net/if_packet.h�������������������������������������������������������������������������������������0000644�����������������00000002356�14763166027�0007452 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Definitions for use with Linux SOCK_PACKET sockets. Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __IF_PACKET_H #define __IF_PACKET_H #include <features.h> #include <bits/sockaddr.h> /* This is the SOCK_PACKET address structure as used in Linux 2.0. From Linux 2.1 the AF_PACKET interface is preferred and you should consider using it in place of this one. */ struct sockaddr_pkt { __SOCKADDR_COMMON (spkt_); unsigned char spkt_device[14]; unsigned short spkt_protocol; }; #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������net/ppp_defs.h��������������������������������������������������������������������������������������0000644�����������������00000000254�14763166027�0007320 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _NET_PPP_DEFS_H #define _NET_PPP_DEFS_H 1 #define __need_time_t #include <time.h> #include <asm/types.h> #include <linux/ppp_defs.h> #endif /* net/ppp_defs.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������net/ppp-comp.h��������������������������������������������������������������������������������������0000644�����������������00000000034�14763166027�0007247 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <linux/ppp-comp.h> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������net/ethernet.h��������������������������������������������������������������������������������������0000644�����������������00000006122�14763166027�0007336 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997, 1999, 2001, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* Based on the FreeBSD version of this file. Curiously, that file lacks a copyright in the header. */ #ifndef __NET_ETHERNET_H #define __NET_ETHERNET_H 1 #include <sys/cdefs.h> #include <sys/types.h> #include <linux/if_ether.h> /* IEEE 802.3 Ethernet constants */ __BEGIN_DECLS /* This is a name for the 48 bit ethernet address available on many systems. */ struct ether_addr { u_int8_t ether_addr_octet[ETH_ALEN]; } __attribute__ ((__packed__)); /* 10Mb/s ethernet header */ struct ether_header { u_int8_t ether_dhost[ETH_ALEN]; /* destination eth addr */ u_int8_t ether_shost[ETH_ALEN]; /* source ether addr */ u_int16_t ether_type; /* packet type ID field */ } __attribute__ ((__packed__)); /* Ethernet protocol ID's */ #define ETHERTYPE_PUP 0x0200 /* Xerox PUP */ #define ETHERTYPE_SPRITE 0x0500 /* Sprite */ #define ETHERTYPE_IP 0x0800 /* IP */ #define ETHERTYPE_ARP 0x0806 /* Address resolution */ #define ETHERTYPE_REVARP 0x8035 /* Reverse ARP */ #define ETHERTYPE_AT 0x809B /* AppleTalk protocol */ #define ETHERTYPE_AARP 0x80F3 /* AppleTalk ARP */ #define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tagging */ #define ETHERTYPE_IPX 0x8137 /* IPX */ #define ETHERTYPE_IPV6 0x86dd /* IP protocol version 6 */ #define ETHERTYPE_LOOPBACK 0x9000 /* used to test interfaces */ #define ETHER_ADDR_LEN ETH_ALEN /* size of ethernet addr */ #define ETHER_TYPE_LEN 2 /* bytes in type field */ #define ETHER_CRC_LEN 4 /* bytes in CRC field */ #define ETHER_HDR_LEN ETH_HLEN /* total octets in header */ #define ETHER_MIN_LEN (ETH_ZLEN + ETHER_CRC_LEN) /* min packet length */ #define ETHER_MAX_LEN (ETH_FRAME_LEN + ETHER_CRC_LEN) /* max packet length */ /* make sure ethenet length is valid */ #define ETHER_IS_VALID_LEN(foo) \ ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) /* * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have * (type-ETHERTYPE_TRAIL)*512 bytes of data followed * by an ETHER type (as given above) and then the (variable-length) header. */ #define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ #define ETHERTYPE_NTRAILER 16 #define ETHERMTU ETH_DATA_LEN #define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) __END_DECLS #endif /* net/ethernet.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tiffconf-64.h���������������������������������������������������������������������������������������0000644�����������������00000006545�14763166027�0006770 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* libtiff/tiffconf.h. Generated from tiffconf.h.in by configure. */ /* Configuration defines for installed libtiff. This file maintained for backward compatibility. Do not use definitions from this file in your programs. */ #ifndef _TIFFCONF_ #define _TIFFCONF_ /* Signed 16-bit type */ #define TIFF_INT16_T signed short /* Signed 32-bit type */ #define TIFF_INT32_T signed int /* Signed 64-bit type */ #define TIFF_INT64_T signed long /* Signed 8-bit type */ #define TIFF_INT8_T signed char /* Unsigned 16-bit type */ #define TIFF_UINT16_T unsigned short /* Unsigned 32-bit type */ #define TIFF_UINT32_T unsigned int /* Unsigned 64-bit type */ #define TIFF_UINT64_T unsigned long /* Unsigned 8-bit type */ #define TIFF_UINT8_T unsigned char /* Signed size type */ #define TIFF_SSIZE_T signed long /* Pointer difference type */ #define TIFF_PTRDIFF_T ptrdiff_t /* Define to 1 if the system has the type `int16'. */ /* #undef HAVE_INT16 */ /* Define to 1 if the system has the type `int32'. */ /* #undef HAVE_INT32 */ /* Define to 1 if the system has the type `int8'. */ /* #undef HAVE_INT8 */ /* Compatibility stuff. */ /* Define as 0 or 1 according to the floating point format suported by the machine */ #define HAVE_IEEEFP 1 /* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */ #define HOST_FILLORDER FILLORDER_LSB2MSB /* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian (Intel) */ #define HOST_BIGENDIAN 0 /* Support CCITT Group 3 & 4 algorithms */ #define CCITT_SUPPORT 1 /* Support JPEG compression (requires IJG JPEG library) */ #define JPEG_SUPPORT 1 /* Support JBIG compression (requires JBIG-KIT library) */ #define JBIG_SUPPORT 1 /* Support LogLuv high dynamic range encoding */ #define LOGLUV_SUPPORT 1 /* Support LZW algorithm */ #define LZW_SUPPORT 1 /* Support NeXT 2-bit RLE algorithm */ #define NEXT_SUPPORT 1 /* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation fails with unpatched IJG JPEG library) */ #define OJPEG_SUPPORT 1 /* Support Macintosh PackBits algorithm */ #define PACKBITS_SUPPORT 1 /* Support Pixar log-format algorithm (requires Zlib) */ #define PIXARLOG_SUPPORT 1 /* Support ThunderScan 4-bit RLE algorithm */ #define THUNDER_SUPPORT 1 /* Support Deflate compression */ #define ZIP_SUPPORT 1 /* Support strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of ~8Kb to reduce memory usage) */ #define STRIPCHOP_DEFAULT TIFF_STRIPCHOP /* Enable SubIFD tag (330) support */ #define SUBIFD_SUPPORT 1 /* Treat extra sample as alpha (default enabled). The RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don't mark the alpha properly. */ #define DEFAULT_EXTRASAMPLE_AS_ALPHA 1 /* Pick up YCbCr subsampling info from the JPEG data stream to support files lacking the tag (default enabled). */ #define CHECK_JPEG_YCBCR_SUBSAMPLING 1 /* Support MS MDI magic number files as TIFF */ #define MDI_SUPPORT 1 /* * Feature support definitions. * XXX: These macros are obsoleted. Don't use them in your apps! * Macros stays here for backward compatibility and should be always defined. */ #define COLORIMETRY_SUPPORT #define YCBCR_SUPPORT #define CMYK_SUPPORT #define ICC_SUPPORT #define PHOTOSHOP_SUPPORT #define IPTC_SUPPORT #endif /* _TIFFCONF_ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������ecpg_informix.h�������������������������������������������������������������������������������������0000644�����������������00000005306�14763166027�0007566 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file contains stuff needed to be as compatible to Informix as possible. * src/interfaces/ecpg/include/ecpg_informix.h */ #ifndef _ECPG_INFORMIX_H #define _ECPG_INFORMIX_H #include <ecpglib.h> #include <pgtypes_date.h> #include <pgtypes_interval.h> #include <pgtypes_numeric.h> #include <pgtypes_timestamp.h> #define SQLNOTFOUND 100 #define ECPG_INFORMIX_NUM_OVERFLOW -1200 #define ECPG_INFORMIX_NUM_UNDERFLOW -1201 #define ECPG_INFORMIX_DIVIDE_ZERO -1202 #define ECPG_INFORMIX_BAD_YEAR -1204 #define ECPG_INFORMIX_BAD_MONTH -1205 #define ECPG_INFORMIX_BAD_DAY -1206 #define ECPG_INFORMIX_ENOSHORTDATE -1209 #define ECPG_INFORMIX_DATE_CONVERT -1210 #define ECPG_INFORMIX_OUT_OF_MEMORY -1211 #define ECPG_INFORMIX_ENOTDMY -1212 #define ECPG_INFORMIX_BAD_NUMERIC -1213 #define ECPG_INFORMIX_BAD_EXPONENT -1216 #define ECPG_INFORMIX_BAD_DATE -1218 #define ECPG_INFORMIX_EXTRA_CHARS -1264 #ifdef __cplusplus extern "C" { #endif extern int rdatestr(date, char *); extern void rtoday(date *); extern int rjulmdy(date, short *); extern int rdefmtdate(date *, char *, char *); extern int rfmtdate(date, char *, char *); extern int rmdyjul(short *, date *); extern int rstrdate(char *, date *); extern int rdayofweek(date); extern int rfmtlong(long, char *, char *); extern int rgetmsg(int, char *, int); extern int risnull(int, char *); extern int rsetnull(int, char *); extern int rtypalign(int, int); extern int rtypmsize(int, int); extern int rtypwidth(int, int); extern void rupshift(char *); extern int byleng(char *, int); extern void ldchar(char *, int, char *); extern void ECPG_informix_set_var(int, void *, int); extern void *ECPG_informix_get_var(int); extern void ECPG_informix_reset_sqlca(void); /* Informix defines these in decimal.h */ int decadd(decimal *, decimal *, decimal *); int deccmp(decimal *, decimal *); void deccopy(decimal *, decimal *); int deccvasc(char *, int, decimal *); int deccvdbl(double, decimal *); int deccvint(int, decimal *); int deccvlong(long, decimal *); int decdiv(decimal *, decimal *, decimal *); int decmul(decimal *, decimal *, decimal *); int decsub(decimal *, decimal *, decimal *); int dectoasc(decimal *, char *, int, int); int dectodbl(decimal *, double *); int dectoint(decimal *, int *); int dectolong(decimal *, long *); /* Informix defines these in datetime.h */ extern void dtcurrent(timestamp *); extern int dtcvasc(char *, timestamp *); extern int dtsub(timestamp *, timestamp *, interval *); extern int dttoasc(timestamp *, char *); extern int dttofmtasc(timestamp *, char *, int, char *); extern int intoasc(interval *, char *); extern int dtcvfmtasc(char *, char *, timestamp *); #ifdef __cplusplus } #endif #endif /* ndef _ECPG_INFORMIX_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������zconf.h���������������������������������������������������������������������������������������������0000644�����������������00000035663�14763166027�0006065 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* zconf.h -- configuration of the zlib compression library * Copyright (C) 1995-2012 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ #ifndef ZCONF_H #define ZCONF_H /* * If you *really* need a unique prefix for all types and library functions, * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. * Even better than compiling with -DZ_PREFIX would be to use configure to set * this permanently in zconf.h using "./configure --zprefix". */ #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ # define Z_PREFIX_SET /* all linked symbols */ # define _dist_code z__dist_code # define _length_code z__length_code # define _tr_align z__tr_align # define _tr_flush_block z__tr_flush_block # define _tr_init z__tr_init # define _tr_stored_block z__tr_stored_block # define _tr_tally z__tr_tally # define adler32 z_adler32 # define adler32_combine z_adler32_combine # define adler32_combine64 z_adler32_combine64 # ifndef Z_SOLO # define compress z_compress # define compress2 z_compress2 # define compressBound z_compressBound # endif # define crc32 z_crc32 # define crc32_combine z_crc32_combine # define crc32_combine64 z_crc32_combine64 # define deflate z_deflate # define deflateBound z_deflateBound # define deflateCopy z_deflateCopy # define deflateEnd z_deflateEnd # define deflateInit2_ z_deflateInit2_ # define deflateInit_ z_deflateInit_ # define deflateParams z_deflateParams # define deflatePending z_deflatePending # define deflatePrime z_deflatePrime # define deflateReset z_deflateReset # define deflateResetKeep z_deflateResetKeep # define deflateSetDictionary z_deflateSetDictionary # define deflateSetHeader z_deflateSetHeader # define deflateTune z_deflateTune # define deflate_copyright z_deflate_copyright # define get_crc_table z_get_crc_table # ifndef Z_SOLO # define gz_error z_gz_error # define gz_intmax z_gz_intmax # define gz_strwinerror z_gz_strwinerror # define gzbuffer z_gzbuffer # define gzclearerr z_gzclearerr # define gzclose z_gzclose # define gzclose_r z_gzclose_r # define gzclose_w z_gzclose_w # define gzdirect z_gzdirect # define gzdopen z_gzdopen # define gzeof z_gzeof # define gzerror z_gzerror # define gzflush z_gzflush # define gzgetc z_gzgetc # define gzgetc_ z_gzgetc_ # define gzgets z_gzgets # define gzoffset z_gzoffset # define gzoffset64 z_gzoffset64 # define gzopen z_gzopen # define gzopen64 z_gzopen64 # ifdef _WIN32 # define gzopen_w z_gzopen_w # endif # define gzprintf z_gzprintf # define gzputc z_gzputc # define gzputs z_gzputs # define gzread z_gzread # define gzrewind z_gzrewind # define gzseek z_gzseek # define gzseek64 z_gzseek64 # define gzsetparams z_gzsetparams # define gztell z_gztell # define gztell64 z_gztell64 # define gzungetc z_gzungetc # define gzwrite z_gzwrite # endif # define inflate z_inflate # define inflateBack z_inflateBack # define inflateBackEnd z_inflateBackEnd # define inflateBackInit_ z_inflateBackInit_ # define inflateCopy z_inflateCopy # define inflateEnd z_inflateEnd # define inflateGetHeader z_inflateGetHeader # define inflateInit2_ z_inflateInit2_ # define inflateInit_ z_inflateInit_ # define inflateMark z_inflateMark # define inflatePrime z_inflatePrime # define inflateReset z_inflateReset # define inflateReset2 z_inflateReset2 # define inflateSetDictionary z_inflateSetDictionary # define inflateSync z_inflateSync # define inflateSyncPoint z_inflateSyncPoint # define inflateUndermine z_inflateUndermine # define inflateResetKeep z_inflateResetKeep # define inflate_copyright z_inflate_copyright # define inflate_fast z_inflate_fast # define inflate_table z_inflate_table # ifndef Z_SOLO # define uncompress z_uncompress # endif # define zError z_zError # ifndef Z_SOLO # define zcalloc z_zcalloc # define zcfree z_zcfree # endif # define zlibCompileFlags z_zlibCompileFlags # define zlibVersion z_zlibVersion /* all zlib typedefs in zlib.h and zconf.h */ # define Byte z_Byte # define Bytef z_Bytef # define alloc_func z_alloc_func # define charf z_charf # define free_func z_free_func # ifndef Z_SOLO # define gzFile z_gzFile # endif # define gz_header z_gz_header # define gz_headerp z_gz_headerp # define in_func z_in_func # define intf z_intf # define out_func z_out_func # define uInt z_uInt # define uIntf z_uIntf # define uLong z_uLong # define uLongf z_uLongf # define voidp z_voidp # define voidpc z_voidpc # define voidpf z_voidpf /* all zlib structs in zlib.h and zconf.h */ # define gz_header_s z_gz_header_s # define internal_state z_internal_state #endif #if defined(__MSDOS__) && !defined(MSDOS) # define MSDOS #endif #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) # define OS2 #endif #if defined(_WINDOWS) && !defined(WINDOWS) # define WINDOWS #endif #if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) # ifndef WIN32 # define WIN32 # endif #endif #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) # if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) # ifndef SYS16BIT # define SYS16BIT # endif # endif #endif /* * Compile with -DMAXSEG_64K if the alloc function cannot allocate more * than 64k bytes at a time (needed on systems with 16-bit int). */ #ifdef SYS16BIT # define MAXSEG_64K #endif #ifdef MSDOS # define UNALIGNED_OK #endif #ifdef __STDC_VERSION__ # ifndef STDC # define STDC # endif # if __STDC_VERSION__ >= 199901L # ifndef STDC99 # define STDC99 # endif # endif #endif #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) # define STDC #endif #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) # define STDC #endif #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) # define STDC #endif #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) # define STDC #endif #if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ # define STDC #endif #ifndef STDC # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ # define const /* note: need a more gentle solution here */ # endif #endif #if defined(ZLIB_CONST) && !defined(z_const) # define z_const const #else # define z_const #endif /* Some Mac compilers merge all .h files incorrectly: */ #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) # define NO_DUMMY_DECL #endif /* Maximum value for memLevel in deflateInit2 */ #ifndef MAX_MEM_LEVEL # ifdef MAXSEG_64K # define MAX_MEM_LEVEL 8 # else # define MAX_MEM_LEVEL 9 # endif #endif /* Maximum value for windowBits in deflateInit2 and inflateInit2. * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files * created by gzip. (Files created by minigzip can still be extracted by * gzip.) */ #ifndef MAX_WBITS # define MAX_WBITS 15 /* 32K LZ77 window */ #endif /* The memory requirements for deflate are (in bytes): (1 << (windowBits+2)) + (1 << (memLevel+9)) that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) plus a few kilobytes for small objects. For example, if you want to reduce the default memory requirements from 256K to 128K, compile with make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" Of course this will generally degrade compression (there's no free lunch). The memory requirements for inflate are (in bytes) 1 << windowBits that is, 32K for windowBits=15 (default value) plus a few kilobytes for small objects. */ /* Type declarations */ #ifndef OF /* function prototypes */ # ifdef STDC # define OF(args) args # else # define OF(args) () # endif #endif #ifndef Z_ARG /* function prototypes for stdarg */ # if defined(STDC) || defined(Z_HAVE_STDARG_H) # define Z_ARG(args) args # else # define Z_ARG(args) () # endif #endif /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, * just define FAR to be empty. */ #ifdef SYS16BIT # if defined(M_I86SM) || defined(M_I86MM) /* MSC small or medium model */ # define SMALL_MEDIUM # ifdef _MSC_VER # define FAR _far # else # define FAR far # endif # endif # if (defined(__SMALL__) || defined(__MEDIUM__)) /* Turbo C small or medium model */ # define SMALL_MEDIUM # ifdef __BORLANDC__ # define FAR _far # else # define FAR far # endif # endif #endif #if defined(WINDOWS) || defined(WIN32) /* If building or using zlib as a DLL, define ZLIB_DLL. * This is not mandatory, but it offers a little performance increase. */ # ifdef ZLIB_DLL # if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) # ifdef ZLIB_INTERNAL # define ZEXTERN extern __declspec(dllexport) # else # define ZEXTERN extern __declspec(dllimport) # endif # endif # endif /* ZLIB_DLL */ /* If building or using zlib with the WINAPI/WINAPIV calling convention, * define ZLIB_WINAPI. * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. */ # ifdef ZLIB_WINAPI # ifdef FAR # undef FAR # endif # include <windows.h> /* No need for _export, use ZLIB.DEF instead. */ /* For complete Windows compatibility, use WINAPI, not __stdcall. */ # define ZEXPORT WINAPI # ifdef WIN32 # define ZEXPORTVA WINAPIV # else # define ZEXPORTVA FAR CDECL # endif # endif #endif #if defined (__BEOS__) # ifdef ZLIB_DLL # ifdef ZLIB_INTERNAL # define ZEXPORT __declspec(dllexport) # define ZEXPORTVA __declspec(dllexport) # else # define ZEXPORT __declspec(dllimport) # define ZEXPORTVA __declspec(dllimport) # endif # endif #endif #ifndef ZEXTERN # define ZEXTERN extern #endif #ifndef ZEXPORT # define ZEXPORT #endif #ifndef ZEXPORTVA # define ZEXPORTVA #endif #ifndef FAR # define FAR #endif #if !defined(__MACTYPES__) typedef unsigned char Byte; /* 8 bits */ #endif typedef unsigned int uInt; /* 16 bits or more */ typedef unsigned long uLong; /* 32 bits or more */ #ifdef SMALL_MEDIUM /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ # define Bytef Byte FAR #else typedef Byte FAR Bytef; #endif typedef char FAR charf; typedef int FAR intf; typedef uInt FAR uIntf; typedef uLong FAR uLongf; #ifdef STDC typedef void const *voidpc; typedef void FAR *voidpf; typedef void *voidp; #else typedef Byte const *voidpc; typedef Byte FAR *voidpf; typedef Byte *voidp; #endif #define Z_U4 unsigned /* ./configure put the #define Z_U4 here */ #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) # include <limits.h> # if (UINT_MAX == 0xffffffffUL) # define Z_U4 unsigned # else # if (ULONG_MAX == 0xffffffffUL) # define Z_U4 unsigned long # else # if (USHRT_MAX == 0xffffffffUL) # define Z_U4 unsigned short # endif # endif # endif #endif #ifdef Z_U4 typedef Z_U4 z_crc_t; #else typedef unsigned long z_crc_t; #endif #if 1 /* was set to #if 1 by ./configure */ # define Z_HAVE_UNISTD_H #endif #if 1 /* was set to #if 1 by ./configure */ # define Z_HAVE_STDARG_H #endif #ifdef STDC # ifndef Z_SOLO # include <sys/types.h> /* for off_t */ # endif #endif #ifdef _WIN32 # include <stddef.h> /* for wchar_t */ #endif /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even * though the former does not conform to the LFS document), but considering * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as * equivalently requesting no 64-bit operations */ #if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 # undef _LARGEFILE64_SOURCE #endif #if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) # define Z_HAVE_UNISTD_H #endif #ifndef Z_SOLO # if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE) # include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ # ifdef VMS # include <unixio.h> /* for off_t */ # endif # ifndef z_off_t # define z_off_t off_t # endif # endif #endif #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 # define Z_LFS64 #endif #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) # define Z_LARGE64 #endif #if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) # define Z_WANT64 #endif #if !defined(SEEK_SET) && !defined(Z_SOLO) # define SEEK_SET 0 /* Seek from beginning of file. */ # define SEEK_CUR 1 /* Seek from current position. */ # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ #endif #ifndef z_off_t # define z_off_t long #endif #if !defined(_WIN32) && defined(Z_LARGE64) # define z_off64_t off64_t #else # if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) # define z_off64_t __int64 # else # define z_off64_t z_off_t # endif #endif /* MVS linker does not support external names larger than 8 bytes */ #if defined(__MVS__) #pragma map(deflateInit_,"DEIN") #pragma map(deflateInit2_,"DEIN2") #pragma map(deflateEnd,"DEEND") #pragma map(deflateBound,"DEBND") #pragma map(inflateInit_,"ININ") #pragma map(inflateInit2_,"ININ2") #pragma map(inflateEnd,"INEND") #pragma map(inflateSync,"INSY") #pragma map(inflateSetDictionary,"INSEDI") #pragma map(compressBound,"CMBND") #pragma map(inflate_table,"INTABL") #pragma map(inflate_fast,"INFA") #pragma map(inflate_copyright,"INCOPY") #endif #endif /* ZCONF_H */ �����������������������������������������������������������������������������gcrypt-module.h�������������������������������������������������������������������������������������0000644�����������������00000016264�14763166027�0007535 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* gcrypt-module.h - GNU Cryptographic Library Interface Copyright (C) 2003, 2007 Free Software Foundation, Inc. This file is part of Libgcrypt. Libgcrypt is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. Libgcrypt 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. */ /* This file contains the necessary declarations/definitions for working with Libgcrypt modules. */ #ifndef _GCRYPT_MODULE_H #define _GCRYPT_MODULE_H #ifdef __cplusplus extern "C" { #if 0 /* keep Emacsens's auto-indent happy */ } #endif #endif /* The interfaces using the module system reserve a certain range of IDs for application use. These IDs are not valid within Libgcrypt but Libgcrypt makes sure never to allocate such a module ID. */ #define GCRY_MODULE_ID_USER 1024 #define GCRY_MODULE_ID_USER_LAST 4095 /* This type represents a `module'. */ typedef struct gcry_module *gcry_module_t; /* Check that the library fulfills the version requirement. */ /* Type for the cipher_setkey function. */ typedef gcry_err_code_t (*gcry_cipher_setkey_t) (void *c, const unsigned char *key, unsigned keylen); /* Type for the cipher_encrypt function. */ typedef void (*gcry_cipher_encrypt_t) (void *c, unsigned char *outbuf, const unsigned char *inbuf); /* Type for the cipher_decrypt function. */ typedef void (*gcry_cipher_decrypt_t) (void *c, unsigned char *outbuf, const unsigned char *inbuf); /* Type for the cipher_stencrypt function. */ typedef void (*gcry_cipher_stencrypt_t) (void *c, unsigned char *outbuf, const unsigned char *inbuf, unsigned int n); /* Type for the cipher_stdecrypt function. */ typedef void (*gcry_cipher_stdecrypt_t) (void *c, unsigned char *outbuf, const unsigned char *inbuf, unsigned int n); typedef struct gcry_cipher_oid_spec { const char *oid; int mode; } gcry_cipher_oid_spec_t; /* Module specification structure for ciphers. */ typedef struct gcry_cipher_spec { const char *name; const char **aliases; gcry_cipher_oid_spec_t *oids; size_t blocksize; size_t keylen; size_t contextsize; gcry_cipher_setkey_t setkey; gcry_cipher_encrypt_t encrypt; gcry_cipher_decrypt_t decrypt; gcry_cipher_stencrypt_t stencrypt; gcry_cipher_stdecrypt_t stdecrypt; } gcry_cipher_spec_t; /* Register a new cipher module whose specification can be found in CIPHER. On success, a new algorithm ID is stored in ALGORITHM_ID and a pointer representing this module is stored in MODULE. */ gcry_error_t gcry_cipher_register (gcry_cipher_spec_t *cipher, int *algorithm_id, gcry_module_t *module) /* */ _GCRY_ATTR_INTERNAL; /* Unregister the cipher identified by MODULE, which must have been registered with gcry_cipher_register. */ void gcry_cipher_unregister (gcry_module_t module) /* */ _GCRY_ATTR_INTERNAL; /* ********************** */ /* Type for the pk_generate function. */ typedef gcry_err_code_t (*gcry_pk_generate_t) (int algo, unsigned int nbits, unsigned long use_e, gcry_mpi_t *skey, gcry_mpi_t **retfactors); /* Type for the pk_check_secret_key function. */ typedef gcry_err_code_t (*gcry_pk_check_secret_key_t) (int algo, gcry_mpi_t *skey); /* Type for the pk_encrypt function. */ typedef gcry_err_code_t (*gcry_pk_encrypt_t) (int algo, gcry_mpi_t *resarr, gcry_mpi_t data, gcry_mpi_t *pkey, int flags); /* Type for the pk_decrypt function. */ typedef gcry_err_code_t (*gcry_pk_decrypt_t) (int algo, gcry_mpi_t *result, gcry_mpi_t *data, gcry_mpi_t *skey, int flags); /* Type for the pk_sign function. */ typedef gcry_err_code_t (*gcry_pk_sign_t) (int algo, gcry_mpi_t *resarr, gcry_mpi_t data, gcry_mpi_t *skey); /* Type for the pk_verify function. */ typedef gcry_err_code_t (*gcry_pk_verify_t) (int algo, gcry_mpi_t hash, gcry_mpi_t *data, gcry_mpi_t *pkey, int (*cmp) (void *, gcry_mpi_t), void *opaquev); /* Type for the pk_get_nbits function. */ typedef unsigned (*gcry_pk_get_nbits_t) (int algo, gcry_mpi_t *pkey); /* Module specification structure for message digests. */ typedef struct gcry_pk_spec { const char *name; const char **aliases; const char *elements_pkey; const char *elements_skey; const char *elements_enc; const char *elements_sig; const char *elements_grip; int use; gcry_pk_generate_t generate; gcry_pk_check_secret_key_t check_secret_key; gcry_pk_encrypt_t encrypt; gcry_pk_decrypt_t decrypt; gcry_pk_sign_t sign; gcry_pk_verify_t verify; gcry_pk_get_nbits_t get_nbits; } gcry_pk_spec_t; /* Register a new pubkey module whose specification can be found in PUBKEY. On success, a new algorithm ID is stored in ALGORITHM_ID and a pointer representhing this module is stored in MODULE. */ gcry_error_t gcry_pk_register (gcry_pk_spec_t *pubkey, unsigned int *algorithm_id, gcry_module_t *module) /* */ _GCRY_ATTR_INTERNAL; /* Unregister the pubkey identified by ID, which must have been registered with gcry_pk_register. */ void gcry_pk_unregister (gcry_module_t module) /* */ _GCRY_ATTR_INTERNAL; /* ********************** */ /* Type for the md_init function. */ typedef void (*gcry_md_init_t) (void *c); /* Type for the md_write function. */ typedef void (*gcry_md_write_t) (void *c, const void *buf, size_t nbytes); /* Type for the md_final function. */ typedef void (*gcry_md_final_t) (void *c); /* Type for the md_read function. */ typedef unsigned char *(*gcry_md_read_t) (void *c); typedef struct gcry_md_oid_spec { const char *oidstring; } gcry_md_oid_spec_t; /* Module specification structure for message digests. */ typedef struct gcry_md_spec { const char *name; unsigned char *asnoid; int asnlen; gcry_md_oid_spec_t *oids; int mdlen; gcry_md_init_t init; gcry_md_write_t write; gcry_md_final_t final; gcry_md_read_t read; size_t contextsize; /* allocate this amount of context */ } gcry_md_spec_t; /* Register a new digest module whose specification can be found in DIGEST. On success, a new algorithm ID is stored in ALGORITHM_ID and a pointer representhing this module is stored in MODULE. */ gcry_error_t gcry_md_register (gcry_md_spec_t *digest, unsigned int *algorithm_id, gcry_module_t *module) /* */ _GCRY_ATTR_INTERNAL; /* Unregister the digest identified by ID, which must have been registered with gcry_digest_register. */ void gcry_md_unregister (gcry_module_t module) /* */ _GCRY_ATTR_INTERNAL; #if 0 /* keep Emacsens's auto-indent happy */ { #endif #ifdef __cplusplus } #endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgtypes_numeric.h�����������������������������������������������������������������������������������0000644�����������������00000004263�14763166027�0010153 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef PGTYPES_NUMERIC #define PGTYPES_NUMERIC #define NUMERIC_POS 0x0000 #define NUMERIC_NEG 0x4000 #define NUMERIC_NAN 0xC000 #define NUMERIC_NULL 0xF000 #define NUMERIC_MAX_PRECISION 1000 #define NUMERIC_MAX_DISPLAY_SCALE NUMERIC_MAX_PRECISION #define NUMERIC_MIN_DISPLAY_SCALE 0 #define NUMERIC_MIN_SIG_DIGITS 16 #define DECSIZE 30 typedef unsigned char NumericDigit; typedef struct { int ndigits; /* number of digits in digits[] - can be 0! */ int weight; /* weight of first digit */ int rscale; /* result scale */ int dscale; /* display scale */ int sign; /* NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN */ NumericDigit *buf; /* start of alloc'd space for digits[] */ NumericDigit *digits; /* decimal digits */ } numeric; typedef struct { int ndigits; /* number of digits in digits[] - can be 0! */ int weight; /* weight of first digit */ int rscale; /* result scale */ int dscale; /* display scale */ int sign; /* NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN */ NumericDigit digits[DECSIZE]; /* decimal digits */ } decimal; #ifdef __cplusplus extern "C" { #endif numeric *PGTYPESnumeric_new(void); decimal *PGTYPESdecimal_new(void); void PGTYPESnumeric_free(numeric *); void PGTYPESdecimal_free(decimal *); numeric *PGTYPESnumeric_from_asc(char *, char **); char *PGTYPESnumeric_to_asc(numeric *, int); int PGTYPESnumeric_add(numeric *, numeric *, numeric *); int PGTYPESnumeric_sub(numeric *, numeric *, numeric *); int PGTYPESnumeric_mul(numeric *, numeric *, numeric *); int PGTYPESnumeric_div(numeric *, numeric *, numeric *); int PGTYPESnumeric_cmp(numeric *, numeric *); int PGTYPESnumeric_from_int(signed int, numeric *); int PGTYPESnumeric_from_long(signed long int, numeric *); int PGTYPESnumeric_copy(numeric *, numeric *); int PGTYPESnumeric_from_double(double, numeric *); int PGTYPESnumeric_to_double(numeric *, double *); int PGTYPESnumeric_to_int(numeric *, int *); int PGTYPESnumeric_to_long(numeric *, long *); int PGTYPESnumeric_to_decimal(numeric *, decimal *); int PGTYPESnumeric_from_decimal(decimal *, numeric *); #ifdef __cplusplus } #endif #endif /* PGTYPES_NUMERIC */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/pyctype.h���������������������������������������������������������������������������������0000644�����������������00000002364�14763166027�0010203 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef PYCTYPE_H #define PYCTYPE_H #define PY_CTF_LOWER 0x01 #define PY_CTF_UPPER 0x02 #define PY_CTF_ALPHA (PY_CTF_LOWER|PY_CTF_UPPER) #define PY_CTF_DIGIT 0x04 #define PY_CTF_ALNUM (PY_CTF_ALPHA|PY_CTF_DIGIT) #define PY_CTF_SPACE 0x08 #define PY_CTF_XDIGIT 0x10 PyAPI_DATA(const unsigned int) _Py_ctype_table[256]; /* Unlike their C counterparts, the following macros are not meant to * handle an int with any of the values [EOF, 0-UCHAR_MAX]. The argument * must be a signed/unsigned char. */ #define Py_ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_LOWER) #define Py_ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_UPPER) #define Py_ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALPHA) #define Py_ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_DIGIT) #define Py_ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_XDIGIT) #define Py_ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALNUM) #define Py_ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_SPACE) PyAPI_DATA(const unsigned char) _Py_ctype_tolower[256]; PyAPI_DATA(const unsigned char) _Py_ctype_toupper[256]; #define Py_TOLOWER(c) (_Py_ctype_tolower[Py_CHARMASK(c)]) #define Py_TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)]) #endif /* !PYCTYPE_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/genobject.h�������������������������������������������������������������������������������0000644�����������������00000001573�14763166027�0010447 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Generator object interface */ #ifndef Py_GENOBJECT_H #define Py_GENOBJECT_H #ifdef __cplusplus extern "C" { #endif struct _frame; /* Avoid including frameobject.h */ typedef struct { PyObject_HEAD /* The gi_ prefix is intended to remind of generator-iterator. */ /* Note: gi_frame can be NULL if the generator is "finished" */ struct _frame *gi_frame; /* True if generator is being executed. */ int gi_running; /* The code object backing the generator */ PyObject *gi_code; /* List of weak reference. */ PyObject *gi_weakreflist; } PyGenObject; PyAPI_DATA(PyTypeObject) PyGen_Type; #define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type) #define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type) PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *); PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *); #ifdef __cplusplus } #endif #endif /* !Py_GENOBJECT_H */ �������������������������������������������������������������������������������������������������������������������������������������python2.7/metagrammar.h�����������������������������������������������������������������������������0000644�����������������00000000375�14763166027�0011003 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_METAGRAMMAR_H #define Py_METAGRAMMAR_H #ifdef __cplusplus extern "C" { #endif #define MSTART 256 #define RULE 257 #define RHS 258 #define ALT 259 #define ITEM 260 #define ATOM 261 #ifdef __cplusplus } #endif #endif /* !Py_METAGRAMMAR_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/intrcheck.h�������������������������������������������������������������������������������0000644�����������������00000000422�14763166027�0010451 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� #ifndef Py_INTRCHECK_H #define Py_INTRCHECK_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(int) PyOS_InterruptOccurred(void); PyAPI_FUNC(void) PyOS_InitInterrupts(void); PyAPI_FUNC(void) PyOS_AfterFork(void); #ifdef __cplusplus } #endif #endif /* !Py_INTRCHECK_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/node.h������������������������������������������������������������������������������������0000644�����������������00000001674�14763166027�0007436 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Parse tree node interface */ #ifndef Py_NODE_H #define Py_NODE_H #ifdef __cplusplus extern "C" { #endif typedef struct _node { short n_type; char *n_str; int n_lineno; int n_col_offset; int n_nchildren; struct _node *n_child; } node; PyAPI_FUNC(node *) PyNode_New(int type); PyAPI_FUNC(int) PyNode_AddChild(node *n, int type, char *str, int lineno, int col_offset); PyAPI_FUNC(void) PyNode_Free(node *n); #ifndef Py_LIMITED_API Py_ssize_t _PyNode_SizeOf(node *n); #endif /* Node access functions */ #define NCH(n) ((n)->n_nchildren) #define CHILD(n, i) (&(n)->n_child[i]) #define RCHILD(n, i) (CHILD(n, NCH(n) + i)) #define TYPE(n) ((n)->n_type) #define STR(n) ((n)->n_str) /* Assert that the type of a node is what we expect */ #define REQ(n, type) assert(TYPE(n) == (type)) PyAPI_FUNC(void) PyNode_ListTree(node *); #ifdef __cplusplus } #endif #endif /* !Py_NODE_H */ ��������������������������������������������������������������������python2.7/pycapsule.h�������������������������������������������������������������������������������0000644�����������������00000003217�14763166027�0010511 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Capsule objects let you wrap a C "void *" pointer in a Python object. They're a way of passing data through the Python interpreter without creating your own custom type. Capsules are used for communication between extension modules. They provide a way for an extension module to export a C interface to other extension modules, so that extension modules can use the Python import mechanism to link to one another. For more information, please see "c-api/capsule.html" in the documentation. */ #ifndef Py_CAPSULE_H #define Py_CAPSULE_H #ifdef __cplusplus extern "C" { #endif PyAPI_DATA(PyTypeObject) PyCapsule_Type; typedef void (*PyCapsule_Destructor)(PyObject *); #define PyCapsule_CheckExact(op) (Py_TYPE(op) == &PyCapsule_Type) PyAPI_FUNC(PyObject *) PyCapsule_New( void *pointer, const char *name, PyCapsule_Destructor destructor); PyAPI_FUNC(void *) PyCapsule_GetPointer(PyObject *capsule, const char *name); PyAPI_FUNC(PyCapsule_Destructor) PyCapsule_GetDestructor(PyObject *capsule); PyAPI_FUNC(const char *) PyCapsule_GetName(PyObject *capsule); PyAPI_FUNC(void *) PyCapsule_GetContext(PyObject *capsule); PyAPI_FUNC(int) PyCapsule_IsValid(PyObject *capsule, const char *name); PyAPI_FUNC(int) PyCapsule_SetPointer(PyObject *capsule, void *pointer); PyAPI_FUNC(int) PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor); PyAPI_FUNC(int) PyCapsule_SetName(PyObject *capsule, const char *name); PyAPI_FUNC(int) PyCapsule_SetContext(PyObject *capsule, void *context); PyAPI_FUNC(void *) PyCapsule_Import(const char *name, int no_block); #ifdef __cplusplus } #endif #endif /* !Py_CAPSULE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/longintrepr.h�����������������������������������������������������������������������������0000644�����������������00000007503�14763166027�0011051 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_LONGINTREPR_H #define Py_LONGINTREPR_H #ifdef __cplusplus extern "C" { #endif /* This is published for the benefit of "friend" marshal.c only. */ /* Parameters of the long integer representation. There are two different sets of parameters: one set for 30-bit digits, stored in an unsigned 32-bit integer type, and one set for 15-bit digits with each digit stored in an unsigned short. The value of PYLONG_BITS_IN_DIGIT, defined either at configure time or in pyport.h, is used to decide which digit size to use. Type 'digit' should be able to hold 2*PyLong_BASE-1, and type 'twodigits' should be an unsigned integer type able to hold all integers up to PyLong_BASE*PyLong_BASE-1. x_sub assumes that 'digit' is an unsigned type, and that overflow is handled by taking the result modulo 2**N for some N > PyLong_SHIFT. The majority of the code doesn't care about the precise value of PyLong_SHIFT, but there are some notable exceptions: - long_pow() requires that PyLong_SHIFT be divisible by 5 - PyLong_{As,From}ByteArray require that PyLong_SHIFT be at least 8 - long_hash() requires that PyLong_SHIFT is *strictly* less than the number of bits in an unsigned long, as do the PyLong <-> long (or unsigned long) conversion functions - the long <-> size_t/Py_ssize_t conversion functions expect that PyLong_SHIFT is strictly less than the number of bits in a size_t - the marshal code currently expects that PyLong_SHIFT is a multiple of 15 The values 15 and 30 should fit all of the above requirements, on any platform. */ #if PYLONG_BITS_IN_DIGIT == 30 #if !(defined HAVE_UINT64_T && defined HAVE_UINT32_T && \ defined HAVE_INT64_T && defined HAVE_INT32_T) #error "30-bit long digits requested, but the necessary types are not available on this platform" #endif typedef PY_UINT32_T digit; typedef PY_INT32_T sdigit; /* signed variant of digit */ typedef PY_UINT64_T twodigits; typedef PY_INT64_T stwodigits; /* signed variant of twodigits */ #define PyLong_SHIFT 30 #define _PyLong_DECIMAL_SHIFT 9 /* max(e such that 10**e fits in a digit) */ #define _PyLong_DECIMAL_BASE ((digit)1000000000) /* 10 ** DECIMAL_SHIFT */ #elif PYLONG_BITS_IN_DIGIT == 15 typedef unsigned short digit; typedef short sdigit; /* signed variant of digit */ typedef unsigned long twodigits; typedef long stwodigits; /* signed variant of twodigits */ #define PyLong_SHIFT 15 #define _PyLong_DECIMAL_SHIFT 4 /* max(e such that 10**e fits in a digit) */ #define _PyLong_DECIMAL_BASE ((digit)10000) /* 10 ** DECIMAL_SHIFT */ #else #error "PYLONG_BITS_IN_DIGIT should be 15 or 30" #endif #define PyLong_BASE ((digit)1 << PyLong_SHIFT) #define PyLong_MASK ((digit)(PyLong_BASE - 1)) /* b/w compatibility with Python 2.5 */ #define SHIFT PyLong_SHIFT #define BASE PyLong_BASE #define MASK PyLong_MASK #if PyLong_SHIFT % 5 != 0 #error "longobject.c requires that PyLong_SHIFT be divisible by 5" #endif /* Long integer representation. The absolute value of a number is equal to SUM(for i=0 through abs(ob_size)-1) ob_digit[i] * 2**(SHIFT*i) Negative numbers are represented with ob_size < 0; zero is represented by ob_size == 0. In a normalized number, ob_digit[abs(ob_size)-1] (the most significant digit) is never zero. Also, in all cases, for all valid i, 0 <= ob_digit[i] <= MASK. The allocation function takes care of allocating extra memory so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available. CAUTION: Generic code manipulating subtypes of PyVarObject has to aware that longs abuse ob_size's sign bit. */ struct _longobject { PyObject_VAR_HEAD digit ob_digit[1]; }; PyAPI_FUNC(PyLongObject *) _PyLong_New(Py_ssize_t); /* Return a copy of src. */ PyAPI_FUNC(PyObject *) _PyLong_Copy(PyLongObject *src); #ifdef __cplusplus } #endif #endif /* !Py_LONGINTREPR_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/graminit.h��������������������������������������������������������������������������������0000644�����������������00000003575�14763166027�0010325 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Generated by Parser/pgen */ #define single_input 256 #define file_input 257 #define eval_input 258 #define decorator 259 #define decorators 260 #define decorated 261 #define funcdef 262 #define parameters 263 #define varargslist 264 #define fpdef 265 #define fplist 266 #define stmt 267 #define simple_stmt 268 #define small_stmt 269 #define expr_stmt 270 #define augassign 271 #define print_stmt 272 #define del_stmt 273 #define pass_stmt 274 #define flow_stmt 275 #define break_stmt 276 #define continue_stmt 277 #define return_stmt 278 #define yield_stmt 279 #define raise_stmt 280 #define import_stmt 281 #define import_name 282 #define import_from 283 #define import_as_name 284 #define dotted_as_name 285 #define import_as_names 286 #define dotted_as_names 287 #define dotted_name 288 #define global_stmt 289 #define exec_stmt 290 #define assert_stmt 291 #define compound_stmt 292 #define if_stmt 293 #define while_stmt 294 #define for_stmt 295 #define try_stmt 296 #define with_stmt 297 #define with_item 298 #define except_clause 299 #define suite 300 #define testlist_safe 301 #define old_test 302 #define old_lambdef 303 #define test 304 #define or_test 305 #define and_test 306 #define not_test 307 #define comparison 308 #define comp_op 309 #define expr 310 #define xor_expr 311 #define and_expr 312 #define shift_expr 313 #define arith_expr 314 #define term 315 #define factor 316 #define power 317 #define atom 318 #define listmaker 319 #define testlist_comp 320 #define lambdef 321 #define trailer 322 #define subscriptlist 323 #define subscript 324 #define sliceop 325 #define exprlist 326 #define testlist 327 #define dictorsetmaker 328 #define classdef 329 #define arglist 330 #define argument 331 #define list_iter 332 #define list_for 333 #define list_if 334 #define comp_iter 335 #define comp_for 336 #define comp_if 337 #define testlist1 338 #define encoding_decl 339 #define yield_expr 340 �����������������������������������������������������������������������������������������������������������������������������������python2.7/frameobject.h�����������������������������������������������������������������������������0000644�����������������00000006247�14763166027�0010773 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Frame object interface */ #ifndef Py_FRAMEOBJECT_H #define Py_FRAMEOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef struct { int b_type; /* what kind of block this is */ int b_handler; /* where to jump to find handler */ int b_level; /* value stack level to pop to */ } PyTryBlock; typedef struct _frame { PyObject_VAR_HEAD struct _frame *f_back; /* previous frame, or NULL */ PyCodeObject *f_code; /* code segment */ PyObject *f_builtins; /* builtin symbol table (PyDictObject) */ PyObject *f_globals; /* global symbol table (PyDictObject) */ PyObject *f_locals; /* local symbol table (any mapping) */ PyObject **f_valuestack; /* points after the last local */ /* Next free slot in f_valuestack. Frame creation sets to f_valuestack. Frame evaluation usually NULLs it, but a frame that yields sets it to the current stack top. */ PyObject **f_stacktop; PyObject *f_trace; /* Trace function */ /* If an exception is raised in this frame, the next three are used to * record the exception info (if any) originally in the thread state. See * comments before set_exc_info() -- it's not obvious. * Invariant: if _type is NULL, then so are _value and _traceback. * Desired invariant: all three are NULL, or all three are non-NULL. That * one isn't currently true, but "should be". */ PyObject *f_exc_type, *f_exc_value, *f_exc_traceback; PyThreadState *f_tstate; int f_lasti; /* Last instruction if called */ /* Call PyFrame_GetLineNumber() instead of reading this field directly. As of 2.3 f_lineno is only valid when tracing is active (i.e. when f_trace is set). At other times we use PyCode_Addr2Line to calculate the line from the current bytecode index. */ int f_lineno; /* Current line number */ int f_iblock; /* index in f_blockstack */ PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */ PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */ } PyFrameObject; /* Standard object interface */ PyAPI_DATA(PyTypeObject) PyFrame_Type; #define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type) #define PyFrame_IsRestricted(f) \ ((f)->f_builtins != (f)->f_tstate->interp->builtins) PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, PyObject *, PyObject *); /* The rest of the interface is specific for frame objects */ /* Block management functions */ PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int); PyAPI_FUNC(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *); /* Extend the value stack */ PyAPI_FUNC(PyObject **) PyFrame_ExtendStack(PyFrameObject *, int, int); /* Conversions between "fast locals" and locals in dictionary */ PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int); PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *); PyAPI_FUNC(int) PyFrame_ClearFreeList(void); PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE *out); /* Return the line of code the frame is currently executing. */ PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *); #ifdef __cplusplus } #endif #endif /* !Py_FRAMEOBJECT_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/ucnhash.h���������������������������������������������������������������������������������0000644�����������������00000001634�14763166027�0010136 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Unicode name database interface */ #ifndef Py_UCNHASH_H #define Py_UCNHASH_H #ifdef __cplusplus extern "C" { #endif /* revised ucnhash CAPI interface (exported through a "wrapper") */ #define PyUnicodeData_CAPSULE_NAME "unicodedata.ucnhash_CAPI" typedef struct { /* Size of this struct */ int size; /* Get name for a given character code. Returns non-zero if success, zero if not. Does not set Python exceptions. If self is NULL, data come from the default version of the database. If it is not NULL, it should be a unicodedata.ucd_X_Y_Z object */ int (*getname)(PyObject *self, Py_UCS4 code, char* buffer, int buflen); /* Get character code for a given name. Same error handling as for getname. */ int (*getcode)(PyObject *self, const char* name, int namelen, Py_UCS4* code); } _PyUnicode_Name_CAPI; #ifdef __cplusplus } #endif #endif /* !Py_UCNHASH_H */ ����������������������������������������������������������������������������������������������������python2.7/cobject.h���������������������������������������������������������������������������������0000644�����������������00000005562�14763166027�0010122 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* CObjects are marked Pending Deprecation as of Python 2.7. The full schedule for 2.x is as follows: - CObjects are marked Pending Deprecation in Python 2.7. - CObjects will be marked Deprecated in Python 2.8 (if there is one). - CObjects will be removed in Python 2.9 (if there is one). Additionally, for the Python 3.x series: - CObjects were marked Deprecated in Python 3.1. - CObjects will be removed in Python 3.2. You should switch all use of CObjects to capsules. Capsules have a safer and more consistent API. For more information, see Include/pycapsule.h, or read the "Capsules" topic in the "Python/C API Reference Manual". Python 2.7 no longer uses CObjects itself; all objects which were formerly CObjects are now capsules. Note that this change does not by itself break binary compatibility with extensions built for previous versions of Python--PyCObject_AsVoidPtr() has been changed to also understand capsules. */ /* original file header comment follows: */ /* C objects to be exported from one extension module to another. C objects are used for communication between extension modules. They provide a way for an extension module to export a C interface to other extension modules, so that extension modules can use the Python import mechanism to link to one another. */ #ifndef Py_COBJECT_H #define Py_COBJECT_H #ifdef __cplusplus extern "C" { #endif PyAPI_DATA(PyTypeObject) PyCObject_Type; #define PyCObject_Check(op) (Py_TYPE(op) == &PyCObject_Type) /* Create a PyCObject from a pointer to a C object and an optional destructor function. If the second argument is non-null, then it will be called with the first argument if and when the PyCObject is destroyed. */ PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtr( void *cobj, void (*destruct)(void*)); /* Create a PyCObject from a pointer to a C object, a description object, and an optional destructor function. If the third argument is non-null, then it will be called with the first and second arguments if and when the PyCObject is destroyed. */ PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtrAndDesc( void *cobj, void *desc, void (*destruct)(void*,void*)); /* Retrieve a pointer to a C object from a PyCObject. */ PyAPI_FUNC(void *) PyCObject_AsVoidPtr(PyObject *); /* Retrieve a pointer to a description object from a PyCObject. */ PyAPI_FUNC(void *) PyCObject_GetDesc(PyObject *); /* Import a pointer to a C object from a module using a PyCObject. */ PyAPI_FUNC(void *) PyCObject_Import(char *module_name, char *cobject_name); /* Modify a C object. Fails (==0) if object has a destructor. */ PyAPI_FUNC(int) PyCObject_SetVoidPtr(PyObject *self, void *cobj); typedef struct { PyObject_HEAD void *cobject; void *desc; void (*destructor)(void *); } PyCObject; #ifdef __cplusplus } #endif #endif /* !Py_COBJECT_H */ ����������������������������������������������������������������������������������������������������������������������������������������������python2.7/import.h����������������������������������������������������������������������������������0000644�����������������00000004255�14763166027�0010021 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Module definition and import interface */ #ifndef Py_IMPORT_H #define Py_IMPORT_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(long) PyImport_GetMagicNumber(void); PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(char *name, PyObject *co); PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx( char *name, PyObject *co, char *pathname); PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void); PyAPI_FUNC(PyObject *) PyImport_AddModule(const char *name); PyAPI_FUNC(PyObject *) PyImport_ImportModule(const char *name); PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(const char *); PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(char *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level); #define PyImport_ImportModuleEx(n, g, l, f) \ PyImport_ImportModuleLevel(n, g, l, f, -1) PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path); PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name); PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m); PyAPI_FUNC(void) PyImport_Cleanup(void); PyAPI_FUNC(int) PyImport_ImportFrozenModule(char *); #ifdef WITH_THREAD PyAPI_FUNC(void) _PyImport_AcquireLock(void); PyAPI_FUNC(int) _PyImport_ReleaseLock(void); #else #define _PyImport_AcquireLock() #define _PyImport_ReleaseLock() 1 #endif PyAPI_FUNC(struct filedescr *) _PyImport_FindModule( const char *, PyObject *, char *, size_t, FILE **, PyObject **); PyAPI_FUNC(int) _PyImport_IsScript(struct filedescr *); PyAPI_FUNC(void) _PyImport_ReInitLock(void); PyAPI_FUNC(PyObject *)_PyImport_FindExtension(char *, char *); PyAPI_FUNC(PyObject *)_PyImport_FixupExtension(char *, char *); struct _inittab { char *name; void (*initfunc)(void); }; PyAPI_DATA(PyTypeObject) PyNullImporter_Type; PyAPI_DATA(struct _inittab *) PyImport_Inittab; PyAPI_FUNC(int) PyImport_AppendInittab(const char *name, void (*initfunc)(void)); PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab); struct _frozen { char *name; unsigned char *code; int size; }; /* Embedding apps may change this pointer to point to their favorite collection of frozen modules: */ PyAPI_DATA(struct _frozen *) PyImport_FrozenModules; #ifdef __cplusplus } #endif #endif /* !Py_IMPORT_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/dtoa.h������������������������������������������������������������������������������������0000644�����������������00000000522�14763166027�0007427 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef PY_NO_SHORT_FLOAT_REPR #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(double) _Py_dg_strtod(const char *str, char **ptr); PyAPI_FUNC(char *) _Py_dg_dtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve); PyAPI_FUNC(void) _Py_dg_freedtoa(char *s); #ifdef __cplusplus } #endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/cellobject.h������������������������������������������������������������������������������0000644�����������������00000001213�14763166027�0010604 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Cell object interface */ #ifndef Py_CELLOBJECT_H #define Py_CELLOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef struct { PyObject_HEAD PyObject *ob_ref; /* Content of the cell or NULL when empty */ } PyCellObject; PyAPI_DATA(PyTypeObject) PyCell_Type; #define PyCell_Check(op) (Py_TYPE(op) == &PyCell_Type) PyAPI_FUNC(PyObject *) PyCell_New(PyObject *); PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *); PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *); #define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref) #define PyCell_SET(op, v) (((PyCellObject *)(op))->ob_ref = v) #ifdef __cplusplus } #endif #endif /* !Py_TUPLEOBJECT_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/classobject.h�����������������������������������������������������������������������������0000644�����������������00000005672�14763166027�0011007 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Class object interface */ /* Revealing some structures (not for general use) */ #ifndef Py_CLASSOBJECT_H #define Py_CLASSOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef struct { PyObject_HEAD PyObject *cl_bases; /* A tuple of class objects */ PyObject *cl_dict; /* A dictionary */ PyObject *cl_name; /* A string */ /* The following three are functions or NULL */ PyObject *cl_getattr; PyObject *cl_setattr; PyObject *cl_delattr; PyObject *cl_weakreflist; /* List of weak references */ } PyClassObject; typedef struct { PyObject_HEAD PyClassObject *in_class; /* The class object */ PyObject *in_dict; /* A dictionary */ PyObject *in_weakreflist; /* List of weak references */ } PyInstanceObject; typedef struct { PyObject_HEAD PyObject *im_func; /* The callable object implementing the method */ PyObject *im_self; /* The instance it is bound to, or NULL */ PyObject *im_class; /* The class that asked for the method */ PyObject *im_weakreflist; /* List of weak references */ } PyMethodObject; PyAPI_DATA(PyTypeObject) PyClass_Type, PyInstance_Type, PyMethod_Type; #define PyClass_Check(op) ((op)->ob_type == &PyClass_Type) #define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type) #define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type) PyAPI_FUNC(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyInstance_New(PyObject *, PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *); PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *); PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *); /* Look up attribute with name (a string) on instance object pinst, using * only the instance and base class dicts. If a descriptor is found in * a class dict, the descriptor is returned without calling it. * Returns NULL if nothing found, else a borrowed reference to the * value associated with name in the dict in which name was found. * The point of this routine is that it never calls arbitrary Python * code, so is always "safe": all it does is dict lookups. The function * can't fail, never sets an exception, and NULL is not an error (it just * means "not found"). */ PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name); /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ #define PyMethod_GET_FUNCTION(meth) \ (((PyMethodObject *)meth) -> im_func) #define PyMethod_GET_SELF(meth) \ (((PyMethodObject *)meth) -> im_self) #define PyMethod_GET_CLASS(meth) \ (((PyMethodObject *)meth) -> im_class) PyAPI_FUNC(int) PyClass_IsSubclass(PyObject *, PyObject *); PyAPI_FUNC(int) PyMethod_ClearFreeList(void); #ifdef __cplusplus } #endif #endif /* !Py_CLASSOBJECT_H */ ����������������������������������������������������������������������python2.7/pgen.h������������������������������������������������������������������������������������0000644�����������������00000000375�14763166027�0007437 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_PGEN_H #define Py_PGEN_H #ifdef __cplusplus extern "C" { #endif /* Parser generator interface */ extern grammar *meta_grammar(void); struct _node; extern grammar *pgen(struct _node *); #ifdef __cplusplus } #endif #endif /* !Py_PGEN_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/pythread.h��������������������������������������������������������������������������������0000644�����������������00000002344�14763166027�0010324 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� #ifndef Py_PYTHREAD_H #define Py_PYTHREAD_H typedef void *PyThread_type_lock; typedef void *PyThread_type_sema; #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(void) PyThread_init_thread(void); PyAPI_FUNC(long) PyThread_start_new_thread(void (*)(void *), void *); PyAPI_FUNC(void) PyThread_exit_thread(void); PyAPI_FUNC(long) PyThread_get_thread_ident(void); PyAPI_FUNC(PyThread_type_lock) PyThread_allocate_lock(void); PyAPI_FUNC(void) PyThread_free_lock(PyThread_type_lock); PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int); #define WAIT_LOCK 1 #define NOWAIT_LOCK 0 PyAPI_FUNC(void) PyThread_release_lock(PyThread_type_lock); PyAPI_FUNC(size_t) PyThread_get_stacksize(void); PyAPI_FUNC(int) PyThread_set_stacksize(size_t); /* Thread Local Storage (TLS) API */ PyAPI_FUNC(int) PyThread_create_key(void); PyAPI_FUNC(void) PyThread_delete_key(int); PyAPI_FUNC(int) PyThread_set_key_value(int, void *); PyAPI_FUNC(void *) PyThread_get_key_value(int); PyAPI_FUNC(void) PyThread_delete_key_value(int key); PyAPI_FUNC(int) _PyThread_AcquireKeyLock(void); PyAPI_FUNC(void) _PyThread_ReleaseKeyLock(void); /* Cleanup after a fork */ PyAPI_FUNC(void) PyThread_ReInitTLS(void); #ifdef __cplusplus } #endif #endif /* !Py_PYTHREAD_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/pyexpat.h���������������������������������������������������������������������������������0000644�����������������00000004105�14763166027�0010173 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Stuff to export relevant 'expat' entry points from pyexpat to other * parser modules, such as cElementTree. */ /* note: you must import expat.h before importing this module! */ #define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.1" #define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI" struct PyExpat_CAPI { char* magic; /* set to PyExpat_CAPI_MAGIC */ int size; /* set to sizeof(struct PyExpat_CAPI) */ int MAJOR_VERSION; int MINOR_VERSION; int MICRO_VERSION; /* pointers to selected expat functions. add new functions at the end, if needed */ const XML_LChar * (*ErrorString)(enum XML_Error code); enum XML_Error (*GetErrorCode)(XML_Parser parser); XML_Size (*GetErrorColumnNumber)(XML_Parser parser); XML_Size (*GetErrorLineNumber)(XML_Parser parser); enum XML_Status (*Parse)( XML_Parser parser, const char *s, int len, int isFinal); XML_Parser (*ParserCreate_MM)( const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite, const XML_Char *namespaceSeparator); void (*ParserFree)(XML_Parser parser); void (*SetCharacterDataHandler)( XML_Parser parser, XML_CharacterDataHandler handler); void (*SetCommentHandler)( XML_Parser parser, XML_CommentHandler handler); void (*SetDefaultHandlerExpand)( XML_Parser parser, XML_DefaultHandler handler); void (*SetElementHandler)( XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end); void (*SetNamespaceDeclHandler)( XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end); void (*SetProcessingInstructionHandler)( XML_Parser parser, XML_ProcessingInstructionHandler handler); void (*SetUnknownEncodingHandler)( XML_Parser parser, XML_UnknownEncodingHandler handler, void *encodingHandlerData); void (*SetUserData)(XML_Parser parser, void *userData); /* might be none for expat < 2.1.0 */ int (*SetHashSalt)(XML_Parser parser, unsigned long hash_salt); /* always add new stuff to the end! */ }; �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/symtable.h��������������������������������������������������������������������������������0000644�����������������00000007214�14763166027�0010325 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_SYMTABLE_H #define Py_SYMTABLE_H #ifdef __cplusplus extern "C" { #endif typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock } _Py_block_ty; struct _symtable_entry; struct symtable { const char *st_filename; /* name of file being compiled */ struct _symtable_entry *st_cur; /* current symbol table entry */ struct _symtable_entry *st_top; /* module entry */ PyObject *st_symbols; /* dictionary of symbol table entries */ PyObject *st_stack; /* stack of namespace info */ PyObject *st_global; /* borrowed ref to MODULE in st_symbols */ int st_nblocks; /* number of blocks */ PyObject *st_private; /* name of current class or NULL */ PyFutureFeatures *st_future; /* module's future features */ }; typedef struct _symtable_entry { PyObject_HEAD PyObject *ste_id; /* int: key in st_symbols */ PyObject *ste_symbols; /* dict: name to flags */ PyObject *ste_name; /* string: name of block */ PyObject *ste_varnames; /* list of variable names */ PyObject *ste_children; /* list of child ids */ _Py_block_ty ste_type; /* module, class, or function */ int ste_unoptimized; /* false if namespace is optimized */ int ste_nested; /* true if block is nested */ unsigned ste_free : 1; /* true if block has free variables */ unsigned ste_child_free : 1; /* true if a child block has free vars, including free refs to globals */ unsigned ste_generator : 1; /* true if namespace is a generator */ unsigned ste_varargs : 1; /* true if block has varargs */ unsigned ste_varkeywords : 1; /* true if block has varkeywords */ unsigned ste_returns_value : 1; /* true if namespace uses return with an argument */ int ste_lineno; /* first line of block */ int ste_opt_lineno; /* lineno of last exec or import * */ int ste_tmpname; /* counter for listcomp temp vars */ struct symtable *ste_table; } PySTEntryObject; PyAPI_DATA(PyTypeObject) PySTEntry_Type; #define PySTEntry_Check(op) (Py_TYPE(op) == &PySTEntry_Type) PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *); PyAPI_FUNC(struct symtable *) PySymtable_Build(mod_ty, const char *, PyFutureFeatures *); PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *); PyAPI_FUNC(void) PySymtable_Free(struct symtable *); /* Flags for def-use information */ #define DEF_GLOBAL 1 /* global stmt */ #define DEF_LOCAL 2 /* assignment in code block */ #define DEF_PARAM 2<<1 /* formal parameter */ #define USE 2<<2 /* name is used */ #define DEF_FREE 2<<3 /* name used but not defined in nested block */ #define DEF_FREE_CLASS 2<<4 /* free variable from class's method */ #define DEF_IMPORT 2<<5 /* assignment occurred via import */ #define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT) /* GLOBAL_EXPLICIT and GLOBAL_IMPLICIT are used internally by the symbol table. GLOBAL is returned from PyST_GetScope() for either of them. It is stored in ste_symbols at bits 12-14. */ #define SCOPE_OFF 11 #define SCOPE_MASK 7 #define LOCAL 1 #define GLOBAL_EXPLICIT 2 #define GLOBAL_IMPLICIT 3 #define FREE 4 #define CELL 5 /* The following three names are used for the ste_unoptimized bit field */ #define OPT_IMPORT_STAR 1 #define OPT_EXEC 2 #define OPT_BARE_EXEC 4 #define OPT_TOPLEVEL 8 /* top-level names, including eval and exec */ #define GENERATOR 1 #define GENERATOR_EXPRESSION 2 #ifdef __cplusplus } #endif #endif /* !Py_SYMTABLE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/tupleobject.h�����������������������������������������������������������������������������0000644�����������������00000004265�14763166027�0011030 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Tuple object interface */ #ifndef Py_TUPLEOBJECT_H #define Py_TUPLEOBJECT_H #ifdef __cplusplus extern "C" { #endif /* Another generally useful object type is a tuple of object pointers. For Python, this is an immutable type. C code can change the tuple items (but not their number), and even use tuples are general-purpose arrays of object references, but in general only brand new tuples should be mutated, not ones that might already have been exposed to Python code. *** WARNING *** PyTuple_SetItem does not increment the new item's reference count, but does decrement the reference count of the item it replaces, if not nil. It does *decrement* the reference count if it is *not* inserted in the tuple. Similarly, PyTuple_GetItem does not increment the returned item's reference count. */ typedef struct { PyObject_VAR_HEAD PyObject *ob_item[1]; /* ob_item contains space for 'ob_size' elements. * Items must normally not be NULL, except during construction when * the tuple is not yet visible outside the function that builds it. */ } PyTupleObject; PyAPI_DATA(PyTypeObject) PyTuple_Type; #define PyTuple_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS) #define PyTuple_CheckExact(op) (Py_TYPE(op) == &PyTuple_Type) PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size); PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *); PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, Py_ssize_t, PyObject *); PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t); PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t); PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...); PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *); /* Macro, trading safety for speed */ #define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i]) #define PyTuple_GET_SIZE(op) Py_SIZE(op) /* Macro, *only* to be used to fill in brand new tuples */ #define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v) PyAPI_FUNC(int) PyTuple_ClearFreeList(void); PyAPI_FUNC(void) _PyTuple_DebugMallocStats(FILE *out); #ifdef __cplusplus } #endif #endif /* !Py_TUPLEOBJECT_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/traceback.h�������������������������������������������������������������������������������0000644�����������������00000001271�14763166027�0010421 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� #ifndef Py_TRACEBACK_H #define Py_TRACEBACK_H #ifdef __cplusplus extern "C" { #endif struct _frame; /* Traceback interface */ typedef struct _traceback { PyObject_HEAD struct _traceback *tb_next; struct _frame *tb_frame; int tb_lasti; int tb_lineno; } PyTracebackObject; PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *); PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *); PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, const char *, int, int); /* Reveal traceback type so we can typecheck traceback objects */ PyAPI_DATA(PyTypeObject) PyTraceBack_Type; #define PyTraceBack_Check(v) (Py_TYPE(v) == &PyTraceBack_Type) #ifdef __cplusplus } #endif #endif /* !Py_TRACEBACK_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/warnings.h��������������������������������������������������������������������������������0000644�����������������00000001173�14763166027�0010333 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_WARNINGS_H #define Py_WARNINGS_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(void) _PyWarnings_Init(void); PyAPI_FUNC(int) PyErr_WarnEx(PyObject *, const char *, Py_ssize_t); PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, const char *, const char *, int, const char *, PyObject *); #define PyErr_WarnPy3k(msg, stacklevel) \ (Py_Py3kWarningFlag ? PyErr_WarnEx(PyExc_DeprecationWarning, msg, stacklevel) : 0) /* DEPRECATED: Use PyErr_WarnEx() instead. */ #define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1) #ifdef __cplusplus } #endif #endif /* !Py_WARNINGS_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/eval.h������������������������������������������������������������������������������������0000644�����������������00000001055�14763166027�0007431 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Interface to execute compiled code */ #ifndef Py_EVAL_H #define Py_EVAL_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyCodeObject *, PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals, PyObject **args, int argc, PyObject **kwds, int kwdc, PyObject **defs, int defc, PyObject *closure); PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args); #ifdef __cplusplus } #endif #endif /* !Py_EVAL_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/patchlevel.h������������������������������������������������������������������������������0000644�����������������00000002650�14763166027�0010633 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Newfangled version identification scheme. This scheme was added in Python 1.5.2b2; before that time, only PATCHLEVEL was available. To test for presence of the scheme, test for defined(PY_MAJOR_VERSION). When the major or minor version changes, the VERSION variable in configure.ac must also be changed. There is also (independent) API version information in modsupport.h. */ /* Values for PY_RELEASE_LEVEL */ #define PY_RELEASE_LEVEL_ALPHA 0xA #define PY_RELEASE_LEVEL_BETA 0xB #define PY_RELEASE_LEVEL_GAMMA 0xC /* For release candidates */ #define PY_RELEASE_LEVEL_FINAL 0xF /* Serial should be 0 here */ /* Higher for patch releases */ /* Version parsed out into numeric values */ /*--start constants--*/ #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 7 #define PY_MICRO_VERSION 5 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL #define PY_RELEASE_SERIAL 0 /* Version as a string */ #define PY_VERSION "2.7.5" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository). Empty since Mercurial migration. */ #define PY_PATCHLEVEL_REVISION "" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */ #define PY_VERSION_HEX ((PY_MAJOR_VERSION << 24) | \ (PY_MINOR_VERSION << 16) | \ (PY_MICRO_VERSION << 8) | \ (PY_RELEASE_LEVEL << 4) | \ (PY_RELEASE_SERIAL << 0)) ����������������������������������������������������������������������������������������python2.7/asdl.h������������������������������������������������������������������������������������0000644�����������������00000002113�14763166027�0007421 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_ASDL_H #define Py_ASDL_H typedef PyObject * identifier; typedef PyObject * string; typedef PyObject * object; #ifndef __cplusplus typedef enum {false, true} bool; #endif /* It would be nice if the code generated by asdl_c.py was completely independent of Python, but it is a goal the requires too much work at this stage. So, for example, I'll represent identifiers as interned Python strings. */ /* XXX A sequence should be typed so that its use can be typechecked. */ typedef struct { int size; void *elements[1]; } asdl_seq; typedef struct { int size; int elements[1]; } asdl_int_seq; asdl_seq *asdl_seq_new(int size, PyArena *arena); asdl_int_seq *asdl_int_seq_new(int size, PyArena *arena); #define asdl_seq_GET(S, I) (S)->elements[(I)] #define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size) #ifdef Py_DEBUG #define asdl_seq_SET(S, I, V) { \ int _asdl_i = (I); \ assert((S) && _asdl_i < (S)->size); \ (S)->elements[_asdl_i] = (V); \ } #else #define asdl_seq_SET(S, I, V) (S)->elements[I] = (V) #endif #endif /* !Py_ASDL_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/pygetopt.h��������������������������������������������������������������������������������0000644�����������������00000000534�14763166027�0010356 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� #ifndef Py_PYGETOPT_H #define Py_PYGETOPT_H #ifdef __cplusplus extern "C" { #endif PyAPI_DATA(int) _PyOS_opterr; PyAPI_DATA(int) _PyOS_optind; PyAPI_DATA(char *) _PyOS_optarg; PyAPI_FUNC(void) _PyOS_ResetGetOpt(void); PyAPI_FUNC(int) _PyOS_GetOpt(int argc, char **argv, char *optstring); #ifdef __cplusplus } #endif #endif /* !Py_PYGETOPT_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/pystrtod.h��������������������������������������������������������������������������������0000644�����������������00000003056�14763166027�0010375 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_STRTOD_H #define Py_STRTOD_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(double) PyOS_ascii_strtod(const char *str, char **ptr); PyAPI_FUNC(double) PyOS_ascii_atof(const char *str); /* Deprecated in 2.7 and 3.1. Will disappear in 2.8 (if it exists) and 3.2 */ PyAPI_FUNC(char *) PyOS_ascii_formatd(char *buffer, size_t buf_len, const char *format, double d); PyAPI_FUNC(double) PyOS_string_to_double(const char *str, char **endptr, PyObject *overflow_exception); /* The caller is responsible for calling PyMem_Free to free the buffer that's is returned. */ PyAPI_FUNC(char *) PyOS_double_to_string(double val, char format_code, int precision, int flags, int *type); PyAPI_FUNC(double) _Py_parse_inf_or_nan(const char *p, char **endptr); /* PyOS_double_to_string's "flags" parameter can be set to 0 or more of: */ #define Py_DTSF_SIGN 0x01 /* always add the sign */ #define Py_DTSF_ADD_DOT_0 0x02 /* if the result is an integer add ".0" */ #define Py_DTSF_ALT 0x04 /* "alternate" formatting. it's format_code specific */ /* PyOS_double_to_string's "type", if non-NULL, will be set to one of: */ #define Py_DTST_FINITE 0 #define Py_DTST_INFINITE 1 #define Py_DTST_NAN 2 #ifdef __cplusplus } #endif #endif /* !Py_STRTOD_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/object.h����������������������������������������������������������������������������������0000644�����������������00000114132�14763166027�0007751 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_OBJECT_H #define Py_OBJECT_H #ifdef __cplusplus extern "C" { #endif /* Object and type object interface */ /* Objects are structures allocated on the heap. Special rules apply to the use of objects to ensure they are properly garbage-collected. Objects are never allocated statically or on the stack; they must be accessed through special macros and functions only. (Type objects are exceptions to the first rule; the standard types are represented by statically initialized type objects, although work on type/class unification for Python 2.2 made it possible to have heap-allocated type objects too). An object has a 'reference count' that is increased or decreased when a pointer to the object is copied or deleted; when the reference count reaches zero there are no references to the object left and it can be removed from the heap. An object has a 'type' that determines what it represents and what kind of data it contains. An object's type is fixed when it is created. Types themselves are represented as objects; an object contains a pointer to the corresponding type object. The type itself has a type pointer pointing to the object representing the type 'type', which contains a pointer to itself!). Objects do not float around in memory; once allocated an object keeps the same size and address. Objects that must hold variable-size data can contain pointers to variable-size parts of the object. Not all objects of the same type have the same size; but the size cannot change after allocation. (These restrictions are made so a reference to an object can be simply a pointer -- moving an object would require updating all the pointers, and changing an object's size would require moving it if there was another object right next to it.) Objects are always accessed through pointers of the type 'PyObject *'. The type 'PyObject' is a structure that only contains the reference count and the type pointer. The actual memory allocated for an object contains other data that can only be accessed after casting the pointer to a pointer to a longer structure type. This longer type must start with the reference count and type fields; the macro PyObject_HEAD should be used for this (to accommodate for future changes). The implementation of a particular object type can cast the object pointer to the proper type and back. A standard interface exists for objects that contain an array of items whose size is determined when the object is allocated. */ /* Py_DEBUG implies Py_TRACE_REFS. */ #if defined(Py_DEBUG) && !defined(Py_TRACE_REFS) #define Py_TRACE_REFS #endif /* Py_TRACE_REFS implies Py_REF_DEBUG. */ #if defined(Py_TRACE_REFS) && !defined(Py_REF_DEBUG) #define Py_REF_DEBUG #endif #ifdef Py_TRACE_REFS /* Define pointers to support a doubly-linked list of all live heap objects. */ #define _PyObject_HEAD_EXTRA \ struct _object *_ob_next; \ struct _object *_ob_prev; #define _PyObject_EXTRA_INIT 0, 0, #else #define _PyObject_HEAD_EXTRA #define _PyObject_EXTRA_INIT #endif /* PyObject_HEAD defines the initial segment of every PyObject. */ #define PyObject_HEAD \ _PyObject_HEAD_EXTRA \ Py_ssize_t ob_refcnt; \ struct _typeobject *ob_type; #define PyObject_HEAD_INIT(type) \ _PyObject_EXTRA_INIT \ 1, type, #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, /* PyObject_VAR_HEAD defines the initial segment of all variable-size * container objects. These end with a declaration of an array with 1 * element, but enough space is malloc'ed so that the array actually * has room for ob_size elements. Note that ob_size is an element count, * not necessarily a byte count. */ #define PyObject_VAR_HEAD \ PyObject_HEAD \ Py_ssize_t ob_size; /* Number of items in variable part */ #define Py_INVALID_SIZE (Py_ssize_t)-1 /* Nothing is actually declared to be a PyObject, but every pointer to * a Python object can be cast to a PyObject*. This is inheritance built * by hand. Similarly every pointer to a variable-size Python object can, * in addition, be cast to PyVarObject*. */ typedef struct _object { PyObject_HEAD } PyObject; typedef struct { PyObject_VAR_HEAD } PyVarObject; #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) /* Type objects contain a string containing the type name (to help somewhat in debugging), the allocation parameters (see PyObject_New() and PyObject_NewVar()), and methods for accessing objects of the type. Methods are optional, a nil pointer meaning that particular kind of access is not available for this type. The Py_DECREF() macro uses the tp_dealloc method without checking for a nil pointer; it should always be implemented except if the implementation can guarantee that the reference count will never reach zero (e.g., for statically allocated type objects). NB: the methods for certain type groups are now contained in separate method blocks. */ typedef PyObject * (*unaryfunc)(PyObject *); typedef PyObject * (*binaryfunc)(PyObject *, PyObject *); typedef PyObject * (*ternaryfunc)(PyObject *, PyObject *, PyObject *); typedef int (*inquiry)(PyObject *); typedef Py_ssize_t (*lenfunc)(PyObject *); typedef int (*coercion)(PyObject **, PyObject **); typedef PyObject *(*intargfunc)(PyObject *, int) Py_DEPRECATED(2.5); typedef PyObject *(*intintargfunc)(PyObject *, int, int) Py_DEPRECATED(2.5); typedef PyObject *(*ssizeargfunc)(PyObject *, Py_ssize_t); typedef PyObject *(*ssizessizeargfunc)(PyObject *, Py_ssize_t, Py_ssize_t); typedef int(*intobjargproc)(PyObject *, int, PyObject *); typedef int(*intintobjargproc)(PyObject *, int, int, PyObject *); typedef int(*ssizeobjargproc)(PyObject *, Py_ssize_t, PyObject *); typedef int(*ssizessizeobjargproc)(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *); typedef int(*objobjargproc)(PyObject *, PyObject *, PyObject *); /* int-based buffer interface */ typedef int (*getreadbufferproc)(PyObject *, int, void **); typedef int (*getwritebufferproc)(PyObject *, int, void **); typedef int (*getsegcountproc)(PyObject *, int *); typedef int (*getcharbufferproc)(PyObject *, int, char **); /* ssize_t-based buffer interface */ typedef Py_ssize_t (*readbufferproc)(PyObject *, Py_ssize_t, void **); typedef Py_ssize_t (*writebufferproc)(PyObject *, Py_ssize_t, void **); typedef Py_ssize_t (*segcountproc)(PyObject *, Py_ssize_t *); typedef Py_ssize_t (*charbufferproc)(PyObject *, Py_ssize_t, char **); /* Py3k buffer interface */ typedef struct bufferinfo { void *buf; PyObject *obj; /* owned reference */ Py_ssize_t len; Py_ssize_t itemsize; /* This is Py_ssize_t so it can be pointed to by strides in simple case.*/ int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; Py_ssize_t smalltable[2]; /* static store for shape and strides of mono-dimensional buffers. */ void *internal; } Py_buffer; typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); typedef void (*releasebufferproc)(PyObject *, Py_buffer *); /* Flags for getting buffers */ #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 /* we used to include an E, backwards compatible alias */ #define PyBUF_WRITEABLE PyBUF_WRITABLE #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #define PyBUF_CONTIG (PyBUF_ND | PyBUF_WRITABLE) #define PyBUF_CONTIG_RO (PyBUF_ND) #define PyBUF_STRIDED (PyBUF_STRIDES | PyBUF_WRITABLE) #define PyBUF_STRIDED_RO (PyBUF_STRIDES) #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_WRITABLE | PyBUF_FORMAT) #define PyBUF_RECORDS_RO (PyBUF_STRIDES | PyBUF_FORMAT) #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_WRITABLE | PyBUF_FORMAT) #define PyBUF_FULL_RO (PyBUF_INDIRECT | PyBUF_FORMAT) #define PyBUF_READ 0x100 #define PyBUF_WRITE 0x200 #define PyBUF_SHADOW 0x400 /* end Py3k buffer interface */ typedef int (*objobjproc)(PyObject *, PyObject *); typedef int (*visitproc)(PyObject *, void *); typedef int (*traverseproc)(PyObject *, visitproc, void *); typedef struct { /* For numbers without flag bit Py_TPFLAGS_CHECKTYPES set, all arguments are guaranteed to be of the object's type (modulo coercion hacks -- i.e. if the type's coercion function returns other types, then these are allowed as well). Numbers that have the Py_TPFLAGS_CHECKTYPES flag bit set should check *both* arguments for proper type and implement the necessary conversions in the slot functions themselves. */ binaryfunc nb_add; binaryfunc nb_subtract; binaryfunc nb_multiply; binaryfunc nb_divide; binaryfunc nb_remainder; binaryfunc nb_divmod; ternaryfunc nb_power; unaryfunc nb_negative; unaryfunc nb_positive; unaryfunc nb_absolute; inquiry nb_nonzero; unaryfunc nb_invert; binaryfunc nb_lshift; binaryfunc nb_rshift; binaryfunc nb_and; binaryfunc nb_xor; binaryfunc nb_or; coercion nb_coerce; unaryfunc nb_int; unaryfunc nb_long; unaryfunc nb_float; unaryfunc nb_oct; unaryfunc nb_hex; /* Added in release 2.0 */ binaryfunc nb_inplace_add; binaryfunc nb_inplace_subtract; binaryfunc nb_inplace_multiply; binaryfunc nb_inplace_divide; binaryfunc nb_inplace_remainder; ternaryfunc nb_inplace_power; binaryfunc nb_inplace_lshift; binaryfunc nb_inplace_rshift; binaryfunc nb_inplace_and; binaryfunc nb_inplace_xor; binaryfunc nb_inplace_or; /* Added in release 2.2 */ /* The following require the Py_TPFLAGS_HAVE_CLASS flag */ binaryfunc nb_floor_divide; binaryfunc nb_true_divide; binaryfunc nb_inplace_floor_divide; binaryfunc nb_inplace_true_divide; /* Added in release 2.5 */ unaryfunc nb_index; } PyNumberMethods; typedef struct { lenfunc sq_length; binaryfunc sq_concat; ssizeargfunc sq_repeat; ssizeargfunc sq_item; ssizessizeargfunc sq_slice; ssizeobjargproc sq_ass_item; ssizessizeobjargproc sq_ass_slice; objobjproc sq_contains; /* Added in release 2.0 */ binaryfunc sq_inplace_concat; ssizeargfunc sq_inplace_repeat; } PySequenceMethods; typedef struct { lenfunc mp_length; binaryfunc mp_subscript; objobjargproc mp_ass_subscript; } PyMappingMethods; typedef struct { readbufferproc bf_getreadbuffer; writebufferproc bf_getwritebuffer; segcountproc bf_getsegcount; charbufferproc bf_getcharbuffer; getbufferproc bf_getbuffer; releasebufferproc bf_releasebuffer; } PyBufferProcs; typedef void (*freefunc)(void *); typedef void (*destructor)(PyObject *); typedef int (*printfunc)(PyObject *, FILE *, int); typedef PyObject *(*getattrfunc)(PyObject *, char *); typedef PyObject *(*getattrofunc)(PyObject *, PyObject *); typedef int (*setattrfunc)(PyObject *, char *, PyObject *); typedef int (*setattrofunc)(PyObject *, PyObject *, PyObject *); typedef int (*cmpfunc)(PyObject *, PyObject *); typedef PyObject *(*reprfunc)(PyObject *); typedef long (*hashfunc)(PyObject *); typedef PyObject *(*richcmpfunc) (PyObject *, PyObject *, int); typedef PyObject *(*getiterfunc) (PyObject *); typedef PyObject *(*iternextfunc) (PyObject *); typedef PyObject *(*descrgetfunc) (PyObject *, PyObject *, PyObject *); typedef int (*descrsetfunc) (PyObject *, PyObject *, PyObject *); typedef int (*initproc)(PyObject *, PyObject *, PyObject *); typedef PyObject *(*newfunc)(struct _typeobject *, PyObject *, PyObject *); typedef PyObject *(*allocfunc)(struct _typeobject *, Py_ssize_t); typedef struct _typeobject { PyObject_VAR_HEAD const char *tp_name; /* For printing, in format "<module>.<name>" */ Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */ /* Methods to implement standard operations */ destructor tp_dealloc; printfunc tp_print; getattrfunc tp_getattr; setattrfunc tp_setattr; cmpfunc tp_compare; reprfunc tp_repr; /* Method suites for standard classes */ PyNumberMethods *tp_as_number; PySequenceMethods *tp_as_sequence; PyMappingMethods *tp_as_mapping; /* More standard operations (here for binary compatibility) */ hashfunc tp_hash; ternaryfunc tp_call; reprfunc tp_str; getattrofunc tp_getattro; setattrofunc tp_setattro; /* Functions to access object as input/output buffer */ PyBufferProcs *tp_as_buffer; /* Flags to define presence of optional/expanded features */ long tp_flags; const char *tp_doc; /* Documentation string */ /* Assigned meaning in release 2.0 */ /* call function for all accessible objects */ traverseproc tp_traverse; /* delete references to contained objects */ inquiry tp_clear; /* Assigned meaning in release 2.1 */ /* rich comparisons */ richcmpfunc tp_richcompare; /* weak reference enabler */ Py_ssize_t tp_weaklistoffset; /* Added in release 2.2 */ /* Iterators */ getiterfunc tp_iter; iternextfunc tp_iternext; /* Attribute descriptor and subclassing stuff */ struct PyMethodDef *tp_methods; struct PyMemberDef *tp_members; struct PyGetSetDef *tp_getset; struct _typeobject *tp_base; PyObject *tp_dict; descrgetfunc tp_descr_get; descrsetfunc tp_descr_set; Py_ssize_t tp_dictoffset; initproc tp_init; allocfunc tp_alloc; newfunc tp_new; freefunc tp_free; /* Low-level free-memory routine */ inquiry tp_is_gc; /* For PyObject_IS_GC */ PyObject *tp_bases; PyObject *tp_mro; /* method resolution order */ PyObject *tp_cache; PyObject *tp_subclasses; PyObject *tp_weaklist; destructor tp_del; /* Type attribute cache version tag. Added in version 2.6 */ unsigned int tp_version_tag; #ifdef COUNT_ALLOCS /* these must be last and never explicitly initialized */ Py_ssize_t tp_allocs; Py_ssize_t tp_frees; Py_ssize_t tp_maxalloc; struct _typeobject *tp_prev; struct _typeobject *tp_next; #endif } PyTypeObject; /* The *real* layout of a type object when allocated on the heap */ typedef struct _heaptypeobject { /* Note: there's a dependency on the order of these members in slotptr() in typeobject.c . */ PyTypeObject ht_type; PyNumberMethods as_number; PyMappingMethods as_mapping; PySequenceMethods as_sequence; /* as_sequence comes after as_mapping, so that the mapping wins when both the mapping and the sequence define a given operator (e.g. __getitem__). see add_operators() in typeobject.c . */ PyBufferProcs as_buffer; PyObject *ht_name, *ht_slots; /* here are optional user slots, followed by the members. */ } PyHeapTypeObject; /* access macro to the members which are floating "behind" the object */ #define PyHeapType_GET_MEMBERS(etype) \ ((PyMemberDef *)(((char *)etype) + Py_TYPE(etype)->tp_basicsize)) /* Generic type check */ PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *); #define PyObject_TypeCheck(ob, tp) \ (Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp))) PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */ PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */ PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */ #define PyType_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS) #define PyType_CheckExact(op) (Py_TYPE(op) == &PyType_Type) PyAPI_FUNC(int) PyType_Ready(PyTypeObject *); PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, Py_ssize_t); PyAPI_FUNC(PyObject *) PyType_GenericNew(PyTypeObject *, PyObject *, PyObject *); PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *); PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, char *, PyObject **); PyAPI_FUNC(unsigned int) PyType_ClearCache(void); PyAPI_FUNC(void) PyType_Modified(PyTypeObject *); /* Generic operations on objects */ PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int); PyAPI_FUNC(void) _PyObject_Dump(PyObject *); PyAPI_FUNC(PyObject *) PyObject_Repr(PyObject *); PyAPI_FUNC(PyObject *) _PyObject_Str(PyObject *); PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *); #define PyObject_Bytes PyObject_Str #ifdef Py_USING_UNICODE PyAPI_FUNC(PyObject *) PyObject_Unicode(PyObject *); #endif PyAPI_FUNC(int) PyObject_Compare(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int); PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject *, PyObject *, int); PyAPI_FUNC(PyObject *) PyObject_GetAttrString(PyObject *, const char *); PyAPI_FUNC(int) PyObject_SetAttrString(PyObject *, const char *, PyObject *); PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, const char *); PyAPI_FUNC(PyObject *) PyObject_GetAttr(PyObject *, PyObject *); PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *); PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *); PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *); PyAPI_FUNC(PyObject *) PyObject_SelfIter(PyObject *); PyAPI_FUNC(PyObject *) _PyObject_NextNotImplemented(PyObject *); PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *); PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *, PyObject *, PyObject *); PyAPI_FUNC(long) PyObject_Hash(PyObject *); PyAPI_FUNC(long) PyObject_HashNotImplemented(PyObject *); PyAPI_FUNC(int) PyObject_IsTrue(PyObject *); PyAPI_FUNC(int) PyObject_Not(PyObject *); PyAPI_FUNC(int) PyCallable_Check(PyObject *); PyAPI_FUNC(int) PyNumber_Coerce(PyObject **, PyObject **); PyAPI_FUNC(int) PyNumber_CoerceEx(PyObject **, PyObject **); PyAPI_FUNC(void) PyObject_ClearWeakRefs(PyObject *); /* A slot function whose address we need to compare */ extern int _PyObject_SlotCompare(PyObject *, PyObject *); /* Same as PyObject_Generic{Get,Set}Attr, but passing the attributes dict as the last parameter. */ PyAPI_FUNC(PyObject *) _PyObject_GenericGetAttrWithDict(PyObject *, PyObject *, PyObject *); PyAPI_FUNC(int) _PyObject_GenericSetAttrWithDict(PyObject *, PyObject *, PyObject *, PyObject *); /* PyObject_Dir(obj) acts like Python __builtin__.dir(obj), returning a list of strings. PyObject_Dir(NULL) is like __builtin__.dir(), returning the names of the current locals. In this case, if there are no current locals, NULL is returned, and PyErr_Occurred() is false. */ PyAPI_FUNC(PyObject *) PyObject_Dir(PyObject *); /* Helpers for printing recursive container types */ PyAPI_FUNC(int) Py_ReprEnter(PyObject *); PyAPI_FUNC(void) Py_ReprLeave(PyObject *); /* Helpers for hash functions */ PyAPI_FUNC(long) _Py_HashDouble(double); PyAPI_FUNC(long) _Py_HashPointer(void*); typedef struct { long prefix; long suffix; } _Py_HashSecret_t; PyAPI_DATA(_Py_HashSecret_t) _Py_HashSecret; #ifdef Py_DEBUG PyAPI_DATA(int) _Py_HashSecret_Initialized; #endif /* Helper for passing objects to printf and the like */ #define PyObject_REPR(obj) PyString_AS_STRING(PyObject_Repr(obj)) /* Flag bits for printing: */ #define Py_PRINT_RAW 1 /* No string quotes etc. */ /* `Type flags (tp_flags) These flags are used to extend the type structure in a backwards-compatible fashion. Extensions can use the flags to indicate (and test) when a given type structure contains a new feature. The Python core will use these when introducing new functionality between major revisions (to avoid mid-version changes in the PYTHON_API_VERSION). Arbitration of the flag bit positions will need to be coordinated among all extension writers who publically release their extensions (this will be fewer than you might expect!).. Python 1.5.2 introduced the bf_getcharbuffer slot into PyBufferProcs. Type definitions should use Py_TPFLAGS_DEFAULT for their tp_flags value. Code can use PyType_HasFeature(type_ob, flag_value) to test whether the given type object has a specified feature. NOTE: when building the core, Py_TPFLAGS_DEFAULT includes Py_TPFLAGS_HAVE_VERSION_TAG; outside the core, it doesn't. This is so that extensions that modify tp_dict of their own types directly don't break, since this was allowed in 2.5. In 3.0 they will have to manually remove this flag though! */ /* PyBufferProcs contains bf_getcharbuffer */ #define Py_TPFLAGS_HAVE_GETCHARBUFFER (1L<<0) /* PySequenceMethods contains sq_contains */ #define Py_TPFLAGS_HAVE_SEQUENCE_IN (1L<<1) /* This is here for backwards compatibility. Extensions that use the old GC * API will still compile but the objects will not be tracked by the GC. */ #define Py_TPFLAGS_GC 0 /* used to be (1L<<2) */ /* PySequenceMethods and PyNumberMethods contain in-place operators */ #define Py_TPFLAGS_HAVE_INPLACEOPS (1L<<3) /* PyNumberMethods do their own coercion */ #define Py_TPFLAGS_CHECKTYPES (1L<<4) /* tp_richcompare is defined */ #define Py_TPFLAGS_HAVE_RICHCOMPARE (1L<<5) /* Objects which are weakly referencable if their tp_weaklistoffset is >0 */ #define Py_TPFLAGS_HAVE_WEAKREFS (1L<<6) /* tp_iter is defined */ #define Py_TPFLAGS_HAVE_ITER (1L<<7) /* New members introduced by Python 2.2 exist */ #define Py_TPFLAGS_HAVE_CLASS (1L<<8) /* Set if the type object is dynamically allocated */ #define Py_TPFLAGS_HEAPTYPE (1L<<9) /* Set if the type allows subclassing */ #define Py_TPFLAGS_BASETYPE (1L<<10) /* Set if the type is 'ready' -- fully initialized */ #define Py_TPFLAGS_READY (1L<<12) /* Set while the type is being 'readied', to prevent recursive ready calls */ #define Py_TPFLAGS_READYING (1L<<13) /* Objects support garbage collection (see objimp.h) */ #define Py_TPFLAGS_HAVE_GC (1L<<14) /* These two bits are preserved for Stackless Python, next after this is 17 */ #ifdef STACKLESS #define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION (3L<<15) #else #define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION 0 #endif /* Objects support nb_index in PyNumberMethods */ #define Py_TPFLAGS_HAVE_INDEX (1L<<17) /* Objects support type attribute cache */ #define Py_TPFLAGS_HAVE_VERSION_TAG (1L<<18) #define Py_TPFLAGS_VALID_VERSION_TAG (1L<<19) /* Type is abstract and cannot be instantiated */ #define Py_TPFLAGS_IS_ABSTRACT (1L<<20) /* Has the new buffer protocol */ #define Py_TPFLAGS_HAVE_NEWBUFFER (1L<<21) /* These flags are used to determine if a type is a subclass. */ #define Py_TPFLAGS_INT_SUBCLASS (1L<<23) #define Py_TPFLAGS_LONG_SUBCLASS (1L<<24) #define Py_TPFLAGS_LIST_SUBCLASS (1L<<25) #define Py_TPFLAGS_TUPLE_SUBCLASS (1L<<26) #define Py_TPFLAGS_STRING_SUBCLASS (1L<<27) #define Py_TPFLAGS_UNICODE_SUBCLASS (1L<<28) #define Py_TPFLAGS_DICT_SUBCLASS (1L<<29) #define Py_TPFLAGS_BASE_EXC_SUBCLASS (1L<<30) #define Py_TPFLAGS_TYPE_SUBCLASS (1L<<31) #define Py_TPFLAGS_DEFAULT_EXTERNAL ( \ Py_TPFLAGS_HAVE_GETCHARBUFFER | \ Py_TPFLAGS_HAVE_SEQUENCE_IN | \ Py_TPFLAGS_HAVE_INPLACEOPS | \ Py_TPFLAGS_HAVE_RICHCOMPARE | \ Py_TPFLAGS_HAVE_WEAKREFS | \ Py_TPFLAGS_HAVE_ITER | \ Py_TPFLAGS_HAVE_CLASS | \ Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | \ Py_TPFLAGS_HAVE_INDEX | \ 0) #define Py_TPFLAGS_DEFAULT_CORE (Py_TPFLAGS_DEFAULT_EXTERNAL | \ Py_TPFLAGS_HAVE_VERSION_TAG) #ifdef Py_BUILD_CORE #define Py_TPFLAGS_DEFAULT Py_TPFLAGS_DEFAULT_CORE #else #define Py_TPFLAGS_DEFAULT Py_TPFLAGS_DEFAULT_EXTERNAL #endif #define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0) #define PyType_FastSubclass(t,f) PyType_HasFeature(t,f) /* The macros Py_INCREF(op) and Py_DECREF(op) are used to increment or decrement reference counts. Py_DECREF calls the object's deallocator function when the refcount falls to 0; for objects that don't contain references to other objects or heap memory this can be the standard function free(). Both macros can be used wherever a void expression is allowed. The argument must not be a NULL pointer. If it may be NULL, use Py_XINCREF/Py_XDECREF instead. The macro _Py_NewReference(op) initialize reference counts to 1, and in special builds (Py_REF_DEBUG, Py_TRACE_REFS) performs additional bookkeeping appropriate to the special build. We assume that the reference count field can never overflow; this can be proven when the size of the field is the same as the pointer size, so we ignore the possibility. Provided a C int is at least 32 bits (which is implicitly assumed in many parts of this code), that's enough for about 2**31 references to an object. XXX The following became out of date in Python 2.2, but I'm not sure XXX what the full truth is now. Certainly, heap-allocated type objects XXX can and should be deallocated. Type objects should never be deallocated; the type pointer in an object is not considered to be a reference to the type object, to save complications in the deallocation function. (This is actually a decision that's up to the implementer of each new type so if you want, you can count such references to the type object.) *** WARNING*** The Py_DECREF macro must have a side-effect-free argument since it may evaluate its argument multiple times. (The alternative would be to mace it a proper function or assign it to a global temporary variable first, both of which are slower; and in a multi-threaded environment the global variable trick is not safe.) */ /* First define a pile of simple helper macros, one set per special * build symbol. These either expand to the obvious things, or to * nothing at all when the special mode isn't in effect. The main * macros can later be defined just once then, yet expand to different * things depending on which special build options are and aren't in effect. * Trust me <wink>: while painful, this is 20x easier to understand than, * e.g, defining _Py_NewReference five different times in a maze of nested * #ifdefs (we used to do that -- it was impenetrable). */ #ifdef Py_REF_DEBUG PyAPI_DATA(Py_ssize_t) _Py_RefTotal; PyAPI_FUNC(void) _Py_NegativeRefcount(const char *fname, int lineno, PyObject *op); PyAPI_FUNC(PyObject *) _PyDict_Dummy(void); PyAPI_FUNC(PyObject *) _PySet_Dummy(void); PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void); #define _Py_INC_REFTOTAL _Py_RefTotal++ #define _Py_DEC_REFTOTAL _Py_RefTotal-- #define _Py_REF_DEBUG_COMMA , #define _Py_CHECK_REFCNT(OP) \ { if (((PyObject*)OP)->ob_refcnt < 0) \ _Py_NegativeRefcount(__FILE__, __LINE__, \ (PyObject *)(OP)); \ } #else #define _Py_INC_REFTOTAL #define _Py_DEC_REFTOTAL #define _Py_REF_DEBUG_COMMA #define _Py_CHECK_REFCNT(OP) /* a semicolon */; #endif /* Py_REF_DEBUG */ #ifdef COUNT_ALLOCS PyAPI_FUNC(void) inc_count(PyTypeObject *); PyAPI_FUNC(void) dec_count(PyTypeObject *); #define _Py_INC_TPALLOCS(OP) inc_count(Py_TYPE(OP)) #define _Py_INC_TPFREES(OP) dec_count(Py_TYPE(OP)) #define _Py_DEC_TPFREES(OP) Py_TYPE(OP)->tp_frees-- #define _Py_COUNT_ALLOCS_COMMA , #else #define _Py_INC_TPALLOCS(OP) #define _Py_INC_TPFREES(OP) #define _Py_DEC_TPFREES(OP) #define _Py_COUNT_ALLOCS_COMMA #endif /* COUNT_ALLOCS */ #ifdef Py_TRACE_REFS /* Py_TRACE_REFS is such major surgery that we call external routines. */ PyAPI_FUNC(void) _Py_NewReference(PyObject *); PyAPI_FUNC(void) _Py_ForgetReference(PyObject *); PyAPI_FUNC(void) _Py_Dealloc(PyObject *); PyAPI_FUNC(void) _Py_PrintReferences(FILE *); PyAPI_FUNC(void) _Py_PrintReferenceAddresses(FILE *); PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force); #else /* Without Py_TRACE_REFS, there's little enough to do that we expand code * inline. */ #define _Py_NewReference(op) ( \ _Py_INC_TPALLOCS(op) _Py_COUNT_ALLOCS_COMMA \ _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \ Py_REFCNT(op) = 1) #define _Py_ForgetReference(op) _Py_INC_TPFREES(op) #define _Py_Dealloc(op) ( \ _Py_INC_TPFREES(op) _Py_COUNT_ALLOCS_COMMA \ (*Py_TYPE(op)->tp_dealloc)((PyObject *)(op))) #endif /* !Py_TRACE_REFS */ #define Py_INCREF(op) ( \ _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \ ((PyObject*)(op))->ob_refcnt++) #define Py_DECREF(op) \ do { \ if (_Py_DEC_REFTOTAL _Py_REF_DEBUG_COMMA \ --((PyObject*)(op))->ob_refcnt != 0) \ _Py_CHECK_REFCNT(op) \ else \ _Py_Dealloc((PyObject *)(op)); \ } while (0) /* Safely decref `op` and set `op` to NULL, especially useful in tp_clear * and tp_dealloc implementatons. * * Note that "the obvious" code can be deadly: * * Py_XDECREF(op); * op = NULL; * * Typically, `op` is something like self->containee, and `self` is done * using its `containee` member. In the code sequence above, suppose * `containee` is non-NULL with a refcount of 1. Its refcount falls to * 0 on the first line, which can trigger an arbitrary amount of code, * possibly including finalizers (like __del__ methods or weakref callbacks) * coded in Python, which in turn can release the GIL and allow other threads * to run, etc. Such code may even invoke methods of `self` again, or cause * cyclic gc to trigger, but-- oops! --self->containee still points to the * object being torn down, and it may be in an insane state while being torn * down. This has in fact been a rich historic source of miserable (rare & * hard-to-diagnose) segfaulting (and other) bugs. * * The safe way is: * * Py_CLEAR(op); * * That arranges to set `op` to NULL _before_ decref'ing, so that any code * triggered as a side-effect of `op` getting torn down no longer believes * `op` points to a valid object. * * There are cases where it's safe to use the naive code, but they're brittle. * For example, if `op` points to a Python integer, you know that destroying * one of those can't cause problems -- but in part that relies on that * Python integers aren't currently weakly referencable. Best practice is * to use Py_CLEAR() even if you can't think of a reason for why you need to. */ #define Py_CLEAR(op) \ do { \ if (op) { \ PyObject *_py_tmp = (PyObject *)(op); \ (op) = NULL; \ Py_DECREF(_py_tmp); \ } \ } while (0) /* Macros to use in case the object pointer may be NULL: */ #define Py_XINCREF(op) do { if ((op) == NULL) ; else Py_INCREF(op); } while (0) #define Py_XDECREF(op) do { if ((op) == NULL) ; else Py_DECREF(op); } while (0) /* These are provided as conveniences to Python runtime embedders, so that they can have object code that is not dependent on Python compilation flags. */ PyAPI_FUNC(void) Py_IncRef(PyObject *); PyAPI_FUNC(void) Py_DecRef(PyObject *); /* _Py_NoneStruct is an object of undefined type which can be used in contexts where NULL (nil) is not suitable (since NULL often means 'error'). Don't forget to apply Py_INCREF() when returning this value!!! */ PyAPI_DATA(PyObject) _Py_NoneStruct; /* Don't use this directly */ #define Py_None (&_Py_NoneStruct) /* Macro for returning Py_None from a function */ #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None /* Py_NotImplemented is a singleton used to signal that an operation is not implemented for a given type combination. */ PyAPI_DATA(PyObject) _Py_NotImplementedStruct; /* Don't use this directly */ #define Py_NotImplemented (&_Py_NotImplementedStruct) /* Rich comparison opcodes */ #define Py_LT 0 #define Py_LE 1 #define Py_EQ 2 #define Py_NE 3 #define Py_GT 4 #define Py_GE 5 /* Maps Py_LT to Py_GT, ..., Py_GE to Py_LE. * Defined in object.c. */ PyAPI_DATA(int) _Py_SwappedOp[]; /* Define staticforward and statichere for source compatibility with old C extensions. The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) */ #define staticforward static #define statichere static /* More conventions ================ Argument Checking ----------------- Functions that take objects as arguments normally don't check for nil arguments, but they do check the type of the argument, and return an error if the function doesn't apply to the type. Failure Modes ------------- Functions may fail for a variety of reasons, including running out of memory. This is communicated to the caller in two ways: an error string is set (see errors.h), and the function result differs: functions that normally return a pointer return NULL for failure, functions returning an integer return -1 (which could be a legal return value too!), and other functions return 0 for success and -1 for failure. Callers should always check for errors before using the result. If an error was set, the caller must either explicitly clear it, or pass the error on to its caller. Reference Counts ---------------- It takes a while to get used to the proper usage of reference counts. Functions that create an object set the reference count to 1; such new objects must be stored somewhere or destroyed again with Py_DECREF(). Some functions that 'store' objects, such as PyTuple_SetItem() and PyList_SetItem(), don't increment the reference count of the object, since the most frequent use is to store a fresh object. Functions that 'retrieve' objects, such as PyTuple_GetItem() and PyDict_GetItemString(), also don't increment the reference count, since most frequently the object is only looked at quickly. Thus, to retrieve an object and store it again, the caller must call Py_INCREF() explicitly. NOTE: functions that 'consume' a reference count, like PyList_SetItem(), consume the reference even if the object wasn't successfully stored, to simplify error handling. It seems attractive to make other functions that take an object as argument consume a reference count; however, this may quickly get confusing (even the current practice is already confusing). Consider it carefully, it may save lots of calls to Py_INCREF() and Py_DECREF() at times. */ /* Trashcan mechanism, thanks to Christian Tismer. When deallocating a container object, it's possible to trigger an unbounded chain of deallocations, as each Py_DECREF in turn drops the refcount on "the next" object in the chain to 0. This can easily lead to stack faults, and especially in threads (which typically have less stack space to work with). A container object that participates in cyclic gc can avoid this by bracketing the body of its tp_dealloc function with a pair of macros: static void mytype_dealloc(mytype *p) { ... declarations go here ... PyObject_GC_UnTrack(p); // must untrack first Py_TRASHCAN_SAFE_BEGIN(p) ... The body of the deallocator goes here, including all calls ... ... to Py_DECREF on contained objects. ... Py_TRASHCAN_SAFE_END(p) } CAUTION: Never return from the middle of the body! If the body needs to "get out early", put a label immediately before the Py_TRASHCAN_SAFE_END call, and goto it. Else the call-depth counter (see below) will stay above 0 forever, and the trashcan will never get emptied. How it works: The BEGIN macro increments a call-depth counter. So long as this counter is small, the body of the deallocator is run directly without further ado. But if the counter gets large, it instead adds p to a list of objects to be deallocated later, skips the body of the deallocator, and resumes execution after the END macro. The tp_dealloc routine then returns without deallocating anything (and so unbounded call-stack depth is avoided). When the call stack finishes unwinding again, code generated by the END macro notices this, and calls another routine to deallocate all the objects that may have been added to the list of deferred deallocations. In effect, a chain of N deallocations is broken into N / PyTrash_UNWIND_LEVEL pieces, with the call stack never exceeding a depth of PyTrash_UNWIND_LEVEL. */ /* This is the old private API, invoked by the macros before 2.7.4. Kept for binary compatibility of extensions. */ PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*); PyAPI_FUNC(void) _PyTrash_destroy_chain(void); PyAPI_DATA(int) _PyTrash_delete_nesting; PyAPI_DATA(PyObject *) _PyTrash_delete_later; /* The new thread-safe private API, invoked by the macros below. */ PyAPI_FUNC(void) _PyTrash_thread_deposit_object(PyObject*); PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(void); #define PyTrash_UNWIND_LEVEL 50 /* Note the workaround for when the thread state is NULL (issue #17703) */ #define Py_TRASHCAN_SAFE_BEGIN(op) \ do { \ PyThreadState *_tstate = PyThreadState_GET(); \ if (!_tstate || \ _tstate->trash_delete_nesting < PyTrash_UNWIND_LEVEL) { \ if (_tstate) \ ++_tstate->trash_delete_nesting; /* The body of the deallocator is here. */ #define Py_TRASHCAN_SAFE_END(op) \ if (_tstate) { \ --_tstate->trash_delete_nesting; \ if (_tstate->trash_delete_later \ && _tstate->trash_delete_nesting <= 0) \ _PyTrash_thread_destroy_chain(); \ } \ } \ else \ _PyTrash_thread_deposit_object((PyObject*)op); \ } while (0); PyAPI_FUNC(void) _PyDebugAllocatorStats(FILE *out, const char *block_name, int num_blocks, size_t sizeof_block); PyAPI_FUNC(void) _PyObject_DebugTypeStats(FILE *out); #ifdef __cplusplus } #endif #endif /* !Py_OBJECT_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/boolobject.h������������������������������������������������������������������������������0000644�����������������00000001620�14763166027�0010622 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Boolean object interface */ #ifndef Py_BOOLOBJECT_H #define Py_BOOLOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef PyIntObject PyBoolObject; PyAPI_DATA(PyTypeObject) PyBool_Type; #define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type) /* Py_False and Py_True are the only two bools in existence. Don't forget to apply Py_INCREF() when returning either!!! */ /* Don't use these directly */ PyAPI_DATA(PyIntObject) _Py_ZeroStruct, _Py_TrueStruct; /* Use these macros */ #define Py_False ((PyObject *) &_Py_ZeroStruct) #define Py_True ((PyObject *) &_Py_TrueStruct) /* Macros for returning Py_True or Py_False, respectively */ #define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True #define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False /* Function to return a bool from a C long */ PyAPI_FUNC(PyObject *) PyBool_FromLong(long); #ifdef __cplusplus } #endif #endif /* !Py_BOOLOBJECT_H */ ����������������������������������������������������������������������������������������������������������������python2.7/moduleobject.h����������������������������������������������������������������������������0000644�����������������00000001141�14763166027�0011152 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Module object interface */ #ifndef Py_MODULEOBJECT_H #define Py_MODULEOBJECT_H #ifdef __cplusplus extern "C" { #endif PyAPI_DATA(PyTypeObject) PyModule_Type; #define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type) #define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type) PyAPI_FUNC(PyObject *) PyModule_New(const char *); PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *); PyAPI_FUNC(char *) PyModule_GetName(PyObject *); PyAPI_FUNC(char *) PyModule_GetFilename(PyObject *); PyAPI_FUNC(void) _PyModule_Clear(PyObject *); #ifdef __cplusplus } #endif #endif /* !Py_MODULEOBJECT_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/descrobject.h�����������������������������������������������������������������������������0000644�����������������00000004660�14763166027�0010776 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Descriptors */ #ifndef Py_DESCROBJECT_H #define Py_DESCROBJECT_H #ifdef __cplusplus extern "C" { #endif typedef PyObject *(*getter)(PyObject *, void *); typedef int (*setter)(PyObject *, PyObject *, void *); typedef struct PyGetSetDef { char *name; getter get; setter set; char *doc; void *closure; } PyGetSetDef; typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args, void *wrapped); typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args, void *wrapped, PyObject *kwds); struct wrapperbase { char *name; int offset; void *function; wrapperfunc wrapper; char *doc; int flags; PyObject *name_strobj; }; /* Flags for above struct */ #define PyWrapperFlag_KEYWORDS 1 /* wrapper function takes keyword args */ /* Various kinds of descriptor objects */ #define PyDescr_COMMON \ PyObject_HEAD \ PyTypeObject *d_type; \ PyObject *d_name typedef struct { PyDescr_COMMON; } PyDescrObject; typedef struct { PyDescr_COMMON; PyMethodDef *d_method; } PyMethodDescrObject; typedef struct { PyDescr_COMMON; struct PyMemberDef *d_member; } PyMemberDescrObject; typedef struct { PyDescr_COMMON; PyGetSetDef *d_getset; } PyGetSetDescrObject; typedef struct { PyDescr_COMMON; struct wrapperbase *d_base; void *d_wrapped; /* This can be any function pointer */ } PyWrapperDescrObject; PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type; PyAPI_DATA(PyTypeObject) PyDictProxy_Type; PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type; PyAPI_DATA(PyTypeObject) PyMemberDescr_Type; PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *); PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *); PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *, struct PyMemberDef *); PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *, struct PyGetSetDef *); PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *, struct wrapperbase *, void *); #define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL) PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *); PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *); PyAPI_DATA(PyTypeObject) PyProperty_Type; #ifdef __cplusplus } #endif #endif /* !Py_DESCROBJECT_H */ ��������������������������������������������������������������������������������python2.7/floatobject.h�����������������������������������������������������������������������������0000644�����������������00000012771�14763166027�0011005 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Float object interface */ /* PyFloatObject represents a (double precision) floating point number. */ #ifndef Py_FLOATOBJECT_H #define Py_FLOATOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef struct { PyObject_HEAD double ob_fval; } PyFloatObject; PyAPI_DATA(PyTypeObject) PyFloat_Type; #define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type) #define PyFloat_CheckExact(op) (Py_TYPE(op) == &PyFloat_Type) /* The str() precision PyFloat_STR_PRECISION is chosen so that in most cases, the rounding noise created by various operations is suppressed, while giving plenty of precision for practical use. */ #define PyFloat_STR_PRECISION 12 #ifdef Py_NAN #define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN) #endif #define Py_RETURN_INF(sign) do \ if (copysign(1., sign) == 1.) { \ return PyFloat_FromDouble(Py_HUGE_VAL); \ } else { \ return PyFloat_FromDouble(-Py_HUGE_VAL); \ } while(0) PyAPI_FUNC(double) PyFloat_GetMax(void); PyAPI_FUNC(double) PyFloat_GetMin(void); PyAPI_FUNC(PyObject *) PyFloat_GetInfo(void); /* Return Python float from string PyObject. Second argument ignored on input, and, if non-NULL, NULL is stored into *junk (this tried to serve a purpose once but can't be made to work as intended). */ PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*, char** junk); /* Return Python float from C double. */ PyAPI_FUNC(PyObject *) PyFloat_FromDouble(double); /* Extract C double from Python float. The macro version trades safety for speed. */ PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *); #define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval) /* Write repr(v) into the char buffer argument, followed by null byte. The buffer must be "big enough"; >= 100 is very safe. PyFloat_AsReprString(buf, x) strives to print enough digits so that PyFloat_FromString(buf) then reproduces x exactly. */ PyAPI_FUNC(void) PyFloat_AsReprString(char*, PyFloatObject *v); /* Write str(v) into the char buffer argument, followed by null byte. The buffer must be "big enough"; >= 100 is very safe. Note that it's unusual to be able to get back the float you started with from PyFloat_AsString's result -- use PyFloat_AsReprString() if you want to preserve precision across conversions. */ PyAPI_FUNC(void) PyFloat_AsString(char*, PyFloatObject *v); /* _PyFloat_{Pack,Unpack}{4,8} * * The struct and pickle (at least) modules need an efficient platform- * independent way to store floating-point values as byte strings. * The Pack routines produce a string from a C double, and the Unpack * routines produce a C double from such a string. The suffix (4 or 8) * specifies the number of bytes in the string. * * On platforms that appear to use (see _PyFloat_Init()) IEEE-754 formats * these functions work by copying bits. On other platforms, the formats the * 4- byte format is identical to the IEEE-754 single precision format, and * the 8-byte format to the IEEE-754 double precision format, although the * packing of INFs and NaNs (if such things exist on the platform) isn't * handled correctly, and attempting to unpack a string containing an IEEE * INF or NaN will raise an exception. * * On non-IEEE platforms with more precision, or larger dynamic range, than * 754 supports, not all values can be packed; on non-IEEE platforms with less * precision, or smaller dynamic range, not all values can be unpacked. What * happens in such cases is partly accidental (alas). */ /* The pack routines write 4 or 8 bytes, starting at p. le is a bool * argument, true if you want the string in little-endian format (exponent * last, at p+3 or p+7), false if you want big-endian format (exponent * first, at p). * Return value: 0 if all is OK, -1 if error (and an exception is * set, most likely OverflowError). * There are two problems on non-IEEE platforms: * 1): What this does is undefined if x is a NaN or infinity. * 2): -0.0 and +0.0 produce the same string. */ PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le); PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le); /* Used to get the important decimal digits of a double */ PyAPI_FUNC(int) _PyFloat_Digits(char *buf, double v, int *signum); PyAPI_FUNC(void) _PyFloat_DigitsInit(void); /* The unpack routines read 4 or 8 bytes, starting at p. le is a bool * argument, true if the string is in little-endian format (exponent * last, at p+3 or p+7), false if big-endian (exponent first, at p). * Return value: The unpacked double. On error, this is -1.0 and * PyErr_Occurred() is true (and an exception is set, most likely * OverflowError). Note that on a non-IEEE platform this will refuse * to unpack a string that represents a NaN or infinity. */ PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char *p, int le); PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le); /* free list api */ PyAPI_FUNC(int) PyFloat_ClearFreeList(void); /* Format the object based on the format_spec, as defined in PEP 3101 (Advanced String Formatting). */ PyAPI_FUNC(PyObject *) _PyFloat_FormatAdvanced(PyObject *obj, char *format_spec, Py_ssize_t format_spec_len); /* Round a C double x to the closest multiple of 10**-ndigits. Returns a Python float on success, or NULL (with an appropriate exception set) on failure. Used in builtin_round in bltinmodule.c. */ PyAPI_FUNC(PyObject *) _Py_double_round(double x, int ndigits); PyAPI_FUNC(void) _PyFloat_DebugMallocStats(FILE* out); #ifdef __cplusplus } #endif #endif /* !Py_FLOATOBJECT_H */ �������python2.7/Python.h����������������������������������������������������������������������������������0000644�����������������00000010351�14763166027�0007762 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_PYTHON_H #define Py_PYTHON_H /* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */ /* Include nearly all Python header files */ #include "patchlevel.h" #include "pyconfig.h" #include "pymacconfig.h" /* Cyclic gc is always enabled, starting with release 2.3a1. Supply the * old symbol for the benefit of extension modules written before then * that may be conditionalizing on it. The core doesn't use it anymore. */ #ifndef WITH_CYCLE_GC #define WITH_CYCLE_GC 1 #endif #include <limits.h> #ifndef UCHAR_MAX #error "Something's broken. UCHAR_MAX should be defined in limits.h." #endif #if UCHAR_MAX != 255 #error "Python's source code assumes C's unsigned char is an 8-bit type." #endif #if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE) #define _SGI_MP_SOURCE #endif #include <stdio.h> #ifndef NULL # error "Python.h requires that stdio.h define NULL." #endif #include <string.h> #ifdef HAVE_ERRNO_H #include <errno.h> #endif #include <stdlib.h> #ifdef HAVE_UNISTD_H #include <unistd.h> #endif /* For size_t? */ #ifdef HAVE_STDDEF_H #include <stddef.h> #endif /* CAUTION: Build setups should ensure that NDEBUG is defined on the * compiler command line when building Python in release mode; else * assert() calls won't be removed. */ #include <assert.h> #include "pyport.h" /* pyconfig.h or pyport.h may or may not define DL_IMPORT */ #ifndef DL_IMPORT /* declarations for DLL import/export */ #define DL_IMPORT(RTYPE) RTYPE #endif #ifndef DL_EXPORT /* declarations for DLL import/export */ #define DL_EXPORT(RTYPE) RTYPE #endif /* Debug-mode build with pymalloc implies PYMALLOC_DEBUG. * PYMALLOC_DEBUG is in error if pymalloc is not in use. */ #if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG) #define PYMALLOC_DEBUG #endif #if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC) #error "PYMALLOC_DEBUG requires WITH_PYMALLOC" #endif #include "pymath.h" #include "pymem.h" #include "object.h" #include "objimpl.h" #include "pydebug.h" #include "unicodeobject.h" #include "intobject.h" #include "boolobject.h" #include "longobject.h" #include "floatobject.h" #ifndef WITHOUT_COMPLEX #include "complexobject.h" #endif #include "rangeobject.h" #include "stringobject.h" #include "memoryobject.h" #include "bufferobject.h" #include "bytesobject.h" #include "bytearrayobject.h" #include "tupleobject.h" #include "listobject.h" #include "dictobject.h" #include "enumobject.h" #include "setobject.h" #include "methodobject.h" #include "moduleobject.h" #include "funcobject.h" #include "classobject.h" #include "fileobject.h" #include "cobject.h" #include "pycapsule.h" #include "traceback.h" #include "sliceobject.h" #include "cellobject.h" #include "iterobject.h" #include "genobject.h" #include "descrobject.h" #include "warnings.h" #include "weakrefobject.h" #include "codecs.h" #include "pyerrors.h" #include "pystate.h" #include "pyarena.h" #include "modsupport.h" #include "pythonrun.h" #include "ceval.h" #include "sysmodule.h" #include "intrcheck.h" #include "import.h" #include "abstract.h" #include "compile.h" #include "eval.h" #include "pyctype.h" #include "pystrtod.h" #include "pystrcmp.h" #include "dtoa.h" /* _Py_Mangle is defined in compile.c */ PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name); /* PyArg_GetInt is deprecated and should not be used, use PyArg_Parse(). */ #define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a)) /* PyArg_NoArgs should not be necessary. Set ml_flags in the PyMethodDef to METH_NOARGS. */ #define PyArg_NoArgs(v) PyArg_Parse(v, "") /* Argument must be a char or an int in [-128, 127] or [0, 255]. */ #define Py_CHARMASK(c) ((unsigned char)((c) & 0xff)) #include "pyfpe.h" /* These definitions must match corresponding definitions in graminit.h. There's code in compile.c that checks that they are the same. */ #define Py_single_input 256 #define Py_file_input 257 #define Py_eval_input 258 #ifdef HAVE_PTH /* GNU pth user-space thread support */ #include <pth.h> #endif /* Define macros for inline documentation. */ #define PyDoc_VAR(name) static char name[] #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) #ifdef WITH_DOC_STRINGS #define PyDoc_STR(str) str #else #define PyDoc_STR(str) "" #endif #endif /* !Py_PYTHON_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/codecs.h����������������������������������������������������������������������������������0000644�����������������00000011636�14763166027�0007750 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_CODECREGISTRY_H #define Py_CODECREGISTRY_H #ifdef __cplusplus extern "C" { #endif /* ------------------------------------------------------------------------ Python Codec Registry and support functions Written by Marc-Andre Lemburg (mal@lemburg.com). Copyright (c) Corporation for National Research Initiatives. ------------------------------------------------------------------------ */ /* Register a new codec search function. As side effect, this tries to load the encodings package, if not yet done, to make sure that it is always first in the list of search functions. The search_function's refcount is incremented by this function. */ PyAPI_FUNC(int) PyCodec_Register( PyObject *search_function ); /* Codec register lookup API. Looks up the given encoding and returns a CodecInfo object with function attributes which implement the different aspects of processing the encoding. The encoding string is looked up converted to all lower-case characters. This makes encodings looked up through this mechanism effectively case-insensitive. If no codec is found, a KeyError is set and NULL returned. As side effect, this tries to load the encodings package, if not yet done. This is part of the lazy load strategy for the encodings package. */ PyAPI_FUNC(PyObject *) _PyCodec_Lookup( const char *encoding ); /* Generic codec based encoding API. object is passed through the encoder function found for the given encoding using the error handling method defined by errors. errors may be NULL to use the default method defined for the codec. Raises a LookupError in case no encoder can be found. */ PyAPI_FUNC(PyObject *) PyCodec_Encode( PyObject *object, const char *encoding, const char *errors ); /* Generic codec based decoding API. object is passed through the decoder function found for the given encoding using the error handling method defined by errors. errors may be NULL to use the default method defined for the codec. Raises a LookupError in case no encoder can be found. */ PyAPI_FUNC(PyObject *) PyCodec_Decode( PyObject *object, const char *encoding, const char *errors ); /* --- Codec Lookup APIs -------------------------------------------------- All APIs return a codec object with incremented refcount and are based on _PyCodec_Lookup(). The same comments w/r to the encoding name also apply to these APIs. */ /* Get an encoder function for the given encoding. */ PyAPI_FUNC(PyObject *) PyCodec_Encoder( const char *encoding ); /* Get a decoder function for the given encoding. */ PyAPI_FUNC(PyObject *) PyCodec_Decoder( const char *encoding ); /* Get a IncrementalEncoder object for the given encoding. */ PyAPI_FUNC(PyObject *) PyCodec_IncrementalEncoder( const char *encoding, const char *errors ); /* Get a IncrementalDecoder object function for the given encoding. */ PyAPI_FUNC(PyObject *) PyCodec_IncrementalDecoder( const char *encoding, const char *errors ); /* Get a StreamReader factory function for the given encoding. */ PyAPI_FUNC(PyObject *) PyCodec_StreamReader( const char *encoding, PyObject *stream, const char *errors ); /* Get a StreamWriter factory function for the given encoding. */ PyAPI_FUNC(PyObject *) PyCodec_StreamWriter( const char *encoding, PyObject *stream, const char *errors ); /* Unicode encoding error handling callback registry API */ /* Register the error handling callback function error under the given name. This function will be called by the codec when it encounters unencodable characters/undecodable bytes and doesn't know the callback name, when name is specified as the error parameter in the call to the encode/decode function. Return 0 on success, -1 on error */ PyAPI_FUNC(int) PyCodec_RegisterError(const char *name, PyObject *error); /* Lookup the error handling callback function registered under the given name. As a special case NULL can be passed, in which case the error handling callback for "strict" will be returned. */ PyAPI_FUNC(PyObject *) PyCodec_LookupError(const char *name); /* raise exc as an exception */ PyAPI_FUNC(PyObject *) PyCodec_StrictErrors(PyObject *exc); /* ignore the unicode error, skipping the faulty input */ PyAPI_FUNC(PyObject *) PyCodec_IgnoreErrors(PyObject *exc); /* replace the unicode encode error with ? or U+FFFD */ PyAPI_FUNC(PyObject *) PyCodec_ReplaceErrors(PyObject *exc); /* replace the unicode encode error with XML character references */ PyAPI_FUNC(PyObject *) PyCodec_XMLCharRefReplaceErrors(PyObject *exc); /* replace the unicode encode error with backslash escapes (\x, \u and \U) */ PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc); #ifdef __cplusplus } #endif #endif /* !Py_CODECREGISTRY_H */ ��������������������������������������������������������������������������������������������������python2.7/pythonrun.h�������������������������������������������������������������������������������0000644�����������������00000016156�14763166027�0010560 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Interfaces to parse and execute pieces of python code */ #ifndef Py_PYTHONRUN_H #define Py_PYTHONRUN_H #ifdef __cplusplus extern "C" { #endif #define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \ CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \ CO_FUTURE_UNICODE_LITERALS) #define PyCF_MASK_OBSOLETE (CO_NESTED) #define PyCF_SOURCE_IS_UTF8 0x0100 #define PyCF_DONT_IMPLY_DEDENT 0x0200 #define PyCF_ONLY_AST 0x0400 typedef struct { int cf_flags; /* bitmask of CO_xxx flags relevant to future */ } PyCompilerFlags; PyAPI_FUNC(void) Py_SetProgramName(char *); PyAPI_FUNC(char *) Py_GetProgramName(void); PyAPI_FUNC(void) Py_SetPythonHome(char *); PyAPI_FUNC(char *) Py_GetPythonHome(void); PyAPI_FUNC(void) Py_Initialize(void); PyAPI_FUNC(void) Py_InitializeEx(int); PyAPI_FUNC(void) Py_Finalize(void); PyAPI_FUNC(int) Py_IsInitialized(void); PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void); PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *); PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *); PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *, const char *, int, PyCompilerFlags *); PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *); PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, const char *, int, PyCompilerFlags *); PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, const char *, PyCompilerFlags *); PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, const char *, PyCompilerFlags *); PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(const char *, const char *, int, PyCompilerFlags *flags, PyArena *); PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(FILE *, const char *, int, char *, char *, PyCompilerFlags *, int *, PyArena *); #define PyParser_SimpleParseString(S, B) \ PyParser_SimpleParseStringFlags(S, B, 0) #define PyParser_SimpleParseFile(FP, S, B) \ PyParser_SimpleParseFileFlags(FP, S, B, 0) PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int, int); PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *, int, int); PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *, PyObject *, PyCompilerFlags *); PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, const char *, int, PyObject *, PyObject *, int, PyCompilerFlags *); #define Py_CompileString(str, p, s) Py_CompileStringFlags(str, p, s, NULL) PyAPI_FUNC(PyObject *) Py_CompileStringFlags(const char *, const char *, int, PyCompilerFlags *); PyAPI_FUNC(struct symtable *) Py_SymtableString(const char *, const char *, int); PyAPI_FUNC(void) PyErr_Print(void); PyAPI_FUNC(void) PyErr_PrintEx(int); PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *); PyAPI_FUNC(int) Py_AtExit(void (*func)(void)); PyAPI_FUNC(void) Py_Exit(int); PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *); /* Bootstrap */ PyAPI_FUNC(int) Py_Main(int argc, char **argv); /* Use macros for a bunch of old variants */ #define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL) #define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL) #define PyRun_AnyFileEx(fp, name, closeit) \ PyRun_AnyFileExFlags(fp, name, closeit, NULL) #define PyRun_AnyFileFlags(fp, name, flags) \ PyRun_AnyFileExFlags(fp, name, 0, flags) #define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL) #define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL) #define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL) #define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL) #define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL) #define PyRun_File(fp, p, s, g, l) \ PyRun_FileExFlags(fp, p, s, g, l, 0, NULL) #define PyRun_FileEx(fp, p, s, g, l, c) \ PyRun_FileExFlags(fp, p, s, g, l, c, NULL) #define PyRun_FileFlags(fp, p, s, g, l, flags) \ PyRun_FileExFlags(fp, p, s, g, l, 0, flags) /* In getpath.c */ PyAPI_FUNC(char *) Py_GetProgramFullPath(void); PyAPI_FUNC(char *) Py_GetPrefix(void); PyAPI_FUNC(char *) Py_GetExecPrefix(void); PyAPI_FUNC(char *) Py_GetPath(void); /* In their own files */ PyAPI_FUNC(const char *) Py_GetVersion(void); PyAPI_FUNC(const char *) Py_GetPlatform(void); PyAPI_FUNC(const char *) Py_GetCopyright(void); PyAPI_FUNC(const char *) Py_GetCompiler(void); PyAPI_FUNC(const char *) Py_GetBuildInfo(void); PyAPI_FUNC(const char *) _Py_svnversion(void); PyAPI_FUNC(const char *) Py_SubversionRevision(void); PyAPI_FUNC(const char *) Py_SubversionShortBranch(void); PyAPI_FUNC(const char *) _Py_hgidentifier(void); PyAPI_FUNC(const char *) _Py_hgversion(void); /* Internal -- various one-time initializations */ PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void); PyAPI_FUNC(PyObject *) _PySys_Init(void); PyAPI_FUNC(void) _PyImport_Init(void); PyAPI_FUNC(void) _PyExc_Init(void); PyAPI_FUNC(void) _PyImportHooks_Init(void); PyAPI_FUNC(int) _PyFrame_Init(void); PyAPI_FUNC(int) _PyInt_Init(void); PyAPI_FUNC(int) _PyLong_Init(void); PyAPI_FUNC(void) _PyFloat_Init(void); PyAPI_FUNC(int) PyByteArray_Init(void); PyAPI_FUNC(void) _PyRandom_Init(void); /* Various internal finalizers */ PyAPI_FUNC(void) _PyExc_Fini(void); PyAPI_FUNC(void) _PyImport_Fini(void); PyAPI_FUNC(void) PyMethod_Fini(void); PyAPI_FUNC(void) PyFrame_Fini(void); PyAPI_FUNC(void) PyCFunction_Fini(void); PyAPI_FUNC(void) PyDict_Fini(void); PyAPI_FUNC(void) PyTuple_Fini(void); PyAPI_FUNC(void) PyList_Fini(void); PyAPI_FUNC(void) PySet_Fini(void); PyAPI_FUNC(void) PyString_Fini(void); PyAPI_FUNC(void) PyInt_Fini(void); PyAPI_FUNC(void) PyFloat_Fini(void); PyAPI_FUNC(void) PyOS_FiniInterrupts(void); PyAPI_FUNC(void) PyByteArray_Fini(void); PyAPI_FUNC(void) _PyRandom_Fini(void); /* Stuff with no proper home (yet) */ PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *); PyAPI_DATA(int) (*PyOS_InputHook)(void); PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *); PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState; /* Stack size, in "pointers" (so we get extra safety margins on 64-bit platforms). On a 32-bit platform, this translates to a 8k margin. */ #define PYOS_STACK_MARGIN 2048 #if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) && _MSC_VER >= 1300 /* Enable stack checking under Microsoft C */ #define USE_STACKCHECK #endif #ifdef USE_STACKCHECK /* Check that we aren't overflowing our stack */ PyAPI_FUNC(int) PyOS_CheckStack(void); #endif /* Signals */ typedef void (*PyOS_sighandler_t)(int); PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int); PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t); /* Random */ PyAPI_FUNC(int) _PyOS_URandom (void *buffer, Py_ssize_t size); #ifdef __cplusplus } #endif #endif /* !Py_PYTHONRUN_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/compile.h���������������������������������������������������������������������������������0000644�����������������00000002051�14763166027�0010127 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� #ifndef Py_COMPILE_H #define Py_COMPILE_H #include "code.h" #ifdef __cplusplus extern "C" { #endif /* Public interface */ struct _node; /* Declare the existence of this type */ PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *); /* Future feature support */ typedef struct { int ff_features; /* flags set by future statements */ int ff_lineno; /* line number of last future statement */ } PyFutureFeatures; #define FUTURE_NESTED_SCOPES "nested_scopes" #define FUTURE_GENERATORS "generators" #define FUTURE_DIVISION "division" #define FUTURE_ABSOLUTE_IMPORT "absolute_import" #define FUTURE_WITH_STATEMENT "with_statement" #define FUTURE_PRINT_FUNCTION "print_function" #define FUTURE_UNICODE_LITERALS "unicode_literals" struct _mod; /* Declare the existence of this type */ PyAPI_FUNC(PyCodeObject *) PyAST_Compile(struct _mod *, const char *, PyCompilerFlags *, PyArena *); PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *); #ifdef __cplusplus } #endif #endif /* !Py_COMPILE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/structmember.h����������������������������������������������������������������������������0000644�����������������00000005525�14763166027�0011224 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_STRUCTMEMBER_H #define Py_STRUCTMEMBER_H #ifdef __cplusplus extern "C" { #endif /* Interface to map C struct members to Python object attributes */ #include <stddef.h> /* For offsetof */ /* The offsetof() macro calculates the offset of a structure member in its structure. Unfortunately this cannot be written down portably, hence it is provided by a Standard C header file. For pre-Standard C compilers, here is a version that usually works (but watch out!): */ #ifndef offsetof #define offsetof(type, member) ( (int) & ((type*)0) -> member ) #endif /* An array of memberlist structures defines the name, type and offset of selected members of a C structure. These can be read by PyMember_Get() and set by PyMember_Set() (except if their READONLY flag is set). The array must be terminated with an entry whose name pointer is NULL. */ struct memberlist { /* Obsolete version, for binary backwards compatibility */ char *name; int type; int offset; int flags; }; typedef struct PyMemberDef { /* Current version, use this */ char *name; int type; Py_ssize_t offset; int flags; char *doc; } PyMemberDef; /* Types */ #define T_SHORT 0 #define T_INT 1 #define T_LONG 2 #define T_FLOAT 3 #define T_DOUBLE 4 #define T_STRING 5 #define T_OBJECT 6 /* XXX the ordering here is weird for binary compatibility */ #define T_CHAR 7 /* 1-character string */ #define T_BYTE 8 /* 8-bit signed int */ /* unsigned variants: */ #define T_UBYTE 9 #define T_USHORT 10 #define T_UINT 11 #define T_ULONG 12 /* Added by Jack: strings contained in the structure */ #define T_STRING_INPLACE 13 /* Added by Lillo: bools contained in the structure (assumed char) */ #define T_BOOL 14 #define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError when the value is NULL, instead of converting to None. */ #ifdef HAVE_LONG_LONG #define T_LONGLONG 17 #define T_ULONGLONG 18 #endif /* HAVE_LONG_LONG */ #define T_PYSSIZET 19 /* Py_ssize_t */ /* Flags */ #define READONLY 1 #define RO READONLY /* Shorthand */ #define READ_RESTRICTED 2 #define PY_WRITE_RESTRICTED 4 #define RESTRICTED (READ_RESTRICTED | PY_WRITE_RESTRICTED) /* Obsolete API, for binary backwards compatibility */ PyAPI_FUNC(PyObject *) PyMember_Get(const char *, struct memberlist *, const char *); PyAPI_FUNC(int) PyMember_Set(char *, struct memberlist *, const char *, PyObject *); /* Current API, use this */ PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, struct PyMemberDef *); PyAPI_FUNC(int) PyMember_SetOne(char *, struct PyMemberDef *, PyObject *); #ifdef __cplusplus } #endif #endif /* !Py_STRUCTMEMBER_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/timefuncs.h�������������������������������������������������������������������������������0000644�����������������00000001035�14763166027�0010475 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* timefuncs.h */ /* Utility function related to timemodule.c. */ #ifndef TIMEFUNCS_H #define TIMEFUNCS_H #ifdef __cplusplus extern "C" { #endif /* Cast double x to time_t, but raise ValueError if x is too large * to fit in a time_t. ValueError is set on return iff the return * value is (time_t)-1 and PyErr_Occurred(). */ PyAPI_FUNC(time_t) _PyTime_DoubleToTimet(double x); /* Get the current time since the epoch in seconds */ PyAPI_FUNC(double) _PyTime_FloatTime(void); #ifdef __cplusplus } #endif #endif /* TIMEFUNCS_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/objimpl.h���������������������������������������������������������������������������������0000644�����������������00000033220�14763166027�0010135 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* The PyObject_ memory family: high-level object memory interfaces. See pymem.h for the low-level PyMem_ family. */ #ifndef Py_OBJIMPL_H #define Py_OBJIMPL_H #include "pymem.h" #ifdef __cplusplus extern "C" { #endif /* BEWARE: Each interface exports both functions and macros. Extension modules should use the functions, to ensure binary compatibility across Python versions. Because the Python implementation is free to change internal details, and the macros may (or may not) expose details for speed, if you do use the macros you must recompile your extensions with each Python release. Never mix calls to PyObject_ memory functions with calls to the platform malloc/realloc/ calloc/free, or with calls to PyMem_. */ /* Functions and macros for modules that implement new object types. - PyObject_New(type, typeobj) allocates memory for a new object of the given type, and initializes part of it. 'type' must be the C structure type used to represent the object, and 'typeobj' the address of the corresponding type object. Reference count and type pointer are filled in; the rest of the bytes of the object are *undefined*! The resulting expression type is 'type *'. The size of the object is determined by the tp_basicsize field of the type object. - PyObject_NewVar(type, typeobj, n) is similar but allocates a variable-size object with room for n items. In addition to the refcount and type pointer fields, this also fills in the ob_size field. - PyObject_Del(op) releases the memory allocated for an object. It does not run a destructor -- it only frees the memory. PyObject_Free is identical. - PyObject_Init(op, typeobj) and PyObject_InitVar(op, typeobj, n) don't allocate memory. Instead of a 'type' parameter, they take a pointer to a new object (allocated by an arbitrary allocator), and initialize its object header fields. Note that objects created with PyObject_{New, NewVar} are allocated using the specialized Python allocator (implemented in obmalloc.c), if WITH_PYMALLOC is enabled. In addition, a special debugging allocator is used if PYMALLOC_DEBUG is also #defined. In case a specific form of memory management is needed (for example, if you must use the platform malloc heap(s), or shared memory, or C++ local storage or operator new), you must first allocate the object with your custom allocator, then pass its pointer to PyObject_{Init, InitVar} for filling in its Python- specific fields: reference count, type pointer, possibly others. You should be aware that Python no control over these objects because they don't cooperate with the Python memory manager. Such objects may not be eligible for automatic garbage collection and you have to make sure that they are released accordingly whenever their destructor gets called (cf. the specific form of memory management you're using). Unless you have specific memory management requirements, use PyObject_{New, NewVar, Del}. */ /* * Raw object memory interface * =========================== */ /* Functions to call the same malloc/realloc/free as used by Python's object allocator. If WITH_PYMALLOC is enabled, these may differ from the platform malloc/realloc/free. The Python object allocator is designed for fast, cache-conscious allocation of many "small" objects, and with low hidden memory overhead. PyObject_Malloc(0) returns a unique non-NULL pointer if possible. PyObject_Realloc(NULL, n) acts like PyObject_Malloc(n). PyObject_Realloc(p != NULL, 0) does not return NULL, or free the memory at p. Returned pointers must be checked for NULL explicitly; no action is performed on failure other than to return NULL (no warning it printed, no exception is set, etc). For allocating objects, use PyObject_{New, NewVar} instead whenever possible. The PyObject_{Malloc, Realloc, Free} family is exposed so that you can exploit Python's small-block allocator for non-object uses. If you must use these routines to allocate object memory, make sure the object gets initialized via PyObject_{Init, InitVar} after obtaining the raw memory. */ PyAPI_FUNC(void *) PyObject_Malloc(size_t); PyAPI_FUNC(void *) PyObject_Realloc(void *, size_t); PyAPI_FUNC(void) PyObject_Free(void *); /* Macros */ #ifdef WITH_PYMALLOC PyAPI_FUNC(void) _PyObject_DebugMallocStats(FILE *out); #ifdef PYMALLOC_DEBUG /* WITH_PYMALLOC && PYMALLOC_DEBUG */ PyAPI_FUNC(void *) _PyObject_DebugMalloc(size_t nbytes); PyAPI_FUNC(void *) _PyObject_DebugRealloc(void *p, size_t nbytes); PyAPI_FUNC(void) _PyObject_DebugFree(void *p); PyAPI_FUNC(void) _PyObject_DebugDumpAddress(const void *p); PyAPI_FUNC(void) _PyObject_DebugCheckAddress(const void *p); PyAPI_FUNC(void *) _PyObject_DebugMallocApi(char api, size_t nbytes); PyAPI_FUNC(void *) _PyObject_DebugReallocApi(char api, void *p, size_t nbytes); PyAPI_FUNC(void) _PyObject_DebugFreeApi(char api, void *p); PyAPI_FUNC(void) _PyObject_DebugCheckAddressApi(char api, const void *p); PyAPI_FUNC(void *) _PyMem_DebugMalloc(size_t nbytes); PyAPI_FUNC(void *) _PyMem_DebugRealloc(void *p, size_t nbytes); PyAPI_FUNC(void) _PyMem_DebugFree(void *p); #define PyObject_MALLOC _PyObject_DebugMalloc #define PyObject_Malloc _PyObject_DebugMalloc #define PyObject_REALLOC _PyObject_DebugRealloc #define PyObject_Realloc _PyObject_DebugRealloc #define PyObject_FREE _PyObject_DebugFree #define PyObject_Free _PyObject_DebugFree #else /* WITH_PYMALLOC && ! PYMALLOC_DEBUG */ #define PyObject_MALLOC PyObject_Malloc #define PyObject_REALLOC PyObject_Realloc #define PyObject_FREE PyObject_Free #endif #else /* ! WITH_PYMALLOC */ #define PyObject_MALLOC PyMem_MALLOC #define PyObject_REALLOC PyMem_REALLOC #define PyObject_FREE PyMem_FREE #endif /* WITH_PYMALLOC */ #define PyObject_Del PyObject_Free #define PyObject_DEL PyObject_FREE /* for source compatibility with 2.2 */ #define _PyObject_Del PyObject_Free /* * Generic object allocator interface * ================================== */ /* Functions */ PyAPI_FUNC(PyObject *) PyObject_Init(PyObject *, PyTypeObject *); PyAPI_FUNC(PyVarObject *) PyObject_InitVar(PyVarObject *, PyTypeObject *, Py_ssize_t); PyAPI_FUNC(PyObject *) _PyObject_New(PyTypeObject *); PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t); #define PyObject_New(type, typeobj) \ ( (type *) _PyObject_New(typeobj) ) #define PyObject_NewVar(type, typeobj, n) \ ( (type *) _PyObject_NewVar((typeobj), (n)) ) /* Macros trading binary compatibility for speed. See also pymem.h. Note that these macros expect non-NULL object pointers.*/ #define PyObject_INIT(op, typeobj) \ ( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) ) #define PyObject_INIT_VAR(op, typeobj, size) \ ( Py_SIZE(op) = (size), PyObject_INIT((op), (typeobj)) ) #define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize ) /* _PyObject_VAR_SIZE returns the number of bytes (as size_t) allocated for a vrbl-size object with nitems items, exclusive of gc overhead (if any). The value is rounded up to the closest multiple of sizeof(void *), in order to ensure that pointer fields at the end of the object are correctly aligned for the platform (this is of special importance for subclasses of, e.g., str or long, so that pointers can be stored after the embedded data). Note that there's no memory wastage in doing this, as malloc has to return (at worst) pointer-aligned memory anyway. */ #if ((SIZEOF_VOID_P - 1) & SIZEOF_VOID_P) != 0 # error "_PyObject_VAR_SIZE requires SIZEOF_VOID_P be a power of 2" #endif #define _PyObject_VAR_SIZE(typeobj, nitems) \ (size_t) \ ( ( (typeobj)->tp_basicsize + \ (nitems)*(typeobj)->tp_itemsize + \ (SIZEOF_VOID_P - 1) \ ) & ~(SIZEOF_VOID_P - 1) \ ) #define PyObject_NEW(type, typeobj) \ ( (type *) PyObject_Init( \ (PyObject *) PyObject_MALLOC( _PyObject_SIZE(typeobj) ), (typeobj)) ) #define PyObject_NEW_VAR(type, typeobj, n) \ ( (type *) PyObject_InitVar( \ (PyVarObject *) PyObject_MALLOC(_PyObject_VAR_SIZE((typeobj),(n)) ),\ (typeobj), (n)) ) /* This example code implements an object constructor with a custom allocator, where PyObject_New is inlined, and shows the important distinction between two steps (at least): 1) the actual allocation of the object storage; 2) the initialization of the Python specific fields in this storage with PyObject_{Init, InitVar}. PyObject * YourObject_New(...) { PyObject *op; op = (PyObject *) Your_Allocator(_PyObject_SIZE(YourTypeStruct)); if (op == NULL) return PyErr_NoMemory(); PyObject_Init(op, &YourTypeStruct); op->ob_field = value; ... return op; } Note that in C++, the use of the new operator usually implies that the 1st step is performed automatically for you, so in a C++ class constructor you would start directly with PyObject_Init/InitVar */ /* * Garbage Collection Support * ========================== */ /* C equivalent of gc.collect(). */ PyAPI_FUNC(Py_ssize_t) PyGC_Collect(void); /* Test if a type has a GC head */ #define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC) /* Test if an object has a GC head */ #define PyObject_IS_GC(o) (PyType_IS_GC(Py_TYPE(o)) && \ (Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o))) PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t); #define PyObject_GC_Resize(type, op, n) \ ( (type *) _PyObject_GC_Resize((PyVarObject *)(op), (n)) ) /* for source compatibility with 2.2 */ #define _PyObject_GC_Del PyObject_GC_Del /* GC information is stored BEFORE the object structure. */ typedef union _gc_head { struct { union _gc_head *gc_next; union _gc_head *gc_prev; Py_ssize_t gc_refs; } gc; long double dummy; /* force worst-case alignment */ } PyGC_Head; extern PyGC_Head *_PyGC_generation0; #define _Py_AS_GC(o) ((PyGC_Head *)(o)-1) #define _PyGC_REFS_UNTRACKED (-2) #define _PyGC_REFS_REACHABLE (-3) #define _PyGC_REFS_TENTATIVELY_UNREACHABLE (-4) /* Tell the GC to track this object. NB: While the object is tracked the * collector it must be safe to call the ob_traverse method. */ #define _PyObject_GC_TRACK(o) do { \ PyGC_Head *g = _Py_AS_GC(o); \ if (g->gc.gc_refs != _PyGC_REFS_UNTRACKED) \ Py_FatalError("GC object already tracked"); \ g->gc.gc_refs = _PyGC_REFS_REACHABLE; \ g->gc.gc_next = _PyGC_generation0; \ g->gc.gc_prev = _PyGC_generation0->gc.gc_prev; \ g->gc.gc_prev->gc.gc_next = g; \ _PyGC_generation0->gc.gc_prev = g; \ } while (0); /* Tell the GC to stop tracking this object. * gc_next doesn't need to be set to NULL, but doing so is a good * way to provoke memory errors if calling code is confused. */ #define _PyObject_GC_UNTRACK(o) do { \ PyGC_Head *g = _Py_AS_GC(o); \ assert(g->gc.gc_refs != _PyGC_REFS_UNTRACKED); \ g->gc.gc_refs = _PyGC_REFS_UNTRACKED; \ g->gc.gc_prev->gc.gc_next = g->gc.gc_next; \ g->gc.gc_next->gc.gc_prev = g->gc.gc_prev; \ g->gc.gc_next = NULL; \ } while (0); /* True if the object is currently tracked by the GC. */ #define _PyObject_GC_IS_TRACKED(o) \ ((_Py_AS_GC(o))->gc.gc_refs != _PyGC_REFS_UNTRACKED) /* True if the object may be tracked by the GC in the future, or already is. This can be useful to implement some optimizations. */ #define _PyObject_GC_MAY_BE_TRACKED(obj) \ (PyObject_IS_GC(obj) && \ (!PyTuple_CheckExact(obj) || _PyObject_GC_IS_TRACKED(obj))) PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t); PyAPI_FUNC(PyObject *) _PyObject_GC_New(PyTypeObject *); PyAPI_FUNC(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, Py_ssize_t); PyAPI_FUNC(void) PyObject_GC_Track(void *); PyAPI_FUNC(void) PyObject_GC_UnTrack(void *); PyAPI_FUNC(void) PyObject_GC_Del(void *); #define PyObject_GC_New(type, typeobj) \ ( (type *) _PyObject_GC_New(typeobj) ) #define PyObject_GC_NewVar(type, typeobj, n) \ ( (type *) _PyObject_GC_NewVar((typeobj), (n)) ) /* Utility macro to help write tp_traverse functions. * To use this macro, the tp_traverse function must name its arguments * "visit" and "arg". This is intended to keep tp_traverse functions * looking as much alike as possible. */ #define Py_VISIT(op) \ do { \ if (op) { \ int vret = visit((PyObject *)(op), arg); \ if (vret) \ return vret; \ } \ } while (0) /* This is here for the sake of backwards compatibility. Extensions that * use the old GC API will still compile but the objects will not be * tracked by the GC. */ #define PyGC_HEAD_SIZE 0 #define PyObject_GC_Init(op) #define PyObject_GC_Fini(op) #define PyObject_AS_GC(op) (op) #define PyObject_FROM_GC(op) (op) /* Test if a type supports weak references */ #define PyType_SUPPORTS_WEAKREFS(t) \ (PyType_HasFeature((t), Py_TPFLAGS_HAVE_WEAKREFS) \ && ((t)->tp_weaklistoffset > 0)) #define PyObject_GET_WEAKREFS_LISTPTR(o) \ ((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset)) #ifdef __cplusplus } #endif #endif /* !Py_OBJIMPL_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/bytes_methods.h���������������������������������������������������������������������������0000644�����������������00000005364�14763166027�0011362 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_BYTES_CTYPE_H #define Py_BYTES_CTYPE_H /* * The internal implementation behind PyString (bytes) and PyBytes (buffer) * methods of the given names, they operate on ASCII byte strings. */ extern PyObject* _Py_bytes_isspace(const char *cptr, Py_ssize_t len); extern PyObject* _Py_bytes_isalpha(const char *cptr, Py_ssize_t len); extern PyObject* _Py_bytes_isalnum(const char *cptr, Py_ssize_t len); extern PyObject* _Py_bytes_isdigit(const char *cptr, Py_ssize_t len); extern PyObject* _Py_bytes_islower(const char *cptr, Py_ssize_t len); extern PyObject* _Py_bytes_isupper(const char *cptr, Py_ssize_t len); extern PyObject* _Py_bytes_istitle(const char *cptr, Py_ssize_t len); /* These store their len sized answer in the given preallocated *result arg. */ extern void _Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len); extern void _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len); extern void _Py_bytes_title(char *result, char *s, Py_ssize_t len); extern void _Py_bytes_capitalize(char *result, char *s, Py_ssize_t len); extern void _Py_bytes_swapcase(char *result, char *s, Py_ssize_t len); /* Shared __doc__ strings. */ extern const char _Py_isspace__doc__[]; extern const char _Py_isalpha__doc__[]; extern const char _Py_isalnum__doc__[]; extern const char _Py_isdigit__doc__[]; extern const char _Py_islower__doc__[]; extern const char _Py_isupper__doc__[]; extern const char _Py_istitle__doc__[]; extern const char _Py_lower__doc__[]; extern const char _Py_upper__doc__[]; extern const char _Py_title__doc__[]; extern const char _Py_capitalize__doc__[]; extern const char _Py_swapcase__doc__[]; /* These are left in for backward compatibility and will be removed in 2.8/3.2 */ #define ISLOWER(c) Py_ISLOWER(c) #define ISUPPER(c) Py_ISUPPER(c) #define ISALPHA(c) Py_ISALPHA(c) #define ISDIGIT(c) Py_ISDIGIT(c) #define ISXDIGIT(c) Py_ISXDIGIT(c) #define ISALNUM(c) Py_ISALNUM(c) #define ISSPACE(c) Py_ISSPACE(c) #undef islower #define islower(c) undefined_islower(c) #undef isupper #define isupper(c) undefined_isupper(c) #undef isalpha #define isalpha(c) undefined_isalpha(c) #undef isdigit #define isdigit(c) undefined_isdigit(c) #undef isxdigit #define isxdigit(c) undefined_isxdigit(c) #undef isalnum #define isalnum(c) undefined_isalnum(c) #undef isspace #define isspace(c) undefined_isspace(c) /* These are left in for backward compatibility and will be removed in 2.8/3.2 */ #define TOLOWER(c) Py_TOLOWER(c) #define TOUPPER(c) Py_TOUPPER(c) #undef tolower #define tolower(c) undefined_tolower(c) #undef toupper #define toupper(c) undefined_toupper(c) /* this is needed because some docs are shared from the .o, not static */ #define PyDoc_STRVAR_shared(name,str) const char name[] = PyDoc_STR(str) #endif /* !Py_BYTES_CTYPE_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/pymactoolbox.h����������������������������������������������������������������������������0000644�����������������00000017407�14763166027�0011232 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** pymactoolbox.h - globals defined in mactoolboxglue.c */ #ifndef Py_PYMACTOOLBOX_H #define Py_PYMACTOOLBOX_H #ifdef __cplusplus extern "C" { #endif #include <Carbon/Carbon.h> #ifndef __LP64__ #include <QuickTime/QuickTime.h> #endif /* !__LP64__ */ /* ** Helper routines for error codes and such. */ char *PyMac_StrError(int); /* strerror with mac errors */ extern PyObject *PyMac_OSErrException; /* Exception for OSErr */ PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */ PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */ PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */ #ifndef __LP64__ extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert fsspec->path */ #endif /* __LP64__ */ /* ** These conversion routines are defined in mactoolboxglue.c itself. */ int PyMac_GetOSType(PyObject *, OSType *); /* argument parser for OSType */ PyObject *PyMac_BuildOSType(OSType); /* Convert OSType to PyObject */ PyObject *PyMac_BuildNumVersion(NumVersion);/* Convert NumVersion to PyObject */ int PyMac_GetStr255(PyObject *, Str255); /* argument parser for Str255 */ PyObject *PyMac_BuildStr255(Str255); /* Convert Str255 to PyObject */ PyObject *PyMac_BuildOptStr255(Str255); /* Convert Str255 to PyObject, NULL to None */ int PyMac_GetRect(PyObject *, Rect *); /* argument parser for Rect */ PyObject *PyMac_BuildRect(Rect *); /* Convert Rect to PyObject */ int PyMac_GetPoint(PyObject *, Point *); /* argument parser for Point */ PyObject *PyMac_BuildPoint(Point); /* Convert Point to PyObject */ int PyMac_GetEventRecord(PyObject *, EventRecord *); /* argument parser for EventRecord */ PyObject *PyMac_BuildEventRecord(EventRecord *); /* Convert EventRecord to PyObject */ int PyMac_GetFixed(PyObject *, Fixed *); /* argument parser for Fixed */ PyObject *PyMac_BuildFixed(Fixed); /* Convert Fixed to PyObject */ int PyMac_Getwide(PyObject *, wide *); /* argument parser for wide */ PyObject *PyMac_Buildwide(wide *); /* Convert wide to PyObject */ /* ** The rest of the routines are implemented by extension modules. If they are ** dynamically loaded mactoolboxglue will contain a stub implementation of the ** routine, which imports the module, whereupon the module's init routine will ** communicate the routine pointer back to the stub. ** If USE_TOOLBOX_OBJECT_GLUE is not defined there is no glue code, and the ** extension modules simply declare the routine. This is the case for static ** builds (and could be the case for MacPython CFM builds, because CFM extension ** modules can reference each other without problems). */ #ifdef USE_TOOLBOX_OBJECT_GLUE /* ** These macros are used in the module init code. If we use toolbox object glue ** it sets the function pointer to point to the real function. */ #define PyMac_INIT_TOOLBOX_OBJECT_NEW(object, rtn) { \ extern PyObject *(*PyMacGluePtr_##rtn)(object); \ PyMacGluePtr_##rtn = _##rtn; \ } #define PyMac_INIT_TOOLBOX_OBJECT_CONVERT(object, rtn) { \ extern int (*PyMacGluePtr_##rtn)(PyObject *, object *); \ PyMacGluePtr_##rtn = _##rtn; \ } #else /* ** If we don't use toolbox object glue the init macros are empty. Moreover, we define ** _xxx_New to be the same as xxx_New, and the code in mactoolboxglue isn't included. */ #define PyMac_INIT_TOOLBOX_OBJECT_NEW(object, rtn) #define PyMac_INIT_TOOLBOX_OBJECT_CONVERT(object, rtn) #endif /* USE_TOOLBOX_OBJECT_GLUE */ /* macfs exports */ #ifndef __LP64__ int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */ PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */ #endif /* !__LP64__ */ int PyMac_GetFSRef(PyObject *, FSRef *); /* argument parser for FSRef */ PyObject *PyMac_BuildFSRef(FSRef *); /* Convert FSRef to PyObject */ /* AE exports */ extern PyObject *AEDesc_New(AppleEvent *); /* XXXX Why passed by address?? */ extern PyObject *AEDesc_NewBorrowed(AppleEvent *); extern int AEDesc_Convert(PyObject *, AppleEvent *); /* Cm exports */ extern PyObject *CmpObj_New(Component); extern int CmpObj_Convert(PyObject *, Component *); extern PyObject *CmpInstObj_New(ComponentInstance); extern int CmpInstObj_Convert(PyObject *, ComponentInstance *); /* Ctl exports */ #ifndef __LP64__ extern PyObject *CtlObj_New(ControlHandle); extern int CtlObj_Convert(PyObject *, ControlHandle *); #endif /* !__LP64__ */ /* Dlg exports */ #ifndef __LP64__ extern PyObject *DlgObj_New(DialogPtr); extern int DlgObj_Convert(PyObject *, DialogPtr *); extern PyObject *DlgObj_WhichDialog(DialogPtr); #endif /* !__LP64__ */ /* Drag exports */ #ifndef __LP64__ extern PyObject *DragObj_New(DragReference); extern int DragObj_Convert(PyObject *, DragReference *); #endif /* !__LP64__ */ /* List exports */ #ifndef __LP64__ extern PyObject *ListObj_New(ListHandle); extern int ListObj_Convert(PyObject *, ListHandle *); #endif /* !__LP64__ */ /* Menu exports */ #ifndef __LP64__ extern PyObject *MenuObj_New(MenuHandle); extern int MenuObj_Convert(PyObject *, MenuHandle *); #endif /* !__LP64__ */ /* Qd exports */ #ifndef __LP64__ extern PyObject *GrafObj_New(GrafPtr); extern int GrafObj_Convert(PyObject *, GrafPtr *); extern PyObject *BMObj_New(BitMapPtr); extern int BMObj_Convert(PyObject *, BitMapPtr *); extern PyObject *QdRGB_New(RGBColor *); extern int QdRGB_Convert(PyObject *, RGBColor *); #endif /* !__LP64__ */ /* Qdoffs exports */ #ifndef __LP64__ extern PyObject *GWorldObj_New(GWorldPtr); extern int GWorldObj_Convert(PyObject *, GWorldPtr *); #endif /* !__LP64__ */ /* Qt exports */ #ifndef __LP64__ extern PyObject *TrackObj_New(Track); extern int TrackObj_Convert(PyObject *, Track *); extern PyObject *MovieObj_New(Movie); extern int MovieObj_Convert(PyObject *, Movie *); extern PyObject *MovieCtlObj_New(MovieController); extern int MovieCtlObj_Convert(PyObject *, MovieController *); extern PyObject *TimeBaseObj_New(TimeBase); extern int TimeBaseObj_Convert(PyObject *, TimeBase *); extern PyObject *UserDataObj_New(UserData); extern int UserDataObj_Convert(PyObject *, UserData *); extern PyObject *MediaObj_New(Media); extern int MediaObj_Convert(PyObject *, Media *); #endif /* !__LP64__ */ /* Res exports */ extern PyObject *ResObj_New(Handle); extern int ResObj_Convert(PyObject *, Handle *); extern PyObject *OptResObj_New(Handle); extern int OptResObj_Convert(PyObject *, Handle *); /* TE exports */ #ifndef __LP64__ extern PyObject *TEObj_New(TEHandle); extern int TEObj_Convert(PyObject *, TEHandle *); #endif /* !__LP64__ */ /* Win exports */ #ifndef __LP64__ extern PyObject *WinObj_New(WindowPtr); extern int WinObj_Convert(PyObject *, WindowPtr *); extern PyObject *WinObj_WhichWindow(WindowPtr); #endif /* !__LP64__ */ /* CF exports */ extern PyObject *CFObj_New(CFTypeRef); extern int CFObj_Convert(PyObject *, CFTypeRef *); extern PyObject *CFTypeRefObj_New(CFTypeRef); extern int CFTypeRefObj_Convert(PyObject *, CFTypeRef *); extern PyObject *CFStringRefObj_New(CFStringRef); extern int CFStringRefObj_Convert(PyObject *, CFStringRef *); extern PyObject *CFMutableStringRefObj_New(CFMutableStringRef); extern int CFMutableStringRefObj_Convert(PyObject *, CFMutableStringRef *); extern PyObject *CFArrayRefObj_New(CFArrayRef); extern int CFArrayRefObj_Convert(PyObject *, CFArrayRef *); extern PyObject *CFMutableArrayRefObj_New(CFMutableArrayRef); extern int CFMutableArrayRefObj_Convert(PyObject *, CFMutableArrayRef *); extern PyObject *CFDictionaryRefObj_New(CFDictionaryRef); extern int CFDictionaryRefObj_Convert(PyObject *, CFDictionaryRef *); extern PyObject *CFMutableDictionaryRefObj_New(CFMutableDictionaryRef); extern int CFMutableDictionaryRefObj_Convert(PyObject *, CFMutableDictionaryRef *); extern PyObject *CFURLRefObj_New(CFURLRef); extern int CFURLRefObj_Convert(PyObject *, CFURLRef *); extern int OptionalCFURLRefObj_Convert(PyObject *, CFURLRef *); #ifdef __cplusplus } #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/fileobject.h������������������������������������������������������������������������������0000644�����������������00000007116�14763166027�0010614 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* File object interface */ #ifndef Py_FILEOBJECT_H #define Py_FILEOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef struct { PyObject_HEAD FILE *f_fp; PyObject *f_name; PyObject *f_mode; int (*f_close)(FILE *); int f_softspace; /* Flag used by 'print' command */ int f_binary; /* Flag which indicates whether the file is open in binary (1) or text (0) mode */ char* f_buf; /* Allocated readahead buffer */ char* f_bufend; /* Points after last occupied position */ char* f_bufptr; /* Current buffer position */ char *f_setbuf; /* Buffer for setbuf(3) and setvbuf(3) */ int f_univ_newline; /* Handle any newline convention */ int f_newlinetypes; /* Types of newlines seen */ int f_skipnextlf; /* Skip next \n */ PyObject *f_encoding; PyObject *f_errors; PyObject *weakreflist; /* List of weak references */ int unlocked_count; /* Num. currently running sections of code using f_fp with the GIL released. */ int readable; int writable; } PyFileObject; PyAPI_DATA(PyTypeObject) PyFile_Type; #define PyFile_Check(op) PyObject_TypeCheck(op, &PyFile_Type) #define PyFile_CheckExact(op) (Py_TYPE(op) == &PyFile_Type) PyAPI_FUNC(PyObject *) PyFile_FromString(char *, char *); PyAPI_FUNC(void) PyFile_SetBufSize(PyObject *, int); PyAPI_FUNC(int) PyFile_SetEncoding(PyObject *, const char *); PyAPI_FUNC(int) PyFile_SetEncodingAndErrors(PyObject *, const char *, char *errors); PyAPI_FUNC(PyObject *) PyFile_FromFile(FILE *, char *, char *, int (*)(FILE *)); PyAPI_FUNC(FILE *) PyFile_AsFile(PyObject *); PyAPI_FUNC(void) PyFile_IncUseCount(PyFileObject *); PyAPI_FUNC(void) PyFile_DecUseCount(PyFileObject *); PyAPI_FUNC(PyObject *) PyFile_Name(PyObject *); PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int); PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int); PyAPI_FUNC(int) PyFile_SoftSpace(PyObject *, int); PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *); PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *); /* The default encoding used by the platform file system APIs If non-NULL, this is different than the default encoding for strings */ PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding; /* Routines to replace fread() and fgets() which accept any of \r, \n or \r\n as line terminators. */ #define PY_STDIOTEXTMODE "b" char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *); /* A routine to do sanity checking on the file mode string. returns non-zero on if an exception occurred */ int _PyFile_SanitizeMode(char *mode); #if defined _MSC_VER && _MSC_VER >= 1400 /* A routine to check if a file descriptor is valid on Windows. Returns 0 * and sets errno to EBADF if it isn't. This is to avoid Assertions * from various functions in the Windows CRT beginning with * Visual Studio 2005 */ int _PyVerify_fd(int fd); #elif defined _MSC_VER && _MSC_VER >= 1200 /* fdopen doesn't set errno EBADF and crashes for large fd on debug build */ #define _PyVerify_fd(fd) (_get_osfhandle(fd) >= 0) #else #define _PyVerify_fd(A) (1) /* dummy */ #endif /* A routine to check if a file descriptor can be select()-ed. */ #ifdef HAVE_SELECT #define _PyIsSelectable_fd(FD) (((FD) >= 0) && ((FD) < FD_SETSIZE)) #else #define _PyIsSelectable_fd(FD) (1) #endif /* HAVE_SELECT */ #ifdef __cplusplus } #endif #endif /* !Py_FILEOBJECT_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/intobject.h�������������������������������������������������������������������������������0000644�����������������00000005420�14763166027�0010463 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Integer object interface */ /* PyIntObject represents a (long) integer. This is an immutable object; an integer cannot change its value after creation. There are functions to create new integer objects, to test an object for integer-ness, and to get the integer value. The latter functions returns -1 and sets errno to EBADF if the object is not an PyIntObject. None of the functions should be applied to nil objects. The type PyIntObject is (unfortunately) exposed here so we can declare _Py_TrueStruct and _Py_ZeroStruct in boolobject.h; don't use this. */ #ifndef Py_INTOBJECT_H #define Py_INTOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef struct { PyObject_HEAD long ob_ival; } PyIntObject; PyAPI_DATA(PyTypeObject) PyInt_Type; #define PyInt_Check(op) \ PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_INT_SUBCLASS) #define PyInt_CheckExact(op) ((op)->ob_type == &PyInt_Type) PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int); #ifdef Py_USING_UNICODE PyAPI_FUNC(PyObject *) PyInt_FromUnicode(Py_UNICODE*, Py_ssize_t, int); #endif PyAPI_FUNC(PyObject *) PyInt_FromLong(long); PyAPI_FUNC(PyObject *) PyInt_FromSize_t(size_t); PyAPI_FUNC(PyObject *) PyInt_FromSsize_t(Py_ssize_t); PyAPI_FUNC(long) PyInt_AsLong(PyObject *); PyAPI_FUNC(Py_ssize_t) PyInt_AsSsize_t(PyObject *); PyAPI_FUNC(int) _PyInt_AsInt(PyObject *); PyAPI_FUNC(unsigned long) PyInt_AsUnsignedLongMask(PyObject *); #ifdef HAVE_LONG_LONG PyAPI_FUNC(unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *); #endif PyAPI_FUNC(long) PyInt_GetMax(void); /* Macro, trading safety for speed */ #define PyInt_AS_LONG(op) (((PyIntObject *)(op))->ob_ival) /* These aren't really part of the Int object, but they're handy; the protos * are necessary for systems that need the magic of PyAPI_FUNC and that want * to have stropmodule as a dynamically loaded module instead of building it * into the main Python shared library/DLL. Guido thinks I'm weird for * building it this way. :-) [cjh] */ PyAPI_FUNC(unsigned long) PyOS_strtoul(char *, char **, int); PyAPI_FUNC(long) PyOS_strtol(char *, char **, int); /* free list api */ PyAPI_FUNC(int) PyInt_ClearFreeList(void); /* Convert an integer to the given base. Returns a string. If base is 2, 8 or 16, add the proper prefix '0b', '0o' or '0x'. If newstyle is zero, then use the pre-2.6 behavior of octal having a leading "0" */ PyAPI_FUNC(PyObject*) _PyInt_Format(PyIntObject* v, int base, int newstyle); /* Format the object based on the format_spec, as defined in PEP 3101 (Advanced String Formatting). */ PyAPI_FUNC(PyObject *) _PyInt_FormatAdvanced(PyObject *obj, char *format_spec, Py_ssize_t format_spec_len); PyAPI_FUNC(void) _PyInt_DebugMallocStats(FILE *out); #ifdef __cplusplus } #endif #endif /* !Py_INTOBJECT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/cStringIO.h�������������������������������������������������������������������������������0000644�����������������00000003725�14763166027�0010351 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_CSTRINGIO_H #define Py_CSTRINGIO_H #ifdef __cplusplus extern "C" { #endif /* This header provides access to cStringIO objects from C. Functions are provided for calling cStringIO objects and macros are provided for testing whether you have cStringIO objects. Before calling any of the functions or macros, you must initialize the routines with: PycString_IMPORT This would typically be done in your init function. */ #define PycStringIO_CAPSULE_NAME "cStringIO.cStringIO_CAPI" #define PycString_IMPORT \ PycStringIO = ((struct PycStringIO_CAPI*)PyCapsule_Import(\ PycStringIO_CAPSULE_NAME, 0)) /* Basic functions to manipulate cStringIO objects from C */ static struct PycStringIO_CAPI { /* Read a string from an input object. If the last argument is -1, the remainder will be read. */ int(*cread)(PyObject *, char **, Py_ssize_t); /* Read a line from an input object. Returns the length of the read line as an int and a pointer inside the object buffer as char** (so the caller doesn't have to provide its own buffer as destination). */ int(*creadline)(PyObject *, char **); /* Write a string to an output object*/ int(*cwrite)(PyObject *, const char *, Py_ssize_t); /* Get the output object as a Python string (returns new reference). */ PyObject *(*cgetvalue)(PyObject *); /* Create a new output object */ PyObject *(*NewOutput)(int); /* Create an input object from a Python string (copies the Python string reference). */ PyObject *(*NewInput)(PyObject *); /* The Python types for cStringIO input and output objects. Note that you can do input on an output object. */ PyTypeObject *InputType, *OutputType; } *PycStringIO; /* These can be used to test if you have one */ #define PycStringIO_InputCheck(O) \ (Py_TYPE(O)==PycStringIO->InputType) #define PycStringIO_OutputCheck(O) \ (Py_TYPE(O)==PycStringIO->OutputType) #ifdef __cplusplus } #endif #endif /* !Py_CSTRINGIO_H */ �������������������������������������������python2.7/bytesobject.h�����������������������������������������������������������������������������0000644�����������������00000002200�14763166027�0011010 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_CHECK_INTERNED PyString_CHECK_INTERNED #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define Py_TPFLAGS_BYTES_SUBCLASS Py_TPFLAGS_STRING_SUBCLASS #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromString PyString_FromString #define PyBytes_FromFormatV PyString_FromFormatV #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_Size PyString_Size #define PyBytes_AsString PyString_AsString #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #define _PyBytes_Resize _PyString_Resize #define _PyBytes_Eq _PyString_Eq #define PyBytes_Format PyString_Format #define _PyBytes_FormatLong _PyString_FormatLong #define PyBytes_DecodeEscape PyString_DecodeEscape #define _PyBytes_Join _PyString_Join #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define _PyBytes_InsertThousandsGrouping _PyString_InsertThousandsGrouping ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/pyerrors.h��������������������������������������������������������������������������������0000644�����������������00000026611�14763166027�0010374 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_ERRORS_H #define Py_ERRORS_H #ifdef __cplusplus extern "C" { #endif /* Error objects */ typedef struct { PyObject_HEAD PyObject *dict; PyObject *args; PyObject *message; } PyBaseExceptionObject; typedef struct { PyObject_HEAD PyObject *dict; PyObject *args; PyObject *message; PyObject *msg; PyObject *filename; PyObject *lineno; PyObject *offset; PyObject *text; PyObject *print_file_and_line; } PySyntaxErrorObject; #ifdef Py_USING_UNICODE typedef struct { PyObject_HEAD PyObject *dict; PyObject *args; PyObject *message; PyObject *encoding; PyObject *object; Py_ssize_t start; Py_ssize_t end; PyObject *reason; } PyUnicodeErrorObject; #endif typedef struct { PyObject_HEAD PyObject *dict; PyObject *args; PyObject *message; PyObject *code; } PySystemExitObject; typedef struct { PyObject_HEAD PyObject *dict; PyObject *args; PyObject *message; PyObject *myerrno; PyObject *strerror; PyObject *filename; } PyEnvironmentErrorObject; #ifdef MS_WINDOWS typedef struct { PyObject_HEAD PyObject *dict; PyObject *args; PyObject *message; PyObject *myerrno; PyObject *strerror; PyObject *filename; PyObject *winerror; } PyWindowsErrorObject; #endif /* Error handling definitions */ PyAPI_FUNC(void) PyErr_SetNone(PyObject *); PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *); PyAPI_FUNC(void) PyErr_SetString(PyObject *, const char *); PyAPI_FUNC(PyObject *) PyErr_Occurred(void); PyAPI_FUNC(void) PyErr_Clear(void); PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **); PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *); #ifdef Py_DEBUG #define _PyErr_OCCURRED() PyErr_Occurred() #else #define _PyErr_OCCURRED() (_PyThreadState_Current->curexc_type) #endif /* Error testing and normalization */ PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *); PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *); PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**); /* */ #define PyExceptionClass_Check(x) \ (PyClass_Check((x)) || (PyType_Check((x)) && \ PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS))) #define PyExceptionInstance_Check(x) \ (PyInstance_Check((x)) || \ PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS)) #define PyExceptionClass_Name(x) \ (PyClass_Check((x)) \ ? PyString_AS_STRING(((PyClassObject*)(x))->cl_name) \ : (char *)(((PyTypeObject*)(x))->tp_name)) #define PyExceptionInstance_Class(x) \ ((PyInstance_Check((x)) \ ? (PyObject*)((PyInstanceObject*)(x))->in_class \ : (PyObject*)((x)->ob_type))) /* Predefined exceptions */ PyAPI_DATA(PyObject *) PyExc_BaseException; PyAPI_DATA(PyObject *) PyExc_Exception; PyAPI_DATA(PyObject *) PyExc_StopIteration; PyAPI_DATA(PyObject *) PyExc_GeneratorExit; PyAPI_DATA(PyObject *) PyExc_StandardError; PyAPI_DATA(PyObject *) PyExc_ArithmeticError; PyAPI_DATA(PyObject *) PyExc_LookupError; PyAPI_DATA(PyObject *) PyExc_AssertionError; PyAPI_DATA(PyObject *) PyExc_AttributeError; PyAPI_DATA(PyObject *) PyExc_EOFError; PyAPI_DATA(PyObject *) PyExc_FloatingPointError; PyAPI_DATA(PyObject *) PyExc_EnvironmentError; PyAPI_DATA(PyObject *) PyExc_IOError; PyAPI_DATA(PyObject *) PyExc_OSError; PyAPI_DATA(PyObject *) PyExc_ImportError; PyAPI_DATA(PyObject *) PyExc_IndexError; PyAPI_DATA(PyObject *) PyExc_KeyError; PyAPI_DATA(PyObject *) PyExc_KeyboardInterrupt; PyAPI_DATA(PyObject *) PyExc_MemoryError; PyAPI_DATA(PyObject *) PyExc_NameError; PyAPI_DATA(PyObject *) PyExc_OverflowError; PyAPI_DATA(PyObject *) PyExc_RuntimeError; PyAPI_DATA(PyObject *) PyExc_NotImplementedError; PyAPI_DATA(PyObject *) PyExc_SyntaxError; PyAPI_DATA(PyObject *) PyExc_IndentationError; PyAPI_DATA(PyObject *) PyExc_TabError; PyAPI_DATA(PyObject *) PyExc_ReferenceError; PyAPI_DATA(PyObject *) PyExc_SystemError; PyAPI_DATA(PyObject *) PyExc_SystemExit; PyAPI_DATA(PyObject *) PyExc_TypeError; PyAPI_DATA(PyObject *) PyExc_UnboundLocalError; PyAPI_DATA(PyObject *) PyExc_UnicodeError; PyAPI_DATA(PyObject *) PyExc_UnicodeEncodeError; PyAPI_DATA(PyObject *) PyExc_UnicodeDecodeError; PyAPI_DATA(PyObject *) PyExc_UnicodeTranslateError; PyAPI_DATA(PyObject *) PyExc_ValueError; PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError; #ifdef MS_WINDOWS PyAPI_DATA(PyObject *) PyExc_WindowsError; #endif #ifdef __VMS PyAPI_DATA(PyObject *) PyExc_VMSError; #endif PyAPI_DATA(PyObject *) PyExc_BufferError; PyAPI_DATA(PyObject *) PyExc_MemoryErrorInst; PyAPI_DATA(PyObject *) PyExc_RecursionErrorInst; /* Predefined warning categories */ PyAPI_DATA(PyObject *) PyExc_Warning; PyAPI_DATA(PyObject *) PyExc_UserWarning; PyAPI_DATA(PyObject *) PyExc_DeprecationWarning; PyAPI_DATA(PyObject *) PyExc_PendingDeprecationWarning; PyAPI_DATA(PyObject *) PyExc_SyntaxWarning; PyAPI_DATA(PyObject *) PyExc_RuntimeWarning; PyAPI_DATA(PyObject *) PyExc_FutureWarning; PyAPI_DATA(PyObject *) PyExc_ImportWarning; PyAPI_DATA(PyObject *) PyExc_UnicodeWarning; PyAPI_DATA(PyObject *) PyExc_BytesWarning; /* Convenience functions */ PyAPI_FUNC(int) PyErr_BadArgument(void); PyAPI_FUNC(PyObject *) PyErr_NoMemory(void); PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *); PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject( PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename( PyObject *, const char *); #ifdef MS_WINDOWS PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename( PyObject *, const Py_UNICODE *); #endif /* MS_WINDOWS */ PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...) Py_GCC_ATTRIBUTE((format(printf, 2, 3))); #ifdef MS_WINDOWS PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilenameObject( int, const char *); PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename( int, const char *); PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename( int, const Py_UNICODE *); PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int); PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject( PyObject *,int, PyObject *); PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename( PyObject *,int, const char *); PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename( PyObject *,int, const Py_UNICODE *); PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int); #endif /* MS_WINDOWS */ /* Export the old function so that the existing API remains available: */ PyAPI_FUNC(void) PyErr_BadInternalCall(void); PyAPI_FUNC(void) _PyErr_BadInternalCall(char *filename, int lineno); /* Mask the old API with a call to the new API for code compiled under Python 2.0: */ #define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__) /* Function to create a new exception */ PyAPI_FUNC(PyObject *) PyErr_NewException( char *name, PyObject *base, PyObject *dict); PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc( char *name, char *doc, PyObject *base, PyObject *dict); PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *); /* In sigcheck.c or signalmodule.c */ PyAPI_FUNC(int) PyErr_CheckSignals(void); PyAPI_FUNC(void) PyErr_SetInterrupt(void); /* In signalmodule.c */ int PySignal_SetWakeupFd(int fd); /* Support for adding program text to SyntaxErrors */ PyAPI_FUNC(void) PyErr_SyntaxLocation(const char *, int); PyAPI_FUNC(PyObject *) PyErr_ProgramText(const char *, int); #ifdef Py_USING_UNICODE /* The following functions are used to create and modify unicode exceptions from C */ /* create a UnicodeDecodeError object */ PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create( const char *, const char *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *); /* create a UnicodeEncodeError object */ PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create( const char *, const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *); /* create a UnicodeTranslateError object */ PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create( const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *); /* get the encoding attribute */ PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *); PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetEncoding(PyObject *); /* get the object attribute */ PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetObject(PyObject *); PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetObject(PyObject *); PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetObject(PyObject *); /* get the value of the start attribute (the int * may not be NULL) return 0 on success, -1 on failure */ PyAPI_FUNC(int) PyUnicodeEncodeError_GetStart(PyObject *, Py_ssize_t *); PyAPI_FUNC(int) PyUnicodeDecodeError_GetStart(PyObject *, Py_ssize_t *); PyAPI_FUNC(int) PyUnicodeTranslateError_GetStart(PyObject *, Py_ssize_t *); /* assign a new value to the start attribute return 0 on success, -1 on failure */ PyAPI_FUNC(int) PyUnicodeEncodeError_SetStart(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyUnicodeDecodeError_SetStart(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyUnicodeTranslateError_SetStart(PyObject *, Py_ssize_t); /* get the value of the end attribute (the int *may not be NULL) return 0 on success, -1 on failure */ PyAPI_FUNC(int) PyUnicodeEncodeError_GetEnd(PyObject *, Py_ssize_t *); PyAPI_FUNC(int) PyUnicodeDecodeError_GetEnd(PyObject *, Py_ssize_t *); PyAPI_FUNC(int) PyUnicodeTranslateError_GetEnd(PyObject *, Py_ssize_t *); /* assign a new value to the end attribute return 0 on success, -1 on failure */ PyAPI_FUNC(int) PyUnicodeEncodeError_SetEnd(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyUnicodeDecodeError_SetEnd(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyUnicodeTranslateError_SetEnd(PyObject *, Py_ssize_t); /* get the value of the reason attribute */ PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetReason(PyObject *); PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetReason(PyObject *); PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetReason(PyObject *); /* assign a new value to the reason attribute return 0 on success, -1 on failure */ PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason( PyObject *, const char *); PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason( PyObject *, const char *); PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason( PyObject *, const char *); #endif /* These APIs aren't really part of the error implementation, but often needed to format error messages; the native C lib APIs are not available on all platforms, which is why we provide emulations for those platforms in Python/mysnprintf.c, WARNING: The return value of snprintf varies across platforms; do not rely on any particular behavior; eventually the C99 defn may be reliable. */ #if defined(MS_WIN32) && !defined(HAVE_SNPRINTF) # define HAVE_SNPRINTF # define snprintf _snprintf # define vsnprintf _vsnprintf #endif #include <stdarg.h> PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) Py_GCC_ATTRIBUTE((format(printf, 3, 4))); PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) Py_GCC_ATTRIBUTE((format(printf, 3, 0))); #ifdef __cplusplus } #endif #endif /* !Py_ERRORS_H */ �����������������������������������������������������������������������������������������������������������������������python2.7/sliceobject.h�����������������������������������������������������������������������������0000644�����������������00000002463�14763166027�0010774 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_SLICEOBJECT_H #define Py_SLICEOBJECT_H #ifdef __cplusplus extern "C" { #endif /* The unique ellipsis object "..." */ PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */ #define Py_Ellipsis (&_Py_EllipsisObject) /* Slice object interface */ /* A slice object containing start, stop, and step data members (the names are from range). After much talk with Guido, it was decided to let these be any arbitrary python type. Py_None stands for omitted values. */ typedef struct { PyObject_HEAD PyObject *start, *stop, *step; /* not NULL */ } PySliceObject; PyAPI_DATA(PyTypeObject) PySlice_Type; PyAPI_DATA(PyTypeObject) PyEllipsis_Type; #define PySlice_Check(op) (Py_TYPE(op) == &PySlice_Type) PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop, PyObject* step); PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop); PyAPI_FUNC(int) PySlice_GetIndices(PySliceObject *r, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); PyAPI_FUNC(int) PySlice_GetIndicesEx(PySliceObject *r, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength); #ifdef __cplusplus } #endif #endif /* !Py_SLICEOBJECT_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/complexobject.h���������������������������������������������������������������������������0000644�����������������00000003475�14763166027�0011350 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Complex number structure */ #ifndef Py_COMPLEXOBJECT_H #define Py_COMPLEXOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef struct { double real; double imag; } Py_complex; /* Operations on complex numbers from complexmodule.c */ #define c_sum _Py_c_sum #define c_diff _Py_c_diff #define c_neg _Py_c_neg #define c_prod _Py_c_prod #define c_quot _Py_c_quot #define c_pow _Py_c_pow #define c_abs _Py_c_abs PyAPI_FUNC(Py_complex) c_sum(Py_complex, Py_complex); PyAPI_FUNC(Py_complex) c_diff(Py_complex, Py_complex); PyAPI_FUNC(Py_complex) c_neg(Py_complex); PyAPI_FUNC(Py_complex) c_prod(Py_complex, Py_complex); PyAPI_FUNC(Py_complex) c_quot(Py_complex, Py_complex); PyAPI_FUNC(Py_complex) c_pow(Py_complex, Py_complex); PyAPI_FUNC(double) c_abs(Py_complex); /* Complex object interface */ /* PyComplexObject represents a complex number with double-precision real and imaginary parts. */ typedef struct { PyObject_HEAD Py_complex cval; } PyComplexObject; PyAPI_DATA(PyTypeObject) PyComplex_Type; #define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type) #define PyComplex_CheckExact(op) (Py_TYPE(op) == &PyComplex_Type) PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex); PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag); PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op); PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op); PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op); /* Format the object based on the format_spec, as defined in PEP 3101 (Advanced String Formatting). */ PyAPI_FUNC(PyObject *) _PyComplex_FormatAdvanced(PyObject *obj, char *format_spec, Py_ssize_t format_spec_len); #ifdef __cplusplus } #endif #endif /* !Py_COMPLEXOBJECT_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/pystrcmp.h��������������������������������������������������������������������������������0000644�����������������00000000717�14763166027�0010367 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_STRCMP_H #define Py_STRCMP_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(int) PyOS_mystrnicmp(const char *, const char *, Py_ssize_t); PyAPI_FUNC(int) PyOS_mystricmp(const char *, const char *); #if defined(MS_WINDOWS) || defined(PYOS_OS2) #define PyOS_strnicmp strnicmp #define PyOS_stricmp stricmp #else #define PyOS_strnicmp PyOS_mystrnicmp #define PyOS_stricmp PyOS_mystricmp #endif #ifdef __cplusplus } #endif #endif /* !Py_STRCMP_H */ �������������������������������������������������python2.7/modsupport.h������������������������������������������������������������������������������0000644�����������������00000011640�14763166027�0010717 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� #ifndef Py_MODSUPPORT_H #define Py_MODSUPPORT_H #ifdef __cplusplus extern "C" { #endif /* Module support interface */ #include <stdarg.h> /* If PY_SSIZE_T_CLEAN is defined, each functions treats #-specifier to mean Py_ssize_t */ #ifdef PY_SSIZE_T_CLEAN #define PyArg_Parse _PyArg_Parse_SizeT #define PyArg_ParseTuple _PyArg_ParseTuple_SizeT #define PyArg_ParseTupleAndKeywords _PyArg_ParseTupleAndKeywords_SizeT #define PyArg_VaParse _PyArg_VaParse_SizeT #define PyArg_VaParseTupleAndKeywords _PyArg_VaParseTupleAndKeywords_SizeT #define Py_BuildValue _Py_BuildValue_SizeT #define Py_VaBuildValue _Py_VaBuildValue_SizeT #else PyAPI_FUNC(PyObject *) _Py_VaBuildValue_SizeT(const char *, va_list); #endif PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...); PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3); PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *, const char *, char **, ...); PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize_t, ...); PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...); PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...); PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kw); PyAPI_FUNC(int) PyArg_VaParse(PyObject *, const char *, va_list); PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *, const char *, char **, va_list); PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list); PyAPI_FUNC(int) PyModule_AddObject(PyObject *, const char *, PyObject *); PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long); PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *); #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c) #define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant(m, #c, c) #define PYTHON_API_VERSION 1013 #define PYTHON_API_STRING "1013" /* The API version is maintained (independently from the Python version) so we can detect mismatches between the interpreter and dynamically loaded modules. These are diagnosed by an error message but the module is still loaded (because the mismatch can only be tested after loading the module). The error message is intended to explain the core dump a few seconds later. The symbol PYTHON_API_STRING defines the same value as a string literal. *** PLEASE MAKE SURE THE DEFINITIONS MATCH. *** Please add a line or two to the top of this log for each API version change: 22-Feb-2006 MvL 1013 PEP 353 - long indices for sequence lengths 19-Aug-2002 GvR 1012 Changes to string object struct for interning changes, saving 3 bytes. 17-Jul-2001 GvR 1011 Descr-branch, just to be on the safe side 25-Jan-2001 FLD 1010 Parameters added to PyCode_New() and PyFrame_New(); Python 2.1a2 14-Mar-2000 GvR 1009 Unicode API added 3-Jan-1999 GvR 1007 Decided to change back! (Don't reuse 1008!) 3-Dec-1998 GvR 1008 Python 1.5.2b1 18-Jan-1997 GvR 1007 string interning and other speedups 11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-( 30-Jul-1996 GvR Slice and ellipses syntax added 23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-) 7-Nov-1995 GvR Keyword arguments (should've been done at 1.3 :-( ) 10-Jan-1995 GvR Renamed globals to new naming scheme 9-Jan-1995 GvR Initial version (incompatible with older API) */ #ifdef MS_WINDOWS /* Special defines for Windows versions used to live here. Things have changed, and the "Version" is now in a global string variable. Reason for this is that this for easier branding of a "custom DLL" without actually needing a recompile. */ #endif /* MS_WINDOWS */ #if SIZEOF_SIZE_T != SIZEOF_INT /* On a 64-bit system, rename the Py_InitModule4 so that 2.4 modules cannot get loaded into a 2.5 interpreter */ #define Py_InitModule4 Py_InitModule4_64 #endif #ifdef Py_TRACE_REFS /* When we are tracing reference counts, rename Py_InitModule4 so modules compiled with incompatible settings will generate a link-time error. */ #if SIZEOF_SIZE_T != SIZEOF_INT #undef Py_InitModule4 #define Py_InitModule4 Py_InitModule4TraceRefs_64 #else #define Py_InitModule4 Py_InitModule4TraceRefs #endif #endif PyAPI_FUNC(PyObject *) Py_InitModule4(const char *name, PyMethodDef *methods, const char *doc, PyObject *self, int apiver); #define Py_InitModule(name, methods) \ Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \ PYTHON_API_VERSION) #define Py_InitModule3(name, methods, doc) \ Py_InitModule4(name, methods, doc, (PyObject *)NULL, \ PYTHON_API_VERSION) PyAPI_DATA(char *) _Py_PackageContext; #ifdef __cplusplus } #endif #endif /* !Py_MODSUPPORT_H */ ������������������������������������������������������������������������������������������������python2.7/pyconfig.h��������������������������������������������������������������������������������0000644�����������������00000000242�14763166027�0010315 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <bits/wordsize.h> #if __WORDSIZE == 32 #include "pyconfig-32.h" #elif __WORDSIZE == 64 #include "pyconfig-64.h" #else #error "Unknown word size" #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/enumobject.h������������������������������������������������������������������������������0000644�����������������00000000375�14763166027�0010641 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_ENUMOBJECT_H #define Py_ENUMOBJECT_H /* Enumerate Object */ #ifdef __cplusplus extern "C" { #endif PyAPI_DATA(PyTypeObject) PyEnum_Type; PyAPI_DATA(PyTypeObject) PyReversed_Type; #ifdef __cplusplus } #endif #endif /* !Py_ENUMOBJECT_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/funcobject.h������������������������������������������������������������������������������0000644�����������������00000005663�14763166027�0010635 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Function object interface */ #ifndef Py_FUNCOBJECT_H #define Py_FUNCOBJECT_H #ifdef __cplusplus extern "C" { #endif /* Function objects and code objects should not be confused with each other: * * Function objects are created by the execution of the 'def' statement. * They reference a code object in their func_code attribute, which is a * purely syntactic object, i.e. nothing more than a compiled version of some * source code lines. There is one code object per source code "fragment", * but each code object can be referenced by zero or many function objects * depending only on how many times the 'def' statement in the source was * executed so far. */ typedef struct { PyObject_HEAD PyObject *func_code; /* A code object */ PyObject *func_globals; /* A dictionary (other mappings won't do) */ PyObject *func_defaults; /* NULL or a tuple */ PyObject *func_closure; /* NULL or a tuple of cell objects */ PyObject *func_doc; /* The __doc__ attribute, can be anything */ PyObject *func_name; /* The __name__ attribute, a string object */ PyObject *func_dict; /* The __dict__ attribute, a dict or NULL */ PyObject *func_weakreflist; /* List of weak references */ PyObject *func_module; /* The __module__ attribute, can be anything */ /* Invariant: * func_closure contains the bindings for func_code->co_freevars, so * PyTuple_Size(func_closure) == PyCode_GetNumFree(func_code) * (func_closure may be NULL if PyCode_GetNumFree(func_code) == 0). */ } PyFunctionObject; PyAPI_DATA(PyTypeObject) PyFunction_Type; #define PyFunction_Check(op) (Py_TYPE(op) == &PyFunction_Type) PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetGlobals(PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetModule(PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetDefaults(PyObject *); PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetClosure(PyObject *); PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *); /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ #define PyFunction_GET_CODE(func) \ (((PyFunctionObject *)func) -> func_code) #define PyFunction_GET_GLOBALS(func) \ (((PyFunctionObject *)func) -> func_globals) #define PyFunction_GET_MODULE(func) \ (((PyFunctionObject *)func) -> func_module) #define PyFunction_GET_DEFAULTS(func) \ (((PyFunctionObject *)func) -> func_defaults) #define PyFunction_GET_CLOSURE(func) \ (((PyFunctionObject *)func) -> func_closure) /* The classmethod and staticmethod types lives here, too */ PyAPI_DATA(PyTypeObject) PyClassMethod_Type; PyAPI_DATA(PyTypeObject) PyStaticMethod_Type; PyAPI_FUNC(PyObject *) PyClassMethod_New(PyObject *); PyAPI_FUNC(PyObject *) PyStaticMethod_New(PyObject *); #ifdef __cplusplus } #endif #endif /* !Py_FUNCOBJECT_H */ �����������������������������������������������������������������������������python2.7/pyarena.h���������������������������������������������������������������������������������0000644�����������������00000005205�14763166027�0010142 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* An arena-like memory interface for the compiler. */ #ifndef Py_PYARENA_H #define Py_PYARENA_H #ifdef __cplusplus extern "C" { #endif typedef struct _arena PyArena; /* PyArena_New() and PyArena_Free() create a new arena and free it, respectively. Once an arena has been created, it can be used to allocate memory via PyArena_Malloc(). Pointers to PyObject can also be registered with the arena via PyArena_AddPyObject(), and the arena will ensure that the PyObjects stay alive at least until PyArena_Free() is called. When an arena is freed, all the memory it allocated is freed, the arena releases internal references to registered PyObject*, and none of its pointers are valid. XXX (tim) What does "none of its pointers are valid" mean? Does it XXX mean that pointers previously obtained via PyArena_Malloc() are XXX no longer valid? (That's clearly true, but not sure that's what XXX the text is trying to say.) PyArena_New() returns an arena pointer. On error, it returns a negative number and sets an exception. XXX (tim): Not true. On error, PyArena_New() actually returns NULL, XXX and looks like it may or may not set an exception (e.g., if the XXX internal PyList_New(0) returns NULL, PyArena_New() passes that on XXX and an exception is set; OTOH, if the internal XXX block_new(DEFAULT_BLOCK_SIZE) returns NULL, that's passed on but XXX an exception is not set in that case). */ PyAPI_FUNC(PyArena *) PyArena_New(void); PyAPI_FUNC(void) PyArena_Free(PyArena *); /* Mostly like malloc(), return the address of a block of memory spanning * `size` bytes, or return NULL (without setting an exception) if enough * new memory can't be obtained. Unlike malloc(0), PyArena_Malloc() with * size=0 does not guarantee to return a unique pointer (the pointer * returned may equal one or more other pointers obtained from * PyArena_Malloc()). * Note that pointers obtained via PyArena_Malloc() must never be passed to * the system free() or realloc(), or to any of Python's similar memory- * management functions. PyArena_Malloc()-obtained pointers remain valid * until PyArena_Free(ar) is called, at which point all pointers obtained * from the arena `ar` become invalid simultaneously. */ PyAPI_FUNC(void *) PyArena_Malloc(PyArena *, size_t size); /* This routine isn't a proper arena allocation routine. It takes * a PyObject* and records it so that it can be DECREFed when the * arena is freed. */ PyAPI_FUNC(int) PyArena_AddPyObject(PyArena *, PyObject *); #ifdef __cplusplus } #endif #endif /* !Py_PYARENA_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/opcode.h����������������������������������������������������������������������������������0000644�����������������00000011316�14763166027�0007754 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_OPCODE_H #define Py_OPCODE_H #ifdef __cplusplus extern "C" { #endif /* Instruction opcodes for compiled code */ #define STOP_CODE 0 #define POP_TOP 1 #define ROT_TWO 2 #define ROT_THREE 3 #define DUP_TOP 4 #define ROT_FOUR 5 #define NOP 9 #define UNARY_POSITIVE 10 #define UNARY_NEGATIVE 11 #define UNARY_NOT 12 #define UNARY_CONVERT 13 #define UNARY_INVERT 15 #define BINARY_POWER 19 #define BINARY_MULTIPLY 20 #define BINARY_DIVIDE 21 #define BINARY_MODULO 22 #define BINARY_ADD 23 #define BINARY_SUBTRACT 24 #define BINARY_SUBSCR 25 #define BINARY_FLOOR_DIVIDE 26 #define BINARY_TRUE_DIVIDE 27 #define INPLACE_FLOOR_DIVIDE 28 #define INPLACE_TRUE_DIVIDE 29 #define SLICE 30 /* Also uses 31-33 */ #define SLICE_1 31 #define SLICE_2 32 #define SLICE_3 33 #define STORE_SLICE 40 /* Also uses 41-43 */ #define STORE_SLICE_1 41 #define STORE_SLICE_2 42 #define STORE_SLICE_3 43 #define DELETE_SLICE 50 /* Also uses 51-53 */ #define DELETE_SLICE_1 51 #define DELETE_SLICE_2 52 #define DELETE_SLICE_3 53 #define STORE_MAP 54 #define INPLACE_ADD 55 #define INPLACE_SUBTRACT 56 #define INPLACE_MULTIPLY 57 #define INPLACE_DIVIDE 58 #define INPLACE_MODULO 59 #define STORE_SUBSCR 60 #define DELETE_SUBSCR 61 #define BINARY_LSHIFT 62 #define BINARY_RSHIFT 63 #define BINARY_AND 64 #define BINARY_XOR 65 #define BINARY_OR 66 #define INPLACE_POWER 67 #define GET_ITER 68 #define PRINT_EXPR 70 #define PRINT_ITEM 71 #define PRINT_NEWLINE 72 #define PRINT_ITEM_TO 73 #define PRINT_NEWLINE_TO 74 #define INPLACE_LSHIFT 75 #define INPLACE_RSHIFT 76 #define INPLACE_AND 77 #define INPLACE_XOR 78 #define INPLACE_OR 79 #define BREAK_LOOP 80 #define WITH_CLEANUP 81 #define LOAD_LOCALS 82 #define RETURN_VALUE 83 #define IMPORT_STAR 84 #define EXEC_STMT 85 #define YIELD_VALUE 86 #define POP_BLOCK 87 #define END_FINALLY 88 #define BUILD_CLASS 89 #define HAVE_ARGUMENT 90 /* Opcodes from here have an argument: */ #define STORE_NAME 90 /* Index in name list */ #define DELETE_NAME 91 /* "" */ #define UNPACK_SEQUENCE 92 /* Number of sequence items */ #define FOR_ITER 93 #define LIST_APPEND 94 #define STORE_ATTR 95 /* Index in name list */ #define DELETE_ATTR 96 /* "" */ #define STORE_GLOBAL 97 /* "" */ #define DELETE_GLOBAL 98 /* "" */ #define DUP_TOPX 99 /* number of items to duplicate */ #define LOAD_CONST 100 /* Index in const list */ #define LOAD_NAME 101 /* Index in name list */ #define BUILD_TUPLE 102 /* Number of tuple items */ #define BUILD_LIST 103 /* Number of list items */ #define BUILD_SET 104 /* Number of set items */ #define BUILD_MAP 105 /* Always zero for now */ #define LOAD_ATTR 106 /* Index in name list */ #define COMPARE_OP 107 /* Comparison operator */ #define IMPORT_NAME 108 /* Index in name list */ #define IMPORT_FROM 109 /* Index in name list */ #define JUMP_FORWARD 110 /* Number of bytes to skip */ #define JUMP_IF_FALSE_OR_POP 111 /* Target byte offset from beginning of code */ #define JUMP_IF_TRUE_OR_POP 112 /* "" */ #define JUMP_ABSOLUTE 113 /* "" */ #define POP_JUMP_IF_FALSE 114 /* "" */ #define POP_JUMP_IF_TRUE 115 /* "" */ #define LOAD_GLOBAL 116 /* Index in name list */ #define CONTINUE_LOOP 119 /* Start of loop (absolute) */ #define SETUP_LOOP 120 /* Target address (relative) */ #define SETUP_EXCEPT 121 /* "" */ #define SETUP_FINALLY 122 /* "" */ #define LOAD_FAST 124 /* Local variable number */ #define STORE_FAST 125 /* Local variable number */ #define DELETE_FAST 126 /* Local variable number */ #define RAISE_VARARGS 130 /* Number of raise arguments (1, 2 or 3) */ /* CALL_FUNCTION_XXX opcodes defined below depend on this definition */ #define CALL_FUNCTION 131 /* #args + (#kwargs<<8) */ #define MAKE_FUNCTION 132 /* #defaults */ #define BUILD_SLICE 133 /* Number of items */ #define MAKE_CLOSURE 134 /* #free vars */ #define LOAD_CLOSURE 135 /* Load free variable from closure */ #define LOAD_DEREF 136 /* Load and dereference from closure cell */ #define STORE_DEREF 137 /* Store into cell */ /* The next 3 opcodes must be contiguous and satisfy (CALL_FUNCTION_VAR - CALL_FUNCTION) & 3 == 1 */ #define CALL_FUNCTION_VAR 140 /* #args + (#kwargs<<8) */ #define CALL_FUNCTION_KW 141 /* #args + (#kwargs<<8) */ #define CALL_FUNCTION_VAR_KW 142 /* #args + (#kwargs<<8) */ #define SETUP_WITH 143 /* Support for opargs more than 16 bits long */ #define EXTENDED_ARG 145 #define SET_ADD 146 #define MAP_ADD 147 enum cmp_op {PyCmp_LT=Py_LT, PyCmp_LE=Py_LE, PyCmp_EQ=Py_EQ, PyCmp_NE=Py_NE, PyCmp_GT=Py_GT, PyCmp_GE=Py_GE, PyCmp_IN, PyCmp_NOT_IN, PyCmp_IS, PyCmp_IS_NOT, PyCmp_EXC_MATCH, PyCmp_BAD}; #define HAS_ARG(op) ((op) >= HAVE_ARGUMENT) #ifdef __cplusplus } #endif #endif /* !Py_OPCODE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/pyport.h����������������������������������������������������������������������������������0000644�����������������00000076656�14763166027�0010062 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_PYPORT_H #define Py_PYPORT_H #include "pyconfig.h" /* include for defines */ /* Some versions of HP-UX & Solaris need inttypes.h for int32_t, INT32_MAX, etc. */ #ifdef HAVE_INTTYPES_H #include <inttypes.h> #endif #ifdef HAVE_STDINT_H #include <stdint.h> #endif /************************************************************************** Symbols and macros to supply platform-independent interfaces to basic C language & library operations whose spellings vary across platforms. Please try to make documentation here as clear as possible: by definition, the stuff here is trying to illuminate C's darkest corners. Config #defines referenced here: SIGNED_RIGHT_SHIFT_ZERO_FILLS Meaning: To be defined iff i>>j does not extend the sign bit when i is a signed integral type and i < 0. Used in: Py_ARITHMETIC_RIGHT_SHIFT Py_DEBUG Meaning: Extra checks compiled in for debug mode. Used in: Py_SAFE_DOWNCAST HAVE_UINTPTR_T Meaning: The C9X type uintptr_t is supported by the compiler Used in: Py_uintptr_t HAVE_LONG_LONG Meaning: The compiler supports the C type "long long" Used in: PY_LONG_LONG **************************************************************************/ /* For backward compatibility only. Obsolete, do not use. */ #ifdef HAVE_PROTOTYPES #define Py_PROTO(x) x #else #define Py_PROTO(x) () #endif #ifndef Py_FPROTO #define Py_FPROTO(x) Py_PROTO(x) #endif /* typedefs for some C9X-defined synonyms for integral types. * * The names in Python are exactly the same as the C9X names, except with a * Py_ prefix. Until C9X is universally implemented, this is the only way * to ensure that Python gets reliable names that don't conflict with names * in non-Python code that are playing their own tricks to define the C9X * names. * * NOTE: don't go nuts here! Python has no use for *most* of the C9X * integral synonyms. Only define the ones we actually need. */ #ifdef HAVE_LONG_LONG #ifndef PY_LONG_LONG #define PY_LONG_LONG long long #if defined(LLONG_MAX) /* If LLONG_MAX is defined in limits.h, use that. */ #define PY_LLONG_MIN LLONG_MIN #define PY_LLONG_MAX LLONG_MAX #define PY_ULLONG_MAX ULLONG_MAX #elif defined(__LONG_LONG_MAX__) /* Otherwise, if GCC has a builtin define, use that. */ #define PY_LLONG_MAX __LONG_LONG_MAX__ #define PY_LLONG_MIN (-PY_LLONG_MAX-1) #define PY_ULLONG_MAX (__LONG_LONG_MAX__*2ULL + 1ULL) #else /* Otherwise, rely on two's complement. */ #define PY_ULLONG_MAX (~0ULL) #define PY_LLONG_MAX ((long long)(PY_ULLONG_MAX>>1)) #define PY_LLONG_MIN (-PY_LLONG_MAX-1) #endif /* LLONG_MAX */ #endif #endif /* HAVE_LONG_LONG */ /* a build with 30-bit digits for Python long integers needs an exact-width * 32-bit unsigned integer type to store those digits. (We could just use * type 'unsigned long', but that would be wasteful on a system where longs * are 64-bits.) On Unix systems, the autoconf macro AC_TYPE_UINT32_T defines * uint32_t to be such a type unless stdint.h or inttypes.h defines uint32_t. * However, it doesn't set HAVE_UINT32_T, so we do that here. */ #ifdef uint32_t #define HAVE_UINT32_T 1 #endif #ifdef HAVE_UINT32_T #ifndef PY_UINT32_T #define PY_UINT32_T uint32_t #endif #endif /* Macros for a 64-bit unsigned integer type; used for type 'twodigits' in the * long integer implementation, when 30-bit digits are enabled. */ #ifdef uint64_t #define HAVE_UINT64_T 1 #endif #ifdef HAVE_UINT64_T #ifndef PY_UINT64_T #define PY_UINT64_T uint64_t #endif #endif /* Signed variants of the above */ #ifdef int32_t #define HAVE_INT32_T 1 #endif #ifdef HAVE_INT32_T #ifndef PY_INT32_T #define PY_INT32_T int32_t #endif #endif #ifdef int64_t #define HAVE_INT64_T 1 #endif #ifdef HAVE_INT64_T #ifndef PY_INT64_T #define PY_INT64_T int64_t #endif #endif /* If PYLONG_BITS_IN_DIGIT is not defined then we'll use 30-bit digits if all the necessary integer types are available, and we're on a 64-bit platform (as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits. */ #ifndef PYLONG_BITS_IN_DIGIT #if (defined HAVE_UINT64_T && defined HAVE_INT64_T && \ defined HAVE_UINT32_T && defined HAVE_INT32_T && SIZEOF_VOID_P >= 8) #define PYLONG_BITS_IN_DIGIT 30 #else #define PYLONG_BITS_IN_DIGIT 15 #endif #endif /* uintptr_t is the C9X name for an unsigned integral type such that a * legitimate void* can be cast to uintptr_t and then back to void* again * without loss of information. Similarly for intptr_t, wrt a signed * integral type. */ #ifdef HAVE_UINTPTR_T typedef uintptr_t Py_uintptr_t; typedef intptr_t Py_intptr_t; #elif SIZEOF_VOID_P <= SIZEOF_INT typedef unsigned int Py_uintptr_t; typedef int Py_intptr_t; #elif SIZEOF_VOID_P <= SIZEOF_LONG typedef unsigned long Py_uintptr_t; typedef long Py_intptr_t; #elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG) typedef unsigned PY_LONG_LONG Py_uintptr_t; typedef PY_LONG_LONG Py_intptr_t; #else # error "Python needs a typedef for Py_uintptr_t in pyport.h." #endif /* HAVE_UINTPTR_T */ /* Py_ssize_t is a signed integral type such that sizeof(Py_ssize_t) == * sizeof(size_t). C99 doesn't define such a thing directly (size_t is an * unsigned integral type). See PEP 353 for details. */ #ifdef HAVE_SSIZE_T typedef ssize_t Py_ssize_t; #elif SIZEOF_VOID_P == SIZEOF_SIZE_T typedef Py_intptr_t Py_ssize_t; #else # error "Python needs a typedef for Py_ssize_t in pyport.h." #endif /* Largest possible value of size_t. SIZE_MAX is part of C99, so it might be defined on some platforms. If it is not defined, (size_t)-1 is a portable definition for C89, due to the way signed->unsigned conversion is defined. */ #ifdef SIZE_MAX #define PY_SIZE_MAX SIZE_MAX #else #define PY_SIZE_MAX ((size_t)-1) #endif /* Largest positive value of type Py_ssize_t. */ #define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1)) /* Smallest negative value of type Py_ssize_t. */ #define PY_SSIZE_T_MIN (-PY_SSIZE_T_MAX-1) #if SIZEOF_PID_T > SIZEOF_LONG # error "Python doesn't support sizeof(pid_t) > sizeof(long)" #endif /* PY_FORMAT_SIZE_T is a platform-specific modifier for use in a printf * format to convert an argument with the width of a size_t or Py_ssize_t. * C99 introduced "z" for this purpose, but not all platforms support that; * e.g., MS compilers use "I" instead. * * These "high level" Python format functions interpret "z" correctly on * all platforms (Python interprets the format string itself, and does whatever * the platform C requires to convert a size_t/Py_ssize_t argument): * * PyString_FromFormat * PyErr_Format * PyString_FromFormatV * * Lower-level uses require that you interpolate the correct format modifier * yourself (e.g., calling printf, fprintf, sprintf, PyOS_snprintf); for * example, * * Py_ssize_t index; * fprintf(stderr, "index %" PY_FORMAT_SIZE_T "d sucks\n", index); * * That will expand to %ld, or %Id, or to something else correct for a * Py_ssize_t on the platform. */ #ifndef PY_FORMAT_SIZE_T # if SIZEOF_SIZE_T == SIZEOF_INT && !defined(__APPLE__) # define PY_FORMAT_SIZE_T "" # elif SIZEOF_SIZE_T == SIZEOF_LONG # define PY_FORMAT_SIZE_T "l" # elif defined(MS_WINDOWS) # define PY_FORMAT_SIZE_T "I" # else # error "This platform's pyconfig.h needs to define PY_FORMAT_SIZE_T" # endif #endif /* PY_FORMAT_LONG_LONG is analogous to PY_FORMAT_SIZE_T above, but for * the long long type instead of the size_t type. It's only available * when HAVE_LONG_LONG is defined. The "high level" Python format * functions listed above will interpret "lld" or "llu" correctly on * all platforms. */ #ifdef HAVE_LONG_LONG # ifndef PY_FORMAT_LONG_LONG # if defined(MS_WIN64) || defined(MS_WINDOWS) # define PY_FORMAT_LONG_LONG "I64" # else # error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG" # endif # endif #endif /* Py_LOCAL can be used instead of static to get the fastest possible calling * convention for functions that are local to a given module. * * Py_LOCAL_INLINE does the same thing, and also explicitly requests inlining, * for platforms that support that. * * If PY_LOCAL_AGGRESSIVE is defined before python.h is included, more * "aggressive" inlining/optimizaion is enabled for the entire module. This * may lead to code bloat, and may slow things down for those reasons. It may * also lead to errors, if the code relies on pointer aliasing. Use with * care. * * NOTE: You can only use this for functions that are entirely local to a * module; functions that are exported via method tables, callbacks, etc, * should keep using static. */ #undef USE_INLINE /* XXX - set via configure? */ #if defined(_MSC_VER) #if defined(PY_LOCAL_AGGRESSIVE) /* enable more aggressive optimization for visual studio */ #pragma optimize("agtw", on) #endif /* ignore warnings if the compiler decides not to inline a function */ #pragma warning(disable: 4710) /* fastest possible local call under MSVC */ #define Py_LOCAL(type) static type __fastcall #define Py_LOCAL_INLINE(type) static __inline type __fastcall #elif defined(USE_INLINE) #define Py_LOCAL(type) static type #define Py_LOCAL_INLINE(type) static inline type #else #define Py_LOCAL(type) static type #define Py_LOCAL_INLINE(type) static type #endif /* Py_MEMCPY can be used instead of memcpy in cases where the copied blocks * are often very short. While most platforms have highly optimized code for * large transfers, the setup costs for memcpy are often quite high. MEMCPY * solves this by doing short copies "in line". */ #if defined(_MSC_VER) #define Py_MEMCPY(target, source, length) do { \ size_t i_, n_ = (length); \ char *t_ = (void*) (target); \ const char *s_ = (void*) (source); \ if (n_ >= 16) \ memcpy(t_, s_, n_); \ else \ for (i_ = 0; i_ < n_; i_++) \ t_[i_] = s_[i_]; \ } while (0) #else #define Py_MEMCPY memcpy #endif #include <stdlib.h> #ifdef HAVE_IEEEFP_H #include <ieeefp.h> /* needed for 'finite' declaration on some platforms */ #endif #include <math.h> /* Moved here from the math section, before extern "C" */ /******************************************** * WRAPPER FOR <time.h> and/or <sys/time.h> * ********************************************/ #ifdef TIME_WITH_SYS_TIME #include <sys/time.h> #include <time.h> #else /* !TIME_WITH_SYS_TIME */ #ifdef HAVE_SYS_TIME_H #include <sys/time.h> #else /* !HAVE_SYS_TIME_H */ #include <time.h> #endif /* !HAVE_SYS_TIME_H */ #endif /* !TIME_WITH_SYS_TIME */ /****************************** * WRAPPER FOR <sys/select.h> * ******************************/ /* NB caller must include <sys/types.h> */ #ifdef HAVE_SYS_SELECT_H #include <sys/select.h> #endif /* !HAVE_SYS_SELECT_H */ /******************************* * stat() and fstat() fiddling * *******************************/ /* We expect that stat and fstat exist on most systems. * It's confirmed on Unix, Mac and Windows. * If you don't have them, add * #define DONT_HAVE_STAT * and/or * #define DONT_HAVE_FSTAT * to your pyconfig.h. Python code beyond this should check HAVE_STAT and * HAVE_FSTAT instead. * Also * #define HAVE_SYS_STAT_H * if <sys/stat.h> exists on your platform, and * #define HAVE_STAT_H * if <stat.h> does. */ #ifndef DONT_HAVE_STAT #define HAVE_STAT #endif #ifndef DONT_HAVE_FSTAT #define HAVE_FSTAT #endif #ifdef RISCOS #include <sys/types.h> #include "unixstuff.h" #endif #ifdef HAVE_SYS_STAT_H #if defined(PYOS_OS2) && defined(PYCC_GCC) #include <sys/types.h> #endif #include <sys/stat.h> #elif defined(HAVE_STAT_H) #include <stat.h> #endif #if defined(PYCC_VACPP) /* VisualAge C/C++ Failed to Define MountType Field in sys/stat.h */ #define S_IFMT (S_IFDIR|S_IFCHR|S_IFREG) #endif #ifndef S_ISREG #define S_ISREG(x) (((x) & S_IFMT) == S_IFREG) #endif #ifndef S_ISDIR #define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR) #endif #ifdef __cplusplus /* Move this down here since some C++ #include's don't like to be included inside an extern "C" */ extern "C" { #endif /* Py_ARITHMETIC_RIGHT_SHIFT * C doesn't define whether a right-shift of a signed integer sign-extends * or zero-fills. Here a macro to force sign extension: * Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) * Return I >> J, forcing sign extension. Arithmetically, return the * floor of I/2**J. * Requirements: * I should have signed integer type. In the terminology of C99, this can * be either one of the five standard signed integer types (signed char, * short, int, long, long long) or an extended signed integer type. * J is an integer >= 0 and strictly less than the number of bits in the * type of I (because C doesn't define what happens for J outside that * range either). * TYPE used to specify the type of I, but is now ignored. It's been left * in for backwards compatibility with versions <= 2.6 or 3.0. * Caution: * I may be evaluated more than once. */ #ifdef SIGNED_RIGHT_SHIFT_ZERO_FILLS #define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) \ ((I) < 0 ? -1-((-1-(I)) >> (J)) : (I) >> (J)) #else #define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) ((I) >> (J)) #endif /* Py_FORCE_EXPANSION(X) * "Simply" returns its argument. However, macro expansions within the * argument are evaluated. This unfortunate trickery is needed to get * token-pasting to work as desired in some cases. */ #define Py_FORCE_EXPANSION(X) X /* Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) * Cast VALUE to type NARROW from type WIDE. In Py_DEBUG mode, this * assert-fails if any information is lost. * Caution: * VALUE may be evaluated more than once. */ #ifdef Py_DEBUG #define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) \ (assert((WIDE)(NARROW)(VALUE) == (VALUE)), (NARROW)(VALUE)) #else #define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) (NARROW)(VALUE) #endif /* Py_SET_ERRNO_ON_MATH_ERROR(x) * If a libm function did not set errno, but it looks like the result * overflowed or not-a-number, set errno to ERANGE or EDOM. Set errno * to 0 before calling a libm function, and invoke this macro after, * passing the function result. * Caution: * This isn't reliable. See Py_OVERFLOWED comments. * X is evaluated more than once. */ #if defined(__FreeBSD__) || defined(__OpenBSD__) || (defined(__hpux) && defined(__ia64)) #define _Py_SET_EDOM_FOR_NAN(X) if (isnan(X)) errno = EDOM; #else #define _Py_SET_EDOM_FOR_NAN(X) ; #endif #define Py_SET_ERRNO_ON_MATH_ERROR(X) \ do { \ if (errno == 0) { \ if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ errno = ERANGE; \ else _Py_SET_EDOM_FOR_NAN(X) \ } \ } while(0) /* Py_SET_ERANGE_ON_OVERFLOW(x) * An alias of Py_SET_ERRNO_ON_MATH_ERROR for backward-compatibility. */ #define Py_SET_ERANGE_IF_OVERFLOW(X) Py_SET_ERRNO_ON_MATH_ERROR(X) /* Py_ADJUST_ERANGE1(x) * Py_ADJUST_ERANGE2(x, y) * Set errno to 0 before calling a libm function, and invoke one of these * macros after, passing the function result(s) (Py_ADJUST_ERANGE2 is useful * for functions returning complex results). This makes two kinds of * adjustments to errno: (A) If it looks like the platform libm set * errno=ERANGE due to underflow, clear errno. (B) If it looks like the * platform libm overflowed but didn't set errno, force errno to ERANGE. In * effect, we're trying to force a useful implementation of C89 errno * behavior. * Caution: * This isn't reliable. See Py_OVERFLOWED comments. * X and Y may be evaluated more than once. */ #define Py_ADJUST_ERANGE1(X) \ do { \ if (errno == 0) { \ if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ errno = ERANGE; \ } \ else if (errno == ERANGE && (X) == 0.0) \ errno = 0; \ } while(0) #define Py_ADJUST_ERANGE2(X, Y) \ do { \ if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL || \ (Y) == Py_HUGE_VAL || (Y) == -Py_HUGE_VAL) { \ if (errno == 0) \ errno = ERANGE; \ } \ else if (errno == ERANGE) \ errno = 0; \ } while(0) /* The functions _Py_dg_strtod and _Py_dg_dtoa in Python/dtoa.c (which are * required to support the short float repr introduced in Python 3.1) require * that the floating-point unit that's being used for arithmetic operations * on C doubles is set to use 53-bit precision. It also requires that the * FPU rounding mode is round-half-to-even, but that's less often an issue. * * If your FPU isn't already set to 53-bit precision/round-half-to-even, and * you want to make use of _Py_dg_strtod and _Py_dg_dtoa, then you should * * #define HAVE_PY_SET_53BIT_PRECISION 1 * * and also give appropriate definitions for the following three macros: * * _PY_SET_53BIT_PRECISION_START : store original FPU settings, and * set FPU to 53-bit precision/round-half-to-even * _PY_SET_53BIT_PRECISION_END : restore original FPU settings * _PY_SET_53BIT_PRECISION_HEADER : any variable declarations needed to * use the two macros above. * * The macros are designed to be used within a single C function: see * Python/pystrtod.c for an example of their use. */ /* get and set x87 control word for gcc/x86 */ #ifdef HAVE_GCC_ASM_FOR_X87 #define HAVE_PY_SET_53BIT_PRECISION 1 /* _Py_get/set_387controlword functions are defined in Python/pymath.c */ #define _Py_SET_53BIT_PRECISION_HEADER \ unsigned short old_387controlword, new_387controlword #define _Py_SET_53BIT_PRECISION_START \ do { \ old_387controlword = _Py_get_387controlword(); \ new_387controlword = (old_387controlword & ~0x0f00) | 0x0200; \ if (new_387controlword != old_387controlword) \ _Py_set_387controlword(new_387controlword); \ } while (0) #define _Py_SET_53BIT_PRECISION_END \ if (new_387controlword != old_387controlword) \ _Py_set_387controlword(old_387controlword) #endif /* get and set x87 control word for VisualStudio/x86 */ #if defined(_MSC_VER) && !defined(_WIN64) /* x87 not supported in 64-bit */ #define HAVE_PY_SET_53BIT_PRECISION 1 #define _Py_SET_53BIT_PRECISION_HEADER \ unsigned int old_387controlword, new_387controlword, out_387controlword /* We use the __control87_2 function to set only the x87 control word. The SSE control word is unaffected. */ #define _Py_SET_53BIT_PRECISION_START \ do { \ __control87_2(0, 0, &old_387controlword, NULL); \ new_387controlword = \ (old_387controlword & ~(_MCW_PC | _MCW_RC)) | (_PC_53 | _RC_NEAR); \ if (new_387controlword != old_387controlword) \ __control87_2(new_387controlword, _MCW_PC | _MCW_RC, \ &out_387controlword, NULL); \ } while (0) #define _Py_SET_53BIT_PRECISION_END \ do { \ if (new_387controlword != old_387controlword) \ __control87_2(old_387controlword, _MCW_PC | _MCW_RC, \ &out_387controlword, NULL); \ } while (0) #endif /* default definitions are empty */ #ifndef HAVE_PY_SET_53BIT_PRECISION #define _Py_SET_53BIT_PRECISION_HEADER #define _Py_SET_53BIT_PRECISION_START #define _Py_SET_53BIT_PRECISION_END #endif /* If we can't guarantee 53-bit precision, don't use the code in Python/dtoa.c, but fall back to standard code. This means that repr of a float will be long (17 sig digits). Realistically, there are two things that could go wrong: (1) doubles aren't IEEE 754 doubles, or (2) we're on x86 with the rounding precision set to 64-bits (extended precision), and we don't know how to change the rounding precision. */ #if !defined(DOUBLE_IS_LITTLE_ENDIAN_IEEE754) && \ !defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) && \ !defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754) #define PY_NO_SHORT_FLOAT_REPR #endif /* double rounding is symptomatic of use of extended precision on x86. If we're seeing double rounding, and we don't have any mechanism available for changing the FPU rounding precision, then don't use Python/dtoa.c. */ #if defined(X87_DOUBLE_ROUNDING) && !defined(HAVE_PY_SET_53BIT_PRECISION) #define PY_NO_SHORT_FLOAT_REPR #endif /* Py_DEPRECATED(version) * Declare a variable, type, or function deprecated. * Usage: * extern int old_var Py_DEPRECATED(2.3); * typedef int T1 Py_DEPRECATED(2.4); * extern int x() Py_DEPRECATED(2.5); */ #if defined(__GNUC__) && ((__GNUC__ >= 4) || \ (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)) #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__)) #else #define Py_DEPRECATED(VERSION_UNUSED) #endif /************************************************************************** Prototypes that are missing from the standard include files on some systems (and possibly only some versions of such systems.) Please be conservative with adding new ones, document them and enclose them in platform-specific #ifdefs. **************************************************************************/ #ifdef SOLARIS /* Unchecked */ extern int gethostname(char *, int); #endif #ifdef __BEOS__ /* Unchecked */ /* It's in the libs, but not the headers... - [cjh] */ int shutdown( int, int ); #endif #ifdef HAVE__GETPTY #include <sys/types.h> /* we need to import mode_t */ extern char * _getpty(int *, int, mode_t, int); #endif /* On QNX 6, struct termio must be declared by including sys/termio.h if TCGETA, TCSETA, TCSETAW, or TCSETAF are used. sys/termio.h must be included before termios.h or it will generate an error. */ #if defined(HAVE_SYS_TERMIO_H) && !defined(__hpux) #include <sys/termio.h> #endif #if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) #if !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) && !defined(HAVE_UTIL_H) /* BSDI does not supply a prototype for the 'openpty' and 'forkpty' functions, even though they are included in libutil. */ #include <termios.h> extern int openpty(int *, int *, char *, struct termios *, struct winsize *); extern pid_t forkpty(int *, char *, struct termios *, struct winsize *); #endif /* !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) */ #endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) */ /* These are pulled from various places. It isn't obvious on what platforms they are necessary, nor what the exact prototype should look like (which is likely to vary between platforms!) If you find you need one of these declarations, please move them to a platform-specific block and include proper prototypes. */ #if 0 /* From Modules/resource.c */ extern int getrusage(); extern int getpagesize(); /* From Python/sysmodule.c and Modules/posixmodule.c */ extern int fclose(FILE *); /* From Modules/posixmodule.c */ extern int fdatasync(int); #endif /* 0 */ /* On 4.4BSD-descendants, ctype functions serves the whole range of * wchar_t character set rather than single byte code points only. * This characteristic can break some operations of string object * including str.upper() and str.split() on UTF-8 locales. This * workaround was provided by Tim Robbins of FreeBSD project. */ #ifdef __FreeBSD__ #include <osreldate.h> #if __FreeBSD_version > 500039 # define _PY_PORT_CTYPE_UTF8_ISSUE #endif #endif #if defined(__APPLE__) # define _PY_PORT_CTYPE_UTF8_ISSUE #endif #ifdef _PY_PORT_CTYPE_UTF8_ISSUE #include <ctype.h> #include <wctype.h> #undef isalnum #define isalnum(c) iswalnum(btowc(c)) #undef isalpha #define isalpha(c) iswalpha(btowc(c)) #undef islower #define islower(c) iswlower(btowc(c)) #undef isspace #define isspace(c) iswspace(btowc(c)) #undef isupper #define isupper(c) iswupper(btowc(c)) #undef tolower #define tolower(c) towlower(btowc(c)) #undef toupper #define toupper(c) towupper(btowc(c)) #endif /* Declarations for symbol visibility. PyAPI_FUNC(type): Declares a public Python API function and return type PyAPI_DATA(type): Declares public Python data and its type PyMODINIT_FUNC: A Python module init function. If these functions are inside the Python core, they are private to the core. If in an extension module, it may be declared with external linkage depending on the platform. As a number of platforms support/require "__declspec(dllimport/dllexport)", we support a HAVE_DECLSPEC_DLL macro to save duplication. */ /* All windows ports, except cygwin, are handled in PC/pyconfig.h. BeOS and cygwin are the only other autoconf platform requiring special linkage handling and both of these use __declspec(). */ #if defined(__CYGWIN__) || defined(__BEOS__) # define HAVE_DECLSPEC_DLL #endif /* only get special linkage if built as shared or platform is Cygwin */ #if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__) # if defined(HAVE_DECLSPEC_DLL) # ifdef Py_BUILD_CORE # define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE # define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE /* module init functions inside the core need no external linkage */ /* except for Cygwin to handle embedding (FIXME: BeOS too?) */ # if defined(__CYGWIN__) # define PyMODINIT_FUNC __declspec(dllexport) void # else /* __CYGWIN__ */ # define PyMODINIT_FUNC void # endif /* __CYGWIN__ */ # else /* Py_BUILD_CORE */ /* Building an extension module, or an embedded situation */ /* public Python functions and data are imported */ /* Under Cygwin, auto-import functions to prevent compilation */ /* failures similar to those described at the bottom of 4.1: */ /* http://docs.python.org/extending/windows.html#a-cookbook-approach */ # if !defined(__CYGWIN__) # define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE # endif /* !__CYGWIN__ */ # define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE /* module init functions outside the core must be exported */ # if defined(__cplusplus) # define PyMODINIT_FUNC extern "C" __declspec(dllexport) void # else /* __cplusplus */ # define PyMODINIT_FUNC __declspec(dllexport) void # endif /* __cplusplus */ # endif /* Py_BUILD_CORE */ # endif /* HAVE_DECLSPEC */ #endif /* Py_ENABLE_SHARED */ /* If no external linkage macros defined by now, create defaults */ #ifndef PyAPI_FUNC # define PyAPI_FUNC(RTYPE) RTYPE #endif #ifndef PyAPI_DATA # define PyAPI_DATA(RTYPE) extern RTYPE #endif #ifndef PyMODINIT_FUNC # if defined(__cplusplus) # define PyMODINIT_FUNC extern "C" void # else /* __cplusplus */ # define PyMODINIT_FUNC void # endif /* __cplusplus */ #endif /* Deprecated DL_IMPORT and DL_EXPORT macros */ #if defined(Py_ENABLE_SHARED) && defined (HAVE_DECLSPEC_DLL) # if defined(Py_BUILD_CORE) # define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE # define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE # else # define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE # define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE # endif #endif #ifndef DL_EXPORT # define DL_EXPORT(RTYPE) RTYPE #endif #ifndef DL_IMPORT # define DL_IMPORT(RTYPE) RTYPE #endif /* End of deprecated DL_* macros */ /* If the fd manipulation macros aren't defined, here is a set that should do the job */ #if 0 /* disabled and probably obsolete */ #ifndef FD_SETSIZE #define FD_SETSIZE 256 #endif #ifndef FD_SET typedef long fd_mask; #define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ #ifndef howmany #define howmany(x, y) (((x)+((y)-1))/(y)) #endif /* howmany */ typedef struct fd_set { fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; } fd_set; #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) #define FD_ZERO(p) memset((char *)(p), '\0', sizeof(*(p))) #endif /* FD_SET */ #endif /* fd manipulation macros */ /* limits.h constants that may be missing */ #ifndef INT_MAX #define INT_MAX 2147483647 #endif #ifndef LONG_MAX #if SIZEOF_LONG == 4 #define LONG_MAX 0X7FFFFFFFL #elif SIZEOF_LONG == 8 #define LONG_MAX 0X7FFFFFFFFFFFFFFFL #else #error "could not set LONG_MAX in pyport.h" #endif #endif #ifndef LONG_MIN #define LONG_MIN (-LONG_MAX-1) #endif #ifndef LONG_BIT #define LONG_BIT (8 * SIZEOF_LONG) #endif #if LONG_BIT != 8 * SIZEOF_LONG /* 04-Oct-2000 LONG_BIT is apparently (mis)defined as 64 on some recent * 32-bit platforms using gcc. We try to catch that here at compile-time * rather than waiting for integer multiplication to trigger bogus * overflows. */ #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)." #endif #ifdef __cplusplus } #endif /* * Hide GCC attributes from compilers that don't support them. */ #if (!defined(__GNUC__) || __GNUC__ < 2 || \ (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ) && \ !defined(RISCOS) #define Py_GCC_ATTRIBUTE(x) #else #define Py_GCC_ATTRIBUTE(x) __attribute__(x) #endif /* * Add PyArg_ParseTuple format where available. */ #ifdef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE #define Py_FORMAT_PARSETUPLE(func,p1,p2) __attribute__((format(func,p1,p2))) #else #define Py_FORMAT_PARSETUPLE(func,p1,p2) #endif /* * Specify alignment on compilers that support it. */ #if defined(__GNUC__) && __GNUC__ >= 3 #define Py_ALIGNED(x) __attribute__((aligned(x))) #else #define Py_ALIGNED(x) #endif /* Eliminate end-of-loop code not reached warnings from SunPro C * when using do{...}while(0) macros */ #ifdef __SUNPRO_C #pragma error_messages (off,E_END_OF_LOOP_CODE_NOT_REACHED) #endif /* * Older Microsoft compilers don't support the C99 long long literal suffixes, * so these will be defined in PC/pyconfig.h for those compilers. */ #ifndef Py_LL #define Py_LL(x) x##LL #endif #ifndef Py_ULL #define Py_ULL(x) Py_LL(x##U) #endif #endif /* Py_PYPORT_H */ ����������������������������������������������������������������������������������python2.7/weakrefobject.h���������������������������������������������������������������������������0000644�����������������00000005622�14763166027�0011321 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Weak references objects for Python. */ #ifndef Py_WEAKREFOBJECT_H #define Py_WEAKREFOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef struct _PyWeakReference PyWeakReference; /* PyWeakReference is the base struct for the Python ReferenceType, ProxyType, * and CallableProxyType. */ struct _PyWeakReference { PyObject_HEAD /* The object to which this is a weak reference, or Py_None if none. * Note that this is a stealth reference: wr_object's refcount is * not incremented to reflect this pointer. */ PyObject *wr_object; /* A callable to invoke when wr_object dies, or NULL if none. */ PyObject *wr_callback; /* A cache for wr_object's hash code. As usual for hashes, this is -1 * if the hash code isn't known yet. */ long hash; /* If wr_object is weakly referenced, wr_object has a doubly-linked NULL- * terminated list of weak references to it. These are the list pointers. * If wr_object goes away, wr_object is set to Py_None, and these pointers * have no meaning then. */ PyWeakReference *wr_prev; PyWeakReference *wr_next; }; PyAPI_DATA(PyTypeObject) _PyWeakref_RefType; PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType; PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType; #define PyWeakref_CheckRef(op) PyObject_TypeCheck(op, &_PyWeakref_RefType) #define PyWeakref_CheckRefExact(op) \ (Py_TYPE(op) == &_PyWeakref_RefType) #define PyWeakref_CheckProxy(op) \ ((Py_TYPE(op) == &_PyWeakref_ProxyType) || \ (Py_TYPE(op) == &_PyWeakref_CallableProxyType)) /* This macro calls PyWeakref_CheckRef() last since that can involve a function call; this makes it more likely that the function call will be avoided. */ #define PyWeakref_Check(op) \ (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op)) PyAPI_FUNC(PyObject *) PyWeakref_NewRef(PyObject *ob, PyObject *callback); PyAPI_FUNC(PyObject *) PyWeakref_NewProxy(PyObject *ob, PyObject *callback); PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref); PyAPI_FUNC(Py_ssize_t) _PyWeakref_GetWeakrefCount(PyWeakReference *head); PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self); /* Explanation for the Py_REFCNT() check: when a weakref's target is part of a long chain of deallocations which triggers the trashcan mechanism, clearing the weakrefs can be delayed long after the target's refcount has dropped to zero. In the meantime, code accessing the weakref will be able to "see" the target object even though it is supposed to be unreachable. See issue #16602. */ #define PyWeakref_GET_OBJECT(ref) \ (Py_REFCNT(((PyWeakReference *)(ref))->wr_object) > 0 \ ? ((PyWeakReference *)(ref))->wr_object \ : Py_None) #ifdef __cplusplus } #endif #endif /* !Py_WEAKREFOBJECT_H */ ��������������������������������������������������������������������������������������������������������������python2.7/Python-ast.h������������������������������������������������������������������������������0000644�����������������00000051171�14763166027�0010554 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* File automatically generated by Parser/asdl_c.py. */ #include "asdl.h" typedef struct _mod *mod_ty; typedef struct _stmt *stmt_ty; typedef struct _expr *expr_ty; typedef enum _expr_context { Load=1, Store=2, Del=3, AugLoad=4, AugStore=5, Param=6 } expr_context_ty; typedef struct _slice *slice_ty; typedef enum _boolop { And=1, Or=2 } boolop_ty; typedef enum _operator { Add=1, Sub=2, Mult=3, Div=4, Mod=5, Pow=6, LShift=7, RShift=8, BitOr=9, BitXor=10, BitAnd=11, FloorDiv=12 } operator_ty; typedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty; typedef enum _cmpop { Eq=1, NotEq=2, Lt=3, LtE=4, Gt=5, GtE=6, Is=7, IsNot=8, In=9, NotIn=10 } cmpop_ty; typedef struct _comprehension *comprehension_ty; typedef struct _excepthandler *excepthandler_ty; typedef struct _arguments *arguments_ty; typedef struct _keyword *keyword_ty; typedef struct _alias *alias_ty; enum _mod_kind {Module_kind=1, Interactive_kind=2, Expression_kind=3, Suite_kind=4}; struct _mod { enum _mod_kind kind; union { struct { asdl_seq *body; } Module; struct { asdl_seq *body; } Interactive; struct { expr_ty body; } Expression; struct { asdl_seq *body; } Suite; } v; }; enum _stmt_kind {FunctionDef_kind=1, ClassDef_kind=2, Return_kind=3, Delete_kind=4, Assign_kind=5, AugAssign_kind=6, Print_kind=7, For_kind=8, While_kind=9, If_kind=10, With_kind=11, Raise_kind=12, TryExcept_kind=13, TryFinally_kind=14, Assert_kind=15, Import_kind=16, ImportFrom_kind=17, Exec_kind=18, Global_kind=19, Expr_kind=20, Pass_kind=21, Break_kind=22, Continue_kind=23}; struct _stmt { enum _stmt_kind kind; union { struct { identifier name; arguments_ty args; asdl_seq *body; asdl_seq *decorator_list; } FunctionDef; struct { identifier name; asdl_seq *bases; asdl_seq *body; asdl_seq *decorator_list; } ClassDef; struct { expr_ty value; } Return; struct { asdl_seq *targets; } Delete; struct { asdl_seq *targets; expr_ty value; } Assign; struct { expr_ty target; operator_ty op; expr_ty value; } AugAssign; struct { expr_ty dest; asdl_seq *values; bool nl; } Print; struct { expr_ty target; expr_ty iter; asdl_seq *body; asdl_seq *orelse; } For; struct { expr_ty test; asdl_seq *body; asdl_seq *orelse; } While; struct { expr_ty test; asdl_seq *body; asdl_seq *orelse; } If; struct { expr_ty context_expr; expr_ty optional_vars; asdl_seq *body; } With; struct { expr_ty type; expr_ty inst; expr_ty tback; } Raise; struct { asdl_seq *body; asdl_seq *handlers; asdl_seq *orelse; } TryExcept; struct { asdl_seq *body; asdl_seq *finalbody; } TryFinally; struct { expr_ty test; expr_ty msg; } Assert; struct { asdl_seq *names; } Import; struct { identifier module; asdl_seq *names; int level; } ImportFrom; struct { expr_ty body; expr_ty globals; expr_ty locals; } Exec; struct { asdl_seq *names; } Global; struct { expr_ty value; } Expr; } v; int lineno; int col_offset; }; enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4, IfExp_kind=5, Dict_kind=6, Set_kind=7, ListComp_kind=8, SetComp_kind=9, DictComp_kind=10, GeneratorExp_kind=11, Yield_kind=12, Compare_kind=13, Call_kind=14, Repr_kind=15, Num_kind=16, Str_kind=17, Attribute_kind=18, Subscript_kind=19, Name_kind=20, List_kind=21, Tuple_kind=22}; struct _expr { enum _expr_kind kind; union { struct { boolop_ty op; asdl_seq *values; } BoolOp; struct { expr_ty left; operator_ty op; expr_ty right; } BinOp; struct { unaryop_ty op; expr_ty operand; } UnaryOp; struct { arguments_ty args; expr_ty body; } Lambda; struct { expr_ty test; expr_ty body; expr_ty orelse; } IfExp; struct { asdl_seq *keys; asdl_seq *values; } Dict; struct { asdl_seq *elts; } Set; struct { expr_ty elt; asdl_seq *generators; } ListComp; struct { expr_ty elt; asdl_seq *generators; } SetComp; struct { expr_ty key; expr_ty value; asdl_seq *generators; } DictComp; struct { expr_ty elt; asdl_seq *generators; } GeneratorExp; struct { expr_ty value; } Yield; struct { expr_ty left; asdl_int_seq *ops; asdl_seq *comparators; } Compare; struct { expr_ty func; asdl_seq *args; asdl_seq *keywords; expr_ty starargs; expr_ty kwargs; } Call; struct { expr_ty value; } Repr; struct { object n; } Num; struct { string s; } Str; struct { expr_ty value; identifier attr; expr_context_ty ctx; } Attribute; struct { expr_ty value; slice_ty slice; expr_context_ty ctx; } Subscript; struct { identifier id; expr_context_ty ctx; } Name; struct { asdl_seq *elts; expr_context_ty ctx; } List; struct { asdl_seq *elts; expr_context_ty ctx; } Tuple; } v; int lineno; int col_offset; }; enum _slice_kind {Ellipsis_kind=1, Slice_kind=2, ExtSlice_kind=3, Index_kind=4}; struct _slice { enum _slice_kind kind; union { struct { expr_ty lower; expr_ty upper; expr_ty step; } Slice; struct { asdl_seq *dims; } ExtSlice; struct { expr_ty value; } Index; } v; }; struct _comprehension { expr_ty target; expr_ty iter; asdl_seq *ifs; }; enum _excepthandler_kind {ExceptHandler_kind=1}; struct _excepthandler { enum _excepthandler_kind kind; union { struct { expr_ty type; expr_ty name; asdl_seq *body; } ExceptHandler; } v; int lineno; int col_offset; }; struct _arguments { asdl_seq *args; identifier vararg; identifier kwarg; asdl_seq *defaults; }; struct _keyword { identifier arg; expr_ty value; }; struct _alias { identifier name; identifier asname; }; #define Module(a0, a1) _Py_Module(a0, a1) mod_ty _Py_Module(asdl_seq * body, PyArena *arena); #define Interactive(a0, a1) _Py_Interactive(a0, a1) mod_ty _Py_Interactive(asdl_seq * body, PyArena *arena); #define Expression(a0, a1) _Py_Expression(a0, a1) mod_ty _Py_Expression(expr_ty body, PyArena *arena); #define Suite(a0, a1) _Py_Suite(a0, a1) mod_ty _Py_Suite(asdl_seq * body, PyArena *arena); #define FunctionDef(a0, a1, a2, a3, a4, a5, a6) _Py_FunctionDef(a0, a1, a2, a3, a4, a5, a6) stmt_ty _Py_FunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq * decorator_list, int lineno, int col_offset, PyArena *arena); #define ClassDef(a0, a1, a2, a3, a4, a5, a6) _Py_ClassDef(a0, a1, a2, a3, a4, a5, a6) stmt_ty _Py_ClassDef(identifier name, asdl_seq * bases, asdl_seq * body, asdl_seq * decorator_list, int lineno, int col_offset, PyArena *arena); #define Return(a0, a1, a2, a3) _Py_Return(a0, a1, a2, a3) stmt_ty _Py_Return(expr_ty value, int lineno, int col_offset, PyArena *arena); #define Delete(a0, a1, a2, a3) _Py_Delete(a0, a1, a2, a3) stmt_ty _Py_Delete(asdl_seq * targets, int lineno, int col_offset, PyArena *arena); #define Assign(a0, a1, a2, a3, a4) _Py_Assign(a0, a1, a2, a3, a4) stmt_ty _Py_Assign(asdl_seq * targets, expr_ty value, int lineno, int col_offset, PyArena *arena); #define AugAssign(a0, a1, a2, a3, a4, a5) _Py_AugAssign(a0, a1, a2, a3, a4, a5) stmt_ty _Py_AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int col_offset, PyArena *arena); #define Print(a0, a1, a2, a3, a4, a5) _Py_Print(a0, a1, a2, a3, a4, a5) stmt_ty _Py_Print(expr_ty dest, asdl_seq * values, bool nl, int lineno, int col_offset, PyArena *arena); #define For(a0, a1, a2, a3, a4, a5, a6) _Py_For(a0, a1, a2, a3, a4, a5, a6) stmt_ty _Py_For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, int lineno, int col_offset, PyArena *arena); #define While(a0, a1, a2, a3, a4, a5) _Py_While(a0, a1, a2, a3, a4, a5) stmt_ty _Py_While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int col_offset, PyArena *arena); #define If(a0, a1, a2, a3, a4, a5) _Py_If(a0, a1, a2, a3, a4, a5) stmt_ty _Py_If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int col_offset, PyArena *arena); #define With(a0, a1, a2, a3, a4, a5) _Py_With(a0, a1, a2, a3, a4, a5) stmt_ty _Py_With(expr_ty context_expr, expr_ty optional_vars, asdl_seq * body, int lineno, int col_offset, PyArena *arena); #define Raise(a0, a1, a2, a3, a4, a5) _Py_Raise(a0, a1, a2, a3, a4, a5) stmt_ty _Py_Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, int col_offset, PyArena *arena); #define TryExcept(a0, a1, a2, a3, a4, a5) _Py_TryExcept(a0, a1, a2, a3, a4, a5) stmt_ty _Py_TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, int lineno, int col_offset, PyArena *arena); #define TryFinally(a0, a1, a2, a3, a4) _Py_TryFinally(a0, a1, a2, a3, a4) stmt_ty _Py_TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int col_offset, PyArena *arena); #define Assert(a0, a1, a2, a3, a4) _Py_Assert(a0, a1, a2, a3, a4) stmt_ty _Py_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, PyArena *arena); #define Import(a0, a1, a2, a3) _Py_Import(a0, a1, a2, a3) stmt_ty _Py_Import(asdl_seq * names, int lineno, int col_offset, PyArena *arena); #define ImportFrom(a0, a1, a2, a3, a4, a5) _Py_ImportFrom(a0, a1, a2, a3, a4, a5) stmt_ty _Py_ImportFrom(identifier module, asdl_seq * names, int level, int lineno, int col_offset, PyArena *arena); #define Exec(a0, a1, a2, a3, a4, a5) _Py_Exec(a0, a1, a2, a3, a4, a5) stmt_ty _Py_Exec(expr_ty body, expr_ty globals, expr_ty locals, int lineno, int col_offset, PyArena *arena); #define Global(a0, a1, a2, a3) _Py_Global(a0, a1, a2, a3) stmt_ty _Py_Global(asdl_seq * names, int lineno, int col_offset, PyArena *arena); #define Expr(a0, a1, a2, a3) _Py_Expr(a0, a1, a2, a3) stmt_ty _Py_Expr(expr_ty value, int lineno, int col_offset, PyArena *arena); #define Pass(a0, a1, a2) _Py_Pass(a0, a1, a2) stmt_ty _Py_Pass(int lineno, int col_offset, PyArena *arena); #define Break(a0, a1, a2) _Py_Break(a0, a1, a2) stmt_ty _Py_Break(int lineno, int col_offset, PyArena *arena); #define Continue(a0, a1, a2) _Py_Continue(a0, a1, a2) stmt_ty _Py_Continue(int lineno, int col_offset, PyArena *arena); #define BoolOp(a0, a1, a2, a3, a4) _Py_BoolOp(a0, a1, a2, a3, a4) expr_ty _Py_BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, PyArena *arena); #define BinOp(a0, a1, a2, a3, a4, a5) _Py_BinOp(a0, a1, a2, a3, a4, a5) expr_ty _Py_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int col_offset, PyArena *arena); #define UnaryOp(a0, a1, a2, a3, a4) _Py_UnaryOp(a0, a1, a2, a3, a4) expr_ty _Py_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, PyArena *arena); #define Lambda(a0, a1, a2, a3, a4) _Py_Lambda(a0, a1, a2, a3, a4) expr_ty _Py_Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, PyArena *arena); #define IfExp(a0, a1, a2, a3, a4, a5) _Py_IfExp(a0, a1, a2, a3, a4, a5) expr_ty _Py_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int col_offset, PyArena *arena); #define Dict(a0, a1, a2, a3, a4) _Py_Dict(a0, a1, a2, a3, a4) expr_ty _Py_Dict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, PyArena *arena); #define Set(a0, a1, a2, a3) _Py_Set(a0, a1, a2, a3) expr_ty _Py_Set(asdl_seq * elts, int lineno, int col_offset, PyArena *arena); #define ListComp(a0, a1, a2, a3, a4) _Py_ListComp(a0, a1, a2, a3, a4) expr_ty _Py_ListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena *arena); #define SetComp(a0, a1, a2, a3, a4) _Py_SetComp(a0, a1, a2, a3, a4) expr_ty _Py_SetComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena *arena); #define DictComp(a0, a1, a2, a3, a4, a5) _Py_DictComp(a0, a1, a2, a3, a4, a5) expr_ty _Py_DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int lineno, int col_offset, PyArena *arena); #define GeneratorExp(a0, a1, a2, a3, a4) _Py_GeneratorExp(a0, a1, a2, a3, a4) expr_ty _Py_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena *arena); #define Yield(a0, a1, a2, a3) _Py_Yield(a0, a1, a2, a3) expr_ty _Py_Yield(expr_ty value, int lineno, int col_offset, PyArena *arena); #define Compare(a0, a1, a2, a3, a4, a5) _Py_Compare(a0, a1, a2, a3, a4, a5) expr_ty _Py_Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int lineno, int col_offset, PyArena *arena); #define Call(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Call(a0, a1, a2, a3, a4, a5, a6, a7) expr_ty _Py_Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty starargs, expr_ty kwargs, int lineno, int col_offset, PyArena *arena); #define Repr(a0, a1, a2, a3) _Py_Repr(a0, a1, a2, a3) expr_ty _Py_Repr(expr_ty value, int lineno, int col_offset, PyArena *arena); #define Num(a0, a1, a2, a3) _Py_Num(a0, a1, a2, a3) expr_ty _Py_Num(object n, int lineno, int col_offset, PyArena *arena); #define Str(a0, a1, a2, a3) _Py_Str(a0, a1, a2, a3) expr_ty _Py_Str(string s, int lineno, int col_offset, PyArena *arena); #define Attribute(a0, a1, a2, a3, a4, a5) _Py_Attribute(a0, a1, a2, a3, a4, a5) expr_ty _Py_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena); #define Subscript(a0, a1, a2, a3, a4, a5) _Py_Subscript(a0, a1, a2, a3, a4, a5) expr_ty _Py_Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena); #define Name(a0, a1, a2, a3, a4) _Py_Name(a0, a1, a2, a3, a4) expr_ty _Py_Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena); #define List(a0, a1, a2, a3, a4) _Py_List(a0, a1, a2, a3, a4) expr_ty _Py_List(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena); #define Tuple(a0, a1, a2, a3, a4) _Py_Tuple(a0, a1, a2, a3, a4) expr_ty _Py_Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena); #define Ellipsis(a0) _Py_Ellipsis(a0) slice_ty _Py_Ellipsis(PyArena *arena); #define Slice(a0, a1, a2, a3) _Py_Slice(a0, a1, a2, a3) slice_ty _Py_Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena); #define ExtSlice(a0, a1) _Py_ExtSlice(a0, a1) slice_ty _Py_ExtSlice(asdl_seq * dims, PyArena *arena); #define Index(a0, a1) _Py_Index(a0, a1) slice_ty _Py_Index(expr_ty value, PyArena *arena); #define comprehension(a0, a1, a2, a3) _Py_comprehension(a0, a1, a2, a3) comprehension_ty _Py_comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs, PyArena *arena); #define ExceptHandler(a0, a1, a2, a3, a4, a5) _Py_ExceptHandler(a0, a1, a2, a3, a4, a5) excepthandler_ty _Py_ExceptHandler(expr_ty type, expr_ty name, asdl_seq * body, int lineno, int col_offset, PyArena *arena); #define arguments(a0, a1, a2, a3, a4) _Py_arguments(a0, a1, a2, a3, a4) arguments_ty _Py_arguments(asdl_seq * args, identifier vararg, identifier kwarg, asdl_seq * defaults, PyArena *arena); #define keyword(a0, a1, a2) _Py_keyword(a0, a1, a2) keyword_ty _Py_keyword(identifier arg, expr_ty value, PyArena *arena); #define alias(a0, a1, a2) _Py_alias(a0, a1, a2) alias_ty _Py_alias(identifier name, identifier asname, PyArena *arena); PyObject* PyAST_mod2obj(mod_ty t); mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode); int PyAST_Check(PyObject* obj); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/abstract.h��������������������������������������������������������������������������������0000644�����������������00000127727�14763166027�0010324 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_ABSTRACTOBJECT_H #define Py_ABSTRACTOBJECT_H #ifdef __cplusplus extern "C" { #endif #ifdef PY_SSIZE_T_CLEAN #define PyObject_CallFunction _PyObject_CallFunction_SizeT #define PyObject_CallMethod _PyObject_CallMethod_SizeT #endif /* Abstract Object Interface (many thanks to Jim Fulton) */ /* PROPOSAL: A Generic Python Object Interface for Python C Modules Problem Python modules written in C that must access Python objects must do so through routines whose interfaces are described by a set of include files. Unfortunately, these routines vary according to the object accessed. To use these routines, the C programmer must check the type of the object being used and must call a routine based on the object type. For example, to access an element of a sequence, the programmer must determine whether the sequence is a list or a tuple: if(is_tupleobject(o)) e=gettupleitem(o,i) else if(is_listitem(o)) e=getlistitem(o,i) If the programmer wants to get an item from another type of object that provides sequence behavior, there is no clear way to do it correctly. The persistent programmer may peruse object.h and find that the _typeobject structure provides a means of invoking up to (currently about) 41 special operators. So, for example, a routine can get an item from any object that provides sequence behavior. However, to use this mechanism, the programmer must make their code dependent on the current Python implementation. Also, certain semantics, especially memory management semantics, may differ by the type of object being used. Unfortunately, these semantics are not clearly described in the current include files. An abstract interface providing more consistent semantics is needed. Proposal I propose the creation of a standard interface (with an associated library of routines and/or macros) for generically obtaining the services of Python objects. This proposal can be viewed as one components of a Python C interface consisting of several components. From the viewpoint of C access to Python services, we have (as suggested by Guido in off-line discussions): - "Very high level layer": two or three functions that let you exec or eval arbitrary Python code given as a string in a module whose name is given, passing C values in and getting C values out using mkvalue/getargs style format strings. This does not require the user to declare any variables of type "PyObject *". This should be enough to write a simple application that gets Python code from the user, execs it, and returns the output or errors. (Error handling must also be part of this API.) - "Abstract objects layer": which is the subject of this proposal. It has many functions operating on objects, and lest you do many things from C that you can also write in Python, without going through the Python parser. - "Concrete objects layer": This is the public type-dependent interface provided by the standard built-in types, such as floats, strings, and lists. This interface exists and is currently documented by the collection of include files provided with the Python distributions. From the point of view of Python accessing services provided by C modules: - "Python module interface": this interface consist of the basic routines used to define modules and their members. Most of the current extensions-writing guide deals with this interface. - "Built-in object interface": this is the interface that a new built-in type must provide and the mechanisms and rules that a developer of a new built-in type must use and follow. This proposal is a "first-cut" that is intended to spur discussion. See especially the lists of notes. The Python C object interface will provide four protocols: object, numeric, sequence, and mapping. Each protocol consists of a collection of related operations. If an operation that is not provided by a particular type is invoked, then a standard exception, NotImplementedError is raised with a operation name as an argument. In addition, for convenience this interface defines a set of constructors for building objects of built-in types. This is needed so new objects can be returned from C functions that otherwise treat objects generically. Memory Management For all of the functions described in this proposal, if a function retains a reference to a Python object passed as an argument, then the function will increase the reference count of the object. It is unnecessary for the caller to increase the reference count of an argument in anticipation of the object's retention. All Python objects returned from functions should be treated as new objects. Functions that return objects assume that the caller will retain a reference and the reference count of the object has already been incremented to account for this fact. A caller that does not retain a reference to an object that is returned from a function must decrement the reference count of the object (using DECREF(object)) to prevent memory leaks. Note that the behavior mentioned here is different from the current behavior for some objects (e.g. lists and tuples) when certain type-specific routines are called directly (e.g. setlistitem). The proposed abstraction layer will provide a consistent memory management interface, correcting for inconsistent behavior for some built-in types. Protocols xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ /* Object Protocol: */ /* Implemented elsewhere: int PyObject_Print(PyObject *o, FILE *fp, int flags); Print an object, o, on file, fp. Returns -1 on error. The flags argument is used to enable certain printing options. The only option currently supported is Py_Print_RAW. (What should be said about Py_Print_RAW?) */ /* Implemented elsewhere: int PyObject_HasAttrString(PyObject *o, char *attr_name); Returns 1 if o has the attribute attr_name, and 0 otherwise. This is equivalent to the Python expression: hasattr(o,attr_name). This function always succeeds. */ /* Implemented elsewhere: PyObject* PyObject_GetAttrString(PyObject *o, char *attr_name); Retrieve an attributed named attr_name form object o. Returns the attribute value on success, or NULL on failure. This is the equivalent of the Python expression: o.attr_name. */ /* Implemented elsewhere: int PyObject_HasAttr(PyObject *o, PyObject *attr_name); Returns 1 if o has the attribute attr_name, and 0 otherwise. This is equivalent to the Python expression: hasattr(o,attr_name). This function always succeeds. */ /* Implemented elsewhere: PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name); Retrieve an attributed named attr_name form object o. Returns the attribute value on success, or NULL on failure. This is the equivalent of the Python expression: o.attr_name. */ /* Implemented elsewhere: int PyObject_SetAttrString(PyObject *o, char *attr_name, PyObject *v); Set the value of the attribute named attr_name, for object o, to the value, v. Returns -1 on failure. This is the equivalent of the Python statement: o.attr_name=v. */ /* Implemented elsewhere: int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v); Set the value of the attribute named attr_name, for object o, to the value, v. Returns -1 on failure. This is the equivalent of the Python statement: o.attr_name=v. */ /* implemented as a macro: int PyObject_DelAttrString(PyObject *o, char *attr_name); Delete attribute named attr_name, for object o. Returns -1 on failure. This is the equivalent of the Python statement: del o.attr_name. */ #define PyObject_DelAttrString(O,A) PyObject_SetAttrString((O),(A),NULL) /* implemented as a macro: int PyObject_DelAttr(PyObject *o, PyObject *attr_name); Delete attribute named attr_name, for object o. Returns -1 on failure. This is the equivalent of the Python statement: del o.attr_name. */ #define PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A),NULL) PyAPI_FUNC(int) PyObject_Cmp(PyObject *o1, PyObject *o2, int *result); /* Compare the values of o1 and o2 using a routine provided by o1, if one exists, otherwise with a routine provided by o2. The result of the comparison is returned in result. Returns -1 on failure. This is the equivalent of the Python statement: result=cmp(o1,o2). */ /* Implemented elsewhere: int PyObject_Compare(PyObject *o1, PyObject *o2); Compare the values of o1 and o2 using a routine provided by o1, if one exists, otherwise with a routine provided by o2. Returns the result of the comparison on success. On error, the value returned is undefined. This is equivalent to the Python expression: cmp(o1,o2). */ /* Implemented elsewhere: PyObject *PyObject_Repr(PyObject *o); Compute the string representation of object, o. Returns the string representation on success, NULL on failure. This is the equivalent of the Python expression: repr(o). Called by the repr() built-in function and by reverse quotes. */ /* Implemented elsewhere: PyObject *PyObject_Str(PyObject *o); Compute the string representation of object, o. Returns the string representation on success, NULL on failure. This is the equivalent of the Python expression: str(o).) Called by the str() built-in function and by the print statement. */ /* Implemented elsewhere: PyObject *PyObject_Unicode(PyObject *o); Compute the unicode representation of object, o. Returns the unicode representation on success, NULL on failure. This is the equivalent of the Python expression: unistr(o).) Called by the unistr() built-in function. */ /* Declared elsewhere PyAPI_FUNC(int) PyCallable_Check(PyObject *o); Determine if the object, o, is callable. Return 1 if the object is callable and 0 otherwise. This function always succeeds. */ PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object, PyObject *args, PyObject *kw); /* Call a callable Python object, callable_object, with arguments and keywords arguments. The 'args' argument can not be NULL, but the 'kw' argument can be NULL. */ PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable_object, PyObject *args); /* Call a callable Python object, callable_object, with arguments given by the tuple, args. If no arguments are needed, then args may be NULL. Returns the result of the call on success, or NULL on failure. This is the equivalent of the Python expression: apply(o,args). */ PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable_object, char *format, ...); /* Call a callable Python object, callable_object, with a variable number of C arguments. The C arguments are described using a mkvalue-style format string. The format may be NULL, indicating that no arguments are provided. Returns the result of the call on success, or NULL on failure. This is the equivalent of the Python expression: apply(o,args). */ PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *o, char *m, char *format, ...); /* Call the method named m of object o with a variable number of C arguments. The C arguments are described by a mkvalue format string. The format may be NULL, indicating that no arguments are provided. Returns the result of the call on success, or NULL on failure. This is the equivalent of the Python expression: o.method(args). */ PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable, char *format, ...); PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *o, char *name, char *format, ...); PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable, ...); /* Call a callable Python object, callable_object, with a variable number of C arguments. The C arguments are provided as PyObject * values, terminated by a NULL. Returns the result of the call on success, or NULL on failure. This is the equivalent of the Python expression: apply(o,args). */ PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(PyObject *o, PyObject *m, ...); /* Call the method named m of object o with a variable number of C arguments. The C arguments are provided as PyObject * values, terminated by NULL. Returns the result of the call on success, or NULL on failure. This is the equivalent of the Python expression: o.method(args). */ /* Implemented elsewhere: long PyObject_Hash(PyObject *o); Compute and return the hash, hash_value, of an object, o. On failure, return -1. This is the equivalent of the Python expression: hash(o). */ /* Implemented elsewhere: int PyObject_IsTrue(PyObject *o); Returns 1 if the object, o, is considered to be true, 0 if o is considered to be false and -1 on failure. This is equivalent to the Python expression: not not o */ /* Implemented elsewhere: int PyObject_Not(PyObject *o); Returns 0 if the object, o, is considered to be true, 1 if o is considered to be false and -1 on failure. This is equivalent to the Python expression: not o */ PyAPI_FUNC(PyObject *) PyObject_Type(PyObject *o); /* On success, returns a type object corresponding to the object type of object o. On failure, returns NULL. This is equivalent to the Python expression: type(o). */ PyAPI_FUNC(Py_ssize_t) PyObject_Size(PyObject *o); /* Return the size of object o. If the object, o, provides both sequence and mapping protocols, the sequence size is returned. On error, -1 is returned. This is the equivalent to the Python expression: len(o). */ /* For DLL compatibility */ #undef PyObject_Length PyAPI_FUNC(Py_ssize_t) PyObject_Length(PyObject *o); #define PyObject_Length PyObject_Size PyAPI_FUNC(Py_ssize_t) _PyObject_LengthHint(PyObject *o, Py_ssize_t); /* Guess the size of object o using len(o) or o.__length_hint__(). If neither of those return a non-negative value, then return the default value. If one of the calls fails, this function returns -1. */ PyAPI_FUNC(PyObject *) PyObject_GetItem(PyObject *o, PyObject *key); /* Return element of o corresponding to the object, key, or NULL on failure. This is the equivalent of the Python expression: o[key]. */ PyAPI_FUNC(int) PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v); /* Map the object, key, to the value, v. Returns -1 on failure. This is the equivalent of the Python statement: o[key]=v. */ PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, char *key); /* Remove the mapping for object, key, from the object *o. Returns -1 on failure. This is equivalent to the Python statement: del o[key]. */ PyAPI_FUNC(int) PyObject_DelItem(PyObject *o, PyObject *key); /* Delete the mapping for key from *o. Returns -1 on failure. This is the equivalent of the Python statement: del o[key]. */ PyAPI_FUNC(int) PyObject_AsCharBuffer(PyObject *obj, const char **buffer, Py_ssize_t *buffer_len); /* Takes an arbitrary object which must support the (character, single segment) buffer interface and returns a pointer to a read-only memory location useable as character based input for subsequent processing. 0 is returned on success. buffer and buffer_len are only set in case no error occurs. Otherwise, -1 is returned and an exception set. */ PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj); /* Checks whether an arbitrary object supports the (character, single segment) buffer interface. Returns 1 on success, 0 on failure. */ PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj, const void **buffer, Py_ssize_t *buffer_len); /* Same as PyObject_AsCharBuffer() except that this API expects (readable, single segment) buffer interface and returns a pointer to a read-only memory location which can contain arbitrary data. 0 is returned on success. buffer and buffer_len are only set in case no error occurs. Otherwise, -1 is returned and an exception set. */ PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj, void **buffer, Py_ssize_t *buffer_len); /* Takes an arbitrary object which must support the (writeable, single segment) buffer interface and returns a pointer to a writeable memory location in buffer of size buffer_len. 0 is returned on success. buffer and buffer_len are only set in case no error occurs. Otherwise, -1 is returned and an exception set. */ /* new buffer API */ #define PyObject_CheckBuffer(obj) \ (((obj)->ob_type->tp_as_buffer != NULL) && \ (PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_NEWBUFFER)) && \ ((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL)) /* Return 1 if the getbuffer function is available, otherwise return 0 */ PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, Py_buffer *view, int flags); /* This is a C-API version of the getbuffer function call. It checks to make sure object has the required function pointer and issues the call. Returns -1 and raises an error on failure and returns 0 on success */ PyAPI_FUNC(void *) PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices); /* Get the memory area pointed to by the indices for the buffer given. Note that view->ndim is the assumed size of indices */ PyAPI_FUNC(int) PyBuffer_SizeFromFormat(const char *); /* Return the implied itemsize of the data-format area from a struct-style description */ PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, Py_buffer *view, Py_ssize_t len, char fort); PyAPI_FUNC(int) PyBuffer_FromContiguous(Py_buffer *view, void *buf, Py_ssize_t len, char fort); /* Copy len bytes of data from the contiguous chunk of memory pointed to by buf into the buffer exported by obj. Return 0 on success and return -1 and raise a PyBuffer_Error on error (i.e. the object does not have a buffer interface or it is not working). If fort is 'F' and the object is multi-dimensional, then the data will be copied into the array in Fortran-style (first dimension varies the fastest). If fort is 'C', then the data will be copied into the array in C-style (last dimension varies the fastest). If fort is 'A', then it does not matter and the copy will be made in whatever way is more efficient. */ PyAPI_FUNC(int) PyObject_CopyData(PyObject *dest, PyObject *src); /* Copy the data from the src buffer to the buffer of destination */ PyAPI_FUNC(int) PyBuffer_IsContiguous(Py_buffer *view, char fort); PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims, Py_ssize_t *shape, Py_ssize_t *strides, int itemsize, char fort); /* Fill the strides array with byte-strides of a contiguous (Fortran-style if fort is 'F' or C-style otherwise) array of the given shape with the given number of bytes per element. */ PyAPI_FUNC(int) PyBuffer_FillInfo(Py_buffer *view, PyObject *o, void *buf, Py_ssize_t len, int readonly, int flags); /* Fills in a buffer-info structure correctly for an exporter that can only share a contiguous chunk of memory of "unsigned bytes" of the given length. Returns 0 on success and -1 (with raising an error) on error. */ PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view); /* Releases a Py_buffer obtained from getbuffer ParseTuple's s*. */ PyAPI_FUNC(PyObject *) PyObject_Format(PyObject* obj, PyObject *format_spec); /* Takes an arbitrary object and returns the result of calling obj.__format__(format_spec). */ /* Iterators */ PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *); /* Takes an object and returns an iterator for it. This is typically a new iterator but if the argument is an iterator, this returns itself. */ #define PyIter_Check(obj) \ (PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_ITER) && \ (obj)->ob_type->tp_iternext != NULL && \ (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented) PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *); /* Takes an iterator object and calls its tp_iternext slot, returning the next value. If the iterator is exhausted, this returns NULL without setting an exception. NULL with an exception means an error occurred. */ /* Number Protocol:*/ PyAPI_FUNC(int) PyNumber_Check(PyObject *o); /* Returns 1 if the object, o, provides numeric protocols, and false otherwise. This function always succeeds. */ PyAPI_FUNC(PyObject *) PyNumber_Add(PyObject *o1, PyObject *o2); /* Returns the result of adding o1 and o2, or null on failure. This is the equivalent of the Python expression: o1+o2. */ PyAPI_FUNC(PyObject *) PyNumber_Subtract(PyObject *o1, PyObject *o2); /* Returns the result of subtracting o2 from o1, or null on failure. This is the equivalent of the Python expression: o1-o2. */ PyAPI_FUNC(PyObject *) PyNumber_Multiply(PyObject *o1, PyObject *o2); /* Returns the result of multiplying o1 and o2, or null on failure. This is the equivalent of the Python expression: o1*o2. */ PyAPI_FUNC(PyObject *) PyNumber_Divide(PyObject *o1, PyObject *o2); /* Returns the result of dividing o1 by o2, or null on failure. This is the equivalent of the Python expression: o1/o2. */ PyAPI_FUNC(PyObject *) PyNumber_FloorDivide(PyObject *o1, PyObject *o2); /* Returns the result of dividing o1 by o2 giving an integral result, or null on failure. This is the equivalent of the Python expression: o1//o2. */ PyAPI_FUNC(PyObject *) PyNumber_TrueDivide(PyObject *o1, PyObject *o2); /* Returns the result of dividing o1 by o2 giving a float result, or null on failure. This is the equivalent of the Python expression: o1/o2. */ PyAPI_FUNC(PyObject *) PyNumber_Remainder(PyObject *o1, PyObject *o2); /* Returns the remainder of dividing o1 by o2, or null on failure. This is the equivalent of the Python expression: o1%o2. */ PyAPI_FUNC(PyObject *) PyNumber_Divmod(PyObject *o1, PyObject *o2); /* See the built-in function divmod. Returns NULL on failure. This is the equivalent of the Python expression: divmod(o1,o2). */ PyAPI_FUNC(PyObject *) PyNumber_Power(PyObject *o1, PyObject *o2, PyObject *o3); /* See the built-in function pow. Returns NULL on failure. This is the equivalent of the Python expression: pow(o1,o2,o3), where o3 is optional. */ PyAPI_FUNC(PyObject *) PyNumber_Negative(PyObject *o); /* Returns the negation of o on success, or null on failure. This is the equivalent of the Python expression: -o. */ PyAPI_FUNC(PyObject *) PyNumber_Positive(PyObject *o); /* Returns the (what?) of o on success, or NULL on failure. This is the equivalent of the Python expression: +o. */ PyAPI_FUNC(PyObject *) PyNumber_Absolute(PyObject *o); /* Returns the absolute value of o, or null on failure. This is the equivalent of the Python expression: abs(o). */ PyAPI_FUNC(PyObject *) PyNumber_Invert(PyObject *o); /* Returns the bitwise negation of o on success, or NULL on failure. This is the equivalent of the Python expression: ~o. */ PyAPI_FUNC(PyObject *) PyNumber_Lshift(PyObject *o1, PyObject *o2); /* Returns the result of left shifting o1 by o2 on success, or NULL on failure. This is the equivalent of the Python expression: o1 << o2. */ PyAPI_FUNC(PyObject *) PyNumber_Rshift(PyObject *o1, PyObject *o2); /* Returns the result of right shifting o1 by o2 on success, or NULL on failure. This is the equivalent of the Python expression: o1 >> o2. */ PyAPI_FUNC(PyObject *) PyNumber_And(PyObject *o1, PyObject *o2); /* Returns the result of bitwise and of o1 and o2 on success, or NULL on failure. This is the equivalent of the Python expression: o1&o2. */ PyAPI_FUNC(PyObject *) PyNumber_Xor(PyObject *o1, PyObject *o2); /* Returns the bitwise exclusive or of o1 by o2 on success, or NULL on failure. This is the equivalent of the Python expression: o1^o2. */ PyAPI_FUNC(PyObject *) PyNumber_Or(PyObject *o1, PyObject *o2); /* Returns the result of bitwise or on o1 and o2 on success, or NULL on failure. This is the equivalent of the Python expression: o1|o2. */ /* Implemented elsewhere: int PyNumber_Coerce(PyObject **p1, PyObject **p2); This function takes the addresses of two variables of type PyObject*. If the objects pointed to by *p1 and *p2 have the same type, increment their reference count and return 0 (success). If the objects can be converted to a common numeric type, replace *p1 and *p2 by their converted value (with 'new' reference counts), and return 0. If no conversion is possible, or if some other error occurs, return -1 (failure) and don't increment the reference counts. The call PyNumber_Coerce(&o1, &o2) is equivalent to the Python statement o1, o2 = coerce(o1, o2). */ #define PyIndex_Check(obj) \ ((obj)->ob_type->tp_as_number != NULL && \ PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_INDEX) && \ (obj)->ob_type->tp_as_number->nb_index != NULL) PyAPI_FUNC(PyObject *) PyNumber_Index(PyObject *o); /* Returns the object converted to a Python long or int or NULL with an error raised on failure. */ PyAPI_FUNC(Py_ssize_t) PyNumber_AsSsize_t(PyObject *o, PyObject *exc); /* Returns the Integral instance converted to an int. The instance is expected to be int or long or have an __int__ method. Steals integral's reference. error_format will be used to create the TypeError if integral isn't actually an Integral instance. error_format should be a format string that can accept a char* naming integral's type. */ PyAPI_FUNC(PyObject *) _PyNumber_ConvertIntegralToInt( PyObject *integral, const char* error_format); /* Returns the object converted to Py_ssize_t by going through PyNumber_Index first. If an overflow error occurs while converting the int-or-long to Py_ssize_t, then the second argument is the error-type to return. If it is NULL, then the overflow error is cleared and the value is clipped. */ PyAPI_FUNC(PyObject *) PyNumber_Int(PyObject *o); /* Returns the o converted to an integer object on success, or NULL on failure. This is the equivalent of the Python expression: int(o). */ PyAPI_FUNC(PyObject *) PyNumber_Long(PyObject *o); /* Returns the o converted to a long integer object on success, or NULL on failure. This is the equivalent of the Python expression: long(o). */ PyAPI_FUNC(PyObject *) PyNumber_Float(PyObject *o); /* Returns the o converted to a float object on success, or NULL on failure. This is the equivalent of the Python expression: float(o). */ /* In-place variants of (some of) the above number protocol functions */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2); /* Returns the result of adding o2 to o1, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 += o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2); /* Returns the result of subtracting o2 from o1, possibly in-place or null on failure. This is the equivalent of the Python expression: o1 -= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2); /* Returns the result of multiplying o1 by o2, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 *= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceDivide(PyObject *o1, PyObject *o2); /* Returns the result of dividing o1 by o2, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 /= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1, PyObject *o2); /* Returns the result of dividing o1 by o2 giving an integral result, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 /= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceTrueDivide(PyObject *o1, PyObject *o2); /* Returns the result of dividing o1 by o2 giving a float result, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 /= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2); /* Returns the remainder of dividing o1 by o2, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 %= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2, PyObject *o3); /* Returns the result of raising o1 to the power of o2, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 **= o2, or pow(o1, o2, o3) if o3 is present. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2); /* Returns the result of left shifting o1 by o2, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 <<= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2); /* Returns the result of right shifting o1 by o2, possibly in-place or null on failure. This is the equivalent of the Python expression: o1 >>= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2); /* Returns the result of bitwise and of o1 and o2, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 &= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceXor(PyObject *o1, PyObject *o2); /* Returns the bitwise exclusive or of o1 by o2, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 ^= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceOr(PyObject *o1, PyObject *o2); /* Returns the result of bitwise or of o1 and o2, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 |= o2. */ PyAPI_FUNC(PyObject *) PyNumber_ToBase(PyObject *n, int base); /* Returns the integer n converted to a string with a base, with a base marker of 0b, 0o or 0x prefixed if applicable. If n is not an int object, it is converted with PyNumber_Index first. */ /* Sequence protocol:*/ PyAPI_FUNC(int) PySequence_Check(PyObject *o); /* Return 1 if the object provides sequence protocol, and zero otherwise. This function always succeeds. */ PyAPI_FUNC(Py_ssize_t) PySequence_Size(PyObject *o); /* Return the size of sequence object o, or -1 on failure. */ /* For DLL compatibility */ #undef PySequence_Length PyAPI_FUNC(Py_ssize_t) PySequence_Length(PyObject *o); #define PySequence_Length PySequence_Size PyAPI_FUNC(PyObject *) PySequence_Concat(PyObject *o1, PyObject *o2); /* Return the concatenation of o1 and o2 on success, and NULL on failure. This is the equivalent of the Python expression: o1+o2. */ PyAPI_FUNC(PyObject *) PySequence_Repeat(PyObject *o, Py_ssize_t count); /* Return the result of repeating sequence object o count times, or NULL on failure. This is the equivalent of the Python expression: o1*count. */ PyAPI_FUNC(PyObject *) PySequence_GetItem(PyObject *o, Py_ssize_t i); /* Return the ith element of o, or NULL on failure. This is the equivalent of the Python expression: o[i]. */ PyAPI_FUNC(PyObject *) PySequence_GetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2); /* Return the slice of sequence object o between i1 and i2, or NULL on failure. This is the equivalent of the Python expression: o[i1:i2]. */ PyAPI_FUNC(int) PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v); /* Assign object v to the ith element of o. Returns -1 on failure. This is the equivalent of the Python statement: o[i]=v. */ PyAPI_FUNC(int) PySequence_DelItem(PyObject *o, Py_ssize_t i); /* Delete the ith element of object v. Returns -1 on failure. This is the equivalent of the Python statement: del o[i]. */ PyAPI_FUNC(int) PySequence_SetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2, PyObject *v); /* Assign the sequence object, v, to the slice in sequence object, o, from i1 to i2. Returns -1 on failure. This is the equivalent of the Python statement: o[i1:i2]=v. */ PyAPI_FUNC(int) PySequence_DelSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2); /* Delete the slice in sequence object, o, from i1 to i2. Returns -1 on failure. This is the equivalent of the Python statement: del o[i1:i2]. */ PyAPI_FUNC(PyObject *) PySequence_Tuple(PyObject *o); /* Returns the sequence, o, as a tuple on success, and NULL on failure. This is equivalent to the Python expression: tuple(o) */ PyAPI_FUNC(PyObject *) PySequence_List(PyObject *o); /* Returns the sequence, o, as a list on success, and NULL on failure. This is equivalent to the Python expression: list(o) */ PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m); /* Returns the sequence, o, as a tuple, unless it's already a tuple or list. Use PySequence_Fast_GET_ITEM to access the members of this list, and PySequence_Fast_GET_SIZE to get its length. Returns NULL on failure. If the object does not support iteration, raises a TypeError exception with m as the message text. */ #define PySequence_Fast_GET_SIZE(o) \ (PyList_Check(o) ? PyList_GET_SIZE(o) : PyTuple_GET_SIZE(o)) /* Return the size of o, assuming that o was returned by PySequence_Fast and is not NULL. */ #define PySequence_Fast_GET_ITEM(o, i)\ (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i)) /* Return the ith element of o, assuming that o was returned by PySequence_Fast, and that i is within bounds. */ #define PySequence_ITEM(o, i)\ ( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) ) /* Assume tp_as_sequence and sq_item exist and that i does not need to be corrected for a negative index */ #define PySequence_Fast_ITEMS(sf) \ (PyList_Check(sf) ? ((PyListObject *)(sf))->ob_item \ : ((PyTupleObject *)(sf))->ob_item) /* Return a pointer to the underlying item array for an object retured by PySequence_Fast */ PyAPI_FUNC(Py_ssize_t) PySequence_Count(PyObject *o, PyObject *value); /* Return the number of occurrences on value on o, that is, return the number of keys for which o[key]==value. On failure, return -1. This is equivalent to the Python expression: o.count(value). */ PyAPI_FUNC(int) PySequence_Contains(PyObject *seq, PyObject *ob); /* Return -1 if error; 1 if ob in seq; 0 if ob not in seq. Use __contains__ if possible, else _PySequence_IterSearch(). */ #define PY_ITERSEARCH_COUNT 1 #define PY_ITERSEARCH_INDEX 2 #define PY_ITERSEARCH_CONTAINS 3 PyAPI_FUNC(Py_ssize_t) _PySequence_IterSearch(PyObject *seq, PyObject *obj, int operation); /* Iterate over seq. Result depends on the operation: PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if error. PY_ITERSEARCH_INDEX: return 0-based index of first occurrence of obj in seq; set ValueError and return -1 if none found; also return -1 on error. PY_ITERSEARCH_CONTAINS: return 1 if obj in seq, else 0; -1 on error. */ /* For DLL-level backwards compatibility */ #undef PySequence_In PyAPI_FUNC(int) PySequence_In(PyObject *o, PyObject *value); /* For source-level backwards compatibility */ #define PySequence_In PySequence_Contains /* Determine if o contains value. If an item in o is equal to X, return 1, otherwise return 0. On error, return -1. This is equivalent to the Python expression: value in o. */ PyAPI_FUNC(Py_ssize_t) PySequence_Index(PyObject *o, PyObject *value); /* Return the first index for which o[i]=value. On error, return -1. This is equivalent to the Python expression: o.index(value). */ /* In-place versions of some of the above Sequence functions. */ PyAPI_FUNC(PyObject *) PySequence_InPlaceConcat(PyObject *o1, PyObject *o2); /* Append o2 to o1, in-place when possible. Return the resulting object, which could be o1, or NULL on failure. This is the equivalent of the Python expression: o1 += o2. */ PyAPI_FUNC(PyObject *) PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count); /* Repeat o1 by count, in-place when possible. Return the resulting object, which could be o1, or NULL on failure. This is the equivalent of the Python expression: o1 *= count. */ /* Mapping protocol:*/ PyAPI_FUNC(int) PyMapping_Check(PyObject *o); /* Return 1 if the object provides mapping protocol, and zero otherwise. This function always succeeds. */ PyAPI_FUNC(Py_ssize_t) PyMapping_Size(PyObject *o); /* Returns the number of keys in object o on success, and -1 on failure. For objects that do not provide sequence protocol, this is equivalent to the Python expression: len(o). */ /* For DLL compatibility */ #undef PyMapping_Length PyAPI_FUNC(Py_ssize_t) PyMapping_Length(PyObject *o); #define PyMapping_Length PyMapping_Size /* implemented as a macro: int PyMapping_DelItemString(PyObject *o, char *key); Remove the mapping for object, key, from the object *o. Returns -1 on failure. This is equivalent to the Python statement: del o[key]. */ #define PyMapping_DelItemString(O,K) PyObject_DelItemString((O),(K)) /* implemented as a macro: int PyMapping_DelItem(PyObject *o, PyObject *key); Remove the mapping for object, key, from the object *o. Returns -1 on failure. This is equivalent to the Python statement: del o[key]. */ #define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K)) PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, char *key); /* On success, return 1 if the mapping object has the key, key, and 0 otherwise. This is equivalent to the Python expression: o.has_key(key). This function always succeeds. */ PyAPI_FUNC(int) PyMapping_HasKey(PyObject *o, PyObject *key); /* Return 1 if the mapping object has the key, key, and 0 otherwise. This is equivalent to the Python expression: o.has_key(key). This function always succeeds. */ /* Implemented as macro: PyObject *PyMapping_Keys(PyObject *o); On success, return a list of the keys in object o. On failure, return NULL. This is equivalent to the Python expression: o.keys(). */ #define PyMapping_Keys(O) PyObject_CallMethod(O,"keys",NULL) /* Implemented as macro: PyObject *PyMapping_Values(PyObject *o); On success, return a list of the values in object o. On failure, return NULL. This is equivalent to the Python expression: o.values(). */ #define PyMapping_Values(O) PyObject_CallMethod(O,"values",NULL) /* Implemented as macro: PyObject *PyMapping_Items(PyObject *o); On success, return a list of the items in object o, where each item is a tuple containing a key-value pair. On failure, return NULL. This is equivalent to the Python expression: o.items(). */ #define PyMapping_Items(O) PyObject_CallMethod(O,"items",NULL) PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o, char *key); /* Return element of o corresponding to the object, key, or NULL on failure. This is the equivalent of the Python expression: o[key]. */ PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, char *key, PyObject *value); /* Map the object, key, to the value, v. Returns -1 on failure. This is the equivalent of the Python statement: o[key]=v. */ PyAPI_FUNC(int) PyObject_IsInstance(PyObject *object, PyObject *typeorclass); /* isinstance(object, typeorclass) */ PyAPI_FUNC(int) PyObject_IsSubclass(PyObject *object, PyObject *typeorclass); /* issubclass(object, typeorclass) */ PyAPI_FUNC(int) _PyObject_RealIsInstance(PyObject *inst, PyObject *cls); PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls); /* For internal use by buffer API functions */ PyAPI_FUNC(void) _Py_add_one_to_index_F(int nd, Py_ssize_t *index, const Py_ssize_t *shape); PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index, const Py_ssize_t *shape); #ifdef __cplusplus } #endif #endif /* Py_ABSTRACTOBJECT_H */ �����������������������������������������python2.7/unicodeobject.h���������������������������������������������������������������������������0000644�����������������00000146002�14763166027�0011321 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_UNICODEOBJECT_H #define Py_UNICODEOBJECT_H #include <stdarg.h> /* Unicode implementation based on original code by Fredrik Lundh, modified by Marc-Andre Lemburg (mal@lemburg.com) according to the Unicode Integration Proposal (see file Misc/unicode.txt). Copyright (c) Corporation for National Research Initiatives. Original header: -------------------------------------------------------------------- * Yet another Unicode string type for Python. This type supports the * 16-bit Basic Multilingual Plane (BMP) only. * * Written by Fredrik Lundh, January 1999. * * Copyright (c) 1999 by Secret Labs AB. * Copyright (c) 1999 by Fredrik Lundh. * * fredrik@pythonware.com * http://www.pythonware.com * * -------------------------------------------------------------------- * This Unicode String Type is * * Copyright (c) 1999 by Secret Labs AB * Copyright (c) 1999 by Fredrik Lundh * * By obtaining, using, and/or copying this software and/or its * associated documentation, you agree that you have read, understood, * and will comply with the following terms and conditions: * * Permission to use, copy, modify, and distribute this software and its * associated documentation for any purpose and without fee is hereby * granted, provided that the above copyright notice appears in all * copies, and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Secret Labs * AB or the author not be used in advertising or publicity pertaining to * distribution of the software without specific, written prior * permission. * * SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * -------------------------------------------------------------------- */ #include <ctype.h> /* === Internal API ======================================================= */ /* --- Internal Unicode Format -------------------------------------------- */ #ifndef Py_USING_UNICODE #define PyUnicode_Check(op) 0 #define PyUnicode_CheckExact(op) 0 #else /* FIXME: MvL's new implementation assumes that Py_UNICODE_SIZE is properly set, but the default rules below doesn't set it. I'll sort this out some other day -- fredrik@pythonware.com */ #ifndef Py_UNICODE_SIZE #error Must define Py_UNICODE_SIZE #endif /* Setting Py_UNICODE_WIDE enables UCS-4 storage. Otherwise, Unicode strings are stored as UCS-2 (with limited support for UTF-16) */ #if Py_UNICODE_SIZE >= 4 #define Py_UNICODE_WIDE #endif /* Set these flags if the platform has "wchar.h", "wctype.h" and the wchar_t type is a 16-bit unsigned type */ /* #define HAVE_WCHAR_H */ /* #define HAVE_USABLE_WCHAR_T */ /* Defaults for various platforms */ #ifndef PY_UNICODE_TYPE /* Windows has a usable wchar_t type (unless we're using UCS-4) */ # if defined(MS_WIN32) && Py_UNICODE_SIZE == 2 # define HAVE_USABLE_WCHAR_T # define PY_UNICODE_TYPE wchar_t # endif # if defined(Py_UNICODE_WIDE) # define PY_UNICODE_TYPE Py_UCS4 # endif #endif /* If the compiler provides a wchar_t type we try to support it through the interface functions PyUnicode_FromWideChar() and PyUnicode_AsWideChar(). */ #ifdef HAVE_USABLE_WCHAR_T # ifndef HAVE_WCHAR_H # define HAVE_WCHAR_H # endif #endif #ifdef HAVE_WCHAR_H /* Work around a cosmetic bug in BSDI 4.x wchar.h; thanks to Thomas Wouters */ # ifdef _HAVE_BSDI # include <time.h> # endif # include <wchar.h> #endif /* * Use this typedef when you need to represent a UTF-16 surrogate pair * as single unsigned integer. */ #if SIZEOF_INT >= 4 typedef unsigned int Py_UCS4; #elif SIZEOF_LONG >= 4 typedef unsigned long Py_UCS4; #endif /* Py_UNICODE is the native Unicode storage format (code unit) used by Python and represents a single Unicode element in the Unicode type. */ typedef PY_UNICODE_TYPE Py_UNICODE; /* --- UCS-2/UCS-4 Name Mangling ------------------------------------------ */ /* Unicode API names are mangled to assure that UCS-2 and UCS-4 builds produce different external names and thus cause import errors in case Python interpreters and extensions with mixed compiled in Unicode width assumptions are combined. */ #ifndef Py_UNICODE_WIDE # define PyUnicode_AsASCIIString PyUnicodeUCS2_AsASCIIString # define PyUnicode_AsCharmapString PyUnicodeUCS2_AsCharmapString # define PyUnicode_AsEncodedObject PyUnicodeUCS2_AsEncodedObject # define PyUnicode_AsEncodedString PyUnicodeUCS2_AsEncodedString # define PyUnicode_AsLatin1String PyUnicodeUCS2_AsLatin1String # define PyUnicode_AsRawUnicodeEscapeString PyUnicodeUCS2_AsRawUnicodeEscapeString # define PyUnicode_AsUTF32String PyUnicodeUCS2_AsUTF32String # define PyUnicode_AsUTF16String PyUnicodeUCS2_AsUTF16String # define PyUnicode_AsUTF8String PyUnicodeUCS2_AsUTF8String # define PyUnicode_AsUnicode PyUnicodeUCS2_AsUnicode # define PyUnicode_AsUnicodeEscapeString PyUnicodeUCS2_AsUnicodeEscapeString # define PyUnicode_AsWideChar PyUnicodeUCS2_AsWideChar # define PyUnicode_ClearFreeList PyUnicodeUCS2_ClearFreelist # define PyUnicode_Compare PyUnicodeUCS2_Compare # define PyUnicode_Concat PyUnicodeUCS2_Concat # define PyUnicode_Contains PyUnicodeUCS2_Contains # define PyUnicode_Count PyUnicodeUCS2_Count # define PyUnicode_Decode PyUnicodeUCS2_Decode # define PyUnicode_DecodeASCII PyUnicodeUCS2_DecodeASCII # define PyUnicode_DecodeCharmap PyUnicodeUCS2_DecodeCharmap # define PyUnicode_DecodeLatin1 PyUnicodeUCS2_DecodeLatin1 # define PyUnicode_DecodeRawUnicodeEscape PyUnicodeUCS2_DecodeRawUnicodeEscape # define PyUnicode_DecodeUTF32 PyUnicodeUCS2_DecodeUTF32 # define PyUnicode_DecodeUTF32Stateful PyUnicodeUCS2_DecodeUTF32Stateful # define PyUnicode_DecodeUTF16 PyUnicodeUCS2_DecodeUTF16 # define PyUnicode_DecodeUTF16Stateful PyUnicodeUCS2_DecodeUTF16Stateful # define PyUnicode_DecodeUTF8 PyUnicodeUCS2_DecodeUTF8 # define PyUnicode_DecodeUTF8Stateful PyUnicodeUCS2_DecodeUTF8Stateful # define PyUnicode_DecodeUnicodeEscape PyUnicodeUCS2_DecodeUnicodeEscape # define PyUnicode_Encode PyUnicodeUCS2_Encode # define PyUnicode_EncodeASCII PyUnicodeUCS2_EncodeASCII # define PyUnicode_EncodeCharmap PyUnicodeUCS2_EncodeCharmap # define PyUnicode_EncodeDecimal PyUnicodeUCS2_EncodeDecimal # define PyUnicode_EncodeLatin1 PyUnicodeUCS2_EncodeLatin1 # define PyUnicode_EncodeRawUnicodeEscape PyUnicodeUCS2_EncodeRawUnicodeEscape # define PyUnicode_EncodeUTF32 PyUnicodeUCS2_EncodeUTF32 # define PyUnicode_EncodeUTF16 PyUnicodeUCS2_EncodeUTF16 # define PyUnicode_EncodeUTF8 PyUnicodeUCS2_EncodeUTF8 # define PyUnicode_EncodeUnicodeEscape PyUnicodeUCS2_EncodeUnicodeEscape # define PyUnicode_Find PyUnicodeUCS2_Find # define PyUnicode_Format PyUnicodeUCS2_Format # define PyUnicode_FromEncodedObject PyUnicodeUCS2_FromEncodedObject # define PyUnicode_FromFormat PyUnicodeUCS2_FromFormat # define PyUnicode_FromFormatV PyUnicodeUCS2_FromFormatV # define PyUnicode_FromObject PyUnicodeUCS2_FromObject # define PyUnicode_FromOrdinal PyUnicodeUCS2_FromOrdinal # define PyUnicode_FromString PyUnicodeUCS2_FromString # define PyUnicode_FromStringAndSize PyUnicodeUCS2_FromStringAndSize # define PyUnicode_FromUnicode PyUnicodeUCS2_FromUnicode # define PyUnicode_FromWideChar PyUnicodeUCS2_FromWideChar # define PyUnicode_GetDefaultEncoding PyUnicodeUCS2_GetDefaultEncoding # define PyUnicode_GetMax PyUnicodeUCS2_GetMax # define PyUnicode_GetSize PyUnicodeUCS2_GetSize # define PyUnicode_Join PyUnicodeUCS2_Join # define PyUnicode_Partition PyUnicodeUCS2_Partition # define PyUnicode_RPartition PyUnicodeUCS2_RPartition # define PyUnicode_RSplit PyUnicodeUCS2_RSplit # define PyUnicode_Replace PyUnicodeUCS2_Replace # define PyUnicode_Resize PyUnicodeUCS2_Resize # define PyUnicode_RichCompare PyUnicodeUCS2_RichCompare # define PyUnicode_SetDefaultEncoding PyUnicodeUCS2_SetDefaultEncoding # define PyUnicode_Split PyUnicodeUCS2_Split # define PyUnicode_Splitlines PyUnicodeUCS2_Splitlines # define PyUnicode_Tailmatch PyUnicodeUCS2_Tailmatch # define PyUnicode_Translate PyUnicodeUCS2_Translate # define PyUnicode_TranslateCharmap PyUnicodeUCS2_TranslateCharmap # define _PyUnicode_AsDefaultEncodedString _PyUnicodeUCS2_AsDefaultEncodedString # define _PyUnicode_Fini _PyUnicodeUCS2_Fini # define _PyUnicode_Init _PyUnicodeUCS2_Init # define _PyUnicode_IsAlpha _PyUnicodeUCS2_IsAlpha # define _PyUnicode_IsDecimalDigit _PyUnicodeUCS2_IsDecimalDigit # define _PyUnicode_IsDigit _PyUnicodeUCS2_IsDigit # define _PyUnicode_IsLinebreak _PyUnicodeUCS2_IsLinebreak # define _PyUnicode_IsLowercase _PyUnicodeUCS2_IsLowercase # define _PyUnicode_IsNumeric _PyUnicodeUCS2_IsNumeric # define _PyUnicode_IsTitlecase _PyUnicodeUCS2_IsTitlecase # define _PyUnicode_IsUppercase _PyUnicodeUCS2_IsUppercase # define _PyUnicode_IsWhitespace _PyUnicodeUCS2_IsWhitespace # define _PyUnicode_ToDecimalDigit _PyUnicodeUCS2_ToDecimalDigit # define _PyUnicode_ToDigit _PyUnicodeUCS2_ToDigit # define _PyUnicode_ToLowercase _PyUnicodeUCS2_ToLowercase # define _PyUnicode_ToNumeric _PyUnicodeUCS2_ToNumeric # define _PyUnicode_ToTitlecase _PyUnicodeUCS2_ToTitlecase # define _PyUnicode_ToUppercase _PyUnicodeUCS2_ToUppercase #else # define PyUnicode_AsASCIIString PyUnicodeUCS4_AsASCIIString # define PyUnicode_AsCharmapString PyUnicodeUCS4_AsCharmapString # define PyUnicode_AsEncodedObject PyUnicodeUCS4_AsEncodedObject # define PyUnicode_AsEncodedString PyUnicodeUCS4_AsEncodedString # define PyUnicode_AsLatin1String PyUnicodeUCS4_AsLatin1String # define PyUnicode_AsRawUnicodeEscapeString PyUnicodeUCS4_AsRawUnicodeEscapeString # define PyUnicode_AsUTF32String PyUnicodeUCS4_AsUTF32String # define PyUnicode_AsUTF16String PyUnicodeUCS4_AsUTF16String # define PyUnicode_AsUTF8String PyUnicodeUCS4_AsUTF8String # define PyUnicode_AsUnicode PyUnicodeUCS4_AsUnicode # define PyUnicode_AsUnicodeEscapeString PyUnicodeUCS4_AsUnicodeEscapeString # define PyUnicode_AsWideChar PyUnicodeUCS4_AsWideChar # define PyUnicode_ClearFreeList PyUnicodeUCS4_ClearFreelist # define PyUnicode_Compare PyUnicodeUCS4_Compare # define PyUnicode_Concat PyUnicodeUCS4_Concat # define PyUnicode_Contains PyUnicodeUCS4_Contains # define PyUnicode_Count PyUnicodeUCS4_Count # define PyUnicode_Decode PyUnicodeUCS4_Decode # define PyUnicode_DecodeASCII PyUnicodeUCS4_DecodeASCII # define PyUnicode_DecodeCharmap PyUnicodeUCS4_DecodeCharmap # define PyUnicode_DecodeLatin1 PyUnicodeUCS4_DecodeLatin1 # define PyUnicode_DecodeRawUnicodeEscape PyUnicodeUCS4_DecodeRawUnicodeEscape # define PyUnicode_DecodeUTF32 PyUnicodeUCS4_DecodeUTF32 # define PyUnicode_DecodeUTF32Stateful PyUnicodeUCS4_DecodeUTF32Stateful # define PyUnicode_DecodeUTF16 PyUnicodeUCS4_DecodeUTF16 # define PyUnicode_DecodeUTF16Stateful PyUnicodeUCS4_DecodeUTF16Stateful # define PyUnicode_DecodeUTF8 PyUnicodeUCS4_DecodeUTF8 # define PyUnicode_DecodeUTF8Stateful PyUnicodeUCS4_DecodeUTF8Stateful # define PyUnicode_DecodeUnicodeEscape PyUnicodeUCS4_DecodeUnicodeEscape # define PyUnicode_Encode PyUnicodeUCS4_Encode # define PyUnicode_EncodeASCII PyUnicodeUCS4_EncodeASCII # define PyUnicode_EncodeCharmap PyUnicodeUCS4_EncodeCharmap # define PyUnicode_EncodeDecimal PyUnicodeUCS4_EncodeDecimal # define PyUnicode_EncodeLatin1 PyUnicodeUCS4_EncodeLatin1 # define PyUnicode_EncodeRawUnicodeEscape PyUnicodeUCS4_EncodeRawUnicodeEscape # define PyUnicode_EncodeUTF32 PyUnicodeUCS4_EncodeUTF32 # define PyUnicode_EncodeUTF16 PyUnicodeUCS4_EncodeUTF16 # define PyUnicode_EncodeUTF8 PyUnicodeUCS4_EncodeUTF8 # define PyUnicode_EncodeUnicodeEscape PyUnicodeUCS4_EncodeUnicodeEscape # define PyUnicode_Find PyUnicodeUCS4_Find # define PyUnicode_Format PyUnicodeUCS4_Format # define PyUnicode_FromEncodedObject PyUnicodeUCS4_FromEncodedObject # define PyUnicode_FromFormat PyUnicodeUCS4_FromFormat # define PyUnicode_FromFormatV PyUnicodeUCS4_FromFormatV # define PyUnicode_FromObject PyUnicodeUCS4_FromObject # define PyUnicode_FromOrdinal PyUnicodeUCS4_FromOrdinal # define PyUnicode_FromString PyUnicodeUCS4_FromString # define PyUnicode_FromStringAndSize PyUnicodeUCS4_FromStringAndSize # define PyUnicode_FromUnicode PyUnicodeUCS4_FromUnicode # define PyUnicode_FromWideChar PyUnicodeUCS4_FromWideChar # define PyUnicode_GetDefaultEncoding PyUnicodeUCS4_GetDefaultEncoding # define PyUnicode_GetMax PyUnicodeUCS4_GetMax # define PyUnicode_GetSize PyUnicodeUCS4_GetSize # define PyUnicode_Join PyUnicodeUCS4_Join # define PyUnicode_Partition PyUnicodeUCS4_Partition # define PyUnicode_RPartition PyUnicodeUCS4_RPartition # define PyUnicode_RSplit PyUnicodeUCS4_RSplit # define PyUnicode_Replace PyUnicodeUCS4_Replace # define PyUnicode_Resize PyUnicodeUCS4_Resize # define PyUnicode_RichCompare PyUnicodeUCS4_RichCompare # define PyUnicode_SetDefaultEncoding PyUnicodeUCS4_SetDefaultEncoding # define PyUnicode_Split PyUnicodeUCS4_Split # define PyUnicode_Splitlines PyUnicodeUCS4_Splitlines # define PyUnicode_Tailmatch PyUnicodeUCS4_Tailmatch # define PyUnicode_Translate PyUnicodeUCS4_Translate # define PyUnicode_TranslateCharmap PyUnicodeUCS4_TranslateCharmap # define _PyUnicode_AsDefaultEncodedString _PyUnicodeUCS4_AsDefaultEncodedString # define _PyUnicode_Fini _PyUnicodeUCS4_Fini # define _PyUnicode_Init _PyUnicodeUCS4_Init # define _PyUnicode_IsAlpha _PyUnicodeUCS4_IsAlpha # define _PyUnicode_IsDecimalDigit _PyUnicodeUCS4_IsDecimalDigit # define _PyUnicode_IsDigit _PyUnicodeUCS4_IsDigit # define _PyUnicode_IsLinebreak _PyUnicodeUCS4_IsLinebreak # define _PyUnicode_IsLowercase _PyUnicodeUCS4_IsLowercase # define _PyUnicode_IsNumeric _PyUnicodeUCS4_IsNumeric # define _PyUnicode_IsTitlecase _PyUnicodeUCS4_IsTitlecase # define _PyUnicode_IsUppercase _PyUnicodeUCS4_IsUppercase # define _PyUnicode_IsWhitespace _PyUnicodeUCS4_IsWhitespace # define _PyUnicode_ToDecimalDigit _PyUnicodeUCS4_ToDecimalDigit # define _PyUnicode_ToDigit _PyUnicodeUCS4_ToDigit # define _PyUnicode_ToLowercase _PyUnicodeUCS4_ToLowercase # define _PyUnicode_ToNumeric _PyUnicodeUCS4_ToNumeric # define _PyUnicode_ToTitlecase _PyUnicodeUCS4_ToTitlecase # define _PyUnicode_ToUppercase _PyUnicodeUCS4_ToUppercase #endif /* --- Internal Unicode Operations ---------------------------------------- */ /* If you want Python to use the compiler's wctype.h functions instead of the ones supplied with Python, define WANT_WCTYPE_FUNCTIONS or configure Python using --with-wctype-functions. This reduces the interpreter's code size. */ #if defined(HAVE_USABLE_WCHAR_T) && defined(WANT_WCTYPE_FUNCTIONS) #include <wctype.h> #define Py_UNICODE_ISSPACE(ch) iswspace(ch) #define Py_UNICODE_ISLOWER(ch) iswlower(ch) #define Py_UNICODE_ISUPPER(ch) iswupper(ch) #define Py_UNICODE_ISTITLE(ch) _PyUnicode_IsTitlecase(ch) #define Py_UNICODE_ISLINEBREAK(ch) _PyUnicode_IsLinebreak(ch) #define Py_UNICODE_TOLOWER(ch) towlower(ch) #define Py_UNICODE_TOUPPER(ch) towupper(ch) #define Py_UNICODE_TOTITLE(ch) _PyUnicode_ToTitlecase(ch) #define Py_UNICODE_ISDECIMAL(ch) _PyUnicode_IsDecimalDigit(ch) #define Py_UNICODE_ISDIGIT(ch) _PyUnicode_IsDigit(ch) #define Py_UNICODE_ISNUMERIC(ch) _PyUnicode_IsNumeric(ch) #define Py_UNICODE_TODECIMAL(ch) _PyUnicode_ToDecimalDigit(ch) #define Py_UNICODE_TODIGIT(ch) _PyUnicode_ToDigit(ch) #define Py_UNICODE_TONUMERIC(ch) _PyUnicode_ToNumeric(ch) #define Py_UNICODE_ISALPHA(ch) iswalpha(ch) #else /* Since splitting on whitespace is an important use case, and whitespace in most situations is solely ASCII whitespace, we optimize for the common case by using a quick look-up table _Py_ascii_whitespace (see below) with an inlined check. */ #define Py_UNICODE_ISSPACE(ch) \ ((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch)) #define Py_UNICODE_ISLOWER(ch) _PyUnicode_IsLowercase(ch) #define Py_UNICODE_ISUPPER(ch) _PyUnicode_IsUppercase(ch) #define Py_UNICODE_ISTITLE(ch) _PyUnicode_IsTitlecase(ch) #define Py_UNICODE_ISLINEBREAK(ch) _PyUnicode_IsLinebreak(ch) #define Py_UNICODE_TOLOWER(ch) _PyUnicode_ToLowercase(ch) #define Py_UNICODE_TOUPPER(ch) _PyUnicode_ToUppercase(ch) #define Py_UNICODE_TOTITLE(ch) _PyUnicode_ToTitlecase(ch) #define Py_UNICODE_ISDECIMAL(ch) _PyUnicode_IsDecimalDigit(ch) #define Py_UNICODE_ISDIGIT(ch) _PyUnicode_IsDigit(ch) #define Py_UNICODE_ISNUMERIC(ch) _PyUnicode_IsNumeric(ch) #define Py_UNICODE_TODECIMAL(ch) _PyUnicode_ToDecimalDigit(ch) #define Py_UNICODE_TODIGIT(ch) _PyUnicode_ToDigit(ch) #define Py_UNICODE_TONUMERIC(ch) _PyUnicode_ToNumeric(ch) #define Py_UNICODE_ISALPHA(ch) _PyUnicode_IsAlpha(ch) #endif #define Py_UNICODE_ISALNUM(ch) \ (Py_UNICODE_ISALPHA(ch) || \ Py_UNICODE_ISDECIMAL(ch) || \ Py_UNICODE_ISDIGIT(ch) || \ Py_UNICODE_ISNUMERIC(ch)) #define Py_UNICODE_COPY(target, source, length) \ Py_MEMCPY((target), (source), (length)*sizeof(Py_UNICODE)) #define Py_UNICODE_FILL(target, value, length) \ do {Py_ssize_t i_; Py_UNICODE *t_ = (target); Py_UNICODE v_ = (value);\ for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\ } while (0) /* Check if substring matches at given offset. the offset must be valid, and the substring must not be empty */ #define Py_UNICODE_MATCH(string, offset, substring) \ ((*((string)->str + (offset)) == *((substring)->str)) && \ ((*((string)->str + (offset) + (substring)->length-1) == *((substring)->str + (substring)->length-1))) && \ !memcmp((string)->str + (offset), (substring)->str, (substring)->length*sizeof(Py_UNICODE))) #ifdef __cplusplus extern "C" { #endif /* --- Unicode Type ------------------------------------------------------- */ typedef struct { PyObject_HEAD Py_ssize_t length; /* Length of raw Unicode data in buffer */ Py_UNICODE *str; /* Raw Unicode buffer */ long hash; /* Hash value; -1 if not set */ PyObject *defenc; /* (Default) Encoded version as Python string, or NULL; this is used for implementing the buffer protocol */ } PyUnicodeObject; PyAPI_DATA(PyTypeObject) PyUnicode_Type; #define PyUnicode_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS) #define PyUnicode_CheckExact(op) (Py_TYPE(op) == &PyUnicode_Type) /* Fast access macros */ #define PyUnicode_GET_SIZE(op) \ (((PyUnicodeObject *)(op))->length) #define PyUnicode_GET_DATA_SIZE(op) \ (((PyUnicodeObject *)(op))->length * sizeof(Py_UNICODE)) #define PyUnicode_AS_UNICODE(op) \ (((PyUnicodeObject *)(op))->str) #define PyUnicode_AS_DATA(op) \ ((const char *)((PyUnicodeObject *)(op))->str) /* --- Constants ---------------------------------------------------------- */ /* This Unicode character will be used as replacement character during decoding if the errors argument is set to "replace". Note: the Unicode character U+FFFD is the official REPLACEMENT CHARACTER in Unicode 3.0. */ #define Py_UNICODE_REPLACEMENT_CHARACTER ((Py_UNICODE) 0xFFFD) /* === Public API ========================================================= */ /* --- Plain Py_UNICODE --------------------------------------------------- */ /* Create a Unicode Object from the Py_UNICODE buffer u of the given size. u may be NULL which causes the contents to be undefined. It is the user's responsibility to fill in the needed data afterwards. Note that modifying the Unicode object contents after construction is only allowed if u was set to NULL. The buffer is copied into the new object. */ PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode( const Py_UNICODE *u, /* Unicode buffer */ Py_ssize_t size /* size of buffer */ ); /* Similar to PyUnicode_FromUnicode(), but u points to Latin-1 encoded bytes */ PyAPI_FUNC(PyObject*) PyUnicode_FromStringAndSize( const char *u, /* char buffer */ Py_ssize_t size /* size of buffer */ ); /* Similar to PyUnicode_FromUnicode(), but u points to null-terminated Latin-1 encoded bytes */ PyAPI_FUNC(PyObject*) PyUnicode_FromString( const char *u /* string */ ); /* Return a read-only pointer to the Unicode object's internal Py_UNICODE buffer. */ PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode( PyObject *unicode /* Unicode object */ ); /* Get the length of the Unicode object. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize( PyObject *unicode /* Unicode object */ ); /* Get the maximum ordinal for a Unicode character. */ PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void); /* Resize an already allocated Unicode object to the new size length. *unicode is modified to point to the new (resized) object and 0 returned on success. This API may only be called by the function which also called the Unicode constructor. The refcount on the object must be 1. Otherwise, an error is returned. Error handling is implemented as follows: an exception is set, -1 is returned and *unicode left untouched. */ PyAPI_FUNC(int) PyUnicode_Resize( PyObject **unicode, /* Pointer to the Unicode object */ Py_ssize_t length /* New length */ ); /* Coerce obj to an Unicode object and return a reference with *incremented* refcount. Coercion is done in the following way: 1. String and other char buffer compatible objects are decoded under the assumptions that they contain data using the current default encoding. Decoding is done in "strict" mode. 2. All other objects (including Unicode objects) raise an exception. The API returns NULL in case of an error. The caller is responsible for decref'ing the returned objects. */ PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject( register PyObject *obj, /* Object */ const char *encoding, /* encoding */ const char *errors /* error handling */ ); /* Coerce obj to an Unicode object and return a reference with *incremented* refcount. Unicode objects are passed back as-is (subclasses are converted to true Unicode objects), all other objects are delegated to PyUnicode_FromEncodedObject(obj, NULL, "strict") which results in using the default encoding as basis for decoding the object. The API returns NULL in case of an error. The caller is responsible for decref'ing the returned objects. */ PyAPI_FUNC(PyObject*) PyUnicode_FromObject( register PyObject *obj /* Object */ ); PyAPI_FUNC(PyObject *) PyUnicode_FromFormatV(const char*, va_list); PyAPI_FUNC(PyObject *) PyUnicode_FromFormat(const char*, ...); /* Format the object based on the format_spec, as defined in PEP 3101 (Advanced String Formatting). */ PyAPI_FUNC(PyObject *) _PyUnicode_FormatAdvanced(PyObject *obj, Py_UNICODE *format_spec, Py_ssize_t format_spec_len); /* --- wchar_t support for platforms which support it --------------------- */ #ifdef HAVE_WCHAR_H /* Create a Unicode Object from the whcar_t buffer w of the given size. The buffer is copied into the new object. */ PyAPI_FUNC(PyObject*) PyUnicode_FromWideChar( register const wchar_t *w, /* wchar_t buffer */ Py_ssize_t size /* size of buffer */ ); /* Copies the Unicode Object contents into the wchar_t buffer w. At most size wchar_t characters are copied. Note that the resulting wchar_t string may or may not be 0-terminated. It is the responsibility of the caller to make sure that the wchar_t string is 0-terminated in case this is required by the application. Returns the number of wchar_t characters copied (excluding a possibly trailing 0-termination character) or -1 in case of an error. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_AsWideChar( PyUnicodeObject *unicode, /* Unicode object */ register wchar_t *w, /* wchar_t buffer */ Py_ssize_t size /* size of buffer */ ); #endif /* --- Unicode ordinals --------------------------------------------------- */ /* Create a Unicode Object from the given Unicode code point ordinal. The ordinal must be in range(0x10000) on narrow Python builds (UCS2), and range(0x110000) on wide builds (UCS4). A ValueError is raised in case it is not. */ PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal); /* --- Free-list management ----------------------------------------------- */ /* Clear the free list used by the Unicode implementation. This can be used to release memory used for objects on the free list back to the Python memory allocator. */ PyAPI_FUNC(int) PyUnicode_ClearFreeList(void); /* === Builtin Codecs ===================================================== Many of these APIs take two arguments encoding and errors. These parameters encoding and errors have the same semantics as the ones of the builtin unicode() API. Setting encoding to NULL causes the default encoding to be used. Error handling is set by errors which may also be set to NULL meaning to use the default handling defined for the codec. Default error handling for all builtin codecs is "strict" (ValueErrors are raised). The codecs all use a similar interface. Only deviation from the generic ones are documented. */ /* --- Manage the default encoding ---------------------------------------- */ /* Return a Python string holding the default encoded value of the Unicode object. The resulting string is cached in the Unicode object for subsequent usage by this function. The cached version is needed to implement the character buffer interface and will live (at least) as long as the Unicode object itself. The refcount of the string is *not* incremented. *** Exported for internal use by the interpreter only !!! *** */ PyAPI_FUNC(PyObject *) _PyUnicode_AsDefaultEncodedString( PyObject *, const char *); /* Returns the currently active default encoding. The default encoding is currently implemented as run-time settable process global. This may change in future versions of the interpreter to become a parameter which is managed on a per-thread basis. */ PyAPI_FUNC(const char*) PyUnicode_GetDefaultEncoding(void); /* Sets the currently active default encoding. Returns 0 on success, -1 in case of an error. */ PyAPI_FUNC(int) PyUnicode_SetDefaultEncoding( const char *encoding /* Encoding name in standard form */ ); /* --- Generic Codecs ----------------------------------------------------- */ /* Create a Unicode object by decoding the encoded string s of the given size. */ PyAPI_FUNC(PyObject*) PyUnicode_Decode( const char *s, /* encoded string */ Py_ssize_t size, /* size of buffer */ const char *encoding, /* encoding */ const char *errors /* error handling */ ); /* Encodes a Py_UNICODE buffer of the given size and returns a Python string object. */ PyAPI_FUNC(PyObject*) PyUnicode_Encode( const Py_UNICODE *s, /* Unicode char buffer */ Py_ssize_t size, /* number of Py_UNICODE chars to encode */ const char *encoding, /* encoding */ const char *errors /* error handling */ ); /* Encodes a Unicode object and returns the result as Python object. */ PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedObject( PyObject *unicode, /* Unicode object */ const char *encoding, /* encoding */ const char *errors /* error handling */ ); /* Encodes a Unicode object and returns the result as Python string object. */ PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedString( PyObject *unicode, /* Unicode object */ const char *encoding, /* encoding */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_BuildEncodingMap( PyObject* string /* 256 character map */ ); /* --- UTF-7 Codecs ------------------------------------------------------- */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7( const char *string, /* UTF-7 encoded string */ Py_ssize_t length, /* size of string */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7Stateful( const char *string, /* UTF-7 encoded string */ Py_ssize_t length, /* size of string */ const char *errors, /* error handling */ Py_ssize_t *consumed /* bytes consumed */ ); PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* number of Py_UNICODE chars to encode */ int base64SetO, /* Encode RFC2152 Set O characters in base64 */ int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */ const char *errors /* error handling */ ); /* --- UTF-8 Codecs ------------------------------------------------------- */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8( const char *string, /* UTF-8 encoded string */ Py_ssize_t length, /* size of string */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8Stateful( const char *string, /* UTF-8 encoded string */ Py_ssize_t length, /* size of string */ const char *errors, /* error handling */ Py_ssize_t *consumed /* bytes consumed */ ); PyAPI_FUNC(PyObject*) PyUnicode_AsUTF8String( PyObject *unicode /* Unicode object */ ); PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* number of Py_UNICODE chars to encode */ const char *errors /* error handling */ ); /* --- UTF-32 Codecs ------------------------------------------------------ */ /* Decodes length bytes from a UTF-32 encoded buffer string and returns the corresponding Unicode object. errors (if non-NULL) defines the error handling. It defaults to "strict". If byteorder is non-NULL, the decoder starts decoding using the given byte order: *byteorder == -1: little endian *byteorder == 0: native order *byteorder == 1: big endian In native mode, the first four bytes of the stream are checked for a BOM mark. If found, the BOM mark is analysed, the byte order adjusted and the BOM skipped. In the other modes, no BOM mark interpretation is done. After completion, *byteorder is set to the current byte order at the end of input data. If byteorder is NULL, the codec starts in native order mode. */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32( const char *string, /* UTF-32 encoded string */ Py_ssize_t length, /* size of string */ const char *errors, /* error handling */ int *byteorder /* pointer to byteorder to use 0=native;-1=LE,1=BE; updated on exit */ ); PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32Stateful( const char *string, /* UTF-32 encoded string */ Py_ssize_t length, /* size of string */ const char *errors, /* error handling */ int *byteorder, /* pointer to byteorder to use 0=native;-1=LE,1=BE; updated on exit */ Py_ssize_t *consumed /* bytes consumed */ ); /* Returns a Python string using the UTF-32 encoding in native byte order. The string always starts with a BOM mark. */ PyAPI_FUNC(PyObject*) PyUnicode_AsUTF32String( PyObject *unicode /* Unicode object */ ); /* Returns a Python string object holding the UTF-32 encoded value of the Unicode data. If byteorder is not 0, output is written according to the following byte order: byteorder == -1: little endian byteorder == 0: native byte order (writes a BOM mark) byteorder == 1: big endian If byteorder is 0, the output string will always start with the Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark is prepended. */ PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* number of Py_UNICODE chars to encode */ const char *errors, /* error handling */ int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ ); /* --- UTF-16 Codecs ------------------------------------------------------ */ /* Decodes length bytes from a UTF-16 encoded buffer string and returns the corresponding Unicode object. errors (if non-NULL) defines the error handling. It defaults to "strict". If byteorder is non-NULL, the decoder starts decoding using the given byte order: *byteorder == -1: little endian *byteorder == 0: native order *byteorder == 1: big endian In native mode, the first two bytes of the stream are checked for a BOM mark. If found, the BOM mark is analysed, the byte order adjusted and the BOM skipped. In the other modes, no BOM mark interpretation is done. After completion, *byteorder is set to the current byte order at the end of input data. If byteorder is NULL, the codec starts in native order mode. */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16( const char *string, /* UTF-16 encoded string */ Py_ssize_t length, /* size of string */ const char *errors, /* error handling */ int *byteorder /* pointer to byteorder to use 0=native;-1=LE,1=BE; updated on exit */ ); PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16Stateful( const char *string, /* UTF-16 encoded string */ Py_ssize_t length, /* size of string */ const char *errors, /* error handling */ int *byteorder, /* pointer to byteorder to use 0=native;-1=LE,1=BE; updated on exit */ Py_ssize_t *consumed /* bytes consumed */ ); /* Returns a Python string using the UTF-16 encoding in native byte order. The string always starts with a BOM mark. */ PyAPI_FUNC(PyObject*) PyUnicode_AsUTF16String( PyObject *unicode /* Unicode object */ ); /* Returns a Python string object holding the UTF-16 encoded value of the Unicode data. If byteorder is not 0, output is written according to the following byte order: byteorder == -1: little endian byteorder == 0: native byte order (writes a BOM mark) byteorder == 1: big endian If byteorder is 0, the output string will always start with the Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark is prepended. Note that Py_UNICODE data is being interpreted as UTF-16 reduced to UCS-2. This trick makes it possible to add full UTF-16 capabilities at a later point without compromising the APIs. */ PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* number of Py_UNICODE chars to encode */ const char *errors, /* error handling */ int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ ); /* --- Unicode-Escape Codecs ---------------------------------------------- */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape( const char *string, /* Unicode-Escape encoded string */ Py_ssize_t length, /* size of string */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString( PyObject *unicode /* Unicode object */ ); PyAPI_FUNC(PyObject*) PyUnicode_EncodeUnicodeEscape( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length /* Number of Py_UNICODE chars to encode */ ); /* --- Raw-Unicode-Escape Codecs ------------------------------------------ */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeRawUnicodeEscape( const char *string, /* Raw-Unicode-Escape encoded string */ Py_ssize_t length, /* size of string */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_AsRawUnicodeEscapeString( PyObject *unicode /* Unicode object */ ); PyAPI_FUNC(PyObject*) PyUnicode_EncodeRawUnicodeEscape( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length /* Number of Py_UNICODE chars to encode */ ); /* --- Unicode Internal Codec --------------------------------------------- Only for internal use in _codecsmodule.c */ PyObject *_PyUnicode_DecodeUnicodeInternal( const char *string, Py_ssize_t length, const char *errors ); /* --- Latin-1 Codecs ----------------------------------------------------- Note: Latin-1 corresponds to the first 256 Unicode ordinals. */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeLatin1( const char *string, /* Latin-1 encoded string */ Py_ssize_t length, /* size of string */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_AsLatin1String( PyObject *unicode /* Unicode object */ ); PyAPI_FUNC(PyObject*) PyUnicode_EncodeLatin1( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ const char *errors /* error handling */ ); /* --- ASCII Codecs ------------------------------------------------------- Only 7-bit ASCII data is excepted. All other codes generate errors. */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeASCII( const char *string, /* ASCII encoded string */ Py_ssize_t length, /* size of string */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_AsASCIIString( PyObject *unicode /* Unicode object */ ); PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ const char *errors /* error handling */ ); /* --- Character Map Codecs ----------------------------------------------- This codec uses mappings to encode and decode characters. Decoding mappings must map single string characters to single Unicode characters, integers (which are then interpreted as Unicode ordinals) or None (meaning "undefined mapping" and causing an error). Encoding mappings must map single Unicode characters to single string characters, integers (which are then interpreted as Latin-1 ordinals) or None (meaning "undefined mapping" and causing an error). If a character lookup fails with a LookupError, the character is copied as-is meaning that its ordinal value will be interpreted as Unicode or Latin-1 ordinal resp. Because of this mappings only need to contain those mappings which map characters to different code points. */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeCharmap( const char *string, /* Encoded string */ Py_ssize_t length, /* size of string */ PyObject *mapping, /* character mapping (char ordinal -> unicode ordinal) */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_AsCharmapString( PyObject *unicode, /* Unicode object */ PyObject *mapping /* character mapping (unicode ordinal -> char ordinal) */ ); PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ PyObject *mapping, /* character mapping (unicode ordinal -> char ordinal) */ const char *errors /* error handling */ ); /* Translate a Py_UNICODE buffer of the given length by applying a character mapping table to it and return the resulting Unicode object. The mapping table must map Unicode ordinal integers to Unicode ordinal integers or None (causing deletion of the character). Mapping tables may be dictionaries or sequences. Unmapped character ordinals (ones which cause a LookupError) are left untouched and are copied as-is. */ PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ PyObject *table, /* Translate table */ const char *errors /* error handling */ ); #ifdef MS_WIN32 /* --- MBCS codecs for Windows -------------------------------------------- */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCS( const char *string, /* MBCS encoded string */ Py_ssize_t length, /* size of string */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCSStateful( const char *string, /* MBCS encoded string */ Py_ssize_t length, /* size of string */ const char *errors, /* error handling */ Py_ssize_t *consumed /* bytes consumed */ ); PyAPI_FUNC(PyObject*) PyUnicode_AsMBCSString( PyObject *unicode /* Unicode object */ ); PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ const char *errors /* error handling */ ); #endif /* MS_WIN32 */ /* --- Decimal Encoder ---------------------------------------------------- */ /* Takes a Unicode string holding a decimal value and writes it into an output buffer using standard ASCII digit codes. The output buffer has to provide at least length+1 bytes of storage area. The output string is 0-terminated. The encoder converts whitespace to ' ', decimal characters to their corresponding ASCII digit and all other Latin-1 characters except \0 as-is. Characters outside this range (Unicode ordinals 1-256) are treated as errors. This includes embedded NULL bytes. Error handling is defined by the errors argument: NULL or "strict": raise a ValueError "ignore": ignore the wrong characters (these are not copied to the output buffer) "replace": replaces illegal characters with '?' Returns 0 on success, -1 on failure. */ PyAPI_FUNC(int) PyUnicode_EncodeDecimal( Py_UNICODE *s, /* Unicode buffer */ Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ char *output, /* Output buffer; must have size >= length */ const char *errors /* error handling */ ); /* --- Methods & Slots ---------------------------------------------------- These are capable of handling Unicode objects and strings on input (we refer to them as strings in the descriptions) and return Unicode objects or integers as apporpriate. */ /* Concat two strings giving a new Unicode string. */ PyAPI_FUNC(PyObject*) PyUnicode_Concat( PyObject *left, /* Left string */ PyObject *right /* Right string */ ); /* Split a string giving a list of Unicode strings. If sep is NULL, splitting will be done at all whitespace substrings. Otherwise, splits occur at the given separator. At most maxsplit splits will be done. If negative, no limit is set. Separators are not included in the resulting list. */ PyAPI_FUNC(PyObject*) PyUnicode_Split( PyObject *s, /* String to split */ PyObject *sep, /* String separator */ Py_ssize_t maxsplit /* Maxsplit count */ ); /* Dito, but split at line breaks. CRLF is considered to be one line break. Line breaks are not included in the resulting list. */ PyAPI_FUNC(PyObject*) PyUnicode_Splitlines( PyObject *s, /* String to split */ int keepends /* If true, line end markers are included */ ); /* Partition a string using a given separator. */ PyAPI_FUNC(PyObject*) PyUnicode_Partition( PyObject *s, /* String to partition */ PyObject *sep /* String separator */ ); /* Partition a string using a given separator, searching from the end of the string. */ PyAPI_FUNC(PyObject*) PyUnicode_RPartition( PyObject *s, /* String to partition */ PyObject *sep /* String separator */ ); /* Split a string giving a list of Unicode strings. If sep is NULL, splitting will be done at all whitespace substrings. Otherwise, splits occur at the given separator. At most maxsplit splits will be done. But unlike PyUnicode_Split PyUnicode_RSplit splits from the end of the string. If negative, no limit is set. Separators are not included in the resulting list. */ PyAPI_FUNC(PyObject*) PyUnicode_RSplit( PyObject *s, /* String to split */ PyObject *sep, /* String separator */ Py_ssize_t maxsplit /* Maxsplit count */ ); /* Translate a string by applying a character mapping table to it and return the resulting Unicode object. The mapping table must map Unicode ordinal integers to Unicode ordinal integers or None (causing deletion of the character). Mapping tables may be dictionaries or sequences. Unmapped character ordinals (ones which cause a LookupError) are left untouched and are copied as-is. */ PyAPI_FUNC(PyObject *) PyUnicode_Translate( PyObject *str, /* String */ PyObject *table, /* Translate table */ const char *errors /* error handling */ ); /* Join a sequence of strings using the given separator and return the resulting Unicode string. */ PyAPI_FUNC(PyObject*) PyUnicode_Join( PyObject *separator, /* Separator string */ PyObject *seq /* Sequence object */ ); /* Return 1 if substr matches str[start:end] at the given tail end, 0 otherwise. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_Tailmatch( PyObject *str, /* String */ PyObject *substr, /* Prefix or Suffix string */ Py_ssize_t start, /* Start index */ Py_ssize_t end, /* Stop index */ int direction /* Tail end: -1 prefix, +1 suffix */ ); /* Return the first position of substr in str[start:end] using the given search direction or -1 if not found. -2 is returned in case an error occurred and an exception is set. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_Find( PyObject *str, /* String */ PyObject *substr, /* Substring to find */ Py_ssize_t start, /* Start index */ Py_ssize_t end, /* Stop index */ int direction /* Find direction: +1 forward, -1 backward */ ); /* Count the number of occurrences of substr in str[start:end]. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_Count( PyObject *str, /* String */ PyObject *substr, /* Substring to count */ Py_ssize_t start, /* Start index */ Py_ssize_t end /* Stop index */ ); /* Replace at most maxcount occurrences of substr in str with replstr and return the resulting Unicode object. */ PyAPI_FUNC(PyObject *) PyUnicode_Replace( PyObject *str, /* String */ PyObject *substr, /* Substring to find */ PyObject *replstr, /* Substring to replace */ Py_ssize_t maxcount /* Max. number of replacements to apply; -1 = all */ ); /* Compare two strings and return -1, 0, 1 for less than, equal, greater than resp. */ PyAPI_FUNC(int) PyUnicode_Compare( PyObject *left, /* Left string */ PyObject *right /* Right string */ ); /* Rich compare two strings and return one of the following: - NULL in case an exception was raised - Py_True or Py_False for successfuly comparisons - Py_NotImplemented in case the type combination is unknown Note that Py_EQ and Py_NE comparisons can cause a UnicodeWarning in case the conversion of the arguments to Unicode fails with a UnicodeDecodeError. Possible values for op: Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE */ PyAPI_FUNC(PyObject *) PyUnicode_RichCompare( PyObject *left, /* Left string */ PyObject *right, /* Right string */ int op /* Operation: Py_EQ, Py_NE, Py_GT, etc. */ ); /* Apply a argument tuple or dictionary to a format string and return the resulting Unicode string. */ PyAPI_FUNC(PyObject *) PyUnicode_Format( PyObject *format, /* Format string */ PyObject *args /* Argument tuple or dictionary */ ); /* Checks whether element is contained in container and return 1/0 accordingly. element has to coerce to an one element Unicode string. -1 is returned in case of an error. */ PyAPI_FUNC(int) PyUnicode_Contains( PyObject *container, /* Container string */ PyObject *element /* Element string */ ); /* Externally visible for str.strip(unicode) */ PyAPI_FUNC(PyObject *) _PyUnicode_XStrip( PyUnicodeObject *self, int striptype, PyObject *sepobj ); /* === Characters Type APIs =============================================== */ /* Helper array used by Py_UNICODE_ISSPACE(). */ PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[]; /* These should not be used directly. Use the Py_UNICODE_IS* and Py_UNICODE_TO* macros instead. These APIs are implemented in Objects/unicodectype.c. */ PyAPI_FUNC(int) _PyUnicode_IsLowercase( Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsUppercase( Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsTitlecase( Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsWhitespace( const Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsLinebreak( const Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToLowercase( Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToUppercase( Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToTitlecase( Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_ToDecimalDigit( Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_ToDigit( Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(double) _PyUnicode_ToNumeric( Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsDecimalDigit( Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsDigit( Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsNumeric( Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsAlpha( Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(void) _PyUnicode_DebugMallocStats(FILE *out); #ifdef __cplusplus } #endif #endif /* Py_USING_UNICODE */ #endif /* !Py_UNICODEOBJECT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/pymacconfig.h�����������������������������������������������������������������������������0000644�����������������00000005654�14763166027�0011012 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef PYMACCONFIG_H #define PYMACCONFIG_H /* * This file moves some of the autoconf magic to compile-time * when building on MacOSX. This is needed for building 4-way * universal binaries and for 64-bit universal binaries because * the values redefined below aren't configure-time constant but * only compile-time constant in these scenarios. */ #if defined(__APPLE__) # undef SIZEOF_LONG # undef SIZEOF_PTHREAD_T # undef SIZEOF_SIZE_T # undef SIZEOF_TIME_T # undef SIZEOF_VOID_P # undef SIZEOF__BOOL # undef SIZEOF_UINTPTR_T # undef SIZEOF_PTHREAD_T # undef WORDS_BIGENDIAN # undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 # undef DOUBLE_IS_BIG_ENDIAN_IEEE754 # undef DOUBLE_IS_LITTLE_ENDIAN_IEEE754 # undef HAVE_GCC_ASM_FOR_X87 # undef VA_LIST_IS_ARRAY # if defined(__LP64__) && defined(__x86_64__) # define VA_LIST_IS_ARRAY 1 # endif # undef HAVE_LARGEFILE_SUPPORT # ifndef __LP64__ # define HAVE_LARGEFILE_SUPPORT 1 # endif # undef SIZEOF_LONG # ifdef __LP64__ # define SIZEOF__BOOL 1 # define SIZEOF__BOOL 1 # define SIZEOF_LONG 8 # define SIZEOF_PTHREAD_T 8 # define SIZEOF_SIZE_T 8 # define SIZEOF_TIME_T 8 # define SIZEOF_VOID_P 8 # define SIZEOF_UINTPTR_T 8 # define SIZEOF_PTHREAD_T 8 # else # ifdef __ppc__ # define SIZEOF__BOOL 4 # else # define SIZEOF__BOOL 1 # endif # define SIZEOF_LONG 4 # define SIZEOF_PTHREAD_T 4 # define SIZEOF_SIZE_T 4 # define SIZEOF_TIME_T 4 # define SIZEOF_VOID_P 4 # define SIZEOF_UINTPTR_T 4 # define SIZEOF_PTHREAD_T 4 # endif # if defined(__LP64__) /* MacOSX 10.4 (the first release to support 64-bit code * at all) only supports 64-bit in the UNIX layer. * Therefore surpress the toolbox-glue in 64-bit mode. */ /* In 64-bit mode setpgrp always has no argments, in 32-bit * mode that depends on the compilation environment */ # undef SETPGRP_HAVE_ARG # endif #ifdef __BIG_ENDIAN__ #define WORDS_BIGENDIAN 1 #define DOUBLE_IS_BIG_ENDIAN_IEEE754 #else #define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 #endif /* __BIG_ENDIAN */ #ifdef __i386__ # define HAVE_GCC_ASM_FOR_X87 #endif /* * The definition in pyconfig.h is only valid on the OS release * where configure ran on and not necessarily for all systems where * the executable can be used on. * * Specifically: OSX 10.4 has limited supported for '%zd', while * 10.5 has full support for '%zd'. A binary built on 10.5 won't * work properly on 10.4 unless we surpress the definition * of PY_FORMAT_SIZE_T */ #undef PY_FORMAT_SIZE_T #endif /* defined(_APPLE__) */ #endif /* PYMACCONFIG_H */ ������������������������������������������������������������������������������������python2.7/longobject.h������������������������������������������������������������������������������0000644�����������������00000013260�14763166027�0010631 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_LONGOBJECT_H #define Py_LONGOBJECT_H #ifdef __cplusplus extern "C" { #endif /* Long (arbitrary precision) integer object interface */ typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */ PyAPI_DATA(PyTypeObject) PyLong_Type; #define PyLong_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS) #define PyLong_CheckExact(op) (Py_TYPE(op) == &PyLong_Type) PyAPI_FUNC(PyObject *) PyLong_FromLong(long); PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLong(unsigned long); PyAPI_FUNC(PyObject *) PyLong_FromDouble(double); PyAPI_FUNC(PyObject *) PyLong_FromSize_t(size_t); PyAPI_FUNC(PyObject *) PyLong_FromSsize_t(Py_ssize_t); PyAPI_FUNC(long) PyLong_AsLong(PyObject *); PyAPI_FUNC(long) PyLong_AsLongAndOverflow(PyObject *, int *); PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *); PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *); PyAPI_FUNC(Py_ssize_t) PyLong_AsSsize_t(PyObject *); PyAPI_FUNC(int) _PyLong_AsInt(PyObject *); PyAPI_FUNC(PyObject *) PyLong_GetInfo(void); /* For use by intobject.c only */ #define _PyLong_AsSsize_t PyLong_AsSsize_t #define _PyLong_FromSize_t PyLong_FromSize_t #define _PyLong_FromSsize_t PyLong_FromSsize_t PyAPI_DATA(int) _PyLong_DigitValue[256]; /* _PyLong_Frexp returns a double x and an exponent e such that the true value is approximately equal to x * 2**e. e is >= 0. x is 0.0 if and only if the input is 0 (in which case, e and x are both zeroes); otherwise, 0.5 <= abs(x) < 1.0. On overflow, which is possible if the number of bits doesn't fit into a Py_ssize_t, sets OverflowError and returns -1.0 for x, 0 for e. */ PyAPI_FUNC(double) _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e); PyAPI_FUNC(double) PyLong_AsDouble(PyObject *); PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *); PyAPI_FUNC(void *) PyLong_AsVoidPtr(PyObject *); #ifdef HAVE_LONG_LONG PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG); PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG); PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject *); PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *); PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *); PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *); #endif /* HAVE_LONG_LONG */ PyAPI_FUNC(PyObject *) PyLong_FromString(char *, char **, int); #ifdef Py_USING_UNICODE PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int); #endif /* _PyLong_Sign. Return 0 if v is 0, -1 if v < 0, +1 if v > 0. v must not be NULL, and must be a normalized long. There are no error cases. */ PyAPI_FUNC(int) _PyLong_Sign(PyObject *v); /* _PyLong_NumBits. Return the number of bits needed to represent the absolute value of a long. For example, this returns 1 for 1 and -1, 2 for 2 and -2, and 2 for 3 and -3. It returns 0 for 0. v must not be NULL, and must be a normalized long. (size_t)-1 is returned and OverflowError set if the true result doesn't fit in a size_t. */ PyAPI_FUNC(size_t) _PyLong_NumBits(PyObject *v); /* _PyLong_FromByteArray: View the n unsigned bytes as a binary integer in base 256, and return a Python long with the same numeric value. If n is 0, the integer is 0. Else: If little_endian is 1/true, bytes[n-1] is the MSB and bytes[0] the LSB; else (little_endian is 0/false) bytes[0] is the MSB and bytes[n-1] the LSB. If is_signed is 0/false, view the bytes as a non-negative integer. If is_signed is 1/true, view the bytes as a 2's-complement integer, non-negative if bit 0x80 of the MSB is clear, negative if set. Error returns: + Return NULL with the appropriate exception set if there's not enough memory to create the Python long. */ PyAPI_FUNC(PyObject *) _PyLong_FromByteArray( const unsigned char* bytes, size_t n, int little_endian, int is_signed); /* _PyLong_AsByteArray: Convert the least-significant 8*n bits of long v to a base-256 integer, stored in array bytes. Normally return 0, return -1 on error. If little_endian is 1/true, store the MSB at bytes[n-1] and the LSB at bytes[0]; else (little_endian is 0/false) store the MSB at bytes[0] and the LSB at bytes[n-1]. If is_signed is 0/false, it's an error if v < 0; else (v >= 0) n bytes are filled and there's nothing special about bit 0x80 of the MSB. If is_signed is 1/true, bytes is filled with the 2's-complement representation of v's value. Bit 0x80 of the MSB is the sign bit. Error returns (-1): + is_signed is 0 and v < 0. TypeError is set in this case, and bytes isn't altered. + n isn't big enough to hold the full mathematical value of v. For example, if is_signed is 0 and there are more digits in the v than fit in n; or if is_signed is 1, v < 0, and n is just 1 bit shy of being large enough to hold a sign bit. OverflowError is set in this case, but bytes holds the least-signficant n bytes of the true value. */ PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v, unsigned char* bytes, size_t n, int little_endian, int is_signed); /* _PyLong_Format: Convert the long to a string object with given base, appending a base prefix of 0[box] if base is 2, 8 or 16. Add a trailing "L" if addL is non-zero. If newstyle is zero, then use the pre-2.6 behavior of octal having a leading "0", instead of the prefix "0o" */ PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *aa, int base, int addL, int newstyle); /* Format the object based on the format_spec, as defined in PEP 3101 (Advanced String Formatting). */ PyAPI_FUNC(PyObject *) _PyLong_FormatAdvanced(PyObject *obj, char *format_spec, Py_ssize_t format_spec_len); #ifdef __cplusplus } #endif #endif /* !Py_LONGOBJECT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/stringobject.h����������������������������������������������������������������������������0000644�����������������00000017456�14763166027�0011213 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* String (str/bytes) object interface */ #ifndef Py_STRINGOBJECT_H #define Py_STRINGOBJECT_H #ifdef __cplusplus extern "C" { #endif #include <stdarg.h> /* Type PyStringObject represents a character string. An extra zero byte is reserved at the end to ensure it is zero-terminated, but a size is present so strings with null bytes in them can be represented. This is an immutable object type. There are functions to create new string objects, to test an object for string-ness, and to get the string value. The latter function returns a null pointer if the object is not of the proper type. There is a variant that takes an explicit size as well as a variant that assumes a zero-terminated string. Note that none of the functions should be applied to nil objects. */ /* Caching the hash (ob_shash) saves recalculation of a string's hash value. Interning strings (ob_sstate) tries to ensure that only one string object with a given value exists, so equality tests can be one pointer comparison. This is generally restricted to strings that "look like" Python identifiers, although the intern() builtin can be used to force interning of any string. Together, these sped the interpreter by up to 20%. */ typedef struct { PyObject_VAR_HEAD long ob_shash; int ob_sstate; char ob_sval[1]; /* Invariants: * ob_sval contains space for 'ob_size+1' elements. * ob_sval[ob_size] == 0. * ob_shash is the hash of the string or -1 if not computed yet. * ob_sstate != 0 iff the string object is in stringobject.c's * 'interned' dictionary; in this case the two references * from 'interned' to this object are *not counted* in ob_refcnt. */ } PyStringObject; #define SSTATE_NOT_INTERNED 0 #define SSTATE_INTERNED_MORTAL 1 #define SSTATE_INTERNED_IMMORTAL 2 PyAPI_DATA(PyTypeObject) PyBaseString_Type; PyAPI_DATA(PyTypeObject) PyString_Type; #define PyString_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_STRING_SUBCLASS) #define PyString_CheckExact(op) (Py_TYPE(op) == &PyString_Type) PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t); PyAPI_FUNC(PyObject *) PyString_FromString(const char *); PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char*, va_list) Py_GCC_ATTRIBUTE((format(printf, 1, 0))); PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...) Py_GCC_ATTRIBUTE((format(printf, 1, 2))); PyAPI_FUNC(Py_ssize_t) PyString_Size(PyObject *); PyAPI_FUNC(char *) PyString_AsString(PyObject *); PyAPI_FUNC(PyObject *) PyString_Repr(PyObject *, int); PyAPI_FUNC(void) PyString_Concat(PyObject **, PyObject *); PyAPI_FUNC(void) PyString_ConcatAndDel(PyObject **, PyObject *); PyAPI_FUNC(int) _PyString_Resize(PyObject **, Py_ssize_t); PyAPI_FUNC(int) _PyString_Eq(PyObject *, PyObject*); PyAPI_FUNC(PyObject *) PyString_Format(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) _PyString_FormatLong(PyObject*, int, int, int, char**, int*); PyAPI_FUNC(PyObject *) PyString_DecodeEscape(const char *, Py_ssize_t, const char *, Py_ssize_t, const char *); PyAPI_FUNC(void) PyString_InternInPlace(PyObject **); PyAPI_FUNC(void) PyString_InternImmortal(PyObject **); PyAPI_FUNC(PyObject *) PyString_InternFromString(const char *); PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void); /* Use only if you know it's a string */ #define PyString_CHECK_INTERNED(op) (((PyStringObject *)(op))->ob_sstate) /* Macro, trading safety for speed */ #define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval) #define PyString_GET_SIZE(op) Py_SIZE(op) /* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*, x must be an iterable object. */ PyAPI_FUNC(PyObject *) _PyString_Join(PyObject *sep, PyObject *x); /* --- Generic Codecs ----------------------------------------------------- */ /* Create an object by decoding the encoded string s of the given size. */ PyAPI_FUNC(PyObject*) PyString_Decode( const char *s, /* encoded string */ Py_ssize_t size, /* size of buffer */ const char *encoding, /* encoding */ const char *errors /* error handling */ ); /* Encodes a char buffer of the given size and returns a Python object. */ PyAPI_FUNC(PyObject*) PyString_Encode( const char *s, /* string char buffer */ Py_ssize_t size, /* number of chars to encode */ const char *encoding, /* encoding */ const char *errors /* error handling */ ); /* Encodes a string object and returns the result as Python object. */ PyAPI_FUNC(PyObject*) PyString_AsEncodedObject( PyObject *str, /* string object */ const char *encoding, /* encoding */ const char *errors /* error handling */ ); /* Encodes a string object and returns the result as Python string object. If the codec returns an Unicode object, the object is converted back to a string using the default encoding. DEPRECATED - use PyString_AsEncodedObject() instead. */ PyAPI_FUNC(PyObject*) PyString_AsEncodedString( PyObject *str, /* string object */ const char *encoding, /* encoding */ const char *errors /* error handling */ ); /* Decodes a string object and returns the result as Python object. */ PyAPI_FUNC(PyObject*) PyString_AsDecodedObject( PyObject *str, /* string object */ const char *encoding, /* encoding */ const char *errors /* error handling */ ); /* Decodes a string object and returns the result as Python string object. If the codec returns an Unicode object, the object is converted back to a string using the default encoding. DEPRECATED - use PyString_AsDecodedObject() instead. */ PyAPI_FUNC(PyObject*) PyString_AsDecodedString( PyObject *str, /* string object */ const char *encoding, /* encoding */ const char *errors /* error handling */ ); /* Provides access to the internal data buffer and size of a string object or the default encoded version of an Unicode object. Passing NULL as *len parameter will force the string buffer to be 0-terminated (passing a string with embedded NULL characters will cause an exception). */ PyAPI_FUNC(int) PyString_AsStringAndSize( register PyObject *obj, /* string or Unicode object */ register char **s, /* pointer to buffer variable */ register Py_ssize_t *len /* pointer to length variable or NULL (only possible for 0-terminated strings) */ ); /* Using the current locale, insert the thousands grouping into the string pointed to by buffer. For the argument descriptions, see Objects/stringlib/localeutil.h */ PyAPI_FUNC(Py_ssize_t) _PyString_InsertThousandsGroupingLocale(char *buffer, Py_ssize_t n_buffer, char *digits, Py_ssize_t n_digits, Py_ssize_t min_width); /* Using explicit passed-in values, insert the thousands grouping into the string pointed to by buffer. For the argument descriptions, see Objects/stringlib/localeutil.h */ PyAPI_FUNC(Py_ssize_t) _PyString_InsertThousandsGrouping(char *buffer, Py_ssize_t n_buffer, char *digits, Py_ssize_t n_digits, Py_ssize_t min_width, const char *grouping, const char *thousands_sep); /* Format the object based on the format_spec, as defined in PEP 3101 (Advanced String Formatting). */ PyAPI_FUNC(PyObject *) _PyBytes_FormatAdvanced(PyObject *obj, char *format_spec, Py_ssize_t format_spec_len); PyAPI_FUNC(void) _PyString_DebugMallocStats(FILE *out); #ifdef __cplusplus } #endif #endif /* !Py_STRINGOBJECT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/memoryobject.h����������������������������������������������������������������������������0000644�����������������00000005411�14763166027�0011201 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Memory view object. In Python this is available as "memoryview". */ #ifndef Py_MEMORYOBJECT_H #define Py_MEMORYOBJECT_H #ifdef __cplusplus extern "C" { #endif PyAPI_DATA(PyTypeObject) PyMemoryView_Type; #define PyMemoryView_Check(op) (Py_TYPE(op) == &PyMemoryView_Type) /* Get a pointer to the underlying Py_buffer of a memoryview object. */ #define PyMemoryView_GET_BUFFER(op) (&((PyMemoryViewObject *)(op))->view) /* Get a pointer to the PyObject from which originates a memoryview object. */ #define PyMemoryView_GET_BASE(op) (((PyMemoryViewObject *)(op))->view.obj) PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base, int buffertype, char fort); /* Return a contiguous chunk of memory representing the buffer from an object in a memory view object. If a copy is made then the base object for the memory view will be a *new* bytes object. Otherwise, the base-object will be the object itself and no data-copying will be done. The buffertype argument can be PyBUF_READ, PyBUF_WRITE, PyBUF_SHADOW to determine whether the returned buffer should be READONLY, WRITABLE, or set to update the original buffer if a copy must be made. If buffertype is PyBUF_WRITE and the buffer is not contiguous an error will be raised. In this circumstance, the user can use PyBUF_SHADOW to ensure that a a writable temporary contiguous buffer is returned. The contents of this contiguous buffer will be copied back into the original object after the memoryview object is deleted as long as the original object is writable and allows setting an exclusive write lock. If this is not allowed by the original object, then a BufferError is raised. If the object is multi-dimensional and if fortran is 'F', the first dimension of the underlying array will vary the fastest in the buffer. If fortran is 'C', then the last dimension will vary the fastest (C-style contiguous). If fortran is 'A', then it does not matter and you will get whatever the object decides is more efficient. A new reference is returned that must be DECREF'd when finished. */ PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base); PyAPI_FUNC(PyObject *) PyMemoryView_FromBuffer(Py_buffer *info); /* create new if bufptr is NULL will be a new bytesobject in base */ /* The struct is declared here so that macros can work, but it shouldn't be considered public. Don't access those fields directly, use the macros and functions instead! */ typedef struct { PyObject_HEAD PyObject *base; Py_buffer view; } PyMemoryViewObject; #ifdef __cplusplus } #endif #endif /* !Py_MEMORYOBJECT_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/code.h������������������������������������������������������������������������������������0000644�����������������00000007467�14763166027�0007431 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Definitions for bytecode */ #ifndef Py_CODE_H #define Py_CODE_H #ifdef __cplusplus extern "C" { #endif /* Bytecode object */ typedef struct { PyObject_HEAD int co_argcount; /* #arguments, except *args */ int co_nlocals; /* #local variables */ int co_stacksize; /* #entries needed for evaluation stack */ int co_flags; /* CO_..., see below */ PyObject *co_code; /* instruction opcodes */ PyObject *co_consts; /* list (constants used) */ PyObject *co_names; /* list of strings (names used) */ PyObject *co_varnames; /* tuple of strings (local variable names) */ PyObject *co_freevars; /* tuple of strings (free variable names) */ PyObject *co_cellvars; /* tuple of strings (cell variable names) */ /* The rest doesn't count for hash/cmp */ PyObject *co_filename; /* string (where it was loaded from) */ PyObject *co_name; /* string (name, for reference) */ int co_firstlineno; /* first source line number */ PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) See Objects/lnotab_notes.txt for details. */ void *co_zombieframe; /* for optimization only (see frameobject.c) */ PyObject *co_weakreflist; /* to support weakrefs to code objects */ } PyCodeObject; /* Masks for co_flags above */ #define CO_OPTIMIZED 0x0001 #define CO_NEWLOCALS 0x0002 #define CO_VARARGS 0x0004 #define CO_VARKEYWORDS 0x0008 #define CO_NESTED 0x0010 #define CO_GENERATOR 0x0020 /* The CO_NOFREE flag is set if there are no free or cell variables. This information is redundant, but it allows a single flag test to determine whether there is any extra work to be done when the call frame it setup. */ #define CO_NOFREE 0x0040 #if 0 /* This is no longer used. Stopped defining in 2.5, do not re-use. */ #define CO_GENERATOR_ALLOWED 0x1000 #endif #define CO_FUTURE_DIVISION 0x2000 #define CO_FUTURE_ABSOLUTE_IMPORT 0x4000 /* do absolute imports by default */ #define CO_FUTURE_WITH_STATEMENT 0x8000 #define CO_FUTURE_PRINT_FUNCTION 0x10000 #define CO_FUTURE_UNICODE_LITERALS 0x20000 /* This should be defined if a future statement modifies the syntax. For example, when a keyword is added. */ #if 1 #define PY_PARSER_REQUIRES_FUTURE_KEYWORD #endif #define CO_MAXBLOCKS 20 /* Max static block nesting within a function */ PyAPI_DATA(PyTypeObject) PyCode_Type; #define PyCode_Check(op) (Py_TYPE(op) == &PyCode_Type) #define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars)) /* Public interface */ PyAPI_FUNC(PyCodeObject *) PyCode_New( int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *); /* same as struct above */ /* Creates a new empty code object with the specified source location. */ PyAPI_FUNC(PyCodeObject *) PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno); /* Return the line number associated with the specified bytecode index in this code object. If you just need the line number of a frame, use PyFrame_GetLineNumber() instead. */ PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int); /* for internal use only */ #define _PyCode_GETCODEPTR(co, pp) \ ((*Py_TYPE((co)->co_code)->tp_as_buffer->bf_getreadbuffer) \ ((co)->co_code, 0, (void **)(pp))) typedef struct _addr_pair { int ap_lower; int ap_upper; } PyAddrPair; /* Update *bounds to describe the first and one-past-the-last instructions in the same line as lasti. Return the number of that line. */ PyAPI_FUNC(int) _PyCode_CheckLineNumber(PyCodeObject* co, int lasti, PyAddrPair *bounds); PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, PyObject *lineno_obj); #ifdef __cplusplus } #endif #endif /* !Py_CODE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/ceval.h�����������������������������������������������������������������������������������0000644�����������������00000011572�14763166027�0007601 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_CEVAL_H #define Py_CEVAL_H #ifdef __cplusplus extern "C" { #endif /* Interface to random parts in ceval.c */ PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords( PyObject *, PyObject *, PyObject *); /* Inline this */ #define PyEval_CallObject(func,arg) \ PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL) PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj, const char *format, ...); PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj, const char *methodname, const char *format, ...); PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *); PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *); struct _frame; /* Avoid including frameobject.h */ PyAPI_FUNC(PyObject *) PyEval_GetBuiltins(void); PyAPI_FUNC(PyObject *) PyEval_GetGlobals(void); PyAPI_FUNC(PyObject *) PyEval_GetLocals(void); PyAPI_FUNC(struct _frame *) PyEval_GetFrame(void); PyAPI_FUNC(int) PyEval_GetRestricted(void); /* Look at the current frame's (if any) code's co_flags, and turn on the corresponding compiler flags in cf->cf_flags. Return 1 if any flag was set, else return 0. */ PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf); PyAPI_FUNC(int) Py_FlushLine(void); PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg); PyAPI_FUNC(int) Py_MakePendingCalls(void); /* Protection against deeply nested recursive calls */ PyAPI_FUNC(void) Py_SetRecursionLimit(int); PyAPI_FUNC(int) Py_GetRecursionLimit(void); #define Py_EnterRecursiveCall(where) \ (_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \ _Py_CheckRecursiveCall(where)) #define Py_LeaveRecursiveCall() \ (--PyThreadState_GET()->recursion_depth) PyAPI_FUNC(int) _Py_CheckRecursiveCall(char *where); PyAPI_DATA(int) _Py_CheckRecursionLimit; #ifdef USE_STACKCHECK # define _Py_MakeRecCheck(x) (++(x) > --_Py_CheckRecursionLimit) #else # define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit) #endif PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject *); PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject *); PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *); PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *); PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(struct _frame *f, int exc); /* this used to be handled on a per-thread basis - now just two globals */ PyAPI_DATA(volatile int) _Py_Ticker; PyAPI_DATA(int) _Py_CheckInterval; /* Interface for threads. A module that plans to do a blocking system call (or something else that lasts a long time and doesn't touch Python data) can allow other threads to run as follows: ...preparations here... Py_BEGIN_ALLOW_THREADS ...blocking system call here... Py_END_ALLOW_THREADS ...interpret result here... The Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS pair expands to a {}-surrounded block. To leave the block in the middle (e.g., with return), you must insert a line containing Py_BLOCK_THREADS before the return, e.g. if (...premature_exit...) { Py_BLOCK_THREADS PyErr_SetFromErrno(PyExc_IOError); return NULL; } An alternative is: Py_BLOCK_THREADS if (...premature_exit...) { PyErr_SetFromErrno(PyExc_IOError); return NULL; } Py_UNBLOCK_THREADS For convenience, that the value of 'errno' is restored across Py_END_ALLOW_THREADS and Py_BLOCK_THREADS. WARNING: NEVER NEST CALLS TO Py_BEGIN_ALLOW_THREADS AND Py_END_ALLOW_THREADS!!! The function PyEval_InitThreads() should be called only from initthread() in "threadmodule.c". Note that not yet all candidates have been converted to use this mechanism! */ PyAPI_FUNC(PyThreadState *) PyEval_SaveThread(void); PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *); #ifdef WITH_THREAD PyAPI_FUNC(int) PyEval_ThreadsInitialized(void); PyAPI_FUNC(void) PyEval_InitThreads(void); PyAPI_FUNC(void) PyEval_AcquireLock(void); PyAPI_FUNC(void) PyEval_ReleaseLock(void); PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate); PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate); PyAPI_FUNC(void) PyEval_ReInitThreads(void); #define Py_BEGIN_ALLOW_THREADS { \ PyThreadState *_save; \ _save = PyEval_SaveThread(); #define Py_BLOCK_THREADS PyEval_RestoreThread(_save); #define Py_UNBLOCK_THREADS _save = PyEval_SaveThread(); #define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \ } #else /* !WITH_THREAD */ #define Py_BEGIN_ALLOW_THREADS { #define Py_BLOCK_THREADS #define Py_UNBLOCK_THREADS #define Py_END_ALLOW_THREADS } #endif /* !WITH_THREAD */ PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *); #ifdef __cplusplus } #endif #endif /* !Py_CEVAL_H */ ��������������������������������������������������������������������������������������������������������������������������������������python2.7/parsetok.h��������������������������������������������������������������������������������0000644�����������������00000003364�14763166027�0010337 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Parser-tokenizer link interface */ #ifndef Py_PARSETOK_H #define Py_PARSETOK_H #ifdef __cplusplus extern "C" { #endif typedef struct { int error; const char *filename; int lineno; int offset; char *text; int token; int expected; } perrdetail; #if 0 #define PyPARSE_YIELD_IS_KEYWORD 0x0001 #endif #define PyPARSE_DONT_IMPLY_DEDENT 0x0002 #if 0 #define PyPARSE_WITH_IS_KEYWORD 0x0003 #endif #define PyPARSE_PRINT_IS_FUNCTION 0x0004 #define PyPARSE_UNICODE_LITERALS 0x0008 PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int, perrdetail *); PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int, char *, char *, perrdetail *); PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int, perrdetail *, int); PyAPI_FUNC(node *) PyParser_ParseFileFlags(FILE *, const char *, grammar *, int, char *, char *, perrdetail *, int); PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx(FILE *, const char *, grammar *, int, char *, char *, perrdetail *, int *); PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(const char *, const char *, grammar *, int, perrdetail *, int); PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilenameEx(const char *, const char *, grammar *, int, perrdetail *, int *); /* Note that he following function is defined in pythonrun.c not parsetok.c. */ PyAPI_FUNC(void) PyParser_SetError(perrdetail *); #ifdef __cplusplus } #endif #endif /* !Py_PARSETOK_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/iterobject.h������������������������������������������������������������������������������0000644�����������������00000001012�14763166027�0010625 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_ITEROBJECT_H #define Py_ITEROBJECT_H /* Iterators (the basic kind, over a sequence) */ #ifdef __cplusplus extern "C" { #endif PyAPI_DATA(PyTypeObject) PySeqIter_Type; #define PySeqIter_Check(op) (Py_TYPE(op) == &PySeqIter_Type) PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *); PyAPI_DATA(PyTypeObject) PyCallIter_Type; #define PyCallIter_Check(op) (Py_TYPE(op) == &PyCallIter_Type) PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *); #ifdef __cplusplus } #endif #endif /* !Py_ITEROBJECT_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/bytearrayobject.h�������������������������������������������������������������������������0000644�����������������00000003625�14763166027�0011700 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ByteArray object interface */ #ifndef Py_BYTEARRAYOBJECT_H #define Py_BYTEARRAYOBJECT_H #ifdef __cplusplus extern "C" { #endif #include <stdarg.h> /* Type PyByteArrayObject represents a mutable array of bytes. * The Python API is that of a sequence; * the bytes are mapped to ints in [0, 256). * Bytes are not characters; they may be used to encode characters. * The only way to go between bytes and str/unicode is via encoding * and decoding. * For the convenience of C programmers, the bytes type is considered * to contain a char pointer, not an unsigned char pointer. */ /* Object layout */ typedef struct { PyObject_VAR_HEAD /* XXX(nnorwitz): should ob_exports be Py_ssize_t? */ int ob_exports; /* how many buffer exports */ Py_ssize_t ob_alloc; /* How many bytes allocated */ char *ob_bytes; } PyByteArrayObject; /* Type object */ PyAPI_DATA(PyTypeObject) PyByteArray_Type; PyAPI_DATA(PyTypeObject) PyByteArrayIter_Type; /* Type check macros */ #define PyByteArray_Check(self) PyObject_TypeCheck(self, &PyByteArray_Type) #define PyByteArray_CheckExact(self) (Py_TYPE(self) == &PyByteArray_Type) /* Direct API functions */ PyAPI_FUNC(PyObject *) PyByteArray_FromObject(PyObject *); PyAPI_FUNC(PyObject *) PyByteArray_Concat(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyByteArray_FromStringAndSize(const char *, Py_ssize_t); PyAPI_FUNC(Py_ssize_t) PyByteArray_Size(PyObject *); PyAPI_FUNC(char *) PyByteArray_AsString(PyObject *); PyAPI_FUNC(int) PyByteArray_Resize(PyObject *, Py_ssize_t); /* Macros, trading safety for speed */ #define PyByteArray_AS_STRING(self) \ (assert(PyByteArray_Check(self)), \ Py_SIZE(self) ? ((PyByteArrayObject *)(self))->ob_bytes : _PyByteArray_empty_string) #define PyByteArray_GET_SIZE(self) (assert(PyByteArray_Check(self)),Py_SIZE(self)) PyAPI_DATA(char) _PyByteArray_empty_string[]; #ifdef __cplusplus } #endif #endif /* !Py_BYTEARRAYOBJECT_H */ �����������������������������������������������������������������������������������������������������������python2.7/pyfpe.h�����������������������������������������������������������������������������������0000644�����������������00000020451�14763166027�0007626 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_PYFPE_H #define Py_PYFPE_H #ifdef __cplusplus extern "C" { #endif /* --------------------------------------------------------------------- / Copyright (c) 1996. \ | The Regents of the University of California. | | All rights reserved. | | | | Permission to use, copy, modify, and distribute this software for | | any purpose without fee is hereby granted, provided that this en- | | tire notice is included in all copies of any software which is or | | includes a copy or modification of this software and in all | | copies of the supporting documentation for such software. | | | | This work was produced at the University of California, Lawrence | | Livermore National Laboratory under contract no. W-7405-ENG-48 | | between the U.S. Department of Energy and The Regents of the | | University of California for the operation of UC LLNL. | | | | DISCLAIMER | | | | This software was prepared as an account of work sponsored by an | | agency of the United States Government. Neither the United States | | Government nor the University of California nor any of their em- | | ployees, makes any warranty, express or implied, or assumes any | | liability or responsibility for the accuracy, completeness, or | | usefulness of any information, apparatus, product, or process | | disclosed, or represents that its use would not infringe | | privately-owned rights. Reference herein to any specific commer- | | cial products, process, or service by trade name, trademark, | | manufacturer, or otherwise, does not necessarily constitute or | | imply its endorsement, recommendation, or favoring by the United | | States Government or the University of California. The views and | | opinions of authors expressed herein do not necessarily state or | | reflect those of the United States Government or the University | | of California, and shall not be used for advertising or product | \ endorsement purposes. / --------------------------------------------------------------------- */ /* * Define macros for handling SIGFPE. * Lee Busby, LLNL, November, 1996 * busby1@llnl.gov * ********************************************* * Overview of the system for handling SIGFPE: * * This file (Include/pyfpe.h) defines a couple of "wrapper" macros for * insertion into your Python C code of choice. Their proper use is * discussed below. The file Python/pyfpe.c defines a pair of global * variables PyFPE_jbuf and PyFPE_counter which are used by the signal * handler for SIGFPE to decide if a particular exception was protected * by the macros. The signal handler itself, and code for enabling the * generation of SIGFPE in the first place, is in a (new) Python module * named fpectl. This module is standard in every respect. It can be loaded * either statically or dynamically as you choose, and like any other * Python module, has no effect until you import it. * * In the general case, there are three steps toward handling SIGFPE in any * Python code: * * 1) Add the *_PROTECT macros to your C code as required to protect * dangerous floating point sections. * * 2) Turn on the inclusion of the code by adding the ``--with-fpectl'' * flag at the time you run configure. If the fpectl or other modules * which use the *_PROTECT macros are to be dynamically loaded, be * sure they are compiled with WANT_SIGFPE_HANDLER defined. * * 3) When python is built and running, import fpectl, and execute * fpectl.turnon_sigfpe(). This sets up the signal handler and enables * generation of SIGFPE whenever an exception occurs. From this point * on, any properly trapped SIGFPE should result in the Python * FloatingPointError exception. * * Step 1 has been done already for the Python kernel code, and should be * done soon for the NumPy array package. Step 2 is usually done once at * python install time. Python's behavior with respect to SIGFPE is not * changed unless you also do step 3. Thus you can control this new * facility at compile time, or run time, or both. * ******************************** * Using the macros in your code: * * static PyObject *foobar(PyObject *self,PyObject *args) * { * .... * PyFPE_START_PROTECT("Error in foobar", return 0) * result = dangerous_op(somearg1, somearg2, ...); * PyFPE_END_PROTECT(result) * .... * } * * If a floating point error occurs in dangerous_op, foobar returns 0 (NULL), * after setting the associated value of the FloatingPointError exception to * "Error in foobar". ``Dangerous_op'' can be a single operation, or a block * of code, function calls, or any combination, so long as no alternate * return is possible before the PyFPE_END_PROTECT macro is reached. * * The macros can only be used in a function context where an error return * can be recognized as signaling a Python exception. (Generally, most * functions that return a PyObject * will qualify.) * * Guido's original design suggestion for PyFPE_START_PROTECT and * PyFPE_END_PROTECT had them open and close a local block, with a locally * defined jmp_buf and jmp_buf pointer. This would allow recursive nesting * of the macros. The Ansi C standard makes it clear that such local * variables need to be declared with the "volatile" type qualifier to keep * setjmp from corrupting their values. Some current implementations seem * to be more restrictive. For example, the HPUX man page for setjmp says * * Upon the return from a setjmp() call caused by a longjmp(), the * values of any non-static local variables belonging to the routine * from which setjmp() was called are undefined. Code which depends on * such values is not guaranteed to be portable. * * I therefore decided on a more limited form of nesting, using a counter * variable (PyFPE_counter) to keep track of any recursion. If an exception * occurs in an ``inner'' pair of macros, the return will apparently * come from the outermost level. * */ #ifdef WANT_SIGFPE_HANDLER #include <signal.h> #include <setjmp.h> #include <math.h> extern jmp_buf PyFPE_jbuf; extern int PyFPE_counter; extern double PyFPE_dummy(void *); #define PyFPE_START_PROTECT(err_string, leave_stmt) \ if (!PyFPE_counter++ && setjmp(PyFPE_jbuf)) { \ PyErr_SetString(PyExc_FloatingPointError, err_string); \ PyFPE_counter = 0; \ leave_stmt; \ } /* * This (following) is a heck of a way to decrement a counter. However, * unless the macro argument is provided, code optimizers will sometimes move * this statement so that it gets executed *before* the unsafe expression * which we're trying to protect. That pretty well messes things up, * of course. * * If the expression(s) you're trying to protect don't happen to return a * value, you will need to manufacture a dummy result just to preserve the * correct ordering of statements. Note that the macro passes the address * of its argument (so you need to give it something which is addressable). * If your expression returns multiple results, pass the last such result * to PyFPE_END_PROTECT. * * Note that PyFPE_dummy returns a double, which is cast to int. * This seeming insanity is to tickle the Floating Point Unit (FPU). * If an exception has occurred in a preceding floating point operation, * some architectures (notably Intel 80x86) will not deliver the interrupt * until the *next* floating point operation. This is painful if you've * already decremented PyFPE_counter. */ #define PyFPE_END_PROTECT(v) PyFPE_counter -= (int)PyFPE_dummy(&(v)); #else #define PyFPE_START_PROTECT(err_string, leave_stmt) #define PyFPE_END_PROTECT(v) #endif #ifdef __cplusplus } #endif #endif /* !Py_PYFPE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/rangeobject.h�����������������������������������������������������������������������������0000644�����������������00000001206�14763166027�0010763 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Range object interface */ #ifndef Py_RANGEOBJECT_H #define Py_RANGEOBJECT_H #ifdef __cplusplus extern "C" { #endif /* This is about the type 'xrange', not the built-in function range(), which returns regular lists. */ /* A range object represents an integer range. This is an immutable object; a range cannot change its value after creation. Range objects behave like the corresponding tuple objects except that they are represented by a start, stop, and step datamembers. */ PyAPI_DATA(PyTypeObject) PyRange_Type; #define PyRange_Check(op) (Py_TYPE(op) == &PyRange_Type) #ifdef __cplusplus } #endif #endif /* !Py_RANGEOBJECT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/sysmodule.h�������������������������������������������������������������������������������0000644�����������������00000001457�14763166027�0010534 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* System module interface */ #ifndef Py_SYSMODULE_H #define Py_SYSMODULE_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(PyObject *) PySys_GetObject(char *); PyAPI_FUNC(int) PySys_SetObject(char *, PyObject *); PyAPI_FUNC(FILE *) PySys_GetFile(char *, FILE *); PyAPI_FUNC(void) PySys_SetArgv(int, char **); PyAPI_FUNC(void) PySys_SetArgvEx(int, char **, int); PyAPI_FUNC(void) PySys_SetPath(char *); PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) Py_GCC_ATTRIBUTE((format(printf, 1, 2))); PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) Py_GCC_ATTRIBUTE((format(printf, 1, 2))); PyAPI_FUNC(void) PySys_ResetWarnOptions(void); PyAPI_FUNC(void) PySys_AddWarnOption(char *); PyAPI_FUNC(int) PySys_HasWarnOptions(void); #ifdef __cplusplus } #endif #endif /* !Py_SYSMODULE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/pydebug.h���������������������������������������������������������������������������������0000644�����������������00000002452�14763166027�0010143 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� #ifndef Py_PYDEBUG_H #define Py_PYDEBUG_H #ifdef __cplusplus extern "C" { #endif PyAPI_DATA(int) Py_DebugFlag; PyAPI_DATA(int) Py_VerboseFlag; PyAPI_DATA(int) Py_InteractiveFlag; PyAPI_DATA(int) Py_InspectFlag; PyAPI_DATA(int) Py_OptimizeFlag; PyAPI_DATA(int) Py_NoSiteFlag; PyAPI_DATA(int) Py_BytesWarningFlag; PyAPI_DATA(int) Py_UseClassExceptionsFlag; PyAPI_DATA(int) Py_FrozenFlag; PyAPI_DATA(int) Py_TabcheckFlag; PyAPI_DATA(int) Py_UnicodeFlag; PyAPI_DATA(int) Py_IgnoreEnvironmentFlag; PyAPI_DATA(int) Py_DivisionWarningFlag; PyAPI_DATA(int) Py_DontWriteBytecodeFlag; PyAPI_DATA(int) Py_NoUserSiteDirectory; /* _XXX Py_QnewFlag should go away in 3.0. It's true iff -Qnew is passed, on the command line, and is used in 2.2 by ceval.c to make all "/" divisions true divisions (which they will be in 3.0). */ PyAPI_DATA(int) _Py_QnewFlag; /* Warn about 3.x issues */ PyAPI_DATA(int) Py_Py3kWarningFlag; PyAPI_DATA(int) Py_HashRandomizationFlag; /* this is a wrapper around getenv() that pays attention to Py_IgnoreEnvironmentFlag. It should be used for getting variables like PYTHONPATH and PYTHONHOME from the environment */ #define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s)) PyAPI_FUNC(void) Py_FatalError(const char *message); #ifdef __cplusplus } #endif #endif /* !Py_PYDEBUG_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/grammar.h���������������������������������������������������������������������������������0000644�����������������00000003745�14763166027�0010140 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Grammar interface */ #ifndef Py_GRAMMAR_H #define Py_GRAMMAR_H #ifdef __cplusplus extern "C" { #endif #include "bitset.h" /* Sigh... */ /* A label of an arc */ typedef struct { int lb_type; char *lb_str; } label; #define EMPTY 0 /* Label number 0 is by definition the empty label */ /* A list of labels */ typedef struct { int ll_nlabels; label *ll_label; } labellist; /* An arc from one state to another */ typedef struct { short a_lbl; /* Label of this arc */ short a_arrow; /* State where this arc goes to */ } arc; /* A state in a DFA */ typedef struct { int s_narcs; arc *s_arc; /* Array of arcs */ /* Optional accelerators */ int s_lower; /* Lowest label index */ int s_upper; /* Highest label index */ int *s_accel; /* Accelerator */ int s_accept; /* Nonzero for accepting state */ } state; /* A DFA */ typedef struct { int d_type; /* Non-terminal this represents */ char *d_name; /* For printing */ int d_initial; /* Initial state */ int d_nstates; state *d_state; /* Array of states */ bitset d_first; } dfa; /* A grammar */ typedef struct { int g_ndfas; dfa *g_dfa; /* Array of DFAs */ labellist g_ll; int g_start; /* Start symbol of the grammar */ int g_accel; /* Set if accelerators present */ } grammar; /* FUNCTIONS */ grammar *newgrammar(int start); dfa *adddfa(grammar *g, int type, char *name); int addstate(dfa *d); void addarc(dfa *d, int from, int to, int lbl); dfa *PyGrammar_FindDFA(grammar *g, int type); int addlabel(labellist *ll, int type, char *str); int findlabel(labellist *ll, int type, char *str); char *PyGrammar_LabelRepr(label *lb); void translatelabels(grammar *g); void addfirstsets(grammar *g); void PyGrammar_AddAccelerators(grammar *g); void PyGrammar_RemoveAccelerators(grammar *); void printgrammar(grammar *g, FILE *fp); void printnonterminals(grammar *g, FILE *fp); #ifdef __cplusplus } #endif #endif /* !Py_GRAMMAR_H */ ���������������������������python2.7/token.h�����������������������������������������������������������������������������������0000644�����������������00000003407�14763166027�0007625 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Token types */ #ifndef Py_TOKEN_H #define Py_TOKEN_H #ifdef __cplusplus extern "C" { #endif #undef TILDE /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */ #define ENDMARKER 0 #define NAME 1 #define NUMBER 2 #define STRING 3 #define NEWLINE 4 #define INDENT 5 #define DEDENT 6 #define LPAR 7 #define RPAR 8 #define LSQB 9 #define RSQB 10 #define COLON 11 #define COMMA 12 #define SEMI 13 #define PLUS 14 #define MINUS 15 #define STAR 16 #define SLASH 17 #define VBAR 18 #define AMPER 19 #define LESS 20 #define GREATER 21 #define EQUAL 22 #define DOT 23 #define PERCENT 24 #define BACKQUOTE 25 #define LBRACE 26 #define RBRACE 27 #define EQEQUAL 28 #define NOTEQUAL 29 #define LESSEQUAL 30 #define GREATEREQUAL 31 #define TILDE 32 #define CIRCUMFLEX 33 #define LEFTSHIFT 34 #define RIGHTSHIFT 35 #define DOUBLESTAR 36 #define PLUSEQUAL 37 #define MINEQUAL 38 #define STAREQUAL 39 #define SLASHEQUAL 40 #define PERCENTEQUAL 41 #define AMPEREQUAL 42 #define VBAREQUAL 43 #define CIRCUMFLEXEQUAL 44 #define LEFTSHIFTEQUAL 45 #define RIGHTSHIFTEQUAL 46 #define DOUBLESTAREQUAL 47 #define DOUBLESLASH 48 #define DOUBLESLASHEQUAL 49 #define AT 50 /* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */ #define OP 51 #define ERRORTOKEN 52 #define N_TOKENS 53 /* Special definitions for cooperation with parser */ #define NT_OFFSET 256 #define ISTERMINAL(x) ((x) < NT_OFFSET) #define ISNONTERMINAL(x) ((x) >= NT_OFFSET) #define ISEOF(x) ((x) == ENDMARKER) PyAPI_DATA(char *) _PyParser_TokenNames[]; /* Token names */ PyAPI_FUNC(int) PyToken_OneChar(int); PyAPI_FUNC(int) PyToken_TwoChars(int, int); PyAPI_FUNC(int) PyToken_ThreeChars(int, int, int); #ifdef __cplusplus } #endif #endif /* !Py_TOKEN_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/pgenheaders.h�����������������������������������������������������������������������������0000644�����������������00000002170�14763166027�0010766 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_PGENHEADERS_H #define Py_PGENHEADERS_H #ifdef __cplusplus extern "C" { #endif /* Include files and extern declarations used by most of the parser. */ #include "Python.h" PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) Py_GCC_ATTRIBUTE((format(printf, 1, 2))); PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) Py_GCC_ATTRIBUTE((format(printf, 1, 2))); #define addarc _Py_addarc #define addbit _Py_addbit #define adddfa _Py_adddfa #define addfirstsets _Py_addfirstsets #define addlabel _Py_addlabel #define addstate _Py_addstate #define delbitset _Py_delbitset #define dumptree _Py_dumptree #define findlabel _Py_findlabel #define mergebitset _Py_mergebitset #define meta_grammar _Py_meta_grammar #define newbitset _Py_newbitset #define newgrammar _Py_newgrammar #define pgen _Py_pgen #define printgrammar _Py_printgrammar #define printnonterminals _Py_printnonterminals #define printtree _Py_printtree #define samebitset _Py_samebitset #define showtree _Py_showtree #define tok_dump _Py_tok_dump #define translatelabels _Py_translatelabels #ifdef __cplusplus } #endif #endif /* !Py_PGENHEADERS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/dictobject.h������������������������������������������������������������������������������0000644�����������������00000015030�14763166027�0010612 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_DICTOBJECT_H #define Py_DICTOBJECT_H #ifdef __cplusplus extern "C" { #endif /* Dictionary object type -- mapping from hashable object to object */ /* The distribution includes a separate file, Objects/dictnotes.txt, describing explorations into dictionary design and optimization. It covers typical dictionary use patterns, the parameters for tuning dictionaries, and several ideas for possible optimizations. */ /* There are three kinds of slots in the table: 1. Unused. me_key == me_value == NULL Does not hold an active (key, value) pair now and never did. Unused can transition to Active upon key insertion. This is the only case in which me_key is NULL, and is each slot's initial state. 2. Active. me_key != NULL and me_key != dummy and me_value != NULL Holds an active (key, value) pair. Active can transition to Dummy upon key deletion. This is the only case in which me_value != NULL. 3. Dummy. me_key == dummy and me_value == NULL Previously held an active (key, value) pair, but that was deleted and an active pair has not yet overwritten the slot. Dummy can transition to Active upon key insertion. Dummy slots cannot be made Unused again (cannot have me_key set to NULL), else the probe sequence in case of collision would have no way to know they were once active. Note: .popitem() abuses the me_hash field of an Unused or Dummy slot to hold a search finger. The me_hash field of Unused or Dummy slots has no meaning otherwise. */ /* PyDict_MINSIZE is the minimum size of a dictionary. This many slots are * allocated directly in the dict object (in the ma_smalltable member). * It must be a power of 2, and at least 4. 8 allows dicts with no more * than 5 active entries to live in ma_smalltable (and so avoid an * additional malloc); instrumentation suggested this suffices for the * majority of dicts (consisting mostly of usually-small instance dicts and * usually-small dicts created to pass keyword arguments). */ #define PyDict_MINSIZE 8 typedef struct { /* Cached hash code of me_key. Note that hash codes are C longs. * We have to use Py_ssize_t instead because dict_popitem() abuses * me_hash to hold a search finger. */ Py_ssize_t me_hash; PyObject *me_key; PyObject *me_value; } PyDictEntry; /* To ensure the lookup algorithm terminates, there must be at least one Unused slot (NULL key) in the table. The value ma_fill is the number of non-NULL keys (sum of Active and Dummy); ma_used is the number of non-NULL, non-dummy keys (== the number of non-NULL values == the number of Active items). To avoid slowing down lookups on a near-full table, we resize the table when it's two-thirds full. */ typedef struct _dictobject PyDictObject; struct _dictobject { PyObject_HEAD Py_ssize_t ma_fill; /* # Active + # Dummy */ Py_ssize_t ma_used; /* # Active */ /* The table contains ma_mask + 1 slots, and that's a power of 2. * We store the mask instead of the size because the mask is more * frequently needed. */ Py_ssize_t ma_mask; /* ma_table points to ma_smalltable for small tables, else to * additional malloc'ed memory. ma_table is never NULL! This rule * saves repeated runtime null-tests in the workhorse getitem and * setitem calls. */ PyDictEntry *ma_table; PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, long hash); PyDictEntry ma_smalltable[PyDict_MINSIZE]; }; PyAPI_DATA(PyTypeObject) PyDict_Type; PyAPI_DATA(PyTypeObject) PyDictIterKey_Type; PyAPI_DATA(PyTypeObject) PyDictIterValue_Type; PyAPI_DATA(PyTypeObject) PyDictIterItem_Type; PyAPI_DATA(PyTypeObject) PyDictKeys_Type; PyAPI_DATA(PyTypeObject) PyDictItems_Type; PyAPI_DATA(PyTypeObject) PyDictValues_Type; #define PyDict_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS) #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) #define PyDictKeys_Check(op) (Py_TYPE(op) == &PyDictKeys_Type) #define PyDictItems_Check(op) (Py_TYPE(op) == &PyDictItems_Type) #define PyDictValues_Check(op) (Py_TYPE(op) == &PyDictValues_Type) /* This excludes Values, since they are not sets. */ # define PyDictViewSet_Check(op) \ (PyDictKeys_Check(op) || PyDictItems_Check(op)) PyAPI_FUNC(PyObject *) PyDict_New(void); PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key); PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item); PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key); PyAPI_FUNC(void) PyDict_Clear(PyObject *mp); PyAPI_FUNC(int) PyDict_Next( PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value); PyAPI_FUNC(int) _PyDict_Next( PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, long *hash); PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp); PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp); PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp); PyAPI_FUNC(Py_ssize_t) PyDict_Size(PyObject *mp); PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp); PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key); PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, long hash); PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused); PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp); /* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */ PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other); /* PyDict_Merge updates/merges from a mapping object (an object that supports PyMapping_Keys() and PyObject_GetItem()). If override is true, the last occurrence of a key wins, else the first. The Python dict.update(other) is equivalent to PyDict_Merge(dict, other, 1). */ PyAPI_FUNC(int) PyDict_Merge(PyObject *mp, PyObject *other, int override); /* PyDict_MergeFromSeq2 updates/merges from an iterable object producing iterable objects of length 2. If override is true, the last occurrence of a key wins, else the first. The Python dict constructor dict(seq2) is equivalent to dict={}; PyDict_MergeFromSeq(dict, seq2, 1). */ PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d, PyObject *seq2, int override); PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key); PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item); PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key); PyAPI_FUNC(void) _PyDict_DebugMallocStats(FILE *out); #ifdef __cplusplus } #endif #endif /* !Py_DICTOBJECT_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/datetime.h��������������������������������������������������������������������������������0000644�����������������00000020171�14763166027�0010276 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* datetime.h */ #ifndef DATETIME_H #define DATETIME_H #ifdef __cplusplus extern "C" { #endif /* Fields are packed into successive bytes, each viewed as unsigned and * big-endian, unless otherwise noted: * * byte offset * 0 year 2 bytes, 1-9999 * 2 month 1 byte, 1-12 * 3 day 1 byte, 1-31 * 4 hour 1 byte, 0-23 * 5 minute 1 byte, 0-59 * 6 second 1 byte, 0-59 * 7 usecond 3 bytes, 0-999999 * 10 */ /* # of bytes for year, month, and day. */ #define _PyDateTime_DATE_DATASIZE 4 /* # of bytes for hour, minute, second, and usecond. */ #define _PyDateTime_TIME_DATASIZE 6 /* # of bytes for year, month, day, hour, minute, second, and usecond. */ #define _PyDateTime_DATETIME_DATASIZE 10 typedef struct { PyObject_HEAD long hashcode; /* -1 when unknown */ int days; /* -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS */ int seconds; /* 0 <= seconds < 24*3600 is invariant */ int microseconds; /* 0 <= microseconds < 1000000 is invariant */ } PyDateTime_Delta; typedef struct { PyObject_HEAD /* a pure abstract base clase */ } PyDateTime_TZInfo; /* The datetime and time types have hashcodes, and an optional tzinfo member, * present if and only if hastzinfo is true. */ #define _PyTZINFO_HEAD \ PyObject_HEAD \ long hashcode; \ char hastzinfo; /* boolean flag */ /* No _PyDateTime_BaseTZInfo is allocated; it's just to have something * convenient to cast to, when getting at the hastzinfo member of objects * starting with _PyTZINFO_HEAD. */ typedef struct { _PyTZINFO_HEAD } _PyDateTime_BaseTZInfo; /* All time objects are of PyDateTime_TimeType, but that can be allocated * in two ways, with or without a tzinfo member. Without is the same as * tzinfo == None, but consumes less memory. _PyDateTime_BaseTime is an * internal struct used to allocate the right amount of space for the * "without" case. */ #define _PyDateTime_TIMEHEAD \ _PyTZINFO_HEAD \ unsigned char data[_PyDateTime_TIME_DATASIZE]; typedef struct { _PyDateTime_TIMEHEAD } _PyDateTime_BaseTime; /* hastzinfo false */ typedef struct { _PyDateTime_TIMEHEAD PyObject *tzinfo; } PyDateTime_Time; /* hastzinfo true */ /* All datetime objects are of PyDateTime_DateTimeType, but that can be * allocated in two ways too, just like for time objects above. In addition, * the plain date type is a base class for datetime, so it must also have * a hastzinfo member (although it's unused there). */ typedef struct { _PyTZINFO_HEAD unsigned char data[_PyDateTime_DATE_DATASIZE]; } PyDateTime_Date; #define _PyDateTime_DATETIMEHEAD \ _PyTZINFO_HEAD \ unsigned char data[_PyDateTime_DATETIME_DATASIZE]; typedef struct { _PyDateTime_DATETIMEHEAD } _PyDateTime_BaseDateTime; /* hastzinfo false */ typedef struct { _PyDateTime_DATETIMEHEAD PyObject *tzinfo; } PyDateTime_DateTime; /* hastzinfo true */ /* Apply for date and datetime instances. */ #define PyDateTime_GET_YEAR(o) ((((PyDateTime_Date*)o)->data[0] << 8) | \ ((PyDateTime_Date*)o)->data[1]) #define PyDateTime_GET_MONTH(o) (((PyDateTime_Date*)o)->data[2]) #define PyDateTime_GET_DAY(o) (((PyDateTime_Date*)o)->data[3]) #define PyDateTime_DATE_GET_HOUR(o) (((PyDateTime_DateTime*)o)->data[4]) #define PyDateTime_DATE_GET_MINUTE(o) (((PyDateTime_DateTime*)o)->data[5]) #define PyDateTime_DATE_GET_SECOND(o) (((PyDateTime_DateTime*)o)->data[6]) #define PyDateTime_DATE_GET_MICROSECOND(o) \ ((((PyDateTime_DateTime*)o)->data[7] << 16) | \ (((PyDateTime_DateTime*)o)->data[8] << 8) | \ ((PyDateTime_DateTime*)o)->data[9]) /* Apply for time instances. */ #define PyDateTime_TIME_GET_HOUR(o) (((PyDateTime_Time*)o)->data[0]) #define PyDateTime_TIME_GET_MINUTE(o) (((PyDateTime_Time*)o)->data[1]) #define PyDateTime_TIME_GET_SECOND(o) (((PyDateTime_Time*)o)->data[2]) #define PyDateTime_TIME_GET_MICROSECOND(o) \ ((((PyDateTime_Time*)o)->data[3] << 16) | \ (((PyDateTime_Time*)o)->data[4] << 8) | \ ((PyDateTime_Time*)o)->data[5]) /* Define structure for C API. */ typedef struct { /* type objects */ PyTypeObject *DateType; PyTypeObject *DateTimeType; PyTypeObject *TimeType; PyTypeObject *DeltaType; PyTypeObject *TZInfoType; /* constructors */ PyObject *(*Date_FromDate)(int, int, int, PyTypeObject*); PyObject *(*DateTime_FromDateAndTime)(int, int, int, int, int, int, int, PyObject*, PyTypeObject*); PyObject *(*Time_FromTime)(int, int, int, int, PyObject*, PyTypeObject*); PyObject *(*Delta_FromDelta)(int, int, int, int, PyTypeObject*); /* constructors for the DB API */ PyObject *(*DateTime_FromTimestamp)(PyObject*, PyObject*, PyObject*); PyObject *(*Date_FromTimestamp)(PyObject*, PyObject*); } PyDateTime_CAPI; #define PyDateTime_CAPSULE_NAME "datetime.datetime_CAPI" /* "magic" constant used to partially protect against developer mistakes. */ #define DATETIME_API_MAGIC 0x414548d5 #ifdef Py_BUILD_CORE /* Macros for type checking when building the Python core. */ #define PyDate_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateType) #define PyDate_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateType) #define PyDateTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateTimeType) #define PyDateTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateTimeType) #define PyTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_TimeType) #define PyTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TimeType) #define PyDelta_Check(op) PyObject_TypeCheck(op, &PyDateTime_DeltaType) #define PyDelta_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DeltaType) #define PyTZInfo_Check(op) PyObject_TypeCheck(op, &PyDateTime_TZInfoType) #define PyTZInfo_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TZInfoType) #else /* Define global variable for the C API and a macro for setting it. */ static PyDateTime_CAPI *PyDateTimeAPI = NULL; #define PyDateTime_IMPORT \ PyDateTimeAPI = (PyDateTime_CAPI *)PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0) /* Macros for type checking when not building the Python core. */ #define PyDate_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateType) #define PyDate_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateType) #define PyDateTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateTimeType) #define PyDateTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateTimeType) #define PyTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TimeType) #define PyTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TimeType) #define PyDelta_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DeltaType) #define PyDelta_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DeltaType) #define PyTZInfo_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TZInfoType) #define PyTZInfo_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TZInfoType) /* Macros for accessing constructors in a simplified fashion. */ #define PyDate_FromDate(year, month, day) \ PyDateTimeAPI->Date_FromDate(year, month, day, PyDateTimeAPI->DateType) #define PyDateTime_FromDateAndTime(year, month, day, hour, min, sec, usec) \ PyDateTimeAPI->DateTime_FromDateAndTime(year, month, day, hour, \ min, sec, usec, Py_None, PyDateTimeAPI->DateTimeType) #define PyTime_FromTime(hour, minute, second, usecond) \ PyDateTimeAPI->Time_FromTime(hour, minute, second, usecond, \ Py_None, PyDateTimeAPI->TimeType) #define PyDelta_FromDSU(days, seconds, useconds) \ PyDateTimeAPI->Delta_FromDelta(days, seconds, useconds, 1, \ PyDateTimeAPI->DeltaType) /* Macros supporting the DB API. */ #define PyDateTime_FromTimestamp(args) \ PyDateTimeAPI->DateTime_FromTimestamp( \ (PyObject*) (PyDateTimeAPI->DateTimeType), args, NULL) #define PyDate_FromTimestamp(args) \ PyDateTimeAPI->Date_FromTimestamp( \ (PyObject*) (PyDateTimeAPI->DateType), args) #endif /* Py_BUILD_CORE */ #ifdef __cplusplus } #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/structseq.h�������������������������������������������������������������������������������0000644�����������������00000001536�14763166027�0010543 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Tuple object interface */ #ifndef Py_STRUCTSEQ_H #define Py_STRUCTSEQ_H #ifdef __cplusplus extern "C" { #endif typedef struct PyStructSequence_Field { char *name; char *doc; } PyStructSequence_Field; typedef struct PyStructSequence_Desc { char *name; char *doc; struct PyStructSequence_Field *fields; int n_in_sequence; } PyStructSequence_Desc; extern char* PyStructSequence_UnnamedField; PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc); PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type); typedef struct { PyObject_VAR_HEAD PyObject *ob_item[1]; } PyStructSequence; /* Macro, *only* to be used to fill in brand new objects */ #define PyStructSequence_SET_ITEM(op, i, v) \ (((PyStructSequence *)(op))->ob_item[i] = v) #ifdef __cplusplus } #endif #endif /* !Py_STRUCTSEQ_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/py_curses.h�������������������������������������������������������������������������������0000644�����������������00000010076�14763166027�0010521 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� #ifndef Py_CURSES_H #define Py_CURSES_H #ifdef __APPLE__ /* ** On Mac OS X 10.2 [n]curses.h and stdlib.h use different guards ** against multiple definition of wchar_t. */ #ifdef _BSD_WCHAR_T_DEFINED_ #define _WCHAR_T #endif /* the following define is necessary for OS X 10.6; without it, the Apple-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python can't get at the WINDOW flags field. */ #define NCURSES_OPAQUE 0 #endif /* __APPLE__ */ #ifdef __FreeBSD__ /* ** On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards ** against multiple definition of wchar_t and wint_t. */ #ifdef _XOPEN_SOURCE_EXTENDED #ifndef __FreeBSD_version #include <osreldate.h> #endif #if __FreeBSD_version >= 500000 #ifndef __wchar_t #define __wchar_t #endif #ifndef __wint_t #define __wint_t #endif #else #ifndef _WCHAR_T #define _WCHAR_T #endif #ifndef _WINT_T #define _WINT_T #endif #endif #endif #endif #ifdef HAVE_NCURSES_H #include <ncurses.h> #else #include <curses.h> #ifdef HAVE_TERM_H /* for tigetstr, which is not declared in SysV curses */ #include <term.h> #endif #endif #ifdef HAVE_NCURSES_H /* configure was checking <curses.h>, but we will use <ncurses.h>, which has all these features. */ #ifndef WINDOW_HAS_FLAGS #define WINDOW_HAS_FLAGS 1 #endif #ifndef MVWDELCH_IS_EXPRESSION #define MVWDELCH_IS_EXPRESSION 1 #endif #endif #ifdef __cplusplus extern "C" { #endif #define PyCurses_API_pointers 4 /* Type declarations */ typedef struct { PyObject_HEAD WINDOW *win; } PyCursesWindowObject; #define PyCursesWindow_Check(v) (Py_TYPE(v) == &PyCursesWindow_Type) #define PyCurses_CAPSULE_NAME "_curses._C_API" #ifdef CURSES_MODULE /* This section is used when compiling _cursesmodule.c */ #else /* This section is used in modules that use the _cursesmodule API */ static void **PyCurses_API; #define PyCursesWindow_Type (*(PyTypeObject *) PyCurses_API[0]) #define PyCursesSetupTermCalled {if (! ((int (*)(void))PyCurses_API[1]) () ) return NULL;} #define PyCursesInitialised {if (! ((int (*)(void))PyCurses_API[2]) () ) return NULL;} #define PyCursesInitialisedColor {if (! ((int (*)(void))PyCurses_API[3]) () ) return NULL;} #define import_curses() \ PyCurses_API = (void **)PyCapsule_Import(PyCurses_CAPSULE_NAME, 1); #endif /* general error messages */ static char *catchall_ERR = "curses function returned ERR"; static char *catchall_NULL = "curses function returned NULL"; /* Function Prototype Macros - They are ugly but very, very useful. ;-) X - function name TYPE - parameter Type ERGSTR - format string for construction of the return value PARSESTR - format string for argument parsing */ #define NoArgNoReturnFunction(X) \ static PyObject *PyCurses_ ## X (PyObject *self) \ { \ PyCursesInitialised \ return PyCursesCheckERR(X(), # X); } #define NoArgOrFlagNoReturnFunction(X) \ static PyObject *PyCurses_ ## X (PyObject *self, PyObject *args) \ { \ int flag = 0; \ PyCursesInitialised \ switch(PyTuple_Size(args)) { \ case 0: \ return PyCursesCheckERR(X(), # X); \ case 1: \ if (!PyArg_ParseTuple(args, "i;True(1) or False(0)", &flag)) return NULL; \ if (flag) return PyCursesCheckERR(X(), # X); \ else return PyCursesCheckERR(no ## X (), # X); \ default: \ PyErr_SetString(PyExc_TypeError, # X " requires 0 or 1 arguments"); \ return NULL; } } #define NoArgReturnIntFunction(X) \ static PyObject *PyCurses_ ## X (PyObject *self) \ { \ PyCursesInitialised \ return PyInt_FromLong((long) X()); } #define NoArgReturnStringFunction(X) \ static PyObject *PyCurses_ ## X (PyObject *self) \ { \ PyCursesInitialised \ return PyString_FromString(X()); } #define NoArgTrueFalseFunction(X) \ static PyObject *PyCurses_ ## X (PyObject *self) \ { \ PyCursesInitialised \ if (X () == FALSE) { \ Py_INCREF(Py_False); \ return Py_False; \ } \ Py_INCREF(Py_True); \ return Py_True; } #define NoArgNoReturnVoidFunction(X) \ static PyObject *PyCurses_ ## X (PyObject *self) \ { \ PyCursesInitialised \ X(); \ Py_INCREF(Py_None); \ return Py_None; } #ifdef __cplusplus } #endif #endif /* !defined(Py_CURSES_H) */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/pystate.h���������������������������������������������������������������������������������0000644�����������������00000014403�14763166027�0010174 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Thread and interpreter state structures and their interfaces */ #ifndef Py_PYSTATE_H #define Py_PYSTATE_H #ifdef __cplusplus extern "C" { #endif /* State shared between threads */ struct _ts; /* Forward */ struct _is; /* Forward */ typedef struct _is { struct _is *next; struct _ts *tstate_head; PyObject *modules; PyObject *sysdict; PyObject *builtins; PyObject *modules_reloading; PyObject *codec_search_path; PyObject *codec_search_cache; PyObject *codec_error_registry; #ifdef HAVE_DLOPEN int dlopenflags; #endif #ifdef WITH_TSC int tscdump; #endif } PyInterpreterState; /* State unique per thread */ struct _frame; /* Avoid including frameobject.h */ /* Py_tracefunc return -1 when raising an exception, or 0 for success. */ typedef int (*Py_tracefunc)(PyObject *, struct _frame *, int, PyObject *); /* The following values are used for 'what' for tracefunc functions: */ #define PyTrace_CALL 0 #define PyTrace_EXCEPTION 1 #define PyTrace_LINE 2 #define PyTrace_RETURN 3 #define PyTrace_C_CALL 4 #define PyTrace_C_EXCEPTION 5 #define PyTrace_C_RETURN 6 typedef struct _ts { /* See Python/ceval.c for comments explaining most fields */ struct _ts *next; PyInterpreterState *interp; struct _frame *frame; int recursion_depth; /* 'tracing' keeps track of the execution depth when tracing/profiling. This is to prevent the actual trace/profile code from being recorded in the trace/profile. */ int tracing; int use_tracing; Py_tracefunc c_profilefunc; Py_tracefunc c_tracefunc; PyObject *c_profileobj; PyObject *c_traceobj; PyObject *curexc_type; PyObject *curexc_value; PyObject *curexc_traceback; PyObject *exc_type; PyObject *exc_value; PyObject *exc_traceback; PyObject *dict; /* Stores per-thread state */ /* tick_counter is incremented whenever the check_interval ticker * reaches zero. The purpose is to give a useful measure of the number * of interpreted bytecode instructions in a given thread. This * extremely lightweight statistic collector may be of interest to * profilers (like psyco.jit()), although nothing in the core uses it. */ int tick_counter; int gilstate_counter; PyObject *async_exc; /* Asynchronous exception to raise */ long thread_id; /* Thread id where this tstate was created */ int trash_delete_nesting; PyObject *trash_delete_later; /* XXX signal handlers should also be here */ } PyThreadState; PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void); PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *); PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *); PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *); PyAPI_FUNC(PyThreadState *) _PyThreadState_Prealloc(PyInterpreterState *); PyAPI_FUNC(void) _PyThreadState_Init(PyThreadState *); PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *); PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *); #ifdef WITH_THREAD PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void); #endif PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void); PyAPI_FUNC(PyThreadState *) PyThreadState_Swap(PyThreadState *); PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void); PyAPI_FUNC(int) PyThreadState_SetAsyncExc(long, PyObject *); /* Variable and macro for in-line access to current thread state */ PyAPI_DATA(PyThreadState *) _PyThreadState_Current; #ifdef Py_DEBUG #define PyThreadState_GET() PyThreadState_Get() #else #define PyThreadState_GET() (_PyThreadState_Current) #endif typedef enum {PyGILState_LOCKED, PyGILState_UNLOCKED} PyGILState_STATE; /* Ensure that the current thread is ready to call the Python C API, regardless of the current state of Python, or of its thread lock. This may be called as many times as desired by a thread so long as each call is matched with a call to PyGILState_Release(). In general, other thread-state APIs may be used between _Ensure() and _Release() calls, so long as the thread-state is restored to its previous state before the Release(). For example, normal use of the Py_BEGIN_ALLOW_THREADS/ Py_END_ALLOW_THREADS macros are acceptable. The return value is an opaque "handle" to the thread state when PyGILState_Ensure() was called, and must be passed to PyGILState_Release() to ensure Python is left in the same state. Even though recursive calls are allowed, these handles can *not* be shared - each unique call to PyGILState_Ensure must save the handle for its call to PyGILState_Release. When the function returns, the current thread will hold the GIL. Failure is a fatal error. */ PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure(void); /* Release any resources previously acquired. After this call, Python's state will be the same as it was prior to the corresponding PyGILState_Ensure() call (but generally this state will be unknown to the caller, hence the use of the GILState API.) Every call to PyGILState_Ensure must be matched by a call to PyGILState_Release on the same thread. */ PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE); /* Helper/diagnostic function - get the current thread state for this thread. May return NULL if no GILState API has been used on the current thread. Note that the main thread always has such a thread-state, even if no auto-thread-state call has been made on the main thread. */ PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void); /* The implementation of sys._current_frames() Returns a dict mapping thread id to that thread's current frame. */ PyAPI_FUNC(PyObject *) _PyThread_CurrentFrames(void); /* Routines for advanced debuggers, requested by David Beazley. Don't use unless you know what you are doing! */ PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void); PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *); PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *); PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *); typedef struct _frame *(*PyThreadFrameGetter)(PyThreadState *self_); /* hook for PyEval_GetFrame(), requested for Psyco */ PyAPI_DATA(PyThreadFrameGetter) _PyThreadState_GetFrame; #ifdef __cplusplus } #endif #endif /* !Py_PYSTATE_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/listobject.h������������������������������������������������������������������������������0000644�����������������00000005010�14763166027�0010637 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* List object interface */ /* Another generally useful object type is an list of object pointers. This is a mutable type: the list items can be changed, and items can be added or removed. Out-of-range indices or non-list objects are ignored. *** WARNING *** PyList_SetItem does not increment the new item's reference count, but does decrement the reference count of the item it replaces, if not nil. It does *decrement* the reference count if it is *not* inserted in the list. Similarly, PyList_GetItem does not increment the returned item's reference count. */ #ifndef Py_LISTOBJECT_H #define Py_LISTOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef struct { PyObject_VAR_HEAD /* Vector of pointers to list elements. list[0] is ob_item[0], etc. */ PyObject **ob_item; /* ob_item contains space for 'allocated' elements. The number * currently in use is ob_size. * Invariants: * 0 <= ob_size <= allocated * len(list) == ob_size * ob_item == NULL implies ob_size == allocated == 0 * list.sort() temporarily sets allocated to -1 to detect mutations. * * Items must normally not be NULL, except during construction when * the list is not yet visible outside the function that builds it. */ Py_ssize_t allocated; } PyListObject; PyAPI_DATA(PyTypeObject) PyList_Type; #define PyList_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS) #define PyList_CheckExact(op) (Py_TYPE(op) == &PyList_Type) PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size); PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *); PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *); PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *); PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t); PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *); PyAPI_FUNC(int) PyList_Sort(PyObject *); PyAPI_FUNC(int) PyList_Reverse(PyObject *); PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *); PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *); /* Macro, trading safety for speed */ #define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i]) #define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v)) #define PyList_GET_SIZE(op) Py_SIZE(op) PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out); #ifdef __cplusplus } #endif #endif /* !Py_LISTOBJECT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/setobject.h�������������������������������������������������������������������������������0000644�����������������00000006072�14763166027�0010470 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Set object interface */ #ifndef Py_SETOBJECT_H #define Py_SETOBJECT_H #ifdef __cplusplus extern "C" { #endif /* There are three kinds of slots in the table: 1. Unused: key == NULL 2. Active: key != NULL and key != dummy 3. Dummy: key == dummy Note: .pop() abuses the hash field of an Unused or Dummy slot to hold a search finger. The hash field of Unused or Dummy slots has no meaning otherwise. */ #define PySet_MINSIZE 8 typedef struct { long hash; /* cached hash code for the entry key */ PyObject *key; } setentry; /* This data structure is shared by set and frozenset objects. */ typedef struct _setobject PySetObject; struct _setobject { PyObject_HEAD Py_ssize_t fill; /* # Active + # Dummy */ Py_ssize_t used; /* # Active */ /* The table contains mask + 1 slots, and that's a power of 2. * We store the mask instead of the size because the mask is more * frequently needed. */ Py_ssize_t mask; /* table points to smalltable for small tables, else to * additional malloc'ed memory. table is never NULL! This rule * saves repeated runtime null-tests. */ setentry *table; setentry *(*lookup)(PySetObject *so, PyObject *key, long hash); setentry smalltable[PySet_MINSIZE]; long hash; /* only used by frozenset objects */ PyObject *weakreflist; /* List of weak references */ }; PyAPI_DATA(PyTypeObject) PySet_Type; PyAPI_DATA(PyTypeObject) PyFrozenSet_Type; /* Invariants for frozensets: * data is immutable. * hash is the hash of the frozenset or -1 if not computed yet. * Invariants for sets: * hash is -1 */ #define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) == &PyFrozenSet_Type) #define PyAnySet_CheckExact(ob) \ (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type) #define PyAnySet_Check(ob) \ (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \ PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \ PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) #define PySet_Check(ob) \ (Py_TYPE(ob) == &PySet_Type || \ PyType_IsSubtype(Py_TYPE(ob), &PySet_Type)) #define PyFrozenSet_Check(ob) \ (Py_TYPE(ob) == &PyFrozenSet_Type || \ PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) PyAPI_FUNC(PyObject *) PySet_New(PyObject *); PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *); PyAPI_FUNC(Py_ssize_t) PySet_Size(PyObject *anyset); #define PySet_GET_SIZE(so) (((PySetObject *)(so))->used) PyAPI_FUNC(int) PySet_Clear(PyObject *set); PyAPI_FUNC(int) PySet_Contains(PyObject *anyset, PyObject *key); PyAPI_FUNC(int) PySet_Discard(PyObject *set, PyObject *key); PyAPI_FUNC(int) PySet_Add(PyObject *set, PyObject *key); PyAPI_FUNC(int) _PySet_Next(PyObject *set, Py_ssize_t *pos, PyObject **key); PyAPI_FUNC(int) _PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, long *hash); PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set); PyAPI_FUNC(int) _PySet_Update(PyObject *set, PyObject *iterable); PyAPI_FUNC(void) _PySet_DebugMallocStats(FILE *out); #ifdef __cplusplus } #endif #endif /* !Py_SETOBJECT_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/bitset.h����������������������������������������������������������������������������������0000644�����������������00000001430�14763166027�0007771 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� #ifndef Py_BITSET_H #define Py_BITSET_H #ifdef __cplusplus extern "C" { #endif /* Bitset interface */ #define BYTE char typedef BYTE *bitset; bitset newbitset(int nbits); void delbitset(bitset bs); #define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0) int addbit(bitset bs, int ibit); /* Returns 0 if already set */ int samebitset(bitset bs1, bitset bs2, int nbits); void mergebitset(bitset bs1, bitset bs2, int nbits); #define BITSPERBYTE (8*sizeof(BYTE)) #define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE) #define BIT2BYTE(ibit) ((ibit) / BITSPERBYTE) #define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE) #define BIT2MASK(ibit) (1 << BIT2SHIFT(ibit)) #define BYTE2BIT(ibyte) ((ibyte) * BITSPERBYTE) #ifdef __cplusplus } #endif #endif /* !Py_BITSET_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/marshal.h���������������������������������������������������������������������������������0000644�����������������00000001311�14763166027�0010124 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Interface for marshal.c */ #ifndef Py_MARSHAL_H #define Py_MARSHAL_H #ifdef __cplusplus extern "C" { #endif #define Py_MARSHAL_VERSION 2 PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int); PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int); PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *, int); PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE *); PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE *); PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *); PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *); PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(char *, Py_ssize_t); #ifdef __cplusplus } #endif #endif /* !Py_MARSHAL_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/osdefs.h����������������������������������������������������������������������������������0000644�����������������00000002043�14763166027�0007763 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_OSDEFS_H #define Py_OSDEFS_H #ifdef __cplusplus extern "C" { #endif /* Operating system dependencies */ /* Mod by chrish: QNX has WATCOM, but isn't DOS */ #if !defined(__QNX__) #if defined(MS_WINDOWS) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__) || defined(PYOS_OS2) #if defined(PYOS_OS2) && defined(PYCC_GCC) #define MAXPATHLEN 260 #define SEP '/' #define ALTSEP '\\' #else #define SEP '\\' #define ALTSEP '/' #define MAXPATHLEN 256 #endif #define DELIM ';' #endif #endif #ifdef RISCOS #define SEP '.' #define MAXPATHLEN 256 #define DELIM ',' #endif /* Filename separator */ #ifndef SEP #define SEP '/' #endif /* Max pathname length */ #ifdef __hpux #include <sys/param.h> #include <limits.h> #ifndef PATH_MAX #define PATH_MAX MAXPATHLEN #endif #endif #ifndef MAXPATHLEN #if defined(PATH_MAX) && PATH_MAX > 1024 #define MAXPATHLEN PATH_MAX #else #define MAXPATHLEN 1024 #endif #endif /* Search path entry delimiter */ #ifndef DELIM #define DELIM ':' #endif #ifdef __cplusplus } #endif #endif /* !Py_OSDEFS_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/pyconfig-64.h�����������������������������������������������������������������������������0000644�����������������00000107716�14763166027�0010562 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* pyconfig.h. Generated from pyconfig.h.in by configure. */ /* pyconfig.h.in. Generated from configure.ac by autoheader. */ #ifndef Py_PYCONFIG_H #define Py_PYCONFIG_H /* Define if building universal (internal helper macro) */ /* #undef AC_APPLE_UNIVERSAL_BUILD */ /* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want support for AIX C++ shared extension modules. */ /* #undef AIX_GENUINE_CPLUSPLUS */ /* Define this if you have AtheOS threads. */ /* #undef ATHEOS_THREADS */ /* Define this if you have BeOS threads. */ /* #undef BEOS_THREADS */ /* Define to keep records on function call invocation */ /* #undef CALL_PROFILE */ /* Define to keep records of the number of instances of each type */ /* #undef COUNT_ALLOCS */ /* Define if you have the Mach cthreads package */ /* #undef C_THREADS */ /* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM mixed-endian order (byte order 45670123) */ /* #undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 */ /* Define if C doubles are 64-bit IEEE 754 binary format, stored with the most significant byte first */ /* #undef DOUBLE_IS_BIG_ENDIAN_IEEE754 */ /* Define if C doubles are 64-bit IEEE 754 binary format, stored with the least significant byte first */ #define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 1 /* Define if --enable-ipv6 is specified */ #define ENABLE_IPV6 1 /* Define if flock needs to be linked with bsd library. */ /* #undef FLOCK_NEEDS_LIBBSD */ /* Define if getpgrp() must be called as getpgrp(0). */ /* #undef GETPGRP_HAVE_ARG */ /* Define if gettimeofday() does not have second (timezone) argument This is the case on Motorola V4 (R40V4.2) */ /* #undef GETTIMEOFDAY_NO_TZ */ /* Define to 1 if you have the `acosh' function. */ #define HAVE_ACOSH 1 /* struct addrinfo (netdb.h) */ #define HAVE_ADDRINFO 1 /* Define to 1 if you have the `alarm' function. */ #define HAVE_ALARM 1 /* Define this if your time.h defines altzone. */ /* #undef HAVE_ALTZONE */ /* Define to 1 if you have the `asinh' function. */ #define HAVE_ASINH 1 /* Define to 1 if you have the <asm/types.h> header file. */ #define HAVE_ASM_TYPES_H 1 /* Define to 1 if you have the `atanh' function. */ #define HAVE_ATANH 1 /* Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3))) */ /* #undef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE */ /* Define to 1 if you have the `bind_textdomain_codeset' function. */ #define HAVE_BIND_TEXTDOMAIN_CODESET 1 /* Define to 1 if you have the <bluetooth/bluetooth.h> header file. */ #define HAVE_BLUETOOTH_BLUETOOTH_H 1 /* Define to 1 if you have the <bluetooth.h> header file. */ /* #undef HAVE_BLUETOOTH_H */ /* Define if nice() returns success/failure instead of the new priority. */ /* #undef HAVE_BROKEN_NICE */ /* Define if the system reports an invalid PIPE_BUF value. */ /* #undef HAVE_BROKEN_PIPE_BUF */ /* Define if poll() sets errno on invalid file descriptors. */ /* #undef HAVE_BROKEN_POLL */ /* Define if the Posix semaphores do not work on your system */ /* #undef HAVE_BROKEN_POSIX_SEMAPHORES */ /* Define if pthread_sigmask() does not work on your system. */ /* #undef HAVE_BROKEN_PTHREAD_SIGMASK */ /* define to 1 if your sem_getvalue is broken. */ /* #undef HAVE_BROKEN_SEM_GETVALUE */ /* Define if `unsetenv` does not return an int. */ /* #undef HAVE_BROKEN_UNSETENV */ /* Define this if you have the type _Bool. */ #define HAVE_C99_BOOL 1 /* Define to 1 if you have the 'chflags' function. */ /* #undef HAVE_CHFLAGS */ /* Define to 1 if you have the `chown' function. */ #define HAVE_CHOWN 1 /* Define if you have the 'chroot' function. */ #define HAVE_CHROOT 1 /* Define to 1 if you have the `clock' function. */ #define HAVE_CLOCK 1 /* Define if the C compiler supports computed gotos. */ #define HAVE_COMPUTED_GOTOS 1 /* Define to 1 if you have the `confstr' function. */ #define HAVE_CONFSTR 1 /* Define to 1 if you have the <conio.h> header file. */ /* #undef HAVE_CONIO_H */ /* Define to 1 if you have the `copysign' function. */ #define HAVE_COPYSIGN 1 /* Define to 1 if you have the `ctermid' function. */ #define HAVE_CTERMID 1 /* Define if you have the 'ctermid_r' function. */ /* #undef HAVE_CTERMID_R */ /* Define to 1 if you have the <curses.h> header file. */ #define HAVE_CURSES_H 1 /* Define if you have the 'is_term_resized' function. */ #define HAVE_CURSES_IS_TERM_RESIZED 1 /* Define if you have the 'resizeterm' function. */ #define HAVE_CURSES_RESIZETERM 1 /* Define if you have the 'resize_term' function. */ #define HAVE_CURSES_RESIZE_TERM 1 /* Define to 1 if you have the declaration of `isfinite', and to 0 if you don't. */ #define HAVE_DECL_ISFINITE 1 /* Define to 1 if you have the declaration of `isinf', and to 0 if you don't. */ #define HAVE_DECL_ISINF 1 /* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. */ #define HAVE_DECL_ISNAN 1 /* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. */ /* #undef HAVE_DECL_TZNAME */ /* Define to 1 if you have the device macros. */ #define HAVE_DEVICE_MACROS 1 /* Define to 1 if you have the /dev/ptc device file. */ /* #undef HAVE_DEV_PTC */ /* Define to 1 if you have the /dev/ptmx device file. */ #define HAVE_DEV_PTMX 1 /* Define to 1 if you have the <direct.h> header file. */ /* #undef HAVE_DIRECT_H */ /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. */ #define HAVE_DIRENT_H 1 /* Define to 1 if you have the <dlfcn.h> header file. */ #define HAVE_DLFCN_H 1 /* Define to 1 if you have the `dlopen' function. */ #define HAVE_DLOPEN 1 /* Define to 1 if you have the `dup2' function. */ #define HAVE_DUP2 1 /* Defined when any dynamic module loading is enabled. */ #define HAVE_DYNAMIC_LOADING 1 /* Define if you have the 'epoll' functions. */ #define HAVE_EPOLL 1 /* Define to 1 if you have the `erf' function. */ #define HAVE_ERF 1 /* Define to 1 if you have the `erfc' function. */ #define HAVE_ERFC 1 /* Define to 1 if you have the <errno.h> header file. */ #define HAVE_ERRNO_H 1 /* Define to 1 if you have the `execv' function. */ #define HAVE_EXECV 1 /* Define to 1 if you have the `expm1' function. */ #define HAVE_EXPM1 1 /* Define if you have the 'fchdir' function. */ #define HAVE_FCHDIR 1 /* Define to 1 if you have the `fchmod' function. */ #define HAVE_FCHMOD 1 /* Define to 1 if you have the `fchown' function. */ #define HAVE_FCHOWN 1 /* Define to 1 if you have the <fcntl.h> header file. */ #define HAVE_FCNTL_H 1 /* Define if you have the 'fdatasync' function. */ #define HAVE_FDATASYNC 1 /* Define to 1 if you have the `finite' function. */ #define HAVE_FINITE 1 /* Define to 1 if you have the `flock' function. */ #define HAVE_FLOCK 1 /* Define to 1 if you have the `fork' function. */ #define HAVE_FORK 1 /* Define to 1 if you have the `forkpty' function. */ #define HAVE_FORKPTY 1 /* Define to 1 if you have the `fpathconf' function. */ #define HAVE_FPATHCONF 1 /* Define to 1 if you have the `fseek64' function. */ /* #undef HAVE_FSEEK64 */ /* Define to 1 if you have the `fseeko' function. */ #define HAVE_FSEEKO 1 /* Define to 1 if you have the `fstatvfs' function. */ #define HAVE_FSTATVFS 1 /* Define if you have the 'fsync' function. */ #define HAVE_FSYNC 1 /* Define to 1 if you have the `ftell64' function. */ /* #undef HAVE_FTELL64 */ /* Define to 1 if you have the `ftello' function. */ #define HAVE_FTELLO 1 /* Define to 1 if you have the `ftime' function. */ #define HAVE_FTIME 1 /* Define to 1 if you have the `ftruncate' function. */ #define HAVE_FTRUNCATE 1 /* Define to 1 if you have the `gai_strerror' function. */ #define HAVE_GAI_STRERROR 1 /* Define to 1 if you have the `gamma' function. */ #define HAVE_GAMMA 1 /* Define if we can use gcc inline assembler to get and set x87 control word */ #define HAVE_GCC_ASM_FOR_X87 1 /* Define if you have the getaddrinfo function. */ #define HAVE_GETADDRINFO 1 /* Define to 1 if you have the `getcwd' function. */ #define HAVE_GETCWD 1 /* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */ #define HAVE_GETC_UNLOCKED 1 /* Define to 1 if you have the `getgroups' function. */ #define HAVE_GETGROUPS 1 /* Define to 1 if you have the `gethostbyname' function. */ /* #undef HAVE_GETHOSTBYNAME */ /* Define this if you have some version of gethostbyname_r() */ #define HAVE_GETHOSTBYNAME_R 1 /* Define this if you have the 3-arg version of gethostbyname_r(). */ /* #undef HAVE_GETHOSTBYNAME_R_3_ARG */ /* Define this if you have the 5-arg version of gethostbyname_r(). */ /* #undef HAVE_GETHOSTBYNAME_R_5_ARG */ /* Define this if you have the 6-arg version of gethostbyname_r(). */ #define HAVE_GETHOSTBYNAME_R_6_ARG 1 /* Define to 1 if you have the `getitimer' function. */ #define HAVE_GETITIMER 1 /* Define to 1 if you have the `getloadavg' function. */ #define HAVE_GETLOADAVG 1 /* Define to 1 if you have the `getlogin' function. */ #define HAVE_GETLOGIN 1 /* Define to 1 if you have the `getnameinfo' function. */ #define HAVE_GETNAMEINFO 1 /* Define if you have the 'getpagesize' function. */ #define HAVE_GETPAGESIZE 1 /* Define to 1 if you have the `getpeername' function. */ #define HAVE_GETPEERNAME 1 /* Define to 1 if you have the `getpgid' function. */ #define HAVE_GETPGID 1 /* Define to 1 if you have the `getpgrp' function. */ #define HAVE_GETPGRP 1 /* Define to 1 if you have the `getpid' function. */ #define HAVE_GETPID 1 /* Define to 1 if you have the `getpriority' function. */ #define HAVE_GETPRIORITY 1 /* Define to 1 if you have the `getpwent' function. */ #define HAVE_GETPWENT 1 /* Define to 1 if you have the `getresgid' function. */ #define HAVE_GETRESGID 1 /* Define to 1 if you have the `getresuid' function. */ #define HAVE_GETRESUID 1 /* Define to 1 if you have the `getsid' function. */ #define HAVE_GETSID 1 /* Define to 1 if you have the `getspent' function. */ #define HAVE_GETSPENT 1 /* Define to 1 if you have the `getspnam' function. */ #define HAVE_GETSPNAM 1 /* Define to 1 if you have the `gettimeofday' function. */ #define HAVE_GETTIMEOFDAY 1 /* Define to 1 if you have the `getwd' function. */ #define HAVE_GETWD 1 /* Define to 1 if you have the <grp.h> header file. */ #define HAVE_GRP_H 1 /* Define if you have the 'hstrerror' function. */ #define HAVE_HSTRERROR 1 /* Define to 1 if you have the `hypot' function. */ #define HAVE_HYPOT 1 /* Define to 1 if you have the <ieeefp.h> header file. */ /* #undef HAVE_IEEEFP_H */ /* Define if you have the 'inet_aton' function. */ #define HAVE_INET_ATON 1 /* Define if you have the 'inet_pton' function. */ #define HAVE_INET_PTON 1 /* Define to 1 if you have the `initgroups' function. */ #define HAVE_INITGROUPS 1 /* Define if your compiler provides int32_t. */ #define HAVE_INT32_T 1 /* Define if your compiler provides int64_t. */ #define HAVE_INT64_T 1 /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the <io.h> header file. */ /* #undef HAVE_IO_H */ /* Define to 1 if you have the `kill' function. */ #define HAVE_KILL 1 /* Define to 1 if you have the `killpg' function. */ #define HAVE_KILLPG 1 /* Define if you have the 'kqueue' functions. */ /* #undef HAVE_KQUEUE */ /* Define to 1 if you have the <langinfo.h> header file. */ #define HAVE_LANGINFO_H 1 /* Defined to enable large file support when an off_t is bigger than a long and long long is available and at least as big as an off_t. You may need to add some flags for configuration and compilation to enable this mode. (For Solaris and Linux, the necessary defines are already defined.) */ /* #undef HAVE_LARGEFILE_SUPPORT */ /* Define to 1 if you have the 'lchflags' function. */ /* #undef HAVE_LCHFLAGS */ /* Define to 1 if you have the `lchmod' function. */ /* #undef HAVE_LCHMOD */ /* Define to 1 if you have the `lchown' function. */ #define HAVE_LCHOWN 1 /* Define to 1 if you have the `lgamma' function. */ #define HAVE_LGAMMA 1 /* Define to 1 if you have the `dl' library (-ldl). */ #define HAVE_LIBDL 1 /* Define to 1 if you have the `dld' library (-ldld). */ /* #undef HAVE_LIBDLD */ /* Define to 1 if you have the `ieee' library (-lieee). */ /* #undef HAVE_LIBIEEE */ /* Define to 1 if you have the <libintl.h> header file. */ #define HAVE_LIBINTL_H 1 /* Define if you have the readline library (-lreadline). */ #define HAVE_LIBREADLINE 1 /* Define to 1 if you have the `resolv' library (-lresolv). */ /* #undef HAVE_LIBRESOLV */ /* Define to 1 if you have the <libutil.h> header file. */ /* #undef HAVE_LIBUTIL_H */ /* Define if you have the 'link' function. */ #define HAVE_LINK 1 /* Define to 1 if you have the <linux/netlink.h> header file. */ #define HAVE_LINUX_NETLINK_H 1 /* Define to 1 if you have the <linux/tipc.h> header file. */ #define HAVE_LINUX_TIPC_H 1 /* Define to 1 if you have the `log1p' function. */ #define HAVE_LOG1P 1 /* Define this if you have the type long double. */ #define HAVE_LONG_DOUBLE 1 /* Define this if you have the type long long. */ #define HAVE_LONG_LONG 1 /* Define to 1 if you have the `lstat' function. */ #define HAVE_LSTAT 1 /* Define this if you have the makedev macro. */ #define HAVE_MAKEDEV 1 /* Define to 1 if you have the `memmove' function. */ #define HAVE_MEMMOVE 1 /* Define to 1 if you have the <memory.h> header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the `mkfifo' function. */ #define HAVE_MKFIFO 1 /* Define to 1 if you have the `mknod' function. */ #define HAVE_MKNOD 1 /* Define to 1 if you have the `mktime' function. */ #define HAVE_MKTIME 1 /* Define to 1 if you have the `mmap' function. */ #define HAVE_MMAP 1 /* Define to 1 if you have the `mremap' function. */ #define HAVE_MREMAP 1 /* Define to 1 if you have the <ncurses.h> header file. */ #define HAVE_NCURSES_H 1 /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ /* #undef HAVE_NDIR_H */ /* Define to 1 if you have the <netpacket/packet.h> header file. */ #define HAVE_NETPACKET_PACKET_H 1 /* Define to 1 if you have the `nice' function. */ #define HAVE_NICE 1 /* Define to 1 if you have the `openpty' function. */ #define HAVE_OPENPTY 1 /* Define if compiling using MacOS X 10.5 SDK or later. */ /* #undef HAVE_OSX105_SDK */ /* Define to 1 if you have the `pathconf' function. */ #define HAVE_PATHCONF 1 /* Define to 1 if you have the `pause' function. */ #define HAVE_PAUSE 1 /* Define to 1 if you have the `plock' function. */ /* #undef HAVE_PLOCK */ /* Define to 1 if you have the `poll' function. */ #define HAVE_POLL 1 /* Define to 1 if you have the <poll.h> header file. */ #define HAVE_POLL_H 1 /* Define to 1 if you have the <process.h> header file. */ /* #undef HAVE_PROCESS_H */ /* Define if your compiler supports function prototype */ #define HAVE_PROTOTYPES 1 /* Define if you have GNU PTH threads. */ /* #undef HAVE_PTH */ /* Defined for Solaris 2.6 bug in pthread header. */ /* #undef HAVE_PTHREAD_DESTRUCTOR */ /* Define to 1 if you have the <pthread.h> header file. */ #define HAVE_PTHREAD_H 1 /* Define to 1 if you have the `pthread_init' function. */ /* #undef HAVE_PTHREAD_INIT */ /* Define to 1 if you have the `pthread_sigmask' function. */ #define HAVE_PTHREAD_SIGMASK 1 /* Define to 1 if you have the <pty.h> header file. */ #define HAVE_PTY_H 1 /* Define to 1 if you have the `putenv' function. */ #define HAVE_PUTENV 1 /* Define to 1 if you have the `readlink' function. */ #define HAVE_READLINK 1 /* Define to 1 if you have the `realpath' function. */ #define HAVE_REALPATH 1 /* Define if you have readline 2.1 */ #define HAVE_RL_CALLBACK 1 /* Define if you can turn off readline's signal handling. */ #define HAVE_RL_CATCH_SIGNAL 1 /* Define if you have readline 2.2 */ #define HAVE_RL_COMPLETION_APPEND_CHARACTER 1 /* Define if you have readline 4.0 */ #define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1 /* Define if you have readline 4.2 */ #define HAVE_RL_COMPLETION_MATCHES 1 /* Define if you have rl_completion_suppress_append */ #define HAVE_RL_COMPLETION_SUPPRESS_APPEND 1 /* Define if you have readline 4.0 */ #define HAVE_RL_PRE_INPUT_HOOK 1 /* Define to 1 if you have the `round' function. */ #define HAVE_ROUND 1 /* Define to 1 if you have the `select' function. */ #define HAVE_SELECT 1 /* Define to 1 if you have the `sem_getvalue' function. */ #define HAVE_SEM_GETVALUE 1 /* Define to 1 if you have the `sem_open' function. */ #define HAVE_SEM_OPEN 1 /* Define to 1 if you have the `sem_timedwait' function. */ #define HAVE_SEM_TIMEDWAIT 1 /* Define to 1 if you have the `sem_unlink' function. */ #define HAVE_SEM_UNLINK 1 /* Define to 1 if you have the `setegid' function. */ #define HAVE_SETEGID 1 /* Define to 1 if you have the `seteuid' function. */ #define HAVE_SETEUID 1 /* Define to 1 if you have the `setgid' function. */ #define HAVE_SETGID 1 /* Define if you have the 'setgroups' function. */ #define HAVE_SETGROUPS 1 /* Define to 1 if you have the `setitimer' function. */ #define HAVE_SETITIMER 1 /* Define to 1 if you have the `setlocale' function. */ #define HAVE_SETLOCALE 1 /* Define to 1 if you have the `setpgid' function. */ #define HAVE_SETPGID 1 /* Define to 1 if you have the `setpgrp' function. */ #define HAVE_SETPGRP 1 /* Define to 1 if you have the `setregid' function. */ #define HAVE_SETREGID 1 /* Define to 1 if you have the `setresgid' function. */ #define HAVE_SETRESGID 1 /* Define to 1 if you have the `setresuid' function. */ #define HAVE_SETRESUID 1 /* Define to 1 if you have the `setreuid' function. */ #define HAVE_SETREUID 1 /* Define to 1 if you have the `setsid' function. */ #define HAVE_SETSID 1 /* Define to 1 if you have the `setuid' function. */ #define HAVE_SETUID 1 /* Define to 1 if you have the `setvbuf' function. */ #define HAVE_SETVBUF 1 /* Define to 1 if you have the <shadow.h> header file. */ #define HAVE_SHADOW_H 1 /* Define to 1 if you have the `sigaction' function. */ #define HAVE_SIGACTION 1 /* Define to 1 if you have the `siginterrupt' function. */ #define HAVE_SIGINTERRUPT 1 /* Define to 1 if you have the <signal.h> header file. */ #define HAVE_SIGNAL_H 1 /* Define to 1 if you have the `sigrelse' function. */ #define HAVE_SIGRELSE 1 /* Define to 1 if you have the `snprintf' function. */ #define HAVE_SNPRINTF 1 /* Define if sockaddr has sa_len member */ /* #undef HAVE_SOCKADDR_SA_LEN */ /* struct sockaddr_storage (sys/socket.h) */ #define HAVE_SOCKADDR_STORAGE 1 /* Define if you have the 'socketpair' function. */ #define HAVE_SOCKETPAIR 1 /* Define to 1 if you have the <spawn.h> header file. */ #define HAVE_SPAWN_H 1 /* Define if your compiler provides ssize_t */ #define HAVE_SSIZE_T 1 /* Define to 1 if you have the `statvfs' function. */ #define HAVE_STATVFS 1 /* Define if you have struct stat.st_mtim.tv_nsec */ #define HAVE_STAT_TV_NSEC 1 /* Define if you have struct stat.st_mtimensec */ /* #undef HAVE_STAT_TV_NSEC2 */ /* Define if your compiler supports variable length function prototypes (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */ #define HAVE_STDARG_PROTOTYPES 1 /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the `strdup' function. */ #define HAVE_STRDUP 1 /* Define to 1 if you have the `strftime' function. */ #define HAVE_STRFTIME 1 /* Define to 1 if you have the <strings.h> header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the <stropts.h> header file. */ /* #undef HAVE_STROPTS_H */ /* Define to 1 if `st_birthtime' is a member of `struct stat'. */ /* #undef HAVE_STRUCT_STAT_ST_BIRTHTIME */ /* Define to 1 if `st_blksize' is a member of `struct stat'. */ #define HAVE_STRUCT_STAT_ST_BLKSIZE 1 /* Define to 1 if `st_blocks' is a member of `struct stat'. */ #define HAVE_STRUCT_STAT_ST_BLOCKS 1 /* Define to 1 if `st_flags' is a member of `struct stat'. */ /* #undef HAVE_STRUCT_STAT_ST_FLAGS */ /* Define to 1 if `st_gen' is a member of `struct stat'. */ /* #undef HAVE_STRUCT_STAT_ST_GEN */ /* Define to 1 if `st_rdev' is a member of `struct stat'. */ #define HAVE_STRUCT_STAT_ST_RDEV 1 /* Define to 1 if `tm_zone' is a member of `struct tm'. */ #define HAVE_STRUCT_TM_TM_ZONE 1 /* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ #define HAVE_ST_BLOCKS 1 /* Define if you have the 'symlink' function. */ #define HAVE_SYMLINK 1 /* Define to 1 if you have the `sysconf' function. */ #define HAVE_SYSCONF 1 /* Define to 1 if you have the <sysexits.h> header file. */ #define HAVE_SYSEXITS_H 1 /* Define to 1 if you have the <sys/audioio.h> header file. */ /* #undef HAVE_SYS_AUDIOIO_H */ /* Define to 1 if you have the <sys/bsdtty.h> header file. */ /* #undef HAVE_SYS_BSDTTY_H */ /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. */ /* #undef HAVE_SYS_DIR_H */ /* Define to 1 if you have the <sys/epoll.h> header file. */ #define HAVE_SYS_EPOLL_H 1 /* Define to 1 if you have the <sys/event.h> header file. */ /* #undef HAVE_SYS_EVENT_H */ /* Define to 1 if you have the <sys/file.h> header file. */ #define HAVE_SYS_FILE_H 1 /* Define to 1 if you have the <sys/loadavg.h> header file. */ /* #undef HAVE_SYS_LOADAVG_H */ /* Define to 1 if you have the <sys/lock.h> header file. */ /* #undef HAVE_SYS_LOCK_H */ /* Define to 1 if you have the <sys/mkdev.h> header file. */ /* #undef HAVE_SYS_MKDEV_H */ /* Define to 1 if you have the <sys/modem.h> header file. */ /* #undef HAVE_SYS_MODEM_H */ /* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. */ /* #undef HAVE_SYS_NDIR_H */ /* Define to 1 if you have the <sys/param.h> header file. */ #define HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the <sys/poll.h> header file. */ #define HAVE_SYS_POLL_H 1 /* Define to 1 if you have the <sys/resource.h> header file. */ #define HAVE_SYS_RESOURCE_H 1 /* Define to 1 if you have the <sys/select.h> header file. */ #define HAVE_SYS_SELECT_H 1 /* Define to 1 if you have the <sys/socket.h> header file. */ #define HAVE_SYS_SOCKET_H 1 /* Define to 1 if you have the <sys/statvfs.h> header file. */ #define HAVE_SYS_STATVFS_H 1 /* Define to 1 if you have the <sys/stat.h> header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the <sys/termio.h> header file. */ /* #undef HAVE_SYS_TERMIO_H */ /* Define to 1 if you have the <sys/times.h> header file. */ #define HAVE_SYS_TIMES_H 1 /* Define to 1 if you have the <sys/time.h> header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <sys/un.h> header file. */ #define HAVE_SYS_UN_H 1 /* Define to 1 if you have the <sys/utsname.h> header file. */ #define HAVE_SYS_UTSNAME_H 1 /* Define to 1 if you have the <sys/wait.h> header file. */ #define HAVE_SYS_WAIT_H 1 /* Define to 1 if you have the `tcgetpgrp' function. */ #define HAVE_TCGETPGRP 1 /* Define to 1 if you have the `tcsetpgrp' function. */ #define HAVE_TCSETPGRP 1 /* Define to 1 if you have the `tempnam' function. */ #define HAVE_TEMPNAM 1 /* Define to 1 if you have the <termios.h> header file. */ #define HAVE_TERMIOS_H 1 /* Define to 1 if you have the <term.h> header file. */ #define HAVE_TERM_H 1 /* Define to 1 if you have the `tgamma' function. */ #define HAVE_TGAMMA 1 /* Define to 1 if you have the <thread.h> header file. */ /* #undef HAVE_THREAD_H */ /* Define to 1 if you have the `timegm' function. */ #define HAVE_TIMEGM 1 /* Define to 1 if you have the `times' function. */ #define HAVE_TIMES 1 /* Define to 1 if you have the `tmpfile' function. */ #define HAVE_TMPFILE 1 /* Define to 1 if you have the `tmpnam' function. */ #define HAVE_TMPNAM 1 /* Define to 1 if you have the `tmpnam_r' function. */ #define HAVE_TMPNAM_R 1 /* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use `HAVE_STRUCT_TM_TM_ZONE' instead. */ #define HAVE_TM_ZONE 1 /* Define to 1 if you have the `truncate' function. */ #define HAVE_TRUNCATE 1 /* Define to 1 if you don't have `tm_zone' but do have the external array `tzname'. */ /* #undef HAVE_TZNAME */ /* Define this if you have tcl and TCL_UTF_MAX==6 */ /* #undef HAVE_UCS4_TCL */ /* Define if your compiler provides uint32_t. */ #define HAVE_UINT32_T 1 /* Define if your compiler provides uint64_t. */ #define HAVE_UINT64_T 1 /* Define to 1 if the system has the type `uintptr_t'. */ #define HAVE_UINTPTR_T 1 /* Define to 1 if you have the `uname' function. */ #define HAVE_UNAME 1 /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the `unsetenv' function. */ #define HAVE_UNSETENV 1 /* Define if you have a useable wchar_t type defined in wchar.h; useable means wchar_t must be an unsigned type with at least 16 bits. (see Include/unicodeobject.h). */ /* #undef HAVE_USABLE_WCHAR_T */ /* Define to 1 if you have the <util.h> header file. */ /* #undef HAVE_UTIL_H */ /* Define to 1 if you have the `utimes' function. */ #define HAVE_UTIMES 1 /* Define to 1 if you have the <utime.h> header file. */ #define HAVE_UTIME_H 1 /* Define to 1 if you have the `wait3' function. */ #define HAVE_WAIT3 1 /* Define to 1 if you have the `wait4' function. */ #define HAVE_WAIT4 1 /* Define to 1 if you have the `waitpid' function. */ #define HAVE_WAITPID 1 /* Define if the compiler provides a wchar.h header file. */ #define HAVE_WCHAR_H 1 /* Define to 1 if you have the `wcscoll' function. */ #define HAVE_WCSCOLL 1 /* Define if tzset() actually switches the local timezone in a meaningful way. */ #define HAVE_WORKING_TZSET 1 /* Define if the zlib library has inflateCopy */ #define HAVE_ZLIB_COPY 1 /* Define to 1 if you have the `_getpty' function. */ /* #undef HAVE__GETPTY */ /* Define if you are using Mach cthreads directly under /include */ /* #undef HURD_C_THREADS */ /* Define if you are using Mach cthreads under mach / */ /* #undef MACH_C_THREADS */ /* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>. */ /* #undef MAJOR_IN_MKDEV */ /* Define to 1 if `major', `minor', and `makedev' are declared in <sysmacros.h>. */ /* #undef MAJOR_IN_SYSMACROS */ /* Define if mvwdelch in curses.h is an expression. */ #define MVWDELCH_IS_EXPRESSION 1 /* Define to the address where bug reports for this package should be sent. */ /* #undef PACKAGE_BUGREPORT */ /* Define to the full name of this package. */ /* #undef PACKAGE_NAME */ /* Define to the full name and version of this package. */ /* #undef PACKAGE_STRING */ /* Define to the one symbol short name of this package. */ /* #undef PACKAGE_TARNAME */ /* Define to the home page for this package. */ /* #undef PACKAGE_URL */ /* Define to the version of this package. */ /* #undef PACKAGE_VERSION */ /* Define if POSIX semaphores aren't enabled on your system */ /* #undef POSIX_SEMAPHORES_NOT_ENABLED */ /* Defined if PTHREAD_SCOPE_SYSTEM supported. */ #define PTHREAD_SYSTEM_SCHED_SUPPORTED 1 /* Define as the preferred size in bits of long digits */ /* #undef PYLONG_BITS_IN_DIGIT */ /* Define to printf format modifier for long long type */ #define PY_FORMAT_LONG_LONG "ll" /* Define to printf format modifier for Py_ssize_t */ #define PY_FORMAT_SIZE_T "z" /* Define as the integral type used for Unicode representation. */ /* #undef PY_UNICODE_TYPE */ /* Define if you want to build an interpreter with many run-time checks. */ /* #undef Py_DEBUG */ /* Defined if Python is built as a shared library. */ #define Py_ENABLE_SHARED 1 /* Define as the size of the unicode type. */ #define Py_UNICODE_SIZE 4 /* Define if you want to have a Unicode type. */ #define Py_USING_UNICODE 1 /* assume C89 semantics that RETSIGTYPE is always void */ #define RETSIGTYPE void /* Define if setpgrp() must be called as setpgrp(0, 0). */ /* #undef SETPGRP_HAVE_ARG */ /* Define this to be extension of shared libraries (including the dot!). */ #define SHLIB_EXT ".so" /* Define if i>>j for signed int i does not extend the sign bit when i < 0 */ /* #undef SIGNED_RIGHT_SHIFT_ZERO_FILLS */ /* The size of `double', as computed by sizeof. */ #define SIZEOF_DOUBLE 8 /* The size of `float', as computed by sizeof. */ #define SIZEOF_FLOAT 4 /* The size of `fpos_t', as computed by sizeof. */ #define SIZEOF_FPOS_T 16 /* The size of `int', as computed by sizeof. */ #define SIZEOF_INT 4 /* The size of `long', as computed by sizeof. */ #define SIZEOF_LONG 8 /* The size of `long double', as computed by sizeof. */ #define SIZEOF_LONG_DOUBLE 16 /* The size of `long long', as computed by sizeof. */ #define SIZEOF_LONG_LONG 8 /* The size of `off_t', as computed by sizeof. */ #define SIZEOF_OFF_T 8 /* The size of `pid_t', as computed by sizeof. */ #define SIZEOF_PID_T 4 /* The size of `pthread_t', as computed by sizeof. */ #define SIZEOF_PTHREAD_T 8 /* The size of `short', as computed by sizeof. */ #define SIZEOF_SHORT 2 /* The size of `size_t', as computed by sizeof. */ #define SIZEOF_SIZE_T 8 /* The size of `time_t', as computed by sizeof. */ #define SIZEOF_TIME_T 8 /* The size of `uintptr_t', as computed by sizeof. */ #define SIZEOF_UINTPTR_T 8 /* The size of `void *', as computed by sizeof. */ #define SIZEOF_VOID_P 8 /* The size of `wchar_t', as computed by sizeof. */ #define SIZEOF_WCHAR_T 4 /* The size of `_Bool', as computed by sizeof. */ #define SIZEOF__BOOL 1 /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define if you can safely include both <sys/select.h> and <sys/time.h> (which you can't on SCO ODT 3.0). */ #define SYS_SELECT_WITH_SYS_TIME 1 /* Define if tanh(-0.) is -0., or if platform doesn't have signed zeros */ #define TANH_PRESERVES_ZERO_SIGN 1 /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ #define TIME_WITH_SYS_TIME 1 /* Define to 1 if your <sys/time.h> declares `struct tm'. */ /* #undef TM_IN_SYS_TIME */ /* Define if you want to use computed gotos in ceval.c. */ /* #undef USE_COMPUTED_GOTOS */ /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # define _ALL_SOURCE 1 #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # define _POSIX_PTHREAD_SEMANTICS 1 #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # define _TANDEM_SOURCE 1 #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # define __EXTENSIONS__ 1 #endif /* Define if you want to use MacPython modules on MacOSX in unix-Python. */ /* #undef USE_TOOLBOX_OBJECT_GLUE */ /* Define if a va_list is an array of some kind */ #define VA_LIST_IS_ARRAY 1 /* Define if you want SIGFPE handled (see Include/pyfpe.h). */ /* #undef WANT_SIGFPE_HANDLER */ /* Define if you want wctype.h functions to be used instead of the one supplied by Python itself. (see Include/unicodectype.h). */ /* #undef WANT_WCTYPE_FUNCTIONS */ /* Define if WINDOW in curses.h offers a field _flags. */ #define WINDOW_HAS_FLAGS 1 /* Define if you want documentation strings in extension modules */ #define WITH_DOC_STRINGS 1 /* Define if you want to compile in Dtrace support */ #define WITH_DTRACE 1 /* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic linker (dyld) instead of the old-style (NextStep) dynamic linker (rld). Dyld is necessary to support frameworks. */ /* #undef WITH_DYLD */ /* Define to 1 if libintl is needed for locale functions. */ /* #undef WITH_LIBINTL */ /* Define if you want to produce an OpenStep/Rhapsody framework (shared library plus accessory files). */ /* #undef WITH_NEXT_FRAMEWORK */ /* Define if you want to compile in Python-specific mallocs */ #define WITH_PYMALLOC 1 /* Define if you want to compile in rudimentary thread support */ #define WITH_THREAD 1 /* Define to profile with the Pentium timestamp counter */ /* #undef WITH_TSC */ /* Define if you want pymalloc to be disabled when running under valgrind */ #define WITH_VALGRIND 1 /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN /* # undef WORDS_BIGENDIAN */ # endif #endif /* Define if arithmetic is subject to x87-style double rounding issue */ /* #undef X87_DOUBLE_ROUNDING */ /* Define on OpenBSD to activate all library features */ /* #undef _BSD_SOURCE */ /* Define on Irix to enable u_int */ #define _BSD_TYPES 1 /* Define on Darwin to activate all library features */ #define _DARWIN_C_SOURCE 1 /* This must be set to 64 on some systems to enable large file support. */ #define _FILE_OFFSET_BITS 64 /* Define on Linux to activate all library features */ #define _GNU_SOURCE 1 /* This must be defined on some systems to enable large file support. */ #define _LARGEFILE_SOURCE 1 /* This must be defined on AIX systems to enable large file support. */ /* #undef _LARGE_FILES */ /* Define to 1 if on MINIX. */ /* #undef _MINIX */ /* Define on NetBSD to activate all library features */ #define _NETBSD_SOURCE 1 /* Define _OSF_SOURCE to get the makedev macro. */ /* #undef _OSF_SOURCE */ /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ /* #undef _POSIX_1_SOURCE */ /* Define to activate features from IEEE Stds 1003.1-2001 */ #define _POSIX_C_SOURCE 200112L /* Define to 1 if you need to in order for `stat' and other things to work. */ /* #undef _POSIX_SOURCE */ /* Define if you have POSIX threads, and your system does not define that. */ /* #undef _POSIX_THREADS */ /* Define to force use of thread-safe errno, h_errno, and other functions */ /* #undef _REENTRANT */ /* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>, <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the #define below would cause a syntax error. */ /* #undef _UINT32_T */ /* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>, <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the #define below would cause a syntax error. */ /* #undef _UINT64_T */ /* Define to the level of X/Open that your system supports */ #define _XOPEN_SOURCE 600 /* Define to activate Unix95-and-earlier features */ #define _XOPEN_SOURCE_EXTENDED 1 /* Define on FreeBSD to activate all library features */ #define __BSD_VISIBLE 1 /* Define to 1 if type `char' is unsigned and you are not using gcc. */ #ifndef __CHAR_UNSIGNED__ /* # undef __CHAR_UNSIGNED__ */ #endif /* Defined on Solaris to see additional function prototypes. */ #define __EXTENSIONS__ 1 /* Define to 'long' if <time.h> doesn't define. */ /* #undef clock_t */ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ /* Define to `int' if <sys/types.h> doesn't define. */ /* #undef gid_t */ /* Define to the type of a signed integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ /* #undef int32_t */ /* Define to the type of a signed integer type of width exactly 64 bits if such a type exists and the standard includes do not define it. */ /* #undef int64_t */ /* Define to `int' if <sys/types.h> does not define. */ /* #undef mode_t */ /* Define to `long int' if <sys/types.h> does not define. */ /* #undef off_t */ /* Define to `int' if <sys/types.h> does not define. */ /* #undef pid_t */ /* Define to empty if the keyword does not work. */ /* #undef signed */ /* Define to `unsigned int' if <sys/types.h> does not define. */ /* #undef size_t */ /* Define to `int' if <sys/socket.h> does not define. */ /* #undef socklen_t */ /* Define to `int' if <sys/types.h> doesn't define. */ /* #undef uid_t */ /* Define to the type of an unsigned integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ /* #undef uint32_t */ /* Define to the type of an unsigned integer type of width exactly 64 bits if such a type exists and the standard includes do not define it. */ /* #undef uint64_t */ /* Define to empty if the keyword does not work. */ /* #undef volatile */ /* Define the macros needed if on a UnixWare 7.x system. */ #if defined(__USLC__) && defined(__SCO_VERSION__) #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ #endif #endif /*Py_PYCONFIG_H*/ ��������������������������������������������������python2.7/pymath.h����������������������������������������������������������������������������������0000644�����������������00000014575�14763166027�0010017 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_PYMATH_H #define Py_PYMATH_H #include "pyconfig.h" /* include for defines */ /************************************************************************** Symbols and macros to supply platform-independent interfaces to mathematical functions and constants **************************************************************************/ /* Python provides implementations for copysign, round and hypot in * Python/pymath.c just in case your math library doesn't provide the * functions. * *Note: PC/pyconfig.h defines copysign as _copysign */ #ifndef HAVE_COPYSIGN extern double copysign(double, double); #endif #ifndef HAVE_ROUND extern double round(double); #endif #ifndef HAVE_HYPOT extern double hypot(double, double); #endif /* extra declarations */ #ifndef _MSC_VER #ifndef __STDC__ extern double fmod (double, double); extern double frexp (double, int *); extern double ldexp (double, int); extern double modf (double, double *); extern double pow(double, double); #endif /* __STDC__ */ #endif /* _MSC_VER */ #ifdef _OSF_SOURCE /* OSF1 5.1 doesn't make these available with XOPEN_SOURCE_EXTENDED defined */ extern int finite(double); extern double copysign(double, double); #endif /* High precision defintion of pi and e (Euler) * The values are taken from libc6's math.h. */ #ifndef Py_MATH_PIl #define Py_MATH_PIl 3.1415926535897932384626433832795029L #endif #ifndef Py_MATH_PI #define Py_MATH_PI 3.14159265358979323846 #endif #ifndef Py_MATH_El #define Py_MATH_El 2.7182818284590452353602874713526625L #endif #ifndef Py_MATH_E #define Py_MATH_E 2.7182818284590452354 #endif /* On x86, Py_FORCE_DOUBLE forces a floating-point number out of an x87 FPU register and into a 64-bit memory location, rounding from extended precision to double precision in the process. On other platforms it does nothing. */ /* we take double rounding as evidence of x87 usage */ #ifndef Py_FORCE_DOUBLE # ifdef X87_DOUBLE_ROUNDING PyAPI_FUNC(double) _Py_force_double(double); # define Py_FORCE_DOUBLE(X) (_Py_force_double(X)) # else # define Py_FORCE_DOUBLE(X) (X) # endif #endif #ifdef HAVE_GCC_ASM_FOR_X87 PyAPI_FUNC(unsigned short) _Py_get_387controlword(void); PyAPI_FUNC(void) _Py_set_387controlword(unsigned short); #endif /* Py_IS_NAN(X) * Return 1 if float or double arg is a NaN, else 0. * Caution: * X is evaluated more than once. * This may not work on all platforms. Each platform has *some* * way to spell this, though -- override in pyconfig.h if you have * a platform where it doesn't work. * Note: PC/pyconfig.h defines Py_IS_NAN as _isnan */ #ifndef Py_IS_NAN #if defined HAVE_DECL_ISNAN && HAVE_DECL_ISNAN == 1 #define Py_IS_NAN(X) isnan(X) #else #define Py_IS_NAN(X) ((X) != (X)) #endif #endif /* Py_IS_INFINITY(X) * Return 1 if float or double arg is an infinity, else 0. * Caution: * X is evaluated more than once. * This implementation may set the underflow flag if |X| is very small; * it really can't be implemented correctly (& easily) before C99. * Override in pyconfig.h if you have a better spelling on your platform. * Py_FORCE_DOUBLE is used to avoid getting false negatives from a * non-infinite value v sitting in an 80-bit x87 register such that * v becomes infinite when spilled from the register to 64-bit memory. * Note: PC/pyconfig.h defines Py_IS_INFINITY as _isinf */ #ifndef Py_IS_INFINITY # if defined HAVE_DECL_ISINF && HAVE_DECL_ISINF == 1 # define Py_IS_INFINITY(X) isinf(X) # else # define Py_IS_INFINITY(X) ((X) && \ (Py_FORCE_DOUBLE(X)*0.5 == Py_FORCE_DOUBLE(X))) # endif #endif /* Py_IS_FINITE(X) * Return 1 if float or double arg is neither infinite nor NAN, else 0. * Some compilers (e.g. VisualStudio) have intrisics for this, so a special * macro for this particular test is useful * Note: PC/pyconfig.h defines Py_IS_FINITE as _finite */ #ifndef Py_IS_FINITE #if defined HAVE_DECL_ISFINITE && HAVE_DECL_ISFINITE == 1 #define Py_IS_FINITE(X) isfinite(X) #elif defined HAVE_FINITE #define Py_IS_FINITE(X) finite(X) #else #define Py_IS_FINITE(X) (!Py_IS_INFINITY(X) && !Py_IS_NAN(X)) #endif #endif /* HUGE_VAL is supposed to expand to a positive double infinity. Python * uses Py_HUGE_VAL instead because some platforms are broken in this * respect. We used to embed code in pyport.h to try to worm around that, * but different platforms are broken in conflicting ways. If you're on * a platform where HUGE_VAL is defined incorrectly, fiddle your Python * config to #define Py_HUGE_VAL to something that works on your platform. */ #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif /* Py_NAN * A value that evaluates to a NaN. On IEEE 754 platforms INF*0 or * INF/INF works. Define Py_NO_NAN in pyconfig.h if your platform * doesn't support NaNs. */ #if !defined(Py_NAN) && !defined(Py_NO_NAN) #define Py_NAN (Py_HUGE_VAL * 0.) #endif /* Py_OVERFLOWED(X) * Return 1 iff a libm function overflowed. Set errno to 0 before calling * a libm function, and invoke this macro after, passing the function * result. * Caution: * This isn't reliable. C99 no longer requires libm to set errno under * any exceptional condition, but does require +- HUGE_VAL return * values on overflow. A 754 box *probably* maps HUGE_VAL to a * double infinity, and we're cool if that's so, unless the input * was an infinity and an infinity is the expected result. A C89 * system sets errno to ERANGE, so we check for that too. We're * out of luck if a C99 754 box doesn't map HUGE_VAL to +Inf, or * if the returned result is a NaN, or if a C89 box returns HUGE_VAL * in non-overflow cases. * X is evaluated more than once. * Some platforms have better way to spell this, so expect some #ifdef'ery. * * OpenBSD uses 'isinf()' because a compiler bug on that platform causes * the longer macro version to be mis-compiled. This isn't optimal, and * should be removed once a newer compiler is available on that platform. * The system that had the failure was running OpenBSD 3.2 on Intel, with * gcc 2.95.3. * * According to Tim's checkin, the FreeBSD systems use isinf() to work * around a FPE bug on that platform. */ #if defined(__FreeBSD__) || defined(__OpenBSD__) #define Py_OVERFLOWED(X) isinf(X) #else #define Py_OVERFLOWED(X) ((X) != 0.0 && (errno == ERANGE || \ (X) == Py_HUGE_VAL || \ (X) == -Py_HUGE_VAL)) #endif #endif /* Py_PYMATH_H */ �����������������������������������������������������������������������������������������������������������������������������������python2.7/methodobject.h����������������������������������������������������������������������������0000644�����������������00000006433�14763166027�0011156 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Method object interface */ #ifndef Py_METHODOBJECT_H #define Py_METHODOBJECT_H #ifdef __cplusplus extern "C" { #endif /* This is about the type 'builtin_function_or_method', not Python methods in user-defined classes. See classobject.h for the latter. */ PyAPI_DATA(PyTypeObject) PyCFunction_Type; #define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type) typedef PyObject *(*PyCFunction)(PyObject *, PyObject *); typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *, PyObject *); typedef PyObject *(*PyNoArgsFunction)(PyObject *); PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *); PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *); PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *); /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ #define PyCFunction_GET_FUNCTION(func) \ (((PyCFunctionObject *)func) -> m_ml -> ml_meth) #define PyCFunction_GET_SELF(func) \ (((PyCFunctionObject *)func) -> m_self) #define PyCFunction_GET_FLAGS(func) \ (((PyCFunctionObject *)func) -> m_ml -> ml_flags) PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *); struct PyMethodDef { const char *ml_name; /* The name of the built-in function/method */ PyCFunction ml_meth; /* The C function that implements it */ int ml_flags; /* Combination of METH_xxx flags, which mostly describe the args expected by the C func */ const char *ml_doc; /* The __doc__ attribute, or NULL */ }; typedef struct PyMethodDef PyMethodDef; PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, const char *); #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL) PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *, PyObject *); /* Flag passed to newmethodobject */ #define METH_OLDARGS 0x0000 #define METH_VARARGS 0x0001 #define METH_KEYWORDS 0x0002 /* METH_NOARGS and METH_O must not be combined with the flags above. */ #define METH_NOARGS 0x0004 #define METH_O 0x0008 /* METH_CLASS and METH_STATIC are a little different; these control the construction of methods for a class. These cannot be used for functions in modules. */ #define METH_CLASS 0x0010 #define METH_STATIC 0x0020 /* METH_COEXIST allows a method to be entered eventhough a slot has already filled the entry. When defined, the flag allows a separate method, "__contains__" for example, to coexist with a defined slot like sq_contains. */ #define METH_COEXIST 0x0040 typedef struct PyMethodChain { PyMethodDef *methods; /* Methods of this type */ struct PyMethodChain *link; /* NULL or base type */ } PyMethodChain; PyAPI_FUNC(PyObject *) Py_FindMethodInChain(PyMethodChain *, PyObject *, const char *); typedef struct { PyObject_HEAD PyMethodDef *m_ml; /* Description of the C function to call */ PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */ PyObject *m_module; /* The __module__ attribute, can be anything */ } PyCFunctionObject; PyAPI_FUNC(int) PyCFunction_ClearFreeList(void); PyAPI_FUNC(void) _PyCFunction_DebugMallocStats(FILE *out); PyAPI_FUNC(void) _PyMethod_DebugMallocStats(FILE *out); #ifdef __cplusplus } #endif #endif /* !Py_METHODOBJECT_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/ast.h�������������������������������������������������������������������������������������0000644�����������������00000000346�14763166027�0007273 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_AST_H #define Py_AST_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(mod_ty) PyAST_FromNode(const node *, PyCompilerFlags *flags, const char *, PyArena *); #ifdef __cplusplus } #endif #endif /* !Py_AST_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/pymem.h�����������������������������������������������������������������������������������0000644�����������������00000011132�14763166027�0007626 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* The PyMem_ family: low-level memory allocation interfaces. See objimpl.h for the PyObject_ memory family. */ #ifndef Py_PYMEM_H #define Py_PYMEM_H #include "pyport.h" #ifdef __cplusplus extern "C" { #endif /* BEWARE: Each interface exports both functions and macros. Extension modules should use the functions, to ensure binary compatibility across Python versions. Because the Python implementation is free to change internal details, and the macros may (or may not) expose details for speed, if you do use the macros you must recompile your extensions with each Python release. Never mix calls to PyMem_ with calls to the platform malloc/realloc/ calloc/free. For example, on Windows different DLLs may end up using different heaps, and if you use PyMem_Malloc you'll get the memory from the heap used by the Python DLL; it could be a disaster if you free()'ed that directly in your own extension. Using PyMem_Free instead ensures Python can return the memory to the proper heap. As another example, in PYMALLOC_DEBUG mode, Python wraps all calls to all PyMem_ and PyObject_ memory functions in special debugging wrappers that add additional debugging info to dynamic memory blocks. The system routines have no idea what to do with that stuff, and the Python wrappers have no idea what to do with raw blocks obtained directly by the system routines then. The GIL must be held when using these APIs. */ /* * Raw memory interface * ==================== */ /* Functions Functions supplying platform-independent semantics for malloc/realloc/ free. These functions make sure that allocating 0 bytes returns a distinct non-NULL pointer (whenever possible -- if we're flat out of memory, NULL may be returned), even if the platform malloc and realloc don't. Returned pointers must be checked for NULL explicitly. No action is performed on failure (no exception is set, no warning is printed, etc). */ PyAPI_FUNC(void *) PyMem_Malloc(size_t); PyAPI_FUNC(void *) PyMem_Realloc(void *, size_t); PyAPI_FUNC(void) PyMem_Free(void *); /* Starting from Python 1.6, the wrappers Py_{Malloc,Realloc,Free} are no longer supported. They used to call PyErr_NoMemory() on failure. */ /* Macros. */ #ifdef PYMALLOC_DEBUG /* Redirect all memory operations to Python's debugging allocator. */ #define PyMem_MALLOC _PyMem_DebugMalloc #define PyMem_REALLOC _PyMem_DebugRealloc #define PyMem_FREE _PyMem_DebugFree #else /* ! PYMALLOC_DEBUG */ /* PyMem_MALLOC(0) means malloc(1). Some systems would return NULL for malloc(0), which would be treated as an error. Some platforms would return a pointer with no memory behind it, which would break pymalloc. To solve these problems, allocate an extra byte. */ /* Returns NULL to indicate error if a negative size or size larger than Py_ssize_t can represent is supplied. Helps prevents security holes. */ #define PyMem_MALLOC(n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \ : malloc((n) ? (n) : 1)) #define PyMem_REALLOC(p, n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \ : realloc((p), (n) ? (n) : 1)) #define PyMem_FREE free #endif /* PYMALLOC_DEBUG */ /* * Type-oriented memory interface * ============================== * * Allocate memory for n objects of the given type. Returns a new pointer * or NULL if the request was too large or memory allocation failed. Use * these macros rather than doing the multiplication yourself so that proper * overflow checking is always done. */ #define PyMem_New(type, n) \ ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ ( (type *) PyMem_Malloc((n) * sizeof(type)) ) ) #define PyMem_NEW(type, n) \ ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ ( (type *) PyMem_MALLOC((n) * sizeof(type)) ) ) /* * The value of (p) is always clobbered by this macro regardless of success. * The caller MUST check if (p) is NULL afterwards and deal with the memory * error if so. This means the original value of (p) MUST be saved for the * caller's memory error handler to not lose track of it. */ #define PyMem_Resize(p, type, n) \ ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ (type *) PyMem_Realloc((p), (n) * sizeof(type)) ) #define PyMem_RESIZE(p, type, n) \ ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ (type *) PyMem_REALLOC((p), (n) * sizeof(type)) ) /* PyMem{Del,DEL} are left over from ancient days, and shouldn't be used * anymore. They're just confusing aliases for PyMem_{Free,FREE} now. */ #define PyMem_Del PyMem_Free #define PyMem_DEL PyMem_FREE #ifdef __cplusplus } #endif #endif /* !Py_PYMEM_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������python2.7/errcode.h���������������������������������������������������������������������������������0000644�����������������00000002567�14763166027�0010136 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef Py_ERRCODE_H #define Py_ERRCODE_H #ifdef __cplusplus extern "C" { #endif /* Error codes passed around between file input, tokenizer, parser and interpreter. This is necessary so we can turn them into Python exceptions at a higher level. Note that some errors have a slightly different meaning when passed from the tokenizer to the parser than when passed from the parser to the interpreter; e.g. the parser only returns E_EOF when it hits EOF immediately, and it never returns E_OK. */ #define E_OK 10 /* No error */ #define E_EOF 11 /* End Of File */ #define E_INTR 12 /* Interrupted */ #define E_TOKEN 13 /* Bad token */ #define E_SYNTAX 14 /* Syntax error */ #define E_NOMEM 15 /* Ran out of memory */ #define E_DONE 16 /* Parsing complete */ #define E_ERROR 17 /* Execution error */ #define E_TABSPACE 18 /* Inconsistent mixing of tabs and spaces */ #define E_OVERFLOW 19 /* Node had too many children */ #define E_TOODEEP 20 /* Too many indentation levels */ #define E_DEDENT 21 /* No matching outer block for dedent */ #define E_DECODE 22 /* Error in decoding into Unicode */ #define E_EOFS 23 /* EOF in triple-quoted string */ #define E_EOLS 24 /* EOL in single-quoted string */ #define E_LINECONT 25 /* Unexpected characters after a line continuation */ #define E_IO 26 /* I/O error */ #ifdef __cplusplus } #endif #endif /* !Py_ERRCODE_H */ �����������������������������������������������������������������������������������������������������������������������������������������python2.7/bufferobject.h����������������������������������������������������������������������������0000644�����������������00000001632�14763166027�0011143 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Buffer object interface */ /* Note: the object's structure is private */ #ifndef Py_BUFFEROBJECT_H #define Py_BUFFEROBJECT_H #ifdef __cplusplus extern "C" { #endif PyAPI_DATA(PyTypeObject) PyBuffer_Type; #define PyBuffer_Check(op) (Py_TYPE(op) == &PyBuffer_Type) #define Py_END_OF_BUFFER (-1) PyAPI_FUNC(PyObject *) PyBuffer_FromObject(PyObject *base, Py_ssize_t offset, Py_ssize_t size); PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteObject(PyObject *base, Py_ssize_t offset, Py_ssize_t size); PyAPI_FUNC(PyObject *) PyBuffer_FromMemory(void *ptr, Py_ssize_t size); PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteMemory(void *ptr, Py_ssize_t size); PyAPI_FUNC(PyObject *) PyBuffer_New(Py_ssize_t size); #ifdef __cplusplus } #endif #endif /* !Py_BUFFEROBJECT_H */ ������������������������������������������������������������������������������������������������������termios.h�������������������������������������������������������������������������������������������0000644�����������������00000007026�14763166027�0006420 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-1994,1996-1999,2003,2010,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 7.1-2 General Terminal Interface <termios.h> */ #ifndef _TERMIOS_H #define _TERMIOS_H 1 #include <features.h> #if defined __USE_UNIX98 || defined __USE_XOPEN2K8 /* We need `pid_t'. */ # include <bits/types.h> # ifndef __pid_t_defined typedef __pid_t pid_t; # define __pid_t_defined # endif #endif __BEGIN_DECLS /* Get the system-dependent definitions of `struct termios', `tcflag_t', `cc_t', `speed_t', and all the macros specifying the flag bits. */ #include <bits/termios.h> #ifdef __USE_BSD /* Compare a character C to a value VAL from the `c_cc' array in a `struct termios'. If VAL is _POSIX_VDISABLE, no character can match it. */ # define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE) #endif /* Return the output baud rate stored in *TERMIOS_P. */ extern speed_t cfgetospeed (const struct termios *__termios_p) __THROW; /* Return the input baud rate stored in *TERMIOS_P. */ extern speed_t cfgetispeed (const struct termios *__termios_p) __THROW; /* Set the output baud rate stored in *TERMIOS_P to SPEED. */ extern int cfsetospeed (struct termios *__termios_p, speed_t __speed) __THROW; /* Set the input baud rate stored in *TERMIOS_P to SPEED. */ extern int cfsetispeed (struct termios *__termios_p, speed_t __speed) __THROW; #ifdef __USE_BSD /* Set both the input and output baud rates in *TERMIOS_OP to SPEED. */ extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __THROW; #endif /* Put the state of FD into *TERMIOS_P. */ extern int tcgetattr (int __fd, struct termios *__termios_p) __THROW; /* Set the state of FD to *TERMIOS_P. Values for OPTIONAL_ACTIONS (TCSA*) are in <bits/termios.h>. */ extern int tcsetattr (int __fd, int __optional_actions, const struct termios *__termios_p) __THROW; #ifdef __USE_BSD /* Set *TERMIOS_P to indicate raw mode. */ extern void cfmakeraw (struct termios *__termios_p) __THROW; #endif /* Send zero bits on FD. */ extern int tcsendbreak (int __fd, int __duration) __THROW; /* Wait for pending output to be written on FD. This function is a cancellation point and therefore not marked with __THROW. */ extern int tcdrain (int __fd); /* Flush pending data on FD. Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in <bits/termios.h>. */ extern int tcflush (int __fd, int __queue_selector) __THROW; /* Suspend or restart transmission on FD. Values for ACTION (TC[IO]{OFF,ON}) are in <bits/termios.h>. */ extern int tcflow (int __fd, int __action) __THROW; #if defined __USE_UNIX98 || defined __USE_XOPEN2K8 /* Get process group ID for session leader for controlling terminal FD. */ extern __pid_t tcgetsid (int __fd) __THROW; #endif #ifdef __USE_BSD # include <sys/ttydefaults.h> #endif __END_DECLS #endif /* termios.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/ioctl.h�����������������������������������������������������������������������������������������0000644�����������������00000000037�14763166027�0006623 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <asm-generic/ioctl.h> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/prctl.h�����������������������������������������������������������������������������������������0000644�����������������00000000642�14763166027�0006637 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_PRCTL_H #define _ASM_X86_PRCTL_H #define ARCH_SET_GS 0x1001 #define ARCH_SET_FS 0x1002 #define ARCH_GET_FS 0x1003 #define ARCH_GET_GS 0x1004 #define ARCH_GET_CPUID 0x1011 #define ARCH_SET_CPUID 0x1012 #define ARCH_MAP_VDSO_X32 0x2001 #define ARCH_MAP_VDSO_32 0x2002 #define ARCH_MAP_VDSO_64 0x2003 #endif /* _ASM_X86_PRCTL_H */ ����������������������������������������������������������������������������������������������asm/ipcbuf.h����������������������������������������������������������������������������������������0000644�����������������00000000040�14763166027�0006753 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <asm-generic/ipcbuf.h> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/sigcontext32.h����������������������������������������������������������������������������������0000644�����������������00000000367�14763166027�0010053 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_SIGCONTEXT32_H #define _ASM_X86_SIGCONTEXT32_H /* This is a legacy file - all the type definitions are in sigcontext.h: */ #include <asm/sigcontext.h> #endif /* _ASM_X86_SIGCONTEXT32_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/sigcontext.h������������������������������������������������������������������������������������0000644�����������������00000022774�14763166027�0007714 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_SIGCONTEXT_H #define _ASM_X86_SIGCONTEXT_H /* * Linux signal context definitions. The sigcontext includes a complex * hierarchy of CPU and FPU state, available to user-space (on the stack) when * a signal handler is executed. * * As over the years this ABI grew from its very simple roots towards * supporting more and more CPU state organically, some of the details (which * were rather clever hacks back in the days) became a bit quirky by today. * * The current ABI includes flexible provisions for future extensions, so we * won't have to grow new quirks for quite some time. Promise! */ #include <linux/types.h> #define FP_XSTATE_MAGIC1 0x46505853U #define FP_XSTATE_MAGIC2 0x46505845U #define FP_XSTATE_MAGIC2_SIZE sizeof(FP_XSTATE_MAGIC2) /* * Bytes 464..511 in the current 512-byte layout of the FXSAVE/FXRSTOR frame * are reserved for SW usage. On CPUs supporting XSAVE/XRSTOR, these bytes are * used to extend the fpstate pointer in the sigcontext, which now includes the * extended state information along with fpstate information. * * If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then there's a * sw_reserved.extended_size bytes large extended context area present. (The * last 32-bit word of this extended area (at the * fpstate+extended_size-FP_XSTATE_MAGIC2_SIZE address) is set to * FP_XSTATE_MAGIC2 so that you can sanity check your size calculations.) * * This extended area typically grows with newer CPUs that have larger and * larger XSAVE areas. */ struct _fpx_sw_bytes { /* * If set to FP_XSTATE_MAGIC1 then this is an xstate context. * 0 if a legacy frame. */ __u32 magic1; /* * Total size of the fpstate area: * * - if magic1 == 0 then it's sizeof(struct _fpstate) * - if magic1 == FP_XSTATE_MAGIC1 then it's sizeof(struct _xstate) * plus extensions (if any) */ __u32 extended_size; /* * Feature bit mask (including FP/SSE/extended state) that is present * in the memory layout: */ __u64 xfeatures; /* * Actual XSAVE state size, based on the xfeatures saved in the layout. * 'extended_size' is greater than 'xstate_size': */ __u32 xstate_size; /* For future use: */ __u32 padding[7]; }; /* * As documented in the iBCS2 standard: * * The first part of "struct _fpstate" is just the normal i387 hardware setup, * the extra "status" word is used to save the coprocessor status word before * entering the handler. * * The FPU state data structure has had to grow to accommodate the extended FPU * state required by the Streaming SIMD Extensions. There is no documented * standard to accomplish this at the moment. */ /* 10-byte legacy floating point register: */ struct _fpreg { __u16 significand[4]; __u16 exponent; }; /* 16-byte floating point register: */ struct _fpxreg { __u16 significand[4]; __u16 exponent; __u16 padding[3]; }; /* 16-byte XMM register: */ struct _xmmreg { __u32 element[4]; }; #define X86_FXSR_MAGIC 0x0000 /* * The 32-bit FPU frame: */ struct _fpstate_32 { /* Legacy FPU environment: */ __u32 cw; __u32 sw; __u32 tag; __u32 ipoff; __u32 cssel; __u32 dataoff; __u32 datasel; struct _fpreg _st[8]; __u16 status; __u16 magic; /* 0xffff: regular FPU data only */ /* 0x0000: FXSR FPU data */ /* FXSR FPU environment */ __u32 _fxsr_env[6]; /* FXSR FPU env is ignored */ __u32 mxcsr; __u32 reserved; struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */ struct _xmmreg _xmm[8]; /* First 8 XMM registers */ union { __u32 padding1[44]; /* Second 8 XMM registers plus padding */ __u32 padding[44]; /* Alias name for old user-space */ }; union { __u32 padding2[12]; struct _fpx_sw_bytes sw_reserved; /* Potential extended state is encoded here */ }; }; /* * The 64-bit FPU frame. (FXSAVE format and later) * * Note1: If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then the structure is * larger: 'struct _xstate'. Note that 'struct _xstate' embedds * 'struct _fpstate' so that you can always assume the _fpstate portion * exists so that you can check the magic value. * * Note2: Reserved fields may someday contain valuable data. Always * save/restore them when you change signal frames. */ struct _fpstate_64 { __u16 cwd; __u16 swd; /* Note this is not the same as the 32-bit/x87/FSAVE twd: */ __u16 twd; __u16 fop; __u64 rip; __u64 rdp; __u32 mxcsr; __u32 mxcsr_mask; __u32 st_space[32]; /* 8x FP registers, 16 bytes each */ __u32 xmm_space[64]; /* 16x XMM registers, 16 bytes each */ __u32 reserved2[12]; union { __u32 reserved3[12]; struct _fpx_sw_bytes sw_reserved; /* Potential extended state is encoded here */ }; }; #ifdef __i386__ # define _fpstate _fpstate_32 #else # define _fpstate _fpstate_64 #endif struct _header { __u64 xfeatures; __u64 reserved1[2]; __u64 reserved2[5]; }; struct _ymmh_state { /* 16x YMM registers, 16 bytes each: */ __u32 ymmh_space[64]; }; /* * Extended state pointed to by sigcontext::fpstate. * * In addition to the fpstate, information encoded in _xstate::xstate_hdr * indicates the presence of other extended state information supported * by the CPU and kernel: */ struct _xstate { struct _fpstate fpstate; struct _header xstate_hdr; struct _ymmh_state ymmh; /* New processor state extensions go here: */ }; /* * The 32-bit signal frame: */ struct sigcontext_32 { __u16 gs, __gsh; __u16 fs, __fsh; __u16 es, __esh; __u16 ds, __dsh; __u32 di; __u32 si; __u32 bp; __u32 sp; __u32 bx; __u32 dx; __u32 cx; __u32 ax; __u32 trapno; __u32 err; __u32 ip; __u16 cs, __csh; __u32 flags; __u32 sp_at_signal; __u16 ss, __ssh; /* * fpstate is really (struct _fpstate *) or (struct _xstate *) * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end * of extended memory layout. See comments at the definition of * (struct _fpx_sw_bytes) */ __u32 fpstate; /* Zero when no FPU/extended context */ __u32 oldmask; __u32 cr2; }; /* * The 64-bit signal frame: */ struct sigcontext_64 { __u64 r8; __u64 r9; __u64 r10; __u64 r11; __u64 r12; __u64 r13; __u64 r14; __u64 r15; __u64 di; __u64 si; __u64 bp; __u64 bx; __u64 dx; __u64 ax; __u64 cx; __u64 sp; __u64 ip; __u64 flags; __u16 cs; __u16 gs; __u16 fs; __u16 ss; __u64 err; __u64 trapno; __u64 oldmask; __u64 cr2; /* * fpstate is really (struct _fpstate *) or (struct _xstate *) * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end * of extended memory layout. See comments at the definition of * (struct _fpx_sw_bytes) */ __u64 fpstate; /* Zero when no FPU/extended context */ __u64 reserved1[8]; }; /* * Create the real 'struct sigcontext' type: */ /* * The old user-space sigcontext definition, just in case user-space still * relies on it. The kernel definition (in asm/sigcontext.h) has unified * field names but otherwise the same layout. */ #define _fpstate_ia32 _fpstate_32 #define sigcontext_ia32 sigcontext_32 # ifdef __i386__ struct sigcontext { __u16 gs, __gsh; __u16 fs, __fsh; __u16 es, __esh; __u16 ds, __dsh; __u32 edi; __u32 esi; __u32 ebp; __u32 esp; __u32 ebx; __u32 edx; __u32 ecx; __u32 eax; __u32 trapno; __u32 err; __u32 eip; __u16 cs, __csh; __u32 eflags; __u32 esp_at_signal; __u16 ss, __ssh; struct _fpstate *fpstate; __u32 oldmask; __u32 cr2; }; # else /* __x86_64__: */ struct sigcontext { __u64 r8; __u64 r9; __u64 r10; __u64 r11; __u64 r12; __u64 r13; __u64 r14; __u64 r15; __u64 rdi; __u64 rsi; __u64 rbp; __u64 rbx; __u64 rdx; __u64 rax; __u64 rcx; __u64 rsp; __u64 rip; __u64 eflags; /* RFLAGS */ __u16 cs; /* * Prior to 2.5.64 ("[PATCH] x86-64 updates for 2.5.64-bk3"), * Linux saved and restored fs and gs in these slots. This * was counterproductive, as fsbase and gsbase were never * saved, so arch_prctl was presumably unreliable. * * These slots should never be reused without extreme caution: * * - Some DOSEMU versions stash fs and gs in these slots manually, * thus overwriting anything the kernel expects to be preserved * in these slots. * * - If these slots are ever needed for any other purpose, * there is some risk that very old 64-bit binaries could get * confused. I doubt that many such binaries still work, * though, since the same patch in 2.5.64 also removed the * 64-bit set_thread_area syscall, so it appears that there * is no TLS API beyond modify_ldt that works in both pre- * and post-2.5.64 kernels. * * If the kernel ever adds explicit fs, gs, fsbase, and gsbase * save/restore, it will most likely need to be opt-in and use * different context slots. */ __u16 gs; __u16 fs; union { __u16 ss; /* If UC_SIGCONTEXT_SS */ __u16 __pad0; /* Alias name for old (!UC_SIGCONTEXT_SS) user-space */ }; __u64 err; __u64 trapno; __u64 oldmask; __u64 cr2; struct _fpstate *fpstate; /* Zero when no FPU context */ # ifdef __ILP32__ __u32 __fpstate_pad; # endif __u64 reserved1[8]; }; # endif /* __x86_64__ */ #endif /* _ASM_X86_SIGCONTEXT_H */ ����asm/types.h�����������������������������������������������������������������������������������������0000644�����������������00000000230�14763166027�0006650 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_TYPES_H #define _ASM_X86_TYPES_H #include <asm-generic/types.h> #endif /* _ASM_X86_TYPES_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/fcntl.h�����������������������������������������������������������������������������������������0000644�����������������00000000037�14763166027�0006617 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <asm-generic/fcntl.h> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/signal.h����������������������������������������������������������������������������������������0000644�����������������00000005525�14763166027�0006775 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_SIGNAL_H #define _ASM_X86_SIGNAL_H #ifndef __ASSEMBLY__ #include <linux/types.h> #include <linux/time.h> /* Avoid too many header ordering problems. */ struct siginfo; /* Here we must cater to libcs that poke about in kernel headers. */ #define NSIG 32 typedef unsigned long sigset_t; #endif /* __ASSEMBLY__ */ #define SIGHUP 1 #define SIGINT 2 #define SIGQUIT 3 #define SIGILL 4 #define SIGTRAP 5 #define SIGABRT 6 #define SIGIOT 6 #define SIGBUS 7 #define SIGFPE 8 #define SIGKILL 9 #define SIGUSR1 10 #define SIGSEGV 11 #define SIGUSR2 12 #define SIGPIPE 13 #define SIGALRM 14 #define SIGTERM 15 #define SIGSTKFLT 16 #define SIGCHLD 17 #define SIGCONT 18 #define SIGSTOP 19 #define SIGTSTP 20 #define SIGTTIN 21 #define SIGTTOU 22 #define SIGURG 23 #define SIGXCPU 24 #define SIGXFSZ 25 #define SIGVTALRM 26 #define SIGPROF 27 #define SIGWINCH 28 #define SIGIO 29 #define SIGPOLL SIGIO /* #define SIGLOST 29 */ #define SIGPWR 30 #define SIGSYS 31 #define SIGUNUSED 31 /* These should not be considered constants from userland. */ #define SIGRTMIN 32 #define SIGRTMAX _NSIG /* * SA_FLAGS values: * * SA_ONSTACK indicates that a registered stack_t will be used. * SA_RESTART flag to get restarting signals (which were the default long ago) * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. * SA_RESETHAND clears the handler when the signal is delivered. * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. * SA_NODEFER prevents the current signal from being masked in the handler. * * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single * Unix names RESETHAND and NODEFER respectively. */ #define SA_NOCLDSTOP 0x00000001u #define SA_NOCLDWAIT 0x00000002u #define SA_SIGINFO 0x00000004u #define SA_ONSTACK 0x08000000u #define SA_RESTART 0x10000000u #define SA_NODEFER 0x40000000u #define SA_RESETHAND 0x80000000u #define SA_NOMASK SA_NODEFER #define SA_ONESHOT SA_RESETHAND #define SA_RESTORER 0x04000000 #define MINSIGSTKSZ 2048 #define SIGSTKSZ 8192 #include <asm-generic/signal-defs.h> #ifndef __ASSEMBLY__ /* Here we must cater to libcs that poke about in kernel headers. */ #ifdef __i386__ struct sigaction { union { __sighandler_t _sa_handler; void (*_sa_sigaction)(int, struct siginfo *, void *); } _u; sigset_t sa_mask; unsigned long sa_flags; void (*sa_restorer)(void); }; #define sa_handler _u._sa_handler #define sa_sigaction _u._sa_sigaction #else /* __i386__ */ struct sigaction { __sighandler_t sa_handler; unsigned long sa_flags; __sigrestore_t sa_restorer; sigset_t sa_mask; /* mask last for extensibility */ }; #endif /* !__i386__ */ typedef struct sigaltstack { void *ss_sp; int ss_flags; size_t ss_size; } stack_t; #endif /* __ASSEMBLY__ */ #endif /* _ASM_X86_SIGNAL_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/msr.h�������������������������������������������������������������������������������������������0000644�����������������00000000532�14763166027�0006312 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_MSR_H #define _ASM_X86_MSR_H #ifndef __ASSEMBLY__ #include <linux/types.h> #include <linux/ioctl.h> #define X86_IOC_RDMSR_REGS _IOWR('c', 0xA0, __u32[8]) #define X86_IOC_WRMSR_REGS _IOWR('c', 0xA1, __u32[8]) #endif /* __ASSEMBLY__ */ #endif /* _ASM_X86_MSR_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/ptrace-abi.h������������������������������������������������������������������������������������0000644�����������������00000003765�14763166027�0007533 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_PTRACE_ABI_H #define _ASM_X86_PTRACE_ABI_H #ifdef __i386__ #define EBX 0 #define ECX 1 #define EDX 2 #define ESI 3 #define EDI 4 #define EBP 5 #define EAX 6 #define DS 7 #define ES 8 #define FS 9 #define GS 10 #define ORIG_EAX 11 #define EIP 12 #define CS 13 #define EFL 14 #define UESP 15 #define SS 16 #define FRAME_SIZE 17 #else /* __i386__ */ #if defined(__ASSEMBLY__) || defined(__FRAME_OFFSETS) /* * C ABI says these regs are callee-preserved. They aren't saved on kernel entry * unless syscall needs a complete, fully filled "struct pt_regs". */ #define R15 0 #define R14 8 #define R13 16 #define R12 24 #define RBP 32 #define RBX 40 /* These regs are callee-clobbered. Always saved on kernel entry. */ #define R11 48 #define R10 56 #define R9 64 #define R8 72 #define RAX 80 #define RCX 88 #define RDX 96 #define RSI 104 #define RDI 112 /* * On syscall entry, this is syscall#. On CPU exception, this is error code. * On hw interrupt, it's IRQ number: */ #define ORIG_RAX 120 /* Return frame for iretq */ #define RIP 128 #define CS 136 #define EFLAGS 144 #define RSP 152 #define SS 160 #endif /* __ASSEMBLY__ */ /* top of stack page */ #define FRAME_SIZE 168 #endif /* !__i386__ */ /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ #define PTRACE_GETREGS 12 #define PTRACE_SETREGS 13 #define PTRACE_GETFPREGS 14 #define PTRACE_SETFPREGS 15 #define PTRACE_GETFPXREGS 18 #define PTRACE_SETFPXREGS 19 #define PTRACE_OLDSETOPTIONS 21 /* only useful for access 32bit programs / kernels */ #define PTRACE_GET_THREAD_AREA 25 #define PTRACE_SET_THREAD_AREA 26 #ifdef __x86_64__ # define PTRACE_ARCH_PRCTL 30 #endif #define PTRACE_SYSEMU 31 #define PTRACE_SYSEMU_SINGLESTEP 32 #define PTRACE_SINGLEBLOCK 33 /* resume execution until next branch */ #ifndef __ASSEMBLY__ #include <linux/types.h> #endif #endif /* _ASM_X86_PTRACE_ABI_H */ �����������asm/byteorder.h�������������������������������������������������������������������������������������0000644�����������������00000000260�14763166027�0007506 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_BYTEORDER_H #define _ASM_X86_BYTEORDER_H #include <linux/byteorder/little_endian.h> #endif /* _ASM_X86_BYTEORDER_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/siginfo.h���������������������������������������������������������������������������������������0000644�����������������00000000756�14763166027�0007157 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_SIGINFO_H #define _ASM_X86_SIGINFO_H #ifdef __x86_64__ # ifdef __ILP32__ /* x32 */ typedef long long __kernel_si_clock_t __attribute__((aligned(4))); # define __ARCH_SI_CLOCK_T __kernel_si_clock_t # define __ARCH_SI_ATTRIBUTES __attribute__((aligned(8))) # else /* x86-64 */ # define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) # endif #endif #include <asm-generic/siginfo.h> #endif /* _ASM_X86_SIGINFO_H */ ������������������asm/shmbuf.h����������������������������������������������������������������������������������������0000644�����������������00000002352�14763166027�0006777 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_X86_SHMBUF_H #define __ASM_X86_SHMBUF_H #if !defined(__x86_64__) || !defined(__ILP32__) #include <asm-generic/shmbuf.h> #else /* * The shmid64_ds structure for x86 architecture with x32 ABI. * * On x86-32 and x86-64 we can just use the generic definition, but * x32 uses the same binary layout as x86_64, which is differnet * from other 32-bit architectures. */ struct shmid64_ds { struct ipc64_perm shm_perm; /* operation perms */ size_t shm_segsz; /* size of segment (bytes) */ __kernel_time_t shm_atime; /* last attach time */ __kernel_time_t shm_dtime; /* last detach time */ __kernel_time_t shm_ctime; /* last change time */ __kernel_pid_t shm_cpid; /* pid of creator */ __kernel_pid_t shm_lpid; /* pid of last operator */ __kernel_ulong_t shm_nattch; /* no. of current attaches */ __kernel_ulong_t __unused4; __kernel_ulong_t __unused5; }; struct shminfo64 { __kernel_ulong_t shmmax; __kernel_ulong_t shmmin; __kernel_ulong_t shmmni; __kernel_ulong_t shmseg; __kernel_ulong_t shmall; __kernel_ulong_t __unused1; __kernel_ulong_t __unused2; __kernel_ulong_t __unused3; __kernel_ulong_t __unused4; }; #endif #endif /* __ASM_X86_SHMBUF_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/bitsperlong.h�����������������������������������������������������������������������������������0000644�����������������00000000501�14763166027�0010035 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_X86_BITSPERLONG_H #define __ASM_X86_BITSPERLONG_H #if defined(__x86_64__) && !defined(__ILP32__) # define __BITS_PER_LONG 64 #else # define __BITS_PER_LONG 32 #endif #include <asm-generic/bitsperlong.h> #endif /* __ASM_X86_BITSPERLONG_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/sembuf.h����������������������������������������������������������������������������������������0000644�����������������00000002025�14763166027�0006771 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_SEMBUF_H #define _ASM_X86_SEMBUF_H /* * The semid64_ds structure for x86 architecture. * Note extra padding because this structure is passed back and forth * between kernel and user space. * * Pad space is left for: * - 2 miscellaneous 32-bit values * * x86_64 and x32 incorrectly added padding here, so the structures * are still incompatible with the padding on x86. */ struct semid64_ds { struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ #ifdef __i386__ unsigned long sem_otime; /* last semop time */ unsigned long sem_otime_high; unsigned long sem_ctime; /* last change time */ unsigned long sem_ctime_high; #else __kernel_time_t sem_otime; /* last semop time */ __kernel_ulong_t __unused1; __kernel_time_t sem_ctime; /* last change time */ __kernel_ulong_t __unused2; #endif __kernel_ulong_t sem_nsems; /* no. of semaphores in array */ __kernel_ulong_t __unused3; __kernel_ulong_t __unused4; }; #endif /* _ASM_X86_SEMBUF_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/a.out.h�����������������������������������������������������������������������������������������0000644�����������������00000001364�14763166027�0006543 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_A_OUT_H #define _ASM_X86_A_OUT_H struct exec { unsigned int a_info; /* Use macros N_MAGIC, etc for access */ unsigned a_text; /* length of text, in bytes */ unsigned a_data; /* length of data, in bytes */ unsigned a_bss; /* length of uninitialized data area for file, in bytes */ unsigned a_syms; /* length of symbol table data in file, in bytes */ unsigned a_entry; /* start address */ unsigned a_trsize; /* length of relocation info for text, in bytes */ unsigned a_drsize; /* length of relocation info for data, in bytes */ }; #define N_TRSIZE(a) ((a).a_trsize) #define N_DRSIZE(a) ((a).a_drsize) #define N_SYMSIZE(a) ((a).a_syms) #endif /* _ASM_X86_A_OUT_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/termbits.h��������������������������������������������������������������������������������������0000644�����������������00000000042�14763166027�0007336 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <asm-generic/termbits.h> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/mce.h�������������������������������������������������������������������������������������������0000644�����������������00000003230�14763166027�0006253 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_MCE_H #define _ASM_X86_MCE_H #include <linux/types.h> #include <linux/ioctl.h> /* * Fields are zero when not available. Also, this struct is shared with * userspace mcelog and thus must keep existing fields at current offsets. * Only add new fields to the end of the structure */ struct mce { __u64 status; /* Bank's MCi_STATUS MSR */ __u64 misc; /* Bank's MCi_MISC MSR */ __u64 addr; /* Bank's MCi_ADDR MSR */ __u64 mcgstatus; /* Machine Check Global Status MSR */ __u64 ip; /* Instruction Pointer when the error happened */ __u64 tsc; /* CPU time stamp counter */ __u64 time; /* Wall time_t when error was detected */ __u8 cpuvendor; /* Kernel's X86_VENDOR enum */ __u8 inject_flags; /* Software inject flags */ __u8 severity; /* Error severity */ __u8 pad; __u32 cpuid; /* CPUID 1 EAX */ __u8 cs; /* Code segment */ __u8 bank; /* Machine check bank reporting the error */ __u8 cpu; /* CPU number; obsoleted by extcpu */ __u8 finished; /* Entry is valid */ __u32 extcpu; /* Linux CPU number that detected the error */ __u32 socketid; /* CPU socket ID */ __u32 apicid; /* CPU initial APIC ID */ __u64 mcgcap; /* MCGCAP MSR: machine check capabilities of CPU */ __u64 synd; /* MCA_SYND MSR: only valid on SMCA systems */ __u64 ipid; /* MCA_IPID MSR: only valid on SMCA systems */ __u64 ppin; /* Protected Processor Inventory Number */ __u32 microcode; /* Microcode revision */ }; #define MCE_GET_RECORD_LEN _IOR('M', 1, int) #define MCE_GET_LOG_LEN _IOR('M', 2, int) #define MCE_GETCLEAR_FLAGS _IOR('M', 3, int) #endif /* _ASM_X86_MCE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/perf_regs.h�������������������������������������������������������������������������������������0000644�����������������00000001315�14763166027�0007465 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_PERF_REGS_H #define _ASM_X86_PERF_REGS_H enum perf_event_x86_regs { PERF_REG_X86_AX, PERF_REG_X86_BX, PERF_REG_X86_CX, PERF_REG_X86_DX, PERF_REG_X86_SI, PERF_REG_X86_DI, PERF_REG_X86_BP, PERF_REG_X86_SP, PERF_REG_X86_IP, PERF_REG_X86_FLAGS, PERF_REG_X86_CS, PERF_REG_X86_SS, PERF_REG_X86_DS, PERF_REG_X86_ES, PERF_REG_X86_FS, PERF_REG_X86_GS, PERF_REG_X86_R8, PERF_REG_X86_R9, PERF_REG_X86_R10, PERF_REG_X86_R11, PERF_REG_X86_R12, PERF_REG_X86_R13, PERF_REG_X86_R14, PERF_REG_X86_R15, PERF_REG_X86_32_MAX = PERF_REG_X86_GS + 1, PERF_REG_X86_64_MAX = PERF_REG_X86_R15 + 1, }; #endif /* _ASM_X86_PERF_REGS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/swab.h������������������������������������������������������������������������������������������0000644�����������������00000001324�14763166027�0006445 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_SWAB_H #define _ASM_X86_SWAB_H #include <linux/types.h> static __inline__ __u32 __arch_swab32(__u32 val) { __asm__("bswapl %0" : "=r" (val) : "0" (val)); return val; } #define __arch_swab32 __arch_swab32 static __inline__ __u64 __arch_swab64(__u64 val) { #ifdef __i386__ union { struct { __u32 a; __u32 b; } s; __u64 u; } v; v.u = val; __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1" : "=r" (v.s.a), "=r" (v.s.b) : "0" (v.s.a), "1" (v.s.b)); return v.u; #else /* __i386__ */ __asm__("bswapq %0" : "=r" (val) : "0" (val)); return val; #endif } #define __arch_swab64 __arch_swab64 #endif /* _ASM_X86_SWAB_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/setup.h�����������������������������������������������������������������������������������������0000644�����������������00000000006�14763166027�0006645 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/ptrace.h����������������������������������������������������������������������������������������0000644�����������������00000002727�14763166027�0006777 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_PTRACE_H #define _ASM_X86_PTRACE_H /* For */ #include <asm/ptrace-abi.h> #include <asm/processor-flags.h> #ifndef __ASSEMBLY__ #ifdef __i386__ /* this struct defines the way the registers are stored on the stack during a system call. */ struct pt_regs { long ebx; long ecx; long edx; long esi; long edi; long ebp; long eax; int xds; int xes; int xfs; int xgs; long orig_eax; long eip; int xcs; long eflags; long esp; int xss; }; #else /* __i386__ */ struct pt_regs { /* * C ABI says these regs are callee-preserved. They aren't saved on kernel entry * unless syscall needs a complete, fully filled "struct pt_regs". */ unsigned long r15; unsigned long r14; unsigned long r13; unsigned long r12; unsigned long rbp; unsigned long rbx; /* These regs are callee-clobbered. Always saved on kernel entry. */ unsigned long r11; unsigned long r10; unsigned long r9; unsigned long r8; unsigned long rax; unsigned long rcx; unsigned long rdx; unsigned long rsi; unsigned long rdi; /* * On syscall entry, this is syscall#. On CPU exception, this is error code. * On hw interrupt, it's IRQ number: */ unsigned long orig_rax; /* Return frame for iretq */ unsigned long rip; unsigned long cs; unsigned long eflags; unsigned long rsp; unsigned long ss; /* top of stack page */ }; #endif /* !__i386__ */ #endif /* !__ASSEMBLY__ */ #endif /* _ASM_X86_PTRACE_H */ �����������������������������������������asm/ioctls.h����������������������������������������������������������������������������������������0000644�����������������00000000040�14763166027�0007000 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <asm-generic/ioctls.h> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/posix_types_64.h��������������������������������������������������������������������������������0000644�����������������00000001141�14763166027�0010405 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_POSIX_TYPES_64_H #define _ASM_X86_POSIX_TYPES_64_H /* * This file is generally used by user-level software, so you need to * be a little careful about namespace pollution etc. Also, we cannot * assume GCC is being used. */ typedef unsigned short __kernel_old_uid_t; typedef unsigned short __kernel_old_gid_t; #define __kernel_old_uid_t __kernel_old_uid_t typedef unsigned long __kernel_old_dev_t; #define __kernel_old_dev_t __kernel_old_dev_t #include <asm-generic/posix_types.h> #endif /* _ASM_X86_POSIX_TYPES_64_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/vsyscall.h��������������������������������������������������������������������������������������0000644�����������������00000000407�14763166027�0007352 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_VSYSCALL_H #define _ASM_X86_VSYSCALL_H enum vsyscall_num { __NR_vgettimeofday, __NR_vtime, __NR_vgetcpu, }; #define VSYSCALL_ADDR (-10UL << 20) #endif /* _ASM_X86_VSYSCALL_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/mman.h������������������������������������������������������������������������������������������0000644�����������������00000001752�14763166027�0006446 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_MMAN_H #define _ASM_X86_MMAN_H #define MAP_32BIT 0x40 /* only give out 32bit addresses */ #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS /* * Take the 4 protection key bits out of the vma->vm_flags * value and turn them in to the bits that we can put in * to a pte. * * Only override these if Protection Keys are available * (which is only on 64-bit). */ #define arch_vm_get_page_prot(vm_flags) __pgprot( \ ((vm_flags) & VM_PKEY_BIT0 ? _PAGE_PKEY_BIT0 : 0) | \ ((vm_flags) & VM_PKEY_BIT1 ? _PAGE_PKEY_BIT1 : 0) | \ ((vm_flags) & VM_PKEY_BIT2 ? _PAGE_PKEY_BIT2 : 0) | \ ((vm_flags) & VM_PKEY_BIT3 ? _PAGE_PKEY_BIT3 : 0)) #define arch_calc_vm_prot_bits(prot, key) ( \ ((key) & 0x1 ? VM_PKEY_BIT0 : 0) | \ ((key) & 0x2 ? VM_PKEY_BIT1 : 0) | \ ((key) & 0x4 ? VM_PKEY_BIT2 : 0) | \ ((key) & 0x8 ? VM_PKEY_BIT3 : 0)) #endif #include <asm-generic/mman.h> #endif /* _ASM_X86_MMAN_H */ ����������������������asm/bootparam.h�������������������������������������������������������������������������������������0000644�����������������00000016750�14763166027�0007506 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_BOOTPARAM_H #define _ASM_X86_BOOTPARAM_H /* setup_data types */ #define SETUP_NONE 0 #define SETUP_E820_EXT 1 #define SETUP_DTB 2 #define SETUP_PCI 3 #define SETUP_EFI 4 #define SETUP_APPLE_PROPERTIES 5 #define SETUP_JAILHOUSE 6 /* ram_size flags */ #define RAMDISK_IMAGE_START_MASK 0x07FF #define RAMDISK_PROMPT_FLAG 0x8000 #define RAMDISK_LOAD_FLAG 0x4000 /* loadflags */ #define LOADED_HIGH (1<<0) #define KASLR_FLAG (1<<1) #define QUIET_FLAG (1<<5) #define KEEP_SEGMENTS (1<<6) #define CAN_USE_HEAP (1<<7) /* xloadflags */ #define XLF_KERNEL_64 (1<<0) #define XLF_CAN_BE_LOADED_ABOVE_4G (1<<1) #define XLF_EFI_HANDOVER_32 (1<<2) #define XLF_EFI_HANDOVER_64 (1<<3) #define XLF_EFI_KEXEC (1<<4) #ifndef __ASSEMBLY__ #include <linux/types.h> #include <linux/screen_info.h> #include <linux/apm_bios.h> #include <linux/edd.h> #include <asm/ist.h> #include <video/edid.h> /* extensible setup data list node */ struct setup_data { __u64 next; __u32 type; __u32 len; __u8 data[0]; }; struct setup_header { __u8 setup_sects; __u16 root_flags; __u32 syssize; __u16 ram_size; __u16 vid_mode; __u16 root_dev; __u16 boot_flag; __u16 jump; __u32 header; __u16 version; __u32 realmode_swtch; __u16 start_sys_seg; __u16 kernel_version; __u8 type_of_loader; __u8 loadflags; __u16 setup_move_size; __u32 code32_start; __u32 ramdisk_image; __u32 ramdisk_size; __u32 bootsect_kludge; __u16 heap_end_ptr; __u8 ext_loader_ver; __u8 ext_loader_type; __u32 cmd_line_ptr; __u32 initrd_addr_max; __u32 kernel_alignment; __u8 relocatable_kernel; __u8 min_alignment; __u16 xloadflags; __u32 cmdline_size; __u32 hardware_subarch; __u64 hardware_subarch_data; __u32 payload_offset; __u32 payload_length; __u64 setup_data; __u64 pref_address; __u32 init_size; __u32 handover_offset; } __attribute__((packed)); struct sys_desc_table { __u16 length; __u8 table[14]; }; /* Gleaned from OFW's set-parameters in cpu/x86/pc/linux.fth */ struct olpc_ofw_header { __u32 ofw_magic; /* OFW signature */ __u32 ofw_version; __u32 cif_handler; /* callback into OFW */ __u32 irq_desc_table; } __attribute__((packed)); struct efi_info { __u32 efi_loader_signature; __u32 efi_systab; __u32 efi_memdesc_size; __u32 efi_memdesc_version; __u32 efi_memmap; __u32 efi_memmap_size; __u32 efi_systab_hi; __u32 efi_memmap_hi; }; /* * This is the maximum number of entries in struct boot_params::e820_table * (the zeropage), which is part of the x86 boot protocol ABI: */ #define E820_MAX_ENTRIES_ZEROPAGE 128 /* * The E820 memory region entry of the boot protocol ABI: */ struct boot_e820_entry { __u64 addr; __u64 size; __u32 type; } __attribute__((packed)); /* * Smallest compatible version of jailhouse_setup_data required by this kernel. */ #define JAILHOUSE_SETUP_REQUIRED_VERSION 1 /* * The boot loader is passing platform information via this Jailhouse-specific * setup data structure. */ struct jailhouse_setup_data { __u16 version; __u16 compatible_version; __u16 pm_timer_address; __u16 num_cpus; __u64 pci_mmconfig_base; __u32 tsc_khz; __u32 apic_khz; __u8 standard_ioapic; __u8 cpu_ids[255]; } __attribute__((packed)); /* The so-called "zeropage" */ struct boot_params { struct screen_info screen_info; /* 0x000 */ struct apm_bios_info apm_bios_info; /* 0x040 */ __u8 _pad2[4]; /* 0x054 */ __u64 tboot_addr; /* 0x058 */ struct ist_info ist_info; /* 0x060 */ __u8 _pad3[16]; /* 0x070 */ __u8 hd0_info[16]; /* obsolete! */ /* 0x080 */ __u8 hd1_info[16]; /* obsolete! */ /* 0x090 */ struct sys_desc_table sys_desc_table; /* obsolete! */ /* 0x0a0 */ struct olpc_ofw_header olpc_ofw_header; /* 0x0b0 */ __u32 ext_ramdisk_image; /* 0x0c0 */ __u32 ext_ramdisk_size; /* 0x0c4 */ __u32 ext_cmd_line_ptr; /* 0x0c8 */ __u8 _pad4[116]; /* 0x0cc */ struct edid_info edid_info; /* 0x140 */ struct efi_info efi_info; /* 0x1c0 */ __u32 alt_mem_k; /* 0x1e0 */ __u32 scratch; /* Scratch field! */ /* 0x1e4 */ __u8 e820_entries; /* 0x1e8 */ __u8 eddbuf_entries; /* 0x1e9 */ __u8 edd_mbr_sig_buf_entries; /* 0x1ea */ __u8 kbd_status; /* 0x1eb */ __u8 secure_boot; /* 0x1ec */ __u8 _pad5[2]; /* 0x1ed */ /* * The sentinel is set to a nonzero value (0xff) in header.S. * * A bootloader is supposed to only take setup_header and put * it into a clean boot_params buffer. If it turns out that * it is clumsy or too generous with the buffer, it most * probably will pick up the sentinel variable too. The fact * that this variable then is still 0xff will let kernel * know that some variables in boot_params are invalid and * kernel should zero out certain portions of boot_params. */ __u8 sentinel; /* 0x1ef */ __u8 _pad6[1]; /* 0x1f0 */ struct setup_header hdr; /* setup header */ /* 0x1f1 */ __u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)]; __u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */ struct boot_e820_entry e820_table[E820_MAX_ENTRIES_ZEROPAGE]; /* 0x2d0 */ __u8 _pad8[48]; /* 0xcd0 */ struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */ __u8 _pad9[276]; /* 0xeec */ } __attribute__((packed)); /** * enum x86_hardware_subarch - x86 hardware subarchitecture * * The x86 hardware_subarch and hardware_subarch_data were added as of the x86 * boot protocol 2.07 to help distinguish and support custom x86 boot * sequences. This enum represents accepted values for the x86 * hardware_subarch. Custom x86 boot sequences (not X86_SUBARCH_PC) do not * have or simply *cannot* make use of natural stubs like BIOS or EFI, the * hardware_subarch can be used on the Linux entry path to revector to a * subarchitecture stub when needed. This subarchitecture stub can be used to * set up Linux boot parameters or for special care to account for nonstandard * handling of page tables. * * These enums should only ever be used by x86 code, and the code that uses * it should be well contained and compartamentalized. * * KVM and Xen HVM do not have a subarch as these are expected to follow * standard x86 boot entries. If there is a genuine need for "hypervisor" type * that should be considered separately in the future. Future guest types * should seriously consider working with standard x86 boot stubs such as * the BIOS or EFI boot stubs. * * WARNING: this enum is only used for legacy hacks, for platform features that * are not easily enumerated or discoverable. You should not ever use * this for new features. * * @X86_SUBARCH_PC: Should be used if the hardware is enumerable using standard * PC mechanisms (PCI, ACPI) and doesn't need a special boot flow. * @X86_SUBARCH_LGUEST: Used for x86 hypervisor demo, lguest, deprecated * @X86_SUBARCH_XEN: Used for Xen guest types which follow the PV boot path, * which start at __asm__ startup_xen() entry point and later jump to the C * xen_start_kernel() entry point. Both domU and dom0 type of guests are * currently supportd through this PV boot path. * @X86_SUBARCH_INTEL_MID: Used for Intel MID (Mobile Internet Device) platform * systems which do not have the PCI legacy interfaces. * @X86_SUBARCH_CE4100: Used for Intel CE media processor (CE4100) SoC for * for settop boxes and media devices, the use of a subarch for CE4100 * is more of a hack... */ enum x86_hardware_subarch { X86_SUBARCH_PC = 0, X86_SUBARCH_LGUEST, X86_SUBARCH_XEN, X86_SUBARCH_INTEL_MID, X86_SUBARCH_CE4100, X86_NR_SUBARCHS, }; #endif /* __ASSEMBLY__ */ #endif /* _ASM_X86_BOOTPARAM_H */ ������������������������asm/ldt.h�������������������������������������������������������������������������������������������0000644�����������������00000002432�14763166027�0006275 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ldt.h * * Definitions of structures used with the modify_ldt system call. */ #ifndef _ASM_X86_LDT_H #define _ASM_X86_LDT_H /* Maximum number of LDT entries supported. */ #define LDT_ENTRIES 8192 /* The size of each LDT entry. */ #define LDT_ENTRY_SIZE 8 #ifndef __ASSEMBLY__ /* * Note on 64bit base and limit is ignored and you cannot set DS/ES/CS * not to the default values if you still want to do syscalls. This * call is more for 32bit mode therefore. */ struct user_desc { unsigned int entry_number; unsigned int base_addr; unsigned int limit; unsigned int seg_32bit:1; unsigned int contents:2; unsigned int read_exec_only:1; unsigned int limit_in_pages:1; unsigned int seg_not_present:1; unsigned int useable:1; #ifdef __x86_64__ /* * Because this bit is not present in 32-bit user code, user * programs can pass uninitialized values here. Therefore, in * any context in which a user_desc comes from a 32-bit program, * the kernel must act as though lm == 0, regardless of the * actual value. */ unsigned int lm:1; #endif }; #define MODIFY_LDT_CONTENTS_DATA 0 #define MODIFY_LDT_CONTENTS_STACK 1 #define MODIFY_LDT_CONTENTS_CODE 2 #endif /* !__ASSEMBLY__ */ #endif /* _ASM_X86_LDT_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/unistd_32.h�������������������������������������������������������������������������������������0000644�����������������00000023715�14763166027�0007333 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _ASM_X86_UNISTD_32_H #define _ASM_X86_UNISTD_32_H 1 #define __NR_restart_syscall 0 #define __NR_exit 1 #define __NR_fork 2 #define __NR_read 3 #define __NR_write 4 #define __NR_open 5 #define __NR_close 6 #define __NR_waitpid 7 #define __NR_creat 8 #define __NR_link 9 #define __NR_unlink 10 #define __NR_execve 11 #define __NR_chdir 12 #define __NR_time 13 #define __NR_mknod 14 #define __NR_chmod 15 #define __NR_lchown 16 #define __NR_break 17 #define __NR_oldstat 18 #define __NR_lseek 19 #define __NR_getpid 20 #define __NR_mount 21 #define __NR_umount 22 #define __NR_setuid 23 #define __NR_getuid 24 #define __NR_stime 25 #define __NR_ptrace 26 #define __NR_alarm 27 #define __NR_oldfstat 28 #define __NR_pause 29 #define __NR_utime 30 #define __NR_stty 31 #define __NR_gtty 32 #define __NR_access 33 #define __NR_nice 34 #define __NR_ftime 35 #define __NR_sync 36 #define __NR_kill 37 #define __NR_rename 38 #define __NR_mkdir 39 #define __NR_rmdir 40 #define __NR_dup 41 #define __NR_pipe 42 #define __NR_times 43 #define __NR_prof 44 #define __NR_brk 45 #define __NR_setgid 46 #define __NR_getgid 47 #define __NR_signal 48 #define __NR_geteuid 49 #define __NR_getegid 50 #define __NR_acct 51 #define __NR_umount2 52 #define __NR_lock 53 #define __NR_ioctl 54 #define __NR_fcntl 55 #define __NR_mpx 56 #define __NR_setpgid 57 #define __NR_ulimit 58 #define __NR_oldolduname 59 #define __NR_umask 60 #define __NR_chroot 61 #define __NR_ustat 62 #define __NR_dup2 63 #define __NR_getppid 64 #define __NR_getpgrp 65 #define __NR_setsid 66 #define __NR_sigaction 67 #define __NR_sgetmask 68 #define __NR_ssetmask 69 #define __NR_setreuid 70 #define __NR_setregid 71 #define __NR_sigsuspend 72 #define __NR_sigpending 73 #define __NR_sethostname 74 #define __NR_setrlimit 75 #define __NR_getrlimit 76 #define __NR_getrusage 77 #define __NR_gettimeofday 78 #define __NR_settimeofday 79 #define __NR_getgroups 80 #define __NR_setgroups 81 #define __NR_select 82 #define __NR_symlink 83 #define __NR_oldlstat 84 #define __NR_readlink 85 #define __NR_uselib 86 #define __NR_swapon 87 #define __NR_reboot 88 #define __NR_readdir 89 #define __NR_mmap 90 #define __NR_munmap 91 #define __NR_truncate 92 #define __NR_ftruncate 93 #define __NR_fchmod 94 #define __NR_fchown 95 #define __NR_getpriority 96 #define __NR_setpriority 97 #define __NR_profil 98 #define __NR_statfs 99 #define __NR_fstatfs 100 #define __NR_ioperm 101 #define __NR_socketcall 102 #define __NR_syslog 103 #define __NR_setitimer 104 #define __NR_getitimer 105 #define __NR_stat 106 #define __NR_lstat 107 #define __NR_fstat 108 #define __NR_olduname 109 #define __NR_iopl 110 #define __NR_vhangup 111 #define __NR_idle 112 #define __NR_vm86old 113 #define __NR_wait4 114 #define __NR_swapoff 115 #define __NR_sysinfo 116 #define __NR_ipc 117 #define __NR_fsync 118 #define __NR_sigreturn 119 #define __NR_clone 120 #define __NR_setdomainname 121 #define __NR_uname 122 #define __NR_modify_ldt 123 #define __NR_adjtimex 124 #define __NR_mprotect 125 #define __NR_sigprocmask 126 #define __NR_create_module 127 #define __NR_init_module 128 #define __NR_delete_module 129 #define __NR_get_kernel_syms 130 #define __NR_quotactl 131 #define __NR_getpgid 132 #define __NR_fchdir 133 #define __NR_bdflush 134 #define __NR_sysfs 135 #define __NR_personality 136 #define __NR_afs_syscall 137 #define __NR_setfsuid 138 #define __NR_setfsgid 139 #define __NR__llseek 140 #define __NR_getdents 141 #define __NR__newselect 142 #define __NR_flock 143 #define __NR_msync 144 #define __NR_readv 145 #define __NR_writev 146 #define __NR_getsid 147 #define __NR_fdatasync 148 #define __NR__sysctl 149 #define __NR_mlock 150 #define __NR_munlock 151 #define __NR_mlockall 152 #define __NR_munlockall 153 #define __NR_sched_setparam 154 #define __NR_sched_getparam 155 #define __NR_sched_setscheduler 156 #define __NR_sched_getscheduler 157 #define __NR_sched_yield 158 #define __NR_sched_get_priority_max 159 #define __NR_sched_get_priority_min 160 #define __NR_sched_rr_get_interval 161 #define __NR_nanosleep 162 #define __NR_mremap 163 #define __NR_setresuid 164 #define __NR_getresuid 165 #define __NR_vm86 166 #define __NR_query_module 167 #define __NR_poll 168 #define __NR_nfsservctl 169 #define __NR_setresgid 170 #define __NR_getresgid 171 #define __NR_prctl 172 #define __NR_rt_sigreturn 173 #define __NR_rt_sigaction 174 #define __NR_rt_sigprocmask 175 #define __NR_rt_sigpending 176 #define __NR_rt_sigtimedwait 177 #define __NR_rt_sigqueueinfo 178 #define __NR_rt_sigsuspend 179 #define __NR_pread64 180 #define __NR_pwrite64 181 #define __NR_chown 182 #define __NR_getcwd 183 #define __NR_capget 184 #define __NR_capset 185 #define __NR_sigaltstack 186 #define __NR_sendfile 187 #define __NR_getpmsg 188 #define __NR_putpmsg 189 #define __NR_vfork 190 #define __NR_ugetrlimit 191 #define __NR_mmap2 192 #define __NR_truncate64 193 #define __NR_ftruncate64 194 #define __NR_stat64 195 #define __NR_lstat64 196 #define __NR_fstat64 197 #define __NR_lchown32 198 #define __NR_getuid32 199 #define __NR_getgid32 200 #define __NR_geteuid32 201 #define __NR_getegid32 202 #define __NR_setreuid32 203 #define __NR_setregid32 204 #define __NR_getgroups32 205 #define __NR_setgroups32 206 #define __NR_fchown32 207 #define __NR_setresuid32 208 #define __NR_getresuid32 209 #define __NR_setresgid32 210 #define __NR_getresgid32 211 #define __NR_chown32 212 #define __NR_setuid32 213 #define __NR_setgid32 214 #define __NR_setfsuid32 215 #define __NR_setfsgid32 216 #define __NR_pivot_root 217 #define __NR_mincore 218 #define __NR_madvise 219 #define __NR_getdents64 220 #define __NR_fcntl64 221 #define __NR_gettid 224 #define __NR_readahead 225 #define __NR_setxattr 226 #define __NR_lsetxattr 227 #define __NR_fsetxattr 228 #define __NR_getxattr 229 #define __NR_lgetxattr 230 #define __NR_fgetxattr 231 #define __NR_listxattr 232 #define __NR_llistxattr 233 #define __NR_flistxattr 234 #define __NR_removexattr 235 #define __NR_lremovexattr 236 #define __NR_fremovexattr 237 #define __NR_tkill 238 #define __NR_sendfile64 239 #define __NR_futex 240 #define __NR_sched_setaffinity 241 #define __NR_sched_getaffinity 242 #define __NR_set_thread_area 243 #define __NR_get_thread_area 244 #define __NR_io_setup 245 #define __NR_io_destroy 246 #define __NR_io_getevents 247 #define __NR_io_submit 248 #define __NR_io_cancel 249 #define __NR_fadvise64 250 #define __NR_exit_group 252 #define __NR_lookup_dcookie 253 #define __NR_epoll_create 254 #define __NR_epoll_ctl 255 #define __NR_epoll_wait 256 #define __NR_remap_file_pages 257 #define __NR_set_tid_address 258 #define __NR_timer_create 259 #define __NR_timer_settime 260 #define __NR_timer_gettime 261 #define __NR_timer_getoverrun 262 #define __NR_timer_delete 263 #define __NR_clock_settime 264 #define __NR_clock_gettime 265 #define __NR_clock_getres 266 #define __NR_clock_nanosleep 267 #define __NR_statfs64 268 #define __NR_fstatfs64 269 #define __NR_tgkill 270 #define __NR_utimes 271 #define __NR_fadvise64_64 272 #define __NR_vserver 273 #define __NR_mbind 274 #define __NR_get_mempolicy 275 #define __NR_set_mempolicy 276 #define __NR_mq_open 277 #define __NR_mq_unlink 278 #define __NR_mq_timedsend 279 #define __NR_mq_timedreceive 280 #define __NR_mq_notify 281 #define __NR_mq_getsetattr 282 #define __NR_kexec_load 283 #define __NR_waitid 284 #define __NR_add_key 286 #define __NR_request_key 287 #define __NR_keyctl 288 #define __NR_ioprio_set 289 #define __NR_ioprio_get 290 #define __NR_inotify_init 291 #define __NR_inotify_add_watch 292 #define __NR_inotify_rm_watch 293 #define __NR_migrate_pages 294 #define __NR_openat 295 #define __NR_mkdirat 296 #define __NR_mknodat 297 #define __NR_fchownat 298 #define __NR_futimesat 299 #define __NR_fstatat64 300 #define __NR_unlinkat 301 #define __NR_renameat 302 #define __NR_linkat 303 #define __NR_symlinkat 304 #define __NR_readlinkat 305 #define __NR_fchmodat 306 #define __NR_faccessat 307 #define __NR_pselect6 308 #define __NR_ppoll 309 #define __NR_unshare 310 #define __NR_set_robust_list 311 #define __NR_get_robust_list 312 #define __NR_splice 313 #define __NR_sync_file_range 314 #define __NR_tee 315 #define __NR_vmsplice 316 #define __NR_move_pages 317 #define __NR_getcpu 318 #define __NR_epoll_pwait 319 #define __NR_utimensat 320 #define __NR_signalfd 321 #define __NR_timerfd_create 322 #define __NR_eventfd 323 #define __NR_fallocate 324 #define __NR_timerfd_settime 325 #define __NR_timerfd_gettime 326 #define __NR_signalfd4 327 #define __NR_eventfd2 328 #define __NR_epoll_create1 329 #define __NR_dup3 330 #define __NR_pipe2 331 #define __NR_inotify_init1 332 #define __NR_preadv 333 #define __NR_pwritev 334 #define __NR_rt_tgsigqueueinfo 335 #define __NR_perf_event_open 336 #define __NR_recvmmsg 337 #define __NR_fanotify_init 338 #define __NR_fanotify_mark 339 #define __NR_prlimit64 340 #define __NR_name_to_handle_at 341 #define __NR_open_by_handle_at 342 #define __NR_clock_adjtime 343 #define __NR_syncfs 344 #define __NR_sendmmsg 345 #define __NR_setns 346 #define __NR_process_vm_readv 347 #define __NR_process_vm_writev 348 #define __NR_kcmp 349 #define __NR_finit_module 350 #define __NR_sched_setattr 351 #define __NR_sched_getattr 352 #define __NR_renameat2 353 #define __NR_seccomp 354 #define __NR_getrandom 355 #define __NR_memfd_create 356 #define __NR_bpf 357 #define __NR_execveat 358 #define __NR_socket 359 #define __NR_socketpair 360 #define __NR_bind 361 #define __NR_connect 362 #define __NR_listen 363 #define __NR_accept4 364 #define __NR_getsockopt 365 #define __NR_setsockopt 366 #define __NR_getsockname 367 #define __NR_getpeername 368 #define __NR_sendto 369 #define __NR_sendmsg 370 #define __NR_recvfrom 371 #define __NR_recvmsg 372 #define __NR_shutdown 373 #define __NR_userfaultfd 374 #define __NR_membarrier 375 #define __NR_mlock2 376 #define __NR_copy_file_range 377 #define __NR_preadv2 378 #define __NR_pwritev2 379 #define __NR_pkey_mprotect 380 #define __NR_pkey_alloc 381 #define __NR_pkey_free 382 #define __NR_statx 383 #define __NR_arch_prctl 384 #define __NR_io_pgetevents 385 #define __NR_rseq 386 #endif /* _ASM_X86_UNISTD_32_H */ ���������������������������������������������������asm/vm86.h������������������������������������������������������������������������������������������0000644�����������������00000006056�14763166027�0006320 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_VM86_H #define _ASM_X86_VM86_H /* * I'm guessing at the VIF/VIP flag usage, but hope that this is how * the Pentium uses them. Linux will return from vm86 mode when both * VIF and VIP is set. * * On a Pentium, we could probably optimize the virtual flags directly * in the eflags register instead of doing it "by hand" in vflags... * * Linus */ #include <asm/processor-flags.h> #define BIOSSEG 0x0f000 #define CPU_086 0 #define CPU_186 1 #define CPU_286 2 #define CPU_386 3 #define CPU_486 4 #define CPU_586 5 /* * Return values for the 'vm86()' system call */ #define VM86_TYPE(retval) ((retval) & 0xff) #define VM86_ARG(retval) ((retval) >> 8) #define VM86_SIGNAL 0 /* return due to signal */ #define VM86_UNKNOWN 1 /* unhandled GP fault - IO-instruction or similar */ #define VM86_INTx 2 /* int3/int x instruction (ARG = x) */ #define VM86_STI 3 /* sti/popf/iret instruction enabled virtual interrupts */ /* * Additional return values when invoking new vm86() */ #define VM86_PICRETURN 4 /* return due to pending PIC request */ #define VM86_TRAP 6 /* return due to DOS-debugger request */ /* * function codes when invoking new vm86() */ #define VM86_PLUS_INSTALL_CHECK 0 #define VM86_ENTER 1 #define VM86_ENTER_NO_BYPASS 2 #define VM86_REQUEST_IRQ 3 #define VM86_FREE_IRQ 4 #define VM86_GET_IRQ_BITS 5 #define VM86_GET_AND_RESET_IRQ 6 /* * This is the stack-layout seen by the user space program when we have * done a translation of "SAVE_ALL" from vm86 mode. The real kernel layout * is 'kernel_vm86_regs' (see below). */ struct vm86_regs { /* * normal regs, with special meaning for the segment descriptors.. */ long ebx; long ecx; long edx; long esi; long edi; long ebp; long eax; long __null_ds; long __null_es; long __null_fs; long __null_gs; long orig_eax; long eip; unsigned short cs, __csh; long eflags; long esp; unsigned short ss, __ssh; /* * these are specific to v86 mode: */ unsigned short es, __esh; unsigned short ds, __dsh; unsigned short fs, __fsh; unsigned short gs, __gsh; }; struct revectored_struct { unsigned long __map[8]; /* 256 bits */ }; struct vm86_struct { struct vm86_regs regs; unsigned long flags; unsigned long screen_bitmap; unsigned long cpu_type; struct revectored_struct int_revectored; struct revectored_struct int21_revectored; }; /* * flags masks */ #define VM86_SCREEN_BITMAP 0x0001 struct vm86plus_info_struct { unsigned long force_return_for_pic:1; unsigned long vm86dbg_active:1; /* for debugger */ unsigned long vm86dbg_TFpendig:1; /* for debugger */ unsigned long unused:28; unsigned long is_vm86pus:1; /* for vm86 internal use */ unsigned char vm86dbg_intxxtab[32]; /* for debugger */ }; struct vm86plus_struct { struct vm86_regs regs; unsigned long flags; unsigned long screen_bitmap; unsigned long cpu_type; struct revectored_struct int_revectored; struct revectored_struct int21_revectored; struct vm86plus_info_struct vm86plus; }; #endif /* _ASM_X86_VM86_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/boot.h������������������������������������������������������������������������������������������0000644�����������������00000000503�14763166027�0006452 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_BOOT_H #define _ASM_X86_BOOT_H /* Internal svga startup constants */ #define NORMAL_VGA 0xffff /* 80x25 mode */ #define EXTENDED_VGA 0xfffe /* 80x50 mode */ #define ASK_VGA 0xfffd /* ask for it at bootup */ #endif /* _ASM_X86_BOOT_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/poll.h������������������������������������������������������������������������������������������0000644�����������������00000000036�14763166027�0006456 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <asm-generic/poll.h> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/msgbuf.h����������������������������������������������������������������������������������������0000644�����������������00000002035�14763166027�0006774 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_X64_MSGBUF_H #define __ASM_X64_MSGBUF_H #if !defined(__x86_64__) || !defined(__ILP32__) #include <asm-generic/msgbuf.h> #else /* * The msqid64_ds structure for x86 architecture with x32 ABI. * * On x86-32 and x86-64 we can just use the generic definition, but * x32 uses the same binary layout as x86_64, which is differnet * from other 32-bit architectures. */ struct msqid64_ds { struct ipc64_perm msg_perm; __kernel_time_t msg_stime; /* last msgsnd time */ __kernel_time_t msg_rtime; /* last msgrcv time */ __kernel_time_t msg_ctime; /* last change time */ __kernel_ulong_t msg_cbytes; /* current number of bytes on queue */ __kernel_ulong_t msg_qnum; /* number of messages in queue */ __kernel_ulong_t msg_qbytes; /* max number of bytes on queue */ __kernel_pid_t msg_lspid; /* pid of last msgsnd */ __kernel_pid_t msg_lrpid; /* last receive pid */ __kernel_ulong_t __unused4; __kernel_ulong_t __unused5; }; #endif #endif /* __ASM_GENERIC_MSGBUF_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/hw_breakpoint.h���������������������������������������������������������������������������������0000644�����������������00000000105�14763166027�0010341 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/hwcap2.h����������������������������������������������������������������������������������������0000644�����������������00000000256�14763166027�0006700 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_HWCAP2_H #define _ASM_X86_HWCAP2_H /* MONITOR/MWAIT enabled in Ring 3 */ #define HWCAP2_RING3MWAIT (1 << 0) #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/posix_types.h�����������������������������������������������������������������������������������0000644�����������������00000000340�14763166027�0010074 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ # ifdef __i386__ # include <asm/posix_types_32.h> # elif defined(__ILP32__) # include <asm/posix_types_x32.h> # else # include <asm/posix_types_64.h> # endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/vmx.h�������������������������������������������������������������������������������������������0000644�����������������00000015135�14763166027�0006330 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * vmx.h: VMX Architecture related definitions * Copyright (c) 2004, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope 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., 59 Temple * Place - Suite 330, Boston, MA 02111-1307 USA. * * A few random additions are: * Copyright (C) 2006 Qumranet * Avi Kivity <avi@qumranet.com> * Yaniv Kamay <yaniv@qumranet.com> * */ #ifndef VMX_H #define VMX_H #define VMX_EXIT_REASONS_FAILED_VMENTRY 0x80000000 #define EXIT_REASON_EXCEPTION_NMI 0 #define EXIT_REASON_EXTERNAL_INTERRUPT 1 #define EXIT_REASON_TRIPLE_FAULT 2 #define EXIT_REASON_PENDING_INTERRUPT 7 #define EXIT_REASON_NMI_WINDOW 8 #define EXIT_REASON_TASK_SWITCH 9 #define EXIT_REASON_CPUID 10 #define EXIT_REASON_HLT 12 #define EXIT_REASON_INVD 13 #define EXIT_REASON_INVLPG 14 #define EXIT_REASON_RDPMC 15 #define EXIT_REASON_RDTSC 16 #define EXIT_REASON_VMCALL 18 #define EXIT_REASON_VMCLEAR 19 #define EXIT_REASON_VMLAUNCH 20 #define EXIT_REASON_VMPTRLD 21 #define EXIT_REASON_VMPTRST 22 #define EXIT_REASON_VMREAD 23 #define EXIT_REASON_VMRESUME 24 #define EXIT_REASON_VMWRITE 25 #define EXIT_REASON_VMOFF 26 #define EXIT_REASON_VMON 27 #define EXIT_REASON_CR_ACCESS 28 #define EXIT_REASON_DR_ACCESS 29 #define EXIT_REASON_IO_INSTRUCTION 30 #define EXIT_REASON_MSR_READ 31 #define EXIT_REASON_MSR_WRITE 32 #define EXIT_REASON_INVALID_STATE 33 #define EXIT_REASON_MSR_LOAD_FAIL 34 #define EXIT_REASON_MWAIT_INSTRUCTION 36 #define EXIT_REASON_MONITOR_TRAP_FLAG 37 #define EXIT_REASON_MONITOR_INSTRUCTION 39 #define EXIT_REASON_PAUSE_INSTRUCTION 40 #define EXIT_REASON_MCE_DURING_VMENTRY 41 #define EXIT_REASON_TPR_BELOW_THRESHOLD 43 #define EXIT_REASON_APIC_ACCESS 44 #define EXIT_REASON_EOI_INDUCED 45 #define EXIT_REASON_GDTR_IDTR 46 #define EXIT_REASON_LDTR_TR 47 #define EXIT_REASON_EPT_VIOLATION 48 #define EXIT_REASON_EPT_MISCONFIG 49 #define EXIT_REASON_INVEPT 50 #define EXIT_REASON_RDTSCP 51 #define EXIT_REASON_PREEMPTION_TIMER 52 #define EXIT_REASON_INVVPID 53 #define EXIT_REASON_WBINVD 54 #define EXIT_REASON_XSETBV 55 #define EXIT_REASON_APIC_WRITE 56 #define EXIT_REASON_RDRAND 57 #define EXIT_REASON_INVPCID 58 #define EXIT_REASON_VMFUNC 59 #define EXIT_REASON_ENCLS 60 #define EXIT_REASON_RDSEED 61 #define EXIT_REASON_PML_FULL 62 #define EXIT_REASON_XSAVES 63 #define EXIT_REASON_XRSTORS 64 #define VMX_EXIT_REASONS \ { EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, \ { EXIT_REASON_EXTERNAL_INTERRUPT, "EXTERNAL_INTERRUPT" }, \ { EXIT_REASON_TRIPLE_FAULT, "TRIPLE_FAULT" }, \ { EXIT_REASON_PENDING_INTERRUPT, "PENDING_INTERRUPT" }, \ { EXIT_REASON_NMI_WINDOW, "NMI_WINDOW" }, \ { EXIT_REASON_TASK_SWITCH, "TASK_SWITCH" }, \ { EXIT_REASON_CPUID, "CPUID" }, \ { EXIT_REASON_HLT, "HLT" }, \ { EXIT_REASON_INVD, "INVD" }, \ { EXIT_REASON_INVLPG, "INVLPG" }, \ { EXIT_REASON_RDPMC, "RDPMC" }, \ { EXIT_REASON_RDTSC, "RDTSC" }, \ { EXIT_REASON_VMCALL, "VMCALL" }, \ { EXIT_REASON_VMCLEAR, "VMCLEAR" }, \ { EXIT_REASON_VMLAUNCH, "VMLAUNCH" }, \ { EXIT_REASON_VMPTRLD, "VMPTRLD" }, \ { EXIT_REASON_VMPTRST, "VMPTRST" }, \ { EXIT_REASON_VMREAD, "VMREAD" }, \ { EXIT_REASON_VMRESUME, "VMRESUME" }, \ { EXIT_REASON_VMWRITE, "VMWRITE" }, \ { EXIT_REASON_VMOFF, "VMOFF" }, \ { EXIT_REASON_VMON, "VMON" }, \ { EXIT_REASON_CR_ACCESS, "CR_ACCESS" }, \ { EXIT_REASON_DR_ACCESS, "DR_ACCESS" }, \ { EXIT_REASON_IO_INSTRUCTION, "IO_INSTRUCTION" }, \ { EXIT_REASON_MSR_READ, "MSR_READ" }, \ { EXIT_REASON_MSR_WRITE, "MSR_WRITE" }, \ { EXIT_REASON_INVALID_STATE, "INVALID_STATE" }, \ { EXIT_REASON_MSR_LOAD_FAIL, "MSR_LOAD_FAIL" }, \ { EXIT_REASON_MWAIT_INSTRUCTION, "MWAIT_INSTRUCTION" }, \ { EXIT_REASON_MONITOR_TRAP_FLAG, "MONITOR_TRAP_FLAG" }, \ { EXIT_REASON_MONITOR_INSTRUCTION, "MONITOR_INSTRUCTION" }, \ { EXIT_REASON_PAUSE_INSTRUCTION, "PAUSE_INSTRUCTION" }, \ { EXIT_REASON_MCE_DURING_VMENTRY, "MCE_DURING_VMENTRY" }, \ { EXIT_REASON_TPR_BELOW_THRESHOLD, "TPR_BELOW_THRESHOLD" }, \ { EXIT_REASON_APIC_ACCESS, "APIC_ACCESS" }, \ { EXIT_REASON_EOI_INDUCED, "EOI_INDUCED" }, \ { EXIT_REASON_GDTR_IDTR, "GDTR_IDTR" }, \ { EXIT_REASON_LDTR_TR, "LDTR_TR" }, \ { EXIT_REASON_EPT_VIOLATION, "EPT_VIOLATION" }, \ { EXIT_REASON_EPT_MISCONFIG, "EPT_MISCONFIG" }, \ { EXIT_REASON_INVEPT, "INVEPT" }, \ { EXIT_REASON_RDTSCP, "RDTSCP" }, \ { EXIT_REASON_PREEMPTION_TIMER, "PREEMPTION_TIMER" }, \ { EXIT_REASON_INVVPID, "INVVPID" }, \ { EXIT_REASON_WBINVD, "WBINVD" }, \ { EXIT_REASON_XSETBV, "XSETBV" }, \ { EXIT_REASON_APIC_WRITE, "APIC_WRITE" }, \ { EXIT_REASON_RDRAND, "RDRAND" }, \ { EXIT_REASON_INVPCID, "INVPCID" }, \ { EXIT_REASON_VMFUNC, "VMFUNC" }, \ { EXIT_REASON_ENCLS, "ENCLS" }, \ { EXIT_REASON_RDSEED, "RDSEED" }, \ { EXIT_REASON_PML_FULL, "PML_FULL" }, \ { EXIT_REASON_XSAVES, "XSAVES" }, \ { EXIT_REASON_XRSTORS, "XRSTORS" } #define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1 #define VMX_ABORT_LOAD_HOST_PDPTE_FAIL 2 #define VMX_ABORT_LOAD_HOST_MSR_FAIL 4 #endif /* VMX_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/processor-flags.h�������������������������������������������������������������������������������0000644�����������������00000014737�14763166027�0010636 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_PROCESSOR_FLAGS_H #define _ASM_X86_PROCESSOR_FLAGS_H /* Various flags defined: can be included from assembler. */ #include <linux/const.h> /* * EFLAGS bits */ #define X86_EFLAGS_CF_BIT 0 /* Carry Flag */ #define X86_EFLAGS_CF _BITUL(X86_EFLAGS_CF_BIT) #define X86_EFLAGS_FIXED_BIT 1 /* Bit 1 - always on */ #define X86_EFLAGS_FIXED _BITUL(X86_EFLAGS_FIXED_BIT) #define X86_EFLAGS_PF_BIT 2 /* Parity Flag */ #define X86_EFLAGS_PF _BITUL(X86_EFLAGS_PF_BIT) #define X86_EFLAGS_AF_BIT 4 /* Auxiliary carry Flag */ #define X86_EFLAGS_AF _BITUL(X86_EFLAGS_AF_BIT) #define X86_EFLAGS_ZF_BIT 6 /* Zero Flag */ #define X86_EFLAGS_ZF _BITUL(X86_EFLAGS_ZF_BIT) #define X86_EFLAGS_SF_BIT 7 /* Sign Flag */ #define X86_EFLAGS_SF _BITUL(X86_EFLAGS_SF_BIT) #define X86_EFLAGS_TF_BIT 8 /* Trap Flag */ #define X86_EFLAGS_TF _BITUL(X86_EFLAGS_TF_BIT) #define X86_EFLAGS_IF_BIT 9 /* Interrupt Flag */ #define X86_EFLAGS_IF _BITUL(X86_EFLAGS_IF_BIT) #define X86_EFLAGS_DF_BIT 10 /* Direction Flag */ #define X86_EFLAGS_DF _BITUL(X86_EFLAGS_DF_BIT) #define X86_EFLAGS_OF_BIT 11 /* Overflow Flag */ #define X86_EFLAGS_OF _BITUL(X86_EFLAGS_OF_BIT) #define X86_EFLAGS_IOPL_BIT 12 /* I/O Privilege Level (2 bits) */ #define X86_EFLAGS_IOPL (_AC(3,UL) << X86_EFLAGS_IOPL_BIT) #define X86_EFLAGS_NT_BIT 14 /* Nested Task */ #define X86_EFLAGS_NT _BITUL(X86_EFLAGS_NT_BIT) #define X86_EFLAGS_RF_BIT 16 /* Resume Flag */ #define X86_EFLAGS_RF _BITUL(X86_EFLAGS_RF_BIT) #define X86_EFLAGS_VM_BIT 17 /* Virtual Mode */ #define X86_EFLAGS_VM _BITUL(X86_EFLAGS_VM_BIT) #define X86_EFLAGS_AC_BIT 18 /* Alignment Check/Access Control */ #define X86_EFLAGS_AC _BITUL(X86_EFLAGS_AC_BIT) #define X86_EFLAGS_VIF_BIT 19 /* Virtual Interrupt Flag */ #define X86_EFLAGS_VIF _BITUL(X86_EFLAGS_VIF_BIT) #define X86_EFLAGS_VIP_BIT 20 /* Virtual Interrupt Pending */ #define X86_EFLAGS_VIP _BITUL(X86_EFLAGS_VIP_BIT) #define X86_EFLAGS_ID_BIT 21 /* CPUID detection */ #define X86_EFLAGS_ID _BITUL(X86_EFLAGS_ID_BIT) /* * Basic CPU control in CR0 */ #define X86_CR0_PE_BIT 0 /* Protection Enable */ #define X86_CR0_PE _BITUL(X86_CR0_PE_BIT) #define X86_CR0_MP_BIT 1 /* Monitor Coprocessor */ #define X86_CR0_MP _BITUL(X86_CR0_MP_BIT) #define X86_CR0_EM_BIT 2 /* Emulation */ #define X86_CR0_EM _BITUL(X86_CR0_EM_BIT) #define X86_CR0_TS_BIT 3 /* Task Switched */ #define X86_CR0_TS _BITUL(X86_CR0_TS_BIT) #define X86_CR0_ET_BIT 4 /* Extension Type */ #define X86_CR0_ET _BITUL(X86_CR0_ET_BIT) #define X86_CR0_NE_BIT 5 /* Numeric Error */ #define X86_CR0_NE _BITUL(X86_CR0_NE_BIT) #define X86_CR0_WP_BIT 16 /* Write Protect */ #define X86_CR0_WP _BITUL(X86_CR0_WP_BIT) #define X86_CR0_AM_BIT 18 /* Alignment Mask */ #define X86_CR0_AM _BITUL(X86_CR0_AM_BIT) #define X86_CR0_NW_BIT 29 /* Not Write-through */ #define X86_CR0_NW _BITUL(X86_CR0_NW_BIT) #define X86_CR0_CD_BIT 30 /* Cache Disable */ #define X86_CR0_CD _BITUL(X86_CR0_CD_BIT) #define X86_CR0_PG_BIT 31 /* Paging */ #define X86_CR0_PG _BITUL(X86_CR0_PG_BIT) /* * Paging options in CR3 */ #define X86_CR3_PWT_BIT 3 /* Page Write Through */ #define X86_CR3_PWT _BITUL(X86_CR3_PWT_BIT) #define X86_CR3_PCD_BIT 4 /* Page Cache Disable */ #define X86_CR3_PCD _BITUL(X86_CR3_PCD_BIT) #define X86_CR3_PCID_BITS 12 #define X86_CR3_PCID_MASK (_AC((1UL << X86_CR3_PCID_BITS) - 1, UL)) #define X86_CR3_PCID_NOFLUSH_BIT 63 /* Preserve old PCID */ #define X86_CR3_PCID_NOFLUSH _BITULL(X86_CR3_PCID_NOFLUSH_BIT) /* * Intel CPU features in CR4 */ #define X86_CR4_VME_BIT 0 /* enable vm86 extensions */ #define X86_CR4_VME _BITUL(X86_CR4_VME_BIT) #define X86_CR4_PVI_BIT 1 /* virtual interrupts flag enable */ #define X86_CR4_PVI _BITUL(X86_CR4_PVI_BIT) #define X86_CR4_TSD_BIT 2 /* disable time stamp at ipl 3 */ #define X86_CR4_TSD _BITUL(X86_CR4_TSD_BIT) #define X86_CR4_DE_BIT 3 /* enable debugging extensions */ #define X86_CR4_DE _BITUL(X86_CR4_DE_BIT) #define X86_CR4_PSE_BIT 4 /* enable page size extensions */ #define X86_CR4_PSE _BITUL(X86_CR4_PSE_BIT) #define X86_CR4_PAE_BIT 5 /* enable physical address extensions */ #define X86_CR4_PAE _BITUL(X86_CR4_PAE_BIT) #define X86_CR4_MCE_BIT 6 /* Machine check enable */ #define X86_CR4_MCE _BITUL(X86_CR4_MCE_BIT) #define X86_CR4_PGE_BIT 7 /* enable global pages */ #define X86_CR4_PGE _BITUL(X86_CR4_PGE_BIT) #define X86_CR4_PCE_BIT 8 /* enable performance counters at ipl 3 */ #define X86_CR4_PCE _BITUL(X86_CR4_PCE_BIT) #define X86_CR4_OSFXSR_BIT 9 /* enable fast FPU save and restore */ #define X86_CR4_OSFXSR _BITUL(X86_CR4_OSFXSR_BIT) #define X86_CR4_OSXMMEXCPT_BIT 10 /* enable unmasked SSE exceptions */ #define X86_CR4_OSXMMEXCPT _BITUL(X86_CR4_OSXMMEXCPT_BIT) #define X86_CR4_UMIP_BIT 11 /* enable UMIP support */ #define X86_CR4_UMIP _BITUL(X86_CR4_UMIP_BIT) #define X86_CR4_LA57_BIT 12 /* enable 5-level page tables */ #define X86_CR4_LA57 _BITUL(X86_CR4_LA57_BIT) #define X86_CR4_VMXE_BIT 13 /* enable VMX virtualization */ #define X86_CR4_VMXE _BITUL(X86_CR4_VMXE_BIT) #define X86_CR4_SMXE_BIT 14 /* enable safer mode (TXT) */ #define X86_CR4_SMXE _BITUL(X86_CR4_SMXE_BIT) #define X86_CR4_FSGSBASE_BIT 16 /* enable RDWRFSGS support */ #define X86_CR4_FSGSBASE _BITUL(X86_CR4_FSGSBASE_BIT) #define X86_CR4_PCIDE_BIT 17 /* enable PCID support */ #define X86_CR4_PCIDE _BITUL(X86_CR4_PCIDE_BIT) #define X86_CR4_OSXSAVE_BIT 18 /* enable xsave and xrestore */ #define X86_CR4_OSXSAVE _BITUL(X86_CR4_OSXSAVE_BIT) #define X86_CR4_SMEP_BIT 20 /* enable SMEP support */ #define X86_CR4_SMEP _BITUL(X86_CR4_SMEP_BIT) #define X86_CR4_SMAP_BIT 21 /* enable SMAP support */ #define X86_CR4_SMAP _BITUL(X86_CR4_SMAP_BIT) #define X86_CR4_PKE_BIT 22 /* enable Protection Keys support */ #define X86_CR4_PKE _BITUL(X86_CR4_PKE_BIT) /* * x86-64 Task Priority Register, CR8 */ #define X86_CR8_TPR _AC(0x0000000f,UL) /* task priority register */ /* * AMD and Transmeta use MSRs for configuration; see <asm/msr-index.h> */ /* * NSC/Cyrix CPU configuration register indexes */ #define CX86_PCR0 0x20 #define CX86_GCR 0xb8 #define CX86_CCR0 0xc0 #define CX86_CCR1 0xc1 #define CX86_CCR2 0xc2 #define CX86_CCR3 0xc3 #define CX86_CCR4 0xe8 #define CX86_CCR5 0xe9 #define CX86_CCR6 0xea #define CX86_CCR7 0xeb #define CX86_PCR1 0xf0 #define CX86_DIR0 0xfe #define CX86_DIR1 0xff #define CX86_ARR_BASE 0xc4 #define CX86_RCR_BASE 0xdc #define CR0_STATE (X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | \ X86_CR0_NE | X86_CR0_WP | X86_CR0_AM | \ X86_CR0_PG) #endif /* _ASM_X86_PROCESSOR_FLAGS_H */ ���������������������������������asm/stat.h������������������������������������������������������������������������������������������0000644�����������������00000006073�14763166027�0006472 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_STAT_H #define _ASM_X86_STAT_H #include <asm/posix_types.h> #define STAT_HAVE_NSEC 1 #ifdef __i386__ struct stat { unsigned long st_dev; unsigned long st_ino; unsigned short st_mode; unsigned short st_nlink; unsigned short st_uid; unsigned short st_gid; unsigned long st_rdev; unsigned long st_size; unsigned long st_blksize; unsigned long st_blocks; unsigned long st_atime; unsigned long st_atime_nsec; unsigned long st_mtime; unsigned long st_mtime_nsec; unsigned long st_ctime; unsigned long st_ctime_nsec; unsigned long __unused4; unsigned long __unused5; }; /* We don't need to memset the whole thing just to initialize the padding */ #define INIT_STRUCT_STAT_PADDING(st) do { \ st.__unused4 = 0; \ st.__unused5 = 0; \ } while (0) #define STAT64_HAS_BROKEN_ST_INO 1 /* This matches struct stat64 in glibc2.1, hence the absolutely * insane amounts of padding around dev_t's. */ struct stat64 { unsigned long long st_dev; unsigned char __pad0[4]; unsigned long __st_ino; unsigned int st_mode; unsigned int st_nlink; unsigned long st_uid; unsigned long st_gid; unsigned long long st_rdev; unsigned char __pad3[4]; long long st_size; unsigned long st_blksize; /* Number 512-byte blocks allocated. */ unsigned long long st_blocks; unsigned long st_atime; unsigned long st_atime_nsec; unsigned long st_mtime; unsigned int st_mtime_nsec; unsigned long st_ctime; unsigned long st_ctime_nsec; unsigned long long st_ino; }; /* We don't need to memset the whole thing just to initialize the padding */ #define INIT_STRUCT_STAT64_PADDING(st) do { \ memset(&st.__pad0, 0, sizeof(st.__pad0)); \ memset(&st.__pad3, 0, sizeof(st.__pad3)); \ } while (0) #else /* __i386__ */ struct stat { __kernel_ulong_t st_dev; __kernel_ulong_t st_ino; __kernel_ulong_t st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; unsigned int __pad0; __kernel_ulong_t st_rdev; __kernel_long_t st_size; __kernel_long_t st_blksize; __kernel_long_t st_blocks; /* Number 512-byte blocks allocated. */ __kernel_ulong_t st_atime; __kernel_ulong_t st_atime_nsec; __kernel_ulong_t st_mtime; __kernel_ulong_t st_mtime_nsec; __kernel_ulong_t st_ctime; __kernel_ulong_t st_ctime_nsec; __kernel_long_t __unused[3]; }; /* We don't need to memset the whole thing just to initialize the padding */ #define INIT_STRUCT_STAT_PADDING(st) do { \ st.__pad0 = 0; \ st.__unused[0] = 0; \ st.__unused[1] = 0; \ st.__unused[2] = 0; \ } while (0) #endif /* for 32bit emulation and 32 bit kernels */ struct __old_kernel_stat { unsigned short st_dev; unsigned short st_ino; unsigned short st_mode; unsigned short st_nlink; unsigned short st_uid; unsigned short st_gid; unsigned short st_rdev; #ifdef __i386__ unsigned long st_size; unsigned long st_atime; unsigned long st_mtime; unsigned long st_ctime; #else unsigned int st_size; unsigned int st_atime; unsigned int st_mtime; unsigned int st_ctime; #endif }; #endif /* _ASM_X86_STAT_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/unistd_64.h�������������������������������������������������������������������������������������0000644�����������������00000021362�14763166027�0007334 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _ASM_X86_UNISTD_64_H #define _ASM_X86_UNISTD_64_H 1 #define __NR_read 0 #define __NR_write 1 #define __NR_open 2 #define __NR_close 3 #define __NR_stat 4 #define __NR_fstat 5 #define __NR_lstat 6 #define __NR_poll 7 #define __NR_lseek 8 #define __NR_mmap 9 #define __NR_mprotect 10 #define __NR_munmap 11 #define __NR_brk 12 #define __NR_rt_sigaction 13 #define __NR_rt_sigprocmask 14 #define __NR_rt_sigreturn 15 #define __NR_ioctl 16 #define __NR_pread64 17 #define __NR_pwrite64 18 #define __NR_readv 19 #define __NR_writev 20 #define __NR_access 21 #define __NR_pipe 22 #define __NR_select 23 #define __NR_sched_yield 24 #define __NR_mremap 25 #define __NR_msync 26 #define __NR_mincore 27 #define __NR_madvise 28 #define __NR_shmget 29 #define __NR_shmat 30 #define __NR_shmctl 31 #define __NR_dup 32 #define __NR_dup2 33 #define __NR_pause 34 #define __NR_nanosleep 35 #define __NR_getitimer 36 #define __NR_alarm 37 #define __NR_setitimer 38 #define __NR_getpid 39 #define __NR_sendfile 40 #define __NR_socket 41 #define __NR_connect 42 #define __NR_accept 43 #define __NR_sendto 44 #define __NR_recvfrom 45 #define __NR_sendmsg 46 #define __NR_recvmsg 47 #define __NR_shutdown 48 #define __NR_bind 49 #define __NR_listen 50 #define __NR_getsockname 51 #define __NR_getpeername 52 #define __NR_socketpair 53 #define __NR_setsockopt 54 #define __NR_getsockopt 55 #define __NR_clone 56 #define __NR_fork 57 #define __NR_vfork 58 #define __NR_execve 59 #define __NR_exit 60 #define __NR_wait4 61 #define __NR_kill 62 #define __NR_uname 63 #define __NR_semget 64 #define __NR_semop 65 #define __NR_semctl 66 #define __NR_shmdt 67 #define __NR_msgget 68 #define __NR_msgsnd 69 #define __NR_msgrcv 70 #define __NR_msgctl 71 #define __NR_fcntl 72 #define __NR_flock 73 #define __NR_fsync 74 #define __NR_fdatasync 75 #define __NR_truncate 76 #define __NR_ftruncate 77 #define __NR_getdents 78 #define __NR_getcwd 79 #define __NR_chdir 80 #define __NR_fchdir 81 #define __NR_rename 82 #define __NR_mkdir 83 #define __NR_rmdir 84 #define __NR_creat 85 #define __NR_link 86 #define __NR_unlink 87 #define __NR_symlink 88 #define __NR_readlink 89 #define __NR_chmod 90 #define __NR_fchmod 91 #define __NR_chown 92 #define __NR_fchown 93 #define __NR_lchown 94 #define __NR_umask 95 #define __NR_gettimeofday 96 #define __NR_getrlimit 97 #define __NR_getrusage 98 #define __NR_sysinfo 99 #define __NR_times 100 #define __NR_ptrace 101 #define __NR_getuid 102 #define __NR_syslog 103 #define __NR_getgid 104 #define __NR_setuid 105 #define __NR_setgid 106 #define __NR_geteuid 107 #define __NR_getegid 108 #define __NR_setpgid 109 #define __NR_getppid 110 #define __NR_getpgrp 111 #define __NR_setsid 112 #define __NR_setreuid 113 #define __NR_setregid 114 #define __NR_getgroups 115 #define __NR_setgroups 116 #define __NR_setresuid 117 #define __NR_getresuid 118 #define __NR_setresgid 119 #define __NR_getresgid 120 #define __NR_getpgid 121 #define __NR_setfsuid 122 #define __NR_setfsgid 123 #define __NR_getsid 124 #define __NR_capget 125 #define __NR_capset 126 #define __NR_rt_sigpending 127 #define __NR_rt_sigtimedwait 128 #define __NR_rt_sigqueueinfo 129 #define __NR_rt_sigsuspend 130 #define __NR_sigaltstack 131 #define __NR_utime 132 #define __NR_mknod 133 #define __NR_uselib 134 #define __NR_personality 135 #define __NR_ustat 136 #define __NR_statfs 137 #define __NR_fstatfs 138 #define __NR_sysfs 139 #define __NR_getpriority 140 #define __NR_setpriority 141 #define __NR_sched_setparam 142 #define __NR_sched_getparam 143 #define __NR_sched_setscheduler 144 #define __NR_sched_getscheduler 145 #define __NR_sched_get_priority_max 146 #define __NR_sched_get_priority_min 147 #define __NR_sched_rr_get_interval 148 #define __NR_mlock 149 #define __NR_munlock 150 #define __NR_mlockall 151 #define __NR_munlockall 152 #define __NR_vhangup 153 #define __NR_modify_ldt 154 #define __NR_pivot_root 155 #define __NR__sysctl 156 #define __NR_prctl 157 #define __NR_arch_prctl 158 #define __NR_adjtimex 159 #define __NR_setrlimit 160 #define __NR_chroot 161 #define __NR_sync 162 #define __NR_acct 163 #define __NR_settimeofday 164 #define __NR_mount 165 #define __NR_umount2 166 #define __NR_swapon 167 #define __NR_swapoff 168 #define __NR_reboot 169 #define __NR_sethostname 170 #define __NR_setdomainname 171 #define __NR_iopl 172 #define __NR_ioperm 173 #define __NR_create_module 174 #define __NR_init_module 175 #define __NR_delete_module 176 #define __NR_get_kernel_syms 177 #define __NR_query_module 178 #define __NR_quotactl 179 #define __NR_nfsservctl 180 #define __NR_getpmsg 181 #define __NR_putpmsg 182 #define __NR_afs_syscall 183 #define __NR_tuxcall 184 #define __NR_security 185 #define __NR_gettid 186 #define __NR_readahead 187 #define __NR_setxattr 188 #define __NR_lsetxattr 189 #define __NR_fsetxattr 190 #define __NR_getxattr 191 #define __NR_lgetxattr 192 #define __NR_fgetxattr 193 #define __NR_listxattr 194 #define __NR_llistxattr 195 #define __NR_flistxattr 196 #define __NR_removexattr 197 #define __NR_lremovexattr 198 #define __NR_fremovexattr 199 #define __NR_tkill 200 #define __NR_time 201 #define __NR_futex 202 #define __NR_sched_setaffinity 203 #define __NR_sched_getaffinity 204 #define __NR_set_thread_area 205 #define __NR_io_setup 206 #define __NR_io_destroy 207 #define __NR_io_getevents 208 #define __NR_io_submit 209 #define __NR_io_cancel 210 #define __NR_get_thread_area 211 #define __NR_lookup_dcookie 212 #define __NR_epoll_create 213 #define __NR_epoll_ctl_old 214 #define __NR_epoll_wait_old 215 #define __NR_remap_file_pages 216 #define __NR_getdents64 217 #define __NR_set_tid_address 218 #define __NR_restart_syscall 219 #define __NR_semtimedop 220 #define __NR_fadvise64 221 #define __NR_timer_create 222 #define __NR_timer_settime 223 #define __NR_timer_gettime 224 #define __NR_timer_getoverrun 225 #define __NR_timer_delete 226 #define __NR_clock_settime 227 #define __NR_clock_gettime 228 #define __NR_clock_getres 229 #define __NR_clock_nanosleep 230 #define __NR_exit_group 231 #define __NR_epoll_wait 232 #define __NR_epoll_ctl 233 #define __NR_tgkill 234 #define __NR_utimes 235 #define __NR_vserver 236 #define __NR_mbind 237 #define __NR_set_mempolicy 238 #define __NR_get_mempolicy 239 #define __NR_mq_open 240 #define __NR_mq_unlink 241 #define __NR_mq_timedsend 242 #define __NR_mq_timedreceive 243 #define __NR_mq_notify 244 #define __NR_mq_getsetattr 245 #define __NR_kexec_load 246 #define __NR_waitid 247 #define __NR_add_key 248 #define __NR_request_key 249 #define __NR_keyctl 250 #define __NR_ioprio_set 251 #define __NR_ioprio_get 252 #define __NR_inotify_init 253 #define __NR_inotify_add_watch 254 #define __NR_inotify_rm_watch 255 #define __NR_migrate_pages 256 #define __NR_openat 257 #define __NR_mkdirat 258 #define __NR_mknodat 259 #define __NR_fchownat 260 #define __NR_futimesat 261 #define __NR_newfstatat 262 #define __NR_unlinkat 263 #define __NR_renameat 264 #define __NR_linkat 265 #define __NR_symlinkat 266 #define __NR_readlinkat 267 #define __NR_fchmodat 268 #define __NR_faccessat 269 #define __NR_pselect6 270 #define __NR_ppoll 271 #define __NR_unshare 272 #define __NR_set_robust_list 273 #define __NR_get_robust_list 274 #define __NR_splice 275 #define __NR_tee 276 #define __NR_sync_file_range 277 #define __NR_vmsplice 278 #define __NR_move_pages 279 #define __NR_utimensat 280 #define __NR_epoll_pwait 281 #define __NR_signalfd 282 #define __NR_timerfd_create 283 #define __NR_eventfd 284 #define __NR_fallocate 285 #define __NR_timerfd_settime 286 #define __NR_timerfd_gettime 287 #define __NR_accept4 288 #define __NR_signalfd4 289 #define __NR_eventfd2 290 #define __NR_epoll_create1 291 #define __NR_dup3 292 #define __NR_pipe2 293 #define __NR_inotify_init1 294 #define __NR_preadv 295 #define __NR_pwritev 296 #define __NR_rt_tgsigqueueinfo 297 #define __NR_perf_event_open 298 #define __NR_recvmmsg 299 #define __NR_fanotify_init 300 #define __NR_fanotify_mark 301 #define __NR_prlimit64 302 #define __NR_name_to_handle_at 303 #define __NR_open_by_handle_at 304 #define __NR_clock_adjtime 305 #define __NR_syncfs 306 #define __NR_sendmmsg 307 #define __NR_setns 308 #define __NR_getcpu 309 #define __NR_process_vm_readv 310 #define __NR_process_vm_writev 311 #define __NR_kcmp 312 #define __NR_finit_module 313 #define __NR_sched_setattr 314 #define __NR_sched_getattr 315 #define __NR_renameat2 316 #define __NR_seccomp 317 #define __NR_getrandom 318 #define __NR_memfd_create 319 #define __NR_kexec_file_load 320 #define __NR_bpf 321 #define __NR_execveat 322 #define __NR_userfaultfd 323 #define __NR_membarrier 324 #define __NR_mlock2 325 #define __NR_copy_file_range 326 #define __NR_preadv2 327 #define __NR_pwritev2 328 #define __NR_pkey_mprotect 329 #define __NR_pkey_alloc 330 #define __NR_pkey_free 331 #define __NR_statx 332 #define __NR_io_pgetevents 333 #define __NR_rseq 334 #endif /* _ASM_X86_UNISTD_64_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/ist.h�������������������������������������������������������������������������������������������0000644�����������������00000001526�14763166027�0006314 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Include file for the interface to IST BIOS * Copyright 2002 Andy Grover <andrew.grover@intel.com> * * 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, 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. */ #ifndef _ASM_X86_IST_H #define _ASM_X86_IST_H #include <linux/types.h> struct ist_info { __u32 signature; __u32 command; __u32 event; __u32 perf_level; }; #endif /* _ASM_X86_IST_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/kvm.h�������������������������������������������������������������������������������������������0000644�����������������00000020306�14763166027�0006307 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_KVM_H #define _ASM_X86_KVM_H /* * KVM x86 specific structures and definitions * */ #include <linux/types.h> #include <linux/ioctl.h> #define KVM_PIO_PAGE_OFFSET 1 #define KVM_COALESCED_MMIO_PAGE_OFFSET 2 #define DE_VECTOR 0 #define DB_VECTOR 1 #define BP_VECTOR 3 #define OF_VECTOR 4 #define BR_VECTOR 5 #define UD_VECTOR 6 #define NM_VECTOR 7 #define DF_VECTOR 8 #define TS_VECTOR 10 #define NP_VECTOR 11 #define SS_VECTOR 12 #define GP_VECTOR 13 #define PF_VECTOR 14 #define MF_VECTOR 16 #define AC_VECTOR 17 #define MC_VECTOR 18 #define XM_VECTOR 19 #define VE_VECTOR 20 /* Select x86 specific features in <linux/kvm.h> */ #define __KVM_HAVE_PIT #define __KVM_HAVE_IOAPIC #define __KVM_HAVE_IRQ_LINE #define __KVM_HAVE_MSI #define __KVM_HAVE_USER_NMI #define __KVM_HAVE_GUEST_DEBUG #define __KVM_HAVE_MSIX #define __KVM_HAVE_MCE #define __KVM_HAVE_PIT_STATE2 #define __KVM_HAVE_XEN_HVM #define __KVM_HAVE_VCPU_EVENTS #define __KVM_HAVE_DEBUGREGS #define __KVM_HAVE_XSAVE #define __KVM_HAVE_XCRS #define __KVM_HAVE_READONLY_MEM /* Architectural interrupt line count. */ #define KVM_NR_INTERRUPTS 256 struct kvm_memory_alias { __u32 slot; /* this has a different namespace than memory slots */ __u32 flags; __u64 guest_phys_addr; __u64 memory_size; __u64 target_phys_addr; }; /* for KVM_GET_IRQCHIP and KVM_SET_IRQCHIP */ struct kvm_pic_state { __u8 last_irr; /* edge detection */ __u8 irr; /* interrupt request register */ __u8 imr; /* interrupt mask register */ __u8 isr; /* interrupt service register */ __u8 priority_add; /* highest irq priority */ __u8 irq_base; __u8 read_reg_select; __u8 poll; __u8 special_mask; __u8 init_state; __u8 auto_eoi; __u8 rotate_on_auto_eoi; __u8 special_fully_nested_mode; __u8 init4; /* true if 4 byte init */ __u8 elcr; /* PIIX edge/trigger selection */ __u8 elcr_mask; }; #define KVM_IOAPIC_NUM_PINS 24 struct kvm_ioapic_state { __u64 base_address; __u32 ioregsel; __u32 id; __u32 irr; __u32 pad; union { __u64 bits; struct { __u8 vector; __u8 delivery_mode:3; __u8 dest_mode:1; __u8 delivery_status:1; __u8 polarity:1; __u8 remote_irr:1; __u8 trig_mode:1; __u8 mask:1; __u8 reserve:7; __u8 reserved[4]; __u8 dest_id; } fields; } redirtbl[KVM_IOAPIC_NUM_PINS]; }; #define KVM_IRQCHIP_PIC_MASTER 0 #define KVM_IRQCHIP_PIC_SLAVE 1 #define KVM_IRQCHIP_IOAPIC 2 #define KVM_NR_IRQCHIPS 3 #define KVM_RUN_X86_SMM (1 << 0) /* for KVM_GET_REGS and KVM_SET_REGS */ struct kvm_regs { /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */ __u64 rax, rbx, rcx, rdx; __u64 rsi, rdi, rsp, rbp; __u64 r8, r9, r10, r11; __u64 r12, r13, r14, r15; __u64 rip, rflags; }; /* for KVM_GET_LAPIC and KVM_SET_LAPIC */ #define KVM_APIC_REG_SIZE 0x400 struct kvm_lapic_state { char regs[KVM_APIC_REG_SIZE]; }; struct kvm_segment { __u64 base; __u32 limit; __u16 selector; __u8 type; __u8 present, dpl, db, s, l, g, avl; __u8 unusable; __u8 padding; }; struct kvm_dtable { __u64 base; __u16 limit; __u16 padding[3]; }; /* for KVM_GET_SREGS and KVM_SET_SREGS */ struct kvm_sregs { /* out (KVM_GET_SREGS) / in (KVM_SET_SREGS) */ struct kvm_segment cs, ds, es, fs, gs, ss; struct kvm_segment tr, ldt; struct kvm_dtable gdt, idt; __u64 cr0, cr2, cr3, cr4, cr8; __u64 efer; __u64 apic_base; __u64 interrupt_bitmap[(KVM_NR_INTERRUPTS + 63) / 64]; }; /* for KVM_GET_FPU and KVM_SET_FPU */ struct kvm_fpu { __u8 fpr[8][16]; __u16 fcw; __u16 fsw; __u8 ftwx; /* in fxsave format */ __u8 pad1; __u16 last_opcode; __u64 last_ip; __u64 last_dp; __u8 xmm[16][16]; __u32 mxcsr; __u32 pad2; }; struct kvm_msr_entry { __u32 index; __u32 reserved; __u64 data; }; /* for KVM_GET_MSRS and KVM_SET_MSRS */ struct kvm_msrs { __u32 nmsrs; /* number of msrs in entries */ __u32 pad; struct kvm_msr_entry entries[0]; }; /* for KVM_GET_MSR_INDEX_LIST */ struct kvm_msr_list { __u32 nmsrs; /* number of msrs in entries */ __u32 indices[0]; }; struct kvm_cpuid_entry { __u32 function; __u32 eax; __u32 ebx; __u32 ecx; __u32 edx; __u32 padding; }; /* for KVM_SET_CPUID */ struct kvm_cpuid { __u32 nent; __u32 padding; struct kvm_cpuid_entry entries[0]; }; struct kvm_cpuid_entry2 { __u32 function; __u32 index; __u32 flags; __u32 eax; __u32 ebx; __u32 ecx; __u32 edx; __u32 padding[3]; }; #define KVM_CPUID_FLAG_SIGNIFCANT_INDEX (1 << 0) #define KVM_CPUID_FLAG_STATEFUL_FUNC (1 << 1) #define KVM_CPUID_FLAG_STATE_READ_NEXT (1 << 2) /* for KVM_SET_CPUID2 */ struct kvm_cpuid2 { __u32 nent; __u32 padding; struct kvm_cpuid_entry2 entries[0]; }; /* for KVM_GET_PIT and KVM_SET_PIT */ struct kvm_pit_channel_state { __u32 count; /* can be 65536 */ __u16 latched_count; __u8 count_latched; __u8 status_latched; __u8 status; __u8 read_state; __u8 write_state; __u8 write_latch; __u8 rw_mode; __u8 mode; __u8 bcd; __u8 gate; __s64 count_load_time; }; struct kvm_debug_exit_arch { __u32 exception; __u32 pad; __u64 pc; __u64 dr6; __u64 dr7; }; #define KVM_GUESTDBG_USE_SW_BP 0x00010000 #define KVM_GUESTDBG_USE_HW_BP 0x00020000 #define KVM_GUESTDBG_INJECT_DB 0x00040000 #define KVM_GUESTDBG_INJECT_BP 0x00080000 /* for KVM_SET_GUEST_DEBUG */ struct kvm_guest_debug_arch { __u64 debugreg[8]; }; struct kvm_pit_state { struct kvm_pit_channel_state channels[3]; }; #define KVM_PIT_FLAGS_HPET_LEGACY 0x00000001 struct kvm_pit_state2 { struct kvm_pit_channel_state channels[3]; __u32 flags; __u32 reserved[9]; }; struct kvm_reinject_control { __u8 pit_reinject; __u8 reserved[31]; }; /* When set in flags, include corresponding fields on KVM_SET_VCPU_EVENTS */ #define KVM_VCPUEVENT_VALID_NMI_PENDING 0x00000001 #define KVM_VCPUEVENT_VALID_SIPI_VECTOR 0x00000002 #define KVM_VCPUEVENT_VALID_SHADOW 0x00000004 #define KVM_VCPUEVENT_VALID_SMM 0x00000008 /* Interrupt shadow states */ #define KVM_X86_SHADOW_INT_MOV_SS 0x01 #define KVM_X86_SHADOW_INT_STI 0x02 /* for KVM_GET/SET_VCPU_EVENTS */ struct kvm_vcpu_events { struct { __u8 injected; __u8 nr; __u8 has_error_code; __u8 pad; __u32 error_code; } exception; struct { __u8 injected; __u8 nr; __u8 soft; __u8 shadow; } interrupt; struct { __u8 injected; __u8 pending; __u8 masked; __u8 pad; } nmi; __u32 sipi_vector; __u32 flags; struct { __u8 smm; __u8 pending; __u8 smm_inside_nmi; __u8 latched_init; } smi; __u32 reserved[9]; }; /* for KVM_GET/SET_DEBUGREGS */ struct kvm_debugregs { __u64 db[4]; __u64 dr6; __u64 dr7; __u64 flags; __u64 reserved[9]; }; /* for KVM_CAP_XSAVE */ struct kvm_xsave { __u32 region[1024]; }; #define KVM_MAX_XCRS 16 struct kvm_xcr { __u32 xcr; __u32 reserved; __u64 value; }; struct kvm_xcrs { __u32 nr_xcrs; __u32 flags; struct kvm_xcr xcrs[KVM_MAX_XCRS]; __u64 padding[16]; }; #define KVM_SYNC_X86_REGS (1UL << 0) #define KVM_SYNC_X86_SREGS (1UL << 1) #define KVM_SYNC_X86_EVENTS (1UL << 2) #define KVM_SYNC_X86_VALID_FIELDS \ (KVM_SYNC_X86_REGS| \ KVM_SYNC_X86_SREGS| \ KVM_SYNC_X86_EVENTS) /* kvm_sync_regs struct included by kvm_run struct */ struct kvm_sync_regs { /* Members of this structure are potentially malicious. * Care must be taken by code reading, esp. interpreting, * data fields from them inside KVM to prevent TOCTOU and * double-fetch types of vulnerabilities. */ struct kvm_regs regs; struct kvm_sregs sregs; struct kvm_vcpu_events events; }; #define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0) #define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1) #define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2) #define KVM_X86_QUIRK_OUT_7E_INC_RIP (1 << 3) #define KVM_STATE_NESTED_GUEST_MODE 0x00000001 #define KVM_STATE_NESTED_RUN_PENDING 0x00000002 #define KVM_STATE_NESTED_SMM_GUEST_MODE 0x00000001 #define KVM_STATE_NESTED_SMM_VMXON 0x00000002 struct kvm_vmx_nested_state { __u64 vmxon_pa; __u64 vmcs_pa; struct { __u16 flags; } smm; }; /* for KVM_CAP_NESTED_STATE */ struct kvm_nested_state { /* KVM_STATE_* flags */ __u16 flags; /* 0 for VMX, 1 for SVM. */ __u16 format; /* 128 for SVM, 128 + VMCS size for VMX. */ __u32 size; union { /* VMXON, VMCS */ struct kvm_vmx_nested_state vmx; /* Pad the header to 128 bytes. */ __u8 pad[120]; }; __u8 data[0]; }; #endif /* _ASM_X86_KVM_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/kvm_perf.h��������������������������������������������������������������������������������������0000644�����������������00000000604�14763166027�0007322 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_KVM_PERF_H #define _ASM_X86_KVM_PERF_H #include <asm/svm.h> #include <asm/vmx.h> #include <asm/kvm.h> #define DECODE_STR_LEN 20 #define VCPU_ID "vcpu_id" #define KVM_ENTRY_TRACE "kvm:kvm_entry" #define KVM_EXIT_TRACE "kvm:kvm_exit" #define KVM_EXIT_REASON "exit_reason" #endif /* _ASM_X86_KVM_PERF_H */ ����������������������������������������������������������������������������������������������������������������������������asm/auxvec.h����������������������������������������������������������������������������������������0000644�����������������00000001042�14763166027�0007001 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_AUXVEC_H #define _ASM_X86_AUXVEC_H /* * Architecture-neutral AT_ values in 0-17, leave some room * for more of them, start the x86-specific ones at 32. */ #ifdef __i386__ #define AT_SYSINFO 32 #endif #define AT_SYSINFO_EHDR 33 /* entries in ARCH_DLINFO: */ #if defined(CONFIG_IA32_EMULATION) || !defined(CONFIG_X86_64) # define AT_VECTOR_SIZE_ARCH 2 #else /* else it's non-compat x86-64 */ # define AT_VECTOR_SIZE_ARCH 1 #endif #endif /* _ASM_X86_AUXVEC_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/svm.h�������������������������������������������������������������������������������������������0000644�����������������00000015567�14763166027�0006334 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __SVM_H #define __SVM_H #define SVM_EXIT_READ_CR0 0x000 #define SVM_EXIT_READ_CR2 0x002 #define SVM_EXIT_READ_CR3 0x003 #define SVM_EXIT_READ_CR4 0x004 #define SVM_EXIT_READ_CR8 0x008 #define SVM_EXIT_WRITE_CR0 0x010 #define SVM_EXIT_WRITE_CR2 0x012 #define SVM_EXIT_WRITE_CR3 0x013 #define SVM_EXIT_WRITE_CR4 0x014 #define SVM_EXIT_WRITE_CR8 0x018 #define SVM_EXIT_READ_DR0 0x020 #define SVM_EXIT_READ_DR1 0x021 #define SVM_EXIT_READ_DR2 0x022 #define SVM_EXIT_READ_DR3 0x023 #define SVM_EXIT_READ_DR4 0x024 #define SVM_EXIT_READ_DR5 0x025 #define SVM_EXIT_READ_DR6 0x026 #define SVM_EXIT_READ_DR7 0x027 #define SVM_EXIT_WRITE_DR0 0x030 #define SVM_EXIT_WRITE_DR1 0x031 #define SVM_EXIT_WRITE_DR2 0x032 #define SVM_EXIT_WRITE_DR3 0x033 #define SVM_EXIT_WRITE_DR4 0x034 #define SVM_EXIT_WRITE_DR5 0x035 #define SVM_EXIT_WRITE_DR6 0x036 #define SVM_EXIT_WRITE_DR7 0x037 #define SVM_EXIT_EXCP_BASE 0x040 #define SVM_EXIT_INTR 0x060 #define SVM_EXIT_NMI 0x061 #define SVM_EXIT_SMI 0x062 #define SVM_EXIT_INIT 0x063 #define SVM_EXIT_VINTR 0x064 #define SVM_EXIT_CR0_SEL_WRITE 0x065 #define SVM_EXIT_IDTR_READ 0x066 #define SVM_EXIT_GDTR_READ 0x067 #define SVM_EXIT_LDTR_READ 0x068 #define SVM_EXIT_TR_READ 0x069 #define SVM_EXIT_IDTR_WRITE 0x06a #define SVM_EXIT_GDTR_WRITE 0x06b #define SVM_EXIT_LDTR_WRITE 0x06c #define SVM_EXIT_TR_WRITE 0x06d #define SVM_EXIT_RDTSC 0x06e #define SVM_EXIT_RDPMC 0x06f #define SVM_EXIT_PUSHF 0x070 #define SVM_EXIT_POPF 0x071 #define SVM_EXIT_CPUID 0x072 #define SVM_EXIT_RSM 0x073 #define SVM_EXIT_IRET 0x074 #define SVM_EXIT_SWINT 0x075 #define SVM_EXIT_INVD 0x076 #define SVM_EXIT_PAUSE 0x077 #define SVM_EXIT_HLT 0x078 #define SVM_EXIT_INVLPG 0x079 #define SVM_EXIT_INVLPGA 0x07a #define SVM_EXIT_IOIO 0x07b #define SVM_EXIT_MSR 0x07c #define SVM_EXIT_TASK_SWITCH 0x07d #define SVM_EXIT_FERR_FREEZE 0x07e #define SVM_EXIT_SHUTDOWN 0x07f #define SVM_EXIT_VMRUN 0x080 #define SVM_EXIT_VMMCALL 0x081 #define SVM_EXIT_VMLOAD 0x082 #define SVM_EXIT_VMSAVE 0x083 #define SVM_EXIT_STGI 0x084 #define SVM_EXIT_CLGI 0x085 #define SVM_EXIT_SKINIT 0x086 #define SVM_EXIT_RDTSCP 0x087 #define SVM_EXIT_ICEBP 0x088 #define SVM_EXIT_WBINVD 0x089 #define SVM_EXIT_MONITOR 0x08a #define SVM_EXIT_MWAIT 0x08b #define SVM_EXIT_MWAIT_COND 0x08c #define SVM_EXIT_XSETBV 0x08d #define SVM_EXIT_NPF 0x400 #define SVM_EXIT_AVIC_INCOMPLETE_IPI 0x401 #define SVM_EXIT_AVIC_UNACCELERATED_ACCESS 0x402 #define SVM_EXIT_ERR -1 #define SVM_EXIT_REASONS \ { SVM_EXIT_READ_CR0, "read_cr0" }, \ { SVM_EXIT_READ_CR2, "read_cr2" }, \ { SVM_EXIT_READ_CR3, "read_cr3" }, \ { SVM_EXIT_READ_CR4, "read_cr4" }, \ { SVM_EXIT_READ_CR8, "read_cr8" }, \ { SVM_EXIT_WRITE_CR0, "write_cr0" }, \ { SVM_EXIT_WRITE_CR2, "write_cr2" }, \ { SVM_EXIT_WRITE_CR3, "write_cr3" }, \ { SVM_EXIT_WRITE_CR4, "write_cr4" }, \ { SVM_EXIT_WRITE_CR8, "write_cr8" }, \ { SVM_EXIT_READ_DR0, "read_dr0" }, \ { SVM_EXIT_READ_DR1, "read_dr1" }, \ { SVM_EXIT_READ_DR2, "read_dr2" }, \ { SVM_EXIT_READ_DR3, "read_dr3" }, \ { SVM_EXIT_READ_DR4, "read_dr4" }, \ { SVM_EXIT_READ_DR5, "read_dr5" }, \ { SVM_EXIT_READ_DR6, "read_dr6" }, \ { SVM_EXIT_READ_DR7, "read_dr7" }, \ { SVM_EXIT_WRITE_DR0, "write_dr0" }, \ { SVM_EXIT_WRITE_DR1, "write_dr1" }, \ { SVM_EXIT_WRITE_DR2, "write_dr2" }, \ { SVM_EXIT_WRITE_DR3, "write_dr3" }, \ { SVM_EXIT_WRITE_DR4, "write_dr4" }, \ { SVM_EXIT_WRITE_DR5, "write_dr5" }, \ { SVM_EXIT_WRITE_DR6, "write_dr6" }, \ { SVM_EXIT_WRITE_DR7, "write_dr7" }, \ { SVM_EXIT_EXCP_BASE + DE_VECTOR, "DE excp" }, \ { SVM_EXIT_EXCP_BASE + DB_VECTOR, "DB excp" }, \ { SVM_EXIT_EXCP_BASE + BP_VECTOR, "BP excp" }, \ { SVM_EXIT_EXCP_BASE + OF_VECTOR, "OF excp" }, \ { SVM_EXIT_EXCP_BASE + BR_VECTOR, "BR excp" }, \ { SVM_EXIT_EXCP_BASE + UD_VECTOR, "UD excp" }, \ { SVM_EXIT_EXCP_BASE + NM_VECTOR, "NM excp" }, \ { SVM_EXIT_EXCP_BASE + DF_VECTOR, "DF excp" }, \ { SVM_EXIT_EXCP_BASE + TS_VECTOR, "TS excp" }, \ { SVM_EXIT_EXCP_BASE + NP_VECTOR, "NP excp" }, \ { SVM_EXIT_EXCP_BASE + SS_VECTOR, "SS excp" }, \ { SVM_EXIT_EXCP_BASE + GP_VECTOR, "GP excp" }, \ { SVM_EXIT_EXCP_BASE + PF_VECTOR, "PF excp" }, \ { SVM_EXIT_EXCP_BASE + MF_VECTOR, "MF excp" }, \ { SVM_EXIT_EXCP_BASE + AC_VECTOR, "AC excp" }, \ { SVM_EXIT_EXCP_BASE + MC_VECTOR, "MC excp" }, \ { SVM_EXIT_EXCP_BASE + XM_VECTOR, "XF excp" }, \ { SVM_EXIT_INTR, "interrupt" }, \ { SVM_EXIT_NMI, "nmi" }, \ { SVM_EXIT_SMI, "smi" }, \ { SVM_EXIT_INIT, "init" }, \ { SVM_EXIT_VINTR, "vintr" }, \ { SVM_EXIT_CR0_SEL_WRITE, "cr0_sel_write" }, \ { SVM_EXIT_IDTR_READ, "read_idtr" }, \ { SVM_EXIT_GDTR_READ, "read_gdtr" }, \ { SVM_EXIT_LDTR_READ, "read_ldtr" }, \ { SVM_EXIT_TR_READ, "read_rt" }, \ { SVM_EXIT_IDTR_WRITE, "write_idtr" }, \ { SVM_EXIT_GDTR_WRITE, "write_gdtr" }, \ { SVM_EXIT_LDTR_WRITE, "write_ldtr" }, \ { SVM_EXIT_TR_WRITE, "write_rt" }, \ { SVM_EXIT_RDTSC, "rdtsc" }, \ { SVM_EXIT_RDPMC, "rdpmc" }, \ { SVM_EXIT_PUSHF, "pushf" }, \ { SVM_EXIT_POPF, "popf" }, \ { SVM_EXIT_CPUID, "cpuid" }, \ { SVM_EXIT_RSM, "rsm" }, \ { SVM_EXIT_IRET, "iret" }, \ { SVM_EXIT_SWINT, "swint" }, \ { SVM_EXIT_INVD, "invd" }, \ { SVM_EXIT_PAUSE, "pause" }, \ { SVM_EXIT_HLT, "hlt" }, \ { SVM_EXIT_INVLPG, "invlpg" }, \ { SVM_EXIT_INVLPGA, "invlpga" }, \ { SVM_EXIT_IOIO, "io" }, \ { SVM_EXIT_MSR, "msr" }, \ { SVM_EXIT_TASK_SWITCH, "task_switch" }, \ { SVM_EXIT_FERR_FREEZE, "ferr_freeze" }, \ { SVM_EXIT_SHUTDOWN, "shutdown" }, \ { SVM_EXIT_VMRUN, "vmrun" }, \ { SVM_EXIT_VMMCALL, "hypercall" }, \ { SVM_EXIT_VMLOAD, "vmload" }, \ { SVM_EXIT_VMSAVE, "vmsave" }, \ { SVM_EXIT_STGI, "stgi" }, \ { SVM_EXIT_CLGI, "clgi" }, \ { SVM_EXIT_SKINIT, "skinit" }, \ { SVM_EXIT_RDTSCP, "rdtscp" }, \ { SVM_EXIT_ICEBP, "icebp" }, \ { SVM_EXIT_WBINVD, "wbinvd" }, \ { SVM_EXIT_MONITOR, "monitor" }, \ { SVM_EXIT_MWAIT, "mwait" }, \ { SVM_EXIT_XSETBV, "xsetbv" }, \ { SVM_EXIT_NPF, "npf" }, \ { SVM_EXIT_AVIC_INCOMPLETE_IPI, "avic_incomplete_ipi" }, \ { SVM_EXIT_AVIC_UNACCELERATED_ACCESS, "avic_unaccelerated_access" }, \ { SVM_EXIT_ERR, "invalid_guest_state" } #endif /* __SVM_H */ �����������������������������������������������������������������������������������������������������������������������������������������asm/termios.h���������������������������������������������������������������������������������������0000644�����������������00000000041�14763166027�0007166 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <asm-generic/termios.h> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/posix_types_x32.h�������������������������������������������������������������������������������0000644�����������������00000001105�14763166027�0010570 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_POSIX_TYPES_X32_H #define _ASM_X86_POSIX_TYPES_X32_H /* * This file is only used by user-level software, so you need to * be a little careful about namespace pollution etc. Also, we cannot * assume GCC is being used. * * These types should generally match the ones used by the 64-bit kernel, * */ typedef long long __kernel_long_t; typedef unsigned long long __kernel_ulong_t; #define __kernel_long_t __kernel_long_t #include <asm/posix_types_64.h> #endif /* _ASM_X86_POSIX_TYPES_X32_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/unistd.h����������������������������������������������������������������������������������������0000644�����������������00000000547�14763166027�0007025 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_UNISTD_H #define _ASM_X86_UNISTD_H /* x32 syscall flag bit */ #define __X32_SYSCALL_BIT 0x40000000 # ifdef __i386__ # include <asm/unistd_32.h> # elif defined(__ILP32__) # include <asm/unistd_x32.h> # else # include <asm/unistd_64.h> # endif #endif /* _ASM_X86_UNISTD_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������asm/e820.h������������������������������������������������������������������������������������������0000644�����������������00000005023�14763166027�0006167 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_E820_H #define _ASM_X86_E820_H #define E820MAP 0x2d0 /* our map */ #define E820MAX 128 /* number of entries in E820MAP */ /* * Legacy E820 BIOS limits us to 128 (E820MAX) nodes due to the * constrained space in the zeropage. If we have more nodes than * that, and if we've booted off EFI firmware, then the EFI tables * passed us from the EFI firmware can list more nodes. Size our * internal memory map tables to have room for these additional * nodes, based on up to three entries per node for which the * kernel was built: MAX_NUMNODES == (1 << CONFIG_NODES_SHIFT), * plus E820MAX, allowing space for the possible duplicate E820 * entries that might need room in the same arrays, prior to the * call to sanitize_e820_map() to remove duplicates. The allowance * of three memory map entries per node is "enough" entries for * the initial hardware platform motivating this mechanism to make * use of additional EFI map entries. Future platforms may want * to allow more than three entries per node or otherwise refine * this size. */ #define E820_X_MAX E820MAX #define E820NR 0x1e8 /* # entries in E820MAP */ #define E820_RAM 1 #define E820_RESERVED 2 #define E820_ACPI 3 #define E820_NVS 4 #define E820_UNUSABLE 5 #define E820_PMEM 7 /* * This is a non-standardized way to represent ADR or NVDIMM regions that * persist over a reboot. The kernel will ignore their special capabilities * unless the CONFIG_X86_PMEM_LEGACY option is set. * * ( Note that older platforms also used 6 for the same type of memory, * but newer versions switched to 12 as 6 was assigned differently. Some * time they will learn... ) */ #define E820_PRAM 12 /* * reserved RAM used by kernel itself * if CONFIG_INTEL_TXT is enabled, memory of this type will be * included in the S3 integrity calculation and so should not include * any memory that BIOS might alter over the S3 transition */ #define E820_RESERVED_KERN 128 #ifndef __ASSEMBLY__ #include <linux/types.h> struct e820entry { __u64 addr; /* start of memory segment */ __u64 size; /* size of memory segment */ __u32 type; /* type of memory segment */ } __attribute__((packed)); struct e820map { __u32 nr_map; struct e820entry map[E820_X_MAX]; }; #define ISA_START_ADDRESS 0xa0000 #define ISA_END_ADDRESS 0x100000 #define BIOS_BEGIN 0x000a0000 #define BIOS_END 0x00100000 #define BIOS_ROM_BASE 0xffe00000 #define BIOS_ROM_END 0xffffffff #endif /* __ASSEMBLY__ */ #endif /* _ASM_X86_E820_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/param.h�����������������������������������������������������������������������������������������0000644�����������������00000000037�14763166027�0006611 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <asm-generic/param.h> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/bpf_perf_event.h��������������������������������������������������������������������������������0000644�����������������00000000050�14763166027�0010470 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <asm-generic/bpf_perf_event.h> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/sockios.h���������������������������������������������������������������������������������������0000644�����������������00000000041�14763166027�0007156 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <asm-generic/sockios.h> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/resource.h��������������������������������������������������������������������������������������0000644�����������������00000000042�14763166027�0007334 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <asm-generic/resource.h> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/statfs.h����������������������������������������������������������������������������������������0000644�����������������00000000640�14763166027�0007015 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_STATFS_H #define _ASM_X86_STATFS_H /* * We need compat_statfs64 to be packed, because the i386 ABI won't * add padding at the end to bring it to a multiple of 8 bytes, but * the x86_64 ABI will. */ #define ARCH_PACK_COMPAT_STATFS64 __attribute__((packed,aligned(4))) #include <asm-generic/statfs.h> #endif /* _ASM_X86_STATFS_H */ ������������������������������������������������������������������������������������������������asm/mtrr.h������������������������������������������������������������������������������������������0000644�����������������00000010201�14763166027�0006467 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: LGPL-2.0+ WITH Linux-syscall-note */ /* Generic MTRR (Memory Type Range Register) ioctls. Copyright (C) 1997-1999 Richard Gooch This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Richard Gooch may be reached by email at rgooch@atnf.csiro.au The postal address is: Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia. */ #ifndef _ASM_X86_MTRR_H #define _ASM_X86_MTRR_H #include <linux/types.h> #include <linux/ioctl.h> #include <linux/errno.h> #define MTRR_IOCTL_BASE 'M' /* Warning: this structure has a different order from i386 on x86-64. The 32bit emulation code takes care of that. But you need to use this for 64bit, otherwise your X server will break. */ #ifdef __i386__ struct mtrr_sentry { unsigned long base; /* Base address */ unsigned int size; /* Size of region */ unsigned int type; /* Type of region */ }; struct mtrr_gentry { unsigned int regnum; /* Register number */ unsigned long base; /* Base address */ unsigned int size; /* Size of region */ unsigned int type; /* Type of region */ }; #else /* __i386__ */ struct mtrr_sentry { __u64 base; /* Base address */ __u32 size; /* Size of region */ __u32 type; /* Type of region */ }; struct mtrr_gentry { __u64 base; /* Base address */ __u32 size; /* Size of region */ __u32 regnum; /* Register number */ __u32 type; /* Type of region */ __u32 _pad; /* Unused */ }; #endif /* !__i386__ */ struct mtrr_var_range { __u32 base_lo; __u32 base_hi; __u32 mask_lo; __u32 mask_hi; }; /* In the Intel processor's MTRR interface, the MTRR type is always held in an 8 bit field: */ typedef __u8 mtrr_type; #define MTRR_NUM_FIXED_RANGES 88 #define MTRR_MAX_VAR_RANGES 256 struct mtrr_state_type { struct mtrr_var_range var_ranges[MTRR_MAX_VAR_RANGES]; mtrr_type fixed_ranges[MTRR_NUM_FIXED_RANGES]; unsigned char enabled; unsigned char have_fixed; mtrr_type def_type; }; #define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg)) #define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1) /* These are the various ioctls */ #define MTRRIOC_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry) #define MTRRIOC_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry) #define MTRRIOC_DEL_ENTRY _IOW(MTRR_IOCTL_BASE, 2, struct mtrr_sentry) #define MTRRIOC_GET_ENTRY _IOWR(MTRR_IOCTL_BASE, 3, struct mtrr_gentry) #define MTRRIOC_KILL_ENTRY _IOW(MTRR_IOCTL_BASE, 4, struct mtrr_sentry) #define MTRRIOC_ADD_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 5, struct mtrr_sentry) #define MTRRIOC_SET_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 6, struct mtrr_sentry) #define MTRRIOC_DEL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 7, struct mtrr_sentry) #define MTRRIOC_GET_PAGE_ENTRY _IOWR(MTRR_IOCTL_BASE, 8, struct mtrr_gentry) #define MTRRIOC_KILL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 9, struct mtrr_sentry) /* MTRR memory types, which are defined in SDM */ #define MTRR_TYPE_UNCACHABLE 0 #define MTRR_TYPE_WRCOMB 1 /*#define MTRR_TYPE_ 2*/ /*#define MTRR_TYPE_ 3*/ #define MTRR_TYPE_WRTHROUGH 4 #define MTRR_TYPE_WRPROT 5 #define MTRR_TYPE_WRBACK 6 #define MTRR_NUM_TYPES 7 /* * Invalid MTRR memory type. mtrr_type_lookup() returns this value when * MTRRs are disabled. Note, this value is allocated from the reserved * values (0x7-0xff) of the MTRR memory types. */ #define MTRR_TYPE_INVALID 0xff #endif /* _ASM_X86_MTRR_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/ucontext.h��������������������������������������������������������������������������������������0000644�����������������00000004105�14763166027�0007362 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_UCONTEXT_H #define _ASM_X86_UCONTEXT_H /* * Indicates the presence of extended state information in the memory * layout pointed by the fpstate pointer in the ucontext's sigcontext * struct (uc_mcontext). */ #define UC_FP_XSTATE 0x1 #ifdef __x86_64__ /* * UC_SIGCONTEXT_SS will be set when delivering 64-bit or x32 signals on * kernels that save SS in the sigcontext. All kernels that set * UC_SIGCONTEXT_SS will correctly restore at least the low 32 bits of esp * regardless of SS (i.e. they implement espfix). * * Kernels that set UC_SIGCONTEXT_SS will also set UC_STRICT_RESTORE_SS * when delivering a signal that came from 64-bit code. * * Sigreturn restores SS as follows: * * if (saved SS is valid || UC_STRICT_RESTORE_SS is set || * saved CS is not 64-bit) * new SS = saved SS (will fail IRET and signal if invalid) * else * new SS = a flat 32-bit data segment * * This behavior serves three purposes: * * - Legacy programs that construct a 64-bit sigcontext from scratch * with zero or garbage in the SS slot (e.g. old CRIU) and call * sigreturn will still work. * * - Old DOSEMU versions sometimes catch a signal from a segmented * context, delete the old SS segment (with modify_ldt), and change * the saved CS to a 64-bit segment. These DOSEMU versions expect * sigreturn to send them back to 64-bit mode without killing them, * despite the fact that the SS selector when the signal was raised is * no longer valid. UC_STRICT_RESTORE_SS will be clear, so the kernel * will fix up SS for these DOSEMU versions. * * - Old and new programs that catch a signal and return without * modifying the saved context will end up in exactly the state they * started in, even if they were running in a segmented context when * the signal was raised.. Old kernels would lose track of the * previous SS value. */ #define UC_SIGCONTEXT_SS 0x2 #define UC_STRICT_RESTORE_SS 0x4 #endif #include <asm-generic/ucontext.h> #endif /* _ASM_X86_UCONTEXT_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/socket.h����������������������������������������������������������������������������������������0000644�����������������00000000040�14763166027�0006773 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <asm-generic/socket.h> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/posix_types_32.h��������������������������������������������������������������������������������0000644�����������������00000001375�14763166027�0010411 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_POSIX_TYPES_32_H #define _ASM_X86_POSIX_TYPES_32_H /* * This file is generally used by user-level software, so you need to * be a little careful about namespace pollution etc. Also, we cannot * assume GCC is being used. */ typedef unsigned short __kernel_mode_t; #define __kernel_mode_t __kernel_mode_t typedef unsigned short __kernel_ipc_pid_t; #define __kernel_ipc_pid_t __kernel_ipc_pid_t typedef unsigned short __kernel_uid_t; typedef unsigned short __kernel_gid_t; #define __kernel_uid_t __kernel_uid_t typedef unsigned short __kernel_old_dev_t; #define __kernel_old_dev_t __kernel_old_dev_t #include <asm-generic/posix_types.h> #endif /* _ASM_X86_POSIX_TYPES_32_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/kvm_para.h��������������������������������������������������������������������������������������0000644�����������������00000006233�14763166027�0007315 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_KVM_PARA_H #define _ASM_X86_KVM_PARA_H #include <linux/types.h> /* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx. It * should be used to determine that a VM is running under KVM. */ #define KVM_CPUID_SIGNATURE 0x40000000 /* This CPUID returns two feature bitmaps in eax, edx. Before enabling * a particular paravirtualization, the appropriate feature bit should * be checked in eax. The performance hint feature bit should be checked * in edx. */ #define KVM_CPUID_FEATURES 0x40000001 #define KVM_FEATURE_CLOCKSOURCE 0 #define KVM_FEATURE_NOP_IO_DELAY 1 #define KVM_FEATURE_MMU_OP 2 /* This indicates that the new set of kvmclock msrs * are available. The use of 0x11 and 0x12 is deprecated */ #define KVM_FEATURE_CLOCKSOURCE2 3 #define KVM_FEATURE_ASYNC_PF 4 #define KVM_FEATURE_STEAL_TIME 5 #define KVM_FEATURE_PV_EOI 6 #define KVM_FEATURE_PV_UNHALT 7 #define KVM_FEATURE_PV_TLB_FLUSH 9 #define KVM_FEATURE_ASYNC_PF_VMEXIT 10 #define KVM_FEATURE_PV_SEND_IPI 11 #define KVM_HINTS_REALTIME 0 /* The last 8 bits are used to indicate how to interpret the flags field * in pvclock structure. If no bits are set, all flags are ignored. */ #define KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 24 #define MSR_KVM_WALL_CLOCK 0x11 #define MSR_KVM_SYSTEM_TIME 0x12 #define KVM_MSR_ENABLED 1 /* Custom MSRs falls in the range 0x4b564d00-0x4b564dff */ #define MSR_KVM_WALL_CLOCK_NEW 0x4b564d00 #define MSR_KVM_SYSTEM_TIME_NEW 0x4b564d01 #define MSR_KVM_ASYNC_PF_EN 0x4b564d02 #define MSR_KVM_STEAL_TIME 0x4b564d03 #define MSR_KVM_PV_EOI_EN 0x4b564d04 struct kvm_steal_time { __u64 steal; __u32 version; __u32 flags; __u8 preempted; __u8 u8_pad[3]; __u32 pad[11]; }; #define KVM_VCPU_PREEMPTED (1 << 0) #define KVM_VCPU_FLUSH_TLB (1 << 1) #define KVM_CLOCK_PAIRING_WALLCLOCK 0 struct kvm_clock_pairing { __s64 sec; __s64 nsec; __u64 tsc; __u32 flags; __u32 pad[9]; }; #define KVM_STEAL_ALIGNMENT_BITS 5 #define KVM_STEAL_VALID_BITS ((-1ULL << (KVM_STEAL_ALIGNMENT_BITS + 1))) #define KVM_STEAL_RESERVED_MASK (((1 << KVM_STEAL_ALIGNMENT_BITS) - 1 ) << 1) #define KVM_MAX_MMU_OP_BATCH 32 #define KVM_ASYNC_PF_ENABLED (1 << 0) #define KVM_ASYNC_PF_SEND_ALWAYS (1 << 1) #define KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT (1 << 2) /* Operations for KVM_HC_MMU_OP */ #define KVM_MMU_OP_WRITE_PTE 1 #define KVM_MMU_OP_FLUSH_TLB 2 #define KVM_MMU_OP_RELEASE_PT 3 /* Payload for KVM_HC_MMU_OP */ struct kvm_mmu_op_header { __u32 op; __u32 pad; }; struct kvm_mmu_op_write_pte { struct kvm_mmu_op_header header; __u64 pte_phys; __u64 pte_val; }; struct kvm_mmu_op_flush_tlb { struct kvm_mmu_op_header header; }; struct kvm_mmu_op_release_pt { struct kvm_mmu_op_header header; __u64 pt_phys; }; #define KVM_PV_REASON_PAGE_NOT_PRESENT 1 #define KVM_PV_REASON_PAGE_READY 2 struct kvm_vcpu_pv_apf_data { __u32 reason; __u8 pad[60]; __u32 enabled; }; #define KVM_PV_EOI_BIT 0 #define KVM_PV_EOI_MASK (0x1 << KVM_PV_EOI_BIT) #define KVM_PV_EOI_ENABLED KVM_PV_EOI_MASK #define KVM_PV_EOI_DISABLED 0x0 #endif /* _ASM_X86_KVM_PARA_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/debugreg.h��������������������������������������������������������������������������������������0000644�����������������00000006325�14763166027�0007303 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_DEBUGREG_H #define _ASM_X86_DEBUGREG_H /* Indicate the register numbers for a number of the specific debug registers. Registers 0-3 contain the addresses we wish to trap on */ #define DR_FIRSTADDR 0 /* u_debugreg[DR_FIRSTADDR] */ #define DR_LASTADDR 3 /* u_debugreg[DR_LASTADDR] */ #define DR_STATUS 6 /* u_debugreg[DR_STATUS] */ #define DR_CONTROL 7 /* u_debugreg[DR_CONTROL] */ /* Define a few things for the status register. We can use this to determine which debugging register was responsible for the trap. The other bits are either reserved or not of interest to us. */ /* Define reserved bits in DR6 which are always set to 1 */ #define DR6_RESERVED (0xFFFF0FF0) #define DR_TRAP0 (0x1) /* db0 */ #define DR_TRAP1 (0x2) /* db1 */ #define DR_TRAP2 (0x4) /* db2 */ #define DR_TRAP3 (0x8) /* db3 */ #define DR_TRAP_BITS (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3) #define DR_STEP (0x4000) /* single-step */ #define DR_SWITCH (0x8000) /* task switch */ /* Now define a bunch of things for manipulating the control register. The top two bytes of the control register consist of 4 fields of 4 bits - each field corresponds to one of the four debug registers, and indicates what types of access we trap on, and how large the data field is that we are looking at */ #define DR_CONTROL_SHIFT 16 /* Skip this many bits in ctl register */ #define DR_CONTROL_SIZE 4 /* 4 control bits per register */ #define DR_RW_EXECUTE (0x0) /* Settings for the access types to trap on */ #define DR_RW_WRITE (0x1) #define DR_RW_READ (0x3) #define DR_LEN_1 (0x0) /* Settings for data length to trap on */ #define DR_LEN_2 (0x4) #define DR_LEN_4 (0xC) #define DR_LEN_8 (0x8) /* The low byte to the control register determine which registers are enabled. There are 4 fields of two bits. One bit is "local", meaning that the processor will reset the bit after a task switch and the other is global meaning that we have to explicitly reset the bit. With linux, you can use either one, since we explicitly zero the register when we enter kernel mode. */ #define DR_LOCAL_ENABLE_SHIFT 0 /* Extra shift to the local enable bit */ #define DR_GLOBAL_ENABLE_SHIFT 1 /* Extra shift to the global enable bit */ #define DR_LOCAL_ENABLE (0x1) /* Local enable for reg 0 */ #define DR_GLOBAL_ENABLE (0x2) /* Global enable for reg 0 */ #define DR_ENABLE_SIZE 2 /* 2 enable bits per register */ #define DR_LOCAL_ENABLE_MASK (0x55) /* Set local bits for all 4 regs */ #define DR_GLOBAL_ENABLE_MASK (0xAA) /* Set global bits for all 4 regs */ /* The second byte to the control register has a few special things. We can slow the instruction pipeline for instructions coming via the gdt or the ldt if we want to. I am not sure why this is an advantage */ #ifdef __i386__ #define DR_CONTROL_RESERVED (0xFC00) /* Reserved by Intel */ #else #define DR_CONTROL_RESERVED (0xFFFFFFFF0000FC00UL) /* Reserved */ #endif #define DR_LOCAL_SLOWDOWN (0x100) /* Local slow the pipeline */ #define DR_GLOBAL_SLOWDOWN (0x200) /* Global slow the pipeline */ /* * HW breakpoint additions */ #endif /* _ASM_X86_DEBUGREG_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/errno.h�����������������������������������������������������������������������������������������0000644�����������������00000000037�14763166027�0006636 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <asm-generic/errno.h> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm/unistd_x32.h������������������������������������������������������������������������������������0000644�����������������00000036623�14763166027�0007525 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _ASM_X86_UNISTD_X32_H #define _ASM_X86_UNISTD_X32_H 1 #define __NR_read (__X32_SYSCALL_BIT + 0) #define __NR_write (__X32_SYSCALL_BIT + 1) #define __NR_open (__X32_SYSCALL_BIT + 2) #define __NR_close (__X32_SYSCALL_BIT + 3) #define __NR_stat (__X32_SYSCALL_BIT + 4) #define __NR_fstat (__X32_SYSCALL_BIT + 5) #define __NR_lstat (__X32_SYSCALL_BIT + 6) #define __NR_poll (__X32_SYSCALL_BIT + 7) #define __NR_lseek (__X32_SYSCALL_BIT + 8) #define __NR_mmap (__X32_SYSCALL_BIT + 9) #define __NR_mprotect (__X32_SYSCALL_BIT + 10) #define __NR_munmap (__X32_SYSCALL_BIT + 11) #define __NR_brk (__X32_SYSCALL_BIT + 12) #define __NR_rt_sigprocmask (__X32_SYSCALL_BIT + 14) #define __NR_pread64 (__X32_SYSCALL_BIT + 17) #define __NR_pwrite64 (__X32_SYSCALL_BIT + 18) #define __NR_access (__X32_SYSCALL_BIT + 21) #define __NR_pipe (__X32_SYSCALL_BIT + 22) #define __NR_select (__X32_SYSCALL_BIT + 23) #define __NR_sched_yield (__X32_SYSCALL_BIT + 24) #define __NR_mremap (__X32_SYSCALL_BIT + 25) #define __NR_msync (__X32_SYSCALL_BIT + 26) #define __NR_mincore (__X32_SYSCALL_BIT + 27) #define __NR_madvise (__X32_SYSCALL_BIT + 28) #define __NR_shmget (__X32_SYSCALL_BIT + 29) #define __NR_shmat (__X32_SYSCALL_BIT + 30) #define __NR_shmctl (__X32_SYSCALL_BIT + 31) #define __NR_dup (__X32_SYSCALL_BIT + 32) #define __NR_dup2 (__X32_SYSCALL_BIT + 33) #define __NR_pause (__X32_SYSCALL_BIT + 34) #define __NR_nanosleep (__X32_SYSCALL_BIT + 35) #define __NR_getitimer (__X32_SYSCALL_BIT + 36) #define __NR_alarm (__X32_SYSCALL_BIT + 37) #define __NR_setitimer (__X32_SYSCALL_BIT + 38) #define __NR_getpid (__X32_SYSCALL_BIT + 39) #define __NR_sendfile (__X32_SYSCALL_BIT + 40) #define __NR_socket (__X32_SYSCALL_BIT + 41) #define __NR_connect (__X32_SYSCALL_BIT + 42) #define __NR_accept (__X32_SYSCALL_BIT + 43) #define __NR_sendto (__X32_SYSCALL_BIT + 44) #define __NR_shutdown (__X32_SYSCALL_BIT + 48) #define __NR_bind (__X32_SYSCALL_BIT + 49) #define __NR_listen (__X32_SYSCALL_BIT + 50) #define __NR_getsockname (__X32_SYSCALL_BIT + 51) #define __NR_getpeername (__X32_SYSCALL_BIT + 52) #define __NR_socketpair (__X32_SYSCALL_BIT + 53) #define __NR_clone (__X32_SYSCALL_BIT + 56) #define __NR_fork (__X32_SYSCALL_BIT + 57) #define __NR_vfork (__X32_SYSCALL_BIT + 58) #define __NR_exit (__X32_SYSCALL_BIT + 60) #define __NR_wait4 (__X32_SYSCALL_BIT + 61) #define __NR_kill (__X32_SYSCALL_BIT + 62) #define __NR_uname (__X32_SYSCALL_BIT + 63) #define __NR_semget (__X32_SYSCALL_BIT + 64) #define __NR_semop (__X32_SYSCALL_BIT + 65) #define __NR_semctl (__X32_SYSCALL_BIT + 66) #define __NR_shmdt (__X32_SYSCALL_BIT + 67) #define __NR_msgget (__X32_SYSCALL_BIT + 68) #define __NR_msgsnd (__X32_SYSCALL_BIT + 69) #define __NR_msgrcv (__X32_SYSCALL_BIT + 70) #define __NR_msgctl (__X32_SYSCALL_BIT + 71) #define __NR_fcntl (__X32_SYSCALL_BIT + 72) #define __NR_flock (__X32_SYSCALL_BIT + 73) #define __NR_fsync (__X32_SYSCALL_BIT + 74) #define __NR_fdatasync (__X32_SYSCALL_BIT + 75) #define __NR_truncate (__X32_SYSCALL_BIT + 76) #define __NR_ftruncate (__X32_SYSCALL_BIT + 77) #define __NR_getdents (__X32_SYSCALL_BIT + 78) #define __NR_getcwd (__X32_SYSCALL_BIT + 79) #define __NR_chdir (__X32_SYSCALL_BIT + 80) #define __NR_fchdir (__X32_SYSCALL_BIT + 81) #define __NR_rename (__X32_SYSCALL_BIT + 82) #define __NR_mkdir (__X32_SYSCALL_BIT + 83) #define __NR_rmdir (__X32_SYSCALL_BIT + 84) #define __NR_creat (__X32_SYSCALL_BIT + 85) #define __NR_link (__X32_SYSCALL_BIT + 86) #define __NR_unlink (__X32_SYSCALL_BIT + 87) #define __NR_symlink (__X32_SYSCALL_BIT + 88) #define __NR_readlink (__X32_SYSCALL_BIT + 89) #define __NR_chmod (__X32_SYSCALL_BIT + 90) #define __NR_fchmod (__X32_SYSCALL_BIT + 91) #define __NR_chown (__X32_SYSCALL_BIT + 92) #define __NR_fchown (__X32_SYSCALL_BIT + 93) #define __NR_lchown (__X32_SYSCALL_BIT + 94) #define __NR_umask (__X32_SYSCALL_BIT + 95) #define __NR_gettimeofday (__X32_SYSCALL_BIT + 96) #define __NR_getrlimit (__X32_SYSCALL_BIT + 97) #define __NR_getrusage (__X32_SYSCALL_BIT + 98) #define __NR_sysinfo (__X32_SYSCALL_BIT + 99) #define __NR_times (__X32_SYSCALL_BIT + 100) #define __NR_getuid (__X32_SYSCALL_BIT + 102) #define __NR_syslog (__X32_SYSCALL_BIT + 103) #define __NR_getgid (__X32_SYSCALL_BIT + 104) #define __NR_setuid (__X32_SYSCALL_BIT + 105) #define __NR_setgid (__X32_SYSCALL_BIT + 106) #define __NR_geteuid (__X32_SYSCALL_BIT + 107) #define __NR_getegid (__X32_SYSCALL_BIT + 108) #define __NR_setpgid (__X32_SYSCALL_BIT + 109) #define __NR_getppid (__X32_SYSCALL_BIT + 110) #define __NR_getpgrp (__X32_SYSCALL_BIT + 111) #define __NR_setsid (__X32_SYSCALL_BIT + 112) #define __NR_setreuid (__X32_SYSCALL_BIT + 113) #define __NR_setregid (__X32_SYSCALL_BIT + 114) #define __NR_getgroups (__X32_SYSCALL_BIT + 115) #define __NR_setgroups (__X32_SYSCALL_BIT + 116) #define __NR_setresuid (__X32_SYSCALL_BIT + 117) #define __NR_getresuid (__X32_SYSCALL_BIT + 118) #define __NR_setresgid (__X32_SYSCALL_BIT + 119) #define __NR_getresgid (__X32_SYSCALL_BIT + 120) #define __NR_getpgid (__X32_SYSCALL_BIT + 121) #define __NR_setfsuid (__X32_SYSCALL_BIT + 122) #define __NR_setfsgid (__X32_SYSCALL_BIT + 123) #define __NR_getsid (__X32_SYSCALL_BIT + 124) #define __NR_capget (__X32_SYSCALL_BIT + 125) #define __NR_capset (__X32_SYSCALL_BIT + 126) #define __NR_rt_sigsuspend (__X32_SYSCALL_BIT + 130) #define __NR_utime (__X32_SYSCALL_BIT + 132) #define __NR_mknod (__X32_SYSCALL_BIT + 133) #define __NR_personality (__X32_SYSCALL_BIT + 135) #define __NR_ustat (__X32_SYSCALL_BIT + 136) #define __NR_statfs (__X32_SYSCALL_BIT + 137) #define __NR_fstatfs (__X32_SYSCALL_BIT + 138) #define __NR_sysfs (__X32_SYSCALL_BIT + 139) #define __NR_getpriority (__X32_SYSCALL_BIT + 140) #define __NR_setpriority (__X32_SYSCALL_BIT + 141) #define __NR_sched_setparam (__X32_SYSCALL_BIT + 142) #define __NR_sched_getparam (__X32_SYSCALL_BIT + 143) #define __NR_sched_setscheduler (__X32_SYSCALL_BIT + 144) #define __NR_sched_getscheduler (__X32_SYSCALL_BIT + 145) #define __NR_sched_get_priority_max (__X32_SYSCALL_BIT + 146) #define __NR_sched_get_priority_min (__X32_SYSCALL_BIT + 147) #define __NR_sched_rr_get_interval (__X32_SYSCALL_BIT + 148) #define __NR_mlock (__X32_SYSCALL_BIT + 149) #define __NR_munlock (__X32_SYSCALL_BIT + 150) #define __NR_mlockall (__X32_SYSCALL_BIT + 151) #define __NR_munlockall (__X32_SYSCALL_BIT + 152) #define __NR_vhangup (__X32_SYSCALL_BIT + 153) #define __NR_modify_ldt (__X32_SYSCALL_BIT + 154) #define __NR_pivot_root (__X32_SYSCALL_BIT + 155) #define __NR_prctl (__X32_SYSCALL_BIT + 157) #define __NR_arch_prctl (__X32_SYSCALL_BIT + 158) #define __NR_adjtimex (__X32_SYSCALL_BIT + 159) #define __NR_setrlimit (__X32_SYSCALL_BIT + 160) #define __NR_chroot (__X32_SYSCALL_BIT + 161) #define __NR_sync (__X32_SYSCALL_BIT + 162) #define __NR_acct (__X32_SYSCALL_BIT + 163) #define __NR_settimeofday (__X32_SYSCALL_BIT + 164) #define __NR_mount (__X32_SYSCALL_BIT + 165) #define __NR_umount2 (__X32_SYSCALL_BIT + 166) #define __NR_swapon (__X32_SYSCALL_BIT + 167) #define __NR_swapoff (__X32_SYSCALL_BIT + 168) #define __NR_reboot (__X32_SYSCALL_BIT + 169) #define __NR_sethostname (__X32_SYSCALL_BIT + 170) #define __NR_setdomainname (__X32_SYSCALL_BIT + 171) #define __NR_iopl (__X32_SYSCALL_BIT + 172) #define __NR_ioperm (__X32_SYSCALL_BIT + 173) #define __NR_init_module (__X32_SYSCALL_BIT + 175) #define __NR_delete_module (__X32_SYSCALL_BIT + 176) #define __NR_quotactl (__X32_SYSCALL_BIT + 179) #define __NR_getpmsg (__X32_SYSCALL_BIT + 181) #define __NR_putpmsg (__X32_SYSCALL_BIT + 182) #define __NR_afs_syscall (__X32_SYSCALL_BIT + 183) #define __NR_tuxcall (__X32_SYSCALL_BIT + 184) #define __NR_security (__X32_SYSCALL_BIT + 185) #define __NR_gettid (__X32_SYSCALL_BIT + 186) #define __NR_readahead (__X32_SYSCALL_BIT + 187) #define __NR_setxattr (__X32_SYSCALL_BIT + 188) #define __NR_lsetxattr (__X32_SYSCALL_BIT + 189) #define __NR_fsetxattr (__X32_SYSCALL_BIT + 190) #define __NR_getxattr (__X32_SYSCALL_BIT + 191) #define __NR_lgetxattr (__X32_SYSCALL_BIT + 192) #define __NR_fgetxattr (__X32_SYSCALL_BIT + 193) #define __NR_listxattr (__X32_SYSCALL_BIT + 194) #define __NR_llistxattr (__X32_SYSCALL_BIT + 195) #define __NR_flistxattr (__X32_SYSCALL_BIT + 196) #define __NR_removexattr (__X32_SYSCALL_BIT + 197) #define __NR_lremovexattr (__X32_SYSCALL_BIT + 198) #define __NR_fremovexattr (__X32_SYSCALL_BIT + 199) #define __NR_tkill (__X32_SYSCALL_BIT + 200) #define __NR_time (__X32_SYSCALL_BIT + 201) #define __NR_futex (__X32_SYSCALL_BIT + 202) #define __NR_sched_setaffinity (__X32_SYSCALL_BIT + 203) #define __NR_sched_getaffinity (__X32_SYSCALL_BIT + 204) #define __NR_io_destroy (__X32_SYSCALL_BIT + 207) #define __NR_io_getevents (__X32_SYSCALL_BIT + 208) #define __NR_io_cancel (__X32_SYSCALL_BIT + 210) #define __NR_lookup_dcookie (__X32_SYSCALL_BIT + 212) #define __NR_epoll_create (__X32_SYSCALL_BIT + 213) #define __NR_remap_file_pages (__X32_SYSCALL_BIT + 216) #define __NR_getdents64 (__X32_SYSCALL_BIT + 217) #define __NR_set_tid_address (__X32_SYSCALL_BIT + 218) #define __NR_restart_syscall (__X32_SYSCALL_BIT + 219) #define __NR_semtimedop (__X32_SYSCALL_BIT + 220) #define __NR_fadvise64 (__X32_SYSCALL_BIT + 221) #define __NR_timer_settime (__X32_SYSCALL_BIT + 223) #define __NR_timer_gettime (__X32_SYSCALL_BIT + 224) #define __NR_timer_getoverrun (__X32_SYSCALL_BIT + 225) #define __NR_timer_delete (__X32_SYSCALL_BIT + 226) #define __NR_clock_settime (__X32_SYSCALL_BIT + 227) #define __NR_clock_gettime (__X32_SYSCALL_BIT + 228) #define __NR_clock_getres (__X32_SYSCALL_BIT + 229) #define __NR_clock_nanosleep (__X32_SYSCALL_BIT + 230) #define __NR_exit_group (__X32_SYSCALL_BIT + 231) #define __NR_epoll_wait (__X32_SYSCALL_BIT + 232) #define __NR_epoll_ctl (__X32_SYSCALL_BIT + 233) #define __NR_tgkill (__X32_SYSCALL_BIT + 234) #define __NR_utimes (__X32_SYSCALL_BIT + 235) #define __NR_mbind (__X32_SYSCALL_BIT + 237) #define __NR_set_mempolicy (__X32_SYSCALL_BIT + 238) #define __NR_get_mempolicy (__X32_SYSCALL_BIT + 239) #define __NR_mq_open (__X32_SYSCALL_BIT + 240) #define __NR_mq_unlink (__X32_SYSCALL_BIT + 241) #define __NR_mq_timedsend (__X32_SYSCALL_BIT + 242) #define __NR_mq_timedreceive (__X32_SYSCALL_BIT + 243) #define __NR_mq_getsetattr (__X32_SYSCALL_BIT + 245) #define __NR_add_key (__X32_SYSCALL_BIT + 248) #define __NR_request_key (__X32_SYSCALL_BIT + 249) #define __NR_keyctl (__X32_SYSCALL_BIT + 250) #define __NR_ioprio_set (__X32_SYSCALL_BIT + 251) #define __NR_ioprio_get (__X32_SYSCALL_BIT + 252) #define __NR_inotify_init (__X32_SYSCALL_BIT + 253) #define __NR_inotify_add_watch (__X32_SYSCALL_BIT + 254) #define __NR_inotify_rm_watch (__X32_SYSCALL_BIT + 255) #define __NR_migrate_pages (__X32_SYSCALL_BIT + 256) #define __NR_openat (__X32_SYSCALL_BIT + 257) #define __NR_mkdirat (__X32_SYSCALL_BIT + 258) #define __NR_mknodat (__X32_SYSCALL_BIT + 259) #define __NR_fchownat (__X32_SYSCALL_BIT + 260) #define __NR_futimesat (__X32_SYSCALL_BIT + 261) #define __NR_newfstatat (__X32_SYSCALL_BIT + 262) #define __NR_unlinkat (__X32_SYSCALL_BIT + 263) #define __NR_renameat (__X32_SYSCALL_BIT + 264) #define __NR_linkat (__X32_SYSCALL_BIT + 265) #define __NR_symlinkat (__X32_SYSCALL_BIT + 266) #define __NR_readlinkat (__X32_SYSCALL_BIT + 267) #define __NR_fchmodat (__X32_SYSCALL_BIT + 268) #define __NR_faccessat (__X32_SYSCALL_BIT + 269) #define __NR_pselect6 (__X32_SYSCALL_BIT + 270) #define __NR_ppoll (__X32_SYSCALL_BIT + 271) #define __NR_unshare (__X32_SYSCALL_BIT + 272) #define __NR_splice (__X32_SYSCALL_BIT + 275) #define __NR_tee (__X32_SYSCALL_BIT + 276) #define __NR_sync_file_range (__X32_SYSCALL_BIT + 277) #define __NR_utimensat (__X32_SYSCALL_BIT + 280) #define __NR_epoll_pwait (__X32_SYSCALL_BIT + 281) #define __NR_signalfd (__X32_SYSCALL_BIT + 282) #define __NR_timerfd_create (__X32_SYSCALL_BIT + 283) #define __NR_eventfd (__X32_SYSCALL_BIT + 284) #define __NR_fallocate (__X32_SYSCALL_BIT + 285) #define __NR_timerfd_settime (__X32_SYSCALL_BIT + 286) #define __NR_timerfd_gettime (__X32_SYSCALL_BIT + 287) #define __NR_accept4 (__X32_SYSCALL_BIT + 288) #define __NR_signalfd4 (__X32_SYSCALL_BIT + 289) #define __NR_eventfd2 (__X32_SYSCALL_BIT + 290) #define __NR_epoll_create1 (__X32_SYSCALL_BIT + 291) #define __NR_dup3 (__X32_SYSCALL_BIT + 292) #define __NR_pipe2 (__X32_SYSCALL_BIT + 293) #define __NR_inotify_init1 (__X32_SYSCALL_BIT + 294) #define __NR_perf_event_open (__X32_SYSCALL_BIT + 298) #define __NR_fanotify_init (__X32_SYSCALL_BIT + 300) #define __NR_fanotify_mark (__X32_SYSCALL_BIT + 301) #define __NR_prlimit64 (__X32_SYSCALL_BIT + 302) #define __NR_name_to_handle_at (__X32_SYSCALL_BIT + 303) #define __NR_open_by_handle_at (__X32_SYSCALL_BIT + 304) #define __NR_clock_adjtime (__X32_SYSCALL_BIT + 305) #define __NR_syncfs (__X32_SYSCALL_BIT + 306) #define __NR_setns (__X32_SYSCALL_BIT + 308) #define __NR_getcpu (__X32_SYSCALL_BIT + 309) #define __NR_kcmp (__X32_SYSCALL_BIT + 312) #define __NR_finit_module (__X32_SYSCALL_BIT + 313) #define __NR_sched_setattr (__X32_SYSCALL_BIT + 314) #define __NR_sched_getattr (__X32_SYSCALL_BIT + 315) #define __NR_renameat2 (__X32_SYSCALL_BIT + 316) #define __NR_seccomp (__X32_SYSCALL_BIT + 317) #define __NR_getrandom (__X32_SYSCALL_BIT + 318) #define __NR_memfd_create (__X32_SYSCALL_BIT + 319) #define __NR_kexec_file_load (__X32_SYSCALL_BIT + 320) #define __NR_bpf (__X32_SYSCALL_BIT + 321) #define __NR_userfaultfd (__X32_SYSCALL_BIT + 323) #define __NR_membarrier (__X32_SYSCALL_BIT + 324) #define __NR_mlock2 (__X32_SYSCALL_BIT + 325) #define __NR_copy_file_range (__X32_SYSCALL_BIT + 326) #define __NR_pkey_mprotect (__X32_SYSCALL_BIT + 329) #define __NR_pkey_alloc (__X32_SYSCALL_BIT + 330) #define __NR_pkey_free (__X32_SYSCALL_BIT + 331) #define __NR_statx (__X32_SYSCALL_BIT + 332) #define __NR_io_pgetevents (__X32_SYSCALL_BIT + 333) #define __NR_rseq (__X32_SYSCALL_BIT + 334) #define __NR_rt_sigaction (__X32_SYSCALL_BIT + 512) #define __NR_rt_sigreturn (__X32_SYSCALL_BIT + 513) #define __NR_ioctl (__X32_SYSCALL_BIT + 514) #define __NR_readv (__X32_SYSCALL_BIT + 515) #define __NR_writev (__X32_SYSCALL_BIT + 516) #define __NR_recvfrom (__X32_SYSCALL_BIT + 517) #define __NR_sendmsg (__X32_SYSCALL_BIT + 518) #define __NR_recvmsg (__X32_SYSCALL_BIT + 519) #define __NR_execve (__X32_SYSCALL_BIT + 520) #define __NR_ptrace (__X32_SYSCALL_BIT + 521) #define __NR_rt_sigpending (__X32_SYSCALL_BIT + 522) #define __NR_rt_sigtimedwait (__X32_SYSCALL_BIT + 523) #define __NR_rt_sigqueueinfo (__X32_SYSCALL_BIT + 524) #define __NR_sigaltstack (__X32_SYSCALL_BIT + 525) #define __NR_timer_create (__X32_SYSCALL_BIT + 526) #define __NR_mq_notify (__X32_SYSCALL_BIT + 527) #define __NR_kexec_load (__X32_SYSCALL_BIT + 528) #define __NR_waitid (__X32_SYSCALL_BIT + 529) #define __NR_set_robust_list (__X32_SYSCALL_BIT + 530) #define __NR_get_robust_list (__X32_SYSCALL_BIT + 531) #define __NR_vmsplice (__X32_SYSCALL_BIT + 532) #define __NR_move_pages (__X32_SYSCALL_BIT + 533) #define __NR_preadv (__X32_SYSCALL_BIT + 534) #define __NR_pwritev (__X32_SYSCALL_BIT + 535) #define __NR_rt_tgsigqueueinfo (__X32_SYSCALL_BIT + 536) #define __NR_recvmmsg (__X32_SYSCALL_BIT + 537) #define __NR_sendmmsg (__X32_SYSCALL_BIT + 538) #define __NR_process_vm_readv (__X32_SYSCALL_BIT + 539) #define __NR_process_vm_writev (__X32_SYSCALL_BIT + 540) #define __NR_setsockopt (__X32_SYSCALL_BIT + 541) #define __NR_getsockopt (__X32_SYSCALL_BIT + 542) #define __NR_io_setup (__X32_SYSCALL_BIT + 543) #define __NR_io_submit (__X32_SYSCALL_BIT + 544) #define __NR_execveat (__X32_SYSCALL_BIT + 545) #define __NR_preadv2 (__X32_SYSCALL_BIT + 546) #define __NR_pwritev2 (__X32_SYSCALL_BIT + 547) #endif /* _ASM_X86_UNISTD_X32_H */ �������������������������������������������������������������������������������������������������������������tar.h�����������������������������������������������������������������������������������������������0000644�����������������00000007261�14763166027�0005525 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Extended tar format from POSIX.1. Copyright (C) 1992, 1996, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by David J. MacKenzie. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _TAR_H #define _TAR_H 1 #include <features.h> /* A tar archive consists of 512-byte blocks. Each file in the archive has a header block followed by 0+ data blocks. Two blocks of NUL bytes indicate the end of the archive. */ /* The fields of header blocks: All strings are stored as ISO 646 (approximately ASCII) strings. Fields are numeric unless otherwise noted below; numbers are ISO 646 representations of octal numbers, with leading zeros as needed. linkname is only valid when typeflag==LNKTYPE. It doesn't use prefix; files that are links to pathnames >100 chars long can not be stored in a tar archive. If typeflag=={LNKTYPE,SYMTYPE,DIRTYPE} then size must be 0. devmajor and devminor are only valid for typeflag=={BLKTYPE,CHRTYPE}. chksum contains the sum of all 512 bytes in the header block, treating each byte as an 8-bit unsigned value and treating the 8 bytes of chksum as blank characters. uname and gname are used in preference to uid and gid, if those names exist locally. Field Name Byte Offset Length in Bytes Field Type name 0 100 NUL-terminated if NUL fits mode 100 8 uid 108 8 gid 116 8 size 124 12 mtime 136 12 chksum 148 8 typeflag 156 1 see below linkname 157 100 NUL-terminated if NUL fits magic 257 6 must be TMAGIC (NUL term.) version 263 2 must be TVERSION uname 265 32 NUL-terminated gname 297 32 NUL-terminated devmajor 329 8 devminor 337 8 prefix 345 155 NUL-terminated if NUL fits If the first character of prefix is '\0', the file name is name; otherwise, it is prefix/name. Files whose pathnames don't fit in that length can not be stored in a tar archive. */ /* The bits in mode: */ #define TSUID 04000 #define TSGID 02000 #ifdef __USE_XOPEN # define TSVTX 01000 #endif #define TUREAD 00400 #define TUWRITE 00200 #define TUEXEC 00100 #define TGREAD 00040 #define TGWRITE 00020 #define TGEXEC 00010 #define TOREAD 00004 #define TOWRITE 00002 #define TOEXEC 00001 /* The values for typeflag: Values 'A'-'Z' are reserved for custom implementations. All other values are reserved for future POSIX.1 revisions. */ #define REGTYPE '0' /* Regular file (preferred code). */ #define AREGTYPE '\0' /* Regular file (alternate code). */ #define LNKTYPE '1' /* Hard link. */ #define SYMTYPE '2' /* Symbolic link (hard if not supported). */ #define CHRTYPE '3' /* Character special. */ #define BLKTYPE '4' /* Block special. */ #define DIRTYPE '5' /* Directory. */ #define FIFOTYPE '6' /* Named pipe. */ #define CONTTYPE '7' /* Contiguous file */ /* (regular file if not supported). */ /* Contents of magic field and its length. */ #define TMAGIC "ustar" #define TMAGLEN 6 /* Contents of the version field and its length. */ #define TVERSION "00" #define TVERSLEN 2 #endif /* tar.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������unistd.h��������������������������������������������������������������������������������������������0000644�����������������00000123434�14763166027�0006246 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-2009, 2010, 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 2.10 Symbolic Constants <unistd.h> */ #ifndef _UNISTD_H #define _UNISTD_H 1 #include <features.h> __BEGIN_DECLS /* These may be used to determine what facilities are present at compile time. Their values can be obtained at run time from `sysconf'. */ #ifdef __USE_XOPEN2K8 /* POSIX Standard approved as ISO/IEC 9945-1 as of September 2008. */ # define _POSIX_VERSION 200809L #elif defined __USE_XOPEN2K /* POSIX Standard approved as ISO/IEC 9945-1 as of December 2001. */ # define _POSIX_VERSION 200112L #elif defined __USE_POSIX199506 /* POSIX Standard approved as ISO/IEC 9945-1 as of June 1995. */ # define _POSIX_VERSION 199506L #elif defined __USE_POSIX199309 /* POSIX Standard approved as ISO/IEC 9945-1 as of September 1993. */ # define _POSIX_VERSION 199309L #else /* POSIX Standard approved as ISO/IEC 9945-1 as of September 1990. */ # define _POSIX_VERSION 199009L #endif /* These are not #ifdef __USE_POSIX2 because they are in the theoretically application-owned namespace. */ #ifdef __USE_XOPEN2K8 # define __POSIX2_THIS_VERSION 200809L /* The utilities on GNU systems also correspond to this version. */ #elif defined __USE_XOPEN2K /* The utilities on GNU systems also correspond to this version. */ # define __POSIX2_THIS_VERSION 200112L #elif defined __USE_POSIX199506 /* The utilities on GNU systems also correspond to this version. */ # define __POSIX2_THIS_VERSION 199506L #else /* The utilities on GNU systems also correspond to this version. */ # define __POSIX2_THIS_VERSION 199209L #endif /* The utilities on GNU systems also correspond to this version. */ #define _POSIX2_VERSION __POSIX2_THIS_VERSION /* If defined, the implementation supports the C Language Bindings Option. */ #define _POSIX2_C_BIND __POSIX2_THIS_VERSION /* If defined, the implementation supports the C Language Development Utilities Option. */ #define _POSIX2_C_DEV __POSIX2_THIS_VERSION /* If defined, the implementation supports the Software Development Utilities Option. */ #define _POSIX2_SW_DEV __POSIX2_THIS_VERSION /* If defined, the implementation supports the creation of locales with the localedef utility. */ #define _POSIX2_LOCALEDEF __POSIX2_THIS_VERSION /* X/Open version number to which the library conforms. It is selectable. */ #ifdef __USE_XOPEN2K8 # define _XOPEN_VERSION 700 #elif defined __USE_XOPEN2K # define _XOPEN_VERSION 600 #elif defined __USE_UNIX98 # define _XOPEN_VERSION 500 #else # define _XOPEN_VERSION 4 #endif /* Commands and utilities from XPG4 are available. */ #define _XOPEN_XCU_VERSION 4 /* We are compatible with the old published standards as well. */ #define _XOPEN_XPG2 1 #define _XOPEN_XPG3 1 #define _XOPEN_XPG4 1 /* The X/Open Unix extensions are available. */ #define _XOPEN_UNIX 1 /* Encryption is present. */ #define _XOPEN_CRYPT 1 /* The enhanced internationalization capabilities according to XPG4.2 are present. */ #define _XOPEN_ENH_I18N 1 /* The legacy interfaces are also available. */ #define _XOPEN_LEGACY 1 /* Get values of POSIX options: If these symbols are defined, the corresponding features are always available. If not, they may be available sometimes. The current values can be obtained with `sysconf'. _POSIX_JOB_CONTROL Job control is supported. _POSIX_SAVED_IDS Processes have a saved set-user-ID and a saved set-group-ID. _POSIX_REALTIME_SIGNALS Real-time, queued signals are supported. _POSIX_PRIORITY_SCHEDULING Priority scheduling is supported. _POSIX_TIMERS POSIX.4 clocks and timers are supported. _POSIX_ASYNCHRONOUS_IO Asynchronous I/O is supported. _POSIX_PRIORITIZED_IO Prioritized asynchronous I/O is supported. _POSIX_SYNCHRONIZED_IO Synchronizing file data is supported. _POSIX_FSYNC The fsync function is present. _POSIX_MAPPED_FILES Mapping of files to memory is supported. _POSIX_MEMLOCK Locking of all memory is supported. _POSIX_MEMLOCK_RANGE Locking of ranges of memory is supported. _POSIX_MEMORY_PROTECTION Setting of memory protections is supported. _POSIX_MESSAGE_PASSING POSIX.4 message queues are supported. _POSIX_SEMAPHORES POSIX.4 counting semaphores are supported. _POSIX_SHARED_MEMORY_OBJECTS POSIX.4 shared memory objects are supported. _POSIX_THREADS POSIX.1c pthreads are supported. _POSIX_THREAD_ATTR_STACKADDR Thread stack address attribute option supported. _POSIX_THREAD_ATTR_STACKSIZE Thread stack size attribute option supported. _POSIX_THREAD_SAFE_FUNCTIONS Thread-safe functions are supported. _POSIX_THREAD_PRIORITY_SCHEDULING POSIX.1c thread execution scheduling supported. _POSIX_THREAD_PRIO_INHERIT Thread priority inheritance option supported. _POSIX_THREAD_PRIO_PROTECT Thread priority protection option supported. _POSIX_THREAD_PROCESS_SHARED Process-shared synchronization supported. _POSIX_PII Protocol-independent interfaces are supported. _POSIX_PII_XTI XTI protocol-indep. interfaces are supported. _POSIX_PII_SOCKET Socket protocol-indep. interfaces are supported. _POSIX_PII_INTERNET Internet family of protocols supported. _POSIX_PII_INTERNET_STREAM Connection-mode Internet protocol supported. _POSIX_PII_INTERNET_DGRAM Connectionless Internet protocol supported. _POSIX_PII_OSI ISO/OSI family of protocols supported. _POSIX_PII_OSI_COTS Connection-mode ISO/OSI service supported. _POSIX_PII_OSI_CLTS Connectionless ISO/OSI service supported. _POSIX_POLL Implementation supports `poll' function. _POSIX_SELECT Implementation supports `select' and `pselect'. _XOPEN_REALTIME X/Open realtime support is available. _XOPEN_REALTIME_THREADS X/Open realtime thread support is available. _XOPEN_SHM Shared memory interface according to XPG4.2. _XBS5_ILP32_OFF32 Implementation provides environment with 32-bit int, long, pointer, and off_t types. _XBS5_ILP32_OFFBIG Implementation provides environment with 32-bit int, long, and pointer and off_t with at least 64 bits. _XBS5_LP64_OFF64 Implementation provides environment with 32-bit int, and 64-bit long, pointer, and off_t types. _XBS5_LPBIG_OFFBIG Implementation provides environment with at least 32 bits int and long, pointer, and off_t with at least 64 bits. If any of these symbols is defined as -1, the corresponding option is not true for any file. If any is defined as other than -1, the corresponding option is true for all files. If a symbol is not defined at all, the value for a specific file can be obtained from `pathconf' and `fpathconf'. _POSIX_CHOWN_RESTRICTED Only the super user can use `chown' to change the owner of a file. `chown' can only be used to change the group ID of a file to a group of which the calling process is a member. _POSIX_NO_TRUNC Pathname components longer than NAME_MAX generate an error. _POSIX_VDISABLE If defined, if the value of an element of the `c_cc' member of `struct termios' is _POSIX_VDISABLE, no character will have the effect associated with that element. _POSIX_SYNC_IO Synchronous I/O may be performed. _POSIX_ASYNC_IO Asynchronous I/O may be performed. _POSIX_PRIO_IO Prioritized Asynchronous I/O may be performed. Support for the Large File Support interface is not generally available. If it is available the following constants are defined to one. _LFS64_LARGEFILE Low-level I/O supports large files. _LFS64_STDIO Standard I/O supports large files. */ #include <bits/posix_opt.h> /* Get the environment definitions from Unix98. */ #if defined __USE_UNIX98 || defined __USE_XOPEN2K # include <bits/environments.h> #endif /* Standard file descriptors. */ #define STDIN_FILENO 0 /* Standard input. */ #define STDOUT_FILENO 1 /* Standard output. */ #define STDERR_FILENO 2 /* Standard error output. */ /* All functions that are not declared anywhere else. */ #include <bits/types.h> #ifndef __ssize_t_defined typedef __ssize_t ssize_t; # define __ssize_t_defined #endif #define __need_size_t #define __need_NULL #include <stddef.h> #if defined __USE_XOPEN || defined __USE_XOPEN2K /* The Single Unix specification says that some more types are available here. */ # ifndef __gid_t_defined typedef __gid_t gid_t; # define __gid_t_defined # endif # ifndef __uid_t_defined typedef __uid_t uid_t; # define __uid_t_defined # endif # ifndef __off_t_defined # ifndef __USE_FILE_OFFSET64 typedef __off_t off_t; # else typedef __off64_t off_t; # endif # define __off_t_defined # endif # if defined __USE_LARGEFILE64 && !defined __off64_t_defined typedef __off64_t off64_t; # define __off64_t_defined # endif # ifndef __useconds_t_defined typedef __useconds_t useconds_t; # define __useconds_t_defined # endif # ifndef __pid_t_defined typedef __pid_t pid_t; # define __pid_t_defined # endif #endif /* X/Open */ #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K # ifndef __intptr_t_defined typedef __intptr_t intptr_t; # define __intptr_t_defined # endif #endif #if defined __USE_BSD || defined __USE_XOPEN # ifndef __socklen_t_defined typedef __socklen_t socklen_t; # define __socklen_t_defined # endif #endif /* Values for the second argument to access. These may be OR'd together. */ #define R_OK 4 /* Test for read permission. */ #define W_OK 2 /* Test for write permission. */ #define X_OK 1 /* Test for execute permission. */ #define F_OK 0 /* Test for existence. */ /* Test for access to NAME using the real UID and real GID. */ extern int access (const char *__name, int __type) __THROW __nonnull ((1)); #ifdef __USE_GNU /* Test for access to NAME using the effective UID and GID (as normal file operations use). */ extern int euidaccess (const char *__name, int __type) __THROW __nonnull ((1)); /* An alias for `euidaccess', used by some other systems. */ extern int eaccess (const char *__name, int __type) __THROW __nonnull ((1)); #endif #ifdef __USE_ATFILE /* Test for access to FILE relative to the directory FD is open on. If AT_EACCESS is set in FLAG, then use effective IDs like `eaccess', otherwise use real IDs like `access'. */ extern int faccessat (int __fd, const char *__file, int __type, int __flag) __THROW __nonnull ((2)) __wur; #endif /* Use GNU. */ /* Values for the WHENCE argument to lseek. */ #ifndef _STDIO_H /* <stdio.h> has the same definitions. */ # define SEEK_SET 0 /* Seek from beginning of file. */ # define SEEK_CUR 1 /* Seek from current position. */ # define SEEK_END 2 /* Seek from end of file. */ # ifdef __USE_GNU # define SEEK_DATA 3 /* Seek to next data. */ # define SEEK_HOLE 4 /* Seek to next hole. */ # endif #endif #if defined __USE_BSD && !defined L_SET /* Old BSD names for the same constants; just for compatibility. */ # define L_SET SEEK_SET # define L_INCR SEEK_CUR # define L_XTND SEEK_END #endif /* Move FD's file position to OFFSET bytes from the beginning of the file (if WHENCE is SEEK_SET), the current position (if WHENCE is SEEK_CUR), or the end of the file (if WHENCE is SEEK_END). Return the new file position. */ #ifndef __USE_FILE_OFFSET64 extern __off_t lseek (int __fd, __off_t __offset, int __whence) __THROW; #else # ifdef __REDIRECT_NTH extern __off64_t __REDIRECT_NTH (lseek, (int __fd, __off64_t __offset, int __whence), lseek64); # else # define lseek lseek64 # endif #endif #ifdef __USE_LARGEFILE64 extern __off64_t lseek64 (int __fd, __off64_t __offset, int __whence) __THROW; #endif /* Close the file descriptor FD. This function is a cancellation point and therefore not marked with __THROW. */ extern int close (int __fd); /* Read NBYTES into BUF from FD. Return the number read, -1 for errors or 0 for EOF. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur; /* Write N bytes of BUF to FD. Return the number written, or -1. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t write (int __fd, const void *__buf, size_t __n) __wur; #if defined __USE_UNIX98 || defined __USE_XOPEN2K8 # ifndef __USE_FILE_OFFSET64 /* Read NBYTES into BUF from FD at the given position OFFSET without changing the file pointer. Return the number read, -1 for errors or 0 for EOF. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset) __wur; /* Write N bytes of BUF to FD at the given position OFFSET without changing the file pointer. Return the number written, or -1. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, __off_t __offset) __wur; # else # ifdef __REDIRECT extern ssize_t __REDIRECT (pread, (int __fd, void *__buf, size_t __nbytes, __off64_t __offset), pread64) __wur; extern ssize_t __REDIRECT (pwrite, (int __fd, const void *__buf, size_t __nbytes, __off64_t __offset), pwrite64) __wur; # else # define pread pread64 # define pwrite pwrite64 # endif # endif # ifdef __USE_LARGEFILE64 /* Read NBYTES into BUF from FD at the given position OFFSET without changing the file pointer. Return the number read, -1 for errors or 0 for EOF. */ extern ssize_t pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) __wur; /* Write N bytes of BUF to FD at the given position OFFSET without changing the file pointer. Return the number written, or -1. */ extern ssize_t pwrite64 (int __fd, const void *__buf, size_t __n, __off64_t __offset) __wur; # endif #endif /* Create a one-way communication channel (pipe). If successful, two file descriptors are stored in PIPEDES; bytes written on PIPEDES[1] can be read from PIPEDES[0]. Returns 0 if successful, -1 if not. */ extern int pipe (int __pipedes[2]) __THROW __wur; #ifdef __USE_GNU /* Same as pipe but apply flags passed in FLAGS to the new file descriptors. */ extern int pipe2 (int __pipedes[2], int __flags) __THROW __wur; #endif /* Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. If SECONDS is zero, any currently scheduled alarm will be cancelled. The function returns the number of seconds remaining until the last alarm scheduled would have signaled, or zero if there wasn't one. There is no return value to indicate an error, but you can set `errno' to 0 and check its value after calling `alarm', and this might tell you. The signal may come late due to processor scheduling. */ extern unsigned int alarm (unsigned int __seconds) __THROW; /* Make the process sleep for SECONDS seconds, or until a signal arrives and is not ignored. The function returns the number of seconds less than SECONDS which it actually slept (thus zero if it slept the full time). If a signal handler does a `longjmp' or modifies the handling of the SIGALRM signal while inside `sleep' call, the handling of the SIGALRM signal afterwards is undefined. There is no return value to indicate error, but if `sleep' returns SECONDS, it probably didn't work. This function is a cancellation point and therefore not marked with __THROW. */ extern unsigned int sleep (unsigned int __seconds); #if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \ || defined __USE_BSD /* Set an alarm to go off (generating a SIGALRM signal) in VALUE microseconds. If INTERVAL is nonzero, when the alarm goes off, the timer is reset to go off every INTERVAL microseconds thereafter. Returns the number of microseconds remaining before the alarm. */ extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) __THROW; /* Sleep USECONDS microseconds, or until a signal arrives that is not blocked or ignored. This function is a cancellation point and therefore not marked with __THROW. */ extern int usleep (__useconds_t __useconds); #endif /* Suspend the process until a signal arrives. This always returns -1 and sets `errno' to EINTR. This function is a cancellation point and therefore not marked with __THROW. */ extern int pause (void); /* Change the owner and group of FILE. */ extern int chown (const char *__file, __uid_t __owner, __gid_t __group) __THROW __nonnull ((1)) __wur; #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 /* Change the owner and group of the file that FD is open on. */ extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __THROW __wur; /* Change owner and group of FILE, if it is a symbolic link the ownership of the symbolic link is changed. */ extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) __THROW __nonnull ((1)) __wur; #endif /* Use BSD || X/Open Unix. */ #ifdef __USE_ATFILE /* Change the owner and group of FILE relative to the directory FD is open on. */ extern int fchownat (int __fd, const char *__file, __uid_t __owner, __gid_t __group, int __flag) __THROW __nonnull ((2)) __wur; #endif /* Use GNU. */ /* Change the process's working directory to PATH. */ extern int chdir (const char *__path) __THROW __nonnull ((1)) __wur; #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 /* Change the process's working directory to the one FD is open on. */ extern int fchdir (int __fd) __THROW __wur; #endif /* Get the pathname of the current working directory, and put it in SIZE bytes of BUF. Returns NULL if the directory couldn't be determined or SIZE was too small. If successful, returns BUF. In GNU, if BUF is NULL, an array is allocated with `malloc'; the array is SIZE bytes long, unless SIZE == 0, in which case it is as big as necessary. */ extern char *getcwd (char *__buf, size_t __size) __THROW __wur; #ifdef __USE_GNU /* Return a malloc'd string containing the current directory name. If the environment variable `PWD' is set, and its value is correct, that value is used. */ extern char *get_current_dir_name (void) __THROW; #endif #if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \ || defined __USE_BSD /* Put the absolute pathname of the current working directory in BUF. If successful, return BUF. If not, put an error message in BUF and return NULL. BUF should be at least PATH_MAX bytes long. */ extern char *getwd (char *__buf) __THROW __nonnull ((1)) __attribute_deprecated__ __wur; #endif /* Duplicate FD, returning a new file descriptor on the same file. */ extern int dup (int __fd) __THROW __wur; /* Duplicate FD to FD2, closing FD2 and making it open on the same file. */ extern int dup2 (int __fd, int __fd2) __THROW; #ifdef __USE_GNU /* Duplicate FD to FD2, closing FD2 and making it open on the same file while setting flags according to FLAGS. */ extern int dup3 (int __fd, int __fd2, int __flags) __THROW; #endif /* NULL-terminated array of "NAME=VALUE" environment variables. */ extern char **__environ; #ifdef __USE_GNU extern char **environ; #endif /* Replace the current process, executing PATH with arguments ARGV and environment ENVP. ARGV and ENVP are terminated by NULL pointers. */ extern int execve (const char *__path, char *const __argv[], char *const __envp[]) __THROW __nonnull ((1, 2)); #ifdef __USE_XOPEN2K8 /* Execute the file FD refers to, overlaying the running program image. ARGV and ENVP are passed to the new program, as for `execve'. */ extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) __THROW __nonnull ((2)); #endif /* Execute PATH with arguments ARGV and environment from `environ'. */ extern int execv (const char *__path, char *const __argv[]) __THROW __nonnull ((1, 2)); /* Execute PATH with all arguments after PATH until a NULL pointer, and the argument after that for environment. */ extern int execle (const char *__path, const char *__arg, ...) __THROW __nonnull ((1, 2)); /* Execute PATH with all arguments after PATH until a NULL pointer and environment from `environ'. */ extern int execl (const char *__path, const char *__arg, ...) __THROW __nonnull ((1, 2)); /* Execute FILE, searching in the `PATH' environment variable if it contains no slashes, with arguments ARGV and environment from `environ'. */ extern int execvp (const char *__file, char *const __argv[]) __THROW __nonnull ((1, 2)); /* Execute FILE, searching in the `PATH' environment variable if it contains no slashes, with all arguments after FILE until a NULL pointer and environment from `environ'. */ extern int execlp (const char *__file, const char *__arg, ...) __THROW __nonnull ((1, 2)); #ifdef __USE_GNU /* Execute FILE, searching in the `PATH' environment variable if it contains no slashes, with arguments ARGV and environment from `environ'. */ extern int execvpe (const char *__file, char *const __argv[], char *const __envp[]) __THROW __nonnull ((1, 2)); #endif #if defined __USE_MISC || defined __USE_XOPEN /* Add INC to priority of the current process. */ extern int nice (int __inc) __THROW __wur; #endif /* Terminate program execution with the low-order 8 bits of STATUS. */ extern void _exit (int __status) __attribute__ ((__noreturn__)); /* Get the `_PC_*' symbols for the NAME argument to `pathconf' and `fpathconf'; the `_SC_*' symbols for the NAME argument to `sysconf'; and the `_CS_*' symbols for the NAME argument to `confstr'. */ #include <bits/confname.h> /* Get file-specific configuration information about PATH. */ extern long int pathconf (const char *__path, int __name) __THROW __nonnull ((1)); /* Get file-specific configuration about descriptor FD. */ extern long int fpathconf (int __fd, int __name) __THROW; /* Get the value of the system variable NAME. */ extern long int sysconf (int __name) __THROW; #ifdef __USE_POSIX2 /* Get the value of the string-valued system variable NAME. */ extern size_t confstr (int __name, char *__buf, size_t __len) __THROW; #endif /* Get the process ID of the calling process. */ extern __pid_t getpid (void) __THROW; /* Get the process ID of the calling process's parent. */ extern __pid_t getppid (void) __THROW; /* Get the process group ID of the calling process. This function is different on old BSD. */ #ifndef __FAVOR_BSD extern __pid_t getpgrp (void) __THROW; #else # ifdef __REDIRECT_NTH extern __pid_t __REDIRECT_NTH (getpgrp, (__pid_t __pid), __getpgid); # else # define getpgrp __getpgid # endif #endif /* Get the process group ID of process PID. */ extern __pid_t __getpgid (__pid_t __pid) __THROW; #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 extern __pid_t getpgid (__pid_t __pid) __THROW; #endif /* Set the process group ID of the process matching PID to PGID. If PID is zero, the current process's process group ID is set. If PGID is zero, the process ID of the process is used. */ extern int setpgid (__pid_t __pid, __pid_t __pgid) __THROW; #if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Both System V and BSD have `setpgrp' functions, but with different calling conventions. The BSD function is the same as POSIX.1 `setpgid' (above). The System V function takes no arguments and puts the calling process in its on group like `setpgid (0, 0)'. New programs should always use `setpgid' instead. The default in GNU is to provide the System V function. The BSD function is available under -D_BSD_SOURCE. */ # ifndef __FAVOR_BSD /* Set the process group ID of the calling process to its own PID. This is exactly the same as `setpgid (0, 0)'. */ extern int setpgrp (void) __THROW; # else /* Another name for `setpgid' (above). */ # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (setpgrp, (__pid_t __pid, __pid_t __pgrp), setpgid); # else # define setpgrp setpgid # endif # endif /* Favor BSD. */ #endif /* Use SVID or BSD. */ /* Create a new session with the calling process as its leader. The process group IDs of the session and the calling process are set to the process ID of the calling process, which is returned. */ extern __pid_t setsid (void) __THROW; #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 /* Return the session ID of the given process. */ extern __pid_t getsid (__pid_t __pid) __THROW; #endif /* Get the real user ID of the calling process. */ extern __uid_t getuid (void) __THROW; /* Get the effective user ID of the calling process. */ extern __uid_t geteuid (void) __THROW; /* Get the real group ID of the calling process. */ extern __gid_t getgid (void) __THROW; /* Get the effective group ID of the calling process. */ extern __gid_t getegid (void) __THROW; /* If SIZE is zero, return the number of supplementary groups the calling process is in. Otherwise, fill in the group IDs of its supplementary groups in LIST and return the number written. */ extern int getgroups (int __size, __gid_t __list[]) __THROW __wur; #ifdef __USE_GNU /* Return nonzero iff the calling process is in group GID. */ extern int group_member (__gid_t __gid) __THROW; #endif /* Set the user ID of the calling process to UID. If the calling process is the super-user, set the real and effective user IDs, and the saved set-user-ID to UID; if not, the effective user ID is set to UID. */ extern int setuid (__uid_t __uid) __THROW __wur; #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Set the real user ID of the calling process to RUID, and the effective user ID of the calling process to EUID. */ extern int setreuid (__uid_t __ruid, __uid_t __euid) __THROW __wur; #endif #if defined __USE_BSD || defined __USE_XOPEN2K /* Set the effective user ID of the calling process to UID. */ extern int seteuid (__uid_t __uid) __THROW __wur; #endif /* Use BSD. */ /* Set the group ID of the calling process to GID. If the calling process is the super-user, set the real and effective group IDs, and the saved set-group-ID to GID; if not, the effective group ID is set to GID. */ extern int setgid (__gid_t __gid) __THROW __wur; #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Set the real group ID of the calling process to RGID, and the effective group ID of the calling process to EGID. */ extern int setregid (__gid_t __rgid, __gid_t __egid) __THROW __wur; #endif #if defined __USE_BSD || defined __USE_XOPEN2K /* Set the effective group ID of the calling process to GID. */ extern int setegid (__gid_t __gid) __THROW __wur; #endif /* Use BSD. */ #ifdef __USE_GNU /* Fetch the real user ID, effective user ID, and saved-set user ID, of the calling process. */ extern int getresuid (__uid_t *__ruid, __uid_t *__euid, __uid_t *__suid) __THROW; /* Fetch the real group ID, effective group ID, and saved-set group ID, of the calling process. */ extern int getresgid (__gid_t *__rgid, __gid_t *__egid, __gid_t *__sgid) __THROW; /* Set the real user ID, effective user ID, and saved-set user ID, of the calling process to RUID, EUID, and SUID, respectively. */ extern int setresuid (__uid_t __ruid, __uid_t __euid, __uid_t __suid) __THROW __wur; /* Set the real group ID, effective group ID, and saved-set group ID, of the calling process to RGID, EGID, and SGID, respectively. */ extern int setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid) __THROW __wur; #endif /* Clone the calling process, creating an exact copy. Return -1 for errors, 0 to the new process, and the process ID of the new process to the old process. */ extern __pid_t fork (void) __THROWNL; #if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \ || defined __USE_BSD /* Clone the calling process, but without copying the whole address space. The calling process is suspended until the new process exits or is replaced by a call to `execve'. Return -1 for errors, 0 to the new process, and the process ID of the new process to the old process. */ extern __pid_t vfork (void) __THROW; #endif /* Use BSD or XPG < 7. */ /* Return the pathname of the terminal FD is open on, or NULL on errors. The returned storage is good only until the next call to this function. */ extern char *ttyname (int __fd) __THROW; /* Store at most BUFLEN characters of the pathname of the terminal FD is open on in BUF. Return 0 on success, otherwise an error number. */ extern int ttyname_r (int __fd, char *__buf, size_t __buflen) __THROW __nonnull ((2)) __wur; /* Return 1 if FD is a valid descriptor associated with a terminal, zero if not. */ extern int isatty (int __fd) __THROW; #if defined __USE_BSD \ || (defined __USE_XOPEN_EXTENDED && !defined __USE_UNIX98) /* Return the index into the active-logins file (utmp) for the controlling terminal. */ extern int ttyslot (void) __THROW; #endif /* Make a link to FROM named TO. */ extern int link (const char *__from, const char *__to) __THROW __nonnull ((1, 2)) __wur; #ifdef __USE_ATFILE /* Like link but relative paths in TO and FROM are interpreted relative to FROMFD and TOFD respectively. */ extern int linkat (int __fromfd, const char *__from, int __tofd, const char *__to, int __flags) __THROW __nonnull ((2, 4)) __wur; #endif #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K /* Make a symbolic link to FROM named TO. */ extern int symlink (const char *__from, const char *__to) __THROW __nonnull ((1, 2)) __wur; /* Read the contents of the symbolic link PATH into no more than LEN bytes of BUF. The contents are not null-terminated. Returns the number of characters read, or -1 for errors. */ extern ssize_t readlink (const char *__restrict __path, char *__restrict __buf, size_t __len) __THROW __nonnull ((1, 2)) __wur; #endif /* Use BSD. */ #ifdef __USE_ATFILE /* Like symlink but a relative path in TO is interpreted relative to TOFD. */ extern int symlinkat (const char *__from, int __tofd, const char *__to) __THROW __nonnull ((1, 3)) __wur; /* Like readlink but a relative PATH is interpreted relative to FD. */ extern ssize_t readlinkat (int __fd, const char *__restrict __path, char *__restrict __buf, size_t __len) __THROW __nonnull ((2, 3)) __wur; #endif /* Remove the link NAME. */ extern int unlink (const char *__name) __THROW __nonnull ((1)); #ifdef __USE_ATFILE /* Remove the link NAME relative to FD. */ extern int unlinkat (int __fd, const char *__name, int __flag) __THROW __nonnull ((2)); #endif /* Remove the directory PATH. */ extern int rmdir (const char *__path) __THROW __nonnull ((1)); /* Return the foreground process group ID of FD. */ extern __pid_t tcgetpgrp (int __fd) __THROW; /* Set the foreground process group ID of FD set PGRP_ID. */ extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __THROW; /* Return the login name of the user. This function is a possible cancellation point and therefore not marked with __THROW. */ extern char *getlogin (void); #if defined __USE_REENTRANT || defined __USE_POSIX199506 /* Return at most NAME_LEN characters of the login name of the user in NAME. If it cannot be determined or some other error occurred, return the error code. Otherwise return 0. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int getlogin_r (char *__name, size_t __name_len) __nonnull ((1)); #endif #ifdef __USE_BSD /* Set the login name returned by `getlogin'. */ extern int setlogin (const char *__name) __THROW __nonnull ((1)); #endif #ifdef __USE_POSIX2 /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. */ # define __need_getopt # include <getopt.h> #endif #if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K /* Put the name of the current host in no more than LEN bytes of NAME. The result is null-terminated if LEN is large enough for the full name and the terminator. */ extern int gethostname (char *__name, size_t __len) __THROW __nonnull ((1)); #endif #if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98) /* Set the name of the current host to NAME, which is LEN bytes long. This call is restricted to the super-user. */ extern int sethostname (const char *__name, size_t __len) __THROW __nonnull ((1)) __wur; /* Set the current machine's Internet number to ID. This call is restricted to the super-user. */ extern int sethostid (long int __id) __THROW __wur; /* Get and set the NIS (aka YP) domain name, if any. Called just like `gethostname' and `sethostname'. The NIS domain name is usually the empty string when not using NIS. */ extern int getdomainname (char *__name, size_t __len) __THROW __nonnull ((1)) __wur; extern int setdomainname (const char *__name, size_t __len) __THROW __nonnull ((1)) __wur; /* Revoke access permissions to all processes currently communicating with the control terminal, and then send a SIGHUP signal to the process group of the control terminal. */ extern int vhangup (void) __THROW; /* Revoke the access of all descriptors currently open on FILE. */ extern int revoke (const char *__file) __THROW __nonnull ((1)) __wur; /* Enable statistical profiling, writing samples of the PC into at most SIZE bytes of SAMPLE_BUFFER; every processor clock tick while profiling is enabled, the system examines the user PC and increments SAMPLE_BUFFER[((PC - OFFSET) / 2) * SCALE / 65536]. If SCALE is zero, disable profiling. Returns zero on success, -1 on error. */ extern int profil (unsigned short int *__sample_buffer, size_t __size, size_t __offset, unsigned int __scale) __THROW __nonnull ((1)); /* Turn accounting on if NAME is an existing file. The system will then write a record for each process as it terminates, to this file. If NAME is NULL, turn accounting off. This call is restricted to the super-user. */ extern int acct (const char *__name) __THROW; /* Successive calls return the shells listed in `/etc/shells'. */ extern char *getusershell (void) __THROW; extern void endusershell (void) __THROW; /* Discard cached info. */ extern void setusershell (void) __THROW; /* Rewind and re-read the file. */ /* Put the program in the background, and dissociate from the controlling terminal. If NOCHDIR is zero, do `chdir ("/")'. If NOCLOSE is zero, redirects stdin, stdout, and stderr to /dev/null. */ extern int daemon (int __nochdir, int __noclose) __THROW __wur; #endif /* Use BSD || X/Open. */ #if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_XOPEN2K) /* Make PATH be the root directory (the starting point for absolute paths). This call is restricted to the super-user. */ extern int chroot (const char *__path) __THROW __nonnull ((1)) __wur; /* Prompt with PROMPT and read a string from the terminal without echoing. Uses /dev/tty if possible; otherwise stderr and stdin. */ extern char *getpass (const char *__prompt) __nonnull ((1)); #endif /* Use BSD || X/Open. */ /* Make all changes done to FD actually appear on disk. This function is a cancellation point and therefore not marked with __THROW. */ extern int fsync (int __fd); #ifdef __USE_GNU /* Make all changes done to all files on the file system associated with FD actually appear on disk. */ extern int syncfs (int __fd) __THROW; #endif #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Return identifier for the current host. */ extern long int gethostid (void); /* Make all changes done to all files actually appear on disk. */ extern void sync (void) __THROW; # if defined __USE_BSD || !defined __USE_XOPEN2K /* Return the number of bytes in a page. This is the system's page size, which is not necessarily the same as the hardware page size. */ extern int getpagesize (void) __THROW __attribute__ ((__const__)); /* Return the maximum number of file descriptors the current process could possibly have. */ extern int getdtablesize (void) __THROW; # endif #endif /* Use BSD || X/Open Unix. */ #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 /* Truncate FILE to LENGTH bytes. */ # ifndef __USE_FILE_OFFSET64 extern int truncate (const char *__file, __off_t __length) __THROW __nonnull ((1)) __wur; # else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (truncate, (const char *__file, __off64_t __length), truncate64) __nonnull ((1)) __wur; # else # define truncate truncate64 # endif # endif # ifdef __USE_LARGEFILE64 extern int truncate64 (const char *__file, __off64_t __length) __THROW __nonnull ((1)) __wur; # endif #endif /* Use BSD || X/Open Unix || POSIX 2008. */ #if defined __USE_BSD || defined __USE_POSIX199309 \ || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K /* Truncate the file FD is open on to LENGTH bytes. */ # ifndef __USE_FILE_OFFSET64 extern int ftruncate (int __fd, __off_t __length) __THROW __wur; # else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (ftruncate, (int __fd, __off64_t __length), ftruncate64) __wur; # else # define ftruncate ftruncate64 # endif # endif # ifdef __USE_LARGEFILE64 extern int ftruncate64 (int __fd, __off64_t __length) __THROW __wur; # endif #endif /* Use BSD || POSIX.1b || X/Open Unix || XPG6. */ #if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \ || defined __USE_MISC /* Set the end of accessible data space (aka "the break") to ADDR. Returns zero on success and -1 for errors (with errno set). */ extern int brk (void *__addr) __THROW __wur; /* Increase or decrease the end of accessible data space by DELTA bytes. If successful, returns the address the previous end of data space (i.e. the beginning of the new space, if DELTA > 0); returns (void *) -1 for errors (with errno set). */ extern void *sbrk (intptr_t __delta) __THROW; #endif #ifdef __USE_MISC /* Invoke `system call' number SYSNO, passing it the remaining arguments. This is completely system-dependent, and not often useful. In Unix, `syscall' sets `errno' for all errors and most calls return -1 for errors; in many systems you cannot pass arguments or get return values for all system calls (`pipe', `fork', and `getppid' typically among them). In Mach, all system calls take normal arguments and always return an error code (zero for success). */ extern long int syscall (long int __sysno, ...) __THROW; #endif /* Use misc. */ #if (defined __USE_MISC || defined __USE_XOPEN_EXTENDED) && !defined F_LOCK /* NOTE: These declarations also appear in <fcntl.h>; be sure to keep both files consistent. Some systems have them there and some here, and some software depends on the macros being defined without including both. */ /* `lockf' is a simpler interface to the locking facilities of `fcntl'. LEN is always relative to the current file position. The CMD argument is one of the following. This function is a cancellation point and therefore not marked with __THROW. */ # define F_ULOCK 0 /* Unlock a previously locked region. */ # define F_LOCK 1 /* Lock a region for exclusive use. */ # define F_TLOCK 2 /* Test and lock a region for exclusive use. */ # define F_TEST 3 /* Test a region for other processes locks. */ # ifndef __USE_FILE_OFFSET64 extern int lockf (int __fd, int __cmd, __off_t __len) __wur; # else # ifdef __REDIRECT extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64) __wur; # else # define lockf lockf64 # endif # endif # ifdef __USE_LARGEFILE64 extern int lockf64 (int __fd, int __cmd, __off64_t __len) __wur; # endif #endif /* Use misc and F_LOCK not already defined. */ #ifdef __USE_GNU /* Evaluate EXPRESSION, and repeat as long as it returns -1 with `errno' set to EINTR. */ # define TEMP_FAILURE_RETRY(expression) \ (__extension__ \ ({ long int __result; \ do __result = (long int) (expression); \ while (__result == -1L && errno == EINTR); \ __result; })) #endif #if defined __USE_POSIX199309 || defined __USE_UNIX98 /* Synchronize at least the data part of a file with the underlying media. */ extern int fdatasync (int __fildes); #endif /* Use POSIX199309 */ /* XPG4.2 specifies that prototypes for the encryption functions must be defined here. */ #ifdef __USE_XOPEN /* Encrypt at most 8 characters from KEY using salt to perturb DES. */ extern char *crypt (const char *__key, const char *__salt) __THROW __nonnull ((1, 2)); /* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt block in place. */ extern void encrypt (char *__block, int __edflag) __THROW __nonnull ((1)); /* Swab pairs bytes in the first N bytes of the area pointed to by FROM and copy the result to TO. The value of TO must not be in the range [FROM - N + 1, FROM - 1]. If N is odd the first byte in FROM is without partner. */ extern void swab (const void *__restrict __from, void *__restrict __to, ssize_t __n) __THROW __nonnull ((1, 2)); #endif /* The Single Unix specification demands this prototype to be here. It is also found in <stdio.h>. */ #if defined __USE_XOPEN && !defined __USE_XOPEN2K /* Return the name of the controlling terminal. */ extern char *ctermid (char *__s) __THROW; #endif /* Define some macros helping to catch buffer overflows. */ #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function # include <bits/unistd.h> #endif __END_DECLS #endif /* unistd.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ctype.h���������������������������������������������������������������������������������������������0000644�����������������00000027030�14763166027�0006057 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991,92,93,95,96,97,98,99,2001,2002,2004,2007-2009,2011,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 Standard 7.4: Character handling <ctype.h> */ #ifndef _CTYPE_H #define _CTYPE_H 1 #include <features.h> #include <bits/types.h> __BEGIN_DECLS #ifndef _ISbit /* These are all the characteristics of characters. If there get to be more than 16 distinct characteristics, many things must be changed that use `unsigned short int's. The characteristics are stored always in network byte order (big endian). We define the bit value interpretations here dependent on the machine's byte order. */ # include <endian.h> # if __BYTE_ORDER == __BIG_ENDIAN # define _ISbit(bit) (1 << (bit)) # else /* __BYTE_ORDER == __LITTLE_ENDIAN */ # define _ISbit(bit) ((bit) < 8 ? ((1 << (bit)) << 8) : ((1 << (bit)) >> 8)) # endif enum { _ISupper = _ISbit (0), /* UPPERCASE. */ _ISlower = _ISbit (1), /* lowercase. */ _ISalpha = _ISbit (2), /* Alphabetic. */ _ISdigit = _ISbit (3), /* Numeric. */ _ISxdigit = _ISbit (4), /* Hexadecimal numeric. */ _ISspace = _ISbit (5), /* Whitespace. */ _ISprint = _ISbit (6), /* Printing. */ _ISgraph = _ISbit (7), /* Graphical. */ _ISblank = _ISbit (8), /* Blank (usually SPC and TAB). */ _IScntrl = _ISbit (9), /* Control character. */ _ISpunct = _ISbit (10), /* Punctuation. */ _ISalnum = _ISbit (11) /* Alphanumeric. */ }; #endif /* ! _ISbit */ /* These are defined in ctype-info.c. The declarations here must match those in localeinfo.h. In the thread-specific locale model (see `uselocale' in <locale.h>) we cannot use global variables for these as was done in the past. Instead, the following accessor functions return the address of each variable, which is local to the current thread if multithreaded. These point into arrays of 384, so they can be indexed by any `unsigned char' value [0,255]; by EOF (-1); or by any `signed char' value [-128,-1). ISO C requires that the ctype functions work for `unsigned char' values and for EOF; we also support negative `signed char' values for broken old programs. The case conversion arrays are of `int's rather than `unsigned char's because tolower (EOF) must be EOF, which doesn't fit into an `unsigned char'. But today more important is that the arrays are also used for multi-byte character sets. */ extern const unsigned short int **__ctype_b_loc (void) __THROW __attribute__ ((__const__)); extern const __int32_t **__ctype_tolower_loc (void) __THROW __attribute__ ((__const__)); extern const __int32_t **__ctype_toupper_loc (void) __THROW __attribute__ ((__const__)); #ifndef __cplusplus # define __isctype(c, type) \ ((*__ctype_b_loc ())[(int) (c)] & (unsigned short int) type) #elif defined __USE_EXTERN_INLINES # define __isctype_f(type) \ __extern_inline int \ is##type (int __c) __THROW \ { \ return (*__ctype_b_loc ())[(int) (__c)] & (unsigned short int) _IS##type; \ } #endif #define __isascii(c) (((c) & ~0x7f) == 0) /* If C is a 7 bit value. */ #define __toascii(c) ((c) & 0x7f) /* Mask off high bits. */ #define __exctype(name) extern int name (int) __THROW __BEGIN_NAMESPACE_STD /* The following names are all functions: int isCHARACTERISTIC(int c); which return nonzero iff C has CHARACTERISTIC. For the meaning of the characteristic names, see the `enum' above. */ __exctype (isalnum); __exctype (isalpha); __exctype (iscntrl); __exctype (isdigit); __exctype (islower); __exctype (isgraph); __exctype (isprint); __exctype (ispunct); __exctype (isspace); __exctype (isupper); __exctype (isxdigit); /* Return the lowercase version of C. */ extern int tolower (int __c) __THROW; /* Return the uppercase version of C. */ extern int toupper (int __c) __THROW; __END_NAMESPACE_STD /* ISO C99 introduced one new function. */ #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 __exctype (isblank); __END_NAMESPACE_C99 #endif #ifdef __USE_GNU /* Test C for a set of character classes according to MASK. */ extern int isctype (int __c, int __mask) __THROW; #endif #if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN /* Return nonzero iff C is in the ASCII set (i.e., is no more than 7 bits wide). */ extern int isascii (int __c) __THROW; /* Return the part of C that is in the ASCII set (i.e., the low-order 7 bits of C). */ extern int toascii (int __c) __THROW; /* These are the same as `toupper' and `tolower' except that they do not check the argument for being in the range of a `char'. */ __exctype (_toupper); __exctype (_tolower); #endif /* Use SVID or use misc. */ /* This code is needed for the optimized mapping functions. */ #define __tobody(c, f, a, args) \ (__extension__ \ ({ int __res; \ if (sizeof (c) > 1) \ { \ if (__builtin_constant_p (c)) \ { \ int __c = (c); \ __res = __c < -128 || __c > 255 ? __c : (a)[__c]; \ } \ else \ __res = f args; \ } \ else \ __res = (a)[(int) (c)]; \ __res; })) #if !defined __NO_CTYPE # ifdef __isctype_f __isctype_f (alnum) __isctype_f (alpha) __isctype_f (cntrl) __isctype_f (digit) __isctype_f (lower) __isctype_f (graph) __isctype_f (print) __isctype_f (punct) __isctype_f (space) __isctype_f (upper) __isctype_f (xdigit) # ifdef __USE_ISOC99 __isctype_f (blank) # endif # elif defined __isctype # define isalnum(c) __isctype((c), _ISalnum) # define isalpha(c) __isctype((c), _ISalpha) # define iscntrl(c) __isctype((c), _IScntrl) # define isdigit(c) __isctype((c), _ISdigit) # define islower(c) __isctype((c), _ISlower) # define isgraph(c) __isctype((c), _ISgraph) # define isprint(c) __isctype((c), _ISprint) # define ispunct(c) __isctype((c), _ISpunct) # define isspace(c) __isctype((c), _ISspace) # define isupper(c) __isctype((c), _ISupper) # define isxdigit(c) __isctype((c), _ISxdigit) # ifdef __USE_ISOC99 # define isblank(c) __isctype((c), _ISblank) # endif # endif # ifdef __USE_EXTERN_INLINES __extern_inline int __NTH (tolower (int __c)) { return __c >= -128 && __c < 256 ? (*__ctype_tolower_loc ())[__c] : __c; } __extern_inline int __NTH (toupper (int __c)) { return __c >= -128 && __c < 256 ? (*__ctype_toupper_loc ())[__c] : __c; } # endif # if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus # define tolower(c) __tobody (c, tolower, *__ctype_tolower_loc (), (c)) # define toupper(c) __tobody (c, toupper, *__ctype_toupper_loc (), (c)) # endif /* Optimizing gcc */ # if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN # define isascii(c) __isascii (c) # define toascii(c) __toascii (c) # define _tolower(c) ((int) (*__ctype_tolower_loc ())[(int) (c)]) # define _toupper(c) ((int) (*__ctype_toupper_loc ())[(int) (c)]) # endif #endif /* Not __NO_CTYPE. */ #ifdef __USE_XOPEN2K8 /* The concept of one static locale per category is not very well thought out. Many applications will need to process its data using information from several different locales. Another application is the implementation of the internationalization handling in the upcoming ISO C++ standard library. To support this another set of the functions using locale data exist which have an additional argument. Attention: all these functions are *not* standardized in any form. This is a proof-of-concept implementation. */ /* Structure for reentrant locale using functions. This is an (almost) opaque type for the user level programs. */ # include <xlocale.h> /* These definitions are similar to the ones above but all functions take as an argument a handle for the locale which shall be used. */ # define __isctype_l(c, type, locale) \ ((locale)->__ctype_b[(int) (c)] & (unsigned short int) type) # define __exctype_l(name) \ extern int name (int, __locale_t) __THROW /* The following names are all functions: int isCHARACTERISTIC(int c, locale_t *locale); which return nonzero iff C has CHARACTERISTIC. For the meaning of the characteristic names, see the `enum' above. */ __exctype_l (isalnum_l); __exctype_l (isalpha_l); __exctype_l (iscntrl_l); __exctype_l (isdigit_l); __exctype_l (islower_l); __exctype_l (isgraph_l); __exctype_l (isprint_l); __exctype_l (ispunct_l); __exctype_l (isspace_l); __exctype_l (isupper_l); __exctype_l (isxdigit_l); __exctype_l (isblank_l); /* Return the lowercase version of C in locale L. */ extern int __tolower_l (int __c, __locale_t __l) __THROW; extern int tolower_l (int __c, __locale_t __l) __THROW; /* Return the uppercase version of C. */ extern int __toupper_l (int __c, __locale_t __l) __THROW; extern int toupper_l (int __c, __locale_t __l) __THROW; # if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus # define __tolower_l(c, locale) \ __tobody (c, __tolower_l, (locale)->__ctype_tolower, (c, locale)) # define __toupper_l(c, locale) \ __tobody (c, __toupper_l, (locale)->__ctype_toupper, (c, locale)) # define tolower_l(c, locale) __tolower_l ((c), (locale)) # define toupper_l(c, locale) __toupper_l ((c), (locale)) # endif /* Optimizing gcc */ # ifndef __NO_CTYPE # define __isalnum_l(c,l) __isctype_l((c), _ISalnum, (l)) # define __isalpha_l(c,l) __isctype_l((c), _ISalpha, (l)) # define __iscntrl_l(c,l) __isctype_l((c), _IScntrl, (l)) # define __isdigit_l(c,l) __isctype_l((c), _ISdigit, (l)) # define __islower_l(c,l) __isctype_l((c), _ISlower, (l)) # define __isgraph_l(c,l) __isctype_l((c), _ISgraph, (l)) # define __isprint_l(c,l) __isctype_l((c), _ISprint, (l)) # define __ispunct_l(c,l) __isctype_l((c), _ISpunct, (l)) # define __isspace_l(c,l) __isctype_l((c), _ISspace, (l)) # define __isupper_l(c,l) __isctype_l((c), _ISupper, (l)) # define __isxdigit_l(c,l) __isctype_l((c), _ISxdigit, (l)) # define __isblank_l(c,l) __isctype_l((c), _ISblank, (l)) # if defined __USE_SVID || defined __USE_MISC # define __isascii_l(c,l) ((l), __isascii (c)) # define __toascii_l(c,l) ((l), __toascii (c)) # endif # define isalnum_l(c,l) __isalnum_l ((c), (l)) # define isalpha_l(c,l) __isalpha_l ((c), (l)) # define iscntrl_l(c,l) __iscntrl_l ((c), (l)) # define isdigit_l(c,l) __isdigit_l ((c), (l)) # define islower_l(c,l) __islower_l ((c), (l)) # define isgraph_l(c,l) __isgraph_l ((c), (l)) # define isprint_l(c,l) __isprint_l ((c), (l)) # define ispunct_l(c,l) __ispunct_l ((c), (l)) # define isspace_l(c,l) __isspace_l ((c), (l)) # define isupper_l(c,l) __isupper_l ((c), (l)) # define isxdigit_l(c,l) __isxdigit_l ((c), (l)) # define isblank_l(c,l) __isblank_l ((c), (l)) # if defined __USE_SVID || defined __USE_MISC # define isascii_l(c,l) __isascii_l ((c), (l)) # define toascii_l(c,l) __toascii_l ((c), (l)) # endif # endif /* Not __NO_CTYPE. */ #endif /* Use POSIX 2008. */ __END_DECLS #endif /* ctype.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������_G_config.h�����������������������������������������������������������������������������������������0000644�����������������00000002407�14763166027�0006606 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* This file is needed by libio to define various configuration parameters. These are always the same in the GNU C library. */ #ifndef _G_config_h #define _G_config_h 1 /* Define types for libio in terms of the standard internal type names. */ #include <bits/types.h> #define __need_size_t #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T # define __need_wchar_t #endif #define __need_NULL #include <stddef.h> #define __need_mbstate_t #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T # define __need_wint_t #endif #include <wchar.h> typedef struct { __off_t __pos; __mbstate_t __state; } _G_fpos_t; typedef struct { __off64_t __pos; __mbstate_t __state; } _G_fpos64_t; #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T # include <gconv.h> typedef union { struct __gconv_info __cd; struct { struct __gconv_info __cd; struct __gconv_step_data __data; } __combined; } _G_iconv_t; #endif /* These library features are always available in the GNU C library. */ #define _G_va_list __gnuc_va_list #define _G_HAVE_MMAP 1 #define _G_HAVE_MREMAP 1 #define _G_IO_IO_FILE_VERSION 0x20001 /* This is defined by <bits/stat.h> if `st_blksize' exists. */ #define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE) #define _G_BUFSIZ 8192 #endif /* _G_config.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������e2p/e2p.h�������������������������������������������������������������������������������������������0000644�����������������00000005121�14763166027�0006104 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * e2p.h --- header file for the e2p library * * %Begin-Header% * This file may be redistributed under the terms of the GNU Library * General Public License, version 2. * %End-Header% */ #include <sys/types.h> /* Needed by dirent.h on netbsd */ #include <stdio.h> #include <dirent.h> #include <ext2fs/ext2_fs.h> #define E2P_FEATURE_COMPAT 0 #define E2P_FEATURE_INCOMPAT 1 #define E2P_FEATURE_RO_INCOMPAT 2 #define E2P_FEATURE_TYPE_MASK 0x03 #define E2P_FEATURE_NEGATE_FLAG 0x80 #define E2P_FS_FEATURE 0 #define E2P_JOURNAL_FEATURE 1 /* `options' for print_flags() */ #define PFOPT_LONG 1 /* Must be 1 for compatibility with `int long_format'. */ int fgetflags (const char * name, unsigned long * flags); int fgetversion (const char * name, unsigned long * version); int fsetflags (const char * name, unsigned long flags); int fsetversion (const char * name, unsigned long version); int getflags (int fd, unsigned long * flags); int getversion (int fd, unsigned long * version); int iterate_on_dir (const char * dir_name, int (*func) (const char *, struct dirent *, void *), void * private); void list_super(struct ext2_super_block * s); void list_super2(struct ext2_super_block * s, FILE *f); void print_fs_errors (FILE * f, unsigned short errors); void print_flags (FILE * f, unsigned long flags, unsigned options); void print_fs_state (FILE * f, unsigned short state); int setflags (int fd, unsigned long flags); int setversion (int fd, unsigned long version); const char *e2p_feature2string(int compat, unsigned int mask); const char *e2p_jrnl_feature2string(int compat, unsigned int mask); int e2p_string2feature(char *string, int *compat, unsigned int *mask); int e2p_jrnl_string2feature(char *string, int *compat_type, unsigned int *mask); int e2p_edit_feature(const char *str, __u32 *compat_array, __u32 *ok_array); int e2p_edit_feature2(const char *str, __u32 *compat_array, __u32 *ok_array, __u32 *clear_ok_array, int *type_err, unsigned int *mask_err); int e2p_is_null_uuid(void *uu); void e2p_uuid_to_str(void *uu, char *out); const char *e2p_uuid2str(void *uu); const char *e2p_hash2string(int num); int e2p_string2hash(char *string); const char *e2p_mntopt2string(unsigned int mask); int e2p_string2mntopt(char *string, unsigned int *mask); int e2p_edit_mntopts(const char *str, __u32 *mntopts, __u32 ok); unsigned long parse_num_blocks(const char *arg, int log_block_size); unsigned long long parse_num_blocks2(const char *arg, int log_block_size); char *e2p_os2string(int os_type); int e2p_string2os(char *str); unsigned int e2p_percent(int percent, unsigned int base); �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sysexits.h������������������������������������������������������������������������������������������0000644�����������������00000012160�14763166027�0006624 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 1987, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)sysexits.h 8.1 (Berkeley) 6/2/93 */ #ifndef _SYSEXITS_H #define _SYSEXITS_H 1 /* * SYSEXITS.H -- Exit status codes for system programs. * * This include file attempts to categorize possible error * exit statuses for system programs, notably delivermail * and the Berkeley network. * * Error numbers begin at EX__BASE to reduce the possibility of * clashing with other exit statuses that random programs may * already return. The meaning of the codes is approximately * as follows: * * EX_USAGE -- The command was used incorrectly, e.g., with * the wrong number of arguments, a bad flag, a bad * syntax in a parameter, or whatever. * EX_DATAERR -- The input data was incorrect in some way. * This should only be used for user's data & not * system files. * EX_NOINPUT -- An input file (not a system file) did not * exist or was not readable. This could also include * errors like "No message" to a mailer (if it cared * to catch it). * EX_NOUSER -- The user specified did not exist. This might * be used for mail addresses or remote logins. * EX_NOHOST -- The host specified did not exist. This is used * in mail addresses or network requests. * EX_UNAVAILABLE -- A service is unavailable. This can occur * if a support program or file does not exist. This * can also be used as a catchall message when something * you wanted to do doesn't work, but you don't know * why. * EX_SOFTWARE -- An internal software error has been detected. * This should be limited to non-operating system related * errors as possible. * EX_OSERR -- An operating system error has been detected. * This is intended to be used for such things as "cannot * fork", "cannot create pipe", or the like. It includes * things like getuid returning a user that does not * exist in the passwd file. * EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp, * etc.) does not exist, cannot be opened, or has some * sort of error (e.g., syntax error). * EX_CANTCREAT -- A (user specified) output file cannot be * created. * EX_IOERR -- An error occurred while doing I/O on some file. * EX_TEMPFAIL -- temporary failure, indicating something that * is not really an error. In sendmail, this means * that a mailer (e.g.) could not create a connection, * and the request should be reattempted later. * EX_PROTOCOL -- the remote system returned something that * was "not possible" during a protocol exchange. * EX_NOPERM -- You did not have sufficient permission to * perform the operation. This is not intended for * file system problems, which should use NOINPUT or * CANTCREAT, but rather for higher level permissions. */ #define EX_OK 0 /* successful termination */ #define EX__BASE 64 /* base value for error messages */ #define EX_USAGE 64 /* command line usage error */ #define EX_DATAERR 65 /* data format error */ #define EX_NOINPUT 66 /* cannot open input */ #define EX_NOUSER 67 /* addressee unknown */ #define EX_NOHOST 68 /* host name unknown */ #define EX_UNAVAILABLE 69 /* service unavailable */ #define EX_SOFTWARE 70 /* internal software error */ #define EX_OSERR 71 /* system error (e.g., can't fork) */ #define EX_OSFILE 72 /* critical OS file missing */ #define EX_CANTCREAT 73 /* can't create (user) output file */ #define EX_IOERR 74 /* input/output error */ #define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */ #define EX_PROTOCOL 76 /* remote error in protocol */ #define EX_NOPERM 77 /* permission denied */ #define EX_CONFIG 78 /* configuration error */ #define EX__MAX 78 /* maximum listed value */ #endif /* sysexits.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gdfonts.h�������������������������������������������������������������������������������������������0000644�����������������00000001111�14763166027�0006367 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifdef __cplusplus extern "C" { #endif #ifndef _GDFONTS_H_ #define _GDFONTS_H_ 1 #ifdef __cplusplus extern "C" { #endif /* This is a header file for gd font, generated using bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz from bdf font -misc-fixed-medium-r-semicondensed-sans-12-116-75-75-c-60-iso8859-2 at Thu Jan 8 14:13:20 1998. No copyright info was found in the original bdf. */ #include "gd.h" BGD_EXPORT_DATA_PROT gdFontPtr gdFontSmall; BGD_DECLARE(gdFontPtr) gdFontGetSmall(void); #ifdef __cplusplus } #endif #endif #ifdef __cplusplus } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ftw.h�����������������������������������������������������������������������������������������������0000644�����������������00000012226�14763166027�0005534 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1992,1996-1999,2003,2004,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * X/Open Portability Guide 4.2: ftw.h */ #ifndef _FTW_H #define _FTW_H 1 #include <features.h> #include <sys/types.h> #include <sys/stat.h> __BEGIN_DECLS /* Values for the FLAG argument to the user function passed to `ftw' and 'nftw'. */ enum { FTW_F, /* Regular file. */ #define FTW_F FTW_F FTW_D, /* Directory. */ #define FTW_D FTW_D FTW_DNR, /* Unreadable directory. */ #define FTW_DNR FTW_DNR FTW_NS, /* Unstatable file. */ #define FTW_NS FTW_NS #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED FTW_SL, /* Symbolic link. */ # define FTW_SL FTW_SL #endif #ifdef __USE_XOPEN_EXTENDED /* These flags are only passed from the `nftw' function. */ FTW_DP, /* Directory, all subdirs have been visited. */ # define FTW_DP FTW_DP FTW_SLN /* Symbolic link naming non-existing file. */ # define FTW_SLN FTW_SLN #endif /* extended X/Open */ }; #ifdef __USE_XOPEN_EXTENDED /* Flags for fourth argument of `nftw'. */ enum { FTW_PHYS = 1, /* Perform physical walk, ignore symlinks. */ # define FTW_PHYS FTW_PHYS FTW_MOUNT = 2, /* Report only files on same file system as the argument. */ # define FTW_MOUNT FTW_MOUNT FTW_CHDIR = 4, /* Change to current directory while processing it. */ # define FTW_CHDIR FTW_CHDIR FTW_DEPTH = 8 /* Report files in directory before directory itself.*/ # define FTW_DEPTH FTW_DEPTH # ifdef __USE_GNU , FTW_ACTIONRETVAL = 16 /* Assume callback to return FTW_* values instead of zero to continue and non-zero to terminate. */ # define FTW_ACTIONRETVAL FTW_ACTIONRETVAL # endif }; #ifdef __USE_GNU /* Return values from callback functions. */ enum { FTW_CONTINUE = 0, /* Continue with next sibling or for FTW_D with the first child. */ # define FTW_CONTINUE FTW_CONTINUE FTW_STOP = 1, /* Return from `ftw' or `nftw' with FTW_STOP as return value. */ # define FTW_STOP FTW_STOP FTW_SKIP_SUBTREE = 2, /* Only meaningful for FTW_D: Don't walk through the subtree, instead just continue with its next sibling. */ # define FTW_SKIP_SUBTREE FTW_SKIP_SUBTREE FTW_SKIP_SIBLINGS = 3,/* Continue with FTW_DP callback for current directory (if FTW_DEPTH) and then its siblings. */ # define FTW_SKIP_SIBLINGS FTW_SKIP_SIBLINGS }; #endif /* Structure used for fourth argument to callback function for `nftw'. */ struct FTW { int base; int level; }; #endif /* extended X/Open */ /* Convenient types for callback functions. */ typedef int (*__ftw_func_t) (const char *__filename, const struct stat *__status, int __flag); #ifdef __USE_LARGEFILE64 typedef int (*__ftw64_func_t) (const char *__filename, const struct stat64 *__status, int __flag); #endif #ifdef __USE_XOPEN_EXTENDED typedef int (*__nftw_func_t) (const char *__filename, const struct stat *__status, int __flag, struct FTW *__info); # ifdef __USE_LARGEFILE64 typedef int (*__nftw64_func_t) (const char *__filename, const struct stat64 *__status, int __flag, struct FTW *__info); # endif #endif /* Call a function on every element in a directory tree. This function is a possible cancellation point and therefore not marked with __THROW. */ #ifndef __USE_FILE_OFFSET64 extern int ftw (const char *__dir, __ftw_func_t __func, int __descriptors) __nonnull ((1, 2)); #else # ifdef __REDIRECT extern int __REDIRECT (ftw, (const char *__dir, __ftw_func_t __func, int __descriptors), ftw64) __nonnull ((1, 2)); # else # define ftw ftw64 # endif #endif #ifdef __USE_LARGEFILE64 extern int ftw64 (const char *__dir, __ftw64_func_t __func, int __descriptors) __nonnull ((1, 2)); #endif #ifdef __USE_XOPEN_EXTENDED /* Call a function on every element in a directory tree. FLAG allows to specify the behaviour more detailed. This function is a possible cancellation point and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int nftw (const char *__dir, __nftw_func_t __func, int __descriptors, int __flag) __nonnull ((1, 2)); # else # ifdef __REDIRECT extern int __REDIRECT (nftw, (const char *__dir, __nftw_func_t __func, int __descriptors, int __flag), nftw64) __nonnull ((1, 2)); # else # define nftw nftw64 # endif # endif # ifdef __USE_LARGEFILE64 extern int nftw64 (const char *__dir, __nftw64_func_t __func, int __descriptors, int __flag) __nonnull ((1, 2)); # endif #endif __END_DECLS #endif /* ftw.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netatalk/at.h���������������������������������������������������������������������������������������0000644�����������������00000002046�14763166027�0007142 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991, 1992, 1993, 1995, 1996, 1997, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _NETATALK_AT_H #define _NETATALK_AT_H 1 #include <asm/types.h> #include <bits/sockaddr.h> #include <linux/atalk.h> #include <sys/socket.h> #define SOL_ATALK 258 /* sockopt level for atalk */ #endif /* netatalk/at.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������regex.h���������������������������������������������������������������������������������������������0000644�����������������00000053120�14763166027�0006044 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Definitions for data structures and routines for the regular expression library. Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003,2005,2006,2008,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _REGEX_H #define _REGEX_H 1 #include <sys/types.h> /* Allow the use in C++ code. */ #ifdef __cplusplus extern "C" { #endif /* The following two types have to be signed and unsigned integer type wide enough to hold a value of a pointer. For most ANSI compilers ptrdiff_t and size_t should be likely OK. Still size of these two types is 2 for Microsoft C. Ugh... */ typedef long int s_reg_t; typedef unsigned long int active_reg_t; /* The following bits are used to determine the regexp syntax we recognize. The set/not-set meanings are chosen so that Emacs syntax remains the value 0. The bits are given in alphabetical order, and the definitions shifted by one from the previous bit; thus, when we add or remove a bit, only one other definition need change. */ typedef unsigned long int reg_syntax_t; #ifdef __USE_GNU /* If this bit is not set, then \ inside a bracket expression is literal. If set, then such a \ quotes the following character. */ # define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1) /* If this bit is not set, then + and ? are operators, and \+ and \? are literals. If set, then \+ and \? are operators and + and ? are literals. */ # define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1) /* If this bit is set, then character classes are supported. They are: [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:], [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:]. If not set, then character classes are not supported. */ # define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1) /* If this bit is set, then ^ and $ are always anchors (outside bracket expressions, of course). If this bit is not set, then it depends: ^ is an anchor if it is at the beginning of a regular expression or after an open-group or an alternation operator; $ is an anchor if it is at the end of a regular expression, or before a close-group or an alternation operator. This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because POSIX draft 11.2 says that * etc. in leading positions is undefined. We already implemented a previous draft which made those constructs invalid, though, so we haven't changed the code back. */ # define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1) /* If this bit is set, then special characters are always special regardless of where they are in the pattern. If this bit is not set, then special characters are special only in some contexts; otherwise they are ordinary. Specifically, * + ? and intervals are only special when not after the beginning, open-group, or alternation operator. */ # define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1) /* If this bit is set, then *, +, ?, and { cannot be first in an re or immediately after an alternation or begin-group operator. */ # define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1) /* If this bit is set, then . matches newline. If not set, then it doesn't. */ # define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1) /* If this bit is set, then . doesn't match NUL. If not set, then it does. */ # define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1) /* If this bit is set, nonmatching lists [^...] do not match newline. If not set, they do. */ # define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1) /* If this bit is set, either \{...\} or {...} defines an interval, depending on RE_NO_BK_BRACES. If not set, \{, \}, {, and } are literals. */ # define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1) /* If this bit is set, +, ? and | aren't recognized as operators. If not set, they are. */ # define RE_LIMITED_OPS (RE_INTERVALS << 1) /* If this bit is set, newline is an alternation operator. If not set, newline is literal. */ # define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1) /* If this bit is set, then `{...}' defines an interval, and \{ and \} are literals. If not set, then `\{...\}' defines an interval. */ # define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1) /* If this bit is set, (...) defines a group, and \( and \) are literals. If not set, \(...\) defines a group, and ( and ) are literals. */ # define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1) /* If this bit is set, then \<digit> matches <digit>. If not set, then \<digit> is a back-reference. */ # define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1) /* If this bit is set, then | is an alternation operator, and \| is literal. If not set, then \| is an alternation operator, and | is literal. */ # define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1) /* If this bit is set, then an ending range point collating higher than the starting range point, as in [z-a], is invalid. If not set, then when ending range point collates higher than the starting range point, the range is ignored. */ # define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1) /* If this bit is set, then an unmatched ) is ordinary. If not set, then an unmatched ) is invalid. */ # define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1) /* If this bit is set, succeed as soon as we match the whole pattern, without further backtracking. */ # define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1) /* If this bit is set, do not process the GNU regex operators. If not set, then the GNU regex operators are recognized. */ # define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1) /* If this bit is set, turn on internal regex debugging. If not set, and debugging was on, turn it off. This only works if regex.c is compiled -DDEBUG. We define this bit always, so that all that's needed to turn on debugging is to recompile regex.c; the calling code can always have this bit set, and it won't affect anything in the normal case. */ # define RE_DEBUG (RE_NO_GNU_OPS << 1) /* If this bit is set, a syntactically invalid interval is treated as a string of ordinary characters. For example, the ERE 'a{1' is treated as 'a\{1'. */ # define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1) /* If this bit is set, then ignore case when matching. If not set, then case is significant. */ # define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1) /* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only for ^, because it is difficult to scan the regex backwards to find whether ^ should be special. */ # define RE_CARET_ANCHORS_HERE (RE_ICASE << 1) /* If this bit is set, then \{ cannot be first in an bre or immediately after an alternation or begin-group operator. */ # define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1) /* If this bit is set, then no_sub will be set to 1 during re_compile_pattern. */ # define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1) #endif /* This global variable defines the particular regexp syntax to use (for some interfaces). When a regexp is compiled, the syntax used is stored in the pattern buffer, so changing this does not affect already-compiled regexps. */ extern reg_syntax_t re_syntax_options; #ifdef __USE_GNU /* Define combinations of the above bits for the standard possibilities. (The [[[ comments delimit what gets put into the Texinfo file, so don't delete them!) */ /* [[[begin syntaxes]]] */ #define RE_SYNTAX_EMACS 0 #define RE_SYNTAX_AWK \ (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \ | RE_NO_BK_PARENS | RE_NO_BK_REFS \ | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \ | RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \ | RE_CHAR_CLASSES \ | RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS) #define RE_SYNTAX_GNU_AWK \ ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \ | RE_INVALID_INTERVAL_ORD) \ & ~(RE_DOT_NOT_NULL | RE_CONTEXT_INDEP_OPS \ | RE_CONTEXT_INVALID_OPS )) #define RE_SYNTAX_POSIX_AWK \ (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \ | RE_INTERVALS | RE_NO_GNU_OPS \ | RE_INVALID_INTERVAL_ORD) #define RE_SYNTAX_GREP \ (RE_BK_PLUS_QM | RE_CHAR_CLASSES \ | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \ | RE_NEWLINE_ALT) #define RE_SYNTAX_EGREP \ (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \ | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \ | RE_NEWLINE_ALT | RE_NO_BK_PARENS \ | RE_NO_BK_VBAR) #define RE_SYNTAX_POSIX_EGREP \ (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES \ | RE_INVALID_INTERVAL_ORD) /* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */ #define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC #define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC /* Syntax bits common to both basic and extended POSIX regex syntax. */ #define _RE_SYNTAX_POSIX_COMMON \ (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \ | RE_INTERVALS | RE_NO_EMPTY_RANGES) #define RE_SYNTAX_POSIX_BASIC \ (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP) /* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this isn't minimal, since other operators, such as \`, aren't disabled. */ #define RE_SYNTAX_POSIX_MINIMAL_BASIC \ (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS) #define RE_SYNTAX_POSIX_EXTENDED \ (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \ | RE_NO_BK_PARENS | RE_NO_BK_VBAR \ | RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD) /* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INDEP_OPS is removed and RE_NO_BK_REFS is added. */ #define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \ (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \ | RE_NO_BK_PARENS | RE_NO_BK_REFS \ | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD) /* [[[end syntaxes]]] */ /* Maximum number of duplicates an interval can allow. Some systems (erroneously) define this in other header files, but we want our value, so remove any previous define. */ # ifdef RE_DUP_MAX # undef RE_DUP_MAX # endif /* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */ # define RE_DUP_MAX (0x7fff) #endif /* POSIX `cflags' bits (i.e., information for `regcomp'). */ /* If this bit is set, then use extended regular expression syntax. If not set, then use basic regular expression syntax. */ #define REG_EXTENDED 1 /* If this bit is set, then ignore case when matching. If not set, then case is significant. */ #define REG_ICASE (REG_EXTENDED << 1) /* If this bit is set, then anchors do not match at newline characters in the string. If not set, then anchors do match at newlines. */ #define REG_NEWLINE (REG_ICASE << 1) /* If this bit is set, then report only success or fail in regexec. If not set, then returns differ between not matching and errors. */ #define REG_NOSUB (REG_NEWLINE << 1) /* POSIX `eflags' bits (i.e., information for regexec). */ /* If this bit is set, then the beginning-of-line operator doesn't match the beginning of the string (presumably because it's not the beginning of a line). If not set, then the beginning-of-line operator does match the beginning of the string. */ #define REG_NOTBOL 1 /* Like REG_NOTBOL, except for the end-of-line. */ #define REG_NOTEOL (1 << 1) /* Use PMATCH[0] to delimit the start and end of the search in the buffer. */ #define REG_STARTEND (1 << 2) /* If any error codes are removed, changed, or added, update the `re_error_msg' table in regex.c. */ typedef enum { #if defined _XOPEN_SOURCE || defined __USE_XOPEN2K REG_ENOSYS = -1, /* This will never happen for this implementation. */ #endif REG_NOERROR = 0, /* Success. */ REG_NOMATCH, /* Didn't find a match (for regexec). */ /* POSIX regcomp return error codes. (In the order listed in the standard.) */ REG_BADPAT, /* Invalid pattern. */ REG_ECOLLATE, /* Inalid collating element. */ REG_ECTYPE, /* Invalid character class name. */ REG_EESCAPE, /* Trailing backslash. */ REG_ESUBREG, /* Invalid back reference. */ REG_EBRACK, /* Unmatched left bracket. */ REG_EPAREN, /* Parenthesis imbalance. */ REG_EBRACE, /* Unmatched \{. */ REG_BADBR, /* Invalid contents of \{\}. */ REG_ERANGE, /* Invalid range end. */ REG_ESPACE, /* Ran out of memory. */ REG_BADRPT, /* No preceding re for repetition op. */ /* Error codes we've added. */ REG_EEND, /* Premature end. */ REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */ REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */ } reg_errcode_t; /* This data structure represents a compiled pattern. Before calling the pattern compiler, the fields `buffer', `allocated', `fastmap', and `translate' can be set. After the pattern has been compiled, the fields `re_nsub', `not_bol' and `not_eol' are available. All other fields are private to the regex routines. */ #ifndef RE_TRANSLATE_TYPE # define __RE_TRANSLATE_TYPE unsigned char * # ifdef __USE_GNU # define RE_TRANSLATE_TYPE __RE_TRANSLATE_TYPE # endif #endif #ifdef __USE_GNU # define __REPB_PREFIX(name) name #else # define __REPB_PREFIX(name) __##name #endif struct re_pattern_buffer { /* Space that holds the compiled pattern. It is declared as `unsigned char *' because its elements are sometimes used as array indexes. */ unsigned char *__REPB_PREFIX(buffer); /* Number of bytes to which `buffer' points. */ unsigned long int __REPB_PREFIX(allocated); /* Number of bytes actually used in `buffer'. */ unsigned long int __REPB_PREFIX(used); /* Syntax setting with which the pattern was compiled. */ reg_syntax_t __REPB_PREFIX(syntax); /* Pointer to a fastmap, if any, otherwise zero. re_search uses the fastmap, if there is one, to skip over impossible starting points for matches. */ char *__REPB_PREFIX(fastmap); /* Either a translate table to apply to all characters before comparing them, or zero for no translation. The translation is applied to a pattern when it is compiled and to a string when it is matched. */ __RE_TRANSLATE_TYPE __REPB_PREFIX(translate); /* Number of subexpressions found by the compiler. */ size_t re_nsub; /* Zero if this pattern cannot match the empty string, one else. Well, in truth it's used only in `re_search_2', to see whether or not we should use the fastmap, so we don't set this absolutely perfectly; see `re_compile_fastmap' (the `duplicate' case). */ unsigned __REPB_PREFIX(can_be_null) : 1; /* If REGS_UNALLOCATED, allocate space in the `regs' structure for `max (RE_NREGS, re_nsub + 1)' groups. If REGS_REALLOCATE, reallocate space if necessary. If REGS_FIXED, use what's there. */ #ifdef __USE_GNU # define REGS_UNALLOCATED 0 # define REGS_REALLOCATE 1 # define REGS_FIXED 2 #endif unsigned __REPB_PREFIX(regs_allocated) : 2; /* Set to zero when `regex_compile' compiles a pattern; set to one by `re_compile_fastmap' if it updates the fastmap. */ unsigned __REPB_PREFIX(fastmap_accurate) : 1; /* If set, `re_match_2' does not return information about subexpressions. */ unsigned __REPB_PREFIX(no_sub) : 1; /* If set, a beginning-of-line anchor doesn't match at the beginning of the string. */ unsigned __REPB_PREFIX(not_bol) : 1; /* Similarly for an end-of-line anchor. */ unsigned __REPB_PREFIX(not_eol) : 1; /* If true, an anchor at a newline matches. */ unsigned __REPB_PREFIX(newline_anchor) : 1; }; typedef struct re_pattern_buffer regex_t; /* Type for byte offsets within the string. POSIX mandates this. */ typedef int regoff_t; #ifdef __USE_GNU /* This is the structure we store register match data in. See regex.texinfo for a full description of what registers match. */ struct re_registers { unsigned num_regs; regoff_t *start; regoff_t *end; }; /* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer, `re_match_2' returns information about at least this many registers the first time a `regs' structure is passed. */ # ifndef RE_NREGS # define RE_NREGS 30 # endif #endif /* POSIX specification for registers. Aside from the different names than `re_registers', POSIX uses an array of structures, instead of a structure of arrays. */ typedef struct { regoff_t rm_so; /* Byte offset from string's start to substring's start. */ regoff_t rm_eo; /* Byte offset from string's start to substring's end. */ } regmatch_t; /* Declarations for routines. */ #ifdef __USE_GNU /* Sets the current default syntax to SYNTAX, and return the old syntax. You can also simply assign to the `re_syntax_options' variable. */ extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax); /* Compile the regular expression PATTERN, with length LENGTH and syntax given by the global `re_syntax_options', into the buffer BUFFER. Return NULL if successful, and an error string if not. To free the allocated storage, you must call `regfree' on BUFFER. Note that the translate table must either have been initialised by `regcomp', with a malloc'ed value, or set to NULL before calling `regfree'. */ extern const char *re_compile_pattern (const char *__pattern, size_t __length, struct re_pattern_buffer *__buffer); /* Compile a fastmap for the compiled pattern in BUFFER; used to accelerate searches. Return 0 if successful and -2 if was an internal error. */ extern int re_compile_fastmap (struct re_pattern_buffer *__buffer); /* Search in the string STRING (with length LENGTH) for the pattern compiled into BUFFER. Start searching at position START, for RANGE characters. Return the starting position of the match, -1 for no match, or -2 for an internal error. Also return register information in REGS (if REGS and BUFFER->no_sub are nonzero). */ extern int re_search (struct re_pattern_buffer *__buffer, const char *__string, int __length, int __start, int __range, struct re_registers *__regs); /* Like `re_search', but search in the concatenation of STRING1 and STRING2. Also, stop searching at index START + STOP. */ extern int re_search_2 (struct re_pattern_buffer *__buffer, const char *__string1, int __length1, const char *__string2, int __length2, int __start, int __range, struct re_registers *__regs, int __stop); /* Like `re_search', but return how many characters in STRING the regexp in BUFFER matched, starting at position START. */ extern int re_match (struct re_pattern_buffer *__buffer, const char *__string, int __length, int __start, struct re_registers *__regs); /* Relates to `re_match' as `re_search_2' relates to `re_search'. */ extern int re_match_2 (struct re_pattern_buffer *__buffer, const char *__string1, int __length1, const char *__string2, int __length2, int __start, struct re_registers *__regs, int __stop); /* Set REGS to hold NUM_REGS registers, storing them in STARTS and ENDS. Subsequent matches using BUFFER and REGS will use this memory for recording register information. STARTS and ENDS must be allocated with malloc, and must each be at least `NUM_REGS * sizeof (regoff_t)' bytes long. If NUM_REGS == 0, then subsequent matches should allocate their own register data. Unless this function is called, the first search or match using PATTERN_BUFFER will allocate its own register data, without freeing the old data. */ extern void re_set_registers (struct re_pattern_buffer *__buffer, struct re_registers *__regs, unsigned int __num_regs, regoff_t *__starts, regoff_t *__ends); #endif /* Use GNU */ #if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_BSD) # ifndef _CRAY /* 4.2 bsd compatibility. */ extern char *re_comp (const char *); extern int re_exec (const char *); # endif #endif /* GCC 2.95 and later have "__restrict"; C99 compilers have "restrict", and "configure" may have defined "restrict". */ #ifndef __restrict # if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)) # if defined restrict || 199901L <= __STDC_VERSION__ # define __restrict restrict # else # define __restrict # endif # endif #endif /* gcc 3.1 and up support the [restrict] syntax. */ #ifndef __restrict_arr # if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) \ && !defined __GNUG__ # define __restrict_arr __restrict # else # define __restrict_arr # endif #endif /* POSIX compatibility. */ extern int regcomp (regex_t *__restrict __preg, const char *__restrict __pattern, int __cflags); extern int regexec (const regex_t *__restrict __preg, const char *__restrict __string, size_t __nmatch, regmatch_t __pmatch[__restrict_arr], int __eflags); extern size_t regerror (int __errcode, const regex_t *__restrict __preg, char *__restrict __errbuf, size_t __errbuf_size); extern void regfree (regex_t *__preg); #ifdef __cplusplus } #endif /* C++ */ #endif /* regex.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������video/uvesafb.h�������������������������������������������������������������������������������������0000644�����������������00000002066�14763166027�0007476 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _UVESAFB_H #define _UVESAFB_H #include <linux/types.h> struct v86_regs { __u32 ebx; __u32 ecx; __u32 edx; __u32 esi; __u32 edi; __u32 ebp; __u32 eax; __u32 eip; __u32 eflags; __u32 esp; __u16 cs; __u16 ss; __u16 es; __u16 ds; __u16 fs; __u16 gs; }; /* Task flags */ #define TF_VBEIB 0x01 #define TF_BUF_ESDI 0x02 #define TF_BUF_ESBX 0x04 #define TF_BUF_RET 0x08 #define TF_EXIT 0x10 struct uvesafb_task { __u8 flags; int buf_len; struct v86_regs regs; }; /* Constants for the capabilities field * in vbe_ib */ #define VBE_CAP_CAN_SWITCH_DAC 0x01 #define VBE_CAP_VGACOMPAT 0x02 /* The VBE Info Block */ struct vbe_ib { char vbe_signature[4]; __u16 vbe_version; __u32 oem_string_ptr; __u32 capabilities; __u32 mode_list_ptr; __u16 total_memory; __u16 oem_software_rev; __u32 oem_vendor_name_ptr; __u32 oem_product_name_ptr; __u32 oem_product_rev_ptr; __u8 reserved[222]; char oem_data[256]; char misc_data[512]; } __attribute__ ((packed)); #endif /* _UVESAFB_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������video/edid.h����������������������������������������������������������������������������������������0000644�����������������00000000325�14763166027�0006744 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __linux_video_edid_h__ #define __linux_video_edid_h__ struct edid_info { unsigned char dummy[128]; }; #endif /* __linux_video_edid_h__ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������video/sisfb.h���������������������������������������������������������������������������������������0000644�����������������00000016733�14763166027�0007157 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * sisfb.h - definitions for the SiS framebuffer driver * * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria. * * 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 named License, * or 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA */ #ifndef _LINUX_SISFB_H_ #define _LINUX_SISFB_H_ #include <linux/types.h> #include <asm/ioctl.h> /**********************************************/ /* PUBLIC */ /**********************************************/ /* vbflags, public (others in sis.h) */ #define CRT2_DEFAULT 0x00000001 #define CRT2_LCD 0x00000002 #define CRT2_TV 0x00000004 #define CRT2_VGA 0x00000008 #define TV_NTSC 0x00000010 #define TV_PAL 0x00000020 #define TV_HIVISION 0x00000040 #define TV_YPBPR 0x00000080 #define TV_AVIDEO 0x00000100 #define TV_SVIDEO 0x00000200 #define TV_SCART 0x00000400 #define TV_PALM 0x00001000 #define TV_PALN 0x00002000 #define TV_NTSCJ 0x00001000 #define TV_CHSCART 0x00008000 #define TV_CHYPBPR525I 0x00010000 #define CRT1_VGA 0x00000000 #define CRT1_LCDA 0x00020000 #define VGA2_CONNECTED 0x00040000 #define VB_DISPTYPE_CRT1 0x00080000 /* CRT1 connected and used */ #define VB_SINGLE_MODE 0x20000000 /* CRT1 or CRT2; determined by DISPTYPE_CRTx */ #define VB_MIRROR_MODE 0x40000000 /* CRT1 + CRT2 identical (mirror mode) */ #define VB_DUALVIEW_MODE 0x80000000 /* CRT1 + CRT2 independent (dual head mode) */ /* Aliases: */ #define CRT2_ENABLE (CRT2_LCD | CRT2_TV | CRT2_VGA) #define TV_STANDARD (TV_NTSC | TV_PAL | TV_PALM | TV_PALN | TV_NTSCJ) #define TV_INTERFACE (TV_AVIDEO|TV_SVIDEO|TV_SCART|TV_HIVISION|TV_YPBPR|TV_CHSCART|TV_CHYPBPR525I) /* Only if TV_YPBPR is set: */ #define TV_YPBPR525I TV_NTSC #define TV_YPBPR525P TV_PAL #define TV_YPBPR750P TV_PALM #define TV_YPBPR1080I TV_PALN #define TV_YPBPRALL (TV_YPBPR525I | TV_YPBPR525P | TV_YPBPR750P | TV_YPBPR1080I) #define VB_DISPTYPE_DISP2 CRT2_ENABLE #define VB_DISPTYPE_CRT2 CRT2_ENABLE #define VB_DISPTYPE_DISP1 VB_DISPTYPE_CRT1 #define VB_DISPMODE_SINGLE VB_SINGLE_MODE #define VB_DISPMODE_MIRROR VB_MIRROR_MODE #define VB_DISPMODE_DUAL VB_DUALVIEW_MODE #define VB_DISPLAY_MODE (SINGLE_MODE | MIRROR_MODE | DUALVIEW_MODE) /* Structure argument for SISFB_GET_INFO ioctl */ struct sisfb_info { __u32 sisfb_id; /* for identifying sisfb */ #ifndef SISFB_ID #define SISFB_ID 0x53495346 /* Identify myself with 'SISF' */ #endif __u32 chip_id; /* PCI-ID of detected chip */ __u32 memory; /* total video memory in KB */ __u32 heapstart; /* heap start offset in KB */ __u8 fbvidmode; /* current sisfb mode */ __u8 sisfb_version; __u8 sisfb_revision; __u8 sisfb_patchlevel; __u8 sisfb_caps; /* sisfb capabilities */ __u32 sisfb_tqlen; /* turbo queue length (in KB) */ __u32 sisfb_pcibus; /* The card's PCI ID */ __u32 sisfb_pcislot; __u32 sisfb_pcifunc; __u8 sisfb_lcdpdc; /* PanelDelayCompensation */ __u8 sisfb_lcda; /* Detected status of LCDA for low res/text modes */ __u32 sisfb_vbflags; __u32 sisfb_currentvbflags; __u32 sisfb_scalelcd; __u32 sisfb_specialtiming; __u8 sisfb_haveemi; __u8 sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33; __u8 sisfb_haveemilcd; __u8 sisfb_lcdpdca; /* PanelDelayCompensation for LCD-via-CRT1 */ __u16 sisfb_tvxpos, sisfb_tvypos; /* Warning: Values + 32 ! */ __u32 sisfb_heapsize; /* heap size (in KB) */ __u32 sisfb_videooffset; /* Offset of viewport in video memory (in bytes) */ __u32 sisfb_curfstn; /* currently running FSTN/DSTN mode */ __u32 sisfb_curdstn; __u16 sisfb_pci_vendor; /* PCI vendor (SiS or XGI) */ __u32 sisfb_vbflags2; /* ivideo->vbflags2 */ __u8 sisfb_can_post; /* sisfb can POST this card */ __u8 sisfb_card_posted; /* card is POSTED */ __u8 sisfb_was_boot_device; /* This card was the boot video device (ie is primary) */ __u8 reserved[183]; /* for future use */ }; #define SISFB_CMD_GETVBFLAGS 0x55AA0001 /* no arg; result[1] = vbflags */ #define SISFB_CMD_SWITCHCRT1 0x55AA0010 /* arg[0]: 99 = query, 0 = off, 1 = on */ /* more to come */ #define SISFB_CMD_ERR_OK 0x80000000 /* command succeeded */ #define SISFB_CMD_ERR_LOCKED 0x80000001 /* sisfb is locked */ #define SISFB_CMD_ERR_EARLY 0x80000002 /* request before sisfb took over gfx system */ #define SISFB_CMD_ERR_NOVB 0x80000003 /* No video bridge */ #define SISFB_CMD_ERR_NOCRT2 0x80000004 /* can't change CRT1 status, CRT2 disabled */ /* more to come */ #define SISFB_CMD_ERR_UNKNOWN 0x8000ffff /* Unknown command */ #define SISFB_CMD_ERR_OTHER 0x80010000 /* Other error */ /* Argument for SISFB_CMD ioctl */ struct sisfb_cmd { __u32 sisfb_cmd; __u32 sisfb_arg[16]; __u32 sisfb_result[4]; }; /* Additional IOCTLs for communication sisfb <> X driver */ /* If changing this, vgatypes.h must also be changed (for X driver) */ /* ioctl for identifying and giving some info (esp. memory heap start) */ #define SISFB_GET_INFO_SIZE _IOR(0xF3,0x00,__u32) #define SISFB_GET_INFO _IOR(0xF3,0x01,struct sisfb_info) /* ioctrl to get current vertical retrace status */ #define SISFB_GET_VBRSTATUS _IOR(0xF3,0x02,__u32) /* ioctl to enable/disable panning auto-maximize (like nomax parameter) */ #define SISFB_GET_AUTOMAXIMIZE _IOR(0xF3,0x03,__u32) #define SISFB_SET_AUTOMAXIMIZE _IOW(0xF3,0x03,__u32) /* ioctls to relocate TV output (x=D[31:16], y=D[15:0], + 32)*/ #define SISFB_GET_TVPOSOFFSET _IOR(0xF3,0x04,__u32) #define SISFB_SET_TVPOSOFFSET _IOW(0xF3,0x04,__u32) /* ioctl for internal sisfb commands (sisfbctrl) */ #define SISFB_COMMAND _IOWR(0xF3,0x05,struct sisfb_cmd) /* ioctl for locking sisfb (no register access during lock) */ /* As of now, only used to avoid register access during * the ioctls listed above. */ #define SISFB_SET_LOCK _IOW(0xF3,0x06,__u32) /* ioctls 0xF3 up to 0x3F reserved for sisfb */ /****************************************************************/ /* The following are deprecated and should not be used anymore: */ /****************************************************************/ /* ioctl for identifying and giving some info (esp. memory heap start) */ #define SISFB_GET_INFO_OLD _IOR('n',0xF8,__u32) /* ioctrl to get current vertical retrace status */ #define SISFB_GET_VBRSTATUS_OLD _IOR('n',0xF9,__u32) /* ioctl to enable/disable panning auto-maximize (like nomax parameter) */ #define SISFB_GET_AUTOMAXIMIZE_OLD _IOR('n',0xFA,__u32) #define SISFB_SET_AUTOMAXIMIZE_OLD _IOW('n',0xFA,__u32) /****************************************************************/ /* End of deprecated ioctl numbers */ /****************************************************************/ /* For fb memory manager (FBIO_ALLOC, FBIO_FREE) */ struct sis_memreq { __u32 offset; __u32 size; }; /**********************************************/ /* PRIVATE */ /* (for IN-KERNEL usage only) */ /**********************************************/ #endif /* _LINUX_SISFB_H_ */ �������������������������������������nl_types.h������������������������������������������������������������������������������������������0000644�����������������00000003354�14763166027�0006573 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996,1997,1999,2003,2004,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _NL_TYPES_H #define _NL_TYPES_H 1 #include <features.h> /* The default message set used by the gencat program. */ #define NL_SETD 1 /* Value for FLAG parameter of `catgets' to say we want XPG4 compliance. */ #define NL_CAT_LOCALE 1 __BEGIN_DECLS /* Message catalog descriptor type. */ typedef void *nl_catd; /* Type used by `nl_langinfo'. */ typedef int nl_item; /* Open message catalog for later use, returning descriptor. This function is a possible cancellation point and therefore not marked with __THROW. */ extern nl_catd catopen (const char *__cat_name, int __flag) __nonnull ((1)); /* Return translation with NUMBER in SET of CATALOG; if not found return STRING. */ extern char *catgets (nl_catd __catalog, int __set, int __number, const char *__string) __THROW __nonnull ((1)); /* Close message CATALOG. */ extern int catclose (nl_catd __catalog) __THROW __nonnull ((1)); __END_DECLS #endif /* nl_types.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������protocols/timed.h�����������������������������������������������������������������������������������0000644�����������������00000007424�14763166027�0010066 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)timed.h 8.1 (Berkeley) 6/2/93 */ #ifndef _PROTOCOLS_TIMED_H #define _PROTOCOLS_TIMED_H 1 #include <sys/types.h> #include <sys/time.h> /* * Time Synchronization Protocol */ #define TSPVERSION 1 #define ANYADDR NULL #define MAXHOSTNAMELEN 64 struct tsp { u_char tsp_type; u_char tsp_vers; u_short tsp_seq; union { struct timeval tspu_time; char tspu_hopcnt; } tsp_u; char tsp_name[MAXHOSTNAMELEN]; }; #define tsp_time tsp_u.tspu_time #define tsp_hopcnt tsp_u.tspu_hopcnt /* * Command types. */ #define TSP_ANY 0 /* match any types */ #define TSP_ADJTIME 1 /* send adjtime */ #define TSP_ACK 2 /* generic acknowledgement */ #define TSP_MASTERREQ 3 /* ask for master's name */ #define TSP_MASTERACK 4 /* acknowledge master request */ #define TSP_SETTIME 5 /* send network time */ #define TSP_MASTERUP 6 /* inform slaves that master is up */ #define TSP_SLAVEUP 7 /* slave is up but not polled */ #define TSP_ELECTION 8 /* advance candidature for master */ #define TSP_ACCEPT 9 /* support candidature of master */ #define TSP_REFUSE 10 /* reject candidature of master */ #define TSP_CONFLICT 11 /* two or more masters present */ #define TSP_RESOLVE 12 /* masters' conflict resolution */ #define TSP_QUIT 13 /* reject candidature if master is up */ #define TSP_DATE 14 /* reset the time (date command) */ #define TSP_DATEREQ 15 /* remote request to reset the time */ #define TSP_DATEACK 16 /* acknowledge time setting */ #define TSP_TRACEON 17 /* turn tracing on */ #define TSP_TRACEOFF 18 /* turn tracing off */ #define TSP_MSITE 19 /* find out master's site */ #define TSP_MSITEREQ 20 /* remote master's site request */ #define TSP_TEST 21 /* for testing election algo */ #define TSP_SETDATE 22 /* New from date command */ #define TSP_SETDATEREQ 23 /* New remote for above */ #define TSP_LOOP 24 /* loop detection packet */ #define TSPTYPENUMBER 25 #ifdef TSPTYPES char *tsptype[TSPTYPENUMBER] = { "ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME", "MASTERUP", "SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT", "RESOLVE", "QUIT", "DATE", "DATEREQ", "DATEACK", "TRACEON", "TRACEOFF", "MSITE", "MSITEREQ", "TEST", "SETDATE", "SETDATEREQ", "LOOP" }; #endif #endif /* protocols/timed.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������protocols/routed.h����������������������������������������������������������������������������������0000644�����������������00000007357�14763166027�0010273 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*- * Copyright (c) 1983, 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)routed.h 8.1 (Berkeley) 6/2/93 */ #ifndef _PROTOCOLS_ROUTED_H #define _PROTOCOLS_ROUTED_H 1 #include <sys/socket.h> /* * Routing Information Protocol * * Derived from Xerox NS Routing Information Protocol * by changing 32-bit net numbers to sockaddr's and * padding stuff to 32-bit boundaries. */ #define RIPVERSION 1 struct netinfo { struct sockaddr rip_dst; /* destination net/host */ int rip_metric; /* cost of route */ }; struct rip { u_char rip_cmd; /* request/response */ u_char rip_vers; /* protocol version # */ u_char rip_res1[2]; /* pad to 32-bit boundary */ union { struct netinfo ru_nets[1]; /* variable length... */ char ru_tracefile[1]; /* ditto ... */ } ripun; #define rip_nets ripun.ru_nets #define rip_tracefile ripun.ru_tracefile }; /* * Packet types. */ #define RIPCMD_REQUEST 1 /* want info */ #define RIPCMD_RESPONSE 2 /* responding to request */ #define RIPCMD_TRACEON 3 /* turn tracing on */ #define RIPCMD_TRACEOFF 4 /* turn it off */ #define RIPCMD_MAX 5 #ifdef RIPCMDS char *ripcmds[RIPCMD_MAX] = { "#0", "REQUEST", "RESPONSE", "TRACEON", "TRACEOFF" }; #endif #define HOPCNT_INFINITY 16 /* per Xerox NS */ #define MAXPACKETSIZE 512 /* max broadcast size */ /* * Timer values used in managing the routing table. * Complete tables are broadcast every SUPPLY_INTERVAL seconds. * If changes occur between updates, dynamic updates containing only changes * may be sent. When these are sent, a timer is set for a random value * between MIN_WAITTIME and MAX_WAITTIME, and no additional dynamic updates * are sent until the timer expires. * * Every update of a routing entry forces an entry's timer to be reset. * After EXPIRE_TIME without updates, the entry is marked invalid, * but held onto until GARBAGE_TIME so that others may * see it "be deleted". */ #define TIMER_RATE 30 /* alarm clocks every 30 seconds */ #define SUPPLY_INTERVAL 30 /* time to supply tables */ #define MIN_WAITTIME 2 /* min. interval to broadcast changes */ #define MAX_WAITTIME 5 /* max. time to delay changes */ #define EXPIRE_TIME 180 /* time to mark entry invalid */ #define GARBAGE_TIME 240 /* time to garbage collect */ #endif /* protocols/routed.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������protocols/talkd.h�����������������������������������������������������������������������������������0000644�����������������00000011155�14763166027�0010057 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)talkd.h 8.1 (Berkeley) 6/2/93 */ #ifndef _PROTOCOLS_TALKD_H #define _PROTOCOLS_TALKD_H 1 /* * This describes the protocol used by the talk server and clients. * * The talk server acts a repository of invitations, responding to * requests by clients wishing to rendezvous for the purpose of * holding a conversation. In normal operation, a client, the caller, * initiates a rendezvous by sending a CTL_MSG to the server of * type LOOK_UP. This causes the server to search its invitation * tables to check if an invitation currently exists for the caller * (to speak to the callee specified in the message). If the lookup * fails, the caller then sends an ANNOUNCE message causing the server * to broadcast an announcement on the callee's login ports requesting * contact. When the callee responds, the local server uses the * recorded invitation to respond with the appropriate rendezvous * address and the caller and callee client programs establish a * stream connection through which the conversation takes place. */ #include <sys/types.h> #include <sys/socket.h> /* * Client->server request message format. */ typedef struct { u_char vers; /* protocol version */ u_char type; /* request type, see below */ u_char answer; /* not used */ u_char pad; u_int32_t id_num; /* message id */ struct osockaddr addr; /* old (4.3) style */ struct osockaddr ctl_addr; /* old (4.3) style */ int32_t pid; /* caller's process id */ #define NAME_SIZE 12 char l_name[NAME_SIZE];/* caller's name */ char r_name[NAME_SIZE];/* callee's name */ #define TTY_SIZE 16 char r_tty[TTY_SIZE];/* callee's tty name */ } CTL_MSG; /* * Server->client response message format. */ typedef struct { u_char vers; /* protocol version */ u_char type; /* type of request message, see below */ u_char answer; /* response to request message, see below */ u_char pad; u_int32_t id_num; /* message id */ struct osockaddr addr; /* address for establishing conversation */ } CTL_RESPONSE; #define TALK_VERSION 1 /* protocol version */ /* message type values */ #define LEAVE_INVITE 0 /* leave invitation with server */ #define LOOK_UP 1 /* check for invitation by callee */ #define DELETE 2 /* delete invitation by caller */ #define ANNOUNCE 3 /* announce invitation by caller */ /* answer values */ #define SUCCESS 0 /* operation completed properly */ #define NOT_HERE 1 /* callee not logged in */ #define FAILED 2 /* operation failed for unexplained reason */ #define MACHINE_UNKNOWN 3 /* caller's machine name unknown */ #define PERMISSION_DENIED 4 /* callee's tty doesn't permit announce */ #define UNKNOWN_REQUEST 5 /* request has invalid type value */ #define BADVERSION 6 /* request has invalid protocol version */ #define BADADDR 7 /* request has invalid addr value */ #define BADCTLADDR 8 /* request has invalid ctl_addr value */ /* * Operational parameters. */ #define MAX_LIFE 60 /* max time daemon saves invitations */ /* RING_WAIT should be 10's of seconds less than MAX_LIFE */ #define RING_WAIT 30 /* time to wait before resending invitation */ #endif /* protocols/talkd.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������protocols/rwhod.h�����������������������������������������������������������������������������������0000644�����������������00000005007�14763166027�0010102 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)rwhod.h 8.1 (Berkeley) 6/2/93 */ #ifndef _PROTOCOLS_RWHOD_H #define _PROTOCOLS_RWHOD_H 1 #include <sys/types.h> /* * rwho protocol packet format. */ struct outmp { char out_line[8]; /* tty name */ char out_name[8]; /* user id */ int32_t out_time; /* time on */ }; struct whod { char wd_vers; /* protocol version # */ char wd_type; /* packet type, see below */ char wd_pad[2]; int wd_sendtime; /* time stamp by sender */ int wd_recvtime; /* time stamp applied by receiver */ char wd_hostname[32]; /* hosts's name */ int wd_loadav[3]; /* load average as in uptime */ int wd_boottime; /* time system booted */ struct whoent { struct outmp we_utmp; /* active tty info */ int we_idle; /* tty idle time */ } wd_we[1024 / sizeof (struct whoent)]; }; #define WHODVERSION 1 #define WHODTYPE_STATUS 1 /* host status */ /* We used to define _PATH_RWHODIR here but it's now in <paths.h>. */ #include <paths.h> #endif /* protocols/rwhod.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pthread.h�������������������������������������������������������������������������������������������0000644�����������������00000117717�14763166027�0006376 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2002-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _PTHREAD_H #define _PTHREAD_H 1 #include <features.h> #include <endian.h> #include <sched.h> #include <time.h> #include <bits/pthreadtypes.h> #include <bits/setjmp.h> #include <bits/wordsize.h> /* Detach state. */ enum { PTHREAD_CREATE_JOINABLE, #define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_DETACHED #define PTHREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED }; /* Mutex types. */ enum { PTHREAD_MUTEX_TIMED_NP, PTHREAD_MUTEX_RECURSIVE_NP, PTHREAD_MUTEX_ERRORCHECK_NP, PTHREAD_MUTEX_ADAPTIVE_NP #if defined __USE_UNIX98 || defined __USE_XOPEN2K8 , PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP, PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP, PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP, PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL #endif #ifdef __USE_GNU /* For compatibility. */ , PTHREAD_MUTEX_FAST_NP = PTHREAD_MUTEX_TIMED_NP #endif }; #ifdef __USE_XOPEN2K /* Robust mutex or not flags. */ enum { PTHREAD_MUTEX_STALLED, PTHREAD_MUTEX_STALLED_NP = PTHREAD_MUTEX_STALLED, PTHREAD_MUTEX_ROBUST, PTHREAD_MUTEX_ROBUST_NP = PTHREAD_MUTEX_ROBUST }; #endif #if defined __USE_POSIX199506 || defined __USE_UNIX98 /* Mutex protocols. */ enum { PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT, PTHREAD_PRIO_PROTECT }; #endif #ifdef __PTHREAD_MUTEX_HAVE_PREV # define PTHREAD_MUTEX_INITIALIZER \ { { 0, 0, 0, 0, 0, __PTHREAD_SPINS, { 0, 0 } } } # ifdef __USE_GNU # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \ { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, __PTHREAD_SPINS, { 0, 0 } } } # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \ { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, __PTHREAD_SPINS, { 0, 0 } } } # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \ { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, __PTHREAD_SPINS, { 0, 0 } } } # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \ { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, __PTHREAD_SPINS, { 0, 0 } } } # endif #else # define PTHREAD_MUTEX_INITIALIZER \ { { 0, 0, 0, 0, 0, { __PTHREAD_SPINS } } } # ifdef __USE_GNU # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \ { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0, { __PTHREAD_SPINS } } } # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \ { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0, { __PTHREAD_SPINS } } } # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \ { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, 0, { __PTHREAD_SPINS } } } # endif #endif /* Read-write lock types. */ #if defined __USE_UNIX98 || defined __USE_XOPEN2K enum { PTHREAD_RWLOCK_PREFER_READER_NP, PTHREAD_RWLOCK_PREFER_WRITER_NP, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_READER_NP }; /* Define __PTHREAD_RWLOCK_INT_FLAGS_SHARED to 1 if pthread_rwlock_t has the shared field. All 64-bit architectures have the shared field in pthread_rwlock_t. */ #ifndef __PTHREAD_RWLOCK_INT_FLAGS_SHARED # if __WORDSIZE == 64 # define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1 # endif #endif /* Read-write lock initializers. */ # define PTHREAD_RWLOCK_INITIALIZER \ { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } # ifdef __USE_GNU # ifdef __PTHREAD_RWLOCK_INT_FLAGS_SHARED # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \ { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } } # else # if __BYTE_ORDER == __LITTLE_ENDIAN # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \ { { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, \ 0, 0, 0, 0 } } # else # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \ { { 0, 0, 0, 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,\ 0 } } # endif # endif # endif #endif /* Unix98 or XOpen2K */ /* Scheduler inheritance. */ enum { PTHREAD_INHERIT_SCHED, #define PTHREAD_INHERIT_SCHED PTHREAD_INHERIT_SCHED PTHREAD_EXPLICIT_SCHED #define PTHREAD_EXPLICIT_SCHED PTHREAD_EXPLICIT_SCHED }; /* Scope handling. */ enum { PTHREAD_SCOPE_SYSTEM, #define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_PROCESS #define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_PROCESS }; /* Process shared or private flag. */ enum { PTHREAD_PROCESS_PRIVATE, #define PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_SHARED #define PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED }; /* Conditional variable handling. */ #define PTHREAD_COND_INITIALIZER { { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } } /* Cleanup buffers */ struct _pthread_cleanup_buffer { void (*__routine) (void *); /* Function to call. */ void *__arg; /* Its argument. */ int __canceltype; /* Saved cancellation type. */ struct _pthread_cleanup_buffer *__prev; /* Chaining of cleanup functions. */ }; /* Cancellation */ enum { PTHREAD_CANCEL_ENABLE, #define PTHREAD_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE PTHREAD_CANCEL_DISABLE #define PTHREAD_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE }; enum { PTHREAD_CANCEL_DEFERRED, #define PTHREAD_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED PTHREAD_CANCEL_ASYNCHRONOUS #define PTHREAD_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS }; #define PTHREAD_CANCELED ((void *) -1) /* Single execution handling. */ #define PTHREAD_ONCE_INIT 0 #ifdef __USE_XOPEN2K /* Value returned by 'pthread_barrier_wait' for one of the threads after the required number of threads have called this function. -1 is distinct from 0 and all errno constants */ # define PTHREAD_BARRIER_SERIAL_THREAD -1 #endif __BEGIN_DECLS /* Create a new thread, starting with execution of START-ROUTINE getting passed ARG. Creation attributed come from ATTR. The new handle is stored in *NEWTHREAD. */ extern int pthread_create (pthread_t *__restrict __newthread, const pthread_attr_t *__restrict __attr, void *(*__start_routine) (void *), void *__restrict __arg) __THROWNL __nonnull ((1, 3)); /* Terminate calling thread. The registered cleanup handlers are called via exception handling so we cannot mark this function with __THROW.*/ extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__)); /* Make calling thread wait for termination of the thread TH. The exit status of the thread is stored in *THREAD_RETURN, if THREAD_RETURN is not NULL. This function is a cancellation point and therefore not marked with __THROW. */ extern int pthread_join (pthread_t __th, void **__thread_return); #ifdef __USE_GNU /* Check whether thread TH has terminated. If yes return the status of the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */ extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW; /* Make calling thread wait for termination of the thread TH, but only until TIMEOUT. The exit status of the thread is stored in *THREAD_RETURN, if THREAD_RETURN is not NULL. This function is a cancellation point and therefore not marked with __THROW. */ extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return, const struct timespec *__abstime); #endif /* Indicate that the thread TH is never to be joined with PTHREAD_JOIN. The resources of TH will therefore be freed immediately when it terminates, instead of waiting for another thread to perform PTHREAD_JOIN on it. */ extern int pthread_detach (pthread_t __th) __THROW; /* Obtain the identifier of the current thread. */ extern pthread_t pthread_self (void) __THROW __attribute__ ((__const__)); /* Compare two thread identifiers. */ extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) __THROW __attribute__ ((__const__)); /* Thread attribute handling. */ /* Initialize thread attribute *ATTR with default attributes (detachstate is PTHREAD_JOINABLE, scheduling policy is SCHED_OTHER, no user-provided stack). */ extern int pthread_attr_init (pthread_attr_t *__attr) __THROW __nonnull ((1)); /* Destroy thread attribute *ATTR. */ extern int pthread_attr_destroy (pthread_attr_t *__attr) __THROW __nonnull ((1)); /* Get detach state attribute. */ extern int pthread_attr_getdetachstate (const pthread_attr_t *__attr, int *__detachstate) __THROW __nonnull ((1, 2)); /* Set detach state attribute. */ extern int pthread_attr_setdetachstate (pthread_attr_t *__attr, int __detachstate) __THROW __nonnull ((1)); /* Get the size of the guard area created for stack overflow protection. */ extern int pthread_attr_getguardsize (const pthread_attr_t *__attr, size_t *__guardsize) __THROW __nonnull ((1, 2)); /* Set the size of the guard area created for stack overflow protection. */ extern int pthread_attr_setguardsize (pthread_attr_t *__attr, size_t __guardsize) __THROW __nonnull ((1)); /* Return in *PARAM the scheduling parameters of *ATTR. */ extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr, struct sched_param *__restrict __param) __THROW __nonnull ((1, 2)); /* Set scheduling parameters (priority, etc) in *ATTR according to PARAM. */ extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr, const struct sched_param *__restrict __param) __THROW __nonnull ((1, 2)); /* Return in *POLICY the scheduling policy of *ATTR. */ extern int pthread_attr_getschedpolicy (const pthread_attr_t *__restrict __attr, int *__restrict __policy) __THROW __nonnull ((1, 2)); /* Set scheduling policy in *ATTR according to POLICY. */ extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy) __THROW __nonnull ((1)); /* Return in *INHERIT the scheduling inheritance mode of *ATTR. */ extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict __attr, int *__restrict __inherit) __THROW __nonnull ((1, 2)); /* Set scheduling inheritance mode in *ATTR according to INHERIT. */ extern int pthread_attr_setinheritsched (pthread_attr_t *__attr, int __inherit) __THROW __nonnull ((1)); /* Return in *SCOPE the scheduling contention scope of *ATTR. */ extern int pthread_attr_getscope (const pthread_attr_t *__restrict __attr, int *__restrict __scope) __THROW __nonnull ((1, 2)); /* Set scheduling contention scope in *ATTR according to SCOPE. */ extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope) __THROW __nonnull ((1)); /* Return the previously set address for the stack. */ extern int pthread_attr_getstackaddr (const pthread_attr_t *__restrict __attr, void **__restrict __stackaddr) __THROW __nonnull ((1, 2)) __attribute_deprecated__; /* Set the starting address of the stack of the thread to be created. Depending on whether the stack grows up or down the value must either be higher or lower than all the address in the memory block. The minimal size of the block must be PTHREAD_STACK_MIN. */ extern int pthread_attr_setstackaddr (pthread_attr_t *__attr, void *__stackaddr) __THROW __nonnull ((1)) __attribute_deprecated__; /* Return the currently used minimal stack size. */ extern int pthread_attr_getstacksize (const pthread_attr_t *__restrict __attr, size_t *__restrict __stacksize) __THROW __nonnull ((1, 2)); /* Add information about the minimum stack size needed for the thread to be started. This size must never be less than PTHREAD_STACK_MIN and must also not exceed the system limits. */ extern int pthread_attr_setstacksize (pthread_attr_t *__attr, size_t __stacksize) __THROW __nonnull ((1)); #ifdef __USE_XOPEN2K /* Return the previously set address for the stack. */ extern int pthread_attr_getstack (const pthread_attr_t *__restrict __attr, void **__restrict __stackaddr, size_t *__restrict __stacksize) __THROW __nonnull ((1, 2, 3)); /* The following two interfaces are intended to replace the last two. They require setting the address as well as the size since only setting the address will make the implementation on some architectures impossible. */ extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr, size_t __stacksize) __THROW __nonnull ((1)); #endif #ifdef __USE_GNU /* Thread created with attribute ATTR will be limited to run only on the processors represented in CPUSET. */ extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr, size_t __cpusetsize, const cpu_set_t *__cpuset) __THROW __nonnull ((1, 3)); /* Get bit set in CPUSET representing the processors threads created with ATTR can run on. */ extern int pthread_attr_getaffinity_np (const pthread_attr_t *__attr, size_t __cpusetsize, cpu_set_t *__cpuset) __THROW __nonnull ((1, 3)); /* Initialize thread attribute *ATTR with attributes corresponding to the already running thread TH. It shall be called on uninitialized ATTR and destroyed with pthread_attr_destroy when no longer needed. */ extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr) __THROW __nonnull ((2)); #endif /* Functions for scheduling control. */ /* Set the scheduling parameters for TARGET_THREAD according to POLICY and *PARAM. */ extern int pthread_setschedparam (pthread_t __target_thread, int __policy, const struct sched_param *__param) __THROW __nonnull ((3)); /* Return in *POLICY and *PARAM the scheduling parameters for TARGET_THREAD. */ extern int pthread_getschedparam (pthread_t __target_thread, int *__restrict __policy, struct sched_param *__restrict __param) __THROW __nonnull ((2, 3)); /* Set the scheduling priority for TARGET_THREAD. */ extern int pthread_setschedprio (pthread_t __target_thread, int __prio) __THROW; #ifdef __USE_GNU /* Get thread name visible in the kernel and its interfaces. */ extern int pthread_getname_np (pthread_t __target_thread, char *__buf, size_t __buflen) __THROW __nonnull ((2)); /* Set thread name visible in the kernel and its interfaces. */ extern int pthread_setname_np (pthread_t __target_thread, const char *__name) __THROW __nonnull ((2)); #endif #ifdef __USE_UNIX98 /* Determine level of concurrency. */ extern int pthread_getconcurrency (void) __THROW; /* Set new concurrency level to LEVEL. */ extern int pthread_setconcurrency (int __level) __THROW; #endif #ifdef __USE_GNU /* Yield the processor to another thread or process. This function is similar to the POSIX `sched_yield' function but might be differently implemented in the case of a m-on-n thread implementation. */ extern int pthread_yield (void) __THROW; /* Limit specified thread TH to run only on the processors represented in CPUSET. */ extern int pthread_setaffinity_np (pthread_t __th, size_t __cpusetsize, const cpu_set_t *__cpuset) __THROW __nonnull ((3)); /* Get bit set in CPUSET representing the processors TH can run on. */ extern int pthread_getaffinity_np (pthread_t __th, size_t __cpusetsize, cpu_set_t *__cpuset) __THROW __nonnull ((3)); #endif /* Functions for handling initialization. */ /* Guarantee that the initialization function INIT_ROUTINE will be called only once, even if pthread_once is executed several times with the same ONCE_CONTROL argument. ONCE_CONTROL must point to a static or extern variable initialized to PTHREAD_ONCE_INIT. The initialization functions might throw exception which is why this function is not marked with __THROW. */ extern int pthread_once (pthread_once_t *__once_control, void (*__init_routine) (void)) __nonnull ((1, 2)); /* Functions for handling cancellation. Note that these functions are explicitly not marked to not throw an exception in C++ code. If cancellation is implemented by unwinding this is necessary to have the compiler generate the unwind information. */ /* Set cancelability state of current thread to STATE, returning old state in *OLDSTATE if OLDSTATE is not NULL. */ extern int pthread_setcancelstate (int __state, int *__oldstate); /* Set cancellation state of current thread to TYPE, returning the old type in *OLDTYPE if OLDTYPE is not NULL. */ extern int pthread_setcanceltype (int __type, int *__oldtype); /* Cancel THREAD immediately or at the next possibility. */ extern int pthread_cancel (pthread_t __th); /* Test for pending cancellation for the current thread and terminate the thread as per pthread_exit(PTHREAD_CANCELED) if it has been cancelled. */ extern void pthread_testcancel (void); /* Cancellation handling with integration into exception handling. */ typedef struct { struct { __jmp_buf __cancel_jmp_buf; int __mask_was_saved; } __cancel_jmp_buf[1]; void *__pad[4]; } __pthread_unwind_buf_t __attribute__ ((__aligned__)); /* No special attributes by default. */ #ifndef __cleanup_fct_attribute # define __cleanup_fct_attribute #endif /* Structure to hold the cleanup handler information. */ struct __pthread_cleanup_frame { void (*__cancel_routine) (void *); void *__cancel_arg; int __do_it; int __cancel_type; }; #if defined __GNUC__ && defined __EXCEPTIONS # ifdef __cplusplus /* Class to handle cancellation handler invocation. */ class __pthread_cleanup_class { void (*__cancel_routine) (void *); void *__cancel_arg; int __do_it; int __cancel_type; public: __pthread_cleanup_class (void (*__fct) (void *), void *__arg) : __cancel_routine (__fct), __cancel_arg (__arg), __do_it (1) { } ~__pthread_cleanup_class () { if (__do_it) __cancel_routine (__cancel_arg); } void __setdoit (int __newval) { __do_it = __newval; } void __defer () { pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &__cancel_type); } void __restore () const { pthread_setcanceltype (__cancel_type, 0); } }; /* Install a cleanup handler: ROUTINE will be called with arguments ARG when the thread is canceled or calls pthread_exit. ROUTINE will also be called with arguments ARG when the matching pthread_cleanup_pop is executed with non-zero EXECUTE argument. pthread_cleanup_push and pthread_cleanup_pop are macros and must always be used in matching pairs at the same nesting level of braces. */ # define pthread_cleanup_push(routine, arg) \ do { \ __pthread_cleanup_class __clframe (routine, arg) /* Remove a cleanup handler installed by the matching pthread_cleanup_push. If EXECUTE is non-zero, the handler function is called. */ # define pthread_cleanup_pop(execute) \ __clframe.__setdoit (execute); \ } while (0) # ifdef __USE_GNU /* Install a cleanup handler as pthread_cleanup_push does, but also saves the current cancellation type and sets it to deferred cancellation. */ # define pthread_cleanup_push_defer_np(routine, arg) \ do { \ __pthread_cleanup_class __clframe (routine, arg); \ __clframe.__defer () /* Remove a cleanup handler as pthread_cleanup_pop does, but also restores the cancellation type that was in effect when the matching pthread_cleanup_push_defer was called. */ # define pthread_cleanup_pop_restore_np(execute) \ __clframe.__restore (); \ __clframe.__setdoit (execute); \ } while (0) # endif # else /* Function called to call the cleanup handler. As an extern inline function the compiler is free to decide inlining the change when needed or fall back on the copy which must exist somewhere else. */ __extern_inline void __pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame) { if (__frame->__do_it) __frame->__cancel_routine (__frame->__cancel_arg); } /* Install a cleanup handler: ROUTINE will be called with arguments ARG when the thread is canceled or calls pthread_exit. ROUTINE will also be called with arguments ARG when the matching pthread_cleanup_pop is executed with non-zero EXECUTE argument. pthread_cleanup_push and pthread_cleanup_pop are macros and must always be used in matching pairs at the same nesting level of braces. */ # define pthread_cleanup_push(routine, arg) \ do { \ struct __pthread_cleanup_frame __clframe \ __attribute__ ((__cleanup__ (__pthread_cleanup_routine))) \ = { .__cancel_routine = (routine), .__cancel_arg = (arg), \ .__do_it = 1 }; /* Remove a cleanup handler installed by the matching pthread_cleanup_push. If EXECUTE is non-zero, the handler function is called. */ # define pthread_cleanup_pop(execute) \ __clframe.__do_it = (execute); \ } while (0) # ifdef __USE_GNU /* Install a cleanup handler as pthread_cleanup_push does, but also saves the current cancellation type and sets it to deferred cancellation. */ # define pthread_cleanup_push_defer_np(routine, arg) \ do { \ struct __pthread_cleanup_frame __clframe \ __attribute__ ((__cleanup__ (__pthread_cleanup_routine))) \ = { .__cancel_routine = (routine), .__cancel_arg = (arg), \ .__do_it = 1 }; \ (void) pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, \ &__clframe.__cancel_type) /* Remove a cleanup handler as pthread_cleanup_pop does, but also restores the cancellation type that was in effect when the matching pthread_cleanup_push_defer was called. */ # define pthread_cleanup_pop_restore_np(execute) \ (void) pthread_setcanceltype (__clframe.__cancel_type, NULL); \ __clframe.__do_it = (execute); \ } while (0) # endif # endif #else /* Install a cleanup handler: ROUTINE will be called with arguments ARG when the thread is canceled or calls pthread_exit. ROUTINE will also be called with arguments ARG when the matching pthread_cleanup_pop is executed with non-zero EXECUTE argument. pthread_cleanup_push and pthread_cleanup_pop are macros and must always be used in matching pairs at the same nesting level of braces. */ # define pthread_cleanup_push(routine, arg) \ do { \ __pthread_unwind_buf_t __cancel_buf; \ void (*__cancel_routine) (void *) = (routine); \ void *__cancel_arg = (arg); \ int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \ __cancel_buf.__cancel_jmp_buf, 0); \ if (__glibc_unlikely (__not_first_call)) \ { \ __cancel_routine (__cancel_arg); \ __pthread_unwind_next (&__cancel_buf); \ /* NOTREACHED */ \ } \ \ __pthread_register_cancel (&__cancel_buf); \ do { extern void __pthread_register_cancel (__pthread_unwind_buf_t *__buf) __cleanup_fct_attribute; /* Remove a cleanup handler installed by the matching pthread_cleanup_push. If EXECUTE is non-zero, the handler function is called. */ # define pthread_cleanup_pop(execute) \ do { } while (0);/* Empty to allow label before pthread_cleanup_pop. */\ } while (0); \ __pthread_unregister_cancel (&__cancel_buf); \ if (execute) \ __cancel_routine (__cancel_arg); \ } while (0) extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf) __cleanup_fct_attribute; # ifdef __USE_GNU /* Install a cleanup handler as pthread_cleanup_push does, but also saves the current cancellation type and sets it to deferred cancellation. */ # define pthread_cleanup_push_defer_np(routine, arg) \ do { \ __pthread_unwind_buf_t __cancel_buf; \ void (*__cancel_routine) (void *) = (routine); \ void *__cancel_arg = (arg); \ int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \ __cancel_buf.__cancel_jmp_buf, 0); \ if (__glibc_unlikely (__not_first_call)) \ { \ __cancel_routine (__cancel_arg); \ __pthread_unwind_next (&__cancel_buf); \ /* NOTREACHED */ \ } \ \ __pthread_register_cancel_defer (&__cancel_buf); \ do { extern void __pthread_register_cancel_defer (__pthread_unwind_buf_t *__buf) __cleanup_fct_attribute; /* Remove a cleanup handler as pthread_cleanup_pop does, but also restores the cancellation type that was in effect when the matching pthread_cleanup_push_defer was called. */ # define pthread_cleanup_pop_restore_np(execute) \ do { } while (0);/* Empty to allow label before pthread_cleanup_pop. */\ } while (0); \ __pthread_unregister_cancel_restore (&__cancel_buf); \ if (execute) \ __cancel_routine (__cancel_arg); \ } while (0) extern void __pthread_unregister_cancel_restore (__pthread_unwind_buf_t *__buf) __cleanup_fct_attribute; # endif /* Internal interface to initiate cleanup. */ extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf) __cleanup_fct_attribute __attribute__ ((__noreturn__)) # ifndef SHARED __attribute__ ((__weak__)) # endif ; #endif /* Function used in the macros. */ struct __jmp_buf_tag; extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL; /* Mutex handling. */ /* Initialize a mutex. */ extern int pthread_mutex_init (pthread_mutex_t *__mutex, const pthread_mutexattr_t *__mutexattr) __THROW __nonnull ((1)); /* Destroy a mutex. */ extern int pthread_mutex_destroy (pthread_mutex_t *__mutex) __THROW __nonnull ((1)); /* Try locking a mutex. */ extern int pthread_mutex_trylock (pthread_mutex_t *__mutex) __THROWNL __nonnull ((1)); /* Lock a mutex. */ extern int pthread_mutex_lock (pthread_mutex_t *__mutex) __THROWNL __nonnull ((1)); #ifdef __USE_XOPEN2K /* Wait until lock becomes available, or specified time passes. */ extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); #endif /* Unlock a mutex. */ extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) __THROWNL __nonnull ((1)); /* Get the priority ceiling of MUTEX. */ extern int pthread_mutex_getprioceiling (const pthread_mutex_t * __restrict __mutex, int *__restrict __prioceiling) __THROW __nonnull ((1, 2)); /* Set the priority ceiling of MUTEX to PRIOCEILING, return old priority ceiling value in *OLD_CEILING. */ extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex, int __prioceiling, int *__restrict __old_ceiling) __THROW __nonnull ((1, 3)); #ifdef __USE_XOPEN2K8 /* Declare the state protected by MUTEX as consistent. */ extern int pthread_mutex_consistent (pthread_mutex_t *__mutex) __THROW __nonnull ((1)); # ifdef __USE_GNU extern int pthread_mutex_consistent_np (pthread_mutex_t *__mutex) __THROW __nonnull ((1)); # endif #endif /* Functions for handling mutex attributes. */ /* Initialize mutex attribute object ATTR with default attributes (kind is PTHREAD_MUTEX_TIMED_NP). */ extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr) __THROW __nonnull ((1)); /* Destroy mutex attribute object ATTR. */ extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr) __THROW __nonnull ((1)); /* Get the process-shared flag of the mutex attribute ATTR. */ extern int pthread_mutexattr_getpshared (const pthread_mutexattr_t * __restrict __attr, int *__restrict __pshared) __THROW __nonnull ((1, 2)); /* Set the process-shared flag of the mutex attribute ATTR. */ extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr, int __pshared) __THROW __nonnull ((1)); #if defined __USE_UNIX98 || defined __USE_XOPEN2K8 /* Return in *KIND the mutex kind attribute in *ATTR. */ extern int pthread_mutexattr_gettype (const pthread_mutexattr_t *__restrict __attr, int *__restrict __kind) __THROW __nonnull ((1, 2)); /* Set the mutex kind attribute in *ATTR to KIND (either PTHREAD_MUTEX_NORMAL, PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_ERRORCHECK, or PTHREAD_MUTEX_DEFAULT). */ extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind) __THROW __nonnull ((1)); #endif /* Return in *PROTOCOL the mutex protocol attribute in *ATTR. */ extern int pthread_mutexattr_getprotocol (const pthread_mutexattr_t * __restrict __attr, int *__restrict __protocol) __THROW __nonnull ((1, 2)); /* Set the mutex protocol attribute in *ATTR to PROTOCOL (either PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT, or PTHREAD_PRIO_PROTECT). */ extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr, int __protocol) __THROW __nonnull ((1)); /* Return in *PRIOCEILING the mutex prioceiling attribute in *ATTR. */ extern int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t * __restrict __attr, int *__restrict __prioceiling) __THROW __nonnull ((1, 2)); /* Set the mutex prioceiling attribute in *ATTR to PRIOCEILING. */ extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr, int __prioceiling) __THROW __nonnull ((1)); #ifdef __USE_XOPEN2K /* Get the robustness flag of the mutex attribute ATTR. */ extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr, int *__robustness) __THROW __nonnull ((1, 2)); # ifdef __USE_GNU extern int pthread_mutexattr_getrobust_np (const pthread_mutexattr_t *__attr, int *__robustness) __THROW __nonnull ((1, 2)); # endif /* Set the robustness flag of the mutex attribute ATTR. */ extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr, int __robustness) __THROW __nonnull ((1)); # ifdef __USE_GNU extern int pthread_mutexattr_setrobust_np (pthread_mutexattr_t *__attr, int __robustness) __THROW __nonnull ((1)); # endif #endif #if defined __USE_UNIX98 || defined __USE_XOPEN2K /* Functions for handling read-write locks. */ /* Initialize read-write lock RWLOCK using attributes ATTR, or use the default values if later is NULL. */ extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock, const pthread_rwlockattr_t *__restrict __attr) __THROW __nonnull ((1)); /* Destroy read-write lock RWLOCK. */ extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock) __THROW __nonnull ((1)); /* Acquire read lock for RWLOCK. */ extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock) __THROWNL __nonnull ((1)); /* Try to acquire read lock for RWLOCK. */ extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) __THROWNL __nonnull ((1)); # ifdef __USE_XOPEN2K /* Try to acquire read lock for RWLOCK or return after specfied time. */ extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); # endif /* Acquire write lock for RWLOCK. */ extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock) __THROWNL __nonnull ((1)); /* Try to acquire write lock for RWLOCK. */ extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) __THROWNL __nonnull ((1)); # ifdef __USE_XOPEN2K /* Try to acquire write lock for RWLOCK or return after specfied time. */ extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); # endif /* Unlock RWLOCK. */ extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock) __THROWNL __nonnull ((1)); /* Functions for handling read-write lock attributes. */ /* Initialize attribute object ATTR with default values. */ extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr) __THROW __nonnull ((1)); /* Destroy attribute object ATTR. */ extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr) __THROW __nonnull ((1)); /* Return current setting of process-shared attribute of ATTR in PSHARED. */ extern int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * __restrict __attr, int *__restrict __pshared) __THROW __nonnull ((1, 2)); /* Set process-shared attribute of ATTR to PSHARED. */ extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr, int __pshared) __THROW __nonnull ((1)); /* Return current setting of reader/writer preference. */ extern int pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t * __restrict __attr, int *__restrict __pref) __THROW __nonnull ((1, 2)); /* Set reader/write preference. */ extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr, int __pref) __THROW __nonnull ((1)); #endif /* Functions for handling conditional variables. */ /* Initialize condition variable COND using attributes ATTR, or use the default values if later is NULL. */ extern int pthread_cond_init (pthread_cond_t *__restrict __cond, const pthread_condattr_t *__restrict __cond_attr) __THROW __nonnull ((1)); /* Destroy condition variable COND. */ extern int pthread_cond_destroy (pthread_cond_t *__cond) __THROW __nonnull ((1)); /* Wake up one thread waiting for condition variable COND. */ extern int pthread_cond_signal (pthread_cond_t *__cond) __THROWNL __nonnull ((1)); /* Wake up all threads waiting for condition variables COND. */ extern int pthread_cond_broadcast (pthread_cond_t *__cond) __THROWNL __nonnull ((1)); /* Wait for condition variable COND to be signaled or broadcast. MUTEX is assumed to be locked before. This function is a cancellation point and therefore not marked with __THROW. */ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond, pthread_mutex_t *__restrict __mutex) __nonnull ((1, 2)); /* Wait for condition variable COND to be signaled or broadcast until ABSTIME. MUTEX is assumed to be locked before. ABSTIME is an absolute time specification; zero is the beginning of the epoch (00:00:00 GMT, January 1, 1970). This function is a cancellation point and therefore not marked with __THROW. */ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, pthread_mutex_t *__restrict __mutex, const struct timespec *__restrict __abstime) __nonnull ((1, 2, 3)); /* Functions for handling condition variable attributes. */ /* Initialize condition variable attribute ATTR. */ extern int pthread_condattr_init (pthread_condattr_t *__attr) __THROW __nonnull ((1)); /* Destroy condition variable attribute ATTR. */ extern int pthread_condattr_destroy (pthread_condattr_t *__attr) __THROW __nonnull ((1)); /* Get the process-shared flag of the condition variable attribute ATTR. */ extern int pthread_condattr_getpshared (const pthread_condattr_t * __restrict __attr, int *__restrict __pshared) __THROW __nonnull ((1, 2)); /* Set the process-shared flag of the condition variable attribute ATTR. */ extern int pthread_condattr_setpshared (pthread_condattr_t *__attr, int __pshared) __THROW __nonnull ((1)); #ifdef __USE_XOPEN2K /* Get the clock selected for the conditon variable attribute ATTR. */ extern int pthread_condattr_getclock (const pthread_condattr_t * __restrict __attr, __clockid_t *__restrict __clock_id) __THROW __nonnull ((1, 2)); /* Set the clock selected for the conditon variable attribute ATTR. */ extern int pthread_condattr_setclock (pthread_condattr_t *__attr, __clockid_t __clock_id) __THROW __nonnull ((1)); #endif #ifdef __USE_XOPEN2K /* Functions to handle spinlocks. */ /* Initialize the spinlock LOCK. If PSHARED is nonzero the spinlock can be shared between different processes. */ extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared) __THROW __nonnull ((1)); /* Destroy the spinlock LOCK. */ extern int pthread_spin_destroy (pthread_spinlock_t *__lock) __THROW __nonnull ((1)); /* Wait until spinlock LOCK is retrieved. */ extern int pthread_spin_lock (pthread_spinlock_t *__lock) __THROWNL __nonnull ((1)); /* Try to lock spinlock LOCK. */ extern int pthread_spin_trylock (pthread_spinlock_t *__lock) __THROWNL __nonnull ((1)); /* Release spinlock LOCK. */ extern int pthread_spin_unlock (pthread_spinlock_t *__lock) __THROWNL __nonnull ((1)); /* Functions to handle barriers. */ /* Initialize BARRIER with the attributes in ATTR. The barrier is opened when COUNT waiters arrived. */ extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier, const pthread_barrierattr_t *__restrict __attr, unsigned int __count) __THROW __nonnull ((1)); /* Destroy a previously dynamically initialized barrier BARRIER. */ extern int pthread_barrier_destroy (pthread_barrier_t *__barrier) __THROW __nonnull ((1)); /* Wait on barrier BARRIER. */ extern int pthread_barrier_wait (pthread_barrier_t *__barrier) __THROWNL __nonnull ((1)); /* Initialize barrier attribute ATTR. */ extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr) __THROW __nonnull ((1)); /* Destroy previously dynamically initialized barrier attribute ATTR. */ extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr) __THROW __nonnull ((1)); /* Get the process-shared flag of the barrier attribute ATTR. */ extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t * __restrict __attr, int *__restrict __pshared) __THROW __nonnull ((1, 2)); /* Set the process-shared flag of the barrier attribute ATTR. */ extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr, int __pshared) __THROW __nonnull ((1)); #endif /* Functions for handling thread-specific data. */ /* Create a key value identifying a location in the thread-specific data area. Each thread maintains a distinct thread-specific data area. DESTR_FUNCTION, if non-NULL, is called with the value associated to that key when the key is destroyed. DESTR_FUNCTION is not called if the value associated is NULL when the key is destroyed. */ extern int pthread_key_create (pthread_key_t *__key, void (*__destr_function) (void *)) __THROW __nonnull ((1)); /* Destroy KEY. */ extern int pthread_key_delete (pthread_key_t __key) __THROW; /* Return current value of the thread-specific data slot identified by KEY. */ extern void *pthread_getspecific (pthread_key_t __key) __THROW; /* Store POINTER in the thread-specific data slot identified by KEY. */ extern int pthread_setspecific (pthread_key_t __key, const void *__pointer) __THROW ; #ifdef __USE_XOPEN2K /* Get ID of CPU-time clock for thread THREAD_ID. */ extern int pthread_getcpuclockid (pthread_t __thread_id, __clockid_t *__clock_id) __THROW __nonnull ((2)); #endif /* Install handlers to be called when a new process is created with FORK. The PREPARE handler is called in the parent process just before performing FORK. The PARENT handler is called in the parent process just after FORK. The CHILD handler is called in the child process. Each of the three handlers can be NULL, meaning that no handler needs to be called at that point. PTHREAD_ATFORK can be called several times, in which case the PREPARE handlers are called in LIFO order (last added with PTHREAD_ATFORK, first called before FORK), and the PARENT and CHILD handlers are called in FIFO (first added, first called). */ extern int pthread_atfork (void (*__prepare) (void), void (*__parent) (void), void (*__child) (void)) __THROW; #ifdef __USE_EXTERN_INLINES /* Optimizations. */ __extern_inline int __NTH (pthread_equal (pthread_t __thread1, pthread_t __thread2)) { return __thread1 == __thread2; } #endif __END_DECLS #endif /* pthread.h */ �������������������������������������������������pgtypes_error.h�������������������������������������������������������������������������������������0000644�����������������00000001022�14763166027�0007630 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/interfaces/ecpg/include/pgtypes_error.h */ #define PGTYPES_NUM_OVERFLOW 301 #define PGTYPES_NUM_BAD_NUMERIC 302 #define PGTYPES_NUM_DIVIDE_ZERO 303 #define PGTYPES_NUM_UNDERFLOW 304 #define PGTYPES_DATE_BAD_DATE 310 #define PGTYPES_DATE_ERR_EARGS 311 #define PGTYPES_DATE_ERR_ENOSHORTDATE 312 #define PGTYPES_DATE_ERR_ENOTDMY 313 #define PGTYPES_DATE_BAD_DAY 314 #define PGTYPES_DATE_BAD_MONTH 315 #define PGTYPES_TS_BAD_TIMESTAMP 320 #define PGTYPES_TS_ERR_EINFTIME 321 #define PGTYPES_INTVL_BAD_INTERVAL 330 ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kdb.h�����������������������������������������������������������������������������������������������0000644�����������������00000170167�14763166027�0005505 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 1990, 1991, 2016 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of M.I.T. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a * fashion that it might be confused with the original M.I.T. software. * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. */ /* * Copyright (C) 1998 by the FundsXpress, INC. * * All rights reserved. * * Export of this software from the United States of America may require * a specific license from the United States Government. It is the * responsibility of any person or organization contemplating export to * obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of FundsXpress. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. FundsXpress makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* KDC Database interface definitions */ /* This API is not considered as stable as the main krb5 API. * * - We may make arbitrary incompatible changes between feature * releases (e.g. from 1.7 to 1.8). * - We will make some effort to avoid making incompatible changes for * bugfix releases, but will make them if necessary. */ #ifndef KRB5_KDB5__ #define KRB5_KDB5__ #include <krb5.h> /* This version will be incremented when incompatible changes are made to the * KDB API, and will be kept in sync with the libkdb major version. */ #define KRB5_KDB_API_VERSION 8 /* Salt types */ #define KRB5_KDB_SALTTYPE_NORMAL 0 #define KRB5_KDB_SALTTYPE_V4 1 #define KRB5_KDB_SALTTYPE_NOREALM 2 #define KRB5_KDB_SALTTYPE_ONLYREALM 3 #define KRB5_KDB_SALTTYPE_SPECIAL 4 #define KRB5_KDB_SALTTYPE_AFS3 5 #define KRB5_KDB_SALTTYPE_CERTHASH 6 /* Attributes */ #define KRB5_KDB_DISALLOW_POSTDATED 0x00000001 #define KRB5_KDB_DISALLOW_FORWARDABLE 0x00000002 #define KRB5_KDB_DISALLOW_TGT_BASED 0x00000004 #define KRB5_KDB_DISALLOW_RENEWABLE 0x00000008 #define KRB5_KDB_DISALLOW_PROXIABLE 0x00000010 #define KRB5_KDB_DISALLOW_DUP_SKEY 0x00000020 #define KRB5_KDB_DISALLOW_ALL_TIX 0x00000040 #define KRB5_KDB_REQUIRES_PRE_AUTH 0x00000080 #define KRB5_KDB_REQUIRES_HW_AUTH 0x00000100 #define KRB5_KDB_REQUIRES_PWCHANGE 0x00000200 #define KRB5_KDB_DISALLOW_SVR 0x00001000 #define KRB5_KDB_PWCHANGE_SERVICE 0x00002000 #define KRB5_KDB_SUPPORT_DESMD5 0x00004000 #define KRB5_KDB_NEW_PRINC 0x00008000 #define KRB5_KDB_OK_AS_DELEGATE 0x00100000 #define KRB5_KDB_OK_TO_AUTH_AS_DELEGATE 0x00200000 /* S4U2Self OK */ #define KRB5_KDB_NO_AUTH_DATA_REQUIRED 0x00400000 #define KRB5_KDB_LOCKDOWN_KEYS 0x00800000 /* Creation flags */ #define KRB5_KDB_CREATE_BTREE 0x00000001 #define KRB5_KDB_CREATE_HASH 0x00000002 /* Private flag used to indicate principal is local TGS */ #define KRB5_KDB_TICKET_GRANTING_SERVICE 0x01000000 /* Private flag used to indicate xrealm relationship is non-transitive */ #define KRB5_KDB_XREALM_NON_TRANSITIVE 0x02000000 /* Entry get flags */ /* Name canonicalization requested */ #define KRB5_KDB_FLAG_CANONICALIZE 0x00000010 /* Include authorization data generated by backend */ #define KRB5_KDB_FLAG_INCLUDE_PAC 0x00000020 /* Is AS-REQ (client referrals only) */ #define KRB5_KDB_FLAG_CLIENT_REFERRALS_ONLY 0x00000040 /* Map cross-realm principals */ #define KRB5_KDB_FLAG_MAP_PRINCIPALS 0x00000080 /* Protocol transition */ #define KRB5_KDB_FLAG_PROTOCOL_TRANSITION 0x00000100 /* Constrained delegation */ #define KRB5_KDB_FLAG_CONSTRAINED_DELEGATION 0x00000200 /* User-to-user */ #define KRB5_KDB_FLAG_USER_TO_USER 0x00000800 /* Cross-realm */ #define KRB5_KDB_FLAG_CROSS_REALM 0x00001000 /* Allow in-realm aliases */ #define KRB5_KDB_FLAG_ALIAS_OK 0x00002000 #define KRB5_KDB_FLAGS_S4U ( KRB5_KDB_FLAG_PROTOCOL_TRANSITION | \ KRB5_KDB_FLAG_CONSTRAINED_DELEGATION ) /* KDB iteration flags */ #define KRB5_DB_ITER_WRITE 0x00000001 #define KRB5_DB_ITER_REV 0x00000002 #define KRB5_DB_ITER_RECURSE 0x00000004 /* String attribute names recognized by krb5 */ #define KRB5_KDB_SK_SESSION_ENCTYPES "session_enctypes" #define KRB5_KDB_SK_REQUIRE_AUTH "require_auth" #if !defined(_WIN32) /* * Note --- these structures cannot be modified without changing the * database version number in libkdb.a, but should be expandable by * adding new tl_data types. */ typedef struct _krb5_tl_data { struct _krb5_tl_data* tl_data_next; /* NOT saved */ krb5_int16 tl_data_type; krb5_ui_2 tl_data_length; krb5_octet * tl_data_contents; } krb5_tl_data; /* String attributes (currently stored inside tl-data) map C string keys to * values. They can be set via kadmin and consumed by KDC plugins. */ typedef struct krb5_string_attr_st { char *key; char *value; } krb5_string_attr; /* * If this ever changes up the version number and make the arrays be as * big as necessary. * * Currently the first type is the enctype and the second is the salt type. */ typedef struct _krb5_key_data { krb5_int16 key_data_ver; /* Version */ krb5_ui_2 key_data_kvno; /* Key Version */ krb5_int16 key_data_type[2]; /* Array of types */ krb5_ui_2 key_data_length[2]; /* Array of lengths */ krb5_octet * key_data_contents[2]; /* Array of pointers */ } krb5_key_data; #define KRB5_KDB_V1_KEY_DATA_ARRAY 2 /* # of array elements */ typedef struct _krb5_keysalt { krb5_int16 type; krb5_data data; /* Length, data */ } krb5_keysalt; /* * A principal database entry. Extensions to this structure currently use the * tl_data list. The e_data and e_length fields are not used by any calling * code except kdb5_util dump and load, which marshal and unmarshal the array * in the dump record. KDB modules may use these fields internally as long as * they set e_length appropriately (non-zero if the data should be marshalled * across dump and load, zero if not) and handle null e_data values in * caller-constructed principal entries. */ typedef struct _krb5_db_entry_new { krb5_magic magic; /* NOT saved */ krb5_ui_2 len; krb5_ui_4 mask; /* members currently changed/set */ krb5_flags attributes; krb5_deltat max_life; krb5_deltat max_renewable_life; krb5_timestamp expiration; /* When the client expires */ krb5_timestamp pw_expiration; /* When its passwd expires */ krb5_timestamp last_success; /* Last successful passwd */ krb5_timestamp last_failed; /* Last failed passwd attempt */ krb5_kvno fail_auth_count; /* # of failed passwd attempt */ krb5_int16 n_tl_data; krb5_int16 n_key_data; krb5_ui_2 e_length; /* Length of extra data */ krb5_octet * e_data; /* Extra data to be saved */ krb5_principal princ; /* Length, data */ krb5_tl_data * tl_data; /* Linked list */ /* key_data must be sorted by kvno in descending order. */ krb5_key_data * key_data; /* Array */ } krb5_db_entry; typedef struct _osa_policy_ent_t { int version; char *name; krb5_ui_4 pw_min_life; krb5_ui_4 pw_max_life; krb5_ui_4 pw_min_length; krb5_ui_4 pw_min_classes; krb5_ui_4 pw_history_num; krb5_ui_4 policy_refcnt; /* no longer used */ /* Only valid if version > 1 */ krb5_ui_4 pw_max_fail; /* pwdMaxFailure */ krb5_ui_4 pw_failcnt_interval; /* pwdFailureCountInterval */ krb5_ui_4 pw_lockout_duration; /* pwdLockoutDuration */ /* Only valid if version > 2 */ krb5_ui_4 attributes; krb5_ui_4 max_life; krb5_ui_4 max_renewable_life; char * allowed_keysalts; krb5_int16 n_tl_data; krb5_tl_data * tl_data; } osa_policy_ent_rec, *osa_policy_ent_t; typedef void (*osa_adb_iter_policy_func) (void *, osa_policy_ent_t); typedef struct __krb5_key_salt_tuple { krb5_enctype ks_enctype; krb5_int32 ks_salttype; } krb5_key_salt_tuple; #define KRB5_KDB_MAGIC_NUMBER 0xdbdbdbdb #define KRB5_KDB_V1_BASE_LENGTH 38 #define KRB5_KDB_MAX_ALLOWED_KS_LEN 512 #define KRB5_TL_LAST_PWD_CHANGE 0x0001 #define KRB5_TL_MOD_PRINC 0x0002 #define KRB5_TL_KADM_DATA 0x0003 #define KRB5_TL_KADM5_E_DATA 0x0004 #define KRB5_TL_RB1_CHALLENGE 0x0005 #ifdef SECURID #define KRB5_TL_SECURID_STATE 0x0006 #endif /* SECURID */ #define KRB5_TL_USER_CERTIFICATE 0x0007 #define KRB5_TL_MKVNO 0x0008 #define KRB5_TL_ACTKVNO 0x0009 #define KRB5_TL_MKEY_AUX 0x000a /* String attributes may not always be represented in tl-data. kadmin clients * must use the get_strings and set_string RPCs. */ #define KRB5_TL_STRING_ATTRS 0x000b #define KRB5_TL_PAC_LOGON_INFO 0x0100 /* NDR encoded validation info */ #define KRB5_TL_SERVER_REFERRAL 0x0200 /* ASN.1 encoded ServerReferralInfo */ #define KRB5_TL_SVR_REFERRAL_DATA 0x0300 /* ASN.1 encoded PA-SVR-REFERRAL-DATA */ #define KRB5_TL_CONSTRAINED_DELEGATION_ACL 0x0400 /* Each entry is a permitted SPN */ #define KRB5_TL_LM_KEY 0x0500 /* LM OWF */ #define KRB5_TL_X509_SUBJECT_ISSUER_NAME 0x0600 /* <I>IssuerDN<S>SubjectDN */ #define KRB5_TL_LAST_ADMIN_UNLOCK 0x0700 /* Timestamp of admin unlock */ #define KRB5_TL_DB_ARGS 0x7fff /* version number for KRB5_TL_ACTKVNO data */ #define KRB5_TL_ACTKVNO_VER 1 /* version number for KRB5_TL_MKEY_AUX data */ #define KRB5_TL_MKEY_AUX_VER 1 typedef struct _krb5_actkvno_node { struct _krb5_actkvno_node *next; krb5_kvno act_kvno; krb5_timestamp act_time; } krb5_actkvno_node; typedef struct _krb5_mkey_aux_node { struct _krb5_mkey_aux_node *next; krb5_kvno mkey_kvno; /* kvno of mkey protecting the latest_mkey */ krb5_key_data latest_mkey; /* most recent mkey */ } krb5_mkey_aux_node; typedef struct _krb5_keylist_node { krb5_keyblock keyblock; krb5_kvno kvno; struct _krb5_keylist_node *next; } krb5_keylist_node; /* * Determines the number of failed KDC requests before DISALLOW_ALL_TIX is set * on the principal. */ #define KRB5_MAX_FAIL_COUNT 5 /* XXX depends on knowledge of krb5_parse_name() formats */ #define KRB5_KDB_M_NAME "K/M" /* Kerberos/Master */ /* prompts used by default when reading the KDC password from the keyboard. */ #define KRB5_KDC_MKEY_1 "Enter KDC database master key" #define KRB5_KDC_MKEY_2 "Re-enter KDC database master key to verify" extern char *krb5_mkey_pwd_prompt1; extern char *krb5_mkey_pwd_prompt2; /* * These macros specify the encoding of data within the database. * * Data encoding is little-endian. */ #ifdef _KRB5_INT_H #include "k5-platform.h" #define krb5_kdb_decode_int16(cp, i16) \ *((krb5_int16 *) &(i16)) = load_16_le(cp) #define krb5_kdb_decode_int32(cp, i32) \ *((krb5_int32 *) &(i32)) = load_32_le(cp) #define krb5_kdb_encode_int16(i16, cp) store_16_le(i16, cp) #define krb5_kdb_encode_int32(i32, cp) store_32_le(i32, cp) #endif /* _KRB5_INT_H */ #define KRB5_KDB_OPEN_RW 0 #define KRB5_KDB_OPEN_RO 1 #ifndef KRB5_KDB_SRV_TYPE_KDC #define KRB5_KDB_SRV_TYPE_KDC 0x0100 #endif #ifndef KRB5_KDB_SRV_TYPE_ADMIN #define KRB5_KDB_SRV_TYPE_ADMIN 0x0200 #endif /* 0x0300 was KRB5_KDB_SRV_TYPE_PASSWD but it is no longer used. */ #ifndef KRB5_KDB_SRV_TYPE_OTHER #define KRB5_KDB_SRV_TYPE_OTHER 0x0400 #endif #define KRB5_KDB_OPT_SET_DB_NAME 0 #define KRB5_KDB_OPT_SET_LOCK_MODE 1 #define KRB5_DB_LOCKMODE_SHARED 0x0001 #define KRB5_DB_LOCKMODE_EXCLUSIVE 0x0002 #define KRB5_DB_LOCKMODE_PERMANENT 0x0008 /* libkdb.spec */ krb5_error_code krb5_db_setup_lib_handle(krb5_context kcontext); krb5_error_code krb5_db_open( krb5_context kcontext, char **db_args, int mode ); krb5_error_code krb5_db_init ( krb5_context kcontext ); krb5_error_code krb5_db_create ( krb5_context kcontext, char **db_args ); krb5_error_code krb5_db_inited ( krb5_context kcontext ); krb5_error_code kdb5_db_create ( krb5_context kcontext, char **db_args ); krb5_error_code krb5_db_fini ( krb5_context kcontext ); const char * krb5_db_errcode2string ( krb5_context kcontext, long err_code ); krb5_error_code krb5_db_destroy ( krb5_context kcontext, char **db_args ); krb5_error_code krb5_db_promote ( krb5_context kcontext, char **db_args ); krb5_error_code krb5_db_get_age ( krb5_context kcontext, char *db_name, time_t *t ); krb5_error_code krb5_db_lock ( krb5_context kcontext, int lock_mode ); krb5_error_code krb5_db_unlock ( krb5_context kcontext ); krb5_error_code krb5_db_get_principal ( krb5_context kcontext, krb5_const_principal search_for, unsigned int flags, krb5_db_entry **entry ); void krb5_db_free_principal ( krb5_context kcontext, krb5_db_entry *entry ); krb5_error_code krb5_db_put_principal ( krb5_context kcontext, krb5_db_entry *entry ); krb5_error_code krb5_db_delete_principal ( krb5_context kcontext, krb5_principal search_for ); krb5_error_code krb5_db_rename_principal ( krb5_context kcontext, krb5_principal source, krb5_principal target ); /* * Iterate over principals in the KDB. If the callback may write to the DB, * the caller must get an exclusive lock with krb5_db_lock before iterating, * and release it with krb5_db_unlock after iterating. */ krb5_error_code krb5_db_iterate ( krb5_context kcontext, char *match_entry, int (*func) (krb5_pointer, krb5_db_entry *), krb5_pointer func_arg, krb5_flags iterflags ); krb5_error_code krb5_db_store_master_key ( krb5_context kcontext, char *keyfile, krb5_principal mname, krb5_kvno kvno, krb5_keyblock *key, char *master_pwd); krb5_error_code krb5_db_store_master_key_list ( krb5_context kcontext, char *keyfile, krb5_principal mname, char *master_pwd); krb5_error_code krb5_db_fetch_mkey ( krb5_context context, krb5_principal mname, krb5_enctype etype, krb5_boolean fromkeyboard, krb5_boolean twice, char *db_args, krb5_kvno *kvno, krb5_data *salt, krb5_keyblock *key); krb5_error_code krb5_db_fetch_mkey_list( krb5_context context, krb5_principal mname, const krb5_keyblock * mkey ); krb5_error_code krb5_dbe_find_enctype( krb5_context kcontext, krb5_db_entry *dbentp, krb5_int32 ktype, krb5_int32 stype, krb5_int32 kvno, krb5_key_data **kdatap); krb5_error_code krb5_dbe_search_enctype ( krb5_context kcontext, krb5_db_entry *dbentp, krb5_int32 *start, krb5_int32 ktype, krb5_int32 stype, krb5_int32 kvno, krb5_key_data **kdatap); krb5_error_code krb5_db_setup_mkey_name ( krb5_context context, const char *keyname, const char *realm, char **fullname, krb5_principal *principal); /** * Decrypts the key given in @@a key_data. If @a mkey is specified, that * master key is used. If @a mkey is NULL, then all master keys are tried. */ krb5_error_code krb5_dbe_decrypt_key_data( krb5_context context, const krb5_keyblock * mkey, const krb5_key_data * key_data, krb5_keyblock * dbkey, krb5_keysalt * keysalt); krb5_error_code krb5_dbe_encrypt_key_data( krb5_context context, const krb5_keyblock * mkey, const krb5_keyblock * dbkey, const krb5_keysalt * keysalt, int keyver, krb5_key_data * key_data); krb5_error_code krb5_dbe_fetch_act_key_list(krb5_context context, krb5_principal princ, krb5_actkvno_node **act_key_list); krb5_error_code krb5_dbe_find_act_mkey( krb5_context context, krb5_actkvno_node * act_mkey_list, krb5_kvno * act_kvno, krb5_keyblock ** act_mkey); krb5_error_code krb5_dbe_find_mkey( krb5_context context, krb5_db_entry * entry, krb5_keyblock ** mkey); /* Set *mkvno to mkvno in entry tl_data, or 0 if not present. */ krb5_error_code krb5_dbe_lookup_mkvno( krb5_context context, krb5_db_entry * entry, krb5_kvno * mkvno); krb5_keylist_node * krb5_db_mkey_list_alias( krb5_context kcontext ); /* Set *mkvno to mkvno in entry tl_data, or minimum value from mkey_list. */ krb5_error_code krb5_dbe_get_mkvno( krb5_context context, krb5_db_entry * entry, krb5_kvno * mkvno); krb5_error_code krb5_dbe_lookup_mod_princ_data( krb5_context context, krb5_db_entry * entry, krb5_timestamp * mod_time, krb5_principal * mod_princ); krb5_error_code krb5_dbe_lookup_mkey_aux( krb5_context context, krb5_db_entry * entry, krb5_mkey_aux_node ** mkey_aux_data_list); krb5_error_code krb5_dbe_update_mkvno( krb5_context context, krb5_db_entry * entry, krb5_kvno mkvno); krb5_error_code krb5_dbe_lookup_actkvno( krb5_context context, krb5_db_entry * entry, krb5_actkvno_node ** actkvno_list); krb5_error_code krb5_dbe_update_mkey_aux( krb5_context context, krb5_db_entry * entry, krb5_mkey_aux_node * mkey_aux_data_list); krb5_error_code krb5_dbe_update_actkvno(krb5_context context, krb5_db_entry * entry, const krb5_actkvno_node *actkvno_list); krb5_error_code krb5_dbe_update_last_pwd_change( krb5_context context, krb5_db_entry * entry, krb5_timestamp stamp); krb5_error_code krb5_dbe_update_last_admin_unlock( krb5_context context, krb5_db_entry * entry, krb5_timestamp stamp); krb5_error_code krb5_dbe_lookup_tl_data( krb5_context context, krb5_db_entry * entry, krb5_tl_data * ret_tl_data); krb5_error_code krb5_dbe_create_key_data( krb5_context context, krb5_db_entry * entry); krb5_error_code krb5_dbe_update_mod_princ_data( krb5_context context, krb5_db_entry * entry, krb5_timestamp mod_date, krb5_const_principal mod_princ); /* * These are wrappers around realloc() and free(). Applications and KDB * modules can use them when manipulating principal and policy entries to * ensure that they allocate and free memory in a manner compatible with the * library. Using libkrb5 or libkbd5 functions to construct values (such as * krb5_copy_principal() to construct the princ field of a krb5_db_entry) is * also safe. On Unix platforms, just using malloc() and free() is safe as * long as the application or module does not use a malloc replacement. */ void *krb5_db_alloc( krb5_context kcontext, void *ptr, size_t size ); void krb5_db_free( krb5_context kcontext, void *ptr); krb5_error_code krb5_dbe_lookup_last_pwd_change( krb5_context context, krb5_db_entry * entry, krb5_timestamp * stamp); krb5_error_code krb5_dbe_lookup_last_admin_unlock( krb5_context context, krb5_db_entry * entry, krb5_timestamp * stamp); /* Retrieve the set of string attributes in entry, in no particular order. * Free *strings_out with krb5_dbe_free_strings when done. */ krb5_error_code krb5_dbe_get_strings(krb5_context context, krb5_db_entry *entry, krb5_string_attr **strings_out, int *count_out); /* Retrieve a single string attribute from entry, or NULL if there is no * attribute for key. Free *value_out with krb5_dbe_free_string when done. */ krb5_error_code krb5_dbe_get_string(krb5_context context, krb5_db_entry *entry, const char *key, char **value_out); /* Change or add a string attribute in entry, or delete it if value is NULL. */ krb5_error_code krb5_dbe_set_string(krb5_context context, krb5_db_entry *entry, const char *key, const char *value); krb5_error_code krb5_dbe_delete_tl_data( krb5_context context, krb5_db_entry * entry, krb5_int16 tl_data_type); krb5_error_code krb5_db_update_tl_data(krb5_context context, krb5_int16 * n_tl_datap, krb5_tl_data **tl_datap, krb5_tl_data * new_tl_data); krb5_error_code krb5_dbe_update_tl_data( krb5_context context, krb5_db_entry * entry, krb5_tl_data * new_tl_data); /* Compute the salt for a key data entry given the corresponding principal. */ krb5_error_code krb5_dbe_compute_salt(krb5_context context, const krb5_key_data *key, krb5_const_principal princ, krb5_int16 *salttype_out, krb5_data **salt_out); /* * Modify the key data of entry to explicitly store salt values using the * KRB5_KDB_SALTTYPE_SPECIAL salt type. */ krb5_error_code krb5_dbe_specialize_salt(krb5_context context, krb5_db_entry *entry); krb5_error_code krb5_dbe_cpw( krb5_context kcontext, krb5_keyblock * master_key, krb5_key_salt_tuple * ks_tuple, int ks_tuple_count, char * passwd, int new_kvno, krb5_boolean keepold, krb5_db_entry * db_entry); krb5_error_code krb5_dbe_ark( krb5_context context, krb5_keyblock * master_key, krb5_key_salt_tuple * ks_tuple, int ks_tuple_count, krb5_db_entry * db_entry); krb5_error_code krb5_dbe_crk( krb5_context context, krb5_keyblock * master_key, krb5_key_salt_tuple * ks_tuple, int ks_tuple_count, krb5_boolean keepold, krb5_db_entry * db_entry); krb5_error_code krb5_dbe_apw( krb5_context context, krb5_keyblock * master_key, krb5_key_salt_tuple * ks_tuple, int ks_tuple_count, char * passwd, krb5_db_entry * db_entry); int krb5_db_get_key_data_kvno( krb5_context context, int count, krb5_key_data * data); krb5_error_code krb5_db_sign_authdata(krb5_context kcontext, unsigned int flags, krb5_const_principal client_princ, krb5_db_entry *client, krb5_db_entry *server, krb5_db_entry *krbtgt, krb5_keyblock *client_key, krb5_keyblock *server_key, krb5_keyblock *krbtgt_key, krb5_keyblock *session_key, krb5_timestamp authtime, krb5_authdata **tgt_auth_data, krb5_authdata ***signed_auth_data); krb5_error_code krb5_db_check_transited_realms(krb5_context kcontext, const krb5_data *tr_contents, const krb5_data *client_realm, const krb5_data *server_realm); krb5_error_code krb5_db_check_policy_as(krb5_context kcontext, krb5_kdc_req *request, krb5_db_entry *client, krb5_db_entry *server, krb5_timestamp kdc_time, const char **status, krb5_pa_data ***e_data); krb5_error_code krb5_db_check_policy_tgs(krb5_context kcontext, krb5_kdc_req *request, krb5_db_entry *server, krb5_ticket *ticket, const char **status, krb5_pa_data ***e_data); void krb5_db_audit_as_req(krb5_context kcontext, krb5_kdc_req *request, krb5_db_entry *client, krb5_db_entry *server, krb5_timestamp authtime, krb5_error_code error_code); void krb5_db_refresh_config(krb5_context kcontext); krb5_error_code krb5_db_check_allowed_to_delegate(krb5_context kcontext, krb5_const_principal client, const krb5_db_entry *server, krb5_const_principal proxy); /** * Sort an array of @a krb5_key_data keys in descending order by their kvno. * Key data order within a kvno is preserved. * * @param key_data * The @a krb5_key_data array to sort. This is sorted in place so the * array will be modified. * @param key_data_length * The length of @a key_data. */ void krb5_dbe_sort_key_data(krb5_key_data *key_data, size_t key_data_length); /* default functions. Should not be directly called */ /* * Default functions prototype */ krb5_error_code krb5_dbe_def_search_enctype( krb5_context kcontext, krb5_db_entry *dbentp, krb5_int32 *start, krb5_int32 ktype, krb5_int32 stype, krb5_int32 kvno, krb5_key_data **kdatap); krb5_error_code krb5_def_store_mkey_list( krb5_context context, char *keyfile, krb5_principal mname, krb5_keylist_node *keylist, char *master_pwd); krb5_error_code krb5_db_def_fetch_mkey( krb5_context context, krb5_principal mname, krb5_keyblock *key, krb5_kvno *kvno, char *db_args); krb5_error_code krb5_def_fetch_mkey_list( krb5_context context, krb5_principal mprinc, const krb5_keyblock *mkey, krb5_keylist_node **mkeys_list); krb5_error_code krb5_dbe_def_cpw( krb5_context context, krb5_keyblock * master_key, krb5_key_salt_tuple * ks_tuple, int ks_tuple_count, char * passwd, int new_kvno, krb5_boolean keepold, krb5_db_entry * db_entry); krb5_error_code krb5_dbe_def_decrypt_key_data( krb5_context context, const krb5_keyblock * mkey, const krb5_key_data * key_data, krb5_keyblock * dbkey, krb5_keysalt * keysalt); krb5_error_code krb5_dbe_def_encrypt_key_data( krb5_context context, const krb5_keyblock * mkey, const krb5_keyblock * dbkey, const krb5_keysalt * keysalt, int keyver, krb5_key_data * key_data); krb5_error_code krb5_db_def_rename_principal( krb5_context kcontext, krb5_const_principal source, krb5_const_principal target); krb5_error_code krb5_db_create_policy( krb5_context kcontext, osa_policy_ent_t policy); krb5_error_code krb5_db_get_policy ( krb5_context kcontext, char *name, osa_policy_ent_t *policy ); krb5_error_code krb5_db_put_policy( krb5_context kcontext, osa_policy_ent_t policy); krb5_error_code krb5_db_iter_policy( krb5_context kcontext, char *match_entry, osa_adb_iter_policy_func func, void *data); krb5_error_code krb5_db_delete_policy( krb5_context kcontext, char *policy); void krb5_db_free_policy( krb5_context kcontext, osa_policy_ent_t policy); krb5_error_code krb5_db_set_context(krb5_context, void *db_context); krb5_error_code krb5_db_get_context(krb5_context, void **db_context); void krb5_dbe_free_key_data_contents(krb5_context, krb5_key_data *); void krb5_dbe_free_key_list(krb5_context, krb5_keylist_node *); void krb5_dbe_free_actkvno_list(krb5_context, krb5_actkvno_node *); void krb5_dbe_free_mkey_aux_list(krb5_context, krb5_mkey_aux_node *); void krb5_dbe_free_tl_data(krb5_context, krb5_tl_data *); void krb5_dbe_free_strings(krb5_context, krb5_string_attr *, int count); void krb5_dbe_free_string(krb5_context, char *); /* * Register the KDB keytab type, allowing "KDB:" to be used as a keytab name. * For this type to work, the context used for keytab operations must have an * associated database handle (via krb5_db_open()). */ krb5_error_code krb5_db_register_keytab(krb5_context context); #define KRB5_KDB_DEF_FLAGS 0 #define KDB_MAX_DB_NAME 128 #define KDB_REALM_SECTION "realms" #define KDB_MODULE_POINTER "database_module" #define KDB_MODULE_DEF_SECTION "dbdefaults" #define KDB_MODULE_SECTION "dbmodules" #define KDB_LIB_POINTER "db_library" #define KDB_DATABASE_CONF_FILE DEFAULT_SECURE_PROFILE_PATH #define KDB_DATABASE_ENV_PROF KDC_PROFILE_ENV #define KRB5_KDB_OPEN_RW 0 #define KRB5_KDB_OPEN_RO 1 #define KRB5_KDB_OPT_SET_DB_NAME 0 #define KRB5_KDB_OPT_SET_LOCK_MODE 1 /* * This number indicates the date of the last incompatible change to the DAL. * The maj_ver field of the module's vtable structure must match this version. */ #define KRB5_KDB_DAL_MAJOR_VERSION 6 /* * A krb5_context can hold one database object. Modules should use * krb5_db_set_context and krb5_db_get_context to store state associated with * the database object. * * Some module functions are mandatory for KDC operation; others are optional * or apply only to administrative operations. If a function is optional, a * module can leave the function pointer as NULL. Alternatively, modules can * return KRB5_PLUGIN_OP_NOTSUPP when asked to perform an inapplicable action. * * Some module functions have default implementations which will call back into * the vtable interface. Leave these functions as NULL to use the default * implementations. * * The documentation in these comments describes the DAL as it is currently * implemented and used, not as it should be. So if anything seems off, that * probably means the current state of things is off. * * Modules must allocate memory for principal entries, policy entries, and * other structures using an allocator compatible with malloc() as seen by * libkdb5 and libkrb5. Modules may link against libkdb5 and call * krb5_db_alloc() to be certain that the same malloc implementation is used. */ typedef struct _kdb_vftabl { short int maj_ver; short int min_ver; /* * Mandatory: Invoked after the module library is loaded, when the first DB * using the module is opened, across all contexts. */ krb5_error_code (*init_library)(void); /* * Mandatory: Invoked before the module library is unloaded, after the last * DB using the module is closed, across all contexts. */ krb5_error_code (*fini_library)(void); /* * Mandatory: Initialize a database object. Profile settings should be * read from conf_section inside KDB_MODULE_SECTION. db_args communicates * command-line arguments for module-specific flags. mode will be one of * KRB5_KDB_OPEN_{RW,RO} or'd with one of * KRB5_KDB_SRV_TYPE_{KDC,ADMIN,PASSWD,OTHER}. */ krb5_error_code (*init_module)(krb5_context kcontext, char *conf_section, char **db_args, int mode); /* * Mandatory: Finalize the database object contained in a context. Free * any state contained in the db_context pointer and null it out. */ krb5_error_code (*fini_module)(krb5_context kcontext); /* * Optional: Initialize a database object while creating the underlying * database. conf_section and db_args have the same meaning as in * init_module. This function may return an error if the database already * exists. Used by kdb5_util create. * * If db_args contains the value "temporary", the module should create an * exclusively locked side copy of the database suitable for loading in a * propagation from master to slave. This side copy will later be promoted * with promote_db, allowing complete updates of the DB with no loss in * read availability. If the module cannot comply with this architecture, * it should return an error. */ krb5_error_code (*create)(krb5_context kcontext, char *conf_section, char **db_args); /* * Optional: Destroy a database. conf_section and db_args have the same * meaning as in init_module. Used by kdb5_util destroy. In current * usage, the database is destroyed while open, so the module should handle * that. */ krb5_error_code (*destroy)(krb5_context kcontext, char *conf_section, char **db_args); /* * Deprecated: No longer used as of krb5 1.10; can be removed in the next * DAL revision. Modules should leave as NULL. */ krb5_error_code (*get_age)(krb5_context kcontext, char *db_name, time_t *age); /* * Optional: Lock the database, with semantics depending on the mode * argument: * * KRB5_DB_LOCKMODE_SHARED: Lock may coexist with other shared locks. * KRB5_DB_LOCKMODE_EXCLUSIVE: Lock may not coexist with other locks. * KRB5_DB_LOCKMODE_PERMANENT: Exclusive lock surviving process exit. * * Used by the "kadmin lock" command, incremental propagation, and * kdb5_util dump. Incremental propagation support requires shared locks * to operate. kdb5_util dump will continue unlocked if the module returns * KRB5_PLUGIN_OP_NOTSUPP. */ krb5_error_code (*lock)(krb5_context kcontext, int mode); /* Optional: Release a lock created with db_lock. */ krb5_error_code (*unlock)(krb5_context kcontext); /* * Mandatory: Set *entry to an allocated entry for the principal * search_for. If the principal is not found, return KRB5_KDB_NOENTRY. * * The meaning of flags are as follows: * * KRB5_KDB_FLAG_CANONICALIZE: Set by the KDC when looking up entries for * an AS or TGS request with canonicalization requested. Determines * whether the module should return out-of-realm referrals. * * KRB5_KDB_FLAG_INCLUDE_PAC: Set by the KDC during an AS request when the * client requested PAC information during padata, and during most TGS * requests. Indicates that the module should include PAC information * when its sign_authdata method is invoked. * * KRB5_KDB_FLAG_CLIENT_REFERRALS_ONLY: Set by the KDC when looking up the * client entry in an AS request. Affects how the module should return * out-of-realm referrals. * * KRB5_KDB_FLAG_MAP_PRINCIPALS: Set by the KDC when looking up the client * entry during TGS requests, except for S4U TGS requests and requests * where the server entry has the KRB5_KDB_NO_AUTH_DATA_REQUIRED * attribute. Indicates that the module should map foreign principals * to local principals if it supports doing so. * * KRB5_KDB_FLAG_PROTOCOL_TRANSITION: Set by the KDC when looking up the * client entry during an S4U2Self TGS request. This affects the PAC * information which should be included when authorization data is * generated; see the Microsoft S4U specification for details. * * KRB5_KDB_FLAG_CONSTRAINED_DELEGATION: Set by the KDC when looking up the * client entry during an S4U2Proxy TGS request. Also affects PAC * generation. * * KRB5_KDB_FLAG_CROSS_REALM: Set by the KDC when looking up a client entry * during a TGS request, if the client principal is not part of the * realm being served. * * KRB5_KDB_FLAG_ALIAS_OK: Set by the KDC for server principal lookups and * for AS request client principal lookups with canonicalization * requested; also set by the admin interface. Determines whether the * module should return in-realm aliases. * * A module can return in-realm aliases if KRB5_KDB_FLAG_ALIAS_OK is set. * To return an in-realm alias, fill in a different value for * entries->princ than the one requested. * * A module can return out-of-realm referrals if KRB5_KDB_FLAG_CANONICALIZE * is set. For AS request clients (KRB5_KDB_FLAG_CLIENT_REFERRALS_ONLY is * also set), the module should do so by simply filling in an out-of-realm * name in entries->princ and setting all other fields to NULL. Otherwise, * the module should return the entry for the cross-realm TGS of the * referred-to realm. For TGS referals, the module can also include * tl-data of type KRB5_TL_SERVER_REFERRAL containing ASN.1-encoded Windows * referral data as documented in draft-ietf-krb-wg-kerberos-referrals-11 * appendix A; this will be returned to the client as encrypted padata. */ krb5_error_code (*get_principal)(krb5_context kcontext, krb5_const_principal search_for, unsigned int flags, krb5_db_entry **entry); /* * Optional: Create or modify a principal entry. db_args communicates * command-line arguments for module-specific flags. * * The mask field of an entry indicates the changed fields. Mask values * are defined in kadmin's admin.h header. If KADM5_PRINCIPAL is set in * the mask, the entry is new; otherwise it already exists. All fields of * an entry are expected to contain correct values, regardless of whether * they are specified in the mask, so it is acceptable for a module to * ignore the mask and update the entire entry. */ krb5_error_code (*put_principal)(krb5_context kcontext, krb5_db_entry *entry, char **db_args); /* * Optional: Delete the entry for the principal search_for. If the * principal did not exist, return KRB5_KDB_NOENTRY. */ krb5_error_code (*delete_principal)(krb5_context kcontext, krb5_const_principal search_for); /* * Optional with default: Rename a principal. If the source principal does * not exist, return KRB5_KDB_NOENTRY. If the target exists, return an * error. * * NOTE: If the module chooses to implement a custom function for renaming * a principal instead of using the default, then rename operations will * fail if iprop logging is enabled. */ krb5_error_code (*rename_principal)(krb5_context kcontext, krb5_const_principal source, krb5_const_principal target); /* * Optional: For each principal entry in the database, invoke func with the * argments func_arg and the entry data. If match_entry is specified, the * module may narrow the iteration to principal names matching that regular * expression; a module may alternatively ignore match_entry. */ krb5_error_code (*iterate)(krb5_context kcontext, char *match_entry, int (*func)(krb5_pointer, krb5_db_entry *), krb5_pointer func_arg, krb5_flags iterflags); /* * Optional: Create a password policy entry. Return an error if the policy * already exists. */ krb5_error_code (*create_policy)(krb5_context kcontext, osa_policy_ent_t policy); /* * Optional: Set *policy to the policy entry of the specified name. If the * entry does not exist, return KRB5_KDB_NOENTRY. */ krb5_error_code (*get_policy)(krb5_context kcontext, char *name, osa_policy_ent_t *policy); /* * Optional: Modify an existing password policy entry to match the values * in policy. Return an error if the policy does not already exist. */ krb5_error_code (*put_policy)(krb5_context kcontext, osa_policy_ent_t policy); /* * Optional: For each password policy entry in the database, invoke func * with the argments data and the entry data. If match_entry is specified, * the module may narrow the iteration to policy names matching that * regular expression; a module may alternatively ignore match_entry. */ krb5_error_code (*iter_policy)(krb5_context kcontext, char *match_entry, osa_adb_iter_policy_func func, void *data); /* * Optional: Delete the password policy entry with the name policy. Return * an error if the entry does not exist. */ krb5_error_code (*delete_policy)(krb5_context kcontext, char *policy); /* * Optional with default: Retrieve a master keyblock from the stash file * db_args, filling in *key and *kvno. mname is the name of the master * principal for the realm. * * The default implementation reads the master keyblock from a keytab or * old-format stash file. */ krb5_error_code (*fetch_master_key)(krb5_context kcontext, krb5_principal mname, krb5_keyblock *key, krb5_kvno *kvno, char *db_args); /* * Optional with default: Given a keyblock for some version of the * database's master key, fetch the decrypted master key values from the * database and store the list into *mkeys_list. The caller will free * *mkeys_list using a libkdb5 function which uses the standard free() * function, so the module must not use a custom allocator. * * The caller may not know the version number of the master key it has, in * which case it will pass IGNORE_VNO. * * The default implementation ignores kvno and tries the key against the * current master key data and all KRB5_TL_MKEY_AUX values, which contain * copies of the master keys encrypted with old master keys. */ krb5_error_code (*fetch_master_key_list)(krb5_context kcontext, krb5_principal mname, const krb5_keyblock *key, krb5_keylist_node **mkeys_list); /* * Optional with default: Save a list of master keyblocks, obtained from * fetch_master_key_list, into the stash file db_arg. The caller will set * master_pwd to NULL, so the module should just ignore it. mname is the * name of the master principal for the realm. * * The default implementation saves the list of master keys in a * keytab-format file. */ krb5_error_code (*store_master_key_list)(krb5_context kcontext, char *db_arg, krb5_principal mname, krb5_keylist_node *keylist, char *master_pwd); /* * Optional with default: Starting at position *start, scan the key data of * a database entry for a key matching the enctype ktype, the salt type * stype, and the version kvno. Store the resulting key into *kdatap and * set *start to the position after the key found. If ktype is negative, * match any enctype. If stype is negative, match any salt type. If kvno * is zero or negative, find the most recent key version satisfying the * other constraints. */ krb5_error_code (*dbe_search_enctype)(krb5_context kcontext, krb5_db_entry *dbentp, krb5_int32 *start, krb5_int32 ktype, krb5_int32 stype, krb5_int32 kvno, krb5_key_data **kdatap); /* * Optional with default: Change the key data for db_entry to include keys * derived from the password passwd in each of the specified key-salt * types, at version new_kvno. Discard the old key data if keepold is not * set. * * The default implementation uses the keyblock master_key to encrypt each * new key, via the function encrypt_key_data. */ krb5_error_code (*change_pwd)(krb5_context context, krb5_keyblock *master_key, krb5_key_salt_tuple *ks_tuple, int ks_tuple_count, char *passwd, int new_kvno, krb5_boolean keepold, krb5_db_entry *db_entry); /* * Optional: Promote a temporary database to be the live one. context must * be initialized with an exclusively locked database created with the * "temporary" db_arg. On success, the database object contained in * context will be finalized. * * This method is used by kdb5_util load to replace the live database with * minimal loss of read availability. */ krb5_error_code (*promote_db)(krb5_context context, char *conf_section, char **db_args); /* * Optional with default: Decrypt the key in key_data with master keyblock * mkey, placing the result into dbkey. Copy the salt from key_data, if * any, into keysalt. Either dbkey or keysalt may be left unmodified on * successful return if key_data does not contain key or salt information. * * The default implementation expects the encrypted key (in krb5_c_encrypt * format) to be stored in key_data_contents[0], with length given by * key_data_length[0]. If key_data_ver is 2, it expects the salt to be * stored, unencrypted, in key_data_contents[1], with length given by * key_data_length[1]. */ krb5_error_code (*decrypt_key_data)(krb5_context kcontext, const krb5_keyblock *mkey, const krb5_key_data *key_data, krb5_keyblock *dbkey, krb5_keysalt *keysalt); /* * Optional with default: Encrypt dbkey with master keyblock mkey, placing * the result into key_data along with keysalt. * * The default implementation stores the encrypted key (in krb5_c_encrypt * format) in key_data_contents[0] and the length in key_data_length[0]. * If keysalt is specified, it sets key_data_ver to 2, and stores the salt * in key_data_contents[1] and its length in key_data_length[1]. If * keysalt is not specified, key_data_ver is set to 1. */ krb5_error_code (*encrypt_key_data)(krb5_context kcontext, const krb5_keyblock *mkey, const krb5_keyblock *dbkey, const krb5_keysalt *keysalt, int keyver, krb5_key_data *key_data); /* * Optional: Generate signed authorization data, such as a Windows PAC, for * the ticket to be returned to the client. Place the signed authorization * data, if any, in *signed_auth_data. This function will be invoked for * an AS request if the client included padata requesting a PAC. This * function will be invoked for a TGS request if there is authorization * data in the TGT, if the client is from another realm, or if the TGS * request is an S4U2Self or S4U2Proxy request. This function will not be * invoked during TGS requests if the server principal has the * no_auth_data_required attribute set. Input parameters are: * * flags: The flags used to look up the client principal. * * client_princ: For S4U2Proxy TGS requests, the client principal * requested by the service; for regular TGS requests, the * possibly-canonicalized client principal. * * client: The DB entry of the client. For S4U2Self, this will be the DB * entry for the client principal requested by the service). * * server: The DB entry of the service principal. * * krbtgt: For TGS requests, the DB entry of the server of the ticket in * the PA-TGS-REQ padata; this is usually a local or cross-realm krbtgt * principal, but not always. For AS requests, the DB entry of the * service principal; this is usually a local krbtgt principal, but not * always. * * client_key: The reply key for the KDC request, before any FAST armor * is applied. For AS requests, this may be the client's long-term key * or a key chosen by a preauth mechanism. For TGS requests, this may * be the subkey found in the AP-REQ or the session key of the TGT. * * server_key: The server key used to encrypt the returned ticket. * * krbtgt_key: For TGS requests, the key used to decrypt the ticket in * the PA-TGS-REQ padata. For AS requests, the server key used to * encrypt the returned ticket. * * session_key: The session key of the ticket being granted to the * requestor. * * authtime: The timestamp of the original client authentication time. * For AS requests, this is the current time. For TGS requests, this * is the authtime of the subject ticket (TGT or S4U2Proxy evidence * ticket). * * tgt_auth_data: For TGS requests, the authorization data present in the * subject ticket. For AS requests, NULL. */ krb5_error_code (*sign_authdata)(krb5_context kcontext, unsigned int flags, krb5_const_principal client_princ, krb5_db_entry *client, krb5_db_entry *server, krb5_db_entry *krbtgt, krb5_keyblock *client_key, krb5_keyblock *server_key, krb5_keyblock *krbtgt_key, krb5_keyblock *session_key, krb5_timestamp authtime, krb5_authdata **tgt_auth_data, krb5_authdata ***signed_auth_data); /* * Optional: Perform a policy check on a cross-realm ticket's transited * field. Return 0 if the check authoritatively succeeds, * KRB5_PLUGIN_NO_HANDLE to use the core transited-checking mechanisms, or * another error (other than KRB5_PLUGIN_OP_NOTSUPP) if the check fails. */ krb5_error_code (*check_transited_realms)(krb5_context kcontext, const krb5_data *tr_contents, const krb5_data *client_realm, const krb5_data *server_realm); /* * Optional: Perform a policy check on an AS request, in addition to the * standard policy checks. Return 0 if the AS request is allowed. If the * AS request is not allowed: * - Place a short string literal into *status. * - If desired, place data into e_data. Any data placed here will be * freed by the caller using the standard free function. * - Return an appropriate error (such as KRB5KDC_ERR_POLICY). */ krb5_error_code (*check_policy_as)(krb5_context kcontext, krb5_kdc_req *request, krb5_db_entry *client, krb5_db_entry *server, krb5_timestamp kdc_time, const char **status, krb5_pa_data ***e_data); /* * Optional: Perform a policy check on a TGS request, in addition to the * standard policy checks. Return 0 if the TGS request is allowed. If the * TGS request is not allowed: * - Place a short string literal into *status. * - If desired, place data into e_data. Any data placed here will be * freed by the caller using the standard free function. * - Return an appropriate error (such as KRB5KDC_ERR_POLICY). * The input parameter ticket contains the TGT used in the TGS request. */ krb5_error_code (*check_policy_tgs)(krb5_context kcontext, krb5_kdc_req *request, krb5_db_entry *server, krb5_ticket *ticket, const char **status, krb5_pa_data ***e_data); /* * Optional: This method informs the module of a successful or unsuccessful * AS request. */ void (*audit_as_req)(krb5_context kcontext, krb5_kdc_req *request, krb5_db_entry *client, krb5_db_entry *server, krb5_timestamp authtime, krb5_error_code error_code); /* Note: there is currently no method for auditing TGS requests. */ /* * Optional: This method informs the module of a request to reload * configuration or other state (that is, the KDC received a SIGHUP). */ void (*refresh_config)(krb5_context kcontext); /* * Optional: Perform a policy check on server being allowed to obtain * tickets from client to proxy. (Note that proxy is the target of the * delegation, not the delegating service; the term "proxy" is from the * viewpoint of the delegating service asking another service to perform * some of its work in the authentication context of the client. This * terminology comes from the Microsoft S4U protocol documentation.) * Return 0 if policy allows it, or an appropriate error (such as * KRB5KDC_ERR_POLICY) if not. If this method is not implemented, all * S4U2Proxy delegation requests will be rejected. */ krb5_error_code (*check_allowed_to_delegate)(krb5_context context, krb5_const_principal client, const krb5_db_entry *server, krb5_const_principal proxy); /* End of minor version 0. */ /* * Optional: Free the e_data pointer of a database entry. If this method * is not implemented, the e_data pointer in principal entries will be * freed with free() as seen by libkdb5. */ void (*free_principal_e_data)(krb5_context kcontext, krb5_octet *e_data); /* End of minor version 1 for major version 6. */ } kdb_vftabl; #endif /* !defined(_WIN32) */ #endif /* KRB5_KDB5__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netdb.h���������������������������������������������������������������������������������������������0000644�����������������00000066723�14763166027�0006043 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Copyright (C) 1996-2004, 2009-2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* All data returned by the network data base library are supplied in host order and returned in network order (suitable for use in system calls). */ #ifndef _NETDB_H #define _NETDB_H 1 #include <features.h> #include <netinet/in.h> #include <stdint.h> #ifdef __USE_MISC /* This is necessary to make this include file properly replace the Sun version. */ # include <rpc/netdb.h> #endif #ifdef __USE_GNU # define __need_sigevent_t # include <bits/siginfo.h> # define __need_timespec # include <time.h> #endif #include <bits/netdb.h> /* Absolute file name for network data base files. */ #define _PATH_HEQUIV "/etc/hosts.equiv" #define _PATH_HOSTS "/etc/hosts" #define _PATH_NETWORKS "/etc/networks" #define _PATH_NSSWITCH_CONF "/etc/nsswitch.conf" #define _PATH_PROTOCOLS "/etc/protocols" #define _PATH_SERVICES "/etc/services" __BEGIN_DECLS #if defined __USE_MISC || !defined __USE_XOPEN2K8 /* Error status for non-reentrant lookup functions. We use a macro to access always the thread-specific `h_errno' variable. */ # define h_errno (*__h_errno_location ()) /* Function to get address of global `h_errno' variable. */ extern int *__h_errno_location (void) __THROW __attribute__ ((__const__)); /* Possible values left in `h_errno'. */ # define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */ # define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL. */ # define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP. */ # define NO_DATA 4 /* Valid name, no data record of requested type. */ #endif #if defined __USE_MISC || defined __USE_GNU # define NETDB_INTERNAL -1 /* See errno. */ # define NETDB_SUCCESS 0 /* No problem. */ # define NO_ADDRESS NO_DATA /* No address, look for MX record. */ #endif #if defined __USE_XOPEN2K || defined __USE_XOPEN_EXTENDED /* Highest reserved Internet port number. */ # define IPPORT_RESERVED 1024 #endif #ifdef __USE_GNU /* Scope delimiter for getaddrinfo(), getnameinfo(). */ # define SCOPE_DELIMITER '%' #endif #ifdef __USE_MISC /* Print error indicated by `h_errno' variable on standard error. STR if non-null is printed before the error string. */ extern void herror (const char *__str) __THROW; /* Return string associated with error ERR_NUM. */ extern const char *hstrerror (int __err_num) __THROW; #endif /* Description of data base entry for a single host. */ struct hostent { char *h_name; /* Official name of host. */ char **h_aliases; /* Alias list. */ int h_addrtype; /* Host address type. */ int h_length; /* Length of address. */ char **h_addr_list; /* List of addresses from name server. */ #if defined __USE_MISC || defined __USE_GNU # define h_addr h_addr_list[0] /* Address, for backward compatibility.*/ #endif }; /* Open host data base files and mark them as staying open even after a later search if STAY_OPEN is non-zero. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void sethostent (int __stay_open); /* Close host data base files and clear `stay open' flag. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void endhostent (void); /* Get next entry from host data base file. Open data base if necessary. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct hostent *gethostent (void); /* Return entry from host data base which address match ADDR with length LEN and type TYPE. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct hostent *gethostbyaddr (const void *__addr, __socklen_t __len, int __type); /* Return entry from host data base for host with NAME. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct hostent *gethostbyname (const char *__name); #ifdef __USE_MISC /* Return entry from host data base for host with NAME. AF must be set to the address type which is `AF_INET' for IPv4 or `AF_INET6' for IPv6. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern struct hostent *gethostbyname2 (const char *__name, int __af); /* Reentrant versions of the functions above. The additional arguments specify a buffer of BUFLEN starting at BUF. The last argument is a pointer to a variable which gets the value which would be stored in the global variable `herrno' by the non-reentrant functions. These functions are not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation they are cancellation points and therefore not marked with __THROW. */ extern int gethostent_r (struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, int *__restrict __h_errnop); extern int gethostbyaddr_r (const void *__restrict __addr, __socklen_t __len, int __type, struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, int *__restrict __h_errnop); extern int gethostbyname_r (const char *__restrict __name, struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, int *__restrict __h_errnop); extern int gethostbyname2_r (const char *__restrict __name, int __af, struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, int *__restrict __h_errnop); #endif /* misc */ /* Open network data base files and mark them as staying open even after a later search if STAY_OPEN is non-zero. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void setnetent (int __stay_open); /* Close network data base files and clear `stay open' flag. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void endnetent (void); /* Get next entry from network data base file. Open data base if necessary. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct netent *getnetent (void); /* Return entry from network data base which address match NET and type TYPE. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct netent *getnetbyaddr (uint32_t __net, int __type); /* Return entry from network data base for network with NAME. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct netent *getnetbyname (const char *__name); #ifdef __USE_MISC /* Reentrant versions of the functions above. The additional arguments specify a buffer of BUFLEN starting at BUF. The last argument is a pointer to a variable which gets the value which would be stored in the global variable `herrno' by the non-reentrant functions. These functions are not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation they are cancellation points and therefore not marked with __THROW. */ extern int getnetent_r (struct netent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct netent **__restrict __result, int *__restrict __h_errnop); extern int getnetbyaddr_r (uint32_t __net, int __type, struct netent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct netent **__restrict __result, int *__restrict __h_errnop); extern int getnetbyname_r (const char *__restrict __name, struct netent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct netent **__restrict __result, int *__restrict __h_errnop); #endif /* misc */ /* Description of data base entry for a single service. */ struct servent { char *s_name; /* Official service name. */ char **s_aliases; /* Alias list. */ int s_port; /* Port number. */ char *s_proto; /* Protocol to use. */ }; /* Open service data base files and mark them as staying open even after a later search if STAY_OPEN is non-zero. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void setservent (int __stay_open); /* Close service data base files and clear `stay open' flag. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void endservent (void); /* Get next entry from service data base file. Open data base if necessary. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct servent *getservent (void); /* Return entry from network data base for network with NAME and protocol PROTO. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct servent *getservbyname (const char *__name, const char *__proto); /* Return entry from service data base which matches port PORT and protocol PROTO. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct servent *getservbyport (int __port, const char *__proto); #ifdef __USE_MISC /* Reentrant versions of the functions above. The additional arguments specify a buffer of BUFLEN starting at BUF. These functions are not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation they are cancellation points and therefore not marked with __THROW. */ extern int getservent_r (struct servent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct servent **__restrict __result); extern int getservbyname_r (const char *__restrict __name, const char *__restrict __proto, struct servent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct servent **__restrict __result); extern int getservbyport_r (int __port, const char *__restrict __proto, struct servent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct servent **__restrict __result); #endif /* misc */ /* Description of data base entry for a single service. */ struct protoent { char *p_name; /* Official protocol name. */ char **p_aliases; /* Alias list. */ int p_proto; /* Protocol number. */ }; /* Open protocol data base files and mark them as staying open even after a later search if STAY_OPEN is non-zero. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void setprotoent (int __stay_open); /* Close protocol data base files and clear `stay open' flag. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void endprotoent (void); /* Get next entry from protocol data base file. Open data base if necessary. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct protoent *getprotoent (void); /* Return entry from protocol data base for network with NAME. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct protoent *getprotobyname (const char *__name); /* Return entry from protocol data base which number is PROTO. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct protoent *getprotobynumber (int __proto); #ifdef __USE_MISC /* Reentrant versions of the functions above. The additional arguments specify a buffer of BUFLEN starting at BUF. These functions are not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation they are cancellation points and therefore not marked with __THROW. */ extern int getprotoent_r (struct protoent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct protoent **__restrict __result); extern int getprotobyname_r (const char *__restrict __name, struct protoent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct protoent **__restrict __result); extern int getprotobynumber_r (int __proto, struct protoent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct protoent **__restrict __result); /* Establish network group NETGROUP for enumeration. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int setnetgrent (const char *__netgroup); /* Free all space allocated by previous `setnetgrent' call. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern void endnetgrent (void); /* Get next member of netgroup established by last `setnetgrent' call and return pointers to elements in HOSTP, USERP, and DOMAINP. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int getnetgrent (char **__restrict __hostp, char **__restrict __userp, char **__restrict __domainp); /* Test whether NETGROUP contains the triple (HOST,USER,DOMAIN). This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int innetgr (const char *__netgroup, const char *__host, const char *__user, const char *__domain); /* Reentrant version of `getnetgrent' where result is placed in BUFFER. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int getnetgrent_r (char **__restrict __hostp, char **__restrict __userp, char **__restrict __domainp, char *__restrict __buffer, size_t __buflen); #endif /* misc */ #ifdef __USE_BSD /* Call `rshd' at port RPORT on remote machine *AHOST to execute CMD. The local user is LOCUSER, on the remote machine the command is executed as REMUSER. In *FD2P the descriptor to the socket for the connection is returned. The caller must have the right to use a reserved port. When the function returns *AHOST contains the official host name. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int rcmd (char **__restrict __ahost, unsigned short int __rport, const char *__restrict __locuser, const char *__restrict __remuser, const char *__restrict __cmd, int *__restrict __fd2p); /* This is the equivalent function where the protocol can be selected and which therefore can be used for IPv6. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport, const char *__restrict __locuser, const char *__restrict __remuser, const char *__restrict __cmd, int *__restrict __fd2p, sa_family_t __af); /* Call `rexecd' at port RPORT on remote machine *AHOST to execute CMD. The process runs at the remote machine using the ID of user NAME whose cleartext password is PASSWD. In *FD2P the descriptor to the socket for the connection is returned. When the function returns *AHOST contains the official host name. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int rexec (char **__restrict __ahost, int __rport, const char *__restrict __name, const char *__restrict __pass, const char *__restrict __cmd, int *__restrict __fd2p); /* This is the equivalent function where the protocol can be selected and which therefore can be used for IPv6. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int rexec_af (char **__restrict __ahost, int __rport, const char *__restrict __name, const char *__restrict __pass, const char *__restrict __cmd, int *__restrict __fd2p, sa_family_t __af); /* Check whether user REMUSER on system RHOST is allowed to login as LOCUSER. If SUSER is not zero the user tries to become superuser. Return 0 if it is possible. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int ruserok (const char *__rhost, int __suser, const char *__remuser, const char *__locuser); /* This is the equivalent function where the protocol can be selected and which therefore can be used for IPv6. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int ruserok_af (const char *__rhost, int __suser, const char *__remuser, const char *__locuser, sa_family_t __af); /* Check whether user REMUSER on system indicated by IPv4 address RADDR is allowed to login as LOCUSER. Non-IPv4 (e.g., IPv6) are not supported. If SUSER is not zero the user tries to become superuser. Return 0 if it is possible. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int iruserok (uint32_t __raddr, int __suser, const char *__remuser, const char *__locuser); /* This is the equivalent function where the pfamiliy if the address pointed to by RADDR is determined by the value of AF. It therefore can be used for IPv6 This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int iruserok_af (const void *__raddr, int __suser, const char *__remuser, const char *__locuser, sa_family_t __af); /* Try to allocate reserved port, returning a descriptor for a socket opened at this port or -1 if unsuccessful. The search for an available port will start at ALPORT and continues with lower numbers. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int rresvport (int *__alport); /* This is the equivalent function where the protocol can be selected and which therefore can be used for IPv6. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int rresvport_af (int *__alport, sa_family_t __af); #endif /* Extension from POSIX.1g. */ #ifdef __USE_POSIX /* Structure to contain information about address of a service provider. */ struct addrinfo { int ai_flags; /* Input flags. */ int ai_family; /* Protocol family for socket. */ int ai_socktype; /* Socket type. */ int ai_protocol; /* Protocol for socket. */ socklen_t ai_addrlen; /* Length of socket address. */ struct sockaddr *ai_addr; /* Socket address for socket. */ char *ai_canonname; /* Canonical name for service location. */ struct addrinfo *ai_next; /* Pointer to next in list. */ }; # ifdef __USE_GNU /* Structure used as control block for asynchronous lookup. */ struct gaicb { const char *ar_name; /* Name to look up. */ const char *ar_service; /* Service name. */ const struct addrinfo *ar_request; /* Additional request specification. */ struct addrinfo *ar_result; /* Pointer to result. */ /* The following are internal elements. */ int __return; int __unused[5]; }; /* Lookup mode. */ # define GAI_WAIT 0 # define GAI_NOWAIT 1 # endif /* Possible values for `ai_flags' field in `addrinfo' structure. */ # define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */ # define AI_CANONNAME 0x0002 /* Request for canonical name. */ # define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */ # define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */ # define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */ # define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose returned address type.. */ # ifdef __USE_GNU # define AI_IDN 0x0040 /* IDN encode input (assuming it is encoded in the current locale's character set) before looking it up. */ # define AI_CANONIDN 0x0080 /* Translate canonical name from IDN format. */ # define AI_IDN_ALLOW_UNASSIGNED 0x0100 /* Don't reject unassigned Unicode code points. */ # define AI_IDN_USE_STD3_ASCII_RULES 0x0200 /* Validate strings according to STD3 rules. */ # endif # define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */ /* Error values for `getaddrinfo' function. */ # define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */ # define EAI_NONAME -2 /* NAME or SERVICE is unknown. */ # define EAI_AGAIN -3 /* Temporary failure in name resolution. */ # define EAI_FAIL -4 /* Non-recoverable failure in name res. */ # define EAI_FAMILY -6 /* `ai_family' not supported. */ # define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */ # define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */ # define EAI_MEMORY -10 /* Memory allocation failure. */ # define EAI_SYSTEM -11 /* System error returned in `errno'. */ # define EAI_OVERFLOW -12 /* Argument buffer overflow. */ # ifdef __USE_GNU # define EAI_NODATA -5 /* No address associated with NAME. */ # define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */ # define EAI_INPROGRESS -100 /* Processing request in progress. */ # define EAI_CANCELED -101 /* Request canceled. */ # define EAI_NOTCANCELED -102 /* Request not canceled. */ # define EAI_ALLDONE -103 /* All requests done. */ # define EAI_INTR -104 /* Interrupted by a signal. */ # define EAI_IDN_ENCODE -105 /* IDN encoding failed. */ # endif # ifdef __USE_MISC # define NI_MAXHOST 1025 # define NI_MAXSERV 32 # endif # define NI_NUMERICHOST 1 /* Don't try to look up hostname. */ # define NI_NUMERICSERV 2 /* Don't convert port number to name. */ # define NI_NOFQDN 4 /* Only return nodename portion. */ # define NI_NAMEREQD 8 /* Don't return numeric addresses. */ # define NI_DGRAM 16 /* Look up UDP service rather than TCP. */ # ifdef __USE_GNU # define NI_IDN 32 /* Convert name from IDN format. */ # define NI_IDN_ALLOW_UNASSIGNED 64 /* Don't reject unassigned Unicode code points. */ # define NI_IDN_USE_STD3_ASCII_RULES 128 /* Validate strings according to STD3 rules. */ # endif /* Translate name of a service location and/or a service name to set of socket addresses. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int getaddrinfo (const char *__restrict __name, const char *__restrict __service, const struct addrinfo *__restrict __req, struct addrinfo **__restrict __pai); /* Free `addrinfo' structure AI including associated storage. */ extern void freeaddrinfo (struct addrinfo *__ai) __THROW; /* Convert error return from getaddrinfo() to a string. */ extern const char *gai_strerror (int __ecode) __THROW; /* Translate a socket address to a location and service name. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int getnameinfo (const struct sockaddr *__restrict __sa, socklen_t __salen, char *__restrict __host, socklen_t __hostlen, char *__restrict __serv, socklen_t __servlen, int __flags); #endif /* POSIX */ #ifdef __USE_GNU /* Enqueue ENT requests from the LIST. If MODE is GAI_WAIT wait until all requests are handled. If WAIT is GAI_NOWAIT return immediately after queueing the requests and signal completion according to SIG. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict_arr], int __ent, struct sigevent *__restrict __sig); /* Suspend execution of the thread until at least one of the ENT requests in LIST is handled. If TIMEOUT is not a null pointer it specifies the longest time the function keeps waiting before returning with an error. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int gai_suspend (const struct gaicb *const __list[], int __ent, const struct timespec *__timeout); /* Get the error status of the request REQ. */ extern int gai_error (struct gaicb *__req) __THROW; /* Cancel the requests associated with GAICBP. */ extern int gai_cancel (struct gaicb *__gaicbp) __THROW; #endif /* GNU */ __END_DECLS #endif /* netdb.h */ ���������������������������������������������c++/4.8.2�������������������������������������������������������������������������������������������0000755�����������������00000000000�14763166027�0005515 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/decimal/decimal���������������������������������������������������������������������������0000644�����������������00000042053�14763166027�0010524 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <decimal> -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file decimal/decimal * This is a Standard C++ Library header. */ // ISO/IEC TR 24733 // Written by Janis Johnson <janis187@us.ibm.com> #ifndef _GLIBCXX_DECIMAL #define _GLIBCXX_DECIMAL 1 #pragma GCC system_header #include <bits/c++config.h> #ifndef _GLIBCXX_USE_DECIMAL_FLOAT #error This file requires compiler and library support for ISO/IEC TR 24733 \ that is currently not available. #endif namespace std _GLIBCXX_VISIBILITY(default) { /** * @defgroup decimal Decimal Floating-Point Arithmetic * @ingroup numerics * * Classes and functions for decimal floating-point arithmetic. * @{ */ /** @namespace std::decimal * @brief ISO/IEC TR 24733 Decimal floating-point arithmetic. */ namespace decimal { _GLIBCXX_BEGIN_NAMESPACE_VERSION class decimal32; class decimal64; class decimal128; // 3.2.5 Initialization from coefficient and exponent. static decimal32 make_decimal32(long long __coeff, int __exp); static decimal32 make_decimal32(unsigned long long __coeff, int __exp); static decimal64 make_decimal64(long long __coeff, int __exp); static decimal64 make_decimal64(unsigned long long __coeff, int __exp); static decimal128 make_decimal128(long long __coeff, int __exp); static decimal128 make_decimal128(unsigned long long __coeff, int __exp); /// Non-conforming extension: Conversion to integral type. long long decimal32_to_long_long(decimal32 __d); long long decimal64_to_long_long(decimal64 __d); long long decimal128_to_long_long(decimal128 __d); long long decimal_to_long_long(decimal32 __d); long long decimal_to_long_long(decimal64 __d); long long decimal_to_long_long(decimal128 __d); // 3.2.6 Conversion to generic floating-point type. float decimal32_to_float(decimal32 __d); float decimal64_to_float(decimal64 __d); float decimal128_to_float(decimal128 __d); float decimal_to_float(decimal32 __d); float decimal_to_float(decimal64 __d); float decimal_to_float(decimal128 __d); double decimal32_to_double(decimal32 __d); double decimal64_to_double(decimal64 __d); double decimal128_to_double(decimal128 __d); double decimal_to_double(decimal32 __d); double decimal_to_double(decimal64 __d); double decimal_to_double(decimal128 __d); long double decimal32_to_long_double(decimal32 __d); long double decimal64_to_long_double(decimal64 __d); long double decimal128_to_long_double(decimal128 __d); long double decimal_to_long_double(decimal32 __d); long double decimal_to_long_double(decimal64 __d); long double decimal_to_long_double(decimal128 __d); // 3.2.7 Unary arithmetic operators. decimal32 operator+(decimal32 __rhs); decimal64 operator+(decimal64 __rhs); decimal128 operator+(decimal128 __rhs); decimal32 operator-(decimal32 __rhs); decimal64 operator-(decimal64 __rhs); decimal128 operator-(decimal128 __rhs); // 3.2.8 Binary arithmetic operators. #define _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(_Op, _T1, _T2, _T3) \ _T1 operator _Op(_T2 __lhs, _T3 __rhs); #define _DECLARE_DECIMAL_BINARY_OP_WITH_INT(_Op, _Tp) \ _Tp operator _Op(_Tp __lhs, int __rhs); \ _Tp operator _Op(_Tp __lhs, unsigned int __rhs); \ _Tp operator _Op(_Tp __lhs, long __rhs); \ _Tp operator _Op(_Tp __lhs, unsigned long __rhs); \ _Tp operator _Op(_Tp __lhs, long long __rhs); \ _Tp operator _Op(_Tp __lhs, unsigned long long __rhs); \ _Tp operator _Op(int __lhs, _Tp __rhs); \ _Tp operator _Op(unsigned int __lhs, _Tp __rhs); \ _Tp operator _Op(long __lhs, _Tp __rhs); \ _Tp operator _Op(unsigned long __lhs, _Tp __rhs); \ _Tp operator _Op(long long __lhs, _Tp __rhs); \ _Tp operator _Op(unsigned long long __lhs, _Tp __rhs); _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal32, decimal32, decimal32) _DECLARE_DECIMAL_BINARY_OP_WITH_INT(+, decimal32) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal32, decimal64) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal64, decimal32) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal64, decimal64) _DECLARE_DECIMAL_BINARY_OP_WITH_INT(+, decimal64) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal32, decimal128) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal64, decimal128) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal32) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal64) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal128) _DECLARE_DECIMAL_BINARY_OP_WITH_INT(+, decimal128) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal32, decimal32, decimal32) _DECLARE_DECIMAL_BINARY_OP_WITH_INT(-, decimal32) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal32, decimal64) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal64, decimal32) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal64, decimal64) _DECLARE_DECIMAL_BINARY_OP_WITH_INT(-, decimal64) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal32, decimal128) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal64, decimal128) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal32) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal64) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal128) _DECLARE_DECIMAL_BINARY_OP_WITH_INT(-, decimal128) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal32, decimal32, decimal32) _DECLARE_DECIMAL_BINARY_OP_WITH_INT(*, decimal32) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal32, decimal64) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal64, decimal32) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal64, decimal64) _DECLARE_DECIMAL_BINARY_OP_WITH_INT(*, decimal64) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal32, decimal128) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal64, decimal128) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal32) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal64) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal128) _DECLARE_DECIMAL_BINARY_OP_WITH_INT(*, decimal128) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal32, decimal32, decimal32) _DECLARE_DECIMAL_BINARY_OP_WITH_INT(/, decimal32) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal32, decimal64) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal64, decimal32) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal64, decimal64) _DECLARE_DECIMAL_BINARY_OP_WITH_INT(/, decimal64) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal32, decimal128) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal64, decimal128) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal32) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal64) _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal128) _DECLARE_DECIMAL_BINARY_OP_WITH_INT(/, decimal128) #undef _DECLARE_DECIMAL_BINARY_OP_WITH_DEC #undef _DECLARE_DECIMAL_BINARY_OP_WITH_INT // 3.2.9 Comparison operators. #define _DECLARE_DECIMAL_COMPARISON(_Op, _Tp) \ bool operator _Op(_Tp __lhs, decimal32 __rhs); \ bool operator _Op(_Tp __lhs, decimal64 __rhs); \ bool operator _Op(_Tp __lhs, decimal128 __rhs); \ bool operator _Op(_Tp __lhs, int __rhs); \ bool operator _Op(_Tp __lhs, unsigned int __rhs); \ bool operator _Op(_Tp __lhs, long __rhs); \ bool operator _Op(_Tp __lhs, unsigned long __rhs); \ bool operator _Op(_Tp __lhs, long long __rhs); \ bool operator _Op(_Tp __lhs, unsigned long long __rhs); \ bool operator _Op(int __lhs, _Tp __rhs); \ bool operator _Op(unsigned int __lhs, _Tp __rhs); \ bool operator _Op(long __lhs, _Tp __rhs); \ bool operator _Op(unsigned long __lhs, _Tp __rhs); \ bool operator _Op(long long __lhs, _Tp __rhs); \ bool operator _Op(unsigned long long __lhs, _Tp __rhs); _DECLARE_DECIMAL_COMPARISON(==, decimal32) _DECLARE_DECIMAL_COMPARISON(==, decimal64) _DECLARE_DECIMAL_COMPARISON(==, decimal128) _DECLARE_DECIMAL_COMPARISON(!=, decimal32) _DECLARE_DECIMAL_COMPARISON(!=, decimal64) _DECLARE_DECIMAL_COMPARISON(!=, decimal128) _DECLARE_DECIMAL_COMPARISON(<, decimal32) _DECLARE_DECIMAL_COMPARISON(<, decimal64) _DECLARE_DECIMAL_COMPARISON(<, decimal128) _DECLARE_DECIMAL_COMPARISON(>=, decimal32) _DECLARE_DECIMAL_COMPARISON(>=, decimal64) _DECLARE_DECIMAL_COMPARISON(>=, decimal128) _DECLARE_DECIMAL_COMPARISON(>, decimal32) _DECLARE_DECIMAL_COMPARISON(>, decimal64) _DECLARE_DECIMAL_COMPARISON(>, decimal128) _DECLARE_DECIMAL_COMPARISON(>=, decimal32) _DECLARE_DECIMAL_COMPARISON(>=, decimal64) _DECLARE_DECIMAL_COMPARISON(>=, decimal128) #undef _DECLARE_DECIMAL_COMPARISON /// 3.2.2 Class decimal32. class decimal32 { public: typedef float __decfloat32 __attribute__((mode(SD))); // 3.2.2.2 Construct/copy/destroy. decimal32() : __val(0.e-101DF) {} // 3.2.2.3 Conversion from floating-point type. explicit decimal32(decimal64 __d64); explicit decimal32(decimal128 __d128); explicit decimal32(float __r) : __val(__r) {} explicit decimal32(double __r) : __val(__r) {} explicit decimal32(long double __r) : __val(__r) {} // 3.2.2.4 Conversion from integral type. decimal32(int __z) : __val(__z) {} decimal32(unsigned int __z) : __val(__z) {} decimal32(long __z) : __val(__z) {} decimal32(unsigned long __z) : __val(__z) {} decimal32(long long __z) : __val(__z) {} decimal32(unsigned long long __z) : __val(__z) {} /// Conforming extension: Conversion from scalar decimal type. decimal32(__decfloat32 __z) : __val(__z) {} // 3.2.2.5 Conversion to integral type. (DISABLED) //operator long long() const { return (long long)__val; } // 3.2.2.6 Increment and decrement operators. decimal32& operator++() { __val += 1; return *this; } decimal32 operator++(int) { decimal32 __tmp = *this; __val += 1; return __tmp; } decimal32& operator--() { __val -= 1; return *this; } decimal32 operator--(int) { decimal32 __tmp = *this; __val -= 1; return __tmp; } // 3.2.2.7 Compound assignment. #define _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(_Op) \ decimal32& operator _Op(decimal32 __rhs); \ decimal32& operator _Op(decimal64 __rhs); \ decimal32& operator _Op(decimal128 __rhs); \ decimal32& operator _Op(int __rhs); \ decimal32& operator _Op(unsigned int __rhs); \ decimal32& operator _Op(long __rhs); \ decimal32& operator _Op(unsigned long __rhs); \ decimal32& operator _Op(long long __rhs); \ decimal32& operator _Op(unsigned long long __rhs); _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(+=) _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(-=) _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(*=) _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(/=) #undef _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT private: __decfloat32 __val; public: __decfloat32 __getval(void) { return __val; } void __setval(__decfloat32 __x) { __val = __x; } }; /// 3.2.3 Class decimal64. class decimal64 { public: typedef float __decfloat64 __attribute__((mode(DD))); // 3.2.3.2 Construct/copy/destroy. decimal64() : __val(0.e-398dd) {} // 3.2.3.3 Conversion from floating-point type. decimal64(decimal32 d32); explicit decimal64(decimal128 d128); explicit decimal64(float __r) : __val(__r) {} explicit decimal64(double __r) : __val(__r) {} explicit decimal64(long double __r) : __val(__r) {} // 3.2.3.4 Conversion from integral type. decimal64(int __z) : __val(__z) {} decimal64(unsigned int __z) : __val(__z) {} decimal64(long __z) : __val(__z) {} decimal64(unsigned long __z) : __val(__z) {} decimal64(long long __z) : __val(__z) {} decimal64(unsigned long long __z) : __val(__z) {} /// Conforming extension: Conversion from scalar decimal type. decimal64(__decfloat64 __z) : __val(__z) {} // 3.2.3.5 Conversion to integral type. (DISABLED) //operator long long() const { return (long long)__val; } // 3.2.3.6 Increment and decrement operators. decimal64& operator++() { __val += 1; return *this; } decimal64 operator++(int) { decimal64 __tmp = *this; __val += 1; return __tmp; } decimal64& operator--() { __val -= 1; return *this; } decimal64 operator--(int) { decimal64 __tmp = *this; __val -= 1; return __tmp; } // 3.2.3.7 Compound assignment. #define _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(_Op) \ decimal64& operator _Op(decimal32 __rhs); \ decimal64& operator _Op(decimal64 __rhs); \ decimal64& operator _Op(decimal128 __rhs); \ decimal64& operator _Op(int __rhs); \ decimal64& operator _Op(unsigned int __rhs); \ decimal64& operator _Op(long __rhs); \ decimal64& operator _Op(unsigned long __rhs); \ decimal64& operator _Op(long long __rhs); \ decimal64& operator _Op(unsigned long long __rhs); _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(+=) _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(-=) _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(*=) _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(/=) #undef _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT private: __decfloat64 __val; public: __decfloat64 __getval(void) { return __val; } void __setval(__decfloat64 __x) { __val = __x; } }; /// 3.2.4 Class decimal128. class decimal128 { public: typedef float __decfloat128 __attribute__((mode(TD))); // 3.2.4.2 Construct/copy/destroy. decimal128() : __val(0.e-6176DL) {} // 3.2.4.3 Conversion from floating-point type. decimal128(decimal32 d32); decimal128(decimal64 d64); explicit decimal128(float __r) : __val(__r) {} explicit decimal128(double __r) : __val(__r) {} explicit decimal128(long double __r) : __val(__r) {} // 3.2.4.4 Conversion from integral type. decimal128(int __z) : __val(__z) {} decimal128(unsigned int __z) : __val(__z) {} decimal128(long __z) : __val(__z) {} decimal128(unsigned long __z) : __val(__z) {} decimal128(long long __z) : __val(__z) {} decimal128(unsigned long long __z) : __val(__z) {} /// Conforming extension: Conversion from scalar decimal type. decimal128(__decfloat128 __z) : __val(__z) {} // 3.2.4.5 Conversion to integral type. (DISABLED) //operator long long() const { return (long long)__val; } // 3.2.4.6 Increment and decrement operators. decimal128& operator++() { __val += 1; return *this; } decimal128 operator++(int) { decimal128 __tmp = *this; __val += 1; return __tmp; } decimal128& operator--() { __val -= 1; return *this; } decimal128 operator--(int) { decimal128 __tmp = *this; __val -= 1; return __tmp; } // 3.2.4.7 Compound assignment. #define _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(_Op) \ decimal128& operator _Op(decimal32 __rhs); \ decimal128& operator _Op(decimal64 __rhs); \ decimal128& operator _Op(decimal128 __rhs); \ decimal128& operator _Op(int __rhs); \ decimal128& operator _Op(unsigned int __rhs); \ decimal128& operator _Op(long __rhs); \ decimal128& operator _Op(unsigned long __rhs); \ decimal128& operator _Op(long long __rhs); \ decimal128& operator _Op(unsigned long long __rhs); _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(+=) _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(-=) _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(*=) _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(/=) #undef _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT private: __decfloat128 __val; public: __decfloat128 __getval(void) { return __val; } void __setval(__decfloat128 __x) { __val = __x; } }; #define _GLIBCXX_USE_DECIMAL_ 1 _GLIBCXX_END_NAMESPACE_VERSION } // namespace decimal // @} group decimal } // namespace std #include <decimal/decimal.h> #endif /* _GLIBCXX_DECIMAL */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/decimal/decimal.h�������������������������������������������������������������������������0000644�����������������00000041152�14763166027�0010751 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// decimal classes -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file decimal/decimal.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{decimal} */ // ISO/IEC TR 24733 // Written by Janis Johnson <janis187@us.ibm.com> #ifndef _GLIBCXX_DECIMAL_IMPL #define _GLIBCXX_DECIMAL_IMPL 1 #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { namespace decimal { _GLIBCXX_BEGIN_NAMESPACE_VERSION // ISO/IEC TR 24733 3.2.[234].1 Construct/copy/destroy. inline decimal32::decimal32(decimal64 __r) : __val(__r.__getval()) {} inline decimal32::decimal32(decimal128 __r) : __val(__r.__getval()) {} inline decimal64::decimal64(decimal32 __r) : __val(__r.__getval()) {} inline decimal64::decimal64(decimal128 __r) : __val(__r.__getval()) {} inline decimal128::decimal128(decimal32 __r) : __val(__r.__getval()) {} inline decimal128::decimal128(decimal64 __r) : __val(__r.__getval()) {} // ISO/IEC TR 24733 3.2.[234].6 Compound assignment. #define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, _T2) \ inline _T1& _T1::operator _Op1(_T2 __rhs) \ { \ __setval(__getval() _Op2 __rhs.__getval()); \ return *this; \ } #define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, _T2) \ inline _T1& _T1::operator _Op1(_T2 __rhs) \ { \ __setval(__getval() _Op2 __rhs); \ return *this; \ } #define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(_Op1, _Op2, _T1) \ _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, decimal32) \ _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, decimal64) \ _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, decimal128) \ _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, int) \ _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, unsigned int) \ _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, long) \ _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, unsigned long)\ _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, long long) \ _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, unsigned long long) _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(+=, +, decimal32) _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(-=, -, decimal32) _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(*=, *, decimal32) _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(/=, /, decimal32) _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(+=, +, decimal64) _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(-=, -, decimal64) _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(*=, *, decimal64) _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(/=, /, decimal64) _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(+=, +, decimal128) _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(-=, -, decimal128) _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(*=, *, decimal128) _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(/=, /, decimal128) #undef _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC #undef _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT #undef _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS // Extension: Conversion to integral type. inline long long decimal32_to_long_long(decimal32 __d) { return (long long)__d.__getval(); } inline long long decimal64_to_long_long(decimal64 __d) { return (long long)__d.__getval(); } inline long long decimal128_to_long_long(decimal128 __d) { return (long long)__d.__getval(); } inline long long decimal_to_long_long(decimal32 __d) { return (long long)__d.__getval(); } inline long long decimal_to_long_long(decimal64 __d) { return (long long)__d.__getval(); } inline long long decimal_to_long_long(decimal128 __d) { return (long long)__d.__getval(); } // ISO/IEC TR 24733 3.2.5 Initialization from coefficient and exponent. static decimal32 make_decimal32(long long __coeff, int __exponent) { decimal32 __decexp = 1, __multiplier; if (__exponent < 0) { __multiplier = 1.E-1DF; __exponent = -__exponent; } else __multiplier = 1.E1DF; for (int __i = 0; __i < __exponent; ++__i) __decexp *= __multiplier; return __coeff * __decexp; } static decimal32 make_decimal32(unsigned long long __coeff, int __exponent) { decimal32 __decexp = 1, __multiplier; if (__exponent < 0) { __multiplier = 1.E-1DF; __exponent = -__exponent; } else __multiplier = 1.E1DF; for (int __i = 0; __i < __exponent; ++__i) __decexp *= __multiplier; return __coeff * __decexp; } static decimal64 make_decimal64(long long __coeff, int __exponent) { decimal64 __decexp = 1, __multiplier; if (__exponent < 0) { __multiplier = 1.E-1DD; __exponent = -__exponent; } else __multiplier = 1.E1DD; for (int __i = 0; __i < __exponent; ++__i) __decexp *= __multiplier; return __coeff * __decexp; } static decimal64 make_decimal64(unsigned long long __coeff, int __exponent) { decimal64 __decexp = 1, __multiplier; if (__exponent < 0) { __multiplier = 1.E-1DD; __exponent = -__exponent; } else __multiplier = 1.E1DD; for (int __i = 0; __i < __exponent; ++__i) __decexp *= __multiplier; return __coeff * __decexp; } static decimal128 make_decimal128(long long __coeff, int __exponent) { decimal128 __decexp = 1, __multiplier; if (__exponent < 0) { __multiplier = 1.E-1DL; __exponent = -__exponent; } else __multiplier = 1.E1DL; for (int __i = 0; __i < __exponent; ++__i) __decexp *= __multiplier; return __coeff * __decexp; } static decimal128 make_decimal128(unsigned long long __coeff, int __exponent) { decimal128 __decexp = 1, __multiplier; if (__exponent < 0) { __multiplier = 1.E-1DL; __exponent = -__exponent; } else __multiplier = 1.E1DL; for (int __i = 0; __i < __exponent; ++__i) __decexp *= __multiplier; return __coeff * __decexp; } // ISO/IEC TR 24733 3.2.6 Conversion to generic floating-point type. inline float decimal32_to_float(decimal32 __d) { return (float)__d.__getval(); } inline float decimal64_to_float(decimal64 __d) { return (float)__d.__getval(); } inline float decimal128_to_float(decimal128 __d) { return (float)__d.__getval(); } inline float decimal_to_float(decimal32 __d) { return (float)__d.__getval(); } inline float decimal_to_float(decimal64 __d) { return (float)__d.__getval(); } inline float decimal_to_float(decimal128 __d) { return (float)__d.__getval(); } inline double decimal32_to_double(decimal32 __d) { return (double)__d.__getval(); } inline double decimal64_to_double(decimal64 __d) { return (double)__d.__getval(); } inline double decimal128_to_double(decimal128 __d) { return (double)__d.__getval(); } inline double decimal_to_double(decimal32 __d) { return (double)__d.__getval(); } inline double decimal_to_double(decimal64 __d) { return (double)__d.__getval(); } inline double decimal_to_double(decimal128 __d) { return (double)__d.__getval(); } inline long double decimal32_to_long_double(decimal32 __d) { return (long double)__d.__getval(); } inline long double decimal64_to_long_double(decimal64 __d) { return (long double)__d.__getval(); } inline long double decimal128_to_long_double(decimal128 __d) { return (long double)__d.__getval(); } inline long double decimal_to_long_double(decimal32 __d) { return (long double)__d.__getval(); } inline long double decimal_to_long_double(decimal64 __d) { return (long double)__d.__getval(); } inline long double decimal_to_long_double(decimal128 __d) { return (long double)__d.__getval(); } // ISO/IEC TR 24733 3.2.7 Unary arithmetic operators. #define _DEFINE_DECIMAL_UNARY_OP(_Op, _Tp) \ inline _Tp operator _Op(_Tp __rhs) \ { \ _Tp __tmp; \ __tmp.__setval(_Op __rhs.__getval()); \ return __tmp; \ } _DEFINE_DECIMAL_UNARY_OP(+, decimal32) _DEFINE_DECIMAL_UNARY_OP(+, decimal64) _DEFINE_DECIMAL_UNARY_OP(+, decimal128) _DEFINE_DECIMAL_UNARY_OP(-, decimal32) _DEFINE_DECIMAL_UNARY_OP(-, decimal64) _DEFINE_DECIMAL_UNARY_OP(-, decimal128) #undef _DEFINE_DECIMAL_UNARY_OP // ISO/IEC TR 24733 3.2.8 Binary arithmetic operators. #define _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(_Op, _T1, _T2, _T3) \ inline _T1 operator _Op(_T2 __lhs, _T3 __rhs) \ { \ _T1 __retval; \ __retval.__setval(__lhs.__getval() _Op __rhs.__getval()); \ return __retval; \ } #define _DEFINE_DECIMAL_BINARY_OP_BOTH(_Op, _T1, _T2, _T3) \ inline _T1 operator _Op(_T2 __lhs, _T3 __rhs) \ { \ _T1 __retval; \ __retval.__setval(__lhs.__getval() _Op __rhs.__getval()); \ return __retval; \ } #define _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, _T2) \ inline _T1 operator _Op(_T1 __lhs, _T2 __rhs) \ { \ _T1 __retval; \ __retval.__setval(__lhs.__getval() _Op __rhs); \ return __retval; \ } #define _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, _T2) \ inline _T1 operator _Op(_T2 __lhs, _T1 __rhs) \ { \ _T1 __retval; \ __retval.__setval(__lhs _Op __rhs.__getval()); \ return __retval; \ } #define _DEFINE_DECIMAL_BINARY_OP_WITH_INT(_Op, _T1) \ _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, int); \ _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, unsigned int); \ _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, long); \ _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, unsigned long); \ _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, long long); \ _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, unsigned long long); \ _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, int); \ _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, unsigned int); \ _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, long); \ _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, unsigned long); \ _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, long long); \ _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, unsigned long long); \ _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal32, decimal32, decimal32) _DEFINE_DECIMAL_BINARY_OP_WITH_INT(+, decimal32) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal32, decimal64) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal64, decimal32) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal64, decimal64) _DEFINE_DECIMAL_BINARY_OP_WITH_INT(+, decimal64) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal32, decimal128) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal64, decimal128) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal32) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal64) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal128) _DEFINE_DECIMAL_BINARY_OP_WITH_INT(+, decimal128) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal32, decimal32, decimal32) _DEFINE_DECIMAL_BINARY_OP_WITH_INT(-, decimal32) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal32, decimal64) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal64, decimal32) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal64, decimal64) _DEFINE_DECIMAL_BINARY_OP_WITH_INT(-, decimal64) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal32, decimal128) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal64, decimal128) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal32) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal64) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal128) _DEFINE_DECIMAL_BINARY_OP_WITH_INT(-, decimal128) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal32, decimal32, decimal32) _DEFINE_DECIMAL_BINARY_OP_WITH_INT(*, decimal32) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal32, decimal64) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal64, decimal32) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal64, decimal64) _DEFINE_DECIMAL_BINARY_OP_WITH_INT(*, decimal64) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal32, decimal128) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal64, decimal128) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal32) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal64) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal128) _DEFINE_DECIMAL_BINARY_OP_WITH_INT(*, decimal128) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal32, decimal32, decimal32) _DEFINE_DECIMAL_BINARY_OP_WITH_INT(/, decimal32) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal32, decimal64) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal64, decimal32) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal64, decimal64) _DEFINE_DECIMAL_BINARY_OP_WITH_INT(/, decimal64) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal32, decimal128) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal64, decimal128) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal32) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal64) _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal128) _DEFINE_DECIMAL_BINARY_OP_WITH_INT(/, decimal128) #undef _DEFINE_DECIMAL_BINARY_OP_WITH_DEC #undef _DEFINE_DECIMAL_BINARY_OP_BOTH #undef _DEFINE_DECIMAL_BINARY_OP_LHS #undef _DEFINE_DECIMAL_BINARY_OP_RHS #undef _DEFINE_DECIMAL_BINARY_OP_WITH_INT // ISO/IEC TR 24733 3.2.9 Comparison operators. #define _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _T1, _T2) \ inline bool operator _Op(_T1 __lhs, _T2 __rhs) \ { return __lhs.__getval() _Op __rhs.__getval(); } #define _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _T1, _T2) \ inline bool operator _Op(_T1 __lhs, _T2 __rhs) \ { return __lhs.__getval() _Op __rhs; } #define _DEFINE_DECIMAL_COMPARISON_RHS(_Op, _T1, _T2) \ inline bool operator _Op(_T1 __lhs, _T2 __rhs) \ { return __lhs _Op __rhs.__getval(); } #define _DEFINE_DECIMAL_COMPARISONS(_Op, _Tp) \ _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _Tp, decimal32) \ _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _Tp, decimal64) \ _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _Tp, decimal128) \ _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, int) \ _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, unsigned int) \ _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, long) \ _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, unsigned long) \ _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, long long) \ _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, unsigned long long) \ _DEFINE_DECIMAL_COMPARISON_RHS(_Op, int, _Tp) \ _DEFINE_DECIMAL_COMPARISON_RHS(_Op, unsigned int, _Tp) \ _DEFINE_DECIMAL_COMPARISON_RHS(_Op, long, _Tp) \ _DEFINE_DECIMAL_COMPARISON_RHS(_Op, unsigned long, _Tp) \ _DEFINE_DECIMAL_COMPARISON_RHS(_Op, long long, _Tp) \ _DEFINE_DECIMAL_COMPARISON_RHS(_Op, unsigned long long, _Tp) _DEFINE_DECIMAL_COMPARISONS(==, decimal32) _DEFINE_DECIMAL_COMPARISONS(==, decimal64) _DEFINE_DECIMAL_COMPARISONS(==, decimal128) _DEFINE_DECIMAL_COMPARISONS(!=, decimal32) _DEFINE_DECIMAL_COMPARISONS(!=, decimal64) _DEFINE_DECIMAL_COMPARISONS(!=, decimal128) _DEFINE_DECIMAL_COMPARISONS(<, decimal32) _DEFINE_DECIMAL_COMPARISONS(<, decimal64) _DEFINE_DECIMAL_COMPARISONS(<, decimal128) _DEFINE_DECIMAL_COMPARISONS(<=, decimal32) _DEFINE_DECIMAL_COMPARISONS(<=, decimal64) _DEFINE_DECIMAL_COMPARISONS(<=, decimal128) _DEFINE_DECIMAL_COMPARISONS(>, decimal32) _DEFINE_DECIMAL_COMPARISONS(>, decimal64) _DEFINE_DECIMAL_COMPARISONS(>, decimal128) _DEFINE_DECIMAL_COMPARISONS(>=, decimal32) _DEFINE_DECIMAL_COMPARISONS(>=, decimal64) _DEFINE_DECIMAL_COMPARISONS(>=, decimal128) #undef _DEFINE_DECIMAL_COMPARISON_BOTH #undef _DEFINE_DECIMAL_COMPARISON_LHS #undef _DEFINE_DECIMAL_COMPARISON_RHS #undef _DEFINE_DECIMAL_COMPARISONS _GLIBCXX_END_NAMESPACE_VERSION } // namespace decimal } // namespace std #endif /* _GLIBCXX_DECIMAL_IMPL */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/complex.h���������������������������������������������������������������������������������0000644�����������������00000002665�14763166027�0007432 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- compatibility header. // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file complex.h * This is a Standard C++ Library header. */ #include <bits/c++config.h> #if __cplusplus >= 201103L # include <ccomplex> #endif #if _GLIBCXX_HAVE_COMPLEX_H # include_next <complex.h> # ifdef _GLIBCXX_COMPLEX // See PR56111, keep the macro in C++03 if possible. # undef complex # endif #endif #ifndef _GLIBCXX_COMPLEX_H #define _GLIBCXX_COMPLEX_H 1 #endif ���������������������������������������������������������������������������c++/4.8.2/complex�����������������������������������������������������������������������������������0000644�����������������00000146445�14763166027�0007211 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// The template and inlines for the -*- C++ -*- complex number classes. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/complex * This is a Standard C++ Library header. */ // // ISO C++ 14882: 26.2 Complex Numbers // Note: this is not a conforming implementation. // Initially implemented by Ulrich Drepper <drepper@cygnus.com> // Improved by Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr> // #ifndef _GLIBCXX_COMPLEX #define _GLIBCXX_COMPLEX 1 #pragma GCC system_header #include <bits/c++config.h> #include <bits/cpp_type_traits.h> #include <ext/type_traits.h> #include <cmath> #include <sstream> // Get rid of a macro possibly defined in <complex.h> #undef complex namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup complex_numbers Complex Numbers * @ingroup numerics * * Classes and functions for complex numbers. * @{ */ // Forward declarations. template<typename _Tp> class complex; template<> class complex<float>; template<> class complex<double>; template<> class complex<long double>; /// Return magnitude of @a z. template<typename _Tp> _Tp abs(const complex<_Tp>&); /// Return phase angle of @a z. template<typename _Tp> _Tp arg(const complex<_Tp>&); /// Return @a z magnitude squared. template<typename _Tp> _Tp norm(const complex<_Tp>&); /// Return complex conjugate of @a z. template<typename _Tp> complex<_Tp> conj(const complex<_Tp>&); /// Return complex with magnitude @a rho and angle @a theta. template<typename _Tp> complex<_Tp> polar(const _Tp&, const _Tp& = 0); // Transcendentals: /// Return complex cosine of @a z. template<typename _Tp> complex<_Tp> cos(const complex<_Tp>&); /// Return complex hyperbolic cosine of @a z. template<typename _Tp> complex<_Tp> cosh(const complex<_Tp>&); /// Return complex base e exponential of @a z. template<typename _Tp> complex<_Tp> exp(const complex<_Tp>&); /// Return complex natural logarithm of @a z. template<typename _Tp> complex<_Tp> log(const complex<_Tp>&); /// Return complex base 10 logarithm of @a z. template<typename _Tp> complex<_Tp> log10(const complex<_Tp>&); #if __cplusplus < 201103L // DR 844. /// Return @a x to the @a y'th power. template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, int); #endif /// Return @a x to the @a y'th power. template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, const _Tp&); /// Return @a x to the @a y'th power. template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, const complex<_Tp>&); /// Return @a x to the @a y'th power. template<typename _Tp> complex<_Tp> pow(const _Tp&, const complex<_Tp>&); /// Return complex sine of @a z. template<typename _Tp> complex<_Tp> sin(const complex<_Tp>&); /// Return complex hyperbolic sine of @a z. template<typename _Tp> complex<_Tp> sinh(const complex<_Tp>&); /// Return complex square root of @a z. template<typename _Tp> complex<_Tp> sqrt(const complex<_Tp>&); /// Return complex tangent of @a z. template<typename _Tp> complex<_Tp> tan(const complex<_Tp>&); /// Return complex hyperbolic tangent of @a z. template<typename _Tp> complex<_Tp> tanh(const complex<_Tp>&); // 26.2.2 Primary template class complex /** * Template to represent complex numbers. * * Specializations for float, double, and long double are part of the * library. Results with any other type are not guaranteed. * * @param Tp Type of real and imaginary values. */ template<typename _Tp> struct complex { /// Value typedef. typedef _Tp value_type; /// Default constructor. First parameter is x, second parameter is y. /// Unspecified parameters default to 0. _GLIBCXX_CONSTEXPR complex(const _Tp& __r = _Tp(), const _Tp& __i = _Tp()) : _M_real(__r), _M_imag(__i) { } // Lets the compiler synthesize the copy constructor // complex (const complex<_Tp>&); /// Copy constructor. template<typename _Up> _GLIBCXX_CONSTEXPR complex(const complex<_Up>& __z) : _M_real(__z.real()), _M_imag(__z.imag()) { } #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. _GLIBCXX_ABI_TAG_CXX11 constexpr _Tp real() { return _M_real; } _GLIBCXX_ABI_TAG_CXX11 constexpr _Tp imag() { return _M_imag; } #else /// Return real part of complex number. _Tp& real() { return _M_real; } /// Return real part of complex number. const _Tp& real() const { return _M_real; } /// Return imaginary part of complex number. _Tp& imag() { return _M_imag; } /// Return imaginary part of complex number. const _Tp& imag() const { return _M_imag; } #endif // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. void real(_Tp __val) { _M_real = __val; } void imag(_Tp __val) { _M_imag = __val; } /// Assign this complex number to scalar @a t. complex<_Tp>& operator=(const _Tp&); /// Add @a t to this complex number. // 26.2.5/1 complex<_Tp>& operator+=(const _Tp& __t) { _M_real += __t; return *this; } /// Subtract @a t from this complex number. // 26.2.5/3 complex<_Tp>& operator-=(const _Tp& __t) { _M_real -= __t; return *this; } /// Multiply this complex number by @a t. complex<_Tp>& operator*=(const _Tp&); /// Divide this complex number by @a t. complex<_Tp>& operator/=(const _Tp&); // Lets the compiler synthesize the // copy and assignment operator // complex<_Tp>& operator= (const complex<_Tp>&); /// Assign this complex number to complex @a z. template<typename _Up> complex<_Tp>& operator=(const complex<_Up>&); /// Add @a z to this complex number. template<typename _Up> complex<_Tp>& operator+=(const complex<_Up>&); /// Subtract @a z from this complex number. template<typename _Up> complex<_Tp>& operator-=(const complex<_Up>&); /// Multiply this complex number by @a z. template<typename _Up> complex<_Tp>& operator*=(const complex<_Up>&); /// Divide this complex number by @a z. template<typename _Up> complex<_Tp>& operator/=(const complex<_Up>&); _GLIBCXX_USE_CONSTEXPR complex __rep() const { return *this; } private: _Tp _M_real; _Tp _M_imag; }; template<typename _Tp> complex<_Tp>& complex<_Tp>::operator=(const _Tp& __t) { _M_real = __t; _M_imag = _Tp(); return *this; } // 26.2.5/5 template<typename _Tp> complex<_Tp>& complex<_Tp>::operator*=(const _Tp& __t) { _M_real *= __t; _M_imag *= __t; return *this; } // 26.2.5/7 template<typename _Tp> complex<_Tp>& complex<_Tp>::operator/=(const _Tp& __t) { _M_real /= __t; _M_imag /= __t; return *this; } template<typename _Tp> template<typename _Up> complex<_Tp>& complex<_Tp>::operator=(const complex<_Up>& __z) { _M_real = __z.real(); _M_imag = __z.imag(); return *this; } // 26.2.5/9 template<typename _Tp> template<typename _Up> complex<_Tp>& complex<_Tp>::operator+=(const complex<_Up>& __z) { _M_real += __z.real(); _M_imag += __z.imag(); return *this; } // 26.2.5/11 template<typename _Tp> template<typename _Up> complex<_Tp>& complex<_Tp>::operator-=(const complex<_Up>& __z) { _M_real -= __z.real(); _M_imag -= __z.imag(); return *this; } // 26.2.5/13 // XXX: This is a grammar school implementation. template<typename _Tp> template<typename _Up> complex<_Tp>& complex<_Tp>::operator*=(const complex<_Up>& __z) { const _Tp __r = _M_real * __z.real() - _M_imag * __z.imag(); _M_imag = _M_real * __z.imag() + _M_imag * __z.real(); _M_real = __r; return *this; } // 26.2.5/15 // XXX: This is a grammar school implementation. template<typename _Tp> template<typename _Up> complex<_Tp>& complex<_Tp>::operator/=(const complex<_Up>& __z) { const _Tp __r = _M_real * __z.real() + _M_imag * __z.imag(); const _Tp __n = std::norm(__z); _M_imag = (_M_imag * __z.real() - _M_real * __z.imag()) / __n; _M_real = __r / __n; return *this; } // Operators: //@{ /// Return new complex value @a x plus @a y. template<typename _Tp> inline complex<_Tp> operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) { complex<_Tp> __r = __x; __r += __y; return __r; } template<typename _Tp> inline complex<_Tp> operator+(const complex<_Tp>& __x, const _Tp& __y) { complex<_Tp> __r = __x; __r += __y; return __r; } template<typename _Tp> inline complex<_Tp> operator+(const _Tp& __x, const complex<_Tp>& __y) { complex<_Tp> __r = __y; __r += __x; return __r; } //@} //@{ /// Return new complex value @a x minus @a y. template<typename _Tp> inline complex<_Tp> operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) { complex<_Tp> __r = __x; __r -= __y; return __r; } template<typename _Tp> inline complex<_Tp> operator-(const complex<_Tp>& __x, const _Tp& __y) { complex<_Tp> __r = __x; __r -= __y; return __r; } template<typename _Tp> inline complex<_Tp> operator-(const _Tp& __x, const complex<_Tp>& __y) { complex<_Tp> __r(__x, -__y.imag()); __r -= __y.real(); return __r; } //@} //@{ /// Return new complex value @a x times @a y. template<typename _Tp> inline complex<_Tp> operator*(const complex<_Tp>& __x, const complex<_Tp>& __y) { complex<_Tp> __r = __x; __r *= __y; return __r; } template<typename _Tp> inline complex<_Tp> operator*(const complex<_Tp>& __x, const _Tp& __y) { complex<_Tp> __r = __x; __r *= __y; return __r; } template<typename _Tp> inline complex<_Tp> operator*(const _Tp& __x, const complex<_Tp>& __y) { complex<_Tp> __r = __y; __r *= __x; return __r; } //@} //@{ /// Return new complex value @a x divided by @a y. template<typename _Tp> inline complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y) { complex<_Tp> __r = __x; __r /= __y; return __r; } template<typename _Tp> inline complex<_Tp> operator/(const complex<_Tp>& __x, const _Tp& __y) { complex<_Tp> __r = __x; __r /= __y; return __r; } template<typename _Tp> inline complex<_Tp> operator/(const _Tp& __x, const complex<_Tp>& __y) { complex<_Tp> __r = __x; __r /= __y; return __r; } //@} /// Return @a x. template<typename _Tp> inline complex<_Tp> operator+(const complex<_Tp>& __x) { return __x; } /// Return complex negation of @a x. template<typename _Tp> inline complex<_Tp> operator-(const complex<_Tp>& __x) { return complex<_Tp>(-__x.real(), -__x.imag()); } //@{ /// Return true if @a x is equal to @a y. template<typename _Tp> inline _GLIBCXX_CONSTEXPR bool operator==(const complex<_Tp>& __x, const complex<_Tp>& __y) { return __x.real() == __y.real() && __x.imag() == __y.imag(); } template<typename _Tp> inline _GLIBCXX_CONSTEXPR bool operator==(const complex<_Tp>& __x, const _Tp& __y) { return __x.real() == __y && __x.imag() == _Tp(); } template<typename _Tp> inline _GLIBCXX_CONSTEXPR bool operator==(const _Tp& __x, const complex<_Tp>& __y) { return __x == __y.real() && _Tp() == __y.imag(); } //@} //@{ /// Return false if @a x is equal to @a y. template<typename _Tp> inline _GLIBCXX_CONSTEXPR bool operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y) { return __x.real() != __y.real() || __x.imag() != __y.imag(); } template<typename _Tp> inline _GLIBCXX_CONSTEXPR bool operator!=(const complex<_Tp>& __x, const _Tp& __y) { return __x.real() != __y || __x.imag() != _Tp(); } template<typename _Tp> inline _GLIBCXX_CONSTEXPR bool operator!=(const _Tp& __x, const complex<_Tp>& __y) { return __x != __y.real() || _Tp() != __y.imag(); } //@} /// Extraction operator for complex values. template<typename _Tp, typename _CharT, class _Traits> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) { _Tp __re_x, __im_x; _CharT __ch; __is >> __ch; if (__ch == '(') { __is >> __re_x >> __ch; if (__ch == ',') { __is >> __im_x >> __ch; if (__ch == ')') __x = complex<_Tp>(__re_x, __im_x); else __is.setstate(ios_base::failbit); } else if (__ch == ')') __x = __re_x; else __is.setstate(ios_base::failbit); } else { __is.putback(__ch); __is >> __re_x; __x = __re_x; } return __is; } /// Insertion operator for complex values. template<typename _Tp, typename _CharT, class _Traits> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x) { basic_ostringstream<_CharT, _Traits> __s; __s.flags(__os.flags()); __s.imbue(__os.getloc()); __s.precision(__os.precision()); __s << '(' << __x.real() << ',' << __x.imag() << ')'; return __os << __s.str(); } // Values #if __cplusplus >= 201103L template<typename _Tp> constexpr _Tp real(const complex<_Tp>& __z) { return __z.real(); } template<typename _Tp> constexpr _Tp imag(const complex<_Tp>& __z) { return __z.imag(); } #else template<typename _Tp> inline _Tp& real(complex<_Tp>& __z) { return __z.real(); } template<typename _Tp> inline const _Tp& real(const complex<_Tp>& __z) { return __z.real(); } template<typename _Tp> inline _Tp& imag(complex<_Tp>& __z) { return __z.imag(); } template<typename _Tp> inline const _Tp& imag(const complex<_Tp>& __z) { return __z.imag(); } #endif // 26.2.7/3 abs(__z): Returns the magnitude of __z. template<typename _Tp> inline _Tp __complex_abs(const complex<_Tp>& __z) { _Tp __x = __z.real(); _Tp __y = __z.imag(); const _Tp __s = std::max(abs(__x), abs(__y)); if (__s == _Tp()) // well ... return __s; __x /= __s; __y /= __s; return __s * sqrt(__x * __x + __y * __y); } #if _GLIBCXX_USE_C99_COMPLEX inline float __complex_abs(__complex__ float __z) { return __builtin_cabsf(__z); } inline double __complex_abs(__complex__ double __z) { return __builtin_cabs(__z); } inline long double __complex_abs(const __complex__ long double& __z) { return __builtin_cabsl(__z); } template<typename _Tp> inline _Tp abs(const complex<_Tp>& __z) { return __complex_abs(__z.__rep()); } #else template<typename _Tp> inline _Tp abs(const complex<_Tp>& __z) { return __complex_abs(__z); } #endif // 26.2.7/4: arg(__z): Returns the phase angle of __z. template<typename _Tp> inline _Tp __complex_arg(const complex<_Tp>& __z) { return atan2(__z.imag(), __z.real()); } #if _GLIBCXX_USE_C99_COMPLEX inline float __complex_arg(__complex__ float __z) { return __builtin_cargf(__z); } inline double __complex_arg(__complex__ double __z) { return __builtin_carg(__z); } inline long double __complex_arg(const __complex__ long double& __z) { return __builtin_cargl(__z); } template<typename _Tp> inline _Tp arg(const complex<_Tp>& __z) { return __complex_arg(__z.__rep()); } #else template<typename _Tp> inline _Tp arg(const complex<_Tp>& __z) { return __complex_arg(__z); } #endif // 26.2.7/5: norm(__z) returns the squared magnitude of __z. // As defined, norm() is -not- a norm is the common mathematical // sens used in numerics. The helper class _Norm_helper<> tries to // distinguish between builtin floating point and the rest, so as // to deliver an answer as close as possible to the real value. template<bool> struct _Norm_helper { template<typename _Tp> static inline _Tp _S_do_it(const complex<_Tp>& __z) { const _Tp __x = __z.real(); const _Tp __y = __z.imag(); return __x * __x + __y * __y; } }; template<> struct _Norm_helper<true> { template<typename _Tp> static inline _Tp _S_do_it(const complex<_Tp>& __z) { _Tp __res = std::abs(__z); return __res * __res; } }; template<typename _Tp> inline _Tp norm(const complex<_Tp>& __z) { return _Norm_helper<__is_floating<_Tp>::__value && !_GLIBCXX_FAST_MATH>::_S_do_it(__z); } template<typename _Tp> inline complex<_Tp> polar(const _Tp& __rho, const _Tp& __theta) { return complex<_Tp>(__rho * cos(__theta), __rho * sin(__theta)); } template<typename _Tp> inline complex<_Tp> conj(const complex<_Tp>& __z) { return complex<_Tp>(__z.real(), -__z.imag()); } // Transcendentals // 26.2.8/1 cos(__z): Returns the cosine of __z. template<typename _Tp> inline complex<_Tp> __complex_cos(const complex<_Tp>& __z) { const _Tp __x = __z.real(); const _Tp __y = __z.imag(); return complex<_Tp>(cos(__x) * cosh(__y), -sin(__x) * sinh(__y)); } #if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_cos(__complex__ float __z) { return __builtin_ccosf(__z); } inline __complex__ double __complex_cos(__complex__ double __z) { return __builtin_ccos(__z); } inline __complex__ long double __complex_cos(const __complex__ long double& __z) { return __builtin_ccosl(__z); } template<typename _Tp> inline complex<_Tp> cos(const complex<_Tp>& __z) { return __complex_cos(__z.__rep()); } #else template<typename _Tp> inline complex<_Tp> cos(const complex<_Tp>& __z) { return __complex_cos(__z); } #endif // 26.2.8/2 cosh(__z): Returns the hyperbolic cosine of __z. template<typename _Tp> inline complex<_Tp> __complex_cosh(const complex<_Tp>& __z) { const _Tp __x = __z.real(); const _Tp __y = __z.imag(); return complex<_Tp>(cosh(__x) * cos(__y), sinh(__x) * sin(__y)); } #if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_cosh(__complex__ float __z) { return __builtin_ccoshf(__z); } inline __complex__ double __complex_cosh(__complex__ double __z) { return __builtin_ccosh(__z); } inline __complex__ long double __complex_cosh(const __complex__ long double& __z) { return __builtin_ccoshl(__z); } template<typename _Tp> inline complex<_Tp> cosh(const complex<_Tp>& __z) { return __complex_cosh(__z.__rep()); } #else template<typename _Tp> inline complex<_Tp> cosh(const complex<_Tp>& __z) { return __complex_cosh(__z); } #endif // 26.2.8/3 exp(__z): Returns the complex base e exponential of x template<typename _Tp> inline complex<_Tp> __complex_exp(const complex<_Tp>& __z) { return std::polar(exp(__z.real()), __z.imag()); } #if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_exp(__complex__ float __z) { return __builtin_cexpf(__z); } inline __complex__ double __complex_exp(__complex__ double __z) { return __builtin_cexp(__z); } inline __complex__ long double __complex_exp(const __complex__ long double& __z) { return __builtin_cexpl(__z); } template<typename _Tp> inline complex<_Tp> exp(const complex<_Tp>& __z) { return __complex_exp(__z.__rep()); } #else template<typename _Tp> inline complex<_Tp> exp(const complex<_Tp>& __z) { return __complex_exp(__z); } #endif // 26.2.8/5 log(__z): Returns the natural complex logarithm of __z. // The branch cut is along the negative axis. template<typename _Tp> inline complex<_Tp> __complex_log(const complex<_Tp>& __z) { return complex<_Tp>(log(std::abs(__z)), std::arg(__z)); } #if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_log(__complex__ float __z) { return __builtin_clogf(__z); } inline __complex__ double __complex_log(__complex__ double __z) { return __builtin_clog(__z); } inline __complex__ long double __complex_log(const __complex__ long double& __z) { return __builtin_clogl(__z); } template<typename _Tp> inline complex<_Tp> log(const complex<_Tp>& __z) { return __complex_log(__z.__rep()); } #else template<typename _Tp> inline complex<_Tp> log(const complex<_Tp>& __z) { return __complex_log(__z); } #endif template<typename _Tp> inline complex<_Tp> log10(const complex<_Tp>& __z) { return std::log(__z) / log(_Tp(10.0)); } // 26.2.8/10 sin(__z): Returns the sine of __z. template<typename _Tp> inline complex<_Tp> __complex_sin(const complex<_Tp>& __z) { const _Tp __x = __z.real(); const _Tp __y = __z.imag(); return complex<_Tp>(sin(__x) * cosh(__y), cos(__x) * sinh(__y)); } #if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_sin(__complex__ float __z) { return __builtin_csinf(__z); } inline __complex__ double __complex_sin(__complex__ double __z) { return __builtin_csin(__z); } inline __complex__ long double __complex_sin(const __complex__ long double& __z) { return __builtin_csinl(__z); } template<typename _Tp> inline complex<_Tp> sin(const complex<_Tp>& __z) { return __complex_sin(__z.__rep()); } #else template<typename _Tp> inline complex<_Tp> sin(const complex<_Tp>& __z) { return __complex_sin(__z); } #endif // 26.2.8/11 sinh(__z): Returns the hyperbolic sine of __z. template<typename _Tp> inline complex<_Tp> __complex_sinh(const complex<_Tp>& __z) { const _Tp __x = __z.real(); const _Tp __y = __z.imag(); return complex<_Tp>(sinh(__x) * cos(__y), cosh(__x) * sin(__y)); } #if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_sinh(__complex__ float __z) { return __builtin_csinhf(__z); } inline __complex__ double __complex_sinh(__complex__ double __z) { return __builtin_csinh(__z); } inline __complex__ long double __complex_sinh(const __complex__ long double& __z) { return __builtin_csinhl(__z); } template<typename _Tp> inline complex<_Tp> sinh(const complex<_Tp>& __z) { return __complex_sinh(__z.__rep()); } #else template<typename _Tp> inline complex<_Tp> sinh(const complex<_Tp>& __z) { return __complex_sinh(__z); } #endif // 26.2.8/13 sqrt(__z): Returns the complex square root of __z. // The branch cut is on the negative axis. template<typename _Tp> complex<_Tp> __complex_sqrt(const complex<_Tp>& __z) { _Tp __x = __z.real(); _Tp __y = __z.imag(); if (__x == _Tp()) { _Tp __t = sqrt(abs(__y) / 2); return complex<_Tp>(__t, __y < _Tp() ? -__t : __t); } else { _Tp __t = sqrt(2 * (std::abs(__z) + abs(__x))); _Tp __u = __t / 2; return __x > _Tp() ? complex<_Tp>(__u, __y / __t) : complex<_Tp>(abs(__y) / __t, __y < _Tp() ? -__u : __u); } } #if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_sqrt(__complex__ float __z) { return __builtin_csqrtf(__z); } inline __complex__ double __complex_sqrt(__complex__ double __z) { return __builtin_csqrt(__z); } inline __complex__ long double __complex_sqrt(const __complex__ long double& __z) { return __builtin_csqrtl(__z); } template<typename _Tp> inline complex<_Tp> sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z.__rep()); } #else template<typename _Tp> inline complex<_Tp> sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z); } #endif // 26.2.8/14 tan(__z): Return the complex tangent of __z. template<typename _Tp> inline complex<_Tp> __complex_tan(const complex<_Tp>& __z) { return std::sin(__z) / std::cos(__z); } #if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_tan(__complex__ float __z) { return __builtin_ctanf(__z); } inline __complex__ double __complex_tan(__complex__ double __z) { return __builtin_ctan(__z); } inline __complex__ long double __complex_tan(const __complex__ long double& __z) { return __builtin_ctanl(__z); } template<typename _Tp> inline complex<_Tp> tan(const complex<_Tp>& __z) { return __complex_tan(__z.__rep()); } #else template<typename _Tp> inline complex<_Tp> tan(const complex<_Tp>& __z) { return __complex_tan(__z); } #endif // 26.2.8/15 tanh(__z): Returns the hyperbolic tangent of __z. template<typename _Tp> inline complex<_Tp> __complex_tanh(const complex<_Tp>& __z) { return std::sinh(__z) / std::cosh(__z); } #if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_tanh(__complex__ float __z) { return __builtin_ctanhf(__z); } inline __complex__ double __complex_tanh(__complex__ double __z) { return __builtin_ctanh(__z); } inline __complex__ long double __complex_tanh(const __complex__ long double& __z) { return __builtin_ctanhl(__z); } template<typename _Tp> inline complex<_Tp> tanh(const complex<_Tp>& __z) { return __complex_tanh(__z.__rep()); } #else template<typename _Tp> inline complex<_Tp> tanh(const complex<_Tp>& __z) { return __complex_tanh(__z); } #endif // 26.2.8/9 pow(__x, __y): Returns the complex power base of __x // raised to the __y-th power. The branch // cut is on the negative axis. #if __cplusplus < 201103L template<typename _Tp> complex<_Tp> __complex_pow_unsigned(complex<_Tp> __x, unsigned __n) { complex<_Tp> __y = __n % 2 ? __x : complex<_Tp>(1); while (__n >>= 1) { __x *= __x; if (__n % 2) __y *= __x; } return __y; } // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 844. complex pow return type is ambiguous. template<typename _Tp> inline complex<_Tp> pow(const complex<_Tp>& __z, int __n) { return __n < 0 ? complex<_Tp>(1) / std::__complex_pow_unsigned(__z, -(unsigned)__n) : std::__complex_pow_unsigned(__z, __n); } #endif template<typename _Tp> complex<_Tp> pow(const complex<_Tp>& __x, const _Tp& __y) { #ifndef _GLIBCXX_USE_C99_COMPLEX if (__x == _Tp()) return _Tp(); #endif if (__x.imag() == _Tp() && __x.real() > _Tp()) return pow(__x.real(), __y); complex<_Tp> __t = std::log(__x); return std::polar(exp(__y * __t.real()), __y * __t.imag()); } template<typename _Tp> inline complex<_Tp> __complex_pow(const complex<_Tp>& __x, const complex<_Tp>& __y) { return __x == _Tp() ? _Tp() : std::exp(__y * std::log(__x)); } #if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_pow(__complex__ float __x, __complex__ float __y) { return __builtin_cpowf(__x, __y); } inline __complex__ double __complex_pow(__complex__ double __x, __complex__ double __y) { return __builtin_cpow(__x, __y); } inline __complex__ long double __complex_pow(const __complex__ long double& __x, const __complex__ long double& __y) { return __builtin_cpowl(__x, __y); } template<typename _Tp> inline complex<_Tp> pow(const complex<_Tp>& __x, const complex<_Tp>& __y) { return __complex_pow(__x.__rep(), __y.__rep()); } #else template<typename _Tp> inline complex<_Tp> pow(const complex<_Tp>& __x, const complex<_Tp>& __y) { return __complex_pow(__x, __y); } #endif template<typename _Tp> inline complex<_Tp> pow(const _Tp& __x, const complex<_Tp>& __y) { return __x > _Tp() ? std::polar(pow(__x, __y.real()), __y.imag() * log(__x)) : std::pow(complex<_Tp>(__x), __y); } /// 26.2.3 complex specializations /// complex<float> specialization template<> struct complex<float> { typedef float value_type; typedef __complex__ float _ComplexT; _GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { } _GLIBCXX_CONSTEXPR complex(float __r = 0.0f, float __i = 0.0f) #if __cplusplus >= 201103L : _M_value{ __r, __i } { } #else { __real__ _M_value = __r; __imag__ _M_value = __i; } #endif explicit _GLIBCXX_CONSTEXPR complex(const complex<double>&); explicit _GLIBCXX_CONSTEXPR complex(const complex<long double>&); #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. __attribute ((__abi_tag__ ("cxx11"))) constexpr float real() { return __real__ _M_value; } __attribute ((__abi_tag__ ("cxx11"))) constexpr float imag() { return __imag__ _M_value; } #else float& real() { return __real__ _M_value; } const float& real() const { return __real__ _M_value; } float& imag() { return __imag__ _M_value; } const float& imag() const { return __imag__ _M_value; } #endif // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. void real(float __val) { __real__ _M_value = __val; } void imag(float __val) { __imag__ _M_value = __val; } complex& operator=(float __f) { _M_value = __f; return *this; } complex& operator+=(float __f) { _M_value += __f; return *this; } complex& operator-=(float __f) { _M_value -= __f; return *this; } complex& operator*=(float __f) { _M_value *= __f; return *this; } complex& operator/=(float __f) { _M_value /= __f; return *this; } // Let the compiler synthesize the copy and assignment // operator. It always does a pretty good job. // complex& operator=(const complex&); template<typename _Tp> complex& operator=(const complex<_Tp>& __z) { __real__ _M_value = __z.real(); __imag__ _M_value = __z.imag(); return *this; } template<typename _Tp> complex& operator+=(const complex<_Tp>& __z) { __real__ _M_value += __z.real(); __imag__ _M_value += __z.imag(); return *this; } template<class _Tp> complex& operator-=(const complex<_Tp>& __z) { __real__ _M_value -= __z.real(); __imag__ _M_value -= __z.imag(); return *this; } template<class _Tp> complex& operator*=(const complex<_Tp>& __z) { _ComplexT __t; __real__ __t = __z.real(); __imag__ __t = __z.imag(); _M_value *= __t; return *this; } template<class _Tp> complex& operator/=(const complex<_Tp>& __z) { _ComplexT __t; __real__ __t = __z.real(); __imag__ __t = __z.imag(); _M_value /= __t; return *this; } _GLIBCXX_USE_CONSTEXPR _ComplexT __rep() const { return _M_value; } private: _ComplexT _M_value; }; /// 26.2.3 complex specializations /// complex<double> specialization template<> struct complex<double> { typedef double value_type; typedef __complex__ double _ComplexT; _GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { } _GLIBCXX_CONSTEXPR complex(double __r = 0.0, double __i = 0.0) #if __cplusplus >= 201103L : _M_value{ __r, __i } { } #else { __real__ _M_value = __r; __imag__ _M_value = __i; } #endif _GLIBCXX_CONSTEXPR complex(const complex<float>& __z) : _M_value(__z.__rep()) { } explicit _GLIBCXX_CONSTEXPR complex(const complex<long double>&); #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. __attribute ((__abi_tag__ ("cxx11"))) constexpr double real() { return __real__ _M_value; } __attribute ((__abi_tag__ ("cxx11"))) constexpr double imag() { return __imag__ _M_value; } #else double& real() { return __real__ _M_value; } const double& real() const { return __real__ _M_value; } double& imag() { return __imag__ _M_value; } const double& imag() const { return __imag__ _M_value; } #endif // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. void real(double __val) { __real__ _M_value = __val; } void imag(double __val) { __imag__ _M_value = __val; } complex& operator=(double __d) { _M_value = __d; return *this; } complex& operator+=(double __d) { _M_value += __d; return *this; } complex& operator-=(double __d) { _M_value -= __d; return *this; } complex& operator*=(double __d) { _M_value *= __d; return *this; } complex& operator/=(double __d) { _M_value /= __d; return *this; } // The compiler will synthesize this, efficiently. // complex& operator=(const complex&); template<typename _Tp> complex& operator=(const complex<_Tp>& __z) { __real__ _M_value = __z.real(); __imag__ _M_value = __z.imag(); return *this; } template<typename _Tp> complex& operator+=(const complex<_Tp>& __z) { __real__ _M_value += __z.real(); __imag__ _M_value += __z.imag(); return *this; } template<typename _Tp> complex& operator-=(const complex<_Tp>& __z) { __real__ _M_value -= __z.real(); __imag__ _M_value -= __z.imag(); return *this; } template<typename _Tp> complex& operator*=(const complex<_Tp>& __z) { _ComplexT __t; __real__ __t = __z.real(); __imag__ __t = __z.imag(); _M_value *= __t; return *this; } template<typename _Tp> complex& operator/=(const complex<_Tp>& __z) { _ComplexT __t; __real__ __t = __z.real(); __imag__ __t = __z.imag(); _M_value /= __t; return *this; } _GLIBCXX_USE_CONSTEXPR _ComplexT __rep() const { return _M_value; } private: _ComplexT _M_value; }; /// 26.2.3 complex specializations /// complex<long double> specialization template<> struct complex<long double> { typedef long double value_type; typedef __complex__ long double _ComplexT; _GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { } _GLIBCXX_CONSTEXPR complex(long double __r = 0.0L, long double __i = 0.0L) #if __cplusplus >= 201103L : _M_value{ __r, __i } { } #else { __real__ _M_value = __r; __imag__ _M_value = __i; } #endif _GLIBCXX_CONSTEXPR complex(const complex<float>& __z) : _M_value(__z.__rep()) { } _GLIBCXX_CONSTEXPR complex(const complex<double>& __z) : _M_value(__z.__rep()) { } #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. __attribute ((__abi_tag__ ("cxx11"))) constexpr long double real() { return __real__ _M_value; } __attribute ((__abi_tag__ ("cxx11"))) constexpr long double imag() { return __imag__ _M_value; } #else long double& real() { return __real__ _M_value; } const long double& real() const { return __real__ _M_value; } long double& imag() { return __imag__ _M_value; } const long double& imag() const { return __imag__ _M_value; } #endif // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. void real(long double __val) { __real__ _M_value = __val; } void imag(long double __val) { __imag__ _M_value = __val; } complex& operator=(long double __r) { _M_value = __r; return *this; } complex& operator+=(long double __r) { _M_value += __r; return *this; } complex& operator-=(long double __r) { _M_value -= __r; return *this; } complex& operator*=(long double __r) { _M_value *= __r; return *this; } complex& operator/=(long double __r) { _M_value /= __r; return *this; } // The compiler knows how to do this efficiently // complex& operator=(const complex&); template<typename _Tp> complex& operator=(const complex<_Tp>& __z) { __real__ _M_value = __z.real(); __imag__ _M_value = __z.imag(); return *this; } template<typename _Tp> complex& operator+=(const complex<_Tp>& __z) { __real__ _M_value += __z.real(); __imag__ _M_value += __z.imag(); return *this; } template<typename _Tp> complex& operator-=(const complex<_Tp>& __z) { __real__ _M_value -= __z.real(); __imag__ _M_value -= __z.imag(); return *this; } template<typename _Tp> complex& operator*=(const complex<_Tp>& __z) { _ComplexT __t; __real__ __t = __z.real(); __imag__ __t = __z.imag(); _M_value *= __t; return *this; } template<typename _Tp> complex& operator/=(const complex<_Tp>& __z) { _ComplexT __t; __real__ __t = __z.real(); __imag__ __t = __z.imag(); _M_value /= __t; return *this; } _GLIBCXX_USE_CONSTEXPR _ComplexT __rep() const { return _M_value; } private: _ComplexT _M_value; }; // These bits have to be at the end of this file, so that the // specializations have all been defined. inline _GLIBCXX_CONSTEXPR complex<float>::complex(const complex<double>& __z) : _M_value(__z.__rep()) { } inline _GLIBCXX_CONSTEXPR complex<float>::complex(const complex<long double>& __z) : _M_value(__z.__rep()) { } inline _GLIBCXX_CONSTEXPR complex<double>::complex(const complex<long double>& __z) : _M_value(__z.__rep()) { } // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. // NB: This syntax is a GNU extension. #if _GLIBCXX_EXTERN_TEMPLATE extern template istream& operator>>(istream&, complex<float>&); extern template ostream& operator<<(ostream&, const complex<float>&); extern template istream& operator>>(istream&, complex<double>&); extern template ostream& operator<<(ostream&, const complex<double>&); extern template istream& operator>>(istream&, complex<long double>&); extern template ostream& operator<<(ostream&, const complex<long double>&); #ifdef _GLIBCXX_USE_WCHAR_T extern template wistream& operator>>(wistream&, complex<float>&); extern template wostream& operator<<(wostream&, const complex<float>&); extern template wistream& operator>>(wistream&, complex<double>&); extern template wostream& operator<<(wostream&, const complex<double>&); extern template wistream& operator>>(wistream&, complex<long double>&); extern template wostream& operator<<(wostream&, const complex<long double>&); #endif #endif // @} group complex_numbers _GLIBCXX_END_NAMESPACE_VERSION } // namespace namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // See ext/type_traits.h for the primary template. template<typename _Tp, typename _Up> struct __promote_2<std::complex<_Tp>, _Up> { public: typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type; }; template<typename _Tp, typename _Up> struct __promote_2<_Tp, std::complex<_Up> > { public: typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type; }; template<typename _Tp, typename _Up> struct __promote_2<std::complex<_Tp>, std::complex<_Up> > { public: typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type; }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #if __cplusplus >= 201103L namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Forward declarations. template<typename _Tp> std::complex<_Tp> acos(const std::complex<_Tp>&); template<typename _Tp> std::complex<_Tp> asin(const std::complex<_Tp>&); template<typename _Tp> std::complex<_Tp> atan(const std::complex<_Tp>&); template<typename _Tp> std::complex<_Tp> acosh(const std::complex<_Tp>&); template<typename _Tp> std::complex<_Tp> asinh(const std::complex<_Tp>&); template<typename _Tp> std::complex<_Tp> atanh(const std::complex<_Tp>&); // DR 595. template<typename _Tp> _Tp fabs(const std::complex<_Tp>&); template<typename _Tp> inline std::complex<_Tp> __complex_acos(const std::complex<_Tp>& __z) { const std::complex<_Tp> __t = std::asin(__z); const _Tp __pi_2 = 1.5707963267948966192313216916397514L; return std::complex<_Tp>(__pi_2 - __t.real(), -__t.imag()); } #if _GLIBCXX_USE_C99_COMPLEX_TR1 inline __complex__ float __complex_acos(__complex__ float __z) { return __builtin_cacosf(__z); } inline __complex__ double __complex_acos(__complex__ double __z) { return __builtin_cacos(__z); } inline __complex__ long double __complex_acos(const __complex__ long double& __z) { return __builtin_cacosl(__z); } template<typename _Tp> inline std::complex<_Tp> acos(const std::complex<_Tp>& __z) { return __complex_acos(__z.__rep()); } #else /// acos(__z) [8.1.2]. // Effects: Behaves the same as C99 function cacos, defined // in subclause 7.3.5.1. template<typename _Tp> inline std::complex<_Tp> acos(const std::complex<_Tp>& __z) { return __complex_acos(__z); } #endif template<typename _Tp> inline std::complex<_Tp> __complex_asin(const std::complex<_Tp>& __z) { std::complex<_Tp> __t(-__z.imag(), __z.real()); __t = std::asinh(__t); return std::complex<_Tp>(__t.imag(), -__t.real()); } #if _GLIBCXX_USE_C99_COMPLEX_TR1 inline __complex__ float __complex_asin(__complex__ float __z) { return __builtin_casinf(__z); } inline __complex__ double __complex_asin(__complex__ double __z) { return __builtin_casin(__z); } inline __complex__ long double __complex_asin(const __complex__ long double& __z) { return __builtin_casinl(__z); } template<typename _Tp> inline std::complex<_Tp> asin(const std::complex<_Tp>& __z) { return __complex_asin(__z.__rep()); } #else /// asin(__z) [8.1.3]. // Effects: Behaves the same as C99 function casin, defined // in subclause 7.3.5.2. template<typename _Tp> inline std::complex<_Tp> asin(const std::complex<_Tp>& __z) { return __complex_asin(__z); } #endif template<typename _Tp> std::complex<_Tp> __complex_atan(const std::complex<_Tp>& __z) { const _Tp __r2 = __z.real() * __z.real(); const _Tp __x = _Tp(1.0) - __r2 - __z.imag() * __z.imag(); _Tp __num = __z.imag() + _Tp(1.0); _Tp __den = __z.imag() - _Tp(1.0); __num = __r2 + __num * __num; __den = __r2 + __den * __den; return std::complex<_Tp>(_Tp(0.5) * atan2(_Tp(2.0) * __z.real(), __x), _Tp(0.25) * log(__num / __den)); } #if _GLIBCXX_USE_C99_COMPLEX_TR1 inline __complex__ float __complex_atan(__complex__ float __z) { return __builtin_catanf(__z); } inline __complex__ double __complex_atan(__complex__ double __z) { return __builtin_catan(__z); } inline __complex__ long double __complex_atan(const __complex__ long double& __z) { return __builtin_catanl(__z); } template<typename _Tp> inline std::complex<_Tp> atan(const std::complex<_Tp>& __z) { return __complex_atan(__z.__rep()); } #else /// atan(__z) [8.1.4]. // Effects: Behaves the same as C99 function catan, defined // in subclause 7.3.5.3. template<typename _Tp> inline std::complex<_Tp> atan(const std::complex<_Tp>& __z) { return __complex_atan(__z); } #endif template<typename _Tp> std::complex<_Tp> __complex_acosh(const std::complex<_Tp>& __z) { // Kahan's formula. return _Tp(2.0) * std::log(std::sqrt(_Tp(0.5) * (__z + _Tp(1.0))) + std::sqrt(_Tp(0.5) * (__z - _Tp(1.0)))); } #if _GLIBCXX_USE_C99_COMPLEX_TR1 inline __complex__ float __complex_acosh(__complex__ float __z) { return __builtin_cacoshf(__z); } inline __complex__ double __complex_acosh(__complex__ double __z) { return __builtin_cacosh(__z); } inline __complex__ long double __complex_acosh(const __complex__ long double& __z) { return __builtin_cacoshl(__z); } template<typename _Tp> inline std::complex<_Tp> acosh(const std::complex<_Tp>& __z) { return __complex_acosh(__z.__rep()); } #else /// acosh(__z) [8.1.5]. // Effects: Behaves the same as C99 function cacosh, defined // in subclause 7.3.6.1. template<typename _Tp> inline std::complex<_Tp> acosh(const std::complex<_Tp>& __z) { return __complex_acosh(__z); } #endif template<typename _Tp> std::complex<_Tp> __complex_asinh(const std::complex<_Tp>& __z) { std::complex<_Tp> __t((__z.real() - __z.imag()) * (__z.real() + __z.imag()) + _Tp(1.0), _Tp(2.0) * __z.real() * __z.imag()); __t = std::sqrt(__t); return std::log(__t + __z); } #if _GLIBCXX_USE_C99_COMPLEX_TR1 inline __complex__ float __complex_asinh(__complex__ float __z) { return __builtin_casinhf(__z); } inline __complex__ double __complex_asinh(__complex__ double __z) { return __builtin_casinh(__z); } inline __complex__ long double __complex_asinh(const __complex__ long double& __z) { return __builtin_casinhl(__z); } template<typename _Tp> inline std::complex<_Tp> asinh(const std::complex<_Tp>& __z) { return __complex_asinh(__z.__rep()); } #else /// asinh(__z) [8.1.6]. // Effects: Behaves the same as C99 function casin, defined // in subclause 7.3.6.2. template<typename _Tp> inline std::complex<_Tp> asinh(const std::complex<_Tp>& __z) { return __complex_asinh(__z); } #endif template<typename _Tp> std::complex<_Tp> __complex_atanh(const std::complex<_Tp>& __z) { const _Tp __i2 = __z.imag() * __z.imag(); const _Tp __x = _Tp(1.0) - __i2 - __z.real() * __z.real(); _Tp __num = _Tp(1.0) + __z.real(); _Tp __den = _Tp(1.0) - __z.real(); __num = __i2 + __num * __num; __den = __i2 + __den * __den; return std::complex<_Tp>(_Tp(0.25) * (log(__num) - log(__den)), _Tp(0.5) * atan2(_Tp(2.0) * __z.imag(), __x)); } #if _GLIBCXX_USE_C99_COMPLEX_TR1 inline __complex__ float __complex_atanh(__complex__ float __z) { return __builtin_catanhf(__z); } inline __complex__ double __complex_atanh(__complex__ double __z) { return __builtin_catanh(__z); } inline __complex__ long double __complex_atanh(const __complex__ long double& __z) { return __builtin_catanhl(__z); } template<typename _Tp> inline std::complex<_Tp> atanh(const std::complex<_Tp>& __z) { return __complex_atanh(__z.__rep()); } #else /// atanh(__z) [8.1.7]. // Effects: Behaves the same as C99 function catanh, defined // in subclause 7.3.6.3. template<typename _Tp> inline std::complex<_Tp> atanh(const std::complex<_Tp>& __z) { return __complex_atanh(__z); } #endif template<typename _Tp> inline _Tp /// fabs(__z) [8.1.8]. // Effects: Behaves the same as C99 function cabs, defined // in subclause 7.3.8.1. fabs(const std::complex<_Tp>& __z) { return std::abs(__z); } /// Additional overloads [8.1.9]. template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type arg(_Tp __x) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; #if (_GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC) return std::signbit(__x) ? __type(3.1415926535897932384626433832795029L) : __type(); #else return std::arg(std::complex<__type>(__x)); #endif } template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type imag(_Tp) { return _Tp(); } template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type norm(_Tp __x) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __type(__x) * __type(__x); } template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type real(_Tp __x) { return __x; } template<typename _Tp, typename _Up> inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type> pow(const std::complex<_Tp>& __x, const _Up& __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return std::pow(std::complex<__type>(__x), __type(__y)); } template<typename _Tp, typename _Up> inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type> pow(const _Tp& __x, const std::complex<_Up>& __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return std::pow(__type(__x), std::complex<__type>(__y)); } template<typename _Tp, typename _Up> inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type> pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return std::pow(std::complex<__type>(__x), std::complex<__type>(__y)); } // Forward declarations. // DR 781. template<typename _Tp> std::complex<_Tp> proj(const std::complex<_Tp>&); template<typename _Tp> std::complex<_Tp> __complex_proj(const std::complex<_Tp>& __z) { const _Tp __den = (__z.real() * __z.real() + __z.imag() * __z.imag() + _Tp(1.0)); return std::complex<_Tp>((_Tp(2.0) * __z.real()) / __den, (_Tp(2.0) * __z.imag()) / __den); } #if _GLIBCXX_USE_C99_COMPLEX inline __complex__ float __complex_proj(__complex__ float __z) { return __builtin_cprojf(__z); } inline __complex__ double __complex_proj(__complex__ double __z) { return __builtin_cproj(__z); } inline __complex__ long double __complex_proj(const __complex__ long double& __z) { return __builtin_cprojl(__z); } template<typename _Tp> inline std::complex<_Tp> proj(const std::complex<_Tp>& __z) { return __complex_proj(__z.__rep()); } #else template<typename _Tp> inline std::complex<_Tp> proj(const std::complex<_Tp>& __z) { return __complex_proj(__z); } #endif // DR 1137. template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type proj(_Tp __x) { return __x; } template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type conj(_Tp __x) { return __x; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // C++11 #endif /* _GLIBCXX_COMPLEX */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/algorithm���������������������������������������������������������������������������������0000644�����������������00000004726�14763166027�0007523 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <algorithm> -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file include/algorithm * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_ALGORITHM #define _GLIBCXX_ALGORITHM 1 #pragma GCC system_header #include <utility> // UK-300. #include <bits/stl_algobase.h> #include <bits/stl_algo.h> #ifdef _GLIBCXX_PARALLEL # include <parallel/algorithm> #endif #endif /* _GLIBCXX_ALGORITHM */ ������������������������������������������c++/4.8.2/cfenv�������������������������������������������������������������������������������������0000644�����������������00000004003�14763166027�0006622 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <cfenv> -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/cfenv * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_CFENV #define _GLIBCXX_CFENV 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <bits/c++config.h> #if _GLIBCXX_HAVE_FENV_H # include <fenv.h> #endif #ifdef _GLIBCXX_USE_C99_FENV_TR1 #undef feclearexcept #undef fegetexceptflag #undef feraiseexcept #undef fesetexceptflag #undef fetestexcept #undef fegetround #undef fesetround #undef fegetenv #undef feholdexcept #undef fesetenv #undef feupdateenv namespace std { // types using ::fenv_t; using ::fexcept_t; // functions using ::feclearexcept; using ::fegetexceptflag; using ::feraiseexcept; using ::fesetexceptflag; using ::fetestexcept; using ::fegetround; using ::fesetround; using ::fegetenv; using ::feholdexcept; using ::fesetenv; using ::feupdateenv; } // namespace std #endif // _GLIBCXX_USE_C99_FENV_TR1 #endif // C++11 #endif // _GLIBCXX_CFENV �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/iostream����������������������������������������������������������������������������������0000644�����������������00000005207�14763166027�0007353 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Standard iostream objects -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/iostream * This is a Standard C++ Library header. */ // // ISO C++ 14882: 27.3 Standard iostream objects // #ifndef _GLIBCXX_IOSTREAM #define _GLIBCXX_IOSTREAM 1 #pragma GCC system_header #include <bits/c++config.h> #include <ostream> #include <istream> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @name Standard Stream Objects * * The <iostream> header declares the eight <em>standard stream * objects</em>. For other declarations, see * http://gcc.gnu.org/onlinedocs/libstdc++/manual/io.html * and the @link iosfwd I/O forward declarations @endlink * * They are required by default to cooperate with the global C * library's @c FILE streams, and to be available during program * startup and termination. For more information, see the section of the * manual linked to above. */ //@{ extern istream cin; /// Linked to standard input extern ostream cout; /// Linked to standard output extern ostream cerr; /// Linked to standard error (unbuffered) extern ostream clog; /// Linked to standard error (buffered) #ifdef _GLIBCXX_USE_WCHAR_T extern wistream wcin; /// Linked to standard input extern wostream wcout; /// Linked to standard output extern wostream wcerr; /// Linked to standard error (unbuffered) extern wostream wclog; /// Linked to standard error (buffered) #endif //@} // For construction of filebuffers for cout, cin, cerr, clog et. al. static ios_base::Init __ioinit; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _GLIBCXX_IOSTREAM */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/regex�������������������������������������������������������������������������������������0000644�����������������00000003506�14763166027�0006642 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <regex> -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/regex * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_REGEX #define _GLIBCXX_REGEX 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <algorithm> #include <bitset> #include <functional> #ifdef _GLIBCXX_DEBUG # include <iosfwd> #endif #include <iterator> #include <locale> #include <memory> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <string> #include <utility> #include <vector> #include <bits/range_access.h> #include <bits/regex_constants.h> #include <bits/regex_error.h> #include <bits/regex_cursor.h> #include <bits/regex_nfa.h> #include <bits/regex_compiler.h> #include <bits/regex_grep_matcher.h> #include <bits/regex.h> #endif // C++11 #endif // _GLIBCXX_REGEX ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/cerrno������������������������������������������������������������������������������������0000644�����������������00000003316�14763166027�0007017 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// The -*- C++ -*- forwarding header. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file cerrno * This is a Standard C++ Library file. You should @c \#include this file * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c errno.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std (except for names which are defined * as macros in C). */ // // ISO C++ 14882: 19.3 Error numbers // #pragma GCC system_header #include <errno.h> #ifndef _GLIBCXX_CERRNO #define _GLIBCXX_CERRNO 1 // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 #ifndef errno #define errno errno #endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/workstealing.h�������������������������������������������������������������������0000644�����������������00000022614�14763166027�0012264 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/workstealing.h * @brief Parallelization of embarrassingly parallel execution by * means of work-stealing. * * Work stealing is described in * * R. D. Blumofe and C. E. Leiserson. * Scheduling multithreaded computations by work stealing. * Journal of the ACM, 46(5):720–748, 1999. * * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Felix Putze. #ifndef _GLIBCXX_PARALLEL_WORKSTEALING_H #define _GLIBCXX_PARALLEL_WORKSTEALING_H 1 #include <parallel/parallel.h> #include <parallel/random_number.h> #include <parallel/compatibility.h> namespace __gnu_parallel { #define _GLIBCXX_JOB_VOLATILE volatile /** @brief One __job for a certain thread. */ template<typename _DifferenceTp> struct _Job { typedef _DifferenceTp _DifferenceType; /** @brief First element. * * Changed by owning and stealing thread. By stealing thread, * always incremented. */ _GLIBCXX_JOB_VOLATILE _DifferenceType _M_first; /** @brief Last element. * * Changed by owning thread only. */ _GLIBCXX_JOB_VOLATILE _DifferenceType _M_last; /** @brief Number of elements, i.e. @c _M_last-_M_first+1. * * Changed by owning thread only. */ _GLIBCXX_JOB_VOLATILE _DifferenceType _M_load; }; /** @brief Work stealing algorithm for random access iterators. * * Uses O(1) additional memory. Synchronization at job lists is * done with atomic operations. * @param __begin Begin iterator of element sequence. * @param __end End iterator of element sequence. * @param __op User-supplied functor (comparator, predicate, adding * functor, ...). * @param __f Functor to @a process an element with __op (depends on * desired functionality, e. g. for std::for_each(), ...). * @param __r Functor to @a add a single __result to the already * processed elements (depends on functionality). * @param __base Base value for reduction. * @param __output Pointer to position where final result is written to * @param __bound Maximum number of elements processed (e. g. for * std::count_n()). * @return User-supplied functor (that may contain a part of the result). */ template<typename _RAIter, typename _Op, typename _Fu, typename _Red, typename _Result> _Op __for_each_template_random_access_workstealing(_RAIter __begin, _RAIter __end, _Op __op, _Fu& __f, _Red __r, _Result __base, _Result& __output, typename std::iterator_traits<_RAIter>::difference_type __bound) { _GLIBCXX_CALL(__end - __begin) typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::difference_type _DifferenceType; const _Settings& __s = _Settings::get(); _DifferenceType __chunk_size = static_cast<_DifferenceType>(__s.workstealing_chunk_size); // How many jobs? _DifferenceType __length = (__bound < 0) ? (__end - __begin) : __bound; // To avoid false sharing in a cache line. const int __stride = (__s.cache_line_size * 10 / sizeof(_Job<_DifferenceType>) + 1); // Total number of threads currently working. _ThreadIndex __busy = 0; _Job<_DifferenceType> *__job; omp_lock_t __output_lock; omp_init_lock(&__output_lock); // Write base value to output. __output = __base; // No more threads than jobs, at least one thread. _ThreadIndex __num_threads = __gnu_parallel::max<_ThreadIndex> (1, __gnu_parallel::min<_DifferenceType>(__length, __get_max_threads())); # pragma omp parallel shared(__busy) num_threads(__num_threads) { # pragma omp single { __num_threads = omp_get_num_threads(); // Create job description array. __job = new _Job<_DifferenceType>[__num_threads * __stride]; } // Initialization phase. // Flags for every thread if it is doing productive work. bool __iam_working = false; // Thread id. _ThreadIndex __iam = omp_get_thread_num(); // This job. _Job<_DifferenceType>& __my_job = __job[__iam * __stride]; // Random number (for work stealing). _ThreadIndex __victim; // Local value for reduction. _Result __result = _Result(); // Number of elements to steal in one attempt. _DifferenceType __steal; // Every thread has its own random number generator // (modulo __num_threads). _RandomNumber __rand_gen(__iam, __num_threads); // This thread is currently working. # pragma omp atomic ++__busy; __iam_working = true; // How many jobs per thread? last thread gets the rest. __my_job._M_first = static_cast<_DifferenceType> (__iam * (__length / __num_threads)); __my_job._M_last = (__iam == (__num_threads - 1) ? (__length - 1) : ((__iam + 1) * (__length / __num_threads) - 1)); __my_job._M_load = __my_job._M_last - __my_job._M_first + 1; // Init result with _M_first value (to have a base value for reduction) if (__my_job._M_first <= __my_job._M_last) { // Cannot use volatile variable directly. _DifferenceType __my_first = __my_job._M_first; __result = __f(__op, __begin + __my_first); ++__my_job._M_first; --__my_job._M_load; } _RAIter __current; # pragma omp barrier // Actual work phase // Work on own or stolen current start while (__busy > 0) { // Work until no productive thread left. # pragma omp flush(__busy) // Thread has own work to do while (__my_job._M_first <= __my_job._M_last) { // fetch-and-add call // Reserve current job block (size __chunk_size) in my queue. _DifferenceType __current_job = __fetch_and_add<_DifferenceType>(&(__my_job._M_first), __chunk_size); // Update _M_load, to make the three values consistent, // _M_first might have been changed in the meantime __my_job._M_load = __my_job._M_last - __my_job._M_first + 1; for (_DifferenceType __job_counter = 0; __job_counter < __chunk_size && __current_job <= __my_job._M_last; ++__job_counter) { // Yes: process it! __current = __begin + __current_job; ++__current_job; // Do actual work. __result = __r(__result, __f(__op, __current)); } # pragma omp flush(__busy) } // After reaching this point, a thread's __job list is empty. if (__iam_working) { // This thread no longer has work. # pragma omp atomic --__busy; __iam_working = false; } _DifferenceType __supposed_first, __supposed_last, __supposed_load; do { // Find random nonempty deque (not own), do consistency check. __yield(); # pragma omp flush(__busy) __victim = __rand_gen(); __supposed_first = __job[__victim * __stride]._M_first; __supposed_last = __job[__victim * __stride]._M_last; __supposed_load = __job[__victim * __stride]._M_load; } while (__busy > 0 && ((__supposed_load <= 0) || ((__supposed_first + __supposed_load - 1) != __supposed_last))); if (__busy == 0) break; if (__supposed_load > 0) { // Has work and work to do. // Number of elements to steal (at least one). __steal = (__supposed_load < 2) ? 1 : __supposed_load / 2; // Push __victim's current start forward. _DifferenceType __stolen_first = __fetch_and_add<_DifferenceType> (&(__job[__victim * __stride]._M_first), __steal); _DifferenceType __stolen_try = (__stolen_first + __steal - _DifferenceType(1)); __my_job._M_first = __stolen_first; __my_job._M_last = __gnu_parallel::min(__stolen_try, __supposed_last); __my_job._M_load = __my_job._M_last - __my_job._M_first + 1; // Has potential work again. # pragma omp atomic ++__busy; __iam_working = true; # pragma omp flush(__busy) } # pragma omp flush(__busy) } // end while __busy > 0 // Add accumulated result to output. omp_set_lock(&__output_lock); __output = __r(__output, __result); omp_unset_lock(&__output_lock); } delete[] __job; // Points to last element processed (needed as return value for // some algorithms like transform) __f._M_finish_iterator = __begin + __length; omp_destroy_lock(&__output_lock); return __op; } } // end namespace #endif /* _GLIBCXX_PARALLEL_WORKSTEALING_H */ ��������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/find_selectors.h�����������������������������������������������������������������0000644�����������������00000015520�14763166027�0012554 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/find_selectors.h * @brief _Function objects representing different tasks to be plugged * into the parallel find algorithm. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Felix Putze. #ifndef _GLIBCXX_PARALLEL_FIND_SELECTORS_H #define _GLIBCXX_PARALLEL_FIND_SELECTORS_H 1 #include <parallel/tags.h> #include <parallel/basic_iterator.h> #include <bits/stl_pair.h> namespace __gnu_parallel { /** @brief Base class of all __gnu_parallel::__find_template selectors. */ struct __generic_find_selector { }; /** * @brief Test predicate on a single element, used for std::find() * and std::find_if (). */ struct __find_if_selector : public __generic_find_selector { /** @brief Test on one position. * @param __i1 _Iterator on first sequence. * @param __i2 _Iterator on second sequence (unused). * @param __pred Find predicate. */ template<typename _RAIter1, typename _RAIter2, typename _Pred> bool operator()(_RAIter1 __i1, _RAIter2 __i2, _Pred __pred) { return __pred(*__i1); } /** @brief Corresponding sequential algorithm on a sequence. * @param __begin1 Begin iterator of first sequence. * @param __end1 End iterator of first sequence. * @param __begin2 Begin iterator of second sequence. * @param __pred Find predicate. */ template<typename _RAIter1, typename _RAIter2, typename _Pred> std::pair<_RAIter1, _RAIter2> _M_sequential_algorithm(_RAIter1 __begin1, _RAIter1 __end1, _RAIter2 __begin2, _Pred __pred) { return std::make_pair(find_if(__begin1, __end1, __pred, sequential_tag()), __begin2); } }; /** @brief Test predicate on two adjacent elements. */ struct __adjacent_find_selector : public __generic_find_selector { /** @brief Test on one position. * @param __i1 _Iterator on first sequence. * @param __i2 _Iterator on second sequence (unused). * @param __pred Find predicate. */ template<typename _RAIter1, typename _RAIter2, typename _Pred> bool operator()(_RAIter1 __i1, _RAIter2 __i2, _Pred __pred) { // Passed end iterator is one short. return __pred(*__i1, *(__i1 + 1)); } /** @brief Corresponding sequential algorithm on a sequence. * @param __begin1 Begin iterator of first sequence. * @param __end1 End iterator of first sequence. * @param __begin2 Begin iterator of second sequence. * @param __pred Find predicate. */ template<typename _RAIter1, typename _RAIter2, typename _Pred> std::pair<_RAIter1, _RAIter2> _M_sequential_algorithm(_RAIter1 __begin1, _RAIter1 __end1, _RAIter2 __begin2, _Pred __pred) { // Passed end iterator is one short. _RAIter1 __spot = adjacent_find(__begin1, __end1 + 1, __pred, sequential_tag()); if (__spot == (__end1 + 1)) __spot = __end1; return std::make_pair(__spot, __begin2); } }; /** @brief Test inverted predicate on a single element. */ struct __mismatch_selector : public __generic_find_selector { /** * @brief Test on one position. * @param __i1 _Iterator on first sequence. * @param __i2 _Iterator on second sequence (unused). * @param __pred Find predicate. */ template<typename _RAIter1, typename _RAIter2, typename _Pred> bool operator()(_RAIter1 __i1, _RAIter2 __i2, _Pred __pred) { return !__pred(*__i1, *__i2); } /** * @brief Corresponding sequential algorithm on a sequence. * @param __begin1 Begin iterator of first sequence. * @param __end1 End iterator of first sequence. * @param __begin2 Begin iterator of second sequence. * @param __pred Find predicate. */ template<typename _RAIter1, typename _RAIter2, typename _Pred> std::pair<_RAIter1, _RAIter2> _M_sequential_algorithm(_RAIter1 __begin1, _RAIter1 __end1, _RAIter2 __begin2, _Pred __pred) { return mismatch(__begin1, __end1, __begin2, __pred, sequential_tag()); } }; /** @brief Test predicate on several elements. */ template<typename _FIterator> struct __find_first_of_selector : public __generic_find_selector { _FIterator _M_begin; _FIterator _M_end; explicit __find_first_of_selector(_FIterator __begin, _FIterator __end) : _M_begin(__begin), _M_end(__end) { } /** @brief Test on one position. * @param __i1 _Iterator on first sequence. * @param __i2 _Iterator on second sequence (unused). * @param __pred Find predicate. */ template<typename _RAIter1, typename _RAIter2, typename _Pred> bool operator()(_RAIter1 __i1, _RAIter2 __i2, _Pred __pred) { for (_FIterator __pos_in_candidates = _M_begin; __pos_in_candidates != _M_end; ++__pos_in_candidates) if (__pred(*__i1, *__pos_in_candidates)) return true; return false; } /** @brief Corresponding sequential algorithm on a sequence. * @param __begin1 Begin iterator of first sequence. * @param __end1 End iterator of first sequence. * @param __begin2 Begin iterator of second sequence. * @param __pred Find predicate. */ template<typename _RAIter1, typename _RAIter2, typename _Pred> std::pair<_RAIter1, _RAIter2> _M_sequential_algorithm(_RAIter1 __begin1, _RAIter1 __end1, _RAIter2 __begin2, _Pred __pred) { return std::make_pair(find_first_of(__begin1, __end1, _M_begin, _M_end, __pred, sequential_tag()), __begin2); } }; } #endif /* _GLIBCXX_PARALLEL_FIND_SELECTORS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/algorithm������������������������������������������������������������������������0000644�����������������00000002545�14763166027�0011314 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Algorithm extensions -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/algorithm * This file is a GNU extension to the Standard C++ Library. */ #ifndef _PARALLEL_ALGORITHM #define _PARALLEL_ALGORITHM 1 #pragma GCC system_header #include <algorithm> #include <parallel/algorithmfwd.h> #include <parallel/algobase.h> #include <parallel/algo.h> #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/types.h��������������������������������������������������������������������������0000644�����������������00000007204�14763166027�0010715 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/types.h * @brief Basic types and typedefs. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler and Felix Putze. #ifndef _GLIBCXX_PARALLEL_TYPES_H #define _GLIBCXX_PARALLEL_TYPES_H 1 #include <cstdlib> #include <limits> #include <tr1/cstdint> namespace __gnu_parallel { // Enumerated types. /// Run-time equivalents for the compile-time tags. enum _Parallelism { /// Not parallel. sequential, /// Parallel unbalanced (equal-sized chunks). parallel_unbalanced, /// Parallel balanced (work-stealing). parallel_balanced, /// Parallel with OpenMP dynamic load-balancing. parallel_omp_loop, /// Parallel with OpenMP static load-balancing. parallel_omp_loop_static, /// Parallel with OpenMP taskqueue construct. parallel_taskqueue }; /// Strategies for run-time algorithm selection: // force_sequential, force_parallel, heuristic. enum _AlgorithmStrategy { heuristic, force_sequential, force_parallel }; /// Sorting algorithms: // multi-way mergesort, quicksort, load-balanced quicksort. enum _SortAlgorithm { MWMS, QS, QS_BALANCED }; /// Merging algorithms: // bubblesort-alike, loser-tree variants, enum __sentinel. enum _MultiwayMergeAlgorithm { LOSER_TREE }; /// Partial sum algorithms: recursive, linear. enum _PartialSumAlgorithm { RECURSIVE, LINEAR }; /// Sorting/merging algorithms: sampling, __exact. enum _SplittingAlgorithm { SAMPLING, EXACT }; /// Find algorithms: // growing blocks, equal-sized blocks, equal splitting. enum _FindAlgorithm { GROWING_BLOCKS, CONSTANT_SIZE_BLOCKS, EQUAL_SPLIT }; /** * @brief Unsigned integer to index __elements. * The total number of elements for each algorithm must fit into this type. */ typedef uint64_t _SequenceIndex; /** * @brief Unsigned integer to index a thread number. * The maximum thread number (for each processor) must fit into this type. */ typedef uint16_t _ThreadIndex; // XXX atomics interface? /// Longest compare-and-swappable integer type on this platform. typedef int64_t _CASable; /// Number of bits of _CASable. static const int _CASable_bits = std::numeric_limits<_CASable>::digits; /// ::_CASable with the right half of bits set to 1. static const _CASable _CASable_mask = ((_CASable(1) << (_CASable_bits / 2)) - 1); } #endif /* _GLIBCXX_PARALLEL_TYPES_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/equally_split.h������������������������������������������������������������������0000644�����������������00000006434�14763166027�0012444 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/equally_split.h * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler. #ifndef _GLIBCXX_PARALLEL_EQUALLY_SPLIT_H #define _GLIBCXX_PARALLEL_EQUALLY_SPLIT_H 1 namespace __gnu_parallel { /** @brief function to split a sequence into parts of almost equal size. * * The resulting sequence __s of length __num_threads+1 contains the * splitting positions when splitting the range [0,__n) into parts of * almost equal size (plus minus 1). The first entry is 0, the last * one n. There may result empty parts. * @param __n Number of elements * @param __num_threads Number of parts * @param __s Splitters * @returns End of __splitter sequence, i.e. @c __s+__num_threads+1 */ template<typename _DifferenceType, typename _OutputIterator> _OutputIterator __equally_split(_DifferenceType __n, _ThreadIndex __num_threads, _OutputIterator __s) { _DifferenceType __chunk_length = __n / __num_threads; _DifferenceType __num_longer_chunks = __n % __num_threads; _DifferenceType __pos = 0; for (_ThreadIndex __i = 0; __i < __num_threads; ++__i) { *__s++ = __pos; __pos += ((__i < __num_longer_chunks) ? (__chunk_length + 1) : __chunk_length); } *__s++ = __n; return __s; } /** @brief function to split a sequence into parts of almost equal size. * * Returns the position of the splitting point between * thread number __thread_no (included) and * thread number __thread_no+1 (excluded). * @param __n Number of elements * @param __num_threads Number of parts * @param __thread_no Number of threads * @returns splitting point */ template<typename _DifferenceType> _DifferenceType __equally_split_point(_DifferenceType __n, _ThreadIndex __num_threads, _ThreadIndex __thread_no) { _DifferenceType __chunk_length = __n / __num_threads; _DifferenceType __num_longer_chunks = __n % __num_threads; if (__thread_no < __num_longer_chunks) return __thread_no * (__chunk_length + 1); else return __num_longer_chunks * (__chunk_length + 1) + (__thread_no - __num_longer_chunks) * __chunk_length; } } #endif /* _GLIBCXX_PARALLEL_EQUALLY_SPLIT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/set_operations.h�����������������������������������������������������������������0000644�����������������00000034376�14763166027�0012621 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** * @file parallel/set_operations.h * @brief Parallel implementations of set operations for random-access * iterators. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Marius Elvert and Felix Bondarenko. #ifndef _GLIBCXX_PARALLEL_SET_OPERATIONS_H #define _GLIBCXX_PARALLEL_SET_OPERATIONS_H 1 #include <omp.h> #include <parallel/settings.h> #include <parallel/multiseq_selection.h> namespace __gnu_parallel { template<typename _IIter, typename _OutputIterator> _OutputIterator __copy_tail(std::pair<_IIter, _IIter> __b, std::pair<_IIter, _IIter> __e, _OutputIterator __r) { if (__b.first != __e.first) { do { *__r++ = *__b.first++; } while (__b.first != __e.first); } else { while (__b.second != __e.second) *__r++ = *__b.second++; } return __r; } template<typename _IIter, typename _OutputIterator, typename _Compare> struct __symmetric_difference_func { typedef std::iterator_traits<_IIter> _TraitsType; typedef typename _TraitsType::difference_type _DifferenceType; typedef typename std::pair<_IIter, _IIter> _IteratorPair; __symmetric_difference_func(_Compare __comp) : _M_comp(__comp) {} _Compare _M_comp; _OutputIterator _M_invoke(_IIter __a, _IIter __b, _IIter __c, _IIter __d, _OutputIterator __r) const { while (__a != __b && __c != __d) { if (_M_comp(*__a, *__c)) { *__r = *__a; ++__a; ++__r; } else if (_M_comp(*__c, *__a)) { *__r = *__c; ++__c; ++__r; } else { ++__a; ++__c; } } return std::copy(__c, __d, std::copy(__a, __b, __r)); } _DifferenceType __count(_IIter __a, _IIter __b, _IIter __c, _IIter __d) const { _DifferenceType __counter = 0; while (__a != __b && __c != __d) { if (_M_comp(*__a, *__c)) { ++__a; ++__counter; } else if (_M_comp(*__c, *__a)) { ++__c; ++__counter; } else { ++__a; ++__c; } } return __counter + (__b - __a) + (__d - __c); } _OutputIterator __first_empty(_IIter __c, _IIter __d, _OutputIterator __out) const { return std::copy(__c, __d, __out); } _OutputIterator __second_empty(_IIter __a, _IIter __b, _OutputIterator __out) const { return std::copy(__a, __b, __out); } }; template<typename _IIter, typename _OutputIterator, typename _Compare> struct __difference_func { typedef std::iterator_traits<_IIter> _TraitsType; typedef typename _TraitsType::difference_type _DifferenceType; typedef typename std::pair<_IIter, _IIter> _IteratorPair; __difference_func(_Compare __comp) : _M_comp(__comp) {} _Compare _M_comp; _OutputIterator _M_invoke(_IIter __a, _IIter __b, _IIter __c, _IIter __d, _OutputIterator __r) const { while (__a != __b && __c != __d) { if (_M_comp(*__a, *__c)) { *__r = *__a; ++__a; ++__r; } else if (_M_comp(*__c, *__a)) { ++__c; } else { ++__a; ++__c; } } return std::copy(__a, __b, __r); } _DifferenceType __count(_IIter __a, _IIter __b, _IIter __c, _IIter __d) const { _DifferenceType __counter = 0; while (__a != __b && __c != __d) { if (_M_comp(*__a, *__c)) { ++__a; ++__counter; } else if (_M_comp(*__c, *__a)) { ++__c; } else { ++__a; ++__c; } } return __counter + (__b - __a); } _OutputIterator __first_empty(_IIter, _IIter, _OutputIterator __out) const { return __out; } _OutputIterator __second_empty(_IIter __a, _IIter __b, _OutputIterator __out) const { return std::copy(__a, __b, __out); } }; template<typename _IIter, typename _OutputIterator, typename _Compare> struct __intersection_func { typedef std::iterator_traits<_IIter> _TraitsType; typedef typename _TraitsType::difference_type _DifferenceType; typedef typename std::pair<_IIter, _IIter> _IteratorPair; __intersection_func(_Compare __comp) : _M_comp(__comp) {} _Compare _M_comp; _OutputIterator _M_invoke(_IIter __a, _IIter __b, _IIter __c, _IIter __d, _OutputIterator __r) const { while (__a != __b && __c != __d) { if (_M_comp(*__a, *__c)) { ++__a; } else if (_M_comp(*__c, *__a)) { ++__c; } else { *__r = *__a; ++__a; ++__c; ++__r; } } return __r; } _DifferenceType __count(_IIter __a, _IIter __b, _IIter __c, _IIter __d) const { _DifferenceType __counter = 0; while (__a != __b && __c != __d) { if (_M_comp(*__a, *__c)) { ++__a; } else if (_M_comp(*__c, *__a)) { ++__c; } else { ++__a; ++__c; ++__counter; } } return __counter; } _OutputIterator __first_empty(_IIter, _IIter, _OutputIterator __out) const { return __out; } _OutputIterator __second_empty(_IIter, _IIter, _OutputIterator __out) const { return __out; } }; template<class _IIter, class _OutputIterator, class _Compare> struct __union_func { typedef typename std::iterator_traits<_IIter>::difference_type _DifferenceType; __union_func(_Compare __comp) : _M_comp(__comp) {} _Compare _M_comp; _OutputIterator _M_invoke(_IIter __a, const _IIter __b, _IIter __c, const _IIter __d, _OutputIterator __r) const { while (__a != __b && __c != __d) { if (_M_comp(*__a, *__c)) { *__r = *__a; ++__a; } else if (_M_comp(*__c, *__a)) { *__r = *__c; ++__c; } else { *__r = *__a; ++__a; ++__c; } ++__r; } return std::copy(__c, __d, std::copy(__a, __b, __r)); } _DifferenceType __count(_IIter __a, _IIter __b, _IIter __c, _IIter __d) const { _DifferenceType __counter = 0; while (__a != __b && __c != __d) { if (_M_comp(*__a, *__c)) { ++__a; } else if (_M_comp(*__c, *__a)) { ++__c; } else { ++__a; ++__c; } ++__counter; } __counter += (__b - __a); __counter += (__d - __c); return __counter; } _OutputIterator __first_empty(_IIter __c, _IIter __d, _OutputIterator __out) const { return std::copy(__c, __d, __out); } _OutputIterator __second_empty(_IIter __a, _IIter __b, _OutputIterator __out) const { return std::copy(__a, __b, __out); } }; template<typename _IIter, typename _OutputIterator, typename _Operation> _OutputIterator __parallel_set_operation(_IIter __begin1, _IIter __end1, _IIter __begin2, _IIter __end2, _OutputIterator __result, _Operation __op) { _GLIBCXX_CALL((__end1 - __begin1) + (__end2 - __begin2)) typedef std::iterator_traits<_IIter> _TraitsType; typedef typename _TraitsType::difference_type _DifferenceType; typedef typename std::pair<_IIter, _IIter> _IteratorPair; if (__begin1 == __end1) return __op.__first_empty(__begin2, __end2, __result); if (__begin2 == __end2) return __op.__second_empty(__begin1, __end1, __result); const _DifferenceType __size = (__end1 - __begin1) + (__end2 - __begin2); const _IteratorPair __sequence[2] = { std::make_pair(__begin1, __end1), std::make_pair(__begin2, __end2) }; _OutputIterator __return_value = __result; _DifferenceType *__borders; _IteratorPair *__block_begins; _DifferenceType* __lengths; _ThreadIndex __num_threads = std::min<_DifferenceType>(__get_max_threads(), std::min(__end1 - __begin1, __end2 - __begin2)); # pragma omp parallel num_threads(__num_threads) { # pragma omp single { __num_threads = omp_get_num_threads(); __borders = new _DifferenceType[__num_threads + 2]; __equally_split(__size, __num_threads + 1, __borders); __block_begins = new _IteratorPair[__num_threads + 1]; // Very __start. __block_begins[0] = std::make_pair(__begin1, __begin2); __lengths = new _DifferenceType[__num_threads]; } //single _ThreadIndex __iam = omp_get_thread_num(); // _Result from multiseq_partition. _IIter __offset[2]; const _DifferenceType __rank = __borders[__iam + 1]; multiseq_partition(__sequence, __sequence + 2, __rank, __offset, __op._M_comp); // allowed to read? // together // *(__offset[ 0 ] - 1) == *__offset[ 1 ] if (__offset[ 0 ] != __begin1 && __offset[1] != __end2 && !__op._M_comp(*(__offset[0] - 1), *__offset[1]) && !__op._M_comp(*__offset[1], *(__offset[0] - 1))) { // Avoid split between globally equal elements: move one to // front in first sequence. --__offset[0]; } _IteratorPair __block_end = __block_begins[__iam + 1] = _IteratorPair(__offset[0], __offset[1]); // Make sure all threads have their block_begin result written out. # pragma omp barrier _IteratorPair __block_begin = __block_begins[__iam]; // Begin working for the first block, while the others except // the last start to count. if (__iam == 0) { // The first thread can copy already. __lengths[ __iam ] = __op._M_invoke(__block_begin.first, __block_end.first, __block_begin.second, __block_end.second, __result) - __result; } else { __lengths[ __iam ] = __op.__count(__block_begin.first, __block_end.first, __block_begin.second, __block_end.second); } // Make sure everyone wrote their lengths. # pragma omp barrier _OutputIterator __r = __result; if (__iam == 0) { // Do the last block. for (_ThreadIndex __i = 0; __i < __num_threads; ++__i) __r += __lengths[__i]; __block_begin = __block_begins[__num_threads]; // Return the result iterator of the last block. __return_value = __op._M_invoke(__block_begin.first, __end1, __block_begin.second, __end2, __r); } else { for (_ThreadIndex __i = 0; __i < __iam; ++__i) __r += __lengths[ __i ]; // Reset begins for copy pass. __op._M_invoke(__block_begin.first, __block_end.first, __block_begin.second, __block_end.second, __r); } } return __return_value; } template<typename _IIter, typename _OutputIterator, typename _Compare> inline _OutputIterator __parallel_set_union(_IIter __begin1, _IIter __end1, _IIter __begin2, _IIter __end2, _OutputIterator __result, _Compare __comp) { return __parallel_set_operation(__begin1, __end1, __begin2, __end2, __result, __union_func< _IIter, _OutputIterator, _Compare>(__comp)); } template<typename _IIter, typename _OutputIterator, typename _Compare> inline _OutputIterator __parallel_set_intersection(_IIter __begin1, _IIter __end1, _IIter __begin2, _IIter __end2, _OutputIterator __result, _Compare __comp) { return __parallel_set_operation(__begin1, __end1, __begin2, __end2, __result, __intersection_func<_IIter, _OutputIterator, _Compare>(__comp)); } template<typename _IIter, typename _OutputIterator, typename _Compare> inline _OutputIterator __parallel_set_difference(_IIter __begin1, _IIter __end1, _IIter __begin2, _IIter __end2, _OutputIterator __result, _Compare __comp) { return __parallel_set_operation(__begin1, __end1, __begin2, __end2, __result, __difference_func<_IIter, _OutputIterator, _Compare>(__comp)); } template<typename _IIter, typename _OutputIterator, typename _Compare> inline _OutputIterator __parallel_set_symmetric_difference(_IIter __begin1, _IIter __end1, _IIter __begin2, _IIter __end2, _OutputIterator __result, _Compare __comp) { return __parallel_set_operation(__begin1, __end1, __begin2, __end2, __result, __symmetric_difference_func<_IIter, _OutputIterator, _Compare>(__comp)); } } #endif /* _GLIBCXX_PARALLEL_SET_OPERATIONS_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/settings.h�����������������������������������������������������������������������0000644�����������������00000030252�14763166027�0011410 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/settings.h * @brief Runtime settings and tuning parameters, heuristics to decide * whether to use parallelized algorithms. * This file is a GNU parallel extension to the Standard C++ Library. * * @section parallelization_decision * The decision whether to run an algorithm in parallel. * * There are several ways the user can switch on and __off the parallel * execution of an algorithm, both at compile- and run-time. * * Only sequential execution can be forced at compile-time. This * reduces code size and protects code parts that have * non-thread-safe side effects. * * Ultimately, forcing parallel execution at compile-time makes * sense. Often, the sequential algorithm implementation is used as * a subroutine, so no reduction in code size can be achieved. Also, * the machine the program is run on might have only one processor * core, so to avoid overhead, the algorithm is executed * sequentially. * * To force sequential execution of an algorithm ultimately at * compile-time, the user must add the tag * gnu_parallel::sequential_tag() to the end of the parameter list, * e. g. * * \code * std::sort(__v.begin(), __v.end(), __gnu_parallel::sequential_tag()); * \endcode * * This is compatible with all overloaded algorithm variants. No * additional code will be instantiated, at all. The same holds for * most algorithm calls with iterators not providing random access. * * If the algorithm call is not forced to be executed sequentially * at compile-time, the decision is made at run-time. * The global variable __gnu_parallel::_Settings::algorithm_strategy * is checked. _It is a tristate variable corresponding to: * * a. force_sequential, meaning the sequential algorithm is executed. * b. force_parallel, meaning the parallel algorithm is executed. * c. heuristic * * For heuristic, the parallel algorithm implementation is called * only if the input size is sufficiently large. For most * algorithms, the input size is the (combined) length of the input * sequence(__s). The threshold can be set by the user, individually * for each algorithm. The according variables are called * gnu_parallel::_Settings::[algorithm]_minimal_n . * * For some of the algorithms, there are even more tuning options, * e. g. the ability to choose from multiple algorithm variants. See * below for details. */ // Written by Johannes Singler and Felix Putze. #ifndef _GLIBCXX_PARALLEL_SETTINGS_H #define _GLIBCXX_PARALLEL_SETTINGS_H 1 #include <parallel/types.h> /** * @brief Determine at compile(?)-time if the parallel variant of an * algorithm should be called. * @param __c A condition that is convertible to bool that is overruled by * __gnu_parallel::_Settings::algorithm_strategy. Usually a decision * based on the input size. */ #define _GLIBCXX_PARALLEL_CONDITION(__c) \ (__gnu_parallel::_Settings::get().algorithm_strategy \ != __gnu_parallel::force_sequential \ && ((__gnu_parallel::__get_max_threads() > 1 && (__c)) \ || __gnu_parallel::_Settings::get().algorithm_strategy \ == __gnu_parallel::force_parallel)) /* inline bool parallel_condition(bool __c) { bool ret = false; const _Settings& __s = _Settings::get(); if (__s.algorithm_strategy != force_seqential) { if (__s.algorithm_strategy == force_parallel) ret = true; else ret = __get_max_threads() > 1 && __c; } return ret; } */ namespace __gnu_parallel { /// class _Settings /// Run-time settings for the parallel mode including all tunable parameters. struct _Settings { _AlgorithmStrategy algorithm_strategy; _SortAlgorithm sort_algorithm; _PartialSumAlgorithm partial_sum_algorithm; _MultiwayMergeAlgorithm multiway_merge_algorithm; _FindAlgorithm find_algorithm; _SplittingAlgorithm sort_splitting; _SplittingAlgorithm merge_splitting; _SplittingAlgorithm multiway_merge_splitting; // Per-algorithm settings. /// Minimal input size for accumulate. _SequenceIndex accumulate_minimal_n; /// Minimal input size for adjacent_difference. unsigned int adjacent_difference_minimal_n; /// Minimal input size for count and count_if. _SequenceIndex count_minimal_n; /// Minimal input size for fill. _SequenceIndex fill_minimal_n; /// Block size increase factor for find. double find_increasing_factor; /// Initial block size for find. _SequenceIndex find_initial_block_size; /// Maximal block size for find. _SequenceIndex find_maximum_block_size; /// Start with looking for this many elements sequentially, for find. _SequenceIndex find_sequential_search_size; /// Minimal input size for for_each. _SequenceIndex for_each_minimal_n; /// Minimal input size for generate. _SequenceIndex generate_minimal_n; /// Minimal input size for max_element. _SequenceIndex max_element_minimal_n; /// Minimal input size for merge. _SequenceIndex merge_minimal_n; /// Oversampling factor for merge. unsigned int merge_oversampling; /// Minimal input size for min_element. _SequenceIndex min_element_minimal_n; /// Minimal input size for multiway_merge. _SequenceIndex multiway_merge_minimal_n; /// Oversampling factor for multiway_merge. int multiway_merge_minimal_k; /// Oversampling factor for multiway_merge. unsigned int multiway_merge_oversampling; /// Minimal input size for nth_element. _SequenceIndex nth_element_minimal_n; /// Chunk size for partition. _SequenceIndex partition_chunk_size; /// Chunk size for partition, relative to input size. If > 0.0, /// this value overrides partition_chunk_size. double partition_chunk_share; /// Minimal input size for partition. _SequenceIndex partition_minimal_n; /// Minimal input size for partial_sort. _SequenceIndex partial_sort_minimal_n; /// Ratio for partial_sum. Assume "sum and write result" to be /// this factor slower than just "sum". float partial_sum_dilation; /// Minimal input size for partial_sum. unsigned int partial_sum_minimal_n; /// Minimal input size for random_shuffle. unsigned int random_shuffle_minimal_n; /// Minimal input size for replace and replace_if. _SequenceIndex replace_minimal_n; /// Minimal input size for set_difference. _SequenceIndex set_difference_minimal_n; /// Minimal input size for set_intersection. _SequenceIndex set_intersection_minimal_n; /// Minimal input size for set_symmetric_difference. _SequenceIndex set_symmetric_difference_minimal_n; /// Minimal input size for set_union. _SequenceIndex set_union_minimal_n; /// Minimal input size for parallel sorting. _SequenceIndex sort_minimal_n; /// Oversampling factor for parallel std::sort (MWMS). unsigned int sort_mwms_oversampling; /// Such many samples to take to find a good pivot (quicksort). unsigned int sort_qs_num_samples_preset; /// Maximal subsequence __length to switch to unbalanced __base case. /// Applies to std::sort with dynamically load-balanced quicksort. _SequenceIndex sort_qsb_base_case_maximal_n; /// Minimal input size for parallel std::transform. _SequenceIndex transform_minimal_n; /// Minimal input size for unique_copy. _SequenceIndex unique_copy_minimal_n; _SequenceIndex workstealing_chunk_size; // Hardware dependent tuning parameters. /// size of the L1 cache in bytes (underestimation). unsigned long long L1_cache_size; /// size of the L2 cache in bytes (underestimation). unsigned long long L2_cache_size; /// size of the Translation Lookaside Buffer (underestimation). unsigned int TLB_size; /// Overestimation of cache line size. Used to avoid false /// sharing, i.e. elements of different threads are at least this /// amount apart. unsigned int cache_line_size; // Statistics. /// The number of stolen ranges in load-balanced quicksort. _SequenceIndex qsb_steals; /// Minimal input size for search and search_n. _SequenceIndex search_minimal_n; /// Block size scale-down factor with respect to current position. float find_scale_factor; /// Get the global settings. _GLIBCXX_CONST static const _Settings& get() throw(); /// Set the global settings. static void set(_Settings&) throw(); explicit _Settings() : algorithm_strategy(heuristic), sort_algorithm(MWMS), partial_sum_algorithm(LINEAR), multiway_merge_algorithm(LOSER_TREE), find_algorithm(CONSTANT_SIZE_BLOCKS), sort_splitting(EXACT), merge_splitting(EXACT), multiway_merge_splitting(EXACT), accumulate_minimal_n(1000), adjacent_difference_minimal_n(1000), count_minimal_n(1000), fill_minimal_n(1000), find_increasing_factor(2.0), find_initial_block_size(256), find_maximum_block_size(8192), find_sequential_search_size(256), for_each_minimal_n(1000), generate_minimal_n(1000), max_element_minimal_n(1000), merge_minimal_n(1000), merge_oversampling(10), min_element_minimal_n(1000), multiway_merge_minimal_n(1000), multiway_merge_minimal_k(2), multiway_merge_oversampling(10), nth_element_minimal_n(1000), partition_chunk_size(1000), partition_chunk_share(0.0), partition_minimal_n(1000), partial_sort_minimal_n(1000), partial_sum_dilation(1.0f), partial_sum_minimal_n(1000), random_shuffle_minimal_n(1000), replace_minimal_n(1000), set_difference_minimal_n(1000), set_intersection_minimal_n(1000), set_symmetric_difference_minimal_n(1000), set_union_minimal_n(1000), sort_minimal_n(1000), sort_mwms_oversampling(10), sort_qs_num_samples_preset(100), sort_qsb_base_case_maximal_n(100), transform_minimal_n(1000), unique_copy_minimal_n(10000), workstealing_chunk_size(100), L1_cache_size(16 << 10), L2_cache_size(256 << 10), TLB_size(128), cache_line_size(64), qsb_steals(0), search_minimal_n(1000), find_scale_factor(0.01f) { } }; } #endif /* _GLIBCXX_PARALLEL_SETTINGS_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/queue.h��������������������������������������������������������������������������0000644�����������������00000012635�14763166027�0010701 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/queue.h * @brief Lock-free double-ended queue. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler. #ifndef _GLIBCXX_PARALLEL_QUEUE_H #define _GLIBCXX_PARALLEL_QUEUE_H 1 #include <parallel/types.h> #include <parallel/base.h> #include <parallel/compatibility.h> /** @brief Decide whether to declare certain variable volatile in this file. */ #define _GLIBCXX_VOLATILE volatile namespace __gnu_parallel { /**@brief Double-ended queue of bounded size, allowing lock-free * atomic access. push_front() and pop_front() must not be called * concurrently to each other, while pop_back() can be called * concurrently at all times. * @c empty(), @c size(), and @c top() are intentionally not provided. * Calling them would not make sense in a concurrent setting. * @param _Tp Contained element type. */ template<typename _Tp> class _RestrictedBoundedConcurrentQueue { private: /** @brief Array of elements, seen as cyclic buffer. */ _Tp* _M_base; /** @brief Maximal number of elements contained at the same time. */ _SequenceIndex _M_max_size; /** @brief Cyclic __begin and __end pointers contained in one atomically changeable value. */ _GLIBCXX_VOLATILE _CASable _M_borders; public: /** @brief Constructor. Not to be called concurrent, of course. * @param __max_size Maximal number of elements to be contained. */ _RestrictedBoundedConcurrentQueue(_SequenceIndex __max_size) { _M_max_size = __max_size; _M_base = new _Tp[__max_size]; _M_borders = __encode2(0, 0); #pragma omp flush } /** @brief Destructor. Not to be called concurrent, of course. */ ~_RestrictedBoundedConcurrentQueue() { delete[] _M_base; } /** @brief Pushes one element into the queue at the front end. * Must not be called concurrently with pop_front(). */ void push_front(const _Tp& __t) { _CASable __former_borders = _M_borders; int __former_front, __former_back; __decode2(__former_borders, __former_front, __former_back); *(_M_base + __former_front % _M_max_size) = __t; #if _GLIBCXX_ASSERTIONS // Otherwise: front - back > _M_max_size eventually. _GLIBCXX_PARALLEL_ASSERT(((__former_front + 1) - __former_back) <= _M_max_size); #endif __fetch_and_add(&_M_borders, __encode2(1, 0)); } /** @brief Pops one element from the queue at the front end. * Must not be called concurrently with pop_front(). */ bool pop_front(_Tp& __t) { int __former_front, __former_back; #pragma omp flush __decode2(_M_borders, __former_front, __former_back); while (__former_front > __former_back) { // Chance. _CASable __former_borders = __encode2(__former_front, __former_back); _CASable __new_borders = __encode2(__former_front - 1, __former_back); if (__compare_and_swap(&_M_borders, __former_borders, __new_borders)) { __t = *(_M_base + (__former_front - 1) % _M_max_size); return true; } #pragma omp flush __decode2(_M_borders, __former_front, __former_back); } return false; } /** @brief Pops one element from the queue at the front end. * Must not be called concurrently with pop_front(). */ bool pop_back(_Tp& __t) //queue behavior { int __former_front, __former_back; #pragma omp flush __decode2(_M_borders, __former_front, __former_back); while (__former_front > __former_back) { // Chance. _CASable __former_borders = __encode2(__former_front, __former_back); _CASable __new_borders = __encode2(__former_front, __former_back + 1); if (__compare_and_swap(&_M_borders, __former_borders, __new_borders)) { __t = *(_M_base + __former_back % _M_max_size); return true; } #pragma omp flush __decode2(_M_borders, __former_front, __former_back); } return false; } }; } //namespace __gnu_parallel #undef _GLIBCXX_VOLATILE #endif /* _GLIBCXX_PARALLEL_QUEUE_H */ ���������������������������������������������������������������������������������������������������c++/4.8.2/parallel/tags.h���������������������������������������������������������������������������0000644�����������������00000013536�14763166027�0010514 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** * @file parallel/tags.h * @brief Tags for compile-time selection. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler and Felix Putze. #ifndef _GLIBCXX_PARALLEL_TAGS_H #define _GLIBCXX_PARALLEL_TAGS_H 1 #include <omp.h> #include <parallel/types.h> namespace __gnu_parallel { /** @brief Forces sequential execution at compile time. */ struct sequential_tag { }; /** @brief Recommends parallel execution at compile time, * optionally using a user-specified number of threads. */ struct parallel_tag { private: _ThreadIndex _M_num_threads; public: /** @brief Default constructor. Use default number of threads. */ parallel_tag() { _M_num_threads = 0; } /** @brief Default constructor. Recommend number of threads to use. * @param __num_threads Desired number of threads. */ parallel_tag(_ThreadIndex __num_threads) { _M_num_threads = __num_threads; } /** @brief Find out desired number of threads. * @return Desired number of threads. */ _ThreadIndex __get_num_threads() { if(_M_num_threads == 0) return omp_get_max_threads(); else return _M_num_threads; } /** @brief Set the desired number of threads. * @param __num_threads Desired number of threads. */ void set_num_threads(_ThreadIndex __num_threads) { _M_num_threads = __num_threads; } }; /** @brief Recommends parallel execution using the default parallel algorithm. */ struct default_parallel_tag : public parallel_tag { default_parallel_tag() { } default_parallel_tag(_ThreadIndex __num_threads) : parallel_tag(__num_threads) { } }; /** @brief Recommends parallel execution using dynamic load-balancing at compile time. */ struct balanced_tag : public parallel_tag { }; /** @brief Recommends parallel execution using static load-balancing at compile time. */ struct unbalanced_tag : public parallel_tag { }; /** @brief Recommends parallel execution using OpenMP dynamic load-balancing at compile time. */ struct omp_loop_tag : public parallel_tag { }; /** @brief Recommends parallel execution using OpenMP static load-balancing at compile time. */ struct omp_loop_static_tag : public parallel_tag { }; /** @brief Base class for for std::find() variants. */ struct find_tag { }; /** @brief Forces parallel merging * with exact splitting, at compile time. */ struct exact_tag : public parallel_tag { exact_tag() { } exact_tag(_ThreadIndex __num_threads) : parallel_tag(__num_threads) { } }; /** @brief Forces parallel merging * with exact splitting, at compile time. */ struct sampling_tag : public parallel_tag { sampling_tag() { } sampling_tag(_ThreadIndex __num_threads) : parallel_tag(__num_threads) { } }; /** @brief Forces parallel sorting using multiway mergesort * at compile time. */ struct multiway_mergesort_tag : public parallel_tag { multiway_mergesort_tag() { } multiway_mergesort_tag(_ThreadIndex __num_threads) : parallel_tag(__num_threads) { } }; /** @brief Forces parallel sorting using multiway mergesort * with exact splitting at compile time. */ struct multiway_mergesort_exact_tag : public parallel_tag { multiway_mergesort_exact_tag() { } multiway_mergesort_exact_tag(_ThreadIndex __num_threads) : parallel_tag(__num_threads) { } }; /** @brief Forces parallel sorting using multiway mergesort * with splitting by sampling at compile time. */ struct multiway_mergesort_sampling_tag : public parallel_tag { multiway_mergesort_sampling_tag() { } multiway_mergesort_sampling_tag(_ThreadIndex __num_threads) : parallel_tag(__num_threads) { } }; /** @brief Forces parallel sorting using unbalanced quicksort * at compile time. */ struct quicksort_tag : public parallel_tag { quicksort_tag() { } quicksort_tag(_ThreadIndex __num_threads) : parallel_tag(__num_threads) { } }; /** @brief Forces parallel sorting using balanced quicksort * at compile time. */ struct balanced_quicksort_tag : public parallel_tag { balanced_quicksort_tag() { } balanced_quicksort_tag(_ThreadIndex __num_threads) : parallel_tag(__num_threads) { } }; /** @brief Selects the growing block size variant for std::find(). @see _GLIBCXX_FIND_GROWING_BLOCKS */ struct growing_blocks_tag : public find_tag { }; /** @brief Selects the constant block size variant for std::find(). @see _GLIBCXX_FIND_CONSTANT_SIZE_BLOCKS */ struct constant_size_blocks_tag : public find_tag { }; /** @brief Selects the equal splitting variant for std::find(). @see _GLIBCXX_FIND_EQUAL_SPLIT */ struct equal_split_tag : public find_tag { }; } #endif /* _GLIBCXX_PARALLEL_TAGS_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/numericfwd.h���������������������������������������������������������������������0000644�����������������00000016514�14763166027�0011720 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <parallel/numeric> Forward declarations -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/numericfwd.h * This file is a GNU parallel extension to the Standard C++ Library. */ #ifndef _GLIBCXX_PARALLEL_NUMERICFWD_H #define _GLIBCXX_PARALLEL_NUMERICFWD_H 1 #pragma GCC system_header #include <parallel/tags.h> #include <parallel/settings.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace __parallel { template<typename _IIter, typename _Tp> _Tp accumulate(_IIter, _IIter, _Tp); template<typename _IIter, typename _Tp> _Tp accumulate(_IIter, _IIter, _Tp, __gnu_parallel::sequential_tag); template<typename _IIter, typename _Tp> _Tp accumulate(_IIter, _IIter, _Tp, __gnu_parallel::_Parallelism); template<typename _IIter, typename _Tp, typename _Tag> _Tp __accumulate_switch(_IIter, _IIter, _Tp, _Tag); template<typename _IIter, typename _Tp, typename _BinaryOper> _Tp accumulate(_IIter, _IIter, _Tp, _BinaryOper); template<typename _IIter, typename _Tp, typename _BinaryOper> _Tp accumulate(_IIter, _IIter, _Tp, _BinaryOper, __gnu_parallel::sequential_tag); template<typename _IIter, typename _Tp, typename _BinaryOper> _Tp accumulate(_IIter, _IIter, _Tp, _BinaryOper, __gnu_parallel::_Parallelism); template<typename _IIter, typename _Tp, typename _BinaryOper, typename _Tag> _Tp __accumulate_switch(_IIter, _IIter, _Tp, _BinaryOper, _Tag); template<typename _RAIter, typename _Tp, typename _BinaryOper> _Tp __accumulate_switch(_RAIter, _RAIter, _Tp, _BinaryOper, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism = __gnu_parallel::parallel_unbalanced); template<typename _IIter, typename _OIter> _OIter adjacent_difference(_IIter, _IIter, _OIter); template<typename _IIter, typename _OIter, typename _BinaryOper> _OIter adjacent_difference(_IIter, _IIter, _OIter, _BinaryOper); template<typename _IIter, typename _OIter> _OIter adjacent_difference(_IIter, _IIter, _OIter, __gnu_parallel::sequential_tag); template<typename _IIter, typename _OIter, typename _BinaryOper> _OIter adjacent_difference(_IIter, _IIter, _OIter, _BinaryOper, __gnu_parallel::sequential_tag); template<typename _IIter, typename _OIter> _OIter adjacent_difference(_IIter, _IIter, _OIter, __gnu_parallel::_Parallelism); template<typename _IIter, typename _OIter, typename _BinaryOper> _OIter adjacent_difference(_IIter, _IIter, _OIter, _BinaryOper, __gnu_parallel::_Parallelism); template<typename _IIter, typename _OIter, typename _BinaryOper, typename _Tag1, typename _Tag2> _OIter __adjacent_difference_switch(_IIter, _IIter, _OIter, _BinaryOper, _Tag1, _Tag2); template<typename _IIter, typename _OIter, typename _BinaryOper> _OIter __adjacent_difference_switch(_IIter, _IIter, _OIter, _BinaryOper, random_access_iterator_tag, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism = __gnu_parallel::parallel_unbalanced); template<typename _IIter1, typename _IIter2, typename _Tp> _Tp inner_product(_IIter1, _IIter1, _IIter2, _Tp); template<typename _IIter1, typename _IIter2, typename _Tp> _Tp inner_product(_IIter1, _IIter1, _IIter2, _Tp, __gnu_parallel::sequential_tag); template<typename _IIter1, typename _IIter2, typename _Tp> _Tp inner_product(_IIter1, _IIter1, _IIter2, _Tp, __gnu_parallel::_Parallelism); template<typename _IIter1, typename _IIter2, typename _Tp, typename _BinaryFunction1, typename _BinaryFunction2> _Tp inner_product(_IIter1, _IIter1, _IIter2, _Tp, _BinaryFunction1, _BinaryFunction2); template<typename _IIter1, typename _IIter2, typename _Tp, typename _BinaryFunction1, typename _BinaryFunction2> _Tp inner_product(_IIter1, _IIter1, _IIter2, _Tp, _BinaryFunction1, _BinaryFunction2, __gnu_parallel::sequential_tag); template<typename _IIter1, typename _IIter2, typename _Tp, typename BinaryFunction1, typename BinaryFunction2> _Tp inner_product(_IIter1, _IIter1, _IIter2, _Tp, BinaryFunction1, BinaryFunction2, __gnu_parallel::_Parallelism); template<typename _RAIter1, typename _RAIter2, typename _Tp, typename BinaryFunction1, typename BinaryFunction2> _Tp __inner_product_switch(_RAIter1, _RAIter1, _RAIter2, _Tp, BinaryFunction1, BinaryFunction2, random_access_iterator_tag, random_access_iterator_tag, __gnu_parallel::_Parallelism = __gnu_parallel::parallel_unbalanced); template<typename _IIter1, typename _IIter2, typename _Tp, typename _BinaryFunction1, typename _BinaryFunction2, typename _Tag1, typename _Tag2> _Tp __inner_product_switch(_IIter1, _IIter1, _IIter2, _Tp, _BinaryFunction1, _BinaryFunction2, _Tag1, _Tag2); template<typename _IIter, typename _OIter> _OIter partial_sum(_IIter, _IIter, _OIter, __gnu_parallel::sequential_tag); template<typename _IIter, typename _OIter, typename _BinaryOper> _OIter partial_sum(_IIter, _IIter, _OIter, _BinaryOper, __gnu_parallel::sequential_tag); template<typename _IIter, typename _OIter> _OIter partial_sum(_IIter, _IIter, _OIter __result); template<typename _IIter, typename _OIter, typename _BinaryOper> _OIter partial_sum(_IIter, _IIter, _OIter, _BinaryOper); template<typename _IIter, typename _OIter, typename _BinaryOper, typename _Tag1, typename _Tag2> _OIter __partial_sum_switch(_IIter, _IIter, _OIter, _BinaryOper, _Tag1, _Tag2); template<typename _IIter, typename _OIter, typename _BinaryOper> _OIter __partial_sum_switch(_IIter, _IIter, _OIter, _BinaryOper, random_access_iterator_tag, random_access_iterator_tag); } // end namespace } // end namespace #endif /* _GLIBCXX_PARALLEL_NUMERICFWD_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/for_each_selectors.h�������������������������������������������������������������0000644�����������������00000024505�14763166027�0013405 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/for_each_selectors.h * @brief Functors representing different tasks to be plugged into the * generic parallelization methods for embarrassingly parallel functions. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Felix Putze. #ifndef _GLIBCXX_PARALLEL_FOR_EACH_SELECTORS_H #define _GLIBCXX_PARALLEL_FOR_EACH_SELECTORS_H 1 #include <parallel/basic_iterator.h> namespace __gnu_parallel { /** @brief Generic __selector for embarrassingly parallel functions. */ template<typename _It> struct __generic_for_each_selector { /** @brief _Iterator on last element processed; needed for some * algorithms (e. g. std::transform()). */ _It _M_finish_iterator; }; /** @brief std::for_each() selector. */ template<typename _It> struct __for_each_selector : public __generic_for_each_selector<_It> { /** @brief Functor execution. * @param __o Operator. * @param __i iterator referencing object. */ template<typename _Op> bool operator()(_Op& __o, _It __i) { __o(*__i); return true; } }; /** @brief std::generate() selector. */ template<typename _It> struct __generate_selector : public __generic_for_each_selector<_It> { /** @brief Functor execution. * @param __o Operator. * @param __i iterator referencing object. */ template<typename _Op> bool operator()(_Op& __o, _It __i) { *__i = __o(); return true; } }; /** @brief std::fill() selector. */ template<typename _It> struct __fill_selector : public __generic_for_each_selector<_It> { /** @brief Functor execution. * @param __v Current value. * @param __i iterator referencing object. */ template<typename _ValueType> bool operator()(_ValueType& __v, _It __i) { *__i = __v; return true; } }; /** @brief std::transform() __selector, one input sequence variant. */ template<typename _It> struct __transform1_selector : public __generic_for_each_selector<_It> { /** @brief Functor execution. * @param __o Operator. * @param __i iterator referencing object. */ template<typename _Op> bool operator()(_Op& __o, _It __i) { *__i.second = __o(*__i.first); return true; } }; /** @brief std::transform() __selector, two input sequences variant. */ template<typename _It> struct __transform2_selector : public __generic_for_each_selector<_It> { /** @brief Functor execution. * @param __o Operator. * @param __i iterator referencing object. */ template<typename _Op> bool operator()(_Op& __o, _It __i) { *__i._M_third = __o(*__i._M_first, *__i._M_second); return true; } }; /** @brief std::replace() selector. */ template<typename _It, typename _Tp> struct __replace_selector : public __generic_for_each_selector<_It> { /** @brief Value to replace with. */ const _Tp& __new_val; /** @brief Constructor * @param __new_val Value to replace with. */ explicit __replace_selector(const _Tp &__new_val) : __new_val(__new_val) {} /** @brief Functor execution. * @param __v Current value. * @param __i iterator referencing object. */ bool operator()(_Tp& __v, _It __i) { if (*__i == __v) *__i = __new_val; return true; } }; /** @brief std::replace() selector. */ template<typename _It, typename _Op, typename _Tp> struct __replace_if_selector : public __generic_for_each_selector<_It> { /** @brief Value to replace with. */ const _Tp& __new_val; /** @brief Constructor. * @param __new_val Value to replace with. */ explicit __replace_if_selector(const _Tp &__new_val) : __new_val(__new_val) { } /** @brief Functor execution. * @param __o Operator. * @param __i iterator referencing object. */ bool operator()(_Op& __o, _It __i) { if (__o(*__i)) *__i = __new_val; return true; } }; /** @brief std::count() selector. */ template<typename _It, typename _Diff> struct __count_selector : public __generic_for_each_selector<_It> { /** @brief Functor execution. * @param __v Current value. * @param __i iterator referencing object. * @return 1 if count, 0 if does not count. */ template<typename _ValueType> _Diff operator()(_ValueType& __v, _It __i) { return (__v == *__i) ? 1 : 0; } }; /** @brief std::count_if () selector. */ template<typename _It, typename _Diff> struct __count_if_selector : public __generic_for_each_selector<_It> { /** @brief Functor execution. * @param __o Operator. * @param __i iterator referencing object. * @return 1 if count, 0 if does not count. */ template<typename _Op> _Diff operator()(_Op& __o, _It __i) { return (__o(*__i)) ? 1 : 0; } }; /** @brief std::accumulate() selector. */ template<typename _It> struct __accumulate_selector : public __generic_for_each_selector<_It> { /** @brief Functor execution. * @param __o Operator (unused). * @param __i iterator referencing object. * @return The current value. */ template<typename _Op> typename std::iterator_traits<_It>::value_type operator()(_Op __o, _It __i) { return *__i; } }; /** @brief std::inner_product() selector. */ template<typename _It, typename _It2, typename _Tp> struct __inner_product_selector : public __generic_for_each_selector<_It> { /** @brief Begin iterator of first sequence. */ _It __begin1_iterator; /** @brief Begin iterator of second sequence. */ _It2 __begin2_iterator; /** @brief Constructor. * @param __b1 Begin iterator of first sequence. * @param __b2 Begin iterator of second sequence. */ explicit __inner_product_selector(_It __b1, _It2 __b2) : __begin1_iterator(__b1), __begin2_iterator(__b2) { } /** @brief Functor execution. * @param __mult Multiplication functor. * @param __current iterator referencing object. * @return Inner product elemental __result. */ template<typename _Op> _Tp operator()(_Op __mult, _It __current) { typename std::iterator_traits<_It>::difference_type __position = __current - __begin1_iterator; return __mult(*__current, *(__begin2_iterator + __position)); } }; /** @brief Selector that just returns the passed iterator. */ template<typename _It> struct __identity_selector : public __generic_for_each_selector<_It> { /** @brief Functor execution. * @param __o Operator (unused). * @param __i iterator referencing object. * @return Passed iterator. */ template<typename _Op> _It operator()(_Op __o, _It __i) { return __i; } }; /** @brief Selector that returns the difference between two adjacent * __elements. */ template<typename _It> struct __adjacent_difference_selector : public __generic_for_each_selector<_It> { template<typename _Op> bool operator()(_Op& __o, _It __i) { typename _It::first_type __go_back_one = __i.first; --__go_back_one; *__i.second = __o(*__i.first, *__go_back_one); return true; } }; /** @brief Functor doing nothing * * For some __reduction tasks (this is not a function object, but is * passed as __selector __dummy parameter. */ struct _Nothing { /** @brief Functor execution. * @param __i iterator referencing object. */ template<typename _It> void operator()(_It __i) { } }; /** @brief Reduction function doing nothing. */ struct _DummyReduct { bool operator()(bool, bool) const { return true; } }; /** @brief Reduction for finding the maximum element, using a comparator. */ template<typename _Compare, typename _It> struct __min_element_reduct { _Compare& __comp; explicit __min_element_reduct(_Compare &__c) : __comp(__c) { } _It operator()(_It __x, _It __y) { return (__comp(*__x, *__y)) ? __x : __y; } }; /** @brief Reduction for finding the maximum element, using a comparator. */ template<typename _Compare, typename _It> struct __max_element_reduct { _Compare& __comp; explicit __max_element_reduct(_Compare& __c) : __comp(__c) { } _It operator()(_It __x, _It __y) { return (__comp(*__x, *__y)) ? __y : __x; } }; /** @brief General reduction, using a binary operator. */ template<typename _BinOp> struct __accumulate_binop_reduct { _BinOp& __binop; explicit __accumulate_binop_reduct(_BinOp& __b) : __binop(__b) { } template<typename _Result, typename _Addend> _Result operator()(const _Result& __x, const _Addend& __y) { return __binop(__x, __y); } }; } #endif /* _GLIBCXX_PARALLEL_FOR_EACH_SELECTORS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/par_loop.h�����������������������������������������������������������������������0000644�����������������00000010710�14763166027�0011360 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/par_loop.h * @brief Parallelization of embarrassingly parallel execution by * means of equal splitting. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Felix Putze. #ifndef _GLIBCXX_PARALLEL_PAR_LOOP_H #define _GLIBCXX_PARALLEL_PAR_LOOP_H 1 #include <omp.h> #include <parallel/settings.h> #include <parallel/base.h> #include <parallel/equally_split.h> namespace __gnu_parallel { /** @brief Embarrassingly parallel algorithm for random access * iterators, using hand-crafted parallelization by equal splitting * the work. * * @param __begin Begin iterator of element sequence. * @param __end End iterator of element sequence. * @param __o User-supplied functor (comparator, predicate, adding * functor, ...) * @param __f Functor to "process" an element with __op (depends on * desired functionality, e. g. for std::for_each(), ...). * @param __r Functor to "add" a single __result to the already * processed elements (depends on functionality). * @param __base Base value for reduction. * @param __output Pointer to position where final result is written to * @param __bound Maximum number of elements processed (e. g. for * std::count_n()). * @return User-supplied functor (that may contain a part of the result). */ template<typename _RAIter, typename _Op, typename _Fu, typename _Red, typename _Result> _Op __for_each_template_random_access_ed(_RAIter __begin, _RAIter __end, _Op __o, _Fu& __f, _Red __r, _Result __base, _Result& __output, typename std::iterator_traits<_RAIter>::difference_type __bound) { typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::difference_type _DifferenceType; const _DifferenceType __length = __end - __begin; _Result *__thread_results; bool* __constructed; _ThreadIndex __num_threads = __gnu_parallel::min<_DifferenceType> (__get_max_threads(), __length); # pragma omp parallel num_threads(__num_threads) { # pragma omp single { __num_threads = omp_get_num_threads(); __thread_results = static_cast<_Result*> (::operator new(__num_threads * sizeof(_Result))); __constructed = new bool[__num_threads]; } _ThreadIndex __iam = omp_get_thread_num(); // Neutral element. _Result* __reduct; _DifferenceType __start = __equally_split_point(__length, __num_threads, __iam), __stop = __equally_split_point(__length, __num_threads, __iam + 1); if (__start < __stop) { __reduct = new _Result(__f(__o, __begin + __start)); ++__start; __constructed[__iam] = true; } else __constructed[__iam] = false; for (; __start < __stop; ++__start) *__reduct = __r(*__reduct, __f(__o, __begin + __start)); if (__constructed[__iam]) { ::new(&__thread_results[__iam]) _Result(*__reduct); delete __reduct; } } //parallel for (_ThreadIndex __i = 0; __i < __num_threads; ++__i) if (__constructed[__i]) { __output = __r(__output, __thread_results[__i]); __thread_results[__i].~_Result(); } // Points to last element processed (needed as return value for // some algorithms like transform). __f._M_finish_iterator = __begin + __length; ::operator delete(__thread_results); delete[] __constructed; return __o; } } // end namespace #endif /* _GLIBCXX_PARALLEL_PAR_LOOP_H */ ��������������������������������������������������������c++/4.8.2/parallel/merge.h��������������������������������������������������������������������������0000644�����������������00000022541�14763166027�0010651 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/merge.h * @brief Parallel implementation of std::merge(). * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler. #ifndef _GLIBCXX_PARALLEL_MERGE_H #define _GLIBCXX_PARALLEL_MERGE_H 1 #include <parallel/basic_iterator.h> #include <bits/stl_algo.h> namespace __gnu_parallel { /** @brief Merge routine being able to merge only the @c __max_length * smallest elements. * * The @c __begin iterators are advanced accordingly, they might not * reach @c __end, in contrast to the usual variant. * @param __begin1 Begin iterator of first sequence. * @param __end1 End iterator of first sequence. * @param __begin2 Begin iterator of second sequence. * @param __end2 End iterator of second sequence. * @param __target Target begin iterator. * @param __max_length Maximum number of elements to merge. * @param __comp Comparator. * @return Output end iterator. */ template<typename _RAIter1, typename _RAIter2, typename _OutputIterator, typename _DifferenceTp, typename _Compare> _OutputIterator __merge_advance_usual(_RAIter1& __begin1, _RAIter1 __end1, _RAIter2& __begin2, _RAIter2 __end2, _OutputIterator __target, _DifferenceTp __max_length, _Compare __comp) { typedef _DifferenceTp _DifferenceType; while (__begin1 != __end1 && __begin2 != __end2 && __max_length > 0) { // array1[__i1] < array0[i0] if (__comp(*__begin2, *__begin1)) *__target++ = *__begin2++; else *__target++ = *__begin1++; --__max_length; } if (__begin1 != __end1) { __target = std::copy(__begin1, __begin1 + __max_length, __target); __begin1 += __max_length; } else { __target = std::copy(__begin2, __begin2 + __max_length, __target); __begin2 += __max_length; } return __target; } /** @brief Merge routine being able to merge only the @c __max_length * smallest elements. * * The @c __begin iterators are advanced accordingly, they might not * reach @c __end, in contrast to the usual variant. * Specially designed code should allow the compiler to generate * conditional moves instead of branches. * @param __begin1 Begin iterator of first sequence. * @param __end1 End iterator of first sequence. * @param __begin2 Begin iterator of second sequence. * @param __end2 End iterator of second sequence. * @param __target Target begin iterator. * @param __max_length Maximum number of elements to merge. * @param __comp Comparator. * @return Output end iterator. */ template<typename _RAIter1, typename _RAIter2, typename _OutputIterator, typename _DifferenceTp, typename _Compare> _OutputIterator __merge_advance_movc(_RAIter1& __begin1, _RAIter1 __end1, _RAIter2& __begin2, _RAIter2 __end2, _OutputIterator __target, _DifferenceTp __max_length, _Compare __comp) { typedef _DifferenceTp _DifferenceType; typedef typename std::iterator_traits<_RAIter1>::value_type _ValueType1; typedef typename std::iterator_traits<_RAIter2>::value_type _ValueType2; #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT(__max_length >= 0); #endif while (__begin1 != __end1 && __begin2 != __end2 && __max_length > 0) { _RAIter1 __next1 = __begin1 + 1; _RAIter2 __next2 = __begin2 + 1; _ValueType1 __element1 = *__begin1; _ValueType2 __element2 = *__begin2; if (__comp(__element2, __element1)) { __element1 = __element2; __begin2 = __next2; } else __begin1 = __next1; *__target = __element1; ++__target; --__max_length; } if (__begin1 != __end1) { __target = std::copy(__begin1, __begin1 + __max_length, __target); __begin1 += __max_length; } else { __target = std::copy(__begin2, __begin2 + __max_length, __target); __begin2 += __max_length; } return __target; } /** @brief Merge routine being able to merge only the @c __max_length * smallest elements. * * The @c __begin iterators are advanced accordingly, they might not * reach @c __end, in contrast to the usual variant. * Static switch on whether to use the conditional-move variant. * @param __begin1 Begin iterator of first sequence. * @param __end1 End iterator of first sequence. * @param __begin2 Begin iterator of second sequence. * @param __end2 End iterator of second sequence. * @param __target Target begin iterator. * @param __max_length Maximum number of elements to merge. * @param __comp Comparator. * @return Output end iterator. */ template<typename _RAIter1, typename _RAIter2, typename _OutputIterator, typename _DifferenceTp, typename _Compare> inline _OutputIterator __merge_advance(_RAIter1& __begin1, _RAIter1 __end1, _RAIter2& __begin2, _RAIter2 __end2, _OutputIterator __target, _DifferenceTp __max_length, _Compare __comp) { _GLIBCXX_CALL(__max_length) return __merge_advance_movc(__begin1, __end1, __begin2, __end2, __target, __max_length, __comp); } /** @brief Merge routine fallback to sequential in case the iterators of the two input sequences are of different type. * @param __begin1 Begin iterator of first sequence. * @param __end1 End iterator of first sequence. * @param __begin2 Begin iterator of second sequence. * @param __end2 End iterator of second sequence. * @param __target Target begin iterator. * @param __max_length Maximum number of elements to merge. * @param __comp Comparator. * @return Output end iterator. */ template<typename _RAIter1, typename _RAIter2, typename _RAIter3, typename _Compare> inline _RAIter3 __parallel_merge_advance(_RAIter1& __begin1, _RAIter1 __end1, _RAIter2& __begin2, // different iterators, parallel implementation // not available _RAIter2 __end2, _RAIter3 __target, typename std::iterator_traits<_RAIter1>:: difference_type __max_length, _Compare __comp) { return __merge_advance(__begin1, __end1, __begin2, __end2, __target, __max_length, __comp); } /** @brief Parallel merge routine being able to merge only the @c * __max_length smallest elements. * * The @c __begin iterators are advanced accordingly, they might not * reach @c __end, in contrast to the usual variant. * The functionality is projected onto parallel_multiway_merge. * @param __begin1 Begin iterator of first sequence. * @param __end1 End iterator of first sequence. * @param __begin2 Begin iterator of second sequence. * @param __end2 End iterator of second sequence. * @param __target Target begin iterator. * @param __max_length Maximum number of elements to merge. * @param __comp Comparator. * @return Output end iterator. */ template<typename _RAIter1, typename _RAIter3, typename _Compare> inline _RAIter3 __parallel_merge_advance(_RAIter1& __begin1, _RAIter1 __end1, _RAIter1& __begin2, _RAIter1 __end2, _RAIter3 __target, typename std::iterator_traits<_RAIter1>:: difference_type __max_length, _Compare __comp) { typedef typename std::iterator_traits<_RAIter1>::value_type _ValueType; typedef typename std::iterator_traits<_RAIter1>:: difference_type _DifferenceType1 /* == difference_type2 */; typedef typename std::iterator_traits<_RAIter3>:: difference_type _DifferenceType3; typedef typename std::pair<_RAIter1, _RAIter1> _IteratorPair; _IteratorPair __seqs[2] = { std::make_pair(__begin1, __end1), std::make_pair(__begin2, __end2) }; _RAIter3 __target_end = parallel_multiway_merge < /* __stable = */ true, /* __sentinels = */ false> (__seqs, __seqs + 2, __target, multiway_merge_exact_splitting < /* __stable = */ true, _IteratorPair*, _Compare, _DifferenceType1>, __max_length, __comp, omp_get_max_threads()); return __target_end; } } //namespace __gnu_parallel #endif /* _GLIBCXX_PARALLEL_MERGE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/random_shuffle.h�����������������������������������������������������������������0000644�����������������00000044363�14763166027�0012554 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/random_shuffle.h * @brief Parallel implementation of std::random_shuffle(). * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler. #ifndef _GLIBCXX_PARALLEL_RANDOM_SHUFFLE_H #define _GLIBCXX_PARALLEL_RANDOM_SHUFFLE_H 1 #include <limits> #include <bits/stl_numeric.h> #include <parallel/parallel.h> #include <parallel/random_number.h> namespace __gnu_parallel { /** @brief Type to hold the index of a bin. * * Since many variables of this type are allocated, it should be * chosen as small as possible. */ typedef unsigned short _BinIndex; /** @brief Data known to every thread participating in __gnu_parallel::__parallel_random_shuffle(). */ template<typename _RAIter> struct _DRandomShufflingGlobalData { typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; /** @brief Begin iterator of the __source. */ _RAIter& _M_source; /** @brief Temporary arrays for each thread. */ _ValueType** _M_temporaries; /** @brief Two-dimensional array to hold the thread-bin distribution. * * Dimensions (_M_num_threads + 1) __x (_M_num_bins + 1). */ _DifferenceType** _M_dist; /** @brief Start indexes of the threads' __chunks. */ _DifferenceType* _M_starts; /** @brief Number of the thread that will further process the corresponding bin. */ _ThreadIndex* _M_bin_proc; /** @brief Number of bins to distribute to. */ int _M_num_bins; /** @brief Number of bits needed to address the bins. */ int _M_num_bits; /** @brief Constructor. */ _DRandomShufflingGlobalData(_RAIter& __source) : _M_source(__source) { } }; /** @brief Local data for a thread participating in __gnu_parallel::__parallel_random_shuffle(). */ template<typename _RAIter, typename _RandomNumberGenerator> struct _DRSSorterPU { /** @brief Number of threads participating in total. */ int _M_num_threads; /** @brief Begin index for bins taken care of by this thread. */ _BinIndex _M_bins_begin; /** @brief End index for bins taken care of by this thread. */ _BinIndex __bins_end; /** @brief Random _M_seed for this thread. */ uint32_t _M_seed; /** @brief Pointer to global data. */ _DRandomShufflingGlobalData<_RAIter>* _M_sd; }; /** @brief Generate a random number in @c [0,2^__logp). * @param __logp Logarithm (basis 2) of the upper range __bound. * @param __rng Random number generator to use. */ template<typename _RandomNumberGenerator> inline int __random_number_pow2(int __logp, _RandomNumberGenerator& __rng) { return __rng.__genrand_bits(__logp); } /** @brief Random shuffle code executed by each thread. * @param __pus Array of thread-local data records. */ template<typename _RAIter, typename _RandomNumberGenerator> void __parallel_random_shuffle_drs_pu(_DRSSorterPU<_RAIter, _RandomNumberGenerator>* __pus) { typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; _ThreadIndex __iam = omp_get_thread_num(); _DRSSorterPU<_RAIter, _RandomNumberGenerator>* __d = &__pus[__iam]; _DRandomShufflingGlobalData<_RAIter>* __sd = __d->_M_sd; // Indexing: _M_dist[bin][processor] _DifferenceType __length = (__sd->_M_starts[__iam + 1] - __sd->_M_starts[__iam]); _BinIndex* __oracles = new _BinIndex[__length]; _DifferenceType* __dist = new _DifferenceType[__sd->_M_num_bins + 1]; _BinIndex* __bin_proc = new _BinIndex[__sd->_M_num_bins]; _ValueType** __temporaries = new _ValueType*[__d->_M_num_threads]; // Compute oracles and count appearances. for (_BinIndex __b = 0; __b < __sd->_M_num_bins + 1; ++__b) __dist[__b] = 0; int __num_bits = __sd->_M_num_bits; _RandomNumber __rng(__d->_M_seed); // First main loop. for (_DifferenceType __i = 0; __i < __length; ++__i) { _BinIndex __oracle = __random_number_pow2(__num_bits, __rng); __oracles[__i] = __oracle; // To allow prefix (partial) sum. ++(__dist[__oracle + 1]); } for (_BinIndex __b = 0; __b < __sd->_M_num_bins + 1; ++__b) __sd->_M_dist[__b][__iam + 1] = __dist[__b]; # pragma omp barrier # pragma omp single { // Sum up bins, __sd->_M_dist[__s + 1][__d->_M_num_threads] now // contains the total number of items in bin __s for (_BinIndex __s = 0; __s < __sd->_M_num_bins; ++__s) __gnu_sequential::partial_sum(__sd->_M_dist[__s + 1], __sd->_M_dist[__s + 1] + __d->_M_num_threads + 1, __sd->_M_dist[__s + 1]); } # pragma omp barrier _SequenceIndex __offset = 0, __global_offset = 0; for (_BinIndex __s = 0; __s < __d->_M_bins_begin; ++__s) __global_offset += __sd->_M_dist[__s + 1][__d->_M_num_threads]; # pragma omp barrier for (_BinIndex __s = __d->_M_bins_begin; __s < __d->__bins_end; ++__s) { for (int __t = 0; __t < __d->_M_num_threads + 1; ++__t) __sd->_M_dist[__s + 1][__t] += __offset; __offset = __sd->_M_dist[__s + 1][__d->_M_num_threads]; } __sd->_M_temporaries[__iam] = static_cast<_ValueType*> (::operator new(sizeof(_ValueType) * __offset)); # pragma omp barrier // Draw local copies to avoid false sharing. for (_BinIndex __b = 0; __b < __sd->_M_num_bins + 1; ++__b) __dist[__b] = __sd->_M_dist[__b][__iam]; for (_BinIndex __b = 0; __b < __sd->_M_num_bins; ++__b) __bin_proc[__b] = __sd->_M_bin_proc[__b]; for (_ThreadIndex __t = 0; __t < __d->_M_num_threads; ++__t) __temporaries[__t] = __sd->_M_temporaries[__t]; _RAIter __source = __sd->_M_source; _DifferenceType __start = __sd->_M_starts[__iam]; // Distribute according to oracles, second main loop. for (_DifferenceType __i = 0; __i < __length; ++__i) { _BinIndex __target_bin = __oracles[__i]; _ThreadIndex __target_p = __bin_proc[__target_bin]; // Last column [__d->_M_num_threads] stays unchanged. ::new(&(__temporaries[__target_p][__dist[__target_bin + 1]++])) _ValueType(*(__source + __i + __start)); } delete[] __oracles; delete[] __dist; delete[] __bin_proc; delete[] __temporaries; # pragma omp barrier // Shuffle bins internally. for (_BinIndex __b = __d->_M_bins_begin; __b < __d->__bins_end; ++__b) { _ValueType* __begin = (__sd->_M_temporaries[__iam] + (__b == __d->_M_bins_begin ? 0 : __sd->_M_dist[__b][__d->_M_num_threads])), *__end = (__sd->_M_temporaries[__iam] + __sd->_M_dist[__b + 1][__d->_M_num_threads]); __sequential_random_shuffle(__begin, __end, __rng); std::copy(__begin, __end, __sd->_M_source + __global_offset + (__b == __d->_M_bins_begin ? 0 : __sd->_M_dist[__b][__d->_M_num_threads])); } for (_SequenceIndex __i = 0; __i < __offset; ++__i) __sd->_M_temporaries[__iam][__i].~_ValueType(); ::operator delete(__sd->_M_temporaries[__iam]); } /** @brief Round up to the next greater power of 2. * @param __x _Integer to round up */ template<typename _Tp> _Tp __round_up_to_pow2(_Tp __x) { if (__x <= 1) return 1; else return (_Tp)1 << (__rd_log2(__x - 1) + 1); } /** @brief Main parallel random shuffle step. * @param __begin Begin iterator of sequence. * @param __end End iterator of sequence. * @param __n Length of sequence. * @param __num_threads Number of threads to use. * @param __rng Random number generator to use. */ template<typename _RAIter, typename _RandomNumberGenerator> void __parallel_random_shuffle_drs(_RAIter __begin, _RAIter __end, typename std::iterator_traits <_RAIter>::difference_type __n, _ThreadIndex __num_threads, _RandomNumberGenerator& __rng) { typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; _GLIBCXX_CALL(__n) const _Settings& __s = _Settings::get(); if (__num_threads > __n) __num_threads = static_cast<_ThreadIndex>(__n); _BinIndex __num_bins, __num_bins_cache; #if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_L1 // Try the L1 cache first. // Must fit into L1. __num_bins_cache = std::max<_DifferenceType>(1, __n / (__s.L1_cache_size_lb / sizeof(_ValueType))); __num_bins_cache = __round_up_to_pow2(__num_bins_cache); // No more buckets than TLB entries, power of 2 // Power of 2 and at least one element per bin, at most the TLB size. __num_bins = std::min<_DifferenceType>(__n, __num_bins_cache); #if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB // 2 TLB entries needed per bin. __num_bins = std::min<_DifferenceType>(__s.TLB_size / 2, __num_bins); #endif __num_bins = __round_up_to_pow2(__num_bins); if (__num_bins < __num_bins_cache) { #endif // Now try the L2 cache // Must fit into L2 __num_bins_cache = static_cast<_BinIndex> (std::max<_DifferenceType>(1, __n / (__s.L2_cache_size / sizeof(_ValueType)))); __num_bins_cache = __round_up_to_pow2(__num_bins_cache); // No more buckets than TLB entries, power of 2. __num_bins = static_cast<_BinIndex> (std::min(__n, static_cast<_DifferenceType>(__num_bins_cache))); // Power of 2 and at least one element per bin, at most the TLB size. #if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB // 2 TLB entries needed per bin. __num_bins = std::min(static_cast<_DifferenceType>(__s.TLB_size / 2), __num_bins); #endif __num_bins = __round_up_to_pow2(__num_bins); #if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_L1 } #endif __num_bins = __round_up_to_pow2( std::max<_BinIndex>(__num_threads, __num_bins)); if (__num_threads <= 1) { _RandomNumber __derived_rng( __rng(std::numeric_limits<uint32_t>::max())); __sequential_random_shuffle(__begin, __end, __derived_rng); return; } _DRandomShufflingGlobalData<_RAIter> __sd(__begin); _DRSSorterPU<_RAIter, _RandomNumber >* __pus; _DifferenceType* __starts; # pragma omp parallel num_threads(__num_threads) { _ThreadIndex __num_threads = omp_get_num_threads(); # pragma omp single { __pus = new _DRSSorterPU<_RAIter, _RandomNumber>[__num_threads]; __sd._M_temporaries = new _ValueType*[__num_threads]; __sd._M_dist = new _DifferenceType*[__num_bins + 1]; __sd._M_bin_proc = new _ThreadIndex[__num_bins]; for (_BinIndex __b = 0; __b < __num_bins + 1; ++__b) __sd._M_dist[__b] = new _DifferenceType[__num_threads + 1]; for (_BinIndex __b = 0; __b < (__num_bins + 1); ++__b) { __sd._M_dist[0][0] = 0; __sd._M_dist[__b][0] = 0; } __starts = __sd._M_starts = new _DifferenceType[__num_threads + 1]; int __bin_cursor = 0; __sd._M_num_bins = __num_bins; __sd._M_num_bits = __rd_log2(__num_bins); _DifferenceType __chunk_length = __n / __num_threads, __split = __n % __num_threads, __start = 0; _DifferenceType __bin_chunk_length = __num_bins / __num_threads, __bin_split = __num_bins % __num_threads; for (_ThreadIndex __i = 0; __i < __num_threads; ++__i) { __starts[__i] = __start; __start += (__i < __split ? (__chunk_length + 1) : __chunk_length); int __j = __pus[__i]._M_bins_begin = __bin_cursor; // Range of bins for this processor. __bin_cursor += (__i < __bin_split ? (__bin_chunk_length + 1) : __bin_chunk_length); __pus[__i].__bins_end = __bin_cursor; for (; __j < __bin_cursor; ++__j) __sd._M_bin_proc[__j] = __i; __pus[__i]._M_num_threads = __num_threads; __pus[__i]._M_seed = __rng(std::numeric_limits<uint32_t>::max()); __pus[__i]._M_sd = &__sd; } __starts[__num_threads] = __start; } //single // Now shuffle in parallel. __parallel_random_shuffle_drs_pu(__pus); } // parallel delete[] __starts; delete[] __sd._M_bin_proc; for (int __s = 0; __s < (__num_bins + 1); ++__s) delete[] __sd._M_dist[__s]; delete[] __sd._M_dist; delete[] __sd._M_temporaries; delete[] __pus; } /** @brief Sequential cache-efficient random shuffle. * @param __begin Begin iterator of sequence. * @param __end End iterator of sequence. * @param __rng Random number generator to use. */ template<typename _RAIter, typename _RandomNumberGenerator> void __sequential_random_shuffle(_RAIter __begin, _RAIter __end, _RandomNumberGenerator& __rng) { typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; _DifferenceType __n = __end - __begin; const _Settings& __s = _Settings::get(); _BinIndex __num_bins, __num_bins_cache; #if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_L1 // Try the L1 cache first, must fit into L1. __num_bins_cache = std::max<_DifferenceType> (1, __n / (__s.L1_cache_size_lb / sizeof(_ValueType))); __num_bins_cache = __round_up_to_pow2(__num_bins_cache); // No more buckets than TLB entries, power of 2 // Power of 2 and at least one element per bin, at most the TLB size __num_bins = std::min(__n, (_DifferenceType)__num_bins_cache); #if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB // 2 TLB entries needed per bin __num_bins = std::min((_DifferenceType)__s.TLB_size / 2, __num_bins); #endif __num_bins = __round_up_to_pow2(__num_bins); if (__num_bins < __num_bins_cache) { #endif // Now try the L2 cache, must fit into L2. __num_bins_cache = static_cast<_BinIndex> (std::max<_DifferenceType>(1, __n / (__s.L2_cache_size / sizeof(_ValueType)))); __num_bins_cache = __round_up_to_pow2(__num_bins_cache); // No more buckets than TLB entries, power of 2 // Power of 2 and at least one element per bin, at most the TLB size. __num_bins = static_cast<_BinIndex> (std::min(__n, static_cast<_DifferenceType>(__num_bins_cache))); #if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB // 2 TLB entries needed per bin __num_bins = std::min<_DifferenceType>(__s.TLB_size / 2, __num_bins); #endif __num_bins = __round_up_to_pow2(__num_bins); #if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_L1 } #endif int __num_bits = __rd_log2(__num_bins); if (__num_bins > 1) { _ValueType* __target = static_cast<_ValueType*>(::operator new(sizeof(_ValueType) * __n)); _BinIndex* __oracles = new _BinIndex[__n]; _DifferenceType* __dist0 = new _DifferenceType[__num_bins + 1], * __dist1 = new _DifferenceType[__num_bins + 1]; for (int __b = 0; __b < __num_bins + 1; ++__b) __dist0[__b] = 0; _RandomNumber __bitrng(__rng(0xFFFFFFFF)); for (_DifferenceType __i = 0; __i < __n; ++__i) { _BinIndex __oracle = __random_number_pow2(__num_bits, __bitrng); __oracles[__i] = __oracle; // To allow prefix (partial) sum. ++(__dist0[__oracle + 1]); } // Sum up bins. __gnu_sequential::partial_sum(__dist0, __dist0 + __num_bins + 1, __dist0); for (int __b = 0; __b < __num_bins + 1; ++__b) __dist1[__b] = __dist0[__b]; // Distribute according to oracles. for (_DifferenceType __i = 0; __i < __n; ++__i) ::new(&(__target[(__dist0[__oracles[__i]])++])) _ValueType(*(__begin + __i)); for (int __b = 0; __b < __num_bins; ++__b) __sequential_random_shuffle(__target + __dist1[__b], __target + __dist1[__b + 1], __rng); // Copy elements back. std::copy(__target, __target + __n, __begin); delete[] __dist0; delete[] __dist1; delete[] __oracles; for (_DifferenceType __i = 0; __i < __n; ++__i) __target[__i].~_ValueType(); ::operator delete(__target); } else __gnu_sequential::random_shuffle(__begin, __end, __rng); } /** @brief Parallel random public call. * @param __begin Begin iterator of sequence. * @param __end End iterator of sequence. * @param __rng Random number generator to use. */ template<typename _RAIter, typename _RandomNumberGenerator> inline void __parallel_random_shuffle(_RAIter __begin, _RAIter __end, _RandomNumberGenerator __rng = _RandomNumber()) { typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::difference_type _DifferenceType; _DifferenceType __n = __end - __begin; __parallel_random_shuffle_drs(__begin, __end, __n, __get_max_threads(), __rng); } } #endif /* _GLIBCXX_PARALLEL_RANDOM_SHUFFLE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/balanced_quicksort.h�������������������������������������������������������������0000644�����������������00000040612�14763166027�0013406 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/balanced_quicksort.h * @brief Implementation of a dynamically load-balanced parallel quicksort. * * It works in-place and needs only logarithmic extra memory. * The algorithm is similar to the one proposed in * * P. Tsigas and Y. Zhang. * A simple, fast parallel implementation of quicksort and * its performance evaluation on SUN enterprise 10000. * In 11th Euromicro Conference on Parallel, Distributed and * Network-Based Processing, page 372, 2003. * * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler. #ifndef _GLIBCXX_PARALLEL_BALANCED_QUICKSORT_H #define _GLIBCXX_PARALLEL_BALANCED_QUICKSORT_H 1 #include <parallel/basic_iterator.h> #include <bits/stl_algo.h> #include <bits/stl_function.h> #include <parallel/settings.h> #include <parallel/partition.h> #include <parallel/random_number.h> #include <parallel/queue.h> #if _GLIBCXX_ASSERTIONS #include <parallel/checkers.h> #endif namespace __gnu_parallel { /** @brief Information local to one thread in the parallel quicksort run. */ template<typename _RAIter> struct _QSBThreadLocal { typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::difference_type _DifferenceType; /** @brief Continuous part of the sequence, described by an iterator pair. */ typedef std::pair<_RAIter, _RAIter> _Piece; /** @brief Initial piece to work on. */ _Piece _M_initial; /** @brief Work-stealing queue. */ _RestrictedBoundedConcurrentQueue<_Piece> _M_leftover_parts; /** @brief Number of threads involved in this algorithm. */ _ThreadIndex _M_num_threads; /** @brief Pointer to a counter of elements left over to sort. */ volatile _DifferenceType* _M_elements_leftover; /** @brief The complete sequence to sort. */ _Piece _M_global; /** @brief Constructor. * @param __queue_size size of the work-stealing queue. */ _QSBThreadLocal(int __queue_size) : _M_leftover_parts(__queue_size) { } }; /** @brief Balanced quicksort divide step. * @param __begin Begin iterator of subsequence. * @param __end End iterator of subsequence. * @param __comp Comparator. * @param __num_threads Number of threads that are allowed to work on * this part. * @pre @c (__end-__begin)>=1 */ template<typename _RAIter, typename _Compare> typename std::iterator_traits<_RAIter>::difference_type __qsb_divide(_RAIter __begin, _RAIter __end, _Compare __comp, _ThreadIndex __num_threads) { _GLIBCXX_PARALLEL_ASSERT(__num_threads > 0); typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; _RAIter __pivot_pos = __median_of_three_iterators(__begin, __begin + (__end - __begin) / 2, __end - 1, __comp); #if defined(_GLIBCXX_ASSERTIONS) // Must be in between somewhere. _DifferenceType __n = __end - __begin; _GLIBCXX_PARALLEL_ASSERT((!__comp(*__pivot_pos, *__begin) && !__comp(*(__begin + __n / 2), *__pivot_pos)) || (!__comp(*__pivot_pos, *__begin) && !__comp(*(__end - 1), *__pivot_pos)) || (!__comp(*__pivot_pos, *(__begin + __n / 2)) && !__comp(*__begin, *__pivot_pos)) || (!__comp(*__pivot_pos, *(__begin + __n / 2)) && !__comp(*(__end - 1), *__pivot_pos)) || (!__comp(*__pivot_pos, *(__end - 1)) && !__comp(*__begin, *__pivot_pos)) || (!__comp(*__pivot_pos, *(__end - 1)) && !__comp(*(__begin + __n / 2), *__pivot_pos))); #endif // Swap pivot value to end. if (__pivot_pos != (__end - 1)) std::iter_swap(__pivot_pos, __end - 1); __pivot_pos = __end - 1; __gnu_parallel::__binder2nd<_Compare, _ValueType, _ValueType, bool> __pred(__comp, *__pivot_pos); // Divide, returning __end - __begin - 1 in the worst case. _DifferenceType __split_pos = __parallel_partition(__begin, __end - 1, __pred, __num_threads); // Swap back pivot to middle. std::iter_swap(__begin + __split_pos, __pivot_pos); __pivot_pos = __begin + __split_pos; #if _GLIBCXX_ASSERTIONS _RAIter __r; for (__r = __begin; __r != __pivot_pos; ++__r) _GLIBCXX_PARALLEL_ASSERT(__comp(*__r, *__pivot_pos)); for (; __r != __end; ++__r) _GLIBCXX_PARALLEL_ASSERT(!__comp(*__r, *__pivot_pos)); #endif return __split_pos; } /** @brief Quicksort conquer step. * @param __tls Array of thread-local storages. * @param __begin Begin iterator of subsequence. * @param __end End iterator of subsequence. * @param __comp Comparator. * @param __iam Number of the thread processing this function. * @param __num_threads * Number of threads that are allowed to work on this part. */ template<typename _RAIter, typename _Compare> void __qsb_conquer(_QSBThreadLocal<_RAIter>** __tls, _RAIter __begin, _RAIter __end, _Compare __comp, _ThreadIndex __iam, _ThreadIndex __num_threads, bool __parent_wait) { typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; _DifferenceType __n = __end - __begin; if (__num_threads <= 1 || __n <= 1) { __tls[__iam]->_M_initial.first = __begin; __tls[__iam]->_M_initial.second = __end; __qsb_local_sort_with_helping(__tls, __comp, __iam, __parent_wait); return; } // Divide step. _DifferenceType __split_pos = __qsb_divide(__begin, __end, __comp, __num_threads); #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT(0 <= __split_pos && __split_pos < (__end - __begin)); #endif _ThreadIndex __num_threads_leftside = std::max<_ThreadIndex> (1, std::min<_ThreadIndex>(__num_threads - 1, __split_pos * __num_threads / __n)); # pragma omp atomic *__tls[__iam]->_M_elements_leftover -= (_DifferenceType)1; // Conquer step. # pragma omp parallel num_threads(2) { bool __wait; if(omp_get_num_threads() < 2) __wait = false; else __wait = __parent_wait; # pragma omp sections { # pragma omp section { __qsb_conquer(__tls, __begin, __begin + __split_pos, __comp, __iam, __num_threads_leftside, __wait); __wait = __parent_wait; } // The pivot_pos is left in place, to ensure termination. # pragma omp section { __qsb_conquer(__tls, __begin + __split_pos + 1, __end, __comp, __iam + __num_threads_leftside, __num_threads - __num_threads_leftside, __wait); __wait = __parent_wait; } } } } /** * @brief Quicksort step doing load-balanced local sort. * @param __tls Array of thread-local storages. * @param __comp Comparator. * @param __iam Number of the thread processing this function. */ template<typename _RAIter, typename _Compare> void __qsb_local_sort_with_helping(_QSBThreadLocal<_RAIter>** __tls, _Compare& __comp, _ThreadIndex __iam, bool __wait) { typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; typedef std::pair<_RAIter, _RAIter> _Piece; _QSBThreadLocal<_RAIter>& __tl = *__tls[__iam]; _DifferenceType __base_case_n = _Settings::get().sort_qsb_base_case_maximal_n; if (__base_case_n < 2) __base_case_n = 2; _ThreadIndex __num_threads = __tl._M_num_threads; // Every thread has its own random number generator. _RandomNumber __rng(__iam + 1); _Piece __current = __tl._M_initial; _DifferenceType __elements_done = 0; #if _GLIBCXX_ASSERTIONS _DifferenceType __total_elements_done = 0; #endif for (;;) { // Invariant: __current must be a valid (maybe empty) range. _RAIter __begin = __current.first, __end = __current.second; _DifferenceType __n = __end - __begin; if (__n > __base_case_n) { // Divide. _RAIter __pivot_pos = __begin + __rng(__n); // Swap __pivot_pos value to end. if (__pivot_pos != (__end - 1)) std::iter_swap(__pivot_pos, __end - 1); __pivot_pos = __end - 1; __gnu_parallel::__binder2nd <_Compare, _ValueType, _ValueType, bool> __pred(__comp, *__pivot_pos); // Divide, leave pivot unchanged in last place. _RAIter __split_pos1, __split_pos2; __split_pos1 = __gnu_sequential::partition(__begin, __end - 1, __pred); // Left side: < __pivot_pos; __right side: >= __pivot_pos. #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT(__begin <= __split_pos1 && __split_pos1 < __end); #endif // Swap pivot back to middle. if (__split_pos1 != __pivot_pos) std::iter_swap(__split_pos1, __pivot_pos); __pivot_pos = __split_pos1; // In case all elements are equal, __split_pos1 == 0. if ((__split_pos1 + 1 - __begin) < (__n >> 7) || (__end - __split_pos1) < (__n >> 7)) { // Very unequal split, one part smaller than one 128th // elements not strictly larger than the pivot. __gnu_parallel::__unary_negate<__gnu_parallel::__binder1st <_Compare, _ValueType, _ValueType, bool>, _ValueType> __pred(__gnu_parallel::__binder1st <_Compare, _ValueType, _ValueType, bool> (__comp, *__pivot_pos)); // Find other end of pivot-equal range. __split_pos2 = __gnu_sequential::partition(__split_pos1 + 1, __end, __pred); } else // Only skip the pivot. __split_pos2 = __split_pos1 + 1; // Elements equal to pivot are done. __elements_done += (__split_pos2 - __split_pos1); #if _GLIBCXX_ASSERTIONS __total_elements_done += (__split_pos2 - __split_pos1); #endif // Always push larger part onto stack. if (((__split_pos1 + 1) - __begin) < (__end - (__split_pos2))) { // Right side larger. if ((__split_pos2) != __end) __tl._M_leftover_parts.push_front (std::make_pair(__split_pos2, __end)); //__current.first = __begin; //already set anyway __current.second = __split_pos1; continue; } else { // Left side larger. if (__begin != __split_pos1) __tl._M_leftover_parts.push_front(std::make_pair (__begin, __split_pos1)); __current.first = __split_pos2; //__current.second = __end; //already set anyway continue; } } else { __gnu_sequential::sort(__begin, __end, __comp); __elements_done += __n; #if _GLIBCXX_ASSERTIONS __total_elements_done += __n; #endif // Prefer own stack, small pieces. if (__tl._M_leftover_parts.pop_front(__current)) continue; # pragma omp atomic *__tl._M_elements_leftover -= __elements_done; __elements_done = 0; #if _GLIBCXX_ASSERTIONS double __search_start = omp_get_wtime(); #endif // Look for new work. bool __successfully_stolen = false; while (__wait && *__tl._M_elements_leftover > 0 && !__successfully_stolen #if _GLIBCXX_ASSERTIONS // Possible dead-lock. && (omp_get_wtime() < (__search_start + 1.0)) #endif ) { _ThreadIndex __victim; __victim = __rng(__num_threads); // Large pieces. __successfully_stolen = (__victim != __iam) && __tls[__victim]->_M_leftover_parts.pop_back(__current); if (!__successfully_stolen) __yield(); #if !defined(__ICC) && !defined(__ECC) # pragma omp flush #endif } #if _GLIBCXX_ASSERTIONS if (omp_get_wtime() >= (__search_start + 1.0)) { sleep(1); _GLIBCXX_PARALLEL_ASSERT(omp_get_wtime() < (__search_start + 1.0)); } #endif if (!__successfully_stolen) { #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT(*__tl._M_elements_leftover == 0); #endif return; } } } } /** @brief Top-level quicksort routine. * @param __begin Begin iterator of sequence. * @param __end End iterator of sequence. * @param __comp Comparator. * @param __num_threads Number of threads that are allowed to work on * this part. */ template<typename _RAIter, typename _Compare> void __parallel_sort_qsb(_RAIter __begin, _RAIter __end, _Compare __comp, _ThreadIndex __num_threads) { _GLIBCXX_CALL(__end - __begin) typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; typedef std::pair<_RAIter, _RAIter> _Piece; typedef _QSBThreadLocal<_RAIter> _TLSType; _DifferenceType __n = __end - __begin; if (__n <= 1) return; // At least one element per processor. if (__num_threads > __n) __num_threads = static_cast<_ThreadIndex>(__n); // Initialize thread local storage _TLSType** __tls = new _TLSType*[__num_threads]; _DifferenceType __queue_size = (__num_threads * (_ThreadIndex)(__rd_log2(__n) + 1)); for (_ThreadIndex __t = 0; __t < __num_threads; ++__t) __tls[__t] = new _QSBThreadLocal<_RAIter>(__queue_size); // There can never be more than ceil(__rd_log2(__n)) ranges on the // stack, because // 1. Only one processor pushes onto the stack // 2. The largest range has at most length __n // 3. Each range is larger than half of the range remaining volatile _DifferenceType __elements_leftover = __n; for (_ThreadIndex __i = 0; __i < __num_threads; ++__i) { __tls[__i]->_M_elements_leftover = &__elements_leftover; __tls[__i]->_M_num_threads = __num_threads; __tls[__i]->_M_global = std::make_pair(__begin, __end); // Just in case nothing is left to assign. __tls[__i]->_M_initial = std::make_pair(__end, __end); } // Main recursion call. __qsb_conquer(__tls, __begin, __begin + __n, __comp, 0, __num_threads, true); #if _GLIBCXX_ASSERTIONS // All stack must be empty. _Piece __dummy; for (_ThreadIndex __i = 1; __i < __num_threads; ++__i) _GLIBCXX_PARALLEL_ASSERT( !__tls[__i]->_M_leftover_parts.pop_back(__dummy)); #endif for (_ThreadIndex __i = 0; __i < __num_threads; ++__i) delete __tls[__i]; delete[] __tls; } } // namespace __gnu_parallel #endif /* _GLIBCXX_PARALLEL_BALANCED_QUICKSORT_H */ ����������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/base.h���������������������������������������������������������������������������0000644�����������������00000027723�14763166027�0010473 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/base.h * @brief Sequential helper functions. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler. #ifndef _GLIBCXX_PARALLEL_BASE_H #define _GLIBCXX_PARALLEL_BASE_H 1 #include <bits/c++config.h> #include <bits/stl_function.h> #include <omp.h> #include <parallel/features.h> #include <parallel/basic_iterator.h> #include <parallel/parallel.h> // Parallel mode namespaces. /** * @namespace std::__parallel * @brief GNU parallel code, replaces standard behavior with parallel behavior. */ namespace std _GLIBCXX_VISIBILITY(default) { namespace __parallel { } } /** * @namespace __gnu_parallel * @brief GNU parallel code for public use. */ namespace __gnu_parallel { // Import all the parallel versions of components in namespace std. using namespace std::__parallel; } /** * @namespace __gnu_sequential * @brief GNU sequential classes for public use. */ namespace __gnu_sequential { // Import whatever is the serial version. #ifdef _GLIBCXX_PARALLEL using namespace std::_GLIBCXX_STD_A; #else using namespace std; #endif } namespace __gnu_parallel { // NB: Including this file cannot produce (unresolved) symbols from // the OpenMP runtime unless the parallel mode is actually invoked // and active, which imples that the OpenMP runtime is actually // going to be linked in. inline _ThreadIndex __get_max_threads() { _ThreadIndex __i = omp_get_max_threads(); return __i > 1 ? __i : 1; } inline bool __is_parallel(const _Parallelism __p) { return __p != sequential; } /** @brief Calculates the rounded-down logarithm of @c __n for base 2. * @param __n Argument. * @return Returns 0 for any argument <1. */ template<typename _Size> inline _Size __rd_log2(_Size __n) { _Size __k; for (__k = 0; __n > 1; __n >>= 1) ++__k; return __k; } /** @brief Encode two integers into one gnu_parallel::_CASable. * @param __a First integer, to be encoded in the most-significant @c * _CASable_bits/2 bits. * @param __b Second integer, to be encoded in the least-significant * @c _CASable_bits/2 bits. * @return value encoding @c __a and @c __b. * @see __decode2 */ inline _CASable __encode2(int __a, int __b) //must all be non-negative, actually { return (((_CASable)__a) << (_CASable_bits / 2)) | (((_CASable)__b) << 0); } /** @brief Decode two integers from one gnu_parallel::_CASable. * @param __x __gnu_parallel::_CASable to decode integers from. * @param __a First integer, to be decoded from the most-significant * @c _CASable_bits/2 bits of @c __x. * @param __b Second integer, to be encoded in the least-significant * @c _CASable_bits/2 bits of @c __x. * @see __encode2 */ inline void __decode2(_CASable __x, int& __a, int& __b) { __a = (int)((__x >> (_CASable_bits / 2)) & _CASable_mask); __b = (int)((__x >> 0 ) & _CASable_mask); } //needed for parallel "numeric", even if "algorithm" not included /** @brief Equivalent to std::min. */ template<typename _Tp> inline const _Tp& min(const _Tp& __a, const _Tp& __b) { return (__a < __b) ? __a : __b; } /** @brief Equivalent to std::max. */ template<typename _Tp> inline const _Tp& max(const _Tp& __a, const _Tp& __b) { return (__a > __b) ? __a : __b; } /** @brief Constructs predicate for equality from strict weak * ordering predicate */ template<typename _T1, typename _T2, typename _Compare> class _EqualFromLess : public std::binary_function<_T1, _T2, bool> { private: _Compare& _M_comp; public: _EqualFromLess(_Compare& __comp) : _M_comp(__comp) { } bool operator()(const _T1& __a, const _T2& __b) { return !_M_comp(__a, __b) && !_M_comp(__b, __a); } }; /** @brief Similar to std::unary_negate, * but giving the argument types explicitly. */ template<typename _Predicate, typename argument_type> class __unary_negate : public std::unary_function<argument_type, bool> { protected: _Predicate _M_pred; public: explicit __unary_negate(const _Predicate& __x) : _M_pred(__x) { } bool operator()(const argument_type& __x) { return !_M_pred(__x); } }; /** @brief Similar to std::binder1st, * but giving the argument types explicitly. */ template<typename _Operation, typename _FirstArgumentType, typename _SecondArgumentType, typename _ResultType> class __binder1st : public std::unary_function<_SecondArgumentType, _ResultType> { protected: _Operation _M_op; _FirstArgumentType _M_value; public: __binder1st(const _Operation& __x, const _FirstArgumentType& __y) : _M_op(__x), _M_value(__y) { } _ResultType operator()(const _SecondArgumentType& __x) { return _M_op(_M_value, __x); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 109. Missing binders for non-const sequence elements _ResultType operator()(_SecondArgumentType& __x) const { return _M_op(_M_value, __x); } }; /** * @brief Similar to std::binder2nd, but giving the argument types * explicitly. */ template<typename _Operation, typename _FirstArgumentType, typename _SecondArgumentType, typename _ResultType> class __binder2nd : public std::unary_function<_FirstArgumentType, _ResultType> { protected: _Operation _M_op; _SecondArgumentType _M_value; public: __binder2nd(const _Operation& __x, const _SecondArgumentType& __y) : _M_op(__x), _M_value(__y) { } _ResultType operator()(const _FirstArgumentType& __x) const { return _M_op(__x, _M_value); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 109. Missing binders for non-const sequence elements _ResultType operator()(_FirstArgumentType& __x) { return _M_op(__x, _M_value); } }; /** @brief Similar to std::equal_to, but allows two different types. */ template<typename _T1, typename _T2> struct _EqualTo : std::binary_function<_T1, _T2, bool> { bool operator()(const _T1& __t1, const _T2& __t2) const { return __t1 == __t2; } }; /** @brief Similar to std::less, but allows two different types. */ template<typename _T1, typename _T2> struct _Less : std::binary_function<_T1, _T2, bool> { bool operator()(const _T1& __t1, const _T2& __t2) const { return __t1 < __t2; } bool operator()(const _T2& __t2, const _T1& __t1) const { return __t2 < __t1; } }; // Partial specialization for one type. Same as std::less. template<typename _Tp> struct _Less<_Tp, _Tp> : public std::less<_Tp> { }; /** @brief Similar to std::plus, but allows two different types. */ template<typename _Tp1, typename _Tp2, typename _Result = __typeof__(*static_cast<_Tp1*>(0) + *static_cast<_Tp2*>(0))> struct _Plus : public std::binary_function<_Tp1, _Tp2, _Result> { _Result operator()(const _Tp1& __x, const _Tp2& __y) const { return __x + __y; } }; // Partial specialization for one type. Same as std::plus. template<typename _Tp> struct _Plus<_Tp, _Tp, _Tp> : public std::plus<_Tp> { }; /** @brief Similar to std::multiplies, but allows two different types. */ template<typename _Tp1, typename _Tp2, typename _Result = __typeof__(*static_cast<_Tp1*>(0) * *static_cast<_Tp2*>(0))> struct _Multiplies : public std::binary_function<_Tp1, _Tp2, _Result> { _Result operator()(const _Tp1& __x, const _Tp2& __y) const { return __x * __y; } }; // Partial specialization for one type. Same as std::multiplies. template<typename _Tp> struct _Multiplies<_Tp, _Tp, _Tp> : public std::multiplies<_Tp> { }; /** @brief _Iterator associated with __gnu_parallel::_PseudoSequence. * If features the usual random-access iterator functionality. * @param _Tp Sequence _M_value type. * @param _DifferenceTp Sequence difference type. */ template<typename _Tp, typename _DifferenceTp> class _PseudoSequenceIterator { public: typedef _DifferenceTp _DifferenceType; _PseudoSequenceIterator(const _Tp& __val, _DifferenceType __pos) : _M_val(__val), _M_pos(__pos) { } // Pre-increment operator. _PseudoSequenceIterator& operator++() { ++_M_pos; return *this; } // Post-increment operator. _PseudoSequenceIterator operator++(int) { return _PseudoSequenceIterator(_M_pos++); } const _Tp& operator*() const { return _M_val; } const _Tp& operator[](_DifferenceType) const { return _M_val; } bool operator==(const _PseudoSequenceIterator& __i2) { return _M_pos == __i2._M_pos; } bool operator!=(const _PseudoSequenceIterator& __i2) { return _M_pos != __i2._M_pos; } _DifferenceType operator-(const _PseudoSequenceIterator& __i2) { return _M_pos - __i2._M_pos; } private: const _Tp& _M_val; _DifferenceType _M_pos; }; /** @brief Sequence that conceptually consists of multiple copies of the same element. * The copies are not stored explicitly, of course. * @param _Tp Sequence _M_value type. * @param _DifferenceTp Sequence difference type. */ template<typename _Tp, typename _DifferenceTp> class _PseudoSequence { public: typedef _DifferenceTp _DifferenceType; // Better cast down to uint64_t, than up to _DifferenceTp. typedef _PseudoSequenceIterator<_Tp, uint64_t> iterator; /** @brief Constructor. * @param __val Element of the sequence. * @param __count Number of (virtual) copies. */ _PseudoSequence(const _Tp& __val, _DifferenceType __count) : _M_val(__val), _M_count(__count) { } /** @brief Begin iterator. */ iterator begin() const { return iterator(_M_val, 0); } /** @brief End iterator. */ iterator end() const { return iterator(_M_val, _M_count); } private: const _Tp& _M_val; _DifferenceType _M_count; }; /** @brief Compute the median of three referenced elements, according to @c __comp. * @param __a First iterator. * @param __b Second iterator. * @param __c Third iterator. * @param __comp Comparator. */ template<typename _RAIter, typename _Compare> _RAIter __median_of_three_iterators(_RAIter __a, _RAIter __b, _RAIter __c, _Compare __comp) { if (__comp(*__a, *__b)) if (__comp(*__b, *__c)) return __b; else if (__comp(*__a, *__c)) return __c; else return __a; else { // Just swap __a and __b. if (__comp(*__a, *__c)) return __a; else if (__comp(*__b, *__c)) return __c; else return __b; } } #define _GLIBCXX_PARALLEL_ASSERT(_Condition) __glibcxx_assert(_Condition) } //namespace __gnu_parallel #endif /* _GLIBCXX_PARALLEL_BASE_H */ ���������������������������������������������c++/4.8.2/parallel/random_number.h������������������������������������������������������������������0000644�����������������00000010203�14763166027�0012372 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/random_number.h * @brief Random number generator based on the Mersenne twister. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler. #ifndef _GLIBCXX_PARALLEL_RANDOM_NUMBER_H #define _GLIBCXX_PARALLEL_RANDOM_NUMBER_H 1 #include <parallel/types.h> #include <tr1/random> #include <limits> namespace __gnu_parallel { /** @brief Random number generator, based on the Mersenne twister. */ class _RandomNumber { private: std::tr1::mt19937 _M_mt; uint64_t _M_supremum; uint64_t _M_rand_sup; double _M_supremum_reciprocal; double _M_rand_sup_reciprocal; // Assumed to be twice as long as the usual random number. uint64_t __cache; // Bit results. int __bits_left; static uint32_t __scale_down(uint64_t __x, #if _GLIBCXX_SCALE_DOWN_FPU uint64_t /*_M_supremum*/, double _M_supremum_reciprocal) #else uint64_t _M_supremum, double /*_M_supremum_reciprocal*/) #endif { #if _GLIBCXX_SCALE_DOWN_FPU return uint32_t(__x * _M_supremum_reciprocal); #else return static_cast<uint32_t>(__x % _M_supremum); #endif } public: /** @brief Default constructor. Seed with 0. */ _RandomNumber() : _M_mt(0), _M_supremum(0x100000000ULL), _M_rand_sup(1ULL << std::numeric_limits<uint32_t>::digits), _M_supremum_reciprocal(double(_M_supremum) / double(_M_rand_sup)), _M_rand_sup_reciprocal(1.0 / double(_M_rand_sup)), __cache(0), __bits_left(0) { } /** @brief Constructor. * @param __seed Random __seed. * @param _M_supremum Generate integer random numbers in the * interval @c [0,_M_supremum). */ _RandomNumber(uint32_t __seed, uint64_t _M_supremum = 0x100000000ULL) : _M_mt(__seed), _M_supremum(_M_supremum), _M_rand_sup(1ULL << std::numeric_limits<uint32_t>::digits), _M_supremum_reciprocal(double(_M_supremum) / double(_M_rand_sup)), _M_rand_sup_reciprocal(1.0 / double(_M_rand_sup)), __cache(0), __bits_left(0) { } /** @brief Generate unsigned random 32-bit integer. */ uint32_t operator()() { return __scale_down(_M_mt(), _M_supremum, _M_supremum_reciprocal); } /** @brief Generate unsigned random 32-bit integer in the interval @c [0,local_supremum). */ uint32_t operator()(uint64_t local_supremum) { return __scale_down(_M_mt(), local_supremum, double(local_supremum * _M_rand_sup_reciprocal)); } /** @brief Generate a number of random bits, run-time parameter. * @param __bits Number of bits to generate. */ unsigned long __genrand_bits(int __bits) { unsigned long __res = __cache & ((1 << __bits) - 1); __cache = __cache >> __bits; __bits_left -= __bits; if (__bits_left < 32) { __cache |= ((uint64_t(_M_mt())) << __bits_left); __bits_left += 32; } return __res; } }; } // namespace __gnu_parallel #endif /* _GLIBCXX_PARALLEL_RANDOM_NUMBER_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/multiway_merge.h�����������������������������������������������������������������0000644�����������������00000211433�14763166027�0012604 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/multiway_merge.h * @brief Implementation of sequential and parallel multiway merge. * * Explanations on the high-speed merging routines in the appendix of * * P. Sanders. * Fast priority queues for cached memory. * ACM Journal of Experimental Algorithmics, 5, 2000. * * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler and Manuel Holtgrewe. #ifndef _GLIBCXX_PARALLEL_MULTIWAY_MERGE_H #define _GLIBCXX_PARALLEL_MULTIWAY_MERGE_H #include <vector> #include <bits/stl_algo.h> #include <parallel/features.h> #include <parallel/parallel.h> #include <parallel/losertree.h> #include <parallel/multiseq_selection.h> #if _GLIBCXX_ASSERTIONS #include <parallel/checkers.h> #endif /** @brief Length of a sequence described by a pair of iterators. */ #define _GLIBCXX_PARALLEL_LENGTH(__s) ((__s).second - (__s).first) namespace __gnu_parallel { template<typename _RAIter1, typename _RAIter2, typename _OutputIterator, typename _DifferenceTp, typename _Compare> _OutputIterator __merge_advance(_RAIter1&, _RAIter1, _RAIter2&, _RAIter2, _OutputIterator, _DifferenceTp, _Compare); /** @brief _Iterator wrapper supporting an implicit supremum at the end * of the sequence, dominating all comparisons. * * The implicit supremum comes with a performance cost. * * Deriving from _RAIter is not possible since * _RAIter need not be a class. */ template<typename _RAIter, typename _Compare> class _GuardedIterator { private: /** @brief Current iterator __position. */ _RAIter _M_current; /** @brief End iterator of the sequence. */ _RAIter _M_end; /** @brief _Compare. */ _Compare& __comp; public: /** @brief Constructor. Sets iterator to beginning of sequence. * @param __begin Begin iterator of sequence. * @param __end End iterator of sequence. * @param __comp Comparator provided for associated overloaded * compare operators. */ _GuardedIterator(_RAIter __begin, _RAIter __end, _Compare& __comp) : _M_current(__begin), _M_end(__end), __comp(__comp) { } /** @brief Pre-increment operator. * @return This. */ _GuardedIterator<_RAIter, _Compare>& operator++() { ++_M_current; return *this; } /** @brief Dereference operator. * @return Referenced element. */ typename std::iterator_traits<_RAIter>::value_type& operator*() { return *_M_current; } /** @brief Convert to wrapped iterator. * @return Wrapped iterator. */ operator _RAIter() { return _M_current; } /** @brief Compare two elements referenced by guarded iterators. * @param __bi1 First iterator. * @param __bi2 Second iterator. * @return @c true if less. */ friend bool operator<(_GuardedIterator<_RAIter, _Compare>& __bi1, _GuardedIterator<_RAIter, _Compare>& __bi2) { if (__bi1._M_current == __bi1._M_end) // __bi1 is sup return __bi2._M_current == __bi2._M_end; // __bi2 is not sup if (__bi2._M_current == __bi2._M_end) // __bi2 is sup return true; return (__bi1.__comp)(*__bi1, *__bi2); // normal compare } /** @brief Compare two elements referenced by guarded iterators. * @param __bi1 First iterator. * @param __bi2 Second iterator. * @return @c True if less equal. */ friend bool operator<=(_GuardedIterator<_RAIter, _Compare>& __bi1, _GuardedIterator<_RAIter, _Compare>& __bi2) { if (__bi2._M_current == __bi2._M_end) // __bi1 is sup return __bi1._M_current != __bi1._M_end; // __bi2 is not sup if (__bi1._M_current == __bi1._M_end) // __bi2 is sup return false; return !(__bi1.__comp)(*__bi2, *__bi1); // normal compare } }; template<typename _RAIter, typename _Compare> class _UnguardedIterator { private: /** @brief Current iterator __position. */ _RAIter _M_current; /** @brief _Compare. */ _Compare& __comp; public: /** @brief Constructor. Sets iterator to beginning of sequence. * @param __begin Begin iterator of sequence. * @param __end Unused, only for compatibility. * @param __comp Unused, only for compatibility. */ _UnguardedIterator(_RAIter __begin, _RAIter /* __end */, _Compare& __comp) : _M_current(__begin), __comp(__comp) { } /** @brief Pre-increment operator. * @return This. */ _UnguardedIterator<_RAIter, _Compare>& operator++() { ++_M_current; return *this; } /** @brief Dereference operator. * @return Referenced element. */ typename std::iterator_traits<_RAIter>::value_type& operator*() { return *_M_current; } /** @brief Convert to wrapped iterator. * @return Wrapped iterator. */ operator _RAIter() { return _M_current; } /** @brief Compare two elements referenced by unguarded iterators. * @param __bi1 First iterator. * @param __bi2 Second iterator. * @return @c true if less. */ friend bool operator<(_UnguardedIterator<_RAIter, _Compare>& __bi1, _UnguardedIterator<_RAIter, _Compare>& __bi2) { // Normal compare. return (__bi1.__comp)(*__bi1, *__bi2); } /** @brief Compare two elements referenced by unguarded iterators. * @param __bi1 First iterator. * @param __bi2 Second iterator. * @return @c True if less equal. */ friend bool operator<=(_UnguardedIterator<_RAIter, _Compare>& __bi1, _UnguardedIterator<_RAIter, _Compare>& __bi2) { // Normal compare. return !(__bi1.__comp)(*__bi2, *__bi1); } }; /** @brief Highly efficient 3-way merging procedure. * * Merging is done with the algorithm implementation described by Peter * Sanders. Basically, the idea is to minimize the number of necessary * comparison after merging an element. The implementation trick * that makes this fast is that the order of the sequences is stored * in the instruction pointer (translated into labels in C++). * * This works well for merging up to 4 sequences. * * Note that making the merging stable does @a not come at a * performance hit. * * Whether the merging is done guarded or unguarded is selected by the * used iterator class. * * @param __seqs_begin Begin iterator of iterator pair input sequence. * @param __seqs_end End iterator of iterator pair input sequence. * @param __target Begin iterator of output sequence. * @param __comp Comparator. * @param __length Maximum length to merge, less equal than the * total number of elements available. * * @return End iterator of output sequence. */ template<template<typename RAI, typename C> class iterator, typename _RAIterIterator, typename _RAIter3, typename _DifferenceTp, typename _Compare> _RAIter3 multiway_merge_3_variant(_RAIterIterator __seqs_begin, _RAIterIterator __seqs_end, _RAIter3 __target, _DifferenceTp __length, _Compare __comp) { _GLIBCXX_CALL(__length); typedef _DifferenceTp _DifferenceType; typedef typename std::iterator_traits<_RAIterIterator> ::value_type::first_type _RAIter1; typedef typename std::iterator_traits<_RAIter1>::value_type _ValueType; if (__length == 0) return __target; #if _GLIBCXX_ASSERTIONS _DifferenceTp __orig_length = __length; #endif iterator<_RAIter1, _Compare> __seq0(__seqs_begin[0].first, __seqs_begin[0].second, __comp), __seq1(__seqs_begin[1].first, __seqs_begin[1].second, __comp), __seq2(__seqs_begin[2].first, __seqs_begin[2].second, __comp); if (__seq0 <= __seq1) { if (__seq1 <= __seq2) goto __s012; else if (__seq2 < __seq0) goto __s201; else goto __s021; } else { if (__seq1 <= __seq2) { if (__seq0 <= __seq2) goto __s102; else goto __s120; } else goto __s210; } #define _GLIBCXX_PARALLEL_MERGE_3_CASE(__a, __b, __c, __c0, __c1) \ __s ## __a ## __b ## __c : \ *__target = *__seq ## __a; \ ++__target; \ --__length; \ ++__seq ## __a; \ if (__length == 0) goto __finish; \ if (__seq ## __a __c0 __seq ## __b) goto __s ## __a ## __b ## __c; \ if (__seq ## __a __c1 __seq ## __c) goto __s ## __b ## __a ## __c; \ goto __s ## __b ## __c ## __a; _GLIBCXX_PARALLEL_MERGE_3_CASE(0, 1, 2, <=, <=); _GLIBCXX_PARALLEL_MERGE_3_CASE(1, 2, 0, <=, < ); _GLIBCXX_PARALLEL_MERGE_3_CASE(2, 0, 1, < , < ); _GLIBCXX_PARALLEL_MERGE_3_CASE(1, 0, 2, < , <=); _GLIBCXX_PARALLEL_MERGE_3_CASE(0, 2, 1, <=, <=); _GLIBCXX_PARALLEL_MERGE_3_CASE(2, 1, 0, < , < ); #undef _GLIBCXX_PARALLEL_MERGE_3_CASE __finish: ; #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT( ((_RAIter1)__seq0 - __seqs_begin[0].first) + ((_RAIter1)__seq1 - __seqs_begin[1].first) + ((_RAIter1)__seq2 - __seqs_begin[2].first) == __orig_length); #endif __seqs_begin[0].first = __seq0; __seqs_begin[1].first = __seq1; __seqs_begin[2].first = __seq2; return __target; } /** * @brief Highly efficient 4-way merging procedure. * * Merging is done with the algorithm implementation described by Peter * Sanders. Basically, the idea is to minimize the number of necessary * comparison after merging an element. The implementation trick * that makes this fast is that the order of the sequences is stored * in the instruction pointer (translated into goto labels in C++). * * This works well for merging up to 4 sequences. * * Note that making the merging stable does @a not come at a * performance hit. * * Whether the merging is done guarded or unguarded is selected by the * used iterator class. * * @param __seqs_begin Begin iterator of iterator pair input sequence. * @param __seqs_end End iterator of iterator pair input sequence. * @param __target Begin iterator of output sequence. * @param __comp Comparator. * @param __length Maximum length to merge, less equal than the * total number of elements available. * * @return End iterator of output sequence. */ template<template<typename RAI, typename C> class iterator, typename _RAIterIterator, typename _RAIter3, typename _DifferenceTp, typename _Compare> _RAIter3 multiway_merge_4_variant(_RAIterIterator __seqs_begin, _RAIterIterator __seqs_end, _RAIter3 __target, _DifferenceTp __length, _Compare __comp) { _GLIBCXX_CALL(__length); typedef _DifferenceTp _DifferenceType; typedef typename std::iterator_traits<_RAIterIterator> ::value_type::first_type _RAIter1; typedef typename std::iterator_traits<_RAIter1>::value_type _ValueType; iterator<_RAIter1, _Compare> __seq0(__seqs_begin[0].first, __seqs_begin[0].second, __comp), __seq1(__seqs_begin[1].first, __seqs_begin[1].second, __comp), __seq2(__seqs_begin[2].first, __seqs_begin[2].second, __comp), __seq3(__seqs_begin[3].first, __seqs_begin[3].second, __comp); #define _GLIBCXX_PARALLEL_DECISION(__a, __b, __c, __d) { \ if (__seq ## __d < __seq ## __a) \ goto __s ## __d ## __a ## __b ## __c; \ if (__seq ## __d < __seq ## __b) \ goto __s ## __a ## __d ## __b ## __c; \ if (__seq ## __d < __seq ## __c) \ goto __s ## __a ## __b ## __d ## __c; \ goto __s ## __a ## __b ## __c ## __d; } if (__seq0 <= __seq1) { if (__seq1 <= __seq2) _GLIBCXX_PARALLEL_DECISION(0,1,2,3) else if (__seq2 < __seq0) _GLIBCXX_PARALLEL_DECISION(2,0,1,3) else _GLIBCXX_PARALLEL_DECISION(0,2,1,3) } else { if (__seq1 <= __seq2) { if (__seq0 <= __seq2) _GLIBCXX_PARALLEL_DECISION(1,0,2,3) else _GLIBCXX_PARALLEL_DECISION(1,2,0,3) } else _GLIBCXX_PARALLEL_DECISION(2,1,0,3) } #define _GLIBCXX_PARALLEL_MERGE_4_CASE(__a, __b, __c, __d, \ __c0, __c1, __c2) \ __s ## __a ## __b ## __c ## __d: \ if (__length == 0) goto __finish; \ *__target = *__seq ## __a; \ ++__target; \ --__length; \ ++__seq ## __a; \ if (__seq ## __a __c0 __seq ## __b) \ goto __s ## __a ## __b ## __c ## __d; \ if (__seq ## __a __c1 __seq ## __c) \ goto __s ## __b ## __a ## __c ## __d; \ if (__seq ## __a __c2 __seq ## __d) \ goto __s ## __b ## __c ## __a ## __d; \ goto __s ## __b ## __c ## __d ## __a; _GLIBCXX_PARALLEL_MERGE_4_CASE(0, 1, 2, 3, <=, <=, <=); _GLIBCXX_PARALLEL_MERGE_4_CASE(0, 1, 3, 2, <=, <=, <=); _GLIBCXX_PARALLEL_MERGE_4_CASE(0, 2, 1, 3, <=, <=, <=); _GLIBCXX_PARALLEL_MERGE_4_CASE(0, 2, 3, 1, <=, <=, <=); _GLIBCXX_PARALLEL_MERGE_4_CASE(0, 3, 1, 2, <=, <=, <=); _GLIBCXX_PARALLEL_MERGE_4_CASE(0, 3, 2, 1, <=, <=, <=); _GLIBCXX_PARALLEL_MERGE_4_CASE(1, 0, 2, 3, < , <=, <=); _GLIBCXX_PARALLEL_MERGE_4_CASE(1, 0, 3, 2, < , <=, <=); _GLIBCXX_PARALLEL_MERGE_4_CASE(1, 2, 0, 3, <=, < , <=); _GLIBCXX_PARALLEL_MERGE_4_CASE(1, 2, 3, 0, <=, <=, < ); _GLIBCXX_PARALLEL_MERGE_4_CASE(1, 3, 0, 2, <=, < , <=); _GLIBCXX_PARALLEL_MERGE_4_CASE(1, 3, 2, 0, <=, <=, < ); _GLIBCXX_PARALLEL_MERGE_4_CASE(2, 0, 1, 3, < , < , <=); _GLIBCXX_PARALLEL_MERGE_4_CASE(2, 0, 3, 1, < , <=, < ); _GLIBCXX_PARALLEL_MERGE_4_CASE(2, 1, 0, 3, < , < , <=); _GLIBCXX_PARALLEL_MERGE_4_CASE(2, 1, 3, 0, < , <=, < ); _GLIBCXX_PARALLEL_MERGE_4_CASE(2, 3, 0, 1, <=, < , < ); _GLIBCXX_PARALLEL_MERGE_4_CASE(2, 3, 1, 0, <=, < , < ); _GLIBCXX_PARALLEL_MERGE_4_CASE(3, 0, 1, 2, < , < , < ); _GLIBCXX_PARALLEL_MERGE_4_CASE(3, 0, 2, 1, < , < , < ); _GLIBCXX_PARALLEL_MERGE_4_CASE(3, 1, 0, 2, < , < , < ); _GLIBCXX_PARALLEL_MERGE_4_CASE(3, 1, 2, 0, < , < , < ); _GLIBCXX_PARALLEL_MERGE_4_CASE(3, 2, 0, 1, < , < , < ); _GLIBCXX_PARALLEL_MERGE_4_CASE(3, 2, 1, 0, < , < , < ); #undef _GLIBCXX_PARALLEL_MERGE_4_CASE #undef _GLIBCXX_PARALLEL_DECISION __finish: ; __seqs_begin[0].first = __seq0; __seqs_begin[1].first = __seq1; __seqs_begin[2].first = __seq2; __seqs_begin[3].first = __seq3; return __target; } /** @brief Multi-way merging procedure for a high branching factor, * guarded case. * * This merging variant uses a LoserTree class as selected by <tt>_LT</tt>. * * Stability is selected through the used LoserTree class <tt>_LT</tt>. * * At least one non-empty sequence is required. * * @param __seqs_begin Begin iterator of iterator pair input sequence. * @param __seqs_end End iterator of iterator pair input sequence. * @param __target Begin iterator of output sequence. * @param __comp Comparator. * @param __length Maximum length to merge, less equal than the * total number of elements available. * * @return End iterator of output sequence. */ template<typename _LT, typename _RAIterIterator, typename _RAIter3, typename _DifferenceTp, typename _Compare> _RAIter3 multiway_merge_loser_tree(_RAIterIterator __seqs_begin, _RAIterIterator __seqs_end, _RAIter3 __target, _DifferenceTp __length, _Compare __comp) { _GLIBCXX_CALL(__length) typedef _DifferenceTp _DifferenceType; typedef typename std::iterator_traits<_RAIterIterator> ::difference_type _SeqNumber; typedef typename std::iterator_traits<_RAIterIterator> ::value_type::first_type _RAIter1; typedef typename std::iterator_traits<_RAIter1>::value_type _ValueType; _SeqNumber __k = static_cast<_SeqNumber>(__seqs_end - __seqs_begin); _LT __lt(__k, __comp); // Default value for potentially non-default-constructible types. _ValueType* __arbitrary_element = 0; for (_SeqNumber __t = 0; __t < __k; ++__t) { if(!__arbitrary_element && _GLIBCXX_PARALLEL_LENGTH(__seqs_begin[__t]) > 0) __arbitrary_element = &(*__seqs_begin[__t].first); } for (_SeqNumber __t = 0; __t < __k; ++__t) { if (__seqs_begin[__t].first == __seqs_begin[__t].second) __lt.__insert_start(*__arbitrary_element, __t, true); else __lt.__insert_start(*__seqs_begin[__t].first, __t, false); } __lt.__init(); _SeqNumber __source; for (_DifferenceType __i = 0; __i < __length; ++__i) { //take out __source = __lt.__get_min_source(); *(__target++) = *(__seqs_begin[__source].first++); // Feed. if (__seqs_begin[__source].first == __seqs_begin[__source].second) __lt.__delete_min_insert(*__arbitrary_element, true); else // Replace from same __source. __lt.__delete_min_insert(*__seqs_begin[__source].first, false); } return __target; } /** @brief Multi-way merging procedure for a high branching factor, * unguarded case. * * Merging is done using the LoserTree class <tt>_LT</tt>. * * Stability is selected by the used LoserTrees. * * @pre No input will run out of elements during the merge. * * @param __seqs_begin Begin iterator of iterator pair input sequence. * @param __seqs_end End iterator of iterator pair input sequence. * @param __target Begin iterator of output sequence. * @param __comp Comparator. * @param __length Maximum length to merge, less equal than the * total number of elements available. * * @return End iterator of output sequence. */ template<typename _LT, typename _RAIterIterator, typename _RAIter3, typename _DifferenceTp, typename _Compare> _RAIter3 multiway_merge_loser_tree_unguarded(_RAIterIterator __seqs_begin, _RAIterIterator __seqs_end, _RAIter3 __target, const typename std::iterator_traits<typename std::iterator_traits< _RAIterIterator>::value_type::first_type>::value_type& __sentinel, _DifferenceTp __length, _Compare __comp) { _GLIBCXX_CALL(__length) typedef _DifferenceTp _DifferenceType; typedef typename std::iterator_traits<_RAIterIterator> ::difference_type _SeqNumber; typedef typename std::iterator_traits<_RAIterIterator> ::value_type::first_type _RAIter1; typedef typename std::iterator_traits<_RAIter1>::value_type _ValueType; _SeqNumber __k = __seqs_end - __seqs_begin; _LT __lt(__k, __sentinel, __comp); for (_SeqNumber __t = 0; __t < __k; ++__t) { #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT(__seqs_begin[__t].first != __seqs_begin[__t].second); #endif __lt.__insert_start(*__seqs_begin[__t].first, __t, false); } __lt.__init(); _SeqNumber __source; #if _GLIBCXX_ASSERTIONS _DifferenceType __i = 0; #endif _RAIter3 __target_end = __target + __length; while (__target < __target_end) { // Take out. __source = __lt.__get_min_source(); #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT(0 <= __source && __source < __k); _GLIBCXX_PARALLEL_ASSERT(__i == 0 || !__comp(*(__seqs_begin[__source].first), *(__target - 1))); #endif // Feed. *(__target++) = *(__seqs_begin[__source].first++); #if _GLIBCXX_ASSERTIONS ++__i; #endif // Replace from same __source. __lt.__delete_min_insert(*__seqs_begin[__source].first, false); } return __target; } /** @brief Multi-way merging procedure for a high branching factor, * requiring sentinels to exist. * * @tparam UnguardedLoserTree _Loser Tree variant to use for the unguarded * merging. * * @param __seqs_begin Begin iterator of iterator pair input sequence. * @param __seqs_end End iterator of iterator pair input sequence. * @param __target Begin iterator of output sequence. * @param __comp Comparator. * @param __length Maximum length to merge, less equal than the * total number of elements available. * * @return End iterator of output sequence. */ template<typename UnguardedLoserTree, typename _RAIterIterator, typename _RAIter3, typename _DifferenceTp, typename _Compare> _RAIter3 multiway_merge_loser_tree_sentinel(_RAIterIterator __seqs_begin, _RAIterIterator __seqs_end, _RAIter3 __target, const typename std::iterator_traits<typename std::iterator_traits< _RAIterIterator>::value_type::first_type>::value_type& __sentinel, _DifferenceTp __length, _Compare __comp) { _GLIBCXX_CALL(__length) typedef _DifferenceTp _DifferenceType; typedef std::iterator_traits<_RAIterIterator> _TraitsType; typedef typename std::iterator_traits<_RAIterIterator> ::value_type::first_type _RAIter1; typedef typename std::iterator_traits<_RAIter1>::value_type _ValueType; _RAIter3 __target_end; for (_RAIterIterator __s = __seqs_begin; __s != __seqs_end; ++__s) // Move the sequence ends to the sentinel. This has the // effect that the sentinel appears to be within the sequence. Then, // we can use the unguarded variant if we merge out as many // non-sentinel elements as we have. ++((*__s).second); __target_end = multiway_merge_loser_tree_unguarded<UnguardedLoserTree> (__seqs_begin, __seqs_end, __target, __sentinel, __length, __comp); #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT(__target_end == __target + __length); _GLIBCXX_PARALLEL_ASSERT(__is_sorted(__target, __target_end, __comp)); #endif // Restore the sequence ends so the sentinels are not contained in the // sequence any more (see comment in loop above). for (_RAIterIterator __s = __seqs_begin; __s != __seqs_end; ++__s) --((*__s).second); return __target_end; } /** * @brief Traits for determining whether the loser tree should * use pointers or copies. * * The field "_M_use_pointer" is used to determine whether to use pointers * in he loser trees or whether to copy the values into the loser tree. * * The default behavior is to use pointers if the data type is 4 times as * big as the pointer to it. * * Specialize for your data type to customize the behavior. * * Example: * * template<> * struct _LoserTreeTraits<int> * { static const bool _M_use_pointer = false; }; * * template<> * struct _LoserTreeTraits<heavyweight_type> * { static const bool _M_use_pointer = true; }; * * @param _Tp type to give the loser tree traits for. */ template <typename _Tp> struct _LoserTreeTraits { /** * @brief True iff to use pointers instead of values in loser trees. * * The default behavior is to use pointers if the data type is four * times as big as the pointer to it. */ static const bool _M_use_pointer = (sizeof(_Tp) > 4 * sizeof(_Tp*)); }; /** * @brief Switch for 3-way merging with __sentinels turned off. * * Note that 3-way merging is always stable! */ template<bool __sentinels /*default == false*/, typename _RAIterIterator, typename _RAIter3, typename _DifferenceTp, typename _Compare> struct __multiway_merge_3_variant_sentinel_switch { _RAIter3 operator()(_RAIterIterator __seqs_begin, _RAIterIterator __seqs_end, _RAIter3 __target, _DifferenceTp __length, _Compare __comp) { return multiway_merge_3_variant<_GuardedIterator> (__seqs_begin, __seqs_end, __target, __length, __comp); } }; /** * @brief Switch for 3-way merging with __sentinels turned on. * * Note that 3-way merging is always stable! */ template<typename _RAIterIterator, typename _RAIter3, typename _DifferenceTp, typename _Compare> struct __multiway_merge_3_variant_sentinel_switch<true, _RAIterIterator, _RAIter3, _DifferenceTp, _Compare> { _RAIter3 operator()(_RAIterIterator __seqs_begin, _RAIterIterator __seqs_end, _RAIter3 __target, _DifferenceTp __length, _Compare __comp) { return multiway_merge_3_variant<_UnguardedIterator> (__seqs_begin, __seqs_end, __target, __length, __comp); } }; /** * @brief Switch for 4-way merging with __sentinels turned off. * * Note that 4-way merging is always stable! */ template<bool __sentinels /*default == false*/, typename _RAIterIterator, typename _RAIter3, typename _DifferenceTp, typename _Compare> struct __multiway_merge_4_variant_sentinel_switch { _RAIter3 operator()(_RAIterIterator __seqs_begin, _RAIterIterator __seqs_end, _RAIter3 __target, _DifferenceTp __length, _Compare __comp) { return multiway_merge_4_variant<_GuardedIterator> (__seqs_begin, __seqs_end, __target, __length, __comp); } }; /** * @brief Switch for 4-way merging with __sentinels turned on. * * Note that 4-way merging is always stable! */ template<typename _RAIterIterator, typename _RAIter3, typename _DifferenceTp, typename _Compare> struct __multiway_merge_4_variant_sentinel_switch<true, _RAIterIterator, _RAIter3, _DifferenceTp, _Compare> { _RAIter3 operator()(_RAIterIterator __seqs_begin, _RAIterIterator __seqs_end, _RAIter3 __target, _DifferenceTp __length, _Compare __comp) { return multiway_merge_4_variant<_UnguardedIterator> (__seqs_begin, __seqs_end, __target, __length, __comp); } }; /** * @brief Switch for k-way merging with __sentinels turned on. */ template<bool __sentinels, bool __stable, typename _RAIterIterator, typename _RAIter3, typename _DifferenceTp, typename _Compare> struct __multiway_merge_k_variant_sentinel_switch { _RAIter3 operator()(_RAIterIterator __seqs_begin, _RAIterIterator __seqs_end, _RAIter3 __target, const typename std::iterator_traits<typename std::iterator_traits< _RAIterIterator>::value_type::first_type>::value_type& __sentinel, _DifferenceTp __length, _Compare __comp) { typedef typename std::iterator_traits<_RAIterIterator> ::value_type::first_type _RAIter1; typedef typename std::iterator_traits<_RAIter1>::value_type _ValueType; return multiway_merge_loser_tree_sentinel< typename __gnu_cxx::__conditional_type< _LoserTreeTraits<_ValueType>::_M_use_pointer, _LoserTreePointerUnguarded<__stable, _ValueType, _Compare>, _LoserTreeUnguarded<__stable, _ValueType, _Compare> >::__type> (__seqs_begin, __seqs_end, __target, __sentinel, __length, __comp); } }; /** * @brief Switch for k-way merging with __sentinels turned off. */ template<bool __stable, typename _RAIterIterator, typename _RAIter3, typename _DifferenceTp, typename _Compare> struct __multiway_merge_k_variant_sentinel_switch<false, __stable, _RAIterIterator, _RAIter3, _DifferenceTp, _Compare> { _RAIter3 operator()(_RAIterIterator __seqs_begin, _RAIterIterator __seqs_end, _RAIter3 __target, const typename std::iterator_traits<typename std::iterator_traits< _RAIterIterator>::value_type::first_type>::value_type& __sentinel, _DifferenceTp __length, _Compare __comp) { typedef typename std::iterator_traits<_RAIterIterator> ::value_type::first_type _RAIter1; typedef typename std::iterator_traits<_RAIter1>::value_type _ValueType; return multiway_merge_loser_tree< typename __gnu_cxx::__conditional_type< _LoserTreeTraits<_ValueType>::_M_use_pointer, _LoserTreePointer<__stable, _ValueType, _Compare>, _LoserTree<__stable, _ValueType, _Compare> >::__type >(__seqs_begin, __seqs_end, __target, __length, __comp); } }; /** @brief Sequential multi-way merging switch. * * The _GLIBCXX_PARALLEL_DECISION is based on the branching factor and * runtime settings. * @param __seqs_begin Begin iterator of iterator pair input sequence. * @param __seqs_end End iterator of iterator pair input sequence. * @param __target Begin iterator of output sequence. * @param __comp Comparator. * @param __length Maximum length to merge, possibly larger than the * number of elements available. * @param __sentinel The sequences have __a __sentinel element. * @return End iterator of output sequence. */ template<bool __stable, bool __sentinels, typename _RAIterIterator, typename _RAIter3, typename _DifferenceTp, typename _Compare> _RAIter3 __sequential_multiway_merge(_RAIterIterator __seqs_begin, _RAIterIterator __seqs_end, _RAIter3 __target, const typename std::iterator_traits<typename std::iterator_traits< _RAIterIterator>::value_type::first_type>::value_type& __sentinel, _DifferenceTp __length, _Compare __comp) { _GLIBCXX_CALL(__length) typedef _DifferenceTp _DifferenceType; typedef typename std::iterator_traits<_RAIterIterator> ::difference_type _SeqNumber; typedef typename std::iterator_traits<_RAIterIterator> ::value_type::first_type _RAIter1; typedef typename std::iterator_traits<_RAIter1>::value_type _ValueType; #if _GLIBCXX_ASSERTIONS for (_RAIterIterator __s = __seqs_begin; __s != __seqs_end; ++__s) { _GLIBCXX_PARALLEL_ASSERT(__is_sorted((*__s).first, (*__s).second, __comp)); } #endif _DifferenceTp __total_length = 0; for (_RAIterIterator __s = __seqs_begin; __s != __seqs_end; ++__s) __total_length += _GLIBCXX_PARALLEL_LENGTH(*__s); __length = std::min<_DifferenceTp>(__length, __total_length); if(__length == 0) return __target; _RAIter3 __return_target = __target; _SeqNumber __k = static_cast<_SeqNumber>(__seqs_end - __seqs_begin); switch (__k) { case 0: break; case 1: __return_target = std::copy(__seqs_begin[0].first, __seqs_begin[0].first + __length, __target); __seqs_begin[0].first += __length; break; case 2: __return_target = __merge_advance(__seqs_begin[0].first, __seqs_begin[0].second, __seqs_begin[1].first, __seqs_begin[1].second, __target, __length, __comp); break; case 3: __return_target = __multiway_merge_3_variant_sentinel_switch <__sentinels, _RAIterIterator, _RAIter3, _DifferenceTp, _Compare>() (__seqs_begin, __seqs_end, __target, __length, __comp); break; case 4: __return_target = __multiway_merge_4_variant_sentinel_switch <__sentinels, _RAIterIterator, _RAIter3, _DifferenceTp, _Compare>() (__seqs_begin, __seqs_end, __target, __length, __comp); break; default: __return_target = __multiway_merge_k_variant_sentinel_switch <__sentinels, __stable, _RAIterIterator, _RAIter3, _DifferenceTp, _Compare>() (__seqs_begin, __seqs_end, __target, __sentinel, __length, __comp); break; } #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT( __is_sorted(__target, __target + __length, __comp)); #endif return __return_target; } /** * @brief Stable sorting functor. * * Used to reduce code instanciation in multiway_merge_sampling_splitting. */ template<bool __stable, class _RAIter, class _StrictWeakOrdering> struct _SamplingSorter { void operator()(_RAIter __first, _RAIter __last, _StrictWeakOrdering __comp) { __gnu_sequential::stable_sort(__first, __last, __comp); } }; /** * @brief Non-__stable sorting functor. * * Used to reduce code instantiation in multiway_merge_sampling_splitting. */ template<class _RAIter, class _StrictWeakOrdering> struct _SamplingSorter<false, _RAIter, _StrictWeakOrdering> { void operator()(_RAIter __first, _RAIter __last, _StrictWeakOrdering __comp) { __gnu_sequential::sort(__first, __last, __comp); } }; /** * @brief Sampling based splitting for parallel multiway-merge routine. */ template<bool __stable, typename _RAIterIterator, typename _Compare, typename _DifferenceType> void multiway_merge_sampling_splitting(_RAIterIterator __seqs_begin, _RAIterIterator __seqs_end, _DifferenceType __length, _DifferenceType __total_length, _Compare __comp, std::vector<std::pair<_DifferenceType, _DifferenceType> > *__pieces) { typedef typename std::iterator_traits<_RAIterIterator> ::difference_type _SeqNumber; typedef typename std::iterator_traits<_RAIterIterator> ::value_type::first_type _RAIter1; typedef typename std::iterator_traits<_RAIter1>::value_type _ValueType; // __k sequences. const _SeqNumber __k = static_cast<_SeqNumber>(__seqs_end - __seqs_begin); const _ThreadIndex __num_threads = omp_get_num_threads(); const _DifferenceType __num_samples = __gnu_parallel::_Settings::get().merge_oversampling * __num_threads; _ValueType* __samples = static_cast<_ValueType*> (::operator new(sizeof(_ValueType) * __k * __num_samples)); // Sample. for (_SeqNumber __s = 0; __s < __k; ++__s) for (_DifferenceType __i = 0; __i < __num_samples; ++__i) { _DifferenceType sample_index = static_cast<_DifferenceType> (_GLIBCXX_PARALLEL_LENGTH(__seqs_begin[__s]) * (double(__i + 1) / (__num_samples + 1)) * (double(__length) / __total_length)); new(&(__samples[__s * __num_samples + __i])) _ValueType(__seqs_begin[__s].first[sample_index]); } // Sort stable or non-stable, depending on value of template parameter // "__stable". _SamplingSorter<__stable, _ValueType*, _Compare>() (__samples, __samples + (__num_samples * __k), __comp); for (_ThreadIndex __slab = 0; __slab < __num_threads; ++__slab) // For each slab / processor. for (_SeqNumber __seq = 0; __seq < __k; ++__seq) { // For each sequence. if (__slab > 0) __pieces[__slab][__seq].first = std::upper_bound (__seqs_begin[__seq].first, __seqs_begin[__seq].second, __samples[__num_samples * __k * __slab / __num_threads], __comp) - __seqs_begin[__seq].first; else // Absolute beginning. __pieces[__slab][__seq].first = 0; if ((__slab + 1) < __num_threads) __pieces[__slab][__seq].second = std::upper_bound (__seqs_begin[__seq].first, __seqs_begin[__seq].second, __samples[__num_samples * __k * (__slab + 1) / __num_threads], __comp) - __seqs_begin[__seq].first; else // Absolute end. __pieces[__slab][__seq].second = _GLIBCXX_PARALLEL_LENGTH(__seqs_begin[__seq]); } for (_SeqNumber __s = 0; __s < __k; ++__s) for (_DifferenceType __i = 0; __i < __num_samples; ++__i) __samples[__s * __num_samples + __i].~_ValueType(); ::operator delete(__samples); } /** * @brief Exact splitting for parallel multiway-merge routine. * * None of the passed sequences may be empty. */ template<bool __stable, typename _RAIterIterator, typename _Compare, typename _DifferenceType> void multiway_merge_exact_splitting(_RAIterIterator __seqs_begin, _RAIterIterator __seqs_end, _DifferenceType __length, _DifferenceType __total_length, _Compare __comp, std::vector<std::pair<_DifferenceType, _DifferenceType> > *__pieces) { typedef typename std::iterator_traits<_RAIterIterator> ::difference_type _SeqNumber; typedef typename std::iterator_traits<_RAIterIterator> ::value_type::first_type _RAIter1; const bool __tight = (__total_length == __length); // __k sequences. const _SeqNumber __k = __seqs_end - __seqs_begin; const _ThreadIndex __num_threads = omp_get_num_threads(); // (Settings::multiway_merge_splitting // == __gnu_parallel::_Settings::EXACT). std::vector<_RAIter1>* __offsets = new std::vector<_RAIter1>[__num_threads]; std::vector<std::pair<_RAIter1, _RAIter1> > __se(__k); copy(__seqs_begin, __seqs_end, __se.begin()); _DifferenceType* __borders = new _DifferenceType[__num_threads + 1]; __equally_split(__length, __num_threads, __borders); for (_ThreadIndex __s = 0; __s < (__num_threads - 1); ++__s) { __offsets[__s].resize(__k); multiseq_partition(__se.begin(), __se.end(), __borders[__s + 1], __offsets[__s].begin(), __comp); // Last one also needed and available. if (!__tight) { __offsets[__num_threads - 1].resize(__k); multiseq_partition(__se.begin(), __se.end(), _DifferenceType(__length), __offsets[__num_threads - 1].begin(), __comp); } } delete[] __borders; for (_ThreadIndex __slab = 0; __slab < __num_threads; ++__slab) { // For each slab / processor. for (_SeqNumber __seq = 0; __seq < __k; ++__seq) { // For each sequence. if (__slab == 0) { // Absolute beginning. __pieces[__slab][__seq].first = 0; } else __pieces[__slab][__seq].first = __pieces[__slab - 1][__seq].second; if (!__tight || __slab < (__num_threads - 1)) __pieces[__slab][__seq].second = __offsets[__slab][__seq] - __seqs_begin[__seq].first; else { // __slab == __num_threads - 1 __pieces[__slab][__seq].second = _GLIBCXX_PARALLEL_LENGTH(__seqs_begin[__seq]); } } } delete[] __offsets; } /** @brief Parallel multi-way merge routine. * * The _GLIBCXX_PARALLEL_DECISION is based on the branching factor * and runtime settings. * * Must not be called if the number of sequences is 1. * * @tparam _Splitter functor to split input (either __exact or sampling based) * @tparam __stable Stable merging incurs a performance penalty. * @tparam __sentinel Ignored. * * @param __seqs_begin Begin iterator of iterator pair input sequence. * @param __seqs_end End iterator of iterator pair input sequence. * @param __target Begin iterator of output sequence. * @param __comp Comparator. * @param __length Maximum length to merge, possibly larger than the * number of elements available. * @return End iterator of output sequence. */ template<bool __stable, bool __sentinels, typename _RAIterIterator, typename _RAIter3, typename _DifferenceTp, typename _Splitter, typename _Compare> _RAIter3 parallel_multiway_merge(_RAIterIterator __seqs_begin, _RAIterIterator __seqs_end, _RAIter3 __target, _Splitter __splitter, _DifferenceTp __length, _Compare __comp, _ThreadIndex __num_threads) { #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT(__seqs_end - __seqs_begin > 1); #endif _GLIBCXX_CALL(__length) typedef _DifferenceTp _DifferenceType; typedef typename std::iterator_traits<_RAIterIterator> ::difference_type _SeqNumber; typedef typename std::iterator_traits<_RAIterIterator> ::value_type::first_type _RAIter1; typedef typename std::iterator_traits<_RAIter1>::value_type _ValueType; // Leave only non-empty sequences. typedef std::pair<_RAIter1, _RAIter1> seq_type; seq_type* __ne_seqs = new seq_type[__seqs_end - __seqs_begin]; _SeqNumber __k = 0; _DifferenceType __total_length = 0; for (_RAIterIterator __raii = __seqs_begin; __raii != __seqs_end; ++__raii) { _DifferenceTp __seq_length = _GLIBCXX_PARALLEL_LENGTH(*__raii); if(__seq_length > 0) { __total_length += __seq_length; __ne_seqs[__k++] = *__raii; } } _GLIBCXX_CALL(__total_length) __length = std::min<_DifferenceTp>(__length, __total_length); if (__total_length == 0 || __k == 0) { delete[] __ne_seqs; return __target; } std::vector<std::pair<_DifferenceType, _DifferenceType> >* __pieces; __num_threads = static_cast<_ThreadIndex> (std::min<_DifferenceType>(__num_threads, __total_length)); # pragma omp parallel num_threads (__num_threads) { # pragma omp single { __num_threads = omp_get_num_threads(); // Thread __t will have to merge pieces[__iam][0..__k - 1] __pieces = new std::vector< std::pair<_DifferenceType, _DifferenceType> >[__num_threads]; for (_ThreadIndex __s = 0; __s < __num_threads; ++__s) __pieces[__s].resize(__k); _DifferenceType __num_samples = __gnu_parallel::_Settings::get().merge_oversampling * __num_threads; __splitter(__ne_seqs, __ne_seqs + __k, __length, __total_length, __comp, __pieces); } //single _ThreadIndex __iam = omp_get_thread_num(); _DifferenceType __target_position = 0; for (_SeqNumber __c = 0; __c < __k; ++__c) __target_position += __pieces[__iam][__c].first; seq_type* __chunks = new seq_type[__k]; for (_SeqNumber __s = 0; __s < __k; ++__s) __chunks[__s] = std::make_pair(__ne_seqs[__s].first + __pieces[__iam][__s].first, __ne_seqs[__s].first + __pieces[__iam][__s].second); if(__length > __target_position) __sequential_multiway_merge<__stable, __sentinels> (__chunks, __chunks + __k, __target + __target_position, *(__seqs_begin->second), __length - __target_position, __comp); delete[] __chunks; } // parallel #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT( __is_sorted(__target, __target + __length, __comp)); #endif __k = 0; // Update ends of sequences. for (_RAIterIterator __raii = __seqs_begin; __raii != __seqs_end; ++__raii) { _DifferenceTp __length = _GLIBCXX_PARALLEL_LENGTH(*__raii); if(__length > 0) (*__raii).first += __pieces[__num_threads - 1][__k++].second; } delete[] __pieces; delete[] __ne_seqs; return __target + __length; } /** * @brief Multiway Merge Frontend. * * Merge the sequences specified by seqs_begin and __seqs_end into * __target. __seqs_begin and __seqs_end must point to a sequence of * pairs. These pairs must contain an iterator to the beginning * of a sequence in their first entry and an iterator the _M_end of * the same sequence in their second entry. * * Ties are broken arbitrarily. See stable_multiway_merge for a variant * that breaks ties by sequence number but is slower. * * The first entries of the pairs (i.e. the begin iterators) will be moved * forward. * * The output sequence has to provide enough space for all elements * that are written to it. * * This function will merge the input sequences: * * - not stable * - parallel, depending on the input size and Settings * - using sampling for splitting * - not using sentinels * * Example: * * <pre> * int sequences[10][10]; * for (int __i = 0; __i < 10; ++__i) * for (int __j = 0; __i < 10; ++__j) * sequences[__i][__j] = __j; * * int __out[33]; * std::vector<std::pair<int*> > seqs; * for (int __i = 0; __i < 10; ++__i) * { seqs.push(std::make_pair<int*>(sequences[__i], * sequences[__i] + 10)) } * * multiway_merge(seqs.begin(), seqs.end(), __target, std::less<int>(), 33); * </pre> * * @see stable_multiway_merge * * @pre All input sequences must be sorted. * @pre Target must provide enough space to merge out length elements or * the number of elements in all sequences, whichever is smaller. * * @post [__target, return __value) contains merged __elements from the * input sequences. * @post return __value - __target = min(__length, number of elements in all * sequences). * * @tparam _RAIterPairIterator iterator over sequence * of pairs of iterators * @tparam _RAIterOut iterator over target sequence * @tparam _DifferenceTp difference type for the sequence * @tparam _Compare strict weak ordering type to compare elements * in sequences * * @param __seqs_begin __begin of sequence __sequence * @param __seqs_end _M_end of sequence __sequence * @param __target target sequence to merge to. * @param __comp strict weak ordering to use for element comparison. * @param __length Maximum length to merge, possibly larger than the * number of elements available. * * @return _M_end iterator of output sequence */ // multiway_merge // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut multiway_merge(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, __gnu_parallel::sequential_tag) { typedef _DifferenceTp _DifferenceType; _GLIBCXX_CALL(__seqs_end - __seqs_begin) // catch special case: no sequences if (__seqs_begin == __seqs_end) return __target; // Execute multiway merge *sequentially*. return __sequential_multiway_merge </* __stable = */ false, /* __sentinels = */ false> (__seqs_begin, __seqs_end, __target, *(__seqs_begin->second), __length, __comp); } // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut multiway_merge(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, __gnu_parallel::exact_tag __tag) { typedef _DifferenceTp _DifferenceType; _GLIBCXX_CALL(__seqs_end - __seqs_begin) // catch special case: no sequences if (__seqs_begin == __seqs_end) return __target; // Execute merge; maybe parallel, depending on the number of merged // elements and the number of sequences and global thresholds in // Settings. if ((__seqs_end - __seqs_begin > 1) && _GLIBCXX_PARALLEL_CONDITION( ((__seqs_end - __seqs_begin) >= __gnu_parallel::_Settings::get().multiway_merge_minimal_k) && ((_SequenceIndex)__length >= __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) return parallel_multiway_merge </* __stable = */ false, /* __sentinels = */ false> (__seqs_begin, __seqs_end, __target, multiway_merge_exact_splitting</* __stable = */ false, typename std::iterator_traits<_RAIterPairIterator> ::value_type*, _Compare, _DifferenceTp>, static_cast<_DifferenceType>(__length), __comp, __tag.__get_num_threads()); else return __sequential_multiway_merge </* __stable = */ false, /* __sentinels = */ false> (__seqs_begin, __seqs_end, __target, *(__seqs_begin->second), __length, __comp); } // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut multiway_merge(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, __gnu_parallel::sampling_tag __tag) { typedef _DifferenceTp _DifferenceType; _GLIBCXX_CALL(__seqs_end - __seqs_begin) // catch special case: no sequences if (__seqs_begin == __seqs_end) return __target; // Execute merge; maybe parallel, depending on the number of merged // elements and the number of sequences and global thresholds in // Settings. if ((__seqs_end - __seqs_begin > 1) && _GLIBCXX_PARALLEL_CONDITION( ((__seqs_end - __seqs_begin) >= __gnu_parallel::_Settings::get().multiway_merge_minimal_k) && ((_SequenceIndex)__length >= __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) return parallel_multiway_merge </* __stable = */ false, /* __sentinels = */ false> (__seqs_begin, __seqs_end, __target, multiway_merge_exact_splitting</* __stable = */ false, typename std::iterator_traits<_RAIterPairIterator> ::value_type*, _Compare, _DifferenceTp>, static_cast<_DifferenceType>(__length), __comp, __tag.__get_num_threads()); else return __sequential_multiway_merge </* __stable = */ false, /* __sentinels = */ false> (__seqs_begin, __seqs_end, __target, *(__seqs_begin->second), __length, __comp); } // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut multiway_merge(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, parallel_tag __tag = parallel_tag(0)) { return multiway_merge(__seqs_begin, __seqs_end, __target, __length, __comp, exact_tag(__tag.__get_num_threads())); } // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut multiway_merge(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, default_parallel_tag __tag) { return multiway_merge(__seqs_begin, __seqs_end, __target, __length, __comp, exact_tag(__tag.__get_num_threads())); } // stable_multiway_merge // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut stable_multiway_merge(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, __gnu_parallel::sequential_tag) { typedef _DifferenceTp _DifferenceType; _GLIBCXX_CALL(__seqs_end - __seqs_begin) // catch special case: no sequences if (__seqs_begin == __seqs_end) return __target; // Execute multiway merge *sequentially*. return __sequential_multiway_merge </* __stable = */ true, /* __sentinels = */ false> (__seqs_begin, __seqs_end, __target, *(__seqs_begin->second), __length, __comp); } // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut stable_multiway_merge(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, __gnu_parallel::exact_tag __tag) { typedef _DifferenceTp _DifferenceType; _GLIBCXX_CALL(__seqs_end - __seqs_begin) // catch special case: no sequences if (__seqs_begin == __seqs_end) return __target; // Execute merge; maybe parallel, depending on the number of merged // elements and the number of sequences and global thresholds in // Settings. if ((__seqs_end - __seqs_begin > 1) && _GLIBCXX_PARALLEL_CONDITION( ((__seqs_end - __seqs_begin) >= __gnu_parallel::_Settings::get().multiway_merge_minimal_k) && ((_SequenceIndex)__length >= __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) return parallel_multiway_merge </* __stable = */ true, /* __sentinels = */ false> (__seqs_begin, __seqs_end, __target, multiway_merge_exact_splitting</* __stable = */ true, typename std::iterator_traits<_RAIterPairIterator> ::value_type*, _Compare, _DifferenceTp>, static_cast<_DifferenceType>(__length), __comp, __tag.__get_num_threads()); else return __sequential_multiway_merge </* __stable = */ true, /* __sentinels = */ false> (__seqs_begin, __seqs_end, __target, *(__seqs_begin->second), __length, __comp); } // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut stable_multiway_merge(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, sampling_tag __tag) { typedef _DifferenceTp _DifferenceType; _GLIBCXX_CALL(__seqs_end - __seqs_begin) // catch special case: no sequences if (__seqs_begin == __seqs_end) return __target; // Execute merge; maybe parallel, depending on the number of merged // elements and the number of sequences and global thresholds in // Settings. if ((__seqs_end - __seqs_begin > 1) && _GLIBCXX_PARALLEL_CONDITION( ((__seqs_end - __seqs_begin) >= __gnu_parallel::_Settings::get().multiway_merge_minimal_k) && ((_SequenceIndex)__length >= __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) return parallel_multiway_merge </* __stable = */ true, /* __sentinels = */ false> (__seqs_begin, __seqs_end, __target, multiway_merge_sampling_splitting</* __stable = */ true, typename std::iterator_traits<_RAIterPairIterator> ::value_type*, _Compare, _DifferenceTp>, static_cast<_DifferenceType>(__length), __comp, __tag.__get_num_threads()); else return __sequential_multiway_merge </* __stable = */ true, /* __sentinels = */ false> (__seqs_begin, __seqs_end, __target, *(__seqs_begin->second), __length, __comp); } // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut stable_multiway_merge(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, parallel_tag __tag = parallel_tag(0)) { return stable_multiway_merge (__seqs_begin, __seqs_end, __target, __length, __comp, exact_tag(__tag.__get_num_threads())); } // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut stable_multiway_merge(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, default_parallel_tag __tag) { return stable_multiway_merge (__seqs_begin, __seqs_end, __target, __length, __comp, exact_tag(__tag.__get_num_threads())); } /** * @brief Multiway Merge Frontend. * * Merge the sequences specified by seqs_begin and __seqs_end into * __target. __seqs_begin and __seqs_end must point to a sequence of * pairs. These pairs must contain an iterator to the beginning * of a sequence in their first entry and an iterator the _M_end of * the same sequence in their second entry. * * Ties are broken arbitrarily. See stable_multiway_merge for a variant * that breaks ties by sequence number but is slower. * * The first entries of the pairs (i.e. the begin iterators) will be moved * forward accordingly. * * The output sequence has to provide enough space for all elements * that are written to it. * * This function will merge the input sequences: * * - not stable * - parallel, depending on the input size and Settings * - using sampling for splitting * - using sentinels * * You have to take care that the element the _M_end iterator points to is * readable and contains a value that is greater than any other non-sentinel * value in all sequences. * * Example: * * <pre> * int sequences[10][11]; * for (int __i = 0; __i < 10; ++__i) * for (int __j = 0; __i < 11; ++__j) * sequences[__i][__j] = __j; // __last one is sentinel! * * int __out[33]; * std::vector<std::pair<int*> > seqs; * for (int __i = 0; __i < 10; ++__i) * { seqs.push(std::make_pair<int*>(sequences[__i], * sequences[__i] + 10)) } * * multiway_merge(seqs.begin(), seqs.end(), __target, std::less<int>(), 33); * </pre> * * @pre All input sequences must be sorted. * @pre Target must provide enough space to merge out length elements or * the number of elements in all sequences, whichever is smaller. * @pre For each @c __i, @c __seqs_begin[__i].second must be the end * marker of the sequence, but also reference the one more __sentinel * element. * * @post [__target, return __value) contains merged __elements from the * input sequences. * @post return __value - __target = min(__length, number of elements in all * sequences). * * @see stable_multiway_merge_sentinels * * @tparam _RAIterPairIterator iterator over sequence * of pairs of iterators * @tparam _RAIterOut iterator over target sequence * @tparam _DifferenceTp difference type for the sequence * @tparam _Compare strict weak ordering type to compare elements * in sequences * * @param __seqs_begin __begin of sequence __sequence * @param __seqs_end _M_end of sequence __sequence * @param __target target sequence to merge to. * @param __comp strict weak ordering to use for element comparison. * @param __length Maximum length to merge, possibly larger than the * number of elements available. * * @return _M_end iterator of output sequence */ // multiway_merge_sentinels // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut multiway_merge_sentinels(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, __gnu_parallel::sequential_tag) { typedef _DifferenceTp _DifferenceType; _GLIBCXX_CALL(__seqs_end - __seqs_begin) // catch special case: no sequences if (__seqs_begin == __seqs_end) return __target; // Execute multiway merge *sequentially*. return __sequential_multiway_merge </* __stable = */ false, /* __sentinels = */ true> (__seqs_begin, __seqs_end, __target, *(__seqs_begin->second), __length, __comp); } // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut multiway_merge_sentinels(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, __gnu_parallel::exact_tag __tag) { typedef _DifferenceTp _DifferenceType; _GLIBCXX_CALL(__seqs_end - __seqs_begin) // catch special case: no sequences if (__seqs_begin == __seqs_end) return __target; // Execute merge; maybe parallel, depending on the number of merged // elements and the number of sequences and global thresholds in // Settings. if ((__seqs_end - __seqs_begin > 1) && _GLIBCXX_PARALLEL_CONDITION( ((__seqs_end - __seqs_begin) >= __gnu_parallel::_Settings::get().multiway_merge_minimal_k) && ((_SequenceIndex)__length >= __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) return parallel_multiway_merge </* __stable = */ false, /* __sentinels = */ true> (__seqs_begin, __seqs_end, __target, multiway_merge_exact_splitting</* __stable = */ false, typename std::iterator_traits<_RAIterPairIterator> ::value_type*, _Compare, _DifferenceTp>, static_cast<_DifferenceType>(__length), __comp, __tag.__get_num_threads()); else return __sequential_multiway_merge </* __stable = */ false, /* __sentinels = */ true> (__seqs_begin, __seqs_end, __target, *(__seqs_begin->second), __length, __comp); } // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut multiway_merge_sentinels(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, sampling_tag __tag) { typedef _DifferenceTp _DifferenceType; _GLIBCXX_CALL(__seqs_end - __seqs_begin) // catch special case: no sequences if (__seqs_begin == __seqs_end) return __target; // Execute merge; maybe parallel, depending on the number of merged // elements and the number of sequences and global thresholds in // Settings. if ((__seqs_end - __seqs_begin > 1) && _GLIBCXX_PARALLEL_CONDITION( ((__seqs_end - __seqs_begin) >= __gnu_parallel::_Settings::get().multiway_merge_minimal_k) && ((_SequenceIndex)__length >= __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) return parallel_multiway_merge </* __stable = */ false, /* __sentinels = */ true> (__seqs_begin, __seqs_end, __target, multiway_merge_sampling_splitting</* __stable = */ false, typename std::iterator_traits<_RAIterPairIterator> ::value_type*, _Compare, _DifferenceTp>, static_cast<_DifferenceType>(__length), __comp, __tag.__get_num_threads()); else return __sequential_multiway_merge </* __stable = */false, /* __sentinels = */ true>( __seqs_begin, __seqs_end, __target, *(__seqs_begin->second), __length, __comp); } // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut multiway_merge_sentinels(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, parallel_tag __tag = parallel_tag(0)) { return multiway_merge_sentinels (__seqs_begin, __seqs_end, __target, __length, __comp, exact_tag(__tag.__get_num_threads())); } // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut multiway_merge_sentinels(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, default_parallel_tag __tag) { return multiway_merge_sentinels (__seqs_begin, __seqs_end, __target, __length, __comp, exact_tag(__tag.__get_num_threads())); } // stable_multiway_merge_sentinels // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut stable_multiway_merge_sentinels(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, __gnu_parallel::sequential_tag) { typedef _DifferenceTp _DifferenceType; _GLIBCXX_CALL(__seqs_end - __seqs_begin) // catch special case: no sequences if (__seqs_begin == __seqs_end) return __target; // Execute multiway merge *sequentially*. return __sequential_multiway_merge </* __stable = */ true, /* __sentinels = */ true> (__seqs_begin, __seqs_end, __target, *(__seqs_begin->second), __length, __comp); } // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut stable_multiway_merge_sentinels(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, __gnu_parallel::exact_tag __tag) { typedef _DifferenceTp _DifferenceType; _GLIBCXX_CALL(__seqs_end - __seqs_begin) // catch special case: no sequences if (__seqs_begin == __seqs_end) return __target; // Execute merge; maybe parallel, depending on the number of merged // elements and the number of sequences and global thresholds in // Settings. if ((__seqs_end - __seqs_begin > 1) && _GLIBCXX_PARALLEL_CONDITION( ((__seqs_end - __seqs_begin) >= __gnu_parallel::_Settings::get().multiway_merge_minimal_k) && ((_SequenceIndex)__length >= __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) return parallel_multiway_merge </* __stable = */ true, /* __sentinels = */ true> (__seqs_begin, __seqs_end, __target, multiway_merge_exact_splitting</* __stable = */ true, typename std::iterator_traits<_RAIterPairIterator> ::value_type*, _Compare, _DifferenceTp>, static_cast<_DifferenceType>(__length), __comp, __tag.__get_num_threads()); else return __sequential_multiway_merge </* __stable = */ true, /* __sentinels = */ true> (__seqs_begin, __seqs_end, __target, *(__seqs_begin->second), __length, __comp); } // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut stable_multiway_merge_sentinels(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, sampling_tag __tag) { typedef _DifferenceTp _DifferenceType; _GLIBCXX_CALL(__seqs_end - __seqs_begin) // catch special case: no sequences if (__seqs_begin == __seqs_end) return __target; // Execute merge; maybe parallel, depending on the number of merged // elements and the number of sequences and global thresholds in // Settings. if ((__seqs_end - __seqs_begin > 1) && _GLIBCXX_PARALLEL_CONDITION( ((__seqs_end - __seqs_begin) >= __gnu_parallel::_Settings::get().multiway_merge_minimal_k) && ((_SequenceIndex)__length >= __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) return parallel_multiway_merge </* __stable = */ true, /* __sentinels = */ true> (__seqs_begin, __seqs_end, __target, multiway_merge_sampling_splitting</* __stable = */ true, typename std::iterator_traits<_RAIterPairIterator> ::value_type*, _Compare, _DifferenceTp>, static_cast<_DifferenceType>(__length), __comp, __tag.__get_num_threads()); else return __sequential_multiway_merge </* __stable = */ true, /* __sentinels = */ true> (__seqs_begin, __seqs_end, __target, *(__seqs_begin->second), __length, __comp); } // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut stable_multiway_merge_sentinels(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, parallel_tag __tag = parallel_tag(0)) { return stable_multiway_merge_sentinels (__seqs_begin, __seqs_end, __target, __length, __comp, exact_tag(__tag.__get_num_threads())); } // public interface template<typename _RAIterPairIterator, typename _RAIterOut, typename _DifferenceTp, typename _Compare> _RAIterOut stable_multiway_merge_sentinels(_RAIterPairIterator __seqs_begin, _RAIterPairIterator __seqs_end, _RAIterOut __target, _DifferenceTp __length, _Compare __comp, default_parallel_tag __tag) { return stable_multiway_merge_sentinels (__seqs_begin, __seqs_end, __target, __length, __comp, exact_tag(__tag.__get_num_threads())); } }; // namespace __gnu_parallel #endif /* _GLIBCXX_PARALLEL_MULTIWAY_MERGE_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/partial_sum.h��������������������������������������������������������������������0000644�����������������00000016462�14763166027�0012077 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/partial_sum.h * @brief Parallel implementation of std::partial_sum(), i.e. prefix * sums. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler. #ifndef _GLIBCXX_PARALLEL_PARTIAL_SUM_H #define _GLIBCXX_PARALLEL_PARTIAL_SUM_H 1 #include <omp.h> #include <new> #include <bits/stl_algobase.h> #include <parallel/parallel.h> #include <parallel/numericfwd.h> namespace __gnu_parallel { // Problem: there is no 0-element given. /** @brief Base case prefix sum routine. * @param __begin Begin iterator of input sequence. * @param __end End iterator of input sequence. * @param __result Begin iterator of output sequence. * @param __bin_op Associative binary function. * @param __value Start value. Must be passed since the neutral * element is unknown in general. * @return End iterator of output sequence. */ template<typename _IIter, typename _OutputIterator, typename _BinaryOperation> _OutputIterator __parallel_partial_sum_basecase(_IIter __begin, _IIter __end, _OutputIterator __result, _BinaryOperation __bin_op, typename std::iterator_traits <_IIter>::value_type __value) { if (__begin == __end) return __result; while (__begin != __end) { __value = __bin_op(__value, *__begin); *__result = __value; ++__result; ++__begin; } return __result; } /** @brief Parallel partial sum implementation, two-phase approach, no recursion. * @param __begin Begin iterator of input sequence. * @param __end End iterator of input sequence. * @param __result Begin iterator of output sequence. * @param __bin_op Associative binary function. * @param __n Length of sequence. * @return End iterator of output sequence. */ template<typename _IIter, typename _OutputIterator, typename _BinaryOperation> _OutputIterator __parallel_partial_sum_linear(_IIter __begin, _IIter __end, _OutputIterator __result, _BinaryOperation __bin_op, typename std::iterator_traits<_IIter>::difference_type __n) { typedef std::iterator_traits<_IIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; if (__begin == __end) return __result; _ThreadIndex __num_threads = std::min<_DifferenceType>(__get_max_threads(), __n - 1); if (__num_threads < 2) { *__result = *__begin; return __parallel_partial_sum_basecase(__begin + 1, __end, __result + 1, __bin_op, *__begin); } _DifferenceType* __borders; _ValueType* __sums; const _Settings& __s = _Settings::get(); # pragma omp parallel num_threads(__num_threads) { # pragma omp single { __num_threads = omp_get_num_threads(); __borders = new _DifferenceType[__num_threads + 2]; if (__s.partial_sum_dilation == 1.0f) __equally_split(__n, __num_threads + 1, __borders); else { _DifferenceType __first_part_length = std::max<_DifferenceType>(1, __n / (1.0f + __s.partial_sum_dilation * __num_threads)); _DifferenceType __chunk_length = (__n - __first_part_length) / __num_threads; _DifferenceType __borderstart = __n - __num_threads * __chunk_length; __borders[0] = 0; for (_ThreadIndex __i = 1; __i < (__num_threads + 1); ++__i) { __borders[__i] = __borderstart; __borderstart += __chunk_length; } __borders[__num_threads + 1] = __n; } __sums = static_cast<_ValueType*>(::operator new(sizeof(_ValueType) * __num_threads)); _OutputIterator __target_end; } //single _ThreadIndex __iam = omp_get_thread_num(); if (__iam == 0) { *__result = *__begin; __parallel_partial_sum_basecase(__begin + 1, __begin + __borders[1], __result + 1, __bin_op, *__begin); ::new(&(__sums[__iam])) _ValueType(*(__result + __borders[1] - 1)); } else { ::new(&(__sums[__iam])) _ValueType(__gnu_parallel::accumulate( __begin + __borders[__iam] + 1, __begin + __borders[__iam + 1], *(__begin + __borders[__iam]), __bin_op, __gnu_parallel::sequential_tag())); } # pragma omp barrier # pragma omp single __parallel_partial_sum_basecase(__sums + 1, __sums + __num_threads, __sums + 1, __bin_op, __sums[0]); # pragma omp barrier // Still same team. __parallel_partial_sum_basecase(__begin + __borders[__iam + 1], __begin + __borders[__iam + 2], __result + __borders[__iam + 1], __bin_op, __sums[__iam]); } //parallel for (_ThreadIndex __i = 0; __i < __num_threads; ++__i) __sums[__i].~_ValueType(); ::operator delete(__sums); delete[] __borders; return __result + __n; } /** @brief Parallel partial sum front-__end. * @param __begin Begin iterator of input sequence. * @param __end End iterator of input sequence. * @param __result Begin iterator of output sequence. * @param __bin_op Associative binary function. * @return End iterator of output sequence. */ template<typename _IIter, typename _OutputIterator, typename _BinaryOperation> _OutputIterator __parallel_partial_sum(_IIter __begin, _IIter __end, _OutputIterator __result, _BinaryOperation __bin_op) { _GLIBCXX_CALL(__begin - __end) typedef std::iterator_traits<_IIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; _DifferenceType __n = __end - __begin; switch (_Settings::get().partial_sum_algorithm) { case LINEAR: // Need an initial offset. return __parallel_partial_sum_linear(__begin, __end, __result, __bin_op, __n); default: // Partial_sum algorithm not implemented. _GLIBCXX_PARALLEL_ASSERT(0); return __result + __n; } } } #endif /* _GLIBCXX_PARALLEL_PARTIAL_SUM_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/algo.h���������������������������������������������������������������������������0000644�����������������00000277242�14763166027�0010506 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/algo.h * @brief Parallel STL function calls corresponding to the stl_algo.h header. * * The functions defined here mainly do case switches and * call the actual parallelized versions in other files. * Inlining policy: Functions that basically only contain one function call, * are declared inline. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler and Felix Putze. #ifndef _GLIBCXX_PARALLEL_ALGO_H #define _GLIBCXX_PARALLEL_ALGO_H 1 #include <parallel/algorithmfwd.h> #include <bits/stl_algobase.h> #include <bits/stl_algo.h> #include <parallel/iterator.h> #include <parallel/base.h> #include <parallel/sort.h> #include <parallel/workstealing.h> #include <parallel/par_loop.h> #include <parallel/omp_loop.h> #include <parallel/omp_loop_static.h> #include <parallel/for_each_selectors.h> #include <parallel/for_each.h> #include <parallel/find.h> #include <parallel/find_selectors.h> #include <parallel/search.h> #include <parallel/random_shuffle.h> #include <parallel/partition.h> #include <parallel/merge.h> #include <parallel/unique_copy.h> #include <parallel/set_operations.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace __parallel { // Sequential fallback template<typename _IIter, typename _Function> inline _Function for_each(_IIter __begin, _IIter __end, _Function __f, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::for_each(__begin, __end, __f); } // Sequential fallback for input iterator case template<typename _IIter, typename _Function, typename _IteratorTag> inline _Function __for_each_switch(_IIter __begin, _IIter __end, _Function __f, _IteratorTag) { return for_each(__begin, __end, __f, __gnu_parallel::sequential_tag()); } // Parallel algorithm for random access iterators template<typename _RAIter, typename _Function> _Function __for_each_switch(_RAIter __begin, _RAIter __end, _Function __f, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism_tag = __gnu_parallel::parallel_balanced) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >= __gnu_parallel::_Settings::get().for_each_minimal_n && __gnu_parallel::__is_parallel(__parallelism_tag))) { bool __dummy; __gnu_parallel::__for_each_selector<_RAIter> __functionality; return __gnu_parallel:: __for_each_template_random_access( __begin, __end, __f, __functionality, __gnu_parallel::_DummyReduct(), true, __dummy, -1, __parallelism_tag); } else return for_each(__begin, __end, __f, __gnu_parallel::sequential_tag()); } // Public interface template<typename _Iterator, typename _Function> inline _Function for_each(_Iterator __begin, _Iterator __end, _Function __f, __gnu_parallel::_Parallelism __parallelism_tag) { typedef std::iterator_traits<_Iterator> _IteratorTraits; typedef typename _IteratorTraits::iterator_category _IteratorCategory; return __for_each_switch(__begin, __end, __f, _IteratorCategory(), __parallelism_tag); } template<typename _Iterator, typename _Function> inline _Function for_each(_Iterator __begin, _Iterator __end, _Function __f) { typedef std::iterator_traits<_Iterator> _IteratorTraits; typedef typename _IteratorTraits::iterator_category _IteratorCategory; return __for_each_switch(__begin, __end, __f, _IteratorCategory()); } // Sequential fallback template<typename _IIter, typename _Tp> inline _IIter find(_IIter __begin, _IIter __end, const _Tp& __val, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::find(__begin, __end, __val); } // Sequential fallback for input iterator case template<typename _IIter, typename _Tp, typename _IteratorTag> inline _IIter __find_switch(_IIter __begin, _IIter __end, const _Tp& __val, _IteratorTag) { return _GLIBCXX_STD_A::find(__begin, __end, __val); } // Parallel find for random access iterators template<typename _RAIter, typename _Tp> _RAIter __find_switch(_RAIter __begin, _RAIter __end, const _Tp& __val, random_access_iterator_tag) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; if (_GLIBCXX_PARALLEL_CONDITION(true)) { std::binder2nd<__gnu_parallel::_EqualTo<_ValueType, const _Tp&> > __comp(__gnu_parallel::_EqualTo<_ValueType, const _Tp&>(), __val); return __gnu_parallel::__find_template( __begin, __end, __begin, __comp, __gnu_parallel::__find_if_selector()).first; } else return _GLIBCXX_STD_A::find(__begin, __end, __val); } // Public interface template<typename _IIter, typename _Tp> inline _IIter find(_IIter __begin, _IIter __end, const _Tp& __val) { typedef std::iterator_traits<_IIter> _IteratorTraits; typedef typename _IteratorTraits::iterator_category _IteratorCategory; return __find_switch(__begin, __end, __val, _IteratorCategory()); } // Sequential fallback template<typename _IIter, typename _Predicate> inline _IIter find_if(_IIter __begin, _IIter __end, _Predicate __pred, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::find_if(__begin, __end, __pred); } // Sequential fallback for input iterator case template<typename _IIter, typename _Predicate, typename _IteratorTag> inline _IIter __find_if_switch(_IIter __begin, _IIter __end, _Predicate __pred, _IteratorTag) { return _GLIBCXX_STD_A::find_if(__begin, __end, __pred); } // Parallel find_if for random access iterators template<typename _RAIter, typename _Predicate> _RAIter __find_if_switch(_RAIter __begin, _RAIter __end, _Predicate __pred, random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION(true)) return __gnu_parallel::__find_template(__begin, __end, __begin, __pred, __gnu_parallel:: __find_if_selector()).first; else return _GLIBCXX_STD_A::find_if(__begin, __end, __pred); } // Public interface template<typename _IIter, typename _Predicate> inline _IIter find_if(_IIter __begin, _IIter __end, _Predicate __pred) { typedef std::iterator_traits<_IIter> _IteratorTraits; typedef typename _IteratorTraits::iterator_category _IteratorCategory; return __find_if_switch(__begin, __end, __pred, _IteratorCategory()); } // Sequential fallback template<typename _IIter, typename _FIterator> inline _IIter find_first_of(_IIter __begin1, _IIter __end1, _FIterator __begin2, _FIterator __end2, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::find_first_of(__begin1, __end1, __begin2, __end2); } // Sequential fallback template<typename _IIter, typename _FIterator, typename _BinaryPredicate> inline _IIter find_first_of(_IIter __begin1, _IIter __end1, _FIterator __begin2, _FIterator __end2, _BinaryPredicate __comp, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::find_first_of( __begin1, __end1, __begin2, __end2, __comp); } // Sequential fallback for input iterator type template<typename _IIter, typename _FIterator, typename _IteratorTag1, typename _IteratorTag2> inline _IIter __find_first_of_switch(_IIter __begin1, _IIter __end1, _FIterator __begin2, _FIterator __end2, _IteratorTag1, _IteratorTag2) { return find_first_of(__begin1, __end1, __begin2, __end2, __gnu_parallel::sequential_tag()); } // Parallel algorithm for random access iterators template<typename _RAIter, typename _FIterator, typename _BinaryPredicate, typename _IteratorTag> inline _RAIter __find_first_of_switch(_RAIter __begin1, _RAIter __end1, _FIterator __begin2, _FIterator __end2, _BinaryPredicate __comp, random_access_iterator_tag, _IteratorTag) { return __gnu_parallel:: __find_template(__begin1, __end1, __begin1, __comp, __gnu_parallel::__find_first_of_selector <_FIterator>(__begin2, __end2)).first; } // Sequential fallback for input iterator type template<typename _IIter, typename _FIterator, typename _BinaryPredicate, typename _IteratorTag1, typename _IteratorTag2> inline _IIter __find_first_of_switch(_IIter __begin1, _IIter __end1, _FIterator __begin2, _FIterator __end2, _BinaryPredicate __comp, _IteratorTag1, _IteratorTag2) { return find_first_of(__begin1, __end1, __begin2, __end2, __comp, __gnu_parallel::sequential_tag()); } // Public interface template<typename _IIter, typename _FIterator, typename _BinaryPredicate> inline _IIter find_first_of(_IIter __begin1, _IIter __end1, _FIterator __begin2, _FIterator __end2, _BinaryPredicate __comp) { typedef std::iterator_traits<_IIter> _IIterTraits; typedef std::iterator_traits<_FIterator> _FIterTraits; typedef typename _IIterTraits::iterator_category _IIteratorCategory; typedef typename _FIterTraits::iterator_category _FIteratorCategory; return __find_first_of_switch(__begin1, __end1, __begin2, __end2, __comp, _IIteratorCategory(), _FIteratorCategory()); } // Public interface, insert default comparator template<typename _IIter, typename _FIterator> inline _IIter find_first_of(_IIter __begin1, _IIter __end1, _FIterator __begin2, _FIterator __end2) { typedef std::iterator_traits<_IIter> _IIterTraits; typedef std::iterator_traits<_FIterator> _FIterTraits; typedef typename _IIterTraits::value_type _IValueType; typedef typename _FIterTraits::value_type _FValueType; return __gnu_parallel::find_first_of(__begin1, __end1, __begin2, __end2, __gnu_parallel::_EqualTo<_IValueType, _FValueType>()); } // Sequential fallback template<typename _IIter, typename _OutputIterator> inline _OutputIterator unique_copy(_IIter __begin1, _IIter __end1, _OutputIterator __out, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::unique_copy(__begin1, __end1, __out); } // Sequential fallback template<typename _IIter, typename _OutputIterator, typename _Predicate> inline _OutputIterator unique_copy(_IIter __begin1, _IIter __end1, _OutputIterator __out, _Predicate __pred, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::unique_copy(__begin1, __end1, __out, __pred); } // Sequential fallback for input iterator case template<typename _IIter, typename _OutputIterator, typename _Predicate, typename _IteratorTag1, typename _IteratorTag2> inline _OutputIterator __unique_copy_switch(_IIter __begin, _IIter __last, _OutputIterator __out, _Predicate __pred, _IteratorTag1, _IteratorTag2) { return _GLIBCXX_STD_A::unique_copy(__begin, __last, __out, __pred); } // Parallel unique_copy for random access iterators template<typename _RAIter, typename RandomAccessOutputIterator, typename _Predicate> RandomAccessOutputIterator __unique_copy_switch(_RAIter __begin, _RAIter __last, RandomAccessOutputIterator __out, _Predicate __pred, random_access_iterator_tag, random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__last - __begin) > __gnu_parallel::_Settings::get().unique_copy_minimal_n)) return __gnu_parallel::__parallel_unique_copy( __begin, __last, __out, __pred); else return _GLIBCXX_STD_A::unique_copy(__begin, __last, __out, __pred); } // Public interface template<typename _IIter, typename _OutputIterator> inline _OutputIterator unique_copy(_IIter __begin1, _IIter __end1, _OutputIterator __out) { typedef std::iterator_traits<_IIter> _IIterTraits; typedef std::iterator_traits<_OutputIterator> _OIterTraits; typedef typename _IIterTraits::iterator_category _IIteratorCategory; typedef typename _IIterTraits::value_type _ValueType; typedef typename _OIterTraits::iterator_category _OIterCategory; return __unique_copy_switch( __begin1, __end1, __out, equal_to<_ValueType>(), _IIteratorCategory(), _OIterCategory()); } // Public interface template<typename _IIter, typename _OutputIterator, typename _Predicate> inline _OutputIterator unique_copy(_IIter __begin1, _IIter __end1, _OutputIterator __out, _Predicate __pred) { typedef std::iterator_traits<_IIter> _IIterTraits; typedef std::iterator_traits<_OutputIterator> _OIterTraits; typedef typename _IIterTraits::iterator_category _IIteratorCategory; typedef typename _OIterTraits::iterator_category _OIterCategory; return __unique_copy_switch( __begin1, __end1, __out, __pred, _IIteratorCategory(), _OIterCategory()); } // Sequential fallback template<typename _IIter1, typename _IIter2, typename _OutputIterator> inline _OutputIterator set_union(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __out, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::set_union( __begin1, __end1, __begin2, __end2, __out); } // Sequential fallback template<typename _IIter1, typename _IIter2, typename _OutputIterator, typename _Predicate> inline _OutputIterator set_union(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __out, _Predicate __pred, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::set_union(__begin1, __end1, __begin2, __end2, __out, __pred); } // Sequential fallback for input iterator case template<typename _IIter1, typename _IIter2, typename _Predicate, typename _OutputIterator, typename _IteratorTag1, typename _IteratorTag2, typename _IteratorTag3> inline _OutputIterator __set_union_switch( _IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __result, _Predicate __pred, _IteratorTag1, _IteratorTag2, _IteratorTag3) { return _GLIBCXX_STD_A::set_union(__begin1, __end1, __begin2, __end2, __result, __pred); } // Parallel set_union for random access iterators template<typename _RAIter1, typename _RAIter2, typename _Output_RAIter, typename _Predicate> _Output_RAIter __set_union_switch(_RAIter1 __begin1, _RAIter1 __end1, _RAIter2 __begin2, _RAIter2 __end2, _Output_RAIter __result, _Predicate __pred, random_access_iterator_tag, random_access_iterator_tag, random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1) >= __gnu_parallel::_Settings::get().set_union_minimal_n || static_cast<__gnu_parallel::_SequenceIndex>(__end2 - __begin2) >= __gnu_parallel::_Settings::get().set_union_minimal_n)) return __gnu_parallel::__parallel_set_union( __begin1, __end1, __begin2, __end2, __result, __pred); else return _GLIBCXX_STD_A::set_union(__begin1, __end1, __begin2, __end2, __result, __pred); } // Public interface template<typename _IIter1, typename _IIter2, typename _OutputIterator> inline _OutputIterator set_union(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __out) { typedef std::iterator_traits<_IIter1> _IIterTraits1; typedef std::iterator_traits<_IIter2> _IIterTraits2; typedef std::iterator_traits<_OutputIterator> _OIterTraits; typedef typename _IIterTraits1::iterator_category _IIterCategory1; typedef typename _IIterTraits2::iterator_category _IIterCategory2; typedef typename _OIterTraits::iterator_category _OIterCategory; typedef typename _IIterTraits1::value_type _ValueType1; typedef typename _IIterTraits2::value_type _ValueType2; return __set_union_switch( __begin1, __end1, __begin2, __end2, __out, __gnu_parallel::_Less<_ValueType1, _ValueType2>(), _IIterCategory1(), _IIterCategory2(), _OIterCategory()); } // Public interface template<typename _IIter1, typename _IIter2, typename _OutputIterator, typename _Predicate> inline _OutputIterator set_union(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __out, _Predicate __pred) { typedef std::iterator_traits<_IIter1> _IIterTraits1; typedef std::iterator_traits<_IIter2> _IIterTraits2; typedef std::iterator_traits<_OutputIterator> _OIterTraits; typedef typename _IIterTraits1::iterator_category _IIterCategory1; typedef typename _IIterTraits2::iterator_category _IIterCategory2; typedef typename _OIterTraits::iterator_category _OIterCategory; return __set_union_switch( __begin1, __end1, __begin2, __end2, __out, __pred, _IIterCategory1(), _IIterCategory2(), _OIterCategory()); } // Sequential fallback. template<typename _IIter1, typename _IIter2, typename _OutputIterator> inline _OutputIterator set_intersection(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __out, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::set_intersection(__begin1, __end1, __begin2, __end2, __out); } // Sequential fallback. template<typename _IIter1, typename _IIter2, typename _OutputIterator, typename _Predicate> inline _OutputIterator set_intersection(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __out, _Predicate __pred, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::set_intersection( __begin1, __end1, __begin2, __end2, __out, __pred); } // Sequential fallback for input iterator case template<typename _IIter1, typename _IIter2, typename _Predicate, typename _OutputIterator, typename _IteratorTag1, typename _IteratorTag2, typename _IteratorTag3> inline _OutputIterator __set_intersection_switch(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __result, _Predicate __pred, _IteratorTag1, _IteratorTag2, _IteratorTag3) { return _GLIBCXX_STD_A::set_intersection(__begin1, __end1, __begin2, __end2, __result, __pred); } // Parallel set_intersection for random access iterators template<typename _RAIter1, typename _RAIter2, typename _Output_RAIter, typename _Predicate> _Output_RAIter __set_intersection_switch(_RAIter1 __begin1, _RAIter1 __end1, _RAIter2 __begin2, _RAIter2 __end2, _Output_RAIter __result, _Predicate __pred, random_access_iterator_tag, random_access_iterator_tag, random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1) >= __gnu_parallel::_Settings::get().set_union_minimal_n || static_cast<__gnu_parallel::_SequenceIndex>(__end2 - __begin2) >= __gnu_parallel::_Settings::get().set_union_minimal_n)) return __gnu_parallel::__parallel_set_intersection( __begin1, __end1, __begin2, __end2, __result, __pred); else return _GLIBCXX_STD_A::set_intersection( __begin1, __end1, __begin2, __end2, __result, __pred); } // Public interface template<typename _IIter1, typename _IIter2, typename _OutputIterator> inline _OutputIterator set_intersection(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __out) { typedef std::iterator_traits<_IIter1> _IIterTraits1; typedef std::iterator_traits<_IIter2> _IIterTraits2; typedef std::iterator_traits<_OutputIterator> _OIterTraits; typedef typename _IIterTraits1::iterator_category _IIterCategory1; typedef typename _IIterTraits2::iterator_category _IIterCategory2; typedef typename _OIterTraits::iterator_category _OIterCategory; typedef typename _IIterTraits1::value_type _ValueType1; typedef typename _IIterTraits2::value_type _ValueType2; return __set_intersection_switch( __begin1, __end1, __begin2, __end2, __out, __gnu_parallel::_Less<_ValueType1, _ValueType2>(), _IIterCategory1(), _IIterCategory2(), _OIterCategory()); } template<typename _IIter1, typename _IIter2, typename _OutputIterator, typename _Predicate> inline _OutputIterator set_intersection(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __out, _Predicate __pred) { typedef std::iterator_traits<_IIter1> _IIterTraits1; typedef std::iterator_traits<_IIter2> _IIterTraits2; typedef std::iterator_traits<_OutputIterator> _OIterTraits; typedef typename _IIterTraits1::iterator_category _IIterCategory1; typedef typename _IIterTraits2::iterator_category _IIterCategory2; typedef typename _OIterTraits::iterator_category _OIterCategory; return __set_intersection_switch( __begin1, __end1, __begin2, __end2, __out, __pred, _IIterCategory1(), _IIterCategory2(), _OIterCategory()); } // Sequential fallback template<typename _IIter1, typename _IIter2, typename _OutputIterator> inline _OutputIterator set_symmetric_difference(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __out, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::set_symmetric_difference( __begin1, __end1, __begin2, __end2, __out); } // Sequential fallback template<typename _IIter1, typename _IIter2, typename _OutputIterator, typename _Predicate> inline _OutputIterator set_symmetric_difference(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __out, _Predicate __pred, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::set_symmetric_difference( __begin1, __end1, __begin2, __end2, __out, __pred); } // Sequential fallback for input iterator case template<typename _IIter1, typename _IIter2, typename _Predicate, typename _OutputIterator, typename _IteratorTag1, typename _IteratorTag2, typename _IteratorTag3> inline _OutputIterator __set_symmetric_difference_switch( _IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __result, _Predicate __pred, _IteratorTag1, _IteratorTag2, _IteratorTag3) { return _GLIBCXX_STD_A::set_symmetric_difference( __begin1, __end1, __begin2, __end2, __result, __pred); } // Parallel set_symmetric_difference for random access iterators template<typename _RAIter1, typename _RAIter2, typename _Output_RAIter, typename _Predicate> _Output_RAIter __set_symmetric_difference_switch(_RAIter1 __begin1, _RAIter1 __end1, _RAIter2 __begin2, _RAIter2 __end2, _Output_RAIter __result, _Predicate __pred, random_access_iterator_tag, random_access_iterator_tag, random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1) >= __gnu_parallel::_Settings::get().set_symmetric_difference_minimal_n || static_cast<__gnu_parallel::_SequenceIndex>(__end2 - __begin2) >= __gnu_parallel::_Settings::get().set_symmetric_difference_minimal_n)) return __gnu_parallel::__parallel_set_symmetric_difference( __begin1, __end1, __begin2, __end2, __result, __pred); else return _GLIBCXX_STD_A::set_symmetric_difference( __begin1, __end1, __begin2, __end2, __result, __pred); } // Public interface. template<typename _IIter1, typename _IIter2, typename _OutputIterator> inline _OutputIterator set_symmetric_difference(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __out) { typedef std::iterator_traits<_IIter1> _IIterTraits1; typedef std::iterator_traits<_IIter2> _IIterTraits2; typedef std::iterator_traits<_OutputIterator> _OIterTraits; typedef typename _IIterTraits1::iterator_category _IIterCategory1; typedef typename _IIterTraits2::iterator_category _IIterCategory2; typedef typename _OIterTraits::iterator_category _OIterCategory; typedef typename _IIterTraits1::value_type _ValueType1; typedef typename _IIterTraits2::value_type _ValueType2; return __set_symmetric_difference_switch( __begin1, __end1, __begin2, __end2, __out, __gnu_parallel::_Less<_ValueType1, _ValueType2>(), _IIterCategory1(), _IIterCategory2(), _OIterCategory()); } // Public interface. template<typename _IIter1, typename _IIter2, typename _OutputIterator, typename _Predicate> inline _OutputIterator set_symmetric_difference(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __out, _Predicate __pred) { typedef std::iterator_traits<_IIter1> _IIterTraits1; typedef std::iterator_traits<_IIter2> _IIterTraits2; typedef std::iterator_traits<_OutputIterator> _OIterTraits; typedef typename _IIterTraits1::iterator_category _IIterCategory1; typedef typename _IIterTraits2::iterator_category _IIterCategory2; typedef typename _OIterTraits::iterator_category _OIterCategory; return __set_symmetric_difference_switch( __begin1, __end1, __begin2, __end2, __out, __pred, _IIterCategory1(), _IIterCategory2(), _OIterCategory()); } // Sequential fallback. template<typename _IIter1, typename _IIter2, typename _OutputIterator> inline _OutputIterator set_difference(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __out, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::set_difference( __begin1,__end1, __begin2, __end2, __out); } // Sequential fallback. template<typename _IIter1, typename _IIter2, typename _OutputIterator, typename _Predicate> inline _OutputIterator set_difference(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __out, _Predicate __pred, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::set_difference(__begin1, __end1, __begin2, __end2, __out, __pred); } // Sequential fallback for input iterator case. template<typename _IIter1, typename _IIter2, typename _Predicate, typename _OutputIterator, typename _IteratorTag1, typename _IteratorTag2, typename _IteratorTag3> inline _OutputIterator __set_difference_switch(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __result, _Predicate __pred, _IteratorTag1, _IteratorTag2, _IteratorTag3) { return _GLIBCXX_STD_A::set_difference( __begin1, __end1, __begin2, __end2, __result, __pred); } // Parallel set_difference for random access iterators template<typename _RAIter1, typename _RAIter2, typename _Output_RAIter, typename _Predicate> _Output_RAIter __set_difference_switch(_RAIter1 __begin1, _RAIter1 __end1, _RAIter2 __begin2, _RAIter2 __end2, _Output_RAIter __result, _Predicate __pred, random_access_iterator_tag, random_access_iterator_tag, random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1) >= __gnu_parallel::_Settings::get().set_difference_minimal_n || static_cast<__gnu_parallel::_SequenceIndex>(__end2 - __begin2) >= __gnu_parallel::_Settings::get().set_difference_minimal_n)) return __gnu_parallel::__parallel_set_difference( __begin1, __end1, __begin2, __end2, __result, __pred); else return _GLIBCXX_STD_A::set_difference( __begin1, __end1, __begin2, __end2, __result, __pred); } // Public interface template<typename _IIter1, typename _IIter2, typename _OutputIterator> inline _OutputIterator set_difference(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __out) { typedef std::iterator_traits<_IIter1> _IIterTraits1; typedef std::iterator_traits<_IIter2> _IIterTraits2; typedef std::iterator_traits<_OutputIterator> _OIterTraits; typedef typename _IIterTraits1::iterator_category _IIterCategory1; typedef typename _IIterTraits2::iterator_category _IIterCategory2; typedef typename _OIterTraits::iterator_category _OIterCategory; typedef typename _IIterTraits1::value_type _ValueType1; typedef typename _IIterTraits2::value_type _ValueType2; return __set_difference_switch( __begin1, __end1, __begin2, __end2, __out, __gnu_parallel::_Less<_ValueType1, _ValueType2>(), _IIterCategory1(), _IIterCategory2(), _OIterCategory()); } // Public interface template<typename _IIter1, typename _IIter2, typename _OutputIterator, typename _Predicate> inline _OutputIterator set_difference(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __out, _Predicate __pred) { typedef std::iterator_traits<_IIter1> _IIterTraits1; typedef std::iterator_traits<_IIter2> _IIterTraits2; typedef std::iterator_traits<_OutputIterator> _OIterTraits; typedef typename _IIterTraits1::iterator_category _IIterCategory1; typedef typename _IIterTraits2::iterator_category _IIterCategory2; typedef typename _OIterTraits::iterator_category _OIterCategory; return __set_difference_switch( __begin1, __end1, __begin2, __end2, __out, __pred, _IIterCategory1(), _IIterCategory2(), _OIterCategory()); } // Sequential fallback template<typename _FIterator> inline _FIterator adjacent_find(_FIterator __begin, _FIterator __end, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::adjacent_find(__begin, __end); } // Sequential fallback template<typename _FIterator, typename _BinaryPredicate> inline _FIterator adjacent_find(_FIterator __begin, _FIterator __end, _BinaryPredicate __binary_pred, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::adjacent_find(__begin, __end, __binary_pred); } // Parallel algorithm for random access iterators template<typename _RAIter> _RAIter __adjacent_find_switch(_RAIter __begin, _RAIter __end, random_access_iterator_tag) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; if (_GLIBCXX_PARALLEL_CONDITION(true)) { _RAIter __spot = __gnu_parallel:: __find_template( __begin, __end - 1, __begin, equal_to<_ValueType>(), __gnu_parallel::__adjacent_find_selector()) .first; if (__spot == (__end - 1)) return __end; else return __spot; } else return adjacent_find(__begin, __end, __gnu_parallel::sequential_tag()); } // Sequential fallback for input iterator case template<typename _FIterator, typename _IteratorTag> inline _FIterator __adjacent_find_switch(_FIterator __begin, _FIterator __end, _IteratorTag) { return adjacent_find(__begin, __end, __gnu_parallel::sequential_tag()); } // Public interface template<typename _FIterator> inline _FIterator adjacent_find(_FIterator __begin, _FIterator __end) { typedef iterator_traits<_FIterator> _TraitsType; typedef typename _TraitsType::iterator_category _IteratorCategory; return __adjacent_find_switch(__begin, __end, _IteratorCategory()); } // Sequential fallback for input iterator case template<typename _FIterator, typename _BinaryPredicate, typename _IteratorTag> inline _FIterator __adjacent_find_switch(_FIterator __begin, _FIterator __end, _BinaryPredicate __pred, _IteratorTag) { return adjacent_find(__begin, __end, __pred, __gnu_parallel::sequential_tag()); } // Parallel algorithm for random access iterators template<typename _RAIter, typename _BinaryPredicate> _RAIter __adjacent_find_switch(_RAIter __begin, _RAIter __end, _BinaryPredicate __pred, random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION(true)) return __gnu_parallel::__find_template(__begin, __end, __begin, __pred, __gnu_parallel:: __adjacent_find_selector()).first; else return adjacent_find(__begin, __end, __pred, __gnu_parallel::sequential_tag()); } // Public interface template<typename _FIterator, typename _BinaryPredicate> inline _FIterator adjacent_find(_FIterator __begin, _FIterator __end, _BinaryPredicate __pred) { typedef iterator_traits<_FIterator> _TraitsType; typedef typename _TraitsType::iterator_category _IteratorCategory; return __adjacent_find_switch(__begin, __end, __pred, _IteratorCategory()); } // Sequential fallback template<typename _IIter, typename _Tp> inline typename iterator_traits<_IIter>::difference_type count(_IIter __begin, _IIter __end, const _Tp& __value, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::count(__begin, __end, __value); } // Parallel code for random access iterators template<typename _RAIter, typename _Tp> typename iterator_traits<_RAIter>::difference_type __count_switch(_RAIter __begin, _RAIter __end, const _Tp& __value, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism_tag = __gnu_parallel::parallel_unbalanced) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; typedef __gnu_parallel::_SequenceIndex _SequenceIndex; if (_GLIBCXX_PARALLEL_CONDITION( static_cast<_SequenceIndex>(__end - __begin) >= __gnu_parallel::_Settings::get().count_minimal_n && __gnu_parallel::__is_parallel(__parallelism_tag))) { __gnu_parallel::__count_selector<_RAIter, _DifferenceType> __functionality; _DifferenceType __res = 0; __gnu_parallel:: __for_each_template_random_access( __begin, __end, __value, __functionality, std::plus<_SequenceIndex>(), __res, __res, -1, __parallelism_tag); return __res; } else return count(__begin, __end, __value, __gnu_parallel::sequential_tag()); } // Sequential fallback for input iterator case. template<typename _IIter, typename _Tp, typename _IteratorTag> inline typename iterator_traits<_IIter>::difference_type __count_switch(_IIter __begin, _IIter __end, const _Tp& __value, _IteratorTag) { return count(__begin, __end, __value, __gnu_parallel::sequential_tag()); } // Public interface. template<typename _IIter, typename _Tp> inline typename iterator_traits<_IIter>::difference_type count(_IIter __begin, _IIter __end, const _Tp& __value, __gnu_parallel::_Parallelism __parallelism_tag) { typedef iterator_traits<_IIter> _TraitsType; typedef typename _TraitsType::iterator_category _IteratorCategory; return __count_switch(__begin, __end, __value, _IteratorCategory(), __parallelism_tag); } template<typename _IIter, typename _Tp> inline typename iterator_traits<_IIter>::difference_type count(_IIter __begin, _IIter __end, const _Tp& __value) { typedef iterator_traits<_IIter> _TraitsType; typedef typename _TraitsType::iterator_category _IteratorCategory; return __count_switch(__begin, __end, __value, _IteratorCategory()); } // Sequential fallback. template<typename _IIter, typename _Predicate> inline typename iterator_traits<_IIter>::difference_type count_if(_IIter __begin, _IIter __end, _Predicate __pred, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::count_if(__begin, __end, __pred); } // Parallel count_if for random access iterators template<typename _RAIter, typename _Predicate> typename iterator_traits<_RAIter>::difference_type __count_if_switch(_RAIter __begin, _RAIter __end, _Predicate __pred, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism_tag = __gnu_parallel::parallel_unbalanced) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; typedef __gnu_parallel::_SequenceIndex _SequenceIndex; if (_GLIBCXX_PARALLEL_CONDITION( static_cast<_SequenceIndex>(__end - __begin) >= __gnu_parallel::_Settings::get().count_minimal_n && __gnu_parallel::__is_parallel(__parallelism_tag))) { _DifferenceType __res = 0; __gnu_parallel:: __count_if_selector<_RAIter, _DifferenceType> __functionality; __gnu_parallel:: __for_each_template_random_access( __begin, __end, __pred, __functionality, std::plus<_SequenceIndex>(), __res, __res, -1, __parallelism_tag); return __res; } else return count_if(__begin, __end, __pred, __gnu_parallel::sequential_tag()); } // Sequential fallback for input iterator case. template<typename _IIter, typename _Predicate, typename _IteratorTag> inline typename iterator_traits<_IIter>::difference_type __count_if_switch(_IIter __begin, _IIter __end, _Predicate __pred, _IteratorTag) { return count_if(__begin, __end, __pred, __gnu_parallel::sequential_tag()); } // Public interface. template<typename _IIter, typename _Predicate> inline typename iterator_traits<_IIter>::difference_type count_if(_IIter __begin, _IIter __end, _Predicate __pred, __gnu_parallel::_Parallelism __parallelism_tag) { typedef iterator_traits<_IIter> _TraitsType; typedef typename _TraitsType::iterator_category _IteratorCategory; return __count_if_switch(__begin, __end, __pred, _IteratorCategory(), __parallelism_tag); } template<typename _IIter, typename _Predicate> inline typename iterator_traits<_IIter>::difference_type count_if(_IIter __begin, _IIter __end, _Predicate __pred) { typedef iterator_traits<_IIter> _TraitsType; typedef typename _TraitsType::iterator_category _IteratorCategory; return __count_if_switch(__begin, __end, __pred, _IteratorCategory()); } // Sequential fallback. template<typename _FIterator1, typename _FIterator2> inline _FIterator1 search(_FIterator1 __begin1, _FIterator1 __end1, _FIterator2 __begin2, _FIterator2 __end2, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::search(__begin1, __end1, __begin2, __end2); } // Parallel algorithm for random access iterator template<typename _RAIter1, typename _RAIter2> _RAIter1 __search_switch(_RAIter1 __begin1, _RAIter1 __end1, _RAIter2 __begin2, _RAIter2 __end2, random_access_iterator_tag, random_access_iterator_tag) { typedef std::iterator_traits<_RAIter1> _Iterator1Traits; typedef typename _Iterator1Traits::value_type _ValueType1; typedef std::iterator_traits<_RAIter2> _Iterator2Traits; typedef typename _Iterator2Traits::value_type _ValueType2; if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1) >= __gnu_parallel::_Settings::get().search_minimal_n)) return __gnu_parallel:: __search_template( __begin1, __end1, __begin2, __end2, __gnu_parallel::_EqualTo<_ValueType1, _ValueType2>()); else return search(__begin1, __end1, __begin2, __end2, __gnu_parallel::sequential_tag()); } // Sequential fallback for input iterator case template<typename _FIterator1, typename _FIterator2, typename _IteratorTag1, typename _IteratorTag2> inline _FIterator1 __search_switch(_FIterator1 __begin1, _FIterator1 __end1, _FIterator2 __begin2, _FIterator2 __end2, _IteratorTag1, _IteratorTag2) { return search(__begin1, __end1, __begin2, __end2, __gnu_parallel::sequential_tag()); } // Public interface. template<typename _FIterator1, typename _FIterator2> inline _FIterator1 search(_FIterator1 __begin1, _FIterator1 __end1, _FIterator2 __begin2, _FIterator2 __end2) { typedef std::iterator_traits<_FIterator1> _Iterator1Traits; typedef typename _Iterator1Traits::iterator_category _IteratorCategory1; typedef std::iterator_traits<_FIterator2> _Iterator2Traits; typedef typename _Iterator2Traits::iterator_category _IteratorCategory2; return __search_switch(__begin1, __end1, __begin2, __end2, _IteratorCategory1(), _IteratorCategory2()); } // Public interface. template<typename _FIterator1, typename _FIterator2, typename _BinaryPredicate> inline _FIterator1 search(_FIterator1 __begin1, _FIterator1 __end1, _FIterator2 __begin2, _FIterator2 __end2, _BinaryPredicate __pred, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::search( __begin1, __end1, __begin2, __end2, __pred); } // Parallel algorithm for random access iterator. template<typename _RAIter1, typename _RAIter2, typename _BinaryPredicate> _RAIter1 __search_switch(_RAIter1 __begin1, _RAIter1 __end1, _RAIter2 __begin2, _RAIter2 __end2, _BinaryPredicate __pred, random_access_iterator_tag, random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1) >= __gnu_parallel::_Settings::get().search_minimal_n)) return __gnu_parallel::__search_template(__begin1, __end1, __begin2, __end2, __pred); else return search(__begin1, __end1, __begin2, __end2, __pred, __gnu_parallel::sequential_tag()); } // Sequential fallback for input iterator case template<typename _FIterator1, typename _FIterator2, typename _BinaryPredicate, typename _IteratorTag1, typename _IteratorTag2> inline _FIterator1 __search_switch(_FIterator1 __begin1, _FIterator1 __end1, _FIterator2 __begin2, _FIterator2 __end2, _BinaryPredicate __pred, _IteratorTag1, _IteratorTag2) { return search(__begin1, __end1, __begin2, __end2, __pred, __gnu_parallel::sequential_tag()); } // Public interface template<typename _FIterator1, typename _FIterator2, typename _BinaryPredicate> inline _FIterator1 search(_FIterator1 __begin1, _FIterator1 __end1, _FIterator2 __begin2, _FIterator2 __end2, _BinaryPredicate __pred) { typedef std::iterator_traits<_FIterator1> _Iterator1Traits; typedef typename _Iterator1Traits::iterator_category _IteratorCategory1; typedef std::iterator_traits<_FIterator2> _Iterator2Traits; typedef typename _Iterator2Traits::iterator_category _IteratorCategory2; return __search_switch(__begin1, __end1, __begin2, __end2, __pred, _IteratorCategory1(), _IteratorCategory2()); } // Sequential fallback template<typename _FIterator, typename _Integer, typename _Tp> inline _FIterator search_n(_FIterator __begin, _FIterator __end, _Integer __count, const _Tp& __val, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::search_n(__begin, __end, __count, __val); } // Sequential fallback template<typename _FIterator, typename _Integer, typename _Tp, typename _BinaryPredicate> inline _FIterator search_n(_FIterator __begin, _FIterator __end, _Integer __count, const _Tp& __val, _BinaryPredicate __binary_pred, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::search_n( __begin, __end, __count, __val, __binary_pred); } // Public interface. template<typename _FIterator, typename _Integer, typename _Tp> inline _FIterator search_n(_FIterator __begin, _FIterator __end, _Integer __count, const _Tp& __val) { typedef typename iterator_traits<_FIterator>::value_type _ValueType; return __gnu_parallel::search_n(__begin, __end, __count, __val, __gnu_parallel::_EqualTo<_ValueType, _Tp>()); } // Parallel algorithm for random access iterators. template<typename _RAIter, typename _Integer, typename _Tp, typename _BinaryPredicate> _RAIter __search_n_switch(_RAIter __begin, _RAIter __end, _Integer __count, const _Tp& __val, _BinaryPredicate __binary_pred, random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >= __gnu_parallel::_Settings::get().search_minimal_n)) { __gnu_parallel::_PseudoSequence<_Tp, _Integer> __ps(__val, __count); return __gnu_parallel::__search_template( __begin, __end, __ps.begin(), __ps.end(), __binary_pred); } else return _GLIBCXX_STD_A::search_n(__begin, __end, __count, __val, __binary_pred); } // Sequential fallback for input iterator case. template<typename _FIterator, typename _Integer, typename _Tp, typename _BinaryPredicate, typename _IteratorTag> inline _FIterator __search_n_switch(_FIterator __begin, _FIterator __end, _Integer __count, const _Tp& __val, _BinaryPredicate __binary_pred, _IteratorTag) { return _GLIBCXX_STD_A::search_n(__begin, __end, __count, __val, __binary_pred); } // Public interface. template<typename _FIterator, typename _Integer, typename _Tp, typename _BinaryPredicate> inline _FIterator search_n(_FIterator __begin, _FIterator __end, _Integer __count, const _Tp& __val, _BinaryPredicate __binary_pred) { return __search_n_switch(__begin, __end, __count, __val, __binary_pred, typename std::iterator_traits<_FIterator>:: iterator_category()); } // Sequential fallback. template<typename _IIter, typename _OutputIterator, typename _UnaryOperation> inline _OutputIterator transform(_IIter __begin, _IIter __end, _OutputIterator __result, _UnaryOperation __unary_op, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::transform(__begin, __end, __result, __unary_op); } // Parallel unary transform for random access iterators. template<typename _RAIter1, typename _RAIter2, typename _UnaryOperation> _RAIter2 __transform1_switch(_RAIter1 __begin, _RAIter1 __end, _RAIter2 __result, _UnaryOperation __unary_op, random_access_iterator_tag, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism_tag = __gnu_parallel::parallel_balanced) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >= __gnu_parallel::_Settings::get().transform_minimal_n && __gnu_parallel::__is_parallel(__parallelism_tag))) { bool __dummy = true; typedef __gnu_parallel::_IteratorPair<_RAIter1, _RAIter2, random_access_iterator_tag> _ItTrip; _ItTrip __begin_pair(__begin, __result), __end_pair(__end, __result + (__end - __begin)); __gnu_parallel::__transform1_selector<_ItTrip> __functionality; __gnu_parallel:: __for_each_template_random_access( __begin_pair, __end_pair, __unary_op, __functionality, __gnu_parallel::_DummyReduct(), __dummy, __dummy, -1, __parallelism_tag); return __functionality._M_finish_iterator; } else return transform(__begin, __end, __result, __unary_op, __gnu_parallel::sequential_tag()); } // Sequential fallback for input iterator case. template<typename _RAIter1, typename _RAIter2, typename _UnaryOperation, typename _IteratorTag1, typename _IteratorTag2> inline _RAIter2 __transform1_switch(_RAIter1 __begin, _RAIter1 __end, _RAIter2 __result, _UnaryOperation __unary_op, _IteratorTag1, _IteratorTag2) { return transform(__begin, __end, __result, __unary_op, __gnu_parallel::sequential_tag()); } // Public interface. template<typename _IIter, typename _OutputIterator, typename _UnaryOperation> inline _OutputIterator transform(_IIter __begin, _IIter __end, _OutputIterator __result, _UnaryOperation __unary_op, __gnu_parallel::_Parallelism __parallelism_tag) { typedef std::iterator_traits<_IIter> _IIterTraits; typedef std::iterator_traits<_OutputIterator> _OIterTraits; typedef typename _IIterTraits::iterator_category _IIteratorCategory; typedef typename _OIterTraits::iterator_category _OIterCategory; return __transform1_switch(__begin, __end, __result, __unary_op, _IIteratorCategory(), _OIterCategory(), __parallelism_tag); } template<typename _IIter, typename _OutputIterator, typename _UnaryOperation> inline _OutputIterator transform(_IIter __begin, _IIter __end, _OutputIterator __result, _UnaryOperation __unary_op) { typedef std::iterator_traits<_IIter> _IIterTraits; typedef std::iterator_traits<_OutputIterator> _OIterTraits; typedef typename _IIterTraits::iterator_category _IIteratorCategory; typedef typename _OIterTraits::iterator_category _OIterCategory; return __transform1_switch(__begin, __end, __result, __unary_op, _IIteratorCategory(), _OIterCategory()); } // Sequential fallback template<typename _IIter1, typename _IIter2, typename _OutputIterator, typename _BinaryOperation> inline _OutputIterator transform(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _OutputIterator __result, _BinaryOperation __binary_op, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::transform(__begin1, __end1, __begin2, __result, __binary_op); } // Parallel binary transform for random access iterators. template<typename _RAIter1, typename _RAIter2, typename _RAIter3, typename _BinaryOperation> _RAIter3 __transform2_switch(_RAIter1 __begin1, _RAIter1 __end1, _RAIter2 __begin2, _RAIter3 __result, _BinaryOperation __binary_op, random_access_iterator_tag, random_access_iterator_tag, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism_tag = __gnu_parallel::parallel_balanced) { if (_GLIBCXX_PARALLEL_CONDITION( (__end1 - __begin1) >= __gnu_parallel::_Settings::get().transform_minimal_n && __gnu_parallel::__is_parallel(__parallelism_tag))) { bool __dummy = true; typedef __gnu_parallel::_IteratorTriple<_RAIter1, _RAIter2, _RAIter3, random_access_iterator_tag> _ItTrip; _ItTrip __begin_triple(__begin1, __begin2, __result), __end_triple(__end1, __begin2 + (__end1 - __begin1), __result + (__end1 - __begin1)); __gnu_parallel::__transform2_selector<_ItTrip> __functionality; __gnu_parallel:: __for_each_template_random_access(__begin_triple, __end_triple, __binary_op, __functionality, __gnu_parallel::_DummyReduct(), __dummy, __dummy, -1, __parallelism_tag); return __functionality._M_finish_iterator; } else return transform(__begin1, __end1, __begin2, __result, __binary_op, __gnu_parallel::sequential_tag()); } // Sequential fallback for input iterator case. template<typename _IIter1, typename _IIter2, typename _OutputIterator, typename _BinaryOperation, typename _Tag1, typename _Tag2, typename _Tag3> inline _OutputIterator __transform2_switch(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _OutputIterator __result, _BinaryOperation __binary_op, _Tag1, _Tag2, _Tag3) { return transform(__begin1, __end1, __begin2, __result, __binary_op, __gnu_parallel::sequential_tag()); } // Public interface. template<typename _IIter1, typename _IIter2, typename _OutputIterator, typename _BinaryOperation> inline _OutputIterator transform(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _OutputIterator __result, _BinaryOperation __binary_op, __gnu_parallel::_Parallelism __parallelism_tag) { typedef std::iterator_traits<_IIter1> _IIterTraits1; typedef typename _IIterTraits1::iterator_category _IIterCategory1; typedef std::iterator_traits<_IIter2> _IIterTraits2; typedef typename _IIterTraits2::iterator_category _IIterCategory2; typedef std::iterator_traits<_OutputIterator> _OIterTraits; typedef typename _OIterTraits::iterator_category _OIterCategory; return __transform2_switch( __begin1, __end1, __begin2, __result, __binary_op, _IIterCategory1(), _IIterCategory2(), _OIterCategory(), __parallelism_tag); } template<typename _IIter1, typename _IIter2, typename _OutputIterator, typename _BinaryOperation> inline _OutputIterator transform(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _OutputIterator __result, _BinaryOperation __binary_op) { typedef std::iterator_traits<_IIter1> _IIterTraits1; typedef typename _IIterTraits1::iterator_category _IIterCategory1; typedef std::iterator_traits<_IIter2> _IIterTraits2; typedef typename _IIterTraits2::iterator_category _IIterCategory2; typedef std::iterator_traits<_OutputIterator> _OIterTraits; typedef typename _OIterTraits::iterator_category _OIterCategory; return __transform2_switch( __begin1, __end1, __begin2, __result, __binary_op, _IIterCategory1(), _IIterCategory2(), _OIterCategory()); } // Sequential fallback template<typename _FIterator, typename _Tp> inline void replace(_FIterator __begin, _FIterator __end, const _Tp& __old_value, const _Tp& __new_value, __gnu_parallel::sequential_tag) { _GLIBCXX_STD_A::replace(__begin, __end, __old_value, __new_value); } // Sequential fallback for input iterator case template<typename _FIterator, typename _Tp, typename _IteratorTag> inline void __replace_switch(_FIterator __begin, _FIterator __end, const _Tp& __old_value, const _Tp& __new_value, _IteratorTag) { replace(__begin, __end, __old_value, __new_value, __gnu_parallel::sequential_tag()); } // Parallel replace for random access iterators template<typename _RAIter, typename _Tp> inline void __replace_switch(_RAIter __begin, _RAIter __end, const _Tp& __old_value, const _Tp& __new_value, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism_tag = __gnu_parallel::parallel_balanced) { // XXX parallel version is where? replace(__begin, __end, __old_value, __new_value, __gnu_parallel::sequential_tag()); } // Public interface template<typename _FIterator, typename _Tp> inline void replace(_FIterator __begin, _FIterator __end, const _Tp& __old_value, const _Tp& __new_value, __gnu_parallel::_Parallelism __parallelism_tag) { typedef iterator_traits<_FIterator> _TraitsType; typedef typename _TraitsType::iterator_category _IteratorCategory; __replace_switch(__begin, __end, __old_value, __new_value, _IteratorCategory(), __parallelism_tag); } template<typename _FIterator, typename _Tp> inline void replace(_FIterator __begin, _FIterator __end, const _Tp& __old_value, const _Tp& __new_value) { typedef iterator_traits<_FIterator> _TraitsType; typedef typename _TraitsType::iterator_category _IteratorCategory; __replace_switch(__begin, __end, __old_value, __new_value, _IteratorCategory()); } // Sequential fallback template<typename _FIterator, typename _Predicate, typename _Tp> inline void replace_if(_FIterator __begin, _FIterator __end, _Predicate __pred, const _Tp& __new_value, __gnu_parallel::sequential_tag) { _GLIBCXX_STD_A::replace_if(__begin, __end, __pred, __new_value); } // Sequential fallback for input iterator case template<typename _FIterator, typename _Predicate, typename _Tp, typename _IteratorTag> inline void __replace_if_switch(_FIterator __begin, _FIterator __end, _Predicate __pred, const _Tp& __new_value, _IteratorTag) { replace_if(__begin, __end, __pred, __new_value, __gnu_parallel::sequential_tag()); } // Parallel algorithm for random access iterators. template<typename _RAIter, typename _Predicate, typename _Tp> void __replace_if_switch(_RAIter __begin, _RAIter __end, _Predicate __pred, const _Tp& __new_value, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism_tag = __gnu_parallel::parallel_balanced) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >= __gnu_parallel::_Settings::get().replace_minimal_n && __gnu_parallel::__is_parallel(__parallelism_tag))) { bool __dummy; __gnu_parallel:: __replace_if_selector<_RAIter, _Predicate, _Tp> __functionality(__new_value); __gnu_parallel:: __for_each_template_random_access( __begin, __end, __pred, __functionality, __gnu_parallel::_DummyReduct(), true, __dummy, -1, __parallelism_tag); } else replace_if(__begin, __end, __pred, __new_value, __gnu_parallel::sequential_tag()); } // Public interface. template<typename _FIterator, typename _Predicate, typename _Tp> inline void replace_if(_FIterator __begin, _FIterator __end, _Predicate __pred, const _Tp& __new_value, __gnu_parallel::_Parallelism __parallelism_tag) { typedef std::iterator_traits<_FIterator> _IteratorTraits; typedef typename _IteratorTraits::iterator_category _IteratorCategory; __replace_if_switch(__begin, __end, __pred, __new_value, _IteratorCategory(), __parallelism_tag); } template<typename _FIterator, typename _Predicate, typename _Tp> inline void replace_if(_FIterator __begin, _FIterator __end, _Predicate __pred, const _Tp& __new_value) { typedef std::iterator_traits<_FIterator> _IteratorTraits; typedef typename _IteratorTraits::iterator_category _IteratorCategory; __replace_if_switch(__begin, __end, __pred, __new_value, _IteratorCategory()); } // Sequential fallback template<typename _FIterator, typename _Generator> inline void generate(_FIterator __begin, _FIterator __end, _Generator __gen, __gnu_parallel::sequential_tag) { _GLIBCXX_STD_A::generate(__begin, __end, __gen); } // Sequential fallback for input iterator case. template<typename _FIterator, typename _Generator, typename _IteratorTag> inline void __generate_switch(_FIterator __begin, _FIterator __end, _Generator __gen, _IteratorTag) { generate(__begin, __end, __gen, __gnu_parallel::sequential_tag()); } // Parallel algorithm for random access iterators. template<typename _RAIter, typename _Generator> void __generate_switch(_RAIter __begin, _RAIter __end, _Generator __gen, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism_tag = __gnu_parallel::parallel_balanced) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >= __gnu_parallel::_Settings::get().generate_minimal_n && __gnu_parallel::__is_parallel(__parallelism_tag))) { bool __dummy; __gnu_parallel::__generate_selector<_RAIter> __functionality; __gnu_parallel:: __for_each_template_random_access( __begin, __end, __gen, __functionality, __gnu_parallel::_DummyReduct(), true, __dummy, -1, __parallelism_tag); } else generate(__begin, __end, __gen, __gnu_parallel::sequential_tag()); } // Public interface. template<typename _FIterator, typename _Generator> inline void generate(_FIterator __begin, _FIterator __end, _Generator __gen, __gnu_parallel::_Parallelism __parallelism_tag) { typedef std::iterator_traits<_FIterator> _IteratorTraits; typedef typename _IteratorTraits::iterator_category _IteratorCategory; __generate_switch(__begin, __end, __gen, _IteratorCategory(), __parallelism_tag); } template<typename _FIterator, typename _Generator> inline void generate(_FIterator __begin, _FIterator __end, _Generator __gen) { typedef std::iterator_traits<_FIterator> _IteratorTraits; typedef typename _IteratorTraits::iterator_category _IteratorCategory; __generate_switch(__begin, __end, __gen, _IteratorCategory()); } // Sequential fallback. template<typename _OutputIterator, typename _Size, typename _Generator> inline _OutputIterator generate_n(_OutputIterator __begin, _Size __n, _Generator __gen, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::generate_n(__begin, __n, __gen); } // Sequential fallback for input iterator case. template<typename _OutputIterator, typename _Size, typename _Generator, typename _IteratorTag> inline _OutputIterator __generate_n_switch(_OutputIterator __begin, _Size __n, _Generator __gen, _IteratorTag) { return generate_n(__begin, __n, __gen, __gnu_parallel::sequential_tag()); } // Parallel algorithm for random access iterators. template<typename _RAIter, typename _Size, typename _Generator> inline _RAIter __generate_n_switch(_RAIter __begin, _Size __n, _Generator __gen, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism_tag = __gnu_parallel::parallel_balanced) { // XXX parallel version is where? return generate_n(__begin, __n, __gen, __gnu_parallel::sequential_tag()); } // Public interface. template<typename _OutputIterator, typename _Size, typename _Generator> inline _OutputIterator generate_n(_OutputIterator __begin, _Size __n, _Generator __gen, __gnu_parallel::_Parallelism __parallelism_tag) { typedef std::iterator_traits<_OutputIterator> _IteratorTraits; typedef typename _IteratorTraits::iterator_category _IteratorCategory; return __generate_n_switch(__begin, __n, __gen, _IteratorCategory(), __parallelism_tag); } template<typename _OutputIterator, typename _Size, typename _Generator> inline _OutputIterator generate_n(_OutputIterator __begin, _Size __n, _Generator __gen) { typedef std::iterator_traits<_OutputIterator> _IteratorTraits; typedef typename _IteratorTraits::iterator_category _IteratorCategory; return __generate_n_switch(__begin, __n, __gen, _IteratorCategory()); } // Sequential fallback. template<typename _RAIter> inline void random_shuffle(_RAIter __begin, _RAIter __end, __gnu_parallel::sequential_tag) { _GLIBCXX_STD_A::random_shuffle(__begin, __end); } // Sequential fallback. template<typename _RAIter, typename _RandomNumberGenerator> inline void random_shuffle(_RAIter __begin, _RAIter __end, _RandomNumberGenerator& __rand, __gnu_parallel::sequential_tag) { _GLIBCXX_STD_A::random_shuffle(__begin, __end, __rand); } /** @brief Functor wrapper for std::rand(). */ template<typename _MustBeInt = int> struct _CRandNumber { int operator()(int __limit) { return rand() % __limit; } }; // Fill in random number generator. template<typename _RAIter> inline void random_shuffle(_RAIter __begin, _RAIter __end) { _CRandNumber<> __r; // Parallelization still possible. __gnu_parallel::random_shuffle(__begin, __end, __r); } // Parallel algorithm for random access iterators. template<typename _RAIter, typename _RandomNumberGenerator> void random_shuffle(_RAIter __begin, _RAIter __end, #if __cplusplus >= 201103L _RandomNumberGenerator&& __rand) #else _RandomNumberGenerator& __rand) #endif { if (__begin == __end) return; if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >= __gnu_parallel::_Settings::get().random_shuffle_minimal_n)) __gnu_parallel::__parallel_random_shuffle(__begin, __end, __rand); else __gnu_parallel::__sequential_random_shuffle(__begin, __end, __rand); } // Sequential fallback. template<typename _FIterator, typename _Predicate> inline _FIterator partition(_FIterator __begin, _FIterator __end, _Predicate __pred, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::partition(__begin, __end, __pred); } // Sequential fallback for input iterator case. template<typename _FIterator, typename _Predicate, typename _IteratorTag> inline _FIterator __partition_switch(_FIterator __begin, _FIterator __end, _Predicate __pred, _IteratorTag) { return partition(__begin, __end, __pred, __gnu_parallel::sequential_tag()); } // Parallel algorithm for random access iterators. template<typename _RAIter, typename _Predicate> _RAIter __partition_switch(_RAIter __begin, _RAIter __end, _Predicate __pred, random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >= __gnu_parallel::_Settings::get().partition_minimal_n)) { typedef typename std::iterator_traits<_RAIter>:: difference_type _DifferenceType; _DifferenceType __middle = __gnu_parallel:: __parallel_partition(__begin, __end, __pred, __gnu_parallel::__get_max_threads()); return __begin + __middle; } else return partition(__begin, __end, __pred, __gnu_parallel::sequential_tag()); } // Public interface. template<typename _FIterator, typename _Predicate> inline _FIterator partition(_FIterator __begin, _FIterator __end, _Predicate __pred) { typedef iterator_traits<_FIterator> _TraitsType; typedef typename _TraitsType::iterator_category _IteratorCategory; return __partition_switch(__begin, __end, __pred, _IteratorCategory()); } // sort interface // Sequential fallback template<typename _RAIter> inline void sort(_RAIter __begin, _RAIter __end, __gnu_parallel::sequential_tag) { _GLIBCXX_STD_A::sort(__begin, __end); } // Sequential fallback template<typename _RAIter, typename _Compare> inline void sort(_RAIter __begin, _RAIter __end, _Compare __comp, __gnu_parallel::sequential_tag) { _GLIBCXX_STD_A::sort<_RAIter, _Compare>(__begin, __end, __comp); } // Public interface template<typename _RAIter, typename _Compare, typename _Parallelism> void sort(_RAIter __begin, _RAIter __end, _Compare __comp, _Parallelism __parallelism) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; if (__begin != __end) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >= __gnu_parallel::_Settings::get().sort_minimal_n)) __gnu_parallel::__parallel_sort<false>( __begin, __end, __comp, __parallelism); else sort(__begin, __end, __comp, __gnu_parallel::sequential_tag()); } } // Public interface, insert default comparator template<typename _RAIter> inline void sort(_RAIter __begin, _RAIter __end) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; sort(__begin, __end, std::less<_ValueType>(), __gnu_parallel::default_parallel_tag()); } // Public interface, insert default comparator template<typename _RAIter> inline void sort(_RAIter __begin, _RAIter __end, __gnu_parallel::default_parallel_tag __parallelism) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; sort(__begin, __end, std::less<_ValueType>(), __parallelism); } // Public interface, insert default comparator template<typename _RAIter> inline void sort(_RAIter __begin, _RAIter __end, __gnu_parallel::parallel_tag __parallelism) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; sort(__begin, __end, std::less<_ValueType>(), __parallelism); } // Public interface, insert default comparator template<typename _RAIter> inline void sort(_RAIter __begin, _RAIter __end, __gnu_parallel::multiway_mergesort_tag __parallelism) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; sort(__begin, __end, std::less<_ValueType>(), __parallelism); } // Public interface, insert default comparator template<typename _RAIter> inline void sort(_RAIter __begin, _RAIter __end, __gnu_parallel::multiway_mergesort_sampling_tag __parallelism) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; sort(__begin, __end, std::less<_ValueType>(), __parallelism); } // Public interface, insert default comparator template<typename _RAIter> inline void sort(_RAIter __begin, _RAIter __end, __gnu_parallel::multiway_mergesort_exact_tag __parallelism) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; sort(__begin, __end, std::less<_ValueType>(), __parallelism); } // Public interface, insert default comparator template<typename _RAIter> inline void sort(_RAIter __begin, _RAIter __end, __gnu_parallel::quicksort_tag __parallelism) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; sort(__begin, __end, std::less<_ValueType>(), __parallelism); } // Public interface, insert default comparator template<typename _RAIter> inline void sort(_RAIter __begin, _RAIter __end, __gnu_parallel::balanced_quicksort_tag __parallelism) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; sort(__begin, __end, std::less<_ValueType>(), __parallelism); } // Public interface template<typename _RAIter, typename _Compare> void sort(_RAIter __begin, _RAIter __end, _Compare __comp) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; sort(__begin, __end, __comp, __gnu_parallel::default_parallel_tag()); } // stable_sort interface // Sequential fallback template<typename _RAIter> inline void stable_sort(_RAIter __begin, _RAIter __end, __gnu_parallel::sequential_tag) { _GLIBCXX_STD_A::stable_sort(__begin, __end); } // Sequential fallback template<typename _RAIter, typename _Compare> inline void stable_sort(_RAIter __begin, _RAIter __end, _Compare __comp, __gnu_parallel::sequential_tag) { _GLIBCXX_STD_A::stable_sort<_RAIter, _Compare>( __begin, __end, __comp); } // Public interface template<typename _RAIter, typename _Compare, typename _Parallelism> void stable_sort(_RAIter __begin, _RAIter __end, _Compare __comp, _Parallelism __parallelism) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; if (__begin != __end) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >= __gnu_parallel::_Settings::get().sort_minimal_n)) __gnu_parallel::__parallel_sort<true>( __begin, __end, __comp, __parallelism); else stable_sort(__begin, __end, __comp, __gnu_parallel::sequential_tag()); } } // Public interface, insert default comparator template<typename _RAIter> inline void stable_sort(_RAIter __begin, _RAIter __end) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; stable_sort(__begin, __end, std::less<_ValueType>(), __gnu_parallel::default_parallel_tag()); } // Public interface, insert default comparator template<typename _RAIter> inline void stable_sort(_RAIter __begin, _RAIter __end, __gnu_parallel::default_parallel_tag __parallelism) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; stable_sort(__begin, __end, std::less<_ValueType>(), __parallelism); } // Public interface, insert default comparator template<typename _RAIter> inline void stable_sort(_RAIter __begin, _RAIter __end, __gnu_parallel::parallel_tag __parallelism) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; stable_sort(__begin, __end, std::less<_ValueType>(), __parallelism); } // Public interface, insert default comparator template<typename _RAIter> inline void stable_sort(_RAIter __begin, _RAIter __end, __gnu_parallel::multiway_mergesort_tag __parallelism) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; stable_sort(__begin, __end, std::less<_ValueType>(), __parallelism); } // Public interface, insert default comparator template<typename _RAIter> inline void stable_sort(_RAIter __begin, _RAIter __end, __gnu_parallel::quicksort_tag __parallelism) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; stable_sort(__begin, __end, std::less<_ValueType>(), __parallelism); } // Public interface, insert default comparator template<typename _RAIter> inline void stable_sort(_RAIter __begin, _RAIter __end, __gnu_parallel::balanced_quicksort_tag __parallelism) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; stable_sort(__begin, __end, std::less<_ValueType>(), __parallelism); } // Public interface template<typename _RAIter, typename _Compare> void stable_sort(_RAIter __begin, _RAIter __end, _Compare __comp) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; stable_sort( __begin, __end, __comp, __gnu_parallel::default_parallel_tag()); } // Sequential fallback template<typename _IIter1, typename _IIter2, typename _OutputIterator> inline _OutputIterator merge(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __result, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::merge( __begin1, __end1, __begin2, __end2, __result); } // Sequential fallback template<typename _IIter1, typename _IIter2, typename _OutputIterator, typename _Compare> inline _OutputIterator merge(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __result, _Compare __comp, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::merge( __begin1, __end1, __begin2, __end2, __result, __comp); } // Sequential fallback for input iterator case template<typename _IIter1, typename _IIter2, typename _OutputIterator, typename _Compare, typename _IteratorTag1, typename _IteratorTag2, typename _IteratorTag3> inline _OutputIterator __merge_switch(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __result, _Compare __comp, _IteratorTag1, _IteratorTag2, _IteratorTag3) { return _GLIBCXX_STD_A::merge(__begin1, __end1, __begin2, __end2, __result, __comp); } // Parallel algorithm for random access iterators template<typename _IIter1, typename _IIter2, typename _OutputIterator, typename _Compare> _OutputIterator __merge_switch(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __result, _Compare __comp, random_access_iterator_tag, random_access_iterator_tag, random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION( (static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1) >= __gnu_parallel::_Settings::get().merge_minimal_n || static_cast<__gnu_parallel::_SequenceIndex>(__end2 - __begin2) >= __gnu_parallel::_Settings::get().merge_minimal_n))) return __gnu_parallel::__parallel_merge_advance( __begin1, __end1, __begin2, __end2, __result, (__end1 - __begin1) + (__end2 - __begin2), __comp); else return __gnu_parallel::__merge_advance( __begin1, __end1, __begin2, __end2, __result, (__end1 - __begin1) + (__end2 - __begin2), __comp); } // Public interface template<typename _IIter1, typename _IIter2, typename _OutputIterator, typename _Compare> inline _OutputIterator merge(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __result, _Compare __comp) { typedef typename iterator_traits<_IIter1>::value_type _ValueType; typedef std::iterator_traits<_IIter1> _IIterTraits1; typedef std::iterator_traits<_IIter2> _IIterTraits2; typedef std::iterator_traits<_OutputIterator> _OIterTraits; typedef typename _IIterTraits1::iterator_category _IIterCategory1; typedef typename _IIterTraits2::iterator_category _IIterCategory2; typedef typename _OIterTraits::iterator_category _OIterCategory; return __merge_switch( __begin1, __end1, __begin2, __end2, __result, __comp, _IIterCategory1(), _IIterCategory2(), _OIterCategory()); } // Public interface, insert default comparator template<typename _IIter1, typename _IIter2, typename _OutputIterator> inline _OutputIterator merge(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _OutputIterator __result) { typedef std::iterator_traits<_IIter1> _Iterator1Traits; typedef std::iterator_traits<_IIter2> _Iterator2Traits; typedef typename _Iterator1Traits::value_type _ValueType1; typedef typename _Iterator2Traits::value_type _ValueType2; return __gnu_parallel::merge(__begin1, __end1, __begin2, __end2, __result, __gnu_parallel::_Less<_ValueType1, _ValueType2>()); } // Sequential fallback template<typename _RAIter> inline void nth_element(_RAIter __begin, _RAIter __nth, _RAIter __end, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::nth_element(__begin, __nth, __end); } // Sequential fallback template<typename _RAIter, typename _Compare> inline void nth_element(_RAIter __begin, _RAIter __nth, _RAIter __end, _Compare __comp, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::nth_element(__begin, __nth, __end, __comp); } // Public interface template<typename _RAIter, typename _Compare> inline void nth_element(_RAIter __begin, _RAIter __nth, _RAIter __end, _Compare __comp) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >= __gnu_parallel::_Settings::get().nth_element_minimal_n)) __gnu_parallel::__parallel_nth_element(__begin, __nth, __end, __comp); else nth_element(__begin, __nth, __end, __comp, __gnu_parallel::sequential_tag()); } // Public interface, insert default comparator template<typename _RAIter> inline void nth_element(_RAIter __begin, _RAIter __nth, _RAIter __end) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; __gnu_parallel::nth_element(__begin, __nth, __end, std::less<_ValueType>()); } // Sequential fallback template<typename _RAIter, typename _Compare> inline void partial_sort(_RAIter __begin, _RAIter __middle, _RAIter __end, _Compare __comp, __gnu_parallel::sequential_tag) { _GLIBCXX_STD_A::partial_sort(__begin, __middle, __end, __comp); } // Sequential fallback template<typename _RAIter> inline void partial_sort(_RAIter __begin, _RAIter __middle, _RAIter __end, __gnu_parallel::sequential_tag) { _GLIBCXX_STD_A::partial_sort(__begin, __middle, __end); } // Public interface, parallel algorithm for random access iterators template<typename _RAIter, typename _Compare> void partial_sort(_RAIter __begin, _RAIter __middle, _RAIter __end, _Compare __comp) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >= __gnu_parallel::_Settings::get().partial_sort_minimal_n)) __gnu_parallel:: __parallel_partial_sort(__begin, __middle, __end, __comp); else partial_sort(__begin, __middle, __end, __comp, __gnu_parallel::sequential_tag()); } // Public interface, insert default comparator template<typename _RAIter> inline void partial_sort(_RAIter __begin, _RAIter __middle, _RAIter __end) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; __gnu_parallel::partial_sort(__begin, __middle, __end, std::less<_ValueType>()); } // Sequential fallback template<typename _FIterator> inline _FIterator max_element(_FIterator __begin, _FIterator __end, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::max_element(__begin, __end); } // Sequential fallback template<typename _FIterator, typename _Compare> inline _FIterator max_element(_FIterator __begin, _FIterator __end, _Compare __comp, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::max_element(__begin, __end, __comp); } // Sequential fallback for input iterator case template<typename _FIterator, typename _Compare, typename _IteratorTag> inline _FIterator __max_element_switch(_FIterator __begin, _FIterator __end, _Compare __comp, _IteratorTag) { return max_element(__begin, __end, __comp, __gnu_parallel::sequential_tag()); } // Parallel algorithm for random access iterators template<typename _RAIter, typename _Compare> _RAIter __max_element_switch(_RAIter __begin, _RAIter __end, _Compare __comp, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism_tag = __gnu_parallel::parallel_balanced) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >= __gnu_parallel::_Settings::get().max_element_minimal_n && __gnu_parallel::__is_parallel(__parallelism_tag))) { _RAIter __res(__begin); __gnu_parallel::__identity_selector<_RAIter> __functionality; __gnu_parallel:: __for_each_template_random_access( __begin, __end, __gnu_parallel::_Nothing(), __functionality, __gnu_parallel::__max_element_reduct<_Compare, _RAIter>(__comp), __res, __res, -1, __parallelism_tag); return __res; } else return max_element(__begin, __end, __comp, __gnu_parallel::sequential_tag()); } // Public interface, insert default comparator template<typename _FIterator> inline _FIterator max_element(_FIterator __begin, _FIterator __end, __gnu_parallel::_Parallelism __parallelism_tag) { typedef typename iterator_traits<_FIterator>::value_type _ValueType; return max_element(__begin, __end, std::less<_ValueType>(), __parallelism_tag); } template<typename _FIterator> inline _FIterator max_element(_FIterator __begin, _FIterator __end) { typedef typename iterator_traits<_FIterator>::value_type _ValueType; return __gnu_parallel::max_element(__begin, __end, std::less<_ValueType>()); } // Public interface template<typename _FIterator, typename _Compare> inline _FIterator max_element(_FIterator __begin, _FIterator __end, _Compare __comp, __gnu_parallel::_Parallelism __parallelism_tag) { typedef iterator_traits<_FIterator> _TraitsType; typedef typename _TraitsType::iterator_category _IteratorCategory; return __max_element_switch(__begin, __end, __comp, _IteratorCategory(), __parallelism_tag); } template<typename _FIterator, typename _Compare> inline _FIterator max_element(_FIterator __begin, _FIterator __end, _Compare __comp) { typedef iterator_traits<_FIterator> _TraitsType; typedef typename _TraitsType::iterator_category _IteratorCategory; return __max_element_switch(__begin, __end, __comp, _IteratorCategory()); } // Sequential fallback template<typename _FIterator> inline _FIterator min_element(_FIterator __begin, _FIterator __end, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::min_element(__begin, __end); } // Sequential fallback template<typename _FIterator, typename _Compare> inline _FIterator min_element(_FIterator __begin, _FIterator __end, _Compare __comp, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::min_element(__begin, __end, __comp); } // Sequential fallback for input iterator case template<typename _FIterator, typename _Compare, typename _IteratorTag> inline _FIterator __min_element_switch(_FIterator __begin, _FIterator __end, _Compare __comp, _IteratorTag) { return min_element(__begin, __end, __comp, __gnu_parallel::sequential_tag()); } // Parallel algorithm for random access iterators template<typename _RAIter, typename _Compare> _RAIter __min_element_switch(_RAIter __begin, _RAIter __end, _Compare __comp, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism_tag = __gnu_parallel::parallel_balanced) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >= __gnu_parallel::_Settings::get().min_element_minimal_n && __gnu_parallel::__is_parallel(__parallelism_tag))) { _RAIter __res(__begin); __gnu_parallel::__identity_selector<_RAIter> __functionality; __gnu_parallel:: __for_each_template_random_access( __begin, __end, __gnu_parallel::_Nothing(), __functionality, __gnu_parallel::__min_element_reduct<_Compare, _RAIter>(__comp), __res, __res, -1, __parallelism_tag); return __res; } else return min_element(__begin, __end, __comp, __gnu_parallel::sequential_tag()); } // Public interface, insert default comparator template<typename _FIterator> inline _FIterator min_element(_FIterator __begin, _FIterator __end, __gnu_parallel::_Parallelism __parallelism_tag) { typedef typename iterator_traits<_FIterator>::value_type _ValueType; return min_element(__begin, __end, std::less<_ValueType>(), __parallelism_tag); } template<typename _FIterator> inline _FIterator min_element(_FIterator __begin, _FIterator __end) { typedef typename iterator_traits<_FIterator>::value_type _ValueType; return __gnu_parallel::min_element(__begin, __end, std::less<_ValueType>()); } // Public interface template<typename _FIterator, typename _Compare> inline _FIterator min_element(_FIterator __begin, _FIterator __end, _Compare __comp, __gnu_parallel::_Parallelism __parallelism_tag) { typedef iterator_traits<_FIterator> _TraitsType; typedef typename _TraitsType::iterator_category _IteratorCategory; return __min_element_switch(__begin, __end, __comp, _IteratorCategory(), __parallelism_tag); } template<typename _FIterator, typename _Compare> inline _FIterator min_element(_FIterator __begin, _FIterator __end, _Compare __comp) { typedef iterator_traits<_FIterator> _TraitsType; typedef typename _TraitsType::iterator_category _IteratorCategory; return __min_element_switch(__begin, __end, __comp, _IteratorCategory()); } } // end namespace } // end namespace #endif /* _GLIBCXX_PARALLEL_ALGO_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/features.h�����������������������������������������������������������������������0000644�����������������00000006727�14763166027�0011400 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/features.h * @brief Defines on whether to include algorithm variants. * * Less variants reduce executable size and compile time. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler. #ifndef _GLIBCXX_PARALLEL_FEATURES_H #define _GLIBCXX_PARALLEL_FEATURES_H 1 #ifndef _GLIBCXX_MERGESORT /** @def _GLIBCXX_MERGESORT * @brief Include parallel multi-way mergesort. * @see __gnu_parallel::_Settings::sort_algorithm */ #define _GLIBCXX_MERGESORT 1 #endif #ifndef _GLIBCXX_QUICKSORT /** @def _GLIBCXX_QUICKSORT * @brief Include parallel unbalanced quicksort. * @see __gnu_parallel::_Settings::sort_algorithm */ #define _GLIBCXX_QUICKSORT 1 #endif #ifndef _GLIBCXX_BAL_QUICKSORT /** @def _GLIBCXX_BAL_QUICKSORT * @brief Include parallel dynamically load-balanced quicksort. * @see __gnu_parallel::_Settings::sort_algorithm */ #define _GLIBCXX_BAL_QUICKSORT 1 #endif #ifndef _GLIBCXX_FIND_GROWING_BLOCKS /** @brief Include the growing blocks variant for std::find. * @see __gnu_parallel::_Settings::find_algorithm */ #define _GLIBCXX_FIND_GROWING_BLOCKS 1 #endif #ifndef _GLIBCXX_FIND_CONSTANT_SIZE_BLOCKS /** @brief Include the equal-sized blocks variant for std::find. * @see __gnu_parallel::_Settings::find_algorithm */ #define _GLIBCXX_FIND_CONSTANT_SIZE_BLOCKS 1 #endif #ifndef _GLIBCXX_FIND_EQUAL_SPLIT /** @def _GLIBCXX_FIND_EQUAL_SPLIT * @brief Include the equal splitting variant for std::find. * @see __gnu_parallel::_Settings::find_algorithm */ #define _GLIBCXX_FIND_EQUAL_SPLIT 1 #endif #ifndef _GLIBCXX_TREE_INITIAL_SPLITTING /** @def _GLIBCXX_TREE_INITIAL_SPLITTING * @brief Include the initial splitting variant for * _Rb_tree::insert_unique(_IIter beg, _IIter __end). * @see __gnu_parallel::_Rb_tree */ #define _GLIBCXX_TREE_INITIAL_SPLITTING 1 #endif #ifndef _GLIBCXX_TREE_DYNAMIC_BALANCING /** @def _GLIBCXX_TREE_DYNAMIC_BALANCING * @brief Include the dynamic balancing variant for * _Rb_tree::insert_unique(_IIter beg, _IIter __end). * @see __gnu_parallel::_Rb_tree */ #define _GLIBCXX_TREE_DYNAMIC_BALANCING 1 #endif #ifndef _GLIBCXX_TREE_FULL_COPY /** @def _GLIBCXX_TREE_FULL_COPY * @brief In order to sort the input sequence of * _Rb_tree::insert_unique(_IIter beg, _IIter __end) a * full copy of the input elements is done. * @see __gnu_parallel::_Rb_tree */ #define _GLIBCXX_TREE_FULL_COPY 1 #endif #endif /* _GLIBCXX_PARALLEL_FEATURES_H */ �����������������������������������������c++/4.8.2/parallel/multiway_mergesort.h�������������������������������������������������������������0000644�����������������00000035647�14763166027�0013527 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/multiway_mergesort.h * @brief Parallel multiway merge sort. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler. #ifndef _GLIBCXX_PARALLEL_MULTIWAY_MERGESORT_H #define _GLIBCXX_PARALLEL_MULTIWAY_MERGESORT_H 1 #include <vector> #include <parallel/basic_iterator.h> #include <bits/stl_algo.h> #include <parallel/parallel.h> #include <parallel/multiway_merge.h> namespace __gnu_parallel { /** @brief Subsequence description. */ template<typename _DifferenceTp> struct _Piece { typedef _DifferenceTp _DifferenceType; /** @brief Begin of subsequence. */ _DifferenceType _M_begin; /** @brief End of subsequence. */ _DifferenceType _M_end; }; /** @brief Data accessed by all threads. * * PMWMS = parallel multiway mergesort */ template<typename _RAIter> struct _PMWMSSortingData { typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; /** @brief Number of threads involved. */ _ThreadIndex _M_num_threads; /** @brief Input __begin. */ _RAIter _M_source; /** @brief Start indices, per thread. */ _DifferenceType* _M_starts; /** @brief Storage in which to sort. */ _ValueType** _M_temporary; /** @brief Samples. */ _ValueType* _M_samples; /** @brief Offsets to add to the found positions. */ _DifferenceType* _M_offsets; /** @brief Pieces of data to merge @c [thread][__sequence] */ std::vector<_Piece<_DifferenceType> >* _M_pieces; }; /** * @brief Select _M_samples from a sequence. * @param __sd Pointer to algorithm data. _Result will be placed in * @c __sd->_M_samples. * @param __num_samples Number of _M_samples to select. */ template<typename _RAIter, typename _DifferenceTp> void __determine_samples(_PMWMSSortingData<_RAIter>* __sd, _DifferenceTp __num_samples) { typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef _DifferenceTp _DifferenceType; _ThreadIndex __iam = omp_get_thread_num(); _DifferenceType* __es = new _DifferenceType[__num_samples + 2]; __equally_split(__sd->_M_starts[__iam + 1] - __sd->_M_starts[__iam], __num_samples + 1, __es); for (_DifferenceType __i = 0; __i < __num_samples; ++__i) ::new(&(__sd->_M_samples[__iam * __num_samples + __i])) _ValueType(__sd->_M_source[__sd->_M_starts[__iam] + __es[__i + 1]]); delete[] __es; } /** @brief Split consistently. */ template<bool __exact, typename _RAIter, typename _Compare, typename _SortingPlacesIterator> struct _SplitConsistently { }; /** @brief Split by exact splitting. */ template<typename _RAIter, typename _Compare, typename _SortingPlacesIterator> struct _SplitConsistently<true, _RAIter, _Compare, _SortingPlacesIterator> { void operator()(const _ThreadIndex __iam, _PMWMSSortingData<_RAIter>* __sd, _Compare& __comp, const typename std::iterator_traits<_RAIter>::difference_type __num_samples) const { # pragma omp barrier std::vector<std::pair<_SortingPlacesIterator, _SortingPlacesIterator> > __seqs(__sd->_M_num_threads); for (_ThreadIndex __s = 0; __s < __sd->_M_num_threads; __s++) __seqs[__s] = std::make_pair(__sd->_M_temporary[__s], __sd->_M_temporary[__s] + (__sd->_M_starts[__s + 1] - __sd->_M_starts[__s])); std::vector<_SortingPlacesIterator> __offsets(__sd->_M_num_threads); // if not last thread if (__iam < __sd->_M_num_threads - 1) multiseq_partition(__seqs.begin(), __seqs.end(), __sd->_M_starts[__iam + 1], __offsets.begin(), __comp); for (_ThreadIndex __seq = 0; __seq < __sd->_M_num_threads; __seq++) { // for each sequence if (__iam < (__sd->_M_num_threads - 1)) __sd->_M_pieces[__iam][__seq]._M_end = __offsets[__seq] - __seqs[__seq].first; else // very end of this sequence __sd->_M_pieces[__iam][__seq]._M_end = __sd->_M_starts[__seq + 1] - __sd->_M_starts[__seq]; } # pragma omp barrier for (_ThreadIndex __seq = 0; __seq < __sd->_M_num_threads; __seq++) { // For each sequence. if (__iam > 0) __sd->_M_pieces[__iam][__seq]._M_begin = __sd->_M_pieces[__iam - 1][__seq]._M_end; else // Absolute beginning. __sd->_M_pieces[__iam][__seq]._M_begin = 0; } } }; /** @brief Split by sampling. */ template<typename _RAIter, typename _Compare, typename _SortingPlacesIterator> struct _SplitConsistently<false, _RAIter, _Compare, _SortingPlacesIterator> { void operator()(const _ThreadIndex __iam, _PMWMSSortingData<_RAIter>* __sd, _Compare& __comp, const typename std::iterator_traits<_RAIter>::difference_type __num_samples) const { typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; __determine_samples(__sd, __num_samples); # pragma omp barrier # pragma omp single __gnu_sequential::sort(__sd->_M_samples, __sd->_M_samples + (__num_samples * __sd->_M_num_threads), __comp); # pragma omp barrier for (_ThreadIndex __s = 0; __s < __sd->_M_num_threads; ++__s) { // For each sequence. if (__num_samples * __iam > 0) __sd->_M_pieces[__iam][__s]._M_begin = std::lower_bound(__sd->_M_temporary[__s], __sd->_M_temporary[__s] + (__sd->_M_starts[__s + 1] - __sd->_M_starts[__s]), __sd->_M_samples[__num_samples * __iam], __comp) - __sd->_M_temporary[__s]; else // Absolute beginning. __sd->_M_pieces[__iam][__s]._M_begin = 0; if ((__num_samples * (__iam + 1)) < (__num_samples * __sd->_M_num_threads)) __sd->_M_pieces[__iam][__s]._M_end = std::lower_bound(__sd->_M_temporary[__s], __sd->_M_temporary[__s] + (__sd->_M_starts[__s + 1] - __sd->_M_starts[__s]), __sd->_M_samples[__num_samples * (__iam + 1)], __comp) - __sd->_M_temporary[__s]; else // Absolute end. __sd->_M_pieces[__iam][__s]._M_end = (__sd->_M_starts[__s + 1] - __sd->_M_starts[__s]); } } }; template<bool __stable, typename _RAIter, typename _Compare> struct __possibly_stable_sort { }; template<typename _RAIter, typename _Compare> struct __possibly_stable_sort<true, _RAIter, _Compare> { void operator()(const _RAIter& __begin, const _RAIter& __end, _Compare& __comp) const { __gnu_sequential::stable_sort(__begin, __end, __comp); } }; template<typename _RAIter, typename _Compare> struct __possibly_stable_sort<false, _RAIter, _Compare> { void operator()(const _RAIter __begin, const _RAIter __end, _Compare& __comp) const { __gnu_sequential::sort(__begin, __end, __comp); } }; template<bool __stable, typename Seq_RAIter, typename _RAIter, typename _Compare, typename DiffType> struct __possibly_stable_multiway_merge { }; template<typename Seq_RAIter, typename _RAIter, typename _Compare, typename _DiffType> struct __possibly_stable_multiway_merge<true, Seq_RAIter, _RAIter, _Compare, _DiffType> { void operator()(const Seq_RAIter& __seqs_begin, const Seq_RAIter& __seqs_end, const _RAIter& __target, _Compare& __comp, _DiffType __length_am) const { stable_multiway_merge(__seqs_begin, __seqs_end, __target, __length_am, __comp, sequential_tag()); } }; template<typename Seq_RAIter, typename _RAIter, typename _Compare, typename _DiffType> struct __possibly_stable_multiway_merge<false, Seq_RAIter, _RAIter, _Compare, _DiffType> { void operator()(const Seq_RAIter& __seqs_begin, const Seq_RAIter& __seqs_end, const _RAIter& __target, _Compare& __comp, _DiffType __length_am) const { multiway_merge(__seqs_begin, __seqs_end, __target, __length_am, __comp, sequential_tag()); } }; /** @brief PMWMS code executed by each thread. * @param __sd Pointer to algorithm data. * @param __comp Comparator. */ template<bool __stable, bool __exact, typename _RAIter, typename _Compare> void parallel_sort_mwms_pu(_PMWMSSortingData<_RAIter>* __sd, _Compare& __comp) { typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; _ThreadIndex __iam = omp_get_thread_num(); // Length of this thread's chunk, before merging. _DifferenceType __length_local = __sd->_M_starts[__iam + 1] - __sd->_M_starts[__iam]; // Sort in temporary storage, leave space for sentinel. typedef _ValueType* _SortingPlacesIterator; __sd->_M_temporary[__iam] = static_cast<_ValueType*>(::operator new(sizeof(_ValueType) * (__length_local + 1))); // Copy there. std::uninitialized_copy(__sd->_M_source + __sd->_M_starts[__iam], __sd->_M_source + __sd->_M_starts[__iam] + __length_local, __sd->_M_temporary[__iam]); __possibly_stable_sort<__stable, _SortingPlacesIterator, _Compare>() (__sd->_M_temporary[__iam], __sd->_M_temporary[__iam] + __length_local, __comp); // Invariant: locally sorted subsequence in sd->_M_temporary[__iam], // __sd->_M_temporary[__iam] + __length_local. // No barrier here: Synchronization is done by the splitting routine. _DifferenceType __num_samples = _Settings::get().sort_mwms_oversampling * __sd->_M_num_threads - 1; _SplitConsistently<__exact, _RAIter, _Compare, _SortingPlacesIterator>() (__iam, __sd, __comp, __num_samples); // Offset from __target __begin, __length after merging. _DifferenceType __offset = 0, __length_am = 0; for (_ThreadIndex __s = 0; __s < __sd->_M_num_threads; __s++) { __length_am += (__sd->_M_pieces[__iam][__s]._M_end - __sd->_M_pieces[__iam][__s]._M_begin); __offset += __sd->_M_pieces[__iam][__s]._M_begin; } typedef std::vector< std::pair<_SortingPlacesIterator, _SortingPlacesIterator> > _SeqVector; _SeqVector __seqs(__sd->_M_num_threads); for (_ThreadIndex __s = 0; __s < __sd->_M_num_threads; ++__s) { __seqs[__s] = std::make_pair(__sd->_M_temporary[__s] + __sd->_M_pieces[__iam][__s]._M_begin, __sd->_M_temporary[__s] + __sd->_M_pieces[__iam][__s]._M_end); } __possibly_stable_multiway_merge< __stable, typename _SeqVector::iterator, _RAIter, _Compare, _DifferenceType>()(__seqs.begin(), __seqs.end(), __sd->_M_source + __offset, __comp, __length_am); # pragma omp barrier for (_DifferenceType __i = 0; __i < __length_local; ++__i) __sd->_M_temporary[__iam][__i].~_ValueType(); ::operator delete(__sd->_M_temporary[__iam]); } /** @brief PMWMS main call. * @param __begin Begin iterator of sequence. * @param __end End iterator of sequence. * @param __comp Comparator. * @param __num_threads Number of threads to use. */ template<bool __stable, bool __exact, typename _RAIter, typename _Compare> void parallel_sort_mwms(_RAIter __begin, _RAIter __end, _Compare __comp, _ThreadIndex __num_threads) { _GLIBCXX_CALL(__end - __begin) typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; _DifferenceType __n = __end - __begin; if (__n <= 1) return; // at least one element per thread if (__num_threads > __n) __num_threads = static_cast<_ThreadIndex>(__n); // shared variables _PMWMSSortingData<_RAIter> __sd; _DifferenceType* __starts; _DifferenceType __size; # pragma omp parallel num_threads(__num_threads) { __num_threads = omp_get_num_threads(); //no more threads than requested # pragma omp single { __sd._M_num_threads = __num_threads; __sd._M_source = __begin; __sd._M_temporary = new _ValueType*[__num_threads]; if (!__exact) { __size = (_Settings::get().sort_mwms_oversampling * __num_threads - 1) * __num_threads; __sd._M_samples = static_cast<_ValueType*> (::operator new(__size * sizeof(_ValueType))); } else __sd._M_samples = 0; __sd._M_offsets = new _DifferenceType[__num_threads - 1]; __sd._M_pieces = new std::vector<_Piece<_DifferenceType> >[__num_threads]; for (_ThreadIndex __s = 0; __s < __num_threads; ++__s) __sd._M_pieces[__s].resize(__num_threads); __starts = __sd._M_starts = new _DifferenceType[__num_threads + 1]; _DifferenceType __chunk_length = __n / __num_threads; _DifferenceType __split = __n % __num_threads; _DifferenceType __pos = 0; for (_ThreadIndex __i = 0; __i < __num_threads; ++__i) { __starts[__i] = __pos; __pos += ((__i < __split) ? (__chunk_length + 1) : __chunk_length); } __starts[__num_threads] = __pos; } //single // Now sort in parallel. parallel_sort_mwms_pu<__stable, __exact>(&__sd, __comp); } //parallel delete[] __starts; delete[] __sd._M_temporary; if (!__exact) { for (_DifferenceType __i = 0; __i < __size; ++__i) __sd._M_samples[__i].~_ValueType(); ::operator delete(__sd._M_samples); } delete[] __sd._M_offsets; delete[] __sd._M_pieces; } } //namespace __gnu_parallel #endif /* _GLIBCXX_PARALLEL_MULTIWAY_MERGESORT_H */ �����������������������������������������������������������������������������������������c++/4.8.2/parallel/partition.h����������������������������������������������������������������������0000644�����������������00000035126�14763166027�0011566 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/partition.h * @brief Parallel implementation of std::partition(), * std::nth_element(), and std::partial_sort(). * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler and Felix Putze. #ifndef _GLIBCXX_PARALLEL_PARTITION_H #define _GLIBCXX_PARALLEL_PARTITION_H 1 #include <parallel/basic_iterator.h> #include <parallel/sort.h> #include <parallel/random_number.h> #include <bits/stl_algo.h> #include <parallel/parallel.h> /** @brief Decide whether to declare certain variables volatile. */ #define _GLIBCXX_VOLATILE volatile namespace __gnu_parallel { /** @brief Parallel implementation of std::partition. * @param __begin Begin iterator of input sequence to split. * @param __end End iterator of input sequence to split. * @param __pred Partition predicate, possibly including some kind * of pivot. * @param __num_threads Maximum number of threads to use for this task. * @return Number of elements not fulfilling the predicate. */ template<typename _RAIter, typename _Predicate> typename std::iterator_traits<_RAIter>::difference_type __parallel_partition(_RAIter __begin, _RAIter __end, _Predicate __pred, _ThreadIndex __num_threads) { typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; _DifferenceType __n = __end - __begin; _GLIBCXX_CALL(__n) const _Settings& __s = _Settings::get(); // shared _GLIBCXX_VOLATILE _DifferenceType __left = 0, __right = __n - 1, __dist = __n, __leftover_left, __leftover_right, __leftnew, __rightnew; // just 0 or 1, but int to allow atomic operations int* __reserved_left = 0, * __reserved_right = 0; _DifferenceType __chunk_size = __s.partition_chunk_size; //at least two chunks per thread if (__dist >= 2 * __num_threads * __chunk_size) # pragma omp parallel num_threads(__num_threads) { # pragma omp single { __num_threads = omp_get_num_threads(); __reserved_left = new int[__num_threads]; __reserved_right = new int[__num_threads]; if (__s.partition_chunk_share > 0.0) __chunk_size = std::max<_DifferenceType> (__s.partition_chunk_size, (double)__n * __s.partition_chunk_share / (double)__num_threads); else __chunk_size = __s.partition_chunk_size; } while (__dist >= 2 * __num_threads * __chunk_size) { # pragma omp single { _DifferenceType __num_chunks = __dist / __chunk_size; for (_ThreadIndex __r = 0; __r < __num_threads; ++__r) { __reserved_left [__r] = 0; // false __reserved_right[__r] = 0; // false } __leftover_left = 0; __leftover_right = 0; } //implicit barrier // Private. _DifferenceType __thread_left, __thread_left_border, __thread_right, __thread_right_border; __thread_left = __left + 1; // Just to satisfy the condition below. __thread_left_border = __thread_left - 1; __thread_right = __n - 1; // Just to satisfy the condition below. __thread_right_border = __thread_right + 1; bool __iam_finished = false; while (!__iam_finished) { if (__thread_left > __thread_left_border) { _DifferenceType __former_dist = __fetch_and_add(&__dist, -__chunk_size); if (__former_dist < __chunk_size) { __fetch_and_add(&__dist, __chunk_size); __iam_finished = true; break; } else { __thread_left = __fetch_and_add(&__left, __chunk_size); __thread_left_border = __thread_left + (__chunk_size - 1); } } if (__thread_right < __thread_right_border) { _DifferenceType __former_dist = __fetch_and_add(&__dist, -__chunk_size); if (__former_dist < __chunk_size) { __fetch_and_add(&__dist, __chunk_size); __iam_finished = true; break; } else { __thread_right = __fetch_and_add(&__right, -__chunk_size); __thread_right_border = __thread_right - (__chunk_size - 1); } } // Swap as usual. while (__thread_left < __thread_right) { while (__pred(__begin[__thread_left]) && __thread_left <= __thread_left_border) ++__thread_left; while (!__pred(__begin[__thread_right]) && __thread_right >= __thread_right_border) --__thread_right; if (__thread_left > __thread_left_border || __thread_right < __thread_right_border) // Fetch new chunk(__s). break; std::iter_swap(__begin + __thread_left, __begin + __thread_right); ++__thread_left; --__thread_right; } } // Now swap the leftover chunks to the right places. if (__thread_left <= __thread_left_border) # pragma omp atomic ++__leftover_left; if (__thread_right >= __thread_right_border) # pragma omp atomic ++__leftover_right; # pragma omp barrier _DifferenceType __leftold = __left, __leftnew = __left - __leftover_left * __chunk_size, __rightold = __right, __rightnew = __right + __leftover_right * __chunk_size; // <=> __thread_left_border + (__chunk_size - 1) >= __leftnew if (__thread_left <= __thread_left_border && __thread_left_border >= __leftnew) { // Chunk already in place, reserve spot. __reserved_left[(__left - (__thread_left_border + 1)) / __chunk_size] = 1; } // <=> __thread_right_border - (__chunk_size - 1) <= __rightnew if (__thread_right >= __thread_right_border && __thread_right_border <= __rightnew) { // Chunk already in place, reserve spot. __reserved_right[((__thread_right_border - 1) - __right) / __chunk_size] = 1; } # pragma omp barrier if (__thread_left <= __thread_left_border && __thread_left_border < __leftnew) { // Find spot and swap. _DifferenceType __swapstart = -1; for (int __r = 0; __r < __leftover_left; ++__r) if (__reserved_left[__r] == 0 && __compare_and_swap(&(__reserved_left[__r]), 0, 1)) { __swapstart = __leftold - (__r + 1) * __chunk_size; break; } #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT(__swapstart != -1); #endif std::swap_ranges(__begin + __thread_left_border - (__chunk_size - 1), __begin + __thread_left_border + 1, __begin + __swapstart); } if (__thread_right >= __thread_right_border && __thread_right_border > __rightnew) { // Find spot and swap _DifferenceType __swapstart = -1; for (int __r = 0; __r < __leftover_right; ++__r) if (__reserved_right[__r] == 0 && __compare_and_swap(&(__reserved_right[__r]), 0, 1)) { __swapstart = __rightold + __r * __chunk_size + 1; break; } #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT(__swapstart != -1); #endif std::swap_ranges(__begin + __thread_right_border, __begin + __thread_right_border + __chunk_size, __begin + __swapstart); } #if _GLIBCXX_ASSERTIONS # pragma omp barrier # pragma omp single { for (_DifferenceType __r = 0; __r < __leftover_left; ++__r) _GLIBCXX_PARALLEL_ASSERT(__reserved_left[__r] == 1); for (_DifferenceType __r = 0; __r < __leftover_right; ++__r) _GLIBCXX_PARALLEL_ASSERT(__reserved_right[__r] == 1); } #endif __left = __leftnew; __right = __rightnew; __dist = __right - __left + 1; } # pragma omp flush(__left, __right) } // end "recursion" //parallel _DifferenceType __final_left = __left, __final_right = __right; while (__final_left < __final_right) { // Go right until key is geq than pivot. while (__pred(__begin[__final_left]) && __final_left < __final_right) ++__final_left; // Go left until key is less than pivot. while (!__pred(__begin[__final_right]) && __final_left < __final_right) --__final_right; if (__final_left == __final_right) break; std::iter_swap(__begin + __final_left, __begin + __final_right); ++__final_left; --__final_right; } // All elements on the left side are < piv, all elements on the // right are >= piv delete[] __reserved_left; delete[] __reserved_right; // Element "between" __final_left and __final_right might not have // been regarded yet if (__final_left < __n && !__pred(__begin[__final_left])) // Really swapped. return __final_left; else return __final_left + 1; } /** * @brief Parallel implementation of std::nth_element(). * @param __begin Begin iterator of input sequence. * @param __nth _Iterator of element that must be in position afterwards. * @param __end End iterator of input sequence. * @param __comp Comparator. */ template<typename _RAIter, typename _Compare> void __parallel_nth_element(_RAIter __begin, _RAIter __nth, _RAIter __end, _Compare __comp) { typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; _GLIBCXX_CALL(__end - __begin) _RAIter __split; _RandomNumber __rng; const _Settings& __s = _Settings::get(); _DifferenceType __minimum_length = std::max<_DifferenceType>(2, std::max(__s.nth_element_minimal_n, __s.partition_minimal_n)); // Break if input range to small. while (static_cast<_SequenceIndex>(__end - __begin) >= __minimum_length) { _DifferenceType __n = __end - __begin; _RAIter __pivot_pos = __begin + __rng(__n); // Swap __pivot_pos value to end. if (__pivot_pos != (__end - 1)) std::iter_swap(__pivot_pos, __end - 1); __pivot_pos = __end - 1; // _Compare must have first_value_type, second_value_type, // result_type // _Compare == // __gnu_parallel::_Lexicographic<S, int, // __gnu_parallel::_Less<S, S> > // __pivot_pos == std::pair<S, int>* __gnu_parallel::__binder2nd<_Compare, _ValueType, _ValueType, bool> __pred(__comp, *__pivot_pos); // Divide, leave pivot unchanged in last place. _RAIter __split_pos1, __split_pos2; __split_pos1 = __begin + __parallel_partition(__begin, __end - 1, __pred, __get_max_threads()); // Left side: < __pivot_pos; __right side: >= __pivot_pos // Swap pivot back to middle. if (__split_pos1 != __pivot_pos) std::iter_swap(__split_pos1, __pivot_pos); __pivot_pos = __split_pos1; // In case all elements are equal, __split_pos1 == 0 if ((__split_pos1 + 1 - __begin) < (__n >> 7) || (__end - __split_pos1) < (__n >> 7)) { // Very unequal split, one part smaller than one 128th // elements not strictly larger than the pivot. __gnu_parallel::__unary_negate<__gnu_parallel:: __binder1st<_Compare, _ValueType, _ValueType, bool>, _ValueType> __pred(__gnu_parallel::__binder1st<_Compare, _ValueType, _ValueType, bool>(__comp, *__pivot_pos)); // Find other end of pivot-equal range. __split_pos2 = __gnu_sequential::partition(__split_pos1 + 1, __end, __pred); } else // Only skip the pivot. __split_pos2 = __split_pos1 + 1; // Compare iterators. if (__split_pos2 <= __nth) __begin = __split_pos2; else if (__nth < __split_pos1) __end = __split_pos1; else break; } // Only at most _Settings::partition_minimal_n __elements __left. __gnu_sequential::nth_element(__begin, __nth, __end, __comp); } /** @brief Parallel implementation of std::partial_sort(). * @param __begin Begin iterator of input sequence. * @param __middle Sort until this position. * @param __end End iterator of input sequence. * @param __comp Comparator. */ template<typename _RAIter, typename _Compare> void __parallel_partial_sort(_RAIter __begin, _RAIter __middle, _RAIter __end, _Compare __comp) { __parallel_nth_element(__begin, __middle, __end, __comp); std::sort(__begin, __middle, __comp); } } //namespace __gnu_parallel #undef _GLIBCXX_VOLATILE #endif /* _GLIBCXX_PARALLEL_PARTITION_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/numeric��������������������������������������������������������������������������0000644�����������������00000050600�14763166027�0010763 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** * @file parallel/numeric * * @brief Parallel STL function calls corresponding to stl_numeric.h. * The functions defined here mainly do case switches and * call the actual parallelized versions in other files. * Inlining policy: Functions that basically only contain one function call, * are declared inline. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler and Felix Putze. #ifndef _GLIBCXX_PARALLEL_NUMERIC_H #define _GLIBCXX_PARALLEL_NUMERIC_H 1 #include <numeric> #include <bits/stl_function.h> #include <parallel/numericfwd.h> #include <parallel/iterator.h> #include <parallel/for_each.h> #include <parallel/for_each_selectors.h> #include <parallel/partial_sum.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace __parallel { // Sequential fallback. template<typename _IIter, typename _Tp> inline _Tp accumulate(_IIter __begin, _IIter __end, _Tp __init, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::accumulate(__begin, __end, __init); } template<typename _IIter, typename _Tp, typename _BinaryOperation> inline _Tp accumulate(_IIter __begin, _IIter __end, _Tp __init, _BinaryOperation __binary_op, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::accumulate(__begin, __end, __init, __binary_op); } // Sequential fallback for input iterator case. template<typename _IIter, typename _Tp, typename _IteratorTag> inline _Tp __accumulate_switch(_IIter __begin, _IIter __end, _Tp __init, _IteratorTag) { return accumulate(__begin, __end, __init, __gnu_parallel::sequential_tag()); } template<typename _IIter, typename _Tp, typename _BinaryOperation, typename _IteratorTag> inline _Tp __accumulate_switch(_IIter __begin, _IIter __end, _Tp __init, _BinaryOperation __binary_op, _IteratorTag) { return accumulate(__begin, __end, __init, __binary_op, __gnu_parallel::sequential_tag()); } // Parallel algorithm for random access iterators. template<typename __RAIter, typename _Tp, typename _BinaryOperation> _Tp __accumulate_switch(__RAIter __begin, __RAIter __end, _Tp __init, _BinaryOperation __binary_op, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism_tag = __gnu_parallel::parallel_unbalanced) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >= __gnu_parallel::_Settings::get().accumulate_minimal_n && __gnu_parallel::__is_parallel(__parallelism_tag))) { _Tp __res = __init; __gnu_parallel::__accumulate_selector<__RAIter> __my_selector; __gnu_parallel:: __for_each_template_random_access_ed(__begin, __end, __gnu_parallel::_Nothing(), __my_selector, __gnu_parallel:: __accumulate_binop_reduct <_BinaryOperation>(__binary_op), __res, __res, -1); return __res; } else return accumulate(__begin, __end, __init, __binary_op, __gnu_parallel::sequential_tag()); } // Public interface. template<typename _IIter, typename _Tp> inline _Tp accumulate(_IIter __begin, _IIter __end, _Tp __init, __gnu_parallel::_Parallelism __parallelism_tag) { typedef std::iterator_traits<_IIter> _IteratorTraits; typedef typename _IteratorTraits::value_type _ValueType; typedef typename _IteratorTraits::iterator_category _IteratorCategory; return __accumulate_switch(__begin, __end, __init, __gnu_parallel::_Plus<_Tp, _ValueType>(), _IteratorCategory(), __parallelism_tag); } template<typename _IIter, typename _Tp> inline _Tp accumulate(_IIter __begin, _IIter __end, _Tp __init) { typedef std::iterator_traits<_IIter> _IteratorTraits; typedef typename _IteratorTraits::value_type _ValueType; typedef typename _IteratorTraits::iterator_category _IteratorCategory; return __accumulate_switch(__begin, __end, __init, __gnu_parallel::_Plus<_Tp, _ValueType>(), _IteratorCategory()); } template<typename _IIter, typename _Tp, typename _BinaryOperation> inline _Tp accumulate(_IIter __begin, _IIter __end, _Tp __init, _BinaryOperation __binary_op, __gnu_parallel::_Parallelism __parallelism_tag) { typedef iterator_traits<_IIter> _IteratorTraits; typedef typename _IteratorTraits::iterator_category _IteratorCategory; return __accumulate_switch(__begin, __end, __init, __binary_op, _IteratorCategory(), __parallelism_tag); } template<typename _IIter, typename _Tp, typename _BinaryOperation> inline _Tp accumulate(_IIter __begin, _IIter __end, _Tp __init, _BinaryOperation __binary_op) { typedef iterator_traits<_IIter> _IteratorTraits; typedef typename _IteratorTraits::iterator_category _IteratorCategory; return __accumulate_switch(__begin, __end, __init, __binary_op, _IteratorCategory()); } // Sequential fallback. template<typename _IIter1, typename _IIter2, typename _Tp> inline _Tp inner_product(_IIter1 __first1, _IIter1 __last1, _IIter2 __first2, _Tp __init, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::inner_product( __first1, __last1, __first2, __init); } template<typename _IIter1, typename _IIter2, typename _Tp, typename _BinaryFunction1, typename _BinaryFunction2> inline _Tp inner_product(_IIter1 __first1, _IIter1 __last1, _IIter2 __first2, _Tp __init, _BinaryFunction1 __binary_op1, _BinaryFunction2 __binary_op2, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::inner_product(__first1, __last1, __first2, __init, __binary_op1, __binary_op2); } // Parallel algorithm for random access iterators. template<typename _RAIter1, typename _RAIter2, typename _Tp, typename _BinaryFunction1, typename _BinaryFunction2> _Tp __inner_product_switch(_RAIter1 __first1, _RAIter1 __last1, _RAIter2 __first2, _Tp __init, _BinaryFunction1 __binary_op1, _BinaryFunction2 __binary_op2, random_access_iterator_tag, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism_tag = __gnu_parallel::parallel_unbalanced) { if (_GLIBCXX_PARALLEL_CONDITION((__last1 - __first1) >= __gnu_parallel::_Settings::get(). accumulate_minimal_n && __gnu_parallel:: __is_parallel(__parallelism_tag))) { _Tp __res = __init; __gnu_parallel:: __inner_product_selector<_RAIter1, _RAIter2, _Tp> __my_selector(__first1, __first2); __gnu_parallel:: __for_each_template_random_access_ed( __first1, __last1, __binary_op2, __my_selector, __binary_op1, __res, __res, -1); return __res; } else return inner_product(__first1, __last1, __first2, __init, __gnu_parallel::sequential_tag()); } // No parallelism for input iterators. template<typename _IIter1, typename _IIter2, typename _Tp, typename _BinaryFunction1, typename _BinaryFunction2, typename _IteratorTag1, typename _IteratorTag2> inline _Tp __inner_product_switch(_IIter1 __first1, _IIter1 __last1, _IIter2 __first2, _Tp __init, _BinaryFunction1 __binary_op1, _BinaryFunction2 __binary_op2, _IteratorTag1, _IteratorTag2) { return inner_product(__first1, __last1, __first2, __init, __binary_op1, __binary_op2, __gnu_parallel::sequential_tag()); } template<typename _IIter1, typename _IIter2, typename _Tp, typename _BinaryFunction1, typename _BinaryFunction2> inline _Tp inner_product(_IIter1 __first1, _IIter1 __last1, _IIter2 __first2, _Tp __init, _BinaryFunction1 __binary_op1, _BinaryFunction2 __binary_op2, __gnu_parallel::_Parallelism __parallelism_tag) { typedef iterator_traits<_IIter1> _TraitsType1; typedef typename _TraitsType1::iterator_category _IteratorCategory1; typedef iterator_traits<_IIter2> _TraitsType2; typedef typename _TraitsType2::iterator_category _IteratorCategory2; return __inner_product_switch(__first1, __last1, __first2, __init, __binary_op1, __binary_op2, _IteratorCategory1(), _IteratorCategory2(), __parallelism_tag); } template<typename _IIter1, typename _IIter2, typename _Tp, typename _BinaryFunction1, typename _BinaryFunction2> inline _Tp inner_product(_IIter1 __first1, _IIter1 __last1, _IIter2 __first2, _Tp __init, _BinaryFunction1 __binary_op1, _BinaryFunction2 __binary_op2) { typedef iterator_traits<_IIter1> _TraitsType1; typedef typename _TraitsType1::iterator_category _IteratorCategory1; typedef iterator_traits<_IIter2> _TraitsType2; typedef typename _TraitsType2::iterator_category _IteratorCategory2; return __inner_product_switch(__first1, __last1, __first2, __init, __binary_op1, __binary_op2, _IteratorCategory1(), _IteratorCategory2()); } template<typename _IIter1, typename _IIter2, typename _Tp> inline _Tp inner_product(_IIter1 __first1, _IIter1 __last1, _IIter2 __first2, _Tp __init, __gnu_parallel::_Parallelism __parallelism_tag) { typedef iterator_traits<_IIter1> _TraitsType1; typedef typename _TraitsType1::value_type _ValueType1; typedef iterator_traits<_IIter2> _TraitsType2; typedef typename _TraitsType2::value_type _ValueType2; typedef typename __gnu_parallel::_Multiplies<_ValueType1, _ValueType2>::result_type _MultipliesResultType; return __gnu_parallel::inner_product(__first1, __last1, __first2, __init, __gnu_parallel::_Plus<_Tp, _MultipliesResultType>(), __gnu_parallel:: _Multiplies<_ValueType1, _ValueType2>(), __parallelism_tag); } template<typename _IIter1, typename _IIter2, typename _Tp> inline _Tp inner_product(_IIter1 __first1, _IIter1 __last1, _IIter2 __first2, _Tp __init) { typedef iterator_traits<_IIter1> _TraitsType1; typedef typename _TraitsType1::value_type _ValueType1; typedef iterator_traits<_IIter2> _TraitsType2; typedef typename _TraitsType2::value_type _ValueType2; typedef typename __gnu_parallel::_Multiplies<_ValueType1, _ValueType2>::result_type _MultipliesResultType; return __gnu_parallel::inner_product(__first1, __last1, __first2, __init, __gnu_parallel::_Plus<_Tp, _MultipliesResultType>(), __gnu_parallel:: _Multiplies<_ValueType1, _ValueType2>()); } // Sequential fallback. template<typename _IIter, typename _OutputIterator> inline _OutputIterator partial_sum(_IIter __begin, _IIter __end, _OutputIterator __result, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::partial_sum(__begin, __end, __result); } // Sequential fallback. template<typename _IIter, typename _OutputIterator, typename _BinaryOperation> inline _OutputIterator partial_sum(_IIter __begin, _IIter __end, _OutputIterator __result, _BinaryOperation __bin_op, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::partial_sum(__begin, __end, __result, __bin_op); } // Sequential fallback for input iterator case. template<typename _IIter, typename _OutputIterator, typename _BinaryOperation, typename _IteratorTag1, typename _IteratorTag2> inline _OutputIterator __partial_sum_switch(_IIter __begin, _IIter __end, _OutputIterator __result, _BinaryOperation __bin_op, _IteratorTag1, _IteratorTag2) { return _GLIBCXX_STD_A::partial_sum(__begin, __end, __result, __bin_op); } // Parallel algorithm for random access iterators. template<typename _IIter, typename _OutputIterator, typename _BinaryOperation> _OutputIterator __partial_sum_switch(_IIter __begin, _IIter __end, _OutputIterator __result, _BinaryOperation __bin_op, random_access_iterator_tag, random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >= __gnu_parallel::_Settings::get().partial_sum_minimal_n)) return __gnu_parallel::__parallel_partial_sum(__begin, __end, __result, __bin_op); else return partial_sum(__begin, __end, __result, __bin_op, __gnu_parallel::sequential_tag()); } // Public interface. template<typename _IIter, typename _OutputIterator> inline _OutputIterator partial_sum(_IIter __begin, _IIter __end, _OutputIterator __result) { typedef typename iterator_traits<_IIter>::value_type _ValueType; return __gnu_parallel::partial_sum(__begin, __end, __result, std::plus<_ValueType>()); } // Public interface template<typename _IIter, typename _OutputIterator, typename _BinaryOperation> inline _OutputIterator partial_sum(_IIter __begin, _IIter __end, _OutputIterator __result, _BinaryOperation __binary_op) { typedef iterator_traits<_IIter> _ITraitsType; typedef typename _ITraitsType::iterator_category _IIteratorCategory; typedef iterator_traits<_OutputIterator> _OTraitsType; typedef typename _OTraitsType::iterator_category _OIterCategory; return __partial_sum_switch(__begin, __end, __result, __binary_op, _IIteratorCategory(), _OIterCategory()); } // Sequential fallback. template<typename _IIter, typename _OutputIterator> inline _OutputIterator adjacent_difference(_IIter __begin, _IIter __end, _OutputIterator __result, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::adjacent_difference(__begin, __end, __result); } // Sequential fallback. template<typename _IIter, typename _OutputIterator, typename _BinaryOperation> inline _OutputIterator adjacent_difference(_IIter __begin, _IIter __end, _OutputIterator __result, _BinaryOperation __bin_op, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::adjacent_difference(__begin, __end, __result, __bin_op); } // Sequential fallback for input iterator case. template<typename _IIter, typename _OutputIterator, typename _BinaryOperation, typename _IteratorTag1, typename _IteratorTag2> inline _OutputIterator __adjacent_difference_switch(_IIter __begin, _IIter __end, _OutputIterator __result, _BinaryOperation __bin_op, _IteratorTag1, _IteratorTag2) { return adjacent_difference(__begin, __end, __result, __bin_op, __gnu_parallel::sequential_tag()); } // Parallel algorithm for random access iterators. template<typename _IIter, typename _OutputIterator, typename _BinaryOperation> _OutputIterator __adjacent_difference_switch(_IIter __begin, _IIter __end, _OutputIterator __result, _BinaryOperation __bin_op, random_access_iterator_tag, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism_tag = __gnu_parallel::parallel_balanced) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >= __gnu_parallel::_Settings::get().adjacent_difference_minimal_n && __gnu_parallel::__is_parallel(__parallelism_tag))) { bool __dummy = true; typedef __gnu_parallel::_IteratorPair<_IIter, _OutputIterator, random_access_iterator_tag> _ItTrip; *__result = *__begin; _ItTrip __begin_pair(__begin + 1, __result + 1), __end_pair(__end, __result + (__end - __begin)); __gnu_parallel::__adjacent_difference_selector<_ItTrip> __functionality; __gnu_parallel:: __for_each_template_random_access_ed( __begin_pair, __end_pair, __bin_op, __functionality, __gnu_parallel::_DummyReduct(), __dummy, __dummy, -1); return __functionality._M_finish_iterator; } else return adjacent_difference(__begin, __end, __result, __bin_op, __gnu_parallel::sequential_tag()); } // Public interface. template<typename _IIter, typename _OutputIterator> inline _OutputIterator adjacent_difference(_IIter __begin, _IIter __end, _OutputIterator __result, __gnu_parallel::_Parallelism __parallelism_tag) { typedef iterator_traits<_IIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; return adjacent_difference(__begin, __end, __result, std::minus<_ValueType>(), __parallelism_tag); } template<typename _IIter, typename _OutputIterator> inline _OutputIterator adjacent_difference(_IIter __begin, _IIter __end, _OutputIterator __result) { typedef iterator_traits<_IIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; return adjacent_difference(__begin, __end, __result, std::minus<_ValueType>()); } template<typename _IIter, typename _OutputIterator, typename _BinaryOperation> inline _OutputIterator adjacent_difference(_IIter __begin, _IIter __end, _OutputIterator __result, _BinaryOperation __binary_op, __gnu_parallel::_Parallelism __parallelism_tag) { typedef iterator_traits<_IIter> _ITraitsType; typedef typename _ITraitsType::iterator_category _IIteratorCategory; typedef iterator_traits<_OutputIterator> _OTraitsType; typedef typename _OTraitsType::iterator_category _OIterCategory; return __adjacent_difference_switch(__begin, __end, __result, __binary_op, _IIteratorCategory(), _OIterCategory(), __parallelism_tag); } template<typename _IIter, typename _OutputIterator, typename _BinaryOperation> inline _OutputIterator adjacent_difference(_IIter __begin, _IIter __end, _OutputIterator __result, _BinaryOperation __binary_op) { typedef iterator_traits<_IIter> _ITraitsType; typedef typename _ITraitsType::iterator_category _IIteratorCategory; typedef iterator_traits<_OutputIterator> _OTraitsType; typedef typename _OTraitsType::iterator_category _OIterCategory; return __adjacent_difference_switch(__begin, __end, __result, __binary_op, _IIteratorCategory(), _OIterCategory()); } } // end namespace } // end namespace #endif /* _GLIBCXX_NUMERIC_H */ ��������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/find.h���������������������������������������������������������������������������0000644�����������������00000032427�14763166027�0010476 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/find.h * @brief Parallel implementation base for std::find(), std::equal() * and related functions. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Felix Putze and Johannes Singler. #ifndef _GLIBCXX_PARALLEL_FIND_H #define _GLIBCXX_PARALLEL_FIND_H 1 #include <bits/stl_algobase.h> #include <parallel/features.h> #include <parallel/parallel.h> #include <parallel/compatibility.h> #include <parallel/equally_split.h> namespace __gnu_parallel { /** * @brief Parallel std::find, switch for different algorithms. * @param __begin1 Begin iterator of first sequence. * @param __end1 End iterator of first sequence. * @param __begin2 Begin iterator of second sequence. Must have same * length as first sequence. * @param __pred Find predicate. * @param __selector _Functionality (e. g. std::find_if(), std::equal(),...) * @return Place of finding in both sequences. */ template<typename _RAIter1, typename _RAIter2, typename _Pred, typename _Selector> inline std::pair<_RAIter1, _RAIter2> __find_template(_RAIter1 __begin1, _RAIter1 __end1, _RAIter2 __begin2, _Pred __pred, _Selector __selector) { switch (_Settings::get().find_algorithm) { case GROWING_BLOCKS: return __find_template(__begin1, __end1, __begin2, __pred, __selector, growing_blocks_tag()); case CONSTANT_SIZE_BLOCKS: return __find_template(__begin1, __end1, __begin2, __pred, __selector, constant_size_blocks_tag()); case EQUAL_SPLIT: return __find_template(__begin1, __end1, __begin2, __pred, __selector, equal_split_tag()); default: _GLIBCXX_PARALLEL_ASSERT(false); return std::make_pair(__begin1, __begin2); } } #if _GLIBCXX_FIND_EQUAL_SPLIT /** * @brief Parallel std::find, equal splitting variant. * @param __begin1 Begin iterator of first sequence. * @param __end1 End iterator of first sequence. * @param __begin2 Begin iterator of second sequence. Second __sequence * must have same length as first sequence. * @param __pred Find predicate. * @param __selector _Functionality (e. g. std::find_if(), std::equal(),...) * @return Place of finding in both sequences. */ template<typename _RAIter1, typename _RAIter2, typename _Pred, typename _Selector> std::pair<_RAIter1, _RAIter2> __find_template(_RAIter1 __begin1, _RAIter1 __end1, _RAIter2 __begin2, _Pred __pred, _Selector __selector, equal_split_tag) { _GLIBCXX_CALL(__end1 - __begin1) typedef std::iterator_traits<_RAIter1> _TraitsType; typedef typename _TraitsType::difference_type _DifferenceType; typedef typename _TraitsType::value_type _ValueType; _DifferenceType __length = __end1 - __begin1; _DifferenceType __result = __length; _DifferenceType* __borders; omp_lock_t __result_lock; omp_init_lock(&__result_lock); _ThreadIndex __num_threads = __get_max_threads(); # pragma omp parallel num_threads(__num_threads) { # pragma omp single { __num_threads = omp_get_num_threads(); __borders = new _DifferenceType[__num_threads + 1]; __equally_split(__length, __num_threads, __borders); } //single _ThreadIndex __iam = omp_get_thread_num(); _DifferenceType __start = __borders[__iam], __stop = __borders[__iam + 1]; _RAIter1 __i1 = __begin1 + __start; _RAIter2 __i2 = __begin2 + __start; for (_DifferenceType __pos = __start; __pos < __stop; ++__pos) { # pragma omp flush(__result) // Result has been set to something lower. if (__result < __pos) break; if (__selector(__i1, __i2, __pred)) { omp_set_lock(&__result_lock); if (__pos < __result) __result = __pos; omp_unset_lock(&__result_lock); break; } ++__i1; ++__i2; } } //parallel omp_destroy_lock(&__result_lock); delete[] __borders; return std::pair<_RAIter1, _RAIter2>(__begin1 + __result, __begin2 + __result); } #endif #if _GLIBCXX_FIND_GROWING_BLOCKS /** * @brief Parallel std::find, growing block size variant. * @param __begin1 Begin iterator of first sequence. * @param __end1 End iterator of first sequence. * @param __begin2 Begin iterator of second sequence. Second __sequence * must have same length as first sequence. * @param __pred Find predicate. * @param __selector _Functionality (e. g. std::find_if(), std::equal(),...) * @return Place of finding in both sequences. * @see __gnu_parallel::_Settings::find_sequential_search_size * @see __gnu_parallel::_Settings::find_scale_factor * * There are two main differences between the growing blocks and * the constant-size blocks variants. * 1. For GB, the block size grows; for CSB, the block size is fixed. * 2. For GB, the blocks are allocated dynamically; * for CSB, the blocks are allocated in a predetermined manner, * namely spacial round-robin. */ template<typename _RAIter1, typename _RAIter2, typename _Pred, typename _Selector> std::pair<_RAIter1, _RAIter2> __find_template(_RAIter1 __begin1, _RAIter1 __end1, _RAIter2 __begin2, _Pred __pred, _Selector __selector, growing_blocks_tag) { _GLIBCXX_CALL(__end1 - __begin1) typedef std::iterator_traits<_RAIter1> _TraitsType; typedef typename _TraitsType::difference_type _DifferenceType; typedef typename _TraitsType::value_type _ValueType; const _Settings& __s = _Settings::get(); _DifferenceType __length = __end1 - __begin1; _DifferenceType __sequential_search_size = std::min<_DifferenceType> (__length, __s.find_sequential_search_size); // Try it sequentially first. std::pair<_RAIter1, _RAIter2> __find_seq_result = __selector._M_sequential_algorithm (__begin1, __begin1 + __sequential_search_size, __begin2, __pred); if (__find_seq_result.first != (__begin1 + __sequential_search_size)) return __find_seq_result; // Index of beginning of next free block (after sequential find). _DifferenceType __next_block_start = __sequential_search_size; _DifferenceType __result = __length; omp_lock_t __result_lock; omp_init_lock(&__result_lock); const float __scale_factor = __s.find_scale_factor; _ThreadIndex __num_threads = __get_max_threads(); # pragma omp parallel shared(__result) num_threads(__num_threads) { # pragma omp single __num_threads = omp_get_num_threads(); // Not within first __k elements -> start parallel. _ThreadIndex __iam = omp_get_thread_num(); _DifferenceType __block_size = std::max<_DifferenceType>(1, __scale_factor * __next_block_start); _DifferenceType __start = __fetch_and_add<_DifferenceType> (&__next_block_start, __block_size); // Get new block, update pointer to next block. _DifferenceType __stop = std::min<_DifferenceType>(__length, __start + __block_size); std::pair<_RAIter1, _RAIter2> __local_result; while (__start < __length) { # pragma omp flush(__result) // Get new value of result. if (__result < __start) { // No chance to find first element. break; } __local_result = __selector._M_sequential_algorithm (__begin1 + __start, __begin1 + __stop, __begin2 + __start, __pred); if (__local_result.first != (__begin1 + __stop)) { omp_set_lock(&__result_lock); if ((__local_result.first - __begin1) < __result) { __result = __local_result.first - __begin1; // Result cannot be in future blocks, stop algorithm. __fetch_and_add<_DifferenceType>(&__next_block_start, __length); } omp_unset_lock(&__result_lock); } _DifferenceType __block_size = std::max<_DifferenceType>(1, __scale_factor * __next_block_start); // Get new block, update pointer to next block. __start = __fetch_and_add<_DifferenceType>(&__next_block_start, __block_size); __stop = std::min<_DifferenceType>(__length, __start + __block_size); } } //parallel omp_destroy_lock(&__result_lock); // Return iterator on found element. return std::pair<_RAIter1, _RAIter2>(__begin1 + __result, __begin2 + __result); } #endif #if _GLIBCXX_FIND_CONSTANT_SIZE_BLOCKS /** * @brief Parallel std::find, constant block size variant. * @param __begin1 Begin iterator of first sequence. * @param __end1 End iterator of first sequence. * @param __begin2 Begin iterator of second sequence. Second __sequence * must have same length as first sequence. * @param __pred Find predicate. * @param __selector _Functionality (e. g. std::find_if(), std::equal(),...) * @return Place of finding in both sequences. * @see __gnu_parallel::_Settings::find_sequential_search_size * @see __gnu_parallel::_Settings::find_block_size * There are two main differences between the growing blocks and the * constant-size blocks variants. * 1. For GB, the block size grows; for CSB, the block size is fixed. * 2. For GB, the blocks are allocated dynamically; for CSB, the * blocks are allocated in a predetermined manner, namely spacial * round-robin. */ template<typename _RAIter1, typename _RAIter2, typename _Pred, typename _Selector> std::pair<_RAIter1, _RAIter2> __find_template(_RAIter1 __begin1, _RAIter1 __end1, _RAIter2 __begin2, _Pred __pred, _Selector __selector, constant_size_blocks_tag) { _GLIBCXX_CALL(__end1 - __begin1) typedef std::iterator_traits<_RAIter1> _TraitsType; typedef typename _TraitsType::difference_type _DifferenceType; typedef typename _TraitsType::value_type _ValueType; const _Settings& __s = _Settings::get(); _DifferenceType __length = __end1 - __begin1; _DifferenceType __sequential_search_size = std::min<_DifferenceType> (__length, __s.find_sequential_search_size); // Try it sequentially first. std::pair<_RAIter1, _RAIter2> __find_seq_result = __selector._M_sequential_algorithm (__begin1, __begin1 + __sequential_search_size, __begin2, __pred); if (__find_seq_result.first != (__begin1 + __sequential_search_size)) return __find_seq_result; _DifferenceType __result = __length; omp_lock_t __result_lock; omp_init_lock(&__result_lock); // Not within first __sequential_search_size elements -> start parallel. _ThreadIndex __num_threads = __get_max_threads(); # pragma omp parallel shared(__result) num_threads(__num_threads) { # pragma omp single __num_threads = omp_get_num_threads(); _ThreadIndex __iam = omp_get_thread_num(); _DifferenceType __block_size = __s.find_initial_block_size; // First element of thread's current iteration. _DifferenceType __iteration_start = __sequential_search_size; // Where to work (initialization). _DifferenceType __start = __iteration_start + __iam * __block_size; _DifferenceType __stop = std::min<_DifferenceType>(__length, __start + __block_size); std::pair<_RAIter1, _RAIter2> __local_result; while (__start < __length) { // Get new value of result. # pragma omp flush(__result) // No chance to find first element. if (__result < __start) break; __local_result = __selector._M_sequential_algorithm (__begin1 + __start, __begin1 + __stop, __begin2 + __start, __pred); if (__local_result.first != (__begin1 + __stop)) { omp_set_lock(&__result_lock); if ((__local_result.first - __begin1) < __result) __result = __local_result.first - __begin1; omp_unset_lock(&__result_lock); // Will not find better value in its interval. break; } __iteration_start += __num_threads * __block_size; // Where to work. __start = __iteration_start + __iam * __block_size; __stop = std::min<_DifferenceType>(__length, __start + __block_size); } } //parallel omp_destroy_lock(&__result_lock); // Return iterator on found element. return std::pair<_RAIter1, _RAIter2>(__begin1 + __result, __begin2 + __result); } #endif } // end namespace #endif /* _GLIBCXX_PARALLEL_FIND_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/algorithmfwd.h�������������������������������������������������������������������0000644�����������������00000076716�14763166027�0012256 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <parallel/algorithm> Forward declarations -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/algorithmfwd.h * This file is a GNU parallel extension to the Standard C++ Library. */ #ifndef _GLIBCXX_PARALLEL_ALGORITHMFWD_H #define _GLIBCXX_PARALLEL_ALGORITHMFWD_H 1 #pragma GCC system_header #include <parallel/tags.h> #include <parallel/settings.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace __parallel { template<typename _FIter> _FIter adjacent_find(_FIter, _FIter); template<typename _FIter> _FIter adjacent_find(_FIter, _FIter, __gnu_parallel::sequential_tag); template<typename _FIter, typename _IterTag> _FIter __adjacent_find_switch(_FIter, _FIter, _IterTag); template<typename _RAIter> _RAIter __adjacent_find_switch(_RAIter, _RAIter, random_access_iterator_tag); template<typename _FIter, typename _BiPredicate> _FIter adjacent_find(_FIter, _FIter, _BiPredicate); template<typename _FIter, typename _BiPredicate> _FIter adjacent_find(_FIter, _FIter, _BiPredicate, __gnu_parallel::sequential_tag); template<typename _FIter, typename _BiPredicate, typename _IterTag> _FIter __adjacent_find_switch(_FIter, _FIter, _BiPredicate, _IterTag); template<typename _RAIter, typename _BiPredicate> _RAIter __adjacent_find_switch(_RAIter, _RAIter, _BiPredicate, random_access_iterator_tag); template<typename _IIter, typename _Tp> typename iterator_traits<_IIter>::difference_type count(_IIter, _IIter, const _Tp&); template<typename _IIter, typename _Tp> typename iterator_traits<_IIter>::difference_type count(_IIter, _IIter, const _Tp&, __gnu_parallel::sequential_tag); template<typename _IIter, typename _Tp> typename iterator_traits<_IIter>::difference_type count(_IIter, _IIter, const _Tp&, __gnu_parallel::_Parallelism); template<typename _IIter, typename _Tp, typename _IterTag> typename iterator_traits<_IIter>::difference_type __count_switch(_IIter, _IIter, const _Tp&, _IterTag); template<typename _RAIter, typename _Tp> typename iterator_traits<_RAIter>::difference_type __count_switch(_RAIter, _RAIter, const _Tp&, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism = __gnu_parallel::parallel_unbalanced); template<typename _IIter, typename _Predicate> typename iterator_traits<_IIter>::difference_type count_if(_IIter, _IIter, _Predicate); template<typename _IIter, typename _Predicate> typename iterator_traits<_IIter>::difference_type count_if(_IIter, _IIter, _Predicate, __gnu_parallel::sequential_tag); template<typename _IIter, typename _Predicate> typename iterator_traits<_IIter>::difference_type count_if(_IIter, _IIter, _Predicate, __gnu_parallel::_Parallelism); template<typename _IIter, typename _Predicate, typename _IterTag> typename iterator_traits<_IIter>::difference_type __count_if_switch(_IIter, _IIter, _Predicate, _IterTag); template<typename _RAIter, typename _Predicate> typename iterator_traits<_RAIter>::difference_type __count_if_switch(_RAIter, _RAIter, _Predicate, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism = __gnu_parallel::parallel_unbalanced); // algobase.h template<typename _IIter1, typename _IIter2> bool equal(_IIter1, _IIter1, _IIter2, __gnu_parallel::sequential_tag); template<typename _IIter1, typename _IIter2, typename _Predicate> bool equal(_IIter1, _IIter1, _IIter2, _Predicate, __gnu_parallel::sequential_tag); template<typename _IIter1, typename _IIter2> bool equal(_IIter1, _IIter1, _IIter2); template<typename _IIter1, typename _IIter2, typename _Predicate> bool equal(_IIter1, _IIter1, _IIter2, _Predicate); template<typename _IIter, typename _Tp> _IIter find(_IIter, _IIter, const _Tp&, __gnu_parallel::sequential_tag); template<typename _IIter, typename _Tp> _IIter find(_IIter, _IIter, const _Tp& __val); template<typename _IIter, typename _Tp, typename _IterTag> _IIter __find_switch(_IIter, _IIter, const _Tp&, _IterTag); template<typename _RAIter, typename _Tp> _RAIter __find_switch(_RAIter, _RAIter, const _Tp&, random_access_iterator_tag); template<typename _IIter, typename _Predicate> _IIter find_if(_IIter, _IIter, _Predicate, __gnu_parallel::sequential_tag); template<typename _IIter, typename _Predicate> _IIter find_if(_IIter, _IIter, _Predicate); template<typename _IIter, typename _Predicate, typename _IterTag> _IIter __find_if_switch(_IIter, _IIter, _Predicate, _IterTag); template<typename _RAIter, typename _Predicate> _RAIter __find_if_switch(_RAIter, _RAIter, _Predicate, random_access_iterator_tag); template<typename _IIter, typename _FIter> _IIter find_first_of(_IIter, _IIter, _FIter, _FIter, __gnu_parallel::sequential_tag); template<typename _IIter, typename _FIter, typename _BiPredicate> _IIter find_first_of(_IIter, _IIter, _FIter, _FIter, _BiPredicate, __gnu_parallel::sequential_tag); template<typename _IIter, typename _FIter, typename _BiPredicate> _IIter find_first_of(_IIter, _IIter, _FIter, _FIter, _BiPredicate); template<typename _IIter, typename _FIter> _IIter find_first_of(_IIter, _IIter, _FIter, _FIter); template<typename _IIter, typename _FIter, typename _IterTag1, typename _IterTag2> _IIter __find_first_of_switch( _IIter, _IIter, _FIter, _FIter, _IterTag1, _IterTag2); template<typename _RAIter, typename _FIter, typename _BiPredicate, typename _IterTag> _RAIter __find_first_of_switch(_RAIter, _RAIter, _FIter, _FIter, _BiPredicate, random_access_iterator_tag, _IterTag); template<typename _IIter, typename _FIter, typename _BiPredicate, typename _IterTag1, typename _IterTag2> _IIter __find_first_of_switch(_IIter, _IIter, _FIter, _FIter, _BiPredicate, _IterTag1, _IterTag2); template<typename _IIter, typename _Function> _Function for_each(_IIter, _IIter, _Function); template<typename _IIter, typename _Function> _Function for_each(_IIter, _IIter, _Function, __gnu_parallel::sequential_tag); template<typename _Iterator, typename _Function> _Function for_each(_Iterator, _Iterator, _Function, __gnu_parallel::_Parallelism); template<typename _IIter, typename _Function, typename _IterTag> _Function __for_each_switch(_IIter, _IIter, _Function, _IterTag); template<typename _RAIter, typename _Function> _Function __for_each_switch(_RAIter, _RAIter, _Function, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism = __gnu_parallel::parallel_balanced); template<typename _FIter, typename _Generator> void generate(_FIter, _FIter, _Generator); template<typename _FIter, typename _Generator> void generate(_FIter, _FIter, _Generator, __gnu_parallel::sequential_tag); template<typename _FIter, typename _Generator> void generate(_FIter, _FIter, _Generator, __gnu_parallel::_Parallelism); template<typename _FIter, typename _Generator, typename _IterTag> void __generate_switch(_FIter, _FIter, _Generator, _IterTag); template<typename _RAIter, typename _Generator> void __generate_switch(_RAIter, _RAIter, _Generator, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism = __gnu_parallel::parallel_balanced); template<typename _OIter, typename _Size, typename _Generator> _OIter generate_n(_OIter, _Size, _Generator); template<typename _OIter, typename _Size, typename _Generator> _OIter generate_n(_OIter, _Size, _Generator, __gnu_parallel::sequential_tag); template<typename _OIter, typename _Size, typename _Generator> _OIter generate_n(_OIter, _Size, _Generator, __gnu_parallel::_Parallelism); template<typename _OIter, typename _Size, typename _Generator, typename _IterTag> _OIter __generate_n_switch(_OIter, _Size, _Generator, _IterTag); template<typename _RAIter, typename _Size, typename _Generator> _RAIter __generate_n_switch(_RAIter, _Size, _Generator, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism = __gnu_parallel::parallel_balanced); template<typename _IIter1, typename _IIter2> bool lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, __gnu_parallel::sequential_tag); template<typename _IIter1, typename _IIter2, typename _Predicate> bool lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Predicate, __gnu_parallel::sequential_tag); template<typename _IIter1, typename _IIter2> bool lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2); template<typename _IIter1, typename _IIter2, typename _Predicate> bool lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Predicate); template<typename _IIter1, typename _IIter2, typename _Predicate, typename _IterTag1, typename _IterTag2> bool __lexicographical_compare_switch(_IIter1, _IIter1, _IIter2, _IIter2, _Predicate, _IterTag1, _IterTag2); template<typename _RAIter1, typename _RAIter2, typename _Predicate> bool __lexicographical_compare_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2, _Predicate, random_access_iterator_tag, random_access_iterator_tag); // algo.h template<typename _IIter1, typename _IIter2> pair<_IIter1, _IIter2> mismatch(_IIter1, _IIter1, _IIter2, __gnu_parallel::sequential_tag); template<typename _IIter1, typename _IIter2, typename _Predicate> pair<_IIter1, _IIter2> mismatch(_IIter1, _IIter1, _IIter2, _Predicate, __gnu_parallel::sequential_tag); template<typename _IIter1, typename _IIter2> pair<_IIter1, _IIter2> mismatch(_IIter1, _IIter1, _IIter2); template<typename _IIter1, typename _IIter2, typename _Predicate> pair<_IIter1, _IIter2> mismatch(_IIter1, _IIter1, _IIter2, _Predicate); template<typename _IIter1, typename _IIter2, typename _Predicate, typename _IterTag1, typename _IterTag2> pair<_IIter1, _IIter2> __mismatch_switch(_IIter1, _IIter1, _IIter2, _Predicate, _IterTag1, _IterTag2); template<typename _RAIter1, typename _RAIter2, typename _Predicate> pair<_RAIter1, _RAIter2> __mismatch_switch(_RAIter1, _RAIter1, _RAIter2, _Predicate, random_access_iterator_tag, random_access_iterator_tag); template<typename _FIter1, typename _FIter2> _FIter1 search(_FIter1, _FIter1, _FIter2, _FIter2, __gnu_parallel::sequential_tag); template<typename _FIter1, typename _FIter2> _FIter1 search(_FIter1, _FIter1, _FIter2, _FIter2); template<typename _FIter1, typename _FIter2, typename _BiPredicate> _FIter1 search(_FIter1, _FIter1, _FIter2, _FIter2, _BiPredicate, __gnu_parallel::sequential_tag); template<typename _FIter1, typename _FIter2, typename _BiPredicate> _FIter1 search(_FIter1, _FIter1, _FIter2, _FIter2, _BiPredicate); template<typename _RAIter1, typename _RAIter2> _RAIter1 __search_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2, random_access_iterator_tag, random_access_iterator_tag); template<typename _FIter1, typename _FIter2, typename _IterTag1, typename _IterTag2> _FIter1 __search_switch(_FIter1, _FIter1, _FIter2, _FIter2, _IterTag1, _IterTag2); template<typename _RAIter1, typename _RAIter2, typename _BiPredicate> _RAIter1 __search_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2, _BiPredicate, random_access_iterator_tag, random_access_iterator_tag); template<typename _FIter1, typename _FIter2, typename _BiPredicate, typename _IterTag1, typename _IterTag2> _FIter1 __search_switch(_FIter1, _FIter1, _FIter2, _FIter2, _BiPredicate, _IterTag1, _IterTag2); template<typename _FIter, typename _Integer, typename _Tp> _FIter search_n(_FIter, _FIter, _Integer, const _Tp&, __gnu_parallel::sequential_tag); template<typename _FIter, typename _Integer, typename _Tp, typename _BiPredicate> _FIter search_n(_FIter, _FIter, _Integer, const _Tp&, _BiPredicate, __gnu_parallel::sequential_tag); template<typename _FIter, typename _Integer, typename _Tp> _FIter search_n(_FIter, _FIter, _Integer, const _Tp&); template<typename _FIter, typename _Integer, typename _Tp, typename _BiPredicate> _FIter search_n(_FIter, _FIter, _Integer, const _Tp&, _BiPredicate); template<typename _RAIter, typename _Integer, typename _Tp, typename _BiPredicate> _RAIter __search_n_switch(_RAIter, _RAIter, _Integer, const _Tp&, _BiPredicate, random_access_iterator_tag); template<typename _FIter, typename _Integer, typename _Tp, typename _BiPredicate, typename _IterTag> _FIter __search_n_switch(_FIter, _FIter, _Integer, const _Tp&, _BiPredicate, _IterTag); template<typename _IIter, typename _OIter, typename _UnaryOperation> _OIter transform(_IIter, _IIter, _OIter, _UnaryOperation); template<typename _IIter, typename _OIter, typename _UnaryOperation> _OIter transform(_IIter, _IIter, _OIter, _UnaryOperation, __gnu_parallel::sequential_tag); template<typename _IIter, typename _OIter, typename _UnaryOperation> _OIter transform(_IIter, _IIter, _OIter, _UnaryOperation, __gnu_parallel::_Parallelism); template<typename _IIter, typename _OIter, typename _UnaryOperation, typename _IterTag1, typename _IterTag2> _OIter __transform1_switch(_IIter, _IIter, _OIter, _UnaryOperation, _IterTag1, _IterTag2); template<typename _RAIIter, typename _RAOIter, typename _UnaryOperation> _RAOIter __transform1_switch(_RAIIter, _RAIIter, _RAOIter, _UnaryOperation, random_access_iterator_tag, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism = __gnu_parallel::parallel_balanced); template<typename _IIter1, typename _IIter2, typename _OIter, typename _BiOperation> _OIter transform(_IIter1, _IIter1, _IIter2, _OIter, _BiOperation); template<typename _IIter1, typename _IIter2, typename _OIter, typename _BiOperation> _OIter transform(_IIter1, _IIter1, _IIter2, _OIter, _BiOperation, __gnu_parallel::sequential_tag); template<typename _IIter1, typename _IIter2, typename _OIter, typename _BiOperation> _OIter transform(_IIter1, _IIter1, _IIter2, _OIter, _BiOperation, __gnu_parallel::_Parallelism); template<typename _RAIter1, typename _RAIter2, typename _RAIter3, typename _BiOperation> _RAIter3 __transform2_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter3, _BiOperation, random_access_iterator_tag, random_access_iterator_tag, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism = __gnu_parallel::parallel_balanced); template<typename _IIter1, typename _IIter2, typename _OIter, typename _BiOperation, typename _Tag1, typename _Tag2, typename _Tag3> _OIter __transform2_switch(_IIter1, _IIter1, _IIter2, _OIter, _BiOperation, _Tag1, _Tag2, _Tag3); template<typename _FIter, typename _Tp> void replace(_FIter, _FIter, const _Tp&, const _Tp&); template<typename _FIter, typename _Tp> void replace(_FIter, _FIter, const _Tp&, const _Tp&, __gnu_parallel::sequential_tag); template<typename _FIter, typename _Tp> void replace(_FIter, _FIter, const _Tp&, const _Tp&, __gnu_parallel::_Parallelism); template<typename _FIter, typename _Tp, typename _IterTag> void __replace_switch(_FIter, _FIter, const _Tp&, const _Tp&, _IterTag); template<typename _RAIter, typename _Tp> void __replace_switch(_RAIter, _RAIter, const _Tp&, const _Tp&, random_access_iterator_tag, __gnu_parallel::_Parallelism); template<typename _FIter, typename _Predicate, typename _Tp> void replace_if(_FIter, _FIter, _Predicate, const _Tp&); template<typename _FIter, typename _Predicate, typename _Tp> void replace_if(_FIter, _FIter, _Predicate, const _Tp&, __gnu_parallel::sequential_tag); template<typename _FIter, typename _Predicate, typename _Tp> void replace_if(_FIter, _FIter, _Predicate, const _Tp&, __gnu_parallel::_Parallelism); template<typename _FIter, typename _Predicate, typename _Tp, typename _IterTag> void __replace_if_switch(_FIter, _FIter, _Predicate, const _Tp&, _IterTag); template<typename _RAIter, typename _Predicate, typename _Tp> void __replace_if_switch(_RAIter, _RAIter, _Predicate, const _Tp&, random_access_iterator_tag, __gnu_parallel::_Parallelism); template<typename _FIter> _FIter max_element(_FIter, _FIter); template<typename _FIter> _FIter max_element(_FIter, _FIter, __gnu_parallel::sequential_tag); template<typename _FIter> _FIter max_element(_FIter, _FIter, __gnu_parallel::_Parallelism); template<typename _FIter, typename _Compare> _FIter max_element(_FIter, _FIter, _Compare); template<typename _FIter, typename _Compare> _FIter max_element(_FIter, _FIter, _Compare, __gnu_parallel::sequential_tag); template<typename _FIter, typename _Compare> _FIter max_element(_FIter, _FIter, _Compare, __gnu_parallel::_Parallelism); template<typename _FIter, typename _Compare, typename _IterTag> _FIter __max_element_switch(_FIter, _FIter, _Compare, _IterTag); template<typename _RAIter, typename _Compare> _RAIter __max_element_switch( _RAIter, _RAIter, _Compare, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism = __gnu_parallel::parallel_balanced); template<typename _IIter1, typename _IIter2, typename _OIter> _OIter merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, __gnu_parallel::sequential_tag); template<typename _IIter1, typename _IIter2, typename _OIter, typename _Compare> _OIter merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare, __gnu_parallel::sequential_tag); template<typename _IIter1, typename _IIter2, typename _OIter, typename _Compare> _OIter merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); template<typename _IIter1, typename _IIter2, typename _OIter> _OIter merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); template<typename _IIter1, typename _IIter2, typename _OIter, typename _Compare, typename _IterTag1, typename _IterTag2, typename _IterTag3> _OIter __merge_switch(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare, _IterTag1, _IterTag2, _IterTag3); template<typename _IIter1, typename _IIter2, typename _OIter, typename _Compare> _OIter __merge_switch(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare, random_access_iterator_tag, random_access_iterator_tag, random_access_iterator_tag); template<typename _FIter> _FIter min_element(_FIter, _FIter); template<typename _FIter> _FIter min_element(_FIter, _FIter, __gnu_parallel::sequential_tag); template<typename _FIter> _FIter min_element(_FIter, _FIter, __gnu_parallel::_Parallelism __parallelism_tag); template<typename _FIter, typename _Compare> _FIter min_element(_FIter, _FIter, _Compare); template<typename _FIter, typename _Compare> _FIter min_element(_FIter, _FIter, _Compare, __gnu_parallel::sequential_tag); template<typename _FIter, typename _Compare> _FIter min_element(_FIter, _FIter, _Compare, __gnu_parallel::_Parallelism); template<typename _FIter, typename _Compare, typename _IterTag> _FIter __min_element_switch(_FIter, _FIter, _Compare, _IterTag); template<typename _RAIter, typename _Compare> _RAIter __min_element_switch( _RAIter, _RAIter, _Compare, random_access_iterator_tag, __gnu_parallel::_Parallelism __parallelism = __gnu_parallel::parallel_balanced); template<typename _RAIter> void nth_element(_RAIter, _RAIter, _RAIter, __gnu_parallel::sequential_tag); template<typename _RAIter, typename _Compare> void nth_element(_RAIter, _RAIter, _RAIter, _Compare, __gnu_parallel::sequential_tag); template<typename _RAIter, typename _Compare> void nth_element(_RAIter, _RAIter, _RAIter, _Compare); template<typename _RAIter> void nth_element(_RAIter, _RAIter, _RAIter); template<typename _RAIter, typename _Compare> void partial_sort(_RAIter, _RAIter, _RAIter, _Compare, __gnu_parallel::sequential_tag); template<typename _RAIter> void partial_sort(_RAIter, _RAIter, _RAIter, __gnu_parallel::sequential_tag); template<typename _RAIter, typename _Compare> void partial_sort(_RAIter, _RAIter, _RAIter, _Compare); template<typename _RAIter> void partial_sort(_RAIter, _RAIter, _RAIter); template<typename _FIter, typename _Predicate> _FIter partition(_FIter, _FIter, _Predicate, __gnu_parallel::sequential_tag); template<typename _FIter, typename _Predicate> _FIter partition(_FIter, _FIter, _Predicate); template<typename _FIter, typename _Predicate, typename _IterTag> _FIter __partition_switch(_FIter, _FIter, _Predicate, _IterTag); template<typename _RAIter, typename _Predicate> _RAIter __partition_switch( _RAIter, _RAIter, _Predicate, random_access_iterator_tag); template<typename _RAIter> void random_shuffle(_RAIter, _RAIter, __gnu_parallel::sequential_tag); template<typename _RAIter, typename _RandomNumberGenerator> void random_shuffle(_RAIter, _RAIter, _RandomNumberGenerator&, __gnu_parallel::sequential_tag); template<typename _RAIter> void random_shuffle(_RAIter, _RAIter); template<typename _RAIter, typename _RandomNumberGenerator> void random_shuffle(_RAIter, _RAIter, #if __cplusplus >= 201103L _RandomNumberGenerator&&); #else _RandomNumberGenerator&); #endif template<typename _IIter1, typename _IIter2, typename _OIter> _OIter set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, __gnu_parallel::sequential_tag); template<typename _IIter1, typename _IIter2, typename _OIter, typename _Predicate> _OIter set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate, __gnu_parallel::sequential_tag); template<typename _IIter1, typename _IIter2, typename _OIter> _OIter set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); template<typename _IIter1, typename _IIter2, typename _OIter, typename _Predicate> _OIter set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate); template<typename _IIter1, typename _IIter2, typename _Predicate, typename _OIter, typename _IterTag1, typename _IterTag2, typename _IterTag3> _OIter __set_union_switch(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate, _IterTag1, _IterTag2, _IterTag3); template<typename _RAIter1, typename _RAIter2, typename _Output_RAIter, typename _Predicate> _Output_RAIter __set_union_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2, _Output_RAIter, _Predicate, random_access_iterator_tag, random_access_iterator_tag, random_access_iterator_tag); template<typename _IIter1, typename _IIter2, typename _OIter> _OIter set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, __gnu_parallel::sequential_tag); template<typename _IIter1, typename _IIter2, typename _OIter, typename _Predicate> _OIter set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate, __gnu_parallel::sequential_tag); template<typename _IIter1, typename _IIter2, typename _OIter> _OIter set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); template<typename _IIter1, typename _IIter2, typename _OIter, typename _Predicate> _OIter set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate); template<typename _IIter1, typename _IIter2, typename _Predicate, typename _OIter, typename _IterTag1, typename _IterTag2, typename _IterTag3> _OIter __set_intersection_switch(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate, _IterTag1, _IterTag2, _IterTag3); template<typename _RAIter1, typename _RAIter2, typename _Output_RAIter, typename _Predicate> _Output_RAIter __set_intersection_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2, _Output_RAIter, _Predicate, random_access_iterator_tag, random_access_iterator_tag, random_access_iterator_tag); template<typename _IIter1, typename _IIter2, typename _OIter> _OIter set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, __gnu_parallel::sequential_tag); template<typename _IIter1, typename _IIter2, typename _OIter, typename _Predicate> _OIter set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate, __gnu_parallel::sequential_tag); template<typename _IIter1, typename _IIter2, typename _OIter> _OIter set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); template<typename _IIter1, typename _IIter2, typename _OIter, typename _Predicate> _OIter set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate); template<typename _IIter1, typename _IIter2, typename _Predicate, typename _OIter, typename _IterTag1, typename _IterTag2, typename _IterTag3> _OIter __set_symmetric_difference_switch(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate, _IterTag1, _IterTag2, _IterTag3); template<typename _RAIter1, typename _RAIter2, typename _Output_RAIter, typename _Predicate> _Output_RAIter __set_symmetric_difference_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2, _Output_RAIter, _Predicate, random_access_iterator_tag, random_access_iterator_tag, random_access_iterator_tag); template<typename _IIter1, typename _IIter2, typename _OIter> _OIter set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, __gnu_parallel::sequential_tag); template<typename _IIter1, typename _IIter2, typename _OIter, typename _Predicate> _OIter set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate, __gnu_parallel::sequential_tag); template<typename _IIter1, typename _IIter2, typename _OIter> _OIter set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); template<typename _IIter1, typename _IIter2, typename _OIter, typename _Predicate> _OIter set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate); template<typename _IIter1, typename _IIter2, typename _Predicate, typename _OIter, typename _IterTag1, typename _IterTag2, typename _IterTag3> _OIter __set_difference_switch(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate, _IterTag1, _IterTag2, _IterTag3); template<typename _RAIter1, typename _RAIter2, typename _Output_RAIter, typename _Predicate> _Output_RAIter __set_difference_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2, _Output_RAIter, _Predicate, random_access_iterator_tag, random_access_iterator_tag, random_access_iterator_tag); template<typename _RAIter> void sort(_RAIter, _RAIter, __gnu_parallel::sequential_tag); template<typename _RAIter, typename _Compare> void sort(_RAIter, _RAIter, _Compare, __gnu_parallel::sequential_tag); template<typename _RAIter> void sort(_RAIter, _RAIter); template<typename _RAIter, typename _Compare> void sort(_RAIter, _RAIter, _Compare); template<typename _RAIter> void stable_sort(_RAIter, _RAIter, __gnu_parallel::sequential_tag); template<typename _RAIter, typename _Compare> void stable_sort(_RAIter, _RAIter, _Compare, __gnu_parallel::sequential_tag); template<typename _RAIter> void stable_sort(_RAIter, _RAIter); template<typename _RAIter, typename _Compare> void stable_sort(_RAIter, _RAIter, _Compare); template<typename _IIter, typename _OIter> _OIter unique_copy(_IIter, _IIter, _OIter, __gnu_parallel::sequential_tag); template<typename _IIter, typename _OIter, typename _Predicate> _OIter unique_copy(_IIter, _IIter, _OIter, _Predicate, __gnu_parallel::sequential_tag); template<typename _IIter, typename _OIter> _OIter unique_copy(_IIter, _IIter, _OIter); template<typename _IIter, typename _OIter, typename _Predicate> _OIter unique_copy(_IIter, _IIter, _OIter, _Predicate); template<typename _IIter, typename _OIter, typename _Predicate, typename _IterTag1, typename _IterTag2> _OIter __unique_copy_switch(_IIter, _IIter, _OIter, _Predicate, _IterTag1, _IterTag2); template<typename _RAIter, typename _RandomAccess_OIter, typename _Predicate> _RandomAccess_OIter __unique_copy_switch(_RAIter, _RAIter, _RandomAccess_OIter, _Predicate, random_access_iterator_tag, random_access_iterator_tag); } // end namespace __parallel } // end namespace std #endif /* _GLIBCXX_PARALLEL_ALGORITHMFWD_H */ ��������������������������������������������������c++/4.8.2/parallel/sort.h���������������������������������������������������������������������������0000644�����������������00000017024�14763166027�0010541 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/sort.h * @brief Parallel sorting algorithm switch. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler. #ifndef _GLIBCXX_PARALLEL_SORT_H #define _GLIBCXX_PARALLEL_SORT_H 1 #include <parallel/basic_iterator.h> #include <parallel/features.h> #include <parallel/parallel.h> #if _GLIBCXX_ASSERTIONS #include <parallel/checkers.h> #endif #if _GLIBCXX_MERGESORT #include <parallel/multiway_mergesort.h> #endif #if _GLIBCXX_QUICKSORT #include <parallel/quicksort.h> #endif #if _GLIBCXX_BAL_QUICKSORT #include <parallel/balanced_quicksort.h> #endif namespace __gnu_parallel { //prototype template<bool __stable, typename _RAIter, typename _Compare, typename _Parallelism> void __parallel_sort(_RAIter __begin, _RAIter __end, _Compare __comp, _Parallelism __parallelism); /** * @brief Choose multiway mergesort, splitting variant at run-time, * for parallel sorting. * @param __begin Begin iterator of input sequence. * @param __end End iterator of input sequence. * @param __comp Comparator. * @tparam __stable Sort stable. * @callgraph */ template<bool __stable, typename _RAIter, typename _Compare> inline void __parallel_sort(_RAIter __begin, _RAIter __end, _Compare __comp, multiway_mergesort_tag __parallelism) { _GLIBCXX_CALL(__end - __begin) if(_Settings::get().sort_splitting == EXACT) parallel_sort_mwms<__stable, true> (__begin, __end, __comp, __parallelism.__get_num_threads()); else parallel_sort_mwms<__stable, false> (__begin, __end, __comp, __parallelism.__get_num_threads()); } /** * @brief Choose multiway mergesort with exact splitting, * for parallel sorting. * @param __begin Begin iterator of input sequence. * @param __end End iterator of input sequence. * @param __comp Comparator. * @tparam __stable Sort stable. * @callgraph */ template<bool __stable, typename _RAIter, typename _Compare> inline void __parallel_sort(_RAIter __begin, _RAIter __end, _Compare __comp, multiway_mergesort_exact_tag __parallelism) { _GLIBCXX_CALL(__end - __begin) parallel_sort_mwms<__stable, true> (__begin, __end, __comp, __parallelism.__get_num_threads()); } /** * @brief Choose multiway mergesort with splitting by sampling, * for parallel sorting. * @param __begin Begin iterator of input sequence. * @param __end End iterator of input sequence. * @param __comp Comparator. * @tparam __stable Sort stable. * @callgraph */ template<bool __stable, typename _RAIter, typename _Compare> inline void __parallel_sort(_RAIter __begin, _RAIter __end, _Compare __comp, multiway_mergesort_sampling_tag __parallelism) { _GLIBCXX_CALL(__end - __begin) parallel_sort_mwms<__stable, false> (__begin, __end, __comp, __parallelism.__get_num_threads()); } /** * @brief Choose quicksort for parallel sorting. * @param __begin Begin iterator of input sequence. * @param __end End iterator of input sequence. * @param __comp Comparator. * @tparam __stable Sort stable. * @callgraph */ template<bool __stable, typename _RAIter, typename _Compare> inline void __parallel_sort(_RAIter __begin, _RAIter __end, _Compare __comp, quicksort_tag __parallelism) { _GLIBCXX_CALL(__end - __begin) _GLIBCXX_PARALLEL_ASSERT(__stable == false); __parallel_sort_qs(__begin, __end, __comp, __parallelism.__get_num_threads()); } /** * @brief Choose balanced quicksort for parallel sorting. * @param __begin Begin iterator of input sequence. * @param __end End iterator of input sequence. * @param __comp Comparator. * @tparam __stable Sort stable. * @callgraph */ template<bool __stable, typename _RAIter, typename _Compare> inline void __parallel_sort(_RAIter __begin, _RAIter __end, _Compare __comp, balanced_quicksort_tag __parallelism) { _GLIBCXX_CALL(__end - __begin) _GLIBCXX_PARALLEL_ASSERT(__stable == false); __parallel_sort_qsb(__begin, __end, __comp, __parallelism.__get_num_threads()); } /** * @brief Choose multiway mergesort with exact splitting, * for parallel sorting. * @param __begin Begin iterator of input sequence. * @param __end End iterator of input sequence. * @param __comp Comparator. * @tparam __stable Sort stable. * @callgraph */ template<bool __stable, typename _RAIter, typename _Compare> inline void __parallel_sort(_RAIter __begin, _RAIter __end, _Compare __comp, default_parallel_tag __parallelism) { _GLIBCXX_CALL(__end - __begin) __parallel_sort<__stable> (__begin, __end, __comp, multiway_mergesort_exact_tag(__parallelism.__get_num_threads())); } /** * @brief Choose a parallel sorting algorithm. * @param __begin Begin iterator of input sequence. * @param __end End iterator of input sequence. * @param __comp Comparator. * @tparam __stable Sort stable. * @callgraph */ template<bool __stable, typename _RAIter, typename _Compare> inline void __parallel_sort(_RAIter __begin, _RAIter __end, _Compare __comp, parallel_tag __parallelism) { _GLIBCXX_CALL(__end - __begin) typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; if (false) ; #if _GLIBCXX_MERGESORT else if (__stable || _Settings::get().sort_algorithm == MWMS) { if(_Settings::get().sort_splitting == EXACT) parallel_sort_mwms<__stable, true> (__begin, __end, __comp, __parallelism.__get_num_threads()); else parallel_sort_mwms<false, false> (__begin, __end, __comp, __parallelism.__get_num_threads()); } #endif #if _GLIBCXX_QUICKSORT else if (_Settings::get().sort_algorithm == QS) __parallel_sort_qs(__begin, __end, __comp, __parallelism.__get_num_threads()); #endif #if _GLIBCXX_BAL_QUICKSORT else if (_Settings::get().sort_algorithm == QS_BALANCED) __parallel_sort_qsb(__begin, __end, __comp, __parallelism.__get_num_threads()); #endif else __gnu_sequential::sort(__begin, __end, __comp); } } // end namespace __gnu_parallel #endif /* _GLIBCXX_PARALLEL_SORT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/basic_iterator.h�����������������������������������������������������������������0000644�����������������00000003062�14763166027�0012541 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/basic_iterator.h * @brief Includes the original header files concerned with iterators * except for stream iterators. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler. #ifndef _GLIBCXX_PARALLEL_BASIC_ITERATOR_H #define _GLIBCXX_PARALLEL_BASIC_ITERATOR_H 1 #include <bits/c++config.h> #include <bits/stl_iterator_base_types.h> #include <bits/stl_iterator_base_funcs.h> #include <bits/stl_iterator.h> #endif /* _GLIBCXX_PARALLEL_BASIC_ITERATOR_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/losertree.h����������������������������������������������������������������������0000644�����������������00000067440�14763166027�0011565 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/losertree.h * @brief Many generic loser tree variants. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler. #ifndef _GLIBCXX_PARALLEL_LOSERTREE_H #define _GLIBCXX_PARALLEL_LOSERTREE_H 1 #include <bits/stl_algobase.h> #include <bits/stl_function.h> #include <parallel/features.h> #include <parallel/base.h> namespace __gnu_parallel { /** * @brief Guarded loser/tournament tree. * * The smallest element is at the top. * * Guarding is done explicitly through one flag _M_sup per element, * inf is not needed due to a better initialization routine. This * is a well-performing variant. * * @param _Tp the element type * @param _Compare the comparator to use, defaults to std::less<_Tp> */ template<typename _Tp, typename _Compare> class _LoserTreeBase { protected: /** @brief Internal representation of a _LoserTree element. */ struct _Loser { /** @brief flag, true iff this is a "maximum" __sentinel. */ bool _M_sup; /** @brief __index of the __source __sequence. */ int _M_source; /** @brief _M_key of the element in the _LoserTree. */ _Tp _M_key; }; unsigned int _M_ik, _M_k, _M_offset; /** log_2{_M_k} */ unsigned int _M_log_k; /** @brief _LoserTree __elements. */ _Loser* _M_losers; /** @brief _Compare to use. */ _Compare _M_comp; /** * @brief State flag that determines whether the _LoserTree is empty. * * Only used for building the _LoserTree. */ bool _M_first_insert; public: /** * @brief The constructor. * * @param __k The number of sequences to merge. * @param __comp The comparator to use. */ _LoserTreeBase(unsigned int __k, _Compare __comp) : _M_comp(__comp) { _M_ik = __k; // Compute log_2{_M_k} for the _Loser Tree _M_log_k = __rd_log2(_M_ik - 1) + 1; // Next greater power of 2. _M_k = 1 << _M_log_k; _M_offset = _M_k; // Avoid default-constructing _M_losers[]._M_key _M_losers = static_cast<_Loser*>(::operator new(2 * _M_k * sizeof(_Loser))); for (unsigned int __i = _M_ik - 1; __i < _M_k; ++__i) _M_losers[__i + _M_k]._M_sup = true; _M_first_insert = true; } /** * @brief The destructor. */ ~_LoserTreeBase() { for (unsigned int __i = 0; __i < (2 * _M_k); ++__i) _M_losers[__i].~_Loser(); ::operator delete(_M_losers); } /** * @brief Initializes the sequence "_M_source" with the element "__key". * * @param __key the element to insert * @param __source __index of the __source __sequence * @param __sup flag that determines whether the value to insert is an * explicit __supremum. */ void __insert_start(const _Tp& __key, int __source, bool __sup) { unsigned int __pos = _M_k + __source; if (_M_first_insert) { // Construct all keys, so we can easily destruct them. for (unsigned int __i = 0; __i < (2 * _M_k); ++__i) ::new(&(_M_losers[__i]._M_key)) _Tp(__key); _M_first_insert = false; } else _M_losers[__pos]._M_key = __key; _M_losers[__pos]._M_sup = __sup; _M_losers[__pos]._M_source = __source; } /** * @return the index of the sequence with the smallest element. */ int __get_min_source() { return _M_losers[0]._M_source; } }; /** * @brief Stable _LoserTree variant. * * Provides the stable implementations of insert_start, __init_winner, * __init and __delete_min_insert. * * Unstable variant is done using partial specialisation below. */ template<bool __stable/* default == true */, typename _Tp, typename _Compare> class _LoserTree : public _LoserTreeBase<_Tp, _Compare> { typedef _LoserTreeBase<_Tp, _Compare> _Base; using _Base::_M_k; using _Base::_M_comp; using _Base::_M_losers; using _Base::_M_first_insert; public: _LoserTree(unsigned int __k, _Compare __comp) : _Base::_LoserTreeBase(__k, __comp) { } unsigned int __init_winner(unsigned int __root) { if (__root >= _M_k) return __root; else { unsigned int __left = __init_winner(2 * __root); unsigned int __right = __init_winner(2 * __root + 1); if (_M_losers[__right]._M_sup || (!_M_losers[__left]._M_sup && !_M_comp(_M_losers[__right]._M_key, _M_losers[__left]._M_key))) { // Left one is less or equal. _M_losers[__root] = _M_losers[__right]; return __left; } else { // Right one is less. _M_losers[__root] = _M_losers[__left]; return __right; } } } void __init() { _M_losers[0] = _M_losers[__init_winner(1)]; } /** * @brief Delete the smallest element and insert a new element from * the previously smallest element's sequence. * * This implementation is stable. */ // Do not pass a const reference since __key will be used as // local variable. void __delete_min_insert(_Tp __key, bool __sup) { using std::swap; #if _GLIBCXX_ASSERTIONS // no dummy sequence can ever be at the top! _GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1); #endif int __source = _M_losers[0]._M_source; for (unsigned int __pos = (_M_k + __source) / 2; __pos > 0; __pos /= 2) { // The smaller one gets promoted, ties are broken by _M_source. if ((__sup && (!_M_losers[__pos]._M_sup || _M_losers[__pos]._M_source < __source)) || (!__sup && !_M_losers[__pos]._M_sup && ((_M_comp(_M_losers[__pos]._M_key, __key)) || (!_M_comp(__key, _M_losers[__pos]._M_key) && _M_losers[__pos]._M_source < __source)))) { // The other one is smaller. std::swap(_M_losers[__pos]._M_sup, __sup); std::swap(_M_losers[__pos]._M_source, __source); swap(_M_losers[__pos]._M_key, __key); } } _M_losers[0]._M_sup = __sup; _M_losers[0]._M_source = __source; _M_losers[0]._M_key = __key; } }; /** * @brief Unstable _LoserTree variant. * * Stability (non-stable here) is selected with partial specialization. */ template<typename _Tp, typename _Compare> class _LoserTree</* __stable == */false, _Tp, _Compare> : public _LoserTreeBase<_Tp, _Compare> { typedef _LoserTreeBase<_Tp, _Compare> _Base; using _Base::_M_log_k; using _Base::_M_k; using _Base::_M_comp; using _Base::_M_losers; using _Base::_M_first_insert; public: _LoserTree(unsigned int __k, _Compare __comp) : _Base::_LoserTreeBase(__k, __comp) { } /** * Computes the winner of the competition at position "__root". * * Called recursively (starting at 0) to build the initial tree. * * @param __root __index of the "game" to start. */ unsigned int __init_winner(unsigned int __root) { if (__root >= _M_k) return __root; else { unsigned int __left = __init_winner(2 * __root); unsigned int __right = __init_winner(2 * __root + 1); if (_M_losers[__right]._M_sup || (!_M_losers[__left]._M_sup && !_M_comp(_M_losers[__right]._M_key, _M_losers[__left]._M_key))) { // Left one is less or equal. _M_losers[__root] = _M_losers[__right]; return __left; } else { // Right one is less. _M_losers[__root] = _M_losers[__left]; return __right; } } } void __init() { _M_losers[0] = _M_losers[__init_winner(1)]; } /** * Delete the _M_key smallest element and insert the element __key * instead. * * @param __key the _M_key to insert * @param __sup true iff __key is an explicitly marked supremum */ // Do not pass a const reference since __key will be used as local // variable. void __delete_min_insert(_Tp __key, bool __sup) { using std::swap; #if _GLIBCXX_ASSERTIONS // no dummy sequence can ever be at the top! _GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1); #endif int __source = _M_losers[0]._M_source; for (unsigned int __pos = (_M_k + __source) / 2; __pos > 0; __pos /= 2) { // The smaller one gets promoted. if (__sup || (!_M_losers[__pos]._M_sup && _M_comp(_M_losers[__pos]._M_key, __key))) { // The other one is smaller. std::swap(_M_losers[__pos]._M_sup, __sup); std::swap(_M_losers[__pos]._M_source, __source); swap(_M_losers[__pos]._M_key, __key); } } _M_losers[0]._M_sup = __sup; _M_losers[0]._M_source = __source; _M_losers[0]._M_key = __key; } }; /** * @brief Base class of _Loser Tree implementation using pointers. */ template<typename _Tp, typename _Compare> class _LoserTreePointerBase { protected: /** @brief Internal representation of _LoserTree __elements. */ struct _Loser { bool _M_sup; int _M_source; const _Tp* _M_keyp; }; unsigned int _M_ik, _M_k, _M_offset; _Loser* _M_losers; _Compare _M_comp; public: _LoserTreePointerBase(unsigned int __k, _Compare __comp = std::less<_Tp>()) : _M_comp(__comp) { _M_ik = __k; // Next greater power of 2. _M_k = 1 << (__rd_log2(_M_ik - 1) + 1); _M_offset = _M_k; _M_losers = new _Loser[_M_k * 2]; for (unsigned int __i = _M_ik - 1; __i < _M_k; __i++) _M_losers[__i + _M_k]._M_sup = true; } ~_LoserTreePointerBase() { delete[] _M_losers; } int __get_min_source() { return _M_losers[0]._M_source; } void __insert_start(const _Tp& __key, int __source, bool __sup) { unsigned int __pos = _M_k + __source; _M_losers[__pos]._M_sup = __sup; _M_losers[__pos]._M_source = __source; _M_losers[__pos]._M_keyp = &__key; } }; /** * @brief Stable _LoserTree implementation. * * The unstable variant is implemented using partial instantiation below. */ template<bool __stable/* default == true */, typename _Tp, typename _Compare> class _LoserTreePointer : public _LoserTreePointerBase<_Tp, _Compare> { typedef _LoserTreePointerBase<_Tp, _Compare> _Base; using _Base::_M_k; using _Base::_M_comp; using _Base::_M_losers; public: _LoserTreePointer(unsigned int __k, _Compare __comp = std::less<_Tp>()) : _Base::_LoserTreePointerBase(__k, __comp) { } unsigned int __init_winner(unsigned int __root) { if (__root >= _M_k) return __root; else { unsigned int __left = __init_winner(2 * __root); unsigned int __right = __init_winner(2 * __root + 1); if (_M_losers[__right]._M_sup || (!_M_losers[__left]._M_sup && !_M_comp(*_M_losers[__right]._M_keyp, *_M_losers[__left]._M_keyp))) { // Left one is less or equal. _M_losers[__root] = _M_losers[__right]; return __left; } else { // Right one is less. _M_losers[__root] = _M_losers[__left]; return __right; } } } void __init() { _M_losers[0] = _M_losers[__init_winner(1)]; } void __delete_min_insert(const _Tp& __key, bool __sup) { #if _GLIBCXX_ASSERTIONS // no dummy sequence can ever be at the top! _GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1); #endif const _Tp* __keyp = &__key; int __source = _M_losers[0]._M_source; for (unsigned int __pos = (_M_k + __source) / 2; __pos > 0; __pos /= 2) { // The smaller one gets promoted, ties are broken by __source. if ((__sup && (!_M_losers[__pos]._M_sup || _M_losers[__pos]._M_source < __source)) || (!__sup && !_M_losers[__pos]._M_sup && ((_M_comp(*_M_losers[__pos]._M_keyp, *__keyp)) || (!_M_comp(*__keyp, *_M_losers[__pos]._M_keyp) && _M_losers[__pos]._M_source < __source)))) { // The other one is smaller. std::swap(_M_losers[__pos]._M_sup, __sup); std::swap(_M_losers[__pos]._M_source, __source); std::swap(_M_losers[__pos]._M_keyp, __keyp); } } _M_losers[0]._M_sup = __sup; _M_losers[0]._M_source = __source; _M_losers[0]._M_keyp = __keyp; } }; /** * @brief Unstable _LoserTree implementation. * * The stable variant is above. */ template<typename _Tp, typename _Compare> class _LoserTreePointer</* __stable == */false, _Tp, _Compare> : public _LoserTreePointerBase<_Tp, _Compare> { typedef _LoserTreePointerBase<_Tp, _Compare> _Base; using _Base::_M_k; using _Base::_M_comp; using _Base::_M_losers; public: _LoserTreePointer(unsigned int __k, _Compare __comp = std::less<_Tp>()) : _Base::_LoserTreePointerBase(__k, __comp) { } unsigned int __init_winner(unsigned int __root) { if (__root >= _M_k) return __root; else { unsigned int __left = __init_winner(2 * __root); unsigned int __right = __init_winner(2 * __root + 1); if (_M_losers[__right]._M_sup || (!_M_losers[__left]._M_sup && !_M_comp(*_M_losers[__right]._M_keyp, *_M_losers[__left]._M_keyp))) { // Left one is less or equal. _M_losers[__root] = _M_losers[__right]; return __left; } else { // Right one is less. _M_losers[__root] = _M_losers[__left]; return __right; } } } void __init() { _M_losers[0] = _M_losers[__init_winner(1)]; } void __delete_min_insert(const _Tp& __key, bool __sup) { #if _GLIBCXX_ASSERTIONS // no dummy sequence can ever be at the top! _GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1); #endif const _Tp* __keyp = &__key; int __source = _M_losers[0]._M_source; for (unsigned int __pos = (_M_k + __source) / 2; __pos > 0; __pos /= 2) { // The smaller one gets promoted. if (__sup || (!_M_losers[__pos]._M_sup && _M_comp(*_M_losers[__pos]._M_keyp, *__keyp))) { // The other one is smaller. std::swap(_M_losers[__pos]._M_sup, __sup); std::swap(_M_losers[__pos]._M_source, __source); std::swap(_M_losers[__pos]._M_keyp, __keyp); } } _M_losers[0]._M_sup = __sup; _M_losers[0]._M_source = __source; _M_losers[0]._M_keyp = __keyp; } }; /** @brief Base class for unguarded _LoserTree implementation. * * The whole element is copied into the tree structure. * * No guarding is done, therefore not a single input sequence must * run empty. Unused __sequence heads are marked with a sentinel which * is > all elements that are to be merged. * * This is a very fast variant. */ template<typename _Tp, typename _Compare> class _LoserTreeUnguardedBase { protected: struct _Loser { int _M_source; _Tp _M_key; }; unsigned int _M_ik, _M_k, _M_offset; _Loser* _M_losers; _Compare _M_comp; public: _LoserTreeUnguardedBase(unsigned int __k, const _Tp& __sentinel, _Compare __comp = std::less<_Tp>()) : _M_comp(__comp) { _M_ik = __k; // Next greater power of 2. _M_k = 1 << (__rd_log2(_M_ik - 1) + 1); _M_offset = _M_k; // Avoid default-constructing _M_losers[]._M_key _M_losers = static_cast<_Loser*>(::operator new(2 * _M_k * sizeof(_Loser))); for (unsigned int __i = 0; __i < _M_k; ++__i) { ::new(&(_M_losers[__i]._M_key)) _Tp(__sentinel); _M_losers[__i]._M_source = -1; } for (unsigned int __i = _M_k + _M_ik - 1; __i < (2 * _M_k); ++__i) { ::new(&(_M_losers[__i]._M_key)) _Tp(__sentinel); _M_losers[__i]._M_source = -1; } } ~_LoserTreeUnguardedBase() { for (unsigned int __i = 0; __i < (2 * _M_k); ++__i) _M_losers[__i].~_Loser(); ::operator delete(_M_losers); } int __get_min_source() { #if _GLIBCXX_ASSERTIONS // no dummy sequence can ever be at the top! _GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1); #endif return _M_losers[0]._M_source; } void __insert_start(const _Tp& __key, int __source, bool) { unsigned int __pos = _M_k + __source; ::new(&(_M_losers[__pos]._M_key)) _Tp(__key); _M_losers[__pos]._M_source = __source; } }; /** * @brief Stable implementation of unguarded _LoserTree. * * Unstable variant is selected below with partial specialization. */ template<bool __stable/* default == true */, typename _Tp, typename _Compare> class _LoserTreeUnguarded : public _LoserTreeUnguardedBase<_Tp, _Compare> { typedef _LoserTreeUnguardedBase<_Tp, _Compare> _Base; using _Base::_M_k; using _Base::_M_comp; using _Base::_M_losers; public: _LoserTreeUnguarded(unsigned int __k, const _Tp& __sentinel, _Compare __comp = std::less<_Tp>()) : _Base::_LoserTreeUnguardedBase(__k, __sentinel, __comp) { } unsigned int __init_winner(unsigned int __root) { if (__root >= _M_k) return __root; else { unsigned int __left = __init_winner(2 * __root); unsigned int __right = __init_winner(2 * __root + 1); if (!_M_comp(_M_losers[__right]._M_key, _M_losers[__left]._M_key)) { // Left one is less or equal. _M_losers[__root] = _M_losers[__right]; return __left; } else { // Right one is less. _M_losers[__root] = _M_losers[__left]; return __right; } } } void __init() { _M_losers[0] = _M_losers[__init_winner(1)]; #if _GLIBCXX_ASSERTIONS // no dummy sequence can ever be at the top at the beginning // (0 sequences!) _GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1); #endif } // Do not pass a const reference since __key will be used as // local variable. void __delete_min_insert(_Tp __key, bool) { using std::swap; #if _GLIBCXX_ASSERTIONS // no dummy sequence can ever be at the top! _GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1); #endif int __source = _M_losers[0]._M_source; for (unsigned int __pos = (_M_k + __source) / 2; __pos > 0; __pos /= 2) { // The smaller one gets promoted, ties are broken by _M_source. if (_M_comp(_M_losers[__pos]._M_key, __key) || (!_M_comp(__key, _M_losers[__pos]._M_key) && _M_losers[__pos]._M_source < __source)) { // The other one is smaller. std::swap(_M_losers[__pos]._M_source, __source); swap(_M_losers[__pos]._M_key, __key); } } _M_losers[0]._M_source = __source; _M_losers[0]._M_key = __key; } }; /** * @brief Non-Stable implementation of unguarded _LoserTree. * * Stable implementation is above. */ template<typename _Tp, typename _Compare> class _LoserTreeUnguarded</* __stable == */false, _Tp, _Compare> : public _LoserTreeUnguardedBase<_Tp, _Compare> { typedef _LoserTreeUnguardedBase<_Tp, _Compare> _Base; using _Base::_M_k; using _Base::_M_comp; using _Base::_M_losers; public: _LoserTreeUnguarded(unsigned int __k, const _Tp& __sentinel, _Compare __comp = std::less<_Tp>()) : _Base::_LoserTreeUnguardedBase(__k, __sentinel, __comp) { } unsigned int __init_winner(unsigned int __root) { if (__root >= _M_k) return __root; else { unsigned int __left = __init_winner(2 * __root); unsigned int __right = __init_winner(2 * __root + 1); #if _GLIBCXX_ASSERTIONS // If __left one is sentinel then __right one must be, too. if (_M_losers[__left]._M_source == -1) _GLIBCXX_PARALLEL_ASSERT(_M_losers[__right]._M_source == -1); #endif if (!_M_comp(_M_losers[__right]._M_key, _M_losers[__left]._M_key)) { // Left one is less or equal. _M_losers[__root] = _M_losers[__right]; return __left; } else { // Right one is less. _M_losers[__root] = _M_losers[__left]; return __right; } } } void __init() { _M_losers[0] = _M_losers[__init_winner(1)]; #if _GLIBCXX_ASSERTIONS // no dummy sequence can ever be at the top at the beginning // (0 sequences!) _GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1); #endif } // Do not pass a const reference since __key will be used as // local variable. void __delete_min_insert(_Tp __key, bool) { using std::swap; #if _GLIBCXX_ASSERTIONS // no dummy sequence can ever be at the top! _GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1); #endif int __source = _M_losers[0]._M_source; for (unsigned int __pos = (_M_k + __source) / 2; __pos > 0; __pos /= 2) { // The smaller one gets promoted. if (_M_comp(_M_losers[__pos]._M_key, __key)) { // The other one is smaller. std::swap(_M_losers[__pos]._M_source, __source); swap(_M_losers[__pos]._M_key, __key); } } _M_losers[0]._M_source = __source; _M_losers[0]._M_key = __key; } }; /** @brief Unguarded loser tree, keeping only pointers to the * elements in the tree structure. * * No guarding is done, therefore not a single input sequence must * run empty. This is a very fast variant. */ template<typename _Tp, typename _Compare> class _LoserTreePointerUnguardedBase { protected: struct _Loser { int _M_source; const _Tp* _M_keyp; }; unsigned int _M_ik, _M_k, _M_offset; _Loser* _M_losers; _Compare _M_comp; public: _LoserTreePointerUnguardedBase(unsigned int __k, const _Tp& __sentinel, _Compare __comp = std::less<_Tp>()) : _M_comp(__comp) { _M_ik = __k; // Next greater power of 2. _M_k = 1 << (__rd_log2(_M_ik - 1) + 1); _M_offset = _M_k; // Avoid default-constructing _M_losers[]._M_key _M_losers = new _Loser[2 * _M_k]; for (unsigned int __i = _M_k + _M_ik - 1; __i < (2 * _M_k); ++__i) { _M_losers[__i]._M_keyp = &__sentinel; _M_losers[__i]._M_source = -1; } } ~_LoserTreePointerUnguardedBase() { delete[] _M_losers; } int __get_min_source() { #if _GLIBCXX_ASSERTIONS // no dummy sequence can ever be at the top! _GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1); #endif return _M_losers[0]._M_source; } void __insert_start(const _Tp& __key, int __source, bool) { unsigned int __pos = _M_k + __source; _M_losers[__pos]._M_keyp = &__key; _M_losers[__pos]._M_source = __source; } }; /** * @brief Stable unguarded _LoserTree variant storing pointers. * * Unstable variant is implemented below using partial specialization. */ template<bool __stable/* default == true */, typename _Tp, typename _Compare> class _LoserTreePointerUnguarded : public _LoserTreePointerUnguardedBase<_Tp, _Compare> { typedef _LoserTreePointerUnguardedBase<_Tp, _Compare> _Base; using _Base::_M_k; using _Base::_M_comp; using _Base::_M_losers; public: _LoserTreePointerUnguarded(unsigned int __k, const _Tp& __sentinel, _Compare __comp = std::less<_Tp>()) : _Base::_LoserTreePointerUnguardedBase(__k, __sentinel, __comp) { } unsigned int __init_winner(unsigned int __root) { if (__root >= _M_k) return __root; else { unsigned int __left = __init_winner(2 * __root); unsigned int __right = __init_winner(2 * __root + 1); if (!_M_comp(*_M_losers[__right]._M_keyp, *_M_losers[__left]._M_keyp)) { // Left one is less or equal. _M_losers[__root] = _M_losers[__right]; return __left; } else { // Right one is less. _M_losers[__root] = _M_losers[__left]; return __right; } } } void __init() { _M_losers[0] = _M_losers[__init_winner(1)]; #if _GLIBCXX_ASSERTIONS // no dummy sequence can ever be at the top at the beginning // (0 sequences!) _GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1); #endif } void __delete_min_insert(const _Tp& __key, bool __sup) { #if _GLIBCXX_ASSERTIONS // no dummy sequence can ever be at the top! _GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1); #endif const _Tp* __keyp = &__key; int __source = _M_losers[0]._M_source; for (unsigned int __pos = (_M_k + __source) / 2; __pos > 0; __pos /= 2) { // The smaller one gets promoted, ties are broken by _M_source. if (_M_comp(*_M_losers[__pos]._M_keyp, *__keyp) || (!_M_comp(*__keyp, *_M_losers[__pos]._M_keyp) && _M_losers[__pos]._M_source < __source)) { // The other one is smaller. std::swap(_M_losers[__pos]._M_source, __source); std::swap(_M_losers[__pos]._M_keyp, __keyp); } } _M_losers[0]._M_source = __source; _M_losers[0]._M_keyp = __keyp; } }; /** * @brief Unstable unguarded _LoserTree variant storing pointers. * * Stable variant is above. */ template<typename _Tp, typename _Compare> class _LoserTreePointerUnguarded</* __stable == */false, _Tp, _Compare> : public _LoserTreePointerUnguardedBase<_Tp, _Compare> { typedef _LoserTreePointerUnguardedBase<_Tp, _Compare> _Base; using _Base::_M_k; using _Base::_M_comp; using _Base::_M_losers; public: _LoserTreePointerUnguarded(unsigned int __k, const _Tp& __sentinel, _Compare __comp = std::less<_Tp>()) : _Base::_LoserTreePointerUnguardedBase(__k, __sentinel, __comp) { } unsigned int __init_winner(unsigned int __root) { if (__root >= _M_k) return __root; else { unsigned int __left = __init_winner(2 * __root); unsigned int __right = __init_winner(2 * __root + 1); #if _GLIBCXX_ASSERTIONS // If __left one is sentinel then __right one must be, too. if (_M_losers[__left]._M_source == -1) _GLIBCXX_PARALLEL_ASSERT(_M_losers[__right]._M_source == -1); #endif if (!_M_comp(*_M_losers[__right]._M_keyp, *_M_losers[__left]._M_keyp)) { // Left one is less or equal. _M_losers[__root] = _M_losers[__right]; return __left; } else { // Right one is less. _M_losers[__root] = _M_losers[__left]; return __right; } } } void __init() { _M_losers[0] = _M_losers[__init_winner(1)]; #if _GLIBCXX_ASSERTIONS // no dummy sequence can ever be at the top at the beginning // (0 sequences!) _GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1); #endif } void __delete_min_insert(const _Tp& __key, bool __sup) { #if _GLIBCXX_ASSERTIONS // no dummy sequence can ever be at the top! _GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1); #endif const _Tp* __keyp = &__key; int __source = _M_losers[0]._M_source; for (unsigned int __pos = (_M_k + __source) / 2; __pos > 0; __pos /= 2) { // The smaller one gets promoted. if (_M_comp(*(_M_losers[__pos]._M_keyp), *__keyp)) { // The other one is smaller. std::swap(_M_losers[__pos]._M_source, __source); std::swap(_M_losers[__pos]._M_keyp, __keyp); } } _M_losers[0]._M_source = __source; _M_losers[0]._M_keyp = __keyp; } }; } // namespace __gnu_parallel #endif /* _GLIBCXX_PARALLEL_LOSERTREE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/checkers.h�����������������������������������������������������������������������0000644�����������������00000004374�14763166027�0011345 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/checkers.h * @brief Routines for checking the correctness of algorithm results. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler. #ifndef _GLIBCXX_PARALLEL_CHECKERS_H #define _GLIBCXX_PARALLEL_CHECKERS_H 1 #include <cstdio> #include <bits/stl_algobase.h> #include <bits/stl_function.h> namespace __gnu_parallel { /** * @brief Check whether @c [__begin, @c __end) is sorted according * to @c __comp. * @param __begin Begin iterator of sequence. * @param __end End iterator of sequence. * @param __comp Comparator. * @return @c true if sorted, @c false otherwise. */ template<typename _IIter, typename _Compare> bool __is_sorted(_IIter __begin, _IIter __end, _Compare __comp) { if (__begin == __end) return true; _IIter __current(__begin), __recent(__begin); unsigned long long __position = 1; for (__current++; __current != __end; __current++) { if (__comp(*__current, *__recent)) { return false; } __recent = __current; __position++; } return true; } } #endif /* _GLIBCXX_PARALLEL_CHECKERS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/iterator.h�����������������������������������������������������������������������0000644�����������������00000013056�14763166027�0011404 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/iterator.h * @brief Helper iterator classes for the std::transform() functions. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler. #ifndef _GLIBCXX_PARALLEL_ITERATOR_H #define _GLIBCXX_PARALLEL_ITERATOR_H 1 #include <parallel/basic_iterator.h> #include <bits/stl_pair.h> namespace __gnu_parallel { /** @brief A pair of iterators. The usual iterator operations are * applied to both child iterators. */ template<typename _Iterator1, typename _Iterator2, typename _IteratorCategory> class _IteratorPair : public std::pair<_Iterator1, _Iterator2> { private: typedef std::pair<_Iterator1, _Iterator2> _Base; public: typedef _IteratorCategory iterator_category; typedef void value_type; typedef std::iterator_traits<_Iterator1> _TraitsType; typedef typename _TraitsType::difference_type difference_type; typedef _IteratorPair* pointer; typedef _IteratorPair& reference; _IteratorPair() { } _IteratorPair(const _Iterator1& __first, const _Iterator2& __second) : _Base(__first, __second) { } // Pre-increment operator. _IteratorPair& operator++() { ++_Base::first; ++_Base::second; return *this; } // Post-increment operator. const _IteratorPair operator++(int) { return _IteratorPair(_Base::first++, _Base::second++); } // Pre-decrement operator. _IteratorPair& operator--() { --_Base::first; --_Base::second; return *this; } // Post-decrement operator. const _IteratorPair operator--(int) { return _IteratorPair(_Base::first--, _Base::second--); } // Type conversion. operator _Iterator2() const { return _Base::second; } _IteratorPair& operator=(const _IteratorPair& __other) { _Base::first = __other.first; _Base::second = __other.second; return *this; } _IteratorPair operator+(difference_type __delta) const { return _IteratorPair(_Base::first + __delta, _Base::second + __delta); } difference_type operator-(const _IteratorPair& __other) const { return _Base::first - __other.first; } }; /** @brief A triple of iterators. The usual iterator operations are applied to all three child iterators. */ template<typename _Iterator1, typename _Iterator2, typename _Iterator3, typename _IteratorCategory> class _IteratorTriple { public: typedef _IteratorCategory iterator_category; typedef void value_type; typedef typename std::iterator_traits<_Iterator1>::difference_type difference_type; typedef _IteratorTriple* pointer; typedef _IteratorTriple& reference; _Iterator1 _M_first; _Iterator2 _M_second; _Iterator3 _M_third; _IteratorTriple() { } _IteratorTriple(const _Iterator1& __first, const _Iterator2& __second, const _Iterator3& __third) { _M_first = __first; _M_second = __second; _M_third = __third; } // Pre-increment operator. _IteratorTriple& operator++() { ++_M_first; ++_M_second; ++_M_third; return *this; } // Post-increment operator. const _IteratorTriple operator++(int) { return _IteratorTriple(_M_first++, _M_second++, _M_third++); } // Pre-decrement operator. _IteratorTriple& operator--() { --_M_first; --_M_second; --_M_third; return *this; } // Post-decrement operator. const _IteratorTriple operator--(int) { return _IteratorTriple(_M_first--, _M_second--, _M_third--); } // Type conversion. operator _Iterator3() const { return _M_third; } _IteratorTriple& operator=(const _IteratorTriple& __other) { _M_first = __other._M_first; _M_second = __other._M_second; _M_third = __other._M_third; return *this; } _IteratorTriple operator+(difference_type __delta) const { return _IteratorTriple(_M_first + __delta, _M_second + __delta, _M_third + __delta); } difference_type operator-(const _IteratorTriple& __other) const { return _M_first - __other._M_first; } }; } #endif /* _GLIBCXX_PARALLEL_ITERATOR_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/omp_loop_static.h����������������������������������������������������������������0000644�����������������00000010010�14763166027�0012731 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/omp_loop_static.h * @brief Parallelization of embarrassingly parallel execution by * means of an OpenMP for loop with static scheduling. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Felix Putze. #ifndef _GLIBCXX_PARALLEL_OMP_LOOP_STATIC_H #define _GLIBCXX_PARALLEL_OMP_LOOP_STATIC_H 1 #include <omp.h> #include <parallel/settings.h> #include <parallel/basic_iterator.h> namespace __gnu_parallel { /** @brief Embarrassingly parallel algorithm for random access * iterators, using an OpenMP for loop with static scheduling. * * @param __begin Begin iterator of element sequence. * @param __end End iterator of element sequence. * @param __o User-supplied functor (comparator, predicate, adding * functor, ...). * @param __f Functor to @a process an element with __op (depends on * desired functionality, e. g. for std::for_each(), ...). * @param __r Functor to @a add a single __result to the already processed * __elements (depends on functionality). * @param __base Base value for reduction. * @param __output Pointer to position where final result is written to * @param __bound Maximum number of elements processed (e. g. for * std::count_n()). * @return User-supplied functor (that may contain a part of the result). */ template<typename _RAIter, typename _Op, typename _Fu, typename _Red, typename _Result> _Op __for_each_template_random_access_omp_loop_static(_RAIter __begin, _RAIter __end, _Op __o, _Fu& __f, _Red __r, _Result __base, _Result& __output, typename std::iterator_traits<_RAIter>::difference_type __bound) { typedef typename std::iterator_traits<_RAIter>::difference_type _DifferenceType; _DifferenceType __length = __end - __begin; _ThreadIndex __num_threads = std::min<_DifferenceType> (__get_max_threads(), __length); _Result *__thread_results; # pragma omp parallel num_threads(__num_threads) { # pragma omp single { __num_threads = omp_get_num_threads(); __thread_results = new _Result[__num_threads]; for (_ThreadIndex __i = 0; __i < __num_threads; ++__i) __thread_results[__i] = _Result(); } _ThreadIndex __iam = omp_get_thread_num(); #pragma omp for schedule(static, _Settings::get().workstealing_chunk_size) for (_DifferenceType __pos = 0; __pos < __length; ++__pos) __thread_results[__iam] = __r(__thread_results[__iam], __f(__o, __begin+__pos)); } //parallel for (_ThreadIndex __i = 0; __i < __num_threads; ++__i) __output = __r(__output, __thread_results[__i]); delete [] __thread_results; // Points to last element processed (needed as return value for // some algorithms like transform). __f.finish_iterator = __begin + __length; return __o; } } // end namespace #endif /* _GLIBCXX_PARALLEL_OMP_LOOP_STATIC_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/quicksort.h����������������������������������������������������������������������0000644�����������������00000013756�14763166027�0011606 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/quicksort.h * @brief Implementation of a unbalanced parallel quicksort (in-place). * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler. #ifndef _GLIBCXX_PARALLEL_QUICKSORT_H #define _GLIBCXX_PARALLEL_QUICKSORT_H 1 #include <parallel/parallel.h> #include <parallel/partition.h> namespace __gnu_parallel { /** @brief Unbalanced quicksort divide step. * @param __begin Begin iterator of subsequence. * @param __end End iterator of subsequence. * @param __comp Comparator. * @param __pivot_rank Desired __rank of the pivot. * @param __num_samples Choose pivot from that many samples. * @param __num_threads Number of threads that are allowed to work on * this part. */ template<typename _RAIter, typename _Compare> typename std::iterator_traits<_RAIter>::difference_type __parallel_sort_qs_divide(_RAIter __begin, _RAIter __end, _Compare __comp, typename std::iterator_traits <_RAIter>::difference_type __pivot_rank, typename std::iterator_traits <_RAIter>::difference_type __num_samples, _ThreadIndex __num_threads) { typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; _DifferenceType __n = __end - __begin; __num_samples = std::min(__num_samples, __n); // Allocate uninitialized, to avoid default constructor. _ValueType* __samples = static_cast<_ValueType*> (::operator new(__num_samples * sizeof(_ValueType))); for (_DifferenceType __s = 0; __s < __num_samples; ++__s) { const unsigned long long __index = static_cast<unsigned long long> (__s) * __n / __num_samples; ::new(&(__samples[__s])) _ValueType(__begin[__index]); } __gnu_sequential::sort(__samples, __samples + __num_samples, __comp); _ValueType& __pivot = __samples[__pivot_rank * __num_samples / __n]; __gnu_parallel::__binder2nd<_Compare, _ValueType, _ValueType, bool> __pred(__comp, __pivot); _DifferenceType __split = __parallel_partition(__begin, __end, __pred, __num_threads); for (_DifferenceType __s = 0; __s < __num_samples; ++__s) __samples[__s].~_ValueType(); ::operator delete(__samples); return __split; } /** @brief Unbalanced quicksort conquer step. * @param __begin Begin iterator of subsequence. * @param __end End iterator of subsequence. * @param __comp Comparator. * @param __num_threads Number of threads that are allowed to work on * this part. */ template<typename _RAIter, typename _Compare> void __parallel_sort_qs_conquer(_RAIter __begin, _RAIter __end, _Compare __comp, _ThreadIndex __num_threads) { typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; if (__num_threads <= 1) { __gnu_sequential::sort(__begin, __end, __comp); return; } _DifferenceType __n = __end - __begin, __pivot_rank; if (__n <= 1) return; _ThreadIndex __num_threads_left; if ((__num_threads % 2) == 1) __num_threads_left = __num_threads / 2 + 1; else __num_threads_left = __num_threads / 2; __pivot_rank = __n * __num_threads_left / __num_threads; _DifferenceType __split = __parallel_sort_qs_divide (__begin, __end, __comp, __pivot_rank, _Settings::get().sort_qs_num_samples_preset, __num_threads); #pragma omp parallel sections num_threads(2) { #pragma omp section __parallel_sort_qs_conquer(__begin, __begin + __split, __comp, __num_threads_left); #pragma omp section __parallel_sort_qs_conquer(__begin + __split, __end, __comp, __num_threads - __num_threads_left); } } /** @brief Unbalanced quicksort main call. * @param __begin Begin iterator of input sequence. * @param __end End iterator input sequence, ignored. * @param __comp Comparator. * @param __num_threads Number of threads that are allowed to work on * this part. */ template<typename _RAIter, typename _Compare> void __parallel_sort_qs(_RAIter __begin, _RAIter __end, _Compare __comp, _ThreadIndex __num_threads) { _GLIBCXX_CALL(__n) typedef std::iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; _DifferenceType __n = __end - __begin; // At least one element per processor. if (__num_threads > __n) __num_threads = static_cast<_ThreadIndex>(__n); __parallel_sort_qs_conquer( __begin, __begin + __n, __comp, __num_threads); } } //namespace __gnu_parallel #endif /* _GLIBCXX_PARALLEL_QUICKSORT_H */ ������������������c++/4.8.2/parallel/list_partition.h�����������������������������������������������������������������0000644�����������������00000014612�14763166027�0012616 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/list_partition.h * @brief _Functionality to split __sequence referenced by only input * iterators. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Leonor Frias Moya and Johannes Singler. #ifndef _GLIBCXX_PARALLEL_LIST_PARTITION_H #define _GLIBCXX_PARALLEL_LIST_PARTITION_H 1 #include <parallel/parallel.h> #include <vector> namespace __gnu_parallel { /** @brief Shrinks and doubles the ranges. * @param __os_starts Start positions worked on (oversampled). * @param __count_to_two Counts up to 2. * @param __range_length Current length of a chunk. * @param __make_twice Whether the @c __os_starts is allowed to be * grown or not */ template<typename _IIter> void __shrink_and_double(std::vector<_IIter>& __os_starts, size_t& __count_to_two, size_t& __range_length, const bool __make_twice) { ++__count_to_two; if (!__make_twice || __count_to_two < 2) __shrink(__os_starts, __count_to_two, __range_length); else { __os_starts.resize((__os_starts.size() - 1) * 2 + 1); __count_to_two = 0; } } /** @brief Combines two ranges into one and thus halves the number of ranges. * @param __os_starts Start positions worked on (oversampled). * @param __count_to_two Counts up to 2. * @param __range_length Current length of a chunk. */ template<typename _IIter> void __shrink(std::vector<_IIter>& __os_starts, size_t& __count_to_two, size_t& __range_length) { for (typename std::vector<_IIter>::size_type __i = 0; __i <= (__os_starts.size() / 2); ++__i) __os_starts[__i] = __os_starts[__i * 2]; __range_length *= 2; } /** @brief Splits a sequence given by input iterators into parts of * almost equal size * * The function needs only one pass over the sequence. * @param __begin Begin iterator of input sequence. * @param __end End iterator of input sequence. * @param __starts Start iterators for the resulting parts, dimension * @c __num_parts+1. For convenience, @c __starts @c [__num_parts] * contains the end iterator of the sequence. * @param __lengths Length of the resulting parts. * @param __num_parts Number of parts to split the sequence into. * @param __f Functor to be applied to each element by traversing __it * @param __oversampling Oversampling factor. If 0, then the * partitions will differ in at most * \sqrt{\mathrm{__end} - \mathrm{__begin}} * __elements. Otherwise, the ratio between the * longest and the shortest part is bounded by * 1/(\mathrm{__oversampling} \cdot \mathrm{num\_parts}) * @return Length of the whole sequence. */ template<typename _IIter, typename _FunctorType> size_t list_partition(const _IIter __begin, const _IIter __end, _IIter* __starts, size_t* __lengths, const int __num_parts, _FunctorType& __f, int __oversampling = 0) { bool __make_twice = false; // The resizing algorithm is chosen according to the oversampling factor. if (__oversampling == 0) { __make_twice = true; __oversampling = 1; } std::vector<_IIter> __os_starts(2 * __oversampling * __num_parts + 1); __os_starts[0] = __begin; _IIter __prev = __begin, __it = __begin; size_t __dist_limit = 0, __dist = 0; size_t __cur = 1, __next = 1; size_t __range_length = 1; size_t __count_to_two = 0; while (__it != __end) { __cur = __next; for (; __cur < __os_starts.size() and __it != __end; ++__cur) { for (__dist_limit += __range_length; __dist < __dist_limit and __it != __end; ++__dist) { __f(__it); ++__it; } __os_starts[__cur] = __it; } // Must compare for end and not __cur < __os_starts.size() , because // __cur could be == __os_starts.size() as well if (__it == __end) break; __shrink_and_double(__os_starts, __count_to_two, __range_length, __make_twice); __next = __os_starts.size() / 2 + 1; } // Calculation of the parts (one must be extracted from __current // because the partition beginning at end, consists only of // itself). size_t __size_part = (__cur - 1) / __num_parts; int __size_greater = static_cast<int>((__cur - 1) % __num_parts); __starts[0] = __os_starts[0]; size_t __index = 0; // Smallest partitions. for (int __i = 1; __i < (__num_parts + 1 - __size_greater); ++__i) { __lengths[__i - 1] = __size_part * __range_length; __index += __size_part; __starts[__i] = __os_starts[__index]; } // Biggest partitions. for (int __i = __num_parts + 1 - __size_greater; __i <= __num_parts; ++__i) { __lengths[__i - 1] = (__size_part+1) * __range_length; __index += (__size_part+1); __starts[__i] = __os_starts[__index]; } // Correction of the end size (the end iteration has not finished). __lengths[__num_parts - 1] -= (__dist_limit - __dist); return __dist; } } #endif /* _GLIBCXX_PARALLEL_LIST_PARTITION_H */ ����������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/algobase.h�����������������������������������������������������������������������0000644�����������������00000026663�14763166027�0011340 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/algobase.h * @brief Parallel STL function calls corresponding to the * stl_algobase.h header. The functions defined here mainly do case * switches and call the actual parallelized versions in other files. * Inlining policy: Functions that basically only contain one * function call, are declared inline. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler and Felix Putze. #ifndef _GLIBCXX_PARALLEL_ALGOBASE_H #define _GLIBCXX_PARALLEL_ALGOBASE_H 1 #include <bits/stl_algobase.h> #include <parallel/base.h> #include <parallel/algorithmfwd.h> #include <parallel/find.h> #include <parallel/find_selectors.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace __parallel { // NB: equal and lexicographical_compare require mismatch. // Sequential fallback template<typename _IIter1, typename _IIter2> inline pair<_IIter1, _IIter2> mismatch(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::mismatch(__begin1, __end1, __begin2); } // Sequential fallback template<typename _IIter1, typename _IIter2, typename _Predicate> inline pair<_IIter1, _IIter2> mismatch(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _Predicate __pred, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::mismatch(__begin1, __end1, __begin2, __pred); } // Sequential fallback for input iterator case template<typename _IIter1, typename _IIter2, typename _Predicate, typename _IteratorTag1, typename _IteratorTag2> inline pair<_IIter1, _IIter2> __mismatch_switch(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _Predicate __pred, _IteratorTag1, _IteratorTag2) { return _GLIBCXX_STD_A::mismatch(__begin1, __end1, __begin2, __pred); } // Parallel mismatch for random access iterators template<typename _RAIter1, typename _RAIter2, typename _Predicate> pair<_RAIter1, _RAIter2> __mismatch_switch(_RAIter1 __begin1, _RAIter1 __end1, _RAIter2 __begin2, _Predicate __pred, random_access_iterator_tag, random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION(true)) { _RAIter1 __res = __gnu_parallel::__find_template(__begin1, __end1, __begin2, __pred, __gnu_parallel:: __mismatch_selector()).first; return make_pair(__res , __begin2 + (__res - __begin1)); } else return _GLIBCXX_STD_A::mismatch(__begin1, __end1, __begin2, __pred); } // Public interface template<typename _IIter1, typename _IIter2> inline pair<_IIter1, _IIter2> mismatch(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2) { typedef std::iterator_traits<_IIter1> _Iterator1Traits; typedef std::iterator_traits<_IIter2> _Iterator2Traits; typedef typename _Iterator1Traits::value_type _ValueType1; typedef typename _Iterator2Traits::value_type _ValueType2; typedef typename _Iterator1Traits::iterator_category _IteratorCategory1; typedef typename _Iterator2Traits::iterator_category _IteratorCategory2; typedef __gnu_parallel::_EqualTo<_ValueType1, _ValueType2> _EqualTo; return __mismatch_switch(__begin1, __end1, __begin2, _EqualTo(), _IteratorCategory1(), _IteratorCategory2()); } // Public interface template<typename _IIter1, typename _IIter2, typename _Predicate> inline pair<_IIter1, _IIter2> mismatch(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _Predicate __pred) { typedef std::iterator_traits<_IIter1> _Iterator1Traits; typedef std::iterator_traits<_IIter2> _Iterator2Traits; typedef typename _Iterator1Traits::iterator_category _IteratorCategory1; typedef typename _Iterator2Traits::iterator_category _IteratorCategory2; return __mismatch_switch(__begin1, __end1, __begin2, __pred, _IteratorCategory1(), _IteratorCategory2()); } // Sequential fallback template<typename _IIter1, typename _IIter2> inline bool equal(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::equal(__begin1, __end1, __begin2); } // Sequential fallback template<typename _IIter1, typename _IIter2, typename _Predicate> inline bool equal(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _Predicate __pred, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::equal(__begin1, __end1, __begin2, __pred); } // Public interface template<typename _IIter1, typename _IIter2> inline bool equal(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2) { return __gnu_parallel::mismatch(__begin1, __end1, __begin2).first == __end1; } // Public interface template<typename _IIter1, typename _IIter2, typename _Predicate> inline bool equal(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _Predicate __pred) { return __gnu_parallel::mismatch(__begin1, __end1, __begin2, __pred).first == __end1; } // Sequential fallback template<typename _IIter1, typename _IIter2> inline bool lexicographical_compare(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::lexicographical_compare(__begin1, __end1, __begin2, __end2); } // Sequential fallback template<typename _IIter1, typename _IIter2, typename _Predicate> inline bool lexicographical_compare(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _Predicate __pred, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_A::lexicographical_compare( __begin1, __end1, __begin2, __end2, __pred); } // Sequential fallback for input iterator case template<typename _IIter1, typename _IIter2, typename _Predicate, typename _IteratorTag1, typename _IteratorTag2> inline bool __lexicographical_compare_switch(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _Predicate __pred, _IteratorTag1, _IteratorTag2) { return _GLIBCXX_STD_A::lexicographical_compare( __begin1, __end1, __begin2, __end2, __pred); } // Parallel lexicographical_compare for random access iterators // Limitation: Both valuetypes must be the same template<typename _RAIter1, typename _RAIter2, typename _Predicate> bool __lexicographical_compare_switch(_RAIter1 __begin1, _RAIter1 __end1, _RAIter2 __begin2, _RAIter2 __end2, _Predicate __pred, random_access_iterator_tag, random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION(true)) { typedef iterator_traits<_RAIter1> _TraitsType1; typedef typename _TraitsType1::value_type _ValueType1; typedef iterator_traits<_RAIter2> _TraitsType2; typedef typename _TraitsType2::value_type _ValueType2; typedef __gnu_parallel:: _EqualFromLess<_ValueType1, _ValueType2, _Predicate> _EqualFromLessCompare; // Longer sequence in first place. if ((__end1 - __begin1) < (__end2 - __begin2)) { typedef pair<_RAIter1, _RAIter2> _SpotType; _SpotType __mm = __mismatch_switch(__begin1, __end1, __begin2, _EqualFromLessCompare(__pred), random_access_iterator_tag(), random_access_iterator_tag()); return (__mm.first == __end1) || bool(__pred(*__mm.first, *__mm.second)); } else { typedef pair<_RAIter2, _RAIter1> _SpotType; _SpotType __mm = __mismatch_switch(__begin2, __end2, __begin1, _EqualFromLessCompare(__pred), random_access_iterator_tag(), random_access_iterator_tag()); return (__mm.first != __end2) && bool(__pred(*__mm.second, *__mm.first)); } } else return _GLIBCXX_STD_A::lexicographical_compare( __begin1, __end1, __begin2, __end2, __pred); } // Public interface template<typename _IIter1, typename _IIter2> inline bool lexicographical_compare(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2) { typedef iterator_traits<_IIter1> _TraitsType1; typedef typename _TraitsType1::value_type _ValueType1; typedef typename _TraitsType1::iterator_category _IteratorCategory1; typedef iterator_traits<_IIter2> _TraitsType2; typedef typename _TraitsType2::value_type _ValueType2; typedef typename _TraitsType2::iterator_category _IteratorCategory2; typedef __gnu_parallel::_Less<_ValueType1, _ValueType2> _LessType; return __lexicographical_compare_switch( __begin1, __end1, __begin2, __end2, _LessType(), _IteratorCategory1(), _IteratorCategory2()); } // Public interface template<typename _IIter1, typename _IIter2, typename _Predicate> inline bool lexicographical_compare(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2, _Predicate __pred) { typedef iterator_traits<_IIter1> _TraitsType1; typedef typename _TraitsType1::iterator_category _IteratorCategory1; typedef iterator_traits<_IIter2> _TraitsType2; typedef typename _TraitsType2::iterator_category _IteratorCategory2; return __lexicographical_compare_switch( __begin1, __end1, __begin2, __end2, __pred, _IteratorCategory1(), _IteratorCategory2()); } } // end namespace } // end namespace #endif /* _GLIBCXX_PARALLEL_ALGOBASE_H */ �����������������������������������������������������������������������������c++/4.8.2/parallel/for_each.h�����������������������������������������������������������������������0000644�����������������00000007553�14763166027�0011326 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/for_each.h * @brief Main interface for embarrassingly parallel functions. * * The explicit implementation are in other header files, like * workstealing.h, par_loop.h, omp_loop.h, and omp_loop_static.h. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Felix Putze. #ifndef _GLIBCXX_PARALLEL_FOR_EACH_H #define _GLIBCXX_PARALLEL_FOR_EACH_H 1 #include <parallel/settings.h> #include <parallel/par_loop.h> #include <parallel/omp_loop.h> #include <parallel/workstealing.h> namespace __gnu_parallel { /** @brief Chose the desired algorithm by evaluating @c __parallelism_tag. * @param __begin Begin iterator of input sequence. * @param __end End iterator of input sequence. * @param __user_op A user-specified functor (comparator, predicate, * associative operator,...) * @param __functionality functor to @a process an element with * __user_op (depends on desired functionality, e. g. accumulate, * for_each,... * @param __reduction Reduction functor. * @param __reduction_start Initial value for reduction. * @param __output Output iterator. * @param __bound Maximum number of elements processed. * @param __parallelism_tag Parallelization method */ template<typename _IIter, typename _UserOp, typename _Functionality, typename _Red, typename _Result> _UserOp __for_each_template_random_access(_IIter __begin, _IIter __end, _UserOp __user_op, _Functionality& __functionality, _Red __reduction, _Result __reduction_start, _Result& __output, typename std::iterator_traits<_IIter>:: difference_type __bound, _Parallelism __parallelism_tag) { if (__parallelism_tag == parallel_unbalanced) return __for_each_template_random_access_ed (__begin, __end, __user_op, __functionality, __reduction, __reduction_start, __output, __bound); else if (__parallelism_tag == parallel_omp_loop) return __for_each_template_random_access_omp_loop (__begin, __end, __user_op, __functionality, __reduction, __reduction_start, __output, __bound); else if (__parallelism_tag == parallel_omp_loop_static) return __for_each_template_random_access_omp_loop (__begin, __end, __user_op, __functionality, __reduction, __reduction_start, __output, __bound); else //e. g. parallel_balanced return __for_each_template_random_access_workstealing (__begin, __end, __user_op, __functionality, __reduction, __reduction_start, __output, __bound); } } #endif /* _GLIBCXX_PARALLEL_FOR_EACH_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/omp_loop.h�����������������������������������������������������������������������0000644�����������������00000007677�14763166027�0011413 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/omp_loop.h * @brief Parallelization of embarrassingly parallel execution by * means of an OpenMP for loop. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Felix Putze. #ifndef _GLIBCXX_PARALLEL_OMP_LOOP_H #define _GLIBCXX_PARALLEL_OMP_LOOP_H 1 #include <omp.h> #include <parallel/settings.h> #include <parallel/basic_iterator.h> #include <parallel/base.h> namespace __gnu_parallel { /** @brief Embarrassingly parallel algorithm for random access * iterators, using an OpenMP for loop. * * @param __begin Begin iterator of element sequence. * @param __end End iterator of element sequence. * @param __o User-supplied functor (comparator, predicate, adding * functor, etc.). * @param __f Functor to @a process an element with __op (depends on * desired functionality, e. g. for std::for_each(), ...). * @param __r Functor to @a add a single __result to the already * processed elements (depends on functionality). * @param __base Base value for reduction. * @param __output Pointer to position where final result is written to * @param __bound Maximum number of elements processed (e. g. for * std::count_n()). * @return User-supplied functor (that may contain a part of the result). */ template<typename _RAIter, typename _Op, typename _Fu, typename _Red, typename _Result> _Op __for_each_template_random_access_omp_loop(_RAIter __begin, _RAIter __end, _Op __o, _Fu& __f, _Red __r, _Result __base, _Result& __output, typename std::iterator_traits<_RAIter>::difference_type __bound) { typedef typename std::iterator_traits<_RAIter>::difference_type _DifferenceType; _DifferenceType __length = __end - __begin; _ThreadIndex __num_threads = __gnu_parallel::min<_DifferenceType> (__get_max_threads(), __length); _Result *__thread_results; # pragma omp parallel num_threads(__num_threads) { # pragma omp single { __num_threads = omp_get_num_threads(); __thread_results = new _Result[__num_threads]; for (_ThreadIndex __i = 0; __i < __num_threads; ++__i) __thread_results[__i] = _Result(); } _ThreadIndex __iam = omp_get_thread_num(); #pragma omp for schedule(dynamic, _Settings::get().workstealing_chunk_size) for (_DifferenceType __pos = 0; __pos < __length; ++__pos) __thread_results[__iam] = __r(__thread_results[__iam], __f(__o, __begin+__pos)); } //parallel for (_ThreadIndex __i = 0; __i < __num_threads; ++__i) __output = __r(__output, __thread_results[__i]); delete [] __thread_results; // Points to last element processed (needed as return value for // some algorithms like transform). __f._M_finish_iterator = __begin + __length; return __o; } } // end namespace #endif /* _GLIBCXX_PARALLEL_OMP_LOOP_H */ �����������������������������������������������������������������c++/4.8.2/parallel/multiseq_selection.h�������������������������������������������������������������0000644�����������������00000053073�14763166027�0013466 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/multiseq_selection.h * @brief Functions to find elements of a certain global __rank in * multiple sorted sequences. Also serves for splitting such * sequence sets. * * The algorithm description can be found in * * P. J. Varman, S. D. Scheufler, B. R. Iyer, and G. R. Ricard. * Merging Multiple Lists on Hierarchical-Memory Multiprocessors. * Journal of Parallel and Distributed Computing, 12(2):171–177, 1991. * * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler. #ifndef _GLIBCXX_PARALLEL_MULTISEQ_SELECTION_H #define _GLIBCXX_PARALLEL_MULTISEQ_SELECTION_H 1 #include <vector> #include <queue> #include <bits/stl_algo.h> namespace __gnu_parallel { /** @brief Compare __a pair of types lexicographically, ascending. */ template<typename _T1, typename _T2, typename _Compare> class _Lexicographic : public std::binary_function<std::pair<_T1, _T2>, std::pair<_T1, _T2>, bool> { private: _Compare& _M_comp; public: _Lexicographic(_Compare& __comp) : _M_comp(__comp) { } bool operator()(const std::pair<_T1, _T2>& __p1, const std::pair<_T1, _T2>& __p2) const { if (_M_comp(__p1.first, __p2.first)) return true; if (_M_comp(__p2.first, __p1.first)) return false; // Firsts are equal. return __p1.second < __p2.second; } }; /** @brief Compare __a pair of types lexicographically, descending. */ template<typename _T1, typename _T2, typename _Compare> class _LexicographicReverse : public std::binary_function<_T1, _T2, bool> { private: _Compare& _M_comp; public: _LexicographicReverse(_Compare& __comp) : _M_comp(__comp) { } bool operator()(const std::pair<_T1, _T2>& __p1, const std::pair<_T1, _T2>& __p2) const { if (_M_comp(__p2.first, __p1.first)) return true; if (_M_comp(__p1.first, __p2.first)) return false; // Firsts are equal. return __p2.second < __p1.second; } }; /** * @brief Splits several sorted sequences at a certain global __rank, * resulting in a splitting point for each sequence. * The sequences are passed via a sequence of random-access * iterator pairs, none of the sequences may be empty. If there * are several equal elements across the split, the ones on the * __left side will be chosen from sequences with smaller number. * @param __begin_seqs Begin of the sequence of iterator pairs. * @param __end_seqs End of the sequence of iterator pairs. * @param __rank The global rank to partition at. * @param __begin_offsets A random-access __sequence __begin where the * __result will be stored in. Each element of the sequence is an * iterator that points to the first element on the greater part of * the respective __sequence. * @param __comp The ordering functor, defaults to std::less<_Tp>. */ template<typename _RanSeqs, typename _RankType, typename _RankIterator, typename _Compare> void multiseq_partition(_RanSeqs __begin_seqs, _RanSeqs __end_seqs, _RankType __rank, _RankIterator __begin_offsets, _Compare __comp = std::less< typename std::iterator_traits<typename std::iterator_traits<_RanSeqs>::value_type:: first_type>::value_type>()) // std::less<_Tp> { _GLIBCXX_CALL(__end_seqs - __begin_seqs) typedef typename std::iterator_traits<_RanSeqs>::value_type::first_type _It; typedef typename std::iterator_traits<_RanSeqs>::difference_type _SeqNumber; typedef typename std::iterator_traits<_It>::difference_type _DifferenceType; typedef typename std::iterator_traits<_It>::value_type _ValueType; _Lexicographic<_ValueType, _SeqNumber, _Compare> __lcomp(__comp); _LexicographicReverse<_ValueType, _SeqNumber, _Compare> __lrcomp(__comp); // Number of sequences, number of elements in total (possibly // including padding). _DifferenceType __m = std::distance(__begin_seqs, __end_seqs), __nn = 0, __nmax, __n, __r; for (_SeqNumber __i = 0; __i < __m; __i++) { __nn += std::distance(__begin_seqs[__i].first, __begin_seqs[__i].second); _GLIBCXX_PARALLEL_ASSERT( std::distance(__begin_seqs[__i].first, __begin_seqs[__i].second) > 0); } if (__rank == __nn) { for (_SeqNumber __i = 0; __i < __m; __i++) __begin_offsets[__i] = __begin_seqs[__i].second; // Very end. // Return __m - 1; return; } _GLIBCXX_PARALLEL_ASSERT(__m != 0); _GLIBCXX_PARALLEL_ASSERT(__nn != 0); _GLIBCXX_PARALLEL_ASSERT(__rank >= 0); _GLIBCXX_PARALLEL_ASSERT(__rank < __nn); _DifferenceType* __ns = new _DifferenceType[__m]; _DifferenceType* __a = new _DifferenceType[__m]; _DifferenceType* __b = new _DifferenceType[__m]; _DifferenceType __l; __ns[0] = std::distance(__begin_seqs[0].first, __begin_seqs[0].second); __nmax = __ns[0]; for (_SeqNumber __i = 0; __i < __m; __i++) { __ns[__i] = std::distance(__begin_seqs[__i].first, __begin_seqs[__i].second); __nmax = std::max(__nmax, __ns[__i]); } __r = __rd_log2(__nmax) + 1; // Pad all lists to this length, at least as long as any ns[__i], // equality iff __nmax = 2^__k - 1. __l = (1ULL << __r) - 1; for (_SeqNumber __i = 0; __i < __m; __i++) { __a[__i] = 0; __b[__i] = __l; } __n = __l / 2; // Invariants: // 0 <= __a[__i] <= __ns[__i], 0 <= __b[__i] <= __l #define __S(__i) (__begin_seqs[__i].first) // Initial partition. std::vector<std::pair<_ValueType, _SeqNumber> > __sample; for (_SeqNumber __i = 0; __i < __m; __i++) if (__n < __ns[__i]) //__sequence long enough __sample.push_back(std::make_pair(__S(__i)[__n], __i)); __gnu_sequential::sort(__sample.begin(), __sample.end(), __lcomp); for (_SeqNumber __i = 0; __i < __m; __i++) //conceptual infinity if (__n >= __ns[__i]) //__sequence too short, conceptual infinity __sample.push_back( std::make_pair(__S(__i)[0] /*__dummy element*/, __i)); _DifferenceType __localrank = __rank / __l; _SeqNumber __j; for (__j = 0; __j < __localrank && ((__n + 1) <= __ns[__sample[__j].second]); ++__j) __a[__sample[__j].second] += __n + 1; for (; __j < __m; __j++) __b[__sample[__j].second] -= __n + 1; // Further refinement. while (__n > 0) { __n /= 2; _SeqNumber __lmax_seq = -1; // to avoid warning const _ValueType* __lmax = 0; // impossible to avoid the warning? for (_SeqNumber __i = 0; __i < __m; __i++) { if (__a[__i] > 0) { if (!__lmax) { __lmax = &(__S(__i)[__a[__i] - 1]); __lmax_seq = __i; } else { // Max, favor rear sequences. if (!__comp(__S(__i)[__a[__i] - 1], *__lmax)) { __lmax = &(__S(__i)[__a[__i] - 1]); __lmax_seq = __i; } } } } _SeqNumber __i; for (__i = 0; __i < __m; __i++) { _DifferenceType __middle = (__b[__i] + __a[__i]) / 2; if (__lmax && __middle < __ns[__i] && __lcomp(std::make_pair(__S(__i)[__middle], __i), std::make_pair(*__lmax, __lmax_seq))) __a[__i] = std::min(__a[__i] + __n + 1, __ns[__i]); else __b[__i] -= __n + 1; } _DifferenceType __leftsize = 0; for (_SeqNumber __i = 0; __i < __m; __i++) __leftsize += __a[__i] / (__n + 1); _DifferenceType __skew = __rank / (__n + 1) - __leftsize; if (__skew > 0) { // Move to the left, find smallest. std::priority_queue<std::pair<_ValueType, _SeqNumber>, std::vector<std::pair<_ValueType, _SeqNumber> >, _LexicographicReverse<_ValueType, _SeqNumber, _Compare> > __pq(__lrcomp); for (_SeqNumber __i = 0; __i < __m; __i++) if (__b[__i] < __ns[__i]) __pq.push(std::make_pair(__S(__i)[__b[__i]], __i)); for (; __skew != 0 && !__pq.empty(); --__skew) { _SeqNumber __source = __pq.top().second; __pq.pop(); __a[__source] = std::min(__a[__source] + __n + 1, __ns[__source]); __b[__source] += __n + 1; if (__b[__source] < __ns[__source]) __pq.push( std::make_pair(__S(__source)[__b[__source]], __source)); } } else if (__skew < 0) { // Move to the right, find greatest. std::priority_queue<std::pair<_ValueType, _SeqNumber>, std::vector<std::pair<_ValueType, _SeqNumber> >, _Lexicographic<_ValueType, _SeqNumber, _Compare> > __pq(__lcomp); for (_SeqNumber __i = 0; __i < __m; __i++) if (__a[__i] > 0) __pq.push(std::make_pair(__S(__i)[__a[__i] - 1], __i)); for (; __skew != 0; ++__skew) { _SeqNumber __source = __pq.top().second; __pq.pop(); __a[__source] -= __n + 1; __b[__source] -= __n + 1; if (__a[__source] > 0) __pq.push(std::make_pair( __S(__source)[__a[__source] - 1], __source)); } } } // Postconditions: // __a[__i] == __b[__i] in most cases, except when __a[__i] has been // clamped because of having reached the boundary // Now return the result, calculate the offset. // Compare the keys on both edges of the border. // Maximum of left edge, minimum of right edge. _ValueType* __maxleft = 0; _ValueType* __minright = 0; for (_SeqNumber __i = 0; __i < __m; __i++) { if (__a[__i] > 0) { if (!__maxleft) __maxleft = &(__S(__i)[__a[__i] - 1]); else { // Max, favor rear sequences. if (!__comp(__S(__i)[__a[__i] - 1], *__maxleft)) __maxleft = &(__S(__i)[__a[__i] - 1]); } } if (__b[__i] < __ns[__i]) { if (!__minright) __minright = &(__S(__i)[__b[__i]]); else { // Min, favor fore sequences. if (__comp(__S(__i)[__b[__i]], *__minright)) __minright = &(__S(__i)[__b[__i]]); } } } _SeqNumber __seq = 0; for (_SeqNumber __i = 0; __i < __m; __i++) __begin_offsets[__i] = __S(__i) + __a[__i]; delete[] __ns; delete[] __a; delete[] __b; } /** * @brief Selects the element at a certain global __rank from several * sorted sequences. * * The sequences are passed via a sequence of random-access * iterator pairs, none of the sequences may be empty. * @param __begin_seqs Begin of the sequence of iterator pairs. * @param __end_seqs End of the sequence of iterator pairs. * @param __rank The global rank to partition at. * @param __offset The rank of the selected element in the global * subsequence of elements equal to the selected element. If the * selected element is unique, this number is 0. * @param __comp The ordering functor, defaults to std::less. */ template<typename _Tp, typename _RanSeqs, typename _RankType, typename _Compare> _Tp multiseq_selection(_RanSeqs __begin_seqs, _RanSeqs __end_seqs, _RankType __rank, _RankType& __offset, _Compare __comp = std::less<_Tp>()) { _GLIBCXX_CALL(__end_seqs - __begin_seqs) typedef typename std::iterator_traits<_RanSeqs>::value_type::first_type _It; typedef typename std::iterator_traits<_RanSeqs>::difference_type _SeqNumber; typedef typename std::iterator_traits<_It>::difference_type _DifferenceType; _Lexicographic<_Tp, _SeqNumber, _Compare> __lcomp(__comp); _LexicographicReverse<_Tp, _SeqNumber, _Compare> __lrcomp(__comp); // Number of sequences, number of elements in total (possibly // including padding). _DifferenceType __m = std::distance(__begin_seqs, __end_seqs); _DifferenceType __nn = 0; _DifferenceType __nmax, __n, __r; for (_SeqNumber __i = 0; __i < __m; __i++) __nn += std::distance(__begin_seqs[__i].first, __begin_seqs[__i].second); if (__m == 0 || __nn == 0 || __rank < 0 || __rank >= __nn) { // result undefined if there is no data or __rank is outside bounds throw std::exception(); } _DifferenceType* __ns = new _DifferenceType[__m]; _DifferenceType* __a = new _DifferenceType[__m]; _DifferenceType* __b = new _DifferenceType[__m]; _DifferenceType __l; __ns[0] = std::distance(__begin_seqs[0].first, __begin_seqs[0].second); __nmax = __ns[0]; for (_SeqNumber __i = 0; __i < __m; ++__i) { __ns[__i] = std::distance(__begin_seqs[__i].first, __begin_seqs[__i].second); __nmax = std::max(__nmax, __ns[__i]); } __r = __rd_log2(__nmax) + 1; // Pad all lists to this length, at least as long as any ns[__i], // equality iff __nmax = 2^__k - 1 __l = __round_up_to_pow2(__r) - 1; for (_SeqNumber __i = 0; __i < __m; ++__i) { __a[__i] = 0; __b[__i] = __l; } __n = __l / 2; // Invariants: // 0 <= __a[__i] <= __ns[__i], 0 <= __b[__i] <= __l #define __S(__i) (__begin_seqs[__i].first) // Initial partition. std::vector<std::pair<_Tp, _SeqNumber> > __sample; for (_SeqNumber __i = 0; __i < __m; __i++) if (__n < __ns[__i]) __sample.push_back(std::make_pair(__S(__i)[__n], __i)); __gnu_sequential::sort(__sample.begin(), __sample.end(), __lcomp, sequential_tag()); // Conceptual infinity. for (_SeqNumber __i = 0; __i < __m; __i++) if (__n >= __ns[__i]) __sample.push_back( std::make_pair(__S(__i)[0] /*__dummy element*/, __i)); _DifferenceType __localrank = __rank / __l; _SeqNumber __j; for (__j = 0; __j < __localrank && ((__n + 1) <= __ns[__sample[__j].second]); ++__j) __a[__sample[__j].second] += __n + 1; for (; __j < __m; ++__j) __b[__sample[__j].second] -= __n + 1; // Further refinement. while (__n > 0) { __n /= 2; const _Tp* __lmax = 0; for (_SeqNumber __i = 0; __i < __m; ++__i) { if (__a[__i] > 0) { if (!__lmax) __lmax = &(__S(__i)[__a[__i] - 1]); else { if (__comp(*__lmax, __S(__i)[__a[__i] - 1])) //max __lmax = &(__S(__i)[__a[__i] - 1]); } } } _SeqNumber __i; for (__i = 0; __i < __m; __i++) { _DifferenceType __middle = (__b[__i] + __a[__i]) / 2; if (__lmax && __middle < __ns[__i] && __comp(__S(__i)[__middle], *__lmax)) __a[__i] = std::min(__a[__i] + __n + 1, __ns[__i]); else __b[__i] -= __n + 1; } _DifferenceType __leftsize = 0; for (_SeqNumber __i = 0; __i < __m; ++__i) __leftsize += __a[__i] / (__n + 1); _DifferenceType __skew = __rank / (__n + 1) - __leftsize; if (__skew > 0) { // Move to the left, find smallest. std::priority_queue<std::pair<_Tp, _SeqNumber>, std::vector<std::pair<_Tp, _SeqNumber> >, _LexicographicReverse<_Tp, _SeqNumber, _Compare> > __pq(__lrcomp); for (_SeqNumber __i = 0; __i < __m; ++__i) if (__b[__i] < __ns[__i]) __pq.push(std::make_pair(__S(__i)[__b[__i]], __i)); for (; __skew != 0 && !__pq.empty(); --__skew) { _SeqNumber __source = __pq.top().second; __pq.pop(); __a[__source] = std::min(__a[__source] + __n + 1, __ns[__source]); __b[__source] += __n + 1; if (__b[__source] < __ns[__source]) __pq.push( std::make_pair(__S(__source)[__b[__source]], __source)); } } else if (__skew < 0) { // Move to the right, find greatest. std::priority_queue<std::pair<_Tp, _SeqNumber>, std::vector<std::pair<_Tp, _SeqNumber> >, _Lexicographic<_Tp, _SeqNumber, _Compare> > __pq(__lcomp); for (_SeqNumber __i = 0; __i < __m; ++__i) if (__a[__i] > 0) __pq.push(std::make_pair(__S(__i)[__a[__i] - 1], __i)); for (; __skew != 0; ++__skew) { _SeqNumber __source = __pq.top().second; __pq.pop(); __a[__source] -= __n + 1; __b[__source] -= __n + 1; if (__a[__source] > 0) __pq.push(std::make_pair( __S(__source)[__a[__source] - 1], __source)); } } } // Postconditions: // __a[__i] == __b[__i] in most cases, except when __a[__i] has been // clamped because of having reached the boundary // Now return the result, calculate the offset. // Compare the keys on both edges of the border. // Maximum of left edge, minimum of right edge. bool __maxleftset = false, __minrightset = false; // Impossible to avoid the warning? _Tp __maxleft, __minright; for (_SeqNumber __i = 0; __i < __m; ++__i) { if (__a[__i] > 0) { if (!__maxleftset) { __maxleft = __S(__i)[__a[__i] - 1]; __maxleftset = true; } else { // Max. if (__comp(__maxleft, __S(__i)[__a[__i] - 1])) __maxleft = __S(__i)[__a[__i] - 1]; } } if (__b[__i] < __ns[__i]) { if (!__minrightset) { __minright = __S(__i)[__b[__i]]; __minrightset = true; } else { // Min. if (__comp(__S(__i)[__b[__i]], __minright)) __minright = __S(__i)[__b[__i]]; } } } // Minright is the __splitter, in any case. if (!__maxleftset || __comp(__minright, __maxleft)) { // Good luck, everything is split unambiguously. __offset = 0; } else { // We have to calculate an offset. __offset = 0; for (_SeqNumber __i = 0; __i < __m; ++__i) { _DifferenceType lb = std::lower_bound(__S(__i), __S(__i) + __ns[__i], __minright, __comp) - __S(__i); __offset += __a[__i] - lb; } } delete[] __ns; delete[] __a; delete[] __b; return __minright; } } #undef __S #endif /* _GLIBCXX_PARALLEL_MULTISEQ_SELECTION_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/unique_copy.h��������������������������������������������������������������������0000644�����������������00000014025�14763166027�0012110 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/unique_copy.h * @brief Parallel implementations of std::unique_copy(). * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Robert Geisberger and Robin Dapp. #ifndef _GLIBCXX_PARALLEL_UNIQUE_COPY_H #define _GLIBCXX_PARALLEL_UNIQUE_COPY_H 1 #include <parallel/parallel.h> #include <parallel/multiseq_selection.h> namespace __gnu_parallel { /** @brief Parallel std::unique_copy(), w/__o explicit equality predicate. * @param __first Begin iterator of input sequence. * @param __last End iterator of input sequence. * @param __result Begin iterator of result __sequence. * @param __binary_pred Equality predicate. * @return End iterator of result __sequence. */ template<typename _IIter, class _OutputIterator, class _BinaryPredicate> _OutputIterator __parallel_unique_copy(_IIter __first, _IIter __last, _OutputIterator __result, _BinaryPredicate __binary_pred) { _GLIBCXX_CALL(__last - __first) typedef std::iterator_traits<_IIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; typedef typename _TraitsType::difference_type _DifferenceType; _DifferenceType __size = __last - __first; if (__size == 0) return __result; // Let the first thread process two parts. _DifferenceType *__counter; _DifferenceType *__borders; _ThreadIndex __num_threads = __get_max_threads(); // First part contains at least one element. # pragma omp parallel num_threads(__num_threads) { # pragma omp single { __num_threads = omp_get_num_threads(); __borders = new _DifferenceType[__num_threads + 2]; __equally_split(__size, __num_threads + 1, __borders); __counter = new _DifferenceType[__num_threads + 1]; } _ThreadIndex __iam = omp_get_thread_num(); _DifferenceType __begin, __end; // Check for length without duplicates // Needed for position in output _DifferenceType __i = 0; _OutputIterator __out = __result; if (__iam == 0) { __begin = __borders[0] + 1; // == 1 __end = __borders[__iam + 1]; ++__i; *__out++ = *__first; for (_IIter __iter = __first + __begin; __iter < __first + __end; ++__iter) { if (!__binary_pred(*__iter, *(__iter - 1))) { ++__i; *__out++ = *__iter; } } } else { __begin = __borders[__iam]; //one part __end = __borders[__iam + 1]; for (_IIter __iter = __first + __begin; __iter < __first + __end; ++__iter) { if (!__binary_pred(*__iter, *(__iter - 1))) ++__i; } } __counter[__iam] = __i; // Last part still untouched. _DifferenceType __begin_output; # pragma omp barrier // Store result in output on calculated positions. __begin_output = 0; if (__iam == 0) { for (_ThreadIndex __t = 0; __t < __num_threads; ++__t) __begin_output += __counter[__t]; __i = 0; _OutputIterator __iter_out = __result + __begin_output; __begin = __borders[__num_threads]; __end = __size; for (_IIter __iter = __first + __begin; __iter < __first + __end; ++__iter) { if (__iter == __first || !__binary_pred(*__iter, *(__iter - 1))) { ++__i; *__iter_out++ = *__iter; } } __counter[__num_threads] = __i; } else { for (_ThreadIndex __t = 0; __t < __iam; __t++) __begin_output += __counter[__t]; _OutputIterator __iter_out = __result + __begin_output; for (_IIter __iter = __first + __begin; __iter < __first + __end; ++__iter) { if (!__binary_pred(*__iter, *(__iter - 1))) *__iter_out++ = *__iter; } } } _DifferenceType __end_output = 0; for (_ThreadIndex __t = 0; __t < __num_threads + 1; __t++) __end_output += __counter[__t]; delete[] __borders; return __result + __end_output; } /** @brief Parallel std::unique_copy(), without explicit equality predicate * @param __first Begin iterator of input sequence. * @param __last End iterator of input sequence. * @param __result Begin iterator of result __sequence. * @return End iterator of result __sequence. */ template<typename _IIter, class _OutputIterator> inline _OutputIterator __parallel_unique_copy(_IIter __first, _IIter __last, _OutputIterator __result) { typedef typename std::iterator_traits<_IIter>::value_type _ValueType; return __parallel_unique_copy(__first, __last, __result, std::equal_to<_ValueType>()); } }//namespace __gnu_parallel #endif /* _GLIBCXX_PARALLEL_UNIQUE_COPY_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/search.h�������������������������������������������������������������������������0000644�����������������00000012417�14763166027�0011020 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/search.h * @brief Parallel implementation base for std::search() and * std::search_n(). * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Felix Putze. #ifndef _GLIBCXX_PARALLEL_SEARCH_H #define _GLIBCXX_PARALLEL_SEARCH_H 1 #include <bits/stl_algobase.h> #include <parallel/parallel.h> #include <parallel/equally_split.h> namespace __gnu_parallel { /** * @brief Precalculate __advances for Knuth-Morris-Pratt algorithm. * @param __elements Begin iterator of sequence to search for. * @param __length Length of sequence to search for. * @param __off Returned __offsets. */ template<typename _RAIter, typename _DifferenceTp> void __calc_borders(_RAIter __elements, _DifferenceTp __length, _DifferenceTp* __off) { typedef _DifferenceTp _DifferenceType; __off[0] = -1; if (__length > 1) __off[1] = 0; _DifferenceType __k = 0; for (_DifferenceType __j = 2; __j <= __length; __j++) { while ((__k >= 0) && !(__elements[__k] == __elements[__j-1])) __k = __off[__k]; __off[__j] = ++__k; } } // Generic parallel find algorithm (requires random access iterator). /** @brief Parallel std::search. * @param __begin1 Begin iterator of first sequence. * @param __end1 End iterator of first sequence. * @param __begin2 Begin iterator of second sequence. * @param __end2 End iterator of second sequence. * @param __pred Find predicate. * @return Place of finding in first sequences. */ template<typename __RAIter1, typename __RAIter2, typename _Pred> __RAIter1 __search_template(__RAIter1 __begin1, __RAIter1 __end1, __RAIter2 __begin2, __RAIter2 __end2, _Pred __pred) { typedef std::iterator_traits<__RAIter1> _TraitsType; typedef typename _TraitsType::difference_type _DifferenceType; _GLIBCXX_CALL((__end1 - __begin1) + (__end2 - __begin2)); _DifferenceType __pattern_length = __end2 - __begin2; // Pattern too short. if(__pattern_length <= 0) return __end1; // Last point to start search. _DifferenceType __input_length = (__end1 - __begin1) - __pattern_length; // Where is first occurrence of pattern? defaults to end. _DifferenceType __result = (__end1 - __begin1); _DifferenceType *__splitters; // Pattern too long. if (__input_length < 0) return __end1; omp_lock_t __result_lock; omp_init_lock(&__result_lock); _ThreadIndex __num_threads = std::max<_DifferenceType> (1, std::min<_DifferenceType>(__input_length, __get_max_threads())); _DifferenceType __advances[__pattern_length]; __calc_borders(__begin2, __pattern_length, __advances); # pragma omp parallel num_threads(__num_threads) { # pragma omp single { __num_threads = omp_get_num_threads(); __splitters = new _DifferenceType[__num_threads + 1]; __equally_split(__input_length, __num_threads, __splitters); } _ThreadIndex __iam = omp_get_thread_num(); _DifferenceType __start = __splitters[__iam], __stop = __splitters[__iam + 1]; _DifferenceType __pos_in_pattern = 0; bool __found_pattern = false; while (__start <= __stop && !__found_pattern) { // Get new value of result. #pragma omp flush(__result) // No chance for this thread to find first occurrence. if (__result < __start) break; while (__pred(__begin1[__start + __pos_in_pattern], __begin2[__pos_in_pattern])) { ++__pos_in_pattern; if (__pos_in_pattern == __pattern_length) { // Found new candidate for result. omp_set_lock(&__result_lock); __result = std::min(__result, __start); omp_unset_lock(&__result_lock); __found_pattern = true; break; } } // Make safe jump. __start += (__pos_in_pattern - __advances[__pos_in_pattern]); __pos_in_pattern = (__advances[__pos_in_pattern] < 0 ? 0 : __advances[__pos_in_pattern]); } } //parallel omp_destroy_lock(&__result_lock); delete[] __splitters; // Return iterator on found element. return (__begin1 + __result); } } // end namespace #endif /* _GLIBCXX_PARALLEL_SEARCH_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/compiletime_settings.h�����������������������������������������������������������0000644�����������������00000005417�14763166027�0014004 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/compiletime_settings.h * @brief Defines on options concerning debugging and performance, at * compile-time. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Johannes Singler. #include <cstdio> /** @brief Determine verbosity level of the parallel mode. * Level 1 prints a message each time a parallel-mode function is entered. */ #define _GLIBCXX_VERBOSE_LEVEL 0 /** @def _GLIBCXX_CALL * @brief Macro to produce log message when entering a function. * @param __n Input size. * @see _GLIBCXX_VERBOSE_LEVEL */ #if (_GLIBCXX_VERBOSE_LEVEL == 0) #define _GLIBCXX_CALL(__n) #endif #if (_GLIBCXX_VERBOSE_LEVEL == 1) #define _GLIBCXX_CALL(__n) \ printf(" %__s:\niam = %d, __n = %ld, __num_threads = %d\n", \ __PRETTY_FUNCTION__, omp_get_thread_num(), (__n), __get_max_threads()); #endif #ifndef _GLIBCXX_SCALE_DOWN_FPU /** @brief Use floating-point scaling instead of modulo for mapping * random numbers to a range. This can be faster on certain CPUs. */ #define _GLIBCXX_SCALE_DOWN_FPU 0 #endif #ifndef _GLIBCXX_ASSERTIONS /** @brief Switch on many _GLIBCXX_PARALLEL_ASSERTions in parallel code. * Should be switched on only locally. */ #define _GLIBCXX_ASSERTIONS 0 #endif #ifndef _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_L1 /** @brief Switch on many _GLIBCXX_PARALLEL_ASSERTions in parallel code. * Consider the size of the L1 cache for * gnu_parallel::__parallel_random_shuffle(). */ #define _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_L1 0 #endif #ifndef _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB /** @brief Switch on many _GLIBCXX_PARALLEL_ASSERTions in parallel code. * Consider the size of the TLB for * gnu_parallel::__parallel_random_shuffle(). */ #define _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB 0 #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/compatibility.h������������������������������������������������������������������0000644�����������������00000007316�14763166027�0012426 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/compatibility.h * @brief Compatibility layer, mostly concerned with atomic operations. * * This file is a GNU parallel extension to the Standard C++ Library * and contains implementation details for the library's internal use. */ // Written by Felix Putze. #ifndef _GLIBCXX_PARALLEL_COMPATIBILITY_H #define _GLIBCXX_PARALLEL_COMPATIBILITY_H 1 #include <parallel/types.h> #include <parallel/base.h> #if !defined(_WIN32) || defined (__CYGWIN__) #include <sched.h> #endif #ifdef __MINGW32__ // Including <windows.h> will drag in all the windows32 names. Since // that can cause user code portability problems, we just declare the // one needed function here. extern "C" __attribute((dllimport)) void __attribute__((stdcall)) Sleep (unsigned long); #endif namespace __gnu_parallel { template<typename _Tp> inline _Tp __add_omp(volatile _Tp* __ptr, _Tp __addend) { int64_t __res; #pragma omp critical { __res = *__ptr; *(__ptr) += __addend; } return __res; } /** @brief Add a value to a variable, atomically. * * @param __ptr Pointer to a signed integer. * @param __addend Value to add. */ template<typename _Tp> inline _Tp __fetch_and_add(volatile _Tp* __ptr, _Tp __addend) { if (__atomic_always_lock_free(sizeof(_Tp), __ptr)) return __atomic_fetch_add(__ptr, __addend, __ATOMIC_ACQ_REL); return __add_omp(__ptr, __addend); } template<typename _Tp> inline bool __cas_omp(volatile _Tp* __ptr, _Tp __comparand, _Tp __replacement) { bool __res = false; #pragma omp critical { if (*__ptr == __comparand) { *__ptr = __replacement; __res = true; } } return __res; } /** @brief Compare-and-swap * * Compare @c *__ptr and @c __comparand. If equal, let @c * *__ptr=__replacement and return @c true, return @c false otherwise. * * @param __ptr Pointer to signed integer. * @param __comparand Compare value. * @param __replacement Replacement value. */ template<typename _Tp> inline bool __compare_and_swap(volatile _Tp* __ptr, _Tp __comparand, _Tp __replacement) { if (__atomic_always_lock_free(sizeof(_Tp), __ptr)) return __atomic_compare_exchange_n(__ptr, &__comparand, __replacement, false, __ATOMIC_ACQ_REL, __ATOMIC_RELAXED); return __cas_omp(__ptr, __comparand, __replacement); } /** @brief Yield control to another thread, without waiting for * the end of the time slice. */ inline void __yield() { #if defined (_WIN32) && !defined (__CYGWIN__) Sleep(0); #else sched_yield(); #endif } } // end namespace #endif /* _GLIBCXX_PARALLEL_COMPATIBILITY_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/parallel/parallel.h�����������������������������������������������������������������������0000644�����������������00000003050�14763166027�0011340 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file parallel/parallel.h * @brief End-user include file. Provides advanced settings and * tuning options. * This file is a GNU parallel extension to the Standard C++ Library. */ // Written by Felix Putze and Johannes Singler. #ifndef _GLIBCXX_PARALLEL_PARALLEL_H #define _GLIBCXX_PARALLEL_PARALLEL_H 1 #include <parallel/features.h> #include <parallel/compiletime_settings.h> #include <parallel/types.h> #include <parallel/tags.h> #include <parallel/settings.h> #endif /* _GLIBCXX_PARALLEL_PARALLEL_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/csetjmp�����������������������������������������������������������������������������������0000644�����������������00000003635�14763166027�0007200 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- forwarding header. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file csetjmp * This is a Standard C++ Library file. You should @c \#include this file * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c setjmp.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std (except for names which are defined * as macros in C). */ // // ISO C++ 14882: 20.4.6 C library // #pragma GCC system_header #include <bits/c++config.h> #include <setjmp.h> #ifndef _GLIBCXX_CSETJMP #define _GLIBCXX_CSETJMP 1 // Get rid of those macros defined in <setjmp.h> in lieu of real functions. #undef longjmp // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 #ifndef setjmp #define setjmp(env) setjmp (env) #endif namespace std { using ::jmp_buf; using ::longjmp; } // namespace std #endif ���������������������������������������������������������������������������������������������������c++/4.8.2/deque�������������������������������������������������������������������������������������0000644�����������������00000005151�14763166027�0006631 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <deque> -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file include/deque * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_DEQUE #define _GLIBCXX_DEQUE 1 #pragma GCC system_header #include <bits/stl_algobase.h> #include <bits/allocator.h> #include <bits/stl_construct.h> #include <bits/stl_uninitialized.h> #include <bits/stl_deque.h> #include <bits/range_access.h> #include <bits/deque.tcc> #ifdef _GLIBCXX_DEBUG # include <debug/deque> #endif #ifdef _GLIBCXX_PROFILE # include <profile/deque> #endif #endif /* _GLIBCXX_DEQUE */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ciso646�����������������������������������������������������������������������������������0000644�����������������00000002722�14763166027�0006724 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- forwarding header. // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ciso646 * This is a Standard C++ Library file. You should @c \#include this file * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c iso646.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std (except for names which are defined * as macros in C). */ ����������������������������������������������c++/4.8.2/ostream�����������������������������������������������������������������������������������0000644�����������������00000046307�14763166027�0007210 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Output streams -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/ostream * This is a Standard C++ Library header. */ // // ISO C++ 14882: 27.6.2 Output streams // #ifndef _GLIBCXX_OSTREAM #define _GLIBCXX_OSTREAM 1 #pragma GCC system_header #include <ios> #include <bits/ostream_insert.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Template class basic_ostream. * @ingroup io * * @tparam _CharT Type of character stream. * @tparam _Traits Traits for character type, defaults to * char_traits<_CharT>. * * This is the base class for all output streams. It provides text * formatting of all builtin types, and communicates with any class * derived from basic_streambuf to do the actual output. */ template<typename _CharT, typename _Traits> class basic_ostream : virtual public basic_ios<_CharT, _Traits> { public: // Types (inherited from basic_ios): typedef _CharT char_type; typedef typename _Traits::int_type int_type; typedef typename _Traits::pos_type pos_type; typedef typename _Traits::off_type off_type; typedef _Traits traits_type; // Non-standard Types: typedef basic_streambuf<_CharT, _Traits> __streambuf_type; typedef basic_ios<_CharT, _Traits> __ios_type; typedef basic_ostream<_CharT, _Traits> __ostream_type; typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > __num_put_type; typedef ctype<_CharT> __ctype_type; /** * @brief Base constructor. * * This ctor is almost never called by the user directly, rather from * derived classes' initialization lists, which pass a pointer to * their own stream buffer. */ explicit basic_ostream(__streambuf_type* __sb) { this->init(__sb); } /** * @brief Base destructor. * * This does very little apart from providing a virtual base dtor. */ virtual ~basic_ostream() { } /// Safe prefix/suffix operations. class sentry; friend class sentry; //@{ /** * @brief Interface for manipulators. * * Manipulators such as @c std::endl and @c std::hex use these * functions in constructs like "std::cout << std::endl". For more * information, see the iomanip header. */ __ostream_type& operator<<(__ostream_type& (*__pf)(__ostream_type&)) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 60. What is a formatted input function? // The inserters for manipulators are *not* formatted output functions. return __pf(*this); } __ostream_type& operator<<(__ios_type& (*__pf)(__ios_type&)) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 60. What is a formatted input function? // The inserters for manipulators are *not* formatted output functions. __pf(*this); return *this; } __ostream_type& operator<<(ios_base& (*__pf) (ios_base&)) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 60. What is a formatted input function? // The inserters for manipulators are *not* formatted output functions. __pf(*this); return *this; } //@} //@{ /** * @name Inserters * * All the @c operator<< functions (aka <em>formatted output * functions</em>) have some common behavior. Each starts by * constructing a temporary object of type std::basic_ostream::sentry. * This can have several effects, concluding with the setting of a * status flag; see the sentry documentation for more. * * If the sentry status is good, the function tries to generate * whatever data is appropriate for the type of the argument. * * If an exception is thrown during insertion, ios_base::badbit * will be turned on in the stream's error state without causing an * ios_base::failure to be thrown. The original exception will then * be rethrown. */ //@{ /** * @brief Integer arithmetic inserters * @param __n A variable of builtin integral type. * @return @c *this if successful * * These functions use the stream's current locale (specifically, the * @c num_get facet) to perform numeric formatting. */ __ostream_type& operator<<(long __n) { return _M_insert(__n); } __ostream_type& operator<<(unsigned long __n) { return _M_insert(__n); } __ostream_type& operator<<(bool __n) { return _M_insert(__n); } __ostream_type& operator<<(short __n); __ostream_type& operator<<(unsigned short __n) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 117. basic_ostream uses nonexistent num_put member functions. return _M_insert(static_cast<unsigned long>(__n)); } __ostream_type& operator<<(int __n); __ostream_type& operator<<(unsigned int __n) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 117. basic_ostream uses nonexistent num_put member functions. return _M_insert(static_cast<unsigned long>(__n)); } #ifdef _GLIBCXX_USE_LONG_LONG __ostream_type& operator<<(long long __n) { return _M_insert(__n); } __ostream_type& operator<<(unsigned long long __n) { return _M_insert(__n); } #endif //@} //@{ /** * @brief Floating point arithmetic inserters * @param __f A variable of builtin floating point type. * @return @c *this if successful * * These functions use the stream's current locale (specifically, the * @c num_get facet) to perform numeric formatting. */ __ostream_type& operator<<(double __f) { return _M_insert(__f); } __ostream_type& operator<<(float __f) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 117. basic_ostream uses nonexistent num_put member functions. return _M_insert(static_cast<double>(__f)); } __ostream_type& operator<<(long double __f) { return _M_insert(__f); } //@} /** * @brief Pointer arithmetic inserters * @param __p A variable of pointer type. * @return @c *this if successful * * These functions use the stream's current locale (specifically, the * @c num_get facet) to perform numeric formatting. */ __ostream_type& operator<<(const void* __p) { return _M_insert(__p); } /** * @brief Extracting from another streambuf. * @param __sb A pointer to a streambuf * * This function behaves like one of the basic arithmetic extractors, * in that it also constructs a sentry object and has the same error * handling behavior. * * If @p __sb is NULL, the stream will set failbit in its error state. * * Characters are extracted from @p __sb and inserted into @c *this * until one of the following occurs: * * - the input stream reaches end-of-file, * - insertion into the output sequence fails (in this case, the * character that would have been inserted is not extracted), or * - an exception occurs while getting a character from @p __sb, which * sets failbit in the error state * * If the function inserts no characters, failbit is set. */ __ostream_type& operator<<(__streambuf_type* __sb); //@} //@{ /** * @name Unformatted Output Functions * * All the unformatted output functions have some common behavior. * Each starts by constructing a temporary object of type * std::basic_ostream::sentry. This has several effects, concluding * with the setting of a status flag; see the sentry documentation * for more. * * If the sentry status is good, the function tries to generate * whatever data is appropriate for the type of the argument. * * If an exception is thrown during insertion, ios_base::badbit * will be turned on in the stream's error state. If badbit is on in * the stream's exceptions mask, the exception will be rethrown * without completing its actions. */ /** * @brief Simple insertion. * @param __c The character to insert. * @return *this * * Tries to insert @p __c. * * @note This function is not overloaded on signed char and * unsigned char. */ __ostream_type& put(char_type __c); /** * @brief Core write functionality, without sentry. * @param __s The array to insert. * @param __n Maximum number of characters to insert. */ void _M_write(const char_type* __s, streamsize __n) { const streamsize __put = this->rdbuf()->sputn(__s, __n); if (__put != __n) this->setstate(ios_base::badbit); } /** * @brief Character string insertion. * @param __s The array to insert. * @param __n Maximum number of characters to insert. * @return *this * * Characters are copied from @p __s and inserted into the stream until * one of the following happens: * * - @p __n characters are inserted * - inserting into the output sequence fails (in this case, badbit * will be set in the stream's error state) * * @note This function is not overloaded on signed char and * unsigned char. */ __ostream_type& write(const char_type* __s, streamsize __n); //@} /** * @brief Synchronizing the stream buffer. * @return *this * * If @c rdbuf() is a null pointer, changes nothing. * * Otherwise, calls @c rdbuf()->pubsync(), and if that returns -1, * sets badbit. */ __ostream_type& flush(); /** * @brief Getting the current write position. * @return A file position object. * * If @c fail() is not false, returns @c pos_type(-1) to indicate * failure. Otherwise returns @c rdbuf()->pubseekoff(0,cur,out). */ pos_type tellp(); /** * @brief Changing the current write position. * @param __pos A file position object. * @return *this * * If @c fail() is not true, calls @c rdbuf()->pubseekpos(pos). If * that function fails, sets failbit. */ __ostream_type& seekp(pos_type); /** * @brief Changing the current write position. * @param __off A file offset object. * @param __dir The direction in which to seek. * @return *this * * If @c fail() is not true, calls @c rdbuf()->pubseekoff(off,dir). * If that function fails, sets failbit. */ __ostream_type& seekp(off_type, ios_base::seekdir); protected: basic_ostream() { this->init(0); } template<typename _ValueT> __ostream_type& _M_insert(_ValueT __v); }; /** * @brief Performs setup work for output streams. * * Objects of this class are created before all of the standard * inserters are run. It is responsible for <em>exception-safe prefix and * suffix operations</em>. */ template <typename _CharT, typename _Traits> class basic_ostream<_CharT, _Traits>::sentry { // Data Members. bool _M_ok; basic_ostream<_CharT, _Traits>& _M_os; public: /** * @brief The constructor performs preparatory work. * @param __os The output stream to guard. * * If the stream state is good (@a __os.good() is true), then if the * stream is tied to another output stream, @c is.tie()->flush() * is called to synchronize the output sequences. * * If the stream state is still good, then the sentry state becomes * true (@a okay). */ explicit sentry(basic_ostream<_CharT, _Traits>& __os); /** * @brief Possibly flushes the stream. * * If @c ios_base::unitbuf is set in @c os.flags(), and * @c std::uncaught_exception() is true, the sentry destructor calls * @c flush() on the output stream. */ ~sentry() { // XXX MT if (bool(_M_os.flags() & ios_base::unitbuf) && !uncaught_exception()) { // Can't call flush directly or else will get into recursive lock. if (_M_os.rdbuf() && _M_os.rdbuf()->pubsync() == -1) _M_os.setstate(ios_base::badbit); } } /** * @brief Quick status checking. * @return The sentry state. * * For ease of use, sentries may be converted to booleans. The * return value is that of the sentry state (true == okay). */ #if __cplusplus >= 201103L explicit #endif operator bool() const { return _M_ok; } }; //@{ /** * @brief Character inserters * @param __out An output stream. * @param __c A character. * @return out * * Behaves like one of the formatted arithmetic inserters described in * std::basic_ostream. After constructing a sentry object with good * status, this function inserts a single character and any required * padding (as determined by [22.2.2.2.2]). @c __out.width(0) is then * called. * * If @p __c is of type @c char and the character type of the stream is not * @c char, the character is widened before insertion. */ template<typename _CharT, typename _Traits> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) { return __ostream_insert(__out, &__c, 1); } template<typename _CharT, typename _Traits> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) { return (__out << __out.widen(__c)); } // Specialization template <class _Traits> inline basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __out, char __c) { return __ostream_insert(__out, &__c, 1); } // Signed and unsigned template<class _Traits> inline basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __out, signed char __c) { return (__out << static_cast<char>(__c)); } template<class _Traits> inline basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) { return (__out << static_cast<char>(__c)); } //@} //@{ /** * @brief String inserters * @param __out An output stream. * @param __s A character string. * @return out * @pre @p __s must be a non-NULL pointer * * Behaves like one of the formatted arithmetic inserters described in * std::basic_ostream. After constructing a sentry object with good * status, this function inserts @c traits::length(__s) characters starting * at @p __s, widened if necessary, followed by any required padding (as * determined by [22.2.2.2.2]). @c __out.width(0) is then called. */ template<typename _CharT, typename _Traits> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) { if (!__s) __out.setstate(ios_base::badbit); else __ostream_insert(__out, __s, static_cast<streamsize>(_Traits::length(__s))); return __out; } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits> & operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s); // Partial specializations template<class _Traits> inline basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __out, const char* __s) { if (!__s) __out.setstate(ios_base::badbit); else __ostream_insert(__out, __s, static_cast<streamsize>(_Traits::length(__s))); return __out; } // Signed and unsigned template<class _Traits> inline basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s) { return (__out << reinterpret_cast<const char*>(__s)); } template<class _Traits> inline basic_ostream<char, _Traits> & operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s) { return (__out << reinterpret_cast<const char*>(__s)); } //@} // Standard basic_ostream manipulators /** * @brief Write a newline and flush the stream. * * This manipulator is often mistakenly used when a simple newline is * desired, leading to poor buffering performance. See * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html * for more on this subject. */ template<typename _CharT, typename _Traits> inline basic_ostream<_CharT, _Traits>& endl(basic_ostream<_CharT, _Traits>& __os) { return flush(__os.put(__os.widen('\n'))); } /** * @brief Write a null character into the output sequence. * * <em>Null character</em> is @c CharT() by definition. For CharT * of @c char, this correctly writes the ASCII @c NUL character * string terminator. */ template<typename _CharT, typename _Traits> inline basic_ostream<_CharT, _Traits>& ends(basic_ostream<_CharT, _Traits>& __os) { return __os.put(_CharT()); } /** * @brief Flushes the output stream. * * This manipulator simply calls the stream's @c flush() member function. */ template<typename _CharT, typename _Traits> inline basic_ostream<_CharT, _Traits>& flush(basic_ostream<_CharT, _Traits>& __os) { return __os.flush(); } #if __cplusplus >= 201103L /** * @brief Generic inserter for rvalue stream * @param __os An input stream. * @param __x A reference to the object being inserted. * @return os * * This is just a forwarding function to allow insertion to * rvalue streams since they won't bind to the inserter functions * that take an lvalue reference. */ template<typename _CharT, typename _Traits, typename _Tp> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x) { __os << __x; return __os; } #endif // C++11 _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #include <bits/ostream.tcc> #endif /* _GLIBCXX_OSTREAM */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/functional��������������������������������������������������������������������������������0000644�����������������00000236347�14763166027�0007705 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <functional> -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * Copyright (c) 1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * */ /** @file include/functional * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_FUNCTIONAL #define _GLIBCXX_FUNCTIONAL 1 #pragma GCC system_header #include <bits/c++config.h> #include <bits/stl_function.h> #if __cplusplus >= 201103L #include <typeinfo> #include <new> #include <tuple> #include <type_traits> #include <bits/functexcept.h> #include <bits/functional_hash.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _MemberPointer> class _Mem_fn; template<typename _Tp, typename _Class> _Mem_fn<_Tp _Class::*> mem_fn(_Tp _Class::*) noexcept; _GLIBCXX_HAS_NESTED_TYPE(result_type) /// If we have found a result_type, extract it. template<bool _Has_result_type, typename _Functor> struct _Maybe_get_result_type { }; template<typename _Functor> struct _Maybe_get_result_type<true, _Functor> { typedef typename _Functor::result_type result_type; }; /** * Base class for any function object that has a weak result type, as * defined in 3.3/3 of TR1. */ template<typename _Functor> struct _Weak_result_type_impl : _Maybe_get_result_type<__has_result_type<_Functor>::value, _Functor> { }; /// Retrieve the result type for a function type. template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(_ArgTypes...)> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(_ArgTypes......)> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(_ArgTypes...) const> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(_ArgTypes......) const> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(_ArgTypes...) volatile> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(_ArgTypes......) volatile> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(_ArgTypes...) const volatile> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(_ArgTypes......) const volatile> { typedef _Res result_type; }; /// Retrieve the result type for a function reference. template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(&)(_ArgTypes...)> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(&)(_ArgTypes......)> { typedef _Res result_type; }; /// Retrieve the result type for a function pointer. template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(*)(_ArgTypes...)> { typedef _Res result_type; }; template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(*)(_ArgTypes......)> { typedef _Res result_type; }; /// Retrieve result type for a member function pointer. template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...)> { typedef _Res result_type; }; template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes......)> { typedef _Res result_type; }; /// Retrieve result type for a const member function pointer. template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) const> { typedef _Res result_type; }; template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes......) const> { typedef _Res result_type; }; /// Retrieve result type for a volatile member function pointer. template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) volatile> { typedef _Res result_type; }; template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes......) volatile> { typedef _Res result_type; }; /// Retrieve result type for a const volatile member function pointer. template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) const volatile> { typedef _Res result_type; }; template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes......) const volatile> { typedef _Res result_type; }; /** * Strip top-level cv-qualifiers from the function object and let * _Weak_result_type_impl perform the real work. */ template<typename _Functor> struct _Weak_result_type : _Weak_result_type_impl<typename remove_cv<_Functor>::type> { }; /// Determines if the type _Tp derives from unary_function. template<typename _Tp> struct _Derives_from_unary_function : __sfinae_types { private: template<typename _T1, typename _Res> static __one __test(const volatile unary_function<_T1, _Res>*); // It's tempting to change "..." to const volatile void*, but // that fails when _Tp is a function type. static __two __test(...); public: static const bool value = sizeof(__test((_Tp*)0)) == 1; }; /// Determines if the type _Tp derives from binary_function. template<typename _Tp> struct _Derives_from_binary_function : __sfinae_types { private: template<typename _T1, typename _T2, typename _Res> static __one __test(const volatile binary_function<_T1, _T2, _Res>*); // It's tempting to change "..." to const volatile void*, but // that fails when _Tp is a function type. static __two __test(...); public: static const bool value = sizeof(__test((_Tp*)0)) == 1; }; /** * Invoke a function object, which may be either a member pointer or a * function object. The first parameter will tell which. */ template<typename _Functor, typename... _Args> inline typename enable_if< (!is_member_pointer<_Functor>::value && !is_function<_Functor>::value && !is_function<typename remove_pointer<_Functor>::type>::value), typename result_of<_Functor&(_Args&&...)>::type >::type __invoke(_Functor& __f, _Args&&... __args) { return __f(std::forward<_Args>(__args)...); } template<typename _Functor, typename... _Args> inline typename enable_if< (is_member_pointer<_Functor>::value && !is_function<_Functor>::value && !is_function<typename remove_pointer<_Functor>::type>::value), typename result_of<_Functor(_Args&&...)>::type >::type __invoke(_Functor& __f, _Args&&... __args) { return std::mem_fn(__f)(std::forward<_Args>(__args)...); } // To pick up function references (that will become function pointers) template<typename _Functor, typename... _Args> inline typename enable_if< (is_pointer<_Functor>::value && is_function<typename remove_pointer<_Functor>::type>::value), typename result_of<_Functor(_Args&&...)>::type >::type __invoke(_Functor __f, _Args&&... __args) { return __f(std::forward<_Args>(__args)...); } /** * Knowing which of unary_function and binary_function _Tp derives * from, derives from the same and ensures that reference_wrapper * will have a weak result type. See cases below. */ template<bool _Unary, bool _Binary, typename _Tp> struct _Reference_wrapper_base_impl; // None of the nested argument types. template<typename _Tp> struct _Reference_wrapper_base_impl<false, false, _Tp> : _Weak_result_type<_Tp> { }; // Nested argument_type only. template<typename _Tp> struct _Reference_wrapper_base_impl<true, false, _Tp> : _Weak_result_type<_Tp> { typedef typename _Tp::argument_type argument_type; }; // Nested first_argument_type and second_argument_type only. template<typename _Tp> struct _Reference_wrapper_base_impl<false, true, _Tp> : _Weak_result_type<_Tp> { typedef typename _Tp::first_argument_type first_argument_type; typedef typename _Tp::second_argument_type second_argument_type; }; // All the nested argument types. template<typename _Tp> struct _Reference_wrapper_base_impl<true, true, _Tp> : _Weak_result_type<_Tp> { typedef typename _Tp::argument_type argument_type; typedef typename _Tp::first_argument_type first_argument_type; typedef typename _Tp::second_argument_type second_argument_type; }; _GLIBCXX_HAS_NESTED_TYPE(argument_type) _GLIBCXX_HAS_NESTED_TYPE(first_argument_type) _GLIBCXX_HAS_NESTED_TYPE(second_argument_type) /** * Derives from unary_function or binary_function when it * can. Specializations handle all of the easy cases. The primary * template determines what to do with a class type, which may * derive from both unary_function and binary_function. */ template<typename _Tp> struct _Reference_wrapper_base : _Reference_wrapper_base_impl< __has_argument_type<_Tp>::value, __has_first_argument_type<_Tp>::value && __has_second_argument_type<_Tp>::value, _Tp> { }; // - a function type (unary) template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res(_T1)> : unary_function<_T1, _Res> { }; template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res(_T1) const> : unary_function<_T1, _Res> { }; template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res(_T1) volatile> : unary_function<_T1, _Res> { }; template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res(_T1) const volatile> : unary_function<_T1, _Res> { }; // - a function type (binary) template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res(_T1, _T2)> : binary_function<_T1, _T2, _Res> { }; template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res(_T1, _T2) const> : binary_function<_T1, _T2, _Res> { }; template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res(_T1, _T2) volatile> : binary_function<_T1, _T2, _Res> { }; template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res(_T1, _T2) const volatile> : binary_function<_T1, _T2, _Res> { }; // - a function pointer type (unary) template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res(*)(_T1)> : unary_function<_T1, _Res> { }; // - a function pointer type (binary) template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res(*)(_T1, _T2)> : binary_function<_T1, _T2, _Res> { }; // - a pointer to member function type (unary, no qualifiers) template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res (_T1::*)()> : unary_function<_T1*, _Res> { }; // - a pointer to member function type (binary, no qualifiers) template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res (_T1::*)(_T2)> : binary_function<_T1*, _T2, _Res> { }; // - a pointer to member function type (unary, const) template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res (_T1::*)() const> : unary_function<const _T1*, _Res> { }; // - a pointer to member function type (binary, const) template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const> : binary_function<const _T1*, _T2, _Res> { }; // - a pointer to member function type (unary, volatile) template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res (_T1::*)() volatile> : unary_function<volatile _T1*, _Res> { }; // - a pointer to member function type (binary, volatile) template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res (_T1::*)(_T2) volatile> : binary_function<volatile _T1*, _T2, _Res> { }; // - a pointer to member function type (unary, const volatile) template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res (_T1::*)() const volatile> : unary_function<const volatile _T1*, _Res> { }; // - a pointer to member function type (binary, const volatile) template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const volatile> : binary_function<const volatile _T1*, _T2, _Res> { }; /** * @brief Primary class template for reference_wrapper. * @ingroup functors * @{ */ template<typename _Tp> class reference_wrapper : public _Reference_wrapper_base<typename remove_cv<_Tp>::type> { _Tp* _M_data; public: typedef _Tp type; reference_wrapper(_Tp& __indata) noexcept : _M_data(std::__addressof(__indata)) { } reference_wrapper(_Tp&&) = delete; reference_wrapper(const reference_wrapper<_Tp>& __inref) noexcept : _M_data(__inref._M_data) { } reference_wrapper& operator=(const reference_wrapper<_Tp>& __inref) noexcept { _M_data = __inref._M_data; return *this; } operator _Tp&() const noexcept { return this->get(); } _Tp& get() const noexcept { return *_M_data; } template<typename... _Args> typename result_of<_Tp&(_Args&&...)>::type operator()(_Args&&... __args) const { return __invoke(get(), std::forward<_Args>(__args)...); } }; /// Denotes a reference should be taken to a variable. template<typename _Tp> inline reference_wrapper<_Tp> ref(_Tp& __t) noexcept { return reference_wrapper<_Tp>(__t); } /// Denotes a const reference should be taken to a variable. template<typename _Tp> inline reference_wrapper<const _Tp> cref(const _Tp& __t) noexcept { return reference_wrapper<const _Tp>(__t); } template<typename _Tp> void ref(const _Tp&&) = delete; template<typename _Tp> void cref(const _Tp&&) = delete; /// Partial specialization. template<typename _Tp> inline reference_wrapper<_Tp> ref(reference_wrapper<_Tp> __t) noexcept { return ref(__t.get()); } /// Partial specialization. template<typename _Tp> inline reference_wrapper<const _Tp> cref(reference_wrapper<_Tp> __t) noexcept { return cref(__t.get()); } // @} group functors template<typename... _Types> struct _Pack : integral_constant<size_t, sizeof...(_Types)> { }; template<typename _From, typename _To, bool = _From::value == _To::value> struct _AllConvertible : false_type { }; template<typename... _From, typename... _To> struct _AllConvertible<_Pack<_From...>, _Pack<_To...>, true> : __and_<is_convertible<_From, _To>...> { }; template<typename _Tp1, typename _Tp2> using _NotSame = __not_<is_same<typename std::decay<_Tp1>::type, typename std::decay<_Tp2>::type>>; /** * Derives from @c unary_function or @c binary_function, or perhaps * nothing, depending on the number of arguments provided. The * primary template is the basis case, which derives nothing. */ template<typename _Res, typename... _ArgTypes> struct _Maybe_unary_or_binary_function { }; /// Derives from @c unary_function, as appropriate. template<typename _Res, typename _T1> struct _Maybe_unary_or_binary_function<_Res, _T1> : std::unary_function<_T1, _Res> { }; /// Derives from @c binary_function, as appropriate. template<typename _Res, typename _T1, typename _T2> struct _Maybe_unary_or_binary_function<_Res, _T1, _T2> : std::binary_function<_T1, _T2, _Res> { }; /// Implementation of @c mem_fn for member function pointers. template<typename _Res, typename _Class, typename... _ArgTypes> class _Mem_fn<_Res (_Class::*)(_ArgTypes...)> : public _Maybe_unary_or_binary_function<_Res, _Class*, _ArgTypes...> { typedef _Res (_Class::*_Functor)(_ArgTypes...); template<typename _Tp, typename... _Args> _Res _M_call(_Tp&& __object, const volatile _Class *, _Args&&... __args) const { return (std::forward<_Tp>(__object).*__pmf) (std::forward<_Args>(__args)...); } template<typename _Tp, typename... _Args> _Res _M_call(_Tp&& __ptr, const volatile void *, _Args&&... __args) const { return ((*__ptr).*__pmf)(std::forward<_Args>(__args)...); } // Require each _Args to be convertible to corresponding _ArgTypes template<typename... _Args> using _RequireValidArgs = _Require<_AllConvertible<_Pack<_Args...>, _Pack<_ArgTypes...>>>; // Require each _Args to be convertible to corresponding _ArgTypes // and require _Tp is not _Class, _Class& or _Class* template<typename _Tp, typename... _Args> using _RequireValidArgs2 = _Require<_NotSame<_Class, _Tp>, _NotSame<_Class*, _Tp>, _AllConvertible<_Pack<_Args...>, _Pack<_ArgTypes...>>>; // Require each _Args to be convertible to corresponding _ArgTypes // and require _Tp is _Class or derived from _Class template<typename _Tp, typename... _Args> using _RequireValidArgs3 = _Require<is_base_of<_Class, _Tp>, _AllConvertible<_Pack<_Args...>, _Pack<_ArgTypes...>>>; public: typedef _Res result_type; explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { } // Handle objects template<typename... _Args, typename _Req = _RequireValidArgs<_Args...>> _Res operator()(_Class& __object, _Args&&... __args) const { return (__object.*__pmf)(std::forward<_Args>(__args)...); } template<typename... _Args, typename _Req = _RequireValidArgs<_Args...>> _Res operator()(_Class&& __object, _Args&&... __args) const { return (std::move(__object).*__pmf)(std::forward<_Args>(__args)...); } // Handle pointers template<typename... _Args, typename _Req = _RequireValidArgs<_Args...>> _Res operator()(_Class* __object, _Args&&... __args) const { return (__object->*__pmf)(std::forward<_Args>(__args)...); } // Handle smart pointers, references and pointers to derived template<typename _Tp, typename... _Args, typename _Req = _RequireValidArgs2<_Tp, _Args...>> _Res operator()(_Tp&& __object, _Args&&... __args) const { return _M_call(std::forward<_Tp>(__object), &__object, std::forward<_Args>(__args)...); } template<typename _Tp, typename... _Args, typename _Req = _RequireValidArgs3<_Tp, _Args...>> _Res operator()(reference_wrapper<_Tp> __ref, _Args&&... __args) const { return operator()(__ref.get(), std::forward<_Args>(__args)...); } private: _Functor __pmf; }; /// Implementation of @c mem_fn for const member function pointers. template<typename _Res, typename _Class, typename... _ArgTypes> class _Mem_fn<_Res (_Class::*)(_ArgTypes...) const> : public _Maybe_unary_or_binary_function<_Res, const _Class*, _ArgTypes...> { typedef _Res (_Class::*_Functor)(_ArgTypes...) const; template<typename _Tp, typename... _Args> _Res _M_call(_Tp&& __object, const volatile _Class *, _Args&&... __args) const { return (std::forward<_Tp>(__object).*__pmf) (std::forward<_Args>(__args)...); } template<typename _Tp, typename... _Args> _Res _M_call(_Tp&& __ptr, const volatile void *, _Args&&... __args) const { return ((*__ptr).*__pmf)(std::forward<_Args>(__args)...); } template<typename... _Args> using _RequireValidArgs = _Require<_AllConvertible<_Pack<_Args...>, _Pack<_ArgTypes...>>>; template<typename _Tp, typename... _Args> using _RequireValidArgs2 = _Require<_NotSame<_Class, _Tp>, _NotSame<const _Class*, _Tp>, _AllConvertible<_Pack<_Args...>, _Pack<_ArgTypes...>>>; template<typename _Tp, typename... _Args> using _RequireValidArgs3 = _Require<is_base_of<_Class, _Tp>, _AllConvertible<_Pack<_Args...>, _Pack<_ArgTypes...>>>; public: typedef _Res result_type; explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { } // Handle objects template<typename... _Args, typename _Req = _RequireValidArgs<_Args...>> _Res operator()(const _Class& __object, _Args&&... __args) const { return (__object.*__pmf)(std::forward<_Args>(__args)...); } template<typename... _Args, typename _Req = _RequireValidArgs<_Args...>> _Res operator()(const _Class&& __object, _Args&&... __args) const { return (std::move(__object).*__pmf)(std::forward<_Args>(__args)...); } // Handle pointers template<typename... _Args, typename _Req = _RequireValidArgs<_Args...>> _Res operator()(const _Class* __object, _Args&&... __args) const { return (__object->*__pmf)(std::forward<_Args>(__args)...); } // Handle smart pointers, references and pointers to derived template<typename _Tp, typename... _Args, typename _Req = _RequireValidArgs2<_Tp, _Args...>> _Res operator()(_Tp&& __object, _Args&&... __args) const { return _M_call(std::forward<_Tp>(__object), &__object, std::forward<_Args>(__args)...); } template<typename _Tp, typename... _Args, typename _Req = _RequireValidArgs3<_Tp, _Args...>> _Res operator()(reference_wrapper<_Tp> __ref, _Args&&... __args) const { return operator()(__ref.get(), std::forward<_Args>(__args)...); } private: _Functor __pmf; }; /// Implementation of @c mem_fn for volatile member function pointers. template<typename _Res, typename _Class, typename... _ArgTypes> class _Mem_fn<_Res (_Class::*)(_ArgTypes...) volatile> : public _Maybe_unary_or_binary_function<_Res, volatile _Class*, _ArgTypes...> { typedef _Res (_Class::*_Functor)(_ArgTypes...) volatile; template<typename _Tp, typename... _Args> _Res _M_call(_Tp&& __object, const volatile _Class *, _Args&&... __args) const { return (std::forward<_Tp>(__object).*__pmf) (std::forward<_Args>(__args)...); } template<typename _Tp, typename... _Args> _Res _M_call(_Tp&& __ptr, const volatile void *, _Args&&... __args) const { return ((*__ptr).*__pmf)(std::forward<_Args>(__args)...); } template<typename... _Args> using _RequireValidArgs = _Require<_AllConvertible<_Pack<_Args...>, _Pack<_ArgTypes...>>>; template<typename _Tp, typename... _Args> using _RequireValidArgs2 = _Require<_NotSame<_Class, _Tp>, _NotSame<volatile _Class*, _Tp>, _AllConvertible<_Pack<_Args...>, _Pack<_ArgTypes...>>>; template<typename _Tp, typename... _Args> using _RequireValidArgs3 = _Require<is_base_of<_Class, _Tp>, _AllConvertible<_Pack<_Args...>, _Pack<_ArgTypes...>>>; public: typedef _Res result_type; explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { } // Handle objects template<typename... _Args, typename _Req = _RequireValidArgs<_Args...>> _Res operator()(volatile _Class& __object, _Args&&... __args) const { return (__object.*__pmf)(std::forward<_Args>(__args)...); } template<typename... _Args, typename _Req = _RequireValidArgs<_Args...>> _Res operator()(volatile _Class&& __object, _Args&&... __args) const { return (std::move(__object).*__pmf)(std::forward<_Args>(__args)...); } // Handle pointers template<typename... _Args, typename _Req = _RequireValidArgs<_Args...>> _Res operator()(volatile _Class* __object, _Args&&... __args) const { return (__object->*__pmf)(std::forward<_Args>(__args)...); } // Handle smart pointers, references and pointers to derived template<typename _Tp, typename... _Args, typename _Req = _RequireValidArgs2<_Tp, _Args...>> _Res operator()(_Tp&& __object, _Args&&... __args) const { return _M_call(std::forward<_Tp>(__object), &__object, std::forward<_Args>(__args)...); } template<typename _Tp, typename... _Args, typename _Req = _RequireValidArgs3<_Tp, _Args...>> _Res operator()(reference_wrapper<_Tp> __ref, _Args&&... __args) const { return operator()(__ref.get(), std::forward<_Args>(__args)...); } private: _Functor __pmf; }; /// Implementation of @c mem_fn for const volatile member function pointers. template<typename _Res, typename _Class, typename... _ArgTypes> class _Mem_fn<_Res (_Class::*)(_ArgTypes...) const volatile> : public _Maybe_unary_or_binary_function<_Res, const volatile _Class*, _ArgTypes...> { typedef _Res (_Class::*_Functor)(_ArgTypes...) const volatile; template<typename _Tp, typename... _Args> _Res _M_call(_Tp&& __object, const volatile _Class *, _Args&&... __args) const { return (std::forward<_Tp>(__object).*__pmf) (std::forward<_Args>(__args)...); } template<typename _Tp, typename... _Args> _Res _M_call(_Tp&& __ptr, const volatile void *, _Args&&... __args) const { return ((*__ptr).*__pmf)(std::forward<_Args>(__args)...); } template<typename... _Args> using _RequireValidArgs = _Require<_AllConvertible<_Pack<_Args...>, _Pack<_ArgTypes...>>>; template<typename _Tp, typename... _Args> using _RequireValidArgs2 = _Require<_NotSame<_Class, _Tp>, _NotSame<const volatile _Class*, _Tp>, _AllConvertible<_Pack<_Args...>, _Pack<_ArgTypes...>>>; template<typename _Tp, typename... _Args> using _RequireValidArgs3 = _Require<is_base_of<_Class, _Tp>, _AllConvertible<_Pack<_Args...>, _Pack<_ArgTypes...>>>; public: typedef _Res result_type; explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { } // Handle objects template<typename... _Args, typename _Req = _RequireValidArgs<_Args...>> _Res operator()(const volatile _Class& __object, _Args&&... __args) const { return (__object.*__pmf)(std::forward<_Args>(__args)...); } template<typename... _Args, typename _Req = _RequireValidArgs<_Args...>> _Res operator()(const volatile _Class&& __object, _Args&&... __args) const { return (std::move(__object).*__pmf)(std::forward<_Args>(__args)...); } // Handle pointers template<typename... _Args, typename _Req = _RequireValidArgs<_Args...>> _Res operator()(const volatile _Class* __object, _Args&&... __args) const { return (__object->*__pmf)(std::forward<_Args>(__args)...); } // Handle smart pointers, references and pointers to derived template<typename _Tp, typename... _Args, typename _Req = _RequireValidArgs2<_Tp, _Args...>> _Res operator()(_Tp&& __object, _Args&&... __args) const { return _M_call(std::forward<_Tp>(__object), &__object, std::forward<_Args>(__args)...); } template<typename _Tp, typename... _Args, typename _Req = _RequireValidArgs3<_Tp, _Args...>> _Res operator()(reference_wrapper<_Tp> __ref, _Args&&... __args) const { return operator()(__ref.get(), std::forward<_Args>(__args)...); } private: _Functor __pmf; }; template<typename _Tp, bool> struct _Mem_fn_const_or_non { typedef const _Tp& type; }; template<typename _Tp> struct _Mem_fn_const_or_non<_Tp, false> { typedef _Tp& type; }; template<typename _Res, typename _Class> class _Mem_fn<_Res _Class::*> { using __pm_type = _Res _Class::*; // This bit of genius is due to Peter Dimov, improved slightly by // Douglas Gregor. // Made less elegant to support perfect forwarding and noexcept. template<typename _Tp> auto _M_call(_Tp&& __object, const _Class *) const noexcept -> decltype(std::forward<_Tp>(__object).*std::declval<__pm_type&>()) { return std::forward<_Tp>(__object).*__pm; } template<typename _Tp, typename _Up> auto _M_call(_Tp&& __object, _Up * const *) const noexcept -> decltype((*std::forward<_Tp>(__object)).*std::declval<__pm_type&>()) { return (*std::forward<_Tp>(__object)).*__pm; } template<typename _Tp> auto _M_call(_Tp&& __ptr, const volatile void*) const noexcept(noexcept((*__ptr).*std::declval<__pm_type&>())) -> decltype((*__ptr).*std::declval<__pm_type&>()) { return (*__ptr).*__pm; } public: explicit _Mem_fn(_Res _Class::*__pm) noexcept : __pm(__pm) { } // Handle objects _Res& operator()(_Class& __object) const noexcept { return __object.*__pm; } const _Res& operator()(const _Class& __object) const noexcept { return __object.*__pm; } _Res&& operator()(_Class&& __object) const noexcept { return std::forward<_Class>(__object).*__pm; } const _Res&& operator()(const _Class&& __object) const noexcept { return std::forward<const _Class>(__object).*__pm; } // Handle pointers _Res& operator()(_Class* __object) const noexcept { return __object->*__pm; } const _Res& operator()(const _Class* __object) const noexcept { return __object->*__pm; } // Handle smart pointers and derived template<typename _Tp, typename _Req = _Require<_NotSame<_Class*, _Tp>>> auto operator()(_Tp&& __unknown) const noexcept(noexcept(std::declval<_Mem_fn*>()->_M_call (std::forward<_Tp>(__unknown), &__unknown))) -> decltype(this->_M_call(std::forward<_Tp>(__unknown), &__unknown)) { return _M_call(std::forward<_Tp>(__unknown), &__unknown); } template<typename _Tp, typename _Req = _Require<is_base_of<_Class, _Tp>>> auto operator()(reference_wrapper<_Tp> __ref) const noexcept(noexcept(std::declval<_Mem_fn&>()(__ref.get()))) -> decltype((*this)(__ref.get())) { return (*this)(__ref.get()); } private: _Res _Class::*__pm; }; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2048. Unnecessary mem_fn overloads /** * @brief Returns a function object that forwards to the member * pointer @a pm. * @ingroup functors */ template<typename _Tp, typename _Class> inline _Mem_fn<_Tp _Class::*> mem_fn(_Tp _Class::* __pm) noexcept { return _Mem_fn<_Tp _Class::*>(__pm); } /** * @brief Determines if the given type _Tp is a function object * should be treated as a subexpression when evaluating calls to * function objects returned by bind(). [TR1 3.6.1] * @ingroup binders */ template<typename _Tp> struct is_bind_expression : public false_type { }; /** * @brief Determines if the given type _Tp is a placeholder in a * bind() expression and, if so, which placeholder it is. [TR1 3.6.2] * @ingroup binders */ template<typename _Tp> struct is_placeholder : public integral_constant<int, 0> { }; /** @brief The type of placeholder objects defined by libstdc++. * @ingroup binders */ template<int _Num> struct _Placeholder { }; _GLIBCXX_END_NAMESPACE_VERSION /** @namespace std::placeholders * @brief ISO C++11 entities sub-namespace for functional. * @ingroup binders */ namespace placeholders { _GLIBCXX_BEGIN_NAMESPACE_VERSION /* Define a large number of placeholders. There is no way to * simplify this with variadic templates, because we're introducing * unique names for each. */ extern const _Placeholder<1> _1; extern const _Placeholder<2> _2; extern const _Placeholder<3> _3; extern const _Placeholder<4> _4; extern const _Placeholder<5> _5; extern const _Placeholder<6> _6; extern const _Placeholder<7> _7; extern const _Placeholder<8> _8; extern const _Placeholder<9> _9; extern const _Placeholder<10> _10; extern const _Placeholder<11> _11; extern const _Placeholder<12> _12; extern const _Placeholder<13> _13; extern const _Placeholder<14> _14; extern const _Placeholder<15> _15; extern const _Placeholder<16> _16; extern const _Placeholder<17> _17; extern const _Placeholder<18> _18; extern const _Placeholder<19> _19; extern const _Placeholder<20> _20; extern const _Placeholder<21> _21; extern const _Placeholder<22> _22; extern const _Placeholder<23> _23; extern const _Placeholder<24> _24; extern const _Placeholder<25> _25; extern const _Placeholder<26> _26; extern const _Placeholder<27> _27; extern const _Placeholder<28> _28; extern const _Placeholder<29> _29; _GLIBCXX_END_NAMESPACE_VERSION } _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * Partial specialization of is_placeholder that provides the placeholder * number for the placeholder objects defined by libstdc++. * @ingroup binders */ template<int _Num> struct is_placeholder<_Placeholder<_Num> > : public integral_constant<int, _Num> { }; template<int _Num> struct is_placeholder<const _Placeholder<_Num> > : public integral_constant<int, _Num> { }; /** * Used by _Safe_tuple_element to indicate that there is no tuple * element at this position. */ struct _No_tuple_element; /** * Implementation helper for _Safe_tuple_element. This primary * template handles the case where it is safe to use @c * tuple_element. */ template<std::size_t __i, typename _Tuple, bool _IsSafe> struct _Safe_tuple_element_impl : tuple_element<__i, _Tuple> { }; /** * Implementation helper for _Safe_tuple_element. This partial * specialization handles the case where it is not safe to use @c * tuple_element. We just return @c _No_tuple_element. */ template<std::size_t __i, typename _Tuple> struct _Safe_tuple_element_impl<__i, _Tuple, false> { typedef _No_tuple_element type; }; /** * Like tuple_element, but returns @c _No_tuple_element when * tuple_element would return an error. */ template<std::size_t __i, typename _Tuple> struct _Safe_tuple_element : _Safe_tuple_element_impl<__i, _Tuple, (__i < tuple_size<_Tuple>::value)> { }; /** * Maps an argument to bind() into an actual argument to the bound * function object [TR1 3.6.3/5]. Only the first parameter should * be specified: the rest are used to determine among the various * implementations. Note that, although this class is a function * object, it isn't entirely normal because it takes only two * parameters regardless of the number of parameters passed to the * bind expression. The first parameter is the bound argument and * the second parameter is a tuple containing references to the * rest of the arguments. */ template<typename _Arg, bool _IsBindExp = is_bind_expression<_Arg>::value, bool _IsPlaceholder = (is_placeholder<_Arg>::value > 0)> class _Mu; /** * If the argument is reference_wrapper<_Tp>, returns the * underlying reference. [TR1 3.6.3/5 bullet 1] */ template<typename _Tp> class _Mu<reference_wrapper<_Tp>, false, false> { public: typedef _Tp& result_type; /* Note: This won't actually work for const volatile * reference_wrappers, because reference_wrapper::get() is const * but not volatile-qualified. This might be a defect in the TR. */ template<typename _CVRef, typename _Tuple> result_type operator()(_CVRef& __arg, _Tuple&) const volatile { return __arg.get(); } }; /** * If the argument is a bind expression, we invoke the underlying * function object with the same cv-qualifiers as we are given and * pass along all of our arguments (unwrapped). [TR1 3.6.3/5 bullet 2] */ template<typename _Arg> class _Mu<_Arg, true, false> { public: template<typename _CVArg, typename... _Args> auto operator()(_CVArg& __arg, tuple<_Args...>& __tuple) const volatile -> decltype(__arg(declval<_Args>()...)) { // Construct an index tuple and forward to __call typedef typename _Build_index_tuple<sizeof...(_Args)>::__type _Indexes; return this->__call(__arg, __tuple, _Indexes()); } private: // Invokes the underlying function object __arg by unpacking all // of the arguments in the tuple. template<typename _CVArg, typename... _Args, std::size_t... _Indexes> auto __call(_CVArg& __arg, tuple<_Args...>& __tuple, const _Index_tuple<_Indexes...>&) const volatile -> decltype(__arg(declval<_Args>()...)) { return __arg(std::forward<_Args>(get<_Indexes>(__tuple))...); } }; /** * If the argument is a placeholder for the Nth argument, returns * a reference to the Nth argument to the bind function object. * [TR1 3.6.3/5 bullet 3] */ template<typename _Arg> class _Mu<_Arg, false, true> { public: template<typename _Signature> class result; template<typename _CVMu, typename _CVArg, typename _Tuple> class result<_CVMu(_CVArg, _Tuple)> { // Add a reference, if it hasn't already been done for us. // This allows us to be a little bit sloppy in constructing // the tuple that we pass to result_of<...>. typedef typename _Safe_tuple_element<(is_placeholder<_Arg>::value - 1), _Tuple>::type __base_type; public: typedef typename add_rvalue_reference<__base_type>::type type; }; template<typename _Tuple> typename result<_Mu(_Arg, _Tuple)>::type operator()(const volatile _Arg&, _Tuple& __tuple) const volatile { return std::forward<typename result<_Mu(_Arg, _Tuple)>::type>( ::std::get<(is_placeholder<_Arg>::value - 1)>(__tuple)); } }; /** * If the argument is just a value, returns a reference to that * value. The cv-qualifiers on the reference are the same as the * cv-qualifiers on the _Mu object. [TR1 3.6.3/5 bullet 4] */ template<typename _Arg> class _Mu<_Arg, false, false> { public: template<typename _Signature> struct result; template<typename _CVMu, typename _CVArg, typename _Tuple> struct result<_CVMu(_CVArg, _Tuple)> { typedef typename add_lvalue_reference<_CVArg>::type type; }; // Pick up the cv-qualifiers of the argument template<typename _CVArg, typename _Tuple> _CVArg&& operator()(_CVArg&& __arg, _Tuple&) const volatile { return std::forward<_CVArg>(__arg); } }; /** * Maps member pointers into instances of _Mem_fn but leaves all * other function objects untouched. Used by tr1::bind(). The * primary template handles the non--member-pointer case. */ template<typename _Tp> struct _Maybe_wrap_member_pointer { typedef _Tp type; static const _Tp& __do_wrap(const _Tp& __x) { return __x; } static _Tp&& __do_wrap(_Tp&& __x) { return static_cast<_Tp&&>(__x); } }; /** * Maps member pointers into instances of _Mem_fn but leaves all * other function objects untouched. Used by tr1::bind(). This * partial specialization handles the member pointer case. */ template<typename _Tp, typename _Class> struct _Maybe_wrap_member_pointer<_Tp _Class::*> { typedef _Mem_fn<_Tp _Class::*> type; static type __do_wrap(_Tp _Class::* __pm) { return type(__pm); } }; // Specialization needed to prevent "forming reference to void" errors when // bind<void>() is called, because argument deduction instantiates // _Maybe_wrap_member_pointer<void> outside the immediate context where // SFINAE applies. template<> struct _Maybe_wrap_member_pointer<void> { typedef void type; }; // std::get<I> for volatile-qualified tuples template<std::size_t _Ind, typename... _Tp> inline auto __volget(volatile tuple<_Tp...>& __tuple) -> typename tuple_element<_Ind, tuple<_Tp...>>::type volatile& { return std::get<_Ind>(const_cast<tuple<_Tp...>&>(__tuple)); } // std::get<I> for const-volatile-qualified tuples template<std::size_t _Ind, typename... _Tp> inline auto __volget(const volatile tuple<_Tp...>& __tuple) -> typename tuple_element<_Ind, tuple<_Tp...>>::type const volatile& { return std::get<_Ind>(const_cast<const tuple<_Tp...>&>(__tuple)); } /// Type of the function object returned from bind(). template<typename _Signature> struct _Bind; template<typename _Functor, typename... _Bound_args> class _Bind<_Functor(_Bound_args...)> : public _Weak_result_type<_Functor> { typedef _Bind __self_type; typedef typename _Build_index_tuple<sizeof...(_Bound_args)>::__type _Bound_indexes; _Functor _M_f; tuple<_Bound_args...> _M_bound_args; // Call unqualified template<typename _Result, typename... _Args, std::size_t... _Indexes> _Result __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) { return _M_f(_Mu<_Bound_args>() (get<_Indexes>(_M_bound_args), __args)...); } // Call as const template<typename _Result, typename... _Args, std::size_t... _Indexes> _Result __call_c(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) const { return _M_f(_Mu<_Bound_args>() (get<_Indexes>(_M_bound_args), __args)...); } // Call as volatile template<typename _Result, typename... _Args, std::size_t... _Indexes> _Result __call_v(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) volatile { return _M_f(_Mu<_Bound_args>() (__volget<_Indexes>(_M_bound_args), __args)...); } // Call as const volatile template<typename _Result, typename... _Args, std::size_t... _Indexes> _Result __call_c_v(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) const volatile { return _M_f(_Mu<_Bound_args>() (__volget<_Indexes>(_M_bound_args), __args)...); } public: template<typename... _Args> explicit _Bind(const _Functor& __f, _Args&&... __args) : _M_f(__f), _M_bound_args(std::forward<_Args>(__args)...) { } template<typename... _Args> explicit _Bind(_Functor&& __f, _Args&&... __args) : _M_f(std::move(__f)), _M_bound_args(std::forward<_Args>(__args)...) { } _Bind(const _Bind&) = default; _Bind(_Bind&& __b) : _M_f(std::move(__b._M_f)), _M_bound_args(std::move(__b._M_bound_args)) { } // Call unqualified template<typename... _Args, typename _Result = decltype( std::declval<_Functor>()( _Mu<_Bound_args>()( std::declval<_Bound_args&>(), std::declval<tuple<_Args...>&>() )... ) )> _Result operator()(_Args&&... __args) { return this->__call<_Result>( std::forward_as_tuple(std::forward<_Args>(__args)...), _Bound_indexes()); } // Call as const template<typename... _Args, typename _Result = decltype( std::declval<typename enable_if<(sizeof...(_Args) >= 0), typename add_const<_Functor>::type>::type>()( _Mu<_Bound_args>()( std::declval<const _Bound_args&>(), std::declval<tuple<_Args...>&>() )... ) )> _Result operator()(_Args&&... __args) const { return this->__call_c<_Result>( std::forward_as_tuple(std::forward<_Args>(__args)...), _Bound_indexes()); } // Call as volatile template<typename... _Args, typename _Result = decltype( std::declval<typename enable_if<(sizeof...(_Args) >= 0), typename add_volatile<_Functor>::type>::type>()( _Mu<_Bound_args>()( std::declval<volatile _Bound_args&>(), std::declval<tuple<_Args...>&>() )... ) )> _Result operator()(_Args&&... __args) volatile { return this->__call_v<_Result>( std::forward_as_tuple(std::forward<_Args>(__args)...), _Bound_indexes()); } // Call as const volatile template<typename... _Args, typename _Result = decltype( std::declval<typename enable_if<(sizeof...(_Args) >= 0), typename add_cv<_Functor>::type>::type>()( _Mu<_Bound_args>()( std::declval<const volatile _Bound_args&>(), std::declval<tuple<_Args...>&>() )... ) )> _Result operator()(_Args&&... __args) const volatile { return this->__call_c_v<_Result>( std::forward_as_tuple(std::forward<_Args>(__args)...), _Bound_indexes()); } }; /// Type of the function object returned from bind<R>(). template<typename _Result, typename _Signature> struct _Bind_result; template<typename _Result, typename _Functor, typename... _Bound_args> class _Bind_result<_Result, _Functor(_Bound_args...)> { typedef _Bind_result __self_type; typedef typename _Build_index_tuple<sizeof...(_Bound_args)>::__type _Bound_indexes; _Functor _M_f; tuple<_Bound_args...> _M_bound_args; // sfinae types template<typename _Res> struct __enable_if_void : enable_if<is_void<_Res>::value, int> { }; template<typename _Res> struct __disable_if_void : enable_if<!is_void<_Res>::value, int> { }; // Call unqualified template<typename _Res, typename... _Args, std::size_t... _Indexes> _Result __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, typename __disable_if_void<_Res>::type = 0) { return _M_f(_Mu<_Bound_args>() (get<_Indexes>(_M_bound_args), __args)...); } // Call unqualified, return void template<typename _Res, typename... _Args, std::size_t... _Indexes> void __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, typename __enable_if_void<_Res>::type = 0) { _M_f(_Mu<_Bound_args>() (get<_Indexes>(_M_bound_args), __args)...); } // Call as const template<typename _Res, typename... _Args, std::size_t... _Indexes> _Result __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, typename __disable_if_void<_Res>::type = 0) const { return _M_f(_Mu<_Bound_args>() (get<_Indexes>(_M_bound_args), __args)...); } // Call as const, return void template<typename _Res, typename... _Args, std::size_t... _Indexes> void __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, typename __enable_if_void<_Res>::type = 0) const { _M_f(_Mu<_Bound_args>() (get<_Indexes>(_M_bound_args), __args)...); } // Call as volatile template<typename _Res, typename... _Args, std::size_t... _Indexes> _Result __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, typename __disable_if_void<_Res>::type = 0) volatile { return _M_f(_Mu<_Bound_args>() (__volget<_Indexes>(_M_bound_args), __args)...); } // Call as volatile, return void template<typename _Res, typename... _Args, std::size_t... _Indexes> void __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, typename __enable_if_void<_Res>::type = 0) volatile { _M_f(_Mu<_Bound_args>() (__volget<_Indexes>(_M_bound_args), __args)...); } // Call as const volatile template<typename _Res, typename... _Args, std::size_t... _Indexes> _Result __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, typename __disable_if_void<_Res>::type = 0) const volatile { return _M_f(_Mu<_Bound_args>() (__volget<_Indexes>(_M_bound_args), __args)...); } // Call as const volatile, return void template<typename _Res, typename... _Args, std::size_t... _Indexes> void __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, typename __enable_if_void<_Res>::type = 0) const volatile { _M_f(_Mu<_Bound_args>() (__volget<_Indexes>(_M_bound_args), __args)...); } public: typedef _Result result_type; template<typename... _Args> explicit _Bind_result(const _Functor& __f, _Args&&... __args) : _M_f(__f), _M_bound_args(std::forward<_Args>(__args)...) { } template<typename... _Args> explicit _Bind_result(_Functor&& __f, _Args&&... __args) : _M_f(std::move(__f)), _M_bound_args(std::forward<_Args>(__args)...) { } _Bind_result(const _Bind_result&) = default; _Bind_result(_Bind_result&& __b) : _M_f(std::move(__b._M_f)), _M_bound_args(std::move(__b._M_bound_args)) { } // Call unqualified template<typename... _Args> result_type operator()(_Args&&... __args) { return this->__call<_Result>( std::forward_as_tuple(std::forward<_Args>(__args)...), _Bound_indexes()); } // Call as const template<typename... _Args> result_type operator()(_Args&&... __args) const { return this->__call<_Result>( std::forward_as_tuple(std::forward<_Args>(__args)...), _Bound_indexes()); } // Call as volatile template<typename... _Args> result_type operator()(_Args&&... __args) volatile { return this->__call<_Result>( std::forward_as_tuple(std::forward<_Args>(__args)...), _Bound_indexes()); } // Call as const volatile template<typename... _Args> result_type operator()(_Args&&... __args) const volatile { return this->__call<_Result>( std::forward_as_tuple(std::forward<_Args>(__args)...), _Bound_indexes()); } }; /** * @brief Class template _Bind is always a bind expression. * @ingroup binders */ template<typename _Signature> struct is_bind_expression<_Bind<_Signature> > : public true_type { }; /** * @brief Class template _Bind is always a bind expression. * @ingroup binders */ template<typename _Signature> struct is_bind_expression<const _Bind<_Signature> > : public true_type { }; /** * @brief Class template _Bind is always a bind expression. * @ingroup binders */ template<typename _Signature> struct is_bind_expression<volatile _Bind<_Signature> > : public true_type { }; /** * @brief Class template _Bind is always a bind expression. * @ingroup binders */ template<typename _Signature> struct is_bind_expression<const volatile _Bind<_Signature>> : public true_type { }; /** * @brief Class template _Bind_result is always a bind expression. * @ingroup binders */ template<typename _Result, typename _Signature> struct is_bind_expression<_Bind_result<_Result, _Signature>> : public true_type { }; /** * @brief Class template _Bind_result is always a bind expression. * @ingroup binders */ template<typename _Result, typename _Signature> struct is_bind_expression<const _Bind_result<_Result, _Signature>> : public true_type { }; /** * @brief Class template _Bind_result is always a bind expression. * @ingroup binders */ template<typename _Result, typename _Signature> struct is_bind_expression<volatile _Bind_result<_Result, _Signature>> : public true_type { }; /** * @brief Class template _Bind_result is always a bind expression. * @ingroup binders */ template<typename _Result, typename _Signature> struct is_bind_expression<const volatile _Bind_result<_Result, _Signature>> : public true_type { }; // Trait type used to remove std::bind() from overload set via SFINAE // when first argument has integer type, so that std::bind() will // not be a better match than ::bind() from the BSD Sockets API. template<typename _Tp, typename _Tp2 = typename decay<_Tp>::type> using __is_socketlike = __or_<is_integral<_Tp2>, is_enum<_Tp2>>; template<bool _SocketLike, typename _Func, typename... _BoundArgs> struct _Bind_helper { typedef _Maybe_wrap_member_pointer<typename decay<_Func>::type> __maybe_type; typedef typename __maybe_type::type __func_type; typedef _Bind<__func_type(typename decay<_BoundArgs>::type...)> type; }; // Partial specialization for is_socketlike == true, does not define // nested type so std::bind() will not participate in overload resolution // when the first argument might be a socket file descriptor. template<typename _Func, typename... _BoundArgs> struct _Bind_helper<true, _Func, _BoundArgs...> { }; /** * @brief Function template for std::bind. * @ingroup binders */ template<typename _Func, typename... _BoundArgs> inline typename _Bind_helper<__is_socketlike<_Func>::value, _Func, _BoundArgs...>::type bind(_Func&& __f, _BoundArgs&&... __args) { typedef _Bind_helper<false, _Func, _BoundArgs...> __helper_type; typedef typename __helper_type::__maybe_type __maybe_type; typedef typename __helper_type::type __result_type; return __result_type(__maybe_type::__do_wrap(std::forward<_Func>(__f)), std::forward<_BoundArgs>(__args)...); } template<typename _Result, typename _Func, typename... _BoundArgs> struct _Bindres_helper { typedef _Maybe_wrap_member_pointer<typename decay<_Func>::type> __maybe_type; typedef typename __maybe_type::type __functor_type; typedef _Bind_result<_Result, __functor_type(typename decay<_BoundArgs>::type...)> type; }; /** * @brief Function template for std::bind<R>. * @ingroup binders */ template<typename _Result, typename _Func, typename... _BoundArgs> inline typename _Bindres_helper<_Result, _Func, _BoundArgs...>::type bind(_Func&& __f, _BoundArgs&&... __args) { typedef _Bindres_helper<_Result, _Func, _BoundArgs...> __helper_type; typedef typename __helper_type::__maybe_type __maybe_type; typedef typename __helper_type::type __result_type; return __result_type(__maybe_type::__do_wrap(std::forward<_Func>(__f)), std::forward<_BoundArgs>(__args)...); } template<typename _Signature> struct _Bind_simple; template<typename _Callable, typename... _Args> struct _Bind_simple<_Callable(_Args...)> { typedef typename result_of<_Callable(_Args...)>::type result_type; template<typename... _Args2, typename = typename enable_if< sizeof...(_Args) == sizeof...(_Args2)>::type> explicit _Bind_simple(const _Callable& __callable, _Args2&&... __args) : _M_bound(__callable, std::forward<_Args2>(__args)...) { } template<typename... _Args2, typename = typename enable_if< sizeof...(_Args) == sizeof...(_Args2)>::type> explicit _Bind_simple(_Callable&& __callable, _Args2&&... __args) : _M_bound(std::move(__callable), std::forward<_Args2>(__args)...) { } _Bind_simple(const _Bind_simple&) = default; _Bind_simple(_Bind_simple&&) = default; result_type operator()() { typedef typename _Build_index_tuple<sizeof...(_Args)>::__type _Indices; return _M_invoke(_Indices()); } private: template<std::size_t... _Indices> typename result_of<_Callable(_Args...)>::type _M_invoke(_Index_tuple<_Indices...>) { // std::bind always forwards bound arguments as lvalues, // but this type can call functions which only accept rvalues. return std::forward<_Callable>(std::get<0>(_M_bound))( std::forward<_Args>(std::get<_Indices+1>(_M_bound))...); } std::tuple<_Callable, _Args...> _M_bound; }; template<typename _Func, typename... _BoundArgs> struct _Bind_simple_helper { typedef _Maybe_wrap_member_pointer<typename decay<_Func>::type> __maybe_type; typedef typename __maybe_type::type __func_type; typedef _Bind_simple<__func_type(typename decay<_BoundArgs>::type...)> __type; }; // Simplified version of std::bind for internal use, without support for // unbound arguments, placeholders or nested bind expressions. template<typename _Callable, typename... _Args> typename _Bind_simple_helper<_Callable, _Args...>::__type __bind_simple(_Callable&& __callable, _Args&&... __args) { typedef _Bind_simple_helper<_Callable, _Args...> __helper_type; typedef typename __helper_type::__maybe_type __maybe_type; typedef typename __helper_type::__type __result_type; return __result_type( __maybe_type::__do_wrap( std::forward<_Callable>(__callable)), std::forward<_Args>(__args)...); } /** * @brief Exception class thrown when class template function's * operator() is called with an empty target. * @ingroup exceptions */ class bad_function_call : public std::exception { public: virtual ~bad_function_call() noexcept; const char* what() const noexcept; }; /** * Trait identifying "location-invariant" types, meaning that the * address of the object (or any of its members) will not escape. * Also implies a trivial copy constructor and assignment operator. */ template<typename _Tp> struct __is_location_invariant : integral_constant<bool, (is_pointer<_Tp>::value || is_member_pointer<_Tp>::value)> { }; class _Undefined_class; union _Nocopy_types { void* _M_object; const void* _M_const_object; void (*_M_function_pointer)(); void (_Undefined_class::*_M_member_pointer)(); }; union _Any_data { void* _M_access() { return &_M_pod_data[0]; } const void* _M_access() const { return &_M_pod_data[0]; } template<typename _Tp> _Tp& _M_access() { return *static_cast<_Tp*>(_M_access()); } template<typename _Tp> const _Tp& _M_access() const { return *static_cast<const _Tp*>(_M_access()); } _Nocopy_types _M_unused; char _M_pod_data[sizeof(_Nocopy_types)]; }; enum _Manager_operation { __get_type_info, __get_functor_ptr, __clone_functor, __destroy_functor }; // Simple type wrapper that helps avoid annoying const problems // when casting between void pointers and pointers-to-pointers. template<typename _Tp> struct _Simple_type_wrapper { _Simple_type_wrapper(_Tp __value) : __value(__value) { } _Tp __value; }; template<typename _Tp> struct __is_location_invariant<_Simple_type_wrapper<_Tp> > : __is_location_invariant<_Tp> { }; // Converts a reference to a function object into a callable // function object. template<typename _Functor> inline _Functor& __callable_functor(_Functor& __f) { return __f; } template<typename _Member, typename _Class> inline _Mem_fn<_Member _Class::*> __callable_functor(_Member _Class::* &__p) { return std::mem_fn(__p); } template<typename _Member, typename _Class> inline _Mem_fn<_Member _Class::*> __callable_functor(_Member _Class::* const &__p) { return std::mem_fn(__p); } template<typename _Member, typename _Class> inline _Mem_fn<_Member _Class::*> __callable_functor(_Member _Class::* volatile &__p) { return std::mem_fn(__p); } template<typename _Member, typename _Class> inline _Mem_fn<_Member _Class::*> __callable_functor(_Member _Class::* const volatile &__p) { return std::mem_fn(__p); } template<typename _Signature> class function; /// Base class of all polymorphic function object wrappers. class _Function_base { public: static const std::size_t _M_max_size = sizeof(_Nocopy_types); static const std::size_t _M_max_align = __alignof__(_Nocopy_types); template<typename _Functor> class _Base_manager { protected: static const bool __stored_locally = (__is_location_invariant<_Functor>::value && sizeof(_Functor) <= _M_max_size && __alignof__(_Functor) <= _M_max_align && (_M_max_align % __alignof__(_Functor) == 0)); typedef integral_constant<bool, __stored_locally> _Local_storage; // Retrieve a pointer to the function object static _Functor* _M_get_pointer(const _Any_data& __source) { const _Functor* __ptr = __stored_locally? std::__addressof(__source._M_access<_Functor>()) /* have stored a pointer */ : __source._M_access<_Functor*>(); return const_cast<_Functor*>(__ptr); } // Clone a location-invariant function object that fits within // an _Any_data structure. static void _M_clone(_Any_data& __dest, const _Any_data& __source, true_type) { new (__dest._M_access()) _Functor(__source._M_access<_Functor>()); } // Clone a function object that is not location-invariant or // that cannot fit into an _Any_data structure. static void _M_clone(_Any_data& __dest, const _Any_data& __source, false_type) { __dest._M_access<_Functor*>() = new _Functor(*__source._M_access<_Functor*>()); } // Destroying a location-invariant object may still require // destruction. static void _M_destroy(_Any_data& __victim, true_type) { __victim._M_access<_Functor>().~_Functor(); } // Destroying an object located on the heap. static void _M_destroy(_Any_data& __victim, false_type) { delete __victim._M_access<_Functor*>(); } public: static bool _M_manager(_Any_data& __dest, const _Any_data& __source, _Manager_operation __op) { switch (__op) { #ifdef __GXX_RTTI case __get_type_info: __dest._M_access<const type_info*>() = &typeid(_Functor); break; #endif case __get_functor_ptr: __dest._M_access<_Functor*>() = _M_get_pointer(__source); break; case __clone_functor: _M_clone(__dest, __source, _Local_storage()); break; case __destroy_functor: _M_destroy(__dest, _Local_storage()); break; } return false; } static void _M_init_functor(_Any_data& __functor, _Functor&& __f) { _M_init_functor(__functor, std::move(__f), _Local_storage()); } template<typename _Signature> static bool _M_not_empty_function(const function<_Signature>& __f) { return static_cast<bool>(__f); } template<typename _Tp> static bool _M_not_empty_function(_Tp* const& __fp) { return __fp; } template<typename _Class, typename _Tp> static bool _M_not_empty_function(_Tp _Class::* const& __mp) { return __mp; } template<typename _Tp> static bool _M_not_empty_function(const _Tp&) { return true; } private: static void _M_init_functor(_Any_data& __functor, _Functor&& __f, true_type) { new (__functor._M_access()) _Functor(std::move(__f)); } static void _M_init_functor(_Any_data& __functor, _Functor&& __f, false_type) { __functor._M_access<_Functor*>() = new _Functor(std::move(__f)); } }; template<typename _Functor> class _Ref_manager : public _Base_manager<_Functor*> { typedef _Function_base::_Base_manager<_Functor*> _Base; public: static bool _M_manager(_Any_data& __dest, const _Any_data& __source, _Manager_operation __op) { switch (__op) { #ifdef __GXX_RTTI case __get_type_info: __dest._M_access<const type_info*>() = &typeid(_Functor); break; #endif case __get_functor_ptr: __dest._M_access<_Functor*>() = *_Base::_M_get_pointer(__source); return is_const<_Functor>::value; break; default: _Base::_M_manager(__dest, __source, __op); } return false; } static void _M_init_functor(_Any_data& __functor, reference_wrapper<_Functor> __f) { _Base::_M_init_functor(__functor, std::__addressof(__f.get())); } }; _Function_base() : _M_manager(0) { } ~_Function_base() { if (_M_manager) _M_manager(_M_functor, _M_functor, __destroy_functor); } bool _M_empty() const { return !_M_manager; } typedef bool (*_Manager_type)(_Any_data&, const _Any_data&, _Manager_operation); _Any_data _M_functor; _Manager_type _M_manager; }; template<typename _Signature, typename _Functor> class _Function_handler; template<typename _Res, typename _Functor, typename... _ArgTypes> class _Function_handler<_Res(_ArgTypes...), _Functor> : public _Function_base::_Base_manager<_Functor> { typedef _Function_base::_Base_manager<_Functor> _Base; public: static _Res _M_invoke(const _Any_data& __functor, _ArgTypes... __args) { return (*_Base::_M_get_pointer(__functor))( std::forward<_ArgTypes>(__args)...); } }; template<typename _Functor, typename... _ArgTypes> class _Function_handler<void(_ArgTypes...), _Functor> : public _Function_base::_Base_manager<_Functor> { typedef _Function_base::_Base_manager<_Functor> _Base; public: static void _M_invoke(const _Any_data& __functor, _ArgTypes... __args) { (*_Base::_M_get_pointer(__functor))( std::forward<_ArgTypes>(__args)...); } }; template<typename _Res, typename _Functor, typename... _ArgTypes> class _Function_handler<_Res(_ArgTypes...), reference_wrapper<_Functor> > : public _Function_base::_Ref_manager<_Functor> { typedef _Function_base::_Ref_manager<_Functor> _Base; public: static _Res _M_invoke(const _Any_data& __functor, _ArgTypes... __args) { return __callable_functor(**_Base::_M_get_pointer(__functor))( std::forward<_ArgTypes>(__args)...); } }; template<typename _Functor, typename... _ArgTypes> class _Function_handler<void(_ArgTypes...), reference_wrapper<_Functor> > : public _Function_base::_Ref_manager<_Functor> { typedef _Function_base::_Ref_manager<_Functor> _Base; public: static void _M_invoke(const _Any_data& __functor, _ArgTypes... __args) { __callable_functor(**_Base::_M_get_pointer(__functor))( std::forward<_ArgTypes>(__args)...); } }; template<typename _Class, typename _Member, typename _Res, typename... _ArgTypes> class _Function_handler<_Res(_ArgTypes...), _Member _Class::*> : public _Function_handler<void(_ArgTypes...), _Member _Class::*> { typedef _Function_handler<void(_ArgTypes...), _Member _Class::*> _Base; public: static _Res _M_invoke(const _Any_data& __functor, _ArgTypes... __args) { return std::mem_fn(_Base::_M_get_pointer(__functor)->__value)( std::forward<_ArgTypes>(__args)...); } }; template<typename _Class, typename _Member, typename... _ArgTypes> class _Function_handler<void(_ArgTypes...), _Member _Class::*> : public _Function_base::_Base_manager< _Simple_type_wrapper< _Member _Class::* > > { typedef _Member _Class::* _Functor; typedef _Simple_type_wrapper<_Functor> _Wrapper; typedef _Function_base::_Base_manager<_Wrapper> _Base; public: static bool _M_manager(_Any_data& __dest, const _Any_data& __source, _Manager_operation __op) { switch (__op) { #ifdef __GXX_RTTI case __get_type_info: __dest._M_access<const type_info*>() = &typeid(_Functor); break; #endif case __get_functor_ptr: __dest._M_access<_Functor*>() = &_Base::_M_get_pointer(__source)->__value; break; default: _Base::_M_manager(__dest, __source, __op); } return false; } static void _M_invoke(const _Any_data& __functor, _ArgTypes... __args) { std::mem_fn(_Base::_M_get_pointer(__functor)->__value)( std::forward<_ArgTypes>(__args)...); } }; template<typename _From, typename _To> using __check_func_return_type = __or_<is_void<_To>, is_convertible<_From, _To>>; /** * @brief Primary class template for std::function. * @ingroup functors * * Polymorphic function wrapper. */ template<typename _Res, typename... _ArgTypes> class function<_Res(_ArgTypes...)> : public _Maybe_unary_or_binary_function<_Res, _ArgTypes...>, private _Function_base { typedef _Res _Signature_type(_ArgTypes...); template<typename _Functor> using _Invoke = decltype(__callable_functor(std::declval<_Functor&>()) (std::declval<_ArgTypes>()...) ); // Used so the return type convertibility checks aren't done when // performing overload resolution for copy construction/assignment. template<typename _Tp> using _NotSelf = __not_<is_same<_Tp, function>>; template<typename _Functor> using _Callable = __and_<_NotSelf<_Functor>, __check_func_return_type<_Invoke<_Functor>, _Res>>; template<typename _Cond, typename _Tp> using _Requires = typename enable_if<_Cond::value, _Tp>::type; public: typedef _Res result_type; // [3.7.2.1] construct/copy/destroy /** * @brief Default construct creates an empty function call wrapper. * @post @c !(bool)*this */ function() noexcept : _Function_base() { } /** * @brief Creates an empty function call wrapper. * @post @c !(bool)*this */ function(nullptr_t) noexcept : _Function_base() { } /** * @brief %Function copy constructor. * @param __x A %function object with identical call signature. * @post @c bool(*this) == bool(__x) * * The newly-created %function contains a copy of the target of @a * __x (if it has one). */ function(const function& __x); /** * @brief %Function move constructor. * @param __x A %function object rvalue with identical call signature. * * The newly-created %function contains the target of @a __x * (if it has one). */ function(function&& __x) : _Function_base() { __x.swap(*this); } // TODO: needs allocator_arg_t /** * @brief Builds a %function that targets a copy of the incoming * function object. * @param __f A %function object that is callable with parameters of * type @c T1, @c T2, ..., @c TN and returns a value convertible * to @c Res. * * The newly-created %function object will target a copy of * @a __f. If @a __f is @c reference_wrapper<F>, then this function * object will contain a reference to the function object @c * __f.get(). If @a __f is a NULL function pointer or NULL * pointer-to-member, the newly-created object will be empty. * * If @a __f is a non-NULL function pointer or an object of type @c * reference_wrapper<F>, this function will not throw. */ template<typename _Functor, typename = _Requires<_Callable<_Functor>, void>> function(_Functor); /** * @brief %Function assignment operator. * @param __x A %function with identical call signature. * @post @c (bool)*this == (bool)x * @returns @c *this * * The target of @a __x is copied to @c *this. If @a __x has no * target, then @c *this will be empty. * * If @a __x targets a function pointer or a reference to a function * object, then this operation will not throw an %exception. */ function& operator=(const function& __x) { function(__x).swap(*this); return *this; } /** * @brief %Function move-assignment operator. * @param __x A %function rvalue with identical call signature. * @returns @c *this * * The target of @a __x is moved to @c *this. If @a __x has no * target, then @c *this will be empty. * * If @a __x targets a function pointer or a reference to a function * object, then this operation will not throw an %exception. */ function& operator=(function&& __x) { function(std::move(__x)).swap(*this); return *this; } /** * @brief %Function assignment to zero. * @post @c !(bool)*this * @returns @c *this * * The target of @c *this is deallocated, leaving it empty. */ function& operator=(nullptr_t) { if (_M_manager) { _M_manager(_M_functor, _M_functor, __destroy_functor); _M_manager = 0; _M_invoker = 0; } return *this; } /** * @brief %Function assignment to a new target. * @param __f A %function object that is callable with parameters of * type @c T1, @c T2, ..., @c TN and returns a value convertible * to @c Res. * @return @c *this * * This %function object wrapper will target a copy of @a * __f. If @a __f is @c reference_wrapper<F>, then this function * object will contain a reference to the function object @c * __f.get(). If @a __f is a NULL function pointer or NULL * pointer-to-member, @c this object will be empty. * * If @a __f is a non-NULL function pointer or an object of type @c * reference_wrapper<F>, this function will not throw. */ template<typename _Functor> _Requires<_Callable<typename decay<_Functor>::type>, function&> operator=(_Functor&& __f) { function(std::forward<_Functor>(__f)).swap(*this); return *this; } /// @overload template<typename _Functor> function& operator=(reference_wrapper<_Functor> __f) noexcept { function(__f).swap(*this); return *this; } // [3.7.2.2] function modifiers /** * @brief Swap the targets of two %function objects. * @param __x A %function with identical call signature. * * Swap the targets of @c this function object and @a __f. This * function will not throw an %exception. */ void swap(function& __x) { std::swap(_M_functor, __x._M_functor); std::swap(_M_manager, __x._M_manager); std::swap(_M_invoker, __x._M_invoker); } // TODO: needs allocator_arg_t /* template<typename _Functor, typename _Alloc> void assign(_Functor&& __f, const _Alloc& __a) { function(allocator_arg, __a, std::forward<_Functor>(__f)).swap(*this); } */ // [3.7.2.3] function capacity /** * @brief Determine if the %function wrapper has a target. * * @return @c true when this %function object contains a target, * or @c false when it is empty. * * This function will not throw an %exception. */ explicit operator bool() const noexcept { return !_M_empty(); } // [3.7.2.4] function invocation /** * @brief Invokes the function targeted by @c *this. * @returns the result of the target. * @throws bad_function_call when @c !(bool)*this * * The function call operator invokes the target function object * stored by @c this. */ _Res operator()(_ArgTypes... __args) const; #ifdef __GXX_RTTI // [3.7.2.5] function target access /** * @brief Determine the type of the target of this function object * wrapper. * * @returns the type identifier of the target function object, or * @c typeid(void) if @c !(bool)*this. * * This function will not throw an %exception. */ const type_info& target_type() const noexcept; /** * @brief Access the stored target function object. * * @return Returns a pointer to the stored target function object, * if @c typeid(Functor).equals(target_type()); otherwise, a NULL * pointer. * * This function will not throw an %exception. */ template<typename _Functor> _Functor* target() noexcept; /// @overload template<typename _Functor> const _Functor* target() const noexcept; #endif private: typedef _Res (*_Invoker_type)(const _Any_data&, _ArgTypes...); _Invoker_type _M_invoker; }; // Out-of-line member definitions. template<typename _Res, typename... _ArgTypes> function<_Res(_ArgTypes...)>:: function(const function& __x) : _Function_base() { if (static_cast<bool>(__x)) { __x._M_manager(_M_functor, __x._M_functor, __clone_functor); _M_invoker = __x._M_invoker; _M_manager = __x._M_manager; } } template<typename _Res, typename... _ArgTypes> template<typename _Functor, typename> function<_Res(_ArgTypes...)>:: function(_Functor __f) : _Function_base() { typedef _Function_handler<_Signature_type, _Functor> _My_handler; if (_My_handler::_M_not_empty_function(__f)) { _My_handler::_M_init_functor(_M_functor, std::move(__f)); _M_invoker = &_My_handler::_M_invoke; _M_manager = &_My_handler::_M_manager; } } template<typename _Res, typename... _ArgTypes> _Res function<_Res(_ArgTypes...)>:: operator()(_ArgTypes... __args) const { if (_M_empty()) __throw_bad_function_call(); return _M_invoker(_M_functor, std::forward<_ArgTypes>(__args)...); } #ifdef __GXX_RTTI template<typename _Res, typename... _ArgTypes> const type_info& function<_Res(_ArgTypes...)>:: target_type() const noexcept { if (_M_manager) { _Any_data __typeinfo_result; _M_manager(__typeinfo_result, _M_functor, __get_type_info); return *__typeinfo_result._M_access<const type_info*>(); } else return typeid(void); } template<typename _Res, typename... _ArgTypes> template<typename _Functor> _Functor* function<_Res(_ArgTypes...)>:: target() noexcept { if (typeid(_Functor) == target_type() && _M_manager) { _Any_data __ptr; if (_M_manager(__ptr, _M_functor, __get_functor_ptr) && !is_const<_Functor>::value) return 0; else return __ptr._M_access<_Functor*>(); } else return 0; } template<typename _Res, typename... _ArgTypes> template<typename _Functor> const _Functor* function<_Res(_ArgTypes...)>:: target() const noexcept { if (typeid(_Functor) == target_type() && _M_manager) { _Any_data __ptr; _M_manager(__ptr, _M_functor, __get_functor_ptr); return __ptr._M_access<const _Functor*>(); } else return 0; } #endif // [20.7.15.2.6] null pointer comparisons /** * @brief Compares a polymorphic function object wrapper against 0 * (the NULL pointer). * @returns @c true if the wrapper has no target, @c false otherwise * * This function will not throw an %exception. */ template<typename _Res, typename... _Args> inline bool operator==(const function<_Res(_Args...)>& __f, nullptr_t) noexcept { return !static_cast<bool>(__f); } /// @overload template<typename _Res, typename... _Args> inline bool operator==(nullptr_t, const function<_Res(_Args...)>& __f) noexcept { return !static_cast<bool>(__f); } /** * @brief Compares a polymorphic function object wrapper against 0 * (the NULL pointer). * @returns @c false if the wrapper has no target, @c true otherwise * * This function will not throw an %exception. */ template<typename _Res, typename... _Args> inline bool operator!=(const function<_Res(_Args...)>& __f, nullptr_t) noexcept { return static_cast<bool>(__f); } /// @overload template<typename _Res, typename... _Args> inline bool operator!=(nullptr_t, const function<_Res(_Args...)>& __f) noexcept { return static_cast<bool>(__f); } // [20.7.15.2.7] specialized algorithms /** * @brief Swap the targets of two polymorphic function object wrappers. * * This function will not throw an %exception. */ template<typename _Res, typename... _Args> inline void swap(function<_Res(_Args...)>& __x, function<_Res(_Args...)>& __y) { __x.swap(__y); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif // C++11 #endif // _GLIBCXX_FUNCTIONAL �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/clocale�����������������������������������������������������������������������������������0000644�����������������00000003561�14763166027�0007133 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- forwarding header. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file clocale * This is a Standard C++ Library file. You should @c \#include this file * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c locale.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std (except for names which are defined * as macros in C). */ // // ISO C++ 14882: 18.2.2 Implementation properties: C library // #pragma GCC system_header #include <bits/c++config.h> #include <locale.h> #ifndef _GLIBCXX_CLOCALE #define _GLIBCXX_CLOCALE 1 // Get rid of those macros defined in <locale.h> in lieu of real functions. #undef setlocale #undef localeconv namespace std { using ::lconv; using ::setlocale; using ::localeconv; } // namespace std #endif �����������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/istream�����������������������������������������������������������������������������������0000644�����������������00000072374�14763166027�0007205 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Input streams -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // // ISO C++ 14882: 27.6.1 Input streams // /** @file include/istream * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_ISTREAM #define _GLIBCXX_ISTREAM 1 #pragma GCC system_header #include <ios> #include <ostream> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Template class basic_istream. * @ingroup io * * @tparam _CharT Type of character stream. * @tparam _Traits Traits for character type, defaults to * char_traits<_CharT>. * * This is the base class for all input streams. It provides text * formatting of all builtin types, and communicates with any class * derived from basic_streambuf to do the actual input. */ template<typename _CharT, typename _Traits> class basic_istream : virtual public basic_ios<_CharT, _Traits> { public: // Types (inherited from basic_ios (27.4.4)): typedef _CharT char_type; typedef typename _Traits::int_type int_type; typedef typename _Traits::pos_type pos_type; typedef typename _Traits::off_type off_type; typedef _Traits traits_type; // Non-standard Types: typedef basic_streambuf<_CharT, _Traits> __streambuf_type; typedef basic_ios<_CharT, _Traits> __ios_type; typedef basic_istream<_CharT, _Traits> __istream_type; typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > __num_get_type; typedef ctype<_CharT> __ctype_type; protected: // Data Members: /** * The number of characters extracted in the previous unformatted * function; see gcount(). */ streamsize _M_gcount; public: /** * @brief Base constructor. * * This ctor is almost never called by the user directly, rather from * derived classes' initialization lists, which pass a pointer to * their own stream buffer. */ explicit basic_istream(__streambuf_type* __sb) : _M_gcount(streamsize(0)) { this->init(__sb); } /** * @brief Base destructor. * * This does very little apart from providing a virtual base dtor. */ virtual ~basic_istream() { _M_gcount = streamsize(0); } /// Safe prefix/suffix operations. class sentry; friend class sentry; //@{ /** * @brief Interface for manipulators. * * Manipulators such as @c std::ws and @c std::dec use these * functions in constructs like * <code>std::cin >> std::ws</code>. * For more information, see the iomanip header. */ __istream_type& operator>>(__istream_type& (*__pf)(__istream_type&)) { return __pf(*this); } __istream_type& operator>>(__ios_type& (*__pf)(__ios_type&)) { __pf(*this); return *this; } __istream_type& operator>>(ios_base& (*__pf)(ios_base&)) { __pf(*this); return *this; } //@} //@{ /** * @name Extractors * * All the @c operator>> functions (aka <em>formatted input * functions</em>) have some common behavior. Each starts by * constructing a temporary object of type std::basic_istream::sentry * with the second argument (noskipws) set to false. This has several * effects, concluding with the setting of a status flag; see the * sentry documentation for more. * * If the sentry status is good, the function tries to extract * whatever data is appropriate for the type of the argument. * * If an exception is thrown during extraction, ios_base::badbit * will be turned on in the stream's error state (without causing an * ios_base::failure to be thrown) and the original exception will * be rethrown if badbit is set in the exceptions mask. */ //@{ /** * @brief Integer arithmetic extractors * @param __n A variable of builtin integral type. * @return @c *this if successful * * These functions use the stream's current locale (specifically, the * @c num_get facet) to parse the input data. */ __istream_type& operator>>(bool& __n) { return _M_extract(__n); } __istream_type& operator>>(short& __n); __istream_type& operator>>(unsigned short& __n) { return _M_extract(__n); } __istream_type& operator>>(int& __n); __istream_type& operator>>(unsigned int& __n) { return _M_extract(__n); } __istream_type& operator>>(long& __n) { return _M_extract(__n); } __istream_type& operator>>(unsigned long& __n) { return _M_extract(__n); } #ifdef _GLIBCXX_USE_LONG_LONG __istream_type& operator>>(long long& __n) { return _M_extract(__n); } __istream_type& operator>>(unsigned long long& __n) { return _M_extract(__n); } #endif //@} //@{ /** * @brief Floating point arithmetic extractors * @param __f A variable of builtin floating point type. * @return @c *this if successful * * These functions use the stream's current locale (specifically, the * @c num_get facet) to parse the input data. */ __istream_type& operator>>(float& __f) { return _M_extract(__f); } __istream_type& operator>>(double& __f) { return _M_extract(__f); } __istream_type& operator>>(long double& __f) { return _M_extract(__f); } //@} /** * @brief Basic arithmetic extractors * @param __p A variable of pointer type. * @return @c *this if successful * * These functions use the stream's current locale (specifically, the * @c num_get facet) to parse the input data. */ __istream_type& operator>>(void*& __p) { return _M_extract(__p); } /** * @brief Extracting into another streambuf. * @param __sb A pointer to a streambuf * * This function behaves like one of the basic arithmetic extractors, * in that it also constructs a sentry object and has the same error * handling behavior. * * If @p __sb is NULL, the stream will set failbit in its error state. * * Characters are extracted from this stream and inserted into the * @p __sb streambuf until one of the following occurs: * * - the input stream reaches end-of-file, * - insertion into the output buffer fails (in this case, the * character that would have been inserted is not extracted), or * - an exception occurs (and in this case is caught) * * If the function inserts no characters, failbit is set. */ __istream_type& operator>>(__streambuf_type* __sb); //@} // [27.6.1.3] unformatted input /** * @brief Character counting * @return The number of characters extracted by the previous * unformatted input function dispatched for this stream. */ streamsize gcount() const { return _M_gcount; } //@{ /** * @name Unformatted Input Functions * * All the unformatted input functions have some common behavior. * Each starts by constructing a temporary object of type * std::basic_istream::sentry with the second argument (noskipws) * set to true. This has several effects, concluding with the * setting of a status flag; see the sentry documentation for more. * * If the sentry status is good, the function tries to extract * whatever data is appropriate for the type of the argument. * * The number of characters extracted is stored for later retrieval * by gcount(). * * If an exception is thrown during extraction, ios_base::badbit * will be turned on in the stream's error state (without causing an * ios_base::failure to be thrown) and the original exception will * be rethrown if badbit is set in the exceptions mask. */ /** * @brief Simple extraction. * @return A character, or eof(). * * Tries to extract a character. If none are available, sets failbit * and returns traits::eof(). */ int_type get(); /** * @brief Simple extraction. * @param __c The character in which to store data. * @return *this * * Tries to extract a character and store it in @a __c. If none are * available, sets failbit and returns traits::eof(). * * @note This function is not overloaded on signed char and * unsigned char. */ __istream_type& get(char_type& __c); /** * @brief Simple multiple-character extraction. * @param __s Pointer to an array. * @param __n Maximum number of characters to store in @a __s. * @param __delim A "stop" character. * @return *this * * Characters are extracted and stored into @a __s until one of the * following happens: * * - @c __n-1 characters are stored * - the input sequence reaches EOF * - the next character equals @a __delim, in which case the character * is not extracted * * If no characters are stored, failbit is set in the stream's error * state. * * In any case, a null character is stored into the next location in * the array. * * @note This function is not overloaded on signed char and * unsigned char. */ __istream_type& get(char_type* __s, streamsize __n, char_type __delim); /** * @brief Simple multiple-character extraction. * @param __s Pointer to an array. * @param __n Maximum number of characters to store in @a s. * @return *this * * Returns @c get(__s,__n,widen('\\n')). */ __istream_type& get(char_type* __s, streamsize __n) { return this->get(__s, __n, this->widen('\n')); } /** * @brief Extraction into another streambuf. * @param __sb A streambuf in which to store data. * @param __delim A "stop" character. * @return *this * * Characters are extracted and inserted into @a __sb until one of the * following happens: * * - the input sequence reaches EOF * - insertion into the output buffer fails (in this case, the * character that would have been inserted is not extracted) * - the next character equals @a __delim (in this case, the character * is not extracted) * - an exception occurs (and in this case is caught) * * If no characters are stored, failbit is set in the stream's error * state. */ __istream_type& get(__streambuf_type& __sb, char_type __delim); /** * @brief Extraction into another streambuf. * @param __sb A streambuf in which to store data. * @return *this * * Returns @c get(__sb,widen('\\n')). */ __istream_type& get(__streambuf_type& __sb) { return this->get(__sb, this->widen('\n')); } /** * @brief String extraction. * @param __s A character array in which to store the data. * @param __n Maximum number of characters to extract. * @param __delim A "stop" character. * @return *this * * Extracts and stores characters into @a __s until one of the * following happens. Note that these criteria are required to be * tested in the order listed here, to allow an input line to exactly * fill the @a __s array without setting failbit. * * -# the input sequence reaches end-of-file, in which case eofbit * is set in the stream error state * -# the next character equals @c __delim, in which case the character * is extracted (and therefore counted in @c gcount()) but not stored * -# @c __n-1 characters are stored, in which case failbit is set * in the stream error state * * If no characters are extracted, failbit is set. (An empty line of * input should therefore not cause failbit to be set.) * * In any case, a null character is stored in the next location in * the array. */ __istream_type& getline(char_type* __s, streamsize __n, char_type __delim); /** * @brief String extraction. * @param __s A character array in which to store the data. * @param __n Maximum number of characters to extract. * @return *this * * Returns @c getline(__s,__n,widen('\\n')). */ __istream_type& getline(char_type* __s, streamsize __n) { return this->getline(__s, __n, this->widen('\n')); } /** * @brief Discarding characters * @param __n Number of characters to discard. * @param __delim A "stop" character. * @return *this * * Extracts characters and throws them away until one of the * following happens: * - if @a __n @c != @c std::numeric_limits<int>::max(), @a __n * characters are extracted * - the input sequence reaches end-of-file * - the next character equals @a __delim (in this case, the character * is extracted); note that this condition will never occur if * @a __delim equals @c traits::eof(). * * NB: Provide three overloads, instead of the single function * (with defaults) mandated by the Standard: this leads to a * better performing implementation, while still conforming to * the Standard. */ __istream_type& ignore(streamsize __n, int_type __delim); __istream_type& ignore(streamsize __n); __istream_type& ignore(); /** * @brief Looking ahead in the stream * @return The next character, or eof(). * * If, after constructing the sentry object, @c good() is false, * returns @c traits::eof(). Otherwise reads but does not extract * the next input character. */ int_type peek(); /** * @brief Extraction without delimiters. * @param __s A character array. * @param __n Maximum number of characters to store. * @return *this * * If the stream state is @c good(), extracts characters and stores * them into @a __s until one of the following happens: * - @a __n characters are stored * - the input sequence reaches end-of-file, in which case the error * state is set to @c failbit|eofbit. * * @note This function is not overloaded on signed char and * unsigned char. */ __istream_type& read(char_type* __s, streamsize __n); /** * @brief Extraction until the buffer is exhausted, but no more. * @param __s A character array. * @param __n Maximum number of characters to store. * @return The number of characters extracted. * * Extracts characters and stores them into @a __s depending on the * number of characters remaining in the streambuf's buffer, * @c rdbuf()->in_avail(), called @c A here: * - if @c A @c == @c -1, sets eofbit and extracts no characters * - if @c A @c == @c 0, extracts no characters * - if @c A @c > @c 0, extracts @c min(A,n) * * The goal is to empty the current buffer, and to not request any * more from the external input sequence controlled by the streambuf. */ streamsize readsome(char_type* __s, streamsize __n); /** * @brief Unextracting a single character. * @param __c The character to push back into the input stream. * @return *this * * If @c rdbuf() is not null, calls @c rdbuf()->sputbackc(c). * * If @c rdbuf() is null or if @c sputbackc() fails, sets badbit in * the error state. * * @note This function first clears eofbit. Since no characters * are extracted, the next call to @c gcount() will return 0, * as required by DR 60. */ __istream_type& putback(char_type __c); /** * @brief Unextracting the previous character. * @return *this * * If @c rdbuf() is not null, calls @c rdbuf()->sungetc(c). * * If @c rdbuf() is null or if @c sungetc() fails, sets badbit in * the error state. * * @note This function first clears eofbit. Since no characters * are extracted, the next call to @c gcount() will return 0, * as required by DR 60. */ __istream_type& unget(); /** * @brief Synchronizing the stream buffer. * @return 0 on success, -1 on failure * * If @c rdbuf() is a null pointer, returns -1. * * Otherwise, calls @c rdbuf()->pubsync(), and if that returns -1, * sets badbit and returns -1. * * Otherwise, returns 0. * * @note This function does not count the number of characters * extracted, if any, and therefore does not affect the next * call to @c gcount(). */ int sync(); /** * @brief Getting the current read position. * @return A file position object. * * If @c fail() is not false, returns @c pos_type(-1) to indicate * failure. Otherwise returns @c rdbuf()->pubseekoff(0,cur,in). * * @note This function does not count the number of characters * extracted, if any, and therefore does not affect the next * call to @c gcount(). At variance with putback, unget and * seekg, eofbit is not cleared first. */ pos_type tellg(); /** * @brief Changing the current read position. * @param __pos A file position object. * @return *this * * If @c fail() is not true, calls @c rdbuf()->pubseekpos(__pos). If * that function fails, sets failbit. * * @note This function first clears eofbit. It does not count the * number of characters extracted, if any, and therefore does * not affect the next call to @c gcount(). */ __istream_type& seekg(pos_type); /** * @brief Changing the current read position. * @param __off A file offset object. * @param __dir The direction in which to seek. * @return *this * * If @c fail() is not true, calls @c rdbuf()->pubseekoff(__off,__dir). * If that function fails, sets failbit. * * @note This function first clears eofbit. It does not count the * number of characters extracted, if any, and therefore does * not affect the next call to @c gcount(). */ __istream_type& seekg(off_type, ios_base::seekdir); //@} protected: basic_istream() : _M_gcount(streamsize(0)) { this->init(0); } template<typename _ValueT> __istream_type& _M_extract(_ValueT& __v); }; /// Explicit specialization declarations, defined in src/istream.cc. template<> basic_istream<char>& basic_istream<char>:: getline(char_type* __s, streamsize __n, char_type __delim); template<> basic_istream<char>& basic_istream<char>:: ignore(streamsize __n); template<> basic_istream<char>& basic_istream<char>:: ignore(streamsize __n, int_type __delim); #ifdef _GLIBCXX_USE_WCHAR_T template<> basic_istream<wchar_t>& basic_istream<wchar_t>:: getline(char_type* __s, streamsize __n, char_type __delim); template<> basic_istream<wchar_t>& basic_istream<wchar_t>:: ignore(streamsize __n); template<> basic_istream<wchar_t>& basic_istream<wchar_t>:: ignore(streamsize __n, int_type __delim); #endif /** * @brief Performs setup work for input streams. * * Objects of this class are created before all of the standard * extractors are run. It is responsible for <em>exception-safe * prefix and suffix operations,</em> although only prefix actions * are currently required by the standard. */ template<typename _CharT, typename _Traits> class basic_istream<_CharT, _Traits>::sentry { // Data Members. bool _M_ok; public: /// Easy access to dependent types. typedef _Traits traits_type; typedef basic_streambuf<_CharT, _Traits> __streambuf_type; typedef basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::__ctype_type __ctype_type; typedef typename _Traits::int_type __int_type; /** * @brief The constructor performs all the work. * @param __is The input stream to guard. * @param __noskipws Whether to consume whitespace or not. * * If the stream state is good (@a __is.good() is true), then the * following actions are performed, otherwise the sentry state * is false (<em>not okay</em>) and failbit is set in the * stream state. * * The sentry's preparatory actions are: * * -# if the stream is tied to an output stream, @c is.tie()->flush() * is called to synchronize the output sequence * -# if @a __noskipws is false, and @c ios_base::skipws is set in * @c is.flags(), the sentry extracts and discards whitespace * characters from the stream. The currently imbued locale is * used to determine whether each character is whitespace. * * If the stream state is still good, then the sentry state becomes * true (@a okay). */ explicit sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false); /** * @brief Quick status checking. * @return The sentry state. * * For ease of use, sentries may be converted to booleans. The * return value is that of the sentry state (true == okay). */ #if __cplusplus >= 201103L explicit #endif operator bool() const { return _M_ok; } }; //@{ /** * @brief Character extractors * @param __in An input stream. * @param __c A character reference. * @return in * * Behaves like one of the formatted arithmetic extractors described in * std::basic_istream. After constructing a sentry object with good * status, this function extracts a character (if one is available) and * stores it in @a __c. Otherwise, sets failbit in the input stream. */ template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c); template<class _Traits> inline basic_istream<char, _Traits>& operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) { return (__in >> reinterpret_cast<char&>(__c)); } template<class _Traits> inline basic_istream<char, _Traits>& operator>>(basic_istream<char, _Traits>& __in, signed char& __c) { return (__in >> reinterpret_cast<char&>(__c)); } //@} //@{ /** * @brief Character string extractors * @param __in An input stream. * @param __s A pointer to a character array. * @return __in * * Behaves like one of the formatted arithmetic extractors described in * std::basic_istream. After constructing a sentry object with good * status, this function extracts up to @c n characters and stores them * into the array starting at @a __s. @c n is defined as: * * - if @c width() is greater than zero, @c n is width() otherwise * - @c n is <em>the number of elements of the largest array of * * - @c char_type that can store a terminating @c eos.</em> * - [27.6.1.2.3]/6 * * Characters are extracted and stored until one of the following happens: * - @c n-1 characters are stored * - EOF is reached * - the next character is whitespace according to the current locale * - the next character is a null byte (i.e., @c charT() ) * * @c width(0) is then called for the input stream. * * If no characters are extracted, sets failbit. */ template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s); // Explicit specialization declaration, defined in src/istream.cc. template<> basic_istream<char>& operator>>(basic_istream<char>& __in, char* __s); template<class _Traits> inline basic_istream<char, _Traits>& operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) { return (__in >> reinterpret_cast<char*>(__s)); } template<class _Traits> inline basic_istream<char, _Traits>& operator>>(basic_istream<char, _Traits>& __in, signed char* __s) { return (__in >> reinterpret_cast<char*>(__s)); } //@} /** * @brief Template class basic_iostream * @ingroup io * * @tparam _CharT Type of character stream. * @tparam _Traits Traits for character type, defaults to * char_traits<_CharT>. * * This class multiply inherits from the input and output stream classes * simply to provide a single interface. */ template<typename _CharT, typename _Traits> class basic_iostream : public basic_istream<_CharT, _Traits>, public basic_ostream<_CharT, _Traits> { public: // _GLIBCXX_RESOLVE_LIB_DEFECTS // 271. basic_iostream missing typedefs // Types (inherited): typedef _CharT char_type; typedef typename _Traits::int_type int_type; typedef typename _Traits::pos_type pos_type; typedef typename _Traits::off_type off_type; typedef _Traits traits_type; // Non-standard Types: typedef basic_istream<_CharT, _Traits> __istream_type; typedef basic_ostream<_CharT, _Traits> __ostream_type; /** * @brief Constructor does nothing. * * Both of the parent classes are initialized with the same * streambuf pointer passed to this constructor. */ explicit basic_iostream(basic_streambuf<_CharT, _Traits>* __sb) : __istream_type(__sb), __ostream_type(__sb) { } /** * @brief Destructor does nothing. */ virtual ~basic_iostream() { } protected: basic_iostream() : __istream_type(), __ostream_type() { } }; /** * @brief Quick and easy way to eat whitespace * * This manipulator extracts whitespace characters, stopping when the * next character is non-whitespace, or when the input sequence is empty. * If the sequence is empty, @c eofbit is set in the stream, but not * @c failbit. * * The current locale is used to distinguish whitespace characters. * * Example: * @code * MyClass mc; * * std::cin >> std::ws >> mc; * @endcode * will skip leading whitespace before calling operator>> on cin and your * object. Note that the same effect can be achieved by creating a * std::basic_istream::sentry inside your definition of operator>>. */ template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& ws(basic_istream<_CharT, _Traits>& __is); #if __cplusplus >= 201103L // [27.7.1.6] Rvalue stream extraction /** * @brief Generic extractor for rvalue stream * @param __is An input stream. * @param __x A reference to the extraction target. * @return is * * This is just a forwarding function to allow extraction from * rvalue streams since they won't bind to the extractor functions * that take an lvalue reference. */ template<typename _CharT, typename _Traits, typename _Tp> inline basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) { __is >> __x; return __is; } #endif // C++11 _GLIBCXX_END_NAMESPACE_VERSION } // namespace #include <bits/istream.tcc> #endif /* _GLIBCXX_ISTREAM */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/atomic������������������������������������������������������������������������������������0000644�����������������00000102465�14763166027�0007010 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- header. // Copyright (C) 2008-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/atomic * This is a Standard C++ Library header. */ // Based on "C++ Atomic Types and Operations" by Hans Boehm and Lawrence Crowl. // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html #ifndef _GLIBCXX_ATOMIC #define _GLIBCXX_ATOMIC 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #endif #include <bits/atomic_base.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup atomics * @{ */ /// atomic_bool // NB: No operators or fetch-operations for this type. struct atomic_bool { private: __atomic_base<bool> _M_base; public: atomic_bool() noexcept = default; ~atomic_bool() noexcept = default; atomic_bool(const atomic_bool&) = delete; atomic_bool& operator=(const atomic_bool&) = delete; atomic_bool& operator=(const atomic_bool&) volatile = delete; constexpr atomic_bool(bool __i) noexcept : _M_base(__i) { } bool operator=(bool __i) noexcept { return _M_base.operator=(__i); } bool operator=(bool __i) volatile noexcept { return _M_base.operator=(__i); } operator bool() const noexcept { return _M_base.load(); } operator bool() const volatile noexcept { return _M_base.load(); } bool is_lock_free() const noexcept { return _M_base.is_lock_free(); } bool is_lock_free() const volatile noexcept { return _M_base.is_lock_free(); } void store(bool __i, memory_order __m = memory_order_seq_cst) noexcept { _M_base.store(__i, __m); } void store(bool __i, memory_order __m = memory_order_seq_cst) volatile noexcept { _M_base.store(__i, __m); } bool load(memory_order __m = memory_order_seq_cst) const noexcept { return _M_base.load(__m); } bool load(memory_order __m = memory_order_seq_cst) const volatile noexcept { return _M_base.load(__m); } bool exchange(bool __i, memory_order __m = memory_order_seq_cst) noexcept { return _M_base.exchange(__i, __m); } bool exchange(bool __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return _M_base.exchange(__i, __m); } bool compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1, memory_order __m2) noexcept { return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); } bool compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1, memory_order __m2) volatile noexcept { return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); } bool compare_exchange_weak(bool& __i1, bool __i2, memory_order __m = memory_order_seq_cst) noexcept { return _M_base.compare_exchange_weak(__i1, __i2, __m); } bool compare_exchange_weak(bool& __i1, bool __i2, memory_order __m = memory_order_seq_cst) volatile noexcept { return _M_base.compare_exchange_weak(__i1, __i2, __m); } bool compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1, memory_order __m2) noexcept { return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); } bool compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1, memory_order __m2) volatile noexcept { return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); } bool compare_exchange_strong(bool& __i1, bool __i2, memory_order __m = memory_order_seq_cst) noexcept { return _M_base.compare_exchange_strong(__i1, __i2, __m); } bool compare_exchange_strong(bool& __i1, bool __i2, memory_order __m = memory_order_seq_cst) volatile noexcept { return _M_base.compare_exchange_strong(__i1, __i2, __m); } }; /** * @brief Generic atomic type, primary class template. * * @tparam _Tp Type to be made atomic, must be trivally copyable. */ template<typename _Tp> struct atomic { private: _Tp _M_i; public: atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(_Tp __i) noexcept : _M_i(__i) { } operator _Tp() const noexcept { return load(); } operator _Tp() const volatile noexcept { return load(); } _Tp operator=(_Tp __i) noexcept { store(__i); return __i; } _Tp operator=(_Tp __i) volatile noexcept { store(__i); return __i; } bool is_lock_free() const noexcept { return __atomic_is_lock_free(sizeof(_M_i), nullptr); } bool is_lock_free() const volatile noexcept { return __atomic_is_lock_free(sizeof(_M_i), nullptr); } void store(_Tp __i, memory_order _m = memory_order_seq_cst) noexcept { __atomic_store(&_M_i, &__i, _m); } void store(_Tp __i, memory_order _m = memory_order_seq_cst) volatile noexcept { __atomic_store(&_M_i, &__i, _m); } _Tp load(memory_order _m = memory_order_seq_cst) const noexcept { _Tp tmp; __atomic_load(&_M_i, &tmp, _m); return tmp; } _Tp load(memory_order _m = memory_order_seq_cst) const volatile noexcept { _Tp tmp; __atomic_load(&_M_i, &tmp, _m); return tmp; } _Tp exchange(_Tp __i, memory_order _m = memory_order_seq_cst) noexcept { _Tp tmp; __atomic_exchange(&_M_i, &__i, &tmp, _m); return tmp; } _Tp exchange(_Tp __i, memory_order _m = memory_order_seq_cst) volatile noexcept { _Tp tmp; __atomic_exchange(&_M_i, &__i, &tmp, _m); return tmp; } bool compare_exchange_weak(_Tp& __e, _Tp __i, memory_order __s, memory_order __f) noexcept { return __atomic_compare_exchange(&_M_i, &__e, &__i, true, __s, __f); } bool compare_exchange_weak(_Tp& __e, _Tp __i, memory_order __s, memory_order __f) volatile noexcept { return __atomic_compare_exchange(&_M_i, &__e, &__i, true, __s, __f); } bool compare_exchange_weak(_Tp& __e, _Tp __i, memory_order __m = memory_order_seq_cst) noexcept { return compare_exchange_weak(__e, __i, __m, __m); } bool compare_exchange_weak(_Tp& __e, _Tp __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return compare_exchange_weak(__e, __i, __m, __m); } bool compare_exchange_strong(_Tp& __e, _Tp __i, memory_order __s, memory_order __f) noexcept { return __atomic_compare_exchange(&_M_i, &__e, &__i, false, __s, __f); } bool compare_exchange_strong(_Tp& __e, _Tp __i, memory_order __s, memory_order __f) volatile noexcept { return __atomic_compare_exchange(&_M_i, &__e, &__i, false, __s, __f); } bool compare_exchange_strong(_Tp& __e, _Tp __i, memory_order __m = memory_order_seq_cst) noexcept { return compare_exchange_strong(__e, __i, __m, __m); } bool compare_exchange_strong(_Tp& __e, _Tp __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return compare_exchange_strong(__e, __i, __m, __m); } }; /// Partial specialization for pointer types. template<typename _Tp> struct atomic<_Tp*> { typedef _Tp* __pointer_type; typedef __atomic_base<_Tp*> __base_type; __base_type _M_b; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__pointer_type __p) noexcept : _M_b(__p) { } operator __pointer_type() const noexcept { return __pointer_type(_M_b); } operator __pointer_type() const volatile noexcept { return __pointer_type(_M_b); } __pointer_type operator=(__pointer_type __p) noexcept { return _M_b.operator=(__p); } __pointer_type operator=(__pointer_type __p) volatile noexcept { return _M_b.operator=(__p); } __pointer_type operator++(int) noexcept { return _M_b++; } __pointer_type operator++(int) volatile noexcept { return _M_b++; } __pointer_type operator--(int) noexcept { return _M_b--; } __pointer_type operator--(int) volatile noexcept { return _M_b--; } __pointer_type operator++() noexcept { return ++_M_b; } __pointer_type operator++() volatile noexcept { return ++_M_b; } __pointer_type operator--() noexcept { return --_M_b; } __pointer_type operator--() volatile noexcept { return --_M_b; } __pointer_type operator+=(ptrdiff_t __d) noexcept { return _M_b.operator+=(__d); } __pointer_type operator+=(ptrdiff_t __d) volatile noexcept { return _M_b.operator+=(__d); } __pointer_type operator-=(ptrdiff_t __d) noexcept { return _M_b.operator-=(__d); } __pointer_type operator-=(ptrdiff_t __d) volatile noexcept { return _M_b.operator-=(__d); } bool is_lock_free() const noexcept { return _M_b.is_lock_free(); } bool is_lock_free() const volatile noexcept { return _M_b.is_lock_free(); } void store(__pointer_type __p, memory_order __m = memory_order_seq_cst) noexcept { return _M_b.store(__p, __m); } void store(__pointer_type __p, memory_order __m = memory_order_seq_cst) volatile noexcept { return _M_b.store(__p, __m); } __pointer_type load(memory_order __m = memory_order_seq_cst) const noexcept { return _M_b.load(__m); } __pointer_type load(memory_order __m = memory_order_seq_cst) const volatile noexcept { return _M_b.load(__m); } __pointer_type exchange(__pointer_type __p, memory_order __m = memory_order_seq_cst) noexcept { return _M_b.exchange(__p, __m); } __pointer_type exchange(__pointer_type __p, memory_order __m = memory_order_seq_cst) volatile noexcept { return _M_b.exchange(__p, __m); } bool compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2, memory_order __m1, memory_order __m2) noexcept { return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); } bool compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2, memory_order __m1, memory_order __m2) volatile noexcept { return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); } bool compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2, memory_order __m = memory_order_seq_cst) noexcept { return compare_exchange_weak(__p1, __p2, __m, __cmpexch_failure_order(__m)); } bool compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2, memory_order __m = memory_order_seq_cst) volatile noexcept { return compare_exchange_weak(__p1, __p2, __m, __cmpexch_failure_order(__m)); } bool compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, memory_order __m1, memory_order __m2) noexcept { return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); } bool compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, memory_order __m1, memory_order __m2) volatile noexcept { return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); } bool compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, memory_order __m = memory_order_seq_cst) noexcept { return _M_b.compare_exchange_strong(__p1, __p2, __m, __cmpexch_failure_order(__m)); } bool compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, memory_order __m = memory_order_seq_cst) volatile noexcept { return _M_b.compare_exchange_strong(__p1, __p2, __m, __cmpexch_failure_order(__m)); } __pointer_type fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) noexcept { return _M_b.fetch_add(__d, __m); } __pointer_type fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile noexcept { return _M_b.fetch_add(__d, __m); } __pointer_type fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) noexcept { return _M_b.fetch_sub(__d, __m); } __pointer_type fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile noexcept { return _M_b.fetch_sub(__d, __m); } }; /// Explicit specialization for bool. template<> struct atomic<bool> : public atomic_bool { typedef bool __integral_type; typedef atomic_bool __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; /// Explicit specialization for char. template<> struct atomic<char> : public atomic_char { typedef char __integral_type; typedef atomic_char __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; /// Explicit specialization for signed char. template<> struct atomic<signed char> : public atomic_schar { typedef signed char __integral_type; typedef atomic_schar __base_type; atomic() noexcept= default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; /// Explicit specialization for unsigned char. template<> struct atomic<unsigned char> : public atomic_uchar { typedef unsigned char __integral_type; typedef atomic_uchar __base_type; atomic() noexcept= default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; /// Explicit specialization for short. template<> struct atomic<short> : public atomic_short { typedef short __integral_type; typedef atomic_short __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; /// Explicit specialization for unsigned short. template<> struct atomic<unsigned short> : public atomic_ushort { typedef unsigned short __integral_type; typedef atomic_ushort __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; /// Explicit specialization for int. template<> struct atomic<int> : atomic_int { typedef int __integral_type; typedef atomic_int __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; /// Explicit specialization for unsigned int. template<> struct atomic<unsigned int> : public atomic_uint { typedef unsigned int __integral_type; typedef atomic_uint __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; /// Explicit specialization for long. template<> struct atomic<long> : public atomic_long { typedef long __integral_type; typedef atomic_long __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; /// Explicit specialization for unsigned long. template<> struct atomic<unsigned long> : public atomic_ulong { typedef unsigned long __integral_type; typedef atomic_ulong __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; /// Explicit specialization for long long. template<> struct atomic<long long> : public atomic_llong { typedef long long __integral_type; typedef atomic_llong __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; /// Explicit specialization for unsigned long long. template<> struct atomic<unsigned long long> : public atomic_ullong { typedef unsigned long long __integral_type; typedef atomic_ullong __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; /// Explicit specialization for wchar_t. template<> struct atomic<wchar_t> : public atomic_wchar_t { typedef wchar_t __integral_type; typedef atomic_wchar_t __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; /// Explicit specialization for char16_t. template<> struct atomic<char16_t> : public atomic_char16_t { typedef char16_t __integral_type; typedef atomic_char16_t __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; /// Explicit specialization for char32_t. template<> struct atomic<char32_t> : public atomic_char32_t { typedef char32_t __integral_type; typedef atomic_char32_t __base_type; atomic() noexcept = default; ~atomic() noexcept = default; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } using __base_type::operator __integral_type; using __base_type::operator=; }; // Function definitions, atomic_flag operations. inline bool atomic_flag_test_and_set_explicit(atomic_flag* __a, memory_order __m) noexcept { return __a->test_and_set(__m); } inline bool atomic_flag_test_and_set_explicit(volatile atomic_flag* __a, memory_order __m) noexcept { return __a->test_and_set(__m); } inline void atomic_flag_clear_explicit(atomic_flag* __a, memory_order __m) noexcept { __a->clear(__m); } inline void atomic_flag_clear_explicit(volatile atomic_flag* __a, memory_order __m) noexcept { __a->clear(__m); } inline bool atomic_flag_test_and_set(atomic_flag* __a) noexcept { return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); } inline bool atomic_flag_test_and_set(volatile atomic_flag* __a) noexcept { return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); } inline void atomic_flag_clear(atomic_flag* __a) noexcept { atomic_flag_clear_explicit(__a, memory_order_seq_cst); } inline void atomic_flag_clear(volatile atomic_flag* __a) noexcept { atomic_flag_clear_explicit(__a, memory_order_seq_cst); } // Function templates generally applicable to atomic types. template<typename _ITp> inline bool atomic_is_lock_free(const atomic<_ITp>* __a) noexcept { return __a->is_lock_free(); } template<typename _ITp> inline bool atomic_is_lock_free(const volatile atomic<_ITp>* __a) noexcept { return __a->is_lock_free(); } template<typename _ITp> inline void atomic_init(atomic<_ITp>* __a, _ITp __i) noexcept; template<typename _ITp> inline void atomic_init(volatile atomic<_ITp>* __a, _ITp __i) noexcept; template<typename _ITp> inline void atomic_store_explicit(atomic<_ITp>* __a, _ITp __i, memory_order __m) noexcept { __a->store(__i, __m); } template<typename _ITp> inline void atomic_store_explicit(volatile atomic<_ITp>* __a, _ITp __i, memory_order __m) noexcept { __a->store(__i, __m); } template<typename _ITp> inline _ITp atomic_load_explicit(const atomic<_ITp>* __a, memory_order __m) noexcept { return __a->load(__m); } template<typename _ITp> inline _ITp atomic_load_explicit(const volatile atomic<_ITp>* __a, memory_order __m) noexcept { return __a->load(__m); } template<typename _ITp> inline _ITp atomic_exchange_explicit(atomic<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->exchange(__i, __m); } template<typename _ITp> inline _ITp atomic_exchange_explicit(volatile atomic<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->exchange(__i, __m); } template<typename _ITp> inline bool atomic_compare_exchange_weak_explicit(atomic<_ITp>* __a, _ITp* __i1, _ITp __i2, memory_order __m1, memory_order __m2) noexcept { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); } template<typename _ITp> inline bool atomic_compare_exchange_weak_explicit(volatile atomic<_ITp>* __a, _ITp* __i1, _ITp __i2, memory_order __m1, memory_order __m2) noexcept { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); } template<typename _ITp> inline bool atomic_compare_exchange_strong_explicit(atomic<_ITp>* __a, _ITp* __i1, _ITp __i2, memory_order __m1, memory_order __m2) noexcept { return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); } template<typename _ITp> inline bool atomic_compare_exchange_strong_explicit(volatile atomic<_ITp>* __a, _ITp* __i1, _ITp __i2, memory_order __m1, memory_order __m2) noexcept { return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); } template<typename _ITp> inline void atomic_store(atomic<_ITp>* __a, _ITp __i) noexcept { atomic_store_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline void atomic_store(volatile atomic<_ITp>* __a, _ITp __i) noexcept { atomic_store_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_load(const atomic<_ITp>* __a) noexcept { return atomic_load_explicit(__a, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_load(const volatile atomic<_ITp>* __a) noexcept { return atomic_load_explicit(__a, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_exchange(atomic<_ITp>* __a, _ITp __i) noexcept { return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_exchange(volatile atomic<_ITp>* __a, _ITp __i) noexcept { return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline bool atomic_compare_exchange_weak(atomic<_ITp>* __a, _ITp* __i1, _ITp __i2) noexcept { return atomic_compare_exchange_weak_explicit(__a, __i1, __i2, memory_order_seq_cst, memory_order_seq_cst); } template<typename _ITp> inline bool atomic_compare_exchange_weak(volatile atomic<_ITp>* __a, _ITp* __i1, _ITp __i2) noexcept { return atomic_compare_exchange_weak_explicit(__a, __i1, __i2, memory_order_seq_cst, memory_order_seq_cst); } template<typename _ITp> inline bool atomic_compare_exchange_strong(atomic<_ITp>* __a, _ITp* __i1, _ITp __i2) noexcept { return atomic_compare_exchange_strong_explicit(__a, __i1, __i2, memory_order_seq_cst, memory_order_seq_cst); } template<typename _ITp> inline bool atomic_compare_exchange_strong(volatile atomic<_ITp>* __a, _ITp* __i1, _ITp __i2) noexcept { return atomic_compare_exchange_strong_explicit(__a, __i1, __i2, memory_order_seq_cst, memory_order_seq_cst); } // Function templates for atomic_integral operations only, using // __atomic_base. Template argument should be constricted to // intergral types as specified in the standard, excluding address // types. template<typename _ITp> inline _ITp atomic_fetch_add_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_add(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_add_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_add(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_sub_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_sub(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_sub_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_sub(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_and_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_and(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_and_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_and(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_or_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_or(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_or_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_or(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_xor_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_xor(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_xor_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, memory_order __m) noexcept { return __a->fetch_xor(__i, __m); } template<typename _ITp> inline _ITp atomic_fetch_add(__atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_add_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_fetch_add(volatile __atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_add_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_fetch_sub(__atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_sub_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_fetch_sub(volatile __atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_sub_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_fetch_and(__atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_and_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_fetch_and(volatile __atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_and_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_fetch_or(__atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_or_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_fetch_or(volatile __atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_or_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_fetch_xor(__atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); } template<typename _ITp> inline _ITp atomic_fetch_xor(volatile __atomic_base<_ITp>* __a, _ITp __i) noexcept { return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); } // Partial specializations for pointers. template<typename _ITp> inline _ITp* atomic_fetch_add_explicit(atomic<_ITp*>* __a, ptrdiff_t __d, memory_order __m) noexcept { return __a->fetch_add(__d, __m); } template<typename _ITp> inline _ITp* atomic_fetch_add_explicit(volatile atomic<_ITp*>* __a, ptrdiff_t __d, memory_order __m) noexcept { return __a->fetch_add(__d, __m); } template<typename _ITp> inline _ITp* atomic_fetch_add(volatile atomic<_ITp*>* __a, ptrdiff_t __d) noexcept { return __a->fetch_add(__d); } template<typename _ITp> inline _ITp* atomic_fetch_add(atomic<_ITp*>* __a, ptrdiff_t __d) noexcept { return __a->fetch_add(__d); } template<typename _ITp> inline _ITp* atomic_fetch_sub_explicit(volatile atomic<_ITp*>* __a, ptrdiff_t __d, memory_order __m) noexcept { return __a->fetch_sub(__d, __m); } template<typename _ITp> inline _ITp* atomic_fetch_sub_explicit(atomic<_ITp*>* __a, ptrdiff_t __d, memory_order __m) noexcept { return __a->fetch_sub(__d, __m); } template<typename _ITp> inline _ITp* atomic_fetch_sub(volatile atomic<_ITp*>* __a, ptrdiff_t __d) noexcept { return __a->fetch_sub(__d); } template<typename _ITp> inline _ITp* atomic_fetch_sub(atomic<_ITp*>* __a, ptrdiff_t __d) noexcept { return __a->fetch_sub(__d); } // @} group atomics _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/unordered_map�����������������������������������������������������������������������������0000644�����������������00000003501�14763166027�0010347 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <unordered_map> -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/unordered_map * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_UNORDERED_MAP #define _GLIBCXX_UNORDERED_MAP 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <utility> #include <type_traits> #include <initializer_list> #include <tuple> #include <bits/stl_algobase.h> #include <bits/allocator.h> #include <bits/alloc_traits.h> #include <bits/stl_function.h> // equal_to, _Identity, _Select1st #include <bits/functional_hash.h> #include <bits/hashtable.h> #include <bits/unordered_map.h> #include <bits/range_access.h> #ifdef _GLIBCXX_DEBUG # include <debug/unordered_map> #endif #ifdef _GLIBCXX_PROFILE # include <profile/unordered_map> #endif #endif // C++11 #endif // _GLIBCXX_UNORDERED_MAP �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr2/dynamic_bitset������������������������������������������������������������������������0000644�����������������00000121022�14763166027�0011227 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR2 <dynamic_bitset> -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr2/dynamic_bitset * This is a TR2 C++ Library header. */ #ifndef _GLIBCXX_TR2_DYNAMIC_BITSET #define _GLIBCXX_TR2_DYNAMIC_BITSET 1 #pragma GCC system_header #include <limits> #include <vector> #include <string> #include <memory> // For std::allocator #include <bits/functexcept.h> // For invalid_argument, out_of_range, // overflow_error #include <iosfwd> #include <bits/cxxabi_forced.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace tr2 { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * Dynamic Bitset. * * See N2050, * Proposal to Add a Dynamically Sizeable Bitset to the Standard Library. */ namespace __detail { template<typename T> class _Bool2UChar { typedef T type; }; template<> class _Bool2UChar<bool> { public: typedef unsigned char type; }; } /** * Base class, general case. * * See documentation for dynamic_bitset. */ template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>> struct __dynamic_bitset_base { static_assert(std::is_unsigned<_WordT>::value, "template argument " "_WordT not an unsigned integral type"); typedef _WordT block_type; typedef _Alloc allocator_type; typedef size_t size_type; static const size_type _S_bits_per_block = __CHAR_BIT__ * sizeof(block_type); static const size_type npos = static_cast<size_type>(-1); /// 0 is the least significant word. std::vector<block_type, allocator_type> _M_w; explicit __dynamic_bitset_base(const allocator_type& __alloc = allocator_type()) : _M_w(__alloc) { } explicit __dynamic_bitset_base(__dynamic_bitset_base&& __b) { this->_M_w.swap(__b._M_w); } explicit __dynamic_bitset_base(size_type __nbits, unsigned long long __val = 0ULL, const allocator_type& __alloc = allocator_type()) : _M_w(__nbits / _S_bits_per_block + (__nbits % _S_bits_per_block > 0), __val, __alloc) { unsigned long long __mask = ~static_cast<block_type>(0); size_t __n = std::min(this->_M_w.size(), sizeof(unsigned long long) / sizeof(block_type)); for (size_t __i = 0; __i < __n; ++__i) { this->_M_w[__i] = (__val & __mask) >> (__i * _S_bits_per_block); __mask <<= _S_bits_per_block; } } void _M_assign(const __dynamic_bitset_base& __b) { this->_M_w = __b._M_w; } void _M_swap(__dynamic_bitset_base& __b) { this->_M_w.swap(__b._M_w); } void _M_clear() { this->_M_w.clear(); } void _M_resize(size_t __nbits, bool __value) { size_t __sz = __nbits / _S_bits_per_block; if (__nbits % _S_bits_per_block > 0) ++__sz; if (__sz != this->_M_w.size()) this->_M_w.resize(__sz); } allocator_type _M_get_allocator() const { return this->_M_w.get_allocator(); } static size_type _S_whichword(size_type __pos) noexcept { return __pos / _S_bits_per_block; } static size_type _S_whichbyte(size_type __pos) noexcept { return (__pos % _S_bits_per_block) / __CHAR_BIT__; } static size_type _S_whichbit(size_type __pos) noexcept { return __pos % _S_bits_per_block; } static block_type _S_maskbit(size_type __pos) noexcept { return (static_cast<block_type>(1)) << _S_whichbit(__pos); } block_type& _M_getword(size_type __pos) { return this->_M_w[_S_whichword(__pos)]; } block_type _M_getword(size_type __pos) const { return this->_M_w[_S_whichword(__pos)]; } block_type& _M_hiword() { return this->_M_w[_M_w.size() - 1]; } block_type _M_hiword() const { return this->_M_w[_M_w.size() - 1]; } void _M_do_and(const __dynamic_bitset_base& __x) { if (__x._M_w.size() == this->_M_w.size()) for (size_t __i = 0; __i < this->_M_w.size(); ++__i) this->_M_w[__i] &= __x._M_w[__i]; else return; } void _M_do_or(const __dynamic_bitset_base& __x) { if (__x._M_w.size() == this->_M_w.size()) for (size_t __i = 0; __i < this->_M_w.size(); ++__i) this->_M_w[__i] |= __x._M_w[__i]; else return; } void _M_do_xor(const __dynamic_bitset_base& __x) { if (__x._M_w.size() == this->_M_w.size()) for (size_t __i = 0; __i < this->_M_w.size(); ++__i) this->_M_w[__i] ^= __x._M_w[__i]; else return; } void _M_do_dif(const __dynamic_bitset_base& __x) { if (__x._M_w.size() == this->_M_w.size()) for (size_t __i = 0; __i < this->_M_w.size(); ++__i) this->_M_w[__i] &= ~__x._M_w[__i]; else return; } void _M_do_left_shift(size_t __shift); void _M_do_right_shift(size_t __shift); void _M_do_flip() { for (size_t __i = 0; __i < this->_M_w.size(); ++__i) this->_M_w[__i] = ~this->_M_w[__i]; } void _M_do_set() { for (size_t __i = 0; __i < this->_M_w.size(); ++__i) this->_M_w[__i] = ~static_cast<block_type>(0); } void _M_do_reset() { for (size_t __i = 0; __i < this->_M_w.size(); ++__i) this->_M_w[__i] = static_cast<block_type>(0); } bool _M_is_equal(const __dynamic_bitset_base& __x) const { if (__x.size() == this->size()) { for (size_t __i = 0; __i < this->_M_w.size(); ++__i) if (this->_M_w[__i] != __x._M_w[__i]) return false; return true; } else return false; } bool _M_is_less(const __dynamic_bitset_base& __x) const { if (__x.size() == this->size()) { for (size_t __i = this->_M_w.size(); __i > 0; --__i) { if (this->_M_w[__i-1] < __x._M_w[__i-1]) return true; else if (this->_M_w[__i-1] > __x._M_w[__i-1]) return false; } return false; } else return false; } size_t _M_are_all_aux() const { for (size_t __i = 0; __i < this->_M_w.size() - 1; ++__i) if (_M_w[__i] != ~static_cast<block_type>(0)) return 0; return ((this->_M_w.size() - 1) * _S_bits_per_block + __builtin_popcountl(this->_M_hiword())); } bool _M_is_any() const { for (size_t __i = 0; __i < this->_M_w.size(); ++__i) if (this->_M_w[__i] != static_cast<block_type>(0)) return true; return false; } bool _M_is_subset_of(const __dynamic_bitset_base& __b) { if (__b.size() == this->size()) { for (size_t __i = 0; __i < _M_w.size(); ++__i) if (this->_M_w[__i] != (this->_M_w[__i] | __b._M_w[__i])) return false; return true; } else return false; } bool _M_is_proper_subset_of(const __dynamic_bitset_base& __b) const { if (this->is_subset_of(__b)) { if (*this == __b) return false; else return true; } else return false; } size_t _M_do_count() const { size_t __result = 0; for (size_t __i = 0; __i < this->_M_w.size(); ++__i) __result += __builtin_popcountl(this->_M_w[__i]); return __result; } size_type _M_size() const noexcept { return this->_M_w.size(); } unsigned long _M_do_to_ulong() const; unsigned long long _M_do_to_ullong() const; // find first "on" bit size_type _M_do_find_first(size_t __not_found) const; // find the next "on" bit that follows "prev" size_type _M_do_find_next(size_t __prev, size_t __not_found) const; // do append of block void _M_do_append_block(block_type __block, size_type __pos) { size_t __offset = __pos % _S_bits_per_block; if (__offset == 0) this->_M_w.push_back(__block); else { this->_M_hiword() |= (__block << __offset); this->_M_w.push_back(__block >> (_S_bits_per_block - __offset)); } } }; // Definitions of non-inline functions from __dynamic_bitset_base. template<typename _WordT, typename _Alloc> void __dynamic_bitset_base<_WordT, _Alloc>::_M_do_left_shift(size_t __shift) { if (__builtin_expect(__shift != 0, 1)) { const size_t __wshift = __shift / _S_bits_per_block; const size_t __offset = __shift % _S_bits_per_block; if (__offset == 0) for (size_t __n = this->_M_w.size() - 1; __n >= __wshift; --__n) this->_M_w[__n] = this->_M_w[__n - __wshift]; else { const size_t __sub_offset = _S_bits_per_block - __offset; for (size_t __n = _M_w.size() - 1; __n > __wshift; --__n) this->_M_w[__n] = ((this->_M_w[__n - __wshift] << __offset) | (this->_M_w[__n - __wshift - 1] >> __sub_offset)); this->_M_w[__wshift] = this->_M_w[0] << __offset; } //// std::fill(this->_M_w.begin(), this->_M_w.begin() + __wshift, //// static_cast<_WordT>(0)); } } template<typename _WordT, typename _Alloc> void __dynamic_bitset_base<_WordT, _Alloc>::_M_do_right_shift(size_t __shift) { if (__builtin_expect(__shift != 0, 1)) { const size_t __wshift = __shift / _S_bits_per_block; const size_t __offset = __shift % _S_bits_per_block; const size_t __limit = this->_M_w.size() - __wshift - 1; if (__offset == 0) for (size_t __n = 0; __n <= __limit; ++__n) this->_M_w[__n] = this->_M_w[__n + __wshift]; else { const size_t __sub_offset = (_S_bits_per_block - __offset); for (size_t __n = 0; __n < __limit; ++__n) this->_M_w[__n] = ((this->_M_w[__n + __wshift] >> __offset) | (this->_M_w[__n + __wshift + 1] << __sub_offset)); this->_M_w[__limit] = this->_M_w[_M_w.size()-1] >> __offset; } ////std::fill(this->_M_w.begin() + __limit + 1, this->_M_w.end(), //// static_cast<_WordT>(0)); } } template<typename _WordT, typename _Alloc> unsigned long __dynamic_bitset_base<_WordT, _Alloc>::_M_do_to_ulong() const { size_t __n = sizeof(unsigned long) / sizeof(block_type); for (size_t __i = __n; __i < this->_M_w.size(); ++__i) if (this->_M_w[__i]) __throw_overflow_error(__N("__dynamic_bitset_base::_M_do_to_ulong")); unsigned long __res = 0UL; for (size_t __i = 0; __i < __n && __i < this->_M_w.size(); ++__i) __res += this->_M_w[__i] << (__i * _S_bits_per_block); return __res; } template<typename _WordT, typename _Alloc> unsigned long long __dynamic_bitset_base<_WordT, _Alloc>::_M_do_to_ullong() const { size_t __n = sizeof(unsigned long long) / sizeof(block_type); for (size_t __i = __n; __i < this->_M_w.size(); ++__i) if (this->_M_w[__i]) __throw_overflow_error(__N("__dynamic_bitset_base::_M_do_to_ullong")); unsigned long long __res = 0ULL; for (size_t __i = 0; __i < __n && __i < this->_M_w.size(); ++__i) __res += this->_M_w[__i] << (__i * _S_bits_per_block); return __res; } template<typename _WordT, typename _Alloc> size_t __dynamic_bitset_base<_WordT, _Alloc> ::_M_do_find_first(size_t __not_found) const { for (size_t __i = 0; __i < this->_M_w.size(); ++__i) { _WordT __thisword = this->_M_w[__i]; if (__thisword != static_cast<_WordT>(0)) return (__i * _S_bits_per_block + __builtin_ctzl(__thisword)); } // not found, so return an indication of failure. return __not_found; } template<typename _WordT, typename _Alloc> size_t __dynamic_bitset_base<_WordT, _Alloc> ::_M_do_find_next(size_t __prev, size_t __not_found) const { // make bound inclusive ++__prev; // check out of bounds if (__prev >= this->_M_w.size() * _S_bits_per_block) return __not_found; // search first word size_t __i = _S_whichword(__prev); _WordT __thisword = this->_M_w[__i]; // mask off bits below bound __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev); if (__thisword != static_cast<_WordT>(0)) return (__i * _S_bits_per_block + __builtin_ctzl(__thisword)); // check subsequent words for (++__i; __i < this->_M_w.size(); ++__i) { __thisword = this->_M_w[__i]; if (__thisword != static_cast<_WordT>(0)) return (__i * _S_bits_per_block + __builtin_ctzl(__thisword)); } // not found, so return an indication of failure. return __not_found; } // end _M_do_find_next /** * @brief The %dynamic_bitset class represents a sequence of bits. * * @ingroup containers * * (Note that %dynamic_bitset does @e not meet the formal * requirements of a <a href="tables.html#65">container</a>. * Mainly, it lacks iterators.) * * The template argument, @a Nb, may be any non-negative number, * specifying the number of bits (e.g., "0", "12", "1024*1024"). * * In the general unoptimized case, storage is allocated in * word-sized blocks. Let B be the number of bits in a word, then * (Nb+(B-1))/B words will be used for storage. B - Nb%B bits are * unused. (They are the high-order bits in the highest word.) It * is a class invariant that those unused bits are always zero. * * If you think of %dynamic_bitset as "a simple array of bits," be * aware that your mental picture is reversed: a %dynamic_bitset * behaves the same way as bits in integers do, with the bit at * index 0 in the "least significant / right-hand" position, and * the bit at index Nb-1 in the "most significant / left-hand" * position. Thus, unlike other containers, a %dynamic_bitset's * index "counts from right to left," to put it very loosely. * * This behavior is preserved when translating to and from strings. * For example, the first line of the following program probably * prints "b('a') is 0001100001" on a modern ASCII system. * * @code * #include <dynamic_bitset> * #include <iostream> * #include <sstream> * * using namespace std; * * int main() * { * long a = 'a'; * dynamic_bitset b(a); * * cout << "b('a') is " << b << endl; * * ostringstream s; * s << b; * string str = s.str(); * cout << "index 3 in the string is " << str[3] << " but\n" * << "index 3 in the bitset is " << b[3] << endl; * } * @endcode * * Also see: * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt12ch33s02.html * for a description of extensions. * * Most of the actual code isn't contained in %dynamic_bitset<> * itself, but in the base class __dynamic_bitset_base. The base * class works with whole words, not with individual bits. This * allows us to specialize __dynamic_bitset_base for the important * special case where the %dynamic_bitset is only a single word. * * Extra confusion can result due to the fact that the storage for * __dynamic_bitset_base @e is a vector, and is indexed as such. This is * carefully encapsulated. */ template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>> class dynamic_bitset : private __dynamic_bitset_base<_WordT, _Alloc> { static_assert(std::is_unsigned<_WordT>::value, "template argument " "_WordT not an unsigned integral type"); public: typedef __dynamic_bitset_base<_WordT, _Alloc> _Base; typedef _WordT block_type; typedef _Alloc allocator_type; typedef size_t size_type; static const size_type bits_per_block = __CHAR_BIT__ * sizeof(block_type); // Use this: constexpr size_type std::numeric_limits<size_type>::max(). static const size_type npos = static_cast<size_type>(-1); private: // Clear the unused bits in the uppermost word. void _M_do_sanitize() { size_type __shift = this->_M_Nb % bits_per_block; if (__shift > 0) this->_M_hiword() &= ~((~static_cast<block_type>(0)) << __shift); } /** * These versions of single-bit set, reset, flip, and test * do no range checking. */ dynamic_bitset<_WordT, _Alloc>& _M_unchecked_set(size_type __pos) { this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); return *this; } dynamic_bitset<_WordT, _Alloc>& _M_unchecked_set(size_type __pos, int __val) { if (__val) this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); else this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); return *this; } dynamic_bitset<_WordT, _Alloc>& _M_unchecked_reset(size_type __pos) { this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); return *this; } dynamic_bitset<_WordT, _Alloc>& _M_unchecked_flip(size_type __pos) { this->_M_getword(__pos) ^= _Base::_S_maskbit(__pos); return *this; } bool _M_unchecked_test(size_type __pos) const { return ((this->_M_getword(__pos) & _Base::_S_maskbit(__pos)) != static_cast<_WordT>(0)); } size_type _M_Nb; public: /** * This encapsulates the concept of a single bit. An instance * of this class is a proxy for an actual bit; this way the * individual bit operations are done as faster word-size * bitwise instructions. * * Most users will never need to use this class directly; * conversions to and from bool are automatic and should be * transparent. Overloaded operators help to preserve the * illusion. * * (On a typical system, this "bit %reference" is 64 times the * size of an actual bit. Ha.) */ class reference { friend class dynamic_bitset; block_type *_M_wp; size_type _M_bpos; // left undefined reference(); public: reference(dynamic_bitset& __b, size_type __pos) { this->_M_wp = &__b._M_getword(__pos); this->_M_bpos = _Base::_S_whichbit(__pos); } ~reference() { } // For b[i] = __x; reference& operator=(bool __x) { if (__x) *this->_M_wp |= _Base::_S_maskbit(this->_M_bpos); else *this->_M_wp &= ~_Base::_S_maskbit(this->_M_bpos); return *this; } // For b[i] = b[__j]; reference& operator=(const reference& __j) { if ((*(__j._M_wp) & _Base::_S_maskbit(__j._M_bpos))) *this->_M_wp |= _Base::_S_maskbit(this->_M_bpos); else *this->_M_wp &= ~_Base::_S_maskbit(this->_M_bpos); return *this; } // Flips the bit bool operator~() const { return (*(_M_wp) & _Base::_S_maskbit(this->_M_bpos)) == 0; } // For __x = b[i]; operator bool() const { return (*(this->_M_wp) & _Base::_S_maskbit(this->_M_bpos)) != 0; } // For b[i].flip(); reference& flip() { *this->_M_wp ^= _Base::_S_maskbit(this->_M_bpos); return *this; } }; friend class reference; typedef bool const_reference; // 23.3.5.1 constructors: /// All bits set to zero. explicit dynamic_bitset(const allocator_type& __alloc = allocator_type()) : _Base(__alloc), _M_Nb(0) { } /// Initial bits bitwise-copied from a single word (others set to zero). explicit dynamic_bitset(size_type __nbits, unsigned long long __val = 0ULL, const allocator_type& __alloc = allocator_type()) : _Base(__nbits, __val, __alloc), _M_Nb(__nbits) { } dynamic_bitset(initializer_list<block_type> __il, const allocator_type& __alloc = allocator_type()) : _Base(__alloc), _M_Nb(0) { this->append(__il); } /** * @brief Use a subset of a string. * @param __str A string of '0' and '1' characters. * @param __pos Index of the first character in @p __str to use. * @param __n The number of characters to copy. * @throw std::out_of_range If @p __pos is bigger the size of @p __str. * @throw std::invalid_argument If a character appears in the string * which is neither '0' nor '1'. */ template<typename _CharT, typename _Traits, typename _Alloc1> explicit dynamic_bitset(const std::basic_string<_CharT, _Traits, _Alloc1>& __str, typename basic_string<_CharT,_Traits,_Alloc1>::size_type __pos = 0, typename basic_string<_CharT,_Traits,_Alloc1>::size_type __n = std::basic_string<_CharT, _Traits, _Alloc1>::npos, _CharT __zero = _CharT('0'), _CharT __one = _CharT('1'), const allocator_type& __alloc = allocator_type()) : _Base(__alloc), _M_Nb(0) // Watch for npos. { if (__pos > __str.size()) __throw_out_of_range(__N("dynamic_bitset::bitset initial position " "not valid")); // Watch for npos. this->_M_Nb = (__n > __str.size() ? __str.size() - __pos : __n); this->resize(this->_M_Nb); this->_M_copy_from_string(__str, __pos, __n, _CharT('0'), _CharT('1')); } /** * @brief Construct from a string. * @param __str A string of '0' and '1' characters. * @throw std::invalid_argument If a character appears in the string * which is neither '0' nor '1'. */ explicit dynamic_bitset(const char* __str, const allocator_type& __alloc = allocator_type()) : _Base(__alloc) { size_t __len = 0; if (__str) while (__str[__len] != '\0') ++__len; this->resize(__len); this->_M_copy_from_ptr<char,std::char_traits<char>> (__str, __len, 0, __len, '0', '1'); } /** * @brief Copy constructor. */ dynamic_bitset(const dynamic_bitset& __b) : _Base(__b), _M_Nb(__b.size()) { } /** * @brief Move constructor. */ dynamic_bitset(dynamic_bitset&& __b) : _Base(std::forward<_Base>(__b)), _M_Nb(__b.size()) { } /** * @brief Swap with another bitset. */ void swap(dynamic_bitset& __b) { this->_M_swap(__b); std::swap(this->_M_Nb, __b._M_Nb); } /** * @brief Assignment. */ dynamic_bitset& operator=(const dynamic_bitset& __b) { if (&__b != this) { this->_M_assign(__b); this->_M_Nb = __b._M_Nb; } } /** * @brief Move assignment. */ dynamic_bitset& operator=(dynamic_bitset&& __b) { this->swap(__b); return *this; } /** * @brief Return the allocator for the bitset. */ allocator_type get_allocator() const { return this->_M_get_allocator(); } /** * @brief Resize the bitset. */ void resize(size_type __nbits, bool __value = false) { this->_M_resize(__nbits, __value); this->_M_Nb = __nbits; this->_M_do_sanitize(); } /** * @brief Clear the bitset. */ void clear() { this->_M_clear(); this->_M_Nb = 0; } /** * @brief Push a bit onto the high end of the bitset. */ void push_back(bool __bit) { if (size_t __offset = this->size() % bits_per_block == 0) this->_M_do_append_block(block_type(0), this->_M_Nb); ++this->_M_Nb; this->_M_unchecked_set(this->_M_Nb, __bit); } /** * @brief Append a block. */ void append(block_type __block) { this->_M_do_append_block(__block, this->_M_Nb); this->_M_Nb += bits_per_block; } /** * @brief */ void append(initializer_list<block_type> __il) { this->append(__il.begin(), __il.end()); } /** * @brief Append an iterator range of blocks. */ template <typename _BlockInputIterator> void append(_BlockInputIterator __first, _BlockInputIterator __last) { for (; __first != __last; ++__first) this->append(*__first); } // 23.3.5.2 dynamic_bitset operations: //@{ /** * @brief Operations on dynamic_bitsets. * @param __rhs A same-sized dynamic_bitset. * * These should be self-explanatory. */ dynamic_bitset<_WordT, _Alloc>& operator&=(const dynamic_bitset<_WordT, _Alloc>& __rhs) { this->_M_do_and(__rhs); return *this; } dynamic_bitset<_WordT, _Alloc>& operator&=(dynamic_bitset<_WordT, _Alloc>&& __rhs) { this->_M_do_and(std::move(__rhs)); return *this; } dynamic_bitset<_WordT, _Alloc>& operator|=(const dynamic_bitset<_WordT, _Alloc>& __rhs) { this->_M_do_or(__rhs); return *this; } dynamic_bitset<_WordT, _Alloc>& operator^=(const dynamic_bitset<_WordT, _Alloc>& __rhs) { this->_M_do_xor(__rhs); return *this; } dynamic_bitset<_WordT, _Alloc>& operator-=(const dynamic_bitset<_WordT, _Alloc>& __rhs) { this->_M_do_dif(__rhs); return *this; } //@} //@{ /** * @brief Operations on dynamic_bitsets. * @param __pos The number of places to shift. * * These should be self-explanatory. */ dynamic_bitset<_WordT, _Alloc>& operator<<=(size_type __pos) { if (__builtin_expect(__pos < this->_M_Nb, 1)) { this->_M_do_left_shift(__pos); this->_M_do_sanitize(); } else this->_M_do_reset(); return *this; } dynamic_bitset<_WordT, _Alloc>& operator>>=(size_type __pos) { if (__builtin_expect(__pos < this->_M_Nb, 1)) { this->_M_do_right_shift(__pos); this->_M_do_sanitize(); } else this->_M_do_reset(); return *this; } //@} // Set, reset, and flip. /** * @brief Sets every bit to true. */ dynamic_bitset<_WordT, _Alloc>& set() { this->_M_do_set(); this->_M_do_sanitize(); return *this; } /** * @brief Sets a given bit to a particular value. * @param __pos The index of the bit. * @param __val Either true or false, defaults to true. * @throw std::out_of_range If @a __pos is bigger the size of the %set. */ dynamic_bitset<_WordT, _Alloc>& set(size_type __pos, bool __val = true) { if (__pos >= _M_Nb) __throw_out_of_range(__N("dynamic_bitset::set")); return this->_M_unchecked_set(__pos, __val); } /** * @brief Sets every bit to false. */ dynamic_bitset<_WordT, _Alloc>& reset() { this->_M_do_reset(); return *this; } /** * @brief Sets a given bit to false. * @param __pos The index of the bit. * @throw std::out_of_range If @a __pos is bigger the size of the %set. * * Same as writing @c set(__pos, false). */ dynamic_bitset<_WordT, _Alloc>& reset(size_type __pos) { if (__pos >= _M_Nb) __throw_out_of_range(__N("dynamic_bitset::reset")); return this->_M_unchecked_reset(__pos); } /** * @brief Toggles every bit to its opposite value. */ dynamic_bitset<_WordT, _Alloc>& flip() { this->_M_do_flip(); this->_M_do_sanitize(); return *this; } /** * @brief Toggles a given bit to its opposite value. * @param __pos The index of the bit. * @throw std::out_of_range If @a __pos is bigger the size of the %set. */ dynamic_bitset<_WordT, _Alloc>& flip(size_type __pos) { if (__pos >= _M_Nb) __throw_out_of_range(__N("dynamic_bitset::flip")); return this->_M_unchecked_flip(__pos); } /// See the no-argument flip(). dynamic_bitset<_WordT, _Alloc> operator~() const { return dynamic_bitset<_WordT, _Alloc>(*this).flip(); } //@{ /** * @brief Array-indexing support. * @param __pos Index into the %dynamic_bitset. * @return A bool for a 'const %dynamic_bitset'. For non-const * bitsets, an instance of the reference proxy class. * @note These operators do no range checking and throw no * exceptions, as required by DR 11 to the standard. */ reference operator[](size_type __pos) { return reference(*this,__pos); } const_reference operator[](size_type __pos) const { return _M_unchecked_test(__pos); } //@} /** * @brief Returns a numerical interpretation of the %dynamic_bitset. * @return The integral equivalent of the bits. * @throw std::overflow_error If there are too many bits to be * represented in an @c unsigned @c long. */ unsigned long to_ulong() const { return this->_M_do_to_ulong(); } /** * @brief Returns a numerical interpretation of the %dynamic_bitset. * @return The integral equivalent of the bits. * @throw std::overflow_error If there are too many bits to be * represented in an @c unsigned @c long. */ unsigned long long to_ullong() const { return this->_M_do_to_ullong(); } /** * @brief Returns a character interpretation of the %dynamic_bitset. * @return The string equivalent of the bits. * * Note the ordering of the bits: decreasing character positions * correspond to increasing bit positions (see the main class notes for * an example). */ template<typename _CharT = char, typename _Traits = std::char_traits<_CharT>, typename _Alloc1 = std::allocator<_CharT>> std::basic_string<_CharT, _Traits, _Alloc1> to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const { std::basic_string<_CharT, _Traits, _Alloc1> __result; _M_copy_to_string(__result, __zero, __one); return __result; } // Helper functions for string operations. template<typename _CharT, typename _Traits> void _M_copy_from_ptr(const _CharT*, size_t, size_t, size_t, _CharT, _CharT); template<typename _CharT, typename _Traits, typename _Alloc1> void _M_copy_from_string(const std::basic_string<_CharT, _Traits, _Alloc1>& __str, size_t __pos, size_t __n, _CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) { _M_copy_from_ptr<_CharT, _Traits>(__str.data(), __str.size(), __pos, __n, __zero, __one); } template<typename _CharT, typename _Traits, typename _Alloc1> void _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc1>& __str, _CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const; /// Returns the number of bits which are set. size_type count() const noexcept { return this->_M_do_count(); } /// Returns the total number of bits. size_type size() const noexcept { return this->_M_Nb; } /// Returns the total number of blocks. size_type num_blocks() const noexcept { return this->_M_size(); } /// Returns true if the dynamic_bitset is empty. bool empty() const noexcept { return (this->_M_Nb == 0); } /// Returns the maximum size of a dynamic_bitset object having the same /// type as *this. /// The real answer is max() * bits_per_block but is likely to overflow. constexpr size_type max_size() noexcept { return std::numeric_limits<block_type>::max(); } /** * @brief Tests the value of a bit. * @param __pos The index of a bit. * @return The value at @a __pos. * @throw std::out_of_range If @a __pos is bigger the size of the %set. */ bool test(size_type __pos) const { if (__pos >= _M_Nb) __throw_out_of_range(__N("dynamic_bitset::test")); return _M_unchecked_test(__pos); } /** * @brief Tests whether all the bits are on. * @return True if all the bits are set. */ bool all() const { return this->_M_are_all_aux() == _M_Nb; } /** * @brief Tests whether any of the bits are on. * @return True if at least one bit is set. */ bool any() const { return this->_M_is_any(); } /** * @brief Tests whether any of the bits are on. * @return True if none of the bits are set. */ bool none() const { return !this->_M_is_any(); } //@{ /// Self-explanatory. dynamic_bitset<_WordT, _Alloc> operator<<(size_type __pos) const { return dynamic_bitset<_WordT, _Alloc>(*this) <<= __pos; } dynamic_bitset<_WordT, _Alloc> operator>>(size_type __pos) const { return dynamic_bitset<_WordT, _Alloc>(*this) >>= __pos; } //@} /** * @brief Finds the index of the first "on" bit. * @return The index of the first bit set, or size() if not found. * @sa find_next */ size_type find_first() const { return this->_M_do_find_first(this->_M_Nb); } /** * @brief Finds the index of the next "on" bit after prev. * @return The index of the next bit set, or size() if not found. * @param __prev Where to start searching. * @sa find_first */ size_type find_next(size_t __prev) const { return this->_M_do_find_next(__prev, this->_M_Nb); } bool is_subset_of(const dynamic_bitset& __b) const { return this->_M_is_subset_of(__b); } bool is_proper_subset_of(const dynamic_bitset& __b) const { return this->_M_is_proper_subset_of(__b); } }; // Definitions of non-inline member functions. template<typename _WordT, typename _Alloc> template<typename _CharT, typename _Traits> void dynamic_bitset<_WordT, _Alloc>:: _M_copy_from_ptr(const _CharT* __str, size_t __len, size_t __pos, size_t __n, _CharT __zero, _CharT __one) { reset(); const size_t __nbits = std::min(_M_Nb, std::min(__n, __len - __pos)); for (size_t __i = __nbits; __i > 0; --__i) { const _CharT __c = __str[__pos + __nbits - __i]; if (_Traits::eq(__c, __zero)) ; else if (_Traits::eq(__c, __one)) _M_unchecked_set(__i - 1); else __throw_invalid_argument(__N("dynamic_bitset::_M_copy_from_ptr")); } } template<typename _WordT, typename _Alloc> template<typename _CharT, typename _Traits, typename _Alloc1> void dynamic_bitset<_WordT, _Alloc>:: _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc1>& __str, _CharT __zero, _CharT __one) const { __str.assign(_M_Nb, __zero); for (size_t __i = _M_Nb; __i > 0; --__i) if (_M_unchecked_test(__i - 1)) _Traits::assign(__str[_M_Nb - __i], __one); } //@{ /// These comparisons for equality/inequality are, well, @e bitwise. template<typename _WordT, typename _Alloc> bool operator==(const dynamic_bitset<_WordT, _Alloc>& __lhs, const dynamic_bitset<_WordT, _Alloc>& __rhs) { return __lhs._M_is_equal(__rhs); } template<typename _WordT, typename _Alloc> bool operator!=(const dynamic_bitset<_WordT, _Alloc>& __lhs, const dynamic_bitset<_WordT, _Alloc>& __rhs) { return !__lhs._M_is_equal(__rhs); } template<typename _WordT, typename _Alloc> bool operator<(const dynamic_bitset<_WordT, _Alloc>& __lhs, const dynamic_bitset<_WordT, _Alloc>& __rhs) { return __lhs._M_is_less(__rhs); } template<typename _WordT, typename _Alloc> bool operator<=(const dynamic_bitset<_WordT, _Alloc>& __lhs, const dynamic_bitset<_WordT, _Alloc>& __rhs) { return !(__lhs > __rhs); } template<typename _WordT, typename _Alloc> bool operator>(const dynamic_bitset<_WordT, _Alloc>& __lhs, const dynamic_bitset<_WordT, _Alloc>& __rhs) { return __rhs < __lhs; } template<typename _WordT, typename _Alloc> bool operator>=(const dynamic_bitset<_WordT, _Alloc>& __lhs, const dynamic_bitset<_WordT, _Alloc>& __rhs) { return !(__lhs < __rhs); } //@} // 23.3.5.3 bitset operations: //@{ /** * @brief Global bitwise operations on bitsets. * @param __x A bitset. * @param __y A bitset of the same size as @a __x. * @return A new bitset. * * These should be self-explanatory. */ template<typename _WordT, typename _Alloc> inline dynamic_bitset<_WordT, _Alloc> operator&(const dynamic_bitset<_WordT, _Alloc>& __x, const dynamic_bitset<_WordT, _Alloc>& __y) { dynamic_bitset<_WordT, _Alloc> __result(__x); __result &= __y; return __result; } template<typename _WordT, typename _Alloc> inline dynamic_bitset<_WordT, _Alloc> operator|(const dynamic_bitset<_WordT, _Alloc>& __x, const dynamic_bitset<_WordT, _Alloc>& __y) { dynamic_bitset<_WordT, _Alloc> __result(__x); __result |= __y; return __result; } template <typename _WordT, typename _Alloc> inline dynamic_bitset<_WordT, _Alloc> operator^(const dynamic_bitset<_WordT, _Alloc>& __x, const dynamic_bitset<_WordT, _Alloc>& __y) { dynamic_bitset<_WordT, _Alloc> __result(__x); __result ^= __y; return __result; } template <typename _WordT, typename _Alloc> inline dynamic_bitset<_WordT, _Alloc> operator-(const dynamic_bitset<_WordT, _Alloc>& __x, const dynamic_bitset<_WordT, _Alloc>& __y) { dynamic_bitset<_WordT, _Alloc> __result(__x); __result -= __y; return __result; } //@} //@{ /** * @brief Global I/O operators for bitsets. * * Direct I/O between streams and bitsets is supported. Output is * straightforward. Input will skip whitespace and only accept '0' * and '1' characters. The %dynamic_bitset will grow as necessary * to hold the string of bits. */ template<typename _CharT, typename _Traits, typename _WordT, typename _Alloc> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, dynamic_bitset<_WordT, _Alloc>& __x) { typedef typename _Traits::char_type char_type; typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; std::basic_string<_CharT, _Traits> __tmp; __tmp.reserve(__x.size()); const char_type __zero = __is.widen('0'); const char_type __one = __is.widen('1'); typename __ios_base::iostate __state = __ios_base::goodbit; typename __istream_type::sentry __sentry(__is); if (__sentry) { __try { while (1) { static typename _Traits::int_type __eof = _Traits::eof(); typename _Traits::int_type __c1 = __is.rdbuf()->sbumpc(); if (_Traits::eq_int_type(__c1, __eof)) { __state |= __ios_base::eofbit; break; } else { const char_type __c2 = _Traits::to_char_type(__c1); if (_Traits::eq(__c2, __zero)) __tmp.push_back(__zero); else if (_Traits::eq(__c2, __one)) __tmp.push_back(__one); else if (_Traits:: eq_int_type(__is.rdbuf()->sputbackc(__c2), __eof)) { __state |= __ios_base::failbit; break; } else break; } } } __catch(__cxxabiv1::__forced_unwind&) { __is._M_setstate(__ios_base::badbit); __throw_exception_again; } __catch(...) { __is._M_setstate(__ios_base::badbit); } } __x.resize(__tmp.size()); if (__tmp.empty() && __x.size()) __state |= __ios_base::failbit; else __x._M_copy_from_string(__tmp, static_cast<size_t>(0), __x.size(), __zero, __one); if (__state) __is.setstate(__state); return __is; } template <typename _CharT, typename _Traits, typename _WordT, typename _Alloc> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const dynamic_bitset<_WordT, _Alloc>& __x) { std::basic_string<_CharT, _Traits> __tmp; const ctype<_CharT>& __ct = use_facet<ctype<_CharT>>(__os.getloc()); __x._M_copy_to_string(__tmp, __ct.widen('0'), __ct.widen('1')); return __os << __tmp; } //@} _GLIBCXX_END_NAMESPACE_VERSION } // tr2 } // std #undef _GLIBCXX_BITSET_BITS_PER_WORD #endif /* _GLIBCXX_TR2_DYNAMIC_BITSET */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr2/bool_set������������������������������������������������������������������������������0000644�����������������00000016312�14763166027�0010044 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR2 <bool_set> -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr2/bool_set * This is a TR2 C++ Library header. */ #ifndef _GLIBCXX_TR2_BOOL_SET #define _GLIBCXX_TR2_BOOL_SET 1 #pragma GCC system_header #include <typeinfo> #include <iostream> namespace std _GLIBCXX_VISIBILITY(default) { namespace tr2 { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * bool_set * * See N2136, Bool_set: multi-valued logic * by Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion. * * The implicit conversion to bool is slippery! I may use the new * explicit conversion. This has been specialized in the language * so that in contexts requiring a bool the conversion happens * implicitly. Thus most objections should be eliminated. */ class bool_set { public: /// Default constructor. constexpr bool_set() : _M_b(_S_false) { } /// Constructor from bool. constexpr bool_set(bool __t) : _M_b(_Bool_set_val(__t)) { } // I'm not sure about this. bool contains(bool_set __b) const { return this->is_singleton() && this->equals(__b); } /// Return true if states are equal. bool equals(bool_set __b) const { return __b._M_b == _M_b; } /// Return true if this is empty. bool is_emptyset() const { return _M_b == _S_empty; } /// Return true if this is indeterminate. bool is_indeterminate() const { return _M_b == _S_indet; } /// Return true if this is false or true (normal boolean). bool is_singleton() const { return _M_b == _S_false || _M_b == _S_true_; } /// Conversion to bool. //explicit operator bool() const { if (! is_singleton()) throw std::bad_cast(); return _M_b; } /// static bool_set indeterminate() { bool_set __b; __b._M_b = _S_indet; return __b; } /// static bool_set emptyset() { bool_set __b; __b._M_b = _S_empty; return __b; } friend bool_set operator!(bool_set __b) { return __b._M_not(); } friend bool_set operator^(bool_set __s, bool_set __t) { return __s._M_xor(__t); } friend bool_set operator|(bool_set __s, bool_set __t) { return __s._M_or(__t); } friend bool_set operator&(bool_set __s, bool_set __t) { return __s._M_and(__t); } friend bool_set operator==(bool_set __s, bool_set __t) { return __s._M_eq(__t); } // These overloads replace the facet additions in the paper! template<typename CharT, typename Traits> friend std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& __out, bool_set __b) { int __a = __b._M_b; __out << __a; } template<typename CharT, typename Traits> friend std::basic_istream<CharT, Traits>& operator>>(std::basic_istream<CharT, Traits>& __in, bool_set& __b) { long __c; __in >> __c; if (__c >= _S_false && __c < _S_empty) __b._M_b = static_cast<_Bool_set_val>(__c); } private: /// enum _Bool_set_val: unsigned char { _S_false = 0, _S_true_ = 1, _S_indet = 2, _S_empty = 3 }; /// Bool set state. _Bool_set_val _M_b; /// bool_set(_Bool_set_val __c) : _M_b(__c) { } /// bool_set _M_not() const { return _S_not[this->_M_b]; } /// bool_set _M_xor(bool_set __b) const { return _S_xor[this->_M_b][__b._M_b]; } /// bool_set _M_or(bool_set __b) const { return _S_or[this->_M_b][__b._M_b]; } /// bool_set _M_and(bool_set __b) const { return _S_and[this->_M_b][__b._M_b]; } /// bool_set _M_eq(bool_set __b) const { return _S_eq[this->_M_b][__b._M_b]; } /// static _Bool_set_val _S_not[4]; /// static _Bool_set_val _S_xor[4][4]; /// static _Bool_set_val _S_or[4][4]; /// static _Bool_set_val _S_and[4][4]; /// static _Bool_set_val _S_eq[4][4]; }; // 20.2.3.2 bool_set values inline bool contains(bool_set __s, bool_set __t) { return __s.contains(__t); } inline bool equals(bool_set __s, bool_set __t) { return __s.equals(__t); } inline bool is_emptyset(bool_set __b) { return __b.is_emptyset(); } inline bool is_indeterminate(bool_set __b) { return __b.is_indeterminate(); } inline bool is_singleton(bool_set __b) { return __b.is_singleton(); } inline bool certainly(bool_set __b) { return ! __b.contains(false); } inline bool possibly(bool_set __b) { return __b.contains(true); } // 20.2.3.3 bool_set set operations inline bool_set set_union(bool __s, bool_set __t) { return bool_set(__s) | __t; } inline bool_set set_union(bool_set __s, bool __t) { return __s | bool_set(__t); } inline bool_set set_union(bool_set __s, bool_set __t) { return __s | __t; } inline bool_set set_intersection(bool __s, bool_set __t) { return bool_set(__s) & __t; } inline bool_set set_intersection(bool_set __s, bool __t) { return __s & bool_set(__t); } inline bool_set set_intersection(bool_set __s, bool_set __t) { return __s & __t; } inline bool_set set_complement(bool_set __b) { return ! __b; } // 20.2.3.4 bool_set logical operators inline bool_set operator^(bool __s, bool_set __t) { return bool_set(__s) ^ __t; } inline bool_set operator^(bool_set __s, bool __t) { return __s ^ bool_set(__t); } inline bool_set operator|(bool __s, bool_set __t) { return bool_set(__s) | __t; } inline bool_set operator|(bool_set __s, bool __t) { return __s | bool_set(__t); } inline bool_set operator&(bool __s, bool_set __t) { return bool_set(__s) & __t; } inline bool_set operator&(bool_set __s, bool __t) { return __s & bool_set(__t); } // 20.2.3.5 bool_set relational operators inline bool_set operator==(bool __s, bool_set __t) { return bool_set(__s) == __t; } inline bool_set operator==(bool_set __s, bool __t) { return __s == bool_set(__t); } inline bool_set operator!=(bool __s, bool_set __t) { return ! (__s == __t); } inline bool_set operator!=(bool_set __s, bool __t) { return ! (__s == __t); } inline bool_set operator!=(bool_set __s, bool_set __t) { return ! (__s == __t); } _GLIBCXX_END_NAMESPACE_VERSION } } #include <tr2/bool_set.tcc> #endif // _GLIBCXX_TR2_BOOL_SET ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr2/ratio���������������������������������������������������������������������������������0000644�����������������00000004122�14763166027�0007350 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR2 <ratio> -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr2/ratio * This is a TR2 C++ Library header. */ #include <ratio> namespace std _GLIBCXX_VISIBILITY(default) { namespace tr2 { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<intmax_t _Pn, size_t _Bit, bool = _Bit < static_cast<size_t> (std::numeric_limits<intmax_t>::digits)> struct __safe_lshift { static const intmax_t __value = 0; }; template<intmax_t _Pn, size_t _Bit> struct __safe_lshift<_Pn, _Bit, true> { static const intmax_t __value = _Pn << _Bit; }; /// Add binary prefixes (IEC 60027-2 A.2 and ISO/IEC 80000). typedef ratio<__safe_lshift<1, 10>::__value, 1> kibi; typedef ratio<__safe_lshift<1, 20>::__value, 1> mebi; typedef ratio<__safe_lshift<1, 30>::__value, 1> gibi; typedef ratio<__safe_lshift<1, 40>::__value, 1> tebi; typedef ratio<__safe_lshift<1, 50>::__value, 1> pebi; typedef ratio<__safe_lshift<1, 60>::__value, 1> exbi; //typedef ratio<__safe_lshift<1, 70>::__value, 1> zebi; //typedef ratio<__safe_lshift<1, 80>::__value, 1> yobi; _GLIBCXX_END_NAMESPACE_VERSION } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr2/type_traits���������������������������������������������������������������������������0000644�����������������00000005213�14763166027�0010603 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR2 <type_traits> -*- C++ -*- // Copyright (C) 2011-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr2/type_traits * This is a TR2 C++ Library header. */ #ifndef _GLIBCXX_TR2_TYPE_TRAITS #define _GLIBCXX_TR2_TYPE_TRAITS 1 #pragma GCC system_header #include <type_traits> #include <bits/c++config.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace tr2 { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup metaprogramming * @{ */ /** * See N2965: Type traits and base classes * by Michael Spertus */ /** * Simple typelist. Compile-time list of types. */ template<typename... _Elements> struct __reflection_typelist; /// Specialization for an empty typelist. template<> struct __reflection_typelist<> { typedef std::true_type empty; }; /// Partial specialization. template<typename _First, typename... _Rest> struct __reflection_typelist<_First, _Rest...> { typedef std::false_type empty; struct first { typedef _First type; }; struct rest { typedef __reflection_typelist<_Rest...> type; }; }; /// Sequence abstraction metafunctions for manipulating a typelist. /// Enumerate all the base classes of a class. Form of a typelist. template<typename _Tp> struct bases { typedef __reflection_typelist<__bases(_Tp)...> type; }; /// Enumerate all the direct base classes of a class. Form of a typelist. template<typename _Tp> struct direct_bases { typedef __reflection_typelist<__direct_bases(_Tp)...> type; }; /// @} group metaprogramming _GLIBCXX_END_NAMESPACE_VERSION } } #endif // _GLIBCXX_TR2_TYPE_TRAITS �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr2/bool_set.tcc��������������������������������������������������������������������������0000644�����������������00000020177�14763166027�0010620 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR2 <bool_set> support files -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr2/bool_set.tcc * This is a TR2 C++ Library header. */ #ifndef _GLIBCXX_TR2_BOOL_SET_TCC #define _GLIBCXX_TR2_BOOL_SET_TCC 1 #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { namespace tr2 { _GLIBCXX_BEGIN_NAMESPACE_VERSION bool_set::_Bool_set_val bool_set::_S_not[4] = { _S_true_, _S_false, _S_indet, _S_empty }; bool_set::_Bool_set_val bool_set::_S_xor[4][4] = { { _S_false, _S_true_, _S_indet, _S_empty }, { _S_true_, _S_false, _S_indet, _S_empty }, { _S_indet, _S_indet, _S_indet, _S_empty }, { _S_empty, _S_empty, _S_empty, _S_empty } }; bool_set::_Bool_set_val bool_set::_S_or[4][4] = { { _S_false, _S_true_, _S_indet, _S_empty }, { _S_true_, _S_true_, _S_true_, _S_empty }, { _S_indet, _S_true_, _S_indet, _S_empty }, { _S_empty, _S_empty, _S_empty, _S_empty } }; bool_set::_Bool_set_val bool_set::_S_and[4][4] = { { _S_false, _S_false, _S_false, _S_empty }, { _S_false, _S_true_, _S_indet, _S_empty }, { _S_false, _S_indet, _S_indet, _S_empty }, { _S_empty, _S_empty, _S_empty, _S_empty } }; bool_set::_Bool_set_val bool_set::_S_eq[4][4] = { { _S_true_, _S_false, _S_indet, _S_empty }, { _S_false, _S_true_, _S_indet, _S_empty }, { _S_indet, _S_indet, _S_indet, _S_empty }, { _S_empty, _S_empty, _S_empty, _S_empty } }; _GLIBCXX_END_NAMESPACE_VERSION } } // I object to these things. // The stuff in locale facets are for basic types. // I think we could hack operator<< and operator>>. /** * @brief Numeric parsing. * * Parses the input stream into the bool @a v. It does so by calling * num_get::do_get(). * * If ios_base::boolalpha is set, attempts to read * ctype<CharT>::truename() or ctype<CharT>::falsename(). Sets * @a v to true or false if successful. Sets err to * ios_base::failbit if reading the string fails. Sets err to * ios_base::eofbit if the stream is emptied. * * If ios_base::boolalpha is not set, proceeds as with reading a long, * except if the value is 1, sets @a v to true, if the value is 0, sets * @a v to false, and otherwise set err to ios_base::failbit. * * @param in Start of input stream. * @param end End of input stream. * @param io Source of locale and flags. * @param err Error flags to set. * @param v Value to format and insert. * @return Iterator after reading. iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, bool& __v) const { return this->do_get(__in, __end, __io, __err, __v); } */ /* template<typename _CharT, typename _InIter> _InIter num_get<_CharT, _InIter>:: do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, bool_set& __v) const { if (!(__io.flags() & ios_base::boolalpha)) { // Parse bool values as long. // NB: We can't just call do_get(long) here, as it might // refer to a derived class. long __l = -1; __beg = _M_extract_int(__beg, __end, __io, __err, __l); if (__c >= _S_false && __c < _S_empty) __b._M_b = static_cast<_Bool_set_val>(__c); else { // What should we do here? __v = true; __err = ios_base::failbit; if (__beg == __end) __err |= ios_base::eofbit; } } else { // Parse bool values as alphanumeric. typedef __numpunct_cache<_CharT> __cache_type; __use_cache<__cache_type> __uc; const locale& __loc = __io._M_getloc(); const __cache_type* __lc = __uc(__loc); bool __testf = true; bool __testt = true; bool __donef = __lc->_M_falsename_size == 0; bool __donet = __lc->_M_truename_size == 0; bool __testeof = false; size_t __n = 0; while (!__donef || !__donet) { if (__beg == __end) { __testeof = true; break; } const char_type __c = *__beg; if (!__donef) __testf = __c == __lc->_M_falsename[__n]; if (!__testf && __donet) break; if (!__donet) __testt = __c == __lc->_M_truename[__n]; if (!__testt && __donef) break; if (!__testt && !__testf) break; ++__n; ++__beg; __donef = !__testf || __n >= __lc->_M_falsename_size; __donet = !__testt || __n >= __lc->_M_truename_size; } if (__testf && __n == __lc->_M_falsename_size && __n) { __v = false; if (__testt && __n == __lc->_M_truename_size) __err = ios_base::failbit; else __err = __testeof ? ios_base::eofbit : ios_base::goodbit; } else if (__testt && __n == __lc->_M_truename_size && __n) { __v = true; __err = __testeof ? ios_base::eofbit : ios_base::goodbit; } else { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 23. Num_get overflow result. __v = false; __err = ios_base::failbit; if (__testeof) __err |= ios_base::eofbit; } } return __beg; } */ /** * @brief Numeric formatting. * * Formats the boolean @a v and inserts it into a stream. It does so * by calling num_put::do_put(). * * If ios_base::boolalpha is set, writes ctype<CharT>::truename() or * ctype<CharT>::falsename(). Otherwise formats @a v as an int. * * @param s Stream to write to. * @param io Source of locale and flags. * @param fill Char_type to use for filling. * @param v Value to format and insert. * @return Iterator after writing. iter_type put(iter_type __s, ios_base& __f, char_type __fill, bool __v) const { return this->do_put(__s, __f, __fill, __v); } */ /* template<typename _CharT, typename _OutIter> _OutIter num_put<_CharT, _OutIter>:: do_put(iter_type __s, ios_base& __io, char_type __fill, bool_set __v) const { const ios_base::fmtflags __flags = __io.flags(); if ((__flags & ios_base::boolalpha) == 0) { const long __l = __v; __s = _M_insert_int(__s, __io, __fill, __l); } else { typedef __numpunct_cache<_CharT> __cache_type; __use_cache<__cache_type> __uc; const locale& __loc = __io._M_getloc(); const __cache_type* __lc = __uc(__loc); const _CharT* __name = __v ? __lc->_M_truename : __lc->_M_falsename; int __len = __v ? __lc->_M_truename_size : __lc->_M_falsename_size; const streamsize __w = __io.width(); if (__w > static_cast<streamsize>(__len)) { const streamsize __plen = __w - __len; _CharT* __ps = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __plen)); char_traits<_CharT>::assign(__ps, __plen, __fill); __io.width(0); if ((__flags & ios_base::adjustfield) == ios_base::left) { __s = std::__write(__s, __name, __len); __s = std::__write(__s, __ps, __plen); } else { __s = std::__write(__s, __ps, __plen); __s = std::__write(__s, __name, __len); } return __s; } __io.width(0); __s = std::__write(__s, __name, __len); } return __s; } */ #endif // _GLIBCXX_TR2_BOOL_SET_TCC �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/deque�����������������������������������������������������������������������������0000644�����������������00000025520�14763166027�0010273 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Profiling deque implementation -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file profile/deque * This file is a GNU profile extension to the Standard C++ Library. */ #ifndef _GLIBCXX_PROFILE_DEQUE #define _GLIBCXX_PROFILE_DEQUE 1 #include <deque> namespace std _GLIBCXX_VISIBILITY(default) { namespace __profile { /// Class std::deque wrapper with performance instrumentation. template<typename _Tp, typename _Allocator = std::allocator<_Tp> > class deque : public _GLIBCXX_STD_C::deque<_Tp, _Allocator> { typedef _GLIBCXX_STD_C::deque<_Tp, _Allocator> _Base; public: typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef typename _Base::iterator iterator; typedef typename _Base::const_iterator const_iterator; typedef typename _Base::reverse_iterator reverse_iterator; typedef typename _Base::const_reverse_iterator const_reverse_iterator; typedef typename _Base::size_type size_type; typedef typename _Base::difference_type difference_type; typedef _Tp value_type; typedef _Allocator allocator_type; typedef typename _Base::pointer pointer; typedef typename _Base::const_pointer const_pointer; // 23.2.1.1 construct/copy/destroy: explicit deque(const _Allocator& __a = _Allocator()) : _Base(__a) { } #if __cplusplus >= 201103L explicit deque(size_type __n) : _Base(__n) { } deque(size_type __n, const _Tp& __value, const _Allocator& __a = _Allocator()) : _Base(__n, __value, __a) { } #else explicit deque(size_type __n, const _Tp& __value = _Tp(), const _Allocator& __a = _Allocator()) : _Base(__n, __value, __a) { } #endif #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<typename _InputIterator> #endif deque(_InputIterator __first, _InputIterator __last, const _Allocator& __a = _Allocator()) : _Base(__first, __last, __a) { } deque(const deque& __x) : _Base(__x) { } deque(const _Base& __x) : _Base(__x) { } #if __cplusplus >= 201103L deque(deque&& __x) : _Base(std::move(__x)) { } deque(initializer_list<value_type> __l, const allocator_type& __a = allocator_type()) : _Base(__l, __a) { } #endif ~deque() _GLIBCXX_NOEXCEPT { } deque& operator=(const deque& __x) { *static_cast<_Base*>(this) = __x; return *this; } #if __cplusplus >= 201103L deque& operator=(deque&& __x) { // NB: DR 1204. // NB: DR 675. this->clear(); this->swap(__x); return *this; } deque& operator=(initializer_list<value_type> __l) { *static_cast<_Base*>(this) = __l; return *this; } #endif #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<typename _InputIterator> #endif void assign(_InputIterator __first, _InputIterator __last) { _Base::assign(__first, __last); } void assign(size_type __n, const _Tp& __t) { _Base::assign(__n, __t); } #if __cplusplus >= 201103L void assign(initializer_list<value_type> __l) { _Base::assign(__l); } #endif using _Base::get_allocator; // iterators: iterator begin() _GLIBCXX_NOEXCEPT { return iterator(_Base::begin()); } const_iterator begin() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::begin()); } iterator end() _GLIBCXX_NOEXCEPT { return iterator(_Base::end()); } const_iterator end() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::end()); } reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(end()); } const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(end()); } reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(begin()); } const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(begin()); } #if __cplusplus >= 201103L const_iterator cbegin() const noexcept { return const_iterator(_Base::begin()); } const_iterator cend() const noexcept { return const_iterator(_Base::end()); } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } #endif // 23.2.1.2 capacity: using _Base::size; using _Base::max_size; #if __cplusplus >= 201103L void resize(size_type __sz) { _Base::resize(__sz); } void resize(size_type __sz, const _Tp& __c) { _Base::resize(__sz, __c); } #else void resize(size_type __sz, _Tp __c = _Tp()) { _Base::resize(__sz, __c); } #endif #if __cplusplus >= 201103L using _Base::shrink_to_fit; #endif using _Base::empty; // element access: reference operator[](size_type __n) { return _M_base()[__n]; } const_reference operator[](size_type __n) const { return _M_base()[__n]; } using _Base::at; reference front() { return _Base::front(); } const_reference front() const { return _Base::front(); } reference back() { return _Base::back(); } const_reference back() const { return _Base::back(); } // 23.2.1.3 modifiers: void push_front(const _Tp& __x) { _Base::push_front(__x); } void push_back(const _Tp& __x) { _Base::push_back(__x); } #if __cplusplus >= 201103L void push_front(_Tp&& __x) { emplace_front(std::move(__x)); } void push_back(_Tp&& __x) { emplace_back(std::move(__x)); } template<typename... _Args> void emplace_front(_Args&&... __args) { _Base::emplace_front(std::forward<_Args>(__args)...); } template<typename... _Args> void emplace_back(_Args&&... __args) { _Base::emplace_back(std::forward<_Args>(__args)...); } template<typename... _Args> iterator emplace(iterator __position, _Args&&... __args) { typename _Base::iterator __res = _Base::emplace(__position, std::forward<_Args>(__args)...); return iterator(__res); } #endif iterator insert(iterator __position, const _Tp& __x) { typename _Base::iterator __res = _Base::insert(__position, __x); return iterator(__res); } #if __cplusplus >= 201103L iterator insert(iterator __position, _Tp&& __x) { return emplace(__position, std::move(__x)); } void insert(iterator __p, initializer_list<value_type> __l) { _Base::insert(__p, __l); } #endif void insert(iterator __position, size_type __n, const _Tp& __x) { _Base::insert(__position, __n, __x); } #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<typename _InputIterator> #endif void insert(iterator __position, _InputIterator __first, _InputIterator __last) { _Base::insert(__position, __first, __last); } void pop_front() { _Base::pop_front(); } void pop_back() { _Base::pop_back(); } iterator erase(iterator __position) { if (__position == begin() || __position == end()-1) { return iterator(_Base::erase(__position)); } else { typename _Base::iterator __res = _Base::erase(__position); return iterator(__res); } } iterator erase(iterator __first, iterator __last) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container return iterator(_Base::erase(__first, __last)); } void swap(deque& __x) { _Base::swap(__x); } void clear() _GLIBCXX_NOEXCEPT { _Base::clear(); } _Base& _M_base() _GLIBCXX_NOEXCEPT { return *this; } const _Base& _M_base() const _GLIBCXX_NOEXCEPT { return *this; } }; template<typename _Tp, typename _Alloc> inline bool operator==(const deque<_Tp, _Alloc>& __lhs, const deque<_Tp, _Alloc>& __rhs) { return __lhs._M_base() == __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator!=(const deque<_Tp, _Alloc>& __lhs, const deque<_Tp, _Alloc>& __rhs) { return __lhs._M_base() != __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator<(const deque<_Tp, _Alloc>& __lhs, const deque<_Tp, _Alloc>& __rhs) { return __lhs._M_base() < __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator<=(const deque<_Tp, _Alloc>& __lhs, const deque<_Tp, _Alloc>& __rhs) { return __lhs._M_base() <= __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator>=(const deque<_Tp, _Alloc>& __lhs, const deque<_Tp, _Alloc>& __rhs) { return __lhs._M_base() >= __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator>(const deque<_Tp, _Alloc>& __lhs, const deque<_Tp, _Alloc>& __rhs) { return __lhs._M_base() > __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline void swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs) { __lhs.swap(__rhs); } } // namespace __profile } // namespace std #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/unordered_map���������������������������������������������������������������������0000644�����������������00000035413�14763166027�0012016 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Profiling unordered_map/unordered_multimap implementation -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/unordered_map * This file is a GNU profile extension to the Standard C++ Library. */ #ifndef _GLIBCXX_PROFILE_UNORDERED_MAP #define _GLIBCXX_PROFILE_UNORDERED_MAP 1 #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else # include <unordered_map> #include <profile/base.h> #include <profile/unordered_base.h> #define _GLIBCXX_BASE unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc> #define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE namespace std _GLIBCXX_VISIBILITY(default) { namespace __profile { /// Class std::unordered_map wrapper with performance instrumentation. template<typename _Key, typename _Tp, typename _Hash = std::hash<_Key>, typename _Pred = std::equal_to<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > > class unordered_map : public _GLIBCXX_STD_BASE, public _Unordered_profile<unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>, true> { typedef typename _GLIBCXX_STD_BASE _Base; _Base& _M_base() noexcept { return *this; } const _Base& _M_base() const noexcept { return *this; } public: typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; typedef typename _Base::allocator_type allocator_type; typedef typename _Base::key_type key_type; typedef typename _Base::value_type value_type; typedef typename _Base::difference_type difference_type; typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef typename _Base::mapped_type mapped_type; typedef typename _Base::iterator iterator; typedef typename _Base::const_iterator const_iterator; explicit unordered_map(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) { } template<typename _InputIterator> unordered_map(_InputIterator __f, _InputIterator __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __eql, __a) { } unordered_map(const unordered_map&) = default; unordered_map(const _Base& __x) : _Base(__x) { } unordered_map(unordered_map&&) = default; unordered_map(initializer_list<value_type> __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__l, __n, __hf, __eql, __a) { } unordered_map& operator=(const unordered_map&) = default; unordered_map& operator=(unordered_map&&) = default; unordered_map& operator=(initializer_list<value_type> __l) { _M_base() = __l; return *this; } void clear() noexcept { __profcxx_hashtable_destruct(this, _Base::bucket_count(), _Base::size()); this->_M_profile_destruct(); _Base::clear(); } template<typename... _Args> std::pair<iterator, bool> emplace(_Args&&... __args) { size_type __old_size = _Base::bucket_count(); std::pair<iterator, bool> __res = _Base::emplace(std::forward<_Args>(__args)...); _M_profile_resize(__old_size); return __res; } template<typename... _Args> iterator emplace_hint(const_iterator __it, _Args&&... __args) { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::emplace_hint(__it, std::forward<_Args>(__args)...); _M_profile_resize(__old_size); return __res; } void insert(std::initializer_list<value_type> __l) { size_type __old_size = _Base::bucket_count(); _Base::insert(__l); _M_profile_resize(__old_size); } std::pair<iterator, bool> insert(const value_type& __obj) { size_type __old_size = _Base::bucket_count(); std::pair<iterator, bool> __res = _Base::insert(__obj); _M_profile_resize(__old_size); return __res; } iterator insert(const_iterator __iter, const value_type& __v) { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::insert(__iter, __v); _M_profile_resize(__old_size); return __res; } template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> std::pair<iterator, bool> insert(_Pair&& __obj) { size_type __old_size = _Base::bucket_count(); std::pair<iterator, bool> __res = _Base::insert(std::forward<_Pair>(__obj)); _M_profile_resize(__old_size); return __res; } template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> iterator insert(const_iterator __iter, _Pair&& __v) { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::insert(__iter, std::forward<_Pair>(__v)); _M_profile_resize(__old_size); return __res; } template<typename _InputIter> void insert(_InputIter __first, _InputIter __last) { size_type __old_size = _Base::bucket_count(); _Base::insert(__first, __last); _M_profile_resize(__old_size); } // operator[] mapped_type& operator[](const _Key& __k) { size_type __old_size = _Base::bucket_count(); mapped_type& __res = _M_base()[__k]; _M_profile_resize(__old_size); return __res; } mapped_type& operator[](_Key&& __k) { size_type __old_size = _Base::bucket_count(); mapped_type& __res = _M_base()[std::move(__k)]; _M_profile_resize(__old_size); return __res; } void swap(unordered_map& __x) { _Base::swap(__x._M_base()); } void rehash(size_type __n) { size_type __old_size = _Base::bucket_count(); _Base::rehash(__n); _M_profile_resize(__old_size); } private: void _M_profile_resize(size_type __old_size) { size_type __new_size = _Base::bucket_count(); if (__old_size != __new_size) __profcxx_hashtable_resize(this, __old_size, __new_size); } }; template<typename _Key, typename _Tp, typename _Hash, typename _Pred, typename _Alloc> inline void swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { __x.swap(__y); } template<typename _Key, typename _Tp, typename _Hash, typename _Pred, typename _Alloc> inline bool operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { return static_cast<const _GLIBCXX_STD_BASE&>(__x) == __y; } template<typename _Key, typename _Tp, typename _Hash, typename _Pred, typename _Alloc> inline bool operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { return !(__x == __y); } #undef _GLIBCXX_BASE #undef _GLIBCXX_STD_BASE #define _GLIBCXX_BASE unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc> #define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE /// Class std::unordered_multimap wrapper with performance instrumentation. template<typename _Key, typename _Tp, typename _Hash = std::hash<_Key>, typename _Pred = std::equal_to<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > > class unordered_multimap : public _GLIBCXX_STD_BASE, public _Unordered_profile<unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>, false> { typedef typename _GLIBCXX_STD_BASE _Base; _Base& _M_base() noexcept { return *this; } const _Base& _M_base() const noexcept { return *this; } public: typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; typedef typename _Base::allocator_type allocator_type; typedef typename _Base::key_type key_type; typedef typename _Base::value_type value_type; typedef typename _Base::difference_type difference_type; typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef typename _Base::iterator iterator; typedef typename _Base::const_iterator const_iterator; explicit unordered_multimap(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) { } template<typename _InputIterator> unordered_multimap(_InputIterator __f, _InputIterator __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __eql, __a) { } unordered_multimap(const unordered_multimap&) = default; unordered_multimap(const _Base& __x) : _Base(__x) { } unordered_multimap(unordered_multimap&&) = default; unordered_multimap(initializer_list<value_type> __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__l, __n, __hf, __eql, __a) { } unordered_multimap& operator=(const unordered_multimap&) = default; unordered_multimap& operator=(unordered_multimap&&) = default; unordered_multimap& operator=(initializer_list<value_type> __l) { _M_base() = __l; return *this; } void clear() noexcept { __profcxx_hashtable_destruct(this, _Base::bucket_count(), _Base::size()); this->_M_profile_destruct(); _Base::clear(); } template<typename... _Args> iterator emplace(_Args&&... __args) { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::emplace(std::forward<_Args>(__args)...); _M_profile_resize(__old_size); return __res; } template<typename... _Args> iterator emplace_hint(const_iterator __it, _Args&&... __args) { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::emplace_hint(__it, std::forward<_Args>(__args)...); _M_profile_resize(__old_size); return __res; } void insert(std::initializer_list<value_type> __l) { size_type __old_size = _Base::bucket_count(); _Base::insert(__l); _M_profile_resize(__old_size); } iterator insert(const value_type& __obj) { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::insert(__obj); _M_profile_resize(__old_size); return __res; } iterator insert(const_iterator __iter, const value_type& __v) { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::insert(__iter, __v); _M_profile_resize(__old_size); return __res; } template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> iterator insert(_Pair&& __obj) { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::insert(std::forward<_Pair>(__obj)); _M_profile_resize(__old_size); return __res; } template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> iterator insert(const_iterator __iter, _Pair&& __v) { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::insert(__iter, std::forward<_Pair>(__v)); _M_profile_resize(__old_size); return __res; } template<typename _InputIter> void insert(_InputIter __first, _InputIter __last) { size_type __old_size = _Base::bucket_count(); _Base::insert(__first, __last); _M_profile_resize(__old_size); } void swap(unordered_multimap& __x) { _Base::swap(__x._M_base()); } void rehash(size_type __n) { size_type __old_size = _Base::bucket_count(); _Base::rehash(__n); _M_profile_resize(__old_size); } private: void _M_profile_resize(size_type __old_size) { size_type __new_size = _Base::bucket_count(); if (__old_size != __new_size) __profcxx_hashtable_resize(this, __old_size, __new_size); } }; template<typename _Key, typename _Tp, typename _Hash, typename _Pred, typename _Alloc> inline void swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { __x.swap(__y); } template<typename _Key, typename _Tp, typename _Hash, typename _Pred, typename _Alloc> inline bool operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { return static_cast<const _GLIBCXX_STD_BASE&>(__x) == __y; } template<typename _Key, typename _Tp, typename _Hash, typename _Pred, typename _Alloc> inline bool operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { return !(__x == __y); } } // namespace __profile } // namespace std #undef _GLIBCXX_BASE #undef _GLIBCXX_STD_BASE #endif // C++11 #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/impl/profiler_vector_size.h�������������������������������������������������������0000644�����������������00000005457�14763166027�0014624 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/impl/profiler_vector_size.h * @brief Collection of vector size traces. */ // Written by Lixia Liu and Silvius Rus. #ifndef _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H #define _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H 1 #include "profile/impl/profiler.h" #include "profile/impl/profiler_node.h" #include "profile/impl/profiler_trace.h" #include "profile/impl/profiler_state.h" #include "profile/impl/profiler_container_size.h" namespace __gnu_profile { /** @brief Hashtable size instrumentation trace producer. */ class __trace_vector_size : public __trace_container_size { public: __trace_vector_size() : __trace_container_size() { __id = "vector-size"; } }; inline void __trace_vector_size_init() { _GLIBCXX_PROFILE_DATA(_S_vector_size) = new __trace_vector_size(); } inline void __trace_vector_size_report(FILE* __f, __warning_vector_t& __warnings) { if (_GLIBCXX_PROFILE_DATA(_S_vector_size)) { _GLIBCXX_PROFILE_DATA(_S_vector_size)->__collect_warnings(__warnings); _GLIBCXX_PROFILE_DATA(_S_vector_size)->__write(__f); } } inline void __trace_vector_size_construct(const void* __obj, std::size_t __num) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_vector_size)->__insert(__obj, __get_stack(), __num); } inline void __trace_vector_size_destruct(const void* __obj, std::size_t __num, std::size_t __inum) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_vector_size)->__destruct(__obj, __num, __inum); } inline void __trace_vector_size_resize(const void* __obj, std::size_t __from, std::size_t __to) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_vector_size)->__resize(__obj, __from, __to); } } // namespace __gnu_profile #endif /* _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/impl/profiler_container_size.h����������������������������������������������������0000644�����������������00000014441�14763166027�0015275 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/impl/profiler_container_size.h * @brief Diagnostics for container sizes. */ // Written by Lixia Liu and Silvius Rus. #ifndef _GLIBCXX_PROFILE_PROFILER_CONTAINER_SIZE_H #define _GLIBCXX_PROFILE_PROFILER_CONTAINER_SIZE_H 1 #include <sstream> #include "profile/impl/profiler.h" #include "profile/impl/profiler_node.h" #include "profile/impl/profiler_trace.h" namespace __gnu_profile { /** @brief A container size instrumentation line in the object table. */ class __container_size_info : public __object_info_base { public: __container_size_info() : _M_init(0), _M_max(0), _M_min(0), _M_total(0), _M_item_min(0), _M_item_max(0), _M_item_total(0), _M_count(0), _M_resize(0), _M_cost(0) { } __container_size_info(const __container_size_info& __o) : __object_info_base(__o), _M_init(__o._M_init), _M_max(__o._M_max), _M_min(__o._M_min), _M_total(__o._M_total), _M_item_min(__o._M_item_min), _M_item_max(__o._M_item_max), _M_item_total(__o._M_item_total), _M_count(__o._M_count), _M_resize(__o._M_resize), _M_cost(__o._M_cost) { } __container_size_info(__stack_t __stack, std::size_t __num) : __object_info_base(__stack), _M_init(__num), _M_max(__num), _M_min(0), _M_total(0), _M_item_min(0), _M_item_max(0), _M_item_total(0), _M_count(0), _M_resize(0), _M_cost(0) { } virtual ~__container_size_info() { } void __write(FILE* __f) const { std::fprintf(__f, "%Zu %Zu %Zu %Zu %Zu %Zu %Zu %Zu %Zu %Zu\n", _M_init, _M_count, _M_cost, _M_resize, _M_min, _M_max, _M_total, _M_item_min, _M_item_max, _M_item_total); } float __magnitude() const { return static_cast<float>(_M_cost); } std::string __advice() const { std::stringstream __message; if (_M_init < _M_item_max) __message << "change initial container size from " << _M_init << " to " << _M_item_max; return __message.str(); } void __merge(const __container_size_info& __o) { _M_init = std::max(_M_init, __o._M_init); _M_max = std::max(_M_max, __o._M_max); _M_item_max = std::max(_M_item_max, __o._M_item_max); _M_min = std::min(_M_min, __o._M_min); _M_item_min = std::min(_M_item_min, __o._M_item_min); _M_total += __o._M_total; _M_item_total += __o._M_item_total; _M_count += __o._M_count; _M_cost += __o._M_cost; _M_resize += __o._M_resize; } // Call if a container is destructed or cleaned. void __destruct(std::size_t __num, std::size_t __inum) { _M_max = std::max(_M_max, __num); _M_item_max = std::max(_M_item_max, __inum); if (_M_min == 0) { _M_min = __num; _M_item_min = __inum; } else { _M_min = std::min(_M_min, __num); _M_item_min = std::min(_M_item_min, __inum); } _M_total += __num; _M_item_total += __inum; _M_count += 1; } // Estimate the cost of resize/rehash. float __resize_cost(std::size_t __from, std::size_t) { return __from; } // Call if container is resized. void __resize(std::size_t __from, std::size_t __to) { _M_cost += this->__resize_cost(__from, __to); _M_resize += 1; _M_max = std::max(_M_max, __to); } private: std::size_t _M_init; std::size_t _M_max; // range of # buckets std::size_t _M_min; std::size_t _M_total; std::size_t _M_item_min; // range of # items std::size_t _M_item_max; std::size_t _M_item_total; std::size_t _M_count; std::size_t _M_resize; std::size_t _M_cost; }; /** @brief A container size instrumentation line in the stack table. */ class __container_size_stack_info : public __container_size_info { public: __container_size_stack_info(const __container_size_info& __o) : __container_size_info(__o) { } }; /** @brief Container size instrumentation trace producer. */ class __trace_container_size : public __trace_base<__container_size_info, __container_size_stack_info> { public: ~__trace_container_size() { } __trace_container_size() : __trace_base<__container_size_info, __container_size_stack_info>() { }; // Insert a new node at construct with object, callstack and initial size. void __insert(const __object_t __obj, __stack_t __stack, std::size_t __num) { __add_object(__obj, __container_size_info(__stack, __num)); } // XXX Undefined? void __construct(const void* __obj, std::size_t __inum); // Call at destruction/clean to set container final size. void __destruct(const void* __obj, std::size_t __num, std::size_t __inum) { if (!__is_on()) return; __object_t __obj_handle = static_cast<__object_t>(__obj); __container_size_info* __object_info = __get_object_info(__obj_handle); if (!__object_info) return; __object_info->__destruct(__num, __inum); __retire_object(__obj_handle); } // Call at resize to set resize/cost information. void __resize(const void* __obj, int __from, int __to) { if (!__is_on()) return; __container_size_info* __object_info = __get_object_info(__obj); if (!__object_info) return; __object_info->__resize(__from, __to); } }; } // namespace __gnu_profile #endif /* _GLIBCXX_PROFILE_PROFILER_CONTAINER_SIZE_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/impl/profiler_vector_to_list.h����������������������������������������������������0000644�����������������00000021604�14763166027�0015317 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/impl/profiler_vector_to_list.h * @brief diagnostics for vector to list. */ // Written by Lixia Liu and Silvius Rus. #ifndef _GLIBCXX_PROFILE_PROFILER_VECTOR_TO_LIST_H #define _GLIBCXX_PROFILE_PROFILER_VECTOR_TO_LIST_H 1 #include "profile/impl/profiler.h" #include "profile/impl/profiler_node.h" #include "profile/impl/profiler_trace.h" namespace __gnu_profile { /** @brief A vector-to-list instrumentation line in the object table. */ class __vector2list_info : public __object_info_base { public: __vector2list_info() : _M_shift_count(0), _M_iterate(0), _M_resize(0), _M_list_cost(0), _M_vector_cost(0), _M_valid(true) { } __vector2list_info(__stack_t __stack) : __object_info_base(__stack), _M_shift_count(0), _M_iterate(0), _M_resize(0), _M_list_cost(0), _M_vector_cost(0), _M_valid(true) { } virtual ~__vector2list_info() { } __vector2list_info(const __vector2list_info& __o) : __object_info_base(__o), _M_shift_count(__o._M_shift_count), _M_iterate(__o._M_iterate), _M_resize(__o._M_resize), _M_list_cost(__o._M_list_cost), _M_vector_cost(__o._M_vector_cost), _M_valid(__o._M_valid) { } void __merge(const __vector2list_info& __o) { _M_shift_count += __o._M_shift_count; _M_iterate += __o._M_iterate; _M_vector_cost += __o._M_vector_cost; _M_list_cost += __o._M_list_cost; _M_valid &= __o._M_valid; _M_resize += __o._M_resize; } void __write(FILE* __f) const { std::fprintf(__f, "%Zu %Zu %Zu %.0f %.0f\n", _M_shift_count, _M_resize, _M_iterate, _M_vector_cost, _M_list_cost); } float __magnitude() const { return _M_vector_cost - _M_list_cost; } std::string __advice() const { return "change std::vector to std::list"; } std::size_t __shift_count() { return _M_shift_count; } std::size_t __iterate() { return _M_iterate; } float __list_cost() { return _M_list_cost; } std::size_t __resize() { return _M_resize; } void __set_list_cost(float __lc) { _M_list_cost = __lc; } void __set_vector_cost(float __vc) { _M_vector_cost = __vc; } bool __is_valid() { return _M_valid; } void __set_invalid() { _M_valid = false; } void __opr_insert(std::size_t __pos, std::size_t __num) { _M_shift_count += __num - __pos; } void __opr_iterate(std::size_t __num) { _M_iterate += __num; } void __resize(std::size_t __from, std::size_t) { _M_resize += __from; } void __opr_find(std::size_t __size) { // Use average case complexity. _M_iterate += 3.0 / 4.0 * __size; } private: std::size_t _M_shift_count; std::size_t _M_iterate; std::size_t _M_resize; float _M_list_cost; float _M_vector_cost; bool _M_valid; }; /** @brief A vector-to-list instrumentation line in the stack table. */ class __vector2list_stack_info : public __vector2list_info { public: __vector2list_stack_info(const __vector2list_info& __o) : __vector2list_info(__o) { } }; /** @brief Vector-to-list instrumentation producer. */ class __trace_vector_to_list : public __trace_base<__vector2list_info, __vector2list_stack_info> { public: __trace_vector_to_list() : __trace_base<__vector2list_info, __vector2list_stack_info>() { __id = "vector-to-list"; } ~__trace_vector_to_list() { } // Insert a new node at construct with object, callstack and initial size. void __insert(__object_t __obj, __stack_t __stack) { __add_object(__obj, __vector2list_info(__stack)); } // Call at destruction/clean to set container final size. void __destruct(const void* __obj) { if (!__is_on()) return; __vector2list_info* __res = __get_object_info(__obj); if (!__res) return; float __vc = __vector_cost(__res->__shift_count(), __res->__iterate(), __res->__resize()); float __lc = __list_cost(__res->__shift_count(), __res->__iterate(), __res->__resize()); __res->__set_vector_cost(__vc); __res->__set_list_cost(__lc); __retire_object(__obj); } // Find the node in the live map. // XXX Undefined?!? __vector2list_info* __find(const void* __obj); // Collect cost of operations. void __opr_insert(const void* __obj, std::size_t __pos, std::size_t __num) { __vector2list_info* __res = __get_object_info(__obj); if (__res) __res->__opr_insert(__pos, __num); } void __opr_iterate(const void* __obj, std::size_t __num) { __vector2list_info* __res = __get_object_info(__obj); if (__res) __res->__opr_iterate(__num); } void __invalid_operator(const void* __obj) { __vector2list_info* __res = __get_object_info(__obj); if (__res) __res->__set_invalid(); } void __resize(const void* __obj, std::size_t __from, std::size_t __to) { __vector2list_info* __res = __get_object_info(__obj); if (__res) __res->__resize(__from, __to); } float __vector_cost(std::size_t __shift, std::size_t __iterate, std::size_t __resize) { return (__shift * _GLIBCXX_PROFILE_DATA(__vector_shift_cost_factor).__value + __iterate * _GLIBCXX_PROFILE_DATA(__vector_iterate_cost_factor).__value + __resize * _GLIBCXX_PROFILE_DATA(__vector_resize_cost_factor).__value); } float __list_cost(std::size_t __shift, std::size_t __iterate, std::size_t __resize) { return (__shift * _GLIBCXX_PROFILE_DATA(__list_shift_cost_factor).__value + __iterate * _GLIBCXX_PROFILE_DATA(__list_iterate_cost_factor).__value + __resize * _GLIBCXX_PROFILE_DATA(__list_resize_cost_factor).__value); } void __opr_find(const void* __obj, std::size_t __size) { __vector2list_info* __res = __get_object_info(__obj); if (__res) __res->__opr_find(__size); } }; inline void __trace_vector_to_list_init() { _GLIBCXX_PROFILE_DATA(_S_vector_to_list) = new __trace_vector_to_list(); } inline void __trace_vector_to_list_report(FILE* __f, __warning_vector_t& __warnings) { if (_GLIBCXX_PROFILE_DATA(_S_vector_to_list)) { _GLIBCXX_PROFILE_DATA(_S_vector_to_list)-> __collect_warnings(__warnings); _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__write(__f); } } inline void __trace_vector_to_list_construct(const void* __obj) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__insert(__obj, __get_stack()); } inline void __trace_vector_to_list_destruct(const void* __obj) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__destruct(__obj); } inline void __trace_vector_to_list_insert(const void* __obj, std::size_t __pos, std::size_t __num) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__opr_insert(__obj, __pos, __num); } inline void __trace_vector_to_list_iterate(const void* __obj, std::size_t __num = 1) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__opr_iterate(__obj, __num); } inline void __trace_vector_to_list_invalid_operator(const void* __obj) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__invalid_operator(__obj); } inline void __trace_vector_to_list_resize(const void* __obj, std::size_t __from, std::size_t __to) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__resize(__obj, __from, __to); } inline void __trace_vector_to_list_find(const void* __obj, std::size_t __size) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__opr_find(__obj, __size); } } // namespace __gnu_profile #endif /* _GLIBCXX_PROFILE_PROFILER_VECTOR_TO_LIST_H */ ����������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/impl/profiler_hash_func.h���������������������������������������������������������0000644�����������������00000011542�14763166027�0014216 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/impl/profiler_hash_func.h * @brief Data structures to represent profiling traces. */ // Written by Lixia Liu and Silvius Rus. #ifndef _GLIBCXX_PROFILE_PROFILER_HASH_FUNC_H #define _GLIBCXX_PROFILE_PROFILER_HASH_FUNC_H 1 #include "profile/impl/profiler.h" #include "profile/impl/profiler_node.h" #include "profile/impl/profiler_trace.h" namespace __gnu_profile { /** @brief A hash performance instrumentation line in the object table. */ class __hashfunc_info : public __object_info_base { public: __hashfunc_info() : _M_longest_chain(0), _M_accesses(0), _M_hops(0) { } __hashfunc_info(const __hashfunc_info& __o) : __object_info_base(__o), _M_longest_chain(__o._M_longest_chain), _M_accesses(__o._M_accesses), _M_hops(__o._M_hops) { } __hashfunc_info(__stack_t __stack) : __object_info_base(__stack), _M_longest_chain(0), _M_accesses(0), _M_hops(0) { } virtual ~__hashfunc_info() { } void __merge(const __hashfunc_info& __o) { _M_longest_chain = std::max(_M_longest_chain, __o._M_longest_chain); _M_accesses += __o._M_accesses; _M_hops += __o._M_hops; } void __destruct(std::size_t __chain, std::size_t __accesses, std::size_t __hops) { _M_longest_chain = std::max(_M_longest_chain, __chain); _M_accesses += __accesses; _M_hops += __hops; } void __write(FILE* __f) const { std::fprintf(__f, "%Zu %Zu %Zu\n", _M_hops, _M_accesses, _M_longest_chain); } float __magnitude() const { return static_cast<float>(_M_hops); } std::string __advice() const { return "change hash function"; } private: std::size_t _M_longest_chain; std::size_t _M_accesses; std::size_t _M_hops; }; /** @brief A hash performance instrumentation line in the stack table. */ class __hashfunc_stack_info : public __hashfunc_info { public: __hashfunc_stack_info(const __hashfunc_info& __o) : __hashfunc_info(__o) { } }; /** @brief Hash performance instrumentation producer. */ class __trace_hash_func : public __trace_base<__hashfunc_info, __hashfunc_stack_info> { public: __trace_hash_func() : __trace_base<__hashfunc_info, __hashfunc_stack_info>() { __id = "hash-distr"; } ~__trace_hash_func() {} // Insert a new node at construct with object, callstack and initial size. void __insert(__object_t __obj, __stack_t __stack) { __add_object(__obj, __hashfunc_info(__stack)); } // Call at destruction/clean to set container final size. void __destruct(const void* __obj, std::size_t __chain, std::size_t __accesses, std::size_t __hops) { if (!__is_on()) return; // First find the item from the live objects and update the informations. __hashfunc_info* __objs = __get_object_info(__obj); if (!__objs) return; __objs->__destruct(__chain, __accesses, __hops); __retire_object(__obj); } }; inline void __trace_hash_func_init() { _GLIBCXX_PROFILE_DATA(_S_hash_func) = new __trace_hash_func(); } inline void __trace_hash_func_report(FILE* __f, __warning_vector_t& __warnings) { if (_GLIBCXX_PROFILE_DATA(_S_hash_func)) { _GLIBCXX_PROFILE_DATA(_S_hash_func)->__collect_warnings(__warnings); _GLIBCXX_PROFILE_DATA(_S_hash_func)->__write(__f); } } inline void __trace_hash_func_construct(const void* __obj) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_hash_func)->__insert(__obj, __get_stack()); } inline void __trace_hash_func_destruct(const void* __obj, std::size_t __chain, std::size_t __accesses, std::size_t __hops) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_hash_func)->__destruct(__obj, __chain, __accesses, __hops); } } // namespace __gnu_profile #endif /* _GLIBCXX_PROFILE_PROFILER_HASH_FUNC_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/impl/profiler_node.h��������������������������������������������������������������0000644�����������������00000010377�14763166027�0013212 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/impl/profiler_node.h * @brief Data structures to represent a single profiling event. */ // Written by Lixia Liu and Silvius Rus. #ifndef _GLIBCXX_PROFILE_PROFILER_NODE_H #define _GLIBCXX_PROFILE_PROFILER_NODE_H 1 #include <cstdio> // FILE, fprintf #include <vector> #if defined _GLIBCXX_HAVE_EXECINFO_H #include <execinfo.h> #endif namespace __gnu_profile { typedef const void* __object_t; typedef void* __instruction_address_t; typedef std::_GLIBCXX_STD_C::vector<__instruction_address_t> __stack_npt; typedef __stack_npt* __stack_t; std::size_t __stack_max_depth(); inline __stack_t __get_stack() { #if defined _GLIBCXX_HAVE_EXECINFO_H std::size_t __max_depth = __stack_max_depth(); if (__max_depth == 0) return 0; __stack_npt __buffer(__max_depth); int __depth = backtrace(&__buffer[0], __max_depth); __stack_t __stack = new __stack_npt(__depth); __builtin_memcpy(&(*__stack)[0], &__buffer[0], __depth * sizeof(__object_t)); return __stack; #else return 0; #endif } inline std::size_t __size(__stack_t __stack) { if (!__stack) return 0; else return __stack->size(); } // XXX inline void __write(FILE* __f, __stack_t __stack) { if (!__stack) return; __stack_npt::const_iterator __it; for (__it = __stack->begin(); __it != __stack->end(); ++__it) std::fprintf(__f, "%p ", *__it); } /** @brief Hash function for summary trace using call stack as index. */ class __stack_hash { public: std::size_t operator()(__stack_t __s) const { if (!__s) return 0; std::size_t __index = 0; __stack_npt::const_iterator __it; for (__it = __s->begin(); __it != __s->end(); ++__it) __index += reinterpret_cast<std::size_t>(*__it); return __index; } bool operator() (__stack_t __stack1, __stack_t __stack2) const { if (!__stack1 && !__stack2) return true; if (!__stack1 || !__stack2) return false; if (__stack1->size() != __stack2->size()) return false; std::size_t __byte_size = __stack1->size() * sizeof(__stack_npt::value_type); return __builtin_memcmp(&(*__stack1)[0], &(*__stack2)[0], __byte_size) == 0; } }; /** @brief Base class for a line in the object table. */ class __object_info_base { public: __object_info_base() { } __object_info_base(__stack_t __stack) : _M_stack(__stack), _M_valid(true) { } __object_info_base(const __object_info_base& __o) : _M_stack(__o._M_stack), _M_valid(__o._M_valid) { } virtual ~__object_info_base() { } bool __is_valid() const { return _M_valid; } __stack_t __stack() const { return _M_stack; } virtual void __write(FILE* __f) const = 0; protected: __stack_t _M_stack; bool _M_valid; }; /** @brief Base class for a line in the stack table. */ template<typename __object_info> class __stack_info_base { public: __stack_info_base() { } __stack_info_base(const __object_info& __info) = 0; virtual ~__stack_info_base() {} void __merge(const __object_info& __info) = 0; virtual float __magnitude() const = 0; virtual const char* __get_id() const = 0; }; } // namespace __gnu_profile #endif /* _GLIBCXX_PROFILE_PROFILER_NODE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/impl/profiler_algos.h�������������������������������������������������������������0000644�����������������00000006545�14763166027�0013374 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/impl/profiler_algos.h * @brief Algorithms used by the profile extension. * * This file is needed to avoid including \<algorithm\> or \<bits/stl_algo.h\>. * Including those files would result in recursive includes. * These implementations are oversimplified. In general, efficiency may be * sacrificed to minimize maintenance overhead. */ #ifndef _GLIBCXX_PROFILE_PROFILER_ALGOS_H #define _GLIBCXX_PROFILE_PROFILER_ALGOS_H 1 namespace __gnu_profile { /* Helper for __top_n. Insert in sorted vector, but not beyond Nth elem. */ template<typename _Container> void __insert_top_n(_Container& __output, const typename _Container::value_type& __value, typename _Container::size_type __n) { typename _Container::iterator __it = __output.begin(); typename _Container::size_type __count = 0; // Skip up to N - 1 elements larger than VALUE. // XXX: Could do binary search for random iterators. while (true) { if (__count >= __n) // VALUE is not in top N. return; if (__it == __output.end()) break; if (*__it < __value) break; ++__it; ++__count; } __output.insert(__it, __value); } /* Copy the top N elements in INPUT, sorted in reverse order, to OUTPUT. */ template<typename _Container> void __top_n(const _Container& __input, _Container& __output, typename _Container::size_type __n) { __output.clear(); typename _Container::const_iterator __it; for (__it = __input.begin(); __it != __input.end(); ++__it) __insert_top_n(__output, *__it, __n); } /* Simplified clone of std::for_each. */ template<typename _InputIterator, typename _Function> _Function __for_each(_InputIterator __first, _InputIterator __last, _Function __f) { for (; __first != __last; ++__first) __f(*__first); return __f; } /* Simplified clone of std::remove. */ template<typename _ForwardIterator, typename _Tp> _ForwardIterator __remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { if(__first == __last) return __first; _ForwardIterator __result = __first; ++__first; for(; __first != __last; ++__first) if(!(*__first == __value)) { *__result = *__first; ++__result; } return __result; } } // namespace __gnu_profile #endif /* _GLIBCXX_PROFILE_PROFILER_ALGOS_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/impl/profiler_hashtable_size.h����������������������������������������������������0000644�����������������00000005561�14763166027�0015251 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/impl/profiler_hashtable_size.h * @brief Collection of hashtable size traces. */ // Written by Lixia Liu and Silvius Rus. #ifndef _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H #define _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H 1 #include "profile/impl/profiler.h" #include "profile/impl/profiler_node.h" #include "profile/impl/profiler_trace.h" #include "profile/impl/profiler_state.h" #include "profile/impl/profiler_container_size.h" namespace __gnu_profile { /** @brief Hashtable size instrumentation trace producer. */ class __trace_hashtable_size : public __trace_container_size { public: __trace_hashtable_size() : __trace_container_size() { __id = "hashtable-size"; } }; inline void __trace_hashtable_size_init() { _GLIBCXX_PROFILE_DATA(_S_hashtable_size) = new __trace_hashtable_size(); } inline void __trace_hashtable_size_report(FILE* __f, __warning_vector_t& __warnings) { if (_GLIBCXX_PROFILE_DATA(_S_hashtable_size)) { _GLIBCXX_PROFILE_DATA(_S_hashtable_size)-> __collect_warnings(__warnings); _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__write(__f); } } inline void __trace_hashtable_size_construct(const void* __obj, std::size_t __num) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__insert(__obj, __get_stack(), __num); } inline void __trace_hashtable_size_destruct(const void* __obj, std::size_t __num, std::size_t __inum) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__destruct(__obj, __num, __inum); } inline void __trace_hashtable_size_resize(const void* __obj, std::size_t __from, std::size_t __to) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__resize(__obj, __from, __to); } } // namespace __gnu_profile #endif /* _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/impl/profiler_trace.h�������������������������������������������������������������0000644�����������������00000051522�14763166027�0013360 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/impl/profiler_trace.h * @brief Data structures to represent profiling traces. */ // Written by Lixia Liu and Silvius Rus. #ifndef _GLIBCXX_PROFILE_PROFILER_TRACE_H #define _GLIBCXX_PROFILE_PROFILER_TRACE_H 1 #include <cstdio> // fopen, fclose, fprintf, FILE #include <cerrno> #include <cstdlib> // atof, atoi, strtol, getenv, atexit, abort #if __cplusplus >= 201103L #define _GLIBCXX_IMPL_UNORDERED_MAP std::_GLIBCXX_STD_C::unordered_map #include <unordered_map> #else #include <tr1/unordered_map> #define _GLIBCXX_IMPL_UNORDERED_MAP std::tr1::unordered_map #endif #include <ext/concurrence.h> #include <fstream> #include <string> #include <utility> #include <vector> #include "profile/impl/profiler_algos.h" #include "profile/impl/profiler_state.h" #include "profile/impl/profiler_node.h" namespace __gnu_profile { /** @brief Internal environment. Values can be set one of two ways: 1. In config file "var = value". The default config file path is libstdcxx-profile.conf. 2. By setting process environment variables. For instance, in a Bash shell you can set the unit cost of iterating through a map like this: export __map_iterate_cost_factor=5.0. If a value is set both in the input file and through an environment variable, the environment value takes precedence. */ typedef _GLIBCXX_IMPL_UNORDERED_MAP<std::string, std::string> __env_t; _GLIBCXX_PROFILE_DEFINE_UNINIT_DATA(__env_t, __env); /** @brief Master lock. */ _GLIBCXX_PROFILE_DEFINE_UNINIT_DATA(__gnu_cxx::__mutex, __global_lock); /** @brief Representation of a warning. */ struct __warning_data { float __magnitude; __stack_t __context; const char* __warning_id; std::string __warning_message; __warning_data() : __magnitude(0.0), __context(0), __warning_id(0) { } __warning_data(float __m, __stack_t __c, const char* __id, const std::string& __msg) : __magnitude(__m), __context(__c), __warning_id(__id), __warning_message(__msg) { } bool operator<(const __warning_data& __other) const { return __magnitude < __other.__magnitude; } }; typedef std::_GLIBCXX_STD_C::vector<__warning_data> __warning_vector_t; // Defined in profiler_<diagnostic name>.h. class __trace_hash_func; class __trace_hashtable_size; class __trace_map2umap; class __trace_vector_size; class __trace_vector_to_list; class __trace_list_to_slist; class __trace_list_to_vector; void __trace_vector_size_init(); void __trace_hashtable_size_init(); void __trace_hash_func_init(); void __trace_vector_to_list_init(); void __trace_list_to_slist_init(); void __trace_list_to_vector_init(); void __trace_map_to_unordered_map_init(); void __trace_vector_size_report(FILE*, __warning_vector_t&); void __trace_hashtable_size_report(FILE*, __warning_vector_t&); void __trace_hash_func_report(FILE*, __warning_vector_t&); void __trace_vector_to_list_report(FILE*, __warning_vector_t&); void __trace_list_to_slist_report(FILE*, __warning_vector_t&); void __trace_list_to_vector_report(FILE*, __warning_vector_t&); void __trace_map_to_unordered_map_report(FILE*, __warning_vector_t&); struct __cost_factor { const char* __env_var; float __value; }; typedef std::_GLIBCXX_STD_C::vector<__cost_factor*> __cost_factor_vector; _GLIBCXX_PROFILE_DEFINE_DATA(__trace_hash_func*, _S_hash_func, 0); _GLIBCXX_PROFILE_DEFINE_DATA(__trace_hashtable_size*, _S_hashtable_size, 0); _GLIBCXX_PROFILE_DEFINE_DATA(__trace_map2umap*, _S_map2umap, 0); _GLIBCXX_PROFILE_DEFINE_DATA(__trace_vector_size*, _S_vector_size, 0); _GLIBCXX_PROFILE_DEFINE_DATA(__trace_vector_to_list*, _S_vector_to_list, 0); _GLIBCXX_PROFILE_DEFINE_DATA(__trace_list_to_slist*, _S_list_to_slist, 0); _GLIBCXX_PROFILE_DEFINE_DATA(__trace_list_to_vector*, _S_list_to_vector, 0); _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __vector_shift_cost_factor, {"__vector_shift_cost_factor", 1.0}); _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __vector_iterate_cost_factor, {"__vector_iterate_cost_factor", 1.0}); _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __vector_resize_cost_factor, {"__vector_resize_cost_factor", 1.0}); _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __list_shift_cost_factor, {"__list_shift_cost_factor", 0.0}); _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __list_iterate_cost_factor, {"__list_iterate_cost_factor", 10.0}); _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __list_resize_cost_factor, {"__list_resize_cost_factor", 0.0}); _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_insert_cost_factor, {"__map_insert_cost_factor", 1.5}); _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_erase_cost_factor, {"__map_erase_cost_factor", 1.5}); _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_find_cost_factor, {"__map_find_cost_factor", 1}); _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_iterate_cost_factor, {"__map_iterate_cost_factor", 2.3}); _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_insert_cost_factor, {"__umap_insert_cost_factor", 12.0}); _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_erase_cost_factor, {"__umap_erase_cost_factor", 12.0}); _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_find_cost_factor, {"__umap_find_cost_factor", 10.0}); _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_iterate_cost_factor, {"__umap_iterate_cost_factor", 1.7}); _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor_vector*, __cost_factors, 0); _GLIBCXX_PROFILE_DEFINE_DATA(const char*, _S_trace_file_name, _GLIBCXX_PROFILE_TRACE_PATH_ROOT); _GLIBCXX_PROFILE_DEFINE_DATA(std::size_t, _S_max_warn_count, _GLIBCXX_PROFILE_MAX_WARN_COUNT); _GLIBCXX_PROFILE_DEFINE_DATA(std::size_t, _S_max_stack_depth, _GLIBCXX_PROFILE_MAX_STACK_DEPTH); _GLIBCXX_PROFILE_DEFINE_DATA(std::size_t, _S_max_mem, _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC); inline std::size_t __stack_max_depth() { return _GLIBCXX_PROFILE_DATA(_S_max_stack_depth); } inline std::size_t __max_mem() { return _GLIBCXX_PROFILE_DATA(_S_max_mem); } /** @brief Base class for all trace producers. */ template<typename __object_info, typename __stack_info> class __trace_base { public: // Do not pick the initial size too large, as we don't know which // diagnostics are more active. __trace_base() : __object_table(10000), __stack_table(10000), __stack_table_byte_size(0), __id(0) { } virtual ~__trace_base() { } void __add_object(__object_t object, __object_info __info); __object_info* __get_object_info(__object_t __object); void __retire_object(__object_t __object); void __write(FILE* __f); void __collect_warnings(__warning_vector_t& __warnings); private: __gnu_cxx::__mutex __object_table_lock; __gnu_cxx::__mutex __stack_table_lock; typedef _GLIBCXX_IMPL_UNORDERED_MAP<__object_t, __object_info> __object_table_t; typedef _GLIBCXX_IMPL_UNORDERED_MAP<__stack_t, __stack_info, __stack_hash, __stack_hash> __stack_table_t; __object_table_t __object_table; __stack_table_t __stack_table; std::size_t __stack_table_byte_size; protected: const char* __id; }; template<typename __object_info, typename __stack_info> void __trace_base<__object_info, __stack_info>:: __collect_warnings(__warning_vector_t& __warnings) { for (typename __stack_table_t::iterator __it = __stack_table.begin(); __it != __stack_table.end(); ++__it) __warnings.push_back(__warning_data((*__it).second.__magnitude(), (*__it).first, __id, (*__it).second.__advice())); } template<typename __object_info, typename __stack_info> void __trace_base<__object_info, __stack_info>:: __add_object(__object_t __object, __object_info __info) { if (__max_mem() == 0 || __object_table.size() * sizeof(__object_info) <= __max_mem()) { this->__object_table_lock.lock(); __object_table.insert(typename __object_table_t:: value_type(__object, __info)); this->__object_table_lock.unlock(); } } template<typename __object_info, typename __stack_info> __object_info* __trace_base<__object_info, __stack_info>:: __get_object_info(__object_t __object) { // XXX: Revisit this to see if we can decrease mutex spans. // Without this mutex, the object table could be rehashed during an // insertion on another thread, which could result in a segfault. this->__object_table_lock.lock(); typename __object_table_t::iterator __object_it = __object_table.find(__object); if (__object_it == __object_table.end()) { this->__object_table_lock.unlock(); return 0; } else { this->__object_table_lock.unlock(); return &__object_it->second; } } template<typename __object_info, typename __stack_info> void __trace_base<__object_info, __stack_info>:: __retire_object(__object_t __object) { this->__object_table_lock.lock(); this->__stack_table_lock.lock(); typename __object_table_t::iterator __object_it = __object_table.find(__object); if (__object_it != __object_table.end()) { const __object_info& __info = __object_it->second; const __stack_t& __stack = __info.__stack(); typename __stack_table_t::iterator __stack_it = __stack_table.find(__stack); if (__stack_it == __stack_table.end()) { // First occurence of this call context. if (__max_mem() == 0 || __stack_table_byte_size < __max_mem()) { __stack_table_byte_size += (sizeof(__instruction_address_t) * __size(__stack) + sizeof(__stack) + sizeof(__stack_info)); __stack_table.insert(make_pair(__stack, __stack_info(__info))); } } else { // Merge object info into info summary for this call context. __stack_it->second.__merge(__info); delete __stack; } __object_table.erase(__object); } this->__object_table_lock.unlock(); this->__stack_table_lock.unlock(); } template<typename __object_info, typename __stack_info> void __trace_base<__object_info, __stack_info>:: __write(FILE* __f) { for (typename __stack_table_t::iterator __it = __stack_table.begin(); __it != __stack_table.end(); ++__it) if (__it->second.__is_valid()) { std::fprintf(__f, __id); std::fprintf(__f, "|"); __gnu_profile::__write(__f, __it->first); std::fprintf(__f, "|"); __it->second.__write(__f); } } inline std::size_t __env_to_size_t(const char* __env_var, std::size_t __default_value) { char* __env_value = std::getenv(__env_var); if (__env_value) { errno = 0; long __converted_value = std::strtol(__env_value, 0, 10); if (errno || __converted_value < 0) { std::fprintf(stderr, "Bad value for environment variable '%s'.\n", __env_var); std::abort(); } else return static_cast<std::size_t>(__converted_value); } else return __default_value; } inline void __set_max_stack_trace_depth() { _GLIBCXX_PROFILE_DATA(_S_max_stack_depth) = __env_to_size_t(_GLIBCXX_PROFILE_MAX_STACK_DEPTH_ENV_VAR, _GLIBCXX_PROFILE_DATA(_S_max_stack_depth)); } inline void __set_max_mem() { _GLIBCXX_PROFILE_DATA(_S_max_mem) = __env_to_size_t(_GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC_ENV_VAR, _GLIBCXX_PROFILE_DATA(_S_max_mem)); } inline int __log_magnitude(float __f) { const float __log_base = 10.0; int __result = 0; int __sign = 1; if (__f < 0) { __f = -__f; __sign = -1; } while (__f > __log_base) { ++__result; __f /= 10.0; } return __sign * __result; } inline FILE* __open_output_file(const char* __extension) { // The path is made of _S_trace_file_name + "." + extension. std::size_t __root_len = __builtin_strlen(_GLIBCXX_PROFILE_DATA(_S_trace_file_name)); std::size_t __ext_len = __builtin_strlen(__extension); char* __file_name = new char[__root_len + 1 + __ext_len + 1]; __builtin_memcpy(__file_name, _GLIBCXX_PROFILE_DATA(_S_trace_file_name), __root_len); *(__file_name + __root_len) = '.'; __builtin_memcpy(__file_name + __root_len + 1, __extension, __ext_len + 1); FILE* __out_file = std::fopen(__file_name, "w"); if (!__out_file) { std::fprintf(stderr, "Could not open trace file '%s'.\n", __file_name); std::abort(); } delete[] __file_name; return __out_file; } struct __warn { FILE* __file; __warn(FILE* __f) { __file = __f; } void operator()(const __warning_data& __info) { std::fprintf(__file, __info.__warning_id); std::fprintf(__file, ": improvement = %d", __log_magnitude(__info.__magnitude)); std::fprintf(__file, ": call stack = "); __gnu_profile::__write(__file, __info.__context); std::fprintf(__file, ": advice = %s\n", __info.__warning_message.c_str()); } }; /** @brief Final report method, registered with @b atexit. * * This can also be called directly by user code, including signal handlers. * It is protected against deadlocks by the reentrance guard in profiler.h. * However, when called from a signal handler that triggers while within * __gnu_profile (under the guarded zone), no output will be produced. */ inline void __report(void) { _GLIBCXX_PROFILE_DATA(__global_lock).lock(); __warning_vector_t __warnings, __top_warnings; FILE* __raw_file = __open_output_file("raw"); __trace_vector_size_report(__raw_file, __warnings); __trace_hashtable_size_report(__raw_file, __warnings); __trace_hash_func_report(__raw_file, __warnings); __trace_vector_to_list_report(__raw_file, __warnings); __trace_list_to_slist_report(__raw_file, __warnings); __trace_list_to_vector_report(__raw_file, __warnings); __trace_map_to_unordered_map_report(__raw_file, __warnings); std::fclose(__raw_file); // Sort data by magnitude, keeping just top N. std::size_t __cutoff = std::min(_GLIBCXX_PROFILE_DATA(_S_max_warn_count), __warnings.size()); __top_n(__warnings, __top_warnings, __cutoff); FILE* __warn_file = __open_output_file("txt"); __for_each(__top_warnings.begin(), __top_warnings.end(), __warn(__warn_file)); std::fclose(__warn_file); _GLIBCXX_PROFILE_DATA(__global_lock).unlock(); } inline void __set_trace_path() { char* __env_trace_file_name = std::getenv(_GLIBCXX_PROFILE_TRACE_ENV_VAR); if (__env_trace_file_name) _GLIBCXX_PROFILE_DATA(_S_trace_file_name) = __env_trace_file_name; // Make sure early that we can create the trace file. std::fclose(__open_output_file("txt")); } inline void __set_max_warn_count() { char* __env_max_warn_count_str = std::getenv(_GLIBCXX_PROFILE_MAX_WARN_COUNT_ENV_VAR); if (__env_max_warn_count_str) _GLIBCXX_PROFILE_DATA(_S_max_warn_count) = static_cast<std::size_t>(std::atoi(__env_max_warn_count_str)); } inline void __read_cost_factors() { std::string __conf_file_name(_GLIBCXX_PROFILE_DATA(_S_trace_file_name)); __conf_file_name += ".conf"; std::ifstream __conf_file(__conf_file_name.c_str()); if (__conf_file.is_open()) { std::string __line; while (std::getline(__conf_file, __line)) { std::string::size_type __i = __line.find_first_not_of(" \t\n\v"); if (__line.length() <= 0 || __line[__i] == '#') // Skip empty lines or comments. continue; } // Trim. __line.erase(__remove(__line.begin(), __line.end(), ' '), __line.end()); std::string::size_type __pos = __line.find("="); std::string __factor_name = __line.substr(0, __pos); std::string::size_type __end = __line.find_first_of(";\n"); std::string __factor_value = __line.substr(__pos + 1, __end - __pos); _GLIBCXX_PROFILE_DATA(__env)[__factor_name] = __factor_value; } } struct __cost_factor_writer { FILE* __file; __cost_factor_writer(FILE* __f) : __file(__f) { } void operator() (const __cost_factor* __factor) { std::fprintf(__file, "%s = %f\n", __factor->__env_var, __factor->__value); } }; inline void __write_cost_factors() { FILE* __file = __open_output_file("conf.out"); __for_each(_GLIBCXX_PROFILE_DATA(__cost_factors)->begin(), _GLIBCXX_PROFILE_DATA(__cost_factors)->end(), __cost_factor_writer(__file)); std::fclose(__file); } struct __cost_factor_setter { void operator()(__cost_factor* __factor) { // Look it up in the process environment first. const char* __env_value = std::getenv(__factor->__env_var); if (!__env_value) { // Look it up in the config file. __env_t::iterator __it = _GLIBCXX_PROFILE_DATA(__env).find(__factor->__env_var); if (__it != _GLIBCXX_PROFILE_DATA(__env).end()) __env_value = (*__it).second.c_str(); } if (__env_value) __factor->__value = std::atof(__env_value); } }; inline void __set_cost_factors() { _GLIBCXX_PROFILE_DATA(__cost_factors) = new __cost_factor_vector; _GLIBCXX_PROFILE_DATA(__cost_factors)-> push_back(&_GLIBCXX_PROFILE_DATA(__vector_shift_cost_factor)); _GLIBCXX_PROFILE_DATA(__cost_factors)-> push_back(&_GLIBCXX_PROFILE_DATA(__vector_iterate_cost_factor)); _GLIBCXX_PROFILE_DATA(__cost_factors)-> push_back(&_GLIBCXX_PROFILE_DATA(__vector_resize_cost_factor)); _GLIBCXX_PROFILE_DATA(__cost_factors)-> push_back(&_GLIBCXX_PROFILE_DATA(__list_shift_cost_factor)); _GLIBCXX_PROFILE_DATA(__cost_factors)-> push_back(&_GLIBCXX_PROFILE_DATA(__list_iterate_cost_factor)); _GLIBCXX_PROFILE_DATA(__cost_factors)-> push_back(&_GLIBCXX_PROFILE_DATA(__list_resize_cost_factor)); _GLIBCXX_PROFILE_DATA(__cost_factors)-> push_back(&_GLIBCXX_PROFILE_DATA(__map_insert_cost_factor)); _GLIBCXX_PROFILE_DATA(__cost_factors)-> push_back(&_GLIBCXX_PROFILE_DATA(__map_erase_cost_factor)); _GLIBCXX_PROFILE_DATA(__cost_factors)-> push_back(&_GLIBCXX_PROFILE_DATA(__map_find_cost_factor)); _GLIBCXX_PROFILE_DATA(__cost_factors)-> push_back(&_GLIBCXX_PROFILE_DATA(__map_iterate_cost_factor)); _GLIBCXX_PROFILE_DATA(__cost_factors)-> push_back(&_GLIBCXX_PROFILE_DATA(__umap_insert_cost_factor)); _GLIBCXX_PROFILE_DATA(__cost_factors)-> push_back(&_GLIBCXX_PROFILE_DATA(__umap_erase_cost_factor)); _GLIBCXX_PROFILE_DATA(__cost_factors)-> push_back(&_GLIBCXX_PROFILE_DATA(__umap_find_cost_factor)); _GLIBCXX_PROFILE_DATA(__cost_factors)-> push_back(&_GLIBCXX_PROFILE_DATA(__umap_iterate_cost_factor)); __for_each(_GLIBCXX_PROFILE_DATA(__cost_factors)->begin(), _GLIBCXX_PROFILE_DATA(__cost_factors)->end(), __cost_factor_setter()); } inline void __profcxx_init_unconditional() { _GLIBCXX_PROFILE_DATA(__global_lock).lock(); if (__is_invalid()) { __set_max_warn_count(); if (_GLIBCXX_PROFILE_DATA(_S_max_warn_count) == 0) __turn_off(); else { __set_max_stack_trace_depth(); __set_max_mem(); __set_trace_path(); __read_cost_factors(); __set_cost_factors(); __write_cost_factors(); __trace_vector_size_init(); __trace_hashtable_size_init(); __trace_hash_func_init(); __trace_vector_to_list_init(); __trace_list_to_slist_init(); __trace_list_to_vector_init(); __trace_map_to_unordered_map_init(); std::atexit(__report); __turn_on(); } } _GLIBCXX_PROFILE_DATA(__global_lock).unlock(); } /** @brief This function must be called by each instrumentation point. * * The common path is inlined fully. */ inline bool __profcxx_init() { if (__is_invalid()) __profcxx_init_unconditional(); return __is_on(); } } // namespace __gnu_profile #endif /* _GLIBCXX_PROFILE_PROFILER_TRACE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/impl/profiler_state.h�������������������������������������������������������������0000644�����������������00000003724�14763166027�0013403 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/impl/profiler_state.h * @brief Global profiler state. */ // Written by Lixia Liu and Silvius Rus. #ifndef _GLIBCXX_PROFILE_PROFILER_STATE_H #define _GLIBCXX_PROFILE_PROFILER_STATE_H 1 namespace __gnu_profile { enum __state_type { __ON, __OFF, __INVALID }; _GLIBCXX_PROFILE_DEFINE_DATA(__state_type, __state, __INVALID); inline bool __turn(__state_type __s) { __state_type inv(__INVALID); return __atomic_compare_exchange_n(&_GLIBCXX_PROFILE_DATA(__state), &inv, __s, false, __ATOMIC_ACQ_REL, __ATOMIC_RELAXED); } inline bool __turn_on() { return __turn(__ON); } inline bool __turn_off() { return __turn(__OFF); } inline bool __is_on() { return _GLIBCXX_PROFILE_DATA(__state) == __ON; } inline bool __is_off() { return _GLIBCXX_PROFILE_DATA(__state) == __OFF; } inline bool __is_invalid() { return _GLIBCXX_PROFILE_DATA(__state) == __INVALID; } } // end namespace __gnu_profile #endif /* _GLIBCXX_PROFILE_PROFILER_STATE_H */ ��������������������������������������������c++/4.8.2/profile/impl/profiler.h�������������������������������������������������������������������0000644�����������������00000037424�14763166027�0012207 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/impl/profiler.h * @brief Interface of the profiling runtime library. */ // Written by Lixia Liu and Silvius Rus. #ifndef _GLIBCXX_PROFILE_PROFILER_H #define _GLIBCXX_PROFILE_PROFILER_H 1 #include <bits/c++config.h> // Mechanism to define data with inline linkage. #define _GLIBCXX_PROFILE_DEFINE_UNINIT_DATA(__type, __name) \ inline __type& \ __get_##__name() \ { \ static __type __name; \ return __name; \ } #define _GLIBCXX_PROFILE_DEFINE_DATA(__type, __name, __initial_value...) \ inline __type& __get_##__name() { \ static __type __name(__initial_value); \ return __name; \ } #define _GLIBCXX_PROFILE_DATA(__name) \ __get_##__name() namespace __gnu_profile { /** @brief Reentrance guard. * * Mechanism to protect all __gnu_profile operations against recursion, * multithreaded and exception reentrance. */ struct __reentrance_guard { static bool __get_in() { if (__inside() == true) return false; else { __inside() = true; return true; } } static bool& __inside() { static __thread bool _S_inside(false); return _S_inside; } __reentrance_guard() { } ~__reentrance_guard() { __inside() = false; } }; #define _GLIBCXX_PROFILE_REENTRANCE_GUARD(__x...) \ { \ if (__gnu_profile::__reentrance_guard::__get_in()) \ { \ __gnu_profile::__reentrance_guard __get_out; \ __x; \ } \ } // Forward declarations of implementation functions. // Don't use any __gnu_profile:: in user code. // Instead, use the __profcxx... macros, which offer guarded access. bool __turn_on(); bool __turn_off(); bool __is_invalid(); bool __is_on(); bool __is_off(); void __report(void); void __trace_hashtable_size_resize(const void*, std::size_t, std::size_t); void __trace_hashtable_size_destruct(const void*, std::size_t, std::size_t); void __trace_hashtable_size_construct(const void*, std::size_t); void __trace_vector_size_resize(const void*, std::size_t, std::size_t); void __trace_vector_size_destruct(const void*, std::size_t, std::size_t); void __trace_vector_size_construct(const void*, std::size_t); void __trace_hash_func_destruct(const void*, std::size_t, std::size_t, std::size_t); void __trace_hash_func_construct(const void*); void __trace_vector_to_list_destruct(const void*); void __trace_vector_to_list_construct(const void*); void __trace_vector_to_list_insert(const void*, std::size_t, std::size_t); void __trace_vector_to_list_iterate(const void*, std::size_t); void __trace_vector_to_list_invalid_operator(const void*); void __trace_vector_to_list_resize(const void*, std::size_t, std::size_t); void __trace_vector_to_list_find(const void*, std::size_t); void __trace_list_to_slist_destruct(const void*); void __trace_list_to_slist_construct(const void*); void __trace_list_to_slist_rewind(const void*); void __trace_list_to_slist_operation(const void*); void __trace_list_to_vector_destruct(const void*); void __trace_list_to_vector_construct(const void*); void __trace_list_to_vector_insert(const void*, std::size_t, std::size_t); void __trace_list_to_vector_iterate(const void*, std::size_t); void __trace_list_to_vector_invalid_operator(const void*); void __trace_list_to_vector_resize(const void*, std::size_t, std::size_t); void __trace_list_to_set_destruct(const void*); void __trace_list_to_set_construct(const void*); void __trace_list_to_set_insert(const void*, std::size_t, std::size_t); void __trace_list_to_set_iterate(const void*, std::size_t); void __trace_list_to_set_invalid_operator(const void*); void __trace_list_to_set_find(const void*, std::size_t); void __trace_map_to_unordered_map_construct(const void*); void __trace_map_to_unordered_map_invalidate(const void*); void __trace_map_to_unordered_map_insert(const void*, std::size_t, std::size_t); void __trace_map_to_unordered_map_erase(const void*, std::size_t, std::size_t); void __trace_map_to_unordered_map_iterate(const void*, std::size_t); void __trace_map_to_unordered_map_find(const void*, std::size_t); void __trace_map_to_unordered_map_destruct(const void*); } // namespace __gnu_profile // Master switch turns on all diagnostics that are not explicitly turned off. #ifdef _GLIBCXX_PROFILE #ifndef _GLIBCXX_PROFILE_NO_HASHTABLE_TOO_SMALL #define _GLIBCXX_PROFILE_HASHTABLE_TOO_SMALL #endif #ifndef _GLIBCXX_PROFILE_NO_HASHTABLE_TOO_LARGE #define _GLIBCXX_PROFILE_HASHTABLE_TOO_LARGE #endif #ifndef _GLIBCXX_PROFILE_NO_VECTOR_TOO_SMALL #define _GLIBCXX_PROFILE_VECTOR_TOO_SMALL #endif #ifndef _GLIBCXX_PROFILE_NO_VECTOR_TOO_LARGE #define _GLIBCXX_PROFILE_VECTOR_TOO_LARGE #endif #ifndef _GLIBCXX_PROFILE_NO_INEFFICIENT_HASH #define _GLIBCXX_PROFILE_INEFFICIENT_HASH #endif #ifndef _GLIBCXX_PROFILE_NO_VECTOR_TO_LIST #define _GLIBCXX_PROFILE_VECTOR_TO_LIST #endif #ifndef _GLIBCXX_PROFILE_NO_LIST_TO_SLIST #define _GLIBCXX_PROFILE_LIST_TO_SLIST #endif #ifndef _GLIBCXX_PROFILE_NO_LIST_TO_VECTOR #define _GLIBCXX_PROFILE_LIST_TO_VECTOR #endif #ifndef _GLIBCXX_PROFILE_NO_MAP_TO_UNORDERED_MAP #define _GLIBCXX_PROFILE_MAP_TO_UNORDERED_MAP #endif #endif // Expose global management routines to user code. #ifdef _GLIBCXX_PROFILE #define __profcxx_report() \ _GLIBCXX_PROFILE_REENTRANCE_GUARD(__gnu_profile::__report()) #define __profcxx_turn_on() \ _GLIBCXX_PROFILE_REENTRANCE_GUARD(__gnu_profile::__turn_on()) #define __profcxx_turn_off() \ _GLIBCXX_PROFILE_REENTRANCE_GUARD(__gnu_profile::__turn_off()) #define __profcxx_is_invalid() \ _GLIBCXX_PROFILE_REENTRANCE_GUARD(__gnu_profile::__is_invalid()) #define __profcxx_is_on() \ _GLIBCXX_PROFILE_REENTRANCE_GUARD(__gnu_profile::__is_on()) #define __profcxx_is_off() \ _GLIBCXX_PROFILE_REENTRANCE_GUARD(__gnu_profile::__is_off()) #else #define __profcxx_report() #define __profcxx_turn_on() #define __profcxx_turn_off() #define __profcxx_is_invalid() #define __profcxx_is_on() #define __profcxx_is_off() #endif // Turn on/off instrumentation for HASHTABLE_TOO_SMALL and HASHTABLE_TOO_LARGE. #if (defined(_GLIBCXX_PROFILE_HASHTABLE_TOO_SMALL) \ || defined(_GLIBCXX_PROFILE_HASHTABLE_TOO_LARGE)) #define __profcxx_hashtable_resize(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_hashtable_size_resize(__x)) #define __profcxx_hashtable_destruct(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_hashtable_size_destruct(__x)) #define __profcxx_hashtable_construct(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_hashtable_size_construct(__x)) #else #define __profcxx_hashtable_resize(__x...) #define __profcxx_hashtable_destruct(__x...) #define __profcxx_hashtable_construct(__x...) #endif // Turn on/off instrumentation for VECTOR_TOO_SMALL and VECTOR_TOO_LARGE. #if (defined(_GLIBCXX_PROFILE_VECTOR_TOO_SMALL) \ || defined(_GLIBCXX_PROFILE_VECTOR_TOO_LARGE)) #define __profcxx_vector_resize(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_vector_size_resize(__x)) #define __profcxx_vector_destruct(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_vector_size_destruct(__x)) #define __profcxx_vector_construct(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_vector_size_construct(__x)) #else #define __profcxx_vector_resize(__x...) #define __profcxx_vector_destruct(__x...) #define __profcxx_vector_construct(__x...) #endif // Turn on/off instrumentation for INEFFICIENT_HASH. #if defined(_GLIBCXX_PROFILE_INEFFICIENT_HASH) #define __profcxx_inefficient_hash_is_on() \ __gnu_profile::__is_on() #define __profcxx_hashtable_construct2(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_hash_func_construct(__x)) #define __profcxx_hashtable_destruct2(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_hash_func_destruct(__x)) #else #define __profcxx_inefficient_hash_is_on() false #define __profcxx_hashtable_destruct2(__x...) #define __profcxx_hashtable_construct2(__x...) #endif // Turn on/off instrumentation for VECTOR_TO_LIST. #if defined(_GLIBCXX_PROFILE_VECTOR_TO_LIST) #define __profcxx_vector_construct2(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_vector_to_list_construct(__x)) #define __profcxx_vector_destruct2(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_vector_to_list_destruct(__x)) #define __profcxx_vector_insert(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_vector_to_list_insert(__x)) #define __profcxx_vector_iterate(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_vector_to_list_iterate(__x)) #define __profcxx_vector_invalid_operator(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_vector_to_list_invalid_operator(__x)) #define __profcxx_vector_resize2(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_vector_to_list_resize(__x)) #define __profcxx_vector_find(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_vector_to_list_find(__x)) #else #define __profcxx_vector_destruct2(__x...) #define __profcxx_vector_construct2(__x...) #define __profcxx_vector_insert(__x...) #define __profcxx_vector_iterate(__x...) #define __profcxx_vector_invalid_operator(__x...) #define __profcxx_vector_resize2(__x...) #define __profcxx_vector_find(__x...) #endif // Turn on/off instrumentation for LIST_TO_VECTOR. #if defined(_GLIBCXX_PROFILE_LIST_TO_VECTOR) #define __profcxx_list_construct2(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_list_to_vector_construct(__x)) #define __profcxx_list_destruct2(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_list_to_vector_destruct(__x)) #define __profcxx_list_insert(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_list_to_vector_insert(__x)) #define __profcxx_list_iterate(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_list_to_vector_iterate(__x)) #define __profcxx_list_invalid_operator(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_list_to_vector_invalid_operator(__x)) #else #define __profcxx_list_destruct2(__x...) #define __profcxx_list_construct2(__x...) #define __profcxx_list_insert(__x...) #define __profcxx_list_iterate(__x...) #define __profcxx_list_invalid_operator(__x...) #endif // Turn on/off instrumentation for LIST_TO_SLIST. #if defined(_GLIBCXX_PROFILE_LIST_TO_SLIST) #define __profcxx_list_rewind(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_list_to_slist_rewind(__x)) #define __profcxx_list_operation(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_list_to_slist_operation(__x)) #define __profcxx_list_destruct(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_list_to_slist_destruct(__x)) #define __profcxx_list_construct(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_list_to_slist_construct(__x)) #else #define __profcxx_list_rewind(__x...) #define __profcxx_list_operation(__x...) #define __profcxx_list_destruct(__x...) #define __profcxx_list_construct(__x...) #endif // Turn on/off instrumentation for MAP_TO_UNORDERED_MAP. #if defined(_GLIBCXX_PROFILE_MAP_TO_UNORDERED_MAP) #define __profcxx_map_to_unordered_map_construct(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_map_to_unordered_map_construct(__x)) #define __profcxx_map_to_unordered_map_destruct(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_map_to_unordered_map_destruct(__x)) #define __profcxx_map_to_unordered_map_insert(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_map_to_unordered_map_insert(__x)) #define __profcxx_map_to_unordered_map_erase(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_map_to_unordered_map_erase(__x)) #define __profcxx_map_to_unordered_map_iterate(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_map_to_unordered_map_iterate(__x)) #define __profcxx_map_to_unordered_map_invalidate(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_map_to_unordered_map_invalidate(__x)) #define __profcxx_map_to_unordered_map_find(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_map_to_unordered_map_find(__x)) #else #define __profcxx_map_to_unordered_map_construct(__x...) \ #define __profcxx_map_to_unordered_map_destruct(__x...) #define __profcxx_map_to_unordered_map_insert(__x...) #define __profcxx_map_to_unordered_map_erase(__x...) #define __profcxx_map_to_unordered_map_iterate(__x...) #define __profcxx_map_to_unordered_map_invalidate(__x...) #define __profcxx_map_to_unordered_map_find(__x...) #endif // Set default values for compile-time customizable variables. #ifndef _GLIBCXX_PROFILE_TRACE_PATH_ROOT #define _GLIBCXX_PROFILE_TRACE_PATH_ROOT "libstdcxx-profile" #endif #ifndef _GLIBCXX_PROFILE_TRACE_ENV_VAR #define _GLIBCXX_PROFILE_TRACE_ENV_VAR "_GLIBCXX_PROFILE_TRACE_PATH_ROOT" #endif #ifndef _GLIBCXX_PROFILE_MAX_WARN_COUNT_ENV_VAR #define _GLIBCXX_PROFILE_MAX_WARN_COUNT_ENV_VAR \ "_GLIBCXX_PROFILE_MAX_WARN_COUNT" #endif #ifndef _GLIBCXX_PROFILE_MAX_WARN_COUNT #define _GLIBCXX_PROFILE_MAX_WARN_COUNT 10 #endif #ifndef _GLIBCXX_PROFILE_MAX_STACK_DEPTH #define _GLIBCXX_PROFILE_MAX_STACK_DEPTH 32 #endif #ifndef _GLIBCXX_PROFILE_MAX_STACK_DEPTH_ENV_VAR #define _GLIBCXX_PROFILE_MAX_STACK_DEPTH_ENV_VAR \ "_GLIBCXX_PROFILE_MAX_STACK_DEPTH" #endif #ifndef _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC #define _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC (1 << 28) #endif #ifndef _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC_ENV_VAR #define _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC_ENV_VAR \ "_GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC" #endif // Instrumentation hook implementations. #include "profile/impl/profiler_hash_func.h" #include "profile/impl/profiler_hashtable_size.h" #include "profile/impl/profiler_map_to_unordered_map.h" #include "profile/impl/profiler_vector_size.h" #include "profile/impl/profiler_vector_to_list.h" #include "profile/impl/profiler_list_to_slist.h" #include "profile/impl/profiler_list_to_vector.h" #endif // _GLIBCXX_PROFILE_PROFILER_H ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/impl/profiler_list_to_slist.h�����������������������������������������������������0000644�����������������00000012262�14763166027�0015153 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/impl/profiler_list_to_slist.h * @brief Diagnostics for list to slist. */ // Written by Changhee Jung. #ifndef _GLIBCXX_PROFILE_PROFILER_LIST_TO_SLIST_H #define _GLIBCXX_PROFILE_PROFILER_LIST_TO_SLIST_H 1 #include "profile/impl/profiler.h" #include "profile/impl/profiler_node.h" #include "profile/impl/profiler_trace.h" namespace __gnu_profile { class __list2slist_info : public __object_info_base { public: __list2slist_info() : _M_rewind(false), _M_operations(0) { } __list2slist_info(__stack_t __stack) : __object_info_base(__stack), _M_rewind(false), _M_operations(0) { } virtual ~__list2slist_info() { } __list2slist_info(const __list2slist_info& __o) : __object_info_base(__o), _M_rewind(__o._M_rewind), _M_operations(__o._M_operations) { } // XXX: the magnitude should be multiplied with a constant factor F, // where F is 1 when the malloc size class of list nodes is different // from the malloc size class of slist nodes. When they fall into the same // class, the only slist benefit is from having to set fewer links, so // the factor F should be much smaller, closer to 0 than to 1. // This could be implemented by passing the size classes in the config // file. For now, we always assume F to be 1. float __magnitude() const { if (!_M_rewind) return _M_operations; else return 0; } void __merge(const __list2slist_info&) { } void __write(FILE* __f) const { std::fprintf(__f, "%s\n", _M_rewind ? "invalid" : "valid"); } std::string __advice() const { return "change std::list to std::forward_list"; } void __opr_rewind() { _M_rewind = true; _M_valid = false; } void __record_operation() { ++_M_operations; } bool __has_rewind() { return _M_rewind; } private: bool _M_rewind; std::size_t _M_operations; }; class __list2slist_stack_info : public __list2slist_info { public: __list2slist_stack_info(const __list2slist_info& __o) : __list2slist_info(__o) { } }; class __trace_list_to_slist : public __trace_base<__list2slist_info, __list2slist_stack_info> { public: ~__trace_list_to_slist() { } __trace_list_to_slist() : __trace_base<__list2slist_info, __list2slist_stack_info>() { __id = "list-to-slist"; } void __opr_rewind(const void* __obj) { __list2slist_info* __res = __get_object_info(__obj); if (__res) __res->__opr_rewind(); } void __record_operation(const void* __obj) { __list2slist_info* __res = __get_object_info(__obj); if (__res) __res->__record_operation(); } void __insert(const __object_t __obj, __stack_t __stack) { __add_object(__obj, __list2slist_info(__stack)); } void __destruct(const void* __obj) { if (!__is_on()) return; __list2slist_info* __res = __get_object_info(__obj); if (!__res) return; __retire_object(__obj); } }; inline void __trace_list_to_slist_init() { _GLIBCXX_PROFILE_DATA(_S_list_to_slist) = new __trace_list_to_slist(); } inline void __trace_list_to_slist_report(FILE* __f, __warning_vector_t& __warnings) { if (_GLIBCXX_PROFILE_DATA(_S_list_to_slist)) { _GLIBCXX_PROFILE_DATA(_S_list_to_slist)-> __collect_warnings(__warnings); _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__write(__f); } } inline void __trace_list_to_slist_rewind(const void* __obj) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__opr_rewind(__obj); } inline void __trace_list_to_slist_operation(const void* __obj) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__record_operation(__obj); } inline void __trace_list_to_slist_construct(const void* __obj) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__insert(__obj, __get_stack()); } inline void __trace_list_to_slist_destruct(const void* __obj) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__destruct(__obj); } } // namespace __gnu_profile #endif /* _GLIBCXX_PROFILE_PROFILER_LIST_TO_SLIST_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/impl/profiler_map_to_unordered_map.h����������������������������������������������0000644�����������������00000017307�14763166027�0016450 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/impl/profiler_map_to_unordered_map.h * @brief Diagnostics for map to unordered_map. */ // Written by Silvius Rus. #ifndef _GLIBCXX_PROFILE_PROFILER_MAP_TO_UNORDERED_MAP_H #define _GLIBCXX_PROFILE_PROFILER_MAP_TO_UNORDERED_MAP_H 1 #include "profile/impl/profiler.h" #include "profile/impl/profiler_node.h" #include "profile/impl/profiler_trace.h" namespace __gnu_profile { inline int __log2(std::size_t __size) { for (int __bit_count = sizeof(std::size_t) - 1; __bit_count >= 0; -- __bit_count) if ((2 << __bit_count) & __size) return __bit_count; return 0; } inline float __map_insert_cost(std::size_t __size) { return (_GLIBCXX_PROFILE_DATA(__map_insert_cost_factor).__value * static_cast<float>(__log2(__size))); } inline float __map_erase_cost(std::size_t __size) { return (_GLIBCXX_PROFILE_DATA(__map_erase_cost_factor).__value * static_cast<float>(__log2(__size))); } inline float __map_find_cost(std::size_t __size) { return (_GLIBCXX_PROFILE_DATA(__map_find_cost_factor).__value * static_cast<float>(__log2(__size))); } /** @brief A map-to-unordered_map instrumentation line in the object table. */ class __map2umap_info : public __object_info_base { public: __map2umap_info() : _M_insert(0), _M_erase(0), _M_find(0), _M_iterate(0), _M_umap_cost(0.0), _M_map_cost(0.0), _M_valid(true) { } __map2umap_info(__stack_t __stack) : __object_info_base(__stack), _M_insert(0), _M_erase(0), _M_find(0), _M_iterate(0), _M_umap_cost(0.0), _M_map_cost(0.0), _M_valid(true) { } virtual ~__map2umap_info() { } __map2umap_info(const __map2umap_info& __o) : __object_info_base(__o), _M_insert(__o._M_insert), _M_erase(__o._M_erase), _M_find(__o._M_find), _M_iterate(__o._M_iterate), _M_umap_cost(__o._M_umap_cost), _M_map_cost(__o._M_map_cost), _M_valid(__o._M_valid) { } void __merge(const __map2umap_info& __o) { _M_insert += __o._M_insert; _M_erase += __o._M_erase; _M_find += __o._M_find; _M_umap_cost += __o._M_umap_cost; _M_map_cost += __o._M_map_cost; _M_valid &= __o._M_valid; } void __write(FILE* __f) const { std::fprintf(__f, "%Zu %Zu %Zu %Zu %.0f %.0f %s\n", _M_insert, _M_erase, _M_find, _M_iterate, _M_map_cost, _M_umap_cost, _M_valid ? "valid" : "invalid"); } float __magnitude() const { return _M_map_cost - _M_umap_cost; } std::string __advice() const { return "change std::map to std::unordered_map"; } void __record_insert(std::size_t __size, std::size_t __count) { _M_insert += __count; _M_map_cost += __count * __map_insert_cost(__size); _M_umap_cost += (__count * _GLIBCXX_PROFILE_DATA(__umap_insert_cost_factor).__value); } void __record_erase(std::size_t __size, std::size_t __count) { _M_erase += __count; _M_map_cost += __count * __map_erase_cost(__size); _M_umap_cost += (__count * _GLIBCXX_PROFILE_DATA(__umap_erase_cost_factor).__value); } void __record_find(std::size_t __size) { _M_find += 1; _M_map_cost += __map_find_cost(__size); _M_umap_cost += _GLIBCXX_PROFILE_DATA(__umap_find_cost_factor).__value; } void __record_iterate(std::size_t __count) { _M_iterate += __count; _M_map_cost += (__count * _GLIBCXX_PROFILE_DATA(__map_iterate_cost_factor).__value); _M_umap_cost += (__count * _GLIBCXX_PROFILE_DATA(__umap_iterate_cost_factor).__value); } void __record_invalidate() { _M_valid = false; } private: std::size_t _M_insert; std::size_t _M_erase; std::size_t _M_find; std::size_t _M_iterate; float _M_umap_cost; float _M_map_cost; bool _M_valid; }; /** @brief A map-to-unordered_map instrumentation line in the stack table. */ class __map2umap_stack_info : public __map2umap_info { public: __map2umap_stack_info(const __map2umap_info& __o) : __map2umap_info(__o) { } }; /** @brief Map-to-unordered_map instrumentation producer. */ class __trace_map2umap : public __trace_base<__map2umap_info, __map2umap_stack_info> { public: __trace_map2umap() : __trace_base<__map2umap_info, __map2umap_stack_info>() { __id = "map-to-unordered-map"; } }; inline void __trace_map_to_unordered_map_init() { _GLIBCXX_PROFILE_DATA(_S_map2umap) = new __trace_map2umap(); } inline void __trace_map_to_unordered_map_report(FILE* __f, __warning_vector_t& __warnings) { if (_GLIBCXX_PROFILE_DATA(_S_map2umap)) { _GLIBCXX_PROFILE_DATA(_S_map2umap)->__collect_warnings(__warnings); _GLIBCXX_PROFILE_DATA(_S_map2umap)->__write(__f); } } inline void __trace_map_to_unordered_map_construct(const void* __obj) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_map2umap)-> __add_object(__obj, __map2umap_info(__get_stack())); } inline void __trace_map_to_unordered_map_destruct(const void* __obj) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_map2umap)->__retire_object(__obj); } inline void __trace_map_to_unordered_map_insert(const void* __obj, std::size_t __size, std::size_t __count) { if (!__profcxx_init()) return; __map2umap_info* __info = _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj); if (__info) __info->__record_insert(__size, __count); } inline void __trace_map_to_unordered_map_erase(const void* __obj, std::size_t __size, std::size_t __count) { if (!__profcxx_init()) return; __map2umap_info* __info = _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj); if (__info) __info->__record_erase(__size, __count); } inline void __trace_map_to_unordered_map_find(const void* __obj, std::size_t __size) { if (!__profcxx_init()) return; __map2umap_info* __info = _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj); if (__info) __info->__record_find(__size); } inline void __trace_map_to_unordered_map_iterate(const void* __obj, std::size_t __count) { if (!__profcxx_init()) return; __map2umap_info* __info = _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj); if (__info) __info->__record_iterate(__count); } inline void __trace_map_to_unordered_map_invalidate(const void* __obj) { if (!__profcxx_init()) return; __map2umap_info* __info = _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj); if (__info) __info->__record_invalidate(); } } // namespace __gnu_profile #endif /* _GLIBCXX_PROFILE_PROFILER_MAP_TO_UNORDERED_MAP_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/impl/profiler_list_to_vector.h����������������������������������������������������0000644�����������������00000020604�14763166027�0015316 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/impl/profiler_list_to_vector.h * @brief diagnostics for list to vector. */ // Written by Changhee Jung. #ifndef _GLIBCXX_PROFILE_PROFILER_LIST_TO_VECTOR_H #define _GLIBCXX_PROFILE_PROFILER_LIST_TO_VECTOR_H 1 #include <sstream> #include "profile/impl/profiler.h" #include "profile/impl/profiler_node.h" #include "profile/impl/profiler_trace.h" namespace __gnu_profile { /** @brief A list-to-vector instrumentation line in the object table. */ class __list2vector_info : public __object_info_base { public: __list2vector_info() : _M_shift_count(0), _M_iterate(0), _M_resize(0), _M_list_cost(0), _M_vector_cost(0), _M_valid(true), _M_max_size(0) { } __list2vector_info(__stack_t __stack) : __object_info_base(__stack), _M_shift_count(0), _M_iterate(0), _M_resize(0), _M_list_cost(0), _M_vector_cost(0), _M_valid(true), _M_max_size(0) { } virtual ~__list2vector_info() { } __list2vector_info(const __list2vector_info& __o) : __object_info_base(__o), _M_shift_count(__o._M_shift_count), _M_iterate(__o._M_iterate), _M_resize(__o._M_resize), _M_list_cost(__o._M_list_cost), _M_vector_cost(__o._M_vector_cost), _M_valid(__o._M_valid), _M_max_size(__o._M_max_size) { } void __merge(const __list2vector_info& __o) { _M_shift_count += __o._M_shift_count; _M_iterate += __o._M_iterate; _M_vector_cost += __o._M_vector_cost; _M_list_cost += __o._M_list_cost; _M_valid &= __o._M_valid; _M_resize += __o._M_resize; _M_max_size = std::max( _M_max_size, __o._M_max_size); } void __write(FILE* __f) const { std::fprintf(__f, "%Zu %Zu %Zu %.0f %.0f\n", _M_shift_count, _M_resize, _M_iterate, _M_vector_cost, _M_list_cost); } float __magnitude() const { return _M_list_cost - _M_vector_cost; } std::string __advice() const { std::stringstream __sstream; __sstream << "change std::list to std::vector and its initial size from 0 to " << _M_max_size; return __sstream.str(); } std::size_t __shift_count() { return _M_shift_count; } std::size_t __iterate() { return _M_iterate; } float __list_cost() { return _M_list_cost; } std::size_t __resize() { return _M_resize; } void __set_list_cost(float __lc) { _M_list_cost = __lc; } void __set_vector_cost(float __vc) { _M_vector_cost = __vc; } bool __is_valid() { return _M_valid; } void __set_invalid() { _M_valid = false; } void __opr_insert(std::size_t __shift, std::size_t __size) { _M_shift_count += __shift; _M_max_size = std::max(_M_max_size, __size); } void __opr_iterate(std::size_t __num) { _M_iterate += __num;} void __resize(std::size_t __from, std::size_t) { _M_resize += __from; } private: std::size_t _M_shift_count; std::size_t _M_iterate; std::size_t _M_resize; float _M_list_cost; float _M_vector_cost; bool _M_valid; std::size_t _M_max_size; }; class __list2vector_stack_info : public __list2vector_info { public: __list2vector_stack_info(const __list2vector_info& __o) : __list2vector_info(__o) {} }; class __trace_list_to_vector : public __trace_base<__list2vector_info, __list2vector_stack_info> { public: __trace_list_to_vector() : __trace_base<__list2vector_info, __list2vector_stack_info>() { __id = "list-to-vector"; } ~__trace_list_to_vector() { } // Insert a new node at construct with object, callstack and initial size. void __insert(__object_t __obj, __stack_t __stack) { __add_object(__obj, __list2vector_info(__stack)); } // Call at destruction/clean to set container final size. void __destruct(const void* __obj) { if (!__is_on()) return; __list2vector_info* __res = __get_object_info(__obj); if (!__res) return; float __vc = __vector_cost(__res->__shift_count(), __res->__iterate()); float __lc = __list_cost(__res->__shift_count(), __res->__iterate()); __res->__set_vector_cost(__vc); __res->__set_list_cost(__lc); __retire_object(__obj); } // Find the node in the live map. __list2vector_info* __find(const void* __obj); // Collect cost of operations. void __opr_insert(const void* __obj, std::size_t __shift, std::size_t __size) { __list2vector_info* __res = __get_object_info(__obj); if (__res) __res->__opr_insert(__shift, __size); } void __opr_iterate(const void* __obj, std::size_t __num) { __list2vector_info* __res = __get_object_info(__obj); if (__res) __res->__opr_iterate(__num); } void __invalid_operator(const void* __obj) { __list2vector_info* __res = __get_object_info(__obj); if (__res) __res->__set_invalid(); } void __resize(const void* __obj, std::size_t __from, std::size_t __to) { __list2vector_info* __res = __get_object_info(__obj); if (__res) __res->__resize(__from, __to); } float __vector_cost(std::size_t __shift, std::size_t __iterate) { // The resulting vector will use a 'reserve' method. return (__shift * _GLIBCXX_PROFILE_DATA(__vector_shift_cost_factor).__value + __iterate * _GLIBCXX_PROFILE_DATA(__vector_iterate_cost_factor).__value); } float __list_cost(std::size_t __shift, std::size_t __iterate) { return (__shift * _GLIBCXX_PROFILE_DATA(__list_shift_cost_factor).__value + __iterate * _GLIBCXX_PROFILE_DATA(__list_iterate_cost_factor).__value); } }; inline void __trace_list_to_vector_init() { _GLIBCXX_PROFILE_DATA(_S_list_to_vector) = new __trace_list_to_vector(); } inline void __trace_list_to_vector_report(FILE* __f, __warning_vector_t& __warnings) { if (_GLIBCXX_PROFILE_DATA(_S_list_to_vector)) { _GLIBCXX_PROFILE_DATA(_S_list_to_vector)-> __collect_warnings(__warnings); _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__write(__f); } } inline void __trace_list_to_vector_construct(const void* __obj) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__insert(__obj, __get_stack()); } inline void __trace_list_to_vector_destruct(const void* __obj) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__destruct(__obj); } inline void __trace_list_to_vector_insert(const void* __obj, std::size_t __shift, std::size_t __size) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__opr_insert(__obj, __shift, __size); } inline void __trace_list_to_vector_iterate(const void* __obj, std::size_t __num = 1) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__opr_iterate(__obj, __num); } inline void __trace_list_to_vector_invalid_operator(const void* __obj) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__invalid_operator(__obj); } inline void __trace_list_to_vector_resize(const void* __obj, std::size_t __from, std::size_t __to) { if (!__profcxx_init()) return; _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__resize(__obj, __from, __to); } } // namespace __gnu_profile #endif /* _GLIBCXX_PROFILE_PROFILER_LIST_TO_VECTOR_H__ */ ����������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/set.h�����������������������������������������������������������������������������0000644�����������������00000027003�14763166027�0010207 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Profiling set implementation -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file profile/set.h * This file is a GNU profile extension to the Standard C++ Library. */ #ifndef _GLIBCXX_PROFILE_SET_H #define _GLIBCXX_PROFILE_SET_H 1 #include <utility> namespace std _GLIBCXX_VISIBILITY(default) { namespace __profile { /// Class std::set wrapper with performance instrumentation. template<typename _Key, typename _Compare = std::less<_Key>, typename _Allocator = std::allocator<_Key> > class set : public _GLIBCXX_STD_C::set<_Key,_Compare,_Allocator> { typedef _GLIBCXX_STD_C::set<_Key, _Compare, _Allocator> _Base; public: // types: typedef _Key key_type; typedef _Key value_type; typedef _Compare key_compare; typedef _Compare value_compare; typedef _Allocator allocator_type; typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef typename _Base::iterator iterator; typedef typename _Base::const_iterator const_iterator; typedef typename _Base::reverse_iterator reverse_iterator; typedef typename _Base::const_reverse_iterator const_reverse_iterator; typedef typename _Base::size_type size_type; typedef typename _Base::difference_type difference_type; typedef typename _Base::pointer pointer; typedef typename _Base::const_pointer const_pointer; // 23.3.3.1 construct/copy/destroy: explicit set(const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) : _Base(__comp, __a) { } #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<typename _InputIterator> #endif set(_InputIterator __first, _InputIterator __last, const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) : _Base(__first, __last, __comp, __a) { } set(const set& __x) : _Base(__x) { } set(const _Base& __x) : _Base(__x) { } #if __cplusplus >= 201103L set(set&& __x) noexcept(is_nothrow_copy_constructible<_Compare>::value) : _Base(std::move(__x)) { } set(initializer_list<value_type> __l, const _Compare& __comp = _Compare(), const allocator_type& __a = allocator_type()) : _Base(__l, __comp, __a) { } #endif ~set() _GLIBCXX_NOEXCEPT { } set& operator=(const set& __x) { *static_cast<_Base*>(this) = __x; return *this; } #if __cplusplus >= 201103L set& operator=(set&& __x) { // NB: DR 1204. // NB: DR 675. this->clear(); this->swap(__x); return *this; } set& operator=(initializer_list<value_type> __l) { this->clear(); this->insert(__l); return *this; } #endif using _Base::get_allocator; // iterators: iterator begin() _GLIBCXX_NOEXCEPT { return iterator(_Base::begin()); } const_iterator begin() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::begin()); } iterator end() _GLIBCXX_NOEXCEPT { return iterator(_Base::end()); } const_iterator end() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::end()); } reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(end()); } const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(end()); } reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(begin()); } const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(begin()); } #if __cplusplus >= 201103L const_iterator cbegin() const noexcept { return const_iterator(_Base::begin()); } const_iterator cend() const noexcept { return const_iterator(_Base::end()); } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } #endif // capacity: using _Base::empty; using _Base::size; using _Base::max_size; // modifiers: #if __cplusplus >= 201103L template<typename... _Args> std::pair<iterator, bool> emplace(_Args&&... __args) { auto __res = _Base::emplace(std::forward<_Args>(__args)...); return std::pair<iterator, bool>(iterator(__res.first), __res.second); } template<typename... _Args> iterator emplace_hint(const_iterator __pos, _Args&&... __args) { return iterator(_Base::emplace_hint(__pos, std::forward<_Args>(__args)...)); } #endif std::pair<iterator, bool> insert(const value_type& __x) { typedef typename _Base::iterator _Base_iterator; std::pair<_Base_iterator, bool> __res = _Base::insert(__x); return std::pair<iterator, bool>(iterator(__res.first), __res.second); } #if __cplusplus >= 201103L std::pair<iterator, bool> insert(value_type&& __x) { typedef typename _Base::iterator _Base_iterator; std::pair<_Base_iterator, bool> __res = _Base::insert(std::move(__x)); return std::pair<iterator, bool>(iterator(__res.first), __res.second); } #endif iterator insert(const_iterator __position, const value_type& __x) { return iterator(_Base::insert(__position, __x)); } #if __cplusplus >= 201103L iterator insert(const_iterator __position, value_type&& __x) { return iterator(_Base::insert(__position, std::move(__x))); } #endif #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<typename _InputIterator> #endif void insert(_InputIterator __first, _InputIterator __last) { _Base::insert(__first, __last); } #if __cplusplus >= 201103L void insert(initializer_list<value_type> __l) { _Base::insert(__l); } #endif #if __cplusplus >= 201103L iterator erase(const_iterator __position) { return iterator(_Base::erase(__position)); } #else void erase(iterator __position) { _Base::erase(__position); } #endif size_type erase(const key_type& __x) { iterator __victim = find(__x); if (__victim == end()) return 0; else { _Base::erase(__victim); return 1; } } #if __cplusplus >= 201103L iterator erase(const_iterator __first, const_iterator __last) { return iterator(_Base::erase(__first, __last)); } #else void erase(iterator __first, iterator __last) { _Base::erase(__first, __last); } #endif void swap(set& __x) { _Base::swap(__x); } void clear() _GLIBCXX_NOEXCEPT { this->erase(begin(), end()); } // observers: using _Base::key_comp; using _Base::value_comp; // set operations: iterator find(const key_type& __x) { return iterator(_Base::find(__x)); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload const_iterator find(const key_type& __x) const { return const_iterator(_Base::find(__x)); } using _Base::count; iterator lower_bound(const key_type& __x) { return iterator(_Base::lower_bound(__x)); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload const_iterator lower_bound(const key_type& __x) const { return const_iterator(_Base::lower_bound(__x)); } iterator upper_bound(const key_type& __x) { return iterator(_Base::upper_bound(__x)); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload const_iterator upper_bound(const key_type& __x) const { return const_iterator(_Base::upper_bound(__x)); } std::pair<iterator,iterator> equal_range(const key_type& __x) { typedef typename _Base::iterator _Base_iterator; std::pair<_Base_iterator, _Base_iterator> __res = _Base::equal_range(__x); return std::make_pair(iterator(__res.first), iterator(__res.second)); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload std::pair<const_iterator,const_iterator> equal_range(const key_type& __x) const { typedef typename _Base::const_iterator _Base_iterator; std::pair<_Base_iterator, _Base_iterator> __res = _Base::equal_range(__x); return std::make_pair(const_iterator(__res.first), const_iterator(__res.second)); } _Base& _M_base() _GLIBCXX_NOEXCEPT { return *this; } const _Base& _M_base() const _GLIBCXX_NOEXCEPT { return *this; } }; template<typename _Key, typename _Compare, typename _Allocator> inline bool operator==(const set<_Key, _Compare, _Allocator>& __lhs, const set<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() == __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator!=(const set<_Key, _Compare, _Allocator>& __lhs, const set<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() != __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator<(const set<_Key, _Compare, _Allocator>& __lhs, const set<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() < __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator<=(const set<_Key, _Compare, _Allocator>& __lhs, const set<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() <= __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator>=(const set<_Key, _Compare, _Allocator>& __lhs, const set<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() >= __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator>(const set<_Key, _Compare, _Allocator>& __lhs, const set<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() > __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> void swap(set<_Key, _Compare, _Allocator>& __x, set<_Key, _Compare, _Allocator>& __y) { return __x.swap(__y); } } // namespace __profile } // namespace std #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/base.h����������������������������������������������������������������������������0000644�����������������00000003306�14763166027�0010326 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/base.h * @brief Sequential helper functions. * This file is a GNU profile extension to the Standard C++ Library. */ // Written by Lixia Liu #ifndef _GLIBCXX_PROFILE_BASE_H #define _GLIBCXX_PROFILE_BASE_H 1 #include <functional> #include <profile/impl/profiler.h> // Profiling mode namespaces. /** * @namespace std::__profile * @brief GNU profile code, replaces standard behavior with profile behavior. */ namespace std _GLIBCXX_VISIBILITY(default) { namespace __profile { } } /** * @namespace __gnu_profile * @brief GNU profile code for public use. */ namespace __gnu_profile { // Import all the profile versions of components in namespace std. using namespace std::__profile; } #endif /* _GLIBCXX_PROFILE_BASE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/set�������������������������������������������������������������������������������0000644�����������������00000002336�14763166027�0007763 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Profiling set/multiset implementation -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/set * This file is a GNU profile extension to the Standard C++ Library. */ #ifndef _GLIBCXX_PROFILE_SET #define _GLIBCXX_PROFILE_SET 1 #include <set> #include <profile/set.h> #include <profile/multiset.h> #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/vector����������������������������������������������������������������������������0000644�����������������00000036146�14763166027�0010500 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Profiling vector implementation -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/vector * This file is a GNU profile extension to the Standard C++ Library. */ #ifndef _GLIBCXX_PROFILE_VECTOR #define _GLIBCXX_PROFILE_VECTOR 1 #include <vector> #include <utility> #include <profile/base.h> #include <profile/iterator_tracker.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace __profile { template<typename _Tp, typename _Allocator = std::allocator<_Tp> > class vector : public _GLIBCXX_STD_C::vector<_Tp, _Allocator> { typedef _GLIBCXX_STD_C::vector<_Tp, _Allocator> _Base; #if __cplusplus >= 201103L typedef __gnu_cxx::__alloc_traits<_Allocator> _Alloc_traits; #endif public: typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef __iterator_tracker<typename _Base::iterator, vector> iterator; typedef __iterator_tracker<typename _Base::const_iterator, vector> const_iterator; typedef typename _Base::size_type size_type; typedef typename _Base::difference_type difference_type; typedef _Tp value_type; typedef _Allocator allocator_type; typedef typename _Base::pointer pointer; typedef typename _Base::const_pointer const_pointer; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; _Base& _M_base() _GLIBCXX_NOEXCEPT { return *this; } const _Base& _M_base() const _GLIBCXX_NOEXCEPT { return *this; } // 23.2.4.1 construct/copy/destroy: explicit vector(const _Allocator& __a = _Allocator()) : _Base(__a) { __profcxx_vector_construct(this, this->capacity()); __profcxx_vector_construct2(this); } #if __cplusplus >= 201103L explicit vector(size_type __n, const _Allocator& __a = _Allocator()) : _Base(__n, __a) { __profcxx_vector_construct(this, this->capacity()); __profcxx_vector_construct2(this); } vector(size_type __n, const _Tp& __value, const _Allocator& __a = _Allocator()) : _Base(__n, __value, __a) { __profcxx_vector_construct(this, this->capacity()); __profcxx_vector_construct2(this); } #else explicit vector(size_type __n, const _Tp& __value = _Tp(), const _Allocator& __a = _Allocator()) : _Base(__n, __value, __a) { __profcxx_vector_construct(this, this->capacity()); __profcxx_vector_construct2(this); } #endif #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<typename _InputIterator> #endif vector(_InputIterator __first, _InputIterator __last, const _Allocator& __a = _Allocator()) : _Base(__first, __last, __a) { __profcxx_vector_construct(this, this->capacity()); __profcxx_vector_construct2(this); } vector(const vector& __x) : _Base(__x) { __profcxx_vector_construct(this, this->capacity()); __profcxx_vector_construct2(this); } /// Construction from a release-mode vector vector(const _Base& __x) : _Base(__x) { __profcxx_vector_construct(this, this->capacity()); __profcxx_vector_construct2(this); } #if __cplusplus >= 201103L vector(vector&& __x) noexcept : _Base(std::move(__x)) { __profcxx_vector_construct(this, this->capacity()); __profcxx_vector_construct2(this); } vector(const _Base& __x, const _Allocator& __a) : _Base(__x, __a) { __profcxx_vector_construct(this, this->capacity()); __profcxx_vector_construct2(this); } vector(vector&& __x, const _Allocator& __a) noexcept : _Base(std::move(__x), __a) { __profcxx_vector_construct(this, this->capacity()); __profcxx_vector_construct2(this); } vector(initializer_list<value_type> __l, const allocator_type& __a = allocator_type()) : _Base(__l, __a) { } #endif ~vector() _GLIBCXX_NOEXCEPT { __profcxx_vector_destruct(this, this->capacity(), this->size()); __profcxx_vector_destruct2(this); } vector& operator=(const vector& __x) { static_cast<_Base&>(*this) = __x; return *this; } #if __cplusplus >= 201103L vector& operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) { __profcxx_vector_destruct(this, this->capacity(), this->size()); __profcxx_vector_destruct2(this); static_cast<_Base&>(*this) = std::move(__x); return *this; } vector& operator=(initializer_list<value_type> __l) { static_cast<_Base&>(*this) = __l; return *this; } #endif using _Base::assign; using _Base::get_allocator; // iterators: iterator begin() _GLIBCXX_NOEXCEPT { return iterator(_Base::begin(), this); } const_iterator begin() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::begin(), this); } iterator end() _GLIBCXX_NOEXCEPT { return iterator(_Base::end(), this); } const_iterator end() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::end(), this); } reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(end()); } const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(end()); } reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(begin()); } const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(begin()); } #if __cplusplus >= 201103L const_iterator cbegin() const noexcept { return const_iterator(_Base::begin(), this); } const_iterator cend() const noexcept { return const_iterator(_Base::end(), this); } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } #endif // 23.2.4.2 capacity: using _Base::size; using _Base::max_size; #if __cplusplus >= 201103L void resize(size_type __sz) { __profcxx_vector_invalid_operator(this); _M_profile_resize(this, this->capacity(), __sz); _Base::resize(__sz); } void resize(size_type __sz, const _Tp& __c) { __profcxx_vector_invalid_operator(this); _M_profile_resize(this, this->capacity(), __sz); _Base::resize(__sz, __c); } #else void resize(size_type __sz, _Tp __c = _Tp()) { __profcxx_vector_invalid_operator(this); _M_profile_resize(this, this->capacity(), __sz); _Base::resize(__sz, __c); } #endif #if __cplusplus >= 201103L using _Base::shrink_to_fit; #endif using _Base::empty; // element access: reference operator[](size_type __n) { __profcxx_vector_invalid_operator(this); return _M_base()[__n]; } const_reference operator[](size_type __n) const { __profcxx_vector_invalid_operator(this); return _M_base()[__n]; } using _Base::at; reference front() { return _Base::front(); } const_reference front() const { return _Base::front(); } reference back() { return _Base::back(); } const_reference back() const { return _Base::back(); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 464. Suggestion for new member functions in standard containers. using _Base::data; // 23.2.4.3 modifiers: void push_back(const _Tp& __x) { size_type __old_size = this->capacity(); _Base::push_back(__x); _M_profile_resize(this, __old_size, this->capacity()); } #if __cplusplus >= 201103L void push_back(_Tp&& __x) { size_type __old_size = this->capacity(); _Base::push_back(std::move(__x)); _M_profile_resize(this, __old_size, this->capacity()); } #endif iterator insert(iterator __position, const _Tp& __x) { __profcxx_vector_insert(this, __position.base() - _Base::begin(), this->size()); size_type __old_size = this->capacity(); typename _Base::iterator __res = _Base::insert(__position.base(), __x); _M_profile_resize(this, __old_size, this->capacity()); return iterator(__res, this); } #if __cplusplus >= 201103L iterator insert(iterator __position, _Tp&& __x) { __profcxx_vector_insert(this, __position.base() - _Base::begin(), this->size()); size_type __old_size = this->capacity(); typename _Base::iterator __res = _Base::insert(__position.base(), __x); _M_profile_resize(this, __old_size, this->capacity()); return iterator(__res, this); } template<typename... _Args> iterator emplace(iterator __position, _Args&&... __args) { typename _Base::iterator __res = _Base::emplace(__position.base(), std::forward<_Args>(__args)...); return iterator(__res, this); } void insert(iterator __position, initializer_list<value_type> __l) { this->insert(__position, __l.begin(), __l.end()); } #endif #if __cplusplus >= 201103L void swap(vector&& __x) { _Base::swap(__x); } #endif void swap(vector& __x) #if __cplusplus >= 201103L noexcept(_Alloc_traits::_S_nothrow_swap()) #endif { _Base::swap(__x); } void insert(iterator __position, size_type __n, const _Tp& __x) { __profcxx_vector_insert(this, __position.base() - _Base::begin(), this->size()); size_type __old_size = this->capacity(); _Base::insert(__position, __n, __x); _M_profile_resize(this, __old_size, this->capacity()); } #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<typename _InputIterator> #endif void insert(iterator __position, _InputIterator __first, _InputIterator __last) { __profcxx_vector_insert(this, __position.base()-_Base::begin(), this->size()); size_type __old_size = this->capacity(); _Base::insert(__position, __first, __last); _M_profile_resize(this, __old_size, this->capacity()); } iterator erase(iterator __position) { typename _Base::iterator __res = _Base::erase(__position.base()); return iterator(__res, this); } iterator erase(iterator __first, iterator __last) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container typename _Base::iterator __res = _Base::erase(__first.base(), __last.base()); return iterator(__res, this); } void clear() _GLIBCXX_NOEXCEPT { __profcxx_vector_destruct(this, this->capacity(), this->size()); __profcxx_vector_destruct2(this); _Base::clear(); } inline void _M_profile_find() const { __profcxx_vector_find(this, size()); } inline void _M_profile_iterate(int __rewind = 0) const { __profcxx_vector_iterate(this); } private: void _M_profile_resize(void* obj, size_type __old_size, size_type __new_size) { if (__old_size < __new_size) { __profcxx_vector_resize(this, this->size(), __new_size); __profcxx_vector_resize2(this, this->size(), __new_size); } } }; template<typename _Tp, typename _Alloc> inline bool operator==(const vector<_Tp, _Alloc>& __lhs, const vector<_Tp, _Alloc>& __rhs) { return __lhs._M_base() == __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator!=(const vector<_Tp, _Alloc>& __lhs, const vector<_Tp, _Alloc>& __rhs) { return __lhs._M_base() != __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator<(const vector<_Tp, _Alloc>& __lhs, const vector<_Tp, _Alloc>& __rhs) { return __lhs._M_base() < __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator<=(const vector<_Tp, _Alloc>& __lhs, const vector<_Tp, _Alloc>& __rhs) { return __lhs._M_base() <= __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator>=(const vector<_Tp, _Alloc>& __lhs, const vector<_Tp, _Alloc>& __rhs) { return __lhs._M_base() >= __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator>(const vector<_Tp, _Alloc>& __lhs, const vector<_Tp, _Alloc>& __rhs) { return __lhs._M_base() > __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline void swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs) { __lhs.swap(__rhs); } #if __cplusplus >= 201103L template<typename _Tp, typename _Alloc> inline void swap(vector<_Tp, _Alloc>&& __lhs, vector<_Tp, _Alloc>& __rhs) { __lhs.swap(__rhs); } template<typename _Tp, typename _Alloc> inline void swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>&& __rhs) { __lhs.swap(__rhs); } #endif } // namespace __profile #if __cplusplus >= 201103L // DR 1182. /// std::hash specialization for vector<bool>. template<typename _Alloc> struct hash<__profile::vector<bool, _Alloc>> : public __hash_base<size_t, __profile::vector<bool, _Alloc>> { size_t operator()(const __profile::vector<bool, _Alloc>& __b) const noexcept { return std::hash<_GLIBCXX_STD_C::vector<bool, _Alloc>>() (__b._M_base()); } }; #endif } // namespace std #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/unordered_base.h������������������������������������������������������������������0000644�����������������00000017547�14763166027�0012411 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Profiling unordered containers implementation details -*- C++ -*- // Copyright (C) 2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/unordered_base.h * This file is a GNU profile extension to the Standard C++ Library. */ #ifndef _GLIBCXX_PROFILE_UNORDERED #define _GLIBCXX_PROFILE_UNORDERED 1 namespace std _GLIBCXX_VISIBILITY(default) { namespace __profile { template<typename _UnorderedCont, typename _Value, bool _Cache_hash_code> struct _Bucket_index_helper; template<typename _UnorderedCont, typename _Value> struct _Bucket_index_helper<_UnorderedCont, _Value, true> { static std::size_t bucket(const _UnorderedCont& __uc, const __detail::_Hash_node<_Value, true>* __node) { return __node->_M_hash_code % __uc.bucket_count(); } }; template<typename _UnorderedCont, typename _Value> struct _Bucket_index_helper<_UnorderedCont, _Value, false> { static std::size_t bucket(const _UnorderedCont& __uc, const __detail::_Hash_node<_Value, false>* __node) { return __uc.bucket(__node->_M_v); } }; template<typename _UnorderedCont, typename _Key, typename _Mapped> struct _Bucket_index_helper<_UnorderedCont, std::pair<const _Key, _Mapped>, false> { typedef std::pair<const _Key, _Mapped> _Value; static std::size_t bucket(const _UnorderedCont& __uc, const __detail::_Hash_node<_Value, false>* __node) { return __uc.bucket(__node->_M_v.first); } }; template<typename _UnorderedCont, typename _Value, bool _Cache_hash_code> std::size_t __get_bucket_index(const _UnorderedCont& __uc, const __detail::_Hash_node<_Value, _Cache_hash_code>* __node) { using __bucket_index_helper = _Bucket_index_helper<_UnorderedCont, _Value, _Cache_hash_code>; return __bucket_index_helper::bucket(__uc, __node); } template<typename _UnorderedCont, typename _Value, bool _Cache_hash_code> struct _Equal_helper; template<typename _UnorderedCont, typename _Value> struct _Equal_helper<_UnorderedCont, _Value, true> { static std::size_t are_equal(const _UnorderedCont& __uc, const __detail::_Hash_node<_Value, true>* __lhs, const __detail::_Hash_node<_Value, true>* __rhs) { return __lhs->_M_hash_code == __rhs->_M_hash_code && __uc.key_eq()(__lhs->_M_v, __rhs->_M_v); } }; template<typename _UnorderedCont, typename _Value> struct _Equal_helper<_UnorderedCont, _Value, false> { static std::size_t are_equal(const _UnorderedCont& __uc, const __detail::_Hash_node<_Value, false>* __lhs, const __detail::_Hash_node<_Value, false>* __rhs) { return __uc.key_eq()(__lhs->_M_v, __rhs->_M_v); } }; template<typename _UnorderedCont, typename _Key, typename _Mapped> struct _Equal_helper<_UnorderedCont, std::pair<const _Key, _Mapped>, true> { typedef std::pair<const _Key, _Mapped> _Value; static std::size_t are_equal(const _UnorderedCont& __uc, const __detail::_Hash_node<_Value, true>* __lhs, const __detail::_Hash_node<_Value, true>* __rhs) { return __lhs->_M_hash_code == __rhs->_M_hash_code && __uc.key_eq()(__lhs->_M_v.first, __rhs->_M_v.first); } }; template<typename _UnorderedCont, typename _Key, typename _Mapped> struct _Equal_helper<_UnorderedCont, std::pair<const _Key, _Mapped>, false> { typedef std::pair<const _Key, _Mapped> _Value; static std::size_t are_equal(const _UnorderedCont& __uc, const __detail::_Hash_node<_Value, false>* __lhs, const __detail::_Hash_node<_Value, false>* __rhs) { return __uc.key_eq()(__lhs->_M_v.first, __rhs->_M_v.first); } }; template<typename _UnorderedCont, typename _Value, bool _Cache_hash_code> bool __are_equal(const _UnorderedCont& __uc, const __detail::_Hash_node<_Value, _Cache_hash_code>* __lhs, const __detail::_Hash_node<_Value, _Cache_hash_code>* __rhs) { using __equal_helper = _Equal_helper<_UnorderedCont, _Value, _Cache_hash_code>; return __equal_helper::are_equal(__uc, __lhs, __rhs); } template<typename _UnorderedCont, bool _Unique_keys> class _Unordered_profile { _UnorderedCont& _M_conjure() { return *(static_cast<_UnorderedCont*>(this)); } using __unique_keys = std::integral_constant<bool, _Unique_keys>; protected: _Unordered_profile() { auto& __uc = _M_conjure(); __profcxx_hashtable_construct(&__uc, __uc.bucket_count()); __profcxx_hashtable_construct2(&__uc); } _Unordered_profile(const _Unordered_profile&) : _Unordered_profile() { } _Unordered_profile(_Unordered_profile&&) : _Unordered_profile() { } ~_Unordered_profile() noexcept { auto& __uc = _M_conjure(); __profcxx_hashtable_destruct(&__uc, __uc.bucket_count(), __uc.size()); _M_profile_destruct(); } _Unordered_profile& operator=(const _Unordered_profile&) = default; _Unordered_profile& operator=(_Unordered_profile&&) = default; void _M_profile_destruct() { if (!__profcxx_inefficient_hash_is_on()) return; _M_profile_destruct(__unique_keys()); } private: void _M_profile_destruct(std::true_type); void _M_profile_destruct(std::false_type); }; template<typename _UnorderedCont, bool _Unique_keys> void _Unordered_profile<_UnorderedCont, _Unique_keys>:: _M_profile_destruct(std::true_type) { auto& __uc = _M_conjure(); std::size_t __hops = 0, __lc = 0, __chain = 0; auto __it = __uc.begin(); while (__it != __uc.end()) { auto __bkt = __get_bucket_index(__uc, __it._M_cur); auto __lit = __uc.begin(__bkt); auto __lend = __uc.end(__bkt); for (++__it, ++__lit; __lit != __lend; ++__it, ++__lit) ++__chain; if (__chain) { ++__chain; __lc = __lc > __chain ? __lc : __chain; __hops += __chain * (__chain - 1) / 2; __chain = 0; } } __profcxx_hashtable_destruct2(&__uc, __lc, __uc.size(), __hops); } template<typename _UnorderedCont, bool _Unique_keys> void _Unordered_profile<_UnorderedCont, _Unique_keys>:: _M_profile_destruct(std::false_type) { auto& __uc = _M_conjure(); std::size_t __hops = 0, __lc = 0, __chain = 0, __unique_size = 0; auto __it = __uc.begin(); while (__it != __uc.end()) { auto __bkt = __get_bucket_index(__uc, __it._M_cur); auto __lit = __uc.begin(__bkt); auto __lend = __uc.end(__bkt); auto __pit = __it; ++__unique_size; for (++__it, ++__lit; __lit != __lend; ++__it, ++__lit) { if (!__are_equal(__uc, __pit._M_cur, __it._M_cur)) { ++__chain; ++__unique_size; __pit = __it; } } if (__chain) { ++__chain; __lc = __lc > __chain ? __lc : __chain; __hops += __chain * (__chain - 1) / 2; __chain = 0; } } __profcxx_hashtable_destruct2(&__uc, __lc, __unique_size, __hops); } } // namespace __profile } // namespace std #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/multiset.h������������������������������������������������������������������������0000644�����������������00000026561�14763166027�0011272 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Profiling multiset implementation -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file profile/multiset.h * This file is a GNU profile extension to the Standard C++ Library. */ #ifndef _GLIBCXX_PROFILE_MULTISET_H #define _GLIBCXX_PROFILE_MULTISET_H 1 #include <utility> namespace std _GLIBCXX_VISIBILITY(default) { namespace __profile { /// Class std::multiset wrapper with performance instrumentation. template<typename _Key, typename _Compare = std::less<_Key>, typename _Allocator = std::allocator<_Key> > class multiset : public _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator> { typedef _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator> _Base; public: // types: typedef _Key key_type; typedef _Key value_type; typedef _Compare key_compare; typedef _Compare value_compare; typedef _Allocator allocator_type; typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef typename _Base::iterator iterator; typedef typename _Base::const_iterator const_iterator; typedef typename _Base::reverse_iterator reverse_iterator; typedef typename _Base::const_reverse_iterator const_reverse_iterator; typedef typename _Base::size_type size_type; typedef typename _Base::difference_type difference_type; typedef typename _Base::pointer pointer; typedef typename _Base::const_pointer const_pointer; // 23.3.3.1 construct/copy/destroy: explicit multiset(const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) : _Base(__comp, __a) { } #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<typename _InputIterator> #endif multiset(_InputIterator __first, _InputIterator __last, const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) : _Base(__first, __last, __comp, __a) { } multiset(const multiset& __x) : _Base(__x) { } multiset(const _Base& __x) : _Base(__x) { } #if __cplusplus >= 201103L multiset(multiset&& __x) noexcept(is_nothrow_copy_constructible<_Compare>::value) : _Base(std::move(__x)) { } multiset(initializer_list<value_type> __l, const _Compare& __comp = _Compare(), const allocator_type& __a = allocator_type()) : _Base(__l, __comp, __a) { } #endif ~multiset() _GLIBCXX_NOEXCEPT { } multiset& operator=(const multiset& __x) { *static_cast<_Base*>(this) = __x; return *this; } #if __cplusplus >= 201103L multiset& operator=(multiset&& __x) { // NB: DR 1204. // NB: DR 675. this->clear(); this->swap(__x); return *this; } multiset& operator=(initializer_list<value_type> __l) { this->clear(); this->insert(__l); return *this; } #endif using _Base::get_allocator; // iterators: iterator begin() _GLIBCXX_NOEXCEPT { return iterator(_Base::begin()); } const_iterator begin() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::begin()); } iterator end() _GLIBCXX_NOEXCEPT { return iterator(_Base::end()); } const_iterator end() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::end()); } reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(end()); } const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(end()); } reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(begin()); } const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(begin()); } #if __cplusplus >= 201103L const_iterator cbegin() const noexcept { return const_iterator(_Base::begin()); } const_iterator cend() const noexcept { return const_iterator(_Base::end()); } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } #endif // capacity: using _Base::empty; using _Base::size; using _Base::max_size; // modifiers: #if __cplusplus >= 201103L template<typename... _Args> iterator emplace(_Args&&... __args) { return iterator(_Base::emplace(std::forward<_Args>(__args)...)); } template<typename... _Args> iterator emplace_hint(const_iterator __pos, _Args&&... __args) { return iterator(_Base::emplace_hint(__pos, std::forward<_Args>(__args)...)); } #endif iterator insert(const value_type& __x) { return iterator(_Base::insert(__x)); } #if __cplusplus >= 201103L iterator insert(value_type&& __x) { return iterator(_Base::insert(std::move(__x))); } #endif iterator insert(const_iterator __position, const value_type& __x) { return iterator(_Base::insert(__position, __x)); } #if __cplusplus >= 201103L iterator insert(const_iterator __position, value_type&& __x) { return iterator(_Base::insert(__position, std::move(__x))); } #endif #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<typename _InputIterator> #endif void insert(_InputIterator __first, _InputIterator __last) { _Base::insert(__first, __last); } #if __cplusplus >= 201103L void insert(initializer_list<value_type> __l) { _Base::insert(__l); } #endif #if __cplusplus >= 201103L iterator erase(const_iterator __position) { return iterator(_Base::erase(__position)); } #else void erase(iterator __position) { _Base::erase(__position); } #endif size_type erase(const key_type& __x) { std::pair<iterator, iterator> __victims = this->equal_range(__x); size_type __count = 0; while (__victims.first != __victims.second) { iterator __victim = __victims.first++; _Base::erase(__victim); ++__count; } return __count; } #if __cplusplus >= 201103L iterator erase(const_iterator __first, const_iterator __last) { return iterator(_Base::erase(__first, __last)); } #else void erase(iterator __first, iterator __last) { _Base::erase(__first, __last); } #endif void swap(multiset& __x) { _Base::swap(__x); } void clear() _GLIBCXX_NOEXCEPT { this->erase(begin(), end()); } // observers: using _Base::key_comp; using _Base::value_comp; // multiset operations: iterator find(const key_type& __x) { return iterator(_Base::find(__x)); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload const_iterator find(const key_type& __x) const { return const_iterator(_Base::find(__x)); } using _Base::count; iterator lower_bound(const key_type& __x) { return iterator(_Base::lower_bound(__x)); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload const_iterator lower_bound(const key_type& __x) const { return const_iterator(_Base::lower_bound(__x)); } iterator upper_bound(const key_type& __x) { return iterator(_Base::upper_bound(__x)); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload const_iterator upper_bound(const key_type& __x) const { return const_iterator(_Base::upper_bound(__x)); } std::pair<iterator,iterator> equal_range(const key_type& __x) { typedef typename _Base::iterator _Base_iterator; std::pair<_Base_iterator, _Base_iterator> __res = _Base::equal_range(__x); return std::make_pair(iterator(__res.first), iterator(__res.second)); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload std::pair<const_iterator,const_iterator> equal_range(const key_type& __x) const { typedef typename _Base::const_iterator _Base_iterator; std::pair<_Base_iterator, _Base_iterator> __res = _Base::equal_range(__x); return std::make_pair(const_iterator(__res.first), const_iterator(__res.second)); } _Base& _M_base() _GLIBCXX_NOEXCEPT { return *this; } const _Base& _M_base() const _GLIBCXX_NOEXCEPT { return *this; } }; template<typename _Key, typename _Compare, typename _Allocator> inline bool operator==(const multiset<_Key, _Compare, _Allocator>& __lhs, const multiset<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() == __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator!=(const multiset<_Key, _Compare, _Allocator>& __lhs, const multiset<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() != __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator<(const multiset<_Key, _Compare, _Allocator>& __lhs, const multiset<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() < __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator<=(const multiset<_Key, _Compare, _Allocator>& __lhs, const multiset<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() <= __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator>=(const multiset<_Key, _Compare, _Allocator>& __lhs, const multiset<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() >= __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator>(const multiset<_Key, _Compare, _Allocator>& __lhs, const multiset<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() > __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> void swap(multiset<_Key, _Compare, _Allocator>& __x, multiset<_Key, _Compare, _Allocator>& __y) { return __x.swap(__y); } } // namespace __profile } // namespace std #endif �����������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/forward_list����������������������������������������������������������������������0000644�����������������00000012435�14763166027�0011670 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <forward_list> -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file profile/forward_list * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_PROFILE_FORWARD_LIST #define _GLIBCXX_PROFILE_FORWARD_LIST 1 #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <forward_list> namespace std _GLIBCXX_VISIBILITY(default) { namespace __profile { /// Class std::forward_list wrapper with performance instrumentation. template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class forward_list : public _GLIBCXX_STD_C::forward_list<_Tp, _Alloc> { typedef _GLIBCXX_STD_C::forward_list<_Tp, _Alloc> _Base; typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template rebind<_GLIBCXX_STD_C::_Fwd_list_node<_Tp>>::other _Node_alloc_type; typedef __gnu_cxx::__alloc_traits<_Node_alloc_type> _Node_alloc_traits; public: typedef typename _Base::size_type size_type; // 23.2.3.1 construct/copy/destroy: explicit forward_list(const _Alloc& __al = _Alloc()) : _Base(__al) { } forward_list(const forward_list& __list, const _Alloc& __al) : _Base(__list, __al) { } forward_list(forward_list&& __list, const _Alloc& __al) : _Base(std::move(__list), __al) { } explicit forward_list(size_type __n, const _Alloc& __al = _Alloc()) : _Base(__n, __al) { } forward_list(size_type __n, const _Tp& __value, const _Alloc& __al = _Alloc()) : _Base(__n, __value, __al) { } template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> forward_list(_InputIterator __first, _InputIterator __last, const _Alloc& __al = _Alloc()) : _Base(__first, __last, __al) { } forward_list(const forward_list& __list) : _Base(__list) { } forward_list(forward_list&& __list) noexcept : _Base(std::move(__list)) { } forward_list(std::initializer_list<_Tp> __il, const _Alloc& __al = _Alloc()) : _Base(__il, __al) { } ~forward_list() noexcept { } forward_list& operator=(const forward_list& __list) { static_cast<_Base&>(*this) = __list; return *this; } forward_list& operator=(forward_list&& __list) noexcept(_Node_alloc_traits::_S_nothrow_move()) { static_cast<_Base&>(*this) = std::move(__list); return *this; } forward_list& operator=(std::initializer_list<_Tp> __il) { static_cast<_Base&>(*this) = __il; return *this; } _Base& _M_base() noexcept { return *this; } const _Base& _M_base() const noexcept { return *this; } }; template<typename _Tp, typename _Alloc> inline bool operator==(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly) { return __lx._M_base() == __ly._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator<(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly) { return __lx._M_base() < __ly._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator!=(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly) { return !(__lx == __ly); } /// Based on operator< template<typename _Tp, typename _Alloc> inline bool operator>(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly) { return (__ly < __lx); } /// Based on operator< template<typename _Tp, typename _Alloc> inline bool operator>=(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly) { return !(__lx < __ly); } /// Based on operator< template<typename _Tp, typename _Alloc> inline bool operator<=(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly) { return !(__ly < __lx); } /// See std::forward_list::swap(). template<typename _Tp, typename _Alloc> inline void swap(forward_list<_Tp, _Alloc>& __lx, forward_list<_Tp, _Alloc>& __ly) { __lx.swap(__ly); } } // namespace __profile } // namespace std #endif // C++11 #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/unordered_set���������������������������������������������������������������������0000644�����������������00000033064�14763166027�0012034 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Profiling unordered_set/unordered_multiset implementation -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/unordered_set * This file is a GNU profile extension to the Standard C++ Library. */ #ifndef _GLIBCXX_PROFILE_UNORDERED_SET #define _GLIBCXX_PROFILE_UNORDERED_SET 1 #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else # include <unordered_set> #include <profile/base.h> #include <profile/unordered_base.h> #define _GLIBCXX_BASE unordered_set<_Key, _Hash, _Pred, _Alloc> #define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE namespace std _GLIBCXX_VISIBILITY(default) { namespace __profile { /** @brief Unordered_set wrapper with performance instrumentation. */ template<typename _Key, typename _Hash = std::hash<_Key>, typename _Pred = std::equal_to<_Key>, typename _Alloc = std::allocator<_Key> > class unordered_set : public _GLIBCXX_STD_BASE, public _Unordered_profile<unordered_set<_Key, _Hash, _Pred, _Alloc>, true> { typedef _GLIBCXX_STD_BASE _Base; _Base& _M_base() noexcept { return *this; } const _Base& _M_base() const noexcept { return *this; } public: typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; typedef typename _Base::allocator_type allocator_type; typedef typename _Base::key_type key_type; typedef typename _Base::value_type value_type; typedef typename _Base::difference_type difference_type; typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef typename _Base::iterator iterator; typedef typename _Base::const_iterator const_iterator; explicit unordered_set(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) { } template<typename _InputIterator> unordered_set(_InputIterator __f, _InputIterator __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __eql, __a) { } unordered_set(const unordered_set&) = default; unordered_set(const _Base& __x) : _Base(__x) { } unordered_set(unordered_set&&) = default; unordered_set(initializer_list<value_type> __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__l, __n, __hf, __eql, __a) { } unordered_set& operator=(const unordered_set&) = default; unordered_set& operator=(unordered_set&&) = default; unordered_set& operator=(initializer_list<value_type> __l) { _M_base() = __l; return *this; } void swap(unordered_set& __x) { _Base::swap(__x); } void clear() noexcept { __profcxx_hashtable_destruct(this, _Base::bucket_count(), _Base::size()); this->_M_profile_destruct(); _Base::clear(); } template<typename... _Args> std::pair<iterator, bool> emplace(_Args&&... __args) { size_type __old_size = _Base::bucket_count(); std::pair<iterator, bool> __res = _Base::emplace(std::forward<_Args>(__args)...); _M_profile_resize(__old_size); return __res; } template<typename... _Args> iterator emplace_hint(const_iterator __it, _Args&&... __args) { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::emplace_hint(__it, std::forward<_Args>(__args)...); _M_profile_resize(__old_size); return __res; } void insert(std::initializer_list<value_type> __l) { size_type __old_size = _Base::bucket_count(); _Base::insert(__l); _M_profile_resize(__old_size); } std::pair<iterator, bool> insert(const value_type& __obj) { size_type __old_size = _Base::bucket_count(); std::pair<iterator, bool> __res = _Base::insert(__obj); _M_profile_resize(__old_size); return __res; } iterator insert(const_iterator __iter, const value_type& __v) { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::insert(__iter, __v); _M_profile_resize(__old_size); return __res; } std::pair<iterator, bool> insert(value_type&& __obj) { size_type __old_size = _Base::bucket_count(); std::pair<iterator, bool> __res = _Base::insert(std::move(__obj)); _M_profile_resize(__old_size); return __res; } iterator insert(const_iterator __iter, value_type&& __v) { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::insert(__iter, std::move(__v)); _M_profile_resize(__old_size); return __res; } template<typename _InputIter> void insert(_InputIter __first, _InputIter __last) { size_type __old_size = _Base::bucket_count(); _Base::insert(__first, __last); _M_profile_resize(__old_size); } void rehash(size_type __n) { size_type __old_size = _Base::bucket_count(); _Base::rehash(__n); _M_profile_resize(__old_size); } private: void _M_profile_resize(size_type __old_size) { size_type __new_size = _Base::bucket_count(); if (__old_size != __new_size) __profcxx_hashtable_resize(this, __old_size, __new_size); } }; template<typename _Key, typename _Hash, typename _Pred, typename _Alloc> inline void swap(unordered_set<_Key, _Hash, _Pred, _Alloc>& __x, unordered_set<_Key, _Hash, _Pred, _Alloc>& __y) { __x.swap(__y); } template<typename _Key, typename _Hash, typename _Pred, typename _Alloc> inline bool operator==(const unordered_set<_Key, _Hash, _Pred, _Alloc>& __x, const unordered_set<_Key, _Hash, _Pred, _Alloc>& __y) { return static_cast<const _GLIBCXX_STD_BASE&>(__x) == __y; } template<typename _Key, typename _Hash, typename _Pred, typename _Alloc> inline bool operator!=(const unordered_set<_Key, _Hash, _Pred, _Alloc>& __x, const unordered_set<_Key, _Hash, _Pred, _Alloc>& __y) { return !(__x == __y); } #undef _GLIBCXX_BASE #undef _GLIBCXX_STD_BASE #define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE #define _GLIBCXX_BASE unordered_multiset<_Value, _Hash, _Pred, _Alloc> /** @brief Unordered_multiset wrapper with performance instrumentation. */ template<typename _Value, typename _Hash = std::hash<_Value>, typename _Pred = std::equal_to<_Value>, typename _Alloc = std::allocator<_Value> > class unordered_multiset : public _GLIBCXX_STD_BASE, public _Unordered_profile<unordered_multiset<_Value, _Hash, _Pred, _Alloc>, false> { typedef _GLIBCXX_STD_BASE _Base; _Base& _M_base() noexcept { return *this; } const _Base& _M_base() const noexcept { return *this; } public: typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; typedef typename _Base::allocator_type allocator_type; typedef typename _Base::key_type key_type; typedef typename _Base::value_type value_type; typedef typename _Base::difference_type difference_type; typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef typename _Base::iterator iterator; typedef typename _Base::const_iterator const_iterator; explicit unordered_multiset(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) { } template<typename _InputIterator> unordered_multiset(_InputIterator __f, _InputIterator __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __eql, __a) { } unordered_multiset(const unordered_multiset&) = default; unordered_multiset(const _Base& __x) : _Base(__x) { } unordered_multiset(unordered_multiset&&) = default; unordered_multiset(initializer_list<value_type> __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__l, __n, __hf, __eql, __a) { } unordered_multiset& operator=(const unordered_multiset&) = default; unordered_multiset& operator=(unordered_multiset&&) = default; unordered_multiset& operator=(initializer_list<value_type> __l) { _M_base() = __l; return *this; } void swap(unordered_multiset& __x) { _Base::swap(__x); } void clear() noexcept { __profcxx_hashtable_destruct(this, _Base::bucket_count(), _Base::size()); this->_M_profile_destruct(); _Base::clear(); } template<typename... _Args> iterator emplace(_Args&&... __args) { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::emplace(std::forward<_Args>(__args)...); _M_profile_resize(__old_size); return __res; } template<typename... _Args> iterator emplace_hint(const_iterator __it, _Args&&... __args) { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::emplace_hint(__it, std::forward<_Args>(__args)...); _M_profile_resize(__old_size); return __res; } void insert(std::initializer_list<value_type> __l) { size_type __old_size = _Base::bucket_count(); _Base::insert(__l); _M_profile_resize(__old_size); } iterator insert(const value_type& __obj) { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::insert(__obj); _M_profile_resize(__old_size); return __res; } iterator insert(const_iterator __iter, const value_type& __v) { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::insert(__iter, __v); _M_profile_resize(__old_size); return __res; } iterator insert(value_type&& __obj) { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::insert(std::move(__obj)); _M_profile_resize(__old_size); return __res; } iterator insert(const_iterator __iter, value_type&& __v) { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::insert(__iter, std::move(__v)); _M_profile_resize(__old_size); return __res; } template<typename _InputIter> void insert(_InputIter __first, _InputIter __last) { size_type __old_size = _Base::bucket_count(); _Base::insert(__first, __last); _M_profile_resize(__old_size); } void rehash(size_type __n) { size_type __old_size = _Base::bucket_count(); _Base::rehash(__n); _M_profile_resize(__old_size); } private: void _M_profile_resize(size_type __old_size) { size_type __new_size = _Base::bucket_count(); if (__old_size != __new_size) __profcxx_hashtable_resize(this, __old_size, __new_size); } }; template<typename _Value, typename _Hash, typename _Pred, typename _Alloc> inline void swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) { __x.swap(__y); } template<typename _Value, typename _Hash, typename _Pred, typename _Alloc> inline bool operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) { return static_cast<const _GLIBCXX_STD_BASE&>(__x) == __y; } template<typename _Value, typename _Hash, typename _Pred, typename _Alloc> inline bool operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) { return !(__x == __y); } } // namespace __profile } // namespace std #undef _GLIBCXX_BASE #undef _GLIBCXX_STD_BASE #endif // C++11 #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/iterator_tracker.h����������������������������������������������������������������0000644�����������������00000021440�14763166027�0012757 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Profiling iterator implementation -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file profile/iterator_tracker.h * This file is a GNU profile extension to the Standard C++ Library. */ #ifndef _GLIBCXX_PROFILE_ITERATOR_TRACKER #define _GLIBCXX_PROFILE_ITERATOR_TRACKER 1 #include <ext/type_traits.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace __profile { template<typename _Iterator, typename _Sequence> class __iterator_tracker { typedef __iterator_tracker _Self; // The underlying iterator _Iterator _M_current; // The underlying data structure const _Sequence* _M_ds; typedef std::iterator_traits<_Iterator> _Traits; public: typedef _Iterator _Base_iterator; typedef typename _Traits::iterator_category iterator_category; typedef typename _Traits::value_type value_type; typedef typename _Traits::difference_type difference_type; typedef typename _Traits::reference reference; typedef typename _Traits::pointer pointer; __iterator_tracker() : _M_current(), _M_ds(0) { } __iterator_tracker(const _Iterator& __i, const _Sequence* __seq) : _M_current(__i), _M_ds(__seq) { } __iterator_tracker(const __iterator_tracker& __x) : _M_current(__x._M_current), _M_ds(__x._M_ds) { } template<typename _MutableIterator> __iterator_tracker(const __iterator_tracker<_MutableIterator, typename __gnu_cxx::__enable_if <(std::__are_same<_MutableIterator, typename _Sequence::iterator::_Base_iterator>::__value), _Sequence>::__type>& __x) : _M_current(__x.base()), _M_ds(__x._M_get_sequence()) { } _Iterator base() const { return _M_current; } /** * @brief Conversion to underlying non-debug iterator to allow * better interaction with non-profile containers. */ operator _Iterator() const { return _M_current; } pointer operator->() const { return &*_M_current; } __iterator_tracker& operator++() { _M_ds->_M_profile_iterate(); ++_M_current; return *this; } __iterator_tracker operator++(int) { _M_ds->_M_profile_iterate(); __iterator_tracker __tmp(*this); ++_M_current; return __tmp; } __iterator_tracker& operator--() { _M_ds->_M_profile_iterate(1); --_M_current; return *this; } __iterator_tracker operator--(int) { _M_ds->_M_profile_iterate(1); __iterator_tracker __tmp(*this); --_M_current; return __tmp; } __iterator_tracker& operator=(const __iterator_tracker& __x) { _M_current = __x._M_current; return *this; } reference operator*() const { return *_M_current; } // ------ Random access iterator requirements ------ reference operator[](const difference_type& __n) const { return _M_current[__n]; } __iterator_tracker& operator+=(const difference_type& __n) { _M_current += __n; return *this; } __iterator_tracker operator+(const difference_type& __n) const { __iterator_tracker __tmp(*this); __tmp += __n; return __tmp; } __iterator_tracker& operator-=(const difference_type& __n) { _M_current += -__n; return *this; } __iterator_tracker operator-(const difference_type& __n) const { __iterator_tracker __tmp(*this); __tmp -= __n; return __tmp; } void _M_find() { _M_ds->_M_profile_find(); } const _Sequence* _M_get_sequence() const { return static_cast<const _Sequence*>(_M_ds); } }; template<typename _IteratorL, typename _IteratorR, typename _Sequence> inline bool operator==(const __iterator_tracker<_IteratorL, _Sequence>& __lhs, const __iterator_tracker<_IteratorR, _Sequence>& __rhs) { return __lhs.base() == __rhs.base(); } template<typename _Iterator, typename _Sequence> inline bool operator==(const __iterator_tracker<_Iterator, _Sequence>& __lhs, const __iterator_tracker<_Iterator, _Sequence>& __rhs) { return __lhs.base() == __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Sequence> inline bool operator!=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs, const __iterator_tracker<_IteratorR, _Sequence>& __rhs) { return __lhs.base() != __rhs.base(); } template<typename _Iterator, typename _Sequence> inline bool operator!=(const __iterator_tracker<_Iterator, _Sequence>& __lhs, const __iterator_tracker<_Iterator, _Sequence>& __rhs) { return __lhs.base() != __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Sequence> inline bool operator<(const __iterator_tracker<_IteratorL, _Sequence>& __lhs, const __iterator_tracker<_IteratorR, _Sequence>& __rhs) { return __lhs.base() < __rhs.base(); } template<typename _Iterator, typename _Sequence> inline bool operator<(const __iterator_tracker<_Iterator, _Sequence>& __lhs, const __iterator_tracker<_Iterator, _Sequence>& __rhs) { return __lhs.base() < __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Sequence> inline bool operator<=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs, const __iterator_tracker<_IteratorR, _Sequence>& __rhs) { return __lhs.base() <= __rhs.base(); } template<typename _Iterator, typename _Sequence> inline bool operator<=(const __iterator_tracker<_Iterator, _Sequence>& __lhs, const __iterator_tracker<_Iterator, _Sequence>& __rhs) { return __lhs.base() <= __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Sequence> inline bool operator>(const __iterator_tracker<_IteratorL, _Sequence>& __lhs, const __iterator_tracker<_IteratorR, _Sequence>& __rhs) { return __lhs.base() > __rhs.base(); } template<typename _Iterator, typename _Sequence> inline bool operator>(const __iterator_tracker<_Iterator, _Sequence>& __lhs, const __iterator_tracker<_Iterator, _Sequence>& __rhs) { return __lhs.base() > __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Sequence> inline bool operator>=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs, const __iterator_tracker<_IteratorR, _Sequence>& __rhs) { return __lhs.base() >= __rhs.base(); } template<typename _Iterator, typename _Sequence> inline bool operator>=(const __iterator_tracker<_Iterator, _Sequence>& __lhs, const __iterator_tracker<_Iterator, _Sequence>& __rhs) { return __lhs.base() >= __rhs.base(); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // According to the resolution of DR179 not only the various comparison // operators but also operator- must accept mixed iterator/const_iterator // parameters. template<typename _IteratorL, typename _IteratorR, typename _Sequence> inline typename __iterator_tracker<_IteratorL, _Sequence>::difference_type operator-(const __iterator_tracker<_IteratorL, _Sequence>& __lhs, const __iterator_tracker<_IteratorR, _Sequence>& __rhs) { return __lhs.base() - __rhs.base(); } template<typename _Iterator, typename _Sequence> inline typename __iterator_tracker<_Iterator, _Sequence>::difference_type operator-(const __iterator_tracker<_Iterator, _Sequence>& __lhs, const __iterator_tracker<_Iterator, _Sequence>& __rhs) { return __lhs.base() - __rhs.base(); } template<typename _Iterator, typename _Sequence> inline __iterator_tracker<_Iterator, _Sequence> operator+(typename __iterator_tracker<_Iterator,_Sequence>::difference_type __n, const __iterator_tracker<_Iterator, _Sequence>& __i) { return __i + __n; } } // namespace __profile } // namespace std #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/bitset����������������������������������������������������������������������������0000644�����������������00000024222�14763166027�0010460 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Profiling bitset implementation -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file profile/bitset * This file is a GNU profile extension to the Standard C++ Library. */ #ifndef _GLIBCXX_PROFILE_BITSET #define _GLIBCXX_PROFILE_BITSET #include <bitset> namespace std _GLIBCXX_VISIBILITY(default) { namespace __profile { /// Class std::bitset wrapper with performance instrumentation. template<size_t _Nb> class bitset : public _GLIBCXX_STD_C::bitset<_Nb> { typedef _GLIBCXX_STD_C::bitset<_Nb> _Base; public: // bit reference: class reference : private _Base::reference { typedef typename _Base::reference _Base_ref; friend class bitset; reference(); reference(const _Base_ref& __base, bitset* __seq) _GLIBCXX_NOEXCEPT : _Base_ref(__base) { } public: reference(const reference& __x) _GLIBCXX_NOEXCEPT : _Base_ref(__x) { } reference& operator=(bool __x) _GLIBCXX_NOEXCEPT { *static_cast<_Base_ref*>(this) = __x; return *this; } reference& operator=(const reference& __x) _GLIBCXX_NOEXCEPT { *static_cast<_Base_ref*>(this) = __x; return *this; } bool operator~() const _GLIBCXX_NOEXCEPT { return ~(*static_cast<const _Base_ref*>(this)); } operator bool() const _GLIBCXX_NOEXCEPT { return *static_cast<const _Base_ref*>(this); } reference& flip() _GLIBCXX_NOEXCEPT { _Base_ref::flip(); return *this; } }; // 23.3.5.1 constructors: _GLIBCXX_CONSTEXPR bitset() _GLIBCXX_NOEXCEPT : _Base() { } #if __cplusplus >= 201103L constexpr bitset(unsigned long long __val) noexcept #else bitset(unsigned long __val) #endif : _Base(__val) { } template<typename _CharT, typename _Traits, typename _Alloc> explicit bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __str, typename std::basic_string<_CharT, _Traits, _Alloc>::size_type __pos = 0, typename std::basic_string<_CharT, _Traits, _Alloc>::size_type __n = (std::basic_string<_CharT, _Traits, _Alloc>::npos)) : _Base(__str, __pos, __n) { } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 396. what are characters zero and one. template<class _CharT, class _Traits, class _Alloc> bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __str, typename std::basic_string<_CharT, _Traits, _Alloc>::size_type __pos, typename std::basic_string<_CharT, _Traits, _Alloc>::size_type __n, _CharT __zero, _CharT __one = _CharT('1')) : _Base(__str, __pos, __n, __zero, __one) { } bitset(const _Base& __x) : _Base(__x) { } #if __cplusplus >= 201103L template<typename _CharT> explicit bitset(const _CharT* __str, typename std::basic_string<_CharT>::size_type __n = std::basic_string<_CharT>::npos, _CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) : _Base(__str, __n, __zero, __one) { } #endif // 23.3.5.2 bitset operations: bitset<_Nb>& operator&=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT { _M_base() &= __rhs; return *this; } bitset<_Nb>& operator|=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT { _M_base() |= __rhs; return *this; } bitset<_Nb>& operator^=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT { _M_base() ^= __rhs; return *this; } bitset<_Nb>& operator<<=(size_t __pos) _GLIBCXX_NOEXCEPT { _M_base() <<= __pos; return *this; } bitset<_Nb>& operator>>=(size_t __pos) _GLIBCXX_NOEXCEPT { _M_base() >>= __pos; return *this; } bitset<_Nb>& set() _GLIBCXX_NOEXCEPT { _Base::set(); return *this; } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 186. bitset::set() second parameter should be bool bitset<_Nb>& set(size_t __pos, bool __val = true) { _Base::set(__pos, __val); return *this; } bitset<_Nb>& reset() _GLIBCXX_NOEXCEPT { _Base::reset(); return *this; } bitset<_Nb>& reset(size_t __pos) { _Base::reset(__pos); return *this; } bitset<_Nb> operator~() const _GLIBCXX_NOEXCEPT { return bitset(~_M_base()); } bitset<_Nb>& flip() _GLIBCXX_NOEXCEPT { _Base::flip(); return *this; } bitset<_Nb>& flip(size_t __pos) { _Base::flip(__pos); return *this; } // element access: // _GLIBCXX_RESOLVE_LIB_DEFECTS // 11. Bitset minor problems reference operator[](size_t __pos) { return reference(_M_base()[__pos], this); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 11. Bitset minor problems _GLIBCXX_CONSTEXPR bool operator[](size_t __pos) const { return _Base::operator[](__pos); } using _Base::to_ulong; #if __cplusplus >= 201103L using _Base::to_ullong; #endif template <typename _CharT, typename _Traits, typename _Alloc> std::basic_string<_CharT, _Traits, _Alloc> to_string() const { return _M_base().template to_string<_CharT, _Traits, _Alloc>(); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 396. what are characters zero and one. template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> to_string(_CharT __zero, _CharT __one = _CharT('1')) const { return _M_base().template to_string<_CharT, _Traits, _Alloc>(__zero, __one); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 434. bitset::to_string() hard to use. template<typename _CharT, typename _Traits> std::basic_string<_CharT, _Traits, std::allocator<_CharT> > to_string() const { return to_string<_CharT, _Traits, std::allocator<_CharT> >(); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 853. to_string needs updating with zero and one. template<class _CharT, class _Traits> std::basic_string<_CharT, _Traits, std::allocator<_CharT> > to_string(_CharT __zero, _CharT __one = _CharT('1')) const { return to_string<_CharT, _Traits, std::allocator<_CharT> >(__zero, __one); } template<typename _CharT> std::basic_string<_CharT, std::char_traits<_CharT>, std::allocator<_CharT> > to_string() const { return to_string<_CharT, std::char_traits<_CharT>, std::allocator<_CharT> >(); } template<class _CharT> std::basic_string<_CharT, std::char_traits<_CharT>, std::allocator<_CharT> > to_string(_CharT __zero, _CharT __one = _CharT('1')) const { return to_string<_CharT, std::char_traits<_CharT>, std::allocator<_CharT> >(__zero, __one); } std::basic_string<char, std::char_traits<char>, std::allocator<char> > to_string() const { return to_string<char,std::char_traits<char>,std::allocator<char> >(); } std::basic_string<char, std::char_traits<char>, std::allocator<char> > to_string(char __zero, char __one = '1') const { return to_string<char, std::char_traits<char>, std::allocator<char> >(__zero, __one); } using _Base::count; using _Base::size; bool operator==(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT { return _M_base() == __rhs; } bool operator!=(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT { return _M_base() != __rhs; } using _Base::test; using _Base::all; using _Base::any; using _Base::none; bitset<_Nb> operator<<(size_t __pos) const _GLIBCXX_NOEXCEPT { return bitset<_Nb>(_M_base() << __pos); } bitset<_Nb> operator>>(size_t __pos) const _GLIBCXX_NOEXCEPT { return bitset<_Nb>(_M_base() >> __pos); } _Base& _M_base() _GLIBCXX_NOEXCEPT { return *this; } const _Base& _M_base() const _GLIBCXX_NOEXCEPT { return *this; } }; template<size_t _Nb> bitset<_Nb> operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT { return bitset<_Nb>(__x) &= __y; } template<size_t _Nb> bitset<_Nb> operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT { return bitset<_Nb>(__x) |= __y; } template<size_t _Nb> bitset<_Nb> operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT { return bitset<_Nb>(__x) ^= __y; } template<typename _CharT, typename _Traits, size_t _Nb> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) { return __is >> __x._M_base(); } template<typename _CharT, typename _Traits, size_t _Nb> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const bitset<_Nb>& __x) { return __os << __x._M_base(); } } // namespace __profile #if __cplusplus >= 201103L // DR 1182. /// std::hash specialization for bitset. template<size_t _Nb> struct hash<__profile::bitset<_Nb>> : public __hash_base<size_t, __profile::bitset<_Nb>> { size_t operator()(const __profile::bitset<_Nb>& __b) const noexcept { return std::hash<_GLIBCXX_STD_C::bitset<_Nb>>()(__b._M_base()); } }; #endif } // namespace std #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/map.h�����������������������������������������������������������������������������0000644�����������������00000037554�14763166027�0010205 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Profiling map implementation -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/map.h * This file is a GNU profile extension to the Standard C++ Library. */ #ifndef _GLIBCXX_PROFILE_MAP_H #define _GLIBCXX_PROFILE_MAP_H 1 #include <utility> #include <profile/base.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace __profile { /// Class std::map wrapper with performance instrumentation. template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>, typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > > class map : public _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator> { typedef _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator> _Base; public: // types: typedef _Key key_type; typedef _Tp mapped_type; typedef std::pair<const _Key, _Tp> value_type; typedef _Compare key_compare; typedef _Allocator allocator_type; typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef typename _Base::iterator iterator; typedef typename _Base::const_iterator const_iterator; typedef typename _Base::size_type size_type; typedef typename _Base::difference_type difference_type; typedef typename _Base::pointer pointer; typedef typename _Base::const_pointer const_pointer; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // 23.3.1.1 construct/copy/destroy: explicit map(const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) : _Base(__comp, __a) { __profcxx_map_to_unordered_map_construct(this); } #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<typename _InputIterator> #endif map(_InputIterator __first, _InputIterator __last, const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) : _Base(__first, __last, __comp, __a) { __profcxx_map_to_unordered_map_construct(this); } map(const map& __x) : _Base(__x) { __profcxx_map_to_unordered_map_construct(this); } map(const _Base& __x) : _Base(__x) { __profcxx_map_to_unordered_map_construct(this); } #if __cplusplus >= 201103L map(map&& __x) noexcept(is_nothrow_copy_constructible<_Compare>::value) : _Base(std::move(__x)) { } map(initializer_list<value_type> __l, const _Compare& __c = _Compare(), const allocator_type& __a = allocator_type()) : _Base(__l, __c, __a) { } #endif ~map() _GLIBCXX_NOEXCEPT { __profcxx_map_to_unordered_map_destruct(this); } map& operator=(const map& __x) { *static_cast<_Base*>(this) = __x; return *this; } #if __cplusplus >= 201103L map& operator=(map&& __x) { // NB: DR 1204. // NB: DR 675. this->clear(); this->swap(__x); return *this; } map& operator=(initializer_list<value_type> __l) { this->clear(); this->insert(__l); return *this; } #endif // _GLIBCXX_RESOLVE_LIB_DEFECTS // 133. map missing get_allocator() using _Base::get_allocator; // iterators: iterator begin() _GLIBCXX_NOEXCEPT { return _Base::begin(); } const_iterator begin() const _GLIBCXX_NOEXCEPT { return _Base::begin(); } iterator end() _GLIBCXX_NOEXCEPT { return _Base::end(); } const_iterator end() const _GLIBCXX_NOEXCEPT { return _Base::end(); } reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { __profcxx_map_to_unordered_map_invalidate(this); return reverse_iterator(end()); } const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { __profcxx_map_to_unordered_map_invalidate(this); return const_reverse_iterator(end()); } reverse_iterator rend() _GLIBCXX_NOEXCEPT { __profcxx_map_to_unordered_map_invalidate(this); return reverse_iterator(begin()); } const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { __profcxx_map_to_unordered_map_invalidate(this); return const_reverse_iterator(begin()); } #if __cplusplus >= 201103L const_iterator cbegin() const noexcept { return const_iterator(_Base::begin()); } const_iterator cend() const noexcept { return const_iterator(_Base::end()); } const_reverse_iterator crbegin() const noexcept { __profcxx_map_to_unordered_map_invalidate(this); return const_reverse_iterator(end()); } const_reverse_iterator crend() const noexcept { __profcxx_map_to_unordered_map_invalidate(this); return const_reverse_iterator(begin()); } #endif // capacity: using _Base::empty; using _Base::size; using _Base::max_size; // 23.3.1.2 element access: mapped_type& operator[](const key_type& __k) { __profcxx_map_to_unordered_map_find(this, size()); return _Base::operator[](__k); } #if __cplusplus >= 201103L mapped_type& operator[](key_type&& __k) { __profcxx_map_to_unordered_map_find(this, size()); return _Base::operator[](std::move(__k)); } #endif mapped_type& at(const key_type& __k) { __profcxx_map_to_unordered_map_find(this, size()); return _Base::at(__k); } const mapped_type& at(const key_type& __k) const { __profcxx_map_to_unordered_map_find(this, size()); return _Base::at(__k); } // modifiers: #if __cplusplus >= 201103L template<typename... _Args> std::pair<iterator, bool> emplace(_Args&&... __args) { __profcxx_map_to_unordered_map_insert(this, size(), 1); auto __res = _Base::emplace(std::forward<_Args>(__args)...); return std::pair<iterator, bool>(iterator(__res.first), __res.second); } template<typename... _Args> iterator emplace_hint(const_iterator __pos, _Args&&... __args) { size_type size_before = size(); auto __res = _Base::emplace_hint(__pos, std::forward<_Args>(__args)...); __profcxx_map_to_unordered_map_insert(this, size_before, size() - size_before); return __res; } #endif std::pair<iterator, bool> insert(const value_type& __x) { __profcxx_map_to_unordered_map_insert(this, size(), 1); typedef typename _Base::iterator _Base_iterator; std::pair<_Base_iterator, bool> __res = _Base::insert(__x); return std::pair<iterator, bool>(iterator(__res.first), __res.second); } #if __cplusplus >= 201103L template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> std::pair<iterator, bool> insert(_Pair&& __x) { __profcxx_map_to_unordered_map_insert(this, size(), 1); typedef typename _Base::iterator _Base_iterator; std::pair<_Base_iterator, bool> __res = _Base::insert(std::forward<_Pair>(__x)); return std::pair<iterator, bool>(iterator(__res.first), __res.second); } #endif #if __cplusplus >= 201103L void insert(std::initializer_list<value_type> __list) { size_type size_before = size(); _Base::insert(__list); __profcxx_map_to_unordered_map_insert(this, size_before, size() - size_before); } #endif iterator #if __cplusplus >= 201103L insert(const_iterator __position, const value_type& __x) #else insert(iterator __position, const value_type& __x) #endif { size_type size_before = size(); iterator __i = iterator(_Base::insert(__position, __x)); __profcxx_map_to_unordered_map_insert(this, size_before, size() - size_before); return __i; } #if __cplusplus >= 201103L template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> iterator insert(const_iterator __position, _Pair&& __x) { size_type size_before = size(); iterator __i = iterator(_Base::insert(__position, std::forward<_Pair>(__x))); __profcxx_map_to_unordered_map_insert(this, size_before, size() - size_before); return __i; } #endif #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<typename _InputIterator> #endif void insert(_InputIterator __first, _InputIterator __last) { size_type size_before = size(); _Base::insert(__first, __last); __profcxx_map_to_unordered_map_insert(this, size_before, size() - size_before); } #if __cplusplus >= 201103L iterator erase(const_iterator __position) { iterator __i = _Base::erase(__position); __profcxx_map_to_unordered_map_erase(this, size(), 1); return __i; } iterator erase(iterator __position) { return erase(const_iterator(__position)); } #else void erase(iterator __position) { _Base::erase(__position); __profcxx_map_to_unordered_map_erase(this, size(), 1); } #endif size_type erase(const key_type& __x) { iterator __victim = find(__x); if (__victim == end()) return 0; else { _Base::erase(__victim); return 1; } } #if __cplusplus >= 201103L iterator erase(const_iterator __first, const_iterator __last) { return iterator(_Base::erase(__first, __last)); } #else void erase(iterator __first, iterator __last) { _Base::erase(__first, __last); } #endif void swap(map& __x) { _Base::swap(__x); } void clear() _GLIBCXX_NOEXCEPT { this->erase(begin(), end()); } // observers: using _Base::key_comp; using _Base::value_comp; // 23.3.1.3 map operations: iterator find(const key_type& __x) { __profcxx_map_to_unordered_map_find(this, size()); return iterator(_Base::find(__x)); } const_iterator find(const key_type& __x) const { __profcxx_map_to_unordered_map_find(this, size()); return const_iterator(_Base::find(__x)); } size_type count(const key_type& __x) const { __profcxx_map_to_unordered_map_find(this, size()); return _Base::count(__x); } iterator lower_bound(const key_type& __x) { __profcxx_map_to_unordered_map_invalidate(this); return iterator(_Base::lower_bound(__x)); } const_iterator lower_bound(const key_type& __x) const { __profcxx_map_to_unordered_map_invalidate(this); return const_iterator(_Base::lower_bound(__x)); } iterator upper_bound(const key_type& __x) { __profcxx_map_to_unordered_map_invalidate(this); return iterator(_Base::upper_bound(__x)); } const_iterator upper_bound(const key_type& __x) const { __profcxx_map_to_unordered_map_invalidate(this); return const_iterator(_Base::upper_bound(__x)); } std::pair<iterator,iterator> equal_range(const key_type& __x) { typedef typename _Base::iterator _Base_iterator; std::pair<_Base_iterator, _Base_iterator> __res = _Base::equal_range(__x); return std::make_pair(iterator(__res.first), iterator(__res.second)); } std::pair<const_iterator,const_iterator> equal_range(const key_type& __x) const { __profcxx_map_to_unordered_map_find(this, size()); typedef typename _Base::const_iterator _Base_const_iterator; std::pair<_Base_const_iterator, _Base_const_iterator> __res = _Base::equal_range(__x); return std::make_pair(const_iterator(__res.first), const_iterator(__res.second)); } _Base& _M_base() _GLIBCXX_NOEXCEPT { return *this; } const _Base& _M_base() const _GLIBCXX_NOEXCEPT { return *this; } }; template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator==(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, const map<_Key, _Tp, _Compare, _Allocator>& __rhs) { __profcxx_map_to_unordered_map_invalidate(&__lhs); __profcxx_map_to_unordered_map_invalidate(&__rhs); return __lhs._M_base() == __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, const map<_Key, _Tp, _Compare, _Allocator>& __rhs) { __profcxx_map_to_unordered_map_invalidate(&__lhs); __profcxx_map_to_unordered_map_invalidate(&__rhs); return __lhs._M_base() != __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator<(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, const map<_Key, _Tp, _Compare, _Allocator>& __rhs) { __profcxx_map_to_unordered_map_invalidate(&__lhs); __profcxx_map_to_unordered_map_invalidate(&__rhs); return __lhs._M_base() < __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, const map<_Key, _Tp, _Compare, _Allocator>& __rhs) { __profcxx_map_to_unordered_map_invalidate(&__lhs); __profcxx_map_to_unordered_map_invalidate(&__rhs); return __lhs._M_base() <= __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, const map<_Key, _Tp, _Compare, _Allocator>& __rhs) { __profcxx_map_to_unordered_map_invalidate(&__lhs); __profcxx_map_to_unordered_map_invalidate(&__rhs); return __lhs._M_base() >= __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator>(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, const map<_Key, _Tp, _Compare, _Allocator>& __rhs) { __profcxx_map_to_unordered_map_invalidate(&__lhs); __profcxx_map_to_unordered_map_invalidate(&__rhs); return __lhs._M_base() > __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline void swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs, map<_Key, _Tp, _Compare, _Allocator>& __rhs) { __lhs.swap(__rhs); } } // namespace __profile } // namespace std #endif ����������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/map�������������������������������������������������������������������������������0000644�����������������00000002336�14763166027�0007745 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Profiling map/multimap implementation -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. /** @file profile/map * This file is a GNU profile extension to the Standard C++ Library. */ #ifndef _GLIBCXX_PROFILE_MAP #define _GLIBCXX_PROFILE_MAP 1 #include <map> #include <profile/map.h> #include <profile/multimap.h> #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/multimap.h������������������������������������������������������������������������0000644�����������������00000027564�14763166027�0011260 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Profiling multimap implementation -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file profile/multimap.h * This file is a GNU profile extension to the Standard C++ Library. */ #ifndef _GLIBCXX_PROFILE_MULTIMAP_H #define _GLIBCXX_PROFILE_MULTIMAP_H 1 #include <utility> namespace std _GLIBCXX_VISIBILITY(default) { namespace __profile { /// Class std::multimap wrapper with performance instrumentation. template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>, typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > > class multimap : public _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator> { typedef _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator> _Base; public: // types: typedef _Key key_type; typedef _Tp mapped_type; typedef std::pair<const _Key, _Tp> value_type; typedef _Compare key_compare; typedef _Allocator allocator_type; typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef typename _Base::iterator iterator; typedef typename _Base::const_iterator const_iterator; typedef typename _Base::reverse_iterator reverse_iterator; typedef typename _Base::const_reverse_iterator const_reverse_iterator; typedef typename _Base::size_type size_type; typedef typename _Base::difference_type difference_type; typedef typename _Base::pointer pointer; typedef typename _Base::const_pointer const_pointer; // 23.3.1.1 construct/copy/destroy: explicit multimap(const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) : _Base(__comp, __a) { } #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<typename _InputIterator> #endif multimap(_InputIterator __first, _InputIterator __last, const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) : _Base(__first, __last, __comp, __a) { } multimap(const multimap& __x) : _Base(__x) { } multimap(const _Base& __x) : _Base(__x) { } #if __cplusplus >= 201103L multimap(multimap&& __x) noexcept(is_nothrow_copy_constructible<_Compare>::value) : _Base(std::move(__x)) { } multimap(initializer_list<value_type> __l, const _Compare& __c = _Compare(), const allocator_type& __a = allocator_type()) : _Base(__l, __c, __a) { } #endif ~multimap() _GLIBCXX_NOEXCEPT { } multimap& operator=(const multimap& __x) { *static_cast<_Base*>(this) = __x; return *this; } #if __cplusplus >= 201103L multimap& operator=(multimap&& __x) { // NB: DR 1204. // NB: DR 675. this->clear(); this->swap(__x); return *this; } multimap& operator=(initializer_list<value_type> __l) { this->clear(); this->insert(__l); return *this; } #endif using _Base::get_allocator; // iterators: iterator begin() _GLIBCXX_NOEXCEPT { return iterator(_Base::begin()); } const_iterator begin() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::begin()); } iterator end() _GLIBCXX_NOEXCEPT { return iterator(_Base::end()); } const_iterator end() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::end()); } reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(end()); } const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(end()); } reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(begin()); } const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(begin()); } #if __cplusplus >= 201103L const_iterator cbegin() const noexcept { return const_iterator(_Base::begin()); } const_iterator cend() const noexcept { return const_iterator(_Base::end()); } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } #endif // capacity: using _Base::empty; using _Base::size; using _Base::max_size; // modifiers: #if __cplusplus >= 201103L template<typename... _Args> iterator emplace(_Args&&... __args) { return iterator(_Base::emplace(std::forward<_Args>(__args)...)); } template<typename... _Args> iterator emplace_hint(const_iterator __pos, _Args&&... __args) { return iterator(_Base::emplace_hint(__pos, std::forward<_Args>(__args)...)); } #endif iterator insert(const value_type& __x) { return iterator(_Base::insert(__x)); } #if __cplusplus >= 201103L template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> iterator insert(_Pair&& __x) { return iterator(_Base::insert(std::forward<_Pair>(__x))); } #endif #if __cplusplus >= 201103L void insert(std::initializer_list<value_type> __list) { _Base::insert(__list); } #endif iterator #if __cplusplus >= 201103L insert(const_iterator __position, const value_type& __x) #else insert(iterator __position, const value_type& __x) #endif { return iterator(_Base::insert(__position, __x)); } #if __cplusplus >= 201103L template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> iterator insert(const_iterator __position, _Pair&& __x) { return iterator(_Base::insert(__position, std::forward<_Pair>(__x))); } #endif #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<typename _InputIterator> #endif void insert(_InputIterator __first, _InputIterator __last) { _Base::insert(__first, __last); } #if __cplusplus >= 201103L iterator erase(const_iterator __position) { return iterator(_Base::erase(__position)); } iterator erase(iterator __position) { return iterator(_Base::erase(__position)); } #else void erase(iterator __position) { _Base::erase(__position); } #endif size_type erase(const key_type& __x) { std::pair<iterator, iterator> __victims = this->equal_range(__x); size_type __count = 0; while (__victims.first != __victims.second) { iterator __victim = __victims.first++; _Base::erase(__victim); ++__count; } return __count; } #if __cplusplus >= 201103L iterator erase(const_iterator __first, const_iterator __last) { return iterator(_Base::erase(__first, __last)); } #else void erase(iterator __first, iterator __last) { _Base::erase(__first, __last); } #endif void swap(multimap& __x) { _Base::swap(__x); } void clear() _GLIBCXX_NOEXCEPT { this->erase(begin(), end()); } // observers: using _Base::key_comp; using _Base::value_comp; // 23.3.1.3 multimap operations: iterator find(const key_type& __x) { return iterator(_Base::find(__x)); } const_iterator find(const key_type& __x) const { return const_iterator(_Base::find(__x)); } using _Base::count; iterator lower_bound(const key_type& __x) { return iterator(_Base::lower_bound(__x)); } const_iterator lower_bound(const key_type& __x) const { return const_iterator(_Base::lower_bound(__x)); } iterator upper_bound(const key_type& __x) { return iterator(_Base::upper_bound(__x)); } const_iterator upper_bound(const key_type& __x) const { return const_iterator(_Base::upper_bound(__x)); } std::pair<iterator,iterator> equal_range(const key_type& __x) { typedef typename _Base::iterator _Base_iterator; std::pair<_Base_iterator, _Base_iterator> __res = _Base::equal_range(__x); return std::make_pair(iterator(__res.first), iterator(__res.second)); } std::pair<const_iterator,const_iterator> equal_range(const key_type& __x) const { typedef typename _Base::const_iterator _Base_const_iterator; std::pair<_Base_const_iterator, _Base_const_iterator> __res = _Base::equal_range(__x); return std::make_pair(const_iterator(__res.first), const_iterator(__res.second)); } _Base& _M_base() _GLIBCXX_NOEXCEPT { return *this; } const _Base& _M_base() const _GLIBCXX_NOEXCEPT { return *this; } }; template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) { return __lhs._M_base() == __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) { return __lhs._M_base() != __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) { return __lhs._M_base() < __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) { return __lhs._M_base() <= __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) { return __lhs._M_base() >= __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) { return __lhs._M_base() > __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline void swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) { __lhs.swap(__rhs); } } // namespace __profile } // namespace std #endif ��������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/array�����������������������������������������������������������������������������0000644�����������������00000017617�14763166027�0010316 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Profile array implementation -*- C++ -*- // Copyright (C) 2012-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file profile/array * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_PROFILE_ARRAY #define _GLIBCXX_PROFILE_ARRAY 1 #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { namespace __profile { template<typename _Tp, std::size_t _Nm> struct array { typedef _Tp value_type; typedef value_type* pointer; typedef const value_type* const_pointer; typedef value_type& reference; typedef const value_type& const_reference; typedef value_type* iterator; typedef const value_type* const_iterator; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // Support for zero-sized arrays mandatory. typedef _GLIBCXX_STD_C::__array_traits<_Tp, _Nm> _AT_Type; typename _AT_Type::_Type _M_elems; // No explicit construct/copy/destroy for aggregate type. // DR 776. void fill(const value_type& __u) { std::fill_n(begin(), size(), __u); } void swap(array& __other) noexcept(noexcept(swap(std::declval<_Tp&>(), std::declval<_Tp&>()))) { std::swap_ranges(begin(), end(), __other.begin()); } // Iterators. iterator begin() noexcept { return iterator(data()); } const_iterator begin() const noexcept { return const_iterator(data()); } iterator end() noexcept { return iterator(data() + _Nm); } const_iterator end() const noexcept { return const_iterator(data() + _Nm); } reverse_iterator rbegin() noexcept { return reverse_iterator(end()); } const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } reverse_iterator rend() noexcept { return reverse_iterator(begin()); } const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } const_iterator cbegin() const noexcept { return const_iterator(data()); } const_iterator cend() const noexcept { return const_iterator(data() + _Nm); } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } // Capacity. constexpr size_type size() const noexcept { return _Nm; } constexpr size_type max_size() const noexcept { return _Nm; } constexpr bool empty() const noexcept { return size() == 0; } // Element access. reference operator[](size_type __n) { return _AT_Type::_S_ref(_M_elems, __n); } constexpr const_reference operator[](size_type __n) const noexcept { return _AT_Type::_S_ref(_M_elems, __n); } reference at(size_type __n) { if (__n >= _Nm) std::__throw_out_of_range(__N("array::at")); return _AT_Type::_S_ref(_M_elems, __n); } constexpr const_reference at(size_type __n) const { // Result of conditional expression must be an lvalue so use // boolean ? lvalue : (throw-expr, lvalue) return __n < _Nm ? _AT_Type::_S_ref(_M_elems, __n) : (std::__throw_out_of_range(__N("array::at")), _AT_Type::_S_ref(_M_elems, 0)); } reference front() { return *begin(); } constexpr const_reference front() const { return _AT_Type::_S_ref(_M_elems, 0); } reference back() { return _Nm ? *(end() - 1) : *end(); } constexpr const_reference back() const { return _Nm ? _AT_Type::_S_ref(_M_elems, _Nm - 1) : _AT_Type::_S_ref(_M_elems, 0); } pointer data() noexcept { return std::__addressof(_AT_Type::_S_ref(_M_elems, 0)); } const_pointer data() const noexcept { return std::__addressof(_AT_Type::_S_ref(_M_elems, 0)); } }; // Array comparisons. template<typename _Tp, std::size_t _Nm> inline bool operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return std::equal(__one.begin(), __one.end(), __two.begin()); } template<typename _Tp, std::size_t _Nm> inline bool operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return !(__one == __two); } template<typename _Tp, std::size_t _Nm> inline bool operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b) { return std::lexicographical_compare(__a.begin(), __a.end(), __b.begin(), __b.end()); } template<typename _Tp, std::size_t _Nm> inline bool operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return __two < __one; } template<typename _Tp, std::size_t _Nm> inline bool operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return !(__one > __two); } template<typename _Tp, std::size_t _Nm> inline bool operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return !(__one < __two); } // Specialized algorithms. template<typename _Tp, std::size_t _Nm> inline void swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two) noexcept(noexcept(__one.swap(__two))) { __one.swap(__two); } template<std::size_t _Int, typename _Tp, std::size_t _Nm> constexpr _Tp& get(array<_Tp, _Nm>& __arr) noexcept { static_assert(_Int < _Nm, "index is out of bounds"); return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>:: _S_ref(__arr._M_elems, _Int); } template<std::size_t _Int, typename _Tp, std::size_t _Nm> constexpr _Tp&& get(array<_Tp, _Nm>&& __arr) noexcept { static_assert(_Int < _Nm, "index is out of bounds"); return std::move(get<_Int>(__arr)); } template<std::size_t _Int, typename _Tp, std::size_t _Nm> constexpr const _Tp& get(const array<_Tp, _Nm>& __arr) noexcept { static_assert(_Int < _Nm, "index is out of bounds"); return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>:: _S_ref(__arr._M_elems, _Int); } } // namespace __profile // Tuple interface to class template array. /// tuple_size template<typename _Tp, std::size_t _Nm> struct tuple_size<__profile::array<_Tp, _Nm>> : public integral_constant<std::size_t, _Nm> { }; /// tuple_element template<std::size_t _Int, typename _Tp, std::size_t _Nm> struct tuple_element<_Int, __profile::array<_Tp, _Nm>> { static_assert(_Int < _Nm, "index is out of bounds"); typedef _Tp type; }; } // namespace std #endif // _GLIBCXX_PROFILE_ARRAY �����������������������������������������������������������������������������������������������������������������c++/4.8.2/profile/list������������������������������������������������������������������������������0000644�����������������00000040551�14763166027�0010144 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Profiling list implementation -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file profile/list * This file is a GNU profile extension to the Standard C++ Library. */ #ifndef _GLIBCXX_PROFILE_LIST #define _GLIBCXX_PROFILE_LIST 1 #include <list> #include <profile/base.h> #include <profile/iterator_tracker.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace __profile { /** @brief List wrapper with performance instrumentation. */ template<typename _Tp, typename _Allocator = std::allocator<_Tp> > class list : public _GLIBCXX_STD_C::list<_Tp, _Allocator> { typedef _GLIBCXX_STD_C::list<_Tp, _Allocator> _Base; public: typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef __iterator_tracker<typename _Base::iterator, list> iterator; typedef __iterator_tracker<typename _Base::const_iterator, list> const_iterator; typedef typename _Base::size_type size_type; typedef typename _Base::difference_type difference_type; typedef _Tp value_type; typedef _Allocator allocator_type; typedef typename _Base::pointer pointer; typedef typename _Base::const_pointer const_pointer; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // 23.2.2.1 construct/copy/destroy: explicit list(const _Allocator& __a = _Allocator()) : _Base(__a) { __profcxx_list_construct(this); // list2slist __profcxx_list_construct2(this); // list2vector } #if __cplusplus >= 201103L explicit list(size_type __n) : _Base(__n) { __profcxx_list_construct(this); __profcxx_list_construct2(this); } list(size_type __n, const _Tp& __value, const _Allocator& __a = _Allocator()) : _Base(__n, __value, __a) { __profcxx_list_construct(this); __profcxx_list_construct2(this); } #else explicit list(size_type __n, const _Tp& __value = _Tp(), const _Allocator& __a = _Allocator()) : _Base(__n, __value, __a) { __profcxx_list_construct(this); __profcxx_list_construct2(this); } #endif #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<class _InputIterator> #endif list(_InputIterator __first, _InputIterator __last, const _Allocator& __a = _Allocator()) : _Base(__first, __last, __a) { __profcxx_list_construct(this); __profcxx_list_construct2(this); } list(const list& __x) : _Base(__x) { __profcxx_list_construct(this); __profcxx_list_construct2(this); } list(const _Base& __x) : _Base(__x) { __profcxx_list_construct(this); __profcxx_list_construct2(this); } #if __cplusplus >= 201103L list(list&& __x) noexcept : _Base(std::move(__x)) { __profcxx_list_construct(this); __profcxx_list_construct2(this); } list(initializer_list<value_type> __l, const allocator_type& __a = allocator_type()) : _Base(__l, __a) { } #endif ~list() _GLIBCXX_NOEXCEPT { __profcxx_list_destruct(this); __profcxx_list_destruct2(this); } list& operator=(const list& __x) { static_cast<_Base&>(*this) = __x; return *this; } #if __cplusplus >= 201103L list& operator=(list&& __x) { // NB: DR 1204. // NB: DR 675. this->clear(); this->swap(__x); return *this; } list& operator=(initializer_list<value_type> __l) { static_cast<_Base&>(*this) = __l; return *this; } void assign(initializer_list<value_type> __l) { _Base::assign(__l); } #endif #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<class _InputIterator> #endif void assign(_InputIterator __first, _InputIterator __last) { _Base::assign(__first, __last); } void assign(size_type __n, const _Tp& __t) { _Base::assign(__n, __t); } using _Base::get_allocator; // iterators: iterator begin() _GLIBCXX_NOEXCEPT { return iterator(_Base::begin(), this); } const_iterator begin() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::begin(), this); } iterator end() _GLIBCXX_NOEXCEPT { __profcxx_list_rewind(this); return iterator(_Base::end(), this); } const_iterator end() const _GLIBCXX_NOEXCEPT { __profcxx_list_rewind(this); return const_iterator(_Base::end(), this); } reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { __profcxx_list_rewind(this); return reverse_iterator(end()); } const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { __profcxx_list_rewind(this); return const_reverse_iterator(end()); } reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(begin()); } const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(begin()); } #if __cplusplus >= 201103L const_iterator cbegin() const noexcept { return const_iterator(_Base::begin(), this); } const_iterator cend() const noexcept { return const_iterator(_Base::end(), this); } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } #endif // 23.2.2.2 capacity: using _Base::empty; using _Base::size; using _Base::max_size; #if __cplusplus >= 201103L void resize(size_type __sz) { _Base::resize(__sz); } void resize(size_type __sz, const _Tp& __c) { _Base::resize(__sz, __c); } #else void resize(size_type __sz, _Tp __c = _Tp()) { _Base::resize(__sz, __c); } #endif // element access: reference front() { return _Base::front(); } const_reference front() const { return _Base::front(); } reference back() { __profcxx_list_rewind(this); return _Base::back(); } const_reference back() const { __profcxx_list_rewind(this); return _Base::back(); } // 23.2.2.3 modifiers: void push_front(const value_type& __x) { __profcxx_list_invalid_operator(this); __profcxx_list_operation(this); _Base::push_front(__x); } #if __cplusplus >= 201103L using _Base::emplace_front; #endif void pop_front() { __profcxx_list_operation(this); _Base::pop_front(); } using _Base::push_back; #if __cplusplus >= 201103L using _Base::emplace_back; #endif void pop_back() { iterator __victim = end(); --__victim; _Base::pop_back(); __profcxx_list_rewind(this); } #if __cplusplus >= 201103L template<typename... _Args> iterator emplace(iterator __position, _Args&&... __args) { return iterator(_Base::emplace(__position.base(), std::forward<_Args>(__args)...), this); } #endif iterator insert(iterator __position, const _Tp& __x) { _M_profile_insert(this, __position, size()); return iterator(_Base::insert(__position.base(), __x), this); } #if __cplusplus >= 201103L iterator insert(iterator __position, _Tp&& __x) { _M_profile_insert(this, __position, size()); return iterator(_Base::emplace(__position.base(), std::move(__x)), this); } void insert(iterator __position, initializer_list<value_type> __l) { _M_profile_insert(this, __position, size()); _Base::insert(__position.base(), __l); } #endif void insert(iterator __position, size_type __n, const _Tp& __x) { _M_profile_insert(this, __position, size()); _Base::insert(__position.base(), __n, __x); } #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<class _InputIterator> #endif void insert(iterator __position, _InputIterator __first, _InputIterator __last) { _M_profile_insert(this, __position, size()); _Base::insert(__position.base(), __first, __last); } iterator erase(iterator __position) { return iterator(_Base::erase(__position.base()), this); } iterator erase(iterator __position, iterator __last) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container return iterator(_Base::erase(__position.base(), __last.base()), this); } void swap(list& __x) { _Base::swap(__x); } void clear() _GLIBCXX_NOEXCEPT { _Base::clear(); } // 23.2.2.4 list operations: void #if __cplusplus >= 201103L splice(iterator __position, list&& __x) #else splice(iterator __position, list& __x) #endif { this->splice(__position, _GLIBCXX_MOVE(__x), __x.begin(), __x.end()); } #if __cplusplus >= 201103L void splice(iterator __position, list& __x) { this->splice(__position, std::move(__x)); } #endif #if __cplusplus >= 201103L void splice(iterator __position, list& __x, iterator __i) { this->splice(__position, std::move(__x), __i); } #endif void #if __cplusplus >= 201103L splice(iterator __position, list&& __x, iterator __i) #else splice(iterator __position, list& __x, iterator __i) #endif { // We used to perform the splice_alloc check: not anymore, redundant // after implementing the relevant bits of N1599. // _GLIBCXX_RESOLVE_LIB_DEFECTS _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()), __i.base()); } void #if __cplusplus >= 201103L splice(iterator __position, list&& __x, iterator __first, iterator __last) #else splice(iterator __position, list& __x, iterator __first, iterator __last) #endif { // We used to perform the splice_alloc check: not anymore, redundant // after implementing the relevant bits of N1599. _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()), __first.base(), __last.base()); } #if __cplusplus >= 201103L void splice(iterator __position, list& __x, iterator __first, iterator __last) { this->splice(__position, std::move(__x), __first, __last); } #endif void remove(const _Tp& __value) { for (iterator __x = begin(); __x != end(); ) { if (*__x == __value) __x = erase(__x); else ++__x; } } template<class _Predicate> void remove_if(_Predicate __pred) { for (iterator __x = begin(); __x != end(); ) { __profcxx_list_operation(this); if (__pred(*__x)) __x = erase(__x); else ++__x; } } void unique() { iterator __first = begin(); iterator __last = end(); if (__first == __last) return; iterator __next = __first; while (++__next != __last) { __profcxx_list_operation(this); if (*__first == *__next) erase(__next); else __first = __next; __next = __first; } } template<class _BinaryPredicate> void unique(_BinaryPredicate __binary_pred) { iterator __first = begin(); iterator __last = end(); if (__first == __last) return; iterator __next = __first; while (++__next != __last) { __profcxx_list_operation(this); if (__binary_pred(*__first, *__next)) erase(__next); else __first = __next; __next = __first; } } void #if __cplusplus >= 201103L merge(list&& __x) #else merge(list& __x) #endif { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 300. list::merge() specification incomplete if (this != &__x) { _Base::merge(_GLIBCXX_MOVE(__x._M_base())); } } #if __cplusplus >= 201103L void merge(list& __x) { this->merge(std::move(__x)); } #endif template<class _Compare> void #if __cplusplus >= 201103L merge(list&& __x, _Compare __comp) #else merge(list& __x, _Compare __comp) #endif { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 300. list::merge() specification incomplete if (this != &__x) { _Base::merge(_GLIBCXX_MOVE(__x._M_base()), __comp); } } #if __cplusplus >= 201103L template<typename _Compare> void merge(list& __x, _Compare __comp) { this->merge(std::move(__x), __comp); } #endif void sort() { _Base::sort(); } template<typename _StrictWeakOrdering> void sort(_StrictWeakOrdering __pred) { _Base::sort(__pred); } using _Base::reverse; _Base& _M_base() _GLIBCXX_NOEXCEPT { return *this; } const _Base& _M_base() const _GLIBCXX_NOEXCEPT { return *this; } void _M_profile_find() const { } void _M_profile_iterate(int __rewind = 0) const { __profcxx_list_operation(this); __profcxx_list_iterate(this); if (__rewind) __profcxx_list_rewind(this); } private: size_type _M_profile_insert(void* obj, iterator __pos, size_type __size) { size_type __shift = 0; typename _Base::iterator __it = __pos.base(); for ( ; __it!=_Base::end(); __it++) __shift++; __profcxx_list_rewind(this); __profcxx_list_operation(this); __profcxx_list_insert(this, __shift, __size); } }; template<typename _Tp, typename _Alloc> inline bool operator==(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs) { return __lhs._M_base() == __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator!=(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs) { return __lhs._M_base() != __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator<(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs) { return __lhs._M_base() < __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator<=(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs) { return __lhs._M_base() <= __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator>=(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs) { return __lhs._M_base() >= __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator>(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs) { return __lhs._M_base() > __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline void swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs) { __lhs.swap(__rhs); } } // namespace __profile } // namespace std #endif �������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/iterator����������������������������������������������������������������������������������0000644�����������������00000005124�14763166027�0007357 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <iterator> -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file include/iterator * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_ITERATOR #define _GLIBCXX_ITERATOR 1 #pragma GCC system_header #include <bits/c++config.h> #include <bits/stl_iterator_base_types.h> #include <bits/stl_iterator_base_funcs.h> #include <bits/stl_iterator.h> #include <ostream> #include <istream> #include <bits/stream_iterator.h> #include <bits/streambuf_iterator.h> #include <bits/range_access.h> #endif /* _GLIBCXX_ITERATOR */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/stack�������������������������������������������������������������������������������������0000644�����������������00000004527�14763166027�0006641 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <stack> -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file include/stack * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_STACK #define _GLIBCXX_STACK 1 #pragma GCC system_header #include <deque> #include <bits/stl_stack.h> #endif /* _GLIBCXX_STACK */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tuple�������������������������������������������������������������������������������������0000644�����������������00000105543�14763166027�0006665 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <tuple> -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/tuple * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_TUPLE #define _GLIBCXX_TUPLE 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <utility> #include <array> #include <bits/uses_allocator.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup utilities * @{ */ // Adds a const reference to a non-reference type. template<typename _Tp> struct __add_c_ref { typedef const _Tp& type; }; template<typename _Tp> struct __add_c_ref<_Tp&> { typedef _Tp& type; }; // Adds a reference to a non-reference type. template<typename _Tp> struct __add_ref { typedef _Tp& type; }; template<typename _Tp> struct __add_ref<_Tp&> { typedef _Tp& type; }; // Adds an rvalue reference to a non-reference type. template<typename _Tp> struct __add_r_ref { typedef _Tp&& type; }; template<typename _Tp> struct __add_r_ref<_Tp&> { typedef _Tp& type; }; template<std::size_t _Idx, typename _Head, bool _IsEmptyNotFinal> struct _Head_base; template<std::size_t _Idx, typename _Head> struct _Head_base<_Idx, _Head, true> : public _Head { constexpr _Head_base() : _Head() { } constexpr _Head_base(const _Head& __h) : _Head(__h) { } constexpr _Head_base(const _Head_base&) = default; constexpr _Head_base(_Head_base&&) = default; template<typename _UHead> constexpr _Head_base(_UHead&& __h) : _Head(std::forward<_UHead>(__h)) { } _Head_base(allocator_arg_t, __uses_alloc0) : _Head() { } template<typename _Alloc> _Head_base(allocator_arg_t, __uses_alloc1<_Alloc> __a) : _Head(allocator_arg, *__a._M_a) { } template<typename _Alloc> _Head_base(allocator_arg_t, __uses_alloc2<_Alloc> __a) : _Head(*__a._M_a) { } template<typename _UHead> _Head_base(__uses_alloc0, _UHead&& __uhead) : _Head(std::forward<_UHead>(__uhead)) { } template<typename _Alloc, typename _UHead> _Head_base(__uses_alloc1<_Alloc> __a, _UHead&& __uhead) : _Head(allocator_arg, *__a._M_a, std::forward<_UHead>(__uhead)) { } template<typename _Alloc, typename _UHead> _Head_base(__uses_alloc2<_Alloc> __a, _UHead&& __uhead) : _Head(std::forward<_UHead>(__uhead), *__a._M_a) { } static constexpr _Head& _M_head(_Head_base& __b) noexcept { return __b; } static constexpr const _Head& _M_head(const _Head_base& __b) noexcept { return __b; } }; template<std::size_t _Idx, typename _Head> struct _Head_base<_Idx, _Head, false> { constexpr _Head_base() : _M_head_impl() { } constexpr _Head_base(const _Head& __h) : _M_head_impl(__h) { } constexpr _Head_base(const _Head_base&) = default; constexpr _Head_base(_Head_base&&) = default; template<typename _UHead> constexpr _Head_base(_UHead&& __h) : _M_head_impl(std::forward<_UHead>(__h)) { } _Head_base(allocator_arg_t, __uses_alloc0) : _M_head_impl() { } template<typename _Alloc> _Head_base(allocator_arg_t, __uses_alloc1<_Alloc> __a) : _M_head_impl(allocator_arg, *__a._M_a) { } template<typename _Alloc> _Head_base(allocator_arg_t, __uses_alloc2<_Alloc> __a) : _M_head_impl(*__a._M_a) { } template<typename _UHead> _Head_base(__uses_alloc0, _UHead&& __uhead) : _M_head_impl(std::forward<_UHead>(__uhead)) { } template<typename _Alloc, typename _UHead> _Head_base(__uses_alloc1<_Alloc> __a, _UHead&& __uhead) : _M_head_impl(allocator_arg, *__a._M_a, std::forward<_UHead>(__uhead)) { } template<typename _Alloc, typename _UHead> _Head_base(__uses_alloc2<_Alloc> __a, _UHead&& __uhead) : _M_head_impl(std::forward<_UHead>(__uhead), *__a._M_a) { } static constexpr _Head& _M_head(_Head_base& __b) noexcept { return __b._M_head_impl; } static constexpr const _Head& _M_head(const _Head_base& __b) noexcept { return __b._M_head_impl; } _Head _M_head_impl; }; /** * Contains the actual implementation of the @c tuple template, stored * as a recursive inheritance hierarchy from the first element (most * derived class) to the last (least derived class). The @c Idx * parameter gives the 0-based index of the element stored at this * point in the hierarchy; we use it to implement a constant-time * get() operation. */ template<std::size_t _Idx, typename... _Elements> struct _Tuple_impl; /** * Zero-element tuple implementation. This is the basis case for the * inheritance recursion. */ template<std::size_t _Idx> struct _Tuple_impl<_Idx> { template<std::size_t, typename...> friend class _Tuple_impl; _Tuple_impl() = default; template<typename _Alloc> _Tuple_impl(allocator_arg_t, const _Alloc&) { } template<typename _Alloc> _Tuple_impl(allocator_arg_t, const _Alloc&, const _Tuple_impl&) { } template<typename _Alloc> _Tuple_impl(allocator_arg_t, const _Alloc&, _Tuple_impl&&) { } protected: void _M_swap(_Tuple_impl&) noexcept { /* no-op */ } }; template<typename _Tp> struct __is_empty_non_tuple : is_empty<_Tp> { }; // Using EBO for elements that are tuples causes ambiguous base errors. template<typename _El0, typename... _El> struct __is_empty_non_tuple<tuple<_El0, _El...>> : false_type { }; // Use the Empty Base-class Optimization for empty, non-final types. template<typename _Tp> using __empty_not_final = typename conditional<__is_final(_Tp), false_type, __is_empty_non_tuple<_Tp>>::type; /** * Recursive tuple implementation. Here we store the @c Head element * and derive from a @c Tuple_impl containing the remaining elements * (which contains the @c Tail). */ template<std::size_t _Idx, typename _Head, typename... _Tail> struct _Tuple_impl<_Idx, _Head, _Tail...> : public _Tuple_impl<_Idx + 1, _Tail...>, private _Head_base<_Idx, _Head, __empty_not_final<_Head>::value> { template<std::size_t, typename...> friend class _Tuple_impl; typedef _Tuple_impl<_Idx + 1, _Tail...> _Inherited; typedef _Head_base<_Idx, _Head, __empty_not_final<_Head>::value> _Base; static constexpr _Head& _M_head(_Tuple_impl& __t) noexcept { return _Base::_M_head(__t); } static constexpr const _Head& _M_head(const _Tuple_impl& __t) noexcept { return _Base::_M_head(__t); } static constexpr _Inherited& _M_tail(_Tuple_impl& __t) noexcept { return __t; } static constexpr const _Inherited& _M_tail(const _Tuple_impl& __t) noexcept { return __t; } constexpr _Tuple_impl() : _Inherited(), _Base() { } explicit constexpr _Tuple_impl(const _Head& __head, const _Tail&... __tail) : _Inherited(__tail...), _Base(__head) { } template<typename _UHead, typename... _UTail, typename = typename enable_if<sizeof...(_Tail) == sizeof...(_UTail)>::type> explicit constexpr _Tuple_impl(_UHead&& __head, _UTail&&... __tail) : _Inherited(std::forward<_UTail>(__tail)...), _Base(std::forward<_UHead>(__head)) { } constexpr _Tuple_impl(const _Tuple_impl&) = default; constexpr _Tuple_impl(_Tuple_impl&& __in) noexcept(__and_<is_nothrow_move_constructible<_Head>, is_nothrow_move_constructible<_Inherited>>::value) : _Inherited(std::move(_M_tail(__in))), _Base(std::forward<_Head>(_M_head(__in))) { } template<typename... _UElements> constexpr _Tuple_impl(const _Tuple_impl<_Idx, _UElements...>& __in) : _Inherited(_Tuple_impl<_Idx, _UElements...>::_M_tail(__in)), _Base(_Tuple_impl<_Idx, _UElements...>::_M_head(__in)) { } template<typename _UHead, typename... _UTails> constexpr _Tuple_impl(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in) : _Inherited(std::move (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))), _Base(std::forward<_UHead> (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in))) { } template<typename _Alloc> _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a) : _Inherited(__tag, __a), _Base(__tag, __use_alloc<_Head>(__a)) { } template<typename _Alloc> _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a, const _Head& __head, const _Tail&... __tail) : _Inherited(__tag, __a, __tail...), _Base(__use_alloc<_Head, _Alloc, _Head>(__a), __head) { } template<typename _Alloc, typename _UHead, typename... _UTail, typename = typename enable_if<sizeof...(_Tail) == sizeof...(_UTail)>::type> _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a, _UHead&& __head, _UTail&&... __tail) : _Inherited(__tag, __a, std::forward<_UTail>(__tail)...), _Base(__use_alloc<_Head, _Alloc, _UHead>(__a), std::forward<_UHead>(__head)) { } template<typename _Alloc> _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a, const _Tuple_impl& __in) : _Inherited(__tag, __a, _M_tail(__in)), _Base(__use_alloc<_Head, _Alloc, _Head>(__a), _M_head(__in)) { } template<typename _Alloc> _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a, _Tuple_impl&& __in) : _Inherited(__tag, __a, std::move(_M_tail(__in))), _Base(__use_alloc<_Head, _Alloc, _Head>(__a), std::forward<_Head>(_M_head(__in))) { } template<typename _Alloc, typename... _UElements> _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a, const _Tuple_impl<_Idx, _UElements...>& __in) : _Inherited(__tag, __a, _Tuple_impl<_Idx, _UElements...>::_M_tail(__in)), _Base(__use_alloc<_Head, _Alloc, _Head>(__a), _Tuple_impl<_Idx, _UElements...>::_M_head(__in)) { } template<typename _Alloc, typename _UHead, typename... _UTails> _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a, _Tuple_impl<_Idx, _UHead, _UTails...>&& __in) : _Inherited(__tag, __a, std::move (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))), _Base(__use_alloc<_Head, _Alloc, _UHead>(__a), std::forward<_UHead> (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in))) { } _Tuple_impl& operator=(const _Tuple_impl& __in) { _M_head(*this) = _M_head(__in); _M_tail(*this) = _M_tail(__in); return *this; } _Tuple_impl& operator=(_Tuple_impl&& __in) noexcept(__and_<is_nothrow_move_assignable<_Head>, is_nothrow_move_assignable<_Inherited>>::value) { _M_head(*this) = std::forward<_Head>(_M_head(__in)); _M_tail(*this) = std::move(_M_tail(__in)); return *this; } template<typename... _UElements> _Tuple_impl& operator=(const _Tuple_impl<_Idx, _UElements...>& __in) { _M_head(*this) = _Tuple_impl<_Idx, _UElements...>::_M_head(__in); _M_tail(*this) = _Tuple_impl<_Idx, _UElements...>::_M_tail(__in); return *this; } template<typename _UHead, typename... _UTails> _Tuple_impl& operator=(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in) { _M_head(*this) = std::forward<_UHead> (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in)); _M_tail(*this) = std::move (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in)); return *this; } protected: void _M_swap(_Tuple_impl& __in) noexcept(noexcept(swap(std::declval<_Head&>(), std::declval<_Head&>())) && noexcept(_M_tail(__in)._M_swap(_M_tail(__in)))) { using std::swap; swap(_M_head(*this), _M_head(__in)); _Inherited::_M_swap(_M_tail(__in)); } }; /// Primary class template, tuple template<typename... _Elements> class tuple : public _Tuple_impl<0, _Elements...> { typedef _Tuple_impl<0, _Elements...> _Inherited; public: constexpr tuple() : _Inherited() { } explicit constexpr tuple(const _Elements&... __elements) : _Inherited(__elements...) { } template<typename... _UElements, typename = typename enable_if<__and_<is_convertible<_UElements, _Elements>...>::value>::type> explicit constexpr tuple(_UElements&&... __elements) : _Inherited(std::forward<_UElements>(__elements)...) { } constexpr tuple(const tuple&) = default; constexpr tuple(tuple&&) = default; template<typename... _UElements, typename = typename enable_if<__and_<is_convertible<const _UElements&, _Elements>...>::value>::type> constexpr tuple(const tuple<_UElements...>& __in) : _Inherited(static_cast<const _Tuple_impl<0, _UElements...>&>(__in)) { } template<typename... _UElements, typename = typename enable_if<__and_<is_convertible<_UElements, _Elements>...>::value>::type> constexpr tuple(tuple<_UElements...>&& __in) : _Inherited(static_cast<_Tuple_impl<0, _UElements...>&&>(__in)) { } // Allocator-extended constructors. template<typename _Alloc> tuple(allocator_arg_t __tag, const _Alloc& __a) : _Inherited(__tag, __a) { } template<typename _Alloc> tuple(allocator_arg_t __tag, const _Alloc& __a, const _Elements&... __elements) : _Inherited(__tag, __a, __elements...) { } template<typename _Alloc, typename... _UElements, typename = typename enable_if<sizeof...(_UElements) == sizeof...(_Elements)>::type> tuple(allocator_arg_t __tag, const _Alloc& __a, _UElements&&... __elements) : _Inherited(__tag, __a, std::forward<_UElements>(__elements)...) { } template<typename _Alloc> tuple(allocator_arg_t __tag, const _Alloc& __a, const tuple& __in) : _Inherited(__tag, __a, static_cast<const _Inherited&>(__in)) { } template<typename _Alloc> tuple(allocator_arg_t __tag, const _Alloc& __a, tuple&& __in) : _Inherited(__tag, __a, static_cast<_Inherited&&>(__in)) { } template<typename _Alloc, typename... _UElements, typename = typename enable_if<sizeof...(_UElements) == sizeof...(_Elements)>::type> tuple(allocator_arg_t __tag, const _Alloc& __a, const tuple<_UElements...>& __in) : _Inherited(__tag, __a, static_cast<const _Tuple_impl<0, _UElements...>&>(__in)) { } template<typename _Alloc, typename... _UElements, typename = typename enable_if<sizeof...(_UElements) == sizeof...(_Elements)>::type> tuple(allocator_arg_t __tag, const _Alloc& __a, tuple<_UElements...>&& __in) : _Inherited(__tag, __a, static_cast<_Tuple_impl<0, _UElements...>&&>(__in)) { } tuple& operator=(const tuple& __in) { static_cast<_Inherited&>(*this) = __in; return *this; } tuple& operator=(tuple&& __in) noexcept(is_nothrow_move_assignable<_Inherited>::value) { static_cast<_Inherited&>(*this) = std::move(__in); return *this; } template<typename... _UElements, typename = typename enable_if<sizeof...(_UElements) == sizeof...(_Elements)>::type> tuple& operator=(const tuple<_UElements...>& __in) { static_cast<_Inherited&>(*this) = __in; return *this; } template<typename... _UElements, typename = typename enable_if<sizeof...(_UElements) == sizeof...(_Elements)>::type> tuple& operator=(tuple<_UElements...>&& __in) { static_cast<_Inherited&>(*this) = std::move(__in); return *this; } void swap(tuple& __in) noexcept(noexcept(__in._M_swap(__in))) { _Inherited::_M_swap(__in); } }; // Explicit specialization, zero-element tuple. template<> class tuple<> { public: void swap(tuple&) noexcept { /* no-op */ } }; /// Partial specialization, 2-element tuple. /// Includes construction and assignment from a pair. template<typename _T1, typename _T2> class tuple<_T1, _T2> : public _Tuple_impl<0, _T1, _T2> { typedef _Tuple_impl<0, _T1, _T2> _Inherited; public: constexpr tuple() : _Inherited() { } explicit constexpr tuple(const _T1& __a1, const _T2& __a2) : _Inherited(__a1, __a2) { } template<typename _U1, typename _U2, typename = typename enable_if<__and_<is_convertible<_U1, _T1>, is_convertible<_U2, _T2>>::value>::type> explicit constexpr tuple(_U1&& __a1, _U2&& __a2) : _Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2)) { } constexpr tuple(const tuple&) = default; constexpr tuple(tuple&&) = default; template<typename _U1, typename _U2, typename = typename enable_if<__and_<is_convertible<const _U1&, _T1>, is_convertible<const _U2&, _T2>>::value>::type> constexpr tuple(const tuple<_U1, _U2>& __in) : _Inherited(static_cast<const _Tuple_impl<0, _U1, _U2>&>(__in)) { } template<typename _U1, typename _U2, typename = typename enable_if<__and_<is_convertible<_U1, _T1>, is_convertible<_U2, _T2>>::value>::type> constexpr tuple(tuple<_U1, _U2>&& __in) : _Inherited(static_cast<_Tuple_impl<0, _U1, _U2>&&>(__in)) { } template<typename _U1, typename _U2, typename = typename enable_if<__and_<is_convertible<const _U1&, _T1>, is_convertible<const _U2&, _T2>>::value>::type> constexpr tuple(const pair<_U1, _U2>& __in) : _Inherited(__in.first, __in.second) { } template<typename _U1, typename _U2, typename = typename enable_if<__and_<is_convertible<_U1, _T1>, is_convertible<_U2, _T2>>::value>::type> constexpr tuple(pair<_U1, _U2>&& __in) : _Inherited(std::forward<_U1>(__in.first), std::forward<_U2>(__in.second)) { } // Allocator-extended constructors. template<typename _Alloc> tuple(allocator_arg_t __tag, const _Alloc& __a) : _Inherited(__tag, __a) { } template<typename _Alloc> tuple(allocator_arg_t __tag, const _Alloc& __a, const _T1& __a1, const _T2& __a2) : _Inherited(__tag, __a, __a1, __a2) { } template<typename _Alloc, typename _U1, typename _U2> tuple(allocator_arg_t __tag, const _Alloc& __a, _U1&& __a1, _U2&& __a2) : _Inherited(__tag, __a, std::forward<_U1>(__a1), std::forward<_U2>(__a2)) { } template<typename _Alloc> tuple(allocator_arg_t __tag, const _Alloc& __a, const tuple& __in) : _Inherited(__tag, __a, static_cast<const _Inherited&>(__in)) { } template<typename _Alloc> tuple(allocator_arg_t __tag, const _Alloc& __a, tuple&& __in) : _Inherited(__tag, __a, static_cast<_Inherited&&>(__in)) { } template<typename _Alloc, typename _U1, typename _U2> tuple(allocator_arg_t __tag, const _Alloc& __a, const tuple<_U1, _U2>& __in) : _Inherited(__tag, __a, static_cast<const _Tuple_impl<0, _U1, _U2>&>(__in)) { } template<typename _Alloc, typename _U1, typename _U2> tuple(allocator_arg_t __tag, const _Alloc& __a, tuple<_U1, _U2>&& __in) : _Inherited(__tag, __a, static_cast<_Tuple_impl<0, _U1, _U2>&&>(__in)) { } template<typename _Alloc, typename _U1, typename _U2> tuple(allocator_arg_t __tag, const _Alloc& __a, const pair<_U1, _U2>& __in) : _Inherited(__tag, __a, __in.first, __in.second) { } template<typename _Alloc, typename _U1, typename _U2> tuple(allocator_arg_t __tag, const _Alloc& __a, pair<_U1, _U2>&& __in) : _Inherited(__tag, __a, std::forward<_U1>(__in.first), std::forward<_U2>(__in.second)) { } tuple& operator=(const tuple& __in) { static_cast<_Inherited&>(*this) = __in; return *this; } tuple& operator=(tuple&& __in) noexcept(is_nothrow_move_assignable<_Inherited>::value) { static_cast<_Inherited&>(*this) = std::move(__in); return *this; } template<typename _U1, typename _U2> tuple& operator=(const tuple<_U1, _U2>& __in) { static_cast<_Inherited&>(*this) = __in; return *this; } template<typename _U1, typename _U2> tuple& operator=(tuple<_U1, _U2>&& __in) { static_cast<_Inherited&>(*this) = std::move(__in); return *this; } template<typename _U1, typename _U2> tuple& operator=(const pair<_U1, _U2>& __in) { this->_M_head(*this) = __in.first; this->_M_tail(*this)._M_head(*this) = __in.second; return *this; } template<typename _U1, typename _U2> tuple& operator=(pair<_U1, _U2>&& __in) { this->_M_head(*this) = std::forward<_U1>(__in.first); this->_M_tail(*this)._M_head(*this) = std::forward<_U2>(__in.second); return *this; } void swap(tuple& __in) noexcept(noexcept(__in._M_swap(__in))) { _Inherited::_M_swap(__in); } }; /// Gives the type of the ith element of a given tuple type. template<std::size_t __i, typename _Tp> struct tuple_element; /** * Recursive case for tuple_element: strip off the first element in * the tuple and retrieve the (i-1)th element of the remaining tuple. */ template<std::size_t __i, typename _Head, typename... _Tail> struct tuple_element<__i, tuple<_Head, _Tail...> > : tuple_element<__i - 1, tuple<_Tail...> > { }; /** * Basis case for tuple_element: The first element is the one we're seeking. */ template<typename _Head, typename... _Tail> struct tuple_element<0, tuple<_Head, _Tail...> > { typedef _Head type; }; template<std::size_t __i, typename _Tp> struct tuple_element<__i, const _Tp> { typedef typename add_const<typename tuple_element<__i, _Tp>::type>::type type; }; template<std::size_t __i, typename _Tp> struct tuple_element<__i, volatile _Tp> { typedef typename add_volatile<typename tuple_element<__i, _Tp>::type>::type type; }; template<std::size_t __i, typename _Tp> struct tuple_element<__i, const volatile _Tp> { typedef typename add_cv<typename tuple_element<__i, _Tp>::type>::type type; }; /// Finds the size of a given tuple type. template<typename _Tp> struct tuple_size; template<typename _Tp> struct tuple_size<const _Tp> : public integral_constant< typename remove_cv<decltype(tuple_size<_Tp>::value)>::type, tuple_size<_Tp>::value> { }; template<typename _Tp> struct tuple_size<volatile _Tp> : public integral_constant< typename remove_cv<decltype(tuple_size<_Tp>::value)>::type, tuple_size<_Tp>::value> { }; template<typename _Tp> struct tuple_size<const volatile _Tp> : public integral_constant< typename remove_cv<decltype(tuple_size<_Tp>::value)>::type, tuple_size<_Tp>::value> { }; /// class tuple_size template<typename... _Elements> struct tuple_size<tuple<_Elements...>> : public integral_constant<std::size_t, sizeof...(_Elements)> { }; template<std::size_t __i, typename _Head, typename... _Tail> constexpr typename __add_ref<_Head>::type __get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t) noexcept { return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); } template<std::size_t __i, typename _Head, typename... _Tail> constexpr typename __add_c_ref<_Head>::type __get_helper(const _Tuple_impl<__i, _Head, _Tail...>& __t) noexcept { return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); } // Return a reference (const reference, rvalue reference) to the ith element // of a tuple. Any const or non-const ref elements are returned with their // original type. template<std::size_t __i, typename... _Elements> constexpr typename __add_ref< typename tuple_element<__i, tuple<_Elements...>>::type >::type get(tuple<_Elements...>& __t) noexcept { return std::__get_helper<__i>(__t); } template<std::size_t __i, typename... _Elements> constexpr typename __add_c_ref< typename tuple_element<__i, tuple<_Elements...>>::type >::type get(const tuple<_Elements...>& __t) noexcept { return std::__get_helper<__i>(__t); } template<std::size_t __i, typename... _Elements> constexpr typename __add_r_ref< typename tuple_element<__i, tuple<_Elements...>>::type >::type get(tuple<_Elements...>&& __t) noexcept { return std::forward<typename tuple_element<__i, tuple<_Elements...>>::type&&>(get<__i>(__t)); } // This class helps construct the various comparison operations on tuples template<std::size_t __check_equal_size, std::size_t __i, std::size_t __j, typename _Tp, typename _Up> struct __tuple_compare; template<std::size_t __i, std::size_t __j, typename _Tp, typename _Up> struct __tuple_compare<0, __i, __j, _Tp, _Up> { static constexpr bool __eq(const _Tp& __t, const _Up& __u) { return (get<__i>(__t) == get<__i>(__u) && __tuple_compare<0, __i + 1, __j, _Tp, _Up>::__eq(__t, __u)); } static constexpr bool __less(const _Tp& __t, const _Up& __u) { return ((get<__i>(__t) < get<__i>(__u)) || !(get<__i>(__u) < get<__i>(__t)) && __tuple_compare<0, __i + 1, __j, _Tp, _Up>::__less(__t, __u)); } }; template<std::size_t __i, typename _Tp, typename _Up> struct __tuple_compare<0, __i, __i, _Tp, _Up> { static constexpr bool __eq(const _Tp&, const _Up&) { return true; } static constexpr bool __less(const _Tp&, const _Up&) { return false; } }; template<typename... _TElements, typename... _UElements> constexpr bool operator==(const tuple<_TElements...>& __t, const tuple<_UElements...>& __u) { typedef tuple<_TElements...> _Tp; typedef tuple<_UElements...> _Up; return bool(__tuple_compare<tuple_size<_Tp>::value - tuple_size<_Up>::value, 0, tuple_size<_Tp>::value, _Tp, _Up>::__eq(__t, __u)); } template<typename... _TElements, typename... _UElements> constexpr bool operator<(const tuple<_TElements...>& __t, const tuple<_UElements...>& __u) { typedef tuple<_TElements...> _Tp; typedef tuple<_UElements...> _Up; return bool(__tuple_compare<tuple_size<_Tp>::value - tuple_size<_Up>::value, 0, tuple_size<_Tp>::value, _Tp, _Up>::__less(__t, __u)); } template<typename... _TElements, typename... _UElements> inline constexpr bool operator!=(const tuple<_TElements...>& __t, const tuple<_UElements...>& __u) { return !(__t == __u); } template<typename... _TElements, typename... _UElements> inline constexpr bool operator>(const tuple<_TElements...>& __t, const tuple<_UElements...>& __u) { return __u < __t; } template<typename... _TElements, typename... _UElements> inline constexpr bool operator<=(const tuple<_TElements...>& __t, const tuple<_UElements...>& __u) { return !(__u < __t); } template<typename... _TElements, typename... _UElements> inline constexpr bool operator>=(const tuple<_TElements...>& __t, const tuple<_UElements...>& __u) { return !(__t < __u); } // NB: DR 705. template<typename... _Elements> constexpr tuple<typename __decay_and_strip<_Elements>::__type...> make_tuple(_Elements&&... __args) { typedef tuple<typename __decay_and_strip<_Elements>::__type...> __result_type; return __result_type(std::forward<_Elements>(__args)...); } template<typename... _Elements> tuple<_Elements&&...> forward_as_tuple(_Elements&&... __args) noexcept { return tuple<_Elements&&...>(std::forward<_Elements>(__args)...); } template<typename> struct __is_tuple_like_impl : false_type { }; template<typename... _Tps> struct __is_tuple_like_impl<tuple<_Tps...>> : true_type { }; template<typename _T1, typename _T2> struct __is_tuple_like_impl<pair<_T1, _T2>> : true_type { }; template<typename _Tp, std::size_t _Nm> struct __is_tuple_like_impl<array<_Tp, _Nm>> : true_type { }; // Internal type trait that allows us to sfinae-protect tuple_cat. template<typename _Tp> struct __is_tuple_like : public __is_tuple_like_impl<typename std::remove_cv <typename std::remove_reference<_Tp>::type>::type>::type { }; // Stores a tuple of indices. Also used by bind() to extract the elements // in a tuple. template<std::size_t... _Indexes> struct _Index_tuple { typedef _Index_tuple<_Indexes..., sizeof...(_Indexes)> __next; }; // Builds an _Index_tuple<0, 1, 2, ..., _Num-1>. template<std::size_t _Num> struct _Build_index_tuple { typedef typename _Build_index_tuple<_Num - 1>::__type::__next __type; }; template<> struct _Build_index_tuple<0> { typedef _Index_tuple<> __type; }; template<std::size_t, typename, typename, std::size_t> struct __make_tuple_impl; template<std::size_t _Idx, typename _Tuple, typename... _Tp, std::size_t _Nm> struct __make_tuple_impl<_Idx, tuple<_Tp...>, _Tuple, _Nm> { typedef typename __make_tuple_impl<_Idx + 1, tuple<_Tp..., typename std::tuple_element<_Idx, _Tuple>::type>, _Tuple, _Nm>::__type __type; }; template<std::size_t _Nm, typename _Tuple, typename... _Tp> struct __make_tuple_impl<_Nm, tuple<_Tp...>, _Tuple, _Nm> { typedef tuple<_Tp...> __type; }; template<typename _Tuple> struct __do_make_tuple : public __make_tuple_impl<0, tuple<>, _Tuple, std::tuple_size<_Tuple>::value> { }; // Returns the std::tuple equivalent of a tuple-like type. template<typename _Tuple> struct __make_tuple : public __do_make_tuple<typename std::remove_cv <typename std::remove_reference<_Tuple>::type>::type> { }; // Combines several std::tuple's into a single one. template<typename...> struct __combine_tuples; template<> struct __combine_tuples<> { typedef tuple<> __type; }; template<typename... _Ts> struct __combine_tuples<tuple<_Ts...>> { typedef tuple<_Ts...> __type; }; template<typename... _T1s, typename... _T2s, typename... _Rem> struct __combine_tuples<tuple<_T1s...>, tuple<_T2s...>, _Rem...> { typedef typename __combine_tuples<tuple<_T1s..., _T2s...>, _Rem...>::__type __type; }; // Computes the result type of tuple_cat given a set of tuple-like types. template<typename... _Tpls> struct __tuple_cat_result { typedef typename __combine_tuples <typename __make_tuple<_Tpls>::__type...>::__type __type; }; // Helper to determine the index set for the first tuple-like // type of a given set. template<typename...> struct __make_1st_indices; template<> struct __make_1st_indices<> { typedef std::_Index_tuple<> __type; }; template<typename _Tp, typename... _Tpls> struct __make_1st_indices<_Tp, _Tpls...> { typedef typename std::_Build_index_tuple<std::tuple_size< typename std::remove_reference<_Tp>::type>::value>::__type __type; }; // Performs the actual concatenation by step-wise expanding tuple-like // objects into the elements, which are finally forwarded into the // result tuple. template<typename _Ret, typename _Indices, typename... _Tpls> struct __tuple_concater; template<typename _Ret, std::size_t... _Is, typename _Tp, typename... _Tpls> struct __tuple_concater<_Ret, std::_Index_tuple<_Is...>, _Tp, _Tpls...> { template<typename... _Us> static constexpr _Ret _S_do(_Tp&& __tp, _Tpls&&... __tps, _Us&&... __us) { typedef typename __make_1st_indices<_Tpls...>::__type __idx; typedef __tuple_concater<_Ret, __idx, _Tpls...> __next; return __next::_S_do(std::forward<_Tpls>(__tps)..., std::forward<_Us>(__us)..., std::get<_Is>(std::forward<_Tp>(__tp))...); } }; template<typename _Ret> struct __tuple_concater<_Ret, std::_Index_tuple<>> { template<typename... _Us> static constexpr _Ret _S_do(_Us&&... __us) { return _Ret(std::forward<_Us>(__us)...); } }; /// tuple_cat template<typename... _Tpls, typename = typename enable_if<__and_<__is_tuple_like<_Tpls>...>::value>::type> constexpr auto tuple_cat(_Tpls&&... __tpls) -> typename __tuple_cat_result<_Tpls...>::__type { typedef typename __tuple_cat_result<_Tpls...>::__type __ret; typedef typename __make_1st_indices<_Tpls...>::__type __idx; typedef __tuple_concater<__ret, __idx, _Tpls...> __concater; return __concater::_S_do(std::forward<_Tpls>(__tpls)...); } /// tie template<typename... _Elements> inline tuple<_Elements&...> tie(_Elements&... __args) noexcept { return tuple<_Elements&...>(__args...); } /// swap template<typename... _Elements> inline void swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } // A class (and instance) which can be used in 'tie' when an element // of a tuple is not required struct _Swallow_assign { template<class _Tp> const _Swallow_assign& operator=(const _Tp&) const { return *this; } }; const _Swallow_assign ignore{}; /// Partial specialization for tuples template<typename... _Types, typename _Alloc> struct uses_allocator<tuple<_Types...>, _Alloc> : true_type { }; // See stl_pair.h... template<class _T1, class _T2> template<typename... _Args1, typename... _Args2> inline pair<_T1, _T2>:: pair(piecewise_construct_t, tuple<_Args1...> __first, tuple<_Args2...> __second) : pair(__first, __second, typename _Build_index_tuple<sizeof...(_Args1)>::__type(), typename _Build_index_tuple<sizeof...(_Args2)>::__type()) { } template<class _T1, class _T2> template<typename... _Args1, std::size_t... _Indexes1, typename... _Args2, std::size_t... _Indexes2> inline pair<_T1, _T2>:: pair(tuple<_Args1...>& __tuple1, tuple<_Args2...>& __tuple2, _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>) : first(std::forward<_Args1>(std::get<_Indexes1>(__tuple1))...), second(std::forward<_Args2>(std::get<_Indexes2>(__tuple2))...) { } /// @} _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif // C++11 #endif // _GLIBCXX_TUPLE �������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/typeindex���������������������������������������������������������������������������������0000644�����������������00000006014�14763166027�0007536 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// C++11 <typeindex> -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/typeindex * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_TYPEINDEX #define _GLIBCXX_TYPEINDEX 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <typeinfo> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Class type_index * @ingroup utilities * * The class type_index provides a simple wrapper for type_info * which can be used as an index type in associative containers * (23.6) and in unordered associative containers (23.7). */ struct type_index { type_index(const type_info& __rhs) noexcept : _M_target(&__rhs) { } bool operator==(const type_index& __rhs) const noexcept { return *_M_target == *__rhs._M_target; } bool operator!=(const type_index& __rhs) const noexcept { return *_M_target != *__rhs._M_target; } bool operator<(const type_index& __rhs) const noexcept { return _M_target->before(*__rhs._M_target); } bool operator<=(const type_index& __rhs) const noexcept { return !__rhs._M_target->before(*_M_target); } bool operator>(const type_index& __rhs) const noexcept { return __rhs._M_target->before(*_M_target); } bool operator>=(const type_index& __rhs) const noexcept { return !_M_target->before(*__rhs._M_target); } size_t hash_code() const noexcept { return _M_target->hash_code(); } const char* name() const { return _M_target->name(); } private: const type_info* _M_target; }; template<typename _Tp> struct hash; /// std::hash specialization for type_index. template<> struct hash<type_index> { typedef size_t result_type; typedef type_index argument_type; size_t operator()(const type_index& __ti) const noexcept { return __ti.hash_code(); } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif // C++11 #endif // _GLIBCXX_TYPEINDEX ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/cwchar������������������������������������������������������������������������������������0000644�����������������00000014541�14763166027�0007000 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- forwarding header. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/cwchar * This is a Standard C++ Library file. You should @c \#include this file * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c wchar.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std (except for names which are defined * as macros in C). */ // // ISO C++ 14882: 21.4 // #pragma GCC system_header #include <bits/c++config.h> #if _GLIBCXX_HAVE_WCHAR_H #include <wchar.h> #endif #ifndef _GLIBCXX_CWCHAR #define _GLIBCXX_CWCHAR 1 // Need to do a bit of trickery here with mbstate_t as char_traits // assumes it is in wchar.h, regardless of wchar_t specializations. #ifndef _GLIBCXX_HAVE_MBSTATE_T extern "C" { typedef struct { int __fill[6]; } mbstate_t; } #endif namespace std { using ::mbstate_t; } // namespace std // Get rid of those macros defined in <wchar.h> in lieu of real functions. #undef btowc #undef fgetwc #undef fgetws #undef fputwc #undef fputws #undef fwide #undef fwprintf #undef fwscanf #undef getwc #undef getwchar #undef mbrlen #undef mbrtowc #undef mbsinit #undef mbsrtowcs #undef putwc #undef putwchar #undef swprintf #undef swscanf #undef ungetwc #undef vfwprintf #if _GLIBCXX_HAVE_VFWSCANF # undef vfwscanf #endif #undef vswprintf #if _GLIBCXX_HAVE_VSWSCANF # undef vswscanf #endif #undef vwprintf #if _GLIBCXX_HAVE_VWSCANF # undef vwscanf #endif #undef wcrtomb #undef wcscat #undef wcschr #undef wcscmp #undef wcscoll #undef wcscpy #undef wcscspn #undef wcsftime #undef wcslen #undef wcsncat #undef wcsncmp #undef wcsncpy #undef wcspbrk #undef wcsrchr #undef wcsrtombs #undef wcsspn #undef wcsstr #undef wcstod #if _GLIBCXX_HAVE_WCSTOF # undef wcstof #endif #undef wcstok #undef wcstol #undef wcstoul #undef wcsxfrm #undef wctob #undef wmemchr #undef wmemcmp #undef wmemcpy #undef wmemmove #undef wmemset #undef wprintf #undef wscanf #if _GLIBCXX_USE_WCHAR_T namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using ::wint_t; using ::btowc; using ::fgetwc; using ::fgetws; using ::fputwc; using ::fputws; using ::fwide; using ::fwprintf; using ::fwscanf; using ::getwc; using ::getwchar; using ::mbrlen; using ::mbrtowc; using ::mbsinit; using ::mbsrtowcs; using ::putwc; using ::putwchar; #ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF using ::swprintf; #endif using ::swscanf; using ::ungetwc; using ::vfwprintf; #if _GLIBCXX_HAVE_VFWSCANF using ::vfwscanf; #endif #ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF using ::vswprintf; #endif #if _GLIBCXX_HAVE_VSWSCANF using ::vswscanf; #endif using ::vwprintf; #if _GLIBCXX_HAVE_VWSCANF using ::vwscanf; #endif using ::wcrtomb; using ::wcscat; using ::wcscmp; using ::wcscoll; using ::wcscpy; using ::wcscspn; using ::wcsftime; using ::wcslen; using ::wcsncat; using ::wcsncmp; using ::wcsncpy; using ::wcsrtombs; using ::wcsspn; using ::wcstod; #if _GLIBCXX_HAVE_WCSTOF using ::wcstof; #endif using ::wcstok; using ::wcstol; using ::wcstoul; using ::wcsxfrm; using ::wctob; using ::wmemcmp; using ::wmemcpy; using ::wmemmove; using ::wmemset; using ::wprintf; using ::wscanf; using ::wcschr; using ::wcspbrk; using ::wcsrchr; using ::wcsstr; using ::wmemchr; #ifndef __CORRECT_ISO_CPP_WCHAR_H_PROTO inline wchar_t* wcschr(wchar_t* __p, wchar_t __c) { return wcschr(const_cast<const wchar_t*>(__p), __c); } inline wchar_t* wcspbrk(wchar_t* __s1, const wchar_t* __s2) { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); } inline wchar_t* wcsrchr(wchar_t* __p, wchar_t __c) { return wcsrchr(const_cast<const wchar_t*>(__p), __c); } inline wchar_t* wcsstr(wchar_t* __s1, const wchar_t* __s2) { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); } inline wchar_t* wmemchr(wchar_t* __p, wchar_t __c, size_t __n) { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); } #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #if _GLIBCXX_USE_C99 #undef wcstold #undef wcstoll #undef wcstoull namespace __gnu_cxx { #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC extern "C" long double (wcstold)(const wchar_t * __restrict, wchar_t ** __restrict) throw (); #endif #if !_GLIBCXX_USE_C99_DYNAMIC using ::wcstold; #endif #if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC extern "C" long long int (wcstoll)(const wchar_t * __restrict, wchar_t ** __restrict, int) throw (); extern "C" unsigned long long int (wcstoull)(const wchar_t * __restrict, wchar_t ** __restrict, int) throw (); #endif #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC using ::wcstoll; using ::wcstoull; #endif } // namespace __gnu_cxx namespace std { using ::__gnu_cxx::wcstold; using ::__gnu_cxx::wcstoll; using ::__gnu_cxx::wcstoull; } // namespace #endif #endif //_GLIBCXX_USE_WCHAR_T #if __cplusplus >= 201103L #ifdef _GLIBCXX_USE_WCHAR_T namespace std { #if _GLIBCXX_HAVE_WCSTOF using std::wcstof; #endif #if _GLIBCXX_HAVE_VFWSCANF using std::vfwscanf; #endif #if _GLIBCXX_HAVE_VSWSCANF using std::vswscanf; #endif #if _GLIBCXX_HAVE_VWSCANF using std::vwscanf; #endif #if _GLIBCXX_USE_C99 using std::wcstold; using std::wcstoll; using std::wcstoull; #endif } // namespace #endif // _GLIBCXX_USE_WCHAR_T #endif // C++11 #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/backward/hash_set�������������������������������������������������������������������������0000644�����������������00000041453�14763166027�0011107 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Hashing set implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * Copyright (c) 1996 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * */ /** @file backward/hash_set * This file is a GNU extension to the Standard C++ Library (possibly * containing extensions from the HP/SGI STL subset). */ #ifndef _BACKWARD_HASH_SET #define _BACKWARD_HASH_SET 1 #ifndef _GLIBCXX_PERMIT_BACKWARD_HASH #include "backward_warning.h" #endif #include <bits/c++config.h> #include <backward/hashtable.h> #include <bits/concept_check.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using std::equal_to; using std::allocator; using std::pair; using std::_Identity; /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template<class _Value, class _HashFcn = hash<_Value>, class _EqualKey = equal_to<_Value>, class _Alloc = allocator<_Value> > class hash_set { // concept requirements __glibcxx_class_requires(_Value, _SGIAssignableConcept) __glibcxx_class_requires3(_HashFcn, size_t, _Value, _UnaryFunctionConcept) __glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept) private: typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, _EqualKey, _Alloc> _Ht; _Ht _M_ht; public: typedef typename _Ht::key_type key_type; typedef typename _Ht::value_type value_type; typedef typename _Ht::hasher hasher; typedef typename _Ht::key_equal key_equal; typedef typename _Ht::size_type size_type; typedef typename _Ht::difference_type difference_type; typedef typename _Alloc::pointer pointer; typedef typename _Alloc::const_pointer const_pointer; typedef typename _Alloc::reference reference; typedef typename _Alloc::const_reference const_reference; typedef typename _Ht::const_iterator iterator; typedef typename _Ht::const_iterator const_iterator; typedef typename _Ht::allocator_type allocator_type; hasher hash_funct() const { return _M_ht.hash_funct(); } key_equal key_eq() const { return _M_ht.key_eq(); } allocator_type get_allocator() const { return _M_ht.get_allocator(); } hash_set() : _M_ht(100, hasher(), key_equal(), allocator_type()) {} explicit hash_set(size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} hash_set(size_type __n, const hasher& __hf) : _M_ht(__n, __hf, key_equal(), allocator_type()) {} hash_set(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) {} template<class _InputIterator> hash_set(_InputIterator __f, _InputIterator __l) : _M_ht(100, hasher(), key_equal(), allocator_type()) { _M_ht.insert_unique(__f, __l); } template<class _InputIterator> hash_set(_InputIterator __f, _InputIterator __l, size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type()) { _M_ht.insert_unique(__f, __l); } template<class _InputIterator> hash_set(_InputIterator __f, _InputIterator __l, size_type __n, const hasher& __hf) : _M_ht(__n, __hf, key_equal(), allocator_type()) { _M_ht.insert_unique(__f, __l); } template<class _InputIterator> hash_set(_InputIterator __f, _InputIterator __l, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) { _M_ht.insert_unique(__f, __l); } size_type size() const { return _M_ht.size(); } size_type max_size() const { return _M_ht.max_size(); } bool empty() const { return _M_ht.empty(); } void swap(hash_set& __hs) { _M_ht.swap(__hs._M_ht); } template<class _Val, class _HF, class _EqK, class _Al> friend bool operator==(const hash_set<_Val, _HF, _EqK, _Al>&, const hash_set<_Val, _HF, _EqK, _Al>&); iterator begin() const { return _M_ht.begin(); } iterator end() const { return _M_ht.end(); } pair<iterator, bool> insert(const value_type& __obj) { pair<typename _Ht::iterator, bool> __p = _M_ht.insert_unique(__obj); return pair<iterator,bool>(__p.first, __p.second); } template<class _InputIterator> void insert(_InputIterator __f, _InputIterator __l) { _M_ht.insert_unique(__f, __l); } pair<iterator, bool> insert_noresize(const value_type& __obj) { pair<typename _Ht::iterator, bool> __p = _M_ht.insert_unique_noresize(__obj); return pair<iterator, bool>(__p.first, __p.second); } iterator find(const key_type& __key) const { return _M_ht.find(__key); } size_type count(const key_type& __key) const { return _M_ht.count(__key); } pair<iterator, iterator> equal_range(const key_type& __key) const { return _M_ht.equal_range(__key); } size_type erase(const key_type& __key) {return _M_ht.erase(__key); } void erase(iterator __it) { _M_ht.erase(__it); } void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } void clear() { _M_ht.clear(); } void resize(size_type __hint) { _M_ht.resize(__hint); } size_type bucket_count() const { return _M_ht.bucket_count(); } size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } size_type elems_in_bucket(size_type __n) const { return _M_ht.elems_in_bucket(__n); } }; template<class _Value, class _HashFcn, class _EqualKey, class _Alloc> inline bool operator==(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1, const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2) { return __hs1._M_ht == __hs2._M_ht; } template<class _Value, class _HashFcn, class _EqualKey, class _Alloc> inline bool operator!=(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1, const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2) { return !(__hs1 == __hs2); } template<class _Val, class _HashFcn, class _EqualKey, class _Alloc> inline void swap(hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1, hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2) { __hs1.swap(__hs2); } /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template<class _Value, class _HashFcn = hash<_Value>, class _EqualKey = equal_to<_Value>, class _Alloc = allocator<_Value> > class hash_multiset { // concept requirements __glibcxx_class_requires(_Value, _SGIAssignableConcept) __glibcxx_class_requires3(_HashFcn, size_t, _Value, _UnaryFunctionConcept) __glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept) private: typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, _EqualKey, _Alloc> _Ht; _Ht _M_ht; public: typedef typename _Ht::key_type key_type; typedef typename _Ht::value_type value_type; typedef typename _Ht::hasher hasher; typedef typename _Ht::key_equal key_equal; typedef typename _Ht::size_type size_type; typedef typename _Ht::difference_type difference_type; typedef typename _Alloc::pointer pointer; typedef typename _Alloc::const_pointer const_pointer; typedef typename _Alloc::reference reference; typedef typename _Alloc::const_reference const_reference; typedef typename _Ht::const_iterator iterator; typedef typename _Ht::const_iterator const_iterator; typedef typename _Ht::allocator_type allocator_type; hasher hash_funct() const { return _M_ht.hash_funct(); } key_equal key_eq() const { return _M_ht.key_eq(); } allocator_type get_allocator() const { return _M_ht.get_allocator(); } hash_multiset() : _M_ht(100, hasher(), key_equal(), allocator_type()) {} explicit hash_multiset(size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} hash_multiset(size_type __n, const hasher& __hf) : _M_ht(__n, __hf, key_equal(), allocator_type()) {} hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) {} template<class _InputIterator> hash_multiset(_InputIterator __f, _InputIterator __l) : _M_ht(100, hasher(), key_equal(), allocator_type()) { _M_ht.insert_equal(__f, __l); } template<class _InputIterator> hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type()) { _M_ht.insert_equal(__f, __l); } template<class _InputIterator> hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, const hasher& __hf) : _M_ht(__n, __hf, key_equal(), allocator_type()) { _M_ht.insert_equal(__f, __l); } template<class _InputIterator> hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) { _M_ht.insert_equal(__f, __l); } size_type size() const { return _M_ht.size(); } size_type max_size() const { return _M_ht.max_size(); } bool empty() const { return _M_ht.empty(); } void swap(hash_multiset& hs) { _M_ht.swap(hs._M_ht); } template<class _Val, class _HF, class _EqK, class _Al> friend bool operator==(const hash_multiset<_Val, _HF, _EqK, _Al>&, const hash_multiset<_Val, _HF, _EqK, _Al>&); iterator begin() const { return _M_ht.begin(); } iterator end() const { return _M_ht.end(); } iterator insert(const value_type& __obj) { return _M_ht.insert_equal(__obj); } template<class _InputIterator> void insert(_InputIterator __f, _InputIterator __l) { _M_ht.insert_equal(__f,__l); } iterator insert_noresize(const value_type& __obj) { return _M_ht.insert_equal_noresize(__obj); } iterator find(const key_type& __key) const { return _M_ht.find(__key); } size_type count(const key_type& __key) const { return _M_ht.count(__key); } pair<iterator, iterator> equal_range(const key_type& __key) const { return _M_ht.equal_range(__key); } size_type erase(const key_type& __key) { return _M_ht.erase(__key); } void erase(iterator __it) { _M_ht.erase(__it); } void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } void clear() { _M_ht.clear(); } void resize(size_type __hint) { _M_ht.resize(__hint); } size_type bucket_count() const { return _M_ht.bucket_count(); } size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } size_type elems_in_bucket(size_type __n) const { return _M_ht.elems_in_bucket(__n); } }; template<class _Val, class _HashFcn, class _EqualKey, class _Alloc> inline bool operator==(const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1, const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2) { return __hs1._M_ht == __hs2._M_ht; } template<class _Val, class _HashFcn, class _EqualKey, class _Alloc> inline bool operator!=(const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1, const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2) { return !(__hs1 == __hs2); } template<class _Val, class _HashFcn, class _EqualKey, class _Alloc> inline void swap(hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1, hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2) { __hs1.swap(__hs2); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Specialization of insert_iterator so that it will work for hash_set // and hash_multiset. template<class _Value, class _HashFcn, class _EqualKey, class _Alloc> class insert_iterator<__gnu_cxx::hash_set<_Value, _HashFcn, _EqualKey, _Alloc> > { protected: typedef __gnu_cxx::hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Container; _Container* container; public: typedef _Container container_type; typedef output_iterator_tag iterator_category; typedef void value_type; typedef void difference_type; typedef void pointer; typedef void reference; insert_iterator(_Container& __x) : container(&__x) {} insert_iterator(_Container& __x, typename _Container::iterator) : container(&__x) {} insert_iterator<_Container>& operator=(const typename _Container::value_type& __value) { container->insert(__value); return *this; } insert_iterator<_Container>& operator*() { return *this; } insert_iterator<_Container>& operator++() { return *this; } insert_iterator<_Container>& operator++(int) { return *this; } }; template<class _Value, class _HashFcn, class _EqualKey, class _Alloc> class insert_iterator<__gnu_cxx::hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > { protected: typedef __gnu_cxx::hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Container; _Container* container; typename _Container::iterator iter; public: typedef _Container container_type; typedef output_iterator_tag iterator_category; typedef void value_type; typedef void difference_type; typedef void pointer; typedef void reference; insert_iterator(_Container& __x) : container(&__x) {} insert_iterator(_Container& __x, typename _Container::iterator) : container(&__x) {} insert_iterator<_Container>& operator=(const typename _Container::value_type& __value) { container->insert(__value); return *this; } insert_iterator<_Container>& operator*() { return *this; } insert_iterator<_Container>& operator++() { return *this; } insert_iterator<_Container>& operator++(int) { return *this; } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/backward/hash_map�������������������������������������������������������������������������0000644�����������������00000042557�14763166027�0011077 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Hashing map implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * Copyright (c) 1996 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * */ /** @file backward/hash_map * This file is a GNU extension to the Standard C++ Library (possibly * containing extensions from the HP/SGI STL subset). */ #ifndef _BACKWARD_HASH_MAP #define _BACKWARD_HASH_MAP 1 #ifndef _GLIBCXX_PERMIT_BACKWARD_HASH #include "backward_warning.h" #endif #include <bits/c++config.h> #include <backward/hashtable.h> #include <bits/concept_check.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using std::equal_to; using std::allocator; using std::pair; using std::_Select1st; /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template<class _Key, class _Tp, class _HashFn = hash<_Key>, class _EqualKey = equal_to<_Key>, class _Alloc = allocator<_Tp> > class hash_map { private: typedef hashtable<pair<const _Key, _Tp>,_Key, _HashFn, _Select1st<pair<const _Key, _Tp> >, _EqualKey, _Alloc> _Ht; _Ht _M_ht; public: typedef typename _Ht::key_type key_type; typedef _Tp data_type; typedef _Tp mapped_type; typedef typename _Ht::value_type value_type; typedef typename _Ht::hasher hasher; typedef typename _Ht::key_equal key_equal; typedef typename _Ht::size_type size_type; typedef typename _Ht::difference_type difference_type; typedef typename _Ht::pointer pointer; typedef typename _Ht::const_pointer const_pointer; typedef typename _Ht::reference reference; typedef typename _Ht::const_reference const_reference; typedef typename _Ht::iterator iterator; typedef typename _Ht::const_iterator const_iterator; typedef typename _Ht::allocator_type allocator_type; hasher hash_funct() const { return _M_ht.hash_funct(); } key_equal key_eq() const { return _M_ht.key_eq(); } allocator_type get_allocator() const { return _M_ht.get_allocator(); } hash_map() : _M_ht(100, hasher(), key_equal(), allocator_type()) {} explicit hash_map(size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} hash_map(size_type __n, const hasher& __hf) : _M_ht(__n, __hf, key_equal(), allocator_type()) {} hash_map(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) {} template<class _InputIterator> hash_map(_InputIterator __f, _InputIterator __l) : _M_ht(100, hasher(), key_equal(), allocator_type()) { _M_ht.insert_unique(__f, __l); } template<class _InputIterator> hash_map(_InputIterator __f, _InputIterator __l, size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type()) { _M_ht.insert_unique(__f, __l); } template<class _InputIterator> hash_map(_InputIterator __f, _InputIterator __l, size_type __n, const hasher& __hf) : _M_ht(__n, __hf, key_equal(), allocator_type()) { _M_ht.insert_unique(__f, __l); } template<class _InputIterator> hash_map(_InputIterator __f, _InputIterator __l, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) { _M_ht.insert_unique(__f, __l); } size_type size() const { return _M_ht.size(); } size_type max_size() const { return _M_ht.max_size(); } bool empty() const { return _M_ht.empty(); } void swap(hash_map& __hs) { _M_ht.swap(__hs._M_ht); } template<class _K1, class _T1, class _HF, class _EqK, class _Al> friend bool operator== (const hash_map<_K1, _T1, _HF, _EqK, _Al>&, const hash_map<_K1, _T1, _HF, _EqK, _Al>&); iterator begin() { return _M_ht.begin(); } iterator end() { return _M_ht.end(); } const_iterator begin() const { return _M_ht.begin(); } const_iterator end() const { return _M_ht.end(); } pair<iterator, bool> insert(const value_type& __obj) { return _M_ht.insert_unique(__obj); } template<class _InputIterator> void insert(_InputIterator __f, _InputIterator __l) { _M_ht.insert_unique(__f, __l); } pair<iterator, bool> insert_noresize(const value_type& __obj) { return _M_ht.insert_unique_noresize(__obj); } iterator find(const key_type& __key) { return _M_ht.find(__key); } const_iterator find(const key_type& __key) const { return _M_ht.find(__key); } _Tp& operator[](const key_type& __key) { return _M_ht.find_or_insert(value_type(__key, _Tp())).second; } size_type count(const key_type& __key) const { return _M_ht.count(__key); } pair<iterator, iterator> equal_range(const key_type& __key) { return _M_ht.equal_range(__key); } pair<const_iterator, const_iterator> equal_range(const key_type& __key) const { return _M_ht.equal_range(__key); } size_type erase(const key_type& __key) {return _M_ht.erase(__key); } void erase(iterator __it) { _M_ht.erase(__it); } void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } void clear() { _M_ht.clear(); } void resize(size_type __hint) { _M_ht.resize(__hint); } size_type bucket_count() const { return _M_ht.bucket_count(); } size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } size_type elems_in_bucket(size_type __n) const { return _M_ht.elems_in_bucket(__n); } }; template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc> inline bool operator==(const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1, const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2) { return __hm1._M_ht == __hm2._M_ht; } template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc> inline bool operator!=(const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1, const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2) { return !(__hm1 == __hm2); } template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc> inline void swap(hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1, hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2) { __hm1.swap(__hm2); } /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template<class _Key, class _Tp, class _HashFn = hash<_Key>, class _EqualKey = equal_to<_Key>, class _Alloc = allocator<_Tp> > class hash_multimap { // concept requirements __glibcxx_class_requires(_Key, _SGIAssignableConcept) __glibcxx_class_requires(_Tp, _SGIAssignableConcept) __glibcxx_class_requires3(_HashFn, size_t, _Key, _UnaryFunctionConcept) __glibcxx_class_requires3(_EqualKey, _Key, _Key, _BinaryPredicateConcept) private: typedef hashtable<pair<const _Key, _Tp>, _Key, _HashFn, _Select1st<pair<const _Key, _Tp> >, _EqualKey, _Alloc> _Ht; _Ht _M_ht; public: typedef typename _Ht::key_type key_type; typedef _Tp data_type; typedef _Tp mapped_type; typedef typename _Ht::value_type value_type; typedef typename _Ht::hasher hasher; typedef typename _Ht::key_equal key_equal; typedef typename _Ht::size_type size_type; typedef typename _Ht::difference_type difference_type; typedef typename _Ht::pointer pointer; typedef typename _Ht::const_pointer const_pointer; typedef typename _Ht::reference reference; typedef typename _Ht::const_reference const_reference; typedef typename _Ht::iterator iterator; typedef typename _Ht::const_iterator const_iterator; typedef typename _Ht::allocator_type allocator_type; hasher hash_funct() const { return _M_ht.hash_funct(); } key_equal key_eq() const { return _M_ht.key_eq(); } allocator_type get_allocator() const { return _M_ht.get_allocator(); } hash_multimap() : _M_ht(100, hasher(), key_equal(), allocator_type()) {} explicit hash_multimap(size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} hash_multimap(size_type __n, const hasher& __hf) : _M_ht(__n, __hf, key_equal(), allocator_type()) {} hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) {} template<class _InputIterator> hash_multimap(_InputIterator __f, _InputIterator __l) : _M_ht(100, hasher(), key_equal(), allocator_type()) { _M_ht.insert_equal(__f, __l); } template<class _InputIterator> hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type()) { _M_ht.insert_equal(__f, __l); } template<class _InputIterator> hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, const hasher& __hf) : _M_ht(__n, __hf, key_equal(), allocator_type()) { _M_ht.insert_equal(__f, __l); } template<class _InputIterator> hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) { _M_ht.insert_equal(__f, __l); } size_type size() const { return _M_ht.size(); } size_type max_size() const { return _M_ht.max_size(); } bool empty() const { return _M_ht.empty(); } void swap(hash_multimap& __hs) { _M_ht.swap(__hs._M_ht); } template<class _K1, class _T1, class _HF, class _EqK, class _Al> friend bool operator==(const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&, const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&); iterator begin() { return _M_ht.begin(); } iterator end() { return _M_ht.end(); } const_iterator begin() const { return _M_ht.begin(); } const_iterator end() const { return _M_ht.end(); } iterator insert(const value_type& __obj) { return _M_ht.insert_equal(__obj); } template<class _InputIterator> void insert(_InputIterator __f, _InputIterator __l) { _M_ht.insert_equal(__f,__l); } iterator insert_noresize(const value_type& __obj) { return _M_ht.insert_equal_noresize(__obj); } iterator find(const key_type& __key) { return _M_ht.find(__key); } const_iterator find(const key_type& __key) const { return _M_ht.find(__key); } size_type count(const key_type& __key) const { return _M_ht.count(__key); } pair<iterator, iterator> equal_range(const key_type& __key) { return _M_ht.equal_range(__key); } pair<const_iterator, const_iterator> equal_range(const key_type& __key) const { return _M_ht.equal_range(__key); } size_type erase(const key_type& __key) { return _M_ht.erase(__key); } void erase(iterator __it) { _M_ht.erase(__it); } void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } void clear() { _M_ht.clear(); } void resize(size_type __hint) { _M_ht.resize(__hint); } size_type bucket_count() const { return _M_ht.bucket_count(); } size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } size_type elems_in_bucket(size_type __n) const { return _M_ht.elems_in_bucket(__n); } }; template<class _Key, class _Tp, class _HF, class _EqKey, class _Alloc> inline bool operator==(const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1, const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2) { return __hm1._M_ht == __hm2._M_ht; } template<class _Key, class _Tp, class _HF, class _EqKey, class _Alloc> inline bool operator!=(const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1, const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2) { return !(__hm1 == __hm2); } template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc> inline void swap(hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1, hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2) { __hm1.swap(__hm2); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Specialization of insert_iterator so that it will work for hash_map // and hash_multimap. template<class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc> class insert_iterator<__gnu_cxx::hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > { protected: typedef __gnu_cxx::hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container; _Container* container; public: typedef _Container container_type; typedef output_iterator_tag iterator_category; typedef void value_type; typedef void difference_type; typedef void pointer; typedef void reference; insert_iterator(_Container& __x) : container(&__x) {} insert_iterator(_Container& __x, typename _Container::iterator) : container(&__x) {} insert_iterator<_Container>& operator=(const typename _Container::value_type& __value) { container->insert(__value); return *this; } insert_iterator<_Container>& operator*() { return *this; } insert_iterator<_Container>& operator++() { return *this; } insert_iterator<_Container>& operator++(int) { return *this; } }; template<class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc> class insert_iterator<__gnu_cxx::hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > { protected: typedef __gnu_cxx::hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container; _Container* container; typename _Container::iterator iter; public: typedef _Container container_type; typedef output_iterator_tag iterator_category; typedef void value_type; typedef void difference_type; typedef void pointer; typedef void reference; insert_iterator(_Container& __x) : container(&__x) {} insert_iterator(_Container& __x, typename _Container::iterator) : container(&__x) {} insert_iterator<_Container>& operator=(const typename _Container::value_type& __value) { container->insert(__value); return *this; } insert_iterator<_Container>& operator*() { return *this; } insert_iterator<_Container>& operator++() { return *this; } insert_iterator<_Container>& operator++(int) { return *this; } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif �������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/backward/binders.h������������������������������������������������������������������������0000644�����������������00000015535�14763166027�0011167 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Functor implementations -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996-1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file backward/binders.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{functional} */ #ifndef _BACKWARD_BINDERS_H #define _BACKWARD_BINDERS_H 1 namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // 20.3.6 binders /** @defgroup binders Binder Classes * @ingroup functors * * Binders turn functions/functors with two arguments into functors * with a single argument, storing an argument to be applied later. * For example, a variable @c B of type @c binder1st is constructed * from a functor @c f and an argument @c x. Later, B's @c * operator() is called with a single argument @c y. The return * value is the value of @c f(x,y). @c B can be @a called with * various arguments (y1, y2, ...) and will in turn call @c * f(x,y1), @c f(x,y2), ... * * The function @c bind1st is provided to save some typing. It takes the * function and an argument as parameters, and returns an instance of * @c binder1st. * * The type @c binder2nd and its creator function @c bind2nd do the same * thing, but the stored argument is passed as the second parameter instead * of the first, e.g., @c bind2nd(std::minus<float>(),1.3) will create a * functor whose @c operator() accepts a floating-point number, subtracts * 1.3 from it, and returns the result. (If @c bind1st had been used, * the functor would perform <em>1.3 - x</em> instead. * * Creator-wrapper functions like @c bind1st are intended to be used in * calling algorithms. Their return values will be temporary objects. * (The goal is to not require you to type names like * @c std::binder1st<std::plus<int>> for declaring a variable to hold the * return value from @c bind1st(std::plus<int>(),5). * * These become more useful when combined with the composition functions. * * These functions are deprecated in C++11 and can be replaced by * @c std::bind (or @c std::tr1::bind) which is more powerful and flexible, * supporting functions with any number of arguments. Uses of @c bind1st * can be replaced by @c std::bind(f, x, std::placeholders::_1) and * @c bind2nd by @c std::bind(f, std::placeholders::_1, x). * @{ */ /// One of the @link binders binder functors@endlink. template<typename _Operation> class binder1st : public unary_function<typename _Operation::second_argument_type, typename _Operation::result_type> { protected: _Operation op; typename _Operation::first_argument_type value; public: binder1st(const _Operation& __x, const typename _Operation::first_argument_type& __y) : op(__x), value(__y) { } typename _Operation::result_type operator()(const typename _Operation::second_argument_type& __x) const { return op(value, __x); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 109. Missing binders for non-const sequence elements typename _Operation::result_type operator()(typename _Operation::second_argument_type& __x) const { return op(value, __x); } } _GLIBCXX_DEPRECATED; /// One of the @link binders binder functors@endlink. template<typename _Operation, typename _Tp> inline binder1st<_Operation> bind1st(const _Operation& __fn, const _Tp& __x) { typedef typename _Operation::first_argument_type _Arg1_type; return binder1st<_Operation>(__fn, _Arg1_type(__x)); } /// One of the @link binders binder functors@endlink. template<typename _Operation> class binder2nd : public unary_function<typename _Operation::first_argument_type, typename _Operation::result_type> { protected: _Operation op; typename _Operation::second_argument_type value; public: binder2nd(const _Operation& __x, const typename _Operation::second_argument_type& __y) : op(__x), value(__y) { } typename _Operation::result_type operator()(const typename _Operation::first_argument_type& __x) const { return op(__x, value); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 109. Missing binders for non-const sequence elements typename _Operation::result_type operator()(typename _Operation::first_argument_type& __x) const { return op(__x, value); } } _GLIBCXX_DEPRECATED; /// One of the @link binders binder functors@endlink. template<typename _Operation, typename _Tp> inline binder2nd<_Operation> bind2nd(const _Operation& __fn, const _Tp& __x) { typedef typename _Operation::second_argument_type _Arg2_type; return binder2nd<_Operation>(__fn, _Arg2_type(__x)); } /** @} */ _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _BACKWARD_BINDERS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/backward/hash_fun.h�����������������������������������������������������������������������0000644�����������������00000010230�14763166027�0011317 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// 'struct hash' from SGI -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * Copyright (c) 1996-1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * */ /** @file backward/hash_fun.h * This file is a GNU extension to the Standard C++ Library (possibly * containing extensions from the HP/SGI STL subset). */ #ifndef _BACKWARD_HASH_FUN_H #define _BACKWARD_HASH_FUN_H 1 #include <bits/c++config.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using std::size_t; template<class _Key> struct hash { }; inline size_t __stl_hash_string(const char* __s) { unsigned long __h = 0; for ( ; *__s; ++__s) __h = 5 * __h + *__s; return size_t(__h); } template<> struct hash<char*> { size_t operator()(const char* __s) const { return __stl_hash_string(__s); } }; template<> struct hash<const char*> { size_t operator()(const char* __s) const { return __stl_hash_string(__s); } }; template<> struct hash<char> { size_t operator()(char __x) const { return __x; } }; template<> struct hash<unsigned char> { size_t operator()(unsigned char __x) const { return __x; } }; template<> struct hash<signed char> { size_t operator()(unsigned char __x) const { return __x; } }; template<> struct hash<short> { size_t operator()(short __x) const { return __x; } }; template<> struct hash<unsigned short> { size_t operator()(unsigned short __x) const { return __x; } }; template<> struct hash<int> { size_t operator()(int __x) const { return __x; } }; template<> struct hash<unsigned int> { size_t operator()(unsigned int __x) const { return __x; } }; template<> struct hash<long> { size_t operator()(long __x) const { return __x; } }; template<> struct hash<unsigned long> { size_t operator()(unsigned long __x) const { return __x; } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/backward/auto_ptr.h�����������������������������������������������������������������������0000644�����������������00000024434�14763166027�0011374 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// auto_ptr implementation -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file backward/auto_ptr.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{memory} */ #ifndef _BACKWARD_AUTO_PTR_H #define _BACKWARD_AUTO_PTR_H 1 #include <bits/c++config.h> #include <debug/debug.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * A wrapper class to provide auto_ptr with reference semantics. * For example, an auto_ptr can be assigned (or constructed from) * the result of a function which returns an auto_ptr by value. * * All the auto_ptr_ref stuff should happen behind the scenes. */ template<typename _Tp1> struct auto_ptr_ref { _Tp1* _M_ptr; explicit auto_ptr_ref(_Tp1* __p): _M_ptr(__p) { } } _GLIBCXX_DEPRECATED; /** * @brief A simple smart pointer providing strict ownership semantics. * * The Standard says: * <pre> * An @c auto_ptr owns the object it holds a pointer to. Copying * an @c auto_ptr copies the pointer and transfers ownership to the * destination. If more than one @c auto_ptr owns the same object * at the same time the behavior of the program is undefined. * * The uses of @c auto_ptr include providing temporary * exception-safety for dynamically allocated memory, passing * ownership of dynamically allocated memory to a function, and * returning dynamically allocated memory from a function. @c * auto_ptr does not meet the CopyConstructible and Assignable * requirements for Standard Library <a * href="tables.html#65">container</a> elements and thus * instantiating a Standard Library container with an @c auto_ptr * results in undefined behavior. * </pre> * Quoted from [20.4.5]/3. * * Good examples of what can and cannot be done with auto_ptr can * be found in the libstdc++ testsuite. * * _GLIBCXX_RESOLVE_LIB_DEFECTS * 127. auto_ptr<> conversion issues * These resolutions have all been incorporated. */ template<typename _Tp> class auto_ptr { private: _Tp* _M_ptr; public: /// The pointed-to type. typedef _Tp element_type; /** * @brief An %auto_ptr is usually constructed from a raw pointer. * @param __p A pointer (defaults to NULL). * * This object now @e owns the object pointed to by @a __p. */ explicit auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { } /** * @brief An %auto_ptr can be constructed from another %auto_ptr. * @param __a Another %auto_ptr of the same type. * * This object now @e owns the object previously owned by @a __a, * which has given up ownership. */ auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) { } /** * @brief An %auto_ptr can be constructed from another %auto_ptr. * @param __a Another %auto_ptr of a different but related type. * * A pointer-to-Tp1 must be convertible to a * pointer-to-Tp/element_type. * * This object now @e owns the object previously owned by @a __a, * which has given up ownership. */ template<typename _Tp1> auto_ptr(auto_ptr<_Tp1>& __a) throw() : _M_ptr(__a.release()) { } /** * @brief %auto_ptr assignment operator. * @param __a Another %auto_ptr of the same type. * * This object now @e owns the object previously owned by @a __a, * which has given up ownership. The object that this one @e * used to own and track has been deleted. */ auto_ptr& operator=(auto_ptr& __a) throw() { reset(__a.release()); return *this; } /** * @brief %auto_ptr assignment operator. * @param __a Another %auto_ptr of a different but related type. * * A pointer-to-Tp1 must be convertible to a pointer-to-Tp/element_type. * * This object now @e owns the object previously owned by @a __a, * which has given up ownership. The object that this one @e * used to own and track has been deleted. */ template<typename _Tp1> auto_ptr& operator=(auto_ptr<_Tp1>& __a) throw() { reset(__a.release()); return *this; } /** * When the %auto_ptr goes out of scope, the object it owns is * deleted. If it no longer owns anything (i.e., @c get() is * @c NULL), then this has no effect. * * The C++ standard says there is supposed to be an empty throw * specification here, but omitting it is standard conforming. Its * presence can be detected only if _Tp::~_Tp() throws, but this is * prohibited. [17.4.3.6]/2 */ ~auto_ptr() { delete _M_ptr; } /** * @brief Smart pointer dereferencing. * * If this %auto_ptr no longer owns anything, then this * operation will crash. (For a smart pointer, <em>no longer owns * anything</em> is the same as being a null pointer, and you know * what happens when you dereference one of those...) */ element_type& operator*() const throw() { _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); return *_M_ptr; } /** * @brief Smart pointer dereferencing. * * This returns the pointer itself, which the language then will * automatically cause to be dereferenced. */ element_type* operator->() const throw() { _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); return _M_ptr; } /** * @brief Bypassing the smart pointer. * @return The raw pointer being managed. * * You can get a copy of the pointer that this object owns, for * situations such as passing to a function which only accepts * a raw pointer. * * @note This %auto_ptr still owns the memory. */ element_type* get() const throw() { return _M_ptr; } /** * @brief Bypassing the smart pointer. * @return The raw pointer being managed. * * You can get a copy of the pointer that this object owns, for * situations such as passing to a function which only accepts * a raw pointer. * * @note This %auto_ptr no longer owns the memory. When this object * goes out of scope, nothing will happen. */ element_type* release() throw() { element_type* __tmp = _M_ptr; _M_ptr = 0; return __tmp; } /** * @brief Forcibly deletes the managed object. * @param __p A pointer (defaults to NULL). * * This object now @e owns the object pointed to by @a __p. The * previous object has been deleted. */ void reset(element_type* __p = 0) throw() { if (__p != _M_ptr) { delete _M_ptr; _M_ptr = __p; } } /** * @brief Automatic conversions * * These operations convert an %auto_ptr into and from an auto_ptr_ref * automatically as needed. This allows constructs such as * @code * auto_ptr<Derived> func_returning_auto_ptr(.....); * ... * auto_ptr<Base> ptr = func_returning_auto_ptr(.....); * @endcode */ auto_ptr(auto_ptr_ref<element_type> __ref) throw() : _M_ptr(__ref._M_ptr) { } auto_ptr& operator=(auto_ptr_ref<element_type> __ref) throw() { if (__ref._M_ptr != this->get()) { delete _M_ptr; _M_ptr = __ref._M_ptr; } return *this; } template<typename _Tp1> operator auto_ptr_ref<_Tp1>() throw() { return auto_ptr_ref<_Tp1>(this->release()); } template<typename _Tp1> operator auto_ptr<_Tp1>() throw() { return auto_ptr<_Tp1>(this->release()); } } _GLIBCXX_DEPRECATED; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 541. shared_ptr template assignment and void template<> class auto_ptr<void> { public: typedef void element_type; } _GLIBCXX_DEPRECATED; #if __cplusplus >= 201103L template<_Lock_policy _Lp> template<typename _Tp> inline __shared_count<_Lp>::__shared_count(std::auto_ptr<_Tp>&& __r) : _M_pi(new _Sp_counted_ptr<_Tp*, _Lp>(__r.get())) { __r.release(); } template<typename _Tp, _Lock_policy _Lp> template<typename _Tp1> inline __shared_ptr<_Tp, _Lp>::__shared_ptr(std::auto_ptr<_Tp1>&& __r) : _M_ptr(__r.get()), _M_refcount() { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) static_assert( sizeof(_Tp1) > 0, "incomplete type" ); _Tp1* __tmp = __r.get(); _M_refcount = __shared_count<_Lp>(std::move(__r)); __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp); } template<typename _Tp> template<typename _Tp1> inline shared_ptr<_Tp>::shared_ptr(std::auto_ptr<_Tp1>&& __r) : __shared_ptr<_Tp>(std::move(__r)) { } template<typename _Tp, typename _Dp> template<typename _Up, typename> inline unique_ptr<_Tp, _Dp>::unique_ptr(auto_ptr<_Up>&& __u) noexcept : _M_t(__u.release(), deleter_type()) { } #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _BACKWARD_AUTO_PTR_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/backward/backward_warning.h���������������������������������������������������������������0000644�����������������00000004673�14763166027�0013045 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file backward/backward_warning.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{iosfwd} */ #ifndef _BACKWARD_BACKWARD_WARNING_H #define _BACKWARD_BACKWARD_WARNING_H 1 #ifdef __DEPRECATED #warning \ This file includes at least one deprecated or antiquated header which \ may be removed without further notice at a future date. Please use a \ non-deprecated interface with equivalent functionality instead. For a \ listing of replacement headers and interfaces, consult the file \ backward_warning.h. To disable this warning use -Wno-deprecated. /* A list of valid replacements is as follows: Use: Instead of: <sstream>, basic_stringbuf <strstream>, strstreambuf <sstream>, basic_istringstream <strstream>, istrstream <sstream>, basic_ostringstream <strstream>, ostrstream <sstream>, basic_stringstream <strstream>, strstream <unordered_set>, unordered_set <ext/hash_set>, hash_set <unordered_set>, unordered_multiset <ext/hash_set>, hash_multiset <unordered_map>, unordered_map <ext/hash_map>, hash_map <unordered_map>, unordered_multimap <ext/hash_map>, hash_multimap <functional>, bind <functional>, binder1st <functional>, bind <functional>, binder2nd <functional>, bind <functional>, bind1st <functional>, bind <functional>, bind2nd <memory>, unique_ptr <memory>, auto_ptr */ #endif #endif ���������������������������������������������������������������������c++/4.8.2/backward/strstream������������������������������������������������������������������������0000644�����������������00000013432�14763166027�0011331 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Backward-compat support -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * Copyright (c) 1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ // WARNING: The classes defined in this header are DEPRECATED. This // header is defined in section D.7.1 of the C++ standard, and it // MAY BE REMOVED in a future standard revision. One should use the // header <sstream> instead. /** @file backward/strstream * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{sstream} */ #ifndef _BACKWARD_STRSTREAM #define _BACKWARD_STRSTREAM #include "backward_warning.h" #include <iosfwd> #include <ios> #include <istream> #include <ostream> #include <string> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Class strstreambuf, a streambuf class that manages an array of char. // Note that this class is not a template. class strstreambuf : public basic_streambuf<char, char_traits<char> > { public: // Types. typedef char_traits<char> _Traits; typedef basic_streambuf<char, _Traits> _Base; public: // Constructor, destructor explicit strstreambuf(streamsize __initial_capacity = 0); strstreambuf(void* (*__alloc)(size_t), void (*__free)(void*)); strstreambuf(char* __get, streamsize __n, char* __put = 0) throw (); strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0) throw (); strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0) throw (); strstreambuf(const char* __get, streamsize __n) throw (); strstreambuf(const signed char* __get, streamsize __n) throw (); strstreambuf(const unsigned char* __get, streamsize __n) throw (); virtual ~strstreambuf(); public: void freeze(bool = true) throw (); char* str() throw (); _GLIBCXX_PURE int pcount() const throw (); protected: virtual int_type overflow(int_type __c = _Traits::eof()); virtual int_type pbackfail(int_type __c = _Traits::eof()); virtual int_type underflow(); virtual _Base* setbuf(char* __buf, streamsize __n); virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir, ios_base::openmode __mode = ios_base::in | ios_base::out); virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode = ios_base::in | ios_base::out); private: strstreambuf& operator=(const strstreambuf&); strstreambuf(const strstreambuf&); // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun. char* _M_alloc(size_t); void _M_free(char*); // Helper function used in constructors. void _M_setup(char* __get, char* __put, streamsize __n) throw (); private: // Data members. void* (*_M_alloc_fun)(size_t); void (*_M_free_fun)(void*); bool _M_dynamic : 1; bool _M_frozen : 1; bool _M_constant : 1; }; // Class istrstream, an istream that manages a strstreambuf. class istrstream : public basic_istream<char> { public: explicit istrstream(char*); explicit istrstream(const char*); istrstream(char* , streamsize); istrstream(const char*, streamsize); virtual ~istrstream(); _GLIBCXX_CONST strstreambuf* rdbuf() const throw (); char* str() throw (); private: strstreambuf _M_buf; }; // Class ostrstream class ostrstream : public basic_ostream<char> { public: ostrstream(); ostrstream(char*, int, ios_base::openmode = ios_base::out); virtual ~ostrstream(); _GLIBCXX_CONST strstreambuf* rdbuf() const throw (); void freeze(bool = true) throw(); char* str() throw (); _GLIBCXX_PURE int pcount() const throw (); private: strstreambuf _M_buf; }; // Class strstream class strstream : public basic_iostream<char> { public: typedef char char_type; typedef char_traits<char>::int_type int_type; typedef char_traits<char>::pos_type pos_type; typedef char_traits<char>::off_type off_type; strstream(); strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out); virtual ~strstream(); _GLIBCXX_CONST strstreambuf* rdbuf() const throw (); void freeze(bool = true) throw (); _GLIBCXX_PURE int pcount() const throw (); char* str() throw (); private: strstreambuf _M_buf; }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/backward/hashtable.h����������������������������������������������������������������������0000644�����������������00000101667�14763166027�0011476 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Hashtable implementation used by containers -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * */ /** @file backward/hashtable.h * This file is a GNU extension to the Standard C++ Library (possibly * containing extensions from the HP/SGI STL subset). */ #ifndef _BACKWARD_HASHTABLE_H #define _BACKWARD_HASHTABLE_H 1 // Hashtable class, used to implement the hashed associative containers // hash_set, hash_map, hash_multiset, and hash_multimap. #include <vector> #include <iterator> #include <algorithm> #include <bits/stl_function.h> #include <backward/hash_fun.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using std::size_t; using std::ptrdiff_t; using std::forward_iterator_tag; using std::input_iterator_tag; using std::_Construct; using std::_Destroy; using std::distance; using std::vector; using std::pair; using std::__iterator_category; template<class _Val> struct _Hashtable_node { _Hashtable_node* _M_next; _Val _M_val; }; template<class _Val, class _Key, class _HashFcn, class _ExtractKey, class _EqualKey, class _Alloc = std::allocator<_Val> > class hashtable; template<class _Val, class _Key, class _HashFcn, class _ExtractKey, class _EqualKey, class _Alloc> struct _Hashtable_iterator; template<class _Val, class _Key, class _HashFcn, class _ExtractKey, class _EqualKey, class _Alloc> struct _Hashtable_const_iterator; template<class _Val, class _Key, class _HashFcn, class _ExtractKey, class _EqualKey, class _Alloc> struct _Hashtable_iterator { typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc> _Hashtable; typedef _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc> iterator; typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc> const_iterator; typedef _Hashtable_node<_Val> _Node; typedef forward_iterator_tag iterator_category; typedef _Val value_type; typedef ptrdiff_t difference_type; typedef size_t size_type; typedef _Val& reference; typedef _Val* pointer; _Node* _M_cur; _Hashtable* _M_ht; _Hashtable_iterator(_Node* __n, _Hashtable* __tab) : _M_cur(__n), _M_ht(__tab) { } _Hashtable_iterator() { } reference operator*() const { return _M_cur->_M_val; } pointer operator->() const { return &(operator*()); } iterator& operator++(); iterator operator++(int); bool operator==(const iterator& __it) const { return _M_cur == __it._M_cur; } bool operator!=(const iterator& __it) const { return _M_cur != __it._M_cur; } }; template<class _Val, class _Key, class _HashFcn, class _ExtractKey, class _EqualKey, class _Alloc> struct _Hashtable_const_iterator { typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc> _Hashtable; typedef _Hashtable_iterator<_Val,_Key,_HashFcn, _ExtractKey,_EqualKey,_Alloc> iterator; typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc> const_iterator; typedef _Hashtable_node<_Val> _Node; typedef forward_iterator_tag iterator_category; typedef _Val value_type; typedef ptrdiff_t difference_type; typedef size_t size_type; typedef const _Val& reference; typedef const _Val* pointer; const _Node* _M_cur; const _Hashtable* _M_ht; _Hashtable_const_iterator(const _Node* __n, const _Hashtable* __tab) : _M_cur(__n), _M_ht(__tab) { } _Hashtable_const_iterator() { } _Hashtable_const_iterator(const iterator& __it) : _M_cur(__it._M_cur), _M_ht(__it._M_ht) { } reference operator*() const { return _M_cur->_M_val; } pointer operator->() const { return &(operator*()); } const_iterator& operator++(); const_iterator operator++(int); bool operator==(const const_iterator& __it) const { return _M_cur == __it._M_cur; } bool operator!=(const const_iterator& __it) const { return _M_cur != __it._M_cur; } }; // Note: assumes long is at least 32 bits. enum { _S_num_primes = 29 }; template<typename _PrimeType> struct _Hashtable_prime_list { static const _PrimeType __stl_prime_list[_S_num_primes]; static const _PrimeType* _S_get_prime_list(); }; template<typename _PrimeType> const _PrimeType _Hashtable_prime_list<_PrimeType>::__stl_prime_list[_S_num_primes] = { 5ul, 53ul, 97ul, 193ul, 389ul, 769ul, 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul, 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul, 1610612741ul, 3221225473ul, 4294967291ul }; template<class _PrimeType> inline const _PrimeType* _Hashtable_prime_list<_PrimeType>::_S_get_prime_list() { return __stl_prime_list; } inline unsigned long __stl_next_prime(unsigned long __n) { const unsigned long* __first = _Hashtable_prime_list<unsigned long>::_S_get_prime_list(); const unsigned long* __last = __first + (int)_S_num_primes; const unsigned long* pos = std::lower_bound(__first, __last, __n); return pos == __last ? *(__last - 1) : *pos; } // Forward declaration of operator==. template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> class hashtable; template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> bool operator==(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1, const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2); // Hashtables handle allocators a bit differently than other // containers do. If we're using standard-conforming allocators, then // a hashtable unconditionally has a member variable to hold its // allocator, even if it so happens that all instances of the // allocator type are identical. This is because, for hashtables, // this extra storage is negligible. Additionally, a base class // wouldn't serve any other purposes; it wouldn't, for example, // simplify the exception-handling code. template<class _Val, class _Key, class _HashFcn, class _ExtractKey, class _EqualKey, class _Alloc> class hashtable { public: typedef _Key key_type; typedef _Val value_type; typedef _HashFcn hasher; typedef _EqualKey key_equal; typedef size_t size_type; typedef ptrdiff_t difference_type; typedef value_type* pointer; typedef const value_type* const_pointer; typedef value_type& reference; typedef const value_type& const_reference; hasher hash_funct() const { return _M_hash; } key_equal key_eq() const { return _M_equals; } private: typedef _Hashtable_node<_Val> _Node; public: typedef typename _Alloc::template rebind<value_type>::other allocator_type; allocator_type get_allocator() const { return _M_node_allocator; } private: typedef typename _Alloc::template rebind<_Node>::other _Node_Alloc; typedef typename _Alloc::template rebind<_Node*>::other _Nodeptr_Alloc; typedef vector<_Node*, _Nodeptr_Alloc> _Vector_type; _Node_Alloc _M_node_allocator; _Node* _M_get_node() { return _M_node_allocator.allocate(1); } void _M_put_node(_Node* __p) { _M_node_allocator.deallocate(__p, 1); } private: hasher _M_hash; key_equal _M_equals; _ExtractKey _M_get_key; _Vector_type _M_buckets; size_type _M_num_elements; public: typedef _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc> iterator; typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc> const_iterator; friend struct _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>; friend struct _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>; public: hashtable(size_type __n, const _HashFcn& __hf, const _EqualKey& __eql, const _ExtractKey& __ext, const allocator_type& __a = allocator_type()) : _M_node_allocator(__a), _M_hash(__hf), _M_equals(__eql), _M_get_key(__ext), _M_buckets(__a), _M_num_elements(0) { _M_initialize_buckets(__n); } hashtable(size_type __n, const _HashFcn& __hf, const _EqualKey& __eql, const allocator_type& __a = allocator_type()) : _M_node_allocator(__a), _M_hash(__hf), _M_equals(__eql), _M_get_key(_ExtractKey()), _M_buckets(__a), _M_num_elements(0) { _M_initialize_buckets(__n); } hashtable(const hashtable& __ht) : _M_node_allocator(__ht.get_allocator()), _M_hash(__ht._M_hash), _M_equals(__ht._M_equals), _M_get_key(__ht._M_get_key), _M_buckets(__ht.get_allocator()), _M_num_elements(0) { _M_copy_from(__ht); } hashtable& operator= (const hashtable& __ht) { if (&__ht != this) { clear(); _M_hash = __ht._M_hash; _M_equals = __ht._M_equals; _M_get_key = __ht._M_get_key; _M_copy_from(__ht); } return *this; } ~hashtable() { clear(); } size_type size() const { return _M_num_elements; } size_type max_size() const { return size_type(-1); } bool empty() const { return size() == 0; } void swap(hashtable& __ht) { std::swap(_M_hash, __ht._M_hash); std::swap(_M_equals, __ht._M_equals); std::swap(_M_get_key, __ht._M_get_key); _M_buckets.swap(__ht._M_buckets); std::swap(_M_num_elements, __ht._M_num_elements); } iterator begin() { for (size_type __n = 0; __n < _M_buckets.size(); ++__n) if (_M_buckets[__n]) return iterator(_M_buckets[__n], this); return end(); } iterator end() { return iterator(0, this); } const_iterator begin() const { for (size_type __n = 0; __n < _M_buckets.size(); ++__n) if (_M_buckets[__n]) return const_iterator(_M_buckets[__n], this); return end(); } const_iterator end() const { return const_iterator(0, this); } template<class _Vl, class _Ky, class _HF, class _Ex, class _Eq, class _Al> friend bool operator==(const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&, const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&); public: size_type bucket_count() const { return _M_buckets.size(); } size_type max_bucket_count() const { return _Hashtable_prime_list<unsigned long>:: _S_get_prime_list()[(int)_S_num_primes - 1]; } size_type elems_in_bucket(size_type __bucket) const { size_type __result = 0; for (_Node* __n = _M_buckets[__bucket]; __n; __n = __n->_M_next) __result += 1; return __result; } pair<iterator, bool> insert_unique(const value_type& __obj) { resize(_M_num_elements + 1); return insert_unique_noresize(__obj); } iterator insert_equal(const value_type& __obj) { resize(_M_num_elements + 1); return insert_equal_noresize(__obj); } pair<iterator, bool> insert_unique_noresize(const value_type& __obj); iterator insert_equal_noresize(const value_type& __obj); template<class _InputIterator> void insert_unique(_InputIterator __f, _InputIterator __l) { insert_unique(__f, __l, __iterator_category(__f)); } template<class _InputIterator> void insert_equal(_InputIterator __f, _InputIterator __l) { insert_equal(__f, __l, __iterator_category(__f)); } template<class _InputIterator> void insert_unique(_InputIterator __f, _InputIterator __l, input_iterator_tag) { for ( ; __f != __l; ++__f) insert_unique(*__f); } template<class _InputIterator> void insert_equal(_InputIterator __f, _InputIterator __l, input_iterator_tag) { for ( ; __f != __l; ++__f) insert_equal(*__f); } template<class _ForwardIterator> void insert_unique(_ForwardIterator __f, _ForwardIterator __l, forward_iterator_tag) { size_type __n = distance(__f, __l); resize(_M_num_elements + __n); for ( ; __n > 0; --__n, ++__f) insert_unique_noresize(*__f); } template<class _ForwardIterator> void insert_equal(_ForwardIterator __f, _ForwardIterator __l, forward_iterator_tag) { size_type __n = distance(__f, __l); resize(_M_num_elements + __n); for ( ; __n > 0; --__n, ++__f) insert_equal_noresize(*__f); } reference find_or_insert(const value_type& __obj); iterator find(const key_type& __key) { size_type __n = _M_bkt_num_key(__key); _Node* __first; for (__first = _M_buckets[__n]; __first && !_M_equals(_M_get_key(__first->_M_val), __key); __first = __first->_M_next) { } return iterator(__first, this); } const_iterator find(const key_type& __key) const { size_type __n = _M_bkt_num_key(__key); const _Node* __first; for (__first = _M_buckets[__n]; __first && !_M_equals(_M_get_key(__first->_M_val), __key); __first = __first->_M_next) { } return const_iterator(__first, this); } size_type count(const key_type& __key) const { const size_type __n = _M_bkt_num_key(__key); size_type __result = 0; for (const _Node* __cur = _M_buckets[__n]; __cur; __cur = __cur->_M_next) if (_M_equals(_M_get_key(__cur->_M_val), __key)) ++__result; return __result; } pair<iterator, iterator> equal_range(const key_type& __key); pair<const_iterator, const_iterator> equal_range(const key_type& __key) const; size_type erase(const key_type& __key); void erase(const iterator& __it); void erase(iterator __first, iterator __last); void erase(const const_iterator& __it); void erase(const_iterator __first, const_iterator __last); void resize(size_type __num_elements_hint); void clear(); private: size_type _M_next_size(size_type __n) const { return __stl_next_prime(__n); } void _M_initialize_buckets(size_type __n) { const size_type __n_buckets = _M_next_size(__n); _M_buckets.reserve(__n_buckets); _M_buckets.insert(_M_buckets.end(), __n_buckets, (_Node*) 0); _M_num_elements = 0; } size_type _M_bkt_num_key(const key_type& __key) const { return _M_bkt_num_key(__key, _M_buckets.size()); } size_type _M_bkt_num(const value_type& __obj) const { return _M_bkt_num_key(_M_get_key(__obj)); } size_type _M_bkt_num_key(const key_type& __key, size_t __n) const { return _M_hash(__key) % __n; } size_type _M_bkt_num(const value_type& __obj, size_t __n) const { return _M_bkt_num_key(_M_get_key(__obj), __n); } _Node* _M_new_node(const value_type& __obj) { _Node* __n = _M_get_node(); __n->_M_next = 0; __try { this->get_allocator().construct(&__n->_M_val, __obj); return __n; } __catch(...) { _M_put_node(__n); __throw_exception_again; } } void _M_delete_node(_Node* __n) { this->get_allocator().destroy(&__n->_M_val); _M_put_node(__n); } void _M_erase_bucket(const size_type __n, _Node* __first, _Node* __last); void _M_erase_bucket(const size_type __n, _Node* __last); void _M_copy_from(const hashtable& __ht); }; template<class _Val, class _Key, class _HF, class _ExK, class _EqK, class _All> _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>& _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>:: operator++() { const _Node* __old = _M_cur; _M_cur = _M_cur->_M_next; if (!_M_cur) { size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val); while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size()) _M_cur = _M_ht->_M_buckets[__bucket]; } return *this; } template<class _Val, class _Key, class _HF, class _ExK, class _EqK, class _All> inline _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All> _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>:: operator++(int) { iterator __tmp = *this; ++*this; return __tmp; } template<class _Val, class _Key, class _HF, class _ExK, class _EqK, class _All> _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>& _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>:: operator++() { const _Node* __old = _M_cur; _M_cur = _M_cur->_M_next; if (!_M_cur) { size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val); while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size()) _M_cur = _M_ht->_M_buckets[__bucket]; } return *this; } template<class _Val, class _Key, class _HF, class _ExK, class _EqK, class _All> inline _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All> _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>:: operator++(int) { const_iterator __tmp = *this; ++*this; return __tmp; } template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> bool operator==(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1, const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2) { typedef typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::_Node _Node; if (__ht1._M_buckets.size() != __ht2._M_buckets.size()) return false; for (size_t __n = 0; __n < __ht1._M_buckets.size(); ++__n) { _Node* __cur1 = __ht1._M_buckets[__n]; _Node* __cur2 = __ht2._M_buckets[__n]; // Check same length of lists for (; __cur1 && __cur2; __cur1 = __cur1->_M_next, __cur2 = __cur2->_M_next) { } if (__cur1 || __cur2) return false; // Now check one's elements are in the other for (__cur1 = __ht1._M_buckets[__n] ; __cur1; __cur1 = __cur1->_M_next) { bool _found__cur1 = false; for (__cur2 = __ht2._M_buckets[__n]; __cur2; __cur2 = __cur2->_M_next) { if (__cur1->_M_val == __cur2->_M_val) { _found__cur1 = true; break; } } if (!_found__cur1) return false; } } return true; } template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> inline bool operator!=(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1, const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2) { return !(__ht1 == __ht2); } template<class _Val, class _Key, class _HF, class _Extract, class _EqKey, class _All> inline void swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1, hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht2) { __ht1.swap(__ht2); } template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator, bool> hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: insert_unique_noresize(const value_type& __obj) { const size_type __n = _M_bkt_num(__obj); _Node* __first = _M_buckets[__n]; for (_Node* __cur = __first; __cur; __cur = __cur->_M_next) if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) return pair<iterator, bool>(iterator(__cur, this), false); _Node* __tmp = _M_new_node(__obj); __tmp->_M_next = __first; _M_buckets[__n] = __tmp; ++_M_num_elements; return pair<iterator, bool>(iterator(__tmp, this), true); } template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: insert_equal_noresize(const value_type& __obj) { const size_type __n = _M_bkt_num(__obj); _Node* __first = _M_buckets[__n]; for (_Node* __cur = __first; __cur; __cur = __cur->_M_next) if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) { _Node* __tmp = _M_new_node(__obj); __tmp->_M_next = __cur->_M_next; __cur->_M_next = __tmp; ++_M_num_elements; return iterator(__tmp, this); } _Node* __tmp = _M_new_node(__obj); __tmp->_M_next = __first; _M_buckets[__n] = __tmp; ++_M_num_elements; return iterator(__tmp, this); } template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::reference hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: find_or_insert(const value_type& __obj) { resize(_M_num_elements + 1); size_type __n = _M_bkt_num(__obj); _Node* __first = _M_buckets[__n]; for (_Node* __cur = __first; __cur; __cur = __cur->_M_next) if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) return __cur->_M_val; _Node* __tmp = _M_new_node(__obj); __tmp->_M_next = __first; _M_buckets[__n] = __tmp; ++_M_num_elements; return __tmp->_M_val; } template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator, typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator> hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: equal_range(const key_type& __key) { typedef pair<iterator, iterator> _Pii; const size_type __n = _M_bkt_num_key(__key); for (_Node* __first = _M_buckets[__n]; __first; __first = __first->_M_next) if (_M_equals(_M_get_key(__first->_M_val), __key)) { for (_Node* __cur = __first->_M_next; __cur; __cur = __cur->_M_next) if (!_M_equals(_M_get_key(__cur->_M_val), __key)) return _Pii(iterator(__first, this), iterator(__cur, this)); for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m) if (_M_buckets[__m]) return _Pii(iterator(__first, this), iterator(_M_buckets[__m], this)); return _Pii(iterator(__first, this), end()); } return _Pii(end(), end()); } template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::const_iterator, typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::const_iterator> hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: equal_range(const key_type& __key) const { typedef pair<const_iterator, const_iterator> _Pii; const size_type __n = _M_bkt_num_key(__key); for (const _Node* __first = _M_buckets[__n]; __first; __first = __first->_M_next) { if (_M_equals(_M_get_key(__first->_M_val), __key)) { for (const _Node* __cur = __first->_M_next; __cur; __cur = __cur->_M_next) if (!_M_equals(_M_get_key(__cur->_M_val), __key)) return _Pii(const_iterator(__first, this), const_iterator(__cur, this)); for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m) if (_M_buckets[__m]) return _Pii(const_iterator(__first, this), const_iterator(_M_buckets[__m], this)); return _Pii(const_iterator(__first, this), end()); } } return _Pii(end(), end()); } template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::size_type hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: erase(const key_type& __key) { const size_type __n = _M_bkt_num_key(__key); _Node* __first = _M_buckets[__n]; _Node* __saved_slot = 0; size_type __erased = 0; if (__first) { _Node* __cur = __first; _Node* __next = __cur->_M_next; while (__next) { if (_M_equals(_M_get_key(__next->_M_val), __key)) { if (&_M_get_key(__next->_M_val) != &__key) { __cur->_M_next = __next->_M_next; _M_delete_node(__next); __next = __cur->_M_next; ++__erased; --_M_num_elements; } else { __saved_slot = __cur; __cur = __next; __next = __cur->_M_next; } } else { __cur = __next; __next = __cur->_M_next; } } bool __delete_first = _M_equals(_M_get_key(__first->_M_val), __key); if (__saved_slot) { __next = __saved_slot->_M_next; __saved_slot->_M_next = __next->_M_next; _M_delete_node(__next); ++__erased; --_M_num_elements; } if (__delete_first) { _M_buckets[__n] = __first->_M_next; _M_delete_node(__first); ++__erased; --_M_num_elements; } } return __erased; } template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: erase(const iterator& __it) { _Node* __p = __it._M_cur; if (__p) { const size_type __n = _M_bkt_num(__p->_M_val); _Node* __cur = _M_buckets[__n]; if (__cur == __p) { _M_buckets[__n] = __cur->_M_next; _M_delete_node(__cur); --_M_num_elements; } else { _Node* __next = __cur->_M_next; while (__next) { if (__next == __p) { __cur->_M_next = __next->_M_next; _M_delete_node(__next); --_M_num_elements; break; } else { __cur = __next; __next = __cur->_M_next; } } } } } template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: erase(iterator __first, iterator __last) { size_type __f_bucket = __first._M_cur ? _M_bkt_num(__first._M_cur->_M_val) : _M_buckets.size(); size_type __l_bucket = __last._M_cur ? _M_bkt_num(__last._M_cur->_M_val) : _M_buckets.size(); if (__first._M_cur == __last._M_cur) return; else if (__f_bucket == __l_bucket) _M_erase_bucket(__f_bucket, __first._M_cur, __last._M_cur); else { _M_erase_bucket(__f_bucket, __first._M_cur, 0); for (size_type __n = __f_bucket + 1; __n < __l_bucket; ++__n) _M_erase_bucket(__n, 0); if (__l_bucket != _M_buckets.size()) _M_erase_bucket(__l_bucket, __last._M_cur); } } template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> inline void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: erase(const_iterator __first, const_iterator __last) { erase(iterator(const_cast<_Node*>(__first._M_cur), const_cast<hashtable*>(__first._M_ht)), iterator(const_cast<_Node*>(__last._M_cur), const_cast<hashtable*>(__last._M_ht))); } template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> inline void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: erase(const const_iterator& __it) { erase(iterator(const_cast<_Node*>(__it._M_cur), const_cast<hashtable*>(__it._M_ht))); } template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: resize(size_type __num_elements_hint) { const size_type __old_n = _M_buckets.size(); if (__num_elements_hint > __old_n) { const size_type __n = _M_next_size(__num_elements_hint); if (__n > __old_n) { _Vector_type __tmp(__n, (_Node*)(0), _M_buckets.get_allocator()); __try { for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) { _Node* __first = _M_buckets[__bucket]; while (__first) { size_type __new_bucket = _M_bkt_num(__first->_M_val, __n); _M_buckets[__bucket] = __first->_M_next; __first->_M_next = __tmp[__new_bucket]; __tmp[__new_bucket] = __first; __first = _M_buckets[__bucket]; } } _M_buckets.swap(__tmp); } __catch(...) { for (size_type __bucket = 0; __bucket < __tmp.size(); ++__bucket) { while (__tmp[__bucket]) { _Node* __next = __tmp[__bucket]->_M_next; _M_delete_node(__tmp[__bucket]); __tmp[__bucket] = __next; } } __throw_exception_again; } } } } template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: _M_erase_bucket(const size_type __n, _Node* __first, _Node* __last) { _Node* __cur = _M_buckets[__n]; if (__cur == __first) _M_erase_bucket(__n, __last); else { _Node* __next; for (__next = __cur->_M_next; __next != __first; __cur = __next, __next = __cur->_M_next) ; while (__next != __last) { __cur->_M_next = __next->_M_next; _M_delete_node(__next); __next = __cur->_M_next; --_M_num_elements; } } } template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: _M_erase_bucket(const size_type __n, _Node* __last) { _Node* __cur = _M_buckets[__n]; while (__cur != __last) { _Node* __next = __cur->_M_next; _M_delete_node(__cur); __cur = __next; _M_buckets[__n] = __cur; --_M_num_elements; } } template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: clear() { if (_M_num_elements == 0) return; for (size_type __i = 0; __i < _M_buckets.size(); ++__i) { _Node* __cur = _M_buckets[__i]; while (__cur != 0) { _Node* __next = __cur->_M_next; _M_delete_node(__cur); __cur = __next; } _M_buckets[__i] = 0; } _M_num_elements = 0; } template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: _M_copy_from(const hashtable& __ht) { _M_buckets.clear(); _M_buckets.reserve(__ht._M_buckets.size()); _M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*) 0); __try { for (size_type __i = 0; __i < __ht._M_buckets.size(); ++__i) { const _Node* __cur = __ht._M_buckets[__i]; if (__cur) { _Node* __local_copy = _M_new_node(__cur->_M_val); _M_buckets[__i] = __local_copy; for (_Node* __next = __cur->_M_next; __next; __cur = __next, __next = __cur->_M_next) { __local_copy->_M_next = _M_new_node(__next->_M_val); __local_copy = __local_copy->_M_next; } } } _M_num_elements = __ht._M_num_elements; } __catch(...) { clear(); __throw_exception_again; } } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif �������������������������������������������������������������������������c++/4.8.2/cstring�����������������������������������������������������������������������������������0000644�����������������00000006063�14763166027�0007202 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- forwarding header. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file cstring * This is a Standard C++ Library file. You should @c \#include this file * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c string.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std (except for names which are defined * as macros in C). */ // // ISO C++ 14882: 20.4.6 C library // #pragma GCC system_header #include <bits/c++config.h> #include <string.h> #ifndef _GLIBCXX_CSTRING #define _GLIBCXX_CSTRING 1 // Get rid of those macros defined in <string.h> in lieu of real functions. #undef memchr #undef memcmp #undef memcpy #undef memmove #undef memset #undef strcat #undef strchr #undef strcmp #undef strcoll #undef strcpy #undef strcspn #undef strerror #undef strlen #undef strncat #undef strncmp #undef strncpy #undef strpbrk #undef strrchr #undef strspn #undef strstr #undef strtok #undef strxfrm namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using ::memchr; using ::memcmp; using ::memcpy; using ::memmove; using ::memset; using ::strcat; using ::strcmp; using ::strcoll; using ::strcpy; using ::strcspn; using ::strerror; using ::strlen; using ::strncat; using ::strncmp; using ::strncpy; using ::strspn; using ::strtok; using ::strxfrm; using ::strchr; using ::strpbrk; using ::strrchr; using ::strstr; #ifndef __CORRECT_ISO_CPP_STRING_H_PROTO inline void* memchr(void* __s, int __c, size_t __n) { return __builtin_memchr(__s, __c, __n); } inline char* strchr(char* __s, int __n) { return __builtin_strchr(__s, __n); } inline char* strpbrk(char* __s1, const char* __s2) { return __builtin_strpbrk(__s1, __s2); } inline char* strrchr(char* __s, int __n) { return __builtin_strrchr(__s, __n); } inline char* strstr(char* __s1, const char* __s2) { return __builtin_strstr(__s1, __s2); } #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/climits�����������������������������������������������������������������������������������0000644�����������������00000003535�14763166027�0007176 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- forwarding header. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/climits * This is a Standard C++ Library file. You should @c \#include this file * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c limits.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std (except for names which are defined * as macros in C). */ // // ISO C++ 14882: 18.2.2 Implementation properties: C library // #pragma GCC system_header #include <limits.h> #ifndef _GLIBCXX_CLIMITS #define _GLIBCXX_CLIMITS 1 #ifndef LLONG_MIN #define LLONG_MIN (-__LONG_LONG_MAX__ - 1) #endif #ifndef LLONG_MAX #define LLONG_MAX __LONG_LONG_MAX__ #endif #ifndef ULLONG_MAX #define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1) #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/memory������������������������������������������������������������������������������������0000644�����������������00000005472�14763166027�0007044 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <memory> -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * Copyright (c) 1997-1999 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * */ /** @file include/memory * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_MEMORY #define _GLIBCXX_MEMORY 1 #pragma GCC system_header /** * @defgroup memory Memory * @ingroup utilities * * Components for memory allocation, deallocation, and management. */ /** * @defgroup pointer_abstractions Pointer Abstractions * @ingroup memory * * Smart pointers, etc. */ #include <bits/stl_algobase.h> #include <bits/allocator.h> #include <bits/stl_construct.h> #include <bits/stl_uninitialized.h> #include <bits/stl_tempbuf.h> #include <bits/stl_raw_storage_iter.h> #if __cplusplus >= 201103L # include <exception> // std::exception # include <typeinfo> // std::type_info in get_deleter # include <iosfwd> // std::basic_ostream # include <ext/atomicity.h> # include <ext/concurrence.h> # include <bits/functexcept.h> # include <bits/stl_function.h> // std::less # include <bits/uses_allocator.h> # include <type_traits> # include <functional> # include <debug/debug.h> # include <bits/unique_ptr.h> # include <bits/shared_ptr.h> # if _GLIBCXX_USE_DEPRECATED # include <backward/auto_ptr.h> # endif #else # include <backward/auto_ptr.h> #endif #endif /* _GLIBCXX_MEMORY */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/streambuf���������������������������������������������������������������������������������0000644�����������������00000071323�14763166027�0007522 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Stream buffer classes -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/streambuf * This is a Standard C++ Library header. */ // // ISO C++ 14882: 27.5 Stream buffers // #ifndef _GLIBXX_STREAMBUF #define _GLIBXX_STREAMBUF 1 #pragma GCC system_header #include <bits/c++config.h> #include <iosfwd> #include <bits/localefwd.h> #include <bits/ios_base.h> #include <bits/cpp_type_traits.h> #include <ext/type_traits.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _CharT, typename _Traits> streamsize __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>*, basic_streambuf<_CharT, _Traits>*, bool&); /** * @brief The actual work of input and output (interface). * @ingroup io * * @tparam _CharT Type of character stream. * @tparam _Traits Traits for character type, defaults to * char_traits<_CharT>. * * This is a base class. Derived stream buffers each control a * pair of character sequences: one for input, and one for output. * * Section [27.5.1] of the standard describes the requirements and * behavior of stream buffer classes. That section (three paragraphs) * is reproduced here, for simplicity and accuracy. * * -# Stream buffers can impose various constraints on the sequences * they control. Some constraints are: * - The controlled input sequence can be not readable. * - The controlled output sequence can be not writable. * - The controlled sequences can be associated with the contents of * other representations for character sequences, such as external * files. * - The controlled sequences can support operations @e directly to or * from associated sequences. * - The controlled sequences can impose limitations on how the * program can read characters from a sequence, write characters to * a sequence, put characters back into an input sequence, or alter * the stream position. * . * -# Each sequence is characterized by three pointers which, if non-null, * all point into the same @c charT array object. The array object * represents, at any moment, a (sub)sequence of characters from the * sequence. Operations performed on a sequence alter the values * stored in these pointers, perform reads and writes directly to or * from associated sequences, and alter <em>the stream position</em> and * conversion state as needed to maintain this subsequence relationship. * The three pointers are: * - the <em>beginning pointer</em>, or lowest element address in the * array (called @e xbeg here); * - the <em>next pointer</em>, or next element address that is a * current candidate for reading or writing (called @e xnext here); * - the <em>end pointer</em>, or first element address beyond the * end of the array (called @e xend here). * . * -# The following semantic constraints shall always apply for any set * of three pointers for a sequence, using the pointer names given * immediately above: * - If @e xnext is not a null pointer, then @e xbeg and @e xend shall * also be non-null pointers into the same @c charT array, as * described above; otherwise, @e xbeg and @e xend shall also be null. * - If @e xnext is not a null pointer and @e xnext < @e xend for an * output sequence, then a <em>write position</em> is available. * In this case, @e *xnext shall be assignable as the next element * to write (to put, or to store a character value, into the sequence). * - If @e xnext is not a null pointer and @e xbeg < @e xnext for an * input sequence, then a <em>putback position</em> is available. * In this case, @e xnext[-1] shall have a defined value and is the * next (preceding) element to store a character that is put back * into the input sequence. * - If @e xnext is not a null pointer and @e xnext< @e xend for an * input sequence, then a <em>read position</em> is available. * In this case, @e *xnext shall have a defined value and is the * next element to read (to get, or to obtain a character value, * from the sequence). */ template<typename _CharT, typename _Traits> class basic_streambuf { public: //@{ /** * These are standard types. They permit a standardized way of * referring to names of (or names dependent on) the template * parameters, which are specific to the implementation. */ typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; //@} //@{ /// This is a non-standard type. typedef basic_streambuf<char_type, traits_type> __streambuf_type; //@} friend class basic_ios<char_type, traits_type>; friend class basic_istream<char_type, traits_type>; friend class basic_ostream<char_type, traits_type>; friend class istreambuf_iterator<char_type, traits_type>; friend class ostreambuf_iterator<char_type, traits_type>; friend streamsize __copy_streambufs_eof<>(basic_streambuf*, basic_streambuf*, bool&); template<bool _IsMove, typename _CharT2> friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, _CharT2*>::__type __copy_move_a2(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, _CharT2*); template<typename _CharT2> friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, istreambuf_iterator<_CharT2> >::__type find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, const _CharT2&); template<typename _CharT2, typename _Traits2> friend basic_istream<_CharT2, _Traits2>& operator>>(basic_istream<_CharT2, _Traits2>&, _CharT2*); template<typename _CharT2, typename _Traits2, typename _Alloc> friend basic_istream<_CharT2, _Traits2>& operator>>(basic_istream<_CharT2, _Traits2>&, basic_string<_CharT2, _Traits2, _Alloc>&); template<typename _CharT2, typename _Traits2, typename _Alloc> friend basic_istream<_CharT2, _Traits2>& getline(basic_istream<_CharT2, _Traits2>&, basic_string<_CharT2, _Traits2, _Alloc>&, _CharT2); protected: /* * This is based on _IO_FILE, just reordered to be more consistent, * and is intended to be the most minimal abstraction for an * internal buffer. * - get == input == read * - put == output == write */ char_type* _M_in_beg; ///< Start of get area. char_type* _M_in_cur; ///< Current read area. char_type* _M_in_end; ///< End of get area. char_type* _M_out_beg; ///< Start of put area. char_type* _M_out_cur; ///< Current put area. char_type* _M_out_end; ///< End of put area. /// Current locale setting. locale _M_buf_locale; public: /// Destructor deallocates no buffer space. virtual ~basic_streambuf() { } // [27.5.2.2.1] locales /** * @brief Entry point for imbue(). * @param __loc The new locale. * @return The previous locale. * * Calls the derived imbue(__loc). */ locale pubimbue(const locale& __loc) { locale __tmp(this->getloc()); this->imbue(__loc); _M_buf_locale = __loc; return __tmp; } /** * @brief Locale access. * @return The current locale in effect. * * If pubimbue(loc) has been called, then the most recent @c loc * is returned. Otherwise the global locale in effect at the time * of construction is returned. */ locale getloc() const { return _M_buf_locale; } // [27.5.2.2.2] buffer management and positioning //@{ /** * @brief Entry points for derived buffer functions. * * The public versions of @c pubfoo dispatch to the protected * derived @c foo member functions, passing the arguments (if any) * and returning the result unchanged. */ basic_streambuf* pubsetbuf(char_type* __s, streamsize __n) { return this->setbuf(__s, __n); } /** * @brief Alters the stream position. * @param __off Offset. * @param __way Value for ios_base::seekdir. * @param __mode Value for ios_base::openmode. * * Calls virtual seekoff function. */ pos_type pubseekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode = ios_base::in | ios_base::out) { return this->seekoff(__off, __way, __mode); } /** * @brief Alters the stream position. * @param __sp Position * @param __mode Value for ios_base::openmode. * * Calls virtual seekpos function. */ pos_type pubseekpos(pos_type __sp, ios_base::openmode __mode = ios_base::in | ios_base::out) { return this->seekpos(__sp, __mode); } /** * @brief Calls virtual sync function. */ int pubsync() { return this->sync(); } //@} // [27.5.2.2.3] get area /** * @brief Looking ahead into the stream. * @return The number of characters available. * * If a read position is available, returns the number of characters * available for reading before the buffer must be refilled. * Otherwise returns the derived @c showmanyc(). */ streamsize in_avail() { const streamsize __ret = this->egptr() - this->gptr(); return __ret ? __ret : this->showmanyc(); } /** * @brief Getting the next character. * @return The next character, or eof. * * Calls @c sbumpc(), and if that function returns * @c traits::eof(), so does this function. Otherwise, @c sgetc(). */ int_type snextc() { int_type __ret = traits_type::eof(); if (__builtin_expect(!traits_type::eq_int_type(this->sbumpc(), __ret), true)) __ret = this->sgetc(); return __ret; } /** * @brief Getting the next character. * @return The next character, or eof. * * If the input read position is available, returns that character * and increments the read pointer, otherwise calls and returns * @c uflow(). */ int_type sbumpc() { int_type __ret; if (__builtin_expect(this->gptr() < this->egptr(), true)) { __ret = traits_type::to_int_type(*this->gptr()); this->gbump(1); } else __ret = this->uflow(); return __ret; } /** * @brief Getting the next character. * @return The next character, or eof. * * If the input read position is available, returns that character, * otherwise calls and returns @c underflow(). Does not move the * read position after fetching the character. */ int_type sgetc() { int_type __ret; if (__builtin_expect(this->gptr() < this->egptr(), true)) __ret = traits_type::to_int_type(*this->gptr()); else __ret = this->underflow(); return __ret; } /** * @brief Entry point for xsgetn. * @param __s A buffer area. * @param __n A count. * * Returns xsgetn(__s,__n). The effect is to fill @a __s[0] through * @a __s[__n-1] with characters from the input sequence, if possible. */ streamsize sgetn(char_type* __s, streamsize __n) { return this->xsgetn(__s, __n); } // [27.5.2.2.4] putback /** * @brief Pushing characters back into the input stream. * @param __c The character to push back. * @return The previous character, if possible. * * Similar to sungetc(), but @a __c is pushed onto the stream * instead of <em>the previous character.</em> If successful, * the next character fetched from the input stream will be @a * __c. */ int_type sputbackc(char_type __c) { int_type __ret; const bool __testpos = this->eback() < this->gptr(); if (__builtin_expect(!__testpos || !traits_type::eq(__c, this->gptr()[-1]), false)) __ret = this->pbackfail(traits_type::to_int_type(__c)); else { this->gbump(-1); __ret = traits_type::to_int_type(*this->gptr()); } return __ret; } /** * @brief Moving backwards in the input stream. * @return The previous character, if possible. * * If a putback position is available, this function decrements * the input pointer and returns that character. Otherwise, * calls and returns pbackfail(). The effect is to @a unget * the last character @a gotten. */ int_type sungetc() { int_type __ret; if (__builtin_expect(this->eback() < this->gptr(), true)) { this->gbump(-1); __ret = traits_type::to_int_type(*this->gptr()); } else __ret = this->pbackfail(); return __ret; } // [27.5.2.2.5] put area /** * @brief Entry point for all single-character output functions. * @param __c A character to output. * @return @a __c, if possible. * * One of two public output functions. * * If a write position is available for the output sequence (i.e., * the buffer is not full), stores @a __c in that position, increments * the position, and returns @c traits::to_int_type(__c). If a write * position is not available, returns @c overflow(__c). */ int_type sputc(char_type __c) { int_type __ret; if (__builtin_expect(this->pptr() < this->epptr(), true)) { *this->pptr() = __c; this->pbump(1); __ret = traits_type::to_int_type(__c); } else __ret = this->overflow(traits_type::to_int_type(__c)); return __ret; } /** * @brief Entry point for all single-character output functions. * @param __s A buffer read area. * @param __n A count. * * One of two public output functions. * * * Returns xsputn(__s,__n). The effect is to write @a __s[0] through * @a __s[__n-1] to the output sequence, if possible. */ streamsize sputn(const char_type* __s, streamsize __n) { return this->xsputn(__s, __n); } protected: /** * @brief Base constructor. * * Only called from derived constructors, and sets up all the * buffer data to zero, including the pointers described in the * basic_streambuf class description. Note that, as a result, * - the class starts with no read nor write positions available, * - this is not an error */ basic_streambuf() : _M_in_beg(0), _M_in_cur(0), _M_in_end(0), _M_out_beg(0), _M_out_cur(0), _M_out_end(0), _M_buf_locale(locale()) { } // [27.5.2.3.1] get area access //@{ /** * @brief Access to the get area. * * These functions are only available to other protected functions, * including derived classes. * * - eback() returns the beginning pointer for the input sequence * - gptr() returns the next pointer for the input sequence * - egptr() returns the end pointer for the input sequence */ char_type* eback() const { return _M_in_beg; } char_type* gptr() const { return _M_in_cur; } char_type* egptr() const { return _M_in_end; } //@} /** * @brief Moving the read position. * @param __n The delta by which to move. * * This just advances the read position without returning any data. */ void gbump(int __n) { _M_in_cur += __n; } /** * @brief Setting the three read area pointers. * @param __gbeg A pointer. * @param __gnext A pointer. * @param __gend A pointer. * @post @a __gbeg == @c eback(), @a __gnext == @c gptr(), and * @a __gend == @c egptr() */ void setg(char_type* __gbeg, char_type* __gnext, char_type* __gend) { _M_in_beg = __gbeg; _M_in_cur = __gnext; _M_in_end = __gend; } // [27.5.2.3.2] put area access //@{ /** * @brief Access to the put area. * * These functions are only available to other protected functions, * including derived classes. * * - pbase() returns the beginning pointer for the output sequence * - pptr() returns the next pointer for the output sequence * - epptr() returns the end pointer for the output sequence */ char_type* pbase() const { return _M_out_beg; } char_type* pptr() const { return _M_out_cur; } char_type* epptr() const { return _M_out_end; } //@} /** * @brief Moving the write position. * @param __n The delta by which to move. * * This just advances the write position without returning any data. */ void pbump(int __n) { _M_out_cur += __n; } /** * @brief Setting the three write area pointers. * @param __pbeg A pointer. * @param __pend A pointer. * @post @a __pbeg == @c pbase(), @a __pbeg == @c pptr(), and * @a __pend == @c epptr() */ void setp(char_type* __pbeg, char_type* __pend) { _M_out_beg = _M_out_cur = __pbeg; _M_out_end = __pend; } // [27.5.2.4] virtual functions // [27.5.2.4.1] locales /** * @brief Changes translations. * @param __loc A new locale. * * Translations done during I/O which depend on the current * locale are changed by this call. The standard adds, * <em>Between invocations of this function a class derived * from streambuf can safely cache results of calls to locale * functions and to members of facets so obtained.</em> * * @note Base class version does nothing. */ virtual void imbue(const locale& __loc) { } // [27.5.2.4.2] buffer management and positioning /** * @brief Manipulates the buffer. * * Each derived class provides its own appropriate behavior. See * the next-to-last paragraph of * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html * for more on this function. * * @note Base class version does nothing, returns @c this. */ virtual basic_streambuf<char_type,_Traits>* setbuf(char_type*, streamsize) { return this; } /** * @brief Alters the stream positions. * * Each derived class provides its own appropriate behavior. * @note Base class version does nothing, returns a @c pos_type * that represents an invalid stream position. */ virtual pos_type seekoff(off_type, ios_base::seekdir, ios_base::openmode /*__mode*/ = ios_base::in | ios_base::out) { return pos_type(off_type(-1)); } /** * @brief Alters the stream positions. * * Each derived class provides its own appropriate behavior. * @note Base class version does nothing, returns a @c pos_type * that represents an invalid stream position. */ virtual pos_type seekpos(pos_type, ios_base::openmode /*__mode*/ = ios_base::in | ios_base::out) { return pos_type(off_type(-1)); } /** * @brief Synchronizes the buffer arrays with the controlled sequences. * @return -1 on failure. * * Each derived class provides its own appropriate behavior, * including the definition of @a failure. * @note Base class version does nothing, returns zero. */ virtual int sync() { return 0; } // [27.5.2.4.3] get area /** * @brief Investigating the data available. * @return An estimate of the number of characters available in the * input sequence, or -1. * * <em>If it returns a positive value, then successive calls to * @c underflow() will not return @c traits::eof() until at * least that number of characters have been supplied. If @c * showmanyc() returns -1, then calls to @c underflow() or @c * uflow() will fail.</em> [27.5.2.4.3]/1 * * @note Base class version does nothing, returns zero. * @note The standard adds that <em>the intention is not only that the * calls [to underflow or uflow] will not return @c eof() but * that they will return immediately.</em> * @note The standard adds that <em>the morphemes of @c showmanyc are * @b es-how-many-see, not @b show-manic.</em> */ virtual streamsize showmanyc() { return 0; } /** * @brief Multiple character extraction. * @param __s A buffer area. * @param __n Maximum number of characters to assign. * @return The number of characters assigned. * * Fills @a __s[0] through @a __s[__n-1] with characters from the input * sequence, as if by @c sbumpc(). Stops when either @a __n characters * have been copied, or when @c traits::eof() would be copied. * * It is expected that derived classes provide a more efficient * implementation by overriding this definition. */ virtual streamsize xsgetn(char_type* __s, streamsize __n); /** * @brief Fetches more data from the controlled sequence. * @return The first character from the <em>pending sequence</em>. * * Informally, this function is called when the input buffer is * exhausted (or does not exist, as buffering need not actually be * done). If a buffer exists, it is @a refilled. In either case, the * next available character is returned, or @c traits::eof() to * indicate a null pending sequence. * * For a formal definition of the pending sequence, see a good text * such as Langer & Kreft, or [27.5.2.4.3]/7-14. * * A functioning input streambuf can be created by overriding only * this function (no buffer area will be used). For an example, see * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25.html * * @note Base class version does nothing, returns eof(). */ virtual int_type underflow() { return traits_type::eof(); } /** * @brief Fetches more data from the controlled sequence. * @return The first character from the <em>pending sequence</em>. * * Informally, this function does the same thing as @c underflow(), * and in fact is required to call that function. It also returns * the new character, like @c underflow() does. However, this * function also moves the read position forward by one. */ virtual int_type uflow() { int_type __ret = traits_type::eof(); const bool __testeof = traits_type::eq_int_type(this->underflow(), __ret); if (!__testeof) { __ret = traits_type::to_int_type(*this->gptr()); this->gbump(1); } return __ret; } // [27.5.2.4.4] putback /** * @brief Tries to back up the input sequence. * @param __c The character to be inserted back into the sequence. * @return eof() on failure, <em>some other value</em> on success * @post The constraints of @c gptr(), @c eback(), and @c pptr() * are the same as for @c underflow(). * * @note Base class version does nothing, returns eof(). */ virtual int_type pbackfail(int_type __c = traits_type::eof()) { return traits_type::eof(); } // Put area: /** * @brief Multiple character insertion. * @param __s A buffer area. * @param __n Maximum number of characters to write. * @return The number of characters written. * * Writes @a __s[0] through @a __s[__n-1] to the output sequence, as if * by @c sputc(). Stops when either @a n characters have been * copied, or when @c sputc() would return @c traits::eof(). * * It is expected that derived classes provide a more efficient * implementation by overriding this definition. */ virtual streamsize xsputn(const char_type* __s, streamsize __n); /** * @brief Consumes data from the buffer; writes to the * controlled sequence. * @param __c An additional character to consume. * @return eof() to indicate failure, something else (usually * @a __c, or not_eof()) * * Informally, this function is called when the output buffer * is full (or does not exist, as buffering need not actually * be done). If a buffer exists, it is @a consumed, with * <em>some effect</em> on the controlled sequence. * (Typically, the buffer is written out to the sequence * verbatim.) In either case, the character @a c is also * written out, if @a __c is not @c eof(). * * For a formal definition of this function, see a good text * such as Langer & Kreft, or [27.5.2.4.5]/3-7. * * A functioning output streambuf can be created by overriding only * this function (no buffer area will be used). * * @note Base class version does nothing, returns eof(). */ virtual int_type overflow(int_type __c = traits_type::eof()) { return traits_type::eof(); } #if _GLIBCXX_USE_DEPRECATED // Annex D.6 public: /** * @brief Tosses a character. * * Advances the read pointer, ignoring the character that would have * been read. * * See http://gcc.gnu.org/ml/libstdc++/2002-05/msg00168.html */ void stossc() { if (this->gptr() < this->egptr()) this->gbump(1); else this->uflow(); } #endif // Also used by specializations for char and wchar_t in src. void __safe_gbump(streamsize __n) { _M_in_cur += __n; } void __safe_pbump(streamsize __n) { _M_out_cur += __n; } private: // _GLIBCXX_RESOLVE_LIB_DEFECTS // Side effect of DR 50. basic_streambuf(const basic_streambuf& __sb) : _M_in_beg(__sb._M_in_beg), _M_in_cur(__sb._M_in_cur), _M_in_end(__sb._M_in_end), _M_out_beg(__sb._M_out_beg), _M_out_cur(__sb._M_out_cur), _M_out_end(__sb._M_out_end), _M_buf_locale(__sb._M_buf_locale) { } basic_streambuf& operator=(const basic_streambuf& __sb) { _M_in_beg = __sb._M_in_beg; _M_in_cur = __sb._M_in_cur; _M_in_end = __sb._M_in_end; _M_out_beg = __sb._M_out_beg; _M_out_cur = __sb._M_out_cur; _M_out_end = __sb._M_out_end; _M_buf_locale = __sb._M_buf_locale; return *this; }; }; // Explicit specialization declarations, defined in src/streambuf.cc. template<> streamsize __copy_streambufs_eof(basic_streambuf<char>* __sbin, basic_streambuf<char>* __sbout, bool& __ineof); #ifdef _GLIBCXX_USE_WCHAR_T template<> streamsize __copy_streambufs_eof(basic_streambuf<wchar_t>* __sbin, basic_streambuf<wchar_t>* __sbout, bool& __ineof); #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #include <bits/streambuf.tcc> #endif /* _GLIBCXX_STREAMBUF */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/cstddef�����������������������������������������������������������������������������������0000644�����������������00000003103�14763166027�0007135 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- forwarding header. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file cstddef * This is a Standard C++ Library file. You should @c \#include this file * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c stddef.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std (except for names which are defined * as macros in C). */ // // ISO C++ 14882: 18.1 Types // #pragma GCC system_header #include <bits/c++config.h> #include <stddef.h> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/cinttypes���������������������������������������������������������������������������������0000644�����������������00000004155�14763166027�0007553 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <cinttypes> -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/cinttypes * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_CINTTYPES #define _GLIBCXX_CINTTYPES 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <cstdint> // For 27.9.2/3 (see C99, Note 184) #if _GLIBCXX_HAVE_INTTYPES_H # ifndef __STDC_FORMAT_MACROS # define _UNDEF__STDC_FORMAT_MACROS # define __STDC_FORMAT_MACROS # endif # include <inttypes.h> # ifdef _UNDEF__STDC_FORMAT_MACROS # undef __STDC_FORMAT_MACROS # undef _UNDEF__STDC_FORMAT_MACROS # endif #endif #ifdef _GLIBCXX_USE_C99_INTTYPES_TR1 namespace std { // types using ::imaxdiv_t; // functions using ::imaxabs; using ::imaxdiv; // GCC does not support extended integer types // intmax_t abs(intmax_t) // imaxdiv_t div(intmax_t, intmax_t) using ::strtoimax; using ::strtoumax; #if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 using ::wcstoimax; using ::wcstoumax; #endif } // namespace std #endif // _GLIBCXX_USE_C99_INTTYPES_TR1 #endif // C++11 #endif // _GLIBCXX_CINTTYPES �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/ext/opt_random.h���������������������������������������������������0000644�����������������00000011224�14763166027�0014500 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Optimizations for random number extensions, x86 version -*- C++ -*- // Copyright (C) 2012-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/random.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ext/random} */ #ifndef _EXT_OPT_RANDOM_H #define _EXT_OPT_RANDOM_H 1 #pragma GCC system_header #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #ifdef __SSE2__ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace { template<size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2, uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4> inline __m128i __sse2_recursion(__m128i __a, __m128i __b, __m128i __c, __m128i __d) { __m128i __y = _mm_srli_epi32(__b, __sr1); __m128i __z = _mm_srli_si128(__c, __sr2); __m128i __v = _mm_slli_epi32(__d, __sl1); __z = _mm_xor_si128(__z, __a); __z = _mm_xor_si128(__z, __v); __m128i __x = _mm_slli_si128(__a, __sl2); __y = _mm_and_si128(__y, _mm_set_epi32(__msk4, __msk3, __msk2, __msk1)); __z = _mm_xor_si128(__z, __x); return _mm_xor_si128(__z, __y); } } #define _GLIBCXX_OPT_HAVE_RANDOM_SFMT_GEN_READ 1 template<typename _UIntType, size_t __m, size_t __pos1, size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2, uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4, uint32_t __parity1, uint32_t __parity2, uint32_t __parity3, uint32_t __parity4> void simd_fast_mersenne_twister_engine<_UIntType, __m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4, __parity1, __parity2, __parity3, __parity4>:: _M_gen_rand(void) { __m128i __r1 = _mm_load_si128(&_M_state[_M_nstate - 2]); __m128i __r2 = _mm_load_si128(&_M_state[_M_nstate - 1]); size_t __i; for (__i = 0; __i < _M_nstate - __pos1; ++__i) { __m128i __r = __sse2_recursion<__sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4> (_M_state[__i], _M_state[__i + __pos1], __r1, __r2); _mm_store_si128(&_M_state[__i], __r); __r1 = __r2; __r2 = __r; } for (; __i < _M_nstate; ++__i) { __m128i __r = __sse2_recursion<__sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4> (_M_state[__i], _M_state[__i + __pos1 - _M_nstate], __r1, __r2); _mm_store_si128(&_M_state[__i], __r); __r1 = __r2; __r2 = __r; } _M_pos = 0; } #define _GLIBCXX_OPT_HAVE_RANDOM_SFMT_OPERATOREQUAL 1 template<typename _UIntType, size_t __m, size_t __pos1, size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2, uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4, uint32_t __parity1, uint32_t __parity2, uint32_t __parity3, uint32_t __parity4> bool operator==(const __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType, __m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4, __parity1, __parity2, __parity3, __parity4>& __lhs, const __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType, __m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4, __parity1, __parity2, __parity3, __parity4>& __rhs) { __m128i __res = _mm_cmpeq_epi8(__lhs._M_state[0], __rhs._M_state[0]); for (size_t __i = 1; __i < __lhs._M_nstate; ++__i) __res = _mm_and_si128(__res, _mm_cmpeq_epi8(__lhs._M_state[__i], __rhs._M_state[__i])); return (_mm_movemask_epi8(__res) == 0xffff && __lhs._M_pos == __rhs._M_pos); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // __SSE2__ #endif // __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #endif // _EXT_OPT_RANDOM_H ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/gthr-default.h������������������������������������������������0000644�����������������00000057255�14763166027�0015103 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Threads compatibility routines for libgcc2 and libobjc. */ /* Compile this one with gcc. */ /* Copyright (C) 1997-2013 Free Software Foundation, Inc. This file is part of GCC. GCC 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 3, or (at your option) any later version. GCC 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. Under Section 7 of GPL version 3, you are granted additional permissions described in the GCC Runtime Library Exception, version 3.1, as published by the Free Software Foundation. You should have received a copy of the GNU General Public License and a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GLIBCXX_GCC_GTHR_POSIX_H #define _GLIBCXX_GCC_GTHR_POSIX_H /* POSIX threads specific definitions. Easy, since the interface is just one-to-one mapping. */ #define __GTHREADS 1 #define __GTHREADS_CXX0X 1 #include <pthread.h> #if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \ || !defined(_GTHREAD_USE_MUTEX_TIMEDLOCK)) # include <unistd.h> # if defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0 # define _GTHREAD_USE_MUTEX_TIMEDLOCK 1 # else # define _GTHREAD_USE_MUTEX_TIMEDLOCK 0 # endif #endif typedef pthread_t __gthread_t; typedef pthread_key_t __gthread_key_t; typedef pthread_once_t __gthread_once_t; typedef pthread_mutex_t __gthread_mutex_t; typedef pthread_mutex_t __gthread_recursive_mutex_t; typedef pthread_cond_t __gthread_cond_t; typedef struct timespec __gthread_time_t; /* POSIX like conditional variables are supported. Please look at comments in gthr.h for details. */ #define __GTHREAD_HAS_COND 1 #define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER #define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function #define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT #if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER) #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER #elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP #else #define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function #endif #define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER #define __GTHREAD_TIME_INIT {0,0} #ifdef _GTHREAD_USE_MUTEX_INIT_FUNC # undef __GTHREAD_MUTEX_INIT #endif #ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC # undef __GTHREAD_RECURSIVE_MUTEX_INIT # undef __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION # define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function #endif #ifdef _GTHREAD_USE_COND_INIT_FUNC # undef __GTHREAD_COND_INIT # define __GTHREAD_COND_INIT_FUNCTION __gthread_cond_init_function #endif #if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK # ifndef __gthrw_pragma # define __gthrw_pragma(pragma) # endif # define __gthrw2(name,name2,type) \ static __typeof(type) name __attribute__ ((__weakref__(#name2))); \ __gthrw_pragma(weak type) # define __gthrw_(name) __gthrw_ ## name #else # define __gthrw2(name,name2,type) # define __gthrw_(name) name #endif /* Typically, __gthrw_foo is a weak reference to symbol foo. */ #define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name) __gthrw(pthread_once) __gthrw(pthread_getspecific) __gthrw(pthread_setspecific) __gthrw(pthread_create) __gthrw(pthread_join) __gthrw(pthread_equal) __gthrw(pthread_self) __gthrw(pthread_detach) #ifndef __BIONIC__ __gthrw(pthread_cancel) #endif __gthrw(sched_yield) __gthrw(pthread_mutex_lock) __gthrw(pthread_mutex_trylock) #if _GTHREAD_USE_MUTEX_TIMEDLOCK __gthrw(pthread_mutex_timedlock) #endif __gthrw(pthread_mutex_unlock) __gthrw(pthread_mutex_init) __gthrw(pthread_mutex_destroy) __gthrw(pthread_cond_init) __gthrw(pthread_cond_broadcast) __gthrw(pthread_cond_signal) __gthrw(pthread_cond_wait) __gthrw(pthread_cond_timedwait) __gthrw(pthread_cond_destroy) __gthrw(pthread_key_create) __gthrw(pthread_key_delete) __gthrw(pthread_mutexattr_init) __gthrw(pthread_mutexattr_settype) __gthrw(pthread_mutexattr_destroy) #if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK) /* Objective-C. */ __gthrw(pthread_exit) #ifdef _POSIX_PRIORITY_SCHEDULING #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING __gthrw(sched_get_priority_max) __gthrw(sched_get_priority_min) #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ #endif /* _POSIX_PRIORITY_SCHEDULING */ __gthrw(pthread_attr_destroy) __gthrw(pthread_attr_init) __gthrw(pthread_attr_setdetachstate) #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING __gthrw(pthread_getschedparam) __gthrw(pthread_setschedparam) #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ #endif /* _LIBOBJC || _LIBOBJC_WEAK */ #if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK /* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if -pthreads is not specified. The functions are dummies and most return an error value. However pthread_once returns 0 without invoking the routine it is passed so we cannot pretend that the interface is active if -pthreads is not specified. On Solaris 2.5.1, the interface is not exposed at all so we need to play the usual game with weak symbols. On Solaris 10 and up, a working interface is always exposed. On FreeBSD 6 and later, libc also exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc, which means the alternate __gthread_active_p below cannot be used there. */ #if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__)) static volatile int __gthread_active = -1; static void __gthread_trigger (void) { __gthread_active = 1; } static inline int __gthread_active_p (void) { static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT; /* Avoid reading __gthread_active twice on the main code path. */ int __gthread_active_latest_value = __gthread_active; /* This test is not protected to avoid taking a lock on the main code path so every update of __gthread_active in a threaded program must be atomic with regard to the result of the test. */ if (__builtin_expect (__gthread_active_latest_value < 0, 0)) { if (__gthrw_(pthread_once)) { /* If this really is a threaded program, then we must ensure that __gthread_active has been set to 1 before exiting this block. */ __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex); __gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger); __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex); } /* Make sure we'll never enter this block again. */ if (__gthread_active < 0) __gthread_active = 0; __gthread_active_latest_value = __gthread_active; } return __gthread_active_latest_value != 0; } #else /* neither FreeBSD nor Solaris */ /* For a program to be multi-threaded the only thing that it certainly must be using is pthread_create. However, there may be other libraries that intercept pthread_create with their own definitions to wrap pthreads functionality for some purpose. In those cases, pthread_create being defined might not necessarily mean that libpthread is actually linked in. For the GNU C library, we can use a known internal name. This is always available in the ABI, but no other library would define it. That is ideal, since any public pthread function might be intercepted just as pthread_create might be. __pthread_key_create is an "internal" implementation symbol, but it is part of the public exported ABI. Also, it's among the symbols that the static libpthread.a always links in whenever pthread_create is used, so there is no danger of a false negative result in any statically-linked, multi-threaded program. For others, we choose pthread_cancel as a function that seems unlikely to be redefined by an interceptor library. The bionic (Android) C library does not provide pthread_cancel, so we do use pthread_create there (and interceptor libraries lose). */ #ifdef __GLIBC__ __gthrw2(__gthrw_(__pthread_key_create), __pthread_key_create, pthread_key_create) # define GTHR_ACTIVE_PROXY __gthrw_(__pthread_key_create) #elif defined (__BIONIC__) # define GTHR_ACTIVE_PROXY __gthrw_(pthread_create) #else # define GTHR_ACTIVE_PROXY __gthrw_(pthread_cancel) #endif static inline int __gthread_active_p (void) { static void *const __gthread_active_ptr = __extension__ (void *) >HR_ACTIVE_PROXY; return __gthread_active_ptr != 0; } #endif /* FreeBSD or Solaris */ #else /* not __GXX_WEAK__ */ /* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread calls in shared flavors of the HP-UX C library. Most of the stubs have no functionality. The details are described in the "libc cumulative patch" for each subversion of HP-UX 11. There are two special interfaces provided for checking whether an application is linked to a shared pthread library or not. However, these interfaces aren't available in early libpthread libraries. We also need a test that works for archive libraries. We can't use pthread_once as some libc versions call the init function. We also can't use pthread_create or pthread_attr_init as these create a thread and thereby prevent changing the default stack size. The function pthread_default_stacksize_np is available in both the archive and shared versions of libpthread. It can be used to determine the default pthread stack size. There is a stub in some shared libc versions which returns a zero size if pthreads are not active. We provide an equivalent stub to handle cases where libc doesn't provide one. */ #if defined(__hppa__) && defined(__hpux__) static volatile int __gthread_active = -1; static inline int __gthread_active_p (void) { /* Avoid reading __gthread_active twice on the main code path. */ int __gthread_active_latest_value = __gthread_active; size_t __s; if (__builtin_expect (__gthread_active_latest_value < 0, 0)) { pthread_default_stacksize_np (0, &__s); __gthread_active = __s ? 1 : 0; __gthread_active_latest_value = __gthread_active; } return __gthread_active_latest_value != 0; } #else /* not hppa-hpux */ static inline int __gthread_active_p (void) { return 1; } #endif /* hppa-hpux */ #endif /* __GXX_WEAK__ */ #ifdef _LIBOBJC /* This is the config.h file in libobjc/ */ #include <config.h> #ifdef HAVE_SCHED_H # include <sched.h> #endif /* Key structure for maintaining thread specific storage */ static pthread_key_t _objc_thread_storage; static pthread_attr_t _objc_thread_attribs; /* Thread local storage for a single thread */ static void *thread_local_storage = NULL; /* Backend initialization functions */ /* Initialize the threads subsystem. */ static inline int __gthread_objc_init_thread_system (void) { if (__gthread_active_p ()) { /* Initialize the thread storage key. */ if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0) { /* The normal default detach state for threads is * PTHREAD_CREATE_JOINABLE which causes threads to not die * when you think they should. */ if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0 && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs, PTHREAD_CREATE_DETACHED) == 0) return 0; } } return -1; } /* Close the threads subsystem. */ static inline int __gthread_objc_close_thread_system (void) { if (__gthread_active_p () && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0 && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0) return 0; return -1; } /* Backend thread functions */ /* Create a new thread of execution. */ static inline objc_thread_t __gthread_objc_thread_detach (void (*func)(void *), void *arg) { objc_thread_t thread_id; pthread_t new_thread_handle; if (!__gthread_active_p ()) return NULL; if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs, (void *) func, arg))) thread_id = (objc_thread_t) new_thread_handle; else thread_id = NULL; return thread_id; } /* Set the current thread's priority. */ static inline int __gthread_objc_thread_set_priority (int priority) { if (!__gthread_active_p ()) return -1; else { #ifdef _POSIX_PRIORITY_SCHEDULING #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING pthread_t thread_id = __gthrw_(pthread_self) (); int policy; struct sched_param params; int priority_min, priority_max; if (__gthrw_(pthread_getschedparam) (thread_id, &policy, ¶ms) == 0) { if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1) return -1; if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1) return -1; if (priority > priority_max) priority = priority_max; else if (priority < priority_min) priority = priority_min; params.sched_priority = priority; /* * The solaris 7 and several other man pages incorrectly state that * this should be a pointer to policy but pthread.h is universally * at odds with this. */ if (__gthrw_(pthread_setschedparam) (thread_id, policy, ¶ms) == 0) return 0; } #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ #endif /* _POSIX_PRIORITY_SCHEDULING */ return -1; } } /* Return the current thread's priority. */ static inline int __gthread_objc_thread_get_priority (void) { #ifdef _POSIX_PRIORITY_SCHEDULING #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING if (__gthread_active_p ()) { int policy; struct sched_param params; if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, ¶ms) == 0) return params.sched_priority; else return -1; } else #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ #endif /* _POSIX_PRIORITY_SCHEDULING */ return OBJC_THREAD_INTERACTIVE_PRIORITY; } /* Yield our process time to another thread. */ static inline void __gthread_objc_thread_yield (void) { if (__gthread_active_p ()) __gthrw_(sched_yield) (); } /* Terminate the current thread. */ static inline int __gthread_objc_thread_exit (void) { if (__gthread_active_p ()) /* exit the thread */ __gthrw_(pthread_exit) (&__objc_thread_exit_status); /* Failed if we reached here */ return -1; } /* Returns an integer value which uniquely describes a thread. */ static inline objc_thread_t __gthread_objc_thread_id (void) { if (__gthread_active_p ()) return (objc_thread_t) __gthrw_(pthread_self) (); else return (objc_thread_t) 1; } /* Sets the thread's local storage pointer. */ static inline int __gthread_objc_thread_set_data (void *value) { if (__gthread_active_p ()) return __gthrw_(pthread_setspecific) (_objc_thread_storage, value); else { thread_local_storage = value; return 0; } } /* Returns the thread's local storage pointer. */ static inline void * __gthread_objc_thread_get_data (void) { if (__gthread_active_p ()) return __gthrw_(pthread_getspecific) (_objc_thread_storage); else return thread_local_storage; } /* Backend mutex functions */ /* Allocate a mutex. */ static inline int __gthread_objc_mutex_allocate (objc_mutex_t mutex) { if (__gthread_active_p ()) { mutex->backend = objc_malloc (sizeof (pthread_mutex_t)); if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL)) { objc_free (mutex->backend); mutex->backend = NULL; return -1; } } return 0; } /* Deallocate a mutex. */ static inline int __gthread_objc_mutex_deallocate (objc_mutex_t mutex) { if (__gthread_active_p ()) { int count; /* * Posix Threads specifically require that the thread be unlocked * for __gthrw_(pthread_mutex_destroy) to work. */ do { count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend); if (count < 0) return -1; } while (count); if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend)) return -1; objc_free (mutex->backend); mutex->backend = NULL; } return 0; } /* Grab a lock on a mutex. */ static inline int __gthread_objc_mutex_lock (objc_mutex_t mutex) { if (__gthread_active_p () && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0) { return -1; } return 0; } /* Try to grab a lock on a mutex. */ static inline int __gthread_objc_mutex_trylock (objc_mutex_t mutex) { if (__gthread_active_p () && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0) { return -1; } return 0; } /* Unlock the mutex */ static inline int __gthread_objc_mutex_unlock (objc_mutex_t mutex) { if (__gthread_active_p () && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0) { return -1; } return 0; } /* Backend condition mutex functions */ /* Allocate a condition. */ static inline int __gthread_objc_condition_allocate (objc_condition_t condition) { if (__gthread_active_p ()) { condition->backend = objc_malloc (sizeof (pthread_cond_t)); if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL)) { objc_free (condition->backend); condition->backend = NULL; return -1; } } return 0; } /* Deallocate a condition. */ static inline int __gthread_objc_condition_deallocate (objc_condition_t condition) { if (__gthread_active_p ()) { if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend)) return -1; objc_free (condition->backend); condition->backend = NULL; } return 0; } /* Wait on the condition */ static inline int __gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend, (pthread_mutex_t *) mutex->backend); else return 0; } /* Wake up all threads waiting on this condition. */ static inline int __gthread_objc_condition_broadcast (objc_condition_t condition) { if (__gthread_active_p ()) return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend); else return 0; } /* Wake up one thread waiting on this condition. */ static inline int __gthread_objc_condition_signal (objc_condition_t condition) { if (__gthread_active_p ()) return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend); else return 0; } #else /* _LIBOBJC */ static inline int __gthread_create (__gthread_t *__threadid, void *(*__func) (void*), void *__args) { return __gthrw_(pthread_create) (__threadid, NULL, __func, __args); } static inline int __gthread_join (__gthread_t __threadid, void **__value_ptr) { return __gthrw_(pthread_join) (__threadid, __value_ptr); } static inline int __gthread_detach (__gthread_t __threadid) { return __gthrw_(pthread_detach) (__threadid); } static inline int __gthread_equal (__gthread_t __t1, __gthread_t __t2) { return __gthrw_(pthread_equal) (__t1, __t2); } static inline __gthread_t __gthread_self (void) { return __gthrw_(pthread_self) (); } static inline int __gthread_yield (void) { return __gthrw_(sched_yield) (); } static inline int __gthread_once (__gthread_once_t *__once, void (*__func) (void)) { if (__gthread_active_p ()) return __gthrw_(pthread_once) (__once, __func); else return -1; } static inline int __gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *)) { return __gthrw_(pthread_key_create) (__key, __dtor); } static inline int __gthread_key_delete (__gthread_key_t __key) { return __gthrw_(pthread_key_delete) (__key); } static inline void * __gthread_getspecific (__gthread_key_t __key) { return __gthrw_(pthread_getspecific) (__key); } static inline int __gthread_setspecific (__gthread_key_t __key, const void *__ptr) { return __gthrw_(pthread_setspecific) (__key, __ptr); } static inline void __gthread_mutex_init_function (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) __gthrw_(pthread_mutex_init) (__mutex, NULL); } static inline int __gthread_mutex_destroy (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_destroy) (__mutex); else return 0; } static inline int __gthread_mutex_lock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_lock) (__mutex); else return 0; } static inline int __gthread_mutex_trylock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_trylock) (__mutex); else return 0; } #if _GTHREAD_USE_MUTEX_TIMEDLOCK static inline int __gthread_mutex_timedlock (__gthread_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout); else return 0; } #endif static inline int __gthread_mutex_unlock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_unlock) (__mutex); else return 0; } #if !defined( PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) \ || defined(_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC) static inline int __gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex) { if (__gthread_active_p ()) { pthread_mutexattr_t __attr; int __r; __r = __gthrw_(pthread_mutexattr_init) (&__attr); if (!__r) __r = __gthrw_(pthread_mutexattr_settype) (&__attr, PTHREAD_MUTEX_RECURSIVE); if (!__r) __r = __gthrw_(pthread_mutex_init) (__mutex, &__attr); if (!__r) __r = __gthrw_(pthread_mutexattr_destroy) (&__attr); return __r; } return 0; } #endif static inline int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_lock (__mutex); } static inline int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_trylock (__mutex); } #if _GTHREAD_USE_MUTEX_TIMEDLOCK static inline int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { return __gthread_mutex_timedlock (__mutex, __abs_timeout); } #endif static inline int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_unlock (__mutex); } static inline int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_destroy (__mutex); } #ifdef _GTHREAD_USE_COND_INIT_FUNC static inline void __gthread_cond_init_function (__gthread_cond_t *__cond) { if (__gthread_active_p ()) __gthrw_(pthread_cond_init) (__cond, NULL); } #endif static inline int __gthread_cond_broadcast (__gthread_cond_t *__cond) { return __gthrw_(pthread_cond_broadcast) (__cond); } static inline int __gthread_cond_signal (__gthread_cond_t *__cond) { return __gthrw_(pthread_cond_signal) (__cond); } static inline int __gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex) { return __gthrw_(pthread_cond_wait) (__cond, __mutex); } static inline int __gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout); } static inline int __gthread_cond_wait_recursive (__gthread_cond_t *__cond, __gthread_recursive_mutex_t *__mutex) { return __gthread_cond_wait (__cond, __mutex); } static inline int __gthread_cond_destroy (__gthread_cond_t* __cond) { return __gthrw_(pthread_cond_destroy) (__cond); } #endif /* _LIBOBJC */ #endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/opt_random.h��������������������������������������������������0000644�����������������00000014041�14763166027�0014641 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Optimizations for random number functions, x86 version -*- C++ -*- // Copyright (C) 2012-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/opt_random.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{random} */ #ifndef _BITS_OPT_RANDOM_H #define _BITS_OPT_RANDOM_H 1 #include <x86intrin.h> #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION #ifdef __SSE3__ template<> template<typename _UniformRandomNumberGenerator> void normal_distribution<double>:: __generate(typename normal_distribution<double>::result_type* __f, typename normal_distribution<double>::result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __param) { typedef uint64_t __uctype; if (__f == __t) return; if (_M_saved_available) { _M_saved_available = false; *__f++ = _M_saved * __param.stddev() + __param.mean(); if (__f == __t) return; } constexpr uint64_t __maskval = 0xfffffffffffffull; static const __m128i __mask = _mm_set1_epi64x(__maskval); static const __m128i __two = _mm_set1_epi64x(0x4000000000000000ull); static const __m128d __three = _mm_set1_pd(3.0); const __m128d __av = _mm_set1_pd(__param.mean()); const __uctype __urngmin = __urng.min(); const __uctype __urngmax = __urng.max(); const __uctype __urngrange = __urngmax - __urngmin; const __uctype __uerngrange = __urngrange + 1; while (__f + 1 < __t) { double __le; __m128d __x; do { union { __m128i __i; __m128d __d; } __v; if (__urngrange > __maskval) { if (__detail::_Power_of_2(__uerngrange)) __v.__i = _mm_and_si128(_mm_set_epi64x(__urng(), __urng()), __mask); else { const __uctype __uerange = __maskval + 1; const __uctype __scaling = __urngrange / __uerange; const __uctype __past = __uerange * __scaling; uint64_t __v1; do __v1 = __uctype(__urng()) - __urngmin; while (__v1 >= __past); __v1 /= __scaling; uint64_t __v2; do __v2 = __uctype(__urng()) - __urngmin; while (__v2 >= __past); __v2 /= __scaling; __v.__i = _mm_set_epi64x(__v1, __v2); } } else if (__urngrange == __maskval) __v.__i = _mm_set_epi64x(__urng(), __urng()); else if ((__urngrange + 2) * __urngrange >= __maskval && __detail::_Power_of_2(__uerngrange)) { uint64_t __v1 = __urng() * __uerngrange + __urng(); uint64_t __v2 = __urng() * __uerngrange + __urng(); __v.__i = _mm_and_si128(_mm_set_epi64x(__v1, __v2), __mask); } else { size_t __nrng = 2; __uctype __high = __maskval / __uerngrange / __uerngrange; while (__high > __uerngrange) { ++__nrng; __high /= __uerngrange; } const __uctype __highrange = __high + 1; const __uctype __scaling = __urngrange / __highrange; const __uctype __past = __highrange * __scaling; __uctype __tmp; uint64_t __v1; do { do __tmp = __uctype(__urng()) - __urngmin; while (__tmp >= __past); __v1 = __tmp / __scaling; for (size_t __cnt = 0; __cnt < __nrng; ++__cnt) { __tmp = __v1; __v1 *= __uerngrange; __v1 += __uctype(__urng()) - __urngmin; } } while (__v1 > __maskval || __v1 < __tmp); uint64_t __v2; do { do __tmp = __uctype(__urng()) - __urngmin; while (__tmp >= __past); __v2 = __tmp / __scaling; for (size_t __cnt = 0; __cnt < __nrng; ++__cnt) { __tmp = __v2; __v2 *= __uerngrange; __v2 += __uctype(__urng()) - __urngmin; } } while (__v2 > __maskval || __v2 < __tmp); __v.__i = _mm_set_epi64x(__v1, __v2); } __v.__i = _mm_or_si128(__v.__i, __two); __x = _mm_sub_pd(__v.__d, __three); __m128d __m = _mm_mul_pd(__x, __x); __le = _mm_cvtsd_f64(_mm_hadd_pd (__m, __m)); } while (__le == 0.0 || __le >= 1.0); double __mult = (std::sqrt(-2.0 * std::log(__le) / __le) * __param.stddev()); __x = _mm_add_pd(_mm_mul_pd(__x, _mm_set1_pd(__mult)), __av); _mm_storeu_pd(__f, __x); __f += 2; } if (__f != __t) { result_type __x, __y, __r2; __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); do { __x = result_type(2.0) * __aurng() - 1.0; __y = result_type(2.0) * __aurng() - 1.0; __r2 = __x * __x + __y * __y; } while (__r2 > 1.0 || __r2 == 0.0); const result_type __mult = std::sqrt(-2 * std::log(__r2) / __r2); _M_saved = __x * __mult; _M_saved_available = true; *__f = __y * __mult * __param.stddev() + __param.mean(); } } #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // _BITS_OPT_RANDOM_H �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/cpu_defines.h�������������������������������������������������0000644�����������������00000002465�14763166027�0014772 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Specific definitions for generic platforms -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/cpu_defines.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{iosfwd} */ #ifndef _GLIBCXX_CPU_DEFINES #define _GLIBCXX_CPU_DEFINES 1 #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/error_constants.h���������������������������������������������0000644�����������������00000012071�14763166027�0015725 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Specific definitions for generic platforms -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/error_constants.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{system_error} */ #ifndef _GLIBCXX_ERROR_CONSTANTS #define _GLIBCXX_ERROR_CONSTANTS 1 #include <bits/c++config.h> #include <cerrno> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION enum class errc { address_family_not_supported = EAFNOSUPPORT, address_in_use = EADDRINUSE, address_not_available = EADDRNOTAVAIL, already_connected = EISCONN, argument_list_too_long = E2BIG, argument_out_of_domain = EDOM, bad_address = EFAULT, bad_file_descriptor = EBADF, #ifdef _GLIBCXX_HAVE_EBADMSG bad_message = EBADMSG, #endif broken_pipe = EPIPE, connection_aborted = ECONNABORTED, connection_already_in_progress = EALREADY, connection_refused = ECONNREFUSED, connection_reset = ECONNRESET, cross_device_link = EXDEV, destination_address_required = EDESTADDRREQ, device_or_resource_busy = EBUSY, directory_not_empty = ENOTEMPTY, executable_format_error = ENOEXEC, file_exists = EEXIST, file_too_large = EFBIG, filename_too_long = ENAMETOOLONG, function_not_supported = ENOSYS, host_unreachable = EHOSTUNREACH, #ifdef _GLIBCXX_HAVE_EIDRM identifier_removed = EIDRM, #endif illegal_byte_sequence = EILSEQ, inappropriate_io_control_operation = ENOTTY, interrupted = EINTR, invalid_argument = EINVAL, invalid_seek = ESPIPE, io_error = EIO, is_a_directory = EISDIR, message_size = EMSGSIZE, network_down = ENETDOWN, network_reset = ENETRESET, network_unreachable = ENETUNREACH, no_buffer_space = ENOBUFS, no_child_process = ECHILD, #ifdef _GLIBCXX_HAVE_ENOLINK no_link = ENOLINK, #endif no_lock_available = ENOLCK, #ifdef _GLIBCXX_HAVE_ENODATA no_message_available = ENODATA, #endif no_message = ENOMSG, no_protocol_option = ENOPROTOOPT, no_space_on_device = ENOSPC, #ifdef _GLIBCXX_HAVE_ENOSR no_stream_resources = ENOSR, #endif no_such_device_or_address = ENXIO, no_such_device = ENODEV, no_such_file_or_directory = ENOENT, no_such_process = ESRCH, not_a_directory = ENOTDIR, not_a_socket = ENOTSOCK, #ifdef _GLIBCXX_HAVE_ENOSTR not_a_stream = ENOSTR, #endif not_connected = ENOTCONN, not_enough_memory = ENOMEM, #ifdef _GLIBCXX_HAVE_ENOTSUP not_supported = ENOTSUP, #endif #ifdef _GLIBCXX_HAVE_ECANCELED operation_canceled = ECANCELED, #endif operation_in_progress = EINPROGRESS, operation_not_permitted = EPERM, operation_not_supported = EOPNOTSUPP, operation_would_block = EWOULDBLOCK, #ifdef _GLIBCXX_HAVE_EOWNERDEAD owner_dead = EOWNERDEAD, #endif permission_denied = EACCES, #ifdef _GLIBCXX_HAVE_EPROTO protocol_error = EPROTO, #endif protocol_not_supported = EPROTONOSUPPORT, read_only_file_system = EROFS, resource_deadlock_would_occur = EDEADLK, resource_unavailable_try_again = EAGAIN, result_out_of_range = ERANGE, #ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE state_not_recoverable = ENOTRECOVERABLE, #endif #ifdef _GLIBCXX_HAVE_ETIME stream_timeout = ETIME, #endif #ifdef _GLIBCXX_HAVE_ETXTBSY text_file_busy = ETXTBSY, #endif timed_out = ETIMEDOUT, too_many_files_open_in_system = ENFILE, too_many_files_open = EMFILE, too_many_links = EMLINK, too_many_symbolic_link_levels = ELOOP, #ifdef _GLIBCXX_HAVE_EOVERFLOW value_too_large = EOVERFLOW, #endif wrong_protocol_type = EPROTOTYPE }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/stdtr1c++.h���������������������������������������������������0000644�����������������00000003315�14763166027�0014213 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// C++ includes used for precompiling TR1 -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file stdtr1c++.h * This is an implementation file for a precompiled header. */ #include <bits/stdc++.h> #include <tr1/array> #include <tr1/cctype> #include <tr1/cfenv> #include <tr1/cfloat> #include <tr1/cinttypes> #include <tr1/climits> #include <tr1/cmath> #include <tr1/complex> #include <tr1/cstdarg> #include <tr1/cstdbool> #include <tr1/cstdint> #include <tr1/cstdio> #include <tr1/cstdlib> #include <tr1/ctgmath> #include <tr1/ctime> #include <tr1/cwchar> #include <tr1/cwctype> #include <tr1/functional> #include <tr1/random> #include <tr1/tuple> #include <tr1/unordered_map> #include <tr1/unordered_set> #include <tr1/utility> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/c++config.h���������������������������������������������������0000644�����������������00000135625�14763166027�0014251 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Predefined symbols and macros -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/c++config.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{iosfwd} */ #ifndef _GLIBCXX_CXX_CONFIG_H #define _GLIBCXX_CXX_CONFIG_H 1 // The current version of the C++ library in compressed ISO date format. #define __GLIBCXX__ 20150623 // Macros for various attributes. // _GLIBCXX_PURE // _GLIBCXX_CONST // _GLIBCXX_NORETURN // _GLIBCXX_NOTHROW // _GLIBCXX_VISIBILITY #ifndef _GLIBCXX_PURE # define _GLIBCXX_PURE __attribute__ ((__pure__)) #endif #ifndef _GLIBCXX_CONST # define _GLIBCXX_CONST __attribute__ ((__const__)) #endif #ifndef _GLIBCXX_NORETURN # define _GLIBCXX_NORETURN __attribute__ ((__noreturn__)) #endif // See below for C++ #ifndef _GLIBCXX_NOTHROW # ifndef __cplusplus # define _GLIBCXX_NOTHROW __attribute__((__nothrow__)) # endif #endif // Macros for visibility attributes. // _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY // _GLIBCXX_VISIBILITY # define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 1 #if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY # define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V))) #else // If this is not supplied by the OS-specific or CPU-specific // headers included below, it will be defined to an empty default. # define _GLIBCXX_VISIBILITY(V) _GLIBCXX_PSEUDO_VISIBILITY(V) #endif // Macros for deprecated attributes. // _GLIBCXX_USE_DEPRECATED // _GLIBCXX_DEPRECATED #ifndef _GLIBCXX_USE_DEPRECATED # define _GLIBCXX_USE_DEPRECATED 1 #endif #if defined(__DEPRECATED) && (__cplusplus >= 201103L) # define _GLIBCXX_DEPRECATED __attribute__ ((__deprecated__)) #else # define _GLIBCXX_DEPRECATED #endif // Macros for ABI tag attributes. #ifndef _GLIBCXX_ABI_TAG_CXX11 # define _GLIBCXX_ABI_TAG_CXX11 __attribute ((__abi_tag__ ("cxx11"))) #endif #if __cplusplus // Macro for constexpr, to support in mixed 03/0x mode. #ifndef _GLIBCXX_CONSTEXPR # if __cplusplus >= 201103L # define _GLIBCXX_CONSTEXPR constexpr # define _GLIBCXX_USE_CONSTEXPR constexpr # else # define _GLIBCXX_CONSTEXPR # define _GLIBCXX_USE_CONSTEXPR const # endif #endif // Macro for noexcept, to support in mixed 03/0x mode. #ifndef _GLIBCXX_NOEXCEPT # if __cplusplus >= 201103L # define _GLIBCXX_NOEXCEPT noexcept # define _GLIBCXX_USE_NOEXCEPT noexcept # define _GLIBCXX_THROW(_EXC) # else # define _GLIBCXX_NOEXCEPT # define _GLIBCXX_USE_NOEXCEPT throw() # define _GLIBCXX_THROW(_EXC) throw(_EXC) # endif #endif #ifndef _GLIBCXX_NOTHROW # define _GLIBCXX_NOTHROW _GLIBCXX_USE_NOEXCEPT #endif #ifndef _GLIBCXX_THROW_OR_ABORT # if __EXCEPTIONS # define _GLIBCXX_THROW_OR_ABORT(_EXC) (throw (_EXC)) # else # define _GLIBCXX_THROW_OR_ABORT(_EXC) (__builtin_abort()) # endif #endif // Macro for extern template, ie controling template linkage via use // of extern keyword on template declaration. As documented in the g++ // manual, it inhibits all implicit instantiations and is used // throughout the library to avoid multiple weak definitions for // required types that are already explicitly instantiated in the // library binary. This substantially reduces the binary size of // resulting executables. // Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern // templates only in basic_string, thus activating its debug-mode // checks even at -O0. # define _GLIBCXX_EXTERN_TEMPLATE 1 /* Outline of libstdc++ namespaces. namespace std { namespace __debug { } namespace __parallel { } namespace __profile { } namespace __cxx1998 { } namespace __detail { } namespace rel_ops { } namespace tr1 { namespace placeholders { } namespace regex_constants { } namespace __detail { } } namespace tr2 { } namespace decimal { } namespace chrono { } namespace placeholders { } namespace regex_constants { } namespace this_thread { } } namespace abi { } namespace __gnu_cxx { namespace __detail { } } For full details see: http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespaces.html */ namespace std { typedef __SIZE_TYPE__ size_t; typedef __PTRDIFF_TYPE__ ptrdiff_t; #if __cplusplus >= 201103L typedef decltype(nullptr) nullptr_t; #endif } // Defined if inline namespaces are used for versioning. # define _GLIBCXX_INLINE_VERSION 0 // Inline namespace for symbol versioning. #if _GLIBCXX_INLINE_VERSION namespace std { inline namespace __7 { } namespace rel_ops { inline namespace __7 { } } namespace tr1 { inline namespace __7 { } namespace placeholders { inline namespace __7 { } } namespace regex_constants { inline namespace __7 { } } namespace __detail { inline namespace __7 { } } } namespace tr2 { inline namespace __7 { } } namespace decimal { inline namespace __7 { } } namespace chrono { inline namespace __7 { } } namespace placeholders { inline namespace __7 { } } namespace regex_constants { inline namespace __7 { } } namespace this_thread { inline namespace __7 { } } namespace __detail { inline namespace __7 { } } } namespace __gnu_cxx { inline namespace __7 { } namespace __detail { inline namespace __7 { } } } # define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __7 { # define _GLIBCXX_END_NAMESPACE_VERSION } #else # define _GLIBCXX_BEGIN_NAMESPACE_VERSION # define _GLIBCXX_END_NAMESPACE_VERSION #endif // Inline namespaces for special modes: debug, parallel, profile. #if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) \ || defined(_GLIBCXX_PROFILE) namespace std { // Non-inline namespace for components replaced by alternates in active mode. namespace __cxx1998 { #if _GLIBCXX_INLINE_VERSION inline namespace __7 { } #endif } // Inline namespace for debug mode. # ifdef _GLIBCXX_DEBUG inline namespace __debug { } # endif // Inline namespaces for parallel mode. # ifdef _GLIBCXX_PARALLEL inline namespace __parallel { } # endif // Inline namespaces for profile mode # ifdef _GLIBCXX_PROFILE inline namespace __profile { } # endif } // Check for invalid usage and unsupported mixed-mode use. # if defined(_GLIBCXX_DEBUG) && defined(_GLIBCXX_PARALLEL) # error illegal use of multiple inlined namespaces # endif # if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_DEBUG) # error illegal use of multiple inlined namespaces # endif # if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_PARALLEL) # error illegal use of multiple inlined namespaces # endif // Check for invalid use due to lack for weak symbols. # if __NO_INLINE__ && !__GXX_WEAK__ # warning currently using inlined namespace mode which may fail \ without inlining due to lack of weak symbols # endif #endif // Macros for namespace scope. Either namespace std:: or the name // of some nested namespace within it corresponding to the active mode. // _GLIBCXX_STD_A // _GLIBCXX_STD_C // // Macros for opening/closing conditional namespaces. // _GLIBCXX_BEGIN_NAMESPACE_ALGO // _GLIBCXX_END_NAMESPACE_ALGO // _GLIBCXX_BEGIN_NAMESPACE_CONTAINER // _GLIBCXX_END_NAMESPACE_CONTAINER #if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PROFILE) # define _GLIBCXX_STD_C __cxx1998 # define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER \ namespace _GLIBCXX_STD_C { _GLIBCXX_BEGIN_NAMESPACE_VERSION # define _GLIBCXX_END_NAMESPACE_CONTAINER \ _GLIBCXX_END_NAMESPACE_VERSION } # undef _GLIBCXX_EXTERN_TEMPLATE # define _GLIBCXX_EXTERN_TEMPLATE -1 #endif #ifdef _GLIBCXX_PARALLEL # define _GLIBCXX_STD_A __cxx1998 # define _GLIBCXX_BEGIN_NAMESPACE_ALGO \ namespace _GLIBCXX_STD_A { _GLIBCXX_BEGIN_NAMESPACE_VERSION # define _GLIBCXX_END_NAMESPACE_ALGO \ _GLIBCXX_END_NAMESPACE_VERSION } #endif #ifndef _GLIBCXX_STD_A # define _GLIBCXX_STD_A std #endif #ifndef _GLIBCXX_STD_C # define _GLIBCXX_STD_C std #endif #ifndef _GLIBCXX_BEGIN_NAMESPACE_ALGO # define _GLIBCXX_BEGIN_NAMESPACE_ALGO #endif #ifndef _GLIBCXX_END_NAMESPACE_ALGO # define _GLIBCXX_END_NAMESPACE_ALGO #endif #ifndef _GLIBCXX_BEGIN_NAMESPACE_CONTAINER # define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER #endif #ifndef _GLIBCXX_END_NAMESPACE_CONTAINER # define _GLIBCXX_END_NAMESPACE_CONTAINER #endif // GLIBCXX_ABI Deprecated // Define if compatibility should be provided for -mlong-double-64. #undef _GLIBCXX_LONG_DOUBLE_COMPAT // Inline namespace for long double 128 mode. #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ namespace std { inline namespace __gnu_cxx_ldbl128 { } } # define _GLIBCXX_NAMESPACE_LDBL __gnu_cxx_ldbl128:: # define _GLIBCXX_BEGIN_NAMESPACE_LDBL namespace __gnu_cxx_ldbl128 { # define _GLIBCXX_END_NAMESPACE_LDBL } #else # define _GLIBCXX_NAMESPACE_LDBL # define _GLIBCXX_BEGIN_NAMESPACE_LDBL # define _GLIBCXX_END_NAMESPACE_LDBL #endif // Assert. #if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PARALLEL) # define __glibcxx_assert(_Condition) #else namespace std { // Avoid the use of assert, because we're trying to keep the <cassert> // include out of the mix. inline void __replacement_assert(const char* __file, int __line, const char* __function, const char* __condition) { __builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line, __function, __condition); __builtin_abort(); } } #define __glibcxx_assert(_Condition) \ do \ { \ if (! (_Condition)) \ std::__replacement_assert(__FILE__, __LINE__, __PRETTY_FUNCTION__, \ #_Condition); \ } while (false) #endif // Macros for race detectors. // _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and // _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain // atomic (lock-free) synchronization to race detectors: // the race detector will infer a happens-before arc from the former to the // latter when they share the same argument pointer. // // The most frequent use case for these macros (and the only case in the // current implementation of the library) is atomic reference counting: // void _M_remove_reference() // { // _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount); // if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0) // { // _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount); // _M_destroy(__a); // } // } // The annotations in this example tell the race detector that all memory // accesses occurred when the refcount was positive do not race with // memory accesses which occurred after the refcount became zero. #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE # define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) #endif #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER # define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) #endif // Macros for C linkage: define extern "C" linkage only when using C++. # define _GLIBCXX_BEGIN_EXTERN_C extern "C" { # define _GLIBCXX_END_EXTERN_C } #else // !__cplusplus # define _GLIBCXX_BEGIN_EXTERN_C # define _GLIBCXX_END_EXTERN_C #endif // First includes. // Pick up any OS-specific definitions. #include <bits/os_defines.h> // Pick up any CPU-specific definitions. #include <bits/cpu_defines.h> // If platform uses neither visibility nor psuedo-visibility, // specify empty default for namespace annotation macros. #ifndef _GLIBCXX_PSEUDO_VISIBILITY # define _GLIBCXX_PSEUDO_VISIBILITY(V) #endif // Certain function definitions that are meant to be overridable from // user code are decorated with this macro. For some targets, this // macro causes these definitions to be weak. #ifndef _GLIBCXX_WEAK_DEFINITION # define _GLIBCXX_WEAK_DEFINITION #endif // The remainder of the prewritten config is automatic; all the // user hooks are listed above. // Create a boolean flag to be used to determine if --fast-math is set. #ifdef __FAST_MATH__ # define _GLIBCXX_FAST_MATH 1 #else # define _GLIBCXX_FAST_MATH 0 #endif // This marks string literals in header files to be extracted for eventual // translation. It is primarily used for messages in thrown exceptions; see // src/functexcept.cc. We use __N because the more traditional _N is used // for something else under certain OSes (see BADNAMES). #define __N(msgid) (msgid) // For example, <windows.h> is known to #define min and max as macros... #undef min #undef max // End of prewritten config; the settings discovered at configure time follow. /* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the `acosf' function. */ #define _GLIBCXX_HAVE_ACOSF 1 /* Define to 1 if you have the `acosl' function. */ #define _GLIBCXX_HAVE_ACOSL 1 /* Define to 1 if you have the `asinf' function. */ #define _GLIBCXX_HAVE_ASINF 1 /* Define to 1 if you have the `asinl' function. */ #define _GLIBCXX_HAVE_ASINL 1 /* Define to 1 if the target assembler supports .symver directive. */ #define _GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE 1 /* Define to 1 if you have the `atan2f' function. */ #define _GLIBCXX_HAVE_ATAN2F 1 /* Define to 1 if you have the `atan2l' function. */ #define _GLIBCXX_HAVE_ATAN2L 1 /* Define to 1 if you have the `atanf' function. */ #define _GLIBCXX_HAVE_ATANF 1 /* Define to 1 if you have the `atanl' function. */ #define _GLIBCXX_HAVE_ATANL 1 /* Define to 1 if you have the `at_quick_exit' function. */ #define _GLIBCXX_HAVE_AT_QUICK_EXIT 1 /* Define to 1 if the target assembler supports thread-local storage. */ /* #undef _GLIBCXX_HAVE_CC_TLS */ /* Define to 1 if you have the `ceilf' function. */ #define _GLIBCXX_HAVE_CEILF 1 /* Define to 1 if you have the `ceill' function. */ #define _GLIBCXX_HAVE_CEILL 1 /* Define to 1 if you have the <complex.h> header file. */ #define _GLIBCXX_HAVE_COMPLEX_H 1 /* Define to 1 if you have the `cosf' function. */ #define _GLIBCXX_HAVE_COSF 1 /* Define to 1 if you have the `coshf' function. */ #define _GLIBCXX_HAVE_COSHF 1 /* Define to 1 if you have the `coshl' function. */ #define _GLIBCXX_HAVE_COSHL 1 /* Define to 1 if you have the `cosl' function. */ #define _GLIBCXX_HAVE_COSL 1 /* Define to 1 if you have the <dlfcn.h> header file. */ #define _GLIBCXX_HAVE_DLFCN_H 1 /* Define if EBADMSG exists. */ #define _GLIBCXX_HAVE_EBADMSG 1 /* Define if ECANCELED exists. */ #define _GLIBCXX_HAVE_ECANCELED 1 /* Define if ECHILD exists. */ #define _GLIBCXX_HAVE_ECHILD 1 /* Define if EIDRM exists. */ #define _GLIBCXX_HAVE_EIDRM 1 /* Define to 1 if you have the <endian.h> header file. */ #define _GLIBCXX_HAVE_ENDIAN_H 1 /* Define if ENODATA exists. */ #define _GLIBCXX_HAVE_ENODATA 1 /* Define if ENOLINK exists. */ #define _GLIBCXX_HAVE_ENOLINK 1 /* Define if ENOSPC exists. */ #define _GLIBCXX_HAVE_ENOSPC 1 /* Define if ENOSR exists. */ #define _GLIBCXX_HAVE_ENOSR 1 /* Define if ENOSTR exists. */ #define _GLIBCXX_HAVE_ENOSTR 1 /* Define if ENOTRECOVERABLE exists. */ #define _GLIBCXX_HAVE_ENOTRECOVERABLE 1 /* Define if ENOTSUP exists. */ #define _GLIBCXX_HAVE_ENOTSUP 1 /* Define if EOVERFLOW exists. */ #define _GLIBCXX_HAVE_EOVERFLOW 1 /* Define if EOWNERDEAD exists. */ #define _GLIBCXX_HAVE_EOWNERDEAD 1 /* Define if EPERM exists. */ #define _GLIBCXX_HAVE_EPERM 1 /* Define if EPROTO exists. */ #define _GLIBCXX_HAVE_EPROTO 1 /* Define if ETIME exists. */ #define _GLIBCXX_HAVE_ETIME 1 /* Define if ETIMEDOUT exists. */ #define _GLIBCXX_HAVE_ETIMEDOUT 1 /* Define if ETXTBSY exists. */ #define _GLIBCXX_HAVE_ETXTBSY 1 /* Define if EWOULDBLOCK exists. */ #define _GLIBCXX_HAVE_EWOULDBLOCK 1 /* Define to 1 if you have the <execinfo.h> header file. */ #define _GLIBCXX_HAVE_EXECINFO_H 1 /* Define to 1 if you have the `expf' function. */ #define _GLIBCXX_HAVE_EXPF 1 /* Define to 1 if you have the `expl' function. */ #define _GLIBCXX_HAVE_EXPL 1 /* Define to 1 if you have the `fabsf' function. */ #define _GLIBCXX_HAVE_FABSF 1 /* Define to 1 if you have the `fabsl' function. */ #define _GLIBCXX_HAVE_FABSL 1 /* Define to 1 if you have the <fenv.h> header file. */ #define _GLIBCXX_HAVE_FENV_H 1 /* Define to 1 if you have the `finite' function. */ #define _GLIBCXX_HAVE_FINITE 1 /* Define to 1 if you have the `finitef' function. */ #define _GLIBCXX_HAVE_FINITEF 1 /* Define to 1 if you have the `finitel' function. */ #define _GLIBCXX_HAVE_FINITEL 1 /* Define to 1 if you have the <float.h> header file. */ #define _GLIBCXX_HAVE_FLOAT_H 1 /* Define to 1 if you have the `floorf' function. */ #define _GLIBCXX_HAVE_FLOORF 1 /* Define to 1 if you have the `floorl' function. */ #define _GLIBCXX_HAVE_FLOORL 1 /* Define to 1 if you have the `fmodf' function. */ #define _GLIBCXX_HAVE_FMODF 1 /* Define to 1 if you have the `fmodl' function. */ #define _GLIBCXX_HAVE_FMODL 1 /* Define to 1 if you have the `fpclass' function. */ /* #undef _GLIBCXX_HAVE_FPCLASS */ /* Define to 1 if you have the <fp.h> header file. */ /* #undef _GLIBCXX_HAVE_FP_H */ /* Define to 1 if you have the `frexpf' function. */ #define _GLIBCXX_HAVE_FREXPF 1 /* Define to 1 if you have the `frexpl' function. */ #define _GLIBCXX_HAVE_FREXPL 1 /* Define if _Unwind_GetIPInfo is available. */ #define _GLIBCXX_HAVE_GETIPINFO 1 /* Define if gets is available in <stdio.h>. */ #define _GLIBCXX_HAVE_GETS 1 /* Define to 1 if you have the `hypot' function. */ #define _GLIBCXX_HAVE_HYPOT 1 /* Define to 1 if you have the `hypotf' function. */ #define _GLIBCXX_HAVE_HYPOTF 1 /* Define to 1 if you have the `hypotl' function. */ #define _GLIBCXX_HAVE_HYPOTL 1 /* Define if you have the iconv() function. */ #define _GLIBCXX_HAVE_ICONV 1 /* Define to 1 if you have the <ieeefp.h> header file. */ /* #undef _GLIBCXX_HAVE_IEEEFP_H */ /* Define if int64_t is available in <stdint.h>. */ #define _GLIBCXX_HAVE_INT64_T 1 /* Define if int64_t is a long. */ /* #undef _GLIBCXX_HAVE_INT64_T_LONG */ /* Define if int64_t is a long long. */ #define _GLIBCXX_HAVE_INT64_T_LONG_LONG 1 /* Define to 1 if you have the <inttypes.h> header file. */ #define _GLIBCXX_HAVE_INTTYPES_H 1 /* Define to 1 if you have the `isinf' function. */ #define _GLIBCXX_HAVE_ISINF 1 /* Define to 1 if you have the `isinff' function. */ #define _GLIBCXX_HAVE_ISINFF 1 /* Define to 1 if you have the `isinfl' function. */ #define _GLIBCXX_HAVE_ISINFL 1 /* Define to 1 if you have the `isnan' function. */ #define _GLIBCXX_HAVE_ISNAN 1 /* Define to 1 if you have the `isnanf' function. */ #define _GLIBCXX_HAVE_ISNANF 1 /* Define to 1 if you have the `isnanl' function. */ #define _GLIBCXX_HAVE_ISNANL 1 /* Defined if iswblank exists. */ #define _GLIBCXX_HAVE_ISWBLANK 1 /* Define if LC_MESSAGES is available in <locale.h>. */ #define _GLIBCXX_HAVE_LC_MESSAGES 1 /* Define to 1 if you have the `ldexpf' function. */ #define _GLIBCXX_HAVE_LDEXPF 1 /* Define to 1 if you have the `ldexpl' function. */ #define _GLIBCXX_HAVE_LDEXPL 1 /* Define to 1 if you have the <libintl.h> header file. */ #define _GLIBCXX_HAVE_LIBINTL_H 1 /* Only used in build directory testsuite_hooks.h. */ #define _GLIBCXX_HAVE_LIMIT_AS 1 /* Only used in build directory testsuite_hooks.h. */ #define _GLIBCXX_HAVE_LIMIT_DATA 1 /* Only used in build directory testsuite_hooks.h. */ #define _GLIBCXX_HAVE_LIMIT_FSIZE 1 /* Only used in build directory testsuite_hooks.h. */ #define _GLIBCXX_HAVE_LIMIT_RSS 1 /* Only used in build directory testsuite_hooks.h. */ #define _GLIBCXX_HAVE_LIMIT_VMEM 0 /* Define if futex syscall is available. */ #define _GLIBCXX_HAVE_LINUX_FUTEX 1 /* Define to 1 if you have the <locale.h> header file. */ #define _GLIBCXX_HAVE_LOCALE_H 1 /* Define to 1 if you have the `log10f' function. */ #define _GLIBCXX_HAVE_LOG10F 1 /* Define to 1 if you have the `log10l' function. */ #define _GLIBCXX_HAVE_LOG10L 1 /* Define to 1 if you have the `logf' function. */ #define _GLIBCXX_HAVE_LOGF 1 /* Define to 1 if you have the `logl' function. */ #define _GLIBCXX_HAVE_LOGL 1 /* Define to 1 if you have the <machine/endian.h> header file. */ /* #undef _GLIBCXX_HAVE_MACHINE_ENDIAN_H */ /* Define to 1 if you have the <machine/param.h> header file. */ /* #undef _GLIBCXX_HAVE_MACHINE_PARAM_H */ /* Define if mbstate_t exists in wchar.h. */ #define _GLIBCXX_HAVE_MBSTATE_T 1 /* Define to 1 if you have the <memory.h> header file. */ #define _GLIBCXX_HAVE_MEMORY_H 1 /* Define to 1 if you have the `modf' function. */ #define _GLIBCXX_HAVE_MODF 1 /* Define to 1 if you have the `modff' function. */ #define _GLIBCXX_HAVE_MODFF 1 /* Define to 1 if you have the `modfl' function. */ #define _GLIBCXX_HAVE_MODFL 1 /* Define to 1 if you have the <nan.h> header file. */ /* #undef _GLIBCXX_HAVE_NAN_H */ /* Define if poll is available in <poll.h>. */ #define _GLIBCXX_HAVE_POLL 1 /* Define to 1 if you have the `powf' function. */ #define _GLIBCXX_HAVE_POWF 1 /* Define to 1 if you have the `powl' function. */ #define _GLIBCXX_HAVE_POWL 1 /* Define to 1 if you have the `qfpclass' function. */ /* #undef _GLIBCXX_HAVE_QFPCLASS */ /* Define to 1 if you have the `quick_exit' function. */ #define _GLIBCXX_HAVE_QUICK_EXIT 1 /* Define to 1 if you have the `setenv' function. */ #define _GLIBCXX_HAVE_SETENV 1 /* Define to 1 if you have the `sincos' function. */ #define _GLIBCXX_HAVE_SINCOS 1 /* Define to 1 if you have the `sincosf' function. */ #define _GLIBCXX_HAVE_SINCOSF 1 /* Define to 1 if you have the `sincosl' function. */ #define _GLIBCXX_HAVE_SINCOSL 1 /* Define to 1 if you have the `sinf' function. */ #define _GLIBCXX_HAVE_SINF 1 /* Define to 1 if you have the `sinhf' function. */ #define _GLIBCXX_HAVE_SINHF 1 /* Define to 1 if you have the `sinhl' function. */ #define _GLIBCXX_HAVE_SINHL 1 /* Define to 1 if you have the `sinl' function. */ #define _GLIBCXX_HAVE_SINL 1 /* Defined if sleep exists. */ #define _GLIBCXX_HAVE_SLEEP 1 /* Define to 1 if you have the `sqrtf' function. */ #define _GLIBCXX_HAVE_SQRTF 1 /* Define to 1 if you have the `sqrtl' function. */ #define _GLIBCXX_HAVE_SQRTL 1 /* Define to 1 if you have the <stdalign.h> header file. */ #define _GLIBCXX_HAVE_STDALIGN_H 1 /* Define to 1 if you have the <stdbool.h> header file. */ #define _GLIBCXX_HAVE_STDBOOL_H 1 /* Define to 1 if you have the <stdint.h> header file. */ #define _GLIBCXX_HAVE_STDINT_H 1 /* Define to 1 if you have the <stdlib.h> header file. */ #define _GLIBCXX_HAVE_STDLIB_H 1 /* Define if strerror_l is available in <string.h>. */ #define _GLIBCXX_HAVE_STRERROR_L 1 /* Define if strerror_r is available in <string.h>. */ #define _GLIBCXX_HAVE_STRERROR_R 1 /* Define to 1 if you have the <strings.h> header file. */ #define _GLIBCXX_HAVE_STRINGS_H 1 /* Define to 1 if you have the <string.h> header file. */ #define _GLIBCXX_HAVE_STRING_H 1 /* Define to 1 if you have the `strtof' function. */ #define _GLIBCXX_HAVE_STRTOF 1 /* Define to 1 if you have the `strtold' function. */ #define _GLIBCXX_HAVE_STRTOLD 1 /* Define if strxfrm_l is available in <string.h>. */ #define _GLIBCXX_HAVE_STRXFRM_L 1 /* Define to 1 if the target runtime linker supports binding the same symbol to different versions. */ #define _GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT 1 /* Define to 1 if you have the <sys/filio.h> header file. */ /* #undef _GLIBCXX_HAVE_SYS_FILIO_H */ /* Define to 1 if you have the <sys/ioctl.h> header file. */ #define _GLIBCXX_HAVE_SYS_IOCTL_H 1 /* Define to 1 if you have the <sys/ipc.h> header file. */ #define _GLIBCXX_HAVE_SYS_IPC_H 1 /* Define to 1 if you have the <sys/isa_defs.h> header file. */ /* #undef _GLIBCXX_HAVE_SYS_ISA_DEFS_H */ /* Define to 1 if you have the <sys/machine.h> header file. */ /* #undef _GLIBCXX_HAVE_SYS_MACHINE_H */ /* Define to 1 if you have the <sys/param.h> header file. */ #define _GLIBCXX_HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the <sys/resource.h> header file. */ #define _GLIBCXX_HAVE_SYS_RESOURCE_H 1 /* Define to 1 if you have a suitable <sys/sdt.h> header file */ #define _GLIBCXX_HAVE_SYS_SDT_H 1 /* Define to 1 if you have the <sys/sem.h> header file. */ #define _GLIBCXX_HAVE_SYS_SEM_H 1 /* Define to 1 if you have the <sys/stat.h> header file. */ #define _GLIBCXX_HAVE_SYS_STAT_H 1 /* Define to 1 if you have the <sys/sysinfo.h> header file. */ #define _GLIBCXX_HAVE_SYS_SYSINFO_H 1 /* Define to 1 if you have the <sys/time.h> header file. */ #define _GLIBCXX_HAVE_SYS_TIME_H 1 /* Define to 1 if you have the <sys/types.h> header file. */ #define _GLIBCXX_HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <sys/uio.h> header file. */ #define _GLIBCXX_HAVE_SYS_UIO_H 1 /* Define if S_IFREG is available in <sys/stat.h>. */ /* #undef _GLIBCXX_HAVE_S_IFREG */ /* Define if S_IFREG is available in <sys/stat.h>. */ #define _GLIBCXX_HAVE_S_ISREG 1 /* Define to 1 if you have the `tanf' function. */ #define _GLIBCXX_HAVE_TANF 1 /* Define to 1 if you have the `tanhf' function. */ #define _GLIBCXX_HAVE_TANHF 1 /* Define to 1 if you have the `tanhl' function. */ #define _GLIBCXX_HAVE_TANHL 1 /* Define to 1 if you have the `tanl' function. */ #define _GLIBCXX_HAVE_TANL 1 /* Define to 1 if you have the <tgmath.h> header file. */ #define _GLIBCXX_HAVE_TGMATH_H 1 /* Define to 1 if the target supports thread-local storage. */ #define _GLIBCXX_HAVE_TLS 1 /* Define to 1 if you have the <unistd.h> header file. */ #define _GLIBCXX_HAVE_UNISTD_H 1 /* Defined if usleep exists. */ #define _GLIBCXX_HAVE_USLEEP 1 /* Defined if vfwscanf exists. */ #define _GLIBCXX_HAVE_VFWSCANF 1 /* Defined if vswscanf exists. */ #define _GLIBCXX_HAVE_VSWSCANF 1 /* Defined if vwscanf exists. */ #define _GLIBCXX_HAVE_VWSCANF 1 /* Define to 1 if you have the <wchar.h> header file. */ #define _GLIBCXX_HAVE_WCHAR_H 1 /* Defined if wcstof exists. */ #define _GLIBCXX_HAVE_WCSTOF 1 /* Define to 1 if you have the <wctype.h> header file. */ #define _GLIBCXX_HAVE_WCTYPE_H 1 /* Defined if Sleep exists. */ /* #undef _GLIBCXX_HAVE_WIN32_SLEEP */ /* Define if writev is available in <sys/uio.h>. */ #define _GLIBCXX_HAVE_WRITEV 1 /* Define to 1 if you have the `_acosf' function. */ /* #undef _GLIBCXX_HAVE__ACOSF */ /* Define to 1 if you have the `_acosl' function. */ /* #undef _GLIBCXX_HAVE__ACOSL */ /* Define to 1 if you have the `_asinf' function. */ /* #undef _GLIBCXX_HAVE__ASINF */ /* Define to 1 if you have the `_asinl' function. */ /* #undef _GLIBCXX_HAVE__ASINL */ /* Define to 1 if you have the `_atan2f' function. */ /* #undef _GLIBCXX_HAVE__ATAN2F */ /* Define to 1 if you have the `_atan2l' function. */ /* #undef _GLIBCXX_HAVE__ATAN2L */ /* Define to 1 if you have the `_atanf' function. */ /* #undef _GLIBCXX_HAVE__ATANF */ /* Define to 1 if you have the `_atanl' function. */ /* #undef _GLIBCXX_HAVE__ATANL */ /* Define to 1 if you have the `_ceilf' function. */ /* #undef _GLIBCXX_HAVE__CEILF */ /* Define to 1 if you have the `_ceill' function. */ /* #undef _GLIBCXX_HAVE__CEILL */ /* Define to 1 if you have the `_cosf' function. */ /* #undef _GLIBCXX_HAVE__COSF */ /* Define to 1 if you have the `_coshf' function. */ /* #undef _GLIBCXX_HAVE__COSHF */ /* Define to 1 if you have the `_coshl' function. */ /* #undef _GLIBCXX_HAVE__COSHL */ /* Define to 1 if you have the `_cosl' function. */ /* #undef _GLIBCXX_HAVE__COSL */ /* Define to 1 if you have the `_expf' function. */ /* #undef _GLIBCXX_HAVE__EXPF */ /* Define to 1 if you have the `_expl' function. */ /* #undef _GLIBCXX_HAVE__EXPL */ /* Define to 1 if you have the `_fabsf' function. */ /* #undef _GLIBCXX_HAVE__FABSF */ /* Define to 1 if you have the `_fabsl' function. */ /* #undef _GLIBCXX_HAVE__FABSL */ /* Define to 1 if you have the `_finite' function. */ /* #undef _GLIBCXX_HAVE__FINITE */ /* Define to 1 if you have the `_finitef' function. */ /* #undef _GLIBCXX_HAVE__FINITEF */ /* Define to 1 if you have the `_finitel' function. */ /* #undef _GLIBCXX_HAVE__FINITEL */ /* Define to 1 if you have the `_floorf' function. */ /* #undef _GLIBCXX_HAVE__FLOORF */ /* Define to 1 if you have the `_floorl' function. */ /* #undef _GLIBCXX_HAVE__FLOORL */ /* Define to 1 if you have the `_fmodf' function. */ /* #undef _GLIBCXX_HAVE__FMODF */ /* Define to 1 if you have the `_fmodl' function. */ /* #undef _GLIBCXX_HAVE__FMODL */ /* Define to 1 if you have the `_fpclass' function. */ /* #undef _GLIBCXX_HAVE__FPCLASS */ /* Define to 1 if you have the `_frexpf' function. */ /* #undef _GLIBCXX_HAVE__FREXPF */ /* Define to 1 if you have the `_frexpl' function. */ /* #undef _GLIBCXX_HAVE__FREXPL */ /* Define to 1 if you have the `_hypot' function. */ /* #undef _GLIBCXX_HAVE__HYPOT */ /* Define to 1 if you have the `_hypotf' function. */ /* #undef _GLIBCXX_HAVE__HYPOTF */ /* Define to 1 if you have the `_hypotl' function. */ /* #undef _GLIBCXX_HAVE__HYPOTL */ /* Define to 1 if you have the `_isinf' function. */ /* #undef _GLIBCXX_HAVE__ISINF */ /* Define to 1 if you have the `_isinff' function. */ /* #undef _GLIBCXX_HAVE__ISINFF */ /* Define to 1 if you have the `_isinfl' function. */ /* #undef _GLIBCXX_HAVE__ISINFL */ /* Define to 1 if you have the `_isnan' function. */ /* #undef _GLIBCXX_HAVE__ISNAN */ /* Define to 1 if you have the `_isnanf' function. */ /* #undef _GLIBCXX_HAVE__ISNANF */ /* Define to 1 if you have the `_isnanl' function. */ /* #undef _GLIBCXX_HAVE__ISNANL */ /* Define to 1 if you have the `_ldexpf' function. */ /* #undef _GLIBCXX_HAVE__LDEXPF */ /* Define to 1 if you have the `_ldexpl' function. */ /* #undef _GLIBCXX_HAVE__LDEXPL */ /* Define to 1 if you have the `_log10f' function. */ /* #undef _GLIBCXX_HAVE__LOG10F */ /* Define to 1 if you have the `_log10l' function. */ /* #undef _GLIBCXX_HAVE__LOG10L */ /* Define to 1 if you have the `_logf' function. */ /* #undef _GLIBCXX_HAVE__LOGF */ /* Define to 1 if you have the `_logl' function. */ /* #undef _GLIBCXX_HAVE__LOGL */ /* Define to 1 if you have the `_modf' function. */ /* #undef _GLIBCXX_HAVE__MODF */ /* Define to 1 if you have the `_modff' function. */ /* #undef _GLIBCXX_HAVE__MODFF */ /* Define to 1 if you have the `_modfl' function. */ /* #undef _GLIBCXX_HAVE__MODFL */ /* Define to 1 if you have the `_powf' function. */ /* #undef _GLIBCXX_HAVE__POWF */ /* Define to 1 if you have the `_powl' function. */ /* #undef _GLIBCXX_HAVE__POWL */ /* Define to 1 if you have the `_qfpclass' function. */ /* #undef _GLIBCXX_HAVE__QFPCLASS */ /* Define to 1 if you have the `_sincos' function. */ /* #undef _GLIBCXX_HAVE__SINCOS */ /* Define to 1 if you have the `_sincosf' function. */ /* #undef _GLIBCXX_HAVE__SINCOSF */ /* Define to 1 if you have the `_sincosl' function. */ /* #undef _GLIBCXX_HAVE__SINCOSL */ /* Define to 1 if you have the `_sinf' function. */ /* #undef _GLIBCXX_HAVE__SINF */ /* Define to 1 if you have the `_sinhf' function. */ /* #undef _GLIBCXX_HAVE__SINHF */ /* Define to 1 if you have the `_sinhl' function. */ /* #undef _GLIBCXX_HAVE__SINHL */ /* Define to 1 if you have the `_sinl' function. */ /* #undef _GLIBCXX_HAVE__SINL */ /* Define to 1 if you have the `_sqrtf' function. */ /* #undef _GLIBCXX_HAVE__SQRTF */ /* Define to 1 if you have the `_sqrtl' function. */ /* #undef _GLIBCXX_HAVE__SQRTL */ /* Define to 1 if you have the `_tanf' function. */ /* #undef _GLIBCXX_HAVE__TANF */ /* Define to 1 if you have the `_tanhf' function. */ /* #undef _GLIBCXX_HAVE__TANHF */ /* Define to 1 if you have the `_tanhl' function. */ /* #undef _GLIBCXX_HAVE__TANHL */ /* Define to 1 if you have the `_tanl' function. */ /* #undef _GLIBCXX_HAVE__TANL */ /* Define to 1 if you have the `__cxa_thread_atexit_impl' function. */ /* #undef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */ /* Define as const if the declaration of iconv() needs const. */ #define _GLIBCXX_ICONV_CONST /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" /* Name of package */ /* #undef _GLIBCXX_PACKAGE */ /* Define to the address where bug reports for this package should be sent. */ #define _GLIBCXX_PACKAGE_BUGREPORT "" /* Define to the full name of this package. */ #define _GLIBCXX_PACKAGE_NAME "package-unused" /* Define to the full name and version of this package. */ #define _GLIBCXX_PACKAGE_STRING "package-unused version-unused" /* Define to the one symbol short name of this package. */ #define _GLIBCXX_PACKAGE_TARNAME "libstdc++" /* Define to the home page for this package. */ #define _GLIBCXX_PACKAGE_URL "" /* Define to the version of this package. */ #define _GLIBCXX_PACKAGE__GLIBCXX_VERSION "version-unused" /* The size of `char', as computed by sizeof. */ /* #undef SIZEOF_CHAR */ /* The size of `int', as computed by sizeof. */ /* #undef SIZEOF_INT */ /* The size of `long', as computed by sizeof. */ /* #undef SIZEOF_LONG */ /* The size of `short', as computed by sizeof. */ /* #undef SIZEOF_SHORT */ /* The size of `void *', as computed by sizeof. */ /* #undef SIZEOF_VOID_P */ /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Version number of package */ /* #undef _GLIBCXX_VERSION */ /* Define if the compiler supports C++11 atomics. */ #define _GLIBCXX_ATOMIC_BUILTINS 1 /* Define to use concept checking code from the boost libraries. */ /* #undef _GLIBCXX_CONCEPT_CHECKS */ /* Define to 1 if a fully dynamic basic_string is wanted, 0 to disable, undefined for platform defaults */ #define _GLIBCXX_FULLY_DYNAMIC_STRING 0 /* Define if gthreads library is available. */ #define _GLIBCXX_HAS_GTHREADS 1 /* Define to 1 if a full hosted library is built, or 0 if freestanding. */ #define _GLIBCXX_HOSTED 1 /* Define if compatibility should be provided for -mlong-double-64. */ /* Define if ptrdiff_t is int. */ #define _GLIBCXX_PTRDIFF_T_IS_INT 1 /* Define if using setrlimit to set resource limits during "make check" */ #define _GLIBCXX_RES_LIMITS 1 /* Define if size_t is unsigned int. */ #define _GLIBCXX_SIZE_T_IS_UINT 1 /* Define if the compiler is configured for setjmp/longjmp exceptions. */ /* #undef _GLIBCXX_SJLJ_EXCEPTIONS */ /* Define to the value of the EOF integer constant. */ #define _GLIBCXX_STDIO_EOF -1 /* Define to the value of the SEEK_CUR integer constant. */ #define _GLIBCXX_STDIO_SEEK_CUR 1 /* Define to the value of the SEEK_END integer constant. */ #define _GLIBCXX_STDIO_SEEK_END 2 /* Define to use symbol versioning in the shared library. */ #define _GLIBCXX_SYMVER 1 /* Define to use darwin versioning in the shared library. */ /* #undef _GLIBCXX_SYMVER_DARWIN */ /* Define to use GNU versioning in the shared library. */ #define _GLIBCXX_SYMVER_GNU 1 /* Define to use GNU namespace versioning in the shared library. */ /* #undef _GLIBCXX_SYMVER_GNU_NAMESPACE */ /* Define to use Sun versioning in the shared library. */ /* #undef _GLIBCXX_SYMVER_SUN */ /* Define if C99 functions or macros from <wchar.h>, <math.h>, <complex.h>, <stdio.h>, and <stdlib.h> can be used or exposed. */ #define _GLIBCXX_USE_C99 1 /* Define if C99 functions in <complex.h> should be used in <complex>. Using compiler builtins for these functions requires corresponding C99 library functions to be present. */ #define _GLIBCXX_USE_C99_COMPLEX 1 /* Define if C99 functions in <complex.h> should be used in <tr1/complex>. Using compiler builtins for these functions requires corresponding C99 library functions to be present. */ #define _GLIBCXX_USE_C99_COMPLEX_TR1 1 /* Define if C99 functions in <ctype.h> should be imported in <tr1/cctype> in namespace std::tr1. */ #define _GLIBCXX_USE_C99_CTYPE_TR1 1 /* Define if C99 functions in <fenv.h> should be imported in <tr1/cfenv> in namespace std::tr1. */ #define _GLIBCXX_USE_C99_FENV_TR1 1 /* Define if C99 functions in <inttypes.h> should be imported in <tr1/cinttypes> in namespace std::tr1. */ #define _GLIBCXX_USE_C99_INTTYPES_TR1 1 /* Define if wchar_t C99 functions in <inttypes.h> should be imported in <tr1/cinttypes> in namespace std::tr1. */ #define _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 1 /* Define if C99 functions or macros in <math.h> should be imported in <cmath> in namespace std. */ #define _GLIBCXX_USE_C99_MATH 1 /* Define if C99 functions or macros in <math.h> should be imported in <tr1/cmath> in namespace std::tr1. */ #define _GLIBCXX_USE_C99_MATH_TR1 1 /* Define if C99 types in <stdint.h> should be imported in <tr1/cstdint> in namespace std::tr1. */ #define _GLIBCXX_USE_C99_STDINT_TR1 1 /* Defined if clock_gettime has monotonic clock support. */ #define _GLIBCXX_USE_CLOCK_MONOTONIC 1 /* Defined if clock_gettime syscall has monotonic and realtime clock support. */ #define _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL 1 /* Defined if clock_gettime has realtime clock support. */ #define _GLIBCXX_USE_CLOCK_REALTIME 1 /* Define if ISO/IEC TR 24733 decimal floating point types are supported on this host. */ #define _GLIBCXX_USE_DECIMAL_FLOAT 1 /* Define if __float128 is supported on this host. */ #define _GLIBCXX_USE_FLOAT128 1 /* Defined if gettimeofday is available. */ #define _GLIBCXX_USE_GETTIMEOFDAY 1 /* Define if get_nprocs is available in <sys/sysinfo.h>. */ #define _GLIBCXX_USE_GET_NPROCS 1 /* Define if __int128 is supported on this host. */ /* #undef _GLIBCXX_USE_INT128 */ /* Define if LFS support is available. */ #define _GLIBCXX_USE_LFS 1 /* Define if code specialized for long long should be used. */ #define _GLIBCXX_USE_LONG_LONG 1 /* Defined if nanosleep is available. */ /* #undef _GLIBCXX_USE_NANOSLEEP */ /* Define if NLS translations are to be used. */ #define _GLIBCXX_USE_NLS 1 /* Define if pthreads_num_processors_np is available in <pthread.h>. */ /* #undef _GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP */ /* Define if /dev/random and /dev/urandom are available for the random_device of TR1 (Chapter 5.1). */ #define _GLIBCXX_USE_RANDOM_TR1 1 /* Defined if sched_yield is available. */ /* #undef _GLIBCXX_USE_SCHED_YIELD */ /* Define if _SC_NPROCESSORS_ONLN is available in <unistd.h>. */ #define _GLIBCXX_USE_SC_NPROCESSORS_ONLN 1 /* Define if _SC_NPROC_ONLN is available in <unistd.h>. */ /* #undef _GLIBCXX_USE_SC_NPROC_ONLN */ /* Define if sysctl(), CTL_HW and HW_NCPU are available in <sys/sysctl.h>. */ /* #undef _GLIBCXX_USE_SYSCTL_HW_NCPU */ /* Define if code specialized for wchar_t should be used. */ #define _GLIBCXX_USE_WCHAR_T 1 /* Define to 1 if a verbose library is built, or 0 otherwise. */ #define _GLIBCXX_VERBOSE 1 /* Defined if as can handle rdrand. */ #define _GLIBCXX_X86_RDRAND 1 /* Define to 1 if mutex_timedlock is available. */ #define _GTHREAD_USE_MUTEX_TIMEDLOCK 1 #if defined (_GLIBCXX_HAVE__ACOSF) && ! defined (_GLIBCXX_HAVE_ACOSF) # define _GLIBCXX_HAVE_ACOSF 1 # define acosf _acosf #endif #if defined (_GLIBCXX_HAVE__ACOSL) && ! defined (_GLIBCXX_HAVE_ACOSL) # define _GLIBCXX_HAVE_ACOSL 1 # define acosl _acosl #endif #if defined (_GLIBCXX_HAVE__ASINF) && ! defined (_GLIBCXX_HAVE_ASINF) # define _GLIBCXX_HAVE_ASINF 1 # define asinf _asinf #endif #if defined (_GLIBCXX_HAVE__ASINL) && ! defined (_GLIBCXX_HAVE_ASINL) # define _GLIBCXX_HAVE_ASINL 1 # define asinl _asinl #endif #if defined (_GLIBCXX_HAVE__ATAN2F) && ! defined (_GLIBCXX_HAVE_ATAN2F) # define _GLIBCXX_HAVE_ATAN2F 1 # define atan2f _atan2f #endif #if defined (_GLIBCXX_HAVE__ATAN2L) && ! defined (_GLIBCXX_HAVE_ATAN2L) # define _GLIBCXX_HAVE_ATAN2L 1 # define atan2l _atan2l #endif #if defined (_GLIBCXX_HAVE__ATANF) && ! defined (_GLIBCXX_HAVE_ATANF) # define _GLIBCXX_HAVE_ATANF 1 # define atanf _atanf #endif #if defined (_GLIBCXX_HAVE__ATANL) && ! defined (_GLIBCXX_HAVE_ATANL) # define _GLIBCXX_HAVE_ATANL 1 # define atanl _atanl #endif #if defined (_GLIBCXX_HAVE__CEILF) && ! defined (_GLIBCXX_HAVE_CEILF) # define _GLIBCXX_HAVE_CEILF 1 # define ceilf _ceilf #endif #if defined (_GLIBCXX_HAVE__CEILL) && ! defined (_GLIBCXX_HAVE_CEILL) # define _GLIBCXX_HAVE_CEILL 1 # define ceill _ceill #endif #if defined (_GLIBCXX_HAVE__COSF) && ! defined (_GLIBCXX_HAVE_COSF) # define _GLIBCXX_HAVE_COSF 1 # define cosf _cosf #endif #if defined (_GLIBCXX_HAVE__COSHF) && ! defined (_GLIBCXX_HAVE_COSHF) # define _GLIBCXX_HAVE_COSHF 1 # define coshf _coshf #endif #if defined (_GLIBCXX_HAVE__COSHL) && ! defined (_GLIBCXX_HAVE_COSHL) # define _GLIBCXX_HAVE_COSHL 1 # define coshl _coshl #endif #if defined (_GLIBCXX_HAVE__COSL) && ! defined (_GLIBCXX_HAVE_COSL) # define _GLIBCXX_HAVE_COSL 1 # define cosl _cosl #endif #if defined (_GLIBCXX_HAVE__EXPF) && ! defined (_GLIBCXX_HAVE_EXPF) # define _GLIBCXX_HAVE_EXPF 1 # define expf _expf #endif #if defined (_GLIBCXX_HAVE__EXPL) && ! defined (_GLIBCXX_HAVE_EXPL) # define _GLIBCXX_HAVE_EXPL 1 # define expl _expl #endif #if defined (_GLIBCXX_HAVE__FABSF) && ! defined (_GLIBCXX_HAVE_FABSF) # define _GLIBCXX_HAVE_FABSF 1 # define fabsf _fabsf #endif #if defined (_GLIBCXX_HAVE__FABSL) && ! defined (_GLIBCXX_HAVE_FABSL) # define _GLIBCXX_HAVE_FABSL 1 # define fabsl _fabsl #endif #if defined (_GLIBCXX_HAVE__FINITE) && ! defined (_GLIBCXX_HAVE_FINITE) # define _GLIBCXX_HAVE_FINITE 1 # define finite _finite #endif #if defined (_GLIBCXX_HAVE__FINITEF) && ! defined (_GLIBCXX_HAVE_FINITEF) # define _GLIBCXX_HAVE_FINITEF 1 # define finitef _finitef #endif #if defined (_GLIBCXX_HAVE__FINITEL) && ! defined (_GLIBCXX_HAVE_FINITEL) # define _GLIBCXX_HAVE_FINITEL 1 # define finitel _finitel #endif #if defined (_GLIBCXX_HAVE__FLOORF) && ! defined (_GLIBCXX_HAVE_FLOORF) # define _GLIBCXX_HAVE_FLOORF 1 # define floorf _floorf #endif #if defined (_GLIBCXX_HAVE__FLOORL) && ! defined (_GLIBCXX_HAVE_FLOORL) # define _GLIBCXX_HAVE_FLOORL 1 # define floorl _floorl #endif #if defined (_GLIBCXX_HAVE__FMODF) && ! defined (_GLIBCXX_HAVE_FMODF) # define _GLIBCXX_HAVE_FMODF 1 # define fmodf _fmodf #endif #if defined (_GLIBCXX_HAVE__FMODL) && ! defined (_GLIBCXX_HAVE_FMODL) # define _GLIBCXX_HAVE_FMODL 1 # define fmodl _fmodl #endif #if defined (_GLIBCXX_HAVE__FPCLASS) && ! defined (_GLIBCXX_HAVE_FPCLASS) # define _GLIBCXX_HAVE_FPCLASS 1 # define fpclass _fpclass #endif #if defined (_GLIBCXX_HAVE__FREXPF) && ! defined (_GLIBCXX_HAVE_FREXPF) # define _GLIBCXX_HAVE_FREXPF 1 # define frexpf _frexpf #endif #if defined (_GLIBCXX_HAVE__FREXPL) && ! defined (_GLIBCXX_HAVE_FREXPL) # define _GLIBCXX_HAVE_FREXPL 1 # define frexpl _frexpl #endif #if defined (_GLIBCXX_HAVE__HYPOT) && ! defined (_GLIBCXX_HAVE_HYPOT) # define _GLIBCXX_HAVE_HYPOT 1 # define hypot _hypot #endif #if defined (_GLIBCXX_HAVE__HYPOTF) && ! defined (_GLIBCXX_HAVE_HYPOTF) # define _GLIBCXX_HAVE_HYPOTF 1 # define hypotf _hypotf #endif #if defined (_GLIBCXX_HAVE__HYPOTL) && ! defined (_GLIBCXX_HAVE_HYPOTL) # define _GLIBCXX_HAVE_HYPOTL 1 # define hypotl _hypotl #endif #if defined (_GLIBCXX_HAVE__ISINF) && ! defined (_GLIBCXX_HAVE_ISINF) # define _GLIBCXX_HAVE_ISINF 1 # define isinf _isinf #endif #if defined (_GLIBCXX_HAVE__ISINFF) && ! defined (_GLIBCXX_HAVE_ISINFF) # define _GLIBCXX_HAVE_ISINFF 1 # define isinff _isinff #endif #if defined (_GLIBCXX_HAVE__ISINFL) && ! defined (_GLIBCXX_HAVE_ISINFL) # define _GLIBCXX_HAVE_ISINFL 1 # define isinfl _isinfl #endif #if defined (_GLIBCXX_HAVE__ISNAN) && ! defined (_GLIBCXX_HAVE_ISNAN) # define _GLIBCXX_HAVE_ISNAN 1 # define isnan _isnan #endif #if defined (_GLIBCXX_HAVE__ISNANF) && ! defined (_GLIBCXX_HAVE_ISNANF) # define _GLIBCXX_HAVE_ISNANF 1 # define isnanf _isnanf #endif #if defined (_GLIBCXX_HAVE__ISNANL) && ! defined (_GLIBCXX_HAVE_ISNANL) # define _GLIBCXX_HAVE_ISNANL 1 # define isnanl _isnanl #endif #if defined (_GLIBCXX_HAVE__LDEXPF) && ! defined (_GLIBCXX_HAVE_LDEXPF) # define _GLIBCXX_HAVE_LDEXPF 1 # define ldexpf _ldexpf #endif #if defined (_GLIBCXX_HAVE__LDEXPL) && ! defined (_GLIBCXX_HAVE_LDEXPL) # define _GLIBCXX_HAVE_LDEXPL 1 # define ldexpl _ldexpl #endif #if defined (_GLIBCXX_HAVE__LOG10F) && ! defined (_GLIBCXX_HAVE_LOG10F) # define _GLIBCXX_HAVE_LOG10F 1 # define log10f _log10f #endif #if defined (_GLIBCXX_HAVE__LOG10L) && ! defined (_GLIBCXX_HAVE_LOG10L) # define _GLIBCXX_HAVE_LOG10L 1 # define log10l _log10l #endif #if defined (_GLIBCXX_HAVE__LOGF) && ! defined (_GLIBCXX_HAVE_LOGF) # define _GLIBCXX_HAVE_LOGF 1 # define logf _logf #endif #if defined (_GLIBCXX_HAVE__LOGL) && ! defined (_GLIBCXX_HAVE_LOGL) # define _GLIBCXX_HAVE_LOGL 1 # define logl _logl #endif #if defined (_GLIBCXX_HAVE__MODF) && ! defined (_GLIBCXX_HAVE_MODF) # define _GLIBCXX_HAVE_MODF 1 # define modf _modf #endif #if defined (_GLIBCXX_HAVE__MODFF) && ! defined (_GLIBCXX_HAVE_MODFF) # define _GLIBCXX_HAVE_MODFF 1 # define modff _modff #endif #if defined (_GLIBCXX_HAVE__MODFL) && ! defined (_GLIBCXX_HAVE_MODFL) # define _GLIBCXX_HAVE_MODFL 1 # define modfl _modfl #endif #if defined (_GLIBCXX_HAVE__POWF) && ! defined (_GLIBCXX_HAVE_POWF) # define _GLIBCXX_HAVE_POWF 1 # define powf _powf #endif #if defined (_GLIBCXX_HAVE__POWL) && ! defined (_GLIBCXX_HAVE_POWL) # define _GLIBCXX_HAVE_POWL 1 # define powl _powl #endif #if defined (_GLIBCXX_HAVE__QFPCLASS) && ! defined (_GLIBCXX_HAVE_QFPCLASS) # define _GLIBCXX_HAVE_QFPCLASS 1 # define qfpclass _qfpclass #endif #if defined (_GLIBCXX_HAVE__SINCOS) && ! defined (_GLIBCXX_HAVE_SINCOS) # define _GLIBCXX_HAVE_SINCOS 1 # define sincos _sincos #endif #if defined (_GLIBCXX_HAVE__SINCOSF) && ! defined (_GLIBCXX_HAVE_SINCOSF) # define _GLIBCXX_HAVE_SINCOSF 1 # define sincosf _sincosf #endif #if defined (_GLIBCXX_HAVE__SINCOSL) && ! defined (_GLIBCXX_HAVE_SINCOSL) # define _GLIBCXX_HAVE_SINCOSL 1 # define sincosl _sincosl #endif #if defined (_GLIBCXX_HAVE__SINF) && ! defined (_GLIBCXX_HAVE_SINF) # define _GLIBCXX_HAVE_SINF 1 # define sinf _sinf #endif #if defined (_GLIBCXX_HAVE__SINHF) && ! defined (_GLIBCXX_HAVE_SINHF) # define _GLIBCXX_HAVE_SINHF 1 # define sinhf _sinhf #endif #if defined (_GLIBCXX_HAVE__SINHL) && ! defined (_GLIBCXX_HAVE_SINHL) # define _GLIBCXX_HAVE_SINHL 1 # define sinhl _sinhl #endif #if defined (_GLIBCXX_HAVE__SINL) && ! defined (_GLIBCXX_HAVE_SINL) # define _GLIBCXX_HAVE_SINL 1 # define sinl _sinl #endif #if defined (_GLIBCXX_HAVE__SQRTF) && ! defined (_GLIBCXX_HAVE_SQRTF) # define _GLIBCXX_HAVE_SQRTF 1 # define sqrtf _sqrtf #endif #if defined (_GLIBCXX_HAVE__SQRTL) && ! defined (_GLIBCXX_HAVE_SQRTL) # define _GLIBCXX_HAVE_SQRTL 1 # define sqrtl _sqrtl #endif #if defined (_GLIBCXX_HAVE__STRTOF) && ! defined (_GLIBCXX_HAVE_STRTOF) # define _GLIBCXX_HAVE_STRTOF 1 # define strtof _strtof #endif #if defined (_GLIBCXX_HAVE__STRTOLD) && ! defined (_GLIBCXX_HAVE_STRTOLD) # define _GLIBCXX_HAVE_STRTOLD 1 # define strtold _strtold #endif #if defined (_GLIBCXX_HAVE__TANF) && ! defined (_GLIBCXX_HAVE_TANF) # define _GLIBCXX_HAVE_TANF 1 # define tanf _tanf #endif #if defined (_GLIBCXX_HAVE__TANHF) && ! defined (_GLIBCXX_HAVE_TANHF) # define _GLIBCXX_HAVE_TANHF 1 # define tanhf _tanhf #endif #if defined (_GLIBCXX_HAVE__TANHL) && ! defined (_GLIBCXX_HAVE_TANHL) # define _GLIBCXX_HAVE_TANHL 1 # define tanhl _tanhl #endif #if defined (_GLIBCXX_HAVE__TANL) && ! defined (_GLIBCXX_HAVE_TANL) # define _GLIBCXX_HAVE_TANL 1 # define tanl _tanl #endif #endif // _GLIBCXX_CXX_CONFIG_H �����������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/c++locale.h���������������������������������������������������0000644�����������������00000006350�14763166027�0014233 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Wrapper for underlying C-language localization -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/c++locale.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{locale} */ // // ISO C++ 14882: 22.8 Standard locale categories. // // Written by Benjamin Kosnik <bkoz@redhat.com> #ifndef _GLIBCXX_CXX_LOCALE_H #define _GLIBCXX_CXX_LOCALE_H 1 #pragma GCC system_header #include <clocale> #define _GLIBCXX_C_LOCALE_GNU 1 #define _GLIBCXX_NUM_CATEGORIES 6 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION extern "C" __typeof(uselocale) __uselocale; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef __locale_t __c_locale; // Convert numeric value of type double and long double to string and // return length of string. If vsnprintf is available use it, otherwise // fall back to the unsafe vsprintf which, in general, can be dangerous // and should be avoided. inline int __convert_from_v(const __c_locale& __cloc __attribute__ ((__unused__)), char* __out, const int __size __attribute__ ((__unused__)), const char* __fmt, ...) { #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) __c_locale __old = __gnu_cxx::__uselocale(__cloc); #else char* __old = std::setlocale(LC_NUMERIC, 0); char* __sav = 0; if (__builtin_strcmp(__old, "C")) { const size_t __len = __builtin_strlen(__old) + 1; __sav = new char[__len]; __builtin_memcpy(__sav, __old, __len); std::setlocale(LC_NUMERIC, "C"); } #endif __builtin_va_list __args; __builtin_va_start(__args, __fmt); #ifdef _GLIBCXX_USE_C99 const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args); #else const int __ret = __builtin_vsprintf(__out, __fmt, __args); #endif __builtin_va_end(__args); #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) __gnu_cxx::__uselocale(__old); #else if (__sav) { std::setlocale(LC_NUMERIC, __sav); delete [] __sav; } #endif return __ret; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/atomic_word.h�������������������������������������������������0000644�����������������00000003604�14763166027�0015011 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Low-level type for atomic operations -*- C++ -*- // Copyright (C) 2004-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file atomic_word.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _GLIBCXX_ATOMIC_WORD_H #define _GLIBCXX_ATOMIC_WORD_H 1 typedef int _Atomic_word; // Define these two macros using the appropriate memory barrier for the target. // The commented out versions below are the defaults. // See ia64/atomic_word.h for an alternative approach. // This one prevents loads from being hoisted across the barrier; // in other words, this is a Load-Load acquire barrier. // This is necessary iff TARGET_RELAXED_ORDERING is defined in tm.h. // #define _GLIBCXX_READ_MEM_BARRIER __asm __volatile ("":::"memory") // This one prevents stores from being sunk across the barrier; in other // words, a Store-Store release barrier. // #define _GLIBCXX_WRITE_MEM_BARRIER __asm __volatile ("":::"memory") #endif ����������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/ctype_base.h��������������������������������������������������0000644�����������������00000004302�14763166027�0014614 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Locale support -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/ctype_base.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{locale} */ // // ISO C++ 14882: 22.1 Locales // // Information as gleaned from /usr/include/ctype.h namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /// @brief Base class for ctype. struct ctype_base { // Non-standard typedefs. typedef const int* __to_type; // NB: Offsets into ctype<char>::_M_table force a particular size // on the mask type. Because of this, we don't use an enum. typedef unsigned short mask; static const mask upper = _ISupper; static const mask lower = _ISlower; static const mask alpha = _ISalpha; static const mask digit = _ISdigit; static const mask xdigit = _ISxdigit; static const mask space = _ISspace; static const mask print = _ISprint; static const mask graph = _ISalpha | _ISdigit | _ISpunct; static const mask cntrl = _IScntrl; static const mask punct = _ISpunct; static const mask alnum = _ISalpha | _ISdigit; }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/time_members.h������������������������������������������������0000644�����������������00000005565�14763166027�0015162 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// std::time_get, std::time_put implementation, GNU version -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/time_members.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{locale} */ // // ISO C++ 14882: 22.2.5.1.2 - time_get functions // ISO C++ 14882: 22.2.5.3.2 - time_put functions // // Written by Benjamin Kosnik <bkoz@redhat.com> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _CharT> __timepunct<_CharT>::__timepunct(size_t __refs) : facet(__refs), _M_data(0), _M_c_locale_timepunct(0), _M_name_timepunct(_S_get_c_name()) { _M_initialize_timepunct(); } template<typename _CharT> __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(0), _M_name_timepunct(_S_get_c_name()) { _M_initialize_timepunct(); } template<typename _CharT> __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, size_t __refs) : facet(__refs), _M_data(0), _M_c_locale_timepunct(0), _M_name_timepunct(0) { if (__builtin_strcmp(__s, _S_get_c_name()) != 0) { const size_t __len = __builtin_strlen(__s) + 1; char* __tmp = new char[__len]; __builtin_memcpy(__tmp, __s, __len); _M_name_timepunct = __tmp; } else _M_name_timepunct = _S_get_c_name(); __try { _M_initialize_timepunct(__cloc); } __catch(...) { if (_M_name_timepunct != _S_get_c_name()) delete [] _M_name_timepunct; __throw_exception_again; } } template<typename _CharT> __timepunct<_CharT>::~__timepunct() { if (_M_name_timepunct != _S_get_c_name()) delete [] _M_name_timepunct; delete _M_data; _S_destroy_c_locale(_M_c_locale_timepunct); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace �������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/stdc++.h������������������������������������������������������0000644�����������������00000005332�14763166027�0013565 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// C++ includes used for precompiling -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file stdc++.h * This is an implementation file for a precompiled header. */ // 17.4.1.2 Headers // C #ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #if __cplusplus >= 201103L #include <ccomplex> #include <cfenv> #include <cinttypes> #include <cstdalign> #include <cstdbool> #include <cstdint> #include <ctgmath> #include <cwchar> #include <cwctype> #endif // C++ #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #if __cplusplus >= 201103L #include <array> #include <atomic> #include <chrono> #include <condition_variable> #include <forward_list> #include <future> #include <initializer_list> #include <mutex> #include <random> #include <ratio> #include <regex> #include <scoped_allocator> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <type_traits> #include <unordered_map> #include <unordered_set> #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/gthr-posix.h��������������������������������������������������0000644�����������������00000057255�14763166027�0014621 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Threads compatibility routines for libgcc2 and libobjc. */ /* Compile this one with gcc. */ /* Copyright (C) 1997-2013 Free Software Foundation, Inc. This file is part of GCC. GCC 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 3, or (at your option) any later version. GCC 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. Under Section 7 of GPL version 3, you are granted additional permissions described in the GCC Runtime Library Exception, version 3.1, as published by the Free Software Foundation. You should have received a copy of the GNU General Public License and a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GLIBCXX_GCC_GTHR_POSIX_H #define _GLIBCXX_GCC_GTHR_POSIX_H /* POSIX threads specific definitions. Easy, since the interface is just one-to-one mapping. */ #define __GTHREADS 1 #define __GTHREADS_CXX0X 1 #include <pthread.h> #if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \ || !defined(_GTHREAD_USE_MUTEX_TIMEDLOCK)) # include <unistd.h> # if defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0 # define _GTHREAD_USE_MUTEX_TIMEDLOCK 1 # else # define _GTHREAD_USE_MUTEX_TIMEDLOCK 0 # endif #endif typedef pthread_t __gthread_t; typedef pthread_key_t __gthread_key_t; typedef pthread_once_t __gthread_once_t; typedef pthread_mutex_t __gthread_mutex_t; typedef pthread_mutex_t __gthread_recursive_mutex_t; typedef pthread_cond_t __gthread_cond_t; typedef struct timespec __gthread_time_t; /* POSIX like conditional variables are supported. Please look at comments in gthr.h for details. */ #define __GTHREAD_HAS_COND 1 #define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER #define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function #define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT #if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER) #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER #elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP #else #define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function #endif #define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER #define __GTHREAD_TIME_INIT {0,0} #ifdef _GTHREAD_USE_MUTEX_INIT_FUNC # undef __GTHREAD_MUTEX_INIT #endif #ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC # undef __GTHREAD_RECURSIVE_MUTEX_INIT # undef __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION # define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function #endif #ifdef _GTHREAD_USE_COND_INIT_FUNC # undef __GTHREAD_COND_INIT # define __GTHREAD_COND_INIT_FUNCTION __gthread_cond_init_function #endif #if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK # ifndef __gthrw_pragma # define __gthrw_pragma(pragma) # endif # define __gthrw2(name,name2,type) \ static __typeof(type) name __attribute__ ((__weakref__(#name2))); \ __gthrw_pragma(weak type) # define __gthrw_(name) __gthrw_ ## name #else # define __gthrw2(name,name2,type) # define __gthrw_(name) name #endif /* Typically, __gthrw_foo is a weak reference to symbol foo. */ #define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name) __gthrw(pthread_once) __gthrw(pthread_getspecific) __gthrw(pthread_setspecific) __gthrw(pthread_create) __gthrw(pthread_join) __gthrw(pthread_equal) __gthrw(pthread_self) __gthrw(pthread_detach) #ifndef __BIONIC__ __gthrw(pthread_cancel) #endif __gthrw(sched_yield) __gthrw(pthread_mutex_lock) __gthrw(pthread_mutex_trylock) #if _GTHREAD_USE_MUTEX_TIMEDLOCK __gthrw(pthread_mutex_timedlock) #endif __gthrw(pthread_mutex_unlock) __gthrw(pthread_mutex_init) __gthrw(pthread_mutex_destroy) __gthrw(pthread_cond_init) __gthrw(pthread_cond_broadcast) __gthrw(pthread_cond_signal) __gthrw(pthread_cond_wait) __gthrw(pthread_cond_timedwait) __gthrw(pthread_cond_destroy) __gthrw(pthread_key_create) __gthrw(pthread_key_delete) __gthrw(pthread_mutexattr_init) __gthrw(pthread_mutexattr_settype) __gthrw(pthread_mutexattr_destroy) #if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK) /* Objective-C. */ __gthrw(pthread_exit) #ifdef _POSIX_PRIORITY_SCHEDULING #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING __gthrw(sched_get_priority_max) __gthrw(sched_get_priority_min) #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ #endif /* _POSIX_PRIORITY_SCHEDULING */ __gthrw(pthread_attr_destroy) __gthrw(pthread_attr_init) __gthrw(pthread_attr_setdetachstate) #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING __gthrw(pthread_getschedparam) __gthrw(pthread_setschedparam) #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ #endif /* _LIBOBJC || _LIBOBJC_WEAK */ #if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK /* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if -pthreads is not specified. The functions are dummies and most return an error value. However pthread_once returns 0 without invoking the routine it is passed so we cannot pretend that the interface is active if -pthreads is not specified. On Solaris 2.5.1, the interface is not exposed at all so we need to play the usual game with weak symbols. On Solaris 10 and up, a working interface is always exposed. On FreeBSD 6 and later, libc also exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc, which means the alternate __gthread_active_p below cannot be used there. */ #if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__)) static volatile int __gthread_active = -1; static void __gthread_trigger (void) { __gthread_active = 1; } static inline int __gthread_active_p (void) { static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT; /* Avoid reading __gthread_active twice on the main code path. */ int __gthread_active_latest_value = __gthread_active; /* This test is not protected to avoid taking a lock on the main code path so every update of __gthread_active in a threaded program must be atomic with regard to the result of the test. */ if (__builtin_expect (__gthread_active_latest_value < 0, 0)) { if (__gthrw_(pthread_once)) { /* If this really is a threaded program, then we must ensure that __gthread_active has been set to 1 before exiting this block. */ __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex); __gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger); __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex); } /* Make sure we'll never enter this block again. */ if (__gthread_active < 0) __gthread_active = 0; __gthread_active_latest_value = __gthread_active; } return __gthread_active_latest_value != 0; } #else /* neither FreeBSD nor Solaris */ /* For a program to be multi-threaded the only thing that it certainly must be using is pthread_create. However, there may be other libraries that intercept pthread_create with their own definitions to wrap pthreads functionality for some purpose. In those cases, pthread_create being defined might not necessarily mean that libpthread is actually linked in. For the GNU C library, we can use a known internal name. This is always available in the ABI, but no other library would define it. That is ideal, since any public pthread function might be intercepted just as pthread_create might be. __pthread_key_create is an "internal" implementation symbol, but it is part of the public exported ABI. Also, it's among the symbols that the static libpthread.a always links in whenever pthread_create is used, so there is no danger of a false negative result in any statically-linked, multi-threaded program. For others, we choose pthread_cancel as a function that seems unlikely to be redefined by an interceptor library. The bionic (Android) C library does not provide pthread_cancel, so we do use pthread_create there (and interceptor libraries lose). */ #ifdef __GLIBC__ __gthrw2(__gthrw_(__pthread_key_create), __pthread_key_create, pthread_key_create) # define GTHR_ACTIVE_PROXY __gthrw_(__pthread_key_create) #elif defined (__BIONIC__) # define GTHR_ACTIVE_PROXY __gthrw_(pthread_create) #else # define GTHR_ACTIVE_PROXY __gthrw_(pthread_cancel) #endif static inline int __gthread_active_p (void) { static void *const __gthread_active_ptr = __extension__ (void *) >HR_ACTIVE_PROXY; return __gthread_active_ptr != 0; } #endif /* FreeBSD or Solaris */ #else /* not __GXX_WEAK__ */ /* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread calls in shared flavors of the HP-UX C library. Most of the stubs have no functionality. The details are described in the "libc cumulative patch" for each subversion of HP-UX 11. There are two special interfaces provided for checking whether an application is linked to a shared pthread library or not. However, these interfaces aren't available in early libpthread libraries. We also need a test that works for archive libraries. We can't use pthread_once as some libc versions call the init function. We also can't use pthread_create or pthread_attr_init as these create a thread and thereby prevent changing the default stack size. The function pthread_default_stacksize_np is available in both the archive and shared versions of libpthread. It can be used to determine the default pthread stack size. There is a stub in some shared libc versions which returns a zero size if pthreads are not active. We provide an equivalent stub to handle cases where libc doesn't provide one. */ #if defined(__hppa__) && defined(__hpux__) static volatile int __gthread_active = -1; static inline int __gthread_active_p (void) { /* Avoid reading __gthread_active twice on the main code path. */ int __gthread_active_latest_value = __gthread_active; size_t __s; if (__builtin_expect (__gthread_active_latest_value < 0, 0)) { pthread_default_stacksize_np (0, &__s); __gthread_active = __s ? 1 : 0; __gthread_active_latest_value = __gthread_active; } return __gthread_active_latest_value != 0; } #else /* not hppa-hpux */ static inline int __gthread_active_p (void) { return 1; } #endif /* hppa-hpux */ #endif /* __GXX_WEAK__ */ #ifdef _LIBOBJC /* This is the config.h file in libobjc/ */ #include <config.h> #ifdef HAVE_SCHED_H # include <sched.h> #endif /* Key structure for maintaining thread specific storage */ static pthread_key_t _objc_thread_storage; static pthread_attr_t _objc_thread_attribs; /* Thread local storage for a single thread */ static void *thread_local_storage = NULL; /* Backend initialization functions */ /* Initialize the threads subsystem. */ static inline int __gthread_objc_init_thread_system (void) { if (__gthread_active_p ()) { /* Initialize the thread storage key. */ if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0) { /* The normal default detach state for threads is * PTHREAD_CREATE_JOINABLE which causes threads to not die * when you think they should. */ if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0 && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs, PTHREAD_CREATE_DETACHED) == 0) return 0; } } return -1; } /* Close the threads subsystem. */ static inline int __gthread_objc_close_thread_system (void) { if (__gthread_active_p () && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0 && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0) return 0; return -1; } /* Backend thread functions */ /* Create a new thread of execution. */ static inline objc_thread_t __gthread_objc_thread_detach (void (*func)(void *), void *arg) { objc_thread_t thread_id; pthread_t new_thread_handle; if (!__gthread_active_p ()) return NULL; if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs, (void *) func, arg))) thread_id = (objc_thread_t) new_thread_handle; else thread_id = NULL; return thread_id; } /* Set the current thread's priority. */ static inline int __gthread_objc_thread_set_priority (int priority) { if (!__gthread_active_p ()) return -1; else { #ifdef _POSIX_PRIORITY_SCHEDULING #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING pthread_t thread_id = __gthrw_(pthread_self) (); int policy; struct sched_param params; int priority_min, priority_max; if (__gthrw_(pthread_getschedparam) (thread_id, &policy, ¶ms) == 0) { if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1) return -1; if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1) return -1; if (priority > priority_max) priority = priority_max; else if (priority < priority_min) priority = priority_min; params.sched_priority = priority; /* * The solaris 7 and several other man pages incorrectly state that * this should be a pointer to policy but pthread.h is universally * at odds with this. */ if (__gthrw_(pthread_setschedparam) (thread_id, policy, ¶ms) == 0) return 0; } #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ #endif /* _POSIX_PRIORITY_SCHEDULING */ return -1; } } /* Return the current thread's priority. */ static inline int __gthread_objc_thread_get_priority (void) { #ifdef _POSIX_PRIORITY_SCHEDULING #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING if (__gthread_active_p ()) { int policy; struct sched_param params; if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, ¶ms) == 0) return params.sched_priority; else return -1; } else #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ #endif /* _POSIX_PRIORITY_SCHEDULING */ return OBJC_THREAD_INTERACTIVE_PRIORITY; } /* Yield our process time to another thread. */ static inline void __gthread_objc_thread_yield (void) { if (__gthread_active_p ()) __gthrw_(sched_yield) (); } /* Terminate the current thread. */ static inline int __gthread_objc_thread_exit (void) { if (__gthread_active_p ()) /* exit the thread */ __gthrw_(pthread_exit) (&__objc_thread_exit_status); /* Failed if we reached here */ return -1; } /* Returns an integer value which uniquely describes a thread. */ static inline objc_thread_t __gthread_objc_thread_id (void) { if (__gthread_active_p ()) return (objc_thread_t) __gthrw_(pthread_self) (); else return (objc_thread_t) 1; } /* Sets the thread's local storage pointer. */ static inline int __gthread_objc_thread_set_data (void *value) { if (__gthread_active_p ()) return __gthrw_(pthread_setspecific) (_objc_thread_storage, value); else { thread_local_storage = value; return 0; } } /* Returns the thread's local storage pointer. */ static inline void * __gthread_objc_thread_get_data (void) { if (__gthread_active_p ()) return __gthrw_(pthread_getspecific) (_objc_thread_storage); else return thread_local_storage; } /* Backend mutex functions */ /* Allocate a mutex. */ static inline int __gthread_objc_mutex_allocate (objc_mutex_t mutex) { if (__gthread_active_p ()) { mutex->backend = objc_malloc (sizeof (pthread_mutex_t)); if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL)) { objc_free (mutex->backend); mutex->backend = NULL; return -1; } } return 0; } /* Deallocate a mutex. */ static inline int __gthread_objc_mutex_deallocate (objc_mutex_t mutex) { if (__gthread_active_p ()) { int count; /* * Posix Threads specifically require that the thread be unlocked * for __gthrw_(pthread_mutex_destroy) to work. */ do { count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend); if (count < 0) return -1; } while (count); if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend)) return -1; objc_free (mutex->backend); mutex->backend = NULL; } return 0; } /* Grab a lock on a mutex. */ static inline int __gthread_objc_mutex_lock (objc_mutex_t mutex) { if (__gthread_active_p () && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0) { return -1; } return 0; } /* Try to grab a lock on a mutex. */ static inline int __gthread_objc_mutex_trylock (objc_mutex_t mutex) { if (__gthread_active_p () && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0) { return -1; } return 0; } /* Unlock the mutex */ static inline int __gthread_objc_mutex_unlock (objc_mutex_t mutex) { if (__gthread_active_p () && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0) { return -1; } return 0; } /* Backend condition mutex functions */ /* Allocate a condition. */ static inline int __gthread_objc_condition_allocate (objc_condition_t condition) { if (__gthread_active_p ()) { condition->backend = objc_malloc (sizeof (pthread_cond_t)); if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL)) { objc_free (condition->backend); condition->backend = NULL; return -1; } } return 0; } /* Deallocate a condition. */ static inline int __gthread_objc_condition_deallocate (objc_condition_t condition) { if (__gthread_active_p ()) { if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend)) return -1; objc_free (condition->backend); condition->backend = NULL; } return 0; } /* Wait on the condition */ static inline int __gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend, (pthread_mutex_t *) mutex->backend); else return 0; } /* Wake up all threads waiting on this condition. */ static inline int __gthread_objc_condition_broadcast (objc_condition_t condition) { if (__gthread_active_p ()) return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend); else return 0; } /* Wake up one thread waiting on this condition. */ static inline int __gthread_objc_condition_signal (objc_condition_t condition) { if (__gthread_active_p ()) return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend); else return 0; } #else /* _LIBOBJC */ static inline int __gthread_create (__gthread_t *__threadid, void *(*__func) (void*), void *__args) { return __gthrw_(pthread_create) (__threadid, NULL, __func, __args); } static inline int __gthread_join (__gthread_t __threadid, void **__value_ptr) { return __gthrw_(pthread_join) (__threadid, __value_ptr); } static inline int __gthread_detach (__gthread_t __threadid) { return __gthrw_(pthread_detach) (__threadid); } static inline int __gthread_equal (__gthread_t __t1, __gthread_t __t2) { return __gthrw_(pthread_equal) (__t1, __t2); } static inline __gthread_t __gthread_self (void) { return __gthrw_(pthread_self) (); } static inline int __gthread_yield (void) { return __gthrw_(sched_yield) (); } static inline int __gthread_once (__gthread_once_t *__once, void (*__func) (void)) { if (__gthread_active_p ()) return __gthrw_(pthread_once) (__once, __func); else return -1; } static inline int __gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *)) { return __gthrw_(pthread_key_create) (__key, __dtor); } static inline int __gthread_key_delete (__gthread_key_t __key) { return __gthrw_(pthread_key_delete) (__key); } static inline void * __gthread_getspecific (__gthread_key_t __key) { return __gthrw_(pthread_getspecific) (__key); } static inline int __gthread_setspecific (__gthread_key_t __key, const void *__ptr) { return __gthrw_(pthread_setspecific) (__key, __ptr); } static inline void __gthread_mutex_init_function (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) __gthrw_(pthread_mutex_init) (__mutex, NULL); } static inline int __gthread_mutex_destroy (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_destroy) (__mutex); else return 0; } static inline int __gthread_mutex_lock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_lock) (__mutex); else return 0; } static inline int __gthread_mutex_trylock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_trylock) (__mutex); else return 0; } #if _GTHREAD_USE_MUTEX_TIMEDLOCK static inline int __gthread_mutex_timedlock (__gthread_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout); else return 0; } #endif static inline int __gthread_mutex_unlock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_unlock) (__mutex); else return 0; } #if !defined( PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) \ || defined(_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC) static inline int __gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex) { if (__gthread_active_p ()) { pthread_mutexattr_t __attr; int __r; __r = __gthrw_(pthread_mutexattr_init) (&__attr); if (!__r) __r = __gthrw_(pthread_mutexattr_settype) (&__attr, PTHREAD_MUTEX_RECURSIVE); if (!__r) __r = __gthrw_(pthread_mutex_init) (__mutex, &__attr); if (!__r) __r = __gthrw_(pthread_mutexattr_destroy) (&__attr); return __r; } return 0; } #endif static inline int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_lock (__mutex); } static inline int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_trylock (__mutex); } #if _GTHREAD_USE_MUTEX_TIMEDLOCK static inline int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { return __gthread_mutex_timedlock (__mutex, __abs_timeout); } #endif static inline int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_unlock (__mutex); } static inline int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_destroy (__mutex); } #ifdef _GTHREAD_USE_COND_INIT_FUNC static inline void __gthread_cond_init_function (__gthread_cond_t *__cond) { if (__gthread_active_p ()) __gthrw_(pthread_cond_init) (__cond, NULL); } #endif static inline int __gthread_cond_broadcast (__gthread_cond_t *__cond) { return __gthrw_(pthread_cond_broadcast) (__cond); } static inline int __gthread_cond_signal (__gthread_cond_t *__cond) { return __gthrw_(pthread_cond_signal) (__cond); } static inline int __gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex) { return __gthrw_(pthread_cond_wait) (__cond, __mutex); } static inline int __gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout); } static inline int __gthread_cond_wait_recursive (__gthread_cond_t *__cond, __gthread_recursive_mutex_t *__mutex) { return __gthread_cond_wait (__cond, __mutex); } static inline int __gthread_cond_destroy (__gthread_cond_t* __cond) { return __gthrw_(pthread_cond_destroy) (__cond); } #endif /* _LIBOBJC */ #endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/c++io.h�������������������������������������������������������0000644�����������������00000003110�14763166027�0013372 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Underlying io library details -*- C++ -*- // Copyright (C) 2000-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/c++io.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ios} */ // c_io_stdio.h - Defines for using "C" stdio.h #ifndef _GLIBCXX_CXX_IO_H #define _GLIBCXX_CXX_IO_H 1 #include <cstdio> #include <bits/gthr.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef __gthread_mutex_t __c_lock; // for basic_file.h typedef FILE __c_file; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/ctype_inline.h������������������������������������������������0000644�����������������00000004354�14763166027�0015167 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Locale support -*- C++ -*- // Copyright (C) 2000-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/ctype_inline.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{locale} */ // // ISO C++ 14882: 22.1 Locales // // ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) // functions go in ctype.cc namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION bool ctype<char>:: is(mask __m, char __c) const { return _M_table[static_cast<unsigned char>(__c)] & __m; } const char* ctype<char>:: is(const char* __low, const char* __high, mask* __vec) const { while (__low < __high) *__vec++ = _M_table[static_cast<unsigned char>(*__low++)]; return __high; } const char* ctype<char>:: scan_is(mask __m, const char* __low, const char* __high) const { while (__low < __high && !(_M_table[static_cast<unsigned char>(*__low)] & __m)) ++__low; return __low; } const char* ctype<char>:: scan_not(mask __m, const char* __low, const char* __high) const { while (__low < __high && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0) ++__low; return __low; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/gthr.h��������������������������������������������������������0000644�����������������00000012750�14763166027�0013450 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Threads compatibility routines for libgcc2. */ /* Compile this one with gcc. */ /* Copyright (C) 1997-2013 Free Software Foundation, Inc. This file is part of GCC. GCC 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 3, or (at your option) any later version. GCC 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. Under Section 7 of GPL version 3, you are granted additional permissions described in the GCC Runtime Library Exception, version 3.1, as published by the Free Software Foundation. You should have received a copy of the GNU General Public License and a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GLIBCXX_GCC_GTHR_H #define _GLIBCXX_GCC_GTHR_H #ifndef _GLIBCXX_HIDE_EXPORTS #pragma GCC visibility push(default) #endif /* If this file is compiled with threads support, it must #define __GTHREADS 1 to indicate that threads support is present. Also it has define function int __gthread_active_p () that returns 1 if thread system is active, 0 if not. The threads interface must define the following types: __gthread_key_t __gthread_once_t __gthread_mutex_t __gthread_recursive_mutex_t The threads interface must define the following macros: __GTHREAD_ONCE_INIT to initialize __gthread_once_t __GTHREAD_MUTEX_INIT to initialize __gthread_mutex_t to get a fast non-recursive mutex. __GTHREAD_MUTEX_INIT_FUNCTION to initialize __gthread_mutex_t to get a fast non-recursive mutex. Define this to a function which looks like this: void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *) Some systems can't initialize a mutex without a function call. Don't define __GTHREAD_MUTEX_INIT in this case. __GTHREAD_RECURSIVE_MUTEX_INIT __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION as above, but for a recursive mutex. The threads interface must define the following static functions: int __gthread_once (__gthread_once_t *once, void (*func) ()) int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *)) int __gthread_key_delete (__gthread_key_t key) void *__gthread_getspecific (__gthread_key_t key) int __gthread_setspecific (__gthread_key_t key, const void *ptr) int __gthread_mutex_destroy (__gthread_mutex_t *mutex); int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *mutex); int __gthread_mutex_lock (__gthread_mutex_t *mutex); int __gthread_mutex_trylock (__gthread_mutex_t *mutex); int __gthread_mutex_unlock (__gthread_mutex_t *mutex); int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex); int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex); int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex); The following are supported in POSIX threads only. They are required to fix a deadlock in static initialization inside libsupc++. The header file gthr-posix.h defines a symbol __GTHREAD_HAS_COND to signify that these extra features are supported. Types: __gthread_cond_t Macros: __GTHREAD_COND_INIT __GTHREAD_COND_INIT_FUNCTION Interface: int __gthread_cond_broadcast (__gthread_cond_t *cond); int __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex); int __gthread_cond_wait_recursive (__gthread_cond_t *cond, __gthread_recursive_mutex_t *mutex); All functions returning int should return zero on success or the error number. If the operation is not supported, -1 is returned. If the following are also defined, you should #define __GTHREADS_CXX0X 1 to enable the c++0x thread library. Types: __gthread_t __gthread_time_t Interface: int __gthread_create (__gthread_t *thread, void *(*func) (void*), void *args); int __gthread_join (__gthread_t thread, void **value_ptr); int __gthread_detach (__gthread_t thread); int __gthread_equal (__gthread_t t1, __gthread_t t2); __gthread_t __gthread_self (void); int __gthread_yield (void); int __gthread_mutex_timedlock (__gthread_mutex_t *m, const __gthread_time_t *abs_timeout); int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *m, const __gthread_time_t *abs_time); int __gthread_cond_signal (__gthread_cond_t *cond); int __gthread_cond_timedwait (__gthread_cond_t *cond, __gthread_mutex_t *mutex, const __gthread_time_t *abs_timeout); */ #if __GXX_WEAK__ /* The pe-coff weak support isn't fully compatible to ELF's weak. For static libraries it might would work, but as we need to deal with shared versions too, we disable it for mingw-targets. */ #ifdef __MINGW32__ #undef _GLIBCXX_GTHREAD_USE_WEAK #define _GLIBCXX_GTHREAD_USE_WEAK 0 #endif #ifndef _GLIBCXX_GTHREAD_USE_WEAK #define _GLIBCXX_GTHREAD_USE_WEAK 1 #endif #endif #include <bits/gthr-default.h> #ifndef _GLIBCXX_HIDE_EXPORTS #pragma GCC visibility pop #endif #endif /* ! _GLIBCXX_GCC_GTHR_H */ ������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/messages_members.h��������������������������������������������0000644�����������������00000010003�14763166027�0016012 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// std::messages implementation details, GNU version -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/messages_members.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{locale} */ // // ISO C++ 14882: 22.2.7.1.2 messages functions // // Written by Benjamin Kosnik <bkoz@redhat.com> #include <libintl.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Non-virtual member functions. template<typename _CharT> messages<_CharT>::messages(size_t __refs) : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), _M_name_messages(_S_get_c_name()) { } template<typename _CharT> messages<_CharT>::messages(__c_locale __cloc, const char* __s, size_t __refs) : facet(__refs), _M_c_locale_messages(0), _M_name_messages(0) { if (__builtin_strcmp(__s, _S_get_c_name()) != 0) { const size_t __len = __builtin_strlen(__s) + 1; char* __tmp = new char[__len]; __builtin_memcpy(__tmp, __s, __len); _M_name_messages = __tmp; } else _M_name_messages = _S_get_c_name(); // Last to avoid leaking memory if new throws. _M_c_locale_messages = _S_clone_c_locale(__cloc); } template<typename _CharT> typename messages<_CharT>::catalog messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, const char* __dir) const { bindtextdomain(__s.c_str(), __dir); return this->do_open(__s, __loc); } // Virtual member functions. template<typename _CharT> messages<_CharT>::~messages() { if (_M_name_messages != _S_get_c_name()) delete [] _M_name_messages; _S_destroy_c_locale(_M_c_locale_messages); } template<typename _CharT> typename messages<_CharT>::catalog messages<_CharT>::do_open(const basic_string<char>& __s, const locale&) const { // No error checking is done, assume the catalog exists and can // be used. textdomain(__s.c_str()); return 0; } template<typename _CharT> void messages<_CharT>::do_close(catalog) const { } // messages_byname template<typename _CharT> messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) : messages<_CharT>(__refs) { if (this->_M_name_messages != locale::facet::_S_get_c_name()) { delete [] this->_M_name_messages; if (__builtin_strcmp(__s, locale::facet::_S_get_c_name()) != 0) { const size_t __len = __builtin_strlen(__s) + 1; char* __tmp = new char[__len]; __builtin_memcpy(__tmp, __s, __len); this->_M_name_messages = __tmp; } else this->_M_name_messages = locale::facet::_S_get_c_name(); } if (__builtin_strcmp(__s, "C") != 0 && __builtin_strcmp(__s, "POSIX") != 0) { this->_S_destroy_c_locale(this->_M_c_locale_messages); this->_S_create_c_locale(this->_M_c_locale_messages, __s); } } _GLIBCXX_END_NAMESPACE_VERSION } // namespace �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/os_defines.h��������������������������������������������������0000644�����������������00000003367�14763166027�0014626 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Specific definitions for GNU/Linux -*- C++ -*- // Copyright (C) 2000-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/os_defines.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{iosfwd} */ #ifndef _GLIBCXX_OS_DEFINES #define _GLIBCXX_OS_DEFINES 1 // System-specific #define, typedefs, corrections, etc, go here. This // file will come before all others. // This keeps isanum, et al from being propagated as macros. #define __NO_CTYPE 1 #include <features.h> // Provide a declaration for the possibly deprecated gets function, as // glibc 2.15 and later does not declare gets for ISO C11 when // __GNU_SOURCE is defined. #if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE) # undef _GLIBCXX_HAVE_GETS #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/cxxabi_tweaks.h�����������������������������������������������0000644�����������������00000004062�14763166027�0015335 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Control various target specific ABI tweaks. Generic version. // Copyright (C) 2004-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/cxxabi_tweaks.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{cxxabi.h} */ #ifndef _CXXABI_TWEAKS_H #define _CXXABI_TWEAKS_H 1 #ifdef __cplusplus namespace __cxxabiv1 { extern "C" { #endif // The generic ABI uses the first byte of a 64-bit guard variable. #define _GLIBCXX_GUARD_TEST(x) (*(char *) (x) != 0) #define _GLIBCXX_GUARD_SET(x) *(char *) (x) = 1 #define _GLIBCXX_GUARD_BIT __guard_test_bit (0, 1) #define _GLIBCXX_GUARD_PENDING_BIT __guard_test_bit (1, 1) #define _GLIBCXX_GUARD_WAITING_BIT __guard_test_bit (2, 1) __extension__ typedef int __guard __attribute__((mode (__DI__))); // __cxa_vec_ctor has void return type. typedef void __cxa_vec_ctor_return_type; #define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return // Constructors and destructors do not return a value. typedef void __cxa_cdtor_return_type; #ifdef __cplusplus } } // namespace __cxxabiv1 #endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/gthr-single.h�������������������������������������������������0000644�����������������00000015204�14763166027�0014724 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Threads compatibility routines for libgcc2 and libobjc. */ /* Compile this one with gcc. */ /* Copyright (C) 1997-2013 Free Software Foundation, Inc. This file is part of GCC. GCC 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 3, or (at your option) any later version. GCC 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. Under Section 7 of GPL version 3, you are granted additional permissions described in the GCC Runtime Library Exception, version 3.1, as published by the Free Software Foundation. You should have received a copy of the GNU General Public License and a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GLIBCXX_GCC_GTHR_SINGLE_H #define _GLIBCXX_GCC_GTHR_SINGLE_H /* Just provide compatibility for mutex handling. */ typedef int __gthread_key_t; typedef int __gthread_once_t; typedef int __gthread_mutex_t; typedef int __gthread_recursive_mutex_t; #define __GTHREAD_ONCE_INIT 0 #define __GTHREAD_MUTEX_INIT 0 #define __GTHREAD_MUTEX_INIT_FUNCTION(mx) #define __GTHREAD_RECURSIVE_MUTEX_INIT 0 #define _GLIBCXX_UNUSED __attribute__((unused)) #ifdef _LIBOBJC /* Thread local storage for a single thread */ static void *thread_local_storage = NULL; /* Backend initialization functions */ /* Initialize the threads subsystem. */ static inline int __gthread_objc_init_thread_system (void) { /* No thread support available */ return -1; } /* Close the threads subsystem. */ static inline int __gthread_objc_close_thread_system (void) { /* No thread support available */ return -1; } /* Backend thread functions */ /* Create a new thread of execution. */ static inline objc_thread_t __gthread_objc_thread_detach (void (* func)(void *), void * arg _GLIBCXX_UNUSED) { /* No thread support available */ return NULL; } /* Set the current thread's priority. */ static inline int __gthread_objc_thread_set_priority (int priority _GLIBCXX_UNUSED) { /* No thread support available */ return -1; } /* Return the current thread's priority. */ static inline int __gthread_objc_thread_get_priority (void) { return OBJC_THREAD_INTERACTIVE_PRIORITY; } /* Yield our process time to another thread. */ static inline void __gthread_objc_thread_yield (void) { return; } /* Terminate the current thread. */ static inline int __gthread_objc_thread_exit (void) { /* No thread support available */ /* Should we really exit the program */ /* exit (&__objc_thread_exit_status); */ return -1; } /* Returns an integer value which uniquely describes a thread. */ static inline objc_thread_t __gthread_objc_thread_id (void) { /* No thread support, use 1. */ return (objc_thread_t) 1; } /* Sets the thread's local storage pointer. */ static inline int __gthread_objc_thread_set_data (void *value) { thread_local_storage = value; return 0; } /* Returns the thread's local storage pointer. */ static inline void * __gthread_objc_thread_get_data (void) { return thread_local_storage; } /* Backend mutex functions */ /* Allocate a mutex. */ static inline int __gthread_objc_mutex_allocate (objc_mutex_t mutex _GLIBCXX_UNUSED) { return 0; } /* Deallocate a mutex. */ static inline int __gthread_objc_mutex_deallocate (objc_mutex_t mutex _GLIBCXX_UNUSED) { return 0; } /* Grab a lock on a mutex. */ static inline int __gthread_objc_mutex_lock (objc_mutex_t mutex _GLIBCXX_UNUSED) { /* There can only be one thread, so we always get the lock */ return 0; } /* Try to grab a lock on a mutex. */ static inline int __gthread_objc_mutex_trylock (objc_mutex_t mutex _GLIBCXX_UNUSED) { /* There can only be one thread, so we always get the lock */ return 0; } /* Unlock the mutex */ static inline int __gthread_objc_mutex_unlock (objc_mutex_t mutex _GLIBCXX_UNUSED) { return 0; } /* Backend condition mutex functions */ /* Allocate a condition. */ static inline int __gthread_objc_condition_allocate (objc_condition_t condition _GLIBCXX_UNUSED) { return 0; } /* Deallocate a condition. */ static inline int __gthread_objc_condition_deallocate (objc_condition_t condition _GLIBCXX_UNUSED) { return 0; } /* Wait on the condition */ static inline int __gthread_objc_condition_wait (objc_condition_t condition _GLIBCXX_UNUSED, objc_mutex_t mutex _GLIBCXX_UNUSED) { return 0; } /* Wake up all threads waiting on this condition. */ static inline int __gthread_objc_condition_broadcast (objc_condition_t condition _GLIBCXX_UNUSED) { return 0; } /* Wake up one thread waiting on this condition. */ static inline int __gthread_objc_condition_signal (objc_condition_t condition _GLIBCXX_UNUSED) { return 0; } #else /* _LIBOBJC */ static inline int __gthread_active_p (void) { return 0; } static inline int __gthread_once (__gthread_once_t *__once _GLIBCXX_UNUSED, void (*__func) (void) _GLIBCXX_UNUSED) { return 0; } static inline int _GLIBCXX_UNUSED __gthread_key_create (__gthread_key_t *__key _GLIBCXX_UNUSED, void (*__func) (void *) _GLIBCXX_UNUSED) { return 0; } static int _GLIBCXX_UNUSED __gthread_key_delete (__gthread_key_t __key _GLIBCXX_UNUSED) { return 0; } static inline void * __gthread_getspecific (__gthread_key_t __key _GLIBCXX_UNUSED) { return 0; } static inline int __gthread_setspecific (__gthread_key_t __key _GLIBCXX_UNUSED, const void *__v _GLIBCXX_UNUSED) { return 0; } static inline int __gthread_mutex_destroy (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED) { return 0; } static inline int __gthread_mutex_lock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED) { return 0; } static inline int __gthread_mutex_trylock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED) { return 0; } static inline int __gthread_mutex_unlock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED) { return 0; } static inline int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_lock (__mutex); } static inline int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_trylock (__mutex); } static inline int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_unlock (__mutex); } static inline int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_destroy (__mutex); } #endif /* _LIBOBJC */ #undef _GLIBCXX_UNUSED #endif /* ! _GLIBCXX_GCC_GTHR_SINGLE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/extc++.h������������������������������������������������������0000644�����������������00000004524�14763166027�0013575 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// C++ includes used for precompiling extensions -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file extc++.h * This is an implementation file for a precompiled header. */ #if __cplusplus < 201103L #include <bits/stdtr1c++.h> #endif #include <ext/algorithm> #include <ext/array_allocator.h> #include <ext/atomicity.h> #include <ext/bitmap_allocator.h> #include <ext/cast.h> #include <ext/concurrence.h> #include <ext/debug_allocator.h> #include <ext/extptr_allocator.h> #include <ext/functional> #include <ext/iterator> #include <ext/malloc_allocator.h> #include <ext/memory> #include <ext/mt_allocator.h> #include <ext/new_allocator.h> #include <ext/numeric> #include <ext/pod_char_traits.h> #include <ext/pointer.h> #include <ext/pool_allocator.h> #include <ext/rb_tree> #include <ext/rope> #include <ext/slist> #include <ext/stdio_filebuf.h> #include <ext/stdio_sync_filebuf.h> #include <ext/throw_allocator.h> #include <ext/typelist.h> #include <ext/type_traits.h> #include <ext/vstring.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/priority_queue.hpp> #include <ext/pb_ds/exception.hpp> #include <ext/pb_ds/hash_policy.hpp> #include <ext/pb_ds/list_update_policy.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/trie_policy.hpp> #ifdef _GLIBCXX_HAVE_ICONV #include <ext/codecvt_specializations.h> #include <ext/enc_filebuf.h> #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/c++allocator.h������������������������������������������������0000644�����������������00000003471�14763166027�0014755 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Base to std::allocator -*- C++ -*- // Copyright (C) 2004-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/c++allocator.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{memory} */ #ifndef _GLIBCXX_CXX_ALLOCATOR_H #define _GLIBCXX_CXX_ALLOCATOR_H 1 #include <ext/new_allocator.h> #if __cplusplus >= 201103L namespace std { /** * @brief An alias to the base class for std::allocator. * @ingroup allocators * * Used to set the std::allocator base class to * __gnu_cxx::new_allocator. * * @tparam _Tp Type of allocated object. */ template<typename _Tp> using __allocator_base = __gnu_cxx::new_allocator<_Tp>; } #else // Define new_allocator as the base class to std::allocator. # define __allocator_base __gnu_cxx::new_allocator #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/32/bits/basic_file.h��������������������������������������������������0000644�����������������00000005512�14763166027�0014562 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Wrapper of C-language FILE struct -*- C++ -*- // Copyright (C) 2000-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // // ISO C++ 14882: 27.8 File-based streams // /** @file bits/basic_file.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ios} */ #ifndef _GLIBCXX_BASIC_FILE_STDIO_H #define _GLIBCXX_BASIC_FILE_STDIO_H 1 #pragma GCC system_header #include <bits/c++config.h> #include <bits/c++io.h> // for __c_lock and __c_file #include <ios> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Generic declaration. template<typename _CharT> class __basic_file; // Specialization. template<> class __basic_file<char> { // Underlying data source/sink. __c_file* _M_cfile; // True iff we opened _M_cfile, and thus must close it ourselves. bool _M_cfile_created; public: __basic_file(__c_lock* __lock = 0) throw (); __basic_file* open(const char* __name, ios_base::openmode __mode, int __prot = 0664); __basic_file* sys_open(__c_file* __file, ios_base::openmode); __basic_file* sys_open(int __fd, ios_base::openmode __mode) throw (); __basic_file* close(); _GLIBCXX_PURE bool is_open() const throw (); _GLIBCXX_PURE int fd() throw (); _GLIBCXX_PURE __c_file* file() throw (); ~__basic_file(); streamsize xsputn(const char* __s, streamsize __n); streamsize xsputn_2(const char* __s1, streamsize __n1, const char* __s2, streamsize __n2); streamsize xsgetn(char* __s, streamsize __n); streamoff seekoff(streamoff __off, ios_base::seekdir __way) throw (); int sync(); streamsize showmanyc(); }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/ext/opt_random.h������������������������������������������������������0000644�����������������00000011224�14763166027�0014254 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Optimizations for random number extensions, x86 version -*- C++ -*- // Copyright (C) 2012-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/random.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ext/random} */ #ifndef _EXT_OPT_RANDOM_H #define _EXT_OPT_RANDOM_H 1 #pragma GCC system_header #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #ifdef __SSE2__ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace { template<size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2, uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4> inline __m128i __sse2_recursion(__m128i __a, __m128i __b, __m128i __c, __m128i __d) { __m128i __y = _mm_srli_epi32(__b, __sr1); __m128i __z = _mm_srli_si128(__c, __sr2); __m128i __v = _mm_slli_epi32(__d, __sl1); __z = _mm_xor_si128(__z, __a); __z = _mm_xor_si128(__z, __v); __m128i __x = _mm_slli_si128(__a, __sl2); __y = _mm_and_si128(__y, _mm_set_epi32(__msk4, __msk3, __msk2, __msk1)); __z = _mm_xor_si128(__z, __x); return _mm_xor_si128(__z, __y); } } #define _GLIBCXX_OPT_HAVE_RANDOM_SFMT_GEN_READ 1 template<typename _UIntType, size_t __m, size_t __pos1, size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2, uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4, uint32_t __parity1, uint32_t __parity2, uint32_t __parity3, uint32_t __parity4> void simd_fast_mersenne_twister_engine<_UIntType, __m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4, __parity1, __parity2, __parity3, __parity4>:: _M_gen_rand(void) { __m128i __r1 = _mm_load_si128(&_M_state[_M_nstate - 2]); __m128i __r2 = _mm_load_si128(&_M_state[_M_nstate - 1]); size_t __i; for (__i = 0; __i < _M_nstate - __pos1; ++__i) { __m128i __r = __sse2_recursion<__sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4> (_M_state[__i], _M_state[__i + __pos1], __r1, __r2); _mm_store_si128(&_M_state[__i], __r); __r1 = __r2; __r2 = __r; } for (; __i < _M_nstate; ++__i) { __m128i __r = __sse2_recursion<__sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4> (_M_state[__i], _M_state[__i + __pos1 - _M_nstate], __r1, __r2); _mm_store_si128(&_M_state[__i], __r); __r1 = __r2; __r2 = __r; } _M_pos = 0; } #define _GLIBCXX_OPT_HAVE_RANDOM_SFMT_OPERATOREQUAL 1 template<typename _UIntType, size_t __m, size_t __pos1, size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2, uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4, uint32_t __parity1, uint32_t __parity2, uint32_t __parity3, uint32_t __parity4> bool operator==(const __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType, __m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4, __parity1, __parity2, __parity3, __parity4>& __lhs, const __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType, __m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4, __parity1, __parity2, __parity3, __parity4>& __rhs) { __m128i __res = _mm_cmpeq_epi8(__lhs._M_state[0], __rhs._M_state[0]); for (size_t __i = 1; __i < __lhs._M_nstate; ++__i) __res = _mm_and_si128(__res, _mm_cmpeq_epi8(__lhs._M_state[__i], __rhs._M_state[__i])); return (_mm_movemask_epi8(__res) == 0xffff && __lhs._M_pos == __rhs._M_pos); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // __SSE2__ #endif // __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #endif // _EXT_OPT_RANDOM_H ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/gthr-default.h���������������������������������������������������0000644�����������������00000057255�14763166027�0014657 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Threads compatibility routines for libgcc2 and libobjc. */ /* Compile this one with gcc. */ /* Copyright (C) 1997-2013 Free Software Foundation, Inc. This file is part of GCC. GCC 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 3, or (at your option) any later version. GCC 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. Under Section 7 of GPL version 3, you are granted additional permissions described in the GCC Runtime Library Exception, version 3.1, as published by the Free Software Foundation. You should have received a copy of the GNU General Public License and a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GLIBCXX_GCC_GTHR_POSIX_H #define _GLIBCXX_GCC_GTHR_POSIX_H /* POSIX threads specific definitions. Easy, since the interface is just one-to-one mapping. */ #define __GTHREADS 1 #define __GTHREADS_CXX0X 1 #include <pthread.h> #if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \ || !defined(_GTHREAD_USE_MUTEX_TIMEDLOCK)) # include <unistd.h> # if defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0 # define _GTHREAD_USE_MUTEX_TIMEDLOCK 1 # else # define _GTHREAD_USE_MUTEX_TIMEDLOCK 0 # endif #endif typedef pthread_t __gthread_t; typedef pthread_key_t __gthread_key_t; typedef pthread_once_t __gthread_once_t; typedef pthread_mutex_t __gthread_mutex_t; typedef pthread_mutex_t __gthread_recursive_mutex_t; typedef pthread_cond_t __gthread_cond_t; typedef struct timespec __gthread_time_t; /* POSIX like conditional variables are supported. Please look at comments in gthr.h for details. */ #define __GTHREAD_HAS_COND 1 #define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER #define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function #define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT #if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER) #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER #elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP #else #define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function #endif #define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER #define __GTHREAD_TIME_INIT {0,0} #ifdef _GTHREAD_USE_MUTEX_INIT_FUNC # undef __GTHREAD_MUTEX_INIT #endif #ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC # undef __GTHREAD_RECURSIVE_MUTEX_INIT # undef __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION # define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function #endif #ifdef _GTHREAD_USE_COND_INIT_FUNC # undef __GTHREAD_COND_INIT # define __GTHREAD_COND_INIT_FUNCTION __gthread_cond_init_function #endif #if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK # ifndef __gthrw_pragma # define __gthrw_pragma(pragma) # endif # define __gthrw2(name,name2,type) \ static __typeof(type) name __attribute__ ((__weakref__(#name2))); \ __gthrw_pragma(weak type) # define __gthrw_(name) __gthrw_ ## name #else # define __gthrw2(name,name2,type) # define __gthrw_(name) name #endif /* Typically, __gthrw_foo is a weak reference to symbol foo. */ #define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name) __gthrw(pthread_once) __gthrw(pthread_getspecific) __gthrw(pthread_setspecific) __gthrw(pthread_create) __gthrw(pthread_join) __gthrw(pthread_equal) __gthrw(pthread_self) __gthrw(pthread_detach) #ifndef __BIONIC__ __gthrw(pthread_cancel) #endif __gthrw(sched_yield) __gthrw(pthread_mutex_lock) __gthrw(pthread_mutex_trylock) #if _GTHREAD_USE_MUTEX_TIMEDLOCK __gthrw(pthread_mutex_timedlock) #endif __gthrw(pthread_mutex_unlock) __gthrw(pthread_mutex_init) __gthrw(pthread_mutex_destroy) __gthrw(pthread_cond_init) __gthrw(pthread_cond_broadcast) __gthrw(pthread_cond_signal) __gthrw(pthread_cond_wait) __gthrw(pthread_cond_timedwait) __gthrw(pthread_cond_destroy) __gthrw(pthread_key_create) __gthrw(pthread_key_delete) __gthrw(pthread_mutexattr_init) __gthrw(pthread_mutexattr_settype) __gthrw(pthread_mutexattr_destroy) #if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK) /* Objective-C. */ __gthrw(pthread_exit) #ifdef _POSIX_PRIORITY_SCHEDULING #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING __gthrw(sched_get_priority_max) __gthrw(sched_get_priority_min) #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ #endif /* _POSIX_PRIORITY_SCHEDULING */ __gthrw(pthread_attr_destroy) __gthrw(pthread_attr_init) __gthrw(pthread_attr_setdetachstate) #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING __gthrw(pthread_getschedparam) __gthrw(pthread_setschedparam) #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ #endif /* _LIBOBJC || _LIBOBJC_WEAK */ #if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK /* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if -pthreads is not specified. The functions are dummies and most return an error value. However pthread_once returns 0 without invoking the routine it is passed so we cannot pretend that the interface is active if -pthreads is not specified. On Solaris 2.5.1, the interface is not exposed at all so we need to play the usual game with weak symbols. On Solaris 10 and up, a working interface is always exposed. On FreeBSD 6 and later, libc also exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc, which means the alternate __gthread_active_p below cannot be used there. */ #if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__)) static volatile int __gthread_active = -1; static void __gthread_trigger (void) { __gthread_active = 1; } static inline int __gthread_active_p (void) { static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT; /* Avoid reading __gthread_active twice on the main code path. */ int __gthread_active_latest_value = __gthread_active; /* This test is not protected to avoid taking a lock on the main code path so every update of __gthread_active in a threaded program must be atomic with regard to the result of the test. */ if (__builtin_expect (__gthread_active_latest_value < 0, 0)) { if (__gthrw_(pthread_once)) { /* If this really is a threaded program, then we must ensure that __gthread_active has been set to 1 before exiting this block. */ __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex); __gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger); __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex); } /* Make sure we'll never enter this block again. */ if (__gthread_active < 0) __gthread_active = 0; __gthread_active_latest_value = __gthread_active; } return __gthread_active_latest_value != 0; } #else /* neither FreeBSD nor Solaris */ /* For a program to be multi-threaded the only thing that it certainly must be using is pthread_create. However, there may be other libraries that intercept pthread_create with their own definitions to wrap pthreads functionality for some purpose. In those cases, pthread_create being defined might not necessarily mean that libpthread is actually linked in. For the GNU C library, we can use a known internal name. This is always available in the ABI, but no other library would define it. That is ideal, since any public pthread function might be intercepted just as pthread_create might be. __pthread_key_create is an "internal" implementation symbol, but it is part of the public exported ABI. Also, it's among the symbols that the static libpthread.a always links in whenever pthread_create is used, so there is no danger of a false negative result in any statically-linked, multi-threaded program. For others, we choose pthread_cancel as a function that seems unlikely to be redefined by an interceptor library. The bionic (Android) C library does not provide pthread_cancel, so we do use pthread_create there (and interceptor libraries lose). */ #ifdef __GLIBC__ __gthrw2(__gthrw_(__pthread_key_create), __pthread_key_create, pthread_key_create) # define GTHR_ACTIVE_PROXY __gthrw_(__pthread_key_create) #elif defined (__BIONIC__) # define GTHR_ACTIVE_PROXY __gthrw_(pthread_create) #else # define GTHR_ACTIVE_PROXY __gthrw_(pthread_cancel) #endif static inline int __gthread_active_p (void) { static void *const __gthread_active_ptr = __extension__ (void *) >HR_ACTIVE_PROXY; return __gthread_active_ptr != 0; } #endif /* FreeBSD or Solaris */ #else /* not __GXX_WEAK__ */ /* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread calls in shared flavors of the HP-UX C library. Most of the stubs have no functionality. The details are described in the "libc cumulative patch" for each subversion of HP-UX 11. There are two special interfaces provided for checking whether an application is linked to a shared pthread library or not. However, these interfaces aren't available in early libpthread libraries. We also need a test that works for archive libraries. We can't use pthread_once as some libc versions call the init function. We also can't use pthread_create or pthread_attr_init as these create a thread and thereby prevent changing the default stack size. The function pthread_default_stacksize_np is available in both the archive and shared versions of libpthread. It can be used to determine the default pthread stack size. There is a stub in some shared libc versions which returns a zero size if pthreads are not active. We provide an equivalent stub to handle cases where libc doesn't provide one. */ #if defined(__hppa__) && defined(__hpux__) static volatile int __gthread_active = -1; static inline int __gthread_active_p (void) { /* Avoid reading __gthread_active twice on the main code path. */ int __gthread_active_latest_value = __gthread_active; size_t __s; if (__builtin_expect (__gthread_active_latest_value < 0, 0)) { pthread_default_stacksize_np (0, &__s); __gthread_active = __s ? 1 : 0; __gthread_active_latest_value = __gthread_active; } return __gthread_active_latest_value != 0; } #else /* not hppa-hpux */ static inline int __gthread_active_p (void) { return 1; } #endif /* hppa-hpux */ #endif /* __GXX_WEAK__ */ #ifdef _LIBOBJC /* This is the config.h file in libobjc/ */ #include <config.h> #ifdef HAVE_SCHED_H # include <sched.h> #endif /* Key structure for maintaining thread specific storage */ static pthread_key_t _objc_thread_storage; static pthread_attr_t _objc_thread_attribs; /* Thread local storage for a single thread */ static void *thread_local_storage = NULL; /* Backend initialization functions */ /* Initialize the threads subsystem. */ static inline int __gthread_objc_init_thread_system (void) { if (__gthread_active_p ()) { /* Initialize the thread storage key. */ if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0) { /* The normal default detach state for threads is * PTHREAD_CREATE_JOINABLE which causes threads to not die * when you think they should. */ if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0 && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs, PTHREAD_CREATE_DETACHED) == 0) return 0; } } return -1; } /* Close the threads subsystem. */ static inline int __gthread_objc_close_thread_system (void) { if (__gthread_active_p () && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0 && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0) return 0; return -1; } /* Backend thread functions */ /* Create a new thread of execution. */ static inline objc_thread_t __gthread_objc_thread_detach (void (*func)(void *), void *arg) { objc_thread_t thread_id; pthread_t new_thread_handle; if (!__gthread_active_p ()) return NULL; if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs, (void *) func, arg))) thread_id = (objc_thread_t) new_thread_handle; else thread_id = NULL; return thread_id; } /* Set the current thread's priority. */ static inline int __gthread_objc_thread_set_priority (int priority) { if (!__gthread_active_p ()) return -1; else { #ifdef _POSIX_PRIORITY_SCHEDULING #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING pthread_t thread_id = __gthrw_(pthread_self) (); int policy; struct sched_param params; int priority_min, priority_max; if (__gthrw_(pthread_getschedparam) (thread_id, &policy, ¶ms) == 0) { if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1) return -1; if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1) return -1; if (priority > priority_max) priority = priority_max; else if (priority < priority_min) priority = priority_min; params.sched_priority = priority; /* * The solaris 7 and several other man pages incorrectly state that * this should be a pointer to policy but pthread.h is universally * at odds with this. */ if (__gthrw_(pthread_setschedparam) (thread_id, policy, ¶ms) == 0) return 0; } #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ #endif /* _POSIX_PRIORITY_SCHEDULING */ return -1; } } /* Return the current thread's priority. */ static inline int __gthread_objc_thread_get_priority (void) { #ifdef _POSIX_PRIORITY_SCHEDULING #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING if (__gthread_active_p ()) { int policy; struct sched_param params; if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, ¶ms) == 0) return params.sched_priority; else return -1; } else #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ #endif /* _POSIX_PRIORITY_SCHEDULING */ return OBJC_THREAD_INTERACTIVE_PRIORITY; } /* Yield our process time to another thread. */ static inline void __gthread_objc_thread_yield (void) { if (__gthread_active_p ()) __gthrw_(sched_yield) (); } /* Terminate the current thread. */ static inline int __gthread_objc_thread_exit (void) { if (__gthread_active_p ()) /* exit the thread */ __gthrw_(pthread_exit) (&__objc_thread_exit_status); /* Failed if we reached here */ return -1; } /* Returns an integer value which uniquely describes a thread. */ static inline objc_thread_t __gthread_objc_thread_id (void) { if (__gthread_active_p ()) return (objc_thread_t) __gthrw_(pthread_self) (); else return (objc_thread_t) 1; } /* Sets the thread's local storage pointer. */ static inline int __gthread_objc_thread_set_data (void *value) { if (__gthread_active_p ()) return __gthrw_(pthread_setspecific) (_objc_thread_storage, value); else { thread_local_storage = value; return 0; } } /* Returns the thread's local storage pointer. */ static inline void * __gthread_objc_thread_get_data (void) { if (__gthread_active_p ()) return __gthrw_(pthread_getspecific) (_objc_thread_storage); else return thread_local_storage; } /* Backend mutex functions */ /* Allocate a mutex. */ static inline int __gthread_objc_mutex_allocate (objc_mutex_t mutex) { if (__gthread_active_p ()) { mutex->backend = objc_malloc (sizeof (pthread_mutex_t)); if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL)) { objc_free (mutex->backend); mutex->backend = NULL; return -1; } } return 0; } /* Deallocate a mutex. */ static inline int __gthread_objc_mutex_deallocate (objc_mutex_t mutex) { if (__gthread_active_p ()) { int count; /* * Posix Threads specifically require that the thread be unlocked * for __gthrw_(pthread_mutex_destroy) to work. */ do { count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend); if (count < 0) return -1; } while (count); if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend)) return -1; objc_free (mutex->backend); mutex->backend = NULL; } return 0; } /* Grab a lock on a mutex. */ static inline int __gthread_objc_mutex_lock (objc_mutex_t mutex) { if (__gthread_active_p () && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0) { return -1; } return 0; } /* Try to grab a lock on a mutex. */ static inline int __gthread_objc_mutex_trylock (objc_mutex_t mutex) { if (__gthread_active_p () && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0) { return -1; } return 0; } /* Unlock the mutex */ static inline int __gthread_objc_mutex_unlock (objc_mutex_t mutex) { if (__gthread_active_p () && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0) { return -1; } return 0; } /* Backend condition mutex functions */ /* Allocate a condition. */ static inline int __gthread_objc_condition_allocate (objc_condition_t condition) { if (__gthread_active_p ()) { condition->backend = objc_malloc (sizeof (pthread_cond_t)); if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL)) { objc_free (condition->backend); condition->backend = NULL; return -1; } } return 0; } /* Deallocate a condition. */ static inline int __gthread_objc_condition_deallocate (objc_condition_t condition) { if (__gthread_active_p ()) { if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend)) return -1; objc_free (condition->backend); condition->backend = NULL; } return 0; } /* Wait on the condition */ static inline int __gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend, (pthread_mutex_t *) mutex->backend); else return 0; } /* Wake up all threads waiting on this condition. */ static inline int __gthread_objc_condition_broadcast (objc_condition_t condition) { if (__gthread_active_p ()) return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend); else return 0; } /* Wake up one thread waiting on this condition. */ static inline int __gthread_objc_condition_signal (objc_condition_t condition) { if (__gthread_active_p ()) return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend); else return 0; } #else /* _LIBOBJC */ static inline int __gthread_create (__gthread_t *__threadid, void *(*__func) (void*), void *__args) { return __gthrw_(pthread_create) (__threadid, NULL, __func, __args); } static inline int __gthread_join (__gthread_t __threadid, void **__value_ptr) { return __gthrw_(pthread_join) (__threadid, __value_ptr); } static inline int __gthread_detach (__gthread_t __threadid) { return __gthrw_(pthread_detach) (__threadid); } static inline int __gthread_equal (__gthread_t __t1, __gthread_t __t2) { return __gthrw_(pthread_equal) (__t1, __t2); } static inline __gthread_t __gthread_self (void) { return __gthrw_(pthread_self) (); } static inline int __gthread_yield (void) { return __gthrw_(sched_yield) (); } static inline int __gthread_once (__gthread_once_t *__once, void (*__func) (void)) { if (__gthread_active_p ()) return __gthrw_(pthread_once) (__once, __func); else return -1; } static inline int __gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *)) { return __gthrw_(pthread_key_create) (__key, __dtor); } static inline int __gthread_key_delete (__gthread_key_t __key) { return __gthrw_(pthread_key_delete) (__key); } static inline void * __gthread_getspecific (__gthread_key_t __key) { return __gthrw_(pthread_getspecific) (__key); } static inline int __gthread_setspecific (__gthread_key_t __key, const void *__ptr) { return __gthrw_(pthread_setspecific) (__key, __ptr); } static inline void __gthread_mutex_init_function (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) __gthrw_(pthread_mutex_init) (__mutex, NULL); } static inline int __gthread_mutex_destroy (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_destroy) (__mutex); else return 0; } static inline int __gthread_mutex_lock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_lock) (__mutex); else return 0; } static inline int __gthread_mutex_trylock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_trylock) (__mutex); else return 0; } #if _GTHREAD_USE_MUTEX_TIMEDLOCK static inline int __gthread_mutex_timedlock (__gthread_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout); else return 0; } #endif static inline int __gthread_mutex_unlock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_unlock) (__mutex); else return 0; } #if !defined( PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) \ || defined(_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC) static inline int __gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex) { if (__gthread_active_p ()) { pthread_mutexattr_t __attr; int __r; __r = __gthrw_(pthread_mutexattr_init) (&__attr); if (!__r) __r = __gthrw_(pthread_mutexattr_settype) (&__attr, PTHREAD_MUTEX_RECURSIVE); if (!__r) __r = __gthrw_(pthread_mutex_init) (__mutex, &__attr); if (!__r) __r = __gthrw_(pthread_mutexattr_destroy) (&__attr); return __r; } return 0; } #endif static inline int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_lock (__mutex); } static inline int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_trylock (__mutex); } #if _GTHREAD_USE_MUTEX_TIMEDLOCK static inline int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { return __gthread_mutex_timedlock (__mutex, __abs_timeout); } #endif static inline int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_unlock (__mutex); } static inline int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_destroy (__mutex); } #ifdef _GTHREAD_USE_COND_INIT_FUNC static inline void __gthread_cond_init_function (__gthread_cond_t *__cond) { if (__gthread_active_p ()) __gthrw_(pthread_cond_init) (__cond, NULL); } #endif static inline int __gthread_cond_broadcast (__gthread_cond_t *__cond) { return __gthrw_(pthread_cond_broadcast) (__cond); } static inline int __gthread_cond_signal (__gthread_cond_t *__cond) { return __gthrw_(pthread_cond_signal) (__cond); } static inline int __gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex) { return __gthrw_(pthread_cond_wait) (__cond, __mutex); } static inline int __gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout); } static inline int __gthread_cond_wait_recursive (__gthread_cond_t *__cond, __gthread_recursive_mutex_t *__mutex) { return __gthread_cond_wait (__cond, __mutex); } static inline int __gthread_cond_destroy (__gthread_cond_t* __cond) { return __gthrw_(pthread_cond_destroy) (__cond); } #endif /* _LIBOBJC */ #endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/opt_random.h�����������������������������������������������������0000644�����������������00000014041�14763166027�0014415 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Optimizations for random number functions, x86 version -*- C++ -*- // Copyright (C) 2012-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/opt_random.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{random} */ #ifndef _BITS_OPT_RANDOM_H #define _BITS_OPT_RANDOM_H 1 #include <x86intrin.h> #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION #ifdef __SSE3__ template<> template<typename _UniformRandomNumberGenerator> void normal_distribution<double>:: __generate(typename normal_distribution<double>::result_type* __f, typename normal_distribution<double>::result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __param) { typedef uint64_t __uctype; if (__f == __t) return; if (_M_saved_available) { _M_saved_available = false; *__f++ = _M_saved * __param.stddev() + __param.mean(); if (__f == __t) return; } constexpr uint64_t __maskval = 0xfffffffffffffull; static const __m128i __mask = _mm_set1_epi64x(__maskval); static const __m128i __two = _mm_set1_epi64x(0x4000000000000000ull); static const __m128d __three = _mm_set1_pd(3.0); const __m128d __av = _mm_set1_pd(__param.mean()); const __uctype __urngmin = __urng.min(); const __uctype __urngmax = __urng.max(); const __uctype __urngrange = __urngmax - __urngmin; const __uctype __uerngrange = __urngrange + 1; while (__f + 1 < __t) { double __le; __m128d __x; do { union { __m128i __i; __m128d __d; } __v; if (__urngrange > __maskval) { if (__detail::_Power_of_2(__uerngrange)) __v.__i = _mm_and_si128(_mm_set_epi64x(__urng(), __urng()), __mask); else { const __uctype __uerange = __maskval + 1; const __uctype __scaling = __urngrange / __uerange; const __uctype __past = __uerange * __scaling; uint64_t __v1; do __v1 = __uctype(__urng()) - __urngmin; while (__v1 >= __past); __v1 /= __scaling; uint64_t __v2; do __v2 = __uctype(__urng()) - __urngmin; while (__v2 >= __past); __v2 /= __scaling; __v.__i = _mm_set_epi64x(__v1, __v2); } } else if (__urngrange == __maskval) __v.__i = _mm_set_epi64x(__urng(), __urng()); else if ((__urngrange + 2) * __urngrange >= __maskval && __detail::_Power_of_2(__uerngrange)) { uint64_t __v1 = __urng() * __uerngrange + __urng(); uint64_t __v2 = __urng() * __uerngrange + __urng(); __v.__i = _mm_and_si128(_mm_set_epi64x(__v1, __v2), __mask); } else { size_t __nrng = 2; __uctype __high = __maskval / __uerngrange / __uerngrange; while (__high > __uerngrange) { ++__nrng; __high /= __uerngrange; } const __uctype __highrange = __high + 1; const __uctype __scaling = __urngrange / __highrange; const __uctype __past = __highrange * __scaling; __uctype __tmp; uint64_t __v1; do { do __tmp = __uctype(__urng()) - __urngmin; while (__tmp >= __past); __v1 = __tmp / __scaling; for (size_t __cnt = 0; __cnt < __nrng; ++__cnt) { __tmp = __v1; __v1 *= __uerngrange; __v1 += __uctype(__urng()) - __urngmin; } } while (__v1 > __maskval || __v1 < __tmp); uint64_t __v2; do { do __tmp = __uctype(__urng()) - __urngmin; while (__tmp >= __past); __v2 = __tmp / __scaling; for (size_t __cnt = 0; __cnt < __nrng; ++__cnt) { __tmp = __v2; __v2 *= __uerngrange; __v2 += __uctype(__urng()) - __urngmin; } } while (__v2 > __maskval || __v2 < __tmp); __v.__i = _mm_set_epi64x(__v1, __v2); } __v.__i = _mm_or_si128(__v.__i, __two); __x = _mm_sub_pd(__v.__d, __three); __m128d __m = _mm_mul_pd(__x, __x); __le = _mm_cvtsd_f64(_mm_hadd_pd (__m, __m)); } while (__le == 0.0 || __le >= 1.0); double __mult = (std::sqrt(-2.0 * std::log(__le) / __le) * __param.stddev()); __x = _mm_add_pd(_mm_mul_pd(__x, _mm_set1_pd(__mult)), __av); _mm_storeu_pd(__f, __x); __f += 2; } if (__f != __t) { result_type __x, __y, __r2; __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); do { __x = result_type(2.0) * __aurng() - 1.0; __y = result_type(2.0) * __aurng() - 1.0; __r2 = __x * __x + __y * __y; } while (__r2 > 1.0 || __r2 == 0.0); const result_type __mult = std::sqrt(-2 * std::log(__r2) / __r2); _M_saved = __x * __mult; _M_saved_available = true; *__f = __y * __mult * __param.stddev() + __param.mean(); } } #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // _BITS_OPT_RANDOM_H �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/cpu_defines.h����������������������������������������������������0000644�����������������00000002465�14763166027�0014546 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Specific definitions for generic platforms -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/cpu_defines.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{iosfwd} */ #ifndef _GLIBCXX_CPU_DEFINES #define _GLIBCXX_CPU_DEFINES 1 #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/error_constants.h������������������������������������������������0000644�����������������00000012071�14763166027�0015501 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Specific definitions for generic platforms -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/error_constants.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{system_error} */ #ifndef _GLIBCXX_ERROR_CONSTANTS #define _GLIBCXX_ERROR_CONSTANTS 1 #include <bits/c++config.h> #include <cerrno> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION enum class errc { address_family_not_supported = EAFNOSUPPORT, address_in_use = EADDRINUSE, address_not_available = EADDRNOTAVAIL, already_connected = EISCONN, argument_list_too_long = E2BIG, argument_out_of_domain = EDOM, bad_address = EFAULT, bad_file_descriptor = EBADF, #ifdef _GLIBCXX_HAVE_EBADMSG bad_message = EBADMSG, #endif broken_pipe = EPIPE, connection_aborted = ECONNABORTED, connection_already_in_progress = EALREADY, connection_refused = ECONNREFUSED, connection_reset = ECONNRESET, cross_device_link = EXDEV, destination_address_required = EDESTADDRREQ, device_or_resource_busy = EBUSY, directory_not_empty = ENOTEMPTY, executable_format_error = ENOEXEC, file_exists = EEXIST, file_too_large = EFBIG, filename_too_long = ENAMETOOLONG, function_not_supported = ENOSYS, host_unreachable = EHOSTUNREACH, #ifdef _GLIBCXX_HAVE_EIDRM identifier_removed = EIDRM, #endif illegal_byte_sequence = EILSEQ, inappropriate_io_control_operation = ENOTTY, interrupted = EINTR, invalid_argument = EINVAL, invalid_seek = ESPIPE, io_error = EIO, is_a_directory = EISDIR, message_size = EMSGSIZE, network_down = ENETDOWN, network_reset = ENETRESET, network_unreachable = ENETUNREACH, no_buffer_space = ENOBUFS, no_child_process = ECHILD, #ifdef _GLIBCXX_HAVE_ENOLINK no_link = ENOLINK, #endif no_lock_available = ENOLCK, #ifdef _GLIBCXX_HAVE_ENODATA no_message_available = ENODATA, #endif no_message = ENOMSG, no_protocol_option = ENOPROTOOPT, no_space_on_device = ENOSPC, #ifdef _GLIBCXX_HAVE_ENOSR no_stream_resources = ENOSR, #endif no_such_device_or_address = ENXIO, no_such_device = ENODEV, no_such_file_or_directory = ENOENT, no_such_process = ESRCH, not_a_directory = ENOTDIR, not_a_socket = ENOTSOCK, #ifdef _GLIBCXX_HAVE_ENOSTR not_a_stream = ENOSTR, #endif not_connected = ENOTCONN, not_enough_memory = ENOMEM, #ifdef _GLIBCXX_HAVE_ENOTSUP not_supported = ENOTSUP, #endif #ifdef _GLIBCXX_HAVE_ECANCELED operation_canceled = ECANCELED, #endif operation_in_progress = EINPROGRESS, operation_not_permitted = EPERM, operation_not_supported = EOPNOTSUPP, operation_would_block = EWOULDBLOCK, #ifdef _GLIBCXX_HAVE_EOWNERDEAD owner_dead = EOWNERDEAD, #endif permission_denied = EACCES, #ifdef _GLIBCXX_HAVE_EPROTO protocol_error = EPROTO, #endif protocol_not_supported = EPROTONOSUPPORT, read_only_file_system = EROFS, resource_deadlock_would_occur = EDEADLK, resource_unavailable_try_again = EAGAIN, result_out_of_range = ERANGE, #ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE state_not_recoverable = ENOTRECOVERABLE, #endif #ifdef _GLIBCXX_HAVE_ETIME stream_timeout = ETIME, #endif #ifdef _GLIBCXX_HAVE_ETXTBSY text_file_busy = ETXTBSY, #endif timed_out = ETIMEDOUT, too_many_files_open_in_system = ENFILE, too_many_files_open = EMFILE, too_many_links = EMLINK, too_many_symbolic_link_levels = ELOOP, #ifdef _GLIBCXX_HAVE_EOVERFLOW value_too_large = EOVERFLOW, #endif wrong_protocol_type = EPROTOTYPE }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/stdtr1c++.h������������������������������������������������������0000644�����������������00000003315�14763166027�0013767 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// C++ includes used for precompiling TR1 -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file stdtr1c++.h * This is an implementation file for a precompiled header. */ #include <bits/stdc++.h> #include <tr1/array> #include <tr1/cctype> #include <tr1/cfenv> #include <tr1/cfloat> #include <tr1/cinttypes> #include <tr1/climits> #include <tr1/cmath> #include <tr1/complex> #include <tr1/cstdarg> #include <tr1/cstdbool> #include <tr1/cstdint> #include <tr1/cstdio> #include <tr1/cstdlib> #include <tr1/ctgmath> #include <tr1/ctime> #include <tr1/cwchar> #include <tr1/cwctype> #include <tr1/functional> #include <tr1/random> #include <tr1/tuple> #include <tr1/unordered_map> #include <tr1/unordered_set> #include <tr1/utility> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/c++config.h������������������������������������������������������0000644�����������������00000273661�14763166027�0014030 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _CPP_CPPCONFIG_WRAPPER #define _CPP_CPPCONFIG_WRAPPER 1 #include <bits/wordsize.h> #if __WORDSIZE == 32 // Predefined symbols and macros -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/c++config.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{iosfwd} */ #ifndef _GLIBCXX_CXX_CONFIG_H #define _GLIBCXX_CXX_CONFIG_H 1 // The current version of the C++ library in compressed ISO date format. #define __GLIBCXX__ 20150623 // Macros for various attributes. // _GLIBCXX_PURE // _GLIBCXX_CONST // _GLIBCXX_NORETURN // _GLIBCXX_NOTHROW // _GLIBCXX_VISIBILITY #ifndef _GLIBCXX_PURE # define _GLIBCXX_PURE __attribute__ ((__pure__)) #endif #ifndef _GLIBCXX_CONST # define _GLIBCXX_CONST __attribute__ ((__const__)) #endif #ifndef _GLIBCXX_NORETURN # define _GLIBCXX_NORETURN __attribute__ ((__noreturn__)) #endif // See below for C++ #ifndef _GLIBCXX_NOTHROW # ifndef __cplusplus # define _GLIBCXX_NOTHROW __attribute__((__nothrow__)) # endif #endif // Macros for visibility attributes. // _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY // _GLIBCXX_VISIBILITY # define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 1 #if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY # define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V))) #else // If this is not supplied by the OS-specific or CPU-specific // headers included below, it will be defined to an empty default. # define _GLIBCXX_VISIBILITY(V) _GLIBCXX_PSEUDO_VISIBILITY(V) #endif // Macros for deprecated attributes. // _GLIBCXX_USE_DEPRECATED // _GLIBCXX_DEPRECATED #ifndef _GLIBCXX_USE_DEPRECATED # define _GLIBCXX_USE_DEPRECATED 1 #endif #if defined(__DEPRECATED) && (__cplusplus >= 201103L) # define _GLIBCXX_DEPRECATED __attribute__ ((__deprecated__)) #else # define _GLIBCXX_DEPRECATED #endif // Macros for ABI tag attributes. #ifndef _GLIBCXX_ABI_TAG_CXX11 # define _GLIBCXX_ABI_TAG_CXX11 __attribute ((__abi_tag__ ("cxx11"))) #endif #if __cplusplus // Macro for constexpr, to support in mixed 03/0x mode. #ifndef _GLIBCXX_CONSTEXPR # if __cplusplus >= 201103L # define _GLIBCXX_CONSTEXPR constexpr # define _GLIBCXX_USE_CONSTEXPR constexpr # else # define _GLIBCXX_CONSTEXPR # define _GLIBCXX_USE_CONSTEXPR const # endif #endif // Macro for noexcept, to support in mixed 03/0x mode. #ifndef _GLIBCXX_NOEXCEPT # if __cplusplus >= 201103L # define _GLIBCXX_NOEXCEPT noexcept # define _GLIBCXX_USE_NOEXCEPT noexcept # define _GLIBCXX_THROW(_EXC) # else # define _GLIBCXX_NOEXCEPT # define _GLIBCXX_USE_NOEXCEPT throw() # define _GLIBCXX_THROW(_EXC) throw(_EXC) # endif #endif #ifndef _GLIBCXX_NOTHROW # define _GLIBCXX_NOTHROW _GLIBCXX_USE_NOEXCEPT #endif #ifndef _GLIBCXX_THROW_OR_ABORT # if __EXCEPTIONS # define _GLIBCXX_THROW_OR_ABORT(_EXC) (throw (_EXC)) # else # define _GLIBCXX_THROW_OR_ABORT(_EXC) (__builtin_abort()) # endif #endif // Macro for extern template, ie controling template linkage via use // of extern keyword on template declaration. As documented in the g++ // manual, it inhibits all implicit instantiations and is used // throughout the library to avoid multiple weak definitions for // required types that are already explicitly instantiated in the // library binary. This substantially reduces the binary size of // resulting executables. // Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern // templates only in basic_string, thus activating its debug-mode // checks even at -O0. # define _GLIBCXX_EXTERN_TEMPLATE 1 /* Outline of libstdc++ namespaces. namespace std { namespace __debug { } namespace __parallel { } namespace __profile { } namespace __cxx1998 { } namespace __detail { } namespace rel_ops { } namespace tr1 { namespace placeholders { } namespace regex_constants { } namespace __detail { } } namespace tr2 { } namespace decimal { } namespace chrono { } namespace placeholders { } namespace regex_constants { } namespace this_thread { } } namespace abi { } namespace __gnu_cxx { namespace __detail { } } For full details see: http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespaces.html */ namespace std { typedef __SIZE_TYPE__ size_t; typedef __PTRDIFF_TYPE__ ptrdiff_t; #if __cplusplus >= 201103L typedef decltype(nullptr) nullptr_t; #endif } // Defined if inline namespaces are used for versioning. # define _GLIBCXX_INLINE_VERSION 0 // Inline namespace for symbol versioning. #if _GLIBCXX_INLINE_VERSION namespace std { inline namespace __7 { } namespace rel_ops { inline namespace __7 { } } namespace tr1 { inline namespace __7 { } namespace placeholders { inline namespace __7 { } } namespace regex_constants { inline namespace __7 { } } namespace __detail { inline namespace __7 { } } } namespace tr2 { inline namespace __7 { } } namespace decimal { inline namespace __7 { } } namespace chrono { inline namespace __7 { } } namespace placeholders { inline namespace __7 { } } namespace regex_constants { inline namespace __7 { } } namespace this_thread { inline namespace __7 { } } namespace __detail { inline namespace __7 { } } } namespace __gnu_cxx { inline namespace __7 { } namespace __detail { inline namespace __7 { } } } # define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __7 { # define _GLIBCXX_END_NAMESPACE_VERSION } #else # define _GLIBCXX_BEGIN_NAMESPACE_VERSION # define _GLIBCXX_END_NAMESPACE_VERSION #endif // Inline namespaces for special modes: debug, parallel, profile. #if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) \ || defined(_GLIBCXX_PROFILE) namespace std { // Non-inline namespace for components replaced by alternates in active mode. namespace __cxx1998 { #if _GLIBCXX_INLINE_VERSION inline namespace __7 { } #endif } // Inline namespace for debug mode. # ifdef _GLIBCXX_DEBUG inline namespace __debug { } # endif // Inline namespaces for parallel mode. # ifdef _GLIBCXX_PARALLEL inline namespace __parallel { } # endif // Inline namespaces for profile mode # ifdef _GLIBCXX_PROFILE inline namespace __profile { } # endif } // Check for invalid usage and unsupported mixed-mode use. # if defined(_GLIBCXX_DEBUG) && defined(_GLIBCXX_PARALLEL) # error illegal use of multiple inlined namespaces # endif # if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_DEBUG) # error illegal use of multiple inlined namespaces # endif # if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_PARALLEL) # error illegal use of multiple inlined namespaces # endif // Check for invalid use due to lack for weak symbols. # if __NO_INLINE__ && !__GXX_WEAK__ # warning currently using inlined namespace mode which may fail \ without inlining due to lack of weak symbols # endif #endif // Macros for namespace scope. Either namespace std:: or the name // of some nested namespace within it corresponding to the active mode. // _GLIBCXX_STD_A // _GLIBCXX_STD_C // // Macros for opening/closing conditional namespaces. // _GLIBCXX_BEGIN_NAMESPACE_ALGO // _GLIBCXX_END_NAMESPACE_ALGO // _GLIBCXX_BEGIN_NAMESPACE_CONTAINER // _GLIBCXX_END_NAMESPACE_CONTAINER #if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PROFILE) # define _GLIBCXX_STD_C __cxx1998 # define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER \ namespace _GLIBCXX_STD_C { _GLIBCXX_BEGIN_NAMESPACE_VERSION # define _GLIBCXX_END_NAMESPACE_CONTAINER \ _GLIBCXX_END_NAMESPACE_VERSION } # undef _GLIBCXX_EXTERN_TEMPLATE # define _GLIBCXX_EXTERN_TEMPLATE -1 #endif #ifdef _GLIBCXX_PARALLEL # define _GLIBCXX_STD_A __cxx1998 # define _GLIBCXX_BEGIN_NAMESPACE_ALGO \ namespace _GLIBCXX_STD_A { _GLIBCXX_BEGIN_NAMESPACE_VERSION # define _GLIBCXX_END_NAMESPACE_ALGO \ _GLIBCXX_END_NAMESPACE_VERSION } #endif #ifndef _GLIBCXX_STD_A # define _GLIBCXX_STD_A std #endif #ifndef _GLIBCXX_STD_C # define _GLIBCXX_STD_C std #endif #ifndef _GLIBCXX_BEGIN_NAMESPACE_ALGO # define _GLIBCXX_BEGIN_NAMESPACE_ALGO #endif #ifndef _GLIBCXX_END_NAMESPACE_ALGO # define _GLIBCXX_END_NAMESPACE_ALGO #endif #ifndef _GLIBCXX_BEGIN_NAMESPACE_CONTAINER # define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER #endif #ifndef _GLIBCXX_END_NAMESPACE_CONTAINER # define _GLIBCXX_END_NAMESPACE_CONTAINER #endif // GLIBCXX_ABI Deprecated // Define if compatibility should be provided for -mlong-double-64. #undef _GLIBCXX_LONG_DOUBLE_COMPAT // Inline namespace for long double 128 mode. #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ namespace std { inline namespace __gnu_cxx_ldbl128 { } } # define _GLIBCXX_NAMESPACE_LDBL __gnu_cxx_ldbl128:: # define _GLIBCXX_BEGIN_NAMESPACE_LDBL namespace __gnu_cxx_ldbl128 { # define _GLIBCXX_END_NAMESPACE_LDBL } #else # define _GLIBCXX_NAMESPACE_LDBL # define _GLIBCXX_BEGIN_NAMESPACE_LDBL # define _GLIBCXX_END_NAMESPACE_LDBL #endif // Assert. #if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PARALLEL) # define __glibcxx_assert(_Condition) #else namespace std { // Avoid the use of assert, because we're trying to keep the <cassert> // include out of the mix. inline void __replacement_assert(const char* __file, int __line, const char* __function, const char* __condition) { __builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line, __function, __condition); __builtin_abort(); } } #define __glibcxx_assert(_Condition) \ do \ { \ if (! (_Condition)) \ std::__replacement_assert(__FILE__, __LINE__, __PRETTY_FUNCTION__, \ #_Condition); \ } while (false) #endif // Macros for race detectors. // _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and // _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain // atomic (lock-free) synchronization to race detectors: // the race detector will infer a happens-before arc from the former to the // latter when they share the same argument pointer. // // The most frequent use case for these macros (and the only case in the // current implementation of the library) is atomic reference counting: // void _M_remove_reference() // { // _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount); // if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0) // { // _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount); // _M_destroy(__a); // } // } // The annotations in this example tell the race detector that all memory // accesses occurred when the refcount was positive do not race with // memory accesses which occurred after the refcount became zero. #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE # define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) #endif #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER # define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) #endif // Macros for C linkage: define extern "C" linkage only when using C++. # define _GLIBCXX_BEGIN_EXTERN_C extern "C" { # define _GLIBCXX_END_EXTERN_C } #else // !__cplusplus # define _GLIBCXX_BEGIN_EXTERN_C # define _GLIBCXX_END_EXTERN_C #endif // First includes. // Pick up any OS-specific definitions. #include <bits/os_defines.h> // Pick up any CPU-specific definitions. #include <bits/cpu_defines.h> // If platform uses neither visibility nor psuedo-visibility, // specify empty default for namespace annotation macros. #ifndef _GLIBCXX_PSEUDO_VISIBILITY # define _GLIBCXX_PSEUDO_VISIBILITY(V) #endif // Certain function definitions that are meant to be overridable from // user code are decorated with this macro. For some targets, this // macro causes these definitions to be weak. #ifndef _GLIBCXX_WEAK_DEFINITION # define _GLIBCXX_WEAK_DEFINITION #endif // The remainder of the prewritten config is automatic; all the // user hooks are listed above. // Create a boolean flag to be used to determine if --fast-math is set. #ifdef __FAST_MATH__ # define _GLIBCXX_FAST_MATH 1 #else # define _GLIBCXX_FAST_MATH 0 #endif // This marks string literals in header files to be extracted for eventual // translation. It is primarily used for messages in thrown exceptions; see // src/functexcept.cc. We use __N because the more traditional _N is used // for something else under certain OSes (see BADNAMES). #define __N(msgid) (msgid) // For example, <windows.h> is known to #define min and max as macros... #undef min #undef max // End of prewritten config; the settings discovered at configure time follow. /* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the `acosf' function. */ #define _GLIBCXX_HAVE_ACOSF 1 /* Define to 1 if you have the `acosl' function. */ #define _GLIBCXX_HAVE_ACOSL 1 /* Define to 1 if you have the `asinf' function. */ #define _GLIBCXX_HAVE_ASINF 1 /* Define to 1 if you have the `asinl' function. */ #define _GLIBCXX_HAVE_ASINL 1 /* Define to 1 if the target assembler supports .symver directive. */ #define _GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE 1 /* Define to 1 if you have the `atan2f' function. */ #define _GLIBCXX_HAVE_ATAN2F 1 /* Define to 1 if you have the `atan2l' function. */ #define _GLIBCXX_HAVE_ATAN2L 1 /* Define to 1 if you have the `atanf' function. */ #define _GLIBCXX_HAVE_ATANF 1 /* Define to 1 if you have the `atanl' function. */ #define _GLIBCXX_HAVE_ATANL 1 /* Define to 1 if you have the `at_quick_exit' function. */ #define _GLIBCXX_HAVE_AT_QUICK_EXIT 1 /* Define to 1 if the target assembler supports thread-local storage. */ /* #undef _GLIBCXX_HAVE_CC_TLS */ /* Define to 1 if you have the `ceilf' function. */ #define _GLIBCXX_HAVE_CEILF 1 /* Define to 1 if you have the `ceill' function. */ #define _GLIBCXX_HAVE_CEILL 1 /* Define to 1 if you have the <complex.h> header file. */ #define _GLIBCXX_HAVE_COMPLEX_H 1 /* Define to 1 if you have the `cosf' function. */ #define _GLIBCXX_HAVE_COSF 1 /* Define to 1 if you have the `coshf' function. */ #define _GLIBCXX_HAVE_COSHF 1 /* Define to 1 if you have the `coshl' function. */ #define _GLIBCXX_HAVE_COSHL 1 /* Define to 1 if you have the `cosl' function. */ #define _GLIBCXX_HAVE_COSL 1 /* Define to 1 if you have the <dlfcn.h> header file. */ #define _GLIBCXX_HAVE_DLFCN_H 1 /* Define if EBADMSG exists. */ #define _GLIBCXX_HAVE_EBADMSG 1 /* Define if ECANCELED exists. */ #define _GLIBCXX_HAVE_ECANCELED 1 /* Define if ECHILD exists. */ #define _GLIBCXX_HAVE_ECHILD 1 /* Define if EIDRM exists. */ #define _GLIBCXX_HAVE_EIDRM 1 /* Define to 1 if you have the <endian.h> header file. */ #define _GLIBCXX_HAVE_ENDIAN_H 1 /* Define if ENODATA exists. */ #define _GLIBCXX_HAVE_ENODATA 1 /* Define if ENOLINK exists. */ #define _GLIBCXX_HAVE_ENOLINK 1 /* Define if ENOSPC exists. */ #define _GLIBCXX_HAVE_ENOSPC 1 /* Define if ENOSR exists. */ #define _GLIBCXX_HAVE_ENOSR 1 /* Define if ENOSTR exists. */ #define _GLIBCXX_HAVE_ENOSTR 1 /* Define if ENOTRECOVERABLE exists. */ #define _GLIBCXX_HAVE_ENOTRECOVERABLE 1 /* Define if ENOTSUP exists. */ #define _GLIBCXX_HAVE_ENOTSUP 1 /* Define if EOVERFLOW exists. */ #define _GLIBCXX_HAVE_EOVERFLOW 1 /* Define if EOWNERDEAD exists. */ #define _GLIBCXX_HAVE_EOWNERDEAD 1 /* Define if EPERM exists. */ #define _GLIBCXX_HAVE_EPERM 1 /* Define if EPROTO exists. */ #define _GLIBCXX_HAVE_EPROTO 1 /* Define if ETIME exists. */ #define _GLIBCXX_HAVE_ETIME 1 /* Define if ETIMEDOUT exists. */ #define _GLIBCXX_HAVE_ETIMEDOUT 1 /* Define if ETXTBSY exists. */ #define _GLIBCXX_HAVE_ETXTBSY 1 /* Define if EWOULDBLOCK exists. */ #define _GLIBCXX_HAVE_EWOULDBLOCK 1 /* Define to 1 if you have the <execinfo.h> header file. */ #define _GLIBCXX_HAVE_EXECINFO_H 1 /* Define to 1 if you have the `expf' function. */ #define _GLIBCXX_HAVE_EXPF 1 /* Define to 1 if you have the `expl' function. */ #define _GLIBCXX_HAVE_EXPL 1 /* Define to 1 if you have the `fabsf' function. */ #define _GLIBCXX_HAVE_FABSF 1 /* Define to 1 if you have the `fabsl' function. */ #define _GLIBCXX_HAVE_FABSL 1 /* Define to 1 if you have the <fenv.h> header file. */ #define _GLIBCXX_HAVE_FENV_H 1 /* Define to 1 if you have the `finite' function. */ #define _GLIBCXX_HAVE_FINITE 1 /* Define to 1 if you have the `finitef' function. */ #define _GLIBCXX_HAVE_FINITEF 1 /* Define to 1 if you have the `finitel' function. */ #define _GLIBCXX_HAVE_FINITEL 1 /* Define to 1 if you have the <float.h> header file. */ #define _GLIBCXX_HAVE_FLOAT_H 1 /* Define to 1 if you have the `floorf' function. */ #define _GLIBCXX_HAVE_FLOORF 1 /* Define to 1 if you have the `floorl' function. */ #define _GLIBCXX_HAVE_FLOORL 1 /* Define to 1 if you have the `fmodf' function. */ #define _GLIBCXX_HAVE_FMODF 1 /* Define to 1 if you have the `fmodl' function. */ #define _GLIBCXX_HAVE_FMODL 1 /* Define to 1 if you have the `fpclass' function. */ /* #undef _GLIBCXX_HAVE_FPCLASS */ /* Define to 1 if you have the <fp.h> header file. */ /* #undef _GLIBCXX_HAVE_FP_H */ /* Define to 1 if you have the `frexpf' function. */ #define _GLIBCXX_HAVE_FREXPF 1 /* Define to 1 if you have the `frexpl' function. */ #define _GLIBCXX_HAVE_FREXPL 1 /* Define if _Unwind_GetIPInfo is available. */ #define _GLIBCXX_HAVE_GETIPINFO 1 /* Define if gets is available in <stdio.h>. */ #define _GLIBCXX_HAVE_GETS 1 /* Define to 1 if you have the `hypot' function. */ #define _GLIBCXX_HAVE_HYPOT 1 /* Define to 1 if you have the `hypotf' function. */ #define _GLIBCXX_HAVE_HYPOTF 1 /* Define to 1 if you have the `hypotl' function. */ #define _GLIBCXX_HAVE_HYPOTL 1 /* Define if you have the iconv() function. */ #define _GLIBCXX_HAVE_ICONV 1 /* Define to 1 if you have the <ieeefp.h> header file. */ /* #undef _GLIBCXX_HAVE_IEEEFP_H */ /* Define if int64_t is available in <stdint.h>. */ #define _GLIBCXX_HAVE_INT64_T 1 /* Define if int64_t is a long. */ /* #undef _GLIBCXX_HAVE_INT64_T_LONG */ /* Define if int64_t is a long long. */ #define _GLIBCXX_HAVE_INT64_T_LONG_LONG 1 /* Define to 1 if you have the <inttypes.h> header file. */ #define _GLIBCXX_HAVE_INTTYPES_H 1 /* Define to 1 if you have the `isinf' function. */ #define _GLIBCXX_HAVE_ISINF 1 /* Define to 1 if you have the `isinff' function. */ #define _GLIBCXX_HAVE_ISINFF 1 /* Define to 1 if you have the `isinfl' function. */ #define _GLIBCXX_HAVE_ISINFL 1 /* Define to 1 if you have the `isnan' function. */ #define _GLIBCXX_HAVE_ISNAN 1 /* Define to 1 if you have the `isnanf' function. */ #define _GLIBCXX_HAVE_ISNANF 1 /* Define to 1 if you have the `isnanl' function. */ #define _GLIBCXX_HAVE_ISNANL 1 /* Defined if iswblank exists. */ #define _GLIBCXX_HAVE_ISWBLANK 1 /* Define if LC_MESSAGES is available in <locale.h>. */ #define _GLIBCXX_HAVE_LC_MESSAGES 1 /* Define to 1 if you have the `ldexpf' function. */ #define _GLIBCXX_HAVE_LDEXPF 1 /* Define to 1 if you have the `ldexpl' function. */ #define _GLIBCXX_HAVE_LDEXPL 1 /* Define to 1 if you have the <libintl.h> header file. */ #define _GLIBCXX_HAVE_LIBINTL_H 1 /* Only used in build directory testsuite_hooks.h. */ #define _GLIBCXX_HAVE_LIMIT_AS 1 /* Only used in build directory testsuite_hooks.h. */ #define _GLIBCXX_HAVE_LIMIT_DATA 1 /* Only used in build directory testsuite_hooks.h. */ #define _GLIBCXX_HAVE_LIMIT_FSIZE 1 /* Only used in build directory testsuite_hooks.h. */ #define _GLIBCXX_HAVE_LIMIT_RSS 1 /* Only used in build directory testsuite_hooks.h. */ #define _GLIBCXX_HAVE_LIMIT_VMEM 0 /* Define if futex syscall is available. */ #define _GLIBCXX_HAVE_LINUX_FUTEX 1 /* Define to 1 if you have the <locale.h> header file. */ #define _GLIBCXX_HAVE_LOCALE_H 1 /* Define to 1 if you have the `log10f' function. */ #define _GLIBCXX_HAVE_LOG10F 1 /* Define to 1 if you have the `log10l' function. */ #define _GLIBCXX_HAVE_LOG10L 1 /* Define to 1 if you have the `logf' function. */ #define _GLIBCXX_HAVE_LOGF 1 /* Define to 1 if you have the `logl' function. */ #define _GLIBCXX_HAVE_LOGL 1 /* Define to 1 if you have the <machine/endian.h> header file. */ /* #undef _GLIBCXX_HAVE_MACHINE_ENDIAN_H */ /* Define to 1 if you have the <machine/param.h> header file. */ /* #undef _GLIBCXX_HAVE_MACHINE_PARAM_H */ /* Define if mbstate_t exists in wchar.h. */ #define _GLIBCXX_HAVE_MBSTATE_T 1 /* Define to 1 if you have the <memory.h> header file. */ #define _GLIBCXX_HAVE_MEMORY_H 1 /* Define to 1 if you have the `modf' function. */ #define _GLIBCXX_HAVE_MODF 1 /* Define to 1 if you have the `modff' function. */ #define _GLIBCXX_HAVE_MODFF 1 /* Define to 1 if you have the `modfl' function. */ #define _GLIBCXX_HAVE_MODFL 1 /* Define to 1 if you have the <nan.h> header file. */ /* #undef _GLIBCXX_HAVE_NAN_H */ /* Define if poll is available in <poll.h>. */ #define _GLIBCXX_HAVE_POLL 1 /* Define to 1 if you have the `powf' function. */ #define _GLIBCXX_HAVE_POWF 1 /* Define to 1 if you have the `powl' function. */ #define _GLIBCXX_HAVE_POWL 1 /* Define to 1 if you have the `qfpclass' function. */ /* #undef _GLIBCXX_HAVE_QFPCLASS */ /* Define to 1 if you have the `quick_exit' function. */ #define _GLIBCXX_HAVE_QUICK_EXIT 1 /* Define to 1 if you have the `setenv' function. */ #define _GLIBCXX_HAVE_SETENV 1 /* Define to 1 if you have the `sincos' function. */ #define _GLIBCXX_HAVE_SINCOS 1 /* Define to 1 if you have the `sincosf' function. */ #define _GLIBCXX_HAVE_SINCOSF 1 /* Define to 1 if you have the `sincosl' function. */ #define _GLIBCXX_HAVE_SINCOSL 1 /* Define to 1 if you have the `sinf' function. */ #define _GLIBCXX_HAVE_SINF 1 /* Define to 1 if you have the `sinhf' function. */ #define _GLIBCXX_HAVE_SINHF 1 /* Define to 1 if you have the `sinhl' function. */ #define _GLIBCXX_HAVE_SINHL 1 /* Define to 1 if you have the `sinl' function. */ #define _GLIBCXX_HAVE_SINL 1 /* Defined if sleep exists. */ #define _GLIBCXX_HAVE_SLEEP 1 /* Define to 1 if you have the `sqrtf' function. */ #define _GLIBCXX_HAVE_SQRTF 1 /* Define to 1 if you have the `sqrtl' function. */ #define _GLIBCXX_HAVE_SQRTL 1 /* Define to 1 if you have the <stdalign.h> header file. */ #define _GLIBCXX_HAVE_STDALIGN_H 1 /* Define to 1 if you have the <stdbool.h> header file. */ #define _GLIBCXX_HAVE_STDBOOL_H 1 /* Define to 1 if you have the <stdint.h> header file. */ #define _GLIBCXX_HAVE_STDINT_H 1 /* Define to 1 if you have the <stdlib.h> header file. */ #define _GLIBCXX_HAVE_STDLIB_H 1 /* Define if strerror_l is available in <string.h>. */ #define _GLIBCXX_HAVE_STRERROR_L 1 /* Define if strerror_r is available in <string.h>. */ #define _GLIBCXX_HAVE_STRERROR_R 1 /* Define to 1 if you have the <strings.h> header file. */ #define _GLIBCXX_HAVE_STRINGS_H 1 /* Define to 1 if you have the <string.h> header file. */ #define _GLIBCXX_HAVE_STRING_H 1 /* Define to 1 if you have the `strtof' function. */ #define _GLIBCXX_HAVE_STRTOF 1 /* Define to 1 if you have the `strtold' function. */ #define _GLIBCXX_HAVE_STRTOLD 1 /* Define if strxfrm_l is available in <string.h>. */ #define _GLIBCXX_HAVE_STRXFRM_L 1 /* Define to 1 if the target runtime linker supports binding the same symbol to different versions. */ #define _GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT 1 /* Define to 1 if you have the <sys/filio.h> header file. */ /* #undef _GLIBCXX_HAVE_SYS_FILIO_H */ /* Define to 1 if you have the <sys/ioctl.h> header file. */ #define _GLIBCXX_HAVE_SYS_IOCTL_H 1 /* Define to 1 if you have the <sys/ipc.h> header file. */ #define _GLIBCXX_HAVE_SYS_IPC_H 1 /* Define to 1 if you have the <sys/isa_defs.h> header file. */ /* #undef _GLIBCXX_HAVE_SYS_ISA_DEFS_H */ /* Define to 1 if you have the <sys/machine.h> header file. */ /* #undef _GLIBCXX_HAVE_SYS_MACHINE_H */ /* Define to 1 if you have the <sys/param.h> header file. */ #define _GLIBCXX_HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the <sys/resource.h> header file. */ #define _GLIBCXX_HAVE_SYS_RESOURCE_H 1 /* Define to 1 if you have a suitable <sys/sdt.h> header file */ #define _GLIBCXX_HAVE_SYS_SDT_H 1 /* Define to 1 if you have the <sys/sem.h> header file. */ #define _GLIBCXX_HAVE_SYS_SEM_H 1 /* Define to 1 if you have the <sys/stat.h> header file. */ #define _GLIBCXX_HAVE_SYS_STAT_H 1 /* Define to 1 if you have the <sys/sysinfo.h> header file. */ #define _GLIBCXX_HAVE_SYS_SYSINFO_H 1 /* Define to 1 if you have the <sys/time.h> header file. */ #define _GLIBCXX_HAVE_SYS_TIME_H 1 /* Define to 1 if you have the <sys/types.h> header file. */ #define _GLIBCXX_HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <sys/uio.h> header file. */ #define _GLIBCXX_HAVE_SYS_UIO_H 1 /* Define if S_IFREG is available in <sys/stat.h>. */ /* #undef _GLIBCXX_HAVE_S_IFREG */ /* Define if S_IFREG is available in <sys/stat.h>. */ #define _GLIBCXX_HAVE_S_ISREG 1 /* Define to 1 if you have the `tanf' function. */ #define _GLIBCXX_HAVE_TANF 1 /* Define to 1 if you have the `tanhf' function. */ #define _GLIBCXX_HAVE_TANHF 1 /* Define to 1 if you have the `tanhl' function. */ #define _GLIBCXX_HAVE_TANHL 1 /* Define to 1 if you have the `tanl' function. */ #define _GLIBCXX_HAVE_TANL 1 /* Define to 1 if you have the <tgmath.h> header file. */ #define _GLIBCXX_HAVE_TGMATH_H 1 /* Define to 1 if the target supports thread-local storage. */ #define _GLIBCXX_HAVE_TLS 1 /* Define to 1 if you have the <unistd.h> header file. */ #define _GLIBCXX_HAVE_UNISTD_H 1 /* Defined if usleep exists. */ #define _GLIBCXX_HAVE_USLEEP 1 /* Defined if vfwscanf exists. */ #define _GLIBCXX_HAVE_VFWSCANF 1 /* Defined if vswscanf exists. */ #define _GLIBCXX_HAVE_VSWSCANF 1 /* Defined if vwscanf exists. */ #define _GLIBCXX_HAVE_VWSCANF 1 /* Define to 1 if you have the <wchar.h> header file. */ #define _GLIBCXX_HAVE_WCHAR_H 1 /* Defined if wcstof exists. */ #define _GLIBCXX_HAVE_WCSTOF 1 /* Define to 1 if you have the <wctype.h> header file. */ #define _GLIBCXX_HAVE_WCTYPE_H 1 /* Defined if Sleep exists. */ /* #undef _GLIBCXX_HAVE_WIN32_SLEEP */ /* Define if writev is available in <sys/uio.h>. */ #define _GLIBCXX_HAVE_WRITEV 1 /* Define to 1 if you have the `_acosf' function. */ /* #undef _GLIBCXX_HAVE__ACOSF */ /* Define to 1 if you have the `_acosl' function. */ /* #undef _GLIBCXX_HAVE__ACOSL */ /* Define to 1 if you have the `_asinf' function. */ /* #undef _GLIBCXX_HAVE__ASINF */ /* Define to 1 if you have the `_asinl' function. */ /* #undef _GLIBCXX_HAVE__ASINL */ /* Define to 1 if you have the `_atan2f' function. */ /* #undef _GLIBCXX_HAVE__ATAN2F */ /* Define to 1 if you have the `_atan2l' function. */ /* #undef _GLIBCXX_HAVE__ATAN2L */ /* Define to 1 if you have the `_atanf' function. */ /* #undef _GLIBCXX_HAVE__ATANF */ /* Define to 1 if you have the `_atanl' function. */ /* #undef _GLIBCXX_HAVE__ATANL */ /* Define to 1 if you have the `_ceilf' function. */ /* #undef _GLIBCXX_HAVE__CEILF */ /* Define to 1 if you have the `_ceill' function. */ /* #undef _GLIBCXX_HAVE__CEILL */ /* Define to 1 if you have the `_cosf' function. */ /* #undef _GLIBCXX_HAVE__COSF */ /* Define to 1 if you have the `_coshf' function. */ /* #undef _GLIBCXX_HAVE__COSHF */ /* Define to 1 if you have the `_coshl' function. */ /* #undef _GLIBCXX_HAVE__COSHL */ /* Define to 1 if you have the `_cosl' function. */ /* #undef _GLIBCXX_HAVE__COSL */ /* Define to 1 if you have the `_expf' function. */ /* #undef _GLIBCXX_HAVE__EXPF */ /* Define to 1 if you have the `_expl' function. */ /* #undef _GLIBCXX_HAVE__EXPL */ /* Define to 1 if you have the `_fabsf' function. */ /* #undef _GLIBCXX_HAVE__FABSF */ /* Define to 1 if you have the `_fabsl' function. */ /* #undef _GLIBCXX_HAVE__FABSL */ /* Define to 1 if you have the `_finite' function. */ /* #undef _GLIBCXX_HAVE__FINITE */ /* Define to 1 if you have the `_finitef' function. */ /* #undef _GLIBCXX_HAVE__FINITEF */ /* Define to 1 if you have the `_finitel' function. */ /* #undef _GLIBCXX_HAVE__FINITEL */ /* Define to 1 if you have the `_floorf' function. */ /* #undef _GLIBCXX_HAVE__FLOORF */ /* Define to 1 if you have the `_floorl' function. */ /* #undef _GLIBCXX_HAVE__FLOORL */ /* Define to 1 if you have the `_fmodf' function. */ /* #undef _GLIBCXX_HAVE__FMODF */ /* Define to 1 if you have the `_fmodl' function. */ /* #undef _GLIBCXX_HAVE__FMODL */ /* Define to 1 if you have the `_fpclass' function. */ /* #undef _GLIBCXX_HAVE__FPCLASS */ /* Define to 1 if you have the `_frexpf' function. */ /* #undef _GLIBCXX_HAVE__FREXPF */ /* Define to 1 if you have the `_frexpl' function. */ /* #undef _GLIBCXX_HAVE__FREXPL */ /* Define to 1 if you have the `_hypot' function. */ /* #undef _GLIBCXX_HAVE__HYPOT */ /* Define to 1 if you have the `_hypotf' function. */ /* #undef _GLIBCXX_HAVE__HYPOTF */ /* Define to 1 if you have the `_hypotl' function. */ /* #undef _GLIBCXX_HAVE__HYPOTL */ /* Define to 1 if you have the `_isinf' function. */ /* #undef _GLIBCXX_HAVE__ISINF */ /* Define to 1 if you have the `_isinff' function. */ /* #undef _GLIBCXX_HAVE__ISINFF */ /* Define to 1 if you have the `_isinfl' function. */ /* #undef _GLIBCXX_HAVE__ISINFL */ /* Define to 1 if you have the `_isnan' function. */ /* #undef _GLIBCXX_HAVE__ISNAN */ /* Define to 1 if you have the `_isnanf' function. */ /* #undef _GLIBCXX_HAVE__ISNANF */ /* Define to 1 if you have the `_isnanl' function. */ /* #undef _GLIBCXX_HAVE__ISNANL */ /* Define to 1 if you have the `_ldexpf' function. */ /* #undef _GLIBCXX_HAVE__LDEXPF */ /* Define to 1 if you have the `_ldexpl' function. */ /* #undef _GLIBCXX_HAVE__LDEXPL */ /* Define to 1 if you have the `_log10f' function. */ /* #undef _GLIBCXX_HAVE__LOG10F */ /* Define to 1 if you have the `_log10l' function. */ /* #undef _GLIBCXX_HAVE__LOG10L */ /* Define to 1 if you have the `_logf' function. */ /* #undef _GLIBCXX_HAVE__LOGF */ /* Define to 1 if you have the `_logl' function. */ /* #undef _GLIBCXX_HAVE__LOGL */ /* Define to 1 if you have the `_modf' function. */ /* #undef _GLIBCXX_HAVE__MODF */ /* Define to 1 if you have the `_modff' function. */ /* #undef _GLIBCXX_HAVE__MODFF */ /* Define to 1 if you have the `_modfl' function. */ /* #undef _GLIBCXX_HAVE__MODFL */ /* Define to 1 if you have the `_powf' function. */ /* #undef _GLIBCXX_HAVE__POWF */ /* Define to 1 if you have the `_powl' function. */ /* #undef _GLIBCXX_HAVE__POWL */ /* Define to 1 if you have the `_qfpclass' function. */ /* #undef _GLIBCXX_HAVE__QFPCLASS */ /* Define to 1 if you have the `_sincos' function. */ /* #undef _GLIBCXX_HAVE__SINCOS */ /* Define to 1 if you have the `_sincosf' function. */ /* #undef _GLIBCXX_HAVE__SINCOSF */ /* Define to 1 if you have the `_sincosl' function. */ /* #undef _GLIBCXX_HAVE__SINCOSL */ /* Define to 1 if you have the `_sinf' function. */ /* #undef _GLIBCXX_HAVE__SINF */ /* Define to 1 if you have the `_sinhf' function. */ /* #undef _GLIBCXX_HAVE__SINHF */ /* Define to 1 if you have the `_sinhl' function. */ /* #undef _GLIBCXX_HAVE__SINHL */ /* Define to 1 if you have the `_sinl' function. */ /* #undef _GLIBCXX_HAVE__SINL */ /* Define to 1 if you have the `_sqrtf' function. */ /* #undef _GLIBCXX_HAVE__SQRTF */ /* Define to 1 if you have the `_sqrtl' function. */ /* #undef _GLIBCXX_HAVE__SQRTL */ /* Define to 1 if you have the `_tanf' function. */ /* #undef _GLIBCXX_HAVE__TANF */ /* Define to 1 if you have the `_tanhf' function. */ /* #undef _GLIBCXX_HAVE__TANHF */ /* Define to 1 if you have the `_tanhl' function. */ /* #undef _GLIBCXX_HAVE__TANHL */ /* Define to 1 if you have the `_tanl' function. */ /* #undef _GLIBCXX_HAVE__TANL */ /* Define to 1 if you have the `__cxa_thread_atexit_impl' function. */ /* #undef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */ /* Define as const if the declaration of iconv() needs const. */ #define _GLIBCXX_ICONV_CONST /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" /* Name of package */ /* #undef _GLIBCXX_PACKAGE */ /* Define to the address where bug reports for this package should be sent. */ #define _GLIBCXX_PACKAGE_BUGREPORT "" /* Define to the full name of this package. */ #define _GLIBCXX_PACKAGE_NAME "package-unused" /* Define to the full name and version of this package. */ #define _GLIBCXX_PACKAGE_STRING "package-unused version-unused" /* Define to the one symbol short name of this package. */ #define _GLIBCXX_PACKAGE_TARNAME "libstdc++" /* Define to the home page for this package. */ #define _GLIBCXX_PACKAGE_URL "" /* Define to the version of this package. */ #define _GLIBCXX_PACKAGE__GLIBCXX_VERSION "version-unused" /* The size of `char', as computed by sizeof. */ /* #undef SIZEOF_CHAR */ /* The size of `int', as computed by sizeof. */ /* #undef SIZEOF_INT */ /* The size of `long', as computed by sizeof. */ /* #undef SIZEOF_LONG */ /* The size of `short', as computed by sizeof. */ /* #undef SIZEOF_SHORT */ /* The size of `void *', as computed by sizeof. */ /* #undef SIZEOF_VOID_P */ /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Version number of package */ /* #undef _GLIBCXX_VERSION */ /* Define if the compiler supports C++11 atomics. */ #define _GLIBCXX_ATOMIC_BUILTINS 1 /* Define to use concept checking code from the boost libraries. */ /* #undef _GLIBCXX_CONCEPT_CHECKS */ /* Define to 1 if a fully dynamic basic_string is wanted, 0 to disable, undefined for platform defaults */ #define _GLIBCXX_FULLY_DYNAMIC_STRING 0 /* Define if gthreads library is available. */ #define _GLIBCXX_HAS_GTHREADS 1 /* Define to 1 if a full hosted library is built, or 0 if freestanding. */ #define _GLIBCXX_HOSTED 1 /* Define if compatibility should be provided for -mlong-double-64. */ /* Define if ptrdiff_t is int. */ #define _GLIBCXX_PTRDIFF_T_IS_INT 1 /* Define if using setrlimit to set resource limits during "make check" */ #define _GLIBCXX_RES_LIMITS 1 /* Define if size_t is unsigned int. */ #define _GLIBCXX_SIZE_T_IS_UINT 1 /* Define if the compiler is configured for setjmp/longjmp exceptions. */ /* #undef _GLIBCXX_SJLJ_EXCEPTIONS */ /* Define to the value of the EOF integer constant. */ #define _GLIBCXX_STDIO_EOF -1 /* Define to the value of the SEEK_CUR integer constant. */ #define _GLIBCXX_STDIO_SEEK_CUR 1 /* Define to the value of the SEEK_END integer constant. */ #define _GLIBCXX_STDIO_SEEK_END 2 /* Define to use symbol versioning in the shared library. */ #define _GLIBCXX_SYMVER 1 /* Define to use darwin versioning in the shared library. */ /* #undef _GLIBCXX_SYMVER_DARWIN */ /* Define to use GNU versioning in the shared library. */ #define _GLIBCXX_SYMVER_GNU 1 /* Define to use GNU namespace versioning in the shared library. */ /* #undef _GLIBCXX_SYMVER_GNU_NAMESPACE */ /* Define to use Sun versioning in the shared library. */ /* #undef _GLIBCXX_SYMVER_SUN */ /* Define if C99 functions or macros from <wchar.h>, <math.h>, <complex.h>, <stdio.h>, and <stdlib.h> can be used or exposed. */ #define _GLIBCXX_USE_C99 1 /* Define if C99 functions in <complex.h> should be used in <complex>. Using compiler builtins for these functions requires corresponding C99 library functions to be present. */ #define _GLIBCXX_USE_C99_COMPLEX 1 /* Define if C99 functions in <complex.h> should be used in <tr1/complex>. Using compiler builtins for these functions requires corresponding C99 library functions to be present. */ #define _GLIBCXX_USE_C99_COMPLEX_TR1 1 /* Define if C99 functions in <ctype.h> should be imported in <tr1/cctype> in namespace std::tr1. */ #define _GLIBCXX_USE_C99_CTYPE_TR1 1 /* Define if C99 functions in <fenv.h> should be imported in <tr1/cfenv> in namespace std::tr1. */ #define _GLIBCXX_USE_C99_FENV_TR1 1 /* Define if C99 functions in <inttypes.h> should be imported in <tr1/cinttypes> in namespace std::tr1. */ #define _GLIBCXX_USE_C99_INTTYPES_TR1 1 /* Define if wchar_t C99 functions in <inttypes.h> should be imported in <tr1/cinttypes> in namespace std::tr1. */ #define _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 1 /* Define if C99 functions or macros in <math.h> should be imported in <cmath> in namespace std. */ #define _GLIBCXX_USE_C99_MATH 1 /* Define if C99 functions or macros in <math.h> should be imported in <tr1/cmath> in namespace std::tr1. */ #define _GLIBCXX_USE_C99_MATH_TR1 1 /* Define if C99 types in <stdint.h> should be imported in <tr1/cstdint> in namespace std::tr1. */ #define _GLIBCXX_USE_C99_STDINT_TR1 1 /* Defined if clock_gettime has monotonic clock support. */ #define _GLIBCXX_USE_CLOCK_MONOTONIC 1 /* Defined if clock_gettime syscall has monotonic and realtime clock support. */ #define _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL 1 /* Defined if clock_gettime has realtime clock support. */ #define _GLIBCXX_USE_CLOCK_REALTIME 1 /* Define if ISO/IEC TR 24733 decimal floating point types are supported on this host. */ #define _GLIBCXX_USE_DECIMAL_FLOAT 1 /* Define if __float128 is supported on this host. */ #define _GLIBCXX_USE_FLOAT128 1 /* Defined if gettimeofday is available. */ #define _GLIBCXX_USE_GETTIMEOFDAY 1 /* Define if get_nprocs is available in <sys/sysinfo.h>. */ #define _GLIBCXX_USE_GET_NPROCS 1 /* Define if __int128 is supported on this host. */ /* #undef _GLIBCXX_USE_INT128 */ /* Define if LFS support is available. */ #define _GLIBCXX_USE_LFS 1 /* Define if code specialized for long long should be used. */ #define _GLIBCXX_USE_LONG_LONG 1 /* Defined if nanosleep is available. */ /* #undef _GLIBCXX_USE_NANOSLEEP */ /* Define if NLS translations are to be used. */ #define _GLIBCXX_USE_NLS 1 /* Define if pthreads_num_processors_np is available in <pthread.h>. */ /* #undef _GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP */ /* Define if /dev/random and /dev/urandom are available for the random_device of TR1 (Chapter 5.1). */ #define _GLIBCXX_USE_RANDOM_TR1 1 /* Defined if sched_yield is available. */ /* #undef _GLIBCXX_USE_SCHED_YIELD */ /* Define if _SC_NPROCESSORS_ONLN is available in <unistd.h>. */ #define _GLIBCXX_USE_SC_NPROCESSORS_ONLN 1 /* Define if _SC_NPROC_ONLN is available in <unistd.h>. */ /* #undef _GLIBCXX_USE_SC_NPROC_ONLN */ /* Define if sysctl(), CTL_HW and HW_NCPU are available in <sys/sysctl.h>. */ /* #undef _GLIBCXX_USE_SYSCTL_HW_NCPU */ /* Define if code specialized for wchar_t should be used. */ #define _GLIBCXX_USE_WCHAR_T 1 /* Define to 1 if a verbose library is built, or 0 otherwise. */ #define _GLIBCXX_VERBOSE 1 /* Defined if as can handle rdrand. */ #define _GLIBCXX_X86_RDRAND 1 /* Define to 1 if mutex_timedlock is available. */ #define _GTHREAD_USE_MUTEX_TIMEDLOCK 1 #if defined (_GLIBCXX_HAVE__ACOSF) && ! defined (_GLIBCXX_HAVE_ACOSF) # define _GLIBCXX_HAVE_ACOSF 1 # define acosf _acosf #endif #if defined (_GLIBCXX_HAVE__ACOSL) && ! defined (_GLIBCXX_HAVE_ACOSL) # define _GLIBCXX_HAVE_ACOSL 1 # define acosl _acosl #endif #if defined (_GLIBCXX_HAVE__ASINF) && ! defined (_GLIBCXX_HAVE_ASINF) # define _GLIBCXX_HAVE_ASINF 1 # define asinf _asinf #endif #if defined (_GLIBCXX_HAVE__ASINL) && ! defined (_GLIBCXX_HAVE_ASINL) # define _GLIBCXX_HAVE_ASINL 1 # define asinl _asinl #endif #if defined (_GLIBCXX_HAVE__ATAN2F) && ! defined (_GLIBCXX_HAVE_ATAN2F) # define _GLIBCXX_HAVE_ATAN2F 1 # define atan2f _atan2f #endif #if defined (_GLIBCXX_HAVE__ATAN2L) && ! defined (_GLIBCXX_HAVE_ATAN2L) # define _GLIBCXX_HAVE_ATAN2L 1 # define atan2l _atan2l #endif #if defined (_GLIBCXX_HAVE__ATANF) && ! defined (_GLIBCXX_HAVE_ATANF) # define _GLIBCXX_HAVE_ATANF 1 # define atanf _atanf #endif #if defined (_GLIBCXX_HAVE__ATANL) && ! defined (_GLIBCXX_HAVE_ATANL) # define _GLIBCXX_HAVE_ATANL 1 # define atanl _atanl #endif #if defined (_GLIBCXX_HAVE__CEILF) && ! defined (_GLIBCXX_HAVE_CEILF) # define _GLIBCXX_HAVE_CEILF 1 # define ceilf _ceilf #endif #if defined (_GLIBCXX_HAVE__CEILL) && ! defined (_GLIBCXX_HAVE_CEILL) # define _GLIBCXX_HAVE_CEILL 1 # define ceill _ceill #endif #if defined (_GLIBCXX_HAVE__COSF) && ! defined (_GLIBCXX_HAVE_COSF) # define _GLIBCXX_HAVE_COSF 1 # define cosf _cosf #endif #if defined (_GLIBCXX_HAVE__COSHF) && ! defined (_GLIBCXX_HAVE_COSHF) # define _GLIBCXX_HAVE_COSHF 1 # define coshf _coshf #endif #if defined (_GLIBCXX_HAVE__COSHL) && ! defined (_GLIBCXX_HAVE_COSHL) # define _GLIBCXX_HAVE_COSHL 1 # define coshl _coshl #endif #if defined (_GLIBCXX_HAVE__COSL) && ! defined (_GLIBCXX_HAVE_COSL) # define _GLIBCXX_HAVE_COSL 1 # define cosl _cosl #endif #if defined (_GLIBCXX_HAVE__EXPF) && ! defined (_GLIBCXX_HAVE_EXPF) # define _GLIBCXX_HAVE_EXPF 1 # define expf _expf #endif #if defined (_GLIBCXX_HAVE__EXPL) && ! defined (_GLIBCXX_HAVE_EXPL) # define _GLIBCXX_HAVE_EXPL 1 # define expl _expl #endif #if defined (_GLIBCXX_HAVE__FABSF) && ! defined (_GLIBCXX_HAVE_FABSF) # define _GLIBCXX_HAVE_FABSF 1 # define fabsf _fabsf #endif #if defined (_GLIBCXX_HAVE__FABSL) && ! defined (_GLIBCXX_HAVE_FABSL) # define _GLIBCXX_HAVE_FABSL 1 # define fabsl _fabsl #endif #if defined (_GLIBCXX_HAVE__FINITE) && ! defined (_GLIBCXX_HAVE_FINITE) # define _GLIBCXX_HAVE_FINITE 1 # define finite _finite #endif #if defined (_GLIBCXX_HAVE__FINITEF) && ! defined (_GLIBCXX_HAVE_FINITEF) # define _GLIBCXX_HAVE_FINITEF 1 # define finitef _finitef #endif #if defined (_GLIBCXX_HAVE__FINITEL) && ! defined (_GLIBCXX_HAVE_FINITEL) # define _GLIBCXX_HAVE_FINITEL 1 # define finitel _finitel #endif #if defined (_GLIBCXX_HAVE__FLOORF) && ! defined (_GLIBCXX_HAVE_FLOORF) # define _GLIBCXX_HAVE_FLOORF 1 # define floorf _floorf #endif #if defined (_GLIBCXX_HAVE__FLOORL) && ! defined (_GLIBCXX_HAVE_FLOORL) # define _GLIBCXX_HAVE_FLOORL 1 # define floorl _floorl #endif #if defined (_GLIBCXX_HAVE__FMODF) && ! defined (_GLIBCXX_HAVE_FMODF) # define _GLIBCXX_HAVE_FMODF 1 # define fmodf _fmodf #endif #if defined (_GLIBCXX_HAVE__FMODL) && ! defined (_GLIBCXX_HAVE_FMODL) # define _GLIBCXX_HAVE_FMODL 1 # define fmodl _fmodl #endif #if defined (_GLIBCXX_HAVE__FPCLASS) && ! defined (_GLIBCXX_HAVE_FPCLASS) # define _GLIBCXX_HAVE_FPCLASS 1 # define fpclass _fpclass #endif #if defined (_GLIBCXX_HAVE__FREXPF) && ! defined (_GLIBCXX_HAVE_FREXPF) # define _GLIBCXX_HAVE_FREXPF 1 # define frexpf _frexpf #endif #if defined (_GLIBCXX_HAVE__FREXPL) && ! defined (_GLIBCXX_HAVE_FREXPL) # define _GLIBCXX_HAVE_FREXPL 1 # define frexpl _frexpl #endif #if defined (_GLIBCXX_HAVE__HYPOT) && ! defined (_GLIBCXX_HAVE_HYPOT) # define _GLIBCXX_HAVE_HYPOT 1 # define hypot _hypot #endif #if defined (_GLIBCXX_HAVE__HYPOTF) && ! defined (_GLIBCXX_HAVE_HYPOTF) # define _GLIBCXX_HAVE_HYPOTF 1 # define hypotf _hypotf #endif #if defined (_GLIBCXX_HAVE__HYPOTL) && ! defined (_GLIBCXX_HAVE_HYPOTL) # define _GLIBCXX_HAVE_HYPOTL 1 # define hypotl _hypotl #endif #if defined (_GLIBCXX_HAVE__ISINF) && ! defined (_GLIBCXX_HAVE_ISINF) # define _GLIBCXX_HAVE_ISINF 1 # define isinf _isinf #endif #if defined (_GLIBCXX_HAVE__ISINFF) && ! defined (_GLIBCXX_HAVE_ISINFF) # define _GLIBCXX_HAVE_ISINFF 1 # define isinff _isinff #endif #if defined (_GLIBCXX_HAVE__ISINFL) && ! defined (_GLIBCXX_HAVE_ISINFL) # define _GLIBCXX_HAVE_ISINFL 1 # define isinfl _isinfl #endif #if defined (_GLIBCXX_HAVE__ISNAN) && ! defined (_GLIBCXX_HAVE_ISNAN) # define _GLIBCXX_HAVE_ISNAN 1 # define isnan _isnan #endif #if defined (_GLIBCXX_HAVE__ISNANF) && ! defined (_GLIBCXX_HAVE_ISNANF) # define _GLIBCXX_HAVE_ISNANF 1 # define isnanf _isnanf #endif #if defined (_GLIBCXX_HAVE__ISNANL) && ! defined (_GLIBCXX_HAVE_ISNANL) # define _GLIBCXX_HAVE_ISNANL 1 # define isnanl _isnanl #endif #if defined (_GLIBCXX_HAVE__LDEXPF) && ! defined (_GLIBCXX_HAVE_LDEXPF) # define _GLIBCXX_HAVE_LDEXPF 1 # define ldexpf _ldexpf #endif #if defined (_GLIBCXX_HAVE__LDEXPL) && ! defined (_GLIBCXX_HAVE_LDEXPL) # define _GLIBCXX_HAVE_LDEXPL 1 # define ldexpl _ldexpl #endif #if defined (_GLIBCXX_HAVE__LOG10F) && ! defined (_GLIBCXX_HAVE_LOG10F) # define _GLIBCXX_HAVE_LOG10F 1 # define log10f _log10f #endif #if defined (_GLIBCXX_HAVE__LOG10L) && ! defined (_GLIBCXX_HAVE_LOG10L) # define _GLIBCXX_HAVE_LOG10L 1 # define log10l _log10l #endif #if defined (_GLIBCXX_HAVE__LOGF) && ! defined (_GLIBCXX_HAVE_LOGF) # define _GLIBCXX_HAVE_LOGF 1 # define logf _logf #endif #if defined (_GLIBCXX_HAVE__LOGL) && ! defined (_GLIBCXX_HAVE_LOGL) # define _GLIBCXX_HAVE_LOGL 1 # define logl _logl #endif #if defined (_GLIBCXX_HAVE__MODF) && ! defined (_GLIBCXX_HAVE_MODF) # define _GLIBCXX_HAVE_MODF 1 # define modf _modf #endif #if defined (_GLIBCXX_HAVE__MODFF) && ! defined (_GLIBCXX_HAVE_MODFF) # define _GLIBCXX_HAVE_MODFF 1 # define modff _modff #endif #if defined (_GLIBCXX_HAVE__MODFL) && ! defined (_GLIBCXX_HAVE_MODFL) # define _GLIBCXX_HAVE_MODFL 1 # define modfl _modfl #endif #if defined (_GLIBCXX_HAVE__POWF) && ! defined (_GLIBCXX_HAVE_POWF) # define _GLIBCXX_HAVE_POWF 1 # define powf _powf #endif #if defined (_GLIBCXX_HAVE__POWL) && ! defined (_GLIBCXX_HAVE_POWL) # define _GLIBCXX_HAVE_POWL 1 # define powl _powl #endif #if defined (_GLIBCXX_HAVE__QFPCLASS) && ! defined (_GLIBCXX_HAVE_QFPCLASS) # define _GLIBCXX_HAVE_QFPCLASS 1 # define qfpclass _qfpclass #endif #if defined (_GLIBCXX_HAVE__SINCOS) && ! defined (_GLIBCXX_HAVE_SINCOS) # define _GLIBCXX_HAVE_SINCOS 1 # define sincos _sincos #endif #if defined (_GLIBCXX_HAVE__SINCOSF) && ! defined (_GLIBCXX_HAVE_SINCOSF) # define _GLIBCXX_HAVE_SINCOSF 1 # define sincosf _sincosf #endif #if defined (_GLIBCXX_HAVE__SINCOSL) && ! defined (_GLIBCXX_HAVE_SINCOSL) # define _GLIBCXX_HAVE_SINCOSL 1 # define sincosl _sincosl #endif #if defined (_GLIBCXX_HAVE__SINF) && ! defined (_GLIBCXX_HAVE_SINF) # define _GLIBCXX_HAVE_SINF 1 # define sinf _sinf #endif #if defined (_GLIBCXX_HAVE__SINHF) && ! defined (_GLIBCXX_HAVE_SINHF) # define _GLIBCXX_HAVE_SINHF 1 # define sinhf _sinhf #endif #if defined (_GLIBCXX_HAVE__SINHL) && ! defined (_GLIBCXX_HAVE_SINHL) # define _GLIBCXX_HAVE_SINHL 1 # define sinhl _sinhl #endif #if defined (_GLIBCXX_HAVE__SINL) && ! defined (_GLIBCXX_HAVE_SINL) # define _GLIBCXX_HAVE_SINL 1 # define sinl _sinl #endif #if defined (_GLIBCXX_HAVE__SQRTF) && ! defined (_GLIBCXX_HAVE_SQRTF) # define _GLIBCXX_HAVE_SQRTF 1 # define sqrtf _sqrtf #endif #if defined (_GLIBCXX_HAVE__SQRTL) && ! defined (_GLIBCXX_HAVE_SQRTL) # define _GLIBCXX_HAVE_SQRTL 1 # define sqrtl _sqrtl #endif #if defined (_GLIBCXX_HAVE__STRTOF) && ! defined (_GLIBCXX_HAVE_STRTOF) # define _GLIBCXX_HAVE_STRTOF 1 # define strtof _strtof #endif #if defined (_GLIBCXX_HAVE__STRTOLD) && ! defined (_GLIBCXX_HAVE_STRTOLD) # define _GLIBCXX_HAVE_STRTOLD 1 # define strtold _strtold #endif #if defined (_GLIBCXX_HAVE__TANF) && ! defined (_GLIBCXX_HAVE_TANF) # define _GLIBCXX_HAVE_TANF 1 # define tanf _tanf #endif #if defined (_GLIBCXX_HAVE__TANHF) && ! defined (_GLIBCXX_HAVE_TANHF) # define _GLIBCXX_HAVE_TANHF 1 # define tanhf _tanhf #endif #if defined (_GLIBCXX_HAVE__TANHL) && ! defined (_GLIBCXX_HAVE_TANHL) # define _GLIBCXX_HAVE_TANHL 1 # define tanhl _tanhl #endif #if defined (_GLIBCXX_HAVE__TANL) && ! defined (_GLIBCXX_HAVE_TANL) # define _GLIBCXX_HAVE_TANL 1 # define tanl _tanl #endif #endif // _GLIBCXX_CXX_CONFIG_H #else // Predefined symbols and macros -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/c++config.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{iosfwd} */ #ifndef _GLIBCXX_CXX_CONFIG_H #define _GLIBCXX_CXX_CONFIG_H 1 // The current version of the C++ library in compressed ISO date format. #define __GLIBCXX__ 20150623 // Macros for various attributes. // _GLIBCXX_PURE // _GLIBCXX_CONST // _GLIBCXX_NORETURN // _GLIBCXX_NOTHROW // _GLIBCXX_VISIBILITY #ifndef _GLIBCXX_PURE # define _GLIBCXX_PURE __attribute__ ((__pure__)) #endif #ifndef _GLIBCXX_CONST # define _GLIBCXX_CONST __attribute__ ((__const__)) #endif #ifndef _GLIBCXX_NORETURN # define _GLIBCXX_NORETURN __attribute__ ((__noreturn__)) #endif // See below for C++ #ifndef _GLIBCXX_NOTHROW # ifndef __cplusplus # define _GLIBCXX_NOTHROW __attribute__((__nothrow__)) # endif #endif // Macros for visibility attributes. // _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY // _GLIBCXX_VISIBILITY # define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 1 #if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY # define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V))) #else // If this is not supplied by the OS-specific or CPU-specific // headers included below, it will be defined to an empty default. # define _GLIBCXX_VISIBILITY(V) _GLIBCXX_PSEUDO_VISIBILITY(V) #endif // Macros for deprecated attributes. // _GLIBCXX_USE_DEPRECATED // _GLIBCXX_DEPRECATED #ifndef _GLIBCXX_USE_DEPRECATED # define _GLIBCXX_USE_DEPRECATED 1 #endif #if defined(__DEPRECATED) && (__cplusplus >= 201103L) # define _GLIBCXX_DEPRECATED __attribute__ ((__deprecated__)) #else # define _GLIBCXX_DEPRECATED #endif // Macros for ABI tag attributes. #ifndef _GLIBCXX_ABI_TAG_CXX11 # define _GLIBCXX_ABI_TAG_CXX11 __attribute ((__abi_tag__ ("cxx11"))) #endif #if __cplusplus // Macro for constexpr, to support in mixed 03/0x mode. #ifndef _GLIBCXX_CONSTEXPR # if __cplusplus >= 201103L # define _GLIBCXX_CONSTEXPR constexpr # define _GLIBCXX_USE_CONSTEXPR constexpr # else # define _GLIBCXX_CONSTEXPR # define _GLIBCXX_USE_CONSTEXPR const # endif #endif // Macro for noexcept, to support in mixed 03/0x mode. #ifndef _GLIBCXX_NOEXCEPT # if __cplusplus >= 201103L # define _GLIBCXX_NOEXCEPT noexcept # define _GLIBCXX_USE_NOEXCEPT noexcept # define _GLIBCXX_THROW(_EXC) # else # define _GLIBCXX_NOEXCEPT # define _GLIBCXX_USE_NOEXCEPT throw() # define _GLIBCXX_THROW(_EXC) throw(_EXC) # endif #endif #ifndef _GLIBCXX_NOTHROW # define _GLIBCXX_NOTHROW _GLIBCXX_USE_NOEXCEPT #endif #ifndef _GLIBCXX_THROW_OR_ABORT # if __EXCEPTIONS # define _GLIBCXX_THROW_OR_ABORT(_EXC) (throw (_EXC)) # else # define _GLIBCXX_THROW_OR_ABORT(_EXC) (__builtin_abort()) # endif #endif // Macro for extern template, ie controling template linkage via use // of extern keyword on template declaration. As documented in the g++ // manual, it inhibits all implicit instantiations and is used // throughout the library to avoid multiple weak definitions for // required types that are already explicitly instantiated in the // library binary. This substantially reduces the binary size of // resulting executables. // Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern // templates only in basic_string, thus activating its debug-mode // checks even at -O0. # define _GLIBCXX_EXTERN_TEMPLATE 1 /* Outline of libstdc++ namespaces. namespace std { namespace __debug { } namespace __parallel { } namespace __profile { } namespace __cxx1998 { } namespace __detail { } namespace rel_ops { } namespace tr1 { namespace placeholders { } namespace regex_constants { } namespace __detail { } } namespace tr2 { } namespace decimal { } namespace chrono { } namespace placeholders { } namespace regex_constants { } namespace this_thread { } } namespace abi { } namespace __gnu_cxx { namespace __detail { } } For full details see: http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespaces.html */ namespace std { typedef __SIZE_TYPE__ size_t; typedef __PTRDIFF_TYPE__ ptrdiff_t; #if __cplusplus >= 201103L typedef decltype(nullptr) nullptr_t; #endif } // Defined if inline namespaces are used for versioning. # define _GLIBCXX_INLINE_VERSION 0 // Inline namespace for symbol versioning. #if _GLIBCXX_INLINE_VERSION namespace std { inline namespace __7 { } namespace rel_ops { inline namespace __7 { } } namespace tr1 { inline namespace __7 { } namespace placeholders { inline namespace __7 { } } namespace regex_constants { inline namespace __7 { } } namespace __detail { inline namespace __7 { } } } namespace tr2 { inline namespace __7 { } } namespace decimal { inline namespace __7 { } } namespace chrono { inline namespace __7 { } } namespace placeholders { inline namespace __7 { } } namespace regex_constants { inline namespace __7 { } } namespace this_thread { inline namespace __7 { } } namespace __detail { inline namespace __7 { } } } namespace __gnu_cxx { inline namespace __7 { } namespace __detail { inline namespace __7 { } } } # define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __7 { # define _GLIBCXX_END_NAMESPACE_VERSION } #else # define _GLIBCXX_BEGIN_NAMESPACE_VERSION # define _GLIBCXX_END_NAMESPACE_VERSION #endif // Inline namespaces for special modes: debug, parallel, profile. #if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) \ || defined(_GLIBCXX_PROFILE) namespace std { // Non-inline namespace for components replaced by alternates in active mode. namespace __cxx1998 { #if _GLIBCXX_INLINE_VERSION inline namespace __7 { } #endif } // Inline namespace for debug mode. # ifdef _GLIBCXX_DEBUG inline namespace __debug { } # endif // Inline namespaces for parallel mode. # ifdef _GLIBCXX_PARALLEL inline namespace __parallel { } # endif // Inline namespaces for profile mode # ifdef _GLIBCXX_PROFILE inline namespace __profile { } # endif } // Check for invalid usage and unsupported mixed-mode use. # if defined(_GLIBCXX_DEBUG) && defined(_GLIBCXX_PARALLEL) # error illegal use of multiple inlined namespaces # endif # if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_DEBUG) # error illegal use of multiple inlined namespaces # endif # if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_PARALLEL) # error illegal use of multiple inlined namespaces # endif // Check for invalid use due to lack for weak symbols. # if __NO_INLINE__ && !__GXX_WEAK__ # warning currently using inlined namespace mode which may fail \ without inlining due to lack of weak symbols # endif #endif // Macros for namespace scope. Either namespace std:: or the name // of some nested namespace within it corresponding to the active mode. // _GLIBCXX_STD_A // _GLIBCXX_STD_C // // Macros for opening/closing conditional namespaces. // _GLIBCXX_BEGIN_NAMESPACE_ALGO // _GLIBCXX_END_NAMESPACE_ALGO // _GLIBCXX_BEGIN_NAMESPACE_CONTAINER // _GLIBCXX_END_NAMESPACE_CONTAINER #if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PROFILE) # define _GLIBCXX_STD_C __cxx1998 # define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER \ namespace _GLIBCXX_STD_C { _GLIBCXX_BEGIN_NAMESPACE_VERSION # define _GLIBCXX_END_NAMESPACE_CONTAINER \ _GLIBCXX_END_NAMESPACE_VERSION } # undef _GLIBCXX_EXTERN_TEMPLATE # define _GLIBCXX_EXTERN_TEMPLATE -1 #endif #ifdef _GLIBCXX_PARALLEL # define _GLIBCXX_STD_A __cxx1998 # define _GLIBCXX_BEGIN_NAMESPACE_ALGO \ namespace _GLIBCXX_STD_A { _GLIBCXX_BEGIN_NAMESPACE_VERSION # define _GLIBCXX_END_NAMESPACE_ALGO \ _GLIBCXX_END_NAMESPACE_VERSION } #endif #ifndef _GLIBCXX_STD_A # define _GLIBCXX_STD_A std #endif #ifndef _GLIBCXX_STD_C # define _GLIBCXX_STD_C std #endif #ifndef _GLIBCXX_BEGIN_NAMESPACE_ALGO # define _GLIBCXX_BEGIN_NAMESPACE_ALGO #endif #ifndef _GLIBCXX_END_NAMESPACE_ALGO # define _GLIBCXX_END_NAMESPACE_ALGO #endif #ifndef _GLIBCXX_BEGIN_NAMESPACE_CONTAINER # define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER #endif #ifndef _GLIBCXX_END_NAMESPACE_CONTAINER # define _GLIBCXX_END_NAMESPACE_CONTAINER #endif // GLIBCXX_ABI Deprecated // Define if compatibility should be provided for -mlong-double-64. #undef _GLIBCXX_LONG_DOUBLE_COMPAT // Inline namespace for long double 128 mode. #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ namespace std { inline namespace __gnu_cxx_ldbl128 { } } # define _GLIBCXX_NAMESPACE_LDBL __gnu_cxx_ldbl128:: # define _GLIBCXX_BEGIN_NAMESPACE_LDBL namespace __gnu_cxx_ldbl128 { # define _GLIBCXX_END_NAMESPACE_LDBL } #else # define _GLIBCXX_NAMESPACE_LDBL # define _GLIBCXX_BEGIN_NAMESPACE_LDBL # define _GLIBCXX_END_NAMESPACE_LDBL #endif // Assert. #if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PARALLEL) # define __glibcxx_assert(_Condition) #else namespace std { // Avoid the use of assert, because we're trying to keep the <cassert> // include out of the mix. inline void __replacement_assert(const char* __file, int __line, const char* __function, const char* __condition) { __builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line, __function, __condition); __builtin_abort(); } } #define __glibcxx_assert(_Condition) \ do \ { \ if (! (_Condition)) \ std::__replacement_assert(__FILE__, __LINE__, __PRETTY_FUNCTION__, \ #_Condition); \ } while (false) #endif // Macros for race detectors. // _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and // _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain // atomic (lock-free) synchronization to race detectors: // the race detector will infer a happens-before arc from the former to the // latter when they share the same argument pointer. // // The most frequent use case for these macros (and the only case in the // current implementation of the library) is atomic reference counting: // void _M_remove_reference() // { // _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount); // if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0) // { // _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount); // _M_destroy(__a); // } // } // The annotations in this example tell the race detector that all memory // accesses occurred when the refcount was positive do not race with // memory accesses which occurred after the refcount became zero. #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE # define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) #endif #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER # define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) #endif // Macros for C linkage: define extern "C" linkage only when using C++. # define _GLIBCXX_BEGIN_EXTERN_C extern "C" { # define _GLIBCXX_END_EXTERN_C } #else // !__cplusplus # define _GLIBCXX_BEGIN_EXTERN_C # define _GLIBCXX_END_EXTERN_C #endif // First includes. // Pick up any OS-specific definitions. #include <bits/os_defines.h> // Pick up any CPU-specific definitions. #include <bits/cpu_defines.h> // If platform uses neither visibility nor psuedo-visibility, // specify empty default for namespace annotation macros. #ifndef _GLIBCXX_PSEUDO_VISIBILITY # define _GLIBCXX_PSEUDO_VISIBILITY(V) #endif // Certain function definitions that are meant to be overridable from // user code are decorated with this macro. For some targets, this // macro causes these definitions to be weak. #ifndef _GLIBCXX_WEAK_DEFINITION # define _GLIBCXX_WEAK_DEFINITION #endif // The remainder of the prewritten config is automatic; all the // user hooks are listed above. // Create a boolean flag to be used to determine if --fast-math is set. #ifdef __FAST_MATH__ # define _GLIBCXX_FAST_MATH 1 #else # define _GLIBCXX_FAST_MATH 0 #endif // This marks string literals in header files to be extracted for eventual // translation. It is primarily used for messages in thrown exceptions; see // src/functexcept.cc. We use __N because the more traditional _N is used // for something else under certain OSes (see BADNAMES). #define __N(msgid) (msgid) // For example, <windows.h> is known to #define min and max as macros... #undef min #undef max // End of prewritten config; the settings discovered at configure time follow. /* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the `acosf' function. */ #define _GLIBCXX_HAVE_ACOSF 1 /* Define to 1 if you have the `acosl' function. */ #define _GLIBCXX_HAVE_ACOSL 1 /* Define to 1 if you have the `asinf' function. */ #define _GLIBCXX_HAVE_ASINF 1 /* Define to 1 if you have the `asinl' function. */ #define _GLIBCXX_HAVE_ASINL 1 /* Define to 1 if the target assembler supports .symver directive. */ #define _GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE 1 /* Define to 1 if you have the `atan2f' function. */ #define _GLIBCXX_HAVE_ATAN2F 1 /* Define to 1 if you have the `atan2l' function. */ #define _GLIBCXX_HAVE_ATAN2L 1 /* Define to 1 if you have the `atanf' function. */ #define _GLIBCXX_HAVE_ATANF 1 /* Define to 1 if you have the `atanl' function. */ #define _GLIBCXX_HAVE_ATANL 1 /* Define to 1 if you have the `at_quick_exit' function. */ #define _GLIBCXX_HAVE_AT_QUICK_EXIT 1 /* Define to 1 if the target assembler supports thread-local storage. */ /* #undef _GLIBCXX_HAVE_CC_TLS */ /* Define to 1 if you have the `ceilf' function. */ #define _GLIBCXX_HAVE_CEILF 1 /* Define to 1 if you have the `ceill' function. */ #define _GLIBCXX_HAVE_CEILL 1 /* Define to 1 if you have the <complex.h> header file. */ #define _GLIBCXX_HAVE_COMPLEX_H 1 /* Define to 1 if you have the `cosf' function. */ #define _GLIBCXX_HAVE_COSF 1 /* Define to 1 if you have the `coshf' function. */ #define _GLIBCXX_HAVE_COSHF 1 /* Define to 1 if you have the `coshl' function. */ #define _GLIBCXX_HAVE_COSHL 1 /* Define to 1 if you have the `cosl' function. */ #define _GLIBCXX_HAVE_COSL 1 /* Define to 1 if you have the <dlfcn.h> header file. */ #define _GLIBCXX_HAVE_DLFCN_H 1 /* Define if EBADMSG exists. */ #define _GLIBCXX_HAVE_EBADMSG 1 /* Define if ECANCELED exists. */ #define _GLIBCXX_HAVE_ECANCELED 1 /* Define if ECHILD exists. */ #define _GLIBCXX_HAVE_ECHILD 1 /* Define if EIDRM exists. */ #define _GLIBCXX_HAVE_EIDRM 1 /* Define to 1 if you have the <endian.h> header file. */ #define _GLIBCXX_HAVE_ENDIAN_H 1 /* Define if ENODATA exists. */ #define _GLIBCXX_HAVE_ENODATA 1 /* Define if ENOLINK exists. */ #define _GLIBCXX_HAVE_ENOLINK 1 /* Define if ENOSPC exists. */ #define _GLIBCXX_HAVE_ENOSPC 1 /* Define if ENOSR exists. */ #define _GLIBCXX_HAVE_ENOSR 1 /* Define if ENOSTR exists. */ #define _GLIBCXX_HAVE_ENOSTR 1 /* Define if ENOTRECOVERABLE exists. */ #define _GLIBCXX_HAVE_ENOTRECOVERABLE 1 /* Define if ENOTSUP exists. */ #define _GLIBCXX_HAVE_ENOTSUP 1 /* Define if EOVERFLOW exists. */ #define _GLIBCXX_HAVE_EOVERFLOW 1 /* Define if EOWNERDEAD exists. */ #define _GLIBCXX_HAVE_EOWNERDEAD 1 /* Define if EPERM exists. */ #define _GLIBCXX_HAVE_EPERM 1 /* Define if EPROTO exists. */ #define _GLIBCXX_HAVE_EPROTO 1 /* Define if ETIME exists. */ #define _GLIBCXX_HAVE_ETIME 1 /* Define if ETIMEDOUT exists. */ #define _GLIBCXX_HAVE_ETIMEDOUT 1 /* Define if ETXTBSY exists. */ #define _GLIBCXX_HAVE_ETXTBSY 1 /* Define if EWOULDBLOCK exists. */ #define _GLIBCXX_HAVE_EWOULDBLOCK 1 /* Define to 1 if you have the <execinfo.h> header file. */ #define _GLIBCXX_HAVE_EXECINFO_H 1 /* Define to 1 if you have the `expf' function. */ #define _GLIBCXX_HAVE_EXPF 1 /* Define to 1 if you have the `expl' function. */ #define _GLIBCXX_HAVE_EXPL 1 /* Define to 1 if you have the `fabsf' function. */ #define _GLIBCXX_HAVE_FABSF 1 /* Define to 1 if you have the `fabsl' function. */ #define _GLIBCXX_HAVE_FABSL 1 /* Define to 1 if you have the <fenv.h> header file. */ #define _GLIBCXX_HAVE_FENV_H 1 /* Define to 1 if you have the `finite' function. */ #define _GLIBCXX_HAVE_FINITE 1 /* Define to 1 if you have the `finitef' function. */ #define _GLIBCXX_HAVE_FINITEF 1 /* Define to 1 if you have the `finitel' function. */ #define _GLIBCXX_HAVE_FINITEL 1 /* Define to 1 if you have the <float.h> header file. */ #define _GLIBCXX_HAVE_FLOAT_H 1 /* Define to 1 if you have the `floorf' function. */ #define _GLIBCXX_HAVE_FLOORF 1 /* Define to 1 if you have the `floorl' function. */ #define _GLIBCXX_HAVE_FLOORL 1 /* Define to 1 if you have the `fmodf' function. */ #define _GLIBCXX_HAVE_FMODF 1 /* Define to 1 if you have the `fmodl' function. */ #define _GLIBCXX_HAVE_FMODL 1 /* Define to 1 if you have the `fpclass' function. */ /* #undef _GLIBCXX_HAVE_FPCLASS */ /* Define to 1 if you have the <fp.h> header file. */ /* #undef _GLIBCXX_HAVE_FP_H */ /* Define to 1 if you have the `frexpf' function. */ #define _GLIBCXX_HAVE_FREXPF 1 /* Define to 1 if you have the `frexpl' function. */ #define _GLIBCXX_HAVE_FREXPL 1 /* Define if _Unwind_GetIPInfo is available. */ #define _GLIBCXX_HAVE_GETIPINFO 1 /* Define if gets is available in <stdio.h>. */ #define _GLIBCXX_HAVE_GETS 1 /* Define to 1 if you have the `hypot' function. */ #define _GLIBCXX_HAVE_HYPOT 1 /* Define to 1 if you have the `hypotf' function. */ #define _GLIBCXX_HAVE_HYPOTF 1 /* Define to 1 if you have the `hypotl' function. */ #define _GLIBCXX_HAVE_HYPOTL 1 /* Define if you have the iconv() function. */ #define _GLIBCXX_HAVE_ICONV 1 /* Define to 1 if you have the <ieeefp.h> header file. */ /* #undef _GLIBCXX_HAVE_IEEEFP_H */ /* Define if int64_t is available in <stdint.h>. */ #define _GLIBCXX_HAVE_INT64_T 1 /* Define if int64_t is a long. */ #define _GLIBCXX_HAVE_INT64_T_LONG 1 /* Define if int64_t is a long long. */ /* #undef _GLIBCXX_HAVE_INT64_T_LONG_LONG */ /* Define to 1 if you have the <inttypes.h> header file. */ #define _GLIBCXX_HAVE_INTTYPES_H 1 /* Define to 1 if you have the `isinf' function. */ #define _GLIBCXX_HAVE_ISINF 1 /* Define to 1 if you have the `isinff' function. */ #define _GLIBCXX_HAVE_ISINFF 1 /* Define to 1 if you have the `isinfl' function. */ #define _GLIBCXX_HAVE_ISINFL 1 /* Define to 1 if you have the `isnan' function. */ #define _GLIBCXX_HAVE_ISNAN 1 /* Define to 1 if you have the `isnanf' function. */ #define _GLIBCXX_HAVE_ISNANF 1 /* Define to 1 if you have the `isnanl' function. */ #define _GLIBCXX_HAVE_ISNANL 1 /* Defined if iswblank exists. */ #define _GLIBCXX_HAVE_ISWBLANK 1 /* Define if LC_MESSAGES is available in <locale.h>. */ #define _GLIBCXX_HAVE_LC_MESSAGES 1 /* Define to 1 if you have the `ldexpf' function. */ #define _GLIBCXX_HAVE_LDEXPF 1 /* Define to 1 if you have the `ldexpl' function. */ #define _GLIBCXX_HAVE_LDEXPL 1 /* Define to 1 if you have the <libintl.h> header file. */ #define _GLIBCXX_HAVE_LIBINTL_H 1 /* Only used in build directory testsuite_hooks.h. */ #define _GLIBCXX_HAVE_LIMIT_AS 1 /* Only used in build directory testsuite_hooks.h. */ #define _GLIBCXX_HAVE_LIMIT_DATA 1 /* Only used in build directory testsuite_hooks.h. */ #define _GLIBCXX_HAVE_LIMIT_FSIZE 1 /* Only used in build directory testsuite_hooks.h. */ #define _GLIBCXX_HAVE_LIMIT_RSS 1 /* Only used in build directory testsuite_hooks.h. */ #define _GLIBCXX_HAVE_LIMIT_VMEM 0 /* Define if futex syscall is available. */ #define _GLIBCXX_HAVE_LINUX_FUTEX 1 /* Define to 1 if you have the <locale.h> header file. */ #define _GLIBCXX_HAVE_LOCALE_H 1 /* Define to 1 if you have the `log10f' function. */ #define _GLIBCXX_HAVE_LOG10F 1 /* Define to 1 if you have the `log10l' function. */ #define _GLIBCXX_HAVE_LOG10L 1 /* Define to 1 if you have the `logf' function. */ #define _GLIBCXX_HAVE_LOGF 1 /* Define to 1 if you have the `logl' function. */ #define _GLIBCXX_HAVE_LOGL 1 /* Define to 1 if you have the <machine/endian.h> header file. */ /* #undef _GLIBCXX_HAVE_MACHINE_ENDIAN_H */ /* Define to 1 if you have the <machine/param.h> header file. */ /* #undef _GLIBCXX_HAVE_MACHINE_PARAM_H */ /* Define if mbstate_t exists in wchar.h. */ #define _GLIBCXX_HAVE_MBSTATE_T 1 /* Define to 1 if you have the <memory.h> header file. */ #define _GLIBCXX_HAVE_MEMORY_H 1 /* Define to 1 if you have the `modf' function. */ #define _GLIBCXX_HAVE_MODF 1 /* Define to 1 if you have the `modff' function. */ #define _GLIBCXX_HAVE_MODFF 1 /* Define to 1 if you have the `modfl' function. */ #define _GLIBCXX_HAVE_MODFL 1 /* Define to 1 if you have the <nan.h> header file. */ /* #undef _GLIBCXX_HAVE_NAN_H */ /* Define if poll is available in <poll.h>. */ #define _GLIBCXX_HAVE_POLL 1 /* Define to 1 if you have the `powf' function. */ #define _GLIBCXX_HAVE_POWF 1 /* Define to 1 if you have the `powl' function. */ #define _GLIBCXX_HAVE_POWL 1 /* Define to 1 if you have the `qfpclass' function. */ /* #undef _GLIBCXX_HAVE_QFPCLASS */ /* Define to 1 if you have the `quick_exit' function. */ #define _GLIBCXX_HAVE_QUICK_EXIT 1 /* Define to 1 if you have the `setenv' function. */ #define _GLIBCXX_HAVE_SETENV 1 /* Define to 1 if you have the `sincos' function. */ #define _GLIBCXX_HAVE_SINCOS 1 /* Define to 1 if you have the `sincosf' function. */ #define _GLIBCXX_HAVE_SINCOSF 1 /* Define to 1 if you have the `sincosl' function. */ #define _GLIBCXX_HAVE_SINCOSL 1 /* Define to 1 if you have the `sinf' function. */ #define _GLIBCXX_HAVE_SINF 1 /* Define to 1 if you have the `sinhf' function. */ #define _GLIBCXX_HAVE_SINHF 1 /* Define to 1 if you have the `sinhl' function. */ #define _GLIBCXX_HAVE_SINHL 1 /* Define to 1 if you have the `sinl' function. */ #define _GLIBCXX_HAVE_SINL 1 /* Defined if sleep exists. */ #define _GLIBCXX_HAVE_SLEEP 1 /* Define to 1 if you have the `sqrtf' function. */ #define _GLIBCXX_HAVE_SQRTF 1 /* Define to 1 if you have the `sqrtl' function. */ #define _GLIBCXX_HAVE_SQRTL 1 /* Define to 1 if you have the <stdalign.h> header file. */ #define _GLIBCXX_HAVE_STDALIGN_H 1 /* Define to 1 if you have the <stdbool.h> header file. */ #define _GLIBCXX_HAVE_STDBOOL_H 1 /* Define to 1 if you have the <stdint.h> header file. */ #define _GLIBCXX_HAVE_STDINT_H 1 /* Define to 1 if you have the <stdlib.h> header file. */ #define _GLIBCXX_HAVE_STDLIB_H 1 /* Define if strerror_l is available in <string.h>. */ #define _GLIBCXX_HAVE_STRERROR_L 1 /* Define if strerror_r is available in <string.h>. */ #define _GLIBCXX_HAVE_STRERROR_R 1 /* Define to 1 if you have the <strings.h> header file. */ #define _GLIBCXX_HAVE_STRINGS_H 1 /* Define to 1 if you have the <string.h> header file. */ #define _GLIBCXX_HAVE_STRING_H 1 /* Define to 1 if you have the `strtof' function. */ #define _GLIBCXX_HAVE_STRTOF 1 /* Define to 1 if you have the `strtold' function. */ #define _GLIBCXX_HAVE_STRTOLD 1 /* Define if strxfrm_l is available in <string.h>. */ #define _GLIBCXX_HAVE_STRXFRM_L 1 /* Define to 1 if the target runtime linker supports binding the same symbol to different versions. */ #define _GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT 1 /* Define to 1 if you have the <sys/filio.h> header file. */ /* #undef _GLIBCXX_HAVE_SYS_FILIO_H */ /* Define to 1 if you have the <sys/ioctl.h> header file. */ #define _GLIBCXX_HAVE_SYS_IOCTL_H 1 /* Define to 1 if you have the <sys/ipc.h> header file. */ #define _GLIBCXX_HAVE_SYS_IPC_H 1 /* Define to 1 if you have the <sys/isa_defs.h> header file. */ /* #undef _GLIBCXX_HAVE_SYS_ISA_DEFS_H */ /* Define to 1 if you have the <sys/machine.h> header file. */ /* #undef _GLIBCXX_HAVE_SYS_MACHINE_H */ /* Define to 1 if you have the <sys/param.h> header file. */ #define _GLIBCXX_HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the <sys/resource.h> header file. */ #define _GLIBCXX_HAVE_SYS_RESOURCE_H 1 /* Define to 1 if you have a suitable <sys/sdt.h> header file */ #define _GLIBCXX_HAVE_SYS_SDT_H 1 /* Define to 1 if you have the <sys/sem.h> header file. */ #define _GLIBCXX_HAVE_SYS_SEM_H 1 /* Define to 1 if you have the <sys/stat.h> header file. */ #define _GLIBCXX_HAVE_SYS_STAT_H 1 /* Define to 1 if you have the <sys/sysinfo.h> header file. */ #define _GLIBCXX_HAVE_SYS_SYSINFO_H 1 /* Define to 1 if you have the <sys/time.h> header file. */ #define _GLIBCXX_HAVE_SYS_TIME_H 1 /* Define to 1 if you have the <sys/types.h> header file. */ #define _GLIBCXX_HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <sys/uio.h> header file. */ #define _GLIBCXX_HAVE_SYS_UIO_H 1 /* Define if S_IFREG is available in <sys/stat.h>. */ /* #undef _GLIBCXX_HAVE_S_IFREG */ /* Define if S_IFREG is available in <sys/stat.h>. */ #define _GLIBCXX_HAVE_S_ISREG 1 /* Define to 1 if you have the `tanf' function. */ #define _GLIBCXX_HAVE_TANF 1 /* Define to 1 if you have the `tanhf' function. */ #define _GLIBCXX_HAVE_TANHF 1 /* Define to 1 if you have the `tanhl' function. */ #define _GLIBCXX_HAVE_TANHL 1 /* Define to 1 if you have the `tanl' function. */ #define _GLIBCXX_HAVE_TANL 1 /* Define to 1 if you have the <tgmath.h> header file. */ #define _GLIBCXX_HAVE_TGMATH_H 1 /* Define to 1 if the target supports thread-local storage. */ #define _GLIBCXX_HAVE_TLS 1 /* Define to 1 if you have the <unistd.h> header file. */ #define _GLIBCXX_HAVE_UNISTD_H 1 /* Defined if usleep exists. */ #define _GLIBCXX_HAVE_USLEEP 1 /* Defined if vfwscanf exists. */ #define _GLIBCXX_HAVE_VFWSCANF 1 /* Defined if vswscanf exists. */ #define _GLIBCXX_HAVE_VSWSCANF 1 /* Defined if vwscanf exists. */ #define _GLIBCXX_HAVE_VWSCANF 1 /* Define to 1 if you have the <wchar.h> header file. */ #define _GLIBCXX_HAVE_WCHAR_H 1 /* Defined if wcstof exists. */ #define _GLIBCXX_HAVE_WCSTOF 1 /* Define to 1 if you have the <wctype.h> header file. */ #define _GLIBCXX_HAVE_WCTYPE_H 1 /* Defined if Sleep exists. */ /* #undef _GLIBCXX_HAVE_WIN32_SLEEP */ /* Define if writev is available in <sys/uio.h>. */ #define _GLIBCXX_HAVE_WRITEV 1 /* Define to 1 if you have the `_acosf' function. */ /* #undef _GLIBCXX_HAVE__ACOSF */ /* Define to 1 if you have the `_acosl' function. */ /* #undef _GLIBCXX_HAVE__ACOSL */ /* Define to 1 if you have the `_asinf' function. */ /* #undef _GLIBCXX_HAVE__ASINF */ /* Define to 1 if you have the `_asinl' function. */ /* #undef _GLIBCXX_HAVE__ASINL */ /* Define to 1 if you have the `_atan2f' function. */ /* #undef _GLIBCXX_HAVE__ATAN2F */ /* Define to 1 if you have the `_atan2l' function. */ /* #undef _GLIBCXX_HAVE__ATAN2L */ /* Define to 1 if you have the `_atanf' function. */ /* #undef _GLIBCXX_HAVE__ATANF */ /* Define to 1 if you have the `_atanl' function. */ /* #undef _GLIBCXX_HAVE__ATANL */ /* Define to 1 if you have the `_ceilf' function. */ /* #undef _GLIBCXX_HAVE__CEILF */ /* Define to 1 if you have the `_ceill' function. */ /* #undef _GLIBCXX_HAVE__CEILL */ /* Define to 1 if you have the `_cosf' function. */ /* #undef _GLIBCXX_HAVE__COSF */ /* Define to 1 if you have the `_coshf' function. */ /* #undef _GLIBCXX_HAVE__COSHF */ /* Define to 1 if you have the `_coshl' function. */ /* #undef _GLIBCXX_HAVE__COSHL */ /* Define to 1 if you have the `_cosl' function. */ /* #undef _GLIBCXX_HAVE__COSL */ /* Define to 1 if you have the `_expf' function. */ /* #undef _GLIBCXX_HAVE__EXPF */ /* Define to 1 if you have the `_expl' function. */ /* #undef _GLIBCXX_HAVE__EXPL */ /* Define to 1 if you have the `_fabsf' function. */ /* #undef _GLIBCXX_HAVE__FABSF */ /* Define to 1 if you have the `_fabsl' function. */ /* #undef _GLIBCXX_HAVE__FABSL */ /* Define to 1 if you have the `_finite' function. */ /* #undef _GLIBCXX_HAVE__FINITE */ /* Define to 1 if you have the `_finitef' function. */ /* #undef _GLIBCXX_HAVE__FINITEF */ /* Define to 1 if you have the `_finitel' function. */ /* #undef _GLIBCXX_HAVE__FINITEL */ /* Define to 1 if you have the `_floorf' function. */ /* #undef _GLIBCXX_HAVE__FLOORF */ /* Define to 1 if you have the `_floorl' function. */ /* #undef _GLIBCXX_HAVE__FLOORL */ /* Define to 1 if you have the `_fmodf' function. */ /* #undef _GLIBCXX_HAVE__FMODF */ /* Define to 1 if you have the `_fmodl' function. */ /* #undef _GLIBCXX_HAVE__FMODL */ /* Define to 1 if you have the `_fpclass' function. */ /* #undef _GLIBCXX_HAVE__FPCLASS */ /* Define to 1 if you have the `_frexpf' function. */ /* #undef _GLIBCXX_HAVE__FREXPF */ /* Define to 1 if you have the `_frexpl' function. */ /* #undef _GLIBCXX_HAVE__FREXPL */ /* Define to 1 if you have the `_hypot' function. */ /* #undef _GLIBCXX_HAVE__HYPOT */ /* Define to 1 if you have the `_hypotf' function. */ /* #undef _GLIBCXX_HAVE__HYPOTF */ /* Define to 1 if you have the `_hypotl' function. */ /* #undef _GLIBCXX_HAVE__HYPOTL */ /* Define to 1 if you have the `_isinf' function. */ /* #undef _GLIBCXX_HAVE__ISINF */ /* Define to 1 if you have the `_isinff' function. */ /* #undef _GLIBCXX_HAVE__ISINFF */ /* Define to 1 if you have the `_isinfl' function. */ /* #undef _GLIBCXX_HAVE__ISINFL */ /* Define to 1 if you have the `_isnan' function. */ /* #undef _GLIBCXX_HAVE__ISNAN */ /* Define to 1 if you have the `_isnanf' function. */ /* #undef _GLIBCXX_HAVE__ISNANF */ /* Define to 1 if you have the `_isnanl' function. */ /* #undef _GLIBCXX_HAVE__ISNANL */ /* Define to 1 if you have the `_ldexpf' function. */ /* #undef _GLIBCXX_HAVE__LDEXPF */ /* Define to 1 if you have the `_ldexpl' function. */ /* #undef _GLIBCXX_HAVE__LDEXPL */ /* Define to 1 if you have the `_log10f' function. */ /* #undef _GLIBCXX_HAVE__LOG10F */ /* Define to 1 if you have the `_log10l' function. */ /* #undef _GLIBCXX_HAVE__LOG10L */ /* Define to 1 if you have the `_logf' function. */ /* #undef _GLIBCXX_HAVE__LOGF */ /* Define to 1 if you have the `_logl' function. */ /* #undef _GLIBCXX_HAVE__LOGL */ /* Define to 1 if you have the `_modf' function. */ /* #undef _GLIBCXX_HAVE__MODF */ /* Define to 1 if you have the `_modff' function. */ /* #undef _GLIBCXX_HAVE__MODFF */ /* Define to 1 if you have the `_modfl' function. */ /* #undef _GLIBCXX_HAVE__MODFL */ /* Define to 1 if you have the `_powf' function. */ /* #undef _GLIBCXX_HAVE__POWF */ /* Define to 1 if you have the `_powl' function. */ /* #undef _GLIBCXX_HAVE__POWL */ /* Define to 1 if you have the `_qfpclass' function. */ /* #undef _GLIBCXX_HAVE__QFPCLASS */ /* Define to 1 if you have the `_sincos' function. */ /* #undef _GLIBCXX_HAVE__SINCOS */ /* Define to 1 if you have the `_sincosf' function. */ /* #undef _GLIBCXX_HAVE__SINCOSF */ /* Define to 1 if you have the `_sincosl' function. */ /* #undef _GLIBCXX_HAVE__SINCOSL */ /* Define to 1 if you have the `_sinf' function. */ /* #undef _GLIBCXX_HAVE__SINF */ /* Define to 1 if you have the `_sinhf' function. */ /* #undef _GLIBCXX_HAVE__SINHF */ /* Define to 1 if you have the `_sinhl' function. */ /* #undef _GLIBCXX_HAVE__SINHL */ /* Define to 1 if you have the `_sinl' function. */ /* #undef _GLIBCXX_HAVE__SINL */ /* Define to 1 if you have the `_sqrtf' function. */ /* #undef _GLIBCXX_HAVE__SQRTF */ /* Define to 1 if you have the `_sqrtl' function. */ /* #undef _GLIBCXX_HAVE__SQRTL */ /* Define to 1 if you have the `_tanf' function. */ /* #undef _GLIBCXX_HAVE__TANF */ /* Define to 1 if you have the `_tanhf' function. */ /* #undef _GLIBCXX_HAVE__TANHF */ /* Define to 1 if you have the `_tanhl' function. */ /* #undef _GLIBCXX_HAVE__TANHL */ /* Define to 1 if you have the `_tanl' function. */ /* #undef _GLIBCXX_HAVE__TANL */ /* Define to 1 if you have the `__cxa_thread_atexit_impl' function. */ /* #undef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */ /* Define as const if the declaration of iconv() needs const. */ #define _GLIBCXX_ICONV_CONST /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" /* Name of package */ /* #undef _GLIBCXX_PACKAGE */ /* Define to the address where bug reports for this package should be sent. */ #define _GLIBCXX_PACKAGE_BUGREPORT "" /* Define to the full name of this package. */ #define _GLIBCXX_PACKAGE_NAME "package-unused" /* Define to the full name and version of this package. */ #define _GLIBCXX_PACKAGE_STRING "package-unused version-unused" /* Define to the one symbol short name of this package. */ #define _GLIBCXX_PACKAGE_TARNAME "libstdc++" /* Define to the home page for this package. */ #define _GLIBCXX_PACKAGE_URL "" /* Define to the version of this package. */ #define _GLIBCXX_PACKAGE__GLIBCXX_VERSION "version-unused" /* The size of `char', as computed by sizeof. */ /* #undef SIZEOF_CHAR */ /* The size of `int', as computed by sizeof. */ /* #undef SIZEOF_INT */ /* The size of `long', as computed by sizeof. */ /* #undef SIZEOF_LONG */ /* The size of `short', as computed by sizeof. */ /* #undef SIZEOF_SHORT */ /* The size of `void *', as computed by sizeof. */ /* #undef SIZEOF_VOID_P */ /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Version number of package */ /* #undef _GLIBCXX_VERSION */ /* Define if the compiler supports C++11 atomics. */ #define _GLIBCXX_ATOMIC_BUILTINS 1 /* Define to use concept checking code from the boost libraries. */ /* #undef _GLIBCXX_CONCEPT_CHECKS */ /* Define to 1 if a fully dynamic basic_string is wanted, 0 to disable, undefined for platform defaults */ #define _GLIBCXX_FULLY_DYNAMIC_STRING 0 /* Define if gthreads library is available. */ #define _GLIBCXX_HAS_GTHREADS 1 /* Define to 1 if a full hosted library is built, or 0 if freestanding. */ #define _GLIBCXX_HOSTED 1 /* Define if compatibility should be provided for -mlong-double-64. */ /* Define if ptrdiff_t is int. */ /* #undef _GLIBCXX_PTRDIFF_T_IS_INT */ /* Define if using setrlimit to set resource limits during "make check" */ #define _GLIBCXX_RES_LIMITS 1 /* Define if size_t is unsigned int. */ /* #undef _GLIBCXX_SIZE_T_IS_UINT */ /* Define if the compiler is configured for setjmp/longjmp exceptions. */ /* #undef _GLIBCXX_SJLJ_EXCEPTIONS */ /* Define to the value of the EOF integer constant. */ #define _GLIBCXX_STDIO_EOF -1 /* Define to the value of the SEEK_CUR integer constant. */ #define _GLIBCXX_STDIO_SEEK_CUR 1 /* Define to the value of the SEEK_END integer constant. */ #define _GLIBCXX_STDIO_SEEK_END 2 /* Define to use symbol versioning in the shared library. */ #define _GLIBCXX_SYMVER 1 /* Define to use darwin versioning in the shared library. */ /* #undef _GLIBCXX_SYMVER_DARWIN */ /* Define to use GNU versioning in the shared library. */ #define _GLIBCXX_SYMVER_GNU 1 /* Define to use GNU namespace versioning in the shared library. */ /* #undef _GLIBCXX_SYMVER_GNU_NAMESPACE */ /* Define to use Sun versioning in the shared library. */ /* #undef _GLIBCXX_SYMVER_SUN */ /* Define if C99 functions or macros from <wchar.h>, <math.h>, <complex.h>, <stdio.h>, and <stdlib.h> can be used or exposed. */ #define _GLIBCXX_USE_C99 1 /* Define if C99 functions in <complex.h> should be used in <complex>. Using compiler builtins for these functions requires corresponding C99 library functions to be present. */ #define _GLIBCXX_USE_C99_COMPLEX 1 /* Define if C99 functions in <complex.h> should be used in <tr1/complex>. Using compiler builtins for these functions requires corresponding C99 library functions to be present. */ #define _GLIBCXX_USE_C99_COMPLEX_TR1 1 /* Define if C99 functions in <ctype.h> should be imported in <tr1/cctype> in namespace std::tr1. */ #define _GLIBCXX_USE_C99_CTYPE_TR1 1 /* Define if C99 functions in <fenv.h> should be imported in <tr1/cfenv> in namespace std::tr1. */ #define _GLIBCXX_USE_C99_FENV_TR1 1 /* Define if C99 functions in <inttypes.h> should be imported in <tr1/cinttypes> in namespace std::tr1. */ #define _GLIBCXX_USE_C99_INTTYPES_TR1 1 /* Define if wchar_t C99 functions in <inttypes.h> should be imported in <tr1/cinttypes> in namespace std::tr1. */ #define _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 1 /* Define if C99 functions or macros in <math.h> should be imported in <cmath> in namespace std. */ #define _GLIBCXX_USE_C99_MATH 1 /* Define if C99 functions or macros in <math.h> should be imported in <tr1/cmath> in namespace std::tr1. */ #define _GLIBCXX_USE_C99_MATH_TR1 1 /* Define if C99 types in <stdint.h> should be imported in <tr1/cstdint> in namespace std::tr1. */ #define _GLIBCXX_USE_C99_STDINT_TR1 1 /* Defined if clock_gettime has monotonic clock support. */ #define _GLIBCXX_USE_CLOCK_MONOTONIC 1 /* Defined if clock_gettime syscall has monotonic and realtime clock support. */ #define _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL 1 /* Defined if clock_gettime has realtime clock support. */ #define _GLIBCXX_USE_CLOCK_REALTIME 1 /* Define if ISO/IEC TR 24733 decimal floating point types are supported on this host. */ #define _GLIBCXX_USE_DECIMAL_FLOAT 1 /* Define if __float128 is supported on this host. */ #define _GLIBCXX_USE_FLOAT128 1 /* Defined if gettimeofday is available. */ #define _GLIBCXX_USE_GETTIMEOFDAY 1 /* Define if get_nprocs is available in <sys/sysinfo.h>. */ #define _GLIBCXX_USE_GET_NPROCS 1 /* Define if __int128 is supported on this host. */ #define _GLIBCXX_USE_INT128 1 /* Define if LFS support is available. */ #define _GLIBCXX_USE_LFS 1 /* Define if code specialized for long long should be used. */ #define _GLIBCXX_USE_LONG_LONG 1 /* Defined if nanosleep is available. */ /* #undef _GLIBCXX_USE_NANOSLEEP */ /* Define if NLS translations are to be used. */ #define _GLIBCXX_USE_NLS 1 /* Define if pthreads_num_processors_np is available in <pthread.h>. */ /* #undef _GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP */ /* Define if /dev/random and /dev/urandom are available for the random_device of TR1 (Chapter 5.1). */ #define _GLIBCXX_USE_RANDOM_TR1 1 /* Defined if sched_yield is available. */ /* #undef _GLIBCXX_USE_SCHED_YIELD */ /* Define if _SC_NPROCESSORS_ONLN is available in <unistd.h>. */ #define _GLIBCXX_USE_SC_NPROCESSORS_ONLN 1 /* Define if _SC_NPROC_ONLN is available in <unistd.h>. */ /* #undef _GLIBCXX_USE_SC_NPROC_ONLN */ /* Define if sysctl(), CTL_HW and HW_NCPU are available in <sys/sysctl.h>. */ /* #undef _GLIBCXX_USE_SYSCTL_HW_NCPU */ /* Define if code specialized for wchar_t should be used. */ #define _GLIBCXX_USE_WCHAR_T 1 /* Define to 1 if a verbose library is built, or 0 otherwise. */ #define _GLIBCXX_VERBOSE 1 /* Defined if as can handle rdrand. */ #define _GLIBCXX_X86_RDRAND 1 /* Define to 1 if mutex_timedlock is available. */ #define _GTHREAD_USE_MUTEX_TIMEDLOCK 1 #if defined (_GLIBCXX_HAVE__ACOSF) && ! defined (_GLIBCXX_HAVE_ACOSF) # define _GLIBCXX_HAVE_ACOSF 1 # define acosf _acosf #endif #if defined (_GLIBCXX_HAVE__ACOSL) && ! defined (_GLIBCXX_HAVE_ACOSL) # define _GLIBCXX_HAVE_ACOSL 1 # define acosl _acosl #endif #if defined (_GLIBCXX_HAVE__ASINF) && ! defined (_GLIBCXX_HAVE_ASINF) # define _GLIBCXX_HAVE_ASINF 1 # define asinf _asinf #endif #if defined (_GLIBCXX_HAVE__ASINL) && ! defined (_GLIBCXX_HAVE_ASINL) # define _GLIBCXX_HAVE_ASINL 1 # define asinl _asinl #endif #if defined (_GLIBCXX_HAVE__ATAN2F) && ! defined (_GLIBCXX_HAVE_ATAN2F) # define _GLIBCXX_HAVE_ATAN2F 1 # define atan2f _atan2f #endif #if defined (_GLIBCXX_HAVE__ATAN2L) && ! defined (_GLIBCXX_HAVE_ATAN2L) # define _GLIBCXX_HAVE_ATAN2L 1 # define atan2l _atan2l #endif #if defined (_GLIBCXX_HAVE__ATANF) && ! defined (_GLIBCXX_HAVE_ATANF) # define _GLIBCXX_HAVE_ATANF 1 # define atanf _atanf #endif #if defined (_GLIBCXX_HAVE__ATANL) && ! defined (_GLIBCXX_HAVE_ATANL) # define _GLIBCXX_HAVE_ATANL 1 # define atanl _atanl #endif #if defined (_GLIBCXX_HAVE__CEILF) && ! defined (_GLIBCXX_HAVE_CEILF) # define _GLIBCXX_HAVE_CEILF 1 # define ceilf _ceilf #endif #if defined (_GLIBCXX_HAVE__CEILL) && ! defined (_GLIBCXX_HAVE_CEILL) # define _GLIBCXX_HAVE_CEILL 1 # define ceill _ceill #endif #if defined (_GLIBCXX_HAVE__COSF) && ! defined (_GLIBCXX_HAVE_COSF) # define _GLIBCXX_HAVE_COSF 1 # define cosf _cosf #endif #if defined (_GLIBCXX_HAVE__COSHF) && ! defined (_GLIBCXX_HAVE_COSHF) # define _GLIBCXX_HAVE_COSHF 1 # define coshf _coshf #endif #if defined (_GLIBCXX_HAVE__COSHL) && ! defined (_GLIBCXX_HAVE_COSHL) # define _GLIBCXX_HAVE_COSHL 1 # define coshl _coshl #endif #if defined (_GLIBCXX_HAVE__COSL) && ! defined (_GLIBCXX_HAVE_COSL) # define _GLIBCXX_HAVE_COSL 1 # define cosl _cosl #endif #if defined (_GLIBCXX_HAVE__EXPF) && ! defined (_GLIBCXX_HAVE_EXPF) # define _GLIBCXX_HAVE_EXPF 1 # define expf _expf #endif #if defined (_GLIBCXX_HAVE__EXPL) && ! defined (_GLIBCXX_HAVE_EXPL) # define _GLIBCXX_HAVE_EXPL 1 # define expl _expl #endif #if defined (_GLIBCXX_HAVE__FABSF) && ! defined (_GLIBCXX_HAVE_FABSF) # define _GLIBCXX_HAVE_FABSF 1 # define fabsf _fabsf #endif #if defined (_GLIBCXX_HAVE__FABSL) && ! defined (_GLIBCXX_HAVE_FABSL) # define _GLIBCXX_HAVE_FABSL 1 # define fabsl _fabsl #endif #if defined (_GLIBCXX_HAVE__FINITE) && ! defined (_GLIBCXX_HAVE_FINITE) # define _GLIBCXX_HAVE_FINITE 1 # define finite _finite #endif #if defined (_GLIBCXX_HAVE__FINITEF) && ! defined (_GLIBCXX_HAVE_FINITEF) # define _GLIBCXX_HAVE_FINITEF 1 # define finitef _finitef #endif #if defined (_GLIBCXX_HAVE__FINITEL) && ! defined (_GLIBCXX_HAVE_FINITEL) # define _GLIBCXX_HAVE_FINITEL 1 # define finitel _finitel #endif #if defined (_GLIBCXX_HAVE__FLOORF) && ! defined (_GLIBCXX_HAVE_FLOORF) # define _GLIBCXX_HAVE_FLOORF 1 # define floorf _floorf #endif #if defined (_GLIBCXX_HAVE__FLOORL) && ! defined (_GLIBCXX_HAVE_FLOORL) # define _GLIBCXX_HAVE_FLOORL 1 # define floorl _floorl #endif #if defined (_GLIBCXX_HAVE__FMODF) && ! defined (_GLIBCXX_HAVE_FMODF) # define _GLIBCXX_HAVE_FMODF 1 # define fmodf _fmodf #endif #if defined (_GLIBCXX_HAVE__FMODL) && ! defined (_GLIBCXX_HAVE_FMODL) # define _GLIBCXX_HAVE_FMODL 1 # define fmodl _fmodl #endif #if defined (_GLIBCXX_HAVE__FPCLASS) && ! defined (_GLIBCXX_HAVE_FPCLASS) # define _GLIBCXX_HAVE_FPCLASS 1 # define fpclass _fpclass #endif #if defined (_GLIBCXX_HAVE__FREXPF) && ! defined (_GLIBCXX_HAVE_FREXPF) # define _GLIBCXX_HAVE_FREXPF 1 # define frexpf _frexpf #endif #if defined (_GLIBCXX_HAVE__FREXPL) && ! defined (_GLIBCXX_HAVE_FREXPL) # define _GLIBCXX_HAVE_FREXPL 1 # define frexpl _frexpl #endif #if defined (_GLIBCXX_HAVE__HYPOT) && ! defined (_GLIBCXX_HAVE_HYPOT) # define _GLIBCXX_HAVE_HYPOT 1 # define hypot _hypot #endif #if defined (_GLIBCXX_HAVE__HYPOTF) && ! defined (_GLIBCXX_HAVE_HYPOTF) # define _GLIBCXX_HAVE_HYPOTF 1 # define hypotf _hypotf #endif #if defined (_GLIBCXX_HAVE__HYPOTL) && ! defined (_GLIBCXX_HAVE_HYPOTL) # define _GLIBCXX_HAVE_HYPOTL 1 # define hypotl _hypotl #endif #if defined (_GLIBCXX_HAVE__ISINF) && ! defined (_GLIBCXX_HAVE_ISINF) # define _GLIBCXX_HAVE_ISINF 1 # define isinf _isinf #endif #if defined (_GLIBCXX_HAVE__ISINFF) && ! defined (_GLIBCXX_HAVE_ISINFF) # define _GLIBCXX_HAVE_ISINFF 1 # define isinff _isinff #endif #if defined (_GLIBCXX_HAVE__ISINFL) && ! defined (_GLIBCXX_HAVE_ISINFL) # define _GLIBCXX_HAVE_ISINFL 1 # define isinfl _isinfl #endif #if defined (_GLIBCXX_HAVE__ISNAN) && ! defined (_GLIBCXX_HAVE_ISNAN) # define _GLIBCXX_HAVE_ISNAN 1 # define isnan _isnan #endif #if defined (_GLIBCXX_HAVE__ISNANF) && ! defined (_GLIBCXX_HAVE_ISNANF) # define _GLIBCXX_HAVE_ISNANF 1 # define isnanf _isnanf #endif #if defined (_GLIBCXX_HAVE__ISNANL) && ! defined (_GLIBCXX_HAVE_ISNANL) # define _GLIBCXX_HAVE_ISNANL 1 # define isnanl _isnanl #endif #if defined (_GLIBCXX_HAVE__LDEXPF) && ! defined (_GLIBCXX_HAVE_LDEXPF) # define _GLIBCXX_HAVE_LDEXPF 1 # define ldexpf _ldexpf #endif #if defined (_GLIBCXX_HAVE__LDEXPL) && ! defined (_GLIBCXX_HAVE_LDEXPL) # define _GLIBCXX_HAVE_LDEXPL 1 # define ldexpl _ldexpl #endif #if defined (_GLIBCXX_HAVE__LOG10F) && ! defined (_GLIBCXX_HAVE_LOG10F) # define _GLIBCXX_HAVE_LOG10F 1 # define log10f _log10f #endif #if defined (_GLIBCXX_HAVE__LOG10L) && ! defined (_GLIBCXX_HAVE_LOG10L) # define _GLIBCXX_HAVE_LOG10L 1 # define log10l _log10l #endif #if defined (_GLIBCXX_HAVE__LOGF) && ! defined (_GLIBCXX_HAVE_LOGF) # define _GLIBCXX_HAVE_LOGF 1 # define logf _logf #endif #if defined (_GLIBCXX_HAVE__LOGL) && ! defined (_GLIBCXX_HAVE_LOGL) # define _GLIBCXX_HAVE_LOGL 1 # define logl _logl #endif #if defined (_GLIBCXX_HAVE__MODF) && ! defined (_GLIBCXX_HAVE_MODF) # define _GLIBCXX_HAVE_MODF 1 # define modf _modf #endif #if defined (_GLIBCXX_HAVE__MODFF) && ! defined (_GLIBCXX_HAVE_MODFF) # define _GLIBCXX_HAVE_MODFF 1 # define modff _modff #endif #if defined (_GLIBCXX_HAVE__MODFL) && ! defined (_GLIBCXX_HAVE_MODFL) # define _GLIBCXX_HAVE_MODFL 1 # define modfl _modfl #endif #if defined (_GLIBCXX_HAVE__POWF) && ! defined (_GLIBCXX_HAVE_POWF) # define _GLIBCXX_HAVE_POWF 1 # define powf _powf #endif #if defined (_GLIBCXX_HAVE__POWL) && ! defined (_GLIBCXX_HAVE_POWL) # define _GLIBCXX_HAVE_POWL 1 # define powl _powl #endif #if defined (_GLIBCXX_HAVE__QFPCLASS) && ! defined (_GLIBCXX_HAVE_QFPCLASS) # define _GLIBCXX_HAVE_QFPCLASS 1 # define qfpclass _qfpclass #endif #if defined (_GLIBCXX_HAVE__SINCOS) && ! defined (_GLIBCXX_HAVE_SINCOS) # define _GLIBCXX_HAVE_SINCOS 1 # define sincos _sincos #endif #if defined (_GLIBCXX_HAVE__SINCOSF) && ! defined (_GLIBCXX_HAVE_SINCOSF) # define _GLIBCXX_HAVE_SINCOSF 1 # define sincosf _sincosf #endif #if defined (_GLIBCXX_HAVE__SINCOSL) && ! defined (_GLIBCXX_HAVE_SINCOSL) # define _GLIBCXX_HAVE_SINCOSL 1 # define sincosl _sincosl #endif #if defined (_GLIBCXX_HAVE__SINF) && ! defined (_GLIBCXX_HAVE_SINF) # define _GLIBCXX_HAVE_SINF 1 # define sinf _sinf #endif #if defined (_GLIBCXX_HAVE__SINHF) && ! defined (_GLIBCXX_HAVE_SINHF) # define _GLIBCXX_HAVE_SINHF 1 # define sinhf _sinhf #endif #if defined (_GLIBCXX_HAVE__SINHL) && ! defined (_GLIBCXX_HAVE_SINHL) # define _GLIBCXX_HAVE_SINHL 1 # define sinhl _sinhl #endif #if defined (_GLIBCXX_HAVE__SINL) && ! defined (_GLIBCXX_HAVE_SINL) # define _GLIBCXX_HAVE_SINL 1 # define sinl _sinl #endif #if defined (_GLIBCXX_HAVE__SQRTF) && ! defined (_GLIBCXX_HAVE_SQRTF) # define _GLIBCXX_HAVE_SQRTF 1 # define sqrtf _sqrtf #endif #if defined (_GLIBCXX_HAVE__SQRTL) && ! defined (_GLIBCXX_HAVE_SQRTL) # define _GLIBCXX_HAVE_SQRTL 1 # define sqrtl _sqrtl #endif #if defined (_GLIBCXX_HAVE__STRTOF) && ! defined (_GLIBCXX_HAVE_STRTOF) # define _GLIBCXX_HAVE_STRTOF 1 # define strtof _strtof #endif #if defined (_GLIBCXX_HAVE__STRTOLD) && ! defined (_GLIBCXX_HAVE_STRTOLD) # define _GLIBCXX_HAVE_STRTOLD 1 # define strtold _strtold #endif #if defined (_GLIBCXX_HAVE__TANF) && ! defined (_GLIBCXX_HAVE_TANF) # define _GLIBCXX_HAVE_TANF 1 # define tanf _tanf #endif #if defined (_GLIBCXX_HAVE__TANHF) && ! defined (_GLIBCXX_HAVE_TANHF) # define _GLIBCXX_HAVE_TANHF 1 # define tanhf _tanhf #endif #if defined (_GLIBCXX_HAVE__TANHL) && ! defined (_GLIBCXX_HAVE_TANHL) # define _GLIBCXX_HAVE_TANHL 1 # define tanhl _tanhl #endif #if defined (_GLIBCXX_HAVE__TANL) && ! defined (_GLIBCXX_HAVE_TANL) # define _GLIBCXX_HAVE_TANL 1 # define tanl _tanl #endif #endif // _GLIBCXX_CXX_CONFIG_H #endif #endif �������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/c++locale.h������������������������������������������������������0000644�����������������00000006350�14763166027�0014007 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Wrapper for underlying C-language localization -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/c++locale.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{locale} */ // // ISO C++ 14882: 22.8 Standard locale categories. // // Written by Benjamin Kosnik <bkoz@redhat.com> #ifndef _GLIBCXX_CXX_LOCALE_H #define _GLIBCXX_CXX_LOCALE_H 1 #pragma GCC system_header #include <clocale> #define _GLIBCXX_C_LOCALE_GNU 1 #define _GLIBCXX_NUM_CATEGORIES 6 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION extern "C" __typeof(uselocale) __uselocale; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef __locale_t __c_locale; // Convert numeric value of type double and long double to string and // return length of string. If vsnprintf is available use it, otherwise // fall back to the unsafe vsprintf which, in general, can be dangerous // and should be avoided. inline int __convert_from_v(const __c_locale& __cloc __attribute__ ((__unused__)), char* __out, const int __size __attribute__ ((__unused__)), const char* __fmt, ...) { #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) __c_locale __old = __gnu_cxx::__uselocale(__cloc); #else char* __old = std::setlocale(LC_NUMERIC, 0); char* __sav = 0; if (__builtin_strcmp(__old, "C")) { const size_t __len = __builtin_strlen(__old) + 1; __sav = new char[__len]; __builtin_memcpy(__sav, __old, __len); std::setlocale(LC_NUMERIC, "C"); } #endif __builtin_va_list __args; __builtin_va_start(__args, __fmt); #ifdef _GLIBCXX_USE_C99 const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args); #else const int __ret = __builtin_vsprintf(__out, __fmt, __args); #endif __builtin_va_end(__args); #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) __gnu_cxx::__uselocale(__old); #else if (__sav) { std::setlocale(LC_NUMERIC, __sav); delete [] __sav; } #endif return __ret; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/atomic_word.h����������������������������������������������������0000644�����������������00000003604�14763166027�0014565 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Low-level type for atomic operations -*- C++ -*- // Copyright (C) 2004-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file atomic_word.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _GLIBCXX_ATOMIC_WORD_H #define _GLIBCXX_ATOMIC_WORD_H 1 typedef int _Atomic_word; // Define these two macros using the appropriate memory barrier for the target. // The commented out versions below are the defaults. // See ia64/atomic_word.h for an alternative approach. // This one prevents loads from being hoisted across the barrier; // in other words, this is a Load-Load acquire barrier. // This is necessary iff TARGET_RELAXED_ORDERING is defined in tm.h. // #define _GLIBCXX_READ_MEM_BARRIER __asm __volatile ("":::"memory") // This one prevents stores from being sunk across the barrier; in other // words, a Store-Store release barrier. // #define _GLIBCXX_WRITE_MEM_BARRIER __asm __volatile ("":::"memory") #endif ����������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/ctype_base.h�����������������������������������������������������0000644�����������������00000004302�14763166027�0014370 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Locale support -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/ctype_base.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{locale} */ // // ISO C++ 14882: 22.1 Locales // // Information as gleaned from /usr/include/ctype.h namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /// @brief Base class for ctype. struct ctype_base { // Non-standard typedefs. typedef const int* __to_type; // NB: Offsets into ctype<char>::_M_table force a particular size // on the mask type. Because of this, we don't use an enum. typedef unsigned short mask; static const mask upper = _ISupper; static const mask lower = _ISlower; static const mask alpha = _ISalpha; static const mask digit = _ISdigit; static const mask xdigit = _ISxdigit; static const mask space = _ISspace; static const mask print = _ISprint; static const mask graph = _ISalpha | _ISdigit | _ISpunct; static const mask cntrl = _IScntrl; static const mask punct = _ISpunct; static const mask alnum = _ISalpha | _ISdigit; }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/time_members.h���������������������������������������������������0000644�����������������00000005565�14763166027�0014736 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// std::time_get, std::time_put implementation, GNU version -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/time_members.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{locale} */ // // ISO C++ 14882: 22.2.5.1.2 - time_get functions // ISO C++ 14882: 22.2.5.3.2 - time_put functions // // Written by Benjamin Kosnik <bkoz@redhat.com> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _CharT> __timepunct<_CharT>::__timepunct(size_t __refs) : facet(__refs), _M_data(0), _M_c_locale_timepunct(0), _M_name_timepunct(_S_get_c_name()) { _M_initialize_timepunct(); } template<typename _CharT> __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(0), _M_name_timepunct(_S_get_c_name()) { _M_initialize_timepunct(); } template<typename _CharT> __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, size_t __refs) : facet(__refs), _M_data(0), _M_c_locale_timepunct(0), _M_name_timepunct(0) { if (__builtin_strcmp(__s, _S_get_c_name()) != 0) { const size_t __len = __builtin_strlen(__s) + 1; char* __tmp = new char[__len]; __builtin_memcpy(__tmp, __s, __len); _M_name_timepunct = __tmp; } else _M_name_timepunct = _S_get_c_name(); __try { _M_initialize_timepunct(__cloc); } __catch(...) { if (_M_name_timepunct != _S_get_c_name()) delete [] _M_name_timepunct; __throw_exception_again; } } template<typename _CharT> __timepunct<_CharT>::~__timepunct() { if (_M_name_timepunct != _S_get_c_name()) delete [] _M_name_timepunct; delete _M_data; _S_destroy_c_locale(_M_c_locale_timepunct); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace �������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/stdc++.h���������������������������������������������������������0000644�����������������00000005332�14763166027�0013341 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// C++ includes used for precompiling -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file stdc++.h * This is an implementation file for a precompiled header. */ // 17.4.1.2 Headers // C #ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #if __cplusplus >= 201103L #include <ccomplex> #include <cfenv> #include <cinttypes> #include <cstdalign> #include <cstdbool> #include <cstdint> #include <ctgmath> #include <cwchar> #include <cwctype> #endif // C++ #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #if __cplusplus >= 201103L #include <array> #include <atomic> #include <chrono> #include <condition_variable> #include <forward_list> #include <future> #include <initializer_list> #include <mutex> #include <random> #include <ratio> #include <regex> #include <scoped_allocator> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <type_traits> #include <unordered_map> #include <unordered_set> #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/gthr-posix.h�����������������������������������������������������0000644�����������������00000057255�14763166027�0014375 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Threads compatibility routines for libgcc2 and libobjc. */ /* Compile this one with gcc. */ /* Copyright (C) 1997-2013 Free Software Foundation, Inc. This file is part of GCC. GCC 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 3, or (at your option) any later version. GCC 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. Under Section 7 of GPL version 3, you are granted additional permissions described in the GCC Runtime Library Exception, version 3.1, as published by the Free Software Foundation. You should have received a copy of the GNU General Public License and a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GLIBCXX_GCC_GTHR_POSIX_H #define _GLIBCXX_GCC_GTHR_POSIX_H /* POSIX threads specific definitions. Easy, since the interface is just one-to-one mapping. */ #define __GTHREADS 1 #define __GTHREADS_CXX0X 1 #include <pthread.h> #if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \ || !defined(_GTHREAD_USE_MUTEX_TIMEDLOCK)) # include <unistd.h> # if defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0 # define _GTHREAD_USE_MUTEX_TIMEDLOCK 1 # else # define _GTHREAD_USE_MUTEX_TIMEDLOCK 0 # endif #endif typedef pthread_t __gthread_t; typedef pthread_key_t __gthread_key_t; typedef pthread_once_t __gthread_once_t; typedef pthread_mutex_t __gthread_mutex_t; typedef pthread_mutex_t __gthread_recursive_mutex_t; typedef pthread_cond_t __gthread_cond_t; typedef struct timespec __gthread_time_t; /* POSIX like conditional variables are supported. Please look at comments in gthr.h for details. */ #define __GTHREAD_HAS_COND 1 #define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER #define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function #define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT #if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER) #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER #elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP #else #define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function #endif #define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER #define __GTHREAD_TIME_INIT {0,0} #ifdef _GTHREAD_USE_MUTEX_INIT_FUNC # undef __GTHREAD_MUTEX_INIT #endif #ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC # undef __GTHREAD_RECURSIVE_MUTEX_INIT # undef __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION # define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function #endif #ifdef _GTHREAD_USE_COND_INIT_FUNC # undef __GTHREAD_COND_INIT # define __GTHREAD_COND_INIT_FUNCTION __gthread_cond_init_function #endif #if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK # ifndef __gthrw_pragma # define __gthrw_pragma(pragma) # endif # define __gthrw2(name,name2,type) \ static __typeof(type) name __attribute__ ((__weakref__(#name2))); \ __gthrw_pragma(weak type) # define __gthrw_(name) __gthrw_ ## name #else # define __gthrw2(name,name2,type) # define __gthrw_(name) name #endif /* Typically, __gthrw_foo is a weak reference to symbol foo. */ #define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name) __gthrw(pthread_once) __gthrw(pthread_getspecific) __gthrw(pthread_setspecific) __gthrw(pthread_create) __gthrw(pthread_join) __gthrw(pthread_equal) __gthrw(pthread_self) __gthrw(pthread_detach) #ifndef __BIONIC__ __gthrw(pthread_cancel) #endif __gthrw(sched_yield) __gthrw(pthread_mutex_lock) __gthrw(pthread_mutex_trylock) #if _GTHREAD_USE_MUTEX_TIMEDLOCK __gthrw(pthread_mutex_timedlock) #endif __gthrw(pthread_mutex_unlock) __gthrw(pthread_mutex_init) __gthrw(pthread_mutex_destroy) __gthrw(pthread_cond_init) __gthrw(pthread_cond_broadcast) __gthrw(pthread_cond_signal) __gthrw(pthread_cond_wait) __gthrw(pthread_cond_timedwait) __gthrw(pthread_cond_destroy) __gthrw(pthread_key_create) __gthrw(pthread_key_delete) __gthrw(pthread_mutexattr_init) __gthrw(pthread_mutexattr_settype) __gthrw(pthread_mutexattr_destroy) #if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK) /* Objective-C. */ __gthrw(pthread_exit) #ifdef _POSIX_PRIORITY_SCHEDULING #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING __gthrw(sched_get_priority_max) __gthrw(sched_get_priority_min) #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ #endif /* _POSIX_PRIORITY_SCHEDULING */ __gthrw(pthread_attr_destroy) __gthrw(pthread_attr_init) __gthrw(pthread_attr_setdetachstate) #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING __gthrw(pthread_getschedparam) __gthrw(pthread_setschedparam) #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ #endif /* _LIBOBJC || _LIBOBJC_WEAK */ #if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK /* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if -pthreads is not specified. The functions are dummies and most return an error value. However pthread_once returns 0 without invoking the routine it is passed so we cannot pretend that the interface is active if -pthreads is not specified. On Solaris 2.5.1, the interface is not exposed at all so we need to play the usual game with weak symbols. On Solaris 10 and up, a working interface is always exposed. On FreeBSD 6 and later, libc also exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc, which means the alternate __gthread_active_p below cannot be used there. */ #if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__)) static volatile int __gthread_active = -1; static void __gthread_trigger (void) { __gthread_active = 1; } static inline int __gthread_active_p (void) { static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT; /* Avoid reading __gthread_active twice on the main code path. */ int __gthread_active_latest_value = __gthread_active; /* This test is not protected to avoid taking a lock on the main code path so every update of __gthread_active in a threaded program must be atomic with regard to the result of the test. */ if (__builtin_expect (__gthread_active_latest_value < 0, 0)) { if (__gthrw_(pthread_once)) { /* If this really is a threaded program, then we must ensure that __gthread_active has been set to 1 before exiting this block. */ __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex); __gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger); __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex); } /* Make sure we'll never enter this block again. */ if (__gthread_active < 0) __gthread_active = 0; __gthread_active_latest_value = __gthread_active; } return __gthread_active_latest_value != 0; } #else /* neither FreeBSD nor Solaris */ /* For a program to be multi-threaded the only thing that it certainly must be using is pthread_create. However, there may be other libraries that intercept pthread_create with their own definitions to wrap pthreads functionality for some purpose. In those cases, pthread_create being defined might not necessarily mean that libpthread is actually linked in. For the GNU C library, we can use a known internal name. This is always available in the ABI, but no other library would define it. That is ideal, since any public pthread function might be intercepted just as pthread_create might be. __pthread_key_create is an "internal" implementation symbol, but it is part of the public exported ABI. Also, it's among the symbols that the static libpthread.a always links in whenever pthread_create is used, so there is no danger of a false negative result in any statically-linked, multi-threaded program. For others, we choose pthread_cancel as a function that seems unlikely to be redefined by an interceptor library. The bionic (Android) C library does not provide pthread_cancel, so we do use pthread_create there (and interceptor libraries lose). */ #ifdef __GLIBC__ __gthrw2(__gthrw_(__pthread_key_create), __pthread_key_create, pthread_key_create) # define GTHR_ACTIVE_PROXY __gthrw_(__pthread_key_create) #elif defined (__BIONIC__) # define GTHR_ACTIVE_PROXY __gthrw_(pthread_create) #else # define GTHR_ACTIVE_PROXY __gthrw_(pthread_cancel) #endif static inline int __gthread_active_p (void) { static void *const __gthread_active_ptr = __extension__ (void *) >HR_ACTIVE_PROXY; return __gthread_active_ptr != 0; } #endif /* FreeBSD or Solaris */ #else /* not __GXX_WEAK__ */ /* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread calls in shared flavors of the HP-UX C library. Most of the stubs have no functionality. The details are described in the "libc cumulative patch" for each subversion of HP-UX 11. There are two special interfaces provided for checking whether an application is linked to a shared pthread library or not. However, these interfaces aren't available in early libpthread libraries. We also need a test that works for archive libraries. We can't use pthread_once as some libc versions call the init function. We also can't use pthread_create or pthread_attr_init as these create a thread and thereby prevent changing the default stack size. The function pthread_default_stacksize_np is available in both the archive and shared versions of libpthread. It can be used to determine the default pthread stack size. There is a stub in some shared libc versions which returns a zero size if pthreads are not active. We provide an equivalent stub to handle cases where libc doesn't provide one. */ #if defined(__hppa__) && defined(__hpux__) static volatile int __gthread_active = -1; static inline int __gthread_active_p (void) { /* Avoid reading __gthread_active twice on the main code path. */ int __gthread_active_latest_value = __gthread_active; size_t __s; if (__builtin_expect (__gthread_active_latest_value < 0, 0)) { pthread_default_stacksize_np (0, &__s); __gthread_active = __s ? 1 : 0; __gthread_active_latest_value = __gthread_active; } return __gthread_active_latest_value != 0; } #else /* not hppa-hpux */ static inline int __gthread_active_p (void) { return 1; } #endif /* hppa-hpux */ #endif /* __GXX_WEAK__ */ #ifdef _LIBOBJC /* This is the config.h file in libobjc/ */ #include <config.h> #ifdef HAVE_SCHED_H # include <sched.h> #endif /* Key structure for maintaining thread specific storage */ static pthread_key_t _objc_thread_storage; static pthread_attr_t _objc_thread_attribs; /* Thread local storage for a single thread */ static void *thread_local_storage = NULL; /* Backend initialization functions */ /* Initialize the threads subsystem. */ static inline int __gthread_objc_init_thread_system (void) { if (__gthread_active_p ()) { /* Initialize the thread storage key. */ if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0) { /* The normal default detach state for threads is * PTHREAD_CREATE_JOINABLE which causes threads to not die * when you think they should. */ if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0 && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs, PTHREAD_CREATE_DETACHED) == 0) return 0; } } return -1; } /* Close the threads subsystem. */ static inline int __gthread_objc_close_thread_system (void) { if (__gthread_active_p () && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0 && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0) return 0; return -1; } /* Backend thread functions */ /* Create a new thread of execution. */ static inline objc_thread_t __gthread_objc_thread_detach (void (*func)(void *), void *arg) { objc_thread_t thread_id; pthread_t new_thread_handle; if (!__gthread_active_p ()) return NULL; if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs, (void *) func, arg))) thread_id = (objc_thread_t) new_thread_handle; else thread_id = NULL; return thread_id; } /* Set the current thread's priority. */ static inline int __gthread_objc_thread_set_priority (int priority) { if (!__gthread_active_p ()) return -1; else { #ifdef _POSIX_PRIORITY_SCHEDULING #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING pthread_t thread_id = __gthrw_(pthread_self) (); int policy; struct sched_param params; int priority_min, priority_max; if (__gthrw_(pthread_getschedparam) (thread_id, &policy, ¶ms) == 0) { if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1) return -1; if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1) return -1; if (priority > priority_max) priority = priority_max; else if (priority < priority_min) priority = priority_min; params.sched_priority = priority; /* * The solaris 7 and several other man pages incorrectly state that * this should be a pointer to policy but pthread.h is universally * at odds with this. */ if (__gthrw_(pthread_setschedparam) (thread_id, policy, ¶ms) == 0) return 0; } #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ #endif /* _POSIX_PRIORITY_SCHEDULING */ return -1; } } /* Return the current thread's priority. */ static inline int __gthread_objc_thread_get_priority (void) { #ifdef _POSIX_PRIORITY_SCHEDULING #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING if (__gthread_active_p ()) { int policy; struct sched_param params; if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, ¶ms) == 0) return params.sched_priority; else return -1; } else #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ #endif /* _POSIX_PRIORITY_SCHEDULING */ return OBJC_THREAD_INTERACTIVE_PRIORITY; } /* Yield our process time to another thread. */ static inline void __gthread_objc_thread_yield (void) { if (__gthread_active_p ()) __gthrw_(sched_yield) (); } /* Terminate the current thread. */ static inline int __gthread_objc_thread_exit (void) { if (__gthread_active_p ()) /* exit the thread */ __gthrw_(pthread_exit) (&__objc_thread_exit_status); /* Failed if we reached here */ return -1; } /* Returns an integer value which uniquely describes a thread. */ static inline objc_thread_t __gthread_objc_thread_id (void) { if (__gthread_active_p ()) return (objc_thread_t) __gthrw_(pthread_self) (); else return (objc_thread_t) 1; } /* Sets the thread's local storage pointer. */ static inline int __gthread_objc_thread_set_data (void *value) { if (__gthread_active_p ()) return __gthrw_(pthread_setspecific) (_objc_thread_storage, value); else { thread_local_storage = value; return 0; } } /* Returns the thread's local storage pointer. */ static inline void * __gthread_objc_thread_get_data (void) { if (__gthread_active_p ()) return __gthrw_(pthread_getspecific) (_objc_thread_storage); else return thread_local_storage; } /* Backend mutex functions */ /* Allocate a mutex. */ static inline int __gthread_objc_mutex_allocate (objc_mutex_t mutex) { if (__gthread_active_p ()) { mutex->backend = objc_malloc (sizeof (pthread_mutex_t)); if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL)) { objc_free (mutex->backend); mutex->backend = NULL; return -1; } } return 0; } /* Deallocate a mutex. */ static inline int __gthread_objc_mutex_deallocate (objc_mutex_t mutex) { if (__gthread_active_p ()) { int count; /* * Posix Threads specifically require that the thread be unlocked * for __gthrw_(pthread_mutex_destroy) to work. */ do { count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend); if (count < 0) return -1; } while (count); if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend)) return -1; objc_free (mutex->backend); mutex->backend = NULL; } return 0; } /* Grab a lock on a mutex. */ static inline int __gthread_objc_mutex_lock (objc_mutex_t mutex) { if (__gthread_active_p () && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0) { return -1; } return 0; } /* Try to grab a lock on a mutex. */ static inline int __gthread_objc_mutex_trylock (objc_mutex_t mutex) { if (__gthread_active_p () && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0) { return -1; } return 0; } /* Unlock the mutex */ static inline int __gthread_objc_mutex_unlock (objc_mutex_t mutex) { if (__gthread_active_p () && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0) { return -1; } return 0; } /* Backend condition mutex functions */ /* Allocate a condition. */ static inline int __gthread_objc_condition_allocate (objc_condition_t condition) { if (__gthread_active_p ()) { condition->backend = objc_malloc (sizeof (pthread_cond_t)); if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL)) { objc_free (condition->backend); condition->backend = NULL; return -1; } } return 0; } /* Deallocate a condition. */ static inline int __gthread_objc_condition_deallocate (objc_condition_t condition) { if (__gthread_active_p ()) { if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend)) return -1; objc_free (condition->backend); condition->backend = NULL; } return 0; } /* Wait on the condition */ static inline int __gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend, (pthread_mutex_t *) mutex->backend); else return 0; } /* Wake up all threads waiting on this condition. */ static inline int __gthread_objc_condition_broadcast (objc_condition_t condition) { if (__gthread_active_p ()) return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend); else return 0; } /* Wake up one thread waiting on this condition. */ static inline int __gthread_objc_condition_signal (objc_condition_t condition) { if (__gthread_active_p ()) return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend); else return 0; } #else /* _LIBOBJC */ static inline int __gthread_create (__gthread_t *__threadid, void *(*__func) (void*), void *__args) { return __gthrw_(pthread_create) (__threadid, NULL, __func, __args); } static inline int __gthread_join (__gthread_t __threadid, void **__value_ptr) { return __gthrw_(pthread_join) (__threadid, __value_ptr); } static inline int __gthread_detach (__gthread_t __threadid) { return __gthrw_(pthread_detach) (__threadid); } static inline int __gthread_equal (__gthread_t __t1, __gthread_t __t2) { return __gthrw_(pthread_equal) (__t1, __t2); } static inline __gthread_t __gthread_self (void) { return __gthrw_(pthread_self) (); } static inline int __gthread_yield (void) { return __gthrw_(sched_yield) (); } static inline int __gthread_once (__gthread_once_t *__once, void (*__func) (void)) { if (__gthread_active_p ()) return __gthrw_(pthread_once) (__once, __func); else return -1; } static inline int __gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *)) { return __gthrw_(pthread_key_create) (__key, __dtor); } static inline int __gthread_key_delete (__gthread_key_t __key) { return __gthrw_(pthread_key_delete) (__key); } static inline void * __gthread_getspecific (__gthread_key_t __key) { return __gthrw_(pthread_getspecific) (__key); } static inline int __gthread_setspecific (__gthread_key_t __key, const void *__ptr) { return __gthrw_(pthread_setspecific) (__key, __ptr); } static inline void __gthread_mutex_init_function (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) __gthrw_(pthread_mutex_init) (__mutex, NULL); } static inline int __gthread_mutex_destroy (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_destroy) (__mutex); else return 0; } static inline int __gthread_mutex_lock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_lock) (__mutex); else return 0; } static inline int __gthread_mutex_trylock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_trylock) (__mutex); else return 0; } #if _GTHREAD_USE_MUTEX_TIMEDLOCK static inline int __gthread_mutex_timedlock (__gthread_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout); else return 0; } #endif static inline int __gthread_mutex_unlock (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) return __gthrw_(pthread_mutex_unlock) (__mutex); else return 0; } #if !defined( PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) \ || defined(_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC) static inline int __gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex) { if (__gthread_active_p ()) { pthread_mutexattr_t __attr; int __r; __r = __gthrw_(pthread_mutexattr_init) (&__attr); if (!__r) __r = __gthrw_(pthread_mutexattr_settype) (&__attr, PTHREAD_MUTEX_RECURSIVE); if (!__r) __r = __gthrw_(pthread_mutex_init) (__mutex, &__attr); if (!__r) __r = __gthrw_(pthread_mutexattr_destroy) (&__attr); return __r; } return 0; } #endif static inline int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_lock (__mutex); } static inline int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_trylock (__mutex); } #if _GTHREAD_USE_MUTEX_TIMEDLOCK static inline int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { return __gthread_mutex_timedlock (__mutex, __abs_timeout); } #endif static inline int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_unlock (__mutex); } static inline int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_destroy (__mutex); } #ifdef _GTHREAD_USE_COND_INIT_FUNC static inline void __gthread_cond_init_function (__gthread_cond_t *__cond) { if (__gthread_active_p ()) __gthrw_(pthread_cond_init) (__cond, NULL); } #endif static inline int __gthread_cond_broadcast (__gthread_cond_t *__cond) { return __gthrw_(pthread_cond_broadcast) (__cond); } static inline int __gthread_cond_signal (__gthread_cond_t *__cond) { return __gthrw_(pthread_cond_signal) (__cond); } static inline int __gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex) { return __gthrw_(pthread_cond_wait) (__cond, __mutex); } static inline int __gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex, const __gthread_time_t *__abs_timeout) { return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout); } static inline int __gthread_cond_wait_recursive (__gthread_cond_t *__cond, __gthread_recursive_mutex_t *__mutex) { return __gthread_cond_wait (__cond, __mutex); } static inline int __gthread_cond_destroy (__gthread_cond_t* __cond) { return __gthrw_(pthread_cond_destroy) (__cond); } #endif /* _LIBOBJC */ #endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/c++io.h����������������������������������������������������������0000644�����������������00000003110�14763166027�0013146 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Underlying io library details -*- C++ -*- // Copyright (C) 2000-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/c++io.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ios} */ // c_io_stdio.h - Defines for using "C" stdio.h #ifndef _GLIBCXX_CXX_IO_H #define _GLIBCXX_CXX_IO_H 1 #include <cstdio> #include <bits/gthr.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef __gthread_mutex_t __c_lock; // for basic_file.h typedef FILE __c_file; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/ctype_inline.h���������������������������������������������������0000644�����������������00000004354�14763166027�0014743 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Locale support -*- C++ -*- // Copyright (C) 2000-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/ctype_inline.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{locale} */ // // ISO C++ 14882: 22.1 Locales // // ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) // functions go in ctype.cc namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION bool ctype<char>:: is(mask __m, char __c) const { return _M_table[static_cast<unsigned char>(__c)] & __m; } const char* ctype<char>:: is(const char* __low, const char* __high, mask* __vec) const { while (__low < __high) *__vec++ = _M_table[static_cast<unsigned char>(*__low++)]; return __high; } const char* ctype<char>:: scan_is(mask __m, const char* __low, const char* __high) const { while (__low < __high && !(_M_table[static_cast<unsigned char>(*__low)] & __m)) ++__low; return __low; } const char* ctype<char>:: scan_not(mask __m, const char* __low, const char* __high) const { while (__low < __high && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0) ++__low; return __low; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/gthr.h�����������������������������������������������������������0000644�����������������00000012750�14763166027�0013224 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Threads compatibility routines for libgcc2. */ /* Compile this one with gcc. */ /* Copyright (C) 1997-2013 Free Software Foundation, Inc. This file is part of GCC. GCC 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 3, or (at your option) any later version. GCC 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. Under Section 7 of GPL version 3, you are granted additional permissions described in the GCC Runtime Library Exception, version 3.1, as published by the Free Software Foundation. You should have received a copy of the GNU General Public License and a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GLIBCXX_GCC_GTHR_H #define _GLIBCXX_GCC_GTHR_H #ifndef _GLIBCXX_HIDE_EXPORTS #pragma GCC visibility push(default) #endif /* If this file is compiled with threads support, it must #define __GTHREADS 1 to indicate that threads support is present. Also it has define function int __gthread_active_p () that returns 1 if thread system is active, 0 if not. The threads interface must define the following types: __gthread_key_t __gthread_once_t __gthread_mutex_t __gthread_recursive_mutex_t The threads interface must define the following macros: __GTHREAD_ONCE_INIT to initialize __gthread_once_t __GTHREAD_MUTEX_INIT to initialize __gthread_mutex_t to get a fast non-recursive mutex. __GTHREAD_MUTEX_INIT_FUNCTION to initialize __gthread_mutex_t to get a fast non-recursive mutex. Define this to a function which looks like this: void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *) Some systems can't initialize a mutex without a function call. Don't define __GTHREAD_MUTEX_INIT in this case. __GTHREAD_RECURSIVE_MUTEX_INIT __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION as above, but for a recursive mutex. The threads interface must define the following static functions: int __gthread_once (__gthread_once_t *once, void (*func) ()) int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *)) int __gthread_key_delete (__gthread_key_t key) void *__gthread_getspecific (__gthread_key_t key) int __gthread_setspecific (__gthread_key_t key, const void *ptr) int __gthread_mutex_destroy (__gthread_mutex_t *mutex); int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *mutex); int __gthread_mutex_lock (__gthread_mutex_t *mutex); int __gthread_mutex_trylock (__gthread_mutex_t *mutex); int __gthread_mutex_unlock (__gthread_mutex_t *mutex); int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex); int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex); int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex); The following are supported in POSIX threads only. They are required to fix a deadlock in static initialization inside libsupc++. The header file gthr-posix.h defines a symbol __GTHREAD_HAS_COND to signify that these extra features are supported. Types: __gthread_cond_t Macros: __GTHREAD_COND_INIT __GTHREAD_COND_INIT_FUNCTION Interface: int __gthread_cond_broadcast (__gthread_cond_t *cond); int __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex); int __gthread_cond_wait_recursive (__gthread_cond_t *cond, __gthread_recursive_mutex_t *mutex); All functions returning int should return zero on success or the error number. If the operation is not supported, -1 is returned. If the following are also defined, you should #define __GTHREADS_CXX0X 1 to enable the c++0x thread library. Types: __gthread_t __gthread_time_t Interface: int __gthread_create (__gthread_t *thread, void *(*func) (void*), void *args); int __gthread_join (__gthread_t thread, void **value_ptr); int __gthread_detach (__gthread_t thread); int __gthread_equal (__gthread_t t1, __gthread_t t2); __gthread_t __gthread_self (void); int __gthread_yield (void); int __gthread_mutex_timedlock (__gthread_mutex_t *m, const __gthread_time_t *abs_timeout); int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *m, const __gthread_time_t *abs_time); int __gthread_cond_signal (__gthread_cond_t *cond); int __gthread_cond_timedwait (__gthread_cond_t *cond, __gthread_mutex_t *mutex, const __gthread_time_t *abs_timeout); */ #if __GXX_WEAK__ /* The pe-coff weak support isn't fully compatible to ELF's weak. For static libraries it might would work, but as we need to deal with shared versions too, we disable it for mingw-targets. */ #ifdef __MINGW32__ #undef _GLIBCXX_GTHREAD_USE_WEAK #define _GLIBCXX_GTHREAD_USE_WEAK 0 #endif #ifndef _GLIBCXX_GTHREAD_USE_WEAK #define _GLIBCXX_GTHREAD_USE_WEAK 1 #endif #endif #include <bits/gthr-default.h> #ifndef _GLIBCXX_HIDE_EXPORTS #pragma GCC visibility pop #endif #endif /* ! _GLIBCXX_GCC_GTHR_H */ ������������������������c++/4.8.2/x86_64-redhat-linux/bits/messages_members.h�����������������������������������������������0000644�����������������00000010003�14763166027�0015566 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// std::messages implementation details, GNU version -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/messages_members.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{locale} */ // // ISO C++ 14882: 22.2.7.1.2 messages functions // // Written by Benjamin Kosnik <bkoz@redhat.com> #include <libintl.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Non-virtual member functions. template<typename _CharT> messages<_CharT>::messages(size_t __refs) : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), _M_name_messages(_S_get_c_name()) { } template<typename _CharT> messages<_CharT>::messages(__c_locale __cloc, const char* __s, size_t __refs) : facet(__refs), _M_c_locale_messages(0), _M_name_messages(0) { if (__builtin_strcmp(__s, _S_get_c_name()) != 0) { const size_t __len = __builtin_strlen(__s) + 1; char* __tmp = new char[__len]; __builtin_memcpy(__tmp, __s, __len); _M_name_messages = __tmp; } else _M_name_messages = _S_get_c_name(); // Last to avoid leaking memory if new throws. _M_c_locale_messages = _S_clone_c_locale(__cloc); } template<typename _CharT> typename messages<_CharT>::catalog messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, const char* __dir) const { bindtextdomain(__s.c_str(), __dir); return this->do_open(__s, __loc); } // Virtual member functions. template<typename _CharT> messages<_CharT>::~messages() { if (_M_name_messages != _S_get_c_name()) delete [] _M_name_messages; _S_destroy_c_locale(_M_c_locale_messages); } template<typename _CharT> typename messages<_CharT>::catalog messages<_CharT>::do_open(const basic_string<char>& __s, const locale&) const { // No error checking is done, assume the catalog exists and can // be used. textdomain(__s.c_str()); return 0; } template<typename _CharT> void messages<_CharT>::do_close(catalog) const { } // messages_byname template<typename _CharT> messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) : messages<_CharT>(__refs) { if (this->_M_name_messages != locale::facet::_S_get_c_name()) { delete [] this->_M_name_messages; if (__builtin_strcmp(__s, locale::facet::_S_get_c_name()) != 0) { const size_t __len = __builtin_strlen(__s) + 1; char* __tmp = new char[__len]; __builtin_memcpy(__tmp, __s, __len); this->_M_name_messages = __tmp; } else this->_M_name_messages = locale::facet::_S_get_c_name(); } if (__builtin_strcmp(__s, "C") != 0 && __builtin_strcmp(__s, "POSIX") != 0) { this->_S_destroy_c_locale(this->_M_c_locale_messages); this->_S_create_c_locale(this->_M_c_locale_messages, __s); } } _GLIBCXX_END_NAMESPACE_VERSION } // namespace �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/os_defines.h�����������������������������������������������������0000644�����������������00000003367�14763166027�0014402 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Specific definitions for GNU/Linux -*- C++ -*- // Copyright (C) 2000-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/os_defines.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{iosfwd} */ #ifndef _GLIBCXX_OS_DEFINES #define _GLIBCXX_OS_DEFINES 1 // System-specific #define, typedefs, corrections, etc, go here. This // file will come before all others. // This keeps isanum, et al from being propagated as macros. #define __NO_CTYPE 1 #include <features.h> // Provide a declaration for the possibly deprecated gets function, as // glibc 2.15 and later does not declare gets for ISO C11 when // __GNU_SOURCE is defined. #if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE) # undef _GLIBCXX_HAVE_GETS #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/cxxabi_tweaks.h��������������������������������������������������0000644�����������������00000004062�14763166027�0015111 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Control various target specific ABI tweaks. Generic version. // Copyright (C) 2004-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/cxxabi_tweaks.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{cxxabi.h} */ #ifndef _CXXABI_TWEAKS_H #define _CXXABI_TWEAKS_H 1 #ifdef __cplusplus namespace __cxxabiv1 { extern "C" { #endif // The generic ABI uses the first byte of a 64-bit guard variable. #define _GLIBCXX_GUARD_TEST(x) (*(char *) (x) != 0) #define _GLIBCXX_GUARD_SET(x) *(char *) (x) = 1 #define _GLIBCXX_GUARD_BIT __guard_test_bit (0, 1) #define _GLIBCXX_GUARD_PENDING_BIT __guard_test_bit (1, 1) #define _GLIBCXX_GUARD_WAITING_BIT __guard_test_bit (2, 1) __extension__ typedef int __guard __attribute__((mode (__DI__))); // __cxa_vec_ctor has void return type. typedef void __cxa_vec_ctor_return_type; #define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return // Constructors and destructors do not return a value. typedef void __cxa_cdtor_return_type; #ifdef __cplusplus } } // namespace __cxxabiv1 #endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/gthr-single.h����������������������������������������������������0000644�����������������00000015204�14763166027�0014500 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Threads compatibility routines for libgcc2 and libobjc. */ /* Compile this one with gcc. */ /* Copyright (C) 1997-2013 Free Software Foundation, Inc. This file is part of GCC. GCC 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 3, or (at your option) any later version. GCC 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. Under Section 7 of GPL version 3, you are granted additional permissions described in the GCC Runtime Library Exception, version 3.1, as published by the Free Software Foundation. You should have received a copy of the GNU General Public License and a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GLIBCXX_GCC_GTHR_SINGLE_H #define _GLIBCXX_GCC_GTHR_SINGLE_H /* Just provide compatibility for mutex handling. */ typedef int __gthread_key_t; typedef int __gthread_once_t; typedef int __gthread_mutex_t; typedef int __gthread_recursive_mutex_t; #define __GTHREAD_ONCE_INIT 0 #define __GTHREAD_MUTEX_INIT 0 #define __GTHREAD_MUTEX_INIT_FUNCTION(mx) #define __GTHREAD_RECURSIVE_MUTEX_INIT 0 #define _GLIBCXX_UNUSED __attribute__((unused)) #ifdef _LIBOBJC /* Thread local storage for a single thread */ static void *thread_local_storage = NULL; /* Backend initialization functions */ /* Initialize the threads subsystem. */ static inline int __gthread_objc_init_thread_system (void) { /* No thread support available */ return -1; } /* Close the threads subsystem. */ static inline int __gthread_objc_close_thread_system (void) { /* No thread support available */ return -1; } /* Backend thread functions */ /* Create a new thread of execution. */ static inline objc_thread_t __gthread_objc_thread_detach (void (* func)(void *), void * arg _GLIBCXX_UNUSED) { /* No thread support available */ return NULL; } /* Set the current thread's priority. */ static inline int __gthread_objc_thread_set_priority (int priority _GLIBCXX_UNUSED) { /* No thread support available */ return -1; } /* Return the current thread's priority. */ static inline int __gthread_objc_thread_get_priority (void) { return OBJC_THREAD_INTERACTIVE_PRIORITY; } /* Yield our process time to another thread. */ static inline void __gthread_objc_thread_yield (void) { return; } /* Terminate the current thread. */ static inline int __gthread_objc_thread_exit (void) { /* No thread support available */ /* Should we really exit the program */ /* exit (&__objc_thread_exit_status); */ return -1; } /* Returns an integer value which uniquely describes a thread. */ static inline objc_thread_t __gthread_objc_thread_id (void) { /* No thread support, use 1. */ return (objc_thread_t) 1; } /* Sets the thread's local storage pointer. */ static inline int __gthread_objc_thread_set_data (void *value) { thread_local_storage = value; return 0; } /* Returns the thread's local storage pointer. */ static inline void * __gthread_objc_thread_get_data (void) { return thread_local_storage; } /* Backend mutex functions */ /* Allocate a mutex. */ static inline int __gthread_objc_mutex_allocate (objc_mutex_t mutex _GLIBCXX_UNUSED) { return 0; } /* Deallocate a mutex. */ static inline int __gthread_objc_mutex_deallocate (objc_mutex_t mutex _GLIBCXX_UNUSED) { return 0; } /* Grab a lock on a mutex. */ static inline int __gthread_objc_mutex_lock (objc_mutex_t mutex _GLIBCXX_UNUSED) { /* There can only be one thread, so we always get the lock */ return 0; } /* Try to grab a lock on a mutex. */ static inline int __gthread_objc_mutex_trylock (objc_mutex_t mutex _GLIBCXX_UNUSED) { /* There can only be one thread, so we always get the lock */ return 0; } /* Unlock the mutex */ static inline int __gthread_objc_mutex_unlock (objc_mutex_t mutex _GLIBCXX_UNUSED) { return 0; } /* Backend condition mutex functions */ /* Allocate a condition. */ static inline int __gthread_objc_condition_allocate (objc_condition_t condition _GLIBCXX_UNUSED) { return 0; } /* Deallocate a condition. */ static inline int __gthread_objc_condition_deallocate (objc_condition_t condition _GLIBCXX_UNUSED) { return 0; } /* Wait on the condition */ static inline int __gthread_objc_condition_wait (objc_condition_t condition _GLIBCXX_UNUSED, objc_mutex_t mutex _GLIBCXX_UNUSED) { return 0; } /* Wake up all threads waiting on this condition. */ static inline int __gthread_objc_condition_broadcast (objc_condition_t condition _GLIBCXX_UNUSED) { return 0; } /* Wake up one thread waiting on this condition. */ static inline int __gthread_objc_condition_signal (objc_condition_t condition _GLIBCXX_UNUSED) { return 0; } #else /* _LIBOBJC */ static inline int __gthread_active_p (void) { return 0; } static inline int __gthread_once (__gthread_once_t *__once _GLIBCXX_UNUSED, void (*__func) (void) _GLIBCXX_UNUSED) { return 0; } static inline int _GLIBCXX_UNUSED __gthread_key_create (__gthread_key_t *__key _GLIBCXX_UNUSED, void (*__func) (void *) _GLIBCXX_UNUSED) { return 0; } static int _GLIBCXX_UNUSED __gthread_key_delete (__gthread_key_t __key _GLIBCXX_UNUSED) { return 0; } static inline void * __gthread_getspecific (__gthread_key_t __key _GLIBCXX_UNUSED) { return 0; } static inline int __gthread_setspecific (__gthread_key_t __key _GLIBCXX_UNUSED, const void *__v _GLIBCXX_UNUSED) { return 0; } static inline int __gthread_mutex_destroy (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED) { return 0; } static inline int __gthread_mutex_lock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED) { return 0; } static inline int __gthread_mutex_trylock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED) { return 0; } static inline int __gthread_mutex_unlock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED) { return 0; } static inline int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_lock (__mutex); } static inline int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_trylock (__mutex); } static inline int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_unlock (__mutex); } static inline int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex) { return __gthread_mutex_destroy (__mutex); } #endif /* _LIBOBJC */ #undef _GLIBCXX_UNUSED #endif /* ! _GLIBCXX_GCC_GTHR_SINGLE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/extc++.h���������������������������������������������������������0000644�����������������00000004524�14763166027�0013351 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// C++ includes used for precompiling extensions -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file extc++.h * This is an implementation file for a precompiled header. */ #if __cplusplus < 201103L #include <bits/stdtr1c++.h> #endif #include <ext/algorithm> #include <ext/array_allocator.h> #include <ext/atomicity.h> #include <ext/bitmap_allocator.h> #include <ext/cast.h> #include <ext/concurrence.h> #include <ext/debug_allocator.h> #include <ext/extptr_allocator.h> #include <ext/functional> #include <ext/iterator> #include <ext/malloc_allocator.h> #include <ext/memory> #include <ext/mt_allocator.h> #include <ext/new_allocator.h> #include <ext/numeric> #include <ext/pod_char_traits.h> #include <ext/pointer.h> #include <ext/pool_allocator.h> #include <ext/rb_tree> #include <ext/rope> #include <ext/slist> #include <ext/stdio_filebuf.h> #include <ext/stdio_sync_filebuf.h> #include <ext/throw_allocator.h> #include <ext/typelist.h> #include <ext/type_traits.h> #include <ext/vstring.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/priority_queue.hpp> #include <ext/pb_ds/exception.hpp> #include <ext/pb_ds/hash_policy.hpp> #include <ext/pb_ds/list_update_policy.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/trie_policy.hpp> #ifdef _GLIBCXX_HAVE_ICONV #include <ext/codecvt_specializations.h> #include <ext/enc_filebuf.h> #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/c++allocator.h���������������������������������������������������0000644�����������������00000003471�14763166027�0014531 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Base to std::allocator -*- C++ -*- // Copyright (C) 2004-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/c++allocator.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{memory} */ #ifndef _GLIBCXX_CXX_ALLOCATOR_H #define _GLIBCXX_CXX_ALLOCATOR_H 1 #include <ext/new_allocator.h> #if __cplusplus >= 201103L namespace std { /** * @brief An alias to the base class for std::allocator. * @ingroup allocators * * Used to set the std::allocator base class to * __gnu_cxx::new_allocator. * * @tparam _Tp Type of allocated object. */ template<typename _Tp> using __allocator_base = __gnu_cxx::new_allocator<_Tp>; } #else // Define new_allocator as the base class to std::allocator. # define __allocator_base __gnu_cxx::new_allocator #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/x86_64-redhat-linux/bits/basic_file.h�����������������������������������������������������0000644�����������������00000005512�14763166027�0014336 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Wrapper of C-language FILE struct -*- C++ -*- // Copyright (C) 2000-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // // ISO C++ 14882: 27.8 File-based streams // /** @file bits/basic_file.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ios} */ #ifndef _GLIBCXX_BASIC_FILE_STDIO_H #define _GLIBCXX_BASIC_FILE_STDIO_H 1 #pragma GCC system_header #include <bits/c++config.h> #include <bits/c++io.h> // for __c_lock and __c_file #include <ios> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Generic declaration. template<typename _CharT> class __basic_file; // Specialization. template<> class __basic_file<char> { // Underlying data source/sink. __c_file* _M_cfile; // True iff we opened _M_cfile, and thus must close it ourselves. bool _M_cfile_created; public: __basic_file(__c_lock* __lock = 0) throw (); __basic_file* open(const char* __name, ios_base::openmode __mode, int __prot = 0664); __basic_file* sys_open(__c_file* __file, ios_base::openmode); __basic_file* sys_open(int __fd, ios_base::openmode __mode) throw (); __basic_file* close(); _GLIBCXX_PURE bool is_open() const throw (); _GLIBCXX_PURE int fd() throw (); _GLIBCXX_PURE __c_file* file() throw (); ~__basic_file(); streamsize xsputn(const char* __s, streamsize __n); streamsize xsputn_2(const char* __s1, streamsize __n1, const char* __s2, streamsize __n2); streamsize xsgetn(char* __s, streamsize __n); streamoff seekoff(streamoff __off, ios_base::seekdir __way) throw (); int sync(); streamsize showmanyc(); }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/typeinfo����������������������������������������������������������������������������������0000644�����������������00000017005�14763166027�0007364 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// RTTI support for -*- C++ -*- // Copyright (C) 1994-2013 Free Software Foundation, Inc. // // This file is part of GCC. // // GCC 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 3, or (at your option) // any later version. // // GCC 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. // // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file typeinfo * This is a Standard C++ Library header. */ #ifndef _TYPEINFO #define _TYPEINFO #pragma GCC system_header #include <exception> #if __cplusplus >= 201103L #include <bits/hash_bytes.h> #endif #pragma GCC visibility push(default) extern "C++" { namespace __cxxabiv1 { class __class_type_info; } // namespace __cxxabiv1 // Determine whether typeinfo names for the same type are merged (in which // case comparison can just compare pointers) or not (in which case strings // must be compared), and whether comparison is to be implemented inline or // not. We used to do inline pointer comparison by default if weak symbols // are available, but even with weak symbols sometimes names are not merged // when objects are loaded with RTLD_LOCAL, so now we always use strcmp by // default. For ABI compatibility, we do the strcmp inline if weak symbols // are available, and out-of-line if not. Out-of-line pointer comparison // is used where the object files are to be portable to multiple systems, // some of which may not be able to use pointer comparison, but the // particular system for which libstdc++ is being built can use pointer // comparison; in particular for most ARM EABI systems, where the ABI // specifies out-of-line comparison. The compiler's target configuration // can override the defaults by defining __GXX_TYPEINFO_EQUALITY_INLINE to // 1 or 0 to indicate whether or not comparison is inline, and // __GXX_MERGED_TYPEINFO_NAMES to 1 or 0 to indicate whether or not pointer // comparison can be used. #ifndef __GXX_MERGED_TYPEINFO_NAMES // By default, typeinfo names are not merged. #define __GXX_MERGED_TYPEINFO_NAMES 0 #endif // By default follow the old inline rules to avoid ABI changes. #ifndef __GXX_TYPEINFO_EQUALITY_INLINE #if !__GXX_WEAK__ #define __GXX_TYPEINFO_EQUALITY_INLINE 0 #else #define __GXX_TYPEINFO_EQUALITY_INLINE 1 #endif #endif namespace std { /** * @brief Part of RTTI. * * The @c type_info class describes type information generated by * an implementation. */ class type_info { public: /** Destructor first. Being the first non-inline virtual function, this * controls in which translation unit the vtable is emitted. The * compiler makes use of that information to know where to emit * the runtime-mandated type_info structures in the new-abi. */ virtual ~type_info(); /** Returns an @e implementation-defined byte string; this is not * portable between compilers! */ const char* name() const _GLIBCXX_NOEXCEPT { return __name[0] == '*' ? __name + 1 : __name; } #if !__GXX_TYPEINFO_EQUALITY_INLINE // In old abi, or when weak symbols are not supported, there can // be multiple instances of a type_info object for one // type. Uniqueness must use the _name value, not object address. bool before(const type_info& __arg) const _GLIBCXX_NOEXCEPT; bool operator==(const type_info& __arg) const _GLIBCXX_NOEXCEPT; #else #if !__GXX_MERGED_TYPEINFO_NAMES /** Returns true if @c *this precedes @c __arg in the implementation's * collation order. */ // Even with the new abi, on systems that support dlopen // we can run into cases where type_info names aren't merged, // so we still need to do string comparison. bool before(const type_info& __arg) const _GLIBCXX_NOEXCEPT { return (__name[0] == '*' && __arg.__name[0] == '*') ? __name < __arg.__name : __builtin_strcmp (__name, __arg.__name) < 0; } bool operator==(const type_info& __arg) const _GLIBCXX_NOEXCEPT { return ((__name == __arg.__name) || (__name[0] != '*' && __builtin_strcmp (__name, __arg.__name) == 0)); } #else // On some targets we can rely on type_info's NTBS being unique, // and therefore address comparisons are sufficient. bool before(const type_info& __arg) const _GLIBCXX_NOEXCEPT { return __name < __arg.__name; } bool operator==(const type_info& __arg) const _GLIBCXX_NOEXCEPT { return __name == __arg.__name; } #endif #endif bool operator!=(const type_info& __arg) const _GLIBCXX_NOEXCEPT { return !operator==(__arg); } #if __cplusplus >= 201103L size_t hash_code() const noexcept { # if !__GXX_MERGED_TYPEINFO_NAMES return _Hash_bytes(name(), __builtin_strlen(name()), static_cast<size_t>(0xc70f6907UL)); # else return reinterpret_cast<size_t>(__name); # endif } #endif // C++11 // Return true if this is a pointer type of some kind virtual bool __is_pointer_p() const; // Return true if this is a function type virtual bool __is_function_p() const; // Try and catch a thrown type. Store an adjusted pointer to the // caught type in THR_OBJ. If THR_TYPE is not a pointer type, then // THR_OBJ points to the thrown object. If THR_TYPE is a pointer // type, then THR_OBJ is the pointer itself. OUTER indicates the // number of outer pointers, and whether they were const // qualified. virtual bool __do_catch(const type_info *__thr_type, void **__thr_obj, unsigned __outer) const; // Internally used during catch matching virtual bool __do_upcast(const __cxxabiv1::__class_type_info *__target, void **__obj_ptr) const; protected: const char *__name; explicit type_info(const char *__n): __name(__n) { } private: /// Assigning type_info is not supported. type_info& operator=(const type_info&); type_info(const type_info&); }; /** * @brief Thrown during incorrect typecasting. * @ingroup exceptions * * If you attempt an invalid @c dynamic_cast expression, an instance of * this class (or something derived from this class) is thrown. */ class bad_cast : public exception { public: bad_cast() _GLIBCXX_USE_NOEXCEPT { } // This declaration is not useless: // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 virtual ~bad_cast() _GLIBCXX_USE_NOEXCEPT; // See comment in eh_exception.cc. virtual const char* what() const _GLIBCXX_USE_NOEXCEPT; }; /** * @brief Thrown when a NULL pointer in a @c typeid expression is used. * @ingroup exceptions */ class bad_typeid : public exception { public: bad_typeid () _GLIBCXX_USE_NOEXCEPT { } // This declaration is not useless: // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 virtual ~bad_typeid() _GLIBCXX_USE_NOEXCEPT; // See comment in eh_exception.cc. virtual const char* what() const _GLIBCXX_USE_NOEXCEPT; }; } // namespace std } // extern "C++" #pragma GCC visibility pop #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/set���������������������������������������������������������������������������������������0000644�����������������00000004777�14763166027�0006336 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <set> -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file include/set * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_SET #define _GLIBCXX_SET 1 #pragma GCC system_header #include <bits/stl_tree.h> #include <bits/stl_set.h> #include <bits/stl_multiset.h> #include <bits/range_access.h> #ifdef _GLIBCXX_DEBUG # include <debug/set> #endif #ifdef _GLIBCXX_PROFILE # include <profile/set> #endif #endif /* _GLIBCXX_SET */ �c++/4.8.2/limits������������������������������������������������������������������������������������0000644�����������������00000203266�14763166027�0007036 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// The template and inlines for the numeric_limits classes. -*- C++ -*- // Copyright (C) 1999-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/limits * This is a Standard C++ Library header. */ // Note: this is not a conforming implementation. // Written by Gabriel Dos Reis <gdr@codesourcery.com> // // ISO 14882:1998 // 18.2.1 // #ifndef _GLIBCXX_NUMERIC_LIMITS #define _GLIBCXX_NUMERIC_LIMITS 1 #pragma GCC system_header #include <bits/c++config.h> // // The numeric_limits<> traits document implementation-defined aspects // of fundamental arithmetic data types (integers and floating points). // From Standard C++ point of view, there are 14 such types: // * integers // bool (1) // char, signed char, unsigned char, wchar_t (4) // short, unsigned short (2) // int, unsigned (2) // long, unsigned long (2) // // * floating points // float (1) // double (1) // long double (1) // // GNU C++ understands (where supported by the host C-library) // * integer // long long, unsigned long long (2) // // which brings us to 16 fundamental arithmetic data types in GNU C++. // // // Since a numeric_limits<> is a bit tricky to get right, we rely on // an interface composed of macros which should be defined in config/os // or config/cpu when they differ from the generic (read arbitrary) // definitions given here. // // These values can be overridden in the target configuration file. // The default values are appropriate for many 32-bit targets. // GCC only intrinsically supports modulo integral types. The only remaining // integral exceptional values is division by zero. Only targets that do not // signal division by zero in some "hard to ignore" way should use false. #ifndef __glibcxx_integral_traps # define __glibcxx_integral_traps true #endif // float // // Default values. Should be overridden in configuration files if necessary. #ifndef __glibcxx_float_has_denorm_loss # define __glibcxx_float_has_denorm_loss false #endif #ifndef __glibcxx_float_traps # define __glibcxx_float_traps false #endif #ifndef __glibcxx_float_tinyness_before # define __glibcxx_float_tinyness_before false #endif // double // Default values. Should be overridden in configuration files if necessary. #ifndef __glibcxx_double_has_denorm_loss # define __glibcxx_double_has_denorm_loss false #endif #ifndef __glibcxx_double_traps # define __glibcxx_double_traps false #endif #ifndef __glibcxx_double_tinyness_before # define __glibcxx_double_tinyness_before false #endif // long double // Default values. Should be overridden in configuration files if necessary. #ifndef __glibcxx_long_double_has_denorm_loss # define __glibcxx_long_double_has_denorm_loss false #endif #ifndef __glibcxx_long_double_traps # define __glibcxx_long_double_traps false #endif #ifndef __glibcxx_long_double_tinyness_before # define __glibcxx_long_double_tinyness_before false #endif // You should not need to define any macros below this point. #define __glibcxx_signed(T) ((T)(-1) < 0) #define __glibcxx_min(T) \ (__glibcxx_signed (T) ? -__glibcxx_max (T) - 1 : (T)0) #define __glibcxx_max(T) \ (__glibcxx_signed (T) ? \ (((((T)1 << (__glibcxx_digits (T) - 1)) - 1) << 1) + 1) : ~(T)0) #define __glibcxx_digits(T) \ (sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T)) // The fraction 643/2136 approximates log10(2) to 7 significant digits. #define __glibcxx_digits10(T) \ (__glibcxx_digits (T) * 643L / 2136) #define __glibcxx_max_digits10(T) \ (2 + (T) * 643L / 2136) namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Describes the rounding style for floating-point types. * * This is used in the std::numeric_limits class. */ enum float_round_style { round_indeterminate = -1, /// Intermediate. round_toward_zero = 0, /// To zero. round_to_nearest = 1, /// To the nearest representable value. round_toward_infinity = 2, /// To infinity. round_toward_neg_infinity = 3 /// To negative infinity. }; /** * @brief Describes the denormalization for floating-point types. * * These values represent the presence or absence of a variable number * of exponent bits. This type is used in the std::numeric_limits class. */ enum float_denorm_style { /// Indeterminate at compile time whether denormalized values are allowed. denorm_indeterminate = -1, /// The type does not allow denormalized values. denorm_absent = 0, /// The type allows denormalized values. denorm_present = 1 }; /** * @brief Part of std::numeric_limits. * * The @c static @c const members are usable as integral constant * expressions. * * @note This is a separate class for purposes of efficiency; you * should only access these members as part of an instantiation * of the std::numeric_limits class. */ struct __numeric_limits_base { /** This will be true for all fundamental types (which have specializations), and false for everything else. */ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = false; /** The number of @c radix digits that be represented without change: for integer types, the number of non-sign bits in the mantissa; for floating types, the number of @c radix digits in the mantissa. */ static _GLIBCXX_USE_CONSTEXPR int digits = 0; /** The number of base 10 digits that can be represented without change. */ static _GLIBCXX_USE_CONSTEXPR int digits10 = 0; #if __cplusplus >= 201103L /** The number of base 10 digits required to ensure that values which differ are always differentiated. */ static constexpr int max_digits10 = 0; #endif /** True if the type is signed. */ static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; /** True if the type is integer. */ static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; /** True if the type uses an exact representation. All integer types are exact, but not all exact types are integer. For example, rational and fixed-exponent representations are exact but not integer. */ static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; /** For integer types, specifies the base of the representation. For floating types, specifies the base of the exponent representation. */ static _GLIBCXX_USE_CONSTEXPR int radix = 0; /** The minimum negative integer such that @c radix raised to the power of (one less than that integer) is a normalized floating point number. */ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; /** The minimum negative integer such that 10 raised to that power is in the range of normalized floating point numbers. */ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; /** The maximum positive integer such that @c radix raised to the power of (one less than that integer) is a representable finite floating point number. */ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; /** The maximum positive integer such that 10 raised to that power is in the range of representable finite floating point numbers. */ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; /** True if the type has a representation for positive infinity. */ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; /** True if the type has a representation for a quiet (non-signaling) Not a Number. */ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; /** True if the type has a representation for a signaling Not a Number. */ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; /** See std::float_denorm_style for more information. */ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; /** True if loss of accuracy is detected as a denormalization loss, rather than as an inexact result. */ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; /** True if-and-only-if the type adheres to the IEC 559 standard, also known as IEEE 754. (Only makes sense for floating point types.) */ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; /** True if the set of values representable by the type is finite. All built-in types are bounded, this member would be false for arbitrary precision types. */ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = false; /** True if the type is @e modulo. A type is modulo if, for any operation involving +, -, or * on values of that type whose result would fall outside the range [min(),max()], the value returned differs from the true value by an integer multiple of max() - min() + 1. On most machines, this is false for floating types, true for unsigned integers, and true for signed integers. See PR22200 about signed integers. */ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; /** True if trapping is implemented for this type. */ static _GLIBCXX_USE_CONSTEXPR bool traps = false; /** True if tininess is detected before rounding. (see IEC 559) */ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; /** See std::float_round_style for more information. This is only meaningful for floating types; integer types will all be round_toward_zero. */ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_toward_zero; }; /** * @brief Properties of fundamental types. * * This class allows a program to obtain information about the * representation of a fundamental type on a given platform. For * non-fundamental types, the functions will return 0 and the data * members will all be @c false. * * _GLIBCXX_RESOLVE_LIB_DEFECTS: DRs 201 and 184 (hi Gaby!) are * noted, but not incorporated in this documented (yet). */ template<typename _Tp> struct numeric_limits : public __numeric_limits_base { /** The minimum finite value, or for floating types with denormalization, the minimum positive normalized value. */ static _GLIBCXX_CONSTEXPR _Tp min() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } /** The maximum finite value. */ static _GLIBCXX_CONSTEXPR _Tp max() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } #if __cplusplus >= 201103L /** A finite value x such that there is no other finite value y * where y < x. */ static constexpr _Tp lowest() noexcept { return _Tp(); } #endif /** The @e machine @e epsilon: the difference between 1 and the least value greater than 1 that is representable. */ static _GLIBCXX_CONSTEXPR _Tp epsilon() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } /** The maximum rounding error measurement (see LIA-1). */ static _GLIBCXX_CONSTEXPR _Tp round_error() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } /** The representation of positive infinity, if @c has_infinity. */ static _GLIBCXX_CONSTEXPR _Tp infinity() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } /** The representation of a quiet Not a Number, if @c has_quiet_NaN. */ static _GLIBCXX_CONSTEXPR _Tp quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } /** The representation of a signaling Not a Number, if @c has_signaling_NaN. */ static _GLIBCXX_CONSTEXPR _Tp signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } /** The minimum positive denormalized value. For types where @c has_denorm is false, this is the minimum positive normalized value. */ static _GLIBCXX_CONSTEXPR _Tp denorm_min() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } }; #if __cplusplus >= 201103L template<typename _Tp> struct numeric_limits<const _Tp> : public numeric_limits<_Tp> { }; template<typename _Tp> struct numeric_limits<volatile _Tp> : public numeric_limits<_Tp> { }; template<typename _Tp> struct numeric_limits<const volatile _Tp> : public numeric_limits<_Tp> { }; #endif // Now there follow 16 explicit specializations. Yes, 16. Make sure // you get the count right. (18 in c++0x mode) /// numeric_limits<bool> specialization. template<> struct numeric_limits<bool> { static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; static _GLIBCXX_CONSTEXPR bool min() _GLIBCXX_USE_NOEXCEPT { return false; } static _GLIBCXX_CONSTEXPR bool max() _GLIBCXX_USE_NOEXCEPT { return true; } #if __cplusplus >= 201103L static constexpr bool lowest() noexcept { return min(); } #endif static _GLIBCXX_USE_CONSTEXPR int digits = 1; static _GLIBCXX_USE_CONSTEXPR int digits10 = 0; #if __cplusplus >= 201103L static constexpr int max_digits10 = 0; #endif static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; static _GLIBCXX_USE_CONSTEXPR int radix = 2; static _GLIBCXX_CONSTEXPR bool epsilon() _GLIBCXX_USE_NOEXCEPT { return false; } static _GLIBCXX_CONSTEXPR bool round_error() _GLIBCXX_USE_NOEXCEPT { return false; } static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; static _GLIBCXX_CONSTEXPR bool infinity() _GLIBCXX_USE_NOEXCEPT { return false; } static _GLIBCXX_CONSTEXPR bool quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return false; } static _GLIBCXX_CONSTEXPR bool signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return false; } static _GLIBCXX_CONSTEXPR bool denorm_min() _GLIBCXX_USE_NOEXCEPT { return false; } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; // It is not clear what it means for a boolean type to trap. // This is a DR on the LWG issue list. Here, I use integer // promotion semantics. static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_toward_zero; }; /// numeric_limits<char> specialization. template<> struct numeric_limits<char> { static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; static _GLIBCXX_CONSTEXPR char min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min(char); } static _GLIBCXX_CONSTEXPR char max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max(char); } #if __cplusplus >= 201103L static constexpr char lowest() noexcept { return min(); } #endif static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char); static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (char); #if __cplusplus >= 201103L static constexpr int max_digits10 = 0; #endif static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (char); static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; static _GLIBCXX_USE_CONSTEXPR int radix = 2; static _GLIBCXX_CONSTEXPR char epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR char round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; static _GLIBCXX_CONSTEXPR char infinity() _GLIBCXX_USE_NOEXCEPT { return char(); } static _GLIBCXX_CONSTEXPR char quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return char(); } static _GLIBCXX_CONSTEXPR char signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return char(); } static _GLIBCXX_CONSTEXPR char denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<char>(0); } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed; static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_toward_zero; }; /// numeric_limits<signed char> specialization. template<> struct numeric_limits<signed char> { static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; static _GLIBCXX_CONSTEXPR signed char min() _GLIBCXX_USE_NOEXCEPT { return -__SCHAR_MAX__ - 1; } static _GLIBCXX_CONSTEXPR signed char max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__; } #if __cplusplus >= 201103L static constexpr signed char lowest() noexcept { return min(); } #endif static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (signed char); static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (signed char); #if __cplusplus >= 201103L static constexpr int max_digits10 = 0; #endif static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; static _GLIBCXX_USE_CONSTEXPR int radix = 2; static _GLIBCXX_CONSTEXPR signed char epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR signed char round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; static _GLIBCXX_CONSTEXPR signed char infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<signed char>(0); } static _GLIBCXX_CONSTEXPR signed char quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<signed char>(0); } static _GLIBCXX_CONSTEXPR signed char signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<signed char>(0); } static _GLIBCXX_CONSTEXPR signed char denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<signed char>(0); } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_toward_zero; }; /// numeric_limits<unsigned char> specialization. template<> struct numeric_limits<unsigned char> { static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; static _GLIBCXX_CONSTEXPR unsigned char min() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR unsigned char max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__ * 2U + 1; } #if __cplusplus >= 201103L static constexpr unsigned char lowest() noexcept { return min(); } #endif static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (unsigned char); static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (unsigned char); #if __cplusplus >= 201103L static constexpr int max_digits10 = 0; #endif static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; static _GLIBCXX_USE_CONSTEXPR int radix = 2; static _GLIBCXX_CONSTEXPR unsigned char epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR unsigned char round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; static _GLIBCXX_CONSTEXPR unsigned char infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned char>(0); } static _GLIBCXX_CONSTEXPR unsigned char quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned char>(0); } static _GLIBCXX_CONSTEXPR unsigned char signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned char>(0); } static _GLIBCXX_CONSTEXPR unsigned char denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned char>(0); } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_toward_zero; }; /// numeric_limits<wchar_t> specialization. template<> struct numeric_limits<wchar_t> { static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; static _GLIBCXX_CONSTEXPR wchar_t min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min (wchar_t); } static _GLIBCXX_CONSTEXPR wchar_t max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max (wchar_t); } #if __cplusplus >= 201103L static constexpr wchar_t lowest() noexcept { return min(); } #endif static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (wchar_t); static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (wchar_t); #if __cplusplus >= 201103L static constexpr int max_digits10 = 0; #endif static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (wchar_t); static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; static _GLIBCXX_USE_CONSTEXPR int radix = 2; static _GLIBCXX_CONSTEXPR wchar_t epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR wchar_t round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; static _GLIBCXX_CONSTEXPR wchar_t infinity() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } static _GLIBCXX_CONSTEXPR wchar_t quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } static _GLIBCXX_CONSTEXPR wchar_t signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } static _GLIBCXX_CONSTEXPR wchar_t denorm_min() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed; static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_toward_zero; }; #if __cplusplus >= 201103L /// numeric_limits<char16_t> specialization. template<> struct numeric_limits<char16_t> { static constexpr bool is_specialized = true; static constexpr char16_t min() noexcept { return __glibcxx_min (char16_t); } static constexpr char16_t max() noexcept { return __glibcxx_max (char16_t); } static constexpr char16_t lowest() noexcept { return min(); } static constexpr int digits = __glibcxx_digits (char16_t); static constexpr int digits10 = __glibcxx_digits10 (char16_t); static constexpr int max_digits10 = 0; static constexpr bool is_signed = __glibcxx_signed (char16_t); static constexpr bool is_integer = true; static constexpr bool is_exact = true; static constexpr int radix = 2; static constexpr char16_t epsilon() noexcept { return 0; } static constexpr char16_t round_error() noexcept { return 0; } static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr float_denorm_style has_denorm = denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr char16_t infinity() noexcept { return char16_t(); } static constexpr char16_t quiet_NaN() noexcept { return char16_t(); } static constexpr char16_t signaling_NaN() noexcept { return char16_t(); } static constexpr char16_t denorm_min() noexcept { return char16_t(); } static constexpr bool is_iec559 = false; static constexpr bool is_bounded = true; static constexpr bool is_modulo = !is_signed; static constexpr bool traps = __glibcxx_integral_traps; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_toward_zero; }; /// numeric_limits<char32_t> specialization. template<> struct numeric_limits<char32_t> { static constexpr bool is_specialized = true; static constexpr char32_t min() noexcept { return __glibcxx_min (char32_t); } static constexpr char32_t max() noexcept { return __glibcxx_max (char32_t); } static constexpr char32_t lowest() noexcept { return min(); } static constexpr int digits = __glibcxx_digits (char32_t); static constexpr int digits10 = __glibcxx_digits10 (char32_t); static constexpr int max_digits10 = 0; static constexpr bool is_signed = __glibcxx_signed (char32_t); static constexpr bool is_integer = true; static constexpr bool is_exact = true; static constexpr int radix = 2; static constexpr char32_t epsilon() noexcept { return 0; } static constexpr char32_t round_error() noexcept { return 0; } static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr float_denorm_style has_denorm = denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr char32_t infinity() noexcept { return char32_t(); } static constexpr char32_t quiet_NaN() noexcept { return char32_t(); } static constexpr char32_t signaling_NaN() noexcept { return char32_t(); } static constexpr char32_t denorm_min() noexcept { return char32_t(); } static constexpr bool is_iec559 = false; static constexpr bool is_bounded = true; static constexpr bool is_modulo = !is_signed; static constexpr bool traps = __glibcxx_integral_traps; static constexpr bool tinyness_before = false; static constexpr float_round_style round_style = round_toward_zero; }; #endif /// numeric_limits<short> specialization. template<> struct numeric_limits<short> { static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; static _GLIBCXX_CONSTEXPR short min() _GLIBCXX_USE_NOEXCEPT { return -__SHRT_MAX__ - 1; } static _GLIBCXX_CONSTEXPR short max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__; } #if __cplusplus >= 201103L static constexpr short lowest() noexcept { return min(); } #endif static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (short); static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (short); #if __cplusplus >= 201103L static constexpr int max_digits10 = 0; #endif static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; static _GLIBCXX_USE_CONSTEXPR int radix = 2; static _GLIBCXX_CONSTEXPR short epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR short round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; static _GLIBCXX_CONSTEXPR short infinity() _GLIBCXX_USE_NOEXCEPT { return short(); } static _GLIBCXX_CONSTEXPR short quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return short(); } static _GLIBCXX_CONSTEXPR short signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return short(); } static _GLIBCXX_CONSTEXPR short denorm_min() _GLIBCXX_USE_NOEXCEPT { return short(); } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_toward_zero; }; /// numeric_limits<unsigned short> specialization. template<> struct numeric_limits<unsigned short> { static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; static _GLIBCXX_CONSTEXPR unsigned short min() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR unsigned short max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__ * 2U + 1; } #if __cplusplus >= 201103L static constexpr unsigned short lowest() noexcept { return min(); } #endif static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (unsigned short); static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (unsigned short); #if __cplusplus >= 201103L static constexpr int max_digits10 = 0; #endif static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; static _GLIBCXX_USE_CONSTEXPR int radix = 2; static _GLIBCXX_CONSTEXPR unsigned short epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR unsigned short round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; static _GLIBCXX_CONSTEXPR unsigned short infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned short>(0); } static _GLIBCXX_CONSTEXPR unsigned short quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned short>(0); } static _GLIBCXX_CONSTEXPR unsigned short signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned short>(0); } static _GLIBCXX_CONSTEXPR unsigned short denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned short>(0); } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_toward_zero; }; /// numeric_limits<int> specialization. template<> struct numeric_limits<int> { static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; static _GLIBCXX_CONSTEXPR int min() _GLIBCXX_USE_NOEXCEPT { return -__INT_MAX__ - 1; } static _GLIBCXX_CONSTEXPR int max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__; } #if __cplusplus >= 201103L static constexpr int lowest() noexcept { return min(); } #endif static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (int); static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (int); #if __cplusplus >= 201103L static constexpr int max_digits10 = 0; #endif static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; static _GLIBCXX_USE_CONSTEXPR int radix = 2; static _GLIBCXX_CONSTEXPR int epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR int round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; static _GLIBCXX_CONSTEXPR int infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } static _GLIBCXX_CONSTEXPR int quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } static _GLIBCXX_CONSTEXPR int signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } static _GLIBCXX_CONSTEXPR int denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_toward_zero; }; /// numeric_limits<unsigned int> specialization. template<> struct numeric_limits<unsigned int> { static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; static _GLIBCXX_CONSTEXPR unsigned int min() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR unsigned int max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__ * 2U + 1; } #if __cplusplus >= 201103L static constexpr unsigned int lowest() noexcept { return min(); } #endif static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (unsigned int); static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (unsigned int); #if __cplusplus >= 201103L static constexpr int max_digits10 = 0; #endif static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; static _GLIBCXX_USE_CONSTEXPR int radix = 2; static _GLIBCXX_CONSTEXPR unsigned int epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR unsigned int round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; static _GLIBCXX_CONSTEXPR unsigned int infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned int>(0); } static _GLIBCXX_CONSTEXPR unsigned int quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned int>(0); } static _GLIBCXX_CONSTEXPR unsigned int signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned int>(0); } static _GLIBCXX_CONSTEXPR unsigned int denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned int>(0); } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_toward_zero; }; /// numeric_limits<long> specialization. template<> struct numeric_limits<long> { static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; static _GLIBCXX_CONSTEXPR long min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_MAX__ - 1; } static _GLIBCXX_CONSTEXPR long max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__; } #if __cplusplus >= 201103L static constexpr long lowest() noexcept { return min(); } #endif static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (long); static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (long); #if __cplusplus >= 201103L static constexpr int max_digits10 = 0; #endif static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; static _GLIBCXX_USE_CONSTEXPR int radix = 2; static _GLIBCXX_CONSTEXPR long epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR long round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; static _GLIBCXX_CONSTEXPR long infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } static _GLIBCXX_CONSTEXPR long quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } static _GLIBCXX_CONSTEXPR long signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } static _GLIBCXX_CONSTEXPR long denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_toward_zero; }; /// numeric_limits<unsigned long> specialization. template<> struct numeric_limits<unsigned long> { static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; static _GLIBCXX_CONSTEXPR unsigned long min() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR unsigned long max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__ * 2UL + 1; } #if __cplusplus >= 201103L static constexpr unsigned long lowest() noexcept { return min(); } #endif static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (unsigned long); static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (unsigned long); #if __cplusplus >= 201103L static constexpr int max_digits10 = 0; #endif static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; static _GLIBCXX_USE_CONSTEXPR int radix = 2; static _GLIBCXX_CONSTEXPR unsigned long epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR unsigned long round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; static _GLIBCXX_CONSTEXPR unsigned long infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned long>(0); } static _GLIBCXX_CONSTEXPR unsigned long quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned long>(0); } static _GLIBCXX_CONSTEXPR unsigned long signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned long>(0); } static _GLIBCXX_CONSTEXPR unsigned long denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned long>(0); } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_toward_zero; }; /// numeric_limits<long long> specialization. template<> struct numeric_limits<long long> { static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; static _GLIBCXX_CONSTEXPR long long min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_LONG_MAX__ - 1; } static _GLIBCXX_CONSTEXPR long long max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__; } #if __cplusplus >= 201103L static constexpr long long lowest() noexcept { return min(); } #endif static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (long long); static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (long long); #if __cplusplus >= 201103L static constexpr int max_digits10 = 0; #endif static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; static _GLIBCXX_USE_CONSTEXPR int radix = 2; static _GLIBCXX_CONSTEXPR long long epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR long long round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; static _GLIBCXX_CONSTEXPR long long infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); } static _GLIBCXX_CONSTEXPR long long quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); } static _GLIBCXX_CONSTEXPR long long signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); } static _GLIBCXX_CONSTEXPR long long denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_toward_zero; }; /// numeric_limits<unsigned long long> specialization. template<> struct numeric_limits<unsigned long long> { static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; static _GLIBCXX_CONSTEXPR unsigned long long min() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR unsigned long long max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__ * 2ULL + 1; } #if __cplusplus >= 201103L static constexpr unsigned long long lowest() noexcept { return min(); } #endif static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (unsigned long long); static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (unsigned long long); #if __cplusplus >= 201103L static constexpr int max_digits10 = 0; #endif static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; static _GLIBCXX_USE_CONSTEXPR int radix = 2; static _GLIBCXX_CONSTEXPR unsigned long long epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR unsigned long long round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; static _GLIBCXX_CONSTEXPR unsigned long long infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned long long>(0); } static _GLIBCXX_CONSTEXPR unsigned long long quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned long long>(0); } static _GLIBCXX_CONSTEXPR unsigned long long signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned long long>(0); } static _GLIBCXX_CONSTEXPR unsigned long long denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned long long>(0); } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_toward_zero; }; #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128) /// numeric_limits<__int128> specialization. template<> struct numeric_limits<__int128> { static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; static _GLIBCXX_CONSTEXPR __int128 min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min (__int128); } static _GLIBCXX_CONSTEXPR __int128 max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max (__int128); } #if __cplusplus >= 201103L static constexpr __int128 lowest() noexcept { return min(); } #endif static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (__int128); static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (__int128); #if __cplusplus >= 201103L static constexpr int max_digits10 = 0; #endif static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; static _GLIBCXX_USE_CONSTEXPR int radix = 2; static _GLIBCXX_CONSTEXPR __int128 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR __int128 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; static _GLIBCXX_CONSTEXPR __int128 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<__int128>(0); } static _GLIBCXX_CONSTEXPR __int128 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<__int128>(0); } static _GLIBCXX_CONSTEXPR __int128 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<__int128>(0); } static _GLIBCXX_CONSTEXPR __int128 denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<__int128>(0); } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_toward_zero; }; /// numeric_limits<unsigned __int128> specialization. template<> struct numeric_limits<unsigned __int128> { static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; static _GLIBCXX_CONSTEXPR unsigned __int128 min() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR unsigned __int128 max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max (unsigned __int128); } #if __cplusplus >= 201103L static constexpr unsigned __int128 lowest() noexcept { return min(); } #endif static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (unsigned __int128); static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (unsigned __int128); #if __cplusplus >= 201103L static constexpr int max_digits10 = 0; #endif static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; static _GLIBCXX_USE_CONSTEXPR int radix = 2; static _GLIBCXX_CONSTEXPR unsigned __int128 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_CONSTEXPR unsigned __int128 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; static _GLIBCXX_CONSTEXPR unsigned __int128 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned __int128>(0); } static _GLIBCXX_CONSTEXPR unsigned __int128 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned __int128>(0); } static _GLIBCXX_CONSTEXPR unsigned __int128 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned __int128>(0); } static _GLIBCXX_CONSTEXPR unsigned __int128 denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned __int128>(0); } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_toward_zero; }; #endif /// numeric_limits<float> specialization. template<> struct numeric_limits<float> { static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; static _GLIBCXX_CONSTEXPR float min() _GLIBCXX_USE_NOEXCEPT { return __FLT_MIN__; } static _GLIBCXX_CONSTEXPR float max() _GLIBCXX_USE_NOEXCEPT { return __FLT_MAX__; } #if __cplusplus >= 201103L static constexpr float lowest() noexcept { return -__FLT_MAX__; } #endif static _GLIBCXX_USE_CONSTEXPR int digits = __FLT_MANT_DIG__; static _GLIBCXX_USE_CONSTEXPR int digits10 = __FLT_DIG__; #if __cplusplus >= 201103L static constexpr int max_digits10 = __glibcxx_max_digits10 (__FLT_MANT_DIG__); #endif static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; static _GLIBCXX_CONSTEXPR float epsilon() _GLIBCXX_USE_NOEXCEPT { return __FLT_EPSILON__; } static _GLIBCXX_CONSTEXPR float round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5F; } static _GLIBCXX_USE_CONSTEXPR int min_exponent = __FLT_MIN_EXP__; static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __FLT_MIN_10_EXP__; static _GLIBCXX_USE_CONSTEXPR int max_exponent = __FLT_MAX_EXP__; static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __FLT_MAX_10_EXP__; static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __FLT_HAS_INFINITY__; static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__; static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent; static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = __glibcxx_float_has_denorm_loss; static _GLIBCXX_CONSTEXPR float infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_valf(); } static _GLIBCXX_CONSTEXPR float quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nanf(""); } static _GLIBCXX_CONSTEXPR float signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nansf(""); } static _GLIBCXX_CONSTEXPR float denorm_min() _GLIBCXX_USE_NOEXCEPT { return __FLT_DENORM_MIN__; } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = has_infinity && has_quiet_NaN && has_denorm == denorm_present; static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_float_traps; static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = __glibcxx_float_tinyness_before; static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_to_nearest; }; #undef __glibcxx_float_has_denorm_loss #undef __glibcxx_float_traps #undef __glibcxx_float_tinyness_before /// numeric_limits<double> specialization. template<> struct numeric_limits<double> { static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; static _GLIBCXX_CONSTEXPR double min() _GLIBCXX_USE_NOEXCEPT { return __DBL_MIN__; } static _GLIBCXX_CONSTEXPR double max() _GLIBCXX_USE_NOEXCEPT { return __DBL_MAX__; } #if __cplusplus >= 201103L static constexpr double lowest() noexcept { return -__DBL_MAX__; } #endif static _GLIBCXX_USE_CONSTEXPR int digits = __DBL_MANT_DIG__; static _GLIBCXX_USE_CONSTEXPR int digits10 = __DBL_DIG__; #if __cplusplus >= 201103L static constexpr int max_digits10 = __glibcxx_max_digits10 (__DBL_MANT_DIG__); #endif static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; static _GLIBCXX_CONSTEXPR double epsilon() _GLIBCXX_USE_NOEXCEPT { return __DBL_EPSILON__; } static _GLIBCXX_CONSTEXPR double round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5; } static _GLIBCXX_USE_CONSTEXPR int min_exponent = __DBL_MIN_EXP__; static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __DBL_MIN_10_EXP__; static _GLIBCXX_USE_CONSTEXPR int max_exponent = __DBL_MAX_EXP__; static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __DBL_MAX_10_EXP__; static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __DBL_HAS_INFINITY__; static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__; static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent; static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = __glibcxx_double_has_denorm_loss; static _GLIBCXX_CONSTEXPR double infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_val(); } static _GLIBCXX_CONSTEXPR double quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nan(""); } static _GLIBCXX_CONSTEXPR double signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nans(""); } static _GLIBCXX_CONSTEXPR double denorm_min() _GLIBCXX_USE_NOEXCEPT { return __DBL_DENORM_MIN__; } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = has_infinity && has_quiet_NaN && has_denorm == denorm_present; static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_double_traps; static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = __glibcxx_double_tinyness_before; static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_to_nearest; }; #undef __glibcxx_double_has_denorm_loss #undef __glibcxx_double_traps #undef __glibcxx_double_tinyness_before /// numeric_limits<long double> specialization. template<> struct numeric_limits<long double> { static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; static _GLIBCXX_CONSTEXPR long double min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MIN__; } static _GLIBCXX_CONSTEXPR long double max() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MAX__; } #if __cplusplus >= 201103L static constexpr long double lowest() noexcept { return -__LDBL_MAX__; } #endif static _GLIBCXX_USE_CONSTEXPR int digits = __LDBL_MANT_DIG__; static _GLIBCXX_USE_CONSTEXPR int digits10 = __LDBL_DIG__; #if __cplusplus >= 201103L static _GLIBCXX_USE_CONSTEXPR int max_digits10 = __glibcxx_max_digits10 (__LDBL_MANT_DIG__); #endif static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; static _GLIBCXX_CONSTEXPR long double epsilon() _GLIBCXX_USE_NOEXCEPT { return __LDBL_EPSILON__; } static _GLIBCXX_CONSTEXPR long double round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5L; } static _GLIBCXX_USE_CONSTEXPR int min_exponent = __LDBL_MIN_EXP__; static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __LDBL_MIN_10_EXP__; static _GLIBCXX_USE_CONSTEXPR int max_exponent = __LDBL_MAX_EXP__; static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __LDBL_MAX_10_EXP__; static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __LDBL_HAS_INFINITY__; static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__; static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent; static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = __glibcxx_long_double_has_denorm_loss; static _GLIBCXX_CONSTEXPR long double infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_vall(); } static _GLIBCXX_CONSTEXPR long double quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nanl(""); } static _GLIBCXX_CONSTEXPR long double signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nansl(""); } static _GLIBCXX_CONSTEXPR long double denorm_min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_DENORM_MIN__; } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = has_infinity && has_quiet_NaN && has_denorm == denorm_present; static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_long_double_traps; static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = __glibcxx_long_double_tinyness_before; static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_to_nearest; }; #undef __glibcxx_long_double_has_denorm_loss #undef __glibcxx_long_double_traps #undef __glibcxx_long_double_tinyness_before _GLIBCXX_END_NAMESPACE_VERSION } // namespace #undef __glibcxx_signed #undef __glibcxx_min #undef __glibcxx_max #undef __glibcxx_digits #undef __glibcxx_digits10 #undef __glibcxx_max_digits10 #endif // _GLIBCXX_NUMERIC_LIMITS ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/cxxabi.h����������������������������������������������������������������������������������0000644�����������������00000052363�14763166027�0007241 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// ABI Support -*- C++ -*- // Copyright (C) 2000-2013 Free Software Foundation, Inc. // // This file is part of GCC. // // GCC 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 3, or (at your option) // any later version. // // GCC 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. // // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Written by Nathan Sidwell, Codesourcery LLC, <nathan@codesourcery.com> /* This file declares the new abi entry points into the runtime. It is not normally necessary for user programs to include this header, or use the entry points directly. However, this header is available should that be needed. Some of the entry points are intended for both C and C++, thus this header is includable from both C and C++. Though the C++ specific parts are not available in C, naturally enough. */ /** @file cxxabi.h * The header provides an interface to the C++ ABI. */ #ifndef _CXXABI_H #define _CXXABI_H 1 #pragma GCC system_header #pragma GCC visibility push(default) #include <stddef.h> #include <bits/c++config.h> #include <bits/cxxabi_tweaks.h> #include <bits/cxxabi_forced.h> #ifndef _GLIBCXX_CDTOR_CALLABI #define _GLIBCXX_CDTOR_CALLABI #endif #ifdef __cplusplus namespace __cxxabiv1 { extern "C" { #endif typedef __cxa_cdtor_return_type (*__cxa_cdtor_type)(void *); // Allocate array. void* __cxa_vec_new(size_t __element_count, size_t __element_size, size_t __padding_size, __cxa_cdtor_type __constructor, __cxa_cdtor_type __destructor); void* __cxa_vec_new2(size_t __element_count, size_t __element_size, size_t __padding_size, __cxa_cdtor_type __constructor, __cxa_cdtor_type __destructor, void *(*__alloc) (size_t), void (*__dealloc) (void*)); void* __cxa_vec_new3(size_t __element_count, size_t __element_size, size_t __padding_size, __cxa_cdtor_type __constructor, __cxa_cdtor_type __destructor, void *(*__alloc) (size_t), void (*__dealloc) (void*, size_t)); // Construct array. __cxa_vec_ctor_return_type __cxa_vec_ctor(void* __array_address, size_t __element_count, size_t __element_size, __cxa_cdtor_type __constructor, __cxa_cdtor_type __destructor); __cxa_vec_ctor_return_type __cxa_vec_cctor(void* __dest_array, void* __src_array, size_t __element_count, size_t __element_size, __cxa_cdtor_return_type (*__constructor) (void*, void*), __cxa_cdtor_type __destructor); // Destruct array. void __cxa_vec_dtor(void* __array_address, size_t __element_count, size_t __element_size, __cxa_cdtor_type __destructor); void __cxa_vec_cleanup(void* __array_address, size_t __element_count, size_t __s, __cxa_cdtor_type __destructor) _GLIBCXX_NOTHROW; // Destruct and release array. void __cxa_vec_delete(void* __array_address, size_t __element_size, size_t __padding_size, __cxa_cdtor_type __destructor); void __cxa_vec_delete2(void* __array_address, size_t __element_size, size_t __padding_size, __cxa_cdtor_type __destructor, void (*__dealloc) (void*)); void __cxa_vec_delete3(void* __array_address, size_t __element_size, size_t __padding_size, __cxa_cdtor_type __destructor, void (*__dealloc) (void*, size_t)); int __cxa_guard_acquire(__guard*); void __cxa_guard_release(__guard*) _GLIBCXX_NOTHROW; void __cxa_guard_abort(__guard*) _GLIBCXX_NOTHROW; // DSO destruction. int __cxa_atexit(void (*)(void*), void*, void*) _GLIBCXX_NOTHROW; int __cxa_finalize(void*); // TLS destruction. int __cxa_thread_atexit(void (*)(void*), void*, void *) _GLIBCXX_NOTHROW; // Pure virtual functions. void __cxa_pure_virtual(void) __attribute__ ((__noreturn__)); void __cxa_deleted_virtual(void) __attribute__ ((__noreturn__)); // Exception handling auxillary. void __cxa_bad_cast() __attribute__((__noreturn__)); void __cxa_bad_typeid() __attribute__((__noreturn__)); /** * @brief Demangling routine. * ABI-mandated entry point in the C++ runtime library for demangling. * * @param __mangled_name A NUL-terminated character string * containing the name to be demangled. * * @param __output_buffer A region of memory, allocated with * malloc, of @a *__length bytes, into which the demangled name is * stored. If @a __output_buffer is not long enough, it is * expanded using realloc. @a __output_buffer may instead be NULL; * in that case, the demangled name is placed in a region of memory * allocated with malloc. * * @param __length If @a __length is non-NULL, the length of the * buffer containing the demangled name is placed in @a *__length. * * @param __status @a *__status is set to one of the following values: * 0: The demangling operation succeeded. * -1: A memory allocation failure occurred. * -2: @a mangled_name is not a valid name under the C++ ABI mangling rules. * -3: One of the arguments is invalid. * * @return A pointer to the start of the NUL-terminated demangled * name, or NULL if the demangling fails. The caller is * responsible for deallocating this memory using @c free. * * The demangling is performed using the C++ ABI mangling rules, * with GNU extensions. For example, this function is used in * __gnu_cxx::__verbose_terminate_handler. * * See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt12ch39.html * for other examples of use. * * @note The same demangling functionality is available via * libiberty (@c <libiberty/demangle.h> and @c libiberty.a) in GCC * 3.1 and later, but that requires explicit installation (@c * --enable-install-libiberty) and uses a different API, although * the ABI is unchanged. */ char* __cxa_demangle(const char* __mangled_name, char* __output_buffer, size_t* __length, int* __status); #ifdef __cplusplus } } // namespace __cxxabiv1 #endif #ifdef __cplusplus #include <typeinfo> namespace __cxxabiv1 { // Type information for int, float etc. class __fundamental_type_info : public std::type_info { public: explicit __fundamental_type_info(const char* __n) : std::type_info(__n) { } virtual ~__fundamental_type_info(); }; // Type information for array objects. class __array_type_info : public std::type_info { public: explicit __array_type_info(const char* __n) : std::type_info(__n) { } virtual ~__array_type_info(); }; // Type information for functions (both member and non-member). class __function_type_info : public std::type_info { public: explicit __function_type_info(const char* __n) : std::type_info(__n) { } virtual ~__function_type_info(); protected: // Implementation defined member function. virtual bool __is_function_p() const; }; // Type information for enumerations. class __enum_type_info : public std::type_info { public: explicit __enum_type_info(const char* __n) : std::type_info(__n) { } virtual ~__enum_type_info(); }; // Common type information for simple pointers and pointers to member. class __pbase_type_info : public std::type_info { public: unsigned int __flags; // Qualification of the target object. const std::type_info* __pointee; // Type of pointed to object. explicit __pbase_type_info(const char* __n, int __quals, const std::type_info* __type) : std::type_info(__n), __flags(__quals), __pointee(__type) { } virtual ~__pbase_type_info(); // Implementation defined type. enum __masks { __const_mask = 0x1, __volatile_mask = 0x2, __restrict_mask = 0x4, __incomplete_mask = 0x8, __incomplete_class_mask = 0x10 }; protected: __pbase_type_info(const __pbase_type_info&); __pbase_type_info& operator=(const __pbase_type_info&); // Implementation defined member functions. virtual bool __do_catch(const std::type_info* __thr_type, void** __thr_obj, unsigned int __outer) const; inline virtual bool __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj, unsigned __outer) const; }; // Type information for simple pointers. class __pointer_type_info : public __pbase_type_info { public: explicit __pointer_type_info(const char* __n, int __quals, const std::type_info* __type) : __pbase_type_info (__n, __quals, __type) { } virtual ~__pointer_type_info(); protected: // Implementation defined member functions. virtual bool __is_pointer_p() const; virtual bool __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj, unsigned __outer) const; }; class __class_type_info; // Type information for a pointer to member variable. class __pointer_to_member_type_info : public __pbase_type_info { public: __class_type_info* __context; // Class of the member. explicit __pointer_to_member_type_info(const char* __n, int __quals, const std::type_info* __type, __class_type_info* __klass) : __pbase_type_info(__n, __quals, __type), __context(__klass) { } virtual ~__pointer_to_member_type_info(); protected: __pointer_to_member_type_info(const __pointer_to_member_type_info&); __pointer_to_member_type_info& operator=(const __pointer_to_member_type_info&); // Implementation defined member function. virtual bool __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj, unsigned __outer) const; }; // Helper class for __vmi_class_type. class __base_class_type_info { public: const __class_type_info* __base_type; // Base class type. #ifdef _GLIBCXX_LLP64 long long __offset_flags; // Offset and info. #else long __offset_flags; // Offset and info. #endif enum __offset_flags_masks { __virtual_mask = 0x1, __public_mask = 0x2, __hwm_bit = 2, __offset_shift = 8 // Bits to shift offset. }; // Implementation defined member functions. bool __is_virtual_p() const { return __offset_flags & __virtual_mask; } bool __is_public_p() const { return __offset_flags & __public_mask; } ptrdiff_t __offset() const { // This shift, being of a signed type, is implementation // defined. GCC implements such shifts as arithmetic, which is // what we want. return static_cast<ptrdiff_t>(__offset_flags) >> __offset_shift; } }; // Type information for a class. class __class_type_info : public std::type_info { public: explicit __class_type_info (const char *__n) : type_info(__n) { } virtual ~__class_type_info (); // Implementation defined types. // The type sub_kind tells us about how a base object is contained // within a derived object. We often do this lazily, hence the // UNKNOWN value. At other times we may use NOT_CONTAINED to mean // not publicly contained. enum __sub_kind { // We have no idea. __unknown = 0, // Not contained within us (in some circumstances this might // mean not contained publicly) __not_contained, // Contained ambiguously. __contained_ambig, // Via a virtual path. __contained_virtual_mask = __base_class_type_info::__virtual_mask, // Via a public path. __contained_public_mask = __base_class_type_info::__public_mask, // Contained within us. __contained_mask = 1 << __base_class_type_info::__hwm_bit, __contained_private = __contained_mask, __contained_public = __contained_mask | __contained_public_mask }; struct __upcast_result; struct __dyncast_result; protected: // Implementation defined member functions. virtual bool __do_upcast(const __class_type_info* __dst_type, void**__obj_ptr) const; virtual bool __do_catch(const type_info* __thr_type, void** __thr_obj, unsigned __outer) const; public: // Helper for upcast. See if DST is us, or one of our bases. // Return false if not found, true if found. virtual bool __do_upcast(const __class_type_info* __dst, const void* __obj, __upcast_result& __restrict __result) const; // Indicate whether SRC_PTR of type SRC_TYPE is contained publicly // within OBJ_PTR. OBJ_PTR points to a base object of our type, // which is the destination type. SRC2DST indicates how SRC // objects might be contained within this type. If SRC_PTR is one // of our SRC_TYPE bases, indicate the virtuality. Returns // not_contained for non containment or private containment. inline __sub_kind __find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr, const __class_type_info* __src_type, const void* __src_ptr) const; // Helper for dynamic cast. ACCESS_PATH gives the access from the // most derived object to this base. DST_TYPE indicates the // desired type we want. OBJ_PTR points to a base of our type // within the complete object. SRC_TYPE indicates the static type // started from and SRC_PTR points to that base within the most // derived object. Fill in RESULT with what we find. Return true // if we have located an ambiguous match. virtual bool __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path, const __class_type_info* __dst_type, const void* __obj_ptr, const __class_type_info* __src_type, const void* __src_ptr, __dyncast_result& __result) const; // Helper for find_public_subobj. SRC2DST indicates how SRC_TYPE // bases are inherited by the type started from -- which is not // necessarily the current type. The current type will be a base // of the destination type. OBJ_PTR points to the current base. virtual __sub_kind __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr, const __class_type_info* __src_type, const void* __src_ptr) const; }; // Type information for a class with a single non-virtual base. class __si_class_type_info : public __class_type_info { public: const __class_type_info* __base_type; explicit __si_class_type_info(const char *__n, const __class_type_info *__base) : __class_type_info(__n), __base_type(__base) { } virtual ~__si_class_type_info(); protected: __si_class_type_info(const __si_class_type_info&); __si_class_type_info& operator=(const __si_class_type_info&); // Implementation defined member functions. virtual bool __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path, const __class_type_info* __dst_type, const void* __obj_ptr, const __class_type_info* __src_type, const void* __src_ptr, __dyncast_result& __result) const; virtual __sub_kind __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr, const __class_type_info* __src_type, const void* __sub_ptr) const; virtual bool __do_upcast(const __class_type_info*__dst, const void*__obj, __upcast_result& __restrict __result) const; }; // Type information for a class with multiple and/or virtual bases. class __vmi_class_type_info : public __class_type_info { public: unsigned int __flags; // Details about the class hierarchy. unsigned int __base_count; // Number of direct bases. // The array of bases uses the trailing array struct hack so this // class is not constructable with a normal constructor. It is // internally generated by the compiler. __base_class_type_info __base_info[1]; // Array of bases. explicit __vmi_class_type_info(const char* __n, int ___flags) : __class_type_info(__n), __flags(___flags), __base_count(0) { } virtual ~__vmi_class_type_info(); // Implementation defined types. enum __flags_masks { __non_diamond_repeat_mask = 0x1, // Distinct instance of repeated base. __diamond_shaped_mask = 0x2, // Diamond shaped multiple inheritance. __flags_unknown_mask = 0x10 }; protected: // Implementation defined member functions. virtual bool __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path, const __class_type_info* __dst_type, const void* __obj_ptr, const __class_type_info* __src_type, const void* __src_ptr, __dyncast_result& __result) const; virtual __sub_kind __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr, const __class_type_info* __src_type, const void* __src_ptr) const; virtual bool __do_upcast(const __class_type_info* __dst, const void* __obj, __upcast_result& __restrict __result) const; }; // Exception handling forward declarations. struct __cxa_exception; struct __cxa_refcounted_exception; struct __cxa_dependent_exception; struct __cxa_eh_globals; extern "C" { // Dynamic cast runtime. // src2dst has the following possible values // >-1: src_type is a unique public non-virtual base of dst_type // dst_ptr + src2dst == src_ptr // -1: unspecified relationship // -2: src_type is not a public base of dst_type // -3: src_type is a multiple public non-virtual base of dst_type void* __dynamic_cast(const void* __src_ptr, // Starting object. const __class_type_info* __src_type, // Static type of object. const __class_type_info* __dst_type, // Desired target type. ptrdiff_t __src2dst); // How src and dst are related. // Exception handling runtime. // The __cxa_eh_globals for the current thread can be obtained by using // either of the following functions. The "fast" version assumes at least // one prior call of __cxa_get_globals has been made from the current // thread, so no initialization is necessary. __cxa_eh_globals* __cxa_get_globals() _GLIBCXX_NOTHROW __attribute__ ((__const__)); __cxa_eh_globals* __cxa_get_globals_fast() _GLIBCXX_NOTHROW __attribute__ ((__const__)); // Allocate memory for the primary exception plus the thrown object. void* __cxa_allocate_exception(size_t) _GLIBCXX_NOTHROW; // Free the space allocated for the primary exception. void __cxa_free_exception(void*) _GLIBCXX_NOTHROW; // Throw the exception. void __cxa_throw(void*, std::type_info*, void (_GLIBCXX_CDTOR_CALLABI *) (void *)) __attribute__((__noreturn__)); // Used to implement exception handlers. void* __cxa_get_exception_ptr(void*) _GLIBCXX_NOTHROW __attribute__ ((__pure__)); void* __cxa_begin_catch(void*) _GLIBCXX_NOTHROW; void __cxa_end_catch(); void __cxa_rethrow() __attribute__((__noreturn__)); // Returns the type_info for the currently handled exception [15.3/8], or // null if there is none. std::type_info* __cxa_current_exception_type() _GLIBCXX_NOTHROW __attribute__ ((__pure__)); // GNU Extensions. // Allocate memory for a dependent exception. __cxa_dependent_exception* __cxa_allocate_dependent_exception() _GLIBCXX_NOTHROW; // Free the space allocated for the dependent exception. void __cxa_free_dependent_exception(__cxa_dependent_exception*) _GLIBCXX_NOTHROW; } // extern "C" // A magic placeholder class that can be caught by reference // to recognize foreign exceptions. class __foreign_exception { virtual ~__foreign_exception() throw(); virtual void __pure_dummy() = 0; // prevent catch by value }; } // namespace __cxxabiv1 /** @namespace abi * @brief The cross-vendor C++ Application Binary Interface. A * namespace alias to __cxxabiv1, but user programs should use the * alias 'abi'. * * A brief overview of an ABI is given in the libstdc++ FAQ, question * 5.8 (you may have a copy of the FAQ locally, or you can view the online * version at http://gcc.gnu.org/onlinedocs/libstdc++/faq.html#5_8 ). * * GCC subscribes to a cross-vendor ABI for C++, sometimes * called the IA64 ABI because it happens to be the native ABI for that * platform. It is summarized at http://www.codesourcery.com/cxx-abi/ * along with the current specification. * * For users of GCC greater than or equal to 3.x, entry points are * available in <cxxabi.h>, which notes, <em>'It is not normally * necessary for user programs to include this header, or use the * entry points directly. However, this header is available should * that be needed.'</em> */ namespace abi = __cxxabiv1; namespace __gnu_cxx { /** * @brief Exception thrown by __cxa_guard_acquire. * @ingroup exceptions * * 6.7[stmt.dcl]/4: If control re-enters the declaration (recursively) * while the object is being initialized, the behavior is undefined. * * Since we already have a library function to handle locking, we might * as well check for this situation and throw an exception. * We use the second byte of the guard variable to remember that we're * in the middle of an initialization. */ class recursive_init_error: public std::exception { public: recursive_init_error() throw() { } virtual ~recursive_init_error() throw (); }; } #endif // __cplusplus #pragma GCC visibility pop #endif // __CXXABI_H �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/valarray����������������������������������������������������������������������������������0000644�����������������00000116503�14763166027�0007353 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// The template and inlines for the -*- C++ -*- valarray class. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/valarray * This is a Standard C++ Library header. */ // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr> #ifndef _GLIBCXX_VALARRAY #define _GLIBCXX_VALARRAY 1 #pragma GCC system_header #include <bits/c++config.h> #include <cmath> #include <algorithm> #include <debug/debug.h> #if __cplusplus >= 201103L #include <initializer_list> #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<class _Clos, typename _Tp> class _Expr; template<typename _Tp1, typename _Tp2> class _ValArray; template<class _Oper, template<class, class> class _Meta, class _Dom> struct _UnClos; template<class _Oper, template<class, class> class _Meta1, template<class, class> class _Meta2, class _Dom1, class _Dom2> class _BinClos; template<template<class, class> class _Meta, class _Dom> class _SClos; template<template<class, class> class _Meta, class _Dom> class _GClos; template<template<class, class> class _Meta, class _Dom> class _IClos; template<template<class, class> class _Meta, class _Dom> class _ValFunClos; template<template<class, class> class _Meta, class _Dom> class _RefFunClos; template<class _Tp> class valarray; // An array of type _Tp class slice; // BLAS-like slice out of an array template<class _Tp> class slice_array; class gslice; // generalized slice out of an array template<class _Tp> class gslice_array; template<class _Tp> class mask_array; // masked array template<class _Tp> class indirect_array; // indirected array _GLIBCXX_END_NAMESPACE_VERSION } // namespace #include <bits/valarray_array.h> #include <bits/valarray_before.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup numeric_arrays Numeric Arrays * @ingroup numerics * * Classes and functions for representing and manipulating arrays of elements. * @{ */ /** * @brief Smart array designed to support numeric processing. * * A valarray is an array that provides constraints intended to allow for * effective optimization of numeric array processing by reducing the * aliasing that can result from pointer representations. It represents a * one-dimensional array from which different multidimensional subsets can * be accessed and modified. * * @tparam _Tp Type of object in the array. */ template<class _Tp> class valarray { template<class _Op> struct _UnaryOp { typedef typename __fun<_Op, _Tp>::result_type __rt; typedef _Expr<_UnClos<_Op, _ValArray, _Tp>, __rt> _Rt; }; public: typedef _Tp value_type; // _lib.valarray.cons_ construct/destroy: /// Construct an empty array. valarray(); /// Construct an array with @a n elements. explicit valarray(size_t); /// Construct an array with @a n elements initialized to @a t. valarray(const _Tp&, size_t); /// Construct an array initialized to the first @a n elements of @a t. valarray(const _Tp* __restrict__, size_t); /// Copy constructor. valarray(const valarray&); #if __cplusplus >= 201103L /// Move constructor. valarray(valarray&&) noexcept; #endif /// Construct an array with the same size and values in @a sa. valarray(const slice_array<_Tp>&); /// Construct an array with the same size and values in @a ga. valarray(const gslice_array<_Tp>&); /// Construct an array with the same size and values in @a ma. valarray(const mask_array<_Tp>&); /// Construct an array with the same size and values in @a ia. valarray(const indirect_array<_Tp>&); #if __cplusplus >= 201103L /// Construct an array with an initializer_list of values. valarray(initializer_list<_Tp>); #endif template<class _Dom> valarray(const _Expr<_Dom, _Tp>& __e); ~valarray() _GLIBCXX_NOEXCEPT; // _lib.valarray.assign_ assignment: /** * @brief Assign elements to an array. * * Assign elements of array to values in @a v. * * @param __v Valarray to get values from. */ valarray<_Tp>& operator=(const valarray<_Tp>& __v); #if __cplusplus >= 201103L /** * @brief Move assign elements to an array. * * Move assign elements of array to values in @a v. * * @param __v Valarray to get values from. */ valarray<_Tp>& operator=(valarray<_Tp>&& __v) noexcept; #endif /** * @brief Assign elements to a value. * * Assign all elements of array to @a t. * * @param __t Value for elements. */ valarray<_Tp>& operator=(const _Tp& __t); /** * @brief Assign elements to an array subset. * * Assign elements of array to values in @a sa. Results are undefined * if @a sa does not have the same size as this array. * * @param __sa Array slice to get values from. */ valarray<_Tp>& operator=(const slice_array<_Tp>& __sa); /** * @brief Assign elements to an array subset. * * Assign elements of array to values in @a ga. Results are undefined * if @a ga does not have the same size as this array. * * @param __ga Array slice to get values from. */ valarray<_Tp>& operator=(const gslice_array<_Tp>& __ga); /** * @brief Assign elements to an array subset. * * Assign elements of array to values in @a ma. Results are undefined * if @a ma does not have the same size as this array. * * @param __ma Array slice to get values from. */ valarray<_Tp>& operator=(const mask_array<_Tp>& __ma); /** * @brief Assign elements to an array subset. * * Assign elements of array to values in @a ia. Results are undefined * if @a ia does not have the same size as this array. * * @param __ia Array slice to get values from. */ valarray<_Tp>& operator=(const indirect_array<_Tp>& __ia); #if __cplusplus >= 201103L /** * @brief Assign elements to an initializer_list. * * Assign elements of array to values in @a __l. Results are undefined * if @a __l does not have the same size as this array. * * @param __l initializer_list to get values from. */ valarray& operator=(initializer_list<_Tp> __l); #endif template<class _Dom> valarray<_Tp>& operator= (const _Expr<_Dom, _Tp>&); // _lib.valarray.access_ element access: /** * Return a reference to the i'th array element. * * @param __i Index of element to return. * @return Reference to the i'th element. */ _Tp& operator[](size_t __i); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 389. Const overload of valarray::operator[] returns by value. const _Tp& operator[](size_t) const; // _lib.valarray.sub_ subset operations: /** * @brief Return an array subset. * * Returns a new valarray containing the elements of the array * indicated by the slice argument. The new valarray has the same size * as the input slice. @see slice. * * @param __s The source slice. * @return New valarray containing elements in @a __s. */ _Expr<_SClos<_ValArray, _Tp>, _Tp> operator[](slice __s) const; /** * @brief Return a reference to an array subset. * * Returns a new valarray containing the elements of the array * indicated by the slice argument. The new valarray has the same size * as the input slice. @see slice. * * @param __s The source slice. * @return New valarray containing elements in @a __s. */ slice_array<_Tp> operator[](slice __s); /** * @brief Return an array subset. * * Returns a slice_array referencing the elements of the array * indicated by the slice argument. @see gslice. * * @param __s The source slice. * @return Slice_array referencing elements indicated by @a __s. */ _Expr<_GClos<_ValArray, _Tp>, _Tp> operator[](const gslice& __s) const; /** * @brief Return a reference to an array subset. * * Returns a new valarray containing the elements of the array * indicated by the gslice argument. The new valarray has * the same size as the input gslice. @see gslice. * * @param __s The source gslice. * @return New valarray containing elements in @a __s. */ gslice_array<_Tp> operator[](const gslice& __s); /** * @brief Return an array subset. * * Returns a new valarray containing the elements of the array * indicated by the argument. The input is a valarray of bool which * represents a bitmask indicating which elements should be copied into * the new valarray. Each element of the array is added to the return * valarray if the corresponding element of the argument is true. * * @param __m The valarray bitmask. * @return New valarray containing elements indicated by @a __m. */ valarray<_Tp> operator[](const valarray<bool>& __m) const; /** * @brief Return a reference to an array subset. * * Returns a new mask_array referencing the elements of the array * indicated by the argument. The input is a valarray of bool which * represents a bitmask indicating which elements are part of the * subset. Elements of the array are part of the subset if the * corresponding element of the argument is true. * * @param __m The valarray bitmask. * @return New valarray containing elements indicated by @a __m. */ mask_array<_Tp> operator[](const valarray<bool>& __m); /** * @brief Return an array subset. * * Returns a new valarray containing the elements of the array * indicated by the argument. The elements in the argument are * interpreted as the indices of elements of this valarray to copy to * the return valarray. * * @param __i The valarray element index list. * @return New valarray containing elements in @a __s. */ _Expr<_IClos<_ValArray, _Tp>, _Tp> operator[](const valarray<size_t>& __i) const; /** * @brief Return a reference to an array subset. * * Returns an indirect_array referencing the elements of the array * indicated by the argument. The elements in the argument are * interpreted as the indices of elements of this valarray to include * in the subset. The returned indirect_array refers to these * elements. * * @param __i The valarray element index list. * @return Indirect_array referencing elements in @a __i. */ indirect_array<_Tp> operator[](const valarray<size_t>& __i); // _lib.valarray.unary_ unary operators: /// Return a new valarray by applying unary + to each element. typename _UnaryOp<__unary_plus>::_Rt operator+() const; /// Return a new valarray by applying unary - to each element. typename _UnaryOp<__negate>::_Rt operator-() const; /// Return a new valarray by applying unary ~ to each element. typename _UnaryOp<__bitwise_not>::_Rt operator~() const; /// Return a new valarray by applying unary ! to each element. typename _UnaryOp<__logical_not>::_Rt operator!() const; // _lib.valarray.cassign_ computed assignment: /// Multiply each element of array by @a t. valarray<_Tp>& operator*=(const _Tp&); /// Divide each element of array by @a t. valarray<_Tp>& operator/=(const _Tp&); /// Set each element e of array to e % @a t. valarray<_Tp>& operator%=(const _Tp&); /// Add @a t to each element of array. valarray<_Tp>& operator+=(const _Tp&); /// Subtract @a t to each element of array. valarray<_Tp>& operator-=(const _Tp&); /// Set each element e of array to e ^ @a t. valarray<_Tp>& operator^=(const _Tp&); /// Set each element e of array to e & @a t. valarray<_Tp>& operator&=(const _Tp&); /// Set each element e of array to e | @a t. valarray<_Tp>& operator|=(const _Tp&); /// Left shift each element e of array by @a t bits. valarray<_Tp>& operator<<=(const _Tp&); /// Right shift each element e of array by @a t bits. valarray<_Tp>& operator>>=(const _Tp&); /// Multiply elements of array by corresponding elements of @a v. valarray<_Tp>& operator*=(const valarray<_Tp>&); /// Divide elements of array by corresponding elements of @a v. valarray<_Tp>& operator/=(const valarray<_Tp>&); /// Modulo elements of array by corresponding elements of @a v. valarray<_Tp>& operator%=(const valarray<_Tp>&); /// Add corresponding elements of @a v to elements of array. valarray<_Tp>& operator+=(const valarray<_Tp>&); /// Subtract corresponding elements of @a v from elements of array. valarray<_Tp>& operator-=(const valarray<_Tp>&); /// Logical xor corresponding elements of @a v with elements of array. valarray<_Tp>& operator^=(const valarray<_Tp>&); /// Logical or corresponding elements of @a v with elements of array. valarray<_Tp>& operator|=(const valarray<_Tp>&); /// Logical and corresponding elements of @a v with elements of array. valarray<_Tp>& operator&=(const valarray<_Tp>&); /// Left shift elements of array by corresponding elements of @a v. valarray<_Tp>& operator<<=(const valarray<_Tp>&); /// Right shift elements of array by corresponding elements of @a v. valarray<_Tp>& operator>>=(const valarray<_Tp>&); template<class _Dom> valarray<_Tp>& operator*=(const _Expr<_Dom, _Tp>&); template<class _Dom> valarray<_Tp>& operator/=(const _Expr<_Dom, _Tp>&); template<class _Dom> valarray<_Tp>& operator%=(const _Expr<_Dom, _Tp>&); template<class _Dom> valarray<_Tp>& operator+=(const _Expr<_Dom, _Tp>&); template<class _Dom> valarray<_Tp>& operator-=(const _Expr<_Dom, _Tp>&); template<class _Dom> valarray<_Tp>& operator^=(const _Expr<_Dom, _Tp>&); template<class _Dom> valarray<_Tp>& operator|=(const _Expr<_Dom, _Tp>&); template<class _Dom> valarray<_Tp>& operator&=(const _Expr<_Dom, _Tp>&); template<class _Dom> valarray<_Tp>& operator<<=(const _Expr<_Dom, _Tp>&); template<class _Dom> valarray<_Tp>& operator>>=(const _Expr<_Dom, _Tp>&); // _lib.valarray.members_ member functions: #if __cplusplus >= 201103L /// Swap. void swap(valarray<_Tp>& __v) noexcept; #endif /// Return the number of elements in array. size_t size() const; /** * @brief Return the sum of all elements in the array. * * Accumulates the sum of all elements into a Tp using +=. The order * of adding the elements is unspecified. */ _Tp sum() const; /// Return the minimum element using operator<(). _Tp min() const; /// Return the maximum element using operator<(). _Tp max() const; /** * @brief Return a shifted array. * * A new valarray is constructed as a copy of this array with elements * in shifted positions. For an element with index i, the new position * is i - n. The new valarray has the same size as the current one. * New elements without a value are set to 0. Elements whose new * position is outside the bounds of the array are discarded. * * Positive arguments shift toward index 0, discarding elements [0, n). * Negative arguments discard elements from the top of the array. * * @param __n Number of element positions to shift. * @return New valarray with elements in shifted positions. */ valarray<_Tp> shift (int __n) const; /** * @brief Return a rotated array. * * A new valarray is constructed as a copy of this array with elements * in shifted positions. For an element with index i, the new position * is (i - n) % size(). The new valarray has the same size as the * current one. Elements that are shifted beyond the array bounds are * shifted into the other end of the array. No elements are lost. * * Positive arguments shift toward index 0, wrapping around the top. * Negative arguments shift towards the top, wrapping around to 0. * * @param __n Number of element positions to rotate. * @return New valarray with elements in shifted positions. */ valarray<_Tp> cshift(int __n) const; /** * @brief Apply a function to the array. * * Returns a new valarray with elements assigned to the result of * applying func to the corresponding element of this array. The new * array has the same size as this one. * * @param func Function of Tp returning Tp to apply. * @return New valarray with transformed elements. */ _Expr<_ValFunClos<_ValArray, _Tp>, _Tp> apply(_Tp func(_Tp)) const; /** * @brief Apply a function to the array. * * Returns a new valarray with elements assigned to the result of * applying func to the corresponding element of this array. The new * array has the same size as this one. * * @param func Function of const Tp& returning Tp to apply. * @return New valarray with transformed elements. */ _Expr<_RefFunClos<_ValArray, _Tp>, _Tp> apply(_Tp func(const _Tp&)) const; /** * @brief Resize array. * * Resize this array to @a size and set all elements to @a c. All * references and iterators are invalidated. * * @param __size New array size. * @param __c New value for all elements. */ void resize(size_t __size, _Tp __c = _Tp()); private: size_t _M_size; _Tp* __restrict__ _M_data; friend class _Array<_Tp>; }; template<typename _Tp> inline const _Tp& valarray<_Tp>::operator[](size_t __i) const { __glibcxx_requires_subscript(__i); return _M_data[__i]; } template<typename _Tp> inline _Tp& valarray<_Tp>::operator[](size_t __i) { __glibcxx_requires_subscript(__i); return _M_data[__i]; } // @} group numeric_arrays _GLIBCXX_END_NAMESPACE_VERSION } // namespace #include <bits/valarray_after.h> #include <bits/slice_array.h> #include <bits/gslice.h> #include <bits/gslice_array.h> #include <bits/mask_array.h> #include <bits/indirect_array.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup numeric_arrays * @{ */ template<typename _Tp> inline valarray<_Tp>::valarray() : _M_size(0), _M_data(0) {} template<typename _Tp> inline valarray<_Tp>::valarray(size_t __n) : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n)) { std::__valarray_default_construct(_M_data, _M_data + __n); } template<typename _Tp> inline valarray<_Tp>::valarray(const _Tp& __t, size_t __n) : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n)) { std::__valarray_fill_construct(_M_data, _M_data + __n, __t); } template<typename _Tp> inline valarray<_Tp>::valarray(const _Tp* __restrict__ __p, size_t __n) : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n)) { _GLIBCXX_DEBUG_ASSERT(__p != 0 || __n == 0); std::__valarray_copy_construct(__p, __p + __n, _M_data); } template<typename _Tp> inline valarray<_Tp>::valarray(const valarray<_Tp>& __v) : _M_size(__v._M_size), _M_data(__valarray_get_storage<_Tp>(__v._M_size)) { std::__valarray_copy_construct(__v._M_data, __v._M_data + _M_size, _M_data); } #if __cplusplus >= 201103L template<typename _Tp> inline valarray<_Tp>::valarray(valarray<_Tp>&& __v) noexcept : _M_size(__v._M_size), _M_data(__v._M_data) { __v._M_size = 0; __v._M_data = 0; } #endif template<typename _Tp> inline valarray<_Tp>::valarray(const slice_array<_Tp>& __sa) : _M_size(__sa._M_sz), _M_data(__valarray_get_storage<_Tp>(__sa._M_sz)) { std::__valarray_copy_construct (__sa._M_array, __sa._M_sz, __sa._M_stride, _Array<_Tp>(_M_data)); } template<typename _Tp> inline valarray<_Tp>::valarray(const gslice_array<_Tp>& __ga) : _M_size(__ga._M_index.size()), _M_data(__valarray_get_storage<_Tp>(_M_size)) { std::__valarray_copy_construct (__ga._M_array, _Array<size_t>(__ga._M_index), _Array<_Tp>(_M_data), _M_size); } template<typename _Tp> inline valarray<_Tp>::valarray(const mask_array<_Tp>& __ma) : _M_size(__ma._M_sz), _M_data(__valarray_get_storage<_Tp>(__ma._M_sz)) { std::__valarray_copy_construct (__ma._M_array, __ma._M_mask, _Array<_Tp>(_M_data), _M_size); } template<typename _Tp> inline valarray<_Tp>::valarray(const indirect_array<_Tp>& __ia) : _M_size(__ia._M_sz), _M_data(__valarray_get_storage<_Tp>(__ia._M_sz)) { std::__valarray_copy_construct (__ia._M_array, __ia._M_index, _Array<_Tp>(_M_data), _M_size); } #if __cplusplus >= 201103L template<typename _Tp> inline valarray<_Tp>::valarray(initializer_list<_Tp> __l) : _M_size(__l.size()), _M_data(__valarray_get_storage<_Tp>(__l.size())) { std::__valarray_copy_construct(__l.begin(), __l.end(), _M_data); } #endif template<typename _Tp> template<class _Dom> inline valarray<_Tp>::valarray(const _Expr<_Dom, _Tp>& __e) : _M_size(__e.size()), _M_data(__valarray_get_storage<_Tp>(_M_size)) { std::__valarray_copy_construct(__e, _M_size, _Array<_Tp>(_M_data)); } template<typename _Tp> inline valarray<_Tp>::~valarray() _GLIBCXX_NOEXCEPT { std::__valarray_destroy_elements(_M_data, _M_data + _M_size); std::__valarray_release_memory(_M_data); } template<typename _Tp> inline valarray<_Tp>& valarray<_Tp>::operator=(const valarray<_Tp>& __v) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 630. arrays of valarray. if (_M_size == __v._M_size) std::__valarray_copy(__v._M_data, _M_size, _M_data); else { if (_M_data) { std::__valarray_destroy_elements(_M_data, _M_data + _M_size); std::__valarray_release_memory(_M_data); } _M_size = __v._M_size; _M_data = __valarray_get_storage<_Tp>(_M_size); std::__valarray_copy_construct(__v._M_data, __v._M_data + _M_size, _M_data); } return *this; } #if __cplusplus >= 201103L template<typename _Tp> inline valarray<_Tp>& valarray<_Tp>::operator=(valarray<_Tp>&& __v) noexcept { if (_M_data) { std::__valarray_destroy_elements(_M_data, _M_data + _M_size); std::__valarray_release_memory(_M_data); } _M_size = __v._M_size; _M_data = __v._M_data; __v._M_size = 0; __v._M_data = 0; return *this; } template<typename _Tp> inline valarray<_Tp>& valarray<_Tp>::operator=(initializer_list<_Tp> __l) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 630. arrays of valarray. if (_M_size == __l.size()) std::__valarray_copy(__l.begin(), __l.size(), _M_data); else { if (_M_data) { std::__valarray_destroy_elements(_M_data, _M_data + _M_size); std::__valarray_release_memory(_M_data); } _M_size = __l.size(); _M_data = __valarray_get_storage<_Tp>(_M_size); std::__valarray_copy_construct(__l.begin(), __l.begin() + _M_size, _M_data); } return *this; } #endif template<typename _Tp> inline valarray<_Tp>& valarray<_Tp>::operator=(const _Tp& __t) { std::__valarray_fill(_M_data, _M_size, __t); return *this; } template<typename _Tp> inline valarray<_Tp>& valarray<_Tp>::operator=(const slice_array<_Tp>& __sa) { _GLIBCXX_DEBUG_ASSERT(_M_size == __sa._M_sz); std::__valarray_copy(__sa._M_array, __sa._M_sz, __sa._M_stride, _Array<_Tp>(_M_data)); return *this; } template<typename _Tp> inline valarray<_Tp>& valarray<_Tp>::operator=(const gslice_array<_Tp>& __ga) { _GLIBCXX_DEBUG_ASSERT(_M_size == __ga._M_index.size()); std::__valarray_copy(__ga._M_array, _Array<size_t>(__ga._M_index), _Array<_Tp>(_M_data), _M_size); return *this; } template<typename _Tp> inline valarray<_Tp>& valarray<_Tp>::operator=(const mask_array<_Tp>& __ma) { _GLIBCXX_DEBUG_ASSERT(_M_size == __ma._M_sz); std::__valarray_copy(__ma._M_array, __ma._M_mask, _Array<_Tp>(_M_data), _M_size); return *this; } template<typename _Tp> inline valarray<_Tp>& valarray<_Tp>::operator=(const indirect_array<_Tp>& __ia) { _GLIBCXX_DEBUG_ASSERT(_M_size == __ia._M_sz); std::__valarray_copy(__ia._M_array, __ia._M_index, _Array<_Tp>(_M_data), _M_size); return *this; } template<typename _Tp> template<class _Dom> inline valarray<_Tp>& valarray<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 630. arrays of valarray. if (_M_size == __e.size()) std::__valarray_copy(__e, _M_size, _Array<_Tp>(_M_data)); else { if (_M_data) { std::__valarray_destroy_elements(_M_data, _M_data + _M_size); std::__valarray_release_memory(_M_data); } _M_size = __e.size(); _M_data = __valarray_get_storage<_Tp>(_M_size); std::__valarray_copy_construct(__e, _M_size, _Array<_Tp>(_M_data)); } return *this; } template<typename _Tp> inline _Expr<_SClos<_ValArray,_Tp>, _Tp> valarray<_Tp>::operator[](slice __s) const { typedef _SClos<_ValArray,_Tp> _Closure; return _Expr<_Closure, _Tp>(_Closure (_Array<_Tp>(_M_data), __s)); } template<typename _Tp> inline slice_array<_Tp> valarray<_Tp>::operator[](slice __s) { return slice_array<_Tp>(_Array<_Tp>(_M_data), __s); } template<typename _Tp> inline _Expr<_GClos<_ValArray,_Tp>, _Tp> valarray<_Tp>::operator[](const gslice& __gs) const { typedef _GClos<_ValArray,_Tp> _Closure; return _Expr<_Closure, _Tp> (_Closure(_Array<_Tp>(_M_data), __gs._M_index->_M_index)); } template<typename _Tp> inline gslice_array<_Tp> valarray<_Tp>::operator[](const gslice& __gs) { return gslice_array<_Tp> (_Array<_Tp>(_M_data), __gs._M_index->_M_index); } template<typename _Tp> inline valarray<_Tp> valarray<_Tp>::operator[](const valarray<bool>& __m) const { size_t __s = 0; size_t __e = __m.size(); for (size_t __i=0; __i<__e; ++__i) if (__m[__i]) ++__s; return valarray<_Tp>(mask_array<_Tp>(_Array<_Tp>(_M_data), __s, _Array<bool> (__m))); } template<typename _Tp> inline mask_array<_Tp> valarray<_Tp>::operator[](const valarray<bool>& __m) { size_t __s = 0; size_t __e = __m.size(); for (size_t __i=0; __i<__e; ++__i) if (__m[__i]) ++__s; return mask_array<_Tp>(_Array<_Tp>(_M_data), __s, _Array<bool>(__m)); } template<typename _Tp> inline _Expr<_IClos<_ValArray,_Tp>, _Tp> valarray<_Tp>::operator[](const valarray<size_t>& __i) const { typedef _IClos<_ValArray,_Tp> _Closure; return _Expr<_Closure, _Tp>(_Closure(*this, __i)); } template<typename _Tp> inline indirect_array<_Tp> valarray<_Tp>::operator[](const valarray<size_t>& __i) { return indirect_array<_Tp>(_Array<_Tp>(_M_data), __i.size(), _Array<size_t>(__i)); } #if __cplusplus >= 201103L template<class _Tp> inline void valarray<_Tp>::swap(valarray<_Tp>& __v) noexcept { std::swap(_M_size, __v._M_size); std::swap(_M_data, __v._M_data); } #endif template<class _Tp> inline size_t valarray<_Tp>::size() const { return _M_size; } template<class _Tp> inline _Tp valarray<_Tp>::sum() const { _GLIBCXX_DEBUG_ASSERT(_M_size > 0); return std::__valarray_sum(_M_data, _M_data + _M_size); } template<class _Tp> inline valarray<_Tp> valarray<_Tp>::shift(int __n) const { valarray<_Tp> __ret; if (_M_size == 0) return __ret; _Tp* __restrict__ __tmp_M_data = std::__valarray_get_storage<_Tp>(_M_size); if (__n == 0) std::__valarray_copy_construct(_M_data, _M_data + _M_size, __tmp_M_data); else if (__n > 0) // shift left { if (size_t(__n) > _M_size) __n = int(_M_size); std::__valarray_copy_construct(_M_data + __n, _M_data + _M_size, __tmp_M_data); std::__valarray_default_construct(__tmp_M_data + _M_size - __n, __tmp_M_data + _M_size); } else // shift right { if (-size_t(__n) > _M_size) __n = -int(_M_size); std::__valarray_copy_construct(_M_data, _M_data + _M_size + __n, __tmp_M_data - __n); std::__valarray_default_construct(__tmp_M_data, __tmp_M_data - __n); } __ret._M_size = _M_size; __ret._M_data = __tmp_M_data; return __ret; } template<class _Tp> inline valarray<_Tp> valarray<_Tp>::cshift(int __n) const { valarray<_Tp> __ret; if (_M_size == 0) return __ret; _Tp* __restrict__ __tmp_M_data = std::__valarray_get_storage<_Tp>(_M_size); if (__n == 0) std::__valarray_copy_construct(_M_data, _M_data + _M_size, __tmp_M_data); else if (__n > 0) // cshift left { if (size_t(__n) > _M_size) __n = int(__n % _M_size); std::__valarray_copy_construct(_M_data, _M_data + __n, __tmp_M_data + _M_size - __n); std::__valarray_copy_construct(_M_data + __n, _M_data + _M_size, __tmp_M_data); } else // cshift right { if (-size_t(__n) > _M_size) __n = -int(-size_t(__n) % _M_size); std::__valarray_copy_construct(_M_data + _M_size + __n, _M_data + _M_size, __tmp_M_data); std::__valarray_copy_construct(_M_data, _M_data + _M_size + __n, __tmp_M_data - __n); } __ret._M_size = _M_size; __ret._M_data = __tmp_M_data; return __ret; } template<class _Tp> inline void valarray<_Tp>::resize(size_t __n, _Tp __c) { // This complication is so to make valarray<valarray<T> > work // even though it is not required by the standard. Nobody should // be saying valarray<valarray<T> > anyway. See the specs. std::__valarray_destroy_elements(_M_data, _M_data + _M_size); if (_M_size != __n) { std::__valarray_release_memory(_M_data); _M_size = __n; _M_data = __valarray_get_storage<_Tp>(__n); } std::__valarray_fill_construct(_M_data, _M_data + __n, __c); } template<typename _Tp> inline _Tp valarray<_Tp>::min() const { _GLIBCXX_DEBUG_ASSERT(_M_size > 0); return *std::min_element(_M_data, _M_data + _M_size); } template<typename _Tp> inline _Tp valarray<_Tp>::max() const { _GLIBCXX_DEBUG_ASSERT(_M_size > 0); return *std::max_element(_M_data, _M_data + _M_size); } template<class _Tp> inline _Expr<_ValFunClos<_ValArray, _Tp>, _Tp> valarray<_Tp>::apply(_Tp func(_Tp)) const { typedef _ValFunClos<_ValArray, _Tp> _Closure; return _Expr<_Closure, _Tp>(_Closure(*this, func)); } template<class _Tp> inline _Expr<_RefFunClos<_ValArray, _Tp>, _Tp> valarray<_Tp>::apply(_Tp func(const _Tp &)) const { typedef _RefFunClos<_ValArray, _Tp> _Closure; return _Expr<_Closure, _Tp>(_Closure(*this, func)); } #define _DEFINE_VALARRAY_UNARY_OPERATOR(_Op, _Name) \ template<typename _Tp> \ inline typename valarray<_Tp>::template _UnaryOp<_Name>::_Rt \ valarray<_Tp>::operator _Op() const \ { \ typedef _UnClos<_Name, _ValArray, _Tp> _Closure; \ typedef typename __fun<_Name, _Tp>::result_type _Rt; \ return _Expr<_Closure, _Rt>(_Closure(*this)); \ } _DEFINE_VALARRAY_UNARY_OPERATOR(+, __unary_plus) _DEFINE_VALARRAY_UNARY_OPERATOR(-, __negate) _DEFINE_VALARRAY_UNARY_OPERATOR(~, __bitwise_not) _DEFINE_VALARRAY_UNARY_OPERATOR (!, __logical_not) #undef _DEFINE_VALARRAY_UNARY_OPERATOR #define _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(_Op, _Name) \ template<class _Tp> \ inline valarray<_Tp>& \ valarray<_Tp>::operator _Op##=(const _Tp &__t) \ { \ _Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, __t); \ return *this; \ } \ \ template<class _Tp> \ inline valarray<_Tp>& \ valarray<_Tp>::operator _Op##=(const valarray<_Tp> &__v) \ { \ _GLIBCXX_DEBUG_ASSERT(_M_size == __v._M_size); \ _Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, \ _Array<_Tp>(__v._M_data)); \ return *this; \ } _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(+, __plus) _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(-, __minus) _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(*, __multiplies) _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(/, __divides) _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(%, __modulus) _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(^, __bitwise_xor) _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(&, __bitwise_and) _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(|, __bitwise_or) _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(<<, __shift_left) _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(>>, __shift_right) #undef _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT #define _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(_Op, _Name) \ template<class _Tp> template<class _Dom> \ inline valarray<_Tp>& \ valarray<_Tp>::operator _Op##=(const _Expr<_Dom, _Tp>& __e) \ { \ _Array_augmented_##_Name(_Array<_Tp>(_M_data), __e, _M_size); \ return *this; \ } _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(+, __plus) _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(-, __minus) _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(*, __multiplies) _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(/, __divides) _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(%, __modulus) _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(^, __bitwise_xor) _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(&, __bitwise_and) _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(|, __bitwise_or) _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(<<, __shift_left) _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(>>, __shift_right) #undef _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT #define _DEFINE_BINARY_OPERATOR(_Op, _Name) \ template<typename _Tp> \ inline _Expr<_BinClos<_Name, _ValArray, _ValArray, _Tp, _Tp>, \ typename __fun<_Name, _Tp>::result_type> \ operator _Op(const valarray<_Tp>& __v, const valarray<_Tp>& __w) \ { \ _GLIBCXX_DEBUG_ASSERT(__v.size() == __w.size()); \ typedef _BinClos<_Name, _ValArray, _ValArray, _Tp, _Tp> _Closure; \ typedef typename __fun<_Name, _Tp>::result_type _Rt; \ return _Expr<_Closure, _Rt>(_Closure(__v, __w)); \ } \ \ template<typename _Tp> \ inline _Expr<_BinClos<_Name, _ValArray,_Constant, _Tp, _Tp>, \ typename __fun<_Name, _Tp>::result_type> \ operator _Op(const valarray<_Tp>& __v, const _Tp& __t) \ { \ typedef _BinClos<_Name, _ValArray, _Constant, _Tp, _Tp> _Closure; \ typedef typename __fun<_Name, _Tp>::result_type _Rt; \ return _Expr<_Closure, _Rt>(_Closure(__v, __t)); \ } \ \ template<typename _Tp> \ inline _Expr<_BinClos<_Name, _Constant, _ValArray, _Tp, _Tp>, \ typename __fun<_Name, _Tp>::result_type> \ operator _Op(const _Tp& __t, const valarray<_Tp>& __v) \ { \ typedef _BinClos<_Name, _Constant, _ValArray, _Tp, _Tp> _Closure; \ typedef typename __fun<_Name, _Tp>::result_type _Rt; \ return _Expr<_Closure, _Rt>(_Closure(__t, __v)); \ } _DEFINE_BINARY_OPERATOR(+, __plus) _DEFINE_BINARY_OPERATOR(-, __minus) _DEFINE_BINARY_OPERATOR(*, __multiplies) _DEFINE_BINARY_OPERATOR(/, __divides) _DEFINE_BINARY_OPERATOR(%, __modulus) _DEFINE_BINARY_OPERATOR(^, __bitwise_xor) _DEFINE_BINARY_OPERATOR(&, __bitwise_and) _DEFINE_BINARY_OPERATOR(|, __bitwise_or) _DEFINE_BINARY_OPERATOR(<<, __shift_left) _DEFINE_BINARY_OPERATOR(>>, __shift_right) _DEFINE_BINARY_OPERATOR(&&, __logical_and) _DEFINE_BINARY_OPERATOR(||, __logical_or) _DEFINE_BINARY_OPERATOR(==, __equal_to) _DEFINE_BINARY_OPERATOR(!=, __not_equal_to) _DEFINE_BINARY_OPERATOR(<, __less) _DEFINE_BINARY_OPERATOR(>, __greater) _DEFINE_BINARY_OPERATOR(<=, __less_equal) _DEFINE_BINARY_OPERATOR(>=, __greater_equal) #undef _DEFINE_BINARY_OPERATOR #if __cplusplus >= 201103L /** * @brief Return an iterator pointing to the first element of * the valarray. * @param __va valarray. */ template<class _Tp> inline _Tp* begin(valarray<_Tp>& __va) { return std::__addressof(__va[0]); } /** * @brief Return an iterator pointing to the first element of * the const valarray. * @param __va valarray. */ template<class _Tp> inline const _Tp* begin(const valarray<_Tp>& __va) { return std::__addressof(__va[0]); } /** * @brief Return an iterator pointing to one past the last element of * the valarray. * @param __va valarray. */ template<class _Tp> inline _Tp* end(valarray<_Tp>& __va) { return std::__addressof(__va[0]) + __va.size(); } /** * @brief Return an iterator pointing to one past the last element of * the const valarray. * @param __va valarray. */ template<class _Tp> inline const _Tp* end(const valarray<_Tp>& __va) { return std::__addressof(__va[0]) + __va.size(); } #endif // C++11 // @} group numeric_arrays _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _GLIBCXX_VALARRAY */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/scoped_allocator��������������������������������������������������������������������������0000644�����������������00000037227�14763166027�0011054 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <scoped_allocator> -*- C++ -*- // Copyright (C) 2011-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/scoped_allocator * This is a Standard C++ Library header. */ #ifndef _SCOPED_ALLOCATOR #define _SCOPED_ALLOCATOR 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <utility> #include <tuple> #include <bits/alloc_traits.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<template<typename> class _Pred, typename... _Allocs> struct __any_of; template<template<typename> class _Pred, typename _Alloc, typename... _Allocs> struct __any_of<_Pred, _Alloc, _Allocs...> : __or_<_Pred<_Alloc>, __any_of<_Pred, _Allocs...>> { }; template<template<typename> class _Pred, typename _Alloc> struct __any_of<_Pred, _Alloc> : _Pred<_Alloc> { }; /** * @addtogroup allocators * @{ */ template<typename _Alloc> struct __propagate_on_copy : allocator_traits<_Alloc>::propagate_on_container_copy_assignment { }; template<typename _Alloc> struct __propagate_on_move : allocator_traits<_Alloc>::propagate_on_container_move_assignment { }; template<typename _Alloc> struct __propagate_on_swap : allocator_traits<_Alloc>::propagate_on_container_swap { }; template<typename _Alloc> inline auto __do_outermost(_Alloc& __a, _Alloc*) -> decltype(__a.outer_allocator()) { return __a.outer_allocator(); } template<typename _Alloc> inline _Alloc& __do_outermost(_Alloc& __a, ...) { return __a; } // TODO: make recursive (see note in 20.12.4/1) template<typename _Alloc> inline auto __outermost(_Alloc& __a) -> decltype(__do_outermost(__a, &__a)) { return __do_outermost(__a, &__a); } template<typename _OuterAlloc, typename... _InnerAllocs> class scoped_allocator_adaptor; template<typename...> struct __inner_type_impl; template<typename _Outer> struct __inner_type_impl<_Outer> { typedef scoped_allocator_adaptor<_Outer> __type; __inner_type_impl() = default; __inner_type_impl(const __inner_type_impl&) = default; __inner_type_impl(__inner_type_impl&&) = default; __inner_type_impl& operator=(const __inner_type_impl&) = default; __inner_type_impl& operator=(__inner_type_impl&&) = default; template<typename _Alloc> __inner_type_impl(const __inner_type_impl<_Alloc>& __other) { } template<typename _Alloc> __inner_type_impl(__inner_type_impl<_Alloc>&& __other) { } __type& _M_get(__type* __p) noexcept { return *__p; } const __type& _M_get(const __type* __p) const noexcept { return *__p; } tuple<> _M_tie() const noexcept { return tuple<>(); } bool operator==(const __inner_type_impl&) const noexcept { return true; } }; template<typename _Outer, typename _InnerHead, typename... _InnerTail> struct __inner_type_impl<_Outer, _InnerHead, _InnerTail...> { typedef scoped_allocator_adaptor<_InnerHead, _InnerTail...> __type; __inner_type_impl() = default; __inner_type_impl(const __inner_type_impl&) = default; __inner_type_impl(__inner_type_impl&&) = default; __inner_type_impl& operator=(const __inner_type_impl&) = default; __inner_type_impl& operator=(__inner_type_impl&&) = default; template<typename... _Allocs> __inner_type_impl(const __inner_type_impl<_Allocs...>& __other) : _M_inner(__other._M_inner) { } template<typename... _Allocs> __inner_type_impl(__inner_type_impl<_Allocs...>&& __other) : _M_inner(std::move(__other._M_inner)) { } template<typename... _Args> explicit __inner_type_impl(_Args&&... __args) : _M_inner(std::forward<_Args>(__args)...) { } __type& _M_get(void*) noexcept { return _M_inner; } const __type& _M_get(const void*) const noexcept { return _M_inner; } tuple<const _InnerHead&, const _InnerTail&...> _M_tie() const noexcept { return _M_inner._M_tie(); } bool operator==(const __inner_type_impl& __other) const noexcept { return _M_inner == __other._M_inner; } private: template<typename...> friend class __inner_type_impl; template<typename, typename...> friend class scoped_allocator_adaptor; __type _M_inner; }; /// Primary class template. template<typename _OuterAlloc, typename... _InnerAllocs> class scoped_allocator_adaptor : public _OuterAlloc { typedef allocator_traits<_OuterAlloc> __traits; typedef __inner_type_impl<_OuterAlloc, _InnerAllocs...> __inner_type; __inner_type _M_inner; template<typename _Outer, typename... _Inner> friend class scoped_allocator_adaptor; template<typename...> friend class __inner_type_impl; tuple<const _OuterAlloc&, const _InnerAllocs&...> _M_tie() const noexcept { return std::tuple_cat(std::tie(outer_allocator()), _M_inner._M_tie()); } template<typename _Alloc> using __outermost_type = typename std::decay<decltype(__outermost(std::declval<_Alloc&>()))>::type; template<typename _Alloc> using __outermost_alloc_traits = allocator_traits<__outermost_type<_Alloc>>; template<typename _Tp, typename... _Args> void _M_construct(__uses_alloc0, _Tp* __p, _Args&&... __args) { typedef __outermost_alloc_traits<scoped_allocator_adaptor> _O_traits; _O_traits::construct(__outermost(*this), __p, std::forward<_Args>(__args)...); } typedef __uses_alloc1<typename __inner_type::__type> __uses_alloc1_; typedef __uses_alloc2<typename __inner_type::__type> __uses_alloc2_; template<typename _Tp, typename... _Args> void _M_construct(__uses_alloc1_, _Tp* __p, _Args&&... __args) { typedef __outermost_alloc_traits<scoped_allocator_adaptor> _O_traits; _O_traits::construct(__outermost(*this), __p, allocator_arg, inner_allocator(), std::forward<_Args>(__args)...); } template<typename _Tp, typename... _Args> void _M_construct(__uses_alloc2_, _Tp* __p, _Args&&... __args) { typedef __outermost_alloc_traits<scoped_allocator_adaptor> _O_traits; _O_traits::construct(__outermost(*this), __p, std::forward<_Args>(__args)..., inner_allocator()); } template<typename _Alloc> static _Alloc _S_select_on_copy(const _Alloc& __a) { typedef allocator_traits<_Alloc> __a_traits; return __a_traits::select_on_container_copy_construction(__a); } template<std::size_t... _Indices> scoped_allocator_adaptor(tuple<const _OuterAlloc&, const _InnerAllocs&...> __refs, _Index_tuple<_Indices...>) : _OuterAlloc(_S_select_on_copy(std::get<0>(__refs))), _M_inner(_S_select_on_copy(std::get<_Indices+1>(__refs))...) { } public: typedef _OuterAlloc outer_allocator_type; typedef typename __inner_type::__type inner_allocator_type; typedef typename __traits::value_type value_type; typedef typename __traits::size_type size_type; typedef typename __traits::difference_type difference_type; typedef typename __traits::pointer pointer; typedef typename __traits::const_pointer const_pointer; typedef typename __traits::void_pointer void_pointer; typedef typename __traits::const_void_pointer const_void_pointer; typedef typename conditional< __any_of<__propagate_on_copy, _OuterAlloc, _InnerAllocs...>::value, true_type, false_type>::type propagate_on_container_copy_assignment; typedef typename conditional< __any_of<__propagate_on_move, _OuterAlloc, _InnerAllocs...>::value, true_type, false_type>::type propagate_on_container_move_assignment; typedef typename conditional< __any_of<__propagate_on_swap, _OuterAlloc, _InnerAllocs...>::value, true_type, false_type>::type propagate_on_container_swap; template <class _Tp> struct rebind { typedef scoped_allocator_adaptor< typename __traits::template rebind_alloc<_Tp>, _InnerAllocs...> other; }; scoped_allocator_adaptor() : _OuterAlloc(), _M_inner() { } template<typename _Outer2> scoped_allocator_adaptor(_Outer2&& __outer, const _InnerAllocs&... __inner) : _OuterAlloc(std::forward<_Outer2>(__outer)), _M_inner(__inner...) { } scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) : _OuterAlloc(__other.outer_allocator()), _M_inner(__other._M_inner) { } scoped_allocator_adaptor(scoped_allocator_adaptor&& __other) : _OuterAlloc(std::move(__other.outer_allocator())), _M_inner(std::move(__other._M_inner)) { } template<typename _Outer2> scoped_allocator_adaptor( const scoped_allocator_adaptor<_Outer2, _InnerAllocs...>& __other) : _OuterAlloc(__other.outer_allocator()), _M_inner(__other._M_inner) { } template<typename _Outer2> scoped_allocator_adaptor( scoped_allocator_adaptor<_Outer2, _InnerAllocs...>&& __other) : _OuterAlloc(std::move(__other.outer_allocator())), _M_inner(std::move(__other._M_inner)) { } scoped_allocator_adaptor& operator=(const scoped_allocator_adaptor&) = default; scoped_allocator_adaptor& operator=(scoped_allocator_adaptor&&) = default; inner_allocator_type& inner_allocator() noexcept { return _M_inner._M_get(this); } const inner_allocator_type& inner_allocator() const noexcept { return _M_inner._M_get(this); } outer_allocator_type& outer_allocator() noexcept { return static_cast<_OuterAlloc&>(*this); } const outer_allocator_type& outer_allocator() const noexcept { return static_cast<const _OuterAlloc&>(*this); } pointer allocate(size_type __n) { return __traits::allocate(outer_allocator(), __n); } pointer allocate(size_type __n, const_void_pointer __hint) { return __traits::allocate(outer_allocator(), __n, __hint); } void deallocate(pointer __p, size_type __n) { return __traits::deallocate(outer_allocator(), __p, __n); } size_type max_size() const { return __traits::max_size(outer_allocator()); } template<typename _Tp, typename... _Args> void construct(_Tp* __p, _Args&&... __args) { auto& __inner = inner_allocator(); auto __use_tag = __use_alloc<_Tp, inner_allocator_type, _Args...>(__inner); _M_construct(__use_tag, __p, std::forward<_Args>(__args)...); } template<typename _T1, typename _T2, typename... _Args1, typename... _Args2> void construct(pair<_T1, _T2>* __p, piecewise_construct_t, tuple<_Args1...> __x, tuple<_Args2...> __y) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2203. wrong argument types for piecewise construction auto& __inner = inner_allocator(); auto __x_use_tag = __use_alloc<_T1, inner_allocator_type, _Args1...>(__inner); auto __y_use_tag = __use_alloc<_T2, inner_allocator_type, _Args2...>(__inner); typedef __outermost_alloc_traits<scoped_allocator_adaptor> _O_traits; _O_traits::construct(__outermost(*this), __p, piecewise_construct, _M_construct_p(__x_use_tag, __x), _M_construct_p(__y_use_tag, __y)); } template<typename _T1, typename _T2> void construct(pair<_T1, _T2>* __p) { construct(__p, piecewise_construct, tuple<>(), tuple<>()); } template<typename _T1, typename _T2, typename _Up, typename _Vp> void construct(pair<_T1, _T2>* __p, _Up&& __u, _Vp&& __v) { construct(__p, piecewise_construct, std::forward_as_tuple(std::forward<_Up>(__u)), std::forward_as_tuple(std::forward<_Vp>(__v))); } template<typename _T1, typename _T2, typename _Up, typename _Vp> void construct(pair<_T1, _T2>* __p, const pair<_Up, _Vp>& __x) { construct(__p, piecewise_construct, std::forward_as_tuple(__x.first), std::forward_as_tuple(__x.second)); } template<typename _T1, typename _T2, typename _Up, typename _Vp> void construct(pair<_T1, _T2>* __p, pair<_Up, _Vp>&& __x) { construct(__p, piecewise_construct, std::forward_as_tuple(std::forward<_Up>(__x.first)), std::forward_as_tuple(std::forward<_Vp>(__x.second))); } template<typename _Tp> void destroy(_Tp* __p) { typedef __outermost_alloc_traits<scoped_allocator_adaptor> _O_traits; _O_traits::destroy(__outermost(*this), __p); } scoped_allocator_adaptor select_on_container_copy_construction() const { typedef typename _Build_index_tuple<sizeof...(_InnerAllocs)>::__type _Indices; return scoped_allocator_adaptor(_M_tie(), _Indices()); } template <typename _OutA1, typename _OutA2, typename... _InA> friend bool operator==(const scoped_allocator_adaptor<_OutA1, _InA...>& __a, const scoped_allocator_adaptor<_OutA2, _InA...>& __b) noexcept; private: template<typename _Tuple> _Tuple&& _M_construct_p(__uses_alloc0, _Tuple& __t) { return std::move(__t); } template<typename... _Args> std::tuple<allocator_arg_t, inner_allocator_type&, _Args...> _M_construct_p(__uses_alloc1_, std::tuple<_Args...>& __t) { typedef std::tuple<allocator_arg_t, inner_allocator_type&> _Tuple; return std::tuple_cat(_Tuple(allocator_arg, inner_allocator()), std::move(__t)); } template<typename... _Args> std::tuple<_Args..., inner_allocator_type&> _M_construct_p(__uses_alloc2_, std::tuple<_Args...>& __t) { typedef std::tuple<inner_allocator_type&> _Tuple; return std::tuple_cat(std::move(__t), _Tuple(inner_allocator())); } }; template <typename _OutA1, typename _OutA2, typename... _InA> inline bool operator==(const scoped_allocator_adaptor<_OutA1, _InA...>& __a, const scoped_allocator_adaptor<_OutA2, _InA...>& __b) noexcept { return __a.outer_allocator() == __b.outer_allocator() && __a._M_inner == __b._M_inner; } template <typename _OutA1, typename _OutA2, typename... _InA> inline bool operator!=(const scoped_allocator_adaptor<_OutA1, _InA...>& __a, const scoped_allocator_adaptor<_OutA2, _InA...>& __b) noexcept { return !(__a == __b); } /// @} _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // C++11 #endif // _SCOPED_ALLOCATOR �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/ell_integral.tcc����������������������������������������������������������������������0000644�����������������00000065552�14763166027�0011460 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Special functions -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/ell_integral.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{tr1/cmath} */ // // ISO C++ 14882 TR1: 5.2 Special functions // // Written by Edward Smith-Rowland based on: // (1) B. C. Carlson Numer. Math. 33, 1 (1979) // (2) B. C. Carlson, Special Functions of Applied Mathematics (1977) // (3) The Gnu Scientific Library, http://www.gnu.org/software/gsl // (4) Numerical Recipes in C, 2nd ed, by W. H. Press, S. A. Teukolsky, // W. T. Vetterling, B. P. Flannery, Cambridge University Press // (1992), pp. 261-269 #ifndef _GLIBCXX_TR1_ELL_INTEGRAL_TCC #define _GLIBCXX_TR1_ELL_INTEGRAL_TCC 1 namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { // [5.2] Special functions // Implementation-space details. namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Return the Carlson elliptic function @f$ R_F(x,y,z) @f$ * of the first kind. * * The Carlson elliptic function of the first kind is defined by: * @f[ * R_F(x,y,z) = \frac{1}{2} \int_0^\infty * \frac{dt}{(t + x)^{1/2}(t + y)^{1/2}(t + z)^{1/2}} * @f] * * @param __x The first of three symmetric arguments. * @param __y The second of three symmetric arguments. * @param __z The third of three symmetric arguments. * @return The Carlson elliptic function of the first kind. */ template<typename _Tp> _Tp __ellint_rf(_Tp __x, _Tp __y, _Tp __z) { const _Tp __min = std::numeric_limits<_Tp>::min(); const _Tp __max = std::numeric_limits<_Tp>::max(); const _Tp __lolim = _Tp(5) * __min; const _Tp __uplim = __max / _Tp(5); if (__x < _Tp(0) || __y < _Tp(0) || __z < _Tp(0)) std::__throw_domain_error(__N("Argument less than zero " "in __ellint_rf.")); else if (__x + __y < __lolim || __x + __z < __lolim || __y + __z < __lolim) std::__throw_domain_error(__N("Argument too small in __ellint_rf")); else { const _Tp __c0 = _Tp(1) / _Tp(4); const _Tp __c1 = _Tp(1) / _Tp(24); const _Tp __c2 = _Tp(1) / _Tp(10); const _Tp __c3 = _Tp(3) / _Tp(44); const _Tp __c4 = _Tp(1) / _Tp(14); _Tp __xn = __x; _Tp __yn = __y; _Tp __zn = __z; const _Tp __eps = std::numeric_limits<_Tp>::epsilon(); const _Tp __errtol = std::pow(__eps, _Tp(1) / _Tp(6)); _Tp __mu; _Tp __xndev, __yndev, __zndev; const unsigned int __max_iter = 100; for (unsigned int __iter = 0; __iter < __max_iter; ++__iter) { __mu = (__xn + __yn + __zn) / _Tp(3); __xndev = 2 - (__mu + __xn) / __mu; __yndev = 2 - (__mu + __yn) / __mu; __zndev = 2 - (__mu + __zn) / __mu; _Tp __epsilon = std::max(std::abs(__xndev), std::abs(__yndev)); __epsilon = std::max(__epsilon, std::abs(__zndev)); if (__epsilon < __errtol) break; const _Tp __xnroot = std::sqrt(__xn); const _Tp __ynroot = std::sqrt(__yn); const _Tp __znroot = std::sqrt(__zn); const _Tp __lambda = __xnroot * (__ynroot + __znroot) + __ynroot * __znroot; __xn = __c0 * (__xn + __lambda); __yn = __c0 * (__yn + __lambda); __zn = __c0 * (__zn + __lambda); } const _Tp __e2 = __xndev * __yndev - __zndev * __zndev; const _Tp __e3 = __xndev * __yndev * __zndev; const _Tp __s = _Tp(1) + (__c1 * __e2 - __c2 - __c3 * __e3) * __e2 + __c4 * __e3; return __s / std::sqrt(__mu); } } /** * @brief Return the complete elliptic integral of the first kind * @f$ K(k) @f$ by series expansion. * * The complete elliptic integral of the first kind is defined as * @f[ * K(k) = F(k,\pi/2) = \int_0^{\pi/2}\frac{d\theta} * {\sqrt{1 - k^2sin^2\theta}} * @f] * * This routine is not bad as long as |k| is somewhat smaller than 1 * but is not is good as the Carlson elliptic integral formulation. * * @param __k The argument of the complete elliptic function. * @return The complete elliptic function of the first kind. */ template<typename _Tp> _Tp __comp_ellint_1_series(_Tp __k) { const _Tp __kk = __k * __k; _Tp __term = __kk / _Tp(4); _Tp __sum = _Tp(1) + __term; const unsigned int __max_iter = 1000; for (unsigned int __i = 2; __i < __max_iter; ++__i) { __term *= (2 * __i - 1) * __kk / (2 * __i); if (__term < std::numeric_limits<_Tp>::epsilon()) break; __sum += __term; } return __numeric_constants<_Tp>::__pi_2() * __sum; } /** * @brief Return the complete elliptic integral of the first kind * @f$ K(k) @f$ using the Carlson formulation. * * The complete elliptic integral of the first kind is defined as * @f[ * K(k) = F(k,\pi/2) = \int_0^{\pi/2}\frac{d\theta} * {\sqrt{1 - k^2 sin^2\theta}} * @f] * where @f$ F(k,\phi) @f$ is the incomplete elliptic integral of the * first kind. * * @param __k The argument of the complete elliptic function. * @return The complete elliptic function of the first kind. */ template<typename _Tp> _Tp __comp_ellint_1(_Tp __k) { if (__isnan(__k)) return std::numeric_limits<_Tp>::quiet_NaN(); else if (std::abs(__k) >= _Tp(1)) return std::numeric_limits<_Tp>::quiet_NaN(); else return __ellint_rf(_Tp(0), _Tp(1) - __k * __k, _Tp(1)); } /** * @brief Return the incomplete elliptic integral of the first kind * @f$ F(k,\phi) @f$ using the Carlson formulation. * * The incomplete elliptic integral of the first kind is defined as * @f[ * F(k,\phi) = \int_0^{\phi}\frac{d\theta} * {\sqrt{1 - k^2 sin^2\theta}} * @f] * * @param __k The argument of the elliptic function. * @param __phi The integral limit argument of the elliptic function. * @return The elliptic function of the first kind. */ template<typename _Tp> _Tp __ellint_1(_Tp __k, _Tp __phi) { if (__isnan(__k) || __isnan(__phi)) return std::numeric_limits<_Tp>::quiet_NaN(); else if (std::abs(__k) > _Tp(1)) std::__throw_domain_error(__N("Bad argument in __ellint_1.")); else { // Reduce phi to -pi/2 < phi < +pi/2. const int __n = std::floor(__phi / __numeric_constants<_Tp>::__pi() + _Tp(0.5L)); const _Tp __phi_red = __phi - __n * __numeric_constants<_Tp>::__pi(); const _Tp __s = std::sin(__phi_red); const _Tp __c = std::cos(__phi_red); const _Tp __F = __s * __ellint_rf(__c * __c, _Tp(1) - __k * __k * __s * __s, _Tp(1)); if (__n == 0) return __F; else return __F + _Tp(2) * __n * __comp_ellint_1(__k); } } /** * @brief Return the complete elliptic integral of the second kind * @f$ E(k) @f$ by series expansion. * * The complete elliptic integral of the second kind is defined as * @f[ * E(k,\pi/2) = \int_0^{\pi/2}\sqrt{1 - k^2 sin^2\theta} * @f] * * This routine is not bad as long as |k| is somewhat smaller than 1 * but is not is good as the Carlson elliptic integral formulation. * * @param __k The argument of the complete elliptic function. * @return The complete elliptic function of the second kind. */ template<typename _Tp> _Tp __comp_ellint_2_series(_Tp __k) { const _Tp __kk = __k * __k; _Tp __term = __kk; _Tp __sum = __term; const unsigned int __max_iter = 1000; for (unsigned int __i = 2; __i < __max_iter; ++__i) { const _Tp __i2m = 2 * __i - 1; const _Tp __i2 = 2 * __i; __term *= __i2m * __i2m * __kk / (__i2 * __i2); if (__term < std::numeric_limits<_Tp>::epsilon()) break; __sum += __term / __i2m; } return __numeric_constants<_Tp>::__pi_2() * (_Tp(1) - __sum); } /** * @brief Return the Carlson elliptic function of the second kind * @f$ R_D(x,y,z) = R_J(x,y,z,z) @f$ where * @f$ R_J(x,y,z,p) @f$ is the Carlson elliptic function * of the third kind. * * The Carlson elliptic function of the second kind is defined by: * @f[ * R_D(x,y,z) = \frac{3}{2} \int_0^\infty * \frac{dt}{(t + x)^{1/2}(t + y)^{1/2}(t + z)^{3/2}} * @f] * * Based on Carlson's algorithms: * - B. C. Carlson Numer. Math. 33, 1 (1979) * - B. C. Carlson, Special Functions of Applied Mathematics (1977) * - Numerical Recipes in C, 2nd ed, pp. 261-269, * by Press, Teukolsky, Vetterling, Flannery (1992) * * @param __x The first of two symmetric arguments. * @param __y The second of two symmetric arguments. * @param __z The third argument. * @return The Carlson elliptic function of the second kind. */ template<typename _Tp> _Tp __ellint_rd(_Tp __x, _Tp __y, _Tp __z) { const _Tp __eps = std::numeric_limits<_Tp>::epsilon(); const _Tp __errtol = std::pow(__eps / _Tp(8), _Tp(1) / _Tp(6)); const _Tp __min = std::numeric_limits<_Tp>::min(); const _Tp __max = std::numeric_limits<_Tp>::max(); const _Tp __lolim = _Tp(2) / std::pow(__max, _Tp(2) / _Tp(3)); const _Tp __uplim = std::pow(_Tp(0.1L) * __errtol / __min, _Tp(2) / _Tp(3)); if (__x < _Tp(0) || __y < _Tp(0)) std::__throw_domain_error(__N("Argument less than zero " "in __ellint_rd.")); else if (__x + __y < __lolim || __z < __lolim) std::__throw_domain_error(__N("Argument too small " "in __ellint_rd.")); else { const _Tp __c0 = _Tp(1) / _Tp(4); const _Tp __c1 = _Tp(3) / _Tp(14); const _Tp __c2 = _Tp(1) / _Tp(6); const _Tp __c3 = _Tp(9) / _Tp(22); const _Tp __c4 = _Tp(3) / _Tp(26); _Tp __xn = __x; _Tp __yn = __y; _Tp __zn = __z; _Tp __sigma = _Tp(0); _Tp __power4 = _Tp(1); _Tp __mu; _Tp __xndev, __yndev, __zndev; const unsigned int __max_iter = 100; for (unsigned int __iter = 0; __iter < __max_iter; ++__iter) { __mu = (__xn + __yn + _Tp(3) * __zn) / _Tp(5); __xndev = (__mu - __xn) / __mu; __yndev = (__mu - __yn) / __mu; __zndev = (__mu - __zn) / __mu; _Tp __epsilon = std::max(std::abs(__xndev), std::abs(__yndev)); __epsilon = std::max(__epsilon, std::abs(__zndev)); if (__epsilon < __errtol) break; _Tp __xnroot = std::sqrt(__xn); _Tp __ynroot = std::sqrt(__yn); _Tp __znroot = std::sqrt(__zn); _Tp __lambda = __xnroot * (__ynroot + __znroot) + __ynroot * __znroot; __sigma += __power4 / (__znroot * (__zn + __lambda)); __power4 *= __c0; __xn = __c0 * (__xn + __lambda); __yn = __c0 * (__yn + __lambda); __zn = __c0 * (__zn + __lambda); } // Note: __ea is an SPU badname. _Tp __eaa = __xndev * __yndev; _Tp __eb = __zndev * __zndev; _Tp __ec = __eaa - __eb; _Tp __ed = __eaa - _Tp(6) * __eb; _Tp __ef = __ed + __ec + __ec; _Tp __s1 = __ed * (-__c1 + __c3 * __ed / _Tp(3) - _Tp(3) * __c4 * __zndev * __ef / _Tp(2)); _Tp __s2 = __zndev * (__c2 * __ef + __zndev * (-__c3 * __ec - __zndev * __c4 - __eaa)); return _Tp(3) * __sigma + __power4 * (_Tp(1) + __s1 + __s2) / (__mu * std::sqrt(__mu)); } } /** * @brief Return the complete elliptic integral of the second kind * @f$ E(k) @f$ using the Carlson formulation. * * The complete elliptic integral of the second kind is defined as * @f[ * E(k,\pi/2) = \int_0^{\pi/2}\sqrt{1 - k^2 sin^2\theta} * @f] * * @param __k The argument of the complete elliptic function. * @return The complete elliptic function of the second kind. */ template<typename _Tp> _Tp __comp_ellint_2(_Tp __k) { if (__isnan(__k)) return std::numeric_limits<_Tp>::quiet_NaN(); else if (std::abs(__k) == 1) return _Tp(1); else if (std::abs(__k) > _Tp(1)) std::__throw_domain_error(__N("Bad argument in __comp_ellint_2.")); else { const _Tp __kk = __k * __k; return __ellint_rf(_Tp(0), _Tp(1) - __kk, _Tp(1)) - __kk * __ellint_rd(_Tp(0), _Tp(1) - __kk, _Tp(1)) / _Tp(3); } } /** * @brief Return the incomplete elliptic integral of the second kind * @f$ E(k,\phi) @f$ using the Carlson formulation. * * The incomplete elliptic integral of the second kind is defined as * @f[ * E(k,\phi) = \int_0^{\phi} \sqrt{1 - k^2 sin^2\theta} * @f] * * @param __k The argument of the elliptic function. * @param __phi The integral limit argument of the elliptic function. * @return The elliptic function of the second kind. */ template<typename _Tp> _Tp __ellint_2(_Tp __k, _Tp __phi) { if (__isnan(__k) || __isnan(__phi)) return std::numeric_limits<_Tp>::quiet_NaN(); else if (std::abs(__k) > _Tp(1)) std::__throw_domain_error(__N("Bad argument in __ellint_2.")); else { // Reduce phi to -pi/2 < phi < +pi/2. const int __n = std::floor(__phi / __numeric_constants<_Tp>::__pi() + _Tp(0.5L)); const _Tp __phi_red = __phi - __n * __numeric_constants<_Tp>::__pi(); const _Tp __kk = __k * __k; const _Tp __s = std::sin(__phi_red); const _Tp __ss = __s * __s; const _Tp __sss = __ss * __s; const _Tp __c = std::cos(__phi_red); const _Tp __cc = __c * __c; const _Tp __E = __s * __ellint_rf(__cc, _Tp(1) - __kk * __ss, _Tp(1)) - __kk * __sss * __ellint_rd(__cc, _Tp(1) - __kk * __ss, _Tp(1)) / _Tp(3); if (__n == 0) return __E; else return __E + _Tp(2) * __n * __comp_ellint_2(__k); } } /** * @brief Return the Carlson elliptic function * @f$ R_C(x,y) = R_F(x,y,y) @f$ where @f$ R_F(x,y,z) @f$ * is the Carlson elliptic function of the first kind. * * The Carlson elliptic function is defined by: * @f[ * R_C(x,y) = \frac{1}{2} \int_0^\infty * \frac{dt}{(t + x)^{1/2}(t + y)} * @f] * * Based on Carlson's algorithms: * - B. C. Carlson Numer. Math. 33, 1 (1979) * - B. C. Carlson, Special Functions of Applied Mathematics (1977) * - Numerical Recipes in C, 2nd ed, pp. 261-269, * by Press, Teukolsky, Vetterling, Flannery (1992) * * @param __x The first argument. * @param __y The second argument. * @return The Carlson elliptic function. */ template<typename _Tp> _Tp __ellint_rc(_Tp __x, _Tp __y) { const _Tp __min = std::numeric_limits<_Tp>::min(); const _Tp __max = std::numeric_limits<_Tp>::max(); const _Tp __lolim = _Tp(5) * __min; const _Tp __uplim = __max / _Tp(5); if (__x < _Tp(0) || __y < _Tp(0) || __x + __y < __lolim) std::__throw_domain_error(__N("Argument less than zero " "in __ellint_rc.")); else { const _Tp __c0 = _Tp(1) / _Tp(4); const _Tp __c1 = _Tp(1) / _Tp(7); const _Tp __c2 = _Tp(9) / _Tp(22); const _Tp __c3 = _Tp(3) / _Tp(10); const _Tp __c4 = _Tp(3) / _Tp(8); _Tp __xn = __x; _Tp __yn = __y; const _Tp __eps = std::numeric_limits<_Tp>::epsilon(); const _Tp __errtol = std::pow(__eps / _Tp(30), _Tp(1) / _Tp(6)); _Tp __mu; _Tp __sn; const unsigned int __max_iter = 100; for (unsigned int __iter = 0; __iter < __max_iter; ++__iter) { __mu = (__xn + _Tp(2) * __yn) / _Tp(3); __sn = (__yn + __mu) / __mu - _Tp(2); if (std::abs(__sn) < __errtol) break; const _Tp __lambda = _Tp(2) * std::sqrt(__xn) * std::sqrt(__yn) + __yn; __xn = __c0 * (__xn + __lambda); __yn = __c0 * (__yn + __lambda); } _Tp __s = __sn * __sn * (__c3 + __sn*(__c1 + __sn * (__c4 + __sn * __c2))); return (_Tp(1) + __s) / std::sqrt(__mu); } } /** * @brief Return the Carlson elliptic function @f$ R_J(x,y,z,p) @f$ * of the third kind. * * The Carlson elliptic function of the third kind is defined by: * @f[ * R_J(x,y,z,p) = \frac{3}{2} \int_0^\infty * \frac{dt}{(t + x)^{1/2}(t + y)^{1/2}(t + z)^{1/2}(t + p)} * @f] * * Based on Carlson's algorithms: * - B. C. Carlson Numer. Math. 33, 1 (1979) * - B. C. Carlson, Special Functions of Applied Mathematics (1977) * - Numerical Recipes in C, 2nd ed, pp. 261-269, * by Press, Teukolsky, Vetterling, Flannery (1992) * * @param __x The first of three symmetric arguments. * @param __y The second of three symmetric arguments. * @param __z The third of three symmetric arguments. * @param __p The fourth argument. * @return The Carlson elliptic function of the fourth kind. */ template<typename _Tp> _Tp __ellint_rj(_Tp __x, _Tp __y, _Tp __z, _Tp __p) { const _Tp __min = std::numeric_limits<_Tp>::min(); const _Tp __max = std::numeric_limits<_Tp>::max(); const _Tp __lolim = std::pow(_Tp(5) * __min, _Tp(1)/_Tp(3)); const _Tp __uplim = _Tp(0.3L) * std::pow(_Tp(0.2L) * __max, _Tp(1)/_Tp(3)); if (__x < _Tp(0) || __y < _Tp(0) || __z < _Tp(0)) std::__throw_domain_error(__N("Argument less than zero " "in __ellint_rj.")); else if (__x + __y < __lolim || __x + __z < __lolim || __y + __z < __lolim || __p < __lolim) std::__throw_domain_error(__N("Argument too small " "in __ellint_rj")); else { const _Tp __c0 = _Tp(1) / _Tp(4); const _Tp __c1 = _Tp(3) / _Tp(14); const _Tp __c2 = _Tp(1) / _Tp(3); const _Tp __c3 = _Tp(3) / _Tp(22); const _Tp __c4 = _Tp(3) / _Tp(26); _Tp __xn = __x; _Tp __yn = __y; _Tp __zn = __z; _Tp __pn = __p; _Tp __sigma = _Tp(0); _Tp __power4 = _Tp(1); const _Tp __eps = std::numeric_limits<_Tp>::epsilon(); const _Tp __errtol = std::pow(__eps / _Tp(8), _Tp(1) / _Tp(6)); _Tp __lambda, __mu; _Tp __xndev, __yndev, __zndev, __pndev; const unsigned int __max_iter = 100; for (unsigned int __iter = 0; __iter < __max_iter; ++__iter) { __mu = (__xn + __yn + __zn + _Tp(2) * __pn) / _Tp(5); __xndev = (__mu - __xn) / __mu; __yndev = (__mu - __yn) / __mu; __zndev = (__mu - __zn) / __mu; __pndev = (__mu - __pn) / __mu; _Tp __epsilon = std::max(std::abs(__xndev), std::abs(__yndev)); __epsilon = std::max(__epsilon, std::abs(__zndev)); __epsilon = std::max(__epsilon, std::abs(__pndev)); if (__epsilon < __errtol) break; const _Tp __xnroot = std::sqrt(__xn); const _Tp __ynroot = std::sqrt(__yn); const _Tp __znroot = std::sqrt(__zn); const _Tp __lambda = __xnroot * (__ynroot + __znroot) + __ynroot * __znroot; const _Tp __alpha1 = __pn * (__xnroot + __ynroot + __znroot) + __xnroot * __ynroot * __znroot; const _Tp __alpha2 = __alpha1 * __alpha1; const _Tp __beta = __pn * (__pn + __lambda) * (__pn + __lambda); __sigma += __power4 * __ellint_rc(__alpha2, __beta); __power4 *= __c0; __xn = __c0 * (__xn + __lambda); __yn = __c0 * (__yn + __lambda); __zn = __c0 * (__zn + __lambda); __pn = __c0 * (__pn + __lambda); } // Note: __ea is an SPU badname. _Tp __eaa = __xndev * (__yndev + __zndev) + __yndev * __zndev; _Tp __eb = __xndev * __yndev * __zndev; _Tp __ec = __pndev * __pndev; _Tp __e2 = __eaa - _Tp(3) * __ec; _Tp __e3 = __eb + _Tp(2) * __pndev * (__eaa - __ec); _Tp __s1 = _Tp(1) + __e2 * (-__c1 + _Tp(3) * __c3 * __e2 / _Tp(4) - _Tp(3) * __c4 * __e3 / _Tp(2)); _Tp __s2 = __eb * (__c2 / _Tp(2) + __pndev * (-__c3 - __c3 + __pndev * __c4)); _Tp __s3 = __pndev * __eaa * (__c2 - __pndev * __c3) - __c2 * __pndev * __ec; return _Tp(3) * __sigma + __power4 * (__s1 + __s2 + __s3) / (__mu * std::sqrt(__mu)); } } /** * @brief Return the complete elliptic integral of the third kind * @f$ \Pi(k,\nu) = \Pi(k,\nu,\pi/2) @f$ using the * Carlson formulation. * * The complete elliptic integral of the third kind is defined as * @f[ * \Pi(k,\nu) = \int_0^{\pi/2} * \frac{d\theta} * {(1 - \nu \sin^2\theta)\sqrt{1 - k^2 \sin^2\theta}} * @f] * * @param __k The argument of the elliptic function. * @param __nu The second argument of the elliptic function. * @return The complete elliptic function of the third kind. */ template<typename _Tp> _Tp __comp_ellint_3(_Tp __k, _Tp __nu) { if (__isnan(__k) || __isnan(__nu)) return std::numeric_limits<_Tp>::quiet_NaN(); else if (__nu == _Tp(1)) return std::numeric_limits<_Tp>::infinity(); else if (std::abs(__k) > _Tp(1)) std::__throw_domain_error(__N("Bad argument in __comp_ellint_3.")); else { const _Tp __kk = __k * __k; return __ellint_rf(_Tp(0), _Tp(1) - __kk, _Tp(1)) - __nu * __ellint_rj(_Tp(0), _Tp(1) - __kk, _Tp(1), _Tp(1) + __nu) / _Tp(3); } } /** * @brief Return the incomplete elliptic integral of the third kind * @f$ \Pi(k,\nu,\phi) @f$ using the Carlson formulation. * * The incomplete elliptic integral of the third kind is defined as * @f[ * \Pi(k,\nu,\phi) = \int_0^{\phi} * \frac{d\theta} * {(1 - \nu \sin^2\theta) * \sqrt{1 - k^2 \sin^2\theta}} * @f] * * @param __k The argument of the elliptic function. * @param __nu The second argument of the elliptic function. * @param __phi The integral limit argument of the elliptic function. * @return The elliptic function of the third kind. */ template<typename _Tp> _Tp __ellint_3(_Tp __k, _Tp __nu, _Tp __phi) { if (__isnan(__k) || __isnan(__nu) || __isnan(__phi)) return std::numeric_limits<_Tp>::quiet_NaN(); else if (std::abs(__k) > _Tp(1)) std::__throw_domain_error(__N("Bad argument in __ellint_3.")); else { // Reduce phi to -pi/2 < phi < +pi/2. const int __n = std::floor(__phi / __numeric_constants<_Tp>::__pi() + _Tp(0.5L)); const _Tp __phi_red = __phi - __n * __numeric_constants<_Tp>::__pi(); const _Tp __kk = __k * __k; const _Tp __s = std::sin(__phi_red); const _Tp __ss = __s * __s; const _Tp __sss = __ss * __s; const _Tp __c = std::cos(__phi_red); const _Tp __cc = __c * __c; const _Tp __Pi = __s * __ellint_rf(__cc, _Tp(1) - __kk * __ss, _Tp(1)) - __nu * __sss * __ellint_rj(__cc, _Tp(1) - __kk * __ss, _Tp(1), _Tp(1) + __nu * __ss) / _Tp(3); if (__n == 0) return __Pi; else return __Pi + _Tp(2) * __n * __comp_ellint_3(__k, __nu); } } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std::tr1::__detail } } #endif // _GLIBCXX_TR1_ELL_INTEGRAL_TCC ������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/complex.h�����������������������������������������������������������������������������0000644�����������������00000002355�14763166027�0010134 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 complex.h -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/complex.h * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_COMPLEX_H #define _GLIBCXX_TR1_COMPLEX_H 1 #include <tr1/ccomplex> #endif // _GLIBCXX_TR1_COMPLEX_H �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/functional_hash.h���������������������������������������������������������������������0000644�����������������00000013312�14763166027�0011625 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 functional_hash.h header -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/functional_hash.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{tr1/functional} */ #ifndef _GLIBCXX_TR1_FUNCTIONAL_HASH_H #define _GLIBCXX_TR1_FUNCTIONAL_HASH_H 1 #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { _GLIBCXX_BEGIN_NAMESPACE_VERSION /// Class template hash. // Declaration of default hash functor std::tr1::hash. The types for // which std::tr1::hash<T> is well-defined is in clause 6.3.3. of the PDTR. template<typename _Tp> struct hash : public std::unary_function<_Tp, size_t> { size_t operator()(_Tp __val) const; }; /// Partial specializations for pointer types. template<typename _Tp> struct hash<_Tp*> : public std::unary_function<_Tp*, size_t> { size_t operator()(_Tp* __p) const { return reinterpret_cast<size_t>(__p); } }; /// Explicit specializations for integer types. #define _TR1_hashtable_define_trivial_hash(_Tp) \ template<> \ inline size_t \ hash<_Tp>::operator()(_Tp __val) const \ { return static_cast<size_t>(__val); } _TR1_hashtable_define_trivial_hash(bool); _TR1_hashtable_define_trivial_hash(char); _TR1_hashtable_define_trivial_hash(signed char); _TR1_hashtable_define_trivial_hash(unsigned char); _TR1_hashtable_define_trivial_hash(wchar_t); _TR1_hashtable_define_trivial_hash(short); _TR1_hashtable_define_trivial_hash(int); _TR1_hashtable_define_trivial_hash(long); _TR1_hashtable_define_trivial_hash(long long); _TR1_hashtable_define_trivial_hash(unsigned short); _TR1_hashtable_define_trivial_hash(unsigned int); _TR1_hashtable_define_trivial_hash(unsigned long); _TR1_hashtable_define_trivial_hash(unsigned long long); #undef _TR1_hashtable_define_trivial_hash // Fowler / Noll / Vo (FNV) Hash (type FNV-1a) // (Used by the next specializations of std::tr1::hash.) /// Dummy generic implementation (for sizeof(size_t) != 4, 8). template<size_t> struct _Fnv_hash_base { template<typename _Tp> static size_t hash(const _Tp* __ptr, size_t __clength) { size_t __result = 0; const char* __cptr = reinterpret_cast<const char*>(__ptr); for (; __clength; --__clength) __result = (__result * 131) + *__cptr++; return __result; } }; template<> struct _Fnv_hash_base<4> { template<typename _Tp> static size_t hash(const _Tp* __ptr, size_t __clength) { size_t __result = static_cast<size_t>(2166136261UL); const char* __cptr = reinterpret_cast<const char*>(__ptr); for (; __clength; --__clength) { __result ^= static_cast<size_t>(*__cptr++); __result *= static_cast<size_t>(16777619UL); } return __result; } }; template<> struct _Fnv_hash_base<8> { template<typename _Tp> static size_t hash(const _Tp* __ptr, size_t __clength) { size_t __result = static_cast<size_t>(14695981039346656037ULL); const char* __cptr = reinterpret_cast<const char*>(__ptr); for (; __clength; --__clength) { __result ^= static_cast<size_t>(*__cptr++); __result *= static_cast<size_t>(1099511628211ULL); } return __result; } }; struct _Fnv_hash : public _Fnv_hash_base<sizeof(size_t)> { using _Fnv_hash_base<sizeof(size_t)>::hash; template<typename _Tp> static size_t hash(const _Tp& __val) { return hash(&__val, sizeof(__val)); } }; /// Explicit specializations for float. template<> inline size_t hash<float>::operator()(float __val) const { // 0 and -0 both hash to zero. return __val != 0.0f ? std::tr1::_Fnv_hash::hash(__val) : 0; } /// Explicit specializations for double. template<> inline size_t hash<double>::operator()(double __val) const { // 0 and -0 both hash to zero. return __val != 0.0 ? std::tr1::_Fnv_hash::hash(__val) : 0; } /// Explicit specializations for long double. template<> _GLIBCXX_PURE size_t hash<long double>::operator()(long double __val) const; /// Explicit specialization of member operator for non-builtin types. template<> _GLIBCXX_PURE size_t hash<string>::operator()(string) const; template<> _GLIBCXX_PURE size_t hash<const string&>::operator()(const string&) const; #ifdef _GLIBCXX_USE_WCHAR_T template<> _GLIBCXX_PURE size_t hash<wstring>::operator()(wstring) const; template<> _GLIBCXX_PURE size_t hash<const wstring&>::operator()(const wstring&) const; #endif _GLIBCXX_END_NAMESPACE_VERSION } } #endif // _GLIBCXX_TR1_FUNCTIONAL_HASH_H ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/complex�������������������������������������������������������������������������������0000644�����������������00000030047�14763166027�0007705 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 complex -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/complex * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_COMPLEX #define _GLIBCXX_TR1_COMPLEX 1 #pragma GCC system_header #include <complex> namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup complex_numbers * @{ */ #if __cplusplus >= 201103L using std::acos; using std::asin; using std::atan; #else template<typename _Tp> std::complex<_Tp> acos(const std::complex<_Tp>&); template<typename _Tp> std::complex<_Tp> asin(const std::complex<_Tp>&); template<typename _Tp> std::complex<_Tp> atan(const std::complex<_Tp>&); #endif template<typename _Tp> std::complex<_Tp> acosh(const std::complex<_Tp>&); template<typename _Tp> std::complex<_Tp> asinh(const std::complex<_Tp>&); template<typename _Tp> std::complex<_Tp> atanh(const std::complex<_Tp>&); // The std::fabs return type in C++0x mode is different (just _Tp). template<typename _Tp> std::complex<_Tp> fabs(const std::complex<_Tp>&); #if __cplusplus < 201103L template<typename _Tp> inline std::complex<_Tp> __complex_acos(const std::complex<_Tp>& __z) { const std::complex<_Tp> __t = std::tr1::asin(__z); const _Tp __pi_2 = 1.5707963267948966192313216916397514L; return std::complex<_Tp>(__pi_2 - __t.real(), -__t.imag()); } #if _GLIBCXX_USE_C99_COMPLEX_TR1 inline __complex__ float __complex_acos(__complex__ float __z) { return __builtin_cacosf(__z); } inline __complex__ double __complex_acos(__complex__ double __z) { return __builtin_cacos(__z); } inline __complex__ long double __complex_acos(const __complex__ long double& __z) { return __builtin_cacosl(__z); } template<typename _Tp> inline std::complex<_Tp> acos(const std::complex<_Tp>& __z) { return __complex_acos(__z.__rep()); } #else /// acos(__z) [8.1.2]. // Effects: Behaves the same as C99 function cacos, defined // in subclause 7.3.5.1. template<typename _Tp> inline std::complex<_Tp> acos(const std::complex<_Tp>& __z) { return __complex_acos(__z); } #endif template<typename _Tp> inline std::complex<_Tp> __complex_asin(const std::complex<_Tp>& __z) { std::complex<_Tp> __t(-__z.imag(), __z.real()); __t = std::tr1::asinh(__t); return std::complex<_Tp>(__t.imag(), -__t.real()); } #if _GLIBCXX_USE_C99_COMPLEX_TR1 inline __complex__ float __complex_asin(__complex__ float __z) { return __builtin_casinf(__z); } inline __complex__ double __complex_asin(__complex__ double __z) { return __builtin_casin(__z); } inline __complex__ long double __complex_asin(const __complex__ long double& __z) { return __builtin_casinl(__z); } template<typename _Tp> inline std::complex<_Tp> asin(const std::complex<_Tp>& __z) { return __complex_asin(__z.__rep()); } #else /// asin(__z) [8.1.3]. // Effects: Behaves the same as C99 function casin, defined // in subclause 7.3.5.2. template<typename _Tp> inline std::complex<_Tp> asin(const std::complex<_Tp>& __z) { return __complex_asin(__z); } #endif template<typename _Tp> std::complex<_Tp> __complex_atan(const std::complex<_Tp>& __z) { const _Tp __r2 = __z.real() * __z.real(); const _Tp __x = _Tp(1.0) - __r2 - __z.imag() * __z.imag(); _Tp __num = __z.imag() + _Tp(1.0); _Tp __den = __z.imag() - _Tp(1.0); __num = __r2 + __num * __num; __den = __r2 + __den * __den; return std::complex<_Tp>(_Tp(0.5) * atan2(_Tp(2.0) * __z.real(), __x), _Tp(0.25) * log(__num / __den)); } #if _GLIBCXX_USE_C99_COMPLEX_TR1 inline __complex__ float __complex_atan(__complex__ float __z) { return __builtin_catanf(__z); } inline __complex__ double __complex_atan(__complex__ double __z) { return __builtin_catan(__z); } inline __complex__ long double __complex_atan(const __complex__ long double& __z) { return __builtin_catanl(__z); } template<typename _Tp> inline std::complex<_Tp> atan(const std::complex<_Tp>& __z) { return __complex_atan(__z.__rep()); } #else /// atan(__z) [8.1.4]. // Effects: Behaves the same as C99 function catan, defined // in subclause 7.3.5.3. template<typename _Tp> inline std::complex<_Tp> atan(const std::complex<_Tp>& __z) { return __complex_atan(__z); } #endif #endif // C++11 template<typename _Tp> std::complex<_Tp> __complex_acosh(const std::complex<_Tp>& __z) { // Kahan's formula. return _Tp(2.0) * std::log(std::sqrt(_Tp(0.5) * (__z + _Tp(1.0))) + std::sqrt(_Tp(0.5) * (__z - _Tp(1.0)))); } #if _GLIBCXX_USE_C99_COMPLEX_TR1 inline __complex__ float __complex_acosh(__complex__ float __z) { return __builtin_cacoshf(__z); } inline __complex__ double __complex_acosh(__complex__ double __z) { return __builtin_cacosh(__z); } inline __complex__ long double __complex_acosh(const __complex__ long double& __z) { return __builtin_cacoshl(__z); } template<typename _Tp> inline std::complex<_Tp> acosh(const std::complex<_Tp>& __z) { return __complex_acosh(__z.__rep()); } #else /// acosh(__z) [8.1.5]. // Effects: Behaves the same as C99 function cacosh, defined // in subclause 7.3.6.1. template<typename _Tp> inline std::complex<_Tp> acosh(const std::complex<_Tp>& __z) { return __complex_acosh(__z); } #endif template<typename _Tp> std::complex<_Tp> __complex_asinh(const std::complex<_Tp>& __z) { std::complex<_Tp> __t((__z.real() - __z.imag()) * (__z.real() + __z.imag()) + _Tp(1.0), _Tp(2.0) * __z.real() * __z.imag()); __t = std::sqrt(__t); return std::log(__t + __z); } #if _GLIBCXX_USE_C99_COMPLEX_TR1 inline __complex__ float __complex_asinh(__complex__ float __z) { return __builtin_casinhf(__z); } inline __complex__ double __complex_asinh(__complex__ double __z) { return __builtin_casinh(__z); } inline __complex__ long double __complex_asinh(const __complex__ long double& __z) { return __builtin_casinhl(__z); } template<typename _Tp> inline std::complex<_Tp> asinh(const std::complex<_Tp>& __z) { return __complex_asinh(__z.__rep()); } #else /// asinh(__z) [8.1.6]. // Effects: Behaves the same as C99 function casin, defined // in subclause 7.3.6.2. template<typename _Tp> inline std::complex<_Tp> asinh(const std::complex<_Tp>& __z) { return __complex_asinh(__z); } #endif template<typename _Tp> std::complex<_Tp> __complex_atanh(const std::complex<_Tp>& __z) { const _Tp __i2 = __z.imag() * __z.imag(); const _Tp __x = _Tp(1.0) - __i2 - __z.real() * __z.real(); _Tp __num = _Tp(1.0) + __z.real(); _Tp __den = _Tp(1.0) - __z.real(); __num = __i2 + __num * __num; __den = __i2 + __den * __den; return std::complex<_Tp>(_Tp(0.25) * (log(__num) - log(__den)), _Tp(0.5) * atan2(_Tp(2.0) * __z.imag(), __x)); } #if _GLIBCXX_USE_C99_COMPLEX_TR1 inline __complex__ float __complex_atanh(__complex__ float __z) { return __builtin_catanhf(__z); } inline __complex__ double __complex_atanh(__complex__ double __z) { return __builtin_catanh(__z); } inline __complex__ long double __complex_atanh(const __complex__ long double& __z) { return __builtin_catanhl(__z); } template<typename _Tp> inline std::complex<_Tp> atanh(const std::complex<_Tp>& __z) { return __complex_atanh(__z.__rep()); } #else /// atanh(__z) [8.1.7]. // Effects: Behaves the same as C99 function catanh, defined // in subclause 7.3.6.3. template<typename _Tp> inline std::complex<_Tp> atanh(const std::complex<_Tp>& __z) { return __complex_atanh(__z); } #endif template<typename _Tp> inline std::complex<_Tp> /// fabs(__z) [8.1.8]. // Effects: Behaves the same as C99 function cabs, defined // in subclause 7.3.8.1. fabs(const std::complex<_Tp>& __z) { return std::abs(__z); } /// Additional overloads [8.1.9]. #if __cplusplus < 201103L template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type arg(_Tp __x) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; #if (_GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC) return std::signbit(__x) ? __type(3.1415926535897932384626433832795029L) : __type(); #else return std::arg(std::complex<__type>(__x)); #endif } template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type imag(_Tp) { return _Tp(); } template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type norm(_Tp __x) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __type(__x) * __type(__x); } template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type real(_Tp __x) { return __x; } #endif template<typename _Tp, typename _Up> inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type> pow(const std::complex<_Tp>& __x, const _Up& __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return std::pow(std::complex<__type>(__x), __type(__y)); } template<typename _Tp, typename _Up> inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type> pow(const _Tp& __x, const std::complex<_Up>& __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return std::pow(__type(__x), std::complex<__type>(__y)); } template<typename _Tp, typename _Up> inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type> pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return std::pow(std::complex<__type>(__x), std::complex<__type>(__y)); } using std::arg; template<typename _Tp> inline std::complex<_Tp> conj(const std::complex<_Tp>& __z) { return std::conj(__z); } template<typename _Tp> inline std::complex<typename __gnu_cxx::__promote<_Tp>::__type> conj(_Tp __x) { return __x; } using std::imag; using std::norm; using std::polar; template<typename _Tp, typename _Up> inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type> polar(const _Tp& __rho, const _Up& __theta) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return std::polar(__type(__rho), __type(__theta)); } using std::real; template<typename _Tp> inline std::complex<_Tp> pow(const std::complex<_Tp>& __x, const _Tp& __y) { return std::pow(__x, __y); } template<typename _Tp> inline std::complex<_Tp> pow(const _Tp& __x, const std::complex<_Tp>& __y) { return std::pow(__x, __y); } template<typename _Tp> inline std::complex<_Tp> pow(const std::complex<_Tp>& __x, const std::complex<_Tp>& __y) { return std::pow(__x, __y); } // @} group complex_numbers _GLIBCXX_END_NAMESPACE_VERSION } } #endif // _GLIBCXX_TR1_COMPLEX �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/cfenv���������������������������������������������������������������������������������0000644�����������������00000003724�14763166027�0007341 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 cfenv -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/cfenv * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_CFENV #define _GLIBCXX_TR1_CFENV 1 #pragma GCC system_header #include <bits/c++config.h> #if _GLIBCXX_HAVE_FENV_H # include <fenv.h> #endif #ifdef _GLIBCXX_USE_C99_FENV_TR1 #undef feclearexcept #undef fegetexceptflag #undef feraiseexcept #undef fesetexceptflag #undef fetestexcept #undef fegetround #undef fesetround #undef fegetenv #undef feholdexcept #undef fesetenv #undef feupdateenv namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { // types using ::fenv_t; using ::fexcept_t; // functions using ::feclearexcept; using ::fegetexceptflag; using ::feraiseexcept; using ::fesetexceptflag; using ::fetestexcept; using ::fegetround; using ::fesetround; using ::fegetenv; using ::feholdexcept; using ::fesetenv; using ::feupdateenv; } } #endif // _GLIBCXX_USE_C99_FENV_TR1 #endif // _GLIBCXX_TR1_CFENV ��������������������������������������������c++/4.8.2/tr1/regex���������������������������������������������������������������������������������0000644�����������������00000265422�14763166027�0007357 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// class template regex -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** * @file tr1/regex * @author Stephen M. Webb <stephen.webb@bregmasoft.ca> * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_REGEX #define _GLIBCXX_TR1_REGEX 1 #pragma GCC system_header #include <algorithm> #include <bitset> #include <iterator> #include <locale> #include <stdexcept> #include <string> #include <vector> #include <utility> #include <sstream> namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { /** * @defgroup tr1_regex Regular Expressions * A facility for performing regular expression pattern matching. */ //@{ /** @namespace std::regex_constants * @brief ISO C++ 0x entities sub namespace for regex. */ namespace regex_constants { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @name 5.1 Regular Expression Syntax Options */ //@{ enum __syntax_option { _S_icase, _S_nosubs, _S_optimize, _S_collate, _S_ECMAScript, _S_basic, _S_extended, _S_awk, _S_grep, _S_egrep, _S_syntax_last }; /** * @brief This is a bitmask type indicating how to interpret the regex. * * The @c syntax_option_type is implementation defined but it is valid to * perform bitwise operations on these values and expect the right thing to * happen. * * A valid value of type syntax_option_type shall have exactly one of the * elements @c ECMAScript, @c basic, @c extended, @c awk, @c grep, @c egrep * %set. */ typedef unsigned int syntax_option_type; /** * Specifies that the matching of regular expressions against a character * sequence shall be performed without regard to case. */ static const syntax_option_type icase = 1 << _S_icase; /** * Specifies that when a regular expression is matched against a character * container sequence, no sub-expression matches are to be stored in the * supplied match_results structure. */ static const syntax_option_type nosubs = 1 << _S_nosubs; /** * Specifies that the regular expression engine should pay more attention to * the speed with which regular expressions are matched, and less to the * speed with which regular expression objects are constructed. Otherwise * it has no detectable effect on the program output. */ static const syntax_option_type optimize = 1 << _S_optimize; /** * Specifies that character ranges of the form [a-b] should be locale * sensitive. */ static const syntax_option_type collate = 1 << _S_collate; /** * Specifies that the grammar recognized by the regular expression engine is * that used by ECMAScript in ECMA-262 [Ecma International, ECMAScript * Language Specification, Standard Ecma-262, third edition, 1999], as * modified in tr1 section [7.13]. This grammar is similar to that defined * in the PERL scripting language but extended with elements found in the * POSIX regular expression grammar. */ static const syntax_option_type ECMAScript = 1 << _S_ECMAScript; /** * Specifies that the grammar recognized by the regular expression engine is * that used by POSIX basic regular expressions in IEEE Std 1003.1-2001, * Portable Operating System Interface (POSIX), Base Definitions and * Headers, Section 9, Regular Expressions [IEEE, Information Technology -- * Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001]. */ static const syntax_option_type basic = 1 << _S_basic; /** * Specifies that the grammar recognized by the regular expression engine is * that used by POSIX extended regular expressions in IEEE Std 1003.1-2001, * Portable Operating System Interface (POSIX), Base Definitions and Headers, * Section 9, Regular Expressions. */ static const syntax_option_type extended = 1 << _S_extended; /** * Specifies that the grammar recognized by the regular expression engine is * that used by POSIX utility awk in IEEE Std 1003.1-2001. This option is * identical to syntax_option_type extended, except that C-style escape * sequences are supported. These sequences are: * \\\\, \\a, \\b, \\f, * \\n, \\r, \\t , \\v, * \\', ', and \\ddd * (where ddd is one, two, or three octal digits). */ static const syntax_option_type awk = 1 << _S_awk; /** * Specifies that the grammar recognized by the regular expression engine is * that used by POSIX utility grep in IEEE Std 1003.1-2001. This option is * identical to syntax_option_type basic, except that newlines are treated * as whitespace. */ static const syntax_option_type grep = 1 << _S_grep; /** * Specifies that the grammar recognized by the regular expression engine is * that used by POSIX utility grep when given the -E option in * IEEE Std 1003.1-2001. This option is identical to syntax_option_type * extended, except that newlines are treated as whitespace. */ static const syntax_option_type egrep = 1 << _S_egrep; //@} /** * @name 5.2 Matching Rules * * Matching a regular expression against a sequence of characters [first, * last) proceeds according to the rules of the grammar specified for the * regular expression object, modified according to the effects listed * below for any bitmask elements set. * */ //@{ enum __match_flag { _S_not_bol, _S_not_eol, _S_not_bow, _S_not_eow, _S_any, _S_not_null, _S_continuous, _S_prev_avail, _S_sed, _S_no_copy, _S_first_only, _S_match_flag_last }; /** * @brief This is a bitmask type indicating regex matching rules. * * The @c match_flag_type is implementation defined but it is valid to * perform bitwise operations on these values and expect the right thing to * happen. */ typedef std::bitset<_S_match_flag_last> match_flag_type; /** * The default matching rules. */ static const match_flag_type match_default = 0; /** * The first character in the sequence [first, last) is treated as though it * is not at the beginning of a line, so the character (^) in the regular * expression shall not match [first, first). */ static const match_flag_type match_not_bol = 1 << _S_not_bol; /** * The last character in the sequence [first, last) is treated as though it * is not at the end of a line, so the character ($) in the regular * expression shall not match [last, last). */ static const match_flag_type match_not_eol = 1 << _S_not_eol; /** * The expression \\b is not matched against the sub-sequence * [first,first). */ static const match_flag_type match_not_bow = 1 << _S_not_bow; /** * The expression \\b should not be matched against the sub-sequence * [last,last). */ static const match_flag_type match_not_eow = 1 << _S_not_eow; /** * If more than one match is possible then any match is an acceptable * result. */ static const match_flag_type match_any = 1 << _S_any; /** * The expression does not match an empty sequence. */ static const match_flag_type match_not_null = 1 << _S_not_null; /** * The expression only matches a sub-sequence that begins at first . */ static const match_flag_type match_continuous = 1 << _S_continuous; /** * --first is a valid iterator position. When this flag is set then the * flags match_not_bol and match_not_bow are ignored by the regular * expression algorithms 7.11 and iterators 7.12. */ static const match_flag_type match_prev_avail = 1 << _S_prev_avail; /** * When a regular expression match is to be replaced by a new string, the * new string is constructed using the rules used by the ECMAScript replace * function in ECMA- 262 [Ecma International, ECMAScript Language * Specification, Standard Ecma-262, third edition, 1999], part 15.5.4.11 * String.prototype.replace. In addition, during search and replace * operations all non-overlapping occurrences of the regular expression * are located and replaced, and sections of the input that did not match * the expression are copied unchanged to the output string. * * Format strings (from ECMA-262 [15.5.4.11]): * @li $$ The dollar-sign itself ($) * @li $& The matched substring. * @li $` The portion of @a string that precedes the matched substring. * This would be match_results::prefix(). * @li $' The portion of @a string that follows the matched substring. * This would be match_results::suffix(). * @li $n The nth capture, where n is in [1,9] and $n is not followed by a * decimal digit. If n <= match_results::size() and the nth capture * is undefined, use the empty string instead. If n > * match_results::size(), the result is implementation-defined. * @li $nn The nnth capture, where nn is a two-digit decimal number on * [01, 99]. If nn <= match_results::size() and the nth capture is * undefined, use the empty string instead. If * nn > match_results::size(), the result is implementation-defined. */ static const match_flag_type format_default = 0; /** * When a regular expression match is to be replaced by a new string, the * new string is constructed using the rules used by the POSIX sed utility * in IEEE Std 1003.1- 2001 [IEEE, Information Technology -- Portable * Operating System Interface (POSIX), IEEE Standard 1003.1-2001]. */ static const match_flag_type format_sed = 1 << _S_sed; /** * During a search and replace operation, sections of the character * container sequence being searched that do not match the regular * expression shall not be copied to the output string. */ static const match_flag_type format_no_copy = 1 << _S_no_copy; /** * When specified during a search and replace operation, only the first * occurrence of the regular expression shall be replaced. */ static const match_flag_type format_first_only = 1 << _S_first_only; //@} /** * @name 5.3 Error Types */ //@{ enum error_type { _S_error_collate, _S_error_ctype, _S_error_escape, _S_error_backref, _S_error_brack, _S_error_paren, _S_error_brace, _S_error_badbrace, _S_error_range, _S_error_space, _S_error_badrepeat, _S_error_complexity, _S_error_stack, _S_error_last }; /** The expression contained an invalid collating element name. */ static const error_type error_collate(_S_error_collate); /** The expression contained an invalid character class name. */ static const error_type error_ctype(_S_error_ctype); /** * The expression contained an invalid escaped character, or a trailing * escape. */ static const error_type error_escape(_S_error_escape); /** The expression contained an invalid back reference. */ static const error_type error_backref(_S_error_backref); /** The expression contained mismatched [ and ]. */ static const error_type error_brack(_S_error_brack); /** The expression contained mismatched ( and ). */ static const error_type error_paren(_S_error_paren); /** The expression contained mismatched { and } */ static const error_type error_brace(_S_error_brace); /** The expression contained an invalid range in a {} expression. */ static const error_type error_badbrace(_S_error_badbrace); /** * The expression contained an invalid character range, * such as [b-a] in most encodings. */ static const error_type error_range(_S_error_range); /** * There was insufficient memory to convert the expression into a * finite state machine. */ static const error_type error_space(_S_error_space); /** * One of <em>*?+{</em> was not preceded by a valid regular expression. */ static const error_type error_badrepeat(_S_error_badrepeat); /** * The complexity of an attempted match against a regular expression * exceeded a pre-set level. */ static const error_type error_complexity(_S_error_complexity); /** * There was insufficient memory to determine whether the * regular expression could match the specified character sequence. */ static const error_type error_stack(_S_error_stack); //@} _GLIBCXX_END_NAMESPACE_VERSION } _GLIBCXX_BEGIN_NAMESPACE_VERSION // [7.8] Class regex_error /** * @brief A regular expression exception class. * @ingroup exceptions * * The regular expression library throws objects of this class on error. */ class regex_error : public std::runtime_error { public: /** * @brief Constructs a regex_error object. * * @param ecode the regex error code. */ explicit regex_error(regex_constants::error_type __ecode) : std::runtime_error("regex_error"), _M_code(__ecode) { } /** * @brief Gets the regex error code. * * @returns the regex error code. */ regex_constants::error_type code() const { return _M_code; } protected: regex_constants::error_type _M_code; }; // [7.7] Class regex_traits /** * @brief Describes aspects of a regular expression. * * A regular expression traits class that satisfies the requirements of tr1 * section [7.2]. * * The class %regex is parameterized around a set of related types and * functions used to complete the definition of its semantics. This class * satisfies the requirements of such a traits class. */ template<typename _Ch_type> struct regex_traits { public: typedef _Ch_type char_type; typedef std::basic_string<char_type> string_type; typedef std::locale locale_type; typedef std::ctype_base::mask char_class_type; public: /** * @brief Constructs a default traits object. */ regex_traits() { } /** * @brief Gives the length of a C-style string starting at @p __p. * * @param __p a pointer to the start of a character sequence. * * @returns the number of characters between @p *__p and the first * default-initialized value of type @p char_type. In other words, uses * the C-string algorithm for determining the length of a sequence of * characters. */ static std::size_t length(const char_type* __p) { return string_type::traits_type::length(__p); } /** * @brief Performs the identity translation. * * @param c A character to the locale-specific character set. * * @returns c. */ char_type translate(char_type __c) const { return __c; } /** * @brief Translates a character into a case-insensitive equivalent. * * @param c A character to the locale-specific character set. * * @returns the locale-specific lower-case equivalent of c. * @throws std::bad_cast if the imbued locale does not support the ctype * facet. */ char_type translate_nocase(char_type __c) const { using std::ctype; using std::use_facet; return use_facet<ctype<char_type> >(_M_locale).tolower(__c); } /** * @brief Gets a sort key for a character sequence. * * @param first beginning of the character sequence. * @param last one-past-the-end of the character sequence. * * Returns a sort key for the character sequence designated by the * iterator range [F1, F2) such that if the character sequence [G1, G2) * sorts before the character sequence [H1, H2) then * v.transform(G1, G2) < v.transform(H1, H2). * * What this really does is provide a more efficient way to compare a * string to multiple other strings in locales with fancy collation * rules and equivalence classes. * * @returns a locale-specific sort key equivalent to the input range. * * @throws std::bad_cast if the current locale does not have a collate * facet. */ template<typename _Fwd_iter> string_type transform(_Fwd_iter __first, _Fwd_iter __last) const { using std::collate; using std::use_facet; const collate<_Ch_type>& __c(use_facet< collate<_Ch_type> >(_M_locale)); string_type __s(__first, __last); return __c.transform(__s.data(), __s.data() + __s.size()); } /** * @brief Dunno. * * @param first beginning of the character sequence. * @param last one-past-the-end of the character sequence. * * Effects: if typeid(use_facet<collate<_Ch_type> >) == * typeid(collate_byname<_Ch_type>) and the form of the sort key * returned by collate_byname<_Ch_type>::transform(first, last) is known * and can be converted into a primary sort key then returns that key, * otherwise returns an empty string. WTF?? * * @todo Implement this function. */ template<typename _Fwd_iter> string_type transform_primary(_Fwd_iter __first, _Fwd_iter __last) const; /** * @brief Gets a collation element by name. * * @param first beginning of the collation element name. * @param last one-past-the-end of the collation element name. * * @returns a sequence of one or more characters that represents the * collating element consisting of the character sequence designated by * the iterator range [first, last). Returns an empty string if the * character sequence is not a valid collating element. * * @todo Implement this function. */ template<typename _Fwd_iter> string_type lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const; /** * @brief Maps one or more characters to a named character * classification. * * @param first beginning of the character sequence. * @param last one-past-the-end of the character sequence. * * @returns an unspecified value that represents the character * classification named by the character sequence designated by the * iterator range [first, last). The value returned shall be independent * of the case of the characters in the character sequence. If the name * is not recognized then returns a value that compares equal to 0. * * At least the following names (or their wide-character equivalent) are * supported. * - d * - w * - s * - alnum * - alpha * - blank * - cntrl * - digit * - graph * - lower * - print * - punct * - space * - upper * - xdigit * * @todo Implement this function. */ template<typename _Fwd_iter> char_class_type lookup_classname(_Fwd_iter __first, _Fwd_iter __last) const; /** * @brief Determines if @p c is a member of an identified class. * * @param c a character. * @param f a class type (as returned from lookup_classname). * * @returns true if the character @p c is a member of the classification * represented by @p f, false otherwise. * * @throws std::bad_cast if the current locale does not have a ctype * facet. */ bool isctype(_Ch_type __c, char_class_type __f) const; /** * @brief Converts a digit to an int. * * @param ch a character representing a digit. * @param radix the radix if the numeric conversion (limited to 8, 10, * or 16). * * @returns the value represented by the digit ch in base radix if the * character ch is a valid digit in base radix; otherwise returns -1. */ int value(_Ch_type __ch, int __radix) const; /** * @brief Imbues the regex_traits object with a copy of a new locale. * * @param loc A locale. * * @returns a copy of the previous locale in use by the regex_traits * object. * * @note Calling imbue with a different locale than the one currently in * use invalidates all cached data held by *this. */ locale_type imbue(locale_type __loc) { std::swap(_M_locale, __loc); return __loc; } /** * @brief Gets a copy of the current locale in use by the regex_traits * object. */ locale_type getloc() const { return _M_locale; } protected: locale_type _M_locale; }; template<typename _Ch_type> bool regex_traits<_Ch_type>:: isctype(_Ch_type __c, char_class_type __f) const { using std::ctype; using std::use_facet; const ctype<_Ch_type>& __ctype(use_facet< ctype<_Ch_type> >(_M_locale)); if (__ctype.is(__c, __f)) return true; // special case of underscore in [[:w:]] if (__c == __ctype.widen('_')) { const char* const __wb[] = "w"; char_class_type __wt = this->lookup_classname(__wb, __wb + sizeof(__wb)); if (__f | __wt) return true; } // special case of [[:space:]] in [[:blank:]] if (__c == __ctype.isspace(__c)) { const char* const __bb[] = "blank"; char_class_type __bt = this->lookup_classname(__bb, __bb + sizeof(__bb)); if (__f | __bt) return true; } return false; } template<typename _Ch_type> int regex_traits<_Ch_type>:: value(_Ch_type __ch, int __radix) const { std::basic_istringstream<_Ch_type> __is(string_type(1, __ch)); int __v; if (__radix == 8) __is >> std::oct; else if (__radix == 16) __is >> std::hex; __is >> __v; return __is.fail() ? -1 : __v; } // [7.8] Class basic_regex /** * Objects of specializations of this class represent regular expressions * constructed from sequences of character type @p _Ch_type. * * Storage for the regular expression is allocated and deallocated as * necessary by the member functions of this class. */ template<typename _Ch_type, typename _Rx_traits = regex_traits<_Ch_type> > class basic_regex { public: // types: typedef _Ch_type value_type; typedef regex_constants::syntax_option_type flag_type; typedef typename _Rx_traits::locale_type locale_type; typedef typename _Rx_traits::string_type string_type; /** * @name Constants * tr1 [7.8.1] std [28.8.1] */ //@{ static const regex_constants::syntax_option_type icase = regex_constants::icase; static const regex_constants::syntax_option_type nosubs = regex_constants::nosubs; static const regex_constants::syntax_option_type optimize = regex_constants::optimize; static const regex_constants::syntax_option_type collate = regex_constants::collate; static const regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript; static const regex_constants::syntax_option_type basic = regex_constants::basic; static const regex_constants::syntax_option_type extended = regex_constants::extended; static const regex_constants::syntax_option_type awk = regex_constants::awk; static const regex_constants::syntax_option_type grep = regex_constants::grep; static const regex_constants::syntax_option_type egrep = regex_constants::egrep; //@} // [7.8.2] construct/copy/destroy /** * Constructs a basic regular expression that does not match any * character sequence. */ basic_regex() : _M_flags(regex_constants::ECMAScript), _M_pattern(), _M_mark_count(0) { _M_compile(); } /** * @brief Constructs a basic regular expression from the sequence * [p, p + char_traits<_Ch_type>::length(p)) interpreted according to the * flags in @p f. * * @param p A pointer to the start of a C-style null-terminated string * containing a regular expression. * @param f Flags indicating the syntax rules and options. * * @throws regex_error if @p p is not a valid regular expression. */ explicit basic_regex(const _Ch_type* __p, flag_type __f = regex_constants::ECMAScript) : _M_flags(__f), _M_pattern(__p), _M_mark_count(0) { _M_compile(); } /** * @brief Constructs a basic regular expression from the sequence * [p, p + len) interpreted according to the flags in @p f. * * @param p A pointer to the start of a string containing a regular * expression. * @param len The length of the string containing the regular expression. * @param f Flags indicating the syntax rules and options. * * @throws regex_error if @p p is not a valid regular expression. */ basic_regex(const _Ch_type* __p, std::size_t __len, flag_type __f) : _M_flags(__f) , _M_pattern(__p, __len), _M_mark_count(0) { _M_compile(); } /** * @brief Copy-constructs a basic regular expression. * * @param rhs A @p regex object. */ basic_regex(const basic_regex& __rhs) : _M_flags(__rhs._M_flags), _M_pattern(__rhs._M_pattern), _M_mark_count(__rhs._M_mark_count) { _M_compile(); } /** * @brief Constructs a basic regular expression from the string * @p s interpreted according to the flags in @p f. * * @param s A string containing a regular expression. * @param f Flags indicating the syntax rules and options. * * @throws regex_error if @p s is not a valid regular expression. */ template<typename _Ch_traits, typename _Ch_alloc> explicit basic_regex(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s, flag_type __f = regex_constants::ECMAScript) : _M_flags(__f), _M_pattern(__s.begin(), __s.end()), _M_mark_count(0) { _M_compile(); } /** * @brief Constructs a basic regular expression from the range * [first, last) interpreted according to the flags in @p f. * * @param first The start of a range containing a valid regular * expression. * @param last The end of a range containing a valid regular * expression. * @param f The format flags of the regular expression. * * @throws regex_error if @p [first, last) is not a valid regular * expression. */ template<typename _InputIterator> basic_regex(_InputIterator __first, _InputIterator __last, flag_type __f = regex_constants::ECMAScript) : _M_flags(__f), _M_pattern(__first, __last), _M_mark_count(0) { _M_compile(); } #ifdef _GLIBCXX_INCLUDE_AS_CXX11 /** * @brief Constructs a basic regular expression from an initializer list. * * @param l The initializer list. * @param f The format flags of the regular expression. * * @throws regex_error if @p l is not a valid regular expression. */ basic_regex(initializer_list<_Ch_type> __l, flag_type __f = regex_constants::ECMAScript) : _M_flags(__f), _M_pattern(__l.begin(), __l.end()), _M_mark_count(0) { _M_compile(); } #endif /** * @brief Destroys a basic regular expression. */ ~basic_regex() { } /** * @brief Assigns one regular expression to another. */ basic_regex& operator=(const basic_regex& __rhs) { return this->assign(__rhs); } /** * @brief Replaces a regular expression with a new one constructed from * a C-style null-terminated string. * * @param A pointer to the start of a null-terminated C-style string * containing a regular expression. */ basic_regex& operator=(const _Ch_type* __p) { return this->assign(__p, flags()); } /** * @brief Replaces a regular expression with a new one constructed from * a string. * * @param A pointer to a string containing a regular expression. */ template<typename _Ch_typeraits, typename _Allocator> basic_regex& operator=(const basic_string<_Ch_type, _Ch_typeraits, _Allocator>& __s) { return this->assign(__s, flags()); } // [7.8.3] assign /** * @brief the real assignment operator. * * @param that Another regular expression object. */ basic_regex& assign(const basic_regex& __that) { basic_regex __tmp(__that); this->swap(__tmp); return *this; } /** * @brief Assigns a new regular expression to a regex object from a * C-style null-terminated string containing a regular expression * pattern. * * @param p A pointer to a C-style null-terminated string containing * a regular expression pattern. * @param flags Syntax option flags. * * @throws regex_error if p does not contain a valid regular expression * pattern interpreted according to @p flags. If regex_error is thrown, * *this remains unchanged. */ basic_regex& assign(const _Ch_type* __p, flag_type __flags = regex_constants::ECMAScript) { return this->assign(string_type(__p), __flags); } /** * @brief Assigns a new regular expression to a regex object from a * C-style string containing a regular expression pattern. * * @param p A pointer to a C-style string containing a * regular expression pattern. * @param len The length of the regular expression pattern string. * @param flags Syntax option flags. * * @throws regex_error if p does not contain a valid regular expression * pattern interpreted according to @p flags. If regex_error is thrown, * *this remains unchanged. */ basic_regex& assign(const _Ch_type* __p, std::size_t __len, flag_type __flags) { return this->assign(string_type(__p, __len), __flags); } /** * @brief Assigns a new regular expression to a regex object from a * string containing a regular expression pattern. * * @param s A string containing a regular expression pattern. * @param flags Syntax option flags. * * @throws regex_error if p does not contain a valid regular expression * pattern interpreted according to @p flags. If regex_error is thrown, * *this remains unchanged. */ template<typename _Ch_typeraits, typename _Allocator> basic_regex& assign(const basic_string<_Ch_type, _Ch_typeraits, _Allocator>& __s, flag_type __f = regex_constants::ECMAScript) { basic_regex __tmp(__s, __f); this->swap(__tmp); return *this; } /** * @brief Assigns a new regular expression to a regex object. * * @param first The start of a range containing a valid regular * expression. * @param last The end of a range containing a valid regular * expression. * @param flags Syntax option flags. * * @throws regex_error if p does not contain a valid regular expression * pattern interpreted according to @p flags. If regex_error is thrown, * the object remains unchanged. */ template<typename _InputIterator> basic_regex& assign(_InputIterator __first, _InputIterator __last, flag_type __flags = regex_constants::ECMAScript) { return this->assign(string_type(__first, __last), __flags); } #ifdef _GLIBCXX_INCLUDE_AS_CXX11 /** * @brief Assigns a new regular expression to a regex object. * * @param l An initializer list representing a regular expression. * @param flags Syntax option flags. * * @throws regex_error if @p l does not contain a valid regular * expression pattern interpreted according to @p flags. If regex_error * is thrown, the object remains unchanged. */ basic_regex& assign(initializer_list<_Ch_type> __l, flag_type __f = regex_constants::ECMAScript) { return this->assign(__l.begin(), __l.end(), __f); } #endif // [7.8.4] const operations /** * @brief Gets the number of marked subexpressions within the regular * expression. */ unsigned int mark_count() const { return _M_mark_count; } /** * @brief Gets the flags used to construct the regular expression * or in the last call to assign(). */ flag_type flags() const { return _M_flags; } // [7.8.5] locale /** * @brief Imbues the regular expression object with the given locale. * * @param loc A locale. */ locale_type imbue(locale_type __loc) { return _M_traits.imbue(__loc); } /** * @brief Gets the locale currently imbued in the regular expression * object. */ locale_type getloc() const { return _M_traits.getloc(); } // [7.8.6] swap /** * @brief Swaps the contents of two regular expression objects. * * @param rhs Another regular expression object. */ void swap(basic_regex& __rhs) { std::swap(_M_flags, __rhs._M_flags); std::swap(_M_pattern, __rhs._M_pattern); std::swap(_M_mark_count, __rhs._M_mark_count); std::swap(_M_traits, __rhs._M_traits); } private: /** * @brief Compiles a regular expression pattern into a NFA. * @todo Implement this function. */ void _M_compile(); protected: flag_type _M_flags; string_type _M_pattern; unsigned int _M_mark_count; _Rx_traits _M_traits; }; /** @brief Standard regular expressions. */ typedef basic_regex<char> regex; #ifdef _GLIBCXX_USE_WCHAR_T /** @brief Standard wide-character regular expressions. */ typedef basic_regex<wchar_t> wregex; #endif // [7.8.6] basic_regex swap /** * @brief Swaps the contents of two regular expression objects. * @param lhs First regular expression. * @param rhs Second regular expression. */ template<typename _Ch_type, typename _Rx_traits> inline void swap(basic_regex<_Ch_type, _Rx_traits>& __lhs, basic_regex<_Ch_type, _Rx_traits>& __rhs) { __lhs.swap(__rhs); } // [7.9] Class template sub_match /** * A sequence of characters matched by a particular marked sub-expression. * * An object of this class is essentially a pair of iterators marking a * matched subexpression within a regular expression pattern match. Such * objects can be converted to and compared with std::basic_string objects * of a similar base character type as the pattern matched by the regular * expression. * * The iterators that make up the pair are the usual half-open interval * referencing the actual original pattern matched. */ template<typename _BiIter> class sub_match : public std::pair<_BiIter, _BiIter> { public: typedef typename iterator_traits<_BiIter>::value_type value_type; typedef typename iterator_traits<_BiIter>::difference_type difference_type; typedef _BiIter iterator; public: bool matched; /** * Gets the length of the matching sequence. */ difference_type length() const { return this->matched ? std::distance(this->first, this->second) : 0; } /** * @brief Gets the matching sequence as a string. * * @returns the matching sequence as a string. * * This is the implicit conversion operator. It is identical to the * str() member function except that it will want to pop up in * unexpected places and cause a great deal of confusion and cursing * from the unwary. */ operator basic_string<value_type>() const { return this->matched ? std::basic_string<value_type>(this->first, this->second) : std::basic_string<value_type>(); } /** * @brief Gets the matching sequence as a string. * * @returns the matching sequence as a string. */ basic_string<value_type> str() const { return this->matched ? std::basic_string<value_type>(this->first, this->second) : std::basic_string<value_type>(); } /** * @brief Compares this and another matched sequence. * * @param s Another matched sequence to compare to this one. * * @retval <0 this matched sequence will collate before @p s. * @retval =0 this matched sequence is equivalent to @p s. * @retval <0 this matched sequence will collate after @p s. */ int compare(const sub_match& __s) const { return this->str().compare(__s.str()); } /** * @brief Compares this sub_match to a string. * * @param s A string to compare to this sub_match. * * @retval <0 this matched sequence will collate before @p s. * @retval =0 this matched sequence is equivalent to @p s. * @retval <0 this matched sequence will collate after @p s. */ int compare(const basic_string<value_type>& __s) const { return this->str().compare(__s); } /** * @brief Compares this sub_match to a C-style string. * * @param s A C-style string to compare to this sub_match. * * @retval <0 this matched sequence will collate before @p s. * @retval =0 this matched sequence is equivalent to @p s. * @retval <0 this matched sequence will collate after @p s. */ int compare(const value_type* __s) const { return this->str().compare(__s); } }; /** @brief Standard regex submatch over a C-style null-terminated string. */ typedef sub_match<const char*> csub_match; /** @brief Standard regex submatch over a standard string. */ typedef sub_match<string::const_iterator> ssub_match; #ifdef _GLIBCXX_USE_WCHAR_T /** @brief Regex submatch over a C-style null-terminated wide string. */ typedef sub_match<const wchar_t*> wcsub_match; /** @brief Regex submatch over a standard wide string. */ typedef sub_match<wstring::const_iterator> wssub_match; #endif // [7.9.2] sub_match non-member operators /** * @brief Tests the equivalence of two regular expression submatches. * @param lhs First regular expression submatch. * @param rhs Second regular expression submatch. * @returns true if @a lhs is equivalent to @a rhs, false otherwise. */ template<typename _BiIter> inline bool operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) { return __lhs.compare(__rhs) == 0; } /** * @brief Tests the inequivalence of two regular expression submatches. * @param lhs First regular expression submatch. * @param rhs Second regular expression submatch. * @returns true if @a lhs is not equivalent to @a rhs, false otherwise. */ template<typename _BiIter> inline bool operator!=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) { return __lhs.compare(__rhs) != 0; } /** * @brief Tests the ordering of two regular expression submatches. * @param lhs First regular expression submatch. * @param rhs Second regular expression submatch. * @returns true if @a lhs precedes @a rhs, false otherwise. */ template<typename _BiIter> inline bool operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) { return __lhs.compare(__rhs) < 0; } /** * @brief Tests the ordering of two regular expression submatches. * @param lhs First regular expression submatch. * @param rhs Second regular expression submatch. * @returns true if @a lhs does not succeed @a rhs, false otherwise. */ template<typename _BiIter> inline bool operator<=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) { return __lhs.compare(__rhs) <= 0; } /** * @brief Tests the ordering of two regular expression submatches. * @param lhs First regular expression submatch. * @param rhs Second regular expression submatch. * @returns true if @a lhs does not precede @a rhs, false otherwise. */ template<typename _BiIter> inline bool operator>=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) { return __lhs.compare(__rhs) >= 0; } /** * @brief Tests the ordering of two regular expression submatches. * @param lhs First regular expression submatch. * @param rhs Second regular expression submatch. * @returns true if @a lhs succeeds @a rhs, false otherwise. */ template<typename _BiIter> inline bool operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) { return __lhs.compare(__rhs) > 0; } /** * @brief Tests the equivalence of a string and a regular expression * submatch. * @param lhs A string. * @param rhs A regular expression submatch. * @returns true if @a lhs is equivalent to @a rhs, false otherwise. */ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc> inline bool operator==(const basic_string< typename iterator_traits<_Bi_iter>::value_type, _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs) { return __lhs == __rhs.str(); } /** * @brief Tests the inequivalence of a string and a regular expression * submatch. * @param lhs A string. * @param rhs A regular expression submatch. * @returns true if @a lhs is not equivalent to @a rhs, false otherwise. */ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc> inline bool operator!=(const basic_string< typename iterator_traits<_Bi_iter>::value_type, _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs) { return __lhs != __rhs.str(); } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param lhs A string. * @param rhs A regular expression submatch. * @returns true if @a lhs precedes @a rhs, false otherwise. */ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc> inline bool operator<(const basic_string< typename iterator_traits<_Bi_iter>::value_type, _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs) { return __lhs < __rhs.str(); } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param lhs A string. * @param rhs A regular expression submatch. * @returns true if @a lhs succeeds @a rhs, false otherwise. */ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc> inline bool operator>(const basic_string< typename iterator_traits<_Bi_iter>::value_type, _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs) { return __lhs > __rhs.str(); } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param lhs A string. * @param rhs A regular expression submatch. * @returns true if @a lhs does not precede @a rhs, false otherwise. */ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc> inline bool operator>=(const basic_string< typename iterator_traits<_Bi_iter>::value_type, _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs) { return __lhs >= __rhs.str(); } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param lhs A string. * @param rhs A regular expression submatch. * @returns true if @a lhs does not succeed @a rhs, false otherwise. */ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc> inline bool operator<=(const basic_string< typename iterator_traits<_Bi_iter>::value_type, _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs) { return __lhs <= __rhs.str(); } /** * @brief Tests the equivalence of a regular expression submatch and a * string. * @param lhs A regular expression submatch. * @param rhs A string. * @returns true if @a lhs is equivalent to @a rhs, false otherwise. */ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc> inline bool operator==(const sub_match<_Bi_iter>& __lhs, const basic_string< typename iterator_traits<_Bi_iter>::value_type, _Ch_traits, _Ch_alloc>& __rhs) { return __lhs.str() == __rhs; } /** * @brief Tests the inequivalence of a regular expression submatch and a * string. * @param lhs A regular expression submatch. * @param rhs A string. * @returns true if @a lhs is not equivalent to @a rhs, false otherwise. */ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc> inline bool operator!=(const sub_match<_Bi_iter>& __lhs, const basic_string< typename iterator_traits<_Bi_iter>::value_type, _Ch_traits, _Ch_alloc>& __rhs) { return __lhs.str() != __rhs; } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param lhs A regular expression submatch. * @param rhs A string. * @returns true if @a lhs precedes @a rhs, false otherwise. */ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc> inline bool operator<(const sub_match<_Bi_iter>& __lhs, const basic_string< typename iterator_traits<_Bi_iter>::value_type, _Ch_traits, _Ch_alloc>& __rhs) { return __lhs.str() < __rhs; } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param lhs A regular expression submatch. * @param rhs A string. * @returns true if @a lhs succeeds @a rhs, false otherwise. */ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc> inline bool operator>(const sub_match<_Bi_iter>& __lhs, const basic_string< typename iterator_traits<_Bi_iter>::value_type, _Ch_traits, _Ch_alloc>& __rhs) { return __lhs.str() > __rhs; } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param lhs A regular expression submatch. * @param rhs A string. * @returns true if @a lhs does not precede @a rhs, false otherwise. */ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc> inline bool operator>=(const sub_match<_Bi_iter>& __lhs, const basic_string< typename iterator_traits<_Bi_iter>::value_type, _Ch_traits, _Ch_alloc>& __rhs) { return __lhs.str() >= __rhs; } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param lhs A regular expression submatch. * @param rhs A string. * @returns true if @a lhs does not succeed @a rhs, false otherwise. */ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc> inline bool operator<=(const sub_match<_Bi_iter>& __lhs, const basic_string< typename iterator_traits<_Bi_iter>::value_type, _Ch_traits, _Ch_alloc>& __rhs) { return __lhs.str() <= __rhs; } /** * @brief Tests the equivalence of a C string and a regular expression * submatch. * @param lhs A C string. * @param rhs A regular expression submatch. * @returns true if @a lhs is equivalent to @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, const sub_match<_Bi_iter>& __rhs) { return __lhs == __rhs.str(); } /** * @brief Tests the inequivalence of an iterator value and a regular * expression submatch. * @param lhs A regular expression submatch. * @param rhs A string. * @returns true if @a lhs is not equivalent to @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, const sub_match<_Bi_iter>& __rhs) { return __lhs != __rhs.str(); } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param lhs A string. * @param rhs A regular expression submatch. * @returns true if @a lhs precedes @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, const sub_match<_Bi_iter>& __rhs) { return __lhs < __rhs.str(); } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param lhs A string. * @param rhs A regular expression submatch. * @returns true if @a lhs succeeds @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs, const sub_match<_Bi_iter>& __rhs) { return __lhs > __rhs.str(); } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param lhs A string. * @param rhs A regular expression submatch. * @returns true if @a lhs does not precede @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator>=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, const sub_match<_Bi_iter>& __rhs) { return __lhs >= __rhs.str(); } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param lhs A string. * @param rhs A regular expression submatch. * @returns true if @a lhs does not succeed @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator<=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, const sub_match<_Bi_iter>& __rhs) { return __lhs <= __rhs.str(); } /** * @brief Tests the equivalence of a regular expression submatch and a * string. * @param lhs A regular expression submatch. * @param rhs A pointer to a string? * @returns true if @a lhs is equivalent to @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator==(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const* __rhs) { return __lhs.str() == __rhs; } /** * @brief Tests the inequivalence of a regular expression submatch and a * string. * @param lhs A regular expression submatch. * @param rhs A pointer to a string. * @returns true if @a lhs is not equivalent to @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator!=(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const* __rhs) { return __lhs.str() != __rhs; } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param lhs A regular expression submatch. * @param rhs A string. * @returns true if @a lhs precedes @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator<(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const* __rhs) { return __lhs.str() < __rhs; } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param lhs A regular expression submatch. * @param rhs A string. * @returns true if @a lhs succeeds @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator>(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const* __rhs) { return __lhs.str() > __rhs; } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param lhs A regular expression submatch. * @param rhs A string. * @returns true if @a lhs does not precede @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator>=(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const* __rhs) { return __lhs.str() >= __rhs; } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param lhs A regular expression submatch. * @param rhs A string. * @returns true if @a lhs does not succeed @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator<=(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const* __rhs) { return __lhs.str() <= __rhs; } /** * @brief Tests the equivalence of a string and a regular expression * submatch. * @param lhs A string. * @param rhs A regular expression submatch. * @returns true if @a lhs is equivalent to @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, const sub_match<_Bi_iter>& __rhs) { return __lhs == __rhs.str(); } /** * @brief Tests the inequivalence of a string and a regular expression * submatch. * @param lhs A string. * @param rhs A regular expression submatch. * @returns true if @a lhs is not equivalent to @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, const sub_match<_Bi_iter>& __rhs) { return __lhs != __rhs.str(); } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param lhs A string. * @param rhs A regular expression submatch. * @returns true if @a lhs precedes @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, const sub_match<_Bi_iter>& __rhs) { return __lhs < __rhs.str(); } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param lhs A string. * @param rhs A regular expression submatch. * @returns true if @a lhs succeeds @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs, const sub_match<_Bi_iter>& __rhs) { return __lhs > __rhs.str(); } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param lhs A string. * @param rhs A regular expression submatch. * @returns true if @a lhs does not precede @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator>=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, const sub_match<_Bi_iter>& __rhs) { return __lhs >= __rhs.str(); } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param lhs A string. * @param rhs A regular expression submatch. * @returns true if @a lhs does not succeed @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator<=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, const sub_match<_Bi_iter>& __rhs) { return __lhs <= __rhs.str(); } /** * @brief Tests the equivalence of a regular expression submatch and a * string. * @param lhs A regular expression submatch. * @param rhs A const string reference. * @returns true if @a lhs is equivalent to @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator==(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const& __rhs) { return __lhs.str() == __rhs; } /** * @brief Tests the inequivalence of a regular expression submatch and a * string. * @param lhs A regular expression submatch. * @param rhs A const string reference. * @returns true if @a lhs is not equivalent to @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator!=(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const& __rhs) { return __lhs.str() != __rhs; } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param lhs A regular expression submatch. * @param rhs A const string reference. * @returns true if @a lhs precedes @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator<(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const& __rhs) { return __lhs.str() < __rhs; } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param lhs A regular expression submatch. * @param rhs A const string reference. * @returns true if @a lhs succeeds @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator>(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const& __rhs) { return __lhs.str() > __rhs; } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param lhs A regular expression submatch. * @param rhs A const string reference. * @returns true if @a lhs does not precede @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator>=(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const& __rhs) { return __lhs.str() >= __rhs; } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param lhs A regular expression submatch. * @param rhs A const string reference. * @returns true if @a lhs does not succeed @a rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator<=(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const& __rhs) { return __lhs.str() <= __rhs; } /** * @brief Inserts a matched string into an output stream. * * @param os The output stream. * @param m A submatch string. * * @returns the output stream with the submatch string inserted. */ template<typename _Ch_type, typename _Ch_traits, typename _Bi_iter> inline basic_ostream<_Ch_type, _Ch_traits>& operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os, const sub_match<_Bi_iter>& __m) { return __os << __m.str(); } // [7.10] Class template match_results /** * @brief The results of a match or search operation. * * A collection of character sequences representing the result of a regular * expression match. Storage for the collection is allocated and freed as * necessary by the member functions of class template match_results. * * This class satisfies the Sequence requirements, with the exception that * only the operations defined for a const-qualified Sequence are supported. * * The sub_match object stored at index 0 represents sub-expression 0, i.e. * the whole match. In this case the sub_match member matched is always true. * The sub_match object stored at index n denotes what matched the marked * sub-expression n within the matched expression. If the sub-expression n * participated in a regular expression match then the sub_match member * matched evaluates to true, and members first and second denote the range * of characters [first, second) which formed that match. Otherwise matched * is false, and members first and second point to the end of the sequence * that was searched. * * @nosubgrouping */ template<typename _Bi_iter, typename _Allocator = allocator<sub_match<_Bi_iter> > > class match_results : private std::vector<std::tr1::sub_match<_Bi_iter>, _Allocator> { private: typedef std::vector<std::tr1::sub_match<_Bi_iter>, _Allocator> _Base_type; public: /** * @name 10.? Public Types */ //@{ typedef sub_match<_Bi_iter> value_type; typedef typename _Allocator::const_reference const_reference; typedef const_reference reference; typedef typename _Base_type::const_iterator const_iterator; typedef const_iterator iterator; typedef typename iterator_traits<_Bi_iter>::difference_type difference_type; typedef typename _Allocator::size_type size_type; typedef _Allocator allocator_type; typedef typename iterator_traits<_Bi_iter>::value_type char_type; typedef basic_string<char_type> string_type; //@} public: /** * @name 10.1 Construction, Copying, and Destruction */ //@{ /** * @brief Constructs a default %match_results container. * @post size() returns 0 and str() returns an empty string. */ explicit match_results(const _Allocator& __a = _Allocator()) : _Base_type(__a), _M_matched(false) { } /** * @brief Copy constructs a %match_results. */ match_results(const match_results& __rhs) : _Base_type(__rhs), _M_matched(__rhs._M_matched), _M_prefix(__rhs._M_prefix), _M_suffix(__rhs._M_suffix) { } /** * @brief Assigns rhs to *this. */ match_results& operator=(const match_results& __rhs) { match_results __tmp(__rhs); this->swap(__tmp); return *this; } /** * @brief Destroys a %match_results object. */ ~match_results() { } //@} /** * @name 10.2 Size */ //@{ /** * @brief Gets the number of matches and submatches. * * The number of matches for a given regular expression will be either 0 * if there was no match or mark_count() + 1 if a match was successful. * Some matches may be empty. * * @returns the number of matches found. */ size_type size() const { return _M_matched ? _Base_type::size() + 1 : 0; } //size_type //max_size() const; using _Base_type::max_size; /** * @brief Indicates if the %match_results contains no results. * @retval true The %match_results object is empty. * @retval false The %match_results object is not empty. */ bool empty() const { return size() == 0; } //@} /** * @name 10.3 Element Access */ //@{ /** * @brief Gets the length of the indicated submatch. * @param sub indicates the submatch. * * This function returns the length of the indicated submatch, or the * length of the entire match if @p sub is zero (the default). */ difference_type length(size_type __sub = 0) const { return _M_matched ? this->str(__sub).length() : 0; } /** * @brief Gets the offset of the beginning of the indicated submatch. * @param sub indicates the submatch. * * This function returns the offset from the beginning of the target * sequence to the beginning of the submatch, unless the value of @p sub * is zero (the default), in which case this function returns the offset * from the beginning of the target sequence to the beginning of the * match. */ difference_type position(size_type __sub = 0) const { return _M_matched ? std::distance(this->prefix().first, (*this)[__sub].first) : 0; } /** * @brief Gets the match or submatch converted to a string type. * @param sub indicates the submatch. * * This function gets the submatch (or match, if @p sub is zero) extracted * from the target range and converted to the associated string type. */ string_type str(size_type __sub = 0) const { return _M_matched ? (*this)[__sub].str() : string_type(); } /** * @brief Gets a %sub_match reference for the match or submatch. * @param sub indicates the submatch. * * This function gets a reference to the indicated submatch, or the entire * match if @p sub is zero. * * If @p sub >= size() then this function returns a %sub_match with a * special value indicating no submatch. */ const_reference operator[](size_type __sub) const { return _Base_type::operator[](__sub); } /** * @brief Gets a %sub_match representing the match prefix. * * This function gets a reference to a %sub_match object representing the * part of the target range between the start of the target range and the * start of the match. */ const_reference prefix() const { return _M_prefix; } /** * @brief Gets a %sub_match representing the match suffix. * * This function gets a reference to a %sub_match object representing the * part of the target range between the end of the match and the end of * the target range. */ const_reference suffix() const { return _M_suffix; } /** * @brief Gets an iterator to the start of the %sub_match collection. */ const_iterator begin() const { return _Base_type::begin(); } #ifdef _GLIBCXX_INCLUDE_AS_CXX11 /** * @brief Gets an iterator to the start of the %sub_match collection. */ const_iterator cbegin() const { return _Base_type::begin(); } #endif /** * @brief Gets an iterator to one-past-the-end of the collection. */ const_iterator end() const { return _Base_type::end(); } #ifdef _GLIBCXX_INCLUDE_AS_CXX11 /** * @brief Gets an iterator to one-past-the-end of the collection. */ const_iterator cend() const { return _Base_type::end(); } #endif //@} /** * @name 10.4 Formatting * * These functions perform formatted substitution of the matched * character sequences into their target. The format specifiers * and escape sequences accepted by these functions are * determined by their @p flags parameter as documented above. */ //@{ /** * @todo Implement this function. */ template<typename _Out_iter> _Out_iter format(_Out_iter __out, const string_type& __fmt, regex_constants::match_flag_type __flags = regex_constants::format_default) const; /** * @todo Implement this function. */ string_type format(const string_type& __fmt, regex_constants::match_flag_type __flags = regex_constants::format_default) const; //@} /** * @name 10.5 Allocator */ //@{ /** * @brief Gets a copy of the allocator. */ //allocator_type //get_allocator() const; using _Base_type::get_allocator; //@} /** * @name 10.6 Swap */ //@{ /** * @brief Swaps the contents of two match_results. */ void swap(match_results& __that) { _Base_type::swap(__that); std::swap(_M_matched, __that._M_matched); std::swap(_M_prefix, __that._M_prefix); std::swap(_M_suffix, __that._M_suffix); } //@} private: bool _M_matched; value_type _M_prefix; value_type _M_suffix; }; typedef match_results<const char*> cmatch; typedef match_results<string::const_iterator> smatch; #ifdef _GLIBCXX_USE_WCHAR_T typedef match_results<const wchar_t*> wcmatch; typedef match_results<wstring::const_iterator> wsmatch; #endif // match_results comparisons /** * @brief Compares two match_results for equality. * @returns true if the two objects refer to the same match, * false otherwise. * @todo Implement this function. */ template<typename _Bi_iter, typename _Allocator> inline bool operator==(const match_results<_Bi_iter, _Allocator>& __m1, const match_results<_Bi_iter, _Allocator>& __m2); /** * @brief Compares two match_results for inequality. * @returns true if the two objects do not refer to the same match, * false otherwise. */ template<typename _Bi_iter, class _Allocator> inline bool operator!=(const match_results<_Bi_iter, _Allocator>& __m1, const match_results<_Bi_iter, _Allocator>& __m2) { return !(__m1 == __m2); } // [7.10.6] match_results swap /** * @brief Swaps two match results. * @param lhs A match result. * @param rhs A match result. * * The contents of the two match_results objects are swapped. */ template<typename _Bi_iter, typename _Allocator> inline void swap(match_results<_Bi_iter, _Allocator>& __lhs, match_results<_Bi_iter, _Allocator>& __rhs) { __lhs.swap(__rhs); } // [7.11.2] Function template regex_match /** * @name Matching, Searching, and Replacing */ //@{ /** * @brief Determines if there is a match between the regular expression @p e * and all of the character sequence [first, last). * * @param first Beginning of the character sequence to match. * @param last One-past-the-end of the character sequence to match. * @param m The match results. * @param re The regular expression. * @param flags Controls how the regular expression is matched. * * @retval true A match exists. * @retval false Otherwise. * * @throws an exception of type regex_error. * * @todo Implement this function. */ template<typename _Bi_iter, typename _Allocator, typename _Ch_type, typename _Rx_traits> bool regex_match(_Bi_iter __first, _Bi_iter __last, match_results<_Bi_iter, _Allocator>& __m, const basic_regex<_Ch_type, _Rx_traits>& __re, regex_constants::match_flag_type __flags = regex_constants::match_default); /** * @brief Indicates if there is a match between the regular expression @p e * and all of the character sequence [first, last). * * @param first Beginning of the character sequence to match. * @param last One-past-the-end of the character sequence to match. * @param re The regular expression. * @param flags Controls how the regular expression is matched. * * @retval true A match exists. * @retval false Otherwise. * * @throws an exception of type regex_error. */ template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits> bool regex_match(_Bi_iter __first, _Bi_iter __last, const basic_regex<_Ch_type, _Rx_traits>& __re, regex_constants::match_flag_type __flags = regex_constants::match_default) { match_results<_Bi_iter> __what; return regex_match(__first, __last, __what, __re, __flags); } /** * @brief Determines if there is a match between the regular expression @p e * and a C-style null-terminated string. * * @param s The C-style null-terminated string to match. * @param m The match results. * @param re The regular expression. * @param f Controls how the regular expression is matched. * * @retval true A match exists. * @retval false Otherwise. * * @throws an exception of type regex_error. */ template<typename _Ch_type, typename _Allocator, typename _Rx_traits> inline bool regex_match(const _Ch_type* __s, match_results<const _Ch_type*, _Allocator>& __m, const basic_regex<_Ch_type, _Rx_traits>& __re, regex_constants::match_flag_type __f = regex_constants::match_default) { return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); } /** * @brief Determines if there is a match between the regular expression @p e * and a string. * * @param s The string to match. * @param m The match results. * @param re The regular expression. * @param flags Controls how the regular expression is matched. * * @retval true A match exists. * @retval false Otherwise. * * @throws an exception of type regex_error. */ template<typename _Ch_traits, typename _Ch_alloc, typename _Allocator, typename _Ch_type, typename _Rx_traits> inline bool regex_match(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s, match_results<typename basic_string<_Ch_type, _Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m, const basic_regex<_Ch_type, _Rx_traits>& __re, regex_constants::match_flag_type __flags = regex_constants::match_default) { return regex_match(__s.begin(), __s.end(), __m, __re, __flags); } /** * @brief Indicates if there is a match between the regular expression @p e * and a C-style null-terminated string. * * @param s The C-style null-terminated string to match. * @param re The regular expression. * @param f Controls how the regular expression is matched. * * @retval true A match exists. * @retval false Otherwise. * * @throws an exception of type regex_error. */ template<typename _Ch_type, class _Rx_traits> inline bool regex_match(const _Ch_type* __s, const basic_regex<_Ch_type, _Rx_traits>& __re, regex_constants::match_flag_type __f = regex_constants::match_default) { return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); } /** * @brief Indicates if there is a match between the regular expression @p e * and a string. * * @param s [IN] The string to match. * @param re [IN] The regular expression. * @param flags [IN] Controls how the regular expression is matched. * * @retval true A match exists. * @retval false Otherwise. * * @throws an exception of type regex_error. */ template<typename _Ch_traits, typename _Str_allocator, typename _Ch_type, typename _Rx_traits> inline bool regex_match(const basic_string<_Ch_type, _Ch_traits, _Str_allocator>& __s, const basic_regex<_Ch_type, _Rx_traits>& __re, regex_constants::match_flag_type __flags = regex_constants::match_default) { return regex_match(__s.begin(), __s.end(), __re, __flags); } // [7.11.3] Function template regex_search /** * Searches for a regular expression within a range. * @param first [IN] The start of the string to search. * @param last [IN] One-past-the-end of the string to search. * @param m [OUT] The match results. * @param re [IN] The regular expression to search for. * @param flags [IN] Search policy flags. * @retval true A match was found within the string. * @retval false No match was found within the string, the content of %m is * undefined. * * @throws an exception of type regex_error. * * @todo Implement this function. */ template<typename _Bi_iter, typename _Allocator, typename _Ch_type, typename _Rx_traits> inline bool regex_search(_Bi_iter __first, _Bi_iter __last, match_results<_Bi_iter, _Allocator>& __m, const basic_regex<_Ch_type, _Rx_traits>& __re, regex_constants::match_flag_type __flags = regex_constants::match_default); /** * Searches for a regular expression within a range. * @param first [IN] The start of the string to search. * @param last [IN] One-past-the-end of the string to search. * @param re [IN] The regular expression to search for. * @param flags [IN] Search policy flags. * @retval true A match was found within the string. * @retval false No match was found within the string. * @doctodo * * @throws an exception of type regex_error. */ template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits> inline bool regex_search(_Bi_iter __first, _Bi_iter __last, const basic_regex<_Ch_type, _Rx_traits>& __re, regex_constants::match_flag_type __flags = regex_constants::match_default) { match_results<_Bi_iter> __what; return regex_search(__first, __last, __what, __re, __flags); } /** * @brief Searches for a regular expression within a C-string. * @param s [IN] A C-string to search for the regex. * @param m [OUT] The set of regex matches. * @param e [IN] The regex to search for in @p s. * @param f [IN] The search flags. * @retval true A match was found within the string. * @retval false No match was found within the string, the content of %m is * undefined. * @doctodo * * @throws an exception of type regex_error. */ template<typename _Ch_type, class _Allocator, class _Rx_traits> inline bool regex_search(const _Ch_type* __s, match_results<const _Ch_type*, _Allocator>& __m, const basic_regex<_Ch_type, _Rx_traits>& __e, regex_constants::match_flag_type __f = regex_constants::match_default) { return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); } /** * @brief Searches for a regular expression within a C-string. * @param s [IN] The C-string to search. * @param e [IN] The regular expression to search for. * @param f [IN] Search policy flags. * @retval true A match was found within the string. * @retval false No match was found within the string. * @doctodo * * @throws an exception of type regex_error. */ template<typename _Ch_type, typename _Rx_traits> inline bool regex_search(const _Ch_type* __s, const basic_regex<_Ch_type, _Rx_traits>& __e, regex_constants::match_flag_type __f = regex_constants::match_default) { return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); } /** * @brief Searches for a regular expression within a string. * @param s [IN] The string to search. * @param e [IN] The regular expression to search for. * @param flags [IN] Search policy flags. * @retval true A match was found within the string. * @retval false No match was found within the string. * @doctodo * * @throws an exception of type regex_error. */ template<typename _Ch_traits, typename _String_allocator, typename _Ch_type, typename _Rx_traits> inline bool regex_search(const basic_string<_Ch_type, _Ch_traits, _String_allocator>& __s, const basic_regex<_Ch_type, _Rx_traits>& __e, regex_constants::match_flag_type __flags = regex_constants::match_default) { return regex_search(__s.begin(), __s.end(), __e, __flags); } /** * @brief Searches for a regular expression within a string. * @param s [IN] A C++ string to search for the regex. * @param m [OUT] The set of regex matches. * @param e [IN] The regex to search for in @p s. * @param f [IN] The search flags. * @retval true A match was found within the string. * @retval false No match was found within the string, the content of %m is * undefined. * * @throws an exception of type regex_error. */ template<typename _Ch_traits, typename _Ch_alloc, typename _Allocator, typename _Ch_type, typename _Rx_traits> inline bool regex_search(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s, match_results<typename basic_string<_Ch_type, _Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m, const basic_regex<_Ch_type, _Rx_traits>& __e, regex_constants::match_flag_type __f = regex_constants::match_default) { return regex_search(__s.begin(), __s.end(), __m, __e, __f); } // tr1 [7.11.4] std [28.11.4] Function template regex_replace /** * @doctodo * @param out * @param first * @param last * @param e * @param fmt * @param flags * * @returns out * @throws an exception of type regex_error. * * @todo Implement this function. */ template<typename _Out_iter, typename _Bi_iter, typename _Rx_traits, typename _Ch_type> inline _Out_iter regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, const basic_regex<_Ch_type, _Rx_traits>& __e, const basic_string<_Ch_type>& __fmt, regex_constants::match_flag_type __flags = regex_constants::match_default); /** * @doctodo * @param s * @param e * @param fmt * @param flags * * @returns a copy of string @p s with replacements. * * @throws an exception of type regex_error. */ template<typename _Rx_traits, typename _Ch_type> inline basic_string<_Ch_type> regex_replace(const basic_string<_Ch_type>& __s, const basic_regex<_Ch_type, _Rx_traits>& __e, const basic_string<_Ch_type>& __fmt, regex_constants::match_flag_type __flags = regex_constants::match_default) { std::string __result; regex_replace(std::back_inserter(__result), __s.begin(), __s.end(), __e, __fmt, __flags); return __result; } //@} // tr1 [7.12.1] std [28.12] Class template regex_iterator /** * An iterator adaptor that will provide repeated calls of regex_search over * a range until no more matches remain. */ template<typename _Bi_iter, typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type, typename _Rx_traits = regex_traits<_Ch_type> > class regex_iterator { public: typedef basic_regex<_Ch_type, _Rx_traits> regex_type; typedef match_results<_Bi_iter> value_type; typedef std::ptrdiff_t difference_type; typedef const value_type* pointer; typedef const value_type& reference; typedef std::forward_iterator_tag iterator_category; public: /** * @brief Provides a singular iterator, useful for indicating * one-past-the-end of a range. * @todo Implement this function. * @doctodo */ regex_iterator(); /** * Constructs a %regex_iterator... * @param a [IN] The start of a text range to search. * @param b [IN] One-past-the-end of the text range to search. * @param re [IN] The regular expression to match. * @param m [IN] Policy flags for match rules. * @todo Implement this function. * @doctodo */ regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re, regex_constants::match_flag_type __m = regex_constants::match_default); /** * Copy constructs a %regex_iterator. * @todo Implement this function. * @doctodo */ regex_iterator(const regex_iterator& __rhs); /** * @todo Implement this function. * @doctodo */ regex_iterator& operator=(const regex_iterator& __rhs); /** * @todo Implement this function. * @doctodo */ bool operator==(const regex_iterator& __rhs); /** * @todo Implement this function. * @doctodo */ bool operator!=(const regex_iterator& __rhs); /** * @todo Implement this function. * @doctodo */ const value_type& operator*(); /** * @todo Implement this function. * @doctodo */ const value_type* operator->(); /** * @todo Implement this function. * @doctodo */ regex_iterator& operator++(); /** * @todo Implement this function. * @doctodo */ regex_iterator operator++(int); private: // these members are shown for exposition only: _Bi_iter begin; _Bi_iter end; const regex_type* pregex; regex_constants::match_flag_type flags; match_results<_Bi_iter> match; }; typedef regex_iterator<const char*> cregex_iterator; typedef regex_iterator<string::const_iterator> sregex_iterator; #ifdef _GLIBCXX_USE_WCHAR_T typedef regex_iterator<const wchar_t*> wcregex_iterator; typedef regex_iterator<wstring::const_iterator> wsregex_iterator; #endif // [7.12.2] Class template regex_token_iterator /** * Iterates over submatches in a range (or @a splits a text string). * * The purpose of this iterator is to enumerate all, or all specified, * matches of a regular expression within a text range. The dereferenced * value of an iterator of this class is a std::tr1::sub_match object. */ template<typename _Bi_iter, typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type, typename _Rx_traits = regex_traits<_Ch_type> > class regex_token_iterator { public: typedef basic_regex<_Ch_type, _Rx_traits> regex_type; typedef sub_match<_Bi_iter> value_type; typedef std::ptrdiff_t difference_type; typedef const value_type* pointer; typedef const value_type& reference; typedef std::forward_iterator_tag iterator_category; public: /** * @brief Default constructs a %regex_token_iterator. * @todo Implement this function. * * A default-constructed %regex_token_iterator is a singular iterator * that will compare equal to the one-past-the-end value for any * iterator of the same type. */ regex_token_iterator(); /** * Constructs a %regex_token_iterator... * @param a [IN] The start of the text to search. * @param b [IN] One-past-the-end of the text to search. * @param re [IN] The regular expression to search for. * @param submatch [IN] Which submatch to return. There are some * special values for this parameter: * - -1 each enumerated subexpression does NOT * match the regular expression (aka field * splitting) * - 0 the entire string matching the * subexpression is returned for each match * within the text. * - >0 enumerates only the indicated * subexpression from a match within the text. * @param m [IN] Policy flags for match rules. * * @todo Implement this function. * @doctodo */ regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re, int __submatch = 0, regex_constants::match_flag_type __m = regex_constants::match_default); /** * Constructs a %regex_token_iterator... * @param a [IN] The start of the text to search. * @param b [IN] One-past-the-end of the text to search. * @param re [IN] The regular expression to search for. * @param submatches [IN] A list of subexpressions to return for each * regular expression match within the text. * @param m [IN] Policy flags for match rules. * * @todo Implement this function. * @doctodo */ regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re, const std::vector<int>& __submatches, regex_constants::match_flag_type __m = regex_constants::match_default); /** * Constructs a %regex_token_iterator... * @param a [IN] The start of the text to search. * @param b [IN] One-past-the-end of the text to search. * @param re [IN] The regular expression to search for. * @param submatches [IN] A list of subexpressions to return for each * regular expression match within the text. * @param m [IN] Policy flags for match rules. * @todo Implement this function. * @doctodo */ template<std::size_t _Nm> regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re, const int (&__submatches)[_Nm], regex_constants::match_flag_type __m = regex_constants::match_default); /** * @brief Copy constructs a %regex_token_iterator. * @param rhs [IN] A %regex_token_iterator to copy. * @todo Implement this function. */ regex_token_iterator(const regex_token_iterator& __rhs); /** * @brief Assigns a %regex_token_iterator to another. * @param rhs [IN] A %regex_token_iterator to copy. * @todo Implement this function. */ regex_token_iterator& operator=(const regex_token_iterator& __rhs); /** * @brief Compares a %regex_token_iterator to another for equality. * @todo Implement this function. */ bool operator==(const regex_token_iterator& __rhs); /** * @brief Compares a %regex_token_iterator to another for inequality. * @todo Implement this function. */ bool operator!=(const regex_token_iterator& __rhs); /** * @brief Dereferences a %regex_token_iterator. * @todo Implement this function. */ const value_type& operator*(); /** * @brief Selects a %regex_token_iterator member. * @todo Implement this function. */ const value_type* operator->(); /** * @brief Increments a %regex_token_iterator. * @todo Implement this function. */ regex_token_iterator& operator++(); /** * @brief Postincrements a %regex_token_iterator. * @todo Implement this function. */ regex_token_iterator operator++(int); private: // data members for exposition only: typedef regex_iterator<_Bi_iter, _Ch_type, _Rx_traits> position_iterator; position_iterator __position; const value_type* __result; value_type __suffix; std::size_t __n; std::vector<int> __subs; }; /** @brief Token iterator for C-style NULL-terminated strings. */ typedef regex_token_iterator<const char*> cregex_token_iterator; /** @brief Token iterator for standard strings. */ typedef regex_token_iterator<string::const_iterator> sregex_token_iterator; #ifdef _GLIBCXX_USE_WCHAR_T /** @brief Token iterator for C-style NULL-terminated wide strings. */ typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator; /** @brief Token iterator for standard wide-character strings. */ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator; #endif //@} _GLIBCXX_END_NAMESPACE_VERSION } } #endif // _GLIBCXX_TR1_REGEX ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/hashtable_policy.h��������������������������������������������������������������������0000644�����������������00000061217�14763166027�0012001 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Internal policy header for TR1 unordered_set and unordered_map -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/hashtable_policy.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. * @headername{tr1/unordered_map, tr1/unordered_set} */ namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Helper function: return distance(first, last) for forward // iterators, or 0 for input iterators. template<class _Iterator> inline typename std::iterator_traits<_Iterator>::difference_type __distance_fw(_Iterator __first, _Iterator __last, std::input_iterator_tag) { return 0; } template<class _Iterator> inline typename std::iterator_traits<_Iterator>::difference_type __distance_fw(_Iterator __first, _Iterator __last, std::forward_iterator_tag) { return std::distance(__first, __last); } template<class _Iterator> inline typename std::iterator_traits<_Iterator>::difference_type __distance_fw(_Iterator __first, _Iterator __last) { typedef typename std::iterator_traits<_Iterator>::iterator_category _Tag; return __distance_fw(__first, __last, _Tag()); } // Auxiliary types used for all instantiations of _Hashtable: nodes // and iterators. // Nodes, used to wrap elements stored in the hash table. A policy // template parameter of class template _Hashtable controls whether // nodes also store a hash code. In some cases (e.g. strings) this // may be a performance win. template<typename _Value, bool __cache_hash_code> struct _Hash_node; template<typename _Value> struct _Hash_node<_Value, true> { _Value _M_v; std::size_t _M_hash_code; _Hash_node* _M_next; }; template<typename _Value> struct _Hash_node<_Value, false> { _Value _M_v; _Hash_node* _M_next; }; // Local iterators, used to iterate within a bucket but not between // buckets. template<typename _Value, bool __cache> struct _Node_iterator_base { _Node_iterator_base(_Hash_node<_Value, __cache>* __p) : _M_cur(__p) { } void _M_incr() { _M_cur = _M_cur->_M_next; } _Hash_node<_Value, __cache>* _M_cur; }; template<typename _Value, bool __cache> inline bool operator==(const _Node_iterator_base<_Value, __cache>& __x, const _Node_iterator_base<_Value, __cache>& __y) { return __x._M_cur == __y._M_cur; } template<typename _Value, bool __cache> inline bool operator!=(const _Node_iterator_base<_Value, __cache>& __x, const _Node_iterator_base<_Value, __cache>& __y) { return __x._M_cur != __y._M_cur; } template<typename _Value, bool __constant_iterators, bool __cache> struct _Node_iterator : public _Node_iterator_base<_Value, __cache> { typedef _Value value_type; typedef typename __gnu_cxx::__conditional_type<__constant_iterators, const _Value*, _Value*>::__type pointer; typedef typename __gnu_cxx::__conditional_type<__constant_iterators, const _Value&, _Value&>::__type reference; typedef std::ptrdiff_t difference_type; typedef std::forward_iterator_tag iterator_category; _Node_iterator() : _Node_iterator_base<_Value, __cache>(0) { } explicit _Node_iterator(_Hash_node<_Value, __cache>* __p) : _Node_iterator_base<_Value, __cache>(__p) { } reference operator*() const { return this->_M_cur->_M_v; } pointer operator->() const { return std::__addressof(this->_M_cur->_M_v); } _Node_iterator& operator++() { this->_M_incr(); return *this; } _Node_iterator operator++(int) { _Node_iterator __tmp(*this); this->_M_incr(); return __tmp; } }; template<typename _Value, bool __constant_iterators, bool __cache> struct _Node_const_iterator : public _Node_iterator_base<_Value, __cache> { typedef _Value value_type; typedef const _Value* pointer; typedef const _Value& reference; typedef std::ptrdiff_t difference_type; typedef std::forward_iterator_tag iterator_category; _Node_const_iterator() : _Node_iterator_base<_Value, __cache>(0) { } explicit _Node_const_iterator(_Hash_node<_Value, __cache>* __p) : _Node_iterator_base<_Value, __cache>(__p) { } _Node_const_iterator(const _Node_iterator<_Value, __constant_iterators, __cache>& __x) : _Node_iterator_base<_Value, __cache>(__x._M_cur) { } reference operator*() const { return this->_M_cur->_M_v; } pointer operator->() const { return std::__addressof(this->_M_cur->_M_v); } _Node_const_iterator& operator++() { this->_M_incr(); return *this; } _Node_const_iterator operator++(int) { _Node_const_iterator __tmp(*this); this->_M_incr(); return __tmp; } }; template<typename _Value, bool __cache> struct _Hashtable_iterator_base { _Hashtable_iterator_base(_Hash_node<_Value, __cache>* __node, _Hash_node<_Value, __cache>** __bucket) : _M_cur_node(__node), _M_cur_bucket(__bucket) { } void _M_incr() { _M_cur_node = _M_cur_node->_M_next; if (!_M_cur_node) _M_incr_bucket(); } void _M_incr_bucket(); _Hash_node<_Value, __cache>* _M_cur_node; _Hash_node<_Value, __cache>** _M_cur_bucket; }; // Global iterators, used for arbitrary iteration within a hash // table. Larger and more expensive than local iterators. template<typename _Value, bool __cache> void _Hashtable_iterator_base<_Value, __cache>:: _M_incr_bucket() { ++_M_cur_bucket; // This loop requires the bucket array to have a non-null sentinel. while (!*_M_cur_bucket) ++_M_cur_bucket; _M_cur_node = *_M_cur_bucket; } template<typename _Value, bool __cache> inline bool operator==(const _Hashtable_iterator_base<_Value, __cache>& __x, const _Hashtable_iterator_base<_Value, __cache>& __y) { return __x._M_cur_node == __y._M_cur_node; } template<typename _Value, bool __cache> inline bool operator!=(const _Hashtable_iterator_base<_Value, __cache>& __x, const _Hashtable_iterator_base<_Value, __cache>& __y) { return __x._M_cur_node != __y._M_cur_node; } template<typename _Value, bool __constant_iterators, bool __cache> struct _Hashtable_iterator : public _Hashtable_iterator_base<_Value, __cache> { typedef _Value value_type; typedef typename __gnu_cxx::__conditional_type<__constant_iterators, const _Value*, _Value*>::__type pointer; typedef typename __gnu_cxx::__conditional_type<__constant_iterators, const _Value&, _Value&>::__type reference; typedef std::ptrdiff_t difference_type; typedef std::forward_iterator_tag iterator_category; _Hashtable_iterator() : _Hashtable_iterator_base<_Value, __cache>(0, 0) { } _Hashtable_iterator(_Hash_node<_Value, __cache>* __p, _Hash_node<_Value, __cache>** __b) : _Hashtable_iterator_base<_Value, __cache>(__p, __b) { } explicit _Hashtable_iterator(_Hash_node<_Value, __cache>** __b) : _Hashtable_iterator_base<_Value, __cache>(*__b, __b) { } reference operator*() const { return this->_M_cur_node->_M_v; } pointer operator->() const { return std::__addressof(this->_M_cur_node->_M_v); } _Hashtable_iterator& operator++() { this->_M_incr(); return *this; } _Hashtable_iterator operator++(int) { _Hashtable_iterator __tmp(*this); this->_M_incr(); return __tmp; } }; template<typename _Value, bool __constant_iterators, bool __cache> struct _Hashtable_const_iterator : public _Hashtable_iterator_base<_Value, __cache> { typedef _Value value_type; typedef const _Value* pointer; typedef const _Value& reference; typedef std::ptrdiff_t difference_type; typedef std::forward_iterator_tag iterator_category; _Hashtable_const_iterator() : _Hashtable_iterator_base<_Value, __cache>(0, 0) { } _Hashtable_const_iterator(_Hash_node<_Value, __cache>* __p, _Hash_node<_Value, __cache>** __b) : _Hashtable_iterator_base<_Value, __cache>(__p, __b) { } explicit _Hashtable_const_iterator(_Hash_node<_Value, __cache>** __b) : _Hashtable_iterator_base<_Value, __cache>(*__b, __b) { } _Hashtable_const_iterator(const _Hashtable_iterator<_Value, __constant_iterators, __cache>& __x) : _Hashtable_iterator_base<_Value, __cache>(__x._M_cur_node, __x._M_cur_bucket) { } reference operator*() const { return this->_M_cur_node->_M_v; } pointer operator->() const { return std::__addressof(this->_M_cur_node->_M_v); } _Hashtable_const_iterator& operator++() { this->_M_incr(); return *this; } _Hashtable_const_iterator operator++(int) { _Hashtable_const_iterator __tmp(*this); this->_M_incr(); return __tmp; } }; // Many of class template _Hashtable's template parameters are policy // classes. These are defaults for the policies. // Default range hashing function: use division to fold a large number // into the range [0, N). struct _Mod_range_hashing { typedef std::size_t first_argument_type; typedef std::size_t second_argument_type; typedef std::size_t result_type; result_type operator()(first_argument_type __num, second_argument_type __den) const { return __num % __den; } }; // Default ranged hash function H. In principle it should be a // function object composed from objects of type H1 and H2 such that // h(k, N) = h2(h1(k), N), but that would mean making extra copies of // h1 and h2. So instead we'll just use a tag to tell class template // hashtable to do that composition. struct _Default_ranged_hash { }; // Default value for rehash policy. Bucket size is (usually) the // smallest prime that keeps the load factor small enough. struct _Prime_rehash_policy { _Prime_rehash_policy(float __z = 1.0) : _M_max_load_factor(__z), _M_growth_factor(2.f), _M_next_resize(0) { } float max_load_factor() const { return _M_max_load_factor; } // Return a bucket size no smaller than n. std::size_t _M_next_bkt(std::size_t __n) const; // Return a bucket count appropriate for n elements std::size_t _M_bkt_for_elements(std::size_t __n) const; // __n_bkt is current bucket count, __n_elt is current element count, // and __n_ins is number of elements to be inserted. Do we need to // increase bucket count? If so, return make_pair(true, n), where n // is the new bucket count. If not, return make_pair(false, 0). std::pair<bool, std::size_t> _M_need_rehash(std::size_t __n_bkt, std::size_t __n_elt, std::size_t __n_ins) const; enum { _S_n_primes = sizeof(unsigned long) != 8 ? 256 : 256 + 48 }; float _M_max_load_factor; float _M_growth_factor; mutable std::size_t _M_next_resize; }; extern const unsigned long __prime_list[]; // XXX This is a hack. There's no good reason for any of // _Prime_rehash_policy's member functions to be inline. // Return a prime no smaller than n. inline std::size_t _Prime_rehash_policy:: _M_next_bkt(std::size_t __n) const { const unsigned long* __p = std::lower_bound(__prime_list, __prime_list + _S_n_primes, __n); _M_next_resize = static_cast<std::size_t>(__builtin_ceil(*__p * _M_max_load_factor)); return *__p; } // Return the smallest prime p such that alpha p >= n, where alpha // is the load factor. inline std::size_t _Prime_rehash_policy:: _M_bkt_for_elements(std::size_t __n) const { const float __min_bkts = __n / _M_max_load_factor; const unsigned long* __p = std::lower_bound(__prime_list, __prime_list + _S_n_primes, __min_bkts); _M_next_resize = static_cast<std::size_t>(__builtin_ceil(*__p * _M_max_load_factor)); return *__p; } // Finds the smallest prime p such that alpha p > __n_elt + __n_ins. // If p > __n_bkt, return make_pair(true, p); otherwise return // make_pair(false, 0). In principle this isn't very different from // _M_bkt_for_elements. // The only tricky part is that we're caching the element count at // which we need to rehash, so we don't have to do a floating-point // multiply for every insertion. inline std::pair<bool, std::size_t> _Prime_rehash_policy:: _M_need_rehash(std::size_t __n_bkt, std::size_t __n_elt, std::size_t __n_ins) const { if (__n_elt + __n_ins > _M_next_resize) { float __min_bkts = ((float(__n_ins) + float(__n_elt)) / _M_max_load_factor); if (__min_bkts > __n_bkt) { __min_bkts = std::max(__min_bkts, _M_growth_factor * __n_bkt); const unsigned long* __p = std::lower_bound(__prime_list, __prime_list + _S_n_primes, __min_bkts); _M_next_resize = static_cast<std::size_t> (__builtin_ceil(*__p * _M_max_load_factor)); return std::make_pair(true, *__p); } else { _M_next_resize = static_cast<std::size_t> (__builtin_ceil(__n_bkt * _M_max_load_factor)); return std::make_pair(false, 0); } } else return std::make_pair(false, 0); } // Base classes for std::tr1::_Hashtable. We define these base // classes because in some cases we want to do different things // depending on the value of a policy class. In some cases the // policy class affects which member functions and nested typedefs // are defined; we handle that by specializing base class templates. // Several of the base class templates need to access other members // of class template _Hashtable, so we use the "curiously recurring // template pattern" for them. // class template _Map_base. If the hashtable has a value type of the // form pair<T1, T2> and a key extraction policy that returns the // first part of the pair, the hashtable gets a mapped_type typedef. // If it satisfies those criteria and also has unique keys, then it // also gets an operator[]. template<typename _Key, typename _Value, typename _Ex, bool __unique, typename _Hashtable> struct _Map_base { }; template<typename _Key, typename _Pair, typename _Hashtable> struct _Map_base<_Key, _Pair, std::_Select1st<_Pair>, false, _Hashtable> { typedef typename _Pair::second_type mapped_type; }; template<typename _Key, typename _Pair, typename _Hashtable> struct _Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable> { typedef typename _Pair::second_type mapped_type; mapped_type& operator[](const _Key& __k); }; template<typename _Key, typename _Pair, typename _Hashtable> typename _Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>::mapped_type& _Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>:: operator[](const _Key& __k) { _Hashtable* __h = static_cast<_Hashtable*>(this); typename _Hashtable::_Hash_code_type __code = __h->_M_hash_code(__k); std::size_t __n = __h->_M_bucket_index(__k, __code, __h->_M_bucket_count); typename _Hashtable::_Node* __p = __h->_M_find_node(__h->_M_buckets[__n], __k, __code); if (!__p) return __h->_M_insert_bucket(std::make_pair(__k, mapped_type()), __n, __code)->second; return (__p->_M_v).second; } // class template _Rehash_base. Give hashtable the max_load_factor // functions iff the rehash policy is _Prime_rehash_policy. template<typename _RehashPolicy, typename _Hashtable> struct _Rehash_base { }; template<typename _Hashtable> struct _Rehash_base<_Prime_rehash_policy, _Hashtable> { float max_load_factor() const { const _Hashtable* __this = static_cast<const _Hashtable*>(this); return __this->__rehash_policy().max_load_factor(); } void max_load_factor(float __z) { _Hashtable* __this = static_cast<_Hashtable*>(this); __this->__rehash_policy(_Prime_rehash_policy(__z)); } }; // Class template _Hash_code_base. Encapsulates two policy issues that // aren't quite orthogonal. // (1) the difference between using a ranged hash function and using // the combination of a hash function and a range-hashing function. // In the former case we don't have such things as hash codes, so // we have a dummy type as placeholder. // (2) Whether or not we cache hash codes. Caching hash codes is // meaningless if we have a ranged hash function. // We also put the key extraction and equality comparison function // objects here, for convenience. // Primary template: unused except as a hook for specializations. template<typename _Key, typename _Value, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, bool __cache_hash_code> struct _Hash_code_base; // Specialization: ranged hash function, no caching hash codes. H1 // and H2 are provided but ignored. We define a dummy hash code type. template<typename _Key, typename _Value, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash> struct _Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, false> { protected: _Hash_code_base(const _ExtractKey& __ex, const _Equal& __eq, const _H1&, const _H2&, const _Hash& __h) : _M_extract(__ex), _M_eq(__eq), _M_ranged_hash(__h) { } typedef void* _Hash_code_type; _Hash_code_type _M_hash_code(const _Key& __key) const { return 0; } std::size_t _M_bucket_index(const _Key& __k, _Hash_code_type, std::size_t __n) const { return _M_ranged_hash(__k, __n); } std::size_t _M_bucket_index(const _Hash_node<_Value, false>* __p, std::size_t __n) const { return _M_ranged_hash(_M_extract(__p->_M_v), __n); } bool _M_compare(const _Key& __k, _Hash_code_type, _Hash_node<_Value, false>* __n) const { return _M_eq(__k, _M_extract(__n->_M_v)); } void _M_store_code(_Hash_node<_Value, false>*, _Hash_code_type) const { } void _M_copy_code(_Hash_node<_Value, false>*, const _Hash_node<_Value, false>*) const { } void _M_swap(_Hash_code_base& __x) { std::swap(_M_extract, __x._M_extract); std::swap(_M_eq, __x._M_eq); std::swap(_M_ranged_hash, __x._M_ranged_hash); } protected: _ExtractKey _M_extract; _Equal _M_eq; _Hash _M_ranged_hash; }; // No specialization for ranged hash function while caching hash codes. // That combination is meaningless, and trying to do it is an error. // Specialization: ranged hash function, cache hash codes. This // combination is meaningless, so we provide only a declaration // and no definition. template<typename _Key, typename _Value, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash> struct _Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, true>; // Specialization: hash function and range-hashing function, no // caching of hash codes. H is provided but ignored. Provides // typedef and accessor required by TR1. template<typename _Key, typename _Value, typename _ExtractKey, typename _Equal, typename _H1, typename _H2> struct _Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Default_ranged_hash, false> { typedef _H1 hasher; hasher hash_function() const { return _M_h1; } protected: _Hash_code_base(const _ExtractKey& __ex, const _Equal& __eq, const _H1& __h1, const _H2& __h2, const _Default_ranged_hash&) : _M_extract(__ex), _M_eq(__eq), _M_h1(__h1), _M_h2(__h2) { } typedef std::size_t _Hash_code_type; _Hash_code_type _M_hash_code(const _Key& __k) const { return _M_h1(__k); } std::size_t _M_bucket_index(const _Key&, _Hash_code_type __c, std::size_t __n) const { return _M_h2(__c, __n); } std::size_t _M_bucket_index(const _Hash_node<_Value, false>* __p, std::size_t __n) const { return _M_h2(_M_h1(_M_extract(__p->_M_v)), __n); } bool _M_compare(const _Key& __k, _Hash_code_type, _Hash_node<_Value, false>* __n) const { return _M_eq(__k, _M_extract(__n->_M_v)); } void _M_store_code(_Hash_node<_Value, false>*, _Hash_code_type) const { } void _M_copy_code(_Hash_node<_Value, false>*, const _Hash_node<_Value, false>*) const { } void _M_swap(_Hash_code_base& __x) { std::swap(_M_extract, __x._M_extract); std::swap(_M_eq, __x._M_eq); std::swap(_M_h1, __x._M_h1); std::swap(_M_h2, __x._M_h2); } protected: _ExtractKey _M_extract; _Equal _M_eq; _H1 _M_h1; _H2 _M_h2; }; // Specialization: hash function and range-hashing function, // caching hash codes. H is provided but ignored. Provides // typedef and accessor required by TR1. template<typename _Key, typename _Value, typename _ExtractKey, typename _Equal, typename _H1, typename _H2> struct _Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Default_ranged_hash, true> { typedef _H1 hasher; hasher hash_function() const { return _M_h1; } protected: _Hash_code_base(const _ExtractKey& __ex, const _Equal& __eq, const _H1& __h1, const _H2& __h2, const _Default_ranged_hash&) : _M_extract(__ex), _M_eq(__eq), _M_h1(__h1), _M_h2(__h2) { } typedef std::size_t _Hash_code_type; _Hash_code_type _M_hash_code(const _Key& __k) const { return _M_h1(__k); } std::size_t _M_bucket_index(const _Key&, _Hash_code_type __c, std::size_t __n) const { return _M_h2(__c, __n); } std::size_t _M_bucket_index(const _Hash_node<_Value, true>* __p, std::size_t __n) const { return _M_h2(__p->_M_hash_code, __n); } bool _M_compare(const _Key& __k, _Hash_code_type __c, _Hash_node<_Value, true>* __n) const { return __c == __n->_M_hash_code && _M_eq(__k, _M_extract(__n->_M_v)); } void _M_store_code(_Hash_node<_Value, true>* __n, _Hash_code_type __c) const { __n->_M_hash_code = __c; } void _M_copy_code(_Hash_node<_Value, true>* __to, const _Hash_node<_Value, true>* __from) const { __to->_M_hash_code = __from->_M_hash_code; } void _M_swap(_Hash_code_base& __x) { std::swap(_M_extract, __x._M_extract); std::swap(_M_eq, __x._M_eq); std::swap(_M_h1, __x._M_h1); std::swap(_M_h2, __x._M_h2); } protected: _ExtractKey _M_extract; _Equal _M_eq; _H1 _M_h1; _H2 _M_h2; }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace __detail } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/special_function_util.h���������������������������������������������������������������0000644�����������������00000011323�14763166027�0013042 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Special functions -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/special_function_util.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{tr1/cmath} */ // // ISO C++ 14882 TR1: 5.2 Special functions // // Written by Edward Smith-Rowland based on numerous mathematics books. #ifndef _GLIBCXX_TR1_SPECIAL_FUNCTION_UTIL_H #define _GLIBCXX_TR1_SPECIAL_FUNCTION_UTIL_H 1 namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION /// A class to encapsulate type dependent floating point /// constants. Not everything will be able to be expressed as /// type logic. template<typename _Tp> struct __floating_point_constant { static const _Tp __value; }; /// A structure for numeric constants. template<typename _Tp> struct __numeric_constants { /// Constant @f$ \pi @f$. static _Tp __pi() throw() { return static_cast<_Tp>(3.1415926535897932384626433832795029L); } /// Constant @f$ \pi / 2 @f$. static _Tp __pi_2() throw() { return static_cast<_Tp>(1.5707963267948966192313216916397514L); } /// Constant @f$ \pi / 3 @f$. static _Tp __pi_3() throw() { return static_cast<_Tp>(1.0471975511965977461542144610931676L); } /// Constant @f$ \pi / 4 @f$. static _Tp __pi_4() throw() { return static_cast<_Tp>(0.7853981633974483096156608458198757L); } /// Constant @f$ 1 / \pi @f$. static _Tp __1_pi() throw() { return static_cast<_Tp>(0.3183098861837906715377675267450287L); } /// Constant @f$ 2 / \sqrt(\pi) @f$. static _Tp __2_sqrtpi() throw() { return static_cast<_Tp>(1.1283791670955125738961589031215452L); } /// Constant @f$ \sqrt(2) @f$. static _Tp __sqrt2() throw() { return static_cast<_Tp>(1.4142135623730950488016887242096981L); } /// Constant @f$ \sqrt(3) @f$. static _Tp __sqrt3() throw() { return static_cast<_Tp>(1.7320508075688772935274463415058723L); } /// Constant @f$ \sqrt(\pi/2) @f$. static _Tp __sqrtpio2() throw() { return static_cast<_Tp>(1.2533141373155002512078826424055226L); } /// Constant @f$ 1 / sqrt(2) @f$. static _Tp __sqrt1_2() throw() { return static_cast<_Tp>(0.7071067811865475244008443621048490L); } /// Constant @f$ \log(\pi) @f$. static _Tp __lnpi() throw() { return static_cast<_Tp>(1.1447298858494001741434273513530587L); } /// Constant Euler's constant @f$ \gamma_E @f$. static _Tp __gamma_e() throw() { return static_cast<_Tp>(0.5772156649015328606065120900824024L); } /// Constant Euler-Mascheroni @f$ e @f$ static _Tp __euler() throw() { return static_cast<_Tp>(2.7182818284590452353602874713526625L); } }; #if _GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC /// This is a wrapper for the isnan function. Otherwise, for NaN, /// all comparisons result in false. If/when we build a std::isnan /// out of intrinsics, this will disappear completely in favor of /// std::isnan. template<typename _Tp> inline bool __isnan(_Tp __x) { return std::isnan(__x); } #else template<typename _Tp> inline bool __isnan(const _Tp __x) { return __builtin_isnan(__x); } template<> inline bool __isnan<float>(float __x) { return __builtin_isnanf(__x); } template<> inline bool __isnan<long double>(long double __x) { return __builtin_isnanl(__x); } #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace __detail } } #endif // _GLIBCXX_TR1_SPECIAL_FUNCTION_UTIL_H �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/stdio.h�������������������������������������������������������������������������������0000644�����������������00000002271�14763166027�0007604 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 stdio.h -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/stdio.h * This is a TR1 C++ Library header. */ #ifndef _TR1_STDIO_H #define _TR1_STDIO_H 1 #include <tr1/cstdio> #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/functional����������������������������������������������������������������������������0000644�����������������00000212236�14763166027�0010402 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 functional header -*- C++ -*- // Copyright (C) 2004-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/functional * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_FUNCTIONAL #define _GLIBCXX_TR1_FUNCTIONAL 1 #pragma GCC system_header #include <bits/c++config.h> #include <bits/stl_function.h> #include <typeinfo> #include <new> #include <tr1/tuple> #include <tr1/type_traits> #include <bits/stringfwd.h> #include <tr1/functional_hash.h> #include <ext/type_traits.h> #include <bits/move.h> // for std::__addressof #if __cplusplus >= 201103L # include <type_traits> // for integral_constant, true_type, false_type #endif namespace std _GLIBCXX_VISIBILITY(default) { #if __cplusplus >= 201103L _GLIBCXX_BEGIN_NAMESPACE_VERSION template<int> struct _Placeholder; template<typename> class _Bind; template<typename, typename> class _Bind_result; _GLIBCXX_END_NAMESPACE_VERSION #endif namespace tr1 { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _MemberPointer> class _Mem_fn; template<typename _Tp, typename _Class> _Mem_fn<_Tp _Class::*> mem_fn(_Tp _Class::*); /** * Actual implementation of _Has_result_type, which uses SFINAE to * determine if the type _Tp has a publicly-accessible member type * result_type. */ template<typename _Tp> class _Has_result_type_helper : __sfinae_types { template<typename _Up> struct _Wrap_type { }; template<typename _Up> static __one __test(_Wrap_type<typename _Up::result_type>*); template<typename _Up> static __two __test(...); public: static const bool value = sizeof(__test<_Tp>(0)) == 1; }; template<typename _Tp> struct _Has_result_type : integral_constant<bool, _Has_result_type_helper<typename remove_cv<_Tp>::type>::value> { }; /** * */ /// If we have found a result_type, extract it. template<bool _Has_result_type, typename _Functor> struct _Maybe_get_result_type { }; template<typename _Functor> struct _Maybe_get_result_type<true, _Functor> { typedef typename _Functor::result_type result_type; }; /** * Base class for any function object that has a weak result type, as * defined in 3.3/3 of TR1. */ template<typename _Functor> struct _Weak_result_type_impl : _Maybe_get_result_type<_Has_result_type<_Functor>::value, _Functor> { }; /// Retrieve the result type for a function type. template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(_ArgTypes...)> { typedef _Res result_type; }; /// Retrieve the result type for a function reference. template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(&)(_ArgTypes...)> { typedef _Res result_type; }; /// Retrieve the result type for a function pointer. template<typename _Res, typename... _ArgTypes> struct _Weak_result_type_impl<_Res(*)(_ArgTypes...)> { typedef _Res result_type; }; /// Retrieve result type for a member function pointer. template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...)> { typedef _Res result_type; }; /// Retrieve result type for a const member function pointer. template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) const> { typedef _Res result_type; }; /// Retrieve result type for a volatile member function pointer. template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) volatile> { typedef _Res result_type; }; /// Retrieve result type for a const volatile member function pointer. template<typename _Res, typename _Class, typename... _ArgTypes> struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...)const volatile> { typedef _Res result_type; }; /** * Strip top-level cv-qualifiers from the function object and let * _Weak_result_type_impl perform the real work. */ template<typename _Functor> struct _Weak_result_type : _Weak_result_type_impl<typename remove_cv<_Functor>::type> { }; template<typename _Signature> class result_of; /** * Actual implementation of result_of. When _Has_result_type is * true, gets its result from _Weak_result_type. Otherwise, uses * the function object's member template result to extract the * result type. */ template<bool _Has_result_type, typename _Signature> struct _Result_of_impl; // Handle member data pointers using _Mem_fn's logic template<typename _Res, typename _Class, typename _T1> struct _Result_of_impl<false, _Res _Class::*(_T1)> { typedef typename _Mem_fn<_Res _Class::*> ::template _Result_type<_T1>::type type; }; /** * Determine whether we can determine a result type from @c Functor * alone. */ template<typename _Functor, typename... _ArgTypes> class result_of<_Functor(_ArgTypes...)> : public _Result_of_impl< _Has_result_type<_Weak_result_type<_Functor> >::value, _Functor(_ArgTypes...)> { }; /// We already know the result type for @c Functor; use it. template<typename _Functor, typename... _ArgTypes> struct _Result_of_impl<true, _Functor(_ArgTypes...)> { typedef typename _Weak_result_type<_Functor>::result_type type; }; /** * We need to compute the result type for this invocation the hard * way. */ template<typename _Functor, typename... _ArgTypes> struct _Result_of_impl<false, _Functor(_ArgTypes...)> { typedef typename _Functor ::template result<_Functor(_ArgTypes...)>::type type; }; /** * It is unsafe to access ::result when there are zero arguments, so we * return @c void instead. */ template<typename _Functor> struct _Result_of_impl<false, _Functor()> { typedef void type; }; /// Determines if the type _Tp derives from unary_function. template<typename _Tp> struct _Derives_from_unary_function : __sfinae_types { private: template<typename _T1, typename _Res> static __one __test(const volatile unary_function<_T1, _Res>*); // It's tempting to change "..." to const volatile void*, but // that fails when _Tp is a function type. static __two __test(...); public: static const bool value = sizeof(__test((_Tp*)0)) == 1; }; /// Determines if the type _Tp derives from binary_function. template<typename _Tp> struct _Derives_from_binary_function : __sfinae_types { private: template<typename _T1, typename _T2, typename _Res> static __one __test(const volatile binary_function<_T1, _T2, _Res>*); // It's tempting to change "..." to const volatile void*, but // that fails when _Tp is a function type. static __two __test(...); public: static const bool value = sizeof(__test((_Tp*)0)) == 1; }; /// Turns a function type into a function pointer type template<typename _Tp, bool _IsFunctionType = is_function<_Tp>::value> struct _Function_to_function_pointer { typedef _Tp type; }; template<typename _Tp> struct _Function_to_function_pointer<_Tp, true> { typedef _Tp* type; }; /** * Invoke a function object, which may be either a member pointer or a * function object. The first parameter will tell which. */ template<typename _Functor, typename... _Args> inline typename __gnu_cxx::__enable_if< (!is_member_pointer<_Functor>::value && !is_function<_Functor>::value && !is_function<typename remove_pointer<_Functor>::type>::value), typename result_of<_Functor(_Args...)>::type >::__type __invoke(_Functor& __f, _Args&... __args) { return __f(__args...); } template<typename _Functor, typename... _Args> inline typename __gnu_cxx::__enable_if< (is_member_pointer<_Functor>::value && !is_function<_Functor>::value && !is_function<typename remove_pointer<_Functor>::type>::value), typename result_of<_Functor(_Args...)>::type >::__type __invoke(_Functor& __f, _Args&... __args) { return mem_fn(__f)(__args...); } // To pick up function references (that will become function pointers) template<typename _Functor, typename... _Args> inline typename __gnu_cxx::__enable_if< (is_pointer<_Functor>::value && is_function<typename remove_pointer<_Functor>::type>::value), typename result_of<_Functor(_Args...)>::type >::__type __invoke(_Functor __f, _Args&... __args) { return __f(__args...); } /** * Knowing which of unary_function and binary_function _Tp derives * from, derives from the same and ensures that reference_wrapper * will have a weak result type. See cases below. */ template<bool _Unary, bool _Binary, typename _Tp> struct _Reference_wrapper_base_impl; // Not a unary_function or binary_function, so try a weak result type. template<typename _Tp> struct _Reference_wrapper_base_impl<false, false, _Tp> : _Weak_result_type<_Tp> { }; // unary_function but not binary_function template<typename _Tp> struct _Reference_wrapper_base_impl<true, false, _Tp> : unary_function<typename _Tp::argument_type, typename _Tp::result_type> { }; // binary_function but not unary_function template<typename _Tp> struct _Reference_wrapper_base_impl<false, true, _Tp> : binary_function<typename _Tp::first_argument_type, typename _Tp::second_argument_type, typename _Tp::result_type> { }; // Both unary_function and binary_function. Import result_type to // avoid conflicts. template<typename _Tp> struct _Reference_wrapper_base_impl<true, true, _Tp> : unary_function<typename _Tp::argument_type, typename _Tp::result_type>, binary_function<typename _Tp::first_argument_type, typename _Tp::second_argument_type, typename _Tp::result_type> { typedef typename _Tp::result_type result_type; }; /** * Derives from unary_function or binary_function when it * can. Specializations handle all of the easy cases. The primary * template determines what to do with a class type, which may * derive from both unary_function and binary_function. */ template<typename _Tp> struct _Reference_wrapper_base : _Reference_wrapper_base_impl< _Derives_from_unary_function<_Tp>::value, _Derives_from_binary_function<_Tp>::value, _Tp> { }; // - a function type (unary) template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res(_T1)> : unary_function<_T1, _Res> { }; // - a function type (binary) template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res(_T1, _T2)> : binary_function<_T1, _T2, _Res> { }; // - a function pointer type (unary) template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res(*)(_T1)> : unary_function<_T1, _Res> { }; // - a function pointer type (binary) template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res(*)(_T1, _T2)> : binary_function<_T1, _T2, _Res> { }; // - a pointer to member function type (unary, no qualifiers) template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res (_T1::*)()> : unary_function<_T1*, _Res> { }; // - a pointer to member function type (binary, no qualifiers) template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res (_T1::*)(_T2)> : binary_function<_T1*, _T2, _Res> { }; // - a pointer to member function type (unary, const) template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res (_T1::*)() const> : unary_function<const _T1*, _Res> { }; // - a pointer to member function type (binary, const) template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const> : binary_function<const _T1*, _T2, _Res> { }; // - a pointer to member function type (unary, volatile) template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res (_T1::*)() volatile> : unary_function<volatile _T1*, _Res> { }; // - a pointer to member function type (binary, volatile) template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res (_T1::*)(_T2) volatile> : binary_function<volatile _T1*, _T2, _Res> { }; // - a pointer to member function type (unary, const volatile) template<typename _Res, typename _T1> struct _Reference_wrapper_base<_Res (_T1::*)() const volatile> : unary_function<const volatile _T1*, _Res> { }; // - a pointer to member function type (binary, const volatile) template<typename _Res, typename _T1, typename _T2> struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const volatile> : binary_function<const volatile _T1*, _T2, _Res> { }; /// reference_wrapper template<typename _Tp> class reference_wrapper : public _Reference_wrapper_base<typename remove_cv<_Tp>::type> { // If _Tp is a function type, we can't form result_of<_Tp(...)>, // so turn it into a function pointer type. typedef typename _Function_to_function_pointer<_Tp>::type _M_func_type; _Tp* _M_data; public: typedef _Tp type; explicit reference_wrapper(_Tp& __indata) : _M_data(std::__addressof(__indata)) { } reference_wrapper(const reference_wrapper<_Tp>& __inref): _M_data(__inref._M_data) { } reference_wrapper& operator=(const reference_wrapper<_Tp>& __inref) { _M_data = __inref._M_data; return *this; } operator _Tp&() const { return this->get(); } _Tp& get() const { return *_M_data; } template<typename... _Args> typename result_of<_M_func_type(_Args...)>::type operator()(_Args&... __args) const { return __invoke(get(), __args...); } }; // Denotes a reference should be taken to a variable. template<typename _Tp> inline reference_wrapper<_Tp> ref(_Tp& __t) { return reference_wrapper<_Tp>(__t); } // Denotes a const reference should be taken to a variable. template<typename _Tp> inline reference_wrapper<const _Tp> cref(const _Tp& __t) { return reference_wrapper<const _Tp>(__t); } template<typename _Tp> inline reference_wrapper<_Tp> ref(reference_wrapper<_Tp> __t) { return ref(__t.get()); } template<typename _Tp> inline reference_wrapper<const _Tp> cref(reference_wrapper<_Tp> __t) { return cref(__t.get()); } template<typename _Tp, bool> struct _Mem_fn_const_or_non { typedef const _Tp& type; }; template<typename _Tp> struct _Mem_fn_const_or_non<_Tp, false> { typedef _Tp& type; }; /** * Derives from @c unary_function or @c binary_function, or perhaps * nothing, depending on the number of arguments provided. The * primary template is the basis case, which derives nothing. */ template<typename _Res, typename... _ArgTypes> struct _Maybe_unary_or_binary_function { }; /// Derives from @c unary_function, as appropriate. template<typename _Res, typename _T1> struct _Maybe_unary_or_binary_function<_Res, _T1> : std::unary_function<_T1, _Res> { }; /// Derives from @c binary_function, as appropriate. template<typename _Res, typename _T1, typename _T2> struct _Maybe_unary_or_binary_function<_Res, _T1, _T2> : std::binary_function<_T1, _T2, _Res> { }; /// Implementation of @c mem_fn for member function pointers. template<typename _Res, typename _Class, typename... _ArgTypes> class _Mem_fn<_Res (_Class::*)(_ArgTypes...)> : public _Maybe_unary_or_binary_function<_Res, _Class*, _ArgTypes...> { typedef _Res (_Class::*_Functor)(_ArgTypes...); template<typename _Tp> _Res _M_call(_Tp& __object, const volatile _Class *, _ArgTypes... __args) const { return (__object.*__pmf)(__args...); } template<typename _Tp> _Res _M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const { return ((*__ptr).*__pmf)(__args...); } public: typedef _Res result_type; explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { } // Handle objects _Res operator()(_Class& __object, _ArgTypes... __args) const { return (__object.*__pmf)(__args...); } // Handle pointers _Res operator()(_Class* __object, _ArgTypes... __args) const { return (__object->*__pmf)(__args...); } // Handle smart pointers, references and pointers to derived template<typename _Tp> _Res operator()(_Tp& __object, _ArgTypes... __args) const { return _M_call(__object, &__object, __args...); } private: _Functor __pmf; }; /// Implementation of @c mem_fn for const member function pointers. template<typename _Res, typename _Class, typename... _ArgTypes> class _Mem_fn<_Res (_Class::*)(_ArgTypes...) const> : public _Maybe_unary_or_binary_function<_Res, const _Class*, _ArgTypes...> { typedef _Res (_Class::*_Functor)(_ArgTypes...) const; template<typename _Tp> _Res _M_call(_Tp& __object, const volatile _Class *, _ArgTypes... __args) const { return (__object.*__pmf)(__args...); } template<typename _Tp> _Res _M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const { return ((*__ptr).*__pmf)(__args...); } public: typedef _Res result_type; explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { } // Handle objects _Res operator()(const _Class& __object, _ArgTypes... __args) const { return (__object.*__pmf)(__args...); } // Handle pointers _Res operator()(const _Class* __object, _ArgTypes... __args) const { return (__object->*__pmf)(__args...); } // Handle smart pointers, references and pointers to derived template<typename _Tp> _Res operator()(_Tp& __object, _ArgTypes... __args) const { return _M_call(__object, &__object, __args...); } private: _Functor __pmf; }; /// Implementation of @c mem_fn for volatile member function pointers. template<typename _Res, typename _Class, typename... _ArgTypes> class _Mem_fn<_Res (_Class::*)(_ArgTypes...) volatile> : public _Maybe_unary_or_binary_function<_Res, volatile _Class*, _ArgTypes...> { typedef _Res (_Class::*_Functor)(_ArgTypes...) volatile; template<typename _Tp> _Res _M_call(_Tp& __object, const volatile _Class *, _ArgTypes... __args) const { return (__object.*__pmf)(__args...); } template<typename _Tp> _Res _M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const { return ((*__ptr).*__pmf)(__args...); } public: typedef _Res result_type; explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { } // Handle objects _Res operator()(volatile _Class& __object, _ArgTypes... __args) const { return (__object.*__pmf)(__args...); } // Handle pointers _Res operator()(volatile _Class* __object, _ArgTypes... __args) const { return (__object->*__pmf)(__args...); } // Handle smart pointers, references and pointers to derived template<typename _Tp> _Res operator()(_Tp& __object, _ArgTypes... __args) const { return _M_call(__object, &__object, __args...); } private: _Functor __pmf; }; /// Implementation of @c mem_fn for const volatile member function pointers. template<typename _Res, typename _Class, typename... _ArgTypes> class _Mem_fn<_Res (_Class::*)(_ArgTypes...) const volatile> : public _Maybe_unary_or_binary_function<_Res, const volatile _Class*, _ArgTypes...> { typedef _Res (_Class::*_Functor)(_ArgTypes...) const volatile; template<typename _Tp> _Res _M_call(_Tp& __object, const volatile _Class *, _ArgTypes... __args) const { return (__object.*__pmf)(__args...); } template<typename _Tp> _Res _M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const { return ((*__ptr).*__pmf)(__args...); } public: typedef _Res result_type; explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { } // Handle objects _Res operator()(const volatile _Class& __object, _ArgTypes... __args) const { return (__object.*__pmf)(__args...); } // Handle pointers _Res operator()(const volatile _Class* __object, _ArgTypes... __args) const { return (__object->*__pmf)(__args...); } // Handle smart pointers, references and pointers to derived template<typename _Tp> _Res operator()(_Tp& __object, _ArgTypes... __args) const { return _M_call(__object, &__object, __args...); } private: _Functor __pmf; }; template<typename _Res, typename _Class> class _Mem_fn<_Res _Class::*> { // This bit of genius is due to Peter Dimov, improved slightly by // Douglas Gregor. template<typename _Tp> _Res& _M_call(_Tp& __object, _Class *) const { return __object.*__pm; } template<typename _Tp, typename _Up> _Res& _M_call(_Tp& __object, _Up * const *) const { return (*__object).*__pm; } template<typename _Tp, typename _Up> const _Res& _M_call(_Tp& __object, const _Up * const *) const { return (*__object).*__pm; } template<typename _Tp> const _Res& _M_call(_Tp& __object, const _Class *) const { return __object.*__pm; } template<typename _Tp> const _Res& _M_call(_Tp& __ptr, const volatile void*) const { return (*__ptr).*__pm; } template<typename _Tp> static _Tp& __get_ref(); template<typename _Tp> static __sfinae_types::__one __check_const(_Tp&, _Class*); template<typename _Tp, typename _Up> static __sfinae_types::__one __check_const(_Tp&, _Up * const *); template<typename _Tp, typename _Up> static __sfinae_types::__two __check_const(_Tp&, const _Up * const *); template<typename _Tp> static __sfinae_types::__two __check_const(_Tp&, const _Class*); template<typename _Tp> static __sfinae_types::__two __check_const(_Tp&, const volatile void*); public: template<typename _Tp> struct _Result_type : _Mem_fn_const_or_non<_Res, (sizeof(__sfinae_types::__two) == sizeof(__check_const<_Tp>(__get_ref<_Tp>(), (_Tp*)0)))> { }; template<typename _Signature> struct result; template<typename _CVMem, typename _Tp> struct result<_CVMem(_Tp)> : public _Result_type<_Tp> { }; template<typename _CVMem, typename _Tp> struct result<_CVMem(_Tp&)> : public _Result_type<_Tp> { }; explicit _Mem_fn(_Res _Class::*__pm) : __pm(__pm) { } // Handle objects _Res& operator()(_Class& __object) const { return __object.*__pm; } const _Res& operator()(const _Class& __object) const { return __object.*__pm; } // Handle pointers _Res& operator()(_Class* __object) const { return __object->*__pm; } const _Res& operator()(const _Class* __object) const { return __object->*__pm; } // Handle smart pointers and derived template<typename _Tp> typename _Result_type<_Tp>::type operator()(_Tp& __unknown) const { return _M_call(__unknown, &__unknown); } private: _Res _Class::*__pm; }; /** * @brief Returns a function object that forwards to the member * pointer @a pm. */ template<typename _Tp, typename _Class> inline _Mem_fn<_Tp _Class::*> mem_fn(_Tp _Class::* __pm) { return _Mem_fn<_Tp _Class::*>(__pm); } /** * @brief Determines if the given type _Tp is a function object * should be treated as a subexpression when evaluating calls to * function objects returned by bind(). [TR1 3.6.1] */ template<typename _Tp> struct is_bind_expression { static const bool value = false; }; template<typename _Tp> const bool is_bind_expression<_Tp>::value; /** * @brief Determines if the given type _Tp is a placeholder in a * bind() expression and, if so, which placeholder it is. [TR1 3.6.2] */ template<typename _Tp> struct is_placeholder { static const int value = 0; }; template<typename _Tp> const int is_placeholder<_Tp>::value; /// The type of placeholder objects defined by libstdc++. template<int _Num> struct _Placeholder { }; _GLIBCXX_END_NAMESPACE_VERSION /** @namespace std::tr1::placeholders * @brief Sub-namespace for tr1/functional. */ namespace placeholders { _GLIBCXX_BEGIN_NAMESPACE_VERSION /* Define a large number of placeholders. There is no way to * simplify this with variadic templates, because we're introducing * unique names for each. */ namespace { _Placeholder<1> _1; _Placeholder<2> _2; _Placeholder<3> _3; _Placeholder<4> _4; _Placeholder<5> _5; _Placeholder<6> _6; _Placeholder<7> _7; _Placeholder<8> _8; _Placeholder<9> _9; _Placeholder<10> _10; _Placeholder<11> _11; _Placeholder<12> _12; _Placeholder<13> _13; _Placeholder<14> _14; _Placeholder<15> _15; _Placeholder<16> _16; _Placeholder<17> _17; _Placeholder<18> _18; _Placeholder<19> _19; _Placeholder<20> _20; _Placeholder<21> _21; _Placeholder<22> _22; _Placeholder<23> _23; _Placeholder<24> _24; _Placeholder<25> _25; _Placeholder<26> _26; _Placeholder<27> _27; _Placeholder<28> _28; _Placeholder<29> _29; } _GLIBCXX_END_NAMESPACE_VERSION } _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * Partial specialization of is_placeholder that provides the placeholder * number for the placeholder objects defined by libstdc++. */ template<int _Num> struct is_placeholder<_Placeholder<_Num> > { static const int value = _Num; }; template<int _Num> const int is_placeholder<_Placeholder<_Num> >::value; #if __cplusplus >= 201103L template<int _Num> struct is_placeholder<std::_Placeholder<_Num>> : std::integral_constant<int, _Num> { }; template<int _Num> struct is_placeholder<const std::_Placeholder<_Num>> : std::integral_constant<int, _Num> { }; #endif /** * Stores a tuple of indices. Used by bind() to extract the elements * in a tuple. */ template<int... _Indexes> struct _Index_tuple { }; /// Builds an _Index_tuple<0, 1, 2, ..., _Num-1>. template<std::size_t _Num, typename _Tuple = _Index_tuple<> > struct _Build_index_tuple; template<std::size_t _Num, int... _Indexes> struct _Build_index_tuple<_Num, _Index_tuple<_Indexes...> > : _Build_index_tuple<_Num - 1, _Index_tuple<_Indexes..., sizeof...(_Indexes)> > { }; template<int... _Indexes> struct _Build_index_tuple<0, _Index_tuple<_Indexes...> > { typedef _Index_tuple<_Indexes...> __type; }; /** * Used by _Safe_tuple_element to indicate that there is no tuple * element at this position. */ struct _No_tuple_element; /** * Implementation helper for _Safe_tuple_element. This primary * template handles the case where it is safe to use @c * tuple_element. */ template<int __i, typename _Tuple, bool _IsSafe> struct _Safe_tuple_element_impl : tuple_element<__i, _Tuple> { }; /** * Implementation helper for _Safe_tuple_element. This partial * specialization handles the case where it is not safe to use @c * tuple_element. We just return @c _No_tuple_element. */ template<int __i, typename _Tuple> struct _Safe_tuple_element_impl<__i, _Tuple, false> { typedef _No_tuple_element type; }; /** * Like tuple_element, but returns @c _No_tuple_element when * tuple_element would return an error. */ template<int __i, typename _Tuple> struct _Safe_tuple_element : _Safe_tuple_element_impl<__i, _Tuple, (__i >= 0 && __i < tuple_size<_Tuple>::value)> { }; /** * Maps an argument to bind() into an actual argument to the bound * function object [TR1 3.6.3/5]. Only the first parameter should * be specified: the rest are used to determine among the various * implementations. Note that, although this class is a function * object, it isn't entirely normal because it takes only two * parameters regardless of the number of parameters passed to the * bind expression. The first parameter is the bound argument and * the second parameter is a tuple containing references to the * rest of the arguments. */ template<typename _Arg, bool _IsBindExp = is_bind_expression<_Arg>::value, bool _IsPlaceholder = (is_placeholder<_Arg>::value > 0)> class _Mu; /** * If the argument is reference_wrapper<_Tp>, returns the * underlying reference. [TR1 3.6.3/5 bullet 1] */ template<typename _Tp> class _Mu<reference_wrapper<_Tp>, false, false> { public: typedef _Tp& result_type; /* Note: This won't actually work for const volatile * reference_wrappers, because reference_wrapper::get() is const * but not volatile-qualified. This might be a defect in the TR. */ template<typename _CVRef, typename _Tuple> result_type operator()(_CVRef& __arg, const _Tuple&) const volatile { return __arg.get(); } }; /** * If the argument is a bind expression, we invoke the underlying * function object with the same cv-qualifiers as we are given and * pass along all of our arguments (unwrapped). [TR1 3.6.3/5 bullet 2] */ template<typename _Arg> class _Mu<_Arg, true, false> { public: template<typename _Signature> class result; // Determine the result type when we pass the arguments along. This // involves passing along the cv-qualifiers placed on _Mu and // unwrapping the argument bundle. template<typename _CVMu, typename _CVArg, typename... _Args> class result<_CVMu(_CVArg, tuple<_Args...>)> : public result_of<_CVArg(_Args...)> { }; template<typename _CVArg, typename... _Args> typename result_of<_CVArg(_Args...)>::type operator()(_CVArg& __arg, const tuple<_Args...>& __tuple) const volatile { // Construct an index tuple and forward to __call typedef typename _Build_index_tuple<sizeof...(_Args)>::__type _Indexes; return this->__call(__arg, __tuple, _Indexes()); } private: // Invokes the underlying function object __arg by unpacking all // of the arguments in the tuple. template<typename _CVArg, typename... _Args, int... _Indexes> typename result_of<_CVArg(_Args...)>::type __call(_CVArg& __arg, const tuple<_Args...>& __tuple, const _Index_tuple<_Indexes...>&) const volatile { return __arg(tr1::get<_Indexes>(__tuple)...); } }; /** * If the argument is a placeholder for the Nth argument, returns * a reference to the Nth argument to the bind function object. * [TR1 3.6.3/5 bullet 3] */ template<typename _Arg> class _Mu<_Arg, false, true> { public: template<typename _Signature> class result; template<typename _CVMu, typename _CVArg, typename _Tuple> class result<_CVMu(_CVArg, _Tuple)> { // Add a reference, if it hasn't already been done for us. // This allows us to be a little bit sloppy in constructing // the tuple that we pass to result_of<...>. typedef typename _Safe_tuple_element<(is_placeholder<_Arg>::value - 1), _Tuple>::type __base_type; public: typedef typename add_reference<__base_type>::type type; }; template<typename _Tuple> typename result<_Mu(_Arg, _Tuple)>::type operator()(const volatile _Arg&, const _Tuple& __tuple) const volatile { return ::std::tr1::get<(is_placeholder<_Arg>::value - 1)>(__tuple); } }; /** * If the argument is just a value, returns a reference to that * value. The cv-qualifiers on the reference are the same as the * cv-qualifiers on the _Mu object. [TR1 3.6.3/5 bullet 4] */ template<typename _Arg> class _Mu<_Arg, false, false> { public: template<typename _Signature> struct result; template<typename _CVMu, typename _CVArg, typename _Tuple> struct result<_CVMu(_CVArg, _Tuple)> { typedef typename add_reference<_CVArg>::type type; }; // Pick up the cv-qualifiers of the argument template<typename _CVArg, typename _Tuple> _CVArg& operator()(_CVArg& __arg, const _Tuple&) const volatile { return __arg; } }; /** * Maps member pointers into instances of _Mem_fn but leaves all * other function objects untouched. Used by tr1::bind(). The * primary template handles the non--member-pointer case. */ template<typename _Tp> struct _Maybe_wrap_member_pointer { typedef _Tp type; static const _Tp& __do_wrap(const _Tp& __x) { return __x; } }; /** * Maps member pointers into instances of _Mem_fn but leaves all * other function objects untouched. Used by tr1::bind(). This * partial specialization handles the member pointer case. */ template<typename _Tp, typename _Class> struct _Maybe_wrap_member_pointer<_Tp _Class::*> { typedef _Mem_fn<_Tp _Class::*> type; static type __do_wrap(_Tp _Class::* __pm) { return type(__pm); } }; /// Type of the function object returned from bind(). template<typename _Signature> struct _Bind; template<typename _Functor, typename... _Bound_args> class _Bind<_Functor(_Bound_args...)> : public _Weak_result_type<_Functor> { typedef _Bind __self_type; typedef typename _Build_index_tuple<sizeof...(_Bound_args)>::__type _Bound_indexes; _Functor _M_f; tuple<_Bound_args...> _M_bound_args; // Call unqualified template<typename... _Args, int... _Indexes> typename result_of< _Functor(typename result_of<_Mu<_Bound_args> (_Bound_args, tuple<_Args...>)>::type...) >::type __call(const tuple<_Args...>& __args, _Index_tuple<_Indexes...>) { return _M_f(_Mu<_Bound_args>() (tr1::get<_Indexes>(_M_bound_args), __args)...); } // Call as const template<typename... _Args, int... _Indexes> typename result_of< const _Functor(typename result_of<_Mu<_Bound_args> (const _Bound_args, tuple<_Args...>) >::type...)>::type __call(const tuple<_Args...>& __args, _Index_tuple<_Indexes...>) const { return _M_f(_Mu<_Bound_args>() (tr1::get<_Indexes>(_M_bound_args), __args)...); } // Call as volatile template<typename... _Args, int... _Indexes> typename result_of< volatile _Functor(typename result_of<_Mu<_Bound_args> (volatile _Bound_args, tuple<_Args...>) >::type...)>::type __call(const tuple<_Args...>& __args, _Index_tuple<_Indexes...>) volatile { return _M_f(_Mu<_Bound_args>() (tr1::get<_Indexes>(_M_bound_args), __args)...); } // Call as const volatile template<typename... _Args, int... _Indexes> typename result_of< const volatile _Functor(typename result_of<_Mu<_Bound_args> (const volatile _Bound_args, tuple<_Args...>) >::type...)>::type __call(const tuple<_Args...>& __args, _Index_tuple<_Indexes...>) const volatile { return _M_f(_Mu<_Bound_args>() (tr1::get<_Indexes>(_M_bound_args), __args)...); } public: explicit _Bind(_Functor __f, _Bound_args... __bound_args) : _M_f(__f), _M_bound_args(__bound_args...) { } // Call unqualified template<typename... _Args> typename result_of< _Functor(typename result_of<_Mu<_Bound_args> (_Bound_args, tuple<_Args...>)>::type...) >::type operator()(_Args&... __args) { return this->__call(tr1::tie(__args...), _Bound_indexes()); } // Call as const template<typename... _Args> typename result_of< const _Functor(typename result_of<_Mu<_Bound_args> (const _Bound_args, tuple<_Args...>)>::type...) >::type operator()(_Args&... __args) const { return this->__call(tr1::tie(__args...), _Bound_indexes()); } // Call as volatile template<typename... _Args> typename result_of< volatile _Functor(typename result_of<_Mu<_Bound_args> (volatile _Bound_args, tuple<_Args...>)>::type...) >::type operator()(_Args&... __args) volatile { return this->__call(tr1::tie(__args...), _Bound_indexes()); } // Call as const volatile template<typename... _Args> typename result_of< const volatile _Functor(typename result_of<_Mu<_Bound_args> (const volatile _Bound_args, tuple<_Args...>)>::type...) >::type operator()(_Args&... __args) const volatile { return this->__call(tr1::tie(__args...), _Bound_indexes()); } }; /// Type of the function object returned from bind<R>(). template<typename _Result, typename _Signature> struct _Bind_result; template<typename _Result, typename _Functor, typename... _Bound_args> class _Bind_result<_Result, _Functor(_Bound_args...)> { typedef _Bind_result __self_type; typedef typename _Build_index_tuple<sizeof...(_Bound_args)>::__type _Bound_indexes; _Functor _M_f; tuple<_Bound_args...> _M_bound_args; // Call unqualified template<typename... _Args, int... _Indexes> _Result __call(const tuple<_Args...>& __args, _Index_tuple<_Indexes...>) { return _M_f(_Mu<_Bound_args>() (tr1::get<_Indexes>(_M_bound_args), __args)...); } // Call as const template<typename... _Args, int... _Indexes> _Result __call(const tuple<_Args...>& __args, _Index_tuple<_Indexes...>) const { return _M_f(_Mu<_Bound_args>() (tr1::get<_Indexes>(_M_bound_args), __args)...); } // Call as volatile template<typename... _Args, int... _Indexes> _Result __call(const tuple<_Args...>& __args, _Index_tuple<_Indexes...>) volatile { return _M_f(_Mu<_Bound_args>() (tr1::get<_Indexes>(_M_bound_args), __args)...); } // Call as const volatile template<typename... _Args, int... _Indexes> _Result __call(const tuple<_Args...>& __args, _Index_tuple<_Indexes...>) const volatile { return _M_f(_Mu<_Bound_args>() (tr1::get<_Indexes>(_M_bound_args), __args)...); } public: typedef _Result result_type; explicit _Bind_result(_Functor __f, _Bound_args... __bound_args) : _M_f(__f), _M_bound_args(__bound_args...) { } // Call unqualified template<typename... _Args> result_type operator()(_Args&... __args) { return this->__call(tr1::tie(__args...), _Bound_indexes()); } // Call as const template<typename... _Args> result_type operator()(_Args&... __args) const { return this->__call(tr1::tie(__args...), _Bound_indexes()); } // Call as volatile template<typename... _Args> result_type operator()(_Args&... __args) volatile { return this->__call(tr1::tie(__args...), _Bound_indexes()); } // Call as const volatile template<typename... _Args> result_type operator()(_Args&... __args) const volatile { return this->__call(tr1::tie(__args...), _Bound_indexes()); } }; /// Class template _Bind is always a bind expression. template<typename _Signature> struct is_bind_expression<_Bind<_Signature> > { static const bool value = true; }; template<typename _Signature> const bool is_bind_expression<_Bind<_Signature> >::value; /// Class template _Bind is always a bind expression. template<typename _Signature> struct is_bind_expression<const _Bind<_Signature> > { static const bool value = true; }; template<typename _Signature> const bool is_bind_expression<const _Bind<_Signature> >::value; /// Class template _Bind is always a bind expression. template<typename _Signature> struct is_bind_expression<volatile _Bind<_Signature> > { static const bool value = true; }; template<typename _Signature> const bool is_bind_expression<volatile _Bind<_Signature> >::value; /// Class template _Bind is always a bind expression. template<typename _Signature> struct is_bind_expression<const volatile _Bind<_Signature> > { static const bool value = true; }; template<typename _Signature> const bool is_bind_expression<const volatile _Bind<_Signature> >::value; /// Class template _Bind_result is always a bind expression. template<typename _Result, typename _Signature> struct is_bind_expression<_Bind_result<_Result, _Signature> > { static const bool value = true; }; template<typename _Result, typename _Signature> const bool is_bind_expression<_Bind_result<_Result, _Signature> >::value; /// Class template _Bind_result is always a bind expression. template<typename _Result, typename _Signature> struct is_bind_expression<const _Bind_result<_Result, _Signature> > { static const bool value = true; }; template<typename _Result, typename _Signature> const bool is_bind_expression<const _Bind_result<_Result, _Signature> >::value; /// Class template _Bind_result is always a bind expression. template<typename _Result, typename _Signature> struct is_bind_expression<volatile _Bind_result<_Result, _Signature> > { static const bool value = true; }; template<typename _Result, typename _Signature> const bool is_bind_expression<volatile _Bind_result<_Result, _Signature> >::value; /// Class template _Bind_result is always a bind expression. template<typename _Result, typename _Signature> struct is_bind_expression<const volatile _Bind_result<_Result, _Signature> > { static const bool value = true; }; template<typename _Result, typename _Signature> const bool is_bind_expression<const volatile _Bind_result<_Result, _Signature> >::value; #if __cplusplus >= 201103L template<typename _Signature> struct is_bind_expression<std::_Bind<_Signature>> : true_type { }; template<typename _Signature> struct is_bind_expression<const std::_Bind<_Signature>> : true_type { }; template<typename _Signature> struct is_bind_expression<volatile std::_Bind<_Signature>> : true_type { }; template<typename _Signature> struct is_bind_expression<const volatile std::_Bind<_Signature>> : true_type { }; template<typename _Result, typename _Signature> struct is_bind_expression<std::_Bind_result<_Result, _Signature>> : true_type { }; template<typename _Result, typename _Signature> struct is_bind_expression<const std::_Bind_result<_Result, _Signature>> : true_type { }; template<typename _Result, typename _Signature> struct is_bind_expression<volatile std::_Bind_result<_Result, _Signature>> : true_type { }; template<typename _Result, typename _Signature> struct is_bind_expression<const volatile std::_Bind_result<_Result, _Signature>> : true_type { }; #endif /// bind template<typename _Functor, typename... _ArgTypes> inline _Bind<typename _Maybe_wrap_member_pointer<_Functor>::type(_ArgTypes...)> bind(_Functor __f, _ArgTypes... __args) { typedef _Maybe_wrap_member_pointer<_Functor> __maybe_type; typedef typename __maybe_type::type __functor_type; typedef _Bind<__functor_type(_ArgTypes...)> __result_type; return __result_type(__maybe_type::__do_wrap(__f), __args...); } template<typename _Result, typename _Functor, typename... _ArgTypes> inline _Bind_result<_Result, typename _Maybe_wrap_member_pointer<_Functor>::type (_ArgTypes...)> bind(_Functor __f, _ArgTypes... __args) { typedef _Maybe_wrap_member_pointer<_Functor> __maybe_type; typedef typename __maybe_type::type __functor_type; typedef _Bind_result<_Result, __functor_type(_ArgTypes...)> __result_type; return __result_type(__maybe_type::__do_wrap(__f), __args...); } /** * @brief Exception class thrown when class template function's * operator() is called with an empty target. * @ingroup exceptions */ class bad_function_call : public std::exception { }; /** * The integral constant expression 0 can be converted into a * pointer to this type. It is used by the function template to * accept NULL pointers. */ struct _M_clear_type; /** * Trait identifying @a location-invariant types, meaning that the * address of the object (or any of its members) will not escape. * Also implies a trivial copy constructor and assignment operator. */ template<typename _Tp> struct __is_location_invariant : integral_constant<bool, (is_pointer<_Tp>::value || is_member_pointer<_Tp>::value)> { }; class _Undefined_class; union _Nocopy_types { void* _M_object; const void* _M_const_object; void (*_M_function_pointer)(); void (_Undefined_class::*_M_member_pointer)(); }; union _Any_data { void* _M_access() { return &_M_pod_data[0]; } const void* _M_access() const { return &_M_pod_data[0]; } template<typename _Tp> _Tp& _M_access() { return *static_cast<_Tp*>(_M_access()); } template<typename _Tp> const _Tp& _M_access() const { return *static_cast<const _Tp*>(_M_access()); } _Nocopy_types _M_unused; char _M_pod_data[sizeof(_Nocopy_types)]; }; enum _Manager_operation { __get_type_info, __get_functor_ptr, __clone_functor, __destroy_functor }; // Simple type wrapper that helps avoid annoying const problems // when casting between void pointers and pointers-to-pointers. template<typename _Tp> struct _Simple_type_wrapper { _Simple_type_wrapper(_Tp __value) : __value(__value) { } _Tp __value; }; template<typename _Tp> struct __is_location_invariant<_Simple_type_wrapper<_Tp> > : __is_location_invariant<_Tp> { }; // Converts a reference to a function object into a callable // function object. template<typename _Functor> inline _Functor& __callable_functor(_Functor& __f) { return __f; } template<typename _Member, typename _Class> inline _Mem_fn<_Member _Class::*> __callable_functor(_Member _Class::* &__p) { return mem_fn(__p); } template<typename _Member, typename _Class> inline _Mem_fn<_Member _Class::*> __callable_functor(_Member _Class::* const &__p) { return mem_fn(__p); } template<typename _Signature> class function; /// Base class of all polymorphic function object wrappers. class _Function_base { public: static const std::size_t _M_max_size = sizeof(_Nocopy_types); static const std::size_t _M_max_align = __alignof__(_Nocopy_types); template<typename _Functor> class _Base_manager { protected: static const bool __stored_locally = (__is_location_invariant<_Functor>::value && sizeof(_Functor) <= _M_max_size && __alignof__(_Functor) <= _M_max_align && (_M_max_align % __alignof__(_Functor) == 0)); typedef integral_constant<bool, __stored_locally> _Local_storage; // Retrieve a pointer to the function object static _Functor* _M_get_pointer(const _Any_data& __source) { const _Functor* __ptr = __stored_locally? std::__addressof(__source._M_access<_Functor>()) /* have stored a pointer */ : __source._M_access<_Functor*>(); return const_cast<_Functor*>(__ptr); } // Clone a location-invariant function object that fits within // an _Any_data structure. static void _M_clone(_Any_data& __dest, const _Any_data& __source, true_type) { new (__dest._M_access()) _Functor(__source._M_access<_Functor>()); } // Clone a function object that is not location-invariant or // that cannot fit into an _Any_data structure. static void _M_clone(_Any_data& __dest, const _Any_data& __source, false_type) { __dest._M_access<_Functor*>() = new _Functor(*__source._M_access<_Functor*>()); } // Destroying a location-invariant object may still require // destruction. static void _M_destroy(_Any_data& __victim, true_type) { __victim._M_access<_Functor>().~_Functor(); } // Destroying an object located on the heap. static void _M_destroy(_Any_data& __victim, false_type) { delete __victim._M_access<_Functor*>(); } public: static bool _M_manager(_Any_data& __dest, const _Any_data& __source, _Manager_operation __op) { switch (__op) { #ifdef __GXX_RTTI case __get_type_info: __dest._M_access<const type_info*>() = &typeid(_Functor); break; #endif case __get_functor_ptr: __dest._M_access<_Functor*>() = _M_get_pointer(__source); break; case __clone_functor: _M_clone(__dest, __source, _Local_storage()); break; case __destroy_functor: _M_destroy(__dest, _Local_storage()); break; } return false; } static void _M_init_functor(_Any_data& __functor, const _Functor& __f) { _M_init_functor(__functor, __f, _Local_storage()); } template<typename _Signature> static bool _M_not_empty_function(const function<_Signature>& __f) { return static_cast<bool>(__f); } template<typename _Tp> static bool _M_not_empty_function(const _Tp*& __fp) { return __fp; } template<typename _Class, typename _Tp> static bool _M_not_empty_function(_Tp _Class::* const& __mp) { return __mp; } template<typename _Tp> static bool _M_not_empty_function(const _Tp&) { return true; } private: static void _M_init_functor(_Any_data& __functor, const _Functor& __f, true_type) { new (__functor._M_access()) _Functor(__f); } static void _M_init_functor(_Any_data& __functor, const _Functor& __f, false_type) { __functor._M_access<_Functor*>() = new _Functor(__f); } }; template<typename _Functor> class _Ref_manager : public _Base_manager<_Functor*> { typedef _Function_base::_Base_manager<_Functor*> _Base; public: static bool _M_manager(_Any_data& __dest, const _Any_data& __source, _Manager_operation __op) { switch (__op) { #ifdef __GXX_RTTI case __get_type_info: __dest._M_access<const type_info*>() = &typeid(_Functor); break; #endif case __get_functor_ptr: __dest._M_access<_Functor*>() = *_Base::_M_get_pointer(__source); return is_const<_Functor>::value; break; default: _Base::_M_manager(__dest, __source, __op); } return false; } static void _M_init_functor(_Any_data& __functor, reference_wrapper<_Functor> __f) { _Base::_M_init_functor(__functor, std::__addressof(__f.get())); } }; _Function_base() : _M_manager(0) { } ~_Function_base() { if (_M_manager) _M_manager(_M_functor, _M_functor, __destroy_functor); } bool _M_empty() const { return !_M_manager; } typedef bool (*_Manager_type)(_Any_data&, const _Any_data&, _Manager_operation); _Any_data _M_functor; _Manager_type _M_manager; }; template<typename _Signature, typename _Functor> class _Function_handler; template<typename _Res, typename _Functor, typename... _ArgTypes> class _Function_handler<_Res(_ArgTypes...), _Functor> : public _Function_base::_Base_manager<_Functor> { typedef _Function_base::_Base_manager<_Functor> _Base; public: static _Res _M_invoke(const _Any_data& __functor, _ArgTypes... __args) { return (*_Base::_M_get_pointer(__functor))(__args...); } }; template<typename _Functor, typename... _ArgTypes> class _Function_handler<void(_ArgTypes...), _Functor> : public _Function_base::_Base_manager<_Functor> { typedef _Function_base::_Base_manager<_Functor> _Base; public: static void _M_invoke(const _Any_data& __functor, _ArgTypes... __args) { (*_Base::_M_get_pointer(__functor))(__args...); } }; template<typename _Res, typename _Functor, typename... _ArgTypes> class _Function_handler<_Res(_ArgTypes...), reference_wrapper<_Functor> > : public _Function_base::_Ref_manager<_Functor> { typedef _Function_base::_Ref_manager<_Functor> _Base; public: static _Res _M_invoke(const _Any_data& __functor, _ArgTypes... __args) { return __callable_functor(**_Base::_M_get_pointer(__functor))(__args...); } }; template<typename _Functor, typename... _ArgTypes> class _Function_handler<void(_ArgTypes...), reference_wrapper<_Functor> > : public _Function_base::_Ref_manager<_Functor> { typedef _Function_base::_Ref_manager<_Functor> _Base; public: static void _M_invoke(const _Any_data& __functor, _ArgTypes... __args) { __callable_functor(**_Base::_M_get_pointer(__functor))(__args...); } }; template<typename _Class, typename _Member, typename _Res, typename... _ArgTypes> class _Function_handler<_Res(_ArgTypes...), _Member _Class::*> : public _Function_handler<void(_ArgTypes...), _Member _Class::*> { typedef _Function_handler<void(_ArgTypes...), _Member _Class::*> _Base; public: static _Res _M_invoke(const _Any_data& __functor, _ArgTypes... __args) { return tr1:: mem_fn(_Base::_M_get_pointer(__functor)->__value)(__args...); } }; template<typename _Class, typename _Member, typename... _ArgTypes> class _Function_handler<void(_ArgTypes...), _Member _Class::*> : public _Function_base::_Base_manager< _Simple_type_wrapper< _Member _Class::* > > { typedef _Member _Class::* _Functor; typedef _Simple_type_wrapper<_Functor> _Wrapper; typedef _Function_base::_Base_manager<_Wrapper> _Base; public: static bool _M_manager(_Any_data& __dest, const _Any_data& __source, _Manager_operation __op) { switch (__op) { #ifdef __GXX_RTTI case __get_type_info: __dest._M_access<const type_info*>() = &typeid(_Functor); break; #endif case __get_functor_ptr: __dest._M_access<_Functor*>() = &_Base::_M_get_pointer(__source)->__value; break; default: _Base::_M_manager(__dest, __source, __op); } return false; } static void _M_invoke(const _Any_data& __functor, _ArgTypes... __args) { tr1::mem_fn(_Base::_M_get_pointer(__functor)->__value)(__args...); } }; /// class function template<typename _Res, typename... _ArgTypes> class function<_Res(_ArgTypes...)> : public _Maybe_unary_or_binary_function<_Res, _ArgTypes...>, private _Function_base { #if __cplusplus < 201103L /// This class is used to implement the safe_bool idiom. struct _Hidden_type { _Hidden_type* _M_bool; }; /// This typedef is used to implement the safe_bool idiom. typedef _Hidden_type* _Hidden_type::* _Safe_bool; #endif typedef _Res _Signature_type(_ArgTypes...); struct _Useless { }; public: typedef _Res result_type; // [3.7.2.1] construct/copy/destroy /** * @brief Default construct creates an empty function call wrapper. * @post @c !(bool)*this */ function() : _Function_base() { } /** * @brief Default construct creates an empty function call wrapper. * @post @c !(bool)*this */ function(_M_clear_type*) : _Function_base() { } /** * @brief %Function copy constructor. * @param x A %function object with identical call signature. * @post @c (bool)*this == (bool)x * * The newly-created %function contains a copy of the target of @a * x (if it has one). */ function(const function& __x); /** * @brief Builds a %function that targets a copy of the incoming * function object. * @param f A %function object that is callable with parameters of * type @c T1, @c T2, ..., @c TN and returns a value convertible * to @c Res. * * The newly-created %function object will target a copy of @a * f. If @a f is @c reference_wrapper<F>, then this function * object will contain a reference to the function object @c * f.get(). If @a f is a NULL function pointer or NULL * pointer-to-member, the newly-created object will be empty. * * If @a f is a non-NULL function pointer or an object of type @c * reference_wrapper<F>, this function will not throw. */ template<typename _Functor> function(_Functor __f, typename __gnu_cxx::__enable_if< !is_integral<_Functor>::value, _Useless>::__type = _Useless()); /** * @brief %Function assignment operator. * @param x A %function with identical call signature. * @post @c (bool)*this == (bool)x * @returns @c *this * * The target of @a x is copied to @c *this. If @a x has no * target, then @c *this will be empty. * * If @a x targets a function pointer or a reference to a function * object, then this operation will not throw an %exception. */ function& operator=(const function& __x) { function(__x).swap(*this); return *this; } /** * @brief %Function assignment to zero. * @post @c !(bool)*this * @returns @c *this * * The target of @c *this is deallocated, leaving it empty. */ function& operator=(_M_clear_type*) { if (_M_manager) { _M_manager(_M_functor, _M_functor, __destroy_functor); _M_manager = 0; _M_invoker = 0; } return *this; } /** * @brief %Function assignment to a new target. * @param f A %function object that is callable with parameters of * type @c T1, @c T2, ..., @c TN and returns a value convertible * to @c Res. * @return @c *this * * This %function object wrapper will target a copy of @a * f. If @a f is @c reference_wrapper<F>, then this function * object will contain a reference to the function object @c * f.get(). If @a f is a NULL function pointer or NULL * pointer-to-member, @c this object will be empty. * * If @a f is a non-NULL function pointer or an object of type @c * reference_wrapper<F>, this function will not throw. */ template<typename _Functor> typename __gnu_cxx::__enable_if<!is_integral<_Functor>::value, function&>::__type operator=(_Functor __f) { function(__f).swap(*this); return *this; } // [3.7.2.2] function modifiers /** * @brief Swap the targets of two %function objects. * @param f A %function with identical call signature. * * Swap the targets of @c this function object and @a f. This * function will not throw an %exception. */ void swap(function& __x) { std::swap(_M_functor, __x._M_functor); std::swap(_M_manager, __x._M_manager); std::swap(_M_invoker, __x._M_invoker); } // [3.7.2.3] function capacity /** * @brief Determine if the %function wrapper has a target. * * @return @c true when this %function object contains a target, * or @c false when it is empty. * * This function will not throw an %exception. */ #if __cplusplus >= 201103L explicit operator bool() const { return !_M_empty(); } #else operator _Safe_bool() const { if (_M_empty()) return 0; else return &_Hidden_type::_M_bool; } #endif // [3.7.2.4] function invocation /** * @brief Invokes the function targeted by @c *this. * @returns the result of the target. * @throws bad_function_call when @c !(bool)*this * * The function call operator invokes the target function object * stored by @c this. */ _Res operator()(_ArgTypes... __args) const; #ifdef __GXX_RTTI // [3.7.2.5] function target access /** * @brief Determine the type of the target of this function object * wrapper. * * @returns the type identifier of the target function object, or * @c typeid(void) if @c !(bool)*this. * * This function will not throw an %exception. */ const type_info& target_type() const; /** * @brief Access the stored target function object. * * @return Returns a pointer to the stored target function object, * if @c typeid(Functor).equals(target_type()); otherwise, a NULL * pointer. * * This function will not throw an %exception. */ template<typename _Functor> _Functor* target(); /// @overload template<typename _Functor> const _Functor* target() const; #endif private: // [3.7.2.6] undefined operators template<typename _Function> void operator==(const function<_Function>&) const; template<typename _Function> void operator!=(const function<_Function>&) const; typedef _Res (*_Invoker_type)(const _Any_data&, _ArgTypes...); _Invoker_type _M_invoker; }; template<typename _Res, typename... _ArgTypes> function<_Res(_ArgTypes...)>:: function(const function& __x) : _Function_base() { if (static_cast<bool>(__x)) { __x._M_manager(_M_functor, __x._M_functor, __clone_functor); _M_invoker = __x._M_invoker; _M_manager = __x._M_manager; } } template<typename _Res, typename... _ArgTypes> template<typename _Functor> function<_Res(_ArgTypes...)>:: function(_Functor __f, typename __gnu_cxx::__enable_if< !is_integral<_Functor>::value, _Useless>::__type) : _Function_base() { typedef _Function_handler<_Signature_type, _Functor> _My_handler; if (_My_handler::_M_not_empty_function(__f)) { _My_handler::_M_init_functor(_M_functor, __f); _M_invoker = &_My_handler::_M_invoke; _M_manager = &_My_handler::_M_manager; } } template<typename _Res, typename... _ArgTypes> _Res function<_Res(_ArgTypes...)>:: operator()(_ArgTypes... __args) const { if (_M_empty()) _GLIBCXX_THROW_OR_ABORT(bad_function_call()); return _M_invoker(_M_functor, __args...); } #ifdef __GXX_RTTI template<typename _Res, typename... _ArgTypes> const type_info& function<_Res(_ArgTypes...)>:: target_type() const { if (_M_manager) { _Any_data __typeinfo_result; _M_manager(__typeinfo_result, _M_functor, __get_type_info); return *__typeinfo_result._M_access<const type_info*>(); } else return typeid(void); } template<typename _Res, typename... _ArgTypes> template<typename _Functor> _Functor* function<_Res(_ArgTypes...)>:: target() { if (typeid(_Functor) == target_type() && _M_manager) { _Any_data __ptr; if (_M_manager(__ptr, _M_functor, __get_functor_ptr) && !is_const<_Functor>::value) return 0; else return __ptr._M_access<_Functor*>(); } else return 0; } template<typename _Res, typename... _ArgTypes> template<typename _Functor> const _Functor* function<_Res(_ArgTypes...)>:: target() const { if (typeid(_Functor) == target_type() && _M_manager) { _Any_data __ptr; _M_manager(__ptr, _M_functor, __get_functor_ptr); return __ptr._M_access<const _Functor*>(); } else return 0; } #endif // [3.7.2.7] null pointer comparisons /** * @brief Compares a polymorphic function object wrapper against 0 * (the NULL pointer). * @returns @c true if the wrapper has no target, @c false otherwise * * This function will not throw an %exception. */ template<typename _Signature> inline bool operator==(const function<_Signature>& __f, _M_clear_type*) { return !static_cast<bool>(__f); } /// @overload template<typename _Signature> inline bool operator==(_M_clear_type*, const function<_Signature>& __f) { return !static_cast<bool>(__f); } /** * @brief Compares a polymorphic function object wrapper against 0 * (the NULL pointer). * @returns @c false if the wrapper has no target, @c true otherwise * * This function will not throw an %exception. */ template<typename _Signature> inline bool operator!=(const function<_Signature>& __f, _M_clear_type*) { return static_cast<bool>(__f); } /// @overload template<typename _Signature> inline bool operator!=(_M_clear_type*, const function<_Signature>& __f) { return static_cast<bool>(__f); } // [3.7.2.8] specialized algorithms /** * @brief Swap the targets of two polymorphic function object wrappers. * * This function will not throw an %exception. */ template<typename _Signature> inline void swap(function<_Signature>& __x, function<_Signature>& __y) { __x.swap(__y); } _GLIBCXX_END_NAMESPACE_VERSION } #if __cplusplus >= 201103L _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename> struct is_placeholder; template<int _Num> struct is_placeholder<tr1::_Placeholder<_Num>> : integral_constant<int, _Num> { }; template<int _Num> struct is_placeholder<const tr1::_Placeholder<_Num>> : integral_constant<int, _Num> { }; template<typename> struct is_bind_expression; template<typename _Signature> struct is_bind_expression<tr1::_Bind<_Signature>> : true_type { }; template<typename _Signature> struct is_bind_expression<const tr1::_Bind<_Signature>> : true_type { }; template<typename _Signature> struct is_bind_expression<volatile tr1::_Bind<_Signature>> : true_type { }; template<typename _Signature> struct is_bind_expression<const volatile tr1::_Bind<_Signature>> : true_type { }; template<typename _Result, typename _Signature> struct is_bind_expression<tr1::_Bind_result<_Result, _Signature>> : true_type { }; template<typename _Result, typename _Signature> struct is_bind_expression<const tr1::_Bind_result<_Result, _Signature>> : true_type { }; template<typename _Result, typename _Signature> struct is_bind_expression<volatile tr1::_Bind_result<_Result, _Signature>> : true_type { }; template<typename _Result, typename _Signature> struct is_bind_expression<const volatile tr1::_Bind_result<_Result, _Signature>> : true_type { }; _GLIBCXX_END_NAMESPACE_VERSION #endif } #endif // _GLIBCXX_TR1_FUNCTIONAL ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/gamma.tcc�����������������������������������������������������������������������������0000644�����������������00000033746�14763166027�0010101 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Special functions -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/gamma.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{tr1/cmath} */ // // ISO C++ 14882 TR1: 5.2 Special functions // // Written by Edward Smith-Rowland based on: // (1) Handbook of Mathematical Functions, // ed. Milton Abramowitz and Irene A. Stegun, // Dover Publications, // Section 6, pp. 253-266 // (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl // (3) Numerical Recipes in C, by W. H. Press, S. A. Teukolsky, // W. T. Vetterling, B. P. Flannery, Cambridge University Press (1992), // 2nd ed, pp. 213-216 // (4) Gamma, Exploring Euler's Constant, Julian Havil, // Princeton, 2003. #ifndef _GLIBCXX_TR1_GAMMA_TCC #define _GLIBCXX_TR1_GAMMA_TCC 1 #include "special_function_util.h" namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { // Implementation-space details. namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief This returns Bernoulli numbers from a table or by summation * for larger values. * * Recursion is unstable. * * @param __n the order n of the Bernoulli number. * @return The Bernoulli number of order n. */ template <typename _Tp> _Tp __bernoulli_series(unsigned int __n) { static const _Tp __num[28] = { _Tp(1UL), -_Tp(1UL) / _Tp(2UL), _Tp(1UL) / _Tp(6UL), _Tp(0UL), -_Tp(1UL) / _Tp(30UL), _Tp(0UL), _Tp(1UL) / _Tp(42UL), _Tp(0UL), -_Tp(1UL) / _Tp(30UL), _Tp(0UL), _Tp(5UL) / _Tp(66UL), _Tp(0UL), -_Tp(691UL) / _Tp(2730UL), _Tp(0UL), _Tp(7UL) / _Tp(6UL), _Tp(0UL), -_Tp(3617UL) / _Tp(510UL), _Tp(0UL), _Tp(43867UL) / _Tp(798UL), _Tp(0UL), -_Tp(174611) / _Tp(330UL), _Tp(0UL), _Tp(854513UL) / _Tp(138UL), _Tp(0UL), -_Tp(236364091UL) / _Tp(2730UL), _Tp(0UL), _Tp(8553103UL) / _Tp(6UL), _Tp(0UL) }; if (__n == 0) return _Tp(1); if (__n == 1) return -_Tp(1) / _Tp(2); // Take care of the rest of the odd ones. if (__n % 2 == 1) return _Tp(0); // Take care of some small evens that are painful for the series. if (__n < 28) return __num[__n]; _Tp __fact = _Tp(1); if ((__n / 2) % 2 == 0) __fact *= _Tp(-1); for (unsigned int __k = 1; __k <= __n; ++__k) __fact *= __k / (_Tp(2) * __numeric_constants<_Tp>::__pi()); __fact *= _Tp(2); _Tp __sum = _Tp(0); for (unsigned int __i = 1; __i < 1000; ++__i) { _Tp __term = std::pow(_Tp(__i), -_Tp(__n)); if (__term < std::numeric_limits<_Tp>::epsilon()) break; __sum += __term; } return __fact * __sum; } /** * @brief This returns Bernoulli number \f$B_n\f$. * * @param __n the order n of the Bernoulli number. * @return The Bernoulli number of order n. */ template<typename _Tp> inline _Tp __bernoulli(int __n) { return __bernoulli_series<_Tp>(__n); } /** * @brief Return \f$log(\Gamma(x))\f$ by asymptotic expansion * with Bernoulli number coefficients. This is like * Sterling's approximation. * * @param __x The argument of the log of the gamma function. * @return The logarithm of the gamma function. */ template<typename _Tp> _Tp __log_gamma_bernoulli(_Tp __x) { _Tp __lg = (__x - _Tp(0.5L)) * std::log(__x) - __x + _Tp(0.5L) * std::log(_Tp(2) * __numeric_constants<_Tp>::__pi()); const _Tp __xx = __x * __x; _Tp __help = _Tp(1) / __x; for ( unsigned int __i = 1; __i < 20; ++__i ) { const _Tp __2i = _Tp(2 * __i); __help /= __2i * (__2i - _Tp(1)) * __xx; __lg += __bernoulli<_Tp>(2 * __i) * __help; } return __lg; } /** * @brief Return \f$log(\Gamma(x))\f$ by the Lanczos method. * This method dominates all others on the positive axis I think. * * @param __x The argument of the log of the gamma function. * @return The logarithm of the gamma function. */ template<typename _Tp> _Tp __log_gamma_lanczos(_Tp __x) { const _Tp __xm1 = __x - _Tp(1); static const _Tp __lanczos_cheb_7[9] = { _Tp( 0.99999999999980993227684700473478L), _Tp( 676.520368121885098567009190444019L), _Tp(-1259.13921672240287047156078755283L), _Tp( 771.3234287776530788486528258894L), _Tp(-176.61502916214059906584551354L), _Tp( 12.507343278686904814458936853L), _Tp(-0.13857109526572011689554707L), _Tp( 9.984369578019570859563e-6L), _Tp( 1.50563273514931155834e-7L) }; static const _Tp __LOGROOT2PI = _Tp(0.9189385332046727417803297364056176L); _Tp __sum = __lanczos_cheb_7[0]; for(unsigned int __k = 1; __k < 9; ++__k) __sum += __lanczos_cheb_7[__k] / (__xm1 + __k); const _Tp __term1 = (__xm1 + _Tp(0.5L)) * std::log((__xm1 + _Tp(7.5L)) / __numeric_constants<_Tp>::__euler()); const _Tp __term2 = __LOGROOT2PI + std::log(__sum); const _Tp __result = __term1 + (__term2 - _Tp(7)); return __result; } /** * @brief Return \f$ log(|\Gamma(x)|) \f$. * This will return values even for \f$ x < 0 \f$. * To recover the sign of \f$ \Gamma(x) \f$ for * any argument use @a __log_gamma_sign. * * @param __x The argument of the log of the gamma function. * @return The logarithm of the gamma function. */ template<typename _Tp> _Tp __log_gamma(_Tp __x) { if (__x > _Tp(0.5L)) return __log_gamma_lanczos(__x); else { const _Tp __sin_fact = std::abs(std::sin(__numeric_constants<_Tp>::__pi() * __x)); if (__sin_fact == _Tp(0)) std::__throw_domain_error(__N("Argument is nonpositive integer " "in __log_gamma")); return __numeric_constants<_Tp>::__lnpi() - std::log(__sin_fact) - __log_gamma_lanczos(_Tp(1) - __x); } } /** * @brief Return the sign of \f$ \Gamma(x) \f$. * At nonpositive integers zero is returned. * * @param __x The argument of the gamma function. * @return The sign of the gamma function. */ template<typename _Tp> _Tp __log_gamma_sign(_Tp __x) { if (__x > _Tp(0)) return _Tp(1); else { const _Tp __sin_fact = std::sin(__numeric_constants<_Tp>::__pi() * __x); if (__sin_fact > _Tp(0)) return (1); else if (__sin_fact < _Tp(0)) return -_Tp(1); else return _Tp(0); } } /** * @brief Return the logarithm of the binomial coefficient. * The binomial coefficient is given by: * @f[ * \left( \right) = \frac{n!}{(n-k)! k!} * @f] * * @param __n The first argument of the binomial coefficient. * @param __k The second argument of the binomial coefficient. * @return The binomial coefficient. */ template<typename _Tp> _Tp __log_bincoef(unsigned int __n, unsigned int __k) { // Max e exponent before overflow. static const _Tp __max_bincoeff = std::numeric_limits<_Tp>::max_exponent10 * std::log(_Tp(10)) - _Tp(1); #if _GLIBCXX_USE_C99_MATH_TR1 _Tp __coeff = std::tr1::lgamma(_Tp(1 + __n)) - std::tr1::lgamma(_Tp(1 + __k)) - std::tr1::lgamma(_Tp(1 + __n - __k)); #else _Tp __coeff = __log_gamma(_Tp(1 + __n)) - __log_gamma(_Tp(1 + __k)) - __log_gamma(_Tp(1 + __n - __k)); #endif } /** * @brief Return the binomial coefficient. * The binomial coefficient is given by: * @f[ * \left( \right) = \frac{n!}{(n-k)! k!} * @f] * * @param __n The first argument of the binomial coefficient. * @param __k The second argument of the binomial coefficient. * @return The binomial coefficient. */ template<typename _Tp> _Tp __bincoef(unsigned int __n, unsigned int __k) { // Max e exponent before overflow. static const _Tp __max_bincoeff = std::numeric_limits<_Tp>::max_exponent10 * std::log(_Tp(10)) - _Tp(1); const _Tp __log_coeff = __log_bincoef<_Tp>(__n, __k); if (__log_coeff > __max_bincoeff) return std::numeric_limits<_Tp>::quiet_NaN(); else return std::exp(__log_coeff); } /** * @brief Return \f$ \Gamma(x) \f$. * * @param __x The argument of the gamma function. * @return The gamma function. */ template<typename _Tp> inline _Tp __gamma(_Tp __x) { return std::exp(__log_gamma(__x)); } /** * @brief Return the digamma function by series expansion. * The digamma or @f$ \psi(x) @f$ function is defined by * @f[ * \psi(x) = \frac{\Gamma'(x)}{\Gamma(x)} * @f] * * The series is given by: * @f[ * \psi(x) = -\gamma_E - \frac{1}{x} * \sum_{k=1}^{\infty} \frac{x}{k(x + k)} * @f] */ template<typename _Tp> _Tp __psi_series(_Tp __x) { _Tp __sum = -__numeric_constants<_Tp>::__gamma_e() - _Tp(1) / __x; const unsigned int __max_iter = 100000; for (unsigned int __k = 1; __k < __max_iter; ++__k) { const _Tp __term = __x / (__k * (__k + __x)); __sum += __term; if (std::abs(__term / __sum) < std::numeric_limits<_Tp>::epsilon()) break; } return __sum; } /** * @brief Return the digamma function for large argument. * The digamma or @f$ \psi(x) @f$ function is defined by * @f[ * \psi(x) = \frac{\Gamma'(x)}{\Gamma(x)} * @f] * * The asymptotic series is given by: * @f[ * \psi(x) = \ln(x) - \frac{1}{2x} * - \sum_{n=1}^{\infty} \frac{B_{2n}}{2 n x^{2n}} * @f] */ template<typename _Tp> _Tp __psi_asymp(_Tp __x) { _Tp __sum = std::log(__x) - _Tp(0.5L) / __x; const _Tp __xx = __x * __x; _Tp __xp = __xx; const unsigned int __max_iter = 100; for (unsigned int __k = 1; __k < __max_iter; ++__k) { const _Tp __term = __bernoulli<_Tp>(2 * __k) / (2 * __k * __xp); __sum -= __term; if (std::abs(__term / __sum) < std::numeric_limits<_Tp>::epsilon()) break; __xp *= __xx; } return __sum; } /** * @brief Return the digamma function. * The digamma or @f$ \psi(x) @f$ function is defined by * @f[ * \psi(x) = \frac{\Gamma'(x)}{\Gamma(x)} * @f] * For negative argument the reflection formula is used: * @f[ * \psi(x) = \psi(1-x) - \pi \cot(\pi x) * @f] */ template<typename _Tp> _Tp __psi(_Tp __x) { const int __n = static_cast<int>(__x + 0.5L); const _Tp __eps = _Tp(4) * std::numeric_limits<_Tp>::epsilon(); if (__n <= 0 && std::abs(__x - _Tp(__n)) < __eps) return std::numeric_limits<_Tp>::quiet_NaN(); else if (__x < _Tp(0)) { const _Tp __pi = __numeric_constants<_Tp>::__pi(); return __psi(_Tp(1) - __x) - __pi * std::cos(__pi * __x) / std::sin(__pi * __x); } else if (__x > _Tp(100)) return __psi_asymp(__x); else return __psi_series(__x); } /** * @brief Return the polygamma function @f$ \psi^{(n)}(x) @f$. * * The polygamma function is related to the Hurwitz zeta function: * @f[ * \psi^{(n)}(x) = (-1)^{n+1} m! \zeta(m+1,x) * @f] */ template<typename _Tp> _Tp __psi(unsigned int __n, _Tp __x) { if (__x <= _Tp(0)) std::__throw_domain_error(__N("Argument out of range " "in __psi")); else if (__n == 0) return __psi(__x); else { const _Tp __hzeta = __hurwitz_zeta(_Tp(__n + 1), __x); #if _GLIBCXX_USE_C99_MATH_TR1 const _Tp __ln_nfact = std::tr1::lgamma(_Tp(__n + 1)); #else const _Tp __ln_nfact = __log_gamma(_Tp(__n + 1)); #endif _Tp __result = std::exp(__ln_nfact) * __hzeta; if (__n % 2 == 1) __result = -__result; return __result; } } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std::tr1::__detail } } #endif // _GLIBCXX_TR1_GAMMA_TCC ��������������������������c++/4.8.2/tr1/unordered_map�������������������������������������������������������������������������0000644�����������������00000003046�14763166027�0011061 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 unordered_map -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/unordered_map * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_UNORDERED_MAP #define _GLIBCXX_TR1_UNORDERED_MAP 1 #pragma GCC system_header #include <utility> #include <bits/stl_algobase.h> #include <bits/allocator.h> #include <bits/stl_function.h> // equal_to, _Identity, _Select1st #include <bits/stringfwd.h> #include <tr1/type_traits> #include <tr1/functional_hash.h> #include <tr1/hashtable.h> #include <tr1/unordered_map.h> #endif // _GLIBCXX_TR1_UNORDERED_MAP ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/unordered_set.h�����������������������������������������������������������������������0000644�����������������00000022504�14763166027�0011325 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 unordered_set implementation -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/unordered_set.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{tr1/unordered_set} */ namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { _GLIBCXX_BEGIN_NAMESPACE_VERSION // NB: When we get typedef templates these class definitions // will be unnecessary. template<class _Value, class _Hash = hash<_Value>, class _Pred = std::equal_to<_Value>, class _Alloc = std::allocator<_Value>, bool __cache_hash_code = false> class __unordered_set : public _Hashtable<_Value, _Value, _Alloc, std::_Identity<_Value>, _Pred, _Hash, __detail::_Mod_range_hashing, __detail::_Default_ranged_hash, __detail::_Prime_rehash_policy, __cache_hash_code, true, true> { typedef _Hashtable<_Value, _Value, _Alloc, std::_Identity<_Value>, _Pred, _Hash, __detail::_Mod_range_hashing, __detail::_Default_ranged_hash, __detail::_Prime_rehash_policy, __cache_hash_code, true, true> _Base; public: typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; typedef typename _Base::allocator_type allocator_type; explicit __unordered_set(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __detail::_Mod_range_hashing(), __detail::_Default_ranged_hash(), __eql, std::_Identity<_Value>(), __a) { } template<typename _InputIterator> __unordered_set(_InputIterator __f, _InputIterator __l, size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(), __detail::_Default_ranged_hash(), __eql, std::_Identity<_Value>(), __a) { } }; template<class _Value, class _Hash = hash<_Value>, class _Pred = std::equal_to<_Value>, class _Alloc = std::allocator<_Value>, bool __cache_hash_code = false> class __unordered_multiset : public _Hashtable<_Value, _Value, _Alloc, std::_Identity<_Value>, _Pred, _Hash, __detail::_Mod_range_hashing, __detail::_Default_ranged_hash, __detail::_Prime_rehash_policy, __cache_hash_code, true, false> { typedef _Hashtable<_Value, _Value, _Alloc, std::_Identity<_Value>, _Pred, _Hash, __detail::_Mod_range_hashing, __detail::_Default_ranged_hash, __detail::_Prime_rehash_policy, __cache_hash_code, true, false> _Base; public: typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; typedef typename _Base::allocator_type allocator_type; explicit __unordered_multiset(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __detail::_Mod_range_hashing(), __detail::_Default_ranged_hash(), __eql, std::_Identity<_Value>(), __a) { } template<typename _InputIterator> __unordered_multiset(_InputIterator __f, _InputIterator __l, typename _Base::size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(), __detail::_Default_ranged_hash(), __eql, std::_Identity<_Value>(), __a) { } }; template<class _Value, class _Hash, class _Pred, class _Alloc, bool __cache_hash_code> inline void swap(__unordered_set<_Value, _Hash, _Pred, _Alloc, __cache_hash_code>& __x, __unordered_set<_Value, _Hash, _Pred, _Alloc, __cache_hash_code>& __y) { __x.swap(__y); } template<class _Value, class _Hash, class _Pred, class _Alloc, bool __cache_hash_code> inline void swap(__unordered_multiset<_Value, _Hash, _Pred, _Alloc, __cache_hash_code>& __x, __unordered_multiset<_Value, _Hash, _Pred, _Alloc, __cache_hash_code>& __y) { __x.swap(__y); } /** * @brief A standard container composed of unique keys (containing * at most one of each key value) in which the elements' keys are * the elements themselves. * * @ingroup unordered_associative_containers * * Meets the requirements of a <a href="tables.html#65">container</a>, and * <a href="tables.html#xx">unordered associative container</a> * * @param Value Type of key objects. * @param Hash Hashing function object type, defaults to hash<Value>. * @param Pred Predicate function object type, defaults to equal_to<Value>. * @param Alloc Allocator type, defaults to allocator<Key>. */ template<class _Value, class _Hash = hash<_Value>, class _Pred = std::equal_to<_Value>, class _Alloc = std::allocator<_Value> > class unordered_set : public __unordered_set<_Value, _Hash, _Pred, _Alloc> { typedef __unordered_set<_Value, _Hash, _Pred, _Alloc> _Base; public: typedef typename _Base::value_type value_type; typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; typedef typename _Base::allocator_type allocator_type; explicit unordered_set(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) { } template<typename _InputIterator> unordered_set(_InputIterator __f, _InputIterator __l, size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __eql, __a) { } }; /** * @brief A standard container composed of equivalent keys * (possibly containing multiple of each key value) in which the * elements' keys are the elements themselves. * * @ingroup unordered_associative_containers * * Meets the requirements of a <a href="tables.html#65">container</a>, and * <a href="tables.html#xx">unordered associative container</a> * * @param Value Type of key objects. * @param Hash Hashing function object type, defaults to hash<Value>. * @param Pred Predicate function object type, defaults to equal_to<Value>. * @param Alloc Allocator type, defaults to allocator<Key>. */ template<class _Value, class _Hash = hash<_Value>, class _Pred = std::equal_to<_Value>, class _Alloc = std::allocator<_Value> > class unordered_multiset : public __unordered_multiset<_Value, _Hash, _Pred, _Alloc> { typedef __unordered_multiset<_Value, _Hash, _Pred, _Alloc> _Base; public: typedef typename _Base::value_type value_type; typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; typedef typename _Base::allocator_type allocator_type; explicit unordered_multiset(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) { } template<typename _InputIterator> unordered_multiset(_InputIterator __f, _InputIterator __l, typename _Base::size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __eql, __a) { } }; template<class _Value, class _Hash, class _Pred, class _Alloc> inline void swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) { __x.swap(__y); } template<class _Value, class _Hash, class _Pred, class _Alloc> inline void swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) { __x.swap(__y); } _GLIBCXX_END_NAMESPACE_VERSION } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/poly_laguerre.tcc���������������������������������������������������������������������0000644�����������������00000026115�14763166027�0011660 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Special functions -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/poly_laguerre.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{tr1/cmath} */ // // ISO C++ 14882 TR1: 5.2 Special functions // // Written by Edward Smith-Rowland based on: // (1) Handbook of Mathematical Functions, // Ed. Milton Abramowitz and Irene A. Stegun, // Dover Publications, // Section 13, pp. 509-510, Section 22 pp. 773-802 // (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl #ifndef _GLIBCXX_TR1_POLY_LAGUERRE_TCC #define _GLIBCXX_TR1_POLY_LAGUERRE_TCC 1 namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { // [5.2] Special functions // Implementation-space details. namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief This routine returns the associated Laguerre polynomial * of order @f$ n @f$, degree @f$ \alpha @f$ for large n. * Abramowitz & Stegun, 13.5.21 * * @param __n The order of the Laguerre function. * @param __alpha The degree of the Laguerre function. * @param __x The argument of the Laguerre function. * @return The value of the Laguerre function of order n, * degree @f$ \alpha @f$, and argument x. * * This is from the GNU Scientific Library. */ template<typename _Tpa, typename _Tp> _Tp __poly_laguerre_large_n(unsigned __n, _Tpa __alpha1, _Tp __x) { const _Tp __a = -_Tp(__n); const _Tp __b = _Tp(__alpha1) + _Tp(1); const _Tp __eta = _Tp(2) * __b - _Tp(4) * __a; const _Tp __cos2th = __x / __eta; const _Tp __sin2th = _Tp(1) - __cos2th; const _Tp __th = std::acos(std::sqrt(__cos2th)); const _Tp __pre_h = __numeric_constants<_Tp>::__pi_2() * __numeric_constants<_Tp>::__pi_2() * __eta * __eta * __cos2th * __sin2th; #if _GLIBCXX_USE_C99_MATH_TR1 const _Tp __lg_b = std::tr1::lgamma(_Tp(__n) + __b); const _Tp __lnfact = std::tr1::lgamma(_Tp(__n + 1)); #else const _Tp __lg_b = __log_gamma(_Tp(__n) + __b); const _Tp __lnfact = __log_gamma(_Tp(__n + 1)); #endif _Tp __pre_term1 = _Tp(0.5L) * (_Tp(1) - __b) * std::log(_Tp(0.25L) * __x * __eta); _Tp __pre_term2 = _Tp(0.25L) * std::log(__pre_h); _Tp __lnpre = __lg_b - __lnfact + _Tp(0.5L) * __x + __pre_term1 - __pre_term2; _Tp __ser_term1 = std::sin(__a * __numeric_constants<_Tp>::__pi()); _Tp __ser_term2 = std::sin(_Tp(0.25L) * __eta * (_Tp(2) * __th - std::sin(_Tp(2) * __th)) + __numeric_constants<_Tp>::__pi_4()); _Tp __ser = __ser_term1 + __ser_term2; return std::exp(__lnpre) * __ser; } /** * @brief Evaluate the polynomial based on the confluent hypergeometric * function in a safe way, with no restriction on the arguments. * * The associated Laguerre function is defined by * @f[ * L_n^\alpha(x) = \frac{(\alpha + 1)_n}{n!} * _1F_1(-n; \alpha + 1; x) * @f] * where @f$ (\alpha)_n @f$ is the Pochhammer symbol and * @f$ _1F_1(a; c; x) @f$ is the confluent hypergeometric function. * * This function assumes x != 0. * * This is from the GNU Scientific Library. */ template<typename _Tpa, typename _Tp> _Tp __poly_laguerre_hyperg(unsigned int __n, _Tpa __alpha1, _Tp __x) { const _Tp __b = _Tp(__alpha1) + _Tp(1); const _Tp __mx = -__x; const _Tp __tc_sgn = (__x < _Tp(0) ? _Tp(1) : ((__n % 2 == 1) ? -_Tp(1) : _Tp(1))); // Get |x|^n/n! _Tp __tc = _Tp(1); const _Tp __ax = std::abs(__x); for (unsigned int __k = 1; __k <= __n; ++__k) __tc *= (__ax / __k); _Tp __term = __tc * __tc_sgn; _Tp __sum = __term; for (int __k = int(__n) - 1; __k >= 0; --__k) { __term *= ((__b + _Tp(__k)) / _Tp(int(__n) - __k)) * _Tp(__k + 1) / __mx; __sum += __term; } return __sum; } /** * @brief This routine returns the associated Laguerre polynomial * of order @f$ n @f$, degree @f$ \alpha @f$: @f$ L_n^\alpha(x) @f$ * by recursion. * * The associated Laguerre function is defined by * @f[ * L_n^\alpha(x) = \frac{(\alpha + 1)_n}{n!} * _1F_1(-n; \alpha + 1; x) * @f] * where @f$ (\alpha)_n @f$ is the Pochhammer symbol and * @f$ _1F_1(a; c; x) @f$ is the confluent hypergeometric function. * * The associated Laguerre polynomial is defined for integral * @f$ \alpha = m @f$ by: * @f[ * L_n^m(x) = (-1)^m \frac{d^m}{dx^m} L_{n + m}(x) * @f] * where the Laguerre polynomial is defined by: * @f[ * L_n(x) = \frac{e^x}{n!} \frac{d^n}{dx^n} (x^ne^{-x}) * @f] * * @param __n The order of the Laguerre function. * @param __alpha The degree of the Laguerre function. * @param __x The argument of the Laguerre function. * @return The value of the Laguerre function of order n, * degree @f$ \alpha @f$, and argument x. */ template<typename _Tpa, typename _Tp> _Tp __poly_laguerre_recursion(unsigned int __n, _Tpa __alpha1, _Tp __x) { // Compute l_0. _Tp __l_0 = _Tp(1); if (__n == 0) return __l_0; // Compute l_1^alpha. _Tp __l_1 = -__x + _Tp(1) + _Tp(__alpha1); if (__n == 1) return __l_1; // Compute l_n^alpha by recursion on n. _Tp __l_n2 = __l_0; _Tp __l_n1 = __l_1; _Tp __l_n = _Tp(0); for (unsigned int __nn = 2; __nn <= __n; ++__nn) { __l_n = (_Tp(2 * __nn - 1) + _Tp(__alpha1) - __x) * __l_n1 / _Tp(__nn) - (_Tp(__nn - 1) + _Tp(__alpha1)) * __l_n2 / _Tp(__nn); __l_n2 = __l_n1; __l_n1 = __l_n; } return __l_n; } /** * @brief This routine returns the associated Laguerre polynomial * of order n, degree @f$ \alpha @f$: @f$ L_n^alpha(x) @f$. * * The associated Laguerre function is defined by * @f[ * L_n^\alpha(x) = \frac{(\alpha + 1)_n}{n!} * _1F_1(-n; \alpha + 1; x) * @f] * where @f$ (\alpha)_n @f$ is the Pochhammer symbol and * @f$ _1F_1(a; c; x) @f$ is the confluent hypergeometric function. * * The associated Laguerre polynomial is defined for integral * @f$ \alpha = m @f$ by: * @f[ * L_n^m(x) = (-1)^m \frac{d^m}{dx^m} L_{n + m}(x) * @f] * where the Laguerre polynomial is defined by: * @f[ * L_n(x) = \frac{e^x}{n!} \frac{d^n}{dx^n} (x^ne^{-x}) * @f] * * @param __n The order of the Laguerre function. * @param __alpha The degree of the Laguerre function. * @param __x The argument of the Laguerre function. * @return The value of the Laguerre function of order n, * degree @f$ \alpha @f$, and argument x. */ template<typename _Tpa, typename _Tp> _Tp __poly_laguerre(unsigned int __n, _Tpa __alpha1, _Tp __x) { if (__x < _Tp(0)) std::__throw_domain_error(__N("Negative argument " "in __poly_laguerre.")); // Return NaN on NaN input. else if (__isnan(__x)) return std::numeric_limits<_Tp>::quiet_NaN(); else if (__n == 0) return _Tp(1); else if (__n == 1) return _Tp(1) + _Tp(__alpha1) - __x; else if (__x == _Tp(0)) { _Tp __prod = _Tp(__alpha1) + _Tp(1); for (unsigned int __k = 2; __k <= __n; ++__k) __prod *= (_Tp(__alpha1) + _Tp(__k)) / _Tp(__k); return __prod; } else if (__n > 10000000 && _Tp(__alpha1) > -_Tp(1) && __x < _Tp(2) * (_Tp(__alpha1) + _Tp(1)) + _Tp(4 * __n)) return __poly_laguerre_large_n(__n, __alpha1, __x); else if (_Tp(__alpha1) >= _Tp(0) || (__x > _Tp(0) && _Tp(__alpha1) < -_Tp(__n + 1))) return __poly_laguerre_recursion(__n, __alpha1, __x); else return __poly_laguerre_hyperg(__n, __alpha1, __x); } /** * @brief This routine returns the associated Laguerre polynomial * of order n, degree m: @f$ L_n^m(x) @f$. * * The associated Laguerre polynomial is defined for integral * @f$ \alpha = m @f$ by: * @f[ * L_n^m(x) = (-1)^m \frac{d^m}{dx^m} L_{n + m}(x) * @f] * where the Laguerre polynomial is defined by: * @f[ * L_n(x) = \frac{e^x}{n!} \frac{d^n}{dx^n} (x^ne^{-x}) * @f] * * @param __n The order of the Laguerre polynomial. * @param __m The degree of the Laguerre polynomial. * @param __x The argument of the Laguerre polynomial. * @return The value of the associated Laguerre polynomial of order n, * degree m, and argument x. */ template<typename _Tp> inline _Tp __assoc_laguerre(unsigned int __n, unsigned int __m, _Tp __x) { return __poly_laguerre<unsigned int, _Tp>(__n, __m, __x); } /** * @brief This routine returns the Laguerre polynomial * of order n: @f$ L_n(x) @f$. * * The Laguerre polynomial is defined by: * @f[ * L_n(x) = \frac{e^x}{n!} \frac{d^n}{dx^n} (x^ne^{-x}) * @f] * * @param __n The order of the Laguerre polynomial. * @param __x The argument of the Laguerre polynomial. * @return The value of the Laguerre polynomial of order n * and argument x. */ template<typename _Tp> inline _Tp __laguerre(unsigned int __n, _Tp __x) { return __poly_laguerre<unsigned int, _Tp>(__n, 0, __x); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std::tr1::__detail } } #endif // _GLIBCXX_TR1_POLY_LAGUERRE_TCC ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/modified_bessel_func.tcc��������������������������������������������������������������0000644�����������������00000036544�14763166027�0013146 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Special functions -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/modified_bessel_func.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{tr1/cmath} */ // // ISO C++ 14882 TR1: 5.2 Special functions // // Written by Edward Smith-Rowland. // // References: // (1) Handbook of Mathematical Functions, // Ed. Milton Abramowitz and Irene A. Stegun, // Dover Publications, // Section 9, pp. 355-434, Section 10 pp. 435-478 // (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl // (3) Numerical Recipes in C, by W. H. Press, S. A. Teukolsky, // W. T. Vetterling, B. P. Flannery, Cambridge University Press (1992), // 2nd ed, pp. 246-249. #ifndef _GLIBCXX_TR1_MODIFIED_BESSEL_FUNC_TCC #define _GLIBCXX_TR1_MODIFIED_BESSEL_FUNC_TCC 1 #include "special_function_util.h" namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { // [5.2] Special functions // Implementation-space details. namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Compute the modified Bessel functions @f$ I_\nu(x) @f$ and * @f$ K_\nu(x) @f$ and their first derivatives * @f$ I'_\nu(x) @f$ and @f$ K'_\nu(x) @f$ respectively. * These four functions are computed together for numerical * stability. * * @param __nu The order of the Bessel functions. * @param __x The argument of the Bessel functions. * @param __Inu The output regular modified Bessel function. * @param __Knu The output irregular modified Bessel function. * @param __Ipnu The output derivative of the regular * modified Bessel function. * @param __Kpnu The output derivative of the irregular * modified Bessel function. */ template <typename _Tp> void __bessel_ik(_Tp __nu, _Tp __x, _Tp & __Inu, _Tp & __Knu, _Tp & __Ipnu, _Tp & __Kpnu) { if (__x == _Tp(0)) { if (__nu == _Tp(0)) { __Inu = _Tp(1); __Ipnu = _Tp(0); } else if (__nu == _Tp(1)) { __Inu = _Tp(0); __Ipnu = _Tp(0.5L); } else { __Inu = _Tp(0); __Ipnu = _Tp(0); } __Knu = std::numeric_limits<_Tp>::infinity(); __Kpnu = -std::numeric_limits<_Tp>::infinity(); return; } const _Tp __eps = std::numeric_limits<_Tp>::epsilon(); const _Tp __fp_min = _Tp(10) * std::numeric_limits<_Tp>::epsilon(); const int __max_iter = 15000; const _Tp __x_min = _Tp(2); const int __nl = static_cast<int>(__nu + _Tp(0.5L)); const _Tp __mu = __nu - __nl; const _Tp __mu2 = __mu * __mu; const _Tp __xi = _Tp(1) / __x; const _Tp __xi2 = _Tp(2) * __xi; _Tp __h = __nu * __xi; if ( __h < __fp_min ) __h = __fp_min; _Tp __b = __xi2 * __nu; _Tp __d = _Tp(0); _Tp __c = __h; int __i; for ( __i = 1; __i <= __max_iter; ++__i ) { __b += __xi2; __d = _Tp(1) / (__b + __d); __c = __b + _Tp(1) / __c; const _Tp __del = __c * __d; __h *= __del; if (std::abs(__del - _Tp(1)) < __eps) break; } if (__i > __max_iter) std::__throw_runtime_error(__N("Argument x too large " "in __bessel_ik; " "try asymptotic expansion.")); _Tp __Inul = __fp_min; _Tp __Ipnul = __h * __Inul; _Tp __Inul1 = __Inul; _Tp __Ipnu1 = __Ipnul; _Tp __fact = __nu * __xi; for (int __l = __nl; __l >= 1; --__l) { const _Tp __Inutemp = __fact * __Inul + __Ipnul; __fact -= __xi; __Ipnul = __fact * __Inutemp + __Inul; __Inul = __Inutemp; } _Tp __f = __Ipnul / __Inul; _Tp __Kmu, __Knu1; if (__x < __x_min) { const _Tp __x2 = __x / _Tp(2); const _Tp __pimu = __numeric_constants<_Tp>::__pi() * __mu; const _Tp __fact = (std::abs(__pimu) < __eps ? _Tp(1) : __pimu / std::sin(__pimu)); _Tp __d = -std::log(__x2); _Tp __e = __mu * __d; const _Tp __fact2 = (std::abs(__e) < __eps ? _Tp(1) : std::sinh(__e) / __e); _Tp __gam1, __gam2, __gampl, __gammi; __gamma_temme(__mu, __gam1, __gam2, __gampl, __gammi); _Tp __ff = __fact * (__gam1 * std::cosh(__e) + __gam2 * __fact2 * __d); _Tp __sum = __ff; __e = std::exp(__e); _Tp __p = __e / (_Tp(2) * __gampl); _Tp __q = _Tp(1) / (_Tp(2) * __e * __gammi); _Tp __c = _Tp(1); __d = __x2 * __x2; _Tp __sum1 = __p; int __i; for (__i = 1; __i <= __max_iter; ++__i) { __ff = (__i * __ff + __p + __q) / (__i * __i - __mu2); __c *= __d / __i; __p /= __i - __mu; __q /= __i + __mu; const _Tp __del = __c * __ff; __sum += __del; const _Tp __del1 = __c * (__p - __i * __ff); __sum1 += __del1; if (std::abs(__del) < __eps * std::abs(__sum)) break; } if (__i > __max_iter) std::__throw_runtime_error(__N("Bessel k series failed to converge " "in __bessel_ik.")); __Kmu = __sum; __Knu1 = __sum1 * __xi2; } else { _Tp __b = _Tp(2) * (_Tp(1) + __x); _Tp __d = _Tp(1) / __b; _Tp __delh = __d; _Tp __h = __delh; _Tp __q1 = _Tp(0); _Tp __q2 = _Tp(1); _Tp __a1 = _Tp(0.25L) - __mu2; _Tp __q = __c = __a1; _Tp __a = -__a1; _Tp __s = _Tp(1) + __q * __delh; int __i; for (__i = 2; __i <= __max_iter; ++__i) { __a -= 2 * (__i - 1); __c = -__a * __c / __i; const _Tp __qnew = (__q1 - __b * __q2) / __a; __q1 = __q2; __q2 = __qnew; __q += __c * __qnew; __b += _Tp(2); __d = _Tp(1) / (__b + __a * __d); __delh = (__b * __d - _Tp(1)) * __delh; __h += __delh; const _Tp __dels = __q * __delh; __s += __dels; if ( std::abs(__dels / __s) < __eps ) break; } if (__i > __max_iter) std::__throw_runtime_error(__N("Steed's method failed " "in __bessel_ik.")); __h = __a1 * __h; __Kmu = std::sqrt(__numeric_constants<_Tp>::__pi() / (_Tp(2) * __x)) * std::exp(-__x) / __s; __Knu1 = __Kmu * (__mu + __x + _Tp(0.5L) - __h) * __xi; } _Tp __Kpmu = __mu * __xi * __Kmu - __Knu1; _Tp __Inumu = __xi / (__f * __Kmu - __Kpmu); __Inu = __Inumu * __Inul1 / __Inul; __Ipnu = __Inumu * __Ipnu1 / __Inul; for ( __i = 1; __i <= __nl; ++__i ) { const _Tp __Knutemp = (__mu + __i) * __xi2 * __Knu1 + __Kmu; __Kmu = __Knu1; __Knu1 = __Knutemp; } __Knu = __Kmu; __Kpnu = __nu * __xi * __Kmu - __Knu1; return; } /** * @brief Return the regular modified Bessel function of order * \f$ \nu \f$: \f$ I_{\nu}(x) \f$. * * The regular modified cylindrical Bessel function is: * @f[ * I_{\nu}(x) = \sum_{k=0}^{\infty} * \frac{(x/2)^{\nu + 2k}}{k!\Gamma(\nu+k+1)} * @f] * * @param __nu The order of the regular modified Bessel function. * @param __x The argument of the regular modified Bessel function. * @return The output regular modified Bessel function. */ template<typename _Tp> _Tp __cyl_bessel_i(_Tp __nu, _Tp __x) { if (__nu < _Tp(0) || __x < _Tp(0)) std::__throw_domain_error(__N("Bad argument " "in __cyl_bessel_i.")); else if (__isnan(__nu) || __isnan(__x)) return std::numeric_limits<_Tp>::quiet_NaN(); else if (__x * __x < _Tp(10) * (__nu + _Tp(1))) return __cyl_bessel_ij_series(__nu, __x, +_Tp(1), 200); else { _Tp __I_nu, __K_nu, __Ip_nu, __Kp_nu; __bessel_ik(__nu, __x, __I_nu, __K_nu, __Ip_nu, __Kp_nu); return __I_nu; } } /** * @brief Return the irregular modified Bessel function * \f$ K_{\nu}(x) \f$ of order \f$ \nu \f$. * * The irregular modified Bessel function is defined by: * @f[ * K_{\nu}(x) = \frac{\pi}{2} * \frac{I_{-\nu}(x) - I_{\nu}(x)}{\sin \nu\pi} * @f] * where for integral \f$ \nu = n \f$ a limit is taken: * \f$ lim_{\nu \to n} \f$. * * @param __nu The order of the irregular modified Bessel function. * @param __x The argument of the irregular modified Bessel function. * @return The output irregular modified Bessel function. */ template<typename _Tp> _Tp __cyl_bessel_k(_Tp __nu, _Tp __x) { if (__nu < _Tp(0) || __x < _Tp(0)) std::__throw_domain_error(__N("Bad argument " "in __cyl_bessel_k.")); else if (__isnan(__nu) || __isnan(__x)) return std::numeric_limits<_Tp>::quiet_NaN(); else { _Tp __I_nu, __K_nu, __Ip_nu, __Kp_nu; __bessel_ik(__nu, __x, __I_nu, __K_nu, __Ip_nu, __Kp_nu); return __K_nu; } } /** * @brief Compute the spherical modified Bessel functions * @f$ i_n(x) @f$ and @f$ k_n(x) @f$ and their first * derivatives @f$ i'_n(x) @f$ and @f$ k'_n(x) @f$ * respectively. * * @param __n The order of the modified spherical Bessel function. * @param __x The argument of the modified spherical Bessel function. * @param __i_n The output regular modified spherical Bessel function. * @param __k_n The output irregular modified spherical * Bessel function. * @param __ip_n The output derivative of the regular modified * spherical Bessel function. * @param __kp_n The output derivative of the irregular modified * spherical Bessel function. */ template <typename _Tp> void __sph_bessel_ik(unsigned int __n, _Tp __x, _Tp & __i_n, _Tp & __k_n, _Tp & __ip_n, _Tp & __kp_n) { const _Tp __nu = _Tp(__n) + _Tp(0.5L); _Tp __I_nu, __Ip_nu, __K_nu, __Kp_nu; __bessel_ik(__nu, __x, __I_nu, __K_nu, __Ip_nu, __Kp_nu); const _Tp __factor = __numeric_constants<_Tp>::__sqrtpio2() / std::sqrt(__x); __i_n = __factor * __I_nu; __k_n = __factor * __K_nu; __ip_n = __factor * __Ip_nu - __i_n / (_Tp(2) * __x); __kp_n = __factor * __Kp_nu - __k_n / (_Tp(2) * __x); return; } /** * @brief Compute the Airy functions * @f$ Ai(x) @f$ and @f$ Bi(x) @f$ and their first * derivatives @f$ Ai'(x) @f$ and @f$ Bi(x) @f$ * respectively. * * @param __n The order of the Airy functions. * @param __x The argument of the Airy functions. * @param __i_n The output Airy function. * @param __k_n The output Airy function. * @param __ip_n The output derivative of the Airy function. * @param __kp_n The output derivative of the Airy function. */ template <typename _Tp> void __airy(_Tp __x, _Tp & __Ai, _Tp & __Bi, _Tp & __Aip, _Tp & __Bip) { const _Tp __absx = std::abs(__x); const _Tp __rootx = std::sqrt(__absx); const _Tp __z = _Tp(2) * __absx * __rootx / _Tp(3); if (__isnan(__x)) return std::numeric_limits<_Tp>::quiet_NaN(); else if (__x > _Tp(0)) { _Tp __I_nu, __Ip_nu, __K_nu, __Kp_nu; __bessel_ik(_Tp(1) / _Tp(3), __z, __I_nu, __K_nu, __Ip_nu, __Kp_nu); __Ai = __rootx * __K_nu / (__numeric_constants<_Tp>::__sqrt3() * __numeric_constants<_Tp>::__pi()); __Bi = __rootx * (__K_nu / __numeric_constants<_Tp>::__pi() + _Tp(2) * __I_nu / __numeric_constants<_Tp>::__sqrt3()); __bessel_ik(_Tp(2) / _Tp(3), __z, __I_nu, __K_nu, __Ip_nu, __Kp_nu); __Aip = -__x * __K_nu / (__numeric_constants<_Tp>::__sqrt3() * __numeric_constants<_Tp>::__pi()); __Bip = __x * (__K_nu / __numeric_constants<_Tp>::__pi() + _Tp(2) * __I_nu / __numeric_constants<_Tp>::__sqrt3()); } else if (__x < _Tp(0)) { _Tp __J_nu, __Jp_nu, __N_nu, __Np_nu; __bessel_jn(_Tp(1) / _Tp(3), __z, __J_nu, __N_nu, __Jp_nu, __Np_nu); __Ai = __rootx * (__J_nu - __N_nu / __numeric_constants<_Tp>::__sqrt3()) / _Tp(2); __Bi = -__rootx * (__N_nu + __J_nu / __numeric_constants<_Tp>::__sqrt3()) / _Tp(2); __bessel_jn(_Tp(2) / _Tp(3), __z, __J_nu, __N_nu, __Jp_nu, __Np_nu); __Aip = __absx * (__N_nu / __numeric_constants<_Tp>::__sqrt3() + __J_nu) / _Tp(2); __Bip = __absx * (__J_nu / __numeric_constants<_Tp>::__sqrt3() - __N_nu) / _Tp(2); } else { // Reference: // Abramowitz & Stegun, page 446 section 10.4.4 on Airy functions. // The number is Ai(0) = 3^{-2/3}/\Gamma(2/3). __Ai = _Tp(0.35502805388781723926L); __Bi = __Ai * __numeric_constants<_Tp>::__sqrt3(); // Reference: // Abramowitz & Stegun, page 446 section 10.4.5 on Airy functions. // The number is Ai'(0) = -3^{-1/3}/\Gamma(1/3). __Aip = -_Tp(0.25881940379280679840L); __Bip = -__Aip * __numeric_constants<_Tp>::__sqrt3(); } return; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std::tr1::__detail } } #endif // _GLIBCXX_TR1_MODIFIED_BESSEL_FUNC_TCC ������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/stdlib.h������������������������������������������������������������������������������0000644�����������������00000002710�14763166027�0007741 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 stdlib.h -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/stdlib.h * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_STDLIB_H #define _GLIBCXX_TR1_STDLIB_H 1 #include <tr1/cstdlib> #if _GLIBCXX_HOSTED #if _GLIBCXX_USE_C99 using std::tr1::atoll; using std::tr1::strtoll; using std::tr1::strtoull; using std::tr1::abs; #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC using std::tr1::div; #endif #endif #endif #endif // _GLIBCXX_TR1_STDLIB_H ��������������������������������������������������������c++/4.8.2/tr1/tuple���������������������������������������������������������������������������������0000644�����������������00000027527�14763166027�0007400 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// class template tuple -*- C++ -*- // Copyright (C) 2004-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/tuple * This is a TR1 C++ Library header. */ // Chris Jefferson <chris@bubblescope.net> // Variadic Templates support by Douglas Gregor <doug.gregor@gmail.com> #ifndef _GLIBCXX_TR1_TUPLE #define _GLIBCXX_TR1_TUPLE 1 #pragma GCC system_header #include <utility> namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Adds a const reference to a non-reference type. template<typename _Tp> struct __add_c_ref { typedef const _Tp& type; }; template<typename _Tp> struct __add_c_ref<_Tp&> { typedef _Tp& type; }; // Adds a reference to a non-reference type. template<typename _Tp> struct __add_ref { typedef _Tp& type; }; template<typename _Tp> struct __add_ref<_Tp&> { typedef _Tp& type; }; /** * Contains the actual implementation of the @c tuple template, stored * as a recursive inheritance hierarchy from the first element (most * derived class) to the last (least derived class). The @c Idx * parameter gives the 0-based index of the element stored at this * point in the hierarchy; we use it to implement a constant-time * get() operation. */ template<int _Idx, typename... _Elements> struct _Tuple_impl; /** * Zero-element tuple implementation. This is the basis case for the * inheritance recursion. */ template<int _Idx> struct _Tuple_impl<_Idx> { }; /** * Recursive tuple implementation. Here we store the @c Head element * and derive from a @c Tuple_impl containing the remaining elements * (which contains the @c Tail). */ template<int _Idx, typename _Head, typename... _Tail> struct _Tuple_impl<_Idx, _Head, _Tail...> : public _Tuple_impl<_Idx + 1, _Tail...> { typedef _Tuple_impl<_Idx + 1, _Tail...> _Inherited; _Head _M_head; _Inherited& _M_tail() { return *this; } const _Inherited& _M_tail() const { return *this; } _Tuple_impl() : _Inherited(), _M_head() { } explicit _Tuple_impl(typename __add_c_ref<_Head>::type __head, typename __add_c_ref<_Tail>::type... __tail) : _Inherited(__tail...), _M_head(__head) { } template<typename... _UElements> _Tuple_impl(const _Tuple_impl<_Idx, _UElements...>& __in) : _Inherited(__in._M_tail()), _M_head(__in._M_head) { } _Tuple_impl(const _Tuple_impl& __in) : _Inherited(__in._M_tail()), _M_head(__in._M_head) { } template<typename... _UElements> _Tuple_impl& operator=(const _Tuple_impl<_Idx, _UElements...>& __in) { _M_head = __in._M_head; _M_tail() = __in._M_tail(); return *this; } _Tuple_impl& operator=(const _Tuple_impl& __in) { _M_head = __in._M_head; _M_tail() = __in._M_tail(); return *this; } }; template<typename... _Elements> class tuple : public _Tuple_impl<0, _Elements...> { typedef _Tuple_impl<0, _Elements...> _Inherited; public: tuple() : _Inherited() { } explicit tuple(typename __add_c_ref<_Elements>::type... __elements) : _Inherited(__elements...) { } template<typename... _UElements> tuple(const tuple<_UElements...>& __in) : _Inherited(__in) { } tuple(const tuple& __in) : _Inherited(__in) { } template<typename... _UElements> tuple& operator=(const tuple<_UElements...>& __in) { static_cast<_Inherited&>(*this) = __in; return *this; } tuple& operator=(const tuple& __in) { static_cast<_Inherited&>(*this) = __in; return *this; } }; template<> class tuple<> { }; // 2-element tuple, with construction and assignment from a pair. template<typename _T1, typename _T2> class tuple<_T1, _T2> : public _Tuple_impl<0, _T1, _T2> { typedef _Tuple_impl<0, _T1, _T2> _Inherited; public: tuple() : _Inherited() { } explicit tuple(typename __add_c_ref<_T1>::type __a1, typename __add_c_ref<_T2>::type __a2) : _Inherited(__a1, __a2) { } template<typename _U1, typename _U2> tuple(const tuple<_U1, _U2>& __in) : _Inherited(__in) { } tuple(const tuple& __in) : _Inherited(__in) { } template<typename _U1, typename _U2> tuple(const pair<_U1, _U2>& __in) : _Inherited(_Tuple_impl<0, typename __add_c_ref<_U1>::type, typename __add_c_ref<_U2>::type>(__in.first, __in.second)) { } template<typename _U1, typename _U2> tuple& operator=(const tuple<_U1, _U2>& __in) { static_cast<_Inherited&>(*this) = __in; return *this; } tuple& operator=(const tuple& __in) { static_cast<_Inherited&>(*this) = __in; return *this; } template<typename _U1, typename _U2> tuple& operator=(const pair<_U1, _U2>& __in) { this->_M_head = __in.first; this->_M_tail()._M_head = __in.second; return *this; } }; /// Gives the type of the ith element of a given tuple type. template<int __i, typename _Tp> struct tuple_element; /** * Recursive case for tuple_element: strip off the first element in * the tuple and retrieve the (i-1)th element of the remaining tuple. */ template<int __i, typename _Head, typename... _Tail> struct tuple_element<__i, tuple<_Head, _Tail...> > : tuple_element<__i - 1, tuple<_Tail...> > { }; /** * Basis case for tuple_element: The first element is the one we're seeking. */ template<typename _Head, typename... _Tail> struct tuple_element<0, tuple<_Head, _Tail...> > { typedef _Head type; }; /// Finds the size of a given tuple type. template<typename _Tp> struct tuple_size; /// class tuple_size template<typename... _Elements> struct tuple_size<tuple<_Elements...> > { static const int value = sizeof...(_Elements); }; template<typename... _Elements> const int tuple_size<tuple<_Elements...> >::value; template<int __i, typename _Head, typename... _Tail> inline typename __add_ref<_Head>::type __get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t) { return __t._M_head; } template<int __i, typename _Head, typename... _Tail> inline typename __add_c_ref<_Head>::type __get_helper(const _Tuple_impl<__i, _Head, _Tail...>& __t) { return __t._M_head; } // Return a reference (const reference) to the ith element of a tuple. // Any const or non-const ref elements are returned with their original type. template<int __i, typename... _Elements> inline typename __add_ref< typename tuple_element<__i, tuple<_Elements...> >::type >::type get(tuple<_Elements...>& __t) { return __get_helper<__i>(__t); } template<int __i, typename... _Elements> inline typename __add_c_ref< typename tuple_element<__i, tuple<_Elements...> >::type >::type get(const tuple<_Elements...>& __t) { return __get_helper<__i>(__t); } // This class helps construct the various comparison operations on tuples template<int __check_equal_size, int __i, int __j, typename _Tp, typename _Up> struct __tuple_compare; template<int __i, int __j, typename _Tp, typename _Up> struct __tuple_compare<0, __i, __j, _Tp, _Up> { static bool __eq(const _Tp& __t, const _Up& __u) { return (get<__i>(__t) == get<__i>(__u) && __tuple_compare<0, __i+1, __j, _Tp, _Up>::__eq(__t, __u)); } static bool __less(const _Tp& __t, const _Up& __u) { return ((get<__i>(__t) < get<__i>(__u)) || !(get<__i>(__u) < get<__i>(__t)) && __tuple_compare<0, __i+1, __j, _Tp, _Up>::__less(__t, __u)); } }; template<int __i, typename _Tp, typename _Up> struct __tuple_compare<0, __i, __i, _Tp, _Up> { static bool __eq(const _Tp&, const _Up&) { return true; } static bool __less(const _Tp&, const _Up&) { return false; } }; template<typename... _TElements, typename... _UElements> bool operator==(const tuple<_TElements...>& __t, const tuple<_UElements...>& __u) { typedef tuple<_TElements...> _Tp; typedef tuple<_UElements...> _Up; return (__tuple_compare<tuple_size<_Tp>::value - tuple_size<_Up>::value, 0, tuple_size<_Tp>::value, _Tp, _Up>::__eq(__t, __u)); } template<typename... _TElements, typename... _UElements> bool operator<(const tuple<_TElements...>& __t, const tuple<_UElements...>& __u) { typedef tuple<_TElements...> _Tp; typedef tuple<_UElements...> _Up; return (__tuple_compare<tuple_size<_Tp>::value - tuple_size<_Up>::value, 0, tuple_size<_Tp>::value, _Tp, _Up>::__less(__t, __u)); } template<typename... _TElements, typename... _UElements> inline bool operator!=(const tuple<_TElements...>& __t, const tuple<_UElements...>& __u) { return !(__t == __u); } template<typename... _TElements, typename... _UElements> inline bool operator>(const tuple<_TElements...>& __t, const tuple<_UElements...>& __u) { return __u < __t; } template<typename... _TElements, typename... _UElements> inline bool operator<=(const tuple<_TElements...>& __t, const tuple<_UElements...>& __u) { return !(__u < __t); } template<typename... _TElements, typename... _UElements> inline bool operator>=(const tuple<_TElements...>& __t, const tuple<_UElements...>& __u) { return !(__t < __u); } template<typename _Tp> class reference_wrapper; // Helper which adds a reference to a type when given a reference_wrapper template<typename _Tp> struct __strip_reference_wrapper { typedef _Tp __type; }; template<typename _Tp> struct __strip_reference_wrapper<reference_wrapper<_Tp> > { typedef _Tp& __type; }; template<typename _Tp> struct __strip_reference_wrapper<const reference_wrapper<_Tp> > { typedef _Tp& __type; }; template<typename... _Elements> inline tuple<typename __strip_reference_wrapper<_Elements>::__type...> make_tuple(_Elements... __args) { typedef tuple<typename __strip_reference_wrapper<_Elements>::__type...> __result_type; return __result_type(__args...); } template<typename... _Elements> inline tuple<_Elements&...> tie(_Elements&... __args) { return tuple<_Elements&...>(__args...); } // A class (and instance) which can be used in 'tie' when an element // of a tuple is not required struct _Swallow_assign { template<class _Tp> _Swallow_assign& operator=(const _Tp&) { return *this; } }; // TODO: Put this in some kind of shared file. namespace { _Swallow_assign ignore; }; // anonymous namespace _GLIBCXX_END_NAMESPACE_VERSION } } #endif // _GLIBCXX_TR1_TUPLE �������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/inttypes.h����������������������������������������������������������������������������0000644�����������������00000002363�14763166027�0010343 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 inttypes.h -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/inttypes.h * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_INTTYPES_H #define _GLIBCXX_TR1_INTTYPES_H 1 #include <tr1/cinttypes> #endif // _GLIBCXX_TR1_INTTYPES_H �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/cwchar��������������������������������������������������������������������������������0000644�����������������00000003260�14763166027�0007502 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 cwchar -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/cwchar * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_CWCHAR #define _GLIBCXX_TR1_CWCHAR 1 #pragma GCC system_header #include <cwchar> #ifdef _GLIBCXX_USE_WCHAR_T namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { #if _GLIBCXX_HAVE_WCSTOF using std::wcstof; #endif #if _GLIBCXX_HAVE_VFWSCANF using std::vfwscanf; #endif #if _GLIBCXX_HAVE_VSWSCANF using std::vswscanf; #endif #if _GLIBCXX_HAVE_VWSCANF using std::vwscanf; #endif #if _GLIBCXX_USE_C99 using std::wcstold; using std::wcstoll; using std::wcstoull; #endif } } #endif // _GLIBCXX_USE_WCHAR_T #endif // _GLIBCXX_TR1_CWCHAR ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/stdbool.h�����������������������������������������������������������������������������0000644�����������������00000002303�14763166027�0010124 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 stdbool.h -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/stdbool.h * This is a TR1 C++ Library header. */ #ifndef _TR1_STDBOOL_H #define _TR1_STDBOOL_H 1 #include <tr1/cstdbool> #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/climits�������������������������������������������������������������������������������0000644�����������������00000002656�14763166027�0007707 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 climits -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/climits * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_CLIMITS #define _GLIBCXX_TR1_CLIMITS 1 #include <climits> #ifndef LLONG_MIN #define LLONG_MIN (-__LONG_LONG_MAX__ - 1) #endif #ifndef LLONG_MAX #define LLONG_MAX __LONG_LONG_MAX__ #endif #ifndef ULLONG_MAX #define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1) #endif #endif // _GLIBCXX_TR1_CLIMITS ����������������������������������������������������������������������������������c++/4.8.2/tr1/float.h�������������������������������������������������������������������������������0000644�����������������00000002271�14763166027�0007567 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 float.h -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/float.h * This is a TR1 C++ Library header. */ #ifndef _TR1_FLOAT_H #define _TR1_FLOAT_H 1 #include <tr1/cfloat> #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/memory��������������������������������������������������������������������������������0000644�����������������00000003377�14763166027�0007554 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <tr1/memory> -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** * @file tr1/memory * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_MEMORY #define _GLIBCXX_TR1_MEMORY 1 #pragma GCC system_header #if defined(_GLIBCXX_INCLUDE_AS_CXX11) # error TR1 header cannot be included from C++11 header #endif #include <memory> #include <exception> // std::exception #include <typeinfo> // std::type_info in get_deleter #include <bits/stl_algobase.h> // std::swap #include <iosfwd> // std::basic_ostream #include <ext/atomicity.h> #include <ext/concurrence.h> #include <bits/functexcept.h> #include <bits/stl_function.h> // std::less #include <debug/debug.h> #include <tr1/type_traits> #include <tr1/shared_ptr.h> #endif // _GLIBCXX_TR1_MEMORY �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/cinttypes�����������������������������������������������������������������������������0000644�����������������00000004320�14763166027�0010253 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 cinttypes -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/cinttypes * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_CINTTYPES #define _GLIBCXX_TR1_CINTTYPES 1 #pragma GCC system_header #include <tr1/cstdint> // For 8.11.1/1 (see C99, Note 184) #if _GLIBCXX_HAVE_INTTYPES_H # ifndef __STDC_FORMAT_MACROS # define _UNDEF__STDC_FORMAT_MACROS # define __STDC_FORMAT_MACROS # endif # include <inttypes.h> # ifdef _UNDEF__STDC_FORMAT_MACROS # undef __STDC_FORMAT_MACROS # undef _UNDEF__STDC_FORMAT_MACROS # endif #endif #ifdef _GLIBCXX_USE_C99_INTTYPES_TR1 namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { // types using ::imaxdiv_t; // functions using ::imaxabs; // May collide with _Longlong abs(_Longlong), and is not described // anywhere outside the synopsis. Likely, a defect. // // intmax_t abs(intmax_t) using ::imaxdiv; // Likewise, with lldiv_t div(_Longlong, _Longlong). // // imaxdiv_t div(intmax_t, intmax_t) using ::strtoimax; using ::strtoumax; #if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 using ::wcstoimax; using ::wcstoumax; #endif } } #endif // _GLIBCXX_USE_C99_INTTYPES_TR1 #endif // _GLIBCXX_TR1_CINTTYPES ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/ccomplex������������������������������������������������������������������������������0000644�����������������00000002347�14763166027�0010052 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 ccomplex -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/ccomplex * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_CCOMPLEX #define _GLIBCXX_TR1_CCOMPLEX 1 #include <tr1/complex> #endif // _GLIBCXX_TR1_CCOMPLEX �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/wctype.h������������������������������������������������������������������������������0000644�����������������00000002347�14763166027�0010001 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 wctype.h -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/wctype.h * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_WCTYPE_H #define _GLIBCXX_TR1_WCTYPE_H 1 #include <tr1/cwctype> #endif // _GLIBCXX_TR1_WCTYPE_H �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/shared_ptr.h��������������������������������������������������������������������������0000644�����������������00000077640�14763166027�0010631 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <tr1/shared_ptr.h> -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // shared_count.hpp // Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. // shared_ptr.hpp // Copyright (C) 1998, 1999 Greg Colvin and Beman Dawes. // Copyright (C) 2001, 2002, 2003 Peter Dimov // weak_ptr.hpp // Copyright (C) 2001, 2002, 2003 Peter Dimov // enable_shared_from_this.hpp // Copyright (C) 2002 Peter Dimov // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // GCC Note: based on version 1.32.0 of the Boost library. /** @file tr1/shared_ptr.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{tr1/memory} */ #ifndef _TR1_SHARED_PTR_H #define _TR1_SHARED_PTR_H 1 namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Exception possibly thrown by @c shared_ptr. * @ingroup exceptions */ class bad_weak_ptr : public std::exception { public: virtual char const* what() const throw() { return "tr1::bad_weak_ptr"; } }; // Substitute for bad_weak_ptr object in the case of -fno-exceptions. inline void __throw_bad_weak_ptr() { _GLIBCXX_THROW_OR_ABORT(bad_weak_ptr()); } using __gnu_cxx::_Lock_policy; using __gnu_cxx::__default_lock_policy; using __gnu_cxx::_S_single; using __gnu_cxx::_S_mutex; using __gnu_cxx::_S_atomic; // Empty helper class except when the template argument is _S_mutex. template<_Lock_policy _Lp> class _Mutex_base { protected: // The atomic policy uses fully-fenced builtins, single doesn't care. enum { _S_need_barriers = 0 }; }; template<> class _Mutex_base<_S_mutex> : public __gnu_cxx::__mutex { protected: // This policy is used when atomic builtins are not available. // The replacement atomic operations might not have the necessary // memory barriers. enum { _S_need_barriers = 1 }; }; template<_Lock_policy _Lp = __default_lock_policy> class _Sp_counted_base : public _Mutex_base<_Lp> { public: _Sp_counted_base() : _M_use_count(1), _M_weak_count(1) { } virtual ~_Sp_counted_base() // nothrow { } // Called when _M_use_count drops to zero, to release the resources // managed by *this. virtual void _M_dispose() = 0; // nothrow // Called when _M_weak_count drops to zero. virtual void _M_destroy() // nothrow { delete this; } virtual void* _M_get_deleter(const std::type_info&) = 0; void _M_add_ref_copy() { __gnu_cxx::__atomic_add_dispatch(&_M_use_count, 1); } void _M_add_ref_lock(); void _M_release() // nothrow { // Be race-detector-friendly. For more info see bits/c++config. _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_use_count); if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1) { _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count); _M_dispose(); // There must be a memory barrier between dispose() and destroy() // to ensure that the effects of dispose() are observed in the // thread that runs destroy(). // See http://gcc.gnu.org/ml/libstdc++/2005-11/msg00136.html if (_Mutex_base<_Lp>::_S_need_barriers) { _GLIBCXX_READ_MEM_BARRIER; _GLIBCXX_WRITE_MEM_BARRIER; } // Be race-detector-friendly. For more info see bits/c++config. _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count); if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, -1) == 1) { _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count); _M_destroy(); } } } void _M_weak_add_ref() // nothrow { __gnu_cxx::__atomic_add_dispatch(&_M_weak_count, 1); } void _M_weak_release() // nothrow { // Be race-detector-friendly. For more info see bits/c++config. _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count); if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, -1) == 1) { _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count); if (_Mutex_base<_Lp>::_S_need_barriers) { // See _M_release(), // destroy() must observe results of dispose() _GLIBCXX_READ_MEM_BARRIER; _GLIBCXX_WRITE_MEM_BARRIER; } _M_destroy(); } } long _M_get_use_count() const // nothrow { // No memory barrier is used here so there is no synchronization // with other threads. return const_cast<const volatile _Atomic_word&>(_M_use_count); } private: _Sp_counted_base(_Sp_counted_base const&); _Sp_counted_base& operator=(_Sp_counted_base const&); _Atomic_word _M_use_count; // #shared _Atomic_word _M_weak_count; // #weak + (#shared != 0) }; template<> inline void _Sp_counted_base<_S_single>:: _M_add_ref_lock() { if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0) { _M_use_count = 0; __throw_bad_weak_ptr(); } } template<> inline void _Sp_counted_base<_S_mutex>:: _M_add_ref_lock() { __gnu_cxx::__scoped_lock sentry(*this); if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0) { _M_use_count = 0; __throw_bad_weak_ptr(); } } template<> inline void _Sp_counted_base<_S_atomic>:: _M_add_ref_lock() { // Perform lock-free add-if-not-zero operation. _Atomic_word __count = _M_use_count; do { if (__count == 0) __throw_bad_weak_ptr(); // Replace the current counter value with the old value + 1, as // long as it's not changed meanwhile. } while (!__atomic_compare_exchange_n(&_M_use_count, &__count, __count + 1, true, __ATOMIC_ACQ_REL, __ATOMIC_RELAXED)); } template<typename _Ptr, typename _Deleter, _Lock_policy _Lp> class _Sp_counted_base_impl : public _Sp_counted_base<_Lp> { public: // Precondition: __d(__p) must not throw. _Sp_counted_base_impl(_Ptr __p, _Deleter __d) : _M_ptr(__p), _M_del(__d) { } virtual void _M_dispose() // nothrow { _M_del(_M_ptr); } virtual void* _M_get_deleter(const std::type_info& __ti) { #ifdef __GXX_RTTI return __ti == typeid(_Deleter) ? &_M_del : 0; #else return 0; #endif } private: _Sp_counted_base_impl(const _Sp_counted_base_impl&); _Sp_counted_base_impl& operator=(const _Sp_counted_base_impl&); _Ptr _M_ptr; // copy constructor must not throw _Deleter _M_del; // copy constructor must not throw }; template<_Lock_policy _Lp = __default_lock_policy> class __weak_count; template<typename _Tp> struct _Sp_deleter { typedef void result_type; typedef _Tp* argument_type; void operator()(_Tp* __p) const { delete __p; } }; template<_Lock_policy _Lp = __default_lock_policy> class __shared_count { public: __shared_count() : _M_pi(0) // nothrow { } template<typename _Ptr> __shared_count(_Ptr __p) : _M_pi(0) { __try { typedef typename std::tr1::remove_pointer<_Ptr>::type _Tp; _M_pi = new _Sp_counted_base_impl<_Ptr, _Sp_deleter<_Tp>, _Lp>( __p, _Sp_deleter<_Tp>()); } __catch(...) { delete __p; __throw_exception_again; } } template<typename _Ptr, typename _Deleter> __shared_count(_Ptr __p, _Deleter __d) : _M_pi(0) { __try { _M_pi = new _Sp_counted_base_impl<_Ptr, _Deleter, _Lp>(__p, __d); } __catch(...) { __d(__p); // Call _Deleter on __p. __throw_exception_again; } } // Special case for auto_ptr<_Tp> to provide the strong guarantee. template<typename _Tp> explicit __shared_count(std::auto_ptr<_Tp>& __r) : _M_pi(new _Sp_counted_base_impl<_Tp*, _Sp_deleter<_Tp>, _Lp >(__r.get(), _Sp_deleter<_Tp>())) { __r.release(); } // Throw bad_weak_ptr when __r._M_get_use_count() == 0. explicit __shared_count(const __weak_count<_Lp>& __r); ~__shared_count() // nothrow { if (_M_pi != 0) _M_pi->_M_release(); } __shared_count(const __shared_count& __r) : _M_pi(__r._M_pi) // nothrow { if (_M_pi != 0) _M_pi->_M_add_ref_copy(); } __shared_count& operator=(const __shared_count& __r) // nothrow { _Sp_counted_base<_Lp>* __tmp = __r._M_pi; if (__tmp != _M_pi) { if (__tmp != 0) __tmp->_M_add_ref_copy(); if (_M_pi != 0) _M_pi->_M_release(); _M_pi = __tmp; } return *this; } void _M_swap(__shared_count& __r) // nothrow { _Sp_counted_base<_Lp>* __tmp = __r._M_pi; __r._M_pi = _M_pi; _M_pi = __tmp; } long _M_get_use_count() const // nothrow { return _M_pi != 0 ? _M_pi->_M_get_use_count() : 0; } bool _M_unique() const // nothrow { return this->_M_get_use_count() == 1; } friend inline bool operator==(const __shared_count& __a, const __shared_count& __b) { return __a._M_pi == __b._M_pi; } friend inline bool operator<(const __shared_count& __a, const __shared_count& __b) { return std::less<_Sp_counted_base<_Lp>*>()(__a._M_pi, __b._M_pi); } void* _M_get_deleter(const std::type_info& __ti) const { return _M_pi ? _M_pi->_M_get_deleter(__ti) : 0; } private: friend class __weak_count<_Lp>; _Sp_counted_base<_Lp>* _M_pi; }; template<_Lock_policy _Lp> class __weak_count { public: __weak_count() : _M_pi(0) // nothrow { } __weak_count(const __shared_count<_Lp>& __r) : _M_pi(__r._M_pi) // nothrow { if (_M_pi != 0) _M_pi->_M_weak_add_ref(); } __weak_count(const __weak_count<_Lp>& __r) : _M_pi(__r._M_pi) // nothrow { if (_M_pi != 0) _M_pi->_M_weak_add_ref(); } ~__weak_count() // nothrow { if (_M_pi != 0) _M_pi->_M_weak_release(); } __weak_count<_Lp>& operator=(const __shared_count<_Lp>& __r) // nothrow { _Sp_counted_base<_Lp>* __tmp = __r._M_pi; if (__tmp != 0) __tmp->_M_weak_add_ref(); if (_M_pi != 0) _M_pi->_M_weak_release(); _M_pi = __tmp; return *this; } __weak_count<_Lp>& operator=(const __weak_count<_Lp>& __r) // nothrow { _Sp_counted_base<_Lp>* __tmp = __r._M_pi; if (__tmp != 0) __tmp->_M_weak_add_ref(); if (_M_pi != 0) _M_pi->_M_weak_release(); _M_pi = __tmp; return *this; } void _M_swap(__weak_count<_Lp>& __r) // nothrow { _Sp_counted_base<_Lp>* __tmp = __r._M_pi; __r._M_pi = _M_pi; _M_pi = __tmp; } long _M_get_use_count() const // nothrow { return _M_pi != 0 ? _M_pi->_M_get_use_count() : 0; } friend inline bool operator==(const __weak_count<_Lp>& __a, const __weak_count<_Lp>& __b) { return __a._M_pi == __b._M_pi; } friend inline bool operator<(const __weak_count<_Lp>& __a, const __weak_count<_Lp>& __b) { return std::less<_Sp_counted_base<_Lp>*>()(__a._M_pi, __b._M_pi); } private: friend class __shared_count<_Lp>; _Sp_counted_base<_Lp>* _M_pi; }; // now that __weak_count is defined we can define this constructor: template<_Lock_policy _Lp> inline __shared_count<_Lp>:: __shared_count(const __weak_count<_Lp>& __r) : _M_pi(__r._M_pi) { if (_M_pi != 0) _M_pi->_M_add_ref_lock(); else __throw_bad_weak_ptr(); } // Forward declarations. template<typename _Tp, _Lock_policy _Lp = __default_lock_policy> class __shared_ptr; template<typename _Tp, _Lock_policy _Lp = __default_lock_policy> class __weak_ptr; template<typename _Tp, _Lock_policy _Lp = __default_lock_policy> class __enable_shared_from_this; template<typename _Tp> class shared_ptr; template<typename _Tp> class weak_ptr; template<typename _Tp> class enable_shared_from_this; // Support for enable_shared_from_this. // Friend of __enable_shared_from_this. template<_Lock_policy _Lp, typename _Tp1, typename _Tp2> void __enable_shared_from_this_helper(const __shared_count<_Lp>&, const __enable_shared_from_this<_Tp1, _Lp>*, const _Tp2*); // Friend of enable_shared_from_this. template<typename _Tp1, typename _Tp2> void __enable_shared_from_this_helper(const __shared_count<>&, const enable_shared_from_this<_Tp1>*, const _Tp2*); template<_Lock_policy _Lp> inline void __enable_shared_from_this_helper(const __shared_count<_Lp>&, ...) { } struct __static_cast_tag { }; struct __const_cast_tag { }; struct __dynamic_cast_tag { }; // A smart pointer with reference-counted copy semantics. The // object pointed to is deleted when the last shared_ptr pointing to // it is destroyed or reset. template<typename _Tp, _Lock_policy _Lp> class __shared_ptr { public: typedef _Tp element_type; __shared_ptr() : _M_ptr(0), _M_refcount() // never throws { } template<typename _Tp1> explicit __shared_ptr(_Tp1* __p) : _M_ptr(__p), _M_refcount(__p) { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) typedef int _IsComplete[sizeof(_Tp1)]; __enable_shared_from_this_helper(_M_refcount, __p, __p); } template<typename _Tp1, typename _Deleter> __shared_ptr(_Tp1* __p, _Deleter __d) : _M_ptr(__p), _M_refcount(__p, __d) { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) // TODO requires _Deleter CopyConstructible and __d(__p) well-formed __enable_shared_from_this_helper(_M_refcount, __p, __p); } // generated copy constructor, assignment, destructor are fine. template<typename _Tp1> __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r) : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) } template<typename _Tp1> explicit __shared_ptr(const __weak_ptr<_Tp1, _Lp>& __r) : _M_refcount(__r._M_refcount) // may throw { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) // It is now safe to copy __r._M_ptr, as _M_refcount(__r._M_refcount) // did not throw. _M_ptr = __r._M_ptr; } #if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED // Postcondition: use_count() == 1 and __r.get() == 0 template<typename _Tp1> explicit __shared_ptr(std::auto_ptr<_Tp1>& __r) : _M_ptr(__r.get()), _M_refcount() { // TODO requries delete __r.release() well-formed __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) typedef int _IsComplete[sizeof(_Tp1)]; _Tp1* __tmp = __r.get(); _M_refcount = __shared_count<_Lp>(__r); __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp); } #endif template<typename _Tp1> __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, __static_cast_tag) : _M_ptr(static_cast<element_type*>(__r._M_ptr)), _M_refcount(__r._M_refcount) { } template<typename _Tp1> __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, __const_cast_tag) : _M_ptr(const_cast<element_type*>(__r._M_ptr)), _M_refcount(__r._M_refcount) { } template<typename _Tp1> __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, __dynamic_cast_tag) : _M_ptr(dynamic_cast<element_type*>(__r._M_ptr)), _M_refcount(__r._M_refcount) { if (_M_ptr == 0) // need to allocate new counter -- the cast failed _M_refcount = __shared_count<_Lp>(); } template<typename _Tp1> __shared_ptr& operator=(const __shared_ptr<_Tp1, _Lp>& __r) // never throws { _M_ptr = __r._M_ptr; _M_refcount = __r._M_refcount; // __shared_count::op= doesn't throw return *this; } #if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED template<typename _Tp1> __shared_ptr& operator=(std::auto_ptr<_Tp1>& __r) { __shared_ptr(__r).swap(*this); return *this; } #endif void reset() // never throws { __shared_ptr().swap(*this); } template<typename _Tp1> void reset(_Tp1* __p) // _Tp1 must be complete. { // Catch self-reset errors. _GLIBCXX_DEBUG_ASSERT(__p == 0 || __p != _M_ptr); __shared_ptr(__p).swap(*this); } template<typename _Tp1, typename _Deleter> void reset(_Tp1* __p, _Deleter __d) { __shared_ptr(__p, __d).swap(*this); } // Allow class instantiation when _Tp is [cv-qual] void. typename std::tr1::add_reference<_Tp>::type operator*() const // never throws { _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); return *_M_ptr; } _Tp* operator->() const // never throws { _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); return _M_ptr; } _Tp* get() const // never throws { return _M_ptr; } // Implicit conversion to "bool" private: typedef _Tp* __shared_ptr::*__unspecified_bool_type; public: operator __unspecified_bool_type() const // never throws { return _M_ptr == 0 ? 0 : &__shared_ptr::_M_ptr; } bool unique() const // never throws { return _M_refcount._M_unique(); } long use_count() const // never throws { return _M_refcount._M_get_use_count(); } void swap(__shared_ptr<_Tp, _Lp>& __other) // never throws { std::swap(_M_ptr, __other._M_ptr); _M_refcount._M_swap(__other._M_refcount); } private: void* _M_get_deleter(const std::type_info& __ti) const { return _M_refcount._M_get_deleter(__ti); } template<typename _Tp1, _Lock_policy _Lp1> bool _M_less(const __shared_ptr<_Tp1, _Lp1>& __rhs) const { return _M_refcount < __rhs._M_refcount; } template<typename _Tp1, _Lock_policy _Lp1> friend class __shared_ptr; template<typename _Tp1, _Lock_policy _Lp1> friend class __weak_ptr; template<typename _Del, typename _Tp1, _Lock_policy _Lp1> friend _Del* get_deleter(const __shared_ptr<_Tp1, _Lp1>&); // Friends injected into enclosing namespace and found by ADL: template<typename _Tp1> friend inline bool operator==(const __shared_ptr& __a, const __shared_ptr<_Tp1, _Lp>& __b) { return __a.get() == __b.get(); } template<typename _Tp1> friend inline bool operator!=(const __shared_ptr& __a, const __shared_ptr<_Tp1, _Lp>& __b) { return __a.get() != __b.get(); } template<typename _Tp1> friend inline bool operator<(const __shared_ptr& __a, const __shared_ptr<_Tp1, _Lp>& __b) { return __a._M_less(__b); } _Tp* _M_ptr; // Contained pointer. __shared_count<_Lp> _M_refcount; // Reference counter. }; // 2.2.3.8 shared_ptr specialized algorithms. template<typename _Tp, _Lock_policy _Lp> inline void swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>& __b) { __a.swap(__b); } // 2.2.3.9 shared_ptr casts /* The seemingly equivalent * shared_ptr<_Tp, _Lp>(static_cast<_Tp*>(__r.get())) * will eventually result in undefined behaviour, * attempting to delete the same object twice. */ template<typename _Tp, typename _Tp1, _Lock_policy _Lp> inline __shared_ptr<_Tp, _Lp> static_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r) { return __shared_ptr<_Tp, _Lp>(__r, __static_cast_tag()); } /* The seemingly equivalent * shared_ptr<_Tp, _Lp>(const_cast<_Tp*>(__r.get())) * will eventually result in undefined behaviour, * attempting to delete the same object twice. */ template<typename _Tp, typename _Tp1, _Lock_policy _Lp> inline __shared_ptr<_Tp, _Lp> const_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r) { return __shared_ptr<_Tp, _Lp>(__r, __const_cast_tag()); } /* The seemingly equivalent * shared_ptr<_Tp, _Lp>(dynamic_cast<_Tp*>(__r.get())) * will eventually result in undefined behaviour, * attempting to delete the same object twice. */ template<typename _Tp, typename _Tp1, _Lock_policy _Lp> inline __shared_ptr<_Tp, _Lp> dynamic_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r) { return __shared_ptr<_Tp, _Lp>(__r, __dynamic_cast_tag()); } // 2.2.3.7 shared_ptr I/O template<typename _Ch, typename _Tr, typename _Tp, _Lock_policy _Lp> std::basic_ostream<_Ch, _Tr>& operator<<(std::basic_ostream<_Ch, _Tr>& __os, const __shared_ptr<_Tp, _Lp>& __p) { __os << __p.get(); return __os; } // 2.2.3.10 shared_ptr get_deleter (experimental) template<typename _Del, typename _Tp, _Lock_policy _Lp> inline _Del* get_deleter(const __shared_ptr<_Tp, _Lp>& __p) { #ifdef __GXX_RTTI return static_cast<_Del*>(__p._M_get_deleter(typeid(_Del))); #else return 0; #endif } template<typename _Tp, _Lock_policy _Lp> class __weak_ptr { public: typedef _Tp element_type; __weak_ptr() : _M_ptr(0), _M_refcount() // never throws { } // Generated copy constructor, assignment, destructor are fine. // The "obvious" converting constructor implementation: // // template<typename _Tp1> // __weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r) // : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws // { } // // has a serious problem. // // __r._M_ptr may already have been invalidated. The _M_ptr(__r._M_ptr) // conversion may require access to *__r._M_ptr (virtual inheritance). // // It is not possible to avoid spurious access violations since // in multithreaded programs __r._M_ptr may be invalidated at any point. template<typename _Tp1> __weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r) : _M_refcount(__r._M_refcount) // never throws { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) _M_ptr = __r.lock().get(); } template<typename _Tp1> __weak_ptr(const __shared_ptr<_Tp1, _Lp>& __r) : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) } template<typename _Tp1> __weak_ptr& operator=(const __weak_ptr<_Tp1, _Lp>& __r) // never throws { _M_ptr = __r.lock().get(); _M_refcount = __r._M_refcount; return *this; } template<typename _Tp1> __weak_ptr& operator=(const __shared_ptr<_Tp1, _Lp>& __r) // never throws { _M_ptr = __r._M_ptr; _M_refcount = __r._M_refcount; return *this; } __shared_ptr<_Tp, _Lp> lock() const // never throws { #ifdef __GTHREADS // Optimization: avoid throw overhead. if (expired()) return __shared_ptr<element_type, _Lp>(); __try { return __shared_ptr<element_type, _Lp>(*this); } __catch(const bad_weak_ptr&) { // Q: How can we get here? // A: Another thread may have invalidated r after the // use_count test above. return __shared_ptr<element_type, _Lp>(); } #else // Optimization: avoid try/catch overhead when single threaded. return expired() ? __shared_ptr<element_type, _Lp>() : __shared_ptr<element_type, _Lp>(*this); #endif } // XXX MT long use_count() const // never throws { return _M_refcount._M_get_use_count(); } bool expired() const // never throws { return _M_refcount._M_get_use_count() == 0; } void reset() // never throws { __weak_ptr().swap(*this); } void swap(__weak_ptr& __s) // never throws { std::swap(_M_ptr, __s._M_ptr); _M_refcount._M_swap(__s._M_refcount); } private: // Used by __enable_shared_from_this. void _M_assign(_Tp* __ptr, const __shared_count<_Lp>& __refcount) { _M_ptr = __ptr; _M_refcount = __refcount; } template<typename _Tp1> bool _M_less(const __weak_ptr<_Tp1, _Lp>& __rhs) const { return _M_refcount < __rhs._M_refcount; } template<typename _Tp1, _Lock_policy _Lp1> friend class __shared_ptr; template<typename _Tp1, _Lock_policy _Lp1> friend class __weak_ptr; friend class __enable_shared_from_this<_Tp, _Lp>; friend class enable_shared_from_this<_Tp>; // Friend injected into namespace and found by ADL. template<typename _Tp1> friend inline bool operator<(const __weak_ptr& __lhs, const __weak_ptr<_Tp1, _Lp>& __rhs) { return __lhs._M_less(__rhs); } _Tp* _M_ptr; // Contained pointer. __weak_count<_Lp> _M_refcount; // Reference counter. }; // 2.2.4.7 weak_ptr specialized algorithms. template<typename _Tp, _Lock_policy _Lp> inline void swap(__weak_ptr<_Tp, _Lp>& __a, __weak_ptr<_Tp, _Lp>& __b) { __a.swap(__b); } template<typename _Tp, _Lock_policy _Lp> class __enable_shared_from_this { protected: __enable_shared_from_this() { } __enable_shared_from_this(const __enable_shared_from_this&) { } __enable_shared_from_this& operator=(const __enable_shared_from_this&) { return *this; } ~__enable_shared_from_this() { } public: __shared_ptr<_Tp, _Lp> shared_from_this() { return __shared_ptr<_Tp, _Lp>(this->_M_weak_this); } __shared_ptr<const _Tp, _Lp> shared_from_this() const { return __shared_ptr<const _Tp, _Lp>(this->_M_weak_this); } private: template<typename _Tp1> void _M_weak_assign(_Tp1* __p, const __shared_count<_Lp>& __n) const { _M_weak_this._M_assign(__p, __n); } template<typename _Tp1> friend void __enable_shared_from_this_helper(const __shared_count<_Lp>& __pn, const __enable_shared_from_this* __pe, const _Tp1* __px) { if (__pe != 0) __pe->_M_weak_assign(const_cast<_Tp1*>(__px), __pn); } mutable __weak_ptr<_Tp, _Lp> _M_weak_this; }; // The actual shared_ptr, with forwarding constructors and // assignment operators. template<typename _Tp> class shared_ptr : public __shared_ptr<_Tp> { public: shared_ptr() : __shared_ptr<_Tp>() { } template<typename _Tp1> explicit shared_ptr(_Tp1* __p) : __shared_ptr<_Tp>(__p) { } template<typename _Tp1, typename _Deleter> shared_ptr(_Tp1* __p, _Deleter __d) : __shared_ptr<_Tp>(__p, __d) { } template<typename _Tp1> shared_ptr(const shared_ptr<_Tp1>& __r) : __shared_ptr<_Tp>(__r) { } template<typename _Tp1> explicit shared_ptr(const weak_ptr<_Tp1>& __r) : __shared_ptr<_Tp>(__r) { } #if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED template<typename _Tp1> explicit shared_ptr(std::auto_ptr<_Tp1>& __r) : __shared_ptr<_Tp>(__r) { } #endif template<typename _Tp1> shared_ptr(const shared_ptr<_Tp1>& __r, __static_cast_tag) : __shared_ptr<_Tp>(__r, __static_cast_tag()) { } template<typename _Tp1> shared_ptr(const shared_ptr<_Tp1>& __r, __const_cast_tag) : __shared_ptr<_Tp>(__r, __const_cast_tag()) { } template<typename _Tp1> shared_ptr(const shared_ptr<_Tp1>& __r, __dynamic_cast_tag) : __shared_ptr<_Tp>(__r, __dynamic_cast_tag()) { } template<typename _Tp1> shared_ptr& operator=(const shared_ptr<_Tp1>& __r) // never throws { this->__shared_ptr<_Tp>::operator=(__r); return *this; } #if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED template<typename _Tp1> shared_ptr& operator=(std::auto_ptr<_Tp1>& __r) { this->__shared_ptr<_Tp>::operator=(__r); return *this; } #endif }; // 2.2.3.8 shared_ptr specialized algorithms. template<typename _Tp> inline void swap(__shared_ptr<_Tp>& __a, __shared_ptr<_Tp>& __b) { __a.swap(__b); } template<typename _Tp, typename _Tp1> inline shared_ptr<_Tp> static_pointer_cast(const shared_ptr<_Tp1>& __r) { return shared_ptr<_Tp>(__r, __static_cast_tag()); } template<typename _Tp, typename _Tp1> inline shared_ptr<_Tp> const_pointer_cast(const shared_ptr<_Tp1>& __r) { return shared_ptr<_Tp>(__r, __const_cast_tag()); } template<typename _Tp, typename _Tp1> inline shared_ptr<_Tp> dynamic_pointer_cast(const shared_ptr<_Tp1>& __r) { return shared_ptr<_Tp>(__r, __dynamic_cast_tag()); } // The actual weak_ptr, with forwarding constructors and // assignment operators. template<typename _Tp> class weak_ptr : public __weak_ptr<_Tp> { public: weak_ptr() : __weak_ptr<_Tp>() { } template<typename _Tp1> weak_ptr(const weak_ptr<_Tp1>& __r) : __weak_ptr<_Tp>(__r) { } template<typename _Tp1> weak_ptr(const shared_ptr<_Tp1>& __r) : __weak_ptr<_Tp>(__r) { } template<typename _Tp1> weak_ptr& operator=(const weak_ptr<_Tp1>& __r) // never throws { this->__weak_ptr<_Tp>::operator=(__r); return *this; } template<typename _Tp1> weak_ptr& operator=(const shared_ptr<_Tp1>& __r) // never throws { this->__weak_ptr<_Tp>::operator=(__r); return *this; } shared_ptr<_Tp> lock() const // never throws { #ifdef __GTHREADS if (this->expired()) return shared_ptr<_Tp>(); __try { return shared_ptr<_Tp>(*this); } __catch(const bad_weak_ptr&) { return shared_ptr<_Tp>(); } #else return this->expired() ? shared_ptr<_Tp>() : shared_ptr<_Tp>(*this); #endif } }; template<typename _Tp> class enable_shared_from_this { protected: enable_shared_from_this() { } enable_shared_from_this(const enable_shared_from_this&) { } enable_shared_from_this& operator=(const enable_shared_from_this&) { return *this; } ~enable_shared_from_this() { } public: shared_ptr<_Tp> shared_from_this() { return shared_ptr<_Tp>(this->_M_weak_this); } shared_ptr<const _Tp> shared_from_this() const { return shared_ptr<const _Tp>(this->_M_weak_this); } private: template<typename _Tp1> void _M_weak_assign(_Tp1* __p, const __shared_count<>& __n) const { _M_weak_this._M_assign(__p, __n); } template<typename _Tp1> friend void __enable_shared_from_this_helper(const __shared_count<>& __pn, const enable_shared_from_this* __pe, const _Tp1* __px) { if (__pe != 0) __pe->_M_weak_assign(const_cast<_Tp1*>(__px), __pn); } mutable weak_ptr<_Tp> _M_weak_this; }; _GLIBCXX_END_NAMESPACE_VERSION } } #endif // _TR1_SHARED_PTR_H ������������������������������������������������������������������������������������������������c++/4.8.2/tr1/wchar.h�������������������������������������������������������������������������������0000644�����������������00000002341�14763166027�0007564 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 wchar.h -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/wchar.h * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_WCHAR_H #define _GLIBCXX_TR1_WCHAR_H 1 #include <tr1/cwchar> #endif // _GLIBCXX_TR1_WCHAR_H �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/tgmath.h������������������������������������������������������������������������������0000644�����������������00000002347�14763166027�0007752 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 tgmath.h -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/tgmath.h * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_TGMATH_H #define _GLIBCXX_TR1_TGMATH_H 1 #include <tr1/ctgmath> #endif // _GLIBCXX_TR1_TGMATH_H �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/random��������������������������������������������������������������������������������0000644�����������������00000003065�14763166027�0007516 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// random number generation -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** * @file tr1/random * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_RANDOM #define _GLIBCXX_TR1_RANDOM 1 #pragma GCC system_header #include <cmath> #include <cstdio> #include <cstdlib> #include <string> #include <iosfwd> #include <limits> #include <ext/type_traits.h> #include <ext/numeric_traits.h> #include <bits/concept_check.h> #include <debug/debug.h> #include <tr1/type_traits> #include <tr1/cmath> #include <tr1/random.h> #include <tr1/random.tcc> #endif // _GLIBCXX_TR1_RANDOM ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/cstdarg�������������������������������������������������������������������������������0000644�����������������00000002336�14763166027�0007665 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 cstdarg -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/cstdarg * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_CSTDARG #define _GLIBCXX_TR1_CSTDARG 1 #include <cstdarg> #endif // _GLIBCXX_TR1_CSTDARG ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/cmath���������������������������������������������������������������������������������0000644�����������������00000111057�14763166027�0007333 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 cmath -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/cmath * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_CMATH #define _GLIBCXX_TR1_CMATH 1 #pragma GCC system_header #include <cmath> #ifdef _GLIBCXX_USE_C99_MATH_TR1 #undef acosh #undef acoshf #undef acoshl #undef asinh #undef asinhf #undef asinhl #undef atanh #undef atanhf #undef atanhl #undef cbrt #undef cbrtf #undef cbrtl #undef copysign #undef copysignf #undef copysignl #undef erf #undef erff #undef erfl #undef erfc #undef erfcf #undef erfcl #undef exp2 #undef exp2f #undef exp2l #undef expm1 #undef expm1f #undef expm1l #undef fdim #undef fdimf #undef fdiml #undef fma #undef fmaf #undef fmal #undef fmax #undef fmaxf #undef fmaxl #undef fmin #undef fminf #undef fminl #undef hypot #undef hypotf #undef hypotl #undef ilogb #undef ilogbf #undef ilogbl #undef lgamma #undef lgammaf #undef lgammal #undef llrint #undef llrintf #undef llrintl #undef llround #undef llroundf #undef llroundl #undef log1p #undef log1pf #undef log1pl #undef log2 #undef log2f #undef log2l #undef logb #undef logbf #undef logbl #undef lrint #undef lrintf #undef lrintl #undef lround #undef lroundf #undef lroundl #undef nan #undef nanf #undef nanl #undef nearbyint #undef nearbyintf #undef nearbyintl #undef nextafter #undef nextafterf #undef nextafterl #undef nexttoward #undef nexttowardf #undef nexttowardl #undef remainder #undef remainderf #undef remainderl #undef remquo #undef remquof #undef remquol #undef rint #undef rintf #undef rintl #undef round #undef roundf #undef roundl #undef scalbln #undef scalblnf #undef scalblnl #undef scalbn #undef scalbnf #undef scalbnl #undef tgamma #undef tgammaf #undef tgammal #undef trunc #undef truncf #undef truncl #endif namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { _GLIBCXX_BEGIN_NAMESPACE_VERSION #if _GLIBCXX_USE_C99_MATH_TR1 // types using ::double_t; using ::float_t; // functions using ::acosh; using ::acoshf; using ::acoshl; using ::asinh; using ::asinhf; using ::asinhl; using ::atanh; using ::atanhf; using ::atanhl; using ::cbrt; using ::cbrtf; using ::cbrtl; using ::copysign; using ::copysignf; using ::copysignl; using ::erf; using ::erff; using ::erfl; using ::erfc; using ::erfcf; using ::erfcl; using ::exp2; using ::exp2f; using ::exp2l; using ::expm1; using ::expm1f; using ::expm1l; using ::fdim; using ::fdimf; using ::fdiml; using ::fma; using ::fmaf; using ::fmal; using ::fmax; using ::fmaxf; using ::fmaxl; using ::fmin; using ::fminf; using ::fminl; using ::hypot; using ::hypotf; using ::hypotl; using ::ilogb; using ::ilogbf; using ::ilogbl; using ::lgamma; using ::lgammaf; using ::lgammal; using ::llrint; using ::llrintf; using ::llrintl; using ::llround; using ::llroundf; using ::llroundl; using ::log1p; using ::log1pf; using ::log1pl; using ::log2; using ::log2f; using ::log2l; using ::logb; using ::logbf; using ::logbl; using ::lrint; using ::lrintf; using ::lrintl; using ::lround; using ::lroundf; using ::lroundl; using ::nan; using ::nanf; using ::nanl; using ::nearbyint; using ::nearbyintf; using ::nearbyintl; using ::nextafter; using ::nextafterf; using ::nextafterl; using ::nexttoward; using ::nexttowardf; using ::nexttowardl; using ::remainder; using ::remainderf; using ::remainderl; using ::remquo; using ::remquof; using ::remquol; using ::rint; using ::rintf; using ::rintl; using ::round; using ::roundf; using ::roundl; using ::scalbln; using ::scalblnf; using ::scalblnl; using ::scalbn; using ::scalbnf; using ::scalbnl; using ::tgamma; using ::tgammaf; using ::tgammal; using ::trunc; using ::truncf; using ::truncl; #endif #if _GLIBCXX_USE_C99_MATH #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC /// Function template definitions [8.16.3]. template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type fpclassify(_Tp __f) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __type(__f)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isfinite(_Tp __f) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isfinite(__type(__f)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isinf(_Tp __f) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isinf(__type(__f)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isnan(_Tp __f) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isnan(__type(__f)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isnormal(_Tp __f) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isnormal(__type(__f)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type signbit(_Tp __f) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_signbit(__type(__f)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isgreater(_Tp __f1, _Tp __f2) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isgreater(__type(__f1), __type(__f2)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isgreaterequal(_Tp __f1, _Tp __f2) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isgreaterequal(__type(__f1), __type(__f2)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isless(_Tp __f1, _Tp __f2) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isless(__type(__f1), __type(__f2)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type islessequal(_Tp __f1, _Tp __f2) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_islessequal(__type(__f1), __type(__f2)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type islessgreater(_Tp __f1, _Tp __f2) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_islessgreater(__type(__f1), __type(__f2)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isunordered(_Tp __f1, _Tp __f2) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isunordered(__type(__f1), __type(__f2)); } #endif #endif #if _GLIBCXX_USE_C99_MATH_TR1 /// Additional overloads [8.16.4]. using std::acos; inline float acosh(float __x) { return __builtin_acoshf(__x); } inline long double acosh(long double __x) { return __builtin_acoshl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type acosh(_Tp __x) { return __builtin_acosh(__x); } using std::asin; inline float asinh(float __x) { return __builtin_asinhf(__x); } inline long double asinh(long double __x) { return __builtin_asinhl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type asinh(_Tp __x) { return __builtin_asinh(__x); } using std::atan; using std::atan2; inline float atanh(float __x) { return __builtin_atanhf(__x); } inline long double atanh(long double __x) { return __builtin_atanhl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type atanh(_Tp __x) { return __builtin_atanh(__x); } inline float cbrt(float __x) { return __builtin_cbrtf(__x); } inline long double cbrt(long double __x) { return __builtin_cbrtl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type cbrt(_Tp __x) { return __builtin_cbrt(__x); } using std::ceil; inline float copysign(float __x, float __y) { return __builtin_copysignf(__x, __y); } inline long double copysign(long double __x, long double __y) { return __builtin_copysignl(__x, __y); } template<typename _Tp, typename _Up> inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type copysign(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return copysign(__type(__x), __type(__y)); } using std::cos; using std::cosh; inline float erf(float __x) { return __builtin_erff(__x); } inline long double erf(long double __x) { return __builtin_erfl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type erf(_Tp __x) { return __builtin_erf(__x); } inline float erfc(float __x) { return __builtin_erfcf(__x); } inline long double erfc(long double __x) { return __builtin_erfcl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type erfc(_Tp __x) { return __builtin_erfc(__x); } using std::exp; inline float exp2(float __x) { return __builtin_exp2f(__x); } inline long double exp2(long double __x) { return __builtin_exp2l(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type exp2(_Tp __x) { return __builtin_exp2(__x); } inline float expm1(float __x) { return __builtin_expm1f(__x); } inline long double expm1(long double __x) { return __builtin_expm1l(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type expm1(_Tp __x) { return __builtin_expm1(__x); } // Note: we deal with fabs in a special way, because an using std::fabs // would bring in also the overloads for complex types, which in C++0x // mode have a different return type. // With __CORRECT_ISO_CPP_MATH_H_PROTO, math.h imports std::fabs in the // global namespace after the declarations of the float / double / long // double overloads but before the std::complex overloads. using ::fabs; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline float fabs(float __x) { return __builtin_fabsf(__x); } inline long double fabs(long double __x) { return __builtin_fabsl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type fabs(_Tp __x) { return __builtin_fabs(__x); } #endif inline float fdim(float __x, float __y) { return __builtin_fdimf(__x, __y); } inline long double fdim(long double __x, long double __y) { return __builtin_fdiml(__x, __y); } template<typename _Tp, typename _Up> inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type fdim(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return fdim(__type(__x), __type(__y)); } using std::floor; inline float fma(float __x, float __y, float __z) { return __builtin_fmaf(__x, __y, __z); } inline long double fma(long double __x, long double __y, long double __z) { return __builtin_fmal(__x, __y, __z); } template<typename _Tp, typename _Up, typename _Vp> inline typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type fma(_Tp __x, _Up __y, _Vp __z) { typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type; return fma(__type(__x), __type(__y), __type(__z)); } inline float fmax(float __x, float __y) { return __builtin_fmaxf(__x, __y); } inline long double fmax(long double __x, long double __y) { return __builtin_fmaxl(__x, __y); } template<typename _Tp, typename _Up> inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type fmax(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return fmax(__type(__x), __type(__y)); } inline float fmin(float __x, float __y) { return __builtin_fminf(__x, __y); } inline long double fmin(long double __x, long double __y) { return __builtin_fminl(__x, __y); } template<typename _Tp, typename _Up> inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type fmin(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return fmin(__type(__x), __type(__y)); } using std::fmod; using std::frexp; inline float hypot(float __x, float __y) { return __builtin_hypotf(__x, __y); } inline long double hypot(long double __x, long double __y) { return __builtin_hypotl(__x, __y); } template<typename _Tp, typename _Up> inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type hypot(_Tp __y, _Up __x) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return hypot(__type(__y), __type(__x)); } inline int ilogb(float __x) { return __builtin_ilogbf(__x); } inline int ilogb(long double __x) { return __builtin_ilogbl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, int>::__type ilogb(_Tp __x) { return __builtin_ilogb(__x); } using std::ldexp; inline float lgamma(float __x) { return __builtin_lgammaf(__x); } inline long double lgamma(long double __x) { return __builtin_lgammal(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type lgamma(_Tp __x) { return __builtin_lgamma(__x); } inline long long llrint(float __x) { return __builtin_llrintf(__x); } inline long long llrint(long double __x) { return __builtin_llrintl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, long long>::__type llrint(_Tp __x) { return __builtin_llrint(__x); } inline long long llround(float __x) { return __builtin_llroundf(__x); } inline long long llround(long double __x) { return __builtin_llroundl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, long long>::__type llround(_Tp __x) { return __builtin_llround(__x); } using std::log; using std::log10; inline float log1p(float __x) { return __builtin_log1pf(__x); } inline long double log1p(long double __x) { return __builtin_log1pl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type log1p(_Tp __x) { return __builtin_log1p(__x); } // DR 568. inline float log2(float __x) { return __builtin_log2f(__x); } inline long double log2(long double __x) { return __builtin_log2l(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type log2(_Tp __x) { return __builtin_log2(__x); } inline float logb(float __x) { return __builtin_logbf(__x); } inline long double logb(long double __x) { return __builtin_logbl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type logb(_Tp __x) { return __builtin_logb(__x); } inline long lrint(float __x) { return __builtin_lrintf(__x); } inline long lrint(long double __x) { return __builtin_lrintl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, long>::__type lrint(_Tp __x) { return __builtin_lrint(__x); } inline long lround(float __x) { return __builtin_lroundf(__x); } inline long lround(long double __x) { return __builtin_lroundl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, long>::__type lround(_Tp __x) { return __builtin_lround(__x); } inline float nearbyint(float __x) { return __builtin_nearbyintf(__x); } inline long double nearbyint(long double __x) { return __builtin_nearbyintl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type nearbyint(_Tp __x) { return __builtin_nearbyint(__x); } inline float nextafter(float __x, float __y) { return __builtin_nextafterf(__x, __y); } inline long double nextafter(long double __x, long double __y) { return __builtin_nextafterl(__x, __y); } template<typename _Tp, typename _Up> inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type nextafter(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return nextafter(__type(__x), __type(__y)); } inline float nexttoward(float __x, long double __y) { return __builtin_nexttowardf(__x, __y); } inline long double nexttoward(long double __x, long double __y) { return __builtin_nexttowardl(__x, __y); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type nexttoward(_Tp __x, long double __y) { return __builtin_nexttoward(__x, __y); } // DR 550. What should the return type of pow(float,int) be? // NB: C++0x and TR1 != C++03. // using std::pow; inline float remainder(float __x, float __y) { return __builtin_remainderf(__x, __y); } inline long double remainder(long double __x, long double __y) { return __builtin_remainderl(__x, __y); } template<typename _Tp, typename _Up> inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type remainder(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return remainder(__type(__x), __type(__y)); } inline float remquo(float __x, float __y, int* __pquo) { return __builtin_remquof(__x, __y, __pquo); } inline long double remquo(long double __x, long double __y, int* __pquo) { return __builtin_remquol(__x, __y, __pquo); } template<typename _Tp, typename _Up> inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type remquo(_Tp __x, _Up __y, int* __pquo) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return remquo(__type(__x), __type(__y), __pquo); } inline float rint(float __x) { return __builtin_rintf(__x); } inline long double rint(long double __x) { return __builtin_rintl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type rint(_Tp __x) { return __builtin_rint(__x); } inline float round(float __x) { return __builtin_roundf(__x); } inline long double round(long double __x) { return __builtin_roundl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type round(_Tp __x) { return __builtin_round(__x); } inline float scalbln(float __x, long __ex) { return __builtin_scalblnf(__x, __ex); } inline long double scalbln(long double __x, long __ex) { return __builtin_scalblnl(__x, __ex); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type scalbln(_Tp __x, long __ex) { return __builtin_scalbln(__x, __ex); } inline float scalbn(float __x, int __ex) { return __builtin_scalbnf(__x, __ex); } inline long double scalbn(long double __x, int __ex) { return __builtin_scalbnl(__x, __ex); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type scalbn(_Tp __x, int __ex) { return __builtin_scalbn(__x, __ex); } using std::sin; using std::sinh; using std::sqrt; using std::tan; using std::tanh; inline float tgamma(float __x) { return __builtin_tgammaf(__x); } inline long double tgamma(long double __x) { return __builtin_tgammal(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type tgamma(_Tp __x) { return __builtin_tgamma(__x); } inline float trunc(float __x) { return __builtin_truncf(__x); } inline long double trunc(long double __x) { return __builtin_truncl(__x); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type trunc(_Tp __x) { return __builtin_trunc(__x); } #endif _GLIBCXX_END_NAMESPACE_VERSION } } namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { _GLIBCXX_BEGIN_NAMESPACE_VERSION // DR 550. What should the return type of pow(float,int) be? // NB: C++0x and TR1 != C++03. inline double pow(double __x, double __y) { return std::pow(__x, __y); } inline float pow(float __x, float __y) { return std::pow(__x, __y); } inline long double pow(long double __x, long double __y) { return std::pow(__x, __y); } template<typename _Tp, typename _Up> inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type pow(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return std::pow(__type(__x), __type(__y)); } _GLIBCXX_END_NAMESPACE_VERSION } } #include <bits/stl_algobase.h> #include <limits> #include <tr1/type_traits> #include <tr1/gamma.tcc> #include <tr1/bessel_function.tcc> #include <tr1/beta_function.tcc> #include <tr1/ell_integral.tcc> #include <tr1/exp_integral.tcc> #include <tr1/hypergeometric.tcc> #include <tr1/legendre_function.tcc> #include <tr1/modified_bessel_func.tcc> #include <tr1/poly_hermite.tcc> #include <tr1/poly_laguerre.tcc> #include <tr1/riemann_zeta.tcc> namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup tr1_math_spec_func Mathematical Special Functions * @ingroup numerics * * A collection of advanced mathematical special functions. * @{ */ inline float assoc_laguerref(unsigned int __n, unsigned int __m, float __x) { return __detail::__assoc_laguerre<float>(__n, __m, __x); } inline long double assoc_laguerrel(unsigned int __n, unsigned int __m, long double __x) { return __detail::__assoc_laguerre<long double>(__n, __m, __x); } /// 5.2.1.1 Associated Laguerre polynomials. template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type assoc_laguerre(unsigned int __n, unsigned int __m, _Tp __x) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __detail::__assoc_laguerre<__type>(__n, __m, __x); } inline float assoc_legendref(unsigned int __l, unsigned int __m, float __x) { return __detail::__assoc_legendre_p<float>(__l, __m, __x); } inline long double assoc_legendrel(unsigned int __l, unsigned int __m, long double __x) { return __detail::__assoc_legendre_p<long double>(__l, __m, __x); } /// 5.2.1.2 Associated Legendre functions. template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type assoc_legendre(unsigned int __l, unsigned int __m, _Tp __x) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __detail::__assoc_legendre_p<__type>(__l, __m, __x); } inline float betaf(float __x, float __y) { return __detail::__beta<float>(__x, __y); } inline long double betal(long double __x, long double __y) { return __detail::__beta<long double>(__x, __y); } /// 5.2.1.3 Beta functions. template<typename _Tpx, typename _Tpy> inline typename __gnu_cxx::__promote_2<_Tpx, _Tpy>::__type beta(_Tpx __x, _Tpy __y) { typedef typename __gnu_cxx::__promote_2<_Tpx, _Tpy>::__type __type; return __detail::__beta<__type>(__x, __y); } inline float comp_ellint_1f(float __k) { return __detail::__comp_ellint_1<float>(__k); } inline long double comp_ellint_1l(long double __k) { return __detail::__comp_ellint_1<long double>(__k); } /// 5.2.1.4 Complete elliptic integrals of the first kind. template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type comp_ellint_1(_Tp __k) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __detail::__comp_ellint_1<__type>(__k); } inline float comp_ellint_2f(float __k) { return __detail::__comp_ellint_2<float>(__k); } inline long double comp_ellint_2l(long double __k) { return __detail::__comp_ellint_2<long double>(__k); } /// 5.2.1.5 Complete elliptic integrals of the second kind. template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type comp_ellint_2(_Tp __k) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __detail::__comp_ellint_2<__type>(__k); } inline float comp_ellint_3f(float __k, float __nu) { return __detail::__comp_ellint_3<float>(__k, __nu); } inline long double comp_ellint_3l(long double __k, long double __nu) { return __detail::__comp_ellint_3<long double>(__k, __nu); } /// 5.2.1.6 Complete elliptic integrals of the third kind. template<typename _Tp, typename _Tpn> inline typename __gnu_cxx::__promote_2<_Tp, _Tpn>::__type comp_ellint_3(_Tp __k, _Tpn __nu) { typedef typename __gnu_cxx::__promote_2<_Tp, _Tpn>::__type __type; return __detail::__comp_ellint_3<__type>(__k, __nu); } inline float conf_hypergf(float __a, float __c, float __x) { return __detail::__conf_hyperg<float>(__a, __c, __x); } inline long double conf_hypergl(long double __a, long double __c, long double __x) { return __detail::__conf_hyperg<long double>(__a, __c, __x); } /// 5.2.1.7 Confluent hypergeometric functions. template<typename _Tpa, typename _Tpc, typename _Tp> inline typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type conf_hyperg(_Tpa __a, _Tpc __c, _Tp __x) { typedef typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type __type; return __detail::__conf_hyperg<__type>(__a, __c, __x); } inline float cyl_bessel_if(float __nu, float __x) { return __detail::__cyl_bessel_i<float>(__nu, __x); } inline long double cyl_bessel_il(long double __nu, long double __x) { return __detail::__cyl_bessel_i<long double>(__nu, __x); } /// 5.2.1.8 Regular modified cylindrical Bessel functions. template<typename _Tpnu, typename _Tp> inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type cyl_bessel_i(_Tpnu __nu, _Tp __x) { typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type; return __detail::__cyl_bessel_i<__type>(__nu, __x); } inline float cyl_bessel_jf(float __nu, float __x) { return __detail::__cyl_bessel_j<float>(__nu, __x); } inline long double cyl_bessel_jl(long double __nu, long double __x) { return __detail::__cyl_bessel_j<long double>(__nu, __x); } /// 5.2.1.9 Cylindrical Bessel functions (of the first kind). template<typename _Tpnu, typename _Tp> inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type cyl_bessel_j(_Tpnu __nu, _Tp __x) { typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type; return __detail::__cyl_bessel_j<__type>(__nu, __x); } inline float cyl_bessel_kf(float __nu, float __x) { return __detail::__cyl_bessel_k<float>(__nu, __x); } inline long double cyl_bessel_kl(long double __nu, long double __x) { return __detail::__cyl_bessel_k<long double>(__nu, __x); } /// 5.2.1.10 Irregular modified cylindrical Bessel functions. template<typename _Tpnu, typename _Tp> inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type cyl_bessel_k(_Tpnu __nu, _Tp __x) { typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type; return __detail::__cyl_bessel_k<__type>(__nu, __x); } inline float cyl_neumannf(float __nu, float __x) { return __detail::__cyl_neumann_n<float>(__nu, __x); } inline long double cyl_neumannl(long double __nu, long double __x) { return __detail::__cyl_neumann_n<long double>(__nu, __x); } /// 5.2.1.11 Cylindrical Neumann functions. template<typename _Tpnu, typename _Tp> inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type cyl_neumann(_Tpnu __nu, _Tp __x) { typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type; return __detail::__cyl_neumann_n<__type>(__nu, __x); } inline float ellint_1f(float __k, float __phi) { return __detail::__ellint_1<float>(__k, __phi); } inline long double ellint_1l(long double __k, long double __phi) { return __detail::__ellint_1<long double>(__k, __phi); } /// 5.2.1.12 Incomplete elliptic integrals of the first kind. template<typename _Tp, typename _Tpp> inline typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type ellint_1(_Tp __k, _Tpp __phi) { typedef typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type __type; return __detail::__ellint_1<__type>(__k, __phi); } inline float ellint_2f(float __k, float __phi) { return __detail::__ellint_2<float>(__k, __phi); } inline long double ellint_2l(long double __k, long double __phi) { return __detail::__ellint_2<long double>(__k, __phi); } /// 5.2.1.13 Incomplete elliptic integrals of the second kind. template<typename _Tp, typename _Tpp> inline typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type ellint_2(_Tp __k, _Tpp __phi) { typedef typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type __type; return __detail::__ellint_2<__type>(__k, __phi); } inline float ellint_3f(float __k, float __nu, float __phi) { return __detail::__ellint_3<float>(__k, __nu, __phi); } inline long double ellint_3l(long double __k, long double __nu, long double __phi) { return __detail::__ellint_3<long double>(__k, __nu, __phi); } /// 5.2.1.14 Incomplete elliptic integrals of the third kind. template<typename _Tp, typename _Tpn, typename _Tpp> inline typename __gnu_cxx::__promote_3<_Tp, _Tpn, _Tpp>::__type ellint_3(_Tp __k, _Tpn __nu, _Tpp __phi) { typedef typename __gnu_cxx::__promote_3<_Tp, _Tpn, _Tpp>::__type __type; return __detail::__ellint_3<__type>(__k, __nu, __phi); } inline float expintf(float __x) { return __detail::__expint<float>(__x); } inline long double expintl(long double __x) { return __detail::__expint<long double>(__x); } /// 5.2.1.15 Exponential integrals. template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type expint(_Tp __x) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __detail::__expint<__type>(__x); } inline float hermitef(unsigned int __n, float __x) { return __detail::__poly_hermite<float>(__n, __x); } inline long double hermitel(unsigned int __n, long double __x) { return __detail::__poly_hermite<long double>(__n, __x); } /// 5.2.1.16 Hermite polynomials. template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type hermite(unsigned int __n, _Tp __x) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __detail::__poly_hermite<__type>(__n, __x); } inline float hypergf(float __a, float __b, float __c, float __x) { return __detail::__hyperg<float>(__a, __b, __c, __x); } inline long double hypergl(long double __a, long double __b, long double __c, long double __x) { return __detail::__hyperg<long double>(__a, __b, __c, __x); } /// 5.2.1.17 Hypergeometric functions. template<typename _Tpa, typename _Tpb, typename _Tpc, typename _Tp> inline typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type hyperg(_Tpa __a, _Tpb __b, _Tpc __c, _Tp __x) { typedef typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type __type; return __detail::__hyperg<__type>(__a, __b, __c, __x); } inline float laguerref(unsigned int __n, float __x) { return __detail::__laguerre<float>(__n, __x); } inline long double laguerrel(unsigned int __n, long double __x) { return __detail::__laguerre<long double>(__n, __x); } /// 5.2.1.18 Laguerre polynomials. template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type laguerre(unsigned int __n, _Tp __x) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __detail::__laguerre<__type>(__n, __x); } inline float legendref(unsigned int __n, float __x) { return __detail::__poly_legendre_p<float>(__n, __x); } inline long double legendrel(unsigned int __n, long double __x) { return __detail::__poly_legendre_p<long double>(__n, __x); } /// 5.2.1.19 Legendre polynomials. template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type legendre(unsigned int __n, _Tp __x) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __detail::__poly_legendre_p<__type>(__n, __x); } inline float riemann_zetaf(float __x) { return __detail::__riemann_zeta<float>(__x); } inline long double riemann_zetal(long double __x) { return __detail::__riemann_zeta<long double>(__x); } /// 5.2.1.20 Riemann zeta function. template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type riemann_zeta(_Tp __x) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __detail::__riemann_zeta<__type>(__x); } inline float sph_besself(unsigned int __n, float __x) { return __detail::__sph_bessel<float>(__n, __x); } inline long double sph_bessell(unsigned int __n, long double __x) { return __detail::__sph_bessel<long double>(__n, __x); } /// 5.2.1.21 Spherical Bessel functions. template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type sph_bessel(unsigned int __n, _Tp __x) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __detail::__sph_bessel<__type>(__n, __x); } inline float sph_legendref(unsigned int __l, unsigned int __m, float __theta) { return __detail::__sph_legendre<float>(__l, __m, __theta); } inline long double sph_legendrel(unsigned int __l, unsigned int __m, long double __theta) { return __detail::__sph_legendre<long double>(__l, __m, __theta); } /// 5.2.1.22 Spherical associated Legendre functions. template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type sph_legendre(unsigned int __l, unsigned int __m, _Tp __theta) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __detail::__sph_legendre<__type>(__l, __m, __theta); } inline float sph_neumannf(unsigned int __n, float __x) { return __detail::__sph_neumann<float>(__n, __x); } inline long double sph_neumannl(unsigned int __n, long double __x) { return __detail::__sph_neumann<long double>(__n, __x); } /// 5.2.1.23 Spherical Neumann functions. template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type sph_neumann(unsigned int __n, _Tp __x) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __detail::__sph_neumann<__type>(__n, __x); } /* @} */ // tr1_math_spec_func _GLIBCXX_END_NAMESPACE_VERSION } } #endif // _GLIBCXX_TR1_CMATH ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/poly_hermite.tcc����������������������������������������������������������������������0000644�����������������00000007163�14763166027�0011511 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Special functions -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/poly_hermite.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{tr1/cmath} */ // // ISO C++ 14882 TR1: 5.2 Special functions // // Written by Edward Smith-Rowland based on: // (1) Handbook of Mathematical Functions, // Ed. Milton Abramowitz and Irene A. Stegun, // Dover Publications, Section 22 pp. 773-802 #ifndef _GLIBCXX_TR1_POLY_HERMITE_TCC #define _GLIBCXX_TR1_POLY_HERMITE_TCC 1 namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { // [5.2] Special functions // Implementation-space details. namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief This routine returns the Hermite polynomial * of order n: \f$ H_n(x) \f$ by recursion on n. * * The Hermite polynomial is defined by: * @f[ * H_n(x) = (-1)^n e^{x^2} \frac{d^n}{dx^n} e^{-x^2} * @f] * * @param __n The order of the Hermite polynomial. * @param __x The argument of the Hermite polynomial. * @return The value of the Hermite polynomial of order n * and argument x. */ template<typename _Tp> _Tp __poly_hermite_recursion(unsigned int __n, _Tp __x) { // Compute H_0. _Tp __H_0 = 1; if (__n == 0) return __H_0; // Compute H_1. _Tp __H_1 = 2 * __x; if (__n == 1) return __H_1; // Compute H_n. _Tp __H_n, __H_nm1, __H_nm2; unsigned int __i; for (__H_nm2 = __H_0, __H_nm1 = __H_1, __i = 2; __i <= __n; ++__i) { __H_n = 2 * (__x * __H_nm1 - (__i - 1) * __H_nm2); __H_nm2 = __H_nm1; __H_nm1 = __H_n; } return __H_n; } /** * @brief This routine returns the Hermite polynomial * of order n: \f$ H_n(x) \f$. * * The Hermite polynomial is defined by: * @f[ * H_n(x) = (-1)^n e^{x^2} \frac{d^n}{dx^n} e^{-x^2} * @f] * * @param __n The order of the Hermite polynomial. * @param __x The argument of the Hermite polynomial. * @return The value of the Hermite polynomial of order n * and argument x. */ template<typename _Tp> inline _Tp __poly_hermite(unsigned int __n, _Tp __x) { if (__isnan(__x)) return std::numeric_limits<_Tp>::quiet_NaN(); else return __poly_hermite_recursion(__n, __x); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std::tr1::__detail } } #endif // _GLIBCXX_TR1_POLY_HERMITE_TCC �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/hypergeometric.tcc��������������������������������������������������������������������0000644�����������������00000066103�14763166027�0012036 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Special functions -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/hypergeometric.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{tr1/cmath} */ // // ISO C++ 14882 TR1: 5.2 Special functions // // Written by Edward Smith-Rowland based: // (1) Handbook of Mathematical Functions, // ed. Milton Abramowitz and Irene A. Stegun, // Dover Publications, // Section 6, pp. 555-566 // (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl #ifndef _GLIBCXX_TR1_HYPERGEOMETRIC_TCC #define _GLIBCXX_TR1_HYPERGEOMETRIC_TCC 1 namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { // [5.2] Special functions // Implementation-space details. namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief This routine returns the confluent hypergeometric function * by series expansion. * * @f[ * _1F_1(a;c;x) = \frac{\Gamma(c)}{\Gamma(a)} * \sum_{n=0}^{\infty} * \frac{\Gamma(a+n)}{\Gamma(c+n)} * \frac{x^n}{n!} * @f] * * If a and b are integers and a < 0 and either b > 0 or b < a * then the series is a polynomial with a finite number of * terms. If b is an integer and b <= 0 the confluent * hypergeometric function is undefined. * * @param __a The "numerator" parameter. * @param __c The "denominator" parameter. * @param __x The argument of the confluent hypergeometric function. * @return The confluent hypergeometric function. */ template<typename _Tp> _Tp __conf_hyperg_series(_Tp __a, _Tp __c, _Tp __x) { const _Tp __eps = std::numeric_limits<_Tp>::epsilon(); _Tp __term = _Tp(1); _Tp __Fac = _Tp(1); const unsigned int __max_iter = 100000; unsigned int __i; for (__i = 0; __i < __max_iter; ++__i) { __term *= (__a + _Tp(__i)) * __x / ((__c + _Tp(__i)) * _Tp(1 + __i)); if (std::abs(__term) < __eps) { break; } __Fac += __term; } if (__i == __max_iter) std::__throw_runtime_error(__N("Series failed to converge " "in __conf_hyperg_series.")); return __Fac; } /** * @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$ * by an iterative procedure described in * Luke, Algorithms for the Computation of Mathematical Functions. * * Like the case of the 2F1 rational approximations, these are * probably guaranteed to converge for x < 0, barring gross * numerical instability in the pre-asymptotic regime. */ template<typename _Tp> _Tp __conf_hyperg_luke(_Tp __a, _Tp __c, _Tp __xin) { const _Tp __big = std::pow(std::numeric_limits<_Tp>::max(), _Tp(0.16L)); const int __nmax = 20000; const _Tp __eps = std::numeric_limits<_Tp>::epsilon(); const _Tp __x = -__xin; const _Tp __x3 = __x * __x * __x; const _Tp __t0 = __a / __c; const _Tp __t1 = (__a + _Tp(1)) / (_Tp(2) * __c); const _Tp __t2 = (__a + _Tp(2)) / (_Tp(2) * (__c + _Tp(1))); _Tp __F = _Tp(1); _Tp __prec; _Tp __Bnm3 = _Tp(1); _Tp __Bnm2 = _Tp(1) + __t1 * __x; _Tp __Bnm1 = _Tp(1) + __t2 * __x * (_Tp(1) + __t1 / _Tp(3) * __x); _Tp __Anm3 = _Tp(1); _Tp __Anm2 = __Bnm2 - __t0 * __x; _Tp __Anm1 = __Bnm1 - __t0 * (_Tp(1) + __t2 * __x) * __x + __t0 * __t1 * (__c / (__c + _Tp(1))) * __x * __x; int __n = 3; while(1) { _Tp __npam1 = _Tp(__n - 1) + __a; _Tp __npcm1 = _Tp(__n - 1) + __c; _Tp __npam2 = _Tp(__n - 2) + __a; _Tp __npcm2 = _Tp(__n - 2) + __c; _Tp __tnm1 = _Tp(2 * __n - 1); _Tp __tnm3 = _Tp(2 * __n - 3); _Tp __tnm5 = _Tp(2 * __n - 5); _Tp __F1 = (_Tp(__n - 2) - __a) / (_Tp(2) * __tnm3 * __npcm1); _Tp __F2 = (_Tp(__n) + __a) * __npam1 / (_Tp(4) * __tnm1 * __tnm3 * __npcm2 * __npcm1); _Tp __F3 = -__npam2 * __npam1 * (_Tp(__n - 2) - __a) / (_Tp(8) * __tnm3 * __tnm3 * __tnm5 * (_Tp(__n - 3) + __c) * __npcm2 * __npcm1); _Tp __E = -__npam1 * (_Tp(__n - 1) - __c) / (_Tp(2) * __tnm3 * __npcm2 * __npcm1); _Tp __An = (_Tp(1) + __F1 * __x) * __Anm1 + (__E + __F2 * __x) * __x * __Anm2 + __F3 * __x3 * __Anm3; _Tp __Bn = (_Tp(1) + __F1 * __x) * __Bnm1 + (__E + __F2 * __x) * __x * __Bnm2 + __F3 * __x3 * __Bnm3; _Tp __r = __An / __Bn; __prec = std::abs((__F - __r) / __F); __F = __r; if (__prec < __eps || __n > __nmax) break; if (std::abs(__An) > __big || std::abs(__Bn) > __big) { __An /= __big; __Bn /= __big; __Anm1 /= __big; __Bnm1 /= __big; __Anm2 /= __big; __Bnm2 /= __big; __Anm3 /= __big; __Bnm3 /= __big; } else if (std::abs(__An) < _Tp(1) / __big || std::abs(__Bn) < _Tp(1) / __big) { __An *= __big; __Bn *= __big; __Anm1 *= __big; __Bnm1 *= __big; __Anm2 *= __big; __Bnm2 *= __big; __Anm3 *= __big; __Bnm3 *= __big; } ++__n; __Bnm3 = __Bnm2; __Bnm2 = __Bnm1; __Bnm1 = __Bn; __Anm3 = __Anm2; __Anm2 = __Anm1; __Anm1 = __An; } if (__n >= __nmax) std::__throw_runtime_error(__N("Iteration failed to converge " "in __conf_hyperg_luke.")); return __F; } /** * @brief Return the confluent hypogeometric function * @f$ _1F_1(a;c;x) @f$. * * @todo Handle b == nonpositive integer blowup - return NaN. * * @param __a The @a numerator parameter. * @param __c The @a denominator parameter. * @param __x The argument of the confluent hypergeometric function. * @return The confluent hypergeometric function. */ template<typename _Tp> _Tp __conf_hyperg(_Tp __a, _Tp __c, _Tp __x) { #if _GLIBCXX_USE_C99_MATH_TR1 const _Tp __c_nint = std::tr1::nearbyint(__c); #else const _Tp __c_nint = static_cast<int>(__c + _Tp(0.5L)); #endif if (__isnan(__a) || __isnan(__c) || __isnan(__x)) return std::numeric_limits<_Tp>::quiet_NaN(); else if (__c_nint == __c && __c_nint <= 0) return std::numeric_limits<_Tp>::infinity(); else if (__a == _Tp(0)) return _Tp(1); else if (__c == __a) return std::exp(__x); else if (__x < _Tp(0)) return __conf_hyperg_luke(__a, __c, __x); else return __conf_hyperg_series(__a, __c, __x); } /** * @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$ * by series expansion. * * The hypogeometric function is defined by * @f[ * _2F_1(a,b;c;x) = \frac{\Gamma(c)}{\Gamma(a)\Gamma(b)} * \sum_{n=0}^{\infty} * \frac{\Gamma(a+n)\Gamma(b+n)}{\Gamma(c+n)} * \frac{x^n}{n!} * @f] * * This works and it's pretty fast. * * @param __a The first @a numerator parameter. * @param __a The second @a numerator parameter. * @param __c The @a denominator parameter. * @param __x The argument of the confluent hypergeometric function. * @return The confluent hypergeometric function. */ template<typename _Tp> _Tp __hyperg_series(_Tp __a, _Tp __b, _Tp __c, _Tp __x) { const _Tp __eps = std::numeric_limits<_Tp>::epsilon(); _Tp __term = _Tp(1); _Tp __Fabc = _Tp(1); const unsigned int __max_iter = 100000; unsigned int __i; for (__i = 0; __i < __max_iter; ++__i) { __term *= (__a + _Tp(__i)) * (__b + _Tp(__i)) * __x / ((__c + _Tp(__i)) * _Tp(1 + __i)); if (std::abs(__term) < __eps) { break; } __Fabc += __term; } if (__i == __max_iter) std::__throw_runtime_error(__N("Series failed to converge " "in __hyperg_series.")); return __Fabc; } /** * @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$ * by an iterative procedure described in * Luke, Algorithms for the Computation of Mathematical Functions. */ template<typename _Tp> _Tp __hyperg_luke(_Tp __a, _Tp __b, _Tp __c, _Tp __xin) { const _Tp __big = std::pow(std::numeric_limits<_Tp>::max(), _Tp(0.16L)); const int __nmax = 20000; const _Tp __eps = std::numeric_limits<_Tp>::epsilon(); const _Tp __x = -__xin; const _Tp __x3 = __x * __x * __x; const _Tp __t0 = __a * __b / __c; const _Tp __t1 = (__a + _Tp(1)) * (__b + _Tp(1)) / (_Tp(2) * __c); const _Tp __t2 = (__a + _Tp(2)) * (__b + _Tp(2)) / (_Tp(2) * (__c + _Tp(1))); _Tp __F = _Tp(1); _Tp __Bnm3 = _Tp(1); _Tp __Bnm2 = _Tp(1) + __t1 * __x; _Tp __Bnm1 = _Tp(1) + __t2 * __x * (_Tp(1) + __t1 / _Tp(3) * __x); _Tp __Anm3 = _Tp(1); _Tp __Anm2 = __Bnm2 - __t0 * __x; _Tp __Anm1 = __Bnm1 - __t0 * (_Tp(1) + __t2 * __x) * __x + __t0 * __t1 * (__c / (__c + _Tp(1))) * __x * __x; int __n = 3; while (1) { const _Tp __npam1 = _Tp(__n - 1) + __a; const _Tp __npbm1 = _Tp(__n - 1) + __b; const _Tp __npcm1 = _Tp(__n - 1) + __c; const _Tp __npam2 = _Tp(__n - 2) + __a; const _Tp __npbm2 = _Tp(__n - 2) + __b; const _Tp __npcm2 = _Tp(__n - 2) + __c; const _Tp __tnm1 = _Tp(2 * __n - 1); const _Tp __tnm3 = _Tp(2 * __n - 3); const _Tp __tnm5 = _Tp(2 * __n - 5); const _Tp __n2 = __n * __n; const _Tp __F1 = (_Tp(3) * __n2 + (__a + __b - _Tp(6)) * __n + _Tp(2) - __a * __b - _Tp(2) * (__a + __b)) / (_Tp(2) * __tnm3 * __npcm1); const _Tp __F2 = -(_Tp(3) * __n2 - (__a + __b + _Tp(6)) * __n + _Tp(2) - __a * __b) * __npam1 * __npbm1 / (_Tp(4) * __tnm1 * __tnm3 * __npcm2 * __npcm1); const _Tp __F3 = (__npam2 * __npam1 * __npbm2 * __npbm1 * (_Tp(__n - 2) - __a) * (_Tp(__n - 2) - __b)) / (_Tp(8) * __tnm3 * __tnm3 * __tnm5 * (_Tp(__n - 3) + __c) * __npcm2 * __npcm1); const _Tp __E = -__npam1 * __npbm1 * (_Tp(__n - 1) - __c) / (_Tp(2) * __tnm3 * __npcm2 * __npcm1); _Tp __An = (_Tp(1) + __F1 * __x) * __Anm1 + (__E + __F2 * __x) * __x * __Anm2 + __F3 * __x3 * __Anm3; _Tp __Bn = (_Tp(1) + __F1 * __x) * __Bnm1 + (__E + __F2 * __x) * __x * __Bnm2 + __F3 * __x3 * __Bnm3; const _Tp __r = __An / __Bn; const _Tp __prec = std::abs((__F - __r) / __F); __F = __r; if (__prec < __eps || __n > __nmax) break; if (std::abs(__An) > __big || std::abs(__Bn) > __big) { __An /= __big; __Bn /= __big; __Anm1 /= __big; __Bnm1 /= __big; __Anm2 /= __big; __Bnm2 /= __big; __Anm3 /= __big; __Bnm3 /= __big; } else if (std::abs(__An) < _Tp(1) / __big || std::abs(__Bn) < _Tp(1) / __big) { __An *= __big; __Bn *= __big; __Anm1 *= __big; __Bnm1 *= __big; __Anm2 *= __big; __Bnm2 *= __big; __Anm3 *= __big; __Bnm3 *= __big; } ++__n; __Bnm3 = __Bnm2; __Bnm2 = __Bnm1; __Bnm1 = __Bn; __Anm3 = __Anm2; __Anm2 = __Anm1; __Anm1 = __An; } if (__n >= __nmax) std::__throw_runtime_error(__N("Iteration failed to converge " "in __hyperg_luke.")); return __F; } /** * @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$ * by the reflection formulae in Abramowitz & Stegun formula * 15.3.6 for d = c - a - b not integral and formula 15.3.11 for * d = c - a - b integral. This assumes a, b, c != negative * integer. * * The hypogeometric function is defined by * @f[ * _2F_1(a,b;c;x) = \frac{\Gamma(c)}{\Gamma(a)\Gamma(b)} * \sum_{n=0}^{\infty} * \frac{\Gamma(a+n)\Gamma(b+n)}{\Gamma(c+n)} * \frac{x^n}{n!} * @f] * * The reflection formula for nonintegral @f$ d = c - a - b @f$ is: * @f[ * _2F_1(a,b;c;x) = \frac{\Gamma(c)\Gamma(d)}{\Gamma(c-a)\Gamma(c-b)} * _2F_1(a,b;1-d;1-x) * + \frac{\Gamma(c)\Gamma(-d)}{\Gamma(a)\Gamma(b)} * _2F_1(c-a,c-b;1+d;1-x) * @f] * * The reflection formula for integral @f$ m = c - a - b @f$ is: * @f[ * _2F_1(a,b;a+b+m;x) = \frac{\Gamma(m)\Gamma(a+b+m)}{\Gamma(a+m)\Gamma(b+m)} * \sum_{k=0}^{m-1} \frac{(m+a)_k(m+b)_k}{k!(1-m)_k} * - * @f] */ template<typename _Tp> _Tp __hyperg_reflect(_Tp __a, _Tp __b, _Tp __c, _Tp __x) { const _Tp __d = __c - __a - __b; const int __intd = std::floor(__d + _Tp(0.5L)); const _Tp __eps = std::numeric_limits<_Tp>::epsilon(); const _Tp __toler = _Tp(1000) * __eps; const _Tp __log_max = std::log(std::numeric_limits<_Tp>::max()); const bool __d_integer = (std::abs(__d - __intd) < __toler); if (__d_integer) { const _Tp __ln_omx = std::log(_Tp(1) - __x); const _Tp __ad = std::abs(__d); _Tp __F1, __F2; _Tp __d1, __d2; if (__d >= _Tp(0)) { __d1 = __d; __d2 = _Tp(0); } else { __d1 = _Tp(0); __d2 = __d; } const _Tp __lng_c = __log_gamma(__c); // Evaluate F1. if (__ad < __eps) { // d = c - a - b = 0. __F1 = _Tp(0); } else { bool __ok_d1 = true; _Tp __lng_ad, __lng_ad1, __lng_bd1; __try { __lng_ad = __log_gamma(__ad); __lng_ad1 = __log_gamma(__a + __d1); __lng_bd1 = __log_gamma(__b + __d1); } __catch(...) { __ok_d1 = false; } if (__ok_d1) { /* Gamma functions in the denominator are ok. * Proceed with evaluation. */ _Tp __sum1 = _Tp(1); _Tp __term = _Tp(1); _Tp __ln_pre1 = __lng_ad + __lng_c + __d2 * __ln_omx - __lng_ad1 - __lng_bd1; /* Do F1 sum. */ for (int __i = 1; __i < __ad; ++__i) { const int __j = __i - 1; __term *= (__a + __d2 + __j) * (__b + __d2 + __j) / (_Tp(1) + __d2 + __j) / __i * (_Tp(1) - __x); __sum1 += __term; } if (__ln_pre1 > __log_max) std::__throw_runtime_error(__N("Overflow of gamma functions" " in __hyperg_luke.")); else __F1 = std::exp(__ln_pre1) * __sum1; } else { // Gamma functions in the denominator were not ok. // So the F1 term is zero. __F1 = _Tp(0); } } // end F1 evaluation // Evaluate F2. bool __ok_d2 = true; _Tp __lng_ad2, __lng_bd2; __try { __lng_ad2 = __log_gamma(__a + __d2); __lng_bd2 = __log_gamma(__b + __d2); } __catch(...) { __ok_d2 = false; } if (__ok_d2) { // Gamma functions in the denominator are ok. // Proceed with evaluation. const int __maxiter = 2000; const _Tp __psi_1 = -__numeric_constants<_Tp>::__gamma_e(); const _Tp __psi_1pd = __psi(_Tp(1) + __ad); const _Tp __psi_apd1 = __psi(__a + __d1); const _Tp __psi_bpd1 = __psi(__b + __d1); _Tp __psi_term = __psi_1 + __psi_1pd - __psi_apd1 - __psi_bpd1 - __ln_omx; _Tp __fact = _Tp(1); _Tp __sum2 = __psi_term; _Tp __ln_pre2 = __lng_c + __d1 * __ln_omx - __lng_ad2 - __lng_bd2; // Do F2 sum. int __j; for (__j = 1; __j < __maxiter; ++__j) { // Values for psi functions use recurrence; // Abramowitz & Stegun 6.3.5 const _Tp __term1 = _Tp(1) / _Tp(__j) + _Tp(1) / (__ad + __j); const _Tp __term2 = _Tp(1) / (__a + __d1 + _Tp(__j - 1)) + _Tp(1) / (__b + __d1 + _Tp(__j - 1)); __psi_term += __term1 - __term2; __fact *= (__a + __d1 + _Tp(__j - 1)) * (__b + __d1 + _Tp(__j - 1)) / ((__ad + __j) * __j) * (_Tp(1) - __x); const _Tp __delta = __fact * __psi_term; __sum2 += __delta; if (std::abs(__delta) < __eps * std::abs(__sum2)) break; } if (__j == __maxiter) std::__throw_runtime_error(__N("Sum F2 failed to converge " "in __hyperg_reflect")); if (__sum2 == _Tp(0)) __F2 = _Tp(0); else __F2 = std::exp(__ln_pre2) * __sum2; } else { // Gamma functions in the denominator not ok. // So the F2 term is zero. __F2 = _Tp(0); } // end F2 evaluation const _Tp __sgn_2 = (__intd % 2 == 1 ? -_Tp(1) : _Tp(1)); const _Tp __F = __F1 + __sgn_2 * __F2; return __F; } else { // d = c - a - b not an integer. // These gamma functions appear in the denominator, so we // catch their harmless domain errors and set the terms to zero. bool __ok1 = true; _Tp __sgn_g1ca = _Tp(0), __ln_g1ca = _Tp(0); _Tp __sgn_g1cb = _Tp(0), __ln_g1cb = _Tp(0); __try { __sgn_g1ca = __log_gamma_sign(__c - __a); __ln_g1ca = __log_gamma(__c - __a); __sgn_g1cb = __log_gamma_sign(__c - __b); __ln_g1cb = __log_gamma(__c - __b); } __catch(...) { __ok1 = false; } bool __ok2 = true; _Tp __sgn_g2a = _Tp(0), __ln_g2a = _Tp(0); _Tp __sgn_g2b = _Tp(0), __ln_g2b = _Tp(0); __try { __sgn_g2a = __log_gamma_sign(__a); __ln_g2a = __log_gamma(__a); __sgn_g2b = __log_gamma_sign(__b); __ln_g2b = __log_gamma(__b); } __catch(...) { __ok2 = false; } const _Tp __sgn_gc = __log_gamma_sign(__c); const _Tp __ln_gc = __log_gamma(__c); const _Tp __sgn_gd = __log_gamma_sign(__d); const _Tp __ln_gd = __log_gamma(__d); const _Tp __sgn_gmd = __log_gamma_sign(-__d); const _Tp __ln_gmd = __log_gamma(-__d); const _Tp __sgn1 = __sgn_gc * __sgn_gd * __sgn_g1ca * __sgn_g1cb; const _Tp __sgn2 = __sgn_gc * __sgn_gmd * __sgn_g2a * __sgn_g2b; _Tp __pre1, __pre2; if (__ok1 && __ok2) { _Tp __ln_pre1 = __ln_gc + __ln_gd - __ln_g1ca - __ln_g1cb; _Tp __ln_pre2 = __ln_gc + __ln_gmd - __ln_g2a - __ln_g2b + __d * std::log(_Tp(1) - __x); if (__ln_pre1 < __log_max && __ln_pre2 < __log_max) { __pre1 = std::exp(__ln_pre1); __pre2 = std::exp(__ln_pre2); __pre1 *= __sgn1; __pre2 *= __sgn2; } else { std::__throw_runtime_error(__N("Overflow of gamma functions " "in __hyperg_reflect")); } } else if (__ok1 && !__ok2) { _Tp __ln_pre1 = __ln_gc + __ln_gd - __ln_g1ca - __ln_g1cb; if (__ln_pre1 < __log_max) { __pre1 = std::exp(__ln_pre1); __pre1 *= __sgn1; __pre2 = _Tp(0); } else { std::__throw_runtime_error(__N("Overflow of gamma functions " "in __hyperg_reflect")); } } else if (!__ok1 && __ok2) { _Tp __ln_pre2 = __ln_gc + __ln_gmd - __ln_g2a - __ln_g2b + __d * std::log(_Tp(1) - __x); if (__ln_pre2 < __log_max) { __pre1 = _Tp(0); __pre2 = std::exp(__ln_pre2); __pre2 *= __sgn2; } else { std::__throw_runtime_error(__N("Overflow of gamma functions " "in __hyperg_reflect")); } } else { __pre1 = _Tp(0); __pre2 = _Tp(0); std::__throw_runtime_error(__N("Underflow of gamma functions " "in __hyperg_reflect")); } const _Tp __F1 = __hyperg_series(__a, __b, _Tp(1) - __d, _Tp(1) - __x); const _Tp __F2 = __hyperg_series(__c - __a, __c - __b, _Tp(1) + __d, _Tp(1) - __x); const _Tp __F = __pre1 * __F1 + __pre2 * __F2; return __F; } } /** * @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$. * * The hypogeometric function is defined by * @f[ * _2F_1(a,b;c;x) = \frac{\Gamma(c)}{\Gamma(a)\Gamma(b)} * \sum_{n=0}^{\infty} * \frac{\Gamma(a+n)\Gamma(b+n)}{\Gamma(c+n)} * \frac{x^n}{n!} * @f] * * @param __a The first @a numerator parameter. * @param __a The second @a numerator parameter. * @param __c The @a denominator parameter. * @param __x The argument of the confluent hypergeometric function. * @return The confluent hypergeometric function. */ template<typename _Tp> _Tp __hyperg(_Tp __a, _Tp __b, _Tp __c, _Tp __x) { #if _GLIBCXX_USE_C99_MATH_TR1 const _Tp __a_nint = std::tr1::nearbyint(__a); const _Tp __b_nint = std::tr1::nearbyint(__b); const _Tp __c_nint = std::tr1::nearbyint(__c); #else const _Tp __a_nint = static_cast<int>(__a + _Tp(0.5L)); const _Tp __b_nint = static_cast<int>(__b + _Tp(0.5L)); const _Tp __c_nint = static_cast<int>(__c + _Tp(0.5L)); #endif const _Tp __toler = _Tp(1000) * std::numeric_limits<_Tp>::epsilon(); if (std::abs(__x) >= _Tp(1)) std::__throw_domain_error(__N("Argument outside unit circle " "in __hyperg.")); else if (__isnan(__a) || __isnan(__b) || __isnan(__c) || __isnan(__x)) return std::numeric_limits<_Tp>::quiet_NaN(); else if (__c_nint == __c && __c_nint <= _Tp(0)) return std::numeric_limits<_Tp>::infinity(); else if (std::abs(__c - __b) < __toler || std::abs(__c - __a) < __toler) return std::pow(_Tp(1) - __x, __c - __a - __b); else if (__a >= _Tp(0) && __b >= _Tp(0) && __c >= _Tp(0) && __x >= _Tp(0) && __x < _Tp(0.995L)) return __hyperg_series(__a, __b, __c, __x); else if (std::abs(__a) < _Tp(10) && std::abs(__b) < _Tp(10)) { // For integer a and b the hypergeometric function is a // finite polynomial. if (__a < _Tp(0) && std::abs(__a - __a_nint) < __toler) return __hyperg_series(__a_nint, __b, __c, __x); else if (__b < _Tp(0) && std::abs(__b - __b_nint) < __toler) return __hyperg_series(__a, __b_nint, __c, __x); else if (__x < -_Tp(0.25L)) return __hyperg_luke(__a, __b, __c, __x); else if (__x < _Tp(0.5L)) return __hyperg_series(__a, __b, __c, __x); else if (std::abs(__c) > _Tp(10)) return __hyperg_series(__a, __b, __c, __x); else return __hyperg_reflect(__a, __b, __c, __x); } else return __hyperg_luke(__a, __b, __c, __x); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std::tr1::__detail } } #endif // _GLIBCXX_TR1_HYPERGEOMETRIC_TCC �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/unordered_map.h�����������������������������������������������������������������������0000644�����������������00000023750�14763166027�0011313 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 unordered_map implementation -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/unordered_map.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{tr1/unordered_map} */ namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { _GLIBCXX_BEGIN_NAMESPACE_VERSION // NB: When we get typedef templates these class definitions // will be unnecessary. template<class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = std::equal_to<_Key>, class _Alloc = std::allocator<std::pair<const _Key, _Tp> >, bool __cache_hash_code = false> class __unordered_map : public _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc, std::_Select1st<std::pair<const _Key, _Tp> >, _Pred, _Hash, __detail::_Mod_range_hashing, __detail::_Default_ranged_hash, __detail::_Prime_rehash_policy, __cache_hash_code, false, true> { typedef _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc, std::_Select1st<std::pair<const _Key, _Tp> >, _Pred, _Hash, __detail::_Mod_range_hashing, __detail::_Default_ranged_hash, __detail::_Prime_rehash_policy, __cache_hash_code, false, true> _Base; public: typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; typedef typename _Base::allocator_type allocator_type; explicit __unordered_map(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __detail::_Mod_range_hashing(), __detail::_Default_ranged_hash(), __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a) { } template<typename _InputIterator> __unordered_map(_InputIterator __f, _InputIterator __l, size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(), __detail::_Default_ranged_hash(), __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a) { } }; template<class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = std::equal_to<_Key>, class _Alloc = std::allocator<std::pair<const _Key, _Tp> >, bool __cache_hash_code = false> class __unordered_multimap : public _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc, std::_Select1st<std::pair<const _Key, _Tp> >, _Pred, _Hash, __detail::_Mod_range_hashing, __detail::_Default_ranged_hash, __detail::_Prime_rehash_policy, __cache_hash_code, false, false> { typedef _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc, std::_Select1st<std::pair<const _Key, _Tp> >, _Pred, _Hash, __detail::_Mod_range_hashing, __detail::_Default_ranged_hash, __detail::_Prime_rehash_policy, __cache_hash_code, false, false> _Base; public: typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; typedef typename _Base::allocator_type allocator_type; explicit __unordered_multimap(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __detail::_Mod_range_hashing(), __detail::_Default_ranged_hash(), __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a) { } template<typename _InputIterator> __unordered_multimap(_InputIterator __f, _InputIterator __l, typename _Base::size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(), __detail::_Default_ranged_hash(), __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a) { } }; template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc, bool __cache_hash_code> inline void swap(__unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc, __cache_hash_code>& __x, __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc, __cache_hash_code>& __y) { __x.swap(__y); } template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc, bool __cache_hash_code> inline void swap(__unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc, __cache_hash_code>& __x, __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc, __cache_hash_code>& __y) { __x.swap(__y); } /** * @brief A standard container composed of unique keys (containing * at most one of each key value) that associates values of another type * with the keys. * * @ingroup unordered_associative_containers * * Meets the requirements of a <a href="tables.html#65">container</a>, and * <a href="tables.html#xx">unordered associative container</a> * * @param Key Type of key objects. * @param Tp Type of mapped objects. * @param Hash Hashing function object type, defaults to hash<Value>. * @param Pred Predicate function object type, defaults to equal_to<Value>. * @param Alloc Allocator type, defaults to allocator<Key>. * * The resulting value type of the container is std::pair<const Key, Tp>. */ template<class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = std::equal_to<_Key>, class _Alloc = std::allocator<std::pair<const _Key, _Tp> > > class unordered_map : public __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc> { typedef __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc> _Base; public: typedef typename _Base::value_type value_type; typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; typedef typename _Base::allocator_type allocator_type; explicit unordered_map(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) { } template<typename _InputIterator> unordered_map(_InputIterator __f, _InputIterator __l, size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __eql, __a) { } }; /** * @brief A standard container composed of equivalent keys * (possibly containing multiple of each key value) that associates * values of another type with the keys. * * @ingroup unordered_associative_containers * * Meets the requirements of a <a href="tables.html#65">container</a>, and * <a href="tables.html#xx">unordered associative container</a> * * @param Key Type of key objects. * @param Tp Type of mapped objects. * @param Hash Hashing function object type, defaults to hash<Value>. * @param Pred Predicate function object type, defaults to equal_to<Value>. * @param Alloc Allocator type, defaults to allocator<Key>. * * The resulting value type of the container is std::pair<const Key, Tp>. */ template<class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = std::equal_to<_Key>, class _Alloc = std::allocator<std::pair<const _Key, _Tp> > > class unordered_multimap : public __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc> { typedef __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc> _Base; public: typedef typename _Base::value_type value_type; typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; typedef typename _Base::allocator_type allocator_type; explicit unordered_multimap(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) { } template<typename _InputIterator> unordered_multimap(_InputIterator __f, _InputIterator __l, typename _Base::size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __eql, __a) { } }; template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline void swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { __x.swap(__y); } template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline void swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { __x.swap(__y); } _GLIBCXX_END_NAMESPACE_VERSION } } ������������������������c++/4.8.2/tr1/cstdint�������������������������������������������������������������������������������0000644�����������������00000005077�14763166027�0007713 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 cstdint -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/cstdint * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_CSTDINT #define _GLIBCXX_TR1_CSTDINT 1 #pragma GCC system_header #include <bits/c++config.h> // For 8.22.1/1 (see C99, Notes 219, 220, 222) # if _GLIBCXX_HAVE_STDINT_H # ifndef __STDC_LIMIT_MACROS # define _UNDEF__STDC_LIMIT_MACROS # define __STDC_LIMIT_MACROS # endif # ifndef __STDC_CONSTANT_MACROS # define _UNDEF__STDC_CONSTANT_MACROS # define __STDC_CONSTANT_MACROS # endif # include <stdint.h> # ifdef _UNDEF__STDC_LIMIT_MACROS # undef __STDC_LIMIT_MACROS # undef _UNDEF__STDC_LIMIT_MACROS # endif # ifdef _UNDEF__STDC_CONSTANT_MACROS # undef __STDC_CONSTANT_MACROS # undef _UNDEF__STDC_CONSTANT_MACROS # endif # endif #ifdef _GLIBCXX_USE_C99_STDINT_TR1 namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { using ::int8_t; using ::int16_t; using ::int32_t; using ::int64_t; using ::int_fast8_t; using ::int_fast16_t; using ::int_fast32_t; using ::int_fast64_t; using ::int_least8_t; using ::int_least16_t; using ::int_least32_t; using ::int_least64_t; using ::intmax_t; using ::intptr_t; using ::uint8_t; using ::uint16_t; using ::uint32_t; using ::uint64_t; using ::uint_fast8_t; using ::uint_fast16_t; using ::uint_fast32_t; using ::uint_fast64_t; using ::uint_least8_t; using ::uint_least16_t; using ::uint_least32_t; using ::uint_least64_t; using ::uintmax_t; using ::uintptr_t; } } #endif // _GLIBCXX_USE_C99_STDINT_TR1 #endif // _GLIBCXX_TR1_CSTDINT �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/utility�������������������������������������������������������������������������������0000644�����������������00000006231�14763166027�0007737 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 utility -*- C++ -*- // Copyright (C) 2004-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/utility * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_UTILITY #define _GLIBCXX_TR1_UTILITY 1 #pragma GCC system_header #include <bits/c++config.h> #include <bits/stl_relops.h> #include <bits/stl_pair.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<class _Tp> class tuple_size; template<int _Int, class _Tp> class tuple_element; // Various functions which give std::pair a tuple-like interface. template<class _Tp1, class _Tp2> struct tuple_size<std::pair<_Tp1, _Tp2> > { static const int value = 2; }; template<class _Tp1, class _Tp2> const int tuple_size<std::pair<_Tp1, _Tp2> >::value; template<class _Tp1, class _Tp2> struct tuple_element<0, std::pair<_Tp1, _Tp2> > { typedef _Tp1 type; }; template<class _Tp1, class _Tp2> struct tuple_element<1, std::pair<_Tp1, _Tp2> > { typedef _Tp2 type; }; template<int _Int> struct __pair_get; template<> struct __pair_get<0> { template<typename _Tp1, typename _Tp2> static _Tp1& __get(std::pair<_Tp1, _Tp2>& __pair) { return __pair.first; } template<typename _Tp1, typename _Tp2> static const _Tp1& __const_get(const std::pair<_Tp1, _Tp2>& __pair) { return __pair.first; } }; template<> struct __pair_get<1> { template<typename _Tp1, typename _Tp2> static _Tp2& __get(std::pair<_Tp1, _Tp2>& __pair) { return __pair.second; } template<typename _Tp1, typename _Tp2> static const _Tp2& __const_get(const std::pair<_Tp1, _Tp2>& __pair) { return __pair.second; } }; template<int _Int, class _Tp1, class _Tp2> inline typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& get(std::pair<_Tp1, _Tp2>& __in) { return __pair_get<_Int>::__get(__in); } template<int _Int, class _Tp1, class _Tp2> inline const typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& get(const std::pair<_Tp1, _Tp2>& __in) { return __pair_get<_Int>::__const_get(__in); } _GLIBCXX_END_NAMESPACE_VERSION } } #endif // _GLIBCXX_TR1_UTILITY �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/exp_integral.tcc����������������������������������������������������������������������0000644�����������������00000036644�14763166027�0011500 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Special functions -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/exp_integral.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{tr1/cmath} */ // // ISO C++ 14882 TR1: 5.2 Special functions // // Written by Edward Smith-Rowland based on: // // (1) Handbook of Mathematical Functions, // Ed. by Milton Abramowitz and Irene A. Stegun, // Dover Publications, New-York, Section 5, pp. 228-251. // (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl // (3) Numerical Recipes in C, by W. H. Press, S. A. Teukolsky, // W. T. Vetterling, B. P. Flannery, Cambridge University Press (1992), // 2nd ed, pp. 222-225. // #ifndef _GLIBCXX_TR1_EXP_INTEGRAL_TCC #define _GLIBCXX_TR1_EXP_INTEGRAL_TCC 1 #include "special_function_util.h" namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { // [5.2] Special functions // Implementation-space details. namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Tp> _Tp __expint_E1(_Tp); /** * @brief Return the exponential integral @f$ E_1(x) @f$ * by series summation. This should be good * for @f$ x < 1 @f$. * * The exponential integral is given by * \f[ * E_1(x) = \int_{1}^{\infty} \frac{e^{-xt}}{t} dt * \f] * * @param __x The argument of the exponential integral function. * @return The exponential integral. */ template<typename _Tp> _Tp __expint_E1_series(_Tp __x) { const _Tp __eps = std::numeric_limits<_Tp>::epsilon(); _Tp __term = _Tp(1); _Tp __esum = _Tp(0); _Tp __osum = _Tp(0); const unsigned int __max_iter = 100; for (unsigned int __i = 1; __i < __max_iter; ++__i) { __term *= - __x / __i; if (std::abs(__term) < __eps) break; if (__term >= _Tp(0)) __esum += __term / __i; else __osum += __term / __i; } return - __esum - __osum - __numeric_constants<_Tp>::__gamma_e() - std::log(__x); } /** * @brief Return the exponential integral @f$ E_1(x) @f$ * by asymptotic expansion. * * The exponential integral is given by * \f[ * E_1(x) = \int_{1}^\infty \frac{e^{-xt}}{t} dt * \f] * * @param __x The argument of the exponential integral function. * @return The exponential integral. */ template<typename _Tp> _Tp __expint_E1_asymp(_Tp __x) { _Tp __term = _Tp(1); _Tp __esum = _Tp(1); _Tp __osum = _Tp(0); const unsigned int __max_iter = 1000; for (unsigned int __i = 1; __i < __max_iter; ++__i) { _Tp __prev = __term; __term *= - __i / __x; if (std::abs(__term) > std::abs(__prev)) break; if (__term >= _Tp(0)) __esum += __term; else __osum += __term; } return std::exp(- __x) * (__esum + __osum) / __x; } /** * @brief Return the exponential integral @f$ E_n(x) @f$ * by series summation. * * The exponential integral is given by * \f[ * E_n(x) = \int_{1}^\infty \frac{e^{-xt}}{t^n} dt * \f] * * @param __n The order of the exponential integral function. * @param __x The argument of the exponential integral function. * @return The exponential integral. */ template<typename _Tp> _Tp __expint_En_series(unsigned int __n, _Tp __x) { const unsigned int __max_iter = 100; const _Tp __eps = std::numeric_limits<_Tp>::epsilon(); const int __nm1 = __n - 1; _Tp __ans = (__nm1 != 0 ? _Tp(1) / __nm1 : -std::log(__x) - __numeric_constants<_Tp>::__gamma_e()); _Tp __fact = _Tp(1); for (int __i = 1; __i <= __max_iter; ++__i) { __fact *= -__x / _Tp(__i); _Tp __del; if ( __i != __nm1 ) __del = -__fact / _Tp(__i - __nm1); else { _Tp __psi = -__numeric_constants<_Tp>::gamma_e(); for (int __ii = 1; __ii <= __nm1; ++__ii) __psi += _Tp(1) / _Tp(__ii); __del = __fact * (__psi - std::log(__x)); } __ans += __del; if (std::abs(__del) < __eps * std::abs(__ans)) return __ans; } std::__throw_runtime_error(__N("Series summation failed " "in __expint_En_series.")); } /** * @brief Return the exponential integral @f$ E_n(x) @f$ * by continued fractions. * * The exponential integral is given by * \f[ * E_n(x) = \int_{1}^\infty \frac{e^{-xt}}{t^n} dt * \f] * * @param __n The order of the exponential integral function. * @param __x The argument of the exponential integral function. * @return The exponential integral. */ template<typename _Tp> _Tp __expint_En_cont_frac(unsigned int __n, _Tp __x) { const unsigned int __max_iter = 100; const _Tp __eps = std::numeric_limits<_Tp>::epsilon(); const _Tp __fp_min = std::numeric_limits<_Tp>::min(); const int __nm1 = __n - 1; _Tp __b = __x + _Tp(__n); _Tp __c = _Tp(1) / __fp_min; _Tp __d = _Tp(1) / __b; _Tp __h = __d; for ( unsigned int __i = 1; __i <= __max_iter; ++__i ) { _Tp __a = -_Tp(__i * (__nm1 + __i)); __b += _Tp(2); __d = _Tp(1) / (__a * __d + __b); __c = __b + __a / __c; const _Tp __del = __c * __d; __h *= __del; if (std::abs(__del - _Tp(1)) < __eps) { const _Tp __ans = __h * std::exp(-__x); return __ans; } } std::__throw_runtime_error(__N("Continued fraction failed " "in __expint_En_cont_frac.")); } /** * @brief Return the exponential integral @f$ E_n(x) @f$ * by recursion. Use upward recursion for @f$ x < n @f$ * and downward recursion (Miller's algorithm) otherwise. * * The exponential integral is given by * \f[ * E_n(x) = \int_{1}^\infty \frac{e^{-xt}}{t^n} dt * \f] * * @param __n The order of the exponential integral function. * @param __x The argument of the exponential integral function. * @return The exponential integral. */ template<typename _Tp> _Tp __expint_En_recursion(unsigned int __n, _Tp __x) { _Tp __En; _Tp __E1 = __expint_E1(__x); if (__x < _Tp(__n)) { // Forward recursion is stable only for n < x. __En = __E1; for (unsigned int __j = 2; __j < __n; ++__j) __En = (std::exp(-__x) - __x * __En) / _Tp(__j - 1); } else { // Backward recursion is stable only for n >= x. __En = _Tp(1); const int __N = __n + 20; // TODO: Check this starting number. _Tp __save = _Tp(0); for (int __j = __N; __j > 0; --__j) { __En = (std::exp(-__x) - __j * __En) / __x; if (__j == __n) __save = __En; } _Tp __norm = __En / __E1; __En /= __norm; } return __En; } /** * @brief Return the exponential integral @f$ Ei(x) @f$ * by series summation. * * The exponential integral is given by * \f[ * Ei(x) = -\int_{-x}^\infty \frac{e^t}{t} dt * \f] * * @param __x The argument of the exponential integral function. * @return The exponential integral. */ template<typename _Tp> _Tp __expint_Ei_series(_Tp __x) { _Tp __term = _Tp(1); _Tp __sum = _Tp(0); const unsigned int __max_iter = 1000; for (unsigned int __i = 1; __i < __max_iter; ++__i) { __term *= __x / __i; __sum += __term / __i; if (__term < std::numeric_limits<_Tp>::epsilon() * __sum) break; } return __numeric_constants<_Tp>::__gamma_e() + __sum + std::log(__x); } /** * @brief Return the exponential integral @f$ Ei(x) @f$ * by asymptotic expansion. * * The exponential integral is given by * \f[ * Ei(x) = -\int_{-x}^\infty \frac{e^t}{t} dt * \f] * * @param __x The argument of the exponential integral function. * @return The exponential integral. */ template<typename _Tp> _Tp __expint_Ei_asymp(_Tp __x) { _Tp __term = _Tp(1); _Tp __sum = _Tp(1); const unsigned int __max_iter = 1000; for (unsigned int __i = 1; __i < __max_iter; ++__i) { _Tp __prev = __term; __term *= __i / __x; if (__term < std::numeric_limits<_Tp>::epsilon()) break; if (__term >= __prev) break; __sum += __term; } return std::exp(__x) * __sum / __x; } /** * @brief Return the exponential integral @f$ Ei(x) @f$. * * The exponential integral is given by * \f[ * Ei(x) = -\int_{-x}^\infty \frac{e^t}{t} dt * \f] * * @param __x The argument of the exponential integral function. * @return The exponential integral. */ template<typename _Tp> _Tp __expint_Ei(_Tp __x) { if (__x < _Tp(0)) return -__expint_E1(-__x); else if (__x < -std::log(std::numeric_limits<_Tp>::epsilon())) return __expint_Ei_series(__x); else return __expint_Ei_asymp(__x); } /** * @brief Return the exponential integral @f$ E_1(x) @f$. * * The exponential integral is given by * \f[ * E_1(x) = \int_{1}^\infty \frac{e^{-xt}}{t} dt * \f] * * @param __x The argument of the exponential integral function. * @return The exponential integral. */ template<typename _Tp> _Tp __expint_E1(_Tp __x) { if (__x < _Tp(0)) return -__expint_Ei(-__x); else if (__x < _Tp(1)) return __expint_E1_series(__x); else if (__x < _Tp(100)) // TODO: Find a good asymptotic switch point. return __expint_En_cont_frac(1, __x); else return __expint_E1_asymp(__x); } /** * @brief Return the exponential integral @f$ E_n(x) @f$ * for large argument. * * The exponential integral is given by * \f[ * E_n(x) = \int_{1}^\infty \frac{e^{-xt}}{t^n} dt * \f] * * This is something of an extension. * * @param __n The order of the exponential integral function. * @param __x The argument of the exponential integral function. * @return The exponential integral. */ template<typename _Tp> _Tp __expint_asymp(unsigned int __n, _Tp __x) { _Tp __term = _Tp(1); _Tp __sum = _Tp(1); for (unsigned int __i = 1; __i <= __n; ++__i) { _Tp __prev = __term; __term *= -(__n - __i + 1) / __x; if (std::abs(__term) > std::abs(__prev)) break; __sum += __term; } return std::exp(-__x) * __sum / __x; } /** * @brief Return the exponential integral @f$ E_n(x) @f$ * for large order. * * The exponential integral is given by * \f[ * E_n(x) = \int_{1}^\infty \frac{e^{-xt}}{t^n} dt * \f] * * This is something of an extension. * * @param __n The order of the exponential integral function. * @param __x The argument of the exponential integral function. * @return The exponential integral. */ template<typename _Tp> _Tp __expint_large_n(unsigned int __n, _Tp __x) { const _Tp __xpn = __x + __n; const _Tp __xpn2 = __xpn * __xpn; _Tp __term = _Tp(1); _Tp __sum = _Tp(1); for (unsigned int __i = 1; __i <= __n; ++__i) { _Tp __prev = __term; __term *= (__n - 2 * (__i - 1) * __x) / __xpn2; if (std::abs(__term) < std::numeric_limits<_Tp>::epsilon()) break; __sum += __term; } return std::exp(-__x) * __sum / __xpn; } /** * @brief Return the exponential integral @f$ E_n(x) @f$. * * The exponential integral is given by * \f[ * E_n(x) = \int_{1}^\infty \frac{e^{-xt}}{t^n} dt * \f] * This is something of an extension. * * @param __n The order of the exponential integral function. * @param __x The argument of the exponential integral function. * @return The exponential integral. */ template<typename _Tp> _Tp __expint(unsigned int __n, _Tp __x) { // Return NaN on NaN input. if (__isnan(__x)) return std::numeric_limits<_Tp>::quiet_NaN(); else if (__n <= 1 && __x == _Tp(0)) return std::numeric_limits<_Tp>::infinity(); else { _Tp __E0 = std::exp(__x) / __x; if (__n == 0) return __E0; _Tp __E1 = __expint_E1(__x); if (__n == 1) return __E1; if (__x == _Tp(0)) return _Tp(1) / static_cast<_Tp>(__n - 1); _Tp __En = __expint_En_recursion(__n, __x); return __En; } } /** * @brief Return the exponential integral @f$ Ei(x) @f$. * * The exponential integral is given by * \f[ * Ei(x) = -\int_{-x}^\infty \frac{e^t}{t} dt * \f] * * @param __x The argument of the exponential integral function. * @return The exponential integral. */ template<typename _Tp> inline _Tp __expint(_Tp __x) { if (__isnan(__x)) return std::numeric_limits<_Tp>::quiet_NaN(); else return __expint_Ei(__x); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std::tr1::__detail } } #endif // _GLIBCXX_TR1_EXP_INTEGRAL_TCC ��������������������������������������������������������������������������������������������c++/4.8.2/tr1/riemann_zeta.tcc����������������������������������������������������������������������0000644�����������������00000032540�14763166027�0011462 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Special functions -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/riemann_zeta.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{tr1/cmath} */ // // ISO C++ 14882 TR1: 5.2 Special functions // // Written by Edward Smith-Rowland based on: // (1) Handbook of Mathematical Functions, // Ed. by Milton Abramowitz and Irene A. Stegun, // Dover Publications, New-York, Section 5, pp. 807-808. // (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl // (3) Gamma, Exploring Euler's Constant, Julian Havil, // Princeton, 2003. #ifndef _GLIBCXX_TR1_RIEMANN_ZETA_TCC #define _GLIBCXX_TR1_RIEMANN_ZETA_TCC 1 #include "special_function_util.h" namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { // [5.2] Special functions // Implementation-space details. namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Compute the Riemann zeta function @f$ \zeta(s) @f$ * by summation for s > 1. * * The Riemann zeta function is defined by: * \f[ * \zeta(s) = \sum_{k=1}^{\infty} \frac{1}{k^{s}} for s > 1 * \f] * For s < 1 use the reflection formula: * \f[ * \zeta(s) = 2^s \pi^{s-1} \Gamma(1-s) \zeta(1-s) * \f] */ template<typename _Tp> _Tp __riemann_zeta_sum(_Tp __s) { // A user shouldn't get to this. if (__s < _Tp(1)) std::__throw_domain_error(__N("Bad argument in zeta sum.")); const unsigned int max_iter = 10000; _Tp __zeta = _Tp(0); for (unsigned int __k = 1; __k < max_iter; ++__k) { _Tp __term = std::pow(static_cast<_Tp>(__k), -__s); if (__term < std::numeric_limits<_Tp>::epsilon()) { break; } __zeta += __term; } return __zeta; } /** * @brief Evaluate the Riemann zeta function @f$ \zeta(s) @f$ * by an alternate series for s > 0. * * The Riemann zeta function is defined by: * \f[ * \zeta(s) = \sum_{k=1}^{\infty} \frac{1}{k^{s}} for s > 1 * \f] * For s < 1 use the reflection formula: * \f[ * \zeta(s) = 2^s \pi^{s-1} \Gamma(1-s) \zeta(1-s) * \f] */ template<typename _Tp> _Tp __riemann_zeta_alt(_Tp __s) { _Tp __sgn = _Tp(1); _Tp __zeta = _Tp(0); for (unsigned int __i = 1; __i < 10000000; ++__i) { _Tp __term = __sgn / std::pow(__i, __s); if (std::abs(__term) < std::numeric_limits<_Tp>::epsilon()) break; __zeta += __term; __sgn *= _Tp(-1); } __zeta /= _Tp(1) - std::pow(_Tp(2), _Tp(1) - __s); return __zeta; } /** * @brief Evaluate the Riemann zeta function by series for all s != 1. * Convergence is great until largish negative numbers. * Then the convergence of the > 0 sum gets better. * * The series is: * \f[ * \zeta(s) = \frac{1}{1-2^{1-s}} * \sum_{n=0}^{\infty} \frac{1}{2^{n+1}} * \sum_{k=0}^{n} (-1)^k \frac{n!}{(n-k)!k!} (k+1)^{-s} * \f] * Havil 2003, p. 206. * * The Riemann zeta function is defined by: * \f[ * \zeta(s) = \sum_{k=1}^{\infty} \frac{1}{k^{s}} for s > 1 * \f] * For s < 1 use the reflection formula: * \f[ * \zeta(s) = 2^s \pi^{s-1} \Gamma(1-s) \zeta(1-s) * \f] */ template<typename _Tp> _Tp __riemann_zeta_glob(_Tp __s) { _Tp __zeta = _Tp(0); const _Tp __eps = std::numeric_limits<_Tp>::epsilon(); // Max e exponent before overflow. const _Tp __max_bincoeff = std::numeric_limits<_Tp>::max_exponent10 * std::log(_Tp(10)) - _Tp(1); // This series works until the binomial coefficient blows up // so use reflection. if (__s < _Tp(0)) { #if _GLIBCXX_USE_C99_MATH_TR1 if (std::tr1::fmod(__s,_Tp(2)) == _Tp(0)) return _Tp(0); else #endif { _Tp __zeta = __riemann_zeta_glob(_Tp(1) - __s); __zeta *= std::pow(_Tp(2) * __numeric_constants<_Tp>::__pi(), __s) * std::sin(__numeric_constants<_Tp>::__pi_2() * __s) #if _GLIBCXX_USE_C99_MATH_TR1 * std::exp(std::tr1::lgamma(_Tp(1) - __s)) #else * std::exp(__log_gamma(_Tp(1) - __s)) #endif / __numeric_constants<_Tp>::__pi(); return __zeta; } } _Tp __num = _Tp(0.5L); const unsigned int __maxit = 10000; for (unsigned int __i = 0; __i < __maxit; ++__i) { bool __punt = false; _Tp __sgn = _Tp(1); _Tp __term = _Tp(0); for (unsigned int __j = 0; __j <= __i; ++__j) { #if _GLIBCXX_USE_C99_MATH_TR1 _Tp __bincoeff = std::tr1::lgamma(_Tp(1 + __i)) - std::tr1::lgamma(_Tp(1 + __j)) - std::tr1::lgamma(_Tp(1 + __i - __j)); #else _Tp __bincoeff = __log_gamma(_Tp(1 + __i)) - __log_gamma(_Tp(1 + __j)) - __log_gamma(_Tp(1 + __i - __j)); #endif if (__bincoeff > __max_bincoeff) { // This only gets hit for x << 0. __punt = true; break; } __bincoeff = std::exp(__bincoeff); __term += __sgn * __bincoeff * std::pow(_Tp(1 + __j), -__s); __sgn *= _Tp(-1); } if (__punt) break; __term *= __num; __zeta += __term; if (std::abs(__term/__zeta) < __eps) break; __num *= _Tp(0.5L); } __zeta /= _Tp(1) - std::pow(_Tp(2), _Tp(1) - __s); return __zeta; } /** * @brief Compute the Riemann zeta function @f$ \zeta(s) @f$ * using the product over prime factors. * \f[ * \zeta(s) = \Pi_{i=1}^\infty \frac{1}{1 - p_i^{-s}} * \f] * where @f$ {p_i} @f$ are the prime numbers. * * The Riemann zeta function is defined by: * \f[ * \zeta(s) = \sum_{k=1}^{\infty} \frac{1}{k^{s}} for s > 1 * \f] * For s < 1 use the reflection formula: * \f[ * \zeta(s) = 2^s \pi^{s-1} \Gamma(1-s) \zeta(1-s) * \f] */ template<typename _Tp> _Tp __riemann_zeta_product(_Tp __s) { static const _Tp __prime[] = { _Tp(2), _Tp(3), _Tp(5), _Tp(7), _Tp(11), _Tp(13), _Tp(17), _Tp(19), _Tp(23), _Tp(29), _Tp(31), _Tp(37), _Tp(41), _Tp(43), _Tp(47), _Tp(53), _Tp(59), _Tp(61), _Tp(67), _Tp(71), _Tp(73), _Tp(79), _Tp(83), _Tp(89), _Tp(97), _Tp(101), _Tp(103), _Tp(107), _Tp(109) }; static const unsigned int __num_primes = sizeof(__prime) / sizeof(_Tp); _Tp __zeta = _Tp(1); for (unsigned int __i = 0; __i < __num_primes; ++__i) { const _Tp __fact = _Tp(1) - std::pow(__prime[__i], -__s); __zeta *= __fact; if (_Tp(1) - __fact < std::numeric_limits<_Tp>::epsilon()) break; } __zeta = _Tp(1) / __zeta; return __zeta; } /** * @brief Return the Riemann zeta function @f$ \zeta(s) @f$. * * The Riemann zeta function is defined by: * \f[ * \zeta(s) = \sum_{k=1}^{\infty} k^{-s} for s > 1 * \frac{(2\pi)^s}{pi} sin(\frac{\pi s}{2}) * \Gamma (1 - s) \zeta (1 - s) for s < 1 * \f] * For s < 1 use the reflection formula: * \f[ * \zeta(s) = 2^s \pi^{s-1} \Gamma(1-s) \zeta(1-s) * \f] */ template<typename _Tp> _Tp __riemann_zeta(_Tp __s) { if (__isnan(__s)) return std::numeric_limits<_Tp>::quiet_NaN(); else if (__s == _Tp(1)) return std::numeric_limits<_Tp>::infinity(); else if (__s < -_Tp(19)) { _Tp __zeta = __riemann_zeta_product(_Tp(1) - __s); __zeta *= std::pow(_Tp(2) * __numeric_constants<_Tp>::__pi(), __s) * std::sin(__numeric_constants<_Tp>::__pi_2() * __s) #if _GLIBCXX_USE_C99_MATH_TR1 * std::exp(std::tr1::lgamma(_Tp(1) - __s)) #else * std::exp(__log_gamma(_Tp(1) - __s)) #endif / __numeric_constants<_Tp>::__pi(); return __zeta; } else if (__s < _Tp(20)) { // Global double sum or McLaurin? bool __glob = true; if (__glob) return __riemann_zeta_glob(__s); else { if (__s > _Tp(1)) return __riemann_zeta_sum(__s); else { _Tp __zeta = std::pow(_Tp(2) * __numeric_constants<_Tp>::__pi(), __s) * std::sin(__numeric_constants<_Tp>::__pi_2() * __s) #if _GLIBCXX_USE_C99_MATH_TR1 * std::tr1::tgamma(_Tp(1) - __s) #else * std::exp(__log_gamma(_Tp(1) - __s)) #endif * __riemann_zeta_sum(_Tp(1) - __s); return __zeta; } } } else return __riemann_zeta_product(__s); } /** * @brief Return the Hurwitz zeta function @f$ \zeta(x,s) @f$ * for all s != 1 and x > -1. * * The Hurwitz zeta function is defined by: * @f[ * \zeta(x,s) = \sum_{n=0}^{\infty} \frac{1}{(n + x)^s} * @f] * The Riemann zeta function is a special case: * @f[ * \zeta(s) = \zeta(1,s) * @f] * * This functions uses the double sum that converges for s != 1 * and x > -1: * @f[ * \zeta(x,s) = \frac{1}{s-1} * \sum_{n=0}^{\infty} \frac{1}{n + 1} * \sum_{k=0}^{n} (-1)^k \frac{n!}{(n-k)!k!} (x+k)^{-s} * @f] */ template<typename _Tp> _Tp __hurwitz_zeta_glob(_Tp __a, _Tp __s) { _Tp __zeta = _Tp(0); const _Tp __eps = std::numeric_limits<_Tp>::epsilon(); // Max e exponent before overflow. const _Tp __max_bincoeff = std::numeric_limits<_Tp>::max_exponent10 * std::log(_Tp(10)) - _Tp(1); const unsigned int __maxit = 10000; for (unsigned int __i = 0; __i < __maxit; ++__i) { bool __punt = false; _Tp __sgn = _Tp(1); _Tp __term = _Tp(0); for (unsigned int __j = 0; __j <= __i; ++__j) { #if _GLIBCXX_USE_C99_MATH_TR1 _Tp __bincoeff = std::tr1::lgamma(_Tp(1 + __i)) - std::tr1::lgamma(_Tp(1 + __j)) - std::tr1::lgamma(_Tp(1 + __i - __j)); #else _Tp __bincoeff = __log_gamma(_Tp(1 + __i)) - __log_gamma(_Tp(1 + __j)) - __log_gamma(_Tp(1 + __i - __j)); #endif if (__bincoeff > __max_bincoeff) { // This only gets hit for x << 0. __punt = true; break; } __bincoeff = std::exp(__bincoeff); __term += __sgn * __bincoeff * std::pow(_Tp(__a + __j), -__s); __sgn *= _Tp(-1); } if (__punt) break; __term /= _Tp(__i + 1); if (std::abs(__term / __zeta) < __eps) break; __zeta += __term; } __zeta /= __s - _Tp(1); return __zeta; } /** * @brief Return the Hurwitz zeta function @f$ \zeta(x,s) @f$ * for all s != 1 and x > -1. * * The Hurwitz zeta function is defined by: * @f[ * \zeta(x,s) = \sum_{n=0}^{\infty} \frac{1}{(n + x)^s} * @f] * The Riemann zeta function is a special case: * @f[ * \zeta(s) = \zeta(1,s) * @f] */ template<typename _Tp> inline _Tp __hurwitz_zeta(_Tp __a, _Tp __s) { return __hurwitz_zeta_glob(__a, __s); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std::tr1::__detail } } #endif // _GLIBCXX_TR1_RIEMANN_ZETA_TCC ����������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/ctime���������������������������������������������������������������������������������0000644�����������������00000002322�14763166027�0007332 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 ctime -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/ctime * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_CTIME #define _GLIBCXX_TR1_CTIME 1 #include <ctime> #endif // _GLIBCXX_TR1_CTIME ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/stdint.h������������������������������������������������������������������������������0000644�����������������00000002276�14763166027�0007774 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 stdint.h -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/stdint.h * This is a TR1 C++ Library header. */ #ifndef _TR1_STDINT_H #define _TR1_STDINT_H 1 #include <tr1/cstdint> #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/limits.h������������������������������������������������������������������������������0000644�����������������00000002276�14763166027�0007770 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 limits.h -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/limits.h * This is a TR1 C++ Library header. */ #ifndef _TR1_LIMITS_H #define _TR1_LIMITS_H 1 #include <tr1/climits> #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/fenv.h��������������������������������������������������������������������������������0000644�����������������00000002264�14763166027�0007422 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 fenv.h -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/fenv.h * This is a TR1 C++ Library header. */ #ifndef _TR1_FENV_H #define _TR1_FENV_H 1 #include <tr1/cfenv> #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/unordered_set�������������������������������������������������������������������������0000644�����������������00000003046�14763166027�0011077 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 unordered_set -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/unordered_set * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_UNORDERED_SET #define _GLIBCXX_TR1_UNORDERED_SET 1 #pragma GCC system_header #include <utility> #include <bits/stl_algobase.h> #include <bits/allocator.h> #include <bits/stl_function.h> // equal_to, _Identity, _Select1st #include <bits/stringfwd.h> #include <tr1/type_traits> #include <tr1/functional_hash.h> #include <tr1/hashtable.h> #include <tr1/unordered_set.h> #endif // _GLIBCXX_TR1_UNORDERED_SET ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/legendre_function.tcc�����������������������������������������������������������������0000644�����������������00000024506�14763166027�0012503 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Special functions -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/legendre_function.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{tr1/cmath} */ // // ISO C++ 14882 TR1: 5.2 Special functions // // Written by Edward Smith-Rowland based on: // (1) Handbook of Mathematical Functions, // ed. Milton Abramowitz and Irene A. Stegun, // Dover Publications, // Section 8, pp. 331-341 // (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl // (3) Numerical Recipes in C, by W. H. Press, S. A. Teukolsky, // W. T. Vetterling, B. P. Flannery, Cambridge University Press (1992), // 2nd ed, pp. 252-254 #ifndef _GLIBCXX_TR1_LEGENDRE_FUNCTION_TCC #define _GLIBCXX_TR1_LEGENDRE_FUNCTION_TCC 1 #include "special_function_util.h" namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { // [5.2] Special functions // Implementation-space details. namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Return the Legendre polynomial by recursion on order * @f$ l @f$. * * The Legendre function of @f$ l @f$ and @f$ x @f$, * @f$ P_l(x) @f$, is defined by: * @f[ * P_l(x) = \frac{1}{2^l l!}\frac{d^l}{dx^l}(x^2 - 1)^{l} * @f] * * @param l The order of the Legendre polynomial. @f$l >= 0@f$. * @param x The argument of the Legendre polynomial. @f$|x| <= 1@f$. */ template<typename _Tp> _Tp __poly_legendre_p(unsigned int __l, _Tp __x) { if ((__x < _Tp(-1)) || (__x > _Tp(+1))) std::__throw_domain_error(__N("Argument out of range" " in __poly_legendre_p.")); else if (__isnan(__x)) return std::numeric_limits<_Tp>::quiet_NaN(); else if (__x == +_Tp(1)) return +_Tp(1); else if (__x == -_Tp(1)) return (__l % 2 == 1 ? -_Tp(1) : +_Tp(1)); else { _Tp __p_lm2 = _Tp(1); if (__l == 0) return __p_lm2; _Tp __p_lm1 = __x; if (__l == 1) return __p_lm1; _Tp __p_l = 0; for (unsigned int __ll = 2; __ll <= __l; ++__ll) { // This arrangement is supposed to be better for roundoff // protection, Arfken, 2nd Ed, Eq 12.17a. __p_l = _Tp(2) * __x * __p_lm1 - __p_lm2 - (__x * __p_lm1 - __p_lm2) / _Tp(__ll); __p_lm2 = __p_lm1; __p_lm1 = __p_l; } return __p_l; } } /** * @brief Return the associated Legendre function by recursion * on @f$ l @f$. * * The associated Legendre function is derived from the Legendre function * @f$ P_l(x) @f$ by the Rodrigues formula: * @f[ * P_l^m(x) = (1 - x^2)^{m/2}\frac{d^m}{dx^m}P_l(x) * @f] * * @param l The order of the associated Legendre function. * @f$ l >= 0 @f$. * @param m The order of the associated Legendre function. * @f$ m <= l @f$. * @param x The argument of the associated Legendre function. * @f$ |x| <= 1 @f$. */ template<typename _Tp> _Tp __assoc_legendre_p(unsigned int __l, unsigned int __m, _Tp __x) { if (__x < _Tp(-1) || __x > _Tp(+1)) std::__throw_domain_error(__N("Argument out of range" " in __assoc_legendre_p.")); else if (__m > __l) std::__throw_domain_error(__N("Degree out of range" " in __assoc_legendre_p.")); else if (__isnan(__x)) return std::numeric_limits<_Tp>::quiet_NaN(); else if (__m == 0) return __poly_legendre_p(__l, __x); else { _Tp __p_mm = _Tp(1); if (__m > 0) { // Two square roots seem more accurate more of the time // than just one. _Tp __root = std::sqrt(_Tp(1) - __x) * std::sqrt(_Tp(1) + __x); _Tp __fact = _Tp(1); for (unsigned int __i = 1; __i <= __m; ++__i) { __p_mm *= -__fact * __root; __fact += _Tp(2); } } if (__l == __m) return __p_mm; _Tp __p_mp1m = _Tp(2 * __m + 1) * __x * __p_mm; if (__l == __m + 1) return __p_mp1m; _Tp __p_lm2m = __p_mm; _Tp __P_lm1m = __p_mp1m; _Tp __p_lm = _Tp(0); for (unsigned int __j = __m + 2; __j <= __l; ++__j) { __p_lm = (_Tp(2 * __j - 1) * __x * __P_lm1m - _Tp(__j + __m - 1) * __p_lm2m) / _Tp(__j - __m); __p_lm2m = __P_lm1m; __P_lm1m = __p_lm; } return __p_lm; } } /** * @brief Return the spherical associated Legendre function. * * The spherical associated Legendre function of @f$ l @f$, @f$ m @f$, * and @f$ \theta @f$ is defined as @f$ Y_l^m(\theta,0) @f$ where * @f[ * Y_l^m(\theta,\phi) = (-1)^m[\frac{(2l+1)}{4\pi} * \frac{(l-m)!}{(l+m)!}] * P_l^m(\cos\theta) \exp^{im\phi} * @f] * is the spherical harmonic function and @f$ P_l^m(x) @f$ is the * associated Legendre function. * * This function differs from the associated Legendre function by * argument (@f$x = \cos(\theta)@f$) and by a normalization factor * but this factor is rather large for large @f$ l @f$ and @f$ m @f$ * and so this function is stable for larger differences of @f$ l @f$ * and @f$ m @f$. * * @param l The order of the spherical associated Legendre function. * @f$ l >= 0 @f$. * @param m The order of the spherical associated Legendre function. * @f$ m <= l @f$. * @param theta The radian angle argument of the spherical associated * Legendre function. */ template <typename _Tp> _Tp __sph_legendre(unsigned int __l, unsigned int __m, _Tp __theta) { if (__isnan(__theta)) return std::numeric_limits<_Tp>::quiet_NaN(); const _Tp __x = std::cos(__theta); if (__l < __m) { std::__throw_domain_error(__N("Bad argument " "in __sph_legendre.")); } else if (__m == 0) { _Tp __P = __poly_legendre_p(__l, __x); _Tp __fact = std::sqrt(_Tp(2 * __l + 1) / (_Tp(4) * __numeric_constants<_Tp>::__pi())); __P *= __fact; return __P; } else if (__x == _Tp(1) || __x == -_Tp(1)) { // m > 0 here return _Tp(0); } else { // m > 0 and |x| < 1 here // Starting value for recursion. // Y_m^m(x) = sqrt( (2m+1)/(4pi m) gamma(m+1/2)/gamma(m) ) // (-1)^m (1-x^2)^(m/2) / pi^(1/4) const _Tp __sgn = ( __m % 2 == 1 ? -_Tp(1) : _Tp(1)); const _Tp __y_mp1m_factor = __x * std::sqrt(_Tp(2 * __m + 3)); #if _GLIBCXX_USE_C99_MATH_TR1 const _Tp __lncirc = std::tr1::log1p(-__x * __x); #else const _Tp __lncirc = std::log(_Tp(1) - __x * __x); #endif // Gamma(m+1/2) / Gamma(m) #if _GLIBCXX_USE_C99_MATH_TR1 const _Tp __lnpoch = std::tr1::lgamma(_Tp(__m + _Tp(0.5L))) - std::tr1::lgamma(_Tp(__m)); #else const _Tp __lnpoch = __log_gamma(_Tp(__m + _Tp(0.5L))) - __log_gamma(_Tp(__m)); #endif const _Tp __lnpre_val = -_Tp(0.25L) * __numeric_constants<_Tp>::__lnpi() + _Tp(0.5L) * (__lnpoch + __m * __lncirc); _Tp __sr = std::sqrt((_Tp(2) + _Tp(1) / __m) / (_Tp(4) * __numeric_constants<_Tp>::__pi())); _Tp __y_mm = __sgn * __sr * std::exp(__lnpre_val); _Tp __y_mp1m = __y_mp1m_factor * __y_mm; if (__l == __m) { return __y_mm; } else if (__l == __m + 1) { return __y_mp1m; } else { _Tp __y_lm = _Tp(0); // Compute Y_l^m, l > m+1, upward recursion on l. for ( int __ll = __m + 2; __ll <= __l; ++__ll) { const _Tp __rat1 = _Tp(__ll - __m) / _Tp(__ll + __m); const _Tp __rat2 = _Tp(__ll - __m - 1) / _Tp(__ll + __m - 1); const _Tp __fact1 = std::sqrt(__rat1 * _Tp(2 * __ll + 1) * _Tp(2 * __ll - 1)); const _Tp __fact2 = std::sqrt(__rat1 * __rat2 * _Tp(2 * __ll + 1) / _Tp(2 * __ll - 3)); __y_lm = (__x * __y_mp1m * __fact1 - (__ll + __m - 1) * __y_mm * __fact2) / _Tp(__ll - __m); __y_mm = __y_mp1m; __y_mp1m = __y_lm; } return __y_lm; } } } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std::tr1::__detail } } #endif // _GLIBCXX_TR1_LEGENDRE_FUNCTION_TCC ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/cstdbool������������������������������������������������������������������������������0000644�����������������00000002500�14763166027�0010040 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 cstdbool -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/cstdbool * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_CSTDBOOL #define _GLIBCXX_TR1_CSTDBOOL 1 #pragma GCC system_header #include <bits/c++config.h> #if _GLIBCXX_HAVE_STDBOOL_H #include <stdbool.h> #endif #endif // _GLIBCXX_TR1_CSTDBOOL ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/beta_function.tcc���������������������������������������������������������������������0000644�����������������00000012745�14763166027�0011633 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Special functions -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/beta_function.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{tr1/cmath} */ // // ISO C++ 14882 TR1: 5.2 Special functions // // Written by Edward Smith-Rowland based on: // (1) Handbook of Mathematical Functions, // ed. Milton Abramowitz and Irene A. Stegun, // Dover Publications, // Section 6, pp. 253-266 // (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl // (3) Numerical Recipes in C, by W. H. Press, S. A. Teukolsky, // W. T. Vetterling, B. P. Flannery, Cambridge University Press (1992), // 2nd ed, pp. 213-216 // (4) Gamma, Exploring Euler's Constant, Julian Havil, // Princeton, 2003. #ifndef _GLIBCXX_TR1_BETA_FUNCTION_TCC #define _GLIBCXX_TR1_BETA_FUNCTION_TCC 1 namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { // [5.2] Special functions // Implementation-space details. namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Return the beta function: \f$B(x,y)\f$. * * The beta function is defined by * @f[ * B(x,y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)} * @f] * * @param __x The first argument of the beta function. * @param __y The second argument of the beta function. * @return The beta function. */ template<typename _Tp> _Tp __beta_gamma(_Tp __x, _Tp __y) { _Tp __bet; #if _GLIBCXX_USE_C99_MATH_TR1 if (__x > __y) { __bet = std::tr1::tgamma(__x) / std::tr1::tgamma(__x + __y); __bet *= std::tr1::tgamma(__y); } else { __bet = std::tr1::tgamma(__y) / std::tr1::tgamma(__x + __y); __bet *= std::tr1::tgamma(__x); } #else if (__x > __y) { __bet = __gamma(__x) / __gamma(__x + __y); __bet *= __gamma(__y); } else { __bet = __gamma(__y) / __gamma(__x + __y); __bet *= __gamma(__x); } #endif return __bet; } /** * @brief Return the beta function \f$B(x,y)\f$ using * the log gamma functions. * * The beta function is defined by * @f[ * B(x,y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)} * @f] * * @param __x The first argument of the beta function. * @param __y The second argument of the beta function. * @return The beta function. */ template<typename _Tp> _Tp __beta_lgamma(_Tp __x, _Tp __y) { #if _GLIBCXX_USE_C99_MATH_TR1 _Tp __bet = std::tr1::lgamma(__x) + std::tr1::lgamma(__y) - std::tr1::lgamma(__x + __y); #else _Tp __bet = __log_gamma(__x) + __log_gamma(__y) - __log_gamma(__x + __y); #endif __bet = std::exp(__bet); return __bet; } /** * @brief Return the beta function \f$B(x,y)\f$ using * the product form. * * The beta function is defined by * @f[ * B(x,y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)} * @f] * * @param __x The first argument of the beta function. * @param __y The second argument of the beta function. * @return The beta function. */ template<typename _Tp> _Tp __beta_product(_Tp __x, _Tp __y) { _Tp __bet = (__x + __y) / (__x * __y); unsigned int __max_iter = 1000000; for (unsigned int __k = 1; __k < __max_iter; ++__k) { _Tp __term = (_Tp(1) + (__x + __y) / __k) / ((_Tp(1) + __x / __k) * (_Tp(1) + __y / __k)); __bet *= __term; } return __bet; } /** * @brief Return the beta function \f$ B(x,y) \f$. * * The beta function is defined by * @f[ * B(x,y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)} * @f] * * @param __x The first argument of the beta function. * @param __y The second argument of the beta function. * @return The beta function. */ template<typename _Tp> inline _Tp __beta(_Tp __x, _Tp __y) { if (__isnan(__x) || __isnan(__y)) return std::numeric_limits<_Tp>::quiet_NaN(); else return __beta_lgamma(__x, __y); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std::tr1::__detail } } #endif // __GLIBCXX_TR1_BETA_FUNCTION_TCC ���������������������������c++/4.8.2/tr1/stdarg.h������������������������������������������������������������������������������0000644�����������������00000002276�14763166027�0007753 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 stdarg.h -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/stdarg.h * This is a TR1 C++ Library header. */ #ifndef _TR1_STDARG_H #define _TR1_STDARG_H 1 #include <tr1/cstdarg> #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/ctype.h�������������������������������������������������������������������������������0000644�����������������00000002271�14763166027�0007606 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 ctype.h -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/ctype.h * This is a TR1 C++ Library header. */ #ifndef _TR1_CTYPE_H #define _TR1_CTYPE_H 1 #include <tr1/cctype> #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/random.h������������������������������������������������������������������������������0000644�����������������00000216751�14763166027�0007754 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// random number generation -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** * @file tr1/random.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{tr1/random} */ #ifndef _GLIBCXX_TR1_RANDOM_H #define _GLIBCXX_TR1_RANDOM_H 1 #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { // [5.1] Random number generation /** * @addtogroup tr1_random Random Number Generation * A facility for generating random numbers on selected distributions. * @{ */ /* * Implementation-space details. */ namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _UIntType, int __w, bool = __w < std::numeric_limits<_UIntType>::digits> struct _Shift { static const _UIntType __value = 0; }; template<typename _UIntType, int __w> struct _Shift<_UIntType, __w, true> { static const _UIntType __value = _UIntType(1) << __w; }; template<typename _Tp, _Tp __a, _Tp __c, _Tp __m, bool> struct _Mod; // Dispatch based on modulus value to prevent divide-by-zero compile-time // errors when m == 0. template<typename _Tp, _Tp __a, _Tp __c, _Tp __m> inline _Tp __mod(_Tp __x) { return _Mod<_Tp, __a, __c, __m, __m == 0>::__calc(__x); } typedef __gnu_cxx::__conditional_type<(sizeof(unsigned) == 4), unsigned, unsigned long>::__type _UInt32Type; /* * An adaptor class for converting the output of any Generator into * the input for a specific Distribution. */ template<typename _Engine, typename _Distribution> struct _Adaptor { typedef typename remove_reference<_Engine>::type _BEngine; typedef typename _BEngine::result_type _Engine_result_type; typedef typename _Distribution::input_type result_type; public: _Adaptor(const _Engine& __g) : _M_g(__g) { } result_type min() const { result_type __return_value; if (is_integral<_Engine_result_type>::value && is_integral<result_type>::value) __return_value = _M_g.min(); else __return_value = result_type(0); return __return_value; } result_type max() const { result_type __return_value; if (is_integral<_Engine_result_type>::value && is_integral<result_type>::value) __return_value = _M_g.max(); else if (!is_integral<result_type>::value) __return_value = result_type(1); else __return_value = std::numeric_limits<result_type>::max() - 1; return __return_value; } /* * Converts a value generated by the adapted random number generator * into a value in the input domain for the dependent random number * distribution. * * Because the type traits are compile time constants only the * appropriate clause of the if statements will actually be emitted * by the compiler. */ result_type operator()() { result_type __return_value; if (is_integral<_Engine_result_type>::value && is_integral<result_type>::value) __return_value = _M_g(); else if (!is_integral<_Engine_result_type>::value && !is_integral<result_type>::value) __return_value = result_type(_M_g() - _M_g.min()) / result_type(_M_g.max() - _M_g.min()); else if (is_integral<_Engine_result_type>::value && !is_integral<result_type>::value) __return_value = result_type(_M_g() - _M_g.min()) / result_type(_M_g.max() - _M_g.min() + result_type(1)); else __return_value = (((_M_g() - _M_g.min()) / (_M_g.max() - _M_g.min())) * std::numeric_limits<result_type>::max()); return __return_value; } private: _Engine _M_g; }; // Specialization for _Engine*. template<typename _Engine, typename _Distribution> struct _Adaptor<_Engine*, _Distribution> { typedef typename _Engine::result_type _Engine_result_type; typedef typename _Distribution::input_type result_type; public: _Adaptor(_Engine* __g) : _M_g(__g) { } result_type min() const { result_type __return_value; if (is_integral<_Engine_result_type>::value && is_integral<result_type>::value) __return_value = _M_g->min(); else __return_value = result_type(0); return __return_value; } result_type max() const { result_type __return_value; if (is_integral<_Engine_result_type>::value && is_integral<result_type>::value) __return_value = _M_g->max(); else if (!is_integral<result_type>::value) __return_value = result_type(1); else __return_value = std::numeric_limits<result_type>::max() - 1; return __return_value; } result_type operator()() { result_type __return_value; if (is_integral<_Engine_result_type>::value && is_integral<result_type>::value) __return_value = (*_M_g)(); else if (!is_integral<_Engine_result_type>::value && !is_integral<result_type>::value) __return_value = result_type((*_M_g)() - _M_g->min()) / result_type(_M_g->max() - _M_g->min()); else if (is_integral<_Engine_result_type>::value && !is_integral<result_type>::value) __return_value = result_type((*_M_g)() - _M_g->min()) / result_type(_M_g->max() - _M_g->min() + result_type(1)); else __return_value = ((((*_M_g)() - _M_g->min()) / (_M_g->max() - _M_g->min())) * std::numeric_limits<result_type>::max()); return __return_value; } private: _Engine* _M_g; }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace __detail _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * Produces random numbers on a given distribution function using a * non-uniform random number generation engine. * * @todo the engine_value_type needs to be studied more carefully. */ template<typename _Engine, typename _Dist> class variate_generator { // Concept requirements. __glibcxx_class_requires(_Engine, _CopyConstructibleConcept) // __glibcxx_class_requires(_Engine, _EngineConcept) // __glibcxx_class_requires(_Dist, _EngineConcept) public: typedef _Engine engine_type; typedef __detail::_Adaptor<_Engine, _Dist> engine_value_type; typedef _Dist distribution_type; typedef typename _Dist::result_type result_type; // tr1:5.1.1 table 5.1 requirement typedef typename __gnu_cxx::__enable_if< is_arithmetic<result_type>::value, result_type>::__type _IsValidType; /** * Constructs a variate generator with the uniform random number * generator @p __eng for the random distribution @p __dist. * * @throws Any exceptions which may thrown by the copy constructors of * the @p _Engine or @p _Dist objects. */ variate_generator(engine_type __eng, distribution_type __dist) : _M_engine(__eng), _M_dist(__dist) { } /** * Gets the next generated value on the distribution. */ result_type operator()() { return _M_dist(_M_engine); } /** * WTF? */ template<typename _Tp> result_type operator()(_Tp __value) { return _M_dist(_M_engine, __value); } /** * Gets a reference to the underlying uniform random number generator * object. */ engine_value_type& engine() { return _M_engine; } /** * Gets a const reference to the underlying uniform random number * generator object. */ const engine_value_type& engine() const { return _M_engine; } /** * Gets a reference to the underlying random distribution. */ distribution_type& distribution() { return _M_dist; } /** * Gets a const reference to the underlying random distribution. */ const distribution_type& distribution() const { return _M_dist; } /** * Gets the closed lower bound of the distribution interval. */ result_type min() const { return this->distribution().min(); } /** * Gets the closed upper bound of the distribution interval. */ result_type max() const { return this->distribution().max(); } private: engine_value_type _M_engine; distribution_type _M_dist; }; /** * @addtogroup tr1_random_generators Random Number Generators * @ingroup tr1_random * * These classes define objects which provide random or pseudorandom * numbers, either from a discrete or a continuous interval. The * random number generator supplied as a part of this library are * all uniform random number generators which provide a sequence of * random number uniformly distributed over their range. * * A number generator is a function object with an operator() that * takes zero arguments and returns a number. * * A compliant random number generator must satisfy the following * requirements. <table border=1 cellpadding=10 cellspacing=0> * <caption align=top>Random Number Generator Requirements</caption> * <tr><td>To be documented.</td></tr> </table> * * @{ */ /** * @brief A model of a linear congruential random number generator. * * A random number generator that produces pseudorandom numbers using the * linear function @f$x_{i+1}\leftarrow(ax_{i} + c) \bmod m @f$. * * The template parameter @p _UIntType must be an unsigned integral type * large enough to store values up to (__m-1). If the template parameter * @p __m is 0, the modulus @p __m used is * std::numeric_limits<_UIntType>::max() plus 1. Otherwise, the template * parameters @p __a and @p __c must be less than @p __m. * * The size of the state is @f$ 1 @f$. */ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> class linear_congruential { __glibcxx_class_requires(_UIntType, _UnsignedIntegerConcept) // __glibcpp_class_requires(__a < __m && __c < __m) public: /** The type of the generated random value. */ typedef _UIntType result_type; /** The multiplier. */ static const _UIntType multiplier = __a; /** An increment. */ static const _UIntType increment = __c; /** The modulus. */ static const _UIntType modulus = __m; /** * Constructs a %linear_congruential random number generator engine with * seed @p __s. The default seed value is 1. * * @param __s The initial seed value. */ explicit linear_congruential(unsigned long __x0 = 1) { this->seed(__x0); } /** * Constructs a %linear_congruential random number generator engine * seeded from the generator function @p __g. * * @param __g The seed generator function. */ template<class _Gen> linear_congruential(_Gen& __g) { this->seed(__g); } /** * Reseeds the %linear_congruential random number generator engine * sequence to the seed @g __s. * * @param __s The new seed. */ void seed(unsigned long __s = 1); /** * Reseeds the %linear_congruential random number generator engine * sequence using values from the generator function @p __g. * * @param __g the seed generator function. */ template<class _Gen> void seed(_Gen& __g) { seed(__g, typename is_fundamental<_Gen>::type()); } /** * Gets the smallest possible value in the output range. * * The minimum depends on the @p __c parameter: if it is zero, the * minimum generated must be > 0, otherwise 0 is allowed. */ result_type min() const { return (__detail::__mod<_UIntType, 1, 0, __m>(__c) == 0) ? 1 : 0; } /** * Gets the largest possible value in the output range. */ result_type max() const { return __m - 1; } /** * Gets the next random number in the sequence. */ result_type operator()(); /** * Compares two linear congruential random number generator * objects of the same type for equality. * * @param __lhs A linear congruential random number generator object. * @param __rhs Another linear congruential random number generator obj. * * @returns true if the two objects are equal, false otherwise. */ friend bool operator==(const linear_congruential& __lhs, const linear_congruential& __rhs) { return __lhs._M_x == __rhs._M_x; } /** * Compares two linear congruential random number generator * objects of the same type for inequality. * * @param __lhs A linear congruential random number generator object. * @param __rhs Another linear congruential random number generator obj. * * @returns true if the two objects are not equal, false otherwise. */ friend bool operator!=(const linear_congruential& __lhs, const linear_congruential& __rhs) { return !(__lhs == __rhs); } /** * Writes the textual representation of the state x(i) of x to @p __os. * * @param __os The output stream. * @param __lcr A % linear_congruential random number generator. * @returns __os. */ template<class _UIntType1, _UIntType1 __a1, _UIntType1 __c1, _UIntType1 __m1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const linear_congruential<_UIntType1, __a1, __c1, __m1>& __lcr); /** * Sets the state of the engine by reading its textual * representation from @p __is. * * The textual representation must have been previously written using an * output stream whose imbued locale and whose type's template * specialization arguments _CharT and _Traits were the same as those of * @p __is. * * @param __is The input stream. * @param __lcr A % linear_congruential random number generator. * @returns __is. */ template<class _UIntType1, _UIntType1 __a1, _UIntType1 __c1, _UIntType1 __m1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, linear_congruential<_UIntType1, __a1, __c1, __m1>& __lcr); private: template<class _Gen> void seed(_Gen& __g, true_type) { return seed(static_cast<unsigned long>(__g)); } template<class _Gen> void seed(_Gen& __g, false_type); _UIntType _M_x; }; /** * The classic Minimum Standard rand0 of Lewis, Goodman, and Miller. */ typedef linear_congruential<unsigned long, 16807, 0, 2147483647> minstd_rand0; /** * An alternative LCR (Lehmer Generator function) . */ typedef linear_congruential<unsigned long, 48271, 0, 2147483647> minstd_rand; /** * A generalized feedback shift register discrete random number generator. * * This algorithm avoids multiplication and division and is designed to be * friendly to a pipelined architecture. If the parameters are chosen * correctly, this generator will produce numbers with a very long period and * fairly good apparent entropy, although still not cryptographically strong. * * The best way to use this generator is with the predefined mt19937 class. * * This algorithm was originally invented by Makoto Matsumoto and * Takuji Nishimura. * * @var word_size The number of bits in each element of the state vector. * @var state_size The degree of recursion. * @var shift_size The period parameter. * @var mask_bits The separation point bit index. * @var parameter_a The last row of the twist matrix. * @var output_u The first right-shift tempering matrix parameter. * @var output_s The first left-shift tempering matrix parameter. * @var output_b The first left-shift tempering matrix mask. * @var output_t The second left-shift tempering matrix parameter. * @var output_c The second left-shift tempering matrix mask. * @var output_l The second right-shift tempering matrix parameter. */ template<class _UIntType, int __w, int __n, int __m, int __r, _UIntType __a, int __u, int __s, _UIntType __b, int __t, _UIntType __c, int __l> class mersenne_twister { __glibcxx_class_requires(_UIntType, _UnsignedIntegerConcept) public: // types typedef _UIntType result_type; // parameter values static const int word_size = __w; static const int state_size = __n; static const int shift_size = __m; static const int mask_bits = __r; static const _UIntType parameter_a = __a; static const int output_u = __u; static const int output_s = __s; static const _UIntType output_b = __b; static const int output_t = __t; static const _UIntType output_c = __c; static const int output_l = __l; // constructors and member function mersenne_twister() { seed(); } explicit mersenne_twister(unsigned long __value) { seed(__value); } template<class _Gen> mersenne_twister(_Gen& __g) { seed(__g); } void seed() { seed(5489UL); } void seed(unsigned long __value); template<class _Gen> void seed(_Gen& __g) { seed(__g, typename is_fundamental<_Gen>::type()); } result_type min() const { return 0; }; result_type max() const { return __detail::_Shift<_UIntType, __w>::__value - 1; } result_type operator()(); /** * Compares two % mersenne_twister random number generator objects of * the same type for equality. * * @param __lhs A % mersenne_twister random number generator object. * @param __rhs Another % mersenne_twister random number generator * object. * * @returns true if the two objects are equal, false otherwise. */ friend bool operator==(const mersenne_twister& __lhs, const mersenne_twister& __rhs) { return std::equal(__lhs._M_x, __lhs._M_x + state_size, __rhs._M_x); } /** * Compares two % mersenne_twister random number generator objects of * the same type for inequality. * * @param __lhs A % mersenne_twister random number generator object. * @param __rhs Another % mersenne_twister random number generator * object. * * @returns true if the two objects are not equal, false otherwise. */ friend bool operator!=(const mersenne_twister& __lhs, const mersenne_twister& __rhs) { return !(__lhs == __rhs); } /** * Inserts the current state of a % mersenne_twister random number * generator engine @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A % mersenne_twister random number generator engine. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<class _UIntType1, int __w1, int __n1, int __m1, int __r1, _UIntType1 __a1, int __u1, int __s1, _UIntType1 __b1, int __t1, _UIntType1 __c1, int __l1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const mersenne_twister<_UIntType1, __w1, __n1, __m1, __r1, __a1, __u1, __s1, __b1, __t1, __c1, __l1>& __x); /** * Extracts the current state of a % mersenne_twister random number * generator engine @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A % mersenne_twister random number generator engine. * * @returns The input stream with the state of @p __x extracted or in * an error state. */ template<class _UIntType1, int __w1, int __n1, int __m1, int __r1, _UIntType1 __a1, int __u1, int __s1, _UIntType1 __b1, int __t1, _UIntType1 __c1, int __l1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, mersenne_twister<_UIntType1, __w1, __n1, __m1, __r1, __a1, __u1, __s1, __b1, __t1, __c1, __l1>& __x); private: template<class _Gen> void seed(_Gen& __g, true_type) { return seed(static_cast<unsigned long>(__g)); } template<class _Gen> void seed(_Gen& __g, false_type); _UIntType _M_x[state_size]; int _M_p; }; /** * The classic Mersenne Twister. * * Reference: * M. Matsumoto and T. Nishimura, Mersenne Twister: A 623-Dimensionally * Equidistributed Uniform Pseudo-Random Number Generator, ACM Transactions * on Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30. */ typedef mersenne_twister< unsigned long, 32, 624, 397, 31, 0x9908b0dful, 11, 7, 0x9d2c5680ul, 15, 0xefc60000ul, 18 > mt19937; /** * @brief The Marsaglia-Zaman generator. * * This is a model of a Generalized Fibonacci discrete random number * generator, sometimes referred to as the SWC generator. * * A discrete random number generator that produces pseudorandom * numbers using @f$x_{i}\leftarrow(x_{i - s} - x_{i - r} - * carry_{i-1}) \bmod m @f$. * * The size of the state is @f$ r @f$ * and the maximum period of the generator is @f$ m^r - m^s -1 @f$. * * N1688[4.13] says <em>the template parameter _IntType shall denote * an integral type large enough to store values up to m</em>. * * @var _M_x The state of the generator. This is a ring buffer. * @var _M_carry The carry. * @var _M_p Current index of x(i - r). */ template<typename _IntType, _IntType __m, int __s, int __r> class subtract_with_carry { __glibcxx_class_requires(_IntType, _IntegerConcept) public: /** The type of the generated random value. */ typedef _IntType result_type; // parameter values static const _IntType modulus = __m; static const int long_lag = __r; static const int short_lag = __s; /** * Constructs a default-initialized % subtract_with_carry random number * generator. */ subtract_with_carry() { this->seed(); } /** * Constructs an explicitly seeded % subtract_with_carry random number * generator. */ explicit subtract_with_carry(unsigned long __value) { this->seed(__value); } /** * Constructs a %subtract_with_carry random number generator engine * seeded from the generator function @p __g. * * @param __g The seed generator function. */ template<class _Gen> subtract_with_carry(_Gen& __g) { this->seed(__g); } /** * Seeds the initial state @f$ x_0 @f$ of the random number generator. * * N1688[4.19] modifies this as follows. If @p __value == 0, * sets value to 19780503. In any case, with a linear * congruential generator lcg(i) having parameters @f$ m_{lcg} = * 2147483563, a_{lcg} = 40014, c_{lcg} = 0, and lcg(0) = value * @f$, sets @f$ x_{-r} \dots x_{-1} @f$ to @f$ lcg(1) \bmod m * \dots lcg(r) \bmod m @f$ respectively. If @f$ x_{-1} = 0 @f$ * set carry to 1, otherwise sets carry to 0. */ void seed(unsigned long __value = 19780503); /** * Seeds the initial state @f$ x_0 @f$ of the % subtract_with_carry * random number generator. */ template<class _Gen> void seed(_Gen& __g) { seed(__g, typename is_fundamental<_Gen>::type()); } /** * Gets the inclusive minimum value of the range of random integers * returned by this generator. */ result_type min() const { return 0; } /** * Gets the inclusive maximum value of the range of random integers * returned by this generator. */ result_type max() const { return this->modulus - 1; } /** * Gets the next random number in the sequence. */ result_type operator()(); /** * Compares two % subtract_with_carry random number generator objects of * the same type for equality. * * @param __lhs A % subtract_with_carry random number generator object. * @param __rhs Another % subtract_with_carry random number generator * object. * * @returns true if the two objects are equal, false otherwise. */ friend bool operator==(const subtract_with_carry& __lhs, const subtract_with_carry& __rhs) { return std::equal(__lhs._M_x, __lhs._M_x + long_lag, __rhs._M_x); } /** * Compares two % subtract_with_carry random number generator objects of * the same type for inequality. * * @param __lhs A % subtract_with_carry random number generator object. * @param __rhs Another % subtract_with_carry random number generator * object. * * @returns true if the two objects are not equal, false otherwise. */ friend bool operator!=(const subtract_with_carry& __lhs, const subtract_with_carry& __rhs) { return !(__lhs == __rhs); } /** * Inserts the current state of a % subtract_with_carry random number * generator engine @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A % subtract_with_carry random number generator engine. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _IntType1, _IntType1 __m1, int __s1, int __r1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const subtract_with_carry<_IntType1, __m1, __s1, __r1>& __x); /** * Extracts the current state of a % subtract_with_carry random number * generator engine @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A % subtract_with_carry random number generator engine. * * @returns The input stream with the state of @p __x extracted or in * an error state. */ template<typename _IntType1, _IntType1 __m1, int __s1, int __r1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, subtract_with_carry<_IntType1, __m1, __s1, __r1>& __x); private: template<class _Gen> void seed(_Gen& __g, true_type) { return seed(static_cast<unsigned long>(__g)); } template<class _Gen> void seed(_Gen& __g, false_type); typedef typename __gnu_cxx::__add_unsigned<_IntType>::__type _UIntType; _UIntType _M_x[long_lag]; _UIntType _M_carry; int _M_p; }; /** * @brief The Marsaglia-Zaman generator (floats version). * * @var _M_x The state of the generator. This is a ring buffer. * @var _M_carry The carry. * @var _M_p Current index of x(i - r). * @var _M_npows Precomputed negative powers of 2. */ template<typename _RealType, int __w, int __s, int __r> class subtract_with_carry_01 { public: /** The type of the generated random value. */ typedef _RealType result_type; // parameter values static const int word_size = __w; static const int long_lag = __r; static const int short_lag = __s; /** * Constructs a default-initialized % subtract_with_carry_01 random * number generator. */ subtract_with_carry_01() { this->seed(); _M_initialize_npows(); } /** * Constructs an explicitly seeded % subtract_with_carry_01 random number * generator. */ explicit subtract_with_carry_01(unsigned long __value) { this->seed(__value); _M_initialize_npows(); } /** * Constructs a % subtract_with_carry_01 random number generator engine * seeded from the generator function @p __g. * * @param __g The seed generator function. */ template<class _Gen> subtract_with_carry_01(_Gen& __g) { this->seed(__g); _M_initialize_npows(); } /** * Seeds the initial state @f$ x_0 @f$ of the random number generator. */ void seed(unsigned long __value = 19780503); /** * Seeds the initial state @f$ x_0 @f$ of the % subtract_with_carry_01 * random number generator. */ template<class _Gen> void seed(_Gen& __g) { seed(__g, typename is_fundamental<_Gen>::type()); } /** * Gets the minimum value of the range of random floats * returned by this generator. */ result_type min() const { return 0.0; } /** * Gets the maximum value of the range of random floats * returned by this generator. */ result_type max() const { return 1.0; } /** * Gets the next random number in the sequence. */ result_type operator()(); /** * Compares two % subtract_with_carry_01 random number generator objects * of the same type for equality. * * @param __lhs A % subtract_with_carry_01 random number * generator object. * @param __rhs Another % subtract_with_carry_01 random number generator * object. * * @returns true if the two objects are equal, false otherwise. */ friend bool operator==(const subtract_with_carry_01& __lhs, const subtract_with_carry_01& __rhs) { for (int __i = 0; __i < long_lag; ++__i) if (!std::equal(__lhs._M_x[__i], __lhs._M_x[__i] + __n, __rhs._M_x[__i])) return false; return true; } /** * Compares two % subtract_with_carry_01 random number generator objects * of the same type for inequality. * * @param __lhs A % subtract_with_carry_01 random number * generator object. * * @param __rhs Another % subtract_with_carry_01 random number generator * object. * * @returns true if the two objects are not equal, false otherwise. */ friend bool operator!=(const subtract_with_carry_01& __lhs, const subtract_with_carry_01& __rhs) { return !(__lhs == __rhs); } /** * Inserts the current state of a % subtract_with_carry_01 random number * generator engine @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A % subtract_with_carry_01 random number generator engine. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, int __w1, int __s1, int __r1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const subtract_with_carry_01<_RealType1, __w1, __s1, __r1>& __x); /** * Extracts the current state of a % subtract_with_carry_01 random number * generator engine @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A % subtract_with_carry_01 random number generator engine. * * @returns The input stream with the state of @p __x extracted or in * an error state. */ template<typename _RealType1, int __w1, int __s1, int __r1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, subtract_with_carry_01<_RealType1, __w1, __s1, __r1>& __x); private: template<class _Gen> void seed(_Gen& __g, true_type) { return seed(static_cast<unsigned long>(__g)); } template<class _Gen> void seed(_Gen& __g, false_type); void _M_initialize_npows(); static const int __n = (__w + 31) / 32; typedef __detail::_UInt32Type _UInt32Type; _UInt32Type _M_x[long_lag][__n]; _RealType _M_npows[__n]; _UInt32Type _M_carry; int _M_p; }; typedef subtract_with_carry_01<float, 24, 10, 24> ranlux_base_01; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 508. Bad parameters for ranlux64_base_01. typedef subtract_with_carry_01<double, 48, 5, 12> ranlux64_base_01; /** * Produces random numbers from some base engine by discarding blocks of * data. * * 0 <= @p __r <= @p __p */ template<class _UniformRandomNumberGenerator, int __p, int __r> class discard_block { // __glibcxx_class_requires(typename base_type::result_type, // ArithmeticTypeConcept) public: /** The type of the underlying generator engine. */ typedef _UniformRandomNumberGenerator base_type; /** The type of the generated random value. */ typedef typename base_type::result_type result_type; // parameter values static const int block_size = __p; static const int used_block = __r; /** * Constructs a default %discard_block engine. * * The underlying engine is default constructed as well. */ discard_block() : _M_n(0) { } /** * Copy constructs a %discard_block engine. * * Copies an existing base class random number generator. * @param rng An existing (base class) engine object. */ explicit discard_block(const base_type& __rng) : _M_b(__rng), _M_n(0) { } /** * Seed constructs a %discard_block engine. * * Constructs the underlying generator engine seeded with @p __s. * @param __s A seed value for the base class engine. */ explicit discard_block(unsigned long __s) : _M_b(__s), _M_n(0) { } /** * Generator construct a %discard_block engine. * * @param __g A seed generator function. */ template<class _Gen> discard_block(_Gen& __g) : _M_b(__g), _M_n(0) { } /** * Reseeds the %discard_block object with the default seed for the * underlying base class generator engine. */ void seed() { _M_b.seed(); _M_n = 0; } /** * Reseeds the %discard_block object with the given seed generator * function. * @param __g A seed generator function. */ template<class _Gen> void seed(_Gen& __g) { _M_b.seed(__g); _M_n = 0; } /** * Gets a const reference to the underlying generator engine object. */ const base_type& base() const { return _M_b; } /** * Gets the minimum value in the generated random number range. */ result_type min() const { return _M_b.min(); } /** * Gets the maximum value in the generated random number range. */ result_type max() const { return _M_b.max(); } /** * Gets the next value in the generated random number sequence. */ result_type operator()(); /** * Compares two %discard_block random number generator objects of * the same type for equality. * * @param __lhs A %discard_block random number generator object. * @param __rhs Another %discard_block random number generator * object. * * @returns true if the two objects are equal, false otherwise. */ friend bool operator==(const discard_block& __lhs, const discard_block& __rhs) { return (__lhs._M_b == __rhs._M_b) && (__lhs._M_n == __rhs._M_n); } /** * Compares two %discard_block random number generator objects of * the same type for inequality. * * @param __lhs A %discard_block random number generator object. * @param __rhs Another %discard_block random number generator * object. * * @returns true if the two objects are not equal, false otherwise. */ friend bool operator!=(const discard_block& __lhs, const discard_block& __rhs) { return !(__lhs == __rhs); } /** * Inserts the current state of a %discard_block random number * generator engine @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %discard_block random number generator engine. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<class _UniformRandomNumberGenerator1, int __p1, int __r1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const discard_block<_UniformRandomNumberGenerator1, __p1, __r1>& __x); /** * Extracts the current state of a % subtract_with_carry random number * generator engine @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %discard_block random number generator engine. * * @returns The input stream with the state of @p __x extracted or in * an error state. */ template<class _UniformRandomNumberGenerator1, int __p1, int __r1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, discard_block<_UniformRandomNumberGenerator1, __p1, __r1>& __x); private: base_type _M_b; int _M_n; }; /** * James's luxury-level-3 integer adaptation of Luescher's generator. */ typedef discard_block< subtract_with_carry<unsigned long, (1UL << 24), 10, 24>, 223, 24 > ranlux3; /** * James's luxury-level-4 integer adaptation of Luescher's generator. */ typedef discard_block< subtract_with_carry<unsigned long, (1UL << 24), 10, 24>, 389, 24 > ranlux4; typedef discard_block< subtract_with_carry_01<float, 24, 10, 24>, 223, 24 > ranlux3_01; typedef discard_block< subtract_with_carry_01<float, 24, 10, 24>, 389, 24 > ranlux4_01; /** * A random number generator adaptor class that combines two random number * generator engines into a single output sequence. */ template<class _UniformRandomNumberGenerator1, int __s1, class _UniformRandomNumberGenerator2, int __s2> class xor_combine { // __glibcxx_class_requires(typename _UniformRandomNumberGenerator1:: // result_type, ArithmeticTypeConcept) // __glibcxx_class_requires(typename _UniformRandomNumberGenerator2:: // result_type, ArithmeticTypeConcept) public: /** The type of the first underlying generator engine. */ typedef _UniformRandomNumberGenerator1 base1_type; /** The type of the second underlying generator engine. */ typedef _UniformRandomNumberGenerator2 base2_type; private: typedef typename base1_type::result_type _Result_type1; typedef typename base2_type::result_type _Result_type2; public: /** The type of the generated random value. */ typedef typename __gnu_cxx::__conditional_type<(sizeof(_Result_type1) > sizeof(_Result_type2)), _Result_type1, _Result_type2>::__type result_type; // parameter values static const int shift1 = __s1; static const int shift2 = __s2; // constructors and member function xor_combine() : _M_b1(), _M_b2() { _M_initialize_max(); } xor_combine(const base1_type& __rng1, const base2_type& __rng2) : _M_b1(__rng1), _M_b2(__rng2) { _M_initialize_max(); } xor_combine(unsigned long __s) : _M_b1(__s), _M_b2(__s + 1) { _M_initialize_max(); } template<class _Gen> xor_combine(_Gen& __g) : _M_b1(__g), _M_b2(__g) { _M_initialize_max(); } void seed() { _M_b1.seed(); _M_b2.seed(); } template<class _Gen> void seed(_Gen& __g) { _M_b1.seed(__g); _M_b2.seed(__g); } const base1_type& base1() const { return _M_b1; } const base2_type& base2() const { return _M_b2; } result_type min() const { return 0; } result_type max() const { return _M_max; } /** * Gets the next random number in the sequence. */ // NB: Not exactly the TR1 formula, per N2079 instead. result_type operator()() { return ((result_type(_M_b1() - _M_b1.min()) << shift1) ^ (result_type(_M_b2() - _M_b2.min()) << shift2)); } /** * Compares two %xor_combine random number generator objects of * the same type for equality. * * @param __lhs A %xor_combine random number generator object. * @param __rhs Another %xor_combine random number generator * object. * * @returns true if the two objects are equal, false otherwise. */ friend bool operator==(const xor_combine& __lhs, const xor_combine& __rhs) { return (__lhs.base1() == __rhs.base1()) && (__lhs.base2() == __rhs.base2()); } /** * Compares two %xor_combine random number generator objects of * the same type for inequality. * * @param __lhs A %xor_combine random number generator object. * @param __rhs Another %xor_combine random number generator * object. * * @returns true if the two objects are not equal, false otherwise. */ friend bool operator!=(const xor_combine& __lhs, const xor_combine& __rhs) { return !(__lhs == __rhs); } /** * Inserts the current state of a %xor_combine random number * generator engine @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %xor_combine random number generator engine. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<class _UniformRandomNumberGenerator11, int __s11, class _UniformRandomNumberGenerator21, int __s21, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const xor_combine<_UniformRandomNumberGenerator11, __s11, _UniformRandomNumberGenerator21, __s21>& __x); /** * Extracts the current state of a %xor_combine random number * generator engine @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %xor_combine random number generator engine. * * @returns The input stream with the state of @p __x extracted or in * an error state. */ template<class _UniformRandomNumberGenerator11, int __s11, class _UniformRandomNumberGenerator21, int __s21, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, xor_combine<_UniformRandomNumberGenerator11, __s11, _UniformRandomNumberGenerator21, __s21>& __x); private: void _M_initialize_max(); result_type _M_initialize_max_aux(result_type, result_type, int); base1_type _M_b1; base2_type _M_b2; result_type _M_max; }; /** * A standard interface to a platform-specific non-deterministic * random number generator (if any are available). */ class random_device { public: // types typedef unsigned int result_type; // constructors, destructors and member functions #ifdef _GLIBCXX_USE_RANDOM_TR1 explicit random_device(const std::string& __token = "/dev/urandom") { if ((__token != "/dev/urandom" && __token != "/dev/random") || !(_M_file = std::fopen(__token.c_str(), "rb"))) std::__throw_runtime_error(__N("random_device::" "random_device(const std::string&)")); } ~random_device() { std::fclose(_M_file); } #else explicit random_device(const std::string& __token = "mt19937") : _M_mt(_M_strtoul(__token)) { } private: static unsigned long _M_strtoul(const std::string& __str) { unsigned long __ret = 5489UL; if (__str != "mt19937") { const char* __nptr = __str.c_str(); char* __endptr; __ret = std::strtoul(__nptr, &__endptr, 0); if (*__nptr == '\0' || *__endptr != '\0') std::__throw_runtime_error(__N("random_device::_M_strtoul" "(const std::string&)")); } return __ret; } public: #endif result_type min() const { return std::numeric_limits<result_type>::min(); } result_type max() const { return std::numeric_limits<result_type>::max(); } double entropy() const { return 0.0; } result_type operator()() { #ifdef _GLIBCXX_USE_RANDOM_TR1 result_type __ret; std::fread(reinterpret_cast<void*>(&__ret), sizeof(result_type), 1, _M_file); return __ret; #else return _M_mt(); #endif } private: random_device(const random_device&); void operator=(const random_device&); #ifdef _GLIBCXX_USE_RANDOM_TR1 FILE* _M_file; #else mt19937 _M_mt; #endif }; /* @} */ // group tr1_random_generators /** * @addtogroup tr1_random_distributions Random Number Distributions * @ingroup tr1_random * @{ */ /** * @addtogroup tr1_random_distributions_discrete Discrete Distributions * @ingroup tr1_random_distributions * @{ */ /** * @brief Uniform discrete distribution for random numbers. * A discrete random distribution on the range @f$[min, max]@f$ with equal * probability throughout the range. */ template<typename _IntType = int> class uniform_int { __glibcxx_class_requires(_IntType, _IntegerConcept) public: /** The type of the parameters of the distribution. */ typedef _IntType input_type; /** The type of the range of the distribution. */ typedef _IntType result_type; public: /** * Constructs a uniform distribution object. */ explicit uniform_int(_IntType __min = 0, _IntType __max = 9) : _M_min(__min), _M_max(__max) { _GLIBCXX_DEBUG_ASSERT(_M_min <= _M_max); } /** * Gets the inclusive lower bound of the distribution range. */ result_type min() const { return _M_min; } /** * Gets the inclusive upper bound of the distribution range. */ result_type max() const { return _M_max; } /** * Resets the distribution state. * * Does nothing for the uniform integer distribution. */ void reset() { } /** * Gets a uniformly distributed random number in the range * @f$(min, max)@f$. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { typedef typename _UniformRandomNumberGenerator::result_type _UResult_type; return _M_call(__urng, _M_min, _M_max, typename is_integral<_UResult_type>::type()); } /** * Gets a uniform random number in the range @f$[0, n)@f$. * * This function is aimed at use with std::random_shuffle. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, result_type __n) { typedef typename _UniformRandomNumberGenerator::result_type _UResult_type; return _M_call(__urng, 0, __n - 1, typename is_integral<_UResult_type>::type()); } /** * Inserts a %uniform_int random number distribution @p __x into the * output stream @p os. * * @param __os An output stream. * @param __x A %uniform_int random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _IntType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const uniform_int<_IntType1>& __x); /** * Extracts a %uniform_int random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %uniform_int random number generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _IntType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, uniform_int<_IntType1>& __x); private: template<typename _UniformRandomNumberGenerator> result_type _M_call(_UniformRandomNumberGenerator& __urng, result_type __min, result_type __max, true_type); template<typename _UniformRandomNumberGenerator> result_type _M_call(_UniformRandomNumberGenerator& __urng, result_type __min, result_type __max, false_type) { return result_type((__urng() - __urng.min()) / (__urng.max() - __urng.min()) * (__max - __min + 1)) + __min; } _IntType _M_min; _IntType _M_max; }; /** * @brief A Bernoulli random number distribution. * * Generates a sequence of true and false values with likelihood @f$ p @f$ * that true will come up and @f$ (1 - p) @f$ that false will appear. */ class bernoulli_distribution { public: typedef int input_type; typedef bool result_type; public: /** * Constructs a Bernoulli distribution with likelihood @p p. * * @param __p [IN] The likelihood of a true result being returned. Must * be in the interval @f$ [0, 1] @f$. */ explicit bernoulli_distribution(double __p = 0.5) : _M_p(__p) { _GLIBCXX_DEBUG_ASSERT((_M_p >= 0.0) && (_M_p <= 1.0)); } /** * Gets the @p p parameter of the distribution. */ double p() const { return _M_p; } /** * Resets the distribution state. * * Does nothing for a Bernoulli distribution. */ void reset() { } /** * Gets the next value in the Bernoullian sequence. */ template<class _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { if ((__urng() - __urng.min()) < _M_p * (__urng.max() - __urng.min())) return true; return false; } /** * Inserts a %bernoulli_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %bernoulli_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const bernoulli_distribution& __x); /** * Extracts a %bernoulli_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %bernoulli_distribution random number generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, bernoulli_distribution& __x) { return __is >> __x._M_p; } private: double _M_p; }; /** * @brief A discrete geometric random number distribution. * * The formula for the geometric probability mass function is * @f$ p(i) = (1 - p)p^{i-1} @f$ where @f$ p @f$ is the parameter of the * distribution. */ template<typename _IntType = int, typename _RealType = double> class geometric_distribution { public: // types typedef _RealType input_type; typedef _IntType result_type; // constructors and member function explicit geometric_distribution(const _RealType& __p = _RealType(0.5)) : _M_p(__p) { _GLIBCXX_DEBUG_ASSERT((_M_p > 0.0) && (_M_p < 1.0)); _M_initialize(); } /** * Gets the distribution parameter @p p. */ _RealType p() const { return _M_p; } void reset() { } template<class _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng); /** * Inserts a %geometric_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %geometric_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _IntType1, typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const geometric_distribution<_IntType1, _RealType1>& __x); /** * Extracts a %geometric_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %geometric_distribution random number generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, geometric_distribution& __x) { __is >> __x._M_p; __x._M_initialize(); return __is; } private: void _M_initialize() { _M_log_p = std::log(_M_p); } _RealType _M_p; _RealType _M_log_p; }; template<typename _RealType> class normal_distribution; /** * @brief A discrete Poisson random number distribution. * * The formula for the Poisson probability mass function is * @f$ p(i) = \frac{mean^i}{i!} e^{-mean} @f$ where @f$ mean @f$ is the * parameter of the distribution. */ template<typename _IntType = int, typename _RealType = double> class poisson_distribution { public: // types typedef _RealType input_type; typedef _IntType result_type; // constructors and member function explicit poisson_distribution(const _RealType& __mean = _RealType(1)) : _M_mean(__mean), _M_nd() { _GLIBCXX_DEBUG_ASSERT(_M_mean > 0.0); _M_initialize(); } /** * Gets the distribution parameter @p mean. */ _RealType mean() const { return _M_mean; } void reset() { _M_nd.reset(); } template<class _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng); /** * Inserts a %poisson_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %poisson_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _IntType1, typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const poisson_distribution<_IntType1, _RealType1>& __x); /** * Extracts a %poisson_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %poisson_distribution random number generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _IntType1, typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, poisson_distribution<_IntType1, _RealType1>& __x); private: void _M_initialize(); // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined. normal_distribution<_RealType> _M_nd; _RealType _M_mean; // Hosts either log(mean) or the threshold of the simple method. _RealType _M_lm_thr; #if _GLIBCXX_USE_C99_MATH_TR1 _RealType _M_lfm, _M_sm, _M_d, _M_scx, _M_1cx, _M_c2b, _M_cb; #endif }; /** * @brief A discrete binomial random number distribution. * * The formula for the binomial probability mass function is * @f$ p(i) = \binom{n}{i} p^i (1 - p)^{t - i} @f$ where @f$ t @f$ * and @f$ p @f$ are the parameters of the distribution. */ template<typename _IntType = int, typename _RealType = double> class binomial_distribution { public: // types typedef _RealType input_type; typedef _IntType result_type; // constructors and member function explicit binomial_distribution(_IntType __t = 1, const _RealType& __p = _RealType(0.5)) : _M_t(__t), _M_p(__p), _M_nd() { _GLIBCXX_DEBUG_ASSERT((_M_t >= 0) && (_M_p >= 0.0) && (_M_p <= 1.0)); _M_initialize(); } /** * Gets the distribution @p t parameter. */ _IntType t() const { return _M_t; } /** * Gets the distribution @p p parameter. */ _RealType p() const { return _M_p; } void reset() { _M_nd.reset(); } template<class _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng); /** * Inserts a %binomial_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %binomial_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _IntType1, typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const binomial_distribution<_IntType1, _RealType1>& __x); /** * Extracts a %binomial_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %binomial_distribution random number generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _IntType1, typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, binomial_distribution<_IntType1, _RealType1>& __x); private: void _M_initialize(); template<class _UniformRandomNumberGenerator> result_type _M_waiting(_UniformRandomNumberGenerator& __urng, _IntType __t); // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined. normal_distribution<_RealType> _M_nd; _RealType _M_q; #if _GLIBCXX_USE_C99_MATH_TR1 _RealType _M_d1, _M_d2, _M_s1, _M_s2, _M_c, _M_a1, _M_a123, _M_s, _M_lf, _M_lp1p; #endif _RealType _M_p; _IntType _M_t; bool _M_easy; }; /* @} */ // group tr1_random_distributions_discrete /** * @addtogroup tr1_random_distributions_continuous Continuous Distributions * @ingroup tr1_random_distributions * @{ */ /** * @brief Uniform continuous distribution for random numbers. * * A continuous random distribution on the range [min, max) with equal * probability throughout the range. The URNG should be real-valued and * deliver number in the range [0, 1). */ template<typename _RealType = double> class uniform_real { public: // types typedef _RealType input_type; typedef _RealType result_type; public: /** * Constructs a uniform_real object. * * @param __min [IN] The lower bound of the distribution. * @param __max [IN] The upper bound of the distribution. */ explicit uniform_real(_RealType __min = _RealType(0), _RealType __max = _RealType(1)) : _M_min(__min), _M_max(__max) { _GLIBCXX_DEBUG_ASSERT(_M_min <= _M_max); } result_type min() const { return _M_min; } result_type max() const { return _M_max; } void reset() { } template<class _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return (__urng() * (_M_max - _M_min)) + _M_min; } /** * Inserts a %uniform_real random number distribution @p __x into the * output stream @p __os. * * @param __os An output stream. * @param __x A %uniform_real random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const uniform_real<_RealType1>& __x); /** * Extracts a %uniform_real random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %uniform_real random number generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, uniform_real<_RealType1>& __x); private: _RealType _M_min; _RealType _M_max; }; /** * @brief An exponential continuous distribution for random numbers. * * The formula for the exponential probability mass function is * @f$ p(x) = \lambda e^{-\lambda x} @f$. * * <table border=1 cellpadding=10 cellspacing=0> * <caption align=top>Distribution Statistics</caption> * <tr><td>Mean</td><td>@f$ \frac{1}{\lambda} @f$</td></tr> * <tr><td>Median</td><td>@f$ \frac{\ln 2}{\lambda} @f$</td></tr> * <tr><td>Mode</td><td>@f$ zero @f$</td></tr> * <tr><td>Range</td><td>@f$[0, \infty]@f$</td></tr> * <tr><td>Standard Deviation</td><td>@f$ \frac{1}{\lambda} @f$</td></tr> * </table> */ template<typename _RealType = double> class exponential_distribution { public: // types typedef _RealType input_type; typedef _RealType result_type; public: /** * Constructs an exponential distribution with inverse scale parameter * @f$ \lambda @f$. */ explicit exponential_distribution(const result_type& __lambda = result_type(1)) : _M_lambda(__lambda) { _GLIBCXX_DEBUG_ASSERT(_M_lambda > 0); } /** * Gets the inverse scale parameter of the distribution. */ _RealType lambda() const { return _M_lambda; } /** * Resets the distribution. * * Has no effect on exponential distributions. */ void reset() { } template<class _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return -std::log(__urng()) / _M_lambda; } /** * Inserts a %exponential_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %exponential_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const exponential_distribution<_RealType1>& __x); /** * Extracts a %exponential_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %exponential_distribution random number * generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, exponential_distribution& __x) { return __is >> __x._M_lambda; } private: result_type _M_lambda; }; /** * @brief A normal continuous distribution for random numbers. * * The formula for the normal probability mass function is * @f$ p(x) = \frac{1}{\sigma \sqrt{2 \pi}} * e^{- \frac{{x - mean}^ {2}}{2 \sigma ^ {2}} } @f$. */ template<typename _RealType = double> class normal_distribution { public: // types typedef _RealType input_type; typedef _RealType result_type; public: /** * Constructs a normal distribution with parameters @f$ mean @f$ and * @f$ \sigma @f$. */ explicit normal_distribution(const result_type& __mean = result_type(0), const result_type& __sigma = result_type(1)) : _M_mean(__mean), _M_sigma(__sigma), _M_saved_available(false) { _GLIBCXX_DEBUG_ASSERT(_M_sigma > 0); } /** * Gets the mean of the distribution. */ _RealType mean() const { return _M_mean; } /** * Gets the @f$ \sigma @f$ of the distribution. */ _RealType sigma() const { return _M_sigma; } /** * Resets the distribution. */ void reset() { _M_saved_available = false; } template<class _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng); /** * Inserts a %normal_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %normal_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const normal_distribution<_RealType1>& __x); /** * Extracts a %normal_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %normal_distribution random number generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, normal_distribution<_RealType1>& __x); private: result_type _M_mean; result_type _M_sigma; result_type _M_saved; bool _M_saved_available; }; /** * @brief A gamma continuous distribution for random numbers. * * The formula for the gamma probability mass function is * @f$ p(x) = \frac{1}{\Gamma(\alpha)} x^{\alpha - 1} e^{-x} @f$. */ template<typename _RealType = double> class gamma_distribution { public: // types typedef _RealType input_type; typedef _RealType result_type; public: /** * Constructs a gamma distribution with parameters @f$ \alpha @f$. */ explicit gamma_distribution(const result_type& __alpha_val = result_type(1)) : _M_alpha(__alpha_val) { _GLIBCXX_DEBUG_ASSERT(_M_alpha > 0); _M_initialize(); } /** * Gets the @f$ \alpha @f$ of the distribution. */ _RealType alpha() const { return _M_alpha; } /** * Resets the distribution. */ void reset() { } template<class _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng); /** * Inserts a %gamma_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %gamma_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const gamma_distribution<_RealType1>& __x); /** * Extracts a %gamma_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %gamma_distribution random number generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, gamma_distribution& __x) { __is >> __x._M_alpha; __x._M_initialize(); return __is; } private: void _M_initialize(); result_type _M_alpha; // Hosts either lambda of GB or d of modified Vaduva's. result_type _M_l_d; }; /* @} */ // group tr1_random_distributions_continuous /* @} */ // group tr1_random_distributions /* @} */ // group tr1_random _GLIBCXX_END_NAMESPACE_VERSION } } #endif // _GLIBCXX_TR1_RANDOM_H �����������������������c++/4.8.2/tr1/cstdio��������������������������������������������������������������������������������0000644�����������������00000002704�14763166027�0007522 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 cstdio -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/cstdio * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_CSTDIO #define _GLIBCXX_TR1_CSTDIO 1 #pragma GCC system_header #include <cstdio> #if _GLIBCXX_USE_C99 namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { using std::snprintf; using std::vsnprintf; using std::vfscanf; using std::vscanf; using std::vsscanf; } } #endif #endif // _GLIBCXX_TR1_CSTDIO ������������������������������������������������������������c++/4.8.2/tr1/type_traits���������������������������������������������������������������������������0000644�����������������00000045113�14763166027�0010605 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 type_traits -*- C++ -*- // Copyright (C) 2004-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/type_traits * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_TYPE_TRAITS #define _GLIBCXX_TR1_TYPE_TRAITS 1 #pragma GCC system_header #include <bits/c++config.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup metaprogramming * @{ */ struct __sfinae_types { typedef char __one; typedef struct { char __arr[2]; } __two; }; #define _DEFINE_SPEC_0_HELPER \ template<> #define _DEFINE_SPEC_1_HELPER \ template<typename _Tp> #define _DEFINE_SPEC_2_HELPER \ template<typename _Tp, typename _Cp> #define _DEFINE_SPEC(_Order, _Trait, _Type, _Value) \ _DEFINE_SPEC_##_Order##_HELPER \ struct _Trait<_Type> \ : public integral_constant<bool, _Value> { }; // helper classes [4.3]. /// integral_constant template<typename _Tp, _Tp __v> struct integral_constant { static const _Tp value = __v; typedef _Tp value_type; typedef integral_constant<_Tp, __v> type; }; /// typedef for true_type typedef integral_constant<bool, true> true_type; /// typedef for false_type typedef integral_constant<bool, false> false_type; template<typename _Tp, _Tp __v> const _Tp integral_constant<_Tp, __v>::value; /// remove_cv template<typename> struct remove_cv; template<typename> struct __is_void_helper : public false_type { }; _DEFINE_SPEC(0, __is_void_helper, void, true) // primary type categories [4.5.1]. /// is_void template<typename _Tp> struct is_void : public integral_constant<bool, (__is_void_helper<typename remove_cv<_Tp>::type>::value)> { }; template<typename> struct __is_integral_helper : public false_type { }; _DEFINE_SPEC(0, __is_integral_helper, bool, true) _DEFINE_SPEC(0, __is_integral_helper, char, true) _DEFINE_SPEC(0, __is_integral_helper, signed char, true) _DEFINE_SPEC(0, __is_integral_helper, unsigned char, true) #ifdef _GLIBCXX_USE_WCHAR_T _DEFINE_SPEC(0, __is_integral_helper, wchar_t, true) #endif _DEFINE_SPEC(0, __is_integral_helper, short, true) _DEFINE_SPEC(0, __is_integral_helper, unsigned short, true) _DEFINE_SPEC(0, __is_integral_helper, int, true) _DEFINE_SPEC(0, __is_integral_helper, unsigned int, true) _DEFINE_SPEC(0, __is_integral_helper, long, true) _DEFINE_SPEC(0, __is_integral_helper, unsigned long, true) _DEFINE_SPEC(0, __is_integral_helper, long long, true) _DEFINE_SPEC(0, __is_integral_helper, unsigned long long, true) /// is_integral template<typename _Tp> struct is_integral : public integral_constant<bool, (__is_integral_helper<typename remove_cv<_Tp>::type>::value)> { }; template<typename> struct __is_floating_point_helper : public false_type { }; _DEFINE_SPEC(0, __is_floating_point_helper, float, true) _DEFINE_SPEC(0, __is_floating_point_helper, double, true) _DEFINE_SPEC(0, __is_floating_point_helper, long double, true) /// is_floating_point template<typename _Tp> struct is_floating_point : public integral_constant<bool, (__is_floating_point_helper<typename remove_cv<_Tp>::type>::value)> { }; /// is_array template<typename> struct is_array : public false_type { }; template<typename _Tp, std::size_t _Size> struct is_array<_Tp[_Size]> : public true_type { }; template<typename _Tp> struct is_array<_Tp[]> : public true_type { }; template<typename> struct __is_pointer_helper : public false_type { }; _DEFINE_SPEC(1, __is_pointer_helper, _Tp*, true) /// is_pointer template<typename _Tp> struct is_pointer : public integral_constant<bool, (__is_pointer_helper<typename remove_cv<_Tp>::type>::value)> { }; /// is_reference template<typename _Tp> struct is_reference; /// is_function template<typename _Tp> struct is_function; template<typename> struct __is_member_object_pointer_helper : public false_type { }; _DEFINE_SPEC(2, __is_member_object_pointer_helper, _Tp _Cp::*, !is_function<_Tp>::value) /// is_member_object_pointer template<typename _Tp> struct is_member_object_pointer : public integral_constant<bool, (__is_member_object_pointer_helper< typename remove_cv<_Tp>::type>::value)> { }; template<typename> struct __is_member_function_pointer_helper : public false_type { }; _DEFINE_SPEC(2, __is_member_function_pointer_helper, _Tp _Cp::*, is_function<_Tp>::value) /// is_member_function_pointer template<typename _Tp> struct is_member_function_pointer : public integral_constant<bool, (__is_member_function_pointer_helper< typename remove_cv<_Tp>::type>::value)> { }; /// is_enum template<typename _Tp> struct is_enum : public integral_constant<bool, __is_enum(_Tp)> { }; /// is_union template<typename _Tp> struct is_union : public integral_constant<bool, __is_union(_Tp)> { }; /// is_class template<typename _Tp> struct is_class : public integral_constant<bool, __is_class(_Tp)> { }; /// is_function template<typename> struct is_function : public false_type { }; template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes...)> : public true_type { }; template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes......)> : public true_type { }; template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes...) const> : public true_type { }; template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes......) const> : public true_type { }; template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes...) volatile> : public true_type { }; template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes......) volatile> : public true_type { }; template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes...) const volatile> : public true_type { }; template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes......) const volatile> : public true_type { }; // composite type traits [4.5.2]. /// is_arithmetic template<typename _Tp> struct is_arithmetic : public integral_constant<bool, (is_integral<_Tp>::value || is_floating_point<_Tp>::value)> { }; /// is_fundamental template<typename _Tp> struct is_fundamental : public integral_constant<bool, (is_arithmetic<_Tp>::value || is_void<_Tp>::value)> { }; /// is_object template<typename _Tp> struct is_object : public integral_constant<bool, !(is_function<_Tp>::value || is_reference<_Tp>::value || is_void<_Tp>::value)> { }; /// is_member_pointer template<typename _Tp> struct is_member_pointer; /// is_scalar template<typename _Tp> struct is_scalar : public integral_constant<bool, (is_arithmetic<_Tp>::value || is_enum<_Tp>::value || is_pointer<_Tp>::value || is_member_pointer<_Tp>::value)> { }; /// is_compound template<typename _Tp> struct is_compound : public integral_constant<bool, !is_fundamental<_Tp>::value> { }; /// is_member_pointer template<typename _Tp> struct __is_member_pointer_helper : public false_type { }; _DEFINE_SPEC(2, __is_member_pointer_helper, _Tp _Cp::*, true) template<typename _Tp> struct is_member_pointer : public integral_constant<bool, (__is_member_pointer_helper< typename remove_cv<_Tp>::type>::value)> { }; // type properties [4.5.3]. /// is_const template<typename> struct is_const : public false_type { }; template<typename _Tp> struct is_const<_Tp const> : public true_type { }; /// is_volatile template<typename> struct is_volatile : public false_type { }; template<typename _Tp> struct is_volatile<_Tp volatile> : public true_type { }; /// is_empty template<typename _Tp> struct is_empty : public integral_constant<bool, __is_empty(_Tp)> { }; /// is_polymorphic template<typename _Tp> struct is_polymorphic : public integral_constant<bool, __is_polymorphic(_Tp)> { }; /// is_abstract template<typename _Tp> struct is_abstract : public integral_constant<bool, __is_abstract(_Tp)> { }; /// has_virtual_destructor template<typename _Tp> struct has_virtual_destructor : public integral_constant<bool, __has_virtual_destructor(_Tp)> { }; /// alignment_of template<typename _Tp> struct alignment_of : public integral_constant<std::size_t, __alignof__(_Tp)> { }; /// rank template<typename> struct rank : public integral_constant<std::size_t, 0> { }; template<typename _Tp, std::size_t _Size> struct rank<_Tp[_Size]> : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; template<typename _Tp> struct rank<_Tp[]> : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; /// extent template<typename, unsigned _Uint = 0> struct extent : public integral_constant<std::size_t, 0> { }; template<typename _Tp, unsigned _Uint, std::size_t _Size> struct extent<_Tp[_Size], _Uint> : public integral_constant<std::size_t, _Uint == 0 ? _Size : extent<_Tp, _Uint - 1>::value> { }; template<typename _Tp, unsigned _Uint> struct extent<_Tp[], _Uint> : public integral_constant<std::size_t, _Uint == 0 ? 0 : extent<_Tp, _Uint - 1>::value> { }; // relationships between types [4.6]. /// is_same template<typename, typename> struct is_same : public false_type { }; template<typename _Tp> struct is_same<_Tp, _Tp> : public true_type { }; // const-volatile modifications [4.7.1]. /// remove_const template<typename _Tp> struct remove_const { typedef _Tp type; }; template<typename _Tp> struct remove_const<_Tp const> { typedef _Tp type; }; /// remove_volatile template<typename _Tp> struct remove_volatile { typedef _Tp type; }; template<typename _Tp> struct remove_volatile<_Tp volatile> { typedef _Tp type; }; /// remove_cv template<typename _Tp> struct remove_cv { typedef typename remove_const<typename remove_volatile<_Tp>::type>::type type; }; /// add_const template<typename _Tp> struct add_const { typedef _Tp const type; }; /// add_volatile template<typename _Tp> struct add_volatile { typedef _Tp volatile type; }; /// add_cv template<typename _Tp> struct add_cv { typedef typename add_const<typename add_volatile<_Tp>::type>::type type; }; // array modifications [4.7.3]. /// remove_extent template<typename _Tp> struct remove_extent { typedef _Tp type; }; template<typename _Tp, std::size_t _Size> struct remove_extent<_Tp[_Size]> { typedef _Tp type; }; template<typename _Tp> struct remove_extent<_Tp[]> { typedef _Tp type; }; /// remove_all_extents template<typename _Tp> struct remove_all_extents { typedef _Tp type; }; template<typename _Tp, std::size_t _Size> struct remove_all_extents<_Tp[_Size]> { typedef typename remove_all_extents<_Tp>::type type; }; template<typename _Tp> struct remove_all_extents<_Tp[]> { typedef typename remove_all_extents<_Tp>::type type; }; // pointer modifications [4.7.4]. template<typename _Tp, typename> struct __remove_pointer_helper { typedef _Tp type; }; template<typename _Tp, typename _Up> struct __remove_pointer_helper<_Tp, _Up*> { typedef _Up type; }; /// remove_pointer template<typename _Tp> struct remove_pointer : public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type> { }; template<typename> struct remove_reference; /// add_pointer template<typename _Tp> struct add_pointer { typedef typename remove_reference<_Tp>::type* type; }; template<typename> struct is_reference : public false_type { }; template<typename _Tp> struct is_reference<_Tp&> : public true_type { }; template<typename _Tp> struct is_pod : public integral_constant<bool, __is_pod(_Tp) || is_void<_Tp>::value> { }; template<typename _Tp> struct has_trivial_constructor : public integral_constant<bool, is_pod<_Tp>::value> { }; template<typename _Tp> struct has_trivial_copy : public integral_constant<bool, is_pod<_Tp>::value> { }; template<typename _Tp> struct has_trivial_assign : public integral_constant<bool, is_pod<_Tp>::value> { }; template<typename _Tp> struct has_trivial_destructor : public integral_constant<bool, is_pod<_Tp>::value> { }; template<typename _Tp> struct has_nothrow_constructor : public integral_constant<bool, is_pod<_Tp>::value> { }; template<typename _Tp> struct has_nothrow_copy : public integral_constant<bool, is_pod<_Tp>::value> { }; template<typename _Tp> struct has_nothrow_assign : public integral_constant<bool, is_pod<_Tp>::value> { }; template<typename> struct __is_signed_helper : public false_type { }; _DEFINE_SPEC(0, __is_signed_helper, signed char, true) _DEFINE_SPEC(0, __is_signed_helper, short, true) _DEFINE_SPEC(0, __is_signed_helper, int, true) _DEFINE_SPEC(0, __is_signed_helper, long, true) _DEFINE_SPEC(0, __is_signed_helper, long long, true) template<typename _Tp> struct is_signed : public integral_constant<bool, (__is_signed_helper<typename remove_cv<_Tp>::type>::value)> { }; template<typename> struct __is_unsigned_helper : public false_type { }; _DEFINE_SPEC(0, __is_unsigned_helper, unsigned char, true) _DEFINE_SPEC(0, __is_unsigned_helper, unsigned short, true) _DEFINE_SPEC(0, __is_unsigned_helper, unsigned int, true) _DEFINE_SPEC(0, __is_unsigned_helper, unsigned long, true) _DEFINE_SPEC(0, __is_unsigned_helper, unsigned long long, true) template<typename _Tp> struct is_unsigned : public integral_constant<bool, (__is_unsigned_helper<typename remove_cv<_Tp>::type>::value)> { }; template<typename _Base, typename _Derived> struct __is_base_of_helper { typedef typename remove_cv<_Base>::type _NoCv_Base; typedef typename remove_cv<_Derived>::type _NoCv_Derived; static const bool __value = (is_same<_Base, _Derived>::value || (__is_base_of(_Base, _Derived) && !is_same<_NoCv_Base, _NoCv_Derived>::value)); }; template<typename _Base, typename _Derived> struct is_base_of : public integral_constant<bool, __is_base_of_helper<_Base, _Derived>::__value> { }; template<typename _From, typename _To> struct __is_convertible_simple : public __sfinae_types { private: static __one __test(_To); static __two __test(...); static _From __makeFrom(); public: static const bool __value = sizeof(__test(__makeFrom())) == 1; }; template<typename _Tp> struct add_reference; template<typename _Tp> struct __is_int_or_cref { typedef typename remove_reference<_Tp>::type __rr_Tp; static const bool __value = (is_integral<_Tp>::value || (is_integral<__rr_Tp>::value && is_const<__rr_Tp>::value && !is_volatile<__rr_Tp>::value)); }; template<typename _From, typename _To, bool = (is_void<_From>::value || is_void<_To>::value || is_function<_To>::value || is_array<_To>::value // This special case is here only to avoid warnings. || (is_floating_point<typename remove_reference<_From>::type>::value && __is_int_or_cref<_To>::__value))> struct __is_convertible_helper { // "An imaginary lvalue of type From...". static const bool __value = (__is_convertible_simple<typename add_reference<_From>::type, _To>::__value); }; template<typename _From, typename _To> struct __is_convertible_helper<_From, _To, true> { static const bool __value = (is_void<_To>::value || (__is_int_or_cref<_To>::__value && !is_void<_From>::value)); }; template<typename _From, typename _To> struct is_convertible : public integral_constant<bool, __is_convertible_helper<_From, _To>::__value> { }; // reference modifications [4.7.2]. template<typename _Tp> struct remove_reference { typedef _Tp type; }; template<typename _Tp> struct remove_reference<_Tp&> { typedef _Tp type; }; // NB: Careful with reference to void. template<typename _Tp, bool = (is_void<_Tp>::value || is_reference<_Tp>::value)> struct __add_reference_helper { typedef _Tp& type; }; template<typename _Tp> struct __add_reference_helper<_Tp, true> { typedef _Tp type; }; template<typename _Tp> struct add_reference : public __add_reference_helper<_Tp> { }; // other transformations [4.8]. template<std::size_t _Len, std::size_t _Align> struct aligned_storage { union type { unsigned char __data[_Len]; struct __attribute__((__aligned__((_Align)))) { } __align; }; }; #undef _DEFINE_SPEC_0_HELPER #undef _DEFINE_SPEC_1_HELPER #undef _DEFINE_SPEC_2_HELPER #undef _DEFINE_SPEC /// @} group metaprogramming _GLIBCXX_END_NAMESPACE_VERSION } } #endif // _GLIBCXX_TR1_TYPE_TRAITS �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/bessel_function.tcc�������������������������������������������������������������������0000644�����������������00000053152�14763166027�0012172 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Special functions -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // // This library 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. // // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/bessel_function.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{tr1/cmath} */ // // ISO C++ 14882 TR1: 5.2 Special functions // // Written by Edward Smith-Rowland. // // References: // (1) Handbook of Mathematical Functions, // ed. Milton Abramowitz and Irene A. Stegun, // Dover Publications, // Section 9, pp. 355-434, Section 10 pp. 435-478 // (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl // (3) Numerical Recipes in C, by W. H. Press, S. A. Teukolsky, // W. T. Vetterling, B. P. Flannery, Cambridge University Press (1992), // 2nd ed, pp. 240-245 #ifndef _GLIBCXX_TR1_BESSEL_FUNCTION_TCC #define _GLIBCXX_TR1_BESSEL_FUNCTION_TCC 1 #include "special_function_util.h" namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { // [5.2] Special functions // Implementation-space details. namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Compute the gamma functions required by the Temme series * expansions of @f$ N_\nu(x) @f$ and @f$ K_\nu(x) @f$. * @f[ * \Gamma_1 = \frac{1}{2\mu} * [\frac{1}{\Gamma(1 - \mu)} - \frac{1}{\Gamma(1 + \mu)}] * @f] * and * @f[ * \Gamma_2 = \frac{1}{2} * [\frac{1}{\Gamma(1 - \mu)} + \frac{1}{\Gamma(1 + \mu)}] * @f] * where @f$ -1/2 <= \mu <= 1/2 @f$ is @f$ \mu = \nu - N @f$ and @f$ N @f$. * is the nearest integer to @f$ \nu @f$. * The values of \f$ \Gamma(1 + \mu) \f$ and \f$ \Gamma(1 - \mu) \f$ * are returned as well. * * The accuracy requirements on this are exquisite. * * @param __mu The input parameter of the gamma functions. * @param __gam1 The output function \f$ \Gamma_1(\mu) \f$ * @param __gam2 The output function \f$ \Gamma_2(\mu) \f$ * @param __gampl The output function \f$ \Gamma(1 + \mu) \f$ * @param __gammi The output function \f$ \Gamma(1 - \mu) \f$ */ template <typename _Tp> void __gamma_temme(_Tp __mu, _Tp & __gam1, _Tp & __gam2, _Tp & __gampl, _Tp & __gammi) { #if _GLIBCXX_USE_C99_MATH_TR1 __gampl = _Tp(1) / std::tr1::tgamma(_Tp(1) + __mu); __gammi = _Tp(1) / std::tr1::tgamma(_Tp(1) - __mu); #else __gampl = _Tp(1) / __gamma(_Tp(1) + __mu); __gammi = _Tp(1) / __gamma(_Tp(1) - __mu); #endif if (std::abs(__mu) < std::numeric_limits<_Tp>::epsilon()) __gam1 = -_Tp(__numeric_constants<_Tp>::__gamma_e()); else __gam1 = (__gammi - __gampl) / (_Tp(2) * __mu); __gam2 = (__gammi + __gampl) / (_Tp(2)); return; } /** * @brief Compute the Bessel @f$ J_\nu(x) @f$ and Neumann * @f$ N_\nu(x) @f$ functions and their first derivatives * @f$ J'_\nu(x) @f$ and @f$ N'_\nu(x) @f$ respectively. * These four functions are computed together for numerical * stability. * * @param __nu The order of the Bessel functions. * @param __x The argument of the Bessel functions. * @param __Jnu The output Bessel function of the first kind. * @param __Nnu The output Neumann function (Bessel function of the second kind). * @param __Jpnu The output derivative of the Bessel function of the first kind. * @param __Npnu The output derivative of the Neumann function. */ template <typename _Tp> void __bessel_jn(_Tp __nu, _Tp __x, _Tp & __Jnu, _Tp & __Nnu, _Tp & __Jpnu, _Tp & __Npnu) { if (__x == _Tp(0)) { if (__nu == _Tp(0)) { __Jnu = _Tp(1); __Jpnu = _Tp(0); } else if (__nu == _Tp(1)) { __Jnu = _Tp(0); __Jpnu = _Tp(0.5L); } else { __Jnu = _Tp(0); __Jpnu = _Tp(0); } __Nnu = -std::numeric_limits<_Tp>::infinity(); __Npnu = std::numeric_limits<_Tp>::infinity(); return; } const _Tp __eps = std::numeric_limits<_Tp>::epsilon(); // When the multiplier is N i.e. // fp_min = N * min() // Then J_0 and N_0 tank at x = 8 * N (J_0 = 0 and N_0 = nan)! //const _Tp __fp_min = _Tp(20) * std::numeric_limits<_Tp>::min(); const _Tp __fp_min = std::sqrt(std::numeric_limits<_Tp>::min()); const int __max_iter = 15000; const _Tp __x_min = _Tp(2); const int __nl = (__x < __x_min ? static_cast<int>(__nu + _Tp(0.5L)) : std::max(0, static_cast<int>(__nu - __x + _Tp(1.5L)))); const _Tp __mu = __nu - __nl; const _Tp __mu2 = __mu * __mu; const _Tp __xi = _Tp(1) / __x; const _Tp __xi2 = _Tp(2) * __xi; _Tp __w = __xi2 / __numeric_constants<_Tp>::__pi(); int __isign = 1; _Tp __h = __nu * __xi; if (__h < __fp_min) __h = __fp_min; _Tp __b = __xi2 * __nu; _Tp __d = _Tp(0); _Tp __c = __h; int __i; for (__i = 1; __i <= __max_iter; ++__i) { __b += __xi2; __d = __b - __d; if (std::abs(__d) < __fp_min) __d = __fp_min; __c = __b - _Tp(1) / __c; if (std::abs(__c) < __fp_min) __c = __fp_min; __d = _Tp(1) / __d; const _Tp __del = __c * __d; __h *= __del; if (__d < _Tp(0)) __isign = -__isign; if (std::abs(__del - _Tp(1)) < __eps) break; } if (__i > __max_iter) std::__throw_runtime_error(__N("Argument x too large in __bessel_jn; " "try asymptotic expansion.")); _Tp __Jnul = __isign * __fp_min; _Tp __Jpnul = __h * __Jnul; _Tp __Jnul1 = __Jnul; _Tp __Jpnu1 = __Jpnul; _Tp __fact = __nu * __xi; for ( int __l = __nl; __l >= 1; --__l ) { const _Tp __Jnutemp = __fact * __Jnul + __Jpnul; __fact -= __xi; __Jpnul = __fact * __Jnutemp - __Jnul; __Jnul = __Jnutemp; } if (__Jnul == _Tp(0)) __Jnul = __eps; _Tp __f= __Jpnul / __Jnul; _Tp __Nmu, __Nnu1, __Npmu, __Jmu; if (__x < __x_min) { const _Tp __x2 = __x / _Tp(2); const _Tp __pimu = __numeric_constants<_Tp>::__pi() * __mu; _Tp __fact = (std::abs(__pimu) < __eps ? _Tp(1) : __pimu / std::sin(__pimu)); _Tp __d = -std::log(__x2); _Tp __e = __mu * __d; _Tp __fact2 = (std::abs(__e) < __eps ? _Tp(1) : std::sinh(__e) / __e); _Tp __gam1, __gam2, __gampl, __gammi; __gamma_temme(__mu, __gam1, __gam2, __gampl, __gammi); _Tp __ff = (_Tp(2) / __numeric_constants<_Tp>::__pi()) * __fact * (__gam1 * std::cosh(__e) + __gam2 * __fact2 * __d); __e = std::exp(__e); _Tp __p = __e / (__numeric_constants<_Tp>::__pi() * __gampl); _Tp __q = _Tp(1) / (__e * __numeric_constants<_Tp>::__pi() * __gammi); const _Tp __pimu2 = __pimu / _Tp(2); _Tp __fact3 = (std::abs(__pimu2) < __eps ? _Tp(1) : std::sin(__pimu2) / __pimu2 ); _Tp __r = __numeric_constants<_Tp>::__pi() * __pimu2 * __fact3 * __fact3; _Tp __c = _Tp(1); __d = -__x2 * __x2; _Tp __sum = __ff + __r * __q; _Tp __sum1 = __p; for (__i = 1; __i <= __max_iter; ++__i) { __ff = (__i * __ff + __p + __q) / (__i * __i - __mu2); __c *= __d / _Tp(__i); __p /= _Tp(__i) - __mu; __q /= _Tp(__i) + __mu; const _Tp __del = __c * (__ff + __r * __q); __sum += __del; const _Tp __del1 = __c * __p - __i * __del; __sum1 += __del1; if ( std::abs(__del) < __eps * (_Tp(1) + std::abs(__sum)) ) break; } if ( __i > __max_iter ) std::__throw_runtime_error(__N("Bessel y series failed to converge " "in __bessel_jn.")); __Nmu = -__sum; __Nnu1 = -__sum1 * __xi2; __Npmu = __mu * __xi * __Nmu - __Nnu1; __Jmu = __w / (__Npmu - __f * __Nmu); } else { _Tp __a = _Tp(0.25L) - __mu2; _Tp __q = _Tp(1); _Tp __p = -__xi / _Tp(2); _Tp __br = _Tp(2) * __x; _Tp __bi = _Tp(2); _Tp __fact = __a * __xi / (__p * __p + __q * __q); _Tp __cr = __br + __q * __fact; _Tp __ci = __bi + __p * __fact; _Tp __den = __br * __br + __bi * __bi; _Tp __dr = __br / __den; _Tp __di = -__bi / __den; _Tp __dlr = __cr * __dr - __ci * __di; _Tp __dli = __cr * __di + __ci * __dr; _Tp __temp = __p * __dlr - __q * __dli; __q = __p * __dli + __q * __dlr; __p = __temp; int __i; for (__i = 2; __i <= __max_iter; ++__i) { __a += _Tp(2 * (__i - 1)); __bi += _Tp(2); __dr = __a * __dr + __br; __di = __a * __di + __bi; if (std::abs(__dr) + std::abs(__di) < __fp_min) __dr = __fp_min; __fact = __a / (__cr * __cr + __ci * __ci); __cr = __br + __cr * __fact; __ci = __bi - __ci * __fact; if (std::abs(__cr) + std::abs(__ci) < __fp_min) __cr = __fp_min; __den = __dr * __dr + __di * __di; __dr /= __den; __di /= -__den; __dlr = __cr * __dr - __ci * __di; __dli = __cr * __di + __ci * __dr; __temp = __p * __dlr - __q * __dli; __q = __p * __dli + __q * __dlr; __p = __temp; if (std::abs(__dlr - _Tp(1)) + std::abs(__dli) < __eps) break; } if (__i > __max_iter) std::__throw_runtime_error(__N("Lentz's method failed " "in __bessel_jn.")); const _Tp __gam = (__p - __f) / __q; __Jmu = std::sqrt(__w / ((__p - __f) * __gam + __q)); #if _GLIBCXX_USE_C99_MATH_TR1 __Jmu = std::tr1::copysign(__Jmu, __Jnul); #else if (__Jmu * __Jnul < _Tp(0)) __Jmu = -__Jmu; #endif __Nmu = __gam * __Jmu; __Npmu = (__p + __q / __gam) * __Nmu; __Nnu1 = __mu * __xi * __Nmu - __Npmu; } __fact = __Jmu / __Jnul; __Jnu = __fact * __Jnul1; __Jpnu = __fact * __Jpnu1; for (__i = 1; __i <= __nl; ++__i) { const _Tp __Nnutemp = (__mu + __i) * __xi2 * __Nnu1 - __Nmu; __Nmu = __Nnu1; __Nnu1 = __Nnutemp; } __Nnu = __Nmu; __Npnu = __nu * __xi * __Nmu - __Nnu1; return; } /** * @brief This routine computes the asymptotic cylindrical Bessel * and Neumann functions of order nu: \f$ J_{\nu} \f$, * \f$ N_{\nu} \f$. * * References: * (1) Handbook of Mathematical Functions, * ed. Milton Abramowitz and Irene A. Stegun, * Dover Publications, * Section 9 p. 364, Equations 9.2.5-9.2.10 * * @param __nu The order of the Bessel functions. * @param __x The argument of the Bessel functions. * @param __Jnu The output Bessel function of the first kind. * @param __Nnu The output Neumann function (Bessel function of the second kind). */ template <typename _Tp> void __cyl_bessel_jn_asymp(_Tp __nu, _Tp __x, _Tp & __Jnu, _Tp & __Nnu) { const _Tp __mu = _Tp(4) * __nu * __nu; const _Tp __mum1 = __mu - _Tp(1); const _Tp __mum9 = __mu - _Tp(9); const _Tp __mum25 = __mu - _Tp(25); const _Tp __mum49 = __mu - _Tp(49); const _Tp __xx = _Tp(64) * __x * __x; const _Tp __P = _Tp(1) - __mum1 * __mum9 / (_Tp(2) * __xx) * (_Tp(1) - __mum25 * __mum49 / (_Tp(12) * __xx)); const _Tp __Q = __mum1 / (_Tp(8) * __x) * (_Tp(1) - __mum9 * __mum25 / (_Tp(6) * __xx)); const _Tp __chi = __x - (__nu + _Tp(0.5L)) * __numeric_constants<_Tp>::__pi_2(); const _Tp __c = std::cos(__chi); const _Tp __s = std::sin(__chi); const _Tp __coef = std::sqrt(_Tp(2) / (__numeric_constants<_Tp>::__pi() * __x)); __Jnu = __coef * (__c * __P - __s * __Q); __Nnu = __coef * (__s * __P + __c * __Q); return; } /** * @brief This routine returns the cylindrical Bessel functions * of order \f$ \nu \f$: \f$ J_{\nu} \f$ or \f$ I_{\nu} \f$ * by series expansion. * * The modified cylindrical Bessel function is: * @f[ * Z_{\nu}(x) = \sum_{k=0}^{\infty} * \frac{\sigma^k (x/2)^{\nu + 2k}}{k!\Gamma(\nu+k+1)} * @f] * where \f$ \sigma = +1 \f$ or\f$ -1 \f$ for * \f$ Z = I \f$ or \f$ J \f$ respectively. * * See Abramowitz & Stegun, 9.1.10 * Abramowitz & Stegun, 9.6.7 * (1) Handbook of Mathematical Functions, * ed. Milton Abramowitz and Irene A. Stegun, * Dover Publications, * Equation 9.1.10 p. 360 and Equation 9.6.10 p. 375 * * @param __nu The order of the Bessel function. * @param __x The argument of the Bessel function. * @param __sgn The sign of the alternate terms * -1 for the Bessel function of the first kind. * +1 for the modified Bessel function of the first kind. * @return The output Bessel function. */ template <typename _Tp> _Tp __cyl_bessel_ij_series(_Tp __nu, _Tp __x, _Tp __sgn, unsigned int __max_iter) { if (__x == _Tp(0)) return __nu == _Tp(0) ? _Tp(1) : _Tp(0); const _Tp __x2 = __x / _Tp(2); _Tp __fact = __nu * std::log(__x2); #if _GLIBCXX_USE_C99_MATH_TR1 __fact -= std::tr1::lgamma(__nu + _Tp(1)); #else __fact -= __log_gamma(__nu + _Tp(1)); #endif __fact = std::exp(__fact); const _Tp __xx4 = __sgn * __x2 * __x2; _Tp __Jn = _Tp(1); _Tp __term = _Tp(1); for (unsigned int __i = 1; __i < __max_iter; ++__i) { __term *= __xx4 / (_Tp(__i) * (__nu + _Tp(__i))); __Jn += __term; if (std::abs(__term / __Jn) < std::numeric_limits<_Tp>::epsilon()) break; } return __fact * __Jn; } /** * @brief Return the Bessel function of order \f$ \nu \f$: * \f$ J_{\nu}(x) \f$. * * The cylindrical Bessel function is: * @f[ * J_{\nu}(x) = \sum_{k=0}^{\infty} * \frac{(-1)^k (x/2)^{\nu + 2k}}{k!\Gamma(\nu+k+1)} * @f] * * @param __nu The order of the Bessel function. * @param __x The argument of the Bessel function. * @return The output Bessel function. */ template<typename _Tp> _Tp __cyl_bessel_j(_Tp __nu, _Tp __x) { if (__nu < _Tp(0) || __x < _Tp(0)) std::__throw_domain_error(__N("Bad argument " "in __cyl_bessel_j.")); else if (__isnan(__nu) || __isnan(__x)) return std::numeric_limits<_Tp>::quiet_NaN(); else if (__x * __x < _Tp(10) * (__nu + _Tp(1))) return __cyl_bessel_ij_series(__nu, __x, -_Tp(1), 200); else if (__x > _Tp(1000)) { _Tp __J_nu, __N_nu; __cyl_bessel_jn_asymp(__nu, __x, __J_nu, __N_nu); return __J_nu; } else { _Tp __J_nu, __N_nu, __Jp_nu, __Np_nu; __bessel_jn(__nu, __x, __J_nu, __N_nu, __Jp_nu, __Np_nu); return __J_nu; } } /** * @brief Return the Neumann function of order \f$ \nu \f$: * \f$ N_{\nu}(x) \f$. * * The Neumann function is defined by: * @f[ * N_{\nu}(x) = \frac{J_{\nu}(x) \cos \nu\pi - J_{-\nu}(x)} * {\sin \nu\pi} * @f] * where for integral \f$ \nu = n \f$ a limit is taken: * \f$ lim_{\nu \to n} \f$. * * @param __nu The order of the Neumann function. * @param __x The argument of the Neumann function. * @return The output Neumann function. */ template<typename _Tp> _Tp __cyl_neumann_n(_Tp __nu, _Tp __x) { if (__nu < _Tp(0) || __x < _Tp(0)) std::__throw_domain_error(__N("Bad argument " "in __cyl_neumann_n.")); else if (__isnan(__nu) || __isnan(__x)) return std::numeric_limits<_Tp>::quiet_NaN(); else if (__x > _Tp(1000)) { _Tp __J_nu, __N_nu; __cyl_bessel_jn_asymp(__nu, __x, __J_nu, __N_nu); return __N_nu; } else { _Tp __J_nu, __N_nu, __Jp_nu, __Np_nu; __bessel_jn(__nu, __x, __J_nu, __N_nu, __Jp_nu, __Np_nu); return __N_nu; } } /** * @brief Compute the spherical Bessel @f$ j_n(x) @f$ * and Neumann @f$ n_n(x) @f$ functions and their first * derivatives @f$ j'_n(x) @f$ and @f$ n'_n(x) @f$ * respectively. * * @param __n The order of the spherical Bessel function. * @param __x The argument of the spherical Bessel function. * @param __j_n The output spherical Bessel function. * @param __n_n The output spherical Neumann function. * @param __jp_n The output derivative of the spherical Bessel function. * @param __np_n The output derivative of the spherical Neumann function. */ template <typename _Tp> void __sph_bessel_jn(unsigned int __n, _Tp __x, _Tp & __j_n, _Tp & __n_n, _Tp & __jp_n, _Tp & __np_n) { const _Tp __nu = _Tp(__n) + _Tp(0.5L); _Tp __J_nu, __N_nu, __Jp_nu, __Np_nu; __bessel_jn(__nu, __x, __J_nu, __N_nu, __Jp_nu, __Np_nu); const _Tp __factor = __numeric_constants<_Tp>::__sqrtpio2() / std::sqrt(__x); __j_n = __factor * __J_nu; __n_n = __factor * __N_nu; __jp_n = __factor * __Jp_nu - __j_n / (_Tp(2) * __x); __np_n = __factor * __Np_nu - __n_n / (_Tp(2) * __x); return; } /** * @brief Return the spherical Bessel function * @f$ j_n(x) @f$ of order n. * * The spherical Bessel function is defined by: * @f[ * j_n(x) = \left( \frac{\pi}{2x} \right) ^{1/2} J_{n+1/2}(x) * @f] * * @param __n The order of the spherical Bessel function. * @param __x The argument of the spherical Bessel function. * @return The output spherical Bessel function. */ template <typename _Tp> _Tp __sph_bessel(unsigned int __n, _Tp __x) { if (__x < _Tp(0)) std::__throw_domain_error(__N("Bad argument " "in __sph_bessel.")); else if (__isnan(__x)) return std::numeric_limits<_Tp>::quiet_NaN(); else if (__x == _Tp(0)) { if (__n == 0) return _Tp(1); else return _Tp(0); } else { _Tp __j_n, __n_n, __jp_n, __np_n; __sph_bessel_jn(__n, __x, __j_n, __n_n, __jp_n, __np_n); return __j_n; } } /** * @brief Return the spherical Neumann function * @f$ n_n(x) @f$. * * The spherical Neumann function is defined by: * @f[ * n_n(x) = \left( \frac{\pi}{2x} \right) ^{1/2} N_{n+1/2}(x) * @f] * * @param __n The order of the spherical Neumann function. * @param __x The argument of the spherical Neumann function. * @return The output spherical Neumann function. */ template <typename _Tp> _Tp __sph_neumann(unsigned int __n, _Tp __x) { if (__x < _Tp(0)) std::__throw_domain_error(__N("Bad argument " "in __sph_neumann.")); else if (__isnan(__x)) return std::numeric_limits<_Tp>::quiet_NaN(); else if (__x == _Tp(0)) return -std::numeric_limits<_Tp>::infinity(); else { _Tp __j_n, __n_n, __jp_n, __np_n; __sph_bessel_jn(__n, __x, __j_n, __n_n, __jp_n, __np_n); return __n_n; } } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std::tr1::__detail } } #endif // _GLIBCXX_TR1_BESSEL_FUNCTION_TCC ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/ctgmath�������������������������������������������������������������������������������0000644�����������������00000002340�14763166027�0007660 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 ctgmath -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/ctgmath * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_CTGMATH #define _GLIBCXX_TR1_CTGMATH 1 #include <tr1/cmath> #endif // _GLIBCXX_TR1_CTGMATH ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/math.h��������������������������������������������������������������������������������0000644�����������������00000010711�14763166027�0007411 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 math.h -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/math.h * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_MATH_H #define _GLIBCXX_TR1_MATH_H 1 #include <tr1/cmath> #if _GLIBCXX_USE_C99_MATH_TR1 using std::tr1::acos; using std::tr1::acosh; using std::tr1::asin; using std::tr1::asinh; using std::tr1::atan; using std::tr1::atan2; using std::tr1::atanh; using std::tr1::cbrt; using std::tr1::ceil; using std::tr1::copysign; using std::tr1::cos; using std::tr1::cosh; using std::tr1::erf; using std::tr1::erfc; using std::tr1::exp; using std::tr1::exp2; using std::tr1::expm1; using std::tr1::fabs; using std::tr1::fdim; using std::tr1::floor; using std::tr1::fma; using std::tr1::fmax; using std::tr1::fmin; using std::tr1::fmod; using std::tr1::frexp; using std::tr1::hypot; using std::tr1::ilogb; using std::tr1::ldexp; using std::tr1::lgamma; using std::tr1::llrint; using std::tr1::llround; using std::tr1::log; using std::tr1::log10; using std::tr1::log1p; using std::tr1::log2; using std::tr1::logb; using std::tr1::lrint; using std::tr1::lround; using std::tr1::nearbyint; using std::tr1::nextafter; using std::tr1::nexttoward; using std::tr1::pow; using std::tr1::remainder; using std::tr1::remquo; using std::tr1::rint; using std::tr1::round; using std::tr1::scalbln; using std::tr1::scalbn; using std::tr1::sin; using std::tr1::sinh; using std::tr1::sqrt; using std::tr1::tan; using std::tr1::tanh; using std::tr1::tgamma; using std::tr1::trunc; #endif using std::tr1::assoc_laguerref; using std::tr1::assoc_laguerre; using std::tr1::assoc_laguerrel; using std::tr1::assoc_legendref; using std::tr1::assoc_legendre; using std::tr1::assoc_legendrel; using std::tr1::betaf; using std::tr1::beta; using std::tr1::betal; using std::tr1::comp_ellint_1f; using std::tr1::comp_ellint_1; using std::tr1::comp_ellint_1l; using std::tr1::comp_ellint_2f; using std::tr1::comp_ellint_2; using std::tr1::comp_ellint_2l; using std::tr1::comp_ellint_3f; using std::tr1::comp_ellint_3; using std::tr1::comp_ellint_3l; using std::tr1::conf_hypergf; using std::tr1::conf_hyperg; using std::tr1::conf_hypergl; using std::tr1::cyl_bessel_if; using std::tr1::cyl_bessel_i; using std::tr1::cyl_bessel_il; using std::tr1::cyl_bessel_jf; using std::tr1::cyl_bessel_j; using std::tr1::cyl_bessel_jl; using std::tr1::cyl_bessel_kf; using std::tr1::cyl_bessel_k; using std::tr1::cyl_bessel_kl; using std::tr1::cyl_neumannf; using std::tr1::cyl_neumann; using std::tr1::cyl_neumannl; using std::tr1::ellint_1f; using std::tr1::ellint_1; using std::tr1::ellint_1l; using std::tr1::ellint_2f; using std::tr1::ellint_2; using std::tr1::ellint_2l; using std::tr1::ellint_3f; using std::tr1::ellint_3; using std::tr1::ellint_3l; using std::tr1::expintf; using std::tr1::expint; using std::tr1::expintl; using std::tr1::hermitef; using std::tr1::hermite; using std::tr1::hermitel; using std::tr1::hypergf; using std::tr1::hyperg; using std::tr1::hypergl; using std::tr1::laguerref; using std::tr1::laguerre; using std::tr1::laguerrel; using std::tr1::legendref; using std::tr1::legendre; using std::tr1::legendrel; using std::tr1::riemann_zetaf; using std::tr1::riemann_zeta; using std::tr1::riemann_zetal; using std::tr1::sph_besself; using std::tr1::sph_bessel; using std::tr1::sph_bessell; using std::tr1::sph_legendref; using std::tr1::sph_legendre; using std::tr1::sph_legendrel; using std::tr1::sph_neumannf; using std::tr1::sph_neumann; using std::tr1::sph_neumannl; #endif // _GLIBCXX_TR1_MATH_H �������������������������������������������������������c++/4.8.2/tr1/cwctype�������������������������������������������������������������������������������0000644�����������������00000002663�14763166027�0007717 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 cwctype -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/cwctype * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_CWCTYPE #define _GLIBCXX_TR1_CWCTYPE 1 #pragma GCC system_header #include <cwctype> #ifdef _GLIBCXX_USE_WCHAR_T namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { #if _GLIBCXX_HAVE_ISWBLANK using std::iswblank; #endif } } #endif // _GLIBCXX_USE_WCHAR_T #endif // _GLIBCXX_TR1_CWCTYPE �����������������������������������������������������������������������������c++/4.8.2/tr1/cctype��������������������������������������������������������������������������������0000644�����������������00000002604�14763166027�0007523 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 cctype -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/cctype * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_CCTYPE #define _GLIBCXX_TR1_CCTYPE 1 #include <bits/c++config.h> #include <cctype> #ifdef _GLIBCXX_USE_C99_CTYPE_TR1 #undef isblank namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { using ::isblank; } } #endif #endif // _GLIBCXX_TR1_CCTYPE ����������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/cstdlib�������������������������������������������������������������������������������0000644�����������������00000003367�14763166027�0007667 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 cstdlib -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/cstdlib * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_CSTDLIB #define _GLIBCXX_TR1_CSTDLIB 1 #pragma GCC system_header #include <cstdlib> #if _GLIBCXX_HOSTED #if _GLIBCXX_USE_C99 namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC // types using std::lldiv_t; // functions using std::llabs; using std::lldiv; #endif using std::atoll; using std::strtoll; using std::strtoull; using std::strtof; using std::strtold; // overloads using std::abs; #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC using std::div; #endif } } #endif // _GLIBCXX_USE_C99 #endif // _GLIBCXX_HOSTED #endif // _GLIBCXX_TR1_CSTDLIB �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/random.tcc����������������������������������������������������������������������������0000644�����������������00000151354�14763166027�0010273 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// random number generation (out of line) -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/random.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{tr1/random} */ #ifndef _GLIBCXX_TR1_RANDOM_TCC #define _GLIBCXX_TR1_RANDOM_TCC 1 namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { /* * (Further) implementation-space details. */ namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION // General case for x = (ax + c) mod m -- use Schrage's algorithm to avoid // integer overflow. // // Because a and c are compile-time integral constants the compiler kindly // elides any unreachable paths. // // Preconditions: a > 0, m > 0. // template<typename _Tp, _Tp __a, _Tp __c, _Tp __m, bool> struct _Mod { static _Tp __calc(_Tp __x) { if (__a == 1) __x %= __m; else { static const _Tp __q = __m / __a; static const _Tp __r = __m % __a; _Tp __t1 = __a * (__x % __q); _Tp __t2 = __r * (__x / __q); if (__t1 >= __t2) __x = __t1 - __t2; else __x = __m - __t2 + __t1; } if (__c != 0) { const _Tp __d = __m - __x; if (__d > __c) __x += __c; else __x = __c - __d; } return __x; } }; // Special case for m == 0 -- use unsigned integer overflow as modulo // operator. template<typename _Tp, _Tp __a, _Tp __c, _Tp __m> struct _Mod<_Tp, __a, __c, __m, true> { static _Tp __calc(_Tp __x) { return __a * __x + __c; } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace __detail _GLIBCXX_BEGIN_NAMESPACE_VERSION template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> const _UIntType linear_congruential<_UIntType, __a, __c, __m>::multiplier; template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> const _UIntType linear_congruential<_UIntType, __a, __c, __m>::increment; template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> const _UIntType linear_congruential<_UIntType, __a, __c, __m>::modulus; /** * Seeds the LCR with integral value @p __x0, adjusted so that the * ring identity is never a member of the convergence set. */ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> void linear_congruential<_UIntType, __a, __c, __m>:: seed(unsigned long __x0) { if ((__detail::__mod<_UIntType, 1, 0, __m>(__c) == 0) && (__detail::__mod<_UIntType, 1, 0, __m>(__x0) == 0)) _M_x = __detail::__mod<_UIntType, 1, 0, __m>(1); else _M_x = __detail::__mod<_UIntType, 1, 0, __m>(__x0); } /** * Seeds the LCR engine with a value generated by @p __g. */ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> template<class _Gen> void linear_congruential<_UIntType, __a, __c, __m>:: seed(_Gen& __g, false_type) { _UIntType __x0 = __g(); if ((__detail::__mod<_UIntType, 1, 0, __m>(__c) == 0) && (__detail::__mod<_UIntType, 1, 0, __m>(__x0) == 0)) _M_x = __detail::__mod<_UIntType, 1, 0, __m>(1); else _M_x = __detail::__mod<_UIntType, 1, 0, __m>(__x0); } /** * Gets the next generated value in sequence. */ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> typename linear_congruential<_UIntType, __a, __c, __m>::result_type linear_congruential<_UIntType, __a, __c, __m>:: operator()() { _M_x = __detail::__mod<_UIntType, __a, __c, __m>(_M_x); return _M_x; } template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const linear_congruential<_UIntType, __a, __c, __m>& __lcr) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left); __os.fill(__os.widen(' ')); __os << __lcr._M_x; __os.flags(__flags); __os.fill(__fill); return __os; } template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, linear_congruential<_UIntType, __a, __c, __m>& __lcr) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec); __is >> __lcr._M_x; __is.flags(__flags); return __is; } template<class _UIntType, int __w, int __n, int __m, int __r, _UIntType __a, int __u, int __s, _UIntType __b, int __t, _UIntType __c, int __l> const int mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s, __b, __t, __c, __l>::word_size; template<class _UIntType, int __w, int __n, int __m, int __r, _UIntType __a, int __u, int __s, _UIntType __b, int __t, _UIntType __c, int __l> const int mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s, __b, __t, __c, __l>::state_size; template<class _UIntType, int __w, int __n, int __m, int __r, _UIntType __a, int __u, int __s, _UIntType __b, int __t, _UIntType __c, int __l> const int mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s, __b, __t, __c, __l>::shift_size; template<class _UIntType, int __w, int __n, int __m, int __r, _UIntType __a, int __u, int __s, _UIntType __b, int __t, _UIntType __c, int __l> const int mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s, __b, __t, __c, __l>::mask_bits; template<class _UIntType, int __w, int __n, int __m, int __r, _UIntType __a, int __u, int __s, _UIntType __b, int __t, _UIntType __c, int __l> const _UIntType mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s, __b, __t, __c, __l>::parameter_a; template<class _UIntType, int __w, int __n, int __m, int __r, _UIntType __a, int __u, int __s, _UIntType __b, int __t, _UIntType __c, int __l> const int mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s, __b, __t, __c, __l>::output_u; template<class _UIntType, int __w, int __n, int __m, int __r, _UIntType __a, int __u, int __s, _UIntType __b, int __t, _UIntType __c, int __l> const int mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s, __b, __t, __c, __l>::output_s; template<class _UIntType, int __w, int __n, int __m, int __r, _UIntType __a, int __u, int __s, _UIntType __b, int __t, _UIntType __c, int __l> const _UIntType mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s, __b, __t, __c, __l>::output_b; template<class _UIntType, int __w, int __n, int __m, int __r, _UIntType __a, int __u, int __s, _UIntType __b, int __t, _UIntType __c, int __l> const int mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s, __b, __t, __c, __l>::output_t; template<class _UIntType, int __w, int __n, int __m, int __r, _UIntType __a, int __u, int __s, _UIntType __b, int __t, _UIntType __c, int __l> const _UIntType mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s, __b, __t, __c, __l>::output_c; template<class _UIntType, int __w, int __n, int __m, int __r, _UIntType __a, int __u, int __s, _UIntType __b, int __t, _UIntType __c, int __l> const int mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s, __b, __t, __c, __l>::output_l; template<class _UIntType, int __w, int __n, int __m, int __r, _UIntType __a, int __u, int __s, _UIntType __b, int __t, _UIntType __c, int __l> void mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s, __b, __t, __c, __l>:: seed(unsigned long __value) { _M_x[0] = __detail::__mod<_UIntType, 1, 0, __detail::_Shift<_UIntType, __w>::__value>(__value); for (int __i = 1; __i < state_size; ++__i) { _UIntType __x = _M_x[__i - 1]; __x ^= __x >> (__w - 2); __x *= 1812433253ul; __x += __i; _M_x[__i] = __detail::__mod<_UIntType, 1, 0, __detail::_Shift<_UIntType, __w>::__value>(__x); } _M_p = state_size; } template<class _UIntType, int __w, int __n, int __m, int __r, _UIntType __a, int __u, int __s, _UIntType __b, int __t, _UIntType __c, int __l> template<class _Gen> void mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s, __b, __t, __c, __l>:: seed(_Gen& __gen, false_type) { for (int __i = 0; __i < state_size; ++__i) _M_x[__i] = __detail::__mod<_UIntType, 1, 0, __detail::_Shift<_UIntType, __w>::__value>(__gen()); _M_p = state_size; } template<class _UIntType, int __w, int __n, int __m, int __r, _UIntType __a, int __u, int __s, _UIntType __b, int __t, _UIntType __c, int __l> typename mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s, __b, __t, __c, __l>::result_type mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s, __b, __t, __c, __l>:: operator()() { // Reload the vector - cost is O(n) amortized over n calls. if (_M_p >= state_size) { const _UIntType __upper_mask = (~_UIntType()) << __r; const _UIntType __lower_mask = ~__upper_mask; for (int __k = 0; __k < (__n - __m); ++__k) { _UIntType __y = ((_M_x[__k] & __upper_mask) | (_M_x[__k + 1] & __lower_mask)); _M_x[__k] = (_M_x[__k + __m] ^ (__y >> 1) ^ ((__y & 0x01) ? __a : 0)); } for (int __k = (__n - __m); __k < (__n - 1); ++__k) { _UIntType __y = ((_M_x[__k] & __upper_mask) | (_M_x[__k + 1] & __lower_mask)); _M_x[__k] = (_M_x[__k + (__m - __n)] ^ (__y >> 1) ^ ((__y & 0x01) ? __a : 0)); } _UIntType __y = ((_M_x[__n - 1] & __upper_mask) | (_M_x[0] & __lower_mask)); _M_x[__n - 1] = (_M_x[__m - 1] ^ (__y >> 1) ^ ((__y & 0x01) ? __a : 0)); _M_p = 0; } // Calculate o(x(i)). result_type __z = _M_x[_M_p++]; __z ^= (__z >> __u); __z ^= (__z << __s) & __b; __z ^= (__z << __t) & __c; __z ^= (__z >> __l); return __z; } template<class _UIntType, int __w, int __n, int __m, int __r, _UIntType __a, int __u, int __s, _UIntType __b, int __t, _UIntType __c, int __l, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s, __b, __t, __c, __l>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left); __os.fill(__space); for (int __i = 0; __i < __n - 1; ++__i) __os << __x._M_x[__i] << __space; __os << __x._M_x[__n - 1]; __os.flags(__flags); __os.fill(__fill); return __os; } template<class _UIntType, int __w, int __n, int __m, int __r, _UIntType __a, int __u, int __s, _UIntType __b, int __t, _UIntType __c, int __l, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s, __b, __t, __c, __l>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); for (int __i = 0; __i < __n; ++__i) __is >> __x._M_x[__i]; __is.flags(__flags); return __is; } template<typename _IntType, _IntType __m, int __s, int __r> const _IntType subtract_with_carry<_IntType, __m, __s, __r>::modulus; template<typename _IntType, _IntType __m, int __s, int __r> const int subtract_with_carry<_IntType, __m, __s, __r>::long_lag; template<typename _IntType, _IntType __m, int __s, int __r> const int subtract_with_carry<_IntType, __m, __s, __r>::short_lag; template<typename _IntType, _IntType __m, int __s, int __r> void subtract_with_carry<_IntType, __m, __s, __r>:: seed(unsigned long __value) { if (__value == 0) __value = 19780503; std::tr1::linear_congruential<unsigned long, 40014, 0, 2147483563> __lcg(__value); for (int __i = 0; __i < long_lag; ++__i) _M_x[__i] = __detail::__mod<_UIntType, 1, 0, modulus>(__lcg()); _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0; _M_p = 0; } template<typename _IntType, _IntType __m, int __s, int __r> template<class _Gen> void subtract_with_carry<_IntType, __m, __s, __r>:: seed(_Gen& __gen, false_type) { const int __n = (std::numeric_limits<_UIntType>::digits + 31) / 32; for (int __i = 0; __i < long_lag; ++__i) { _UIntType __tmp = 0; _UIntType __factor = 1; for (int __j = 0; __j < __n; ++__j) { __tmp += __detail::__mod<__detail::_UInt32Type, 1, 0, 0> (__gen()) * __factor; __factor *= __detail::_Shift<_UIntType, 32>::__value; } _M_x[__i] = __detail::__mod<_UIntType, 1, 0, modulus>(__tmp); } _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0; _M_p = 0; } template<typename _IntType, _IntType __m, int __s, int __r> typename subtract_with_carry<_IntType, __m, __s, __r>::result_type subtract_with_carry<_IntType, __m, __s, __r>:: operator()() { // Derive short lag index from current index. int __ps = _M_p - short_lag; if (__ps < 0) __ps += long_lag; // Calculate new x(i) without overflow or division. // NB: Thanks to the requirements for _IntType, _M_x[_M_p] + _M_carry // cannot overflow. _UIntType __xi; if (_M_x[__ps] >= _M_x[_M_p] + _M_carry) { __xi = _M_x[__ps] - _M_x[_M_p] - _M_carry; _M_carry = 0; } else { __xi = modulus - _M_x[_M_p] - _M_carry + _M_x[__ps]; _M_carry = 1; } _M_x[_M_p] = __xi; // Adjust current index to loop around in ring buffer. if (++_M_p >= long_lag) _M_p = 0; return __xi; } template<typename _IntType, _IntType __m, int __s, int __r, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const subtract_with_carry<_IntType, __m, __s, __r>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left); __os.fill(__space); for (int __i = 0; __i < __r; ++__i) __os << __x._M_x[__i] << __space; __os << __x._M_carry; __os.flags(__flags); __os.fill(__fill); return __os; } template<typename _IntType, _IntType __m, int __s, int __r, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, subtract_with_carry<_IntType, __m, __s, __r>& __x) { typedef std::basic_ostream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); for (int __i = 0; __i < __r; ++__i) __is >> __x._M_x[__i]; __is >> __x._M_carry; __is.flags(__flags); return __is; } template<typename _RealType, int __w, int __s, int __r> const int subtract_with_carry_01<_RealType, __w, __s, __r>::word_size; template<typename _RealType, int __w, int __s, int __r> const int subtract_with_carry_01<_RealType, __w, __s, __r>::long_lag; template<typename _RealType, int __w, int __s, int __r> const int subtract_with_carry_01<_RealType, __w, __s, __r>::short_lag; template<typename _RealType, int __w, int __s, int __r> void subtract_with_carry_01<_RealType, __w, __s, __r>:: _M_initialize_npows() { for (int __j = 0; __j < __n; ++__j) #if _GLIBCXX_USE_C99_MATH_TR1 _M_npows[__j] = std::tr1::ldexp(_RealType(1), -__w + __j * 32); #else _M_npows[__j] = std::pow(_RealType(2), -__w + __j * 32); #endif } template<typename _RealType, int __w, int __s, int __r> void subtract_with_carry_01<_RealType, __w, __s, __r>:: seed(unsigned long __value) { if (__value == 0) __value = 19780503; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 512. Seeding subtract_with_carry_01 from a single unsigned long. std::tr1::linear_congruential<unsigned long, 40014, 0, 2147483563> __lcg(__value); this->seed(__lcg); } template<typename _RealType, int __w, int __s, int __r> template<class _Gen> void subtract_with_carry_01<_RealType, __w, __s, __r>:: seed(_Gen& __gen, false_type) { for (int __i = 0; __i < long_lag; ++__i) { for (int __j = 0; __j < __n - 1; ++__j) _M_x[__i][__j] = __detail::__mod<_UInt32Type, 1, 0, 0>(__gen()); _M_x[__i][__n - 1] = __detail::__mod<_UInt32Type, 1, 0, __detail::_Shift<_UInt32Type, __w % 32>::__value>(__gen()); } _M_carry = 1; for (int __j = 0; __j < __n; ++__j) if (_M_x[long_lag - 1][__j] != 0) { _M_carry = 0; break; } _M_p = 0; } template<typename _RealType, int __w, int __s, int __r> typename subtract_with_carry_01<_RealType, __w, __s, __r>::result_type subtract_with_carry_01<_RealType, __w, __s, __r>:: operator()() { // Derive short lag index from current index. int __ps = _M_p - short_lag; if (__ps < 0) __ps += long_lag; _UInt32Type __new_carry; for (int __j = 0; __j < __n - 1; ++__j) { if (_M_x[__ps][__j] > _M_x[_M_p][__j] || (_M_x[__ps][__j] == _M_x[_M_p][__j] && _M_carry == 0)) __new_carry = 0; else __new_carry = 1; _M_x[_M_p][__j] = _M_x[__ps][__j] - _M_x[_M_p][__j] - _M_carry; _M_carry = __new_carry; } if (_M_x[__ps][__n - 1] > _M_x[_M_p][__n - 1] || (_M_x[__ps][__n - 1] == _M_x[_M_p][__n - 1] && _M_carry == 0)) __new_carry = 0; else __new_carry = 1; _M_x[_M_p][__n - 1] = __detail::__mod<_UInt32Type, 1, 0, __detail::_Shift<_UInt32Type, __w % 32>::__value> (_M_x[__ps][__n - 1] - _M_x[_M_p][__n - 1] - _M_carry); _M_carry = __new_carry; result_type __ret = 0.0; for (int __j = 0; __j < __n; ++__j) __ret += _M_x[_M_p][__j] * _M_npows[__j]; // Adjust current index to loop around in ring buffer. if (++_M_p >= long_lag) _M_p = 0; return __ret; } template<typename _RealType, int __w, int __s, int __r, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const subtract_with_carry_01<_RealType, __w, __s, __r>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left); __os.fill(__space); for (int __i = 0; __i < __r; ++__i) for (int __j = 0; __j < __x.__n; ++__j) __os << __x._M_x[__i][__j] << __space; __os << __x._M_carry; __os.flags(__flags); __os.fill(__fill); return __os; } template<typename _RealType, int __w, int __s, int __r, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, subtract_with_carry_01<_RealType, __w, __s, __r>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); for (int __i = 0; __i < __r; ++__i) for (int __j = 0; __j < __x.__n; ++__j) __is >> __x._M_x[__i][__j]; __is >> __x._M_carry; __is.flags(__flags); return __is; } template<class _UniformRandomNumberGenerator, int __p, int __r> const int discard_block<_UniformRandomNumberGenerator, __p, __r>::block_size; template<class _UniformRandomNumberGenerator, int __p, int __r> const int discard_block<_UniformRandomNumberGenerator, __p, __r>::used_block; template<class _UniformRandomNumberGenerator, int __p, int __r> typename discard_block<_UniformRandomNumberGenerator, __p, __r>::result_type discard_block<_UniformRandomNumberGenerator, __p, __r>:: operator()() { if (_M_n >= used_block) { while (_M_n < block_size) { _M_b(); ++_M_n; } _M_n = 0; } ++_M_n; return _M_b(); } template<class _UniformRandomNumberGenerator, int __p, int __r, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const discard_block<_UniformRandomNumberGenerator, __p, __r>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left); __os.fill(__space); __os << __x._M_b << __space << __x._M_n; __os.flags(__flags); __os.fill(__fill); return __os; } template<class _UniformRandomNumberGenerator, int __p, int __r, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, discard_block<_UniformRandomNumberGenerator, __p, __r>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); __is >> __x._M_b >> __x._M_n; __is.flags(__flags); return __is; } template<class _UniformRandomNumberGenerator1, int __s1, class _UniformRandomNumberGenerator2, int __s2> const int xor_combine<_UniformRandomNumberGenerator1, __s1, _UniformRandomNumberGenerator2, __s2>::shift1; template<class _UniformRandomNumberGenerator1, int __s1, class _UniformRandomNumberGenerator2, int __s2> const int xor_combine<_UniformRandomNumberGenerator1, __s1, _UniformRandomNumberGenerator2, __s2>::shift2; template<class _UniformRandomNumberGenerator1, int __s1, class _UniformRandomNumberGenerator2, int __s2> void xor_combine<_UniformRandomNumberGenerator1, __s1, _UniformRandomNumberGenerator2, __s2>:: _M_initialize_max() { const int __w = std::numeric_limits<result_type>::digits; const result_type __m1 = std::min(result_type(_M_b1.max() - _M_b1.min()), __detail::_Shift<result_type, __w - __s1>::__value - 1); const result_type __m2 = std::min(result_type(_M_b2.max() - _M_b2.min()), __detail::_Shift<result_type, __w - __s2>::__value - 1); // NB: In TR1 s1 is not required to be >= s2. if (__s1 < __s2) _M_max = _M_initialize_max_aux(__m2, __m1, __s2 - __s1) << __s1; else _M_max = _M_initialize_max_aux(__m1, __m2, __s1 - __s2) << __s2; } template<class _UniformRandomNumberGenerator1, int __s1, class _UniformRandomNumberGenerator2, int __s2> typename xor_combine<_UniformRandomNumberGenerator1, __s1, _UniformRandomNumberGenerator2, __s2>::result_type xor_combine<_UniformRandomNumberGenerator1, __s1, _UniformRandomNumberGenerator2, __s2>:: _M_initialize_max_aux(result_type __a, result_type __b, int __d) { const result_type __two2d = result_type(1) << __d; const result_type __c = __a * __two2d; if (__a == 0 || __b < __two2d) return __c + __b; const result_type __t = std::max(__c, __b); const result_type __u = std::min(__c, __b); result_type __ub = __u; result_type __p; for (__p = 0; __ub != 1; __ub >>= 1) ++__p; const result_type __two2p = result_type(1) << __p; const result_type __k = __t / __two2p; if (__k & 1) return (__k + 1) * __two2p - 1; if (__c >= __b) return (__k + 1) * __two2p + _M_initialize_max_aux((__t % __two2p) / __two2d, __u % __two2p, __d); else return (__k + 1) * __two2p + _M_initialize_max_aux((__u % __two2p) / __two2d, __t % __two2p, __d); } template<class _UniformRandomNumberGenerator1, int __s1, class _UniformRandomNumberGenerator2, int __s2, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const xor_combine<_UniformRandomNumberGenerator1, __s1, _UniformRandomNumberGenerator2, __s2>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left); __os.fill(__space); __os << __x.base1() << __space << __x.base2(); __os.flags(__flags); __os.fill(__fill); return __os; } template<class _UniformRandomNumberGenerator1, int __s1, class _UniformRandomNumberGenerator2, int __s2, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, xor_combine<_UniformRandomNumberGenerator1, __s1, _UniformRandomNumberGenerator2, __s2>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::skipws); __is >> __x._M_b1 >> __x._M_b2; __is.flags(__flags); return __is; } template<typename _IntType> template<typename _UniformRandomNumberGenerator> typename uniform_int<_IntType>::result_type uniform_int<_IntType>:: _M_call(_UniformRandomNumberGenerator& __urng, result_type __min, result_type __max, true_type) { // XXX Must be fixed to work well for *arbitrary* __urng.max(), // __urng.min(), __max, __min. Currently works fine only in the // most common case __urng.max() - __urng.min() >= __max - __min, // with __urng.max() > __urng.min() >= 0. typedef typename __gnu_cxx::__add_unsigned<typename _UniformRandomNumberGenerator::result_type>::__type __urntype; typedef typename __gnu_cxx::__add_unsigned<result_type>::__type __utype; typedef typename __gnu_cxx::__conditional_type<(sizeof(__urntype) > sizeof(__utype)), __urntype, __utype>::__type __uctype; result_type __ret; const __urntype __urnmin = __urng.min(); const __urntype __urnmax = __urng.max(); const __urntype __urnrange = __urnmax - __urnmin; const __uctype __urange = __max - __min; const __uctype __udenom = (__urnrange <= __urange ? 1 : __urnrange / (__urange + 1)); do __ret = (__urntype(__urng()) - __urnmin) / __udenom; while (__ret > __max - __min); return __ret + __min; } template<typename _IntType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const uniform_int<_IntType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os << __x.min() << __space << __x.max(); __os.flags(__flags); __os.fill(__fill); return __os; } template<typename _IntType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, uniform_int<_IntType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); __is >> __x._M_min >> __x._M_max; __is.flags(__flags); return __is; } template<typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const bernoulli_distribution& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__os.widen(' ')); __os.precision(__gnu_cxx::__numeric_traits<double>::__max_digits10); __os << __x.p(); __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _IntType, typename _RealType> template<class _UniformRandomNumberGenerator> typename geometric_distribution<_IntType, _RealType>::result_type geometric_distribution<_IntType, _RealType>:: operator()(_UniformRandomNumberGenerator& __urng) { // About the epsilon thing see this thread: // http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00971.html const _RealType __naf = (1 - std::numeric_limits<_RealType>::epsilon()) / 2; // The largest _RealType convertible to _IntType. const _RealType __thr = std::numeric_limits<_IntType>::max() + __naf; _RealType __cand; do __cand = std::ceil(std::log(__urng()) / _M_log_p); while (__cand >= __thr); return result_type(__cand + __naf); } template<typename _IntType, typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const geometric_distribution<_IntType, _RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__os.widen(' ')); __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10); __os << __x.p(); __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _IntType, typename _RealType> void poisson_distribution<_IntType, _RealType>:: _M_initialize() { #if _GLIBCXX_USE_C99_MATH_TR1 if (_M_mean >= 12) { const _RealType __m = std::floor(_M_mean); _M_lm_thr = std::log(_M_mean); _M_lfm = std::tr1::lgamma(__m + 1); _M_sm = std::sqrt(__m); const _RealType __pi_4 = 0.7853981633974483096156608458198757L; const _RealType __dx = std::sqrt(2 * __m * std::log(32 * __m / __pi_4)); _M_d = std::tr1::round(std::max(_RealType(6), std::min(__m, __dx))); const _RealType __cx = 2 * __m + _M_d; _M_scx = std::sqrt(__cx / 2); _M_1cx = 1 / __cx; _M_c2b = std::sqrt(__pi_4 * __cx) * std::exp(_M_1cx); _M_cb = 2 * __cx * std::exp(-_M_d * _M_1cx * (1 + _M_d / 2)) / _M_d; } else #endif _M_lm_thr = std::exp(-_M_mean); } /** * A rejection algorithm when mean >= 12 and a simple method based * upon the multiplication of uniform random variates otherwise. * NB: The former is available only if _GLIBCXX_USE_C99_MATH_TR1 * is defined. * * Reference: * Devroye, L. Non-Uniform Random Variates Generation. Springer-Verlag, * New York, 1986, Ch. X, Sects. 3.3 & 3.4 (+ Errata!). */ template<typename _IntType, typename _RealType> template<class _UniformRandomNumberGenerator> typename poisson_distribution<_IntType, _RealType>::result_type poisson_distribution<_IntType, _RealType>:: operator()(_UniformRandomNumberGenerator& __urng) { #if _GLIBCXX_USE_C99_MATH_TR1 if (_M_mean >= 12) { _RealType __x; // See comments above... const _RealType __naf = (1 - std::numeric_limits<_RealType>::epsilon()) / 2; const _RealType __thr = std::numeric_limits<_IntType>::max() + __naf; const _RealType __m = std::floor(_M_mean); // sqrt(pi / 2) const _RealType __spi_2 = 1.2533141373155002512078826424055226L; const _RealType __c1 = _M_sm * __spi_2; const _RealType __c2 = _M_c2b + __c1; const _RealType __c3 = __c2 + 1; const _RealType __c4 = __c3 + 1; // e^(1 / 78) const _RealType __e178 = 1.0129030479320018583185514777512983L; const _RealType __c5 = __c4 + __e178; const _RealType __c = _M_cb + __c5; const _RealType __2cx = 2 * (2 * __m + _M_d); bool __reject = true; do { const _RealType __u = __c * __urng(); const _RealType __e = -std::log(__urng()); _RealType __w = 0.0; if (__u <= __c1) { const _RealType __n = _M_nd(__urng); const _RealType __y = -std::abs(__n) * _M_sm - 1; __x = std::floor(__y); __w = -__n * __n / 2; if (__x < -__m) continue; } else if (__u <= __c2) { const _RealType __n = _M_nd(__urng); const _RealType __y = 1 + std::abs(__n) * _M_scx; __x = std::ceil(__y); __w = __y * (2 - __y) * _M_1cx; if (__x > _M_d) continue; } else if (__u <= __c3) // NB: This case not in the book, nor in the Errata, // but should be ok... __x = -1; else if (__u <= __c4) __x = 0; else if (__u <= __c5) __x = 1; else { const _RealType __v = -std::log(__urng()); const _RealType __y = _M_d + __v * __2cx / _M_d; __x = std::ceil(__y); __w = -_M_d * _M_1cx * (1 + __y / 2); } __reject = (__w - __e - __x * _M_lm_thr > _M_lfm - std::tr1::lgamma(__x + __m + 1)); __reject |= __x + __m >= __thr; } while (__reject); return result_type(__x + __m + __naf); } else #endif { _IntType __x = 0; _RealType __prod = 1.0; do { __prod *= __urng(); __x += 1; } while (__prod > _M_lm_thr); return __x - 1; } } template<typename _IntType, typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const poisson_distribution<_IntType, _RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10); __os << __x.mean() << __space << __x._M_nd; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _IntType, typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, poisson_distribution<_IntType, _RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::skipws); __is >> __x._M_mean >> __x._M_nd; __x._M_initialize(); __is.flags(__flags); return __is; } template<typename _IntType, typename _RealType> void binomial_distribution<_IntType, _RealType>:: _M_initialize() { const _RealType __p12 = _M_p <= 0.5 ? _M_p : 1.0 - _M_p; _M_easy = true; #if _GLIBCXX_USE_C99_MATH_TR1 if (_M_t * __p12 >= 8) { _M_easy = false; const _RealType __np = std::floor(_M_t * __p12); const _RealType __pa = __np / _M_t; const _RealType __1p = 1 - __pa; const _RealType __pi_4 = 0.7853981633974483096156608458198757L; const _RealType __d1x = std::sqrt(__np * __1p * std::log(32 * __np / (81 * __pi_4 * __1p))); _M_d1 = std::tr1::round(std::max(_RealType(1), __d1x)); const _RealType __d2x = std::sqrt(__np * __1p * std::log(32 * _M_t * __1p / (__pi_4 * __pa))); _M_d2 = std::tr1::round(std::max(_RealType(1), __d2x)); // sqrt(pi / 2) const _RealType __spi_2 = 1.2533141373155002512078826424055226L; _M_s1 = std::sqrt(__np * __1p) * (1 + _M_d1 / (4 * __np)); _M_s2 = std::sqrt(__np * __1p) * (1 + _M_d2 / (4 * _M_t * __1p)); _M_c = 2 * _M_d1 / __np; _M_a1 = std::exp(_M_c) * _M_s1 * __spi_2; const _RealType __a12 = _M_a1 + _M_s2 * __spi_2; const _RealType __s1s = _M_s1 * _M_s1; _M_a123 = __a12 + (std::exp(_M_d1 / (_M_t * __1p)) * 2 * __s1s / _M_d1 * std::exp(-_M_d1 * _M_d1 / (2 * __s1s))); const _RealType __s2s = _M_s2 * _M_s2; _M_s = (_M_a123 + 2 * __s2s / _M_d2 * std::exp(-_M_d2 * _M_d2 / (2 * __s2s))); _M_lf = (std::tr1::lgamma(__np + 1) + std::tr1::lgamma(_M_t - __np + 1)); _M_lp1p = std::log(__pa / __1p); _M_q = -std::log(1 - (__p12 - __pa) / __1p); } else #endif _M_q = -std::log(1 - __p12); } template<typename _IntType, typename _RealType> template<class _UniformRandomNumberGenerator> typename binomial_distribution<_IntType, _RealType>::result_type binomial_distribution<_IntType, _RealType>:: _M_waiting(_UniformRandomNumberGenerator& __urng, _IntType __t) { _IntType __x = 0; _RealType __sum = 0; do { const _RealType __e = -std::log(__urng()); __sum += __e / (__t - __x); __x += 1; } while (__sum <= _M_q); return __x - 1; } /** * A rejection algorithm when t * p >= 8 and a simple waiting time * method - the second in the referenced book - otherwise. * NB: The former is available only if _GLIBCXX_USE_C99_MATH_TR1 * is defined. * * Reference: * Devroye, L. Non-Uniform Random Variates Generation. Springer-Verlag, * New York, 1986, Ch. X, Sect. 4 (+ Errata!). */ template<typename _IntType, typename _RealType> template<class _UniformRandomNumberGenerator> typename binomial_distribution<_IntType, _RealType>::result_type binomial_distribution<_IntType, _RealType>:: operator()(_UniformRandomNumberGenerator& __urng) { result_type __ret; const _RealType __p12 = _M_p <= 0.5 ? _M_p : 1.0 - _M_p; #if _GLIBCXX_USE_C99_MATH_TR1 if (!_M_easy) { _RealType __x; // See comments above... const _RealType __naf = (1 - std::numeric_limits<_RealType>::epsilon()) / 2; const _RealType __thr = std::numeric_limits<_IntType>::max() + __naf; const _RealType __np = std::floor(_M_t * __p12); const _RealType __pa = __np / _M_t; // sqrt(pi / 2) const _RealType __spi_2 = 1.2533141373155002512078826424055226L; const _RealType __a1 = _M_a1; const _RealType __a12 = __a1 + _M_s2 * __spi_2; const _RealType __a123 = _M_a123; const _RealType __s1s = _M_s1 * _M_s1; const _RealType __s2s = _M_s2 * _M_s2; bool __reject; do { const _RealType __u = _M_s * __urng(); _RealType __v; if (__u <= __a1) { const _RealType __n = _M_nd(__urng); const _RealType __y = _M_s1 * std::abs(__n); __reject = __y >= _M_d1; if (!__reject) { const _RealType __e = -std::log(__urng()); __x = std::floor(__y); __v = -__e - __n * __n / 2 + _M_c; } } else if (__u <= __a12) { const _RealType __n = _M_nd(__urng); const _RealType __y = _M_s2 * std::abs(__n); __reject = __y >= _M_d2; if (!__reject) { const _RealType __e = -std::log(__urng()); __x = std::floor(-__y); __v = -__e - __n * __n / 2; } } else if (__u <= __a123) { const _RealType __e1 = -std::log(__urng()); const _RealType __e2 = -std::log(__urng()); const _RealType __y = _M_d1 + 2 * __s1s * __e1 / _M_d1; __x = std::floor(__y); __v = (-__e2 + _M_d1 * (1 / (_M_t - __np) -__y / (2 * __s1s))); __reject = false; } else { const _RealType __e1 = -std::log(__urng()); const _RealType __e2 = -std::log(__urng()); const _RealType __y = _M_d2 + 2 * __s2s * __e1 / _M_d2; __x = std::floor(-__y); __v = -__e2 - _M_d2 * __y / (2 * __s2s); __reject = false; } __reject = __reject || __x < -__np || __x > _M_t - __np; if (!__reject) { const _RealType __lfx = std::tr1::lgamma(__np + __x + 1) + std::tr1::lgamma(_M_t - (__np + __x) + 1); __reject = __v > _M_lf - __lfx + __x * _M_lp1p; } __reject |= __x + __np >= __thr; } while (__reject); __x += __np + __naf; const _IntType __z = _M_waiting(__urng, _M_t - _IntType(__x)); __ret = _IntType(__x) + __z; } else #endif __ret = _M_waiting(__urng, _M_t); if (__p12 != _M_p) __ret = _M_t - __ret; return __ret; } template<typename _IntType, typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const binomial_distribution<_IntType, _RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10); __os << __x.t() << __space << __x.p() << __space << __x._M_nd; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _IntType, typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, binomial_distribution<_IntType, _RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); __is >> __x._M_t >> __x._M_p >> __x._M_nd; __x._M_initialize(); __is.flags(__flags); return __is; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const uniform_real<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10); __os << __x.min() << __space << __x.max(); __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, uniform_real<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::skipws); __is >> __x._M_min >> __x._M_max; __is.flags(__flags); return __is; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const exponential_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__os.widen(' ')); __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10); __os << __x.lambda(); __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } /** * Polar method due to Marsaglia. * * Devroye, L. Non-Uniform Random Variates Generation. Springer-Verlag, * New York, 1986, Ch. V, Sect. 4.4. */ template<typename _RealType> template<class _UniformRandomNumberGenerator> typename normal_distribution<_RealType>::result_type normal_distribution<_RealType>:: operator()(_UniformRandomNumberGenerator& __urng) { result_type __ret; if (_M_saved_available) { _M_saved_available = false; __ret = _M_saved; } else { result_type __x, __y, __r2; do { __x = result_type(2.0) * __urng() - 1.0; __y = result_type(2.0) * __urng() - 1.0; __r2 = __x * __x + __y * __y; } while (__r2 > 1.0 || __r2 == 0.0); const result_type __mult = std::sqrt(-2 * std::log(__r2) / __r2); _M_saved = __x * __mult; _M_saved_available = true; __ret = __y * __mult; } __ret = __ret * _M_sigma + _M_mean; return __ret; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const normal_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10); __os << __x._M_saved_available << __space << __x.mean() << __space << __x.sigma(); if (__x._M_saved_available) __os << __space << __x._M_saved; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, normal_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); __is >> __x._M_saved_available >> __x._M_mean >> __x._M_sigma; if (__x._M_saved_available) __is >> __x._M_saved; __is.flags(__flags); return __is; } template<typename _RealType> void gamma_distribution<_RealType>:: _M_initialize() { if (_M_alpha >= 1) _M_l_d = std::sqrt(2 * _M_alpha - 1); else _M_l_d = (std::pow(_M_alpha, _M_alpha / (1 - _M_alpha)) * (1 - _M_alpha)); } /** * Cheng's rejection algorithm GB for alpha >= 1 and a modification * of Vaduva's rejection from Weibull algorithm due to Devroye for * alpha < 1. * * References: * Cheng, R. C. The Generation of Gamma Random Variables with Non-integral * Shape Parameter. Applied Statistics, 26, 71-75, 1977. * * Vaduva, I. Computer Generation of Gamma Gandom Variables by Rejection * and Composition Procedures. Math. Operationsforschung and Statistik, * Series in Statistics, 8, 545-576, 1977. * * Devroye, L. Non-Uniform Random Variates Generation. Springer-Verlag, * New York, 1986, Ch. IX, Sect. 3.4 (+ Errata!). */ template<typename _RealType> template<class _UniformRandomNumberGenerator> typename gamma_distribution<_RealType>::result_type gamma_distribution<_RealType>:: operator()(_UniformRandomNumberGenerator& __urng) { result_type __x; bool __reject; if (_M_alpha >= 1) { // alpha - log(4) const result_type __b = _M_alpha - result_type(1.3862943611198906188344642429163531L); const result_type __c = _M_alpha + _M_l_d; const result_type __1l = 1 / _M_l_d; // 1 + log(9 / 2) const result_type __k = 2.5040773967762740733732583523868748L; do { const result_type __u = __urng(); const result_type __v = __urng(); const result_type __y = __1l * std::log(__v / (1 - __v)); __x = _M_alpha * std::exp(__y); const result_type __z = __u * __v * __v; const result_type __r = __b + __c * __y - __x; __reject = __r < result_type(4.5) * __z - __k; if (__reject) __reject = __r < std::log(__z); } while (__reject); } else { const result_type __c = 1 / _M_alpha; do { const result_type __z = -std::log(__urng()); const result_type __e = -std::log(__urng()); __x = std::pow(__z, __c); __reject = __z + __e < _M_l_d + __x; } while (__reject); } return __x; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const gamma_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__os.widen(' ')); __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10); __os << __x.alpha(); __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } _GLIBCXX_END_NAMESPACE_VERSION } } #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/cfloat��������������������������������������������������������������������������������0000644�����������������00000002544�14763166027�0007507 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 cfloat -*- C++ -*- // Copyright (C) 2006-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/cfloat * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_CFLOAT #define _GLIBCXX_TR1_CFLOAT 1 #include <cfloat> #ifndef DECIMAL_DIG #define DECIMAL_DIG __DECIMAL_DIG__ #endif #ifndef FLT_EVAL_METHOD #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ #endif #endif //_GLIBCXX_TR1_CFLOAT ������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/hashtable.h���������������������������������������������������������������������������0000644�����������������00000121101�14763166027�0010407 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// TR1 hashtable.h header -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/hashtable.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. * @headername{tr1/unordered_set, tr1/unordered_map} */ #ifndef _GLIBCXX_TR1_HASHTABLE_H #define _GLIBCXX_TR1_HASHTABLE_H 1 #pragma GCC system_header #include <tr1/hashtable_policy.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Class template _Hashtable, class definition. // Meaning of class template _Hashtable's template parameters // _Key and _Value: arbitrary CopyConstructible types. // _Allocator: an allocator type ([lib.allocator.requirements]) whose // value type is Value. As a conforming extension, we allow for // value type != Value. // _ExtractKey: function object that takes a object of type Value // and returns a value of type _Key. // _Equal: function object that takes two objects of type k and returns // a bool-like value that is true if the two objects are considered equal. // _H1: the hash function. A unary function object with argument type // Key and result type size_t. Return values should be distributed // over the entire range [0, numeric_limits<size_t>:::max()]. // _H2: the range-hashing function (in the terminology of Tavori and // Dreizin). A binary function object whose argument types and result // type are all size_t. Given arguments r and N, the return value is // in the range [0, N). // _Hash: the ranged hash function (Tavori and Dreizin). A binary function // whose argument types are _Key and size_t and whose result type is // size_t. Given arguments k and N, the return value is in the range // [0, N). Default: hash(k, N) = h2(h1(k), N). If _Hash is anything other // than the default, _H1 and _H2 are ignored. // _RehashPolicy: Policy class with three members, all of which govern // the bucket count. _M_next_bkt(n) returns a bucket count no smaller // than n. _M_bkt_for_elements(n) returns a bucket count appropriate // for an element count of n. _M_need_rehash(n_bkt, n_elt, n_ins) // determines whether, if the current bucket count is n_bkt and the // current element count is n_elt, we need to increase the bucket // count. If so, returns make_pair(true, n), where n is the new // bucket count. If not, returns make_pair(false, <anything>). // ??? Right now it is hard-wired that the number of buckets never // shrinks. Should we allow _RehashPolicy to change that? // __cache_hash_code: bool. true if we store the value of the hash // function along with the value. This is a time-space tradeoff. // Storing it may improve lookup speed by reducing the number of times // we need to call the Equal function. // __constant_iterators: bool. true if iterator and const_iterator are // both constant iterator types. This is true for unordered_set and // unordered_multiset, false for unordered_map and unordered_multimap. // __unique_keys: bool. true if the return value of _Hashtable::count(k) // is always at most one, false if it may be an arbitrary number. This // true for unordered_set and unordered_map, false for unordered_multiset // and unordered_multimap. template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __cache_hash_code, bool __constant_iterators, bool __unique_keys> class _Hashtable : public __detail::_Rehash_base<_RehashPolicy, _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __cache_hash_code, __constant_iterators, __unique_keys> >, public __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, __cache_hash_code>, public __detail::_Map_base<_Key, _Value, _ExtractKey, __unique_keys, _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __cache_hash_code, __constant_iterators, __unique_keys> > { public: typedef _Allocator allocator_type; typedef _Value value_type; typedef _Key key_type; typedef _Equal key_equal; // mapped_type, if present, comes from _Map_base. // hasher, if present, comes from _Hash_code_base. typedef typename _Allocator::difference_type difference_type; typedef typename _Allocator::size_type size_type; typedef typename _Allocator::pointer pointer; typedef typename _Allocator::const_pointer const_pointer; typedef typename _Allocator::reference reference; typedef typename _Allocator::const_reference const_reference; typedef __detail::_Node_iterator<value_type, __constant_iterators, __cache_hash_code> local_iterator; typedef __detail::_Node_const_iterator<value_type, __constant_iterators, __cache_hash_code> const_local_iterator; typedef __detail::_Hashtable_iterator<value_type, __constant_iterators, __cache_hash_code> iterator; typedef __detail::_Hashtable_const_iterator<value_type, __constant_iterators, __cache_hash_code> const_iterator; template<typename _Key2, typename _Value2, typename _Ex2, bool __unique2, typename _Hashtable2> friend struct __detail::_Map_base; private: typedef __detail::_Hash_node<_Value, __cache_hash_code> _Node; typedef typename _Allocator::template rebind<_Node>::other _Node_allocator_type; typedef typename _Allocator::template rebind<_Node*>::other _Bucket_allocator_type; typedef typename _Allocator::template rebind<_Value>::other _Value_allocator_type; _Node_allocator_type _M_node_allocator; _Node** _M_buckets; size_type _M_bucket_count; size_type _M_element_count; _RehashPolicy _M_rehash_policy; _Node* _M_allocate_node(const value_type& __v); void _M_deallocate_node(_Node* __n); void _M_deallocate_nodes(_Node**, size_type); _Node** _M_allocate_buckets(size_type __n); void _M_deallocate_buckets(_Node**, size_type __n); public: // Constructor, destructor, assignment, swap _Hashtable(size_type __bucket_hint, const _H1&, const _H2&, const _Hash&, const _Equal&, const _ExtractKey&, const allocator_type&); template<typename _InputIterator> _Hashtable(_InputIterator __first, _InputIterator __last, size_type __bucket_hint, const _H1&, const _H2&, const _Hash&, const _Equal&, const _ExtractKey&, const allocator_type&); _Hashtable(const _Hashtable&); _Hashtable& operator=(const _Hashtable&); ~_Hashtable(); void swap(_Hashtable&); // Basic container operations iterator begin() { iterator __i(_M_buckets); if (!__i._M_cur_node) __i._M_incr_bucket(); return __i; } const_iterator begin() const { const_iterator __i(_M_buckets); if (!__i._M_cur_node) __i._M_incr_bucket(); return __i; } iterator end() { return iterator(_M_buckets + _M_bucket_count); } const_iterator end() const { return const_iterator(_M_buckets + _M_bucket_count); } size_type size() const { return _M_element_count; } bool empty() const { return size() == 0; } allocator_type get_allocator() const { return allocator_type(_M_node_allocator); } _Value_allocator_type _M_get_Value_allocator() const { return _Value_allocator_type(_M_node_allocator); } size_type max_size() const { return _M_node_allocator.max_size(); } // Observers key_equal key_eq() const { return this->_M_eq; } // hash_function, if present, comes from _Hash_code_base. // Bucket operations size_type bucket_count() const { return _M_bucket_count; } size_type max_bucket_count() const { return max_size(); } size_type bucket_size(size_type __n) const { return std::distance(begin(__n), end(__n)); } size_type bucket(const key_type& __k) const { return this->_M_bucket_index(__k, this->_M_hash_code(__k), bucket_count()); } local_iterator begin(size_type __n) { return local_iterator(_M_buckets[__n]); } local_iterator end(size_type) { return local_iterator(0); } const_local_iterator begin(size_type __n) const { return const_local_iterator(_M_buckets[__n]); } const_local_iterator end(size_type) const { return const_local_iterator(0); } float load_factor() const { return static_cast<float>(size()) / static_cast<float>(bucket_count()); } // max_load_factor, if present, comes from _Rehash_base. // Generalization of max_load_factor. Extension, not found in TR1. Only // useful if _RehashPolicy is something other than the default. const _RehashPolicy& __rehash_policy() const { return _M_rehash_policy; } void __rehash_policy(const _RehashPolicy&); // Lookup. iterator find(const key_type& __k); const_iterator find(const key_type& __k) const; size_type count(const key_type& __k) const; std::pair<iterator, iterator> equal_range(const key_type& __k); std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const; private: // Find, insert and erase helper functions // ??? This dispatching is a workaround for the fact that we don't // have partial specialization of member templates; it would be // better to just specialize insert on __unique_keys. There may be a // cleaner workaround. typedef typename __gnu_cxx::__conditional_type<__unique_keys, std::pair<iterator, bool>, iterator>::__type _Insert_Return_Type; typedef typename __gnu_cxx::__conditional_type<__unique_keys, std::_Select1st<_Insert_Return_Type>, std::_Identity<_Insert_Return_Type> >::__type _Insert_Conv_Type; _Node* _M_find_node(_Node*, const key_type&, typename _Hashtable::_Hash_code_type) const; iterator _M_insert_bucket(const value_type&, size_type, typename _Hashtable::_Hash_code_type); std::pair<iterator, bool> _M_insert(const value_type&, std::tr1::true_type); iterator _M_insert(const value_type&, std::tr1::false_type); void _M_erase_node(_Node*, _Node**); public: // Insert and erase _Insert_Return_Type insert(const value_type& __v) { return _M_insert(__v, std::tr1::integral_constant<bool, __unique_keys>()); } iterator insert(iterator, const value_type& __v) { return iterator(_Insert_Conv_Type()(this->insert(__v))); } const_iterator insert(const_iterator, const value_type& __v) { return const_iterator(_Insert_Conv_Type()(this->insert(__v))); } template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last); iterator erase(iterator); const_iterator erase(const_iterator); size_type erase(const key_type&); iterator erase(iterator, iterator); const_iterator erase(const_iterator, const_iterator); void clear(); // Set number of buckets to be appropriate for container of n element. void rehash(size_type __n); private: // Unconditionally change size of bucket array to n. void _M_rehash(size_type __n); }; // Definitions of class template _Hashtable's out-of-line member functions. template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::_Node* _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: _M_allocate_node(const value_type& __v) { _Node* __n = _M_node_allocator.allocate(1); __try { _M_get_Value_allocator().construct(&__n->_M_v, __v); __n->_M_next = 0; return __n; } __catch(...) { _M_node_allocator.deallocate(__n, 1); __throw_exception_again; } } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> void _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: _M_deallocate_node(_Node* __n) { _M_get_Value_allocator().destroy(&__n->_M_v); _M_node_allocator.deallocate(__n, 1); } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> void _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: _M_deallocate_nodes(_Node** __array, size_type __n) { for (size_type __i = 0; __i < __n; ++__i) { _Node* __p = __array[__i]; while (__p) { _Node* __tmp = __p; __p = __p->_M_next; _M_deallocate_node(__tmp); } __array[__i] = 0; } } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::_Node** _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: _M_allocate_buckets(size_type __n) { _Bucket_allocator_type __alloc(_M_node_allocator); // We allocate one extra bucket to hold a sentinel, an arbitrary // non-null pointer. Iterator increment relies on this. _Node** __p = __alloc.allocate(__n + 1); std::fill(__p, __p + __n, (_Node*) 0); __p[__n] = reinterpret_cast<_Node*>(0x1000); return __p; } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> void _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: _M_deallocate_buckets(_Node** __p, size_type __n) { _Bucket_allocator_type __alloc(_M_node_allocator); __alloc.deallocate(__p, __n + 1); } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: _Hashtable(size_type __bucket_hint, const _H1& __h1, const _H2& __h2, const _Hash& __h, const _Equal& __eq, const _ExtractKey& __exk, const allocator_type& __a) : __detail::_Rehash_base<_RehashPolicy, _Hashtable>(), __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, __chc>(__exk, __eq, __h1, __h2, __h), __detail::_Map_base<_Key, _Value, _ExtractKey, __uk, _Hashtable>(), _M_node_allocator(__a), _M_bucket_count(0), _M_element_count(0), _M_rehash_policy() { _M_bucket_count = _M_rehash_policy._M_next_bkt(__bucket_hint); _M_buckets = _M_allocate_buckets(_M_bucket_count); } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> template<typename _InputIterator> _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: _Hashtable(_InputIterator __f, _InputIterator __l, size_type __bucket_hint, const _H1& __h1, const _H2& __h2, const _Hash& __h, const _Equal& __eq, const _ExtractKey& __exk, const allocator_type& __a) : __detail::_Rehash_base<_RehashPolicy, _Hashtable>(), __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, __chc>(__exk, __eq, __h1, __h2, __h), __detail::_Map_base<_Key, _Value, _ExtractKey, __uk, _Hashtable>(), _M_node_allocator(__a), _M_bucket_count(0), _M_element_count(0), _M_rehash_policy() { _M_bucket_count = std::max(_M_rehash_policy._M_next_bkt(__bucket_hint), _M_rehash_policy. _M_bkt_for_elements(__detail:: __distance_fw(__f, __l))); _M_buckets = _M_allocate_buckets(_M_bucket_count); __try { for (; __f != __l; ++__f) this->insert(*__f); } __catch(...) { clear(); _M_deallocate_buckets(_M_buckets, _M_bucket_count); __throw_exception_again; } } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: _Hashtable(const _Hashtable& __ht) : __detail::_Rehash_base<_RehashPolicy, _Hashtable>(__ht), __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, __chc>(__ht), __detail::_Map_base<_Key, _Value, _ExtractKey, __uk, _Hashtable>(__ht), _M_node_allocator(__ht._M_node_allocator), _M_bucket_count(__ht._M_bucket_count), _M_element_count(__ht._M_element_count), _M_rehash_policy(__ht._M_rehash_policy) { _M_buckets = _M_allocate_buckets(_M_bucket_count); __try { for (size_type __i = 0; __i < __ht._M_bucket_count; ++__i) { _Node* __n = __ht._M_buckets[__i]; _Node** __tail = _M_buckets + __i; while (__n) { *__tail = _M_allocate_node(__n->_M_v); this->_M_copy_code(*__tail, __n); __tail = &((*__tail)->_M_next); __n = __n->_M_next; } } } __catch(...) { clear(); _M_deallocate_buckets(_M_buckets, _M_bucket_count); __throw_exception_again; } } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>& _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: operator=(const _Hashtable& __ht) { _Hashtable __tmp(__ht); this->swap(__tmp); return *this; } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: ~_Hashtable() { clear(); _M_deallocate_buckets(_M_buckets, _M_bucket_count); } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> void _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: swap(_Hashtable& __x) { // The only base class with member variables is hash_code_base. We // define _Hash_code_base::_M_swap because different specializations // have different members. __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, __chc>::_M_swap(__x); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 431. Swapping containers with unequal allocators. std::__alloc_swap<_Node_allocator_type>::_S_do_it(_M_node_allocator, __x._M_node_allocator); std::swap(_M_rehash_policy, __x._M_rehash_policy); std::swap(_M_buckets, __x._M_buckets); std::swap(_M_bucket_count, __x._M_bucket_count); std::swap(_M_element_count, __x._M_element_count); } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> void _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: __rehash_policy(const _RehashPolicy& __pol) { _M_rehash_policy = __pol; size_type __n_bkt = __pol._M_bkt_for_elements(_M_element_count); if (__n_bkt > _M_bucket_count) _M_rehash(__n_bkt); } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::iterator _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: find(const key_type& __k) { typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k); std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count); _Node* __p = _M_find_node(_M_buckets[__n], __k, __code); return __p ? iterator(__p, _M_buckets + __n) : this->end(); } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::const_iterator _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: find(const key_type& __k) const { typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k); std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count); _Node* __p = _M_find_node(_M_buckets[__n], __k, __code); return __p ? const_iterator(__p, _M_buckets + __n) : this->end(); } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::size_type _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: count(const key_type& __k) const { typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k); std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count); std::size_t __result = 0; for (_Node* __p = _M_buckets[__n]; __p; __p = __p->_M_next) if (this->_M_compare(__k, __code, __p)) ++__result; return __result; } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> std::pair<typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::iterator, typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::iterator> _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: equal_range(const key_type& __k) { typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k); std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count); _Node** __head = _M_buckets + __n; _Node* __p = _M_find_node(*__head, __k, __code); if (__p) { _Node* __p1 = __p->_M_next; for (; __p1; __p1 = __p1->_M_next) if (!this->_M_compare(__k, __code, __p1)) break; iterator __first(__p, __head); iterator __last(__p1, __head); if (!__p1) __last._M_incr_bucket(); return std::make_pair(__first, __last); } else return std::make_pair(this->end(), this->end()); } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> std::pair<typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::const_iterator, typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::const_iterator> _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: equal_range(const key_type& __k) const { typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k); std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count); _Node** __head = _M_buckets + __n; _Node* __p = _M_find_node(*__head, __k, __code); if (__p) { _Node* __p1 = __p->_M_next; for (; __p1; __p1 = __p1->_M_next) if (!this->_M_compare(__k, __code, __p1)) break; const_iterator __first(__p, __head); const_iterator __last(__p1, __head); if (!__p1) __last._M_incr_bucket(); return std::make_pair(__first, __last); } else return std::make_pair(this->end(), this->end()); } // Find the node whose key compares equal to k, beginning the search // at p (usually the head of a bucket). Return zero if no node is found. template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::_Node* _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: _M_find_node(_Node* __p, const key_type& __k, typename _Hashtable::_Hash_code_type __code) const { for (; __p; __p = __p->_M_next) if (this->_M_compare(__k, __code, __p)) return __p; return 0; } // Insert v in bucket n (assumes no element with its key already present). template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::iterator _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: _M_insert_bucket(const value_type& __v, size_type __n, typename _Hashtable::_Hash_code_type __code) { std::pair<bool, std::size_t> __do_rehash = _M_rehash_policy._M_need_rehash(_M_bucket_count, _M_element_count, 1); // Allocate the new node before doing the rehash so that we don't // do a rehash if the allocation throws. _Node* __new_node = _M_allocate_node(__v); __try { if (__do_rehash.first) { const key_type& __k = this->_M_extract(__v); __n = this->_M_bucket_index(__k, __code, __do_rehash.second); _M_rehash(__do_rehash.second); } __new_node->_M_next = _M_buckets[__n]; this->_M_store_code(__new_node, __code); _M_buckets[__n] = __new_node; ++_M_element_count; return iterator(__new_node, _M_buckets + __n); } __catch(...) { _M_deallocate_node(__new_node); __throw_exception_again; } } // Insert v if no element with its key is already present. template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> std::pair<typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::iterator, bool> _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: _M_insert(const value_type& __v, std::tr1::true_type) { const key_type& __k = this->_M_extract(__v); typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k); size_type __n = this->_M_bucket_index(__k, __code, _M_bucket_count); if (_Node* __p = _M_find_node(_M_buckets[__n], __k, __code)) return std::make_pair(iterator(__p, _M_buckets + __n), false); return std::make_pair(_M_insert_bucket(__v, __n, __code), true); } // Insert v unconditionally. template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::iterator _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: _M_insert(const value_type& __v, std::tr1::false_type) { std::pair<bool, std::size_t> __do_rehash = _M_rehash_policy._M_need_rehash(_M_bucket_count, _M_element_count, 1); if (__do_rehash.first) _M_rehash(__do_rehash.second); const key_type& __k = this->_M_extract(__v); typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k); size_type __n = this->_M_bucket_index(__k, __code, _M_bucket_count); // First find the node, avoid leaking new_node if compare throws. _Node* __prev = _M_find_node(_M_buckets[__n], __k, __code); _Node* __new_node = _M_allocate_node(__v); if (__prev) { __new_node->_M_next = __prev->_M_next; __prev->_M_next = __new_node; } else { __new_node->_M_next = _M_buckets[__n]; _M_buckets[__n] = __new_node; } this->_M_store_code(__new_node, __code); ++_M_element_count; return iterator(__new_node, _M_buckets + __n); } // For erase(iterator) and erase(const_iterator). template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> void _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: _M_erase_node(_Node* __p, _Node** __b) { _Node* __cur = *__b; if (__cur == __p) *__b = __cur->_M_next; else { _Node* __next = __cur->_M_next; while (__next != __p) { __cur = __next; __next = __cur->_M_next; } __cur->_M_next = __next->_M_next; } _M_deallocate_node(__p); --_M_element_count; } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> template<typename _InputIterator> void _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: insert(_InputIterator __first, _InputIterator __last) { size_type __n_elt = __detail::__distance_fw(__first, __last); std::pair<bool, std::size_t> __do_rehash = _M_rehash_policy._M_need_rehash(_M_bucket_count, _M_element_count, __n_elt); if (__do_rehash.first) _M_rehash(__do_rehash.second); for (; __first != __last; ++__first) this->insert(*__first); } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::iterator _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: erase(iterator __it) { iterator __result = __it; ++__result; _M_erase_node(__it._M_cur_node, __it._M_cur_bucket); return __result; } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::const_iterator _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: erase(const_iterator __it) { const_iterator __result = __it; ++__result; _M_erase_node(__it._M_cur_node, __it._M_cur_bucket); return __result; } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::size_type _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: erase(const key_type& __k) { typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k); std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count); size_type __result = 0; _Node** __slot = _M_buckets + __n; while (*__slot && !this->_M_compare(__k, __code, *__slot)) __slot = &((*__slot)->_M_next); _Node** __saved_slot = 0; while (*__slot && this->_M_compare(__k, __code, *__slot)) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 526. Is it undefined if a function in the standard changes // in parameters? if (&this->_M_extract((*__slot)->_M_v) != &__k) { _Node* __p = *__slot; *__slot = __p->_M_next; _M_deallocate_node(__p); --_M_element_count; ++__result; } else { __saved_slot = __slot; __slot = &((*__slot)->_M_next); } } if (__saved_slot) { _Node* __p = *__saved_slot; *__saved_slot = __p->_M_next; _M_deallocate_node(__p); --_M_element_count; ++__result; } return __result; } // ??? This could be optimized by taking advantage of the bucket // structure, but it's not clear that it's worth doing. It probably // wouldn't even be an optimization unless the load factor is large. template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::iterator _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: erase(iterator __first, iterator __last) { while (__first != __last) __first = this->erase(__first); return __last; } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::const_iterator _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: erase(const_iterator __first, const_iterator __last) { while (__first != __last) __first = this->erase(__first); return __last; } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> void _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: clear() { _M_deallocate_nodes(_M_buckets, _M_bucket_count); _M_element_count = 0; } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> void _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: rehash(size_type __n) { _M_rehash(std::max(_M_rehash_policy._M_next_bkt(__n), _M_rehash_policy._M_bkt_for_elements(_M_element_count + 1))); } template<typename _Key, typename _Value, typename _Allocator, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, bool __chc, bool __cit, bool __uk> void _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: _M_rehash(size_type __n) { _Node** __new_array = _M_allocate_buckets(__n); __try { for (size_type __i = 0; __i < _M_bucket_count; ++__i) while (_Node* __p = _M_buckets[__i]) { std::size_t __new_index = this->_M_bucket_index(__p, __n); _M_buckets[__i] = __p->_M_next; __p->_M_next = __new_array[__new_index]; __new_array[__new_index] = __p; } _M_deallocate_buckets(_M_buckets, _M_bucket_count); _M_bucket_count = __n; _M_buckets = __new_array; } __catch(...) { // A failure here means that a hash function threw an exception. // We can't restore the previous state without calling the hash // function again, so the only sensible recovery is to delete // everything. _M_deallocate_nodes(__new_array, __n); _M_deallocate_buckets(__new_array, __n); _M_deallocate_nodes(_M_buckets, _M_bucket_count); _M_element_count = 0; __throw_exception_again; } } _GLIBCXX_END_NAMESPACE_VERSION } // namespace tr1 } // namespace std #endif // _GLIBCXX_TR1_HASHTABLE_H ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tr1/array���������������������������������������������������������������������������������0000644�����������������00000015464�14763166027�0007362 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// class template array -*- C++ -*- // Copyright (C) 2004-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tr1/array * This is a TR1 C++ Library header. */ #ifndef _GLIBCXX_TR1_ARRAY #define _GLIBCXX_TR1_ARRAY 1 #pragma GCC system_header #include <bits/stl_algobase.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief A standard container for storing a fixed size sequence of elements. * * @ingroup sequences * * Meets the requirements of a <a href="tables.html#65">container</a>, a * <a href="tables.html#66">reversible container</a>, and a * <a href="tables.html#67">sequence</a>. * * Sets support random access iterators. * * @param Tp Type of element. Required to be a complete type. * @param N Number of elements. */ template<typename _Tp, std::size_t _Nm> struct array { typedef _Tp value_type; typedef value_type& reference; typedef const value_type& const_reference; typedef value_type* iterator; typedef const value_type* const_iterator; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // Support for zero-sized arrays mandatory. value_type _M_instance[_Nm ? _Nm : 1]; // No explicit construct/copy/destroy for aggregate type. void assign(const value_type& __u) { std::fill_n(begin(), size(), __u); } void swap(array& __other) { std::swap_ranges(begin(), end(), __other.begin()); } // Iterators. iterator begin() { return iterator(std::__addressof(_M_instance[0])); } const_iterator begin() const { return const_iterator(std::__addressof(_M_instance[0])); } iterator end() { return iterator(std::__addressof(_M_instance[_Nm])); } const_iterator end() const { return const_iterator(std::__addressof(_M_instance[_Nm])); } reverse_iterator rbegin() { return reverse_iterator(end()); } const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } reverse_iterator rend() { return reverse_iterator(begin()); } const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } // Capacity. size_type size() const { return _Nm; } size_type max_size() const { return _Nm; } bool empty() const { return size() == 0; } // Element access. reference operator[](size_type __n) { return _M_instance[__n]; } const_reference operator[](size_type __n) const { return _M_instance[__n]; } reference at(size_type __n) { if (__n >= _Nm) std::__throw_out_of_range(__N("array::at")); return _M_instance[__n]; } const_reference at(size_type __n) const { if (__n >= _Nm) std::__throw_out_of_range(__N("array::at")); return _M_instance[__n]; } reference front() { return *begin(); } const_reference front() const { return *begin(); } reference back() { return _Nm ? *(end() - 1) : *end(); } const_reference back() const { return _Nm ? *(end() - 1) : *end(); } _Tp* data() { return std::__addressof(_M_instance[0]); } const _Tp* data() const { return std::__addressof(_M_instance[0]); } }; // Array comparisons. template<typename _Tp, std::size_t _Nm> inline bool operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return std::equal(__one.begin(), __one.end(), __two.begin()); } template<typename _Tp, std::size_t _Nm> inline bool operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return !(__one == __two); } template<typename _Tp, std::size_t _Nm> inline bool operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b) { return std::lexicographical_compare(__a.begin(), __a.end(), __b.begin(), __b.end()); } template<typename _Tp, std::size_t _Nm> inline bool operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return __two < __one; } template<typename _Tp, std::size_t _Nm> inline bool operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return !(__one > __two); } template<typename _Tp, std::size_t _Nm> inline bool operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return !(__one < __two); } // Specialized algorithms [6.2.2.2]. template<typename _Tp, std::size_t _Nm> inline void swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two) { __one.swap(__two); } // Tuple interface to class template array [6.2.2.5]. /// tuple_size template<typename _Tp> class tuple_size; /// tuple_element template<int _Int, typename _Tp> class tuple_element; template<typename _Tp, std::size_t _Nm> struct tuple_size<array<_Tp, _Nm> > { static const int value = _Nm; }; template<typename _Tp, std::size_t _Nm> const int tuple_size<array<_Tp, _Nm> >::value; template<int _Int, typename _Tp, std::size_t _Nm> struct tuple_element<_Int, array<_Tp, _Nm> > { typedef _Tp type; }; template<int _Int, typename _Tp, std::size_t _Nm> inline _Tp& get(array<_Tp, _Nm>& __arr) { return __arr[_Int]; } template<int _Int, typename _Tp, std::size_t _Nm> inline const _Tp& get(const array<_Tp, _Nm>& __arr) { return __arr[_Int]; } _GLIBCXX_END_NAMESPACE_VERSION } } #endif // _GLIBCXX_TR1_ARRAY ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ccomplex����������������������������������������������������������������������������������0000644�����������������00000002446�14763166027�0007344 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <ccomplex> -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/ccomplex * This is a Standard C++ Library header. */ #pragma GCC system_header #ifndef _GLIBCXX_CCOMPLEX #define _GLIBCXX_CCOMPLEX 1 #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #endif #include <complex> #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/cstdalign���������������������������������������������������������������������������������0000644�����������������00000002577�14763166027�0007507 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <cstdalign> -*- C++ -*- // Copyright (C) 2011-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/cstdalign * This is a Standard C++ Library header. */ #pragma GCC system_header #ifndef _GLIBCXX_CSTDALIGN #define _GLIBCXX_CSTDALIGN 1 #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else # include <bits/c++config.h> # if _GLIBCXX_HAVE_STDALIGN_H # include <stdalign.h> # endif #endif #endif ���������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/cassert�����������������������������������������������������������������������������������0000644�����������������00000003124�14763166027�0007170 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- forwarding header. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file cassert * This is a Standard C++ Library file. You should @c \#include this file * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c assert.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std (except for names which are defined * as macros in C). */ // // ISO C++ 14882: 19.2 Assertions // // No include guards on this header... #pragma GCC system_header #include <assert.h> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/chrono������������������������������������������������������������������������������������0000644�����������������00000056054�14763166027�0007026 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <chrono> -*- C++ -*- // Copyright (C) 2008-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/chrono * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_CHRONO #define _GLIBCXX_CHRONO 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <ratio> #include <type_traits> #include <limits> #include <ctime> #ifdef _GLIBCXX_USE_C99_STDINT_TR1 namespace std _GLIBCXX_VISIBILITY(default) { /** * @defgroup chrono Time * @ingroup utilities * * Classes and functions for time. * @{ */ /** @namespace std::chrono * @brief ISO C++ 2011 entities sub-namespace for time and date. */ namespace chrono { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Rep, typename _Period = ratio<1>> struct duration; template<typename _Clock, typename _Dur = typename _Clock::duration> struct time_point; _GLIBCXX_END_NAMESPACE_VERSION } _GLIBCXX_BEGIN_NAMESPACE_VERSION // 20.11.4.3 specialization of common_type (for duration, sfinae-friendly) template<typename _CT, typename _Period1, typename _Period2> struct __duration_common_type_wrapper { private: typedef __static_gcd<_Period1::num, _Period2::num> __gcd_num; typedef __static_gcd<_Period1::den, _Period2::den> __gcd_den; typedef typename _CT::type __cr; typedef ratio<__gcd_num::value, (_Period1::den / __gcd_den::value) * _Period2::den> __r; public: typedef __success_type<chrono::duration<__cr, __r>> type; }; template<typename _Period1, typename _Period2> struct __duration_common_type_wrapper<__failure_type, _Period1, _Period2> { typedef __failure_type type; }; template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2> struct common_type<chrono::duration<_Rep1, _Period1>, chrono::duration<_Rep2, _Period2>> : public __duration_common_type_wrapper<typename __member_type_wrapper< common_type<_Rep1, _Rep2>>::type, _Period1, _Period2>::type { }; // 20.11.4.3 specialization of common_type (for time_point, sfinae-friendly) template<typename _CT, typename _Clock> struct __timepoint_common_type_wrapper { typedef __success_type<chrono::time_point<_Clock, typename _CT::type>> type; }; template<typename _Clock> struct __timepoint_common_type_wrapper<__failure_type, _Clock> { typedef __failure_type type; }; template<typename _Clock, typename _Duration1, typename _Duration2> struct common_type<chrono::time_point<_Clock, _Duration1>, chrono::time_point<_Clock, _Duration2>> : public __timepoint_common_type_wrapper<typename __member_type_wrapper< common_type<_Duration1, _Duration2>>::type, _Clock>::type { }; _GLIBCXX_END_NAMESPACE_VERSION namespace chrono { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Primary template for duration_cast impl. template<typename _ToDur, typename _CF, typename _CR, bool _NumIsOne = false, bool _DenIsOne = false> struct __duration_cast_impl { template<typename _Rep, typename _Period> static constexpr _ToDur __cast(const duration<_Rep, _Period>& __d) { typedef typename _ToDur::rep __to_rep; return _ToDur(static_cast<__to_rep>(static_cast<_CR>(__d.count()) * static_cast<_CR>(_CF::num) / static_cast<_CR>(_CF::den))); } }; template<typename _ToDur, typename _CF, typename _CR> struct __duration_cast_impl<_ToDur, _CF, _CR, true, true> { template<typename _Rep, typename _Period> static constexpr _ToDur __cast(const duration<_Rep, _Period>& __d) { typedef typename _ToDur::rep __to_rep; return _ToDur(static_cast<__to_rep>(__d.count())); } }; template<typename _ToDur, typename _CF, typename _CR> struct __duration_cast_impl<_ToDur, _CF, _CR, true, false> { template<typename _Rep, typename _Period> static constexpr _ToDur __cast(const duration<_Rep, _Period>& __d) { typedef typename _ToDur::rep __to_rep; return _ToDur(static_cast<__to_rep>( static_cast<_CR>(__d.count()) / static_cast<_CR>(_CF::den))); } }; template<typename _ToDur, typename _CF, typename _CR> struct __duration_cast_impl<_ToDur, _CF, _CR, false, true> { template<typename _Rep, typename _Period> static constexpr _ToDur __cast(const duration<_Rep, _Period>& __d) { typedef typename _ToDur::rep __to_rep; return _ToDur(static_cast<__to_rep>( static_cast<_CR>(__d.count()) * static_cast<_CR>(_CF::num))); } }; template<typename _Tp> struct __is_duration : std::false_type { }; template<typename _Rep, typename _Period> struct __is_duration<duration<_Rep, _Period>> : std::true_type { }; /// duration_cast template<typename _ToDur, typename _Rep, typename _Period> constexpr typename enable_if<__is_duration<_ToDur>::value, _ToDur>::type duration_cast(const duration<_Rep, _Period>& __d) { typedef typename _ToDur::period __to_period; typedef typename _ToDur::rep __to_rep; typedef ratio_divide<_Period, __to_period> __cf; typedef typename common_type<__to_rep, _Rep, intmax_t>::type __cr; typedef __duration_cast_impl<_ToDur, __cf, __cr, __cf::num == 1, __cf::den == 1> __dc; return __dc::__cast(__d); } /// treat_as_floating_point template<typename _Rep> struct treat_as_floating_point : is_floating_point<_Rep> { }; /// duration_values template<typename _Rep> struct duration_values { static constexpr _Rep zero() { return _Rep(0); } static constexpr _Rep max() { return numeric_limits<_Rep>::max(); } static constexpr _Rep min() { return numeric_limits<_Rep>::lowest(); } }; template<typename _Tp> struct __is_ratio : std::false_type { }; template<intmax_t _Num, intmax_t _Den> struct __is_ratio<ratio<_Num, _Den>> : std::true_type { }; /// duration template<typename _Rep, typename _Period> struct duration { typedef _Rep rep; typedef _Period period; static_assert(!__is_duration<_Rep>::value, "rep cannot be a duration"); static_assert(__is_ratio<_Period>::value, "period must be a specialization of ratio"); static_assert(_Period::num > 0, "period must be positive"); // 20.11.5.1 construction / copy / destroy constexpr duration() = default; // NB: Make constexpr implicit. This cannot be explicitly // constexpr, as any UDT that is not a literal type with a // constexpr copy constructor will be ill-formed. duration(const duration&) = default; template<typename _Rep2, typename = typename enable_if<is_convertible<_Rep2, rep>::value && (treat_as_floating_point<rep>::value || !treat_as_floating_point<_Rep2>::value)>::type> constexpr explicit duration(const _Rep2& __rep) : __r(static_cast<rep>(__rep)) { } template<typename _Rep2, typename _Period2, typename = typename enable_if<treat_as_floating_point<rep>::value || (ratio_divide<_Period2, period>::den == 1 && !treat_as_floating_point<_Rep2>::value)>::type> constexpr duration(const duration<_Rep2, _Period2>& __d) : __r(duration_cast<duration>(__d).count()) { } ~duration() = default; duration& operator=(const duration&) = default; // 20.11.5.2 observer constexpr rep count() const { return __r; } // 20.11.5.3 arithmetic constexpr duration operator+() const { return *this; } constexpr duration operator-() const { return duration(-__r); } duration& operator++() { ++__r; return *this; } duration operator++(int) { return duration(__r++); } duration& operator--() { --__r; return *this; } duration operator--(int) { return duration(__r--); } duration& operator+=(const duration& __d) { __r += __d.count(); return *this; } duration& operator-=(const duration& __d) { __r -= __d.count(); return *this; } duration& operator*=(const rep& __rhs) { __r *= __rhs; return *this; } duration& operator/=(const rep& __rhs) { __r /= __rhs; return *this; } // DR 934. template<typename _Rep2 = rep> typename enable_if<!treat_as_floating_point<_Rep2>::value, duration&>::type operator%=(const rep& __rhs) { __r %= __rhs; return *this; } template<typename _Rep2 = rep> typename enable_if<!treat_as_floating_point<_Rep2>::value, duration&>::type operator%=(const duration& __d) { __r %= __d.count(); return *this; } // 20.11.5.4 special values static constexpr duration zero() { return duration(duration_values<rep>::zero()); } static constexpr duration min() { return duration(duration_values<rep>::min()); } static constexpr duration max() { return duration(duration_values<rep>::max()); } private: rep __r; }; template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2> constexpr typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2>>::type operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { typedef duration<_Rep1, _Period1> __dur1; typedef duration<_Rep2, _Period2> __dur2; typedef typename common_type<__dur1,__dur2>::type __cd; return __cd(__cd(__lhs).count() + __cd(__rhs).count()); } template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2> constexpr typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2>>::type operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { typedef duration<_Rep1, _Period1> __dur1; typedef duration<_Rep2, _Period2> __dur2; typedef typename common_type<__dur1,__dur2>::type __cd; return __cd(__cd(__lhs).count() - __cd(__rhs).count()); } template<typename _Rep1, typename _Rep2, bool = is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value> struct __common_rep_type { }; template<typename _Rep1, typename _Rep2> struct __common_rep_type<_Rep1, _Rep2, true> { typedef typename common_type<_Rep1, _Rep2>::type type; }; template<typename _Rep1, typename _Period, typename _Rep2> constexpr duration<typename __common_rep_type<_Rep1, _Rep2>::type, _Period> operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period> __cd; return __cd(__cd(__d).count() * __s); } template<typename _Rep1, typename _Rep2, typename _Period> constexpr duration<typename __common_rep_type<_Rep2, _Rep1>::type, _Period> operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d) { return __d * __s; } template<typename _Rep1, typename _Period, typename _Rep2> constexpr duration<typename __common_rep_type<_Rep1, typename enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::type, _Period> operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period> __cd; return __cd(__cd(__d).count() / __s); } template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2> constexpr typename common_type<_Rep1, _Rep2>::type operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { typedef duration<_Rep1, _Period1> __dur1; typedef duration<_Rep2, _Period2> __dur2; typedef typename common_type<__dur1,__dur2>::type __cd; return __cd(__lhs).count() / __cd(__rhs).count(); } // DR 934. template<typename _Rep1, typename _Period, typename _Rep2> constexpr duration<typename __common_rep_type<_Rep1, typename enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::type, _Period> operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period> __cd; return __cd(__cd(__d).count() % __s); } template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2> constexpr typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2>>::type operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { typedef duration<_Rep1, _Period1> __dur1; typedef duration<_Rep2, _Period2> __dur2; typedef typename common_type<__dur1,__dur2>::type __cd; return __cd(__cd(__lhs).count() % __cd(__rhs).count()); } // comparisons template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2> constexpr bool operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { typedef duration<_Rep1, _Period1> __dur1; typedef duration<_Rep2, _Period2> __dur2; typedef typename common_type<__dur1,__dur2>::type __ct; return __ct(__lhs).count() == __ct(__rhs).count(); } template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2> constexpr bool operator<(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { typedef duration<_Rep1, _Period1> __dur1; typedef duration<_Rep2, _Period2> __dur2; typedef typename common_type<__dur1,__dur2>::type __ct; return __ct(__lhs).count() < __ct(__rhs).count(); } template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2> constexpr bool operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { return !(__lhs == __rhs); } template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2> constexpr bool operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { return !(__rhs < __lhs); } template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2> constexpr bool operator>(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { return __rhs < __lhs; } template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2> constexpr bool operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { return !(__lhs < __rhs); } /// nanoseconds typedef duration<int64_t, nano> nanoseconds; /// microseconds typedef duration<int64_t, micro> microseconds; /// milliseconds typedef duration<int64_t, milli> milliseconds; /// seconds typedef duration<int64_t> seconds; /// minutes typedef duration<int, ratio< 60>> minutes; /// hours typedef duration<int, ratio<3600>> hours; /// time_point template<typename _Clock, typename _Dur> struct time_point { typedef _Clock clock; typedef _Dur duration; typedef typename duration::rep rep; typedef typename duration::period period; constexpr time_point() : __d(duration::zero()) { } constexpr explicit time_point(const duration& __dur) : __d(__dur) { } // conversions template<typename _Dur2> constexpr time_point(const time_point<clock, _Dur2>& __t) : __d(__t.time_since_epoch()) { } // observer constexpr duration time_since_epoch() const { return __d; } // arithmetic time_point& operator+=(const duration& __dur) { __d += __dur; return *this; } time_point& operator-=(const duration& __dur) { __d -= __dur; return *this; } // special values static constexpr time_point min() { return time_point(duration::min()); } static constexpr time_point max() { return time_point(duration::max()); } private: duration __d; }; /// time_point_cast template<typename _ToDur, typename _Clock, typename _Dur> constexpr typename enable_if<__is_duration<_ToDur>::value, time_point<_Clock, _ToDur>>::type time_point_cast(const time_point<_Clock, _Dur>& __t) { typedef time_point<_Clock, _ToDur> __time_point; return __time_point(duration_cast<_ToDur>(__t.time_since_epoch())); } template<typename _Clock, typename _Dur1, typename _Rep2, typename _Period2> constexpr time_point<_Clock, typename common_type<_Dur1, duration<_Rep2, _Period2>>::type> operator+(const time_point<_Clock, _Dur1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { typedef duration<_Rep2, _Period2> __dur2; typedef typename common_type<_Dur1,__dur2>::type __ct; typedef time_point<_Clock, __ct> __time_point; return __time_point(__lhs.time_since_epoch() + __rhs); } template<typename _Rep1, typename _Period1, typename _Clock, typename _Dur2> constexpr time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Dur2>::type> operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Dur2>& __rhs) { typedef duration<_Rep1, _Period1> __dur1; typedef typename common_type<__dur1,_Dur2>::type __ct; typedef time_point<_Clock, __ct> __time_point; return __time_point(__rhs.time_since_epoch() + __lhs); } template<typename _Clock, typename _Dur1, typename _Rep2, typename _Period2> constexpr time_point<_Clock, typename common_type<_Dur1, duration<_Rep2, _Period2>>::type> operator-(const time_point<_Clock, _Dur1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { typedef duration<_Rep2, _Period2> __dur2; typedef typename common_type<_Dur1,__dur2>::type __ct; typedef time_point<_Clock, __ct> __time_point; return __time_point(__lhs.time_since_epoch() -__rhs); } template<typename _Clock, typename _Dur1, typename _Dur2> constexpr typename common_type<_Dur1, _Dur2>::type operator-(const time_point<_Clock, _Dur1>& __lhs, const time_point<_Clock, _Dur2>& __rhs) { return __lhs.time_since_epoch() - __rhs.time_since_epoch(); } template<typename _Clock, typename _Dur1, typename _Dur2> constexpr bool operator==(const time_point<_Clock, _Dur1>& __lhs, const time_point<_Clock, _Dur2>& __rhs) { return __lhs.time_since_epoch() == __rhs.time_since_epoch(); } template<typename _Clock, typename _Dur1, typename _Dur2> constexpr bool operator!=(const time_point<_Clock, _Dur1>& __lhs, const time_point<_Clock, _Dur2>& __rhs) { return !(__lhs == __rhs); } template<typename _Clock, typename _Dur1, typename _Dur2> constexpr bool operator<(const time_point<_Clock, _Dur1>& __lhs, const time_point<_Clock, _Dur2>& __rhs) { return __lhs.time_since_epoch() < __rhs.time_since_epoch(); } template<typename _Clock, typename _Dur1, typename _Dur2> constexpr bool operator<=(const time_point<_Clock, _Dur1>& __lhs, const time_point<_Clock, _Dur2>& __rhs) { return !(__rhs < __lhs); } template<typename _Clock, typename _Dur1, typename _Dur2> constexpr bool operator>(const time_point<_Clock, _Dur1>& __lhs, const time_point<_Clock, _Dur2>& __rhs) { return __rhs < __lhs; } template<typename _Clock, typename _Dur1, typename _Dur2> constexpr bool operator>=(const time_point<_Clock, _Dur1>& __lhs, const time_point<_Clock, _Dur2>& __rhs) { return !(__lhs < __rhs); } // Clocks. // Why nanosecond resolution as the default? // Why have std::system_clock always count in the higest // resolution (ie nanoseconds), even if on some OSes the low 3 // or 9 decimal digits will be always zero? This allows later // implementations to change the system_clock::now() // implementation any time to provide better resolution without // changing function signature or units. // To support the (forward) evolution of the library's defined // clocks, wrap inside inline namespace so that the current // defintions of system_clock, steady_clock, and // high_resolution_clock types are uniquely mangled. This way, new // code can use the latests clocks, while the library can contain // compatibility definitions for previous versions. At some // point, when these clocks settle down, the inlined namespaces // can be removed. XXX GLIBCXX_ABI Deprecated inline namespace _V2 { /** * @brief System clock. * * Time returned represents wall time from the system-wide clock. */ struct system_clock { typedef chrono::nanoseconds duration; typedef duration::rep rep; typedef duration::period period; typedef chrono::time_point<system_clock, duration> time_point; static_assert(system_clock::duration::min() < system_clock::duration::zero(), "a clock's minimum duration cannot be less than its epoch"); static constexpr bool is_steady = false; static time_point now() noexcept; // Map to C API static std::time_t to_time_t(const time_point& __t) noexcept { return std::time_t(duration_cast<chrono::seconds> (__t.time_since_epoch()).count()); } static time_point from_time_t(std::time_t __t) noexcept { typedef chrono::time_point<system_clock, seconds> __from; return time_point_cast<system_clock::duration> (__from(chrono::seconds(__t))); } }; /** * @brief Monotonic clock * * Time returned has the property of only increasing at a uniform rate. */ struct steady_clock { typedef chrono::nanoseconds duration; typedef duration::rep rep; typedef duration::period period; typedef chrono::time_point<steady_clock, duration> time_point; static constexpr bool is_steady = true; static time_point now() noexcept; }; /** * @brief Highest-resolution clock * * This is the clock "with the shortest tick period." Alias to * std::system_clock until higher-than-nanosecond definitions * become feasible. */ using high_resolution_clock = system_clock; } // end inline namespace _V2 _GLIBCXX_END_NAMESPACE_VERSION } // namespace chrono // @} group chrono } // namespace #endif //_GLIBCXX_USE_C99_STDINT_TR1 #endif // C++11 #endif //_GLIBCXX_CHRONO ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/tgmath.h����������������������������������������������������������������������������������0000644�����������������00000002520�14763166027�0007235 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- compatibility header. // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file tgmath.h * This is a Standard C++ Library header. */ #include <bits/c++config.h> #if __cplusplus >= 201103L # include <ctgmath> #else # if _GLIBCXX_HAVE_TGMATH_H # include_next <tgmath.h> # endif #endif #ifndef _GLIBCXX_TGMATH_H #define _GLIBCXX_TGMATH_H 1 #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/random������������������������������������������������������������������������������������0000644�����������������00000003256�14763166027�0007012 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <random> -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/random * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_RANDOM #define _GLIBCXX_RANDOM 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <cmath> #include <cstdio> #include <cstdlib> #include <string> #include <iosfwd> #include <limits> #include <debug/debug.h> #include <type_traits> #ifdef _GLIBCXX_USE_C99_STDINT_TR1 #include <cstdint> // For uint_fast32_t, uint_fast64_t, uint_least32_t #include <bits/random.h> #include <bits/opt_random.h> #include <bits/random.tcc> #endif // _GLIBCXX_USE_C99_STDINT_TR1 #endif // C++11 #endif // _GLIBCXX_RANDOM ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/cstdarg�����������������������������������������������������������������������������������0000644�����������������00000003464�14763166027�0007162 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- forwarding header. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/cstdarg * This is a Standard C++ Library file. You should @c \#include this file * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c stdarg.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std (except for names which are defined * as macros in C). */ // // ISO C++ 14882: 20.4.6 C library // #pragma GCC system_header #include <bits/c++config.h> #include <stdarg.h> #ifndef _GLIBCXX_CSTDARG #define _GLIBCXX_CSTDARG 1 // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 #ifndef va_end #define va_end(ap) va_end (ap) #endif namespace std { using ::va_list; } // namespace std #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/cmath�������������������������������������������������������������������������������������0000644�����������������00000122715�14763166027�0006630 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- C forwarding header. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/cmath * This is a Standard C++ Library file. You should @c \#include this file * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c math.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std (except for names which are defined * as macros in C). */ // // ISO C++ 14882: 26.5 C library // #pragma GCC system_header #include <bits/c++config.h> #include <bits/cpp_type_traits.h> #include <ext/type_traits.h> #include <math.h> #ifndef _GLIBCXX_CMATH #define _GLIBCXX_CMATH 1 // Get rid of those macros defined in <math.h> in lieu of real functions. #undef abs #undef div #undef acos #undef asin #undef atan #undef atan2 #undef ceil #undef cos #undef cosh #undef exp #undef fabs #undef floor #undef fmod #undef frexp #undef ldexp #undef log #undef log10 #undef modf #undef pow #undef sin #undef sinh #undef sqrt #undef tan #undef tanh namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR double abs(double __x) { return __builtin_fabs(__x); } #endif #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float abs(float __x) { return __builtin_fabsf(__x); } inline _GLIBCXX_CONSTEXPR long double abs(long double __x) { return __builtin_fabsl(__x); } #endif template<typename _Tp> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type abs(_Tp __x) { return __builtin_fabs(__x); } using ::acos; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float acos(float __x) { return __builtin_acosf(__x); } inline _GLIBCXX_CONSTEXPR long double acos(long double __x) { return __builtin_acosl(__x); } #endif template<typename _Tp> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type acos(_Tp __x) { return __builtin_acos(__x); } using ::asin; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float asin(float __x) { return __builtin_asinf(__x); } inline _GLIBCXX_CONSTEXPR long double asin(long double __x) { return __builtin_asinl(__x); } #endif template<typename _Tp> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type asin(_Tp __x) { return __builtin_asin(__x); } using ::atan; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float atan(float __x) { return __builtin_atanf(__x); } inline _GLIBCXX_CONSTEXPR long double atan(long double __x) { return __builtin_atanl(__x); } #endif template<typename _Tp> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type atan(_Tp __x) { return __builtin_atan(__x); } using ::atan2; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float atan2(float __y, float __x) { return __builtin_atan2f(__y, __x); } inline _GLIBCXX_CONSTEXPR long double atan2(long double __y, long double __x) { return __builtin_atan2l(__y, __x); } #endif template<typename _Tp, typename _Up> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__promote_2<_Tp, _Up>::__type atan2(_Tp __y, _Up __x) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return atan2(__type(__y), __type(__x)); } using ::ceil; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float ceil(float __x) { return __builtin_ceilf(__x); } inline _GLIBCXX_CONSTEXPR long double ceil(long double __x) { return __builtin_ceill(__x); } #endif template<typename _Tp> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type ceil(_Tp __x) { return __builtin_ceil(__x); } using ::cos; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float cos(float __x) { return __builtin_cosf(__x); } inline _GLIBCXX_CONSTEXPR long double cos(long double __x) { return __builtin_cosl(__x); } #endif template<typename _Tp> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type cos(_Tp __x) { return __builtin_cos(__x); } using ::cosh; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float cosh(float __x) { return __builtin_coshf(__x); } inline _GLIBCXX_CONSTEXPR long double cosh(long double __x) { return __builtin_coshl(__x); } #endif template<typename _Tp> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type cosh(_Tp __x) { return __builtin_cosh(__x); } using ::exp; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float exp(float __x) { return __builtin_expf(__x); } inline _GLIBCXX_CONSTEXPR long double exp(long double __x) { return __builtin_expl(__x); } #endif template<typename _Tp> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type exp(_Tp __x) { return __builtin_exp(__x); } using ::fabs; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float fabs(float __x) { return __builtin_fabsf(__x); } inline _GLIBCXX_CONSTEXPR long double fabs(long double __x) { return __builtin_fabsl(__x); } #endif template<typename _Tp> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type fabs(_Tp __x) { return __builtin_fabs(__x); } using ::floor; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float floor(float __x) { return __builtin_floorf(__x); } inline _GLIBCXX_CONSTEXPR long double floor(long double __x) { return __builtin_floorl(__x); } #endif template<typename _Tp> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type floor(_Tp __x) { return __builtin_floor(__x); } using ::fmod; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float fmod(float __x, float __y) { return __builtin_fmodf(__x, __y); } inline _GLIBCXX_CONSTEXPR long double fmod(long double __x, long double __y) { return __builtin_fmodl(__x, __y); } #endif template<typename _Tp, typename _Up> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__promote_2<_Tp, _Up>::__type fmod(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return fmod(__type(__x), __type(__y)); } using ::frexp; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline float frexp(float __x, int* __exp) { return __builtin_frexpf(__x, __exp); } inline long double frexp(long double __x, int* __exp) { return __builtin_frexpl(__x, __exp); } #endif template<typename _Tp> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type frexp(_Tp __x, int* __exp) { return __builtin_frexp(__x, __exp); } using ::ldexp; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float ldexp(float __x, int __exp) { return __builtin_ldexpf(__x, __exp); } inline _GLIBCXX_CONSTEXPR long double ldexp(long double __x, int __exp) { return __builtin_ldexpl(__x, __exp); } #endif template<typename _Tp> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type ldexp(_Tp __x, int __exp) { return __builtin_ldexp(__x, __exp); } using ::log; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float log(float __x) { return __builtin_logf(__x); } inline _GLIBCXX_CONSTEXPR long double log(long double __x) { return __builtin_logl(__x); } #endif template<typename _Tp> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type log(_Tp __x) { return __builtin_log(__x); } using ::log10; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float log10(float __x) { return __builtin_log10f(__x); } inline _GLIBCXX_CONSTEXPR long double log10(long double __x) { return __builtin_log10l(__x); } #endif template<typename _Tp> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type log10(_Tp __x) { return __builtin_log10(__x); } using ::modf; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline float modf(float __x, float* __iptr) { return __builtin_modff(__x, __iptr); } inline long double modf(long double __x, long double* __iptr) { return __builtin_modfl(__x, __iptr); } #endif using ::pow; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float pow(float __x, float __y) { return __builtin_powf(__x, __y); } inline _GLIBCXX_CONSTEXPR long double pow(long double __x, long double __y) { return __builtin_powl(__x, __y); } #if __cplusplus < 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 550. What should the return type of pow(float,int) be? inline double pow(double __x, int __i) { return __builtin_powi(__x, __i); } inline float pow(float __x, int __n) { return __builtin_powif(__x, __n); } inline long double pow(long double __x, int __n) { return __builtin_powil(__x, __n); } #endif #endif template<typename _Tp, typename _Up> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__promote_2<_Tp, _Up>::__type pow(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return pow(__type(__x), __type(__y)); } using ::sin; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float sin(float __x) { return __builtin_sinf(__x); } inline _GLIBCXX_CONSTEXPR long double sin(long double __x) { return __builtin_sinl(__x); } #endif template<typename _Tp> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type sin(_Tp __x) { return __builtin_sin(__x); } using ::sinh; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float sinh(float __x) { return __builtin_sinhf(__x); } inline _GLIBCXX_CONSTEXPR long double sinh(long double __x) { return __builtin_sinhl(__x); } #endif template<typename _Tp> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type sinh(_Tp __x) { return __builtin_sinh(__x); } using ::sqrt; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float sqrt(float __x) { return __builtin_sqrtf(__x); } inline _GLIBCXX_CONSTEXPR long double sqrt(long double __x) { return __builtin_sqrtl(__x); } #endif template<typename _Tp> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type sqrt(_Tp __x) { return __builtin_sqrt(__x); } using ::tan; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float tan(float __x) { return __builtin_tanf(__x); } inline _GLIBCXX_CONSTEXPR long double tan(long double __x) { return __builtin_tanl(__x); } #endif template<typename _Tp> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type tan(_Tp __x) { return __builtin_tan(__x); } using ::tanh; #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO inline _GLIBCXX_CONSTEXPR float tanh(float __x) { return __builtin_tanhf(__x); } inline _GLIBCXX_CONSTEXPR long double tanh(long double __x) { return __builtin_tanhl(__x); } #endif template<typename _Tp> inline _GLIBCXX_CONSTEXPR typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type tanh(_Tp __x) { return __builtin_tanh(__x); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #if _GLIBCXX_USE_C99_MATH #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC // These are possible macros imported from C99-land. #undef fpclassify #undef isfinite #undef isinf #undef isnan #undef isnormal #undef signbit #undef isgreater #undef isgreaterequal #undef isless #undef islessequal #undef islessgreater #undef isunordered namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus >= 201103L constexpr int fpclassify(float __x) { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x); } constexpr int fpclassify(double __x) { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x); } constexpr int fpclassify(long double __x) { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, int>::__type fpclassify(_Tp __x) { return __x != 0 ? FP_NORMAL : FP_ZERO; } constexpr bool isfinite(float __x) { return __builtin_isfinite(__x); } constexpr bool isfinite(double __x) { return __builtin_isfinite(__x); } constexpr bool isfinite(long double __x) { return __builtin_isfinite(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, bool>::__type isfinite(_Tp __x) { return true; } constexpr bool isinf(float __x) { return __builtin_isinf(__x); } constexpr bool isinf(double __x) { return __builtin_isinf(__x); } constexpr bool isinf(long double __x) { return __builtin_isinf(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, bool>::__type isinf(_Tp __x) { return false; } constexpr bool isnan(float __x) { return __builtin_isnan(__x); } constexpr bool isnan(double __x) { return __builtin_isnan(__x); } constexpr bool isnan(long double __x) { return __builtin_isnan(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, bool>::__type isnan(_Tp __x) { return false; } constexpr bool isnormal(float __x) { return __builtin_isnormal(__x); } constexpr bool isnormal(double __x) { return __builtin_isnormal(__x); } constexpr bool isnormal(long double __x) { return __builtin_isnormal(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, bool>::__type isnormal(_Tp __x) { return __x != 0 ? true : false; } constexpr bool signbit(float __x) { return __builtin_signbit(__x); } constexpr bool signbit(double __x) { return __builtin_signbit(__x); } constexpr bool signbit(long double __x) { return __builtin_signbit(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, bool>::__type signbit(_Tp __x) { return __x < 0 ? true : false; } constexpr bool isgreater(float __x, float __y) { return __builtin_isgreater(__x, __y); } constexpr bool isgreater(double __x, double __y) { return __builtin_isgreater(__x, __y); } constexpr bool isgreater(long double __x, long double __y) { return __builtin_isgreater(__x, __y); } template<typename _Tp, typename _Up> constexpr typename __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value && __is_arithmetic<_Up>::__value), bool>::__type isgreater(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return __builtin_isgreater(__type(__x), __type(__y)); } constexpr bool isgreaterequal(float __x, float __y) { return __builtin_isgreaterequal(__x, __y); } constexpr bool isgreaterequal(double __x, double __y) { return __builtin_isgreaterequal(__x, __y); } constexpr bool isgreaterequal(long double __x, long double __y) { return __builtin_isgreaterequal(__x, __y); } template<typename _Tp, typename _Up> constexpr typename __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value && __is_arithmetic<_Up>::__value), bool>::__type isgreaterequal(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return __builtin_isgreaterequal(__type(__x), __type(__y)); } constexpr bool isless(float __x, float __y) { return __builtin_isless(__x, __y); } constexpr bool isless(double __x, double __y) { return __builtin_isless(__x, __y); } constexpr bool isless(long double __x, long double __y) { return __builtin_isless(__x, __y); } template<typename _Tp, typename _Up> constexpr typename __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value && __is_arithmetic<_Up>::__value), bool>::__type isless(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return __builtin_isless(__type(__x), __type(__y)); } constexpr bool islessequal(float __x, float __y) { return __builtin_islessequal(__x, __y); } constexpr bool islessequal(double __x, double __y) { return __builtin_islessequal(__x, __y); } constexpr bool islessequal(long double __x, long double __y) { return __builtin_islessequal(__x, __y); } template<typename _Tp, typename _Up> constexpr typename __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value && __is_arithmetic<_Up>::__value), bool>::__type islessequal(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return __builtin_islessequal(__type(__x), __type(__y)); } constexpr bool islessgreater(float __x, float __y) { return __builtin_islessgreater(__x, __y); } constexpr bool islessgreater(double __x, double __y) { return __builtin_islessgreater(__x, __y); } constexpr bool islessgreater(long double __x, long double __y) { return __builtin_islessgreater(__x, __y); } template<typename _Tp, typename _Up> constexpr typename __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value && __is_arithmetic<_Up>::__value), bool>::__type islessgreater(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return __builtin_islessgreater(__type(__x), __type(__y)); } constexpr bool isunordered(float __x, float __y) { return __builtin_isunordered(__x, __y); } constexpr bool isunordered(double __x, double __y) { return __builtin_isunordered(__x, __y); } constexpr bool isunordered(long double __x, long double __y) { return __builtin_isunordered(__x, __y); } template<typename _Tp, typename _Up> constexpr typename __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value && __is_arithmetic<_Up>::__value), bool>::__type isunordered(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return __builtin_isunordered(__type(__x), __type(__y)); } #else template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type fpclassify(_Tp __f) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __type(__f)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isfinite(_Tp __f) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isfinite(__type(__f)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isinf(_Tp __f) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isinf(__type(__f)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isnan(_Tp __f) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isnan(__type(__f)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isnormal(_Tp __f) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isnormal(__type(__f)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type signbit(_Tp __f) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_signbit(__type(__f)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isgreater(_Tp __f1, _Tp __f2) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isgreater(__type(__f1), __type(__f2)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isgreaterequal(_Tp __f1, _Tp __f2) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isgreaterequal(__type(__f1), __type(__f2)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isless(_Tp __f1, _Tp __f2) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isless(__type(__f1), __type(__f2)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type islessequal(_Tp __f1, _Tp __f2) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_islessequal(__type(__f1), __type(__f2)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type islessgreater(_Tp __f1, _Tp __f2) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_islessgreater(__type(__f1), __type(__f2)); } template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, int>::__type isunordered(_Tp __f1, _Tp __f2) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return __builtin_isunordered(__type(__f1), __type(__f2)); } #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */ #endif #if __cplusplus >= 201103L #ifdef _GLIBCXX_USE_C99_MATH_TR1 #undef acosh #undef acoshf #undef acoshl #undef asinh #undef asinhf #undef asinhl #undef atanh #undef atanhf #undef atanhl #undef cbrt #undef cbrtf #undef cbrtl #undef copysign #undef copysignf #undef copysignl #undef erf #undef erff #undef erfl #undef erfc #undef erfcf #undef erfcl #undef exp2 #undef exp2f #undef exp2l #undef expm1 #undef expm1f #undef expm1l #undef fdim #undef fdimf #undef fdiml #undef fma #undef fmaf #undef fmal #undef fmax #undef fmaxf #undef fmaxl #undef fmin #undef fminf #undef fminl #undef hypot #undef hypotf #undef hypotl #undef ilogb #undef ilogbf #undef ilogbl #undef lgamma #undef lgammaf #undef lgammal #undef llrint #undef llrintf #undef llrintl #undef llround #undef llroundf #undef llroundl #undef log1p #undef log1pf #undef log1pl #undef log2 #undef log2f #undef log2l #undef logb #undef logbf #undef logbl #undef lrint #undef lrintf #undef lrintl #undef lround #undef lroundf #undef lroundl #undef nan #undef nanf #undef nanl #undef nearbyint #undef nearbyintf #undef nearbyintl #undef nextafter #undef nextafterf #undef nextafterl #undef nexttoward #undef nexttowardf #undef nexttowardl #undef remainder #undef remainderf #undef remainderl #undef remquo #undef remquof #undef remquol #undef rint #undef rintf #undef rintl #undef round #undef roundf #undef roundl #undef scalbln #undef scalblnf #undef scalblnl #undef scalbn #undef scalbnf #undef scalbnl #undef tgamma #undef tgammaf #undef tgammal #undef trunc #undef truncf #undef truncl namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // types using ::double_t; using ::float_t; // functions using ::acosh; using ::acoshf; using ::acoshl; using ::asinh; using ::asinhf; using ::asinhl; using ::atanh; using ::atanhf; using ::atanhl; using ::cbrt; using ::cbrtf; using ::cbrtl; using ::copysign; using ::copysignf; using ::copysignl; using ::erf; using ::erff; using ::erfl; using ::erfc; using ::erfcf; using ::erfcl; using ::exp2; using ::exp2f; using ::exp2l; using ::expm1; using ::expm1f; using ::expm1l; using ::fdim; using ::fdimf; using ::fdiml; using ::fma; using ::fmaf; using ::fmal; using ::fmax; using ::fmaxf; using ::fmaxl; using ::fmin; using ::fminf; using ::fminl; using ::hypot; using ::hypotf; using ::hypotl; using ::ilogb; using ::ilogbf; using ::ilogbl; using ::lgamma; using ::lgammaf; using ::lgammal; using ::llrint; using ::llrintf; using ::llrintl; using ::llround; using ::llroundf; using ::llroundl; using ::log1p; using ::log1pf; using ::log1pl; using ::log2; using ::log2f; using ::log2l; using ::logb; using ::logbf; using ::logbl; using ::lrint; using ::lrintf; using ::lrintl; using ::lround; using ::lroundf; using ::lroundl; using ::nan; using ::nanf; using ::nanl; using ::nearbyint; using ::nearbyintf; using ::nearbyintl; using ::nextafter; using ::nextafterf; using ::nextafterl; using ::nexttoward; using ::nexttowardf; using ::nexttowardl; using ::remainder; using ::remainderf; using ::remainderl; using ::remquo; using ::remquof; using ::remquol; using ::rint; using ::rintf; using ::rintl; using ::round; using ::roundf; using ::roundl; using ::scalbln; using ::scalblnf; using ::scalblnl; using ::scalbn; using ::scalbnf; using ::scalbnl; using ::tgamma; using ::tgammaf; using ::tgammal; using ::trunc; using ::truncf; using ::truncl; /// Additional overloads. constexpr float acosh(float __x) { return __builtin_acoshf(__x); } constexpr long double acosh(long double __x) { return __builtin_acoshl(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type acosh(_Tp __x) { return __builtin_acosh(__x); } constexpr float asinh(float __x) { return __builtin_asinhf(__x); } constexpr long double asinh(long double __x) { return __builtin_asinhl(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type asinh(_Tp __x) { return __builtin_asinh(__x); } constexpr float atanh(float __x) { return __builtin_atanhf(__x); } constexpr long double atanh(long double __x) { return __builtin_atanhl(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type atanh(_Tp __x) { return __builtin_atanh(__x); } constexpr float cbrt(float __x) { return __builtin_cbrtf(__x); } constexpr long double cbrt(long double __x) { return __builtin_cbrtl(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type cbrt(_Tp __x) { return __builtin_cbrt(__x); } constexpr float copysign(float __x, float __y) { return __builtin_copysignf(__x, __y); } constexpr long double copysign(long double __x, long double __y) { return __builtin_copysignl(__x, __y); } template<typename _Tp, typename _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type copysign(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return copysign(__type(__x), __type(__y)); } constexpr float erf(float __x) { return __builtin_erff(__x); } constexpr long double erf(long double __x) { return __builtin_erfl(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type erf(_Tp __x) { return __builtin_erf(__x); } constexpr float erfc(float __x) { return __builtin_erfcf(__x); } constexpr long double erfc(long double __x) { return __builtin_erfcl(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type erfc(_Tp __x) { return __builtin_erfc(__x); } constexpr float exp2(float __x) { return __builtin_exp2f(__x); } constexpr long double exp2(long double __x) { return __builtin_exp2l(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type exp2(_Tp __x) { return __builtin_exp2(__x); } constexpr float expm1(float __x) { return __builtin_expm1f(__x); } constexpr long double expm1(long double __x) { return __builtin_expm1l(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type expm1(_Tp __x) { return __builtin_expm1(__x); } constexpr float fdim(float __x, float __y) { return __builtin_fdimf(__x, __y); } constexpr long double fdim(long double __x, long double __y) { return __builtin_fdiml(__x, __y); } template<typename _Tp, typename _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type fdim(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return fdim(__type(__x), __type(__y)); } constexpr float fma(float __x, float __y, float __z) { return __builtin_fmaf(__x, __y, __z); } constexpr long double fma(long double __x, long double __y, long double __z) { return __builtin_fmal(__x, __y, __z); } template<typename _Tp, typename _Up, typename _Vp> constexpr typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type fma(_Tp __x, _Up __y, _Vp __z) { typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type; return fma(__type(__x), __type(__y), __type(__z)); } constexpr float fmax(float __x, float __y) { return __builtin_fmaxf(__x, __y); } constexpr long double fmax(long double __x, long double __y) { return __builtin_fmaxl(__x, __y); } template<typename _Tp, typename _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type fmax(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return fmax(__type(__x), __type(__y)); } constexpr float fmin(float __x, float __y) { return __builtin_fminf(__x, __y); } constexpr long double fmin(long double __x, long double __y) { return __builtin_fminl(__x, __y); } template<typename _Tp, typename _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type fmin(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return fmin(__type(__x), __type(__y)); } constexpr float hypot(float __x, float __y) { return __builtin_hypotf(__x, __y); } constexpr long double hypot(long double __x, long double __y) { return __builtin_hypotl(__x, __y); } template<typename _Tp, typename _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type hypot(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return hypot(__type(__x), __type(__y)); } constexpr int ilogb(float __x) { return __builtin_ilogbf(__x); } constexpr int ilogb(long double __x) { return __builtin_ilogbl(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, int>::__type ilogb(_Tp __x) { return __builtin_ilogb(__x); } constexpr float lgamma(float __x) { return __builtin_lgammaf(__x); } constexpr long double lgamma(long double __x) { return __builtin_lgammal(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type lgamma(_Tp __x) { return __builtin_lgamma(__x); } constexpr long long llrint(float __x) { return __builtin_llrintf(__x); } constexpr long long llrint(long double __x) { return __builtin_llrintl(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, long long>::__type llrint(_Tp __x) { return __builtin_llrint(__x); } constexpr long long llround(float __x) { return __builtin_llroundf(__x); } constexpr long long llround(long double __x) { return __builtin_llroundl(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, long long>::__type llround(_Tp __x) { return __builtin_llround(__x); } constexpr float log1p(float __x) { return __builtin_log1pf(__x); } constexpr long double log1p(long double __x) { return __builtin_log1pl(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type log1p(_Tp __x) { return __builtin_log1p(__x); } // DR 568. constexpr float log2(float __x) { return __builtin_log2f(__x); } constexpr long double log2(long double __x) { return __builtin_log2l(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type log2(_Tp __x) { return __builtin_log2(__x); } constexpr float logb(float __x) { return __builtin_logbf(__x); } constexpr long double logb(long double __x) { return __builtin_logbl(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type logb(_Tp __x) { return __builtin_logb(__x); } constexpr long lrint(float __x) { return __builtin_lrintf(__x); } constexpr long lrint(long double __x) { return __builtin_lrintl(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, long>::__type lrint(_Tp __x) { return __builtin_lrint(__x); } constexpr long lround(float __x) { return __builtin_lroundf(__x); } constexpr long lround(long double __x) { return __builtin_lroundl(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, long>::__type lround(_Tp __x) { return __builtin_lround(__x); } constexpr float nearbyint(float __x) { return __builtin_nearbyintf(__x); } constexpr long double nearbyint(long double __x) { return __builtin_nearbyintl(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type nearbyint(_Tp __x) { return __builtin_nearbyint(__x); } constexpr float nextafter(float __x, float __y) { return __builtin_nextafterf(__x, __y); } constexpr long double nextafter(long double __x, long double __y) { return __builtin_nextafterl(__x, __y); } template<typename _Tp, typename _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type nextafter(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return nextafter(__type(__x), __type(__y)); } constexpr float nexttoward(float __x, long double __y) { return __builtin_nexttowardf(__x, __y); } constexpr long double nexttoward(long double __x, long double __y) { return __builtin_nexttowardl(__x, __y); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type nexttoward(_Tp __x, long double __y) { return __builtin_nexttoward(__x, __y); } constexpr float remainder(float __x, float __y) { return __builtin_remainderf(__x, __y); } constexpr long double remainder(long double __x, long double __y) { return __builtin_remainderl(__x, __y); } template<typename _Tp, typename _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type remainder(_Tp __x, _Up __y) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return remainder(__type(__x), __type(__y)); } inline float remquo(float __x, float __y, int* __pquo) { return __builtin_remquof(__x, __y, __pquo); } inline long double remquo(long double __x, long double __y, int* __pquo) { return __builtin_remquol(__x, __y, __pquo); } template<typename _Tp, typename _Up> inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type remquo(_Tp __x, _Up __y, int* __pquo) { typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; return remquo(__type(__x), __type(__y), __pquo); } constexpr float rint(float __x) { return __builtin_rintf(__x); } constexpr long double rint(long double __x) { return __builtin_rintl(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type rint(_Tp __x) { return __builtin_rint(__x); } constexpr float round(float __x) { return __builtin_roundf(__x); } constexpr long double round(long double __x) { return __builtin_roundl(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type round(_Tp __x) { return __builtin_round(__x); } constexpr float scalbln(float __x, long __ex) { return __builtin_scalblnf(__x, __ex); } constexpr long double scalbln(long double __x, long __ex) { return __builtin_scalblnl(__x, __ex); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type scalbln(_Tp __x, long __ex) { return __builtin_scalbln(__x, __ex); } constexpr float scalbn(float __x, int __ex) { return __builtin_scalbnf(__x, __ex); } constexpr long double scalbn(long double __x, int __ex) { return __builtin_scalbnl(__x, __ex); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type scalbn(_Tp __x, int __ex) { return __builtin_scalbn(__x, __ex); } constexpr float tgamma(float __x) { return __builtin_tgammaf(__x); } constexpr long double tgamma(long double __x) { return __builtin_tgammal(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type tgamma(_Tp __x) { return __builtin_tgamma(__x); } constexpr float trunc(float __x) { return __builtin_truncf(__x); } constexpr long double trunc(long double __x) { return __builtin_truncl(__x); } template<typename _Tp> constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, double>::__type trunc(_Tp __x) { return __builtin_trunc(__x); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // _GLIBCXX_USE_C99_MATH_TR1 #endif // C++11 #endif ���������������������������������������������������c++/4.8.2/ext/algorithm�����������������������������������������������������������������������������0000644�����������������00000045532�14763166027�0010323 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Algorithm extensions -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file ext/algorithm * This file is a GNU extension to the Standard C++ Library (possibly * containing extensions from the HP/SGI STL subset). */ #ifndef _EXT_ALGORITHM #define _EXT_ALGORITHM 1 #pragma GCC system_header #include <algorithm> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using std::ptrdiff_t; using std::min; using std::pair; using std::input_iterator_tag; using std::random_access_iterator_tag; using std::iterator_traits; //-------------------------------------------------- // copy_n (not part of the C++ standard) template<typename _InputIterator, typename _Size, typename _OutputIterator> pair<_InputIterator, _OutputIterator> __copy_n(_InputIterator __first, _Size __count, _OutputIterator __result, input_iterator_tag) { for ( ; __count > 0; --__count) { *__result = *__first; ++__first; ++__result; } return pair<_InputIterator, _OutputIterator>(__first, __result); } template<typename _RAIterator, typename _Size, typename _OutputIterator> inline pair<_RAIterator, _OutputIterator> __copy_n(_RAIterator __first, _Size __count, _OutputIterator __result, random_access_iterator_tag) { _RAIterator __last = __first + __count; return pair<_RAIterator, _OutputIterator>(__last, std::copy(__first, __last, __result)); } /** * @brief Copies the range [first,first+count) into [result,result+count). * @param __first An input iterator. * @param __count The number of elements to copy. * @param __result An output iterator. * @return A std::pair composed of first+count and result+count. * * This is an SGI extension. * This inline function will boil down to a call to @c memmove whenever * possible. Failing that, if random access iterators are passed, then the * loop count will be known (and therefore a candidate for compiler * optimizations such as unrolling). * @ingroup SGIextensions */ template<typename _InputIterator, typename _Size, typename _OutputIterator> inline pair<_InputIterator, _OutputIterator> copy_n(_InputIterator __first, _Size __count, _OutputIterator __result) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, typename iterator_traits<_InputIterator>::value_type>) return __gnu_cxx::__copy_n(__first, __count, __result, std::__iterator_category(__first)); } template<typename _InputIterator1, typename _InputIterator2> int __lexicographical_compare_3way(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { while (__first1 != __last1 && __first2 != __last2) { if (*__first1 < *__first2) return -1; if (*__first2 < *__first1) return 1; ++__first1; ++__first2; } if (__first2 == __last2) return !(__first1 == __last1); else return -1; } inline int __lexicographical_compare_3way(const unsigned char* __first1, const unsigned char* __last1, const unsigned char* __first2, const unsigned char* __last2) { const ptrdiff_t __len1 = __last1 - __first1; const ptrdiff_t __len2 = __last2 - __first2; const int __result = __builtin_memcmp(__first1, __first2, min(__len1, __len2)); return __result != 0 ? __result : (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1)); } inline int __lexicographical_compare_3way(const char* __first1, const char* __last1, const char* __first2, const char* __last2) { #if CHAR_MAX == SCHAR_MAX return __lexicographical_compare_3way((const signed char*) __first1, (const signed char*) __last1, (const signed char*) __first2, (const signed char*) __last2); #else return __lexicographical_compare_3way((const unsigned char*) __first1, (const unsigned char*) __last1, (const unsigned char*) __first2, (const unsigned char*) __last2); #endif } /** * @brief @c memcmp on steroids. * @param __first1 An input iterator. * @param __last1 An input iterator. * @param __first2 An input iterator. * @param __last2 An input iterator. * @return An int, as with @c memcmp. * * The return value will be less than zero if the first range is * <em>lexigraphically less than</em> the second, greater than zero * if the second range is <em>lexigraphically less than</em> the * first, and zero otherwise. * This is an SGI extension. * @ingroup SGIextensions */ template<typename _InputIterator1, typename _InputIterator2> int lexicographical_compare_3way(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_function_requires(_LessThanComparableConcept< typename iterator_traits<_InputIterator1>::value_type>) __glibcxx_function_requires(_LessThanComparableConcept< typename iterator_traits<_InputIterator2>::value_type>) __glibcxx_requires_valid_range(__first1, __last1); __glibcxx_requires_valid_range(__first2, __last2); return __lexicographical_compare_3way(__first1, __last1, __first2, __last2); } // count and count_if: this version, whose return type is void, was present // in the HP STL, and is retained as an extension for backward compatibility. template<typename _InputIterator, typename _Tp, typename _Size> void count(_InputIterator __first, _InputIterator __last, const _Tp& __value, _Size& __n) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_EqualityComparableConcept< typename iterator_traits<_InputIterator>::value_type >) __glibcxx_function_requires(_EqualityComparableConcept<_Tp>) __glibcxx_requires_valid_range(__first, __last); for ( ; __first != __last; ++__first) if (*__first == __value) ++__n; } template<typename _InputIterator, typename _Predicate, typename _Size> void count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred, _Size& __n) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, typename iterator_traits<_InputIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); for ( ; __first != __last; ++__first) if (__pred(*__first)) ++__n; } // random_sample and random_sample_n (extensions, not part of the standard). /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template<typename _ForwardIterator, typename _OutputIterator, typename _Distance> _OutputIterator random_sample_n(_ForwardIterator __first, _ForwardIterator __last, _OutputIterator __out, const _Distance __n) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); _Distance __remaining = std::distance(__first, __last); _Distance __m = min(__n, __remaining); while (__m > 0) { if ((std::rand() % __remaining) < __m) { *__out = *__first; ++__out; --__m; } --__remaining; ++__first; } return __out; } /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template<typename _ForwardIterator, typename _OutputIterator, typename _Distance, typename _RandomNumberGenerator> _OutputIterator random_sample_n(_ForwardIterator __first, _ForwardIterator __last, _OutputIterator __out, const _Distance __n, _RandomNumberGenerator& __rand) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_function_requires(_UnaryFunctionConcept< _RandomNumberGenerator, _Distance, _Distance>) __glibcxx_requires_valid_range(__first, __last); _Distance __remaining = std::distance(__first, __last); _Distance __m = min(__n, __remaining); while (__m > 0) { if (__rand(__remaining) < __m) { *__out = *__first; ++__out; --__m; } --__remaining; ++__first; } return __out; } template<typename _InputIterator, typename _RandomAccessIterator, typename _Distance> _RandomAccessIterator __random_sample(_InputIterator __first, _InputIterator __last, _RandomAccessIterator __out, const _Distance __n) { _Distance __m = 0; _Distance __t = __n; for ( ; __first != __last && __m < __n; ++__m, ++__first) __out[__m] = *__first; while (__first != __last) { ++__t; _Distance __M = std::rand() % (__t); if (__M < __n) __out[__M] = *__first; ++__first; } return __out + __m; } template<typename _InputIterator, typename _RandomAccessIterator, typename _RandomNumberGenerator, typename _Distance> _RandomAccessIterator __random_sample(_InputIterator __first, _InputIterator __last, _RandomAccessIterator __out, _RandomNumberGenerator& __rand, const _Distance __n) { // concept requirements __glibcxx_function_requires(_UnaryFunctionConcept< _RandomNumberGenerator, _Distance, _Distance>) _Distance __m = 0; _Distance __t = __n; for ( ; __first != __last && __m < __n; ++__m, ++__first) __out[__m] = *__first; while (__first != __last) { ++__t; _Distance __M = __rand(__t); if (__M < __n) __out[__M] = *__first; ++__first; } return __out + __m; } /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template<typename _InputIterator, typename _RandomAccessIterator> inline _RandomAccessIterator random_sample(_InputIterator __first, _InputIterator __last, _RandomAccessIterator __out_first, _RandomAccessIterator __out_last) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_requires_valid_range(__first, __last); __glibcxx_requires_valid_range(__out_first, __out_last); return __random_sample(__first, __last, __out_first, __out_last - __out_first); } /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template<typename _InputIterator, typename _RandomAccessIterator, typename _RandomNumberGenerator> inline _RandomAccessIterator random_sample(_InputIterator __first, _InputIterator __last, _RandomAccessIterator __out_first, _RandomAccessIterator __out_last, _RandomNumberGenerator& __rand) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_requires_valid_range(__first, __last); __glibcxx_requires_valid_range(__out_first, __out_last); return __random_sample(__first, __last, __out_first, __rand, __out_last - __out_first); } #if __cplusplus >= 201103L using std::is_heap; #else /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template<typename _RandomAccessIterator> inline bool is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { // concept requirements __glibcxx_function_requires(_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_function_requires(_LessThanComparableConcept< typename iterator_traits<_RandomAccessIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); return std::__is_heap(__first, __last - __first); } /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template<typename _RandomAccessIterator, typename _StrictWeakOrdering> inline bool is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _StrictWeakOrdering __comp) { // concept requirements __glibcxx_function_requires(_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_StrictWeakOrdering, typename iterator_traits<_RandomAccessIterator>::value_type, typename iterator_traits<_RandomAccessIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); return std::__is_heap(__first, __comp, __last - __first); } #endif #if __cplusplus >= 201103L using std::is_sorted; #else // is_sorted, a predicated testing whether a range is sorted in // nondescending order. This is an extension, not part of the C++ // standard. /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template<typename _ForwardIterator> bool is_sorted(_ForwardIterator __first, _ForwardIterator __last) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_LessThanComparableConcept< typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return true; _ForwardIterator __next = __first; for (++__next; __next != __last; __first = __next, ++__next) if (*__next < *__first) return false; return true; } /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template<typename _ForwardIterator, typename _StrictWeakOrdering> bool is_sorted(_ForwardIterator __first, _ForwardIterator __last, _StrictWeakOrdering __comp) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_StrictWeakOrdering, typename iterator_traits<_ForwardIterator>::value_type, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return true; _ForwardIterator __next = __first; for (++__next; __next != __last; __first = __next, ++__next) if (__comp(*__next, *__first)) return false; return true; } #endif // C++11 /** * @brief Find the median of three values. * @param __a A value. * @param __b A value. * @param __c A value. * @return One of @p a, @p b or @p c. * * If @c {l,m,n} is some convolution of @p {a,b,c} such that @c l<=m<=n * then the value returned will be @c m. * This is an SGI extension. * @ingroup SGIextensions */ template<typename _Tp> const _Tp& __median(const _Tp& __a, const _Tp& __b, const _Tp& __c) { // concept requirements __glibcxx_function_requires(_LessThanComparableConcept<_Tp>) if (__a < __b) if (__b < __c) return __b; else if (__a < __c) return __c; else return __a; else if (__a < __c) return __a; else if (__b < __c) return __c; else return __b; } /** * @brief Find the median of three values using a predicate for comparison. * @param __a A value. * @param __b A value. * @param __c A value. * @param __comp A binary predicate. * @return One of @p a, @p b or @p c. * * If @c {l,m,n} is some convolution of @p {a,b,c} such that @p comp(l,m) * and @p comp(m,n) are both true then the value returned will be @c m. * This is an SGI extension. * @ingroup SGIextensions */ template<typename _Tp, typename _Compare> const _Tp& __median(const _Tp& __a, const _Tp& __b, const _Tp& __c, _Compare __comp) { // concept requirements __glibcxx_function_requires(_BinaryFunctionConcept<_Compare, bool, _Tp, _Tp>) if (__comp(__a, __b)) if (__comp(__b, __c)) return __b; else if (__comp(__a, __c)) return __c; else return __a; else if (__comp(__a, __c)) return __a; else if (__comp(__b, __c)) return __c; else return __b; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _EXT_ALGORITHM */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/extptr_allocator.h��������������������������������������������������������������������0000644�����������������00000014055�14763166027�0012145 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <extptr_allocator.h> -*- C++ -*- // Copyright (C) 2008-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** * @file ext/extptr_allocator.h * This file is a GNU extension to the Standard C++ Library. * * @author Bob Walters * * An example allocator which uses an alternative pointer type from * bits/pointer.h. Supports test cases which confirm container support * for alternative pointers. */ #ifndef _EXTPTR_ALLOCATOR_H #define _EXTPTR_ALLOCATOR_H 1 #include <memory> #include <ext/numeric_traits.h> #include <ext/pointer.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief An example allocator which uses a non-standard pointer type. * @ingroup allocators * * This allocator specifies that containers use a 'relative pointer' as it's * pointer type. (See ext/pointer.h) Memory allocation in this example * is still performed using std::allocator. */ template<typename _Tp> class _ExtPtr_allocator { public: typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; // Note the non-standard pointer types. typedef _Pointer_adapter<_Relative_pointer_impl<_Tp> > pointer; typedef _Pointer_adapter<_Relative_pointer_impl<const _Tp> > const_pointer; typedef _Tp& reference; typedef const _Tp& const_reference; typedef _Tp value_type; template<typename _Up> struct rebind { typedef _ExtPtr_allocator<_Up> other; }; _ExtPtr_allocator() _GLIBCXX_USE_NOEXCEPT : _M_real_alloc() { } _ExtPtr_allocator(const _ExtPtr_allocator& __rarg) _GLIBCXX_USE_NOEXCEPT : _M_real_alloc(__rarg._M_real_alloc) { } template<typename _Up> _ExtPtr_allocator(const _ExtPtr_allocator<_Up>& __rarg) _GLIBCXX_USE_NOEXCEPT : _M_real_alloc(__rarg._M_getUnderlyingImp()) { } ~_ExtPtr_allocator() _GLIBCXX_USE_NOEXCEPT { } pointer address(reference __x) const _GLIBCXX_NOEXCEPT { return std::__addressof(__x); } const_pointer address(const_reference __x) const _GLIBCXX_NOEXCEPT { return std::__addressof(__x); } pointer allocate(size_type __n, void* __hint = 0) { return _M_real_alloc.allocate(__n,__hint); } void deallocate(pointer __p, size_type __n) { _M_real_alloc.deallocate(__p.get(), __n); } size_type max_size() const _GLIBCXX_USE_NOEXCEPT { return __numeric_traits<size_type>::__max / sizeof(_Tp); } #if __cplusplus >= 201103L template<typename _Up, typename... _Args> void construct(_Up* __p, _Args&&... __args) { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } template<typename... _Args> void construct(pointer __p, _Args&&... __args) { construct(__p.get(), std::forward<_Args>(__args)...); } template<typename _Up> void destroy(_Up* __p) { __p->~_Up(); } void destroy(pointer __p) { destroy(__p.get()); } #else void construct(pointer __p, const _Tp& __val) { ::new(__p.get()) _Tp(__val); } void destroy(pointer __p) { __p->~_Tp(); } #endif template<typename _Up> inline bool operator==(const _ExtPtr_allocator<_Up>& __rarg) { return _M_real_alloc == __rarg._M_getUnderlyingImp(); } inline bool operator==(const _ExtPtr_allocator& __rarg) { return _M_real_alloc == __rarg._M_real_alloc; } template<typename _Up> inline bool operator!=(const _ExtPtr_allocator<_Up>& __rarg) { return _M_real_alloc != __rarg._M_getUnderlyingImp(); } inline bool operator!=(const _ExtPtr_allocator& __rarg) { return _M_real_alloc != __rarg._M_real_alloc; } template<typename _Up> inline friend void swap(_ExtPtr_allocator<_Up>&, _ExtPtr_allocator<_Up>&); // A method specific to this implementation. const std::allocator<_Tp>& _M_getUnderlyingImp() const { return _M_real_alloc; } private: std::allocator<_Tp> _M_real_alloc; }; // _ExtPtr_allocator<void> specialization. template<> class _ExtPtr_allocator<void> { public: typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; typedef void value_type; // Note the non-standard pointer types typedef _Pointer_adapter<_Relative_pointer_impl<void> > pointer; typedef _Pointer_adapter<_Relative_pointer_impl<const void> > const_pointer; template<typename _Up> struct rebind { typedef _ExtPtr_allocator<_Up> other; }; private: std::allocator<void> _M_real_alloc; }; template<typename _Tp> inline void swap(_ExtPtr_allocator<_Tp>& __larg, _ExtPtr_allocator<_Tp>& __rarg) { std::allocator<_Tp> __tmp( __rarg._M_real_alloc ); __rarg._M_real_alloc = __larg._M_real_alloc; __larg._M_real_alloc = __tmp; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _EXTPTR_ALLOCATOR_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pod_char_traits.h���������������������������������������������������������������������0000644�����������������00000012160�14763166027�0011717 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// POD character, std::char_traits specialization -*- C++ -*- // Copyright (C) 2002-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/pod_char_traits.h * This file is a GNU extension to the Standard C++ Library. */ // Gabriel Dos Reis <gdr@integrable-solutions.net> // Benjamin Kosnik <bkoz@redhat.com> #ifndef _POD_CHAR_TRAITS_H #define _POD_CHAR_TRAITS_H 1 #pragma GCC system_header #include <string> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // POD character abstraction. // NB: The char_type parameter is a subset of int_type, as to allow // int_type to properly hold the full range of char_type values as // well as EOF. /// @brief A POD class that serves as a character abstraction class. template<typename V, typename I, typename S = std::mbstate_t> struct character { typedef V value_type; typedef I int_type; typedef S state_type; typedef character<V, I, S> char_type; value_type value; template<typename V2> static char_type from(const V2& v) { char_type ret = { static_cast<value_type>(v) }; return ret; } template<typename V2> static V2 to(const char_type& c) { V2 ret = { static_cast<V2>(c.value) }; return ret; } }; template<typename V, typename I, typename S> inline bool operator==(const character<V, I, S>& lhs, const character<V, I, S>& rhs) { return lhs.value == rhs.value; } template<typename V, typename I, typename S> inline bool operator<(const character<V, I, S>& lhs, const character<V, I, S>& rhs) { return lhs.value < rhs.value; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /// char_traits<__gnu_cxx::character> specialization. template<typename V, typename I, typename S> struct char_traits<__gnu_cxx::character<V, I, S> > { typedef __gnu_cxx::character<V, I, S> char_type; typedef typename char_type::int_type int_type; typedef typename char_type::state_type state_type; typedef fpos<state_type> pos_type; typedef streamoff off_type; static void assign(char_type& __c1, const char_type& __c2) { __c1 = __c2; } static bool eq(const char_type& __c1, const char_type& __c2) { return __c1 == __c2; } static bool lt(const char_type& __c1, const char_type& __c2) { return __c1 < __c2; } static int compare(const char_type* __s1, const char_type* __s2, size_t __n) { for (size_t __i = 0; __i < __n; ++__i) if (!eq(__s1[__i], __s2[__i])) return lt(__s1[__i], __s2[__i]) ? -1 : 1; return 0; } static size_t length(const char_type* __s) { const char_type* __p = __s; while (__p->value) ++__p; return (__p - __s); } static const char_type* find(const char_type* __s, size_t __n, const char_type& __a) { for (const char_type* __p = __s; size_t(__p - __s) < __n; ++__p) if (*__p == __a) return __p; return 0; } static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) { return static_cast<char_type*> (__builtin_memmove(__s1, __s2, __n * sizeof(char_type))); } static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) { std::copy(__s2, __s2 + __n, __s1); return __s1; } static char_type* assign(char_type* __s, size_t __n, char_type __a) { std::fill_n(__s, __n, __a); return __s; } static char_type to_char_type(const int_type& __i) { return char_type::template from(__i); } static int_type to_int_type(const char_type& __c) { return char_type::template to<int_type>(__c); } static bool eq_int_type(const int_type& __c1, const int_type& __c2) { return __c1 == __c2; } static int_type eof() { int_type __r = { -1 }; return __r; } static int_type not_eof(const int_type& __c) { return eq_int_type(__c, eof()) ? int_type() : __c; } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/typelist.h����������������������������������������������������������������������������0000644�����������������00000040703�14763166027�0010433 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice and // this permission notice appear in supporting documentation. None of // the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied warranty. /** * @file ext/typelist.h * This file is a GNU extension to the Standard C++ Library. * * Contains typelist_chain definitions. * Typelists are an idea by Andrei Alexandrescu. */ #ifndef _TYPELIST_H #define _TYPELIST_H 1 #include <ext/type_traits.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** @namespace __gnu_cxx::typelist * @brief GNU typelist extensions for public compile-time use. */ namespace typelist { struct null_type { }; template<typename Root> struct node { typedef Root root; }; // Forward declarations of functors. template<typename Hd, typename Typelist> struct chain { typedef Hd head; typedef Typelist tail; }; // Apply all typelist types to unary functor. template<typename Fn, typename Typelist> void apply(Fn&, Typelist); /// Apply all typelist types to generator functor. template<typename Gn, typename Typelist> void apply_generator(Gn&, Typelist); // Apply all typelist types and values to generator functor. template<typename Gn, typename TypelistT, typename TypelistV> void apply_generator(Gn&, TypelistT, TypelistV); template<typename Typelist0, typename Typelist1> struct append; template<typename Typelist_Typelist> struct append_typelist; template<typename Typelist, typename T> struct contains; template<typename Typelist, template<typename T> class Pred> struct filter; template<typename Typelist, int i> struct at_index; template<typename Typelist, template<typename T> class Transform> struct transform; template<typename Typelist_Typelist> struct flatten; template<typename Typelist> struct from_first; template<typename T1> struct create1; template<typename T1, typename T2> struct create2; template<typename T1, typename T2, typename T3> struct create3; template<typename T1, typename T2, typename T3, typename T4> struct create4; template<typename T1, typename T2, typename T3, typename T4, typename T5> struct create5; template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> struct create6; } // namespace typelist _GLIBCXX_END_NAMESPACE_VERSION } // namespace namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace typelist { namespace detail { template<typename Fn, typename Typelist_Chain> struct apply_; template<typename Fn, typename Hd, typename Tl> struct apply_<Fn, chain<Hd, Tl> > { void operator()(Fn& f) { f.operator()(Hd()); apply_<Fn, Tl> next; next(f); } }; template<typename Fn> struct apply_<Fn, null_type> { void operator()(Fn&) { } }; template<typename Gn, typename Typelist_Chain> struct apply_generator1_; template<typename Gn, typename Hd, typename Tl> struct apply_generator1_<Gn, chain<Hd, Tl> > { void operator()(Gn& g) { g.template operator()<Hd>(); apply_generator1_<Gn, Tl> next; next(g); } }; template<typename Gn> struct apply_generator1_<Gn, null_type> { void operator()(Gn&) { } }; template<typename Gn, typename TypelistT_Chain, typename TypelistV_Chain> struct apply_generator2_; template<typename Gn, typename Hd1, typename TlT, typename Hd2, typename TlV> struct apply_generator2_<Gn, chain<Hd1, TlT>, chain<Hd2, TlV> > { void operator()(Gn& g) { g.template operator()<Hd1, Hd2>(); apply_generator2_<Gn, TlT, TlV> next; next(g); } }; template<typename Gn> struct apply_generator2_<Gn, null_type, null_type> { void operator()(Gn&) { } }; template<typename Typelist_Chain0, typename Typelist_Chain1> struct append_; template<typename Hd, typename Tl, typename Typelist_Chain> struct append_<chain<Hd, Tl>, Typelist_Chain> { private: typedef append_<Tl, Typelist_Chain> append_type; public: typedef chain<Hd, typename append_type::type> type; }; template<typename Typelist_Chain> struct append_<null_type, Typelist_Chain> { typedef Typelist_Chain type; }; template<typename Typelist_Chain> struct append_<Typelist_Chain, null_type> { typedef Typelist_Chain type; }; template<> struct append_<null_type, null_type> { typedef null_type type; }; template<typename Typelist_Typelist_Chain> struct append_typelist_; template<typename Hd> struct append_typelist_<chain<Hd, null_type> > { typedef chain<Hd, null_type> type; }; template<typename Hd, typename Tl> struct append_typelist_<chain< Hd, Tl> > { private: typedef typename append_typelist_<Tl>::type rest_type; public: typedef typename append<Hd, node<rest_type> >::type::root type; }; template<typename Typelist_Chain, typename T> struct contains_; template<typename T> struct contains_<null_type, T> { enum { value = false }; }; template<typename Hd, typename Tl, typename T> struct contains_<chain<Hd, Tl>, T> { enum { value = contains_<Tl, T>::value }; }; template<typename Tl, typename T> struct contains_<chain<T, Tl>, T> { enum { value = true }; }; template<typename Typelist_Chain, template<typename T> class Pred> struct chain_filter_; template<template<typename T> class Pred> struct chain_filter_<null_type, Pred> { typedef null_type type; }; template<typename Hd, typename Tl, template<typename T> class Pred> struct chain_filter_<chain<Hd, Tl>, Pred> { private: enum { include_hd = Pred<Hd>::value }; typedef typename chain_filter_<Tl, Pred>::type rest_type; typedef chain<Hd, rest_type> chain_type; public: typedef typename __conditional_type<include_hd, chain_type, rest_type>::__type type; }; template<typename Typelist_Chain, int i> struct chain_at_index_; template<typename Hd, typename Tl> struct chain_at_index_<chain<Hd, Tl>, 0> { typedef Hd type; }; template<typename Hd, typename Tl, int i> struct chain_at_index_<chain<Hd, Tl>, i> { typedef typename chain_at_index_<Tl, i - 1>::type type; }; template<class Typelist_Chain, template<typename T> class Transform> struct chain_transform_; template<template<typename T> class Transform> struct chain_transform_<null_type, Transform> { typedef null_type type; }; template<class Hd, class Tl, template<typename T> class Transform> struct chain_transform_<chain<Hd, Tl>, Transform> { private: typedef typename chain_transform_<Tl, Transform>::type rest_type; typedef typename Transform<Hd>::type transform_type; public: typedef chain<transform_type, rest_type> type; }; template<typename Typelist_Typelist_Chain> struct chain_flatten_; template<typename Hd_Tl> struct chain_flatten_<chain<Hd_Tl, null_type> > { typedef typename Hd_Tl::root type; }; template<typename Hd_Typelist, class Tl_Typelist> struct chain_flatten_<chain<Hd_Typelist, Tl_Typelist> > { private: typedef typename chain_flatten_<Tl_Typelist>::type rest_type; typedef append<Hd_Typelist, node<rest_type> > append_type; public: typedef typename append_type::type::root type; }; } // namespace detail } // namespace typelist _GLIBCXX_END_NAMESPACE_VERSION } // namespace #define _GLIBCXX_TYPELIST_CHAIN1(X0) __gnu_cxx::typelist::chain<X0, __gnu_cxx::typelist::null_type> #define _GLIBCXX_TYPELIST_CHAIN2(X0, X1) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN1(X1) > #define _GLIBCXX_TYPELIST_CHAIN3(X0, X1, X2) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN2(X1, X2) > #define _GLIBCXX_TYPELIST_CHAIN4(X0, X1, X2, X3) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN3(X1, X2, X3) > #define _GLIBCXX_TYPELIST_CHAIN5(X0, X1, X2, X3, X4) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN4(X1, X2, X3, X4) > #define _GLIBCXX_TYPELIST_CHAIN6(X0, X1, X2, X3, X4, X5) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN5(X1, X2, X3, X4, X5) > #define _GLIBCXX_TYPELIST_CHAIN7(X0, X1, X2, X3, X4, X5, X6) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN6(X1, X2, X3, X4, X5, X6) > #define _GLIBCXX_TYPELIST_CHAIN8(X0, X1, X2, X3, X4, X5, X6, X7) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN7(X1, X2, X3, X4, X5, X6, X7) > #define _GLIBCXX_TYPELIST_CHAIN9(X0, X1, X2, X3, X4, X5, X6, X7, X8) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN8(X1, X2, X3, X4, X5, X6, X7, X8) > #define _GLIBCXX_TYPELIST_CHAIN10(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN9(X1, X2, X3, X4, X5, X6, X7, X8, X9) > #define _GLIBCXX_TYPELIST_CHAIN11(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN10(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) > #define _GLIBCXX_TYPELIST_CHAIN12(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN11(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) > #define _GLIBCXX_TYPELIST_CHAIN13(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN12(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) > #define _GLIBCXX_TYPELIST_CHAIN14(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN13(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) > #define _GLIBCXX_TYPELIST_CHAIN15(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN14(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) > #define _GLIBCXX_TYPELIST_CHAIN16(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN15(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15) > #define _GLIBCXX_TYPELIST_CHAIN17(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN16(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16) > #define _GLIBCXX_TYPELIST_CHAIN18(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN17(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17) > #define _GLIBCXX_TYPELIST_CHAIN19(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17, X18) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN18(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17, X18) > #define _GLIBCXX_TYPELIST_CHAIN20(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17, X18, X19) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN19(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17, X18, X19) > namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace typelist { template<typename Fn, typename Typelist> void apply(Fn& fn, Typelist) { detail::apply_<Fn, typename Typelist::root> a; a(fn); } template<typename Fn, typename Typelist> void apply_generator(Fn& fn, Typelist) { detail::apply_generator1_<Fn, typename Typelist::root> a; a(fn); } template<typename Fn, typename TypelistT, typename TypelistV> void apply_generator(Fn& fn, TypelistT, TypelistV) { typedef typename TypelistT::root rootT; typedef typename TypelistV::root rootV; detail::apply_generator2_<Fn, rootT, rootV> a; a(fn); } template<typename Typelist0, typename Typelist1> struct append { private: typedef typename Typelist0::root root0_type; typedef typename Typelist1::root root1_type; typedef detail::append_<root0_type, root1_type> append_type; public: typedef node<typename append_type::type> type; }; template<typename Typelist_Typelist> struct append_typelist { private: typedef typename Typelist_Typelist::root root_type; typedef detail::append_typelist_<root_type> append_type; public: typedef node<typename append_type::type> type; }; template<typename Typelist, typename T> struct contains { private: typedef typename Typelist::root root_type; public: enum { value = detail::contains_<root_type, T>::value }; }; template<typename Typelist, template<typename T> class Pred> struct filter { private: typedef typename Typelist::root root_type; typedef detail::chain_filter_<root_type, Pred> filter_type; public: typedef node<typename filter_type::type> type; }; template<typename Typelist, int i> struct at_index { private: typedef typename Typelist::root root_type; typedef detail::chain_at_index_<root_type, i> index_type; public: typedef typename index_type::type type; }; template<typename Typelist, template<typename T> class Transform> struct transform { private: typedef typename Typelist::root root_type; typedef detail::chain_transform_<root_type, Transform> transform_type; public: typedef node<typename transform_type::type> type; }; template<typename Typelist_Typelist> struct flatten { private: typedef typename Typelist_Typelist::root root_type; typedef typename detail::chain_flatten_<root_type>::type flatten_type; public: typedef node<flatten_type> type; }; template<typename Typelist> struct from_first { private: typedef typename at_index<Typelist, 0>::type first_type; public: typedef node<chain<first_type, null_type> > type; }; template<typename T1> struct create1 { typedef node<_GLIBCXX_TYPELIST_CHAIN1(T1)> type; }; template<typename T1, typename T2> struct create2 { typedef node<_GLIBCXX_TYPELIST_CHAIN2(T1,T2)> type; }; template<typename T1, typename T2, typename T3> struct create3 { typedef node<_GLIBCXX_TYPELIST_CHAIN3(T1,T2,T3)> type; }; template<typename T1, typename T2, typename T3, typename T4> struct create4 { typedef node<_GLIBCXX_TYPELIST_CHAIN4(T1,T2,T3,T4)> type; }; template<typename T1, typename T2, typename T3, typename T4, typename T5> struct create5 { typedef node<_GLIBCXX_TYPELIST_CHAIN5(T1,T2,T3,T4,T5)> type; }; template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> struct create6 { typedef node<_GLIBCXX_TYPELIST_CHAIN6(T1,T2,T3,T4,T5,T6)> type; }; } // namespace typelist _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif �������������������������������������������������������������c++/4.8.2/ext/pool_allocator.h����������������������������������������������������������������������0000644�����������������00000020347�14763166027�0011571 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Allocators -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * Copyright (c) 1996-1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file ext/pool_allocator.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _POOL_ALLOCATOR_H #define _POOL_ALLOCATOR_H 1 #include <bits/c++config.h> #include <cstdlib> #include <new> #include <bits/functexcept.h> #include <ext/atomicity.h> #include <ext/concurrence.h> #include <bits/move.h> #if __cplusplus >= 201103L #include <type_traits> #endif namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using std::size_t; using std::ptrdiff_t; /** * @brief Base class for __pool_alloc. * * Uses various allocators to fulfill underlying requests (and makes as * few requests as possible when in default high-speed pool mode). * * Important implementation properties: * 0. If globally mandated, then allocate objects from new * 1. If the clients request an object of size > _S_max_bytes, the resulting * object will be obtained directly from new * 2. In all other cases, we allocate an object of size exactly * _S_round_up(requested_size). Thus the client has enough size * information that we can return the object to the proper free list * without permanently losing part of the object. */ class __pool_alloc_base { protected: enum { _S_align = 8 }; enum { _S_max_bytes = 128 }; enum { _S_free_list_size = (size_t)_S_max_bytes / (size_t)_S_align }; union _Obj { union _Obj* _M_free_list_link; char _M_client_data[1]; // The client sees this. }; static _Obj* volatile _S_free_list[_S_free_list_size]; // Chunk allocation state. static char* _S_start_free; static char* _S_end_free; static size_t _S_heap_size; size_t _M_round_up(size_t __bytes) { return ((__bytes + (size_t)_S_align - 1) & ~((size_t)_S_align - 1)); } _GLIBCXX_CONST _Obj* volatile* _M_get_free_list(size_t __bytes) throw (); __mutex& _M_get_mutex() throw (); // Returns an object of size __n, and optionally adds to size __n // free list. void* _M_refill(size_t __n); // Allocates a chunk for nobjs of size size. nobjs may be reduced // if it is inconvenient to allocate the requested number. char* _M_allocate_chunk(size_t __n, int& __nobjs); }; /** * @brief Allocator using a memory pool with a single lock. * @ingroup allocators */ template<typename _Tp> class __pool_alloc : private __pool_alloc_base { private: static _Atomic_word _S_force_new; public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Tp* pointer; typedef const _Tp* const_pointer; typedef _Tp& reference; typedef const _Tp& const_reference; typedef _Tp value_type; template<typename _Tp1> struct rebind { typedef __pool_alloc<_Tp1> other; }; #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2103. propagate_on_container_move_assignment typedef std::true_type propagate_on_container_move_assignment; #endif __pool_alloc() _GLIBCXX_USE_NOEXCEPT { } __pool_alloc(const __pool_alloc&) _GLIBCXX_USE_NOEXCEPT { } template<typename _Tp1> __pool_alloc(const __pool_alloc<_Tp1>&) _GLIBCXX_USE_NOEXCEPT { } ~__pool_alloc() _GLIBCXX_USE_NOEXCEPT { } pointer address(reference __x) const _GLIBCXX_NOEXCEPT { return std::__addressof(__x); } const_pointer address(const_reference __x) const _GLIBCXX_NOEXCEPT { return std::__addressof(__x); } size_type max_size() const _GLIBCXX_USE_NOEXCEPT { return size_t(-1) / sizeof(_Tp); } #if __cplusplus >= 201103L template<typename _Up, typename... _Args> void construct(_Up* __p, _Args&&... __args) { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } template<typename _Up> void destroy(_Up* __p) { __p->~_Up(); } #else // _GLIBCXX_RESOLVE_LIB_DEFECTS // 402. wrong new expression in [some_] allocator::construct void construct(pointer __p, const _Tp& __val) { ::new((void *)__p) _Tp(__val); } void destroy(pointer __p) { __p->~_Tp(); } #endif pointer allocate(size_type __n, const void* = 0); void deallocate(pointer __p, size_type __n); }; template<typename _Tp> inline bool operator==(const __pool_alloc<_Tp>&, const __pool_alloc<_Tp>&) { return true; } template<typename _Tp> inline bool operator!=(const __pool_alloc<_Tp>&, const __pool_alloc<_Tp>&) { return false; } template<typename _Tp> _Atomic_word __pool_alloc<_Tp>::_S_force_new; template<typename _Tp> _Tp* __pool_alloc<_Tp>::allocate(size_type __n, const void*) { pointer __ret = 0; if (__builtin_expect(__n != 0, true)) { if (__n > this->max_size()) std::__throw_bad_alloc(); // If there is a race through here, assume answer from getenv // will resolve in same direction. Inspired by techniques // to efficiently support threading found in basic_string.h. if (_S_force_new == 0) { if (std::getenv("GLIBCXX_FORCE_NEW")) __atomic_add_dispatch(&_S_force_new, 1); else __atomic_add_dispatch(&_S_force_new, -1); } const size_t __bytes = __n * sizeof(_Tp); if (__bytes > size_t(_S_max_bytes) || _S_force_new > 0) __ret = static_cast<_Tp*>(::operator new(__bytes)); else { _Obj* volatile* __free_list = _M_get_free_list(__bytes); __scoped_lock sentry(_M_get_mutex()); _Obj* __restrict__ __result = *__free_list; if (__builtin_expect(__result == 0, 0)) __ret = static_cast<_Tp*>(_M_refill(_M_round_up(__bytes))); else { *__free_list = __result->_M_free_list_link; __ret = reinterpret_cast<_Tp*>(__result); } if (__ret == 0) std::__throw_bad_alloc(); } } return __ret; } template<typename _Tp> void __pool_alloc<_Tp>::deallocate(pointer __p, size_type __n) { if (__builtin_expect(__n != 0 && __p != 0, true)) { const size_t __bytes = __n * sizeof(_Tp); if (__bytes > static_cast<size_t>(_S_max_bytes) || _S_force_new > 0) ::operator delete(__p); else { _Obj* volatile* __free_list = _M_get_free_list(__bytes); _Obj* __q = reinterpret_cast<_Obj*>(__p); __scoped_lock sentry(_M_get_mutex()); __q ->_M_free_list_link = *__free_list; *__free_list = __q; } } } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/ropeimpl.h����������������������������������������������������������������������������0000644�����������������00000136455�14763166027�0010417 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// SGI's rope class implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * Copyright (c) 1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file ropeimpl.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ext/rope} */ #include <cstdio> #include <ostream> #include <bits/functexcept.h> #include <ext/algorithm> // For copy_n and lexicographical_compare_3way #include <ext/memory> // For uninitialized_copy_n #include <ext/numeric> // For power namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using std::size_t; using std::printf; using std::basic_ostream; using std::__throw_length_error; using std::_Destroy; using std::__uninitialized_fill_n_a; // Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf // if necessary. Assumes _M_path_end[leaf_index] and leaf_pos are correct. // Results in a valid buf_ptr if the iterator can be legitimately // dereferenced. template <class _CharT, class _Alloc> void _Rope_iterator_base<_CharT, _Alloc>:: _S_setbuf(_Rope_iterator_base<_CharT, _Alloc>& __x) { const _RopeRep* __leaf = __x._M_path_end[__x._M_leaf_index]; size_t __leaf_pos = __x._M_leaf_pos; size_t __pos = __x._M_current_pos; switch(__leaf->_M_tag) { case __detail::_S_leaf: __x._M_buf_start = ((_Rope_RopeLeaf<_CharT, _Alloc>*)__leaf)->_M_data; __x._M_buf_ptr = __x._M_buf_start + (__pos - __leaf_pos); __x._M_buf_end = __x._M_buf_start + __leaf->_M_size; break; case __detail::_S_function: case __detail::_S_substringfn: { size_t __len = _S_iterator_buf_len; size_t __buf_start_pos = __leaf_pos; size_t __leaf_end = __leaf_pos + __leaf->_M_size; char_producer<_CharT>* __fn = ((_Rope_RopeFunction<_CharT, _Alloc>*)__leaf)->_M_fn; if (__buf_start_pos + __len <= __pos) { __buf_start_pos = __pos - __len / 4; if (__buf_start_pos + __len > __leaf_end) __buf_start_pos = __leaf_end - __len; } if (__buf_start_pos + __len > __leaf_end) __len = __leaf_end - __buf_start_pos; (*__fn)(__buf_start_pos - __leaf_pos, __len, __x._M_tmp_buf); __x._M_buf_ptr = __x._M_tmp_buf + (__pos - __buf_start_pos); __x._M_buf_start = __x._M_tmp_buf; __x._M_buf_end = __x._M_tmp_buf + __len; } break; default: break; } } // Set path and buffer inside a rope iterator. We assume that // pos and root are already set. template <class _CharT, class _Alloc> void _Rope_iterator_base<_CharT, _Alloc>:: _S_setcache(_Rope_iterator_base<_CharT, _Alloc>& __x) { const _RopeRep* __path[int(__detail::_S_max_rope_depth) + 1]; const _RopeRep* __curr_rope; int __curr_depth = -1; /* index into path */ size_t __curr_start_pos = 0; size_t __pos = __x._M_current_pos; unsigned char __dirns = 0; // Bit vector marking right turns in the path if (__pos >= __x._M_root->_M_size) { __x._M_buf_ptr = 0; return; } __curr_rope = __x._M_root; if (0 != __curr_rope->_M_c_string) { /* Treat the root as a leaf. */ __x._M_buf_start = __curr_rope->_M_c_string; __x._M_buf_end = __curr_rope->_M_c_string + __curr_rope->_M_size; __x._M_buf_ptr = __curr_rope->_M_c_string + __pos; __x._M_path_end[0] = __curr_rope; __x._M_leaf_index = 0; __x._M_leaf_pos = 0; return; } for(;;) { ++__curr_depth; __path[__curr_depth] = __curr_rope; switch(__curr_rope->_M_tag) { case __detail::_S_leaf: case __detail::_S_function: case __detail::_S_substringfn: __x._M_leaf_pos = __curr_start_pos; goto done; case __detail::_S_concat: { _Rope_RopeConcatenation<_CharT, _Alloc>* __c = (_Rope_RopeConcatenation<_CharT, _Alloc>*)__curr_rope; _RopeRep* __left = __c->_M_left; size_t __left_len = __left->_M_size; __dirns <<= 1; if (__pos >= __curr_start_pos + __left_len) { __dirns |= 1; __curr_rope = __c->_M_right; __curr_start_pos += __left_len; } else __curr_rope = __left; } break; } } done: // Copy last section of path into _M_path_end. { int __i = -1; int __j = __curr_depth + 1 - int(_S_path_cache_len); if (__j < 0) __j = 0; while (__j <= __curr_depth) __x._M_path_end[++__i] = __path[__j++]; __x._M_leaf_index = __i; } __x._M_path_directions = __dirns; _S_setbuf(__x); } // Specialized version of the above. Assumes that // the path cache is valid for the previous position. template <class _CharT, class _Alloc> void _Rope_iterator_base<_CharT, _Alloc>:: _S_setcache_for_incr(_Rope_iterator_base<_CharT, _Alloc>& __x) { int __current_index = __x._M_leaf_index; const _RopeRep* __current_node = __x._M_path_end[__current_index]; size_t __len = __current_node->_M_size; size_t __node_start_pos = __x._M_leaf_pos; unsigned char __dirns = __x._M_path_directions; _Rope_RopeConcatenation<_CharT, _Alloc>* __c; if (__x._M_current_pos - __node_start_pos < __len) { /* More stuff in this leaf, we just didn't cache it. */ _S_setbuf(__x); return; } // node_start_pos is starting position of last_node. while (--__current_index >= 0) { if (!(__dirns & 1) /* Path turned left */) break; __current_node = __x._M_path_end[__current_index]; __c = (_Rope_RopeConcatenation<_CharT, _Alloc>*)__current_node; // Otherwise we were in the right child. Thus we should pop // the concatenation node. __node_start_pos -= __c->_M_left->_M_size; __dirns >>= 1; } if (__current_index < 0) { // We underflowed the cache. Punt. _S_setcache(__x); return; } __current_node = __x._M_path_end[__current_index]; __c = (_Rope_RopeConcatenation<_CharT, _Alloc>*)__current_node; // current_node is a concatenation node. We are positioned on the first // character in its right child. // node_start_pos is starting position of current_node. __node_start_pos += __c->_M_left->_M_size; __current_node = __c->_M_right; __x._M_path_end[++__current_index] = __current_node; __dirns |= 1; while (__detail::_S_concat == __current_node->_M_tag) { ++__current_index; if (int(_S_path_cache_len) == __current_index) { int __i; for (__i = 0; __i < int(_S_path_cache_len) - 1; __i++) __x._M_path_end[__i] = __x._M_path_end[__i+1]; --__current_index; } __current_node = ((_Rope_RopeConcatenation<_CharT, _Alloc>*)__current_node)->_M_left; __x._M_path_end[__current_index] = __current_node; __dirns <<= 1; // node_start_pos is unchanged. } __x._M_leaf_index = __current_index; __x._M_leaf_pos = __node_start_pos; __x._M_path_directions = __dirns; _S_setbuf(__x); } template <class _CharT, class _Alloc> void _Rope_iterator_base<_CharT, _Alloc>:: _M_incr(size_t __n) { _M_current_pos += __n; if (0 != _M_buf_ptr) { size_t __chars_left = _M_buf_end - _M_buf_ptr; if (__chars_left > __n) _M_buf_ptr += __n; else if (__chars_left == __n) { _M_buf_ptr += __n; _S_setcache_for_incr(*this); } else _M_buf_ptr = 0; } } template <class _CharT, class _Alloc> void _Rope_iterator_base<_CharT, _Alloc>:: _M_decr(size_t __n) { if (0 != _M_buf_ptr) { size_t __chars_left = _M_buf_ptr - _M_buf_start; if (__chars_left >= __n) _M_buf_ptr -= __n; else _M_buf_ptr = 0; } _M_current_pos -= __n; } template <class _CharT, class _Alloc> void _Rope_iterator<_CharT, _Alloc>:: _M_check() { if (_M_root_rope->_M_tree_ptr != this->_M_root) { // _Rope was modified. Get things fixed up. _RopeRep::_S_unref(this->_M_root); this->_M_root = _M_root_rope->_M_tree_ptr; _RopeRep::_S_ref(this->_M_root); this->_M_buf_ptr = 0; } } template <class _CharT, class _Alloc> inline _Rope_const_iterator<_CharT, _Alloc>:: _Rope_const_iterator(const _Rope_iterator<_CharT, _Alloc>& __x) : _Rope_iterator_base<_CharT, _Alloc>(__x) { } template <class _CharT, class _Alloc> inline _Rope_iterator<_CharT, _Alloc>:: _Rope_iterator(rope<_CharT, _Alloc>& __r, size_t __pos) : _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos), _M_root_rope(&__r) { _RopeRep::_S_ref(this->_M_root); } template <class _CharT, class _Alloc> inline size_t rope<_CharT, _Alloc>:: _S_char_ptr_len(const _CharT* __s) { const _CharT* __p = __s; while (!_S_is0(*__p)) ++__p; return (__p - __s); } #ifndef __GC template <class _CharT, class _Alloc> inline void _Rope_RopeRep<_CharT, _Alloc>:: _M_free_c_string() { _CharT* __cstr = _M_c_string; if (0 != __cstr) { size_t __size = this->_M_size + 1; _Destroy(__cstr, __cstr + __size, _M_get_allocator()); this->_Data_deallocate(__cstr, __size); } } template <class _CharT, class _Alloc> inline void _Rope_RopeRep<_CharT, _Alloc>:: _S_free_string(_CharT* __s, size_t __n, allocator_type& __a) { if (!_S_is_basic_char_type((_CharT*)0)) _Destroy(__s, __s + __n, __a); // This has to be a static member, so this gets a bit messy __a.deallocate(__s, _Rope_RopeLeaf<_CharT, _Alloc>::_S_rounded_up_size(__n)); } // There are several reasons for not doing this with virtual destructors // and a class specific delete operator: // - A class specific delete operator can't easily get access to // allocator instances if we need them. // - Any virtual function would need a 4 or byte vtable pointer; // this only requires a one byte tag per object. template <class _CharT, class _Alloc> void _Rope_RopeRep<_CharT, _Alloc>:: _M_free_tree() { switch(_M_tag) { case __detail::_S_leaf: { _Rope_RopeLeaf<_CharT, _Alloc>* __l = (_Rope_RopeLeaf<_CharT, _Alloc>*)this; __l->_Rope_RopeLeaf<_CharT, _Alloc>::~_Rope_RopeLeaf(); this->_L_deallocate(__l, 1); break; } case __detail::_S_concat: { _Rope_RopeConcatenation<_CharT,_Alloc>* __c = (_Rope_RopeConcatenation<_CharT, _Alloc>*)this; __c->_Rope_RopeConcatenation<_CharT, _Alloc>:: ~_Rope_RopeConcatenation(); this->_C_deallocate(__c, 1); break; } case __detail::_S_function: { _Rope_RopeFunction<_CharT, _Alloc>* __f = (_Rope_RopeFunction<_CharT, _Alloc>*)this; __f->_Rope_RopeFunction<_CharT, _Alloc>::~_Rope_RopeFunction(); this->_F_deallocate(__f, 1); break; } case __detail::_S_substringfn: { _Rope_RopeSubstring<_CharT, _Alloc>* __ss = (_Rope_RopeSubstring<_CharT, _Alloc>*)this; __ss->_Rope_RopeSubstring<_CharT, _Alloc>:: ~_Rope_RopeSubstring(); this->_S_deallocate(__ss, 1); break; } } } #else template <class _CharT, class _Alloc> inline void _Rope_RopeRep<_CharT, _Alloc>:: _S_free_string(const _CharT*, size_t, allocator_type) { } #endif // Concatenate a C string onto a leaf rope by copying the rope data. // Used for short ropes. template <class _CharT, class _Alloc> typename rope<_CharT, _Alloc>::_RopeLeaf* rope<_CharT, _Alloc>:: _S_leaf_concat_char_iter(_RopeLeaf* __r, const _CharT* __iter, size_t __len) { size_t __old_len = __r->_M_size; _CharT* __new_data = (_CharT*) rope::_Data_allocate(_S_rounded_up_size(__old_len + __len)); _RopeLeaf* __result; uninitialized_copy_n(__r->_M_data, __old_len, __new_data); uninitialized_copy_n(__iter, __len, __new_data + __old_len); _S_cond_store_eos(__new_data[__old_len + __len]); __try { __result = _S_new_RopeLeaf(__new_data, __old_len + __len, __r->_M_get_allocator()); } __catch(...) { _RopeRep::__STL_FREE_STRING(__new_data, __old_len + __len, __r->_M_get_allocator()); __throw_exception_again; } return __result; } #ifndef __GC // As above, but it's OK to clobber original if refcount is 1 template <class _CharT, class _Alloc> typename rope<_CharT,_Alloc>::_RopeLeaf* rope<_CharT, _Alloc>:: _S_destr_leaf_concat_char_iter(_RopeLeaf* __r, const _CharT* __iter, size_t __len) { if (__r->_M_ref_count > 1) return _S_leaf_concat_char_iter(__r, __iter, __len); size_t __old_len = __r->_M_size; if (_S_allocated_capacity(__old_len) >= __old_len + __len) { // The space has been partially initialized for the standard // character types. But that doesn't matter for those types. uninitialized_copy_n(__iter, __len, __r->_M_data + __old_len); if (_S_is_basic_char_type((_CharT*)0)) _S_cond_store_eos(__r->_M_data[__old_len + __len]); else if (__r->_M_c_string != __r->_M_data && 0 != __r->_M_c_string) { __r->_M_free_c_string(); __r->_M_c_string = 0; } __r->_M_size = __old_len + __len; __r->_M_ref_count = 2; return __r; } else { _RopeLeaf* __result = _S_leaf_concat_char_iter(__r, __iter, __len); return __result; } } #endif // Assumes left and right are not 0. // Does not increment (nor decrement on exception) child reference counts. // Result has ref count 1. template <class _CharT, class _Alloc> typename rope<_CharT, _Alloc>::_RopeRep* rope<_CharT, _Alloc>:: _S_tree_concat(_RopeRep* __left, _RopeRep* __right) { _RopeConcatenation* __result = _S_new_RopeConcatenation(__left, __right, __left-> _M_get_allocator()); size_t __depth = __result->_M_depth; if (__depth > 20 && (__result->_M_size < 1000 || __depth > size_t(__detail::_S_max_rope_depth))) { _RopeRep* __balanced; __try { __balanced = _S_balance(__result); __result->_M_unref_nonnil(); } __catch(...) { rope::_C_deallocate(__result,1); __throw_exception_again; } // In case of exception, we need to deallocate // otherwise dangling result node. But caller // still owns its children. Thus unref is // inappropriate. return __balanced; } else return __result; } template <class _CharT, class _Alloc> typename rope<_CharT, _Alloc>::_RopeRep* rope<_CharT, _Alloc>:: _S_concat_char_iter(_RopeRep* __r, const _CharT*__s, size_t __slen) { _RopeRep* __result; if (0 == __slen) { _S_ref(__r); return __r; } if (0 == __r) return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->_M_get_allocator()); if (__r->_M_tag == __detail::_S_leaf && __r->_M_size + __slen <= size_t(_S_copy_max)) { __result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen); return __result; } if (__detail::_S_concat == __r->_M_tag && __detail::_S_leaf == ((_RopeConcatenation*) __r)->_M_right->_M_tag) { _RopeLeaf* __right = (_RopeLeaf* )(((_RopeConcatenation* )__r)->_M_right); if (__right->_M_size + __slen <= size_t(_S_copy_max)) { _RopeRep* __left = ((_RopeConcatenation*)__r)->_M_left; _RopeRep* __nright = _S_leaf_concat_char_iter((_RopeLeaf*)__right, __s, __slen); __left->_M_ref_nonnil(); __try { __result = _S_tree_concat(__left, __nright); } __catch(...) { _S_unref(__left); _S_unref(__nright); __throw_exception_again; } return __result; } } _RopeRep* __nright = __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->_M_get_allocator()); __try { __r->_M_ref_nonnil(); __result = _S_tree_concat(__r, __nright); } __catch(...) { _S_unref(__r); _S_unref(__nright); __throw_exception_again; } return __result; } #ifndef __GC template <class _CharT, class _Alloc> typename rope<_CharT,_Alloc>::_RopeRep* rope<_CharT,_Alloc>:: _S_destr_concat_char_iter(_RopeRep* __r, const _CharT* __s, size_t __slen) { _RopeRep* __result; if (0 == __r) return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->_M_get_allocator()); size_t __count = __r->_M_ref_count; size_t __orig_size = __r->_M_size; if (__count > 1) return _S_concat_char_iter(__r, __s, __slen); if (0 == __slen) { __r->_M_ref_count = 2; // One more than before return __r; } if (__orig_size + __slen <= size_t(_S_copy_max) && __detail::_S_leaf == __r->_M_tag) { __result = _S_destr_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen); return __result; } if (__detail::_S_concat == __r->_M_tag) { _RopeLeaf* __right = (_RopeLeaf*)(((_RopeConcatenation*) __r)->_M_right); if (__detail::_S_leaf == __right->_M_tag && __right->_M_size + __slen <= size_t(_S_copy_max)) { _RopeRep* __new_right = _S_destr_leaf_concat_char_iter(__right, __s, __slen); if (__right == __new_right) __new_right->_M_ref_count = 1; else __right->_M_unref_nonnil(); __r->_M_ref_count = 2; // One more than before. ((_RopeConcatenation*)__r)->_M_right = __new_right; __r->_M_size = __orig_size + __slen; if (0 != __r->_M_c_string) { __r->_M_free_c_string(); __r->_M_c_string = 0; } return __r; } } _RopeRep* __right = __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->_M_get_allocator()); __r->_M_ref_nonnil(); __try { __result = _S_tree_concat(__r, __right); } __catch(...) { _S_unref(__r); _S_unref(__right); __throw_exception_again; } return __result; } #endif /* !__GC */ template <class _CharT, class _Alloc> typename rope<_CharT, _Alloc>::_RopeRep* rope<_CharT, _Alloc>:: _S_concat(_RopeRep* __left, _RopeRep* __right) { if (0 == __left) { _S_ref(__right); return __right; } if (0 == __right) { __left->_M_ref_nonnil(); return __left; } if (__detail::_S_leaf == __right->_M_tag) { if (__detail::_S_leaf == __left->_M_tag) { if (__right->_M_size + __left->_M_size <= size_t(_S_copy_max)) return _S_leaf_concat_char_iter((_RopeLeaf*)__left, ((_RopeLeaf*)__right)->_M_data, __right->_M_size); } else if (__detail::_S_concat == __left->_M_tag && __detail::_S_leaf == ((_RopeConcatenation*) __left)->_M_right->_M_tag) { _RopeLeaf* __leftright = (_RopeLeaf*)(((_RopeConcatenation*)__left)->_M_right); if (__leftright->_M_size + __right->_M_size <= size_t(_S_copy_max)) { _RopeRep* __leftleft = ((_RopeConcatenation*)__left)->_M_left; _RopeRep* __rest = _S_leaf_concat_char_iter(__leftright, ((_RopeLeaf*) __right)-> _M_data, __right->_M_size); __leftleft->_M_ref_nonnil(); __try { return(_S_tree_concat(__leftleft, __rest)); } __catch(...) { _S_unref(__leftleft); _S_unref(__rest); __throw_exception_again; } } } } __left->_M_ref_nonnil(); __right->_M_ref_nonnil(); __try { return(_S_tree_concat(__left, __right)); } __catch(...) { _S_unref(__left); _S_unref(__right); __throw_exception_again; } } template <class _CharT, class _Alloc> typename rope<_CharT, _Alloc>::_RopeRep* rope<_CharT, _Alloc>:: _S_substring(_RopeRep* __base, size_t __start, size_t __endp1) { if (0 == __base) return 0; size_t __len = __base->_M_size; size_t __adj_endp1; const size_t __lazy_threshold = 128; if (__endp1 >= __len) { if (0 == __start) { __base->_M_ref_nonnil(); return __base; } else __adj_endp1 = __len; } else __adj_endp1 = __endp1; switch(__base->_M_tag) { case __detail::_S_concat: { _RopeConcatenation* __c = (_RopeConcatenation*)__base; _RopeRep* __left = __c->_M_left; _RopeRep* __right = __c->_M_right; size_t __left_len = __left->_M_size; _RopeRep* __result; if (__adj_endp1 <= __left_len) return _S_substring(__left, __start, __endp1); else if (__start >= __left_len) return _S_substring(__right, __start - __left_len, __adj_endp1 - __left_len); _Self_destruct_ptr __left_result(_S_substring(__left, __start, __left_len)); _Self_destruct_ptr __right_result(_S_substring(__right, 0, __endp1 - __left_len)); __result = _S_concat(__left_result, __right_result); return __result; } case __detail::_S_leaf: { _RopeLeaf* __l = (_RopeLeaf*)__base; _RopeLeaf* __result; size_t __result_len; if (__start >= __adj_endp1) return 0; __result_len = __adj_endp1 - __start; if (__result_len > __lazy_threshold) goto lazy; #ifdef __GC const _CharT* __section = __l->_M_data + __start; __result = _S_new_RopeLeaf(__section, __result_len, __base->_M_get_allocator()); __result->_M_c_string = 0; // Not eos terminated. #else // We should sometimes create substring node instead. __result = __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__l->_M_data + __start, __result_len, __base-> _M_get_allocator()); #endif return __result; } case __detail::_S_substringfn: // Avoid introducing multiple layers of substring nodes. { _RopeSubstring* __old = (_RopeSubstring*)__base; size_t __result_len; if (__start >= __adj_endp1) return 0; __result_len = __adj_endp1 - __start; if (__result_len > __lazy_threshold) { _RopeSubstring* __result = _S_new_RopeSubstring(__old->_M_base, __start + __old->_M_start, __adj_endp1 - __start, __base->_M_get_allocator()); return __result; } // *** else fall through: *** } case __detail::_S_function: { _RopeFunction* __f = (_RopeFunction*)__base; _CharT* __section; size_t __result_len; if (__start >= __adj_endp1) return 0; __result_len = __adj_endp1 - __start; if (__result_len > __lazy_threshold) goto lazy; __section = (_CharT*) rope::_Data_allocate(_S_rounded_up_size(__result_len)); __try { (*(__f->_M_fn))(__start, __result_len, __section); } __catch(...) { _RopeRep::__STL_FREE_STRING(__section, __result_len, __base->_M_get_allocator()); __throw_exception_again; } _S_cond_store_eos(__section[__result_len]); return _S_new_RopeLeaf(__section, __result_len, __base->_M_get_allocator()); } } lazy: { // Create substring node. return _S_new_RopeSubstring(__base, __start, __adj_endp1 - __start, __base->_M_get_allocator()); } } template<class _CharT> class _Rope_flatten_char_consumer : public _Rope_char_consumer<_CharT> { private: _CharT* _M_buf_ptr; public: _Rope_flatten_char_consumer(_CharT* __buffer) { _M_buf_ptr = __buffer; }; ~_Rope_flatten_char_consumer() {} bool operator()(const _CharT* __leaf, size_t __n) { uninitialized_copy_n(__leaf, __n, _M_buf_ptr); _M_buf_ptr += __n; return true; } }; template<class _CharT> class _Rope_find_char_char_consumer : public _Rope_char_consumer<_CharT> { private: _CharT _M_pattern; public: size_t _M_count; // Number of nonmatching characters _Rope_find_char_char_consumer(_CharT __p) : _M_pattern(__p), _M_count(0) {} ~_Rope_find_char_char_consumer() {} bool operator()(const _CharT* __leaf, size_t __n) { size_t __i; for (__i = 0; __i < __n; __i++) { if (__leaf[__i] == _M_pattern) { _M_count += __i; return false; } } _M_count += __n; return true; } }; template<class _CharT, class _Traits> // Here _CharT is both the stream and rope character type. class _Rope_insert_char_consumer : public _Rope_char_consumer<_CharT> { private: typedef basic_ostream<_CharT,_Traits> _Insert_ostream; _Insert_ostream& _M_o; public: _Rope_insert_char_consumer(_Insert_ostream& __writer) : _M_o(__writer) {}; ~_Rope_insert_char_consumer() { }; // Caller is presumed to own the ostream bool operator() (const _CharT* __leaf, size_t __n); // Returns true to continue traversal. }; template<class _CharT, class _Traits> bool _Rope_insert_char_consumer<_CharT, _Traits>:: operator()(const _CharT* __leaf, size_t __n) { size_t __i; // We assume that formatting is set up correctly for each element. for (__i = 0; __i < __n; __i++) _M_o.put(__leaf[__i]); return true; } template <class _CharT, class _Alloc> bool rope<_CharT, _Alloc>:: _S_apply_to_pieces(_Rope_char_consumer<_CharT>& __c, const _RopeRep* __r, size_t __begin, size_t __end) { if (0 == __r) return true; switch(__r->_M_tag) { case __detail::_S_concat: { _RopeConcatenation* __conc = (_RopeConcatenation*)__r; _RopeRep* __left = __conc->_M_left; size_t __left_len = __left->_M_size; if (__begin < __left_len) { size_t __left_end = std::min(__left_len, __end); if (!_S_apply_to_pieces(__c, __left, __begin, __left_end)) return false; } if (__end > __left_len) { _RopeRep* __right = __conc->_M_right; size_t __right_start = std::max(__left_len, __begin); if (!_S_apply_to_pieces(__c, __right, __right_start - __left_len, __end - __left_len)) return false; } } return true; case __detail::_S_leaf: { _RopeLeaf* __l = (_RopeLeaf*)__r; return __c(__l->_M_data + __begin, __end - __begin); } case __detail::_S_function: case __detail::_S_substringfn: { _RopeFunction* __f = (_RopeFunction*)__r; size_t __len = __end - __begin; bool __result; _CharT* __buffer = (_CharT*)_Alloc().allocate(__len * sizeof(_CharT)); __try { (*(__f->_M_fn))(__begin, __len, __buffer); __result = __c(__buffer, __len); _Alloc().deallocate(__buffer, __len * sizeof(_CharT)); } __catch(...) { _Alloc().deallocate(__buffer, __len * sizeof(_CharT)); __throw_exception_again; } return __result; } default: return false; } } template<class _CharT, class _Traits> inline void _Rope_fill(basic_ostream<_CharT, _Traits>& __o, size_t __n) { char __f = __o.fill(); size_t __i; for (__i = 0; __i < __n; __i++) __o.put(__f); } template <class _CharT> inline bool _Rope_is_simple(_CharT*) { return false; } inline bool _Rope_is_simple(char*) { return true; } inline bool _Rope_is_simple(wchar_t*) { return true; } template<class _CharT, class _Traits, class _Alloc> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __o, const rope<_CharT, _Alloc>& __r) { size_t __w = __o.width(); bool __left = bool(__o.flags() & std::ios::left); size_t __pad_len; size_t __rope_len = __r.size(); _Rope_insert_char_consumer<_CharT, _Traits> __c(__o); bool __is_simple = _Rope_is_simple((_CharT*)0); if (__rope_len < __w) __pad_len = __w - __rope_len; else __pad_len = 0; if (!__is_simple) __o.width(__w / __rope_len); __try { if (__is_simple && !__left && __pad_len > 0) _Rope_fill(__o, __pad_len); __r.apply_to_pieces(0, __r.size(), __c); if (__is_simple && __left && __pad_len > 0) _Rope_fill(__o, __pad_len); if (!__is_simple) __o.width(__w); } __catch(...) { if (!__is_simple) __o.width(__w); __throw_exception_again; } return __o; } template <class _CharT, class _Alloc> _CharT* rope<_CharT, _Alloc>:: _S_flatten(_RopeRep* __r, size_t __start, size_t __len, _CharT* __buffer) { _Rope_flatten_char_consumer<_CharT> __c(__buffer); _S_apply_to_pieces(__c, __r, __start, __start + __len); return(__buffer + __len); } template <class _CharT, class _Alloc> size_t rope<_CharT, _Alloc>:: find(_CharT __pattern, size_t __start) const { _Rope_find_char_char_consumer<_CharT> __c(__pattern); _S_apply_to_pieces(__c, this->_M_tree_ptr, __start, size()); size_type __result_pos = __start + __c._M_count; #ifndef __STL_OLD_ROPE_SEMANTICS if (__result_pos == size()) __result_pos = npos; #endif return __result_pos; } template <class _CharT, class _Alloc> _CharT* rope<_CharT, _Alloc>:: _S_flatten(_RopeRep* __r, _CharT* __buffer) { if (0 == __r) return __buffer; switch(__r->_M_tag) { case __detail::_S_concat: { _RopeConcatenation* __c = (_RopeConcatenation*)__r; _RopeRep* __left = __c->_M_left; _RopeRep* __right = __c->_M_right; _CharT* __rest = _S_flatten(__left, __buffer); return _S_flatten(__right, __rest); } case __detail::_S_leaf: { _RopeLeaf* __l = (_RopeLeaf*)__r; return copy_n(__l->_M_data, __l->_M_size, __buffer).second; } case __detail::_S_function: case __detail::_S_substringfn: // We don't yet do anything with substring nodes. // This needs to be fixed before ropefiles will work well. { _RopeFunction* __f = (_RopeFunction*)__r; (*(__f->_M_fn))(0, __f->_M_size, __buffer); return __buffer + __f->_M_size; } default: return 0; } } // This needs work for _CharT != char template <class _CharT, class _Alloc> void rope<_CharT, _Alloc>:: _S_dump(_RopeRep* __r, int __indent) { for (int __i = 0; __i < __indent; __i++) putchar(' '); if (0 == __r) { printf("NULL\n"); return; } if (_S_concat == __r->_M_tag) { _RopeConcatenation* __c = (_RopeConcatenation*)__r; _RopeRep* __left = __c->_M_left; _RopeRep* __right = __c->_M_right; #ifdef __GC printf("Concatenation %p (depth = %d, len = %ld, %s balanced)\n", __r, __r->_M_depth, __r->_M_size, __r->_M_is_balanced? "" : "not"); #else printf("Concatenation %p (rc = %ld, depth = %d, " "len = %ld, %s balanced)\n", __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size, __r->_M_is_balanced? "" : "not"); #endif _S_dump(__left, __indent + 2); _S_dump(__right, __indent + 2); return; } else { char* __kind; switch (__r->_M_tag) { case __detail::_S_leaf: __kind = "Leaf"; break; case __detail::_S_function: __kind = "Function"; break; case __detail::_S_substringfn: __kind = "Function representing substring"; break; default: __kind = "(corrupted kind field!)"; } #ifdef __GC printf("%s %p (depth = %d, len = %ld) ", __kind, __r, __r->_M_depth, __r->_M_size); #else printf("%s %p (rc = %ld, depth = %d, len = %ld) ", __kind, __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size); #endif if (_S_is_one_byte_char_type((_CharT*)0)) { const int __max_len = 40; _Self_destruct_ptr __prefix(_S_substring(__r, 0, __max_len)); _CharT __buffer[__max_len + 1]; bool __too_big = __r->_M_size > __prefix->_M_size; _S_flatten(__prefix, __buffer); __buffer[__prefix->_M_size] = _S_eos((_CharT*)0); printf("%s%s\n", (char*)__buffer, __too_big? "...\n" : "\n"); } else printf("\n"); } } template <class _CharT, class _Alloc> const unsigned long rope<_CharT, _Alloc>:: _S_min_len[int(__detail::_S_max_rope_depth) + 1] = { /* 0 */1, /* 1 */2, /* 2 */3, /* 3 */5, /* 4 */8, /* 5 */13, /* 6 */21, /* 7 */34, /* 8 */55, /* 9 */89, /* 10 */144, /* 11 */233, /* 12 */377, /* 13 */610, /* 14 */987, /* 15 */1597, /* 16 */2584, /* 17 */4181, /* 18 */6765, /* 19 */10946, /* 20 */17711, /* 21 */28657, /* 22 */46368, /* 23 */75025, /* 24 */121393, /* 25 */196418, /* 26 */317811, /* 27 */514229, /* 28 */832040, /* 29 */1346269, /* 30 */2178309, /* 31 */3524578, /* 32 */5702887, /* 33 */9227465, /* 34 */14930352, /* 35 */24157817, /* 36 */39088169, /* 37 */63245986, /* 38 */102334155, /* 39 */165580141, /* 40 */267914296, /* 41 */433494437, /* 42 */701408733, /* 43 */1134903170, /* 44 */1836311903, /* 45 */2971215073u }; // These are Fibonacci numbers < 2**32. template <class _CharT, class _Alloc> typename rope<_CharT, _Alloc>::_RopeRep* rope<_CharT, _Alloc>:: _S_balance(_RopeRep* __r) { _RopeRep* __forest[int(__detail::_S_max_rope_depth) + 1]; _RopeRep* __result = 0; int __i; // Invariant: // The concatenation of forest in descending order is equal to __r. // __forest[__i]._M_size >= _S_min_len[__i] // __forest[__i]._M_depth = __i // References from forest are included in refcount. for (__i = 0; __i <= int(__detail::_S_max_rope_depth); ++__i) __forest[__i] = 0; __try { _S_add_to_forest(__r, __forest); for (__i = 0; __i <= int(__detail::_S_max_rope_depth); ++__i) if (0 != __forest[__i]) { #ifndef __GC _Self_destruct_ptr __old(__result); #endif __result = _S_concat(__forest[__i], __result); __forest[__i]->_M_unref_nonnil(); #if !defined(__GC) && defined(__EXCEPTIONS) __forest[__i] = 0; #endif } } __catch(...) { for(__i = 0; __i <= int(__detail::_S_max_rope_depth); __i++) _S_unref(__forest[__i]); __throw_exception_again; } if (__result->_M_depth > int(__detail::_S_max_rope_depth)) __throw_length_error(__N("rope::_S_balance")); return(__result); } template <class _CharT, class _Alloc> void rope<_CharT, _Alloc>:: _S_add_to_forest(_RopeRep* __r, _RopeRep** __forest) { if (__r->_M_is_balanced) { _S_add_leaf_to_forest(__r, __forest); return; } { _RopeConcatenation* __c = (_RopeConcatenation*)__r; _S_add_to_forest(__c->_M_left, __forest); _S_add_to_forest(__c->_M_right, __forest); } } template <class _CharT, class _Alloc> void rope<_CharT, _Alloc>:: _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest) { _RopeRep* __insertee; // included in refcount _RopeRep* __too_tiny = 0; // included in refcount int __i; // forest[0..__i-1] is empty size_t __s = __r->_M_size; for (__i = 0; __s >= _S_min_len[__i+1]/* not this bucket */; ++__i) { if (0 != __forest[__i]) { #ifndef __GC _Self_destruct_ptr __old(__too_tiny); #endif __too_tiny = _S_concat_and_set_balanced(__forest[__i], __too_tiny); __forest[__i]->_M_unref_nonnil(); __forest[__i] = 0; } } { #ifndef __GC _Self_destruct_ptr __old(__too_tiny); #endif __insertee = _S_concat_and_set_balanced(__too_tiny, __r); } // Too_tiny dead, and no longer included in refcount. // Insertee is live and included. for (;; ++__i) { if (0 != __forest[__i]) { #ifndef __GC _Self_destruct_ptr __old(__insertee); #endif __insertee = _S_concat_and_set_balanced(__forest[__i], __insertee); __forest[__i]->_M_unref_nonnil(); __forest[__i] = 0; } if (__i == int(__detail::_S_max_rope_depth) || __insertee->_M_size < _S_min_len[__i+1]) { __forest[__i] = __insertee; // refcount is OK since __insertee is now dead. return; } } } template <class _CharT, class _Alloc> _CharT rope<_CharT, _Alloc>:: _S_fetch(_RopeRep* __r, size_type __i) { __GC_CONST _CharT* __cstr = __r->_M_c_string; if (0 != __cstr) return __cstr[__i]; for(;;) { switch(__r->_M_tag) { case __detail::_S_concat: { _RopeConcatenation* __c = (_RopeConcatenation*)__r; _RopeRep* __left = __c->_M_left; size_t __left_len = __left->_M_size; if (__i >= __left_len) { __i -= __left_len; __r = __c->_M_right; } else __r = __left; } break; case __detail::_S_leaf: { _RopeLeaf* __l = (_RopeLeaf*)__r; return __l->_M_data[__i]; } case __detail::_S_function: case __detail::_S_substringfn: { _RopeFunction* __f = (_RopeFunction*)__r; _CharT __result; (*(__f->_M_fn))(__i, 1, &__result); return __result; } } } } #ifndef __GC // Return a uniquely referenced character slot for the given // position, or 0 if that's not possible. template <class _CharT, class _Alloc> _CharT* rope<_CharT, _Alloc>:: _S_fetch_ptr(_RopeRep* __r, size_type __i) { _RopeRep* __clrstack[__detail::_S_max_rope_depth]; size_t __csptr = 0; for(;;) { if (__r->_M_ref_count > 1) return 0; switch(__r->_M_tag) { case __detail::_S_concat: { _RopeConcatenation* __c = (_RopeConcatenation*)__r; _RopeRep* __left = __c->_M_left; size_t __left_len = __left->_M_size; if (__c->_M_c_string != 0) __clrstack[__csptr++] = __c; if (__i >= __left_len) { __i -= __left_len; __r = __c->_M_right; } else __r = __left; } break; case __detail::_S_leaf: { _RopeLeaf* __l = (_RopeLeaf*)__r; if (__l->_M_c_string != __l->_M_data && __l->_M_c_string != 0) __clrstack[__csptr++] = __l; while (__csptr > 0) { -- __csptr; _RopeRep* __d = __clrstack[__csptr]; __d->_M_free_c_string(); __d->_M_c_string = 0; } return __l->_M_data + __i; } case __detail::_S_function: case __detail::_S_substringfn: return 0; } } } #endif /* __GC */ // The following could be implemented trivially using // lexicographical_compare_3way. // We do a little more work to avoid dealing with rope iterators for // flat strings. template <class _CharT, class _Alloc> int rope<_CharT, _Alloc>:: _S_compare (const _RopeRep* __left, const _RopeRep* __right) { size_t __left_len; size_t __right_len; if (0 == __right) return 0 != __left; if (0 == __left) return -1; __left_len = __left->_M_size; __right_len = __right->_M_size; if (__detail::_S_leaf == __left->_M_tag) { _RopeLeaf* __l = (_RopeLeaf*) __left; if (__detail::_S_leaf == __right->_M_tag) { _RopeLeaf* __r = (_RopeLeaf*) __right; return lexicographical_compare_3way(__l->_M_data, __l->_M_data + __left_len, __r->_M_data, __r->_M_data + __right_len); } else { const_iterator __rstart(__right, 0); const_iterator __rend(__right, __right_len); return lexicographical_compare_3way(__l->_M_data, __l->_M_data + __left_len, __rstart, __rend); } } else { const_iterator __lstart(__left, 0); const_iterator __lend(__left, __left_len); if (__detail::_S_leaf == __right->_M_tag) { _RopeLeaf* __r = (_RopeLeaf*) __right; return lexicographical_compare_3way(__lstart, __lend, __r->_M_data, __r->_M_data + __right_len); } else { const_iterator __rstart(__right, 0); const_iterator __rend(__right, __right_len); return lexicographical_compare_3way(__lstart, __lend, __rstart, __rend); } } } // Assignment to reference proxies. template <class _CharT, class _Alloc> _Rope_char_ref_proxy<_CharT, _Alloc>& _Rope_char_ref_proxy<_CharT, _Alloc>:: operator=(_CharT __c) { _RopeRep* __old = _M_root->_M_tree_ptr; #ifndef __GC // First check for the case in which everything is uniquely // referenced. In that case we can do this destructively. _CharT* __ptr = _My_rope::_S_fetch_ptr(__old, _M_pos); if (0 != __ptr) { *__ptr = __c; return *this; } #endif _Self_destruct_ptr __left(_My_rope::_S_substring(__old, 0, _M_pos)); _Self_destruct_ptr __right(_My_rope::_S_substring(__old, _M_pos + 1, __old->_M_size)); _Self_destruct_ptr __result_left(_My_rope:: _S_destr_concat_char_iter(__left, &__c, 1)); _RopeRep* __result = _My_rope::_S_concat(__result_left, __right); #ifndef __GC _RopeRep::_S_unref(__old); #endif _M_root->_M_tree_ptr = __result; return *this; } template <class _CharT, class _Alloc> inline _Rope_char_ref_proxy<_CharT, _Alloc>:: operator _CharT() const { if (_M_current_valid) return _M_current; else return _My_rope::_S_fetch(_M_root->_M_tree_ptr, _M_pos); } template <class _CharT, class _Alloc> _Rope_char_ptr_proxy<_CharT, _Alloc> _Rope_char_ref_proxy<_CharT, _Alloc>:: operator&() const { return _Rope_char_ptr_proxy<_CharT, _Alloc>(*this); } template <class _CharT, class _Alloc> rope<_CharT, _Alloc>:: rope(size_t __n, _CharT __c, const allocator_type& __a) : _Base(__a) { rope<_CharT,_Alloc> __result; const size_t __exponentiate_threshold = 32; size_t __exponent; size_t __rest; _CharT* __rest_buffer; _RopeRep* __remainder; rope<_CharT, _Alloc> __remainder_rope; if (0 == __n) return; __exponent = __n / __exponentiate_threshold; __rest = __n % __exponentiate_threshold; if (0 == __rest) __remainder = 0; else { __rest_buffer = this->_Data_allocate(_S_rounded_up_size(__rest)); __uninitialized_fill_n_a(__rest_buffer, __rest, __c, _M_get_allocator()); _S_cond_store_eos(__rest_buffer[__rest]); __try { __remainder = _S_new_RopeLeaf(__rest_buffer, __rest, _M_get_allocator()); } __catch(...) { _RopeRep::__STL_FREE_STRING(__rest_buffer, __rest, _M_get_allocator()); __throw_exception_again; } } __remainder_rope._M_tree_ptr = __remainder; if (__exponent != 0) { _CharT* __base_buffer = this->_Data_allocate(_S_rounded_up_size(__exponentiate_threshold)); _RopeLeaf* __base_leaf; rope __base_rope; __uninitialized_fill_n_a(__base_buffer, __exponentiate_threshold, __c, _M_get_allocator()); _S_cond_store_eos(__base_buffer[__exponentiate_threshold]); __try { __base_leaf = _S_new_RopeLeaf(__base_buffer, __exponentiate_threshold, _M_get_allocator()); } __catch(...) { _RopeRep::__STL_FREE_STRING(__base_buffer, __exponentiate_threshold, _M_get_allocator()); __throw_exception_again; } __base_rope._M_tree_ptr = __base_leaf; if (1 == __exponent) __result = __base_rope; else __result = power(__base_rope, __exponent, _Rope_Concat_fn<_CharT, _Alloc>()); if (0 != __remainder) __result += __remainder_rope; } else __result = __remainder_rope; this->_M_tree_ptr = __result._M_tree_ptr; this->_M_tree_ptr->_M_ref_nonnil(); } template<class _CharT, class _Alloc> _CharT rope<_CharT, _Alloc>::_S_empty_c_str[1]; template<class _CharT, class _Alloc> const _CharT* rope<_CharT, _Alloc>:: c_str() const { if (0 == this->_M_tree_ptr) { _S_empty_c_str[0] = _S_eos((_CharT*)0); // Possibly redundant, // but probably fast. return _S_empty_c_str; } __gthread_mutex_lock (&this->_M_tree_ptr->_M_c_string_lock); __GC_CONST _CharT* __result = this->_M_tree_ptr->_M_c_string; if (0 == __result) { size_t __s = size(); __result = this->_Data_allocate(__s + 1); _S_flatten(this->_M_tree_ptr, __result); __result[__s] = _S_eos((_CharT*)0); this->_M_tree_ptr->_M_c_string = __result; } __gthread_mutex_unlock (&this->_M_tree_ptr->_M_c_string_lock); return(__result); } template<class _CharT, class _Alloc> const _CharT* rope<_CharT, _Alloc>:: replace_with_c_str() { if (0 == this->_M_tree_ptr) { _S_empty_c_str[0] = _S_eos((_CharT*)0); return _S_empty_c_str; } __GC_CONST _CharT* __old_c_string = this->_M_tree_ptr->_M_c_string; if (__detail::_S_leaf == this->_M_tree_ptr->_M_tag && 0 != __old_c_string) return(__old_c_string); size_t __s = size(); _CharT* __result = this->_Data_allocate(_S_rounded_up_size(__s)); _S_flatten(this->_M_tree_ptr, __result); __result[__s] = _S_eos((_CharT*)0); this->_M_tree_ptr->_M_unref_nonnil(); this->_M_tree_ptr = _S_new_RopeLeaf(__result, __s, this->_M_get_allocator()); return(__result); } // Algorithm specializations. More should be added. template<class _Rope_iterator> // was templated on CharT and Alloc void // VC++ workaround _Rope_rotate(_Rope_iterator __first, _Rope_iterator __middle, _Rope_iterator __last) { typedef typename _Rope_iterator::value_type _CharT; typedef typename _Rope_iterator::_allocator_type _Alloc; rope<_CharT, _Alloc>& __r(__first.container()); rope<_CharT, _Alloc> __prefix = __r.substr(0, __first.index()); rope<_CharT, _Alloc> __suffix = __r.substr(__last.index(), __r.size() - __last.index()); rope<_CharT, _Alloc> __part1 = __r.substr(__middle.index(), __last.index() - __middle.index()); rope<_CharT, _Alloc> __part2 = __r.substr(__first.index(), __middle.index() - __first.index()); __r = __prefix; __r += __part1; __r += __part2; __r += __suffix; } #if !defined(__GNUC__) // Appears to confuse g++ inline void rotate(_Rope_iterator<char, __STL_DEFAULT_ALLOCATOR(char)> __first, _Rope_iterator<char, __STL_DEFAULT_ALLOCATOR(char)> __middle, _Rope_iterator<char, __STL_DEFAULT_ALLOCATOR(char)> __last) { _Rope_rotate(__first, __middle, __last); } #endif # if 0 // Probably not useful for several reasons: // - for SGIs 7.1 compiler and probably some others, // this forces lots of rope<wchar_t, ...> instantiations, creating a // code bloat and compile time problem. (Fixed in 7.2.) // - wchar_t is 4 bytes wide on most UNIX platforms, making it // unattractive for unicode strings. Unsigned short may be a better // character type. inline void rotate(_Rope_iterator<wchar_t, __STL_DEFAULT_ALLOCATOR(char)> __first, _Rope_iterator<wchar_t, __STL_DEFAULT_ALLOCATOR(char)> __middle, _Rope_iterator<wchar_t, __STL_DEFAULT_ALLOCATOR(char)> __last) { _Rope_rotate(__first, __middle, __last); } # endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/vstring.tcc���������������������������������������������������������������������������0000644�����������������00000056055�14763166027�0010603 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Versatile string -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/vstring.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ext/vstring.h} */ #ifndef _VSTRING_TCC #define _VSTRING_TCC 1 #pragma GCC system_header #include <bits/cxxabi_forced.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> const typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type __versa_string<_CharT, _Traits, _Alloc, _Base>::npos; template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> void __versa_string<_CharT, _Traits, _Alloc, _Base>:: resize(size_type __n, _CharT __c) { const size_type __size = this->size(); if (__size < __n) this->append(__n - __size, __c); else if (__n < __size) this->_M_erase(__n, __size - __n); } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> __versa_string<_CharT, _Traits, _Alloc, _Base>& __versa_string<_CharT, _Traits, _Alloc, _Base>:: _M_append(const _CharT* __s, size_type __n) { const size_type __len = __n + this->size(); if (__len <= this->capacity() && !this->_M_is_shared()) { if (__n) this->_S_copy(this->_M_data() + this->size(), __s, __n); } else this->_M_mutate(this->size(), size_type(0), __s, __n); this->_M_set_length(__len); return *this; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> template<typename _InputIterator> __versa_string<_CharT, _Traits, _Alloc, _Base>& __versa_string<_CharT, _Traits, _Alloc, _Base>:: _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1, _InputIterator __k2, std::__false_type) { const __versa_string __s(__k1, __k2); const size_type __n1 = __i2 - __i1; return _M_replace(__i1 - _M_ibegin(), __n1, __s._M_data(), __s.size()); } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> __versa_string<_CharT, _Traits, _Alloc, _Base>& __versa_string<_CharT, _Traits, _Alloc, _Base>:: _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, _CharT __c) { _M_check_length(__n1, __n2, "__versa_string::_M_replace_aux"); const size_type __old_size = this->size(); const size_type __new_size = __old_size + __n2 - __n1; if (__new_size <= this->capacity() && !this->_M_is_shared()) { _CharT* __p = this->_M_data() + __pos1; const size_type __how_much = __old_size - __pos1 - __n1; if (__how_much && __n1 != __n2) this->_S_move(__p + __n2, __p + __n1, __how_much); } else this->_M_mutate(__pos1, __n1, 0, __n2); if (__n2) this->_S_assign(this->_M_data() + __pos1, __n2, __c); this->_M_set_length(__new_size); return *this; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> __versa_string<_CharT, _Traits, _Alloc, _Base>& __versa_string<_CharT, _Traits, _Alloc, _Base>:: _M_replace(size_type __pos, size_type __len1, const _CharT* __s, const size_type __len2) { _M_check_length(__len1, __len2, "__versa_string::_M_replace"); const size_type __old_size = this->size(); const size_type __new_size = __old_size + __len2 - __len1; if (__new_size <= this->capacity() && !this->_M_is_shared()) { _CharT* __p = this->_M_data() + __pos; const size_type __how_much = __old_size - __pos - __len1; if (_M_disjunct(__s)) { if (__how_much && __len1 != __len2) this->_S_move(__p + __len2, __p + __len1, __how_much); if (__len2) this->_S_copy(__p, __s, __len2); } else { // Work in-place. if (__len2 && __len2 <= __len1) this->_S_move(__p, __s, __len2); if (__how_much && __len1 != __len2) this->_S_move(__p + __len2, __p + __len1, __how_much); if (__len2 > __len1) { if (__s + __len2 <= __p + __len1) this->_S_move(__p, __s, __len2); else if (__s >= __p + __len1) this->_S_copy(__p, __s + __len2 - __len1, __len2); else { const size_type __nleft = (__p + __len1) - __s; this->_S_move(__p, __s, __nleft); this->_S_copy(__p + __nleft, __p + __len2, __len2 - __nleft); } } } } else this->_M_mutate(__pos, __len1, __s, __len2); this->_M_set_length(__new_size); return *this; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> __versa_string<_CharT, _Traits, _Alloc, _Base> operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs) { __versa_string<_CharT, _Traits, _Alloc, _Base> __str; __str.reserve(__lhs.size() + __rhs.size()); __str.append(__lhs); __str.append(__rhs); return __str; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> __versa_string<_CharT, _Traits, _Alloc, _Base> operator+(const _CharT* __lhs, const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs) { __glibcxx_requires_string(__lhs); typedef __versa_string<_CharT, _Traits, _Alloc, _Base> __string_type; typedef typename __string_type::size_type __size_type; const __size_type __len = _Traits::length(__lhs); __string_type __str; __str.reserve(__len + __rhs.size()); __str.append(__lhs, __len); __str.append(__rhs); return __str; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> __versa_string<_CharT, _Traits, _Alloc, _Base> operator+(_CharT __lhs, const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs) { __versa_string<_CharT, _Traits, _Alloc, _Base> __str; __str.reserve(__rhs.size() + 1); __str.push_back(__lhs); __str.append(__rhs); return __str; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> __versa_string<_CharT, _Traits, _Alloc, _Base> operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, const _CharT* __rhs) { __glibcxx_requires_string(__rhs); typedef __versa_string<_CharT, _Traits, _Alloc, _Base> __string_type; typedef typename __string_type::size_type __size_type; const __size_type __len = _Traits::length(__rhs); __string_type __str; __str.reserve(__lhs.size() + __len); __str.append(__lhs); __str.append(__rhs, __len); return __str; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> __versa_string<_CharT, _Traits, _Alloc, _Base> operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, _CharT __rhs) { __versa_string<_CharT, _Traits, _Alloc, _Base> __str; __str.reserve(__lhs.size() + 1); __str.append(__lhs); __str.push_back(__rhs); return __str; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type __versa_string<_CharT, _Traits, _Alloc, _Base>:: copy(_CharT* __s, size_type __n, size_type __pos) const { _M_check(__pos, "__versa_string::copy"); __n = _M_limit(__pos, __n); __glibcxx_requires_string_len(__s, __n); if (__n) this->_S_copy(__s, this->_M_data() + __pos, __n); // 21.3.5.7 par 3: do not append null. (good.) return __n; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type __versa_string<_CharT, _Traits, _Alloc, _Base>:: find(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_requires_string_len(__s, __n); const size_type __size = this->size(); const _CharT* __data = this->_M_data(); if (__n == 0) return __pos <= __size ? __pos : npos; if (__n <= __size) { for (; __pos <= __size - __n; ++__pos) if (traits_type::eq(__data[__pos], __s[0]) && traits_type::compare(__data + __pos + 1, __s + 1, __n - 1) == 0) return __pos; } return npos; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type __versa_string<_CharT, _Traits, _Alloc, _Base>:: find(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT { size_type __ret = npos; const size_type __size = this->size(); if (__pos < __size) { const _CharT* __data = this->_M_data(); const size_type __n = __size - __pos; const _CharT* __p = traits_type::find(__data + __pos, __n, __c); if (__p) __ret = __p - __data; } return __ret; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type __versa_string<_CharT, _Traits, _Alloc, _Base>:: rfind(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_requires_string_len(__s, __n); const size_type __size = this->size(); if (__n <= __size) { __pos = std::min(size_type(__size - __n), __pos); const _CharT* __data = this->_M_data(); do { if (traits_type::compare(__data + __pos, __s, __n) == 0) return __pos; } while (__pos-- > 0); } return npos; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type __versa_string<_CharT, _Traits, _Alloc, _Base>:: rfind(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT { size_type __size = this->size(); if (__size) { if (--__size > __pos) __size = __pos; for (++__size; __size-- > 0; ) if (traits_type::eq(this->_M_data()[__size], __c)) return __size; } return npos; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type __versa_string<_CharT, _Traits, _Alloc, _Base>:: find_first_of(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_requires_string_len(__s, __n); for (; __n && __pos < this->size(); ++__pos) { const _CharT* __p = traits_type::find(__s, __n, this->_M_data()[__pos]); if (__p) return __pos; } return npos; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type __versa_string<_CharT, _Traits, _Alloc, _Base>:: find_last_of(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_requires_string_len(__s, __n); size_type __size = this->size(); if (__size && __n) { if (--__size > __pos) __size = __pos; do { if (traits_type::find(__s, __n, this->_M_data()[__size])) return __size; } while (__size-- != 0); } return npos; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type __versa_string<_CharT, _Traits, _Alloc, _Base>:: find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_requires_string_len(__s, __n); for (; __pos < this->size(); ++__pos) if (!traits_type::find(__s, __n, this->_M_data()[__pos])) return __pos; return npos; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type __versa_string<_CharT, _Traits, _Alloc, _Base>:: find_first_not_of(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT { for (; __pos < this->size(); ++__pos) if (!traits_type::eq(this->_M_data()[__pos], __c)) return __pos; return npos; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type __versa_string<_CharT, _Traits, _Alloc, _Base>:: find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_requires_string_len(__s, __n); size_type __size = this->size(); if (__size) { if (--__size > __pos) __size = __pos; do { if (!traits_type::find(__s, __n, this->_M_data()[__size])) return __size; } while (__size--); } return npos; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type __versa_string<_CharT, _Traits, _Alloc, _Base>:: find_last_not_of(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT { size_type __size = this->size(); if (__size) { if (--__size > __pos) __size = __pos; do { if (!traits_type::eq(this->_M_data()[__size], __c)) return __size; } while (__size--); } return npos; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> int __versa_string<_CharT, _Traits, _Alloc, _Base>:: compare(size_type __pos, size_type __n, const __versa_string& __str) const { _M_check(__pos, "__versa_string::compare"); __n = _M_limit(__pos, __n); const size_type __osize = __str.size(); const size_type __len = std::min(__n, __osize); int __r = traits_type::compare(this->_M_data() + __pos, __str.data(), __len); if (!__r) __r = this->_S_compare(__n, __osize); return __r; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> int __versa_string<_CharT, _Traits, _Alloc, _Base>:: compare(size_type __pos1, size_type __n1, const __versa_string& __str, size_type __pos2, size_type __n2) const { _M_check(__pos1, "__versa_string::compare"); __str._M_check(__pos2, "__versa_string::compare"); __n1 = _M_limit(__pos1, __n1); __n2 = __str._M_limit(__pos2, __n2); const size_type __len = std::min(__n1, __n2); int __r = traits_type::compare(this->_M_data() + __pos1, __str.data() + __pos2, __len); if (!__r) __r = this->_S_compare(__n1, __n2); return __r; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> int __versa_string<_CharT, _Traits, _Alloc, _Base>:: compare(const _CharT* __s) const { __glibcxx_requires_string(__s); const size_type __size = this->size(); const size_type __osize = traits_type::length(__s); const size_type __len = std::min(__size, __osize); int __r = traits_type::compare(this->_M_data(), __s, __len); if (!__r) __r = this->_S_compare(__size, __osize); return __r; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> int __versa_string <_CharT, _Traits, _Alloc, _Base>:: compare(size_type __pos, size_type __n1, const _CharT* __s) const { __glibcxx_requires_string(__s); _M_check(__pos, "__versa_string::compare"); __n1 = _M_limit(__pos, __n1); const size_type __osize = traits_type::length(__s); const size_type __len = std::min(__n1, __osize); int __r = traits_type::compare(this->_M_data() + __pos, __s, __len); if (!__r) __r = this->_S_compare(__n1, __osize); return __r; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> int __versa_string <_CharT, _Traits, _Alloc, _Base>:: compare(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) const { __glibcxx_requires_string_len(__s, __n2); _M_check(__pos, "__versa_string::compare"); __n1 = _M_limit(__pos, __n1); const size_type __len = std::min(__n1, __n2); int __r = traits_type::compare(this->_M_data() + __pos, __s, __len); if (!__r) __r = this->_S_compare(__n1, __n2); return __r; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __in, __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>& __str) { typedef basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; typedef __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base> __string_type; typedef typename __istream_type::int_type __int_type; typedef typename __string_type::size_type __size_type; typedef ctype<_CharT> __ctype_type; typedef typename __ctype_type::ctype_base __ctype_base; __size_type __extracted = 0; typename __ios_base::iostate __err = __ios_base::goodbit; typename __istream_type::sentry __cerb(__in, false); if (__cerb) { __try { // Avoid reallocation for common case. __str.erase(); _CharT __buf[128]; __size_type __len = 0; const streamsize __w = __in.width(); const __size_type __n = __w > 0 ? static_cast<__size_type>(__w) : __str.max_size(); const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc()); const __int_type __eof = _Traits::eof(); __int_type __c = __in.rdbuf()->sgetc(); while (__extracted < __n && !_Traits::eq_int_type(__c, __eof) && !__ct.is(__ctype_base::space, _Traits::to_char_type(__c))) { if (__len == sizeof(__buf) / sizeof(_CharT)) { __str.append(__buf, sizeof(__buf) / sizeof(_CharT)); __len = 0; } __buf[__len++] = _Traits::to_char_type(__c); ++__extracted; __c = __in.rdbuf()->snextc(); } __str.append(__buf, __len); if (_Traits::eq_int_type(__c, __eof)) __err |= __ios_base::eofbit; __in.width(0); } __catch(__cxxabiv1::__forced_unwind&) { __in._M_setstate(__ios_base::badbit); __throw_exception_again; } __catch(...) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 91. Description of operator>> and getline() for string<> // might cause endless loop __in._M_setstate(__ios_base::badbit); } } // 211. operator>>(istream&, string&) doesn't set failbit if (!__extracted) __err |= __ios_base::failbit; if (__err) __in.setstate(__err); return __in; } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>& __in, __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>& __str, _CharT __delim) { typedef basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; typedef __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base> __string_type; typedef typename __istream_type::int_type __int_type; typedef typename __string_type::size_type __size_type; __size_type __extracted = 0; const __size_type __n = __str.max_size(); typename __ios_base::iostate __err = __ios_base::goodbit; typename __istream_type::sentry __cerb(__in, true); if (__cerb) { __try { // Avoid reallocation for common case. __str.erase(); _CharT __buf[128]; __size_type __len = 0; const __int_type __idelim = _Traits::to_int_type(__delim); const __int_type __eof = _Traits::eof(); __int_type __c = __in.rdbuf()->sgetc(); while (__extracted < __n && !_Traits::eq_int_type(__c, __eof) && !_Traits::eq_int_type(__c, __idelim)) { if (__len == sizeof(__buf) / sizeof(_CharT)) { __str.append(__buf, sizeof(__buf) / sizeof(_CharT)); __len = 0; } __buf[__len++] = _Traits::to_char_type(__c); ++__extracted; __c = __in.rdbuf()->snextc(); } __str.append(__buf, __len); if (_Traits::eq_int_type(__c, __eof)) __err |= __ios_base::eofbit; else if (_Traits::eq_int_type(__c, __idelim)) { ++__extracted; __in.rdbuf()->sbumpc(); } else __err |= __ios_base::failbit; } __catch(__cxxabiv1::__forced_unwind&) { __in._M_setstate(__ios_base::badbit); __throw_exception_again; } __catch(...) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 91. Description of operator>> and getline() for string<> // might cause endless loop __in._M_setstate(__ios_base::badbit); } } if (!__extracted) __err |= __ios_base::failbit; if (__err) __in.setstate(__err); return __in; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // _VSTRING_TCC �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pointer.h�����������������������������������������������������������������������������0000644�����������������00000046320�14763166027�0010237 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Custom pointer adapter and sample storage policies // Copyright (C) 2008-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** * @file ext/pointer.h * This file is a GNU extension to the Standard C++ Library. * * @author Bob Walters * * Provides reusable _Pointer_adapter for assisting in the development of * custom pointer types that can be used with the standard containers via * the allocator::pointer and allocator::const_pointer typedefs. */ #ifndef _POINTER_H #define _POINTER_H 1 #pragma GCC system_header #include <iosfwd> #include <bits/stl_iterator_base_types.h> #include <ext/cast.h> #include <ext/type_traits.h> #if __cplusplus >= 201103L # include <bits/move.h> # include <bits/ptr_traits.h> #endif namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief A storage policy for use with _Pointer_adapter<> which yields a * standard pointer. * * A _Storage_policy is required to provide 4 things: * 1) A get() API for returning the stored pointer value. * 2) An set() API for storing a pointer value. * 3) An element_type typedef to define the type this points to. * 4) An operator<() to support pointer comparison. * 5) An operator==() to support pointer comparison. */ template<typename _Tp> class _Std_pointer_impl { public: // the type this pointer points to. typedef _Tp element_type; // A method to fetch the pointer value as a standard T* value; inline _Tp* get() const { return _M_value; } // A method to set the pointer value, from a standard T* value; inline void set(element_type* __arg) { _M_value = __arg; } // Comparison of pointers inline bool operator<(const _Std_pointer_impl& __rarg) const { return (_M_value < __rarg._M_value); } inline bool operator==(const _Std_pointer_impl& __rarg) const { return (_M_value == __rarg._M_value); } private: element_type* _M_value; }; /** * @brief A storage policy for use with _Pointer_adapter<> which stores * the pointer's address as an offset value which is relative to * its own address. * * This is intended for pointers within shared memory regions which * might be mapped at different addresses by different processes. * For null pointers, a value of 1 is used. (0 is legitimate * sometimes for nodes in circularly linked lists) This value was * chosen as the least likely to generate an incorrect null, As * there is no reason why any normal pointer would point 1 byte into * its own pointer address. */ template<typename _Tp> class _Relative_pointer_impl { public: typedef _Tp element_type; _Tp* get() const { if (_M_diff == 1) return 0; else return reinterpret_cast<_Tp*>(reinterpret_cast<_UIntPtrType>(this) + _M_diff); } void set(_Tp* __arg) { if (!__arg) _M_diff = 1; else _M_diff = reinterpret_cast<_UIntPtrType>(__arg) - reinterpret_cast<_UIntPtrType>(this); } // Comparison of pointers inline bool operator<(const _Relative_pointer_impl& __rarg) const { return (reinterpret_cast<_UIntPtrType>(this->get()) < reinterpret_cast<_UIntPtrType>(__rarg.get())); } inline bool operator==(const _Relative_pointer_impl& __rarg) const { return (reinterpret_cast<_UIntPtrType>(this->get()) == reinterpret_cast<_UIntPtrType>(__rarg.get())); } private: #ifdef _GLIBCXX_USE_LONG_LONG typedef __gnu_cxx::__conditional_type< (sizeof(unsigned long) >= sizeof(void*)), unsigned long, unsigned long long>::__type _UIntPtrType; #else typedef unsigned long _UIntPtrType; #endif _UIntPtrType _M_diff; }; /** * Relative_pointer_impl needs a specialization for const T because of * the casting done during pointer arithmetic. */ template<typename _Tp> class _Relative_pointer_impl<const _Tp> { public: typedef const _Tp element_type; const _Tp* get() const { if (_M_diff == 1) return 0; else return reinterpret_cast<const _Tp*> (reinterpret_cast<_UIntPtrType>(this) + _M_diff); } void set(const _Tp* __arg) { if (!__arg) _M_diff = 1; else _M_diff = reinterpret_cast<_UIntPtrType>(__arg) - reinterpret_cast<_UIntPtrType>(this); } // Comparison of pointers inline bool operator<(const _Relative_pointer_impl& __rarg) const { return (reinterpret_cast<_UIntPtrType>(this->get()) < reinterpret_cast<_UIntPtrType>(__rarg.get())); } inline bool operator==(const _Relative_pointer_impl& __rarg) const { return (reinterpret_cast<_UIntPtrType>(this->get()) == reinterpret_cast<_UIntPtrType>(__rarg.get())); } private: #ifdef _GLIBCXX_USE_LONG_LONG typedef __gnu_cxx::__conditional_type< (sizeof(unsigned long) >= sizeof(void*)), unsigned long, unsigned long long>::__type _UIntPtrType; #else typedef unsigned long _UIntPtrType; #endif _UIntPtrType _M_diff; }; /** * The specialization on this type helps resolve the problem of * reference to void, and eliminates the need to specialize * _Pointer_adapter for cases of void*, const void*, and so on. */ struct _Invalid_type { }; template<typename _Tp> struct _Reference_type { typedef _Tp& reference; }; template<> struct _Reference_type<void> { typedef _Invalid_type& reference; }; template<> struct _Reference_type<const void> { typedef const _Invalid_type& reference; }; template<> struct _Reference_type<volatile void> { typedef volatile _Invalid_type& reference; }; template<> struct _Reference_type<volatile const void> { typedef const volatile _Invalid_type& reference; }; /** * This structure accommodates the way in which * std::iterator_traits<> is normally specialized for const T*, so * that value_type is still T. */ template<typename _Tp> struct _Unqualified_type { typedef _Tp type; }; template<typename _Tp> struct _Unqualified_type<const _Tp> { typedef _Tp type; }; /** * The following provides an 'alternative pointer' that works with * the containers when specified as the pointer typedef of the * allocator. * * The pointer type used with the containers doesn't have to be this * class, but it must support the implicit conversions, pointer * arithmetic, comparison operators, etc. that are supported by this * class, and avoid raising compile-time ambiguities. Because * creating a working pointer can be challenging, this pointer * template was designed to wrapper an easier storage policy type, * so that it becomes reusable for creating other pointer types. * * A key point of this class is also that it allows container * writers to 'assume' Allocator::pointer is a typedef for a normal * pointer. This class supports most of the conventions of a true * pointer, and can, for instance handle implicit conversion to * const and base class pointer types. The only impositions on * container writers to support extended pointers are: 1) use the * Allocator::pointer typedef appropriately for pointer types. 2) * if you need pointer casting, use the __pointer_cast<> functions * from ext/cast.h. This allows pointer cast operations to be * overloaded as necessary by custom pointers. * * Note: The const qualifier works with this pointer adapter as * follows: * * _Tp* == _Pointer_adapter<_Std_pointer_impl<_Tp> >; * const _Tp* == _Pointer_adapter<_Std_pointer_impl<const _Tp> >; * _Tp* const == const _Pointer_adapter<_Std_pointer_impl<_Tp> >; * const _Tp* const == const _Pointer_adapter<_Std_pointer_impl<const _Tp> >; */ template<typename _Storage_policy> class _Pointer_adapter : public _Storage_policy { public: typedef typename _Storage_policy::element_type element_type; // These are needed for iterator_traits typedef std::random_access_iterator_tag iterator_category; typedef typename _Unqualified_type<element_type>::type value_type; typedef std::ptrdiff_t difference_type; typedef _Pointer_adapter pointer; typedef typename _Reference_type<element_type>::reference reference; // Reminder: 'const' methods mean that the method is valid when the // pointer is immutable, and has nothing to do with whether the // 'pointee' is const. // Default Constructor (Convert from element_type*) _Pointer_adapter(element_type* __arg = 0) { _Storage_policy::set(__arg); } // Copy constructor from _Pointer_adapter of same type. _Pointer_adapter(const _Pointer_adapter& __arg) { _Storage_policy::set(__arg.get()); } // Convert from _Up* if conversion to element_type* is valid. template<typename _Up> _Pointer_adapter(_Up* __arg) { _Storage_policy::set(__arg); } // Conversion from another _Pointer_adapter if _Up if static cast is // valid. template<typename _Up> _Pointer_adapter(const _Pointer_adapter<_Up>& __arg) { _Storage_policy::set(__arg.get()); } // Destructor ~_Pointer_adapter() { } // Assignment operator _Pointer_adapter& operator=(const _Pointer_adapter& __arg) { _Storage_policy::set(__arg.get()); return *this; } template<typename _Up> _Pointer_adapter& operator=(const _Pointer_adapter<_Up>& __arg) { _Storage_policy::set(__arg.get()); return *this; } template<typename _Up> _Pointer_adapter& operator=(_Up* __arg) { _Storage_policy::set(__arg); return *this; } // Operator*, returns element_type& inline reference operator*() const { return *(_Storage_policy::get()); } // Operator->, returns element_type* inline element_type* operator->() const { return _Storage_policy::get(); } // Operator[], returns a element_type& to the item at that loc. inline reference operator[](std::ptrdiff_t __index) const { return _Storage_policy::get()[__index]; } // To allow implicit conversion to "bool", for "if (ptr)..." private: typedef element_type*(_Pointer_adapter::*__unspecified_bool_type)() const; public: operator __unspecified_bool_type() const { return _Storage_policy::get() == 0 ? 0 : &_Pointer_adapter::operator->; } // ! operator (for: if (!ptr)...) inline bool operator!() const { return (_Storage_policy::get() == 0); } // Pointer differences inline friend std::ptrdiff_t operator-(const _Pointer_adapter& __lhs, element_type* __rhs) { return (__lhs.get() - __rhs); } inline friend std::ptrdiff_t operator-(element_type* __lhs, const _Pointer_adapter& __rhs) { return (__lhs - __rhs.get()); } template<typename _Up> inline friend std::ptrdiff_t operator-(const _Pointer_adapter& __lhs, _Up* __rhs) { return (__lhs.get() - __rhs); } template<typename _Up> inline friend std::ptrdiff_t operator-(_Up* __lhs, const _Pointer_adapter& __rhs) { return (__lhs - __rhs.get()); } template<typename _Up> inline std::ptrdiff_t operator-(const _Pointer_adapter<_Up>& __rhs) const { return (_Storage_policy::get() - __rhs.get()); } // Pointer math // Note: There is a reason for all this overloading based on different // integer types. In some libstdc++-v3 test cases, a templated // operator+ is declared which can match any types. This operator // tends to "steal" the recognition of _Pointer_adapter's own operator+ // unless the integer type matches perfectly. #define _CXX_POINTER_ARITH_OPERATOR_SET(INT_TYPE) \ inline friend _Pointer_adapter \ operator+(const _Pointer_adapter& __lhs, INT_TYPE __offset) \ { return _Pointer_adapter(__lhs.get() + __offset); } \ \ inline friend _Pointer_adapter \ operator+(INT_TYPE __offset, const _Pointer_adapter& __rhs) \ { return _Pointer_adapter(__rhs.get() + __offset); } \ \ inline friend _Pointer_adapter \ operator-(const _Pointer_adapter& __lhs, INT_TYPE __offset) \ { return _Pointer_adapter(__lhs.get() - __offset); } \ \ inline _Pointer_adapter& \ operator+=(INT_TYPE __offset) \ { \ _Storage_policy::set(_Storage_policy::get() + __offset); \ return *this; \ } \ \ inline _Pointer_adapter& \ operator-=(INT_TYPE __offset) \ { \ _Storage_policy::set(_Storage_policy::get() - __offset); \ return *this; \ } \ // END of _CXX_POINTER_ARITH_OPERATOR_SET macro // Expand into the various pointer arithmetic operators needed. _CXX_POINTER_ARITH_OPERATOR_SET(short); _CXX_POINTER_ARITH_OPERATOR_SET(unsigned short); _CXX_POINTER_ARITH_OPERATOR_SET(int); _CXX_POINTER_ARITH_OPERATOR_SET(unsigned int); _CXX_POINTER_ARITH_OPERATOR_SET(long); _CXX_POINTER_ARITH_OPERATOR_SET(unsigned long); // Mathematical Manipulators inline _Pointer_adapter& operator++() { _Storage_policy::set(_Storage_policy::get() + 1); return *this; } inline _Pointer_adapter operator++(int) { _Pointer_adapter tmp(*this); _Storage_policy::set(_Storage_policy::get() + 1); return tmp; } inline _Pointer_adapter& operator--() { _Storage_policy::set(_Storage_policy::get() - 1); return *this; } inline _Pointer_adapter operator--(int) { _Pointer_adapter tmp(*this); _Storage_policy::set(_Storage_policy::get() - 1); return tmp; } }; // class _Pointer_adapter #define _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(OPERATOR) \ template<typename _Tp1, typename _Tp2> \ inline bool \ operator OPERATOR(const _Pointer_adapter<_Tp1>& __lhs, _Tp2 __rhs) \ { return __lhs.get() OPERATOR __rhs; } \ \ template<typename _Tp1, typename _Tp2> \ inline bool \ operator OPERATOR(_Tp1 __lhs, const _Pointer_adapter<_Tp2>& __rhs) \ { return __lhs OPERATOR __rhs.get(); } \ \ template<typename _Tp1, typename _Tp2> \ inline bool \ operator OPERATOR(const _Pointer_adapter<_Tp1>& __lhs, \ const _Pointer_adapter<_Tp2>& __rhs) \ { return __lhs.get() OPERATOR __rhs.get(); } \ \ // End GCC_CXX_POINTER_COMPARISON_OPERATION_SET Macro // Expand into the various comparison operators needed. _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(==) _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(!=) _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(<) _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(<=) _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(>) _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(>=) // These are here for expressions like "ptr == 0", "ptr != 0" template<typename _Tp> inline bool operator==(const _Pointer_adapter<_Tp>& __lhs, int __rhs) { return __lhs.get() == reinterpret_cast<void*>(__rhs); } template<typename _Tp> inline bool operator==(int __lhs, const _Pointer_adapter<_Tp>& __rhs) { return __rhs.get() == reinterpret_cast<void*>(__lhs); } template<typename _Tp> inline bool operator!=(const _Pointer_adapter<_Tp>& __lhs, int __rhs) { return __lhs.get() != reinterpret_cast<void*>(__rhs); } template<typename _Tp> inline bool operator!=(int __lhs, const _Pointer_adapter<_Tp>& __rhs) { return __rhs.get() != reinterpret_cast<void*>(__lhs); } /** * Comparison operators for _Pointer_adapter defer to the base class' * comparison operators, when possible. */ template<typename _Tp> inline bool operator==(const _Pointer_adapter<_Tp>& __lhs, const _Pointer_adapter<_Tp>& __rhs) { return __lhs._Tp::operator==(__rhs); } template<typename _Tp> inline bool operator<=(const _Pointer_adapter<_Tp>& __lhs, const _Pointer_adapter<_Tp>& __rhs) { return __lhs._Tp::operator<(__rhs) || __lhs._Tp::operator==(__rhs); } template<typename _Tp> inline bool operator!=(const _Pointer_adapter<_Tp>& __lhs, const _Pointer_adapter<_Tp>& __rhs) { return !(__lhs._Tp::operator==(__rhs)); } template<typename _Tp> inline bool operator>(const _Pointer_adapter<_Tp>& __lhs, const _Pointer_adapter<_Tp>& __rhs) { return !(__lhs._Tp::operator<(__rhs) || __lhs._Tp::operator==(__rhs)); } template<typename _Tp> inline bool operator>=(const _Pointer_adapter<_Tp>& __lhs, const _Pointer_adapter<_Tp>& __rhs) { return !(__lhs._Tp::operator<(__rhs)); } template<typename _CharT, typename _Traits, typename _StoreT> inline std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const _Pointer_adapter<_StoreT>& __p) { return (__os << __p.get()); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #if __cplusplus >= 201103L namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Storage_policy> struct pointer_traits<__gnu_cxx::_Pointer_adapter<_Storage_policy>> { /// The pointer type typedef __gnu_cxx::_Pointer_adapter<_Storage_policy> pointer; /// The type pointed to typedef typename pointer::element_type element_type; /// Type used to represent the difference between two pointers typedef typename pointer::difference_type difference_type; template<typename _Up> using rebind = typename __gnu_cxx::_Pointer_adapter< typename pointer_traits<_Storage_policy>::rebind<_Up>>; static pointer pointer_to(typename pointer::reference __r) noexcept { return pointer(std::addressof(__r)); } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif #endif // _POINTER_H ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/malloc_allocator.h��������������������������������������������������������������������0000644�����������������00000010562�14763166027�0012065 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Allocator that wraps "C" malloc -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/malloc_allocator.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _MALLOC_ALLOCATOR_H #define _MALLOC_ALLOCATOR_H 1 #include <cstdlib> #include <new> #include <bits/functexcept.h> #include <bits/move.h> #if __cplusplus >= 201103L #include <type_traits> #endif namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using std::size_t; using std::ptrdiff_t; /** * @brief An allocator that uses malloc. * @ingroup allocators * * This is precisely the allocator defined in the C++ Standard. * - all allocation calls malloc * - all deallocation calls free */ template<typename _Tp> class malloc_allocator { public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Tp* pointer; typedef const _Tp* const_pointer; typedef _Tp& reference; typedef const _Tp& const_reference; typedef _Tp value_type; template<typename _Tp1> struct rebind { typedef malloc_allocator<_Tp1> other; }; #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2103. propagate_on_container_move_assignment typedef std::true_type propagate_on_container_move_assignment; #endif malloc_allocator() _GLIBCXX_USE_NOEXCEPT { } malloc_allocator(const malloc_allocator&) _GLIBCXX_USE_NOEXCEPT { } template<typename _Tp1> malloc_allocator(const malloc_allocator<_Tp1>&) _GLIBCXX_USE_NOEXCEPT { } ~malloc_allocator() _GLIBCXX_USE_NOEXCEPT { } pointer address(reference __x) const _GLIBCXX_NOEXCEPT { return std::__addressof(__x); } const_pointer address(const_reference __x) const _GLIBCXX_NOEXCEPT { return std::__addressof(__x); } // NB: __n is permitted to be 0. The C++ standard says nothing // about what the return value is when __n == 0. pointer allocate(size_type __n, const void* = 0) { if (__n > this->max_size()) std::__throw_bad_alloc(); pointer __ret = static_cast<_Tp*>(std::malloc(__n * sizeof(_Tp))); if (!__ret) std::__throw_bad_alloc(); return __ret; } // __p is not permitted to be a null pointer. void deallocate(pointer __p, size_type) { std::free(static_cast<void*>(__p)); } size_type max_size() const _GLIBCXX_USE_NOEXCEPT { return size_t(-1) / sizeof(_Tp); } #if __cplusplus >= 201103L template<typename _Up, typename... _Args> void construct(_Up* __p, _Args&&... __args) { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } template<typename _Up> void destroy(_Up* __p) { __p->~_Up(); } #else // _GLIBCXX_RESOLVE_LIB_DEFECTS // 402. wrong new expression in [some_] allocator::construct void construct(pointer __p, const _Tp& __val) { ::new((void *)__p) value_type(__val); } void destroy(pointer __p) { __p->~_Tp(); } #endif }; template<typename _Tp> inline bool operator==(const malloc_allocator<_Tp>&, const malloc_allocator<_Tp>&) { return true; } template<typename _Tp> inline bool operator!=(const malloc_allocator<_Tp>&, const malloc_allocator<_Tp>&) { return false; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ����������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/functional����������������������������������������������������������������������������0000644�����������������00000033724�14763166027�0010477 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Functional extensions -*- C++ -*- // Copyright (C) 2002-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file ext/functional * This file is a GNU extension to the Standard C++ Library (possibly * containing extensions from the HP/SGI STL subset). */ #ifndef _EXT_FUNCTIONAL #define _EXT_FUNCTIONAL 1 #pragma GCC system_header #include <functional> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using std::size_t; using std::unary_function; using std::binary_function; using std::mem_fun1_t; using std::const_mem_fun1_t; using std::mem_fun1_ref_t; using std::const_mem_fun1_ref_t; /** The @c identity_element functions are not part of the C++ * standard; SGI provided them as an extension. Its argument is an * operation, and its return value is the identity element for that * operation. It is overloaded for addition and multiplication, * and you can overload it for your own nefarious operations. * * @addtogroup SGIextensions * @{ */ /// An \link SGIextensions SGI extension \endlink. template <class _Tp> inline _Tp identity_element(std::plus<_Tp>) { return _Tp(0); } /// An \link SGIextensions SGI extension \endlink. template <class _Tp> inline _Tp identity_element(std::multiplies<_Tp>) { return _Tp(1); } /** @} */ /** As an extension to the binders, SGI provided composition functors and * wrapper functions to aid in their creation. The @c unary_compose * functor is constructed from two functions/functors, @c f and @c g. * Calling @c operator() with a single argument @c x returns @c f(g(x)). * The function @c compose1 takes the two functions and constructs a * @c unary_compose variable for you. * * @c binary_compose is constructed from three functors, @c f, @c g1, * and @c g2. Its @c operator() returns @c f(g1(x),g2(x)). The function * compose2 takes f, g1, and g2, and constructs the @c binary_compose * instance for you. For example, if @c f returns an int, then * \code * int answer = (compose2(f,g1,g2))(x); * \endcode * is equivalent to * \code * int temp1 = g1(x); * int temp2 = g2(x); * int answer = f(temp1,temp2); * \endcode * But the first form is more compact, and can be passed around as a * functor to other algorithms. * * @addtogroup SGIextensions * @{ */ /// An \link SGIextensions SGI extension \endlink. template <class _Operation1, class _Operation2> class unary_compose : public unary_function<typename _Operation2::argument_type, typename _Operation1::result_type> { protected: _Operation1 _M_fn1; _Operation2 _M_fn2; public: unary_compose(const _Operation1& __x, const _Operation2& __y) : _M_fn1(__x), _M_fn2(__y) {} typename _Operation1::result_type operator()(const typename _Operation2::argument_type& __x) const { return _M_fn1(_M_fn2(__x)); } }; /// An \link SGIextensions SGI extension \endlink. template <class _Operation1, class _Operation2> inline unary_compose<_Operation1, _Operation2> compose1(const _Operation1& __fn1, const _Operation2& __fn2) { return unary_compose<_Operation1,_Operation2>(__fn1, __fn2); } /// An \link SGIextensions SGI extension \endlink. template <class _Operation1, class _Operation2, class _Operation3> class binary_compose : public unary_function<typename _Operation2::argument_type, typename _Operation1::result_type> { protected: _Operation1 _M_fn1; _Operation2 _M_fn2; _Operation3 _M_fn3; public: binary_compose(const _Operation1& __x, const _Operation2& __y, const _Operation3& __z) : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { } typename _Operation1::result_type operator()(const typename _Operation2::argument_type& __x) const { return _M_fn1(_M_fn2(__x), _M_fn3(__x)); } }; /// An \link SGIextensions SGI extension \endlink. template <class _Operation1, class _Operation2, class _Operation3> inline binary_compose<_Operation1, _Operation2, _Operation3> compose2(const _Operation1& __fn1, const _Operation2& __fn2, const _Operation3& __fn3) { return binary_compose<_Operation1, _Operation2, _Operation3> (__fn1, __fn2, __fn3); } /** @} */ /** As an extension, SGI provided a functor called @c identity. When a * functor is required but no operations are desired, this can be used as a * pass-through. Its @c operator() returns its argument unchanged. * * @addtogroup SGIextensions */ template <class _Tp> struct identity : public std::_Identity<_Tp> {}; /** @c select1st and @c select2nd are extensions provided by SGI. Their * @c operator()s * take a @c std::pair as an argument, and return either the first member * or the second member, respectively. They can be used (especially with * the composition functors) to @a strip data from a sequence before * performing the remainder of an algorithm. * * @addtogroup SGIextensions * @{ */ /// An \link SGIextensions SGI extension \endlink. template <class _Pair> struct select1st : public std::_Select1st<_Pair> {}; /// An \link SGIextensions SGI extension \endlink. template <class _Pair> struct select2nd : public std::_Select2nd<_Pair> {}; /** @} */ // extension documented next template <class _Arg1, class _Arg2> struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1> { _Arg1 operator()(const _Arg1& __x, const _Arg2&) const { return __x; } }; template <class _Arg1, class _Arg2> struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2> { _Arg2 operator()(const _Arg1&, const _Arg2& __y) const { return __y; } }; /** The @c operator() of the @c project1st functor takes two arbitrary * arguments and returns the first one, while @c project2nd returns the * second one. They are extensions provided by SGI. * * @addtogroup SGIextensions * @{ */ /// An \link SGIextensions SGI extension \endlink. template <class _Arg1, class _Arg2> struct project1st : public _Project1st<_Arg1, _Arg2> {}; /// An \link SGIextensions SGI extension \endlink. template <class _Arg1, class _Arg2> struct project2nd : public _Project2nd<_Arg1, _Arg2> {}; /** @} */ // extension documented next template <class _Result> struct _Constant_void_fun { typedef _Result result_type; result_type _M_val; _Constant_void_fun(const result_type& __v) : _M_val(__v) {} const result_type& operator()() const { return _M_val; } }; template <class _Result, class _Argument> struct _Constant_unary_fun { typedef _Argument argument_type; typedef _Result result_type; result_type _M_val; _Constant_unary_fun(const result_type& __v) : _M_val(__v) {} const result_type& operator()(const _Argument&) const { return _M_val; } }; template <class _Result, class _Arg1, class _Arg2> struct _Constant_binary_fun { typedef _Arg1 first_argument_type; typedef _Arg2 second_argument_type; typedef _Result result_type; _Result _M_val; _Constant_binary_fun(const _Result& __v) : _M_val(__v) {} const result_type& operator()(const _Arg1&, const _Arg2&) const { return _M_val; } }; /** These three functors are each constructed from a single arbitrary * variable/value. Later, their @c operator()s completely ignore any * arguments passed, and return the stored value. * - @c constant_void_fun's @c operator() takes no arguments * - @c constant_unary_fun's @c operator() takes one argument (ignored) * - @c constant_binary_fun's @c operator() takes two arguments (ignored) * * The helper creator functions @c constant0, @c constant1, and * @c constant2 each take a @a result argument and construct variables of * the appropriate functor type. * * @addtogroup SGIextensions * @{ */ /// An \link SGIextensions SGI extension \endlink. template <class _Result> struct constant_void_fun : public _Constant_void_fun<_Result> { constant_void_fun(const _Result& __v) : _Constant_void_fun<_Result>(__v) {} }; /// An \link SGIextensions SGI extension \endlink. template <class _Result, class _Argument = _Result> struct constant_unary_fun : public _Constant_unary_fun<_Result, _Argument> { constant_unary_fun(const _Result& __v) : _Constant_unary_fun<_Result, _Argument>(__v) {} }; /// An \link SGIextensions SGI extension \endlink. template <class _Result, class _Arg1 = _Result, class _Arg2 = _Arg1> struct constant_binary_fun : public _Constant_binary_fun<_Result, _Arg1, _Arg2> { constant_binary_fun(const _Result& __v) : _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {} }; /// An \link SGIextensions SGI extension \endlink. template <class _Result> inline constant_void_fun<_Result> constant0(const _Result& __val) { return constant_void_fun<_Result>(__val); } /// An \link SGIextensions SGI extension \endlink. template <class _Result> inline constant_unary_fun<_Result, _Result> constant1(const _Result& __val) { return constant_unary_fun<_Result, _Result>(__val); } /// An \link SGIextensions SGI extension \endlink. template <class _Result> inline constant_binary_fun<_Result,_Result,_Result> constant2(const _Result& __val) { return constant_binary_fun<_Result, _Result, _Result>(__val); } /** @} */ /** The @c subtractive_rng class is documented on * <a href="http://www.sgi.com/tech/stl/">SGI's site</a>. * Note that this code assumes that @c int is 32 bits. * * @ingroup SGIextensions */ class subtractive_rng : public unary_function<unsigned int, unsigned int> { private: unsigned int _M_table[55]; size_t _M_index1; size_t _M_index2; public: /// Returns a number less than the argument. unsigned int operator()(unsigned int __limit) { _M_index1 = (_M_index1 + 1) % 55; _M_index2 = (_M_index2 + 1) % 55; _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2]; return _M_table[_M_index1] % __limit; } void _M_initialize(unsigned int __seed) { unsigned int __k = 1; _M_table[54] = __seed; size_t __i; for (__i = 0; __i < 54; __i++) { size_t __ii = (21 * (__i + 1) % 55) - 1; _M_table[__ii] = __k; __k = __seed - __k; __seed = _M_table[__ii]; } for (int __loop = 0; __loop < 4; __loop++) { for (__i = 0; __i < 55; __i++) _M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55]; } _M_index1 = 0; _M_index2 = 31; } /// Ctor allowing you to initialize the seed. subtractive_rng(unsigned int __seed) { _M_initialize(__seed); } /// Default ctor; initializes its state with some number you don't see. subtractive_rng() { _M_initialize(161803398u); } }; // Mem_fun adaptor helper functions mem_fun1 and mem_fun1_ref, // provided for backward compatibility, they are no longer part of // the C++ standard. template <class _Ret, class _Tp, class _Arg> inline mem_fun1_t<_Ret, _Tp, _Arg> mem_fun1(_Ret (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); } template <class _Ret, class _Tp, class _Arg> inline const_mem_fun1_t<_Ret, _Tp, _Arg> mem_fun1(_Ret (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); } template <class _Ret, class _Tp, class _Arg> inline mem_fun1_ref_t<_Ret, _Tp, _Arg> mem_fun1_ref(_Ret (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } template <class _Ret, class _Tp, class _Arg> inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg> mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ��������������������������������������������c++/4.8.2/ext/concurrence.h�������������������������������������������������������������������������0000644�����������������00000016673�14763166027�0011075 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Support for concurrent programing -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/concurrence.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _CONCURRENCE_H #define _CONCURRENCE_H 1 #pragma GCC system_header #include <exception> #include <bits/gthr.h> #include <bits/functexcept.h> #include <bits/cpp_type_traits.h> #include <ext/type_traits.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Available locking policies: // _S_single single-threaded code that doesn't need to be locked. // _S_mutex multi-threaded code that requires additional support // from gthr.h or abstraction layers in concurrence.h. // _S_atomic multi-threaded code using atomic operations. enum _Lock_policy { _S_single, _S_mutex, _S_atomic }; // Compile time constant that indicates prefered locking policy in // the current configuration. static const _Lock_policy __default_lock_policy = #ifdef __GTHREADS #if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) \ && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)) _S_atomic; #else _S_mutex; #endif #else _S_single; #endif // NB: As this is used in libsupc++, need to only depend on // exception. No stdexception classes, no use of std::string. class __concurrence_lock_error : public std::exception { public: virtual char const* what() const throw() { return "__gnu_cxx::__concurrence_lock_error"; } }; class __concurrence_unlock_error : public std::exception { public: virtual char const* what() const throw() { return "__gnu_cxx::__concurrence_unlock_error"; } }; class __concurrence_broadcast_error : public std::exception { public: virtual char const* what() const throw() { return "__gnu_cxx::__concurrence_broadcast_error"; } }; class __concurrence_wait_error : public std::exception { public: virtual char const* what() const throw() { return "__gnu_cxx::__concurrence_wait_error"; } }; // Substitute for concurrence_error object in the case of -fno-exceptions. inline void __throw_concurrence_lock_error() { _GLIBCXX_THROW_OR_ABORT(__concurrence_lock_error()); } inline void __throw_concurrence_unlock_error() { _GLIBCXX_THROW_OR_ABORT(__concurrence_unlock_error()); } #ifdef __GTHREAD_HAS_COND inline void __throw_concurrence_broadcast_error() { _GLIBCXX_THROW_OR_ABORT(__concurrence_broadcast_error()); } inline void __throw_concurrence_wait_error() { _GLIBCXX_THROW_OR_ABORT(__concurrence_wait_error()); } #endif class __mutex { private: #if __GTHREADS && defined __GTHREAD_MUTEX_INIT __gthread_mutex_t _M_mutex = __GTHREAD_MUTEX_INIT; #else __gthread_mutex_t _M_mutex; #endif __mutex(const __mutex&); __mutex& operator=(const __mutex&); public: __mutex() { #if __GTHREADS && ! defined __GTHREAD_MUTEX_INIT if (__gthread_active_p()) __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex); #endif } #if __GTHREADS && ! defined __GTHREAD_MUTEX_INIT ~__mutex() { if (__gthread_active_p()) __gthread_mutex_destroy(&_M_mutex); } #endif void lock() { #if __GTHREADS if (__gthread_active_p()) { if (__gthread_mutex_lock(&_M_mutex) != 0) __throw_concurrence_lock_error(); } #endif } void unlock() { #if __GTHREADS if (__gthread_active_p()) { if (__gthread_mutex_unlock(&_M_mutex) != 0) __throw_concurrence_unlock_error(); } #endif } __gthread_mutex_t* gthread_mutex(void) { return &_M_mutex; } }; class __recursive_mutex { private: #if __GTHREADS && defined __GTHREAD_RECURSIVE_MUTEX_INIT __gthread_recursive_mutex_t _M_mutex = __GTHREAD_RECURSIVE_MUTEX_INIT; #else __gthread_recursive_mutex_t _M_mutex; #endif __recursive_mutex(const __recursive_mutex&); __recursive_mutex& operator=(const __recursive_mutex&); public: __recursive_mutex() { #if __GTHREADS && ! defined __GTHREAD_RECURSIVE_MUTEX_INIT if (__gthread_active_p()) __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex); #endif } #if __GTHREADS && ! defined __GTHREAD_RECURSIVE_MUTEX_INIT ~__recursive_mutex() { if (__gthread_active_p()) __gthread_recursive_mutex_destroy(&_M_mutex); } #endif void lock() { #if __GTHREADS if (__gthread_active_p()) { if (__gthread_recursive_mutex_lock(&_M_mutex) != 0) __throw_concurrence_lock_error(); } #endif } void unlock() { #if __GTHREADS if (__gthread_active_p()) { if (__gthread_recursive_mutex_unlock(&_M_mutex) != 0) __throw_concurrence_unlock_error(); } #endif } __gthread_recursive_mutex_t* gthread_recursive_mutex(void) { return &_M_mutex; } }; /// Scoped lock idiom. // Acquire the mutex here with a constructor call, then release with // the destructor call in accordance with RAII style. class __scoped_lock { public: typedef __mutex __mutex_type; private: __mutex_type& _M_device; __scoped_lock(const __scoped_lock&); __scoped_lock& operator=(const __scoped_lock&); public: explicit __scoped_lock(__mutex_type& __name) : _M_device(__name) { _M_device.lock(); } ~__scoped_lock() throw() { _M_device.unlock(); } }; #ifdef __GTHREAD_HAS_COND class __cond { private: #if __GTHREADS && defined __GTHREAD_COND_INIT __gthread_cond_t _M_cond = __GTHREAD_COND_INIT; #else __gthread_cond_t _M_cond; #endif __cond(const __cond&); __cond& operator=(const __cond&); public: __cond() { #if __GTHREADS && ! defined __GTHREAD_COND_INIT if (__gthread_active_p()) __GTHREAD_COND_INIT_FUNCTION(&_M_cond); #endif } #if __GTHREADS && ! defined __GTHREAD_COND_INIT ~__cond() { if (__gthread_active_p()) __gthread_cond_destroy(&_M_cond); } #endif void broadcast() { #if __GTHREADS if (__gthread_active_p()) { if (__gthread_cond_broadcast(&_M_cond) != 0) __throw_concurrence_broadcast_error(); } #endif } void wait(__mutex *mutex) { #if __GTHREADS { if (__gthread_cond_wait(&_M_cond, mutex->gthread_mutex()) != 0) __throw_concurrence_wait_error(); } #endif } void wait_recursive(__recursive_mutex *mutex) { #if __GTHREADS { if (__gthread_cond_wait_recursive(&_M_cond, mutex->gthread_recursive_mutex()) != 0) __throw_concurrence_wait_error(); } #endif } }; #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ���������������������������������������������������������������������c++/4.8.2/ext/enc_filebuf.h�������������������������������������������������������������������������0000644�����������������00000004307�14763166027�0011017 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// filebuf with encoding state type -*- C++ -*- // Copyright (C) 2002-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/enc_filebuf.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _EXT_ENC_FILEBUF_H #define _EXT_ENC_FILEBUF_H 1 #include <fstream> #include <locale> #include <ext/codecvt_specializations.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /// class enc_filebuf. template<typename _CharT> class enc_filebuf : public std::basic_filebuf<_CharT, encoding_char_traits<_CharT> > { public: typedef encoding_char_traits<_CharT> traits_type; typedef typename traits_type::state_type state_type; typedef typename traits_type::pos_type pos_type; enc_filebuf(state_type& __state) : std::basic_filebuf<_CharT, encoding_char_traits<_CharT> >() { this->_M_state_beg = __state; } private: // concept requirements: // Set state type to something useful. // Something more than copyconstructible is needed here, so // require default and copy constructible + assignment operator. __glibcxx_class_requires(state_type, _SGIAssignableConcept) }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/numeric_traits.h����������������������������������������������������������������������0000644�����������������00000010737�14763166027�0011612 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/numeric_traits.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _EXT_NUMERIC_TRAITS #define _EXT_NUMERIC_TRAITS 1 #pragma GCC system_header #include <bits/cpp_type_traits.h> #include <ext/type_traits.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Compile time constants for builtin types. // Sadly std::numeric_limits member functions cannot be used for this. #define __glibcxx_signed(_Tp) ((_Tp)(-1) < 0) #define __glibcxx_digits(_Tp) \ (sizeof(_Tp) * __CHAR_BIT__ - __glibcxx_signed(_Tp)) #define __glibcxx_min(_Tp) \ (__glibcxx_signed(_Tp) ? (_Tp)1 << __glibcxx_digits(_Tp) : (_Tp)0) #define __glibcxx_max(_Tp) \ (__glibcxx_signed(_Tp) ? \ (((((_Tp)1 << (__glibcxx_digits(_Tp) - 1)) - 1) << 1) + 1) : ~(_Tp)0) template<typename _Value> struct __numeric_traits_integer { // Only integers for initialization of member constant. static const _Value __min = __glibcxx_min(_Value); static const _Value __max = __glibcxx_max(_Value); // NB: these two also available in std::numeric_limits as compile // time constants, but <limits> is big and we avoid including it. static const bool __is_signed = __glibcxx_signed(_Value); static const int __digits = __glibcxx_digits(_Value); }; template<typename _Value> const _Value __numeric_traits_integer<_Value>::__min; template<typename _Value> const _Value __numeric_traits_integer<_Value>::__max; template<typename _Value> const bool __numeric_traits_integer<_Value>::__is_signed; template<typename _Value> const int __numeric_traits_integer<_Value>::__digits; #undef __glibcxx_signed #undef __glibcxx_digits #undef __glibcxx_min #undef __glibcxx_max #define __glibcxx_floating(_Tp, _Fval, _Dval, _LDval) \ (std::__are_same<_Tp, float>::__value ? _Fval \ : std::__are_same<_Tp, double>::__value ? _Dval : _LDval) #define __glibcxx_max_digits10(_Tp) \ (2 + __glibcxx_floating(_Tp, __FLT_MANT_DIG__, __DBL_MANT_DIG__, \ __LDBL_MANT_DIG__) * 643L / 2136) #define __glibcxx_digits10(_Tp) \ __glibcxx_floating(_Tp, __FLT_DIG__, __DBL_DIG__, __LDBL_DIG__) #define __glibcxx_max_exponent10(_Tp) \ __glibcxx_floating(_Tp, __FLT_MAX_10_EXP__, __DBL_MAX_10_EXP__, \ __LDBL_MAX_10_EXP__) template<typename _Value> struct __numeric_traits_floating { // Only floating point types. See N1822. static const int __max_digits10 = __glibcxx_max_digits10(_Value); // See above comment... static const bool __is_signed = true; static const int __digits10 = __glibcxx_digits10(_Value); static const int __max_exponent10 = __glibcxx_max_exponent10(_Value); }; template<typename _Value> const int __numeric_traits_floating<_Value>::__max_digits10; template<typename _Value> const bool __numeric_traits_floating<_Value>::__is_signed; template<typename _Value> const int __numeric_traits_floating<_Value>::__digits10; template<typename _Value> const int __numeric_traits_floating<_Value>::__max_exponent10; template<typename _Value> struct __numeric_traits : public __conditional_type<std::__is_integer<_Value>::__value, __numeric_traits_integer<_Value>, __numeric_traits_floating<_Value> >::__type { }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #undef __glibcxx_floating #undef __glibcxx_max_digits10 #undef __glibcxx_digits10 #undef __glibcxx_max_exponent10 #endif ���������������������������������c++/4.8.2/ext/debug_allocator.h���������������������������������������������������������������������0000644�����������������00000007665�14763166027�0011716 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Allocators -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * Copyright (c) 1996-1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file ext/debug_allocator.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _DEBUG_ALLOCATOR_H #define _DEBUG_ALLOCATOR_H 1 #include <stdexcept> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using std::size_t; /** * @brief A meta-allocator with debugging bits, as per [20.4]. * @ingroup allocators * * This is precisely the allocator defined in the C++ Standard. * - all allocation calls operator new * - all deallocation calls operator delete */ template<typename _Alloc> class debug_allocator { public: typedef typename _Alloc::size_type size_type; typedef typename _Alloc::difference_type difference_type; typedef typename _Alloc::pointer pointer; typedef typename _Alloc::const_pointer const_pointer; typedef typename _Alloc::reference reference; typedef typename _Alloc::const_reference const_reference; typedef typename _Alloc::value_type value_type; private: // _M_extra is the number of objects that correspond to the // extra space where debug information is stored. size_type _M_extra; _Alloc _M_allocator; public: debug_allocator() { const size_t __obj_size = sizeof(value_type); _M_extra = (sizeof(size_type) + __obj_size - 1) / __obj_size; } pointer allocate(size_type __n) { pointer __res = _M_allocator.allocate(__n + _M_extra); size_type* __ps = reinterpret_cast<size_type*>(__res); *__ps = __n; return __res + _M_extra; } pointer allocate(size_type __n, const void* __hint) { pointer __res = _M_allocator.allocate(__n + _M_extra, __hint); size_type* __ps = reinterpret_cast<size_type*>(__res); *__ps = __n; return __res + _M_extra; } void deallocate(pointer __p, size_type __n) { if (__p) { pointer __real_p = __p - _M_extra; if (*reinterpret_cast<size_type*>(__real_p) != __n) { throw std::runtime_error("debug_allocator::deallocate" " wrong size"); } _M_allocator.deallocate(__real_p, __n + _M_extra); } else throw std::runtime_error("debug_allocator::deallocate null pointer"); } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ���������������������������������������������������������������������������c++/4.8.2/ext/iterator������������������������������������������������������������������������������0000644�����������������00000007677�14763166027�0010176 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// HP/SGI iterator extensions -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996-1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file ext/iterator * This file is a GNU extension to the Standard C++ Library (possibly * containing extensions from the HP/SGI STL subset). */ #ifndef _EXT_ITERATOR #define _EXT_ITERATOR 1 #pragma GCC system_header #include <bits/concept_check.h> #include <iterator> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // There are two signatures for distance. In addition to the one // taking two iterators and returning a result, there is another // taking two iterators and a reference-to-result variable, and // returning nothing. The latter seems to be an SGI extension. // -- pedwards template<typename _InputIterator, typename _Distance> inline void __distance(_InputIterator __first, _InputIterator __last, _Distance& __n, std::input_iterator_tag) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) while (__first != __last) { ++__first; ++__n; } } template<typename _RandomAccessIterator, typename _Distance> inline void __distance(_RandomAccessIterator __first, _RandomAccessIterator __last, _Distance& __n, std::random_access_iterator_tag) { // concept requirements __glibcxx_function_requires(_RandomAccessIteratorConcept< _RandomAccessIterator>) __n += __last - __first; } /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template<typename _InputIterator, typename _Distance> inline void distance(_InputIterator __first, _InputIterator __last, _Distance& __n) { // concept requirements -- taken care of in __distance __distance(__first, __last, __n, std::__iterator_category(__first)); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif �����������������������������������������������������������������c++/4.8.2/ext/alloc_traits.h������������������������������������������������������������������������0000644�����������������00000017751�14763166027�0011245 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Allocator traits -*- C++ -*- // Copyright (C) 2011-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/alloc_traits.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _EXT_ALLOC_TRAITS_H #define _EXT_ALLOC_TRAITS_H 1 #pragma GCC system_header #if __cplusplus >= 201103L # include <bits/move.h> # include <bits/alloc_traits.h> #else # include <bits/allocator.h> // for __alloc_swap #endif namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus >= 201103L template<typename _Alloc> struct __allocator_always_compares_equal { static const bool value = false; }; template<typename _Alloc> const bool __allocator_always_compares_equal<_Alloc>::value; template<typename _Tp> struct __allocator_always_compares_equal<std::allocator<_Tp>> { static const bool value = true; }; template<typename _Tp> const bool __allocator_always_compares_equal<std::allocator<_Tp>>::value; template<typename, typename> struct array_allocator; template<typename _Tp, typename _Array> struct __allocator_always_compares_equal<array_allocator<_Tp, _Array>> { static const bool value = true; }; template<typename _Tp, typename _Array> const bool __allocator_always_compares_equal<array_allocator<_Tp, _Array>>::value; template<typename> struct bitmap_allocator; template<typename _Tp> struct __allocator_always_compares_equal<bitmap_allocator<_Tp>> { static const bool value = true; }; template<typename _Tp> const bool __allocator_always_compares_equal<bitmap_allocator<_Tp>>::value; template<typename> struct malloc_allocator; template<typename _Tp> struct __allocator_always_compares_equal<malloc_allocator<_Tp>> { static const bool value = true; }; template<typename _Tp> const bool __allocator_always_compares_equal<malloc_allocator<_Tp>>::value; template<typename> struct mt_allocator; template<typename _Tp> struct __allocator_always_compares_equal<mt_allocator<_Tp>> { static const bool value = true; }; template<typename _Tp> const bool __allocator_always_compares_equal<mt_allocator<_Tp>>::value; template<typename> struct new_allocator; template<typename _Tp> struct __allocator_always_compares_equal<new_allocator<_Tp>> { static const bool value = true; }; template<typename _Tp> const bool __allocator_always_compares_equal<new_allocator<_Tp>>::value; template<typename> struct pool_allocator; template<typename _Tp> struct __allocator_always_compares_equal<pool_allocator<_Tp>> { static const bool value = true; }; template<typename _Tp> const bool __allocator_always_compares_equal<pool_allocator<_Tp>>::value; #endif /** * @brief Uniform interface to C++98 and C++0x allocators. * @ingroup allocators */ template<typename _Alloc> struct __alloc_traits #if __cplusplus >= 201103L : std::allocator_traits<_Alloc> #endif { typedef _Alloc allocator_type; #if __cplusplus >= 201103L typedef std::allocator_traits<_Alloc> _Base_type; typedef typename _Base_type::value_type value_type; typedef typename _Base_type::pointer pointer; typedef typename _Base_type::const_pointer const_pointer; typedef typename _Base_type::size_type size_type; typedef typename _Base_type::difference_type difference_type; // C++0x allocators do not define reference or const_reference typedef value_type& reference; typedef const value_type& const_reference; using _Base_type::allocate; using _Base_type::deallocate; using _Base_type::construct; using _Base_type::destroy; using _Base_type::max_size; private: template<typename _Ptr> struct __is_custom_pointer : std::integral_constant<bool, std::is_same<pointer, _Ptr>::value && !std::is_pointer<_Ptr>::value> { }; public: // overload construct for non-standard pointer types template<typename _Ptr, typename... _Args> static typename std::enable_if<__is_custom_pointer<_Ptr>::value>::type construct(_Alloc& __a, _Ptr __p, _Args&&... __args) { _Base_type::construct(__a, std::addressof(*__p), std::forward<_Args>(__args)...); } // overload destroy for non-standard pointer types template<typename _Ptr> static typename std::enable_if<__is_custom_pointer<_Ptr>::value>::type destroy(_Alloc& __a, _Ptr __p) { _Base_type::destroy(__a, std::addressof(*__p)); } static _Alloc _S_select_on_copy(const _Alloc& __a) { return _Base_type::select_on_container_copy_construction(__a); } static void _S_on_swap(_Alloc& __a, _Alloc& __b) { std::__alloc_on_swap(__a, __b); } static constexpr bool _S_propagate_on_copy_assign() { return _Base_type::propagate_on_container_copy_assignment::value; } static constexpr bool _S_propagate_on_move_assign() { return _Base_type::propagate_on_container_move_assignment::value; } static constexpr bool _S_propagate_on_swap() { return _Base_type::propagate_on_container_swap::value; } static constexpr bool _S_always_equal() { return __allocator_always_compares_equal<_Alloc>::value; } static constexpr bool _S_nothrow_move() { return _S_propagate_on_move_assign() || _S_always_equal(); } static constexpr bool _S_nothrow_swap() { using std::swap; return !_S_propagate_on_swap() || noexcept(swap(std::declval<_Alloc&>(), std::declval<_Alloc&>())); } template<typename _Tp> struct rebind { typedef typename _Base_type::template rebind_alloc<_Tp> other; }; #else typedef typename _Alloc::pointer pointer; typedef typename _Alloc::const_pointer const_pointer; typedef typename _Alloc::value_type value_type; typedef typename _Alloc::reference reference; typedef typename _Alloc::const_reference const_reference; typedef typename _Alloc::size_type size_type; typedef typename _Alloc::difference_type difference_type; static pointer allocate(_Alloc& __a, size_type __n) { return __a.allocate(__n); } static void deallocate(_Alloc& __a, pointer __p, size_type __n) { __a.deallocate(__p, __n); } template<typename _Tp> static void construct(_Alloc& __a, pointer __p, const _Tp& __arg) { __a.construct(__p, __arg); } static void destroy(_Alloc& __a, pointer __p) { __a.destroy(__p); } static size_type max_size(const _Alloc& __a) { return __a.max_size(); } static const _Alloc& _S_select_on_copy(const _Alloc& __a) { return __a; } static void _S_on_swap(_Alloc& __a, _Alloc& __b) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 431. Swapping containers with unequal allocators. std::__alloc_swap<_Alloc>::_S_do_it(__a, __b); } template<typename _Tp> struct rebind { typedef typename _Alloc::template rebind<_Tp>::other other; }; #endif }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif �����������������������c++/4.8.2/ext/hash_set������������������������������������������������������������������������������0000644�����������������00000041453�14763166027�0010131 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Hashing set implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * Copyright (c) 1996 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * */ /** @file backward/hash_set * This file is a GNU extension to the Standard C++ Library (possibly * containing extensions from the HP/SGI STL subset). */ #ifndef _BACKWARD_HASH_SET #define _BACKWARD_HASH_SET 1 #ifndef _GLIBCXX_PERMIT_BACKWARD_HASH #include "backward_warning.h" #endif #include <bits/c++config.h> #include <backward/hashtable.h> #include <bits/concept_check.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using std::equal_to; using std::allocator; using std::pair; using std::_Identity; /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template<class _Value, class _HashFcn = hash<_Value>, class _EqualKey = equal_to<_Value>, class _Alloc = allocator<_Value> > class hash_set { // concept requirements __glibcxx_class_requires(_Value, _SGIAssignableConcept) __glibcxx_class_requires3(_HashFcn, size_t, _Value, _UnaryFunctionConcept) __glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept) private: typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, _EqualKey, _Alloc> _Ht; _Ht _M_ht; public: typedef typename _Ht::key_type key_type; typedef typename _Ht::value_type value_type; typedef typename _Ht::hasher hasher; typedef typename _Ht::key_equal key_equal; typedef typename _Ht::size_type size_type; typedef typename _Ht::difference_type difference_type; typedef typename _Alloc::pointer pointer; typedef typename _Alloc::const_pointer const_pointer; typedef typename _Alloc::reference reference; typedef typename _Alloc::const_reference const_reference; typedef typename _Ht::const_iterator iterator; typedef typename _Ht::const_iterator const_iterator; typedef typename _Ht::allocator_type allocator_type; hasher hash_funct() const { return _M_ht.hash_funct(); } key_equal key_eq() const { return _M_ht.key_eq(); } allocator_type get_allocator() const { return _M_ht.get_allocator(); } hash_set() : _M_ht(100, hasher(), key_equal(), allocator_type()) {} explicit hash_set(size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} hash_set(size_type __n, const hasher& __hf) : _M_ht(__n, __hf, key_equal(), allocator_type()) {} hash_set(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) {} template<class _InputIterator> hash_set(_InputIterator __f, _InputIterator __l) : _M_ht(100, hasher(), key_equal(), allocator_type()) { _M_ht.insert_unique(__f, __l); } template<class _InputIterator> hash_set(_InputIterator __f, _InputIterator __l, size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type()) { _M_ht.insert_unique(__f, __l); } template<class _InputIterator> hash_set(_InputIterator __f, _InputIterator __l, size_type __n, const hasher& __hf) : _M_ht(__n, __hf, key_equal(), allocator_type()) { _M_ht.insert_unique(__f, __l); } template<class _InputIterator> hash_set(_InputIterator __f, _InputIterator __l, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) { _M_ht.insert_unique(__f, __l); } size_type size() const { return _M_ht.size(); } size_type max_size() const { return _M_ht.max_size(); } bool empty() const { return _M_ht.empty(); } void swap(hash_set& __hs) { _M_ht.swap(__hs._M_ht); } template<class _Val, class _HF, class _EqK, class _Al> friend bool operator==(const hash_set<_Val, _HF, _EqK, _Al>&, const hash_set<_Val, _HF, _EqK, _Al>&); iterator begin() const { return _M_ht.begin(); } iterator end() const { return _M_ht.end(); } pair<iterator, bool> insert(const value_type& __obj) { pair<typename _Ht::iterator, bool> __p = _M_ht.insert_unique(__obj); return pair<iterator,bool>(__p.first, __p.second); } template<class _InputIterator> void insert(_InputIterator __f, _InputIterator __l) { _M_ht.insert_unique(__f, __l); } pair<iterator, bool> insert_noresize(const value_type& __obj) { pair<typename _Ht::iterator, bool> __p = _M_ht.insert_unique_noresize(__obj); return pair<iterator, bool>(__p.first, __p.second); } iterator find(const key_type& __key) const { return _M_ht.find(__key); } size_type count(const key_type& __key) const { return _M_ht.count(__key); } pair<iterator, iterator> equal_range(const key_type& __key) const { return _M_ht.equal_range(__key); } size_type erase(const key_type& __key) {return _M_ht.erase(__key); } void erase(iterator __it) { _M_ht.erase(__it); } void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } void clear() { _M_ht.clear(); } void resize(size_type __hint) { _M_ht.resize(__hint); } size_type bucket_count() const { return _M_ht.bucket_count(); } size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } size_type elems_in_bucket(size_type __n) const { return _M_ht.elems_in_bucket(__n); } }; template<class _Value, class _HashFcn, class _EqualKey, class _Alloc> inline bool operator==(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1, const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2) { return __hs1._M_ht == __hs2._M_ht; } template<class _Value, class _HashFcn, class _EqualKey, class _Alloc> inline bool operator!=(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1, const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2) { return !(__hs1 == __hs2); } template<class _Val, class _HashFcn, class _EqualKey, class _Alloc> inline void swap(hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1, hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2) { __hs1.swap(__hs2); } /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template<class _Value, class _HashFcn = hash<_Value>, class _EqualKey = equal_to<_Value>, class _Alloc = allocator<_Value> > class hash_multiset { // concept requirements __glibcxx_class_requires(_Value, _SGIAssignableConcept) __glibcxx_class_requires3(_HashFcn, size_t, _Value, _UnaryFunctionConcept) __glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept) private: typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, _EqualKey, _Alloc> _Ht; _Ht _M_ht; public: typedef typename _Ht::key_type key_type; typedef typename _Ht::value_type value_type; typedef typename _Ht::hasher hasher; typedef typename _Ht::key_equal key_equal; typedef typename _Ht::size_type size_type; typedef typename _Ht::difference_type difference_type; typedef typename _Alloc::pointer pointer; typedef typename _Alloc::const_pointer const_pointer; typedef typename _Alloc::reference reference; typedef typename _Alloc::const_reference const_reference; typedef typename _Ht::const_iterator iterator; typedef typename _Ht::const_iterator const_iterator; typedef typename _Ht::allocator_type allocator_type; hasher hash_funct() const { return _M_ht.hash_funct(); } key_equal key_eq() const { return _M_ht.key_eq(); } allocator_type get_allocator() const { return _M_ht.get_allocator(); } hash_multiset() : _M_ht(100, hasher(), key_equal(), allocator_type()) {} explicit hash_multiset(size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} hash_multiset(size_type __n, const hasher& __hf) : _M_ht(__n, __hf, key_equal(), allocator_type()) {} hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) {} template<class _InputIterator> hash_multiset(_InputIterator __f, _InputIterator __l) : _M_ht(100, hasher(), key_equal(), allocator_type()) { _M_ht.insert_equal(__f, __l); } template<class _InputIterator> hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type()) { _M_ht.insert_equal(__f, __l); } template<class _InputIterator> hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, const hasher& __hf) : _M_ht(__n, __hf, key_equal(), allocator_type()) { _M_ht.insert_equal(__f, __l); } template<class _InputIterator> hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) { _M_ht.insert_equal(__f, __l); } size_type size() const { return _M_ht.size(); } size_type max_size() const { return _M_ht.max_size(); } bool empty() const { return _M_ht.empty(); } void swap(hash_multiset& hs) { _M_ht.swap(hs._M_ht); } template<class _Val, class _HF, class _EqK, class _Al> friend bool operator==(const hash_multiset<_Val, _HF, _EqK, _Al>&, const hash_multiset<_Val, _HF, _EqK, _Al>&); iterator begin() const { return _M_ht.begin(); } iterator end() const { return _M_ht.end(); } iterator insert(const value_type& __obj) { return _M_ht.insert_equal(__obj); } template<class _InputIterator> void insert(_InputIterator __f, _InputIterator __l) { _M_ht.insert_equal(__f,__l); } iterator insert_noresize(const value_type& __obj) { return _M_ht.insert_equal_noresize(__obj); } iterator find(const key_type& __key) const { return _M_ht.find(__key); } size_type count(const key_type& __key) const { return _M_ht.count(__key); } pair<iterator, iterator> equal_range(const key_type& __key) const { return _M_ht.equal_range(__key); } size_type erase(const key_type& __key) { return _M_ht.erase(__key); } void erase(iterator __it) { _M_ht.erase(__it); } void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } void clear() { _M_ht.clear(); } void resize(size_type __hint) { _M_ht.resize(__hint); } size_type bucket_count() const { return _M_ht.bucket_count(); } size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } size_type elems_in_bucket(size_type __n) const { return _M_ht.elems_in_bucket(__n); } }; template<class _Val, class _HashFcn, class _EqualKey, class _Alloc> inline bool operator==(const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1, const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2) { return __hs1._M_ht == __hs2._M_ht; } template<class _Val, class _HashFcn, class _EqualKey, class _Alloc> inline bool operator!=(const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1, const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2) { return !(__hs1 == __hs2); } template<class _Val, class _HashFcn, class _EqualKey, class _Alloc> inline void swap(hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1, hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2) { __hs1.swap(__hs2); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Specialization of insert_iterator so that it will work for hash_set // and hash_multiset. template<class _Value, class _HashFcn, class _EqualKey, class _Alloc> class insert_iterator<__gnu_cxx::hash_set<_Value, _HashFcn, _EqualKey, _Alloc> > { protected: typedef __gnu_cxx::hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Container; _Container* container; public: typedef _Container container_type; typedef output_iterator_tag iterator_category; typedef void value_type; typedef void difference_type; typedef void pointer; typedef void reference; insert_iterator(_Container& __x) : container(&__x) {} insert_iterator(_Container& __x, typename _Container::iterator) : container(&__x) {} insert_iterator<_Container>& operator=(const typename _Container::value_type& __value) { container->insert(__value); return *this; } insert_iterator<_Container>& operator*() { return *this; } insert_iterator<_Container>& operator++() { return *this; } insert_iterator<_Container>& operator++(int) { return *this; } }; template<class _Value, class _HashFcn, class _EqualKey, class _Alloc> class insert_iterator<__gnu_cxx::hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > { protected: typedef __gnu_cxx::hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Container; _Container* container; typename _Container::iterator iter; public: typedef _Container container_type; typedef output_iterator_tag iterator_category; typedef void value_type; typedef void difference_type; typedef void pointer; typedef void reference; insert_iterator(_Container& __x) : container(&__x) {} insert_iterator(_Container& __x, typename _Container::iterator) : container(&__x) {} insert_iterator<_Container>& operator=(const typename _Container::value_type& __value) { container->insert(__value); return *this; } insert_iterator<_Container>& operator*() { return *this; } insert_iterator<_Container>& operator++() { return *this; } insert_iterator<_Container>& operator++(int) { return *this; } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/vstring_fwd.h�������������������������������������������������������������������������0000644�����������������00000006226�14763166027�0011114 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <vstring.h> Forward declarations -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/vstring_fwd.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ext/vstring.h} */ #ifndef _VSTRING_FWD_H #define _VSTRING_FWD_H 1 #pragma GCC system_header #include <bits/c++config.h> #include <bits/char_traits.h> #include <bits/allocator.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _CharT, typename _Traits, typename _Alloc> class __sso_string_base; template<typename _CharT, typename _Traits, typename _Alloc> class __rc_string_base; template<typename _CharT, typename _Traits = std::char_traits<_CharT>, typename _Alloc = std::allocator<_CharT>, template <typename, typename, typename> class _Base = __sso_string_base> class __versa_string; typedef __versa_string<char> __vstring; typedef __vstring __sso_string; typedef __versa_string<char, std::char_traits<char>, std::allocator<char>, __rc_string_base> __rc_string; #ifdef _GLIBCXX_USE_WCHAR_T typedef __versa_string<wchar_t> __wvstring; typedef __wvstring __wsso_string; typedef __versa_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t>, __rc_string_base> __wrc_string; #endif #if ((__cplusplus >= 201103L) \ && defined(_GLIBCXX_USE_C99_STDINT_TR1)) typedef __versa_string<char16_t> __u16vstring; typedef __u16vstring __u16sso_string; typedef __versa_string<char16_t, std::char_traits<char16_t>, std::allocator<char16_t>, __rc_string_base> __u16rc_string; typedef __versa_string<char32_t> __u32vstring; typedef __u32vstring __u32sso_string; typedef __versa_string<char32_t, std::char_traits<char32_t>, std::allocator<char32_t>, __rc_string_base> __u32rc_string; #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _VSTRING_FWD_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/hash_map������������������������������������������������������������������������������0000644�����������������00000042557�14763166027�0010121 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Hashing map implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * Copyright (c) 1996 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * */ /** @file backward/hash_map * This file is a GNU extension to the Standard C++ Library (possibly * containing extensions from the HP/SGI STL subset). */ #ifndef _BACKWARD_HASH_MAP #define _BACKWARD_HASH_MAP 1 #ifndef _GLIBCXX_PERMIT_BACKWARD_HASH #include "backward_warning.h" #endif #include <bits/c++config.h> #include <backward/hashtable.h> #include <bits/concept_check.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using std::equal_to; using std::allocator; using std::pair; using std::_Select1st; /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template<class _Key, class _Tp, class _HashFn = hash<_Key>, class _EqualKey = equal_to<_Key>, class _Alloc = allocator<_Tp> > class hash_map { private: typedef hashtable<pair<const _Key, _Tp>,_Key, _HashFn, _Select1st<pair<const _Key, _Tp> >, _EqualKey, _Alloc> _Ht; _Ht _M_ht; public: typedef typename _Ht::key_type key_type; typedef _Tp data_type; typedef _Tp mapped_type; typedef typename _Ht::value_type value_type; typedef typename _Ht::hasher hasher; typedef typename _Ht::key_equal key_equal; typedef typename _Ht::size_type size_type; typedef typename _Ht::difference_type difference_type; typedef typename _Ht::pointer pointer; typedef typename _Ht::const_pointer const_pointer; typedef typename _Ht::reference reference; typedef typename _Ht::const_reference const_reference; typedef typename _Ht::iterator iterator; typedef typename _Ht::const_iterator const_iterator; typedef typename _Ht::allocator_type allocator_type; hasher hash_funct() const { return _M_ht.hash_funct(); } key_equal key_eq() const { return _M_ht.key_eq(); } allocator_type get_allocator() const { return _M_ht.get_allocator(); } hash_map() : _M_ht(100, hasher(), key_equal(), allocator_type()) {} explicit hash_map(size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} hash_map(size_type __n, const hasher& __hf) : _M_ht(__n, __hf, key_equal(), allocator_type()) {} hash_map(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) {} template<class _InputIterator> hash_map(_InputIterator __f, _InputIterator __l) : _M_ht(100, hasher(), key_equal(), allocator_type()) { _M_ht.insert_unique(__f, __l); } template<class _InputIterator> hash_map(_InputIterator __f, _InputIterator __l, size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type()) { _M_ht.insert_unique(__f, __l); } template<class _InputIterator> hash_map(_InputIterator __f, _InputIterator __l, size_type __n, const hasher& __hf) : _M_ht(__n, __hf, key_equal(), allocator_type()) { _M_ht.insert_unique(__f, __l); } template<class _InputIterator> hash_map(_InputIterator __f, _InputIterator __l, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) { _M_ht.insert_unique(__f, __l); } size_type size() const { return _M_ht.size(); } size_type max_size() const { return _M_ht.max_size(); } bool empty() const { return _M_ht.empty(); } void swap(hash_map& __hs) { _M_ht.swap(__hs._M_ht); } template<class _K1, class _T1, class _HF, class _EqK, class _Al> friend bool operator== (const hash_map<_K1, _T1, _HF, _EqK, _Al>&, const hash_map<_K1, _T1, _HF, _EqK, _Al>&); iterator begin() { return _M_ht.begin(); } iterator end() { return _M_ht.end(); } const_iterator begin() const { return _M_ht.begin(); } const_iterator end() const { return _M_ht.end(); } pair<iterator, bool> insert(const value_type& __obj) { return _M_ht.insert_unique(__obj); } template<class _InputIterator> void insert(_InputIterator __f, _InputIterator __l) { _M_ht.insert_unique(__f, __l); } pair<iterator, bool> insert_noresize(const value_type& __obj) { return _M_ht.insert_unique_noresize(__obj); } iterator find(const key_type& __key) { return _M_ht.find(__key); } const_iterator find(const key_type& __key) const { return _M_ht.find(__key); } _Tp& operator[](const key_type& __key) { return _M_ht.find_or_insert(value_type(__key, _Tp())).second; } size_type count(const key_type& __key) const { return _M_ht.count(__key); } pair<iterator, iterator> equal_range(const key_type& __key) { return _M_ht.equal_range(__key); } pair<const_iterator, const_iterator> equal_range(const key_type& __key) const { return _M_ht.equal_range(__key); } size_type erase(const key_type& __key) {return _M_ht.erase(__key); } void erase(iterator __it) { _M_ht.erase(__it); } void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } void clear() { _M_ht.clear(); } void resize(size_type __hint) { _M_ht.resize(__hint); } size_type bucket_count() const { return _M_ht.bucket_count(); } size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } size_type elems_in_bucket(size_type __n) const { return _M_ht.elems_in_bucket(__n); } }; template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc> inline bool operator==(const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1, const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2) { return __hm1._M_ht == __hm2._M_ht; } template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc> inline bool operator!=(const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1, const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2) { return !(__hm1 == __hm2); } template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc> inline void swap(hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1, hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2) { __hm1.swap(__hm2); } /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template<class _Key, class _Tp, class _HashFn = hash<_Key>, class _EqualKey = equal_to<_Key>, class _Alloc = allocator<_Tp> > class hash_multimap { // concept requirements __glibcxx_class_requires(_Key, _SGIAssignableConcept) __glibcxx_class_requires(_Tp, _SGIAssignableConcept) __glibcxx_class_requires3(_HashFn, size_t, _Key, _UnaryFunctionConcept) __glibcxx_class_requires3(_EqualKey, _Key, _Key, _BinaryPredicateConcept) private: typedef hashtable<pair<const _Key, _Tp>, _Key, _HashFn, _Select1st<pair<const _Key, _Tp> >, _EqualKey, _Alloc> _Ht; _Ht _M_ht; public: typedef typename _Ht::key_type key_type; typedef _Tp data_type; typedef _Tp mapped_type; typedef typename _Ht::value_type value_type; typedef typename _Ht::hasher hasher; typedef typename _Ht::key_equal key_equal; typedef typename _Ht::size_type size_type; typedef typename _Ht::difference_type difference_type; typedef typename _Ht::pointer pointer; typedef typename _Ht::const_pointer const_pointer; typedef typename _Ht::reference reference; typedef typename _Ht::const_reference const_reference; typedef typename _Ht::iterator iterator; typedef typename _Ht::const_iterator const_iterator; typedef typename _Ht::allocator_type allocator_type; hasher hash_funct() const { return _M_ht.hash_funct(); } key_equal key_eq() const { return _M_ht.key_eq(); } allocator_type get_allocator() const { return _M_ht.get_allocator(); } hash_multimap() : _M_ht(100, hasher(), key_equal(), allocator_type()) {} explicit hash_multimap(size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} hash_multimap(size_type __n, const hasher& __hf) : _M_ht(__n, __hf, key_equal(), allocator_type()) {} hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) {} template<class _InputIterator> hash_multimap(_InputIterator __f, _InputIterator __l) : _M_ht(100, hasher(), key_equal(), allocator_type()) { _M_ht.insert_equal(__f, __l); } template<class _InputIterator> hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type()) { _M_ht.insert_equal(__f, __l); } template<class _InputIterator> hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, const hasher& __hf) : _M_ht(__n, __hf, key_equal(), allocator_type()) { _M_ht.insert_equal(__f, __l); } template<class _InputIterator> hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) { _M_ht.insert_equal(__f, __l); } size_type size() const { return _M_ht.size(); } size_type max_size() const { return _M_ht.max_size(); } bool empty() const { return _M_ht.empty(); } void swap(hash_multimap& __hs) { _M_ht.swap(__hs._M_ht); } template<class _K1, class _T1, class _HF, class _EqK, class _Al> friend bool operator==(const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&, const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&); iterator begin() { return _M_ht.begin(); } iterator end() { return _M_ht.end(); } const_iterator begin() const { return _M_ht.begin(); } const_iterator end() const { return _M_ht.end(); } iterator insert(const value_type& __obj) { return _M_ht.insert_equal(__obj); } template<class _InputIterator> void insert(_InputIterator __f, _InputIterator __l) { _M_ht.insert_equal(__f,__l); } iterator insert_noresize(const value_type& __obj) { return _M_ht.insert_equal_noresize(__obj); } iterator find(const key_type& __key) { return _M_ht.find(__key); } const_iterator find(const key_type& __key) const { return _M_ht.find(__key); } size_type count(const key_type& __key) const { return _M_ht.count(__key); } pair<iterator, iterator> equal_range(const key_type& __key) { return _M_ht.equal_range(__key); } pair<const_iterator, const_iterator> equal_range(const key_type& __key) const { return _M_ht.equal_range(__key); } size_type erase(const key_type& __key) { return _M_ht.erase(__key); } void erase(iterator __it) { _M_ht.erase(__it); } void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } void clear() { _M_ht.clear(); } void resize(size_type __hint) { _M_ht.resize(__hint); } size_type bucket_count() const { return _M_ht.bucket_count(); } size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } size_type elems_in_bucket(size_type __n) const { return _M_ht.elems_in_bucket(__n); } }; template<class _Key, class _Tp, class _HF, class _EqKey, class _Alloc> inline bool operator==(const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1, const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2) { return __hm1._M_ht == __hm2._M_ht; } template<class _Key, class _Tp, class _HF, class _EqKey, class _Alloc> inline bool operator!=(const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1, const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2) { return !(__hm1 == __hm2); } template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc> inline void swap(hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1, hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2) { __hm1.swap(__hm2); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Specialization of insert_iterator so that it will work for hash_map // and hash_multimap. template<class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc> class insert_iterator<__gnu_cxx::hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > { protected: typedef __gnu_cxx::hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container; _Container* container; public: typedef _Container container_type; typedef output_iterator_tag iterator_category; typedef void value_type; typedef void difference_type; typedef void pointer; typedef void reference; insert_iterator(_Container& __x) : container(&__x) {} insert_iterator(_Container& __x, typename _Container::iterator) : container(&__x) {} insert_iterator<_Container>& operator=(const typename _Container::value_type& __value) { container->insert(__value); return *this; } insert_iterator<_Container>& operator*() { return *this; } insert_iterator<_Container>& operator++() { return *this; } insert_iterator<_Container>& operator++(int) { return *this; } }; template<class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc> class insert_iterator<__gnu_cxx::hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > { protected: typedef __gnu_cxx::hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container; _Container* container; typename _Container::iterator iter; public: typedef _Container container_type; typedef output_iterator_tag iterator_category; typedef void value_type; typedef void difference_type; typedef void pointer; typedef void reference; insert_iterator(_Container& __x) : container(&__x) {} insert_iterator(_Container& __x, typename _Container::iterator) : container(&__x) {} insert_iterator<_Container>& operator=(const typename _Container::value_type& __value) { container->insert(__value); return *this; } insert_iterator<_Container>& operator*() { return *this; } insert_iterator<_Container>& operator++() { return *this; } insert_iterator<_Container>& operator++(int) { return *this; } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif �������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/memory��������������������������������������������������������������������������������0000644�����������������00000015764�14763166027�0007651 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Memory extensions -*- C++ -*- // Copyright (C) 2002-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file ext/memory * This file is a GNU extension to the Standard C++ Library (possibly * containing extensions from the HP/SGI STL subset). */ #ifndef _EXT_MEMORY #define _EXT_MEMORY 1 #pragma GCC system_header #include <memory> #include <bits/stl_tempbuf.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using std::ptrdiff_t; using std::pair; using std::__iterator_category; using std::_Temporary_buffer; template<typename _InputIter, typename _Size, typename _ForwardIter> pair<_InputIter, _ForwardIter> __uninitialized_copy_n(_InputIter __first, _Size __count, _ForwardIter __result, std::input_iterator_tag) { _ForwardIter __cur = __result; __try { for (; __count > 0 ; --__count, ++__first, ++__cur) std::_Construct(&*__cur, *__first); return pair<_InputIter, _ForwardIter>(__first, __cur); } __catch(...) { std::_Destroy(__result, __cur); __throw_exception_again; } } template<typename _RandomAccessIter, typename _Size, typename _ForwardIter> inline pair<_RandomAccessIter, _ForwardIter> __uninitialized_copy_n(_RandomAccessIter __first, _Size __count, _ForwardIter __result, std::random_access_iterator_tag) { _RandomAccessIter __last = __first + __count; return (pair<_RandomAccessIter, _ForwardIter> (__last, std::uninitialized_copy(__first, __last, __result))); } template<typename _InputIter, typename _Size, typename _ForwardIter> inline pair<_InputIter, _ForwardIter> __uninitialized_copy_n(_InputIter __first, _Size __count, _ForwardIter __result) { return __gnu_cxx::__uninitialized_copy_n(__first, __count, __result, __iterator_category(__first)); } /** * @brief Copies the range [first,last) into result. * @param __first An input iterator. * @param __count Length * @param __result An output iterator. * @return __result + (__first + __count) * @ingroup SGIextensions * * Like copy(), but does not require an initialized output range. */ template<typename _InputIter, typename _Size, typename _ForwardIter> inline pair<_InputIter, _ForwardIter> uninitialized_copy_n(_InputIter __first, _Size __count, _ForwardIter __result) { return __gnu_cxx::__uninitialized_copy_n(__first, __count, __result, __iterator_category(__first)); } // An alternative version of uninitialized_copy_n that constructs // and destroys objects with a user-provided allocator. template<typename _InputIter, typename _Size, typename _ForwardIter, typename _Allocator> pair<_InputIter, _ForwardIter> __uninitialized_copy_n_a(_InputIter __first, _Size __count, _ForwardIter __result, _Allocator __alloc) { _ForwardIter __cur = __result; __try { for (; __count > 0 ; --__count, ++__first, ++__cur) __alloc.construct(&*__cur, *__first); return pair<_InputIter, _ForwardIter>(__first, __cur); } __catch(...) { std::_Destroy(__result, __cur, __alloc); __throw_exception_again; } } template<typename _InputIter, typename _Size, typename _ForwardIter, typename _Tp> inline pair<_InputIter, _ForwardIter> __uninitialized_copy_n_a(_InputIter __first, _Size __count, _ForwardIter __result, std::allocator<_Tp>) { return __gnu_cxx::uninitialized_copy_n(__first, __count, __result); } /** * This class provides similar behavior and semantics of the standard * functions get_temporary_buffer() and return_temporary_buffer(), but * encapsulated in a type vaguely resembling a standard container. * * By default, a temporary_buffer<Iter> stores space for objects of * whatever type the Iter iterator points to. It is constructed from a * typical [first,last) range, and provides the begin(), end(), size() * functions, as well as requested_size(). For non-trivial types, copies * of *first will be used to initialize the storage. * * @c malloc is used to obtain underlying storage. * * Like get_temporary_buffer(), not all the requested memory may be * available. Ideally, the created buffer will be large enough to hold a * copy of [first,last), but if size() is less than requested_size(), * then this didn't happen. * * @ingroup SGIextensions */ template <class _ForwardIterator, class _Tp = typename std::iterator_traits<_ForwardIterator>::value_type > struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp> { /// Requests storage large enough to hold a copy of [first,last). temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) : _Temporary_buffer<_ForwardIterator, _Tp>(__first, __last) { } /// Destroys objects and frees storage. ~temporary_buffer() { } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ������������c++/4.8.2/ext/rope����������������������������������������������������������������������������������0000644�����������������00000253132�14763166027�0007277 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// SGI's rope class -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * Copyright (c) 1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file ext/rope * This file is a GNU extension to the Standard C++ Library (possibly * containing extensions from the HP/SGI STL subset). */ #ifndef _ROPE #define _ROPE 1 #pragma GCC system_header #include <algorithm> #include <iosfwd> #include <bits/stl_construct.h> #include <bits/stl_uninitialized.h> #include <bits/stl_function.h> #include <bits/stl_numeric.h> #include <bits/allocator.h> #include <bits/gthr.h> #include <tr1/functional> # ifdef __GC # define __GC_CONST const # else # define __GC_CONST // constant except for deallocation # endif #include <ext/memory> // For uninitialized_copy_n namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { namespace __detail { enum { _S_max_rope_depth = 45 }; enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function}; } // namespace __detail using std::size_t; using std::ptrdiff_t; using std::allocator; using std::_Destroy; _GLIBCXX_BEGIN_NAMESPACE_VERSION // See libstdc++/36832. template<typename _ForwardIterator, typename _Allocator> void _Destroy_const(_ForwardIterator __first, _ForwardIterator __last, _Allocator __alloc) { for (; __first != __last; ++__first) __alloc.destroy(&*__first); } template<typename _ForwardIterator, typename _Tp> inline void _Destroy_const(_ForwardIterator __first, _ForwardIterator __last, allocator<_Tp>) { _Destroy(__first, __last); } // The _S_eos function is used for those functions that // convert to/from C-like strings to detect the end of the string. // The end-of-C-string character. // This is what the draft standard says it should be. template <class _CharT> inline _CharT _S_eos(_CharT*) { return _CharT(); } // Test for basic character types. // For basic character types leaves having a trailing eos. template <class _CharT> inline bool _S_is_basic_char_type(_CharT*) { return false; } template <class _CharT> inline bool _S_is_one_byte_char_type(_CharT*) { return false; } inline bool _S_is_basic_char_type(char*) { return true; } inline bool _S_is_one_byte_char_type(char*) { return true; } inline bool _S_is_basic_char_type(wchar_t*) { return true; } // Store an eos iff _CharT is a basic character type. // Do not reference _S_eos if it isn't. template <class _CharT> inline void _S_cond_store_eos(_CharT&) { } inline void _S_cond_store_eos(char& __c) { __c = 0; } inline void _S_cond_store_eos(wchar_t& __c) { __c = 0; } // char_producers are logically functions that generate a section of // a string. These can be converted to ropes. The resulting rope // invokes the char_producer on demand. This allows, for example, // files to be viewed as ropes without reading the entire file. template <class _CharT> class char_producer { public: virtual ~char_producer() { }; virtual void operator()(size_t __start_pos, size_t __len, _CharT* __buffer) = 0; // Buffer should really be an arbitrary output iterator. // That way we could flatten directly into an ostream, etc. // This is thoroughly impossible, since iterator types don't // have runtime descriptions. }; // Sequence buffers: // // Sequence must provide an append operation that appends an // array to the sequence. Sequence buffers are useful only if // appending an entire array is cheaper than appending element by element. // This is true for many string representations. // This should perhaps inherit from ostream<sequence::value_type> // and be implemented correspondingly, so that they can be used // for formatted. For the sake of portability, we don't do this yet. // // For now, sequence buffers behave as output iterators. But they also // behave a little like basic_ostringstream<sequence::value_type> and a // little like containers. template<class _Sequence, size_t _Buf_sz = 100> class sequence_buffer : public std::iterator<std::output_iterator_tag, void, void, void, void> { public: typedef typename _Sequence::value_type value_type; protected: _Sequence* _M_prefix; value_type _M_buffer[_Buf_sz]; size_t _M_buf_count; public: void flush() { _M_prefix->append(_M_buffer, _M_buffer + _M_buf_count); _M_buf_count = 0; } ~sequence_buffer() { flush(); } sequence_buffer() : _M_prefix(0), _M_buf_count(0) { } sequence_buffer(const sequence_buffer& __x) { _M_prefix = __x._M_prefix; _M_buf_count = __x._M_buf_count; std::copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer); } sequence_buffer(sequence_buffer& __x) { __x.flush(); _M_prefix = __x._M_prefix; _M_buf_count = 0; } sequence_buffer(_Sequence& __s) : _M_prefix(&__s), _M_buf_count(0) { } sequence_buffer& operator=(sequence_buffer& __x) { __x.flush(); _M_prefix = __x._M_prefix; _M_buf_count = 0; return *this; } sequence_buffer& operator=(const sequence_buffer& __x) { _M_prefix = __x._M_prefix; _M_buf_count = __x._M_buf_count; std::copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer); return *this; } void push_back(value_type __x) { if (_M_buf_count < _Buf_sz) { _M_buffer[_M_buf_count] = __x; ++_M_buf_count; } else { flush(); _M_buffer[0] = __x; _M_buf_count = 1; } } void append(value_type* __s, size_t __len) { if (__len + _M_buf_count <= _Buf_sz) { size_t __i = _M_buf_count; for (size_t __j = 0; __j < __len; __i++, __j++) _M_buffer[__i] = __s[__j]; _M_buf_count += __len; } else if (0 == _M_buf_count) _M_prefix->append(__s, __s + __len); else { flush(); append(__s, __len); } } sequence_buffer& write(value_type* __s, size_t __len) { append(__s, __len); return *this; } sequence_buffer& put(value_type __x) { push_back(__x); return *this; } sequence_buffer& operator=(const value_type& __rhs) { push_back(__rhs); return *this; } sequence_buffer& operator*() { return *this; } sequence_buffer& operator++() { return *this; } sequence_buffer operator++(int) { return *this; } }; // The following should be treated as private, at least for now. template<class _CharT> class _Rope_char_consumer { public: // If we had member templates, these should not be virtual. // For now we need to use run-time parametrization where // compile-time would do. Hence this should all be private // for now. // The symmetry with char_producer is accidental and temporary. virtual ~_Rope_char_consumer() { }; virtual bool operator()(const _CharT* __buffer, size_t __len) = 0; }; // First a lot of forward declarations. The standard seems to require // much stricter "declaration before use" than many of the implementations // that preceded it. template<class _CharT, class _Alloc = allocator<_CharT> > class rope; template<class _CharT, class _Alloc> struct _Rope_RopeConcatenation; template<class _CharT, class _Alloc> struct _Rope_RopeLeaf; template<class _CharT, class _Alloc> struct _Rope_RopeFunction; template<class _CharT, class _Alloc> struct _Rope_RopeSubstring; template<class _CharT, class _Alloc> class _Rope_iterator; template<class _CharT, class _Alloc> class _Rope_const_iterator; template<class _CharT, class _Alloc> class _Rope_char_ref_proxy; template<class _CharT, class _Alloc> class _Rope_char_ptr_proxy; template<class _CharT, class _Alloc> bool operator==(const _Rope_char_ptr_proxy<_CharT, _Alloc>& __x, const _Rope_char_ptr_proxy<_CharT, _Alloc>& __y); template<class _CharT, class _Alloc> _Rope_const_iterator<_CharT, _Alloc> operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n); template<class _CharT, class _Alloc> _Rope_const_iterator<_CharT, _Alloc> operator+(const _Rope_const_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n); template<class _CharT, class _Alloc> _Rope_const_iterator<_CharT, _Alloc> operator+(ptrdiff_t __n, const _Rope_const_iterator<_CharT, _Alloc>& __x); template<class _CharT, class _Alloc> bool operator==(const _Rope_const_iterator<_CharT, _Alloc>& __x, const _Rope_const_iterator<_CharT, _Alloc>& __y); template<class _CharT, class _Alloc> bool operator<(const _Rope_const_iterator<_CharT, _Alloc>& __x, const _Rope_const_iterator<_CharT, _Alloc>& __y); template<class _CharT, class _Alloc> ptrdiff_t operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x, const _Rope_const_iterator<_CharT, _Alloc>& __y); template<class _CharT, class _Alloc> _Rope_iterator<_CharT, _Alloc> operator-(const _Rope_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n); template<class _CharT, class _Alloc> _Rope_iterator<_CharT, _Alloc> operator+(const _Rope_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n); template<class _CharT, class _Alloc> _Rope_iterator<_CharT, _Alloc> operator+(ptrdiff_t __n, const _Rope_iterator<_CharT, _Alloc>& __x); template<class _CharT, class _Alloc> bool operator==(const _Rope_iterator<_CharT, _Alloc>& __x, const _Rope_iterator<_CharT, _Alloc>& __y); template<class _CharT, class _Alloc> bool operator<(const _Rope_iterator<_CharT, _Alloc>& __x, const _Rope_iterator<_CharT, _Alloc>& __y); template<class _CharT, class _Alloc> ptrdiff_t operator-(const _Rope_iterator<_CharT, _Alloc>& __x, const _Rope_iterator<_CharT, _Alloc>& __y); template<class _CharT, class _Alloc> rope<_CharT, _Alloc> operator+(const rope<_CharT, _Alloc>& __left, const rope<_CharT, _Alloc>& __right); template<class _CharT, class _Alloc> rope<_CharT, _Alloc> operator+(const rope<_CharT, _Alloc>& __left, const _CharT* __right); template<class _CharT, class _Alloc> rope<_CharT, _Alloc> operator+(const rope<_CharT, _Alloc>& __left, _CharT __right); // Some helpers, so we can use power on ropes. // See below for why this isn't local to the implementation. // This uses a nonstandard refcount convention. // The result has refcount 0. template<class _CharT, class _Alloc> struct _Rope_Concat_fn : public std::binary_function<rope<_CharT, _Alloc>, rope<_CharT, _Alloc>, rope<_CharT, _Alloc> > { rope<_CharT, _Alloc> operator()(const rope<_CharT, _Alloc>& __x, const rope<_CharT, _Alloc>& __y) { return __x + __y; } }; template <class _CharT, class _Alloc> inline rope<_CharT, _Alloc> identity_element(_Rope_Concat_fn<_CharT, _Alloc>) { return rope<_CharT, _Alloc>(); } // Class _Refcount_Base provides a type, _RC_t, a data member, // _M_ref_count, and member functions _M_incr and _M_decr, which perform // atomic preincrement/predecrement. The constructor initializes // _M_ref_count. struct _Refcount_Base { // The type _RC_t typedef size_t _RC_t; // The data member _M_ref_count volatile _RC_t _M_ref_count; // Constructor #ifdef __GTHREAD_MUTEX_INIT __gthread_mutex_t _M_ref_count_lock = __GTHREAD_MUTEX_INIT; #else __gthread_mutex_t _M_ref_count_lock; #endif _Refcount_Base(_RC_t __n) : _M_ref_count(__n) { #ifndef __GTHREAD_MUTEX_INIT #ifdef __GTHREAD_MUTEX_INIT_FUNCTION __GTHREAD_MUTEX_INIT_FUNCTION (&_M_ref_count_lock); #else #error __GTHREAD_MUTEX_INIT or __GTHREAD_MUTEX_INIT_FUNCTION should be defined by gthr.h abstraction layer, report problem to libstdc++@gcc.gnu.org. #endif #endif } #ifndef __GTHREAD_MUTEX_INIT ~_Refcount_Base() { __gthread_mutex_destroy(&_M_ref_count_lock); } #endif void _M_incr() { __gthread_mutex_lock(&_M_ref_count_lock); ++_M_ref_count; __gthread_mutex_unlock(&_M_ref_count_lock); } _RC_t _M_decr() { __gthread_mutex_lock(&_M_ref_count_lock); volatile _RC_t __tmp = --_M_ref_count; __gthread_mutex_unlock(&_M_ref_count_lock); return __tmp; } }; // // What follows should really be local to rope. Unfortunately, // that doesn't work, since it makes it impossible to define generic // equality on rope iterators. According to the draft standard, the // template parameters for such an equality operator cannot be inferred // from the occurrence of a member class as a parameter. // (SGI compilers in fact allow this, but the __result wouldn't be // portable.) // Similarly, some of the static member functions are member functions // only to avoid polluting the global namespace, and to circumvent // restrictions on type inference for template functions. // // // The internal data structure for representing a rope. This is // private to the implementation. A rope is really just a pointer // to one of these. // // A few basic functions for manipulating this data structure // are members of _RopeRep. Most of the more complex algorithms // are implemented as rope members. // // Some of the static member functions of _RopeRep have identically // named functions in rope that simply invoke the _RopeRep versions. #define __ROPE_DEFINE_ALLOCS(__a) \ __ROPE_DEFINE_ALLOC(_CharT,_Data) /* character data */ \ typedef _Rope_RopeConcatenation<_CharT,__a> __C; \ __ROPE_DEFINE_ALLOC(__C,_C) \ typedef _Rope_RopeLeaf<_CharT,__a> __L; \ __ROPE_DEFINE_ALLOC(__L,_L) \ typedef _Rope_RopeFunction<_CharT,__a> __F; \ __ROPE_DEFINE_ALLOC(__F,_F) \ typedef _Rope_RopeSubstring<_CharT,__a> __S; \ __ROPE_DEFINE_ALLOC(__S,_S) // Internal rope nodes potentially store a copy of the allocator // instance used to allocate them. This is mostly redundant. // But the alternative would be to pass allocator instances around // in some form to nearly all internal functions, since any pointer // assignment may result in a zero reference count and thus require // deallocation. #define __STATIC_IF_SGI_ALLOC /* not static */ template <class _CharT, class _Alloc> struct _Rope_rep_base : public _Alloc { typedef _Alloc allocator_type; allocator_type get_allocator() const { return *static_cast<const _Alloc*>(this); } allocator_type& _M_get_allocator() { return *static_cast<_Alloc*>(this); } const allocator_type& _M_get_allocator() const { return *static_cast<const _Alloc*>(this); } _Rope_rep_base(size_t __size, const allocator_type&) : _M_size(__size) { } size_t _M_size; # define __ROPE_DEFINE_ALLOC(_Tp, __name) \ typedef typename \ _Alloc::template rebind<_Tp>::other __name##Alloc; \ static _Tp* __name##_allocate(size_t __n) \ { return __name##Alloc().allocate(__n); } \ static void __name##_deallocate(_Tp *__p, size_t __n) \ { __name##Alloc().deallocate(__p, __n); } __ROPE_DEFINE_ALLOCS(_Alloc) # undef __ROPE_DEFINE_ALLOC }; template<class _CharT, class _Alloc> struct _Rope_RopeRep : public _Rope_rep_base<_CharT, _Alloc> # ifndef __GC , _Refcount_Base # endif { public: __detail::_Tag _M_tag:8; bool _M_is_balanced:8; unsigned char _M_depth; __GC_CONST _CharT* _M_c_string; #ifdef __GTHREAD_MUTEX_INIT __gthread_mutex_t _M_c_string_lock = __GTHREAD_MUTEX_INIT; #else __gthread_mutex_t _M_c_string_lock; #endif /* Flattened version of string, if needed. */ /* typically 0. */ /* If it's not 0, then the memory is owned */ /* by this node. */ /* In the case of a leaf, this may point to */ /* the same memory as the data field. */ typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type allocator_type; using _Rope_rep_base<_CharT, _Alloc>::get_allocator; using _Rope_rep_base<_CharT, _Alloc>::_M_get_allocator; _Rope_RopeRep(__detail::_Tag __t, int __d, bool __b, size_t __size, const allocator_type& __a) : _Rope_rep_base<_CharT, _Alloc>(__size, __a), #ifndef __GC _Refcount_Base(1), #endif _M_tag(__t), _M_is_balanced(__b), _M_depth(__d), _M_c_string(0) #ifdef __GTHREAD_MUTEX_INIT { } #else { __GTHREAD_MUTEX_INIT_FUNCTION (&_M_c_string_lock); } ~_Rope_RopeRep() { __gthread_mutex_destroy (&_M_c_string_lock); } #endif #ifdef __GC void _M_incr () { } #endif static void _S_free_string(__GC_CONST _CharT*, size_t __len, allocator_type& __a); #define __STL_FREE_STRING(__s, __l, __a) _S_free_string(__s, __l, __a); // Deallocate data section of a leaf. // This shouldn't be a member function. // But its hard to do anything else at the // moment, because it's templatized w.r.t. // an allocator. // Does nothing if __GC is defined. #ifndef __GC void _M_free_c_string(); void _M_free_tree(); // Deallocate t. Assumes t is not 0. void _M_unref_nonnil() { if (0 == _M_decr()) _M_free_tree(); } void _M_ref_nonnil() { _M_incr(); } static void _S_unref(_Rope_RopeRep* __t) { if (0 != __t) __t->_M_unref_nonnil(); } static void _S_ref(_Rope_RopeRep* __t) { if (0 != __t) __t->_M_incr(); } static void _S_free_if_unref(_Rope_RopeRep* __t) { if (0 != __t && 0 == __t->_M_ref_count) __t->_M_free_tree(); } # else /* __GC */ void _M_unref_nonnil() { } void _M_ref_nonnil() { } static void _S_unref(_Rope_RopeRep*) { } static void _S_ref(_Rope_RopeRep*) { } static void _S_free_if_unref(_Rope_RopeRep*) { } # endif protected: _Rope_RopeRep& operator=(const _Rope_RopeRep&); _Rope_RopeRep(const _Rope_RopeRep&); }; template<class _CharT, class _Alloc> struct _Rope_RopeLeaf : public _Rope_RopeRep<_CharT, _Alloc> { public: // Apparently needed by VC++ // The data fields of leaves are allocated with some // extra space, to accommodate future growth and for basic // character types, to hold a trailing eos character. enum { _S_alloc_granularity = 8 }; static size_t _S_rounded_up_size(size_t __n) { size_t __size_with_eos; if (_S_is_basic_char_type((_CharT*)0)) __size_with_eos = __n + 1; else __size_with_eos = __n; #ifdef __GC return __size_with_eos; #else // Allow slop for in-place expansion. return ((__size_with_eos + size_t(_S_alloc_granularity) - 1) &~ (size_t(_S_alloc_granularity) - 1)); #endif } __GC_CONST _CharT* _M_data; /* Not necessarily 0 terminated. */ /* The allocated size is */ /* _S_rounded_up_size(size), except */ /* in the GC case, in which it */ /* doesn't matter. */ typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type allocator_type; _Rope_RopeLeaf(__GC_CONST _CharT* __d, size_t __size, const allocator_type& __a) : _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_leaf, 0, true, __size, __a), _M_data(__d) { if (_S_is_basic_char_type((_CharT *)0)) { // already eos terminated. this->_M_c_string = __d; } } // The constructor assumes that d has been allocated with // the proper allocator and the properly padded size. // In contrast, the destructor deallocates the data: #ifndef __GC ~_Rope_RopeLeaf() throw() { if (_M_data != this->_M_c_string) this->_M_free_c_string(); this->__STL_FREE_STRING(_M_data, this->_M_size, this->_M_get_allocator()); } #endif protected: _Rope_RopeLeaf& operator=(const _Rope_RopeLeaf&); _Rope_RopeLeaf(const _Rope_RopeLeaf&); }; template<class _CharT, class _Alloc> struct _Rope_RopeConcatenation : public _Rope_RopeRep<_CharT, _Alloc> { public: _Rope_RopeRep<_CharT, _Alloc>* _M_left; _Rope_RopeRep<_CharT, _Alloc>* _M_right; typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type allocator_type; _Rope_RopeConcatenation(_Rope_RopeRep<_CharT, _Alloc>* __l, _Rope_RopeRep<_CharT, _Alloc>* __r, const allocator_type& __a) : _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_concat, std::max(__l->_M_depth, __r->_M_depth) + 1, false, __l->_M_size + __r->_M_size, __a), _M_left(__l), _M_right(__r) { } #ifndef __GC ~_Rope_RopeConcatenation() throw() { this->_M_free_c_string(); _M_left->_M_unref_nonnil(); _M_right->_M_unref_nonnil(); } #endif protected: _Rope_RopeConcatenation& operator=(const _Rope_RopeConcatenation&); _Rope_RopeConcatenation(const _Rope_RopeConcatenation&); }; template<class _CharT, class _Alloc> struct _Rope_RopeFunction : public _Rope_RopeRep<_CharT, _Alloc> { public: char_producer<_CharT>* _M_fn; #ifndef __GC bool _M_delete_when_done; // Char_producer is owned by the // rope and should be explicitly // deleted when the rope becomes // inaccessible. #else // In the GC case, we either register the rope for // finalization, or not. Thus the field is unnecessary; // the information is stored in the collector data structures. // We do need a finalization procedure to be invoked by the // collector. static void _S_fn_finalization_proc(void * __tree, void *) { delete ((_Rope_RopeFunction *)__tree) -> _M_fn; } #endif typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type allocator_type; _Rope_RopeFunction(char_producer<_CharT>* __f, size_t __size, bool __d, const allocator_type& __a) : _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_function, 0, true, __size, __a) , _M_fn(__f) #ifndef __GC , _M_delete_when_done(__d) #endif { #ifdef __GC if (__d) { GC_REGISTER_FINALIZER(this, _Rope_RopeFunction:: _S_fn_finalization_proc, 0, 0, 0); } #endif } #ifndef __GC ~_Rope_RopeFunction() throw() { this->_M_free_c_string(); if (_M_delete_when_done) delete _M_fn; } # endif protected: _Rope_RopeFunction& operator=(const _Rope_RopeFunction&); _Rope_RopeFunction(const _Rope_RopeFunction&); }; // Substring results are usually represented using just // concatenation nodes. But in the case of very long flat ropes // or ropes with a functional representation that isn't practical. // In that case, we represent the __result as a special case of // RopeFunction, whose char_producer points back to the rope itself. // In all cases except repeated substring operations and // deallocation, we treat the __result as a RopeFunction. template<class _CharT, class _Alloc> struct _Rope_RopeSubstring : public _Rope_RopeFunction<_CharT, _Alloc>, public char_producer<_CharT> { public: // XXX this whole class should be rewritten. _Rope_RopeRep<_CharT,_Alloc>* _M_base; // not 0 size_t _M_start; virtual void operator()(size_t __start_pos, size_t __req_len, _CharT* __buffer) { switch(_M_base->_M_tag) { case __detail::_S_function: case __detail::_S_substringfn: { char_producer<_CharT>* __fn = ((_Rope_RopeFunction<_CharT,_Alloc>*)_M_base)->_M_fn; (*__fn)(__start_pos + _M_start, __req_len, __buffer); } break; case __detail::_S_leaf: { __GC_CONST _CharT* __s = ((_Rope_RopeLeaf<_CharT,_Alloc>*)_M_base)->_M_data; uninitialized_copy_n(__s + __start_pos + _M_start, __req_len, __buffer); } break; default: break; } } typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type allocator_type; _Rope_RopeSubstring(_Rope_RopeRep<_CharT, _Alloc>* __b, size_t __s, size_t __l, const allocator_type& __a) : _Rope_RopeFunction<_CharT, _Alloc>(this, __l, false, __a), char_producer<_CharT>(), _M_base(__b), _M_start(__s) { #ifndef __GC _M_base->_M_ref_nonnil(); #endif this->_M_tag = __detail::_S_substringfn; } virtual ~_Rope_RopeSubstring() throw() { #ifndef __GC _M_base->_M_unref_nonnil(); // _M_free_c_string(); -- done by parent class #endif } }; // Self-destructing pointers to Rope_rep. // These are not conventional smart pointers. Their // only purpose in life is to ensure that unref is called // on the pointer either at normal exit or if an exception // is raised. It is the caller's responsibility to // adjust reference counts when these pointers are initialized // or assigned to. (This convention significantly reduces // the number of potentially expensive reference count // updates.) #ifndef __GC template<class _CharT, class _Alloc> struct _Rope_self_destruct_ptr { _Rope_RopeRep<_CharT, _Alloc>* _M_ptr; ~_Rope_self_destruct_ptr() { _Rope_RopeRep<_CharT, _Alloc>::_S_unref(_M_ptr); } #ifdef __EXCEPTIONS _Rope_self_destruct_ptr() : _M_ptr(0) { }; #else _Rope_self_destruct_ptr() { }; #endif _Rope_self_destruct_ptr(_Rope_RopeRep<_CharT, _Alloc>* __p) : _M_ptr(__p) { } _Rope_RopeRep<_CharT, _Alloc>& operator*() { return *_M_ptr; } _Rope_RopeRep<_CharT, _Alloc>* operator->() { return _M_ptr; } operator _Rope_RopeRep<_CharT, _Alloc>*() { return _M_ptr; } _Rope_self_destruct_ptr& operator=(_Rope_RopeRep<_CharT, _Alloc>* __x) { _M_ptr = __x; return *this; } }; #endif // Dereferencing a nonconst iterator has to return something // that behaves almost like a reference. It's not possible to // return an actual reference since assignment requires extra // work. And we would get into the same problems as with the // CD2 version of basic_string. template<class _CharT, class _Alloc> class _Rope_char_ref_proxy { friend class rope<_CharT, _Alloc>; friend class _Rope_iterator<_CharT, _Alloc>; friend class _Rope_char_ptr_proxy<_CharT, _Alloc>; #ifdef __GC typedef _Rope_RopeRep<_CharT, _Alloc>* _Self_destruct_ptr; #else typedef _Rope_self_destruct_ptr<_CharT, _Alloc> _Self_destruct_ptr; #endif typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep; typedef rope<_CharT, _Alloc> _My_rope; size_t _M_pos; _CharT _M_current; bool _M_current_valid; _My_rope* _M_root; // The whole rope. public: _Rope_char_ref_proxy(_My_rope* __r, size_t __p) : _M_pos(__p), _M_current(), _M_current_valid(false), _M_root(__r) { } _Rope_char_ref_proxy(const _Rope_char_ref_proxy& __x) : _M_pos(__x._M_pos), _M_current(__x._M_current), _M_current_valid(false), _M_root(__x._M_root) { } // Don't preserve cache if the reference can outlive the // expression. We claim that's not possible without calling // a copy constructor or generating reference to a proxy // reference. We declare the latter to have undefined semantics. _Rope_char_ref_proxy(_My_rope* __r, size_t __p, _CharT __c) : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) { } inline operator _CharT () const; _Rope_char_ref_proxy& operator=(_CharT __c); _Rope_char_ptr_proxy<_CharT, _Alloc> operator&() const; _Rope_char_ref_proxy& operator=(const _Rope_char_ref_proxy& __c) { return operator=((_CharT)__c); } }; template<class _CharT, class __Alloc> inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a, _Rope_char_ref_proxy <_CharT, __Alloc > __b) { _CharT __tmp = __a; __a = __b; __b = __tmp; } template<class _CharT, class _Alloc> class _Rope_char_ptr_proxy { // XXX this class should be rewritten. friend class _Rope_char_ref_proxy<_CharT, _Alloc>; size_t _M_pos; rope<_CharT,_Alloc>* _M_root; // The whole rope. public: _Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x) : _M_pos(__x._M_pos), _M_root(__x._M_root) { } _Rope_char_ptr_proxy(const _Rope_char_ptr_proxy& __x) : _M_pos(__x._M_pos), _M_root(__x._M_root) { } _Rope_char_ptr_proxy() { } _Rope_char_ptr_proxy(_CharT* __x) : _M_root(0), _M_pos(0) { } _Rope_char_ptr_proxy& operator=(const _Rope_char_ptr_proxy& __x) { _M_pos = __x._M_pos; _M_root = __x._M_root; return *this; } template<class _CharT2, class _Alloc2> friend bool operator==(const _Rope_char_ptr_proxy<_CharT2, _Alloc2>& __x, const _Rope_char_ptr_proxy<_CharT2, _Alloc2>& __y); _Rope_char_ref_proxy<_CharT, _Alloc> operator*() const { return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root, _M_pos); } }; // Rope iterators: // Unlike in the C version, we cache only part of the stack // for rope iterators, since they must be efficiently copyable. // When we run out of cache, we have to reconstruct the iterator // value. // Pointers from iterators are not included in reference counts. // Iterators are assumed to be thread private. Ropes can // be shared. template<class _CharT, class _Alloc> class _Rope_iterator_base : public std::iterator<std::random_access_iterator_tag, _CharT> { friend class rope<_CharT, _Alloc>; public: typedef _Alloc _allocator_type; // used in _Rope_rotate, VC++ workaround typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep; // Borland doesn't want this to be protected. protected: enum { _S_path_cache_len = 4 }; // Must be <= 9. enum { _S_iterator_buf_len = 15 }; size_t _M_current_pos; _RopeRep* _M_root; // The whole rope. size_t _M_leaf_pos; // Starting position for current leaf __GC_CONST _CharT* _M_buf_start; // Buffer possibly // containing current char. __GC_CONST _CharT* _M_buf_ptr; // Pointer to current char in buffer. // != 0 ==> buffer valid. __GC_CONST _CharT* _M_buf_end; // One past __last valid char in buffer. // What follows is the path cache. We go out of our // way to make this compact. // Path_end contains the bottom section of the path from // the root to the current leaf. const _RopeRep* _M_path_end[_S_path_cache_len]; int _M_leaf_index; // Last valid __pos in path_end; // _M_path_end[0] ... _M_path_end[leaf_index-1] // point to concatenation nodes. unsigned char _M_path_directions; // (path_directions >> __i) & 1 is 1 // iff we got from _M_path_end[leaf_index - __i - 1] // to _M_path_end[leaf_index - __i] by going to the // __right. Assumes path_cache_len <= 9. _CharT _M_tmp_buf[_S_iterator_buf_len]; // Short buffer for surrounding chars. // This is useful primarily for // RopeFunctions. We put the buffer // here to avoid locking in the // multithreaded case. // The cached path is generally assumed to be valid // only if the buffer is valid. static void _S_setbuf(_Rope_iterator_base& __x); // Set buffer contents given // path cache. static void _S_setcache(_Rope_iterator_base& __x); // Set buffer contents and // path cache. static void _S_setcache_for_incr(_Rope_iterator_base& __x); // As above, but assumes path // cache is valid for previous posn. _Rope_iterator_base() { } _Rope_iterator_base(_RopeRep* __root, size_t __pos) : _M_current_pos(__pos), _M_root(__root), _M_buf_ptr(0) { } void _M_incr(size_t __n); void _M_decr(size_t __n); public: size_t index() const { return _M_current_pos; } _Rope_iterator_base(const _Rope_iterator_base& __x) { if (0 != __x._M_buf_ptr) *this = __x; else { _M_current_pos = __x._M_current_pos; _M_root = __x._M_root; _M_buf_ptr = 0; } } }; template<class _CharT, class _Alloc> class _Rope_iterator; template<class _CharT, class _Alloc> class _Rope_const_iterator : public _Rope_iterator_base<_CharT, _Alloc> { friend class rope<_CharT, _Alloc>; protected: typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep; // The one from the base class may not be directly visible. _Rope_const_iterator(const _RopeRep* __root, size_t __pos) : _Rope_iterator_base<_CharT, _Alloc>(const_cast<_RopeRep*>(__root), __pos) // Only nonconst iterators modify root ref count { } public: typedef _CharT reference; // Really a value. Returning a reference // Would be a mess, since it would have // to be included in refcount. typedef const _CharT* pointer; public: _Rope_const_iterator() { }; _Rope_const_iterator(const _Rope_const_iterator& __x) : _Rope_iterator_base<_CharT,_Alloc>(__x) { } _Rope_const_iterator(const _Rope_iterator<_CharT,_Alloc>& __x); _Rope_const_iterator(const rope<_CharT, _Alloc>& __r, size_t __pos) : _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos) { } _Rope_const_iterator& operator=(const _Rope_const_iterator& __x) { if (0 != __x._M_buf_ptr) *(static_cast<_Rope_iterator_base<_CharT, _Alloc>*>(this)) = __x; else { this->_M_current_pos = __x._M_current_pos; this->_M_root = __x._M_root; this->_M_buf_ptr = 0; } return(*this); } reference operator*() { if (0 == this->_M_buf_ptr) this->_S_setcache(*this); return *this->_M_buf_ptr; } // Without this const version, Rope iterators do not meet the // requirements of an Input Iterator. reference operator*() const { return *const_cast<_Rope_const_iterator&>(*this); } _Rope_const_iterator& operator++() { __GC_CONST _CharT* __next; if (0 != this->_M_buf_ptr && (__next = this->_M_buf_ptr + 1) < this->_M_buf_end) { this->_M_buf_ptr = __next; ++this->_M_current_pos; } else this->_M_incr(1); return *this; } _Rope_const_iterator& operator+=(ptrdiff_t __n) { if (__n >= 0) this->_M_incr(__n); else this->_M_decr(-__n); return *this; } _Rope_const_iterator& operator--() { this->_M_decr(1); return *this; } _Rope_const_iterator& operator-=(ptrdiff_t __n) { if (__n >= 0) this->_M_decr(__n); else this->_M_incr(-__n); return *this; } _Rope_const_iterator operator++(int) { size_t __old_pos = this->_M_current_pos; this->_M_incr(1); return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos); // This makes a subsequent dereference expensive. // Perhaps we should instead copy the iterator // if it has a valid cache? } _Rope_const_iterator operator--(int) { size_t __old_pos = this->_M_current_pos; this->_M_decr(1); return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos); } template<class _CharT2, class _Alloc2> friend _Rope_const_iterator<_CharT2, _Alloc2> operator-(const _Rope_const_iterator<_CharT2, _Alloc2>& __x, ptrdiff_t __n); template<class _CharT2, class _Alloc2> friend _Rope_const_iterator<_CharT2, _Alloc2> operator+(const _Rope_const_iterator<_CharT2, _Alloc2>& __x, ptrdiff_t __n); template<class _CharT2, class _Alloc2> friend _Rope_const_iterator<_CharT2, _Alloc2> operator+(ptrdiff_t __n, const _Rope_const_iterator<_CharT2, _Alloc2>& __x); reference operator[](size_t __n) { return rope<_CharT, _Alloc>::_S_fetch(this->_M_root, this->_M_current_pos + __n); } template<class _CharT2, class _Alloc2> friend bool operator==(const _Rope_const_iterator<_CharT2, _Alloc2>& __x, const _Rope_const_iterator<_CharT2, _Alloc2>& __y); template<class _CharT2, class _Alloc2> friend bool operator<(const _Rope_const_iterator<_CharT2, _Alloc2>& __x, const _Rope_const_iterator<_CharT2, _Alloc2>& __y); template<class _CharT2, class _Alloc2> friend ptrdiff_t operator-(const _Rope_const_iterator<_CharT2, _Alloc2>& __x, const _Rope_const_iterator<_CharT2, _Alloc2>& __y); }; template<class _CharT, class _Alloc> class _Rope_iterator : public _Rope_iterator_base<_CharT, _Alloc> { friend class rope<_CharT, _Alloc>; protected: typedef typename _Rope_iterator_base<_CharT, _Alloc>::_RopeRep _RopeRep; rope<_CharT, _Alloc>* _M_root_rope; // root is treated as a cached version of this, and is used to // detect changes to the underlying rope. // Root is included in the reference count. This is necessary // so that we can detect changes reliably. Unfortunately, it // requires careful bookkeeping for the nonGC case. _Rope_iterator(rope<_CharT, _Alloc>* __r, size_t __pos) : _Rope_iterator_base<_CharT, _Alloc>(__r->_M_tree_ptr, __pos), _M_root_rope(__r) { _RopeRep::_S_ref(this->_M_root); if (!(__r -> empty())) this->_S_setcache(*this); } void _M_check(); public: typedef _Rope_char_ref_proxy<_CharT, _Alloc> reference; typedef _Rope_char_ref_proxy<_CharT, _Alloc>* pointer; rope<_CharT, _Alloc>& container() { return *_M_root_rope; } _Rope_iterator() { this->_M_root = 0; // Needed for reference counting. }; _Rope_iterator(const _Rope_iterator& __x) : _Rope_iterator_base<_CharT, _Alloc>(__x) { _M_root_rope = __x._M_root_rope; _RopeRep::_S_ref(this->_M_root); } _Rope_iterator(rope<_CharT, _Alloc>& __r, size_t __pos); ~_Rope_iterator() { _RopeRep::_S_unref(this->_M_root); } _Rope_iterator& operator=(const _Rope_iterator& __x) { _RopeRep* __old = this->_M_root; _RopeRep::_S_ref(__x._M_root); if (0 != __x._M_buf_ptr) { _M_root_rope = __x._M_root_rope; *(static_cast<_Rope_iterator_base<_CharT, _Alloc>*>(this)) = __x; } else { this->_M_current_pos = __x._M_current_pos; this->_M_root = __x._M_root; _M_root_rope = __x._M_root_rope; this->_M_buf_ptr = 0; } _RopeRep::_S_unref(__old); return(*this); } reference operator*() { _M_check(); if (0 == this->_M_buf_ptr) return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root_rope, this->_M_current_pos); else return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root_rope, this->_M_current_pos, *this->_M_buf_ptr); } // See above comment. reference operator*() const { return *const_cast<_Rope_iterator&>(*this); } _Rope_iterator& operator++() { this->_M_incr(1); return *this; } _Rope_iterator& operator+=(ptrdiff_t __n) { if (__n >= 0) this->_M_incr(__n); else this->_M_decr(-__n); return *this; } _Rope_iterator& operator--() { this->_M_decr(1); return *this; } _Rope_iterator& operator-=(ptrdiff_t __n) { if (__n >= 0) this->_M_decr(__n); else this->_M_incr(-__n); return *this; } _Rope_iterator operator++(int) { size_t __old_pos = this->_M_current_pos; this->_M_incr(1); return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos); } _Rope_iterator operator--(int) { size_t __old_pos = this->_M_current_pos; this->_M_decr(1); return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos); } reference operator[](ptrdiff_t __n) { return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root_rope, this->_M_current_pos + __n); } template<class _CharT2, class _Alloc2> friend bool operator==(const _Rope_iterator<_CharT2, _Alloc2>& __x, const _Rope_iterator<_CharT2, _Alloc2>& __y); template<class _CharT2, class _Alloc2> friend bool operator<(const _Rope_iterator<_CharT2, _Alloc2>& __x, const _Rope_iterator<_CharT2, _Alloc2>& __y); template<class _CharT2, class _Alloc2> friend ptrdiff_t operator-(const _Rope_iterator<_CharT2, _Alloc2>& __x, const _Rope_iterator<_CharT2, _Alloc2>& __y); template<class _CharT2, class _Alloc2> friend _Rope_iterator<_CharT2, _Alloc2> operator-(const _Rope_iterator<_CharT2, _Alloc2>& __x, ptrdiff_t __n); template<class _CharT2, class _Alloc2> friend _Rope_iterator<_CharT2, _Alloc2> operator+(const _Rope_iterator<_CharT2, _Alloc2>& __x, ptrdiff_t __n); template<class _CharT2, class _Alloc2> friend _Rope_iterator<_CharT2, _Alloc2> operator+(ptrdiff_t __n, const _Rope_iterator<_CharT2, _Alloc2>& __x); }; template <class _CharT, class _Alloc> struct _Rope_base : public _Alloc { typedef _Alloc allocator_type; allocator_type get_allocator() const { return *static_cast<const _Alloc*>(this); } allocator_type& _M_get_allocator() { return *static_cast<_Alloc*>(this); } const allocator_type& _M_get_allocator() const { return *static_cast<const _Alloc*>(this); } typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep; // The one in _Base may not be visible due to template rules. _Rope_base(_RopeRep* __t, const allocator_type&) : _M_tree_ptr(__t) { } _Rope_base(const allocator_type&) { } // The only data member of a rope: _RopeRep *_M_tree_ptr; #define __ROPE_DEFINE_ALLOC(_Tp, __name) \ typedef typename \ _Alloc::template rebind<_Tp>::other __name##Alloc; \ static _Tp* __name##_allocate(size_t __n) \ { return __name##Alloc().allocate(__n); } \ static void __name##_deallocate(_Tp *__p, size_t __n) \ { __name##Alloc().deallocate(__p, __n); } __ROPE_DEFINE_ALLOCS(_Alloc) #undef __ROPE_DEFINE_ALLOC protected: _Rope_base& operator=(const _Rope_base&); _Rope_base(const _Rope_base&); }; /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template <class _CharT, class _Alloc> class rope : public _Rope_base<_CharT, _Alloc> { public: typedef _CharT value_type; typedef ptrdiff_t difference_type; typedef size_t size_type; typedef _CharT const_reference; typedef const _CharT* const_pointer; typedef _Rope_iterator<_CharT, _Alloc> iterator; typedef _Rope_const_iterator<_CharT, _Alloc> const_iterator; typedef _Rope_char_ref_proxy<_CharT, _Alloc> reference; typedef _Rope_char_ptr_proxy<_CharT, _Alloc> pointer; friend class _Rope_iterator<_CharT, _Alloc>; friend class _Rope_const_iterator<_CharT, _Alloc>; friend struct _Rope_RopeRep<_CharT, _Alloc>; friend class _Rope_iterator_base<_CharT, _Alloc>; friend class _Rope_char_ptr_proxy<_CharT, _Alloc>; friend class _Rope_char_ref_proxy<_CharT, _Alloc>; friend struct _Rope_RopeSubstring<_CharT, _Alloc>; protected: typedef _Rope_base<_CharT, _Alloc> _Base; typedef typename _Base::allocator_type allocator_type; using _Base::_M_tree_ptr; using _Base::get_allocator; using _Base::_M_get_allocator; typedef __GC_CONST _CharT* _Cstrptr; static _CharT _S_empty_c_str[1]; static bool _S_is0(_CharT __c) { return __c == _S_eos((_CharT*)0); } enum { _S_copy_max = 23 }; // For strings shorter than _S_copy_max, we copy to // concatenate. typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep; typedef _Rope_RopeConcatenation<_CharT, _Alloc> _RopeConcatenation; typedef _Rope_RopeLeaf<_CharT, _Alloc> _RopeLeaf; typedef _Rope_RopeFunction<_CharT, _Alloc> _RopeFunction; typedef _Rope_RopeSubstring<_CharT, _Alloc> _RopeSubstring; // Retrieve a character at the indicated position. static _CharT _S_fetch(_RopeRep* __r, size_type __pos); #ifndef __GC // Obtain a pointer to the character at the indicated position. // The pointer can be used to change the character. // If such a pointer cannot be produced, as is frequently the // case, 0 is returned instead. // (Returns nonzero only if all nodes in the path have a refcount // of 1.) static _CharT* _S_fetch_ptr(_RopeRep* __r, size_type __pos); #endif static bool _S_apply_to_pieces(// should be template parameter _Rope_char_consumer<_CharT>& __c, const _RopeRep* __r, size_t __begin, size_t __end); // begin and end are assumed to be in range. #ifndef __GC static void _S_unref(_RopeRep* __t) { _RopeRep::_S_unref(__t); } static void _S_ref(_RopeRep* __t) { _RopeRep::_S_ref(__t); } #else /* __GC */ static void _S_unref(_RopeRep*) { } static void _S_ref(_RopeRep*) { } #endif #ifdef __GC typedef _Rope_RopeRep<_CharT, _Alloc>* _Self_destruct_ptr; #else typedef _Rope_self_destruct_ptr<_CharT, _Alloc> _Self_destruct_ptr; #endif // _Result is counted in refcount. static _RopeRep* _S_substring(_RopeRep* __base, size_t __start, size_t __endp1); static _RopeRep* _S_concat_char_iter(_RopeRep* __r, const _CharT* __iter, size_t __slen); // Concatenate rope and char ptr, copying __s. // Should really take an arbitrary iterator. // Result is counted in refcount. static _RopeRep* _S_destr_concat_char_iter(_RopeRep* __r, const _CharT* __iter, size_t __slen) // As above, but one reference to __r is about to be // destroyed. Thus the pieces may be recycled if all // relevant reference counts are 1. #ifdef __GC // We can't really do anything since refcounts are unavailable. { return _S_concat_char_iter(__r, __iter, __slen); } #else ; #endif static _RopeRep* _S_concat(_RopeRep* __left, _RopeRep* __right); // General concatenation on _RopeRep. _Result // has refcount of 1. Adjusts argument refcounts. public: void apply_to_pieces(size_t __begin, size_t __end, _Rope_char_consumer<_CharT>& __c) const { _S_apply_to_pieces(__c, this->_M_tree_ptr, __begin, __end); } protected: static size_t _S_rounded_up_size(size_t __n) { return _RopeLeaf::_S_rounded_up_size(__n); } static size_t _S_allocated_capacity(size_t __n) { if (_S_is_basic_char_type((_CharT*)0)) return _S_rounded_up_size(__n) - 1; else return _S_rounded_up_size(__n); } // Allocate and construct a RopeLeaf using the supplied allocator // Takes ownership of s instead of copying. static _RopeLeaf* _S_new_RopeLeaf(__GC_CONST _CharT *__s, size_t __size, allocator_type& __a) { _RopeLeaf* __space = typename _Base::_LAlloc(__a).allocate(1); return new(__space) _RopeLeaf(__s, __size, __a); } static _RopeConcatenation* _S_new_RopeConcatenation(_RopeRep* __left, _RopeRep* __right, allocator_type& __a) { _RopeConcatenation* __space = typename _Base::_CAlloc(__a).allocate(1); return new(__space) _RopeConcatenation(__left, __right, __a); } static _RopeFunction* _S_new_RopeFunction(char_producer<_CharT>* __f, size_t __size, bool __d, allocator_type& __a) { _RopeFunction* __space = typename _Base::_FAlloc(__a).allocate(1); return new(__space) _RopeFunction(__f, __size, __d, __a); } static _RopeSubstring* _S_new_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s, size_t __l, allocator_type& __a) { _RopeSubstring* __space = typename _Base::_SAlloc(__a).allocate(1); return new(__space) _RopeSubstring(__b, __s, __l, __a); } static _RopeLeaf* _S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s, size_t __size, allocator_type& __a) #define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a) \ _S_RopeLeaf_from_unowned_char_ptr(__s, __size, __a) { if (0 == __size) return 0; _CharT* __buf = __a.allocate(_S_rounded_up_size(__size)); __uninitialized_copy_n_a(__s, __size, __buf, __a); _S_cond_store_eos(__buf[__size]); __try { return _S_new_RopeLeaf(__buf, __size, __a); } __catch(...) { _RopeRep::__STL_FREE_STRING(__buf, __size, __a); __throw_exception_again; } } // Concatenation of nonempty strings. // Always builds a concatenation node. // Rebalances if the result is too deep. // Result has refcount 1. // Does not increment left and right ref counts even though // they are referenced. static _RopeRep* _S_tree_concat(_RopeRep* __left, _RopeRep* __right); // Concatenation helper functions static _RopeLeaf* _S_leaf_concat_char_iter(_RopeLeaf* __r, const _CharT* __iter, size_t __slen); // Concatenate by copying leaf. // should take an arbitrary iterator // result has refcount 1. #ifndef __GC static _RopeLeaf* _S_destr_leaf_concat_char_iter(_RopeLeaf* __r, const _CharT* __iter, size_t __slen); // A version that potentially clobbers __r if __r->_M_ref_count == 1. #endif private: static size_t _S_char_ptr_len(const _CharT* __s); // slightly generalized strlen rope(_RopeRep* __t, const allocator_type& __a = allocator_type()) : _Base(__t, __a) { } // Copy __r to the _CharT buffer. // Returns __buffer + __r->_M_size. // Assumes that buffer is uninitialized. static _CharT* _S_flatten(_RopeRep* __r, _CharT* __buffer); // Again, with explicit starting position and length. // Assumes that buffer is uninitialized. static _CharT* _S_flatten(_RopeRep* __r, size_t __start, size_t __len, _CharT* __buffer); static const unsigned long _S_min_len[__detail::_S_max_rope_depth + 1]; static bool _S_is_balanced(_RopeRep* __r) { return (__r->_M_size >= _S_min_len[__r->_M_depth]); } static bool _S_is_almost_balanced(_RopeRep* __r) { return (__r->_M_depth == 0 || __r->_M_size >= _S_min_len[__r->_M_depth - 1]); } static bool _S_is_roughly_balanced(_RopeRep* __r) { return (__r->_M_depth <= 1 || __r->_M_size >= _S_min_len[__r->_M_depth - 2]); } // Assumes the result is not empty. static _RopeRep* _S_concat_and_set_balanced(_RopeRep* __left, _RopeRep* __right) { _RopeRep* __result = _S_concat(__left, __right); if (_S_is_balanced(__result)) __result->_M_is_balanced = true; return __result; } // The basic rebalancing operation. Logically copies the // rope. The result has refcount of 1. The client will // usually decrement the reference count of __r. // The result is within height 2 of balanced by the above // definition. static _RopeRep* _S_balance(_RopeRep* __r); // Add all unbalanced subtrees to the forest of balanced trees. // Used only by balance. static void _S_add_to_forest(_RopeRep*__r, _RopeRep** __forest); // Add __r to forest, assuming __r is already balanced. static void _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest); // Print to stdout, exposing structure static void _S_dump(_RopeRep* __r, int __indent = 0); // Return -1, 0, or 1 if __x < __y, __x == __y, or __x > __y resp. static int _S_compare(const _RopeRep* __x, const _RopeRep* __y); public: bool empty() const { return 0 == this->_M_tree_ptr; } // Comparison member function. This is public only for those // clients that need a ternary comparison. Others // should use the comparison operators below. int compare(const rope& __y) const { return _S_compare(this->_M_tree_ptr, __y._M_tree_ptr); } rope(const _CharT* __s, const allocator_type& __a = allocator_type()) : _Base(__a) { this->_M_tree_ptr = __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, _S_char_ptr_len(__s), _M_get_allocator()); } rope(const _CharT* __s, size_t __len, const allocator_type& __a = allocator_type()) : _Base(__a) { this->_M_tree_ptr = __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __len, _M_get_allocator()); } // Should perhaps be templatized with respect to the iterator type // and use Sequence_buffer. (It should perhaps use sequence_buffer // even now.) rope(const _CharT* __s, const _CharT* __e, const allocator_type& __a = allocator_type()) : _Base(__a) { this->_M_tree_ptr = __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __e - __s, _M_get_allocator()); } rope(const const_iterator& __s, const const_iterator& __e, const allocator_type& __a = allocator_type()) : _Base(_S_substring(__s._M_root, __s._M_current_pos, __e._M_current_pos), __a) { } rope(const iterator& __s, const iterator& __e, const allocator_type& __a = allocator_type()) : _Base(_S_substring(__s._M_root, __s._M_current_pos, __e._M_current_pos), __a) { } rope(_CharT __c, const allocator_type& __a = allocator_type()) : _Base(__a) { _CharT* __buf = this->_Data_allocate(_S_rounded_up_size(1)); _M_get_allocator().construct(__buf, __c); __try { this->_M_tree_ptr = _S_new_RopeLeaf(__buf, 1, _M_get_allocator()); } __catch(...) { _RopeRep::__STL_FREE_STRING(__buf, 1, _M_get_allocator()); __throw_exception_again; } } rope(size_t __n, _CharT __c, const allocator_type& __a = allocator_type()); rope(const allocator_type& __a = allocator_type()) : _Base(0, __a) { } // Construct a rope from a function that can compute its members rope(char_producer<_CharT> *__fn, size_t __len, bool __delete_fn, const allocator_type& __a = allocator_type()) : _Base(__a) { this->_M_tree_ptr = (0 == __len) ? 0 : _S_new_RopeFunction(__fn, __len, __delete_fn, _M_get_allocator()); } rope(const rope& __x, const allocator_type& __a = allocator_type()) : _Base(__x._M_tree_ptr, __a) { _S_ref(this->_M_tree_ptr); } ~rope() throw() { _S_unref(this->_M_tree_ptr); } rope& operator=(const rope& __x) { _RopeRep* __old = this->_M_tree_ptr; this->_M_tree_ptr = __x._M_tree_ptr; _S_ref(this->_M_tree_ptr); _S_unref(__old); return *this; } void clear() { _S_unref(this->_M_tree_ptr); this->_M_tree_ptr = 0; } void push_back(_CharT __x) { _RopeRep* __old = this->_M_tree_ptr; this->_M_tree_ptr = _S_destr_concat_char_iter(this->_M_tree_ptr, &__x, 1); _S_unref(__old); } void pop_back() { _RopeRep* __old = this->_M_tree_ptr; this->_M_tree_ptr = _S_substring(this->_M_tree_ptr, 0, this->_M_tree_ptr->_M_size - 1); _S_unref(__old); } _CharT back() const { return _S_fetch(this->_M_tree_ptr, this->_M_tree_ptr->_M_size - 1); } void push_front(_CharT __x) { _RopeRep* __old = this->_M_tree_ptr; _RopeRep* __left = __STL_ROPE_FROM_UNOWNED_CHAR_PTR(&__x, 1, _M_get_allocator()); __try { this->_M_tree_ptr = _S_concat(__left, this->_M_tree_ptr); _S_unref(__old); _S_unref(__left); } __catch(...) { _S_unref(__left); __throw_exception_again; } } void pop_front() { _RopeRep* __old = this->_M_tree_ptr; this->_M_tree_ptr = _S_substring(this->_M_tree_ptr, 1, this->_M_tree_ptr->_M_size); _S_unref(__old); } _CharT front() const { return _S_fetch(this->_M_tree_ptr, 0); } void balance() { _RopeRep* __old = this->_M_tree_ptr; this->_M_tree_ptr = _S_balance(this->_M_tree_ptr); _S_unref(__old); } void copy(_CharT* __buffer) const { _Destroy_const(__buffer, __buffer + size(), _M_get_allocator()); _S_flatten(this->_M_tree_ptr, __buffer); } // This is the copy function from the standard, but // with the arguments reordered to make it consistent with the // rest of the interface. // Note that this guaranteed not to compile if the draft standard // order is assumed. size_type copy(size_type __pos, size_type __n, _CharT* __buffer) const { size_t __size = size(); size_t __len = (__pos + __n > __size? __size - __pos : __n); _Destroy_const(__buffer, __buffer + __len, _M_get_allocator()); _S_flatten(this->_M_tree_ptr, __pos, __len, __buffer); return __len; } // Print to stdout, exposing structure. May be useful for // performance debugging. void dump() { _S_dump(this->_M_tree_ptr); } // Convert to 0 terminated string in new allocated memory. // Embedded 0s in the input do not terminate the copy. const _CharT* c_str() const; // As above, but also use the flattened representation as // the new rope representation. const _CharT* replace_with_c_str(); // Reclaim memory for the c_str generated flattened string. // Intentionally undocumented, since it's hard to say when this // is safe for multiple threads. void delete_c_str () { if (0 == this->_M_tree_ptr) return; if (__detail::_S_leaf == this->_M_tree_ptr->_M_tag && ((_RopeLeaf*)this->_M_tree_ptr)->_M_data == this->_M_tree_ptr->_M_c_string) { // Representation shared return; } #ifndef __GC this->_M_tree_ptr->_M_free_c_string(); #endif this->_M_tree_ptr->_M_c_string = 0; } _CharT operator[] (size_type __pos) const { return _S_fetch(this->_M_tree_ptr, __pos); } _CharT at(size_type __pos) const { // if (__pos >= size()) throw out_of_range; // XXX return (*this)[__pos]; } const_iterator begin() const { return(const_iterator(this->_M_tree_ptr, 0)); } // An easy way to get a const iterator from a non-const container. const_iterator const_begin() const { return(const_iterator(this->_M_tree_ptr, 0)); } const_iterator end() const { return(const_iterator(this->_M_tree_ptr, size())); } const_iterator const_end() const { return(const_iterator(this->_M_tree_ptr, size())); } size_type size() const { return(0 == this->_M_tree_ptr? 0 : this->_M_tree_ptr->_M_size); } size_type length() const { return size(); } size_type max_size() const { return _S_min_len[int(__detail::_S_max_rope_depth) - 1] - 1; // Guarantees that the result can be sufficiently // balanced. Longer ropes will probably still work, // but it's harder to make guarantees. } typedef std::reverse_iterator<const_iterator> const_reverse_iterator; const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } const_reverse_iterator const_rbegin() const { return const_reverse_iterator(end()); } const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } const_reverse_iterator const_rend() const { return const_reverse_iterator(begin()); } template<class _CharT2, class _Alloc2> friend rope<_CharT2, _Alloc2> operator+(const rope<_CharT2, _Alloc2>& __left, const rope<_CharT2, _Alloc2>& __right); template<class _CharT2, class _Alloc2> friend rope<_CharT2, _Alloc2> operator+(const rope<_CharT2, _Alloc2>& __left, const _CharT2* __right); template<class _CharT2, class _Alloc2> friend rope<_CharT2, _Alloc2> operator+(const rope<_CharT2, _Alloc2>& __left, _CharT2 __right); // The symmetric cases are intentionally omitted, since they're // presumed to be less common, and we don't handle them as well. // The following should really be templatized. The first // argument should be an input iterator or forward iterator with // value_type _CharT. rope& append(const _CharT* __iter, size_t __n) { _RopeRep* __result = _S_destr_concat_char_iter(this->_M_tree_ptr, __iter, __n); _S_unref(this->_M_tree_ptr); this->_M_tree_ptr = __result; return *this; } rope& append(const _CharT* __c_string) { size_t __len = _S_char_ptr_len(__c_string); append(__c_string, __len); return(*this); } rope& append(const _CharT* __s, const _CharT* __e) { _RopeRep* __result = _S_destr_concat_char_iter(this->_M_tree_ptr, __s, __e - __s); _S_unref(this->_M_tree_ptr); this->_M_tree_ptr = __result; return *this; } rope& append(const_iterator __s, const_iterator __e) { _Self_destruct_ptr __appendee(_S_substring(__s._M_root, __s._M_current_pos, __e._M_current_pos)); _RopeRep* __result = _S_concat(this->_M_tree_ptr, (_RopeRep*)__appendee); _S_unref(this->_M_tree_ptr); this->_M_tree_ptr = __result; return *this; } rope& append(_CharT __c) { _RopeRep* __result = _S_destr_concat_char_iter(this->_M_tree_ptr, &__c, 1); _S_unref(this->_M_tree_ptr); this->_M_tree_ptr = __result; return *this; } rope& append() { return append(_CharT()); } // XXX why? rope& append(const rope& __y) { _RopeRep* __result = _S_concat(this->_M_tree_ptr, __y._M_tree_ptr); _S_unref(this->_M_tree_ptr); this->_M_tree_ptr = __result; return *this; } rope& append(size_t __n, _CharT __c) { rope<_CharT,_Alloc> __last(__n, __c); return append(__last); } void swap(rope& __b) { _RopeRep* __tmp = this->_M_tree_ptr; this->_M_tree_ptr = __b._M_tree_ptr; __b._M_tree_ptr = __tmp; } protected: // Result is included in refcount. static _RopeRep* replace(_RopeRep* __old, size_t __pos1, size_t __pos2, _RopeRep* __r) { if (0 == __old) { _S_ref(__r); return __r; } _Self_destruct_ptr __left(_S_substring(__old, 0, __pos1)); _Self_destruct_ptr __right(_S_substring(__old, __pos2, __old->_M_size)); _RopeRep* __result; if (0 == __r) __result = _S_concat(__left, __right); else { _Self_destruct_ptr __left_result(_S_concat(__left, __r)); __result = _S_concat(__left_result, __right); } return __result; } public: void insert(size_t __p, const rope& __r) { _RopeRep* __result = replace(this->_M_tree_ptr, __p, __p, __r._M_tree_ptr); _S_unref(this->_M_tree_ptr); this->_M_tree_ptr = __result; } void insert(size_t __p, size_t __n, _CharT __c) { rope<_CharT,_Alloc> __r(__n,__c); insert(__p, __r); } void insert(size_t __p, const _CharT* __i, size_t __n) { _Self_destruct_ptr __left(_S_substring(this->_M_tree_ptr, 0, __p)); _Self_destruct_ptr __right(_S_substring(this->_M_tree_ptr, __p, size())); _Self_destruct_ptr __left_result(_S_concat_char_iter(__left, __i, __n)); // _S_ destr_concat_char_iter should be safe here. // But as it stands it's probably not a win, since __left // is likely to have additional references. _RopeRep* __result = _S_concat(__left_result, __right); _S_unref(this->_M_tree_ptr); this->_M_tree_ptr = __result; } void insert(size_t __p, const _CharT* __c_string) { insert(__p, __c_string, _S_char_ptr_len(__c_string)); } void insert(size_t __p, _CharT __c) { insert(__p, &__c, 1); } void insert(size_t __p) { _CharT __c = _CharT(); insert(__p, &__c, 1); } void insert(size_t __p, const _CharT* __i, const _CharT* __j) { rope __r(__i, __j); insert(__p, __r); } void insert(size_t __p, const const_iterator& __i, const const_iterator& __j) { rope __r(__i, __j); insert(__p, __r); } void insert(size_t __p, const iterator& __i, const iterator& __j) { rope __r(__i, __j); insert(__p, __r); } // (position, length) versions of replace operations: void replace(size_t __p, size_t __n, const rope& __r) { _RopeRep* __result = replace(this->_M_tree_ptr, __p, __p + __n, __r._M_tree_ptr); _S_unref(this->_M_tree_ptr); this->_M_tree_ptr = __result; } void replace(size_t __p, size_t __n, const _CharT* __i, size_t __i_len) { rope __r(__i, __i_len); replace(__p, __n, __r); } void replace(size_t __p, size_t __n, _CharT __c) { rope __r(__c); replace(__p, __n, __r); } void replace(size_t __p, size_t __n, const _CharT* __c_string) { rope __r(__c_string); replace(__p, __n, __r); } void replace(size_t __p, size_t __n, const _CharT* __i, const _CharT* __j) { rope __r(__i, __j); replace(__p, __n, __r); } void replace(size_t __p, size_t __n, const const_iterator& __i, const const_iterator& __j) { rope __r(__i, __j); replace(__p, __n, __r); } void replace(size_t __p, size_t __n, const iterator& __i, const iterator& __j) { rope __r(__i, __j); replace(__p, __n, __r); } // Single character variants: void replace(size_t __p, _CharT __c) { iterator __i(this, __p); *__i = __c; } void replace(size_t __p, const rope& __r) { replace(__p, 1, __r); } void replace(size_t __p, const _CharT* __i, size_t __i_len) { replace(__p, 1, __i, __i_len); } void replace(size_t __p, const _CharT* __c_string) { replace(__p, 1, __c_string); } void replace(size_t __p, const _CharT* __i, const _CharT* __j) { replace(__p, 1, __i, __j); } void replace(size_t __p, const const_iterator& __i, const const_iterator& __j) { replace(__p, 1, __i, __j); } void replace(size_t __p, const iterator& __i, const iterator& __j) { replace(__p, 1, __i, __j); } // Erase, (position, size) variant. void erase(size_t __p, size_t __n) { _RopeRep* __result = replace(this->_M_tree_ptr, __p, __p + __n, 0); _S_unref(this->_M_tree_ptr); this->_M_tree_ptr = __result; } // Erase, single character void erase(size_t __p) { erase(__p, __p + 1); } // Insert, iterator variants. iterator insert(const iterator& __p, const rope& __r) { insert(__p.index(), __r); return __p; } iterator insert(const iterator& __p, size_t __n, _CharT __c) { insert(__p.index(), __n, __c); return __p; } iterator insert(const iterator& __p, _CharT __c) { insert(__p.index(), __c); return __p; } iterator insert(const iterator& __p ) { insert(__p.index()); return __p; } iterator insert(const iterator& __p, const _CharT* c_string) { insert(__p.index(), c_string); return __p; } iterator insert(const iterator& __p, const _CharT* __i, size_t __n) { insert(__p.index(), __i, __n); return __p; } iterator insert(const iterator& __p, const _CharT* __i, const _CharT* __j) { insert(__p.index(), __i, __j); return __p; } iterator insert(const iterator& __p, const const_iterator& __i, const const_iterator& __j) { insert(__p.index(), __i, __j); return __p; } iterator insert(const iterator& __p, const iterator& __i, const iterator& __j) { insert(__p.index(), __i, __j); return __p; } // Replace, range variants. void replace(const iterator& __p, const iterator& __q, const rope& __r) { replace(__p.index(), __q.index() - __p.index(), __r); } void replace(const iterator& __p, const iterator& __q, _CharT __c) { replace(__p.index(), __q.index() - __p.index(), __c); } void replace(const iterator& __p, const iterator& __q, const _CharT* __c_string) { replace(__p.index(), __q.index() - __p.index(), __c_string); } void replace(const iterator& __p, const iterator& __q, const _CharT* __i, size_t __n) { replace(__p.index(), __q.index() - __p.index(), __i, __n); } void replace(const iterator& __p, const iterator& __q, const _CharT* __i, const _CharT* __j) { replace(__p.index(), __q.index() - __p.index(), __i, __j); } void replace(const iterator& __p, const iterator& __q, const const_iterator& __i, const const_iterator& __j) { replace(__p.index(), __q.index() - __p.index(), __i, __j); } void replace(const iterator& __p, const iterator& __q, const iterator& __i, const iterator& __j) { replace(__p.index(), __q.index() - __p.index(), __i, __j); } // Replace, iterator variants. void replace(const iterator& __p, const rope& __r) { replace(__p.index(), __r); } void replace(const iterator& __p, _CharT __c) { replace(__p.index(), __c); } void replace(const iterator& __p, const _CharT* __c_string) { replace(__p.index(), __c_string); } void replace(const iterator& __p, const _CharT* __i, size_t __n) { replace(__p.index(), __i, __n); } void replace(const iterator& __p, const _CharT* __i, const _CharT* __j) { replace(__p.index(), __i, __j); } void replace(const iterator& __p, const_iterator __i, const_iterator __j) { replace(__p.index(), __i, __j); } void replace(const iterator& __p, iterator __i, iterator __j) { replace(__p.index(), __i, __j); } // Iterator and range variants of erase iterator erase(const iterator& __p, const iterator& __q) { size_t __p_index = __p.index(); erase(__p_index, __q.index() - __p_index); return iterator(this, __p_index); } iterator erase(const iterator& __p) { size_t __p_index = __p.index(); erase(__p_index, 1); return iterator(this, __p_index); } rope substr(size_t __start, size_t __len = 1) const { return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr, __start, __start + __len)); } rope substr(iterator __start, iterator __end) const { return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr, __start.index(), __end.index())); } rope substr(iterator __start) const { size_t __pos = __start.index(); return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr, __pos, __pos + 1)); } rope substr(const_iterator __start, const_iterator __end) const { // This might eventually take advantage of the cache in the // iterator. return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr, __start.index(), __end.index())); } rope<_CharT, _Alloc> substr(const_iterator __start) { size_t __pos = __start.index(); return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr, __pos, __pos + 1)); } static const size_type npos; size_type find(_CharT __c, size_type __pos = 0) const; size_type find(const _CharT* __s, size_type __pos = 0) const { size_type __result_pos; const_iterator __result = std::search(const_begin() + __pos, const_end(), __s, __s + _S_char_ptr_len(__s)); __result_pos = __result.index(); #ifndef __STL_OLD_ROPE_SEMANTICS if (__result_pos == size()) __result_pos = npos; #endif return __result_pos; } iterator mutable_begin() { return(iterator(this, 0)); } iterator mutable_end() { return(iterator(this, size())); } typedef std::reverse_iterator<iterator> reverse_iterator; reverse_iterator mutable_rbegin() { return reverse_iterator(mutable_end()); } reverse_iterator mutable_rend() { return reverse_iterator(mutable_begin()); } reference mutable_reference_at(size_type __pos) { return reference(this, __pos); } #ifdef __STD_STUFF reference operator[] (size_type __pos) { return _char_ref_proxy(this, __pos); } reference at(size_type __pos) { // if (__pos >= size()) throw out_of_range; // XXX return (*this)[__pos]; } void resize(size_type __n, _CharT __c) { } void resize(size_type __n) { } void reserve(size_type __res_arg = 0) { } size_type capacity() const { return max_size(); } // Stuff below this line is dangerous because it's error prone. // I would really like to get rid of it. // copy function with funny arg ordering. size_type copy(_CharT* __buffer, size_type __n, size_type __pos = 0) const { return copy(__pos, __n, __buffer); } iterator end() { return mutable_end(); } iterator begin() { return mutable_begin(); } reverse_iterator rend() { return mutable_rend(); } reverse_iterator rbegin() { return mutable_rbegin(); } #else const_iterator end() { return const_end(); } const_iterator begin() { return const_begin(); } const_reverse_iterator rend() { return const_rend(); } const_reverse_iterator rbegin() { return const_rbegin(); } #endif }; template <class _CharT, class _Alloc> const typename rope<_CharT, _Alloc>::size_type rope<_CharT, _Alloc>::npos = (size_type)(-1); template <class _CharT, class _Alloc> inline bool operator==(const _Rope_const_iterator<_CharT, _Alloc>& __x, const _Rope_const_iterator<_CharT, _Alloc>& __y) { return (__x._M_current_pos == __y._M_current_pos && __x._M_root == __y._M_root); } template <class _CharT, class _Alloc> inline bool operator<(const _Rope_const_iterator<_CharT, _Alloc>& __x, const _Rope_const_iterator<_CharT, _Alloc>& __y) { return (__x._M_current_pos < __y._M_current_pos); } template <class _CharT, class _Alloc> inline bool operator!=(const _Rope_const_iterator<_CharT, _Alloc>& __x, const _Rope_const_iterator<_CharT, _Alloc>& __y) { return !(__x == __y); } template <class _CharT, class _Alloc> inline bool operator>(const _Rope_const_iterator<_CharT, _Alloc>& __x, const _Rope_const_iterator<_CharT, _Alloc>& __y) { return __y < __x; } template <class _CharT, class _Alloc> inline bool operator<=(const _Rope_const_iterator<_CharT, _Alloc>& __x, const _Rope_const_iterator<_CharT, _Alloc>& __y) { return !(__y < __x); } template <class _CharT, class _Alloc> inline bool operator>=(const _Rope_const_iterator<_CharT, _Alloc>& __x, const _Rope_const_iterator<_CharT, _Alloc>& __y) { return !(__x < __y); } template <class _CharT, class _Alloc> inline ptrdiff_t operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x, const _Rope_const_iterator<_CharT, _Alloc>& __y) { return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; } template <class _CharT, class _Alloc> inline _Rope_const_iterator<_CharT, _Alloc> operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n) { return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root, __x._M_current_pos - __n); } template <class _CharT, class _Alloc> inline _Rope_const_iterator<_CharT, _Alloc> operator+(const _Rope_const_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n) { return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root, __x._M_current_pos + __n); } template <class _CharT, class _Alloc> inline _Rope_const_iterator<_CharT, _Alloc> operator+(ptrdiff_t __n, const _Rope_const_iterator<_CharT, _Alloc>& __x) { return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root, __x._M_current_pos + __n); } template <class _CharT, class _Alloc> inline bool operator==(const _Rope_iterator<_CharT, _Alloc>& __x, const _Rope_iterator<_CharT, _Alloc>& __y) {return (__x._M_current_pos == __y._M_current_pos && __x._M_root_rope == __y._M_root_rope); } template <class _CharT, class _Alloc> inline bool operator<(const _Rope_iterator<_CharT, _Alloc>& __x, const _Rope_iterator<_CharT, _Alloc>& __y) { return (__x._M_current_pos < __y._M_current_pos); } template <class _CharT, class _Alloc> inline bool operator!=(const _Rope_iterator<_CharT, _Alloc>& __x, const _Rope_iterator<_CharT, _Alloc>& __y) { return !(__x == __y); } template <class _CharT, class _Alloc> inline bool operator>(const _Rope_iterator<_CharT, _Alloc>& __x, const _Rope_iterator<_CharT, _Alloc>& __y) { return __y < __x; } template <class _CharT, class _Alloc> inline bool operator<=(const _Rope_iterator<_CharT, _Alloc>& __x, const _Rope_iterator<_CharT, _Alloc>& __y) { return !(__y < __x); } template <class _CharT, class _Alloc> inline bool operator>=(const _Rope_iterator<_CharT, _Alloc>& __x, const _Rope_iterator<_CharT, _Alloc>& __y) { return !(__x < __y); } template <class _CharT, class _Alloc> inline ptrdiff_t operator-(const _Rope_iterator<_CharT, _Alloc>& __x, const _Rope_iterator<_CharT, _Alloc>& __y) { return ((ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos); } template <class _CharT, class _Alloc> inline _Rope_iterator<_CharT, _Alloc> operator-(const _Rope_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n) { return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope, __x._M_current_pos - __n); } template <class _CharT, class _Alloc> inline _Rope_iterator<_CharT, _Alloc> operator+(const _Rope_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n) { return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope, __x._M_current_pos + __n); } template <class _CharT, class _Alloc> inline _Rope_iterator<_CharT, _Alloc> operator+(ptrdiff_t __n, const _Rope_iterator<_CharT, _Alloc>& __x) { return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope, __x._M_current_pos + __n); } template <class _CharT, class _Alloc> inline rope<_CharT, _Alloc> operator+(const rope<_CharT, _Alloc>& __left, const rope<_CharT, _Alloc>& __right) { // Inlining this should make it possible to keep __left and // __right in registers. typedef rope<_CharT, _Alloc> rope_type; return rope_type(rope_type::_S_concat(__left._M_tree_ptr, __right._M_tree_ptr)); } template <class _CharT, class _Alloc> inline rope<_CharT, _Alloc>& operator+=(rope<_CharT, _Alloc>& __left, const rope<_CharT, _Alloc>& __right) { __left.append(__right); return __left; } template <class _CharT, class _Alloc> inline rope<_CharT, _Alloc> operator+(const rope<_CharT, _Alloc>& __left, const _CharT* __right) { typedef rope<_CharT, _Alloc> rope_type; size_t __rlen = rope_type::_S_char_ptr_len(__right); return rope_type(rope_type::_S_concat_char_iter(__left._M_tree_ptr, __right, __rlen)); } template <class _CharT, class _Alloc> inline rope<_CharT, _Alloc>& operator+=(rope<_CharT, _Alloc>& __left, const _CharT* __right) { __left.append(__right); return __left; } template <class _CharT, class _Alloc> inline rope<_CharT, _Alloc> operator+(const rope<_CharT, _Alloc>& __left, _CharT __right) { typedef rope<_CharT, _Alloc> rope_type; return rope_type(rope_type::_S_concat_char_iter(__left._M_tree_ptr, &__right, 1)); } template <class _CharT, class _Alloc> inline rope<_CharT, _Alloc>& operator+=(rope<_CharT, _Alloc>& __left, _CharT __right) { __left.append(__right); return __left; } template <class _CharT, class _Alloc> bool operator<(const rope<_CharT, _Alloc>& __left, const rope<_CharT, _Alloc>& __right) { return __left.compare(__right) < 0; } template <class _CharT, class _Alloc> bool operator==(const rope<_CharT, _Alloc>& __left, const rope<_CharT, _Alloc>& __right) { return __left.compare(__right) == 0; } template <class _CharT, class _Alloc> inline bool operator==(const _Rope_char_ptr_proxy<_CharT, _Alloc>& __x, const _Rope_char_ptr_proxy<_CharT, _Alloc>& __y) { return (__x._M_pos == __y._M_pos && __x._M_root == __y._M_root); } template <class _CharT, class _Alloc> inline bool operator!=(const rope<_CharT, _Alloc>& __x, const rope<_CharT, _Alloc>& __y) { return !(__x == __y); } template <class _CharT, class _Alloc> inline bool operator>(const rope<_CharT, _Alloc>& __x, const rope<_CharT, _Alloc>& __y) { return __y < __x; } template <class _CharT, class _Alloc> inline bool operator<=(const rope<_CharT, _Alloc>& __x, const rope<_CharT, _Alloc>& __y) { return !(__y < __x); } template <class _CharT, class _Alloc> inline bool operator>=(const rope<_CharT, _Alloc>& __x, const rope<_CharT, _Alloc>& __y) { return !(__x < __y); } template <class _CharT, class _Alloc> inline bool operator!=(const _Rope_char_ptr_proxy<_CharT, _Alloc>& __x, const _Rope_char_ptr_proxy<_CharT, _Alloc>& __y) { return !(__x == __y); } template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __o, const rope<_CharT, _Alloc>& __r); typedef rope<char> crope; typedef rope<wchar_t> wrope; inline crope::reference __mutable_reference_at(crope& __c, size_t __i) { return __c.mutable_reference_at(__i); } inline wrope::reference __mutable_reference_at(wrope& __c, size_t __i) { return __c.mutable_reference_at(__i); } template <class _CharT, class _Alloc> inline void swap(rope<_CharT, _Alloc>& __x, rope<_CharT, _Alloc>& __y) { __x.swap(__y); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace namespace std _GLIBCXX_VISIBILITY(default) { namespace tr1 { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<> struct hash<__gnu_cxx::crope> { size_t operator()(const __gnu_cxx::crope& __str) const { size_t __size = __str.size(); if (0 == __size) return 0; return 13 * __str[0] + 5 * __str[__size - 1] + __size; } }; template<> struct hash<__gnu_cxx::wrope> { size_t operator()(const __gnu_cxx::wrope& __str) const { size_t __size = __str.size(); if (0 == __size) return 0; return 13 * __str[0] + 5 * __str[__size - 1] + __size; } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace tr1 } // namespace std # include <ext/ropeimpl.h> #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/rb_tree�������������������������������������������������������������������������������0000644�����������������00000006357�14763166027�0007761 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// rb_tree extension -*- C++ -*- // Copyright (C) 2002-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file ext/rb_tree * This file is a GNU extension to the Standard C++ Library (possibly * containing extensions from the HP/SGI STL subset). */ #ifndef _RB_TREE #define _RB_TREE 1 #pragma GCC system_header #include <bits/stl_tree.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using std::_Rb_tree; using std::allocator; // Class rb_tree is not part of the C++ standard. It is provided for // compatibility with the HP STL. /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template <class _Key, class _Value, class _KeyOfValue, class _Compare, class _Alloc = allocator<_Value> > struct rb_tree : public _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc> { typedef _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc> _Base; typedef typename _Base::allocator_type allocator_type; rb_tree(const _Compare& __comp = _Compare(), const allocator_type& __a = allocator_type()) : _Base(__comp, __a) { } ~rb_tree() { } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/stdio_filebuf.h�����������������������������������������������������������������������0000644�����������������00000012461�14763166027�0011374 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File descriptor layer for filebuf -*- C++ -*- // Copyright (C) 2002-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/stdio_filebuf.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _STDIO_FILEBUF_H #define _STDIO_FILEBUF_H 1 #pragma GCC system_header #include <fstream> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Provides a layer of compatibility for C/POSIX. * @ingroup io * * This GNU extension provides extensions for working with standard C * FILE*'s and POSIX file descriptors. It must be instantiated by the * user with the type of character used in the file stream, e.g., * stdio_filebuf<char>. */ template<typename _CharT, typename _Traits = std::char_traits<_CharT> > class stdio_filebuf : public std::basic_filebuf<_CharT, _Traits> { public: // Types: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; typedef std::size_t size_t; public: /** * deferred initialization */ stdio_filebuf() : std::basic_filebuf<_CharT, _Traits>() {} /** * @param __fd An open file descriptor. * @param __mode Same meaning as in a standard filebuf. * @param __size Optimal or preferred size of internal buffer, * in chars. * * This constructor associates a file stream buffer with an open * POSIX file descriptor. The file descriptor will be automatically * closed when the stdio_filebuf is closed/destroyed. */ stdio_filebuf(int __fd, std::ios_base::openmode __mode, size_t __size = static_cast<size_t>(BUFSIZ)); /** * @param __f An open @c FILE*. * @param __mode Same meaning as in a standard filebuf. * @param __size Optimal or preferred size of internal buffer, * in chars. Defaults to system's @c BUFSIZ. * * This constructor associates a file stream buffer with an open * C @c FILE*. The @c FILE* will not be automatically closed when the * stdio_filebuf is closed/destroyed. */ stdio_filebuf(std::__c_file* __f, std::ios_base::openmode __mode, size_t __size = static_cast<size_t>(BUFSIZ)); /** * Closes the external data stream if the file descriptor constructor * was used. */ virtual ~stdio_filebuf(); /** * @return The underlying file descriptor. * * Once associated with an external data stream, this function can be * used to access the underlying POSIX file descriptor. Note that * there is no way for the library to track what you do with the * descriptor, so be careful. */ int fd() { return this->_M_file.fd(); } /** * @return The underlying FILE*. * * This function can be used to access the underlying "C" file pointer. * Note that there is no way for the library to track what you do * with the file, so be careful. */ std::__c_file* file() { return this->_M_file.file(); } }; template<typename _CharT, typename _Traits> stdio_filebuf<_CharT, _Traits>::~stdio_filebuf() { } template<typename _CharT, typename _Traits> stdio_filebuf<_CharT, _Traits>:: stdio_filebuf(int __fd, std::ios_base::openmode __mode, size_t __size) { this->_M_file.sys_open(__fd, __mode); if (this->is_open()) { this->_M_mode = __mode; this->_M_buf_size = __size; this->_M_allocate_internal_buffer(); this->_M_reading = false; this->_M_writing = false; this->_M_set_buffer(-1); } } template<typename _CharT, typename _Traits> stdio_filebuf<_CharT, _Traits>:: stdio_filebuf(std::__c_file* __f, std::ios_base::openmode __mode, size_t __size) { this->_M_file.sys_open(__f, __mode); if (this->is_open()) { this->_M_mode = __mode; this->_M_buf_size = __size; this->_M_allocate_internal_buffer(); this->_M_reading = false; this->_M_writing = false; this->_M_set_buffer(-1); } } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/vstring.h�����������������������������������������������������������������������������0000644�����������������00000317700�14763166027�0010256 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Versatile string -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/vstring.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _VSTRING_H #define _VSTRING_H 1 #pragma GCC system_header #if __cplusplus >= 201103L #include <initializer_list> #endif #include <ext/vstring_util.h> #include <ext/rc_string_base.h> #include <ext/sso_string_base.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @class __versa_string vstring.h * @brief Template class __versa_string. * @ingroup extensions * * Data structure managing sequences of characters and * character-like objects. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> class __versa_string : private _Base<_CharT, _Traits, _Alloc> { typedef _Base<_CharT, _Traits, _Alloc> __vstring_base; typedef typename __vstring_base::_CharT_alloc_type _CharT_alloc_type; // Types: public: typedef _Traits traits_type; typedef typename _Traits::char_type value_type; typedef _Alloc allocator_type; typedef typename _CharT_alloc_type::size_type size_type; typedef typename _CharT_alloc_type::difference_type difference_type; typedef value_type& reference; typedef const value_type& const_reference; typedef typename _CharT_alloc_type::pointer pointer; typedef typename _CharT_alloc_type::const_pointer const_pointer; typedef __gnu_cxx::__normal_iterator<pointer, __versa_string> iterator; typedef __gnu_cxx::__normal_iterator<const_pointer, __versa_string> const_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<iterator> reverse_iterator; // Data Member (public): /// Value returned by various member functions when they fail. static const size_type npos = static_cast<size_type>(-1); private: size_type _M_check(size_type __pos, const char* __s) const { if (__pos > this->size()) std::__throw_out_of_range(__N(__s)); return __pos; } void _M_check_length(size_type __n1, size_type __n2, const char* __s) const { if (this->max_size() - (this->size() - __n1) < __n2) std::__throw_length_error(__N(__s)); } // NB: _M_limit doesn't check for a bad __pos value. size_type _M_limit(size_type __pos, size_type __off) const { const bool __testoff = __off < this->size() - __pos; return __testoff ? __off : this->size() - __pos; } // True if _Rep and source do not overlap. bool _M_disjunct(const _CharT* __s) const { return (std::less<const _CharT*>()(__s, this->_M_data()) || std::less<const _CharT*>()(this->_M_data() + this->size(), __s)); } // For the internal use we have functions similar to `begin'/`end' // but they do not call _M_leak. iterator _M_ibegin() const { return iterator(this->_M_data()); } iterator _M_iend() const { return iterator(this->_M_data() + this->_M_length()); } public: // Construct/copy/destroy: // NB: We overload ctors in some cases instead of using default // arguments, per 17.4.4.4 para. 2 item 2. /** * @brief Default constructor creates an empty string. */ __versa_string() : __vstring_base() { } /** * @brief Construct an empty string using allocator @a a. */ explicit __versa_string(const _Alloc& __a) : __vstring_base(__a) { } // NB: per LWG issue 42, semantics different from IS: /** * @brief Construct string with copy of value of @a __str. * @param __str Source string. */ __versa_string(const __versa_string& __str) : __vstring_base(__str) { } #if __cplusplus >= 201103L /** * @brief String move constructor. * @param __str Source string. * * The newly-constructed %string contains the exact contents of * @a __str. The contents of @a __str are a valid, but unspecified * string. */ __versa_string(__versa_string&& __str) noexcept : __vstring_base(std::move(__str)) { } /** * @brief Construct string from an initializer list. * @param __l std::initializer_list of characters. * @param __a Allocator to use (default is default allocator). */ __versa_string(std::initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) : __vstring_base(__l.begin(), __l.end(), __a) { } #endif /** * @brief Construct string as copy of a substring. * @param __str Source string. * @param __pos Index of first character to copy from. * @param __n Number of characters to copy (default remainder). */ __versa_string(const __versa_string& __str, size_type __pos, size_type __n = npos) : __vstring_base(__str._M_data() + __str._M_check(__pos, "__versa_string::__versa_string"), __str._M_data() + __str._M_limit(__pos, __n) + __pos, _Alloc()) { } /** * @brief Construct string as copy of a substring. * @param __str Source string. * @param __pos Index of first character to copy from. * @param __n Number of characters to copy. * @param __a Allocator to use. */ __versa_string(const __versa_string& __str, size_type __pos, size_type __n, const _Alloc& __a) : __vstring_base(__str._M_data() + __str._M_check(__pos, "__versa_string::__versa_string"), __str._M_data() + __str._M_limit(__pos, __n) + __pos, __a) { } /** * @brief Construct string initialized by a character array. * @param __s Source character array. * @param __n Number of characters to copy. * @param __a Allocator to use (default is default allocator). * * NB: @a __s must have at least @a __n characters, '\\0' has no special * meaning. */ __versa_string(const _CharT* __s, size_type __n, const _Alloc& __a = _Alloc()) : __vstring_base(__s, __s + __n, __a) { } /** * @brief Construct string as copy of a C string. * @param __s Source C string. * @param __a Allocator to use (default is default allocator). */ __versa_string(const _CharT* __s, const _Alloc& __a = _Alloc()) : __vstring_base(__s, __s ? __s + traits_type::length(__s) : __s + npos, __a) { } /** * @brief Construct string as multiple characters. * @param __n Number of characters. * @param __c Character to use. * @param __a Allocator to use (default is default allocator). */ __versa_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()) : __vstring_base(__n, __c, __a) { } /** * @brief Construct string as copy of a range. * @param __beg Start of range. * @param __end End of range. * @param __a Allocator to use (default is default allocator). */ #if __cplusplus >= 201103L template<class _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<class _InputIterator> #endif __versa_string(_InputIterator __beg, _InputIterator __end, const _Alloc& __a = _Alloc()) : __vstring_base(__beg, __end, __a) { } /** * @brief Destroy the string instance. */ ~__versa_string() _GLIBCXX_NOEXCEPT { } /** * @brief Assign the value of @a str to this string. * @param __str Source string. */ __versa_string& operator=(const __versa_string& __str) { return this->assign(__str); } #if __cplusplus >= 201103L /** * @brief String move assignment operator. * @param __str Source string. * * The contents of @a __str are moved into this string (without * copying). @a __str is a valid, but unspecified string. */ __versa_string& operator=(__versa_string&& __str) { // NB: DR 1204. this->swap(__str); return *this; } /** * @brief Set value to string constructed from initializer list. * @param __l std::initializer_list. */ __versa_string& operator=(std::initializer_list<_CharT> __l) { this->assign(__l.begin(), __l.end()); return *this; } #endif /** * @brief Copy contents of @a __s into this string. * @param __s Source null-terminated string. */ __versa_string& operator=(const _CharT* __s) { return this->assign(__s); } /** * @brief Set value to string of length 1. * @param __c Source character. * * Assigning to a character makes this string length 1 and * (*this)[0] == @a __c. */ __versa_string& operator=(_CharT __c) { this->assign(1, __c); return *this; } // Iterators: /** * Returns a read/write iterator that points to the first character in * the %string. Unshares the string. */ iterator begin() _GLIBCXX_NOEXCEPT { this->_M_leak(); return iterator(this->_M_data()); } /** * Returns a read-only (constant) iterator that points to the first * character in the %string. */ const_iterator begin() const _GLIBCXX_NOEXCEPT { return const_iterator(this->_M_data()); } /** * Returns a read/write iterator that points one past the last * character in the %string. Unshares the string. */ iterator end() _GLIBCXX_NOEXCEPT { this->_M_leak(); return iterator(this->_M_data() + this->size()); } /** * Returns a read-only (constant) iterator that points one past the * last character in the %string. */ const_iterator end() const _GLIBCXX_NOEXCEPT { return const_iterator(this->_M_data() + this->size()); } /** * Returns a read/write reverse iterator that points to the last * character in the %string. Iteration is done in reverse element * order. Unshares the string. */ reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(this->end()); } /** * Returns a read-only (constant) reverse iterator that points * to the last character in the %string. Iteration is done in * reverse element order. */ const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(this->end()); } /** * Returns a read/write reverse iterator that points to one before the * first character in the %string. Iteration is done in reverse * element order. Unshares the string. */ reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(this->begin()); } /** * Returns a read-only (constant) reverse iterator that points * to one before the first character in the %string. Iteration * is done in reverse element order. */ const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(this->begin()); } #if __cplusplus >= 201103L /** * Returns a read-only (constant) iterator that points to the first * character in the %string. */ const_iterator cbegin() const noexcept { return const_iterator(this->_M_data()); } /** * Returns a read-only (constant) iterator that points one past the * last character in the %string. */ const_iterator cend() const noexcept { return const_iterator(this->_M_data() + this->size()); } /** * Returns a read-only (constant) reverse iterator that points * to the last character in the %string. Iteration is done in * reverse element order. */ const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(this->end()); } /** * Returns a read-only (constant) reverse iterator that points * to one before the first character in the %string. Iteration * is done in reverse element order. */ const_reverse_iterator crend() const noexcept { return const_reverse_iterator(this->begin()); } #endif public: // Capacity: /// Returns the number of characters in the string, not including any /// null-termination. size_type size() const _GLIBCXX_NOEXCEPT { return this->_M_length(); } /// Returns the number of characters in the string, not including any /// null-termination. size_type length() const _GLIBCXX_NOEXCEPT { return this->_M_length(); } /// Returns the size() of the largest possible %string. size_type max_size() const _GLIBCXX_NOEXCEPT { return this->_M_max_size(); } /** * @brief Resizes the %string to the specified number of characters. * @param __n Number of characters the %string should contain. * @param __c Character to fill any new elements. * * This function will %resize the %string to the specified * number of characters. If the number is smaller than the * %string's current size the %string is truncated, otherwise * the %string is extended and new elements are set to @a __c. */ void resize(size_type __n, _CharT __c); /** * @brief Resizes the %string to the specified number of characters. * @param __n Number of characters the %string should contain. * * This function will resize the %string to the specified * length. If the new size is smaller than the %string's * current size the %string is truncated, otherwise the %string * is extended and new characters are default-constructed. For * basic types such as char, this means setting them to 0. */ void resize(size_type __n) { this->resize(__n, _CharT()); } #if __cplusplus >= 201103L /// A non-binding request to reduce capacity() to size(). void shrink_to_fit() { if (capacity() > size()) { __try { this->reserve(0); } __catch(...) { } } } #endif /** * Returns the total number of characters that the %string can * hold before needing to allocate more memory. */ size_type capacity() const _GLIBCXX_NOEXCEPT { return this->_M_capacity(); } /** * @brief Attempt to preallocate enough memory for specified number of * characters. * @param __res_arg Number of characters required. * @throw std::length_error If @a __res_arg exceeds @c max_size(). * * This function attempts to reserve enough memory for the * %string to hold the specified number of characters. If the * number requested is more than max_size(), length_error is * thrown. * * The advantage of this function is that if optimal code is a * necessity and the user can determine the string length that * will be required, the user can reserve the memory in * %advance, and thus prevent a possible reallocation of memory * and copying of %string data. */ void reserve(size_type __res_arg = 0) { this->_M_reserve(__res_arg); } /** * Erases the string, making it empty. */ void clear() _GLIBCXX_NOEXCEPT { this->_M_clear(); } /** * Returns true if the %string is empty. Equivalent to * <code>*this == ""</code>. */ bool empty() const _GLIBCXX_NOEXCEPT { return this->size() == 0; } // Element access: /** * @brief Subscript access to the data contained in the %string. * @param __pos The index of the character to access. * @return Read-only (constant) reference to the character. * * This operator allows for easy, array-style, data access. * Note that data access with this operator is unchecked and * out_of_range lookups are not defined. (For checked lookups * see at().) */ const_reference operator[] (size_type __pos) const { _GLIBCXX_DEBUG_ASSERT(__pos <= this->size()); return this->_M_data()[__pos]; } /** * @brief Subscript access to the data contained in the %string. * @param __pos The index of the character to access. * @return Read/write reference to the character. * * This operator allows for easy, array-style, data access. * Note that data access with this operator is unchecked and * out_of_range lookups are not defined. (For checked lookups * see at().) Unshares the string. */ reference operator[](size_type __pos) { // allow pos == size() as v3 extension: _GLIBCXX_DEBUG_ASSERT(__pos <= this->size()); // but be strict in pedantic mode: _GLIBCXX_DEBUG_PEDASSERT(__pos < this->size()); this->_M_leak(); return this->_M_data()[__pos]; } /** * @brief Provides access to the data contained in the %string. * @param __n The index of the character to access. * @return Read-only (const) reference to the character. * @throw std::out_of_range If @a __n is an invalid index. * * This function provides for safer data access. The parameter * is first checked that it is in the range of the string. The * function throws out_of_range if the check fails. */ const_reference at(size_type __n) const { if (__n >= this->size()) std::__throw_out_of_range(__N("__versa_string::at")); return this->_M_data()[__n]; } /** * @brief Provides access to the data contained in the %string. * @param __n The index of the character to access. * @return Read/write reference to the character. * @throw std::out_of_range If @a __n is an invalid index. * * This function provides for safer data access. The parameter * is first checked that it is in the range of the string. The * function throws out_of_range if the check fails. Success * results in unsharing the string. */ reference at(size_type __n) { if (__n >= this->size()) std::__throw_out_of_range(__N("__versa_string::at")); this->_M_leak(); return this->_M_data()[__n]; } #if __cplusplus >= 201103L /** * Returns a read/write reference to the data at the first * element of the %string. */ reference front() { return operator[](0); } /** * Returns a read-only (constant) reference to the data at the first * element of the %string. */ const_reference front() const { return operator[](0); } /** * Returns a read/write reference to the data at the last * element of the %string. */ reference back() { return operator[](this->size() - 1); } /** * Returns a read-only (constant) reference to the data at the * last element of the %string. */ const_reference back() const { return operator[](this->size() - 1); } #endif // Modifiers: /** * @brief Append a string to this string. * @param __str The string to append. * @return Reference to this string. */ __versa_string& operator+=(const __versa_string& __str) { return this->append(__str); } /** * @brief Append a C string. * @param __s The C string to append. * @return Reference to this string. */ __versa_string& operator+=(const _CharT* __s) { return this->append(__s); } /** * @brief Append a character. * @param __c The character to append. * @return Reference to this string. */ __versa_string& operator+=(_CharT __c) { this->push_back(__c); return *this; } #if __cplusplus >= 201103L /** * @brief Append an initializer_list of characters. * @param __l The initializer_list of characters to be appended. * @return Reference to this string. */ __versa_string& operator+=(std::initializer_list<_CharT> __l) { return this->append(__l.begin(), __l.end()); } #endif // C++11 /** * @brief Append a string to this string. * @param __str The string to append. * @return Reference to this string. */ __versa_string& append(const __versa_string& __str) { return _M_append(__str._M_data(), __str.size()); } /** * @brief Append a substring. * @param __str The string to append. * @param __pos Index of the first character of str to append. * @param __n The number of characters to append. * @return Reference to this string. * @throw std::out_of_range if @a pos is not a valid index. * * This function appends @a __n characters from @a __str * starting at @a __pos to this string. If @a __n is is larger * than the number of available characters in @a __str, the * remainder of @a __str is appended. */ __versa_string& append(const __versa_string& __str, size_type __pos, size_type __n) { return _M_append(__str._M_data() + __str._M_check(__pos, "__versa_string::append"), __str._M_limit(__pos, __n)); } /** * @brief Append a C substring. * @param __s The C string to append. * @param __n The number of characters to append. * @return Reference to this string. */ __versa_string& append(const _CharT* __s, size_type __n) { __glibcxx_requires_string_len(__s, __n); _M_check_length(size_type(0), __n, "__versa_string::append"); return _M_append(__s, __n); } /** * @brief Append a C string. * @param __s The C string to append. * @return Reference to this string. */ __versa_string& append(const _CharT* __s) { __glibcxx_requires_string(__s); const size_type __n = traits_type::length(__s); _M_check_length(size_type(0), __n, "__versa_string::append"); return _M_append(__s, __n); } /** * @brief Append multiple characters. * @param __n The number of characters to append. * @param __c The character to use. * @return Reference to this string. * * Appends n copies of c to this string. */ __versa_string& append(size_type __n, _CharT __c) { return _M_replace_aux(this->size(), size_type(0), __n, __c); } #if __cplusplus >= 201103L /** * @brief Append an initializer_list of characters. * @param __l The initializer_list of characters to append. * @return Reference to this string. */ __versa_string& append(std::initializer_list<_CharT> __l) { return this->append(__l.begin(), __l.end()); } #endif // C++11 /** * @brief Append a range of characters. * @param __first Iterator referencing the first character to append. * @param __last Iterator marking the end of the range. * @return Reference to this string. * * Appends characters in the range [first,last) to this string. */ #if __cplusplus >= 201103L template<class _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<class _InputIterator> #endif __versa_string& append(_InputIterator __first, _InputIterator __last) { return this->replace(_M_iend(), _M_iend(), __first, __last); } /** * @brief Append a single character. * @param __c Character to append. */ void push_back(_CharT __c) { const size_type __size = this->size(); if (__size + 1 > this->capacity() || this->_M_is_shared()) this->_M_mutate(__size, size_type(0), 0, size_type(1)); traits_type::assign(this->_M_data()[__size], __c); this->_M_set_length(__size + 1); } /** * @brief Set value to contents of another string. * @param __str Source string to use. * @return Reference to this string. */ __versa_string& assign(const __versa_string& __str) { this->_M_assign(__str); return *this; } #if __cplusplus >= 201103L /** * @brief Set value to contents of another string. * @param __str Source string to use. * @return Reference to this string. * * This function sets this string to the exact contents of @a __str. * @a __str is a valid, but unspecified string. */ __versa_string& assign(__versa_string&& __str) { this->swap(__str); return *this; } #endif // C++11 /** * @brief Set value to a substring of a string. * @param __str The string to use. * @param __pos Index of the first character of str. * @param __n Number of characters to use. * @return Reference to this string. * @throw std::out_of_range if @a __pos is not a valid index. * * This function sets this string to the substring of @a __str * consisting of @a __n characters at @a __pos. If @a __n is * is larger than the number of available characters in @a * __str, the remainder of @a __str is used. */ __versa_string& assign(const __versa_string& __str, size_type __pos, size_type __n) { return _M_replace(size_type(0), this->size(), __str._M_data() + __str._M_check(__pos, "__versa_string::assign"), __str._M_limit(__pos, __n)); } /** * @brief Set value to a C substring. * @param __s The C string to use. * @param __n Number of characters to use. * @return Reference to this string. * * This function sets the value of this string to the first @a * __n characters of @a __s. If @a __n is is larger than the * number of available characters in @a __s, the remainder of * @a __s is used. */ __versa_string& assign(const _CharT* __s, size_type __n) { __glibcxx_requires_string_len(__s, __n); return _M_replace(size_type(0), this->size(), __s, __n); } /** * @brief Set value to contents of a C string. * @param __s The C string to use. * @return Reference to this string. * * This function sets the value of this string to the value of * @a __s. The data is copied, so there is no dependence on @a * __s once the function returns. */ __versa_string& assign(const _CharT* __s) { __glibcxx_requires_string(__s); return _M_replace(size_type(0), this->size(), __s, traits_type::length(__s)); } /** * @brief Set value to multiple characters. * @param __n Length of the resulting string. * @param __c The character to use. * @return Reference to this string. * * This function sets the value of this string to @a __n copies of * character @a __c. */ __versa_string& assign(size_type __n, _CharT __c) { return _M_replace_aux(size_type(0), this->size(), __n, __c); } /** * @brief Set value to a range of characters. * @param __first Iterator referencing the first character to append. * @param __last Iterator marking the end of the range. * @return Reference to this string. * * Sets value of string to characters in the range * [first,last). */ #if __cplusplus >= 201103L template<class _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<class _InputIterator> #endif __versa_string& assign(_InputIterator __first, _InputIterator __last) { return this->replace(_M_ibegin(), _M_iend(), __first, __last); } #if __cplusplus >= 201103L /** * @brief Set value to an initializer_list of characters. * @param __l The initializer_list of characters to assign. * @return Reference to this string. */ __versa_string& assign(std::initializer_list<_CharT> __l) { return this->assign(__l.begin(), __l.end()); } #endif // C++11 /** * @brief Insert multiple characters. * @param __p Iterator referencing location in string to insert at. * @param __n Number of characters to insert * @param __c The character to insert. * @throw std::length_error If new length exceeds @c max_size(). * * Inserts @a __n copies of character @a __c starting at the * position referenced by iterator @a __p. If adding * characters causes the length to exceed max_size(), * length_error is thrown. The value of the string doesn't * change if an error is thrown. */ void insert(iterator __p, size_type __n, _CharT __c) { this->replace(__p, __p, __n, __c); } /** * @brief Insert a range of characters. * @param __p Iterator referencing location in string to insert at. * @param __beg Start of range. * @param __end End of range. * @throw std::length_error If new length exceeds @c max_size(). * * Inserts characters in range [beg,end). If adding characters * causes the length to exceed max_size(), length_error is * thrown. The value of the string doesn't change if an error * is thrown. */ #if __cplusplus >= 201103L template<class _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<class _InputIterator> #endif void insert(iterator __p, _InputIterator __beg, _InputIterator __end) { this->replace(__p, __p, __beg, __end); } #if __cplusplus >= 201103L /** * @brief Insert an initializer_list of characters. * @param __p Iterator referencing location in string to insert at. * @param __l The initializer_list of characters to insert. * @throw std::length_error If new length exceeds @c max_size(). */ void insert(iterator __p, std::initializer_list<_CharT> __l) { this->insert(__p, __l.begin(), __l.end()); } #endif // C++11 /** * @brief Insert value of a string. * @param __pos1 Iterator referencing location in string to insert at. * @param __str The string to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * * Inserts value of @a __str starting at @a __pos1. If adding * characters causes the length to exceed max_size(), * length_error is thrown. The value of the string doesn't * change if an error is thrown. */ __versa_string& insert(size_type __pos1, const __versa_string& __str) { return this->replace(__pos1, size_type(0), __str._M_data(), __str.size()); } /** * @brief Insert a substring. * @param __pos1 Iterator referencing location in string to insert at. * @param __str The string to insert. * @param __pos2 Start of characters in str to insert. * @param __n Number of characters to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * @throw std::out_of_range If @a __pos1 > size() or * @a __pos2 > @a __str.size(). * * Starting at @a __pos1, insert @a __n character of @a __str * beginning with @a __pos2. If adding characters causes the * length to exceed max_size(), length_error is thrown. If @a * __pos1 is beyond the end of this string or @a __pos2 is * beyond the end of @a __str, out_of_range is thrown. The * value of the string doesn't change if an error is thrown. */ __versa_string& insert(size_type __pos1, const __versa_string& __str, size_type __pos2, size_type __n) { return this->replace(__pos1, size_type(0), __str._M_data() + __str._M_check(__pos2, "__versa_string::insert"), __str._M_limit(__pos2, __n)); } /** * @brief Insert a C substring. * @param __pos Iterator referencing location in string to insert at. * @param __s The C string to insert. * @param __n The number of characters to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * @throw std::out_of_range If @a __pos is beyond the end of this * string. * * Inserts the first @a __n characters of @a __s starting at @a * __pos. If adding characters causes the length to exceed * max_size(), length_error is thrown. If @a __pos is beyond * end(), out_of_range is thrown. The value of the string * doesn't change if an error is thrown. */ __versa_string& insert(size_type __pos, const _CharT* __s, size_type __n) { return this->replace(__pos, size_type(0), __s, __n); } /** * @brief Insert a C string. * @param __pos Iterator referencing location in string to insert at. * @param __s The C string to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * @throw std::out_of_range If @a __pos is beyond the end of this * string. * * Inserts the first @a __n characters of @a __s starting at @a * __pos. If adding characters causes the length to exceed * max_size(), length_error is thrown. If @a __pos is beyond * end(), out_of_range is thrown. The value of the string * doesn't change if an error is thrown. */ __versa_string& insert(size_type __pos, const _CharT* __s) { __glibcxx_requires_string(__s); return this->replace(__pos, size_type(0), __s, traits_type::length(__s)); } /** * @brief Insert multiple characters. * @param __pos Index in string to insert at. * @param __n Number of characters to insert * @param __c The character to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * @throw std::out_of_range If @a __pos is beyond the end of this * string. * * Inserts @a __n copies of character @a __c starting at index * @a __pos. If adding characters causes the length to exceed * max_size(), length_error is thrown. If @a __pos > length(), * out_of_range is thrown. The value of the string doesn't * change if an error is thrown. */ __versa_string& insert(size_type __pos, size_type __n, _CharT __c) { return _M_replace_aux(_M_check(__pos, "__versa_string::insert"), size_type(0), __n, __c); } /** * @brief Insert one character. * @param __p Iterator referencing position in string to insert at. * @param __c The character to insert. * @return Iterator referencing newly inserted char. * @throw std::length_error If new length exceeds @c max_size(). * * Inserts character @a __c at position referenced by @a __p. * If adding character causes the length to exceed max_size(), * length_error is thrown. If @a __p is beyond end of string, * out_of_range is thrown. The value of the string doesn't * change if an error is thrown. */ iterator insert(iterator __p, _CharT __c) { _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend()); const size_type __pos = __p - _M_ibegin(); _M_replace_aux(__pos, size_type(0), size_type(1), __c); this->_M_set_leaked(); return iterator(this->_M_data() + __pos); } /** * @brief Remove characters. * @param __pos Index of first character to remove (default 0). * @param __n Number of characters to remove (default remainder). * @return Reference to this string. * @throw std::out_of_range If @a __pos is beyond the end of this * string. * * Removes @a __n characters from this string starting at @a * __pos. The length of the string is reduced by @a __n. If * there are < @a __n characters to remove, the remainder of * the string is truncated. If @a __p is beyond end of string, * out_of_range is thrown. The value of the string doesn't * change if an error is thrown. */ __versa_string& erase(size_type __pos = 0, size_type __n = npos) { this->_M_erase(_M_check(__pos, "__versa_string::erase"), _M_limit(__pos, __n)); return *this; } /** * @brief Remove one character. * @param __position Iterator referencing the character to remove. * @return iterator referencing same location after removal. * * Removes the character at @a __position from this string. The * value of the string doesn't change if an error is thrown. */ iterator erase(iterator __position) { _GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin() && __position < _M_iend()); const size_type __pos = __position - _M_ibegin(); this->_M_erase(__pos, size_type(1)); this->_M_set_leaked(); return iterator(this->_M_data() + __pos); } /** * @brief Remove a range of characters. * @param __first Iterator referencing the first character to remove. * @param __last Iterator referencing the end of the range. * @return Iterator referencing location of first after removal. * * Removes the characters in the range [first,last) from this * string. The value of the string doesn't change if an error * is thrown. */ iterator erase(iterator __first, iterator __last) { _GLIBCXX_DEBUG_PEDASSERT(__first >= _M_ibegin() && __first <= __last && __last <= _M_iend()); const size_type __pos = __first - _M_ibegin(); this->_M_erase(__pos, __last - __first); this->_M_set_leaked(); return iterator(this->_M_data() + __pos); } #if __cplusplus >= 201103L /** * @brief Remove the last character. * * The string must be non-empty. */ void pop_back() { this->_M_erase(size()-1, 1); } #endif // C++11 /** * @brief Replace characters with value from another string. * @param __pos Index of first character to replace. * @param __n Number of characters to be replaced. * @param __str String to insert. * @return Reference to this string. * @throw std::out_of_range If @a __pos is beyond the end of this * string. * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [pos,pos+n) from this * string. In place, the value of @a __str is inserted. If @a * __pos is beyond end of string, out_of_range is thrown. If * the length of the result exceeds max_size(), length_error is * thrown. The value of the string doesn't change if an error * is thrown. */ __versa_string& replace(size_type __pos, size_type __n, const __versa_string& __str) { return this->replace(__pos, __n, __str._M_data(), __str.size()); } /** * @brief Replace characters with value from another string. * @param __pos1 Index of first character to replace. * @param __n1 Number of characters to be replaced. * @param __str String to insert. * @param __pos2 Index of first character of str to use. * @param __n2 Number of characters from str to use. * @return Reference to this string. * @throw std::out_of_range If @a __pos1 > size() or @a __pos2 > * str.size(). * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [pos1,pos1 + n) from * this string. In place, the value of @a __str is inserted. * If @a __pos is beyond end of string, out_of_range is thrown. * If the length of the result exceeds max_size(), length_error * is thrown. The value of the string doesn't change if an * error is thrown. */ __versa_string& replace(size_type __pos1, size_type __n1, const __versa_string& __str, size_type __pos2, size_type __n2) { return this->replace(__pos1, __n1, __str._M_data() + __str._M_check(__pos2, "__versa_string::replace"), __str._M_limit(__pos2, __n2)); } /** * @brief Replace characters with value of a C substring. * @param __pos Index of first character to replace. * @param __n1 Number of characters to be replaced. * @param __s C string to insert. * @param __n2 Number of characters from @a __s to use. * @return Reference to this string. * @throw std::out_of_range If @a __pos1 > size(). * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [pos,pos + n1) from this * string. In place, the first @a __n2 characters of @a __s * are inserted, or all of @a __s if @a __n2 is too large. If * @a __pos is beyond end of string, out_of_range is thrown. * If the length of result exceeds max_size(), length_error is * thrown. The value of the string doesn't change if an error * is thrown. */ __versa_string& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) { __glibcxx_requires_string_len(__s, __n2); return _M_replace(_M_check(__pos, "__versa_string::replace"), _M_limit(__pos, __n1), __s, __n2); } /** * @brief Replace characters with value of a C string. * @param __pos Index of first character to replace. * @param __n1 Number of characters to be replaced. * @param __s C string to insert. * @return Reference to this string. * @throw std::out_of_range If @a __pos > size(). * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [pos,pos + n1) from this * string. In place, the characters of @a __s are inserted. If * @a pos is beyond end of string, out_of_range is thrown. If * the length of result exceeds max_size(), length_error is thrown. * The value of the string doesn't change if an error is thrown. */ __versa_string& replace(size_type __pos, size_type __n1, const _CharT* __s) { __glibcxx_requires_string(__s); return this->replace(__pos, __n1, __s, traits_type::length(__s)); } /** * @brief Replace characters with multiple characters. * @param __pos Index of first character to replace. * @param __n1 Number of characters to be replaced. * @param __n2 Number of characters to insert. * @param __c Character to insert. * @return Reference to this string. * @throw std::out_of_range If @a __pos > size(). * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [pos,pos + n1) from this * string. In place, @a __n2 copies of @a __c are inserted. * If @a __pos is beyond end of string, out_of_range is thrown. * If the length of result exceeds max_size(), length_error is * thrown. The value of the string doesn't change if an error * is thrown. */ __versa_string& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) { return _M_replace_aux(_M_check(__pos, "__versa_string::replace"), _M_limit(__pos, __n1), __n2, __c); } /** * @brief Replace range of characters with string. * @param __i1 Iterator referencing start of range to replace. * @param __i2 Iterator referencing end of range to replace. * @param __str String value to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [i1,i2). In place, the * value of @a __str is inserted. If the length of result * exceeds max_size(), length_error is thrown. The value of * the string doesn't change if an error is thrown. */ __versa_string& replace(iterator __i1, iterator __i2, const __versa_string& __str) { return this->replace(__i1, __i2, __str._M_data(), __str.size()); } /** * @brief Replace range of characters with C substring. * @param __i1 Iterator referencing start of range to replace. * @param __i2 Iterator referencing end of range to replace. * @param __s C string value to insert. * @param __n Number of characters from s to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [i1,i2). In place, the * first @a n characters of @a __s are inserted. If the length * of result exceeds max_size(), length_error is thrown. The * value of the string doesn't change if an error is thrown. */ __versa_string& replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n) { _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 && __i2 <= _M_iend()); return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n); } /** * @brief Replace range of characters with C string. * @param __i1 Iterator referencing start of range to replace. * @param __i2 Iterator referencing end of range to replace. * @param __s C string value to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [i1,i2). In place, the * characters of @a __s are inserted. If the length of result * exceeds max_size(), length_error is thrown. The value of * the string doesn't change if an error is thrown. */ __versa_string& replace(iterator __i1, iterator __i2, const _CharT* __s) { __glibcxx_requires_string(__s); return this->replace(__i1, __i2, __s, traits_type::length(__s)); } /** * @brief Replace range of characters with multiple characters * @param __i1 Iterator referencing start of range to replace. * @param __i2 Iterator referencing end of range to replace. * @param __n Number of characters to insert. * @param __c Character to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [i1,i2). In place, @a * __n copies of @a __c are inserted. If the length of result * exceeds max_size(), length_error is thrown. The value of * the string doesn't change if an error is thrown. */ __versa_string& replace(iterator __i1, iterator __i2, size_type __n, _CharT __c) { _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 && __i2 <= _M_iend()); return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c); } /** * @brief Replace range of characters with range. * @param __i1 Iterator referencing start of range to replace. * @param __i2 Iterator referencing end of range to replace. * @param __k1 Iterator referencing start of range to insert. * @param __k2 Iterator referencing end of range to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [i1,i2). In place, * characters in the range [k1,k2) are inserted. If the length * of result exceeds max_size(), length_error is thrown. The * value of the string doesn't change if an error is thrown. */ #if __cplusplus >= 201103L template<class _InputIterator, typename = std::_RequireInputIter<_InputIterator>> __versa_string& replace(iterator __i1, iterator __i2, _InputIterator __k1, _InputIterator __k2) { _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 && __i2 <= _M_iend()); __glibcxx_requires_valid_range(__k1, __k2); return this->_M_replace_dispatch(__i1, __i2, __k1, __k2, std::__false_type()); } #else template<class _InputIterator> __versa_string& replace(iterator __i1, iterator __i2, _InputIterator __k1, _InputIterator __k2) { _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 && __i2 <= _M_iend()); __glibcxx_requires_valid_range(__k1, __k2); typedef typename std::__is_integer<_InputIterator>::__type _Integral; return this->_M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral()); } #endif // Specializations for the common case of pointer and iterator: // useful to avoid the overhead of temporary buffering in _M_replace. __versa_string& replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2) { _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 && __i2 <= _M_iend()); __glibcxx_requires_valid_range(__k1, __k2); return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __k1, __k2 - __k1); } __versa_string& replace(iterator __i1, iterator __i2, const _CharT* __k1, const _CharT* __k2) { _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 && __i2 <= _M_iend()); __glibcxx_requires_valid_range(__k1, __k2); return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __k1, __k2 - __k1); } __versa_string& replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2) { _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 && __i2 <= _M_iend()); __glibcxx_requires_valid_range(__k1, __k2); return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __k1.base(), __k2 - __k1); } __versa_string& replace(iterator __i1, iterator __i2, const_iterator __k1, const_iterator __k2) { _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 && __i2 <= _M_iend()); __glibcxx_requires_valid_range(__k1, __k2); return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __k1.base(), __k2 - __k1); } #if __cplusplus >= 201103L /** * @brief Replace range of characters with initializer_list. * @param __i1 Iterator referencing start of range to replace. * @param __i2 Iterator referencing end of range to replace. * @param __l The initializer_list of characters to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [i1,i2). In place, * characters in the range [k1,k2) are inserted. If the length * of result exceeds max_size(), length_error is thrown. The * value of the string doesn't change if an error is thrown. */ __versa_string& replace(iterator __i1, iterator __i2, std::initializer_list<_CharT> __l) { return this->replace(__i1, __i2, __l.begin(), __l.end()); } #endif // C++11 private: template<class _Integer> __versa_string& _M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n, _Integer __val, std::__true_type) { return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); } template<class _InputIterator> __versa_string& _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1, _InputIterator __k2, std::__false_type); __versa_string& _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, _CharT __c); __versa_string& _M_replace(size_type __pos, size_type __len1, const _CharT* __s, const size_type __len2); __versa_string& _M_append(const _CharT* __s, size_type __n); public: /** * @brief Copy substring into C string. * @param __s C string to copy value into. * @param __n Number of characters to copy. * @param __pos Index of first character to copy. * @return Number of characters actually copied * @throw std::out_of_range If pos > size(). * * Copies up to @a __n characters starting at @a __pos into the * C string @a s. If @a __pos is greater than size(), * out_of_range is thrown. */ size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const; /** * @brief Swap contents with another string. * @param __s String to swap with. * * Exchanges the contents of this string with that of @a __s in * constant time. */ void swap(__versa_string& __s) { this->_M_swap(__s); } // String operations: /** * @brief Return const pointer to null-terminated contents. * * This is a handle to internal data. Do not modify or dire things may * happen. */ const _CharT* c_str() const _GLIBCXX_NOEXCEPT { return this->_M_data(); } /** * @brief Return const pointer to contents. * * This is a handle to internal data. Do not modify or dire things may * happen. */ const _CharT* data() const _GLIBCXX_NOEXCEPT { return this->_M_data(); } /** * @brief Return copy of allocator used to construct this string. */ allocator_type get_allocator() const _GLIBCXX_NOEXCEPT { return allocator_type(this->_M_get_allocator()); } /** * @brief Find position of a C substring. * @param __s C string to locate. * @param __pos Index of character to search from. * @param __n Number of characters from @a __s to search for. * @return Index of start of first occurrence. * * Starting from @a __pos, searches forward for the first @a * __n characters in @a __s within this string. If found, * returns the index where it begins. If not found, returns * npos. */ size_type find(const _CharT* __s, size_type __pos, size_type __n) const; /** * @brief Find position of a string. * @param __str String to locate. * @param __pos Index of character to search from (default 0). * @return Index of start of first occurrence. * * Starting from @a __pos, searches forward for value of @a * __str within this string. If found, returns the index where * it begins. If not found, returns npos. */ size_type find(const __versa_string& __str, size_type __pos = 0) const _GLIBCXX_NOEXCEPT { return this->find(__str.data(), __pos, __str.size()); } /** * @brief Find position of a C string. * @param __s C string to locate. * @param __pos Index of character to search from (default 0). * @return Index of start of first occurrence. * * Starting from @a __pos, searches forward for the value of @a * __s within this string. If found, returns the index where * it begins. If not found, returns npos. */ size_type find(const _CharT* __s, size_type __pos = 0) const { __glibcxx_requires_string(__s); return this->find(__s, __pos, traits_type::length(__s)); } /** * @brief Find position of a character. * @param __c Character to locate. * @param __pos Index of character to search from (default 0). * @return Index of first occurrence. * * Starting from @a __pos, searches forward for @a __c within * this string. If found, returns the index where it was * found. If not found, returns npos. */ size_type find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT; /** * @brief Find last position of a string. * @param __str String to locate. * @param __pos Index of character to search back from (default end). * @return Index of start of last occurrence. * * Starting from @a __pos, searches backward for value of @a * __str within this string. If found, returns the index where * it begins. If not found, returns npos. */ size_type rfind(const __versa_string& __str, size_type __pos = npos) const _GLIBCXX_NOEXCEPT { return this->rfind(__str.data(), __pos, __str.size()); } /** * @brief Find last position of a C substring. * @param __s C string to locate. * @param __pos Index of character to search back from. * @param __n Number of characters from s to search for. * @return Index of start of last occurrence. * * Starting from @a __pos, searches backward for the first @a * __n characters in @a __s within this string. If found, * returns the index where it begins. If not found, returns * npos. */ size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const; /** * @brief Find last position of a C string. * @param __s C string to locate. * @param __pos Index of character to start search at (default end). * @return Index of start of last occurrence. * * Starting from @a __pos, searches backward for the value of * @a __s within this string. If found, returns the index * where it begins. If not found, returns npos. */ size_type rfind(const _CharT* __s, size_type __pos = npos) const { __glibcxx_requires_string(__s); return this->rfind(__s, __pos, traits_type::length(__s)); } /** * @brief Find last position of a character. * @param __c Character to locate. * @param __pos Index of character to search back from (default end). * @return Index of last occurrence. * * Starting from @a __pos, searches backward for @a __c within * this string. If found, returns the index where it was * found. If not found, returns npos. */ size_type rfind(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT; /** * @brief Find position of a character of string. * @param __str String containing characters to locate. * @param __pos Index of character to search from (default 0). * @return Index of first occurrence. * * Starting from @a __pos, searches forward for one of the characters of * @a __str within this string. If found, returns the index where it was * found. If not found, returns npos. */ size_type find_first_of(const __versa_string& __str, size_type __pos = 0) const _GLIBCXX_NOEXCEPT { return this->find_first_of(__str.data(), __pos, __str.size()); } /** * @brief Find position of a character of C substring. * @param __s String containing characters to locate. * @param __pos Index of character to search from. * @param __n Number of characters from s to search for. * @return Index of first occurrence. * * Starting from @a __pos, searches forward for one of the * first @a __n characters of @a __s within this string. If * found, returns the index where it was found. If not found, * returns npos. */ size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const; /** * @brief Find position of a character of C string. * @param __s String containing characters to locate. * @param __pos Index of character to search from (default 0). * @return Index of first occurrence. * * Starting from @a __pos, searches forward for one of the * characters of @a __s within this string. If found, returns * the index where it was found. If not found, returns npos. */ size_type find_first_of(const _CharT* __s, size_type __pos = 0) const { __glibcxx_requires_string(__s); return this->find_first_of(__s, __pos, traits_type::length(__s)); } /** * @brief Find position of a character. * @param __c Character to locate. * @param __pos Index of character to search from (default 0). * @return Index of first occurrence. * * Starting from @a __pos, searches forward for the character * @a __c within this string. If found, returns the index * where it was found. If not found, returns npos. * * Note: equivalent to find(c, pos). */ size_type find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT { return this->find(__c, __pos); } /** * @brief Find last position of a character of string. * @param __str String containing characters to locate. * @param __pos Index of character to search back from (default end). * @return Index of last occurrence. * * Starting from @a __pos, searches backward for one of the * characters of @a __str within this string. If found, * returns the index where it was found. If not found, returns * npos. */ size_type find_last_of(const __versa_string& __str, size_type __pos = npos) const _GLIBCXX_NOEXCEPT { return this->find_last_of(__str.data(), __pos, __str.size()); } /** * @brief Find last position of a character of C substring. * @param __s C string containing characters to locate. * @param __pos Index of character to search back from. * @param __n Number of characters from s to search for. * @return Index of last occurrence. * * Starting from @a __pos, searches backward for one of the * first @a __n characters of @a __s within this string. If * found, returns the index where it was found. If not found, * returns npos. */ size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const; /** * @brief Find last position of a character of C string. * @param __s C string containing characters to locate. * @param __pos Index of character to search back from (default end). * @return Index of last occurrence. * * Starting from @a __pos, searches backward for one of the * characters of @a __s within this string. If found, returns * the index where it was found. If not found, returns npos. */ size_type find_last_of(const _CharT* __s, size_type __pos = npos) const { __glibcxx_requires_string(__s); return this->find_last_of(__s, __pos, traits_type::length(__s)); } /** * @brief Find last position of a character. * @param __c Character to locate. * @param __pos Index of character to search back from (default end). * @return Index of last occurrence. * * Starting from @a __pos, searches backward for @a __c within * this string. If found, returns the index where it was * found. If not found, returns npos. * * Note: equivalent to rfind(c, pos). */ size_type find_last_of(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT { return this->rfind(__c, __pos); } /** * @brief Find position of a character not in string. * @param __str String containing characters to avoid. * @param __pos Index of character to search from (default 0). * @return Index of first occurrence. * * Starting from @a __pos, searches forward for a character not * contained in @a __str within this string. If found, returns * the index where it was found. If not found, returns npos. */ size_type find_first_not_of(const __versa_string& __str, size_type __pos = 0) const _GLIBCXX_NOEXCEPT { return this->find_first_not_of(__str.data(), __pos, __str.size()); } /** * @brief Find position of a character not in C substring. * @param __s C string containing characters to avoid. * @param __pos Index of character to search from. * @param __n Number of characters from s to consider. * @return Index of first occurrence. * * Starting from @a __pos, searches forward for a character not * contained in the first @a __n characters of @a __s within * this string. If found, returns the index where it was * found. If not found, returns npos. */ size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const; /** * @brief Find position of a character not in C string. * @param __s C string containing characters to avoid. * @param __pos Index of character to search from (default 0). * @return Index of first occurrence. * * Starting from @a __pos, searches forward for a character not * contained in @a __s within this string. If found, returns * the index where it was found. If not found, returns npos. */ size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const { __glibcxx_requires_string(__s); return this->find_first_not_of(__s, __pos, traits_type::length(__s)); } /** * @brief Find position of a different character. * @param __c Character to avoid. * @param __pos Index of character to search from (default 0). * @return Index of first occurrence. * * Starting from @a __pos, searches forward for a character * other than @a __c within this string. If found, returns the * index where it was found. If not found, returns npos. */ size_type find_first_not_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT; /** * @brief Find last position of a character not in string. * @param __str String containing characters to avoid. * @param __pos Index of character to search back from (default end). * @return Index of last occurrence. * * Starting from @a __pos, searches backward for a character * not contained in @a __str within this string. If found, * returns the index where it was found. If not found, returns * npos. */ size_type find_last_not_of(const __versa_string& __str, size_type __pos = npos) const _GLIBCXX_NOEXCEPT { return this->find_last_not_of(__str.data(), __pos, __str.size()); } /** * @brief Find last position of a character not in C substring. * @param __s C string containing characters to avoid. * @param __pos Index of character to search back from. * @param __n Number of characters from s to consider. * @return Index of last occurrence. * * Starting from @a __pos, searches backward for a character * not contained in the first @a __n characters of @a __s * within this string. If found, returns the index where it * was found. If not found, returns npos. */ size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const; /** * @brief Find last position of a character not in C string. * @param __s C string containing characters to avoid. * @param __pos Index of character to search back from (default end). * @return Index of last occurrence. * * Starting from @a __pos, searches backward for a character * not contained in @a __s within this string. If found, * returns the index where it was found. If not found, returns * npos. */ size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const { __glibcxx_requires_string(__s); return this->find_last_not_of(__s, __pos, traits_type::length(__s)); } /** * @brief Find last position of a different character. * @param __c Character to avoid. * @param __pos Index of character to search back from (default end). * @return Index of last occurrence. * * Starting from @a __pos, searches backward for a character * other than @a __c within this string. If found, returns the * index where it was found. If not found, returns npos. */ size_type find_last_not_of(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT; /** * @brief Get a substring. * @param __pos Index of first character (default 0). * @param __n Number of characters in substring (default remainder). * @return The new string. * @throw std::out_of_range If pos > size(). * * Construct and return a new string using the @a __n * characters starting at @a __pos. If the string is too * short, use the remainder of the characters. If @a __pos is * beyond the end of the string, out_of_range is thrown. */ __versa_string substr(size_type __pos = 0, size_type __n = npos) const { return __versa_string(*this, _M_check(__pos, "__versa_string::substr"), __n); } /** * @brief Compare to a string. * @param __str String to compare against. * @return Integer < 0, 0, or > 0. * * Returns an integer < 0 if this string is ordered before @a * __str, 0 if their values are equivalent, or > 0 if this * string is ordered after @a __str. Determines the effective * length rlen of the strings to compare as the smallest of * size() and str.size(). The function then compares the two * strings by calling traits::compare(data(), str.data(),rlen). * If the result of the comparison is nonzero returns it, * otherwise the shorter one is ordered first. */ int compare(const __versa_string& __str) const { if (this->_M_compare(__str)) return 0; const size_type __size = this->size(); const size_type __osize = __str.size(); const size_type __len = std::min(__size, __osize); int __r = traits_type::compare(this->_M_data(), __str.data(), __len); if (!__r) __r = this->_S_compare(__size, __osize); return __r; } /** * @brief Compare substring to a string. * @param __pos Index of first character of substring. * @param __n Number of characters in substring. * @param __str String to compare against. * @return Integer < 0, 0, or > 0. * * Form the substring of this string from the @a __n characters * starting at @a __pos. Returns an integer < 0 if the * substring is ordered before @a __str, 0 if their values are * equivalent, or > 0 if the substring is ordered after @a * __str. Determines the effective length rlen of the strings * to compare as the smallest of the length of the substring * and @a __str.size(). The function then compares the two * strings by calling * traits::compare(substring.data(),str.data(),rlen). If the * result of the comparison is nonzero returns it, otherwise * the shorter one is ordered first. */ int compare(size_type __pos, size_type __n, const __versa_string& __str) const; /** * @brief Compare substring to a substring. * @param __pos1 Index of first character of substring. * @param __n1 Number of characters in substring. * @param __str String to compare against. * @param __pos2 Index of first character of substring of str. * @param __n2 Number of characters in substring of str. * @return Integer < 0, 0, or > 0. * * Form the substring of this string from the @a __n1 * characters starting at @a __pos1. Form the substring of @a * __str from the @a __n2 characters starting at @a __pos2. * Returns an integer < 0 if this substring is ordered before * the substring of @a __str, 0 if their values are equivalent, * or > 0 if this substring is ordered after the substring of * @a __str. Determines the effective length rlen of the * strings to compare as the smallest of the lengths of the * substrings. The function then compares the two strings by * calling * traits::compare(substring.data(),str.substr(pos2,n2).data(),rlen). * If the result of the comparison is nonzero returns it, * otherwise the shorter one is ordered first. */ int compare(size_type __pos1, size_type __n1, const __versa_string& __str, size_type __pos2, size_type __n2) const; /** * @brief Compare to a C string. * @param __s C string to compare against. * @return Integer < 0, 0, or > 0. * * Returns an integer < 0 if this string is ordered before @a * __s, 0 if their values are equivalent, or > 0 if this string * is ordered after @a __s. Determines the effective length * rlen of the strings to compare as the smallest of size() and * the length of a string constructed from @a __s. The * function then compares the two strings by calling * traits::compare(data(),s,rlen). If the result of the * comparison is nonzero returns it, otherwise the shorter one * is ordered first. */ int compare(const _CharT* __s) const; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 5 String::compare specification questionable /** * @brief Compare substring to a C string. * @param __pos Index of first character of substring. * @param __n1 Number of characters in substring. * @param __s C string to compare against. * @return Integer < 0, 0, or > 0. * * Form the substring of this string from the @a __n1 * characters starting at @a __pos. Returns an integer < 0 if * the substring is ordered before @a __s, 0 if their values * are equivalent, or > 0 if the substring is ordered after @a * __s. Determines the effective length rlen of the strings to * compare as the smallest of the length of the substring and * the length of a string constructed from @a __s. The * function then compares the two string by calling * traits::compare(substring.data(),s,rlen). If the result of * the comparison is nonzero returns it, otherwise the shorter * one is ordered first. */ int compare(size_type __pos, size_type __n1, const _CharT* __s) const; /** * @brief Compare substring against a character array. * @param __pos Index of first character of substring. * @param __n1 Number of characters in substring. * @param __s character array to compare against. * @param __n2 Number of characters of s. * @return Integer < 0, 0, or > 0. * * Form the substring of this string from the @a __n1 * characters starting at @a __pos. Form a string from the * first @a __n2 characters of @a __s. Returns an integer < 0 * if this substring is ordered before the string from @a __s, * 0 if their values are equivalent, or > 0 if this substring * is ordered after the string from @a __s. Determines the * effective length rlen of the strings to compare as the * smallest of the length of the substring and @a __n2. The * function then compares the two strings by calling * traits::compare(substring.data(),__s,rlen). If the result of * the comparison is nonzero returns it, otherwise the shorter * one is ordered first. * * NB: __s must have at least n2 characters, <em>\\0</em> has no special * meaning. */ int compare(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) const; }; // operator+ /** * @brief Concatenate two strings. * @param __lhs First string. * @param __rhs Last string. * @return New string with value of @a __lhs followed by @a __rhs. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> __versa_string<_CharT, _Traits, _Alloc, _Base> operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs); /** * @brief Concatenate C string and string. * @param __lhs First string. * @param __rhs Last string. * @return New string with value of @a __lhs followed by @a __rhs. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> __versa_string<_CharT, _Traits, _Alloc, _Base> operator+(const _CharT* __lhs, const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs); /** * @brief Concatenate character and string. * @param __lhs First string. * @param __rhs Last string. * @return New string with @a __lhs followed by @a __rhs. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> __versa_string<_CharT, _Traits, _Alloc, _Base> operator+(_CharT __lhs, const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs); /** * @brief Concatenate string and C string. * @param __lhs First string. * @param __rhs Last string. * @return New string with @a __lhs followed by @a __rhs. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> __versa_string<_CharT, _Traits, _Alloc, _Base> operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, const _CharT* __rhs); /** * @brief Concatenate string and character. * @param __lhs First string. * @param __rhs Last string. * @return New string with @a __lhs followed by @a __rhs. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> __versa_string<_CharT, _Traits, _Alloc, _Base> operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, _CharT __rhs); #if __cplusplus >= 201103L template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline __versa_string<_CharT, _Traits, _Alloc, _Base> operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs, const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs) { return std::move(__lhs.append(__rhs)); } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline __versa_string<_CharT, _Traits, _Alloc, _Base> operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, __versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs) { return std::move(__rhs.insert(0, __lhs)); } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline __versa_string<_CharT, _Traits, _Alloc, _Base> operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs, __versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs) { const auto __size = __lhs.size() + __rhs.size(); const bool __cond = (__size > __lhs.capacity() && __size <= __rhs.capacity()); return __cond ? std::move(__rhs.insert(0, __lhs)) : std::move(__lhs.append(__rhs)); } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline __versa_string<_CharT, _Traits, _Alloc, _Base> operator+(const _CharT* __lhs, __versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs) { return std::move(__rhs.insert(0, __lhs)); } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline __versa_string<_CharT, _Traits, _Alloc, _Base> operator+(_CharT __lhs, __versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs) { return std::move(__rhs.insert(0, 1, __lhs)); } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline __versa_string<_CharT, _Traits, _Alloc, _Base> operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs, const _CharT* __rhs) { return std::move(__lhs.append(__rhs)); } template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline __versa_string<_CharT, _Traits, _Alloc, _Base> operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs, _CharT __rhs) { return std::move(__lhs.append(1, __rhs)); } #endif // operator == /** * @brief Test equivalence of two strings. * @param __lhs First string. * @param __rhs Second string. * @return True if @a __lhs.compare(@a __rhs) == 0. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline bool operator==(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs) { return __lhs.compare(__rhs) == 0; } template<typename _CharT, template <typename, typename, typename> class _Base> inline typename __enable_if<std::__is_char<_CharT>::__value, bool>::__type operator==(const __versa_string<_CharT, std::char_traits<_CharT>, std::allocator<_CharT>, _Base>& __lhs, const __versa_string<_CharT, std::char_traits<_CharT>, std::allocator<_CharT>, _Base>& __rhs) { return (__lhs.size() == __rhs.size() && !std::char_traits<_CharT>::compare(__lhs.data(), __rhs.data(), __lhs.size())); } /** * @brief Test equivalence of C string and string. * @param __lhs C string. * @param __rhs String. * @return True if @a __rhs.compare(@a __lhs) == 0. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline bool operator==(const _CharT* __lhs, const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs) { return __rhs.compare(__lhs) == 0; } /** * @brief Test equivalence of string and C string. * @param __lhs String. * @param __rhs C string. * @return True if @a __lhs.compare(@a __rhs) == 0. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline bool operator==(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) == 0; } // operator != /** * @brief Test difference of two strings. * @param __lhs First string. * @param __rhs Second string. * @return True if @a __lhs.compare(@a __rhs) != 0. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline bool operator!=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs) { return !(__lhs == __rhs); } /** * @brief Test difference of C string and string. * @param __lhs C string. * @param __rhs String. * @return True if @a __rhs.compare(@a __lhs) != 0. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline bool operator!=(const _CharT* __lhs, const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs) { return !(__lhs == __rhs); } /** * @brief Test difference of string and C string. * @param __lhs String. * @param __rhs C string. * @return True if @a __lhs.compare(@a __rhs) != 0. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline bool operator!=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, const _CharT* __rhs) { return !(__lhs == __rhs); } // operator < /** * @brief Test if string precedes string. * @param __lhs First string. * @param __rhs Second string. * @return True if @a __lhs precedes @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline bool operator<(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs) { return __lhs.compare(__rhs) < 0; } /** * @brief Test if string precedes C string. * @param __lhs String. * @param __rhs C string. * @return True if @a __lhs precedes @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline bool operator<(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) < 0; } /** * @brief Test if C string precedes string. * @param __lhs C string. * @param __rhs String. * @return True if @a __lhs precedes @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline bool operator<(const _CharT* __lhs, const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs) { return __rhs.compare(__lhs) > 0; } // operator > /** * @brief Test if string follows string. * @param __lhs First string. * @param __rhs Second string. * @return True if @a __lhs follows @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline bool operator>(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs) { return __lhs.compare(__rhs) > 0; } /** * @brief Test if string follows C string. * @param __lhs String. * @param __rhs C string. * @return True if @a __lhs follows @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline bool operator>(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) > 0; } /** * @brief Test if C string follows string. * @param __lhs C string. * @param __rhs String. * @return True if @a __lhs follows @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline bool operator>(const _CharT* __lhs, const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs) { return __rhs.compare(__lhs) < 0; } // operator <= /** * @brief Test if string doesn't follow string. * @param __lhs First string. * @param __rhs Second string. * @return True if @a __lhs doesn't follow @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline bool operator<=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs) { return __lhs.compare(__rhs) <= 0; } /** * @brief Test if string doesn't follow C string. * @param __lhs String. * @param __rhs C string. * @return True if @a __lhs doesn't follow @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline bool operator<=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) <= 0; } /** * @brief Test if C string doesn't follow string. * @param __lhs C string. * @param __rhs String. * @return True if @a __lhs doesn't follow @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline bool operator<=(const _CharT* __lhs, const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs) { return __rhs.compare(__lhs) >= 0; } // operator >= /** * @brief Test if string doesn't precede string. * @param __lhs First string. * @param __rhs Second string. * @return True if @a __lhs doesn't precede @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline bool operator>=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs) { return __lhs.compare(__rhs) >= 0; } /** * @brief Test if string doesn't precede C string. * @param __lhs String. * @param __rhs C string. * @return True if @a __lhs doesn't precede @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline bool operator>=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) >= 0; } /** * @brief Test if C string doesn't precede string. * @param __lhs C string. * @param __rhs String. * @return True if @a __lhs doesn't precede @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline bool operator>=(const _CharT* __lhs, const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs) { return __rhs.compare(__lhs) <= 0; } /** * @brief Swap contents of two strings. * @param __lhs First string. * @param __rhs Second string. * * Exchanges the contents of @a __lhs and @a __rhs in constant time. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline void swap(__versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs, __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs) { __lhs.swap(__rhs); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Read stream into a string. * @param __is Input stream. * @param __str Buffer to store into. * @return Reference to the input stream. * * Stores characters from @a __is into @a __str until whitespace is * found, the end of the stream is encountered, or str.max_size() * is reached. If is.width() is non-zero, that is the limit on the * number of characters stored into @a __str. Any previous * contents of @a __str are erased. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>& __str); /** * @brief Write string to a stream. * @param __os Output stream. * @param __str String to write out. * @return Reference to the output stream. * * Output characters of @a __str into os following the same rules as for * writing a C string. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>& __str) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 586. string inserter not a formatted function return __ostream_insert(__os, __str.data(), __str.size()); } /** * @brief Read a line from stream into a string. * @param __is Input stream. * @param __str Buffer to store into. * @param __delim Character marking end of line. * @return Reference to the input stream. * * Stores characters from @a __is into @a __str until @a __delim is * found, the end of the stream is encountered, or str.max_size() * is reached. If is.width() is non-zero, that is the limit on the * number of characters stored into @a __str. Any previous * contents of @a __str are erased. If @a delim was encountered, * it is extracted but not stored into @a __str. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>& __is, __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>& __str, _CharT __delim); /** * @brief Read a line from stream into a string. * @param __is Input stream. * @param __str Buffer to store into. * @return Reference to the input stream. * * Stores characters from is into @a __str until '\n' is * found, the end of the stream is encountered, or str.max_size() * is reached. If is.width() is non-zero, that is the limit on the * number of characters stored into @a __str. Any previous * contents of @a __str are erased. If end of line was * encountered, it is extracted but not stored into @a __str. */ template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> inline basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>& __is, __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>& __str) { return getline(__is, __str, __is.widen('\n')); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99)) #include <ext/string_conversions.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // 21.4 Numeric Conversions [string.conversions]. inline int stoi(const __vstring& __str, std::size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa<long, int>(&std::strtol, "stoi", __str.c_str(), __idx, __base); } inline long stol(const __vstring& __str, std::size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::strtol, "stol", __str.c_str(), __idx, __base); } inline unsigned long stoul(const __vstring& __str, std::size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::strtoul, "stoul", __str.c_str(), __idx, __base); } inline long long stoll(const __vstring& __str, std::size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::strtoll, "stoll", __str.c_str(), __idx, __base); } inline unsigned long long stoull(const __vstring& __str, std::size_t* __idx, int __base = 10) { return __gnu_cxx::__stoa(&std::strtoull, "stoull", __str.c_str(), __idx, __base); } // NB: strtof vs strtod. inline float stof(const __vstring& __str, std::size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::strtof, "stof", __str.c_str(), __idx); } inline double stod(const __vstring& __str, std::size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::strtod, "stod", __str.c_str(), __idx); } inline long double stold(const __vstring& __str, std::size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __idx); } // NB: (v)snprintf vs sprintf. // DR 1261. inline __vstring to_string(int __val) { return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, 4 * sizeof(int), "%d", __val); } inline __vstring to_string(unsigned __val) { return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, 4 * sizeof(unsigned), "%u", __val); } inline __vstring to_string(long __val) { return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, 4 * sizeof(long), "%ld", __val); } inline __vstring to_string(unsigned long __val) { return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, 4 * sizeof(unsigned long), "%lu", __val); } inline __vstring to_string(long long __val) { return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, 4 * sizeof(long long), "%lld", __val); } inline __vstring to_string(unsigned long long __val) { return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, 4 * sizeof(unsigned long long), "%llu", __val); } inline __vstring to_string(float __val) { const int __n = __numeric_traits<float>::__max_exponent10 + 20; return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n, "%f", __val); } inline __vstring to_string(double __val) { const int __n = __numeric_traits<double>::__max_exponent10 + 20; return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n, "%f", __val); } inline __vstring to_string(long double __val) { const int __n = __numeric_traits<long double>::__max_exponent10 + 20; return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n, "%Lf", __val); } #ifdef _GLIBCXX_USE_WCHAR_T inline int stoi(const __wvstring& __str, std::size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa<long, int>(&std::wcstol, "stoi", __str.c_str(), __idx, __base); } inline long stol(const __wvstring& __str, std::size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::wcstol, "stol", __str.c_str(), __idx, __base); } inline unsigned long stoul(const __wvstring& __str, std::size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::wcstoul, "stoul", __str.c_str(), __idx, __base); } inline long long stoll(const __wvstring& __str, std::size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::wcstoll, "stoll", __str.c_str(), __idx, __base); } inline unsigned long long stoull(const __wvstring& __str, std::size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::wcstoull, "stoull", __str.c_str(), __idx, __base); } // NB: wcstof vs wcstod. inline float stof(const __wvstring& __str, std::size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::wcstof, "stof", __str.c_str(), __idx); } inline double stod(const __wvstring& __str, std::size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::wcstod, "stod", __str.c_str(), __idx); } inline long double stold(const __wvstring& __str, std::size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::wcstold, "stold", __str.c_str(), __idx); } #ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF // DR 1261. inline __wvstring to_wstring(int __val) { return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, 4 * sizeof(int), L"%d", __val); } inline __wvstring to_wstring(unsigned __val) { return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, 4 * sizeof(unsigned), L"%u", __val); } inline __wvstring to_wstring(long __val) { return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, 4 * sizeof(long), L"%ld", __val); } inline __wvstring to_wstring(unsigned long __val) { return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, 4 * sizeof(unsigned long), L"%lu", __val); } inline __wvstring to_wstring(long long __val) { return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, 4 * sizeof(long long), L"%lld", __val); } inline __wvstring to_wstring(unsigned long long __val) { return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, 4 * sizeof(unsigned long long), L"%llu", __val); } inline __wvstring to_wstring(float __val) { const int __n = __numeric_traits<float>::__max_exponent10 + 20; return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n, L"%f", __val); } inline __wvstring to_wstring(double __val) { const int __n = __numeric_traits<double>::__max_exponent10 + 20; return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n, L"%f", __val); } inline __wvstring to_wstring(long double __val) { const int __n = __numeric_traits<long double>::__max_exponent10 + 20; return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n, L"%Lf", __val); } #endif #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif #if __cplusplus >= 201103L #include <bits/functional_hash.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /// std::hash specialization for __vstring. template<> struct hash<__gnu_cxx::__vstring> : public __hash_base<size_t, __gnu_cxx::__vstring> { size_t operator()(const __gnu_cxx::__vstring& __s) const noexcept { return std::_Hash_impl::hash(__s.data(), __s.length()); } }; #ifdef _GLIBCXX_USE_WCHAR_T /// std::hash specialization for __wvstring. template<> struct hash<__gnu_cxx::__wvstring> : public __hash_base<size_t, __gnu_cxx::__wvstring> { size_t operator()(const __gnu_cxx::__wvstring& __s) const noexcept { return std::_Hash_impl::hash(__s.data(), __s.length() * sizeof(wchar_t)); } }; #endif #ifdef _GLIBCXX_USE_C99_STDINT_TR1 /// std::hash specialization for __u16vstring. template<> struct hash<__gnu_cxx::__u16vstring> : public __hash_base<size_t, __gnu_cxx::__u16vstring> { size_t operator()(const __gnu_cxx::__u16vstring& __s) const noexcept { return std::_Hash_impl::hash(__s.data(), __s.length() * sizeof(char16_t)); } }; /// std::hash specialization for __u32vstring. template<> struct hash<__gnu_cxx::__u32vstring> : public __hash_base<size_t, __gnu_cxx::__u32vstring> { size_t operator()(const __gnu_cxx::__u32vstring& __s) const noexcept { return std::_Hash_impl::hash(__s.data(), __s.length() * sizeof(char32_t)); } }; #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // C++11 #include "vstring.tcc" #endif /* _VSTRING_H */ ����������������������������������������������������������������c++/4.8.2/ext/pb_ds/trie_policy.hpp�����������������������������������������������������������������0000644�����������������00000027701�14763166027�0012532 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file trie_policy.hpp * Contains trie-related policies. */ #ifndef PB_DS_TRIE_POLICY_HPP #define PB_DS_TRIE_POLICY_HPP #include <bits/c++config.h> #include <string> #include <ext/pb_ds/detail/type_utils.hpp> #include <ext/pb_ds/detail/trie_policy/trie_policy_base.hpp> namespace __gnu_pbds { #define PB_DS_CLASS_T_DEC \ template<typename String, typename String::value_type Min_E_Val, \ typename String::value_type Max_E_Val, bool Reverse, \ typename _Alloc> #define PB_DS_CLASS_C_DEC \ trie_string_access_traits<String, Min_E_Val,Max_E_Val,Reverse,_Alloc> /** * Element access traits for string types. * * @tparam String String type. * @tparam Min_E_Val Minimal element value. * @tparam Max_E_Val Maximum element value. * @tparam Reverse Reverse iteration should be used. * Default: false. * @tparam _Alloc Allocator type. */ template<typename String = std::string, typename String::value_type Min_E_Val = detail::__numeric_traits<typename String::value_type>::__min, typename String::value_type Max_E_Val = detail::__numeric_traits<typename String::value_type>::__max, bool Reverse = false, typename _Alloc = std::allocator<char> > struct trie_string_access_traits { public: typedef typename _Alloc::size_type size_type; typedef String key_type; typedef typename _Alloc::template rebind<key_type> __rebind_k; typedef typename __rebind_k::other::const_reference key_const_reference; enum { reverse = Reverse }; /// Element const iterator type. typedef typename detail::__conditional_type<Reverse, \ typename String::const_reverse_iterator, \ typename String::const_iterator>::__type const_iterator; /// Element type. typedef typename std::iterator_traits<const_iterator>::value_type e_type; enum { min_e_val = Min_E_Val, max_e_val = Max_E_Val, max_size = max_e_val - min_e_val + 1 }; PB_DS_STATIC_ASSERT(min_max_size, max_size >= 2); /// Returns a const_iterator to the first element of /// key_const_reference agumnet. inline static const_iterator begin(key_const_reference); /// Returns a const_iterator to the after-last element of /// key_const_reference argument. inline static const_iterator end(key_const_reference); /// Maps an element to a position. inline static size_type e_pos(e_type e); private: inline static const_iterator begin_imp(key_const_reference, detail::false_type); inline static const_iterator begin_imp(key_const_reference, detail::true_type); inline static const_iterator end_imp(key_const_reference, detail::false_type); inline static const_iterator end_imp(key_const_reference, detail::true_type); static detail::integral_constant<int, Reverse> s_rev_ind; }; #include <ext/pb_ds/detail/trie_policy/trie_string_access_traits_imp.hpp> #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #define PB_DS_CLASS_T_DEC \ template<typename Node_CItr,typename Node_Itr, \ typename _ATraits, typename _Alloc> #define PB_DS_CLASS_C_DEC \ trie_prefix_search_node_update<Node_CItr, Node_Itr, \ _ATraits,_Alloc> #define PB_DS_TRIE_POLICY_BASE \ detail::trie_policy_base<Node_CItr,Node_Itr,_ATraits, _Alloc> /// A node updator that allows tries to be searched for the range of /// values that match a certain prefix. template<typename Node_CItr, typename Node_Itr, typename _ATraits, typename _Alloc> class trie_prefix_search_node_update : private PB_DS_TRIE_POLICY_BASE { private: typedef PB_DS_TRIE_POLICY_BASE base_type; public: typedef typename base_type::key_type key_type; typedef typename base_type::key_const_reference key_const_reference; /// Element access traits. typedef _ATraits access_traits; /// Const element iterator. typedef typename access_traits::const_iterator a_const_iterator; /// _Alloc type. typedef _Alloc allocator_type; /// Size type. typedef typename allocator_type::size_type size_type; typedef null_type metadata_type; typedef Node_Itr node_iterator; typedef Node_CItr node_const_iterator; typedef typename node_iterator::value_type iterator; typedef typename node_const_iterator::value_type const_iterator; /// Finds the const iterator range corresponding to all values /// whose prefixes match r_key. std::pair<const_iterator, const_iterator> prefix_range(key_const_reference) const; /// Finds the iterator range corresponding to all values whose /// prefixes match r_key. std::pair<iterator, iterator> prefix_range(key_const_reference); /// Finds the const iterator range corresponding to all values /// whose prefixes match [b, e). std::pair<const_iterator, const_iterator> prefix_range(a_const_iterator, a_const_iterator) const; /// Finds the iterator range corresponding to all values whose /// prefixes match [b, e). std::pair<iterator, iterator> prefix_range(a_const_iterator, a_const_iterator); protected: /// Called to update a node's metadata. inline void operator()(node_iterator node_it, node_const_iterator end_nd_it) const; private: node_iterator next_child(node_iterator, a_const_iterator, a_const_iterator, node_iterator, const access_traits&); /// Returns the const iterator associated with the just-after last element. virtual const_iterator end() const = 0; /// Returns the iterator associated with the just-after last element. virtual iterator end() = 0; /// Returns the node_const_iterator associated with the trie's root node. virtual node_const_iterator node_begin() const = 0; /// Returns the node_iterator associated with the trie's root node. virtual node_iterator node_begin() = 0; /// Returns the node_const_iterator associated with a just-after leaf node. virtual node_const_iterator node_end() const = 0; /// Returns the node_iterator associated with a just-after leaf node. virtual node_iterator node_end() = 0; /// Access to the cmp_fn object. virtual const access_traits& get_access_traits() const = 0; }; #include <ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp> #undef PB_DS_CLASS_C_DEC #define PB_DS_CLASS_C_DEC \ trie_order_statistics_node_update<Node_CItr, Node_Itr, \ _ATraits, _Alloc> /// Functor updating ranks of entrees. template<typename Node_CItr, typename Node_Itr, typename _ATraits, typename _Alloc> class trie_order_statistics_node_update : private PB_DS_TRIE_POLICY_BASE { private: typedef PB_DS_TRIE_POLICY_BASE base_type; public: typedef _ATraits access_traits; typedef typename access_traits::const_iterator a_const_iterator; typedef _Alloc allocator_type; typedef typename allocator_type::size_type size_type; typedef typename base_type::key_type key_type; typedef typename base_type::key_const_reference key_const_reference; typedef size_type metadata_type; typedef Node_CItr node_const_iterator; typedef Node_Itr node_iterator; typedef typename node_const_iterator::value_type const_iterator; typedef typename node_iterator::value_type iterator; /// Finds an entry by __order. Returns a const_iterator to the /// entry with the __order order, or a const_iterator to the /// container object's end if order is at least the size of the /// container object. inline const_iterator find_by_order(size_type) const; /// Finds an entry by __order. Returns an iterator to the entry /// with the __order order, or an iterator to the container /// object's end if order is at least the size of the container /// object. inline iterator find_by_order(size_type); /// Returns the order of a key within a sequence. For exapmle, if /// r_key is the smallest key, this method will return 0; if r_key /// is a key between the smallest and next key, this method will /// return 1; if r_key is a key larger than the largest key, this /// method will return the size of r_c. inline size_type order_of_key(key_const_reference) const; /// Returns the order of a prefix within a sequence. For exapmle, /// if [b, e] is the smallest prefix, this method will return 0; if /// r_key is a key between the smallest and next key, this method /// will return 1; if r_key is a key larger than the largest key, /// this method will return the size of r_c. inline size_type order_of_prefix(a_const_iterator, a_const_iterator) const; protected: /// Updates the rank of a node through a node_iterator node_it; /// end_nd_it is the end node iterator. inline void operator()(node_iterator, node_const_iterator) const; private: typedef typename base_type::const_reference const_reference; typedef typename base_type::const_pointer const_pointer; typedef typename _Alloc::template rebind<metadata_type> __rebind_m; typedef typename __rebind_m::other __rebind_ma; typedef typename __rebind_ma::const_reference metadata_const_reference; typedef typename __rebind_ma::reference metadata_reference; /// Returns true if the container is empty. virtual bool empty() const = 0; /// Returns the iterator associated with the trie's first element. virtual iterator begin() = 0; /// Returns the iterator associated with the trie's /// just-after-last element. virtual iterator end() = 0; /// Returns the node_const_iterator associated with the trie's root node. virtual node_const_iterator node_begin() const = 0; /// Returns the node_iterator associated with the trie's root node. virtual node_iterator node_begin() = 0; /// Returns the node_const_iterator associated with a just-after /// leaf node. virtual node_const_iterator node_end() const = 0; /// Returns the node_iterator associated with a just-after leaf node. virtual node_iterator node_end() = 0; /// Access to the cmp_fn object. virtual access_traits& get_access_traits() = 0; }; #include <ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp> #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #undef PB_DS_TRIE_POLICY_BASE } // namespace __gnu_pbds #endif ���������������������������������������������������������������c++/4.8.2/ext/pb_ds/tag_and_trait.hpp���������������������������������������������������������������0000644�����������������00000027756�14763166027�0013022 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file tag_and_trait.hpp * Contains tags and traits, e.g., ones describing underlying * data structures. */ #ifndef PB_DS_TAG_AND_TRAIT_HPP #define PB_DS_TAG_AND_TRAIT_HPP #include <bits/c++config.h> #include <ext/pb_ds/detail/type_utils.hpp> /** * @namespace __gnu_pbds * @brief GNU extensions for policy-based data structures for public use. */ namespace __gnu_pbds { /** @defgroup pbds Policy-Based Data Structures * @ingroup extensions * * This is a library of policy-based elementary data structures: * associative containers and priority queues. It is designed for * high-performance, flexibility, semantic safety, and conformance * to the corresponding containers in std (except for some points * where it differs by design). * * For details, see: * http://gcc.gnu.org/onlinedocs/libstdc++/ext/pb_ds/index.html * * @{ */ /** * @defgroup tags Tags * @{ */ /// A trivial iterator tag. Signifies that the iterators has none of /// std::iterators's movement abilities. struct trivial_iterator_tag { }; /// Prohibit moving trivial iterators. typedef void trivial_iterator_difference_type; /** * @defgroup invalidation_tags Invalidation Guarantees * @ingroup tags * @{ */ /** * Signifies a basic invalidation guarantee that any iterator, * pointer, or reference to a container object's mapped value type * is valid as long as the container is not modified. */ struct basic_invalidation_guarantee { }; /** * Signifies an invalidation guarantee that includes all those of * its base, and additionally, that any point-type iterator, * pointer, or reference to a container object's mapped value type * is valid as long as its corresponding entry has not be erased, * regardless of modifications to the container object. */ struct point_invalidation_guarantee : public basic_invalidation_guarantee { }; /** * Signifies an invalidation guarantee that includes all those of * its base, and additionally, that any range-type iterator * (including the returns of begin() and end()) is in the correct * relative positions to other range-type iterators as long as its * corresponding entry has not be erased, regardless of * modifications to the container object. */ struct range_invalidation_guarantee : public point_invalidation_guarantee { }; //@} /** * @defgroup ds_tags Data Structure Type * @ingroup tags * @{ */ /// Base data structure tag. struct container_tag { }; /// Basic sequence. struct sequence_tag : public container_tag { }; /// Basic string container, inclusive of strings, ropes, etc. struct string_tag : public sequence_tag { }; /// Basic associative-container. struct associative_tag : public container_tag { }; /// Basic hash structure. struct basic_hash_tag : public associative_tag { }; /// Collision-chaining hash. struct cc_hash_tag : public basic_hash_tag { }; /// General-probing hash. struct gp_hash_tag : public basic_hash_tag { }; /// Basic branch structure. struct basic_branch_tag : public associative_tag { }; /// Basic tree structure. struct tree_tag : public basic_branch_tag { }; /// Red-black tree. struct rb_tree_tag : public tree_tag { }; /// Splay tree. struct splay_tree_tag : public tree_tag { }; /// Ordered-vector tree. struct ov_tree_tag : public tree_tag { }; /// Basic trie structure. struct trie_tag : public basic_branch_tag { }; /// PATRICIA trie. struct pat_trie_tag : public trie_tag { }; /// List-update. struct list_update_tag : public associative_tag { }; /// Basic priority-queue. struct priority_queue_tag : public container_tag { }; /// Pairing-heap. struct pairing_heap_tag : public priority_queue_tag { }; /// Binomial-heap. struct binomial_heap_tag : public priority_queue_tag { }; /// Redundant-counter binomial-heap. struct rc_binomial_heap_tag : public priority_queue_tag { }; /// Binary-heap (array-based). struct binary_heap_tag : public priority_queue_tag { }; /// Thin heap. struct thin_heap_tag : public priority_queue_tag { }; //@} //@} /** * @defgroup traits Traits * @{ */ /** * @brief Represents no type, or absence of type, for template tricks. * * In a mapped-policy, indicates that an associative container is a set. * * In a list-update policy, indicates that each link does not need * metadata. * * In a hash policy, indicates that the combining hash function * is actually a ranged hash function. * * In a probe policy, indicates that the combining probe function * is actually a ranged probe function. */ struct null_type { }; /// A null node updator, indicating that no node updates are required. template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4> struct null_node_update : public null_type { }; /// Primary template, container traits base. template<typename _Tag> struct container_traits_base; /// Specialization, cc hash. template<> struct container_traits_base<cc_hash_tag> { typedef cc_hash_tag container_category; typedef point_invalidation_guarantee invalidation_guarantee; enum { order_preserving = false, erase_can_throw = false, split_join_can_throw = false, reverse_iteration = false }; }; /// Specialization, gp hash. template<> struct container_traits_base<gp_hash_tag> { typedef gp_hash_tag container_category; typedef basic_invalidation_guarantee invalidation_guarantee; enum { order_preserving = false, erase_can_throw = false, split_join_can_throw = false, reverse_iteration = false }; }; /// Specialization, rb tree. template<> struct container_traits_base<rb_tree_tag> { typedef rb_tree_tag container_category; typedef range_invalidation_guarantee invalidation_guarantee; enum { order_preserving = true, erase_can_throw = false, split_join_can_throw = false, reverse_iteration = true }; }; /// Specialization, splay tree. template<> struct container_traits_base<splay_tree_tag> { typedef splay_tree_tag container_category; typedef range_invalidation_guarantee invalidation_guarantee; enum { order_preserving = true, erase_can_throw = false, split_join_can_throw = false, reverse_iteration = true }; }; /// Specialization, ov tree. template<> struct container_traits_base<ov_tree_tag> { typedef ov_tree_tag container_category; typedef basic_invalidation_guarantee invalidation_guarantee; enum { order_preserving = true, erase_can_throw = true, split_join_can_throw = true, reverse_iteration = false }; }; /// Specialization, pat trie. template<> struct container_traits_base<pat_trie_tag> { typedef pat_trie_tag container_category; typedef range_invalidation_guarantee invalidation_guarantee; enum { order_preserving = true, erase_can_throw = false, split_join_can_throw = true, reverse_iteration = true }; }; /// Specialization, list update. template<> struct container_traits_base<list_update_tag> { typedef list_update_tag container_category; typedef point_invalidation_guarantee invalidation_guarantee; enum { order_preserving = false, erase_can_throw = false, split_join_can_throw = false, reverse_iteration = false }; }; /// Specialization, pairing heap. template<> struct container_traits_base<pairing_heap_tag> { typedef pairing_heap_tag container_category; typedef point_invalidation_guarantee invalidation_guarantee; enum { order_preserving = false, erase_can_throw = false, split_join_can_throw = false, reverse_iteration = false }; }; /// Specialization, thin heap. template<> struct container_traits_base<thin_heap_tag> { typedef thin_heap_tag container_category; typedef point_invalidation_guarantee invalidation_guarantee; enum { order_preserving = false, erase_can_throw = false, split_join_can_throw = false, reverse_iteration = false }; }; /// Specialization, binomial heap. template<> struct container_traits_base<binomial_heap_tag> { typedef binomial_heap_tag container_category; typedef point_invalidation_guarantee invalidation_guarantee; enum { order_preserving = false, erase_can_throw = false, split_join_can_throw = false, reverse_iteration = false }; }; /// Specialization, rc binomial heap. template<> struct container_traits_base<rc_binomial_heap_tag> { typedef rc_binomial_heap_tag container_category; typedef point_invalidation_guarantee invalidation_guarantee; enum { order_preserving = false, erase_can_throw = false, split_join_can_throw = false, reverse_iteration = false }; }; /// Specialization, binary heap. template<> struct container_traits_base<binary_heap_tag> { typedef binary_heap_tag container_category; typedef basic_invalidation_guarantee invalidation_guarantee; enum { order_preserving = false, erase_can_throw = false, split_join_can_throw = true, reverse_iteration = false }; }; /// Container traits. // See Matt Austern for the name, S. Meyers MEFC++ #2, others. template<typename Cntnr> struct container_traits : public container_traits_base<typename Cntnr::container_category> { typedef Cntnr container_type; typedef typename Cntnr::container_category container_category; typedef container_traits_base<container_category> base_type; typedef typename base_type::invalidation_guarantee invalidation_guarantee; enum { /// True only if Cntnr objects guarantee storing keys by order. order_preserving = base_type::order_preserving, /// True only if erasing a key can throw. erase_can_throw = base_type::erase_can_throw, /// True only if split or join operations can throw. split_join_can_throw = base_type::split_join_can_throw, /// True only reverse iterators are supported. reverse_iteration = base_type::reverse_iteration }; }; //@} namespace detail { /// Dispatch mechanism, primary template for associative types. template<typename Key, typename Mapped, typename _Alloc, typename Tag, typename Policy_Tl = null_type> struct container_base_dispatch; } // namespace __detail //@} } // namespace __gnu_pbds #endif ������������������c++/4.8.2/ext/pb_ds/list_update_policy.hpp����������������������������������������������������������0000644�����������������00000010420�14763166027�0014072 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file list_update_policy.hpp * Contains policies for list update containers. */ #ifndef PB_DS_LU_POLICY_HPP #define PB_DS_LU_POLICY_HPP #include <bits/c++config.h> #include <cstdlib> #include <ext/pb_ds/detail/list_update_policy/lu_counter_metadata.hpp> #include <ext/pb_ds/tag_and_trait.hpp> namespace __gnu_pbds { /** * A list-update policy that unconditionally moves elements to the * front of the list. A null type means that each link in a * list-based container does not actually need metadata. */ template<typename _Alloc = std::allocator<char> > class lu_move_to_front_policy { public: typedef _Alloc allocator_type; /// Metadata on which this functor operates. typedef null_type metadata_type; private: typedef typename _Alloc::template rebind<metadata_type> __rebind_m; public: /// Reference to metadata on which this functor operates. typedef typename __rebind_m::other::reference metadata_reference; /// Creates a metadata object. metadata_type operator()() const { return s_metadata; } /// Decides whether a metadata object should be moved to the front /// of the list. inline bool operator()(metadata_reference r_metadata) const { return true; } private: static null_type s_metadata; }; /** * A list-update policy that moves elements to the front of the * list based on the counter algorithm. */ template<std::size_t Max_Count = 5, typename _Alloc = std::allocator<char> > class lu_counter_policy : private detail::lu_counter_policy_base<typename _Alloc::size_type> { public: typedef _Alloc allocator_type; typedef typename allocator_type::size_type size_type; enum { /// When some element is accessed this number of times, it /// will be moved to the front of the list. max_count = Max_Count }; /// Metadata on which this functor operates. typedef detail::lu_counter_metadata<size_type> metadata_type; private: typedef detail::lu_counter_policy_base<size_type> base_type; typedef typename _Alloc::template rebind<metadata_type> __rebind_m; public: /// Reference to metadata on which this functor operates. typedef typename __rebind_m::other::reference metadata_reference; /// Creates a metadata object. metadata_type operator()() const { return base_type::operator()(max_count); } /// Decides whether a metadata object should be moved to the front /// of the list. bool operator()(metadata_reference r_data) const { return base_type::operator()(r_data, max_count); } }; } // namespace __gnu_pbds #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp�����������������������0000644�����������������00000004147�14763166027�0023140 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file detail/binomial_heap_/constructors_destructor_fn_imps.hpp * Contains an implementation for binomial_heap_. */ PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: binomial_heap() { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: binomial_heap(const Cmp_Fn& r_cmp_fn) : base_type(r_cmp_fn) { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: binomial_heap(const PB_DS_CLASS_C_DEC& other) : base_type(other) { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ~binomial_heap() { } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp����������������������������������������0000644�����������������00000007522�14763166027�0017325 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binomial_heap_.hpp * Contains an implementation class for a binomial heap. */ /* * Binomial heap. * Vuillemin J is the mastah. * Modified from CLRS. */ #include <debug/debug.h> #include <ext/pb_ds/detail/cond_dealtor.hpp> #include <ext/pb_ds/detail/type_utils.hpp> #include <ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp> namespace __gnu_pbds { namespace detail { #define PB_DS_CLASS_T_DEC \ template<typename Value_Type, typename Cmp_Fn, typename _Alloc> #define PB_DS_CLASS_C_DEC \ binomial_heap<Value_Type, Cmp_Fn, _Alloc> /** * Binomial heap. * * @ingroup heap-detail */ template<typename Value_Type, typename Cmp_Fn, typename _Alloc> class binomial_heap : public binomial_heap_base<Value_Type, Cmp_Fn, _Alloc> { private: typedef binomial_heap_base<Value_Type, Cmp_Fn, _Alloc> base_type; typedef typename base_type::node_pointer node_pointer; typedef typename base_type::node_const_pointer node_const_pointer; public: typedef Value_Type value_type; typedef typename _Alloc::size_type size_type; typedef typename _Alloc::difference_type difference_type; typedef typename base_type::pointer pointer; typedef typename base_type::const_pointer const_pointer; typedef typename base_type::reference reference; typedef typename base_type::const_reference const_reference; typedef typename base_type::point_const_iterator point_const_iterator; typedef typename base_type::point_iterator point_iterator; typedef typename base_type::const_iterator const_iterator; typedef typename base_type::iterator iterator; typedef typename base_type::cmp_fn cmp_fn; typedef typename base_type::allocator_type allocator_type; binomial_heap(); binomial_heap(const Cmp_Fn&); binomial_heap(const binomial_heap&); ~binomial_heap(); protected: #ifdef _GLIBCXX_DEBUG void assert_valid(const char*, int) const; #endif }; #include <ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp> #include <ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp> #undef PB_DS_CLASS_C_DEC #undef PB_DS_CLASS_T_DEC } // namespace detail } // namespace __gnu_pbds ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp�����������������������������������������0000644�����������������00000003551�14763166027�0017176 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file detail/binomial_heap_/debug_fn_imps.hpp * Contains an implementation for binomial_heap_. */ #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_valid(const char* __file, int __line) const { base_type::assert_valid(true, __file, __line); } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/unordered_iterator/iterator.hpp������������������������������������������0000644�����������������00000007325�14763166027�0017203 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file iterator.hpp * Contains an iterator_ class used for ranging over the elements of the * table. */ /// Range-type iterator. class iterator_ : public const_iterator_ { public: /// Category. typedef std::forward_iterator_tag iterator_category; /// Difference type. typedef typename _Alloc::difference_type difference_type; /// Iterator's value type. typedef value_type_ value_type; /// Iterator's pointer type. typedef pointer_ pointer; /// Iterator's const pointer type. typedef const_pointer_ const_pointer; /// Iterator's reference type. typedef reference_ reference; /// Iterator's const reference type. typedef const_reference_ const_reference; /// Default constructor. inline iterator_() : const_iterator_(0, PB_DS_GEN_POS(), 0) { } /// Conversion to a point-type iterator. inline operator point_iterator_() { return point_iterator_(const_cast<pointer>(const_iterator_::m_p_value)); } /// Conversion to a point-type iterator. inline operator const point_iterator_() const { return point_iterator_(const_cast<pointer>(const_iterator_::m_p_value)); } /// Access. pointer operator->() const { _GLIBCXX_DEBUG_ASSERT(base_type::m_p_value != 0); return (const_cast<pointer>(base_type::m_p_value)); } /// Access. reference operator*() const { _GLIBCXX_DEBUG_ASSERT(base_type::m_p_value != 0); return (const_cast<reference>(*base_type::m_p_value)); } /// Increments. iterator_& operator++() { base_type::m_p_tbl->inc_it_state(base_type::m_p_value, base_type::m_pos); return *this; } /// Increments. iterator_ operator++(int) { iterator_ ret =* this; base_type::m_p_tbl->inc_it_state(base_type::m_p_value, base_type::m_pos); return ret; } protected: typedef const_iterator_ base_type; /** * Constructor used by the table to initiate the generalized * pointer and position (e.g., this is called from within a find() * of a table. * */ inline iterator_(pointer p_value, PB_DS_GEN_POS pos, PB_DS_CLASS_C_DEC* p_tbl) : const_iterator_(p_value, pos, p_tbl) { } friend class PB_DS_CLASS_C_DEC; }; �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp������������������������������0000644�����������������00000007336�14763166027�0021624 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file unordered_iterator/point_const_iterator.hpp * Contains an iterator class returned by the tables' const find and insert * methods. */ class point_iterator_; /// Const point-type iterator. class point_const_iterator_ { public: /// Category. typedef trivial_iterator_tag iterator_category; /// Difference type. typedef trivial_iterator_difference_type difference_type; /// Iterator's value type. typedef value_type_ value_type; /// Iterator's pointer type. typedef pointer_ pointer; /// Iterator's const pointer type. typedef const_pointer_ const_pointer; /// Iterator's reference type. typedef reference_ reference; /// Iterator's const reference type. typedef const_reference_ const_reference; inline point_const_iterator_(const_pointer p_value) : m_p_value(p_value) { } /// Default constructor. inline point_const_iterator_() : m_p_value(0) { } /// Copy constructor. inline point_const_iterator_(const point_const_iterator_& other) : m_p_value(other.m_p_value) { } /// Copy constructor. inline point_const_iterator_(const point_iterator_& other) : m_p_value(other.m_p_value) { } /// Access. const_pointer operator->() const { _GLIBCXX_DEBUG_ASSERT(m_p_value != 0); return m_p_value; } /// Access. const_reference operator*() const { _GLIBCXX_DEBUG_ASSERT(m_p_value != 0); return *m_p_value; } /// Compares content to a different iterator object. bool operator==(const point_iterator_& other) const { return m_p_value == other.m_p_value; } /// Compares content to a different iterator object. bool operator==(const point_const_iterator_& other) const { return m_p_value == other.m_p_value; } /// Compares content (negatively) to a different iterator object. bool operator!=(const point_iterator_& other) const { return m_p_value != other.m_p_value; } /// Compares content (negatively) to a different iterator object. bool operator!=(const point_const_iterator_& other) const { return m_p_value != other.m_p_value; } protected: const_pointer m_p_value; friend class point_iterator_; friend class PB_DS_CLASS_C_DEC; }; ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp������������������������������������0000644�����������������00000006421�14763166027�0020405 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file unordered_iterator/const_iterator.hpp * Contains an iterator class used for const ranging over the elements of the * table. */ /// Const range-type iterator. class const_iterator_ : public point_const_iterator_ { public: /// Category. typedef std::forward_iterator_tag iterator_category; /// Difference type. typedef typename _Alloc::difference_type difference_type; /// Iterator's value type. typedef value_type_ value_type; /// Iterator's pointer type. typedef pointer_ pointer; /// Iterator's const pointer type. typedef const_pointer_ const_pointer; /// Iterator's reference type. typedef reference_ reference; /// Iterator's const reference type. typedef const_reference_ const_reference; /// Default constructor. const_iterator_() : m_p_tbl(0) { } /// Increments. const_iterator_& operator++() { m_p_tbl->inc_it_state(base_type::m_p_value, m_pos); return *this; } /// Increments. const_iterator_ operator++(int) { const_iterator_ ret =* this; m_p_tbl->inc_it_state(base_type::m_p_value, m_pos); return ret; } protected: typedef point_const_iterator_ base_type; /** * Constructor used by the table to initiate the generalized * pointer and position (e.g., this is called from within a find() * of a table. * */ const_iterator_(const_pointer_ p_value, PB_DS_GEN_POS pos, const PB_DS_CLASS_C_DEC* p_tbl) : point_const_iterator_(p_value), m_p_tbl(p_tbl), m_pos(pos) { } /** * Pointer to the table object which created the iterator (used for * incrementing its position. * */ const PB_DS_CLASS_C_DEC* m_p_tbl; PB_DS_GEN_POS m_pos; friend class PB_DS_CLASS_C_DEC; }; �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp������������������������������������0000644�����������������00000006766�14763166027�0020424 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file point_iterator.hpp * Contains an iterator class returned by the tables' find and insert * methods. */ /// Find type iterator. class point_iterator_ { public: /// Category. typedef trivial_iterator_tag iterator_category; /// Difference type. typedef trivial_iterator_difference_type difference_type; /// Iterator's value type. typedef value_type_ value_type; /// Iterator's pointer type. typedef pointer_ pointer; /// Iterator's const pointer type. typedef const_pointer_ const_pointer; /// Iterator's reference type. typedef reference_ reference; /// Iterator's const reference type. typedef const_reference_ const_reference; /// Default constructor. inline point_iterator_() : m_p_value(0) { } /// Copy constructor. inline point_iterator_(const point_iterator_& other) : m_p_value(other.m_p_value) { } /// Access. pointer operator->() const { _GLIBCXX_DEBUG_ASSERT(m_p_value != 0); return (m_p_value); } /// Access. reference operator*() const { _GLIBCXX_DEBUG_ASSERT(m_p_value != 0); return (*m_p_value); } /// Compares content to a different iterator object. bool operator==(const point_iterator_& other) const { return m_p_value == other.m_p_value; } /// Compares content to a different iterator object. bool operator==(const point_const_iterator_& other) const { return m_p_value == other.m_p_value; } /// Compares content to a different iterator object. bool operator!=(const point_iterator_& other) const { return m_p_value != other.m_p_value; } /// Compares content (negatively) to a different iterator object. bool operator!=(const point_const_iterator_& other) const { return m_p_value != other.m_p_value; } inline point_iterator_(pointer p_value) : m_p_value(p_value) { } protected: friend class point_const_iterator_; friend class PB_DS_CLASS_C_DEC; protected: pointer m_p_value; }; ����������c++/4.8.2/ext/pb_ds/detail/eq_fn/eq_by_less.hpp�����������������������������������������������������0000644�����������������00000004432�14763166027�0014663 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file eq_by_less.hpp * Contains an equivalence function. */ #ifndef PB_DS_EQ_BY_LESS_HPP #define PB_DS_EQ_BY_LESS_HPP #include <utility> #include <functional> #include <vector> #include <assert.h> #include <ext/pb_ds/detail/types_traits.hpp> namespace __gnu_pbds { namespace detail { /// Equivalence function. template<typename Key, class Cmp_Fn> struct eq_by_less : private Cmp_Fn { bool operator()(const Key& r_lhs, const Key& r_rhs) const { const bool l = Cmp_Fn::operator()(r_lhs, r_rhs); const bool g = Cmp_Fn::operator()(r_rhs, r_lhs); return !(l || g); } }; } // namespace detail } // namespace __gnu_pbds #endif // #ifndef PB_DS_EQ_BY_LESS_HPP ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp�����������������������������������������������������0000644�����������������00000007355�14763166027�0014640 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file hash_eq_fn.hpp * Contains 2 eqivalence functions, one employing a hash value, * and one ignoring it. */ #ifndef PB_DS_HASH_EQ_FN_HPP #define PB_DS_HASH_EQ_FN_HPP #include <utility> #include <debug/debug.h> namespace __gnu_pbds { namespace detail { /// Primary template. template<typename Key, typename Eq_Fn, typename _Alloc, bool Store_Hash> struct hash_eq_fn; /// Specialization 1 - The client requests that hash values not be stored. template<typename Key, typename Eq_Fn, typename _Alloc> struct hash_eq_fn<Key, Eq_Fn, _Alloc, false> : public Eq_Fn { typedef Eq_Fn eq_fn_base; typedef typename _Alloc::template rebind<Key>::other key_allocator; typedef typename key_allocator::const_reference key_const_reference; hash_eq_fn() { } hash_eq_fn(const Eq_Fn& r_eq_fn) : Eq_Fn(r_eq_fn) { } bool operator()(key_const_reference r_lhs_key, key_const_reference r_rhs_key) const { return eq_fn_base::operator()(r_lhs_key, r_rhs_key); } void swap(const hash_eq_fn& other) { std::swap((Eq_Fn&)(*this), (Eq_Fn&)other); } }; /// Specialization 2 - The client requests that hash values be stored. template<typename Key, class Eq_Fn, class _Alloc> struct hash_eq_fn<Key, Eq_Fn, _Alloc, true> : public Eq_Fn { typedef typename _Alloc::size_type size_type; typedef Eq_Fn eq_fn_base; typedef typename _Alloc::template rebind<Key>::other key_allocator; typedef typename key_allocator::const_reference key_const_reference; hash_eq_fn() { } hash_eq_fn(const Eq_Fn& r_eq_fn) : Eq_Fn(r_eq_fn) { } bool operator()(key_const_reference r_lhs_key, size_type lhs_hash, key_const_reference r_rhs_key, size_type rhs_hash) const { _GLIBCXX_DEBUG_ASSERT(!eq_fn_base::operator()(r_lhs_key, r_rhs_key) || lhs_hash == rhs_hash); return (lhs_hash == rhs_hash && eq_fn_base::operator()(r_lhs_key, r_rhs_key)); } void swap(const hash_eq_fn& other) { std::swap((Eq_Fn&)(*this), (Eq_Fn&)(other)); } }; } // namespace detail } // namespace __gnu_pbds #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp�������������������������������������0000644�����������������00000011135�14763166027�0020220 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file trie_policy/order_statistics_imp.hpp * Contains forward declarations for order_statistics_key */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: find_by_order(size_type order) { if (empty()) return end(); ++order; node_iterator nd_it = node_begin(); while (true) { if (order > nd_it.get_metadata()) return ++base_type::rightmost_it(nd_it); const size_type num_children = nd_it.num_children(); if (num_children == 0) return *nd_it; for (size_type i = 0; i < num_children; ++i) { node_iterator child_nd_it = nd_it.get_child(i); if (order <= child_nd_it.get_metadata()) { i = num_children; nd_it = child_nd_it; } else order -= child_nd_it.get_metadata(); } } } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: find_by_order(size_type order) const { return const_cast<PB_DS_CLASS_C_DEC*>(this)->find_by_order(order); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: order_of_key(key_const_reference r_key) const { const _ATraits& r_traits = const_cast<PB_DS_CLASS_C_DEC* >(this)->get_access_traits(); return order_of_prefix(r_traits.begin(r_key), r_traits.end(r_key)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: order_of_prefix(typename access_traits::const_iterator b, typename access_traits::const_iterator e) const { if (empty()) return 0; const _ATraits& r_traits = const_cast<PB_DS_CLASS_C_DEC*>(this)->get_access_traits(); node_const_iterator nd_it = node_begin(); node_const_iterator end_nd_it = node_end(); size_type ord = 0; while (true) { const size_type num_children = nd_it.num_children(); if (num_children == 0) { key_const_reference r_key = base_type::extract_key(*(*nd_it)); typename access_traits::const_iterator key_b = r_traits.begin(r_key); typename access_traits::const_iterator key_e = r_traits.end(r_key); return (base_type::less(key_b, key_e, b, e, r_traits)) ? ord + 1 : ord; } node_const_iterator next_nd_it = end_nd_it; size_type i = num_children - 1; do { node_const_iterator child_nd_it = nd_it.get_child(i); if (next_nd_it != end_nd_it) ord += child_nd_it.get_metadata(); else if (!base_type::less(b, e, child_nd_it.valid_prefix().first, child_nd_it.valid_prefix().second, r_traits)) next_nd_it = child_nd_it; } while (i-- > 0); if (next_nd_it == end_nd_it) return ord; nd_it = next_nd_it; } } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: operator()(node_iterator nd_it, node_const_iterator /*end_nd_it*/) const { const size_type num_children = nd_it.num_children(); size_type children_rank = 0; for (size_type i = 0; i < num_children; ++i) children_rank += nd_it.get_child(i).get_metadata(); const size_type res = (num_children == 0) ? 1 : children_rank; const_cast<size_type&>(nd_it.get_metadata()) = res; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp�����������������������������������0000644�����������������00000006412�14763166027�0020455 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file trie_policy/node_metadata_selector.hpp * Contains an implementation class for tries. */ #ifndef PB_DS_TRIE_NODE_METADATA_DISPATCH_HPP #define PB_DS_TRIE_NODE_METADATA_DISPATCH_HPP #include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp> #include <ext/pb_ds/detail/types_traits.hpp> namespace __gnu_pbds { namespace detail { /** * @addtogroup traits Traits * @{ */ /// Trie metadata helper. template<typename Node_Update, bool _BTp> struct trie_metadata_helper; /// Specialization, false. template<typename Node_Update> struct trie_metadata_helper<Node_Update, false> { typedef typename Node_Update::metadata_type type; }; /// Specialization, true. template<typename Node_Update> struct trie_metadata_helper<Node_Update, true> { typedef null_type type; }; /// Trie node metadata dispatch. template<typename Key, typename Data, typename Cmp_Fn, template<typename Node_CItr, typename Const_Iterator, typename Cmp_Fn_, typename _Alloc_> class Node_Update, typename _Alloc> struct trie_node_metadata_dispatch { private: typedef dumnode_const_iterator<Key, Data, _Alloc> __it_type; typedef Node_Update<__it_type, __it_type, Cmp_Fn, _Alloc> __node_u; typedef null_node_update<__it_type, __it_type, Cmp_Fn, _Alloc> __nnode_u; enum { null_update = is_same<__node_u, __nnode_u>::value }; public: typedef typename trie_metadata_helper<__node_u, null_update>::type type; }; //@} } // namespace detail } // namespace __gnu_pbds #endif // #ifndef PB_DS_TRIE_NODE_METADATA_DISPATCH_HPP ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/trie_policy/trie_string_access_traits_imp.hpp����������������������������0000644�����������������00000005753�14763166027�0022104 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file trie_policy/trie_string_access_traits_imp.hpp * Contains a policy for extracting character positions from * a string for a vector-based PATRICIA tree */ PB_DS_CLASS_T_DEC detail::integral_constant<int, Reverse> PB_DS_CLASS_C_DEC::s_rev_ind; PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: e_pos(e_type e) { return (static_cast<size_type>(e - min_e_val)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: begin(key_const_reference r_key) { return (begin_imp(r_key, s_rev_ind)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: end(key_const_reference r_key) { return (end_imp(r_key, s_rev_ind)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: begin_imp(key_const_reference r_key, detail::false_type) { return (r_key.begin()); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: begin_imp(key_const_reference r_key, detail::true_type) { return (r_key.rbegin()); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: end_imp(key_const_reference r_key, detail::false_type) { return (r_key.end()); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: end_imp(key_const_reference r_key, detail::true_type) { return (r_key.rend()); } ���������������������c++/4.8.2/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp����������������������������0000644�����������������00000010637�14763166027�0022032 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file trie_policy/prefix_search_node_update_imp.hpp * Contains an implementation of prefix_search_node_update. */ PB_DS_CLASS_T_DEC std::pair< typename PB_DS_CLASS_C_DEC::const_iterator, typename PB_DS_CLASS_C_DEC::const_iterator> PB_DS_CLASS_C_DEC:: prefix_range(key_const_reference r_key) const { const access_traits& r_traits = get_access_traits(); return (prefix_range(r_traits.begin(r_key), r_traits.end(r_key))); } PB_DS_CLASS_T_DEC std::pair< typename PB_DS_CLASS_C_DEC::iterator, typename PB_DS_CLASS_C_DEC::iterator> PB_DS_CLASS_C_DEC:: prefix_range(key_const_reference r_key) { return (prefix_range(get_access_traits().begin(r_key), get_access_traits().end(r_key))); } PB_DS_CLASS_T_DEC std::pair< typename PB_DS_CLASS_C_DEC::const_iterator, typename PB_DS_CLASS_C_DEC::const_iterator> PB_DS_CLASS_C_DEC:: prefix_range(typename access_traits::const_iterator b, typename access_traits::const_iterator e) const { const std::pair<iterator, iterator> non_const_ret = const_cast<PB_DS_CLASS_C_DEC* >(this)->prefix_range(b, e); return (std::make_pair(const_iterator(non_const_ret.first), const_iterator(non_const_ret.second))); } PB_DS_CLASS_T_DEC std::pair< typename PB_DS_CLASS_C_DEC::iterator, typename PB_DS_CLASS_C_DEC::iterator> PB_DS_CLASS_C_DEC:: prefix_range(typename access_traits::const_iterator b, typename access_traits::const_iterator e) { Node_Itr nd_it = node_begin(); Node_Itr end_nd_it = node_end(); const access_traits& r_traits = get_access_traits(); const size_type given_range_length = std::distance(b, e); while (true) { if (nd_it == end_nd_it) return (std::make_pair(end(), end())); const size_type common_range_length = base_type::common_prefix_len(nd_it, b, e, r_traits); if (common_range_length >= given_range_length) { iterator ret_b = this->leftmost_it(nd_it); iterator ret_e = this->rightmost_it(nd_it); return (std::make_pair(ret_b, ++ret_e)); } nd_it = next_child(nd_it, b, e, end_nd_it, r_traits); } } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_iterator PB_DS_CLASS_C_DEC:: next_child(node_iterator nd_it, typename access_traits::const_iterator b, typename access_traits::const_iterator e, node_iterator end_nd_it, const access_traits& r_traits) { const size_type num_children = nd_it.num_children(); node_iterator ret = end_nd_it; size_type max_length = 0; for (size_type i = 0; i < num_children; ++i) { node_iterator pot = nd_it.get_child(i); const size_type common_range_length = base_type::common_prefix_len(pot, b, e, r_traits); if (common_range_length > max_length) { ret = pot; max_length = common_range_length; } } return (ret); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: operator()(node_iterator /*nd_it*/, node_const_iterator /*end_nd_it*/) const { } �������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/trie_policy/sample_trie_access_traits.hpp��������������������������������0000644�����������������00000005231�14763166027�0021201 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file trie_policy/sample_trie_access_traits.hpp * Contains a sample probe policy. */ #ifndef PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP #define PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP namespace __gnu_pbds { /// A sample trie element access traits. struct sample_trie_access_traits { typedef std::size_t size_type; typedef std::string key_type; typedef typename _Alloc::template rebind<key_type> __rebind_k; typedef typename __rebind_k::other::const_reference key_const_reference; typedef std::string::const_iterator const_iterator; /// Element type. typedef char e_type; enum { max_size = 4 }; /// Returns a const_iterator to the first element of r_key. inline static const_iterator begin(key_const_reference); /// Returns a const_iterator to the after-last element of r_key. inline static const_iterator end(key_const_reference); /// Maps an element to a position. inline static size_type e_pos(e_type); }; } #endif // #ifndef PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp����������������������������������0000644�����������������00000004454�14763166027�0020647 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file trie_policy/sample_trie_node_update.hpp * Contains a samle node update functor. */ #ifndef PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP #define PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP namespace __gnu_pbds { /// A sample node updator. template<typename Node_CItr, typename Node_Itr, typename _ATraits, typename _Alloc> class sample_trie_node_update { public: typedef std::size_t metadata_type; protected: /// Default constructor. sample_trie_node_update(); /// Updates the rank of a node through a node_iterator node_it; /// end_nd_it is the end node iterator. inline void operator()(node_iterator, node_const_iterator) const; }; } #endif // #ifndef PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp�����������������������������������������0000644�����������������00000013327�14763166027�0017307 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file trie_policy/trie_policy_base.hpp * Contains an implementation of trie_policy_base. */ #ifndef PB_DS_TRIE_POLICY_BASE_HPP #define PB_DS_TRIE_POLICY_BASE_HPP #include <ext/pb_ds/detail/branch_policy/branch_policy.hpp> namespace __gnu_pbds { namespace detail { /// Base class for trie policies. template<typename Node_CItr, typename Node_Itr, typename _ATraits, typename _Alloc> class trie_policy_base : public branch_policy<Node_CItr, Node_Itr, _Alloc> { typedef branch_policy<Node_CItr, Node_Itr, _Alloc> base_type; public: typedef _ATraits access_traits; typedef _Alloc allocator_type; typedef typename allocator_type::size_type size_type; typedef null_type metadata_type; typedef Node_CItr node_const_iterator; typedef Node_Itr node_iterator; typedef typename node_const_iterator::value_type const_iterator; typedef typename node_iterator::value_type iterator; typedef typename base_type::key_type key_type; typedef typename base_type::key_const_reference key_const_reference; protected: virtual const_iterator end() const = 0; virtual iterator end() = 0; virtual node_const_iterator node_begin() const = 0; virtual node_iterator node_begin() = 0; virtual node_const_iterator node_end() const = 0; virtual node_iterator node_end() = 0; virtual const access_traits& get_access_traits() const = 0; private: typedef typename access_traits::const_iterator e_const_iterator; typedef std::pair<e_const_iterator, e_const_iterator> prefix_range_t; protected: static size_type common_prefix_len(node_iterator, e_const_iterator, e_const_iterator, const access_traits&); static iterator leftmost_it(node_iterator); static iterator rightmost_it(node_iterator); static bool less(e_const_iterator, e_const_iterator, e_const_iterator, e_const_iterator, const access_traits&); }; #define PB_DS_CLASS_T_DEC \ template<typename Node_CItr, typename Node_Itr, \ typename _ATraits, typename _Alloc> #define PB_DS_CLASS_C_DEC \ trie_policy_base<Node_CItr, Node_Itr, _ATraits, _Alloc> PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: common_prefix_len(node_iterator nd_it, e_const_iterator b_r, e_const_iterator e_r, const access_traits& r_traits) { prefix_range_t pref_range = nd_it.valid_prefix(); e_const_iterator b_l = pref_range.first; e_const_iterator e_l = pref_range.second; const size_type range_length_l = std::distance(b_l, e_l); const size_type range_length_r = std::distance(b_r, e_r); if (range_length_r < range_length_l) { std::swap(b_l, b_r); std::swap(e_l, e_r); } size_type ret = 0; while (b_l != e_l) { if (r_traits.e_pos(*b_l) != r_traits.e_pos(*b_r)) return ret; ++ret; ++b_l; ++b_r; } return ret; } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: leftmost_it(node_iterator nd_it) { if (nd_it.num_children() == 0) return *nd_it; return leftmost_it(nd_it.get_child(0)); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: rightmost_it(node_iterator nd_it) { const size_type num_children = nd_it.num_children(); if (num_children == 0) return *nd_it; return rightmost_it(nd_it.get_child(num_children - 1)); } PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: less(e_const_iterator b_l, e_const_iterator e_l, e_const_iterator b_r, e_const_iterator e_r, const access_traits& r_traits) { while (b_l != e_l) { if (b_r == e_r) return false; size_type l_pos = r_traits.e_pos(*b_l); size_type r_pos = r_traits.e_pos(*b_r); if (l_pos != r_pos) return (l_pos < r_pos); ++b_l; ++b_r; } return b_r != e_r; } #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC } // namespace detail } // namespace __gnu_pbds #endif // #ifndef PB_DS_TRIE_POLICY_BASE_HPP ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/types_traits.hpp���������������������������������������������������������0000644�����������������00000023416�14763166027�0014203 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file detail/types_traits.hpp * Contains a traits class of types used by containers. */ #ifndef PB_DS_TYPES_TRAITS_HPP #define PB_DS_TYPES_TRAITS_HPP #include <algorithm> #include <utility> #include <ext/pb_ds/tag_and_trait.hpp> #include <ext/pb_ds/detail/type_utils.hpp> #include <utility> namespace __gnu_pbds { namespace detail { /** * @addtogroup traits Traits * @{ */ /// Primary template. template<typename Key, typename Mapped> struct no_throw_copies { static const bool __simple = is_simple<Key>::value && is_simple<Mapped>::value; typedef integral_constant<int, __simple> indicator; }; /// Specialization. template<typename Key> struct no_throw_copies<Key, null_type> { typedef integral_constant<int, is_simple<Key>::value> indicator; }; /// Stored value. template<typename _Tv> struct stored_value { typedef _Tv value_type; value_type m_value; }; /// Stored hash. template<typename _Th> struct stored_hash { typedef _Th hash_type; hash_type m_hash; }; /// Primary template for representation of stored data. /// Two types of data can be stored: value and hash. template<typename _Tv, typename _Th> struct stored_data : public stored_value<_Tv>, public stored_hash<_Th> { }; /// Specialization for representation of stored data of just value type. template<typename _Tv> struct stored_data<_Tv, null_type> : public stored_value<_Tv> { }; /// Primary template. template<typename Key, typename Mapped, typename _Alloc, bool Store_Hash> struct type_base; /** * Specialization of type_base for the case where the hash value * is not stored alongside each value. */ template<typename Key, typename Mapped, typename _Alloc> struct type_base<Key, Mapped, _Alloc, false> { public: typedef typename _Alloc::size_type size_type; private: typedef typename _Alloc::template rebind<Mapped> __rebind_m; typedef typename __rebind_m::other __rebind_ma; typedef std::pair<const Key, Mapped> __value_type; typedef typename _Alloc::template rebind<__value_type> __rebind_v; typedef typename __rebind_v::other __rebind_va; public: typedef typename __rebind_ma::value_type mapped_type; typedef typename __rebind_ma::pointer mapped_pointer; typedef typename __rebind_ma::const_pointer mapped_const_pointer; typedef typename __rebind_ma::reference mapped_reference; typedef typename __rebind_ma::const_reference mapped_const_reference; typedef typename __rebind_va::value_type value_type; typedef typename __rebind_va::pointer pointer; typedef typename __rebind_va::const_pointer const_pointer; typedef typename __rebind_va::reference reference; typedef typename __rebind_va::const_reference const_reference; typedef stored_data<value_type, null_type> stored_data_type; }; /** * Specialization of type_base for the case where the hash value * is stored alongside each value. */ template<typename Key, typename Mapped, typename _Alloc> struct type_base<Key, Mapped, _Alloc, true> { public: typedef typename _Alloc::size_type size_type; private: typedef typename _Alloc::template rebind<Mapped> __rebind_m; typedef typename __rebind_m::other __rebind_ma; typedef std::pair<const Key, Mapped> __value_type; typedef typename _Alloc::template rebind<__value_type> __rebind_v; typedef typename __rebind_v::other __rebind_va; public: typedef typename __rebind_ma::value_type mapped_type; typedef typename __rebind_ma::pointer mapped_pointer; typedef typename __rebind_ma::const_pointer mapped_const_pointer; typedef typename __rebind_ma::reference mapped_reference; typedef typename __rebind_ma::const_reference mapped_const_reference; typedef typename __rebind_va::value_type value_type; typedef typename __rebind_va::pointer pointer; typedef typename __rebind_va::const_pointer const_pointer; typedef typename __rebind_va::reference reference; typedef typename __rebind_va::const_reference const_reference; typedef stored_data<value_type, size_type> stored_data_type; }; /** * Specialization of type_base for the case where the hash value * is not stored alongside each value. */ template<typename Key, typename _Alloc> struct type_base<Key, null_type, _Alloc, false> { public: typedef typename _Alloc::size_type size_type; typedef Key value_type; private: typedef typename _Alloc::template rebind<null_type> __rebind_m; typedef typename __rebind_m::other __rebind_ma; typedef typename _Alloc::template rebind<value_type> __rebind_v; typedef typename __rebind_v::other __rebind_va; public: typedef typename __rebind_ma::value_type mapped_type; typedef typename __rebind_ma::pointer mapped_pointer; typedef typename __rebind_ma::const_pointer mapped_const_pointer; typedef typename __rebind_ma::reference mapped_reference; typedef typename __rebind_ma::const_reference mapped_const_reference; typedef typename __rebind_va::pointer pointer; typedef typename __rebind_va::const_pointer const_pointer; typedef typename __rebind_va::reference reference; typedef typename __rebind_va::const_reference const_reference; typedef stored_data<value_type, null_type> stored_data_type; static null_type s_null_type; }; template<typename Key, typename _Alloc> null_type type_base<Key, null_type, _Alloc, false>::s_null_type; /** * Specialization of type_base for the case where the hash value * is stored alongside each value. */ template<typename Key, typename _Alloc> struct type_base<Key, null_type, _Alloc, true> { public: typedef typename _Alloc::size_type size_type; typedef Key value_type; private: typedef typename _Alloc::template rebind<null_type> __rebind_m; typedef typename __rebind_m::other __rebind_ma; typedef typename _Alloc::template rebind<value_type> __rebind_v; typedef typename __rebind_v::other __rebind_va; public: typedef typename __rebind_ma::value_type mapped_type; typedef typename __rebind_ma::pointer mapped_pointer; typedef typename __rebind_ma::const_pointer mapped_const_pointer; typedef typename __rebind_ma::reference mapped_reference; typedef typename __rebind_ma::const_reference mapped_const_reference; typedef typename __rebind_va::pointer pointer; typedef typename __rebind_va::const_pointer const_pointer; typedef typename __rebind_va::reference reference; typedef typename __rebind_va::const_reference const_reference; typedef stored_data<value_type, size_type> stored_data_type; static null_type s_null_type; }; template<typename Key, typename _Alloc> null_type type_base<Key, null_type, _Alloc, true>::s_null_type; /// Type base dispatch. template<typename Key, typename Mapped, typename _Alloc, bool Store_Hash> struct type_dispatch { typedef type_base<Key, Mapped, _Alloc, Store_Hash> type; }; /// Traits for abstract types. template<typename Key, typename Mapped, typename _Alloc, bool Store_Hash> struct types_traits : public type_dispatch<Key, Mapped, _Alloc, Store_Hash>::type { private: typedef no_throw_copies<Key, Mapped> __nothrowcopy; typedef typename _Alloc::template rebind<Key>::other __rebind_a; public: typedef typename _Alloc::size_type size_type; typedef typename __rebind_a::value_type key_type; typedef typename __rebind_a::pointer key_pointer; typedef typename __rebind_a::const_pointer key_const_pointer; typedef typename __rebind_a::reference key_reference; typedef typename __rebind_a::const_reference key_const_reference; typedef std::pair<size_type, size_type> comp_hash; typedef integral_constant<int, Store_Hash> store_extra; typedef typename __nothrowcopy::indicator no_throw_indicator; store_extra m_store_extra_indicator; no_throw_indicator m_no_throw_copies_indicator; }; //@} } // namespace detail } // namespace __gnu_pbds #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/list_update_policy/lu_counter_metadata.hpp�������������������������������0000644�����������������00000005442�14763166027�0021363 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file lu_counter_metadata.hpp * Contains implementation of a lu counter policy's metadata. */ namespace __gnu_pbds { namespace detail { template<typename Size_Type> class lu_counter_policy_base; /// A list-update metadata type that moves elements to the front of /// the list based on the counter algorithm. template<typename Size_Type = std::size_t> class lu_counter_metadata { public: typedef Size_Type size_type; private: lu_counter_metadata(size_type init_count) : m_count(init_count) { } friend class lu_counter_policy_base<size_type>; mutable size_type m_count; }; /// Base class for list-update counter policy. template<typename Size_Type> class lu_counter_policy_base { protected: typedef Size_Type size_type; lu_counter_metadata<size_type> operator()(size_type max_size) const { return lu_counter_metadata<Size_Type>(std::rand() % max_size); } template<typename Metadata_Reference> bool operator()(Metadata_Reference r_data, size_type m_max_count) const { if (++r_data.m_count != m_max_count) return false; r_data.m_count = 0; return true; } }; } // namespace detail } // namespace __gnu_pbds ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp������������������������������0000644�����������������00000005160�14763166027�0021543 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file sample_update_policy.hpp * Contains a sample policy for list update containers. */ #ifndef PB_DS_SAMPLE_UPDATE_POLICY_HPP #define PB_DS_SAMPLE_UPDATE_POLICY_HPP namespace __gnu_pbds { /// A sample list-update policy. struct sample_update_policy { /// Default constructor. sample_update_policy(); /// Copy constructor. sample_update_policy(const sample_update_policy&); /// Swaps content. inline void swap(sample_update_policy& other); protected: /// Metadata on which this functor operates. typedef some_metadata_type metadata_type; /// Creates a metadata object. metadata_type operator()() const; /// Decides whether a metadata object should be moved to the front /// of the list. A list-update based containers object will call /// this method to decide whether to move a node to the front of /// the list. The method shoule return true if the node should be /// moved to the front of the list. bool operator()(metadata_reference) const; }; } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/standard_policies.hpp����������������������������������������������������0000644�����������������00000011647�14763166027�0015143 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file detail/standard_policies.hpp * Contains standard policies for containers. */ #ifndef PB_DS_STANDARD_POLICIES_HPP #define PB_DS_STANDARD_POLICIES_HPP #include <memory> #include <ext/pb_ds/hash_policy.hpp> #include <ext/pb_ds/list_update_policy.hpp> #include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/trie_policy.hpp> #include <ext/pb_ds/tag_and_trait.hpp> #include <tr1/functional> namespace __gnu_pbds { namespace detail { /// Primary template, default_hash_fn. template<typename Key> struct default_hash_fn { /// Dispatched type. typedef std::tr1::hash<Key> type; }; /// Primary template, default_eq_fn. template<typename Key> struct default_eq_fn { /// Dispatched type. typedef std::equal_to<Key> type; }; /// Enumeration for default behavior of stored hash data. enum { default_store_hash = false }; /// Primary template, default_comb_hash_fn. struct default_comb_hash_fn { /// Dispatched type. typedef direct_mask_range_hashing<> type; }; /// Primary template, default_resize_policy. template<typename Comb_Hash_Fn> struct default_resize_policy { private: typedef typename Comb_Hash_Fn::size_type size_type; typedef direct_mask_range_hashing<size_type> default_fn; typedef is_same<default_fn, Comb_Hash_Fn> same_type; typedef hash_exponential_size_policy<size_type> iftrue; typedef hash_prime_size_policy iffalse; typedef __conditional_type<same_type::value, iftrue, iffalse> cond_type; typedef typename cond_type::__type size_policy_type; typedef hash_load_check_resize_trigger<false, size_type> trigger; public: /// Dispatched type. typedef hash_standard_resize_policy<size_policy_type, trigger, false, size_type> type; }; /// Default update policy. struct default_update_policy { /// Dispatched type. typedef lu_move_to_front_policy<> type; }; /// Primary template, default_probe_fn. template<typename Comb_Probe_Fn> struct default_probe_fn { private: typedef typename Comb_Probe_Fn::size_type size_type; typedef direct_mask_range_hashing<size_type> default_fn; typedef is_same<default_fn, Comb_Probe_Fn> same_type; typedef linear_probe_fn<size_type> iftrue; typedef quadratic_probe_fn<size_type> iffalse; typedef __conditional_type<same_type::value, iftrue, iffalse> cond_type; public: /// Dispatched type. typedef typename cond_type::__type type; }; /// Primary template, default_trie_access_traits. template<typename Key> struct default_trie_access_traits; #define __dtrie_alloc std::allocator<char> #define __dtrie_string std::basic_string<Char, Char_Traits, __dtrie_alloc> /// Partial specialization, default_trie_access_traits. template<typename Char, typename Char_Traits> struct default_trie_access_traits<__dtrie_string> { private: typedef __dtrie_string string_type; public: /// Dispatched type. typedef trie_string_access_traits<string_type> type; }; #undef __dtrie_alloc #undef __dtrie_string } // namespace detail } // namespace __gnu_pbds #endif // #ifndef PB_DS_STANDARD_POLICIES_HPP �����������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp��������������������������������������������0000644�����������������00000017561�14763166027�0016626 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file splay_tree_/splay_fn_imps.hpp * Contains an implementation class for splay_tree_. */ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: splay(node_pointer p_nd) { while (p_nd->m_p_parent != base_type::m_p_head) { #ifdef _GLIBCXX_DEBUG { node_pointer p_head = base_type::m_p_head; assert_special_imp(p_head, __FILE__, __LINE__); } #endif PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_nd) if (p_nd->m_p_parent->m_p_parent == base_type::m_p_head) { base_type::rotate_parent(p_nd); _GLIBCXX_DEBUG_ASSERT(p_nd == this->m_p_head->m_p_parent); } else { const node_pointer p_parent = p_nd->m_p_parent; const node_pointer p_grandparent = p_parent->m_p_parent; #ifdef _GLIBCXX_DEBUG const size_type total = base_type::recursive_count(p_grandparent); _GLIBCXX_DEBUG_ASSERT(total >= 3); #endif if (p_parent->m_p_left == p_nd && p_grandparent->m_p_right == p_parent) splay_zig_zag_left(p_nd, p_parent, p_grandparent); else if (p_parent->m_p_right == p_nd && p_grandparent->m_p_left == p_parent) splay_zig_zag_right(p_nd, p_parent, p_grandparent); else if (p_parent->m_p_left == p_nd && p_grandparent->m_p_left == p_parent) splay_zig_zig_left(p_nd, p_parent, p_grandparent); else splay_zig_zig_right(p_nd, p_parent, p_grandparent); _GLIBCXX_DEBUG_ASSERT(total ==this->recursive_count(p_nd)); } PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_nd) } } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: splay_zig_zag_left(node_pointer p_nd, node_pointer p_parent, node_pointer p_grandparent) { _GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent); _GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent); PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_grandparent) _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_left == p_nd && p_grandparent->m_p_right == p_parent); splay_zz_start(p_nd, p_parent, p_grandparent); node_pointer p_b = p_nd->m_p_right; node_pointer p_c = p_nd->m_p_left; p_nd->m_p_right = p_parent; p_parent->m_p_parent = p_nd; p_nd->m_p_left = p_grandparent; p_grandparent->m_p_parent = p_nd; p_parent->m_p_left = p_b; if (p_b != 0) p_b->m_p_parent = p_parent; p_grandparent->m_p_right = p_c; if (p_c != 0) p_c->m_p_parent = p_grandparent; splay_zz_end(p_nd, p_parent, p_grandparent); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: splay_zig_zag_right(node_pointer p_nd, node_pointer p_parent, node_pointer p_grandparent) { _GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent); _GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent); PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_grandparent) _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_right == p_nd && p_grandparent->m_p_left == p_parent); splay_zz_start(p_nd, p_parent, p_grandparent); node_pointer p_b = p_nd->m_p_left; node_pointer p_c = p_nd->m_p_right; p_nd->m_p_left = p_parent; p_parent->m_p_parent = p_nd; p_nd->m_p_right = p_grandparent; p_grandparent->m_p_parent = p_nd; p_parent->m_p_right = p_b; if (p_b != 0) p_b->m_p_parent = p_parent; p_grandparent->m_p_left = p_c; if (p_c != 0) p_c->m_p_parent = p_grandparent; splay_zz_end(p_nd, p_parent, p_grandparent); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: splay_zig_zig_left(node_pointer p_nd, node_pointer p_parent, node_pointer p_grandparent) { _GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent); _GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent); PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_grandparent) _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_left == p_nd && p_nd->m_p_parent->m_p_parent->m_p_left == p_nd->m_p_parent); splay_zz_start(p_nd, p_parent, p_grandparent); node_pointer p_b = p_nd->m_p_right; node_pointer p_c = p_parent->m_p_right; p_nd->m_p_right = p_parent; p_parent->m_p_parent = p_nd; p_parent->m_p_right = p_grandparent; p_grandparent->m_p_parent = p_parent; p_parent->m_p_left = p_b; if (p_b != 0) p_b->m_p_parent = p_parent; p_grandparent->m_p_left = p_c; if (p_c != 0) p_c->m_p_parent = p_grandparent; splay_zz_end(p_nd, p_parent, p_grandparent); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: splay_zig_zig_right(node_pointer p_nd, node_pointer p_parent, node_pointer p_grandparent) { _GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent); _GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent); PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_grandparent) _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_right == p_nd && p_nd->m_p_parent->m_p_parent->m_p_right == p_nd->m_p_parent); splay_zz_start(p_nd, p_parent, p_grandparent); node_pointer p_b = p_nd->m_p_left; node_pointer p_c = p_parent->m_p_left; p_nd->m_p_left = p_parent; p_parent->m_p_parent = p_nd; p_parent->m_p_left = p_grandparent; p_grandparent->m_p_parent = p_parent; p_parent->m_p_right = p_b; if (p_b != 0) p_b->m_p_parent = p_parent; p_grandparent->m_p_right = p_c; if (p_c != 0) p_c->m_p_parent = p_grandparent; base_type::update_to_top(p_grandparent, (node_update*)this); splay_zz_end(p_nd, p_parent, p_grandparent); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: splay_zz_start(node_pointer p_nd, #ifdef _GLIBCXX_DEBUG node_pointer p_parent, #else node_pointer /*p_parent*/, #endif node_pointer p_grandparent) { _GLIBCXX_DEBUG_ASSERT(p_nd != 0); _GLIBCXX_DEBUG_ASSERT(p_parent != 0); _GLIBCXX_DEBUG_ASSERT(p_grandparent != 0); const bool grandparent_head = p_grandparent->m_p_parent == base_type::m_p_head; if (grandparent_head) { base_type::m_p_head->m_p_parent = base_type::m_p_head->m_p_parent; p_nd->m_p_parent = base_type::m_p_head; return; } node_pointer p_greatgrandparent = p_grandparent->m_p_parent; p_nd->m_p_parent = p_greatgrandparent; if (p_grandparent == p_greatgrandparent->m_p_left) p_greatgrandparent->m_p_left = p_nd; else p_greatgrandparent->m_p_right = p_nd; } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: splay_zz_end(node_pointer p_nd, node_pointer p_parent, node_pointer p_grandparent) { if (p_nd->m_p_parent == base_type::m_p_head) base_type::m_p_head->m_p_parent = p_nd; this->apply_update(p_grandparent, (node_update*)this); this->apply_update(p_parent, (node_update*)this); this->apply_update(p_nd, (node_update*)this); PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_nd) } �����������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp��������������������������0000644�����������������00000005437�14763166027�0022523 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file splay_tree_/constructors_destructor_fn_imps.hpp * Contains an implementation class for splay_tree_. */ PB_DS_CLASS_T_DEC template<typename It> void PB_DS_CLASS_C_DEC:: copy_from_range(It first_it, It last_it) { while (first_it != last_it) insert(*(first_it++)); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_S_TREE_NAME() { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_S_TREE_NAME(const Cmp_Fn& r_cmp_fn) : base_type(r_cmp_fn) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_S_TREE_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) : base_type(r_cmp_fn, r_node_update) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_S_TREE_NAME(const PB_DS_CLASS_C_DEC& other) : base_type(other) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) base_type::swap(other); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: initialize() { base_type::m_p_head->m_special = true; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp�������������������������������������������0000644�����������������00000006431�14763166027�0016774 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file splay_tree_/insert_fn_imps.hpp * Contains an implementation class for splay_tree_. */ PB_DS_CLASS_T_DEC inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool> PB_DS_CLASS_C_DEC:: insert(const_reference r_value) { PB_DS_ASSERT_VALID((*this)) std::pair<point_iterator, bool> ins_pair = insert_leaf_imp(r_value); ins_pair.first.m_p_nd->m_special = false; PB_DS_ASSERT_VALID((*this)) splay(ins_pair.first.m_p_nd); PB_DS_ASSERT_VALID((*this)) return ins_pair; } PB_DS_CLASS_T_DEC inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool> PB_DS_CLASS_C_DEC:: insert_leaf_imp(const_reference r_value) { _GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid(__FILE__, __LINE__);) if (base_type::m_size == 0) return std::make_pair(base_type::insert_imp_empty(r_value), true); node_pointer p_nd = base_type::m_p_head->m_p_parent; node_pointer p_pot = base_type::m_p_head; while (p_nd != 0) if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), PB_DS_V2F(r_value))) { if (!Cmp_Fn::operator()(PB_DS_V2F(r_value), PB_DS_V2F(p_nd->m_value))) { return std::make_pair(point_iterator(p_nd), false); } p_pot = p_nd; p_nd = p_nd->m_p_left; } else p_nd = p_nd->m_p_right; if (p_pot == base_type::m_p_head) return std::make_pair(base_type::insert_leaf_new(r_value, base_type::m_p_head->m_p_right, false), true); PB_DS_CHECK_KEY_DOES_NOT_EXIST(PB_DS_V2F(r_value)) p_nd = p_pot->m_p_left; if (p_nd == 0) return (std::make_pair(base_type::insert_leaf_new(r_value, p_pot, true), true)); while (p_nd->m_p_right != 0) p_nd = p_nd->m_p_right; return std::make_pair(this->insert_leaf_new(r_value, p_nd, false), true); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp���������������������������������������0000644�����������������00000007062�14763166027�0017643 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file splay_tree_/split_join_fn_imps.hpp * Contains an implementation class for splay_tree_. */ PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: join(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) if (base_type::join_prep(other) == false) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) return; } node_pointer p_target_r = other.leftmost(other.m_p_head); _GLIBCXX_DEBUG_ASSERT(p_target_r != 0); other.splay(p_target_r); _GLIBCXX_DEBUG_ASSERT(p_target_r == other.m_p_head->m_p_parent); _GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_left == 0); p_target_r->m_p_left = base_type::m_p_head->m_p_parent; _GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_left != 0); p_target_r->m_p_left->m_p_parent = p_target_r; base_type::m_p_head->m_p_parent = p_target_r; p_target_r->m_p_parent = base_type::m_p_head; this->apply_update(p_target_r, (node_update*)this); base_type::join_finish(other); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: split(key_const_reference r_key, PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) if (base_type::split_prep(r_key, other) == false) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) return; } node_pointer p_upper_bound = this->upper_bound(r_key).m_p_nd; _GLIBCXX_DEBUG_ASSERT(p_upper_bound != 0); splay(p_upper_bound); _GLIBCXX_DEBUG_ASSERT(p_upper_bound->m_p_parent == this->m_p_head); node_pointer p_new_root = p_upper_bound->m_p_left; _GLIBCXX_DEBUG_ASSERT(p_new_root != 0); base_type::m_p_head->m_p_parent = p_new_root; p_new_root->m_p_parent = base_type::m_p_head; other.m_p_head->m_p_parent = p_upper_bound; p_upper_bound->m_p_parent = other.m_p_head; p_upper_bound->m_p_left = 0; this->apply_update(p_upper_bound, (node_update*)this); base_type::split_finish(other); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/splay_tree_/traits.hpp���������������������������������������������������0000644�����������������00000006427�14763166027�0015270 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file splay_tree_/traits.hpp * Contains an implementation for splay_tree_. */ #ifndef PB_DS_SPLAY_TREE_NODE_AND_IT_TRAITS_HPP #define PB_DS_SPLAY_TREE_NODE_AND_IT_TRAITS_HPP #include <ext/pb_ds/detail/splay_tree_/node.hpp> namespace __gnu_pbds { namespace detail { /// Specialization. /// @ingroup traits template<typename Key, typename Mapped, typename Cmp_Fn, template<typename Node_CItr, typename Node_Itr, typename Cmp_Fn_, typename _Alloc_> class Node_Update, typename _Alloc> struct tree_traits<Key, Mapped, Cmp_Fn, Node_Update, splay_tree_tag, _Alloc> : public bin_search_tree_traits<Key, Mapped, Cmp_Fn, Node_Update, splay_tree_node_< typename types_traits<Key, Mapped, _Alloc, false>::value_type, typename tree_node_metadata_dispatch<Key, Mapped, Cmp_Fn, Node_Update, _Alloc>::type, _Alloc>, _Alloc> { }; /// Specialization. /// @ingroup traits template<typename Key, class Cmp_Fn, template<typename Node_CItr, class Node_Itr, class Cmp_Fn_, typename _Alloc_> class Node_Update, typename _Alloc> struct tree_traits<Key, null_type, Cmp_Fn, Node_Update, splay_tree_tag, _Alloc> : public bin_search_tree_traits<Key, null_type, Cmp_Fn, Node_Update, splay_tree_node_< typename types_traits<Key, null_type, _Alloc, false>::value_type, typename tree_node_metadata_dispatch<Key, null_type, Cmp_Fn, Node_Update, _Alloc>::type, _Alloc>, _Alloc> { }; } // namespace detail } // namespace __gnu_pbds #endif // #ifndef PB_DS_SPLAY_TREE_NODE_AND_IT_TRAITS_HPP �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp���������������������������������������������0000644�����������������00000006367�14763166027�0016420 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file splay_tree_/find_fn_imps.hpp * Contains an implementation class for splay_tree_. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_iterator PB_DS_CLASS_C_DEC:: find(key_const_reference r_key) { node_pointer p_found = find_imp(r_key); if (p_found != base_type::m_p_head) splay(p_found); return point_iterator(p_found); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_const_iterator PB_DS_CLASS_C_DEC:: find(key_const_reference r_key) const { const node_pointer p_found = find_imp(r_key); if (p_found != base_type::m_p_head) const_cast<PB_DS_CLASS_C_DEC* >(this)->splay(p_found); return point_iterator(p_found); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: find_imp(key_const_reference r_key) { _GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid(__FILE__, __LINE__);) node_pointer p_nd = base_type::m_p_head->m_p_parent; while (p_nd != 0) if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key)) { if (!Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value))) return p_nd; p_nd = p_nd->m_p_left; } else p_nd = p_nd->m_p_right; return base_type::m_p_head; } PB_DS_CLASS_T_DEC inline const typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: find_imp(key_const_reference r_key) const { PB_DS_ASSERT_VALID((*this)) node_pointer p_nd = base_type::m_p_head->m_p_parent; while (p_nd != 0) if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key)) { if (!Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value))) return p_nd; p_nd = p_nd->m_p_left; } else p_nd = p_nd->m_p_right; return base_type::m_p_head; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp��������������������������������������������0000644�����������������00000010255�14763166027�0016566 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file splay_tree_/erase_fn_imps.hpp * Contains an implementation class for splay_tree_. */ PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: erase(key_const_reference r_key) { point_iterator it = find(r_key); if (it == base_type::end()) return false; erase(it); return true; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: erase(iterator it) { PB_DS_ASSERT_VALID((*this)) if (it == base_type::end()) return it; iterator ret_it = it; ++ret_it; erase_node(it.m_p_nd); PB_DS_ASSERT_VALID((*this)) return ret_it; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::reverse_iterator PB_DS_CLASS_C_DEC:: erase(reverse_iterator it) { PB_DS_ASSERT_VALID((*this)) if (it.m_p_nd == base_type::m_p_head) return (it); reverse_iterator ret_it = it; ++ret_it; erase_node(it.m_p_nd); PB_DS_ASSERT_VALID((*this)) return ret_it; } PB_DS_CLASS_T_DEC template<typename Pred> inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: erase_if(Pred pred) { PB_DS_ASSERT_VALID((*this)) size_type num_ersd = 0; iterator it = base_type::begin(); while (it != base_type::end()) { if (pred(*it)) { ++num_ersd; it = erase(it); } else ++it; } PB_DS_ASSERT_VALID((*this)) return num_ersd; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: erase_node(node_pointer p_nd) { _GLIBCXX_DEBUG_ASSERT(p_nd != 0); splay(p_nd); PB_DS_ASSERT_VALID((*this)) _GLIBCXX_DEBUG_ASSERT(p_nd == this->m_p_head->m_p_parent); node_pointer p_l = p_nd->m_p_left; node_pointer p_r = p_nd->m_p_right; base_type::update_min_max_for_erased_node(p_nd); base_type::actual_erase_node(p_nd); if (p_r == 0) { base_type::m_p_head->m_p_parent = p_l; if (p_l != 0) p_l->m_p_parent = base_type::m_p_head; PB_DS_ASSERT_VALID((*this)) return; } node_pointer p_target_r = leftmost(p_r); _GLIBCXX_DEBUG_ASSERT(p_target_r != 0); p_r->m_p_parent = base_type::m_p_head; base_type::m_p_head->m_p_parent = p_r; splay(p_target_r); _GLIBCXX_DEBUG_ONLY(p_target_r->m_p_left = 0); _GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_parent == this->m_p_head); _GLIBCXX_DEBUG_ASSERT(this->m_p_head->m_p_parent == p_target_r); p_target_r->m_p_left = p_l; if (p_l != 0) p_l->m_p_parent = p_target_r; PB_DS_ASSERT_VALID((*this)) this->apply_update(p_target_r, (node_update*)this); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: leftmost(node_pointer p_nd) { _GLIBCXX_DEBUG_ASSERT(p_nd != 0); while (p_nd->m_p_left != 0) p_nd = p_nd->m_p_left; return p_nd; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/splay_tree_/node.hpp�����������������������������������������������������0000644�����������������00000007240�14763166027�0014701 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file splay_tree_/node.hpp * Contains an implementation struct for splay_tree_'s node. */ #ifndef PB_DS_SPLAY_TREE_NODE_HPP #define PB_DS_SPLAY_TREE_NODE_HPP namespace __gnu_pbds { namespace detail { /// Node for splay tree. template<typename Value_Type, class Metadata, typename _Alloc> struct splay_tree_node_ { public: typedef Value_Type value_type; typedef Metadata metadata_type; typedef typename _Alloc::template rebind< splay_tree_node_<Value_Type, Metadata, _Alloc> >::other::pointer node_pointer; typedef typename _Alloc::template rebind<metadata_type>::other::reference metadata_reference; typedef typename _Alloc::template rebind<metadata_type>::other::const_reference metadata_const_reference; #ifdef PB_DS_BIN_SEARCH_TREE_TRACE_ void trace() const { std::cout << PB_DS_V2F(m_value) << "(" << m_metadata << ")"; } #endif inline bool special() const { return m_special; } inline metadata_const_reference get_metadata() const { return m_metadata; } inline metadata_reference get_metadata() { return m_metadata; } value_type m_value; bool m_special; node_pointer m_p_left; node_pointer m_p_right; node_pointer m_p_parent; metadata_type m_metadata; }; template<typename Value_Type, typename _Alloc> struct splay_tree_node_<Value_Type, null_type, _Alloc> { public: typedef Value_Type value_type; typedef null_type metadata_type; typedef typename _Alloc::template rebind< splay_tree_node_<Value_Type, null_type, _Alloc> >::other::pointer node_pointer; inline bool special() const { return m_special; } #ifdef PB_DS_BIN_SEARCH_TREE_TRACE_ void trace() const { std::cout << PB_DS_V2F(m_value); } #endif node_pointer m_p_left; node_pointer m_p_right; node_pointer m_p_parent; value_type m_value; bool m_special; }; } // namespace detail } // namespace __gnu_pbds #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp���������������������������������������������0000644�����������������00000003231�14763166027�0016416 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file splay_tree_/info_fn_imps.hpp * Contains an implementation. */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp��������������������������������������������0000644�����������������00000004637�14763166027�0016564 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file splay_tree_/debug_fn_imps.hpp * Contains an implementation class for splay_tree_. */ #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_valid(const char* __file, int __line) const { base_type::assert_valid(__file, __line); const node_pointer p_head = base_type::m_p_head; assert_special_imp(p_head, __file, __line); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_special_imp(const node_pointer p_nd, const char* __file, int __line) const { if (p_nd == 0) return; if (p_nd == base_type::m_p_head) { PB_DS_DEBUG_VERIFY(p_nd->m_special); assert_special_imp(p_nd->m_p_parent, __file, __line); return; } PB_DS_DEBUG_VERIFY(!p_nd->m_special); assert_special_imp(p_nd->m_p_left, __file, __line); assert_special_imp(p_nd->m_p_right, __file, __line); } #endif �������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp����������������������������������������������0000644�����������������00000022133�14763166027�0016260 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file splay_tree_/splay_tree_.hpp * Contains an implementation class for splay trees. */ /* * This implementation uses an idea from the SGI STL (using a @a header node * which is needed for efficient iteration). Following is the SGI STL * copyright. * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * */ #include <utility> #include <vector> #include <assert.h> #include <debug/debug.h> namespace __gnu_pbds { namespace detail { #ifdef PB_DS_DATA_TRUE_INDICATOR # define PB_DS_S_TREE_NAME splay_tree_map # define PB_DS_S_TREE_BASE_NAME bin_search_tree_map #endif #ifdef PB_DS_DATA_FALSE_INDICATOR # define PB_DS_S_TREE_NAME splay_tree_set # define PB_DS_S_TREE_BASE_NAME bin_search_tree_set #endif #define PB_DS_CLASS_T_DEC \ template<typename Key, typename Mapped, typename Cmp_Fn, \ typename Node_And_It_Traits, typename _Alloc> #define PB_DS_CLASS_C_DEC \ PB_DS_S_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc> #define PB_DS_S_TREE_BASE \ PB_DS_S_TREE_BASE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc> /** * @brief Splay tree. * @ingroup branch-detail */ template<typename Key, typename Mapped, typename Cmp_Fn, typename Node_And_It_Traits, typename _Alloc> class PB_DS_S_TREE_NAME : public PB_DS_S_TREE_BASE { private: typedef PB_DS_S_TREE_BASE base_type; #ifdef _GLIBCXX_DEBUG typedef base_type debug_base; #endif typedef typename base_type::node_pointer node_pointer; public: typedef splay_tree_tag container_category; typedef _Alloc allocator_type; typedef typename _Alloc::size_type size_type; typedef typename _Alloc::difference_type difference_type; typedef Cmp_Fn cmp_fn; typedef typename base_type::key_type key_type; typedef typename base_type::key_pointer key_pointer; typedef typename base_type::key_const_pointer key_const_pointer; typedef typename base_type::key_reference key_reference; typedef typename base_type::key_const_reference key_const_reference; typedef typename base_type::mapped_type mapped_type; typedef typename base_type::mapped_pointer mapped_pointer; typedef typename base_type::mapped_const_pointer mapped_const_pointer; typedef typename base_type::mapped_reference mapped_reference; typedef typename base_type::mapped_const_reference mapped_const_reference; typedef typename base_type::value_type value_type; typedef typename base_type::pointer pointer; typedef typename base_type::const_pointer const_pointer; typedef typename base_type::reference reference; typedef typename base_type::const_reference const_reference; typedef typename base_type::point_iterator point_iterator; typedef typename base_type::const_iterator point_const_iterator; typedef typename base_type::iterator iterator; typedef typename base_type::const_iterator const_iterator; typedef typename base_type::reverse_iterator reverse_iterator; typedef typename base_type::const_reverse_iterator const_reverse_iterator; typedef typename base_type::node_update node_update; PB_DS_S_TREE_NAME(); PB_DS_S_TREE_NAME(const Cmp_Fn&); PB_DS_S_TREE_NAME(const Cmp_Fn&, const node_update&); PB_DS_S_TREE_NAME(const PB_DS_CLASS_C_DEC&); void swap(PB_DS_CLASS_C_DEC&); template<typename It> void copy_from_range(It, It); void initialize(); inline std::pair<point_iterator, bool> insert(const_reference r_value); inline mapped_reference operator[](key_const_reference r_key) { #ifdef PB_DS_DATA_TRUE_INDICATOR _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);) std::pair<point_iterator, bool> ins_pair = insert_leaf_imp(value_type(r_key, mapped_type())); ins_pair.first.m_p_nd->m_special = false; _GLIBCXX_DEBUG_ONLY(base_type::assert_valid(__FILE__, __LINE__)); splay(ins_pair.first.m_p_nd); _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);) return ins_pair.first.m_p_nd->m_value.second; #else insert(r_key); return base_type::s_null_type; #endif } inline point_iterator find(key_const_reference); inline point_const_iterator find(key_const_reference) const; inline bool erase(key_const_reference); inline iterator erase(iterator it); inline reverse_iterator erase(reverse_iterator); template<typename Pred> inline size_type erase_if(Pred); void join(PB_DS_CLASS_C_DEC&); void split(key_const_reference, PB_DS_CLASS_C_DEC&); private: inline std::pair<point_iterator, bool> insert_leaf_imp(const_reference); inline node_pointer find_imp(key_const_reference); inline const node_pointer find_imp(key_const_reference) const; #ifdef _GLIBCXX_DEBUG void assert_valid(const char* file, int line) const; void assert_special_imp(const node_pointer, const char* file, int line) const; #endif void splay(node_pointer); inline void splay_zig_zag_left(node_pointer, node_pointer, node_pointer); inline void splay_zig_zag_right(node_pointer, node_pointer, node_pointer); inline void splay_zig_zig_left(node_pointer, node_pointer, node_pointer); inline void splay_zig_zig_right(node_pointer, node_pointer, node_pointer); inline void splay_zz_start(node_pointer, node_pointer, node_pointer); inline void splay_zz_end(node_pointer, node_pointer, node_pointer); inline node_pointer leftmost(node_pointer); void erase_node(node_pointer); }; #define PB_DS_ASSERT_BASE_NODE_CONSISTENT(_Node) \ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(_Node, \ __FILE__, __LINE__);) #include <ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp> #include <ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp> #include <ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp> #include <ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp> #include <ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp> #include <ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp> #include <ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp> #undef PB_DS_ASSERT_BASE_NODE_CONSISTENT #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #undef PB_DS_S_TREE_NAME #undef PB_DS_S_TREE_BASE_NAME #undef PB_DS_S_TREE_BASE } // namespace detail } // namespace __gnu_pbds �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/debug_map_base.hpp�������������������������������������������������������0000644�����������������00000020771�14763166027�0014367 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file detail/debug_map_base.hpp * Contains a debug-mode base for all maps. */ #ifndef PB_DS_DEBUG_MAP_BASE_HPP #define PB_DS_DEBUG_MAP_BASE_HPP #ifdef _GLIBCXX_DEBUG #include <list> #include <utility> #include <cstdlib> #include <iostream> #include <ext/throw_allocator.h> #include <debug/debug.h> namespace __gnu_pbds { namespace detail { // Need std::pair ostream extractor. template<typename _CharT, typename _Traits, typename _Tp1, typename _Tp2> inline std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __out, const std::pair<_Tp1, _Tp2>& p) { return (__out << '(' << p.first << ',' << p.second << ')'); } #define PB_DS_CLASS_T_DEC \ template<typename Key, typename Eq_Fn, typename Const_Key_Reference> #define PB_DS_CLASS_C_DEC \ debug_map_base<Key, Eq_Fn, Const_Key_Reference> /// Debug base class. template<typename Key, typename Eq_Fn, typename Const_Key_Reference> class debug_map_base { private: typedef Const_Key_Reference key_const_reference; typedef std::_GLIBCXX_STD_C::list<Key> key_repository; typedef typename key_repository::size_type size_type; typedef typename key_repository::iterator iterator; typedef typename key_repository::const_iterator const_iterator; protected: debug_map_base(); debug_map_base(const PB_DS_CLASS_C_DEC&); ~debug_map_base(); inline void insert_new(key_const_reference); inline void erase_existing(key_const_reference); void clear(); inline void check_key_exists(key_const_reference, const char*, int) const; inline void check_key_does_not_exist(key_const_reference, const char*, int) const; inline void check_size(size_type, const char*, int) const; void swap(PB_DS_CLASS_C_DEC&); template<typename Cmp_Fn> void split(key_const_reference, Cmp_Fn, PB_DS_CLASS_C_DEC&); void join(PB_DS_CLASS_C_DEC&, bool with_cleanup = true); private: void assert_valid(const char*, int) const; const_iterator find(key_const_reference) const; iterator find(key_const_reference); key_repository m_keys; Eq_Fn m_eq; }; PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: debug_map_base() { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: debug_map_base(const PB_DS_CLASS_C_DEC& other) : m_keys(other.m_keys), m_eq(other.m_eq) { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ~debug_map_base() { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: insert_new(key_const_reference r_key) { PB_DS_ASSERT_VALID((*this)) if (find(r_key) != m_keys.end()) { std::cerr << "insert_new key already present " << r_key << std::endl; std::abort(); } __try { m_keys.push_back(r_key); } __catch(...) { std::cerr << "insert_new " << r_key << std::endl; std::abort(); } PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: erase_existing(key_const_reference r_key) { PB_DS_ASSERT_VALID((*this)) iterator it = find(r_key); if (it == m_keys.end()) { std::cerr << "erase_existing" << r_key << std::endl; std::abort(); } m_keys.erase(it); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: clear() { PB_DS_ASSERT_VALID((*this)) m_keys.clear(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: check_key_exists(key_const_reference r_key, const char* __file, int __line) const { assert_valid(__file, __line); if (find(r_key) == m_keys.end()) { std::cerr << __file << ':' << __line << ": check_key_exists " << r_key << std::endl; std::abort(); } } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: check_key_does_not_exist(key_const_reference r_key, const char* __file, int __line) const { assert_valid(__file, __line); if (find(r_key) != m_keys.end()) { using std::cerr; using std::endl; cerr << __file << ':' << __line << ": check_key_does_not_exist " << r_key << endl; std::abort(); } } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: check_size(size_type size, const char* __file, int __line) const { assert_valid(__file, __line); const size_type keys_size = m_keys.size(); if (size != keys_size) { std::cerr << __file << ':' << __line << ": check_size " << size << " != " << keys_size << std::endl; std::abort(); } } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) m_keys.swap(other.m_keys); std::swap(m_eq, other.m_eq); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: find(key_const_reference r_key) const { PB_DS_ASSERT_VALID((*this)) typedef const_iterator iterator_type; for (iterator_type it = m_keys.begin(); it != m_keys.end(); ++it) if (m_eq(*it, r_key)) return it; return m_keys.end(); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: find(key_const_reference r_key) { PB_DS_ASSERT_VALID((*this)) iterator it = m_keys.begin(); while (it != m_keys.end()) { if (m_eq(*it, r_key)) return it; ++it; } return it; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_valid(const char* __file, int __line) const { const_iterator prime_it = m_keys.begin(); while (prime_it != m_keys.end()) { const_iterator sec_it = prime_it; ++sec_it; while (sec_it != m_keys.end()) { PB_DS_DEBUG_VERIFY(!m_eq(*sec_it, *prime_it)); PB_DS_DEBUG_VERIFY(!m_eq(*prime_it, *sec_it)); ++sec_it; } ++prime_it; } } PB_DS_CLASS_T_DEC template<typename Cmp_Fn> void PB_DS_CLASS_C_DEC:: split(key_const_reference r_key, Cmp_Fn cmp_fn, PB_DS_CLASS_C_DEC& other) { other.clear(); iterator it = m_keys.begin(); while (it != m_keys.end()) if (cmp_fn(r_key, *it)) { other.insert_new(*it); it = m_keys.erase(it); } else ++it; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: join(PB_DS_CLASS_C_DEC& other, bool with_cleanup) { iterator it = other.m_keys.begin(); while (it != other.m_keys.end()) { insert_new(*it); if (with_cleanup) it = other.m_keys.erase(it); else ++it; } _GLIBCXX_DEBUG_ASSERT(!with_cleanup || other.m_keys.empty()); } #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC } // namespace detail } // namespace __gnu_pbds #endif #endif �������c++/4.8.2/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp�������������������������������������0000644�����������������00000007213�14763166027�0020216 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file tree_policy/order_statistics_imp.hpp * Contains forward declarations for order_statistics_key */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: find_by_order(size_type order) { node_iterator it = node_begin(); node_iterator end_it = node_end(); while (it != end_it) { node_iterator l_it = it.get_l_child(); const size_type o = (l_it == end_it)? 0 : l_it.get_metadata(); if (order == o) return *it; else if (order < o) it = l_it; else { order -= o + 1; it = it.get_r_child(); } } return base_type::end_iterator(); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: find_by_order(size_type order) const { return const_cast<PB_DS_CLASS_C_DEC*>(this)->find_by_order(order); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: order_of_key(key_const_reference r_key) const { node_const_iterator it = node_begin(); node_const_iterator end_it = node_end(); const cmp_fn& r_cmp_fn = const_cast<PB_DS_CLASS_C_DEC*>(this)->get_cmp_fn(); size_type ord = 0; while (it != end_it) { node_const_iterator l_it = it.get_l_child(); if (r_cmp_fn(r_key, this->extract_key(*(*it)))) it = l_it; else if (r_cmp_fn(this->extract_key(*(*it)), r_key)) { ord += (l_it == end_it)? 1 : 1 + l_it.get_metadata(); it = it.get_r_child(); } else { ord += (l_it == end_it)? 0 : l_it.get_metadata(); it = end_it; } } return ord; } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: operator()(node_iterator node_it, node_const_iterator end_nd_it) const { node_iterator l_it = node_it.get_l_child(); const size_type l_rank = (l_it == end_nd_it) ? 0 : l_it.get_metadata(); node_iterator r_it = node_it.get_r_child(); const size_type r_rank = (r_it == end_nd_it) ? 0 : r_it.get_metadata(); const_cast<metadata_reference>(node_it.get_metadata())= 1 + l_rank + r_rank; } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ~tree_order_statistics_node_update() { } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp�����������������������������������0000644�����������������00000006412�14763166027�0020451 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file tree_policy/node_metadata_selector.hpp * Contains an implementation class for trees. */ #ifndef PB_DS_TREE_NODE_METADATA_DISPATCH_HPP #define PB_DS_TREE_NODE_METADATA_DISPATCH_HPP #include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp> #include <ext/pb_ds/detail/types_traits.hpp> namespace __gnu_pbds { namespace detail { /** * @addtogroup traits Traits * @{ */ /// Tree metadata helper. template<typename Node_Update, bool _BTp> struct tree_metadata_helper; /// Specialization, false. template<typename Node_Update> struct tree_metadata_helper<Node_Update, false> { typedef typename Node_Update::metadata_type type; }; /// Specialization, true. template<typename Node_Update> struct tree_metadata_helper<Node_Update, true> { typedef null_type type; }; /// Tree node metadata dispatch. template<typename Key, typename Data, typename Cmp_Fn, template<typename Node_CItr, typename Const_Iterator, typename Cmp_Fn_, typename _Alloc_> class Node_Update, typename _Alloc> struct tree_node_metadata_dispatch { private: typedef dumnode_const_iterator<Key, Data, _Alloc> __it_type; typedef Node_Update<__it_type, __it_type, Cmp_Fn, _Alloc> __node_u; typedef null_node_update<__it_type, __it_type, Cmp_Fn, _Alloc> __nnode_u; enum { null_update = is_same<__node_u, __nnode_u>::value }; public: typedef typename tree_metadata_helper<__node_u, null_update>::type type; }; //@} } // namespace detail } // namespace __gnu_pbds #endif // #ifndef PB_DS_TREE_NODE_METADATA_DISPATCH_HPP ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp����������������������������������0000644�����������������00000004452�14763166027�0020635 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file tree_policy/sample_tree_node_update.hpp * Contains a samle node update functor. */ #ifndef PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP #define PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP namespace __gnu_pbds { /// A sample node updator. template<typename Const_Node_Iter, typename Node_Iter, typename Cmp_Fn, typename _Alloc> class sample_tree_node_update { typedef std::size_t metadata_type; /// Default constructor. sample_tree_node_update(); /// Updates the rank of a node through a node_iterator node_it; /// end_nd_it is the end node iterator. inline void operator()(node_iterator node_it, node_const_iterator end_nd_it) const; }; } #endif // #ifndef PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp��������������������������������������0000644�����������������00000006666�14763166027�0020011 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file list_update_map_/insert_fn_imps.hpp * Contains implementations of lu_map_. */ PB_DS_CLASS_T_DEC inline std::pair< typename PB_DS_CLASS_C_DEC::point_iterator, bool> PB_DS_CLASS_C_DEC:: insert(const_reference r_val) { PB_DS_ASSERT_VALID((*this)) entry_pointer p_l = find_imp(PB_DS_V2F(r_val)); if (p_l != 0) { PB_DS_CHECK_KEY_EXISTS(PB_DS_V2F(r_val)) return std::make_pair(point_iterator(&p_l->m_value), false); } PB_DS_CHECK_KEY_DOES_NOT_EXIST(PB_DS_V2F(r_val)) p_l = allocate_new_entry(r_val, traits_base::m_no_throw_copies_indicator); p_l->m_p_next = m_p_l; m_p_l = p_l; PB_DS_ASSERT_VALID((*this)) return std::make_pair(point_iterator(&p_l->m_value), true); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::entry_pointer PB_DS_CLASS_C_DEC:: allocate_new_entry(const_reference r_val, false_type) { entry_pointer p_l = s_entry_allocator.allocate(1); cond_dealtor_t cond(p_l); new (const_cast<void* >(static_cast<const void* >(&p_l->m_value))) value_type(r_val); cond.set_no_action(); _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));) init_entry_metadata(p_l, s_metadata_type_indicator); return p_l; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::entry_pointer PB_DS_CLASS_C_DEC:: allocate_new_entry(const_reference r_val, true_type) { entry_pointer p_l = s_entry_allocator.allocate(1); new (&p_l->m_value) value_type(r_val); _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));) init_entry_metadata(p_l, s_metadata_type_indicator); return p_l; } PB_DS_CLASS_T_DEC template<typename Metadata> inline void PB_DS_CLASS_C_DEC:: init_entry_metadata(entry_pointer p_l, type_to_type<Metadata>) { new (&p_l->m_update_metadata) Metadata(s_update_policy()); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: init_entry_metadata(entry_pointer, type_to_type<null_type>) { } ��������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp�����������������������������������0000644�����������������00000004730�14763166027�0020507 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file list_update_map_/iterators_fn_imps.hpp * Contains implementations of lu_map_. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: begin() { if (m_p_l == 0) { _GLIBCXX_DEBUG_ASSERT(empty()); return end(); } return iterator(&m_p_l->m_value, m_p_l, this); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: begin() const { if (m_p_l == 0) { _GLIBCXX_DEBUG_ASSERT(empty()); return end(); } return iterator(&m_p_l->m_value, m_p_l, const_cast<PB_DS_CLASS_C_DEC* >(this)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: end() { return iterator(0, 0, this); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: end() const { return const_iterator(0, 0, const_cast<PB_DS_CLASS_C_DEC* const>(this)); } ����������������������������������������c++/4.8.2/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp���������������������������������0000644�����������������00000004105�14763166027�0020747 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file list_update_map_/entry_metadata_base.hpp * Contains an implementation for a list update map. */ #ifndef PB_DS_LU_MAP_ENTRY_METADATA_BASE_HPP #define PB_DS_LU_MAP_ENTRY_METADATA_BASE_HPP namespace __gnu_pbds { namespace detail { template<typename Metadata> struct lu_map_entry_metadata_base { Metadata m_update_metadata; }; template<> struct lu_map_entry_metadata_base<null_type> { }; } // namespace detail } // namespace __gnu_pbds #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/list_update_map_/lu_map_.hpp���������������������������������������������0000644�����������������00000024231�14763166027�0016372 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file list_update_map_/lu_map_.hpp * Contains a list update map. */ #include <utility> #include <iterator> #include <ext/pb_ds/detail/cond_dealtor.hpp> #include <ext/pb_ds/tag_and_trait.hpp> #include <ext/pb_ds/detail/types_traits.hpp> #include <ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp> #include <ext/pb_ds/exception.hpp> #ifdef _GLIBCXX_DEBUG #include <ext/pb_ds/detail/debug_map_base.hpp> #endif #ifdef PB_DS_LU_MAP_TRACE_ #include <iostream> #endif #include <debug/debug.h> namespace __gnu_pbds { namespace detail { #ifdef PB_DS_DATA_TRUE_INDICATOR #define PB_DS_LU_NAME lu_map #endif #ifdef PB_DS_DATA_FALSE_INDICATOR #define PB_DS_LU_NAME lu_set #endif #define PB_DS_CLASS_T_DEC \ template<typename Key, typename Mapped, typename Eq_Fn, \ typename _Alloc, typename Update_Policy> #define PB_DS_CLASS_C_DEC \ PB_DS_LU_NAME<Key, Mapped, Eq_Fn, _Alloc, Update_Policy> #define PB_DS_LU_TRAITS_BASE \ types_traits<Key, Mapped, _Alloc, false> #ifdef _GLIBCXX_DEBUG #define PB_DS_DEBUG_MAP_BASE_C_DEC \ debug_map_base<Key, Eq_Fn, \ typename _Alloc::template rebind<Key>::other::const_reference> #endif /// list-based (with updates) associative container. /// Skip to the lu, my darling. template<typename Key, typename Mapped, typename Eq_Fn, typename _Alloc, typename Update_Policy> class PB_DS_LU_NAME : #ifdef _GLIBCXX_DEBUG protected PB_DS_DEBUG_MAP_BASE_C_DEC, #endif public PB_DS_LU_TRAITS_BASE { private: typedef PB_DS_LU_TRAITS_BASE traits_base; struct entry : public lu_map_entry_metadata_base<typename Update_Policy::metadata_type> { typename traits_base::value_type m_value; typename _Alloc::template rebind<entry>::other::pointer m_p_next; }; typedef typename _Alloc::template rebind<entry>::other entry_allocator; typedef typename entry_allocator::pointer entry_pointer; typedef typename entry_allocator::const_pointer const_entry_pointer; typedef typename entry_allocator::reference entry_reference; typedef typename entry_allocator::const_reference const_entry_reference; typedef typename _Alloc::template rebind<entry_pointer>::other entry_pointer_allocator; typedef typename entry_pointer_allocator::pointer entry_pointer_array; typedef typename traits_base::value_type value_type_; typedef typename traits_base::pointer pointer_; typedef typename traits_base::const_pointer const_pointer_; typedef typename traits_base::reference reference_; typedef typename traits_base::const_reference const_reference_; #define PB_DS_GEN_POS entry_pointer #include <ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp> #include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp> #include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp> #include <ext/pb_ds/detail/unordered_iterator/iterator.hpp> #undef PB_DS_GEN_POS #ifdef _GLIBCXX_DEBUG typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base; #endif typedef cond_dealtor<entry, _Alloc> cond_dealtor_t; public: typedef _Alloc allocator_type; typedef typename _Alloc::size_type size_type; typedef typename _Alloc::difference_type difference_type; typedef Eq_Fn eq_fn; typedef Update_Policy update_policy; typedef typename Update_Policy::metadata_type update_metadata; typedef typename traits_base::key_type key_type; typedef typename traits_base::key_pointer key_pointer; typedef typename traits_base::key_const_pointer key_const_pointer; typedef typename traits_base::key_reference key_reference; typedef typename traits_base::key_const_reference key_const_reference; typedef typename traits_base::mapped_type mapped_type; typedef typename traits_base::mapped_pointer mapped_pointer; typedef typename traits_base::mapped_const_pointer mapped_const_pointer; typedef typename traits_base::mapped_reference mapped_reference; typedef typename traits_base::mapped_const_reference mapped_const_reference; typedef typename traits_base::value_type value_type; typedef typename traits_base::pointer pointer; typedef typename traits_base::const_pointer const_pointer; typedef typename traits_base::reference reference; typedef typename traits_base::const_reference const_reference; #ifdef PB_DS_DATA_TRUE_INDICATOR typedef point_iterator_ point_iterator; #endif #ifdef PB_DS_DATA_FALSE_INDICATOR typedef point_const_iterator_ point_iterator; #endif typedef point_const_iterator_ point_const_iterator; #ifdef PB_DS_DATA_TRUE_INDICATOR typedef iterator_ iterator; #endif #ifdef PB_DS_DATA_FALSE_INDICATOR typedef const_iterator_ iterator; #endif typedef const_iterator_ const_iterator; public: PB_DS_LU_NAME(); PB_DS_LU_NAME(const PB_DS_CLASS_C_DEC&); virtual ~PB_DS_LU_NAME(); template<typename It> PB_DS_LU_NAME(It, It); void swap(PB_DS_CLASS_C_DEC&); inline size_type size() const; inline size_type max_size() const; inline bool empty() const; inline mapped_reference operator[](key_const_reference r_key) { #ifdef PB_DS_DATA_TRUE_INDICATOR _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);) return insert(std::make_pair(r_key, mapped_type())).first->second; #else insert(r_key); return traits_base::s_null_type; #endif } inline std::pair<point_iterator, bool> insert(const_reference); inline point_iterator find(key_const_reference r_key) { _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);) entry_pointer p_e = find_imp(r_key); return point_iterator(p_e == 0 ? 0: &p_e->m_value); } inline point_const_iterator find(key_const_reference r_key) const { _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);) entry_pointer p_e = find_imp(r_key); return point_const_iterator(p_e == 0 ? 0: &p_e->m_value); } inline bool erase(key_const_reference); template<typename Pred> inline size_type erase_if(Pred); void clear(); inline iterator begin(); inline const_iterator begin() const; inline iterator end(); inline const_iterator end() const; #ifdef _GLIBCXX_DEBUG void assert_valid(const char* file, int line) const; #endif #ifdef PB_DS_LU_MAP_TRACE_ void trace() const; #endif protected: template<typename It> void copy_from_range(It, It); private: #ifdef PB_DS_DATA_TRUE_INDICATOR friend class iterator_; #endif friend class const_iterator_; inline entry_pointer allocate_new_entry(const_reference, false_type); inline entry_pointer allocate_new_entry(const_reference, true_type); template<typename Metadata> inline static void init_entry_metadata(entry_pointer, type_to_type<Metadata>); inline static void init_entry_metadata(entry_pointer, type_to_type<null_type>); void deallocate_all(); void erase_next(entry_pointer); void actual_erase_entry(entry_pointer); void inc_it_state(const_pointer& r_p_value, entry_pointer& r_pos) const { r_pos = r_pos->m_p_next; r_p_value = (r_pos == 0) ? 0 : &r_pos->m_value; } template<typename Metadata> inline static bool apply_update(entry_pointer, type_to_type<Metadata>); inline static bool apply_update(entry_pointer, type_to_type<null_type>); inline entry_pointer find_imp(key_const_reference) const; static entry_allocator s_entry_allocator; static Eq_Fn s_eq_fn; static Update_Policy s_update_policy; static type_to_type<update_metadata> s_metadata_type_indicator; static null_type s_null_type; mutable entry_pointer m_p_l; }; #include <ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp> #include <ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp> #include <ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp> #include <ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp> #include <ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp> #include <ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp> #include <ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp> #include <ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp> #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #undef PB_DS_LU_TRAITS_BASE #undef PB_DS_DEBUG_MAP_BASE_C_DEC #undef PB_DS_LU_NAME } // namespace detail } // namespace __gnu_pbds �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp����������������������0000644�����������������00000007000�14763166027�0023327 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file list_update_map_/constructor_destructor_fn_imps.hpp */ PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::entry_allocator PB_DS_CLASS_C_DEC::s_entry_allocator; PB_DS_CLASS_T_DEC Eq_Fn PB_DS_CLASS_C_DEC::s_eq_fn; PB_DS_CLASS_T_DEC null_type PB_DS_CLASS_C_DEC::s_null_type; PB_DS_CLASS_T_DEC Update_Policy PB_DS_CLASS_C_DEC::s_update_policy; PB_DS_CLASS_T_DEC type_to_type< typename PB_DS_CLASS_C_DEC::update_metadata> PB_DS_CLASS_C_DEC::s_metadata_type_indicator; PB_DS_CLASS_T_DEC template<typename It> void PB_DS_CLASS_C_DEC:: copy_from_range(It first_it, It last_it) { while (first_it != last_it) insert(*(first_it++)); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_LU_NAME() : m_p_l(0) { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC template<typename It> PB_DS_CLASS_C_DEC:: PB_DS_LU_NAME(It first_it, It last_it) : m_p_l(0) { copy_from_range(first_it, last_it); PB_DS_ASSERT_VALID((*this)); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_LU_NAME(const PB_DS_CLASS_C_DEC& other) : m_p_l(0) { __try { for (const_iterator it = other.begin(); it != other.end(); ++it) { entry_pointer p_l = allocate_new_entry(*it, traits_base::m_no_throw_copies_indicator); p_l->m_p_next = m_p_l; m_p_l = p_l; } } __catch(...) { deallocate_all(); __throw_exception_again; } PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);) std::swap(m_p_l, other.m_p_l); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: deallocate_all() { entry_pointer p_l = m_p_l; while (p_l != 0) { entry_pointer p_next_l = p_l->m_p_next; actual_erase_entry(p_l); p_l = p_next_l; } m_p_l = 0; } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ~PB_DS_LU_NAME() { deallocate_all(); } c++/4.8.2/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp����������������������������������������0000644�����������������00000005455�14763166027�0017420 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file list_update_map_/find_fn_imps.hpp * Contains implementations of lu_map_. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::entry_pointer PB_DS_CLASS_C_DEC:: find_imp(key_const_reference r_key) const { if (m_p_l == 0) return 0; if (s_eq_fn(r_key, PB_DS_V2F(m_p_l->m_value))) { apply_update(m_p_l, s_metadata_type_indicator); PB_DS_CHECK_KEY_EXISTS(r_key) return m_p_l; } entry_pointer p_l = m_p_l; while (p_l->m_p_next != 0) { entry_pointer p_next = p_l->m_p_next; if (s_eq_fn(r_key, PB_DS_V2F(p_next->m_value))) { if (apply_update(p_next, s_metadata_type_indicator)) { p_l->m_p_next = p_next->m_p_next; p_next->m_p_next = m_p_l; m_p_l = p_next; return m_p_l; } return p_next; } else p_l = p_next; } PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) return 0; } PB_DS_CLASS_T_DEC template<typename Metadata> inline bool PB_DS_CLASS_C_DEC:: apply_update(entry_pointer p_l, type_to_type<Metadata>) { return s_update_policy(p_l->m_update_metadata); } PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: apply_update(entry_pointer, type_to_type<null_type>) { return s_update_policy(s_null_type); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp���������������������������������������0000644�����������������00000006632�14763166027�0017575 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file list_update_map_/erase_fn_imps.hpp * Contains implementations of lu_map_. */ PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: erase(key_const_reference r_key) { PB_DS_ASSERT_VALID((*this)) if (m_p_l == 0) return false; if (s_eq_fn(r_key, PB_DS_V2F(m_p_l->m_value))) { entry_pointer p_next = m_p_l->m_p_next; actual_erase_entry(m_p_l); m_p_l = p_next; return true; } entry_pointer p_l = m_p_l; while (p_l->m_p_next != 0) if (s_eq_fn(r_key, PB_DS_V2F(p_l->m_p_next->m_value))) { erase_next(p_l); return true; } else p_l = p_l->m_p_next; return false; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: clear() { deallocate_all(); } PB_DS_CLASS_T_DEC template<typename Pred> inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: erase_if(Pred pred) { PB_DS_ASSERT_VALID((*this)) size_type num_ersd = 0; while (m_p_l != 0 && pred(m_p_l->m_value)) { entry_pointer p_next = m_p_l->m_p_next; ++num_ersd; actual_erase_entry(m_p_l); m_p_l = p_next; } if (m_p_l == 0) return num_ersd; entry_pointer p_l = m_p_l; while (p_l->m_p_next != 0) { if (pred(p_l->m_p_next->m_value)) { ++num_ersd; erase_next(p_l); } else p_l = p_l->m_p_next; } PB_DS_ASSERT_VALID((*this)) return num_ersd; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: erase_next(entry_pointer p_l) { _GLIBCXX_DEBUG_ASSERT(p_l != 0); _GLIBCXX_DEBUG_ASSERT(p_l->m_p_next != 0); entry_pointer p_next_l = p_l->m_p_next->m_p_next; actual_erase_entry(p_l->m_p_next); p_l->m_p_next = p_next_l; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: actual_erase_entry(entry_pointer p_l) { _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_l->m_value));) p_l->~entry(); s_entry_allocator.deallocate(p_l, 1); } ������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp���������������������������������������0000644�����������������00000003754�14763166027�0017576 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file list_update_map_/trace_fn_imps.hpp * Contains implementations of lu_map_. */ #ifdef PB_DS_LU_MAP_TRACE_ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace() const { std::cerr << m_p_l << std::endl << std::endl; const_entry_pointer p_l = m_p_l; while (p_l != 0) { std::cerr << PB_DS_V2F(p_l->m_value) << std::endl; p_l = p_l->m_p_next; } std::cerr << std::endl; } #endif ��������������������c++/4.8.2/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp����������������������������������������0000644�����������������00000004032�14763166027�0017421 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file list_update_map_/info_fn_imps.hpp * Contains implementations of lu_map_. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: size() const { return std::distance(begin(), end()); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: max_size() const { return s_entry_allocator.max_size(); } PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: empty() const { return (m_p_l == 0); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp���������������������������������������0000644�����������������00000004057�14763166027�0017563 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file list_update_map_/debug_fn_imps.hpp * Contains implementations of cc_ht_map_'s debug-mode functions. */ #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_valid(const char* __file, int __line) const { size_type calc_size = 0; for (const_iterator it = begin(); it != end(); ++it) { debug_base::check_key_exists(PB_DS_V2F(*it), __file, __line); ++calc_size; } debug_base::check_size(calc_size, __file, __line); } #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/priority_queue_base_dispatch.hpp�����������������������������������������0000644�����������������00000010054�14763166027�0017401 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file detail/priority_queue_base_dispatch.hpp * Contains an pqiative container dispatching base. */ #ifndef PB_DS_PRIORITY_QUEUE_BASE_DS_DISPATCHER_HPP #define PB_DS_PRIORITY_QUEUE_BASE_DS_DISPATCHER_HPP #define PB_DS_ASSERT_VALID(X) \ _GLIBCXX_DEBUG_ONLY(X.assert_valid(__FILE__, __LINE__);) #define PB_DS_DEBUG_VERIFY(_Cond) \ _GLIBCXX_DEBUG_VERIFY_AT(_Cond, \ _M_message(#_Cond" assertion from %1;:%2;") \ ._M_string(__FILE__)._M_integer(__LINE__) \ ,__file,__line) #include <ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp> #include <ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp> #include <ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp> #include <ext/pb_ds/detail/binary_heap_/binary_heap_.hpp> #include <ext/pb_ds/detail/thin_heap_/thin_heap_.hpp> #undef PB_DS_DEBUG_VERIFY #undef PB_DS_ASSERT_VALID namespace __gnu_pbds { namespace detail { /// Specialization for pairing_heap. template<typename _VTp, typename Cmp_Fn, typename _Alloc> struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, pairing_heap_tag, null_type> { /// Dispatched type. typedef pairing_heap<_VTp, Cmp_Fn, _Alloc> type; }; /// Specialization for binomial_heap. template<typename _VTp, typename Cmp_Fn, typename _Alloc> struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, binomial_heap_tag, null_type> { /// Dispatched type. typedef binomial_heap<_VTp, Cmp_Fn, _Alloc> type; }; /// Specialization for rc_binary_heap. template<typename _VTp, typename Cmp_Fn, typename _Alloc> struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, rc_binomial_heap_tag, null_type> { /// Dispatched type. typedef rc_binomial_heap<_VTp, Cmp_Fn, _Alloc> type; }; /// Specialization for binary_heap. template<typename _VTp, typename Cmp_Fn, typename _Alloc> struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, binary_heap_tag, null_type> { /// Dispatched type. typedef binary_heap<_VTp, Cmp_Fn, _Alloc> type; }; /// Specialization for thin_heap. template<typename _VTp, typename Cmp_Fn, typename _Alloc> struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, thin_heap_tag, null_type> { /// Dispatched type. typedef thin_heap<_VTp, Cmp_Fn, _Alloc> type; }; //@} group pbds } // namespace detail } // namespace __gnu_pbds #endif // #ifndef PB_DS_PRIORITY_QUEUE_BASE_DS_DISPATCHER_HPP ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp�������������������������0000644�����������������00000005337�14763166027�0022632 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file rb_tree_map_/constructors_destructor_fn_imps.hpp * Contains an implementation for rb_tree_. */ PB_DS_CLASS_T_DEC template<typename It> void PB_DS_CLASS_C_DEC:: copy_from_range(It first_it, It last_it) { while (first_it != last_it) insert(*(first_it++)); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_RB_TREE_NAME() { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_RB_TREE_NAME(const Cmp_Fn& r_cmp_fn) : base_type(r_cmp_fn) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_RB_TREE_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) : base_type(r_cmp_fn, r_node_update) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_RB_TREE_NAME(const PB_DS_CLASS_C_DEC& other) : base_type(other) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) base_type::swap(other); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: initialize() { base_type::m_p_head->m_red = true; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp������������������������������������������������0000644�����������������00000017432�14763166027�0015651 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file rb_tree_map_/rb_tree_.hpp * Contains an implementation for Red Black trees. */ #include <ext/pb_ds/detail/standard_policies.hpp> #include <utility> #include <vector> #include <assert.h> #include <debug/debug.h> namespace __gnu_pbds { namespace detail { #define PB_DS_CLASS_T_DEC \ template<typename Key, typename Mapped, typename Cmp_Fn, \ typename Node_And_It_Traits, typename _Alloc> #ifdef PB_DS_DATA_TRUE_INDICATOR # define PB_DS_RB_TREE_NAME rb_tree_map # define PB_DS_RB_TREE_BASE_NAME bin_search_tree_map #endif #ifdef PB_DS_DATA_FALSE_INDICATOR # define PB_DS_RB_TREE_NAME rb_tree_set # define PB_DS_RB_TREE_BASE_NAME bin_search_tree_set #endif #define PB_DS_CLASS_C_DEC \ PB_DS_RB_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc> #define PB_DS_RB_TREE_BASE \ PB_DS_RB_TREE_BASE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc> /** * @brief Red-Black tree. * @ingroup branch-detail * * This implementation uses an idea from the SGI STL (using a * @a header node which is needed for efficient iteration). */ template<typename Key, typename Mapped, typename Cmp_Fn, typename Node_And_It_Traits, typename _Alloc> class PB_DS_RB_TREE_NAME : public PB_DS_RB_TREE_BASE { private: typedef PB_DS_RB_TREE_BASE base_type; typedef typename base_type::node_pointer node_pointer; public: typedef rb_tree_tag container_category; typedef Cmp_Fn cmp_fn; typedef _Alloc allocator_type; typedef typename _Alloc::size_type size_type; typedef typename _Alloc::difference_type difference_type; typedef typename base_type::key_type key_type; typedef typename base_type::key_pointer key_pointer; typedef typename base_type::key_const_pointer key_const_pointer; typedef typename base_type::key_reference key_reference; typedef typename base_type::key_const_reference key_const_reference; typedef typename base_type::mapped_type mapped_type; typedef typename base_type::mapped_pointer mapped_pointer; typedef typename base_type::mapped_const_pointer mapped_const_pointer; typedef typename base_type::mapped_reference mapped_reference; typedef typename base_type::mapped_const_reference mapped_const_reference; typedef typename base_type::value_type value_type; typedef typename base_type::pointer pointer; typedef typename base_type::const_pointer const_pointer; typedef typename base_type::reference reference; typedef typename base_type::const_reference const_reference; typedef typename base_type::point_iterator point_iterator; typedef typename base_type::const_iterator point_const_iterator; typedef typename base_type::iterator iterator; typedef typename base_type::const_iterator const_iterator; typedef typename base_type::reverse_iterator reverse_iterator; typedef typename base_type::const_reverse_iterator const_reverse_iterator; typedef typename base_type::node_update node_update; PB_DS_RB_TREE_NAME(); PB_DS_RB_TREE_NAME(const Cmp_Fn&); PB_DS_RB_TREE_NAME(const Cmp_Fn&, const node_update&); PB_DS_RB_TREE_NAME(const PB_DS_CLASS_C_DEC&); void swap(PB_DS_CLASS_C_DEC&); template<typename It> void copy_from_range(It, It); inline std::pair<point_iterator, bool> insert(const_reference); inline mapped_reference operator[](key_const_reference r_key) { #ifdef PB_DS_DATA_TRUE_INDICATOR _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);) std::pair<point_iterator, bool> ins_pair = base_type::insert_leaf(value_type(r_key, mapped_type())); if (ins_pair.second == true) { ins_pair.first.m_p_nd->m_red = true; _GLIBCXX_DEBUG_ONLY(this->structure_only_assert_valid(__FILE__, __LINE__);) insert_fixup(ins_pair.first.m_p_nd); } _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);) return ins_pair.first.m_p_nd->m_value.second; #else insert(r_key); return base_type::s_null_type; #endif } inline bool erase(key_const_reference); inline iterator erase(iterator); inline reverse_iterator erase(reverse_iterator); template<typename Pred> inline size_type erase_if(Pred); void join(PB_DS_CLASS_C_DEC&); void split(key_const_reference, PB_DS_CLASS_C_DEC&); private: #ifdef _GLIBCXX_DEBUG void assert_valid(const char*, int) const; size_type assert_node_consistent(const node_pointer, const char*, int) const; #endif inline static bool is_effectively_black(const node_pointer); void initialize(); void insert_fixup(node_pointer); void erase_node(node_pointer); void remove_node(node_pointer); void remove_fixup(node_pointer, node_pointer); void split_imp(node_pointer, PB_DS_CLASS_C_DEC&); inline node_pointer split_min(); std::pair<node_pointer, node_pointer> split_min_imp(); void join_imp(node_pointer, node_pointer); std::pair<node_pointer, node_pointer> find_join_pos_right(node_pointer, size_type, size_type); std::pair<node_pointer, node_pointer> find_join_pos_left(node_pointer, size_type, size_type); inline size_type black_height(node_pointer); void split_at_node(node_pointer, PB_DS_CLASS_C_DEC&); }; #define PB_DS_STRUCT_ONLY_ASSERT_VALID(X) \ _GLIBCXX_DEBUG_ONLY(X.structure_only_assert_valid(__FILE__, __LINE__);) #include <ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp> #include <ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp> #include <ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp> #include <ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp> #include <ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp> #include <ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp> #undef PB_DS_STRUCT_ONLY_ASSERT_VALID #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #undef PB_DS_RB_TREE_NAME #undef PB_DS_RB_TREE_BASE_NAME #undef PB_DS_RB_TREE_BASE } // namespace detail } // namespace __gnu_pbds ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp������������������������������������������0000644�����������������00000007433�14763166027�0017107 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file rb_tree_map_/insert_fn_imps.hpp * Contains an implementation for rb_tree_. */ PB_DS_CLASS_T_DEC inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool> PB_DS_CLASS_C_DEC:: insert(const_reference r_value) { PB_DS_ASSERT_VALID((*this)) std::pair<point_iterator, bool> ins_pair = base_type::insert_leaf(r_value); if (ins_pair.second == true) { ins_pair.first.m_p_nd->m_red = true; PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) insert_fixup(ins_pair.first.m_p_nd); } PB_DS_ASSERT_VALID((*this)) return ins_pair; } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: insert_fixup(node_pointer p_nd) { _GLIBCXX_DEBUG_ASSERT(p_nd->m_red == true); while (p_nd != base_type::m_p_head->m_p_parent && p_nd->m_p_parent->m_red) { if (p_nd->m_p_parent == p_nd->m_p_parent->m_p_parent->m_p_left) { node_pointer p_y = p_nd->m_p_parent->m_p_parent->m_p_right; if (p_y != 0 && p_y->m_red) { p_nd->m_p_parent->m_red = false; p_y->m_red = false; p_nd->m_p_parent->m_p_parent->m_red = true; p_nd = p_nd->m_p_parent->m_p_parent; } else { if (p_nd == p_nd->m_p_parent->m_p_right) { p_nd = p_nd->m_p_parent; base_type::rotate_left(p_nd); } p_nd->m_p_parent->m_red = false; p_nd->m_p_parent->m_p_parent->m_red = true; base_type::rotate_right(p_nd->m_p_parent->m_p_parent); } } else { node_pointer p_y = p_nd->m_p_parent->m_p_parent->m_p_left; if (p_y != 0 && p_y->m_red) { p_nd->m_p_parent->m_red = false; p_y->m_red = false; p_nd->m_p_parent->m_p_parent->m_red = true; p_nd = p_nd->m_p_parent->m_p_parent; } else { if (p_nd == p_nd->m_p_parent->m_p_left) { p_nd = p_nd->m_p_parent; base_type::rotate_right(p_nd); } p_nd->m_p_parent->m_red = false; p_nd->m_p_parent->m_p_parent->m_red = true; base_type::rotate_left(p_nd->m_p_parent->m_p_parent); } } } base_type::update_to_top(p_nd, (node_update* )this); base_type::m_p_head->m_p_parent->m_red = false; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp��������������������������������������0000644�����������������00000017265�14763166027�0017761 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file rb_tree_map_/split_join_fn_imps.hpp * Contains an implementation for rb_tree_. */ PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: join(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) if (base_type::join_prep(other) == false) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) return; } const node_pointer p_x = other.split_min(); join_imp(p_x, other.m_p_head->m_p_parent); base_type::join_finish(other); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: join_imp(node_pointer p_x, node_pointer p_r) { _GLIBCXX_DEBUG_ASSERT(p_x != 0); if (p_r != 0) p_r->m_red = false; const size_type h = black_height(base_type::m_p_head->m_p_parent); const size_type other_h = black_height(p_r); node_pointer p_x_l; node_pointer p_x_r; std::pair<node_pointer, node_pointer> join_pos; const bool right_join = h >= other_h; if (right_join) { join_pos = find_join_pos_right(base_type::m_p_head->m_p_parent, h, other_h); p_x_l = join_pos.first; p_x_r = p_r; } else { p_x_l = base_type::m_p_head->m_p_parent; base_type::m_p_head->m_p_parent = p_r; if (p_r != 0) p_r->m_p_parent = base_type::m_p_head; join_pos = find_join_pos_left(base_type::m_p_head->m_p_parent, h, other_h); p_x_r = join_pos.first; } node_pointer p_parent = join_pos.second; if (p_parent == base_type::m_p_head) { base_type::m_p_head->m_p_parent = p_x; p_x->m_p_parent = base_type::m_p_head; } else { p_x->m_p_parent = p_parent; if (right_join) p_x->m_p_parent->m_p_right = p_x; else p_x->m_p_parent->m_p_left = p_x; } p_x->m_p_left = p_x_l; if (p_x_l != 0) p_x_l->m_p_parent = p_x; p_x->m_p_right = p_x_r; if (p_x_r != 0) p_x_r->m_p_parent = p_x; p_x->m_red = true; base_type::initialize_min_max(); PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) base_type::update_to_top(p_x, (node_update* )this); insert_fixup(p_x); PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: split_min() { node_pointer p_min = base_type::m_p_head->m_p_left; #ifdef _GLIBCXX_DEBUG const node_pointer p_head = base_type::m_p_head; _GLIBCXX_DEBUG_ASSERT(p_min != p_head); #endif remove_node(p_min); return p_min; } PB_DS_CLASS_T_DEC std::pair< typename PB_DS_CLASS_C_DEC::node_pointer, typename PB_DS_CLASS_C_DEC::node_pointer> PB_DS_CLASS_C_DEC:: find_join_pos_right(node_pointer p_l, size_type h_l, size_type h_r) { _GLIBCXX_DEBUG_ASSERT(h_l >= h_r); if (base_type::m_p_head->m_p_parent == 0) return (std::make_pair((node_pointer)0, base_type::m_p_head)); node_pointer p_l_parent = base_type::m_p_head; while (h_l > h_r) { if (p_l->m_red == false) { _GLIBCXX_DEBUG_ASSERT(h_l > 0); --h_l; } p_l_parent = p_l; p_l = p_l->m_p_right; } if (!is_effectively_black(p_l)) { p_l_parent = p_l; p_l = p_l->m_p_right; } _GLIBCXX_DEBUG_ASSERT(is_effectively_black(p_l)); _GLIBCXX_DEBUG_ASSERT(black_height(p_l) == h_r); _GLIBCXX_DEBUG_ASSERT(p_l == 0 || p_l->m_p_parent == p_l_parent); return std::make_pair(p_l, p_l_parent); } PB_DS_CLASS_T_DEC std::pair< typename PB_DS_CLASS_C_DEC::node_pointer, typename PB_DS_CLASS_C_DEC::node_pointer> PB_DS_CLASS_C_DEC:: find_join_pos_left(node_pointer p_r, size_type h_l, size_type h_r) { _GLIBCXX_DEBUG_ASSERT(h_r > h_l); if (base_type::m_p_head->m_p_parent == 0) return (std::make_pair((node_pointer)0, base_type::m_p_head)); node_pointer p_r_parent = base_type::m_p_head; while (h_r > h_l) { if (p_r->m_red == false) { _GLIBCXX_DEBUG_ASSERT(h_r > 0); --h_r; } p_r_parent = p_r; p_r = p_r->m_p_left; } if (!is_effectively_black(p_r)) { p_r_parent = p_r; p_r = p_r->m_p_left; } _GLIBCXX_DEBUG_ASSERT(is_effectively_black(p_r)); _GLIBCXX_DEBUG_ASSERT(black_height(p_r) == h_l); _GLIBCXX_DEBUG_ASSERT(p_r == 0 || p_r->m_p_parent == p_r_parent); return std::make_pair(p_r, p_r_parent); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: black_height(node_pointer p_nd) { size_type h = 1; while (p_nd != 0) { if (p_nd->m_red == false) ++h; p_nd = p_nd->m_p_left; } return h; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: split(key_const_reference r_key, PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) if (base_type::split_prep(r_key, other) == false) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) return; } PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) PB_DS_STRUCT_ONLY_ASSERT_VALID(other) node_pointer p_nd = this->upper_bound(r_key).m_p_nd; do { node_pointer p_next_nd = p_nd->m_p_parent; if (Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value))) split_at_node(p_nd, other); PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) PB_DS_STRUCT_ONLY_ASSERT_VALID(other) p_nd = p_next_nd; } while (p_nd != base_type::m_p_head); base_type::split_finish(other); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: split_at_node(node_pointer p_nd, PB_DS_CLASS_C_DEC& other) { _GLIBCXX_DEBUG_ASSERT(p_nd != 0); node_pointer p_l = p_nd->m_p_left; node_pointer p_r = p_nd->m_p_right; node_pointer p_parent = p_nd->m_p_parent; if (p_parent == base_type::m_p_head) { base_type::m_p_head->m_p_parent = p_l; if (p_l != 0) { p_l->m_p_parent = base_type::m_p_head; p_l->m_red = false; } } else { if (p_parent->m_p_left == p_nd) p_parent->m_p_left = p_l; else p_parent->m_p_right = p_l; if (p_l != 0) p_l->m_p_parent = p_parent; this->update_to_top(p_parent, (node_update* )this); if (!p_nd->m_red) remove_fixup(p_l, p_parent); } base_type::initialize_min_max(); other.join_imp(p_nd, p_r); PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) PB_DS_STRUCT_ONLY_ASSERT_VALID(other) } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/rb_tree_map_/traits.hpp��������������������������������������������������0000644�����������������00000006323�14763166027�0015373 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file rb_tree_map_/traits.hpp * Contains an implementation for rb_tree_. */ #ifndef PB_DS_RB_TREE_NODE_AND_IT_TRAITS_HPP #define PB_DS_RB_TREE_NODE_AND_IT_TRAITS_HPP #include <ext/pb_ds/detail/rb_tree_map_/node.hpp> namespace __gnu_pbds { namespace detail { /// Specialization. /// @ingroup traits template<typename Key, typename Mapped, typename Cmp_Fn, template<typename Node_CItr, typename Node_Itr, typename Cmp_Fn_, typename _Alloc_> class Node_Update, typename _Alloc> struct tree_traits<Key, Mapped, Cmp_Fn, Node_Update, rb_tree_tag,_Alloc> : public bin_search_tree_traits< Key, Mapped, Cmp_Fn, Node_Update, rb_tree_node_< typename types_traits<Key, Mapped, _Alloc, false>::value_type, typename tree_node_metadata_dispatch<Key, Mapped, Cmp_Fn, Node_Update, _Alloc>::type, _Alloc>, _Alloc> { }; /// Specialization. /// @ingroup traits template<typename Key, typename Cmp_Fn, template<typename Node_CItr, typename Node_Itr, typename Cmp_Fn_, typename _Alloc_> class Node_Update, typename _Alloc> struct tree_traits<Key, null_type, Cmp_Fn, Node_Update, rb_tree_tag,_Alloc> : public bin_search_tree_traits< Key, null_type, Cmp_Fn, Node_Update, rb_tree_node_< typename types_traits<Key, null_type, _Alloc, false>::value_type, typename tree_node_metadata_dispatch<Key, null_type, Cmp_Fn, Node_Update, _Alloc>::type, _Alloc>, _Alloc> { }; } // namespace detail } // namespace __gnu_pbds #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp��������������������������������������������0000644�����������������00000003247�14763166027�0016522 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file rb_tree_map_/find_fn_imps.hpp * Contains an implementation for rb_tree_. */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp�������������������������������������������0000644�����������������00000015613�14763166027�0016701 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file rb_tree_map_/erase_fn_imps.hpp * Contains an implementation for rb_tree_. */ PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: erase(key_const_reference r_key) { point_iterator it = this->find(r_key); if (it == base_type::end()) return false; erase(it); return true; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: erase(iterator it) { PB_DS_ASSERT_VALID((*this)) if (it == base_type::end()) return it; iterator ret_it = it; ++ret_it; erase_node(it.m_p_nd); PB_DS_ASSERT_VALID((*this)) return ret_it; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::reverse_iterator PB_DS_CLASS_C_DEC:: erase(reverse_iterator it) { PB_DS_ASSERT_VALID((*this)) if (it.m_p_nd == base_type::m_p_head) return it; reverse_iterator ret_it = it; ++ret_it; erase_node(it.m_p_nd); PB_DS_ASSERT_VALID((*this)) return ret_it; } PB_DS_CLASS_T_DEC template<typename Pred> inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: erase_if(Pred pred) { PB_DS_ASSERT_VALID((*this)) size_type num_ersd = 0; iterator it = base_type::begin(); while (it != base_type::end()) { if (pred(*it)) { ++num_ersd; it = erase(it); } else ++it; } PB_DS_ASSERT_VALID((*this)) return num_ersd; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: erase_node(node_pointer p_nd) { remove_node(p_nd); base_type::actual_erase_node(p_nd); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: remove_node(node_pointer p_z) { this->update_min_max_for_erased_node(p_z); node_pointer p_y = p_z; node_pointer p_x = 0; node_pointer p_new_x_parent = 0; if (p_y->m_p_left == 0) p_x = p_y->m_p_right; else if (p_y->m_p_right == 0) p_x = p_y->m_p_left; else { p_y = p_y->m_p_right; while (p_y->m_p_left != 0) p_y = p_y->m_p_left; p_x = p_y->m_p_right; } if (p_y == p_z) { p_new_x_parent = p_y->m_p_parent; if (p_x != 0) p_x->m_p_parent = p_y->m_p_parent; if (base_type::m_p_head->m_p_parent == p_z) base_type::m_p_head->m_p_parent = p_x; else if (p_z->m_p_parent->m_p_left == p_z) { p_y->m_p_left = p_z->m_p_parent; p_z->m_p_parent->m_p_left = p_x; } else { p_y->m_p_left = 0; p_z->m_p_parent->m_p_right = p_x; } } else { p_z->m_p_left->m_p_parent = p_y; p_y->m_p_left = p_z->m_p_left; if (p_y != p_z->m_p_right) { p_new_x_parent = p_y->m_p_parent; if (p_x != 0) p_x->m_p_parent = p_y->m_p_parent; p_y->m_p_parent->m_p_left = p_x; p_y->m_p_right = p_z->m_p_right; p_z->m_p_right->m_p_parent = p_y; } else p_new_x_parent = p_y; if (base_type::m_p_head->m_p_parent == p_z) base_type::m_p_head->m_p_parent = p_y; else if (p_z->m_p_parent->m_p_left == p_z) p_z->m_p_parent->m_p_left = p_y; else p_z->m_p_parent->m_p_right = p_y; p_y->m_p_parent = p_z->m_p_parent; std::swap(p_y->m_red, p_z->m_red); p_y = p_z; } this->update_to_top(p_new_x_parent, (node_update* )this); if (p_y->m_red) return; remove_fixup(p_x, p_new_x_parent); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: remove_fixup(node_pointer p_x, node_pointer p_new_x_parent) { _GLIBCXX_DEBUG_ASSERT(p_x == 0 || p_x->m_p_parent == p_new_x_parent); while (p_x != base_type::m_p_head->m_p_parent && is_effectively_black(p_x)) if (p_x == p_new_x_parent->m_p_left) { node_pointer p_w = p_new_x_parent->m_p_right; if (p_w->m_red) { p_w->m_red = false; p_new_x_parent->m_red = true; base_type::rotate_left(p_new_x_parent); p_w = p_new_x_parent->m_p_right; } if (is_effectively_black(p_w->m_p_left) && is_effectively_black(p_w->m_p_right)) { p_w->m_red = true; p_x = p_new_x_parent; p_new_x_parent = p_new_x_parent->m_p_parent; } else { if (is_effectively_black(p_w->m_p_right)) { if (p_w->m_p_left != 0) p_w->m_p_left->m_red = false; p_w->m_red = true; base_type::rotate_right(p_w); p_w = p_new_x_parent->m_p_right; } p_w->m_red = p_new_x_parent->m_red; p_new_x_parent->m_red = false; if (p_w->m_p_right != 0) p_w->m_p_right->m_red = false; base_type::rotate_left(p_new_x_parent); this->update_to_top(p_new_x_parent, (node_update* )this); break; } } else { node_pointer p_w = p_new_x_parent->m_p_left; if (p_w->m_red == true) { p_w->m_red = false; p_new_x_parent->m_red = true; base_type::rotate_right(p_new_x_parent); p_w = p_new_x_parent->m_p_left; } if (is_effectively_black(p_w->m_p_right) && is_effectively_black(p_w->m_p_left)) { p_w->m_red = true; p_x = p_new_x_parent; p_new_x_parent = p_new_x_parent->m_p_parent; } else { if (is_effectively_black(p_w->m_p_left)) { if (p_w->m_p_right != 0) p_w->m_p_right->m_red = false; p_w->m_red = true; base_type::rotate_left(p_w); p_w = p_new_x_parent->m_p_left; } p_w->m_red = p_new_x_parent->m_red; p_new_x_parent->m_red = false; if (p_w->m_p_left != 0) p_w->m_p_left->m_red = false; base_type::rotate_right(p_new_x_parent); this->update_to_top(p_new_x_parent, (node_update* )this); break; } } if (p_x != 0) p_x->m_red = false; } ���������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/rb_tree_map_/node.hpp����������������������������������������������������0000644�����������������00000007436�14763166027�0015020 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file rb_tree_map_/node.hpp * Contains an implementation for rb_tree_. */ #ifndef PB_DS_RB_TREE_NODE_HPP #define PB_DS_RB_TREE_NODE_HPP #include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp> namespace __gnu_pbds { namespace detail { /// Node for Red-Black trees. template<typename Value_Type, class Metadata, typename _Alloc> struct rb_tree_node_ { public: typedef Value_Type value_type; typedef Metadata metadata_type; typedef typename _Alloc::template rebind< rb_tree_node_< Value_Type, Metadata, _Alloc> >::other::pointer node_pointer; typedef typename _Alloc::template rebind< metadata_type>::other::reference metadata_reference; typedef typename _Alloc::template rebind< metadata_type>::other::const_reference metadata_const_reference; bool special() const { return m_red; } metadata_const_reference get_metadata() const { return m_metadata; } metadata_reference get_metadata() { return m_metadata; } #ifdef PB_DS_BIN_SEARCH_TREE_TRACE_ void trace() const { std::cout << PB_DS_V2F(m_value) <<(m_red? " <r> " : " <b> ") << "(" << m_metadata << ")"; } #endif node_pointer m_p_left; node_pointer m_p_right; node_pointer m_p_parent; value_type m_value; bool m_red; metadata_type m_metadata; }; template<typename Value_Type, typename _Alloc> struct rb_tree_node_<Value_Type, null_type, _Alloc> { public: typedef Value_Type value_type; typedef null_type metadata_type; typedef typename _Alloc::template rebind< rb_tree_node_< Value_Type, null_type, _Alloc> >::other::pointer node_pointer; bool special() const { return m_red; } #ifdef PB_DS_BIN_SEARCH_TREE_TRACE_ void trace() const { std::cout << PB_DS_V2F(m_value) <<(m_red? " <r> " : " <b> "); } #endif node_pointer m_p_left; node_pointer m_p_right; node_pointer m_p_parent; value_type m_value; bool m_red; }; } // namespace detail } // namespace __gnu_pbds #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp��������������������������������������������0000644�����������������00000003461�14763166027�0016533 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file rb_tree_map_/info_fn_imps.hpp * Contains an implementation for rb_tree_. */ PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: is_effectively_black(const node_pointer p_nd) { return (p_nd == 0 || !p_nd->m_red); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp�������������������������������������������0000644�����������������00000005311�14763166027�0016662 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file rb_tree_map_/debug_fn_imps.hpp * Contains an implementation for rb_tree_. */ #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: assert_node_consistent(const node_pointer p_nd, const char* __file, int __line) const { if (p_nd == 0) return 1; const size_type l_height = assert_node_consistent(p_nd->m_p_left, __file, __line); const size_type r_height = assert_node_consistent(p_nd->m_p_right, __file, __line); if (p_nd->m_red) { PB_DS_DEBUG_VERIFY(is_effectively_black(p_nd->m_p_left)); PB_DS_DEBUG_VERIFY(is_effectively_black(p_nd->m_p_right)); } PB_DS_DEBUG_VERIFY(l_height == r_height); return (p_nd->m_red ? 0 : 1) + l_height; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_valid(const char* __file, int __line) const { base_type::assert_valid(__file, __line); const node_pointer p_head = base_type::m_p_head; PB_DS_DEBUG_VERIFY(p_head->m_red); if (p_head->m_p_parent != 0) { PB_DS_DEBUG_VERIFY(!p_head->m_p_parent->m_red); assert_node_consistent(p_head->m_p_parent, __file, __line); } } #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cond_dealtor.hpp���������������������������������������������������������0000644�����������������00000005244�14763166027�0014105 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file detail/cond_dealtor.hpp * Contains a conditional deallocator. */ #ifndef PB_DS_COND_DEALTOR_HPP #define PB_DS_COND_DEALTOR_HPP namespace __gnu_pbds { namespace detail { /// Conditional deallocate constructor argument. template<typename Entry, typename _Alloc> class cond_dealtor { typedef typename _Alloc::template rebind<Entry> __rebind_e; public: typedef typename __rebind_e::other entry_allocator; typedef typename entry_allocator::pointer entry_pointer; cond_dealtor(entry_pointer p_e) : m_p_e(p_e), m_no_action_destructor(false) { } ~cond_dealtor() { if (m_no_action_destructor) return; s_alloc.deallocate(m_p_e, 1); } void set_no_action() { m_no_action_destructor = true; } private: entry_pointer m_p_e; bool m_no_action_destructor; static entry_allocator s_alloc; }; template<typename Entry, class _Alloc> typename cond_dealtor<Entry, _Alloc>::entry_allocator cond_dealtor<Entry, _Alloc>::s_alloc; } // namespace detail } // namespace __gnu_pbds #endif // #ifndef PB_DS_COND_DEALTOR_HPP ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp��������������������0000644�����������������00000004643�14763166027�0023625 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file rc_binomial_heap_/constructors_destructor_fn_imps.hpp * Contains an implementation for rc_binomial_heap_. */ PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: rc_binomial_heap() { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: rc_binomial_heap(const Cmp_Fn& r_cmp_fn) : base_type(r_cmp_fn) { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: rc_binomial_heap(const PB_DS_CLASS_C_DEC& other) : base_type(other) { make_binomial_heap(); base_type::find_max(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ~rc_binomial_heap() { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) base_type::swap(other); m_rc.swap(other.m_rc); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } ���������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp�������������������������������������0000644�����������������00000010215�14763166027�0020073 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file rc_binomial_heap_/insert_fn_imps.hpp * Contains an implementation for rc_binomial_heap_. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_iterator PB_DS_CLASS_C_DEC:: push(const_reference r_val) { PB_DS_ASSERT_VALID((*this)) make_0_exposed(); PB_DS_ASSERT_VALID((*this)) node_pointer p_nd = base_type::get_new_node_for_insert(r_val); p_nd->m_p_l_child = p_nd->m_p_prev_or_parent = 0; p_nd->m_metadata = 0; if (base_type::m_p_max == 0 || Cmp_Fn::operator()(base_type::m_p_max->m_value, r_val)) base_type::m_p_max = p_nd; p_nd->m_p_next_sibling = base_type::m_p_root; if (base_type::m_p_root != 0) base_type::m_p_root->m_p_prev_or_parent = p_nd; base_type::m_p_root = p_nd; if (p_nd->m_p_next_sibling != 0&& p_nd->m_p_next_sibling->m_metadata == 0) m_rc.push(p_nd); PB_DS_ASSERT_VALID((*this)) return point_iterator(p_nd); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: modify(point_iterator it, const_reference r_new_val) { PB_DS_ASSERT_VALID((*this)) make_binomial_heap(); base_type::modify(it, r_new_val); base_type::find_max(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: link_with_next_sibling(node_pointer p_nd) { node_pointer p_next = p_nd->m_p_next_sibling; _GLIBCXX_DEBUG_ASSERT(p_next != 0); _GLIBCXX_DEBUG_ASSERT(p_next->m_p_prev_or_parent == p_nd); if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value)) { p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent; if (p_next->m_p_prev_or_parent == 0) base_type::m_p_root = p_next; else p_next->m_p_prev_or_parent->m_p_next_sibling = p_next; if (base_type::m_p_max == p_nd) base_type::m_p_max = p_next; base_type::make_child_of(p_nd, p_next); ++p_next->m_metadata; return p_next; } p_nd->m_p_next_sibling = p_next->m_p_next_sibling; if (p_nd->m_p_next_sibling != 0) p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd; if (base_type::m_p_max == p_next) base_type::m_p_max = p_nd; base_type::make_child_of(p_next, p_nd); ++p_nd->m_metadata; return p_nd; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: make_0_exposed() { if (m_rc.empty()) return; node_pointer p_nd = m_rc.top(); m_rc.pop(); _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling != 0); _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata); node_pointer p_res = link_with_next_sibling(p_nd); if (p_res->m_p_next_sibling != 0&& p_res->m_metadata == p_res->m_p_next_sibling->m_metadata) m_rc.push(p_res); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp�������������������������������������������������0000644�����������������00000014171�14763166027�0015465 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file rc_binomial_heap_/rc.hpp * Contains a redundant (binary counter). */ #ifndef PB_DS_RC_HPP #define PB_DS_RC_HPP namespace __gnu_pbds { namespace detail { /// Redundant binary counter. template<typename _Node, typename _Alloc> class rc { private: typedef _Alloc allocator_type; typedef typename allocator_type::size_type size_type; typedef _Node node; typedef typename _Alloc::template rebind<node> __rebind_n; typedef typename __rebind_n::other::pointer node_pointer; typedef typename _Alloc::template rebind<node_pointer> __rebind_np; typedef typename __rebind_np::other::pointer entry_pointer; typedef typename __rebind_np::other::const_pointer entry_const_pointer; enum { max_entries = sizeof(size_type) << 3 }; public: typedef node_pointer entry; typedef entry_const_pointer const_iterator; rc(); rc(const rc&); inline void swap(rc&); inline void push(entry); inline node_pointer top() const; inline void pop(); inline bool empty() const; inline size_type size() const; void clear(); const const_iterator begin() const; const const_iterator end() const; #ifdef _GLIBCXX_DEBUG void assert_valid(const char*, int) const; #endif #ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_ void trace() const; #endif private: node_pointer m_a_entries[max_entries]; size_type m_over_top; }; template<typename _Node, typename _Alloc> rc<_Node, _Alloc>:: rc() : m_over_top(0) { PB_DS_ASSERT_VALID((*this)) } template<typename _Node, typename _Alloc> rc<_Node, _Alloc>:: rc(const rc<_Node, _Alloc>& other) : m_over_top(0) { PB_DS_ASSERT_VALID((*this)) } template<typename _Node, typename _Alloc> inline void rc<_Node, _Alloc>:: swap(rc<_Node, _Alloc>& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) const size_type over_top = std::max(m_over_top, other.m_over_top); for (size_type i = 0; i < over_top; ++i) std::swap(m_a_entries[i], other.m_a_entries[i]); std::swap(m_over_top, other.m_over_top); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } template<typename _Node, typename _Alloc> inline void rc<_Node, _Alloc>:: push(entry p_nd) { PB_DS_ASSERT_VALID((*this)) _GLIBCXX_DEBUG_ASSERT(m_over_top < max_entries); m_a_entries[m_over_top++] = p_nd; PB_DS_ASSERT_VALID((*this)) } template<typename _Node, typename _Alloc> inline void rc<_Node, _Alloc>:: pop() { PB_DS_ASSERT_VALID((*this)) _GLIBCXX_DEBUG_ASSERT(!empty()); --m_over_top; PB_DS_ASSERT_VALID((*this)) } template<typename _Node, typename _Alloc> inline typename rc<_Node, _Alloc>::node_pointer rc<_Node, _Alloc>:: top() const { PB_DS_ASSERT_VALID((*this)) _GLIBCXX_DEBUG_ASSERT(!empty()); return *(m_a_entries + m_over_top - 1); } template<typename _Node, typename _Alloc> inline bool rc<_Node, _Alloc>:: empty() const { PB_DS_ASSERT_VALID((*this)) return m_over_top == 0; } template<typename _Node, typename _Alloc> inline typename rc<_Node, _Alloc>::size_type rc<_Node, _Alloc>:: size() const { return m_over_top; } template<typename _Node, typename _Alloc> void rc<_Node, _Alloc>:: clear() { PB_DS_ASSERT_VALID((*this)) m_over_top = 0; PB_DS_ASSERT_VALID((*this)) } template<typename _Node, typename _Alloc> const typename rc<_Node, _Alloc>::const_iterator rc<_Node, _Alloc>:: begin() const { return& m_a_entries[0]; } template<typename _Node, typename _Alloc> const typename rc<_Node, _Alloc>::const_iterator rc<_Node, _Alloc>:: end() const { return& m_a_entries[m_over_top]; } #ifdef _GLIBCXX_DEBUG template<typename _Node, typename _Alloc> void rc<_Node, _Alloc>:: assert_valid(const char* __file, int __line) const { PB_DS_DEBUG_VERIFY(m_over_top < max_entries); } #endif #ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_ template<typename _Node, typename _Alloc> void rc<_Node, _Alloc>:: trace() const { std::cout << "rc" << std::endl; for (size_type i = 0; i < m_over_top; ++i) std::cerr << m_a_entries[i] << std::endl; std::cout << std::endl; } #endif } // namespace detail } // namespace __gnu_pbds #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp���������������������������������0000644�����������������00000004562�14763166027�0020751 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file rc_binomial_heap_/split_join_fn_imps.hpp * Contains an implementation for rc_binomial_heap_. */ PB_DS_CLASS_T_DEC template<typename Pred> void PB_DS_CLASS_C_DEC:: split(Pred pred, PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) make_binomial_heap(); other.make_binomial_heap(); base_type::split(pred, other); base_type::find_max(); other.find_max(); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: join(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) make_binomial_heap(); other.make_binomial_heap(); base_type::join(other); base_type::find_max(); other.find_max(); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } ����������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp��������������������������������������0000644�����������������00000005511�14763166027�0017671 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file rc_binomial_heap_/erase_fn_imps.hpp * Contains an implementation for rc_binomial_heap_. */ PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: pop() { make_binomial_heap(); _GLIBCXX_DEBUG_ASSERT(!base_type::empty()); base_type::pop(); base_type::find_max(); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: clear() { base_type::clear(); m_rc.clear(); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: make_binomial_heap() { node_pointer p_nd = base_type::m_p_root; while (p_nd != 0) { node_pointer p_next = p_nd->m_p_next_sibling; if (p_next == 0) p_nd = p_next; else if (p_nd->m_metadata == p_next->m_metadata) p_nd = link_with_next_sibling(p_nd); else if (p_nd->m_metadata < p_next->m_metadata) p_nd = p_next; #ifdef _GLIBCXX_DEBUG else _GLIBCXX_DEBUG_ASSERT(0); #endif } m_rc.clear(); } PB_DS_CLASS_T_DEC template<typename Pred> typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: erase_if(Pred pred) { make_binomial_heap(); const size_type ersd = base_type::erase_if(pred); base_type::find_max(); PB_DS_ASSERT_VALID((*this)) return ersd; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: erase(point_iterator it) { make_binomial_heap(); base_type::erase(it); base_type::find_max(); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp��������������������������������������0000644�����������������00000003560�14763166027�0017672 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file rc_binomial_heap_/trace_fn_imps.hpp * Contains an implementation for rc_binomial_heap_. */ #ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace() const { base_type::trace(); m_rc.trace(); } #endif // #ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_ ������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp����������������������������������0000644�����������������00000012267�14763166027�0020477 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file rc_binomial_heap_/rc_binomial_heap_.hpp * Contains an implementation for redundant-counter binomial heap. */ #include <ext/pb_ds/detail/cond_dealtor.hpp> #include <ext/pb_ds/detail/type_utils.hpp> #include <ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp> #include <ext/pb_ds/detail/rc_binomial_heap_/rc.hpp> #include <debug/debug.h> namespace __gnu_pbds { namespace detail { #define PB_DS_CLASS_T_DEC \ template<typename Value_Type, typename Cmp_Fn, typename _Alloc> #define PB_DS_CLASS_C_DEC \ rc_binomial_heap<Value_Type, Cmp_Fn, _Alloc> #define PB_DS_RC_C_DEC \ rc<typename binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>::node, _Alloc> /** * Redundant-counter binomial heap. * * @ingroup heap-detail */ template<typename Value_Type, typename Cmp_Fn, typename _Alloc> class rc_binomial_heap : public binomial_heap_base<Value_Type, Cmp_Fn, _Alloc> { private: typedef binomial_heap_base<Value_Type, Cmp_Fn, _Alloc> base_type; typedef typename base_type::node_pointer node_pointer; typedef typename base_type::node_const_pointer node_const_pointer; typedef PB_DS_RC_C_DEC rc_t; public: typedef Value_Type value_type; typedef typename _Alloc::size_type size_type; typedef typename _Alloc::difference_type difference_type; typedef typename base_type::pointer pointer; typedef typename base_type::const_pointer const_pointer; typedef typename base_type::reference reference; typedef typename base_type::const_reference const_reference; typedef typename base_type::point_const_iterator point_const_iterator; typedef typename base_type::point_iterator point_iterator; typedef typename base_type::const_iterator const_iterator; typedef typename base_type::iterator iterator; typedef typename base_type::cmp_fn cmp_fn; typedef typename base_type::allocator_type allocator_type; rc_binomial_heap(); rc_binomial_heap(const Cmp_Fn&); rc_binomial_heap(const PB_DS_CLASS_C_DEC&); ~rc_binomial_heap(); void swap(PB_DS_CLASS_C_DEC&); inline point_iterator push(const_reference); void modify(point_iterator, const_reference); inline void pop(); void erase(point_iterator); inline void clear(); template<typename Pred> size_type erase_if(Pred); template<typename Pred> void split(Pred, PB_DS_CLASS_C_DEC&); void join(PB_DS_CLASS_C_DEC&); #ifdef _GLIBCXX_DEBUG void assert_valid(const char*, int) const; #endif #ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_ void trace() const; #endif private: inline node_pointer link_with_next_sibling(node_pointer); void make_0_exposed(); void make_binomial_heap(); #ifdef _GLIBCXX_DEBUG static node_const_pointer next_2_pointer(node_const_pointer); static node_const_pointer next_after_0_pointer(node_const_pointer); #endif rc_t m_rc; }; #include <ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp> #include <ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp> #include <ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp> #include <ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp> #include <ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp> #include <ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp> #undef PB_DS_CLASS_C_DEC #undef PB_DS_CLASS_T_DEC #undef PB_DS_RC_C_DEC } // namespace detail } // namespace __gnu_pbds �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp��������������������������������������0000644�����������������00000006722�14763166027�0017665 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file rc_binomial_heap_/debug_fn_imps.hpp * Contains an implementation for rc_binomial_heap_. */ #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_valid(const char* __file, int __line) const { base_type::assert_valid(false, __file, __line); if (!base_type::empty()) { PB_DS_DEBUG_VERIFY(base_type::m_p_max != 0); base_type::assert_max(__file, __line); } m_rc.assert_valid(__file, __line); if (m_rc.empty()) { base_type::assert_valid(true, __file, __line); PB_DS_DEBUG_VERIFY(next_2_pointer(base_type::m_p_root) == 0); return; } node_const_pointer p_nd = next_2_pointer(base_type::m_p_root); typename rc_t::const_iterator it = m_rc.end(); --it; while (p_nd != 0) { PB_DS_DEBUG_VERIFY(*it == p_nd); node_const_pointer p_next = p_nd->m_p_next_sibling; PB_DS_DEBUG_VERIFY(p_next != 0); PB_DS_DEBUG_VERIFY(p_nd->m_metadata == p_next->m_metadata); PB_DS_DEBUG_VERIFY(p_next->m_p_next_sibling == 0 || p_next->m_metadata < p_next->m_p_next_sibling->m_metadata); --it; p_nd = next_2_pointer(next_after_0_pointer(p_nd)); } PB_DS_DEBUG_VERIFY(it + 1 == m_rc.begin()); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_const_pointer PB_DS_CLASS_C_DEC:: next_2_pointer(node_const_pointer p_nd) { if (p_nd == 0) return 0; node_pointer p_next = p_nd->m_p_next_sibling; if (p_next == 0) return 0; if (p_nd->m_metadata == p_next->m_metadata) return p_nd; return next_2_pointer(p_next); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_const_pointer PB_DS_CLASS_C_DEC:: next_after_0_pointer(node_const_pointer p_nd) { if (p_nd == 0) return 0; node_pointer p_next = p_nd->m_p_next_sibling; if (p_next == 0) return 0; if (p_nd->m_metadata < p_next->m_metadata) return p_next; return next_after_0_pointer(p_next); } #endif ����������������������������������������������c++/4.8.2/ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp�������������������0000644�����������������00000010620�14763166027�0023710 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file left_child_next_sibling_heap_/point_const_iterator.hpp * Contains an iterator class returned by the table's const find and insert * methods. */ #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP #define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP #include <ext/pb_ds/tag_and_trait.hpp> #include <debug/debug.h> namespace __gnu_pbds { namespace detail { #define PB_DS_CLASS_T_DEC \ template<typename Node, typename _Alloc> #define PB_DS_CLASS_C_DEC \ left_child_next_sibling_heap_node_point_const_iterator_<Node, _Alloc> /// Const point-type iterator. template<typename Node, typename _Alloc> class left_child_next_sibling_heap_node_point_const_iterator_ { protected: typedef typename _Alloc::template rebind<Node>::other::pointer node_pointer; public: /// Category. typedef trivial_iterator_tag iterator_category; /// Difference type. typedef trivial_iterator_difference_type difference_type; /// Iterator's value type. typedef typename Node::value_type value_type; /// Iterator's pointer type. typedef typename _Alloc::template rebind< value_type>::other::pointer pointer; /// Iterator's const pointer type. typedef typename _Alloc::template rebind< value_type>::other::const_pointer const_pointer; /// Iterator's reference type. typedef typename _Alloc::template rebind< value_type>::other::reference reference; /// Iterator's const reference type. typedef typename _Alloc::template rebind< value_type>::other::const_reference const_reference; inline left_child_next_sibling_heap_node_point_const_iterator_(node_pointer p_nd) : m_p_nd(p_nd) { } /// Default constructor. inline left_child_next_sibling_heap_node_point_const_iterator_() : m_p_nd(0) { } /// Copy constructor. inline left_child_next_sibling_heap_node_point_const_iterator_(const PB_DS_CLASS_C_DEC& other) : m_p_nd(other.m_p_nd) { } /// Access. const_pointer operator->() const { _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0); return &m_p_nd->m_value; } /// Access. const_reference operator*() const { _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0); return m_p_nd->m_value; } /// Compares content to a different iterator object. bool operator==(const PB_DS_CLASS_C_DEC& other) const { return m_p_nd == other.m_p_nd; } /// Compares content (negatively) to a different iterator object. bool operator!=(const PB_DS_CLASS_C_DEC& other) const { return m_p_nd != other.m_p_nd; } node_pointer m_p_nd; }; #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC } // namespace detail } // namespace __gnu_pbds #endif ����������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp��������0000644�����������������00000007727�14763166027�0026217 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp * Contains an implementation class for left_child_next_sibling_heap_. */ PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_allocator PB_DS_CLASS_C_DEC::s_node_allocator; PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::no_throw_copies_t PB_DS_CLASS_C_DEC::s_no_throw_copies_ind; PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: left_child_next_sibling_heap() : m_p_root(0), m_size(0) { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: left_child_next_sibling_heap(const Cmp_Fn& r_cmp_fn) : Cmp_Fn(r_cmp_fn), m_p_root(0), m_size(0) { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: left_child_next_sibling_heap(const PB_DS_CLASS_C_DEC& other) : Cmp_Fn(other), m_p_root(0), m_size(0) { m_size = other.m_size; PB_DS_ASSERT_VALID(other) m_p_root = recursive_copy_node(other.m_p_root); m_size = other.m_size; PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) value_swap(other); std::swap((Cmp_Fn& )(*this), (Cmp_Fn& )other); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: value_swap(PB_DS_CLASS_C_DEC& other) { std::swap(m_p_root, other.m_p_root); std::swap(m_size, other.m_size); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ~left_child_next_sibling_heap() { clear(); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: recursive_copy_node(node_const_pointer p_nd) { if (p_nd == 0) return (0); node_pointer p_ret = s_node_allocator.allocate(1); __try { new (p_ret) node(*p_nd); } __catch(...) { s_node_allocator.deallocate(p_ret, 1); __throw_exception_again; } p_ret->m_p_l_child = p_ret->m_p_next_sibling = p_ret->m_p_prev_or_parent = 0; __try { p_ret->m_p_l_child = recursive_copy_node(p_nd->m_p_l_child); p_ret->m_p_next_sibling = recursive_copy_node(p_nd->m_p_next_sibling); } __catch(...) { clear_imp(p_ret); __throw_exception_again; } if (p_ret->m_p_l_child != 0) p_ret->m_p_l_child->m_p_prev_or_parent = p_ret; if (p_ret->m_p_next_sibling != 0) p_ret->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd ? p_ret : 0; return p_ret; } �����������������������������������������c++/4.8.2/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp�������������������������0000644�����������������00000012121�14763166027�0022455 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file left_child_next_sibling_heap_/insert_fn_imps.hpp * Contains an implementation class for left_child_next_sibling_heap_. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: get_new_node_for_insert(const_reference r_val) { return get_new_node_for_insert(r_val, s_no_throw_copies_ind); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: get_new_node_for_insert(const_reference r_val, false_type) { node_pointer p_new_nd = s_node_allocator.allocate(1); cond_dealtor_t cond(p_new_nd); new (const_cast<void* >( static_cast<const void* >(&p_new_nd->m_value))) typename node::value_type(r_val); cond.set_no_action(); ++m_size; return (p_new_nd); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: get_new_node_for_insert(const_reference r_val, true_type) { node_pointer p_new_nd = s_node_allocator.allocate(1); new (const_cast<void* >( static_cast<const void* >(&p_new_nd->m_value))) typename node::value_type(r_val); ++m_size; return (p_new_nd); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: make_child_of(node_pointer p_nd, node_pointer p_new_parent) { _GLIBCXX_DEBUG_ASSERT(p_nd != 0); _GLIBCXX_DEBUG_ASSERT(p_new_parent != 0); p_nd->m_p_next_sibling = p_new_parent->m_p_l_child; if (p_new_parent->m_p_l_child != 0) p_new_parent->m_p_l_child->m_p_prev_or_parent = p_nd; p_nd->m_p_prev_or_parent = p_new_parent; p_new_parent->m_p_l_child = p_nd; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: parent(node_pointer p_nd) { while (true) { node_pointer p_pot = p_nd->m_p_prev_or_parent; if (p_pot == 0 || p_pot->m_p_l_child == p_nd) return p_pot; p_nd = p_pot; } } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: swap_with_parent(node_pointer p_nd, node_pointer p_parent) { if (p_parent == m_p_root) m_p_root = p_nd; _GLIBCXX_DEBUG_ASSERT(p_nd != 0); _GLIBCXX_DEBUG_ASSERT(p_parent != 0); _GLIBCXX_DEBUG_ASSERT(parent(p_nd) == p_parent); const bool nd_direct_child = p_parent->m_p_l_child == p_nd; const bool parent_root = p_parent->m_p_prev_or_parent == 0; const bool parent_direct_child = !parent_root&& p_parent->m_p_prev_or_parent->m_p_l_child == p_parent; std::swap(p_parent->m_p_prev_or_parent, p_nd->m_p_prev_or_parent); std::swap(p_parent->m_p_next_sibling, p_nd->m_p_next_sibling); std::swap(p_parent->m_p_l_child, p_nd->m_p_l_child); std::swap(p_parent->m_metadata, p_nd->m_metadata); _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child != 0); _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_prev_or_parent != 0); if (p_nd->m_p_next_sibling != 0) p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd; if (p_parent->m_p_next_sibling != 0) p_parent->m_p_next_sibling->m_p_prev_or_parent = p_parent; if (p_parent->m_p_l_child != 0) p_parent->m_p_l_child->m_p_prev_or_parent = p_parent; if (parent_direct_child) p_nd->m_p_prev_or_parent->m_p_l_child = p_nd; else if (!parent_root) p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd; if (!nd_direct_child) { p_nd->m_p_l_child->m_p_prev_or_parent = p_nd; p_parent->m_p_prev_or_parent->m_p_next_sibling = p_parent; } else { _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child == p_nd); _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_prev_or_parent == p_parent); p_nd->m_p_l_child = p_parent; p_parent->m_p_prev_or_parent = p_nd; } _GLIBCXX_DEBUG_ASSERT(parent(p_parent) == p_nd); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp����������������������0000644�����������������00000004773�14763166027�0023203 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file left_child_next_sibling_heap_/iterators_fn_imps.hpp * Contains an implementation class for left_child_next_sibling_heap_. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: begin() { node_pointer p_nd = m_p_root; if (p_nd == 0) return (iterator(0)); while (p_nd->m_p_l_child != 0) p_nd = p_nd->m_p_l_child; return (iterator(p_nd)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: begin() const { node_pointer p_nd = m_p_root; if (p_nd == 0) return (const_iterator(0)); while (p_nd->m_p_l_child != 0) p_nd = p_nd->m_p_l_child; return (const_iterator(p_nd)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: end() { return (iterator(0)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: end() const { return (const_iterator(0)); } �����c++/4.8.2/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp�������������������������0000644�����������������00000011474�14763166027�0022507 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file left_child_next_sibling_heap_/const_iterator.hpp * Contains an iterator class returned by the table's const find and insert * methods. */ #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_ITERATOR_HPP #define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_ITERATOR_HPP #include <ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp> #include <debug/debug.h> namespace __gnu_pbds { namespace detail { #define PB_DS_CLASS_C_DEC \ left_child_next_sibling_heap_const_iterator_<Node, _Alloc> #define PB_DS_BASIC_HEAP_CIT_BASE \ left_child_next_sibling_heap_node_point_const_iterator_<Node, _Alloc> /// Const point-type iterator. template<typename Node, typename _Alloc> class left_child_next_sibling_heap_const_iterator_ : public PB_DS_BASIC_HEAP_CIT_BASE { private: typedef PB_DS_BASIC_HEAP_CIT_BASE base_type; typedef typename base_type::node_pointer node_pointer; public: /// Category. typedef std::forward_iterator_tag iterator_category; /// Difference type. typedef typename _Alloc::difference_type difference_type; /// Iterator's value type. typedef typename base_type::value_type value_type; /// Iterator's pointer type. typedef typename base_type::pointer pointer; /// Iterator's const pointer type. typedef typename base_type::const_pointer const_pointer; /// Iterator's reference type. typedef typename base_type::reference reference; /// Iterator's const reference type. typedef typename base_type::const_reference const_reference; inline left_child_next_sibling_heap_const_iterator_(node_pointer p_nd) : base_type(p_nd) { } /// Default constructor. inline left_child_next_sibling_heap_const_iterator_() { } /// Copy constructor. inline left_child_next_sibling_heap_const_iterator_(const PB_DS_CLASS_C_DEC& other) : base_type(other) { } /// Compares content to a different iterator object. bool operator==(const PB_DS_CLASS_C_DEC& other) const { return (base_type::m_p_nd == other.m_p_nd); } /// Compares content (negatively) to a different iterator object. bool operator!=(const PB_DS_CLASS_C_DEC& other) const { return (base_type::m_p_nd != other.m_p_nd); } PB_DS_CLASS_C_DEC& operator++() { _GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd != 0); inc(); return (*this); } PB_DS_CLASS_C_DEC operator++(int) { PB_DS_CLASS_C_DEC ret_it(base_type::m_p_nd); operator++(); return (ret_it); } private: void inc() { if (base_type::m_p_nd->m_p_next_sibling != 0) { base_type::m_p_nd = base_type::m_p_nd->m_p_next_sibling; while (base_type::m_p_nd->m_p_l_child != 0) base_type::m_p_nd = base_type::m_p_nd->m_p_l_child; return; } while (true) { node_pointer p_next = base_type::m_p_nd; base_type::m_p_nd = base_type::m_p_nd->m_p_prev_or_parent; if (base_type::m_p_nd == 0 || base_type::m_p_nd->m_p_l_child == p_next) return; } } }; #undef PB_DS_CLASS_C_DEC #undef PB_DS_BASIC_HEAP_CIT_BASE } // namespace detail } // namespace __gnu_pbds #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp������������������0000644�����������������00000003607�14763166027�0024002 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file left_child_next_sibling_heap_/policy_access_fn_imps.hpp * Contains an implementation class for left_child_next_sibling_heap_. */ PB_DS_CLASS_T_DEC Cmp_Fn& PB_DS_CLASS_C_DEC:: get_cmp_fn() { return *this; } PB_DS_CLASS_T_DEC const Cmp_Fn& PB_DS_CLASS_C_DEC:: get_cmp_fn() const { return *this; } �������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp����������0000644�����������������00000017757�14763166027�0025460 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp * Contains an implementation class for a basic heap. */ #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_HPP #define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_HPP /* * Based on CLRS. */ #include <iterator> #include <ext/pb_ds/detail/cond_dealtor.hpp> #include <ext/pb_ds/detail/type_utils.hpp> #include <ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp> #include <ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp> #include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp> #ifdef PB_DS_LC_NS_HEAP_TRACE_ #include <iostream> #endif #include <debug/debug.h> namespace __gnu_pbds { namespace detail { #ifdef _GLIBCXX_DEBUG #define PB_DS_CLASS_T_DEC \ template<typename Value_Type, typename Cmp_Fn, typename Node_Metadata, \ typename _Alloc, bool Single_Link_Roots> #define PB_DS_CLASS_C_DEC \ left_child_next_sibling_heap<Value_Type, Cmp_Fn, Node_Metadata, \ _Alloc, Single_Link_Roots> #else #define PB_DS_CLASS_T_DEC \ template<typename Value_Type, typename Cmp_Fn, typename Node_Metadata, \ typename _Alloc> #define PB_DS_CLASS_C_DEC \ left_child_next_sibling_heap<Value_Type, Cmp_Fn, Node_Metadata, _Alloc> #endif /// Base class for a basic heap. template<typename Value_Type, typename Cmp_Fn, typename Node_Metadata, typename _Alloc #ifdef _GLIBCXX_DEBUG ,bool Single_Link_Roots> #else > #endif class left_child_next_sibling_heap : public Cmp_Fn { protected: typedef typename _Alloc::template rebind< left_child_next_sibling_heap_node_<Value_Type, Node_Metadata, _Alloc> >::other node_allocator; typedef typename node_allocator::value_type node; typedef typename node_allocator::pointer node_pointer; typedef typename node_allocator::const_pointer node_const_pointer; typedef Node_Metadata node_metadata; typedef std::pair< node_pointer, node_pointer> node_pointer_pair; private: typedef cond_dealtor< node, _Alloc> cond_dealtor_t; enum { simple_value = is_simple<Value_Type>::value }; typedef integral_constant<int, simple_value> no_throw_copies_t; typedef typename _Alloc::template rebind<Value_Type> __rebind_v; public: typedef typename _Alloc::size_type size_type; typedef typename _Alloc::difference_type difference_type; typedef Value_Type value_type; typedef typename __rebind_v::other::pointer pointer; typedef typename __rebind_v::other::const_pointer const_pointer; typedef typename __rebind_v::other::reference reference; typedef typename __rebind_v::other::const_reference const_reference; typedef left_child_next_sibling_heap_node_point_const_iterator_<node, _Alloc> point_const_iterator; typedef point_const_iterator point_iterator; typedef left_child_next_sibling_heap_const_iterator_<node, _Alloc> const_iterator; typedef const_iterator iterator; typedef Cmp_Fn cmp_fn; typedef _Alloc allocator_type; left_child_next_sibling_heap(); left_child_next_sibling_heap(const Cmp_Fn&); left_child_next_sibling_heap(const left_child_next_sibling_heap&); void swap(PB_DS_CLASS_C_DEC&); ~left_child_next_sibling_heap(); inline bool empty() const; inline size_type size() const; inline size_type max_size() const; Cmp_Fn& get_cmp_fn(); const Cmp_Fn& get_cmp_fn() const; inline iterator begin(); inline const_iterator begin() const; inline iterator end(); inline const_iterator end() const; void clear(); #ifdef PB_DS_LC_NS_HEAP_TRACE_ void trace() const; #endif protected: inline node_pointer get_new_node_for_insert(const_reference); inline static void make_child_of(node_pointer, node_pointer); void value_swap(left_child_next_sibling_heap&); inline static node_pointer parent(node_pointer); inline void swap_with_parent(node_pointer, node_pointer); void bubble_to_top(node_pointer); inline void actual_erase_node(node_pointer); void clear_imp(node_pointer); void to_linked_list(); template<typename Pred> node_pointer prune(Pred); #ifdef _GLIBCXX_DEBUG void assert_valid(const char*, int) const; void assert_node_consistent(node_const_pointer, bool, const char*, int) const; static size_type size_under_node(node_const_pointer); static size_type degree(node_const_pointer); #endif #ifdef PB_DS_LC_NS_HEAP_TRACE_ static void trace_node(node_const_pointer, size_type); #endif private: #ifdef _GLIBCXX_DEBUG void assert_iterators(const char*, int) const; void assert_size(const char*, int) const; static size_type size_from_node(node_const_pointer); #endif node_pointer recursive_copy_node(node_const_pointer); inline node_pointer get_new_node_for_insert(const_reference, false_type); inline node_pointer get_new_node_for_insert(const_reference, true_type); #ifdef PB_DS_LC_NS_HEAP_TRACE_ template<typename Metadata_> static void trace_node_metadata(node_const_pointer, type_to_type<Metadata_>); static void trace_node_metadata(node_const_pointer, type_to_type<null_type>); #endif static node_allocator s_node_allocator; static no_throw_copies_t s_no_throw_copies_ind; protected: node_pointer m_p_root; size_type m_size; }; #include <ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp> #include <ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp> #include <ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp> #include <ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp> #include <ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp> #include <ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp> #include <ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp> #include <ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp> #undef PB_DS_CLASS_C_DEC #undef PB_DS_CLASS_T_DEC } // namespace detail } // namespace __gnu_pbds #endif �����������������c++/4.8.2/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp��������������������������0000644�����������������00000007567�14763166027�0022272 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file left_child_next_sibling_heap_/erase_fn_imps.hpp * Contains an implementation class for left_child_next_sibling_heap_. */ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: clear() { clear_imp(m_p_root); _GLIBCXX_DEBUG_ASSERT(m_size == 0); m_p_root = 0; } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: actual_erase_node(node_pointer p_nd) { _GLIBCXX_DEBUG_ASSERT(m_size > 0); --m_size; p_nd->~node(); s_node_allocator.deallocate(p_nd, 1); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: clear_imp(node_pointer p_nd) { while (p_nd != 0) { clear_imp(p_nd->m_p_l_child); node_pointer p_next = p_nd->m_p_next_sibling; actual_erase_node(p_nd); p_nd = p_next; } } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: to_linked_list() { PB_DS_ASSERT_VALID((*this)) node_pointer p_cur = m_p_root; while (p_cur != 0) if (p_cur->m_p_l_child != 0) { node_pointer p_child_next = p_cur->m_p_l_child->m_p_next_sibling; p_cur->m_p_l_child->m_p_next_sibling = p_cur->m_p_next_sibling; p_cur->m_p_next_sibling = p_cur->m_p_l_child; p_cur->m_p_l_child = p_child_next; } else p_cur = p_cur->m_p_next_sibling; #ifdef _GLIBCXX_DEBUG node_const_pointer p_counter = m_p_root; size_type count = 0; while (p_counter != 0) { ++count; _GLIBCXX_DEBUG_ASSERT(p_counter->m_p_l_child == 0); p_counter = p_counter->m_p_next_sibling; } _GLIBCXX_DEBUG_ASSERT(count == m_size); #endif } PB_DS_CLASS_T_DEC template<typename Pred> typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: prune(Pred pred) { node_pointer p_cur = m_p_root; m_p_root = 0; node_pointer p_out = 0; while (p_cur != 0) { node_pointer p_next = p_cur->m_p_next_sibling; if (pred(p_cur->m_value)) { p_cur->m_p_next_sibling = p_out; if (p_out != 0) p_out->m_p_prev_or_parent = p_cur; p_out = p_cur; } else { p_cur->m_p_next_sibling = m_p_root; if (m_p_root != 0) m_p_root->m_p_prev_or_parent = p_cur; m_p_root = p_cur; } p_cur = p_next; } return p_out; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: bubble_to_top(node_pointer p_nd) { node_pointer p_parent = parent(p_nd); while (p_parent != 0) { swap_with_parent(p_nd, p_parent); p_parent = parent(p_nd); } } �����������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp�����������������������������������0000644�����������������00000006214�14763166027�0020371 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file left_child_next_sibling_heap_/node.hpp * Contains an implementation struct for this type of heap's node. */ #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP #define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP namespace __gnu_pbds { namespace detail { /// Node. template<typename _Value, typename _Metadata, typename _Alloc> struct left_child_next_sibling_heap_node_ { private: typedef left_child_next_sibling_heap_node_<_Value, _Metadata, _Alloc> this_type; public: typedef _Value value_type; typedef typename _Alloc::size_type size_type; typedef _Metadata metadata_type; typedef typename _Alloc::template rebind<this_type>::other::pointer node_pointer; value_type m_value; metadata_type m_metadata; node_pointer m_p_l_child; node_pointer m_p_next_sibling; node_pointer m_p_prev_or_parent; }; template<typename _Value, typename _Alloc> struct left_child_next_sibling_heap_node_<_Value, null_type, _Alloc> { private: typedef left_child_next_sibling_heap_node_<_Value, null_type, _Alloc> this_type; public: typedef _Value value_type; typedef typename _Alloc::size_type size_type; typedef typename _Alloc::template rebind<this_type>::other::pointer node_pointer; value_type m_value; node_pointer m_p_l_child; node_pointer m_p_next_sibling; node_pointer m_p_prev_or_parent; }; } // namespace detail } // namespace __gnu_pbds #endif // #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp��������������������������0000644�����������������00000005377�14763166027�0022266 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file left_child_next_sibling_heap_/trace_fn_imps.hpp * Contains an implementation class for left_child_next_sibling_heap_. */ #ifdef PB_DS_LC_NS_HEAP_TRACE_ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace() const { std::cerr << std::endl; trace_node(m_p_root, 0); std::cerr << std::endl; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace_node(node_const_pointer p_nd, size_type level) { while (p_nd != 0) { for (size_type i = 0; i < level; ++i) std::cerr << ' '; std::cerr << p_nd << " prev = " << p_nd->m_p_prev_or_parent << " next " << p_nd->m_p_next_sibling << " left = " << p_nd->m_p_l_child << " "; trace_node_metadata(p_nd, type_to_type<node_metadata>()); std::cerr << p_nd->m_value << std::endl; trace_node(p_nd->m_p_l_child, level + 1); p_nd = p_nd->m_p_next_sibling; } } PB_DS_CLASS_T_DEC template<typename Metadata_> void PB_DS_CLASS_C_DEC:: trace_node_metadata(node_const_pointer p_nd, type_to_type<Metadata_>) { std::cerr << "(" << p_nd->m_metadata << ") "; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace_node_metadata(node_const_pointer, type_to_type<null_type>) { } #endif // #ifdef PB_DS_LC_NS_HEAP_TRACE_ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp���������������������������0000644�����������������00000004072�14763166027�0022112 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file left_child_next_sibling_heap_/info_fn_imps.hpp * Contains an implementation class for left_child_next_sibling_heap_. */ PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: empty() const { return (m_size == 0); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: size() const { return (m_size); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: max_size() const { return (s_node_allocator.max_size()); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp��������������������������0000644�����������������00000007753�14763166027�0022256 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file left_child_next_sibling_heap_/debug_fn_imps.hpp * Contains an implementation class for left_child_next_sibling_heap_. */ #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_valid(const char* __file, int __line) const { PB_DS_DEBUG_VERIFY(m_p_root == 0 || m_p_root->m_p_prev_or_parent == 0); if (m_p_root != 0) assert_node_consistent(m_p_root, Single_Link_Roots, __file, __line); assert_size(__file, __line); assert_iterators(__file, __line); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_node_consistent(node_const_pointer p_nd, bool single_link, const char* __file, int __line) const { if (p_nd == 0) return; assert_node_consistent(p_nd->m_p_l_child, false, __file, __line); assert_node_consistent(p_nd->m_p_next_sibling, single_link, __file, __line); if (single_link) PB_DS_DEBUG_VERIFY(p_nd->m_p_prev_or_parent == 0); else if (p_nd->m_p_next_sibling != 0) PB_DS_DEBUG_VERIFY(p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd); if (p_nd->m_p_l_child == 0) return; node_const_pointer p_child = p_nd->m_p_l_child; while (p_child != 0) { node_const_pointer p_next_child = p_child->m_p_next_sibling; PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(p_nd->m_value, p_child->m_value)); p_child = p_next_child; } PB_DS_DEBUG_VERIFY(p_nd->m_p_l_child->m_p_prev_or_parent == p_nd); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_iterators(const char* __file, int __line) const { PB_DS_DEBUG_VERIFY(std::distance(begin(), end()) == size()); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_size(const char* __file, int __line) const { PB_DS_DEBUG_VERIFY(size_from_node(m_p_root) == m_size); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: size_under_node(node_const_pointer p_nd) { return 1 + size_from_node(p_nd->m_p_l_child); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: size_from_node(node_const_pointer p_nd) { size_type ret = 0; while (p_nd != 0) { ret += 1 + size_from_node(p_nd->m_p_l_child); p_nd = p_nd->m_p_next_sibling; } return ret; } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: degree(node_const_pointer p_nd) { size_type ret = 0; node_const_pointer p_child = p_nd->m_p_l_child; while (p_child != 0) { ++ret; p_child = p_child->m_p_next_sibling; } return ret; } #endif ���������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp��������������������������0000644�����������������00000005125�14763166027�0022242 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/debug_store_hash_fn_imps.hpp * Contains implementations of gp_ht_map_'s debug-mode functions. */ #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_entry_array_valid(const entry_array a_entries, true_type, const char* __file, int __line) const { size_type iterated_num_used_e = 0; for (size_type pos = 0; pos < m_num_e; ++pos) { const_entry_pointer p_e =& a_entries[pos]; switch(p_e->m_stat) { case empty_entry_status: case erased_entry_status: break; case valid_entry_status: { key_const_reference r_key = PB_DS_V2F(p_e->m_value); debug_base::check_key_exists(r_key, __file, __line); const comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key); PB_DS_DEBUG_VERIFY(p_e->m_hash == pos_hash_pair.second); ++iterated_num_used_e; break; } default: PB_DS_DEBUG_VERIFY(0); }; } PB_DS_DEBUG_VERIFY(iterated_num_used_e == m_num_used_e); } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp������������������������������������0000644�����������������00000003550�14763166027�0020241 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/insert_fn_imps.hpp * Contains implementations of gp_ht_map_'s insert related functions. */ #include <ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp> #include <ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp> ��������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp�������������������������0000644�����������������00000007765�14763166027�0022474 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/insert_store_hash_fn_imps.hpp * Contains implementations of gp_ht_map_'s find related functions, * when the hash value is stored. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::comp_hash PB_DS_CLASS_C_DEC:: find_ins_pos(key_const_reference r_key, true_type) { PB_DS_ASSERT_VALID((*this)) comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key); size_type i; /* The insertion position is initted to a non-legal value to indicate * that it has not been initted yet. */ size_type ins_pos = m_num_e; resize_base::notify_insert_search_start(); for (i = 0; i < m_num_e; ++i) { const size_type pos = ranged_probe_fn_base::operator()(r_key, pos_hash_pair.second, i); entry* const p_e = m_entries + pos; switch(p_e->m_stat) { case empty_entry_status: { resize_base::notify_insert_search_end(); PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) return ((ins_pos == m_num_e) ? std::make_pair(pos, pos_hash_pair.second) : std::make_pair(ins_pos, pos_hash_pair.second)); } break; case erased_entry_status: if (ins_pos == m_num_e) ins_pos = pos; break; case valid_entry_status: if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash, r_key, pos_hash_pair.second)) { resize_base::notify_insert_search_end(); PB_DS_CHECK_KEY_EXISTS(r_key) return std::make_pair(pos, pos_hash_pair.second); } break; default: _GLIBCXX_DEBUG_ASSERT(0); }; resize_base::notify_insert_search_collision(); } resize_base::notify_insert_search_end(); if (ins_pos == m_num_e) __throw_insert_error(); return std::make_pair(ins_pos, pos_hash_pair.second); } PB_DS_CLASS_T_DEC inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool> PB_DS_CLASS_C_DEC:: insert_imp(const_reference r_val, true_type) { key_const_reference r_key = PB_DS_V2F(r_val); comp_hash pos_hash_pair = find_ins_pos(r_key, traits_base::m_store_extra_indicator); _GLIBCXX_DEBUG_ASSERT(pos_hash_pair.first < m_num_e); entry_pointer p_e =& m_entries[pos_hash_pair.first]; if (p_e->m_stat == valid_entry_status) { PB_DS_CHECK_KEY_EXISTS(r_key) return std::make_pair(&p_e->m_value, false); } PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) return std::make_pair(insert_new_imp(r_val, pos_hash_pair), true); } �����������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp���������0000644�����������������00000004335�14763166027�0026021 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp * Contains implementations of gp_ht_map_'s constructors, destructor, * and related functions. */ PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: constructor_insert_new_imp(mapped_const_reference r_val, size_type pos, true_type) { _GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status); entry* const p_e = m_entries + pos; new (&p_e->m_value) mapped_value_type(r_val); p_e->m_hash = ranged_probe_fn_base::operator()(PB_DS_V2F(r_val)).second; p_e->m_stat = valid_entry_status; _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(p_e->m_value.first);) } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp��������������������0000644�����������������00000014716�14763166027�0023606 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/constructor_destructor_fn_imps.hpp * Contains implementations of gp_ht_map_'s constructors, destructor, * and related functions. */ PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::entry_allocator PB_DS_CLASS_C_DEC::s_entry_allocator; PB_DS_CLASS_T_DEC template<typename It> void PB_DS_CLASS_C_DEC:: copy_from_range(It first_it, It last_it) { while (first_it != last_it) insert(*(first_it++)); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_GP_HASH_NAME() : ranged_probe_fn_base(resize_base::get_nearest_larger_size(1)), m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0), m_entries(s_entry_allocator.allocate(m_num_e)) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn) : ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn), m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0), m_entries(s_entry_allocator.allocate(m_num_e)) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn) : hash_eq_fn_base(r_eq_fn), ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn), m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0), m_entries(s_entry_allocator.allocate(m_num_e)) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, const Comb_Probe_Fn& r_comb_hash_fn) : hash_eq_fn_base(r_eq_fn), ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn, r_comb_hash_fn), m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0), m_entries(s_entry_allocator.allocate(m_num_e)) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, const Comb_Probe_Fn& comb_hash_fn, const Probe_Fn& prober) : hash_eq_fn_base(r_eq_fn), ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn, comb_hash_fn, prober), m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0), m_entries(s_entry_allocator.allocate(m_num_e)) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, const Comb_Probe_Fn& comb_hash_fn, const Probe_Fn& prober, const Resize_Policy& r_resize_policy) : hash_eq_fn_base(r_eq_fn), resize_base(r_resize_policy), ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn, comb_hash_fn, prober), m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0), m_entries(s_entry_allocator.allocate(m_num_e)) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_GP_HASH_NAME(const PB_DS_CLASS_C_DEC& other) : #ifdef _GLIBCXX_DEBUG debug_base(other), #endif hash_eq_fn_base(other), resize_base(other), ranged_probe_fn_base(other), m_num_e(other.m_num_e), m_num_used_e(other.m_num_used_e), m_entries(s_entry_allocator.allocate(m_num_e)) { for (size_type i = 0; i < m_num_e; ++i) m_entries[i].m_stat = (entry_status)empty_entry_status; __try { for (size_type i = 0; i < m_num_e; ++i) { m_entries[i].m_stat = other.m_entries[i].m_stat; if (m_entries[i].m_stat == valid_entry_status) new (m_entries + i) entry(other.m_entries[i]); } } __catch(...) { deallocate_all(); __throw_exception_again; } PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ~PB_DS_GP_HASH_NAME() { deallocate_all(); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) std::swap(m_num_e, other.m_num_e); std::swap(m_num_used_e, other.m_num_used_e); std::swap(m_entries, other.m_entries); ranged_probe_fn_base::swap(other); hash_eq_fn_base::swap(other); resize_base::swap(other); _GLIBCXX_DEBUG_ONLY(debug_base::swap(other)); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: deallocate_all() { clear(); erase_all_valid_entries(m_entries, m_num_e); s_entry_allocator.deallocate(m_entries, m_num_e); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: erase_all_valid_entries(entry_array a_entries_resized, size_type len) { for (size_type pos = 0; pos < len; ++pos) { entry_pointer p_e = &a_entries_resized[pos]; if (p_e->m_stat == valid_entry_status) p_e->m_value.~value_type(); } } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: initialize() { Resize_Policy::notify_resized(m_num_e); Resize_Policy::notify_cleared(); ranged_probe_fn_base::notify_resized(m_num_e); for (size_type i = 0; i < m_num_e; ++i) m_entries[i].m_stat = empty_entry_status; } ��������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp����������������������������������0000644�����������������00000005073�14763166027�0020570 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/iterator_fn_imps.hpp * Contains implementations of gp_ht_map_'s iterators related functions, e.g., * begin(). */ PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC::s_end_it; PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC::s_const_end_it; PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: begin() { pointer_ p_value; size_type pos; get_start_it_state(p_value, pos); return iterator(p_value, pos, this); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: end() { return s_end_it; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: begin() const { const_pointer_ p_value; size_type pos; get_start_it_state(p_value, pos); return const_iterator(p_value, pos, this); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: end() const { return s_const_end_it; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp���������������������������0000644�����������������00000003364�14763166027�0022077 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/find_store_hash_fn_imps.hpp * Contains implementations of gp_ht_map_'s insert related functions, * when the hash value is stored. */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp����������������������0000644�����������������00000005072�14763166027�0023152 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp * Contains implementations of gp_ht_map_'s resize related functions, when the * hash value is not stored. */ PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: resize_imp_reassign(entry_pointer p_e, entry_array a_entries_resized, false_type) { key_const_reference r_key = PB_DS_V2F(p_e->m_value); size_type hash = ranged_probe_fn_base::operator()(r_key); size_type i; for (i = 0; i < m_num_e; ++i) { const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i); entry_pointer p_new_e = a_entries_resized + pos; switch(p_new_e->m_stat) { case empty_entry_status: new (&p_new_e->m_value) value_type(p_e->m_value); p_new_e->m_stat = valid_entry_status; return; case erased_entry_status: _GLIBCXX_DEBUG_ASSERT(0); break; case valid_entry_status: break; default: _GLIBCXX_DEBUG_ASSERT(0); }; } __throw_insert_error(); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp����������������������������������������0000644�����������������00000047652�14763166027�0017332 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/gp_ht_map_.hpp * Contains an implementation class for general probing hash. */ #include <ext/pb_ds/tag_and_trait.hpp> #include <ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp> #include <ext/pb_ds/detail/types_traits.hpp> #include <ext/pb_ds/exception.hpp> #include <ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp> #include <utility> #ifdef PB_DS_HT_MAP_TRACE_ #include <iostream> #endif #ifdef _GLIBCXX_DEBUG #include <ext/pb_ds/detail/debug_map_base.hpp> #endif #include <debug/debug.h> namespace __gnu_pbds { namespace detail { #ifdef PB_DS_DATA_TRUE_INDICATOR #define PB_DS_GP_HASH_NAME gp_ht_map #endif #ifdef PB_DS_DATA_FALSE_INDICATOR #define PB_DS_GP_HASH_NAME gp_ht_set #endif #define PB_DS_CLASS_T_DEC \ template<typename Key, typename Mapped, typename Hash_Fn, typename Eq_Fn, \ typename _Alloc, bool Store_Hash, typename Comb_Probe_Fn, \ typename Probe_Fn, typename Resize_Policy> #define PB_DS_CLASS_C_DEC \ PB_DS_GP_HASH_NAME<Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, \ Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy> #define PB_DS_HASH_EQ_FN_C_DEC \ hash_eq_fn<Key, Eq_Fn, _Alloc, Store_Hash> #define PB_DS_RANGED_PROBE_FN_C_DEC \ ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, Store_Hash> #define PB_DS_GP_HASH_TRAITS_BASE \ types_traits<Key, Mapped, _Alloc, Store_Hash> #ifdef _GLIBCXX_DEBUG #define PB_DS_DEBUG_MAP_BASE_C_DEC \ debug_map_base<Key, Eq_Fn, \ typename _Alloc::template rebind<Key>::other::const_reference> #endif /** * A general-probing hash-based container. * * * @ingroup hash-detail * * @tparam Key Key type. * * @tparam Mapped Map type. * * @tparam Hash_Fn Hashing functor. * Default is __gnu_cxx::hash. * * @tparam Eq_Fn Equal functor. * Default std::equal_to<Key> * * @tparam _Alloc Allocator type. * * @tparam Store_Hash If key type stores extra metadata. * Defaults to false. * * @tparam Comb_Probe_Fn Combining probe functor. * If Hash_Fn is not null_type, then this * is the ranged-probe functor; otherwise, * this is the range-hashing functor. * XXX See Design::Hash-Based Containers::Hash Policies. * Default direct_mask_range_hashing. * * @tparam Probe_Fn Probe functor. * Defaults to linear_probe_fn, * also quadratic_probe_fn. * * @tparam Resize_Policy Resizes hash. * Defaults to hash_standard_resize_policy, * using hash_exponential_size_policy and * hash_load_check_resize_trigger. * * * Bases are: detail::hash_eq_fn, Resize_Policy, detail::ranged_probe_fn, * detail::types_traits. (Optional: detail::debug_map_base.) */ template<typename Key, typename Mapped, typename Hash_Fn, typename Eq_Fn, typename _Alloc, bool Store_Hash, typename Comb_Probe_Fn, typename Probe_Fn, typename Resize_Policy> class PB_DS_GP_HASH_NAME : #ifdef _GLIBCXX_DEBUG protected PB_DS_DEBUG_MAP_BASE_C_DEC, #endif public PB_DS_HASH_EQ_FN_C_DEC, public Resize_Policy, public PB_DS_RANGED_PROBE_FN_C_DEC, public PB_DS_GP_HASH_TRAITS_BASE { private: typedef PB_DS_GP_HASH_TRAITS_BASE traits_base; typedef typename traits_base::value_type value_type_; typedef typename traits_base::pointer pointer_; typedef typename traits_base::const_pointer const_pointer_; typedef typename traits_base::reference reference_; typedef typename traits_base::const_reference const_reference_; typedef typename traits_base::comp_hash comp_hash; enum entry_status { empty_entry_status, valid_entry_status, erased_entry_status } __attribute__ ((packed)); struct entry : public traits_base::stored_data_type { entry_status m_stat; }; typedef typename _Alloc::template rebind<entry>::other entry_allocator; typedef typename entry_allocator::pointer entry_pointer; typedef typename entry_allocator::const_pointer const_entry_pointer; typedef typename entry_allocator::reference entry_reference; typedef typename entry_allocator::const_reference const_entry_reference; typedef typename entry_allocator::pointer entry_array; typedef PB_DS_RANGED_PROBE_FN_C_DEC ranged_probe_fn_base; #ifdef _GLIBCXX_DEBUG typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base; #endif typedef PB_DS_HASH_EQ_FN_C_DEC hash_eq_fn_base; typedef Resize_Policy resize_base; #define PB_DS_GEN_POS typename _Alloc::size_type #include <ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp> #include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp> #include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp> #include <ext/pb_ds/detail/unordered_iterator/iterator.hpp> #undef PB_DS_GEN_POS public: typedef _Alloc allocator_type; typedef typename _Alloc::size_type size_type; typedef typename _Alloc::difference_type difference_type; typedef Hash_Fn hash_fn; typedef Eq_Fn eq_fn; typedef Probe_Fn probe_fn; typedef Comb_Probe_Fn comb_probe_fn; typedef Resize_Policy resize_policy; /// Value stores hash, true or false. enum { store_hash = Store_Hash }; typedef typename traits_base::key_type key_type; typedef typename traits_base::key_pointer key_pointer; typedef typename traits_base::key_const_pointer key_const_pointer; typedef typename traits_base::key_reference key_reference; typedef typename traits_base::key_const_reference key_const_reference; typedef typename traits_base::mapped_type mapped_type; typedef typename traits_base::mapped_pointer mapped_pointer; typedef typename traits_base::mapped_const_pointer mapped_const_pointer; typedef typename traits_base::mapped_reference mapped_reference; typedef typename traits_base::mapped_const_reference mapped_const_reference; typedef typename traits_base::value_type value_type; typedef typename traits_base::pointer pointer; typedef typename traits_base::const_pointer const_pointer; typedef typename traits_base::reference reference; typedef typename traits_base::const_reference const_reference; #ifdef PB_DS_DATA_TRUE_INDICATOR typedef point_iterator_ point_iterator; #endif #ifdef PB_DS_DATA_FALSE_INDICATOR typedef point_const_iterator_ point_iterator; #endif typedef point_const_iterator_ point_const_iterator; #ifdef PB_DS_DATA_TRUE_INDICATOR typedef iterator_ iterator; #endif #ifdef PB_DS_DATA_FALSE_INDICATOR typedef const_iterator_ iterator; #endif typedef const_iterator_ const_iterator; PB_DS_GP_HASH_NAME(); PB_DS_GP_HASH_NAME(const PB_DS_CLASS_C_DEC&); PB_DS_GP_HASH_NAME(const Hash_Fn&); PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&); PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&); PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&, const Probe_Fn&); PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&, const Probe_Fn&, const Resize_Policy&); template<typename It> void copy_from_range(It, It); virtual ~PB_DS_GP_HASH_NAME(); void swap(PB_DS_CLASS_C_DEC&); inline size_type size() const; inline size_type max_size() const; /// True if size() == 0. inline bool empty() const; /// Return current hash_fn. Hash_Fn& get_hash_fn(); /// Return current const hash_fn. const Hash_Fn& get_hash_fn() const; /// Return current eq_fn. Eq_Fn& get_eq_fn(); /// Return current const eq_fn. const Eq_Fn& get_eq_fn() const; /// Return current probe_fn. Probe_Fn& get_probe_fn(); /// Return current const probe_fn. const Probe_Fn& get_probe_fn() const; /// Return current comb_probe_fn. Comb_Probe_Fn& get_comb_probe_fn(); /// Return current const comb_probe_fn. const Comb_Probe_Fn& get_comb_probe_fn() const; /// Return current resize_policy. Resize_Policy& get_resize_policy(); /// Return current const resize_policy. const Resize_Policy& get_resize_policy() const; inline std::pair<point_iterator, bool> insert(const_reference r_val) { _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid(__FILE__, __LINE__);) return insert_imp(r_val, traits_base::m_store_extra_indicator); } inline mapped_reference operator[](key_const_reference r_key) { #ifdef PB_DS_DATA_TRUE_INDICATOR return subscript_imp(r_key, traits_base::m_store_extra_indicator); #else insert(r_key); return traits_base::s_null_type; #endif } inline point_iterator find(key_const_reference); inline point_const_iterator find(key_const_reference) const; inline point_iterator find_end(); inline point_const_iterator find_end() const; inline bool erase(key_const_reference); template<typename Pred> inline size_type erase_if(Pred); void clear(); inline iterator begin(); inline const_iterator begin() const; inline iterator end(); inline const_iterator end() const; #ifdef _GLIBCXX_DEBUG void assert_valid(const char*, int) const; #endif #ifdef PB_DS_HT_MAP_TRACE_ void trace() const; #endif private: #ifdef PB_DS_DATA_TRUE_INDICATOR friend class iterator_; #endif friend class const_iterator_; void deallocate_all(); void initialize(); void erase_all_valid_entries(entry_array, size_type); inline bool do_resize_if_needed(); inline void do_resize_if_needed_no_throw(); void resize_imp(size_type); virtual void do_resize(size_type); void resize_imp(entry_array, size_type); inline void resize_imp_reassign(entry_pointer, entry_array, false_type); inline void resize_imp_reassign(entry_pointer, entry_array, true_type); inline size_type find_ins_pos(key_const_reference, false_type); inline comp_hash find_ins_pos(key_const_reference, true_type); inline std::pair<point_iterator, bool> insert_imp(const_reference, false_type); inline std::pair<point_iterator, bool> insert_imp(const_reference, true_type); inline pointer insert_new_imp(const_reference r_val, size_type pos) { _GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status); if (do_resize_if_needed()) pos = find_ins_pos(PB_DS_V2F(r_val), traits_base::m_store_extra_indicator); _GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status); entry* const p_e = m_entries + pos; new (&p_e->m_value) value_type(r_val); p_e->m_stat = valid_entry_status; resize_base::notify_inserted(++m_num_used_e); _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(p_e->m_value));) _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);) return &p_e->m_value; } inline pointer insert_new_imp(const_reference r_val, comp_hash& r_pos_hash_pair) { _GLIBCXX_DEBUG_ASSERT(m_entries[r_pos_hash_pair.first].m_stat != valid_entry_status); if (do_resize_if_needed()) r_pos_hash_pair = find_ins_pos(PB_DS_V2F(r_val), traits_base::m_store_extra_indicator); _GLIBCXX_DEBUG_ASSERT(m_entries[r_pos_hash_pair.first].m_stat != valid_entry_status); entry* const p_e = m_entries + r_pos_hash_pair.first; new (&p_e->m_value) value_type(r_val); p_e->m_hash = r_pos_hash_pair.second; p_e->m_stat = valid_entry_status; resize_base::notify_inserted(++m_num_used_e); _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(p_e->m_value));) _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);) return &p_e->m_value; } #ifdef PB_DS_DATA_TRUE_INDICATOR inline mapped_reference subscript_imp(key_const_reference key, false_type) { _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);) const size_type pos = find_ins_pos(key, traits_base::m_store_extra_indicator); entry_pointer p_e = &m_entries[pos]; if (p_e->m_stat != valid_entry_status) return insert_new_imp(value_type(key, mapped_type()), pos)->second; PB_DS_CHECK_KEY_EXISTS(key) return p_e->m_value.second; } inline mapped_reference subscript_imp(key_const_reference key, true_type) { _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);) comp_hash pos_hash_pair = find_ins_pos(key, traits_base::m_store_extra_indicator); if (m_entries[pos_hash_pair.first].m_stat != valid_entry_status) return insert_new_imp(value_type(key, mapped_type()), pos_hash_pair)->second; PB_DS_CHECK_KEY_EXISTS(key) return (m_entries + pos_hash_pair.first)->m_value.second; } #endif inline pointer find_key_pointer(key_const_reference key, false_type) { const size_type hash = ranged_probe_fn_base::operator()(key); resize_base::notify_find_search_start(); // Loop until entry is found or until all possible entries accessed. for (size_type i = 0; i < m_num_e; ++i) { const size_type pos = ranged_probe_fn_base::operator()(key, hash, i); entry* const p_e = m_entries + pos; switch (p_e->m_stat) { case empty_entry_status: { resize_base::notify_find_search_end(); PB_DS_CHECK_KEY_DOES_NOT_EXIST(key) return 0; } break; case valid_entry_status: if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), key)) { resize_base::notify_find_search_end(); PB_DS_CHECK_KEY_EXISTS(key) return pointer(&p_e->m_value); } break; case erased_entry_status: break; default: _GLIBCXX_DEBUG_ASSERT(0); }; resize_base::notify_find_search_collision(); } PB_DS_CHECK_KEY_DOES_NOT_EXIST(key) resize_base::notify_find_search_end(); return 0; } inline pointer find_key_pointer(key_const_reference key, true_type) { comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(key); resize_base::notify_find_search_start(); // Loop until entry is found or until all possible entries accessed. for (size_type i = 0; i < m_num_e; ++i) { const size_type pos = ranged_probe_fn_base::operator()(key, pos_hash_pair.second, i); entry* const p_e = m_entries + pos; switch(p_e->m_stat) { case empty_entry_status: { resize_base::notify_find_search_end(); PB_DS_CHECK_KEY_DOES_NOT_EXIST(key) return 0; } break; case valid_entry_status: if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash, key, pos_hash_pair.second)) { resize_base::notify_find_search_end(); PB_DS_CHECK_KEY_EXISTS(key) return pointer(&p_e->m_value); } break; case erased_entry_status: break; default: _GLIBCXX_DEBUG_ASSERT(0); }; resize_base::notify_find_search_collision(); } PB_DS_CHECK_KEY_DOES_NOT_EXIST(key) resize_base::notify_find_search_end(); return 0; } inline bool erase_imp(key_const_reference, true_type); inline bool erase_imp(key_const_reference, false_type); inline void erase_entry(entry_pointer); #ifdef PB_DS_DATA_TRUE_INDICATOR void inc_it_state(pointer& r_p_value, size_type& r_pos) const { inc_it_state((mapped_const_pointer& )r_p_value, r_pos); } #endif void inc_it_state(const_pointer& r_p_value, size_type& r_pos) const { _GLIBCXX_DEBUG_ASSERT(r_p_value != 0); for (++r_pos; r_pos < m_num_e; ++r_pos) { const_entry_pointer p_e =& m_entries[r_pos]; if (p_e->m_stat == valid_entry_status) { r_p_value =& p_e->m_value; return; } } r_p_value = 0; } void get_start_it_state(const_pointer& r_p_value, size_type& r_pos) const { for (r_pos = 0; r_pos < m_num_e; ++r_pos) { const_entry_pointer p_e = &m_entries[r_pos]; if (p_e->m_stat == valid_entry_status) { r_p_value = &p_e->m_value; return; } } r_p_value = 0; } void get_start_it_state(pointer& r_p_value, size_type& r_pos) { for (r_pos = 0; r_pos < m_num_e; ++r_pos) { entry_pointer p_e = &m_entries[r_pos]; if (p_e->m_stat == valid_entry_status) { r_p_value = &p_e->m_value; return; } } r_p_value = 0; } #ifdef _GLIBCXX_DEBUG void assert_entry_array_valid(const entry_array, false_type, const char*, int) const; void assert_entry_array_valid(const entry_array, true_type, const char*, int) const; #endif static entry_allocator s_entry_allocator; static iterator s_end_it; static const_iterator s_const_end_it; size_type m_num_e; size_type m_num_used_e; entry_pointer m_entries; enum { store_hash_ok = !Store_Hash || !is_same<Hash_Fn, __gnu_pbds::null_type>::value }; PB_DS_STATIC_ASSERT(sth, store_hash_ok); }; #include <ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp> #include <ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp> #include <ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp> #include <ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp> #include <ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp> #include <ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp> #include <ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp> #include <ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp> #include <ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp> #include <ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp> #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #undef PB_DS_HASH_EQ_FN_C_DEC #undef PB_DS_RANGED_PROBE_FN_C_DEC #undef PB_DS_GP_HASH_TRAITS_BASE #undef PB_DS_DEBUG_MAP_BASE_C_DEC #undef PB_DS_GP_HASH_NAME } // namespace detail } // namespace __gnu_pbds ��������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp�����������������������0000644�����������������00000004711�14763166027�0022736 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp * Contains implementations of gp_ht_map_'s debug-mode functions. */ #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_entry_array_valid(const entry_array a_entries, false_type, const char* __file, int __line) const { size_type iterated_num_used_e = 0; for (size_type pos = 0; pos < m_num_e; ++pos) { const_entry_pointer p_e = &a_entries[pos]; switch(p_e->m_stat) { case empty_entry_status: case erased_entry_status: break; case valid_entry_status: { key_const_reference r_key = PB_DS_V2F(p_e->m_value); debug_base::check_key_exists(r_key, __file, __line); ++iterated_num_used_e; break; } default: PB_DS_DEBUG_VERIFY(0); }; } PB_DS_DEBUG_VERIFY(iterated_num_used_e == m_num_used_e); } #endif �������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp��������������������������������������0000644�����������������00000004656�14763166027�0017665 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/find_fn_imps.hpp * Contains implementations of gp_ht_map_'s find related functions. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_iterator PB_DS_CLASS_C_DEC:: find(key_const_reference r_key) { PB_DS_ASSERT_VALID((*this)) return find_key_pointer(r_key, traits_base::m_store_extra_indicator); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_const_iterator PB_DS_CLASS_C_DEC:: find(key_const_reference r_key) const { PB_DS_ASSERT_VALID((*this)) return const_cast<PB_DS_CLASS_C_DEC&>(*this).find_key_pointer(r_key, traits_base::m_store_extra_indicator); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_iterator PB_DS_CLASS_C_DEC:: find_end() { return 0; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_const_iterator PB_DS_CLASS_C_DEC:: find_end() const { return 0; } ����������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp������0000644�����������������00000004232�14763166027�0026511 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp * Contains implementations of gp_ht_map_'s constructors, destructor, * and related functions. */ PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: constructor_insert_new_imp(mapped_const_reference r_val, size_type pos, false_type) { _GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status)k; entry* const p_e = m_entries + pos; new (&p_e->m_value) mapped_value_type(r_val); p_e->m_stat = valid_entry_status; _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(p_e->m_value.first);) } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp����������������������0000644�����������������00000007301�14763166027�0023152 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp * Contains implementations of gp_ht_map_'s insert related functions, * when the hash value is not stored. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: find_ins_pos(key_const_reference r_key, false_type) { size_type hash = ranged_probe_fn_base::operator()(r_key); size_type i; /* The insertion position is initted to a non-legal value to indicate * that it has not been initted yet. */ size_type ins_pos = m_num_e; resize_base::notify_insert_search_start(); for (i = 0; i < m_num_e; ++i) { const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i); _GLIBCXX_DEBUG_ASSERT(pos < m_num_e); entry* const p_e = m_entries + pos; switch(p_e->m_stat) { case empty_entry_status: { resize_base::notify_insert_search_end(); PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) return (ins_pos == m_num_e) ? pos : ins_pos; } break; case erased_entry_status: if (ins_pos == m_num_e) ins_pos = pos; break; case valid_entry_status: if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key)) { resize_base::notify_insert_search_end(); PB_DS_CHECK_KEY_EXISTS(r_key) return pos; } break; default: _GLIBCXX_DEBUG_ASSERT(0); }; resize_base::notify_insert_search_collision(); } resize_base::notify_insert_search_end(); if (ins_pos == m_num_e) __throw_insert_error(); return ins_pos; } PB_DS_CLASS_T_DEC inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool> PB_DS_CLASS_C_DEC:: insert_imp(const_reference r_val, false_type) { key_const_reference r_key = PB_DS_V2F(r_val); const size_type pos = find_ins_pos(r_key, traits_base::m_store_extra_indicator); if (m_entries[pos].m_stat == valid_entry_status) { PB_DS_CHECK_KEY_EXISTS(r_key) return std::make_pair(&(m_entries + pos)->m_value, false); } PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) return std::make_pair(insert_new_imp(r_val, pos), true); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp�����������������������������0000644�����������������00000005144�14763166027�0021556 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/policy_access_fn_imps.hpp * Contains implementations of gp_ht_map_'s policy agpess * functions. */ PB_DS_CLASS_T_DEC Hash_Fn& PB_DS_CLASS_C_DEC:: get_hash_fn() { return *this; } PB_DS_CLASS_T_DEC const Hash_Fn& PB_DS_CLASS_C_DEC:: get_hash_fn() const { return *this; } PB_DS_CLASS_T_DEC Eq_Fn& PB_DS_CLASS_C_DEC:: get_eq_fn() { return *this; } PB_DS_CLASS_T_DEC const Eq_Fn& PB_DS_CLASS_C_DEC:: get_eq_fn() const { return *this; } PB_DS_CLASS_T_DEC Probe_Fn& PB_DS_CLASS_C_DEC:: get_probe_fn() { return *this; } PB_DS_CLASS_T_DEC const Probe_Fn& PB_DS_CLASS_C_DEC:: get_probe_fn() const { return *this; } PB_DS_CLASS_T_DEC Comb_Probe_Fn& PB_DS_CLASS_C_DEC:: get_comb_probe_fn() { return *this; } PB_DS_CLASS_T_DEC const Comb_Probe_Fn& PB_DS_CLASS_C_DEC:: get_comb_probe_fn() const { return *this; } PB_DS_CLASS_T_DEC Resize_Policy& PB_DS_CLASS_C_DEC:: get_resize_policy() { return *this; } PB_DS_CLASS_T_DEC const Resize_Policy& PB_DS_CLASS_C_DEC:: get_resize_policy() const { return *this; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp�������������������������0000644�����������������00000005133�14763166027�0022454 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/resize_store_hash_fn_imps.hpp * Contains implementations of gp_ht_map_'s resize related functions, when the * hash value is stored. */ PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: resize_imp_reassign(entry_pointer p_e, entry_array a_entries_resized, true_type) { key_const_reference r_key = PB_DS_V2F(p_e->m_value); size_type hash = ranged_probe_fn_base::operator()(r_key, p_e->m_hash); size_type i; for (i = 0; i < m_num_e; ++i) { const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i); entry_pointer p_new_e = a_entries_resized + pos; switch(p_new_e->m_stat) { case empty_entry_status: new (&p_new_e->m_value) value_type(p_e->m_value); p_new_e->m_hash = hash; p_new_e->m_stat = valid_entry_status; return; case erased_entry_status: _GLIBCXX_DEBUG_ASSERT(0); break; case valid_entry_status: break; default: _GLIBCXX_DEBUG_ASSERT(0); }; } __throw_insert_error(); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp������������������������������������0000644�����������������00000010075�14763166027�0020236 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/resize_fn_imps.hpp * Contains implementations of gp_ht_map_'s resize related functions. */ PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: do_resize_if_needed() { if (!resize_base::is_resize_needed()) return false; resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e)); return true; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: do_resize(size_type n) { resize_imp(resize_base::get_nearest_larger_size(n)); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: do_resize_if_needed_no_throw() { if (!resize_base::is_resize_needed()) return; __try { resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e)); } __catch(...) { } PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: resize_imp(size_type new_size) { #ifdef PB_DS_REGRESSION typename _Alloc::group_adjustor adjust(m_num_e); #endif if (new_size == m_num_e) return; PB_DS_ASSERT_VALID((*this)) const size_type old_size = m_num_e; entry_array a_entries_resized = 0; // Following line might throw an exception. a_entries_resized = s_entry_allocator.allocate(new_size); ranged_probe_fn_base::notify_resized(new_size); m_num_e = new_size; for (size_type i = 0; i < m_num_e; ++i) a_entries_resized[i].m_stat = empty_entry_status; __try { resize_imp(a_entries_resized, old_size); } __catch(...) { erase_all_valid_entries(a_entries_resized, new_size); m_num_e = old_size; s_entry_allocator.deallocate(a_entries_resized, new_size); ranged_probe_fn_base::notify_resized(old_size); __throw_exception_again; } // At this point no exceptions can be thrown. _GLIBCXX_DEBUG_ONLY(assert_entry_array_valid(a_entries_resized, traits_base::m_store_extra_indicator, __FILE__, __LINE__);) Resize_Policy::notify_resized(new_size); erase_all_valid_entries(m_entries, old_size); s_entry_allocator.deallocate(m_entries, old_size); m_entries = a_entries_resized; PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: resize_imp(entry_array a_entries_resized, size_type old_size) { for (size_type pos = 0; pos < old_size; ++pos) if (m_entries[pos].m_stat == valid_entry_status) resize_imp_reassign(m_entries + pos, a_entries_resized, traits_base::m_store_extra_indicator); } #include <ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp> #include <ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp�������������������������������������0000644�����������������00000006204�14763166027�0020033 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/erase_fn_imps.hpp * Contains implementations of gp_ht_map_'s erase related functions. */ PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: erase_entry(entry_pointer p_e) { _GLIBCXX_DEBUG_ASSERT(p_e->m_stat = valid_entry_status); _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_e->m_value));) p_e->m_value.~value_type(); p_e->m_stat = erased_entry_status; _GLIBCXX_DEBUG_ASSERT(m_num_used_e > 0); resize_base::notify_erased(--m_num_used_e); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: clear() { for (size_type pos = 0; pos < m_num_e; ++pos) { entry_pointer p_e = &m_entries[pos]; if (p_e->m_stat == valid_entry_status) erase_entry(p_e); } do_resize_if_needed_no_throw(); resize_base::notify_cleared(); } PB_DS_CLASS_T_DEC template<typename Pred> inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: erase_if(Pred pred) { PB_DS_ASSERT_VALID((*this)) size_type num_ersd = 0; for (size_type pos = 0; pos < m_num_e; ++pos) { entry_pointer p_e = &m_entries[pos]; if (p_e->m_stat == valid_entry_status) if (pred(p_e->m_value)) { ++num_ersd; erase_entry(p_e); } } do_resize_if_needed_no_throw(); PB_DS_ASSERT_VALID((*this)) return num_ersd; } PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: erase(key_const_reference r_key) { return erase_imp(r_key, traits_base::m_store_extra_indicator); } #include <ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp> #include <ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp������������������������0000644�����������������00000003604�14763166027�0022570 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/find_no_store_hash_fn_imps.hpp * Contains implementations of gp_ht_map_'s find related functions, * when the hash value is not stored. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::pointer PB_DS_CLASS_C_DEC:: find_key_pointer(key_const_reference r_key, false_type) ����������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp��������������������������0000644�����������������00000005547�14763166027�0022263 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/erase_store_hash_fn_imps.hpp * Contains implementations of gp_ht_map_'s erase related functions, * when the hash value is stored. */ PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: erase_imp(key_const_reference r_key, true_type) { const comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key); size_type i; resize_base::notify_erase_search_start(); for (i = 0; i < m_num_e; ++i) { const size_type pos = ranged_probe_fn_base::operator()(r_key, pos_hash_pair.second, i); entry* const p_e = m_entries + pos; switch(p_e->m_stat) { case empty_entry_status: { resize_base::notify_erase_search_end(); PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) return false; } break; case valid_entry_status: if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash, r_key, pos_hash_pair.second)) { resize_base::notify_erase_search_end(); erase_entry(p_e); do_resize_if_needed_no_throw(); return true; } break; case erased_entry_status: break; default: _GLIBCXX_DEBUG_ASSERT(0); }; resize_base::notify_erase_search_collision(); } resize_base::notify_erase_search_end(); return false; } ���������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp�������������������������������������0000644�����������������00000004570�14763166027�0020036 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/trace_fn_imps.hpp * Contains implementations of gp_ht_map_'s trace-mode functions. */ #ifdef PB_DS_HT_MAP_TRACE_ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace() const { std::cerr << static_cast<unsigned long>(m_num_e) << " " << static_cast<unsigned long>(m_num_used_e) << std::endl; for (size_type i = 0; i < m_num_e; ++i) { std::cerr << static_cast<unsigned long>(i) << " "; switch(m_entries[i].m_stat) { case empty_entry_status: std::cerr << "<empty>"; break; case erased_entry_status: std::cerr << "<erased>"; break; case valid_entry_status: std::cerr << PB_DS_V2F(m_entries[i].m_value); break; default: _GLIBCXX_DEBUG_ASSERT(0); }; std::cerr << std::endl; } } #endif // #ifdef PB_DS_HT_MAP_TRACE_ ����������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp��������������������������������������0000644�����������������00000004074�14763166027�0017672 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/info_fn_imps.hpp * Contains implementations of gp_ht_map_'s entire container info related * functions. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: size() const { return m_num_used_e; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: max_size() const { return s_entry_allocator.max_size(); } PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: empty() const { return (size() == 0); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp�����������������������0000644�����������������00000005505�14763166027�0022751 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp * Contains implementations of gp_ht_map_'s erase related functions, * when the hash value is not stored. */ PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: erase_imp(key_const_reference r_key, false_type) { PB_DS_ASSERT_VALID((*this)) size_type hash = ranged_probe_fn_base::operator()(r_key); size_type i; resize_base::notify_erase_search_start(); for (i = 0; i < m_num_e; ++i) { const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i); entry* const p_e = m_entries + pos; switch(p_e->m_stat) { case empty_entry_status: { resize_base::notify_erase_search_end(); PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) return false; } break; case valid_entry_status: if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key)) { resize_base::notify_erase_search_end(); erase_entry(p_e); do_resize_if_needed_no_throw(); return true; } break; case erased_entry_status: break; default: _GLIBCXX_DEBUG_ASSERT(0); }; resize_base::notify_erase_search_collision(); } resize_base::notify_erase_search_end(); return false; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp�������������������������������������0000644�����������������00000004176�14763166027�0020030 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file gp_hash_table_map_/debug_fn_imps.hpp * Contains implementations of gp_ht_map_'s debug-mode functions. */ #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_valid(const char* __file, int __line) const { debug_base::check_size(m_num_used_e, __file, __line); assert_entry_array_valid(m_entries, traits_base::m_store_extra_indicator, __file, __line); } #include <ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp> #include <ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp> #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp�����������������������������������0000644�����������������00000006772�14763166027�0020560 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file sample_resize_policy.hpp * Contains a sample resize policy for hash tables. */ #ifndef PB_DS_SAMPLE_RESIZE_POLICY_HPP #define PB_DS_SAMPLE_RESIZE_POLICY_HPP namespace __gnu_pbds { /// A sample resize policy. class sample_resize_policy { public: /// Size type. typedef std::size_t size_type; /// Default constructor. sample_resize_policy(); /// Copy constructor. sample_range_hashing(const sample_resize_policy& other); /// Swaps content. inline void swap(sample_resize_policy& other); protected: /// Notifies a search started. inline void notify_insert_search_start(); /// Notifies a search encountered a collision. inline void notify_insert_search_collision(); /// Notifies a search ended. inline void notify_insert_search_end(); /// Notifies a search started. inline void notify_find_search_start(); /// Notifies a search encountered a collision. inline void notify_find_search_collision(); /// Notifies a search ended. inline void notify_find_search_end(); /// Notifies a search started. inline void notify_erase_search_start(); /// Notifies a search encountered a collision. inline void notify_erase_search_collision(); /// Notifies a search ended. inline void notify_erase_search_end(); /// Notifies an element was inserted. inline void notify_inserted(size_type num_e); /// Notifies an element was erased. inline void notify_erased(size_type num_e); /// Notifies the table was cleared. void notify_cleared(); /// Notifies the table was resized to new_size. void notify_resized(size_type new_size); /// Queries whether a resize is needed. inline bool is_resize_needed() const; /// Queries what the new size should be. size_type get_new_size(size_type size, size_type num_used_e) const; }; } #endif ������c++/4.8.2/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp���������0000644�����������������00000011443�14763166027�0025744 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_max_collision_check_resize_trigger_imp.hpp * Contains a resize trigger implementation. */ PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: cc_hash_max_collision_check_resize_trigger(float load) : m_load(load), m_size(0), m_num_col(0), m_max_col(0), m_resize_needed(false) { } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_find_search_start() { } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_find_search_collision() { } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_find_search_end() { } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_insert_search_start() { m_num_col = 0; } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_insert_search_collision() { ++m_num_col; } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_insert_search_end() { calc_resize_needed(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_erase_search_start() { } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_erase_search_collision() { } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_erase_search_end() { } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_inserted(size_type) { } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_erased(size_type) { m_resize_needed = true; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: notify_cleared() { m_resize_needed = false; } PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: is_resize_needed() const { return m_resize_needed; } PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: is_grow_needed(size_type /*size*/, size_type /*num_used_e*/) const { return m_num_col >= m_max_col; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: notify_resized(size_type new_size) { m_size = new_size; #ifdef PB_DS_HT_MAP_RESIZE_TRACE_ std::cerr << "chmccrt::notify_resized " << static_cast<unsigned long>(new_size) << std::endl; #endif calc_max_num_coll(); calc_resize_needed(); m_num_col = 0; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: calc_max_num_coll() { // max_col <-- \sqrt{2 load \ln( 2 m \ln( m ) ) } const double ln_arg = 2 * m_size * std::log(double(m_size)); m_max_col = size_type(std::ceil(std::sqrt(2 * m_load * std::log(ln_arg)))); #ifdef PB_DS_HT_MAP_RESIZE_TRACE_ std::cerr << "chmccrt::calc_max_num_coll " << static_cast<unsigned long>(m_size) << " " << static_cast<unsigned long>(m_max_col) << std::endl; #endif } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: notify_externally_resized(size_type new_size) { notify_resized(new_size); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { std::swap(m_load, other.m_load); std::swap(m_size, other.m_size); std::swap(m_num_col, other.m_num_col); std::swap(m_max_col, other.m_max_col); std::swap(m_resize_needed, other.m_resize_needed); } PB_DS_CLASS_T_DEC inline float PB_DS_CLASS_C_DEC:: get_load() const { PB_DS_STATIC_ASSERT(access, external_load_access); return m_load; } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: calc_resize_needed() { m_resize_needed = m_resize_needed || m_num_col >= m_max_col; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: set_load(float load) { PB_DS_STATIC_ASSERT(access, external_load_access); m_load = load; calc_max_num_coll(); calc_resize_needed(); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp����������������������������������0000644�����������������00000007512�14763166027�0020715 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file sample_resize_trigger.hpp * Contains a sample resize trigger policy class. */ #ifndef PB_DS_SAMPLE_RESIZE_TRIGGER_HPP #define PB_DS_SAMPLE_RESIZE_TRIGGER_HPP namespace __gnu_pbds { /// A sample resize trigger policy. class sample_resize_trigger { public: /// Size type. typedef std::size_t size_type; /// Default constructor. sample_resize_trigger(); /// Copy constructor. sample_range_hashing(const sample_resize_trigger&); /// Swaps content. inline void swap(sample_resize_trigger&); protected: /// Notifies a search started. inline void notify_insert_search_start(); /// Notifies a search encountered a collision. inline void notify_insert_search_collision(); /// Notifies a search ended. inline void notify_insert_search_end(); /// Notifies a search started. inline void notify_find_search_start(); /// Notifies a search encountered a collision. inline void notify_find_search_collision(); /// Notifies a search ended. inline void notify_find_search_end(); /// Notifies a search started. inline void notify_erase_search_start(); /// Notifies a search encountered a collision. inline void notify_erase_search_collision(); /// Notifies a search ended. inline void notify_erase_search_end(); /// Notifies an element was inserted. the total number of entries in /// the table is num_entries. inline void notify_inserted(size_type num_entries); /// Notifies an element was erased. inline void notify_erased(size_type num_entries); /// Notifies the table was cleared. void notify_cleared(); /// Notifies the table was resized as a result of this object's /// signifying that a resize is needed. void notify_resized(size_type new_size); /// Notifies the table was resized externally. void notify_externally_resized(size_type new_size); /// Queries whether a resize is needed. inline bool is_resize_needed() const; /// Queries whether a grow is needed. inline bool is_grow_needed(size_type size, size_type num_entries) const; private: /// Resizes to new_size. virtual void do_resize(size_type); }; } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp�����������������������0000644�����������������00000005324�14763166027�0023136 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file hash_exponential_size_policy_imp.hpp * Contains a resize size policy implementation. */ PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: hash_exponential_size_policy(size_type start_size, size_type grow_factor) : m_start_size(start_size), m_grow_factor(grow_factor) { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { std::swap(m_start_size, other.m_start_size); std::swap(m_grow_factor, other.m_grow_factor); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: get_nearest_larger_size(size_type size) const { size_type ret = m_start_size; while (ret <= size) { const size_type next_ret = ret* m_grow_factor; if (next_ret < ret) __throw_insert_error(); ret = next_ret; } return ret; } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: get_nearest_smaller_size(size_type size) const { size_type ret = m_start_size; while (true) { const size_type next_ret = ret* m_grow_factor; if (next_ret < ret) __throw_resize_error(); if (next_ret >= size) return (ret); ret = next_ret; } return ret; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp�����������������������������0000644�����������������00000013773�14763166027�0021733 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file hash_prime_size_policy_imp.hpp * Contains a resize size policy implementation. */ #pragma GCC system_header namespace detail { enum { num_distinct_sizes_32_bit = 30, num_distinct_sizes_64_bit = 62, num_distinct_sizes = sizeof(std::size_t) != 8 ? num_distinct_sizes_32_bit : num_distinct_sizes_64_bit, }; // Originally taken from the SGI implementation; acknowledged in the docs. // Further modified (for 64 bits) from tr1's hashtable. static const std::size_t g_a_sizes[num_distinct_sizes_64_bit] = { /* 0 */ 5ul, /* 1 */ 11ul, /* 2 */ 23ul, /* 3 */ 47ul, /* 4 */ 97ul, /* 5 */ 199ul, /* 6 */ 409ul, /* 7 */ 823ul, /* 8 */ 1741ul, /* 9 */ 3469ul, /* 10 */ 6949ul, /* 11 */ 14033ul, /* 12 */ 28411ul, /* 13 */ 57557ul, /* 14 */ 116731ul, /* 15 */ 236897ul, /* 16 */ 480881ul, /* 17 */ 976369ul, /* 18 */ 1982627ul, /* 19 */ 4026031ul, /* 20 */ 8175383ul, /* 21 */ 16601593ul, /* 22 */ 33712729ul, /* 23 */ 68460391ul, /* 24 */ 139022417ul, /* 25 */ 282312799ul, /* 26 */ 573292817ul, /* 27 */ 1164186217ul, /* 28 */ 2364114217ul, /* 29 */ 4294967291ul, /* 30 */ (std::size_t)8589934583ull, /* 31 */ (std::size_t)17179869143ull, /* 32 */ (std::size_t)34359738337ull, /* 33 */ (std::size_t)68719476731ull, /* 34 */ (std::size_t)137438953447ull, /* 35 */ (std::size_t)274877906899ull, /* 36 */ (std::size_t)549755813881ull, /* 37 */ (std::size_t)1099511627689ull, /* 38 */ (std::size_t)2199023255531ull, /* 39 */ (std::size_t)4398046511093ull, /* 40 */ (std::size_t)8796093022151ull, /* 41 */ (std::size_t)17592186044399ull, /* 42 */ (std::size_t)35184372088777ull, /* 43 */ (std::size_t)70368744177643ull, /* 44 */ (std::size_t)140737488355213ull, /* 45 */ (std::size_t)281474976710597ull, /* 46 */ (std::size_t)562949953421231ull, /* 47 */ (std::size_t)1125899906842597ull, /* 48 */ (std::size_t)2251799813685119ull, /* 49 */ (std::size_t)4503599627370449ull, /* 50 */ (std::size_t)9007199254740881ull, /* 51 */ (std::size_t)18014398509481951ull, /* 52 */ (std::size_t)36028797018963913ull, /* 53 */ (std::size_t)72057594037927931ull, /* 54 */ (std::size_t)144115188075855859ull, /* 55 */ (std::size_t)288230376151711717ull, /* 56 */ (std::size_t)576460752303423433ull, /* 57 */ (std::size_t)1152921504606846883ull, /* 58 */ (std::size_t)2305843009213693951ull, /* 59 */ (std::size_t)4611686018427387847ull, /* 60 */ (std::size_t)9223372036854775783ull, /* 61 */ (std::size_t)18446744073709551557ull, }; } // namespace detail PB_DS_CLASS_T_DEC inline PB_DS_CLASS_C_DEC:: hash_prime_size_policy(size_type n) : m_start_size(n) { m_start_size = get_nearest_larger_size(n); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { std::swap(m_start_size, other.m_start_size); } PB_DS_CLASS_T_DEC inline PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: get_nearest_larger_size(size_type n) const { const std::size_t* const p_upper = std::upper_bound(detail::g_a_sizes, detail::g_a_sizes + detail::num_distinct_sizes, n); if (p_upper == detail::g_a_sizes + detail::num_distinct_sizes) __throw_resize_error(); return *p_upper; } PB_DS_CLASS_T_DEC inline PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: get_nearest_smaller_size(size_type n) const { const std::size_t* p_lower = std::lower_bound(detail::g_a_sizes, detail::g_a_sizes + detail::num_distinct_sizes, n); if (*p_lower >= n && p_lower != detail::g_a_sizes) --p_lower; if (*p_lower < m_start_size) return m_start_size; return *p_lower; } �����c++/4.8.2/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp���������������0000644�����������������00000005632�14763166027�0024540 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file hash_load_check_resize_trigger_size_base.hpp * Contains an base holding size for some resize policies. */ #ifndef PB_DS_HASH_LOAD_CHECK_RESIZE_TRIGGER_SIZE_BASE_HPP #define PB_DS_HASH_LOAD_CHECK_RESIZE_TRIGGER_SIZE_BASE_HPP namespace __gnu_pbds { namespace detail { /// Primary template. template<typename Size_Type, bool Hold_Size> class hash_load_check_resize_trigger_size_base; /// Specializations. template<typename Size_Type> class hash_load_check_resize_trigger_size_base<Size_Type, true> { protected: typedef Size_Type size_type; hash_load_check_resize_trigger_size_base(): m_size(0) { } inline void swap(hash_load_check_resize_trigger_size_base& other) { std::swap(m_size, other.m_size); } inline void set_size(size_type size) { m_size = size; } inline size_type get_size() const { return m_size; } private: size_type m_size; }; template<typename Size_Type> class hash_load_check_resize_trigger_size_base<Size_Type, false> { protected: typedef Size_Type size_type; protected: inline void swap(hash_load_check_resize_trigger_size_base& other) { } inline void set_size(size_type size) { } }; } // namespace detail } // namespace __gnu_pbds #endif ������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp�������������������������������������0000644�����������������00000004573�14763166027�0020226 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file sample_size_policy.hpp * Contains a sample size resize-policy. */ #ifndef PB_DS_SAMPLE_SIZE_POLICY_HPP #define PB_DS_SAMPLE_SIZE_POLICY_HPP namespace __gnu_pbds { /// A sample size policy. class sample_size_policy { public: /// Size type. typedef std::size_t size_type; /// Default constructor. sample_size_policy(); /// Copy constructor. sample_range_hashing(const sample_size_policy&); /// Swaps content. inline void swap(sample_size_policy& other); protected: /// Given a __size size, returns a __size that is larger. inline size_type get_nearest_larger_size(size_type size) const; /// Given a __size size, returns a __size that is smaller. inline size_type get_nearest_smaller_size(size_type size) const; }; } #endif �������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp���������������������0000644�����������������00000017110�14763166027�0023353 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file hash_load_check_resize_trigger_imp.hpp * Contains a resize trigger implementation. */ #define PB_DS_ASSERT_VALID(X) \ _GLIBCXX_DEBUG_ONLY(X.assert_valid(__FILE__, __LINE__);) PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: hash_load_check_resize_trigger(float load_min, float load_max) : m_load_min(load_min), m_load_max(load_max), m_next_shrink_size(0), m_next_grow_size(0), m_resize_needed(false) { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_find_search_start() { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_find_search_collision() { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_find_search_end() { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_insert_search_start() { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_insert_search_collision() { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_insert_search_end() { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_erase_search_start() { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_erase_search_collision() { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_erase_search_end() { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_inserted(size_type num_entries) { m_resize_needed = (num_entries >= m_next_grow_size); size_base::set_size(num_entries); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_erased(size_type num_entries) { size_base::set_size(num_entries); m_resize_needed = num_entries <= m_next_shrink_size; PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: is_resize_needed() const { PB_DS_ASSERT_VALID((*this)) return m_resize_needed; } PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: is_grow_needed(size_type /*size*/, size_type num_entries) const { _GLIBCXX_DEBUG_ASSERT(m_resize_needed); return num_entries >= m_next_grow_size; } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ~hash_load_check_resize_trigger() { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: notify_resized(size_type new_size) { m_resize_needed = false; m_next_grow_size = size_type(m_load_max * new_size - 1); m_next_shrink_size = size_type(m_load_min * new_size); #ifdef PB_DS_HT_MAP_RESIZE_TRACE_ std::cerr << "hlcrt::notify_resized " << std::endl << "1 " << new_size << std::endl << "2 " << m_load_min << std::endl << "3 " << m_load_max << std::endl << "4 " << m_next_shrink_size << std::endl << "5 " << m_next_grow_size << std::endl; #endif PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: notify_externally_resized(size_type new_size) { m_resize_needed = false; size_type new_grow_size = size_type(m_load_max * new_size - 1); size_type new_shrink_size = size_type(m_load_min * new_size); #ifdef PB_DS_HT_MAP_RESIZE_TRACE_ std::cerr << "hlcrt::notify_externally_resized " << std::endl << "1 " << new_size << std::endl << "2 " << m_load_min << std::endl << "3 " << m_load_max << std::endl << "4 " << m_next_shrink_size << std::endl << "5 " << m_next_grow_size << std::endl << "6 " << new_shrink_size << std::endl << "7 " << new_grow_size << std::endl; #endif if (new_grow_size >= m_next_grow_size) { _GLIBCXX_DEBUG_ASSERT(new_shrink_size >= m_next_shrink_size); m_next_grow_size = new_grow_size; } else { _GLIBCXX_DEBUG_ASSERT(new_shrink_size <= m_next_shrink_size); m_next_shrink_size = new_shrink_size; } PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: notify_cleared() { PB_DS_ASSERT_VALID((*this)) size_base::set_size(0); m_resize_needed = (0 < m_next_shrink_size); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) size_base::swap(other); std::swap(m_load_min, other.m_load_min); std::swap(m_load_max, other.m_load_max); std::swap(m_resize_needed, other.m_resize_needed); std::swap(m_next_grow_size, other.m_next_grow_size); std::swap(m_next_shrink_size, other.m_next_shrink_size); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } PB_DS_CLASS_T_DEC inline std::pair<float, float> PB_DS_CLASS_C_DEC:: get_loads() const { PB_DS_STATIC_ASSERT(access, external_load_access); return std::make_pair(m_load_min, m_load_max); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: set_loads(std::pair<float, float> load_pair) { PB_DS_STATIC_ASSERT(access, external_load_access); const float old_load_min = m_load_min; const float old_load_max = m_load_max; const size_type old_next_shrink_size = m_next_shrink_size; const size_type old_next_grow_size = m_next_grow_size; const bool old_resize_needed = m_resize_needed; __try { m_load_min = load_pair.first; m_load_max = load_pair.second; do_resize(static_cast<size_type>(size_base::get_size() / ((m_load_min + m_load_max) / 2))); } __catch(...) { m_load_min = old_load_min; m_load_max = old_load_max; m_next_shrink_size = old_next_shrink_size; m_next_grow_size = old_next_grow_size; m_resize_needed = old_resize_needed; __throw_exception_again; } } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: do_resize(size_type) { std::abort(); } #ifdef _GLIBCXX_DEBUG # define PB_DS_DEBUG_VERIFY(_Cond) \ _GLIBCXX_DEBUG_VERIFY_AT(_Cond, \ _M_message(#_Cond" assertion from %1;:%2;") \ ._M_string(__FILE__)._M_integer(__LINE__) \ ,__file,__line) PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_valid(const char* __file, int __line) const { PB_DS_DEBUG_VERIFY(m_load_max > m_load_min); PB_DS_DEBUG_VERIFY(m_next_grow_size >= m_next_shrink_size); } # undef PB_DS_DEBUG_VERIFY #endif #undef PB_DS_ASSERT_VALID ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp������������������������0000644�����������������00000014213�14763166027�0022734 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file hash_standard_resize_policy_imp.hpp * Contains a resize policy implementation. */ PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: hash_standard_resize_policy() : m_size(Size_Policy::get_nearest_larger_size(1)) { trigger_policy_base::notify_externally_resized(m_size); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: hash_standard_resize_policy(const Size_Policy& r_size_policy) : Size_Policy(r_size_policy), m_size(Size_Policy::get_nearest_larger_size(1)) { trigger_policy_base::notify_externally_resized(m_size); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: hash_standard_resize_policy(const Size_Policy& r_size_policy, const Trigger_Policy& r_trigger_policy) : Size_Policy(r_size_policy), Trigger_Policy(r_trigger_policy), m_size(Size_Policy::get_nearest_larger_size(1)) { trigger_policy_base::notify_externally_resized(m_size); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ~hash_standard_resize_policy() { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { trigger_policy_base::swap(other); size_policy_base::swap(other); std::swap(m_size, other.m_size); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_find_search_start() { trigger_policy_base::notify_find_search_start(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_find_search_collision() { trigger_policy_base::notify_find_search_collision(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_find_search_end() { trigger_policy_base::notify_find_search_end(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_insert_search_start() { trigger_policy_base::notify_insert_search_start(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_insert_search_collision() { trigger_policy_base::notify_insert_search_collision(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_insert_search_end() { trigger_policy_base::notify_insert_search_end(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_erase_search_start() { trigger_policy_base::notify_erase_search_start(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_erase_search_collision() { trigger_policy_base::notify_erase_search_collision(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_erase_search_end() { trigger_policy_base::notify_erase_search_end(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_inserted(size_type num_e) { trigger_policy_base::notify_inserted(num_e); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_erased(size_type num_e) { trigger_policy_base::notify_erased(num_e); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: notify_cleared() { trigger_policy_base::notify_cleared(); } PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: is_resize_needed() const { return trigger_policy_base::is_resize_needed(); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: get_new_size(size_type size, size_type num_used_e) const { if (trigger_policy_base::is_grow_needed(size, num_used_e)) return size_policy_base::get_nearest_larger_size(size); return size_policy_base::get_nearest_smaller_size(size); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: notify_resized(size_type new_size) { trigger_policy_base::notify_resized(new_size); m_size = new_size; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: get_actual_size() const { PB_DS_STATIC_ASSERT(access, external_size_access); return m_size; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: resize(size_type new_size) { PB_DS_STATIC_ASSERT(access, external_size_access); size_type actual_size = size_policy_base::get_nearest_larger_size(1); while (actual_size < new_size) { const size_type pot = size_policy_base::get_nearest_larger_size(actual_size); if (pot == actual_size && pot < new_size) __throw_resize_error(); actual_size = pot; } if (actual_size > 0) --actual_size; const size_type old_size = m_size; __try { do_resize(actual_size - 1); } __catch(insert_error& ) { m_size = old_size; __throw_resize_error(); } __catch(...) { m_size = old_size; __throw_exception_again; } } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: do_resize(size_type) { // Do nothing } PB_DS_CLASS_T_DEC Trigger_Policy& PB_DS_CLASS_C_DEC:: get_trigger_policy() { return *this; } PB_DS_CLASS_T_DEC const Trigger_Policy& PB_DS_CLASS_C_DEC:: get_trigger_policy() const { return *this; } PB_DS_CLASS_T_DEC Size_Policy& PB_DS_CLASS_C_DEC:: get_size_policy() { return *this; } PB_DS_CLASS_T_DEC const Size_Policy& PB_DS_CLASS_C_DEC:: get_size_policy() const { return *this; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/branch_policy/branch_policy.hpp������������������������������������������0000644�����������������00000007677�14763166030�0017106 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file branch_policy/branch_policy.hpp * Contains a base class for branch policies. */ #ifndef PB_DS_BRANCH_POLICY_BASE_HPP #define PB_DS_BRANCH_POLICY_BASE_HPP #include <ext/pb_ds/tag_and_trait.hpp> namespace __gnu_pbds { namespace detail { /// Primary template, base class for branch structure policies. template<typename Node_CItr, typename Node_Itr, typename _Alloc> struct branch_policy { protected: typedef typename Node_Itr::value_type it_type; typedef typename std::iterator_traits<it_type>::value_type value_type; typedef typename value_type::first_type key_type; typedef typename remove_const<value_type>::type rcvalue_type; typedef typename remove_const<key_type>::type rckey_type; typedef typename _Alloc::template rebind<rcvalue_type>::other rebind_v; typedef typename _Alloc::template rebind<rckey_type>::other rebind_k; typedef typename rebind_v::reference reference; typedef typename rebind_v::const_reference const_reference; typedef typename rebind_v::const_pointer const_pointer; typedef typename rebind_k::const_reference key_const_reference; static inline key_const_reference extract_key(const_reference r_val) { return r_val.first; } virtual it_type end() = 0; it_type end_iterator() const { return const_cast<branch_policy*>(this)->end(); } virtual ~branch_policy() { } }; /// Specialization for const iterators. template<typename Node_CItr, typename _Alloc> struct branch_policy<Node_CItr, Node_CItr, _Alloc> { protected: typedef typename Node_CItr::value_type it_type; typedef typename std::iterator_traits<it_type>::value_type value_type; typedef typename remove_const<value_type>::type rcvalue_type; typedef typename _Alloc::template rebind<rcvalue_type>::other rebind_v; typedef typename rebind_v::reference reference; typedef typename rebind_v::const_reference const_reference; typedef typename rebind_v::const_pointer const_pointer; typedef value_type key_type; typedef typename rebind_v::const_reference key_const_reference; static inline key_const_reference extract_key(const_reference r_val) { return r_val; } virtual it_type end() const = 0; it_type end_iterator() const { return end(); } virtual ~branch_policy() { } }; } // namespace detail } // namespace __gnu_pbds #endif // #ifndef PB_DS_BRANCH_POLICY_BASE_HPP �����������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/branch_policy/traits.hpp�������������������������������������������������0000644�����������������00000006266�14763166030�0015571 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file branch_policy/traits.hpp * Contains an implementation class for tree-like classes. */ #ifndef PB_DS_NODE_AND_IT_TRAITS_HPP #define PB_DS_NODE_AND_IT_TRAITS_HPP #include <ext/pb_ds/detail/types_traits.hpp> #include <ext/pb_ds/detail/bin_search_tree_/traits.hpp> #include <ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp> #include <ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp> #define PB_DS_DEBUG_VERIFY(_Cond) \ _GLIBCXX_DEBUG_VERIFY_AT(_Cond, \ _M_message(#_Cond" assertion from %1;:%2;") \ ._M_string(__FILE__)._M_integer(__LINE__) \ ,__file,__line) namespace __gnu_pbds { namespace detail { /// Tree traits class, primary template. template<typename Key, typename Data, typename Cmp_Fn, template<typename Node_CItr, typename Node_Itr, typename Cmp_Fn_, typename _Alloc> class Node_Update, typename Tag, typename _Alloc> struct tree_traits; /// Trie traits class, primary template. template<typename Key, typename Data, typename _ATraits, template<typename Node_CItr, typename Node_Itr, typename _ATraits_, typename _Alloc> class Node_Update, typename Tag, typename _Alloc> struct trie_traits; } // namespace detail } // namespace __gnu_pbds #include <ext/pb_ds/detail/rb_tree_map_/traits.hpp> #include <ext/pb_ds/detail/splay_tree_/traits.hpp> #include <ext/pb_ds/detail/ov_tree_map_/traits.hpp> #include <ext/pb_ds/detail/pat_trie_/traits.hpp> #undef PB_DS_DEBUG_VERIFY #endif // #ifndef PB_DS_NODE_AND_IT_TRAITS_HPP ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/branch_policy/null_node_metadata.hpp�������������������������������������0000644�����������������00000004513�14763166030�0020073 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file branch_policy/null_node_metadata.hpp * Contains an implementation class for tree-like classes. */ #ifndef PB_DS_0_NODE_METADATA_HPP #define PB_DS_0_NODE_METADATA_HPP #include <ext/pb_ds/detail/types_traits.hpp> namespace __gnu_pbds { namespace detail { /// Constant node iterator. template<typename Key, typename Data, typename _Alloc> struct dumnode_const_iterator { private: typedef types_traits<Key, Data, _Alloc, false> __traits_type; typedef typename __traits_type::pointer const_iterator; public: typedef const_iterator value_type; typedef const_iterator const_reference; typedef const_reference reference; }; } // namespace detail } // namespace __gnu_pbds #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp��������������������������������������0000644�����������������00000004075�14763166030�0017663 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/size_fn_imps.hpp * Contains implementations of cc_ht_map_'s entire container size related * functions. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: size() const { return m_num_used_e; } PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: empty() const { return (size() == 0); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: max_size() const { return s_entry_allocator.max_size(); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp��������������������������0000644�����������������00000004144�14763166030�0022213 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/debug_store_hash_fn_imps.hpp * Contains implementations of cc_ht_map_'s debug-mode functions. */ #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_entry_pointer_valid(const entry_pointer p_e, true_type, const char* __file, int __line) const { debug_base::check_key_exists(PB_DS_V2F(p_e->m_value), __file, __line); comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value)); PB_DS_DEBUG_VERIFY(p_e->m_hash == pos_hash_pair.second); } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp������������������������������������0000644�����������������00000003550�14763166030�0020212 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/insert_fn_imps.hpp * Contains implementations of cc_ht_map_'s insert related functions. */ #include <ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp> #include <ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp> ��������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp���������������������������������0000644�����������������00000005150�14763166030�0020720 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/iterators_fn_imps.hpp * Contains implementations of cc_ht_map_'s iterators related functions, e.g., * begin(). */ PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC::s_end_it; PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC::s_const_end_it; PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: begin() { pointer p_value; std::pair<entry_pointer, size_type> pos; get_start_it_state(p_value, pos); return iterator(p_value, pos, this); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: end() { return s_end_it; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: begin() const { pointer p_value; std::pair<entry_pointer, size_type> pos; get_start_it_state(p_value, pos); return const_iterator(p_value, pos, this); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: end() const { return s_const_end_it; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp�������������������������0000644�����������������00000005162�14763166030�0022432 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/insert_store_hash_fn_imps.hpp * Contains implementations of cc_ht_map_'s insert related functions, * when the hash value is stored. */ PB_DS_CLASS_T_DEC inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool> PB_DS_CLASS_C_DEC:: insert_imp(const_reference r_val, true_type) { PB_DS_ASSERT_VALID((*this)) key_const_reference key = PB_DS_V2F(r_val); comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(key); entry_pointer p_e = m_entries[pos_hash_pair.first]; resize_base::notify_insert_search_start(); while (p_e != 0 && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash, key, pos_hash_pair.second)) { resize_base::notify_insert_search_collision(); p_e = p_e->m_p_next; } resize_base::notify_insert_search_end(); if (p_e != 0) { PB_DS_CHECK_KEY_EXISTS(key) return std::make_pair(&p_e->m_value, false); } PB_DS_CHECK_KEY_DOES_NOT_EXIST(key) return std::make_pair(insert_new_imp(r_val, pos_hash_pair), true); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp����������������������������������������0000644�����������������00000046761�14763166030�0017262 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/cc_ht_map_.hpp * Contains an implementation class for cc_ht_map_. */ #include <utility> #include <iterator> #include <ext/pb_ds/detail/cond_dealtor.hpp> #include <ext/pb_ds/tag_and_trait.hpp> #include <ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp> #include <ext/pb_ds/detail/types_traits.hpp> #include <ext/pb_ds/exception.hpp> #include <ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp> #ifdef _GLIBCXX_DEBUG #include <ext/pb_ds/detail/debug_map_base.hpp> #endif #ifdef PB_DS_HT_MAP_TRACE_ #include <iostream> #endif #include <debug/debug.h> namespace __gnu_pbds { namespace detail { #ifdef PB_DS_DATA_TRUE_INDICATOR #define PB_DS_CC_HASH_NAME cc_ht_map #endif #ifdef PB_DS_DATA_FALSE_INDICATOR #define PB_DS_CC_HASH_NAME cc_ht_set #endif #define PB_DS_CLASS_T_DEC \ template<typename Key, typename Mapped, typename Hash_Fn, \ typename Eq_Fn, typename _Alloc, bool Store_Hash, \ typename Comb_Hash_Fn, typename Resize_Policy> #define PB_DS_CLASS_C_DEC \ PB_DS_CC_HASH_NAME<Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, \ Store_Hash, Comb_Hash_Fn, Resize_Policy> #define PB_DS_HASH_EQ_FN_C_DEC \ hash_eq_fn<Key, Eq_Fn, _Alloc, Store_Hash> #define PB_DS_RANGED_HASH_FN_C_DEC \ ranged_hash_fn<Key, Hash_Fn, _Alloc, Comb_Hash_Fn, Store_Hash> #define PB_DS_CC_HASH_TRAITS_BASE \ types_traits<Key, Mapped, _Alloc, Store_Hash> #ifdef _GLIBCXX_DEBUG #define PB_DS_DEBUG_MAP_BASE_C_DEC \ debug_map_base<Key, Eq_Fn, \ typename _Alloc::template rebind<Key>::other::const_reference> #endif /** * A collision-chaining hash-based container. * * * @ingroup hash-detail * * @tparam Key Key type. * * @tparam Mapped Map type. * * @tparam Hash_Fn Hashing functor. * Default is __gnu_cxx::hash. * * @tparam Eq_Fn Equal functor. * Default std::equal_to<Key> * * @tparam _Alloc Allocator type. * * @tparam Store_Hash If key type stores extra metadata. * Defaults to false. * * @tparam Comb_Hash_Fn Combining hash functor. * If Hash_Fn is not null_type, then this * is the ranged-hash functor; otherwise, * this is the range-hashing functor. * XXX(See Design::Hash-Based Containers::Hash Policies.) * Default direct_mask_range_hashing. * * @tparam Resize_Policy Resizes hash. * Defaults to hash_standard_resize_policy, * using hash_exponential_size_policy and * hash_load_check_resize_trigger. * * * Bases are: detail::hash_eq_fn, Resize_Policy, detail::ranged_hash_fn, * detail::types_traits. (Optional: detail::debug_map_base.) */ template<typename Key, typename Mapped, typename Hash_Fn, typename Eq_Fn, typename _Alloc, bool Store_Hash, typename Comb_Hash_Fn, typename Resize_Policy > class PB_DS_CC_HASH_NAME: #ifdef _GLIBCXX_DEBUG protected PB_DS_DEBUG_MAP_BASE_C_DEC, #endif public PB_DS_HASH_EQ_FN_C_DEC, public Resize_Policy, public PB_DS_RANGED_HASH_FN_C_DEC, public PB_DS_CC_HASH_TRAITS_BASE { private: typedef PB_DS_CC_HASH_TRAITS_BASE traits_base; typedef typename traits_base::comp_hash comp_hash; typedef typename traits_base::value_type value_type_; typedef typename traits_base::pointer pointer_; typedef typename traits_base::const_pointer const_pointer_; typedef typename traits_base::reference reference_; typedef typename traits_base::const_reference const_reference_; struct entry : public traits_base::stored_data_type { typename _Alloc::template rebind<entry>::other::pointer m_p_next; }; typedef cond_dealtor<entry, _Alloc> cond_dealtor_t; typedef typename _Alloc::template rebind<entry>::other entry_allocator; typedef typename entry_allocator::pointer entry_pointer; typedef typename entry_allocator::const_pointer const_entry_pointer; typedef typename entry_allocator::reference entry_reference; typedef typename entry_allocator::const_reference const_entry_reference; typedef typename _Alloc::template rebind<entry_pointer>::other entry_pointer_allocator; typedef typename entry_pointer_allocator::pointer entry_pointer_array; typedef PB_DS_RANGED_HASH_FN_C_DEC ranged_hash_fn_base; typedef PB_DS_HASH_EQ_FN_C_DEC hash_eq_fn_base; typedef Resize_Policy resize_base; #ifdef _GLIBCXX_DEBUG typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base; #endif #define PB_DS_GEN_POS std::pair<entry_pointer, typename _Alloc::size_type> #include <ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp> #include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp> #include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp> #include <ext/pb_ds/detail/unordered_iterator/iterator.hpp> #undef PB_DS_GEN_POS public: typedef _Alloc allocator_type; typedef typename _Alloc::size_type size_type; typedef typename _Alloc::difference_type difference_type; typedef Hash_Fn hash_fn; typedef Eq_Fn eq_fn; typedef Comb_Hash_Fn comb_hash_fn; typedef Resize_Policy resize_policy; /// Value stores hash, true or false. enum { store_hash = Store_Hash }; typedef typename traits_base::key_type key_type; typedef typename traits_base::key_pointer key_pointer; typedef typename traits_base::key_const_pointer key_const_pointer; typedef typename traits_base::key_reference key_reference; typedef typename traits_base::key_const_reference key_const_reference; typedef typename traits_base::mapped_type mapped_type; typedef typename traits_base::mapped_pointer mapped_pointer; typedef typename traits_base::mapped_const_pointer mapped_const_pointer; typedef typename traits_base::mapped_reference mapped_reference; typedef typename traits_base::mapped_const_reference mapped_const_reference; typedef typename traits_base::value_type value_type; typedef typename traits_base::pointer pointer; typedef typename traits_base::const_pointer const_pointer; typedef typename traits_base::reference reference; typedef typename traits_base::const_reference const_reference; #ifdef PB_DS_DATA_TRUE_INDICATOR typedef point_iterator_ point_iterator; #endif #ifdef PB_DS_DATA_FALSE_INDICATOR typedef point_const_iterator_ point_iterator; #endif typedef point_const_iterator_ point_const_iterator; #ifdef PB_DS_DATA_TRUE_INDICATOR typedef iterator_ iterator; #endif #ifdef PB_DS_DATA_FALSE_INDICATOR typedef const_iterator_ iterator; #endif typedef const_iterator_ const_iterator; PB_DS_CC_HASH_NAME(); PB_DS_CC_HASH_NAME(const Hash_Fn&); PB_DS_CC_HASH_NAME(const Hash_Fn&, const Eq_Fn&); PB_DS_CC_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Hash_Fn&); PB_DS_CC_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Hash_Fn&, const Resize_Policy&); PB_DS_CC_HASH_NAME(const PB_DS_CLASS_C_DEC&); virtual ~PB_DS_CC_HASH_NAME(); void swap(PB_DS_CLASS_C_DEC&); template<typename It> void copy_from_range(It, It); void initialize(); inline size_type size() const; inline size_type max_size() const; /// True if size() == 0. inline bool empty() const; /// Return current hash_fn. Hash_Fn& get_hash_fn(); /// Return current const hash_fn. const Hash_Fn& get_hash_fn() const; /// Return current eq_fn. Eq_Fn& get_eq_fn(); /// Return current const eq_fn. const Eq_Fn& get_eq_fn() const; /// Return current comb_hash_fn. Comb_Hash_Fn& get_comb_hash_fn(); /// Return current const comb_hash_fn. const Comb_Hash_Fn& get_comb_hash_fn() const; /// Return current resize_policy. Resize_Policy& get_resize_policy(); /// Return current const resize_policy. const Resize_Policy& get_resize_policy() const; inline std::pair<point_iterator, bool> insert(const_reference r_val) { return insert_imp(r_val, traits_base::m_store_extra_indicator); } inline mapped_reference operator[](key_const_reference r_key) { #ifdef PB_DS_DATA_TRUE_INDICATOR return (subscript_imp(r_key, traits_base::m_store_extra_indicator)); #else insert(r_key); return traits_base::s_null_type; #endif } inline point_iterator find(key_const_reference); inline point_const_iterator find(key_const_reference) const; inline point_iterator find_end(); inline point_const_iterator find_end() const; inline bool erase(key_const_reference); template<typename Pred> inline size_type erase_if(Pred); void clear(); inline iterator begin(); inline const_iterator begin() const; inline iterator end(); inline const_iterator end() const; #ifdef _GLIBCXX_DEBUG void assert_valid(const char*, int) const; #endif #ifdef PB_DS_HT_MAP_TRACE_ void trace() const; #endif private: void deallocate_all(); inline bool do_resize_if_needed(); inline void do_resize_if_needed_no_throw(); void resize_imp(size_type); void do_resize(size_type); void resize_imp_no_exceptions(size_type, entry_pointer_array, size_type); inline entry_pointer resize_imp_no_exceptions_reassign_pointer(entry_pointer, entry_pointer_array, false_type); inline entry_pointer resize_imp_no_exceptions_reassign_pointer(entry_pointer, entry_pointer_array, true_type); void deallocate_links_in_list(entry_pointer); inline entry_pointer get_entry(const_reference, false_type); inline entry_pointer get_entry(const_reference, true_type); inline void rels_entry(entry_pointer); #ifdef PB_DS_DATA_TRUE_INDICATOR inline mapped_reference subscript_imp(key_const_reference r_key, false_type) { _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);) const size_type pos = ranged_hash_fn_base::operator()(r_key); entry_pointer p_e = m_entries[pos]; resize_base::notify_insert_search_start(); while (p_e != 0 && !hash_eq_fn_base::operator()(p_e->m_value.first, r_key)) { resize_base::notify_insert_search_collision(); p_e = p_e->m_p_next; } resize_base::notify_insert_search_end(); if (p_e != 0) { PB_DS_CHECK_KEY_EXISTS(r_key) return (p_e->m_value.second); } PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) return insert_new_imp(value_type(r_key, mapped_type()), pos)->second; } inline mapped_reference subscript_imp(key_const_reference r_key, true_type) { _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);) comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(r_key); entry_pointer p_e = m_entries[pos_hash_pair.first]; resize_base::notify_insert_search_start(); while (p_e != 0 && !hash_eq_fn_base::operator()(p_e->m_value.first, p_e->m_hash, r_key, pos_hash_pair.second)) { resize_base::notify_insert_search_collision(); p_e = p_e->m_p_next; } resize_base::notify_insert_search_end(); if (p_e != 0) { PB_DS_CHECK_KEY_EXISTS(r_key) return p_e->m_value.second; } PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) return insert_new_imp(value_type(r_key, mapped_type()), pos_hash_pair)->second; } #endif inline std::pair<point_iterator, bool> insert_imp(const_reference, false_type); inline std::pair<point_iterator, bool> insert_imp(const_reference, true_type); inline pointer insert_new_imp(const_reference r_val, size_type pos) { if (do_resize_if_needed()) pos = ranged_hash_fn_base::operator()(PB_DS_V2F(r_val)); // Following lines might throw an exception. entry_pointer p_e = get_entry(r_val, traits_base::m_no_throw_copies_indicator); // At this point no exceptions can be thrown. p_e->m_p_next = m_entries[pos]; m_entries[pos] = p_e; resize_base::notify_inserted(++m_num_used_e); _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));) _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);) return &p_e->m_value; } inline pointer insert_new_imp(const_reference r_val, comp_hash& r_pos_hash_pair) { // Following lines might throw an exception. if (do_resize_if_needed()) r_pos_hash_pair = ranged_hash_fn_base::operator()(PB_DS_V2F(r_val)); entry_pointer p_e = get_entry(r_val, traits_base::m_no_throw_copies_indicator); // At this point no exceptions can be thrown. p_e->m_hash = r_pos_hash_pair.second; p_e->m_p_next = m_entries[r_pos_hash_pair.first]; m_entries[r_pos_hash_pair.first] = p_e; resize_base::notify_inserted(++m_num_used_e); _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));) _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);) return &p_e->m_value; } inline pointer find_key_pointer(key_const_reference r_key, false_type) { entry_pointer p_e = m_entries[ranged_hash_fn_base::operator()(r_key)]; resize_base::notify_find_search_start(); while (p_e != 0 && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key)) { resize_base::notify_find_search_collision(); p_e = p_e->m_p_next; } resize_base::notify_find_search_end(); #ifdef _GLIBCXX_DEBUG if (p_e == 0) PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) else PB_DS_CHECK_KEY_EXISTS(r_key) #endif return &p_e->m_value; } inline pointer find_key_pointer(key_const_reference r_key, true_type) { comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(r_key); entry_pointer p_e = m_entries[pos_hash_pair.first]; resize_base::notify_find_search_start(); while (p_e != 0 && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash, r_key, pos_hash_pair.second)) { resize_base::notify_find_search_collision(); p_e = p_e->m_p_next; } resize_base::notify_find_search_end(); #ifdef _GLIBCXX_DEBUG if (p_e == 0) PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) else PB_DS_CHECK_KEY_EXISTS(r_key) #endif return &p_e->m_value; } inline bool erase_in_pos_imp(key_const_reference, size_type); inline bool erase_in_pos_imp(key_const_reference, const comp_hash&); inline void erase_entry_pointer(entry_pointer&); #ifdef PB_DS_DATA_TRUE_INDICATOR void inc_it_state(pointer& r_p_value, std::pair<entry_pointer, size_type>& r_pos) const { inc_it_state((mapped_const_pointer& )r_p_value, r_pos); } #endif void inc_it_state(const_pointer& r_p_value, std::pair<entry_pointer, size_type>& r_pos) const { _GLIBCXX_DEBUG_ASSERT(r_p_value != 0); r_pos.first = r_pos.first->m_p_next; if (r_pos.first != 0) { r_p_value = &r_pos.first->m_value; return; } for (++r_pos.second; r_pos.second < m_num_e; ++r_pos.second) if (m_entries[r_pos.second] != 0) { r_pos.first = m_entries[r_pos.second]; r_p_value = &r_pos.first->m_value; return; } r_p_value = 0; } void get_start_it_state(pointer& r_p_value, std::pair<entry_pointer, size_type>& r_pos) const { for (r_pos.second = 0; r_pos.second < m_num_e; ++r_pos.second) if (m_entries[r_pos.second] != 0) { r_pos.first = m_entries[r_pos.second]; r_p_value = &r_pos.first->m_value; return; } r_p_value = 0; } #ifdef _GLIBCXX_DEBUG void assert_entry_pointer_array_valid(const entry_pointer_array, const char*, int) const; void assert_entry_pointer_valid(const entry_pointer, true_type, const char*, int) const; void assert_entry_pointer_valid(const entry_pointer, false_type, const char*, int) const; #endif #ifdef PB_DS_HT_MAP_TRACE_ void trace_list(const_entry_pointer) const; #endif private: #ifdef PB_DS_DATA_TRUE_INDICATOR friend class iterator_; #endif friend class const_iterator_; static entry_allocator s_entry_allocator; static entry_pointer_allocator s_entry_pointer_allocator; static iterator s_end_it; static const_iterator s_const_end_it; static point_iterator s_find_end_it; static point_const_iterator s_const_find_end_it; size_type m_num_e; size_type m_num_used_e; entry_pointer_array m_entries; enum { store_hash_ok = !Store_Hash || !is_same<Hash_Fn, __gnu_pbds::null_type>::value }; PB_DS_STATIC_ASSERT(sth, store_hash_ok); }; #include <ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp> #include <ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp> #include <ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp> #include <ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp> #include <ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp> #include <ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp> #include <ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp> #include <ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp> #include <ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp> #include <ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp> #include <ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp> #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #undef PB_DS_HASH_EQ_FN_C_DEC #undef PB_DS_RANGED_HASH_FN_C_DEC #undef PB_DS_CC_HASH_TRAITS_BASE #undef PB_DS_DEBUG_MAP_BASE_C_DEC #undef PB_DS_CC_HASH_NAME } // namespace detail } // namespace __gnu_pbds ���������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp���������0000644�����������������00000004402�14763166030�0025765 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp * Contains implementations of cc_ht_map_'s constructors, destructor, * and related functions. */ PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: constructor_insert_new_imp(const_reference r_val, size_type pos, true_type) { // Following lines might throw an exception. entry_pointer p = get_entry(r_val, traits_base::s_no_throw_copies_indicator); // At this point no exceptions can be thrown. p->m_p_next = m_entries[pos]; p->m_hash = ranged_hash_fn_base::operator()((key_const_reference)(PB_DS_V2F(p->m_value))).second; m_entries[pos] = p; _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(r_key);) } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp��������������������0000644�����������������00000013237�14763166030�0023554 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/constructor_destructor_fn_imps.hpp * Contains implementations of cc_ht_map_'s constructors, destructor, * and related functions. */ PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::entry_allocator PB_DS_CLASS_C_DEC::s_entry_allocator; PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::entry_pointer_allocator PB_DS_CLASS_C_DEC::s_entry_pointer_allocator; PB_DS_CLASS_T_DEC template<typename It> void PB_DS_CLASS_C_DEC:: copy_from_range(It first_it, It last_it) { while (first_it != last_it) insert(*(first_it++)); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_CC_HASH_NAME() : ranged_hash_fn_base(resize_base::get_nearest_larger_size(1)), m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0), m_entries(s_entry_pointer_allocator.allocate(m_num_e)) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_CC_HASH_NAME(const Hash_Fn& r_hash_fn) : ranged_hash_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn), m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0), m_entries(s_entry_pointer_allocator.allocate(m_num_e)) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_CC_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn) : PB_DS_HASH_EQ_FN_C_DEC(r_eq_fn), ranged_hash_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn), m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0), m_entries(s_entry_pointer_allocator.allocate(m_num_e)) { std::fill(m_entries, m_entries + m_num_e, (entry_pointer)0); Resize_Policy::notify_cleared(); ranged_hash_fn_base::notify_resized(m_num_e); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_CC_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, const Comb_Hash_Fn& r_comb_hash_fn) : PB_DS_HASH_EQ_FN_C_DEC(r_eq_fn), ranged_hash_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn, r_comb_hash_fn), m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0), m_entries(s_entry_pointer_allocator.allocate(m_num_e)) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_CC_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, const Comb_Hash_Fn& r_comb_hash_fn, const Resize_Policy& r_resize_policy) : PB_DS_HASH_EQ_FN_C_DEC(r_eq_fn), Resize_Policy(r_resize_policy), ranged_hash_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn, r_comb_hash_fn), m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0), m_entries(s_entry_pointer_allocator.allocate(m_num_e)) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_CC_HASH_NAME(const PB_DS_CLASS_C_DEC& other) : PB_DS_HASH_EQ_FN_C_DEC(other), resize_base(other), ranged_hash_fn_base(other), m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0), m_entries(s_entry_pointer_allocator.allocate(m_num_e)) { initialize(); PB_DS_ASSERT_VALID((*this)) __try { copy_from_range(other.begin(), other.end()); } __catch(...) { deallocate_all(); __throw_exception_again; } PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ~PB_DS_CC_HASH_NAME() { deallocate_all(); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) std::swap(m_entries, other.m_entries); std::swap(m_num_e, other.m_num_e); std::swap(m_num_used_e, other.m_num_used_e); ranged_hash_fn_base::swap(other); hash_eq_fn_base::swap(other); resize_base::swap(other); _GLIBCXX_DEBUG_ONLY(debug_base::swap(other)); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: deallocate_all() { clear(); s_entry_pointer_allocator.deallocate(m_entries, m_num_e); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: initialize() { std::fill(m_entries, m_entries + m_num_e, entry_pointer(0)); Resize_Policy::notify_resized(m_num_e); Resize_Policy::notify_cleared(); ranged_hash_fn_base::notify_resized(m_num_e); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp���������������������������0000644�����������������00000003363�14763166030�0022047 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/find_store_hash_fn_imps.hpp * Contains implementations of cc_ht_map_'s find related functions, * when the hash value is stored. */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp�����������������������0000644�����������������00000005472�14763166030�0022756 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp * Contains a conditional key destructor, used for exception handling. */ namespace __gnu_pbds { namespace detail { /// Conditional dey destructor, cc_hash. template<typename HT_Map> class cond_dealtor { public: typedef typename HT_Map::entry entry; typedef typename HT_Map::entry_allocator entry_allocator; typedef typename HT_Map::key_type key_type; cond_dealtor(entry_allocator* p_a, entry* p_e) : m_p_a(p_a), m_p_e(p_e), m_key_destruct(false), m_no_action_destructor(false) { } inline ~cond_dealtor(); void set_key_destruct() { m_key_destruct = true; } void set_no_action_destructor() { m_no_action_destructor = true; } protected: entry_allocator* const m_p_a; entry* const m_p_e; bool m_key_destruct; bool m_no_action_destructor; }; template<typename HT_Map> inline cond_dealtor<HT_Map>:: ~cond_dealtor() { if (m_no_action_destructor) return; if (m_key_destruct) m_p_e->m_value.first.~key_type(); m_p_a->deallocate(m_p_e, 1); } } // namespace detail } // namespace __gnu_pbds ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp��������������������������������0000644�����������������00000005612�14763166030�0021103 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/entry_list_fn_imps.hpp * Contains implementations of cc_ht_map_'s entry-list related functions. */ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: deallocate_links_in_list(entry_pointer p_e) { while (p_e != 0) { entry_pointer p_dealloc_e = p_e; p_e = p_e->m_p_next; s_entry_allocator.deallocate(p_dealloc_e, 1); } } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::entry_pointer PB_DS_CLASS_C_DEC:: get_entry(const_reference r_val, true_type) { // Following line might throw an exception. entry_pointer p_e = s_entry_allocator.allocate(1); // Following lines* cannot* throw an exception. new (&p_e->m_value) value_type(r_val); return p_e; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::entry_pointer PB_DS_CLASS_C_DEC:: get_entry(const_reference r_val, false_type) { // Following line might throw an exception. entry_pointer p_e = s_entry_allocator.allocate(1); cond_dealtor_t cond(p_e); // Following lines might throw an exception. new (&p_e->m_value) value_type(r_val); cond.set_no_action(); return p_e; } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: rels_entry(entry_pointer p_e) { // The following lines cannot throw exceptions (unless if key-data dtors do). p_e->m_value.~value_type(); s_entry_allocator.deallocate(p_e, 1); } ����������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp����������������������0000644�����������������00000004302�14763166030�0023116 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp * Contains implementations of cc_ht_map_'s resize related functions, when the * hash value is not stored. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::entry_pointer PB_DS_CLASS_C_DEC:: resize_imp_no_exceptions_reassign_pointer(entry_pointer p_e, entry_pointer_array a_p_entries_resized, false_type) { const size_type hash_pos = ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value)); entry_pointer const p_next_e = p_e->m_p_next; p_e->m_p_next = a_p_entries_resized[hash_pos]; a_p_entries_resized[hash_pos] = p_e; return p_next_e; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp�����������������������0000644�����������������00000003720�14763166030�0022706 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp * Contains implementations of cc_ht_map_'s debug-mode functions. */ #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_entry_pointer_valid(const entry_pointer p, false_type, const char* __file, int __line) const { debug_base::check_key_exists(PB_DS_V2F(p->m_value), __file, __line); } #endif ������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp��������������������������������������0000644�����������������00000004665�14763166030�0017636 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/find_fn_imps.hpp * Contains implementations of cc_ht_map_'s find related functions. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_iterator PB_DS_CLASS_C_DEC:: find(key_const_reference r_key) { PB_DS_ASSERT_VALID((*this)) return find_key_pointer(r_key, traits_base::m_store_extra_indicator); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_const_iterator PB_DS_CLASS_C_DEC:: find(key_const_reference r_key) const { PB_DS_ASSERT_VALID((*this)) return const_cast<PB_DS_CLASS_C_DEC& >(*this).find_key_pointer(r_key, traits_base::m_store_extra_indicator); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_iterator PB_DS_CLASS_C_DEC:: find_end() { return 0; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_const_iterator PB_DS_CLASS_C_DEC:: find_end() const { return 0; } ���������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp������0000644�����������������00000004262�14763166030�0026465 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp * Contains implementations of cc_ht_map_'s constructors, destructor, * and related functions. */ PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: constructor_insert_new_imp(mapped_const_reference r_val, size_type pos, false_type) { // Following lines might throw an exception. entry_pointer p = get_entry(r_val, traits_base::s_no_throw_copies_indicator); // At this point no exceptions can be thrown. p->m_p_next = m_entries[pos]; m_entries[pos] = p; _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(r_key);) } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp����������������������0000644�����������������00000005072�14763166030�0023126 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp * Contains implementations of cc_ht_map_'s insert related functions, * when the hash value is not stored. */ PB_DS_CLASS_T_DEC inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool> PB_DS_CLASS_C_DEC:: insert_imp(const_reference r_val, false_type) { PB_DS_ASSERT_VALID((*this)) key_const_reference r_key = PB_DS_V2F(r_val); const size_type pos = ranged_hash_fn_base::operator()(r_key); entry_pointer p_e = m_entries[pos]; resize_base::notify_insert_search_start(); while (p_e != 0 && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key)) { resize_base::notify_insert_search_collision(); p_e = p_e->m_p_next; } resize_base::notify_insert_search_end(); if (p_e != 0) { PB_DS_CHECK_KEY_EXISTS(r_key) return std::make_pair(&p_e->m_value, false); } PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) return std::make_pair(insert_new_imp(r_val, pos), true); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp�����������������������������0000644�����������������00000004661�14763166030�0021532 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/policy_access_fn_imps.hpp * Contains implementations of cc_ht_map_'s policy access * functions. */ PB_DS_CLASS_T_DEC Hash_Fn& PB_DS_CLASS_C_DEC:: get_hash_fn() { return *this; } PB_DS_CLASS_T_DEC const Hash_Fn& PB_DS_CLASS_C_DEC:: get_hash_fn() const { return *this; } PB_DS_CLASS_T_DEC Eq_Fn& PB_DS_CLASS_C_DEC:: get_eq_fn() { return *this; } PB_DS_CLASS_T_DEC const Eq_Fn& PB_DS_CLASS_C_DEC:: get_eq_fn() const { return *this; } PB_DS_CLASS_T_DEC Comb_Hash_Fn& PB_DS_CLASS_C_DEC:: get_comb_hash_fn() { return *this; } PB_DS_CLASS_T_DEC const Comb_Hash_Fn& PB_DS_CLASS_C_DEC:: get_comb_hash_fn() const { return *this; } PB_DS_CLASS_T_DEC Resize_Policy& PB_DS_CLASS_C_DEC:: get_resize_policy() { return *this; } PB_DS_CLASS_T_DEC const Resize_Policy& PB_DS_CLASS_C_DEC:: get_resize_policy() const { return *this; } �������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp�������������������������0000644�����������������00000004342�14763166030�0022426 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/resize_store_hash_fn_imps.hpp * Contains implementations of cc_ht_map_'s resize related functions, when the * hash value is stored. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::entry_pointer PB_DS_CLASS_C_DEC:: resize_imp_no_exceptions_reassign_pointer(entry_pointer p_e, entry_pointer_array a_p_entries_resized, true_type) { const comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash); entry_pointer const p_next_e = p_e->m_p_next; p_e->m_p_next = a_p_entries_resized[pos_hash_pair.first]; a_p_entries_resized[pos_hash_pair.first] = p_e; return p_next_e; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp������������������������������������0000644�����������������00000007736�14763166030�0020221 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/resize_fn_imps.hpp * Contains implementations of cc_ht_map_'s resize related functions. */ PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: do_resize_if_needed() { if (!resize_base::is_resize_needed()) return false; resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e)); return true; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: do_resize(size_type len) { resize_imp(resize_base::get_nearest_larger_size(len)); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: do_resize_if_needed_no_throw() { if (!resize_base::is_resize_needed()) return; __try { resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e)); } __catch(...) { } PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: resize_imp(size_type new_size) { PB_DS_ASSERT_VALID((*this)) if (new_size == m_num_e) return; const size_type old_size = m_num_e; entry_pointer_array a_p_entries_resized; // Following line might throw an exception. ranged_hash_fn_base::notify_resized(new_size); __try { // Following line might throw an exception. a_p_entries_resized = s_entry_pointer_allocator.allocate(new_size); m_num_e = new_size; } __catch(...) { ranged_hash_fn_base::notify_resized(old_size); __throw_exception_again; } // At this point no exceptions can be thrown. resize_imp_no_exceptions(new_size, a_p_entries_resized, old_size); Resize_Policy::notify_resized(new_size); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: resize_imp_no_exceptions(size_type new_size, entry_pointer_array a_p_entries_resized, size_type old_size) { std::fill(a_p_entries_resized, a_p_entries_resized + m_num_e, entry_pointer(0)); for (size_type pos = 0; pos < old_size; ++pos) { entry_pointer p_e = m_entries[pos]; while (p_e != 0) p_e = resize_imp_no_exceptions_reassign_pointer(p_e, a_p_entries_resized, traits_base::m_store_extra_indicator); } m_num_e = new_size; _GLIBCXX_DEBUG_ONLY(assert_entry_pointer_array_valid(a_p_entries_resized, __FILE__, __LINE__);) s_entry_pointer_allocator.deallocate(m_entries, old_size); m_entries = a_p_entries_resized; PB_DS_ASSERT_VALID((*this)) } #include <ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp> #include <ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp> ����������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp�������������������������������������0000644�����������������00000006255�14763166030�0020012 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/erase_fn_imps.hpp * Contains implementations of cc_ht_map_'s erase related functions. */ PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: erase_entry_pointer(entry_pointer& r_p_e) { _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(r_p_e->m_value))); entry_pointer p_e = r_p_e; r_p_e = r_p_e->m_p_next; rels_entry(p_e); _GLIBCXX_DEBUG_ASSERT(m_num_used_e > 0); resize_base::notify_erased(--m_num_used_e); } PB_DS_CLASS_T_DEC template<typename Pred> inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: erase_if(Pred pred) { size_type num_ersd = 0; for (size_type pos = 0; pos < m_num_e; ++pos) { while (m_entries[pos] != 0 && pred(m_entries[pos]->m_value)) { ++num_ersd; entry_pointer p_next_e = m_entries[pos]->m_p_next; erase_entry_pointer(m_entries[pos]); m_entries[pos] = p_next_e; } entry_pointer p_e = m_entries[pos]; while (p_e != 0 && p_e->m_p_next != 0) { if (pred(p_e->m_p_next->m_value)) { ++num_ersd; erase_entry_pointer(p_e->m_p_next); } else p_e = p_e->m_p_next; } } do_resize_if_needed_no_throw(); return num_ersd; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: clear() { for (size_type pos = 0; pos < m_num_e; ++pos) while (m_entries[pos] != 0) erase_entry_pointer(m_entries[pos]); do_resize_if_needed_no_throw(); resize_base::notify_cleared(); } #include <ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp> #include <ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp���������������������������������������0000644�����������������00000005315�14763166030�0017466 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/cmp_fn_imps.hpp * Contains implementations of cc_ht_map_'s entire container comparison related * functions. */ PB_DS_CLASS_T_DEC template<typename Other_HT_Map_Type> bool PB_DS_CLASS_C_DEC:: operator==(const Other_HT_Map_Type& other) const { return cmp_with_other(other); } PB_DS_CLASS_T_DEC template<typename Other_Map_Type> bool PB_DS_CLASS_C_DEC:: cmp_with_other(const Other_Map_Type& other) const { if (size() != other.size()) return false; for (typename Other_Map_Type::const_iterator it = other.begin(); it != other.end(); ++it) { key_const_reference r_key = key_const_reference(PB_DS_V2F(*it)); mapped_const_pointer p_mapped_value = const_cast<PB_DS_CLASS_C_DEC& >(*this). find_key_pointer(r_key, traits_base::m_store_extra_indicator); if (p_mapped_value == 0) return false; #ifdef PB_DS_DATA_TRUE_INDICATOR if (p_mapped_value->second != it->second) return false; #endif } return true; } PB_DS_CLASS_T_DEC template<typename Other_HT_Map_Type> bool PB_DS_CLASS_C_DEC:: operator!=(const Other_HT_Map_Type& other) const { return !operator==(other); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp��������������������������0000644�����������������00000006231�14763166030�0022223 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/erase_store_hash_fn_imps.hpp * Contains implementations of cc_ht_map_'s erase related functions, * when the hash value is stored. */ PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: erase_in_pos_imp(key_const_reference r_key, const comp_hash& r_pos_hash_pair) { PB_DS_ASSERT_VALID((*this)) entry_pointer p_e = m_entries[r_pos_hash_pair.first]; resize_base::notify_erase_search_start(); if (p_e == 0) { resize_base::notify_erase_search_end(); PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) PB_DS_ASSERT_VALID((*this)) return false; } if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash, r_key, r_pos_hash_pair.second)) { resize_base::notify_erase_search_end(); PB_DS_CHECK_KEY_EXISTS(r_key) erase_entry_pointer(m_entries[r_pos_hash_pair.first]); do_resize_if_needed_no_throw(); PB_DS_ASSERT_VALID((*this)) return true; } while (true) { entry_pointer p_next_e = p_e->m_p_next; if (p_next_e == 0) { resize_base::notify_erase_search_end(); PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) PB_DS_ASSERT_VALID((*this)) return false; } if (hash_eq_fn_base::operator()(PB_DS_V2F(p_next_e->m_value), p_next_e->m_hash, r_key, r_pos_hash_pair.second)) { resize_base::notify_erase_search_end(); PB_DS_CHECK_KEY_EXISTS(r_key) erase_entry_pointer(p_e->m_p_next); do_resize_if_needed_no_throw(); PB_DS_ASSERT_VALID((*this)) return true; } resize_base::notify_erase_search_collision(); p_e = p_next_e; } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp�������������������������������������0000644�����������������00000004473�14763166030�0020011 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/trace_fn_imps.hpp * Contains implementations of cc_ht_map_'s trace-mode functions. */ #ifdef PB_DS_HT_MAP_TRACE_ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace() const { std::cerr << static_cast<unsigned long>(m_num_e) << " " << static_cast<unsigned long>(m_num_used_e) << std::endl; for (size_type i = 0; i < m_num_e; ++i) { std::cerr << static_cast<unsigned long>(i) << " "; trace_list(m_entries[i]); std::cerr << std::endl; } } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace_list(const_entry_pointer p_l) const { size_type iterated_num_used_e = 0; while (p_l != 0) { std::cerr << PB_DS_V2F(p_l->m_value) << " "; p_l = p_l->m_p_next; } } #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp��������������������������������������0000644�����������������00000006047�14763166030�0017645 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/info_fn_imps.hpp * Contains implementations of cc_ht_map_'s entire container info related * functions. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: size() const { return m_num_used_e; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: max_size() const { return m_entry_allocator.max_size(); } PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: empty() const { return (size() == 0); } PB_DS_CLASS_T_DEC template<typename Other_HT_Map_Type> bool PB_DS_CLASS_C_DEC:: operator==(const Other_HT_Map_Type& other) const { return cmp_with_other(other); } PB_DS_CLASS_T_DEC template<typename Other_Map_Type> bool PB_DS_CLASS_C_DEC:: cmp_with_other(const Other_Map_Type& other) const { if (size() != other.size()) return false; for (typename Other_Map_Type::const_iterator it = other.begin(); it != other.end(); ++it) { key_const_reference r_key =(key_const_reference)PB_DS_V2F(*it); mapped_const_pointer p_mapped_value = const_cast<PB_DS_CLASS_C_DEC& >(*this). find_key_pointer(r_key, traits_base::m_store_extra_indicator); if (p_mapped_value == 0) return false; #ifdef PB_DS_DATA_TRUE_INDICATOR if (p_mapped_value->second != it->second) return false; #endif } return true; } PB_DS_CLASS_T_DEC template<typename Other_HT_Map_Type> bool PB_DS_CLASS_C_DEC:: operator!=(const Other_HT_Map_Type& other) const { return !operator==(other); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp�����������������������0000644�����������������00000006300�14763166030�0022714 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp * Contains implementations of cc_ht_map_'s erase related functions, * when the hash value is not stored. */ PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: erase(key_const_reference r_key) { PB_DS_ASSERT_VALID((*this)) return erase_in_pos_imp(r_key, ranged_hash_fn_base::operator()(r_key)); } PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: erase_in_pos_imp(key_const_reference r_key, size_type pos) { PB_DS_ASSERT_VALID((*this)) entry_pointer p_e = m_entries[pos]; resize_base::notify_erase_search_start(); if (p_e == 0) { resize_base::notify_erase_search_end(); PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) PB_DS_ASSERT_VALID((*this)) return false; } if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key)) { resize_base::notify_erase_search_end(); PB_DS_CHECK_KEY_EXISTS(r_key) erase_entry_pointer(m_entries[pos]); do_resize_if_needed_no_throw(); PB_DS_ASSERT_VALID((*this)) return true; } while (true) { entry_pointer p_next_e = p_e->m_p_next; if (p_next_e == 0) { resize_base::notify_erase_search_end(); PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) PB_DS_ASSERT_VALID((*this)) return false; } if (hash_eq_fn_base::operator()(PB_DS_V2F(p_next_e->m_value), r_key)) { resize_base::notify_erase_search_end(); PB_DS_CHECK_KEY_EXISTS(r_key) erase_entry_pointer(p_e->m_p_next); do_resize_if_needed_no_throw(); PB_DS_ASSERT_VALID((*this)) return true; } resize_base::notify_erase_search_collision(); p_e = p_next_e; } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp�������������������������������������0000644�����������������00000005205�14763166030�0017773 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file cc_hash_table_map_/debug_fn_imps.hpp * Contains implementations of cc_ht_map_'s debug-mode functions. */ #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_valid(const char* __file, int __line) const { debug_base::check_size(m_num_used_e, __file, __line); assert_entry_pointer_array_valid(m_entries, __file, __line); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_entry_pointer_array_valid(const entry_pointer_array a_p_entries, const char* __file, int __line) const { size_type iterated_num_used_e = 0; for (size_type pos = 0; pos < m_num_e; ++pos) { entry_pointer p_e = a_p_entries[pos]; while (p_e != 0) { ++iterated_num_used_e; assert_entry_pointer_valid(p_e, traits_base::m_store_extra_indicator, __file, __line); p_e = p_e->m_p_next; } } PB_DS_DEBUG_VERIFY(iterated_num_used_e == m_num_used_e); } #include <ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp> #include <ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp> #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp����������������������������������������������0000644�����������������00000004363�14763166030�0016204 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file sample_probe_fn.hpp * Contains a sample probe policy. */ #ifndef PB_DS_SAMPLE_PROBE_FN_HPP #define PB_DS_SAMPLE_PROBE_FN_HPP namespace __gnu_pbds { /// A sample probe policy. class sample_probe_fn { public: typedef std::size_t size_type; /// Default constructor. sample_probe_fn(); /// Copy constructor. sample_probe_fn(const sample_probe_fn&); /// Swaps content. inline void swap(sample_probe_fn&); protected: /// Returns the i-th offset from the hash value of some key r_key. inline size_type operator()(key_const_reference r_key, size_type i) const; }; } #endif // #ifndef PB_DS_SAMPLE_PROBE_FN_HPP �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp���������������������������������0000644�����������������00000004056�14763166030�0020703 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file direct_mod_range_hashing_imp.hpp * Contains a range-hashing policy implementation */ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { mod_based_base::swap(other); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: notify_resized(size_type n) { mod_based_base::notify_resized(n); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: operator()(size_type hash) const { return mod_based_base::range_hash(hash); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp����������������������������������������������0000644�����������������00000024304�14763166030�0016160 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file ranged_probe_fn.hpp * Contains a unified ranged probe functor, allowing the probe tables to deal with * a single class for ranged probeing. */ #ifndef PB_DS_RANGED_PROBE_FN_HPP #define PB_DS_RANGED_PROBE_FN_HPP #include <utility> #include <debug/debug.h> namespace __gnu_pbds { namespace detail { /// Primary template. template<typename Key, typename Hash_Fn, typename _Alloc, typename Comb_Probe_Fn, typename Probe_Fn, bool Store_Hash> class ranged_probe_fn; #define PB_DS_CLASS_T_DEC \ template<typename Key, typename Hash_Fn, typename _Alloc, \ typename Comb_Probe_Fn, typename Probe_Fn> #define PB_DS_CLASS_C_DEC \ ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, false> /** * Specialization 1 * The client supplies a probe function and a ranged probe * function, and requests that hash values not be stored. **/ template<typename Key, typename Hash_Fn, typename _Alloc, typename Comb_Probe_Fn, typename Probe_Fn> class ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, false> : public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn { protected: typedef typename _Alloc::size_type size_type; typedef Comb_Probe_Fn comb_probe_fn_base; typedef Hash_Fn hash_fn_base; typedef Probe_Fn probe_fn_base; typedef typename _Alloc::template rebind<Key>::other key_allocator; typedef typename key_allocator::const_reference key_const_reference; ranged_probe_fn(size_type); ranged_probe_fn(size_type, const Hash_Fn&); ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&); ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&, const Probe_Fn&); void swap(PB_DS_CLASS_C_DEC&); void notify_resized(size_type); inline size_type operator()(key_const_reference) const; inline size_type operator()(key_const_reference, size_type, size_type) const; }; PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_probe_fn(size_type size) { Comb_Probe_Fn::notify_resized(size); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn) : Hash_Fn(r_hash_fn) { Comb_Probe_Fn::notify_resized(size); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, const Comb_Probe_Fn& r_comb_probe_fn) : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn) { comb_probe_fn_base::notify_resized(size); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, const Comb_Probe_Fn& r_comb_probe_fn, const Probe_Fn& r_probe_fn) : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn), Probe_Fn(r_probe_fn) { comb_probe_fn_base::notify_resized(size); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { comb_probe_fn_base::swap(other); std::swap((Hash_Fn& )(*this), (Hash_Fn&)other); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: notify_resized(size_type size) { comb_probe_fn_base::notify_resized(size); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: operator()(key_const_reference r_key) const { return comb_probe_fn_base::operator()(hash_fn_base::operator()(r_key)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: operator()(key_const_reference, size_type hash, size_type i) const { return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i)); } #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #define PB_DS_CLASS_T_DEC \ template<typename Key, typename Hash_Fn, typename _Alloc, \ typename Comb_Probe_Fn, typename Probe_Fn> #define PB_DS_CLASS_C_DEC \ ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, true> /** * Specialization 2- The client supplies a probe function and a ranged * probe function, and requests that hash values not be stored. **/ template<typename Key, typename Hash_Fn, typename _Alloc, typename Comb_Probe_Fn, typename Probe_Fn> class ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, true> : public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn { protected: typedef typename _Alloc::size_type size_type; typedef std::pair<size_type, size_type> comp_hash; typedef Comb_Probe_Fn comb_probe_fn_base; typedef Hash_Fn hash_fn_base; typedef Probe_Fn probe_fn_base; typedef typename _Alloc::template rebind<Key>::other key_allocator; typedef typename key_allocator::const_reference key_const_reference; ranged_probe_fn(size_type); ranged_probe_fn(size_type, const Hash_Fn&); ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&); ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&, const Probe_Fn&); void swap(PB_DS_CLASS_C_DEC&); void notify_resized(size_type); inline comp_hash operator()(key_const_reference) const; inline size_type operator()(key_const_reference, size_type, size_type) const; inline size_type operator()(key_const_reference, size_type) const; }; PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_probe_fn(size_type size) { Comb_Probe_Fn::notify_resized(size); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn) : Hash_Fn(r_hash_fn) { Comb_Probe_Fn::notify_resized(size); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, const Comb_Probe_Fn& r_comb_probe_fn) : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn) { comb_probe_fn_base::notify_resized(size); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, const Comb_Probe_Fn& r_comb_probe_fn, const Probe_Fn& r_probe_fn) : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn), Probe_Fn(r_probe_fn) { comb_probe_fn_base::notify_resized(size); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { comb_probe_fn_base::swap(other); std::swap((Hash_Fn& )(*this), (Hash_Fn& )other); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: notify_resized(size_type size) { comb_probe_fn_base::notify_resized(size); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::comp_hash PB_DS_CLASS_C_DEC:: operator()(key_const_reference r_key) const { const size_type hash = hash_fn_base::operator()(r_key); return std::make_pair(comb_probe_fn_base::operator()(hash), hash); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: operator()(key_const_reference, size_type hash, size_type i) const { return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: operator() #ifdef _GLIBCXX_DEBUG (key_const_reference r_key, size_type hash) const #else (key_const_reference /*r_key*/, size_type hash) const #endif { _GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key)); return hash; } #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC /** * Specialization 3 and 4 * The client does not supply a hash function or probe function, * and requests that hash values not be stored. **/ template<typename Key, typename _Alloc, typename Comb_Probe_Fn> class ranged_probe_fn<Key, null_type, _Alloc, Comb_Probe_Fn, null_type, false> : public Comb_Probe_Fn { protected: typedef typename _Alloc::size_type size_type; typedef Comb_Probe_Fn comb_probe_fn_base; typedef typename _Alloc::template rebind<Key>::other key_allocator; typedef typename key_allocator::const_reference key_const_reference; ranged_probe_fn(size_type size) { Comb_Probe_Fn::notify_resized(size); } ranged_probe_fn(size_type, const Comb_Probe_Fn& r_comb_probe_fn) : Comb_Probe_Fn(r_comb_probe_fn) { } ranged_probe_fn(size_type, const null_type&, const Comb_Probe_Fn& r_comb_probe_fn, const null_type&) : Comb_Probe_Fn(r_comb_probe_fn) { } void swap(ranged_probe_fn& other) { comb_probe_fn_base::swap(other); } }; } // namespace detail } // namespace __gnu_pbds #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp�����������������������������������������������0000644�����������������00000024573�14763166030�0016004 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file ranged_hash_fn.hpp * Contains a unified ranged hash functor, allowing the hash tables * to deal with a single class for ranged hashing. */ #ifndef PB_DS_RANGED_HASH_FN_HPP #define PB_DS_RANGED_HASH_FN_HPP #include <utility> #include <debug/debug.h> namespace __gnu_pbds { namespace detail { /// Primary template. template<typename Key, typename Hash_Fn, typename _Alloc, typename Comb_Hash_Fn, bool Store_Hash> class ranged_hash_fn; #define PB_DS_CLASS_T_DEC \ template<typename Key, typename Hash_Fn, typename _Alloc, \ typename Comb_Hash_Fn> #define PB_DS_CLASS_C_DEC \ ranged_hash_fn<Key, Hash_Fn, _Alloc, Comb_Hash_Fn, false> /** * Specialization 1 * The client supplies a hash function and a ranged hash function, * and requests that hash values not be stored. **/ template<typename Key, typename Hash_Fn, typename _Alloc, typename Comb_Hash_Fn> class ranged_hash_fn< Key, Hash_Fn, _Alloc, Comb_Hash_Fn, false> : public Hash_Fn, public Comb_Hash_Fn { protected: typedef typename _Alloc::size_type size_type; typedef Hash_Fn hash_fn_base; typedef Comb_Hash_Fn comb_hash_fn_base; typedef typename _Alloc::template rebind< Key>::other key_allocator; typedef typename key_allocator::const_reference key_const_reference; ranged_hash_fn(size_type); ranged_hash_fn(size_type, const Hash_Fn&); ranged_hash_fn(size_type, const Hash_Fn&, const Comb_Hash_Fn&); void swap(PB_DS_CLASS_C_DEC&); void notify_resized(size_type); inline size_type operator()(key_const_reference) const; }; PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_hash_fn(size_type size) { Comb_Hash_Fn::notify_resized(size); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn) : Hash_Fn(r_hash_fn) { Comb_Hash_Fn::notify_resized(size); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn, const Comb_Hash_Fn& r_comb_hash_fn) : Hash_Fn(r_hash_fn), Comb_Hash_Fn(r_comb_hash_fn) { comb_hash_fn_base::notify_resized(size); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { comb_hash_fn_base::swap(other); std::swap((Hash_Fn& )(*this), (Hash_Fn& )other); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: notify_resized(size_type size) { comb_hash_fn_base::notify_resized(size); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: operator()(key_const_reference r_key) const { return (comb_hash_fn_base::operator()(hash_fn_base::operator()(r_key)));} #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #define PB_DS_CLASS_T_DEC \ template<typename Key, typename Hash_Fn, typename _Alloc, \ typename Comb_Hash_Fn> #define PB_DS_CLASS_C_DEC \ ranged_hash_fn<Key,Hash_Fn, _Alloc, Comb_Hash_Fn, true> /** * Specialization 2 * The client supplies a hash function and a ranged hash function, * and requests that hash values be stored. **/ template<typename Key, typename Hash_Fn, typename _Alloc, typename Comb_Hash_Fn> class ranged_hash_fn<Key, Hash_Fn, _Alloc, Comb_Hash_Fn, true> : public Hash_Fn, public Comb_Hash_Fn { protected: typedef typename _Alloc::size_type size_type; typedef std::pair<size_type, size_type> comp_hash; typedef Hash_Fn hash_fn_base; typedef Comb_Hash_Fn comb_hash_fn_base; typedef typename _Alloc::template rebind<Key>::other key_allocator; typedef typename key_allocator::const_reference key_const_reference; ranged_hash_fn(size_type); ranged_hash_fn(size_type, const Hash_Fn&); ranged_hash_fn(size_type, const Hash_Fn&, const Comb_Hash_Fn&); void swap(PB_DS_CLASS_C_DEC&); void notify_resized(size_type); inline comp_hash operator()(key_const_reference) const; inline comp_hash operator()(key_const_reference, size_type) const; }; PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_hash_fn(size_type size) { Comb_Hash_Fn::notify_resized(size); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn) : Hash_Fn(r_hash_fn) { Comb_Hash_Fn::notify_resized(size); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn, const Comb_Hash_Fn& r_comb_hash_fn) : Hash_Fn(r_hash_fn), Comb_Hash_Fn(r_comb_hash_fn) { comb_hash_fn_base::notify_resized(size); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { comb_hash_fn_base::swap(other); std::swap((Hash_Fn& )(*this), (Hash_Fn& )other); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: notify_resized(size_type size) { comb_hash_fn_base::notify_resized(size); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::comp_hash PB_DS_CLASS_C_DEC:: operator()(key_const_reference r_key) const { const size_type hash = hash_fn_base::operator()(r_key); return std::make_pair(comb_hash_fn_base::operator()(hash), hash); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::comp_hash PB_DS_CLASS_C_DEC:: operator() #ifdef _GLIBCXX_DEBUG (key_const_reference r_key, size_type hash) const #else (key_const_reference /*r_key*/, size_type hash) const #endif { _GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key)); return std::make_pair(comb_hash_fn_base::operator()(hash), hash); } #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #define PB_DS_CLASS_T_DEC \ template<typename Key, typename _Alloc, typename Comb_Hash_Fn> #define PB_DS_CLASS_C_DEC \ ranged_hash_fn<Key, null_type, _Alloc, Comb_Hash_Fn, false> /** * Specialization 3 * The client does not supply a hash function (by specifying * null_type as the Hash_Fn parameter), and requests that hash * values not be stored. **/ template<typename Key, typename _Alloc, typename Comb_Hash_Fn> class ranged_hash_fn<Key, null_type, _Alloc, Comb_Hash_Fn, false> : public Comb_Hash_Fn { protected: typedef typename _Alloc::size_type size_type; typedef Comb_Hash_Fn comb_hash_fn_base; ranged_hash_fn(size_type); ranged_hash_fn(size_type, const Comb_Hash_Fn&); ranged_hash_fn(size_type, const null_type&, const Comb_Hash_Fn&); void swap(PB_DS_CLASS_C_DEC&); }; PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_hash_fn(size_type size) { Comb_Hash_Fn::notify_resized(size); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_hash_fn(size_type size, const Comb_Hash_Fn& r_comb_hash_fn) : Comb_Hash_Fn(r_comb_hash_fn) { } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_hash_fn(size_type size, const null_type& r_null_type, const Comb_Hash_Fn& r_comb_hash_fn) : Comb_Hash_Fn(r_comb_hash_fn) { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { comb_hash_fn_base::swap(other); } #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #define PB_DS_CLASS_T_DEC \ template<typename Key, typename _Alloc, typename Comb_Hash_Fn> #define PB_DS_CLASS_C_DEC \ ranged_hash_fn<Key, null_type, _Alloc, Comb_Hash_Fn, true> /** * Specialization 4 * The client does not supply a hash function (by specifying * null_type as the Hash_Fn parameter), and requests that hash * values be stored. **/ template<typename Key, typename _Alloc, typename Comb_Hash_Fn> class ranged_hash_fn<Key, null_type, _Alloc, Comb_Hash_Fn, true> : public Comb_Hash_Fn { protected: typedef typename _Alloc::size_type size_type; typedef Comb_Hash_Fn comb_hash_fn_base; ranged_hash_fn(size_type); ranged_hash_fn(size_type, const Comb_Hash_Fn&); ranged_hash_fn(size_type, const null_type&, const Comb_Hash_Fn&); void swap(PB_DS_CLASS_C_DEC&); }; PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_hash_fn(size_type size) { Comb_Hash_Fn::notify_resized(size); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_hash_fn(size_type size, const Comb_Hash_Fn& r_comb_hash_fn) : Comb_Hash_Fn(r_comb_hash_fn) { } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ranged_hash_fn(size_type size, const null_type& r_null_type, const Comb_Hash_Fn& r_comb_hash_fn) : Comb_Hash_Fn(r_comb_hash_fn) { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { comb_hash_fn_base::swap(other); } #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC } // namespace detail } // namespace __gnu_pbds #endif �������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp������������������������������������������������0000644�����������������00000003731�14763166030�0015633 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file probe_fn_base.hpp * Contains a probe policy base. */ #ifndef PB_DS_PROBE_FN_BASE_HPP #define PB_DS_PROBE_FN_BASE_HPP #include <functional> namespace __gnu_pbds { namespace detail { /// Probe functor base. template<typename _Alloc> class probe_fn_base { protected: ~probe_fn_base() { } }; } // namespace detail } // namespace __gnu_pbds #endif ���������������������������������������c++/4.8.2/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp��������������������������������������0000644�����������������00000004527�14763166030�0017645 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file mod_based_range_hashing.hpp * Contains a range hashing policy base. */ #ifndef PB_DS_MOD_BASED_RANGE_HASHING_HPP #define PB_DS_MOD_BASED_RANGE_HASHING_HPP namespace __gnu_pbds { namespace detail { /// Mod based range hashing. template<typename Size_Type> class mod_based_range_hashing { protected: typedef Size_Type size_type; void swap(mod_based_range_hashing& other) { std::swap(m_size, other.m_size); } void notify_resized(size_type s) { m_size = s; } inline size_type range_hash(size_type s) const { return s % m_size; } private: size_type m_size; }; } // namespace detail } // namespace __gnu_pbds #endif // #ifndef PB_DS_MOD_BASED_RANGE_HASHING_HPP �������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp�����������������������������������������0000644�����������������00000004667�14763166030�0017216 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file sample_range_hashing.hpp * Contains a range hashing policy. */ #ifndef PB_DS_SAMPLE_RANGE_HASHING_HPP #define PB_DS_SAMPLE_RANGE_HASHING_HPP namespace __gnu_pbds { /// A sample range-hashing functor. class sample_range_hashing { public: /// Size type. typedef std::size_t size_type; /// Default constructor. sample_range_hashing(); /// Copy constructor. sample_range_hashing(const sample_range_hashing& other); /// Swaps content. inline void swap(sample_range_hashing& other); protected: /// Notifies the policy object that the container's size has /// changed to argument's size. void notify_resized(size_type); /// Transforms the __hash value hash into a ranged-hash value. inline size_type operator()(size_type ) const; }; } #endif // #ifndef PB_DS_SAMPLE_RANGE_HASHING_HPP �������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp���������������������������������������0000644�����������������00000003600�14763166030�0017536 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file quadratic_probe_fn_imp.hpp * Contains a probe policy implementation */ PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: operator()(size_type i) const { return (i* i); } ��������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp�������������������������������������0000644�����������������00000006332�14763166030�0020015 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file mask_based_range_hashing.hpp * Contains a range hashing policy base. */ #ifndef PB_DS_MASK_BASED_RANGE_HASHING_HPP #define PB_DS_MASK_BASED_RANGE_HASHING_HPP namespace __gnu_pbds { namespace detail { /// Range hashing policy. template<typename Size_Type> class mask_based_range_hashing { protected: typedef Size_Type size_type; void swap(mask_based_range_hashing& other) { std::swap(m_mask, other.m_mask); } void notify_resized(size_type size); inline size_type range_hash(size_type hash) const { return size_type(hash & m_mask); } private: size_type m_mask; const static size_type s_num_bits_in_size_type; const static size_type s_highest_bit_1; }; template<typename Size_Type> const typename mask_based_range_hashing<Size_Type>::size_type mask_based_range_hashing<Size_Type>::s_num_bits_in_size_type = sizeof(typename mask_based_range_hashing<Size_Type>::size_type) << 3; template<typename Size_Type> const typename mask_based_range_hashing<Size_Type>::size_type mask_based_range_hashing<Size_Type>::s_highest_bit_1 = static_cast<typename mask_based_range_hashing<Size_Type>::size_type>(1) << (s_num_bits_in_size_type - 1); template<typename Size_Type> void mask_based_range_hashing<Size_Type>:: notify_resized(size_type size) { size_type i = 0; while (size ^ s_highest_bit_1) { size <<= 1; ++i; } m_mask = 1; i += 2; while (i++ < s_num_bits_in_size_type) m_mask = (m_mask << 1) ^ 1; } } // namespace detail } // namespace __gnu_pbds #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp����������������������������������������0000644�����������������00000004645�14763166030�0017343 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file sample_ranged_hash_fn.hpp * Contains a ranged hash policy. */ #ifndef PB_DS_SAMPLE_RANGED_HASH_FN_HPP #define PB_DS_SAMPLE_RANGED_HASH_FN_HPP namespace __gnu_pbds { /// A sample ranged-hash functor. class sample_ranged_hash_fn { public: typedef std::size_t size_type; /// Default constructor. sample_ranged_hash_fn(); /// Copy constructor. sample_ranged_hash_fn(const sample_ranged_hash_fn&); /// Swaps content. inline void swap(sample_ranged_hash_fn&); protected: /// Notifies the policy object that the container's __size has /// changed to size. void notify_resized(size_type); /// Transforms key_const_reference into a position within the table. inline size_type operator()(key_const_reference) const; }; } #endif // #ifndef PB_DS_SAMPLE_RANGED_HASH_FN_HPP �������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp������������������������������������������0000644�����������������00000003571�14763166030�0017042 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file linear_probe_fn_imp.hpp * Contains a probe policy implementation */ PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: operator()(size_type i) const { return (i); } ���������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp��������������������������������0000644�����������������00000004070�14763166030�0021053 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file direct_mask_range_hashing_imp.hpp * Contains a range-hashing policy implementation */ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { mask_based_base::swap(other); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: notify_resized(size_type size) { mask_based_base::notify_resized(size); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: operator()(size_type hash) const { return mask_based_base::range_hash(hash); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp���������������������������������������0000644�����������������00000005046�14763166030�0017523 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file sample_ranged_probe_fn.hpp * Contains a ranged probe policy. */ #ifndef PB_DS_SAMPLE_RANGED_PROBE_FN_HPP #define PB_DS_SAMPLE_RANGED_PROBE_FN_HPP namespace __gnu_pbds { /// A sample ranged-probe functor. class sample_ranged_probe_fn { public: typedef std::size_t size_type; // Default constructor. sample_ranged_probe_fn(); // Copy constructor. sample_ranged_probe_fn(const sample_ranged_probe_fn&); // Swaps content. inline void swap(sample_ranged_probe_fn&); protected: // Notifies the policy object that the container's __size has // changed to size. void notify_resized(size_type); // Transforms the const key reference r_key into the i-th position // within the table. This method is called for each collision within // the probe sequence. inline size_type operator()(key_const_reference, std::size_t, size_type) const; }; } #endif // #ifndef PB_DS_SAMPLE_RANGED_PROBE_FN_HPP ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/container_base_dispatch.hpp����������������������������������������������0000644�����������������00000031500�14763166030�0016267 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file container_base_dispatch.hpp * Contains associative container dispatching. */ #ifndef PB_DS_ASSOC_CNTNR_BASE_DS_DISPATCHER_HPP #define PB_DS_ASSOC_CNTNR_BASE_DS_DISPATCHER_HPP #include <ext/typelist.h> #define PB_DS_ASSERT_VALID(X) \ _GLIBCXX_DEBUG_ONLY(X.assert_valid(__FILE__, __LINE__);) #define PB_DS_DEBUG_VERIFY(_Cond) \ _GLIBCXX_DEBUG_VERIFY_AT(_Cond, \ _M_message(#_Cond" assertion from %1;:%2;") \ ._M_string(__FILE__)._M_integer(__LINE__) \ ,__file,__line) #define PB_DS_CHECK_KEY_EXISTS(_Key) \ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(_Key, __FILE__, __LINE__);) #define PB_DS_CHECK_KEY_DOES_NOT_EXIST(_Key) \ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(_Key, \ __FILE__, __LINE__);) #define PB_DS_DATA_TRUE_INDICATOR #define PB_DS_V2F(X) (X).first #define PB_DS_V2S(X) (X).second #define PB_DS_EP2VP(X)& ((X)->m_value) #include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp> #include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp> #include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp> #include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp> #include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp> #include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp> #include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp> #include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp> #undef PB_DS_DATA_TRUE_INDICATOR #undef PB_DS_V2F #undef PB_DS_V2S #undef PB_DS_EP2VP #define PB_DS_DATA_FALSE_INDICATOR #define PB_DS_V2F(X) (X) #define PB_DS_V2S(X) Mapped_Data() #define PB_DS_EP2VP(X)& ((X)->m_value.first) #include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp> #include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp> #include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp> #include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp> #include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp> #include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp> #include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp> #include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp> #undef PB_DS_DATA_FALSE_INDICATOR #undef PB_DS_V2F #undef PB_DS_V2S #undef PB_DS_EP2VP #undef PB_DS_CHECK_KEY_DOES_NOT_EXIST #undef PB_DS_CHECK_KEY_EXISTS #undef PB_DS_DEBUG_VERIFY #undef PB_DS_ASSERT_VALID namespace __gnu_pbds { namespace detail { /// Specialization for list-update map. template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl> struct container_base_dispatch<Key, Mapped, _Alloc, list_update_tag, Policy_Tl> { private: typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; typedef typename at0::type at0t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; typedef typename at1::type at1t; public: /// Dispatched type. typedef lu_map<Key, Mapped, at0t, _Alloc, at1t> type; }; /// Specialization for list-update set. template<typename Key, typename _Alloc, typename Policy_Tl> struct container_base_dispatch<Key, null_type, _Alloc, list_update_tag, Policy_Tl> { private: typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; typedef typename at0::type at0t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; typedef typename at1::type at1t; public: /// Dispatched type. typedef lu_set<Key, null_type, at0t, _Alloc, at1t> type; }; /// Specialization for PATRICIA trie map. template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl> struct container_base_dispatch<Key, Mapped, _Alloc, pat_trie_tag, Policy_Tl> { private: typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; typedef typename at1::type at1t; public: typedef pat_trie_map<Key, Mapped, at1t, _Alloc> type; }; /// Specialization for PATRICIA trie set. template<typename Key, typename _Alloc, typename Policy_Tl> struct container_base_dispatch<Key, null_type, _Alloc, pat_trie_tag, Policy_Tl> { private: typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; typedef typename at1::type at1t; public: /// Dispatched type. typedef pat_trie_set<Key, null_type, at1t, _Alloc> type; }; /// Specialization for R-B tree map. template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl> struct container_base_dispatch<Key, Mapped, _Alloc, rb_tree_tag, Policy_Tl> { private: typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; typedef typename at0::type at0t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; typedef typename at1::type at1t; public: /// Dispatched type. typedef rb_tree_map<Key, Mapped, at0t, at1t, _Alloc> type; }; /// Specialization for R-B tree set. template<typename Key, typename _Alloc, typename Policy_Tl> struct container_base_dispatch<Key, null_type, _Alloc, rb_tree_tag, Policy_Tl> { private: typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; typedef typename at0::type at0t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; typedef typename at1::type at1t; public: typedef rb_tree_set<Key, null_type, at0t, at1t, _Alloc> type; }; /// Specialization splay tree map. template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl> struct container_base_dispatch<Key, Mapped, _Alloc, splay_tree_tag, Policy_Tl> { private: typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; typedef typename at0::type at0t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; typedef typename at1::type at1t; public: /// Dispatched type. typedef splay_tree_map<Key, Mapped, at0t, at1t, _Alloc> type; }; /// Specialization splay tree set. template<typename Key, typename _Alloc, typename Policy_Tl> struct container_base_dispatch<Key, null_type, _Alloc, splay_tree_tag, Policy_Tl> { private: typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; typedef typename at0::type at0t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; typedef typename at1::type at1t; public: /// Dispatched type. typedef splay_tree_set<Key, null_type, at0t, at1t, _Alloc> type; }; /// Specialization ordered-vector tree map. template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl> struct container_base_dispatch<Key, Mapped, _Alloc, ov_tree_tag, Policy_Tl> { private: typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; typedef typename at0::type at0t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; typedef typename at1::type at1t; public: /// Dispatched type. typedef ov_tree_map<Key, Mapped, at0t, at1t, _Alloc> type; }; /// Specialization ordered-vector tree set. template<typename Key, typename _Alloc, typename Policy_Tl> struct container_base_dispatch<Key, null_type, _Alloc, ov_tree_tag, Policy_Tl> { private: typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; typedef typename at0::type at0t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; typedef typename at1::type at1t; public: /// Dispatched type. typedef ov_tree_set<Key, null_type, at0t, at1t, _Alloc> type; }; /// Specialization colision-chaining hash map. template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl> struct container_base_dispatch<Key, Mapped, _Alloc, cc_hash_tag, Policy_Tl> { private: typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; typedef typename at0::type at0t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; typedef typename at1::type at1t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2; typedef typename at2::type at2t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3; typedef typename at3::type at3t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4; typedef typename at4::type at4t; public: /// Dispatched type. typedef cc_ht_map<Key, Mapped, at0t, at1t, _Alloc, at3t::value, at4t, at2t> type; }; /// Specialization colision-chaining hash set. template<typename Key, typename _Alloc, typename Policy_Tl> struct container_base_dispatch<Key, null_type, _Alloc, cc_hash_tag, Policy_Tl> { private: typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; typedef typename at0::type at0t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; typedef typename at1::type at1t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2; typedef typename at2::type at2t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3; typedef typename at3::type at3t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4; typedef typename at4::type at4t; public: /// Dispatched type. typedef cc_ht_set<Key, null_type, at0t, at1t, _Alloc, at3t::value, at4t, at2t> type; }; /// Specialization general-probe hash map. template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl> struct container_base_dispatch<Key, Mapped, _Alloc, gp_hash_tag, Policy_Tl> { private: typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; typedef typename at0::type at0t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; typedef typename at1::type at1t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2; typedef typename at2::type at2t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3; typedef typename at3::type at3t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4; typedef typename at4::type at4t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 5> at5; typedef typename at5::type at5t; public: /// Dispatched type. typedef gp_ht_map<Key, Mapped, at0t, at1t, _Alloc, at3t::value, at4t, at5t, at2t> type; }; /// Specialization general-probe hash set. template<typename Key, typename _Alloc, typename Policy_Tl> struct container_base_dispatch<Key, null_type, _Alloc, gp_hash_tag, Policy_Tl> { private: typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; typedef typename at0::type at0t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; typedef typename at1::type at1t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2; typedef typename at2::type at2t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3; typedef typename at3::type at3t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4; typedef typename at4::type at4t; typedef __gnu_cxx::typelist::at_index<Policy_Tl, 5> at5; typedef typename at5::type at5t; public: /// Dispatched type. typedef gp_ht_set<Key, null_type, at0t, at1t, _Alloc, at3t::value, at4t, at5t, at2t> type; }; } // namespace detail } // namespace __gnu_pbds #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp��������������������������������������������0000644�����������������00000005550�14763166030�0016543 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pat_trie_/r_erase_fn_imps.hpp * Contains an implementation class for pat_trie. */ PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: actual_erase_node(node_pointer p_z) { _GLIBCXX_DEBUG_ASSERT(m_size > 0); --m_size; _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_z->m_value))); p_z->~node(); s_node_allocator.deallocate(p_z, 1); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: update_min_max_for_erased_node(node_pointer p_z) { if (m_size == 1) { m_p_head->m_p_left = m_p_head->m_p_right = m_p_head; return; } if (m_p_head->m_p_left == p_z) { iterator it(p_z); ++it; m_p_head->m_p_left = it.m_p_nd; } else if (m_p_head->m_p_right == p_z) { iterator it(p_z); --it; m_p_head->m_p_right = it.m_p_nd; } } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: clear() { _GLIBCXX_DEBUG_ONLY(assert_valid(true, true);) clear_imp(m_p_head->m_p_parent); m_size = 0; initialize(); _GLIBCXX_DEBUG_ONLY(debug_base::clear();) _GLIBCXX_DEBUG_ONLY(assert_valid(true, true);) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: clear_imp(node_pointer p_nd) { if (p_nd == 0) return; clear_imp(p_nd->m_p_left); clear_imp(p_nd->m_p_right); p_nd->~Node(); s_node_allocator.deallocate(p_nd, 1); } ��������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp���������������������������������������������0000644�����������������00000003772�14763166030�0016411 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pat_trie_/update_fn_imps.hpp * Contains an implementation class for pat_trie_. */ PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: apply_update(node_pointer, null_node_update_pointer) { } PB_DS_CLASS_T_DEC template<typename Node_Update_> inline void PB_DS_CLASS_C_DEC:: apply_update(node_pointer p_nd, Node_Update_*) { Node_Update_::operator()(node_iterator(p_nd, this), node_const_iterator(0, this)); } ������c++/4.8.2/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp����������������������������������������������0000644�����������������00000017055�14763166030�0016261 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pat_trie_/split_fn_imps.hpp * Contains an implementation class for pat_trie. */ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: split(key_const_reference r_key, PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) branch_bag bag; leaf_pointer p_split_lf = split_prep(r_key, other, bag); if (p_split_lf == 0) { _GLIBCXX_DEBUG_ASSERT(bag.empty()); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) return; } _GLIBCXX_DEBUG_ASSERT(!bag.empty()); other.clear(); m_p_head->m_p_parent = rec_split(m_p_head->m_p_parent, pref_begin(p_split_lf), pref_end(p_split_lf), other, bag); m_p_head->m_p_parent->m_p_parent = m_p_head; head_pointer __ohead = other.m_p_head; __ohead->m_p_max = m_p_head->m_p_max; m_p_head->m_p_max = rightmost_descendant(m_p_head->m_p_parent); __ohead->m_p_min = other.leftmost_descendant(__ohead->m_p_parent); other.m_size = std::distance(other.PB_DS_CLASS_C_DEC::begin(), other.PB_DS_CLASS_C_DEC::end()); m_size -= other.m_size; PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::leaf_pointer PB_DS_CLASS_C_DEC:: split_prep(key_const_reference r_key, PB_DS_CLASS_C_DEC& other, branch_bag& r_bag) { _GLIBCXX_DEBUG_ASSERT(r_bag.empty()); if (m_size == 0) { other.clear(); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) return 0; } if (synth_access_traits::cmp_keys(r_key, PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_min)->value()))) { other.clear(); value_swap(other); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) return 0; } if (!synth_access_traits::cmp_keys(r_key, PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_max)->value()))) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) return 0; } iterator it = lower_bound(r_key); if (!synth_access_traits::equal_keys(PB_DS_V2F(*it), r_key)) --it; node_pointer p_nd = it.m_p_nd; _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == leaf_node); leaf_pointer p_ret_l = static_cast<leaf_pointer>(p_nd); while (p_nd->m_type != head_node) { r_bag.add_branch(); p_nd = p_nd->m_p_parent; } _GLIBCXX_DEBUG_ONLY(debug_base::split(r_key,(synth_access_traits&)(*this), other);) return p_ret_l; } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: rec_split(node_pointer p_nd, a_const_iterator b_it, a_const_iterator e_it, PB_DS_CLASS_C_DEC& other, branch_bag& r_bag) { if (p_nd->m_type == leaf_node) { _GLIBCXX_DEBUG_ASSERT(other.m_p_head->m_p_parent == 0); return p_nd; } _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node); inode_pointer p_ind = static_cast<inode_pointer>(p_nd); node_pointer pfirst = p_ind->get_child_node(b_it, e_it, this); node_pointer p_child_ret = rec_split(pfirst, b_it, e_it, other, r_bag); PB_DS_ASSERT_NODE_VALID(p_child_ret) p_ind->replace_child(p_child_ret, b_it, e_it, this); apply_update(p_ind, (node_update*)this); inode_iterator child_it = p_ind->get_child_it(b_it, e_it, this); const size_type lhs_dist = std::distance(p_ind->begin(), child_it); const size_type lhs_num_children = lhs_dist + 1; _GLIBCXX_DEBUG_ASSERT(lhs_num_children > 0); const size_type rhs_dist = std::distance(p_ind->begin(), p_ind->end()); size_type rhs_num_children = rhs_dist - lhs_num_children; if (rhs_num_children == 0) { apply_update(p_ind, (node_update*)this); return p_ind; } other.split_insert_branch(p_ind->get_e_ind(), b_it, child_it, rhs_num_children, r_bag); child_it = p_ind->get_child_it(b_it, e_it, this); while (rhs_num_children != 0) { ++child_it; p_ind->remove_child(child_it); --rhs_num_children; } apply_update(p_ind, (node_update*)this); const size_type int_dist = std::distance(p_ind->begin(), p_ind->end()); _GLIBCXX_DEBUG_ASSERT(int_dist >= 1); if (int_dist > 1) { p_ind->update_prefixes(this); PB_DS_ASSERT_NODE_VALID(p_ind) apply_update(p_ind, (node_update*)this); return p_ind; } node_pointer p_ret = *p_ind->begin(); p_ind->~inode(); s_inode_allocator.deallocate(p_ind, 1); apply_update(p_ret, (node_update*)this); return p_ret; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: split_insert_branch(size_type e_ind, a_const_iterator b_it, inode_iterator child_b_it, size_type num_children, branch_bag& r_bag) { #ifdef _GLIBCXX_DEBUG if (m_p_head->m_p_parent != 0) PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent) #endif const size_type start = m_p_head->m_p_parent == 0 ? 0 : 1; const size_type total_num_children = start + num_children; if (total_num_children == 0) { _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == 0); return; } if (total_num_children == 1) { if (m_p_head->m_p_parent != 0) { PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent) return; } _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == 0); ++child_b_it; m_p_head->m_p_parent = *child_b_it; m_p_head->m_p_parent->m_p_parent = m_p_head; apply_update(m_p_head->m_p_parent, (node_update*)this); PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent) return; } _GLIBCXX_DEBUG_ASSERT(total_num_children > 1); inode_pointer p_new_root = r_bag.get_branch(); new (p_new_root) inode(e_ind, b_it); size_type num_inserted = 0; while (num_inserted++ < num_children) { ++child_b_it; PB_DS_ASSERT_NODE_VALID((*child_b_it)) p_new_root->add_child(*child_b_it, pref_begin(*child_b_it), pref_end(*child_b_it), this); } if (m_p_head->m_p_parent != 0) p_new_root->add_child(m_p_head->m_p_parent, pref_begin(m_p_head->m_p_parent), pref_end(m_p_head->m_p_parent), this); m_p_head->m_p_parent = p_new_root; p_new_root->m_p_parent = m_p_head; apply_update(m_p_head->m_p_parent, (node_update*)this); PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent) } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp���������������������������������������������0000644�����������������00000010352�14763166030�0016415 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pat_trie_/rotate_fn_imps.hpp * Contains imps for rotating nodes. */ PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: rotate_left(node_pointer p_x) { node_pointer p_y = p_x->m_p_right; p_x->m_p_right = p_y->m_p_left; if (p_y->m_p_left != 0) p_y->m_p_left->m_p_parent = p_x; p_y->m_p_parent = p_x->m_p_parent; if (p_x == m_p_head->m_p_parent) m_p_head->m_p_parent = p_y; else if (p_x == p_x->m_p_parent->m_p_left) p_x->m_p_parent->m_p_left = p_y; else p_x->m_p_parent->m_p_right = p_y; p_y->m_p_left = p_x; p_x->m_p_parent = p_y; _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_x);) _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y);) apply_update(p_x, (Node_Update*)this); apply_update(p_x->m_p_parent, (Node_Update*)this); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: rotate_right(node_pointer p_x) { node_pointer p_y = p_x->m_p_left; p_x->m_p_left = p_y->m_p_right; if (p_y->m_p_right != 0) p_y->m_p_right->m_p_parent = p_x; p_y->m_p_parent = p_x->m_p_parent; if (p_x == m_p_head->m_p_parent) m_p_head->m_p_parent = p_y; else if (p_x == p_x->m_p_parent->m_p_right) p_x->m_p_parent->m_p_right = p_y; else p_x->m_p_parent->m_p_left = p_y; p_y->m_p_right = p_x; p_x->m_p_parent = p_y; _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_x);) _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y);) apply_update(p_x, (Node_Update*)this); apply_update(p_x->m_p_parent, (Node_Update*)this); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: rotate_parent(node_pointer p_nd) { node_pointer p_parent = p_nd->m_p_parent; if (p_nd == p_parent->m_p_left) rotate_right(p_parent); else rotate_left(p_parent); _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_parent = p_nd); _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left == p_parent || p_nd->m_p_right == p_parent); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: apply_update(node_pointer /*p_nd*/, __gnu_pbds::null_node_update* /*p_update*/) { } PB_DS_CLASS_T_DEC template<typename Node_Update_> inline void PB_DS_CLASS_C_DEC:: apply_update(node_pointer p_nd, Node_Update_* p_update) { p_update->operator()(& PB_DS_V2F(p_nd->m_value),(p_nd->m_p_left == 0) ? 0 : & PB_DS_V2F(p_nd->m_p_left->m_value),(p_nd->m_p_right == 0) ? 0 : & PB_DS_V2F(p_nd->m_p_right->m_value)); } PB_DS_CLASS_T_DEC template<typename Node_Update_> inline void PB_DS_CLASS_C_DEC:: update_to_top(node_pointer p_nd, Node_Update_* p_update) { while (p_nd != m_p_head) { apply_update(p_nd, p_update); p_nd = p_nd->m_p_parent; } } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: update_to_top(node_pointer /*p_nd*/, __gnu_pbds::null_node_update* /*p_update*/) { } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp����������������������������0000644�����������������00000013120�14763166030�0022141 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� // -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pat_trie_/constructors_destructor_fn_imps.hpp * Contains an implementation class for pat_trie. */ PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::head_allocator PB_DS_CLASS_C_DEC::s_head_allocator; PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::inode_allocator PB_DS_CLASS_C_DEC::s_inode_allocator; PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::leaf_allocator PB_DS_CLASS_C_DEC::s_leaf_allocator; PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_PAT_TRIE_NAME() : m_p_head(s_head_allocator.allocate(1)), m_size(0) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_PAT_TRIE_NAME(const access_traits& r_access_traits) : synth_access_traits(r_access_traits), m_p_head(s_head_allocator.allocate(1)), m_size(0) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_PAT_TRIE_NAME(const PB_DS_CLASS_C_DEC& other) : #ifdef _GLIBCXX_DEBUG debug_base(other), #endif synth_access_traits(other), node_update(other), m_p_head(s_head_allocator.allocate(1)), m_size(0) { initialize(); m_size = other.m_size; PB_DS_ASSERT_VALID(other) if (other.m_p_head->m_p_parent == 0) { PB_DS_ASSERT_VALID((*this)) return; } __try { m_p_head->m_p_parent = recursive_copy_node(other.m_p_head->m_p_parent); } __catch(...) { s_head_allocator.deallocate(m_p_head, 1); __throw_exception_again; } m_p_head->m_p_min = leftmost_descendant(m_p_head->m_p_parent); m_p_head->m_p_max = rightmost_descendant(m_p_head->m_p_parent); m_p_head->m_p_parent->m_p_parent = m_p_head; PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) value_swap(other); std::swap((access_traits& )(*this), (access_traits& )other); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: value_swap(PB_DS_CLASS_C_DEC& other) { _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);) std::swap(m_p_head, other.m_p_head); std::swap(m_size, other.m_size); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ~PB_DS_PAT_TRIE_NAME() { clear(); s_head_allocator.deallocate(m_p_head, 1); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: initialize() { new (m_p_head) head(); m_p_head->m_p_parent = 0; m_p_head->m_p_min = m_p_head; m_p_head->m_p_max = m_p_head; m_size = 0; } PB_DS_CLASS_T_DEC template<typename It> void PB_DS_CLASS_C_DEC:: copy_from_range(It first_it, It last_it) { while (first_it != last_it) insert(*(first_it++)); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: recursive_copy_node(node_const_pointer p_ncp) { _GLIBCXX_DEBUG_ASSERT(p_ncp != 0); if (p_ncp->m_type == leaf_node) { leaf_const_pointer p_other_lf = static_cast<leaf_const_pointer>(p_ncp); leaf_pointer p_new_lf = s_leaf_allocator.allocate(1); cond_dealtor cond(p_new_lf); new (p_new_lf) leaf(p_other_lf->value()); apply_update(p_new_lf, (node_update*)this); cond.set_no_action_dtor(); return (p_new_lf); } _GLIBCXX_DEBUG_ASSERT(p_ncp->m_type == i_node); node_pointer a_p_children[inode::arr_size]; size_type child_i = 0; inode_const_pointer p_icp = static_cast<inode_const_pointer>(p_ncp); typename inode::const_iterator child_it = p_icp->begin(); inode_pointer p_ret; __try { while (child_it != p_icp->end()) { a_p_children[child_i] = recursive_copy_node(*(child_it)); child_i++; child_it++; } p_ret = s_inode_allocator.allocate(1); } __catch(...) { while (child_i-- > 0) clear_imp(a_p_children[child_i]); __throw_exception_again; } new (p_ret) inode(p_icp->get_e_ind(), pref_begin(a_p_children[0])); --child_i; _GLIBCXX_DEBUG_ASSERT(child_i >= 1); do p_ret->add_child(a_p_children[child_i], pref_begin(a_p_children[child_i]), pref_end(a_p_children[child_i]), this); while (child_i-- > 0); apply_update(p_ret, (node_update*)this); return p_ret; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp������������������������������������������0000644�����������������00000006630�14763166030�0017137 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pat_trie_/iterators_fn_imps.hpp * Contains an implementation class for pat_trie. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: begin() { return iterator(m_p_head->m_p_min); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: begin() const { return const_iterator(m_p_head->m_p_min); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: end() { return iterator(m_p_head); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: end() const { return const_iterator(m_p_head); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_reverse_iterator PB_DS_CLASS_C_DEC:: rbegin() const { if (empty()) return rend(); return --end(); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::reverse_iterator PB_DS_CLASS_C_DEC:: rbegin() { if (empty()) return rend(); return --end(); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::reverse_iterator PB_DS_CLASS_C_DEC:: rend() { return reverse_iterator(m_p_head); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_reverse_iterator PB_DS_CLASS_C_DEC:: rend() const { return const_reverse_iterator(m_p_head); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_const_iterator PB_DS_CLASS_C_DEC:: node_begin() const { return node_const_iterator(m_p_head->m_p_parent, this); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_iterator PB_DS_CLASS_C_DEC:: node_begin() { return node_iterator(m_p_head->m_p_parent, this); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_const_iterator PB_DS_CLASS_C_DEC:: node_end() const { return node_const_iterator(0, this); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_iterator PB_DS_CLASS_C_DEC:: node_end() { return node_iterator(0, this); } ��������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp����������������������������������������0000644�����������������00000034213�14763166030�0017444 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pat_trie_/insert_join_fn_imps.hpp * Contains an implementation class for pat_trie. */ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: join(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) branch_bag bag; if (!join_prep(other, bag)) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) return; } m_p_head->m_p_parent = rec_join(m_p_head->m_p_parent, other.m_p_head->m_p_parent, 0, bag); m_p_head->m_p_parent->m_p_parent = m_p_head; m_size += other.m_size; other.initialize(); PB_DS_ASSERT_VALID(other) m_p_head->m_p_min = leftmost_descendant(m_p_head->m_p_parent); m_p_head->m_p_max = rightmost_descendant(m_p_head->m_p_parent); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: join_prep(PB_DS_CLASS_C_DEC& other, branch_bag& r_bag) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) if (other.m_size == 0) return false; if (m_size == 0) { value_swap(other); return false; } const bool greater = synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_max)->value()), PB_DS_V2F(static_cast<leaf_const_pointer>(other.m_p_head->m_p_min)->value())); const bool lesser = synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(other.m_p_head->m_p_max)->value()), PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_min)->value())); if (!greater && !lesser) __throw_join_error(); rec_join_prep(m_p_head->m_p_parent, other.m_p_head->m_p_parent, r_bag); _GLIBCXX_DEBUG_ONLY(debug_base::join(other, false);) return true; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: rec_join_prep(node_const_pointer p_l, node_const_pointer p_r, branch_bag& r_bag) { if (p_l->m_type == leaf_node) { if (p_r->m_type == leaf_node) { rec_join_prep(static_cast<leaf_const_pointer>(p_l), static_cast<leaf_const_pointer>(p_r), r_bag); return; } _GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node); rec_join_prep(static_cast<leaf_const_pointer>(p_l), static_cast<inode_const_pointer>(p_r), r_bag); return; } _GLIBCXX_DEBUG_ASSERT(p_l->m_type == i_node); if (p_r->m_type == leaf_node) { rec_join_prep(static_cast<inode_const_pointer>(p_l), static_cast<leaf_const_pointer>(p_r), r_bag); return; } _GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node); rec_join_prep(static_cast<inode_const_pointer>(p_l), static_cast<inode_const_pointer>(p_r), r_bag); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: rec_join_prep(leaf_const_pointer /*p_l*/, leaf_const_pointer /*p_r*/, branch_bag& r_bag) { r_bag.add_branch(); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: rec_join_prep(leaf_const_pointer /*p_l*/, inode_const_pointer /*p_r*/, branch_bag& r_bag) { r_bag.add_branch(); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: rec_join_prep(inode_const_pointer /*p_l*/, leaf_const_pointer /*p_r*/, branch_bag& r_bag) { r_bag.add_branch(); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: rec_join_prep(inode_const_pointer p_l, inode_const_pointer p_r, branch_bag& r_bag) { if (p_l->get_e_ind() == p_r->get_e_ind() && synth_access_traits::equal_prefixes(p_l->pref_b_it(), p_l->pref_e_it(), p_r->pref_b_it(), p_r->pref_e_it())) { for (typename inode::const_iterator it = p_r->begin(); it != p_r->end(); ++ it) { node_const_pointer p_l_join_child = p_l->get_join_child(*it, this); if (p_l_join_child != 0) rec_join_prep(p_l_join_child, * it, r_bag); } return; } if (p_r->get_e_ind() < p_l->get_e_ind() && p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this)) { node_const_pointer p_r_join_child = p_r->get_join_child(p_l, this); if (p_r_join_child != 0) rec_join_prep(p_r_join_child, p_l, r_bag); return; } if (p_r->get_e_ind() < p_l->get_e_ind() && p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this)) { node_const_pointer p_r_join_child = p_r->get_join_child(p_l, this); if (p_r_join_child != 0) rec_join_prep(p_r_join_child, p_l, r_bag); return; } r_bag.add_branch(); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: rec_join(node_pointer p_l, node_pointer p_r, size_type checked_ind, branch_bag& r_bag) { _GLIBCXX_DEBUG_ASSERT(p_r != 0); if (p_l == 0) { apply_update(p_r, (node_update*)this); return (p_r); } if (p_l->m_type == leaf_node) { if (p_r->m_type == leaf_node) { node_pointer p_ret = rec_join(static_cast<leaf_pointer>(p_l), static_cast<leaf_pointer>(p_r), r_bag); apply_update(p_ret, (node_update*)this); return p_ret; } _GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node); node_pointer p_ret = rec_join(static_cast<leaf_pointer>(p_l), static_cast<inode_pointer>(p_r), checked_ind, r_bag); apply_update(p_ret, (node_update*)this); return p_ret; } _GLIBCXX_DEBUG_ASSERT(p_l->m_type == i_node); if (p_r->m_type == leaf_node) { node_pointer p_ret = rec_join(static_cast<inode_pointer>(p_l), static_cast<leaf_pointer>(p_r), checked_ind, r_bag); apply_update(p_ret, (node_update*)this); return p_ret; } _GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node); node_pointer p_ret = rec_join(static_cast<inode_pointer>(p_l), static_cast<inode_pointer>(p_r), r_bag); apply_update(p_ret, (node_update*)this); return p_ret; } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: rec_join(leaf_pointer p_l, leaf_pointer p_r, branch_bag& r_bag) { _GLIBCXX_DEBUG_ASSERT(p_r != 0); if (p_l == 0) return (p_r); node_pointer p_ret = insert_branch(p_l, p_r, r_bag); _GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_ret) == 2); return p_ret; } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: rec_join(leaf_pointer p_l, inode_pointer p_r, size_type checked_ind, branch_bag& r_bag) { #ifdef _GLIBCXX_DEBUG const size_type lhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_l); const size_type rhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_r); #endif _GLIBCXX_DEBUG_ASSERT(p_r != 0); node_pointer p_ret = rec_join(p_r, p_l, checked_ind, r_bag); _GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_ret) == lhs_leafs + rhs_leafs); return p_ret; } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: rec_join(inode_pointer p_l, leaf_pointer p_r, size_type checked_ind, branch_bag& r_bag) { _GLIBCXX_DEBUG_ASSERT(p_l != 0); _GLIBCXX_DEBUG_ASSERT(p_r != 0); #ifdef _GLIBCXX_DEBUG const size_type lhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_l); const size_type rhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_r); #endif if (!p_l->should_be_mine(pref_begin(p_r), pref_end(p_r), checked_ind, this)) { node_pointer p_ret = insert_branch(p_l, p_r, r_bag); PB_DS_ASSERT_NODE_VALID(p_ret) _GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_ret) == lhs_leafs + rhs_leafs); return p_ret; } node_pointer p_pot_child = p_l->add_child(p_r, pref_begin(p_r), pref_end(p_r), this); if (p_pot_child != p_r) { node_pointer p_new_child = rec_join(p_pot_child, p_r, p_l->get_e_ind(), r_bag); p_l->replace_child(p_new_child, pref_begin(p_new_child), pref_end(p_new_child), this); } PB_DS_ASSERT_NODE_VALID(p_l) _GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_l) == lhs_leafs + rhs_leafs); return p_l; } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: rec_join(inode_pointer p_l, inode_pointer p_r, branch_bag& r_bag) { _GLIBCXX_DEBUG_ASSERT(p_l != 0); _GLIBCXX_DEBUG_ASSERT(p_r != 0); #ifdef _GLIBCXX_DEBUG const size_type lhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_l); const size_type rhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_r); #endif if (p_l->get_e_ind() == p_r->get_e_ind() && synth_access_traits::equal_prefixes(p_l->pref_b_it(), p_l->pref_e_it(), p_r->pref_b_it(), p_r->pref_e_it())) { for (typename inode::iterator it = p_r->begin(); it != p_r->end(); ++ it) { node_pointer p_new_child = rec_join(p_l->get_join_child(*it, this), * it, 0, r_bag); p_l->replace_child(p_new_child, pref_begin(p_new_child), pref_end(p_new_child), this); } p_r->~inode(); s_inode_allocator.deallocate(p_r, 1); PB_DS_ASSERT_NODE_VALID(p_l) _GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_l) == lhs_leafs + rhs_leafs); return p_l; } if (p_l->get_e_ind() < p_r->get_e_ind() && p_l->should_be_mine(p_r->pref_b_it(), p_r->pref_e_it(), 0, this)) { node_pointer p_new_child = rec_join(p_l->get_join_child(p_r, this), p_r, 0, r_bag); p_l->replace_child(p_new_child, pref_begin(p_new_child), pref_end(p_new_child), this); PB_DS_ASSERT_NODE_VALID(p_l) return p_l; } if (p_r->get_e_ind() < p_l->get_e_ind() && p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this)) { node_pointer p_new_child = rec_join(p_r->get_join_child(p_l, this), p_l, 0, r_bag); p_r->replace_child(p_new_child, pref_begin(p_new_child), pref_end(p_new_child), this); PB_DS_ASSERT_NODE_VALID(p_r) _GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_r) == lhs_leafs + rhs_leafs); return p_r; } node_pointer p_ret = insert_branch(p_l, p_r, r_bag); PB_DS_ASSERT_NODE_VALID(p_ret) _GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_ret) == lhs_leafs + rhs_leafs); return p_ret; } PB_DS_CLASS_T_DEC inline std::pair<typename PB_DS_CLASS_C_DEC::iterator, bool> PB_DS_CLASS_C_DEC:: insert(const_reference r_val) { node_pointer p_lf = find_imp(PB_DS_V2F(r_val)); if (p_lf != 0 && p_lf->m_type == leaf_node && synth_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_lf)->value()), PB_DS_V2F(r_val))) { PB_DS_CHECK_KEY_EXISTS(PB_DS_V2F(r_val)) PB_DS_ASSERT_VALID((*this)) return std::make_pair(iterator(p_lf), false); } PB_DS_CHECK_KEY_DOES_NOT_EXIST(PB_DS_V2F(r_val)) leaf_pointer p_new_lf = s_leaf_allocator.allocate(1); cond_dealtor cond(p_new_lf); new (p_new_lf) leaf(r_val); apply_update(p_new_lf, (node_update*)this); cond.set_call_destructor(); branch_bag bag; bag.add_branch(); m_p_head->m_p_parent = rec_join(m_p_head->m_p_parent, p_new_lf, 0, bag); m_p_head->m_p_parent->m_p_parent = m_p_head; cond.set_no_action_dtor(); ++m_size; update_min_max_for_inserted_leaf(p_new_lf); _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));) PB_DS_ASSERT_VALID((*this)) return std::make_pair(point_iterator(p_new_lf), true); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: keys_diff_ind(typename access_traits::const_iterator b_l, typename access_traits::const_iterator e_l, typename access_traits::const_iterator b_r, typename access_traits::const_iterator e_r) { size_type diff_pos = 0; while (b_l != e_l) { if (b_r == e_r) return (diff_pos); if (access_traits::e_pos(*b_l) != access_traits::e_pos(*b_r)) return (diff_pos); ++b_l; ++b_r; ++diff_pos; } _GLIBCXX_DEBUG_ASSERT(b_r != e_r); return diff_pos; } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::inode_pointer PB_DS_CLASS_C_DEC:: insert_branch(node_pointer p_l, node_pointer p_r, branch_bag& r_bag) { typename synth_access_traits::const_iterator left_b_it = pref_begin(p_l); typename synth_access_traits::const_iterator left_e_it = pref_end(p_l); typename synth_access_traits::const_iterator right_b_it = pref_begin(p_r); typename synth_access_traits::const_iterator right_e_it = pref_end(p_r); const size_type diff_ind = keys_diff_ind(left_b_it, left_e_it, right_b_it, right_e_it); inode_pointer p_new_nd = r_bag.get_branch(); new (p_new_nd) inode(diff_ind, left_b_it); p_new_nd->add_child(p_l, left_b_it, left_e_it, this); p_new_nd->add_child(p_r, right_b_it, right_e_it, this); p_l->m_p_parent = p_new_nd; p_r->m_p_parent = p_new_nd; PB_DS_ASSERT_NODE_VALID(p_new_nd) return (p_new_nd); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: update_min_max_for_inserted_leaf(leaf_pointer p_new_lf) { if (m_p_head->m_p_min == m_p_head || synth_access_traits::cmp_keys(PB_DS_V2F(p_new_lf->value()), PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_min)->value()))) m_p_head->m_p_min = p_new_lf; if (m_p_head->m_p_max == m_p_head || synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_max)->value()), PB_DS_V2F(p_new_lf->value()))) m_p_head->m_p_max = p_new_lf; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp����������������������������������������0000644�����������������00000015076�14763166030�0017470 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pat_trie_/synth_access_traits.hpp * Contains an implementation class for a patricia tree. */ #ifndef PB_DS_SYNTH_E_ACCESS_TRAITS_HPP #define PB_DS_SYNTH_E_ACCESS_TRAITS_HPP #include <ext/pb_ds/detail/type_utils.hpp> namespace __gnu_pbds { namespace detail { #define PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC \ template<typename Type_Traits, bool Set, typename _ATraits> #define PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC \ synth_access_traits<Type_Traits, Set, _ATraits> /// Synthetic element access traits. template<typename Type_Traits, bool Set, typename _ATraits> struct synth_access_traits : public _ATraits { typedef _ATraits base_type; typedef typename base_type::const_iterator const_iterator; typedef Type_Traits type_traits; typedef typename type_traits::const_reference const_reference; typedef typename type_traits::key_const_reference key_const_reference; synth_access_traits(); synth_access_traits(const base_type&); inline bool equal_prefixes(const_iterator, const_iterator, const_iterator, const_iterator, bool compare_after = true) const; bool equal_keys(key_const_reference, key_const_reference) const; bool cmp_prefixes(const_iterator, const_iterator, const_iterator, const_iterator, bool compare_after = false) const; bool cmp_keys(key_const_reference, key_const_reference) const; inline static key_const_reference extract_key(const_reference); #ifdef _GLIBCXX_DEBUG bool operator()(key_const_reference, key_const_reference); #endif private: inline static key_const_reference extract_key(const_reference, true_type); inline static key_const_reference extract_key(const_reference, false_type); static integral_constant<int, Set> s_set_ind; }; PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC integral_constant<int,Set> PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::s_set_ind; PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC:: synth_access_traits() { } PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC:: synth_access_traits(const _ATraits& r_traits) : _ATraits(r_traits) { } PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC inline bool PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC:: equal_prefixes(const_iterator b_l, const_iterator e_l, const_iterator b_r, const_iterator e_r, bool compare_after /*= false */) const { while (b_l != e_l) { if (b_r == e_r) return false; if (base_type::e_pos(*b_l) != base_type::e_pos(*b_r)) return false; ++b_l; ++b_r; } return (!compare_after || b_r == e_r); } PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC bool PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC:: equal_keys(key_const_reference r_lhs_key, key_const_reference r_rhs_key) const { return equal_prefixes(base_type::begin(r_lhs_key), base_type::end(r_lhs_key), base_type::begin(r_rhs_key), base_type::end(r_rhs_key), true); } PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC bool PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC:: cmp_prefixes(const_iterator b_l, const_iterator e_l, const_iterator b_r, const_iterator e_r, bool compare_after /* = false*/) const { while (b_l != e_l) { if (b_r == e_r) return false; const typename base_type::size_type l_pos = base_type::e_pos(*b_l); const typename base_type::size_type r_pos = base_type::e_pos(*b_r); if (l_pos != r_pos) return l_pos < r_pos; ++b_l; ++b_r; } if (!compare_after) return false; return b_r != e_r; } PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC bool PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC:: cmp_keys(key_const_reference r_lhs_key, key_const_reference r_rhs_key) const { return cmp_prefixes(base_type::begin(r_lhs_key), base_type::end(r_lhs_key), base_type::begin(r_rhs_key), base_type::end(r_rhs_key), true); } PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::key_const_reference PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC:: extract_key(const_reference r_val) { return extract_key(r_val, s_set_ind); } PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::key_const_reference PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC:: extract_key(const_reference r_val, true_type) { return r_val; } PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::key_const_reference PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC:: extract_key(const_reference r_val, false_type) { return r_val.first; } #ifdef _GLIBCXX_DEBUG PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC bool PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC:: operator()(key_const_reference r_lhs, key_const_reference r_rhs) { return cmp_keys(r_lhs, r_rhs); } #endif #undef PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC #undef PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC } // namespace detail } // namespace __gnu_pbds #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pat_trie_/traits.hpp�����������������������������������������������������0000644�����������������00000014241�14763166030�0014713 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pat_trie_/traits.hpp * Contains an implementation class for pat_trie_. */ #ifndef PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP #define PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP #include <ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp> #include <ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp> namespace __gnu_pbds { namespace detail { /// Specialization. /// @ingroup traits template<typename Key, typename Mapped, typename _ATraits, template<typename Node_CItr, typename Node_Itr, typename Cmp_Fn_, typename _Alloc_> class Node_Update, typename _Alloc> struct trie_traits<Key, Mapped, _ATraits, Node_Update, pat_trie_tag, _Alloc> { private: typedef pat_trie_base base_type; typedef types_traits<Key, Mapped, _Alloc, false> type_traits; public: typedef typename trie_node_metadata_dispatch<Key, Mapped, _ATraits, Node_Update, _Alloc>::type metadata_type; typedef base_type::_Metadata<metadata_type, _Alloc> metadata; typedef _ATraits access_traits; /// Type for synthesized traits. typedef __gnu_pbds::detail::synth_access_traits<type_traits, false, access_traits> synth_access_traits; typedef base_type::_Node_base<synth_access_traits, metadata> node; typedef base_type::_Head<synth_access_traits, metadata> head; typedef base_type::_Leaf<synth_access_traits, metadata> leaf; typedef base_type::_Inode<synth_access_traits, metadata> inode; typedef base_type::_Iter<node, leaf, head, inode, true> iterator; typedef base_type::_CIter<node, leaf, head, inode, true> const_iterator; typedef base_type::_Iter<node, leaf, head, inode, false> reverse_iterator; typedef base_type::_CIter<node, leaf, head, inode, false> const_reverse_iterator; /// This is an iterator to an iterator: it iterates over nodes, /// and de-referencing it returns one of the tree's iterators. typedef base_type::_Node_citer<node, leaf, head, inode, const_iterator, iterator, _Alloc> node_const_iterator; typedef base_type::_Node_iter<node, leaf, head, inode, const_iterator, iterator, _Alloc> node_iterator; /// Type for node update. typedef Node_Update<node_const_iterator, node_iterator, _ATraits, _Alloc> node_update; typedef null_node_update<node_const_iterator, node_iterator, _ATraits, _Alloc>* null_node_update_pointer; }; /// Specialization. /// @ingroup traits template<typename Key, typename _ATraits, template<typename Node_CItr, typename Node_Itr, typename Cmp_Fn_, typename _Alloc_> class Node_Update, typename _Alloc> struct trie_traits<Key, null_type, _ATraits, Node_Update, pat_trie_tag, _Alloc> { private: typedef pat_trie_base base_type; typedef types_traits<Key, null_type, _Alloc, false> type_traits; public: typedef typename trie_node_metadata_dispatch<Key, null_type, _ATraits, Node_Update, _Alloc>::type metadata_type; typedef base_type::_Metadata<metadata_type, _Alloc> metadata; typedef _ATraits access_traits; /// Type for synthesized traits. typedef __gnu_pbds::detail::synth_access_traits<type_traits, true, access_traits> synth_access_traits; typedef base_type::_Node_base<synth_access_traits, metadata> node; typedef base_type::_Head<synth_access_traits, metadata> head; typedef base_type::_Leaf<synth_access_traits, metadata> leaf; typedef base_type::_Inode<synth_access_traits, metadata> inode; typedef base_type::_CIter<node, leaf, head, inode, true> const_iterator; typedef const_iterator iterator; typedef base_type::_CIter<node, leaf, head, inode, false> const_reverse_iterator; typedef const_reverse_iterator reverse_iterator; /// This is an iterator to an iterator: it iterates over nodes, /// and de-referencing it returns one of the tree's iterators. typedef base_type::_Node_citer<node, leaf, head, inode, const_iterator, iterator, _Alloc> node_const_iterator; typedef node_const_iterator node_iterator; /// Type for node update. typedef Node_Update<node_const_iterator, node_iterator, _ATraits, _Alloc> node_update; typedef null_node_update<node_const_iterator, node_const_iterator, _ATraits, _Alloc>* null_node_update_pointer; }; } // namespace detail } // namespace __gnu_pbds #endif // #ifndef PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp�����������������������������������������������0000644�����������������00000017303�14763166030�0016042 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pat_trie_/find_fn_imps.hpp * Contains an implementation class for pat_trie. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_iterator PB_DS_CLASS_C_DEC:: find(key_const_reference r_key) { PB_DS_ASSERT_VALID((*this)) node_pointer p_nd = find_imp(r_key); if (p_nd == 0 || p_nd->m_type != leaf_node) { PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) return end(); } if (synth_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_nd)->value()), r_key)) { PB_DS_CHECK_KEY_EXISTS(r_key) return iterator(p_nd); } PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) return end(); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_const_iterator PB_DS_CLASS_C_DEC:: find(key_const_reference r_key) const { PB_DS_ASSERT_VALID((*this)) node_const_pointer p_nd = const_cast<PB_DS_CLASS_C_DEC* >(this)->find_imp(r_key); if (p_nd == 0 || p_nd->m_type != leaf_node) { PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) return end(); } if (synth_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value()), r_key)) { PB_DS_CHECK_KEY_EXISTS(r_key) return const_iterator(const_cast<node_pointer>(p_nd)); } PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) return end(); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: find_imp(key_const_reference r_key) { if (empty()) return 0; typename synth_access_traits::const_iterator b_it = synth_access_traits::begin(r_key); typename synth_access_traits::const_iterator e_it = synth_access_traits::end(r_key); node_pointer p_nd = m_p_head->m_p_parent; _GLIBCXX_DEBUG_ASSERT(p_nd != 0); while (p_nd->m_type != leaf_node) { _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node); node_pointer p_next_nd = static_cast<inode_pointer>(p_nd)->get_child_node(b_it, e_it, this); if (p_next_nd == 0) return p_nd; p_nd = p_next_nd; } return p_nd; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: lower_bound_imp(key_const_reference r_key) { if (empty()) return (m_p_head); node_pointer p_nd = m_p_head->m_p_parent; _GLIBCXX_DEBUG_ASSERT(p_nd != 0); typename PB_DS_CLASS_C_DEC::a_const_iterator b_it = synth_access_traits::begin(r_key); typename PB_DS_CLASS_C_DEC::a_const_iterator e_it = synth_access_traits::end(r_key); size_type checked_ind = 0; while (true) { if (p_nd->m_type == leaf_node) { if (!synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value()), r_key)) return p_nd; iterator it(p_nd); ++it; return it.m_p_nd; } _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node); const size_type new_checked_ind = static_cast<inode_pointer>(p_nd)->get_e_ind(); p_nd = static_cast<inode_pointer>(p_nd)->get_lower_bound_child_node( b_it, e_it, checked_ind, this); checked_ind = new_checked_ind; } } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_iterator PB_DS_CLASS_C_DEC:: lower_bound(key_const_reference r_key) { return point_iterator(lower_bound_imp(r_key)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_const_iterator PB_DS_CLASS_C_DEC:: lower_bound(key_const_reference r_key) const { return point_const_iterator(const_cast<PB_DS_CLASS_C_DEC* >(this)->lower_bound_imp(r_key)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_iterator PB_DS_CLASS_C_DEC:: upper_bound(key_const_reference r_key) { point_iterator l_bound_it = lower_bound(r_key); _GLIBCXX_DEBUG_ASSERT(l_bound_it == end() || !synth_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it), r_key)); if (l_bound_it == end() || synth_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it))) return l_bound_it; return ++l_bound_it; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_const_iterator PB_DS_CLASS_C_DEC:: upper_bound(key_const_reference r_key) const { point_const_iterator l_bound_it = lower_bound(r_key); _GLIBCXX_DEBUG_ASSERT(l_bound_it == end() || !synth_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it), r_key)); if (l_bound_it == end() || synth_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it))) return l_bound_it; return ++l_bound_it; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::a_const_iterator PB_DS_CLASS_C_DEC:: pref_begin(node_const_pointer p_nd) { if (p_nd->m_type == leaf_node) return (synth_access_traits::begin(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value()))); _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node); return static_cast<inode_const_pointer>(p_nd)->pref_b_it(); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::a_const_iterator PB_DS_CLASS_C_DEC:: pref_end(node_const_pointer p_nd) { if (p_nd->m_type == leaf_node) return (synth_access_traits::end(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value()))); _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node); return static_cast<inode_const_pointer>(p_nd)->pref_e_it(); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::leaf_const_pointer PB_DS_CLASS_C_DEC:: leftmost_descendant(node_const_pointer p_nd) { if (p_nd->m_type == leaf_node) return static_cast<leaf_const_pointer>(p_nd); return static_cast<inode_const_pointer>(p_nd)->leftmost_descendant(); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::leaf_pointer PB_DS_CLASS_C_DEC:: leftmost_descendant(node_pointer p_nd) { if (p_nd->m_type == leaf_node) return static_cast<leaf_pointer>(p_nd); return static_cast<inode_pointer>(p_nd)->leftmost_descendant(); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::leaf_const_pointer PB_DS_CLASS_C_DEC:: rightmost_descendant(node_const_pointer p_nd) { if (p_nd->m_type == leaf_node) return static_cast<leaf_const_pointer>(p_nd); return static_cast<inode_const_pointer>(p_nd)->rightmost_descendant(); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::leaf_pointer PB_DS_CLASS_C_DEC:: rightmost_descendant(node_pointer p_nd) { if (p_nd->m_type == leaf_node) return static_cast<leaf_pointer>(p_nd); return static_cast<inode_pointer>(p_nd)->rightmost_descendant(); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp����������������������������������������������0000644�����������������00000111401�14763166030�0016202 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pat_trie_/pat_trie_base.hpp * Contains the base class for a patricia tree. */ #ifndef PB_DS_PAT_TRIE_BASE #define PB_DS_PAT_TRIE_BASE #include <debug/debug.h> namespace __gnu_pbds { namespace detail { /// Base type for PATRICIA trees. struct pat_trie_base { /** * @brief Three types of nodes. * * i_node is used by _Inode, leaf_node by _Leaf, and head_node by _Head. */ enum node_type { i_node, leaf_node, head_node }; /// Metadata base primary template. template<typename Metadata, typename _Alloc> struct _Metadata { typedef Metadata metadata_type; typedef _Alloc allocator_type; typedef typename _Alloc::template rebind<Metadata> __rebind_m; typedef typename __rebind_m::other::const_reference const_reference; const_reference get_metadata() const { return m_metadata; } metadata_type m_metadata; }; /// Specialization for null metadata. template<typename _Alloc> struct _Metadata<null_type, _Alloc> { typedef null_type metadata_type; typedef _Alloc allocator_type; }; /// Node base. template<typename _ATraits, typename Metadata> struct _Node_base : public Metadata { private: typedef typename Metadata::allocator_type _Alloc; public: typedef _Alloc allocator_type; typedef _ATraits access_traits; typedef typename _ATraits::type_traits type_traits; typedef typename _Alloc::template rebind<_Node_base> __rebind_n; typedef typename __rebind_n::other::pointer node_pointer; node_pointer m_p_parent; const node_type m_type; _Node_base(node_type type) : m_type(type) { } typedef typename _Alloc::template rebind<_ATraits> __rebind_at; typedef typename __rebind_at::other::const_pointer a_const_pointer; typedef typename _ATraits::const_iterator a_const_iterator; #ifdef _GLIBCXX_DEBUG typedef std::pair<a_const_iterator, a_const_iterator> node_debug_info; void assert_valid(a_const_pointer p_traits, const char* __file, int __line) const { assert_valid_imp(p_traits, __file, __line); } virtual node_debug_info assert_valid_imp(a_const_pointer, const char*, int) const = 0; #endif }; /// Head node for PATRICIA tree. template<typename _ATraits, typename Metadata> struct _Head : public _Node_base<_ATraits, Metadata> { typedef _Node_base<_ATraits, Metadata> base_type; typedef typename base_type::type_traits type_traits; typedef typename base_type::node_pointer node_pointer; node_pointer m_p_min; node_pointer m_p_max; _Head() : base_type(head_node) { } #ifdef _GLIBCXX_DEBUG typedef typename base_type::node_debug_info node_debug_info; typedef typename base_type::a_const_pointer a_const_pointer; virtual node_debug_info assert_valid_imp(a_const_pointer, const char* __file, int __line) const { _GLIBCXX_DEBUG_VERIFY_AT(false, _M_message("Assertion from %1;:%2;") ._M_string(__FILE__)._M_integer(__LINE__), __file, __line); return node_debug_info(); } #endif }; /// Leaf node for PATRICIA tree. template<typename _ATraits, typename Metadata> struct _Leaf : public _Node_base<_ATraits, Metadata> { typedef _Node_base<_ATraits, Metadata> base_type; typedef typename base_type::type_traits type_traits; typedef typename type_traits::value_type value_type; typedef typename type_traits::reference reference; typedef typename type_traits::const_reference const_reference; private: value_type m_value; _Leaf(const _Leaf&); public: _Leaf(const_reference other) : base_type(leaf_node), m_value(other) { } reference value() { return m_value; } const_reference value() const { return m_value; } #ifdef _GLIBCXX_DEBUG typedef typename base_type::node_debug_info node_debug_info; typedef typename base_type::a_const_pointer a_const_pointer; virtual node_debug_info assert_valid_imp(a_const_pointer p_traits, const char* __file, int __line) const { PB_DS_DEBUG_VERIFY(base_type::m_type == leaf_node); node_debug_info ret; const_reference r_val = value(); return std::make_pair(p_traits->begin(p_traits->extract_key(r_val)), p_traits->end(p_traits->extract_key(r_val))); } virtual ~_Leaf() { } #endif }; /// Internal node type, PATRICIA tree. template<typename _ATraits, typename Metadata> struct _Inode : public _Node_base<_ATraits, Metadata> { typedef _Node_base<_ATraits, Metadata> base_type; typedef typename base_type::type_traits type_traits; typedef typename base_type::access_traits access_traits; typedef typename type_traits::value_type value_type; typedef typename base_type::allocator_type _Alloc; typedef _Alloc allocator_type; typedef typename _Alloc::size_type size_type; private: typedef typename base_type::a_const_pointer a_const_pointer; typedef typename base_type::a_const_iterator a_const_iterator; typedef typename base_type::node_pointer node_pointer; typedef typename _Alloc::template rebind<base_type> __rebind_n; typedef typename __rebind_n::other::const_pointer node_const_pointer; typedef _Leaf<_ATraits, Metadata> leaf; typedef typename _Alloc::template rebind<leaf>::other __rebind_l; typedef typename __rebind_l::pointer leaf_pointer; typedef typename __rebind_l::const_pointer leaf_const_pointer; typedef typename _Alloc::template rebind<_Inode>::other __rebind_in; typedef typename __rebind_in::pointer inode_pointer; typedef typename __rebind_in::const_pointer inode_const_pointer; inline size_type get_pref_pos(a_const_iterator, a_const_iterator, a_const_pointer) const; public: typedef typename _Alloc::template rebind<node_pointer>::other __rebind_np; typedef typename __rebind_np::pointer node_pointer_pointer; typedef typename __rebind_np::reference node_pointer_reference; enum { arr_size = _ATraits::max_size + 1 }; PB_DS_STATIC_ASSERT(min_arr_size, arr_size >= 2); /// Constant child iterator. struct const_iterator { node_pointer_pointer m_p_p_cur; node_pointer_pointer m_p_p_end; typedef std::forward_iterator_tag iterator_category; typedef typename _Alloc::difference_type difference_type; typedef node_pointer value_type; typedef node_pointer_pointer pointer; typedef node_pointer_reference reference; const_iterator(node_pointer_pointer p_p_cur = 0, node_pointer_pointer p_p_end = 0) : m_p_p_cur(p_p_cur), m_p_p_end(p_p_end) { } bool operator==(const const_iterator& other) const { return m_p_p_cur == other.m_p_p_cur; } bool operator!=(const const_iterator& other) const { return m_p_p_cur != other.m_p_p_cur; } const_iterator& operator++() { do ++m_p_p_cur; while (m_p_p_cur != m_p_p_end && *m_p_p_cur == 0); return *this; } const_iterator operator++(int) { const_iterator ret_it(*this); operator++(); return ret_it; } const node_pointer_pointer operator->() const { _GLIBCXX_DEBUG_ONLY(assert_referencible();) return m_p_p_cur; } node_const_pointer operator*() const { _GLIBCXX_DEBUG_ONLY(assert_referencible();) return *m_p_p_cur; } protected: #ifdef _GLIBCXX_DEBUG void assert_referencible() const { _GLIBCXX_DEBUG_ASSERT(m_p_p_cur != m_p_p_end && *m_p_p_cur != 0); } #endif }; /// Child iterator. struct iterator : public const_iterator { public: typedef std::forward_iterator_tag iterator_category; typedef typename _Alloc::difference_type difference_type; typedef node_pointer value_type; typedef node_pointer_pointer pointer; typedef node_pointer_reference reference; inline iterator(node_pointer_pointer p_p_cur = 0, node_pointer_pointer p_p_end = 0) : const_iterator(p_p_cur, p_p_end) { } bool operator==(const iterator& other) const { return const_iterator::m_p_p_cur == other.m_p_p_cur; } bool operator!=(const iterator& other) const { return const_iterator::m_p_p_cur != other.m_p_p_cur; } iterator& operator++() { const_iterator::operator++(); return *this; } iterator operator++(int) { iterator ret_it(*this); operator++(); return ret_it; } node_pointer_pointer operator->() { _GLIBCXX_DEBUG_ONLY(const_iterator::assert_referencible();) return const_iterator::m_p_p_cur; } node_pointer operator*() { _GLIBCXX_DEBUG_ONLY(const_iterator::assert_referencible();) return *const_iterator::m_p_p_cur; } }; _Inode(size_type, const a_const_iterator); void update_prefixes(a_const_pointer); const_iterator begin() const; iterator begin(); const_iterator end() const; iterator end(); inline node_pointer get_child_node(a_const_iterator, a_const_iterator, a_const_pointer); inline node_const_pointer get_child_node(a_const_iterator, a_const_iterator, a_const_pointer) const; inline iterator get_child_it(a_const_iterator, a_const_iterator, a_const_pointer); inline node_pointer get_lower_bound_child_node(a_const_iterator, a_const_iterator, size_type, a_const_pointer); inline node_pointer add_child(node_pointer, a_const_iterator, a_const_iterator, a_const_pointer); inline node_const_pointer get_join_child(node_const_pointer, a_const_pointer) const; inline node_pointer get_join_child(node_pointer, a_const_pointer); void remove_child(node_pointer); void remove_child(iterator); void replace_child(node_pointer, a_const_iterator, a_const_iterator, a_const_pointer); inline a_const_iterator pref_b_it() const; inline a_const_iterator pref_e_it() const; bool should_be_mine(a_const_iterator, a_const_iterator, size_type, a_const_pointer) const; leaf_pointer leftmost_descendant(); leaf_const_pointer leftmost_descendant() const; leaf_pointer rightmost_descendant(); leaf_const_pointer rightmost_descendant() const; #ifdef _GLIBCXX_DEBUG typedef typename base_type::node_debug_info node_debug_info; virtual node_debug_info assert_valid_imp(a_const_pointer, const char*, int) const; #endif size_type get_e_ind() const { return m_e_ind; } private: _Inode(const _Inode&); size_type get_begin_pos() const; static __rebind_l s_leaf_alloc; static __rebind_in s_inode_alloc; const size_type m_e_ind; a_const_iterator m_pref_b_it; a_const_iterator m_pref_e_it; node_pointer m_a_p_children[arr_size]; }; #define PB_DS_CONST_IT_C_DEC \ _CIter<Node, Leaf, Head, Inode, Is_Forward_Iterator> #define PB_DS_CONST_ODIR_IT_C_DEC \ _CIter<Node, Leaf, Head, Inode, !Is_Forward_Iterator> #define PB_DS_IT_C_DEC \ _Iter<Node, Leaf, Head, Inode, Is_Forward_Iterator> #define PB_DS_ODIR_IT_C_DEC \ _Iter<Node, Leaf, Head, Inode, !Is_Forward_Iterator> /// Const iterator. template<typename Node, typename Leaf, typename Head, typename Inode, bool Is_Forward_Iterator> class _CIter { public: // These types are all the same for the first four template arguments. typedef typename Node::allocator_type allocator_type; typedef typename Node::type_traits type_traits; typedef std::bidirectional_iterator_tag iterator_category; typedef typename allocator_type::difference_type difference_type; typedef typename type_traits::value_type value_type; typedef typename type_traits::pointer pointer; typedef typename type_traits::reference reference; typedef typename type_traits::const_pointer const_pointer; typedef typename type_traits::const_reference const_reference; typedef allocator_type _Alloc; typedef typename _Alloc::template rebind<Node> __rebind_n; typedef typename __rebind_n::other::pointer node_pointer; typedef typename _Alloc::template rebind<Leaf> __rebind_l; typedef typename __rebind_l::other::pointer leaf_pointer; typedef typename __rebind_l::other::const_pointer leaf_const_pointer; typedef typename _Alloc::template rebind<Head> __rebind_h; typedef typename __rebind_h::other::pointer head_pointer; typedef typename _Alloc::template rebind<Inode> __rebind_in; typedef typename __rebind_in::other::pointer inode_pointer; typedef typename Inode::iterator inode_iterator; node_pointer m_p_nd; _CIter(node_pointer p_nd = 0) : m_p_nd(p_nd) { } _CIter(const PB_DS_CONST_ODIR_IT_C_DEC& other) : m_p_nd(other.m_p_nd) { } _CIter& operator=(const _CIter& other) { m_p_nd = other.m_p_nd; return *this; } _CIter& operator=(const PB_DS_CONST_ODIR_IT_C_DEC& other) { m_p_nd = other.m_p_nd; return *this; } const_pointer operator->() const { _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == leaf_node); return &static_cast<leaf_pointer>(m_p_nd)->value(); } const_reference operator*() const { _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == leaf_node); return static_cast<leaf_pointer>(m_p_nd)->value(); } bool operator==(const _CIter& other) const { return m_p_nd == other.m_p_nd; } bool operator==(const PB_DS_CONST_ODIR_IT_C_DEC& other) const { return m_p_nd == other.m_p_nd; } bool operator!=(const _CIter& other) const { return m_p_nd != other.m_p_nd; } bool operator!=(const PB_DS_CONST_ODIR_IT_C_DEC& other) const { return m_p_nd != other.m_p_nd; } _CIter& operator++() { inc(integral_constant<int, Is_Forward_Iterator>()); return *this; } _CIter operator++(int) { _CIter ret_it(m_p_nd); operator++(); return ret_it; } _CIter& operator--() { dec(integral_constant<int, Is_Forward_Iterator>()); return *this; } _CIter operator--(int) { _CIter ret_it(m_p_nd); operator--(); return ret_it; } protected: void inc(false_type) { dec(true_type()); } void inc(true_type) { if (m_p_nd->m_type == head_node) { m_p_nd = static_cast<head_pointer>(m_p_nd)->m_p_min; return; } node_pointer p_y = m_p_nd->m_p_parent; while (p_y->m_type != head_node && get_larger_sibling(m_p_nd) == 0) { m_p_nd = p_y; p_y = p_y->m_p_parent; } if (p_y->m_type == head_node) { m_p_nd = p_y; return; } m_p_nd = leftmost_descendant(get_larger_sibling(m_p_nd)); } void dec(false_type) { inc(true_type()); } void dec(true_type) { if (m_p_nd->m_type == head_node) { m_p_nd = static_cast<head_pointer>(m_p_nd)->m_p_max; return; } node_pointer p_y = m_p_nd->m_p_parent; while (p_y->m_type != head_node && get_smaller_sibling(m_p_nd) == 0) { m_p_nd = p_y; p_y = p_y->m_p_parent; } if (p_y->m_type == head_node) { m_p_nd = p_y; return; } m_p_nd = rightmost_descendant(get_smaller_sibling(m_p_nd)); } static node_pointer get_larger_sibling(node_pointer p_nd) { inode_pointer p_parent = static_cast<inode_pointer>(p_nd->m_p_parent); inode_iterator it = p_parent->begin(); while (*it != p_nd) ++it; inode_iterator next_it = it; ++next_it; return (next_it == p_parent->end())? 0 : *next_it; } static node_pointer get_smaller_sibling(node_pointer p_nd) { inode_pointer p_parent = static_cast<inode_pointer>(p_nd->m_p_parent); inode_iterator it = p_parent->begin(); if (*it == p_nd) return 0; inode_iterator prev_it; do { prev_it = it; ++it; if (*it == p_nd) return *prev_it; } while (true); _GLIBCXX_DEBUG_ASSERT(false); return 0; } static leaf_pointer leftmost_descendant(node_pointer p_nd) { if (p_nd->m_type == leaf_node) return static_cast<leaf_pointer>(p_nd); return static_cast<inode_pointer>(p_nd)->leftmost_descendant(); } static leaf_pointer rightmost_descendant(node_pointer p_nd) { if (p_nd->m_type == leaf_node) return static_cast<leaf_pointer>(p_nd); return static_cast<inode_pointer>(p_nd)->rightmost_descendant(); } }; /// Iterator. template<typename Node, typename Leaf, typename Head, typename Inode, bool Is_Forward_Iterator> class _Iter : public _CIter<Node, Leaf, Head, Inode, Is_Forward_Iterator> { public: typedef _CIter<Node, Leaf, Head, Inode, Is_Forward_Iterator> base_type; typedef typename base_type::allocator_type allocator_type; typedef typename base_type::type_traits type_traits; typedef typename type_traits::value_type value_type; typedef typename type_traits::pointer pointer; typedef typename type_traits::reference reference; typedef typename base_type::node_pointer node_pointer; typedef typename base_type::leaf_pointer leaf_pointer; typedef typename base_type::leaf_const_pointer leaf_const_pointer; typedef typename base_type::head_pointer head_pointer; typedef typename base_type::inode_pointer inode_pointer; _Iter(node_pointer p_nd = 0) : base_type(p_nd) { } _Iter(const PB_DS_ODIR_IT_C_DEC& other) : base_type(other.m_p_nd) { } _Iter& operator=(const _Iter& other) { base_type::m_p_nd = other.m_p_nd; return *this; } _Iter& operator=(const PB_DS_ODIR_IT_C_DEC& other) { base_type::m_p_nd = other.m_p_nd; return *this; } pointer operator->() const { _GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == leaf_node); return &static_cast<leaf_pointer>(base_type::m_p_nd)->value(); } reference operator*() const { _GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == leaf_node); return static_cast<leaf_pointer>(base_type::m_p_nd)->value(); } _Iter& operator++() { base_type::operator++(); return *this; } _Iter operator++(int) { _Iter ret(base_type::m_p_nd); operator++(); return ret; } _Iter& operator--() { base_type::operator--(); return *this; } _Iter operator--(int) { _Iter ret(base_type::m_p_nd); operator--(); return ret; } }; #undef PB_DS_CONST_ODIR_IT_C_DEC #undef PB_DS_ODIR_IT_C_DEC #define PB_DS_PAT_TRIE_NODE_CONST_ITERATOR_C_DEC \ _Node_citer<Node, Leaf, Head, Inode, _CIterator, Iterator, _ATraits, _Alloc> #define PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC \ _Node_iter<Node, Leaf, Head, Inode, _CIterator, Iterator, _ATraits, _Alloc> /// Node const iterator. template<typename Node, typename Leaf, typename Head, typename Inode, typename _CIterator, typename Iterator, typename _Alloc> class _Node_citer { protected: typedef typename _Alloc::template rebind<Node> __rebind_n; typedef typename __rebind_n::other::pointer node_pointer; typedef typename _Alloc::template rebind<Leaf> __rebind_l; typedef typename __rebind_l::other::pointer leaf_pointer; typedef typename __rebind_l::other::const_pointer leaf_const_pointer; typedef typename _Alloc::template rebind<Inode> __rebind_in; typedef typename __rebind_in::other::pointer inode_pointer; typedef typename __rebind_in::other::const_pointer inode_const_pointer; typedef typename Node::a_const_pointer a_const_pointer; typedef typename Node::a_const_iterator a_const_iterator; private: a_const_iterator pref_begin() const { if (m_p_nd->m_type == leaf_node) { leaf_const_pointer lcp = static_cast<leaf_const_pointer>(m_p_nd); return m_p_traits->begin(m_p_traits->extract_key(lcp->value())); } _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node); return static_cast<inode_const_pointer>(m_p_nd)->pref_b_it(); } a_const_iterator pref_end() const { if (m_p_nd->m_type == leaf_node) { leaf_const_pointer lcp = static_cast<leaf_const_pointer>(m_p_nd); return m_p_traits->end(m_p_traits->extract_key(lcp->value())); } _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node); return static_cast<inode_const_pointer>(m_p_nd)->pref_e_it(); } public: typedef trivial_iterator_tag iterator_category; typedef trivial_iterator_difference_type difference_type; typedef typename _Alloc::size_type size_type; typedef _CIterator value_type; typedef value_type reference; typedef value_type const_reference; /// Metadata type. typedef typename Node::metadata_type metadata_type; /// Const metadata reference type. typedef typename _Alloc::template rebind<metadata_type> __rebind_m; typedef typename __rebind_m::other __rebind_ma; typedef typename __rebind_ma::const_reference metadata_const_reference; inline _Node_citer(node_pointer p_nd = 0, a_const_pointer p_traits = 0) : m_p_nd(const_cast<node_pointer>(p_nd)), m_p_traits(p_traits) { } /// Subtree valid prefix. std::pair<a_const_iterator, a_const_iterator> valid_prefix() const { return std::make_pair(pref_begin(), pref_end()); } /// Const access; returns the __const iterator* associated with /// the current leaf. const_reference operator*() const { _GLIBCXX_DEBUG_ASSERT(num_children() == 0); return _CIterator(m_p_nd); } /// Metadata access. metadata_const_reference get_metadata() const { return m_p_nd->get_metadata(); } /// Returns the number of children in the corresponding node. size_type num_children() const { if (m_p_nd->m_type == leaf_node) return 0; _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node); inode_pointer inp = static_cast<inode_pointer>(m_p_nd); return std::distance(inp->begin(), inp->end()); } /// Returns a __const node __iterator to the corresponding node's /// i-th child. _Node_citer get_child(size_type i) const { _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node); inode_pointer inp = static_cast<inode_pointer>(m_p_nd); typename Inode::iterator it = inp->begin(); std::advance(it, i); return _Node_citer(*it, m_p_traits); } /// Compares content to a different iterator object. bool operator==(const _Node_citer& other) const { return m_p_nd == other.m_p_nd; } /// Compares content (negatively) to a different iterator object. bool operator!=(const _Node_citer& other) const { return m_p_nd != other.m_p_nd; } node_pointer m_p_nd; a_const_pointer m_p_traits; }; /// Node iterator. template<typename Node, typename Leaf, typename Head, typename Inode, typename _CIterator, typename Iterator, typename _Alloc> class _Node_iter : public _Node_citer<Node, Leaf, Head, Inode, _CIterator, Iterator, _Alloc> { private: typedef _Node_citer<Node, Leaf, Head, Inode, _CIterator, Iterator, _Alloc> base_type; typedef typename _Alloc::template rebind<Node> __rebind_n; typedef typename __rebind_n::other::pointer node_pointer; typedef typename base_type::inode_pointer inode_pointer; typedef typename base_type::a_const_pointer a_const_pointer; typedef Iterator iterator; public: typedef typename base_type::size_type size_type; typedef Iterator value_type; typedef value_type reference; typedef value_type const_reference; _Node_iter(node_pointer p_nd = 0, a_const_pointer p_traits = 0) : base_type(p_nd, p_traits) { } /// Access; returns the iterator* associated with the current leaf. reference operator*() const { _GLIBCXX_DEBUG_ASSERT(base_type::num_children() == 0); return iterator(base_type::m_p_nd); } /// Returns a node __iterator to the corresponding node's i-th child. _Node_iter get_child(size_type i) const { _GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == i_node); typename Inode::iterator it = static_cast<inode_pointer>(base_type::m_p_nd)->begin(); std::advance(it, i); return _Node_iter(*it, base_type::m_p_traits); } }; }; #define PB_DS_CLASS_T_DEC \ template<typename _ATraits, typename Metadata> #define PB_DS_CLASS_C_DEC \ pat_trie_base::_Inode<_ATraits, Metadata> PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::__rebind_l PB_DS_CLASS_C_DEC::s_leaf_alloc; PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::__rebind_in PB_DS_CLASS_C_DEC::s_inode_alloc; PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: get_pref_pos(a_const_iterator b_it, a_const_iterator e_it, a_const_pointer p_traits) const { if (static_cast<std::size_t>(std::distance(b_it, e_it)) <= m_e_ind) return 0; std::advance(b_it, m_e_ind); return 1 + p_traits->e_pos(*b_it); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: _Inode(size_type len, const a_const_iterator it) : base_type(i_node), m_e_ind(len), m_pref_b_it(it), m_pref_e_it(it) { std::advance(m_pref_e_it, m_e_ind); std::fill(m_a_p_children, m_a_p_children + arr_size, static_cast<node_pointer>(0)); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: update_prefixes(a_const_pointer p_traits) { node_pointer p_first = *begin(); if (p_first->m_type == leaf_node) { leaf_const_pointer p = static_cast<leaf_const_pointer>(p_first); m_pref_b_it = p_traits->begin(access_traits::extract_key(p->value())); } else { inode_pointer p = static_cast<inode_pointer>(p_first); _GLIBCXX_DEBUG_ASSERT(p_first->m_type == i_node); m_pref_b_it = p->pref_b_it(); } m_pref_e_it = m_pref_b_it; std::advance(m_pref_e_it, m_e_ind); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: begin() const { typedef node_pointer_pointer pointer_type; pointer_type p = const_cast<pointer_type>(m_a_p_children); return const_iterator(p + get_begin_pos(), p + arr_size); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: begin() { return iterator(m_a_p_children + get_begin_pos(), m_a_p_children + arr_size); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: end() const { typedef node_pointer_pointer pointer_type; pointer_type p = const_cast<pointer_type>(m_a_p_children) + arr_size; return const_iterator(p, p); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: end() { return iterator(m_a_p_children + arr_size, m_a_p_children + arr_size); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: get_child_node(a_const_iterator b_it, a_const_iterator e_it, a_const_pointer p_traits) { const size_type i = get_pref_pos(b_it, e_it, p_traits); _GLIBCXX_DEBUG_ASSERT(i < arr_size); return m_a_p_children[i]; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: get_child_it(a_const_iterator b_it, a_const_iterator e_it, a_const_pointer p_traits) { const size_type i = get_pref_pos(b_it, e_it, p_traits); _GLIBCXX_DEBUG_ASSERT(i < arr_size); _GLIBCXX_DEBUG_ASSERT(m_a_p_children[i] != 0); return iterator(m_a_p_children + i, m_a_p_children + i); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_const_pointer PB_DS_CLASS_C_DEC:: get_child_node(a_const_iterator b_it, a_const_iterator e_it, a_const_pointer p_traits) const { return const_cast<node_pointer>(get_child_node(b_it, e_it, p_traits)); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: get_lower_bound_child_node(a_const_iterator b_it, a_const_iterator e_it, size_type checked_ind, a_const_pointer p_traits) { if (!should_be_mine(b_it, e_it, checked_ind, p_traits)) { if (p_traits->cmp_prefixes(b_it, e_it, m_pref_b_it, m_pref_e_it, true)) return leftmost_descendant(); return rightmost_descendant(); } size_type i = get_pref_pos(b_it, e_it, p_traits); _GLIBCXX_DEBUG_ASSERT(i < arr_size); if (m_a_p_children[i] != 0) return m_a_p_children[i]; while (++i < arr_size) if (m_a_p_children[i] != 0) { const node_type& __nt = m_a_p_children[i]->m_type; node_pointer ret = m_a_p_children[i]; if (__nt == leaf_node) return ret; _GLIBCXX_DEBUG_ASSERT(__nt == i_node); inode_pointer inp = static_cast<inode_pointer>(ret); return inp->leftmost_descendant(); } return rightmost_descendant(); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: add_child(node_pointer p_nd, a_const_iterator b_it, a_const_iterator e_it, a_const_pointer p_traits) { const size_type i = get_pref_pos(b_it, e_it, p_traits); _GLIBCXX_DEBUG_ASSERT(i < arr_size); if (m_a_p_children[i] == 0) { m_a_p_children[i] = p_nd; p_nd->m_p_parent = this; return p_nd; } return m_a_p_children[i]; } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_const_pointer PB_DS_CLASS_C_DEC:: get_join_child(node_const_pointer p_nd, a_const_pointer p_tr) const { node_pointer p = const_cast<node_pointer>(p_nd); return const_cast<inode_pointer>(this)->get_join_child(p, p_tr); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: get_join_child(node_pointer p_nd, a_const_pointer p_traits) { size_type i; a_const_iterator b_it; a_const_iterator e_it; if (p_nd->m_type == leaf_node) { leaf_const_pointer p = static_cast<leaf_const_pointer>(p_nd); typedef typename type_traits::key_const_reference kcr; kcr r_key = access_traits::extract_key(p->value()); b_it = p_traits->begin(r_key); e_it = p_traits->end(r_key); } else { b_it = static_cast<inode_pointer>(p_nd)->pref_b_it(); e_it = static_cast<inode_pointer>(p_nd)->pref_e_it(); } i = get_pref_pos(b_it, e_it, p_traits); _GLIBCXX_DEBUG_ASSERT(i < arr_size); return m_a_p_children[i]; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: remove_child(node_pointer p_nd) { size_type i = 0; for (; i < arr_size; ++i) if (m_a_p_children[i] == p_nd) { m_a_p_children[i] = 0; return; } _GLIBCXX_DEBUG_ASSERT(i != arr_size); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: remove_child(iterator it) { *it.m_p_p_cur = 0; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: replace_child(node_pointer p_nd, a_const_iterator b_it, a_const_iterator e_it, a_const_pointer p_traits) { const size_type i = get_pref_pos(b_it, e_it, p_traits); _GLIBCXX_DEBUG_ASSERT(i < arr_size); m_a_p_children[i] = p_nd; p_nd->m_p_parent = this; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::a_const_iterator PB_DS_CLASS_C_DEC:: pref_b_it() const { return m_pref_b_it; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::a_const_iterator PB_DS_CLASS_C_DEC:: pref_e_it() const { return m_pref_e_it; } PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: should_be_mine(a_const_iterator b_it, a_const_iterator e_it, size_type checked_ind, a_const_pointer p_traits) const { if (m_e_ind == 0) return true; const size_type num_es = std::distance(b_it, e_it); if (num_es < m_e_ind) return false; a_const_iterator key_b_it = b_it; std::advance(key_b_it, checked_ind); a_const_iterator key_e_it = b_it; std::advance(key_e_it, m_e_ind); a_const_iterator value_b_it = m_pref_b_it; std::advance(value_b_it, checked_ind); a_const_iterator value_e_it = m_pref_b_it; std::advance(value_e_it, m_e_ind); return p_traits->equal_prefixes(key_b_it, key_e_it, value_b_it, value_e_it); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::leaf_pointer PB_DS_CLASS_C_DEC:: leftmost_descendant() { node_pointer p_pot = *begin(); if (p_pot->m_type == leaf_node) return (static_cast<leaf_pointer>(p_pot)); _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == i_node); return static_cast<inode_pointer>(p_pot)->leftmost_descendant(); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::leaf_const_pointer PB_DS_CLASS_C_DEC:: leftmost_descendant() const { return const_cast<inode_pointer>(this)->leftmost_descendant(); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::leaf_pointer PB_DS_CLASS_C_DEC:: rightmost_descendant() { const size_type num_children = std::distance(begin(), end()); _GLIBCXX_DEBUG_ASSERT(num_children >= 2); iterator it = begin(); std::advance(it, num_children - 1); node_pointer p_pot =* it; if (p_pot->m_type == leaf_node) return static_cast<leaf_pointer>(p_pot); _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == i_node); return static_cast<inode_pointer>(p_pot)->rightmost_descendant(); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::leaf_const_pointer PB_DS_CLASS_C_DEC:: rightmost_descendant() const { return const_cast<inode_pointer>(this)->rightmost_descendant(); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: get_begin_pos() const { size_type i = 0; for (; i < arr_size && m_a_p_children[i] == 0; ++i) ; return i; } #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_debug_info PB_DS_CLASS_C_DEC:: assert_valid_imp(a_const_pointer p_traits, const char* __file, int __line) const { PB_DS_DEBUG_VERIFY(base_type::m_type == i_node); PB_DS_DEBUG_VERIFY(static_cast<size_type>(std::distance(pref_b_it(), pref_e_it())) == m_e_ind); PB_DS_DEBUG_VERIFY(std::distance(begin(), end()) >= 2); for (typename _Inode::const_iterator it = begin(); it != end(); ++it) { node_const_pointer p_nd = *it; PB_DS_DEBUG_VERIFY(p_nd->m_p_parent == this); node_debug_info child_ret = p_nd->assert_valid_imp(p_traits, __file, __line); PB_DS_DEBUG_VERIFY(static_cast<size_type>(std::distance(child_ret.first, child_ret.second)) >= m_e_ind); PB_DS_DEBUG_VERIFY(should_be_mine(child_ret.first, child_ret.second, 0, p_traits)); PB_DS_DEBUG_VERIFY(get_pref_pos(child_ret.first, child_ret.second, p_traits) == static_cast<size_type>(it.m_p_p_cur - m_a_p_children)); } return std::make_pair(pref_b_it(), pref_e_it()); } #endif #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC } // namespace detail } // namespace __gnu_pbds #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp��������������������������������������0000644�����������������00000004247�14763166030�0017745 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pat_trie_/policy_access_fn_imps.hpp * Contains an implementation class for pat_trie. */ PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::access_traits& PB_DS_CLASS_C_DEC:: get_access_traits() { return *this; } PB_DS_CLASS_T_DEC const typename PB_DS_CLASS_C_DEC::access_traits& PB_DS_CLASS_C_DEC:: get_access_traits() const { return *this; } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_update& PB_DS_CLASS_C_DEC:: get_node_update() { return *this; } PB_DS_CLASS_T_DEC const typename PB_DS_CLASS_C_DEC::node_update& PB_DS_CLASS_C_DEC:: get_node_update() const { return *this; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp����������������������������������������������0000644�����������������00000017411�14763166030�0016221 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pat_trie_/erase_fn_imps.hpp * Contains an implementation class for pat_trie. */ PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: erase(key_const_reference r_key) { node_pointer p_nd = find_imp(r_key); if (p_nd == 0 || p_nd->m_type == i_node) { PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) return false; } _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == leaf_node); if (!synth_access_traits::equal_keys(PB_DS_V2F(reinterpret_cast<leaf_pointer>(p_nd)->value()), r_key)) { PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) return false; } PB_DS_CHECK_KEY_EXISTS(r_key) erase_leaf(static_cast<leaf_pointer>(p_nd)); PB_DS_ASSERT_VALID((*this)) return true; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: erase_fixup(inode_pointer p_nd) { _GLIBCXX_DEBUG_ASSERT(std::distance(p_nd->begin(), p_nd->end()) >= 1); if (std::distance(p_nd->begin(), p_nd->end()) == 1) { node_pointer p_parent = p_nd->m_p_parent; if (p_parent == m_p_head) m_p_head->m_p_parent = *p_nd->begin(); else { _GLIBCXX_DEBUG_ASSERT(p_parent->m_type == i_node); node_pointer p_new_child = *p_nd->begin(); typedef inode_pointer inode_ptr; inode_ptr p_internal = static_cast<inode_ptr>(p_parent); p_internal->replace_child(p_new_child, pref_begin(p_new_child), pref_end(p_new_child), this); } (*p_nd->begin())->m_p_parent = p_nd->m_p_parent; p_nd->~inode(); s_inode_allocator.deallocate(p_nd, 1); if (p_parent == m_p_head) return; _GLIBCXX_DEBUG_ASSERT(p_parent->m_type == i_node); p_nd = static_cast<inode_pointer>(p_parent); } while (true) { _GLIBCXX_DEBUG_ASSERT(std::distance(p_nd->begin(), p_nd->end()) > 1); p_nd->update_prefixes(this); apply_update(p_nd, (node_update*)this); PB_DS_ASSERT_NODE_VALID(p_nd) if (p_nd->m_p_parent->m_type == head_node) return; _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_parent->m_type == i_node); p_nd = static_cast<inode_pointer>(p_nd->m_p_parent); } } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: actual_erase_leaf(leaf_pointer p_l) { _GLIBCXX_DEBUG_ASSERT(m_size > 0); --m_size; _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_l->value()))); p_l->~leaf(); s_leaf_allocator.deallocate(p_l, 1); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: clear() { if (!empty()) { clear_imp(m_p_head->m_p_parent); m_size = 0; initialize(); _GLIBCXX_DEBUG_ONLY(debug_base::clear();) PB_DS_ASSERT_VALID((*this)) } } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: clear_imp(node_pointer p_nd) { if (p_nd->m_type == i_node) { _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node); for (typename inode::iterator it = static_cast<inode_pointer>(p_nd)->begin(); it != static_cast<inode_pointer>(p_nd)->end(); ++it) { node_pointer p_child =* it; clear_imp(p_child); } s_inode_allocator.deallocate(static_cast<inode_pointer>(p_nd), 1); return; } _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == leaf_node); static_cast<leaf_pointer>(p_nd)->~leaf(); s_leaf_allocator.deallocate(static_cast<leaf_pointer>(p_nd), 1); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: erase(const_iterator it) { PB_DS_ASSERT_VALID((*this)) if (it == end()) return it; const_iterator ret_it = it; ++ret_it; _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node); erase_leaf(static_cast<leaf_pointer>(it.m_p_nd)); PB_DS_ASSERT_VALID((*this)) return ret_it; } #ifdef PB_DS_DATA_TRUE_INDICATOR PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: erase(iterator it) { PB_DS_ASSERT_VALID((*this)) if (it == end()) return it; iterator ret_it = it; ++ret_it; _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node); erase_leaf(static_cast<leaf_pointer>(it.m_p_nd)); PB_DS_ASSERT_VALID((*this)) return ret_it; } #endif // #ifdef PB_DS_DATA_TRUE_INDICATOR PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_reverse_iterator PB_DS_CLASS_C_DEC:: erase(const_reverse_iterator it) { PB_DS_ASSERT_VALID((*this)) if (it.m_p_nd == m_p_head) return it; const_reverse_iterator ret_it = it; ++ret_it; _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node); erase_leaf(static_cast<leaf_pointer>(it.m_p_nd)); PB_DS_ASSERT_VALID((*this)) return ret_it; } #ifdef PB_DS_DATA_TRUE_INDICATOR PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::reverse_iterator PB_DS_CLASS_C_DEC:: erase(reverse_iterator it) { PB_DS_ASSERT_VALID((*this)) if (it.m_p_nd == m_p_head) return it; reverse_iterator ret_it = it; ++ret_it; _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node); erase_leaf(static_cast<leaf_pointer>(it.m_p_nd)); PB_DS_ASSERT_VALID((*this)) return ret_it; } #endif // #ifdef PB_DS_DATA_TRUE_INDICATOR PB_DS_CLASS_T_DEC template<typename Pred> inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: erase_if(Pred pred) { size_type num_ersd = 0; PB_DS_ASSERT_VALID((*this)) iterator it = begin(); while (it != end()) { PB_DS_ASSERT_VALID((*this)) if (pred(*it)) { ++num_ersd; it = erase(it); } else ++it; } PB_DS_ASSERT_VALID((*this)) return num_ersd; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: erase_leaf(leaf_pointer p_l) { update_min_max_for_erased_leaf(p_l); if (p_l->m_p_parent->m_type == head_node) { _GLIBCXX_DEBUG_ASSERT(size() == 1); clear(); return; } _GLIBCXX_DEBUG_ASSERT(size() > 1); _GLIBCXX_DEBUG_ASSERT(p_l->m_p_parent->m_type == i_node); inode_pointer p_parent = static_cast<inode_pointer>(p_l->m_p_parent); p_parent->remove_child(p_l); erase_fixup(p_parent); actual_erase_leaf(p_l); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: update_min_max_for_erased_leaf(leaf_pointer p_l) { if (m_size == 1) { m_p_head->m_p_min = m_p_head; m_p_head->m_p_max = m_p_head; return; } if (p_l == static_cast<leaf_const_pointer>(m_p_head->m_p_min)) { iterator it(p_l); ++it; m_p_head->m_p_min = it.m_p_nd; return; } if (p_l == static_cast<leaf_const_pointer>(m_p_head->m_p_max)) { iterator it(p_l); --it; m_p_head->m_p_max = it.m_p_nd; } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp��������������������������������������������������0000644�����������������00000040745�14763166030�0015363 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pat_trie_/pat_trie_.hpp * Contains an implementation class for a patricia tree. */ #include <iterator> #include <utility> #include <algorithm> #include <functional> #include <assert.h> #include <list> #include <ext/pb_ds/exception.hpp> #include <ext/pb_ds/tag_and_trait.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/detail/cond_dealtor.hpp> #include <ext/pb_ds/detail/type_utils.hpp> #include <ext/pb_ds/detail/types_traits.hpp> #include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp> #include <ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp> #include <ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp> #ifdef _GLIBCXX_DEBUG #include <ext/pb_ds/detail/debug_map_base.hpp> #endif #include <debug/debug.h> namespace __gnu_pbds { namespace detail { #ifdef PB_DS_DATA_TRUE_INDICATOR #define PB_DS_PAT_TRIE_NAME pat_trie_map #endif #ifdef PB_DS_DATA_FALSE_INDICATOR #define PB_DS_PAT_TRIE_NAME pat_trie_set #endif #define PB_DS_CLASS_T_DEC \ template<typename Key, typename Mapped, typename Node_And_It_Traits, \ typename _Alloc> #define PB_DS_CLASS_C_DEC \ PB_DS_PAT_TRIE_NAME<Key, Mapped, Node_And_It_Traits, _Alloc> #define PB_DS_PAT_TRIE_TRAITS_BASE \ types_traits<Key, Mapped, _Alloc, false> #ifdef _GLIBCXX_DEBUG #define PB_DS_DEBUG_MAP_BASE_C_DEC \ debug_map_base<Key, eq_by_less<Key, std::less<Key> >, \ typename _Alloc::template rebind<Key>::other::const_reference> #endif /** * @brief PATRICIA trie. * @ingroup branch-detail * * This implementation loosely borrows ideas from: * 1) Fast Mergeable Integer Maps, Okasaki, Gill 1998 * 2) Ptset: Sets of integers implemented as Patricia trees, * Jean-Christophe Filliatr, 2000 */ template<typename Key, typename Mapped, typename Node_And_It_Traits, typename _Alloc> class PB_DS_PAT_TRIE_NAME : #ifdef _GLIBCXX_DEBUG public PB_DS_DEBUG_MAP_BASE_C_DEC, #endif public Node_And_It_Traits::synth_access_traits, public Node_And_It_Traits::node_update, public PB_DS_PAT_TRIE_TRAITS_BASE, public pat_trie_base { private: typedef pat_trie_base base_type; typedef PB_DS_PAT_TRIE_TRAITS_BASE traits_base; typedef Node_And_It_Traits traits_type; typedef typename traits_type::synth_access_traits synth_access_traits; typedef typename synth_access_traits::const_iterator a_const_iterator; typedef typename traits_type::node node; typedef typename _Alloc::template rebind<node> __rebind_n; typedef typename __rebind_n::other::const_pointer node_const_pointer; typedef typename __rebind_n::other::pointer node_pointer; typedef typename traits_type::head head; typedef typename _Alloc::template rebind<head> __rebind_h; typedef typename __rebind_h::other head_allocator; typedef typename head_allocator::pointer head_pointer; typedef typename traits_type::leaf leaf; typedef typename _Alloc::template rebind<leaf> __rebind_l; typedef typename __rebind_l::other leaf_allocator; typedef typename leaf_allocator::pointer leaf_pointer; typedef typename leaf_allocator::const_pointer leaf_const_pointer; typedef typename traits_type::inode inode; typedef typename inode::iterator inode_iterator; typedef typename _Alloc::template rebind<inode> __rebind_in; typedef typename __rebind_in::other __rebind_ina; typedef typename __rebind_in::other inode_allocator; typedef typename __rebind_ina::pointer inode_pointer; typedef typename __rebind_ina::const_pointer inode_const_pointer; /// Conditional deallocator. class cond_dealtor { protected: leaf_pointer m_p_nd; bool m_no_action_dtor; bool m_call_destructor; public: cond_dealtor(leaf_pointer p_nd) : m_p_nd(p_nd), m_no_action_dtor(false), m_call_destructor(false) { } void set_no_action_dtor() { m_no_action_dtor = true; } void set_call_destructor() { m_call_destructor = true; } ~cond_dealtor() { if (m_no_action_dtor) return; if (m_call_destructor) m_p_nd->~leaf(); s_leaf_allocator.deallocate(m_p_nd, 1); } }; /// Branch bag, for split-join. class branch_bag { private: typedef inode_pointer __inp; typedef typename _Alloc::template rebind<__inp>::other __rebind_inp; #ifdef _GLIBCXX_DEBUG typedef std::_GLIBCXX_STD_C::list<__inp, __rebind_inp> bag_type; #else typedef std::list<__inp, __rebind_inp> bag_type; #endif bag_type m_bag; public: void add_branch() { inode_pointer p_nd = s_inode_allocator.allocate(1); __try { m_bag.push_back(p_nd); } __catch(...) { s_inode_allocator.deallocate(p_nd, 1); __throw_exception_again; } } inode_pointer get_branch() { _GLIBCXX_DEBUG_ASSERT(!m_bag.empty()); inode_pointer p_nd = *m_bag.begin(); m_bag.pop_front(); return p_nd; } ~branch_bag() { while (!m_bag.empty()) { inode_pointer p_nd = *m_bag.begin(); s_inode_allocator.deallocate(p_nd, 1); m_bag.pop_front(); } } inline bool empty() const { return m_bag.empty(); } }; #ifdef _GLIBCXX_DEBUG typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base; #endif typedef typename traits_type::null_node_update_pointer null_node_update_pointer; public: typedef pat_trie_tag container_category; typedef _Alloc allocator_type; typedef typename _Alloc::size_type size_type; typedef typename _Alloc::difference_type difference_type; typedef typename traits_base::key_type key_type; typedef typename traits_base::key_pointer key_pointer; typedef typename traits_base::key_const_pointer key_const_pointer; typedef typename traits_base::key_reference key_reference; typedef typename traits_base::key_const_reference key_const_reference; typedef typename traits_base::mapped_type mapped_type; typedef typename traits_base::mapped_pointer mapped_pointer; typedef typename traits_base::mapped_const_pointer mapped_const_pointer; typedef typename traits_base::mapped_reference mapped_reference; typedef typename traits_base::mapped_const_reference mapped_const_reference; typedef typename traits_base::value_type value_type; typedef typename traits_base::pointer pointer; typedef typename traits_base::const_pointer const_pointer; typedef typename traits_base::reference reference; typedef typename traits_base::const_reference const_reference; typedef typename traits_type::access_traits access_traits; typedef typename traits_type::const_iterator point_const_iterator; typedef typename traits_type::iterator point_iterator; typedef point_const_iterator const_iterator; typedef point_iterator iterator; typedef typename traits_type::reverse_iterator reverse_iterator; typedef typename traits_type::const_reverse_iterator const_reverse_iterator; typedef typename traits_type::node_const_iterator node_const_iterator; typedef typename traits_type::node_iterator node_iterator; typedef typename traits_type::node_update node_update; PB_DS_PAT_TRIE_NAME(); PB_DS_PAT_TRIE_NAME(const access_traits&); PB_DS_PAT_TRIE_NAME(const PB_DS_CLASS_C_DEC&); void swap(PB_DS_CLASS_C_DEC&); ~PB_DS_PAT_TRIE_NAME(); inline bool empty() const; inline size_type size() const; inline size_type max_size() const; access_traits& get_access_traits(); const access_traits& get_access_traits() const; node_update& get_node_update(); const node_update& get_node_update() const; inline std::pair<point_iterator, bool> insert(const_reference); inline mapped_reference operator[](key_const_reference r_key) { #ifdef PB_DS_DATA_TRUE_INDICATOR return insert(std::make_pair(r_key, mapped_type())).first->second; #else insert(r_key); return traits_base::s_null_type; #endif } inline point_iterator find(key_const_reference); inline point_const_iterator find(key_const_reference) const; inline point_iterator lower_bound(key_const_reference); inline point_const_iterator lower_bound(key_const_reference) const; inline point_iterator upper_bound(key_const_reference); inline point_const_iterator upper_bound(key_const_reference) const; void clear(); inline bool erase(key_const_reference); inline const_iterator erase(const_iterator); #ifdef PB_DS_DATA_TRUE_INDICATOR inline iterator erase(iterator); #endif inline const_reverse_iterator erase(const_reverse_iterator); #ifdef PB_DS_DATA_TRUE_INDICATOR inline reverse_iterator erase(reverse_iterator); #endif template<typename Pred> inline size_type erase_if(Pred); void join(PB_DS_CLASS_C_DEC&); void split(key_const_reference, PB_DS_CLASS_C_DEC&); inline iterator begin(); inline const_iterator begin() const; inline iterator end(); inline const_iterator end() const; inline reverse_iterator rbegin(); inline const_reverse_iterator rbegin() const; inline reverse_iterator rend(); inline const_reverse_iterator rend() const; /// Returns a const node_iterator corresponding to the node at the /// root of the tree. inline node_const_iterator node_begin() const; /// Returns a node_iterator corresponding to the node at the /// root of the tree. inline node_iterator node_begin(); /// Returns a const node_iterator corresponding to a node just /// after a leaf of the tree. inline node_const_iterator node_end() const; /// Returns a node_iterator corresponding to a node just /// after a leaf of the tree. inline node_iterator node_end(); #ifdef PB_DS_PAT_TRIE_TRACE_ void trace() const; #endif protected: template<typename It> void copy_from_range(It, It); void value_swap(PB_DS_CLASS_C_DEC&); node_pointer recursive_copy_node(node_const_pointer); private: void initialize(); inline void apply_update(node_pointer, null_node_update_pointer); template<typename Node_Update_> inline void apply_update(node_pointer, Node_Update_*); bool join_prep(PB_DS_CLASS_C_DEC&, branch_bag&); void rec_join_prep(node_const_pointer, node_const_pointer, branch_bag&); void rec_join_prep(leaf_const_pointer, leaf_const_pointer, branch_bag&); void rec_join_prep(leaf_const_pointer, inode_const_pointer, branch_bag&); void rec_join_prep(inode_const_pointer, leaf_const_pointer, branch_bag&); void rec_join_prep(inode_const_pointer, inode_const_pointer, branch_bag&); node_pointer rec_join(node_pointer, node_pointer, size_type, branch_bag&); node_pointer rec_join(leaf_pointer, leaf_pointer, branch_bag&); node_pointer rec_join(leaf_pointer, inode_pointer, size_type, branch_bag&); node_pointer rec_join(inode_pointer, leaf_pointer, size_type, branch_bag&); node_pointer rec_join(inode_pointer, inode_pointer, branch_bag&); size_type keys_diff_ind(typename access_traits::const_iterator, typename access_traits::const_iterator, typename access_traits::const_iterator, typename access_traits::const_iterator); inode_pointer insert_branch(node_pointer, node_pointer, branch_bag&); void update_min_max_for_inserted_leaf(leaf_pointer); void erase_leaf(leaf_pointer); inline void actual_erase_leaf(leaf_pointer); void clear_imp(node_pointer); void erase_fixup(inode_pointer); void update_min_max_for_erased_leaf(leaf_pointer); static inline a_const_iterator pref_begin(node_const_pointer); static inline a_const_iterator pref_end(node_const_pointer); inline node_pointer find_imp(key_const_reference); inline node_pointer lower_bound_imp(key_const_reference); inline node_pointer upper_bound_imp(key_const_reference); inline static leaf_const_pointer leftmost_descendant(node_const_pointer); inline static leaf_pointer leftmost_descendant(node_pointer); inline static leaf_const_pointer rightmost_descendant(node_const_pointer); inline static leaf_pointer rightmost_descendant(node_pointer); #ifdef _GLIBCXX_DEBUG void assert_valid(const char*, int) const; void assert_iterators(const char*, int) const; void assert_reverse_iterators(const char*, int) const; static size_type recursive_count_leafs(node_const_pointer, const char*, int); #endif #ifdef PB_DS_PAT_TRIE_TRACE_ static void trace_node(node_const_pointer, size_type); template<typename Metadata_> static void trace_node_metadata(node_const_pointer, type_to_type<Metadata_>); static void trace_node_metadata(node_const_pointer, type_to_type<null_type>); #endif leaf_pointer split_prep(key_const_reference, PB_DS_CLASS_C_DEC&, branch_bag&); node_pointer rec_split(node_pointer, a_const_iterator, a_const_iterator, PB_DS_CLASS_C_DEC&, branch_bag&); void split_insert_branch(size_type, a_const_iterator, inode_iterator, size_type, branch_bag&); static head_allocator s_head_allocator; static inode_allocator s_inode_allocator; static leaf_allocator s_leaf_allocator; head_pointer m_p_head; size_type m_size; }; #define PB_DS_ASSERT_NODE_VALID(X) \ _GLIBCXX_DEBUG_ONLY(X->assert_valid(this, __FILE__, __LINE__);) #define PB_DS_RECURSIVE_COUNT_LEAFS(X) \ recursive_count_leafs(X, __FILE__, __LINE__) #include <ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp> #include <ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp> #include <ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp> #include <ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp> #include <ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp> #include <ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp> #include <ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp> #include <ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp> #include <ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp> #include <ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp> #include <ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp> #undef PB_DS_RECURSIVE_COUNT_LEAFS #undef PB_DS_ASSERT_NODE_VALID #undef PB_DS_CLASS_C_DEC #undef PB_DS_CLASS_T_DEC #undef PB_DS_PAT_TRIE_NAME #undef PB_DS_PAT_TRIE_TRAITS_BASE #undef PB_DS_DEBUG_MAP_BASE_C_DEC } // namespace detail } // namespace __gnu_pbds ���������������������������c++/4.8.2/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp����������������������������������������������0000644�����������������00000006511�14763166030�0016217 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pat_trie_/trace_fn_imps.hpp * Contains an implementation class for pat_trie_. */ #ifdef PB_DS_PAT_TRIE_TRACE_ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace() const { std::cerr << std::endl; if (m_p_head->m_p_parent == 0) return; trace_node(m_p_head->m_p_parent, 0); std::cerr << std::endl; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace_node(node_const_pointer p_nd, size_type level) { for (size_type i = 0; i < level; ++i) std::cerr << ' '; std::cerr << p_nd << " "; std::cerr << ((p_nd->m_type == pat_trie_leaf_node_type) ? "l " : "i "); trace_node_metadata(p_nd, type_to_type<typename node::metadata_type>()); typename access_traits::const_iterator el_it = pref_begin(p_nd); while (el_it != pref_end(p_nd)) { std::cerr <<* el_it; ++el_it; } if (p_nd->m_type == pat_trie_leaf_node_type) { std::cerr << std::endl; return; } inode_const_pointer p_internal = static_cast<inode_const_pointer>(p_nd); std::cerr << " " << static_cast<unsigned long>(p_internal->get_e_ind()) << std::endl; const size_type num_children = std::distance(p_internal->begin(), p_internal->end()); for (size_type child_i = 0; child_i < num_children; ++child_i) { typename inode::const_iterator child_it = p_internal->begin(); std::advance(child_it, num_children - child_i - 1); trace_node(*child_it, level + 1); } } PB_DS_CLASS_T_DEC template<typename Metadata_> void PB_DS_CLASS_C_DEC:: trace_node_metadata(node_const_pointer p_nd, type_to_type<Metadata_>) { std::cerr << "(" << static_cast<unsigned long>(p_nd->get_metadata()) << ") "; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace_node_metadata(node_const_pointer, type_to_type<null_type>) { } #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp�����������������������������������������������0000644�����������������00000004010�14763166030�0016044 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pat_trie_/info_fn_imps.hpp * Contains an implementation class for pat_trie. */ PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: empty() const { return (m_size == 0); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: size() const { return m_size; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: max_size() const { return s_inode_allocator.max_size(); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp����������������������������������������������0000644�����������������00000007317�14763166030�0016214 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pat_trie_/debug_fn_imps.hpp * Contains an implementation class for pat_trie_. */ #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_valid(const char* __file, int __line) const { if (m_p_head->m_p_parent != 0) m_p_head->m_p_parent->assert_valid(this, __file, __line); assert_iterators(__file, __line); assert_reverse_iterators(__file, __line); if (m_p_head->m_p_parent == 0) { PB_DS_DEBUG_VERIFY(m_p_head->m_p_min == m_p_head); PB_DS_DEBUG_VERIFY(m_p_head->m_p_max == m_p_head); PB_DS_DEBUG_VERIFY(empty()); return; } PB_DS_DEBUG_VERIFY(m_p_head->m_p_min->m_type == leaf_node); PB_DS_DEBUG_VERIFY(m_p_head->m_p_max->m_type == leaf_node); PB_DS_DEBUG_VERIFY(!empty()); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_iterators(const char* __file, int __line) const { size_type calc_size = 0; for (const_iterator it = begin(); it != end(); ++it) { ++calc_size; debug_base::check_key_exists(PB_DS_V2F(*it), __file, __line); PB_DS_DEBUG_VERIFY(lower_bound(PB_DS_V2F(*it)) == it); PB_DS_DEBUG_VERIFY(--upper_bound(PB_DS_V2F(*it)) == it); } PB_DS_DEBUG_VERIFY(calc_size == m_size); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_reverse_iterators(const char* __file, int __line) const { size_type calc_size = 0; for (const_reverse_iterator it = rbegin(); it != rend(); ++it) { ++calc_size; node_const_pointer p_nd = const_cast<PB_DS_CLASS_C_DEC*>(this)->find_imp(PB_DS_V2F(*it)); PB_DS_DEBUG_VERIFY(p_nd == it.m_p_nd); } PB_DS_DEBUG_VERIFY(calc_size == m_size); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: recursive_count_leafs(node_const_pointer p_nd, const char* __file, int __line) { if (p_nd == 0) return (0); if (p_nd->m_type == leaf_node) return (1); PB_DS_DEBUG_VERIFY(p_nd->m_type == i_node); size_type ret = 0; for (typename inode::const_iterator it = static_cast<inode_const_pointer>(p_nd)->begin(); it != static_cast<inode_const_pointer>(p_nd)->end(); ++it) ret += recursive_count_leafs(*it, __file, __line); return ret; } #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp�������������������������0000644�����������������00000015325�14763166030�0022643 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file ov_tree_map_/constructors_destructor_fn_imps.hpp * Contains an implementation class for ov_tree_. */ PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::value_allocator PB_DS_CLASS_C_DEC::s_value_alloc; PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::metadata_allocator PB_DS_CLASS_C_DEC::s_metadata_alloc; PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_OV_TREE_NAME() : m_a_values(0), m_a_metadata(0), m_end_it(0), m_size(0) { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_OV_TREE_NAME(const Cmp_Fn& r_cmp_fn) : cmp_fn(r_cmp_fn), m_a_values(0), m_a_metadata(0), m_end_it(0), m_size(0) { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_OV_TREE_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_nodeu) : cmp_fn(r_cmp_fn), node_update(r_nodeu), m_a_values(0), m_a_metadata(0), m_end_it(0), m_size(0) { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_OV_TREE_NAME(const PB_DS_CLASS_C_DEC& other) : #ifdef PB_DS_TREE_TRACE trace_base(other), #endif cmp_fn(other), node_update(other), m_a_values(0), m_a_metadata(0), m_end_it(0), m_size(0) { copy_from_ordered_range(other.begin(), other.end()); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC template<typename It> inline void PB_DS_CLASS_C_DEC:: copy_from_range(It first_it, It last_it) { #ifdef PB_DS_DATA_TRUE_INDICATOR typedef std::map<key_type, mapped_type, Cmp_Fn, typename _Alloc::template rebind<value_type>::other> map_type; #else typedef std::set<key_type, Cmp_Fn, typename _Alloc::template rebind<Key>::other> map_type; #endif map_type m(first_it, last_it); copy_from_ordered_range(m.begin(), m.end()); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC template<typename It> void PB_DS_CLASS_C_DEC:: copy_from_ordered_range(It first_it, It last_it) { const size_type len = std::distance(first_it, last_it); if (len == 0) return; value_vector a_values = s_value_alloc.allocate(len); iterator target_it = a_values; It source_it = first_it; It source_end_it = last_it; cond_dtor<size_type> cd(a_values, target_it, len); while (source_it != source_end_it) { void* __v = const_cast<void*>(static_cast<const void*>(target_it)); new (__v) value_type(*source_it++); ++target_it; } reallocate_metadata((node_update*)this, len); cd.set_no_action(); m_a_values = a_values; m_size = len; m_end_it = m_a_values + m_size; update(PB_DS_node_begin_imp(), (node_update*)this); #ifdef _GLIBCXX_DEBUG for (const_iterator dbg_it = m_a_values; dbg_it != m_end_it; ++dbg_it) debug_base::insert_new(PB_DS_V2F(*dbg_it)); #endif } PB_DS_CLASS_T_DEC template<typename It> void PB_DS_CLASS_C_DEC:: copy_from_ordered_range(It first_it, It last_it, It other_first_it, It other_last_it) { clear(); const size_type len = std::distance(first_it, last_it) + std::distance(other_first_it, other_last_it); value_vector a_values = s_value_alloc.allocate(len); iterator target_it = a_values; It source_it = first_it; It source_end_it = last_it; cond_dtor<size_type> cd(a_values, target_it, len); while (source_it != source_end_it) { new (const_cast<void* >(static_cast<const void* >(target_it))) value_type(*source_it++); ++target_it; } source_it = other_first_it; source_end_it = other_last_it; while (source_it != source_end_it) { new (const_cast<void* >(static_cast<const void* >(target_it))) value_type(*source_it++); ++target_it; } reallocate_metadata((node_update* )this, len); cd.set_no_action(); m_a_values = a_values; m_size = len; m_end_it = m_a_values + m_size; update(PB_DS_node_begin_imp(), (node_update* )this); #ifdef _GLIBCXX_DEBUG for (const_iterator dbg_it = m_a_values; dbg_it != m_end_it; ++dbg_it) debug_base::insert_new(PB_DS_V2F(*dbg_it)); #endif } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) value_swap(other); std::swap(static_cast<cmp_fn&>(*this), static_cast<cmp_fn&>(other)); std::swap(static_cast<traits_base&>(*this), static_cast<traits_base&>(other)); PB_DS_ASSERT_VALID(other) PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: value_swap(PB_DS_CLASS_C_DEC& other) { _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);) std::swap(m_a_values, other.m_a_values); std::swap(m_a_metadata, other.m_a_metadata); std::swap(m_size, other.m_size); std::swap(m_end_it, other.m_end_it); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ~PB_DS_OV_TREE_NAME() { PB_DS_ASSERT_VALID((*this)) cond_dtor<size_type> cd(m_a_values, m_end_it, m_size); reallocate_metadata((node_update*)this, 0); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: update(node_iterator, null_node_update_pointer) { } PB_DS_CLASS_T_DEC template<typename Node_Update> void PB_DS_CLASS_C_DEC:: update(node_iterator nd_it, Node_Update* p_update) { node_const_iterator end_it = PB_DS_node_end_imp(); if (nd_it != end_it) { update(nd_it.get_l_child(), p_update); update(nd_it.get_r_child(), p_update); node_update::operator()(nd_it, end_it); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp������������������������������������������0000644�����������������00000004341�14763166030�0017115 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file ov_tree_map_/insert_fn_imps.hpp * Contains an implementation class for ov_tree_. */ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: reallocate_metadata(null_node_update_pointer, size_type) { } PB_DS_CLASS_T_DEC template<typename Node_Update_> void PB_DS_CLASS_C_DEC:: reallocate_metadata(Node_Update_* , size_type new_size) { metadata_pointer a_new_metadata_vec =(new_size == 0) ? 0 : s_metadata_alloc.allocate(new_size); if (m_a_metadata != 0) { for (size_type i = 0; i < m_size; ++i) m_a_metadata[i].~metadata_type(); s_metadata_alloc.deallocate(m_a_metadata, m_size); } std::swap(m_a_metadata, a_new_metadata_vec); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp���������������������������������������0000644�����������������00000006441�14763166030�0017630 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file ov_tree_map_/iterators_fn_imps.hpp * Contains an implementation class for ov_tree_. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_const_iterator PB_DS_CLASS_C_DEC:: node_begin() const { return PB_DS_node_begin_imp(); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_const_iterator PB_DS_CLASS_C_DEC:: node_end() const { return PB_DS_node_end_imp(); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_iterator PB_DS_CLASS_C_DEC:: node_begin() { return PB_DS_node_begin_imp(); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_iterator PB_DS_CLASS_C_DEC:: node_end() { return PB_DS_node_end_imp(); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_const_iterator PB_DS_CLASS_C_DEC:: PB_DS_node_begin_imp() const { return node_const_iterator(const_cast<pointer>(mid_pointer(begin(), end())), const_cast<pointer>(begin()), const_cast<pointer>(end()),(m_a_metadata == 0)? 0 : mid_pointer(m_a_metadata, m_a_metadata + m_size)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_const_iterator PB_DS_CLASS_C_DEC:: PB_DS_node_end_imp() const { return node_const_iterator(end(), end(), end(), (m_a_metadata == 0) ? 0 : m_a_metadata + m_size); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_iterator PB_DS_CLASS_C_DEC:: PB_DS_node_begin_imp() { return node_iterator(mid_pointer(begin(), end()), begin(), end(), (m_a_metadata == 0) ? 0 : mid_pointer(m_a_metadata, m_a_metadata + m_size)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_iterator PB_DS_CLASS_C_DEC:: PB_DS_node_end_imp() { return node_iterator(end(), end(), end(),(m_a_metadata == 0) ? 0 : m_a_metadata + m_size); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp��������������������������������������0000644�����������������00000007276�14763166030�0017775 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file ov_tree_map_/split_join_fn_imps.hpp * Contains an implementation class for ov_tree_. */ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: split(key_const_reference r_key, PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) if (m_size == 0) { other.clear(); return; } if (Cmp_Fn::operator()(r_key, PB_DS_V2F(*begin()))) { value_swap(other); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) return; } if (!Cmp_Fn::operator()(r_key, PB_DS_V2F(*(end() - 1)))) { return; } if (m_size == 1) { value_swap(other); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) return; } iterator it = upper_bound(r_key); PB_DS_CLASS_C_DEC new_other(other, other); new_other.copy_from_ordered_range(it, end()); PB_DS_CLASS_C_DEC new_this(*this, *this); new_this.copy_from_ordered_range(begin(), it); // No exceptions from this point. other.update(other.node_begin(), (node_update*)(&other)); update(node_begin(), (node_update*)this); other.value_swap(new_other); value_swap(new_this); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: join(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) if (other.m_size == 0) return; if (m_size == 0) { value_swap(other); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) return; } const bool greater = Cmp_Fn::operator()(PB_DS_V2F(*(end() - 1)), PB_DS_V2F(*other.begin())); const bool lesser = Cmp_Fn::operator()(PB_DS_V2F(*(other.end() - 1)), PB_DS_V2F(*begin())); if (!greater && !lesser) __throw_join_error(); PB_DS_CLASS_C_DEC new_this(*this, *this); if (greater) new_this.copy_from_ordered_range(begin(), end(), other.begin(), other.end()); else new_this.copy_from_ordered_range(other.begin(), other.end(), begin(), end()); // No exceptions from this point. value_swap(new_this); other.clear(); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/ov_tree_map_/traits.hpp��������������������������������������������������0000644�����������������00000010722�14763166030�0015404 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file ov_tree_map_/traits.hpp * Contains an implementation class for ov_tree_. */ #ifndef PB_DS_OV_TREE_NODE_AND_IT_TRAITS_HPP #define PB_DS_OV_TREE_NODE_AND_IT_TRAITS_HPP #include <ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp> namespace __gnu_pbds { namespace detail { /// Tree traits. /// @ingroup traits template<typename Key, typename Mapped, class Cmp_Fn, template<typename Node_CItr, class Node_Itr, class Cmp_Fn_, typename _Alloc_> class Node_Update, typename _Alloc> struct tree_traits< Key, Mapped, Cmp_Fn, Node_Update, ov_tree_tag, _Alloc> { private: typedef typename types_traits< Key, Mapped, _Alloc, false>::value_type value_type; public: typedef typename tree_node_metadata_dispatch< Key, Mapped, Cmp_Fn, Node_Update, _Alloc>::type metadata_type; /// This is an iterator to an iterator: it iterates over nodes, /// and de-referencing it returns one of the tree's iterators. typedef ov_tree_node_const_it_< value_type, metadata_type, _Alloc> node_const_iterator; typedef ov_tree_node_it_< value_type, metadata_type, _Alloc> node_iterator; typedef Node_Update< node_const_iterator, node_iterator, Cmp_Fn, _Alloc> node_update; typedef __gnu_pbds::null_node_update< node_const_iterator, node_iterator, Cmp_Fn, _Alloc>* null_node_update_pointer; }; /// Specialization. /// @ingroup traits template<typename Key, class Cmp_Fn, template<typename Node_CItr, class Node_Itr, class Cmp_Fn_, typename _Alloc_> class Node_Update, typename _Alloc> struct tree_traits< Key, null_type, Cmp_Fn, Node_Update, ov_tree_tag, _Alloc> { private: typedef typename types_traits< Key, null_type, _Alloc, false>::value_type value_type; public: typedef typename tree_node_metadata_dispatch< Key, null_type, Cmp_Fn, Node_Update, _Alloc>::type metadata_type; /// This is an iterator to an iterator: it iterates over nodes, /// and de-referencing it returns one of the tree's iterators. typedef ov_tree_node_const_it_< value_type, metadata_type, _Alloc> node_const_iterator; typedef node_const_iterator node_iterator; typedef Node_Update< node_const_iterator, node_const_iterator, Cmp_Fn, _Alloc> node_update; typedef __gnu_pbds::null_node_update< node_const_iterator, node_iterator, Cmp_Fn, _Alloc>* null_node_update_pointer; }; } // namespace detail } // namespace __gnu_pbds #endif // #ifndef PB_DS_OV_TREE_NODE_AND_IT_TRAITS_HPP ����������������������������������������������c++/4.8.2/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp������������������������������������������0000644�����������������00000021153�14763166030�0017117 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file ov_tree_map_/node_iterators.hpp * Contains an implementation class for ov_tree_. */ #ifndef PB_DS_OV_TREE_NODE_ITERATORS_HPP #define PB_DS_OV_TREE_NODE_ITERATORS_HPP #include <ext/pb_ds/tag_and_trait.hpp> #include <ext/pb_ds/detail/type_utils.hpp> #include <debug/debug.h> namespace __gnu_pbds { namespace detail { #define PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC \ ov_tree_node_const_it_<Value_Type, Metadata_Type, _Alloc> /// Const node reference. template<typename Value_Type, typename Metadata_Type, typename _Alloc> class ov_tree_node_const_it_ { protected: typedef typename _Alloc::template rebind< Value_Type>::other::pointer pointer; typedef typename _Alloc::template rebind< Value_Type>::other::const_pointer const_pointer; typedef typename _Alloc::template rebind< Metadata_Type>::other::const_pointer const_metadata_pointer; typedef PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC this_type; protected: template<typename Ptr> inline static Ptr mid_pointer(Ptr p_begin, Ptr p_end) { _GLIBCXX_DEBUG_ASSERT(p_end >= p_begin); return (p_begin + (p_end - p_begin) / 2); } public: typedef trivial_iterator_tag iterator_category; typedef trivial_iterator_difference_type difference_type; typedef typename _Alloc::template rebind< Value_Type>::other::const_pointer value_type; typedef typename _Alloc::template rebind< typename remove_const< Value_Type>::type>::other::const_pointer reference; typedef typename _Alloc::template rebind< typename remove_const< Value_Type>::type>::other::const_pointer const_reference; typedef Metadata_Type metadata_type; typedef typename _Alloc::template rebind< metadata_type>::other::const_reference metadata_const_reference; public: inline ov_tree_node_const_it_(const_pointer p_nd = 0, const_pointer p_begin_nd = 0, const_pointer p_end_nd = 0, const_metadata_pointer p_metadata = 0) : m_p_value(const_cast<pointer>(p_nd)), m_p_begin_value(const_cast<pointer>(p_begin_nd)), m_p_end_value(const_cast<pointer>(p_end_nd)), m_p_metadata(p_metadata) { } inline const_reference operator*() const { return m_p_value; } inline metadata_const_reference get_metadata() const { enum { has_metadata = !is_same<Metadata_Type, null_type>::value }; PB_DS_STATIC_ASSERT(should_have_metadata, has_metadata); _GLIBCXX_DEBUG_ASSERT(m_p_metadata != 0); return *m_p_metadata; } /// Returns the node iterator associated with the left node. inline this_type get_l_child() const { if (m_p_begin_value == m_p_value) return (this_type(m_p_begin_value, m_p_begin_value, m_p_begin_value)); const_metadata_pointer p_begin_metadata = m_p_metadata - (m_p_value - m_p_begin_value); return (this_type(mid_pointer(m_p_begin_value, m_p_value), m_p_begin_value, m_p_value, mid_pointer(p_begin_metadata, m_p_metadata))); } /// Returns the node iterator associated with the right node. inline this_type get_r_child() const { if (m_p_value == m_p_end_value) return (this_type(m_p_end_value, m_p_end_value, m_p_end_value)); const_metadata_pointer p_end_metadata = m_p_metadata + (m_p_end_value - m_p_value); return (this_type(mid_pointer(m_p_value + 1, m_p_end_value), m_p_value + 1, m_p_end_value,(m_p_metadata == 0) ? 0 : mid_pointer(m_p_metadata + 1, p_end_metadata))); } inline bool operator==(const this_type& other) const { const bool is_end = m_p_begin_value == m_p_end_value; const bool is_other_end = other.m_p_begin_value == other.m_p_end_value; if (is_end) return (is_other_end); if (is_other_end) return (is_end); return m_p_value == other.m_p_value; } inline bool operator!=(const this_type& other) const { return !operator==(other); } public: pointer m_p_value; pointer m_p_begin_value; pointer m_p_end_value; const_metadata_pointer m_p_metadata; }; #define PB_DS_OV_TREE_NODE_ITERATOR_C_DEC \ ov_tree_node_it_<Value_Type, Metadata_Type, _Alloc> /// Node reference. template<typename Value_Type, typename Metadata_Type, typename _Alloc> class ov_tree_node_it_ : public PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC { private: typedef PB_DS_OV_TREE_NODE_ITERATOR_C_DEC this_type; typedef PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC base_type; typedef typename base_type::pointer pointer; typedef typename base_type::const_pointer const_pointer; typedef typename base_type::const_metadata_pointer const_metadata_pointer; public: typedef trivial_iterator_tag iterator_category; typedef trivial_iterator_difference_type difference_type; typedef typename _Alloc::template rebind< Value_Type>::other::pointer value_type; typedef typename _Alloc::template rebind< typename remove_const< Value_Type>::type>::other::pointer reference; typedef typename _Alloc::template rebind< typename remove_const< Value_Type>::type>::other::pointer const_reference; inline ov_tree_node_it_(const_pointer p_nd = 0, const_pointer p_begin_nd = 0, const_pointer p_end_nd = 0, const_metadata_pointer p_metadata = 0) : base_type(p_nd, p_begin_nd, p_end_nd, p_metadata) { } /// Access. inline reference operator*() const { return reference(base_type::m_p_value); } /// Returns the node reference associated with the left node. inline ov_tree_node_it_ get_l_child() const { if (base_type::m_p_begin_value == base_type::m_p_value) return (this_type(base_type::m_p_begin_value, base_type::m_p_begin_value, base_type::m_p_begin_value)); const_metadata_pointer p_begin_metadata = base_type::m_p_metadata - (base_type::m_p_value - base_type::m_p_begin_value); return (this_type(base_type::mid_pointer(base_type::m_p_begin_value, base_type::m_p_value), base_type::m_p_begin_value, base_type::m_p_value, base_type::mid_pointer(p_begin_metadata, base_type::m_p_metadata))); } /// Returns the node reference associated with the right node. inline ov_tree_node_it_ get_r_child() const { if (base_type::m_p_value == base_type::m_p_end_value) return this_type(base_type::m_p_end_value, base_type::m_p_end_value, base_type::m_p_end_value); const_metadata_pointer p_end_metadata = base_type::m_p_metadata + (base_type::m_p_end_value - base_type::m_p_value); return (this_type(base_type::mid_pointer(base_type::m_p_value + 1, base_type::m_p_end_value), base_type::m_p_value + 1, base_type::m_p_end_value,(base_type::m_p_metadata == 0)? 0 : base_type::mid_pointer(base_type::m_p_metadata + 1, p_end_metadata))); } }; #undef PB_DS_OV_TREE_NODE_ITERATOR_C_DEC #undef PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC } // namespace detail } // namespace __gnu_pbds #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp�����������������������������������0000644�����������������00000003537�14763166030�0020437 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file ov_tree_map_/policy_access_fn_imps.hpp * Contains an implementation class for ov_tree. */ PB_DS_CLASS_T_DEC Cmp_Fn& PB_DS_CLASS_C_DEC:: get_cmp_fn() { return *this; } PB_DS_CLASS_T_DEC const Cmp_Fn& PB_DS_CLASS_C_DEC:: get_cmp_fn() const { return *this; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp��������������������������������������������0000644�����������������00000036006�14763166030�0016540 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file ov_tree_map_/ov_tree_map_.hpp * Contains an implementation class for ov_tree. */ #include <map> #include <set> #include <ext/pb_ds/exception.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp> #include <ext/pb_ds/detail/types_traits.hpp> #include <ext/pb_ds/detail/type_utils.hpp> #include <ext/pb_ds/detail/tree_trace_base.hpp> #ifdef _GLIBCXX_DEBUG #include <ext/pb_ds/detail/debug_map_base.hpp> #endif #include <utility> #include <functional> #include <algorithm> #include <vector> #include <assert.h> #include <debug/debug.h> namespace __gnu_pbds { namespace detail { #ifdef PB_DS_DATA_TRUE_INDICATOR #define PB_DS_OV_TREE_NAME ov_tree_map #define PB_DS_CONST_NODE_ITERATOR_NAME ov_tree_node_const_iterator_map #endif #ifdef PB_DS_DATA_FALSE_INDICATOR #define PB_DS_OV_TREE_NAME ov_tree_set #define PB_DS_CONST_NODE_ITERATOR_NAME ov_tree_node_const_iterator_set #endif #define PB_DS_CLASS_T_DEC \ template<typename Key, typename Mapped, typename Cmp_Fn, \ typename Node_And_It_Traits, typename _Alloc> #define PB_DS_CLASS_C_DEC \ PB_DS_OV_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc> #define PB_DS_OV_TREE_TRAITS_BASE \ types_traits<Key, Mapped, _Alloc, false> #ifdef _GLIBCXX_DEBUG #define PB_DS_DEBUG_MAP_BASE_C_DEC \ debug_map_base<Key, eq_by_less<Key, Cmp_Fn>, \ typename _Alloc::template rebind<Key>::other::const_reference> #endif #ifdef PB_DS_TREE_TRACE #define PB_DS_TREE_TRACE_BASE_C_DEC \ tree_trace_base<typename Node_And_It_Traits::node_const_iterator, \ typename Node_And_It_Traits::node_iterator, \ Cmp_Fn, false, _Alloc> #endif #ifndef PB_DS_CHECK_KEY_EXISTS # error Missing definition #endif /** * @brief Ordered-vector tree associative-container. * @ingroup branch-detail */ template<typename Key, typename Mapped, typename Cmp_Fn, typename Node_And_It_Traits, typename _Alloc> class PB_DS_OV_TREE_NAME : #ifdef _GLIBCXX_DEBUG protected PB_DS_DEBUG_MAP_BASE_C_DEC, #endif #ifdef PB_DS_TREE_TRACE public PB_DS_TREE_TRACE_BASE_C_DEC, #endif public Cmp_Fn, public Node_And_It_Traits::node_update, public PB_DS_OV_TREE_TRAITS_BASE { private: typedef PB_DS_OV_TREE_TRAITS_BASE traits_base; typedef Node_And_It_Traits traits_type; typedef typename remove_const<typename traits_base::value_type>::type non_const_value_type; typedef typename _Alloc::template rebind<non_const_value_type>::other value_allocator; typedef typename value_allocator::pointer value_vector; #ifdef _GLIBCXX_DEBUG typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base; #endif #ifdef PB_DS_TREE_TRACE typedef PB_DS_TREE_TRACE_BASE_C_DEC trace_base; #endif typedef typename traits_base::pointer mapped_pointer_; typedef typename traits_base::const_pointer mapped_const_pointer_; typedef typename traits_type::metadata_type metadata_type; typedef typename _Alloc::template rebind<metadata_type>::other metadata_allocator; typedef typename metadata_allocator::pointer metadata_pointer; typedef typename metadata_allocator::const_reference metadata_const_reference; typedef typename metadata_allocator::reference metadata_reference; typedef typename traits_type::null_node_update_pointer null_node_update_pointer; public: typedef ov_tree_tag container_category; typedef _Alloc allocator_type; typedef typename _Alloc::size_type size_type; typedef typename _Alloc::difference_type difference_type; typedef Cmp_Fn cmp_fn; typedef typename traits_base::key_type key_type; typedef typename traits_base::key_pointer key_pointer; typedef typename traits_base::key_const_pointer key_const_pointer; typedef typename traits_base::key_reference key_reference; typedef typename traits_base::key_const_reference key_const_reference; typedef typename traits_base::mapped_type mapped_type; typedef typename traits_base::mapped_pointer mapped_pointer; typedef typename traits_base::mapped_const_pointer mapped_const_pointer; typedef typename traits_base::mapped_reference mapped_reference; typedef typename traits_base::mapped_const_reference mapped_const_reference; typedef typename traits_base::value_type value_type; typedef typename traits_base::pointer pointer; typedef typename traits_base::const_pointer const_pointer; typedef typename traits_base::reference reference; typedef typename traits_base::const_reference const_reference; typedef const_pointer point_const_iterator; #ifdef PB_DS_DATA_TRUE_INDICATOR typedef pointer point_iterator; #else typedef point_const_iterator point_iterator; #endif typedef point_iterator iterator; typedef point_const_iterator const_iterator; /// Conditional destructor. template<typename Size_Type> class cond_dtor { public: cond_dtor(value_vector a_vec, iterator& r_last_it, Size_Type total_size) : m_a_vec(a_vec), m_r_last_it(r_last_it), m_max_size(total_size), m_no_action(false) { } ~cond_dtor() { if (m_no_action) return; iterator it = m_a_vec; while (it != m_r_last_it) { it->~value_type(); ++it; } if (m_max_size > 0) value_allocator().deallocate(m_a_vec, m_max_size); } inline void set_no_action() { m_no_action = true; } protected: value_vector m_a_vec; iterator& m_r_last_it; const Size_Type m_max_size; bool m_no_action; }; typedef typename traits_type::node_update node_update; typedef typename traits_type::node_iterator node_iterator; typedef typename traits_type::node_const_iterator node_const_iterator; PB_DS_OV_TREE_NAME(); PB_DS_OV_TREE_NAME(const Cmp_Fn&); PB_DS_OV_TREE_NAME(const Cmp_Fn&, const node_update&); PB_DS_OV_TREE_NAME(const PB_DS_CLASS_C_DEC&); ~PB_DS_OV_TREE_NAME(); void swap(PB_DS_CLASS_C_DEC&); template<typename It> void copy_from_range(It, It); inline size_type max_size() const; inline bool empty() const; inline size_type size() const; Cmp_Fn& get_cmp_fn(); const Cmp_Fn& get_cmp_fn() const; inline mapped_reference operator[](key_const_reference r_key) { #ifdef PB_DS_DATA_TRUE_INDICATOR PB_DS_ASSERT_VALID((*this)) point_iterator it = lower_bound(r_key); if (it != end() && !Cmp_Fn::operator()(r_key, PB_DS_V2F(*it))) { PB_DS_CHECK_KEY_EXISTS(r_key) PB_DS_ASSERT_VALID((*this)) return it->second; } return insert_new_val(it, std::make_pair(r_key, mapped_type()))->second; #else insert(r_key); return traits_base::s_null_type; #endif } inline std::pair<point_iterator, bool> insert(const_reference r_value) { PB_DS_ASSERT_VALID((*this)) key_const_reference r_key = PB_DS_V2F(r_value); point_iterator it = lower_bound(r_key); if (it != end()&& !Cmp_Fn::operator()(r_key, PB_DS_V2F(*it))) { PB_DS_ASSERT_VALID((*this)) PB_DS_CHECK_KEY_EXISTS(r_key) return std::make_pair(it, false); } return std::make_pair(insert_new_val(it, r_value), true); } inline point_iterator lower_bound(key_const_reference r_key) { pointer it = m_a_values; pointer e_it = m_a_values + m_size; while (it != e_it) { pointer mid_it = it + ((e_it - it) >> 1); if (cmp_fn::operator()(PB_DS_V2F(*mid_it), r_key)) it = ++mid_it; else e_it = mid_it; } return it; } inline point_const_iterator lower_bound(key_const_reference r_key) const { return const_cast<PB_DS_CLASS_C_DEC& >(*this).lower_bound(r_key); } inline point_iterator upper_bound(key_const_reference r_key) { iterator pot_it = lower_bound(r_key); if (pot_it != end() && !Cmp_Fn::operator()(r_key, PB_DS_V2F(*pot_it))) { PB_DS_CHECK_KEY_EXISTS(r_key) return ++pot_it; } PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) return pot_it; } inline point_const_iterator upper_bound(key_const_reference r_key) const { return const_cast<PB_DS_CLASS_C_DEC&>(*this).upper_bound(r_key); } inline point_iterator find(key_const_reference r_key) { PB_DS_ASSERT_VALID((*this)) iterator pot_it = lower_bound(r_key); if (pot_it != end() && !Cmp_Fn::operator()(r_key, PB_DS_V2F(*pot_it))) { PB_DS_CHECK_KEY_EXISTS(r_key) return pot_it; } PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) return end(); } inline point_const_iterator find(key_const_reference r_key) const { return (const_cast<PB_DS_CLASS_C_DEC&>(*this).find(r_key)); } bool erase(key_const_reference); template<typename Pred> inline size_type erase_if(Pred); inline iterator erase(iterator it) { return erase_imp<iterator>(it); } void clear(); void join(PB_DS_CLASS_C_DEC&); void split(key_const_reference, PB_DS_CLASS_C_DEC&); inline iterator begin() { return m_a_values; } inline const_iterator begin() const { return m_a_values; } inline iterator end() { return m_end_it; } inline const_iterator end() const { return m_end_it; } /// Returns a const node_iterator corresponding to the node at the /// root of the tree. inline node_const_iterator node_begin() const; /// Returns a node_iterator corresponding to the node at the /// root of the tree. inline node_iterator node_begin(); /// Returns a const node_iterator corresponding to a node just /// after a leaf of the tree. inline node_const_iterator node_end() const; /// Returns a node_iterator corresponding to a node just /// after a leaf of the tree. inline node_iterator node_end(); private: inline void update(node_iterator, null_node_update_pointer); template<typename Node_Update> void update(node_iterator, Node_Update*); void reallocate_metadata(null_node_update_pointer, size_type); template<typename Node_Update_> void reallocate_metadata(Node_Update_*, size_type); template<typename It> void copy_from_ordered_range(It, It); void value_swap(PB_DS_CLASS_C_DEC&); template<typename It> void copy_from_ordered_range(It, It, It, It); template<typename Ptr> inline static Ptr mid_pointer(Ptr p_begin, Ptr p_end) { _GLIBCXX_DEBUG_ASSERT(p_end >= p_begin); return (p_begin + (p_end - p_begin) / 2); } inline iterator insert_new_val(iterator it, const_reference r_value) { #ifdef PB_DS_REGRESSION typename _Alloc::group_adjustor adjust(m_size); #endif PB_DS_CHECK_KEY_DOES_NOT_EXIST(PB_DS_V2F(r_value)) value_vector a_values = s_value_alloc.allocate(m_size + 1); iterator source_it = begin(); iterator source_end_it = end(); iterator target_it = a_values; iterator ret_it; cond_dtor<size_type> cd(a_values, target_it, m_size + 1); while (source_it != it) { new (const_cast<void*>(static_cast<const void*>(target_it))) value_type(*source_it++); ++target_it; } new (const_cast<void*>(static_cast<const void*>(ret_it = target_it))) value_type(r_value); ++target_it; while (source_it != source_end_it) { new (const_cast<void*>(static_cast<const void*>(target_it))) value_type(*source_it++); ++target_it; } reallocate_metadata((node_update*)this, m_size + 1); cd.set_no_action(); if (m_size != 0) { cond_dtor<size_type> cd1(m_a_values, m_end_it, m_size); } ++m_size; m_a_values = a_values; m_end_it = m_a_values + m_size; _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_value))); update(node_begin(), (node_update* )this); PB_DS_ASSERT_VALID((*this)) return ret_it; } #ifdef _GLIBCXX_DEBUG void assert_valid(const char*, int) const; void assert_iterators(const char*, int) const; #endif template<typename It> It erase_imp(It); inline node_const_iterator PB_DS_node_begin_imp() const; inline node_const_iterator PB_DS_node_end_imp() const; inline node_iterator PB_DS_node_begin_imp(); inline node_iterator PB_DS_node_end_imp(); private: static value_allocator s_value_alloc; static metadata_allocator s_metadata_alloc; value_vector m_a_values; metadata_pointer m_a_metadata; iterator m_end_it; size_type m_size; }; #include <ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp> #include <ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp> #include <ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp> #include <ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp> #include <ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp> #include <ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp> #include <ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp> #include <ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp> #undef PB_DS_CLASS_C_DEC #undef PB_DS_CLASS_T_DEC #undef PB_DS_OV_TREE_NAME #undef PB_DS_OV_TREE_TRAITS_BASE #undef PB_DS_DEBUG_MAP_BASE_C_DEC #ifdef PB_DS_TREE_TRACE #undef PB_DS_TREE_TRACE_BASE_C_DEC #endif #undef PB_DS_CONST_NODE_ITERATOR_NAME } // namespace detail } // namespace __gnu_pbds ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp�������������������������������������������0000644�����������������00000011565�14763166030�0016716 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file ov_tree_map_/erase_fn_imps.hpp * Contains an implementation class for ov_tree_. */ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: clear() { PB_DS_ASSERT_VALID((*this)) if (m_size == 0) { return; } else { reallocate_metadata((node_update* )this, 0); cond_dtor<size_type> cd(m_a_values, m_end_it, m_size); } _GLIBCXX_DEBUG_ONLY(debug_base::clear();) m_a_values = 0; m_size = 0; m_end_it = m_a_values; PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC template<typename Pred> inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: erase_if(Pred pred) { PB_DS_ASSERT_VALID((*this)) #ifdef PB_DS_REGRESSION typename _Alloc::group_adjustor adjust(m_size); #endif size_type new_size = 0; size_type num_val_ersd = 0; for (iterator source_it = begin(); source_it != m_end_it; ++source_it) if (!pred(*source_it)) ++new_size; else ++num_val_ersd; if (new_size == 0) { clear(); return num_val_ersd; } value_vector a_new_values = s_value_alloc.allocate(new_size); iterator target_it = a_new_values; cond_dtor<size_type> cd(a_new_values, target_it, new_size); _GLIBCXX_DEBUG_ONLY(debug_base::clear()); for (iterator source_it = begin(); source_it != m_end_it; ++source_it) { if (!pred(*source_it)) { new (const_cast<void*>(static_cast<const void*>(target_it))) value_type(*source_it); _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(*source_it))); ++target_it; } } reallocate_metadata((node_update*)this, new_size); cd.set_no_action(); { cond_dtor<size_type> cd1(m_a_values, m_end_it, m_size); } m_a_values = a_new_values; m_size = new_size; m_end_it = target_it; update(node_begin(), (node_update*)this); PB_DS_ASSERT_VALID((*this)) return num_val_ersd; } PB_DS_CLASS_T_DEC template<typename It> It PB_DS_CLASS_C_DEC:: erase_imp(It it) { PB_DS_ASSERT_VALID((*this)) if (it == end()) return end(); PB_DS_CHECK_KEY_EXISTS(PB_DS_V2F(*it)) #ifdef PB_DS_REGRESSION typename _Alloc::group_adjustor adjust(m_size); #endif _GLIBCXX_DEBUG_ASSERT(m_size > 0); value_vector a_values = s_value_alloc.allocate(m_size - 1); iterator source_it = begin(); iterator source_end_it = end(); iterator target_it = a_values; iterator ret_it = end(); cond_dtor<size_type> cd(a_values, target_it, m_size - 1); _GLIBCXX_DEBUG_ONLY(size_type cnt = 0;) while (source_it != source_end_it) { if (source_it != it) { _GLIBCXX_DEBUG_ONLY(++cnt;) _GLIBCXX_DEBUG_ASSERT(cnt != m_size); new (const_cast<void*>(static_cast<const void*>(target_it))) value_type(*source_it); ++target_it; } else ret_it = target_it; ++source_it; } _GLIBCXX_DEBUG_ASSERT(m_size > 0); reallocate_metadata((node_update*)this, m_size - 1); cd.set_no_action(); _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(*it));) { cond_dtor<size_type> cd1(m_a_values, m_end_it, m_size); } m_a_values = a_values; --m_size; m_end_it = m_a_values + m_size; update(node_begin(), (node_update*)this); PB_DS_ASSERT_VALID((*this)) return It(ret_it); } PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: erase(key_const_reference r_key) { point_iterator it = find(r_key); if (it == end()) return false; erase(it); return true; } �������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp��������������������������������������������0000644�����������������00000004044�14763166030�0016544 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file ov_tree_map_/info_fn_imps.hpp * Contains an implementation class for ov_tree_. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: size() const { PB_DS_ASSERT_VALID((*this)) return m_size; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: max_size() const { return s_value_alloc.max_size(); } PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: empty() const { return size() == 0; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp�������������������������������������������0000644�����������������00000005402�14763166030�0016676 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file ov_tree_map_/debug_fn_imps.hpp * Contains an implementation class for ov_tree_. */ #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_valid(const char* __file, int __line) const { if (m_a_values == 0 || m_end_it == 0 || m_size == 0) PB_DS_DEBUG_VERIFY(m_a_values == 0 && m_end_it == 0 && m_size == 0); assert_iterators(__file, __line); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_iterators(const char* __file, int __line) const { debug_base::check_size(m_size, __file, __line); size_type iterated_num = 0; const_iterator prev_it = end(); PB_DS_DEBUG_VERIFY(m_end_it == m_a_values + m_size); for (const_iterator it = begin(); it != end(); ++it) { ++iterated_num; debug_base::check_key_exists(PB_DS_V2F(*it), __file, __line); PB_DS_DEBUG_VERIFY(lower_bound(PB_DS_V2F(*it)) == it); const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*it)); --upper_bound_it; PB_DS_DEBUG_VERIFY(upper_bound_it == it); if (prev_it != end()) PB_DS_DEBUG_VERIFY(Cmp_Fn::operator()(PB_DS_V2F(*prev_it), PB_DS_V2F(*it))); prev_it = it; } PB_DS_DEBUG_VERIFY(iterated_num == m_size); } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp������������������������0000644�����������������00000004712�14763166030�0022767 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pairing_heap_/constructors_destructor_fn_imps.hpp * Contains an implementation class for a pairing heap. */ PB_DS_CLASS_T_DEC template<typename It> void PB_DS_CLASS_C_DEC:: copy_from_range(It first_it, It last_it) { while (first_it != last_it) push(*(first_it++)); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: pairing_heap() { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: pairing_heap(const Cmp_Fn& r_cmp_fn) : base_type(r_cmp_fn) { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: pairing_heap(const PB_DS_CLASS_C_DEC& other) : base_type(other) { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) base_type::swap(other); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ~pairing_heap() { } ������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp�����������������������������������������0000644�����������������00000005603�14763166030�0017245 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pairing_heap_/insert_fn_imps.hpp * Contains an implementation class for a pairing heap. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_iterator PB_DS_CLASS_C_DEC:: push(const_reference r_val) { PB_DS_ASSERT_VALID((*this)) node_pointer p_new_nd = base_type::get_new_node_for_insert(r_val); push_imp(p_new_nd); PB_DS_ASSERT_VALID((*this)) return point_iterator(p_new_nd); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: push_imp(node_pointer p_nd) { p_nd->m_p_l_child = 0; if (base_type::m_p_root == 0) { p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent = 0; base_type::m_p_root = p_nd; } else if (Cmp_Fn::operator()(base_type::m_p_root->m_value, p_nd->m_value)) { p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent = 0; base_type::make_child_of(base_type::m_p_root, p_nd); PB_DS_ASSERT_NODE_CONSISTENT(p_nd, false) base_type::m_p_root = p_nd; } else { base_type::make_child_of(p_nd, base_type::m_p_root); PB_DS_ASSERT_NODE_CONSISTENT(base_type::m_p_root, false) } } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: modify(point_iterator it, const_reference r_new_val) { PB_DS_ASSERT_VALID((*this)) remove_node(it.m_p_nd); it.m_p_nd->m_value = r_new_val; push_imp(it.m_p_nd); PB_DS_ASSERT_VALID((*this)) } �����������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp�������������������������������������0000644�����������������00000007172�14763166030�0020116 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pairing_heap_/split_join_fn_imps.hpp * Contains an implementation class for a pairing heap. */ PB_DS_CLASS_T_DEC template<typename Pred> void PB_DS_CLASS_C_DEC:: split(Pred pred, PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) other.clear(); if (base_type::empty()) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) return; } base_type::to_linked_list(); node_pointer p_out = base_type::prune(pred); while (p_out != 0) { _GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0); --base_type::m_size; ++other.m_size; node_pointer p_next = p_out->m_p_next_sibling; p_out->m_p_l_child = p_out->m_p_next_sibling = p_out->m_p_prev_or_parent = 0; other.push_imp(p_out); p_out = p_next; } PB_DS_ASSERT_VALID(other) node_pointer p_cur = base_type::m_p_root; base_type::m_p_root = 0; while (p_cur != 0) { node_pointer p_next = p_cur->m_p_next_sibling; p_cur->m_p_l_child = p_cur->m_p_next_sibling = p_cur->m_p_prev_or_parent = 0; push_imp(p_cur); p_cur = p_next; } PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: join(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) if (other.m_p_root == 0) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) return; } if (base_type::m_p_root == 0) base_type::m_p_root = other.m_p_root; else if (Cmp_Fn::operator()(base_type::m_p_root->m_value, other.m_p_root->m_value)) { base_type::make_child_of(base_type::m_p_root, other.m_p_root); PB_DS_ASSERT_NODE_CONSISTENT(other.m_p_root, false) base_type::m_p_root = other.m_p_root; } else { base_type::make_child_of(other.m_p_root, base_type::m_p_root); PB_DS_ASSERT_NODE_CONSISTENT(base_type::m_p_root, false) } base_type::m_size += other.m_size; other.m_p_root = 0; other.m_size = 0; PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp�������������������������������������������0000644�����������������00000003621�14763166030�0016657 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pairing_heap_/find_fn_imps.hpp * Contains an implementation class for a pairing heap. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_reference PB_DS_CLASS_C_DEC:: top() const { PB_DS_ASSERT_VALID((*this)) _GLIBCXX_DEBUG_ASSERT(!base_type::empty()); return base_type::m_p_root->m_value; } ���������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp������������������������������������������0000644�����������������00000016027�14763166030�0017042 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pairing_heap_/erase_fn_imps.hpp * Contains an implementation class for a pairing heap. */ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: pop() { PB_DS_ASSERT_VALID((*this)) _GLIBCXX_DEBUG_ASSERT(!base_type::empty()); node_pointer p_new_root = join_node_children(base_type::m_p_root); PB_DS_ASSERT_NODE_CONSISTENT(p_new_root, false) if (p_new_root != 0) p_new_root->m_p_prev_or_parent = 0; base_type::actual_erase_node(base_type::m_p_root); base_type::m_p_root = p_new_root; PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: erase(point_iterator it) { PB_DS_ASSERT_VALID((*this)) _GLIBCXX_DEBUG_ASSERT(!base_type::empty()); remove_node(it.m_p_nd); base_type::actual_erase_node(it.m_p_nd); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: remove_node(node_pointer p_nd) { PB_DS_ASSERT_VALID((*this)) _GLIBCXX_DEBUG_ASSERT(!base_type::empty()); node_pointer p_new_child = join_node_children(p_nd); PB_DS_ASSERT_NODE_CONSISTENT(p_new_child, false) if (p_nd == base_type::m_p_root) { if (p_new_child != 0) p_new_child->m_p_prev_or_parent = 0; base_type::m_p_root = p_new_child; PB_DS_ASSERT_NODE_CONSISTENT(base_type::m_p_root, false) return; } _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_prev_or_parent != 0); if (p_nd->m_p_prev_or_parent->m_p_l_child == p_nd) { if (p_new_child != 0) { p_new_child->m_p_prev_or_parent = p_nd->m_p_prev_or_parent; p_new_child->m_p_next_sibling = p_nd->m_p_next_sibling; if (p_new_child->m_p_next_sibling != 0) p_new_child->m_p_next_sibling->m_p_prev_or_parent = p_new_child; p_nd->m_p_prev_or_parent->m_p_l_child = p_new_child; PB_DS_ASSERT_NODE_CONSISTENT(p_nd->m_p_prev_or_parent, false) return; } p_nd->m_p_prev_or_parent->m_p_l_child = p_nd->m_p_next_sibling; if (p_nd->m_p_next_sibling != 0) p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_prev_or_parent; PB_DS_ASSERT_NODE_CONSISTENT(p_nd->m_p_prev_or_parent, false) return; } if (p_new_child != 0) { p_new_child->m_p_prev_or_parent = p_nd->m_p_prev_or_parent; p_new_child->m_p_next_sibling = p_nd->m_p_next_sibling; if (p_new_child->m_p_next_sibling != 0) p_new_child->m_p_next_sibling->m_p_prev_or_parent = p_new_child; p_new_child->m_p_prev_or_parent->m_p_next_sibling = p_new_child; PB_DS_ASSERT_NODE_CONSISTENT(p_nd->m_p_prev_or_parent, false) return; } p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd->m_p_next_sibling; if (p_nd->m_p_next_sibling != 0) p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_prev_or_parent; PB_DS_ASSERT_NODE_CONSISTENT(p_nd->m_p_prev_or_parent, false) } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: join_node_children(node_pointer p_nd) { _GLIBCXX_DEBUG_ASSERT(p_nd != 0); node_pointer p_ret = p_nd->m_p_l_child; if (p_ret == 0) return 0; while (p_ret->m_p_next_sibling != 0) p_ret = forward_join(p_ret, p_ret->m_p_next_sibling); while (p_ret->m_p_prev_or_parent != p_nd) p_ret = back_join(p_ret->m_p_prev_or_parent, p_ret); PB_DS_ASSERT_NODE_CONSISTENT(p_ret, false) return p_ret; } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: forward_join(node_pointer p_nd, node_pointer p_next) { _GLIBCXX_DEBUG_ASSERT(p_nd != 0); _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling == p_next); if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value)) { p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent; base_type::make_child_of(p_nd, p_next); return p_next->m_p_next_sibling == 0 ? p_next : p_next->m_p_next_sibling; } if (p_next->m_p_next_sibling != 0) { p_next->m_p_next_sibling->m_p_prev_or_parent = p_nd; p_nd->m_p_next_sibling = p_next->m_p_next_sibling; base_type::make_child_of(p_next, p_nd); return p_nd->m_p_next_sibling; } p_nd->m_p_next_sibling = 0; base_type::make_child_of(p_next, p_nd); PB_DS_ASSERT_NODE_CONSISTENT(p_nd, false) return p_nd; } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: back_join(node_pointer p_nd, node_pointer p_next) { _GLIBCXX_DEBUG_ASSERT(p_nd != 0); _GLIBCXX_DEBUG_ASSERT(p_next->m_p_next_sibling == 0); if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value)) { p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent; base_type::make_child_of(p_nd, p_next); PB_DS_ASSERT_NODE_CONSISTENT(p_next, false) return p_next; } p_nd->m_p_next_sibling = 0; base_type::make_child_of(p_next, p_nd); PB_DS_ASSERT_NODE_CONSISTENT(p_nd, false) return p_nd; } PB_DS_CLASS_T_DEC template<typename Pred> typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: erase_if(Pred pred) { PB_DS_ASSERT_VALID((*this)) if (base_type::empty()) { PB_DS_ASSERT_VALID((*this)) return 0; } base_type::to_linked_list(); node_pointer p_out = base_type::prune(pred); size_type ersd = 0; while (p_out != 0) { ++ersd; node_pointer p_next = p_out->m_p_next_sibling; base_type::actual_erase_node(p_out); p_out = p_next; } node_pointer p_cur = base_type::m_p_root; base_type::m_p_root = 0; while (p_cur != 0) { node_pointer p_next = p_cur->m_p_next_sibling; p_cur->m_p_l_child = p_cur->m_p_next_sibling = p_cur->m_p_prev_or_parent = 0; push_imp(p_cur); p_cur = p_next; } PB_DS_ASSERT_VALID((*this)) return ersd; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp������������������������������������������0000644�����������������00000012615�14763166030�0017014 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pairing_heap_/pairing_heap_.hpp * Contains an implementation class for a pairing heap. */ /* * Pairing heap: * Michael L. Fredman, Robert Sedgewick, Daniel Dominic Sleator, * and Robert Endre Tarjan, The Pairing Heap: * A New Form of Self-Adjusting Heap, Algorithmica, 1(1):111-129, 1986. */ #include <ext/pb_ds/detail/cond_dealtor.hpp> #include <ext/pb_ds/detail/type_utils.hpp> #include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp> #include <debug/debug.h> namespace __gnu_pbds { namespace detail { #define PB_DS_CLASS_T_DEC \ template<typename Value_Type, typename Cmp_Fn, typename _Alloc> #define PB_DS_CLASS_C_DEC \ pairing_heap<Value_Type, Cmp_Fn, _Alloc> #ifdef _GLIBCXX_DEBUG #define PB_DS_P_HEAP_BASE \ left_child_next_sibling_heap<Value_Type, Cmp_Fn, null_type, _Alloc, false> #else #define PB_DS_P_HEAP_BASE \ left_child_next_sibling_heap<Value_Type, Cmp_Fn, null_type, _Alloc> #endif /** * Pairing heap. * * @ingroup heap-detail */ template<typename Value_Type, typename Cmp_Fn, typename _Alloc> class pairing_heap : public PB_DS_P_HEAP_BASE { private: typedef PB_DS_P_HEAP_BASE base_type; typedef typename base_type::node_pointer node_pointer; typedef typename _Alloc::template rebind<Value_Type>::other __rebind_a; public: typedef Value_Type value_type; typedef Cmp_Fn cmp_fn; typedef _Alloc allocator_type; typedef typename _Alloc::size_type size_type; typedef typename _Alloc::difference_type difference_type; typedef typename __rebind_a::pointer pointer; typedef typename __rebind_a::const_pointer const_pointer; typedef typename __rebind_a::reference reference; typedef typename __rebind_a::const_reference const_reference; typedef typename base_type::point_const_iterator point_const_iterator; typedef typename base_type::point_iterator point_iterator; typedef typename base_type::const_iterator const_iterator; typedef typename base_type::iterator iterator; pairing_heap(); pairing_heap(const Cmp_Fn&); pairing_heap(const pairing_heap&); void swap(pairing_heap&); ~pairing_heap(); inline point_iterator push(const_reference); void modify(point_iterator, const_reference); inline const_reference top() const; void pop(); void erase(point_iterator); template<typename Pred> size_type erase_if(Pred); template<typename Pred> void split(Pred, pairing_heap&); void join(pairing_heap&); protected: template<typename It> void copy_from_range(It, It); #ifdef _GLIBCXX_DEBUG void assert_valid(const char*, int) const; #endif private: inline void push_imp(node_pointer); node_pointer join_node_children(node_pointer); node_pointer forward_join(node_pointer, node_pointer); node_pointer back_join(node_pointer, node_pointer); void remove_node(node_pointer); }; #define PB_DS_ASSERT_NODE_CONSISTENT(_Node, _Bool) \ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(_Node, _Bool, \ __FILE__, __LINE__);) #include <ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp> #include <ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp> #include <ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp> #include <ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp> #include <ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp> #include <ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp> #undef PB_DS_ASSERT_NODE_CONSISTENT #undef PB_DS_CLASS_C_DEC #undef PB_DS_CLASS_T_DEC #undef PB_DS_P_HEAP_BASE } // namespace detail } // namespace __gnu_pbds �������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp������������������������������������������0000644�����������������00000003714�14763166030�0017030 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file pairing_heap_/debug_fn_imps.hpp * Contains an implementation class for a pairing heap. */ #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_valid(const char* __file, int __line) const { PB_DS_DEBUG_VERIFY(base_type::m_p_root == 0 || base_type::m_p_root->m_p_next_sibling == 0); base_type::assert_valid(__file, __line); } #endif ����������������������������������������������������c++/4.8.2/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp���������������������������0000644�����������������00000005602�14763166030�0022277 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file thin_heap_/constructors_destructor_fn_imps.hpp * Contains an implementation for thin_heap_. */ PB_DS_CLASS_T_DEC template<typename It> void PB_DS_CLASS_C_DEC:: copy_from_range(It first_it, It last_it) { while (first_it != last_it) push(*(first_it++)); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: thin_heap() : m_p_max(0) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: thin_heap(const Cmp_Fn& r_cmp_fn) : base_type(r_cmp_fn), m_p_max(0) { initialize(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: thin_heap(const PB_DS_CLASS_C_DEC& other) : base_type(other) { initialize(); m_p_max = base_type::m_p_root; for (node_pointer p_nd = base_type::m_p_root; p_nd != 0; p_nd = p_nd->m_p_next_sibling) if (Cmp_Fn::operator()(m_p_max->m_value, p_nd->m_value)) m_p_max = p_nd; PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) base_type::swap(other); std::swap(m_p_max, other.m_p_max); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ~thin_heap() { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: initialize() { std::fill(m_a_aux, m_a_aux + max_rank, static_cast<node_pointer>(0)); } ������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp��������������������������������������������0000644�����������������00000016473�14763166030�0016565 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file thin_heap_/insert_fn_imps.hpp * Contains an implementation for thin_heap_. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_iterator PB_DS_CLASS_C_DEC:: push(const_reference r_val) { PB_DS_ASSERT_VALID((*this)) node_pointer p_nd = base_type::get_new_node_for_insert(r_val); p_nd->m_metadata = 0; p_nd->m_p_prev_or_parent = p_nd->m_p_l_child = 0; if (base_type::m_p_root == 0) { p_nd->m_p_next_sibling = 0; m_p_max = base_type::m_p_root = p_nd; PB_DS_ASSERT_VALID((*this)) return point_iterator(p_nd); } p_nd->m_p_next_sibling = base_type::m_p_root; base_type::m_p_root->m_p_prev_or_parent = 0; base_type::m_p_root = p_nd; update_max(p_nd); PB_DS_ASSERT_VALID((*this)) return point_iterator(p_nd); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: make_root(node_pointer p_nd) { p_nd->m_metadata = p_nd->m_p_l_child == 0 ? 0 : 1 + p_nd->m_p_l_child->m_metadata; } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: make_root_and_link(node_pointer p_nd) { make_root(p_nd); p_nd->m_p_prev_or_parent = 0; p_nd->m_p_next_sibling = base_type::m_p_root; if (base_type::m_p_root != 0) base_type::m_p_root->m_p_prev_or_parent = 0; base_type::m_p_root = p_nd; update_max(p_nd); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: fix(node_pointer p_y) { while (true) { if (p_y->m_p_prev_or_parent == 0) { fix_root(p_y); return; } else if (p_y->m_metadata == 1&& p_y->m_p_next_sibling == 0) { if (p_y->m_p_l_child != 0) { fix_sibling_rank_1_unmarked(p_y); return; } fix_sibling_rank_1_marked(p_y); p_y = p_y->m_p_prev_or_parent; } else if (p_y->m_metadata > p_y->m_p_next_sibling->m_metadata + 1) { _GLIBCXX_DEBUG_ASSERT(p_y->m_p_l_child != 0); if (p_y->m_metadata != p_y->m_p_l_child->m_metadata + 2) { fix_sibling_general_unmarked(p_y); return; } fix_sibling_general_marked(p_y); p_y = p_y->m_p_prev_or_parent; } else if ((p_y->m_p_l_child == 0&& p_y->m_metadata == 2) ||(p_y->m_p_l_child != 0&& p_y->m_metadata == p_y->m_p_l_child->m_metadata + 3)) { node_pointer p_z = p_y->m_p_prev_or_parent; fix_child(p_y); p_y = p_z; } else return; } } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: fix_root(node_pointer p_y) { _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent == 0); make_root(p_y); PB_DS_ASSERT_NODE_CONSISTENT(p_y, true) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: fix_sibling_rank_1_unmarked(node_pointer p_y) { _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0); _GLIBCXX_DEBUG_ONLY(node_pointer p_w = p_y->m_p_l_child;) _GLIBCXX_DEBUG_ASSERT(p_w != 0); _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling == 0); _GLIBCXX_DEBUG_ASSERT(p_y->m_p_next_sibling == 0); p_y->m_p_next_sibling = p_y->m_p_l_child; p_y->m_p_next_sibling->m_p_prev_or_parent = p_y; p_y->m_p_l_child = 0; PB_DS_ASSERT_NODE_CONSISTENT(p_y, false) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: fix_sibling_rank_1_marked(node_pointer p_y) { _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0); _GLIBCXX_DEBUG_ASSERT(p_y->m_p_l_child == 0); p_y->m_metadata = 0; PB_DS_ASSERT_NODE_CONSISTENT(p_y, false) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: fix_sibling_general_unmarked(node_pointer p_y) { _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0); node_pointer p_w = p_y->m_p_l_child; _GLIBCXX_DEBUG_ASSERT(p_w != 0); _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling != 0); p_y->m_p_l_child = p_w->m_p_next_sibling; p_w->m_p_next_sibling->m_p_prev_or_parent = p_y; p_w->m_p_next_sibling = p_y->m_p_next_sibling; _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling != 0); p_w->m_p_next_sibling->m_p_prev_or_parent = p_w; p_y->m_p_next_sibling = p_w; p_w->m_p_prev_or_parent = p_y; PB_DS_ASSERT_NODE_CONSISTENT(p_y, false) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: fix_sibling_general_marked(node_pointer p_y) { _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0); --p_y->m_metadata; PB_DS_ASSERT_NODE_CONSISTENT(p_y, false) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: fix_child(node_pointer p_y) { _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0); if (p_y->m_p_next_sibling != 0) p_y->m_p_next_sibling->m_p_prev_or_parent = p_y->m_p_prev_or_parent; if (p_y->m_p_prev_or_parent->m_p_l_child == p_y) p_y->m_p_prev_or_parent->m_p_l_child = p_y->m_p_next_sibling; else p_y->m_p_prev_or_parent->m_p_next_sibling = p_y->m_p_next_sibling; make_root_and_link(p_y); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: modify(point_iterator it, const_reference r_new_val) { PB_DS_ASSERT_VALID((*this)) node_pointer p_nd = it.m_p_nd; _GLIBCXX_DEBUG_ASSERT(p_nd != 0); const bool smaller = Cmp_Fn::operator()(r_new_val, p_nd->m_value); p_nd->m_value = r_new_val; if (smaller) { remove_node(p_nd); p_nd->m_p_l_child = 0; make_root_and_link(p_nd); PB_DS_ASSERT_VALID((*this)) return; } if (p_nd->m_p_prev_or_parent == 0) { update_max(p_nd); PB_DS_ASSERT_VALID((*this)) return; } node_pointer p_y = p_nd->m_p_prev_or_parent; _GLIBCXX_DEBUG_ASSERT(p_y != 0); if (p_nd->m_p_next_sibling != 0) p_nd->m_p_next_sibling->m_p_prev_or_parent = p_y; if (p_y->m_p_l_child == p_nd) p_y->m_p_l_child = p_nd->m_p_next_sibling; else p_y->m_p_next_sibling = p_nd->m_p_next_sibling; fix(p_y); make_root_and_link(p_nd); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: update_max(node_pointer p_nd) { if (m_p_max == 0 || Cmp_Fn::operator()(m_p_max->m_value, p_nd->m_value)) m_p_max = p_nd; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp����������������������������������������0000644�����������������00000006123�14763166030�0017422 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file thin_heap_/split_join_fn_imps.hpp * Contains an implementation for thin_heap_. */ PB_DS_CLASS_T_DEC template<typename Pred> void PB_DS_CLASS_C_DEC:: split(Pred pred, PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) other.clear(); if (base_type::empty()) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) return; } base_type::to_linked_list(); node_pointer p_out = base_type::prune(pred); while (p_out != 0) { _GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0); --base_type::m_size; ++other.m_size; node_pointer p_next = p_out->m_p_next_sibling; other.make_root_and_link(p_out); p_out = p_next; } PB_DS_ASSERT_VALID(other) node_pointer p_cur = base_type::m_p_root; m_p_max = 0; base_type::m_p_root = 0; while (p_cur != 0) { node_pointer p_next = p_cur->m_p_next_sibling; make_root_and_link(p_cur); p_cur = p_next; } PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: join(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) node_pointer p_other = other.m_p_root; while (p_other != 0) { node_pointer p_next = p_other->m_p_next_sibling; make_root_and_link(p_other); p_other = p_next; } base_type::m_size += other.m_size; other.m_p_root = 0; other.m_size = 0; other.m_p_max = 0; PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp����������������������������������������������0000644�����������������00000003640�14763166030�0016171 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file thin_heap_/find_fn_imps.hpp * Contains an implementation for thin_heap_. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_reference PB_DS_CLASS_C_DEC:: top() const { PB_DS_ASSERT_VALID((*this)) _GLIBCXX_DEBUG_ASSERT(!base_type::empty()); _GLIBCXX_DEBUG_ASSERT(m_p_max != 0); return m_p_max->m_value; } ������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp���������������������������������������������0000644�����������������00000013647�14763166030�0016360 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file thin_heap_/erase_fn_imps.hpp * Contains an implementation for thin_heap_. */ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: pop() { PB_DS_ASSERT_VALID((*this)) _GLIBCXX_DEBUG_ASSERT(!base_type::empty()); _GLIBCXX_DEBUG_ASSERT(m_p_max != 0); node_pointer p_nd = m_p_max; remove_max_node(); base_type::actual_erase_node(p_nd); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: remove_max_node() { to_aux_except_max(); make_from_aux(); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: to_aux_except_max() { node_pointer p_add = base_type::m_p_root; while (p_add != m_p_max) { node_pointer p_next_add = p_add->m_p_next_sibling; add_to_aux(p_add); p_add = p_next_add; } p_add = m_p_max->m_p_l_child; while (p_add != 0) { node_pointer p_next_add = p_add->m_p_next_sibling; p_add->m_metadata = p_add->m_p_l_child == 0 ? 0 : p_add->m_p_l_child->m_metadata + 1; add_to_aux(p_add); p_add = p_next_add; } p_add = m_p_max->m_p_next_sibling; while (p_add != 0) { node_pointer p_next_add = p_add->m_p_next_sibling; add_to_aux(p_add); p_add = p_next_add; } } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: add_to_aux(node_pointer p_nd) { size_type r = p_nd->m_metadata; while (m_a_aux[r] != 0) { _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata < rank_bound()); if (Cmp_Fn::operator()(m_a_aux[r]->m_value, p_nd->m_value)) make_child_of(m_a_aux[r], p_nd); else { make_child_of(p_nd, m_a_aux[r]); p_nd = m_a_aux[r]; } m_a_aux[r] = 0; ++r; } _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata < rank_bound()); m_a_aux[r] = p_nd; } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: make_child_of(node_pointer p_nd, node_pointer p_new_parent) { _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_new_parent->m_metadata); _GLIBCXX_DEBUG_ASSERT(m_a_aux[p_nd->m_metadata] == p_nd || m_a_aux[p_nd->m_metadata] == p_new_parent); ++p_new_parent->m_metadata; base_type::make_child_of(p_nd, p_new_parent); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: make_from_aux() { base_type::m_p_root = m_p_max = 0; const size_type rnk_bnd = rank_bound(); size_type i = 0; while (i < rnk_bnd) { if (m_a_aux[i] != 0) { make_root_and_link(m_a_aux[i]); m_a_aux[i] = 0; } ++i; } PB_DS_ASSERT_AUX_NULL((*this)) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: remove_node(node_pointer p_nd) { node_pointer p_parent = p_nd; while (base_type::parent(p_parent) != 0) p_parent = base_type::parent(p_parent); base_type::bubble_to_top(p_nd); m_p_max = p_nd; node_pointer p_fix = base_type::m_p_root; while (p_fix != 0&& p_fix->m_p_next_sibling != p_parent) p_fix = p_fix->m_p_next_sibling; if (p_fix != 0) p_fix->m_p_next_sibling = p_nd; remove_max_node(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: clear() { base_type::clear(); m_p_max = 0; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: erase(point_iterator it) { PB_DS_ASSERT_VALID((*this)) _GLIBCXX_DEBUG_ASSERT(!base_type::empty()); node_pointer p_nd = it.m_p_nd; remove_node(p_nd); base_type::actual_erase_node(p_nd); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC template<typename Pred> typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: erase_if(Pred pred) { PB_DS_ASSERT_VALID((*this)) if (base_type::empty()) { PB_DS_ASSERT_VALID((*this)) return 0; } base_type::to_linked_list(); node_pointer p_out = base_type::prune(pred); size_type ersd = 0; while (p_out != 0) { ++ersd; node_pointer p_next = p_out->m_p_next_sibling; base_type::actual_erase_node(p_out); p_out = p_next; } node_pointer p_cur = base_type::m_p_root; m_p_max = base_type::m_p_root = 0; while (p_cur != 0) { node_pointer p_next = p_cur->m_p_next_sibling; make_root_and_link(p_cur); p_cur = p_next; } PB_DS_ASSERT_VALID((*this)) return ersd; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: rank_bound() { using namespace std; const size_t* const p_upper = std::upper_bound(g_a_rank_bounds, g_a_rank_bounds + num_distinct_rank_bounds, base_type::m_size); if (p_upper == g_a_rank_bounds + num_distinct_rank_bounds) return max_rank; return (p_upper - g_a_rank_bounds); } �����������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp���������������������������������������������0000644�����������������00000003652�14763166030�0016352 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file thin_heap_/trace_fn_imps.hpp * Contains an implementation class for left_child_next_sibling_heap_. */ #ifdef PB_DS_THIN_HEAP_TRACE_ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace() const { std::cerr << std::endl; std::cerr << "m_p_max " << m_p_max << std::endl; base_type::trace(); } #endif // #ifdef PB_DS_THIN_HEAP_TRACE_ ��������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp������������������������������������������������0000644�����������������00000020142�14763166030�0015630 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file thin_heap_/thin_heap_.hpp * Contains an implementation class for a thin heap. */ #ifndef PB_DS_THIN_HEAP_HPP #define PB_DS_THIN_HEAP_HPP #include <algorithm> #include <ext/pb_ds/detail/cond_dealtor.hpp> #include <ext/pb_ds/detail/type_utils.hpp> #include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp> #include <debug/debug.h> namespace __gnu_pbds { namespace detail { #define PB_DS_CLASS_T_DEC \ template<typename Value_Type, typename Cmp_Fn, typename _Alloc> #define PB_DS_CLASS_C_DEC \ thin_heap<Value_Type, Cmp_Fn, _Alloc> #ifdef _GLIBCXX_DEBUG #define PB_DS_BASE_T_P \ <Value_Type, Cmp_Fn, typename _Alloc::size_type, _Alloc, true> #else #define PB_DS_BASE_T_P \ <Value_Type, Cmp_Fn, typename _Alloc::size_type, _Alloc> #endif /** * Thin heap. * * @ingroup heap-detail * * See Tarjan and Kaplan. */ template<typename Value_Type, typename Cmp_Fn, typename _Alloc> class thin_heap : public left_child_next_sibling_heap PB_DS_BASE_T_P { private: typedef typename _Alloc::template rebind<Value_Type>::other __rebind_a; typedef left_child_next_sibling_heap PB_DS_BASE_T_P base_type; protected: typedef typename base_type::node node; typedef typename base_type::node_pointer node_pointer; typedef typename base_type::node_const_pointer node_const_pointer; public: typedef Value_Type value_type; typedef Cmp_Fn cmp_fn; typedef _Alloc allocator_type; typedef typename _Alloc::size_type size_type; typedef typename _Alloc::difference_type difference_type; typedef typename __rebind_a::pointer pointer; typedef typename __rebind_a::const_pointer const_pointer; typedef typename __rebind_a::reference reference; typedef typename __rebind_a::const_reference const_reference; typedef typename base_type::point_iterator point_iterator; typedef typename base_type::point_const_iterator point_const_iterator; typedef typename base_type::iterator iterator; typedef typename base_type::const_iterator const_iterator; inline point_iterator push(const_reference); void modify(point_iterator, const_reference); inline const_reference top() const; void pop(); void erase(point_iterator); inline void clear(); template<typename Pred> size_type erase_if(Pred); template<typename Pred> void split(Pred, PB_DS_CLASS_C_DEC&); void join(PB_DS_CLASS_C_DEC&); protected: thin_heap(); thin_heap(const Cmp_Fn&); thin_heap(const PB_DS_CLASS_C_DEC&); void swap(PB_DS_CLASS_C_DEC&); ~thin_heap(); template<typename It> void copy_from_range(It, It); #ifdef _GLIBCXX_DEBUG void assert_valid(const char*, int) const; void assert_max(const char*, int) const; #endif #ifdef PB_DS_THIN_HEAP_TRACE_ void trace() const; #endif private: enum { max_rank = (sizeof(size_type) << 4) + 2 }; void initialize(); inline void update_max(node_pointer); inline void fix(node_pointer); inline void fix_root(node_pointer); inline void fix_sibling_rank_1_unmarked(node_pointer); inline void fix_sibling_rank_1_marked(node_pointer); inline void fix_sibling_general_unmarked(node_pointer); inline void fix_sibling_general_marked(node_pointer); inline void fix_child(node_pointer); inline static void make_root(node_pointer); inline void make_root_and_link(node_pointer); inline void remove_max_node(); void to_aux_except_max(); inline void add_to_aux(node_pointer); inline void make_from_aux(); inline size_type rank_bound(); inline void make_child_of(node_pointer, node_pointer); inline void remove_node(node_pointer); inline node_pointer join(node_pointer, node_pointer) const; #ifdef _GLIBCXX_DEBUG void assert_node_consistent(node_const_pointer, bool, const char*, int) const; void assert_aux_null(const char*, int) const; #endif node_pointer m_p_max; node_pointer m_a_aux[max_rank]; }; enum { num_distinct_rank_bounds = 48 }; // Taken from the SGI implementation; acknowledged in the docs. static const std::size_t g_a_rank_bounds[num_distinct_rank_bounds] = { /* Dealing cards... */ /* 0 */ 0ul, /* 1 */ 1ul, /* 2 */ 1ul, /* 3 */ 2ul, /* 4 */ 4ul, /* 5 */ 6ul, /* 6 */ 11ul, /* 7 */ 17ul, /* 8 */ 29ul, /* 9 */ 46ul, /* 10 */ 76ul, /* 11 */ 122ul, /* 12 */ 199ul, /* 13 */ 321ul, /* 14 */ 521ul, /* 15 */ 842ul, /* 16 */ 1364ul, /* 17 */ 2206ul, /* 18 */ 3571ul, /* 19 */ 5777ul, /* 20 */ 9349ul, /* 21 */ 15126ul, /* 22 */ 24476ul, /* 23 */ 39602ul, /* 24 */ 64079ul, /* 25 */ 103681ul, /* 26 */ 167761ul, /* 27 */ 271442ul, /* 28 */ 439204ul, /* 29 */ 710646ul, /* 30 */ 1149851ul, /* 31 */ 1860497ul, /* 32 */ 3010349ul, /* 33 */ 4870846ul, /* 34 */ 7881196ul, /* 35 */ 12752042ul, /* 36 */ 20633239ul, /* 37 */ 33385282ul, /* 38 */ 54018521ul, /* 39 */ 87403803ul, /* 40 */ 141422324ul, /* 41 */ 228826127ul, /* 42 */ 370248451ul, /* 43 */ 599074578ul, /* 44 */ 969323029ul, /* 45 */ 1568397607ul, /* 46 */ 2537720636ul, /* 47 */ 4106118243ul /* Pot's good, let's play */ }; #define PB_DS_ASSERT_NODE_CONSISTENT(_Node, _Bool) \ _GLIBCXX_DEBUG_ONLY(assert_node_consistent(_Node, _Bool, \ __FILE__, __LINE__);) #define PB_DS_ASSERT_AUX_NULL(X) \ _GLIBCXX_DEBUG_ONLY(X.assert_aux_null(__FILE__, __LINE__);) #include <ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp> #include <ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp> #include <ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp> #include <ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp> #include <ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp> #include <ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp> #include <ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp> #undef PB_DS_ASSERT_AUX_NULL #undef PB_DS_ASSERT_NODE_CONSISTENT #undef PB_DS_CLASS_C_DEC #undef PB_DS_CLASS_T_DEC #undef PB_DS_BASE_T_P } // namespace detail } // namespace __gnu_pbds #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp���������������������������������������������0000644�����������������00000007432�14763166030�0016342 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file thin_heap_/debug_fn_imps.hpp * Contains an implementation for thin_heap_. */ #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_valid(const char* __file, int __line) const { base_type::assert_valid(__file, __line); assert_node_consistent(base_type::m_p_root, true, __file, __line); assert_max(__file, __line); assert_aux_null(__file, __line); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_aux_null(const char* __file, int __line) const { for (size_type i = 0; i < max_rank; ++i) PB_DS_DEBUG_VERIFY(m_a_aux[i] == 0); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_max(const char* __file, int __line) const { if (m_p_max == 0) { PB_DS_DEBUG_VERIFY(base_type::empty()); return; } PB_DS_DEBUG_VERIFY(!base_type::empty()); PB_DS_DEBUG_VERIFY(base_type::parent(m_p_max) == 0); PB_DS_DEBUG_VERIFY(m_p_max->m_p_prev_or_parent == 0); for (const_iterator it = base_type::begin(); it != base_type::end(); ++it) PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(m_p_max->m_value, it.m_p_nd->m_value)); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_node_consistent(node_const_pointer p_nd, bool root, const char* __file, int __line) const { base_type::assert_node_consistent(p_nd, root, __file, __line); if (p_nd == 0) return; assert_node_consistent(p_nd->m_p_next_sibling, root, __file, __line); assert_node_consistent(p_nd->m_p_l_child, false, __file, __line); if (!root) { if (p_nd->m_metadata == 0) PB_DS_DEBUG_VERIFY(p_nd->m_p_next_sibling == 0); else PB_DS_DEBUG_VERIFY(p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata + 1); } if (p_nd->m_p_l_child != 0) PB_DS_DEBUG_VERIFY(p_nd->m_p_l_child->m_metadata + 1 == base_type::degree(p_nd)); const bool unmarked_valid = (p_nd->m_p_l_child == 0 && p_nd->m_metadata == 0) || (p_nd->m_p_l_child != 0 && p_nd->m_metadata == p_nd->m_p_l_child->m_metadata + 1); const bool marked_valid = (p_nd->m_p_l_child == 0 && p_nd->m_metadata == 1) || (p_nd->m_p_l_child != 0 && p_nd->m_metadata == p_nd->m_p_l_child->m_metadata + 2); PB_DS_DEBUG_VERIFY(unmarked_valid || marked_valid); if (root) PB_DS_DEBUG_VERIFY(unmarked_valid); } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/type_utils.hpp�����������������������������������������������������������0000644�����������������00000010337�14763166030�0013642 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file detail/type_utils.hpp * Contains utilities for handnling types. All of these classes are based on * Modern C++ by Andrei Alxandrescu. */ #ifndef PB_DS_TYPE_UTILS_HPP #define PB_DS_TYPE_UTILS_HPP #include <cstddef> #include <utility> #include <tr1/type_traits> #include <ext/type_traits.h> #include <ext/numeric_traits.h> namespace __gnu_pbds { namespace detail { using std::tr1::is_same; using std::tr1::is_const; using std::tr1::is_pointer; using std::tr1::is_reference; using std::tr1::is_fundamental; using std::tr1::is_member_object_pointer; using std::tr1::is_member_pointer; using std::tr1::is_base_of; using std::tr1::remove_const; using std::tr1::remove_reference; // Need integral_const<bool, true> <-> integral_const<int, 1>, so // because of this use the following typedefs instead of importing // std::tr1's. using std::tr1::integral_constant; typedef std::tr1::integral_constant<int, 1> true_type; typedef std::tr1::integral_constant<int, 0> false_type; using __gnu_cxx::__conditional_type; using __gnu_cxx::__numeric_traits; template<typename T> struct is_const_pointer { enum { value = is_const<T>::value && is_pointer<T>::value }; }; template<typename T> struct is_const_reference { enum { value = is_const<T>::value && is_reference<T>::value }; }; template<typename T> struct is_simple { enum { value = is_fundamental<typename remove_const<T>::type>::value || is_pointer<typename remove_const<T>::type>::value || is_member_pointer<T>::value }; }; template<typename T> class is_pair { private: template<typename U> struct is_pair_imp { enum { value = 0 }; }; template<typename U, typename V> struct is_pair_imp<std::pair<U,V> > { enum { value = 1 }; }; public: enum { value = is_pair_imp<T>::value }; }; // Use C++0x's static_assert if possible. #if __cplusplus >= 201103L #define PB_DS_STATIC_ASSERT(UNIQUE, E) static_assert(E, #UNIQUE) #else template<bool> struct __static_assert; template<> struct __static_assert<true> { }; template<int> struct __static_assert_dumclass { enum { v = 1 }; }; #define PB_DS_STATIC_ASSERT(UNIQUE, E) \ typedef __gnu_pbds::detail::__static_assert_dumclass<sizeof(__gnu_pbds::detail::__static_assert<bool(E)>)> UNIQUE##__static_assert_type #endif template<typename Type> struct type_to_type { typedef Type type; }; } // namespace detail } // namespace __gnu_pbds #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp�������������������������������������0000644�����������������00000005535�14763166030�0020053 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file bin_search_tree_/r_erase_fn_imps.hpp * Contains an implementation class for bin_search_tree_. */ PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: actual_erase_node(node_pointer p_z) { _GLIBCXX_DEBUG_ASSERT(m_size > 0); --m_size; _GLIBCXX_DEBUG_ONLY(erase_existing(PB_DS_V2F(p_z->m_value));) p_z->~node(); s_node_allocator.deallocate(p_z, 1); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: update_min_max_for_erased_node(node_pointer p_z) { if (m_size == 1) { m_p_head->m_p_left = m_p_head->m_p_right = m_p_head; return; } if (m_p_head->m_p_left == p_z) { iterator it(p_z); ++it; m_p_head->m_p_left = it.m_p_nd; } else if (m_p_head->m_p_right == p_z) { iterator it(p_z); --it; m_p_head->m_p_right = it.m_p_nd; } } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: clear() { PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) clear_imp(m_p_head->m_p_parent); m_size = 0; initialize(); _GLIBCXX_DEBUG_ONLY(debug_base::clear();) PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: clear_imp(node_pointer p_nd) { if (p_nd == 0) return; clear_imp(p_nd->m_p_left); clear_imp(p_nd->m_p_right); p_nd->~Node(); s_node_allocator.deallocate(p_nd, 1); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp��������������������������������������0000644�����������������00000010136�14763166030�0017722 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file bin_search_tree_/rotate_fn_imps.hpp * Contains imps for rotating nodes. */ PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: rotate_left(node_pointer p_x) { node_pointer p_y = p_x->m_p_right; p_x->m_p_right = p_y->m_p_left; if (p_y->m_p_left != 0) p_y->m_p_left->m_p_parent = p_x; p_y->m_p_parent = p_x->m_p_parent; if (p_x == m_p_head->m_p_parent) m_p_head->m_p_parent = p_y; else if (p_x == p_x->m_p_parent->m_p_left) p_x->m_p_parent->m_p_left = p_y; else p_x->m_p_parent->m_p_right = p_y; p_y->m_p_left = p_x; p_x->m_p_parent = p_y; PB_DS_ASSERT_NODE_CONSISTENT(p_x) PB_DS_ASSERT_NODE_CONSISTENT(p_y) apply_update(p_x, (node_update* )this); apply_update(p_x->m_p_parent, (node_update* )this); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: rotate_right(node_pointer p_x) { node_pointer p_y = p_x->m_p_left; p_x->m_p_left = p_y->m_p_right; if (p_y->m_p_right != 0) p_y->m_p_right->m_p_parent = p_x; p_y->m_p_parent = p_x->m_p_parent; if (p_x == m_p_head->m_p_parent) m_p_head->m_p_parent = p_y; else if (p_x == p_x->m_p_parent->m_p_right) p_x->m_p_parent->m_p_right = p_y; else p_x->m_p_parent->m_p_left = p_y; p_y->m_p_right = p_x; p_x->m_p_parent = p_y; PB_DS_ASSERT_NODE_CONSISTENT(p_x) PB_DS_ASSERT_NODE_CONSISTENT(p_y) apply_update(p_x, (node_update* )this); apply_update(p_x->m_p_parent, (node_update* )this); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: rotate_parent(node_pointer p_nd) { node_pointer p_parent = p_nd->m_p_parent; if (p_nd == p_parent->m_p_left) rotate_right(p_parent); else rotate_left(p_parent); _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_parent = p_nd); _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left == p_parent || p_nd->m_p_right == p_parent); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: apply_update(node_pointer /*p_nd*/, null_node_update_pointer /*p_update*/) { } PB_DS_CLASS_T_DEC template<typename Node_Update_> inline void PB_DS_CLASS_C_DEC:: apply_update(node_pointer p_nd, Node_Update_* /*p_update*/) { node_update::operator()(node_iterator(p_nd), node_const_iterator(static_cast<node_pointer>(0))); } PB_DS_CLASS_T_DEC template<typename Node_Update_> inline void PB_DS_CLASS_C_DEC:: update_to_top(node_pointer p_nd, Node_Update_* p_update) { while (p_nd != m_p_head) { apply_update(p_nd, p_update); p_nd = p_nd->m_p_parent; } } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: update_to_top(node_pointer /*p_nd*/, null_node_update_pointer /*p_update*/) { } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp���������������������0000644�����������������00000012603�14763166030�0023453 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file bin_search_tree_/constructors_destructor_fn_imps.hpp * Contains an implementation class for bin_search_tree_. */ PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_allocator PB_DS_CLASS_C_DEC::s_node_allocator; PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_BIN_TREE_NAME() : m_p_head(s_node_allocator.allocate(1)), m_size(0) { initialize(); PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_BIN_TREE_NAME(const Cmp_Fn& r_cmp_fn) : Cmp_Fn(r_cmp_fn), m_p_head(s_node_allocator.allocate(1)), m_size(0) { initialize(); PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_BIN_TREE_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) : Cmp_Fn(r_cmp_fn), node_update(r_node_update), m_p_head(s_node_allocator.allocate(1)), m_size(0) { initialize(); PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: PB_DS_BIN_TREE_NAME(const PB_DS_CLASS_C_DEC& other) : #ifdef _GLIBCXX_DEBUG debug_base(other), #endif #ifdef PB_DS_TREE_TRACE PB_DS_TREE_TRACE_BASE_C_DEC(other), #endif Cmp_Fn(other), node_update(other), m_p_head(s_node_allocator.allocate(1)), m_size(0) { initialize(); m_size = other.m_size; PB_DS_STRUCT_ONLY_ASSERT_VALID(other) __try { m_p_head->m_p_parent = recursive_copy_node(other.m_p_head->m_p_parent); if (m_p_head->m_p_parent != 0) m_p_head->m_p_parent->m_p_parent = m_p_head; m_size = other.m_size; initialize_min_max(); } __catch(...) { _GLIBCXX_DEBUG_ONLY(debug_base::clear();) s_node_allocator.deallocate(m_p_head, 1); __throw_exception_again; } PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) PB_DS_STRUCT_ONLY_ASSERT_VALID(other) value_swap(other); std::swap((Cmp_Fn& )(*this), (Cmp_Fn& )other); PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) PB_DS_STRUCT_ONLY_ASSERT_VALID(other) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: value_swap(PB_DS_CLASS_C_DEC& other) { _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);) std::swap(m_p_head, other.m_p_head); std::swap(m_size, other.m_size); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ~PB_DS_BIN_TREE_NAME() { clear(); s_node_allocator.deallocate(m_p_head, 1); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: initialize() { m_p_head->m_p_parent = 0; m_p_head->m_p_left = m_p_head; m_p_head->m_p_right = m_p_head; m_size = 0; } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: recursive_copy_node(const node_pointer p_nd) { if (p_nd == 0) return (0); node_pointer p_ret = s_node_allocator.allocate(1); __try { new (p_ret) node(*p_nd); } __catch(...) { s_node_allocator.deallocate(p_ret, 1); __throw_exception_again; } p_ret->m_p_left = p_ret->m_p_right = 0; __try { p_ret->m_p_left = recursive_copy_node(p_nd->m_p_left); p_ret->m_p_right = recursive_copy_node(p_nd->m_p_right); } __catch(...) { clear_imp(p_ret); __throw_exception_again; } if (p_ret->m_p_left != 0) p_ret->m_p_left->m_p_parent = p_ret; if (p_ret->m_p_right != 0) p_ret->m_p_right->m_p_parent = p_ret; PB_DS_ASSERT_NODE_CONSISTENT(p_ret) return p_ret; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: initialize_min_max() { if (m_p_head->m_p_parent == 0) { m_p_head->m_p_left = m_p_head->m_p_right = m_p_head; return; } { node_pointer p_min = m_p_head->m_p_parent; while (p_min->m_p_left != 0) p_min = p_min->m_p_left; m_p_head->m_p_left = p_min; } { node_pointer p_max = m_p_head->m_p_parent; while (p_max->m_p_right != 0) p_max = p_max->m_p_right; m_p_head->m_p_right = p_max; } } �����������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp��������������������������������������0000644�����������������00000012551�14763166030�0017733 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file bin_search_tree_/insert_fn_imps.hpp * Contains an implementation class for bin_search_tree_. */ PB_DS_CLASS_T_DEC inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool> PB_DS_CLASS_C_DEC:: insert_leaf(const_reference r_value) { PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) if (m_size == 0) return std::make_pair(insert_imp_empty(r_value), true); node_pointer p_nd = m_p_head->m_p_parent; node_pointer p_pot = m_p_head; while (p_nd != 0) if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), PB_DS_V2F(r_value))) { p_pot = p_nd; p_nd = p_nd->m_p_left; } else p_nd = p_nd->m_p_right; if (p_pot == m_p_head) return std::make_pair(insert_leaf_new(r_value, m_p_head->m_p_right, false), true); if (!Cmp_Fn::operator()(PB_DS_V2F(r_value), PB_DS_V2F(p_pot->m_value))) { PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) PB_DS_CHECK_KEY_EXISTS(PB_DS_V2F(r_value)) return std::make_pair(p_pot, false); } PB_DS_CHECK_KEY_DOES_NOT_EXIST(PB_DS_V2F(r_value)) p_nd = p_pot->m_p_left; if (p_nd == 0) return std::make_pair(insert_leaf_new(r_value, p_pot, true), true); while (p_nd->m_p_right != 0) p_nd = p_nd->m_p_right; return std::make_pair(insert_leaf_new(r_value, p_nd, false), true); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: insert_leaf_new(const_reference r_value, node_pointer p_nd, bool left_nd) { node_pointer p_new_nd = get_new_node_for_leaf_insert(r_value, traits_base::m_no_throw_copies_indicator); if (left_nd) { _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left == 0); _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(r_value), PB_DS_V2F(p_nd->m_value))); p_nd->m_p_left = p_new_nd; if (m_p_head->m_p_left == p_nd) m_p_head->m_p_left = p_new_nd; } else { _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_right == 0); _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), PB_DS_V2F(r_value))); p_nd->m_p_right = p_new_nd; if (m_p_head->m_p_right == p_nd) m_p_head->m_p_right = p_new_nd; } p_new_nd->m_p_parent = p_nd; p_new_nd->m_p_left = p_new_nd->m_p_right = 0; PB_DS_ASSERT_NODE_CONSISTENT(p_nd) update_to_top(p_new_nd, (node_update* )this); _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_value));) return iterator(p_new_nd); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: insert_imp_empty(const_reference r_value) { node_pointer p_new_node = get_new_node_for_leaf_insert(r_value, traits_base::m_no_throw_copies_indicator); m_p_head->m_p_left = m_p_head->m_p_right = m_p_head->m_p_parent = p_new_node; p_new_node->m_p_parent = m_p_head; p_new_node->m_p_left = p_new_node->m_p_right = 0; _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_value));) update_to_top(m_p_head->m_p_parent, (node_update*)this); return iterator(p_new_node); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: get_new_node_for_leaf_insert(const_reference r_val, false_type) { node_pointer p_new_nd = s_node_allocator.allocate(1); cond_dealtor_t cond(p_new_nd); new (const_cast<void* >(static_cast<const void* >(&p_new_nd->m_value))) typename node::value_type(r_val); cond.set_no_action(); p_new_nd->m_p_left = p_new_nd->m_p_right = 0; ++m_size; return p_new_nd; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: get_new_node_for_leaf_insert(const_reference r_val, true_type) { node_pointer p_new_nd = s_node_allocator.allocate(1); new (const_cast<void* >(static_cast<const void* >(&p_new_nd->m_value))) typename node::value_type(r_val); p_new_nd->m_p_left = p_new_nd->m_p_right = 0; ++m_size; return p_new_nd; } �������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp�����������������������������������0000644�����������������00000006673�14763166030�0020453 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file bin_search_tree_/iterators_fn_imps.hpp * Contains an implementation class for bin_search_tree_. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: begin() { return (iterator(m_p_head->m_p_left)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: begin() const { return (const_iterator(m_p_head->m_p_left)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: end() { return (iterator(m_p_head)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: end() const { return (const_iterator(m_p_head)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_reverse_iterator PB_DS_CLASS_C_DEC:: rbegin() const { return (const_reverse_iterator(m_p_head->m_p_right)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::reverse_iterator PB_DS_CLASS_C_DEC:: rbegin() { return (reverse_iterator(m_p_head->m_p_right)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::reverse_iterator PB_DS_CLASS_C_DEC:: rend() { return (reverse_iterator(m_p_head)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_reverse_iterator PB_DS_CLASS_C_DEC:: rend() const { return (const_reverse_iterator(m_p_head)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_const_iterator PB_DS_CLASS_C_DEC:: node_begin() const { return (node_const_iterator(m_p_head->m_p_parent)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_iterator PB_DS_CLASS_C_DEC:: node_begin() { return (node_iterator(m_p_head->m_p_parent)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_const_iterator PB_DS_CLASS_C_DEC:: node_end() const { return (node_const_iterator(0)); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_iterator PB_DS_CLASS_C_DEC:: node_end() { return (node_iterator(0)); } ���������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp����������������������������������0000644�����������������00000007647�14763166030�0020613 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file bin_search_tree_/split_join_fn_imps.hpp * Contains an implementation class for bin_search_tree_. */ PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: join_prep(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) if (other.m_size == 0) return false; if (m_size == 0) { value_swap(other); return false; } const bool greater = Cmp_Fn::operator()(PB_DS_V2F(m_p_head->m_p_right->m_value), PB_DS_V2F(other.m_p_head->m_p_left->m_value)); const bool lesser = Cmp_Fn::operator()(PB_DS_V2F(other.m_p_head->m_p_right->m_value), PB_DS_V2F(m_p_head->m_p_left->m_value)); if (!greater && !lesser) __throw_join_error(); if (lesser) value_swap(other); m_size += other.m_size; _GLIBCXX_DEBUG_ONLY(debug_base::join(other);) return true; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: join_finish(PB_DS_CLASS_C_DEC& other) { initialize_min_max(); other.initialize(); } PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: split_prep(key_const_reference r_key, PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) other.clear(); if (m_size == 0) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) return false; } if (Cmp_Fn::operator()(r_key, PB_DS_V2F(m_p_head->m_p_left->m_value))) { value_swap(other); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) return false; } if (!Cmp_Fn::operator()(r_key, PB_DS_V2F(m_p_head->m_p_right->m_value))) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) return false; } if (m_size == 1) { value_swap(other); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) return false; } _GLIBCXX_DEBUG_ONLY(debug_base::split(r_key,(Cmp_Fn& )(*this), other);) return true; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: split_finish(PB_DS_CLASS_C_DEC& other) { other.initialize_min_max(); other.m_size = std::distance(other.begin(), other.end()); m_size -= other.m_size; initialize_min_max(); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: recursive_count(node_pointer p) const { if (p == 0) return 0; return 1 + recursive_count(p->m_p_left) + recursive_count(p->m_p_right); } �����������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp�������������������������������������0000644�����������������00000021401�14763166030�0020133 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file bin_search_tree_/point_iterators.hpp * Contains an implementation class for bin_search_tree_. */ #ifndef PB_DS_BIN_SEARCH_TREE_FIND_ITERATORS_HPP #define PB_DS_BIN_SEARCH_TREE_FIND_ITERATORS_HPP #include <ext/pb_ds/tag_and_trait.hpp> #include <debug/debug.h> namespace __gnu_pbds { namespace detail { #define PB_DS_TREE_CONST_IT_C_DEC \ bin_search_tree_const_it_< \ Node_Pointer, \ Value_Type, \ Pointer, \ Const_Pointer, \ Reference, \ Const_Reference, \ Is_Forward_Iterator, \ _Alloc> #define PB_DS_TREE_CONST_ODIR_IT_C_DEC \ bin_search_tree_const_it_< \ Node_Pointer, \ Value_Type, \ Pointer, \ Const_Pointer, \ Reference, \ Const_Reference, \ !Is_Forward_Iterator, \ _Alloc> #define PB_DS_TREE_IT_C_DEC \ bin_search_tree_it_< \ Node_Pointer, \ Value_Type, \ Pointer, \ Const_Pointer, \ Reference, \ Const_Reference, \ Is_Forward_Iterator, \ _Alloc> #define PB_DS_TREE_ODIR_IT_C_DEC \ bin_search_tree_it_< \ Node_Pointer, \ Value_Type, \ Pointer, \ Const_Pointer, \ Reference, \ Const_Reference, \ !Is_Forward_Iterator, \ _Alloc> /// Const iterator. template<typename Node_Pointer, typename Value_Type, typename Pointer, typename Const_Pointer, typename Reference, typename Const_Reference, bool Is_Forward_Iterator, typename _Alloc> class bin_search_tree_const_it_ { public: typedef std::bidirectional_iterator_tag iterator_category; typedef typename _Alloc::difference_type difference_type; typedef Value_Type value_type; typedef Pointer pointer; typedef Const_Pointer const_pointer; typedef Reference reference; typedef Const_Reference const_reference; inline bin_search_tree_const_it_(const Node_Pointer p_nd = 0) : m_p_nd(const_cast<Node_Pointer>(p_nd)) { } inline bin_search_tree_const_it_(const PB_DS_TREE_CONST_ODIR_IT_C_DEC& other) : m_p_nd(other.m_p_nd) { } inline PB_DS_TREE_CONST_IT_C_DEC& operator=(const PB_DS_TREE_CONST_IT_C_DEC& other) { m_p_nd = other.m_p_nd; return *this; } inline PB_DS_TREE_CONST_IT_C_DEC& operator=(const PB_DS_TREE_CONST_ODIR_IT_C_DEC& other) { m_p_nd = other.m_p_nd; return *this; } inline const_pointer operator->() const { _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0); return &m_p_nd->m_value; } inline const_reference operator*() const { _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0); return m_p_nd->m_value; } inline bool operator==(const PB_DS_TREE_CONST_IT_C_DEC & other) const { return m_p_nd == other.m_p_nd; } inline bool operator==(const PB_DS_TREE_CONST_ODIR_IT_C_DEC & other) const { return m_p_nd == other.m_p_nd; } inline bool operator!=(const PB_DS_TREE_CONST_IT_C_DEC& other) const { return m_p_nd != other.m_p_nd; } inline bool operator!=(const PB_DS_TREE_CONST_ODIR_IT_C_DEC& other) const { return m_p_nd != other.m_p_nd; } inline PB_DS_TREE_CONST_IT_C_DEC& operator++() { _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0); inc(integral_constant<int,Is_Forward_Iterator>()); return *this; } inline PB_DS_TREE_CONST_IT_C_DEC operator++(int) { PB_DS_TREE_CONST_IT_C_DEC ret_it(m_p_nd); operator++(); return ret_it; } inline PB_DS_TREE_CONST_IT_C_DEC& operator--() { dec(integral_constant<int,Is_Forward_Iterator>()); return *this; } inline PB_DS_TREE_CONST_IT_C_DEC operator--(int) { PB_DS_TREE_CONST_IT_C_DEC ret_it(m_p_nd); operator--(); return ret_it; } protected: inline void inc(false_type) { dec(true_type()); } void inc(true_type) { if (m_p_nd->special()&& m_p_nd->m_p_parent->m_p_parent == m_p_nd) { m_p_nd = m_p_nd->m_p_left; return; } if (m_p_nd->m_p_right != 0) { m_p_nd = m_p_nd->m_p_right; while (m_p_nd->m_p_left != 0) m_p_nd = m_p_nd->m_p_left; return; } Node_Pointer p_y = m_p_nd->m_p_parent; while (m_p_nd == p_y->m_p_right) { m_p_nd = p_y; p_y = p_y->m_p_parent; } if (m_p_nd->m_p_right != p_y) m_p_nd = p_y; } inline void dec(false_type) { inc(true_type()); } void dec(true_type) { if (m_p_nd->special() && m_p_nd->m_p_parent->m_p_parent == m_p_nd) { m_p_nd = m_p_nd->m_p_right; return; } if (m_p_nd->m_p_left != 0) { Node_Pointer p_y = m_p_nd->m_p_left; while (p_y->m_p_right != 0) p_y = p_y->m_p_right; m_p_nd = p_y; return; } Node_Pointer p_y = m_p_nd->m_p_parent; while (m_p_nd == p_y->m_p_left) { m_p_nd = p_y; p_y = p_y->m_p_parent; } if (m_p_nd->m_p_left != p_y) m_p_nd = p_y; } public: Node_Pointer m_p_nd; }; /// Iterator. template<typename Node_Pointer, typename Value_Type, typename Pointer, typename Const_Pointer, typename Reference, typename Const_Reference, bool Is_Forward_Iterator, typename _Alloc> class bin_search_tree_it_ : public PB_DS_TREE_CONST_IT_C_DEC { public: inline bin_search_tree_it_(const Node_Pointer p_nd = 0) : PB_DS_TREE_CONST_IT_C_DEC((Node_Pointer)p_nd) { } inline bin_search_tree_it_(const PB_DS_TREE_ODIR_IT_C_DEC& other) : PB_DS_TREE_CONST_IT_C_DEC(other.m_p_nd) { } inline PB_DS_TREE_IT_C_DEC& operator=(const PB_DS_TREE_IT_C_DEC& other) { base_it_type::m_p_nd = other.m_p_nd; return *this; } inline PB_DS_TREE_IT_C_DEC& operator=(const PB_DS_TREE_ODIR_IT_C_DEC& other) { base_it_type::m_p_nd = other.m_p_nd; return *this; } inline typename PB_DS_TREE_CONST_IT_C_DEC::pointer operator->() const { _GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd != 0); return &base_it_type::m_p_nd->m_value; } inline typename PB_DS_TREE_CONST_IT_C_DEC::reference operator*() const { _GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd != 0); return base_it_type::m_p_nd->m_value; } inline PB_DS_TREE_IT_C_DEC& operator++() { PB_DS_TREE_CONST_IT_C_DEC:: operator++(); return *this; } inline PB_DS_TREE_IT_C_DEC operator++(int) { PB_DS_TREE_IT_C_DEC ret_it(base_it_type::m_p_nd); operator++(); return ret_it; } inline PB_DS_TREE_IT_C_DEC& operator--() { PB_DS_TREE_CONST_IT_C_DEC:: operator--(); return *this; } inline PB_DS_TREE_IT_C_DEC operator--(int) { PB_DS_TREE_IT_C_DEC ret_it(base_it_type::m_p_nd); operator--(); return ret_it; } protected: typedef PB_DS_TREE_CONST_IT_C_DEC base_it_type; }; #undef PB_DS_TREE_CONST_IT_C_DEC #undef PB_DS_TREE_CONST_ODIR_IT_C_DEC #undef PB_DS_TREE_IT_C_DEC #undef PB_DS_TREE_ODIR_IT_C_DEC } // namespace detail } // namespace __gnu_pbds #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/bin_search_tree_/traits.hpp����������������������������������������������0000644�����������������00000014411�14763166030�0016217 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file bin_search_tree_/traits.hpp * Contains an implementation for bin_search_tree_. */ #ifndef PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP #define PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP #include <ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp> #include <ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp> namespace __gnu_pbds { namespace detail { /// Binary search tree traits, primary template /// @ingroup traits template<typename Key, typename Mapped, class Cmp_Fn, template<typename Node_CItr, class Node_Itr, class Cmp_Fn, typename _Alloc> class Node_Update, class Node, typename _Alloc> struct bin_search_tree_traits { private: typedef types_traits<Key, Mapped, _Alloc, false> type_traits; public: typedef Node node; typedef bin_search_tree_const_it_< typename _Alloc::template rebind< node>::other::pointer, typename type_traits::value_type, typename type_traits::pointer, typename type_traits::const_pointer, typename type_traits::reference, typename type_traits::const_reference, true, _Alloc> point_const_iterator; typedef bin_search_tree_it_< typename _Alloc::template rebind< node>::other::pointer, typename type_traits::value_type, typename type_traits::pointer, typename type_traits::const_pointer, typename type_traits::reference, typename type_traits::const_reference, true, _Alloc> point_iterator; typedef bin_search_tree_const_it_< typename _Alloc::template rebind< node>::other::pointer, typename type_traits::value_type, typename type_traits::pointer, typename type_traits::const_pointer, typename type_traits::reference, typename type_traits::const_reference, false, _Alloc> const_reverse_iterator; typedef bin_search_tree_it_< typename _Alloc::template rebind< node>::other::pointer, typename type_traits::value_type, typename type_traits::pointer, typename type_traits::const_pointer, typename type_traits::reference, typename type_traits::const_reference, false, _Alloc> reverse_iterator; /// This is an iterator to an iterator: it iterates over nodes, /// and de-referencing it returns one of the tree's iterators. typedef bin_search_tree_const_node_it_< Node, point_const_iterator, point_iterator, _Alloc> node_const_iterator; typedef bin_search_tree_node_it_< Node, point_const_iterator, point_iterator, _Alloc> node_iterator; typedef Node_Update< node_const_iterator, node_iterator, Cmp_Fn, _Alloc> node_update; typedef __gnu_pbds::null_node_update< node_const_iterator, node_iterator, Cmp_Fn, _Alloc>* null_node_update_pointer; }; /// Specialization. /// @ingroup traits template<typename Key, class Cmp_Fn, template<typename Node_CItr, class Node_Itr, class Cmp_Fn, typename _Alloc> class Node_Update, class Node, typename _Alloc> struct bin_search_tree_traits< Key, null_type, Cmp_Fn, Node_Update, Node, _Alloc> { private: typedef types_traits<Key, null_type, _Alloc, false> type_traits; public: typedef Node node; typedef bin_search_tree_const_it_< typename _Alloc::template rebind< node>::other::pointer, typename type_traits::value_type, typename type_traits::pointer, typename type_traits::const_pointer, typename type_traits::reference, typename type_traits::const_reference, true, _Alloc> point_const_iterator; typedef point_const_iterator point_iterator; typedef bin_search_tree_const_it_< typename _Alloc::template rebind< node>::other::pointer, typename type_traits::value_type, typename type_traits::pointer, typename type_traits::const_pointer, typename type_traits::reference, typename type_traits::const_reference, false, _Alloc> const_reverse_iterator; typedef const_reverse_iterator reverse_iterator; /// This is an iterator to an iterator: it iterates over nodes, /// and de-referencing it returns one of the tree's iterators. typedef bin_search_tree_const_node_it_< Node, point_const_iterator, point_iterator, _Alloc> node_const_iterator; typedef node_const_iterator node_iterator; typedef Node_Update<node_const_iterator, node_iterator, Cmp_Fn, _Alloc> node_update; typedef __gnu_pbds::null_node_update< node_const_iterator, node_iterator, Cmp_Fn, _Alloc>* null_node_update_pointer; }; } // namespace detail } // namespace __gnu_pbds #endif // #ifndef PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp��������������������������������������0000644�����������������00000013555�14763166030�0017742 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file bin_search_tree_/node_iterators.hpp * Contains an implementation class for bin_search_tree_. */ #ifndef PB_DS_BIN_SEARCH_TREE_NODE_ITERATORS_HPP #define PB_DS_BIN_SEARCH_TREE_NODE_ITERATORS_HPP #include <ext/pb_ds/tag_and_trait.hpp> namespace __gnu_pbds { namespace detail { #define PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC \ bin_search_tree_const_node_it_<Node, Const_Iterator, Iterator, _Alloc> /// Const node iterator. template<typename Node, class Const_Iterator, class Iterator, typename _Alloc> class bin_search_tree_const_node_it_ { private: typedef typename _Alloc::template rebind< Node>::other::pointer node_pointer; public: /// Category. typedef trivial_iterator_tag iterator_category; /// Difference type. typedef trivial_iterator_difference_type difference_type; /// Iterator's value type. typedef Const_Iterator value_type; /// Iterator's reference type. typedef Const_Iterator reference; /// Iterator's __const reference type. typedef Const_Iterator const_reference; /// Metadata type. typedef typename Node::metadata_type metadata_type; /// Const metadata reference type. typedef typename _Alloc::template rebind<metadata_type>::other::const_reference metadata_const_reference; bin_search_tree_const_node_it_(const node_pointer p_nd = 0) : m_p_nd(const_cast<node_pointer>(p_nd)) { } /// Access. const_reference operator*() const { return Const_Iterator(m_p_nd); } /// Metadata access. metadata_const_reference get_metadata() const { return m_p_nd->get_metadata(); } /// Returns the __const node iterator associated with the left node. PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC get_l_child() const { return PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(m_p_nd->m_p_left); } /// Returns the __const node iterator associated with the right node. PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC get_r_child() const { return PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(m_p_nd->m_p_right); } /// Compares to a different iterator object. bool operator==(const PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC& other) const { return m_p_nd == other.m_p_nd; } /// Compares (negatively) to a different iterator object. bool operator!=(const PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC& other) const { return m_p_nd != other.m_p_nd; } node_pointer m_p_nd; }; #define PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC \ bin_search_tree_node_it_<Node, Const_Iterator, Iterator, _Alloc> /// Node iterator. template<typename Node, class Const_Iterator, class Iterator, typename _Alloc> class bin_search_tree_node_it_ : public PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC { private: typedef typename _Alloc::template rebind< Node>::other::pointer node_pointer; public: /// Iterator's value type. typedef Iterator value_type; /// Iterator's reference type. typedef Iterator reference; /// Iterator's __const reference type. typedef Iterator const_reference; inline bin_search_tree_node_it_(const node_pointer p_nd = 0) : PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(const_cast<node_pointer>(p_nd)) { } /// Access. Iterator operator*() const { return Iterator(PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd); } /// Returns the node iterator associated with the left node. PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC get_l_child() const { return PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC( PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd->m_p_left); } /// Returns the node iterator associated with the right node. PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC get_r_child() const { return PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC( PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd->m_p_right); } }; #undef PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC #undef PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC } // namespace detail } // namespace __gnu_pbds #endif // #ifndef PB_DS_BIN_SEARCH_TREE_NODE_ITERATORS_HPP ���������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp����������������������������������������0000644�����������������00000011107�14763166030�0017343 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file bin_search_tree_/find_fn_imps.hpp * Contains an implementation class for bin_search_tree_. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_const_iterator PB_DS_CLASS_C_DEC:: lower_bound(key_const_reference r_key) const { node_pointer p_pot = m_p_head; node_pointer p_nd = m_p_head->m_p_parent; while (p_nd != 0) if (Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key)) p_nd = p_nd->m_p_right; else { p_pot = p_nd; p_nd = p_nd->m_p_left; } return iterator(p_pot); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_iterator PB_DS_CLASS_C_DEC:: lower_bound(key_const_reference r_key) { node_pointer p_pot = m_p_head; node_pointer p_nd = m_p_head->m_p_parent; while (p_nd != 0) if (Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key)) p_nd = p_nd->m_p_right; else { p_pot = p_nd; p_nd = p_nd->m_p_left; } return iterator(p_pot); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_const_iterator PB_DS_CLASS_C_DEC:: upper_bound(key_const_reference r_key) const { node_pointer p_pot = m_p_head; node_pointer p_nd = m_p_head->m_p_parent; while (p_nd != 0) if (Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value))) { p_pot = p_nd; p_nd = p_nd->m_p_left; } else p_nd = p_nd->m_p_right; return const_iterator(p_pot); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_iterator PB_DS_CLASS_C_DEC:: upper_bound(key_const_reference r_key) { node_pointer p_pot = m_p_head; node_pointer p_nd = m_p_head->m_p_parent; while (p_nd != 0) if (Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value))) { p_pot = p_nd; p_nd = p_nd->m_p_left; } else p_nd = p_nd->m_p_right; return point_iterator(p_pot); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_iterator PB_DS_CLASS_C_DEC:: find(key_const_reference r_key) { PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) node_pointer p_pot = m_p_head; node_pointer p_nd = m_p_head->m_p_parent; while (p_nd != 0) if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key)) { p_pot = p_nd; p_nd = p_nd->m_p_left; } else p_nd = p_nd->m_p_right; node_pointer ret = p_pot; if (p_pot != m_p_head) { const bool __cmp = Cmp_Fn::operator()(r_key, PB_DS_V2F(p_pot->m_value)); if (__cmp) ret = m_p_head; } return point_iterator(ret); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_const_iterator PB_DS_CLASS_C_DEC:: find(key_const_reference r_key) const { PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) node_pointer p_pot = m_p_head; node_pointer p_nd = m_p_head->m_p_parent; while (p_nd != 0) if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key)) { p_pot = p_nd; p_nd = p_nd->m_p_left; } else p_nd = p_nd->m_p_right; node_pointer ret = p_pot; if (p_pot != m_p_head) { const bool __cmp = Cmp_Fn::operator()(r_key, PB_DS_V2F(p_pot->m_value)); if (__cmp) ret = m_p_head; } return point_const_iterator(ret); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp�������������������������������0000644�����������������00000003561�14763166030�0021250 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file bin_search_tree_/policy_access_fn_imps.hpp * Contains an implementation class for bin_search_tree_. */ PB_DS_CLASS_T_DEC Cmp_Fn& PB_DS_CLASS_C_DEC:: get_cmp_fn() { return (*this); } PB_DS_CLASS_T_DEC const Cmp_Fn& PB_DS_CLASS_C_DEC:: get_cmp_fn() const { return (*this); } �����������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp������������������������������������0000644�����������������00000030203�14763166030�0020161 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file bin_search_tree_/bin_search_tree_.hpp * Contains an implementation class for binary search tree. */ #include <ext/pb_ds/exception.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp> #include <ext/pb_ds/detail/types_traits.hpp> #include <ext/pb_ds/detail/cond_dealtor.hpp> #include <ext/pb_ds/detail/type_utils.hpp> #include <ext/pb_ds/detail/tree_trace_base.hpp> #ifdef _GLIBCXX_DEBUG #include <ext/pb_ds/detail/debug_map_base.hpp> #endif #include <utility> #include <functional> #include <debug/debug.h> namespace __gnu_pbds { namespace detail { #ifdef PB_DS_DATA_TRUE_INDICATOR #define PB_DS_BIN_TREE_NAME bin_search_tree_map #endif #ifdef PB_DS_DATA_FALSE_INDICATOR #define PB_DS_BIN_TREE_NAME bin_search_tree_set #endif #define PB_DS_CLASS_T_DEC \ template<typename Key, typename Mapped, typename Cmp_Fn, \ typename Node_And_It_Traits, typename _Alloc> #define PB_DS_CLASS_C_DEC \ PB_DS_BIN_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc> #define PB_DS_BIN_TREE_TRAITS_BASE \ types_traits<Key, Mapped, _Alloc, false> #ifdef _GLIBCXX_DEBUG #define PB_DS_DEBUG_MAP_BASE_C_DEC \ debug_map_base<Key, eq_by_less<Key, Cmp_Fn>, \ typename _Alloc::template rebind<Key>::other::const_reference> #endif #ifdef PB_DS_TREE_TRACE #define PB_DS_TREE_TRACE_BASE_C_DEC \ tree_trace_base<typename Node_And_It_Traits::node_const_iterator, \ typename Node_And_It_Traits::node_iterator, \ Cmp_Fn, true, _Alloc> #endif /* * @brief Binary search tree (BST). * * This implementation uses an idea from the SGI STL (using a @a * header node which is needed for efficient iteration). */ template<typename Key, typename Mapped, typename Cmp_Fn, typename Node_And_It_Traits, typename _Alloc> class PB_DS_BIN_TREE_NAME : #ifdef _GLIBCXX_DEBUG public PB_DS_DEBUG_MAP_BASE_C_DEC, #endif #ifdef PB_DS_TREE_TRACE public PB_DS_TREE_TRACE_BASE_C_DEC, #endif public Cmp_Fn, public PB_DS_BIN_TREE_TRAITS_BASE, public Node_And_It_Traits::node_update { typedef Node_And_It_Traits traits_type; protected: typedef PB_DS_BIN_TREE_TRAITS_BASE traits_base; typedef typename _Alloc::template rebind<typename traits_type::node>::other node_allocator; typedef typename node_allocator::value_type node; typedef typename node_allocator::pointer node_pointer; typedef typename traits_type::null_node_update_pointer null_node_update_pointer; private: typedef cond_dealtor<node, _Alloc> cond_dealtor_t; #ifdef _GLIBCXX_DEBUG typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base; #endif public: typedef typename _Alloc::size_type size_type; typedef typename _Alloc::difference_type difference_type; typedef typename traits_base::key_type key_type; typedef typename traits_base::key_pointer key_pointer; typedef typename traits_base::key_const_pointer key_const_pointer; typedef typename traits_base::key_reference key_reference; typedef typename traits_base::key_const_reference key_const_reference; #ifdef PB_DS_DATA_TRUE_INDICATOR typedef typename traits_base::mapped_type mapped_type; typedef typename traits_base::mapped_pointer mapped_pointer; typedef typename traits_base::mapped_const_pointer mapped_const_pointer; typedef typename traits_base::mapped_reference mapped_reference; typedef typename traits_base::mapped_const_reference mapped_const_reference; #endif typedef typename traits_base::value_type value_type; typedef typename traits_base::pointer pointer; typedef typename traits_base::const_pointer const_pointer; typedef typename traits_base::reference reference; typedef typename traits_base::const_reference const_reference; typedef typename traits_type::point_const_iterator point_const_iterator; typedef point_const_iterator const_iterator; typedef typename traits_type::point_iterator point_iterator; typedef point_iterator iterator; typedef typename traits_type::const_reverse_iterator const_reverse_iterator; typedef typename traits_type::reverse_iterator reverse_iterator; typedef typename traits_type::node_const_iterator node_const_iterator; typedef typename traits_type::node_iterator node_iterator; typedef typename traits_type::node_update node_update; typedef Cmp_Fn cmp_fn; typedef _Alloc allocator_type; PB_DS_BIN_TREE_NAME(); PB_DS_BIN_TREE_NAME(const Cmp_Fn&); PB_DS_BIN_TREE_NAME(const Cmp_Fn&, const node_update&); PB_DS_BIN_TREE_NAME(const PB_DS_CLASS_C_DEC&); void swap(PB_DS_CLASS_C_DEC&); ~PB_DS_BIN_TREE_NAME(); inline bool empty() const; inline size_type size() const; inline size_type max_size() const; Cmp_Fn& get_cmp_fn(); const Cmp_Fn& get_cmp_fn() const; inline point_iterator lower_bound(key_const_reference); inline point_const_iterator lower_bound(key_const_reference) const; inline point_iterator upper_bound(key_const_reference); inline point_const_iterator upper_bound(key_const_reference) const; inline point_iterator find(key_const_reference); inline point_const_iterator find(key_const_reference) const; inline iterator begin(); inline const_iterator begin() const; inline iterator end(); inline const_iterator end() const; inline reverse_iterator rbegin(); inline const_reverse_iterator rbegin() const; inline reverse_iterator rend(); inline const_reverse_iterator rend() const; /// Returns a const node_iterator corresponding to the node at the /// root of the tree. inline node_const_iterator node_begin() const; /// Returns a node_iterator corresponding to the node at the /// root of the tree. inline node_iterator node_begin(); /// Returns a const node_iterator corresponding to a node just /// after a leaf of the tree. inline node_const_iterator node_end() const; /// Returns a node_iterator corresponding to a node just /// after a leaf of the tree. inline node_iterator node_end(); void clear(); protected: void value_swap(PB_DS_CLASS_C_DEC&); void initialize_min_max(); inline iterator insert_imp_empty(const_reference); inline iterator insert_leaf_new(const_reference, node_pointer, bool); inline node_pointer get_new_node_for_leaf_insert(const_reference, false_type); inline node_pointer get_new_node_for_leaf_insert(const_reference, true_type); inline void actual_erase_node(node_pointer); inline std::pair<node_pointer, bool> erase(node_pointer); inline void update_min_max_for_erased_node(node_pointer); static void clear_imp(node_pointer); inline std::pair<point_iterator, bool> insert_leaf(const_reference); inline void rotate_left(node_pointer); inline void rotate_right(node_pointer); inline void rotate_parent(node_pointer); inline void apply_update(node_pointer, null_node_update_pointer); template<typename Node_Update_> inline void apply_update(node_pointer, Node_Update_*); inline void update_to_top(node_pointer, null_node_update_pointer); template<typename Node_Update_> inline void update_to_top(node_pointer, Node_Update_*); bool join_prep(PB_DS_CLASS_C_DEC&); void join_finish(PB_DS_CLASS_C_DEC&); bool split_prep(key_const_reference, PB_DS_CLASS_C_DEC&); void split_finish(PB_DS_CLASS_C_DEC&); size_type recursive_count(node_pointer) const; #ifdef _GLIBCXX_DEBUG void assert_valid(const char*, int) const; void structure_only_assert_valid(const char*, int) const; void assert_node_consistent(const node_pointer, const char*, int) const; #endif private: #ifdef _GLIBCXX_DEBUG void assert_iterators(const char*, int) const; void assert_consistent_with_debug_base(const char*, int) const; void assert_node_consistent_with_left(const node_pointer, const char*, int) const; void assert_node_consistent_with_right(const node_pointer, const char*, int) const; void assert_consistent_with_debug_base(const node_pointer, const char*, int) const; void assert_min(const char*, int) const; void assert_min_imp(const node_pointer, const char*, int) const; void assert_max(const char*, int) const; void assert_max_imp(const node_pointer, const char*, int) const; void assert_size(const char*, int) const; typedef std::pair<const_pointer, const_pointer> node_consistent_t; node_consistent_t assert_node_consistent_(const node_pointer, const char*, int) const; #endif void initialize(); node_pointer recursive_copy_node(const node_pointer); protected: node_pointer m_p_head; size_type m_size; static node_allocator s_node_allocator; }; #define PB_DS_STRUCT_ONLY_ASSERT_VALID(X) \ _GLIBCXX_DEBUG_ONLY(X.structure_only_assert_valid(__FILE__, __LINE__);) #define PB_DS_ASSERT_NODE_CONSISTENT(_Node) \ _GLIBCXX_DEBUG_ONLY(assert_node_consistent(_Node, __FILE__, __LINE__);) #include <ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp> #include <ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp> #include <ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp> #include <ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp> #include <ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp> #include <ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp> #include <ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp> #include <ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp> #include <ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp> #include <ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp> #undef PB_DS_ASSERT_NODE_CONSISTENT #undef PB_DS_STRUCT_ONLY_ASSERT_VALID #undef PB_DS_CLASS_C_DEC #undef PB_DS_CLASS_T_DEC #undef PB_DS_BIN_TREE_NAME #undef PB_DS_BIN_TREE_TRAITS_BASE #undef PB_DS_DEBUG_MAP_BASE_C_DEC #ifdef PB_DS_TREE_TRACE #undef PB_DS_TREE_TRACE_BASE_C_DEC #endif } // namespace detail } // namespace __gnu_pbds ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp���������������������������������������0000644�����������������00000005547�14763166030�0017535 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file bin_search_tree_/erase_fn_imps.hpp * Contains an implementation class for bin_search_tree_. */ PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: actual_erase_node(node_pointer p_z) { _GLIBCXX_DEBUG_ASSERT(m_size > 0); --m_size; _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_z->m_value));) p_z->~node(); s_node_allocator.deallocate(p_z, 1); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: update_min_max_for_erased_node(node_pointer p_z) { if (m_size == 1) { m_p_head->m_p_left = m_p_head->m_p_right = m_p_head; return; } if (m_p_head->m_p_left == p_z) { iterator it(p_z); ++it; m_p_head->m_p_left = it.m_p_nd; } else if (m_p_head->m_p_right == p_z) { iterator it(p_z); --it; m_p_head->m_p_right = it.m_p_nd; } } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: clear() { PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) clear_imp(m_p_head->m_p_parent); m_size = 0; initialize(); _GLIBCXX_DEBUG_ONLY(debug_base::clear();) PB_DS_STRUCT_ONLY_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: clear_imp(node_pointer p_nd) { if (p_nd == 0) return; clear_imp(p_nd->m_p_left); clear_imp(p_nd->m_p_right); p_nd->~node(); s_node_allocator.deallocate(p_nd, 1); } ���������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp����������������������������������������0000644�����������������00000004040�14763166030�0017354 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file bin_search_tree_/info_fn_imps.hpp * Contains an implementation class for bin_search_tree_. */ PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: empty() const { return (m_size == 0); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: size() const { return (m_size); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: max_size() const { return (s_node_allocator.max_size()); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp���������������������������������������0000644�����������������00000017607�14763166030�0017524 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file bin_search_tree_/debug_fn_imps.hpp * Contains an implementation class for bin_search_tree_. */ #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_valid(const char* __file, int __line) const { structure_only_assert_valid(__file, __line); assert_consistent_with_debug_base(__file, __line); assert_size(__file, __line); assert_iterators(__file, __line); if (m_p_head->m_p_parent == 0) { PB_DS_DEBUG_VERIFY(m_size == 0); } else { PB_DS_DEBUG_VERIFY(m_size > 0); } } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: structure_only_assert_valid(const char* __file, int __line) const { PB_DS_DEBUG_VERIFY(m_p_head != 0); if (m_p_head->m_p_parent == 0) { PB_DS_DEBUG_VERIFY(m_p_head->m_p_left == m_p_head); PB_DS_DEBUG_VERIFY(m_p_head->m_p_right == m_p_head); } else { PB_DS_DEBUG_VERIFY(m_p_head->m_p_parent->m_p_parent == m_p_head); PB_DS_DEBUG_VERIFY(m_p_head->m_p_left != m_p_head); PB_DS_DEBUG_VERIFY(m_p_head->m_p_right != m_p_head); } if (m_p_head->m_p_parent != 0) assert_node_consistent(m_p_head->m_p_parent, __file, __line); assert_min(__file, __line); assert_max(__file, __line); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_node_consistent(const node_pointer p_nd, const char* __file, int __line) const { assert_node_consistent_(p_nd, __file, __line); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::node_consistent_t PB_DS_CLASS_C_DEC:: assert_node_consistent_(const node_pointer p_nd, const char* __file, int __line) const { if (p_nd == 0) return (std::make_pair((const_pointer)0,(const_pointer)0)); assert_node_consistent_with_left(p_nd, __file, __line); assert_node_consistent_with_right(p_nd, __file, __line); const std::pair<const_pointer, const_pointer> l_range = assert_node_consistent_(p_nd->m_p_left, __file, __line); if (l_range.second != 0) PB_DS_DEBUG_VERIFY(Cmp_Fn::operator()(PB_DS_V2F(*l_range.second), PB_DS_V2F(p_nd->m_value))); const std::pair<const_pointer, const_pointer> r_range = assert_node_consistent_(p_nd->m_p_right, __file, __line); if (r_range.first != 0) PB_DS_DEBUG_VERIFY(Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), PB_DS_V2F(*r_range.first))); return std::make_pair((l_range.first != 0) ? l_range.first : &p_nd->m_value, (r_range.second != 0)? r_range.second : &p_nd->m_value); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_node_consistent_with_left(const node_pointer p_nd, const char* __file, int __line) const { if (p_nd->m_p_left == 0) return; PB_DS_DEBUG_VERIFY(p_nd->m_p_left->m_p_parent == p_nd); PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), PB_DS_V2F(p_nd->m_p_left->m_value))); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_node_consistent_with_right(const node_pointer p_nd, const char* __file, int __line) const { if (p_nd->m_p_right == 0) return; PB_DS_DEBUG_VERIFY(p_nd->m_p_right->m_p_parent == p_nd); PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_p_right->m_value), PB_DS_V2F(p_nd->m_value))); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_min(const char* __file, int __line) const { assert_min_imp(m_p_head->m_p_parent, __file, __line); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_min_imp(const node_pointer p_nd, const char* __file, int __line) const { if (p_nd == 0) { PB_DS_DEBUG_VERIFY(m_p_head->m_p_left == m_p_head); return; } if (p_nd->m_p_left == 0) { PB_DS_DEBUG_VERIFY(p_nd == m_p_head->m_p_left); return; } assert_min_imp(p_nd->m_p_left, __file, __line); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_max(const char* __file, int __line) const { assert_max_imp(m_p_head->m_p_parent, __file, __line); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_max_imp(const node_pointer p_nd, const char* __file, int __line) const { if (p_nd == 0) { PB_DS_DEBUG_VERIFY(m_p_head->m_p_right == m_p_head); return; } if (p_nd->m_p_right == 0) { PB_DS_DEBUG_VERIFY(p_nd == m_p_head->m_p_right); return; } assert_max_imp(p_nd->m_p_right, __file, __line); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_iterators(const char* __file, int __line) const { size_type iterated_num = 0; const_iterator prev_it = end(); for (const_iterator it = begin(); it != end(); ++it) { ++iterated_num; PB_DS_DEBUG_VERIFY(lower_bound(PB_DS_V2F(*it)).m_p_nd == it.m_p_nd); const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*it)); --upper_bound_it; PB_DS_DEBUG_VERIFY(upper_bound_it.m_p_nd == it.m_p_nd); if (prev_it != end()) PB_DS_DEBUG_VERIFY(Cmp_Fn::operator()(PB_DS_V2F(*prev_it), PB_DS_V2F(*it))); prev_it = it; } PB_DS_DEBUG_VERIFY(iterated_num == m_size); size_type reverse_iterated_num = 0; const_reverse_iterator reverse_prev_it = rend(); for (const_reverse_iterator reverse_it = rbegin(); reverse_it != rend(); ++reverse_it) { ++reverse_iterated_num; PB_DS_DEBUG_VERIFY(lower_bound( PB_DS_V2F(*reverse_it)).m_p_nd == reverse_it.m_p_nd); const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*reverse_it)); --upper_bound_it; PB_DS_DEBUG_VERIFY(upper_bound_it.m_p_nd == reverse_it.m_p_nd); if (reverse_prev_it != rend()) PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(PB_DS_V2F(*reverse_prev_it), PB_DS_V2F(*reverse_it))); reverse_prev_it = reverse_it; } PB_DS_DEBUG_VERIFY(reverse_iterated_num == m_size); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_consistent_with_debug_base(const char* __file, int __line) const { debug_base::check_size(m_size, __file, __line); assert_consistent_with_debug_base(m_p_head->m_p_parent, __file, __line); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_consistent_with_debug_base(const node_pointer p_nd, const char* __file, int __line) const { if (p_nd == 0) return; debug_base::check_key_exists(PB_DS_V2F(p_nd->m_value), __file, __line); assert_consistent_with_debug_base(p_nd->m_p_left, __file, __line); assert_consistent_with_debug_base(p_nd->m_p_right, __file, __line); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_size(const char* __file, int __line) const { PB_DS_DEBUG_VERIFY(recursive_count(m_p_head->m_p_parent) == m_size); } #endif �������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp������������������������������0000644�����������������00000014072�14763166030�0021301 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binomial_heap_base_/binomial_heap_base_.hpp * Contains an implementation class for a base of binomial heaps. */ #ifndef PB_DS_BINOMIAL_HEAP_BASE_HPP #define PB_DS_BINOMIAL_HEAP_BASE_HPP /* * Binomial heap base. * Vuillemin J is the mastah. * Modified from CLRS. */ #include <debug/debug.h> #include <ext/pb_ds/detail/cond_dealtor.hpp> #include <ext/pb_ds/detail/type_utils.hpp> #include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp> namespace __gnu_pbds { namespace detail { #define PB_DS_CLASS_T_DEC \ template<typename Value_Type, typename Cmp_Fn, typename _Alloc> #define PB_DS_CLASS_C_DEC \ binomial_heap_base<Value_Type, Cmp_Fn, _Alloc> #ifdef _GLIBCXX_DEBUG #define PB_DS_B_HEAP_BASE \ left_child_next_sibling_heap<Value_Type, Cmp_Fn, \ typename _Alloc::size_type, _Alloc, false> #else #define PB_DS_B_HEAP_BASE \ left_child_next_sibling_heap<Value_Type, Cmp_Fn, \ typename _Alloc::size_type, _Alloc> #endif /// Base class for binomial heap. template<typename Value_Type, typename Cmp_Fn, typename _Alloc> class binomial_heap_base : public PB_DS_B_HEAP_BASE { private: typedef typename _Alloc::template rebind<Value_Type>::other __rebind_v; typedef PB_DS_B_HEAP_BASE base_type; protected: typedef typename base_type::node node; typedef typename base_type::node_pointer node_pointer; typedef typename base_type::node_const_pointer node_const_pointer; public: typedef Value_Type value_type; typedef Cmp_Fn cmp_fn; typedef _Alloc allocator_type; typedef typename _Alloc::size_type size_type; typedef typename _Alloc::difference_type difference_type; typedef typename __rebind_v::pointer pointer; typedef typename __rebind_v::const_pointer const_pointer; typedef typename __rebind_v::reference reference; typedef typename __rebind_v::const_reference const_reference; typedef typename base_type::point_const_iterator point_const_iterator; typedef typename base_type::point_iterator point_iterator; typedef typename base_type::const_iterator const_iterator; typedef typename base_type::iterator iterator; public: inline point_iterator push(const_reference); void modify(point_iterator, const_reference); inline const_reference top() const; void pop(); void erase(point_iterator); inline void clear(); template<typename Pred> size_type erase_if(Pred); template<typename Pred> void split(Pred, PB_DS_CLASS_C_DEC&); void join(PB_DS_CLASS_C_DEC&); protected: binomial_heap_base(); binomial_heap_base(const Cmp_Fn&); binomial_heap_base(const PB_DS_CLASS_C_DEC&); void swap(PB_DS_CLASS_C_DEC&); ~binomial_heap_base(); template<typename It> void copy_from_range(It, It); inline void find_max(); #ifdef _GLIBCXX_DEBUG void assert_valid(bool, const char*, int) const; void assert_max(const char*, int) const; #endif private: inline node_pointer fix(node_pointer) const; inline void insert_node(node_pointer); inline void remove_parentless_node(node_pointer); inline node_pointer join(node_pointer, node_pointer) const; #ifdef _GLIBCXX_DEBUG void assert_node_consistent(node_const_pointer, bool, bool, const char*, int) const; #endif protected: node_pointer m_p_max; }; #define PB_DS_ASSERT_VALID_COND(X, _StrictlyBinomial) \ _GLIBCXX_DEBUG_ONLY(X.assert_valid(_StrictlyBinomial,__FILE__, __LINE__);) #define PB_DS_ASSERT_BASE_NODE_CONSISTENT(_Node, _Bool) \ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(_Node, _Bool, \ __FILE__, __LINE__);) #include <ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp> #include <ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp> #include <ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp> #include <ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp> #include <ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp> #include <ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp> #undef PB_DS_ASSERT_BASE_NODE_CONSISTENT #undef PB_DS_ASSERT_VALID_COND #undef PB_DS_CLASS_C_DEC #undef PB_DS_CLASS_T_DEC #undef PB_DS_B_HEAP_BASE } // namespace detail } // namespace __gnu_pbds #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp������������������0000644�����������������00000005200�14763166030�0024113 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binomial_heap_base_/constructors_destructor_fn_imps.hpp * Contains an implementation class for a base of binomial heaps. */ PB_DS_CLASS_T_DEC template<typename It> void PB_DS_CLASS_C_DEC:: copy_from_range(It first_it, It last_it) { while (first_it != last_it) push(*(first_it++)); PB_DS_ASSERT_VALID_COND((*this),false) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: binomial_heap_base() : m_p_max(0) { PB_DS_ASSERT_VALID_COND((*this),false) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: binomial_heap_base(const Cmp_Fn& r_cmp_fn) : base_type(r_cmp_fn), m_p_max(0) { PB_DS_ASSERT_VALID_COND((*this),false) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: binomial_heap_base(const PB_DS_CLASS_C_DEC& other) : base_type(other), m_p_max(0) { PB_DS_ASSERT_VALID_COND((*this),false) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID_COND((*this),false) base_type::swap(other); std::swap(m_p_max, other.m_p_max); PB_DS_ASSERT_VALID_COND((*this),false) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ~binomial_heap_base() { } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp�����������������������������������0000644�����������������00000012227�14763166030�0020400 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binomial_heap_base_/insert_fn_imps.hpp * Contains an implementation class for a base of binomial heaps. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_iterator PB_DS_CLASS_C_DEC:: push(const_reference r_val) { PB_DS_ASSERT_VALID_COND((*this),true) node_pointer p_nd = base_type::get_new_node_for_insert(r_val); insert_node(p_nd); m_p_max = 0; PB_DS_ASSERT_VALID_COND((*this),true) return point_iterator(p_nd); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: insert_node(node_pointer p_nd) { if (base_type::m_p_root == 0) { p_nd->m_p_next_sibling = 0; p_nd->m_p_prev_or_parent = 0; p_nd->m_p_l_child = 0; p_nd->m_metadata = 0; base_type::m_p_root = p_nd; return; } if (base_type::m_p_root->m_metadata > 0) { p_nd->m_p_prev_or_parent = p_nd->m_p_l_child = 0; p_nd->m_p_next_sibling = base_type::m_p_root; base_type::m_p_root->m_p_prev_or_parent = p_nd; base_type::m_p_root = p_nd; p_nd->m_metadata = 0; return; } if (Cmp_Fn::operator()(base_type::m_p_root->m_value, p_nd->m_value)) { p_nd->m_p_next_sibling = base_type::m_p_root->m_p_next_sibling; p_nd->m_p_prev_or_parent = 0; p_nd->m_metadata = 1; p_nd->m_p_l_child = base_type::m_p_root; base_type::m_p_root->m_p_prev_or_parent = p_nd; base_type::m_p_root->m_p_next_sibling = 0; base_type::m_p_root = p_nd; } else { p_nd->m_p_next_sibling = 0; p_nd->m_p_l_child = 0; p_nd->m_p_prev_or_parent = base_type::m_p_root; p_nd->m_metadata = 0; _GLIBCXX_DEBUG_ASSERT(base_type::m_p_root->m_p_l_child == 0); base_type::m_p_root->m_p_l_child = p_nd; base_type::m_p_root->m_metadata = 1; } base_type::m_p_root = fix(base_type::m_p_root); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: fix(node_pointer p_nd) const { while (p_nd->m_p_next_sibling != 0 && p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata) { node_pointer p_next = p_nd->m_p_next_sibling; if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value)) { p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent; if (p_nd->m_p_prev_or_parent != 0) p_nd->m_p_prev_or_parent->m_p_next_sibling = p_next; base_type::make_child_of(p_nd, p_next); ++p_next->m_metadata; p_nd = p_next; } else { p_nd->m_p_next_sibling = p_next->m_p_next_sibling; if (p_nd->m_p_next_sibling != 0) p_next->m_p_next_sibling = 0; base_type::make_child_of(p_next, p_nd); ++p_nd->m_metadata; } } if (p_nd->m_p_next_sibling != 0) p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd; return p_nd; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: modify(point_iterator it, const_reference r_new_val) { PB_DS_ASSERT_VALID_COND((*this),true) node_pointer p_nd = it.m_p_nd; _GLIBCXX_DEBUG_ASSERT(p_nd != 0); PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_nd, false) const bool bubble_up = Cmp_Fn::operator()(p_nd->m_value, r_new_val); p_nd->m_value = r_new_val; if (bubble_up) { node_pointer p_parent = base_type::parent(p_nd); while (p_parent != 0 && Cmp_Fn::operator()(p_parent->m_value, p_nd->m_value)) { base_type::swap_with_parent(p_nd, p_parent); p_parent = base_type::parent(p_nd); } if (p_nd->m_p_prev_or_parent == 0) base_type::m_p_root = p_nd; m_p_max = 0; PB_DS_ASSERT_VALID_COND((*this),true) return; } base_type::bubble_to_top(p_nd); remove_parentless_node(p_nd); insert_node(p_nd); m_p_max = 0; PB_DS_ASSERT_VALID_COND((*this),true) } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp�������������������������������0000644�����������������00000012365�14763166030�0021251 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binomial_heap_base_/split_join_fn_imps.hpp * Contains an implementation class for a base of binomial heaps. */ PB_DS_CLASS_T_DEC template<typename Pred> void PB_DS_CLASS_C_DEC:: split(Pred pred, PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID_COND((*this),true) PB_DS_ASSERT_VALID_COND(other,true) other.clear(); if (base_type::empty()) { PB_DS_ASSERT_VALID_COND((*this),true) PB_DS_ASSERT_VALID_COND(other,true) return; } base_type::to_linked_list(); node_pointer p_out = base_type::prune(pred); while (p_out != 0) { _GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0); --base_type::m_size; ++other.m_size; node_pointer p_next = p_out->m_p_next_sibling; p_out->m_p_l_child = p_out->m_p_prev_or_parent = 0; p_out->m_metadata = 0; p_out->m_p_next_sibling = other.m_p_root; if (other.m_p_root != 0) other.m_p_root->m_p_prev_or_parent = p_out; other.m_p_root = p_out; other.m_p_root = other.fix(other.m_p_root); p_out = p_next; } PB_DS_ASSERT_VALID_COND(other,true) node_pointer p_cur = base_type::m_p_root; base_type::m_p_root = 0; while (p_cur != 0) { node_pointer p_next = p_cur->m_p_next_sibling; p_cur->m_p_l_child = p_cur->m_p_prev_or_parent = 0; p_cur->m_metadata = 0; p_cur->m_p_next_sibling = base_type::m_p_root; if (base_type::m_p_root != 0) base_type::m_p_root->m_p_prev_or_parent = p_cur; base_type::m_p_root = p_cur; base_type::m_p_root = fix(base_type::m_p_root); p_cur = p_next; } m_p_max = 0; PB_DS_ASSERT_VALID_COND((*this),true) PB_DS_ASSERT_VALID_COND(other,true) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: join(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID_COND((*this),true) PB_DS_ASSERT_VALID_COND(other,true) node_pointer p_other = other.m_p_root; if (p_other != 0) do { node_pointer p_next = p_other->m_p_next_sibling; std::swap(p_other->m_p_next_sibling, p_other->m_p_prev_or_parent); p_other = p_next; } while (p_other != 0); base_type::m_p_root = join(base_type::m_p_root, other.m_p_root); base_type::m_size += other.m_size; m_p_max = 0; other.m_p_root = 0; other.m_size = 0; other.m_p_max = 0; PB_DS_ASSERT_VALID_COND((*this),true) PB_DS_ASSERT_VALID_COND(other,true) } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::node_pointer PB_DS_CLASS_C_DEC:: join(node_pointer p_lhs, node_pointer p_rhs) const { node_pointer p_ret = 0; node_pointer p_cur = 0; while (p_lhs != 0 || p_rhs != 0) { if (p_rhs == 0) { if (p_cur == 0) p_ret = p_cur = p_lhs; else { p_cur->m_p_next_sibling = p_lhs; p_lhs->m_p_prev_or_parent = p_cur; } p_cur = p_lhs = 0; } else if (p_lhs == 0 || p_rhs->m_metadata < p_lhs->m_metadata) { if (p_cur == 0) { p_ret = p_cur = p_rhs; p_rhs = p_rhs->m_p_prev_or_parent; } else { p_cur->m_p_next_sibling = p_rhs; p_rhs = p_rhs->m_p_prev_or_parent; p_cur->m_p_next_sibling->m_p_prev_or_parent = p_cur; p_cur = p_cur->m_p_next_sibling; } } else if (p_lhs->m_metadata < p_rhs->m_metadata) { if (p_cur == 0) p_ret = p_cur = p_lhs; else { p_cur->m_p_next_sibling = p_lhs; p_lhs->m_p_prev_or_parent = p_cur; p_cur = p_cur->m_p_next_sibling; } p_lhs = p_cur->m_p_next_sibling; } else { node_pointer p_next_rhs = p_rhs->m_p_prev_or_parent; p_rhs->m_p_next_sibling = p_lhs; p_lhs = fix(p_rhs); p_rhs = p_next_rhs; } } if (p_cur != 0) p_cur->m_p_next_sibling = 0; if (p_ret != 0) p_ret->m_p_prev_or_parent = 0; return p_ret; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp�������������������������������������0000644�����������������00000004451�14763166030�0020014 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binomial_heap_base_/find_fn_imps.hpp * Contains an implementation class for a base of binomial heaps. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_reference PB_DS_CLASS_C_DEC:: top() const { PB_DS_ASSERT_VALID_COND((*this),false) _GLIBCXX_DEBUG_ASSERT(!base_type::empty()); if (m_p_max == 0) const_cast<PB_DS_CLASS_C_DEC* >(this)->find_max(); _GLIBCXX_DEBUG_ASSERT(m_p_max != 0); return m_p_max->m_value; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: find_max() { node_pointer p_cur = base_type::m_p_root; m_p_max = p_cur; while (p_cur != 0) { if (Cmp_Fn::operator()(m_p_max->m_value, p_cur->m_value)) m_p_max = p_cur; p_cur = p_cur->m_p_next_sibling; } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp������������������������������������0000644�����������������00000010602�14763166030�0020166 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binomial_heap_base_/erase_fn_imps.hpp * Contains an implementation class for a base of binomial heaps. */ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: pop() { PB_DS_ASSERT_VALID_COND((*this),true) _GLIBCXX_DEBUG_ASSERT(!base_type::empty()); if (m_p_max == 0) find_max(); _GLIBCXX_DEBUG_ASSERT(m_p_max != 0); node_pointer p_nd = m_p_max; remove_parentless_node(m_p_max); base_type::actual_erase_node(p_nd); m_p_max = 0; PB_DS_ASSERT_VALID_COND((*this),true) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: remove_parentless_node(node_pointer p_nd) { _GLIBCXX_DEBUG_ASSERT(p_nd != 0); _GLIBCXX_DEBUG_ASSERT(base_type::parent(p_nd) == 0); node_pointer p_cur_root = p_nd == base_type::m_p_root? p_nd->m_p_next_sibling : base_type::m_p_root; if (p_cur_root != 0) p_cur_root->m_p_prev_or_parent = 0; if (p_nd->m_p_prev_or_parent != 0) p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd->m_p_next_sibling; if (p_nd->m_p_next_sibling != 0) p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_prev_or_parent; node_pointer p_child = p_nd->m_p_l_child; if (p_child != 0) { p_child->m_p_prev_or_parent = 0; while (p_child->m_p_next_sibling != 0) p_child = p_child->m_p_next_sibling; } m_p_max = 0; base_type::m_p_root = join(p_cur_root, p_child); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: clear() { base_type::clear(); m_p_max = 0; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: erase(point_iterator it) { PB_DS_ASSERT_VALID_COND((*this),true) _GLIBCXX_DEBUG_ASSERT(!base_type::empty()); base_type::bubble_to_top(it.m_p_nd); remove_parentless_node(it.m_p_nd); base_type::actual_erase_node(it.m_p_nd); m_p_max = 0; PB_DS_ASSERT_VALID_COND((*this),true) } PB_DS_CLASS_T_DEC template<typename Pred> typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: erase_if(Pred pred) { PB_DS_ASSERT_VALID_COND((*this),true) if (base_type::empty()) { PB_DS_ASSERT_VALID_COND((*this),true) return 0; } base_type::to_linked_list(); node_pointer p_out = base_type::prune(pred); size_type ersd = 0; while (p_out != 0) { ++ersd; node_pointer p_next = p_out->m_p_next_sibling; base_type::actual_erase_node(p_out); p_out = p_next; } node_pointer p_cur = base_type::m_p_root; base_type::m_p_root = 0; while (p_cur != 0) { node_pointer p_next = p_cur->m_p_next_sibling; p_cur->m_p_l_child = p_cur->m_p_prev_or_parent = 0; p_cur->m_metadata = 0; p_cur->m_p_next_sibling = base_type::m_p_root; if (base_type::m_p_root != 0) base_type::m_p_root->m_p_prev_or_parent = p_cur; base_type::m_p_root = p_cur; base_type::m_p_root = fix(base_type::m_p_root); p_cur = p_next; } m_p_max = 0; PB_DS_ASSERT_VALID_COND((*this),true) return ersd; } ������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp������������������������������������0000644�����������������00000006614�14763166030�0020165 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binomial_heap_base_/debug_fn_imps.hpp * Contains an implementation class for a base of binomial heaps. */ #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_valid(bool strictly_binomial, const char* __file, int __line) const { base_type::assert_valid(__file, __line); assert_node_consistent(base_type::m_p_root, strictly_binomial, true, __file, __line); assert_max(__file, __line); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_max(const char* __file, int __line) const { if (m_p_max == 0) return; PB_DS_DEBUG_VERIFY(base_type::parent(m_p_max) == 0); for (const_iterator it = base_type::begin(); it != base_type::end(); ++it) PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(m_p_max->m_value, it.m_p_nd->m_value)); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_node_consistent(node_const_pointer p_nd, bool strictly_binomial, bool increasing, const char* __file, int __line) const { PB_DS_DEBUG_VERIFY(increasing || strictly_binomial); base_type::assert_node_consistent(p_nd, false, __file, __line); if (p_nd == 0) return; PB_DS_DEBUG_VERIFY(p_nd->m_metadata == base_type::degree(p_nd)); PB_DS_DEBUG_VERIFY(base_type::size_under_node(p_nd) == static_cast<size_type>(1 << p_nd->m_metadata)); assert_node_consistent(p_nd->m_p_next_sibling, strictly_binomial, increasing, __file, __line); assert_node_consistent(p_nd->m_p_l_child, true, false, __file, __line); if (p_nd->m_p_next_sibling != 0) { if (increasing) { if (strictly_binomial) PB_DS_DEBUG_VERIFY(p_nd->m_metadata < p_nd->m_p_next_sibling->m_metadata); else PB_DS_DEBUG_VERIFY(p_nd->m_metadata <= p_nd->m_p_next_sibling->m_metadata); } else PB_DS_DEBUG_VERIFY(p_nd->m_metadata > p_nd->m_p_next_sibling->m_metadata); } } #endif ��������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp������������������������������������0000644�����������������00000010537�14763166030�0020333 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binary_heap_/point_const_iterator.hpp * Contains an iterator class returned by the table's const find and insert * methods. */ #ifndef PB_DS_BINARY_HEAP_CONST_FIND_ITERATOR_HPP #define PB_DS_BINARY_HEAP_CONST_FIND_ITERATOR_HPP #include <ext/pb_ds/tag_and_trait.hpp> #include <debug/debug.h> namespace __gnu_pbds { namespace detail { /// Const point-type iterator. template<typename Value_Type, typename Entry, bool Simple, typename _Alloc> class binary_heap_point_const_iterator_ { protected: typedef typename _Alloc::template rebind<Entry>::other::pointer entry_pointer; public: /// Category. typedef trivial_iterator_tag iterator_category; /// Difference type. typedef trivial_iterator_difference_type difference_type; /// Iterator's value type. typedef Value_Type value_type; /// Iterator's pointer type. typedef typename _Alloc::template rebind<value_type>::other::pointer pointer; /// Iterator's const pointer type. typedef typename _Alloc::template rebind<value_type>::other::const_pointer const_pointer; /// Iterator's reference type. typedef typename _Alloc::template rebind<value_type>::other::reference reference; /// Iterator's const reference type. typedef typename _Alloc::template rebind<value_type>::other::const_reference const_reference; inline binary_heap_point_const_iterator_(entry_pointer p_e) : m_p_e(p_e) { } /// Default constructor. inline binary_heap_point_const_iterator_() : m_p_e(0) { } /// Copy constructor. inline binary_heap_point_const_iterator_(const binary_heap_point_const_iterator_& other) : m_p_e(other.m_p_e) { } /// Access. inline const_pointer operator->() const { _GLIBCXX_DEBUG_ASSERT(m_p_e != 0); return to_ptr(integral_constant<int, Simple>()); } /// Access. inline const_reference operator*() const { _GLIBCXX_DEBUG_ASSERT(m_p_e != 0); return *to_ptr(integral_constant<int, Simple>()); } /// Compares content to a different iterator object. inline bool operator==(const binary_heap_point_const_iterator_& other) const { return m_p_e == other.m_p_e; } /// Compares content (negatively) to a different iterator object. inline bool operator!=(const binary_heap_point_const_iterator_& other) const { return m_p_e != other.m_p_e; } private: inline const_pointer to_ptr(true_type) const { return m_p_e; } inline const_pointer to_ptr(false_type) const { return *m_p_e; } public: entry_pointer m_p_e; }; } // namespace detail } // namespace __gnu_pbds #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp�������������������������0000644�����������������00000010135�14763166030�0022616 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binary_heap_/constructors_destructor_fn_imps.hpp * Contains an implementation class for binary_heap_. */ PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::entry_allocator PB_DS_CLASS_C_DEC::s_entry_allocator; PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::value_allocator PB_DS_CLASS_C_DEC::s_value_allocator; PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::no_throw_copies_t PB_DS_CLASS_C_DEC::s_no_throw_copies_ind; PB_DS_CLASS_T_DEC template<typename It> void PB_DS_CLASS_C_DEC:: copy_from_range(It first_it, It last_it) { while (first_it != last_it) { insert_value(*first_it, s_no_throw_copies_ind); ++first_it; } make_heap(); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: binary_heap() : m_size(0), m_actual_size(resize_policy::min_size), m_a_entries(s_entry_allocator.allocate(m_actual_size)) { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: binary_heap(const Cmp_Fn& r_cmp_fn) : entry_cmp(r_cmp_fn), m_size(0), m_actual_size(resize_policy::min_size), m_a_entries(s_entry_allocator.allocate(m_actual_size)) { PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: binary_heap(const PB_DS_CLASS_C_DEC& other) : entry_cmp(other), resize_policy(other), m_size(0), m_actual_size(other.m_actual_size), m_a_entries(s_entry_allocator.allocate(m_actual_size)) { PB_DS_ASSERT_VALID(other) _GLIBCXX_DEBUG_ASSERT(m_a_entries != other.m_a_entries); __try { copy_from_range(other.begin(), other.end()); } __catch(...) { for (size_type i = 0; i < m_size; ++i) erase_at(m_a_entries, i, s_no_throw_copies_ind); s_entry_allocator.deallocate(m_a_entries, m_actual_size); __throw_exception_again; } PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) _GLIBCXX_DEBUG_ASSERT(m_a_entries != other.m_a_entries); value_swap(other); std::swap((entry_cmp&)(*this), (entry_cmp&)other); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: value_swap(PB_DS_CLASS_C_DEC& other) { std::swap(m_a_entries, other.m_a_entries); std::swap(m_size, other.m_size); std::swap(m_actual_size, other.m_actual_size); static_cast<resize_policy*>(this)->swap(other); } PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: ~binary_heap() { for (size_type i = 0; i < m_size; ++i) erase_at(m_a_entries, i, s_no_throw_copies_ind); s_entry_allocator.deallocate(m_a_entries, m_actual_size); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp������������������������������������������0000644�����������������00000011626�14763166030�0017102 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binary_heap_/insert_fn_imps.hpp * Contains an implementation class for a binary_heap. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_iterator PB_DS_CLASS_C_DEC:: push(const_reference r_val) { PB_DS_ASSERT_VALID((*this)) insert_value(r_val, s_no_throw_copies_ind); push_heap(); PB_DS_ASSERT_VALID((*this)) return point_iterator(m_a_entries); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: insert_value(value_type val, true_type) { resize_for_insert_if_needed(); m_a_entries[m_size++] = val; } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: insert_value(const_reference r_val, false_type) { resize_for_insert_if_needed(); pointer p_new = s_value_allocator.allocate(1); cond_dealtor_t cond(p_new); new (p_new) value_type(r_val); cond.set_no_action(); m_a_entries[m_size++] = p_new; } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: resize_for_insert_if_needed() { if (!resize_policy::resize_needed_for_grow(m_size)) { _GLIBCXX_DEBUG_ASSERT(m_size < m_actual_size); return; } const size_type new_size = resize_policy::get_new_size_for_grow(); entry_pointer new_entries = s_entry_allocator.allocate(new_size); resize_policy::notify_grow_resize(); std::copy(m_a_entries, m_a_entries + m_size, new_entries); s_entry_allocator.deallocate(m_a_entries, m_actual_size); m_actual_size = new_size; m_a_entries = new_entries; make_heap(); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: modify(point_iterator it, const_reference r_new_val) { PB_DS_ASSERT_VALID((*this)) swap_value_imp(it.m_p_e, r_new_val, s_no_throw_copies_ind); fix(it.m_p_e); PB_DS_ASSERT_VALID((*this)) _GLIBCXX_DEBUG_ASSERT(is_heap()); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: fix(entry_pointer p_e) { size_type i = p_e - m_a_entries; if (i > 0 && entry_cmp::operator()(m_a_entries[parent(i)], m_a_entries[i])) { size_type parent_i = parent(i); while (i > 0 && entry_cmp::operator()(m_a_entries[parent_i], m_a_entries[i])) { std::swap(m_a_entries[i], m_a_entries[parent_i]); i = parent_i; parent_i = parent(i); } PB_DS_ASSERT_VALID((*this)) return; } while (i < m_size) { const size_type lchild_i = left_child(i); const size_type rchild_i = right_child(i); _GLIBCXX_DEBUG_ASSERT(rchild_i > lchild_i); const bool smaller_than_lchild = lchild_i < m_size && entry_cmp::operator()(m_a_entries[i], m_a_entries[lchild_i]); const bool smaller_than_rchild = rchild_i < m_size && entry_cmp::operator()(m_a_entries[i], m_a_entries[rchild_i]); const bool swap_with_rchild = smaller_than_rchild && (!smaller_than_lchild || entry_cmp::operator()(m_a_entries[lchild_i], m_a_entries[rchild_i])); const bool swap_with_lchild = !swap_with_rchild && smaller_than_lchild; if (swap_with_lchild) { std::swap(m_a_entries[i], m_a_entries[lchild_i]); i = lchild_i; } else if (swap_with_rchild) { std::swap(m_a_entries[i], m_a_entries[rchild_i]); i = rchild_i; } else i = m_size; } } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: swap_value_imp(entry_pointer p_e, value_type new_val, true_type) { *p_e = new_val; } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: swap_value_imp(entry_pointer p_e, const_reference r_new_val, false_type) { value_type tmp(r_new_val); (*p_e)->swap(tmp); } ����������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp���������������������������������������0000644�����������������00000004336�14763166030�0017612 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binary_heap_/iterators_fn_imps.hpp * Contains an implementation class for a binary_heap. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: begin() { return iterator(m_a_entries); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: begin() const { return const_iterator(m_a_entries); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::iterator PB_DS_CLASS_C_DEC:: end() { return iterator(m_a_entries + m_size); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_iterator PB_DS_CLASS_C_DEC:: end() const { return const_iterator(m_a_entries + m_size); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binary_heap_/const_iterator.hpp������������������������������������������0000644�����������������00000010362�14763166030�0017116 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binary_heap_/const_iterator.hpp * Contains an iterator class returned by the table's const find and insert * methods. */ #ifndef PB_DS_BINARY_HEAP_CONST_ITERATOR_HPP #define PB_DS_BINARY_HEAP_CONST_ITERATOR_HPP #include <ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp> #include <debug/debug.h> namespace __gnu_pbds { namespace detail { #define PB_DS_BIN_HEAP_CIT_BASE \ binary_heap_point_const_iterator_<Value_Type, Entry, Simple, _Alloc> /// Const point-type iterator. template<typename Value_Type, typename Entry, bool Simple, typename _Alloc> class binary_heap_const_iterator_ : public PB_DS_BIN_HEAP_CIT_BASE { private: typedef PB_DS_BIN_HEAP_CIT_BASE base_type; typedef typename base_type::entry_pointer entry_pointer; public: /// Category. typedef std::forward_iterator_tag iterator_category; /// Difference type. typedef typename _Alloc::difference_type difference_type; /// Iterator's value type. typedef typename base_type::value_type value_type; /// Iterator's pointer type. typedef typename base_type::pointer pointer; /// Iterator's const pointer type. typedef typename base_type::const_pointer const_pointer; /// Iterator's reference type. typedef typename base_type::reference reference; /// Iterator's const reference type. typedef typename base_type::const_reference const_reference; inline binary_heap_const_iterator_(entry_pointer p_e) : base_type(p_e) { } /// Default constructor. inline binary_heap_const_iterator_() { } /// Copy constructor. inline binary_heap_const_iterator_(const binary_heap_const_iterator_& other) : base_type(other) { } /// Compares content to a different iterator object. inline bool operator==(const binary_heap_const_iterator_& other) const { return base_type::m_p_e == other.m_p_e; } /// Compares content (negatively) to a different iterator object. inline bool operator!=(const binary_heap_const_iterator_& other) const { return base_type::m_p_e != other.m_p_e; } inline binary_heap_const_iterator_& operator++() { _GLIBCXX_DEBUG_ASSERT(base_type::m_p_e != 0); inc(); return *this; } inline binary_heap_const_iterator_ operator++(int) { binary_heap_const_iterator_ ret_it(base_type::m_p_e); operator++(); return ret_it; } private: void inc() { ++base_type::m_p_e; } }; #undef PB_DS_BIN_HEAP_CIT_BASE } // namespace detail } // namespace __gnu_pbds #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binary_heap_/resize_policy.hpp�������������������������������������������0000644�����������������00000013765�14763166030�0016751 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binary_heap_/resize_policy.hpp * Contains an implementation class for a binary_heap. */ #ifndef PB_DS_BINARY_HEAP_RESIZE_POLICY_HPP #define PB_DS_BINARY_HEAP_RESIZE_POLICY_HPP #include <debug/debug.h> namespace __gnu_pbds { namespace detail { /// Resize policy for binary heap. template<typename _Tp> class resize_policy { private: enum { ratio = 8, factor = 2 }; /// Next shrink size. _Tp m_shrink_size; /// Next grow size. _Tp m_grow_size; public: typedef _Tp size_type; static const _Tp min_size = 16; resize_policy() : m_shrink_size(0), m_grow_size(min_size) { PB_DS_ASSERT_VALID((*this)) } resize_policy(const resize_policy& other) : m_shrink_size(other.m_shrink_size), m_grow_size(other.m_grow_size) { PB_DS_ASSERT_VALID((*this)) } inline void swap(resize_policy<_Tp>&); inline bool resize_needed_for_grow(size_type) const; inline bool resize_needed_for_shrink(size_type) const; inline bool grow_needed(size_type) const; inline bool shrink_needed(size_type) const; inline size_type get_new_size_for_grow() const; inline size_type get_new_size_for_shrink() const; inline size_type get_new_size_for_arbitrary(size_type) const; inline void notify_grow_resize(); inline void notify_shrink_resize(); void notify_arbitrary(size_type); #ifdef _GLIBCXX_DEBUG void assert_valid(const char*, int) const; #endif #ifdef PB_DS_BINARY_HEAP_TRACE_ void trace() const; #endif }; template<typename _Tp> const _Tp resize_policy<_Tp>::min_size; template<typename _Tp> inline void resize_policy<_Tp>:: swap(resize_policy<_Tp>& other) { std::swap(m_shrink_size, other.m_shrink_size); std::swap(m_grow_size, other.m_grow_size); } template<typename _Tp> inline bool resize_policy<_Tp>:: resize_needed_for_grow(size_type size) const { _GLIBCXX_DEBUG_ASSERT(size <= m_grow_size); return size == m_grow_size; } template<typename _Tp> inline bool resize_policy<_Tp>:: resize_needed_for_shrink(size_type size) const { _GLIBCXX_DEBUG_ASSERT(size <= m_grow_size); return size == m_shrink_size; } template<typename _Tp> inline typename resize_policy<_Tp>::size_type resize_policy<_Tp>:: get_new_size_for_grow() const { return m_grow_size * factor; } template<typename _Tp> inline typename resize_policy<_Tp>::size_type resize_policy<_Tp>:: get_new_size_for_shrink() const { const size_type half_size = m_grow_size / factor; return std::max(min_size, half_size); } template<typename _Tp> inline typename resize_policy<_Tp>::size_type resize_policy<_Tp>:: get_new_size_for_arbitrary(size_type size) const { size_type ret = min_size; while (ret < size) ret *= factor; return ret; } template<typename _Tp> inline void resize_policy<_Tp>:: notify_grow_resize() { PB_DS_ASSERT_VALID((*this)) _GLIBCXX_DEBUG_ASSERT(m_grow_size >= min_size); m_grow_size *= factor; m_shrink_size = m_grow_size / ratio; PB_DS_ASSERT_VALID((*this)) } template<typename _Tp> inline void resize_policy<_Tp>:: notify_shrink_resize() { PB_DS_ASSERT_VALID((*this)) m_shrink_size /= factor; if (m_shrink_size == 1) m_shrink_size = 0; m_grow_size = std::max(m_grow_size / factor, min_size); PB_DS_ASSERT_VALID((*this)) } template<typename _Tp> inline void resize_policy<_Tp>:: notify_arbitrary(size_type actual_size) { m_grow_size = actual_size; m_shrink_size = m_grow_size / ratio; PB_DS_ASSERT_VALID((*this)) } #ifdef _GLIBCXX_DEBUG template<typename _Tp> void resize_policy<_Tp>:: assert_valid(const char* __file, int __line) const { PB_DS_DEBUG_VERIFY(m_shrink_size == 0 || m_shrink_size * ratio == m_grow_size); PB_DS_DEBUG_VERIFY(m_grow_size >= min_size); } #endif #ifdef PB_DS_BINARY_HEAP_TRACE_ template<typename _Tp> void resize_policy<_Tp>:: trace() const { std::cerr << "shrink = " << m_shrink_size << " grow = " << m_grow_size << std::endl; } #endif } // namespace detail } // namespace __gnu_pbds #endif �����������c++/4.8.2/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp��������������������������������������0000644�����������������00000011473�14763166030�0017750 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binary_heap_/split_join_fn_imps.hpp * Contains an implementation class for a binary_heap. */ PB_DS_CLASS_T_DEC template<typename Pred> void PB_DS_CLASS_C_DEC:: split(Pred pred, PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) typedef typename entry_pred<value_type, Pred, _Alloc, simple_value>::type pred_t; const size_type left = partition(pred_t(pred)); _GLIBCXX_DEBUG_ASSERT(m_size >= left); const size_type ersd = m_size - left; _GLIBCXX_DEBUG_ASSERT(m_size >= ersd); const size_type new_size = resize_policy::get_new_size_for_arbitrary(left); const size_type other_actual_size = other.get_new_size_for_arbitrary(ersd); entry_pointer a_entries = 0; entry_pointer a_other_entries = 0; __try { a_entries = s_entry_allocator.allocate(new_size); a_other_entries = s_entry_allocator.allocate(other_actual_size); } __catch(...) { if (a_entries != 0) s_entry_allocator.deallocate(a_entries, new_size); if (a_other_entries != 0) s_entry_allocator.deallocate(a_other_entries, other_actual_size); __throw_exception_again; }; for (size_type i = 0; i < other.m_size; ++i) erase_at(other.m_a_entries, i, s_no_throw_copies_ind); _GLIBCXX_DEBUG_ASSERT(new_size >= left); std::copy(m_a_entries, m_a_entries + left, a_entries); std::copy(m_a_entries + left, m_a_entries + m_size, a_other_entries); s_entry_allocator.deallocate(m_a_entries, m_actual_size); s_entry_allocator.deallocate(other.m_a_entries, other.m_actual_size); m_actual_size = new_size; other.m_actual_size = other_actual_size; m_size = left; other.m_size = ersd; m_a_entries = a_entries; other.m_a_entries = a_other_entries; make_heap(); other.make_heap(); resize_policy::notify_arbitrary(m_actual_size); other.notify_arbitrary(other.m_actual_size); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: join(PB_DS_CLASS_C_DEC& other) { PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) const size_type len = m_size + other.m_size; const size_type new_size = resize_policy::get_new_size_for_arbitrary(len); entry_pointer a_entries = 0; entry_pointer a_other_entries = 0; __try { a_entries = s_entry_allocator.allocate(new_size); a_other_entries = s_entry_allocator.allocate(resize_policy::min_size); } __catch(...) { if (a_entries != 0) s_entry_allocator.deallocate(a_entries, new_size); if (a_other_entries != 0) s_entry_allocator.deallocate(a_other_entries, resize_policy::min_size); __throw_exception_again; } std::copy(m_a_entries, m_a_entries + m_size, a_entries); std::copy(other.m_a_entries, other.m_a_entries + other.m_size, a_entries + m_size); s_entry_allocator.deallocate(m_a_entries, m_actual_size); m_a_entries = a_entries; m_size = len; m_actual_size = new_size; resize_policy::notify_arbitrary(new_size); make_heap(); s_entry_allocator.deallocate(other.m_a_entries, other.m_actual_size); other.m_a_entries = a_other_entries; other.m_size = 0; other.m_actual_size = resize_policy::min_size; other.notify_arbitrary(resize_policy::min_size); other.make_heap(); PB_DS_ASSERT_VALID((*this)) PB_DS_ASSERT_VALID(other) } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binary_heap_/entry_pred.hpp����������������������������������������������0000644�����������������00000005341�14763166030�0016233 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binary_heap_/entry_pred.hpp * Contains an implementation class for a binary_heap. */ #ifndef PB_DS_BINARY_HEAP_ENTRY_PRED_HPP #define PB_DS_BINARY_HEAP_ENTRY_PRED_HPP namespace __gnu_pbds { namespace detail { /// Entry predicate primary class template. template<typename _VTp, typename Pred, typename _Alloc, bool No_Throw> struct entry_pred; /// Specialization, true. template<typename _VTp, typename Pred, typename _Alloc> struct entry_pred<_VTp, Pred, _Alloc, true> { typedef Pred type; }; /// Specialization, false. template<typename _VTp, typename Pred, typename _Alloc> struct entry_pred<_VTp, Pred, _Alloc, false> { private: typedef typename _Alloc::template rebind<_VTp> __rebind_v; public: typedef typename __rebind_v::other::const_pointer entry; struct type : public Pred { inline type() { } inline type(const Pred& other) : Pred(other) { } inline bool operator()(entry p_v) const { return Pred::operator()(*p_v); } }; }; } // namespace detail } // namespace __gnu_pbds #endif // #ifndef PB_DS_BINARY_HEAP_ENTRY_PRED_HPP �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp��������������������������������������������0000644�����������������00000005045�14763166030�0016514 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binary_heap_/find_fn_imps.hpp * Contains an implementation class for a binary_heap. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_reference PB_DS_CLASS_C_DEC:: top() const { PB_DS_ASSERT_VALID((*this)) _GLIBCXX_DEBUG_ASSERT(!empty()); return top_imp(s_no_throw_copies_ind); } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_reference PB_DS_CLASS_C_DEC:: top_imp(true_type) const { return *m_a_entries; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::const_reference PB_DS_CLASS_C_DEC:: top_imp(false_type) const { return **m_a_entries; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: left_child(size_type i) { return i * 2 + 1; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: right_child(size_type i) { return i * 2 + 2; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: parent(size_type i) { return (i - 1) / 2; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp�����������������������������������������������0000644�����������������00000005404�14763166030�0016060 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binary_heap_/entry_cmp.hpp * Contains an implementation class for a binary_heap. */ #ifndef PB_DS_BINARY_HEAP_ENTRY_CMP_HPP #define PB_DS_BINARY_HEAP_ENTRY_CMP_HPP namespace __gnu_pbds { namespace detail { /// Entry compare, primary template. template<typename _VTp, typename Cmp_Fn, typename _Alloc, bool No_Throw> struct entry_cmp; /// Specialization, true. template<typename _VTp, typename Cmp_Fn, typename _Alloc> struct entry_cmp<_VTp, Cmp_Fn, _Alloc, true> { /// Compare. typedef Cmp_Fn type; }; /// Specialization, false. template<typename _VTp, typename Cmp_Fn, typename _Alloc> struct entry_cmp<_VTp, Cmp_Fn, _Alloc, false> { private: typedef typename _Alloc::template rebind<_VTp> __rebind_v; public: typedef typename __rebind_v::other::const_pointer entry; /// Compare plus entry. struct type : public Cmp_Fn { type() { } type(const Cmp_Fn& other) : Cmp_Fn(other) { } bool operator()(entry lhs, entry rhs) const { return Cmp_Fn::operator()(*lhs, *rhs); } }; }; } // namespace detail } // namespace __gnu_pbds #endif // #ifndef PB_DS_BINARY_HEAP_ENTRY_CMP_HPP ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp�����������������������������������0000644�����������������00000003556�14763166030�0020421 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binary_heap_/policy_access_fn_imps.hpp * Contains an implementation class for a binary_heap. */ PB_DS_CLASS_T_DEC Cmp_Fn& PB_DS_CLASS_C_DEC:: get_cmp_fn() { return (*this); } PB_DS_CLASS_T_DEC const Cmp_Fn& PB_DS_CLASS_C_DEC:: get_cmp_fn() const { return (*this); } ��������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp��������������������������������������������0000644�����������������00000022141�14763166030�0016475 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binary_heap_/binary_heap_.hpp * Contains an implementation class for a binary heap. */ #ifndef PB_DS_BINARY_HEAP_HPP #define PB_DS_BINARY_HEAP_HPP #include <queue> #include <algorithm> #include <ext/pb_ds/detail/cond_dealtor.hpp> #include <ext/pb_ds/detail/cond_dealtor.hpp> #include <ext/pb_ds/detail/type_utils.hpp> #include <ext/pb_ds/detail/binary_heap_/entry_cmp.hpp> #include <ext/pb_ds/detail/binary_heap_/entry_pred.hpp> #include <ext/pb_ds/detail/binary_heap_/resize_policy.hpp> #include <ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp> #include <ext/pb_ds/detail/binary_heap_/const_iterator.hpp> #ifdef PB_DS_BINARY_HEAP_TRACE_ #include <iostream> #endif #include <ext/pb_ds/detail/type_utils.hpp> #include <debug/debug.h> namespace __gnu_pbds { namespace detail { #define PB_DS_CLASS_T_DEC \ template<typename Value_Type, typename Cmp_Fn, typename _Alloc> #define PB_DS_CLASS_C_DEC \ binary_heap<Value_Type, Cmp_Fn, _Alloc> #define PB_DS_ENTRY_CMP_DEC \ entry_cmp<Value_Type, Cmp_Fn, _Alloc, is_simple<Value_Type>::value>::type #define PB_DS_RESIZE_POLICY_DEC \ __gnu_pbds::detail::resize_policy<typename _Alloc::size_type> /** * Binary heaps composed of resize and compare policies. * * @ingroup heap-detail * * Based on CLRS. */ template<typename Value_Type, typename Cmp_Fn, typename _Alloc> class binary_heap : public PB_DS_ENTRY_CMP_DEC, public PB_DS_RESIZE_POLICY_DEC { public: typedef Value_Type value_type; typedef Cmp_Fn cmp_fn; typedef _Alloc allocator_type; typedef typename _Alloc::size_type size_type; typedef typename _Alloc::difference_type difference_type; typedef typename PB_DS_ENTRY_CMP_DEC entry_cmp; typedef PB_DS_RESIZE_POLICY_DEC resize_policy; typedef cond_dealtor<value_type, _Alloc> cond_dealtor_t; private: enum { simple_value = is_simple<value_type>::value }; typedef integral_constant<int, simple_value> no_throw_copies_t; typedef typename _Alloc::template rebind<value_type> __rebind_v; typedef typename __rebind_v::other value_allocator; public: typedef typename value_allocator::pointer pointer; typedef typename value_allocator::const_pointer const_pointer; typedef typename value_allocator::reference reference; typedef typename value_allocator::const_reference const_reference; typedef typename __conditional_type<simple_value, value_type, pointer>::__type entry; typedef typename _Alloc::template rebind<entry>::other entry_allocator; typedef typename entry_allocator::pointer entry_pointer; typedef binary_heap_point_const_iterator_<value_type, entry, simple_value, _Alloc> point_const_iterator; typedef point_const_iterator point_iterator; typedef binary_heap_const_iterator_<value_type, entry, simple_value, _Alloc> const_iterator; typedef const_iterator iterator; binary_heap(); binary_heap(const cmp_fn&); binary_heap(const binary_heap&); void swap(binary_heap&); ~binary_heap(); inline bool empty() const; inline size_type size() const; inline size_type max_size() const; Cmp_Fn& get_cmp_fn(); const Cmp_Fn& get_cmp_fn() const; inline point_iterator push(const_reference); void modify(point_iterator, const_reference); inline const_reference top() const; inline void pop(); inline void erase(point_iterator); template<typename Pred> size_type erase_if(Pred); inline void erase_at(entry_pointer, size_type, false_type); inline void erase_at(entry_pointer, size_type, true_type); inline iterator begin(); inline const_iterator begin() const; inline iterator end(); inline const_iterator end() const; void clear(); template<typename Pred> void split(Pred, binary_heap&); void join(binary_heap&); #ifdef PB_DS_BINARY_HEAP_TRACE_ void trace() const; #endif protected: template<typename It> void copy_from_range(It, It); private: void value_swap(binary_heap&); inline void insert_value(const_reference, false_type); inline void insert_value(value_type, true_type); inline void resize_for_insert_if_needed(); inline void swap_value_imp(entry_pointer, value_type, true_type); inline void swap_value_imp(entry_pointer, const_reference, false_type); void fix(entry_pointer); inline const_reference top_imp(true_type) const; inline const_reference top_imp(false_type) const; inline static size_type left_child(size_type); inline static size_type right_child(size_type); inline static size_type parent(size_type); inline void resize_for_erase_if_needed(); template<typename Pred> size_type partition(Pred); void make_heap() { const entry_cmp& m_cmp = static_cast<entry_cmp&>(*this); entry_pointer end = m_a_entries + m_size; std::make_heap(m_a_entries, end, m_cmp); _GLIBCXX_DEBUG_ASSERT(is_heap()); } void push_heap() { if (!is_heap()) make_heap(); else { const entry_cmp& m_cmp = static_cast<entry_cmp&>(*this); entry_pointer end = m_a_entries + m_size; std::push_heap(m_a_entries, end, m_cmp); } } void pop_heap() { const entry_cmp& m_cmp = static_cast<entry_cmp&>(*this); entry_pointer end = m_a_entries + m_size; std::pop_heap(m_a_entries, end, m_cmp); } bool is_heap() { const entry_cmp& m_cmp = static_cast<entry_cmp&>(*this); entry_pointer end = m_a_entries + m_size; bool p = std::__is_heap(m_a_entries, end, m_cmp); return p; } #ifdef _GLIBCXX_DEBUG void assert_valid(const char*, int) const; #endif #ifdef PB_DS_BINARY_HEAP_TRACE_ void trace_entry(const entry&, false_type) const; void trace_entry(const entry&, true_type) const; #endif static entry_allocator s_entry_allocator; static value_allocator s_value_allocator; static no_throw_copies_t s_no_throw_copies_ind; size_type m_size; size_type m_actual_size; entry_pointer m_a_entries; }; #define PB_DS_ASSERT_VALID(X) \ _GLIBCXX_DEBUG_ONLY(X.assert_valid(__FILE__, __LINE__);) #define PB_DS_DEBUG_VERIFY(_Cond) \ _GLIBCXX_DEBUG_VERIFY_AT(_Cond, \ _M_message(#_Cond" assertion from %1;:%2;") \ ._M_string(__FILE__)._M_integer(__LINE__) \ ,__file,__line) #include <ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp> #include <ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp> #include <ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp> #include <ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp> #include <ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp> #include <ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp> #include <ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp> #include <ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp> #include <ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp> #include <ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp> #undef PB_DS_CLASS_C_DEC #undef PB_DS_CLASS_T_DEC #undef PB_DS_ENTRY_CMP_DEC #undef PB_DS_RESIZE_POLICY_DEC } // namespace detail } // namespace __gnu_pbds #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp�������������������������������������������0000644�����������������00000012600�14763166030�0016666 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binary_heap_/erase_fn_imps.hpp * Contains an implementation class for a binary_heap. */ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: clear() { for (size_type i = 0; i < m_size; ++i) erase_at(m_a_entries, i, s_no_throw_copies_ind); __try { const size_type new_size = resize_policy::get_new_size_for_arbitrary(0); entry_pointer new_entries = s_entry_allocator.allocate(new_size); resize_policy::notify_arbitrary(new_size); s_entry_allocator.deallocate(m_a_entries, m_actual_size); m_actual_size = new_size; m_a_entries = new_entries; } __catch(...) { } m_size = 0; PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: erase_at(entry_pointer a_entries, size_type i, false_type) { a_entries[i]->~value_type(); s_value_allocator.deallocate(a_entries[i], 1); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: erase_at(entry_pointer, size_type, true_type) { } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: pop() { PB_DS_ASSERT_VALID((*this)) _GLIBCXX_DEBUG_ASSERT(!empty()); pop_heap(); erase_at(m_a_entries, m_size - 1, s_no_throw_copies_ind); resize_for_erase_if_needed(); _GLIBCXX_DEBUG_ASSERT(m_size > 0); --m_size; PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC template<typename Pred> typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: erase_if(Pred pred) { PB_DS_ASSERT_VALID((*this)) typedef typename entry_pred<value_type, Pred, _Alloc, simple_value>::type pred_t; const size_type left = partition(pred_t(pred)); _GLIBCXX_DEBUG_ASSERT(m_size >= left); const size_type ersd = m_size - left; for (size_type i = left; i < m_size; ++i) erase_at(m_a_entries, i, s_no_throw_copies_ind); __try { const size_type new_size = resize_policy::get_new_size_for_arbitrary(left); entry_pointer new_entries = s_entry_allocator.allocate(new_size); std::copy(m_a_entries, m_a_entries + left, new_entries); s_entry_allocator.deallocate(m_a_entries, m_actual_size); m_actual_size = new_size; resize_policy::notify_arbitrary(m_actual_size); } __catch(...) { }; m_size = left; make_heap(); PB_DS_ASSERT_VALID((*this)) return ersd; } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: erase(point_iterator it) { PB_DS_ASSERT_VALID((*this)) _GLIBCXX_DEBUG_ASSERT(!empty()); const size_type fix_pos = it.m_p_e - m_a_entries; std::swap(*it.m_p_e, m_a_entries[m_size - 1]); erase_at(m_a_entries, m_size - 1, s_no_throw_copies_ind); resize_for_erase_if_needed(); _GLIBCXX_DEBUG_ASSERT(m_size > 0); --m_size; _GLIBCXX_DEBUG_ASSERT(fix_pos <= m_size); if (fix_pos != m_size) fix(m_a_entries + fix_pos); PB_DS_ASSERT_VALID((*this)) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: resize_for_erase_if_needed() { if (!resize_policy::resize_needed_for_shrink(m_size)) return; __try { const size_type new_size = resize_policy::get_new_size_for_shrink(); entry_pointer new_entries = s_entry_allocator.allocate(new_size); resize_policy::notify_shrink_resize(); _GLIBCXX_DEBUG_ASSERT(m_size > 0); std::copy(m_a_entries, m_a_entries + m_size - 1, new_entries); s_entry_allocator.deallocate(m_a_entries, m_actual_size); m_actual_size = new_size; m_a_entries = new_entries; } __catch(...) { } } PB_DS_CLASS_T_DEC template<typename Pred> typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: partition(Pred pred) { size_type left = 0; size_type right = m_size - 1; while (right + 1 != left) { _GLIBCXX_DEBUG_ASSERT(left <= m_size); if (!pred(m_a_entries[left])) ++left; else if (pred(m_a_entries[right])) --right; else { _GLIBCXX_DEBUG_ASSERT(left < right); std::swap(m_a_entries[left], m_a_entries[right]); ++left; --right; } } return left; } ��������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp�������������������������������������������0000644�����������������00000004617�14763166030�0016676 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binary_heap_/trace_fn_imps.hpp * Contains an implementation class for a binary_heap. */ #ifdef PB_DS_BINARY_HEAP_TRACE_ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace() const { std::cerr << this << std::endl; std::cerr << m_a_entries << std::endl; for (size_type i = 0; i < m_size; ++i) trace_entry(m_a_entries[i], s_no_throw_copies_ind); std::cerr << std::endl; std::cerr << "size = " << m_size << " " << "actual_size = " << m_actual_size << std::endl; resize_policy::trace(); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace_entry(const entry& r_e, false_type) const { std::cout << r_e << " " <<* r_e << std::endl; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace_entry(const entry& r_e, true_type) const { std::cout << r_e << std::endl; } #endif // #ifdef PB_DS_BINARY_HEAP_TRACE_ �����������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp��������������������������������������������0000644�����������������00000004016�14763166030�0016524 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binary_heap_/info_fn_imps.hpp * Contains an implementation class for a binary_heap. */ PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: empty() const { return m_size == 0; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: size() const { return m_size; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: max_size() const { return s_entry_allocator.max_size(); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp�������������������������������������������0000644�����������������00000004755�14763166030�0016671 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file binary_heap_/debug_fn_imps.hpp * Contains an implementation class for a binary_heap. */ #ifdef _GLIBCXX_DEBUG PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: assert_valid(const char* __file, int __line) const { #ifdef PB_DS_REGRESSION s_entry_allocator.check_allocated(m_a_entries, m_actual_size); #endif resize_policy::assert_valid(__file, __line); PB_DS_DEBUG_VERIFY(m_size <= m_actual_size); for (size_type i = 0; i < m_size; ++i) { #ifdef PB_DS_REGRESSION s_value_allocator.check_allocated(m_a_entries[i], 1); #endif if (left_child(i) < m_size) PB_DS_DEBUG_VERIFY(!entry_cmp::operator()(m_a_entries[i], m_a_entries[left_child(i)])); PB_DS_DEBUG_VERIFY(parent(left_child(i)) == i); if (right_child(i) < m_size) PB_DS_DEBUG_VERIFY(!entry_cmp::operator()(m_a_entries[i], m_a_entries[right_child(i)])); PB_DS_DEBUG_VERIFY(parent(right_child(i)) == i); } } #endif �������������������c++/4.8.2/ext/pb_ds/detail/tree_trace_base.hpp������������������������������������������������������0000644�����������������00000012016�14763166030�0014544 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file detail/tree_trace_base.hpp * Contains tree-related policies. */ #ifndef PB_DS_TREE_TRACE_BASE_HPP #define PB_DS_TREE_TRACE_BASE_HPP #ifdef PB_DS_TREE_TRACE #include <ext/pb_ds/detail/branch_policy/branch_policy.hpp> #include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp> namespace __gnu_pbds { namespace detail { #ifdef PB_DS_TREE_TRACE #define PB_DS_CLASS_T_DEC \ template<typename Node_CItr, typename Node_Itr, \ typename Cmp_Fn, bool Node_Based, typename _Alloc> #define PB_DS_CLASS_C_DEC \ tree_trace_base<Node_CItr, Node_Itr, Cmp_Fn, \ Node_Based, _Alloc> #define PB_DS_TRACE_BASE \ branch_policy<Node_CItr, Node_Itr, _Alloc> /// Tracing base class. template<typename Node_CItr, typename Node_Itr, typename Cmp_Fn, bool Node_Based, typename _Alloc> class tree_trace_base : private PB_DS_TRACE_BASE { public: void trace() const; private: typedef PB_DS_TRACE_BASE base_type; typedef Node_CItr node_const_iterator; typedef typename _Alloc::size_type size_type; void trace_node(node_const_iterator, size_type) const; virtual bool empty() const = 0; virtual node_const_iterator node_begin() const = 0; virtual node_const_iterator node_end() const = 0; static void print_node_pointer(Node_CItr, integral_constant<int,true>); static void print_node_pointer(Node_CItr, integral_constant<int,false>); template<typename Metadata_> static void trace_it_metadata(Node_CItr, type_to_type<Metadata_>); static void trace_it_metadata(Node_CItr, type_to_type<null_type>); }; PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace() const { if (empty()) return; trace_node(node_begin(), 0); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace_node(node_const_iterator nd_it, size_type level) const { if (nd_it.get_r_child() != node_end()) trace_node(nd_it.get_r_child(), level + 1); for (size_type i = 0; i < level; ++i) std::cerr << ' '; print_node_pointer(nd_it, integral_constant<int,Node_Based>()); std::cerr << base_type::extract_key(*(*nd_it)); typedef type_to_type<typename node_const_iterator::metadata_type> m_type_ind_t; trace_it_metadata(nd_it, m_type_ind_t()); std::cerr << std::endl; if (nd_it.get_l_child() != node_end()) trace_node(nd_it.get_l_child(), level + 1); } PB_DS_CLASS_T_DEC template<typename Metadata_> void PB_DS_CLASS_C_DEC:: trace_it_metadata(Node_CItr nd_it, type_to_type<Metadata_>) { const unsigned long ul = static_cast<unsigned long>(nd_it.get_metadata()); std::cerr << " (" << ul << ") "; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace_it_metadata(Node_CItr, type_to_type<null_type>) { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: print_node_pointer(Node_CItr nd_it, integral_constant<int,true>) { std::cerr << nd_it.m_p_nd << " "; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: print_node_pointer(Node_CItr nd_it, integral_constant<int,false>) { std::cerr << *nd_it << " "; } #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #undef PB_DS_TRACE_BASE #endif // #ifdef PB_DS_TREE_TRACE } // namespace detail } // namespace __gnu_pbds #endif // #ifdef PB_DS_TREE_TRACE #endif // #ifndef PB_DS_TREE_TRACE_BASE_HPP ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/priority_queue.hpp��������������������������������������������������������������0000644�����������������00000012576�14763166030�0013273 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file priority_queue.hpp * Contains priority_queues. */ #ifndef PB_DS_PRIORITY_QUEUE_HPP #define PB_DS_PRIORITY_QUEUE_HPP #include <bits/c++config.h> #include <ext/pb_ds/tag_and_trait.hpp> #include <ext/pb_ds/detail/priority_queue_base_dispatch.hpp> #include <ext/pb_ds/detail/standard_policies.hpp> namespace __gnu_pbds { /** * @defgroup heap-based Heap-Based * @ingroup containers-pbds * @{ */ /** * @defgroup heap-detail Base and Policy Classes * @ingroup heap-based */ /** * A priority queue composed of one specific heap policy. * * @tparam _Tv Value type. * @tparam Cmp_Fn Comparison functor. * @tparam Tag Instantiating data structure type, * see container_tag. * @tparam _Alloc Allocator type. * * Base is dispatched at compile time via Tag, from the following * choices: binary_heap_tag, binomial_heap_tag, pairing_heap_tag, * rc_binomial_heap_tag, thin_heap_tag * * Base choices are: detail::binary_heap, detail::binomial_heap, * detail::pairing_heap, detail::rc_binomial_heap, * detail::thin_heap. */ template<typename _Tv, typename Cmp_Fn = std::less<_Tv>, typename Tag = pairing_heap_tag, typename _Alloc = std::allocator<char> > class priority_queue : public detail::container_base_dispatch<_Tv, Cmp_Fn, _Alloc, Tag>::type { public: typedef _Tv value_type; typedef Cmp_Fn cmp_fn; typedef Tag container_category; typedef _Alloc allocator_type; typedef typename allocator_type::size_type size_type; typedef typename allocator_type::difference_type difference_type; private: typedef typename detail::container_base_dispatch<_Tv, Cmp_Fn, _Alloc, Tag>::type base_type; typedef typename _Alloc::template rebind<_Tv> __rebind_v; typedef typename __rebind_v::other __rebind_va; public: typedef typename __rebind_va::reference reference; typedef typename __rebind_va::const_reference const_reference; typedef typename __rebind_va::pointer pointer; typedef typename __rebind_va::const_pointer const_pointer; typedef typename base_type::point_iterator point_iterator; typedef typename base_type::point_const_iterator point_const_iterator; typedef typename base_type::iterator iterator; typedef typename base_type::const_iterator const_iterator; priority_queue() { } /// Constructor taking some policy objects. r_cmp_fn will be /// copied by the Cmp_Fn object of the container object. priority_queue(const cmp_fn& r_cmp_fn) : base_type(r_cmp_fn) { } /// Constructor taking __iterators to a range of value_types. The /// value_types between first_it and last_it will be inserted into /// the container object. template<typename It> priority_queue(It first_it, It last_it) { base_type::copy_from_range(first_it, last_it); } /// Constructor taking __iterators to a range of value_types and /// some policy objects The value_types between first_it and /// last_it will be inserted into the container object. r_cmp_fn /// will be copied by the cmp_fn object of the container object. template<typename It> priority_queue(It first_it, It last_it, const cmp_fn& r_cmp_fn) : base_type(r_cmp_fn) { base_type::copy_from_range(first_it, last_it); } priority_queue(const priority_queue& other) : base_type((const base_type& )other) { } virtual ~priority_queue() { } priority_queue& operator=(const priority_queue& other) { if (this != &other) { priority_queue tmp(other); swap(tmp); } return *this; } void swap(priority_queue& other) { base_type::swap(other); } }; } // namespace __gnu_pbds //@} heap-based #endif ����������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/assoc_container.hpp�������������������������������������������������������������0000644�����������������00000072636�14763166030�0013363 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file assoc_container.hpp * Contains associative containers. */ #ifndef PB_DS_ASSOC_CNTNR_HPP #define PB_DS_ASSOC_CNTNR_HPP #include <bits/c++config.h> #include <ext/typelist.h> #include <ext/pb_ds/tag_and_trait.hpp> #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/detail/container_base_dispatch.hpp> #include <ext/pb_ds/detail/branch_policy/traits.hpp> namespace __gnu_pbds { /** * @defgroup containers-pbds Containers * @ingroup pbds * @{ */ /** * @defgroup hash-based Hash-Based * @ingroup containers-pbds * @{ */ #define PB_DS_HASH_BASE \ detail::container_base_dispatch<Key, Mapped, _Alloc, Tag, \ typename __gnu_cxx::typelist::append< \ typename __gnu_cxx::typelist::create4<Hash_Fn, Eq_Fn, Resize_Policy, \ detail::integral_constant<int, Store_Hash> >::type, Policy_Tl>::type>::type /** * @defgroup hash-detail Base and Policy Classes * @ingroup hash-based */ /** * A hashed container abstraction. * * @tparam Key Key type. * @tparam Mapped Map type. * @tparam Hash_Fn Hashing functor. * @tparam Eq_Fn Equal functor. * @tparam Resize_Policy Resizes hash. * @tparam Store_Hash Indicates whether the hash value * will be stored along with each key. * @tparam Tag Instantiating data structure type, * see container_tag. * @tparam Policy_TL Policy typelist. * @tparam _Alloc Allocator type. * * Base is dispatched at compile time via Tag, from the following * choices: cc_hash_tag, gp_hash_tag, and descendants of basic_hash_tag. * * Base choices are: detail::cc_ht_map, detail::gp_ht_map */ template<typename Key, typename Mapped, typename Hash_Fn, typename Eq_Fn, typename Resize_Policy, bool Store_Hash, typename Tag, typename Policy_Tl, typename _Alloc> class basic_hash_table : public PB_DS_HASH_BASE { private: typedef typename PB_DS_HASH_BASE base_type; public: virtual ~basic_hash_table() { } protected: basic_hash_table() { } basic_hash_table(const basic_hash_table& other) : base_type((const base_type&)other) { } template<typename T0> basic_hash_table(T0 t0) : base_type(t0) { } template<typename T0, typename T1> basic_hash_table(T0 t0, T1 t1) : base_type(t0, t1) { } template<typename T0, typename T1, typename T2> basic_hash_table(T0 t0, T1 t1, T2 t2) : base_type(t0, t1, t2) { } template<typename T0, typename T1, typename T2, typename T3> basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3) : base_type(t0, t1, t2, t3) { } template<typename T0, typename T1, typename T2, typename T3, typename T4> basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4) : base_type(t0, t1, t2, t3, t4) { } template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5> basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) : base_type(t0, t1, t2, t3, t4, t5) { } template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6) : base_type(t0, t1, t2, t3, t4, t5, t6) { } template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7) : base_type(t0, t1, t2, t3, t4, t5, t6, t7) { } template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8) : base_type(t0, t1, t2, t3, t4, t5, t6, t7, t8) { } private: basic_hash_table& operator=(const base_type&); }; #undef PB_DS_HASH_BASE #define PB_DS_CC_HASH_BASE \ basic_hash_table<Key, Mapped, Hash_Fn, Eq_Fn, Resize_Policy, Store_Hash, \ cc_hash_tag, \ typename __gnu_cxx::typelist::create1<Comb_Hash_Fn>::type, _Alloc> /** * A collision-chaining hash-based associative container. * * @tparam Key Key type. * @tparam Mapped Map type. * @tparam Hash_Fn Hashing functor. * @tparam Eq_Fn Equal functor. * @tparam Comb_Hash_Fn Combining hash functor. * If Hash_Fn is not null_type, then this * is the ranged-hash functor; otherwise, * this is the range-hashing functor. * XXX(See Design::Hash-Based Containers::Hash Policies.) * @tparam Resize_Policy Resizes hash. * @tparam Store_Hash Indicates whether the hash value * will be stored along with each key. * If Hash_Fn is null_type, then the * container will not compile if this * value is true * @tparam _Alloc Allocator type. * * Base tag choices are: cc_hash_tag. * * Base is basic_hash_table. */ template<typename Key, typename Mapped, typename Hash_Fn = typename detail::default_hash_fn<Key>::type, typename Eq_Fn = typename detail::default_eq_fn<Key>::type, typename Comb_Hash_Fn = detail::default_comb_hash_fn::type, typename Resize_Policy = typename detail::default_resize_policy<Comb_Hash_Fn>::type, bool Store_Hash = detail::default_store_hash, typename _Alloc = std::allocator<char> > class cc_hash_table : public PB_DS_CC_HASH_BASE { private: typedef PB_DS_CC_HASH_BASE base_type; public: typedef cc_hash_tag container_category; typedef Hash_Fn hash_fn; typedef Eq_Fn eq_fn; typedef Resize_Policy resize_policy; typedef Comb_Hash_Fn comb_hash_fn; /// Default constructor. cc_hash_table() { } /// Constructor taking some policy objects. r_hash_fn will be /// copied by the Hash_Fn object of the container object. cc_hash_table(const hash_fn& h) : base_type(h) { } /// Constructor taking some policy objects. r_hash_fn will be /// copied by the hash_fn object of the container object, and /// r_eq_fn will be copied by the eq_fn object of the container /// object. cc_hash_table(const hash_fn& h, const eq_fn& e) : base_type(h, e) { } /// Constructor taking some policy objects. r_hash_fn will be /// copied by the hash_fn object of the container object, r_eq_fn /// will be copied by the eq_fn object of the container object, /// and r_comb_hash_fn will be copied by the comb_hash_fn object /// of the container object. cc_hash_table(const hash_fn& h, const eq_fn& e, const comb_hash_fn& ch) : base_type(h, e, ch) { } /// Constructor taking some policy objects. r_hash_fn will be /// copied by the hash_fn object of the container object, r_eq_fn /// will be copied by the eq_fn object of the container object, /// r_comb_hash_fn will be copied by the comb_hash_fn object of /// the container object, and r_resize_policy will be copied by /// the resize_policy object of the container object. cc_hash_table(const hash_fn& h, const eq_fn& e, const comb_hash_fn& ch, const resize_policy& rp) : base_type(h, e, ch, rp) { } /// Constructor taking __iterators to a range of value_types. The /// value_types between first_it and last_it will be inserted into /// the container object. template<typename It> cc_hash_table(It first, It last) { base_type::copy_from_range(first, last); } /// Constructor taking __iterators to a range of value_types and /// some policy objects. The value_types between first_it and /// last_it will be inserted into the container object. template<typename It> cc_hash_table(It first, It last, const hash_fn& h) : base_type(h) { this->copy_from_range(first, last); } /// Constructor taking __iterators to a range of value_types and /// some policy objects The value_types between first_it and /// last_it will be inserted into the container object. r_hash_fn /// will be copied by the hash_fn object of the container object, /// and r_eq_fn will be copied by the eq_fn object of the /// container object. template<typename It> cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e) : base_type(h, e) { this->copy_from_range(first, last); } /// Constructor taking __iterators to a range of value_types and /// some policy objects The value_types between first_it and /// last_it will be inserted into the container object. r_hash_fn /// will be copied by the hash_fn object of the container object, /// r_eq_fn will be copied by the eq_fn object of the container /// object, and r_comb_hash_fn will be copied by the comb_hash_fn /// object of the container object. template<typename It> cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e, const comb_hash_fn& ch) : base_type(h, e, ch) { this->copy_from_range(first, last); } /// Constructor taking __iterators to a range of value_types and /// some policy objects The value_types between first_it and /// last_it will be inserted into the container object. r_hash_fn /// will be copied by the hash_fn object of the container object, /// r_eq_fn will be copied by the eq_fn object of the container /// object, r_comb_hash_fn will be copied by the comb_hash_fn /// object of the container object, and r_resize_policy will be /// copied by the resize_policy object of the container object. template<typename It> cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e, const comb_hash_fn& ch, const resize_policy& rp) : base_type(h, e, ch, rp) { this->copy_from_range(first, last); } cc_hash_table(const cc_hash_table& other) : base_type((const base_type&)other) { } virtual ~cc_hash_table() { } cc_hash_table& operator=(const cc_hash_table& other) { if (this != &other) { cc_hash_table tmp(other); swap(tmp); } return *this; } void swap(cc_hash_table& other) { base_type::swap(other); } }; #undef PB_DS_CC_HASH_BASE #define PB_DS_GP_HASH_BASE \ basic_hash_table<Key, Mapped, Hash_Fn, Eq_Fn, Resize_Policy, Store_Hash, \ gp_hash_tag, \ typename __gnu_cxx::typelist::create2<Comb_Probe_Fn, Probe_Fn>::type, _Alloc> /** * A general-probing hash-based associative container. * * @tparam Key Key type. * @tparam Mapped Map type. * @tparam Hash_Fn Hashing functor. * @tparam Eq_Fn Equal functor. * @tparam Comb_Probe_Fn Combining probe functor. * If Hash_Fn is not null_type, then this * is the ranged-probe functor; otherwise, * this is the range-hashing functor. * XXX See Design::Hash-Based Containers::Hash Policies. * @tparam Probe_Fn Probe functor. * @tparam Resize_Policy Resizes hash. * @tparam Store_Hash Indicates whether the hash value * will be stored along with each key. * If Hash_Fn is null_type, then the * container will not compile if this * value is true * @tparam _Alloc Allocator type. * * Base tag choices are: gp_hash_tag. * * Base is basic_hash_table. */ template<typename Key, typename Mapped, typename Hash_Fn = typename detail::default_hash_fn<Key>::type, typename Eq_Fn = typename detail::default_eq_fn<Key>::type, typename Comb_Probe_Fn = detail::default_comb_hash_fn::type, typename Probe_Fn = typename detail::default_probe_fn<Comb_Probe_Fn>::type, typename Resize_Policy = typename detail::default_resize_policy<Comb_Probe_Fn>::type, bool Store_Hash = detail::default_store_hash, typename _Alloc = std::allocator<char> > class gp_hash_table : public PB_DS_GP_HASH_BASE { private: typedef PB_DS_GP_HASH_BASE base_type; public: typedef gp_hash_tag container_category; typedef Hash_Fn hash_fn; typedef Eq_Fn eq_fn; typedef Comb_Probe_Fn comb_probe_fn; typedef Probe_Fn probe_fn; typedef Resize_Policy resize_policy; /// Default constructor. gp_hash_table() { } /// Constructor taking some policy objects. r_hash_fn will be /// copied by the hash_fn object of the container object. gp_hash_table(const hash_fn& h) : base_type(h) { } /// Constructor taking some policy objects. r_hash_fn will be /// copied by the hash_fn object of the container object, and /// r_eq_fn will be copied by the eq_fn object of the container /// object. gp_hash_table(const hash_fn& h, const eq_fn& e) : base_type(h, e) { } /// Constructor taking some policy objects. r_hash_fn will be /// copied by the hash_fn object of the container object, r_eq_fn /// will be copied by the eq_fn object of the container object, /// and r_comb_probe_fn will be copied by the comb_probe_fn object /// of the container object. gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp) : base_type(h, e, cp) { } /// Constructor taking some policy objects. r_hash_fn will be /// copied by the hash_fn object of the container object, r_eq_fn /// will be copied by the eq_fn object of the container object, /// r_comb_probe_fn will be copied by the comb_probe_fn object of /// the container object, and r_probe_fn will be copied by the /// probe_fn object of the container object. gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp, const probe_fn& p) : base_type(h, e, cp, p) { } /// Constructor taking some policy objects. r_hash_fn will be /// copied by the hash_fn object of the container object, r_eq_fn /// will be copied by the eq_fn object of the container object, /// r_comb_probe_fn will be copied by the comb_probe_fn object of /// the container object, r_probe_fn will be copied by the /// probe_fn object of the container object, and r_resize_policy /// will be copied by the Resize_Policy object of the container /// object. gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp, const probe_fn& p, const resize_policy& rp) : base_type(h, e, cp, p, rp) { } /// Constructor taking __iterators to a range of value_types. The /// value_types between first_it and last_it will be inserted into /// the container object. template<typename It> gp_hash_table(It first, It last) { base_type::copy_from_range(first, last); } /// Constructor taking __iterators to a range of value_types and /// some policy objects. The value_types between first_it and /// last_it will be inserted into the container object. r_hash_fn /// will be copied by the hash_fn object of the container object. template<typename It> gp_hash_table(It first, It last, const hash_fn& h) : base_type(h) { base_type::copy_from_range(first, last); } /// Constructor taking __iterators to a range of value_types and /// some policy objects. The value_types between first_it and /// last_it will be inserted into the container object. r_hash_fn /// will be copied by the hash_fn object of the container object, /// and r_eq_fn will be copied by the eq_fn object of the /// container object. template<typename It> gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e) : base_type(h, e) { base_type::copy_from_range(first, last); } /// Constructor taking __iterators to a range of value_types and /// some policy objects. The value_types between first_it and /// last_it will be inserted into the container object. r_hash_fn /// will be copied by the hash_fn object of the container object, /// r_eq_fn will be copied by the eq_fn object of the container /// object, and r_comb_probe_fn will be copied by the /// comb_probe_fn object of the container object. template<typename It> gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp) : base_type(h, e, cp) { base_type::copy_from_range(first, last); } /// Constructor taking __iterators to a range of value_types and /// some policy objects. The value_types between first_it and /// last_it will be inserted into the container object. r_hash_fn /// will be copied by the hash_fn object of the container object, /// r_eq_fn will be copied by the eq_fn object of the container /// object, r_comb_probe_fn will be copied by the comb_probe_fn /// object of the container object, and r_probe_fn will be copied /// by the probe_fn object of the container object. template<typename It> gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp, const probe_fn& p) : base_type(h, e, cp, p) { base_type::copy_from_range(first, last); } /// Constructor taking __iterators to a range of value_types and /// some policy objects. The value_types between first_it and /// last_it will be inserted into the container object. r_hash_fn /// will be copied by the hash_fn object of the container object, /// r_eq_fn will be copied by the eq_fn object of the container /// object, r_comb_probe_fn will be copied by the comb_probe_fn /// object of the container object, r_probe_fn will be copied by /// the probe_fn object of the container object, and /// r_resize_policy will be copied by the resize_policy object of /// the container object. template<typename It> gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp, const probe_fn& p, const resize_policy& rp) : base_type(h, e, cp, p, rp) { base_type::copy_from_range(first, last); } gp_hash_table(const gp_hash_table& other) : base_type((const base_type&)other) { } virtual ~gp_hash_table() { } gp_hash_table& operator=(const gp_hash_table& other) { if (this != &other) { gp_hash_table tmp(other); swap(tmp); } return *this; } void swap(gp_hash_table& other) { base_type::swap(other); } }; //@} hash-based #undef PB_DS_GP_HASH_BASE /** * @defgroup branch-based Branch-Based * @ingroup containers-pbds * @{ */ #define PB_DS_BRANCH_BASE \ detail::container_base_dispatch<Key, Mapped, _Alloc, Tag, Policy_Tl>::type /** * @defgroup branch-detail Base and Policy Classes * @ingroup branch-based */ /** * A branched, tree-like (tree, trie) container abstraction. * * @tparam Key Key type. * @tparam Mapped Map type. * @tparam Tag Instantiating data structure type, * see container_tag. * @tparam Node_Update Updates nodes, restores invariants. * @tparam Policy_TL Policy typelist. * @tparam _Alloc Allocator type. * * Base is dispatched at compile time via Tag, from the following * choices: tree_tag, trie_tag, and their descendants. * * Base choices are: detail::ov_tree_map, detail::rb_tree_map, * detail::splay_tree_map, and detail::pat_trie_map. */ template<typename Key, typename Mapped, typename Tag, typename Node_Update, typename Policy_Tl, typename _Alloc> class basic_branch : public PB_DS_BRANCH_BASE { private: typedef typename PB_DS_BRANCH_BASE base_type; public: typedef Node_Update node_update; virtual ~basic_branch() { } protected: basic_branch() { } basic_branch(const basic_branch& other) : base_type((const base_type&)other) { } template<typename T0> basic_branch(T0 t0) : base_type(t0) { } template<typename T0, typename T1> basic_branch(T0 t0, T1 t1) : base_type(t0, t1) { } template<typename T0, typename T1, typename T2> basic_branch(T0 t0, T1 t1, T2 t2) : base_type(t0, t1, t2) { } template<typename T0, typename T1, typename T2, typename T3> basic_branch(T0 t0, T1 t1, T2 t2, T3 t3) : base_type(t0, t1, t2, t3) { } template<typename T0, typename T1, typename T2, typename T3, typename T4> basic_branch(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4) : base_type(t0, t1, t2, t3, t4) { } template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5> basic_branch(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) : base_type(t0, t1, t2, t3, t4, t5) { } template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> basic_branch(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6) : base_type(t0, t1, t2, t3, t4, t5, t6) { } }; #undef PB_DS_BRANCH_BASE #define PB_DS_TREE_NODE_AND_IT_TRAITS \ detail::tree_traits<Key, Mapped,Cmp_Fn,Node_Update,Tag,_Alloc> #define PB_DS_TREE_BASE \ basic_branch<Key,Mapped, Tag, \ typename PB_DS_TREE_NODE_AND_IT_TRAITS::node_update, \ typename __gnu_cxx::typelist::create2<Cmp_Fn, \ PB_DS_TREE_NODE_AND_IT_TRAITS>::type, _Alloc> /** * A tree-based container. * * @tparam Key Key type. * @tparam Mapped Map type. * @tparam Cmp_Fn Comparison functor. * @tparam Tag Instantiating data structure type, * see container_tag. * @tparam Node_Update Updates tree internal-nodes, * restores invariants when invalidated. * XXX See design::tree-based-containers::node invariants. * @tparam _Alloc Allocator type. * * Base tag choices are: ov_tree_tag, rb_tree_tag, splay_tree_tag. * * Base is basic_branch. */ template<typename Key, typename Mapped, typename Cmp_Fn = std::less<Key>, typename Tag = rb_tree_tag, template<typename Node_CItr, typename Node_Itr, typename Cmp_Fn_, typename _Alloc_> class Node_Update = null_node_update, typename _Alloc = std::allocator<char> > class tree : public PB_DS_TREE_BASE { private: typedef PB_DS_TREE_BASE base_type; public: /// Comparison functor type. typedef Cmp_Fn cmp_fn; tree() { } /// Constructor taking some policy objects. r_cmp_fn will be /// copied by the Cmp_Fn object of the container object. tree(const cmp_fn& c) : base_type(c) { } /// Constructor taking __iterators to a range of value_types. The /// value_types between first_it and last_it will be inserted into /// the container object. template<typename It> tree(It first, It last) { base_type::copy_from_range(first, last); } /// Constructor taking __iterators to a range of value_types and /// some policy objects The value_types between first_it and /// last_it will be inserted into the container object. r_cmp_fn /// will be copied by the cmp_fn object of the container object. template<typename It> tree(It first, It last, const cmp_fn& c) : base_type(c) { base_type::copy_from_range(first, last); } tree(const tree& other) : base_type((const base_type&)other) { } virtual ~tree() { } tree& operator=(const tree& other) { if (this != &other) { tree tmp(other); swap(tmp); } return *this; } void swap(tree& other) { base_type::swap(other); } }; #undef PB_DS_TREE_BASE #undef PB_DS_TREE_NODE_AND_IT_TRAITS #define PB_DS_TRIE_NODE_AND_IT_TRAITS \ detail::trie_traits<Key,Mapped,_ATraits,Node_Update,Tag,_Alloc> #define PB_DS_TRIE_BASE \ basic_branch<Key,Mapped,Tag, \ typename PB_DS_TRIE_NODE_AND_IT_TRAITS::node_update, \ typename __gnu_cxx::typelist::create2<_ATraits, \ PB_DS_TRIE_NODE_AND_IT_TRAITS >::type, _Alloc> /** * A trie-based container. * * @tparam Key Key type. * @tparam Mapped Map type. * @tparam _ATraits Element access traits. * @tparam Tag Instantiating data structure type, * see container_tag. * @tparam Node_Update Updates trie internal-nodes, * restores invariants when invalidated. * XXX See design::tree-based-containers::node invariants. * @tparam _Alloc Allocator type. * * Base tag choice is pat_trie_tag. * * Base is basic_branch. */ template<typename Key, typename Mapped, typename _ATraits = \ typename detail::default_trie_access_traits<Key>::type, typename Tag = pat_trie_tag, template<typename Node_CItr, typename Node_Itr, typename _ATraits_, typename _Alloc_> class Node_Update = null_node_update, typename _Alloc = std::allocator<char> > class trie : public PB_DS_TRIE_BASE { private: typedef PB_DS_TRIE_BASE base_type; public: /// Element access traits type. typedef _ATraits access_traits; trie() { } /// Constructor taking some policy objects. r_access_traits will /// be copied by the _ATraits object of the container object. trie(const access_traits& t) : base_type(t) { } /// Constructor taking __iterators to a range of value_types. The /// value_types between first_it and last_it will be inserted into /// the container object. template<typename It> trie(It first, It last) { base_type::copy_from_range(first, last); } /// Constructor taking __iterators to a range of value_types and /// some policy objects. The value_types between first_it and /// last_it will be inserted into the container object. template<typename It> trie(It first, It last, const access_traits& t) : base_type(t) { base_type::copy_from_range(first, last); } trie(const trie& other) : base_type((const base_type&)other) { } virtual ~trie() { } trie& operator=(const trie& other) { if (this != &other) { trie tmp(other); swap(tmp); } return *this; } void swap(trie& other) { base_type::swap(other); } }; //@} branch-based #undef PB_DS_TRIE_BASE #undef PB_DS_TRIE_NODE_AND_IT_TRAITS /** * @defgroup list-based List-Based * @ingroup containers-pbds * @{ */ #define PB_DS_LU_BASE \ detail::container_base_dispatch<Key, Mapped, _Alloc, list_update_tag, \ typename __gnu_cxx::typelist::create2<Eq_Fn, Update_Policy>::type>::type /** * A list-update based associative container. * * @tparam Key Key type. * @tparam Mapped Map type. * @tparam Eq_Fn Equal functor. * @tparam Update_Policy Update policy, determines when an element * will be moved to the front of the list. * @tparam _Alloc Allocator type. * * Base is detail::lu_map. */ template<typename Key, typename Mapped, class Eq_Fn = typename detail::default_eq_fn<Key>::type, class Update_Policy = detail::default_update_policy::type, class _Alloc = std::allocator<char> > class list_update : public PB_DS_LU_BASE { private: typedef typename PB_DS_LU_BASE base_type; public: typedef list_update_tag container_category; typedef Eq_Fn eq_fn; typedef Update_Policy update_policy; list_update() { } /// Constructor taking __iterators to a range of value_types. The /// value_types between first_it and last_it will be inserted into /// the container object. template<typename It> list_update(It first, It last) { base_type::copy_from_range(first, last); } list_update(const list_update& other) : base_type((const base_type&)other) { } virtual ~list_update() { } list_update& operator=(const list_update& other) { if (this !=& other) { list_update tmp(other); swap(tmp); } return *this; } void swap(list_update& other) { base_type::swap(other); } }; //@} list-based #undef PB_DS_LU_BASE // @} group containers-pbds } // namespace __gnu_pbds #endif ��������������������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/exception.hpp�������������������������������������������������������������������0000644�����������������00000005654�14763166030�0012203 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file exception.hpp * Contains exception classes. */ #ifndef PB_DS_EXCEPTION_HPP #define PB_DS_EXCEPTION_HPP #include <bits/c++config.h> #include <stdexcept> #include <cstdlib> namespace __gnu_pbds { /** * @defgroup exceptions-pbds Exceptions * @ingroup pbds * @{ */ /// Base class for exceptions. struct container_error : public std::logic_error { container_error() : std::logic_error(__N("__gnu_pbds::container_error")) { } }; /// An entry cannot be inserted into a container object for logical /// reasons (not, e.g., if memory is unabvailable, in which case /// the allocator_type's exception will be thrown). struct insert_error : public container_error { }; /// A join cannot be performed logical reasons (i.e., the ranges of /// the two container objects being joined overlaps. struct join_error : public container_error { }; /// A container cannot be resized. struct resize_error : public container_error { }; inline void __throw_container_error() { _GLIBCXX_THROW_OR_ABORT(container_error()); } inline void __throw_insert_error() { _GLIBCXX_THROW_OR_ABORT(insert_error()); } inline void __throw_join_error() { _GLIBCXX_THROW_OR_ABORT(join_error()); } inline void __throw_resize_error() { _GLIBCXX_THROW_OR_ABORT(resize_error()); } //@} } // namespace __gnu_pbds #endif ������������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/hash_policy.hpp�����������������������������������������������������������������0000644�����������������00000040657�14763166030�0012511 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file hash_policy.hpp * Contains hash-related policies. */ #ifndef PB_DS_HASH_POLICY_HPP #define PB_DS_HASH_POLICY_HPP #include <bits/c++config.h> #include <algorithm> #include <vector> #include <cmath> #include <ext/pb_ds/exception.hpp> #include <ext/pb_ds/detail/type_utils.hpp> #include <ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp> #include <ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp> #include <ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp> namespace __gnu_pbds { #define PB_DS_CLASS_T_DEC template<typename Size_Type> #define PB_DS_CLASS_C_DEC linear_probe_fn<Size_Type> /// A probe sequence policy using fixed increments. template<typename Size_Type = std::size_t> class linear_probe_fn { public: typedef Size_Type size_type; void swap(PB_DS_CLASS_C_DEC& other); protected: /// Returns the i-th offset from the hash value. inline size_type operator()(size_type i) const; }; #include <ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp> #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #define PB_DS_CLASS_T_DEC template<typename Size_Type> #define PB_DS_CLASS_C_DEC quadratic_probe_fn<Size_Type> /// A probe sequence policy using square increments. template<typename Size_Type = std::size_t> class quadratic_probe_fn { public: typedef Size_Type size_type; void swap(PB_DS_CLASS_C_DEC& other); protected: /// Returns the i-th offset from the hash value. inline size_type operator()(size_type i) const; }; #include <ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp> #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #define PB_DS_CLASS_T_DEC template<typename Size_Type> #define PB_DS_CLASS_C_DEC direct_mask_range_hashing<Size_Type> /// A mask range-hashing class (uses a bitmask). template<typename Size_Type = std::size_t> class direct_mask_range_hashing : public detail::mask_based_range_hashing<Size_Type> { private: typedef detail::mask_based_range_hashing<Size_Type> mask_based_base; public: typedef Size_Type size_type; void swap(PB_DS_CLASS_C_DEC& other); protected: void notify_resized(size_type size); /// Transforms the __hash value hash into a ranged-hash value /// (using a bit-mask). inline size_type operator()(size_type hash) const; }; #include <ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp> #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #define PB_DS_CLASS_T_DEC template<typename Size_Type> #define PB_DS_CLASS_C_DEC direct_mod_range_hashing<Size_Type> /// A mod range-hashing class (uses the modulo function). template<typename Size_Type = std::size_t> class direct_mod_range_hashing : public detail::mod_based_range_hashing<Size_Type> { public: typedef Size_Type size_type; void swap(PB_DS_CLASS_C_DEC& other); protected: void notify_resized(size_type size); /// Transforms the __hash value hash into a ranged-hash value /// (using a modulo operation). inline size_type operator()(size_type hash) const; private: typedef detail::mod_based_range_hashing<size_type> mod_based_base; }; #include <ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp> #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #define PB_DS_CLASS_T_DEC template<bool External_Load_Access, typename Size_Type> #define PB_DS_CLASS_C_DEC hash_load_check_resize_trigger<External_Load_Access, Size_Type> #define PB_DS_SIZE_BASE_C_DEC detail::hash_load_check_resize_trigger_size_base<Size_Type, External_Load_Access> /// A resize trigger policy based on a load check. It keeps the /// load factor between some load factors load_min and load_max. template<bool External_Load_Access = false, typename Size_Type = std::size_t> class hash_load_check_resize_trigger : private PB_DS_SIZE_BASE_C_DEC { public: typedef Size_Type size_type; enum { /// Specifies whether the load factor can be accessed /// externally. The two options have different trade-offs in /// terms of flexibility, genericity, and encapsulation. external_load_access = External_Load_Access }; /// Default constructor, or constructor taking load_min and /// load_max load factors between which this policy will keep the /// actual load. hash_load_check_resize_trigger(float load_min = 0.125, float load_max = 0.5); void swap(hash_load_check_resize_trigger& other); virtual ~hash_load_check_resize_trigger(); /// Returns a pair of the minimal and maximal loads, respectively. inline std::pair<float, float> get_loads() const; /// Sets the loads through a pair of the minimal and maximal /// loads, respectively. void set_loads(std::pair<float, float> load_pair); protected: inline void notify_insert_search_start(); inline void notify_insert_search_collision(); inline void notify_insert_search_end(); inline void notify_find_search_start(); inline void notify_find_search_collision(); inline void notify_find_search_end(); inline void notify_erase_search_start(); inline void notify_erase_search_collision(); inline void notify_erase_search_end(); /// Notifies an element was inserted. The total number of entries /// in the table is num_entries. inline void notify_inserted(size_type num_entries); inline void notify_erased(size_type num_entries); /// Notifies the table was cleared. void notify_cleared(); /// Notifies the table was resized as a result of this object's /// signifying that a resize is needed. void notify_resized(size_type new_size); void notify_externally_resized(size_type new_size); inline bool is_resize_needed() const; inline bool is_grow_needed(size_type size, size_type num_entries) const; private: virtual void do_resize(size_type new_size); typedef PB_DS_SIZE_BASE_C_DEC size_base; #ifdef _GLIBCXX_DEBUG void assert_valid(const char* file, int line) const; #endif float m_load_min; float m_load_max; size_type m_next_shrink_size; size_type m_next_grow_size; bool m_resize_needed; }; #include <ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp> #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #undef PB_DS_SIZE_BASE_C_DEC #define PB_DS_CLASS_T_DEC template<bool External_Load_Access, typename Size_Type> #define PB_DS_CLASS_C_DEC cc_hash_max_collision_check_resize_trigger<External_Load_Access, Size_Type> /// A resize trigger policy based on collision checks. It keeps the /// simulated load factor lower than some given load factor. template<bool External_Load_Access = false, typename Size_Type = std::size_t> class cc_hash_max_collision_check_resize_trigger { public: typedef Size_Type size_type; enum { /// Specifies whether the load factor can be accessed /// externally. The two options have different trade-offs in /// terms of flexibility, genericity, and encapsulation. external_load_access = External_Load_Access }; /// Default constructor, or constructor taking load, a __load /// factor which it will attempt to maintain. cc_hash_max_collision_check_resize_trigger(float load = 0.5); void swap(PB_DS_CLASS_C_DEC& other); /// Returns the current load. inline float get_load() const; /// Sets the load; does not resize the container. void set_load(float load); protected: /// Notifies an insert search started. inline void notify_insert_search_start(); /// Notifies a search encountered a collision. inline void notify_insert_search_collision(); /// Notifies a search ended. inline void notify_insert_search_end(); /// Notifies a find search started. inline void notify_find_search_start(); /// Notifies a search encountered a collision. inline void notify_find_search_collision(); /// Notifies a search ended. inline void notify_find_search_end(); /// Notifies an erase search started. inline void notify_erase_search_start(); /// Notifies a search encountered a collision. inline void notify_erase_search_collision(); /// Notifies a search ended. inline void notify_erase_search_end(); /// Notifies an element was inserted. inline void notify_inserted(size_type num_entries); /// Notifies an element was erased. inline void notify_erased(size_type num_entries); /// Notifies the table was cleared. void notify_cleared(); /// Notifies the table was resized as a result of this object's /// signifying that a resize is needed. void notify_resized(size_type new_size); /// Notifies the table was resized externally. void notify_externally_resized(size_type new_size); /// Queries whether a resize is needed. inline bool is_resize_needed() const; /// Queries whether a grow is needed. This method is called only /// if this object indicated is needed. inline bool is_grow_needed(size_type size, size_type num_entries) const; private: void calc_max_num_coll(); inline void calc_resize_needed(); float m_load; size_type m_size; size_type m_num_col; size_type m_max_col; bool m_resize_needed; }; #include <ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp> #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #define PB_DS_CLASS_T_DEC template<typename Size_Type> #define PB_DS_CLASS_C_DEC hash_exponential_size_policy<Size_Type> /// A size policy whose sequence of sizes form an exponential /// sequence (typically powers of 2. template<typename Size_Type = std::size_t> class hash_exponential_size_policy { public: typedef Size_Type size_type; /// Default constructor, or onstructor taking a start_size, or /// constructor taking a start size and grow_factor. The policy /// will use the sequence of sizes start_size, start_size* /// grow_factor, start_size* grow_factor^2, ... hash_exponential_size_policy(size_type start_size = 8, size_type grow_factor = 2); void swap(PB_DS_CLASS_C_DEC& other); protected: size_type get_nearest_larger_size(size_type size) const; size_type get_nearest_smaller_size(size_type size) const; private: size_type m_start_size; size_type m_grow_factor; }; #include <ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp> #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #define PB_DS_CLASS_T_DEC #define PB_DS_CLASS_C_DEC hash_prime_size_policy /// A size policy whose sequence of sizes form a nearly-exponential /// sequence of primes. class hash_prime_size_policy { public: /// Size type. typedef std::size_t size_type; /// Default constructor, or onstructor taking a start_size The /// policy will use the sequence of sizes approximately /// start_size, start_size* 2, start_size* 2^2, ... hash_prime_size_policy(size_type start_size = 8); inline void swap(PB_DS_CLASS_C_DEC& other); protected: size_type get_nearest_larger_size(size_type size) const; size_type get_nearest_smaller_size(size_type size) const; private: size_type m_start_size; }; #include <ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp> #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #define PB_DS_CLASS_T_DEC template<typename Size_Policy, typename Trigger_Policy, bool External_Size_Access, typename Size_Type> #define PB_DS_CLASS_C_DEC hash_standard_resize_policy<Size_Policy, Trigger_Policy, External_Size_Access, Size_Type> /// A resize policy which delegates operations to size and trigger policies. template<typename Size_Policy = hash_exponential_size_policy<>, typename Trigger_Policy = hash_load_check_resize_trigger<>, bool External_Size_Access = false, typename Size_Type = std::size_t> class hash_standard_resize_policy : public Size_Policy, public Trigger_Policy { public: typedef Size_Type size_type; typedef Trigger_Policy trigger_policy; typedef Size_Policy size_policy; enum { external_size_access = External_Size_Access }; /// Default constructor. hash_standard_resize_policy(); /// constructor taking some policies r_size_policy will be copied /// by the Size_Policy object of this object. hash_standard_resize_policy(const Size_Policy& r_size_policy); /// constructor taking some policies. r_size_policy will be /// copied by the Size_Policy object of this /// object. r_trigger_policy will be copied by the Trigger_Policy /// object of this object. hash_standard_resize_policy(const Size_Policy& r_size_policy, const Trigger_Policy& r_trigger_policy); virtual ~hash_standard_resize_policy(); inline void swap(PB_DS_CLASS_C_DEC& other); /// Access to the Size_Policy object used. Size_Policy& get_size_policy(); /// Const access to the Size_Policy object used. const Size_Policy& get_size_policy() const; /// Access to the Trigger_Policy object used. Trigger_Policy& get_trigger_policy(); /// Access to the Trigger_Policy object used. const Trigger_Policy& get_trigger_policy() const; /// Returns the actual size of the container. inline size_type get_actual_size() const; /// Resizes the container to suggested_new_size, a suggested size /// (the actual size will be determined by the Size_Policy /// object). void resize(size_type suggested_new_size); protected: inline void notify_insert_search_start(); inline void notify_insert_search_collision(); inline void notify_insert_search_end(); inline void notify_find_search_start(); inline void notify_find_search_collision(); inline void notify_find_search_end(); inline void notify_erase_search_start(); inline void notify_erase_search_collision(); inline void notify_erase_search_end(); inline void notify_inserted(size_type num_e); inline void notify_erased(size_type num_e); void notify_cleared(); void notify_resized(size_type new_size); inline bool is_resize_needed() const; /// Queries what the new size should be, when the container is /// resized naturally. The current __size of the container is /// size, and the number of used entries within the container is /// num_used_e. size_type get_new_size(size_type size, size_type num_used_e) const; private: /// Resizes to new_size. virtual void do_resize(size_type new_size); typedef Trigger_Policy trigger_policy_base; typedef Size_Policy size_policy_base; size_type m_size; }; #include <ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp> #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC } // namespace __gnu_pbds #endif ���������������������������������������������������������������������������������c++/4.8.2/ext/pb_ds/tree_policy.hpp�����������������������������������������������������������������0000644�����������������00000012711�14763166030�0012513 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file tree_policy.hpp * Contains tree-related policies. */ #ifndef PB_DS_TREE_POLICY_HPP #define PB_DS_TREE_POLICY_HPP #include <bits/c++config.h> #include <iterator> #include <ext/pb_ds/detail/type_utils.hpp> #include <ext/pb_ds/detail/branch_policy/branch_policy.hpp> namespace __gnu_pbds { #define PB_DS_CLASS_T_DEC \ template<typename Node_CItr, typename Node_Itr, typename Cmp_Fn, \ typename _Alloc> #define PB_DS_CLASS_C_DEC \ tree_order_statistics_node_update<Node_CItr, Node_Itr, Cmp_Fn, _Alloc> #define PB_DS_BRANCH_POLICY_BASE \ detail::branch_policy<Node_CItr, Node_Itr, _Alloc> /// Functor updating ranks of entrees. template<typename Node_CItr, typename Node_Itr, typename Cmp_Fn, typename _Alloc> class tree_order_statistics_node_update : private PB_DS_BRANCH_POLICY_BASE { private: typedef PB_DS_BRANCH_POLICY_BASE base_type; public: typedef Cmp_Fn cmp_fn; typedef _Alloc allocator_type; typedef typename allocator_type::size_type size_type; typedef typename base_type::key_type key_type; typedef typename base_type::key_const_reference key_const_reference; typedef size_type metadata_type; typedef Node_CItr node_const_iterator; typedef Node_Itr node_iterator; typedef typename node_const_iterator::value_type const_iterator; typedef typename node_iterator::value_type iterator; /// Finds an entry by __order. Returns a const_iterator to the /// entry with the __order order, or a const_iterator to the /// container object's end if order is at least the size of the /// container object. inline const_iterator find_by_order(size_type) const; /// Finds an entry by __order. Returns an iterator to the entry /// with the __order order, or an iterator to the container /// object's end if order is at least the size of the container /// object. inline iterator find_by_order(size_type); /// Returns the order of a key within a sequence. For exapmle, if /// r_key is the smallest key, this method will return 0; if r_key /// is a key between the smallest and next key, this method will /// return 1; if r_key is a key larger than the largest key, this /// method will return the size of r_c. inline size_type order_of_key(key_const_reference) const; private: /// Const reference to the container's value-type. typedef typename base_type::const_reference const_reference; /// Const pointer to the container's value-type. typedef typename base_type::const_pointer const_pointer; typedef typename _Alloc::template rebind<metadata_type>::other __rebind_m; /// Const metadata reference. typedef typename __rebind_m::const_reference metadata_const_reference; /// Metadata reference. typedef typename __rebind_m::reference metadata_reference; /// Returns the node_const_iterator associated with the tree's root node. virtual node_const_iterator node_begin() const = 0; /// Returns the node_iterator associated with the tree's root node. virtual node_iterator node_begin() = 0; /// Returns the node_const_iterator associated with a just-after leaf node. virtual node_const_iterator node_end() const = 0; /// Returns the node_iterator associated with a just-after leaf node. virtual node_iterator node_end() = 0; /// Access to the cmp_fn object. virtual cmp_fn& get_cmp_fn() = 0; protected: /// Updates the rank of a node through a node_iterator node_it; /// end_nd_it is the end node iterator. inline void operator()(node_iterator, node_const_iterator) const; virtual ~tree_order_statistics_node_update(); }; #include <ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp> #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #undef PB_DS_BRANCH_POLICY_BASE } // namespace __gnu_pbds #endif �������������������������������������������������������c++/4.8.2/ext/stdio_sync_filebuf.h������������������������������������������������������������������0000644�����������������00000017421�14763166030�0012423 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Iostreams wrapper for stdio FILE* -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/stdio_sync_filebuf.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _STDIO_SYNC_FILEBUF_H #define _STDIO_SYNC_FILEBUF_H 1 #pragma GCC system_header #include <streambuf> #include <unistd.h> #include <cstdio> #include <bits/c++io.h> // For __c_file #ifdef _GLIBCXX_USE_WCHAR_T #include <cwchar> #endif namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Provides a layer of compatibility for C. * @ingroup io * * This GNU extension provides extensions for working with standard * C FILE*'s. It must be instantiated by the user with the type of * character used in the file stream, e.g., stdio_filebuf<char>. */ template<typename _CharT, typename _Traits = std::char_traits<_CharT> > class stdio_sync_filebuf : public std::basic_streambuf<_CharT, _Traits> { public: // Types: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; private: // Underlying stdio FILE std::__c_file* const _M_file; // Last character gotten. This is used when pbackfail is // called from basic_streambuf::sungetc() int_type _M_unget_buf; public: explicit stdio_sync_filebuf(std::__c_file* __f) : _M_file(__f), _M_unget_buf(traits_type::eof()) { } /** * @return The underlying FILE*. * * This function can be used to access the underlying C file pointer. * Note that there is no way for the library to track what you do * with the file, so be careful. */ std::__c_file* const file() { return this->_M_file; } protected: int_type syncgetc(); int_type syncungetc(int_type __c); int_type syncputc(int_type __c); virtual int_type underflow() { int_type __c = this->syncgetc(); return this->syncungetc(__c); } virtual int_type uflow() { // Store the gotten character in case we need to unget it. _M_unget_buf = this->syncgetc(); return _M_unget_buf; } virtual int_type pbackfail(int_type __c = traits_type::eof()) { int_type __ret; const int_type __eof = traits_type::eof(); // Check if the unget or putback was requested if (traits_type::eq_int_type(__c, __eof)) // unget { if (!traits_type::eq_int_type(_M_unget_buf, __eof)) __ret = this->syncungetc(_M_unget_buf); else // buffer invalid, fail. __ret = __eof; } else // putback __ret = this->syncungetc(__c); // The buffered character is no longer valid, discard it. _M_unget_buf = __eof; return __ret; } virtual std::streamsize xsgetn(char_type* __s, std::streamsize __n); virtual int_type overflow(int_type __c = traits_type::eof()) { int_type __ret; if (traits_type::eq_int_type(__c, traits_type::eof())) { if (std::fflush(_M_file)) __ret = traits_type::eof(); else __ret = traits_type::not_eof(__c); } else __ret = this->syncputc(__c); return __ret; } virtual std::streamsize xsputn(const char_type* __s, std::streamsize __n); virtual int sync() { return std::fflush(_M_file); } virtual std::streampos seekoff(std::streamoff __off, std::ios_base::seekdir __dir, std::ios_base::openmode = std::ios_base::in | std::ios_base::out) { std::streampos __ret(std::streamoff(-1)); int __whence; if (__dir == std::ios_base::beg) __whence = SEEK_SET; else if (__dir == std::ios_base::cur) __whence = SEEK_CUR; else __whence = SEEK_END; #ifdef _GLIBCXX_USE_LFS if (!fseeko64(_M_file, __off, __whence)) __ret = std::streampos(ftello64(_M_file)); #else if (!fseek(_M_file, __off, __whence)) __ret = std::streampos(std::ftell(_M_file)); #endif return __ret; } virtual std::streampos seekpos(std::streampos __pos, std::ios_base::openmode __mode = std::ios_base::in | std::ios_base::out) { return seekoff(std::streamoff(__pos), std::ios_base::beg, __mode); } }; template<> inline stdio_sync_filebuf<char>::int_type stdio_sync_filebuf<char>::syncgetc() { return std::getc(_M_file); } template<> inline stdio_sync_filebuf<char>::int_type stdio_sync_filebuf<char>::syncungetc(int_type __c) { return std::ungetc(__c, _M_file); } template<> inline stdio_sync_filebuf<char>::int_type stdio_sync_filebuf<char>::syncputc(int_type __c) { return std::putc(__c, _M_file); } template<> inline std::streamsize stdio_sync_filebuf<char>::xsgetn(char* __s, std::streamsize __n) { std::streamsize __ret = std::fread(__s, 1, __n, _M_file); if (__ret > 0) _M_unget_buf = traits_type::to_int_type(__s[__ret - 1]); else _M_unget_buf = traits_type::eof(); return __ret; } template<> inline std::streamsize stdio_sync_filebuf<char>::xsputn(const char* __s, std::streamsize __n) { return std::fwrite(__s, 1, __n, _M_file); } #ifdef _GLIBCXX_USE_WCHAR_T template<> inline stdio_sync_filebuf<wchar_t>::int_type stdio_sync_filebuf<wchar_t>::syncgetc() { return std::getwc(_M_file); } template<> inline stdio_sync_filebuf<wchar_t>::int_type stdio_sync_filebuf<wchar_t>::syncungetc(int_type __c) { return std::ungetwc(__c, _M_file); } template<> inline stdio_sync_filebuf<wchar_t>::int_type stdio_sync_filebuf<wchar_t>::syncputc(int_type __c) { return std::putwc(__c, _M_file); } template<> inline std::streamsize stdio_sync_filebuf<wchar_t>::xsgetn(wchar_t* __s, std::streamsize __n) { std::streamsize __ret = 0; const int_type __eof = traits_type::eof(); while (__n--) { int_type __c = this->syncgetc(); if (traits_type::eq_int_type(__c, __eof)) break; __s[__ret] = traits_type::to_char_type(__c); ++__ret; } if (__ret > 0) _M_unget_buf = traits_type::to_int_type(__s[__ret - 1]); else _M_unget_buf = traits_type::eof(); return __ret; } template<> inline std::streamsize stdio_sync_filebuf<wchar_t>::xsputn(const wchar_t* __s, std::streamsize __n) { std::streamsize __ret = 0; const int_type __eof = traits_type::eof(); while (__n--) { if (traits_type::eq_int_type(this->syncputc(*__s++), __eof)) break; ++__ret; } return __ret; } #endif #if _GLIBCXX_EXTERN_TEMPLATE extern template class stdio_sync_filebuf<char>; #ifdef _GLIBCXX_USE_WCHAR_T extern template class stdio_sync_filebuf<wchar_t>; #endif #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/random��������������������������������������������������������������������������������0000644�����������������00000245402�14763166030�0007605 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Random number extensions -*- C++ -*- // Copyright (C) 2012-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/random * This file is a GNU extension to the Standard C++ Library. */ #ifndef _EXT_RANDOM #define _EXT_RANDOM 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <random> #include <array> #include <ext/cmath> #ifdef __SSE2__ # include <x86intrin.h> #endif #ifdef _GLIBCXX_USE_C99_STDINT_TR1 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ /* Mersenne twister implementation optimized for vector operations. * * Reference: http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/ */ template<typename _UIntType, size_t __m, size_t __pos1, size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2, uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4, uint32_t __parity1, uint32_t __parity2, uint32_t __parity3, uint32_t __parity4> class simd_fast_mersenne_twister_engine { static_assert(std::is_unsigned<_UIntType>::value, "template argument " "substituting _UIntType not an unsigned integral type"); static_assert(__sr1 < 32, "first right shift too large"); static_assert(__sr2 < 16, "second right shift too large"); static_assert(__sl1 < 32, "first left shift too large"); static_assert(__sl2 < 16, "second left shift too large"); public: typedef _UIntType result_type; private: static constexpr size_t m_w = sizeof(result_type) * 8; static constexpr size_t _M_nstate = __m / 128 + 1; static constexpr size_t _M_nstate32 = _M_nstate * 4; static_assert(std::is_unsigned<_UIntType>::value, "template argument " "substituting _UIntType not an unsigned integral type"); static_assert(__pos1 < _M_nstate, "POS1 not smaller than state size"); static_assert(16 % sizeof(_UIntType) == 0, "UIntType size must divide 16"); public: static constexpr size_t state_size = _M_nstate * (16 / sizeof(result_type)); static constexpr result_type default_seed = 5489u; // constructors and member function explicit simd_fast_mersenne_twister_engine(result_type __sd = default_seed) { seed(__sd); } template<typename _Sseq, typename = typename std::enable_if<!std::is_same<_Sseq, simd_fast_mersenne_twister_engine>::value> ::type> explicit simd_fast_mersenne_twister_engine(_Sseq& __q) { seed(__q); } void seed(result_type __sd = default_seed); template<typename _Sseq> typename std::enable_if<std::is_class<_Sseq>::value>::type seed(_Sseq& __q); static constexpr result_type min() { return 0; }; static constexpr result_type max() { return std::numeric_limits<result_type>::max(); } void discard(unsigned long long __z); result_type operator()() { if (__builtin_expect(_M_pos >= state_size, 0)) _M_gen_rand(); return _M_stateT[_M_pos++]; } template<typename _UIntType_2, size_t __m_2, size_t __pos1_2, size_t __sl1_2, size_t __sl2_2, size_t __sr1_2, size_t __sr2_2, uint32_t __msk1_2, uint32_t __msk2_2, uint32_t __msk3_2, uint32_t __msk4_2, uint32_t __parity1_2, uint32_t __parity2_2, uint32_t __parity3_2, uint32_t __parity4_2> friend bool operator==(const simd_fast_mersenne_twister_engine<_UIntType_2, __m_2, __pos1_2, __sl1_2, __sl2_2, __sr1_2, __sr2_2, __msk1_2, __msk2_2, __msk3_2, __msk4_2, __parity1_2, __parity2_2, __parity3_2, __parity4_2>& __lhs, const simd_fast_mersenne_twister_engine<_UIntType_2, __m_2, __pos1_2, __sl1_2, __sl2_2, __sr1_2, __sr2_2, __msk1_2, __msk2_2, __msk3_2, __msk4_2, __parity1_2, __parity2_2, __parity3_2, __parity4_2>& __rhs); template<typename _UIntType_2, size_t __m_2, size_t __pos1_2, size_t __sl1_2, size_t __sl2_2, size_t __sr1_2, size_t __sr2_2, uint32_t __msk1_2, uint32_t __msk2_2, uint32_t __msk3_2, uint32_t __msk4_2, uint32_t __parity1_2, uint32_t __parity2_2, uint32_t __parity3_2, uint32_t __parity4_2, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const __gnu_cxx::simd_fast_mersenne_twister_engine <_UIntType_2, __m_2, __pos1_2, __sl1_2, __sl2_2, __sr1_2, __sr2_2, __msk1_2, __msk2_2, __msk3_2, __msk4_2, __parity1_2, __parity2_2, __parity3_2, __parity4_2>& __x); template<typename _UIntType_2, size_t __m_2, size_t __pos1_2, size_t __sl1_2, size_t __sl2_2, size_t __sr1_2, size_t __sr2_2, uint32_t __msk1_2, uint32_t __msk2_2, uint32_t __msk3_2, uint32_t __msk4_2, uint32_t __parity1_2, uint32_t __parity2_2, uint32_t __parity3_2, uint32_t __parity4_2, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType_2, __m_2, __pos1_2, __sl1_2, __sl2_2, __sr1_2, __sr2_2, __msk1_2, __msk2_2, __msk3_2, __msk4_2, __parity1_2, __parity2_2, __parity3_2, __parity4_2>& __x); private: union { #ifdef __SSE2__ __m128i _M_state[_M_nstate]; #endif uint32_t _M_state32[_M_nstate32]; result_type _M_stateT[state_size]; } __attribute__ ((__aligned__ (16))); size_t _M_pos; void _M_gen_rand(void); void _M_period_certification(); }; template<typename _UIntType, size_t __m, size_t __pos1, size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2, uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4, uint32_t __parity1, uint32_t __parity2, uint32_t __parity3, uint32_t __parity4> inline bool operator!=(const __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType, __m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4, __parity1, __parity2, __parity3, __parity4>& __lhs, const __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType, __m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4, __parity1, __parity2, __parity3, __parity4>& __rhs) { return !(__lhs == __rhs); } /* Definitions for the SIMD-oriented Fast Mersenne Twister as defined * in the C implementation by Daito and Matsumoto, as both a 32-bit * and 64-bit version. */ typedef simd_fast_mersenne_twister_engine<uint32_t, 607, 2, 15, 3, 13, 3, 0xfdff37ffU, 0xef7f3f7dU, 0xff777b7dU, 0x7ff7fb2fU, 0x00000001U, 0x00000000U, 0x00000000U, 0x5986f054U> sfmt607; typedef simd_fast_mersenne_twister_engine<uint64_t, 607, 2, 15, 3, 13, 3, 0xfdff37ffU, 0xef7f3f7dU, 0xff777b7dU, 0x7ff7fb2fU, 0x00000001U, 0x00000000U, 0x00000000U, 0x5986f054U> sfmt607_64; typedef simd_fast_mersenne_twister_engine<uint32_t, 1279, 7, 14, 3, 5, 1, 0xf7fefffdU, 0x7fefcfffU, 0xaff3ef3fU, 0xb5ffff7fU, 0x00000001U, 0x00000000U, 0x00000000U, 0x20000000U> sfmt1279; typedef simd_fast_mersenne_twister_engine<uint64_t, 1279, 7, 14, 3, 5, 1, 0xf7fefffdU, 0x7fefcfffU, 0xaff3ef3fU, 0xb5ffff7fU, 0x00000001U, 0x00000000U, 0x00000000U, 0x20000000U> sfmt1279_64; typedef simd_fast_mersenne_twister_engine<uint32_t, 2281, 12, 19, 1, 5, 1, 0xbff7ffbfU, 0xfdfffffeU, 0xf7ffef7fU, 0xf2f7cbbfU, 0x00000001U, 0x00000000U, 0x00000000U, 0x41dfa600U> sfmt2281; typedef simd_fast_mersenne_twister_engine<uint64_t, 2281, 12, 19, 1, 5, 1, 0xbff7ffbfU, 0xfdfffffeU, 0xf7ffef7fU, 0xf2f7cbbfU, 0x00000001U, 0x00000000U, 0x00000000U, 0x41dfa600U> sfmt2281_64; typedef simd_fast_mersenne_twister_engine<uint32_t, 4253, 17, 20, 1, 7, 1, 0x9f7bffffU, 0x9fffff5fU, 0x3efffffbU, 0xfffff7bbU, 0xa8000001U, 0xaf5390a3U, 0xb740b3f8U, 0x6c11486dU> sfmt4253; typedef simd_fast_mersenne_twister_engine<uint64_t, 4253, 17, 20, 1, 7, 1, 0x9f7bffffU, 0x9fffff5fU, 0x3efffffbU, 0xfffff7bbU, 0xa8000001U, 0xaf5390a3U, 0xb740b3f8U, 0x6c11486dU> sfmt4253_64; typedef simd_fast_mersenne_twister_engine<uint32_t, 11213, 68, 14, 3, 7, 3, 0xeffff7fbU, 0xffffffefU, 0xdfdfbfffU, 0x7fffdbfdU, 0x00000001U, 0x00000000U, 0xe8148000U, 0xd0c7afa3U> sfmt11213; typedef simd_fast_mersenne_twister_engine<uint64_t, 11213, 68, 14, 3, 7, 3, 0xeffff7fbU, 0xffffffefU, 0xdfdfbfffU, 0x7fffdbfdU, 0x00000001U, 0x00000000U, 0xe8148000U, 0xd0c7afa3U> sfmt11213_64; typedef simd_fast_mersenne_twister_engine<uint32_t, 19937, 122, 18, 1, 11, 1, 0xdfffffefU, 0xddfecb7fU, 0xbffaffffU, 0xbffffff6U, 0x00000001U, 0x00000000U, 0x00000000U, 0x13c9e684U> sfmt19937; typedef simd_fast_mersenne_twister_engine<uint64_t, 19937, 122, 18, 1, 11, 1, 0xdfffffefU, 0xddfecb7fU, 0xbffaffffU, 0xbffffff6U, 0x00000001U, 0x00000000U, 0x00000000U, 0x13c9e684U> sfmt19937_64; typedef simd_fast_mersenne_twister_engine<uint32_t, 44497, 330, 5, 3, 9, 3, 0xeffffffbU, 0xdfbebfffU, 0xbfbf7befU, 0x9ffd7bffU, 0x00000001U, 0x00000000U, 0xa3ac4000U, 0xecc1327aU> sfmt44497; typedef simd_fast_mersenne_twister_engine<uint64_t, 44497, 330, 5, 3, 9, 3, 0xeffffffbU, 0xdfbebfffU, 0xbfbf7befU, 0x9ffd7bffU, 0x00000001U, 0x00000000U, 0xa3ac4000U, 0xecc1327aU> sfmt44497_64; typedef simd_fast_mersenne_twister_engine<uint32_t, 86243, 366, 6, 7, 19, 1, 0xfdbffbffU, 0xbff7ff3fU, 0xfd77efffU, 0xbf9ff3ffU, 0x00000001U, 0x00000000U, 0x00000000U, 0xe9528d85U> sfmt86243; typedef simd_fast_mersenne_twister_engine<uint64_t, 86243, 366, 6, 7, 19, 1, 0xfdbffbffU, 0xbff7ff3fU, 0xfd77efffU, 0xbf9ff3ffU, 0x00000001U, 0x00000000U, 0x00000000U, 0xe9528d85U> sfmt86243_64; typedef simd_fast_mersenne_twister_engine<uint32_t, 132049, 110, 19, 1, 21, 1, 0xffffbb5fU, 0xfb6ebf95U, 0xfffefffaU, 0xcff77fffU, 0x00000001U, 0x00000000U, 0xcb520000U, 0xc7e91c7dU> sfmt132049; typedef simd_fast_mersenne_twister_engine<uint64_t, 132049, 110, 19, 1, 21, 1, 0xffffbb5fU, 0xfb6ebf95U, 0xfffefffaU, 0xcff77fffU, 0x00000001U, 0x00000000U, 0xcb520000U, 0xc7e91c7dU> sfmt132049_64; typedef simd_fast_mersenne_twister_engine<uint32_t, 216091, 627, 11, 3, 10, 1, 0xbff7bff7U, 0xbfffffffU, 0xbffffa7fU, 0xffddfbfbU, 0xf8000001U, 0x89e80709U, 0x3bd2b64bU, 0x0c64b1e4U> sfmt216091; typedef simd_fast_mersenne_twister_engine<uint64_t, 216091, 627, 11, 3, 10, 1, 0xbff7bff7U, 0xbfffffffU, 0xbffffa7fU, 0xffddfbfbU, 0xf8000001U, 0x89e80709U, 0x3bd2b64bU, 0x0c64b1e4U> sfmt216091_64; #endif // __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ /** * @brief A beta continuous distribution for random numbers. * * The formula for the beta probability density function is: * @f[ * p(x|\alpha,\beta) = \frac{1}{B(\alpha,\beta)} * x^{\alpha - 1} (1 - x)^{\beta - 1} * @f] */ template<typename _RealType = double> class beta_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef beta_distribution<_RealType> distribution_type; friend class beta_distribution<_RealType>; explicit param_type(_RealType __alpha_val = _RealType(1), _RealType __beta_val = _RealType(1)) : _M_alpha(__alpha_val), _M_beta(__beta_val) { _GLIBCXX_DEBUG_ASSERT(_M_alpha > _RealType(0)); _GLIBCXX_DEBUG_ASSERT(_M_beta > _RealType(0)); } _RealType alpha() const { return _M_alpha; } _RealType beta() const { return _M_beta; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return (__p1._M_alpha == __p2._M_alpha && __p1._M_beta == __p2._M_beta); } private: void _M_initialize(); _RealType _M_alpha; _RealType _M_beta; }; public: /** * @brief Constructs a beta distribution with parameters * @f$\alpha@f$ and @f$\beta@f$. */ explicit beta_distribution(_RealType __alpha_val = _RealType(1), _RealType __beta_val = _RealType(1)) : _M_param(__alpha_val, __beta_val) { } explicit beta_distribution(const param_type& __p) : _M_param(__p) { } /** * @brief Resets the distribution state. */ void reset() { } /** * @brief Returns the @f$\alpha@f$ of the distribution. */ _RealType alpha() const { return _M_param.alpha(); } /** * @brief Returns the @f$\beta@f$ of the distribution. */ _RealType beta() const { return _M_param.beta(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return result_type(0); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return result_type(1); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two beta distributions have the same * parameters and the sequences that would be generated * are equal. */ friend bool operator==(const beta_distribution& __d1, const beta_distribution& __d2) { return __d1._M_param == __d2._M_param; } /** * @brief Inserts a %beta_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %beta_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const __gnu_cxx::beta_distribution<_RealType1>& __x); /** * @brief Extracts a %beta_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %beta_distribution random number generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, __gnu_cxx::beta_distribution<_RealType1>& __x); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; }; /** * @brief Return true if two beta distributions are different. */ template<typename _RealType> inline bool operator!=(const __gnu_cxx::beta_distribution<_RealType>& __d1, const __gnu_cxx::beta_distribution<_RealType>& __d2) { return !(__d1 == __d2); } /** * @brief A multi-variate normal continuous distribution for random numbers. * * The formula for the normal probability density function is * @f[ * p(\overrightarrow{x}|\overrightarrow{\mu },\Sigma) = * \frac{1}{\sqrt{(2\pi )^k\det(\Sigma))}} * e^{-\frac{1}{2}(\overrightarrow{x}-\overrightarrow{\mu})^\text{T} * \Sigma ^{-1}(\overrightarrow{x}-\overrightarrow{\mu})} * @f] * * where @f$\overrightarrow{x}@f$ and @f$\overrightarrow{\mu}@f$ are * vectors of dimension @f$k@f$ and @f$\Sigma@f$ is the covariance * matrix (which must be positive-definite). */ template<std::size_t _Dimen, typename _RealType = double> class normal_mv_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); static_assert(_Dimen != 0, "dimension is zero"); public: /** The type of the range of the distribution. */ typedef std::array<_RealType, _Dimen> result_type; /** Parameter type. */ class param_type { static constexpr size_t _M_t_size = _Dimen * (_Dimen + 1) / 2; public: typedef normal_mv_distribution<_Dimen, _RealType> distribution_type; friend class normal_mv_distribution<_Dimen, _RealType>; param_type() { std::fill(_M_mean.begin(), _M_mean.end(), _RealType(0)); auto __it = _M_t.begin(); for (size_t __i = 0; __i < _Dimen; ++__i) { std::fill_n(__it, __i, _RealType(0)); __it += __i; *__it++ = _RealType(1); } } template<typename _ForwardIterator1, typename _ForwardIterator2> param_type(_ForwardIterator1 __meanbegin, _ForwardIterator1 __meanend, _ForwardIterator2 __varcovbegin, _ForwardIterator2 __varcovend) { __glibcxx_function_requires(_ForwardIteratorConcept< _ForwardIterator1>) __glibcxx_function_requires(_ForwardIteratorConcept< _ForwardIterator2>) _GLIBCXX_DEBUG_ASSERT(std::distance(__meanbegin, __meanend) <= _Dimen); const auto __dist = std::distance(__varcovbegin, __varcovend); _GLIBCXX_DEBUG_ASSERT(__dist == _Dimen * _Dimen || __dist == _Dimen * (_Dimen + 1) / 2 || __dist == _Dimen); if (__dist == _Dimen * _Dimen) _M_init_full(__meanbegin, __meanend, __varcovbegin, __varcovend); else if (__dist == _Dimen * (_Dimen + 1) / 2) _M_init_lower(__meanbegin, __meanend, __varcovbegin, __varcovend); else _M_init_diagonal(__meanbegin, __meanend, __varcovbegin, __varcovend); } param_type(std::initializer_list<_RealType> __mean, std::initializer_list<_RealType> __varcov) { _GLIBCXX_DEBUG_ASSERT(__mean.size() <= _Dimen); _GLIBCXX_DEBUG_ASSERT(__varcov.size() == _Dimen * _Dimen || __varcov.size() == _Dimen * (_Dimen + 1) / 2 || __varcov.size() == _Dimen); if (__varcov.size() == _Dimen * _Dimen) _M_init_full(__mean.begin(), __mean.end(), __varcov.begin(), __varcov.end()); else if (__varcov.size() == _Dimen * (_Dimen + 1) / 2) _M_init_lower(__mean.begin(), __mean.end(), __varcov.begin(), __varcov.end()); else _M_init_diagonal(__mean.begin(), __mean.end(), __varcov.begin(), __varcov.end()); } std::array<_RealType, _Dimen> mean() const { return _M_mean; } std::array<_RealType, _M_t_size> varcov() const { return _M_t; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_mean == __p2._M_mean && __p1._M_t == __p2._M_t; } private: template <typename _InputIterator1, typename _InputIterator2> void _M_init_full(_InputIterator1 __meanbegin, _InputIterator1 __meanend, _InputIterator2 __varcovbegin, _InputIterator2 __varcovend); template <typename _InputIterator1, typename _InputIterator2> void _M_init_lower(_InputIterator1 __meanbegin, _InputIterator1 __meanend, _InputIterator2 __varcovbegin, _InputIterator2 __varcovend); template <typename _InputIterator1, typename _InputIterator2> void _M_init_diagonal(_InputIterator1 __meanbegin, _InputIterator1 __meanend, _InputIterator2 __varbegin, _InputIterator2 __varend); std::array<_RealType, _Dimen> _M_mean; std::array<_RealType, _M_t_size> _M_t; }; public: normal_mv_distribution() : _M_param(), _M_nd() { } template<typename _ForwardIterator1, typename _ForwardIterator2> normal_mv_distribution(_ForwardIterator1 __meanbegin, _ForwardIterator1 __meanend, _ForwardIterator2 __varcovbegin, _ForwardIterator2 __varcovend) : _M_param(__meanbegin, __meanend, __varcovbegin, __varcovend), _M_nd() { } normal_mv_distribution(std::initializer_list<_RealType> __mean, std::initializer_list<_RealType> __varcov) : _M_param(__mean, __varcov), _M_nd() { } explicit normal_mv_distribution(const param_type& __p) : _M_param(__p), _M_nd() { } /** * @brief Resets the distribution state. */ void reset() { _M_nd.reset(); } /** * @brief Returns the mean of the distribution. */ result_type mean() const { return _M_param.mean(); } /** * @brief Returns the compact form of the variance/covariance * matrix of the distribution. */ std::array<_RealType, _Dimen * (_Dimen + 1) / 2> varcov() const { return _M_param.varcov(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { result_type __res; __res.fill(std::numeric_limits<_RealType>::lowest()); return __res; } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { result_type __res; __res.fill(std::numeric_limits<_RealType>::max()); return __res; } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { return this->__generate_impl(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { return this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two multi-variant normal distributions have * the same parameters and the sequences that would * be generated are equal. */ template<size_t _Dimen1, typename _RealType1> friend bool operator==(const __gnu_cxx::normal_mv_distribution<_Dimen1, _RealType1>& __d1, const __gnu_cxx::normal_mv_distribution<_Dimen1, _RealType1>& __d2); /** * @brief Inserts a %normal_mv_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %normal_mv_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<size_t _Dimen1, typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const __gnu_cxx::normal_mv_distribution<_Dimen1, _RealType1>& __x); /** * @brief Extracts a %normal_mv_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %normal_mv_distribution random number generator engine. * * @returns The input stream with @p __x extracted or in an error * state. */ template<size_t _Dimen1, typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, __gnu_cxx::normal_mv_distribution<_Dimen1, _RealType1>& __x); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; std::normal_distribution<_RealType> _M_nd; }; /** * @brief Return true if two multi-variate normal distributions are * different. */ template<size_t _Dimen, typename _RealType> inline bool operator!=(const __gnu_cxx::normal_mv_distribution<_Dimen, _RealType>& __d1, const __gnu_cxx::normal_mv_distribution<_Dimen, _RealType>& __d2) { return !(__d1 == __d2); } /** * @brief A Rice continuous distribution for random numbers. * * The formula for the Rice probability density function is * @f[ * p(x|\nu,\sigma) = \frac{x}{\sigma^2} * \exp\left(-\frac{x^2+\nu^2}{2\sigma^2}\right) * I_0\left(\frac{x \nu}{\sigma^2}\right) * @f] * where @f$I_0(z)@f$ is the modified Bessel function of the first kind * of order 0 and @f$\nu >= 0@f$ and @f$\sigma > 0@f$. * * <table border=1 cellpadding=10 cellspacing=0> * <caption align=top>Distribution Statistics</caption> * <tr><td>Mean</td><td>@f$\sqrt{\pi/2}L_{1/2}(-\nu^2/2\sigma^2)@f$</td></tr> * <tr><td>Variance</td><td>@f$2\sigma^2 + \nu^2 * + (\pi\sigma^2/2)L^2_{1/2}(-\nu^2/2\sigma^2)@f$</td></tr> * <tr><td>Range</td><td>@f$[0, \infty)@f$</td></tr> * </table> * where @f$L_{1/2}(x)@f$ is the Laguerre polynomial of order 1/2. */ template<typename _RealType = double> class rice_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef rice_distribution<result_type> distribution_type; param_type(result_type __nu_val = result_type(0), result_type __sigma_val = result_type(1)) : _M_nu(__nu_val), _M_sigma(__sigma_val) { _GLIBCXX_DEBUG_ASSERT(_M_nu >= result_type(0)); _GLIBCXX_DEBUG_ASSERT(_M_sigma > result_type(0)); } result_type nu() const { return _M_nu; } result_type sigma() const { return _M_sigma; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_nu == __p2._M_nu && __p1._M_sigma == __p2._M_sigma; } private: void _M_initialize(); result_type _M_nu; result_type _M_sigma; }; /** * @brief Constructors. */ explicit rice_distribution(result_type __nu_val = result_type(0), result_type __sigma_val = result_type(1)) : _M_param(__nu_val, __sigma_val), _M_ndx(__nu_val, __sigma_val), _M_ndy(result_type(0), __sigma_val) { } explicit rice_distribution(const param_type& __p) : _M_param(__p), _M_ndx(__p.nu(), __p.sigma()), _M_ndy(result_type(0), __p.sigma()) { } /** * @brief Resets the distribution state. */ void reset() { _M_ndx.reset(); _M_ndy.reset(); } /** * @brief Return the parameters of the distribution. */ result_type nu() const { return _M_param.nu(); } result_type sigma() const { return _M_param.sigma(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return result_type(0); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return std::numeric_limits<result_type>::max(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { result_type __x = this->_M_ndx(__urng); result_type __y = this->_M_ndy(__urng); #if _GLIBCXX_USE_C99_MATH_TR1 return std::hypot(__x, __y); #else return std::sqrt(__x * __x + __y * __y); #endif } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { typename std::normal_distribution<result_type>::param_type __px(__p.nu(), __p.sigma()), __py(result_type(0), __p.sigma()); result_type __x = this->_M_ndx(__px, __urng); result_type __y = this->_M_ndy(__py, __urng); #if _GLIBCXX_USE_C99_MATH_TR1 return std::hypot(__x, __y); #else return std::sqrt(__x * __x + __y * __y); #endif } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two Rice distributions have * the same parameters and the sequences that would * be generated are equal. */ friend bool operator==(const rice_distribution& __d1, const rice_distribution& __d2) { return (__d1._M_param == __d2._M_param && __d1._M_ndx == __d2._M_ndx && __d1._M_ndy == __d2._M_ndy); } /** * @brief Inserts a %rice_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %rice_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>&, const rice_distribution<_RealType1>&); /** * @brief Extracts a %rice_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %rice_distribution random number * generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>&, rice_distribution<_RealType1>&); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; std::normal_distribution<result_type> _M_ndx; std::normal_distribution<result_type> _M_ndy; }; /** * @brief Return true if two Rice distributions are not equal. */ template<typename _RealType1> inline bool operator!=(const rice_distribution<_RealType1>& __d1, const rice_distribution<_RealType1>& __d2) { return !(__d1 == __d2); } /** * @brief A Nakagami continuous distribution for random numbers. * * The formula for the Nakagami probability density function is * @f[ * p(x|\mu,\omega) = \frac{2\mu^\mu}{\Gamma(\mu)\omega^\mu} * x^{2\mu-1}e^{-\mu x / \omega} * @f] * where @f$\Gamma(z)@f$ is the gamma function and @f$\mu >= 0.5@f$ * and @f$\omega > 0@f$. */ template<typename _RealType = double> class nakagami_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef nakagami_distribution<result_type> distribution_type; param_type(result_type __mu_val = result_type(1), result_type __omega_val = result_type(1)) : _M_mu(__mu_val), _M_omega(__omega_val) { _GLIBCXX_DEBUG_ASSERT(_M_mu >= result_type(0.5L)); _GLIBCXX_DEBUG_ASSERT(_M_omega > result_type(0)); } result_type mu() const { return _M_mu; } result_type omega() const { return _M_omega; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_mu == __p2._M_mu && __p1._M_omega == __p2._M_omega; } private: void _M_initialize(); result_type _M_mu; result_type _M_omega; }; /** * @brief Constructors. */ explicit nakagami_distribution(result_type __mu_val = result_type(1), result_type __omega_val = result_type(1)) : _M_param(__mu_val, __omega_val), _M_gd(__mu_val, __omega_val / __mu_val) { } explicit nakagami_distribution(const param_type& __p) : _M_param(__p), _M_gd(__p.mu(), __p.omega() / __p.mu()) { } /** * @brief Resets the distribution state. */ void reset() { _M_gd.reset(); } /** * @brief Return the parameters of the distribution. */ result_type mu() const { return _M_param.mu(); } result_type omega() const { return _M_param.omega(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return result_type(0); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return std::numeric_limits<result_type>::max(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return std::sqrt(this->_M_gd(__urng)); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { typename std::gamma_distribution<result_type>::param_type __pg(__p.mu(), __p.omega() / __p.mu()); return std::sqrt(this->_M_gd(__pg, __urng)); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two Nakagami distributions have * the same parameters and the sequences that would * be generated are equal. */ friend bool operator==(const nakagami_distribution& __d1, const nakagami_distribution& __d2) { return (__d1._M_param == __d2._M_param && __d1._M_gd == __d2._M_gd); } /** * @brief Inserts a %nakagami_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %nakagami_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>&, const nakagami_distribution<_RealType1>&); /** * @brief Extracts a %nakagami_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %nakagami_distribution random number * generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>&, nakagami_distribution<_RealType1>&); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; std::gamma_distribution<result_type> _M_gd; }; /** * @brief Return true if two Nakagami distributions are not equal. */ template<typename _RealType> inline bool operator!=(const nakagami_distribution<_RealType>& __d1, const nakagami_distribution<_RealType>& __d2) { return !(__d1 == __d2); } /** * @brief A Pareto continuous distribution for random numbers. * * The formula for the Pareto cumulative probability function is * @f[ * P(x|\alpha,\mu) = 1 - \left(\frac{\mu}{x}\right)^\alpha * @f] * The formula for the Pareto probability density function is * @f[ * p(x|\alpha,\mu) = \frac{\alpha + 1}{\mu} * \left(\frac{\mu}{x}\right)^{\alpha + 1} * @f] * where @f$x >= \mu@f$ and @f$\mu > 0@f$, @f$\alpha > 0@f$. * * <table border=1 cellpadding=10 cellspacing=0> * <caption align=top>Distribution Statistics</caption> * <tr><td>Mean</td><td>@f$\alpha \mu / (\alpha - 1)@f$ * for @f$\alpha > 1@f$</td></tr> * <tr><td>Variance</td><td>@f$\alpha \mu^2 / [(\alpha - 1)^2(\alpha - 2)]@f$ * for @f$\alpha > 2@f$</td></tr> * <tr><td>Range</td><td>@f$[\mu, \infty)@f$</td></tr> * </table> */ template<typename _RealType = double> class pareto_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef pareto_distribution<result_type> distribution_type; param_type(result_type __alpha_val = result_type(1), result_type __mu_val = result_type(1)) : _M_alpha(__alpha_val), _M_mu(__mu_val) { _GLIBCXX_DEBUG_ASSERT(_M_alpha > result_type(0)); _GLIBCXX_DEBUG_ASSERT(_M_mu > result_type(0)); } result_type alpha() const { return _M_alpha; } result_type mu() const { return _M_mu; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_alpha == __p2._M_alpha && __p1._M_mu == __p2._M_mu; } private: void _M_initialize(); result_type _M_alpha; result_type _M_mu; }; /** * @brief Constructors. */ explicit pareto_distribution(result_type __alpha_val = result_type(1), result_type __mu_val = result_type(1)) : _M_param(__alpha_val, __mu_val), _M_ud() { } explicit pareto_distribution(const param_type& __p) : _M_param(__p), _M_ud() { } /** * @brief Resets the distribution state. */ void reset() { _M_ud.reset(); } /** * @brief Return the parameters of the distribution. */ result_type alpha() const { return _M_param.alpha(); } result_type mu() const { return _M_param.mu(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return this->mu(); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return std::numeric_limits<result_type>::max(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->mu() * std::pow(this->_M_ud(__urng), -result_type(1) / this->alpha()); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { return __p.mu() * std::pow(this->_M_ud(__urng), -result_type(1) / __p.alpha()); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two Pareto distributions have * the same parameters and the sequences that would * be generated are equal. */ friend bool operator==(const pareto_distribution& __d1, const pareto_distribution& __d2) { return (__d1._M_param == __d2._M_param && __d1._M_ud == __d2._M_ud); } /** * @brief Inserts a %pareto_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %pareto_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>&, const pareto_distribution<_RealType1>&); /** * @brief Extracts a %pareto_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %pareto_distribution random number * generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>&, pareto_distribution<_RealType1>&); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; std::uniform_real_distribution<result_type> _M_ud; }; /** * @brief Return true if two Pareto distributions are not equal. */ template<typename _RealType> inline bool operator!=(const pareto_distribution<_RealType>& __d1, const pareto_distribution<_RealType>& __d2) { return !(__d1 == __d2); } /** * @brief A K continuous distribution for random numbers. * * The formula for the K probability density function is * @f[ * p(x|\lambda, \mu, \nu) = \frac{2}{x} * \left(\frac{\lambda\nu x}{\mu}\right)^{\frac{\lambda + \nu}{2}} * \frac{1}{\Gamma(\lambda)\Gamma(\nu)} * K_{\nu - \lambda}\left(2\sqrt{\frac{\lambda\nu x}{\mu}}\right) * @f] * where @f$I_0(z)@f$ is the modified Bessel function of the second kind * of order @f$\nu - \lambda@f$ and @f$\lambda > 0@f$, @f$\mu > 0@f$ * and @f$\nu > 0@f$. * * <table border=1 cellpadding=10 cellspacing=0> * <caption align=top>Distribution Statistics</caption> * <tr><td>Mean</td><td>@f$\mu@f$</td></tr> * <tr><td>Variance</td><td>@f$\mu^2\frac{\lambda + \nu + 1}{\lambda\nu}@f$</td></tr> * <tr><td>Range</td><td>@f$[0, \infty)@f$</td></tr> * </table> */ template<typename _RealType = double> class k_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef k_distribution<result_type> distribution_type; param_type(result_type __lambda_val = result_type(1), result_type __mu_val = result_type(1), result_type __nu_val = result_type(1)) : _M_lambda(__lambda_val), _M_mu(__mu_val), _M_nu(__nu_val) { _GLIBCXX_DEBUG_ASSERT(_M_lambda > result_type(0)); _GLIBCXX_DEBUG_ASSERT(_M_mu > result_type(0)); _GLIBCXX_DEBUG_ASSERT(_M_nu > result_type(0)); } result_type lambda() const { return _M_lambda; } result_type mu() const { return _M_mu; } result_type nu() const { return _M_nu; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_lambda == __p2._M_lambda && __p1._M_mu == __p2._M_mu && __p1._M_nu == __p2._M_nu; } private: void _M_initialize(); result_type _M_lambda; result_type _M_mu; result_type _M_nu; }; /** * @brief Constructors. */ explicit k_distribution(result_type __lambda_val = result_type(1), result_type __mu_val = result_type(1), result_type __nu_val = result_type(1)) : _M_param(__lambda_val, __mu_val, __nu_val), _M_gd1(__lambda_val, result_type(1) / __lambda_val), _M_gd2(__nu_val, __mu_val / __nu_val) { } explicit k_distribution(const param_type& __p) : _M_param(__p), _M_gd1(__p.lambda(), result_type(1) / __p.lambda()), _M_gd2(__p.nu(), __p.mu() / __p.nu()) { } /** * @brief Resets the distribution state. */ void reset() { _M_gd1.reset(); _M_gd2.reset(); } /** * @brief Return the parameters of the distribution. */ result_type lambda() const { return _M_param.lambda(); } result_type mu() const { return _M_param.mu(); } result_type nu() const { return _M_param.nu(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return result_type(0); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return std::numeric_limits<result_type>::max(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator&); template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator&, const param_type&); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two K distributions have * the same parameters and the sequences that would * be generated are equal. */ friend bool operator==(const k_distribution& __d1, const k_distribution& __d2) { return (__d1._M_param == __d2._M_param && __d1._M_gd1 == __d2._M_gd1 && __d1._M_gd2 == __d2._M_gd2); } /** * @brief Inserts a %k_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %k_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>&, const k_distribution<_RealType1>&); /** * @brief Extracts a %k_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %k_distribution random number * generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>&, k_distribution<_RealType1>&); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; std::gamma_distribution<result_type> _M_gd1; std::gamma_distribution<result_type> _M_gd2; }; /** * @brief Return true if two K distributions are not equal. */ template<typename _RealType> inline bool operator!=(const k_distribution<_RealType>& __d1, const k_distribution<_RealType>& __d2) { return !(__d1 == __d2); } /** * @brief An arcsine continuous distribution for random numbers. * * The formula for the arcsine probability density function is * @f[ * p(x|a,b) = \frac{1}{\pi \sqrt{(x - a)(b - x)}} * @f] * where @f$x >= a@f$ and @f$x <= b@f$. * * <table border=1 cellpadding=10 cellspacing=0> * <caption align=top>Distribution Statistics</caption> * <tr><td>Mean</td><td>@f$ (a + b) / 2 @f$</td></tr> * <tr><td>Variance</td><td>@f$ (b - a)^2 / 8 @f$</td></tr> * <tr><td>Range</td><td>@f$[a, b]@f$</td></tr> * </table> */ template<typename _RealType = double> class arcsine_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef arcsine_distribution<result_type> distribution_type; param_type(result_type __a = result_type(0), result_type __b = result_type(1)) : _M_a(__a), _M_b(__b) { _GLIBCXX_DEBUG_ASSERT(_M_a <= _M_b); } result_type a() const { return _M_a; } result_type b() const { return _M_b; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; } private: void _M_initialize(); result_type _M_a; result_type _M_b; }; /** * @brief Constructors. */ explicit arcsine_distribution(result_type __a = result_type(0), result_type __b = result_type(1)) : _M_param(__a, __b), _M_ud(-1.5707963267948966192313216916397514L, +1.5707963267948966192313216916397514L) { } explicit arcsine_distribution(const param_type& __p) : _M_param(__p), _M_ud(-1.5707963267948966192313216916397514L, +1.5707963267948966192313216916397514L) { } /** * @brief Resets the distribution state. */ void reset() { _M_ud.reset(); } /** * @brief Return the parameters of the distribution. */ result_type a() const { return _M_param.a(); } result_type b() const { return _M_param.b(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return this->a(); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return this->b(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { result_type __x = std::sin(this->_M_ud(__urng)); return (__x * (this->b() - this->a()) + this->a() + this->b()) / result_type(2); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { result_type __x = std::sin(this->_M_ud(__urng)); return (__x * (__p.b() - __p.a()) + __p.a() + __p.b()) / result_type(2); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two arcsine distributions have * the same parameters and the sequences that would * be generated are equal. */ friend bool operator==(const arcsine_distribution& __d1, const arcsine_distribution& __d2) { return (__d1._M_param == __d2._M_param && __d1._M_ud == __d2._M_ud); } /** * @brief Inserts a %arcsine_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %arcsine_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>&, const arcsine_distribution<_RealType1>&); /** * @brief Extracts a %arcsine_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %arcsine_distribution random number * generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>&, arcsine_distribution<_RealType1>&); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; std::uniform_real_distribution<result_type> _M_ud; }; /** * @brief Return true if two arcsine distributions are not equal. */ template<typename _RealType> inline bool operator!=(const arcsine_distribution<_RealType>& __d1, const arcsine_distribution<_RealType>& __d2) { return !(__d1 == __d2); } /** * @brief A Hoyt continuous distribution for random numbers. * * The formula for the Hoyt probability density function is * @f[ * p(x|q,\omega) = \frac{(1 + q^2)x}{q\omega} * \exp\left(-\frac{(1 + q^2)^2 x^2}{4 q^2 \omega}\right) * I_0\left(\frac{(1 - q^4) x^2}{4 q^2 \omega}\right) * @f] * where @f$I_0(z)@f$ is the modified Bessel function of the first kind * of order 0 and @f$0 < q < 1@f$. * * <table border=1 cellpadding=10 cellspacing=0> * <caption align=top>Distribution Statistics</caption> * <tr><td>Mean</td><td>@f$ \sqrt{\frac{2}{\pi}} \sqrt{\frac{\omega}{1 + q^2}} * E(1 - q^2) @f$</td></tr> * <tr><td>Variance</td><td>@f$ \omega \left(1 - \frac{2E^2(1 - q^2)} * {\pi (1 + q^2)}\right) @f$</td></tr> * <tr><td>Range</td><td>@f$[0, \infty)@f$</td></tr> * </table> * where @f$E(x)@f$ is the elliptic function of the second kind. */ template<typename _RealType = double> class hoyt_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef hoyt_distribution<result_type> distribution_type; param_type(result_type __q = result_type(0.5L), result_type __omega = result_type(1)) : _M_q(__q), _M_omega(__omega) { _GLIBCXX_DEBUG_ASSERT(_M_q > result_type(0)); _GLIBCXX_DEBUG_ASSERT(_M_q < result_type(1)); } result_type q() const { return _M_q; } result_type omega() const { return _M_omega; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_q == __p2._M_q && __p1._M_omega == __p2._M_omega; } private: void _M_initialize(); result_type _M_q; result_type _M_omega; }; /** * @brief Constructors. */ explicit hoyt_distribution(result_type __q = result_type(0.5L), result_type __omega = result_type(1)) : _M_param(__q, __omega), _M_ad(result_type(0.5L) * (result_type(1) + __q * __q), result_type(0.5L) * (result_type(1) + __q * __q) / (__q * __q)), _M_ed(result_type(1)) { } explicit hoyt_distribution(const param_type& __p) : _M_param(__p), _M_ad(result_type(0.5L) * (result_type(1) + __p.q() * __p.q()), result_type(0.5L) * (result_type(1) + __p.q() * __p.q()) / (__p.q() * __p.q())), _M_ed(result_type(1)) { } /** * @brief Resets the distribution state. */ void reset() { _M_ad.reset(); _M_ed.reset(); } /** * @brief Return the parameters of the distribution. */ result_type q() const { return _M_param.q(); } result_type omega() const { return _M_param.omega(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return result_type(0); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return std::numeric_limits<result_type>::max(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng); template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two Hoyt distributions have * the same parameters and the sequences that would * be generated are equal. */ friend bool operator==(const hoyt_distribution& __d1, const hoyt_distribution& __d2) { return (__d1._M_param == __d2._M_param && __d1._M_ad == __d2._M_ad && __d1._M_ed == __d2._M_ed); } /** * @brief Inserts a %hoyt_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %hoyt_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>&, const hoyt_distribution<_RealType1>&); /** * @brief Extracts a %hoyt_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %hoyt_distribution random number * generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>&, hoyt_distribution<_RealType1>&); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; __gnu_cxx::arcsine_distribution<result_type> _M_ad; std::exponential_distribution<result_type> _M_ed; }; /** * @brief Return true if two Hoyt distributions are not equal. */ template<typename _RealType> inline bool operator!=(const hoyt_distribution<_RealType>& __d1, const hoyt_distribution<_RealType>& __d2) { return !(__d1 == __d2); } /** * @brief A triangular distribution for random numbers. * * The formula for the triangular probability density function is * @f[ * / 0 for x < a * p(x|a,b,c) = | \frac{2(x-a)}{(c-a)(b-a)} for a <= x <= b * | \frac{2(c-x)}{(c-a)(c-b)} for b < x <= c * \ 0 for c < x * @f] * * <table border=1 cellpadding=10 cellspacing=0> * <caption align=top>Distribution Statistics</caption> * <tr><td>Mean</td><td>@f$ \frac{a+b+c}{2} @f$</td></tr> * <tr><td>Variance</td><td>@f$ \frac{a^2+b^2+c^2-ab-ac-bc} * {18}@f$</td></tr> * <tr><td>Range</td><td>@f$[a, c]@f$</td></tr> * </table> */ template<typename _RealType = double> class triangular_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { friend class triangular_distribution<_RealType>; explicit param_type(_RealType __a = _RealType(0), _RealType __b = _RealType(0.5), _RealType __c = _RealType(1)) : _M_a(__a), _M_b(__b), _M_c(__c) { _GLIBCXX_DEBUG_ASSERT(_M_a <= _M_b); _GLIBCXX_DEBUG_ASSERT(_M_b <= _M_c); _GLIBCXX_DEBUG_ASSERT(_M_a < _M_c); _M_r_ab = (_M_b - _M_a) / (_M_c - _M_a); _M_f_ab_ac = (_M_b - _M_a) * (_M_c - _M_a); _M_f_bc_ac = (_M_c - _M_b) * (_M_c - _M_a); } _RealType a() const { return _M_a; } _RealType b() const { return _M_b; } _RealType c() const { return _M_c; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return (__p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b && __p1._M_c == __p2._M_c); } private: _RealType _M_a; _RealType _M_b; _RealType _M_c; _RealType _M_r_ab; _RealType _M_f_ab_ac; _RealType _M_f_bc_ac; }; /** * @brief Constructs a triangle distribution with parameters * @f$ a @f$, @f$ b @f$ and @f$ c @f$. */ explicit triangular_distribution(result_type __a = result_type(0), result_type __b = result_type(0.5), result_type __c = result_type(1)) : _M_param(__a, __b, __c) { } explicit triangular_distribution(const param_type& __p) : _M_param(__p) { } /** * @brief Resets the distribution state. */ void reset() { } /** * @brief Returns the @f$ a @f$ of the distribution. */ result_type a() const { return _M_param.a(); } /** * @brief Returns the @f$ b @f$ of the distribution. */ result_type b() const { return _M_param.b(); } /** * @brief Returns the @f$ c @f$ of the distribution. */ result_type c() const { return _M_param.c(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return _M_param._M_a; } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return _M_param._M_c; } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { std::__detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); result_type __rnd = __aurng(); if (__rnd <= __p._M_r_ab) return __p.a() + std::sqrt(__rnd * __p._M_f_ab_ac); else return __p.c() - std::sqrt((result_type(1) - __rnd) * __p._M_f_bc_ac); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two triangle distributions have the same * parameters and the sequences that would be generated * are equal. */ friend bool operator==(const triangular_distribution& __d1, const triangular_distribution& __d2) { return __d1._M_param == __d2._M_param; } /** * @brief Inserts a %triangular_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %triangular_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const __gnu_cxx::triangular_distribution<_RealType1>& __x); /** * @brief Extracts a %triangular_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %triangular_distribution random number generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, __gnu_cxx::triangular_distribution<_RealType1>& __x); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; }; /** * @brief Return true if two triangle distributions are different. */ template<typename _RealType> inline bool operator!=(const __gnu_cxx::triangular_distribution<_RealType>& __d1, const __gnu_cxx::triangular_distribution<_RealType>& __d2) { return !(__d1 == __d2); } /** * @brief A von Mises distribution for random numbers. * * The formula for the von Mises probability density function is * @f[ * p(x|\mu,\kappa) = \frac{e^{\kappa \cos(x-\mu)}} * {2\pi I_0(\kappa)} * @f] * * The generating functions use the method according to: * * D. J. Best and N. I. Fisher, 1979. "Efficient Simulation of the * von Mises Distribution", Journal of the Royal Statistical Society. * Series C (Applied Statistics), Vol. 28, No. 2, pp. 152-157. * * <table border=1 cellpadding=10 cellspacing=0> * <caption align=top>Distribution Statistics</caption> * <tr><td>Mean</td><td>@f$ \mu @f$</td></tr> * <tr><td>Variance</td><td>@f$ 1-I_1(\kappa)/I_0(\kappa) @f$</td></tr> * <tr><td>Range</td><td>@f$[-\pi, \pi]@f$</td></tr> * </table> */ template<typename _RealType = double> class von_mises_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { friend class von_mises_distribution<_RealType>; explicit param_type(_RealType __mu = _RealType(0), _RealType __kappa = _RealType(1)) : _M_mu(__mu), _M_kappa(__kappa) { const _RealType __pi = __gnu_cxx::__math_constants<_RealType>::__pi; _GLIBCXX_DEBUG_ASSERT(_M_mu >= -__pi && _M_mu <= __pi); _GLIBCXX_DEBUG_ASSERT(_M_kappa >= _RealType(0)); auto __tau = std::sqrt(_RealType(4) * _M_kappa * _M_kappa + _RealType(1)) + _RealType(1); auto __rho = ((__tau - std::sqrt(_RealType(2) * __tau)) / (_RealType(2) * _M_kappa)); _M_r = (_RealType(1) + __rho * __rho) / (_RealType(2) * __rho); } _RealType mu() const { return _M_mu; } _RealType kappa() const { return _M_kappa; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return (__p1._M_mu == __p2._M_mu && __p1._M_kappa == __p2._M_kappa); } private: _RealType _M_mu; _RealType _M_kappa; _RealType _M_r; }; /** * @brief Constructs a von Mises distribution with parameters * @f$\mu@f$ and @f$\kappa@f$. */ explicit von_mises_distribution(result_type __mu = result_type(0), result_type __kappa = result_type(1)) : _M_param(__mu, __kappa) { } explicit von_mises_distribution(const param_type& __p) : _M_param(__p) { } /** * @brief Resets the distribution state. */ void reset() { } /** * @brief Returns the @f$ \mu @f$ of the distribution. */ result_type mu() const { return _M_param.mu(); } /** * @brief Returns the @f$ \kappa @f$ of the distribution. */ result_type kappa() const { return _M_param.kappa(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return -__gnu_cxx::__math_constants<result_type>::__pi; } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return __gnu_cxx::__math_constants<result_type>::__pi; } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { const result_type __pi = __gnu_cxx::__math_constants<result_type>::__pi; std::__detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); result_type __f; while (1) { result_type __rnd = std::cos(__pi * __aurng()); __f = (result_type(1) + __p._M_r * __rnd) / (__p._M_r + __rnd); result_type __c = __p._M_kappa * (__p._M_r - __f); result_type __rnd2 = __aurng(); if (__c * (result_type(2) - __c) > __rnd2) break; if (std::log(__c / __rnd2) >= __c - result_type(1)) break; } result_type __res = std::acos(__f); #if _GLIBCXX_USE_C99_MATH_TR1 __res = std::copysign(__res, __aurng() - result_type(0.5)); #else if (__aurng() < result_type(0.5)) __res = -__res; #endif __res += __p._M_mu; if (__res > __pi) __res -= result_type(2) * __pi; else if (__res < -__pi) __res += result_type(2) * __pi; return __res; } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two von Mises distributions have the same * parameters and the sequences that would be generated * are equal. */ friend bool operator==(const von_mises_distribution& __d1, const von_mises_distribution& __d2) { return __d1._M_param == __d2._M_param; } /** * @brief Inserts a %von_mises_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %von_mises_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const __gnu_cxx::von_mises_distribution<_RealType1>& __x); /** * @brief Extracts a %von_mises_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %von_mises_distribution random number generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, __gnu_cxx::von_mises_distribution<_RealType1>& __x); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; }; /** * @brief Return true if two von Mises distributions are different. */ template<typename _RealType> inline bool operator!=(const __gnu_cxx::von_mises_distribution<_RealType>& __d1, const __gnu_cxx::von_mises_distribution<_RealType>& __d2) { return !(__d1 == __d2); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace __gnu_cxx #include "ext/opt_random.h" #include "random.tcc" #endif // _GLIBCXX_USE_C99_STDINT_TR1 #endif // C++11 #endif // _EXT_RANDOM ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/array_allocator.h���������������������������������������������������������������������0000644�����������������00000011747�14763166030�0011734 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// array allocator -*- C++ -*- // Copyright (C) 2004-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/array_allocator.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _ARRAY_ALLOCATOR_H #define _ARRAY_ALLOCATOR_H 1 #include <bits/c++config.h> #include <new> #include <bits/functexcept.h> #include <tr1/array> #include <bits/move.h> #if __cplusplus >= 201103L #include <type_traits> #endif namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using std::size_t; using std::ptrdiff_t; /// Base class. template<typename _Tp> class array_allocator_base { public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Tp* pointer; typedef const _Tp* const_pointer; typedef _Tp& reference; typedef const _Tp& const_reference; typedef _Tp value_type; pointer address(reference __x) const _GLIBCXX_NOEXCEPT { return std::__addressof(__x); } const_pointer address(const_reference __x) const _GLIBCXX_NOEXCEPT { return std::__addressof(__x); } void deallocate(pointer, size_type) { // Does nothing. } size_type max_size() const _GLIBCXX_USE_NOEXCEPT { return size_t(-1) / sizeof(_Tp); } #if __cplusplus >= 201103L template<typename _Up, typename... _Args> void construct(_Up* __p, _Args&&... __args) { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } template<typename _Up> void destroy(_Up* __p) { __p->~_Up(); } #else // _GLIBCXX_RESOLVE_LIB_DEFECTS // 402. wrong new expression in [some_] allocator::construct void construct(pointer __p, const _Tp& __val) { ::new((void *)__p) value_type(__val); } void destroy(pointer __p) { __p->~_Tp(); } #endif }; /** * @brief An allocator that uses previously allocated memory. * This memory can be externally, globally, or otherwise allocated. * @ingroup allocators */ template<typename _Tp, typename _Array = std::tr1::array<_Tp, 1> > class array_allocator : public array_allocator_base<_Tp> { public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Tp* pointer; typedef const _Tp* const_pointer; typedef _Tp& reference; typedef const _Tp& const_reference; typedef _Tp value_type; typedef _Array array_type; #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2103. std::allocator propagate_on_container_move_assignment typedef std::true_type propagate_on_container_move_assignment; #endif private: array_type* _M_array; size_type _M_used; public: template<typename _Tp1, typename _Array1 = _Array> struct rebind { typedef array_allocator<_Tp1, _Array1> other; }; array_allocator(array_type* __array = 0) _GLIBCXX_USE_NOEXCEPT : _M_array(__array), _M_used(size_type()) { } array_allocator(const array_allocator& __o) _GLIBCXX_USE_NOEXCEPT : _M_array(__o._M_array), _M_used(__o._M_used) { } template<typename _Tp1, typename _Array1> array_allocator(const array_allocator<_Tp1, _Array1>&) _GLIBCXX_USE_NOEXCEPT : _M_array(0), _M_used(size_type()) { } ~array_allocator() _GLIBCXX_USE_NOEXCEPT { } pointer allocate(size_type __n, const void* = 0) { if (_M_array == 0 || _M_used + __n > _M_array->size()) std::__throw_bad_alloc(); pointer __ret = _M_array->begin() + _M_used; _M_used += __n; return __ret; } }; template<typename _Tp, typename _Array> inline bool operator==(const array_allocator<_Tp, _Array>&, const array_allocator<_Tp, _Array>&) { return true; } template<typename _Tp, typename _Array> inline bool operator!=(const array_allocator<_Tp, _Array>&, const array_allocator<_Tp, _Array>&) { return false; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif �������������������������c++/4.8.2/ext/cmath���������������������������������������������������������������������������������0000644�����������������00000014645�14763166030�0007424 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Math extensions -*- C++ -*- // Copyright (C) 2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/cmath * This file is a GNU extension to the Standard C++ Library. */ #ifndef _EXT_CMATH #define _EXT_CMATH 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <cmath> #include <type_traits> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // A class for math constants. template<typename _RealType> struct __math_constants { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); // Constant @f$ \pi @f$. static constexpr _RealType __pi = 3.1415926535897932384626433832795029L; // Constant @f$ \pi / 2 @f$. static constexpr _RealType __pi_half = 1.5707963267948966192313216916397514L; // Constant @f$ \pi / 3 @f$. static constexpr _RealType __pi_third = 1.0471975511965977461542144610931676L; // Constant @f$ \pi / 4 @f$. static constexpr _RealType __pi_quarter = 0.7853981633974483096156608458198757L; // Constant @f$ \sqrt(\pi / 2) @f$. static constexpr _RealType __root_pi_div_2 = 1.2533141373155002512078826424055226L; // Constant @f$ 1 / \pi @f$. static constexpr _RealType __one_div_pi = 0.3183098861837906715377675267450287L; // Constant @f$ 2 / \pi @f$. static constexpr _RealType __two_div_pi = 0.6366197723675813430755350534900574L; // Constant @f$ 2 / \sqrt(\pi) @f$. static constexpr _RealType __two_div_root_pi = 1.1283791670955125738961589031215452L; // Constant Euler's number @f$ e @f$. static constexpr _RealType __e = 2.7182818284590452353602874713526625L; // Constant @f$ 1 / e @f$. static constexpr _RealType __one_div_e = 0.36787944117144232159552377016146087L; // Constant @f$ \log_2(e) @f$. static constexpr _RealType __log2_e = 1.4426950408889634073599246810018921L; // Constant @f$ \log_10(e) @f$. static constexpr _RealType __log10_e = 0.4342944819032518276511289189166051L; // Constant @f$ \ln(2) @f$. static constexpr _RealType __ln_2 = 0.6931471805599453094172321214581766L; // Constant @f$ \ln(3) @f$. static constexpr _RealType __ln_3 = 1.0986122886681096913952452369225257L; // Constant @f$ \ln(10) @f$. static constexpr _RealType __ln_10 = 2.3025850929940456840179914546843642L; // Constant Euler-Mascheroni @f$ \gamma_E @f$. static constexpr _RealType __gamma_e = 0.5772156649015328606065120900824024L; // Constant Golden Ratio @f$ \phi @f$. static constexpr _RealType __phi = 1.6180339887498948482045868343656381L; // Constant @f$ \sqrt(2) @f$. static constexpr _RealType __root_2 = 1.4142135623730950488016887242096981L; // Constant @f$ \sqrt(3) @f$. static constexpr _RealType __root_3 = 1.7320508075688772935274463415058724L; // Constant @f$ \sqrt(5) @f$. static constexpr _RealType __root_5 = 2.2360679774997896964091736687312762L; // Constant @f$ \sqrt(7) @f$. static constexpr _RealType __root_7 = 2.6457513110645905905016157536392604L; // Constant @f$ 1 / \sqrt(2) @f$. static constexpr _RealType __one_div_root_2 = 0.7071067811865475244008443621048490L; }; // And the template definitions for the constants. template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__pi; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__pi_half; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__pi_third; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__pi_quarter; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__root_pi_div_2; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__one_div_pi; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__two_div_pi; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__two_div_root_pi; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__e; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__one_div_e; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__log2_e; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__log10_e; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__ln_2; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__ln_3; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__ln_10; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__gamma_e; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__phi; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__root_2; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__root_3; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__root_5; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__root_7; template<typename _RealType> constexpr _RealType __math_constants<_RealType>::__one_div_root_2; _GLIBCXX_END_NAMESPACE_VERSION } // namespace __gnu_cxx #endif // C++11 #endif // _EXT_CMATH �������������������������������������������������������������������������������������������c++/4.8.2/ext/vstring_util.h������������������������������������������������������������������������0000644�����������������00000013207�14763166030�0011300 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Versatile string utility -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/vstring_util.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ext/vstring.h} */ #ifndef _VSTRING_UTIL_H #define _VSTRING_UTIL_H 1 #pragma GCC system_header #include <ext/vstring_fwd.h> #include <debug/debug.h> #include <bits/stl_function.h> // For less #include <bits/functexcept.h> #include <bits/localefwd.h> #include <bits/ostream_insert.h> #include <bits/stl_iterator.h> #include <ext/numeric_traits.h> #include <bits/move.h> #include <bits/range_access.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _CharT, typename _Traits, typename _Alloc> struct __vstring_utility { typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type; typedef _Traits traits_type; typedef typename _Traits::char_type value_type; typedef typename _CharT_alloc_type::size_type size_type; typedef typename _CharT_alloc_type::difference_type difference_type; typedef typename _CharT_alloc_type::pointer pointer; typedef typename _CharT_alloc_type::const_pointer const_pointer; // For __sso_string. typedef __gnu_cxx:: __normal_iterator<pointer, __gnu_cxx:: __versa_string<_CharT, _Traits, _Alloc, __sso_string_base> > __sso_iterator; typedef __gnu_cxx:: __normal_iterator<const_pointer, __gnu_cxx:: __versa_string<_CharT, _Traits, _Alloc, __sso_string_base> > __const_sso_iterator; // For __rc_string. typedef __gnu_cxx:: __normal_iterator<pointer, __gnu_cxx:: __versa_string<_CharT, _Traits, _Alloc, __rc_string_base> > __rc_iterator; typedef __gnu_cxx:: __normal_iterator<const_pointer, __gnu_cxx:: __versa_string<_CharT, _Traits, _Alloc, __rc_string_base> > __const_rc_iterator; // NB: When the allocator is empty, deriving from it saves space // (http://www.cantrip.org/emptyopt.html). template<typename _Alloc1> struct _Alloc_hider : public _Alloc1 { _Alloc_hider(_CharT* __ptr) : _Alloc1(), _M_p(__ptr) { } _Alloc_hider(const _Alloc1& __a, _CharT* __ptr) : _Alloc1(__a), _M_p(__ptr) { } _CharT* _M_p; // The actual data. }; // When __n = 1 way faster than the general multichar // traits_type::copy/move/assign. static void _S_copy(_CharT* __d, const _CharT* __s, size_type __n) { if (__n == 1) traits_type::assign(*__d, *__s); else traits_type::copy(__d, __s, __n); } static void _S_move(_CharT* __d, const _CharT* __s, size_type __n) { if (__n == 1) traits_type::assign(*__d, *__s); else traits_type::move(__d, __s, __n); } static void _S_assign(_CharT* __d, size_type __n, _CharT __c) { if (__n == 1) traits_type::assign(*__d, __c); else traits_type::assign(__d, __n, __c); } // _S_copy_chars is a separate template to permit specialization // to optimize for the common case of pointers as iterators. template<typename _Iterator> static void _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2) { for (; __k1 != __k2; ++__k1, ++__p) traits_type::assign(*__p, *__k1); // These types are off. } static void _S_copy_chars(_CharT* __p, __sso_iterator __k1, __sso_iterator __k2) { _S_copy_chars(__p, __k1.base(), __k2.base()); } static void _S_copy_chars(_CharT* __p, __const_sso_iterator __k1, __const_sso_iterator __k2) { _S_copy_chars(__p, __k1.base(), __k2.base()); } static void _S_copy_chars(_CharT* __p, __rc_iterator __k1, __rc_iterator __k2) { _S_copy_chars(__p, __k1.base(), __k2.base()); } static void _S_copy_chars(_CharT* __p, __const_rc_iterator __k1, __const_rc_iterator __k2) { _S_copy_chars(__p, __k1.base(), __k2.base()); } static void _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) { _S_copy(__p, __k1, __k2 - __k1); } static void _S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2) { _S_copy(__p, __k1, __k2 - __k1); } static int _S_compare(size_type __n1, size_type __n2) { const difference_type __d = difference_type(__n1 - __n2); if (__d > __numeric_traits_integer<int>::__max) return __numeric_traits_integer<int>::__max; else if (__d < __numeric_traits_integer<int>::__min) return __numeric_traits_integer<int>::__min; else return int(__d); } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _VSTRING_UTIL_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/type_traits.h�������������������������������������������������������������������������0000644�����������������00000013221�14763166030�0011112 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/type_traits.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _EXT_TYPE_TRAITS #define _EXT_TYPE_TRAITS 1 #pragma GCC system_header #include <bits/c++config.h> #include <bits/cpp_type_traits.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Define a nested type if some predicate holds. template<bool, typename> struct __enable_if { }; template<typename _Tp> struct __enable_if<true, _Tp> { typedef _Tp __type; }; // Conditional expression for types. If true, first, if false, second. template<bool _Cond, typename _Iftrue, typename _Iffalse> struct __conditional_type { typedef _Iftrue __type; }; template<typename _Iftrue, typename _Iffalse> struct __conditional_type<false, _Iftrue, _Iffalse> { typedef _Iffalse __type; }; // Given an integral builtin type, return the corresponding unsigned type. template<typename _Tp> struct __add_unsigned { private: typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type; public: typedef typename __if_type::__type __type; }; template<> struct __add_unsigned<char> { typedef unsigned char __type; }; template<> struct __add_unsigned<signed char> { typedef unsigned char __type; }; template<> struct __add_unsigned<short> { typedef unsigned short __type; }; template<> struct __add_unsigned<int> { typedef unsigned int __type; }; template<> struct __add_unsigned<long> { typedef unsigned long __type; }; template<> struct __add_unsigned<long long> { typedef unsigned long long __type; }; // Declare but don't define. template<> struct __add_unsigned<bool>; template<> struct __add_unsigned<wchar_t>; // Given an integral builtin type, return the corresponding signed type. template<typename _Tp> struct __remove_unsigned { private: typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type; public: typedef typename __if_type::__type __type; }; template<> struct __remove_unsigned<char> { typedef signed char __type; }; template<> struct __remove_unsigned<unsigned char> { typedef signed char __type; }; template<> struct __remove_unsigned<unsigned short> { typedef short __type; }; template<> struct __remove_unsigned<unsigned int> { typedef int __type; }; template<> struct __remove_unsigned<unsigned long> { typedef long __type; }; template<> struct __remove_unsigned<unsigned long long> { typedef long long __type; }; // Declare but don't define. template<> struct __remove_unsigned<bool>; template<> struct __remove_unsigned<wchar_t>; // For use in string and vstring. template<typename _Type> inline bool __is_null_pointer(_Type* __ptr) { return __ptr == 0; } template<typename _Type> inline bool __is_null_pointer(_Type) { return false; } // For complex and cmath template<typename _Tp, bool = std::__is_integer<_Tp>::__value> struct __promote { typedef double __type; }; // No nested __type member for non-integer non-floating point types, // allows this type to be used for SFINAE to constrain overloads in // <cmath> and <complex> to only the intended types. template<typename _Tp> struct __promote<_Tp, false> { }; template<> struct __promote<long double> { typedef long double __type; }; template<> struct __promote<double> { typedef double __type; }; template<> struct __promote<float> { typedef float __type; }; template<typename _Tp, typename _Up, typename _Tp2 = typename __promote<_Tp>::__type, typename _Up2 = typename __promote<_Up>::__type> struct __promote_2 { typedef __typeof__(_Tp2() + _Up2()) __type; }; template<typename _Tp, typename _Up, typename _Vp, typename _Tp2 = typename __promote<_Tp>::__type, typename _Up2 = typename __promote<_Up>::__type, typename _Vp2 = typename __promote<_Vp>::__type> struct __promote_3 { typedef __typeof__(_Tp2() + _Up2() + _Vp2()) __type; }; template<typename _Tp, typename _Up, typename _Vp, typename _Wp, typename _Tp2 = typename __promote<_Tp>::__type, typename _Up2 = typename __promote<_Up>::__type, typename _Vp2 = typename __promote<_Vp>::__type, typename _Wp2 = typename __promote<_Wp>::__type> struct __promote_4 { typedef __typeof__(_Tp2() + _Up2() + _Vp2() + _Wp2()) __type; }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/slist���������������������������������������������������������������������������������0000644�����������������00000071643�14763166030�0007467 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Singly-linked list implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * Copyright (c) 1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * */ /** @file ext/slist * This file is a GNU extension to the Standard C++ Library (possibly * containing extensions from the HP/SGI STL subset). */ #ifndef _SLIST #define _SLIST 1 #include <algorithm> #include <bits/allocator.h> #include <bits/stl_construct.h> #include <bits/stl_uninitialized.h> #include <bits/concept_check.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using std::size_t; using std::ptrdiff_t; using std::_Construct; using std::_Destroy; using std::allocator; using std::__true_type; using std::__false_type; struct _Slist_node_base { _Slist_node_base* _M_next; }; inline _Slist_node_base* __slist_make_link(_Slist_node_base* __prev_node, _Slist_node_base* __new_node) { __new_node->_M_next = __prev_node->_M_next; __prev_node->_M_next = __new_node; return __new_node; } inline _Slist_node_base* __slist_previous(_Slist_node_base* __head, const _Slist_node_base* __node) { while (__head && __head->_M_next != __node) __head = __head->_M_next; return __head; } inline const _Slist_node_base* __slist_previous(const _Slist_node_base* __head, const _Slist_node_base* __node) { while (__head && __head->_M_next != __node) __head = __head->_M_next; return __head; } inline void __slist_splice_after(_Slist_node_base* __pos, _Slist_node_base* __before_first, _Slist_node_base* __before_last) { if (__pos != __before_first && __pos != __before_last) { _Slist_node_base* __first = __before_first->_M_next; _Slist_node_base* __after = __pos->_M_next; __before_first->_M_next = __before_last->_M_next; __pos->_M_next = __first; __before_last->_M_next = __after; } } inline void __slist_splice_after(_Slist_node_base* __pos, _Slist_node_base* __head) { _Slist_node_base* __before_last = __slist_previous(__head, 0); if (__before_last != __head) { _Slist_node_base* __after = __pos->_M_next; __pos->_M_next = __head->_M_next; __head->_M_next = 0; __before_last->_M_next = __after; } } inline _Slist_node_base* __slist_reverse(_Slist_node_base* __node) { _Slist_node_base* __result = __node; __node = __node->_M_next; __result->_M_next = 0; while(__node) { _Slist_node_base* __next = __node->_M_next; __node->_M_next = __result; __result = __node; __node = __next; } return __result; } inline size_t __slist_size(_Slist_node_base* __node) { size_t __result = 0; for (; __node != 0; __node = __node->_M_next) ++__result; return __result; } template <class _Tp> struct _Slist_node : public _Slist_node_base { _Tp _M_data; }; struct _Slist_iterator_base { typedef size_t size_type; typedef ptrdiff_t difference_type; typedef std::forward_iterator_tag iterator_category; _Slist_node_base* _M_node; _Slist_iterator_base(_Slist_node_base* __x) : _M_node(__x) {} void _M_incr() { _M_node = _M_node->_M_next; } bool operator==(const _Slist_iterator_base& __x) const { return _M_node == __x._M_node; } bool operator!=(const _Slist_iterator_base& __x) const { return _M_node != __x._M_node; } }; template <class _Tp, class _Ref, class _Ptr> struct _Slist_iterator : public _Slist_iterator_base { typedef _Slist_iterator<_Tp, _Tp&, _Tp*> iterator; typedef _Slist_iterator<_Tp, const _Tp&, const _Tp*> const_iterator; typedef _Slist_iterator<_Tp, _Ref, _Ptr> _Self; typedef _Tp value_type; typedef _Ptr pointer; typedef _Ref reference; typedef _Slist_node<_Tp> _Node; explicit _Slist_iterator(_Node* __x) : _Slist_iterator_base(__x) {} _Slist_iterator() : _Slist_iterator_base(0) {} _Slist_iterator(const iterator& __x) : _Slist_iterator_base(__x._M_node) {} reference operator*() const { return ((_Node*) _M_node)->_M_data; } pointer operator->() const { return &(operator*()); } _Self& operator++() { _M_incr(); return *this; } _Self operator++(int) { _Self __tmp = *this; _M_incr(); return __tmp; } }; template <class _Tp, class _Alloc> struct _Slist_base : public _Alloc::template rebind<_Slist_node<_Tp> >::other { typedef typename _Alloc::template rebind<_Slist_node<_Tp> >::other _Node_alloc; typedef _Alloc allocator_type; allocator_type get_allocator() const { return *static_cast<const _Node_alloc*>(this); } _Slist_base(const allocator_type& __a) : _Node_alloc(__a) { this->_M_head._M_next = 0; } ~_Slist_base() { _M_erase_after(&this->_M_head, 0); } protected: _Slist_node_base _M_head; _Slist_node<_Tp>* _M_get_node() { return _Node_alloc::allocate(1); } void _M_put_node(_Slist_node<_Tp>* __p) { _Node_alloc::deallocate(__p, 1); } protected: _Slist_node_base* _M_erase_after(_Slist_node_base* __pos) { _Slist_node<_Tp>* __next = (_Slist_node<_Tp>*) (__pos->_M_next); _Slist_node_base* __next_next = __next->_M_next; __pos->_M_next = __next_next; get_allocator().destroy(&__next->_M_data); _M_put_node(__next); return __next_next; } _Slist_node_base* _M_erase_after(_Slist_node_base*, _Slist_node_base*); }; template <class _Tp, class _Alloc> _Slist_node_base* _Slist_base<_Tp,_Alloc>::_M_erase_after(_Slist_node_base* __before_first, _Slist_node_base* __last_node) { _Slist_node<_Tp>* __cur = (_Slist_node<_Tp>*) (__before_first->_M_next); while (__cur != __last_node) { _Slist_node<_Tp>* __tmp = __cur; __cur = (_Slist_node<_Tp>*) __cur->_M_next; get_allocator().destroy(&__tmp->_M_data); _M_put_node(__tmp); } __before_first->_M_next = __last_node; return __last_node; } /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template <class _Tp, class _Alloc = allocator<_Tp> > class slist : private _Slist_base<_Tp,_Alloc> { // concept requirements __glibcxx_class_requires(_Tp, _SGIAssignableConcept) private: typedef _Slist_base<_Tp,_Alloc> _Base; public: typedef _Tp value_type; typedef value_type* pointer; typedef const value_type* const_pointer; typedef value_type& reference; typedef const value_type& const_reference; typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Slist_iterator<_Tp, _Tp&, _Tp*> iterator; typedef _Slist_iterator<_Tp, const _Tp&, const _Tp*> const_iterator; typedef typename _Base::allocator_type allocator_type; allocator_type get_allocator() const { return _Base::get_allocator(); } private: typedef _Slist_node<_Tp> _Node; typedef _Slist_node_base _Node_base; typedef _Slist_iterator_base _Iterator_base; _Node* _M_create_node(const value_type& __x) { _Node* __node = this->_M_get_node(); __try { get_allocator().construct(&__node->_M_data, __x); __node->_M_next = 0; } __catch(...) { this->_M_put_node(__node); __throw_exception_again; } return __node; } _Node* _M_create_node() { _Node* __node = this->_M_get_node(); __try { get_allocator().construct(&__node->_M_data, value_type()); __node->_M_next = 0; } __catch(...) { this->_M_put_node(__node); __throw_exception_again; } return __node; } public: explicit slist(const allocator_type& __a = allocator_type()) : _Base(__a) {} slist(size_type __n, const value_type& __x, const allocator_type& __a = allocator_type()) : _Base(__a) { _M_insert_after_fill(&this->_M_head, __n, __x); } explicit slist(size_type __n) : _Base(allocator_type()) { _M_insert_after_fill(&this->_M_head, __n, value_type()); } // We don't need any dispatching tricks here, because // _M_insert_after_range already does them. template <class _InputIterator> slist(_InputIterator __first, _InputIterator __last, const allocator_type& __a = allocator_type()) : _Base(__a) { _M_insert_after_range(&this->_M_head, __first, __last); } slist(const slist& __x) : _Base(__x.get_allocator()) { _M_insert_after_range(&this->_M_head, __x.begin(), __x.end()); } slist& operator= (const slist& __x); ~slist() {} public: // assign(), a generalized assignment member function. Two // versions: one that takes a count, and one that takes a range. // The range version is a member template, so we dispatch on whether // or not the type is an integer. void assign(size_type __n, const _Tp& __val) { _M_fill_assign(__n, __val); } void _M_fill_assign(size_type __n, const _Tp& __val); template <class _InputIterator> void assign(_InputIterator __first, _InputIterator __last) { typedef typename std::__is_integer<_InputIterator>::__type _Integral; _M_assign_dispatch(__first, __last, _Integral()); } template <class _Integer> void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) { _M_fill_assign((size_type) __n, (_Tp) __val); } template <class _InputIterator> void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, __false_type); public: iterator begin() { return iterator((_Node*)this->_M_head._M_next); } const_iterator begin() const { return const_iterator((_Node*)this->_M_head._M_next);} iterator end() { return iterator(0); } const_iterator end() const { return const_iterator(0); } // Experimental new feature: before_begin() returns a // non-dereferenceable iterator that, when incremented, yields // begin(). This iterator may be used as the argument to // insert_after, erase_after, etc. Note that even for an empty // slist, before_begin() is not the same iterator as end(). It // is always necessary to increment before_begin() at least once to // obtain end(). iterator before_begin() { return iterator((_Node*) &this->_M_head); } const_iterator before_begin() const { return const_iterator((_Node*) &this->_M_head); } size_type size() const { return __slist_size(this->_M_head._M_next); } size_type max_size() const { return size_type(-1); } bool empty() const { return this->_M_head._M_next == 0; } void swap(slist& __x) { std::swap(this->_M_head._M_next, __x._M_head._M_next); } public: reference front() { return ((_Node*) this->_M_head._M_next)->_M_data; } const_reference front() const { return ((_Node*) this->_M_head._M_next)->_M_data; } void push_front(const value_type& __x) { __slist_make_link(&this->_M_head, _M_create_node(__x)); } void push_front() { __slist_make_link(&this->_M_head, _M_create_node()); } void pop_front() { _Node* __node = (_Node*) this->_M_head._M_next; this->_M_head._M_next = __node->_M_next; get_allocator().destroy(&__node->_M_data); this->_M_put_node(__node); } iterator previous(const_iterator __pos) { return iterator((_Node*) __slist_previous(&this->_M_head, __pos._M_node)); } const_iterator previous(const_iterator __pos) const { return const_iterator((_Node*) __slist_previous(&this->_M_head, __pos._M_node)); } private: _Node* _M_insert_after(_Node_base* __pos, const value_type& __x) { return (_Node*) (__slist_make_link(__pos, _M_create_node(__x))); } _Node* _M_insert_after(_Node_base* __pos) { return (_Node*) (__slist_make_link(__pos, _M_create_node())); } void _M_insert_after_fill(_Node_base* __pos, size_type __n, const value_type& __x) { for (size_type __i = 0; __i < __n; ++__i) __pos = __slist_make_link(__pos, _M_create_node(__x)); } // Check whether it's an integral type. If so, it's not an iterator. template <class _InIterator> void _M_insert_after_range(_Node_base* __pos, _InIterator __first, _InIterator __last) { typedef typename std::__is_integer<_InIterator>::__type _Integral; _M_insert_after_range(__pos, __first, __last, _Integral()); } template <class _Integer> void _M_insert_after_range(_Node_base* __pos, _Integer __n, _Integer __x, __true_type) { _M_insert_after_fill(__pos, __n, __x); } template <class _InIterator> void _M_insert_after_range(_Node_base* __pos, _InIterator __first, _InIterator __last, __false_type) { while (__first != __last) { __pos = __slist_make_link(__pos, _M_create_node(*__first)); ++__first; } } public: iterator insert_after(iterator __pos, const value_type& __x) { return iterator(_M_insert_after(__pos._M_node, __x)); } iterator insert_after(iterator __pos) { return insert_after(__pos, value_type()); } void insert_after(iterator __pos, size_type __n, const value_type& __x) { _M_insert_after_fill(__pos._M_node, __n, __x); } // We don't need any dispatching tricks here, because // _M_insert_after_range already does them. template <class _InIterator> void insert_after(iterator __pos, _InIterator __first, _InIterator __last) { _M_insert_after_range(__pos._M_node, __first, __last); } iterator insert(iterator __pos, const value_type& __x) { return iterator(_M_insert_after(__slist_previous(&this->_M_head, __pos._M_node), __x)); } iterator insert(iterator __pos) { return iterator(_M_insert_after(__slist_previous(&this->_M_head, __pos._M_node), value_type())); } void insert(iterator __pos, size_type __n, const value_type& __x) { _M_insert_after_fill(__slist_previous(&this->_M_head, __pos._M_node), __n, __x); } // We don't need any dispatching tricks here, because // _M_insert_after_range already does them. template <class _InIterator> void insert(iterator __pos, _InIterator __first, _InIterator __last) { _M_insert_after_range(__slist_previous(&this->_M_head, __pos._M_node), __first, __last); } public: iterator erase_after(iterator __pos) { return iterator((_Node*) this->_M_erase_after(__pos._M_node)); } iterator erase_after(iterator __before_first, iterator __last) { return iterator((_Node*) this->_M_erase_after(__before_first._M_node, __last._M_node)); } iterator erase(iterator __pos) { return iterator((_Node*) this->_M_erase_after (__slist_previous(&this->_M_head, __pos._M_node))); } iterator erase(iterator __first, iterator __last) { return iterator((_Node*) this->_M_erase_after (__slist_previous(&this->_M_head, __first._M_node), __last._M_node)); } void resize(size_type new_size, const _Tp& __x); void resize(size_type new_size) { resize(new_size, _Tp()); } void clear() { this->_M_erase_after(&this->_M_head, 0); } public: // Moves the range [__before_first + 1, __before_last + 1) to *this, // inserting it immediately after __pos. This is constant time. void splice_after(iterator __pos, iterator __before_first, iterator __before_last) { if (__before_first != __before_last) __slist_splice_after(__pos._M_node, __before_first._M_node, __before_last._M_node); } // Moves the element that follows __prev to *this, inserting it // immediately after __pos. This is constant time. void splice_after(iterator __pos, iterator __prev) { __slist_splice_after(__pos._M_node, __prev._M_node, __prev._M_node->_M_next); } // Removes all of the elements from the list __x to *this, inserting // them immediately after __pos. __x must not be *this. Complexity: // linear in __x.size(). void splice_after(iterator __pos, slist& __x) { __slist_splice_after(__pos._M_node, &__x._M_head); } // Linear in distance(begin(), __pos), and linear in __x.size(). void splice(iterator __pos, slist& __x) { if (__x._M_head._M_next) __slist_splice_after(__slist_previous(&this->_M_head, __pos._M_node), &__x._M_head, __slist_previous(&__x._M_head, 0)); } // Linear in distance(begin(), __pos), and in distance(__x.begin(), __i). void splice(iterator __pos, slist& __x, iterator __i) { __slist_splice_after(__slist_previous(&this->_M_head, __pos._M_node), __slist_previous(&__x._M_head, __i._M_node), __i._M_node); } // Linear in distance(begin(), __pos), in distance(__x.begin(), __first), // and in distance(__first, __last). void splice(iterator __pos, slist& __x, iterator __first, iterator __last) { if (__first != __last) __slist_splice_after(__slist_previous(&this->_M_head, __pos._M_node), __slist_previous(&__x._M_head, __first._M_node), __slist_previous(__first._M_node, __last._M_node)); } public: void reverse() { if (this->_M_head._M_next) this->_M_head._M_next = __slist_reverse(this->_M_head._M_next); } void remove(const _Tp& __val); void unique(); void merge(slist& __x); void sort(); template <class _Predicate> void remove_if(_Predicate __pred); template <class _BinaryPredicate> void unique(_BinaryPredicate __pred); template <class _StrictWeakOrdering> void merge(slist&, _StrictWeakOrdering); template <class _StrictWeakOrdering> void sort(_StrictWeakOrdering __comp); }; template <class _Tp, class _Alloc> slist<_Tp, _Alloc>& slist<_Tp, _Alloc>::operator=(const slist<_Tp, _Alloc>& __x) { if (&__x != this) { _Node_base* __p1 = &this->_M_head; _Node* __n1 = (_Node*) this->_M_head._M_next; const _Node* __n2 = (const _Node*) __x._M_head._M_next; while (__n1 && __n2) { __n1->_M_data = __n2->_M_data; __p1 = __n1; __n1 = (_Node*) __n1->_M_next; __n2 = (const _Node*) __n2->_M_next; } if (__n2 == 0) this->_M_erase_after(__p1, 0); else _M_insert_after_range(__p1, const_iterator((_Node*)__n2), const_iterator(0)); } return *this; } template <class _Tp, class _Alloc> void slist<_Tp, _Alloc>::_M_fill_assign(size_type __n, const _Tp& __val) { _Node_base* __prev = &this->_M_head; _Node* __node = (_Node*) this->_M_head._M_next; for (; __node != 0 && __n > 0; --__n) { __node->_M_data = __val; __prev = __node; __node = (_Node*) __node->_M_next; } if (__n > 0) _M_insert_after_fill(__prev, __n, __val); else this->_M_erase_after(__prev, 0); } template <class _Tp, class _Alloc> template <class _InputIterator> void slist<_Tp, _Alloc>::_M_assign_dispatch(_InputIterator __first, _InputIterator __last, __false_type) { _Node_base* __prev = &this->_M_head; _Node* __node = (_Node*) this->_M_head._M_next; while (__node != 0 && __first != __last) { __node->_M_data = *__first; __prev = __node; __node = (_Node*) __node->_M_next; ++__first; } if (__first != __last) _M_insert_after_range(__prev, __first, __last); else this->_M_erase_after(__prev, 0); } template <class _Tp, class _Alloc> inline bool operator==(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2) { typedef typename slist<_Tp,_Alloc>::const_iterator const_iterator; const_iterator __end1 = _SL1.end(); const_iterator __end2 = _SL2.end(); const_iterator __i1 = _SL1.begin(); const_iterator __i2 = _SL2.begin(); while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) { ++__i1; ++__i2; } return __i1 == __end1 && __i2 == __end2; } template <class _Tp, class _Alloc> inline bool operator<(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2) { return std::lexicographical_compare(_SL1.begin(), _SL1.end(), _SL2.begin(), _SL2.end()); } template <class _Tp, class _Alloc> inline bool operator!=(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2) { return !(_SL1 == _SL2); } template <class _Tp, class _Alloc> inline bool operator>(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2) { return _SL2 < _SL1; } template <class _Tp, class _Alloc> inline bool operator<=(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2) { return !(_SL2 < _SL1); } template <class _Tp, class _Alloc> inline bool operator>=(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2) { return !(_SL1 < _SL2); } template <class _Tp, class _Alloc> inline void swap(slist<_Tp, _Alloc>& __x, slist<_Tp, _Alloc>& __y) { __x.swap(__y); } template <class _Tp, class _Alloc> void slist<_Tp, _Alloc>::resize(size_type __len, const _Tp& __x) { _Node_base* __cur = &this->_M_head; while (__cur->_M_next != 0 && __len > 0) { --__len; __cur = __cur->_M_next; } if (__cur->_M_next) this->_M_erase_after(__cur, 0); else _M_insert_after_fill(__cur, __len, __x); } template <class _Tp, class _Alloc> void slist<_Tp, _Alloc>::remove(const _Tp& __val) { _Node_base* __cur = &this->_M_head; while (__cur && __cur->_M_next) { if (((_Node*) __cur->_M_next)->_M_data == __val) this->_M_erase_after(__cur); else __cur = __cur->_M_next; } } template <class _Tp, class _Alloc> void slist<_Tp, _Alloc>::unique() { _Node_base* __cur = this->_M_head._M_next; if (__cur) { while (__cur->_M_next) { if (((_Node*)__cur)->_M_data == ((_Node*)(__cur->_M_next))->_M_data) this->_M_erase_after(__cur); else __cur = __cur->_M_next; } } } template <class _Tp, class _Alloc> void slist<_Tp, _Alloc>::merge(slist<_Tp, _Alloc>& __x) { _Node_base* __n1 = &this->_M_head; while (__n1->_M_next && __x._M_head._M_next) { if (((_Node*) __x._M_head._M_next)->_M_data < ((_Node*) __n1->_M_next)->_M_data) __slist_splice_after(__n1, &__x._M_head, __x._M_head._M_next); __n1 = __n1->_M_next; } if (__x._M_head._M_next) { __n1->_M_next = __x._M_head._M_next; __x._M_head._M_next = 0; } } template <class _Tp, class _Alloc> void slist<_Tp, _Alloc>::sort() { if (this->_M_head._M_next && this->_M_head._M_next->_M_next) { slist __carry; slist __counter[64]; int __fill = 0; while (!empty()) { __slist_splice_after(&__carry._M_head, &this->_M_head, this->_M_head._M_next); int __i = 0; while (__i < __fill && !__counter[__i].empty()) { __counter[__i].merge(__carry); __carry.swap(__counter[__i]); ++__i; } __carry.swap(__counter[__i]); if (__i == __fill) ++__fill; } for (int __i = 1; __i < __fill; ++__i) __counter[__i].merge(__counter[__i-1]); this->swap(__counter[__fill-1]); } } template <class _Tp, class _Alloc> template <class _Predicate> void slist<_Tp, _Alloc>::remove_if(_Predicate __pred) { _Node_base* __cur = &this->_M_head; while (__cur->_M_next) { if (__pred(((_Node*) __cur->_M_next)->_M_data)) this->_M_erase_after(__cur); else __cur = __cur->_M_next; } } template <class _Tp, class _Alloc> template <class _BinaryPredicate> void slist<_Tp, _Alloc>::unique(_BinaryPredicate __pred) { _Node* __cur = (_Node*) this->_M_head._M_next; if (__cur) { while (__cur->_M_next) { if (__pred(((_Node*)__cur)->_M_data, ((_Node*)(__cur->_M_next))->_M_data)) this->_M_erase_after(__cur); else __cur = (_Node*) __cur->_M_next; } } } template <class _Tp, class _Alloc> template <class _StrictWeakOrdering> void slist<_Tp, _Alloc>::merge(slist<_Tp, _Alloc>& __x, _StrictWeakOrdering __comp) { _Node_base* __n1 = &this->_M_head; while (__n1->_M_next && __x._M_head._M_next) { if (__comp(((_Node*) __x._M_head._M_next)->_M_data, ((_Node*) __n1->_M_next)->_M_data)) __slist_splice_after(__n1, &__x._M_head, __x._M_head._M_next); __n1 = __n1->_M_next; } if (__x._M_head._M_next) { __n1->_M_next = __x._M_head._M_next; __x._M_head._M_next = 0; } } template <class _Tp, class _Alloc> template <class _StrictWeakOrdering> void slist<_Tp, _Alloc>::sort(_StrictWeakOrdering __comp) { if (this->_M_head._M_next && this->_M_head._M_next->_M_next) { slist __carry; slist __counter[64]; int __fill = 0; while (!empty()) { __slist_splice_after(&__carry._M_head, &this->_M_head, this->_M_head._M_next); int __i = 0; while (__i < __fill && !__counter[__i].empty()) { __counter[__i].merge(__carry, __comp); __carry.swap(__counter[__i]); ++__i; } __carry.swap(__counter[__i]); if (__i == __fill) ++__fill; } for (int __i = 1; __i < __fill; ++__i) __counter[__i].merge(__counter[__i-1], __comp); this->swap(__counter[__fill-1]); } } _GLIBCXX_END_NAMESPACE_VERSION } // namespace namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Specialization of insert_iterator so that insertions will be constant // time rather than linear time. template <class _Tp, class _Alloc> class insert_iterator<__gnu_cxx::slist<_Tp, _Alloc> > { protected: typedef __gnu_cxx::slist<_Tp, _Alloc> _Container; _Container* container; typename _Container::iterator iter; public: typedef _Container container_type; typedef output_iterator_tag iterator_category; typedef void value_type; typedef void difference_type; typedef void pointer; typedef void reference; insert_iterator(_Container& __x, typename _Container::iterator __i) : container(&__x) { if (__i == __x.begin()) iter = __x.before_begin(); else iter = __x.previous(__i); } insert_iterator<_Container>& operator=(const typename _Container::value_type& __value) { iter = container->insert_after(iter, __value); return *this; } insert_iterator<_Container>& operator*() { return *this; } insert_iterator<_Container>& operator++() { return *this; } insert_iterator<_Container>& operator++(int) { return *this; } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ���������������������������������������������������������������������������������������������c++/4.8.2/ext/rc_string_base.h����������������������������������������������������������������������0000644�����������������00000056242�14763166030�0011541 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Reference-counted versatile string base -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/rc_string_base.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ext/vstring.h} */ #ifndef _RC_STRING_BASE_H #define _RC_STRING_BASE_H 1 #include <ext/atomicity.h> #include <bits/stl_iterator_base_funcs.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * Documentation? What's that? * Nathan Myers <ncm@cantrip.org>. * * A string looks like this: * * @code * [_Rep] * _M_length * [__rc_string_base<char_type>] _M_capacity * _M_dataplus _M_refcount * _M_p ----------------> unnamed array of char_type * @endcode * * Where the _M_p points to the first character in the string, and * you cast it to a pointer-to-_Rep and subtract 1 to get a * pointer to the header. * * This approach has the enormous advantage that a string object * requires only one allocation. All the ugliness is confined * within a single pair of inline functions, which each compile to * a single @a add instruction: _Rep::_M_refdata(), and * __rc_string_base::_M_rep(); and the allocation function which gets a * block of raw bytes and with room enough and constructs a _Rep * object at the front. * * The reason you want _M_data pointing to the character array and * not the _Rep is so that the debugger can see the string * contents. (Probably we should add a non-inline member to get * the _Rep for the debugger to use, so users can check the actual * string length.) * * Note that the _Rep object is a POD so that you can have a * static <em>empty string</em> _Rep object already @a constructed before * static constructors have run. The reference-count encoding is * chosen so that a 0 indicates one reference, so you never try to * destroy the empty-string _Rep object. * * All but the last paragraph is considered pretty conventional * for a C++ string implementation. */ template<typename _CharT, typename _Traits, typename _Alloc> class __rc_string_base : protected __vstring_utility<_CharT, _Traits, _Alloc> { public: typedef _Traits traits_type; typedef typename _Traits::char_type value_type; typedef _Alloc allocator_type; typedef __vstring_utility<_CharT, _Traits, _Alloc> _Util_Base; typedef typename _Util_Base::_CharT_alloc_type _CharT_alloc_type; typedef typename _CharT_alloc_type::size_type size_type; private: // _Rep: string representation // Invariants: // 1. String really contains _M_length + 1 characters: due to 21.3.4 // must be kept null-terminated. // 2. _M_capacity >= _M_length // Allocated memory is always (_M_capacity + 1) * sizeof(_CharT). // 3. _M_refcount has three states: // -1: leaked, one reference, no ref-copies allowed, non-const. // 0: one reference, non-const. // n>0: n + 1 references, operations require a lock, const. // 4. All fields == 0 is an empty string, given the extra storage // beyond-the-end for a null terminator; thus, the shared // empty string representation needs no constructor. struct _Rep { union { struct { size_type _M_length; size_type _M_capacity; _Atomic_word _M_refcount; } _M_info; // Only for alignment purposes. _CharT _M_align; }; typedef typename _Alloc::template rebind<_Rep>::other _Rep_alloc_type; _CharT* _M_refdata() throw() { return reinterpret_cast<_CharT*>(this + 1); } _CharT* _M_refcopy() throw() { __atomic_add_dispatch(&_M_info._M_refcount, 1); return _M_refdata(); } // XXX MT void _M_set_length(size_type __n) { _M_info._M_refcount = 0; // One reference. _M_info._M_length = __n; // grrr. (per 21.3.4) // You cannot leave those LWG people alone for a second. traits_type::assign(_M_refdata()[__n], _CharT()); } // Create & Destroy static _Rep* _S_create(size_type, size_type, const _Alloc&); void _M_destroy(const _Alloc&) throw(); _CharT* _M_clone(const _Alloc&, size_type __res = 0); }; struct _Rep_empty : public _Rep { _CharT _M_terminal; }; static _Rep_empty _S_empty_rep; // The maximum number of individual char_type elements of an // individual string is determined by _S_max_size. This is the // value that will be returned by max_size(). (Whereas npos // is the maximum number of bytes the allocator can allocate.) // If one was to divvy up the theoretical largest size string, // with a terminating character and m _CharT elements, it'd // look like this: // npos = sizeof(_Rep) + (m * sizeof(_CharT)) + sizeof(_CharT) // + sizeof(_Rep) - 1 // (NB: last two terms for rounding reasons, see _M_create below) // Solving for m: // m = ((npos - 2 * sizeof(_Rep) + 1) / sizeof(_CharT)) - 1 // In addition, this implementation halves this amount. enum { _S_max_size = (((static_cast<size_type>(-1) - 2 * sizeof(_Rep) + 1) / sizeof(_CharT)) - 1) / 2 }; // Data Member (private): mutable typename _Util_Base::template _Alloc_hider<_Alloc> _M_dataplus; void _M_data(_CharT* __p) { _M_dataplus._M_p = __p; } _Rep* _M_rep() const { return &((reinterpret_cast<_Rep*>(_M_data()))[-1]); } _CharT* _M_grab(const _Alloc& __alloc) const { return (!_M_is_leaked() && _M_get_allocator() == __alloc) ? _M_rep()->_M_refcopy() : _M_rep()->_M_clone(__alloc); } void _M_dispose() { // Be race-detector-friendly. For more info see bits/c++config. _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_rep()->_M_info. _M_refcount); if (__exchange_and_add_dispatch(&_M_rep()->_M_info._M_refcount, -1) <= 0) { _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_rep()->_M_info. _M_refcount); _M_rep()->_M_destroy(_M_get_allocator()); } } // XXX MT bool _M_is_leaked() const { return _M_rep()->_M_info._M_refcount < 0; } void _M_set_sharable() { _M_rep()->_M_info._M_refcount = 0; } void _M_leak_hard(); // _S_construct_aux is used to implement the 21.3.1 para 15 which // requires special behaviour if _InIterator is an integral type template<typename _InIterator> static _CharT* _S_construct_aux(_InIterator __beg, _InIterator __end, const _Alloc& __a, std::__false_type) { typedef typename iterator_traits<_InIterator>::iterator_category _Tag; return _S_construct(__beg, __end, __a, _Tag()); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 438. Ambiguity in the "do the right thing" clause template<typename _Integer> static _CharT* _S_construct_aux(_Integer __beg, _Integer __end, const _Alloc& __a, std::__true_type) { return _S_construct_aux_2(static_cast<size_type>(__beg), __end, __a); } static _CharT* _S_construct_aux_2(size_type __req, _CharT __c, const _Alloc& __a) { return _S_construct(__req, __c, __a); } template<typename _InIterator> static _CharT* _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a) { typedef typename std::__is_integer<_InIterator>::__type _Integral; return _S_construct_aux(__beg, __end, __a, _Integral()); } // For Input Iterators, used in istreambuf_iterators, etc. template<typename _InIterator> static _CharT* _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a, std::input_iterator_tag); // For forward_iterators up to random_access_iterators, used for // string::iterator, _CharT*, etc. template<typename _FwdIterator> static _CharT* _S_construct(_FwdIterator __beg, _FwdIterator __end, const _Alloc& __a, std::forward_iterator_tag); static _CharT* _S_construct(size_type __req, _CharT __c, const _Alloc& __a); public: size_type _M_max_size() const { return size_type(_S_max_size); } _CharT* _M_data() const { return _M_dataplus._M_p; } size_type _M_length() const { return _M_rep()->_M_info._M_length; } size_type _M_capacity() const { return _M_rep()->_M_info._M_capacity; } bool _M_is_shared() const { return _M_rep()->_M_info._M_refcount > 0; } void _M_set_leaked() { _M_rep()->_M_info._M_refcount = -1; } void _M_leak() // for use in begin() & non-const op[] { if (!_M_is_leaked()) _M_leak_hard(); } void _M_set_length(size_type __n) { _M_rep()->_M_set_length(__n); } __rc_string_base() : _M_dataplus(_S_empty_rep._M_refcopy()) { } __rc_string_base(const _Alloc& __a); __rc_string_base(const __rc_string_base& __rcs); #if __cplusplus >= 201103L __rc_string_base(__rc_string_base&& __rcs) : _M_dataplus(__rcs._M_dataplus) { __rcs._M_data(_S_empty_rep._M_refcopy()); } #endif __rc_string_base(size_type __n, _CharT __c, const _Alloc& __a); template<typename _InputIterator> __rc_string_base(_InputIterator __beg, _InputIterator __end, const _Alloc& __a); ~__rc_string_base() { _M_dispose(); } allocator_type& _M_get_allocator() { return _M_dataplus; } const allocator_type& _M_get_allocator() const { return _M_dataplus; } void _M_swap(__rc_string_base& __rcs); void _M_assign(const __rc_string_base& __rcs); void _M_reserve(size_type __res); void _M_mutate(size_type __pos, size_type __len1, const _CharT* __s, size_type __len2); void _M_erase(size_type __pos, size_type __n); void _M_clear() { _M_erase(size_type(0), _M_length()); } bool _M_compare(const __rc_string_base&) const { return false; } }; template<typename _CharT, typename _Traits, typename _Alloc> typename __rc_string_base<_CharT, _Traits, _Alloc>::_Rep_empty __rc_string_base<_CharT, _Traits, _Alloc>::_S_empty_rep; template<typename _CharT, typename _Traits, typename _Alloc> typename __rc_string_base<_CharT, _Traits, _Alloc>::_Rep* __rc_string_base<_CharT, _Traits, _Alloc>::_Rep:: _S_create(size_type __capacity, size_type __old_capacity, const _Alloc& __alloc) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 83. String::npos vs. string::max_size() if (__capacity > size_type(_S_max_size)) std::__throw_length_error(__N("__rc_string_base::_Rep::_S_create")); // The standard places no restriction on allocating more memory // than is strictly needed within this layer at the moment or as // requested by an explicit application call to reserve(). // Many malloc implementations perform quite poorly when an // application attempts to allocate memory in a stepwise fashion // growing each allocation size by only 1 char. Additionally, // it makes little sense to allocate less linear memory than the // natural blocking size of the malloc implementation. // Unfortunately, we would need a somewhat low-level calculation // with tuned parameters to get this perfect for any particular // malloc implementation. Fortunately, generalizations about // common features seen among implementations seems to suffice. // __pagesize need not match the actual VM page size for good // results in practice, thus we pick a common value on the low // side. __malloc_header_size is an estimate of the amount of // overhead per memory allocation (in practice seen N * sizeof // (void*) where N is 0, 2 or 4). According to folklore, // picking this value on the high side is better than // low-balling it (especially when this algorithm is used with // malloc implementations that allocate memory blocks rounded up // to a size which is a power of 2). const size_type __pagesize = 4096; const size_type __malloc_header_size = 4 * sizeof(void*); // The below implements an exponential growth policy, necessary to // meet amortized linear time requirements of the library: see // http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html. if (__capacity > __old_capacity && __capacity < 2 * __old_capacity) { __capacity = 2 * __old_capacity; // Never allocate a string bigger than _S_max_size. if (__capacity > size_type(_S_max_size)) __capacity = size_type(_S_max_size); } // NB: Need an array of char_type[__capacity], plus a terminating // null char_type() element, plus enough for the _Rep data structure, // plus sizeof(_Rep) - 1 to upper round to a size multiple of // sizeof(_Rep). // Whew. Seemingly so needy, yet so elemental. size_type __size = ((__capacity + 1) * sizeof(_CharT) + 2 * sizeof(_Rep) - 1); const size_type __adj_size = __size + __malloc_header_size; if (__adj_size > __pagesize && __capacity > __old_capacity) { const size_type __extra = __pagesize - __adj_size % __pagesize; __capacity += __extra / sizeof(_CharT); if (__capacity > size_type(_S_max_size)) __capacity = size_type(_S_max_size); __size = (__capacity + 1) * sizeof(_CharT) + 2 * sizeof(_Rep) - 1; } // NB: Might throw, but no worries about a leak, mate: _Rep() // does not throw. _Rep* __place = _Rep_alloc_type(__alloc).allocate(__size / sizeof(_Rep)); _Rep* __p = new (__place) _Rep; __p->_M_info._M_capacity = __capacity; return __p; } template<typename _CharT, typename _Traits, typename _Alloc> void __rc_string_base<_CharT, _Traits, _Alloc>::_Rep:: _M_destroy(const _Alloc& __a) throw () { const size_type __size = ((_M_info._M_capacity + 1) * sizeof(_CharT) + 2 * sizeof(_Rep) - 1); _Rep_alloc_type(__a).deallocate(this, __size / sizeof(_Rep)); } template<typename _CharT, typename _Traits, typename _Alloc> _CharT* __rc_string_base<_CharT, _Traits, _Alloc>::_Rep:: _M_clone(const _Alloc& __alloc, size_type __res) { // Requested capacity of the clone. const size_type __requested_cap = _M_info._M_length + __res; _Rep* __r = _Rep::_S_create(__requested_cap, _M_info._M_capacity, __alloc); if (_M_info._M_length) __rc_string_base::_S_copy(__r->_M_refdata(), _M_refdata(), _M_info._M_length); __r->_M_set_length(_M_info._M_length); return __r->_M_refdata(); } template<typename _CharT, typename _Traits, typename _Alloc> __rc_string_base<_CharT, _Traits, _Alloc>:: __rc_string_base(const _Alloc& __a) : _M_dataplus(__a, _S_construct(size_type(), _CharT(), __a)) { } template<typename _CharT, typename _Traits, typename _Alloc> __rc_string_base<_CharT, _Traits, _Alloc>:: __rc_string_base(const __rc_string_base& __rcs) : _M_dataplus(__rcs._M_get_allocator(), __rcs._M_grab(__rcs._M_get_allocator())) { } template<typename _CharT, typename _Traits, typename _Alloc> __rc_string_base<_CharT, _Traits, _Alloc>:: __rc_string_base(size_type __n, _CharT __c, const _Alloc& __a) : _M_dataplus(__a, _S_construct(__n, __c, __a)) { } template<typename _CharT, typename _Traits, typename _Alloc> template<typename _InputIterator> __rc_string_base<_CharT, _Traits, _Alloc>:: __rc_string_base(_InputIterator __beg, _InputIterator __end, const _Alloc& __a) : _M_dataplus(__a, _S_construct(__beg, __end, __a)) { } template<typename _CharT, typename _Traits, typename _Alloc> void __rc_string_base<_CharT, _Traits, _Alloc>:: _M_leak_hard() { if (_M_is_shared()) _M_erase(0, 0); _M_set_leaked(); } // NB: This is the special case for Input Iterators, used in // istreambuf_iterators, etc. // Input Iterators have a cost structure very different from // pointers, calling for a different coding style. template<typename _CharT, typename _Traits, typename _Alloc> template<typename _InIterator> _CharT* __rc_string_base<_CharT, _Traits, _Alloc>:: _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a, std::input_iterator_tag) { if (__beg == __end && __a == _Alloc()) return _S_empty_rep._M_refcopy(); // Avoid reallocation for common case. _CharT __buf[128]; size_type __len = 0; while (__beg != __end && __len < sizeof(__buf) / sizeof(_CharT)) { __buf[__len++] = *__beg; ++__beg; } _Rep* __r = _Rep::_S_create(__len, size_type(0), __a); _S_copy(__r->_M_refdata(), __buf, __len); __try { while (__beg != __end) { if (__len == __r->_M_info._M_capacity) { // Allocate more space. _Rep* __another = _Rep::_S_create(__len + 1, __len, __a); _S_copy(__another->_M_refdata(), __r->_M_refdata(), __len); __r->_M_destroy(__a); __r = __another; } __r->_M_refdata()[__len++] = *__beg; ++__beg; } } __catch(...) { __r->_M_destroy(__a); __throw_exception_again; } __r->_M_set_length(__len); return __r->_M_refdata(); } template<typename _CharT, typename _Traits, typename _Alloc> template<typename _InIterator> _CharT* __rc_string_base<_CharT, _Traits, _Alloc>:: _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a, std::forward_iterator_tag) { if (__beg == __end && __a == _Alloc()) return _S_empty_rep._M_refcopy(); // NB: Not required, but considered best practice. if (__is_null_pointer(__beg) && __beg != __end) std::__throw_logic_error(__N("__rc_string_base::" "_S_construct null not valid")); const size_type __dnew = static_cast<size_type>(std::distance(__beg, __end)); // Check for out_of_range and length_error exceptions. _Rep* __r = _Rep::_S_create(__dnew, size_type(0), __a); __try { __rc_string_base::_S_copy_chars(__r->_M_refdata(), __beg, __end); } __catch(...) { __r->_M_destroy(__a); __throw_exception_again; } __r->_M_set_length(__dnew); return __r->_M_refdata(); } template<typename _CharT, typename _Traits, typename _Alloc> _CharT* __rc_string_base<_CharT, _Traits, _Alloc>:: _S_construct(size_type __n, _CharT __c, const _Alloc& __a) { if (__n == 0 && __a == _Alloc()) return _S_empty_rep._M_refcopy(); // Check for out_of_range and length_error exceptions. _Rep* __r = _Rep::_S_create(__n, size_type(0), __a); if (__n) __rc_string_base::_S_assign(__r->_M_refdata(), __n, __c); __r->_M_set_length(__n); return __r->_M_refdata(); } template<typename _CharT, typename _Traits, typename _Alloc> void __rc_string_base<_CharT, _Traits, _Alloc>:: _M_swap(__rc_string_base& __rcs) { if (_M_is_leaked()) _M_set_sharable(); if (__rcs._M_is_leaked()) __rcs._M_set_sharable(); _CharT* __tmp = _M_data(); _M_data(__rcs._M_data()); __rcs._M_data(__tmp); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 431. Swapping containers with unequal allocators. std::__alloc_swap<allocator_type>::_S_do_it(_M_get_allocator(), __rcs._M_get_allocator()); } template<typename _CharT, typename _Traits, typename _Alloc> void __rc_string_base<_CharT, _Traits, _Alloc>:: _M_assign(const __rc_string_base& __rcs) { if (_M_rep() != __rcs._M_rep()) { _CharT* __tmp = __rcs._M_grab(_M_get_allocator()); _M_dispose(); _M_data(__tmp); } } template<typename _CharT, typename _Traits, typename _Alloc> void __rc_string_base<_CharT, _Traits, _Alloc>:: _M_reserve(size_type __res) { // Make sure we don't shrink below the current size. if (__res < _M_length()) __res = _M_length(); if (__res != _M_capacity() || _M_is_shared()) { _CharT* __tmp = _M_rep()->_M_clone(_M_get_allocator(), __res - _M_length()); _M_dispose(); _M_data(__tmp); } } template<typename _CharT, typename _Traits, typename _Alloc> void __rc_string_base<_CharT, _Traits, _Alloc>:: _M_mutate(size_type __pos, size_type __len1, const _CharT* __s, size_type __len2) { const size_type __how_much = _M_length() - __pos - __len1; _Rep* __r = _Rep::_S_create(_M_length() + __len2 - __len1, _M_capacity(), _M_get_allocator()); if (__pos) this->_S_copy(__r->_M_refdata(), _M_data(), __pos); if (__s && __len2) this->_S_copy(__r->_M_refdata() + __pos, __s, __len2); if (__how_much) this->_S_copy(__r->_M_refdata() + __pos + __len2, _M_data() + __pos + __len1, __how_much); _M_dispose(); _M_data(__r->_M_refdata()); } template<typename _CharT, typename _Traits, typename _Alloc> void __rc_string_base<_CharT, _Traits, _Alloc>:: _M_erase(size_type __pos, size_type __n) { const size_type __new_size = _M_length() - __n; const size_type __how_much = _M_length() - __pos - __n; if (_M_is_shared()) { // Must reallocate. _Rep* __r = _Rep::_S_create(__new_size, _M_capacity(), _M_get_allocator()); if (__pos) this->_S_copy(__r->_M_refdata(), _M_data(), __pos); if (__how_much) this->_S_copy(__r->_M_refdata() + __pos, _M_data() + __pos + __n, __how_much); _M_dispose(); _M_data(__r->_M_refdata()); } else if (__how_much && __n) { // Work in-place. this->_S_move(_M_data() + __pos, _M_data() + __pos + __n, __how_much); } _M_rep()->_M_set_length(__new_size); } template<> inline bool __rc_string_base<char, std::char_traits<char>, std::allocator<char> >:: _M_compare(const __rc_string_base& __rcs) const { if (_M_rep() == __rcs._M_rep()) return true; return false; } #ifdef _GLIBCXX_USE_WCHAR_T template<> inline bool __rc_string_base<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >:: _M_compare(const __rc_string_base& __rcs) const { if (_M_rep() == __rcs._M_rep()) return true; return false; } #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _RC_STRING_BASE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/numeric�������������������������������������������������������������������������������0000644�����������������00000011173�14763166030�0007763 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Numeric extensions -*- C++ -*- // Copyright (C) 2002-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file ext/numeric * This file is a GNU extension to the Standard C++ Library (possibly * containing extensions from the HP/SGI STL subset). */ #ifndef _EXT_NUMERIC #define _EXT_NUMERIC 1 #pragma GCC system_header #include <bits/concept_check.h> #include <numeric> #include <ext/functional> // For identity_element namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Returns __x ** __n, where __n >= 0. _Note that "multiplication" // is required to be associative, but not necessarily commutative. template<typename _Tp, typename _Integer, typename _MonoidOperation> _Tp __power(_Tp __x, _Integer __n, _MonoidOperation __monoid_op) { if (__n == 0) return identity_element(__monoid_op); else { while ((__n & 1) == 0) { __n >>= 1; __x = __monoid_op(__x, __x); } _Tp __result = __x; __n >>= 1; while (__n != 0) { __x = __monoid_op(__x, __x); if ((__n & 1) != 0) __result = __monoid_op(__result, __x); __n >>= 1; } return __result; } } template<typename _Tp, typename _Integer> inline _Tp __power(_Tp __x, _Integer __n) { return __power(__x, __n, std::multiplies<_Tp>()); } /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ // Alias for the internal name __power. Note that power is an extension, // not part of the C++ standard. template<typename _Tp, typename _Integer, typename _MonoidOperation> inline _Tp power(_Tp __x, _Integer __n, _MonoidOperation __monoid_op) { return __power(__x, __n, __monoid_op); } /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ template<typename _Tp, typename _Integer> inline _Tp power(_Tp __x, _Integer __n) { return __power(__x, __n); } #if __cplusplus >= 201103L using std::iota; #else /** * This is an SGI extension. * @ingroup SGIextensions * @doctodo */ // iota is not part of the C++ standard. It is an extension. template<typename _ForwardIter, typename _Tp> void iota(_ForwardIter __first, _ForwardIter __last, _Tp __value) { // concept requirements __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<_ForwardIter>) __glibcxx_function_requires(_ConvertibleConcept<_Tp, typename std::iterator_traits<_ForwardIter>::value_type>) while (__first != __last) *__first++ = __value++; } #endif // C++11 _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/sso_string_base.h���������������������������������������������������������������������0000644�����������������00000037672�14763166030�0011747 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Short-string-optimized versatile string base -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/sso_string_base.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ext/vstring.h} */ #ifndef _SSO_STRING_BASE_H #define _SSO_STRING_BASE_H 1 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _CharT, typename _Traits, typename _Alloc> class __sso_string_base : protected __vstring_utility<_CharT, _Traits, _Alloc> { public: typedef _Traits traits_type; typedef typename _Traits::char_type value_type; typedef __vstring_utility<_CharT, _Traits, _Alloc> _Util_Base; typedef typename _Util_Base::_CharT_alloc_type _CharT_alloc_type; typedef typename _CharT_alloc_type::size_type size_type; private: // Data Members: typename _Util_Base::template _Alloc_hider<_CharT_alloc_type> _M_dataplus; size_type _M_string_length; enum { _S_local_capacity = 15 }; union { _CharT _M_local_data[_S_local_capacity + 1]; size_type _M_allocated_capacity; }; void _M_data(_CharT* __p) { _M_dataplus._M_p = __p; } void _M_length(size_type __length) { _M_string_length = __length; } void _M_capacity(size_type __capacity) { _M_allocated_capacity = __capacity; } bool _M_is_local() const { return _M_data() == _M_local_data; } // Create & Destroy _CharT* _M_create(size_type&, size_type); void _M_dispose() { if (!_M_is_local()) _M_destroy(_M_allocated_capacity); } void _M_destroy(size_type __size) throw() { _M_get_allocator().deallocate(_M_data(), __size + 1); } // _M_construct_aux is used to implement the 21.3.1 para 15 which // requires special behaviour if _InIterator is an integral type template<typename _InIterator> void _M_construct_aux(_InIterator __beg, _InIterator __end, std::__false_type) { typedef typename iterator_traits<_InIterator>::iterator_category _Tag; _M_construct(__beg, __end, _Tag()); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 438. Ambiguity in the "do the right thing" clause template<typename _Integer> void _M_construct_aux(_Integer __beg, _Integer __end, std::__true_type) { _M_construct_aux_2(static_cast<size_type>(__beg), __end); } void _M_construct_aux_2(size_type __req, _CharT __c) { _M_construct(__req, __c); } template<typename _InIterator> void _M_construct(_InIterator __beg, _InIterator __end) { typedef typename std::__is_integer<_InIterator>::__type _Integral; _M_construct_aux(__beg, __end, _Integral()); } // For Input Iterators, used in istreambuf_iterators, etc. template<typename _InIterator> void _M_construct(_InIterator __beg, _InIterator __end, std::input_iterator_tag); // For forward_iterators up to random_access_iterators, used for // string::iterator, _CharT*, etc. template<typename _FwdIterator> void _M_construct(_FwdIterator __beg, _FwdIterator __end, std::forward_iterator_tag); void _M_construct(size_type __req, _CharT __c); public: size_type _M_max_size() const { return (_M_get_allocator().max_size() - 1) / 2; } _CharT* _M_data() const { return _M_dataplus._M_p; } size_type _M_length() const { return _M_string_length; } size_type _M_capacity() const { return _M_is_local() ? size_type(_S_local_capacity) : _M_allocated_capacity; } bool _M_is_shared() const { return false; } void _M_set_leaked() { } void _M_leak() { } void _M_set_length(size_type __n) { _M_length(__n); traits_type::assign(_M_data()[__n], _CharT()); } __sso_string_base() : _M_dataplus(_M_local_data) { _M_set_length(0); } __sso_string_base(const _Alloc& __a); __sso_string_base(const __sso_string_base& __rcs); #if __cplusplus >= 201103L __sso_string_base(__sso_string_base&& __rcs); #endif __sso_string_base(size_type __n, _CharT __c, const _Alloc& __a); template<typename _InputIterator> __sso_string_base(_InputIterator __beg, _InputIterator __end, const _Alloc& __a); ~__sso_string_base() { _M_dispose(); } _CharT_alloc_type& _M_get_allocator() { return _M_dataplus; } const _CharT_alloc_type& _M_get_allocator() const { return _M_dataplus; } void _M_swap(__sso_string_base& __rcs); void _M_assign(const __sso_string_base& __rcs); void _M_reserve(size_type __res); void _M_mutate(size_type __pos, size_type __len1, const _CharT* __s, size_type __len2); void _M_erase(size_type __pos, size_type __n); void _M_clear() { _M_set_length(0); } bool _M_compare(const __sso_string_base&) const { return false; } }; template<typename _CharT, typename _Traits, typename _Alloc> void __sso_string_base<_CharT, _Traits, _Alloc>:: _M_swap(__sso_string_base& __rcs) { if (this == &__rcs) return; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 431. Swapping containers with unequal allocators. std::__alloc_swap<_CharT_alloc_type>::_S_do_it(_M_get_allocator(), __rcs._M_get_allocator()); if (_M_is_local()) if (__rcs._M_is_local()) { if (_M_length() && __rcs._M_length()) { _CharT __tmp_data[_S_local_capacity + 1]; traits_type::copy(__tmp_data, __rcs._M_local_data, _S_local_capacity + 1); traits_type::copy(__rcs._M_local_data, _M_local_data, _S_local_capacity + 1); traits_type::copy(_M_local_data, __tmp_data, _S_local_capacity + 1); } else if (__rcs._M_length()) { traits_type::copy(_M_local_data, __rcs._M_local_data, _S_local_capacity + 1); _M_length(__rcs._M_length()); __rcs._M_set_length(0); return; } else if (_M_length()) { traits_type::copy(__rcs._M_local_data, _M_local_data, _S_local_capacity + 1); __rcs._M_length(_M_length()); _M_set_length(0); return; } } else { const size_type __tmp_capacity = __rcs._M_allocated_capacity; traits_type::copy(__rcs._M_local_data, _M_local_data, _S_local_capacity + 1); _M_data(__rcs._M_data()); __rcs._M_data(__rcs._M_local_data); _M_capacity(__tmp_capacity); } else { const size_type __tmp_capacity = _M_allocated_capacity; if (__rcs._M_is_local()) { traits_type::copy(_M_local_data, __rcs._M_local_data, _S_local_capacity + 1); __rcs._M_data(_M_data()); _M_data(_M_local_data); } else { _CharT* __tmp_ptr = _M_data(); _M_data(__rcs._M_data()); __rcs._M_data(__tmp_ptr); _M_capacity(__rcs._M_allocated_capacity); } __rcs._M_capacity(__tmp_capacity); } const size_type __tmp_length = _M_length(); _M_length(__rcs._M_length()); __rcs._M_length(__tmp_length); } template<typename _CharT, typename _Traits, typename _Alloc> _CharT* __sso_string_base<_CharT, _Traits, _Alloc>:: _M_create(size_type& __capacity, size_type __old_capacity) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 83. String::npos vs. string::max_size() if (__capacity > _M_max_size()) std::__throw_length_error(__N("__sso_string_base::_M_create")); // The below implements an exponential growth policy, necessary to // meet amortized linear time requirements of the library: see // http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html. if (__capacity > __old_capacity && __capacity < 2 * __old_capacity) { __capacity = 2 * __old_capacity; // Never allocate a string bigger than max_size. if (__capacity > _M_max_size()) __capacity = _M_max_size(); } // NB: Need an array of char_type[__capacity], plus a terminating // null char_type() element. return _M_get_allocator().allocate(__capacity + 1); } template<typename _CharT, typename _Traits, typename _Alloc> __sso_string_base<_CharT, _Traits, _Alloc>:: __sso_string_base(const _Alloc& __a) : _M_dataplus(__a, _M_local_data) { _M_set_length(0); } template<typename _CharT, typename _Traits, typename _Alloc> __sso_string_base<_CharT, _Traits, _Alloc>:: __sso_string_base(const __sso_string_base& __rcs) : _M_dataplus(__rcs._M_get_allocator(), _M_local_data) { _M_construct(__rcs._M_data(), __rcs._M_data() + __rcs._M_length()); } #if __cplusplus >= 201103L template<typename _CharT, typename _Traits, typename _Alloc> __sso_string_base<_CharT, _Traits, _Alloc>:: __sso_string_base(__sso_string_base&& __rcs) : _M_dataplus(__rcs._M_get_allocator(), _M_local_data) { if (__rcs._M_is_local()) { if (__rcs._M_length()) traits_type::copy(_M_local_data, __rcs._M_local_data, _S_local_capacity + 1); } else { _M_data(__rcs._M_data()); _M_capacity(__rcs._M_allocated_capacity); } _M_set_length(__rcs._M_length()); __rcs._M_data(__rcs._M_local_data); __rcs._M_set_length(0); } #endif template<typename _CharT, typename _Traits, typename _Alloc> __sso_string_base<_CharT, _Traits, _Alloc>:: __sso_string_base(size_type __n, _CharT __c, const _Alloc& __a) : _M_dataplus(__a, _M_local_data) { _M_construct(__n, __c); } template<typename _CharT, typename _Traits, typename _Alloc> template<typename _InputIterator> __sso_string_base<_CharT, _Traits, _Alloc>:: __sso_string_base(_InputIterator __beg, _InputIterator __end, const _Alloc& __a) : _M_dataplus(__a, _M_local_data) { _M_construct(__beg, __end); } // NB: This is the special case for Input Iterators, used in // istreambuf_iterators, etc. // Input Iterators have a cost structure very different from // pointers, calling for a different coding style. template<typename _CharT, typename _Traits, typename _Alloc> template<typename _InIterator> void __sso_string_base<_CharT, _Traits, _Alloc>:: _M_construct(_InIterator __beg, _InIterator __end, std::input_iterator_tag) { size_type __len = 0; size_type __capacity = size_type(_S_local_capacity); while (__beg != __end && __len < __capacity) { _M_data()[__len++] = *__beg; ++__beg; } __try { while (__beg != __end) { if (__len == __capacity) { // Allocate more space. __capacity = __len + 1; _CharT* __another = _M_create(__capacity, __len); this->_S_copy(__another, _M_data(), __len); _M_dispose(); _M_data(__another); _M_capacity(__capacity); } _M_data()[__len++] = *__beg; ++__beg; } } __catch(...) { _M_dispose(); __throw_exception_again; } _M_set_length(__len); } template<typename _CharT, typename _Traits, typename _Alloc> template<typename _InIterator> void __sso_string_base<_CharT, _Traits, _Alloc>:: _M_construct(_InIterator __beg, _InIterator __end, std::forward_iterator_tag) { // NB: Not required, but considered best practice. if (__is_null_pointer(__beg) && __beg != __end) std::__throw_logic_error(__N("__sso_string_base::" "_M_construct null not valid")); size_type __dnew = static_cast<size_type>(std::distance(__beg, __end)); if (__dnew > size_type(_S_local_capacity)) { _M_data(_M_create(__dnew, size_type(0))); _M_capacity(__dnew); } // Check for out_of_range and length_error exceptions. __try { this->_S_copy_chars(_M_data(), __beg, __end); } __catch(...) { _M_dispose(); __throw_exception_again; } _M_set_length(__dnew); } template<typename _CharT, typename _Traits, typename _Alloc> void __sso_string_base<_CharT, _Traits, _Alloc>:: _M_construct(size_type __n, _CharT __c) { if (__n > size_type(_S_local_capacity)) { _M_data(_M_create(__n, size_type(0))); _M_capacity(__n); } if (__n) this->_S_assign(_M_data(), __n, __c); _M_set_length(__n); } template<typename _CharT, typename _Traits, typename _Alloc> void __sso_string_base<_CharT, _Traits, _Alloc>:: _M_assign(const __sso_string_base& __rcs) { if (this != &__rcs) { const size_type __rsize = __rcs._M_length(); const size_type __capacity = _M_capacity(); if (__rsize > __capacity) { size_type __new_capacity = __rsize; _CharT* __tmp = _M_create(__new_capacity, __capacity); _M_dispose(); _M_data(__tmp); _M_capacity(__new_capacity); } if (__rsize) this->_S_copy(_M_data(), __rcs._M_data(), __rsize); _M_set_length(__rsize); } } template<typename _CharT, typename _Traits, typename _Alloc> void __sso_string_base<_CharT, _Traits, _Alloc>:: _M_reserve(size_type __res) { // Make sure we don't shrink below the current size. if (__res < _M_length()) __res = _M_length(); const size_type __capacity = _M_capacity(); if (__res != __capacity) { if (__res > __capacity || __res > size_type(_S_local_capacity)) { _CharT* __tmp = _M_create(__res, __capacity); this->_S_copy(__tmp, _M_data(), _M_length() + 1); _M_dispose(); _M_data(__tmp); _M_capacity(__res); } else if (!_M_is_local()) { this->_S_copy(_M_local_data, _M_data(), _M_length() + 1); _M_destroy(__capacity); _M_data(_M_local_data); } } } template<typename _CharT, typename _Traits, typename _Alloc> void __sso_string_base<_CharT, _Traits, _Alloc>:: _M_mutate(size_type __pos, size_type __len1, const _CharT* __s, size_type __len2) { const size_type __how_much = _M_length() - __pos - __len1; size_type __new_capacity = _M_length() + __len2 - __len1; _CharT* __r = _M_create(__new_capacity, _M_capacity()); if (__pos) this->_S_copy(__r, _M_data(), __pos); if (__s && __len2) this->_S_copy(__r + __pos, __s, __len2); if (__how_much) this->_S_copy(__r + __pos + __len2, _M_data() + __pos + __len1, __how_much); _M_dispose(); _M_data(__r); _M_capacity(__new_capacity); } template<typename _CharT, typename _Traits, typename _Alloc> void __sso_string_base<_CharT, _Traits, _Alloc>:: _M_erase(size_type __pos, size_type __n) { const size_type __how_much = _M_length() - __pos - __n; if (__how_much && __n) this->_S_move(_M_data() + __pos, _M_data() + __pos + __n, __how_much); _M_set_length(_M_length() - __n); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _SSO_STRING_BASE_H */ ����������������������������������������������������������������������c++/4.8.2/ext/string_conversions.h������������������������������������������������������������������0000644�����������������00000006213�14763166030�0012504 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// String Conversions -*- C++ -*- // Copyright (C) 2008-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/string_conversions.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _STRING_CONVERSIONS_H #define _STRING_CONVERSIONS_H 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <bits/c++config.h> #include <ext/numeric_traits.h> #include <bits/functexcept.h> #include <cstdlib> #include <cwchar> #include <cstdio> #include <cerrno> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Helper for all the sto* functions. template<typename _TRet, typename _Ret = _TRet, typename _CharT, typename... _Base> _Ret __stoa(_TRet (*__convf) (const _CharT*, _CharT**, _Base...), const char* __name, const _CharT* __str, std::size_t* __idx, _Base... __base) { _Ret __ret; _CharT* __endptr; errno = 0; const _TRet __tmp = __convf(__str, &__endptr, __base...); if (__endptr == __str) std::__throw_invalid_argument(__name); else if (errno == ERANGE || (std::__are_same<_Ret, int>::__value && (__tmp < __numeric_traits<int>::__min || __tmp > __numeric_traits<int>::__max))) std::__throw_out_of_range(__name); else __ret = __tmp; if (__idx) *__idx = __endptr - __str; return __ret; } // Helper for the to_string / to_wstring functions. template<typename _String, typename _CharT = typename _String::value_type> _String __to_xstring(int (*__convf) (_CharT*, std::size_t, const _CharT*, __builtin_va_list), std::size_t __n, const _CharT* __fmt, ...) { // XXX Eventually the result will be constructed in place in // the C++0x string, likely with the help of internal hooks. _CharT* __s = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __n)); __builtin_va_list __args; __builtin_va_start(__args, __fmt); const int __len = __convf(__s, __n, __fmt, __args); __builtin_va_end(__args); return _String(__s, __s + __len); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // C++11 #endif // _STRING_CONVERSIONS_H �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/atomicity.h���������������������������������������������������������������������������0000644�����������������00000006645�14763166030�0010561 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Support for atomic operations -*- C++ -*- // Copyright (C) 2004-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/atomicity.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _GLIBCXX_ATOMICITY_H #define _GLIBCXX_ATOMICITY_H 1 #pragma GCC system_header #include <bits/c++config.h> #include <bits/gthr.h> #include <bits/atomic_word.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Functions for portable atomic access. // To abstract locking primitives across all thread policies, use: // __exchange_and_add_dispatch // __atomic_add_dispatch #ifdef _GLIBCXX_ATOMIC_BUILTINS static inline _Atomic_word __exchange_and_add(volatile _Atomic_word* __mem, int __val) { return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); } static inline void __atomic_add(volatile _Atomic_word* __mem, int __val) { __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); } #else _Atomic_word __attribute__ ((__unused__)) __exchange_and_add(volatile _Atomic_word*, int) throw (); void __attribute__ ((__unused__)) __atomic_add(volatile _Atomic_word*, int) throw (); #endif static inline _Atomic_word __exchange_and_add_single(_Atomic_word* __mem, int __val) { _Atomic_word __result = *__mem; *__mem += __val; return __result; } static inline void __atomic_add_single(_Atomic_word* __mem, int __val) { *__mem += __val; } static inline _Atomic_word __attribute__ ((__unused__)) __exchange_and_add_dispatch(_Atomic_word* __mem, int __val) { #ifdef __GTHREADS if (__gthread_active_p()) return __exchange_and_add(__mem, __val); else return __exchange_and_add_single(__mem, __val); #else return __exchange_and_add_single(__mem, __val); #endif } static inline void __attribute__ ((__unused__)) __atomic_add_dispatch(_Atomic_word* __mem, int __val) { #ifdef __GTHREADS if (__gthread_active_p()) __atomic_add(__mem, __val); else __atomic_add_single(__mem, __val); #else __atomic_add_single(__mem, __val); #endif } _GLIBCXX_END_NAMESPACE_VERSION } // namespace // Even if the CPU doesn't need a memory barrier, we need to ensure // that the compiler doesn't reorder memory accesses across the // barriers. #ifndef _GLIBCXX_READ_MEM_BARRIER #define _GLIBCXX_READ_MEM_BARRIER __asm __volatile ("":::"memory") #endif #ifndef _GLIBCXX_WRITE_MEM_BARRIER #define _GLIBCXX_WRITE_MEM_BARRIER __asm __volatile ("":::"memory") #endif #endif �������������������������������������������������������������������������������������������c++/4.8.2/ext/new_allocator.h�����������������������������������������������������������������������0000644�����������������00000010524�14763166030�0011377 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Allocator that wraps operator new -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/new_allocator.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _NEW_ALLOCATOR_H #define _NEW_ALLOCATOR_H 1 #include <bits/c++config.h> #include <new> #include <bits/functexcept.h> #include <bits/move.h> #if __cplusplus >= 201103L #include <type_traits> #endif namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using std::size_t; using std::ptrdiff_t; /** * @brief An allocator that uses global new, as per [20.4]. * @ingroup allocators * * This is precisely the allocator defined in the C++ Standard. * - all allocation calls operator new * - all deallocation calls operator delete * * @tparam _Tp Type of allocated object. */ template<typename _Tp> class new_allocator { public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Tp* pointer; typedef const _Tp* const_pointer; typedef _Tp& reference; typedef const _Tp& const_reference; typedef _Tp value_type; template<typename _Tp1> struct rebind { typedef new_allocator<_Tp1> other; }; #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2103. propagate_on_container_move_assignment typedef std::true_type propagate_on_container_move_assignment; #endif new_allocator() _GLIBCXX_USE_NOEXCEPT { } new_allocator(const new_allocator&) _GLIBCXX_USE_NOEXCEPT { } template<typename _Tp1> new_allocator(const new_allocator<_Tp1>&) _GLIBCXX_USE_NOEXCEPT { } ~new_allocator() _GLIBCXX_USE_NOEXCEPT { } pointer address(reference __x) const _GLIBCXX_NOEXCEPT { return std::__addressof(__x); } const_pointer address(const_reference __x) const _GLIBCXX_NOEXCEPT { return std::__addressof(__x); } // NB: __n is permitted to be 0. The C++ standard says nothing // about what the return value is when __n == 0. pointer allocate(size_type __n, const void* = 0) { if (__n > this->max_size()) std::__throw_bad_alloc(); return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp))); } // __p is not permitted to be a null pointer. void deallocate(pointer __p, size_type) { ::operator delete(__p); } size_type max_size() const _GLIBCXX_USE_NOEXCEPT { return size_t(-1) / sizeof(_Tp); } #if __cplusplus >= 201103L template<typename _Up, typename... _Args> void construct(_Up* __p, _Args&&... __args) { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } template<typename _Up> void destroy(_Up* __p) { __p->~_Up(); } #else // _GLIBCXX_RESOLVE_LIB_DEFECTS // 402. wrong new expression in [some_] allocator::construct void construct(pointer __p, const _Tp& __val) { ::new((void *)__p) _Tp(__val); } void destroy(pointer __p) { __p->~_Tp(); } #endif }; template<typename _Tp> inline bool operator==(const new_allocator<_Tp>&, const new_allocator<_Tp>&) { return true; } template<typename _Tp> inline bool operator!=(const new_allocator<_Tp>&, const new_allocator<_Tp>&) { return false; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/codecvt_specializations.h�������������������������������������������������������������0000644�����������������00000037641�14763166030�0013467 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Locale support (codecvt) -*- C++ -*- // Copyright (C) 2000-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // // ISO C++ 14882: 22.2.1.5 Template class codecvt // // Written by Benjamin Kosnik <bkoz@redhat.com> /** @file ext/codecvt_specializations.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _EXT_CODECVT_SPECIALIZATIONS_H #define _EXT_CODECVT_SPECIALIZATIONS_H 1 #include <bits/c++config.h> #include <locale> #include <iconv.h> namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /// Extension to use iconv for dealing with character encodings. // This includes conversions and comparisons between various character // sets. This object encapsulates data that may need to be shared between // char_traits, codecvt and ctype. class encoding_state { public: // Types: // NB: A conversion descriptor subsumes and enhances the // functionality of a simple state type such as mbstate_t. typedef iconv_t descriptor_type; protected: // Name of internal character set encoding. std::string _M_int_enc; // Name of external character set encoding. std::string _M_ext_enc; // Conversion descriptor between external encoding to internal encoding. descriptor_type _M_in_desc; // Conversion descriptor between internal encoding to external encoding. descriptor_type _M_out_desc; // The byte-order marker for the external encoding, if necessary. int _M_ext_bom; // The byte-order marker for the internal encoding, if necessary. int _M_int_bom; // Number of external bytes needed to construct one complete // character in the internal encoding. // NB: -1 indicates variable, or stateful, encodings. int _M_bytes; public: explicit encoding_state() : _M_in_desc(0), _M_out_desc(0), _M_ext_bom(0), _M_int_bom(0), _M_bytes(0) { } explicit encoding_state(const char* __int, const char* __ext, int __ibom = 0, int __ebom = 0, int __bytes = 1) : _M_int_enc(__int), _M_ext_enc(__ext), _M_in_desc(0), _M_out_desc(0), _M_ext_bom(__ebom), _M_int_bom(__ibom), _M_bytes(__bytes) { init(); } // 21.1.2 traits typedefs // p4 // typedef STATE_T state_type // requires: state_type shall meet the requirements of // CopyConstructible types (20.1.3) // NB: This does not preserve the actual state of the conversion // descriptor member, but it does duplicate the encoding // information. encoding_state(const encoding_state& __obj) : _M_in_desc(0), _M_out_desc(0) { construct(__obj); } // Need assignment operator as well. encoding_state& operator=(const encoding_state& __obj) { construct(__obj); return *this; } ~encoding_state() { destroy(); } bool good() const throw() { const descriptor_type __err = (iconv_t)(-1); bool __test = _M_in_desc && _M_in_desc != __err; __test &= _M_out_desc && _M_out_desc != __err; return __test; } int character_ratio() const { return _M_bytes; } const std::string internal_encoding() const { return _M_int_enc; } int internal_bom() const { return _M_int_bom; } const std::string external_encoding() const { return _M_ext_enc; } int external_bom() const { return _M_ext_bom; } const descriptor_type& in_descriptor() const { return _M_in_desc; } const descriptor_type& out_descriptor() const { return _M_out_desc; } protected: void init() { const descriptor_type __err = (iconv_t)(-1); const bool __have_encodings = _M_int_enc.size() && _M_ext_enc.size(); if (!_M_in_desc && __have_encodings) { _M_in_desc = iconv_open(_M_int_enc.c_str(), _M_ext_enc.c_str()); if (_M_in_desc == __err) std::__throw_runtime_error(__N("encoding_state::_M_init " "creating iconv input descriptor failed")); } if (!_M_out_desc && __have_encodings) { _M_out_desc = iconv_open(_M_ext_enc.c_str(), _M_int_enc.c_str()); if (_M_out_desc == __err) std::__throw_runtime_error(__N("encoding_state::_M_init " "creating iconv output descriptor failed")); } } void construct(const encoding_state& __obj) { destroy(); _M_int_enc = __obj._M_int_enc; _M_ext_enc = __obj._M_ext_enc; _M_ext_bom = __obj._M_ext_bom; _M_int_bom = __obj._M_int_bom; _M_bytes = __obj._M_bytes; init(); } void destroy() throw() { const descriptor_type __err = (iconv_t)(-1); if (_M_in_desc && _M_in_desc != __err) { iconv_close(_M_in_desc); _M_in_desc = 0; } if (_M_out_desc && _M_out_desc != __err) { iconv_close(_M_out_desc); _M_out_desc = 0; } } }; /// encoding_char_traits // Custom traits type with encoding_state for the state type, and the // associated fpos<encoding_state> for the position type, all other // bits equivalent to the required char_traits instantiations. template<typename _CharT> struct encoding_char_traits : public std::char_traits<_CharT> { typedef encoding_state state_type; typedef typename std::fpos<state_type> pos_type; }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using __gnu_cxx::encoding_state; /// codecvt<InternT, _ExternT, encoding_state> specialization. // This partial specialization takes advantage of iconv to provide // code conversions between a large number of character encodings. template<typename _InternT, typename _ExternT> class codecvt<_InternT, _ExternT, encoding_state> : public __codecvt_abstract_base<_InternT, _ExternT, encoding_state> { public: // Types: typedef codecvt_base::result result; typedef _InternT intern_type; typedef _ExternT extern_type; typedef __gnu_cxx::encoding_state state_type; typedef state_type::descriptor_type descriptor_type; // Data Members: static locale::id id; explicit codecvt(size_t __refs = 0) : __codecvt_abstract_base<intern_type, extern_type, state_type>(__refs) { } explicit codecvt(state_type& __enc, size_t __refs = 0) : __codecvt_abstract_base<intern_type, extern_type, state_type>(__refs) { } protected: virtual ~codecvt() { } virtual result do_out(state_type& __state, const intern_type* __from, const intern_type* __from_end, const intern_type*& __from_next, extern_type* __to, extern_type* __to_end, extern_type*& __to_next) const; virtual result do_unshift(state_type& __state, extern_type* __to, extern_type* __to_end, extern_type*& __to_next) const; virtual result do_in(state_type& __state, const extern_type* __from, const extern_type* __from_end, const extern_type*& __from_next, intern_type* __to, intern_type* __to_end, intern_type*& __to_next) const; virtual int do_encoding() const throw(); virtual bool do_always_noconv() const throw(); virtual int do_length(state_type&, const extern_type* __from, const extern_type* __end, size_t __max) const; virtual int do_max_length() const throw(); }; template<typename _InternT, typename _ExternT> locale::id codecvt<_InternT, _ExternT, encoding_state>::id; // This adaptor works around the signature problems of the second // argument to iconv(): SUSv2 and others use 'const char**', but glibc 2.2 // uses 'char**', which matches the POSIX 1003.1-2001 standard. // Using this adaptor, g++ will do the work for us. template<typename _Tp> inline size_t __iconv_adaptor(size_t(*__func)(iconv_t, _Tp, size_t*, char**, size_t*), iconv_t __cd, char** __inbuf, size_t* __inbytes, char** __outbuf, size_t* __outbytes) { return __func(__cd, (_Tp)__inbuf, __inbytes, __outbuf, __outbytes); } template<typename _InternT, typename _ExternT> codecvt_base::result codecvt<_InternT, _ExternT, encoding_state>:: do_out(state_type& __state, const intern_type* __from, const intern_type* __from_end, const intern_type*& __from_next, extern_type* __to, extern_type* __to_end, extern_type*& __to_next) const { result __ret = codecvt_base::error; if (__state.good()) { const descriptor_type& __desc = __state.out_descriptor(); const size_t __fmultiple = sizeof(intern_type); size_t __fbytes = __fmultiple * (__from_end - __from); const size_t __tmultiple = sizeof(extern_type); size_t __tbytes = __tmultiple * (__to_end - __to); // Argument list for iconv specifies a byte sequence. Thus, // all to/from arrays must be brutally casted to char*. char* __cto = reinterpret_cast<char*>(__to); char* __cfrom; size_t __conv; // Some encodings need a byte order marker as the first item // in the byte stream, to designate endian-ness. The default // value for the byte order marker is NULL, so if this is // the case, it's not necessary and we can just go on our // merry way. int __int_bom = __state.internal_bom(); if (__int_bom) { size_t __size = __from_end - __from; intern_type* __cfixed = static_cast<intern_type*> (__builtin_alloca(sizeof(intern_type) * (__size + 1))); __cfixed[0] = static_cast<intern_type>(__int_bom); char_traits<intern_type>::copy(__cfixed + 1, __from, __size); __cfrom = reinterpret_cast<char*>(__cfixed); __conv = __iconv_adaptor(iconv, __desc, &__cfrom, &__fbytes, &__cto, &__tbytes); } else { intern_type* __cfixed = const_cast<intern_type*>(__from); __cfrom = reinterpret_cast<char*>(__cfixed); __conv = __iconv_adaptor(iconv, __desc, &__cfrom, &__fbytes, &__cto, &__tbytes); } if (__conv != size_t(-1)) { __from_next = reinterpret_cast<const intern_type*>(__cfrom); __to_next = reinterpret_cast<extern_type*>(__cto); __ret = codecvt_base::ok; } else { if (__fbytes < __fmultiple * (__from_end - __from)) { __from_next = reinterpret_cast<const intern_type*>(__cfrom); __to_next = reinterpret_cast<extern_type*>(__cto); __ret = codecvt_base::partial; } else __ret = codecvt_base::error; } } return __ret; } template<typename _InternT, typename _ExternT> codecvt_base::result codecvt<_InternT, _ExternT, encoding_state>:: do_unshift(state_type& __state, extern_type* __to, extern_type* __to_end, extern_type*& __to_next) const { result __ret = codecvt_base::error; if (__state.good()) { const descriptor_type& __desc = __state.in_descriptor(); const size_t __tmultiple = sizeof(intern_type); size_t __tlen = __tmultiple * (__to_end - __to); // Argument list for iconv specifies a byte sequence. Thus, // all to/from arrays must be brutally casted to char*. char* __cto = reinterpret_cast<char*>(__to); size_t __conv = __iconv_adaptor(iconv,__desc, 0, 0, &__cto, &__tlen); if (__conv != size_t(-1)) { __to_next = reinterpret_cast<extern_type*>(__cto); if (__tlen == __tmultiple * (__to_end - __to)) __ret = codecvt_base::noconv; else if (__tlen == 0) __ret = codecvt_base::ok; else __ret = codecvt_base::partial; } else __ret = codecvt_base::error; } return __ret; } template<typename _InternT, typename _ExternT> codecvt_base::result codecvt<_InternT, _ExternT, encoding_state>:: do_in(state_type& __state, const extern_type* __from, const extern_type* __from_end, const extern_type*& __from_next, intern_type* __to, intern_type* __to_end, intern_type*& __to_next) const { result __ret = codecvt_base::error; if (__state.good()) { const descriptor_type& __desc = __state.in_descriptor(); const size_t __fmultiple = sizeof(extern_type); size_t __flen = __fmultiple * (__from_end - __from); const size_t __tmultiple = sizeof(intern_type); size_t __tlen = __tmultiple * (__to_end - __to); // Argument list for iconv specifies a byte sequence. Thus, // all to/from arrays must be brutally casted to char*. char* __cto = reinterpret_cast<char*>(__to); char* __cfrom; size_t __conv; // Some encodings need a byte order marker as the first item // in the byte stream, to designate endian-ness. The default // value for the byte order marker is NULL, so if this is // the case, it's not necessary and we can just go on our // merry way. int __ext_bom = __state.external_bom(); if (__ext_bom) { size_t __size = __from_end - __from; extern_type* __cfixed = static_cast<extern_type*> (__builtin_alloca(sizeof(extern_type) * (__size + 1))); __cfixed[0] = static_cast<extern_type>(__ext_bom); char_traits<extern_type>::copy(__cfixed + 1, __from, __size); __cfrom = reinterpret_cast<char*>(__cfixed); __conv = __iconv_adaptor(iconv, __desc, &__cfrom, &__flen, &__cto, &__tlen); } else { extern_type* __cfixed = const_cast<extern_type*>(__from); __cfrom = reinterpret_cast<char*>(__cfixed); __conv = __iconv_adaptor(iconv, __desc, &__cfrom, &__flen, &__cto, &__tlen); } if (__conv != size_t(-1)) { __from_next = reinterpret_cast<const extern_type*>(__cfrom); __to_next = reinterpret_cast<intern_type*>(__cto); __ret = codecvt_base::ok; } else { if (__flen < static_cast<size_t>(__from_end - __from)) { __from_next = reinterpret_cast<const extern_type*>(__cfrom); __to_next = reinterpret_cast<intern_type*>(__cto); __ret = codecvt_base::partial; } else __ret = codecvt_base::error; } } return __ret; } template<typename _InternT, typename _ExternT> int codecvt<_InternT, _ExternT, encoding_state>:: do_encoding() const throw() { int __ret = 0; if (sizeof(_ExternT) <= sizeof(_InternT)) __ret = sizeof(_InternT) / sizeof(_ExternT); return __ret; } template<typename _InternT, typename _ExternT> bool codecvt<_InternT, _ExternT, encoding_state>:: do_always_noconv() const throw() { return false; } template<typename _InternT, typename _ExternT> int codecvt<_InternT, _ExternT, encoding_state>:: do_length(state_type&, const extern_type* __from, const extern_type* __end, size_t __max) const { return std::min(__max, static_cast<size_t>(__end - __from)); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 74. Garbled text for codecvt::do_max_length template<typename _InternT, typename _ExternT> int codecvt<_InternT, _ExternT, encoding_state>:: do_max_length() const throw() { return 1; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif �����������������������������������������������������������������������������������������������c++/4.8.2/ext/mt_allocator.h������������������������������������������������������������������������0000644�����������������00000054675�14763166030�0011245 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// MT-optimized allocator -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/mt_allocator.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _MT_ALLOCATOR_H #define _MT_ALLOCATOR_H 1 #include <new> #include <cstdlib> #include <bits/functexcept.h> #include <ext/atomicity.h> #include <bits/move.h> #if __cplusplus >= 201103L #include <type_traits> #endif namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using std::size_t; using std::ptrdiff_t; typedef void (*__destroy_handler)(void*); /// Base class for pool object. struct __pool_base { // Using short int as type for the binmap implies we are never // caching blocks larger than 32768 with this allocator. typedef unsigned short int _Binmap_type; // Variables used to configure the behavior of the allocator, // assigned and explained in detail below. struct _Tune { // Compile time constants for the default _Tune values. enum { _S_align = 8 }; enum { _S_max_bytes = 128 }; enum { _S_min_bin = 8 }; enum { _S_chunk_size = 4096 - 4 * sizeof(void*) }; enum { _S_max_threads = 4096 }; enum { _S_freelist_headroom = 10 }; // Alignment needed. // NB: In any case must be >= sizeof(_Block_record), that // is 4 on 32 bit machines and 8 on 64 bit machines. size_t _M_align; // Allocation requests (after round-up to power of 2) below // this value will be handled by the allocator. A raw new/ // call will be used for requests larger than this value. // NB: Must be much smaller than _M_chunk_size and in any // case <= 32768. size_t _M_max_bytes; // Size in bytes of the smallest bin. // NB: Must be a power of 2 and >= _M_align (and of course // much smaller than _M_max_bytes). size_t _M_min_bin; // In order to avoid fragmenting and minimize the number of // new() calls we always request new memory using this // value. Based on previous discussions on the libstdc++ // mailing list we have chosen the value below. // See http://gcc.gnu.org/ml/libstdc++/2001-07/msg00077.html // NB: At least one order of magnitude > _M_max_bytes. size_t _M_chunk_size; // The maximum number of supported threads. For // single-threaded operation, use one. Maximum values will // vary depending on details of the underlying system. (For // instance, Linux 2.4.18 reports 4070 in // /proc/sys/kernel/threads-max, while Linux 2.6.6 reports // 65534) size_t _M_max_threads; // Each time a deallocation occurs in a threaded application // we make sure that there are no more than // _M_freelist_headroom % of used memory on the freelist. If // the number of additional records is more than // _M_freelist_headroom % of the freelist, we move these // records back to the global pool. size_t _M_freelist_headroom; // Set to true forces all allocations to use new(). bool _M_force_new; explicit _Tune() : _M_align(_S_align), _M_max_bytes(_S_max_bytes), _M_min_bin(_S_min_bin), _M_chunk_size(_S_chunk_size), _M_max_threads(_S_max_threads), _M_freelist_headroom(_S_freelist_headroom), _M_force_new(std::getenv("GLIBCXX_FORCE_NEW") ? true : false) { } explicit _Tune(size_t __align, size_t __maxb, size_t __minbin, size_t __chunk, size_t __maxthreads, size_t __headroom, bool __force) : _M_align(__align), _M_max_bytes(__maxb), _M_min_bin(__minbin), _M_chunk_size(__chunk), _M_max_threads(__maxthreads), _M_freelist_headroom(__headroom), _M_force_new(__force) { } }; struct _Block_address { void* _M_initial; _Block_address* _M_next; }; const _Tune& _M_get_options() const { return _M_options; } void _M_set_options(_Tune __t) { if (!_M_init) _M_options = __t; } bool _M_check_threshold(size_t __bytes) { return __bytes > _M_options._M_max_bytes || _M_options._M_force_new; } size_t _M_get_binmap(size_t __bytes) { return _M_binmap[__bytes]; } size_t _M_get_align() { return _M_options._M_align; } explicit __pool_base() : _M_options(_Tune()), _M_binmap(0), _M_init(false) { } explicit __pool_base(const _Tune& __options) : _M_options(__options), _M_binmap(0), _M_init(false) { } private: explicit __pool_base(const __pool_base&); __pool_base& operator=(const __pool_base&); protected: // Configuration options. _Tune _M_options; _Binmap_type* _M_binmap; // Configuration of the pool object via _M_options can happen // after construction but before initialization. After // initialization is complete, this variable is set to true. bool _M_init; }; /** * @brief Data describing the underlying memory pool, parameterized on * threading support. */ template<bool _Thread> class __pool; /// Specialization for single thread. template<> class __pool<false> : public __pool_base { public: union _Block_record { // Points to the block_record of the next free block. _Block_record* _M_next; }; struct _Bin_record { // An "array" of pointers to the first free block. _Block_record** _M_first; // A list of the initial addresses of all allocated blocks. _Block_address* _M_address; }; void _M_initialize_once() { if (__builtin_expect(_M_init == false, false)) _M_initialize(); } void _M_destroy() throw(); char* _M_reserve_block(size_t __bytes, const size_t __thread_id); void _M_reclaim_block(char* __p, size_t __bytes) throw (); size_t _M_get_thread_id() { return 0; } const _Bin_record& _M_get_bin(size_t __which) { return _M_bin[__which]; } void _M_adjust_freelist(const _Bin_record&, _Block_record*, size_t) { } explicit __pool() : _M_bin(0), _M_bin_size(1) { } explicit __pool(const __pool_base::_Tune& __tune) : __pool_base(__tune), _M_bin(0), _M_bin_size(1) { } private: // An "array" of bin_records each of which represents a specific // power of 2 size. Memory to this "array" is allocated in // _M_initialize(). _Bin_record* _M_bin; // Actual value calculated in _M_initialize(). size_t _M_bin_size; void _M_initialize(); }; #ifdef __GTHREADS /// Specialization for thread enabled, via gthreads.h. template<> class __pool<true> : public __pool_base { public: // Each requesting thread is assigned an id ranging from 1 to // _S_max_threads. Thread id 0 is used as a global memory pool. // In order to get constant performance on the thread assignment // routine, we keep a list of free ids. When a thread first // requests memory we remove the first record in this list and // stores the address in a __gthread_key. When initializing the // __gthread_key we specify a destructor. When this destructor // (i.e. the thread dies) is called, we return the thread id to // the front of this list. struct _Thread_record { // Points to next free thread id record. NULL if last record in list. _Thread_record* _M_next; // Thread id ranging from 1 to _S_max_threads. size_t _M_id; }; union _Block_record { // Points to the block_record of the next free block. _Block_record* _M_next; // The thread id of the thread which has requested this block. size_t _M_thread_id; }; struct _Bin_record { // An "array" of pointers to the first free block for each // thread id. Memory to this "array" is allocated in // _S_initialize() for _S_max_threads + global pool 0. _Block_record** _M_first; // A list of the initial addresses of all allocated blocks. _Block_address* _M_address; // An "array" of counters used to keep track of the amount of // blocks that are on the freelist/used for each thread id. // - Note that the second part of the allocated _M_used "array" // actually hosts (atomic) counters of reclaimed blocks: in // _M_reserve_block and in _M_reclaim_block those numbers are // subtracted from the first ones to obtain the actual size // of the "working set" of the given thread. // - Memory to these "arrays" is allocated in _S_initialize() // for _S_max_threads + global pool 0. size_t* _M_free; size_t* _M_used; // Each bin has its own mutex which is used to ensure data // integrity while changing "ownership" on a block. The mutex // is initialized in _S_initialize(). __gthread_mutex_t* _M_mutex; }; // XXX GLIBCXX_ABI Deprecated void _M_initialize(__destroy_handler); void _M_initialize_once() { if (__builtin_expect(_M_init == false, false)) _M_initialize(); } void _M_destroy() throw(); char* _M_reserve_block(size_t __bytes, const size_t __thread_id); void _M_reclaim_block(char* __p, size_t __bytes) throw (); const _Bin_record& _M_get_bin(size_t __which) { return _M_bin[__which]; } void _M_adjust_freelist(const _Bin_record& __bin, _Block_record* __block, size_t __thread_id) { if (__gthread_active_p()) { __block->_M_thread_id = __thread_id; --__bin._M_free[__thread_id]; ++__bin._M_used[__thread_id]; } } // XXX GLIBCXX_ABI Deprecated _GLIBCXX_CONST void _M_destroy_thread_key(void*) throw (); size_t _M_get_thread_id(); explicit __pool() : _M_bin(0), _M_bin_size(1), _M_thread_freelist(0) { } explicit __pool(const __pool_base::_Tune& __tune) : __pool_base(__tune), _M_bin(0), _M_bin_size(1), _M_thread_freelist(0) { } private: // An "array" of bin_records each of which represents a specific // power of 2 size. Memory to this "array" is allocated in // _M_initialize(). _Bin_record* _M_bin; // Actual value calculated in _M_initialize(). size_t _M_bin_size; _Thread_record* _M_thread_freelist; void* _M_thread_freelist_initial; void _M_initialize(); }; #endif template<template <bool> class _PoolTp, bool _Thread> struct __common_pool { typedef _PoolTp<_Thread> pool_type; static pool_type& _S_get_pool() { static pool_type _S_pool; return _S_pool; } }; template<template <bool> class _PoolTp, bool _Thread> struct __common_pool_base; template<template <bool> class _PoolTp> struct __common_pool_base<_PoolTp, false> : public __common_pool<_PoolTp, false> { using __common_pool<_PoolTp, false>::_S_get_pool; static void _S_initialize_once() { static bool __init; if (__builtin_expect(__init == false, false)) { _S_get_pool()._M_initialize_once(); __init = true; } } }; #ifdef __GTHREADS template<template <bool> class _PoolTp> struct __common_pool_base<_PoolTp, true> : public __common_pool<_PoolTp, true> { using __common_pool<_PoolTp, true>::_S_get_pool; static void _S_initialize() { _S_get_pool()._M_initialize_once(); } static void _S_initialize_once() { static bool __init; if (__builtin_expect(__init == false, false)) { if (__gthread_active_p()) { // On some platforms, __gthread_once_t is an aggregate. static __gthread_once_t __once = __GTHREAD_ONCE_INIT; __gthread_once(&__once, _S_initialize); } // Double check initialization. May be necessary on some // systems for proper construction when not compiling with // thread flags. _S_get_pool()._M_initialize_once(); __init = true; } } }; #endif /// Policy for shared __pool objects. template<template <bool> class _PoolTp, bool _Thread> struct __common_pool_policy : public __common_pool_base<_PoolTp, _Thread> { template<typename _Tp1, template <bool> class _PoolTp1 = _PoolTp, bool _Thread1 = _Thread> struct _M_rebind { typedef __common_pool_policy<_PoolTp1, _Thread1> other; }; using __common_pool_base<_PoolTp, _Thread>::_S_get_pool; using __common_pool_base<_PoolTp, _Thread>::_S_initialize_once; }; template<typename _Tp, template <bool> class _PoolTp, bool _Thread> struct __per_type_pool { typedef _Tp value_type; typedef _PoolTp<_Thread> pool_type; static pool_type& _S_get_pool() { // Sane defaults for the _PoolTp. typedef typename pool_type::_Block_record _Block_record; const static size_t __a = (__alignof__(_Tp) >= sizeof(_Block_record) ? __alignof__(_Tp) : sizeof(_Block_record)); typedef typename __pool_base::_Tune _Tune; static _Tune _S_tune(__a, sizeof(_Tp) * 64, sizeof(_Tp) * 2 >= __a ? sizeof(_Tp) * 2 : __a, sizeof(_Tp) * size_t(_Tune::_S_chunk_size), _Tune::_S_max_threads, _Tune::_S_freelist_headroom, std::getenv("GLIBCXX_FORCE_NEW") ? true : false); static pool_type _S_pool(_S_tune); return _S_pool; } }; template<typename _Tp, template <bool> class _PoolTp, bool _Thread> struct __per_type_pool_base; template<typename _Tp, template <bool> class _PoolTp> struct __per_type_pool_base<_Tp, _PoolTp, false> : public __per_type_pool<_Tp, _PoolTp, false> { using __per_type_pool<_Tp, _PoolTp, false>::_S_get_pool; static void _S_initialize_once() { static bool __init; if (__builtin_expect(__init == false, false)) { _S_get_pool()._M_initialize_once(); __init = true; } } }; #ifdef __GTHREADS template<typename _Tp, template <bool> class _PoolTp> struct __per_type_pool_base<_Tp, _PoolTp, true> : public __per_type_pool<_Tp, _PoolTp, true> { using __per_type_pool<_Tp, _PoolTp, true>::_S_get_pool; static void _S_initialize() { _S_get_pool()._M_initialize_once(); } static void _S_initialize_once() { static bool __init; if (__builtin_expect(__init == false, false)) { if (__gthread_active_p()) { // On some platforms, __gthread_once_t is an aggregate. static __gthread_once_t __once = __GTHREAD_ONCE_INIT; __gthread_once(&__once, _S_initialize); } // Double check initialization. May be necessary on some // systems for proper construction when not compiling with // thread flags. _S_get_pool()._M_initialize_once(); __init = true; } } }; #endif /// Policy for individual __pool objects. template<typename _Tp, template <bool> class _PoolTp, bool _Thread> struct __per_type_pool_policy : public __per_type_pool_base<_Tp, _PoolTp, _Thread> { template<typename _Tp1, template <bool> class _PoolTp1 = _PoolTp, bool _Thread1 = _Thread> struct _M_rebind { typedef __per_type_pool_policy<_Tp1, _PoolTp1, _Thread1> other; }; using __per_type_pool_base<_Tp, _PoolTp, _Thread>::_S_get_pool; using __per_type_pool_base<_Tp, _PoolTp, _Thread>::_S_initialize_once; }; /// Base class for _Tp dependent member functions. template<typename _Tp> class __mt_alloc_base { public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Tp* pointer; typedef const _Tp* const_pointer; typedef _Tp& reference; typedef const _Tp& const_reference; typedef _Tp value_type; #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2103. propagate_on_container_move_assignment typedef std::true_type propagate_on_container_move_assignment; #endif pointer address(reference __x) const _GLIBCXX_NOEXCEPT { return std::__addressof(__x); } const_pointer address(const_reference __x) const _GLIBCXX_NOEXCEPT { return std::__addressof(__x); } size_type max_size() const _GLIBCXX_USE_NOEXCEPT { return size_t(-1) / sizeof(_Tp); } #if __cplusplus >= 201103L template<typename _Up, typename... _Args> void construct(_Up* __p, _Args&&... __args) { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } template<typename _Up> void destroy(_Up* __p) { __p->~_Up(); } #else // _GLIBCXX_RESOLVE_LIB_DEFECTS // 402. wrong new expression in [some_] allocator::construct void construct(pointer __p, const _Tp& __val) { ::new((void *)__p) _Tp(__val); } void destroy(pointer __p) { __p->~_Tp(); } #endif }; #ifdef __GTHREADS #define __thread_default true #else #define __thread_default false #endif /** * @brief This is a fixed size (power of 2) allocator which - when * compiled with thread support - will maintain one freelist per * size per thread plus a @a global one. Steps are taken to limit * the per thread freelist sizes (by returning excess back to * the @a global list). * @ingroup allocators * * Further details: * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt12ch32.html */ template<typename _Tp, typename _Poolp = __common_pool_policy<__pool, __thread_default> > class __mt_alloc : public __mt_alloc_base<_Tp> { public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Tp* pointer; typedef const _Tp* const_pointer; typedef _Tp& reference; typedef const _Tp& const_reference; typedef _Tp value_type; typedef _Poolp __policy_type; typedef typename _Poolp::pool_type __pool_type; template<typename _Tp1, typename _Poolp1 = _Poolp> struct rebind { typedef typename _Poolp1::template _M_rebind<_Tp1>::other pol_type; typedef __mt_alloc<_Tp1, pol_type> other; }; __mt_alloc() _GLIBCXX_USE_NOEXCEPT { } __mt_alloc(const __mt_alloc&) _GLIBCXX_USE_NOEXCEPT { } template<typename _Tp1, typename _Poolp1> __mt_alloc(const __mt_alloc<_Tp1, _Poolp1>&) _GLIBCXX_USE_NOEXCEPT { } ~__mt_alloc() _GLIBCXX_USE_NOEXCEPT { } pointer allocate(size_type __n, const void* = 0); void deallocate(pointer __p, size_type __n); const __pool_base::_Tune _M_get_options() { // Return a copy, not a reference, for external consumption. return __policy_type::_S_get_pool()._M_get_options(); } void _M_set_options(__pool_base::_Tune __t) { __policy_type::_S_get_pool()._M_set_options(__t); } }; template<typename _Tp, typename _Poolp> typename __mt_alloc<_Tp, _Poolp>::pointer __mt_alloc<_Tp, _Poolp>:: allocate(size_type __n, const void*) { if (__n > this->max_size()) std::__throw_bad_alloc(); __policy_type::_S_initialize_once(); // Requests larger than _M_max_bytes are handled by operator // new/delete directly. __pool_type& __pool = __policy_type::_S_get_pool(); const size_t __bytes = __n * sizeof(_Tp); if (__pool._M_check_threshold(__bytes)) { void* __ret = ::operator new(__bytes); return static_cast<_Tp*>(__ret); } // Round up to power of 2 and figure out which bin to use. const size_t __which = __pool._M_get_binmap(__bytes); const size_t __thread_id = __pool._M_get_thread_id(); // Find out if we have blocks on our freelist. If so, go ahead // and use them directly without having to lock anything. char* __c; typedef typename __pool_type::_Bin_record _Bin_record; const _Bin_record& __bin = __pool._M_get_bin(__which); if (__bin._M_first[__thread_id]) { // Already reserved. typedef typename __pool_type::_Block_record _Block_record; _Block_record* __block = __bin._M_first[__thread_id]; __bin._M_first[__thread_id] = __block->_M_next; __pool._M_adjust_freelist(__bin, __block, __thread_id); __c = reinterpret_cast<char*>(__block) + __pool._M_get_align(); } else { // Null, reserve. __c = __pool._M_reserve_block(__bytes, __thread_id); } return static_cast<_Tp*>(static_cast<void*>(__c)); } template<typename _Tp, typename _Poolp> void __mt_alloc<_Tp, _Poolp>:: deallocate(pointer __p, size_type __n) { if (__builtin_expect(__p != 0, true)) { // Requests larger than _M_max_bytes are handled by // operators new/delete directly. __pool_type& __pool = __policy_type::_S_get_pool(); const size_t __bytes = __n * sizeof(_Tp); if (__pool._M_check_threshold(__bytes)) ::operator delete(__p); else __pool._M_reclaim_block(reinterpret_cast<char*>(__p), __bytes); } } template<typename _Tp, typename _Poolp> inline bool operator==(const __mt_alloc<_Tp, _Poolp>&, const __mt_alloc<_Tp, _Poolp>&) { return true; } template<typename _Tp, typename _Poolp> inline bool operator!=(const __mt_alloc<_Tp, _Poolp>&, const __mt_alloc<_Tp, _Poolp>&) { return false; } #undef __thread_default _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif �������������������������������������������������������������������c++/4.8.2/ext/bitmap_allocator.h��������������������������������������������������������������������0000644�����������������00000075134�14763166030�0012072 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Bitmap Allocator. -*- C++ -*- // Copyright (C) 2004-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/bitmap_allocator.h * This file is a GNU extension to the Standard C++ Library. */ #ifndef _BITMAP_ALLOCATOR_H #define _BITMAP_ALLOCATOR_H 1 #include <utility> // For std::pair. #include <bits/functexcept.h> // For __throw_bad_alloc(). #include <functional> // For greater_equal, and less_equal. #include <new> // For operator new. #include <debug/debug.h> // _GLIBCXX_DEBUG_ASSERT #include <ext/concurrence.h> #include <bits/move.h> /** @brief The constant in the expression below is the alignment * required in bytes. */ #define _BALLOC_ALIGN_BYTES 8 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { using std::size_t; using std::ptrdiff_t; namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** @class __mini_vector bitmap_allocator.h bitmap_allocator.h * * @brief __mini_vector<> is a stripped down version of the * full-fledged std::vector<>. * * It is to be used only for built-in types or PODs. Notable * differences are: * * 1. Not all accessor functions are present. * 2. Used ONLY for PODs. * 3. No Allocator template argument. Uses ::operator new() to get * memory, and ::operator delete() to free it. * Caveat: The dtor does NOT free the memory allocated, so this a * memory-leaking vector! */ template<typename _Tp> class __mini_vector { __mini_vector(const __mini_vector&); __mini_vector& operator=(const __mini_vector&); public: typedef _Tp value_type; typedef _Tp* pointer; typedef _Tp& reference; typedef const _Tp& const_reference; typedef size_t size_type; typedef ptrdiff_t difference_type; typedef pointer iterator; private: pointer _M_start; pointer _M_finish; pointer _M_end_of_storage; size_type _M_space_left() const throw() { return _M_end_of_storage - _M_finish; } pointer allocate(size_type __n) { return static_cast<pointer>(::operator new(__n * sizeof(_Tp))); } void deallocate(pointer __p, size_type) { ::operator delete(__p); } public: // Members used: size(), push_back(), pop_back(), // insert(iterator, const_reference), erase(iterator), // begin(), end(), back(), operator[]. __mini_vector() : _M_start(0), _M_finish(0), _M_end_of_storage(0) { } size_type size() const throw() { return _M_finish - _M_start; } iterator begin() const throw() { return this->_M_start; } iterator end() const throw() { return this->_M_finish; } reference back() const throw() { return *(this->end() - 1); } reference operator[](const size_type __pos) const throw() { return this->_M_start[__pos]; } void insert(iterator __pos, const_reference __x); void push_back(const_reference __x) { if (this->_M_space_left()) { *this->end() = __x; ++this->_M_finish; } else this->insert(this->end(), __x); } void pop_back() throw() { --this->_M_finish; } void erase(iterator __pos) throw(); void clear() throw() { this->_M_finish = this->_M_start; } }; // Out of line function definitions. template<typename _Tp> void __mini_vector<_Tp>:: insert(iterator __pos, const_reference __x) { if (this->_M_space_left()) { size_type __to_move = this->_M_finish - __pos; iterator __dest = this->end(); iterator __src = this->end() - 1; ++this->_M_finish; while (__to_move) { *__dest = *__src; --__dest; --__src; --__to_move; } *__pos = __x; } else { size_type __new_size = this->size() ? this->size() * 2 : 1; iterator __new_start = this->allocate(__new_size); iterator __first = this->begin(); iterator __start = __new_start; while (__first != __pos) { *__start = *__first; ++__start; ++__first; } *__start = __x; ++__start; while (__first != this->end()) { *__start = *__first; ++__start; ++__first; } if (this->_M_start) this->deallocate(this->_M_start, this->size()); this->_M_start = __new_start; this->_M_finish = __start; this->_M_end_of_storage = this->_M_start + __new_size; } } template<typename _Tp> void __mini_vector<_Tp>:: erase(iterator __pos) throw() { while (__pos + 1 != this->end()) { *__pos = __pos[1]; ++__pos; } --this->_M_finish; } template<typename _Tp> struct __mv_iter_traits { typedef typename _Tp::value_type value_type; typedef typename _Tp::difference_type difference_type; }; template<typename _Tp> struct __mv_iter_traits<_Tp*> { typedef _Tp value_type; typedef ptrdiff_t difference_type; }; enum { bits_per_byte = 8, bits_per_block = sizeof(size_t) * size_t(bits_per_byte) }; template<typename _ForwardIterator, typename _Tp, typename _Compare> _ForwardIterator __lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __val, _Compare __comp) { typedef typename __mv_iter_traits<_ForwardIterator>::difference_type _DistanceType; _DistanceType __len = __last - __first; _DistanceType __half; _ForwardIterator __middle; while (__len > 0) { __half = __len >> 1; __middle = __first; __middle += __half; if (__comp(*__middle, __val)) { __first = __middle; ++__first; __len = __len - __half - 1; } else __len = __half; } return __first; } /** @brief The number of Blocks pointed to by the address pair * passed to the function. */ template<typename _AddrPair> inline size_t __num_blocks(_AddrPair __ap) { return (__ap.second - __ap.first) + 1; } /** @brief The number of Bit-maps pointed to by the address pair * passed to the function. */ template<typename _AddrPair> inline size_t __num_bitmaps(_AddrPair __ap) { return __num_blocks(__ap) / size_t(bits_per_block); } // _Tp should be a pointer type. template<typename _Tp> class _Inclusive_between : public std::unary_function<typename std::pair<_Tp, _Tp>, bool> { typedef _Tp pointer; pointer _M_ptr_value; typedef typename std::pair<_Tp, _Tp> _Block_pair; public: _Inclusive_between(pointer __ptr) : _M_ptr_value(__ptr) { } bool operator()(_Block_pair __bp) const throw() { if (std::less_equal<pointer>()(_M_ptr_value, __bp.second) && std::greater_equal<pointer>()(_M_ptr_value, __bp.first)) return true; else return false; } }; // Used to pass a Functor to functions by reference. template<typename _Functor> class _Functor_Ref : public std::unary_function<typename _Functor::argument_type, typename _Functor::result_type> { _Functor& _M_fref; public: typedef typename _Functor::argument_type argument_type; typedef typename _Functor::result_type result_type; _Functor_Ref(_Functor& __fref) : _M_fref(__fref) { } result_type operator()(argument_type __arg) { return _M_fref(__arg); } }; /** @class _Ffit_finder bitmap_allocator.h bitmap_allocator.h * * @brief The class which acts as a predicate for applying the * first-fit memory allocation policy for the bitmap allocator. */ // _Tp should be a pointer type, and _Alloc is the Allocator for // the vector. template<typename _Tp> class _Ffit_finder : public std::unary_function<typename std::pair<_Tp, _Tp>, bool> { typedef typename std::pair<_Tp, _Tp> _Block_pair; typedef typename __detail::__mini_vector<_Block_pair> _BPVector; typedef typename _BPVector::difference_type _Counter_type; size_t* _M_pbitmap; _Counter_type _M_data_offset; public: _Ffit_finder() : _M_pbitmap(0), _M_data_offset(0) { } bool operator()(_Block_pair __bp) throw() { // Set the _rover to the last physical location bitmap, // which is the bitmap which belongs to the first free // block. Thus, the bitmaps are in exact reverse order of // the actual memory layout. So, we count down the bitmaps, // which is the same as moving up the memory. // If the used count stored at the start of the Bit Map headers // is equal to the number of Objects that the current Block can // store, then there is definitely no space for another single // object, so just return false. _Counter_type __diff = __detail::__num_bitmaps(__bp); if (*(reinterpret_cast<size_t*> (__bp.first) - (__diff + 1)) == __detail::__num_blocks(__bp)) return false; size_t* __rover = reinterpret_cast<size_t*>(__bp.first) - 1; for (_Counter_type __i = 0; __i < __diff; ++__i) { _M_data_offset = __i; if (*__rover) { _M_pbitmap = __rover; return true; } --__rover; } return false; } size_t* _M_get() const throw() { return _M_pbitmap; } _Counter_type _M_offset() const throw() { return _M_data_offset * size_t(bits_per_block); } }; /** @class _Bitmap_counter bitmap_allocator.h bitmap_allocator.h * * @brief The bitmap counter which acts as the bitmap * manipulator, and manages the bit-manipulation functions and * the searching and identification functions on the bit-map. */ // _Tp should be a pointer type. template<typename _Tp> class _Bitmap_counter { typedef typename __detail::__mini_vector<typename std::pair<_Tp, _Tp> > _BPVector; typedef typename _BPVector::size_type _Index_type; typedef _Tp pointer; _BPVector& _M_vbp; size_t* _M_curr_bmap; size_t* _M_last_bmap_in_block; _Index_type _M_curr_index; public: // Use the 2nd parameter with care. Make sure that such an // entry exists in the vector before passing that particular // index to this ctor. _Bitmap_counter(_BPVector& Rvbp, long __index = -1) : _M_vbp(Rvbp) { this->_M_reset(__index); } void _M_reset(long __index = -1) throw() { if (__index == -1) { _M_curr_bmap = 0; _M_curr_index = static_cast<_Index_type>(-1); return; } _M_curr_index = __index; _M_curr_bmap = reinterpret_cast<size_t*> (_M_vbp[_M_curr_index].first) - 1; _GLIBCXX_DEBUG_ASSERT(__index <= (long)_M_vbp.size() - 1); _M_last_bmap_in_block = _M_curr_bmap - ((_M_vbp[_M_curr_index].second - _M_vbp[_M_curr_index].first + 1) / size_t(bits_per_block) - 1); } // Dangerous Function! Use with extreme care. Pass to this // function ONLY those values that are known to be correct, // otherwise this will mess up big time. void _M_set_internal_bitmap(size_t* __new_internal_marker) throw() { _M_curr_bmap = __new_internal_marker; } bool _M_finished() const throw() { return(_M_curr_bmap == 0); } _Bitmap_counter& operator++() throw() { if (_M_curr_bmap == _M_last_bmap_in_block) { if (++_M_curr_index == _M_vbp.size()) _M_curr_bmap = 0; else this->_M_reset(_M_curr_index); } else --_M_curr_bmap; return *this; } size_t* _M_get() const throw() { return _M_curr_bmap; } pointer _M_base() const throw() { return _M_vbp[_M_curr_index].first; } _Index_type _M_offset() const throw() { return size_t(bits_per_block) * ((reinterpret_cast<size_t*>(this->_M_base()) - _M_curr_bmap) - 1); } _Index_type _M_where() const throw() { return _M_curr_index; } }; /** @brief Mark a memory address as allocated by re-setting the * corresponding bit in the bit-map. */ inline void __bit_allocate(size_t* __pbmap, size_t __pos) throw() { size_t __mask = 1 << __pos; __mask = ~__mask; *__pbmap &= __mask; } /** @brief Mark a memory address as free by setting the * corresponding bit in the bit-map. */ inline void __bit_free(size_t* __pbmap, size_t __pos) throw() { size_t __mask = 1 << __pos; *__pbmap |= __mask; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace __detail _GLIBCXX_BEGIN_NAMESPACE_VERSION /** @brief Generic Version of the bsf instruction. */ inline size_t _Bit_scan_forward(size_t __num) { return static_cast<size_t>(__builtin_ctzl(__num)); } /** @class free_list bitmap_allocator.h bitmap_allocator.h * * @brief The free list class for managing chunks of memory to be * given to and returned by the bitmap_allocator. */ class free_list { public: typedef size_t* value_type; typedef __detail::__mini_vector<value_type> vector_type; typedef vector_type::iterator iterator; typedef __mutex __mutex_type; private: struct _LT_pointer_compare { bool operator()(const size_t* __pui, const size_t __cui) const throw() { return *__pui < __cui; } }; #if defined __GTHREADS __mutex_type& _M_get_mutex() { static __mutex_type _S_mutex; return _S_mutex; } #endif vector_type& _M_get_free_list() { static vector_type _S_free_list; return _S_free_list; } /** @brief Performs validation of memory based on their size. * * @param __addr The pointer to the memory block to be * validated. * * Validates the memory block passed to this function and * appropriately performs the action of managing the free list of * blocks by adding this block to the free list or deleting this * or larger blocks from the free list. */ void _M_validate(size_t* __addr) throw() { vector_type& __free_list = _M_get_free_list(); const vector_type::size_type __max_size = 64; if (__free_list.size() >= __max_size) { // Ok, the threshold value has been reached. We determine // which block to remove from the list of free blocks. if (*__addr >= *__free_list.back()) { // Ok, the new block is greater than or equal to the // last block in the list of free blocks. We just free // the new block. ::operator delete(static_cast<void*>(__addr)); return; } else { // Deallocate the last block in the list of free lists, // and insert the new one in its correct position. ::operator delete(static_cast<void*>(__free_list.back())); __free_list.pop_back(); } } // Just add the block to the list of free lists unconditionally. iterator __temp = __detail::__lower_bound (__free_list.begin(), __free_list.end(), *__addr, _LT_pointer_compare()); // We may insert the new free list before _temp; __free_list.insert(__temp, __addr); } /** @brief Decides whether the wastage of memory is acceptable for * the current memory request and returns accordingly. * * @param __block_size The size of the block available in the free * list. * * @param __required_size The required size of the memory block. * * @return true if the wastage incurred is acceptable, else returns * false. */ bool _M_should_i_give(size_t __block_size, size_t __required_size) throw() { const size_t __max_wastage_percentage = 36; if (__block_size >= __required_size && (((__block_size - __required_size) * 100 / __block_size) < __max_wastage_percentage)) return true; else return false; } public: /** @brief This function returns the block of memory to the * internal free list. * * @param __addr The pointer to the memory block that was given * by a call to the _M_get function. */ inline void _M_insert(size_t* __addr) throw() { #if defined __GTHREADS __scoped_lock __bfl_lock(_M_get_mutex()); #endif // Call _M_validate to decide what should be done with // this particular free list. this->_M_validate(reinterpret_cast<size_t*>(__addr) - 1); // See discussion as to why this is 1! } /** @brief This function gets a block of memory of the specified * size from the free list. * * @param __sz The size in bytes of the memory required. * * @return A pointer to the new memory block of size at least * equal to that requested. */ size_t* _M_get(size_t __sz) throw(std::bad_alloc); /** @brief This function just clears the internal Free List, and * gives back all the memory to the OS. */ void _M_clear(); }; // Forward declare the class. template<typename _Tp> class bitmap_allocator; // Specialize for void: template<> class bitmap_allocator<void> { public: typedef void* pointer; typedef const void* const_pointer; // Reference-to-void members are impossible. typedef void value_type; template<typename _Tp1> struct rebind { typedef bitmap_allocator<_Tp1> other; }; }; /** * @brief Bitmap Allocator, primary template. * @ingroup allocators */ template<typename _Tp> class bitmap_allocator : private free_list { public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Tp* pointer; typedef const _Tp* const_pointer; typedef _Tp& reference; typedef const _Tp& const_reference; typedef _Tp value_type; typedef free_list::__mutex_type __mutex_type; template<typename _Tp1> struct rebind { typedef bitmap_allocator<_Tp1> other; }; #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2103. propagate_on_container_move_assignment typedef std::true_type propagate_on_container_move_assignment; #endif private: template<size_t _BSize, size_t _AlignSize> struct aligned_size { enum { modulus = _BSize % _AlignSize, value = _BSize + (modulus ? _AlignSize - (modulus) : 0) }; }; struct _Alloc_block { char __M_unused[aligned_size<sizeof(value_type), _BALLOC_ALIGN_BYTES>::value]; }; typedef typename std::pair<_Alloc_block*, _Alloc_block*> _Block_pair; typedef typename __detail::__mini_vector<_Block_pair> _BPVector; typedef typename _BPVector::iterator _BPiter; template<typename _Predicate> static _BPiter _S_find(_Predicate __p) { _BPiter __first = _S_mem_blocks.begin(); while (__first != _S_mem_blocks.end() && !__p(*__first)) ++__first; return __first; } #if defined _GLIBCXX_DEBUG // Complexity: O(lg(N)). Where, N is the number of block of size // sizeof(value_type). void _S_check_for_free_blocks() throw() { typedef typename __detail::_Ffit_finder<_Alloc_block*> _FFF; _BPiter __bpi = _S_find(_FFF()); _GLIBCXX_DEBUG_ASSERT(__bpi == _S_mem_blocks.end()); } #endif /** @brief Responsible for exponentially growing the internal * memory pool. * * @throw std::bad_alloc. If memory can not be allocated. * * Complexity: O(1), but internally depends upon the * complexity of the function free_list::_M_get. The part where * the bitmap headers are written has complexity: O(X),where X * is the number of blocks of size sizeof(value_type) within * the newly acquired block. Having a tight bound. */ void _S_refill_pool() throw(std::bad_alloc) { #if defined _GLIBCXX_DEBUG _S_check_for_free_blocks(); #endif const size_t __num_bitmaps = (_S_block_size / size_t(__detail::bits_per_block)); const size_t __size_to_allocate = sizeof(size_t) + _S_block_size * sizeof(_Alloc_block) + __num_bitmaps * sizeof(size_t); size_t* __temp = reinterpret_cast<size_t*>(this->_M_get(__size_to_allocate)); *__temp = 0; ++__temp; // The Header information goes at the Beginning of the Block. _Block_pair __bp = std::make_pair(reinterpret_cast<_Alloc_block*> (__temp + __num_bitmaps), reinterpret_cast<_Alloc_block*> (__temp + __num_bitmaps) + _S_block_size - 1); // Fill the Vector with this information. _S_mem_blocks.push_back(__bp); for (size_t __i = 0; __i < __num_bitmaps; ++__i) __temp[__i] = ~static_cast<size_t>(0); // 1 Indicates all Free. _S_block_size *= 2; } static _BPVector _S_mem_blocks; static size_t _S_block_size; static __detail::_Bitmap_counter<_Alloc_block*> _S_last_request; static typename _BPVector::size_type _S_last_dealloc_index; #if defined __GTHREADS static __mutex_type _S_mut; #endif public: /** @brief Allocates memory for a single object of size * sizeof(_Tp). * * @throw std::bad_alloc. If memory can not be allocated. * * Complexity: Worst case complexity is O(N), but that * is hardly ever hit. If and when this particular case is * encountered, the next few cases are guaranteed to have a * worst case complexity of O(1)! That's why this function * performs very well on average. You can consider this * function to have a complexity referred to commonly as: * Amortized Constant time. */ pointer _M_allocate_single_object() throw(std::bad_alloc) { #if defined __GTHREADS __scoped_lock __bit_lock(_S_mut); #endif // The algorithm is something like this: The last_request // variable points to the last accessed Bit Map. When such a // condition occurs, we try to find a free block in the // current bitmap, or succeeding bitmaps until the last bitmap // is reached. If no free block turns up, we resort to First // Fit method. // WARNING: Do not re-order the condition in the while // statement below, because it relies on C++'s short-circuit // evaluation. The return from _S_last_request->_M_get() will // NOT be dereference able if _S_last_request->_M_finished() // returns true. This would inevitably lead to a NULL pointer // dereference if tinkered with. while (_S_last_request._M_finished() == false && (*(_S_last_request._M_get()) == 0)) _S_last_request.operator++(); if (__builtin_expect(_S_last_request._M_finished() == true, false)) { // Fall Back to First Fit algorithm. typedef typename __detail::_Ffit_finder<_Alloc_block*> _FFF; _FFF __fff; _BPiter __bpi = _S_find(__detail::_Functor_Ref<_FFF>(__fff)); if (__bpi != _S_mem_blocks.end()) { // Search was successful. Ok, now mark the first bit from // the right as 0, meaning Allocated. This bit is obtained // by calling _M_get() on __fff. size_t __nz_bit = _Bit_scan_forward(*__fff._M_get()); __detail::__bit_allocate(__fff._M_get(), __nz_bit); _S_last_request._M_reset(__bpi - _S_mem_blocks.begin()); // Now, get the address of the bit we marked as allocated. pointer __ret = reinterpret_cast<pointer> (__bpi->first + __fff._M_offset() + __nz_bit); size_t* __puse_count = reinterpret_cast<size_t*> (__bpi->first) - (__detail::__num_bitmaps(*__bpi) + 1); ++(*__puse_count); return __ret; } else { // Search was unsuccessful. We Add more memory to the // pool by calling _S_refill_pool(). _S_refill_pool(); // _M_Reset the _S_last_request structure to the first // free block's bit map. _S_last_request._M_reset(_S_mem_blocks.size() - 1); // Now, mark that bit as allocated. } } // _S_last_request holds a pointer to a valid bit map, that // points to a free block in memory. size_t __nz_bit = _Bit_scan_forward(*_S_last_request._M_get()); __detail::__bit_allocate(_S_last_request._M_get(), __nz_bit); pointer __ret = reinterpret_cast<pointer> (_S_last_request._M_base() + _S_last_request._M_offset() + __nz_bit); size_t* __puse_count = reinterpret_cast<size_t*> (_S_mem_blocks[_S_last_request._M_where()].first) - (__detail:: __num_bitmaps(_S_mem_blocks[_S_last_request._M_where()]) + 1); ++(*__puse_count); return __ret; } /** @brief Deallocates memory that belongs to a single object of * size sizeof(_Tp). * * Complexity: O(lg(N)), but the worst case is not hit * often! This is because containers usually deallocate memory * close to each other and this case is handled in O(1) time by * the deallocate function. */ void _M_deallocate_single_object(pointer __p) throw() { #if defined __GTHREADS __scoped_lock __bit_lock(_S_mut); #endif _Alloc_block* __real_p = reinterpret_cast<_Alloc_block*>(__p); typedef typename _BPVector::iterator _Iterator; typedef typename _BPVector::difference_type _Difference_type; _Difference_type __diff; long __displacement; _GLIBCXX_DEBUG_ASSERT(_S_last_dealloc_index >= 0); __detail::_Inclusive_between<_Alloc_block*> __ibt(__real_p); if (__ibt(_S_mem_blocks[_S_last_dealloc_index])) { _GLIBCXX_DEBUG_ASSERT(_S_last_dealloc_index <= _S_mem_blocks.size() - 1); // Initial Assumption was correct! __diff = _S_last_dealloc_index; __displacement = __real_p - _S_mem_blocks[__diff].first; } else { _Iterator _iter = _S_find(__ibt); _GLIBCXX_DEBUG_ASSERT(_iter != _S_mem_blocks.end()); __diff = _iter - _S_mem_blocks.begin(); __displacement = __real_p - _S_mem_blocks[__diff].first; _S_last_dealloc_index = __diff; } // Get the position of the iterator that has been found. const size_t __rotate = (__displacement % size_t(__detail::bits_per_block)); size_t* __bitmapC = reinterpret_cast<size_t*> (_S_mem_blocks[__diff].first) - 1; __bitmapC -= (__displacement / size_t(__detail::bits_per_block)); __detail::__bit_free(__bitmapC, __rotate); size_t* __puse_count = reinterpret_cast<size_t*> (_S_mem_blocks[__diff].first) - (__detail::__num_bitmaps(_S_mem_blocks[__diff]) + 1); _GLIBCXX_DEBUG_ASSERT(*__puse_count != 0); --(*__puse_count); if (__builtin_expect(*__puse_count == 0, false)) { _S_block_size /= 2; // We can safely remove this block. // _Block_pair __bp = _S_mem_blocks[__diff]; this->_M_insert(__puse_count); _S_mem_blocks.erase(_S_mem_blocks.begin() + __diff); // Reset the _S_last_request variable to reflect the // erased block. We do this to protect future requests // after the last block has been removed from a particular // memory Chunk, which in turn has been returned to the // free list, and hence had been erased from the vector, // so the size of the vector gets reduced by 1. if ((_Difference_type)_S_last_request._M_where() >= __diff--) _S_last_request._M_reset(__diff); // If the Index into the vector of the region of memory // that might hold the next address that will be passed to // deallocated may have been invalidated due to the above // erase procedure being called on the vector, hence we // try to restore this invariant too. if (_S_last_dealloc_index >= _S_mem_blocks.size()) { _S_last_dealloc_index =(__diff != -1 ? __diff : 0); _GLIBCXX_DEBUG_ASSERT(_S_last_dealloc_index >= 0); } } } public: bitmap_allocator() _GLIBCXX_USE_NOEXCEPT { } bitmap_allocator(const bitmap_allocator&) _GLIBCXX_USE_NOEXCEPT { } template<typename _Tp1> bitmap_allocator(const bitmap_allocator<_Tp1>&) _GLIBCXX_USE_NOEXCEPT { } ~bitmap_allocator() _GLIBCXX_USE_NOEXCEPT { } pointer allocate(size_type __n) { if (__n > this->max_size()) std::__throw_bad_alloc(); if (__builtin_expect(__n == 1, true)) return this->_M_allocate_single_object(); else { const size_type __b = __n * sizeof(value_type); return reinterpret_cast<pointer>(::operator new(__b)); } } pointer allocate(size_type __n, typename bitmap_allocator<void>::const_pointer) { return allocate(__n); } void deallocate(pointer __p, size_type __n) throw() { if (__builtin_expect(__p != 0, true)) { if (__builtin_expect(__n == 1, true)) this->_M_deallocate_single_object(__p); else ::operator delete(__p); } } pointer address(reference __r) const _GLIBCXX_NOEXCEPT { return std::__addressof(__r); } const_pointer address(const_reference __r) const _GLIBCXX_NOEXCEPT { return std::__addressof(__r); } size_type max_size() const _GLIBCXX_USE_NOEXCEPT { return size_type(-1) / sizeof(value_type); } #if __cplusplus >= 201103L template<typename _Up, typename... _Args> void construct(_Up* __p, _Args&&... __args) { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } template<typename _Up> void destroy(_Up* __p) { __p->~_Up(); } #else void construct(pointer __p, const_reference __data) { ::new((void *)__p) value_type(__data); } void destroy(pointer __p) { __p->~value_type(); } #endif }; template<typename _Tp1, typename _Tp2> bool operator==(const bitmap_allocator<_Tp1>&, const bitmap_allocator<_Tp2>&) throw() { return true; } template<typename _Tp1, typename _Tp2> bool operator!=(const bitmap_allocator<_Tp1>&, const bitmap_allocator<_Tp2>&) throw() { return false; } // Static member definitions. template<typename _Tp> typename bitmap_allocator<_Tp>::_BPVector bitmap_allocator<_Tp>::_S_mem_blocks; template<typename _Tp> size_t bitmap_allocator<_Tp>::_S_block_size = 2 * size_t(__detail::bits_per_block); template<typename _Tp> typename bitmap_allocator<_Tp>::_BPVector::size_type bitmap_allocator<_Tp>::_S_last_dealloc_index = 0; template<typename _Tp> __detail::_Bitmap_counter <typename bitmap_allocator<_Tp>::_Alloc_block*> bitmap_allocator<_Tp>::_S_last_request(_S_mem_blocks); #if defined __GTHREADS template<typename _Tp> typename bitmap_allocator<_Tp>::__mutex_type bitmap_allocator<_Tp>::_S_mut; #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace __gnu_cxx #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/random.tcc����������������������������������������������������������������������������0000644�����������������00000125432�14763166030�0010355 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Random number extensions -*- C++ -*- // Copyright (C) 2012-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/random.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ext/random} */ #ifndef _EXT_RANDOM_TCC #define _EXT_RANDOM_TCC 1 #pragma GCC system_header namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ template<typename _UIntType, size_t __m, size_t __pos1, size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2, uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4, uint32_t __parity1, uint32_t __parity2, uint32_t __parity3, uint32_t __parity4> void simd_fast_mersenne_twister_engine<_UIntType, __m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4, __parity1, __parity2, __parity3, __parity4>:: seed(_UIntType __seed) { _M_state32[0] = static_cast<uint32_t>(__seed); for (size_t __i = 1; __i < _M_nstate32; ++__i) _M_state32[__i] = (1812433253UL * (_M_state32[__i - 1] ^ (_M_state32[__i - 1] >> 30)) + __i); _M_pos = state_size; _M_period_certification(); } namespace { inline uint32_t _Func1(uint32_t __x) { return (__x ^ (__x >> 27)) * UINT32_C(1664525); } inline uint32_t _Func2(uint32_t __x) { return (__x ^ (__x >> 27)) * UINT32_C(1566083941); } } template<typename _UIntType, size_t __m, size_t __pos1, size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2, uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4, uint32_t __parity1, uint32_t __parity2, uint32_t __parity3, uint32_t __parity4> template<typename _Sseq> typename std::enable_if<std::is_class<_Sseq>::value>::type simd_fast_mersenne_twister_engine<_UIntType, __m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4, __parity1, __parity2, __parity3, __parity4>:: seed(_Sseq& __q) { size_t __lag; if (_M_nstate32 >= 623) __lag = 11; else if (_M_nstate32 >= 68) __lag = 7; else if (_M_nstate32 >= 39) __lag = 5; else __lag = 3; const size_t __mid = (_M_nstate32 - __lag) / 2; std::fill(_M_state32, _M_state32 + _M_nstate32, UINT32_C(0x8b8b8b8b)); uint32_t __arr[_M_nstate32]; __q.generate(__arr + 0, __arr + _M_nstate32); uint32_t __r = _Func1(_M_state32[0] ^ _M_state32[__mid] ^ _M_state32[_M_nstate32 - 1]); _M_state32[__mid] += __r; __r += _M_nstate32; _M_state32[__mid + __lag] += __r; _M_state32[0] = __r; for (size_t __i = 1, __j = 0; __j < _M_nstate32; ++__j) { __r = _Func1(_M_state32[__i] ^ _M_state32[(__i + __mid) % _M_nstate32] ^ _M_state32[(__i + _M_nstate32 - 1) % _M_nstate32]); _M_state32[(__i + __mid) % _M_nstate32] += __r; __r += __arr[__j] + __i; _M_state32[(__i + __mid + __lag) % _M_nstate32] += __r; _M_state32[__i] = __r; __i = (__i + 1) % _M_nstate32; } for (size_t __j = 0; __j < _M_nstate32; ++__j) { const size_t __i = (__j + 1) % _M_nstate32; __r = _Func2(_M_state32[__i] + _M_state32[(__i + __mid) % _M_nstate32] + _M_state32[(__i + _M_nstate32 - 1) % _M_nstate32]); _M_state32[(__i + __mid) % _M_nstate32] ^= __r; __r -= __i; _M_state32[(__i + __mid + __lag) % _M_nstate32] ^= __r; _M_state32[__i] = __r; } _M_pos = state_size; _M_period_certification(); } template<typename _UIntType, size_t __m, size_t __pos1, size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2, uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4, uint32_t __parity1, uint32_t __parity2, uint32_t __parity3, uint32_t __parity4> void simd_fast_mersenne_twister_engine<_UIntType, __m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4, __parity1, __parity2, __parity3, __parity4>:: _M_period_certification(void) { static const uint32_t __parity[4] = { __parity1, __parity2, __parity3, __parity4 }; uint32_t __inner = 0; for (size_t __i = 0; __i < 4; ++__i) if (__parity[__i] != 0) __inner ^= _M_state32[__i] & __parity[__i]; if (__builtin_parity(__inner) & 1) return; for (size_t __i = 0; __i < 4; ++__i) if (__parity[__i] != 0) { _M_state32[__i] ^= 1 << (__builtin_ffs(__parity[__i]) - 1); return; } __builtin_unreachable(); } template<typename _UIntType, size_t __m, size_t __pos1, size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2, uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4, uint32_t __parity1, uint32_t __parity2, uint32_t __parity3, uint32_t __parity4> void simd_fast_mersenne_twister_engine<_UIntType, __m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4, __parity1, __parity2, __parity3, __parity4>:: discard(unsigned long long __z) { while (__z > state_size - _M_pos) { __z -= state_size - _M_pos; _M_gen_rand(); } _M_pos += __z; } #ifndef _GLIBCXX_OPT_HAVE_RANDOM_SFMT_GEN_READ namespace { template<size_t __shift> inline void __rshift(uint32_t *__out, const uint32_t *__in) { uint64_t __th = ((static_cast<uint64_t>(__in[3]) << 32) | static_cast<uint64_t>(__in[2])); uint64_t __tl = ((static_cast<uint64_t>(__in[1]) << 32) | static_cast<uint64_t>(__in[0])); uint64_t __oh = __th >> (__shift * 8); uint64_t __ol = __tl >> (__shift * 8); __ol |= __th << (64 - __shift * 8); __out[1] = static_cast<uint32_t>(__ol >> 32); __out[0] = static_cast<uint32_t>(__ol); __out[3] = static_cast<uint32_t>(__oh >> 32); __out[2] = static_cast<uint32_t>(__oh); } template<size_t __shift> inline void __lshift(uint32_t *__out, const uint32_t *__in) { uint64_t __th = ((static_cast<uint64_t>(__in[3]) << 32) | static_cast<uint64_t>(__in[2])); uint64_t __tl = ((static_cast<uint64_t>(__in[1]) << 32) | static_cast<uint64_t>(__in[0])); uint64_t __oh = __th << (__shift * 8); uint64_t __ol = __tl << (__shift * 8); __oh |= __tl >> (64 - __shift * 8); __out[1] = static_cast<uint32_t>(__ol >> 32); __out[0] = static_cast<uint32_t>(__ol); __out[3] = static_cast<uint32_t>(__oh >> 32); __out[2] = static_cast<uint32_t>(__oh); } template<size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2, uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4> inline void __recursion(uint32_t *__r, const uint32_t *__a, const uint32_t *__b, const uint32_t *__c, const uint32_t *__d) { uint32_t __x[4]; uint32_t __y[4]; __lshift<__sl2>(__x, __a); __rshift<__sr2>(__y, __c); __r[0] = (__a[0] ^ __x[0] ^ ((__b[0] >> __sr1) & __msk1) ^ __y[0] ^ (__d[0] << __sl1)); __r[1] = (__a[1] ^ __x[1] ^ ((__b[1] >> __sr1) & __msk2) ^ __y[1] ^ (__d[1] << __sl1)); __r[2] = (__a[2] ^ __x[2] ^ ((__b[2] >> __sr1) & __msk3) ^ __y[2] ^ (__d[2] << __sl1)); __r[3] = (__a[3] ^ __x[3] ^ ((__b[3] >> __sr1) & __msk4) ^ __y[3] ^ (__d[3] << __sl1)); } } template<typename _UIntType, size_t __m, size_t __pos1, size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2, uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4, uint32_t __parity1, uint32_t __parity2, uint32_t __parity3, uint32_t __parity4> void simd_fast_mersenne_twister_engine<_UIntType, __m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4, __parity1, __parity2, __parity3, __parity4>:: _M_gen_rand(void) { const uint32_t *__r1 = &_M_state32[_M_nstate32 - 8]; const uint32_t *__r2 = &_M_state32[_M_nstate32 - 4]; static constexpr size_t __pos1_32 = __pos1 * 4; size_t __i; for (__i = 0; __i < _M_nstate32 - __pos1_32; __i += 4) { __recursion<__sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4> (&_M_state32[__i], &_M_state32[__i], &_M_state32[__i + __pos1_32], __r1, __r2); __r1 = __r2; __r2 = &_M_state32[__i]; } for (; __i < _M_nstate32; __i += 4) { __recursion<__sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4> (&_M_state32[__i], &_M_state32[__i], &_M_state32[__i + __pos1_32 - _M_nstate32], __r1, __r2); __r1 = __r2; __r2 = &_M_state32[__i]; } _M_pos = 0; } #endif #ifndef _GLIBCXX_OPT_HAVE_RANDOM_SFMT_OPERATOREQUAL template<typename _UIntType, size_t __m, size_t __pos1, size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2, uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4, uint32_t __parity1, uint32_t __parity2, uint32_t __parity3, uint32_t __parity4> bool operator==(const __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType, __m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4, __parity1, __parity2, __parity3, __parity4>& __lhs, const __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType, __m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4, __parity1, __parity2, __parity3, __parity4>& __rhs) { typedef __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType, __m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4, __parity1, __parity2, __parity3, __parity4> __engine; return (std::equal(__lhs._M_stateT, __lhs._M_stateT + __engine::state_size, __rhs._M_stateT) && __lhs._M_pos == __rhs._M_pos); } #endif template<typename _UIntType, size_t __m, size_t __pos1, size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2, uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4, uint32_t __parity1, uint32_t __parity2, uint32_t __parity3, uint32_t __parity4, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType, __m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4, __parity1, __parity2, __parity3, __parity4>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left); __os.fill(__space); for (size_t __i = 0; __i < __x._M_nstate32; ++__i) __os << __x._M_state32[__i] << __space; __os << __x._M_pos; __os.flags(__flags); __os.fill(__fill); return __os; } template<typename _UIntType, size_t __m, size_t __pos1, size_t __sl1, size_t __sl2, size_t __sr1, size_t __sr2, uint32_t __msk1, uint32_t __msk2, uint32_t __msk3, uint32_t __msk4, uint32_t __parity1, uint32_t __parity2, uint32_t __parity3, uint32_t __parity4, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType, __m, __pos1, __sl1, __sl2, __sr1, __sr2, __msk1, __msk2, __msk3, __msk4, __parity1, __parity2, __parity3, __parity4>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); for (size_t __i = 0; __i < __x._M_nstate32; ++__i) __is >> __x._M_state32[__i]; __is >> __x._M_pos; __is.flags(__flags); return __is; } #endif // __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ /** * Iteration method due to M.D. J<o:>hnk. * * M.D. J<o:>hnk, Erzeugung von betaverteilten und gammaverteilten * Zufallszahlen, Metrika, Volume 8, 1964 */ template<typename _RealType> template<typename _UniformRandomNumberGenerator> typename beta_distribution<_RealType>::result_type beta_distribution<_RealType>:: operator()(_UniformRandomNumberGenerator& __urng, const param_type& __param) { std::__detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); result_type __x, __y; do { __x = std::exp(std::log(__aurng()) / __param.alpha()); __y = std::exp(std::log(__aurng()) / __param.beta()); } while (__x + __y > result_type(1)); return __x / (__x + __y); } template<typename _RealType> template<typename _OutputIterator, typename _UniformRandomNumberGenerator> void beta_distribution<_RealType>:: __generate_impl(_OutputIterator __f, _OutputIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __param) { __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator>) std::__detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); while (__f != __t) { result_type __x, __y; do { __x = std::exp(std::log(__aurng()) / __param.alpha()); __y = std::exp(std::log(__aurng()) / __param.beta()); } while (__x + __y > result_type(1)); *__f++ = __x / (__x + __y); } } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const __gnu_cxx::beta_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.alpha() << __space << __x.beta(); __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, __gnu_cxx::beta_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _RealType __alpha_val, __beta_val; __is >> __alpha_val >> __beta_val; __x.param(typename __gnu_cxx::beta_distribution<_RealType>:: param_type(__alpha_val, __beta_val)); __is.flags(__flags); return __is; } template<std::size_t _Dimen, typename _RealType> template<typename _InputIterator1, typename _InputIterator2> void normal_mv_distribution<_Dimen, _RealType>::param_type:: _M_init_full(_InputIterator1 __meanbegin, _InputIterator1 __meanend, _InputIterator2 __varcovbegin, _InputIterator2 __varcovend) { __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) std::fill(std::copy(__meanbegin, __meanend, _M_mean.begin()), _M_mean.end(), _RealType(0)); // Perform the Cholesky decomposition auto __w = _M_t.begin(); for (size_t __j = 0; __j < _Dimen; ++__j) { _RealType __sum = _RealType(0); auto __slitbegin = __w; auto __cit = _M_t.begin(); for (size_t __i = 0; __i < __j; ++__i) { auto __slit = __slitbegin; _RealType __s = *__varcovbegin++; for (size_t __k = 0; __k < __i; ++__k) __s -= *__slit++ * *__cit++; *__w++ = __s /= *__cit++; __sum += __s * __s; } __sum = *__varcovbegin - __sum; if (__builtin_expect(__sum <= _RealType(0), 0)) std::__throw_runtime_error(__N("normal_mv_distribution::" "param_type::_M_init_full")); *__w++ = std::sqrt(__sum); std::advance(__varcovbegin, _Dimen - __j); } } template<std::size_t _Dimen, typename _RealType> template<typename _InputIterator1, typename _InputIterator2> void normal_mv_distribution<_Dimen, _RealType>::param_type:: _M_init_lower(_InputIterator1 __meanbegin, _InputIterator1 __meanend, _InputIterator2 __varcovbegin, _InputIterator2 __varcovend) { __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) std::fill(std::copy(__meanbegin, __meanend, _M_mean.begin()), _M_mean.end(), _RealType(0)); // Perform the Cholesky decomposition auto __w = _M_t.begin(); for (size_t __j = 0; __j < _Dimen; ++__j) { _RealType __sum = _RealType(0); auto __slitbegin = __w; auto __cit = _M_t.begin(); for (size_t __i = 0; __i < __j; ++__i) { auto __slit = __slitbegin; _RealType __s = *__varcovbegin++; for (size_t __k = 0; __k < __i; ++__k) __s -= *__slit++ * *__cit++; *__w++ = __s /= *__cit++; __sum += __s * __s; } __sum = *__varcovbegin++ - __sum; if (__builtin_expect(__sum <= _RealType(0), 0)) std::__throw_runtime_error(__N("normal_mv_distribution::" "param_type::_M_init_full")); *__w++ = std::sqrt(__sum); } } template<std::size_t _Dimen, typename _RealType> template<typename _InputIterator1, typename _InputIterator2> void normal_mv_distribution<_Dimen, _RealType>::param_type:: _M_init_diagonal(_InputIterator1 __meanbegin, _InputIterator1 __meanend, _InputIterator2 __varbegin, _InputIterator2 __varend) { __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) std::fill(std::copy(__meanbegin, __meanend, _M_mean.begin()), _M_mean.end(), _RealType(0)); auto __w = _M_t.begin(); size_t __step = 0; while (__varbegin != __varend) { std::fill_n(__w, __step, _RealType(0)); __w += __step++; if (__builtin_expect(*__varbegin < _RealType(0), 0)) std::__throw_runtime_error(__N("normal_mv_distribution::" "param_type::_M_init_diagonal")); *__w++ = std::sqrt(*__varbegin++); } } template<std::size_t _Dimen, typename _RealType> template<typename _UniformRandomNumberGenerator> typename normal_mv_distribution<_Dimen, _RealType>::result_type normal_mv_distribution<_Dimen, _RealType>:: operator()(_UniformRandomNumberGenerator& __urng, const param_type& __param) { result_type __ret; _M_nd.__generate(__ret.begin(), __ret.end(), __urng); auto __t_it = __param._M_t.crbegin(); for (size_t __i = _Dimen; __i > 0; --__i) { _RealType __sum = _RealType(0); for (size_t __j = __i; __j > 0; --__j) __sum += __ret[__j - 1] * *__t_it++; __ret[__i - 1] = __sum; } return __ret; } template<std::size_t _Dimen, typename _RealType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void normal_mv_distribution<_Dimen, _RealType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __param) { __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< _ForwardIterator>) while (__f != __t) *__f++ = this->operator()(__urng, __param); } template<size_t _Dimen, typename _RealType> bool operator==(const __gnu_cxx::normal_mv_distribution<_Dimen, _RealType>& __d1, const __gnu_cxx::normal_mv_distribution<_Dimen, _RealType>& __d2) { return __d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd; } template<size_t _Dimen, typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const __gnu_cxx::normal_mv_distribution<_Dimen, _RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); auto __mean = __x._M_param.mean(); for (auto __it : __mean) __os << __it << __space; auto __t = __x._M_param.varcov(); for (auto __it : __t) __os << __it << __space; __os << __x._M_nd; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<size_t _Dimen, typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, __gnu_cxx::normal_mv_distribution<_Dimen, _RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); std::array<_RealType, _Dimen> __mean; for (auto& __it : __mean) __is >> __it; std::array<_RealType, _Dimen * (_Dimen + 1) / 2> __varcov; for (auto& __it : __varcov) __is >> __it; __is >> __x._M_nd; __x.param(typename normal_mv_distribution<_Dimen, _RealType>:: param_type(__mean.begin(), __mean.end(), __varcov.begin(), __varcov.end())); __is.flags(__flags); return __is; } template<typename _RealType> template<typename _OutputIterator, typename _UniformRandomNumberGenerator> void rice_distribution<_RealType>:: __generate_impl(_OutputIterator __f, _OutputIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator>) while (__f != __t) { typename std::normal_distribution<result_type>::param_type __px(__p.nu(), __p.sigma()), __py(result_type(0), __p.sigma()); result_type __x = this->_M_ndx(__px, __urng); result_type __y = this->_M_ndy(__py, __urng); #if _GLIBCXX_USE_C99_MATH_TR1 *__f++ = std::hypot(__x, __y); #else *__f++ = std::sqrt(__x * __x + __y * __y); #endif } } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const rice_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.nu() << __space << __x.sigma(); __os << __space << __x._M_ndx; __os << __space << __x._M_ndy; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, rice_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _RealType __nu_val, __sigma_val; __is >> __nu_val >> __sigma_val; __is >> __x._M_ndx; __is >> __x._M_ndy; __x.param(typename rice_distribution<_RealType>:: param_type(__nu_val, __sigma_val)); __is.flags(__flags); return __is; } template<typename _RealType> template<typename _OutputIterator, typename _UniformRandomNumberGenerator> void nakagami_distribution<_RealType>:: __generate_impl(_OutputIterator __f, _OutputIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator>) typename std::gamma_distribution<result_type>::param_type __pg(__p.mu(), __p.omega() / __p.mu()); while (__f != __t) *__f++ = std::sqrt(this->_M_gd(__pg, __urng)); } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const nakagami_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.mu() << __space << __x.omega(); __os << __space << __x._M_gd; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, nakagami_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _RealType __mu_val, __omega_val; __is >> __mu_val >> __omega_val; __is >> __x._M_gd; __x.param(typename nakagami_distribution<_RealType>:: param_type(__mu_val, __omega_val)); __is.flags(__flags); return __is; } template<typename _RealType> template<typename _OutputIterator, typename _UniformRandomNumberGenerator> void pareto_distribution<_RealType>:: __generate_impl(_OutputIterator __f, _OutputIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator>) result_type __mu_val = __p.mu(); result_type __malphinv = -result_type(1) / __p.alpha(); while (__f != __t) *__f++ = __mu_val * std::pow(this->_M_ud(__urng), __malphinv); } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const pareto_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.alpha() << __space << __x.mu(); __os << __space << __x._M_ud; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, pareto_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _RealType __alpha_val, __mu_val; __is >> __alpha_val >> __mu_val; __is >> __x._M_ud; __x.param(typename pareto_distribution<_RealType>:: param_type(__alpha_val, __mu_val)); __is.flags(__flags); return __is; } template<typename _RealType> template<typename _UniformRandomNumberGenerator> typename k_distribution<_RealType>::result_type k_distribution<_RealType>:: operator()(_UniformRandomNumberGenerator& __urng) { result_type __x = this->_M_gd1(__urng); result_type __y = this->_M_gd2(__urng); return std::sqrt(__x * __y); } template<typename _RealType> template<typename _UniformRandomNumberGenerator> typename k_distribution<_RealType>::result_type k_distribution<_RealType>:: operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { typename std::gamma_distribution<result_type>::param_type __p1(__p.lambda(), result_type(1) / __p.lambda()), __p2(__p.nu(), __p.mu() / __p.nu()); result_type __x = this->_M_gd1(__p1, __urng); result_type __y = this->_M_gd2(__p2, __urng); return std::sqrt(__x * __y); } template<typename _RealType> template<typename _OutputIterator, typename _UniformRandomNumberGenerator> void k_distribution<_RealType>:: __generate_impl(_OutputIterator __f, _OutputIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator>) typename std::gamma_distribution<result_type>::param_type __p1(__p.lambda(), result_type(1) / __p.lambda()), __p2(__p.nu(), __p.mu() / __p.nu()); while (__f != __t) { result_type __x = this->_M_gd1(__p1, __urng); result_type __y = this->_M_gd2(__p2, __urng); *__f++ = std::sqrt(__x * __y); } } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const k_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.lambda() << __space << __x.mu() << __space << __x.nu(); __os << __space << __x._M_gd1; __os << __space << __x._M_gd2; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, k_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _RealType __lambda_val, __mu_val, __nu_val; __is >> __lambda_val >> __mu_val >> __nu_val; __is >> __x._M_gd1; __is >> __x._M_gd2; __x.param(typename k_distribution<_RealType>:: param_type(__lambda_val, __mu_val, __nu_val)); __is.flags(__flags); return __is; } template<typename _RealType> template<typename _OutputIterator, typename _UniformRandomNumberGenerator> void arcsine_distribution<_RealType>:: __generate_impl(_OutputIterator __f, _OutputIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator>) result_type __dif = __p.b() - __p.a(); result_type __sum = __p.a() + __p.b(); while (__f != __t) { result_type __x = std::sin(this->_M_ud(__urng)); *__f++ = (__x * __dif + __sum) / result_type(2); } } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const arcsine_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.a() << __space << __x.b(); __os << __space << __x._M_ud; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, arcsine_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _RealType __a, __b; __is >> __a >> __b; __is >> __x._M_ud; __x.param(typename arcsine_distribution<_RealType>:: param_type(__a, __b)); __is.flags(__flags); return __is; } template<typename _RealType> template<typename _UniformRandomNumberGenerator> typename hoyt_distribution<_RealType>::result_type hoyt_distribution<_RealType>:: operator()(_UniformRandomNumberGenerator& __urng) { result_type __x = this->_M_ad(__urng); result_type __y = this->_M_ed(__urng); return (result_type(2) * this->q() / (result_type(1) + this->q() * this->q())) * std::sqrt(this->omega() * __x * __y); } template<typename _RealType> template<typename _UniformRandomNumberGenerator> typename hoyt_distribution<_RealType>::result_type hoyt_distribution<_RealType>:: operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { result_type __q2 = __p.q() * __p.q(); result_type __num = result_type(0.5L) * (result_type(1) + __q2); typename __gnu_cxx::arcsine_distribution<result_type>::param_type __pa(__num, __num / __q2); result_type __x = this->_M_ad(__pa, __urng); result_type __y = this->_M_ed(__urng); return (result_type(2) * __p.q() / (result_type(1) + __q2)) * std::sqrt(__p.omega() * __x * __y); } template<typename _RealType> template<typename _OutputIterator, typename _UniformRandomNumberGenerator> void hoyt_distribution<_RealType>:: __generate_impl(_OutputIterator __f, _OutputIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator>) result_type __2q = result_type(2) * __p.q(); result_type __q2 = __p.q() * __p.q(); result_type __q2p1 = result_type(1) + __q2; result_type __num = result_type(0.5L) * __q2p1; result_type __omega = __p.omega(); typename __gnu_cxx::arcsine_distribution<result_type>::param_type __pa(__num, __num / __q2); while (__f != __t) { result_type __x = this->_M_ad(__pa, __urng); result_type __y = this->_M_ed(__urng); *__f++ = (__2q / __q2p1) * std::sqrt(__omega * __x * __y); } } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const hoyt_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.q() << __space << __x.omega(); __os << __space << __x._M_ad; __os << __space << __x._M_ed; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, hoyt_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _RealType __q, __omega; __is >> __q >> __omega; __is >> __x._M_ad; __is >> __x._M_ed; __x.param(typename hoyt_distribution<_RealType>:: param_type(__q, __omega)); __is.flags(__flags); return __is; } template<typename _RealType> template<typename _OutputIterator, typename _UniformRandomNumberGenerator> void triangular_distribution<_RealType>:: __generate_impl(_OutputIterator __f, _OutputIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __param) { __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator>) while (__f != __t) *__f++ = this->operator()(__urng, __param); } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const __gnu_cxx::triangular_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.a() << __space << __x.b() << __space << __x.c(); __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, __gnu_cxx::triangular_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _RealType __a, __b, __c; __is >> __a >> __b >> __c; __x.param(typename __gnu_cxx::triangular_distribution<_RealType>:: param_type(__a, __b, __c)); __is.flags(__flags); return __is; } template<typename _RealType> template<typename _OutputIterator, typename _UniformRandomNumberGenerator> void von_mises_distribution<_RealType>:: __generate_impl(_OutputIterator __f, _OutputIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __param) { __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator>) while (__f != __t) *__f++ = this->operator()(__urng, __param); } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const __gnu_cxx::von_mises_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.mu() << __space << __x.kappa(); __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, __gnu_cxx::von_mises_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _RealType __mu, __kappa; __is >> __mu >> __kappa; __x.param(typename __gnu_cxx::von_mises_distribution<_RealType>:: param_type(__mu, __kappa)); __is.flags(__flags); return __is; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // _EXT_RANDOM_TCC ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/cast.h��������������������������������������������������������������������������������0000644�����������������00000010536�14763166030�0007503 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <cast.h> -*- C++ -*- // Copyright (C) 2008-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file ext/cast.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ext/pointer.h} */ #ifndef _GLIBCXX_CAST_H #define _GLIBCXX_CAST_H 1 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * These functions are here to allow containers to support non standard * pointer types. For normal pointers, these resolve to the use of the * standard cast operation. For other types the functions will perform * the apprpriate cast to/from the custom pointer class so long as that * class meets the following conditions: * 1) has a typedef element_type which names tehe type it points to. * 2) has a get() const method which returns element_type*. * 3) has a constructor which can take one element_type* argument. */ /** * This type supports the semantics of the pointer cast operators (below.) */ template<typename _ToType> struct _Caster { typedef typename _ToType::element_type* type; }; template<typename _ToType> struct _Caster<_ToType*> { typedef _ToType* type; }; /** * Casting operations for cases where _FromType is not a standard pointer. * _ToType can be a standard or non-standard pointer. Given that _FromType * is not a pointer, it must have a get() method that returns the standard * pointer equivalent of the address it points to, and must have an * element_type typedef which names the type it points to. */ template<typename _ToType, typename _FromType> inline _ToType __static_pointer_cast(const _FromType& __arg) { return _ToType(static_cast<typename _Caster<_ToType>:: type>(__arg.get())); } template<typename _ToType, typename _FromType> inline _ToType __dynamic_pointer_cast(const _FromType& __arg) { return _ToType(dynamic_cast<typename _Caster<_ToType>:: type>(__arg.get())); } template<typename _ToType, typename _FromType> inline _ToType __const_pointer_cast(const _FromType& __arg) { return _ToType(const_cast<typename _Caster<_ToType>:: type>(__arg.get())); } template<typename _ToType, typename _FromType> inline _ToType __reinterpret_pointer_cast(const _FromType& __arg) { return _ToType(reinterpret_cast<typename _Caster<_ToType>:: type>(__arg.get())); } /** * Casting operations for cases where _FromType is a standard pointer. * _ToType can be a standard or non-standard pointer. */ template<typename _ToType, typename _FromType> inline _ToType __static_pointer_cast(_FromType* __arg) { return _ToType(static_cast<typename _Caster<_ToType>:: type>(__arg)); } template<typename _ToType, typename _FromType> inline _ToType __dynamic_pointer_cast(_FromType* __arg) { return _ToType(dynamic_cast<typename _Caster<_ToType>:: type>(__arg)); } template<typename _ToType, typename _FromType> inline _ToType __const_pointer_cast(_FromType* __arg) { return _ToType(const_cast<typename _Caster<_ToType>:: type>(__arg)); } template<typename _ToType, typename _FromType> inline _ToType __reinterpret_pointer_cast(_FromType* __arg) { return _ToType(reinterpret_cast<typename _Caster<_ToType>:: type>(__arg)); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // _GLIBCXX_CAST_H ������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ext/throw_allocator.h���������������������������������������������������������������������0000644�����������������00000050773�14763166030�0011763 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2005-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) any later // version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** @file ext/throw_allocator.h * This file is a GNU extension to the Standard C++ Library. * * Contains two exception-generating types (throw_value, throw_allocator) * intended to be used as value and allocator types while testing * exception safety in templatized containers and algorithms. The * allocator has additional log and debug features. The exception * generated is of type forced_exception_error. */ #ifndef _THROW_ALLOCATOR_H #define _THROW_ALLOCATOR_H 1 #include <cmath> #include <ctime> #include <map> #include <string> #include <ostream> #include <stdexcept> #include <utility> #include <bits/functexcept.h> #include <bits/move.h> #if __cplusplus >= 201103L # include <functional> # include <random> #else # include <tr1/functional> # include <tr1/random> #endif namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Thown by exception safety machinery. * @ingroup exceptions */ struct forced_error : public std::exception { }; // Substitute for forced_error object when -fno-exceptions. inline void __throw_forced_error() { _GLIBCXX_THROW_OR_ABORT(forced_error()); } /** * @brief Base class for checking address and label information * about allocations. Create a std::map between the allocated * address (void*) and a datum for annotations, which are a pair of * numbers corresponding to label and allocated size. */ struct annotate_base { annotate_base() { label(); map(); } static void set_label(size_t l) { label() = l; } static size_t get_label() { return label(); } void insert(void* p, size_t size) { if (!p) { std::string error("annotate_base::insert null insert!\n"); log_to_string(error, make_entry(p, size)); std::__throw_logic_error(error.c_str()); } const_iterator found = map().find(p); if (found != map().end()) { std::string error("annotate_base::insert double insert!\n"); log_to_string(error, make_entry(p, size)); log_to_string(error, *found); std::__throw_logic_error(error.c_str()); } map().insert(make_entry(p, size)); } void erase(void* p, size_t size) { check_allocated(p, size); map().erase(p); } // See if a particular address and allocation size has been saved. inline void check_allocated(void* p, size_t size) { const_iterator found = map().find(p); if (found == map().end()) { std::string error("annotate_base::check_allocated by value " "null erase!\n"); log_to_string(error, make_entry(p, size)); std::__throw_logic_error(error.c_str()); } if (found->second.second != size) { std::string error("annotate_base::check_allocated by value " "wrong-size erase!\n"); log_to_string(error, make_entry(p, size)); log_to_string(error, *found); std::__throw_logic_error(error.c_str()); } } // See if a given label has been allocated. inline void check_allocated(size_t label) { const_iterator beg = map().begin(); const_iterator end = map().end(); std::string found; while (beg != end) { if (beg->second.first == label) log_to_string(found, *beg); ++beg; } if (!found.empty()) { std::string error("annotate_base::check_allocated by label\n"); error += found; std::__throw_logic_error(error.c_str()); } } private: typedef std::pair<size_t, size_t> data_type; typedef std::map<void*, data_type> map_type; typedef map_type::value_type entry_type; typedef map_type::const_iterator const_iterator; typedef map_type::const_reference const_reference; friend std::ostream& operator<<(std::ostream&, const annotate_base&); entry_type make_entry(void* p, size_t size) { return std::make_pair(p, data_type(get_label(), size)); } void log_to_string(std::string& s, const_reference ref) const { char buf[40]; const char tab('\t'); s += "label: "; unsigned long l = static_cast<unsigned long>(ref.second.first); __builtin_sprintf(buf, "%lu", l); s += buf; s += tab; s += "size: "; l = static_cast<unsigned long>(ref.second.second); __builtin_sprintf(buf, "%lu", l); s += buf; s += tab; s += "address: "; __builtin_sprintf(buf, "%p", ref.first); s += buf; s += '\n'; } static size_t& label() { static size_t _S_label(std::numeric_limits<size_t>::max()); return _S_label; } static map_type& map() { static map_type _S_map; return _S_map; } }; inline std::ostream& operator<<(std::ostream& os, const annotate_base& __b) { std::string error; typedef annotate_base base_type; base_type::const_iterator beg = __b.map().begin(); base_type::const_iterator end = __b.map().end(); for (; beg != end; ++beg) __b.log_to_string(error, *beg); return os << error; } /** * @brief Base struct for condition policy. * * Requires a public member function with the signature * void throw_conditionally() */ struct condition_base { virtual ~condition_base() { }; }; /** * @brief Base class for incremental control and throw. */ struct limit_condition : public condition_base { // Scope-level adjustor objects: set limit for throw at the // beginning of a scope block, and restores to previous limit when // object is destroyed on exiting the block. struct adjustor_base { private: const size_t _M_orig; public: adjustor_base() : _M_orig(limit()) { } virtual ~adjustor_base() { set_limit(_M_orig); } }; /// Never enter the condition. struct never_adjustor : public adjustor_base { never_adjustor() { set_limit(std::numeric_limits<size_t>::max()); } }; /// Always enter the condition. struct always_adjustor : public adjustor_base { always_adjustor() { set_limit(count()); } }; /// Enter the nth condition. struct limit_adjustor : public adjustor_base { limit_adjustor(const size_t __l) { set_limit(__l); } }; // Increment _S_count every time called. // If _S_count matches the limit count, throw. static void throw_conditionally() { if (count() == limit()) __throw_forced_error(); ++count(); } static size_t& count() { static size_t _S_count(0); return _S_count; } static size_t& limit() { static size_t _S_limit(std::numeric_limits<size_t>::max()); return _S_limit; } // Zero the throw counter, set limit to argument. static void set_limit(const size_t __l) { limit() = __l; count() = 0; } }; /** * @brief Base class for random probability control and throw. */ struct random_condition : public condition_base { // Scope-level adjustor objects: set probability for throw at the // beginning of a scope block, and restores to previous // probability when object is destroyed on exiting the block. struct adjustor_base { private: const double _M_orig; public: adjustor_base() : _M_orig(probability()) { } virtual ~adjustor_base() { set_probability(_M_orig); } }; /// Group condition. struct group_adjustor : public adjustor_base { group_adjustor(size_t size) { set_probability(1 - std::pow(double(1 - probability()), double(0.5 / (size + 1)))); } }; /// Never enter the condition. struct never_adjustor : public adjustor_base { never_adjustor() { set_probability(0); } }; /// Always enter the condition. struct always_adjustor : public adjustor_base { always_adjustor() { set_probability(1); } }; random_condition() { probability(); engine(); } static void set_probability(double __p) { probability() = __p; } static void throw_conditionally() { if (generate() < probability()) __throw_forced_error(); } void seed(unsigned long __s) { engine().seed(__s); } private: #if __cplusplus >= 201103L typedef std::uniform_real_distribution<double> distribution_type; typedef std::mt19937 engine_type; #else typedef std::tr1::uniform_real<double> distribution_type; typedef std::tr1::mt19937 engine_type; #endif static double generate() { #if __cplusplus >= 201103L const distribution_type distribution(0, 1); static auto generator = std::bind(distribution, engine()); #else // Use variate_generator to get normalized results. typedef std::tr1::variate_generator<engine_type, distribution_type> gen_t; distribution_type distribution(0, 1); static gen_t generator(engine(), distribution); #endif double random = generator(); if (random < distribution.min() || random > distribution.max()) { std::string __s("random_condition::generate"); __s += "\n"; __s += "random number generated is: "; char buf[40]; __builtin_sprintf(buf, "%f", random); __s += buf; std::__throw_out_of_range(__s.c_str()); } return random; } static double& probability() { static double _S_p; return _S_p; } static engine_type& engine() { static engine_type _S_e; return _S_e; } }; /** * @brief Class with exception generation control. Intended to be * used as a value_type in templatized code. * * Note: Destructor not allowed to throw. */ template<typename _Cond> struct throw_value_base : public _Cond { typedef _Cond condition_type; using condition_type::throw_conditionally; std::size_t _M_i; #ifndef _GLIBCXX_IS_AGGREGATE throw_value_base() : _M_i(0) { throw_conditionally(); } throw_value_base(const throw_value_base& __v) : _M_i(__v._M_i) { throw_conditionally(); } #if __cplusplus >= 201103L // Shall not throw. throw_value_base(throw_value_base&&) = default; #endif explicit throw_value_base(const std::size_t __i) : _M_i(__i) { throw_conditionally(); } #endif throw_value_base& operator=(const throw_value_base& __v) { throw_conditionally(); _M_i = __v._M_i; return *this; } #if __cplusplus >= 201103L // Shall not throw. throw_value_base& operator=(throw_value_base&&) = default; #endif throw_value_base& operator++() { throw_conditionally(); ++_M_i; return *this; } }; template<typename _Cond> inline void swap(throw_value_base<_Cond>& __a, throw_value_base<_Cond>& __b) { typedef throw_value_base<_Cond> throw_value; throw_value::throw_conditionally(); throw_value orig(__a); __a = __b; __b = orig; } // General instantiable types requirements. template<typename _Cond> inline bool operator==(const throw_value_base<_Cond>& __a, const throw_value_base<_Cond>& __b) { typedef throw_value_base<_Cond> throw_value; throw_value::throw_conditionally(); bool __ret = __a._M_i == __b._M_i; return __ret; } template<typename _Cond> inline bool operator<(const throw_value_base<_Cond>& __a, const throw_value_base<_Cond>& __b) { typedef throw_value_base<_Cond> throw_value; throw_value::throw_conditionally(); bool __ret = __a._M_i < __b._M_i; return __ret; } // Numeric algorithms instantiable types requirements. template<typename _Cond> inline throw_value_base<_Cond> operator+(const throw_value_base<_Cond>& __a, const throw_value_base<_Cond>& __b) { typedef throw_value_base<_Cond> throw_value; throw_value::throw_conditionally(); throw_value __ret(__a._M_i + __b._M_i); return __ret; } template<typename _Cond> inline throw_value_base<_Cond> operator-(const throw_value_base<_Cond>& __a, const throw_value_base<_Cond>& __b) { typedef throw_value_base<_Cond> throw_value; throw_value::throw_conditionally(); throw_value __ret(__a._M_i - __b._M_i); return __ret; } template<typename _Cond> inline throw_value_base<_Cond> operator*(const throw_value_base<_Cond>& __a, const throw_value_base<_Cond>& __b) { typedef throw_value_base<_Cond> throw_value; throw_value::throw_conditionally(); throw_value __ret(__a._M_i * __b._M_i); return __ret; } /// Type throwing via limit condition. struct throw_value_limit : public throw_value_base<limit_condition> { typedef throw_value_base<limit_condition> base_type; #ifndef _GLIBCXX_IS_AGGREGATE throw_value_limit() { } throw_value_limit(const throw_value_limit& __other) : base_type(__other._M_i) { } #if __cplusplus >= 201103L throw_value_limit(throw_value_limit&&) = default; #endif explicit throw_value_limit(const std::size_t __i) : base_type(__i) { } #endif throw_value_limit& operator=(const throw_value_limit& __other) { base_type::operator=(__other); return *this; } #if __cplusplus >= 201103L throw_value_limit& operator=(throw_value_limit&&) = default; #endif }; /// Type throwing via random condition. struct throw_value_random : public throw_value_base<random_condition> { typedef throw_value_base<random_condition> base_type; #ifndef _GLIBCXX_IS_AGGREGATE throw_value_random() { } throw_value_random(const throw_value_random& __other) : base_type(__other._M_i) { } #if __cplusplus >= 201103L throw_value_random(throw_value_random&&) = default; #endif explicit throw_value_random(const std::size_t __i) : base_type(__i) { } #endif throw_value_random& operator=(const throw_value_random& __other) { base_type::operator=(__other); return *this; } #if __cplusplus >= 201103L throw_value_random& operator=(throw_value_random&&) = default; #endif }; /** * @brief Allocator class with logging and exception generation control. * Intended to be used as an allocator_type in templatized code. * @ingroup allocators * * Note: Deallocate not allowed to throw. */ template<typename _Tp, typename _Cond> class throw_allocator_base : public annotate_base, public _Cond { public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Tp value_type; typedef value_type* pointer; typedef const value_type* const_pointer; typedef value_type& reference; typedef const value_type& const_reference; #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2103. std::allocator propagate_on_container_move_assignment typedef std::true_type propagate_on_container_move_assignment; #endif private: typedef _Cond condition_type; std::allocator<value_type> _M_allocator; using condition_type::throw_conditionally; public: size_type max_size() const _GLIBCXX_USE_NOEXCEPT { return _M_allocator.max_size(); } pointer address(reference __x) const _GLIBCXX_NOEXCEPT { return std::__addressof(__x); } const_pointer address(const_reference __x) const _GLIBCXX_NOEXCEPT { return std::__addressof(__x); } pointer allocate(size_type __n, std::allocator<void>::const_pointer hint = 0) { if (__n > this->max_size()) std::__throw_bad_alloc(); throw_conditionally(); pointer const a = _M_allocator.allocate(__n, hint); insert(a, sizeof(value_type) * __n); return a; } #if __cplusplus >= 201103L template<typename _Up, typename... _Args> void construct(_Up* __p, _Args&&... __args) { return _M_allocator.construct(__p, std::forward<_Args>(__args)...); } template<typename _Up> void destroy(_Up* __p) { _M_allocator.destroy(__p); } #else void construct(pointer __p, const value_type& val) { return _M_allocator.construct(__p, val); } void destroy(pointer __p) { _M_allocator.destroy(__p); } #endif void deallocate(pointer __p, size_type __n) { erase(__p, sizeof(value_type) * __n); _M_allocator.deallocate(__p, __n); } void check_allocated(pointer __p, size_type __n) { size_type __t = sizeof(value_type) * __n; annotate_base::check_allocated(__p, __t); } void check_allocated(size_type __n) { annotate_base::check_allocated(__n); } }; template<typename _Tp, typename _Cond> inline bool operator==(const throw_allocator_base<_Tp, _Cond>&, const throw_allocator_base<_Tp, _Cond>&) { return true; } template<typename _Tp, typename _Cond> inline bool operator!=(const throw_allocator_base<_Tp, _Cond>&, const throw_allocator_base<_Tp, _Cond>&) { return false; } /// Allocator throwing via limit condition. template<typename _Tp> struct throw_allocator_limit : public throw_allocator_base<_Tp, limit_condition> { template<typename _Tp1> struct rebind { typedef throw_allocator_limit<_Tp1> other; }; throw_allocator_limit() _GLIBCXX_USE_NOEXCEPT { } throw_allocator_limit(const throw_allocator_limit&) _GLIBCXX_USE_NOEXCEPT { } template<typename _Tp1> throw_allocator_limit(const throw_allocator_limit<_Tp1>&) _GLIBCXX_USE_NOEXCEPT { } ~throw_allocator_limit() _GLIBCXX_USE_NOEXCEPT { } }; /// Allocator throwing via random condition. template<typename _Tp> struct throw_allocator_random : public throw_allocator_base<_Tp, random_condition> { template<typename _Tp1> struct rebind { typedef throw_allocator_random<_Tp1> other; }; throw_allocator_random() _GLIBCXX_USE_NOEXCEPT { } throw_allocator_random(const throw_allocator_random&) _GLIBCXX_USE_NOEXCEPT { } template<typename _Tp1> throw_allocator_random(const throw_allocator_random<_Tp1>&) _GLIBCXX_USE_NOEXCEPT { } ~throw_allocator_random() _GLIBCXX_USE_NOEXCEPT { } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #if __cplusplus >= 201103L # include <bits/functional_hash.h> namespace std _GLIBCXX_VISIBILITY(default) { /// Explicit specialization of std::hash for __gnu_cxx::throw_value_limit. template<> struct hash<__gnu_cxx::throw_value_limit> : public std::unary_function<__gnu_cxx::throw_value_limit, size_t> { size_t operator()(const __gnu_cxx::throw_value_limit& __val) const { std::hash<std::size_t> __h; size_t __result = __h(__val._M_i); return __result; } }; /// Explicit specialization of std::hash for __gnu_cxx::throw_value_limit. template<> struct hash<__gnu_cxx::throw_value_random> : public std::unary_function<__gnu_cxx::throw_value_random, size_t> { size_t operator()(const __gnu_cxx::throw_value_random& __val) const { std::hash<std::size_t> __h; size_t __result = __h(__val._M_i); return __result; } }; } // end namespace std #endif #endif �����c++/4.8.2/vector������������������������������������������������������������������������������������0000644�����������������00000005245�14763166030�0007026 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <vector> -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any ded "as is" without express or implied warranty. * * * Copyright (c) 1996 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file include/vector * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_VECTOR #define _GLIBCXX_VECTOR 1 #pragma GCC system_header #include <bits/stl_algobase.h> #include <bits/allocator.h> #include <bits/stl_construct.h> #include <bits/stl_uninitialized.h> #include <bits/stl_vector.h> #include <bits/stl_bvector.h> #include <bits/range_access.h> #ifndef _GLIBCXX_EXPORT_TEMPLATE # include <bits/vector.tcc> #endif #ifdef _GLIBCXX_DEBUG # include <debug/vector> #endif #ifdef _GLIBCXX_PROFILE # include <profile/vector> #endif #endif /* _GLIBCXX_VECTOR */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/stdexcept���������������������������������������������������������������������������������0000644�����������������00000011156�14763166030�0007525 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Standard exception classes -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/stdexcept * This is a Standard C++ Library header. */ // // ISO C++ 19.1 Exception classes // #ifndef _GLIBCXX_STDEXCEPT #define _GLIBCXX_STDEXCEPT 1 #pragma GCC system_header #include <exception> #include <string> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup exceptions * @{ */ /** Logic errors represent problems in the internal logic of a program; * in theory, these are preventable, and even detectable before the * program runs (e.g., violations of class invariants). * @brief One of two subclasses of exception. */ class logic_error : public exception { string _M_msg; public: /** Takes a character string describing the error. */ explicit logic_error(const string& __arg); virtual ~logic_error() _GLIBCXX_USE_NOEXCEPT; /** Returns a C-style character string describing the general cause of * the current error (the same string passed to the ctor). */ virtual const char* what() const _GLIBCXX_USE_NOEXCEPT; }; /** Thrown by the library, or by you, to report domain errors (domain in * the mathematical sense). */ class domain_error : public logic_error { public: explicit domain_error(const string& __arg); virtual ~domain_error() _GLIBCXX_USE_NOEXCEPT; }; /** Thrown to report invalid arguments to functions. */ class invalid_argument : public logic_error { public: explicit invalid_argument(const string& __arg); virtual ~invalid_argument() _GLIBCXX_USE_NOEXCEPT; }; /** Thrown when an object is constructed that would exceed its maximum * permitted size (e.g., a basic_string instance). */ class length_error : public logic_error { public: explicit length_error(const string& __arg); virtual ~length_error() _GLIBCXX_USE_NOEXCEPT; }; /** This represents an argument whose value is not within the expected * range (e.g., boundary checks in basic_string). */ class out_of_range : public logic_error { public: explicit out_of_range(const string& __arg); virtual ~out_of_range() _GLIBCXX_USE_NOEXCEPT; }; /** Runtime errors represent problems outside the scope of a program; * they cannot be easily predicted and can generally only be caught as * the program executes. * @brief One of two subclasses of exception. */ class runtime_error : public exception { string _M_msg; public: /** Takes a character string describing the error. */ explicit runtime_error(const string& __arg); virtual ~runtime_error() _GLIBCXX_USE_NOEXCEPT; /** Returns a C-style character string describing the general cause of * the current error (the same string passed to the ctor). */ virtual const char* what() const _GLIBCXX_USE_NOEXCEPT; }; /** Thrown to indicate range errors in internal computations. */ class range_error : public runtime_error { public: explicit range_error(const string& __arg); virtual ~range_error() _GLIBCXX_USE_NOEXCEPT; }; /** Thrown to indicate arithmetic overflow. */ class overflow_error : public runtime_error { public: explicit overflow_error(const string& __arg); virtual ~overflow_error() _GLIBCXX_USE_NOEXCEPT; }; /** Thrown to indicate arithmetic underflow. */ class underflow_error : public runtime_error { public: explicit underflow_error(const string& __arg); virtual ~underflow_error() _GLIBCXX_USE_NOEXCEPT; }; // @} group exceptions _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _GLIBCXX_STDEXCEPT */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/thread������������������������������������������������������������������������������������0000644�����������������00000016124�14763166030�0006771 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <thread> -*- C++ -*- // Copyright (C) 2008-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/thread * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_THREAD #define _GLIBCXX_THREAD 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <chrono> #include <functional> #include <memory> #include <bits/functexcept.h> #include <bits/functional_hash.h> #include <bits/gthr.h> #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup threads Threads * @ingroup concurrency * * Classes for thread support. * @{ */ /// thread class thread { public: typedef __gthread_t native_handle_type; struct _Impl_base; typedef shared_ptr<_Impl_base> __shared_base_type; /// thread::id class id { native_handle_type _M_thread; public: id() noexcept : _M_thread() { } explicit id(native_handle_type __id) : _M_thread(__id) { } private: friend class thread; friend class hash<thread::id>; friend bool operator==(thread::id __x, thread::id __y) noexcept { return __gthread_equal(__x._M_thread, __y._M_thread); } friend bool operator<(thread::id __x, thread::id __y) noexcept { return __x._M_thread < __y._M_thread; } template<class _CharT, class _Traits> friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __out, thread::id __id); }; // Simple base type that the templatized, derived class containing // an arbitrary functor can be converted to and called. struct _Impl_base { __shared_base_type _M_this_ptr; inline virtual ~_Impl_base(); virtual void _M_run() = 0; }; template<typename _Callable> struct _Impl : public _Impl_base { _Callable _M_func; _Impl(_Callable&& __f) : _M_func(std::forward<_Callable>(__f)) { } void _M_run() { _M_func(); } }; private: id _M_id; public: thread() noexcept = default; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2097. packaged_task constructors should be constrained thread(thread&) = delete; thread(const thread&) = delete; thread(thread&& __t) noexcept { swap(__t); } template<typename _Callable, typename... _Args> explicit thread(_Callable&& __f, _Args&&... __args) { _M_start_thread(_M_make_routine(std::__bind_simple( std::forward<_Callable>(__f), std::forward<_Args>(__args)...))); } ~thread() { if (joinable()) std::terminate(); } thread& operator=(const thread&) = delete; thread& operator=(thread&& __t) noexcept { if (joinable()) std::terminate(); swap(__t); return *this; } void swap(thread& __t) noexcept { std::swap(_M_id, __t._M_id); } bool joinable() const noexcept { return !(_M_id == id()); } void join(); void detach(); thread::id get_id() const noexcept { return _M_id; } /** @pre thread is joinable */ native_handle_type native_handle() { return _M_id._M_thread; } // Returns a value that hints at the number of hardware thread contexts. static unsigned int hardware_concurrency() noexcept; private: void _M_start_thread(__shared_base_type); template<typename _Callable> shared_ptr<_Impl<_Callable>> _M_make_routine(_Callable&& __f) { // Create and allocate full data structure, not base. return std::make_shared<_Impl<_Callable>>(std::forward<_Callable>(__f)); } }; inline thread::_Impl_base::~_Impl_base() = default; inline void swap(thread& __x, thread& __y) noexcept { __x.swap(__y); } inline bool operator!=(thread::id __x, thread::id __y) noexcept { return !(__x == __y); } inline bool operator<=(thread::id __x, thread::id __y) noexcept { return !(__y < __x); } inline bool operator>(thread::id __x, thread::id __y) noexcept { return __y < __x; } inline bool operator>=(thread::id __x, thread::id __y) noexcept { return !(__x < __y); } // DR 889. /// std::hash specialization for thread::id. template<> struct hash<thread::id> : public __hash_base<size_t, thread::id> { size_t operator()(const thread::id& __id) const noexcept { return std::_Hash_impl::hash(__id._M_thread); } }; template<class _CharT, class _Traits> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __out, thread::id __id) { if (__id == thread::id()) return __out << "thread::id of a non-executing thread"; else return __out << __id._M_thread; } _GLIBCXX_END_NAMESPACE_VERSION /** @namespace std::this_thread * @brief ISO C++ 2011 entities sub-namespace for thread. * 30.3.2 Namespace this_thread. */ namespace this_thread { _GLIBCXX_BEGIN_NAMESPACE_VERSION /// get_id inline thread::id get_id() noexcept { return thread::id(__gthread_self()); } /// yield inline void yield() noexcept { #ifdef _GLIBCXX_USE_SCHED_YIELD __gthread_yield(); #endif } void __sleep_for(chrono::seconds, chrono::nanoseconds); /// sleep_for template<typename _Rep, typename _Period> inline void sleep_for(const chrono::duration<_Rep, _Period>& __rtime) { auto __s = chrono::duration_cast<chrono::seconds>(__rtime); auto __ns = chrono::duration_cast<chrono::nanoseconds>(__rtime - __s); #ifdef _GLIBCXX_USE_NANOSLEEP __gthread_time_t __ts = { static_cast<std::time_t>(__s.count()), static_cast<long>(__ns.count()) }; ::nanosleep(&__ts, 0); #else __sleep_for(__s, __ns); #endif } /// sleep_until template<typename _Clock, typename _Duration> inline void sleep_until(const chrono::time_point<_Clock, _Duration>& __atime) { sleep_for(__atime - _Clock::now()); } _GLIBCXX_END_NAMESPACE_VERSION } // @} group threads } // namespace #endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1 #endif // C++11 #endif // _GLIBCXX_THREAD ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/cstdint�����������������������������������������������������������������������������������0000644�����������������00000004167�14763166030�0007176 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <cstdint> -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/cstdint * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_CSTDINT #define _GLIBCXX_CSTDINT 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <bits/c++config.h> #if _GLIBCXX_HAVE_STDINT_H # include <stdint.h> #endif #ifdef _GLIBCXX_USE_C99_STDINT_TR1 namespace std { using ::int8_t; using ::int16_t; using ::int32_t; using ::int64_t; using ::int_fast8_t; using ::int_fast16_t; using ::int_fast32_t; using ::int_fast64_t; using ::int_least8_t; using ::int_least16_t; using ::int_least32_t; using ::int_least64_t; using ::intmax_t; using ::intptr_t; using ::uint8_t; using ::uint16_t; using ::uint32_t; using ::uint64_t; using ::uint_fast8_t; using ::uint_fast16_t; using ::uint_fast32_t; using ::uint_fast64_t; using ::uint_least8_t; using ::uint_least16_t; using ::uint_least32_t; using ::uint_least64_t; using ::uintmax_t; using ::uintptr_t; } // namespace std #endif // _GLIBCXX_USE_C99_STDINT_TR1 #endif // C++11 #endif // _GLIBCXX_CSTDINT ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/new���������������������������������������������������������������������������������������0000644�����������������00000010130�14763166030�0006302 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// The -*- C++ -*- dynamic memory management header. // Copyright (C) 1994-2013 Free Software Foundation, Inc. // This file is part of GCC. // // GCC 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 3, or (at your option) // any later version. // // GCC 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. // // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file new * This is a Standard C++ Library header. * * The header @c new defines several functions to manage dynamic memory and * handling memory allocation errors; see * http://gcc.gnu.org/onlinedocs/libstdc++/18_support/howto.html#4 for more. */ #ifndef _NEW #define _NEW #pragma GCC system_header #include <bits/c++config.h> #include <exception> #pragma GCC visibility push(default) extern "C++" { namespace std { /** * @brief Exception possibly thrown by @c new. * @ingroup exceptions * * @c bad_alloc (or classes derived from it) is used to report allocation * errors from the throwing forms of @c new. */ class bad_alloc : public exception { public: bad_alloc() throw() { } // This declaration is not useless: // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 virtual ~bad_alloc() throw(); // See comment in eh_exception.cc. virtual const char* what() const throw(); }; struct nothrow_t { }; extern const nothrow_t nothrow; /** If you write your own error handler to be called by @c new, it must * be of this type. */ typedef void (*new_handler)(); /// Takes a replacement handler as the argument, returns the /// previous handler. new_handler set_new_handler(new_handler) throw(); } // namespace std //@{ /** These are replaceable signatures: * - normal single new and delete (no arguments, throw @c bad_alloc on error) * - normal array new and delete (same) * - @c nothrow single new and delete (take a @c nothrow argument, return * @c NULL on error) * - @c nothrow array new and delete (same) * * Placement new and delete signatures (take a memory address argument, * does nothing) may not be replaced by a user's program. */ void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) __attribute__((__externally_visible__)); void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) __attribute__((__externally_visible__)); void operator delete(void*) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); void operator delete[](void*) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); void operator delete(void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); void operator delete[](void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); // Default placement versions of operator new. inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT { return __p; } inline void* operator new[](std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT { return __p; } // Default placement versions of operator delete. inline void operator delete (void*, void*) _GLIBCXX_USE_NOEXCEPT { } inline void operator delete[](void*, void*) _GLIBCXX_USE_NOEXCEPT { } //@} } // extern "C++" #pragma GCC visibility pop #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/utility�����������������������������������������������������������������������������������0000644�����������������00000012344�14763166030�0007225 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <utility> -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file include/utility * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_UTILITY #define _GLIBCXX_UTILITY 1 #pragma GCC system_header /** * @defgroup utilities Utilities * * Components deemed generally useful. Includes pair, tuple, * forward/move helpers, ratio, function object, metaprogramming and * type traits, time, date, and memory functions. */ #include <bits/c++config.h> #include <bits/stl_relops.h> #include <bits/stl_pair.h> #if __cplusplus >= 201103L #include <bits/move.h> #include <initializer_list> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<class _Tp> class tuple_size; template<std::size_t _Int, class _Tp> class tuple_element; // Various functions which give std::pair a tuple-like interface. template<class _Tp1, class _Tp2> struct tuple_size<std::pair<_Tp1, _Tp2>> : public integral_constant<std::size_t, 2> { }; template<class _Tp1, class _Tp2> struct tuple_element<0, std::pair<_Tp1, _Tp2>> { typedef _Tp1 type; }; template<class _Tp1, class _Tp2> struct tuple_element<1, std::pair<_Tp1, _Tp2>> { typedef _Tp2 type; }; template<std::size_t _Int> struct __pair_get; template<> struct __pair_get<0> { template<typename _Tp1, typename _Tp2> static constexpr _Tp1& __get(std::pair<_Tp1, _Tp2>& __pair) noexcept { return __pair.first; } template<typename _Tp1, typename _Tp2> static constexpr _Tp1&& __move_get(std::pair<_Tp1, _Tp2>&& __pair) noexcept { return std::forward<_Tp1>(__pair.first); } template<typename _Tp1, typename _Tp2> static constexpr const _Tp1& __const_get(const std::pair<_Tp1, _Tp2>& __pair) noexcept { return __pair.first; } }; template<> struct __pair_get<1> { template<typename _Tp1, typename _Tp2> static constexpr _Tp2& __get(std::pair<_Tp1, _Tp2>& __pair) noexcept { return __pair.second; } template<typename _Tp1, typename _Tp2> static constexpr _Tp2&& __move_get(std::pair<_Tp1, _Tp2>&& __pair) noexcept { return std::forward<_Tp2>(__pair.second); } template<typename _Tp1, typename _Tp2> static constexpr const _Tp2& __const_get(const std::pair<_Tp1, _Tp2>& __pair) noexcept { return __pair.second; } }; template<std::size_t _Int, class _Tp1, class _Tp2> constexpr typename tuple_element<_Int, std::pair<_Tp1, _Tp2>>::type& get(std::pair<_Tp1, _Tp2>& __in) noexcept { return __pair_get<_Int>::__get(__in); } template<std::size_t _Int, class _Tp1, class _Tp2> constexpr typename tuple_element<_Int, std::pair<_Tp1, _Tp2>>::type&& get(std::pair<_Tp1, _Tp2>&& __in) noexcept { return __pair_get<_Int>::__move_get(std::move(__in)); } template<std::size_t _Int, class _Tp1, class _Tp2> constexpr const typename tuple_element<_Int, std::pair<_Tp1, _Tp2>>::type& get(const std::pair<_Tp1, _Tp2>& __in) noexcept { return __pair_get<_Int>::__const_get(__in); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif #endif /* _GLIBCXX_UTILITY */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ctime�������������������������������������������������������������������������������������0000644�����������������00000004115�14763166030�0006620 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- forwarding header. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/ctime * This is a Standard C++ Library file. You should @c \#include this file * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c time.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std (except for names which are defined * as macros in C). */ // // ISO C++ 14882: 20.5 Date and time // #pragma GCC system_header #include <bits/c++config.h> #include <time.h> #ifndef _GLIBCXX_CTIME #define _GLIBCXX_CTIME 1 // Get rid of those macros defined in <time.h> in lieu of real functions. #undef clock #undef difftime #undef mktime #undef time #undef asctime #undef ctime #undef gmtime #undef localtime #undef strftime namespace std { using ::clock_t; using ::time_t; using ::tm; using ::clock; using ::difftime; using ::mktime; using ::time; using ::asctime; using ::ctime; using ::gmtime; using ::localtime; using ::strftime; } // namespace #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/mutex�������������������������������������������������������������������������������������0000644�����������������00000047243�14763166030�0006672 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <mutex> -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/mutex * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_MUTEX #define _GLIBCXX_MUTEX 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <tuple> #include <chrono> #include <exception> #include <type_traits> #include <functional> #include <system_error> #include <bits/functexcept.h> #include <bits/gthr.h> #include <bits/move.h> // for std::swap #ifdef _GLIBCXX_USE_C99_STDINT_TR1 namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION #ifdef _GLIBCXX_HAS_GTHREADS // Common base class for std::mutex and std::timed_mutex class __mutex_base { protected: typedef __gthread_mutex_t __native_type; #ifdef __GTHREAD_MUTEX_INIT __native_type _M_mutex = __GTHREAD_MUTEX_INIT; constexpr __mutex_base() noexcept = default; #else __native_type _M_mutex; __mutex_base() noexcept { // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may) __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex); } ~__mutex_base() noexcept { __gthread_mutex_destroy(&_M_mutex); } #endif __mutex_base(const __mutex_base&) = delete; __mutex_base& operator=(const __mutex_base&) = delete; }; // Common base class for std::recursive_mutex and std::timed_recursive_mutex class __recursive_mutex_base { protected: typedef __gthread_recursive_mutex_t __native_type; __recursive_mutex_base(const __recursive_mutex_base&) = delete; __recursive_mutex_base& operator=(const __recursive_mutex_base&) = delete; #ifdef __GTHREAD_RECURSIVE_MUTEX_INIT __native_type _M_mutex = __GTHREAD_RECURSIVE_MUTEX_INIT; __recursive_mutex_base() = default; #else __native_type _M_mutex; __recursive_mutex_base() { // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may) __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex); } ~__recursive_mutex_base() { __gthread_recursive_mutex_destroy(&_M_mutex); } #endif }; /** * @defgroup mutexes Mutexes * @ingroup concurrency * * Classes for mutex support. * @{ */ /// mutex class mutex : private __mutex_base { public: typedef __native_type* native_handle_type; #ifdef __GTHREAD_MUTEX_INIT constexpr #endif mutex() noexcept = default; ~mutex() = default; mutex(const mutex&) = delete; mutex& operator=(const mutex&) = delete; void lock() { int __e = __gthread_mutex_lock(&_M_mutex); // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may) if (__e) __throw_system_error(__e); } bool try_lock() noexcept { // XXX EINVAL, EAGAIN, EBUSY return !__gthread_mutex_trylock(&_M_mutex); } void unlock() { // XXX EINVAL, EAGAIN, EPERM __gthread_mutex_unlock(&_M_mutex); } native_handle_type native_handle() { return &_M_mutex; } }; /// recursive_mutex class recursive_mutex : private __recursive_mutex_base { public: typedef __native_type* native_handle_type; recursive_mutex() = default; ~recursive_mutex() = default; recursive_mutex(const recursive_mutex&) = delete; recursive_mutex& operator=(const recursive_mutex&) = delete; void lock() { int __e = __gthread_recursive_mutex_lock(&_M_mutex); // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may) if (__e) __throw_system_error(__e); } bool try_lock() noexcept { // XXX EINVAL, EAGAIN, EBUSY return !__gthread_recursive_mutex_trylock(&_M_mutex); } void unlock() { // XXX EINVAL, EAGAIN, EBUSY __gthread_recursive_mutex_unlock(&_M_mutex); } native_handle_type native_handle() { return &_M_mutex; } }; #if _GTHREAD_USE_MUTEX_TIMEDLOCK /// timed_mutex class timed_mutex : private __mutex_base { #ifdef _GLIBCXX_USE_CLOCK_MONOTONIC typedef chrono::steady_clock __clock_t; #else typedef chrono::high_resolution_clock __clock_t; #endif public: typedef __native_type* native_handle_type; timed_mutex() = default; ~timed_mutex() = default; timed_mutex(const timed_mutex&) = delete; timed_mutex& operator=(const timed_mutex&) = delete; void lock() { int __e = __gthread_mutex_lock(&_M_mutex); // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may) if (__e) __throw_system_error(__e); } bool try_lock() noexcept { // XXX EINVAL, EAGAIN, EBUSY return !__gthread_mutex_trylock(&_M_mutex); } template <class _Rep, class _Period> bool try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) { return _M_try_lock_for(__rtime); } template <class _Clock, class _Duration> bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) { return _M_try_lock_until(__atime); } void unlock() { // XXX EINVAL, EAGAIN, EBUSY __gthread_mutex_unlock(&_M_mutex); } native_handle_type native_handle() { return &_M_mutex; } private: template<typename _Rep, typename _Period> bool _M_try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) { auto __rt = chrono::duration_cast<__clock_t::duration>(__rtime); if (ratio_greater<__clock_t::period, _Period>()) ++__rt; return _M_try_lock_until(__clock_t::now() + __rt); } template<typename _Duration> bool _M_try_lock_until(const chrono::time_point<__clock_t, _Duration>& __atime) { chrono::time_point<__clock_t, chrono::seconds> __s = chrono::time_point_cast<chrono::seconds>(__atime); chrono::nanoseconds __ns = chrono::duration_cast<chrono::nanoseconds>(__atime - __s); __gthread_time_t __ts = { static_cast<std::time_t>(__s.time_since_epoch().count()), static_cast<long>(__ns.count()) }; return !__gthread_mutex_timedlock(native_handle(), &__ts); } template<typename _Clock, typename _Duration> bool _M_try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) { return _M_try_lock_for(__atime - _Clock::now()); } }; /// recursive_timed_mutex class recursive_timed_mutex : private __recursive_mutex_base { #ifdef _GLIBCXX_USE_CLOCK_MONOTONIC typedef chrono::steady_clock __clock_t; #else typedef chrono::high_resolution_clock __clock_t; #endif public: typedef __native_type* native_handle_type; recursive_timed_mutex() = default; ~recursive_timed_mutex() = default; recursive_timed_mutex(const recursive_timed_mutex&) = delete; recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete; void lock() { int __e = __gthread_recursive_mutex_lock(&_M_mutex); // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may) if (__e) __throw_system_error(__e); } bool try_lock() noexcept { // XXX EINVAL, EAGAIN, EBUSY return !__gthread_recursive_mutex_trylock(&_M_mutex); } template <class _Rep, class _Period> bool try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) { return _M_try_lock_for(__rtime); } template <class _Clock, class _Duration> bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) { return _M_try_lock_until(__atime); } void unlock() { // XXX EINVAL, EAGAIN, EBUSY __gthread_recursive_mutex_unlock(&_M_mutex); } native_handle_type native_handle() { return &_M_mutex; } private: template<typename _Rep, typename _Period> bool _M_try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) { auto __rt = chrono::duration_cast<__clock_t::duration>(__rtime); if (ratio_greater<__clock_t::period, _Period>()) ++__rt; return _M_try_lock_until(__clock_t::now() + __rt); } template<typename _Duration> bool _M_try_lock_until(const chrono::time_point<__clock_t, _Duration>& __atime) { chrono::time_point<__clock_t, chrono::seconds> __s = chrono::time_point_cast<chrono::seconds>(__atime); chrono::nanoseconds __ns = chrono::duration_cast<chrono::nanoseconds>(__atime - __s); __gthread_time_t __ts = { static_cast<std::time_t>(__s.time_since_epoch().count()), static_cast<long>(__ns.count()) }; return !__gthread_mutex_timedlock(native_handle(), &__ts); } template<typename _Clock, typename _Duration> bool _M_try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) { return _M_try_lock_for(__atime - _Clock::now()); } }; #endif #endif // _GLIBCXX_HAS_GTHREADS /// Do not acquire ownership of the mutex. struct defer_lock_t { }; /// Try to acquire ownership of the mutex without blocking. struct try_to_lock_t { }; /// Assume the calling thread has already obtained mutex ownership /// and manage it. struct adopt_lock_t { }; constexpr defer_lock_t defer_lock { }; constexpr try_to_lock_t try_to_lock { }; constexpr adopt_lock_t adopt_lock { }; /// @brief Scoped lock idiom. // Acquire the mutex here with a constructor call, then release with // the destructor call in accordance with RAII style. template<typename _Mutex> class lock_guard { public: typedef _Mutex mutex_type; explicit lock_guard(mutex_type& __m) : _M_device(__m) { _M_device.lock(); } lock_guard(mutex_type& __m, adopt_lock_t) : _M_device(__m) { } // calling thread owns mutex ~lock_guard() { _M_device.unlock(); } lock_guard(const lock_guard&) = delete; lock_guard& operator=(const lock_guard&) = delete; private: mutex_type& _M_device; }; /// unique_lock template<typename _Mutex> class unique_lock { public: typedef _Mutex mutex_type; unique_lock() noexcept : _M_device(0), _M_owns(false) { } explicit unique_lock(mutex_type& __m) : _M_device(&__m), _M_owns(false) { lock(); _M_owns = true; } unique_lock(mutex_type& __m, defer_lock_t) noexcept : _M_device(&__m), _M_owns(false) { } unique_lock(mutex_type& __m, try_to_lock_t) : _M_device(&__m), _M_owns(_M_device->try_lock()) { } unique_lock(mutex_type& __m, adopt_lock_t) : _M_device(&__m), _M_owns(true) { // XXX calling thread owns mutex } template<typename _Clock, typename _Duration> unique_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __atime) : _M_device(&__m), _M_owns(_M_device->try_lock_until(__atime)) { } template<typename _Rep, typename _Period> unique_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __rtime) : _M_device(&__m), _M_owns(_M_device->try_lock_for(__rtime)) { } ~unique_lock() { if (_M_owns) unlock(); } unique_lock(const unique_lock&) = delete; unique_lock& operator=(const unique_lock&) = delete; unique_lock(unique_lock&& __u) noexcept : _M_device(__u._M_device), _M_owns(__u._M_owns) { __u._M_device = 0; __u._M_owns = false; } unique_lock& operator=(unique_lock&& __u) noexcept { if(_M_owns) unlock(); unique_lock(std::move(__u)).swap(*this); __u._M_device = 0; __u._M_owns = false; return *this; } void lock() { if (!_M_device) __throw_system_error(int(errc::operation_not_permitted)); else if (_M_owns) __throw_system_error(int(errc::resource_deadlock_would_occur)); else { _M_device->lock(); _M_owns = true; } } bool try_lock() { if (!_M_device) __throw_system_error(int(errc::operation_not_permitted)); else if (_M_owns) __throw_system_error(int(errc::resource_deadlock_would_occur)); else { _M_owns = _M_device->try_lock(); return _M_owns; } } template<typename _Clock, typename _Duration> bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) { if (!_M_device) __throw_system_error(int(errc::operation_not_permitted)); else if (_M_owns) __throw_system_error(int(errc::resource_deadlock_would_occur)); else { _M_owns = _M_device->try_lock_until(__atime); return _M_owns; } } template<typename _Rep, typename _Period> bool try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) { if (!_M_device) __throw_system_error(int(errc::operation_not_permitted)); else if (_M_owns) __throw_system_error(int(errc::resource_deadlock_would_occur)); else { _M_owns = _M_device->try_lock_for(__rtime); return _M_owns; } } void unlock() { if (!_M_owns) __throw_system_error(int(errc::operation_not_permitted)); else if (_M_device) { _M_device->unlock(); _M_owns = false; } } void swap(unique_lock& __u) noexcept { std::swap(_M_device, __u._M_device); std::swap(_M_owns, __u._M_owns); } mutex_type* release() noexcept { mutex_type* __ret = _M_device; _M_device = 0; _M_owns = false; return __ret; } bool owns_lock() const noexcept { return _M_owns; } explicit operator bool() const noexcept { return owns_lock(); } mutex_type* mutex() const noexcept { return _M_device; } private: mutex_type* _M_device; bool _M_owns; // XXX use atomic_bool }; /// Partial specialization for unique_lock objects. template<typename _Mutex> inline void swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) noexcept { __x.swap(__y); } template<int _Idx> struct __unlock_impl { template<typename... _Lock> static void __do_unlock(tuple<_Lock&...>& __locks) { std::get<_Idx>(__locks).unlock(); __unlock_impl<_Idx - 1>::__do_unlock(__locks); } }; template<> struct __unlock_impl<-1> { template<typename... _Lock> static void __do_unlock(tuple<_Lock&...>&) { } }; template<typename _Lock> unique_lock<_Lock> __try_to_lock(_Lock& __l) { return unique_lock<_Lock>(__l, try_to_lock); } template<int _Idx, bool _Continue = true> struct __try_lock_impl { template<typename... _Lock> static void __do_try_lock(tuple<_Lock&...>& __locks, int& __idx) { __idx = _Idx; auto __lock = __try_to_lock(std::get<_Idx>(__locks)); if (__lock.owns_lock()) { __try_lock_impl<_Idx + 1, _Idx + 2 < sizeof...(_Lock)>:: __do_try_lock(__locks, __idx); if (__idx == -1) __lock.release(); } } }; template<int _Idx> struct __try_lock_impl<_Idx, false> { template<typename... _Lock> static void __do_try_lock(tuple<_Lock&...>& __locks, int& __idx) { __idx = _Idx; auto __lock = __try_to_lock(std::get<_Idx>(__locks)); if (__lock.owns_lock()) { __idx = -1; __lock.release(); } } }; /** @brief Generic try_lock. * @param __l1 Meets Mutex requirements (try_lock() may throw). * @param __l2 Meets Mutex requirements (try_lock() may throw). * @param __l3 Meets Mutex requirements (try_lock() may throw). * @return Returns -1 if all try_lock() calls return true. Otherwise returns * a 0-based index corresponding to the argument that returned false. * @post Either all arguments are locked, or none will be. * * Sequentially calls try_lock() on each argument. */ template<typename _Lock1, typename _Lock2, typename... _Lock3> int try_lock(_Lock1& __l1, _Lock2& __l2, _Lock3&... __l3) { int __idx; auto __locks = std::tie(__l1, __l2, __l3...); __try { __try_lock_impl<0>::__do_try_lock(__locks, __idx); } __catch(...) { } return __idx; } /** @brief Generic lock. * @param __l1 Meets Mutex requirements (try_lock() may throw). * @param __l2 Meets Mutex requirements (try_lock() may throw). * @param __l3 Meets Mutex requirements (try_lock() may throw). * @throw An exception thrown by an argument's lock() or try_lock() member. * @post All arguments are locked. * * All arguments are locked via a sequence of calls to lock(), try_lock() * and unlock(). If the call exits via an exception any locks that were * obtained will be released. */ template<typename _L1, typename _L2, typename ..._L3> void lock(_L1& __l1, _L2& __l2, _L3&... __l3) { while (true) { unique_lock<_L1> __first(__l1); int __idx; auto __locks = std::tie(__l2, __l3...); __try_lock_impl<0, sizeof...(_L3)>::__do_try_lock(__locks, __idx); if (__idx == -1) { __first.release(); return; } } } #ifdef _GLIBCXX_HAS_GTHREADS /// once_flag struct once_flag { private: typedef __gthread_once_t __native_type; __native_type _M_once = __GTHREAD_ONCE_INIT; public: /// Constructor constexpr once_flag() noexcept = default; /// Deleted copy constructor once_flag(const once_flag&) = delete; /// Deleted assignment operator once_flag& operator=(const once_flag&) = delete; template<typename _Callable, typename... _Args> friend void call_once(once_flag& __once, _Callable&& __f, _Args&&... __args); }; #ifdef _GLIBCXX_HAVE_TLS extern __thread void* __once_callable; extern __thread void (*__once_call)(); template<typename _Callable> inline void __once_call_impl() { (*(_Callable*)__once_callable)(); } #else extern function<void()> __once_functor; extern void __set_once_functor_lock_ptr(unique_lock<mutex>*); extern mutex& __get_once_mutex(); #endif extern "C" void __once_proxy(void); /// call_once template<typename _Callable, typename... _Args> void call_once(once_flag& __once, _Callable&& __f, _Args&&... __args) { #ifdef _GLIBCXX_HAVE_TLS auto __bound_functor = std::__bind_simple(std::forward<_Callable>(__f), std::forward<_Args>(__args)...); __once_callable = &__bound_functor; __once_call = &__once_call_impl<decltype(__bound_functor)>; #else unique_lock<mutex> __functor_lock(__get_once_mutex()); auto __callable = std::__bind_simple(std::forward<_Callable>(__f), std::forward<_Args>(__args)...); __once_functor = [&]() { __callable(); }; __set_once_functor_lock_ptr(&__functor_lock); #endif int __e = __gthread_once(&(__once._M_once), &__once_proxy); #ifndef _GLIBCXX_HAVE_TLS if (__functor_lock) __set_once_functor_lock_ptr(0); #endif if (__e) __throw_system_error(__e); } #endif // _GLIBCXX_HAS_GTHREADS // @} group mutexes _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // _GLIBCXX_USE_C99_STDINT_TR1 #endif // C++11 #endif // _GLIBCXX_MUTEX �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/numeric�����������������������������������������������������������������������������������0000644�����������������00000005336�14763166030�0007167 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <numeric> -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file include/numeric * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_NUMERIC #define _GLIBCXX_NUMERIC 1 #pragma GCC system_header #include <bits/c++config.h> #include <bits/stl_iterator_base_types.h> #include <bits/stl_numeric.h> #ifdef _GLIBCXX_PARALLEL # include <parallel/numeric> #endif /** * @defgroup numerics Numerics * * Components for performing numeric operations. Includes support for * for complex number types, random number generation, numeric * (n-at-a-time) arrays, generalized numeric algorithms, and special * math functions. */ #endif /* _GLIBCXX_NUMERIC */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/fstream�����������������������������������������������������������������������������������0000644�����������������00000072502�14763166030�0007165 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File based streams -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/fstream * This is a Standard C++ Library header. */ // // ISO C++ 14882: 27.8 File-based streams // #ifndef _GLIBCXX_FSTREAM #define _GLIBCXX_FSTREAM 1 #pragma GCC system_header #include <istream> #include <ostream> #include <bits/codecvt.h> #include <cstdio> // For BUFSIZ #include <bits/basic_file.h> // For __basic_file, __c_lock #if __cplusplus >= 201103L #include <string> // For std::string overloads. #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // [27.8.1.1] template class basic_filebuf /** * @brief The actual work of input and output (for files). * @ingroup io * * @tparam _CharT Type of character stream. * @tparam _Traits Traits for character type, defaults to * char_traits<_CharT>. * * This class associates both its input and output sequence with an * external disk file, and maintains a joint file position for both * sequences. Many of its semantics are described in terms of similar * behavior in the Standard C Library's @c FILE streams. * * Requirements on traits_type, specific to this class: * - traits_type::pos_type must be fpos<traits_type::state_type> * - traits_type::off_type must be streamoff * - traits_type::state_type must be Assignable and DefaultConstructible, * - traits_type::state_type() must be the initial state for codecvt. */ template<typename _CharT, typename _Traits> class basic_filebuf : public basic_streambuf<_CharT, _Traits> { public: // Types: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; typedef basic_streambuf<char_type, traits_type> __streambuf_type; typedef basic_filebuf<char_type, traits_type> __filebuf_type; typedef __basic_file<char> __file_type; typedef typename traits_type::state_type __state_type; typedef codecvt<char_type, char, __state_type> __codecvt_type; friend class ios_base; // For sync_with_stdio. protected: // Data Members: // MT lock inherited from libio or other low-level io library. __c_lock _M_lock; // External buffer. __file_type _M_file; /// Place to stash in || out || in | out settings for current filebuf. ios_base::openmode _M_mode; // Beginning state type for codecvt. __state_type _M_state_beg; // During output, the state that corresponds to pptr(), // during input, the state that corresponds to egptr() and // _M_ext_next. __state_type _M_state_cur; // Not used for output. During input, the state that corresponds // to eback() and _M_ext_buf. __state_type _M_state_last; /// Pointer to the beginning of internal buffer. char_type* _M_buf; /** * Actual size of internal buffer. This number is equal to the size * of the put area + 1 position, reserved for the overflow char of * a full area. */ size_t _M_buf_size; // Set iff _M_buf is allocated memory from _M_allocate_internal_buffer. bool _M_buf_allocated; /** * _M_reading == false && _M_writing == false for @b uncommitted mode; * _M_reading == true for @b read mode; * _M_writing == true for @b write mode; * * NB: _M_reading == true && _M_writing == true is unused. */ bool _M_reading; bool _M_writing; //@{ /** * Necessary bits for putback buffer management. * * @note pbacks of over one character are not currently supported. */ char_type _M_pback; char_type* _M_pback_cur_save; char_type* _M_pback_end_save; bool _M_pback_init; //@} // Cached codecvt facet. const __codecvt_type* _M_codecvt; /** * Buffer for external characters. Used for input when * codecvt::always_noconv() == false. When valid, this corresponds * to eback(). */ char* _M_ext_buf; /** * Size of buffer held by _M_ext_buf. */ streamsize _M_ext_buf_size; /** * Pointers into the buffer held by _M_ext_buf that delimit a * subsequence of bytes that have been read but not yet converted. * When valid, _M_ext_next corresponds to egptr(). */ const char* _M_ext_next; char* _M_ext_end; /** * Initializes pback buffers, and moves normal buffers to safety. * Assumptions: * _M_in_cur has already been moved back */ void _M_create_pback() { if (!_M_pback_init) { _M_pback_cur_save = this->gptr(); _M_pback_end_save = this->egptr(); this->setg(&_M_pback, &_M_pback, &_M_pback + 1); _M_pback_init = true; } } /** * Deactivates pback buffer contents, and restores normal buffer. * Assumptions: * The pback buffer has only moved forward. */ void _M_destroy_pback() throw() { if (_M_pback_init) { // Length _M_in_cur moved in the pback buffer. _M_pback_cur_save += this->gptr() != this->eback(); this->setg(_M_buf, _M_pback_cur_save, _M_pback_end_save); _M_pback_init = false; } } public: // Constructors/destructor: /** * @brief Does not open any files. * * The default constructor initializes the parent class using its * own default ctor. */ basic_filebuf(); /** * @brief The destructor closes the file first. */ virtual ~basic_filebuf() { this->close(); } // Members: /** * @brief Returns true if the external file is open. */ bool is_open() const throw() { return _M_file.is_open(); } /** * @brief Opens an external file. * @param __s The name of the file. * @param __mode The open mode flags. * @return @c this on success, NULL on failure * * If a file is already open, this function immediately fails. * Otherwise it tries to open the file named @a __s using the flags * given in @a __mode. * * Table 92, adapted here, gives the relation between openmode * combinations and the equivalent fopen() flags. * (NB: lines app, in|out|app, in|app, binary|app, binary|in|out|app, * and binary|in|app per DR 596) * +---------------------------------------------------------+ * | ios_base Flag combination stdio equivalent | * |binary in out trunc app | * +---------------------------------------------------------+ * | + w | * | + + a | * | + a | * | + + w | * | + r | * | + + r+ | * | + + + w+ | * | + + + a+ | * | + + a+ | * +---------------------------------------------------------+ * | + + wb | * | + + + ab | * | + + ab | * | + + + wb | * | + + rb | * | + + + r+b | * | + + + + w+b | * | + + + + a+b | * | + + + a+b | * +---------------------------------------------------------+ */ __filebuf_type* open(const char* __s, ios_base::openmode __mode); #if __cplusplus >= 201103L /** * @brief Opens an external file. * @param __s The name of the file. * @param __mode The open mode flags. * @return @c this on success, NULL on failure */ __filebuf_type* open(const std::string& __s, ios_base::openmode __mode) { return open(__s.c_str(), __mode); } #endif /** * @brief Closes the currently associated file. * @return @c this on success, NULL on failure * * If no file is currently open, this function immediately fails. * * If a <em>put buffer area</em> exists, @c overflow(eof) is * called to flush all the characters. The file is then * closed. * * If any operations fail, this function also fails. */ __filebuf_type* close(); protected: void _M_allocate_internal_buffer(); void _M_destroy_internal_buffer() throw(); // [27.8.1.4] overridden virtual functions virtual streamsize showmanyc(); // Stroustrup, 1998, p. 628 // underflow() and uflow() functions are called to get the next // character from the real input source when the buffer is empty. // Buffered input uses underflow() virtual int_type underflow(); virtual int_type pbackfail(int_type __c = _Traits::eof()); // Stroustrup, 1998, p 648 // The overflow() function is called to transfer characters to the // real output destination when the buffer is full. A call to // overflow(c) outputs the contents of the buffer plus the // character c. // 27.5.2.4.5 // Consume some sequence of the characters in the pending sequence. virtual int_type overflow(int_type __c = _Traits::eof()); // Convert internal byte sequence to external, char-based // sequence via codecvt. bool _M_convert_to_external(char_type*, streamsize); /** * @brief Manipulates the buffer. * @param __s Pointer to a buffer area. * @param __n Size of @a __s. * @return @c this * * If no file has been opened, and both @a __s and @a __n are zero, then * the stream becomes unbuffered. Otherwise, @c __s is used as a * buffer; see * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html * for more. */ virtual __streambuf_type* setbuf(char_type* __s, streamsize __n); virtual pos_type seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode = ios_base::in | ios_base::out); virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode = ios_base::in | ios_base::out); // Common code for seekoff, seekpos, and overflow pos_type _M_seek(off_type __off, ios_base::seekdir __way, __state_type __state); int _M_get_ext_pos(__state_type &__state); virtual int sync(); virtual void imbue(const locale& __loc); virtual streamsize xsgetn(char_type* __s, streamsize __n); virtual streamsize xsputn(const char_type* __s, streamsize __n); // Flushes output buffer, then writes unshift sequence. bool _M_terminate_output(); /** * This function sets the pointers of the internal buffer, both get * and put areas. Typically: * * __off == egptr() - eback() upon underflow/uflow (@b read mode); * __off == 0 upon overflow (@b write mode); * __off == -1 upon open, setbuf, seekoff/pos (@b uncommitted mode). * * NB: epptr() - pbase() == _M_buf_size - 1, since _M_buf_size * reflects the actual allocated memory and the last cell is reserved * for the overflow char of a full put area. */ void _M_set_buffer(streamsize __off) { const bool __testin = _M_mode & ios_base::in; const bool __testout = _M_mode & ios_base::out; if (__testin && __off > 0) this->setg(_M_buf, _M_buf, _M_buf + __off); else this->setg(_M_buf, _M_buf, _M_buf); if (__testout && __off == 0 && _M_buf_size > 1 ) this->setp(_M_buf, _M_buf + _M_buf_size - 1); else this->setp(0, 0); } }; // [27.8.1.5] Template class basic_ifstream /** * @brief Controlling input for files. * @ingroup io * * @tparam _CharT Type of character stream. * @tparam _Traits Traits for character type, defaults to * char_traits<_CharT>. * * This class supports reading from named files, using the inherited * functions from std::basic_istream. To control the associated * sequence, an instance of std::basic_filebuf is used, which this page * refers to as @c sb. */ template<typename _CharT, typename _Traits> class basic_ifstream : public basic_istream<_CharT, _Traits> { public: // Types: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; // Non-standard types: typedef basic_filebuf<char_type, traits_type> __filebuf_type; typedef basic_istream<char_type, traits_type> __istream_type; private: __filebuf_type _M_filebuf; public: // Constructors/Destructors: /** * @brief Default constructor. * * Initializes @c sb using its default constructor, and passes * @c &sb to the base class initializer. Does not open any files * (you haven't given it a filename to open). */ basic_ifstream() : __istream_type(), _M_filebuf() { this->init(&_M_filebuf); } /** * @brief Create an input file stream. * @param __s Null terminated string specifying the filename. * @param __mode Open file in specified mode (see std::ios_base). * * @c ios_base::in is automatically included in @a __mode. * * Tip: When using std::string to hold the filename, you must use * .c_str() before passing it to this constructor. */ explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in) : __istream_type(), _M_filebuf() { this->init(&_M_filebuf); this->open(__s, __mode); } #if __cplusplus >= 201103L /** * @brief Create an input file stream. * @param __s std::string specifying the filename. * @param __mode Open file in specified mode (see std::ios_base). * * @c ios_base::in is automatically included in @a __mode. */ explicit basic_ifstream(const std::string& __s, ios_base::openmode __mode = ios_base::in) : __istream_type(), _M_filebuf() { this->init(&_M_filebuf); this->open(__s, __mode); } #endif /** * @brief The destructor does nothing. * * The file is closed by the filebuf object, not the formatting * stream. */ ~basic_ifstream() { } // Members: /** * @brief Accessing the underlying buffer. * @return The current basic_filebuf buffer. * * This hides both signatures of std::basic_ios::rdbuf(). */ __filebuf_type* rdbuf() const { return const_cast<__filebuf_type*>(&_M_filebuf); } /** * @brief Wrapper to test for an open file. * @return @c rdbuf()->is_open() */ bool is_open() { return _M_filebuf.is_open(); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 365. Lack of const-qualification in clause 27 bool is_open() const { return _M_filebuf.is_open(); } /** * @brief Opens an external file. * @param __s The name of the file. * @param __mode The open mode flags. * * Calls @c std::basic_filebuf::open(s,__mode|in). If that function * fails, @c failbit is set in the stream's error state. * * Tip: When using std::string to hold the filename, you must use * .c_str() before passing it to this constructor. */ void open(const char* __s, ios_base::openmode __mode = ios_base::in) { if (!_M_filebuf.open(__s, __mode | ios_base::in)) this->setstate(ios_base::failbit); else // _GLIBCXX_RESOLVE_LIB_DEFECTS // 409. Closing an fstream should clear error state this->clear(); } #if __cplusplus >= 201103L /** * @brief Opens an external file. * @param __s The name of the file. * @param __mode The open mode flags. * * Calls @c std::basic_filebuf::open(__s,__mode|in). If that function * fails, @c failbit is set in the stream's error state. */ void open(const std::string& __s, ios_base::openmode __mode = ios_base::in) { if (!_M_filebuf.open(__s, __mode | ios_base::in)) this->setstate(ios_base::failbit); else // _GLIBCXX_RESOLVE_LIB_DEFECTS // 409. Closing an fstream should clear error state this->clear(); } #endif /** * @brief Close the file. * * Calls @c std::basic_filebuf::close(). If that function * fails, @c failbit is set in the stream's error state. */ void close() { if (!_M_filebuf.close()) this->setstate(ios_base::failbit); } }; // [27.8.1.8] Template class basic_ofstream /** * @brief Controlling output for files. * @ingroup io * * @tparam _CharT Type of character stream. * @tparam _Traits Traits for character type, defaults to * char_traits<_CharT>. * * This class supports reading from named files, using the inherited * functions from std::basic_ostream. To control the associated * sequence, an instance of std::basic_filebuf is used, which this page * refers to as @c sb. */ template<typename _CharT, typename _Traits> class basic_ofstream : public basic_ostream<_CharT,_Traits> { public: // Types: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; // Non-standard types: typedef basic_filebuf<char_type, traits_type> __filebuf_type; typedef basic_ostream<char_type, traits_type> __ostream_type; private: __filebuf_type _M_filebuf; public: // Constructors: /** * @brief Default constructor. * * Initializes @c sb using its default constructor, and passes * @c &sb to the base class initializer. Does not open any files * (you haven't given it a filename to open). */ basic_ofstream(): __ostream_type(), _M_filebuf() { this->init(&_M_filebuf); } /** * @brief Create an output file stream. * @param __s Null terminated string specifying the filename. * @param __mode Open file in specified mode (see std::ios_base). * * @c ios_base::out | @c ios_base::trunc is automatically included in * @a __mode. * * Tip: When using std::string to hold the filename, you must use * .c_str() before passing it to this constructor. */ explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out|ios_base::trunc) : __ostream_type(), _M_filebuf() { this->init(&_M_filebuf); this->open(__s, __mode); } #if __cplusplus >= 201103L /** * @brief Create an output file stream. * @param __s std::string specifying the filename. * @param __mode Open file in specified mode (see std::ios_base). * * @c ios_base::out | @c ios_base::trunc is automatically included in * @a __mode. */ explicit basic_ofstream(const std::string& __s, ios_base::openmode __mode = ios_base::out|ios_base::trunc) : __ostream_type(), _M_filebuf() { this->init(&_M_filebuf); this->open(__s, __mode); } #endif /** * @brief The destructor does nothing. * * The file is closed by the filebuf object, not the formatting * stream. */ ~basic_ofstream() { } // Members: /** * @brief Accessing the underlying buffer. * @return The current basic_filebuf buffer. * * This hides both signatures of std::basic_ios::rdbuf(). */ __filebuf_type* rdbuf() const { return const_cast<__filebuf_type*>(&_M_filebuf); } /** * @brief Wrapper to test for an open file. * @return @c rdbuf()->is_open() */ bool is_open() { return _M_filebuf.is_open(); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 365. Lack of const-qualification in clause 27 bool is_open() const { return _M_filebuf.is_open(); } /** * @brief Opens an external file. * @param __s The name of the file. * @param __mode The open mode flags. * * Calls @c std::basic_filebuf::open(__s,__mode|out|trunc). If that * function fails, @c failbit is set in the stream's error state. * * Tip: When using std::string to hold the filename, you must use * .c_str() before passing it to this constructor. */ void open(const char* __s, ios_base::openmode __mode = ios_base::out | ios_base::trunc) { if (!_M_filebuf.open(__s, __mode | ios_base::out)) this->setstate(ios_base::failbit); else // _GLIBCXX_RESOLVE_LIB_DEFECTS // 409. Closing an fstream should clear error state this->clear(); } #if __cplusplus >= 201103L /** * @brief Opens an external file. * @param __s The name of the file. * @param __mode The open mode flags. * * Calls @c std::basic_filebuf::open(s,mode|out|trunc). If that * function fails, @c failbit is set in the stream's error state. */ void open(const std::string& __s, ios_base::openmode __mode = ios_base::out | ios_base::trunc) { if (!_M_filebuf.open(__s, __mode | ios_base::out)) this->setstate(ios_base::failbit); else // _GLIBCXX_RESOLVE_LIB_DEFECTS // 409. Closing an fstream should clear error state this->clear(); } #endif /** * @brief Close the file. * * Calls @c std::basic_filebuf::close(). If that function * fails, @c failbit is set in the stream's error state. */ void close() { if (!_M_filebuf.close()) this->setstate(ios_base::failbit); } }; // [27.8.1.11] Template class basic_fstream /** * @brief Controlling input and output for files. * @ingroup io * * @tparam _CharT Type of character stream. * @tparam _Traits Traits for character type, defaults to * char_traits<_CharT>. * * This class supports reading from and writing to named files, using * the inherited functions from std::basic_iostream. To control the * associated sequence, an instance of std::basic_filebuf is used, which * this page refers to as @c sb. */ template<typename _CharT, typename _Traits> class basic_fstream : public basic_iostream<_CharT, _Traits> { public: // Types: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; // Non-standard types: typedef basic_filebuf<char_type, traits_type> __filebuf_type; typedef basic_ios<char_type, traits_type> __ios_type; typedef basic_iostream<char_type, traits_type> __iostream_type; private: __filebuf_type _M_filebuf; public: // Constructors/destructor: /** * @brief Default constructor. * * Initializes @c sb using its default constructor, and passes * @c &sb to the base class initializer. Does not open any files * (you haven't given it a filename to open). */ basic_fstream() : __iostream_type(), _M_filebuf() { this->init(&_M_filebuf); } /** * @brief Create an input/output file stream. * @param __s Null terminated string specifying the filename. * @param __mode Open file in specified mode (see std::ios_base). * * Tip: When using std::string to hold the filename, you must use * .c_str() before passing it to this constructor. */ explicit basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out) : __iostream_type(0), _M_filebuf() { this->init(&_M_filebuf); this->open(__s, __mode); } #if __cplusplus >= 201103L /** * @brief Create an input/output file stream. * @param __s Null terminated string specifying the filename. * @param __mode Open file in specified mode (see std::ios_base). */ explicit basic_fstream(const std::string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out) : __iostream_type(0), _M_filebuf() { this->init(&_M_filebuf); this->open(__s, __mode); } #endif /** * @brief The destructor does nothing. * * The file is closed by the filebuf object, not the formatting * stream. */ ~basic_fstream() { } // Members: /** * @brief Accessing the underlying buffer. * @return The current basic_filebuf buffer. * * This hides both signatures of std::basic_ios::rdbuf(). */ __filebuf_type* rdbuf() const { return const_cast<__filebuf_type*>(&_M_filebuf); } /** * @brief Wrapper to test for an open file. * @return @c rdbuf()->is_open() */ bool is_open() { return _M_filebuf.is_open(); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 365. Lack of const-qualification in clause 27 bool is_open() const { return _M_filebuf.is_open(); } /** * @brief Opens an external file. * @param __s The name of the file. * @param __mode The open mode flags. * * Calls @c std::basic_filebuf::open(__s,__mode). If that * function fails, @c failbit is set in the stream's error state. * * Tip: When using std::string to hold the filename, you must use * .c_str() before passing it to this constructor. */ void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out) { if (!_M_filebuf.open(__s, __mode)) this->setstate(ios_base::failbit); else // _GLIBCXX_RESOLVE_LIB_DEFECTS // 409. Closing an fstream should clear error state this->clear(); } #if __cplusplus >= 201103L /** * @brief Opens an external file. * @param __s The name of the file. * @param __mode The open mode flags. * * Calls @c std::basic_filebuf::open(__s,__mode). If that * function fails, @c failbit is set in the stream's error state. */ void open(const std::string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out) { if (!_M_filebuf.open(__s, __mode)) this->setstate(ios_base::failbit); else // _GLIBCXX_RESOLVE_LIB_DEFECTS // 409. Closing an fstream should clear error state this->clear(); } #endif /** * @brief Close the file. * * Calls @c std::basic_filebuf::close(). If that function * fails, @c failbit is set in the stream's error state. */ void close() { if (!_M_filebuf.close()) this->setstate(ios_base::failbit); } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #include <bits/fstream.tcc> #endif /* _GLIBCXX_FSTREAM */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/iomanip�����������������������������������������������������������������������������������0000644�����������������00000026327�14763166030�0007164 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Standard stream manipulators -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/iomanip * This is a Standard C++ Library header. */ // // ISO C++ 14882: 27.6.3 Standard manipulators // #ifndef _GLIBCXX_IOMANIP #define _GLIBCXX_IOMANIP 1 #pragma GCC system_header #include <bits/c++config.h> #include <iosfwd> #include <bits/ios_base.h> #if __cplusplus >= 201103L #include <locale> #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // [27.6.3] standard manipulators // Also see DR 183. struct _Resetiosflags { ios_base::fmtflags _M_mask; }; /** * @brief Manipulator for @c setf. * @param __mask A format flags mask. * * Sent to a stream object, this manipulator resets the specified flags, * via @e stream.setf(0,__mask). */ inline _Resetiosflags resetiosflags(ios_base::fmtflags __mask) { return { __mask }; } template<typename _CharT, typename _Traits> inline basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f) { __is.setf(ios_base::fmtflags(0), __f._M_mask); return __is; } template<typename _CharT, typename _Traits> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, _Resetiosflags __f) { __os.setf(ios_base::fmtflags(0), __f._M_mask); return __os; } struct _Setiosflags { ios_base::fmtflags _M_mask; }; /** * @brief Manipulator for @c setf. * @param __mask A format flags mask. * * Sent to a stream object, this manipulator sets the format flags * to @a __mask. */ inline _Setiosflags setiosflags(ios_base::fmtflags __mask) { return { __mask }; } template<typename _CharT, typename _Traits> inline basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f) { __is.setf(__f._M_mask); return __is; } template<typename _CharT, typename _Traits> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, _Setiosflags __f) { __os.setf(__f._M_mask); return __os; } struct _Setbase { int _M_base; }; /** * @brief Manipulator for @c setf. * @param __base A numeric base. * * Sent to a stream object, this manipulator changes the * @c ios_base::basefield flags to @c oct, @c dec, or @c hex when @a base * is 8, 10, or 16, accordingly, and to 0 if @a __base is any other value. */ inline _Setbase setbase(int __base) { return { __base }; } template<typename _CharT, typename _Traits> inline basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f) { __is.setf(__f._M_base == 8 ? ios_base::oct : __f._M_base == 10 ? ios_base::dec : __f._M_base == 16 ? ios_base::hex : ios_base::fmtflags(0), ios_base::basefield); return __is; } template<typename _CharT, typename _Traits> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, _Setbase __f) { __os.setf(__f._M_base == 8 ? ios_base::oct : __f._M_base == 10 ? ios_base::dec : __f._M_base == 16 ? ios_base::hex : ios_base::fmtflags(0), ios_base::basefield); return __os; } template<typename _CharT> struct _Setfill { _CharT _M_c; }; /** * @brief Manipulator for @c fill. * @param __c The new fill character. * * Sent to a stream object, this manipulator calls @c fill(__c) for that * object. */ template<typename _CharT> inline _Setfill<_CharT> setfill(_CharT __c) { return { __c }; } template<typename _CharT, typename _Traits> inline basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f) { __is.fill(__f._M_c); return __is; } template<typename _CharT, typename _Traits> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, _Setfill<_CharT> __f) { __os.fill(__f._M_c); return __os; } struct _Setprecision { int _M_n; }; /** * @brief Manipulator for @c precision. * @param __n The new precision. * * Sent to a stream object, this manipulator calls @c precision(__n) for * that object. */ inline _Setprecision setprecision(int __n) { return { __n }; } template<typename _CharT, typename _Traits> inline basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, _Setprecision __f) { __is.precision(__f._M_n); return __is; } template<typename _CharT, typename _Traits> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, _Setprecision __f) { __os.precision(__f._M_n); return __os; } struct _Setw { int _M_n; }; /** * @brief Manipulator for @c width. * @param __n The new width. * * Sent to a stream object, this manipulator calls @c width(__n) for * that object. */ inline _Setw setw(int __n) { return { __n }; } template<typename _CharT, typename _Traits> inline basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, _Setw __f) { __is.width(__f._M_n); return __is; } template<typename _CharT, typename _Traits> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, _Setw __f) { __os.width(__f._M_n); return __os; } #if __cplusplus >= 201103L template<typename _MoneyT> struct _Get_money { _MoneyT& _M_mon; bool _M_intl; }; /** * @brief Extended manipulator for extracting money. * @param __mon Either long double or a specialization of @c basic_string. * @param __intl A bool indicating whether international format * is to be used. * * Sent to a stream object, this manipulator extracts @a __mon. */ template<typename _MoneyT> inline _Get_money<_MoneyT> get_money(_MoneyT& __mon, bool __intl = false) { return { __mon, __intl }; } template<typename _CharT, typename _Traits, typename _MoneyT> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, _Get_money<_MoneyT> __f) { typename basic_istream<_CharT, _Traits>::sentry __cerb(__is, false); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; __try { typedef istreambuf_iterator<_CharT, _Traits> _Iter; typedef money_get<_CharT, _Iter> _MoneyGet; const _MoneyGet& __mg = use_facet<_MoneyGet>(__is.getloc()); __mg.get(_Iter(__is.rdbuf()), _Iter(), __f._M_intl, __is, __err, __f._M_mon); } __catch(__cxxabiv1::__forced_unwind&) { __is._M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { __is._M_setstate(ios_base::badbit); } if (__err) __is.setstate(__err); } return __is; } template<typename _MoneyT> struct _Put_money { const _MoneyT& _M_mon; bool _M_intl; }; /** * @brief Extended manipulator for inserting money. * @param __mon Either long double or a specialization of @c basic_string. * @param __intl A bool indicating whether international format * is to be used. * * Sent to a stream object, this manipulator inserts @a __mon. */ template<typename _MoneyT> inline _Put_money<_MoneyT> put_money(const _MoneyT& __mon, bool __intl = false) { return { __mon, __intl }; } template<typename _CharT, typename _Traits, typename _MoneyT> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, _Put_money<_MoneyT> __f) { typename basic_ostream<_CharT, _Traits>::sentry __cerb(__os); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; __try { typedef ostreambuf_iterator<_CharT, _Traits> _Iter; typedef money_put<_CharT, _Iter> _MoneyPut; const _MoneyPut& __mp = use_facet<_MoneyPut>(__os.getloc()); if (__mp.put(_Iter(__os.rdbuf()), __f._M_intl, __os, __os.fill(), __f._M_mon).failed()) __err |= ios_base::badbit; } __catch(__cxxabiv1::__forced_unwind&) { __os._M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { __os._M_setstate(ios_base::badbit); } if (__err) __os.setstate(__err); } return __os; } #endif // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. // NB: This syntax is a GNU extension. #if _GLIBCXX_EXTERN_TEMPLATE extern template ostream& operator<<(ostream&, _Setfill<char>); extern template ostream& operator<<(ostream&, _Setiosflags); extern template ostream& operator<<(ostream&, _Resetiosflags); extern template ostream& operator<<(ostream&, _Setbase); extern template ostream& operator<<(ostream&, _Setprecision); extern template ostream& operator<<(ostream&, _Setw); extern template istream& operator>>(istream&, _Setfill<char>); extern template istream& operator>>(istream&, _Setiosflags); extern template istream& operator>>(istream&, _Resetiosflags); extern template istream& operator>>(istream&, _Setbase); extern template istream& operator>>(istream&, _Setprecision); extern template istream& operator>>(istream&, _Setw); #ifdef _GLIBCXX_USE_WCHAR_T extern template wostream& operator<<(wostream&, _Setfill<wchar_t>); extern template wostream& operator<<(wostream&, _Setiosflags); extern template wostream& operator<<(wostream&, _Resetiosflags); extern template wostream& operator<<(wostream&, _Setbase); extern template wostream& operator<<(wostream&, _Setprecision); extern template wostream& operator<<(wostream&, _Setw); extern template wistream& operator>>(wistream&, _Setfill<wchar_t>); extern template wistream& operator>>(wistream&, _Setiosflags); extern template wistream& operator>>(wistream&, _Resetiosflags); extern template wistream& operator>>(wistream&, _Setbase); extern template wistream& operator>>(wistream&, _Setprecision); extern template wistream& operator>>(wistream&, _Setw); #endif #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _GLIBCXX_IOMANIP */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ratio�������������������������������������������������������������������������������������0000644�����������������00000045306�14763166030�0006644 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// ratio -*- C++ -*- // Copyright (C) 2008-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/ratio * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_RATIO #define _GLIBCXX_RATIO 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <type_traits> #include <cstdint> #ifdef _GLIBCXX_USE_C99_STDINT_TR1 namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup ratio Rational Arithmetic * @ingroup utilities * * Compile time representation of finite rational numbers. * @{ */ template<intmax_t _Pn> struct __static_sign : integral_constant<intmax_t, (_Pn < 0) ? -1 : 1> { }; template<intmax_t _Pn> struct __static_abs : integral_constant<intmax_t, _Pn * __static_sign<_Pn>::value> { }; template<intmax_t _Pn, intmax_t _Qn> struct __static_gcd : __static_gcd<_Qn, (_Pn % _Qn)> { }; template<intmax_t _Pn> struct __static_gcd<_Pn, 0> : integral_constant<intmax_t, __static_abs<_Pn>::value> { }; template<intmax_t _Qn> struct __static_gcd<0, _Qn> : integral_constant<intmax_t, __static_abs<_Qn>::value> { }; // Let c = 2^(half # of bits in an intmax_t) // then we find a1, a0, b1, b0 s.t. N = a1*c + a0, M = b1*c + b0 // The multiplication of N and M becomes, // N * M = (a1 * b1)c^2 + (a0 * b1 + b0 * a1)c + a0 * b0 // Multiplication is safe if each term and the sum of the terms // is representable by intmax_t. template<intmax_t _Pn, intmax_t _Qn> struct __safe_multiply { private: static const uintmax_t __c = uintmax_t(1) << (sizeof(intmax_t) * 4); static const uintmax_t __a0 = __static_abs<_Pn>::value % __c; static const uintmax_t __a1 = __static_abs<_Pn>::value / __c; static const uintmax_t __b0 = __static_abs<_Qn>::value % __c; static const uintmax_t __b1 = __static_abs<_Qn>::value / __c; static_assert(__a1 == 0 || __b1 == 0, "overflow in multiplication"); static_assert(__a0 * __b1 + __b0 * __a1 < (__c >> 1), "overflow in multiplication"); static_assert(__b0 * __a0 <= __INTMAX_MAX__, "overflow in multiplication"); static_assert((__a0 * __b1 + __b0 * __a1) * __c <= __INTMAX_MAX__ - __b0 * __a0, "overflow in multiplication"); public: static const intmax_t value = _Pn * _Qn; }; // Some double-precision utilities, where numbers are represented as // __hi*2^(8*sizeof(uintmax_t)) + __lo. template<uintmax_t __hi1, uintmax_t __lo1, uintmax_t __hi2, uintmax_t __lo2> struct __big_less : integral_constant<bool, (__hi1 < __hi2 || (__hi1 == __hi2 && __lo1 < __lo2))> { }; template<uintmax_t __hi1, uintmax_t __lo1, uintmax_t __hi2, uintmax_t __lo2> struct __big_add { static constexpr uintmax_t __lo = __lo1 + __lo2; static constexpr uintmax_t __hi = (__hi1 + __hi2 + (__lo1 + __lo2 < __lo1)); // carry }; // Subtract a number from a bigger one. template<uintmax_t __hi1, uintmax_t __lo1, uintmax_t __hi2, uintmax_t __lo2> struct __big_sub { static_assert(!__big_less<__hi1, __lo1, __hi2, __lo2>::value, "Internal library error"); static constexpr uintmax_t __lo = __lo1 - __lo2; static constexpr uintmax_t __hi = (__hi1 - __hi2 - (__lo1 < __lo2)); // carry }; // Same principle as __safe_multiply. template<uintmax_t __x, uintmax_t __y> struct __big_mul { private: static constexpr uintmax_t __c = uintmax_t(1) << (sizeof(intmax_t) * 4); static constexpr uintmax_t __x0 = __x % __c; static constexpr uintmax_t __x1 = __x / __c; static constexpr uintmax_t __y0 = __y % __c; static constexpr uintmax_t __y1 = __y / __c; static constexpr uintmax_t __x0y0 = __x0 * __y0; static constexpr uintmax_t __x0y1 = __x0 * __y1; static constexpr uintmax_t __x1y0 = __x1 * __y0; static constexpr uintmax_t __x1y1 = __x1 * __y1; static constexpr uintmax_t __mix = __x0y1 + __x1y0; // possible carry... static constexpr uintmax_t __mix_lo = __mix * __c; static constexpr uintmax_t __mix_hi = __mix / __c + ((__mix < __x0y1) ? __c : 0); // ... added here typedef __big_add<__mix_hi, __mix_lo, __x1y1, __x0y0> _Res; public: static constexpr uintmax_t __hi = _Res::__hi; static constexpr uintmax_t __lo = _Res::__lo; }; // Adapted from __udiv_qrnnd_c in longlong.h // This version assumes that the high bit of __d is 1. template<uintmax_t __n1, uintmax_t __n0, uintmax_t __d> struct __big_div_impl { private: static_assert(__d >= (uintmax_t(1) << (sizeof(intmax_t) * 8 - 1)), "Internal library error"); static_assert(__n1 < __d, "Internal library error"); static constexpr uintmax_t __c = uintmax_t(1) << (sizeof(intmax_t) * 4); static constexpr uintmax_t __d1 = __d / __c; static constexpr uintmax_t __d0 = __d % __c; static constexpr uintmax_t __q1x = __n1 / __d1; static constexpr uintmax_t __r1x = __n1 % __d1; static constexpr uintmax_t __m = __q1x * __d0; static constexpr uintmax_t __r1y = __r1x * __c + __n0 / __c; static constexpr uintmax_t __r1z = __r1y + __d; static constexpr uintmax_t __r1 = ((__r1y < __m) ? ((__r1z >= __d) && (__r1z < __m)) ? (__r1z + __d) : __r1z : __r1y) - __m; static constexpr uintmax_t __q1 = __q1x - ((__r1y < __m) ? ((__r1z >= __d) && (__r1z < __m)) ? 2 : 1 : 0); static constexpr uintmax_t __q0x = __r1 / __d1; static constexpr uintmax_t __r0x = __r1 % __d1; static constexpr uintmax_t __n = __q0x * __d0; static constexpr uintmax_t __r0y = __r0x * __c + __n0 % __c; static constexpr uintmax_t __r0z = __r0y + __d; static constexpr uintmax_t __r0 = ((__r0y < __n) ? ((__r0z >= __d) && (__r0z < __n)) ? (__r0z + __d) : __r0z : __r0y) - __n; static constexpr uintmax_t __q0 = __q0x - ((__r0y < __n) ? ((__r0z >= __d) && (__r0z < __n)) ? 2 : 1 : 0); public: static constexpr uintmax_t __quot = __q1 * __c + __q0; static constexpr uintmax_t __rem = __r0; private: typedef __big_mul<__quot, __d> _Prod; typedef __big_add<_Prod::__hi, _Prod::__lo, 0, __rem> _Sum; static_assert(_Sum::__hi == __n1 && _Sum::__lo == __n0, "Internal library error"); }; template<uintmax_t __n1, uintmax_t __n0, uintmax_t __d> struct __big_div { private: static_assert(__d != 0, "Internal library error"); static_assert(sizeof (uintmax_t) == sizeof (unsigned long long), "This library calls __builtin_clzll on uintmax_t, which " "is unsafe on your platform. Please complain to " "http://gcc.gnu.org/bugzilla/"); static constexpr int __shift = __builtin_clzll(__d); static constexpr int __coshift_ = sizeof(uintmax_t) * 8 - __shift; static constexpr int __coshift = (__shift != 0) ? __coshift_ : 0; static constexpr uintmax_t __c1 = uintmax_t(1) << __shift; static constexpr uintmax_t __c2 = uintmax_t(1) << __coshift; static constexpr uintmax_t __new_d = __d * __c1; static constexpr uintmax_t __new_n0 = __n0 * __c1; static constexpr uintmax_t __n1_shifted = (__n1 % __d) * __c1; static constexpr uintmax_t __n0_top = (__shift != 0) ? (__n0 / __c2) : 0; static constexpr uintmax_t __new_n1 = __n1_shifted + __n0_top; typedef __big_div_impl<__new_n1, __new_n0, __new_d> _Res; public: static constexpr uintmax_t __quot_hi = __n1 / __d; static constexpr uintmax_t __quot_lo = _Res::__quot; static constexpr uintmax_t __rem = _Res::__rem / __c1; private: typedef __big_mul<__quot_lo, __d> _P0; typedef __big_mul<__quot_hi, __d> _P1; typedef __big_add<_P0::__hi, _P0::__lo, _P1::__lo, __rem> _Sum; // No overflow. static_assert(_P1::__hi == 0, "Internal library error"); static_assert(_Sum::__hi >= _P0::__hi, "Internal library error"); // Matches the input data. static_assert(_Sum::__hi == __n1 && _Sum::__lo == __n0, "Internal library error"); static_assert(__rem < __d, "Internal library error"); }; /** * @brief Provides compile-time rational arithmetic. * * This class template represents any finite rational number with a * numerator and denominator representable by compile-time constants of * type intmax_t. The ratio is simplified when instantiated. * * For example: * @code * std::ratio<7,-21>::num == -1; * std::ratio<7,-21>::den == 3; * @endcode * */ template<intmax_t _Num, intmax_t _Den = 1> struct ratio { static_assert(_Den != 0, "denominator cannot be zero"); static_assert(_Num >= -__INTMAX_MAX__ && _Den >= -__INTMAX_MAX__, "out of range"); // Note: sign(N) * abs(N) == N static constexpr intmax_t num = _Num * __static_sign<_Den>::value / __static_gcd<_Num, _Den>::value; static constexpr intmax_t den = __static_abs<_Den>::value / __static_gcd<_Num, _Den>::value; typedef ratio<num, den> type; }; template<intmax_t _Num, intmax_t _Den> constexpr intmax_t ratio<_Num, _Den>::num; template<intmax_t _Num, intmax_t _Den> constexpr intmax_t ratio<_Num, _Den>::den; template<typename _R1, typename _R2> struct __ratio_multiply { private: static const intmax_t __gcd1 = __static_gcd<_R1::num, _R2::den>::value; static const intmax_t __gcd2 = __static_gcd<_R2::num, _R1::den>::value; public: typedef ratio< __safe_multiply<(_R1::num / __gcd1), (_R2::num / __gcd2)>::value, __safe_multiply<(_R1::den / __gcd2), (_R2::den / __gcd1)>::value> type; static constexpr intmax_t num = type::num; static constexpr intmax_t den = type::den; }; template<typename _R1, typename _R2> constexpr intmax_t __ratio_multiply<_R1, _R2>::num; template<typename _R1, typename _R2> constexpr intmax_t __ratio_multiply<_R1, _R2>::den; /// ratio_multiply template<typename _R1, typename _R2> using ratio_multiply = typename __ratio_multiply<_R1, _R2>::type; template<typename _R1, typename _R2> struct __ratio_divide { static_assert(_R2::num != 0, "division by 0"); typedef typename __ratio_multiply< _R1, ratio<_R2::den, _R2::num>>::type type; static constexpr intmax_t num = type::num; static constexpr intmax_t den = type::den; }; template<typename _R1, typename _R2> constexpr intmax_t __ratio_divide<_R1, _R2>::num; template<typename _R1, typename _R2> constexpr intmax_t __ratio_divide<_R1, _R2>::den; /// ratio_divide template<typename _R1, typename _R2> using ratio_divide = typename __ratio_divide<_R1, _R2>::type; /// ratio_equal template<typename _R1, typename _R2> struct ratio_equal : integral_constant<bool, _R1::num == _R2::num && _R1::den == _R2::den> { }; /// ratio_not_equal template<typename _R1, typename _R2> struct ratio_not_equal : integral_constant<bool, !ratio_equal<_R1, _R2>::value> { }; // Both numbers are positive. template<typename _R1, typename _R2, typename _Left = __big_mul<_R1::num,_R2::den>, typename _Right = __big_mul<_R2::num,_R1::den> > struct __ratio_less_impl_1 : integral_constant<bool, __big_less<_Left::__hi, _Left::__lo, _Right::__hi, _Right::__lo>::value> { }; template<typename _R1, typename _R2, bool = (_R1::num == 0 || _R2::num == 0 || (__static_sign<_R1::num>::value != __static_sign<_R2::num>::value)), bool = (__static_sign<_R1::num>::value == -1 && __static_sign<_R2::num>::value == -1)> struct __ratio_less_impl : __ratio_less_impl_1<_R1, _R2>::type { }; template<typename _R1, typename _R2> struct __ratio_less_impl<_R1, _R2, true, false> : integral_constant<bool, _R1::num < _R2::num> { }; template<typename _R1, typename _R2> struct __ratio_less_impl<_R1, _R2, false, true> : __ratio_less_impl_1<ratio<-_R2::num, _R2::den>, ratio<-_R1::num, _R1::den> >::type { }; /// ratio_less template<typename _R1, typename _R2> struct ratio_less : __ratio_less_impl<_R1, _R2>::type { }; /// ratio_less_equal template<typename _R1, typename _R2> struct ratio_less_equal : integral_constant<bool, !ratio_less<_R2, _R1>::value> { }; /// ratio_greater template<typename _R1, typename _R2> struct ratio_greater : integral_constant<bool, ratio_less<_R2, _R1>::value> { }; /// ratio_greater_equal template<typename _R1, typename _R2> struct ratio_greater_equal : integral_constant<bool, !ratio_less<_R1, _R2>::value> { }; template<typename _R1, typename _R2, bool = (_R1::num >= 0), bool = (_R2::num >= 0), bool = ratio_less<ratio<__static_abs<_R1::num>::value, _R1::den>, ratio<__static_abs<_R2::num>::value, _R2::den> >::value> struct __ratio_add_impl { private: typedef typename __ratio_add_impl< ratio<-_R1::num, _R1::den>, ratio<-_R2::num, _R2::den> >::type __t; public: typedef ratio<-__t::num, __t::den> type; }; // True addition of nonnegative numbers. template<typename _R1, typename _R2, bool __b> struct __ratio_add_impl<_R1, _R2, true, true, __b> { private: static constexpr uintmax_t __g = __static_gcd<_R1::den, _R2::den>::value; static constexpr uintmax_t __d2 = _R2::den / __g; typedef __big_mul<_R1::den, __d2> __d; typedef __big_mul<_R1::num, _R2::den / __g> __x; typedef __big_mul<_R2::num, _R1::den / __g> __y; typedef __big_add<__x::__hi, __x::__lo, __y::__hi, __y::__lo> __n; static_assert(__n::__hi >= __x::__hi, "Internal library error"); typedef __big_div<__n::__hi, __n::__lo, __g> __ng; static constexpr uintmax_t __g2 = __static_gcd<__ng::__rem, __g>::value; typedef __big_div<__n::__hi, __n::__lo, __g2> __n_final; static_assert(__n_final::__rem == 0, "Internal library error"); static_assert(__n_final::__quot_hi == 0 && __n_final::__quot_lo <= __INTMAX_MAX__, "overflow in addition"); typedef __big_mul<_R1::den / __g2, __d2> __d_final; static_assert(__d_final::__hi == 0 && __d_final::__lo <= __INTMAX_MAX__, "overflow in addition"); public: typedef ratio<__n_final::__quot_lo, __d_final::__lo> type; }; template<typename _R1, typename _R2> struct __ratio_add_impl<_R1, _R2, false, true, true> : __ratio_add_impl<_R2, _R1> { }; // True subtraction of nonnegative numbers yielding a nonnegative result. template<typename _R1, typename _R2> struct __ratio_add_impl<_R1, _R2, true, false, false> { private: static constexpr uintmax_t __g = __static_gcd<_R1::den, _R2::den>::value; static constexpr uintmax_t __d2 = _R2::den / __g; typedef __big_mul<_R1::den, __d2> __d; typedef __big_mul<_R1::num, _R2::den / __g> __x; typedef __big_mul<-_R2::num, _R1::den / __g> __y; typedef __big_sub<__x::__hi, __x::__lo, __y::__hi, __y::__lo> __n; typedef __big_div<__n::__hi, __n::__lo, __g> __ng; static constexpr uintmax_t __g2 = __static_gcd<__ng::__rem, __g>::value; typedef __big_div<__n::__hi, __n::__lo, __g2> __n_final; static_assert(__n_final::__rem == 0, "Internal library error"); static_assert(__n_final::__quot_hi == 0 && __n_final::__quot_lo <= __INTMAX_MAX__, "overflow in addition"); typedef __big_mul<_R1::den / __g2, __d2> __d_final; static_assert(__d_final::__hi == 0 && __d_final::__lo <= __INTMAX_MAX__, "overflow in addition"); public: typedef ratio<__n_final::__quot_lo, __d_final::__lo> type; }; template<typename _R1, typename _R2> struct __ratio_add { typedef typename __ratio_add_impl<_R1, _R2>::type type; static constexpr intmax_t num = type::num; static constexpr intmax_t den = type::den; }; template<typename _R1, typename _R2> constexpr intmax_t __ratio_add<_R1, _R2>::num; template<typename _R1, typename _R2> constexpr intmax_t __ratio_add<_R1, _R2>::den; /// ratio_add template<typename _R1, typename _R2> using ratio_add = typename __ratio_add<_R1, _R2>::type; template<typename _R1, typename _R2> struct __ratio_subtract { typedef typename __ratio_add< _R1, ratio<-_R2::num, _R2::den>>::type type; static constexpr intmax_t num = type::num; static constexpr intmax_t den = type::den; }; template<typename _R1, typename _R2> constexpr intmax_t __ratio_subtract<_R1, _R2>::num; template<typename _R1, typename _R2> constexpr intmax_t __ratio_subtract<_R1, _R2>::den; /// ratio_subtract template<typename _R1, typename _R2> using ratio_subtract = typename __ratio_subtract<_R1, _R2>::type; typedef ratio<1, 1000000000000000000> atto; typedef ratio<1, 1000000000000000> femto; typedef ratio<1, 1000000000000> pico; typedef ratio<1, 1000000000> nano; typedef ratio<1, 1000000> micro; typedef ratio<1, 1000> milli; typedef ratio<1, 100> centi; typedef ratio<1, 10> deci; typedef ratio< 10, 1> deca; typedef ratio< 100, 1> hecto; typedef ratio< 1000, 1> kilo; typedef ratio< 1000000, 1> mega; typedef ratio< 1000000000, 1> giga; typedef ratio< 1000000000000, 1> tera; typedef ratio< 1000000000000000, 1> peta; typedef ratio< 1000000000000000000, 1> exa; // @} group ratio _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif //_GLIBCXX_USE_C99_STDINT_TR1 #endif // C++11 #endif //_GLIBCXX_RATIO ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/string������������������������������������������������������������������������������������0000644�����������������00000003627�14763166030�0007034 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Components for manipulating sequences of characters -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/string * This is a Standard C++ Library header. */ // // ISO C++ 14882: 21 Strings library // #ifndef _GLIBCXX_STRING #define _GLIBCXX_STRING 1 #pragma GCC system_header #include <bits/c++config.h> #include <bits/stringfwd.h> #include <bits/char_traits.h> // NB: In turn includes stl_algobase.h #include <bits/allocator.h> #include <bits/cpp_type_traits.h> #include <bits/localefwd.h> // For operators >>, <<, and getline. #include <bits/ostream_insert.h> #include <bits/stl_iterator_base_types.h> #include <bits/stl_iterator_base_funcs.h> #include <bits/stl_iterator.h> #include <bits/stl_function.h> // For less #include <ext/numeric_traits.h> #include <bits/stl_algobase.h> #include <bits/range_access.h> #include <bits/basic_string.h> #include <bits/basic_string.tcc> #endif /* _GLIBCXX_STRING */ ���������������������������������������������������������������������������������������������������������c++/4.8.2/initializer_list��������������������������������������������������������������������������0000644�����������������00000005634�14763166030�0011104 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// std::initializer_list support -*- C++ -*- // Copyright (C) 2008-2013 Free Software Foundation, Inc. // // This file is part of GCC. // // GCC 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 3, or (at your option) // any later version. // // GCC 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. // // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file initializer_list * This is a Standard C++ Library header. */ #ifndef _INITIALIZER_LIST #define _INITIALIZER_LIST #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else // C++0x #pragma GCC visibility push(default) #include <bits/c++config.h> namespace std { /// initializer_list template<class _E> class initializer_list { public: typedef _E value_type; typedef const _E& reference; typedef const _E& const_reference; typedef size_t size_type; typedef const _E* iterator; typedef const _E* const_iterator; private: iterator _M_array; size_type _M_len; // The compiler can call a private constructor. constexpr initializer_list(const_iterator __a, size_type __l) : _M_array(__a), _M_len(__l) { } public: constexpr initializer_list() noexcept : _M_array(0), _M_len(0) { } // Number of elements. constexpr size_type size() const noexcept { return _M_len; } // First element. constexpr const_iterator begin() const noexcept { return _M_array; } // One past the last element. constexpr const_iterator end() const noexcept { return begin() + size(); } }; /** * @brief Return an iterator pointing to the first element of * the initilizer_list. * @param __ils Initializer list. */ template<class _Tp> constexpr const _Tp* begin(initializer_list<_Tp> __ils) noexcept { return __ils.begin(); } /** * @brief Return an iterator pointing to one past the last element * of the initilizer_list. * @param __ils Initializer list. */ template<class _Tp> constexpr const _Tp* end(initializer_list<_Tp> __ils) noexcept { return __ils.end(); } } #pragma GCC visibility pop #endif // C++11 #endif // _INITIALIZER_LIST ����������������������������������������������������������������������������������������������������c++/4.8.2/forward_list������������������������������������������������������������������������������0000644�����������������00000003051�14763166030�0010214 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <forward_list> -*- C++ -*- // Copyright (C) 2008-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/forward_list * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_FORWARD_LIST #define _GLIBCXX_FORWARD_LIST 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <bits/forward_list.h> #include <bits/range_access.h> #include <bits/forward_list.tcc> #ifdef _GLIBCXX_DEBUG # include <debug/forward_list> #endif #ifdef _GLIBCXX_PROFILE # include <profile/forward_list> #endif #endif // C++11 #endif // _GLIBCXX_FORWARD_LIST ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/safe_unordered_base.h���������������������������������������������������������������0000644�����������������00000015430�14763166030�0013014 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Safe container/iterator base implementation -*- C++ -*- // Copyright (C) 2011-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/safe_unordered_base.h * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_SAFE_UNORDERED_BASE_H #define _GLIBCXX_DEBUG_SAFE_UNORDERED_BASE_H 1 #include <debug/safe_base.h> namespace __gnu_debug { class _Safe_unordered_container_base; /** \brief Basic functionality for a @a safe iterator. * * The %_Safe_local_iterator_base base class implements the functionality * of a safe local iterator that is not specific to a particular iterator * type. It contains a pointer back to the container it references * along with iterator version information and pointers to form a * doubly-linked list of local iterators referenced by the container. * * This class must not perform any operations that can throw an * exception, or the exception guarantees of derived iterators will * be broken. */ class _Safe_local_iterator_base : public _Safe_iterator_base { protected: /** Initializes the iterator and makes it singular. */ _Safe_local_iterator_base() { } /** Initialize the iterator to reference the container pointed to * by @p __seq. @p __constant is true when we are initializing a * constant local iterator, and false if it is a mutable local iterator. * Note that @p __seq may be NULL, in which case the iterator will be * singular. Otherwise, the iterator will reference @p __seq and * be nonsingular. */ _Safe_local_iterator_base(const _Safe_sequence_base* __seq, bool __constant) { this->_M_attach(const_cast<_Safe_sequence_base*>(__seq), __constant); } /** Initializes the iterator to reference the same container that @p __x does. @p __constant is true if this is a constant iterator, and false if it is mutable. */ _Safe_local_iterator_base(const _Safe_local_iterator_base& __x, bool __constant) { this->_M_attach(__x._M_sequence, __constant); } _Safe_local_iterator_base& operator=(const _Safe_local_iterator_base&); explicit _Safe_local_iterator_base(const _Safe_local_iterator_base&); ~_Safe_local_iterator_base() { this->_M_detach(); } _Safe_unordered_container_base* _M_get_container() const _GLIBCXX_NOEXCEPT; public: /** Attaches this iterator to the given container, detaching it * from whatever container it was attached to originally. If the * new container is the NULL pointer, the iterator is left * unattached. */ void _M_attach(_Safe_sequence_base* __seq, bool __constant); /** Likewise, but not thread-safe. */ void _M_attach_single(_Safe_sequence_base* __seq, bool __constant) throw (); /** Detach the iterator for whatever container it is attached to, * if any. */ void _M_detach(); /** Likewise, but not thread-safe. */ void _M_detach_single() throw (); }; /** * @brief Base class that supports tracking of local iterators that * reference an unordered container. * * The %_Safe_unordered_container_base class provides basic support for * tracking iterators into an unordered container. Containers that track * iterators must derived from %_Safe_unordered_container_base publicly, so * that safe iterators (which inherit _Safe_iterator_base) can * attach to them. This class contains four linked lists of * iterators, one for constant iterators, one for mutable * iterators, one for constant local iterators, one for mutable local * iterators and a version number that allows very fast * invalidation of all iterators that reference the container. * * This class must ensure that no operation on it may throw an * exception, otherwise @a safe containers may fail to provide the * exception-safety guarantees required by the C++ standard. */ class _Safe_unordered_container_base : public _Safe_sequence_base { typedef _Safe_sequence_base _Base; public: /// The list of mutable local iterators that reference this container _Safe_iterator_base* _M_local_iterators; /// The list of constant local iterators that reference this container _Safe_iterator_base* _M_const_local_iterators; protected: // Initialize with a version number of 1 and no iterators _Safe_unordered_container_base() : _M_local_iterators(nullptr), _M_const_local_iterators(nullptr) { } // Initialize with a version number of 1 and no iterators _Safe_unordered_container_base(const _Safe_unordered_container_base&) noexcept : _Safe_unordered_container_base() { } _Safe_unordered_container_base(_Safe_unordered_container_base&& __x) noexcept : _Safe_unordered_container_base() { this->_M_swap(__x); } /** Notify all iterators that reference this container that the container is being destroyed. */ ~_Safe_unordered_container_base() { this->_M_detach_all(); } /** Detach all iterators, leaving them singular. */ void _M_detach_all(); /** Swap this container with the given container. This operation * also swaps ownership of the iterators, so that when the * operation is complete all iterators that originally referenced * one container now reference the other container. */ void _M_swap(_Safe_unordered_container_base& __x); public: /** Attach an iterator to this container. */ void _M_attach_local(_Safe_iterator_base* __it, bool __constant); /** Likewise but not thread safe. */ void _M_attach_local_single(_Safe_iterator_base* __it, bool __constant) throw (); /** Detach an iterator from this container */ void _M_detach_local(_Safe_iterator_base* __it); /** Likewise but not thread safe. */ void _M_detach_local_single(_Safe_iterator_base* __it) throw (); }; } // namespace __gnu_debug #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/debug.h�����������������������������������������������������������������������������0000644�����������������00000012352�14763166030�0010123 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debugging support implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/debug.h * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_MACRO_SWITCH_H #define _GLIBCXX_DEBUG_MACRO_SWITCH_H 1 /** Macros and namespaces used by the implementation outside of debug * wrappers to verify certain properties. The __glibcxx_requires_xxx * macros are merely wrappers around the __glibcxx_check_xxx wrappers * when we are compiling with debug mode, but disappear when we are * in release mode so that there is no checking performed in, e.g., * the standard library algorithms. */ // Debug mode namespaces. /** * @namespace std::__debug * @brief GNU debug code, replaces standard behavior with debug behavior. */ namespace std { namespace __debug { } } /** @namespace __gnu_debug * @brief GNU debug classes for public use. */ namespace __gnu_debug { using namespace std::__debug; } #ifndef _GLIBCXX_DEBUG # define _GLIBCXX_DEBUG_ASSERT(_Condition) # define _GLIBCXX_DEBUG_PEDASSERT(_Condition) # define _GLIBCXX_DEBUG_ONLY(_Statement) ; # define __glibcxx_requires_cond(_Cond,_Msg) # define __glibcxx_requires_valid_range(_First,_Last) # define __glibcxx_requires_non_empty_range(_First,_Last) # define __glibcxx_requires_sorted(_First,_Last) # define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) # define __glibcxx_requires_sorted_set(_First1,_Last1,_First2) # define __glibcxx_requires_sorted_set_pred(_First1,_Last1,_First2,_Pred) # define __glibcxx_requires_partitioned_lower(_First,_Last,_Value) # define __glibcxx_requires_partitioned_upper(_First,_Last,_Value) # define __glibcxx_requires_partitioned_lower_pred(_First,_Last,_Value,_Pred) # define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred) # define __glibcxx_requires_heap(_First,_Last) # define __glibcxx_requires_heap_pred(_First,_Last,_Pred) # define __glibcxx_requires_nonempty() # define __glibcxx_requires_string(_String) # define __glibcxx_requires_string_len(_String,_Len) # define __glibcxx_requires_subscript(_N) #else # include <debug/macros.h> #define _GLIBCXX_DEBUG_ASSERT(_Condition) __glibcxx_assert(_Condition) #ifdef _GLIBCXX_DEBUG_PEDANTIC # define _GLIBCXX_DEBUG_PEDASSERT(_Condition) _GLIBCXX_DEBUG_ASSERT(_Condition) #else # define _GLIBCXX_DEBUG_PEDASSERT(_Condition) #endif # define _GLIBCXX_DEBUG_ONLY(_Statement) _Statement # define __glibcxx_requires_cond(_Cond,_Msg) _GLIBCXX_DEBUG_VERIFY(_Cond,_Msg) # define __glibcxx_requires_valid_range(_First,_Last) \ __glibcxx_check_valid_range(_First,_Last) # define __glibcxx_requires_non_empty_range(_First,_Last) \ __glibcxx_check_non_empty_range(_First,_Last) # define __glibcxx_requires_sorted(_First,_Last) \ __glibcxx_check_sorted(_First,_Last) # define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) \ __glibcxx_check_sorted_pred(_First,_Last,_Pred) # define __glibcxx_requires_sorted_set(_First1,_Last1,_First2) \ __glibcxx_check_sorted_set(_First1,_Last1,_First2) # define __glibcxx_requires_sorted_set_pred(_First1,_Last1,_First2,_Pred) \ __glibcxx_check_sorted_set_pred(_First1,_Last1,_First2,_Pred) # define __glibcxx_requires_partitioned_lower(_First,_Last,_Value) \ __glibcxx_check_partitioned_lower(_First,_Last,_Value) # define __glibcxx_requires_partitioned_upper(_First,_Last,_Value) \ __glibcxx_check_partitioned_upper(_First,_Last,_Value) # define __glibcxx_requires_partitioned_lower_pred(_First,_Last,_Value,_Pred) \ __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred) # define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred) \ __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred) # define __glibcxx_requires_heap(_First,_Last) \ __glibcxx_check_heap(_First,_Last) # define __glibcxx_requires_heap_pred(_First,_Last,_Pred) \ __glibcxx_check_heap_pred(_First,_Last,_Pred) # define __glibcxx_requires_nonempty() __glibcxx_check_nonempty() # define __glibcxx_requires_string(_String) __glibcxx_check_string(_String) # define __glibcxx_requires_string_len(_String,_Len) \ __glibcxx_check_string_len(_String,_Len) # define __glibcxx_requires_subscript(_N) __glibcxx_check_subscript(_N) # include <debug/functions.h> #endif #endif // _GLIBCXX_DEBUG_MACRO_SWITCH_H ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/deque�������������������������������������������������������������������������������0000644�����������������00000034142�14763166030�0007713 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debugging deque implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/deque * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_DEQUE #define _GLIBCXX_DEBUG_DEQUE 1 #include <deque> #include <debug/safe_sequence.h> #include <debug/safe_iterator.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { /// Class std::deque with safety/checking/debug instrumentation. template<typename _Tp, typename _Allocator = std::allocator<_Tp> > class deque : public _GLIBCXX_STD_C::deque<_Tp, _Allocator>, public __gnu_debug::_Safe_sequence<deque<_Tp, _Allocator> > { typedef _GLIBCXX_STD_C::deque<_Tp, _Allocator> _Base; typedef typename _Base::const_iterator _Base_const_iterator; typedef typename _Base::iterator _Base_iterator; typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; public: typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef __gnu_debug::_Safe_iterator<_Base_iterator,deque> iterator; typedef __gnu_debug::_Safe_iterator<_Base_const_iterator,deque> const_iterator; typedef typename _Base::size_type size_type; typedef typename _Base::difference_type difference_type; typedef _Tp value_type; typedef _Allocator allocator_type; typedef typename _Base::pointer pointer; typedef typename _Base::const_pointer const_pointer; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // 23.2.1.1 construct/copy/destroy: explicit deque(const _Allocator& __a = _Allocator()) : _Base(__a) { } #if __cplusplus >= 201103L explicit deque(size_type __n) : _Base(__n) { } deque(size_type __n, const _Tp& __value, const _Allocator& __a = _Allocator()) : _Base(__n, __value, __a) { } #else explicit deque(size_type __n, const _Tp& __value = _Tp(), const _Allocator& __a = _Allocator()) : _Base(__n, __value, __a) { } #endif #if __cplusplus >= 201103L template<class _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<class _InputIterator> #endif deque(_InputIterator __first, _InputIterator __last, const _Allocator& __a = _Allocator()) : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, __last)), __gnu_debug::__base(__last), __a) { } deque(const deque& __x) : _Base(__x) { } deque(const _Base& __x) : _Base(__x) { } #if __cplusplus >= 201103L deque(deque&& __x) : _Base(std::move(__x)) { this->_M_swap(__x); } deque(initializer_list<value_type> __l, const allocator_type& __a = allocator_type()) : _Base(__l, __a) { } #endif ~deque() _GLIBCXX_NOEXCEPT { } deque& operator=(const deque& __x) { *static_cast<_Base*>(this) = __x; this->_M_invalidate_all(); return *this; } #if __cplusplus >= 201103L deque& operator=(deque&& __x) { // NB: DR 1204. // NB: DR 675. __glibcxx_check_self_move_assign(__x); clear(); swap(__x); return *this; } deque& operator=(initializer_list<value_type> __l) { *static_cast<_Base*>(this) = __l; this->_M_invalidate_all(); return *this; } #endif #if __cplusplus >= 201103L template<class _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<class _InputIterator> #endif void assign(_InputIterator __first, _InputIterator __last) { __glibcxx_check_valid_range(__first, __last); _Base::assign(__gnu_debug::__base(__first), __gnu_debug::__base(__last)); this->_M_invalidate_all(); } void assign(size_type __n, const _Tp& __t) { _Base::assign(__n, __t); this->_M_invalidate_all(); } #if __cplusplus >= 201103L void assign(initializer_list<value_type> __l) { _Base::assign(__l); this->_M_invalidate_all(); } #endif using _Base::get_allocator; // iterators: iterator begin() _GLIBCXX_NOEXCEPT { return iterator(_Base::begin(), this); } const_iterator begin() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::begin(), this); } iterator end() _GLIBCXX_NOEXCEPT { return iterator(_Base::end(), this); } const_iterator end() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::end(), this); } reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(end()); } const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(end()); } reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(begin()); } const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(begin()); } #if __cplusplus >= 201103L const_iterator cbegin() const noexcept { return const_iterator(_Base::begin(), this); } const_iterator cend() const noexcept { return const_iterator(_Base::end(), this); } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } #endif private: void _M_invalidate_after_nth(difference_type __n) { typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth; this->_M_invalidate_if(_After_nth(__n, _Base::begin())); } public: // 23.2.1.2 capacity: using _Base::size; using _Base::max_size; #if __cplusplus >= 201103L void resize(size_type __sz) { bool __invalidate_all = __sz > this->size(); if (__sz < this->size()) this->_M_invalidate_after_nth(__sz); _Base::resize(__sz); if (__invalidate_all) this->_M_invalidate_all(); } void resize(size_type __sz, const _Tp& __c) { bool __invalidate_all = __sz > this->size(); if (__sz < this->size()) this->_M_invalidate_after_nth(__sz); _Base::resize(__sz, __c); if (__invalidate_all) this->_M_invalidate_all(); } #else void resize(size_type __sz, _Tp __c = _Tp()) { bool __invalidate_all = __sz > this->size(); if (__sz < this->size()) this->_M_invalidate_after_nth(__sz); _Base::resize(__sz, __c); if (__invalidate_all) this->_M_invalidate_all(); } #endif #if __cplusplus >= 201103L void shrink_to_fit() { if (_Base::_M_shrink_to_fit()) this->_M_invalidate_all(); } #endif using _Base::empty; // element access: reference operator[](size_type __n) { __glibcxx_check_subscript(__n); return _M_base()[__n]; } const_reference operator[](size_type __n) const { __glibcxx_check_subscript(__n); return _M_base()[__n]; } using _Base::at; reference front() { __glibcxx_check_nonempty(); return _Base::front(); } const_reference front() const { __glibcxx_check_nonempty(); return _Base::front(); } reference back() { __glibcxx_check_nonempty(); return _Base::back(); } const_reference back() const { __glibcxx_check_nonempty(); return _Base::back(); } // 23.2.1.3 modifiers: void push_front(const _Tp& __x) { _Base::push_front(__x); this->_M_invalidate_all(); } void push_back(const _Tp& __x) { _Base::push_back(__x); this->_M_invalidate_all(); } #if __cplusplus >= 201103L void push_front(_Tp&& __x) { emplace_front(std::move(__x)); } void push_back(_Tp&& __x) { emplace_back(std::move(__x)); } template<typename... _Args> void emplace_front(_Args&&... __args) { _Base::emplace_front(std::forward<_Args>(__args)...); this->_M_invalidate_all(); } template<typename... _Args> void emplace_back(_Args&&... __args) { _Base::emplace_back(std::forward<_Args>(__args)...); this->_M_invalidate_all(); } template<typename... _Args> iterator emplace(iterator __position, _Args&&... __args) { __glibcxx_check_insert(__position); _Base_iterator __res = _Base::emplace(__position.base(), std::forward<_Args>(__args)...); this->_M_invalidate_all(); return iterator(__res, this); } #endif iterator insert(iterator __position, const _Tp& __x) { __glibcxx_check_insert(__position); _Base_iterator __res = _Base::insert(__position.base(), __x); this->_M_invalidate_all(); return iterator(__res, this); } #if __cplusplus >= 201103L iterator insert(iterator __position, _Tp&& __x) { return emplace(__position, std::move(__x)); } void insert(iterator __p, initializer_list<value_type> __l) { _Base::insert(__p, __l); this->_M_invalidate_all(); } #endif void insert(iterator __position, size_type __n, const _Tp& __x) { __glibcxx_check_insert(__position); _Base::insert(__position.base(), __n, __x); this->_M_invalidate_all(); } #if __cplusplus >= 201103L template<class _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<class _InputIterator> #endif void insert(iterator __position, _InputIterator __first, _InputIterator __last) { __glibcxx_check_insert_range(__position, __first, __last); _Base::insert(__position.base(), __gnu_debug::__base(__first), __gnu_debug::__base(__last)); this->_M_invalidate_all(); } void pop_front() { __glibcxx_check_nonempty(); this->_M_invalidate_if(_Equal(_Base::begin())); _Base::pop_front(); } void pop_back() { __glibcxx_check_nonempty(); this->_M_invalidate_if(_Equal(--_Base::end())); _Base::pop_back(); } iterator erase(iterator __position) { __glibcxx_check_erase(__position); _Base_iterator __victim = __position.base(); if (__victim == _Base::begin() || __victim == _Base::end()-1) { this->_M_invalidate_if(_Equal(__victim)); return iterator(_Base::erase(__victim), this); } else { _Base_iterator __res = _Base::erase(__victim); this->_M_invalidate_all(); return iterator(__res, this); } } iterator erase(iterator __first, iterator __last) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container __glibcxx_check_erase_range(__first, __last); if (__first.base() == __last.base()) return __first; else if (__first.base() == _Base::begin() || __last.base() == _Base::end()) { this->_M_detach_singular(); for (_Base_iterator __position = __first.base(); __position != __last.base(); ++__position) { this->_M_invalidate_if(_Equal(__position)); } __try { return iterator(_Base::erase(__first.base(), __last.base()), this); } __catch(...) { this->_M_revalidate_singular(); __throw_exception_again; } } else { _Base_iterator __res = _Base::erase(__first.base(), __last.base()); this->_M_invalidate_all(); return iterator(__res, this); } } void swap(deque& __x) { _Base::swap(__x); this->_M_swap(__x); } void clear() _GLIBCXX_NOEXCEPT { _Base::clear(); this->_M_invalidate_all(); } _Base& _M_base() _GLIBCXX_NOEXCEPT { return *this; } const _Base& _M_base() const _GLIBCXX_NOEXCEPT { return *this; } }; template<typename _Tp, typename _Alloc> inline bool operator==(const deque<_Tp, _Alloc>& __lhs, const deque<_Tp, _Alloc>& __rhs) { return __lhs._M_base() == __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator!=(const deque<_Tp, _Alloc>& __lhs, const deque<_Tp, _Alloc>& __rhs) { return __lhs._M_base() != __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator<(const deque<_Tp, _Alloc>& __lhs, const deque<_Tp, _Alloc>& __rhs) { return __lhs._M_base() < __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator<=(const deque<_Tp, _Alloc>& __lhs, const deque<_Tp, _Alloc>& __rhs) { return __lhs._M_base() <= __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator>=(const deque<_Tp, _Alloc>& __lhs, const deque<_Tp, _Alloc>& __rhs) { return __lhs._M_base() >= __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator>(const deque<_Tp, _Alloc>& __lhs, const deque<_Tp, _Alloc>& __rhs) { return __lhs._M_base() > __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline void swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs) { __lhs.swap(__rhs); } } // namespace __debug } // namespace std #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/safe_sequence.h���������������������������������������������������������������������0000644�����������������00000010674�14763166030�0011650 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Safe sequence implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/safe_sequence.h * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_SAFE_SEQUENCE_H #define _GLIBCXX_DEBUG_SAFE_SEQUENCE_H 1 #include <debug/debug.h> #include <debug/macros.h> #include <debug/functions.h> #include <debug/safe_base.h> namespace __gnu_debug { template<typename _Iterator, typename _Sequence> class _Safe_iterator; /** A simple function object that returns true if the passed-in * value is not equal to the stored value. It saves typing over * using both bind1st and not_equal. */ template<typename _Type> class _Not_equal_to { _Type __value; public: explicit _Not_equal_to(const _Type& __v) : __value(__v) { } bool operator()(const _Type& __x) const { return __value != __x; } }; /** A simple function object that returns true if the passed-in * value is equal to the stored value. */ template <typename _Type> class _Equal_to { _Type __value; public: explicit _Equal_to(const _Type& __v) : __value(__v) { } bool operator()(const _Type& __x) const { return __value == __x; } }; /** A function object that returns true when the given random access iterator is at least @c n steps away from the given iterator. */ template<typename _Iterator> class _After_nth_from { typedef typename std::iterator_traits<_Iterator>::difference_type difference_type; _Iterator _M_base; difference_type _M_n; public: _After_nth_from(const difference_type& __n, const _Iterator& __base) : _M_base(__base), _M_n(__n) { } bool operator()(const _Iterator& __x) const { return __x - _M_base >= _M_n; } }; /** * @brief Base class for constructing a @a safe sequence type that * tracks iterators that reference it. * * The class template %_Safe_sequence simplifies the construction of * @a safe sequences that track the iterators that reference the * sequence, so that the iterators are notified of changes in the * sequence that may affect their operation, e.g., if the container * invalidates its iterators or is destructed. This class template * may only be used by deriving from it and passing the name of the * derived class as its template parameter via the curiously * recurring template pattern. The derived class must have @c * iterator and @c const_iterator types that are instantiations of * class template _Safe_iterator for this sequence. Iterators will * then be tracked automatically. */ template<typename _Sequence> class _Safe_sequence : public _Safe_sequence_base { public: /** Invalidates all iterators @c x that reference this sequence, are not singular, and for which @c __pred(x) returns @c true. @c __pred will be invoked with the normal iterators nested in the safe ones. */ template<typename _Predicate> void _M_invalidate_if(_Predicate __pred); /** Transfers all iterators @c x that reference @c from sequence, are not singular, and for which @c __pred(x) returns @c true. @c __pred will be invoked with the normal iterators nested in the safe ones. */ template<typename _Predicate> void _M_transfer_from_if(_Safe_sequence& __from, _Predicate __pred); }; } // namespace __gnu_debug #include <debug/safe_sequence.tcc> #endif ��������������������������������������������������������������������c++/4.8.2/debug/unordered_map�����������������������������������������������������������������������0000644�����������������00000064060�14763166030�0011436 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debugging unordered_map/unordered_multimap implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/unordered_map * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_UNORDERED_MAP #define _GLIBCXX_DEBUG_UNORDERED_MAP 1 #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else # include <unordered_map> #include <debug/safe_unordered_container.h> #include <debug/safe_iterator.h> #include <debug/safe_local_iterator.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { /// Class std::unordered_map with safety/checking/debug instrumentation. template<typename _Key, typename _Tp, typename _Hash = std::hash<_Key>, typename _Pred = std::equal_to<_Key>, typename _Alloc = std::allocator<_Key> > class unordered_map : public _GLIBCXX_STD_C::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>, public __gnu_debug::_Safe_unordered_container<unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc> > { typedef _GLIBCXX_STD_C::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc> _Base; typedef __gnu_debug::_Safe_unordered_container<unordered_map> _Safe_base; typedef typename _Base::const_iterator _Base_const_iterator; typedef typename _Base::iterator _Base_iterator; typedef typename _Base::const_local_iterator _Base_const_local_iterator; typedef typename _Base::local_iterator _Base_local_iterator; public: typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; typedef typename _Base::allocator_type allocator_type; typedef typename _Base::key_type key_type; typedef typename _Base::value_type value_type; typedef __gnu_debug::_Safe_iterator<_Base_iterator, unordered_map> iterator; typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, unordered_map> const_iterator; typedef __gnu_debug::_Safe_local_iterator<_Base_local_iterator, unordered_map> local_iterator; typedef __gnu_debug::_Safe_local_iterator<_Base_const_local_iterator, unordered_map> const_local_iterator; explicit unordered_map(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) { } template<typename _InputIterator> unordered_map(_InputIterator __first, _InputIterator __last, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, __last)), __gnu_debug::__base(__last), __n, __hf, __eql, __a) { } unordered_map(const unordered_map& __x) = default; unordered_map(const _Base& __x) : _Base(__x) { } unordered_map(unordered_map&& __x) = default; unordered_map(initializer_list<value_type> __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__l, __n, __hf, __eql, __a) { } ~unordered_map() noexcept { } unordered_map& operator=(const unordered_map& __x) { *static_cast<_Base*>(this) = __x; this->_M_invalidate_all(); return *this; } unordered_map& operator=(unordered_map&& __x) { // NB: DR 1204. // NB: DR 675. __glibcxx_check_self_move_assign(__x); clear(); swap(__x); return *this; } unordered_map& operator=(initializer_list<value_type> __l) { this->clear(); this->insert(__l); return *this; } void swap(unordered_map& __x) { _Base::swap(__x); _Safe_base::_M_swap(__x); } void clear() noexcept { _Base::clear(); this->_M_invalidate_all(); } iterator begin() noexcept { return iterator(_Base::begin(), this); } const_iterator begin() const noexcept { return const_iterator(_Base::begin(), this); } iterator end() noexcept { return iterator(_Base::end(), this); } const_iterator end() const noexcept { return const_iterator(_Base::end(), this); } const_iterator cbegin() const noexcept { return const_iterator(_Base::begin(), this); } const_iterator cend() const noexcept { return const_iterator(_Base::end(), this); } // local versions local_iterator begin(size_type __b) { __glibcxx_check_bucket_index(__b); return local_iterator(_Base::begin(__b), __b, this); } local_iterator end(size_type __b) { __glibcxx_check_bucket_index(__b); return local_iterator(_Base::end(__b), __b, this); } const_local_iterator begin(size_type __b) const { __glibcxx_check_bucket_index(__b); return const_local_iterator(_Base::begin(__b), __b, this); } const_local_iterator end(size_type __b) const { __glibcxx_check_bucket_index(__b); return const_local_iterator(_Base::end(__b), __b, this); } const_local_iterator cbegin(size_type __b) const { __glibcxx_check_bucket_index(__b); return const_local_iterator(_Base::cbegin(__b), __b, this); } const_local_iterator cend(size_type __b) const { __glibcxx_check_bucket_index(__b); return const_local_iterator(_Base::cend(__b), __b, this); } size_type bucket_size(size_type __b) const { __glibcxx_check_bucket_index(__b); return _Base::bucket_size(__b); } float max_load_factor() const noexcept { return _Base::max_load_factor(); } void max_load_factor(float __f) { __glibcxx_check_max_load_factor(__f); _Base::max_load_factor(__f); } template<typename... _Args> std::pair<iterator, bool> emplace(_Args&&... __args) { size_type __bucket_count = this->bucket_count(); std::pair<_Base_iterator, bool> __res = _Base::emplace(std::forward<_Args>(__args)...); _M_check_rehashed(__bucket_count); return std::make_pair(iterator(__res.first, this), __res.second); } template<typename... _Args> iterator emplace_hint(const_iterator __hint, _Args&&... __args) { __glibcxx_check_insert(__hint); size_type __bucket_count = this->bucket_count(); _Base_iterator __it = _Base::emplace_hint(__hint.base(), std::forward<_Args>(__args)...); _M_check_rehashed(__bucket_count); return iterator(__it, this); } std::pair<iterator, bool> insert(const value_type& __obj) { size_type __bucket_count = this->bucket_count(); std::pair<_Base_iterator, bool> __res = _Base::insert(__obj); _M_check_rehashed(__bucket_count); return std::make_pair(iterator(__res.first, this), __res.second); } iterator insert(const_iterator __hint, const value_type& __obj) { __glibcxx_check_insert(__hint); size_type __bucket_count = this->bucket_count(); _Base_iterator __it = _Base::insert(__hint.base(), __obj); _M_check_rehashed(__bucket_count); return iterator(__it, this); } template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> std::pair<iterator, bool> insert(_Pair&& __obj) { size_type __bucket_count = this->bucket_count(); std::pair<_Base_iterator, bool> __res = _Base::insert(std::forward<_Pair>(__obj)); _M_check_rehashed(__bucket_count); return std::make_pair(iterator(__res.first, this), __res.second); } template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> iterator insert(const_iterator __hint, _Pair&& __obj) { __glibcxx_check_insert(__hint); size_type __bucket_count = this->bucket_count(); _Base_iterator __it = _Base::insert(__hint.base(), std::forward<_Pair>(__obj)); _M_check_rehashed(__bucket_count); return iterator(__it, this); } void insert(std::initializer_list<value_type> __l) { size_type __bucket_count = this->bucket_count(); _Base::insert(__l); _M_check_rehashed(__bucket_count); } template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) { __glibcxx_check_valid_range(__first, __last); size_type __bucket_count = this->bucket_count(); _Base::insert(__gnu_debug::__base(__first), __gnu_debug::__base(__last)); _M_check_rehashed(__bucket_count); } iterator find(const key_type& __key) { return iterator(_Base::find(__key), this); } const_iterator find(const key_type& __key) const { return const_iterator(_Base::find(__key), this); } std::pair<iterator, iterator> equal_range(const key_type& __key) { std::pair<_Base_iterator, _Base_iterator> __res = _Base::equal_range(__key); return std::make_pair(iterator(__res.first, this), iterator(__res.second, this)); } std::pair<const_iterator, const_iterator> equal_range(const key_type& __key) const { std::pair<_Base_const_iterator, _Base_const_iterator> __res = _Base::equal_range(__key); return std::make_pair(const_iterator(__res.first, this), const_iterator(__res.second, this)); } size_type erase(const key_type& __key) { size_type __ret(0); _Base_iterator __victim(_Base::find(__key)); if (__victim != _Base::end()) { this->_M_invalidate_if([__victim](_Base_const_iterator __it) { return __it == __victim; }); this->_M_invalidate_local_if( [__victim](_Base_const_local_iterator __it) { return __it._M_cur == __victim._M_cur; }); size_type __bucket_count = this->bucket_count(); _Base::erase(__victim); _M_check_rehashed(__bucket_count); __ret = 1; } return __ret; } iterator erase(const_iterator __it) { __glibcxx_check_erase(__it); _Base_const_iterator __victim = __it.base(); this->_M_invalidate_if([__victim](_Base_const_iterator __it) { return __it == __victim; }); this->_M_invalidate_local_if( [__victim](_Base_const_local_iterator __it) { return __it._M_cur == __victim._M_cur; }); size_type __bucket_count = this->bucket_count(); _Base_iterator __next = _Base::erase(__it.base()); _M_check_rehashed(__bucket_count); return iterator(__next, this); } iterator erase(iterator __it) { return erase(const_iterator(__it)); } iterator erase(const_iterator __first, const_iterator __last) { __glibcxx_check_erase_range(__first, __last); for (_Base_const_iterator __tmp = __first.base(); __tmp != __last.base(); ++__tmp) { _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::end(), _M_message(__gnu_debug::__msg_valid_range) ._M_iterator(__first, "first") ._M_iterator(__last, "last")); this->_M_invalidate_if([__tmp](_Base_const_iterator __it) { return __it == __tmp; }); this->_M_invalidate_local_if( [__tmp](_Base_const_local_iterator __it) { return __it._M_cur == __tmp._M_cur; }); } size_type __bucket_count = this->bucket_count(); _Base_iterator __next = _Base::erase(__first.base(), __last.base()); _M_check_rehashed(__bucket_count); return iterator(__next, this); } _Base& _M_base() noexcept { return *this; } const _Base& _M_base() const noexcept { return *this; } private: void _M_invalidate_locals() { _Base_local_iterator __local_end = _Base::end(0); this->_M_invalidate_local_if( [__local_end](_Base_const_local_iterator __it) { return __it != __local_end; }); } void _M_invalidate_all() { _Base_iterator __end = _Base::end(); this->_M_invalidate_if([__end](_Base_const_iterator __it) { return __it != __end; }); _M_invalidate_locals(); } void _M_check_rehashed(size_type __prev_count) { if (__prev_count != this->bucket_count()) _M_invalidate_locals(); } }; template<typename _Key, typename _Tp, typename _Hash, typename _Pred, typename _Alloc> inline void swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { __x.swap(__y); } template<typename _Key, typename _Tp, typename _Hash, typename _Pred, typename _Alloc> inline bool operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { return __x._M_base() == __y._M_base(); } template<typename _Key, typename _Tp, typename _Hash, typename _Pred, typename _Alloc> inline bool operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { return !(__x == __y); } /// Class std::unordered_multimap with safety/checking/debug instrumentation. template<typename _Key, typename _Tp, typename _Hash = std::hash<_Key>, typename _Pred = std::equal_to<_Key>, typename _Alloc = std::allocator<_Key> > class unordered_multimap : public _GLIBCXX_STD_C::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>, public __gnu_debug::_Safe_unordered_container<unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc> > { typedef _GLIBCXX_STD_C::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc> _Base; typedef __gnu_debug::_Safe_unordered_container<unordered_multimap> _Safe_base; typedef typename _Base::const_iterator _Base_const_iterator; typedef typename _Base::iterator _Base_iterator; typedef typename _Base::const_local_iterator _Base_const_local_iterator; typedef typename _Base::local_iterator _Base_local_iterator; public: typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; typedef typename _Base::allocator_type allocator_type; typedef typename _Base::key_type key_type; typedef typename _Base::value_type value_type; typedef __gnu_debug::_Safe_iterator<_Base_iterator, unordered_multimap> iterator; typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, unordered_multimap> const_iterator; typedef __gnu_debug::_Safe_local_iterator< _Base_local_iterator, unordered_multimap> local_iterator; typedef __gnu_debug::_Safe_local_iterator< _Base_const_local_iterator, unordered_multimap> const_local_iterator; explicit unordered_multimap(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) { } template<typename _InputIterator> unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, __last)), __gnu_debug::__base(__last), __n, __hf, __eql, __a) { } unordered_multimap(const unordered_multimap& __x) = default; unordered_multimap(const _Base& __x) : _Base(__x) { } unordered_multimap(unordered_multimap&& __x) = default; unordered_multimap(initializer_list<value_type> __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__l, __n, __hf, __eql, __a) { } ~unordered_multimap() noexcept { } unordered_multimap& operator=(const unordered_multimap& __x) { *static_cast<_Base*>(this) = __x; this->_M_invalidate_all(); return *this; } unordered_multimap& operator=(unordered_multimap&& __x) { // NB: DR 1204. // NB: DR 675. __glibcxx_check_self_move_assign(__x); clear(); swap(__x); return *this; } unordered_multimap& operator=(initializer_list<value_type> __l) { this->clear(); this->insert(__l); return *this; } void swap(unordered_multimap& __x) { _Base::swap(__x); _Safe_base::_M_swap(__x); } void clear() noexcept { _Base::clear(); this->_M_invalidate_all(); } iterator begin() noexcept { return iterator(_Base::begin(), this); } const_iterator begin() const noexcept { return const_iterator(_Base::begin(), this); } iterator end() noexcept { return iterator(_Base::end(), this); } const_iterator end() const noexcept { return const_iterator(_Base::end(), this); } const_iterator cbegin() const noexcept { return const_iterator(_Base::begin(), this); } const_iterator cend() const noexcept { return const_iterator(_Base::end(), this); } // local versions local_iterator begin(size_type __b) { __glibcxx_check_bucket_index(__b); return local_iterator(_Base::begin(__b), __b, this); } local_iterator end(size_type __b) { __glibcxx_check_bucket_index(__b); return local_iterator(_Base::end(__b), __b, this); } const_local_iterator begin(size_type __b) const { __glibcxx_check_bucket_index(__b); return const_local_iterator(_Base::begin(__b), __b, this); } const_local_iterator end(size_type __b) const { __glibcxx_check_bucket_index(__b); return const_local_iterator(_Base::end(__b), __b, this); } const_local_iterator cbegin(size_type __b) const { __glibcxx_check_bucket_index(__b); return const_local_iterator(_Base::cbegin(__b), __b, this); } const_local_iterator cend(size_type __b) const { __glibcxx_check_bucket_index(__b); return const_local_iterator(_Base::cend(__b), __b, this); } size_type bucket_size(size_type __b) const { __glibcxx_check_bucket_index(__b); return _Base::bucket_size(__b); } float max_load_factor() const noexcept { return _Base::max_load_factor(); } void max_load_factor(float __f) { __glibcxx_check_max_load_factor(__f); _Base::max_load_factor(__f); } template<typename... _Args> iterator emplace(_Args&&... __args) { size_type __bucket_count = this->bucket_count(); _Base_iterator __it = _Base::emplace(std::forward<_Args>(__args)...); _M_check_rehashed(__bucket_count); return iterator(__it, this); } template<typename... _Args> iterator emplace_hint(const_iterator __hint, _Args&&... __args) { __glibcxx_check_insert(__hint); size_type __bucket_count = this->bucket_count(); _Base_iterator __it = _Base::emplace_hint(__hint.base(), std::forward<_Args>(__args)...); _M_check_rehashed(__bucket_count); return iterator(__it, this); } iterator insert(const value_type& __obj) { size_type __bucket_count = this->bucket_count(); _Base_iterator __it = _Base::insert(__obj); _M_check_rehashed(__bucket_count); return iterator(__it, this); } iterator insert(const_iterator __hint, const value_type& __obj) { __glibcxx_check_insert(__hint); size_type __bucket_count = this->bucket_count(); _Base_iterator __it = _Base::insert(__hint.base(), __obj); _M_check_rehashed(__bucket_count); return iterator(__it, this); } template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> iterator insert(_Pair&& __obj) { size_type __bucket_count = this->bucket_count(); _Base_iterator __it = _Base::insert(std::forward<_Pair>(__obj)); _M_check_rehashed(__bucket_count); return iterator(__it, this); } template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> iterator insert(const_iterator __hint, _Pair&& __obj) { __glibcxx_check_insert(__hint); size_type __bucket_count = this->bucket_count(); _Base_iterator __it = _Base::insert(__hint.base(), std::forward<_Pair>(__obj)); _M_check_rehashed(__bucket_count); return iterator(__it, this); } void insert(std::initializer_list<value_type> __l) { _Base::insert(__l); } template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) { __glibcxx_check_valid_range(__first, __last); size_type __bucket_count = this->bucket_count(); _Base::insert(__gnu_debug::__base(__first), __gnu_debug::__base(__last)); _M_check_rehashed(__bucket_count); } iterator find(const key_type& __key) { return iterator(_Base::find(__key), this); } const_iterator find(const key_type& __key) const { return const_iterator(_Base::find(__key), this); } std::pair<iterator, iterator> equal_range(const key_type& __key) { std::pair<_Base_iterator, _Base_iterator> __res = _Base::equal_range(__key); return std::make_pair(iterator(__res.first, this), iterator(__res.second, this)); } std::pair<const_iterator, const_iterator> equal_range(const key_type& __key) const { std::pair<_Base_const_iterator, _Base_const_iterator> __res = _Base::equal_range(__key); return std::make_pair(const_iterator(__res.first, this), const_iterator(__res.second, this)); } size_type erase(const key_type& __key) { size_type __ret(0); size_type __bucket_count = this->bucket_count(); std::pair<_Base_iterator, _Base_iterator> __pair = _Base::equal_range(__key); for (_Base_iterator __victim = __pair.first; __victim != __pair.second;) { this->_M_invalidate_if([__victim](_Base_const_iterator __it) { return __it == __victim; }); this->_M_invalidate_local_if( [__victim](_Base_const_local_iterator __it) { return __it._M_cur == __victim._M_cur; }); _Base::erase(__victim++); ++__ret; } _M_check_rehashed(__bucket_count); return __ret; } iterator erase(const_iterator __it) { __glibcxx_check_erase(__it); _Base_const_iterator __victim = __it.base(); this->_M_invalidate_if([__victim](_Base_const_iterator __it) { return __it == __victim; }); this->_M_invalidate_local_if( [__victim](_Base_const_local_iterator __it) { return __it._M_cur == __victim._M_cur; }); size_type __bucket_count = this->bucket_count(); _Base_iterator __next = _Base::erase(__it.base()); _M_check_rehashed(__bucket_count); return iterator(__next, this); } iterator erase(iterator __it) { return erase(const_iterator(__it)); } iterator erase(const_iterator __first, const_iterator __last) { __glibcxx_check_erase_range(__first, __last); for (_Base_const_iterator __tmp = __first.base(); __tmp != __last.base(); ++__tmp) { _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::end(), _M_message(__gnu_debug::__msg_valid_range) ._M_iterator(__first, "first") ._M_iterator(__last, "last")); this->_M_invalidate_if([__tmp](_Base_const_iterator __it) { return __it == __tmp; }); this->_M_invalidate_local_if( [__tmp](_Base_const_local_iterator __it) { return __it._M_cur == __tmp._M_cur; }); } size_type __bucket_count = this->bucket_count(); _Base_iterator __next = _Base::erase(__first.base(), __last.base()); _M_check_rehashed(__bucket_count); return iterator(__next, this); } _Base& _M_base() noexcept { return *this; } const _Base& _M_base() const noexcept { return *this; } private: void _M_invalidate_locals() { _Base_local_iterator __local_end = _Base::end(0); this->_M_invalidate_local_if( [__local_end](_Base_const_local_iterator __it) { return __it != __local_end; }); } void _M_invalidate_all() { _Base_iterator __end = _Base::end(); this->_M_invalidate_if([__end](_Base_const_iterator __it) { return __it != __end; }); _M_invalidate_locals(); } void _M_check_rehashed(size_type __prev_count) { if (__prev_count != this->bucket_count()) _M_invalidate_locals(); } }; template<typename _Key, typename _Tp, typename _Hash, typename _Pred, typename _Alloc> inline void swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { __x.swap(__y); } template<typename _Key, typename _Tp, typename _Hash, typename _Pred, typename _Alloc> inline bool operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { return __x._M_base() == __y._M_base(); } template<typename _Key, typename _Tp, typename _Hash, typename _Pred, typename _Alloc> inline bool operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { return !(__x == __y); } } // namespace __debug } // namespace std #endif // C++11 #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/safe_base.h�������������������������������������������������������������������������0000644�����������������00000021103�14763166030�0010737 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Safe sequence/iterator base implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/safe_base.h * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_SAFE_BASE_H #define _GLIBCXX_DEBUG_SAFE_BASE_H 1 #include <ext/concurrence.h> namespace __gnu_debug { class _Safe_sequence_base; /** \brief Basic functionality for a @a safe iterator. * * The %_Safe_iterator_base base class implements the functionality * of a safe iterator that is not specific to a particular iterator * type. It contains a pointer back to the sequence it references * along with iterator version information and pointers to form a * doubly-linked list of iterators referenced by the container. * * This class must not perform any operations that can throw an * exception, or the exception guarantees of derived iterators will * be broken. */ class _Safe_iterator_base { public: /** The sequence this iterator references; may be NULL to indicate a singular iterator. */ _Safe_sequence_base* _M_sequence; /** The version number of this iterator. The sentinel value 0 is * used to indicate an invalidated iterator (i.e., one that is * singular because of an operation on the container). This * version number must equal the version number in the sequence * referenced by _M_sequence for the iterator to be * non-singular. */ unsigned int _M_version; /** Pointer to the previous iterator in the sequence's list of iterators. Only valid when _M_sequence != NULL. */ _Safe_iterator_base* _M_prior; /** Pointer to the next iterator in the sequence's list of iterators. Only valid when _M_sequence != NULL. */ _Safe_iterator_base* _M_next; protected: /** Initializes the iterator and makes it singular. */ _Safe_iterator_base() : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0) { } /** Initialize the iterator to reference the sequence pointed to * by @p __seq. @p __constant is true when we are initializing a * constant iterator, and false if it is a mutable iterator. Note * that @p __seq may be NULL, in which case the iterator will be * singular. Otherwise, the iterator will reference @p __seq and * be nonsingular. */ _Safe_iterator_base(const _Safe_sequence_base* __seq, bool __constant) : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0) { this->_M_attach(const_cast<_Safe_sequence_base*>(__seq), __constant); } /** Initializes the iterator to reference the same sequence that @p __x does. @p __constant is true if this is a constant iterator, and false if it is mutable. */ _Safe_iterator_base(const _Safe_iterator_base& __x, bool __constant) : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0) { this->_M_attach(__x._M_sequence, __constant); } _Safe_iterator_base& operator=(const _Safe_iterator_base&); explicit _Safe_iterator_base(const _Safe_iterator_base&); ~_Safe_iterator_base() { this->_M_detach(); } /** For use in _Safe_iterator. */ __gnu_cxx::__mutex& _M_get_mutex() throw (); public: /** Attaches this iterator to the given sequence, detaching it * from whatever sequence it was attached to originally. If the * new sequence is the NULL pointer, the iterator is left * unattached. */ void _M_attach(_Safe_sequence_base* __seq, bool __constant); /** Likewise, but not thread-safe. */ void _M_attach_single(_Safe_sequence_base* __seq, bool __constant) throw (); /** Detach the iterator for whatever sequence it is attached to, * if any. */ void _M_detach(); /** Likewise, but not thread-safe. */ void _M_detach_single() throw (); /** Determines if we are attached to the given sequence. */ bool _M_attached_to(const _Safe_sequence_base* __seq) const { return _M_sequence == __seq; } /** Is this iterator singular? */ _GLIBCXX_PURE bool _M_singular() const throw (); /** Can we compare this iterator to the given iterator @p __x? Returns true if both iterators are nonsingular and reference the same sequence. */ _GLIBCXX_PURE bool _M_can_compare(const _Safe_iterator_base& __x) const throw (); /** Invalidate the iterator, making it singular. */ void _M_invalidate() { _M_version = 0; } /** Reset all member variables */ void _M_reset() throw (); /** Unlink itself */ void _M_unlink() throw () { if (_M_prior) _M_prior->_M_next = _M_next; if (_M_next) _M_next->_M_prior = _M_prior; } }; /** * @brief Base class that supports tracking of iterators that * reference a sequence. * * The %_Safe_sequence_base class provides basic support for * tracking iterators into a sequence. Sequences that track * iterators must derived from %_Safe_sequence_base publicly, so * that safe iterators (which inherit _Safe_iterator_base) can * attach to them. This class contains two linked lists of * iterators, one for constant iterators and one for mutable * iterators, and a version number that allows very fast * invalidation of all iterators that reference the container. * * This class must ensure that no operation on it may throw an * exception, otherwise @a safe sequences may fail to provide the * exception-safety guarantees required by the C++ standard. */ class _Safe_sequence_base { public: /// The list of mutable iterators that reference this container _Safe_iterator_base* _M_iterators; /// The list of constant iterators that reference this container _Safe_iterator_base* _M_const_iterators; /// The container version number. This number may never be 0. mutable unsigned int _M_version; protected: // Initialize with a version number of 1 and no iterators _Safe_sequence_base() : _M_iterators(0), _M_const_iterators(0), _M_version(1) { } /** Notify all iterators that reference this sequence that the sequence is being destroyed. */ ~_Safe_sequence_base() { this->_M_detach_all(); } /** Detach all iterators, leaving them singular. */ void _M_detach_all(); /** Detach all singular iterators. * @post for all iterators i attached to this sequence, * i->_M_version == _M_version. */ void _M_detach_singular(); /** Revalidates all attached singular iterators. This method may * be used to validate iterators that were invalidated before * (but for some reason, such as an exception, need to become * valid again). */ void _M_revalidate_singular(); /** Swap this sequence with the given sequence. This operation * also swaps ownership of the iterators, so that when the * operation is complete all iterators that originally referenced * one container now reference the other container. */ void _M_swap(_Safe_sequence_base& __x); /** For use in _Safe_sequence. */ __gnu_cxx::__mutex& _M_get_mutex() throw (); public: /** Invalidates all iterators. */ void _M_invalidate_all() const { if (++_M_version == 0) _M_version = 1; } /** Attach an iterator to this sequence. */ void _M_attach(_Safe_iterator_base* __it, bool __constant); /** Likewise but not thread safe. */ void _M_attach_single(_Safe_iterator_base* __it, bool __constant) throw (); /** Detach an iterator from this sequence */ void _M_detach(_Safe_iterator_base* __it); /** Likewise but not thread safe. */ void _M_detach_single(_Safe_iterator_base* __it) throw (); }; } // namespace __gnu_debug #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/set.h�������������������������������������������������������������������������������0000644�����������������00000032722�14763166030�0007633 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debugging set implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/set.h * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_SET_H #define _GLIBCXX_DEBUG_SET_H 1 #include <debug/safe_sequence.h> #include <debug/safe_iterator.h> #include <utility> namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { /// Class std::set with safety/checking/debug instrumentation. template<typename _Key, typename _Compare = std::less<_Key>, typename _Allocator = std::allocator<_Key> > class set : public _GLIBCXX_STD_C::set<_Key,_Compare,_Allocator>, public __gnu_debug::_Safe_sequence<set<_Key, _Compare, _Allocator> > { typedef _GLIBCXX_STD_C::set<_Key, _Compare, _Allocator> _Base; typedef typename _Base::const_iterator _Base_const_iterator; typedef typename _Base::iterator _Base_iterator; typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; public: // types: typedef _Key key_type; typedef _Key value_type; typedef _Compare key_compare; typedef _Compare value_compare; typedef _Allocator allocator_type; typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef __gnu_debug::_Safe_iterator<_Base_iterator, set> iterator; typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, set> const_iterator; typedef typename _Base::size_type size_type; typedef typename _Base::difference_type difference_type; typedef typename _Base::pointer pointer; typedef typename _Base::const_pointer const_pointer; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // 23.3.3.1 construct/copy/destroy: explicit set(const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) : _Base(__comp, __a) { } template<typename _InputIterator> set(_InputIterator __first, _InputIterator __last, const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, __last)), __gnu_debug::__base(__last), __comp, __a) { } set(const set& __x) : _Base(__x) { } set(const _Base& __x) : _Base(__x) { } #if __cplusplus >= 201103L set(set&& __x) noexcept(is_nothrow_copy_constructible<_Compare>::value) : _Base(std::move(__x)) { this->_M_swap(__x); } set(initializer_list<value_type> __l, const _Compare& __comp = _Compare(), const allocator_type& __a = allocator_type()) : _Base(__l, __comp, __a) { } #endif ~set() _GLIBCXX_NOEXCEPT { } set& operator=(const set& __x) { *static_cast<_Base*>(this) = __x; this->_M_invalidate_all(); return *this; } #if __cplusplus >= 201103L set& operator=(set&& __x) { // NB: DR 1204. // NB: DR 675. __glibcxx_check_self_move_assign(__x); clear(); swap(__x); return *this; } set& operator=(initializer_list<value_type> __l) { this->clear(); this->insert(__l); return *this; } #endif using _Base::get_allocator; // iterators: iterator begin() _GLIBCXX_NOEXCEPT { return iterator(_Base::begin(), this); } const_iterator begin() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::begin(), this); } iterator end() _GLIBCXX_NOEXCEPT { return iterator(_Base::end(), this); } const_iterator end() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::end(), this); } reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(end()); } const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(end()); } reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(begin()); } const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(begin()); } #if __cplusplus >= 201103L const_iterator cbegin() const noexcept { return const_iterator(_Base::begin(), this); } const_iterator cend() const noexcept { return const_iterator(_Base::end(), this); } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } #endif // capacity: using _Base::empty; using _Base::size; using _Base::max_size; // modifiers: #if __cplusplus >= 201103L template<typename... _Args> std::pair<iterator, bool> emplace(_Args&&... __args) { auto __res = _Base::emplace(std::forward<_Args>(__args)...); return std::pair<iterator, bool>(iterator(__res.first, this), __res.second); } template<typename... _Args> iterator emplace_hint(const_iterator __pos, _Args&&... __args) { __glibcxx_check_insert(__pos); return iterator(_Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...), this); } #endif std::pair<iterator, bool> insert(const value_type& __x) { std::pair<_Base_iterator, bool> __res = _Base::insert(__x); return std::pair<iterator, bool>(iterator(__res.first, this), __res.second); } #if __cplusplus >= 201103L std::pair<iterator, bool> insert(value_type&& __x) { std::pair<_Base_iterator, bool> __res = _Base::insert(std::move(__x)); return std::pair<iterator, bool>(iterator(__res.first, this), __res.second); } #endif iterator insert(const_iterator __position, const value_type& __x) { __glibcxx_check_insert(__position); return iterator(_Base::insert(__position.base(), __x), this); } #if __cplusplus >= 201103L iterator insert(const_iterator __position, value_type&& __x) { __glibcxx_check_insert(__position); return iterator(_Base::insert(__position.base(), std::move(__x)), this); } #endif template <typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) { __glibcxx_check_valid_range(__first, __last); _Base::insert(__gnu_debug::__base(__first), __gnu_debug::__base(__last)); } #if __cplusplus >= 201103L void insert(initializer_list<value_type> __l) { _Base::insert(__l); } #endif #if __cplusplus >= 201103L iterator erase(const_iterator __position) { __glibcxx_check_erase(__position); this->_M_invalidate_if(_Equal(__position.base())); return iterator(_Base::erase(__position.base()), this); } #else void erase(iterator __position) { __glibcxx_check_erase(__position); this->_M_invalidate_if(_Equal(__position.base())); _Base::erase(__position.base()); } #endif size_type erase(const key_type& __x) { _Base_iterator __victim = _Base::find(__x); if (__victim == _Base::end()) return 0; else { this->_M_invalidate_if(_Equal(__victim)); _Base::erase(__victim); return 1; } } #if __cplusplus >= 201103L iterator erase(const_iterator __first, const_iterator __last) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container __glibcxx_check_erase_range(__first, __last); for (_Base_const_iterator __victim = __first.base(); __victim != __last.base(); ++__victim) { _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), _M_message(__gnu_debug::__msg_valid_range) ._M_iterator(__first, "first") ._M_iterator(__last, "last")); this->_M_invalidate_if(_Equal(__victim)); } return iterator(_Base::erase(__first.base(), __last.base()), this); } #else void erase(iterator __first, iterator __last) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container __glibcxx_check_erase_range(__first, __last); for (_Base_iterator __victim = __first.base(); __victim != __last.base(); ++__victim) { _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), _M_message(__gnu_debug::__msg_valid_range) ._M_iterator(__first, "first") ._M_iterator(__last, "last")); this->_M_invalidate_if(_Equal(__victim)); } _Base::erase(__first.base(), __last.base()); } #endif void swap(set& __x) { _Base::swap(__x); this->_M_swap(__x); } void clear() _GLIBCXX_NOEXCEPT { this->_M_invalidate_all(); _Base::clear(); } // observers: using _Base::key_comp; using _Base::value_comp; // set operations: iterator find(const key_type& __x) { return iterator(_Base::find(__x), this); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload const_iterator find(const key_type& __x) const { return const_iterator(_Base::find(__x), this); } using _Base::count; iterator lower_bound(const key_type& __x) { return iterator(_Base::lower_bound(__x), this); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload const_iterator lower_bound(const key_type& __x) const { return const_iterator(_Base::lower_bound(__x), this); } iterator upper_bound(const key_type& __x) { return iterator(_Base::upper_bound(__x), this); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload const_iterator upper_bound(const key_type& __x) const { return const_iterator(_Base::upper_bound(__x), this); } std::pair<iterator,iterator> equal_range(const key_type& __x) { std::pair<_Base_iterator, _Base_iterator> __res = _Base::equal_range(__x); return std::make_pair(iterator(__res.first, this), iterator(__res.second, this)); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload std::pair<const_iterator,const_iterator> equal_range(const key_type& __x) const { std::pair<_Base_iterator, _Base_iterator> __res = _Base::equal_range(__x); return std::make_pair(const_iterator(__res.first, this), const_iterator(__res.second, this)); } _Base& _M_base() _GLIBCXX_NOEXCEPT { return *this; } const _Base& _M_base() const _GLIBCXX_NOEXCEPT { return *this; } private: void _M_invalidate_all() { typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal; this->_M_invalidate_if(_Not_equal(_M_base().end())); } }; template<typename _Key, typename _Compare, typename _Allocator> inline bool operator==(const set<_Key, _Compare, _Allocator>& __lhs, const set<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() == __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator!=(const set<_Key, _Compare, _Allocator>& __lhs, const set<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() != __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator<(const set<_Key, _Compare, _Allocator>& __lhs, const set<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() < __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator<=(const set<_Key, _Compare, _Allocator>& __lhs, const set<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() <= __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator>=(const set<_Key, _Compare, _Allocator>& __lhs, const set<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() >= __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator>(const set<_Key, _Compare, _Allocator>& __lhs, const set<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() > __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> void swap(set<_Key, _Compare, _Allocator>& __x, set<_Key, _Compare, _Allocator>& __y) { return __x.swap(__y); } } // namespace __debug } // namespace std #endif ����������������������������������������������c++/4.8.2/debug/safe_unordered_container.tcc��������������������������������������������������������0000644�����������������00000006277�14763166030�0014417 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Safe container implementation -*- C++ -*- // Copyright (C) 2011-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/safe_unordered_container.tcc * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_SAFE_UNORDERED_CONTAINER_TCC #define _GLIBCXX_DEBUG_SAFE_UNORDERED_CONTAINER_TCC 1 namespace __gnu_debug { template<typename _Container> template<typename _Predicate> void _Safe_unordered_container<_Container>:: _M_invalidate_if(_Predicate __pred) { typedef typename _Container::iterator iterator; typedef typename _Container::const_iterator const_iterator; __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex()); for (_Safe_iterator_base* __iter = _M_iterators; __iter;) { iterator* __victim = static_cast<iterator*>(__iter); __iter = __iter->_M_next; if (!__victim->_M_singular() && __pred(__victim->base())) { __victim->_M_invalidate(); } } for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2;) { const_iterator* __victim = static_cast<const_iterator*>(__iter2); __iter2 = __iter2->_M_next; if (!__victim->_M_singular() && __pred(__victim->base())) { __victim->_M_invalidate(); } } } template<typename _Container> template<typename _Predicate> void _Safe_unordered_container<_Container>:: _M_invalidate_local_if(_Predicate __pred) { typedef typename _Container::local_iterator local_iterator; typedef typename _Container::const_local_iterator const_local_iterator; __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex()); for (_Safe_iterator_base* __iter = _M_local_iterators; __iter;) { local_iterator* __victim = static_cast<local_iterator*>(__iter); __iter = __iter->_M_next; if (!__victim->_M_singular() && __pred(__victim->base())) { __victim->_M_invalidate(); } } for (_Safe_iterator_base* __iter2 = _M_const_local_iterators; __iter2;) { const_local_iterator* __victim = static_cast<const_local_iterator*>(__iter2); __iter2 = __iter2->_M_next; if (!__victim->_M_singular() && __pred(__victim->base())) { __victim->_M_invalidate(); } } } } // namespace __gnu_debug #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/functions.h�������������������������������������������������������������������������0000644�����������������00000036132�14763166030�0011047 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debugging support implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/functions.h * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_FUNCTIONS_H #define _GLIBCXX_DEBUG_FUNCTIONS_H 1 #include <bits/c++config.h> #include <bits/stl_iterator_base_types.h> // for iterator_traits, categories and // _Iter_base #include <bits/cpp_type_traits.h> // for __is_integer #include <debug/formatter.h> namespace __gnu_debug { template<typename _Iterator, typename _Sequence> class _Safe_iterator; // An arbitrary iterator pointer is not singular. inline bool __check_singular_aux(const void*) { return false; } // We may have an iterator that derives from _Safe_iterator_base but isn't // a _Safe_iterator. template<typename _Iterator> inline bool __check_singular(_Iterator& __x) { return __check_singular_aux(&__x); } /** Non-NULL pointers are nonsingular. */ template<typename _Tp> inline bool __check_singular(const _Tp* __ptr) { return __ptr == 0; } /** Safe iterators know if they are singular. */ template<typename _Iterator, typename _Sequence> inline bool __check_singular(const _Safe_iterator<_Iterator, _Sequence>& __x) { return __x._M_singular(); } /** Assume that some arbitrary iterator is dereferenceable, because we can't prove that it isn't. */ template<typename _Iterator> inline bool __check_dereferenceable(_Iterator&) { return true; } /** Non-NULL pointers are dereferenceable. */ template<typename _Tp> inline bool __check_dereferenceable(const _Tp* __ptr) { return __ptr; } /** Safe iterators know if they are singular. */ template<typename _Iterator, typename _Sequence> inline bool __check_dereferenceable(const _Safe_iterator<_Iterator, _Sequence>& __x) { return __x._M_dereferenceable(); } /** If the distance between two random access iterators is * nonnegative, assume the range is valid. */ template<typename _RandomAccessIterator> inline bool __valid_range_aux2(const _RandomAccessIterator& __first, const _RandomAccessIterator& __last, std::random_access_iterator_tag) { return __last - __first >= 0; } /** Can't test for a valid range with input iterators, because * iteration may be destructive. So we just assume that the range * is valid. */ template<typename _InputIterator> inline bool __valid_range_aux2(const _InputIterator&, const _InputIterator&, std::input_iterator_tag) { return true; } /** We say that integral types for a valid range, and defer to other * routines to realize what to do with integral types instead of * iterators. */ template<typename _Integral> inline bool __valid_range_aux(const _Integral&, const _Integral&, std::__true_type) { return true; } /** We have iterators, so figure out what kind of iterators that are * to see if we can check the range ahead of time. */ template<typename _InputIterator> inline bool __valid_range_aux(const _InputIterator& __first, const _InputIterator& __last, std::__false_type) { return __valid_range_aux2(__first, __last, std::__iterator_category(__first)); } /** Don't know what these iterators are, or if they are even * iterators (we may get an integral type for InputIterator), so * see if they are integral and pass them on to the next phase * otherwise. */ template<typename _InputIterator> inline bool __valid_range(const _InputIterator& __first, const _InputIterator& __last) { typedef typename std::__is_integer<_InputIterator>::__type _Integral; return __valid_range_aux(__first, __last, _Integral()); } /** Safe iterators know how to check if they form a valid range. */ template<typename _Iterator, typename _Sequence> inline bool __valid_range(const _Safe_iterator<_Iterator, _Sequence>& __first, const _Safe_iterator<_Iterator, _Sequence>& __last) { return __first._M_valid_range(__last); } /** Safe local iterators know how to check if they form a valid range. */ template<typename _Iterator, typename _Sequence> inline bool __valid_range(const _Safe_local_iterator<_Iterator, _Sequence>& __first, const _Safe_local_iterator<_Iterator, _Sequence>& __last) { return __first._M_valid_range(__last); } /* Checks that [first, last) is a valid range, and then returns * __first. This routine is useful when we can't use a separate * assertion statement because, e.g., we are in a constructor. */ template<typename _InputIterator> inline _InputIterator __check_valid_range(const _InputIterator& __first, const _InputIterator& __last __attribute__((__unused__))) { __glibcxx_check_valid_range(__first, __last); return __first; } /** Checks that __s is non-NULL or __n == 0, and then returns __s. */ template<typename _CharT, typename _Integer> inline const _CharT* __check_string(const _CharT* __s, const _Integer& __n __attribute__((__unused__))) { #ifdef _GLIBCXX_DEBUG_PEDANTIC __glibcxx_assert(__s != 0 || __n == 0); #endif return __s; } /** Checks that __s is non-NULL and then returns __s. */ template<typename _CharT> inline const _CharT* __check_string(const _CharT* __s) { #ifdef _GLIBCXX_DEBUG_PEDANTIC __glibcxx_assert(__s != 0); #endif return __s; } // Can't check if an input iterator sequence is sorted, because we // can't step through the sequence. template<typename _InputIterator> inline bool __check_sorted_aux(const _InputIterator&, const _InputIterator&, std::input_iterator_tag) { return true; } // Can verify if a forward iterator sequence is in fact sorted using // std::__is_sorted template<typename _ForwardIterator> inline bool __check_sorted_aux(_ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag) { if (__first == __last) return true; _ForwardIterator __next = __first; for (++__next; __next != __last; __first = __next, ++__next) if (*__next < *__first) return false; return true; } // For performance reason, as the iterator range has been validated, check on // random access safe iterators is done using the base iterator. template<typename _Iterator, typename _Sequence> inline bool __check_sorted_aux(const _Safe_iterator<_Iterator, _Sequence>& __first, const _Safe_iterator<_Iterator, _Sequence>& __last, std::random_access_iterator_tag __tag) { return __check_sorted_aux(__first.base(), __last.base(), __tag); } // Can't check if an input iterator sequence is sorted, because we can't step // through the sequence. template<typename _InputIterator, typename _Predicate> inline bool __check_sorted_aux(const _InputIterator&, const _InputIterator&, _Predicate, std::input_iterator_tag) { return true; } // Can verify if a forward iterator sequence is in fact sorted using // std::__is_sorted template<typename _ForwardIterator, typename _Predicate> inline bool __check_sorted_aux(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, std::forward_iterator_tag) { if (__first == __last) return true; _ForwardIterator __next = __first; for (++__next; __next != __last; __first = __next, ++__next) if (__pred(*__next, *__first)) return false; return true; } // For performance reason, as the iterator range has been validated, check on // random access safe iterators is done using the base iterator. template<typename _Iterator, typename _Sequence, typename _Predicate> inline bool __check_sorted_aux(const _Safe_iterator<_Iterator, _Sequence>& __first, const _Safe_iterator<_Iterator, _Sequence>& __last, _Predicate __pred, std::random_access_iterator_tag __tag) { return __check_sorted_aux(__first.base(), __last.base(), __pred, __tag); } // Determine if a sequence is sorted. template<typename _InputIterator> inline bool __check_sorted(const _InputIterator& __first, const _InputIterator& __last) { // Verify that the < operator for elements in the sequence is a // StrictWeakOrdering by checking that it is irreflexive. __glibcxx_assert(__first == __last || !(*__first < *__first)); return __check_sorted_aux(__first, __last, std::__iterator_category(__first)); } template<typename _InputIterator, typename _Predicate> inline bool __check_sorted(const _InputIterator& __first, const _InputIterator& __last, _Predicate __pred) { // Verify that the predicate is StrictWeakOrdering by checking that it // is irreflexive. __glibcxx_assert(__first == __last || !__pred(*__first, *__first)); return __check_sorted_aux(__first, __last, __pred, std::__iterator_category(__first)); } template<typename _InputIterator> inline bool __check_sorted_set_aux(const _InputIterator& __first, const _InputIterator& __last, std::__true_type) { return __check_sorted(__first, __last); } template<typename _InputIterator> inline bool __check_sorted_set_aux(const _InputIterator&, const _InputIterator&, std::__false_type) { return true; } template<typename _InputIterator, typename _Predicate> inline bool __check_sorted_set_aux(const _InputIterator& __first, const _InputIterator& __last, _Predicate __pred, std::__true_type) { return __check_sorted(__first, __last, __pred); } template<typename _InputIterator, typename _Predicate> inline bool __check_sorted_set_aux(const _InputIterator&, const _InputIterator&, _Predicate, std::__false_type) { return true; } // ... special variant used in std::merge, std::includes, std::set_*. template<typename _InputIterator1, typename _InputIterator2> inline bool __check_sorted_set(const _InputIterator1& __first, const _InputIterator1& __last, const _InputIterator2&) { typedef typename std::iterator_traits<_InputIterator1>::value_type _ValueType1; typedef typename std::iterator_traits<_InputIterator2>::value_type _ValueType2; typedef typename std::__are_same<_ValueType1, _ValueType2>::__type _SameType; return __check_sorted_set_aux(__first, __last, _SameType()); } template<typename _InputIterator1, typename _InputIterator2, typename _Predicate> inline bool __check_sorted_set(const _InputIterator1& __first, const _InputIterator1& __last, const _InputIterator2&, _Predicate __pred) { typedef typename std::iterator_traits<_InputIterator1>::value_type _ValueType1; typedef typename std::iterator_traits<_InputIterator2>::value_type _ValueType2; typedef typename std::__are_same<_ValueType1, _ValueType2>::__type _SameType; return __check_sorted_set_aux(__first, __last, __pred, _SameType()); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 270. Binary search requirements overly strict // Determine if a sequence is partitioned w.r.t. this element. template<typename _ForwardIterator, typename _Tp> inline bool __check_partitioned_lower(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { while (__first != __last && *__first < __value) ++__first; if (__first != __last) { ++__first; while (__first != __last && !(*__first < __value)) ++__first; } return __first == __last; } template<typename _ForwardIterator, typename _Tp> inline bool __check_partitioned_upper(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { while (__first != __last && !(__value < *__first)) ++__first; if (__first != __last) { ++__first; while (__first != __last && __value < *__first) ++__first; } return __first == __last; } // Determine if a sequence is partitioned w.r.t. this element. template<typename _ForwardIterator, typename _Tp, typename _Pred> inline bool __check_partitioned_lower(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Pred __pred) { while (__first != __last && bool(__pred(*__first, __value))) ++__first; if (__first != __last) { ++__first; while (__first != __last && !bool(__pred(*__first, __value))) ++__first; } return __first == __last; } template<typename _ForwardIterator, typename _Tp, typename _Pred> inline bool __check_partitioned_upper(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Pred __pred) { while (__first != __last && !bool(__pred(__value, *__first))) ++__first; if (__first != __last) { ++__first; while (__first != __last && bool(__pred(__value, *__first))) ++__first; } return __first == __last; } // Helper struct to detect random access safe iterators. template<typename _Iterator> struct __is_safe_random_iterator { enum { __value = 0 }; typedef std::__false_type __type; }; template<typename _Iterator, typename _Sequence> struct __is_safe_random_iterator<_Safe_iterator<_Iterator, _Sequence> > : std::__are_same<std::random_access_iterator_tag, typename std::iterator_traits<_Iterator>:: iterator_category> { }; template<typename _Iterator> struct _Siter_base : std::_Iter_base<_Iterator, __is_safe_random_iterator<_Iterator>::__value> { }; /** Helper function to extract base iterator of random access safe iterator in order to reduce performance impact of debug mode. Limited to random access iterator because it is the only category for which it is possible to check for correct iterators order in the __valid_range function thanks to the < operator. */ template<typename _Iterator> inline typename _Siter_base<_Iterator>::iterator_type __base(_Iterator __it) { return _Siter_base<_Iterator>::_S_base(__it); } } // namespace __gnu_debug #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/safe_iterator.tcc�������������������������������������������������������������������0000644�����������������00000006706�14763166030�0012214 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debugging iterator implementation (out of line) -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/safe_iterator.tcc * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_SAFE_ITERATOR_TCC #define _GLIBCXX_DEBUG_SAFE_ITERATOR_TCC 1 namespace __gnu_debug { template<typename _Iterator, typename _Sequence> bool _Safe_iterator<_Iterator, _Sequence>:: _M_can_advance(const difference_type& __n) const { typedef typename _Sequence::const_iterator const_debug_iterator; typedef typename const_debug_iterator::iterator_type const_iterator; if (this->_M_singular()) return false; if (__n == 0) return true; if (__n < 0) { const_iterator __begin = _M_get_sequence()->_M_base().begin(); std::pair<difference_type, _Distance_precision> __dist = __get_distance(__begin, base()); bool __ok = ((__dist.second == __dp_exact && __dist.first >= -__n) || (__dist.second != __dp_exact && __dist.first > 0)); return __ok; } else { const_iterator __end = _M_get_sequence()->_M_base().end(); std::pair<difference_type, _Distance_precision> __dist = __get_distance(base(), __end); bool __ok = ((__dist.second == __dp_exact && __dist.first >= __n) || (__dist.second != __dp_exact && __dist.first > 0)); return __ok; } } template<typename _Iterator, typename _Sequence> template<typename _Other> bool _Safe_iterator<_Iterator, _Sequence>:: _M_valid_range(const _Safe_iterator<_Other, _Sequence>& __rhs) const { if (!_M_can_compare(__rhs)) return false; /* Determine if we can order the iterators without the help of the container */ std::pair<difference_type, _Distance_precision> __dist = __get_distance(base(), __rhs.base()); switch (__dist.second) { case __dp_equality: if (__dist.first == 0) return true; break; case __dp_sign: case __dp_exact: return __dist.first >= 0; } /* We can only test for equality, but check if one of the iterators is at an extreme. */ /* Optim for classic [begin, it) or [it, end) ranges, limit checks * when code is valid. Note, for the special case of forward_list, * before_begin replaces the role of begin. */ if (_M_is_beginnest() || __rhs._M_is_end()) return true; if (_M_is_end() || __rhs._M_is_beginnest()) return false; // Assume that this is a valid range; we can't check anything else return true; } } // namespace __gnu_debug #endif ����������������������������������������������������������c++/4.8.2/debug/set���������������������������������������������������������������������������������0000644�����������������00000002446�14763166030�0007405 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debugging set/multiset implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/set * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_SET #define _GLIBCXX_DEBUG_SET 1 #include <set> #include <debug/set.h> #include <debug/multiset.h> #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/safe_sequence.tcc�������������������������������������������������������������������0000644�����������������00000011377�14763166030�0012173 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Safe sequence implementation -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/safe_sequence.tcc * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_SAFE_SEQUENCE_TCC #define _GLIBCXX_DEBUG_SAFE_SEQUENCE_TCC 1 namespace __gnu_debug { template<typename _Sequence> template<typename _Predicate> void _Safe_sequence<_Sequence>:: _M_invalidate_if(_Predicate __pred) { typedef typename _Sequence::iterator iterator; typedef typename _Sequence::const_iterator const_iterator; __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex()); for (_Safe_iterator_base* __iter = _M_iterators; __iter;) { iterator* __victim = static_cast<iterator*>(__iter); __iter = __iter->_M_next; if (!__victim->_M_singular() && __pred(__victim->base())) { __victim->_M_invalidate(); } } for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2;) { const_iterator* __victim = static_cast<const_iterator*>(__iter2); __iter2 = __iter2->_M_next; if (!__victim->_M_singular() && __pred(__victim->base())) { __victim->_M_invalidate(); } } } template<typename _Sequence> template<typename _Predicate> void _Safe_sequence<_Sequence>:: _M_transfer_from_if(_Safe_sequence& __from, _Predicate __pred) { typedef typename _Sequence::iterator iterator; typedef typename _Sequence::const_iterator const_iterator; _Safe_iterator_base* __transfered_iterators = 0; _Safe_iterator_base* __transfered_const_iterators = 0; _Safe_iterator_base* __last_iterator = 0; _Safe_iterator_base* __last_const_iterator = 0; { // We lock __from first and detach iterator(s) to transfer __gnu_cxx::__scoped_lock sentry(__from._M_get_mutex()); for (_Safe_iterator_base* __iter = __from._M_iterators; __iter;) { iterator* __victim = static_cast<iterator*>(__iter); __iter = __iter->_M_next; if (!__victim->_M_singular() && __pred(__victim->base())) { __victim->_M_detach_single(); if (__transfered_iterators) { __victim->_M_next = __transfered_iterators; __transfered_iterators->_M_prior = __victim; } else __last_iterator = __victim; __victim->_M_sequence = this; __victim->_M_version = this->_M_version; __transfered_iterators = __victim; } } for (_Safe_iterator_base* __iter2 = __from._M_const_iterators; __iter2;) { const_iterator* __victim = static_cast<const_iterator*>(__iter2); __iter2 = __iter2->_M_next; if (!__victim->_M_singular() && __pred(__victim->base())) { __victim->_M_detach_single(); if (__transfered_const_iterators) { __victim->_M_next = __transfered_const_iterators; __transfered_const_iterators->_M_prior = __victim; } else __last_const_iterator = __victim; __victim->_M_sequence = this; __victim->_M_version = this->_M_version; __transfered_const_iterators = __victim; } } } // Now we can lock *this and add the transfered iterators if any if (__last_iterator || __last_const_iterator) { __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex()); if (__last_iterator) { if (this->_M_iterators) { this->_M_iterators->_M_prior = __last_iterator; __last_iterator->_M_next = this->_M_iterators; } this->_M_iterators = __transfered_iterators; } if (__last_const_iterator) { if (this->_M_const_iterators) { this->_M_const_iterators->_M_prior = __last_const_iterator; __last_const_iterator->_M_next = this->_M_const_iterators; } this->_M_const_iterators = __transfered_const_iterators; } } } } // namespace __gnu_debug #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/safe_local_iterator.tcc�������������������������������������������������������������0000644�����������������00000004626�14763166030�0013365 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debugging iterator implementation (out of line) -*- C++ -*- // Copyright (C) 2011-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/safe_local_iterator.tcc * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_SAFE_LOCAL_ITERATOR_TCC #define _GLIBCXX_DEBUG_SAFE_LOCAL_ITERATOR_TCC 1 namespace __gnu_debug { template<typename _Iterator, typename _Sequence> template<typename _Other> bool _Safe_local_iterator<_Iterator, _Sequence>:: _M_valid_range(const _Safe_local_iterator<_Other, _Sequence>& __rhs) const { if (!_M_can_compare(__rhs)) return false; if (_M_bucket != __rhs._M_bucket) return false; /* Determine if we can order the iterators without the help of the container */ std::pair<difference_type, _Distance_precision> __dist = __get_distance(base(), __rhs.base()); switch (__dist.second) { case __dp_equality: if (__dist.first == 0) return true; break; case __dp_sign: case __dp_exact: return __dist.first >= 0; } /* We can only test for equality, but check if one of the iterators is at an extreme. */ /* Optim for classic [begin, it) or [it, end) ranges, limit checks * when code is valid. */ if (_M_is_begin() || __rhs._M_is_end()) return true; if (_M_is_end() || __rhs._M_is_begin()) return false; // Assume that this is a valid range; we can't check anything else return true; } } // namespace __gnu_debug #endif ����������������������������������������������������������������������������������������������������������c++/4.8.2/debug/vector������������������������������������������������������������������������������0000644�����������������00000043100�14763166030�0010104 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debugging vector implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/vector * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_VECTOR #define _GLIBCXX_DEBUG_VECTOR 1 #include <vector> #include <utility> #include <debug/safe_sequence.h> #include <debug/safe_iterator.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { /// Class std::vector with safety/checking/debug instrumentation. template<typename _Tp, typename _Allocator = std::allocator<_Tp> > class vector : public _GLIBCXX_STD_C::vector<_Tp, _Allocator>, public __gnu_debug::_Safe_sequence<vector<_Tp, _Allocator> > { typedef _GLIBCXX_STD_C::vector<_Tp, _Allocator> _Base; typedef typename _Base::iterator _Base_iterator; typedef typename _Base::const_iterator _Base_const_iterator; typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; #if __cplusplus >= 201103L typedef __gnu_cxx::__alloc_traits<_Allocator> _Alloc_traits; #endif public: typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef __gnu_debug::_Safe_iterator<_Base_iterator,vector> iterator; typedef __gnu_debug::_Safe_iterator<_Base_const_iterator,vector> const_iterator; typedef typename _Base::size_type size_type; typedef typename _Base::difference_type difference_type; typedef _Tp value_type; typedef _Allocator allocator_type; typedef typename _Base::pointer pointer; typedef typename _Base::const_pointer const_pointer; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // 23.2.4.1 construct/copy/destroy: explicit vector(const _Allocator& __a = _Allocator()) : _Base(__a), _M_guaranteed_capacity(0) { } #if __cplusplus >= 201103L explicit vector(size_type __n, const _Allocator& __a = _Allocator()) : _Base(__n, __a), _M_guaranteed_capacity(__n) { } vector(size_type __n, const _Tp& __value, const _Allocator& __a = _Allocator()) : _Base(__n, __value, __a), _M_guaranteed_capacity(__n) { } #else explicit vector(size_type __n, const _Tp& __value = _Tp(), const _Allocator& __a = _Allocator()) : _Base(__n, __value, __a), _M_guaranteed_capacity(__n) { } #endif #if __cplusplus >= 201103L template<class _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<class _InputIterator> #endif vector(_InputIterator __first, _InputIterator __last, const _Allocator& __a = _Allocator()) : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, __last)), __gnu_debug::__base(__last), __a), _M_guaranteed_capacity(0) { _M_update_guaranteed_capacity(); } vector(const vector& __x) : _Base(__x), _M_guaranteed_capacity(__x.size()) { } /// Construction from a release-mode vector vector(const _Base& __x) : _Base(__x), _M_guaranteed_capacity(__x.size()) { } #if __cplusplus >= 201103L vector(vector&& __x) noexcept : _Base(std::move(__x)), _M_guaranteed_capacity(this->size()) { this->_M_swap(__x); __x._M_guaranteed_capacity = 0; } vector(const vector& __x, const allocator_type& __a) : _Base(__x, __a), _M_guaranteed_capacity(__x.size()) { } vector(vector&& __x, const allocator_type& __a) : _Base(std::move(__x), __a), _M_guaranteed_capacity(this->size()) { __x._M_invalidate_all(); __x._M_guaranteed_capacity = 0; } vector(initializer_list<value_type> __l, const allocator_type& __a = allocator_type()) : _Base(__l, __a), _M_guaranteed_capacity(__l.size()) { } #endif ~vector() _GLIBCXX_NOEXCEPT { } vector& operator=(const vector& __x) { static_cast<_Base&>(*this) = __x; this->_M_invalidate_all(); _M_update_guaranteed_capacity(); return *this; } #if __cplusplus >= 201103L vector& operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) { __glibcxx_check_self_move_assign(__x); _Base::operator=(std::move(__x)); this->_M_invalidate_all(); _M_update_guaranteed_capacity(); __x._M_invalidate_all(); __x._M_guaranteed_capacity = 0; return *this; } vector& operator=(initializer_list<value_type> __l) { static_cast<_Base&>(*this) = __l; this->_M_invalidate_all(); _M_update_guaranteed_capacity(); return *this; } #endif #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<typename _InputIterator> #endif void assign(_InputIterator __first, _InputIterator __last) { __glibcxx_check_valid_range(__first, __last); _Base::assign(__gnu_debug::__base(__first), __gnu_debug::__base(__last)); this->_M_invalidate_all(); _M_update_guaranteed_capacity(); } void assign(size_type __n, const _Tp& __u) { _Base::assign(__n, __u); this->_M_invalidate_all(); _M_update_guaranteed_capacity(); } #if __cplusplus >= 201103L void assign(initializer_list<value_type> __l) { _Base::assign(__l); this->_M_invalidate_all(); _M_update_guaranteed_capacity(); } #endif using _Base::get_allocator; // iterators: iterator begin() _GLIBCXX_NOEXCEPT { return iterator(_Base::begin(), this); } const_iterator begin() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::begin(), this); } iterator end() _GLIBCXX_NOEXCEPT { return iterator(_Base::end(), this); } const_iterator end() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::end(), this); } reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(end()); } const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(end()); } reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(begin()); } const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(begin()); } #if __cplusplus >= 201103L const_iterator cbegin() const noexcept { return const_iterator(_Base::begin(), this); } const_iterator cend() const noexcept { return const_iterator(_Base::end(), this); } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } #endif // 23.2.4.2 capacity: using _Base::size; using _Base::max_size; #if __cplusplus >= 201103L void resize(size_type __sz) { bool __realloc = _M_requires_reallocation(__sz); if (__sz < this->size()) this->_M_invalidate_after_nth(__sz); _Base::resize(__sz); if (__realloc) this->_M_invalidate_all(); _M_update_guaranteed_capacity(); } void resize(size_type __sz, const _Tp& __c) { bool __realloc = _M_requires_reallocation(__sz); if (__sz < this->size()) this->_M_invalidate_after_nth(__sz); _Base::resize(__sz, __c); if (__realloc) this->_M_invalidate_all(); _M_update_guaranteed_capacity(); } #else void resize(size_type __sz, _Tp __c = _Tp()) { bool __realloc = _M_requires_reallocation(__sz); if (__sz < this->size()) this->_M_invalidate_after_nth(__sz); _Base::resize(__sz, __c); if (__realloc) this->_M_invalidate_all(); _M_update_guaranteed_capacity(); } #endif #if __cplusplus >= 201103L void shrink_to_fit() { if (_Base::_M_shrink_to_fit()) { _M_guaranteed_capacity = _Base::capacity(); this->_M_invalidate_all(); } } #endif size_type capacity() const _GLIBCXX_NOEXCEPT { #ifdef _GLIBCXX_DEBUG_PEDANTIC return _M_guaranteed_capacity; #else return _Base::capacity(); #endif } using _Base::empty; void reserve(size_type __n) { bool __realloc = _M_requires_reallocation(__n); _Base::reserve(__n); if (__n > _M_guaranteed_capacity) _M_guaranteed_capacity = __n; if (__realloc) this->_M_invalidate_all(); } // element access: reference operator[](size_type __n) { __glibcxx_check_subscript(__n); return _M_base()[__n]; } const_reference operator[](size_type __n) const { __glibcxx_check_subscript(__n); return _M_base()[__n]; } using _Base::at; reference front() { __glibcxx_check_nonempty(); return _Base::front(); } const_reference front() const { __glibcxx_check_nonempty(); return _Base::front(); } reference back() { __glibcxx_check_nonempty(); return _Base::back(); } const_reference back() const { __glibcxx_check_nonempty(); return _Base::back(); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 464. Suggestion for new member functions in standard containers. using _Base::data; // 23.2.4.3 modifiers: void push_back(const _Tp& __x) { bool __realloc = _M_requires_reallocation(this->size() + 1); _Base::push_back(__x); if (__realloc) this->_M_invalidate_all(); _M_update_guaranteed_capacity(); } #if __cplusplus >= 201103L template<typename _Up = _Tp> typename __gnu_cxx::__enable_if<!std::__are_same<_Up, bool>::__value, void>::__type push_back(_Tp&& __x) { emplace_back(std::move(__x)); } template<typename... _Args> void emplace_back(_Args&&... __args) { bool __realloc = _M_requires_reallocation(this->size() + 1); _Base::emplace_back(std::forward<_Args>(__args)...); if (__realloc) this->_M_invalidate_all(); _M_update_guaranteed_capacity(); } #endif void pop_back() { __glibcxx_check_nonempty(); this->_M_invalidate_if(_Equal(--_Base::end())); _Base::pop_back(); } #if __cplusplus >= 201103L template<typename... _Args> iterator emplace(iterator __position, _Args&&... __args) { __glibcxx_check_insert(__position); bool __realloc = _M_requires_reallocation(this->size() + 1); difference_type __offset = __position.base() - _Base::begin(); _Base_iterator __res = _Base::emplace(__position.base(), std::forward<_Args>(__args)...); if (__realloc) this->_M_invalidate_all(); else this->_M_invalidate_after_nth(__offset); _M_update_guaranteed_capacity(); return iterator(__res, this); } #endif iterator insert(iterator __position, const _Tp& __x) { __glibcxx_check_insert(__position); bool __realloc = _M_requires_reallocation(this->size() + 1); difference_type __offset = __position.base() - _Base::begin(); _Base_iterator __res = _Base::insert(__position.base(), __x); if (__realloc) this->_M_invalidate_all(); else this->_M_invalidate_after_nth(__offset); _M_update_guaranteed_capacity(); return iterator(__res, this); } #if __cplusplus >= 201103L template<typename _Up = _Tp> typename __gnu_cxx::__enable_if<!std::__are_same<_Up, bool>::__value, iterator>::__type insert(iterator __position, _Tp&& __x) { return emplace(__position, std::move(__x)); } void insert(iterator __position, initializer_list<value_type> __l) { this->insert(__position, __l.begin(), __l.end()); } #endif void insert(iterator __position, size_type __n, const _Tp& __x) { __glibcxx_check_insert(__position); bool __realloc = _M_requires_reallocation(this->size() + __n); difference_type __offset = __position.base() - _Base::begin(); _Base::insert(__position.base(), __n, __x); if (__realloc) this->_M_invalidate_all(); else this->_M_invalidate_after_nth(__offset); _M_update_guaranteed_capacity(); } #if __cplusplus >= 201103L template<class _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<class _InputIterator> #endif void insert(iterator __position, _InputIterator __first, _InputIterator __last) { __glibcxx_check_insert_range(__position, __first, __last); /* Hard to guess if invalidation will occur, because __last - __first can't be calculated in all cases, so we just punt here by checking if it did occur. */ _Base_iterator __old_begin = _M_base().begin(); difference_type __offset = __position.base() - _Base::begin(); _Base::insert(__position.base(), __gnu_debug::__base(__first), __gnu_debug::__base(__last)); if (_M_base().begin() != __old_begin) this->_M_invalidate_all(); else this->_M_invalidate_after_nth(__offset); _M_update_guaranteed_capacity(); } iterator erase(iterator __position) { __glibcxx_check_erase(__position); difference_type __offset = __position.base() - _Base::begin(); _Base_iterator __res = _Base::erase(__position.base()); this->_M_invalidate_after_nth(__offset); return iterator(__res, this); } iterator erase(iterator __first, iterator __last) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container __glibcxx_check_erase_range(__first, __last); if (__first.base() != __last.base()) { difference_type __offset = __first.base() - _Base::begin(); _Base_iterator __res = _Base::erase(__first.base(), __last.base()); this->_M_invalidate_after_nth(__offset); return iterator(__res, this); } else return __first; } void swap(vector& __x) #if __cplusplus >= 201103L noexcept(_Alloc_traits::_S_nothrow_swap()) #endif { #if __cplusplus >= 201103L if (!_Alloc_traits::_S_propagate_on_swap()) __glibcxx_check_equal_allocs(__x); #endif _Base::swap(__x); this->_M_swap(__x); std::swap(_M_guaranteed_capacity, __x._M_guaranteed_capacity); } void clear() _GLIBCXX_NOEXCEPT { _Base::clear(); this->_M_invalidate_all(); _M_guaranteed_capacity = 0; } _Base& _M_base() _GLIBCXX_NOEXCEPT { return *this; } const _Base& _M_base() const _GLIBCXX_NOEXCEPT { return *this; } private: size_type _M_guaranteed_capacity; bool _M_requires_reallocation(size_type __elements) { return __elements > this->capacity(); } void _M_update_guaranteed_capacity() { if (this->size() > _M_guaranteed_capacity) _M_guaranteed_capacity = this->size(); } void _M_invalidate_after_nth(difference_type __n) { typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth; this->_M_invalidate_if(_After_nth(__n, _Base::begin())); } }; template<typename _Tp, typename _Alloc> inline bool operator==(const vector<_Tp, _Alloc>& __lhs, const vector<_Tp, _Alloc>& __rhs) { return __lhs._M_base() == __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator!=(const vector<_Tp, _Alloc>& __lhs, const vector<_Tp, _Alloc>& __rhs) { return __lhs._M_base() != __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator<(const vector<_Tp, _Alloc>& __lhs, const vector<_Tp, _Alloc>& __rhs) { return __lhs._M_base() < __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator<=(const vector<_Tp, _Alloc>& __lhs, const vector<_Tp, _Alloc>& __rhs) { return __lhs._M_base() <= __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator>=(const vector<_Tp, _Alloc>& __lhs, const vector<_Tp, _Alloc>& __rhs) { return __lhs._M_base() >= __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator>(const vector<_Tp, _Alloc>& __lhs, const vector<_Tp, _Alloc>& __rhs) { return __lhs._M_base() > __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline void swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs) { __lhs.swap(__rhs); } } // namespace __debug #if __cplusplus >= 201103L // DR 1182. /// std::hash specialization for vector<bool>. template<typename _Alloc> struct hash<__debug::vector<bool, _Alloc>> : public __hash_base<size_t, __debug::vector<bool, _Alloc>> { size_t operator()(const __debug::vector<bool, _Alloc>& __b) const noexcept { return std::hash<_GLIBCXX_STD_C::vector<bool, _Alloc>>() (__b._M_base()); } }; #endif } // namespace std #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/macros.h����������������������������������������������������������������������������0000644�����������������00000036637�14763166030�0010335 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debugging support implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/macros.h * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_MACROS_H #define _GLIBCXX_DEBUG_MACROS_H 1 /** * Macros used by the implementation to verify certain * properties. These macros may only be used directly by the debug * wrappers. Note that these are macros (instead of the more obviously * @a correct choice of making them functions) because we need line and * file information at the call site, to minimize the distance between * the user error and where the error is reported. * */ #define _GLIBCXX_DEBUG_VERIFY_AT(_Condition,_ErrorMessage,_File,_Line) \ do \ { \ if (! (_Condition)) \ __gnu_debug::_Error_formatter::_M_at(_File, _Line) \ ._ErrorMessage._M_error(); \ } while (false) #define _GLIBCXX_DEBUG_VERIFY(_Condition,_ErrorMessage) \ _GLIBCXX_DEBUG_VERIFY_AT(_Condition,_ErrorMessage,__FILE__,__LINE__) // Verify that [_First, _Last) forms a valid iterator range. #define __glibcxx_check_valid_range(_First,_Last) \ _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__valid_range(_First, _Last), \ _M_message(__gnu_debug::__msg_valid_range) \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last)) // Verify that [_First, _Last) forms a non-empty iterator range. #define __glibcxx_check_non_empty_range(_First,_Last) \ _GLIBCXX_DEBUG_VERIFY(_First != _Last, \ _M_message(__gnu_debug::__msg_non_empty_range) \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last)) /** Verify that we can insert into *this with the iterator _Position. * Insertion into a container at a specific position requires that * the iterator be nonsingular, either dereferenceable or past-the-end, * and that it reference the sequence we are inserting into. Note that * this macro is only valid when the container is a_Safe_sequence and * the iterator is a _Safe_iterator. */ #define __glibcxx_check_insert(_Position) \ _GLIBCXX_DEBUG_VERIFY(!_Position._M_singular(), \ _M_message(__gnu_debug::__msg_insert_singular) \ ._M_sequence(*this, "this") \ ._M_iterator(_Position, #_Position)); \ _GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \ _M_message(__gnu_debug::__msg_insert_different) \ ._M_sequence(*this, "this") \ ._M_iterator(_Position, #_Position)) /** Verify that we can insert into *this after the iterator _Position. * Insertion into a container after a specific position requires that * the iterator be nonsingular, either dereferenceable or before-begin, * and that it reference the sequence we are inserting into. Note that * this macro is only valid when the container is a_Safe_sequence and * the iterator is a _Safe_iterator. */ #define __glibcxx_check_insert_after(_Position) \ __glibcxx_check_insert(_Position); \ _GLIBCXX_DEBUG_VERIFY(!_Position._M_is_end(), \ _M_message(__gnu_debug::__msg_insert_after_end) \ ._M_sequence(*this, "this") \ ._M_iterator(_Position, #_Position)) /** Verify that we can insert the values in the iterator range * [_First, _Last) into *this with the iterator _Position. Insertion * into a container at a specific position requires that the iterator * be nonsingular (i.e., either dereferenceable or past-the-end), * that it reference the sequence we are inserting into, and that the * iterator range [_First, Last) is a valid (possibly empty) * range. Note that this macro is only valid when the container is a * _Safe_sequence and the iterator is a _Safe_iterator. * * @todo We would like to be able to check for noninterference of * _Position and the range [_First, _Last), but that can't (in * general) be done. */ #define __glibcxx_check_insert_range(_Position,_First,_Last) \ __glibcxx_check_valid_range(_First,_Last); \ __glibcxx_check_insert(_Position) /** Verify that we can insert the values in the iterator range * [_First, _Last) into *this after the iterator _Position. Insertion * into a container after a specific position requires that the iterator * be nonsingular (i.e., either dereferenceable or past-the-end), * that it reference the sequence we are inserting into, and that the * iterator range [_First, Last) is a valid (possibly empty) * range. Note that this macro is only valid when the container is a * _Safe_sequence and the iterator is a _Safe_iterator. * * @todo We would like to be able to check for noninterference of * _Position and the range [_First, _Last), but that can't (in * general) be done. */ #define __glibcxx_check_insert_range_after(_Position,_First,_Last) \ __glibcxx_check_valid_range(_First,_Last); \ __glibcxx_check_insert_after(_Position) /** Verify that we can erase the element referenced by the iterator * _Position. We can erase the element if the _Position iterator is * dereferenceable and references this sequence. */ #define __glibcxx_check_erase(_Position) \ _GLIBCXX_DEBUG_VERIFY(_Position._M_dereferenceable(), \ _M_message(__gnu_debug::__msg_erase_bad) \ ._M_sequence(*this, "this") \ ._M_iterator(_Position, #_Position)); \ _GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \ _M_message(__gnu_debug::__msg_erase_different) \ ._M_sequence(*this, "this") \ ._M_iterator(_Position, #_Position)) /** Verify that we can erase the element after the iterator * _Position. We can erase the element if the _Position iterator is * before a dereferenceable one and references this sequence. */ #define __glibcxx_check_erase_after(_Position) \ _GLIBCXX_DEBUG_VERIFY(_Position._M_before_dereferenceable(), \ _M_message(__gnu_debug::__msg_erase_after_bad) \ ._M_sequence(*this, "this") \ ._M_iterator(_Position, #_Position)); \ _GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \ _M_message(__gnu_debug::__msg_erase_different) \ ._M_sequence(*this, "this") \ ._M_iterator(_Position, #_Position)) /** Verify that we can erase the elements in the iterator range * [_First, _Last). We can erase the elements if [_First, _Last) is a * valid iterator range within this sequence. */ #define __glibcxx_check_erase_range(_First,_Last) \ __glibcxx_check_valid_range(_First,_Last); \ _GLIBCXX_DEBUG_VERIFY(_First._M_attached_to(this), \ _M_message(__gnu_debug::__msg_erase_different) \ ._M_sequence(*this, "this") \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last)) /** Verify that we can erase the elements in the iterator range * (_First, _Last). We can erase the elements if (_First, _Last) is a * valid iterator range within this sequence. */ #define __glibcxx_check_erase_range_after(_First,_Last) \ _GLIBCXX_DEBUG_VERIFY(_First._M_can_compare(_Last), \ _M_message(__gnu_debug::__msg_erase_different) \ ._M_sequence(*this, "this") \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last)); \ _GLIBCXX_DEBUG_VERIFY(_First._M_attached_to(this), \ _M_message(__gnu_debug::__msg_erase_different) \ ._M_sequence(*this, "this") \ ._M_iterator(_First, #_First)); \ _GLIBCXX_DEBUG_VERIFY(_First != _Last, \ _M_message(__gnu_debug::__msg_valid_range2) \ ._M_sequence(*this, "this") \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last)); \ _GLIBCXX_DEBUG_VERIFY(_First._M_incrementable(), \ _M_message(__gnu_debug::__msg_valid_range2) \ ._M_sequence(*this, "this") \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last)); \ _GLIBCXX_DEBUG_VERIFY(!_Last._M_is_before_begin(), \ _M_message(__gnu_debug::__msg_valid_range2) \ ._M_sequence(*this, "this") \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last)) \ // Verify that the subscript _N is less than the container's size. #define __glibcxx_check_subscript(_N) \ _GLIBCXX_DEBUG_VERIFY(_N < this->size(), \ _M_message(__gnu_debug::__msg_subscript_oob) \ ._M_sequence(*this, "this") \ ._M_integer(_N, #_N) \ ._M_integer(this->size(), "size")) // Verify that the bucket _N is less than the container's buckets count. #define __glibcxx_check_bucket_index(_N) \ _GLIBCXX_DEBUG_VERIFY(_N < this->bucket_count(), \ _M_message(__gnu_debug::__msg_bucket_index_oob) \ ._M_sequence(*this, "this") \ ._M_integer(_N, #_N) \ ._M_integer(this->bucket_count(), "size")) // Verify that the container is nonempty #define __glibcxx_check_nonempty() \ _GLIBCXX_DEBUG_VERIFY(! this->empty(), \ _M_message(__gnu_debug::__msg_empty) \ ._M_sequence(*this, "this")) // Verify that the iterator range [_First, _Last) is sorted #define __glibcxx_check_sorted(_First,_Last) \ __glibcxx_check_valid_range(_First,_Last); \ _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted(_First, _Last), \ _M_message(__gnu_debug::__msg_unsorted) \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last)) /** Verify that the iterator range [_First, _Last) is sorted by the predicate _Pred. */ #define __glibcxx_check_sorted_pred(_First,_Last,_Pred) \ __glibcxx_check_valid_range(_First,_Last); \ _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted(_First, _Last, _Pred), \ _M_message(__gnu_debug::__msg_unsorted_pred) \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last) \ ._M_string(#_Pred)) // Special variant for std::merge, std::includes, std::set_* #define __glibcxx_check_sorted_set(_First1,_Last1,_First2) \ __glibcxx_check_valid_range(_First1,_Last1); \ _GLIBCXX_DEBUG_VERIFY( \ __gnu_debug::__check_sorted_set(_First1, _Last1, _First2), \ _M_message(__gnu_debug::__msg_unsorted) \ ._M_iterator(_First1, #_First1) \ ._M_iterator(_Last1, #_Last1)) // Likewise with a _Pred. #define __glibcxx_check_sorted_set_pred(_First1,_Last1,_First2,_Pred) \ __glibcxx_check_valid_range(_First1,_Last1); \ _GLIBCXX_DEBUG_VERIFY( \ __gnu_debug::__check_sorted_set(_First1, _Last1, _First2, _Pred), \ _M_message(__gnu_debug::__msg_unsorted_pred) \ ._M_iterator(_First1, #_First1) \ ._M_iterator(_Last1, #_Last1) \ ._M_string(#_Pred)) /** Verify that the iterator range [_First, _Last) is partitioned w.r.t. the value _Value. */ #define __glibcxx_check_partitioned_lower(_First,_Last,_Value) \ __glibcxx_check_valid_range(_First,_Last); \ _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \ __gnu_debug::__base(_First), \ __gnu_debug::__base(_Last), _Value), \ _M_message(__gnu_debug::__msg_unpartitioned) \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last) \ ._M_string(#_Value)) #define __glibcxx_check_partitioned_upper(_First,_Last,_Value) \ __glibcxx_check_valid_range(_First,_Last); \ _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \ __gnu_debug::__base(_First), \ __gnu_debug::__base(_Last), _Value), \ _M_message(__gnu_debug::__msg_unpartitioned) \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last) \ ._M_string(#_Value)) /** Verify that the iterator range [_First, _Last) is partitioned w.r.t. the value _Value and predicate _Pred. */ #define __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred) \ __glibcxx_check_valid_range(_First,_Last); \ _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \ __gnu_debug::__base(_First), \ __gnu_debug::__base(_Last), _Value, _Pred), \ _M_message(__gnu_debug::__msg_unpartitioned_pred) \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last) \ ._M_string(#_Pred) \ ._M_string(#_Value)) /** Verify that the iterator range [_First, _Last) is partitioned w.r.t. the value _Value and predicate _Pred. */ #define __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred) \ __glibcxx_check_valid_range(_First,_Last); \ _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \ __gnu_debug::__base(_First), \ __gnu_debug::__base(_Last), _Value, _Pred), \ _M_message(__gnu_debug::__msg_unpartitioned_pred) \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last) \ ._M_string(#_Pred) \ ._M_string(#_Value)) // Verify that the iterator range [_First, _Last) is a heap #define __glibcxx_check_heap(_First,_Last) \ _GLIBCXX_DEBUG_VERIFY(std::__is_heap(__gnu_debug::__base(_First), \ __gnu_debug::__base(_Last)), \ _M_message(__gnu_debug::__msg_not_heap) \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last)) /** Verify that the iterator range [_First, _Last) is a heap w.r.t. the predicate _Pred. */ #define __glibcxx_check_heap_pred(_First,_Last,_Pred) \ _GLIBCXX_DEBUG_VERIFY(std::__is_heap(__gnu_debug::__base(_First), \ __gnu_debug::__base(_Last), \ _Pred), \ _M_message(__gnu_debug::__msg_not_heap_pred) \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last) \ ._M_string(#_Pred)) // Verify that the container is not self move assigned #define __glibcxx_check_self_move_assign(_Other) \ _GLIBCXX_DEBUG_VERIFY(this != &_Other, \ _M_message(__gnu_debug::__msg_self_move_assign) \ ._M_sequence(*this, "this")) // Verify that load factor is position #define __glibcxx_check_max_load_factor(_F) \ _GLIBCXX_DEBUG_VERIFY(_F > 0.0f, \ _M_message(__gnu_debug::__msg_valid_load_factor) \ ._M_sequence(*this, "this")) #define __glibcxx_check_equal_allocs(_Other) \ _GLIBCXX_DEBUG_VERIFY(this->get_allocator() == _Other.get_allocator(), \ _M_message(__gnu_debug::__msg_equal_allocs) \ ._M_sequence(*this, "this")) #ifdef _GLIBCXX_DEBUG_PEDANTIC # define __glibcxx_check_string(_String) _GLIBCXX_DEBUG_ASSERT(_String != 0) # define __glibcxx_check_string_len(_String,_Len) \ _GLIBCXX_DEBUG_ASSERT(_String != 0 || _Len == 0) #else # define __glibcxx_check_string(_String) # define __glibcxx_check_string_len(_String,_Len) #endif #endif �������������������������������������������������������������������������������������������������c++/4.8.2/debug/formatter.h�������������������������������������������������������������������������0000644�����������������00000031666�14763166030�0011051 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debug-mode error formatting implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/formatter.h * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_FORMATTER_H #define _GLIBCXX_DEBUG_FORMATTER_H 1 #include <bits/c++config.h> #include <bits/cpp_type_traits.h> #include <typeinfo> namespace __gnu_debug { using std::type_info; template<typename _Iterator> bool __check_singular(_Iterator&); class _Safe_sequence_base; template<typename _Iterator, typename _Sequence> class _Safe_iterator; template<typename _Iterator, typename _Sequence> class _Safe_local_iterator; template<typename _Sequence> class _Safe_sequence; enum _Debug_msg_id { // General checks __msg_valid_range, __msg_insert_singular, __msg_insert_different, __msg_erase_bad, __msg_erase_different, __msg_subscript_oob, __msg_empty, __msg_unpartitioned, __msg_unpartitioned_pred, __msg_unsorted, __msg_unsorted_pred, __msg_not_heap, __msg_not_heap_pred, // std::bitset checks __msg_bad_bitset_write, __msg_bad_bitset_read, __msg_bad_bitset_flip, // std::list checks __msg_self_splice, __msg_splice_alloc, __msg_splice_bad, __msg_splice_other, __msg_splice_overlap, // iterator checks __msg_init_singular, __msg_init_copy_singular, __msg_init_const_singular, __msg_copy_singular, __msg_bad_deref, __msg_bad_inc, __msg_bad_dec, __msg_iter_subscript_oob, __msg_advance_oob, __msg_retreat_oob, __msg_iter_compare_bad, __msg_compare_different, __msg_iter_order_bad, __msg_order_different, __msg_distance_bad, __msg_distance_different, // istream_iterator __msg_deref_istream, __msg_inc_istream, // ostream_iterator __msg_output_ostream, // istreambuf_iterator __msg_deref_istreambuf, __msg_inc_istreambuf, // forward_list __msg_insert_after_end, __msg_erase_after_bad, __msg_valid_range2, // unordered container local iterators __msg_local_iter_compare_bad, __msg_non_empty_range, // self move assign __msg_self_move_assign, // unordered container buckets __msg_bucket_index_oob, __msg_valid_load_factor, __msg_equal_allocs }; class _Error_formatter { /// Whether an iterator is constant, mutable, or unknown enum _Constness { __unknown_constness, __const_iterator, __mutable_iterator, __last_constness }; // The state of the iterator (fine-grained), if we know it. enum _Iterator_state { __unknown_state, __singular, // singular, may still be attached to a sequence __begin, // dereferenceable, and at the beginning __middle, // dereferenceable, not at the beginning __end, // past-the-end, may be at beginning if sequence empty __before_begin, // before begin __last_state }; // Tags denoting the type of parameter for construction struct _Is_iterator { }; struct _Is_sequence { }; // A parameter that may be referenced by an error message struct _Parameter { enum { __unused_param, __iterator, __sequence, __integer, __string } _M_kind; union { // When _M_kind == __iterator struct { const char* _M_name; const void* _M_address; const type_info* _M_type; _Constness _M_constness; _Iterator_state _M_state; const void* _M_sequence; const type_info* _M_seq_type; } _M_iterator; // When _M_kind == __sequence struct { const char* _M_name; const void* _M_address; const type_info* _M_type; } _M_sequence; // When _M_kind == __integer struct { const char* _M_name; long _M_value; } _M_integer; // When _M_kind == __string struct { const char* _M_name; const char* _M_value; } _M_string; } _M_variant; _Parameter() : _M_kind(__unused_param), _M_variant() { } _Parameter(long __value, const char* __name) : _M_kind(__integer), _M_variant() { _M_variant._M_integer._M_name = __name; _M_variant._M_integer._M_value = __value; } _Parameter(const char* __value, const char* __name) : _M_kind(__string), _M_variant() { _M_variant._M_string._M_name = __name; _M_variant._M_string._M_value = __value; } template<typename _Iterator, typename _Sequence> _Parameter(const _Safe_iterator<_Iterator, _Sequence>& __it, const char* __name, _Is_iterator) : _M_kind(__iterator), _M_variant() { _M_variant._M_iterator._M_name = __name; _M_variant._M_iterator._M_address = &__it; #ifdef __GXX_RTTI _M_variant._M_iterator._M_type = &typeid(__it); #else _M_variant._M_iterator._M_type = 0; #endif _M_variant._M_iterator._M_constness = std::__are_same<_Safe_iterator<_Iterator, _Sequence>, typename _Sequence::iterator>:: __value ? __mutable_iterator : __const_iterator; _M_variant._M_iterator._M_sequence = __it._M_get_sequence(); #ifdef __GXX_RTTI _M_variant._M_iterator._M_seq_type = &typeid(_Sequence); #else _M_variant._M_iterator._M_seq_type = 0; #endif if (__it._M_singular()) _M_variant._M_iterator._M_state = __singular; else { if (__it._M_is_before_begin()) _M_variant._M_iterator._M_state = __before_begin; else if (__it._M_is_end()) _M_variant._M_iterator._M_state = __end; else if (__it._M_is_begin()) _M_variant._M_iterator._M_state = __begin; else _M_variant._M_iterator._M_state = __middle; } } template<typename _Iterator, typename _Sequence> _Parameter(const _Safe_local_iterator<_Iterator, _Sequence>& __it, const char* __name, _Is_iterator) : _M_kind(__iterator), _M_variant() { _M_variant._M_iterator._M_name = __name; _M_variant._M_iterator._M_address = &__it; #ifdef __GXX_RTTI _M_variant._M_iterator._M_type = &typeid(__it); #else _M_variant._M_iterator._M_type = 0; #endif _M_variant._M_iterator._M_constness = std::__are_same<_Safe_local_iterator<_Iterator, _Sequence>, typename _Sequence::local_iterator>:: __value ? __mutable_iterator : __const_iterator; _M_variant._M_iterator._M_sequence = __it._M_get_sequence(); #ifdef __GXX_RTTI _M_variant._M_iterator._M_seq_type = &typeid(_Sequence); #else _M_variant._M_iterator._M_seq_type = 0; #endif if (__it._M_singular()) _M_variant._M_iterator._M_state = __singular; else { if (__it._M_is_end()) _M_variant._M_iterator._M_state = __end; else if (__it._M_is_begin()) _M_variant._M_iterator._M_state = __begin; else _M_variant._M_iterator._M_state = __middle; } } template<typename _Type> _Parameter(const _Type*& __it, const char* __name, _Is_iterator) : _M_kind(__iterator), _M_variant() { _M_variant._M_iterator._M_name = __name; _M_variant._M_iterator._M_address = &__it; #ifdef __GXX_RTTI _M_variant._M_iterator._M_type = &typeid(__it); #else _M_variant._M_iterator._M_type = 0; #endif _M_variant._M_iterator._M_constness = __mutable_iterator; _M_variant._M_iterator._M_state = __it? __unknown_state : __singular; _M_variant._M_iterator._M_sequence = 0; _M_variant._M_iterator._M_seq_type = 0; } template<typename _Type> _Parameter(_Type*& __it, const char* __name, _Is_iterator) : _M_kind(__iterator), _M_variant() { _M_variant._M_iterator._M_name = __name; _M_variant._M_iterator._M_address = &__it; #ifdef __GXX_RTTI _M_variant._M_iterator._M_type = &typeid(__it); #else _M_variant._M_iterator._M_type = 0; #endif _M_variant._M_iterator._M_constness = __const_iterator; _M_variant._M_iterator._M_state = __it? __unknown_state : __singular; _M_variant._M_iterator._M_sequence = 0; _M_variant._M_iterator._M_seq_type = 0; } template<typename _Iterator> _Parameter(const _Iterator& __it, const char* __name, _Is_iterator) : _M_kind(__iterator), _M_variant() { _M_variant._M_iterator._M_name = __name; _M_variant._M_iterator._M_address = &__it; #ifdef __GXX_RTTI _M_variant._M_iterator._M_type = &typeid(__it); #else _M_variant._M_iterator._M_type = 0; #endif _M_variant._M_iterator._M_constness = __unknown_constness; _M_variant._M_iterator._M_state = __gnu_debug::__check_singular(__it)? __singular : __unknown_state; _M_variant._M_iterator._M_sequence = 0; _M_variant._M_iterator._M_seq_type = 0; } template<typename _Sequence> _Parameter(const _Safe_sequence<_Sequence>& __seq, const char* __name, _Is_sequence) : _M_kind(__sequence), _M_variant() { _M_variant._M_sequence._M_name = __name; _M_variant._M_sequence._M_address = static_cast<const _Sequence*>(&__seq); #ifdef __GXX_RTTI _M_variant._M_sequence._M_type = &typeid(_Sequence); #else _M_variant._M_sequence._M_type = 0; #endif } template<typename _Sequence> _Parameter(const _Sequence& __seq, const char* __name, _Is_sequence) : _M_kind(__sequence), _M_variant() { _M_variant._M_sequence._M_name = __name; _M_variant._M_sequence._M_address = &__seq; #ifdef __GXX_RTTI _M_variant._M_sequence._M_type = &typeid(_Sequence); #else _M_variant._M_sequence._M_type = 0; #endif } void _M_print_field(const _Error_formatter* __formatter, const char* __name) const; void _M_print_description(const _Error_formatter* __formatter) const; }; friend struct _Parameter; public: template<typename _Iterator> const _Error_formatter& _M_iterator(const _Iterator& __it, const char* __name = 0) const { if (_M_num_parameters < std::size_t(__max_parameters)) _M_parameters[_M_num_parameters++] = _Parameter(__it, __name, _Is_iterator()); return *this; } const _Error_formatter& _M_integer(long __value, const char* __name = 0) const { if (_M_num_parameters < std::size_t(__max_parameters)) _M_parameters[_M_num_parameters++] = _Parameter(__value, __name); return *this; } const _Error_formatter& _M_string(const char* __value, const char* __name = 0) const { if (_M_num_parameters < std::size_t(__max_parameters)) _M_parameters[_M_num_parameters++] = _Parameter(__value, __name); return *this; } template<typename _Sequence> const _Error_formatter& _M_sequence(const _Sequence& __seq, const char* __name = 0) const { if (_M_num_parameters < std::size_t(__max_parameters)) _M_parameters[_M_num_parameters++] = _Parameter(__seq, __name, _Is_sequence()); return *this; } const _Error_formatter& _M_message(const char* __text) const { _M_text = __text; return *this; } const _Error_formatter& _M_message(_Debug_msg_id __id) const throw (); _GLIBCXX_NORETURN void _M_error() const; private: _Error_formatter(const char* __file, std::size_t __line) : _M_file(__file), _M_line(__line), _M_num_parameters(0), _M_text(0), _M_max_length(78), _M_column(1), _M_first_line(true), _M_wordwrap(false) { _M_get_max_length(); } template<typename _Tp> void _M_format_word(char*, int, const char*, _Tp) const throw (); void _M_print_word(const char* __word) const; void _M_print_string(const char* __string) const; void _M_get_max_length() const throw (); enum { __max_parameters = 9 }; const char* _M_file; std::size_t _M_line; mutable _Parameter _M_parameters[__max_parameters]; mutable std::size_t _M_num_parameters; mutable const char* _M_text; mutable std::size_t _M_max_length; enum { _M_indent = 4 } ; mutable std::size_t _M_column; mutable bool _M_first_line; mutable bool _M_wordwrap; public: static _Error_formatter _M_at(const char* __file, std::size_t __line) { return _Error_formatter(__file, __line); } }; } // namespace __gnu_debug #endif ��������������������������������������������������������������������������c++/4.8.2/debug/safe_iterator.h���������������������������������������������������������������������0000644�����������������00000056640�14763166030�0011674 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Safe iterator implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/safe_iterator.h * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_SAFE_ITERATOR_H #define _GLIBCXX_DEBUG_SAFE_ITERATOR_H 1 #include <debug/debug.h> #include <debug/macros.h> #include <debug/functions.h> #include <debug/safe_base.h> #include <bits/stl_pair.h> #include <ext/type_traits.h> namespace __gnu_debug { /** Helper struct to deal with sequence offering a before_begin * iterator. **/ template <typename _Sequence> struct _BeforeBeginHelper { typedef typename _Sequence::const_iterator _It; typedef typename _It::iterator_type _BaseIt; static bool _S_Is(_BaseIt, const _Sequence*) { return false; } static bool _S_Is_Beginnest(_BaseIt __it, const _Sequence* __seq) { return __it == __seq->_M_base().begin(); } }; /** Iterators that derive from _Safe_iterator_base but that aren't * _Safe_iterators can be determined singular or non-singular via * _Safe_iterator_base. */ inline bool __check_singular_aux(const _Safe_iterator_base* __x) { return __x->_M_singular(); } /** The precision to which we can calculate the distance between * two iterators. */ enum _Distance_precision { __dp_equality, //< Can compare iterator equality, only __dp_sign, //< Can determine equality and ordering __dp_exact //< Can determine distance precisely }; /** Determine the distance between two iterators with some known * precision. */ template<typename _Iterator1, typename _Iterator2> inline std::pair<typename std::iterator_traits<_Iterator1>::difference_type, _Distance_precision> __get_distance(const _Iterator1& __lhs, const _Iterator2& __rhs, std::random_access_iterator_tag) { return std::make_pair(__rhs - __lhs, __dp_exact); } template<typename _Iterator1, typename _Iterator2> inline std::pair<typename std::iterator_traits<_Iterator1>::difference_type, _Distance_precision> __get_distance(const _Iterator1& __lhs, const _Iterator2& __rhs, std::forward_iterator_tag) { return std::make_pair(__lhs == __rhs? 0 : 1, __dp_equality); } template<typename _Iterator1, typename _Iterator2> inline std::pair<typename std::iterator_traits<_Iterator1>::difference_type, _Distance_precision> __get_distance(const _Iterator1& __lhs, const _Iterator2& __rhs) { typedef typename std::iterator_traits<_Iterator1>::iterator_category _Category; return __get_distance(__lhs, __rhs, _Category()); } /** \brief Safe iterator wrapper. * * The class template %_Safe_iterator is a wrapper around an * iterator that tracks the iterator's movement among sequences and * checks that operations performed on the "safe" iterator are * legal. In additional to the basic iterator operations (which are * validated, and then passed to the underlying iterator), * %_Safe_iterator has member functions for iterator invalidation, * attaching/detaching the iterator from sequences, and querying * the iterator's state. */ template<typename _Iterator, typename _Sequence> class _Safe_iterator : public _Safe_iterator_base { typedef _Safe_iterator _Self; /// The underlying iterator _Iterator _M_current; /// Determine if this is a constant iterator. bool _M_constant() const { typedef typename _Sequence::const_iterator const_iterator; return std::__are_same<const_iterator, _Safe_iterator>::__value; } typedef std::iterator_traits<_Iterator> _Traits; public: typedef _Iterator iterator_type; typedef typename _Traits::iterator_category iterator_category; typedef typename _Traits::value_type value_type; typedef typename _Traits::difference_type difference_type; typedef typename _Traits::reference reference; typedef typename _Traits::pointer pointer; /// @post the iterator is singular and unattached _Safe_iterator() : _M_current() { } /** * @brief Safe iterator construction from an unsafe iterator and * its sequence. * * @pre @p seq is not NULL * @post this is not singular */ _Safe_iterator(const _Iterator& __i, const _Sequence* __seq) : _Safe_iterator_base(__seq, _M_constant()), _M_current(__i) { _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(), _M_message(__msg_init_singular) ._M_iterator(*this, "this")); } /** * @brief Copy construction. */ _Safe_iterator(const _Safe_iterator& __x) : _Safe_iterator_base(__x, _M_constant()), _M_current(__x._M_current) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 408. Is vector<reverse_iterator<char*> > forbidden? _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() || __x._M_current == _Iterator(), _M_message(__msg_init_copy_singular) ._M_iterator(*this, "this") ._M_iterator(__x, "other")); } #if __cplusplus >= 201103L /** * @brief Move construction. * @post __x is singular and unattached */ _Safe_iterator(_Safe_iterator&& __x) : _M_current() { _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() || __x._M_current == _Iterator(), _M_message(__msg_init_copy_singular) ._M_iterator(*this, "this") ._M_iterator(__x, "other")); std::swap(_M_current, __x._M_current); this->_M_attach(__x._M_sequence); __x._M_detach(); } #endif /** * @brief Converting constructor from a mutable iterator to a * constant iterator. */ template<typename _MutableIterator> _Safe_iterator( const _Safe_iterator<_MutableIterator, typename __gnu_cxx::__enable_if<(std::__are_same<_MutableIterator, typename _Sequence::iterator::iterator_type>::__value), _Sequence>::__type>& __x) : _Safe_iterator_base(__x, _M_constant()), _M_current(__x.base()) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 408. Is vector<reverse_iterator<char*> > forbidden? _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() || __x.base() == _Iterator(), _M_message(__msg_init_const_singular) ._M_iterator(*this, "this") ._M_iterator(__x, "other")); } /** * @brief Copy assignment. */ _Safe_iterator& operator=(const _Safe_iterator& __x) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 408. Is vector<reverse_iterator<char*> > forbidden? _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() || __x._M_current == _Iterator(), _M_message(__msg_copy_singular) ._M_iterator(*this, "this") ._M_iterator(__x, "other")); _M_current = __x._M_current; this->_M_attach(__x._M_sequence); return *this; } #if __cplusplus >= 201103L /** * @brief Move assignment. * @post __x is singular and unattached */ _Safe_iterator& operator=(_Safe_iterator&& __x) { _GLIBCXX_DEBUG_VERIFY(this != &__x, _M_message(__msg_self_move_assign) ._M_iterator(*this, "this")); _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() || __x._M_current == _Iterator(), _M_message(__msg_copy_singular) ._M_iterator(*this, "this") ._M_iterator(__x, "other")); _M_current = __x._M_current; _M_attach(__x._M_sequence); __x._M_detach(); __x._M_current = _Iterator(); return *this; } #endif /** * @brief Iterator dereference. * @pre iterator is dereferenceable */ reference operator*() const { _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), _M_message(__msg_bad_deref) ._M_iterator(*this, "this")); return *_M_current; } /** * @brief Iterator dereference. * @pre iterator is dereferenceable * @todo Make this correct w.r.t. iterators that return proxies * @todo Use addressof() instead of & operator */ pointer operator->() const { _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), _M_message(__msg_bad_deref) ._M_iterator(*this, "this")); return &*_M_current; } // ------ Input iterator requirements ------ /** * @brief Iterator preincrement * @pre iterator is incrementable */ _Safe_iterator& operator++() { _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), _M_message(__msg_bad_inc) ._M_iterator(*this, "this")); ++_M_current; return *this; } /** * @brief Iterator postincrement * @pre iterator is incrementable */ _Safe_iterator operator++(int) { _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), _M_message(__msg_bad_inc) ._M_iterator(*this, "this")); _Safe_iterator __tmp(*this); ++_M_current; return __tmp; } // ------ Bidirectional iterator requirements ------ /** * @brief Iterator predecrement * @pre iterator is decrementable */ _Safe_iterator& operator--() { _GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(), _M_message(__msg_bad_dec) ._M_iterator(*this, "this")); --_M_current; return *this; } /** * @brief Iterator postdecrement * @pre iterator is decrementable */ _Safe_iterator operator--(int) { _GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(), _M_message(__msg_bad_dec) ._M_iterator(*this, "this")); _Safe_iterator __tmp(*this); --_M_current; return __tmp; } // ------ Random access iterator requirements ------ reference operator[](const difference_type& __n) const { _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n) && this->_M_can_advance(__n+1), _M_message(__msg_iter_subscript_oob) ._M_iterator(*this)._M_integer(__n)); return _M_current[__n]; } _Safe_iterator& operator+=(const difference_type& __n) { _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n), _M_message(__msg_advance_oob) ._M_iterator(*this)._M_integer(__n)); _M_current += __n; return *this; } _Safe_iterator operator+(const difference_type& __n) const { _Safe_iterator __tmp(*this); __tmp += __n; return __tmp; } _Safe_iterator& operator-=(const difference_type& __n) { _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(-__n), _M_message(__msg_retreat_oob) ._M_iterator(*this)._M_integer(__n)); _M_current += -__n; return *this; } _Safe_iterator operator-(const difference_type& __n) const { _Safe_iterator __tmp(*this); __tmp -= __n; return __tmp; } // ------ Utilities ------ /** * @brief Return the underlying iterator */ _Iterator base() const { return _M_current; } /** * @brief Conversion to underlying non-debug iterator to allow * better interaction with non-debug containers. */ operator _Iterator() const { return _M_current; } /** Attach iterator to the given sequence. */ void _M_attach(_Safe_sequence_base* __seq) { _Safe_iterator_base::_M_attach(__seq, _M_constant()); } /** Likewise, but not thread-safe. */ void _M_attach_single(_Safe_sequence_base* __seq) { _Safe_iterator_base::_M_attach_single(__seq, _M_constant()); } /// Is the iterator dereferenceable? bool _M_dereferenceable() const { return !this->_M_singular() && !_M_is_end() && !_M_is_before_begin(); } /// Is the iterator before a dereferenceable one? bool _M_before_dereferenceable() const { if (this->_M_incrementable()) { _Iterator __base = base(); return ++__base != _M_get_sequence()->_M_base().end(); } return false; } /// Is the iterator incrementable? bool _M_incrementable() const { return !this->_M_singular() && !_M_is_end(); } // Is the iterator decrementable? bool _M_decrementable() const { return !_M_singular() && !_M_is_begin(); } // Can we advance the iterator @p __n steps (@p __n may be negative) bool _M_can_advance(const difference_type& __n) const; // Is the iterator range [*this, __rhs) valid? template<typename _Other> bool _M_valid_range(const _Safe_iterator<_Other, _Sequence>& __rhs) const; // The sequence this iterator references. const _Sequence* _M_get_sequence() const { return static_cast<const _Sequence*>(_M_sequence); } /// Is this iterator equal to the sequence's begin() iterator? bool _M_is_begin() const { return base() == _M_get_sequence()->_M_base().begin(); } /// Is this iterator equal to the sequence's end() iterator? bool _M_is_end() const { return base() == _M_get_sequence()->_M_base().end(); } /// Is this iterator equal to the sequence's before_begin() iterator if /// any? bool _M_is_before_begin() const { return _BeforeBeginHelper<_Sequence>::_S_Is(base(), _M_get_sequence()); } /// Is this iterator equal to the sequence's before_begin() iterator if /// any or begin() otherwise? bool _M_is_beginnest() const { return _BeforeBeginHelper<_Sequence>::_S_Is_Beginnest(base(), _M_get_sequence()); } }; template<typename _IteratorL, typename _IteratorR, typename _Sequence> inline bool operator==(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, const _Safe_iterator<_IteratorR, _Sequence>& __rhs) { _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), _M_message(__msg_iter_compare_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), _M_message(__msg_compare_different) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); return __lhs.base() == __rhs.base(); } template<typename _Iterator, typename _Sequence> inline bool operator==(const _Safe_iterator<_Iterator, _Sequence>& __lhs, const _Safe_iterator<_Iterator, _Sequence>& __rhs) { _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), _M_message(__msg_iter_compare_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), _M_message(__msg_compare_different) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); return __lhs.base() == __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Sequence> inline bool operator!=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, const _Safe_iterator<_IteratorR, _Sequence>& __rhs) { _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), _M_message(__msg_iter_compare_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), _M_message(__msg_compare_different) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); return __lhs.base() != __rhs.base(); } template<typename _Iterator, typename _Sequence> inline bool operator!=(const _Safe_iterator<_Iterator, _Sequence>& __lhs, const _Safe_iterator<_Iterator, _Sequence>& __rhs) { _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), _M_message(__msg_iter_compare_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), _M_message(__msg_compare_different) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); return __lhs.base() != __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Sequence> inline bool operator<(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, const _Safe_iterator<_IteratorR, _Sequence>& __rhs) { _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), _M_message(__msg_iter_order_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), _M_message(__msg_order_different) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); return __lhs.base() < __rhs.base(); } template<typename _Iterator, typename _Sequence> inline bool operator<(const _Safe_iterator<_Iterator, _Sequence>& __lhs, const _Safe_iterator<_Iterator, _Sequence>& __rhs) { _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), _M_message(__msg_iter_order_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), _M_message(__msg_order_different) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); return __lhs.base() < __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Sequence> inline bool operator<=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, const _Safe_iterator<_IteratorR, _Sequence>& __rhs) { _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), _M_message(__msg_iter_order_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), _M_message(__msg_order_different) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); return __lhs.base() <= __rhs.base(); } template<typename _Iterator, typename _Sequence> inline bool operator<=(const _Safe_iterator<_Iterator, _Sequence>& __lhs, const _Safe_iterator<_Iterator, _Sequence>& __rhs) { _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), _M_message(__msg_iter_order_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), _M_message(__msg_order_different) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); return __lhs.base() <= __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Sequence> inline bool operator>(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, const _Safe_iterator<_IteratorR, _Sequence>& __rhs) { _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), _M_message(__msg_iter_order_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), _M_message(__msg_order_different) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); return __lhs.base() > __rhs.base(); } template<typename _Iterator, typename _Sequence> inline bool operator>(const _Safe_iterator<_Iterator, _Sequence>& __lhs, const _Safe_iterator<_Iterator, _Sequence>& __rhs) { _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), _M_message(__msg_iter_order_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), _M_message(__msg_order_different) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); return __lhs.base() > __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Sequence> inline bool operator>=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, const _Safe_iterator<_IteratorR, _Sequence>& __rhs) { _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), _M_message(__msg_iter_order_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), _M_message(__msg_order_different) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); return __lhs.base() >= __rhs.base(); } template<typename _Iterator, typename _Sequence> inline bool operator>=(const _Safe_iterator<_Iterator, _Sequence>& __lhs, const _Safe_iterator<_Iterator, _Sequence>& __rhs) { _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), _M_message(__msg_iter_order_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), _M_message(__msg_order_different) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); return __lhs.base() >= __rhs.base(); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // According to the resolution of DR179 not only the various comparison // operators but also operator- must accept mixed iterator/const_iterator // parameters. template<typename _IteratorL, typename _IteratorR, typename _Sequence> inline typename _Safe_iterator<_IteratorL, _Sequence>::difference_type operator-(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, const _Safe_iterator<_IteratorR, _Sequence>& __rhs) { _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), _M_message(__msg_distance_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), _M_message(__msg_distance_different) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); return __lhs.base() - __rhs.base(); } template<typename _Iterator, typename _Sequence> inline typename _Safe_iterator<_Iterator, _Sequence>::difference_type operator-(const _Safe_iterator<_Iterator, _Sequence>& __lhs, const _Safe_iterator<_Iterator, _Sequence>& __rhs) { _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), _M_message(__msg_distance_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), _M_message(__msg_distance_different) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); return __lhs.base() - __rhs.base(); } template<typename _Iterator, typename _Sequence> inline _Safe_iterator<_Iterator, _Sequence> operator+(typename _Safe_iterator<_Iterator,_Sequence>::difference_type __n, const _Safe_iterator<_Iterator, _Sequence>& __i) { return __i + __n; } } // namespace __gnu_debug #include <debug/safe_iterator.tcc> #endif ������������������������������������������������������������������������������������������������c++/4.8.2/debug/multiset.h��������������������������������������������������������������������������0000644�����������������00000032516�14763166030�0010707 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debugging multiset implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/multiset.h * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_MULTISET_H #define _GLIBCXX_DEBUG_MULTISET_H 1 #include <debug/safe_sequence.h> #include <debug/safe_iterator.h> #include <utility> namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { /// Class std::multiset with safety/checking/debug instrumentation. template<typename _Key, typename _Compare = std::less<_Key>, typename _Allocator = std::allocator<_Key> > class multiset : public _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator>, public __gnu_debug::_Safe_sequence<multiset<_Key, _Compare, _Allocator> > { typedef _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator> _Base; typedef typename _Base::const_iterator _Base_const_iterator; typedef typename _Base::iterator _Base_iterator; typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; public: // types: typedef _Key key_type; typedef _Key value_type; typedef _Compare key_compare; typedef _Compare value_compare; typedef _Allocator allocator_type; typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef __gnu_debug::_Safe_iterator<_Base_iterator, multiset> iterator; typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, multiset> const_iterator; typedef typename _Base::size_type size_type; typedef typename _Base::difference_type difference_type; typedef typename _Base::pointer pointer; typedef typename _Base::const_pointer const_pointer; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // 23.3.3.1 construct/copy/destroy: explicit multiset(const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) : _Base(__comp, __a) { } template<typename _InputIterator> multiset(_InputIterator __first, _InputIterator __last, const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, __last)), __gnu_debug::__base(__last), __comp, __a) { } multiset(const multiset& __x) : _Base(__x) { } multiset(const _Base& __x) : _Base(__x) { } #if __cplusplus >= 201103L multiset(multiset&& __x) noexcept(is_nothrow_copy_constructible<_Compare>::value) : _Base(std::move(__x)) { this->_M_swap(__x); } multiset(initializer_list<value_type> __l, const _Compare& __comp = _Compare(), const allocator_type& __a = allocator_type()) : _Base(__l, __comp, __a) { } #endif ~multiset() _GLIBCXX_NOEXCEPT { } multiset& operator=(const multiset& __x) { *static_cast<_Base*>(this) = __x; this->_M_invalidate_all(); return *this; } #if __cplusplus >= 201103L multiset& operator=(multiset&& __x) { // NB: DR 1204. // NB: DR 675. __glibcxx_check_self_move_assign(__x); clear(); swap(__x); return *this; } multiset& operator=(initializer_list<value_type> __l) { this->clear(); this->insert(__l); return *this; } #endif using _Base::get_allocator; // iterators: iterator begin() _GLIBCXX_NOEXCEPT { return iterator(_Base::begin(), this); } const_iterator begin() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::begin(), this); } iterator end() _GLIBCXX_NOEXCEPT { return iterator(_Base::end(), this); } const_iterator end() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::end(), this); } reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(end()); } const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(end()); } reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(begin()); } const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(begin()); } #if __cplusplus >= 201103L const_iterator cbegin() const noexcept { return const_iterator(_Base::begin(), this); } const_iterator cend() const noexcept { return const_iterator(_Base::end(), this); } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } #endif // capacity: using _Base::empty; using _Base::size; using _Base::max_size; // modifiers: #if __cplusplus >= 201103L template<typename... _Args> iterator emplace(_Args&&... __args) { return iterator(_Base::emplace(std::forward<_Args>(__args)...), this); } template<typename... _Args> iterator emplace_hint(const_iterator __pos, _Args&&... __args) { __glibcxx_check_insert(__pos); return iterator(_Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...), this); } #endif iterator insert(const value_type& __x) { return iterator(_Base::insert(__x), this); } #if __cplusplus >= 201103L iterator insert(value_type&& __x) { return iterator(_Base::insert(std::move(__x)), this); } #endif iterator insert(const_iterator __position, const value_type& __x) { __glibcxx_check_insert(__position); return iterator(_Base::insert(__position.base(), __x), this); } #if __cplusplus >= 201103L iterator insert(const_iterator __position, value_type&& __x) { __glibcxx_check_insert(__position); return iterator(_Base::insert(__position.base(), std::move(__x)), this); } #endif template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) { __glibcxx_check_valid_range(__first, __last); _Base::insert(__gnu_debug::__base(__first), __gnu_debug::__base(__last)); } #if __cplusplus >= 201103L void insert(initializer_list<value_type> __l) { _Base::insert(__l); } #endif #if __cplusplus >= 201103L iterator erase(const_iterator __position) { __glibcxx_check_erase(__position); this->_M_invalidate_if(_Equal(__position.base())); return iterator(_Base::erase(__position.base()), this); } #else void erase(iterator __position) { __glibcxx_check_erase(__position); this->_M_invalidate_if(_Equal(__position.base())); _Base::erase(__position.base()); } #endif size_type erase(const key_type& __x) { std::pair<_Base_iterator, _Base_iterator> __victims = _Base::equal_range(__x); size_type __count = 0; _Base_iterator __victim = __victims.first; while (__victim != __victims.second) { this->_M_invalidate_if(_Equal(__victim)); _Base::erase(__victim++); ++__count; } return __count; } #if __cplusplus >= 201103L iterator erase(const_iterator __first, const_iterator __last) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container __glibcxx_check_erase_range(__first, __last); for (_Base_const_iterator __victim = __first.base(); __victim != __last.base(); ++__victim) { _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), _M_message(__gnu_debug::__msg_valid_range) ._M_iterator(__first, "first") ._M_iterator(__last, "last")); this->_M_invalidate_if(_Equal(__victim)); } return iterator(_Base::erase(__first.base(), __last.base()), this); } #else void erase(iterator __first, iterator __last) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container __glibcxx_check_erase_range(__first, __last); for (_Base_iterator __victim = __first.base(); __victim != __last.base(); ++__victim) { _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), _M_message(__gnu_debug::__msg_valid_range) ._M_iterator(__first, "first") ._M_iterator(__last, "last")); this->_M_invalidate_if(_Equal(__victim)); } _Base::erase(__first.base(), __last.base()); } #endif void swap(multiset& __x) { _Base::swap(__x); this->_M_swap(__x); } void clear() _GLIBCXX_NOEXCEPT { this->_M_invalidate_all(); _Base::clear(); } // observers: using _Base::key_comp; using _Base::value_comp; // multiset operations: iterator find(const key_type& __x) { return iterator(_Base::find(__x), this); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload const_iterator find(const key_type& __x) const { return const_iterator(_Base::find(__x), this); } using _Base::count; iterator lower_bound(const key_type& __x) { return iterator(_Base::lower_bound(__x), this); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload const_iterator lower_bound(const key_type& __x) const { return const_iterator(_Base::lower_bound(__x), this); } iterator upper_bound(const key_type& __x) { return iterator(_Base::upper_bound(__x), this); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload const_iterator upper_bound(const key_type& __x) const { return const_iterator(_Base::upper_bound(__x), this); } std::pair<iterator,iterator> equal_range(const key_type& __x) { std::pair<_Base_iterator, _Base_iterator> __res = _Base::equal_range(__x); return std::make_pair(iterator(__res.first, this), iterator(__res.second, this)); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload std::pair<const_iterator,const_iterator> equal_range(const key_type& __x) const { std::pair<_Base_const_iterator, _Base_const_iterator> __res = _Base::equal_range(__x); return std::make_pair(const_iterator(__res.first, this), const_iterator(__res.second, this)); } _Base& _M_base() _GLIBCXX_NOEXCEPT { return *this; } const _Base& _M_base() const _GLIBCXX_NOEXCEPT { return *this; } private: void _M_invalidate_all() { typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal; this->_M_invalidate_if(_Not_equal(_Base::end())); } }; template<typename _Key, typename _Compare, typename _Allocator> inline bool operator==(const multiset<_Key, _Compare, _Allocator>& __lhs, const multiset<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() == __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator!=(const multiset<_Key, _Compare, _Allocator>& __lhs, const multiset<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() != __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator<(const multiset<_Key, _Compare, _Allocator>& __lhs, const multiset<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() < __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator<=(const multiset<_Key, _Compare, _Allocator>& __lhs, const multiset<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() <= __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator>=(const multiset<_Key, _Compare, _Allocator>& __lhs, const multiset<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() >= __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> inline bool operator>(const multiset<_Key, _Compare, _Allocator>& __lhs, const multiset<_Key, _Compare, _Allocator>& __rhs) { return __lhs._M_base() > __rhs._M_base(); } template<typename _Key, typename _Compare, typename _Allocator> void swap(multiset<_Key, _Compare, _Allocator>& __x, multiset<_Key, _Compare, _Allocator>& __y) { return __x.swap(__y); } } // namespace __debug } // namespace std #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/string������������������������������������������������������������������������������0000644�����������������00000077166�14763166030�0010133 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debugging string implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/string * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_STRING #define _GLIBCXX_DEBUG_STRING 1 #include <string> #include <debug/safe_sequence.h> #include <debug/safe_iterator.h> namespace __gnu_debug { /// Class std::basic_string with safety/checking/debug instrumentation. template<typename _CharT, typename _Traits = std::char_traits<_CharT>, typename _Allocator = std::allocator<_CharT> > class basic_string : public std::basic_string<_CharT, _Traits, _Allocator>, public __gnu_debug::_Safe_sequence<basic_string<_CharT, _Traits, _Allocator> > { typedef std::basic_string<_CharT, _Traits, _Allocator> _Base; typedef __gnu_debug::_Safe_sequence<basic_string> _Safe_base; public: // types: typedef _Traits traits_type; typedef typename _Traits::char_type value_type; typedef _Allocator allocator_type; typedef typename _Base::size_type size_type; typedef typename _Base::difference_type difference_type; typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef typename _Base::pointer pointer; typedef typename _Base::const_pointer const_pointer; typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, basic_string> iterator; typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator, basic_string> const_iterator; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; using _Base::npos; // 21.3.1 construct/copy/destroy: explicit basic_string(const _Allocator& __a = _Allocator()) : _Base(__a) { } // Provides conversion from a release-mode string to a debug-mode string basic_string(const _Base& __base) : _Base(__base) { } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 42. string ctors specify wrong default allocator basic_string(const basic_string& __str) : _Base(__str, 0, _Base::npos, __str.get_allocator()) { } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 42. string ctors specify wrong default allocator basic_string(const basic_string& __str, size_type __pos, size_type __n = _Base::npos, const _Allocator& __a = _Allocator()) : _Base(__str, __pos, __n, __a) { } basic_string(const _CharT* __s, size_type __n, const _Allocator& __a = _Allocator()) : _Base(__gnu_debug::__check_string(__s, __n), __n, __a) { } basic_string(const _CharT* __s, const _Allocator& __a = _Allocator()) : _Base(__gnu_debug::__check_string(__s), __a) { this->assign(__s); } basic_string(size_type __n, _CharT __c, const _Allocator& __a = _Allocator()) : _Base(__n, __c, __a) { } template<typename _InputIterator> basic_string(_InputIterator __begin, _InputIterator __end, const _Allocator& __a = _Allocator()) : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__begin, __end)), __gnu_debug::__base(__end), __a) { } #if __cplusplus >= 201103L basic_string(basic_string&& __str) noexcept : _Base(std::move(__str)) { } basic_string(std::initializer_list<_CharT> __l, const _Allocator& __a = _Allocator()) : _Base(__l, __a) { } #endif // C++11 ~basic_string() _GLIBCXX_NOEXCEPT { } basic_string& operator=(const basic_string& __str) { *static_cast<_Base*>(this) = __str; this->_M_invalidate_all(); return *this; } basic_string& operator=(const _CharT* __s) { __glibcxx_check_string(__s); *static_cast<_Base*>(this) = __s; this->_M_invalidate_all(); return *this; } basic_string& operator=(_CharT __c) { *static_cast<_Base*>(this) = __c; this->_M_invalidate_all(); return *this; } #if __cplusplus >= 201103L basic_string& operator=(basic_string&& __str) { __glibcxx_check_self_move_assign(__str); *static_cast<_Base*>(this) = std::move(__str); this->_M_invalidate_all(); return *this; } basic_string& operator=(std::initializer_list<_CharT> __l) { *static_cast<_Base*>(this) = __l; this->_M_invalidate_all(); return *this; } #endif // C++11 // 21.3.2 iterators: iterator begin() _GLIBCXX_NOEXCEPT { return iterator(_Base::begin(), this); } const_iterator begin() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::begin(), this); } iterator end() _GLIBCXX_NOEXCEPT { return iterator(_Base::end(), this); } const_iterator end() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::end(), this); } reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(end()); } const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(end()); } reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(begin()); } const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(begin()); } #if __cplusplus >= 201103L const_iterator cbegin() const noexcept { return const_iterator(_Base::begin(), this); } const_iterator cend() const noexcept { return const_iterator(_Base::end(), this); } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } #endif // 21.3.3 capacity: using _Base::size; using _Base::length; using _Base::max_size; void resize(size_type __n, _CharT __c) { _Base::resize(__n, __c); this->_M_invalidate_all(); } void resize(size_type __n) { this->resize(__n, _CharT()); } #if __cplusplus >= 201103L void shrink_to_fit() { if (capacity() > size()) { __try { reserve(0); this->_M_invalidate_all(); } __catch(...) { } } } #endif using _Base::capacity; using _Base::reserve; void clear() _GLIBCXX_NOEXCEPT { _Base::clear(); this->_M_invalidate_all(); } using _Base::empty; // 21.3.4 element access: const_reference operator[](size_type __pos) const { _GLIBCXX_DEBUG_VERIFY(__pos <= this->size(), _M_message(__gnu_debug::__msg_subscript_oob) ._M_sequence(*this, "this") ._M_integer(__pos, "__pos") ._M_integer(this->size(), "size")); return _M_base()[__pos]; } reference operator[](size_type __pos) { #ifdef _GLIBCXX_DEBUG_PEDANTIC __glibcxx_check_subscript(__pos); #else // as an extension v3 allows s[s.size()] when s is non-const. _GLIBCXX_DEBUG_VERIFY(__pos <= this->size(), _M_message(__gnu_debug::__msg_subscript_oob) ._M_sequence(*this, "this") ._M_integer(__pos, "__pos") ._M_integer(this->size(), "size")); #endif return _M_base()[__pos]; } using _Base::at; #if __cplusplus >= 201103L using _Base::front; using _Base::back; #endif // 21.3.5 modifiers: basic_string& operator+=(const basic_string& __str) { _M_base() += __str; this->_M_invalidate_all(); return *this; } basic_string& operator+=(const _CharT* __s) { __glibcxx_check_string(__s); _M_base() += __s; this->_M_invalidate_all(); return *this; } basic_string& operator+=(_CharT __c) { _M_base() += __c; this->_M_invalidate_all(); return *this; } #if __cplusplus >= 201103L basic_string& operator+=(std::initializer_list<_CharT> __l) { _M_base() += __l; this->_M_invalidate_all(); return *this; } #endif // C++11 basic_string& append(const basic_string& __str) { _Base::append(__str); this->_M_invalidate_all(); return *this; } basic_string& append(const basic_string& __str, size_type __pos, size_type __n) { _Base::append(__str, __pos, __n); this->_M_invalidate_all(); return *this; } basic_string& append(const _CharT* __s, size_type __n) { __glibcxx_check_string_len(__s, __n); _Base::append(__s, __n); this->_M_invalidate_all(); return *this; } basic_string& append(const _CharT* __s) { __glibcxx_check_string(__s); _Base::append(__s); this->_M_invalidate_all(); return *this; } basic_string& append(size_type __n, _CharT __c) { _Base::append(__n, __c); this->_M_invalidate_all(); return *this; } template<typename _InputIterator> basic_string& append(_InputIterator __first, _InputIterator __last) { __glibcxx_check_valid_range(__first, __last); _Base::append(__gnu_debug::__base(__first), __gnu_debug::__base(__last)); this->_M_invalidate_all(); return *this; } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 7. string clause minor problems void push_back(_CharT __c) { _Base::push_back(__c); this->_M_invalidate_all(); } basic_string& assign(const basic_string& __x) { _Base::assign(__x); this->_M_invalidate_all(); return *this; } #if __cplusplus >= 201103L basic_string& assign(basic_string&& __x) { _Base::assign(std::move(__x)); this->_M_invalidate_all(); return *this; } #endif // C++11 basic_string& assign(const basic_string& __str, size_type __pos, size_type __n) { _Base::assign(__str, __pos, __n); this->_M_invalidate_all(); return *this; } basic_string& assign(const _CharT* __s, size_type __n) { __glibcxx_check_string_len(__s, __n); _Base::assign(__s, __n); this->_M_invalidate_all(); return *this; } basic_string& assign(const _CharT* __s) { __glibcxx_check_string(__s); _Base::assign(__s); this->_M_invalidate_all(); return *this; } basic_string& assign(size_type __n, _CharT __c) { _Base::assign(__n, __c); this->_M_invalidate_all(); return *this; } template<typename _InputIterator> basic_string& assign(_InputIterator __first, _InputIterator __last) { __glibcxx_check_valid_range(__first, __last); _Base::assign(__gnu_debug::__base(__first), __gnu_debug::__base(__last)); this->_M_invalidate_all(); return *this; } #if __cplusplus >= 201103L basic_string& assign(std::initializer_list<_CharT> __l) { _Base::assign(__l); this->_M_invalidate_all(); return *this; } #endif // C++11 basic_string& insert(size_type __pos1, const basic_string& __str) { _Base::insert(__pos1, __str); this->_M_invalidate_all(); return *this; } basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n) { _Base::insert(__pos1, __str, __pos2, __n); this->_M_invalidate_all(); return *this; } basic_string& insert(size_type __pos, const _CharT* __s, size_type __n) { __glibcxx_check_string(__s); _Base::insert(__pos, __s, __n); this->_M_invalidate_all(); return *this; } basic_string& insert(size_type __pos, const _CharT* __s) { __glibcxx_check_string(__s); _Base::insert(__pos, __s); this->_M_invalidate_all(); return *this; } basic_string& insert(size_type __pos, size_type __n, _CharT __c) { _Base::insert(__pos, __n, __c); this->_M_invalidate_all(); return *this; } iterator insert(iterator __p, _CharT __c) { __glibcxx_check_insert(__p); typename _Base::iterator __res = _Base::insert(__p.base(), __c); this->_M_invalidate_all(); return iterator(__res, this); } void insert(iterator __p, size_type __n, _CharT __c) { __glibcxx_check_insert(__p); _Base::insert(__p.base(), __n, __c); this->_M_invalidate_all(); } template<typename _InputIterator> void insert(iterator __p, _InputIterator __first, _InputIterator __last) { __glibcxx_check_insert_range(__p, __first, __last); _Base::insert(__p.base(), __gnu_debug::__base(__first), __gnu_debug::__base(__last)); this->_M_invalidate_all(); } #if __cplusplus >= 201103L void insert(iterator __p, std::initializer_list<_CharT> __l) { __glibcxx_check_insert(__p); _Base::insert(__p.base(), __l); this->_M_invalidate_all(); } #endif // C++11 basic_string& erase(size_type __pos = 0, size_type __n = _Base::npos) { _Base::erase(__pos, __n); this->_M_invalidate_all(); return *this; } iterator erase(iterator __position) { __glibcxx_check_erase(__position); typename _Base::iterator __res = _Base::erase(__position.base()); this->_M_invalidate_all(); return iterator(__res, this); } iterator erase(iterator __first, iterator __last) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container __glibcxx_check_erase_range(__first, __last); typename _Base::iterator __res = _Base::erase(__first.base(), __last.base()); this->_M_invalidate_all(); return iterator(__res, this); } #if __cplusplus >= 201103L void pop_back() { __glibcxx_check_nonempty(); _Base::pop_back(); this->_M_invalidate_all(); } #endif // C++11 basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str) { _Base::replace(__pos1, __n1, __str); this->_M_invalidate_all(); return *this; } basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) { _Base::replace(__pos1, __n1, __str, __pos2, __n2); this->_M_invalidate_all(); return *this; } basic_string& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) { __glibcxx_check_string_len(__s, __n2); _Base::replace(__pos, __n1, __s, __n2); this->_M_invalidate_all(); return *this; } basic_string& replace(size_type __pos, size_type __n1, const _CharT* __s) { __glibcxx_check_string(__s); _Base::replace(__pos, __n1, __s); this->_M_invalidate_all(); return *this; } basic_string& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) { _Base::replace(__pos, __n1, __n2, __c); this->_M_invalidate_all(); return *this; } basic_string& replace(iterator __i1, iterator __i2, const basic_string& __str) { __glibcxx_check_erase_range(__i1, __i2); _Base::replace(__i1.base(), __i2.base(), __str); this->_M_invalidate_all(); return *this; } basic_string& replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n) { __glibcxx_check_erase_range(__i1, __i2); __glibcxx_check_string_len(__s, __n); _Base::replace(__i1.base(), __i2.base(), __s, __n); this->_M_invalidate_all(); return *this; } basic_string& replace(iterator __i1, iterator __i2, const _CharT* __s) { __glibcxx_check_erase_range(__i1, __i2); __glibcxx_check_string(__s); _Base::replace(__i1.base(), __i2.base(), __s); this->_M_invalidate_all(); return *this; } basic_string& replace(iterator __i1, iterator __i2, size_type __n, _CharT __c) { __glibcxx_check_erase_range(__i1, __i2); _Base::replace(__i1.base(), __i2.base(), __n, __c); this->_M_invalidate_all(); return *this; } template<typename _InputIterator> basic_string& replace(iterator __i1, iterator __i2, _InputIterator __j1, _InputIterator __j2) { __glibcxx_check_erase_range(__i1, __i2); __glibcxx_check_valid_range(__j1, __j2); _Base::replace(__i1.base(), __i2.base(), __j1, __j2); this->_M_invalidate_all(); return *this; } #if __cplusplus >= 201103L basic_string& replace(iterator __i1, iterator __i2, std::initializer_list<_CharT> __l) { __glibcxx_check_erase_range(__i1, __i2); _Base::replace(__i1.base(), __i2.base(), __l); this->_M_invalidate_all(); return *this; } #endif // C++11 size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const { __glibcxx_check_string_len(__s, __n); return _Base::copy(__s, __n, __pos); } void swap(basic_string<_CharT,_Traits,_Allocator>& __x) { _Base::swap(__x); this->_M_swap(__x); this->_M_invalidate_all(); __x._M_invalidate_all(); } // 21.3.6 string operations: const _CharT* c_str() const _GLIBCXX_NOEXCEPT { const _CharT* __res = _Base::c_str(); this->_M_invalidate_all(); return __res; } const _CharT* data() const _GLIBCXX_NOEXCEPT { const _CharT* __res = _Base::data(); this->_M_invalidate_all(); return __res; } using _Base::get_allocator; size_type find(const basic_string& __str, size_type __pos = 0) const _GLIBCXX_NOEXCEPT { return _Base::find(__str, __pos); } size_type find(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_check_string(__s); return _Base::find(__s, __pos, __n); } size_type find(const _CharT* __s, size_type __pos = 0) const { __glibcxx_check_string(__s); return _Base::find(__s, __pos); } size_type find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT { return _Base::find(__c, __pos); } size_type rfind(const basic_string& __str, size_type __pos = _Base::npos) const _GLIBCXX_NOEXCEPT { return _Base::rfind(__str, __pos); } size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_check_string_len(__s, __n); return _Base::rfind(__s, __pos, __n); } size_type rfind(const _CharT* __s, size_type __pos = _Base::npos) const { __glibcxx_check_string(__s); return _Base::rfind(__s, __pos); } size_type rfind(_CharT __c, size_type __pos = _Base::npos) const _GLIBCXX_NOEXCEPT { return _Base::rfind(__c, __pos); } size_type find_first_of(const basic_string& __str, size_type __pos = 0) const _GLIBCXX_NOEXCEPT { return _Base::find_first_of(__str, __pos); } size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_check_string(__s); return _Base::find_first_of(__s, __pos, __n); } size_type find_first_of(const _CharT* __s, size_type __pos = 0) const { __glibcxx_check_string(__s); return _Base::find_first_of(__s, __pos); } size_type find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT { return _Base::find_first_of(__c, __pos); } size_type find_last_of(const basic_string& __str, size_type __pos = _Base::npos) const _GLIBCXX_NOEXCEPT { return _Base::find_last_of(__str, __pos); } size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_check_string(__s); return _Base::find_last_of(__s, __pos, __n); } size_type find_last_of(const _CharT* __s, size_type __pos = _Base::npos) const { __glibcxx_check_string(__s); return _Base::find_last_of(__s, __pos); } size_type find_last_of(_CharT __c, size_type __pos = _Base::npos) const _GLIBCXX_NOEXCEPT { return _Base::find_last_of(__c, __pos); } size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const _GLIBCXX_NOEXCEPT { return _Base::find_first_not_of(__str, __pos); } size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_check_string_len(__s, __n); return _Base::find_first_not_of(__s, __pos, __n); } size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const { __glibcxx_check_string(__s); return _Base::find_first_not_of(__s, __pos); } size_type find_first_not_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT { return _Base::find_first_not_of(__c, __pos); } size_type find_last_not_of(const basic_string& __str, size_type __pos = _Base::npos) const _GLIBCXX_NOEXCEPT { return _Base::find_last_not_of(__str, __pos); } size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_check_string(__s); return _Base::find_last_not_of(__s, __pos, __n); } size_type find_last_not_of(const _CharT* __s, size_type __pos = _Base::npos) const { __glibcxx_check_string(__s); return _Base::find_last_not_of(__s, __pos); } size_type find_last_not_of(_CharT __c, size_type __pos = _Base::npos) const _GLIBCXX_NOEXCEPT { return _Base::find_last_not_of(__c, __pos); } basic_string substr(size_type __pos = 0, size_type __n = _Base::npos) const { return basic_string(_Base::substr(__pos, __n)); } int compare(const basic_string& __str) const { return _Base::compare(__str); } int compare(size_type __pos1, size_type __n1, const basic_string& __str) const { return _Base::compare(__pos1, __n1, __str); } int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const { return _Base::compare(__pos1, __n1, __str, __pos2, __n2); } int compare(const _CharT* __s) const { __glibcxx_check_string(__s); return _Base::compare(__s); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 5. string::compare specification questionable int compare(size_type __pos1, size_type __n1, const _CharT* __s) const { __glibcxx_check_string(__s); return _Base::compare(__pos1, __n1, __s); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 5. string::compare specification questionable int compare(size_type __pos1, size_type __n1,const _CharT* __s, size_type __n2) const { __glibcxx_check_string_len(__s, __n2); return _Base::compare(__pos1, __n1, __s, __n2); } _Base& _M_base() _GLIBCXX_NOEXCEPT { return *this; } const _Base& _M_base() const _GLIBCXX_NOEXCEPT { return *this; } using _Safe_base::_M_invalidate_all; }; template<typename _CharT, typename _Traits, typename _Allocator> inline basic_string<_CharT,_Traits,_Allocator> operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline basic_string<_CharT,_Traits,_Allocator> operator+(const _CharT* __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { __glibcxx_check_string(__lhs); return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline basic_string<_CharT,_Traits,_Allocator> operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { return basic_string<_CharT,_Traits,_Allocator>(1, __lhs) += __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline basic_string<_CharT,_Traits,_Allocator> operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const _CharT* __rhs) { __glibcxx_check_string(__rhs); return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline basic_string<_CharT,_Traits,_Allocator> operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs, _CharT __rhs) { return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { return __lhs._M_base() == __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator==(const _CharT* __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { __glibcxx_check_string(__lhs); return __lhs == __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const _CharT* __rhs) { __glibcxx_check_string(__rhs); return __lhs._M_base() == __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { return __lhs._M_base() != __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator!=(const _CharT* __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { __glibcxx_check_string(__lhs); return __lhs != __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const _CharT* __rhs) { __glibcxx_check_string(__rhs); return __lhs._M_base() != __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator<(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { return __lhs._M_base() < __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator<(const _CharT* __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { __glibcxx_check_string(__lhs); return __lhs < __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator<(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const _CharT* __rhs) { __glibcxx_check_string(__rhs); return __lhs._M_base() < __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator<=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { return __lhs._M_base() <= __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator<=(const _CharT* __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { __glibcxx_check_string(__lhs); return __lhs <= __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator<=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const _CharT* __rhs) { __glibcxx_check_string(__rhs); return __lhs._M_base() <= __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator>=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { return __lhs._M_base() >= __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator>=(const _CharT* __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { __glibcxx_check_string(__lhs); return __lhs >= __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator>=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const _CharT* __rhs) { __glibcxx_check_string(__rhs); return __lhs._M_base() >= __rhs; } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator>(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { return __lhs._M_base() > __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator>(const _CharT* __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { __glibcxx_check_string(__lhs); return __lhs > __rhs._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> inline bool operator>(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const _CharT* __rhs) { __glibcxx_check_string(__rhs); return __lhs._M_base() > __rhs; } // 21.3.7.8: template<typename _CharT, typename _Traits, typename _Allocator> inline void swap(basic_string<_CharT,_Traits,_Allocator>& __lhs, basic_string<_CharT,_Traits,_Allocator>& __rhs) { __lhs.swap(__rhs); } template<typename _CharT, typename _Traits, typename _Allocator> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const basic_string<_CharT, _Traits, _Allocator>& __str) { return __os << __str._M_base(); } template<typename _CharT, typename _Traits, typename _Allocator> std::basic_istream<_CharT,_Traits>& operator>>(std::basic_istream<_CharT,_Traits>& __is, basic_string<_CharT,_Traits,_Allocator>& __str) { std::basic_istream<_CharT,_Traits>& __res = __is >> __str._M_base(); __str._M_invalidate_all(); return __res; } template<typename _CharT, typename _Traits, typename _Allocator> std::basic_istream<_CharT,_Traits>& getline(std::basic_istream<_CharT,_Traits>& __is, basic_string<_CharT,_Traits,_Allocator>& __str, _CharT __delim) { std::basic_istream<_CharT,_Traits>& __res = getline(__is, __str._M_base(), __delim); __str._M_invalidate_all(); return __res; } template<typename _CharT, typename _Traits, typename _Allocator> std::basic_istream<_CharT,_Traits>& getline(std::basic_istream<_CharT,_Traits>& __is, basic_string<_CharT,_Traits,_Allocator>& __str) { std::basic_istream<_CharT,_Traits>& __res = getline(__is, __str._M_base()); __str._M_invalidate_all(); return __res; } typedef basic_string<char> string; #ifdef _GLIBCXX_USE_WCHAR_T typedef basic_string<wchar_t> wstring; #endif } // namespace __gnu_debug #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/forward_list������������������������������������������������������������������������0000644�����������������00000055670�14763166030�0011320 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <forward_list> -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/forward_list * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_FORWARD_LIST #define _GLIBCXX_DEBUG_FORWARD_LIST 1 #pragma GCC system_header #include <forward_list> #include <debug/safe_sequence.h> #include <debug/safe_iterator.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { /// Class std::forward_list with safety/checking/debug instrumentation. template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class forward_list : public _GLIBCXX_STD_C::forward_list<_Tp, _Alloc>, public __gnu_debug::_Safe_sequence<forward_list<_Tp, _Alloc> > { typedef _GLIBCXX_STD_C::forward_list<_Tp, _Alloc> _Base; typedef typename _Base::iterator _Base_iterator; typedef typename _Base::const_iterator _Base_const_iterator; typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template rebind<_GLIBCXX_STD_C::_Fwd_list_node<_Tp>>::other _Node_alloc_type; typedef __gnu_cxx::__alloc_traits<_Node_alloc_type> _Node_alloc_traits; public: typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef __gnu_debug::_Safe_iterator<_Base_iterator, forward_list> iterator; typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, forward_list> const_iterator; typedef typename _Base::size_type size_type; typedef typename _Base::difference_type difference_type; typedef _Tp value_type; typedef _Alloc allocator_type; typedef typename _Base::pointer pointer; typedef typename _Base::const_pointer const_pointer; // 23.2.3.1 construct/copy/destroy: explicit forward_list(const _Alloc& __al = _Alloc()) : _Base(__al) { } forward_list(const forward_list& __list, const _Alloc& __al) : _Base(__list, __al) { } forward_list(forward_list&& __list, const _Alloc& __al) : _Base(std::move(__list._M_base()), __al) { if (__list.get_allocator() == __al) this->_M_swap(__list); else __list._M_invalidate_all(); } explicit forward_list(size_type __n, const _Alloc& __al = _Alloc()) : _Base(__n, __al) { } forward_list(size_type __n, const _Tp& __value, const _Alloc& __al = _Alloc()) : _Base(__n, __value, __al) { } template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> forward_list(_InputIterator __first, _InputIterator __last, const _Alloc& __al = _Alloc()) : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, __last)), __gnu_debug::__base(__last), __al) { } forward_list(const forward_list& __list) : _Base(__list) { } forward_list(forward_list&& __list) noexcept : _Base(std::move(__list._M_base())) { this->_M_swap(__list); } forward_list(std::initializer_list<_Tp> __il, const _Alloc& __al = _Alloc()) : _Base(__il, __al) { } ~forward_list() noexcept { } forward_list& operator=(const forward_list& __list) { static_cast<_Base&>(*this) = __list; this->_M_invalidate_all(); return *this; } forward_list& operator=(forward_list&& __list) noexcept(_Node_alloc_traits::_S_nothrow_move()) { __glibcxx_check_self_move_assign(__list); bool xfer_memory = _Node_alloc_traits::_S_propagate_on_move_assign() || __list.get_allocator() == this->get_allocator(); static_cast<_Base&>(*this) = std::move(__list); if (xfer_memory) this->_M_swap(__list); else this->_M_invalidate_all(); __list._M_invalidate_all(); return *this; } forward_list& operator=(std::initializer_list<_Tp> __il) { static_cast<_Base&>(*this) = __il; this->_M_invalidate_all(); return *this; } template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> void assign(_InputIterator __first, _InputIterator __last) { __glibcxx_check_valid_range(__first, __last); _Base::assign(__gnu_debug::__base(__first), __gnu_debug::__base(__last)); this->_M_invalidate_all(); } void assign(size_type __n, const _Tp& __val) { _Base::assign(__n, __val); this->_M_invalidate_all(); } void assign(std::initializer_list<_Tp> __il) { _Base::assign(__il); this->_M_invalidate_all(); } using _Base::get_allocator; // iterators: iterator before_begin() noexcept { return iterator(_Base::before_begin(), this); } const_iterator before_begin() const noexcept { return const_iterator(_Base::before_begin(), this); } iterator begin() noexcept { return iterator(_Base::begin(), this); } const_iterator begin() const noexcept { return const_iterator(_Base::begin(), this); } iterator end() noexcept { return iterator(_Base::end(), this); } const_iterator end() const noexcept { return const_iterator(_Base::end(), this); } const_iterator cbegin() const noexcept { return const_iterator(_Base::cbegin(), this); } const_iterator cbefore_begin() const noexcept { return const_iterator(_Base::cbefore_begin(), this); } const_iterator cend() const noexcept { return const_iterator(_Base::cend(), this); } using _Base::empty; using _Base::max_size; // element access: reference front() { __glibcxx_check_nonempty(); return _Base::front(); } const_reference front() const { __glibcxx_check_nonempty(); return _Base::front(); } // modifiers: using _Base::emplace_front; using _Base::push_front; void pop_front() { __glibcxx_check_nonempty(); this->_M_invalidate_if([this](_Base_const_iterator __it) { return __it == this->_M_base().cbegin(); }); _Base::pop_front(); } template<typename... _Args> iterator emplace_after(const_iterator __pos, _Args&&... __args) { __glibcxx_check_insert_after(__pos); return iterator(_Base::emplace_after(__pos.base(), std::forward<_Args>(__args)...), this); } iterator insert_after(const_iterator __pos, const _Tp& __val) { __glibcxx_check_insert_after(__pos); return iterator(_Base::insert_after(__pos.base(), __val), this); } iterator insert_after(const_iterator __pos, _Tp&& __val) { __glibcxx_check_insert_after(__pos); return iterator(_Base::insert_after(__pos.base(), std::move(__val)), this); } iterator insert_after(const_iterator __pos, size_type __n, const _Tp& __val) { __glibcxx_check_insert_after(__pos); return iterator(_Base::insert_after(__pos.base(), __n, __val), this); } template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> iterator insert_after(const_iterator __pos, _InputIterator __first, _InputIterator __last) { __glibcxx_check_insert_range_after(__pos, __first, __last); return iterator(_Base::insert_after(__pos.base(), __gnu_debug::__base(__first), __gnu_debug::__base(__last)), this); } iterator insert_after(const_iterator __pos, std::initializer_list<_Tp> __il) { __glibcxx_check_insert_after(__pos); return iterator(_Base::insert_after(__pos.base(), __il), this); } private: _Base_iterator _M_erase_after(_Base_const_iterator __pos) { _Base_const_iterator __next = std::next(__pos); this->_M_invalidate_if([__next](_Base_const_iterator __it) { return __it == __next; }); return _Base::erase_after(__pos); } public: iterator erase_after(const_iterator __pos) { __glibcxx_check_erase_after(__pos); return iterator(_M_erase_after(__pos.base()), this); } iterator erase_after(const_iterator __pos, const_iterator __last) { __glibcxx_check_erase_range_after(__pos, __last); for (_Base_const_iterator __victim = std::next(__pos.base()); __victim != __last.base(); ++__victim) { _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), _M_message(__gnu_debug::__msg_valid_range2) ._M_sequence(*this, "this") ._M_iterator(__pos, "pos") ._M_iterator(__last, "last")); this->_M_invalidate_if([__victim](_Base_const_iterator __it) { return __it == __victim; }); } return iterator(_Base::erase_after(__pos.base(), __last.base()), this); } void swap(forward_list& __list) noexcept(_Node_alloc_traits::_S_nothrow_swap()) { if (!_Node_alloc_traits::_S_propagate_on_swap()) __glibcxx_check_equal_allocs(__list); _Base::swap(__list); this->_M_swap(__list); } void resize(size_type __sz) { this->_M_detach_singular(); // if __sz < size(), invalidate all iterators in [begin+__sz, end() _Base_iterator __victim = _Base::begin(); _Base_iterator __end = _Base::end(); for (size_type __i = __sz; __victim != __end && __i > 0; --__i) ++__victim; for (; __victim != __end; ++__victim) { this->_M_invalidate_if([__victim](_Base_const_iterator __it) { return __it == __victim; }); } __try { _Base::resize(__sz); } __catch(...) { this->_M_revalidate_singular(); __throw_exception_again; } } void resize(size_type __sz, const value_type& __val) { this->_M_detach_singular(); // if __sz < size(), invalidate all iterators in [begin+__sz, end()) _Base_iterator __victim = _Base::begin(); _Base_iterator __end = _Base::end(); for (size_type __i = __sz; __victim != __end && __i > 0; --__i) ++__victim; for (; __victim != __end; ++__victim) { this->_M_invalidate_if([__victim](_Base_const_iterator __it) { return __it == __victim; }); } __try { _Base::resize(__sz, __val); } __catch(...) { this->_M_revalidate_singular(); __throw_exception_again; } } void clear() noexcept { _Base::clear(); this->_M_invalidate_all(); } // 23.2.3.5 forward_list operations: void splice_after(const_iterator __pos, forward_list&& __list) { __glibcxx_check_insert_after(__pos); _GLIBCXX_DEBUG_VERIFY(&__list != this, _M_message(__gnu_debug::__msg_self_splice) ._M_sequence(*this, "this")); _GLIBCXX_DEBUG_VERIFY(__list.get_allocator() == this->get_allocator(), _M_message(__gnu_debug::__msg_splice_alloc) ._M_sequence(*this) ._M_sequence(__list, "__list")); this->_M_transfer_from_if(__list, [&__list](_Base_const_iterator __it) { return __it != __list._M_base().cbefore_begin() && __it != __list._M_base().end(); }); _Base::splice_after(__pos.base(), std::move(__list._M_base())); } void splice_after(const_iterator __pos, forward_list& __list) { splice_after(__pos, std::move(__list)); } void splice_after(const_iterator __pos, forward_list&& __list, const_iterator __i) { __glibcxx_check_insert_after(__pos); _GLIBCXX_DEBUG_VERIFY(__i._M_before_dereferenceable(), _M_message(__gnu_debug::__msg_splice_bad) ._M_iterator(__i, "__i")); _GLIBCXX_DEBUG_VERIFY(__i._M_attached_to(&__list), _M_message(__gnu_debug::__msg_splice_other) ._M_iterator(__i, "__i") ._M_sequence(__list, "__list")); _GLIBCXX_DEBUG_VERIFY(__list.get_allocator() == this->get_allocator(), _M_message(__gnu_debug::__msg_splice_alloc) ._M_sequence(*this) ._M_sequence(__list, "__list")); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 250. splicing invalidates iterators _Base_const_iterator __next = std::next(__i.base()); this->_M_transfer_from_if(__list, [__next](_Base_const_iterator __it) { return __it == __next; }); _Base::splice_after(__pos.base(), std::move(__list._M_base()), __i.base()); } void splice_after(const_iterator __pos, forward_list& __list, const_iterator __i) { splice_after(__pos, std::move(__list), __i); } void splice_after(const_iterator __pos, forward_list&& __list, const_iterator __before, const_iterator __last) { __glibcxx_check_insert_after(__pos); __glibcxx_check_valid_range(__before, __last); _GLIBCXX_DEBUG_VERIFY(__before._M_attached_to(&__list), _M_message(__gnu_debug::__msg_splice_other) ._M_sequence(__list, "list") ._M_iterator(__before, "before")); _GLIBCXX_DEBUG_VERIFY(__before._M_dereferenceable() || __before._M_is_before_begin(), _M_message(__gnu_debug::__msg_valid_range2) ._M_sequence(__list, "list") ._M_iterator(__before, "before") ._M_iterator(__last, "last")); _GLIBCXX_DEBUG_VERIFY(__before != __last, _M_message(__gnu_debug::__msg_valid_range2) ._M_sequence(__list, "list") ._M_iterator(__before, "before") ._M_iterator(__last, "last")); _GLIBCXX_DEBUG_VERIFY(__list.get_allocator() == this->get_allocator(), _M_message(__gnu_debug::__msg_splice_alloc) ._M_sequence(*this) ._M_sequence(__list, "__list")); for (_Base_const_iterator __tmp = std::next(__before.base()); __tmp != __last.base(); ++__tmp) { _GLIBCXX_DEBUG_VERIFY(__tmp != __list._M_base().end(), _M_message(__gnu_debug::__msg_valid_range2) ._M_sequence(__list, "list") ._M_iterator(__before, "before") ._M_iterator(__last, "last")); _GLIBCXX_DEBUG_VERIFY(&__list != this || __tmp != __pos.base(), _M_message(__gnu_debug::__msg_splice_overlap) ._M_iterator(__tmp, "position") ._M_iterator(__before, "before") ._M_iterator(__last, "last")); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 250. splicing invalidates iterators this->_M_transfer_from_if(__list, [__tmp](_Base_const_iterator __it) { return __it == __tmp; }); } _Base::splice_after(__pos.base(), std::move(__list._M_base()), __before.base(), __last.base()); } void splice_after(const_iterator __pos, forward_list& __list, const_iterator __before, const_iterator __last) { splice_after(__pos, std::move(__list), __before, __last); } void remove(const _Tp& __val) { _Base_iterator __x = _Base::before_begin(); _Base_iterator __old = __x++; while (__x != _Base::end()) { if (*__x == __val) __x = _M_erase_after(__old); else __old = __x++; } } template<typename _Pred> void remove_if(_Pred __pred) { _Base_iterator __x = _Base::before_begin(); _Base_iterator __old = __x++; while (__x != _Base::end()) { if (__pred(*__x)) __x = _M_erase_after(__old); else __old = __x++; } } void unique() { _Base_iterator __first = _Base::begin(); _Base_iterator __last = _Base::end(); if (__first == __last) return; _Base_iterator __next = std::next(__first); while (__next != __last) { if (*__first == *__next) __next = _M_erase_after(__first); else __first = __next++; } } template<typename _BinPred> void unique(_BinPred __binary_pred) { _Base_iterator __first = _Base::begin(); _Base_iterator __last = _Base::end(); if (__first == __last) return; _Base_iterator __next = std::next(__first); while (__next != __last) { if (__binary_pred(*__first, *__next)) __next = _M_erase_after(__first); else __first = __next++; } } void merge(forward_list&& __list) { if (this != &__list) { __glibcxx_check_sorted(_Base::begin(), _Base::end()); __glibcxx_check_sorted(__list._M_base().begin(), __list._M_base().end()); this->_M_transfer_from_if(__list, [&__list](_Base_const_iterator __it) { return __it != __list._M_base().cbefore_begin() && __it != __list._M_base().cend(); }); _Base::merge(std::move(__list._M_base())); } } void merge(forward_list& __list) { merge(std::move(__list)); } template<typename _Comp> void merge(forward_list&& __list, _Comp __comp) { if (this != &__list) { __glibcxx_check_sorted_pred(_Base::begin(), _Base::end(), __comp); __glibcxx_check_sorted_pred(__list._M_base().begin(), __list._M_base().end(), __comp); this->_M_transfer_from_if(__list, [&__list](_Base_const_iterator __it) { return __it != __list._M_base().cbefore_begin() && __it != __list._M_base().cend(); }); _Base::merge(std::move(__list._M_base()), __comp); } } template<typename _Comp> void merge(forward_list& __list, _Comp __comp) { merge(std::move(__list), __comp); } using _Base::sort; using _Base::reverse; _Base& _M_base() noexcept { return *this; } const _Base& _M_base() const noexcept { return *this; } private: void _M_invalidate_all() { this->_M_invalidate_if([this](_Base_const_iterator __it) { return __it != this->_M_base().cbefore_begin() && __it != this->_M_base().cend(); }); } typedef __gnu_debug::_Safe_iterator_base _Safe_iterator_base; static void _M_swap_aux(forward_list& __lhs, _Safe_iterator_base*& __lhs_iterators, forward_list& __rhs, _Safe_iterator_base*& __rhs_iterators); void _M_swap(forward_list& __list); }; template<typename _Tp, typename _Alloc> void forward_list<_Tp, _Alloc>:: _M_swap_aux(forward_list<_Tp, _Alloc>& __lhs, __gnu_debug::_Safe_iterator_base*& __lhs_iterators, forward_list<_Tp, _Alloc>& __rhs, __gnu_debug::_Safe_iterator_base*& __rhs_iterators) { using __gnu_debug::_Safe_iterator_base; _Safe_iterator_base* __bbegin_its = 0; _Safe_iterator_base* __last_bbegin = 0; for (_Safe_iterator_base* __iter = __lhs_iterators; __iter;) { // Even iterator are casted to const_iterator, not a problem. const_iterator* __victim = static_cast<const_iterator*>(__iter); __iter = __iter->_M_next; if (__victim->base() == __rhs._M_base().cbefore_begin()) { __victim->_M_unlink(); if (__lhs_iterators == __victim) __lhs_iterators = __victim->_M_next; if (__bbegin_its) { __victim->_M_next = __bbegin_its; __bbegin_its->_M_prior = __victim; } else __last_bbegin = __victim; __bbegin_its = __victim; } else __victim->_M_sequence = &__lhs; } if (__bbegin_its) { if (__rhs_iterators) { __rhs_iterators->_M_prior = __last_bbegin; __last_bbegin->_M_next = __rhs_iterators; } __rhs_iterators = __bbegin_its; } } /* Special forward_list _M_swap version that do not swap the * before-begin ownership.*/ template<typename _Tp, typename _Alloc> void forward_list<_Tp, _Alloc>:: _M_swap(forward_list<_Tp, _Alloc>& __list) { __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex()); std::swap(this->_M_iterators, __list._M_iterators); std::swap(this->_M_const_iterators, __list._M_const_iterators); // Useless, always 1 on forward_list //std::swap(this->_M_version, __list._M_version); _Safe_iterator_base* __this_its = this->_M_iterators; _M_swap_aux(__list, __list._M_iterators, *this, this->_M_iterators); _Safe_iterator_base* __this_const_its = this->_M_const_iterators; _M_swap_aux(__list, __list._M_const_iterators, *this, this->_M_const_iterators); _M_swap_aux(*this, __this_its, __list, __list._M_iterators); _M_swap_aux(*this, __this_const_its, __list, __list._M_const_iterators); } template<typename _Tp, typename _Alloc> bool operator==(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly) { return __lx._M_base() == __ly._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator<(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly) { return __lx._M_base() < __ly._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator!=(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly) { return !(__lx == __ly); } /// Based on operator< template<typename _Tp, typename _Alloc> inline bool operator>(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly) { return (__ly < __lx); } /// Based on operator< template<typename _Tp, typename _Alloc> inline bool operator>=(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly) { return !(__lx < __ly); } /// Based on operator< template<typename _Tp, typename _Alloc> inline bool operator<=(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly) { return !(__ly < __lx); } /// See std::forward_list::swap(). template<typename _Tp, typename _Alloc> inline void swap(forward_list<_Tp, _Alloc>& __lx, forward_list<_Tp, _Alloc>& __ly) { __lx.swap(__ly); } } // namespace __debug } // namespace std namespace __gnu_debug { template<class _Tp, class _Alloc> struct _BeforeBeginHelper<std::__debug::forward_list<_Tp, _Alloc> > { typedef std::__debug::forward_list<_Tp, _Alloc> _Sequence; typedef typename _Sequence::const_iterator _It; typedef typename _It::iterator_type _BaseIt; static bool _S_Is(_BaseIt __it, const _Sequence* __seq) { return __it == __seq->_M_base().cbefore_begin(); } static bool _S_Is_Beginnest(_BaseIt __it, const _Sequence* __seq) { return _S_Is(__it, __seq); } }; } #endif ������������������������������������������������������������������������c++/4.8.2/debug/unordered_set�����������������������������������������������������������������������0000644�����������������00000062504�14763166030�0011455 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debugging unordered_set/unordered_multiset implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/unordered_set * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_UNORDERED_SET #define _GLIBCXX_DEBUG_UNORDERED_SET 1 #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else # include <unordered_set> #include <debug/safe_unordered_container.h> #include <debug/safe_iterator.h> #include <debug/safe_local_iterator.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { /// Class std::unordered_set with safety/checking/debug instrumentation. template<typename _Value, typename _Hash = std::hash<_Value>, typename _Pred = std::equal_to<_Value>, typename _Alloc = std::allocator<_Value> > class unordered_set : public _GLIBCXX_STD_C::unordered_set<_Value, _Hash, _Pred, _Alloc>, public __gnu_debug::_Safe_unordered_container<unordered_set<_Value, _Hash, _Pred, _Alloc> > { typedef _GLIBCXX_STD_C::unordered_set<_Value, _Hash, _Pred, _Alloc> _Base; typedef __gnu_debug::_Safe_unordered_container<unordered_set> _Safe_base; typedef typename _Base::const_iterator _Base_const_iterator; typedef typename _Base::iterator _Base_iterator; typedef typename _Base::const_local_iterator _Base_const_local_iterator; typedef typename _Base::local_iterator _Base_local_iterator; public: typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; typedef typename _Base::allocator_type allocator_type; typedef typename _Base::key_type key_type; typedef typename _Base::value_type value_type; typedef __gnu_debug::_Safe_iterator<_Base_iterator, unordered_set> iterator; typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, unordered_set> const_iterator; typedef __gnu_debug::_Safe_local_iterator<_Base_local_iterator, unordered_set> local_iterator; typedef __gnu_debug::_Safe_local_iterator<_Base_const_local_iterator, unordered_set> const_local_iterator; explicit unordered_set(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) { } template<typename _InputIterator> unordered_set(_InputIterator __first, _InputIterator __last, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, __last)), __gnu_debug::__base(__last), __n, __hf, __eql, __a) { } unordered_set(const unordered_set& __x) = default; unordered_set(const _Base& __x) : _Base(__x) { } unordered_set(unordered_set&& __x) = default; unordered_set(initializer_list<value_type> __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__l, __n, __hf, __eql, __a) { } ~unordered_set() noexcept { } unordered_set& operator=(const unordered_set& __x) { *static_cast<_Base*>(this) = __x; this->_M_invalidate_all(); return *this; } unordered_set& operator=(unordered_set&& __x) { // NB: DR 1204. // NB: DR 675. __glibcxx_check_self_move_assign(__x); clear(); swap(__x); return *this; } unordered_set& operator=(initializer_list<value_type> __l) { this->clear(); this->insert(__l); return *this; } void swap(unordered_set& __x) { _Base::swap(__x); _Safe_base::_M_swap(__x); } void clear() noexcept { _Base::clear(); this->_M_invalidate_all(); } iterator begin() noexcept { return iterator(_Base::begin(), this); } const_iterator begin() const noexcept { return const_iterator(_Base::begin(), this); } iterator end() noexcept { return iterator(_Base::end(), this); } const_iterator end() const noexcept { return const_iterator(_Base::end(), this); } const_iterator cbegin() const noexcept { return const_iterator(_Base::begin(), this); } const_iterator cend() const noexcept { return const_iterator(_Base::end(), this); } // local versions local_iterator begin(size_type __b) { __glibcxx_check_bucket_index(__b); return local_iterator(_Base::begin(__b), __b, this); } local_iterator end(size_type __b) { __glibcxx_check_bucket_index(__b); return local_iterator(_Base::end(__b), __b, this); } const_local_iterator begin(size_type __b) const { __glibcxx_check_bucket_index(__b); return const_local_iterator(_Base::begin(__b), __b, this); } const_local_iterator end(size_type __b) const { __glibcxx_check_bucket_index(__b); return const_local_iterator(_Base::end(__b), __b, this); } const_local_iterator cbegin(size_type __b) const { __glibcxx_check_bucket_index(__b); return const_local_iterator(_Base::cbegin(__b), __b, this); } const_local_iterator cend(size_type __b) const { __glibcxx_check_bucket_index(__b); return const_local_iterator(_Base::cend(__b), __b, this); } size_type bucket_size(size_type __b) const { __glibcxx_check_bucket_index(__b); return _Base::bucket_size(__b); } float max_load_factor() const noexcept { return _Base::max_load_factor(); } void max_load_factor(float __f) { __glibcxx_check_max_load_factor(__f); _Base::max_load_factor(__f); } template<typename... _Args> std::pair<iterator, bool> emplace(_Args&&... __args) { size_type __bucket_count = this->bucket_count(); std::pair<_Base_iterator, bool> __res = _Base::emplace(std::forward<_Args>(__args)...); _M_check_rehashed(__bucket_count); return std::make_pair(iterator(__res.first, this), __res.second); } template<typename... _Args> iterator emplace_hint(const_iterator __hint, _Args&&... __args) { __glibcxx_check_insert(__hint); size_type __bucket_count = this->bucket_count(); _Base_iterator __it = _Base::emplace_hint(__hint.base(), std::forward<_Args>(__args)...); _M_check_rehashed(__bucket_count); return iterator(__it, this); } std::pair<iterator, bool> insert(const value_type& __obj) { size_type __bucket_count = this->bucket_count(); typedef std::pair<_Base_iterator, bool> __pair_type; __pair_type __res = _Base::insert(__obj); _M_check_rehashed(__bucket_count); return std::make_pair(iterator(__res.first, this), __res.second); } iterator insert(const_iterator __hint, const value_type& __obj) { __glibcxx_check_insert(__hint); size_type __bucket_count = this->bucket_count(); _Base_iterator __it = _Base::insert(__hint.base(), __obj); _M_check_rehashed(__bucket_count); return iterator(__it, this); } std::pair<iterator, bool> insert(value_type&& __obj) { size_type __bucket_count = this->bucket_count(); typedef std::pair<typename _Base::iterator, bool> __pair_type; __pair_type __res = _Base::insert(std::move(__obj)); _M_check_rehashed(__bucket_count); return std::make_pair(iterator(__res.first, this), __res.second); } iterator insert(const_iterator __hint, value_type&& __obj) { __glibcxx_check_insert(__hint); size_type __bucket_count = this->bucket_count(); _Base_iterator __it = _Base::insert(__hint.base(), std::move(__obj)); _M_check_rehashed(__bucket_count); return iterator(__it, this); } void insert(std::initializer_list<value_type> __l) { size_type __bucket_count = this->bucket_count(); _Base::insert(__l); _M_check_rehashed(__bucket_count); } template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) { __glibcxx_check_valid_range(__first, __last); size_type __bucket_count = this->bucket_count(); _Base::insert(__gnu_debug::__base(__first), __gnu_debug::__base(__last)); _M_check_rehashed(__bucket_count); } iterator find(const key_type& __key) { return iterator(_Base::find(__key), this); } const_iterator find(const key_type& __key) const { return const_iterator(_Base::find(__key), this); } std::pair<iterator, iterator> equal_range(const key_type& __key) { typedef std::pair<_Base_iterator, _Base_iterator> __pair_type; __pair_type __res = _Base::equal_range(__key); return std::make_pair(iterator(__res.first, this), iterator(__res.second, this)); } std::pair<const_iterator, const_iterator> equal_range(const key_type& __key) const { std::pair<_Base_const_iterator, _Base_const_iterator> __res = _Base::equal_range(__key); return std::make_pair(const_iterator(__res.first, this), const_iterator(__res.second, this)); } size_type erase(const key_type& __key) { size_type __ret(0); _Base_iterator __victim(_Base::find(__key)); if (__victim != _Base::end()) { this->_M_invalidate_if( [__victim](_Base_const_iterator __it) { return __it == __victim; }); this->_M_invalidate_local_if( [__victim](_Base_const_local_iterator __it) { return __it._M_cur == __victim._M_cur; }); size_type __bucket_count = this->bucket_count(); _Base::erase(__victim); _M_check_rehashed(__bucket_count); __ret = 1; } return __ret; } iterator erase(const_iterator __it) { __glibcxx_check_erase(__it); _Base_const_iterator __victim = __it.base(); this->_M_invalidate_if( [__victim](_Base_const_iterator __it) { return __it == __victim; }); this->_M_invalidate_local_if( [__victim](_Base_const_local_iterator __it) { return __it._M_cur == __victim._M_cur; }); size_type __bucket_count = this->bucket_count(); _Base_iterator __next = _Base::erase(__it.base()); _M_check_rehashed(__bucket_count); return iterator(__next, this); } iterator erase(iterator __it) { return erase(const_iterator(__it)); } iterator erase(const_iterator __first, const_iterator __last) { __glibcxx_check_erase_range(__first, __last); for (_Base_const_iterator __tmp = __first.base(); __tmp != __last.base(); ++__tmp) { _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::end(), _M_message(__gnu_debug::__msg_valid_range) ._M_iterator(__first, "first") ._M_iterator(__last, "last")); this->_M_invalidate_if( [__tmp](_Base_const_iterator __it) { return __it == __tmp; }); this->_M_invalidate_local_if( [__tmp](_Base_const_local_iterator __it) { return __it._M_cur == __tmp._M_cur; }); } size_type __bucket_count = this->bucket_count(); _Base_iterator __next = _Base::erase(__first.base(), __last.base()); _M_check_rehashed(__bucket_count); return iterator(__next, this); } _Base& _M_base() noexcept { return *this; } const _Base& _M_base() const noexcept { return *this; } private: void _M_invalidate_locals() { _Base_local_iterator __local_end = _Base::end(0); this->_M_invalidate_local_if( [__local_end](_Base_const_local_iterator __it) { return __it != __local_end; }); } void _M_invalidate_all() { _Base_iterator __end = _Base::end(); this->_M_invalidate_if( [__end](_Base_const_iterator __it) { return __it != __end; }); _M_invalidate_locals(); } void _M_check_rehashed(size_type __prev_count) { if (__prev_count != this->bucket_count()) _M_invalidate_locals(); } }; template<typename _Value, typename _Hash, typename _Pred, typename _Alloc> inline void swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) { __x.swap(__y); } template<typename _Value, typename _Hash, typename _Pred, typename _Alloc> inline bool operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) { return __x._M_base() == __y._M_base(); } template<typename _Value, typename _Hash, typename _Pred, typename _Alloc> inline bool operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) { return !(__x == __y); } /// Class std::unordered_multiset with safety/checking/debug instrumentation. template<typename _Value, typename _Hash = std::hash<_Value>, typename _Pred = std::equal_to<_Value>, typename _Alloc = std::allocator<_Value> > class unordered_multiset : public _GLIBCXX_STD_C::unordered_multiset<_Value, _Hash, _Pred, _Alloc>, public __gnu_debug::_Safe_unordered_container< unordered_multiset<_Value, _Hash, _Pred, _Alloc> > { typedef _GLIBCXX_STD_C::unordered_multiset<_Value, _Hash, _Pred, _Alloc> _Base; typedef __gnu_debug::_Safe_unordered_container<unordered_multiset> _Safe_base; typedef typename _Base::const_iterator _Base_const_iterator; typedef typename _Base::iterator _Base_iterator; typedef typename _Base::const_local_iterator _Base_const_local_iterator; typedef typename _Base::local_iterator _Base_local_iterator; public: typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; typedef typename _Base::allocator_type allocator_type; typedef typename _Base::key_type key_type; typedef typename _Base::value_type value_type; typedef __gnu_debug::_Safe_iterator<_Base_iterator, unordered_multiset> iterator; typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, unordered_multiset> const_iterator; typedef __gnu_debug::_Safe_local_iterator< _Base_local_iterator, unordered_multiset> local_iterator; typedef __gnu_debug::_Safe_local_iterator< _Base_const_local_iterator, unordered_multiset> const_local_iterator; explicit unordered_multiset(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) { } template<typename _InputIterator> unordered_multiset(_InputIterator __first, _InputIterator __last, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, __last)), __gnu_debug::__base(__last), __n, __hf, __eql, __a) { } unordered_multiset(const unordered_multiset& __x) = default; unordered_multiset(const _Base& __x) : _Base(__x) { } unordered_multiset(unordered_multiset&& __x) = default; unordered_multiset(initializer_list<value_type> __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__l, __n, __hf, __eql, __a) { } ~unordered_multiset() noexcept { } unordered_multiset& operator=(const unordered_multiset& __x) { *static_cast<_Base*>(this) = __x; this->_M_invalidate_all(); return *this; } unordered_multiset& operator=(unordered_multiset&& __x) { // NB: DR 1204. // NB: DR 675. __glibcxx_check_self_move_assign(__x); clear(); swap(__x); return *this; } unordered_multiset& operator=(initializer_list<value_type> __l) { this->clear(); this->insert(__l); return *this; } void swap(unordered_multiset& __x) { _Base::swap(__x); _Safe_base::_M_swap(__x); } void clear() noexcept { _Base::clear(); this->_M_invalidate_all(); } iterator begin() noexcept { return iterator(_Base::begin(), this); } const_iterator begin() const noexcept { return const_iterator(_Base::begin(), this); } iterator end() noexcept { return iterator(_Base::end(), this); } const_iterator end() const noexcept { return const_iterator(_Base::end(), this); } const_iterator cbegin() const noexcept { return const_iterator(_Base::begin(), this); } const_iterator cend() const noexcept { return const_iterator(_Base::end(), this); } // local versions local_iterator begin(size_type __b) { __glibcxx_check_bucket_index(__b); return local_iterator(_Base::begin(__b), __b, this); } local_iterator end(size_type __b) { __glibcxx_check_bucket_index(__b); return local_iterator(_Base::end(__b), __b, this); } const_local_iterator begin(size_type __b) const { __glibcxx_check_bucket_index(__b); return const_local_iterator(_Base::begin(__b), __b, this); } const_local_iterator end(size_type __b) const { __glibcxx_check_bucket_index(__b); return const_local_iterator(_Base::end(__b), __b, this); } const_local_iterator cbegin(size_type __b) const { __glibcxx_check_bucket_index(__b); return const_local_iterator(_Base::cbegin(__b), __b, this); } const_local_iterator cend(size_type __b) const { __glibcxx_check_bucket_index(__b); return const_local_iterator(_Base::cend(__b), __b, this); } size_type bucket_size(size_type __b) const { __glibcxx_check_bucket_index(__b); return _Base::bucket_size(__b); } float max_load_factor() const noexcept { return _Base::max_load_factor(); } void max_load_factor(float __f) { __glibcxx_check_max_load_factor(__f); _Base::max_load_factor(__f); } template<typename... _Args> iterator emplace(_Args&&... __args) { size_type __bucket_count = this->bucket_count(); _Base_iterator __it = _Base::emplace(std::forward<_Args>(__args)...); _M_check_rehashed(__bucket_count); return iterator(__it, this); } template<typename... _Args> iterator emplace_hint(const_iterator __hint, _Args&&... __args) { __glibcxx_check_insert(__hint); size_type __bucket_count = this->bucket_count(); _Base_iterator __it = _Base::emplace_hint(__hint.base(), std::forward<_Args>(__args)...); _M_check_rehashed(__bucket_count); return iterator(__it, this); } iterator insert(const value_type& __obj) { size_type __bucket_count = this->bucket_count(); _Base_iterator __it = _Base::insert(__obj); _M_check_rehashed(__bucket_count); return iterator(__it, this); } iterator insert(const_iterator __hint, const value_type& __obj) { __glibcxx_check_insert(__hint); size_type __bucket_count = this->bucket_count(); _Base_iterator __it = _Base::insert(__hint.base(), __obj); _M_check_rehashed(__bucket_count); return iterator(__it, this); } iterator insert(value_type&& __obj) { size_type __bucket_count = this->bucket_count(); _Base_iterator __it = _Base::insert(std::move(__obj)); _M_check_rehashed(__bucket_count); return iterator(__it, this); } iterator insert(const_iterator __hint, value_type&& __obj) { __glibcxx_check_insert(__hint); size_type __bucket_count = this->bucket_count(); _Base_iterator __it = _Base::insert(__hint.base(), std::move(__obj)); _M_check_rehashed(__bucket_count); return iterator(__it, this); } void insert(std::initializer_list<value_type> __l) { size_type __bucket_count = this->bucket_count(); _Base::insert(__l); _M_check_rehashed(__bucket_count); } template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) { __glibcxx_check_valid_range(__first, __last); size_type __bucket_count = this->bucket_count(); _Base::insert(__gnu_debug::__base(__first), __gnu_debug::__base(__last)); _M_check_rehashed(__bucket_count); } iterator find(const key_type& __key) { return iterator(_Base::find(__key), this); } const_iterator find(const key_type& __key) const { return const_iterator(_Base::find(__key), this); } std::pair<iterator, iterator> equal_range(const key_type& __key) { typedef std::pair<_Base_iterator, _Base_iterator> __pair_type; __pair_type __res = _Base::equal_range(__key); return std::make_pair(iterator(__res.first, this), iterator(__res.second, this)); } std::pair<const_iterator, const_iterator> equal_range(const key_type& __key) const { std::pair<_Base_const_iterator, _Base_const_iterator> __res = _Base::equal_range(__key); return std::make_pair(const_iterator(__res.first, this), const_iterator(__res.second, this)); } size_type erase(const key_type& __key) { size_type __ret(0); std::pair<_Base_iterator, _Base_iterator> __pair = _Base::equal_range(__key); for (_Base_iterator __victim = __pair.first; __victim != __pair.second;) { this->_M_invalidate_if([__victim](_Base_const_iterator __it) { return __it == __victim; }); this->_M_invalidate_local_if( [__victim](_Base_const_local_iterator __it) { return __it._M_cur == __victim._M_cur; }); _Base::erase(__victim++); ++__ret; } return __ret; } iterator erase(const_iterator __it) { __glibcxx_check_erase(__it); _Base_const_iterator __victim = __it.base(); this->_M_invalidate_if([__victim](_Base_const_iterator __it) { return __it == __victim; }); this->_M_invalidate_local_if( [__victim](_Base_const_local_iterator __it) { return __it._M_cur == __victim._M_cur; }); return iterator(_Base::erase(__it.base()), this); } iterator erase(iterator __it) { return erase(const_iterator(__it)); } iterator erase(const_iterator __first, const_iterator __last) { __glibcxx_check_erase_range(__first, __last); for (_Base_const_iterator __tmp = __first.base(); __tmp != __last.base(); ++__tmp) { _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::end(), _M_message(__gnu_debug::__msg_valid_range) ._M_iterator(__first, "first") ._M_iterator(__last, "last")); this->_M_invalidate_if([__tmp](_Base_const_iterator __it) { return __it == __tmp; }); this->_M_invalidate_local_if( [__tmp](_Base_const_local_iterator __it) { return __it._M_cur == __tmp._M_cur; }); } return iterator(_Base::erase(__first.base(), __last.base()), this); } _Base& _M_base() noexcept { return *this; } const _Base& _M_base() const noexcept { return *this; } private: void _M_invalidate_locals() { _Base_local_iterator __local_end = _Base::end(0); this->_M_invalidate_local_if( [__local_end](_Base_const_local_iterator __it) { return __it != __local_end; }); } void _M_invalidate_all() { _Base_iterator __end = _Base::end(); this->_M_invalidate_if([__end](_Base_const_iterator __it) { return __it != __end; }); _M_invalidate_locals(); } void _M_check_rehashed(size_type __prev_count) { if (__prev_count != this->bucket_count()) _M_invalidate_locals(); } }; template<typename _Value, typename _Hash, typename _Pred, typename _Alloc> inline void swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) { __x.swap(__y); } template<typename _Value, typename _Hash, typename _Pred, typename _Alloc> inline bool operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) { return __x._M_base() == __y._M_base(); } template<typename _Value, typename _Hash, typename _Pred, typename _Alloc> inline bool operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) { return !(__x == __y); } } // namespace __debug } // namespace std #endif // C++11 #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/bitset������������������������������������������������������������������������������0000644�����������������00000027212�14763166030�0010102 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debugging bitset implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/bitset * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_BITSET #define _GLIBCXX_DEBUG_BITSET #include <bitset> #include <debug/safe_sequence.h> #include <debug/safe_iterator.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { /// Class std::bitset with additional safety/checking/debug instrumentation. template<size_t _Nb> class bitset : public _GLIBCXX_STD_C::bitset<_Nb> #if __cplusplus < 201103L , public __gnu_debug::_Safe_sequence_base #endif { typedef _GLIBCXX_STD_C::bitset<_Nb> _Base; public: // In C++0x we rely on normal reference type to preserve the property // of bitset to be use as a literal. // TODO: Find another solution. #if __cplusplus >= 201103L typedef typename _Base::reference reference; #else // bit reference: class reference : private _Base::reference , public __gnu_debug::_Safe_iterator_base { typedef typename _Base::reference _Base_ref; friend class bitset; reference(); reference(const _Base_ref& __base, bitset* __seq __attribute__((__unused__))) _GLIBCXX_NOEXCEPT : _Base_ref(__base) , _Safe_iterator_base(__seq, false) { } public: reference(const reference& __x) _GLIBCXX_NOEXCEPT : _Base_ref(__x) , _Safe_iterator_base(__x, false) { } reference& operator=(bool __x) _GLIBCXX_NOEXCEPT { _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(), _M_message(__gnu_debug::__msg_bad_bitset_write) ._M_iterator(*this)); *static_cast<_Base_ref*>(this) = __x; return *this; } reference& operator=(const reference& __x) _GLIBCXX_NOEXCEPT { _GLIBCXX_DEBUG_VERIFY(! __x._M_singular(), _M_message(__gnu_debug::__msg_bad_bitset_read) ._M_iterator(__x)); _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(), _M_message(__gnu_debug::__msg_bad_bitset_write) ._M_iterator(*this)); *static_cast<_Base_ref*>(this) = __x; return *this; } bool operator~() const _GLIBCXX_NOEXCEPT { _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(), _M_message(__gnu_debug::__msg_bad_bitset_read) ._M_iterator(*this)); return ~(*static_cast<const _Base_ref*>(this)); } operator bool() const _GLIBCXX_NOEXCEPT { _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(), _M_message(__gnu_debug::__msg_bad_bitset_read) ._M_iterator(*this)); return *static_cast<const _Base_ref*>(this); } reference& flip() _GLIBCXX_NOEXCEPT { _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(), _M_message(__gnu_debug::__msg_bad_bitset_flip) ._M_iterator(*this)); _Base_ref::flip(); return *this; } }; #endif // 23.3.5.1 constructors: _GLIBCXX_CONSTEXPR bitset() _GLIBCXX_NOEXCEPT : _Base() { } #if __cplusplus >= 201103L constexpr bitset(unsigned long long __val) noexcept #else bitset(unsigned long __val) #endif : _Base(__val) { } template<typename _CharT, typename _Traits, typename _Alloc> explicit bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __str, typename std::basic_string<_CharT, _Traits, _Alloc>::size_type __pos = 0, typename std::basic_string<_CharT, _Traits, _Alloc>::size_type __n = (std::basic_string<_CharT, _Traits, _Alloc>::npos)) : _Base(__str, __pos, __n) { } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 396. what are characters zero and one. template<class _CharT, class _Traits, class _Alloc> bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __str, typename std::basic_string<_CharT, _Traits, _Alloc>::size_type __pos, typename std::basic_string<_CharT, _Traits, _Alloc>::size_type __n, _CharT __zero, _CharT __one = _CharT('1')) : _Base(__str, __pos, __n, __zero, __one) { } bitset(const _Base& __x) : _Base(__x) { } #if __cplusplus >= 201103L template<typename _CharT> explicit bitset(const _CharT* __str, typename std::basic_string<_CharT>::size_type __n = std::basic_string<_CharT>::npos, _CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) : _Base(__str, __n, __zero, __one) { } #endif // 23.3.5.2 bitset operations: bitset<_Nb>& operator&=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT { _M_base() &= __rhs; return *this; } bitset<_Nb>& operator|=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT { _M_base() |= __rhs; return *this; } bitset<_Nb>& operator^=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT { _M_base() ^= __rhs; return *this; } bitset<_Nb>& operator<<=(size_t __pos) _GLIBCXX_NOEXCEPT { _M_base() <<= __pos; return *this; } bitset<_Nb>& operator>>=(size_t __pos) _GLIBCXX_NOEXCEPT { _M_base() >>= __pos; return *this; } bitset<_Nb>& set() _GLIBCXX_NOEXCEPT { _Base::set(); return *this; } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 186. bitset::set() second parameter should be bool bitset<_Nb>& set(size_t __pos, bool __val = true) { _Base::set(__pos, __val); return *this; } bitset<_Nb>& reset() _GLIBCXX_NOEXCEPT { _Base::reset(); return *this; } bitset<_Nb>& reset(size_t __pos) { _Base::reset(__pos); return *this; } bitset<_Nb> operator~() const _GLIBCXX_NOEXCEPT { return bitset(~_M_base()); } bitset<_Nb>& flip() _GLIBCXX_NOEXCEPT { _Base::flip(); return *this; } bitset<_Nb>& flip(size_t __pos) { _Base::flip(__pos); return *this; } // element access: // _GLIBCXX_RESOLVE_LIB_DEFECTS // 11. Bitset minor problems reference operator[](size_t __pos) { __glibcxx_check_subscript(__pos); #if __cplusplus >= 201103L return _M_base()[__pos]; #else return reference(_M_base()[__pos], this); #endif } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 11. Bitset minor problems _GLIBCXX_CONSTEXPR bool operator[](size_t __pos) const { #if __cplusplus < 201103L // TODO: Check in debug-mode too. __glibcxx_check_subscript(__pos); #endif return _Base::operator[](__pos); } using _Base::to_ulong; #if __cplusplus >= 201103L using _Base::to_ullong; #endif template <typename _CharT, typename _Traits, typename _Alloc> std::basic_string<_CharT, _Traits, _Alloc> to_string() const { return _M_base().template to_string<_CharT, _Traits, _Alloc>(); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 396. what are characters zero and one. template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> to_string(_CharT __zero, _CharT __one = _CharT('1')) const { return _M_base().template to_string<_CharT, _Traits, _Alloc>(__zero, __one); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 434. bitset::to_string() hard to use. template<typename _CharT, typename _Traits> std::basic_string<_CharT, _Traits, std::allocator<_CharT> > to_string() const { return to_string<_CharT, _Traits, std::allocator<_CharT> >(); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 853. to_string needs updating with zero and one. template<class _CharT, class _Traits> std::basic_string<_CharT, _Traits, std::allocator<_CharT> > to_string(_CharT __zero, _CharT __one = _CharT('1')) const { return to_string<_CharT, _Traits, std::allocator<_CharT> >(__zero, __one); } template<typename _CharT> std::basic_string<_CharT, std::char_traits<_CharT>, std::allocator<_CharT> > to_string() const { return to_string<_CharT, std::char_traits<_CharT>, std::allocator<_CharT> >(); } template<class _CharT> std::basic_string<_CharT, std::char_traits<_CharT>, std::allocator<_CharT> > to_string(_CharT __zero, _CharT __one = _CharT('1')) const { return to_string<_CharT, std::char_traits<_CharT>, std::allocator<_CharT> >(__zero, __one); } std::basic_string<char, std::char_traits<char>, std::allocator<char> > to_string() const { return to_string<char,std::char_traits<char>,std::allocator<char> >(); } std::basic_string<char, std::char_traits<char>, std::allocator<char> > to_string(char __zero, char __one = '1') const { return to_string<char, std::char_traits<char>, std::allocator<char> >(__zero, __one); } using _Base::count; using _Base::size; bool operator==(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT { return _M_base() == __rhs; } bool operator!=(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT { return _M_base() != __rhs; } using _Base::test; using _Base::all; using _Base::any; using _Base::none; bitset<_Nb> operator<<(size_t __pos) const _GLIBCXX_NOEXCEPT { return bitset<_Nb>(_M_base() << __pos); } bitset<_Nb> operator>>(size_t __pos) const _GLIBCXX_NOEXCEPT { return bitset<_Nb>(_M_base() >> __pos); } _Base& _M_base() _GLIBCXX_NOEXCEPT { return *this; } const _Base& _M_base() const _GLIBCXX_NOEXCEPT { return *this; } }; template<size_t _Nb> bitset<_Nb> operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT { return bitset<_Nb>(__x) &= __y; } template<size_t _Nb> bitset<_Nb> operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT { return bitset<_Nb>(__x) |= __y; } template<size_t _Nb> bitset<_Nb> operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT { return bitset<_Nb>(__x) ^= __y; } template<typename _CharT, typename _Traits, size_t _Nb> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) { return __is >> __x._M_base(); } template<typename _CharT, typename _Traits, size_t _Nb> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const bitset<_Nb>& __x) { return __os << __x._M_base(); } } // namespace __debug #if __cplusplus >= 201103L // DR 1182. /// std::hash specialization for bitset. template<size_t _Nb> struct hash<__debug::bitset<_Nb>> : public __hash_base<size_t, __debug::bitset<_Nb>> { size_t operator()(const __debug::bitset<_Nb>& __b) const noexcept { return std::hash<_GLIBCXX_STD_C::bitset<_Nb>>()(__b._M_base()); } }; #endif } // namespace std #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/safe_local_iterator.h���������������������������������������������������������������0000644�����������������00000030441�14763166030�0013035 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Safe iterator implementation -*- C++ -*- // Copyright (C) 2011-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/safe_local_iterator.h * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_SAFE_LOCAL_ITERATOR_H #define _GLIBCXX_DEBUG_SAFE_LOCAL_ITERATOR_H 1 #include <debug/debug.h> #include <debug/macros.h> #include <debug/functions.h> #include <debug/safe_unordered_base.h> #include <ext/type_traits.h> namespace __gnu_debug { /** \brief Safe iterator wrapper. * * The class template %_Safe_local_iterator is a wrapper around an * iterator that tracks the iterator's movement among sequences and * checks that operations performed on the "safe" iterator are * legal. In additional to the basic iterator operations (which are * validated, and then passed to the underlying iterator), * %_Safe_local_iterator has member functions for iterator invalidation, * attaching/detaching the iterator from sequences, and querying * the iterator's state. */ template<typename _Iterator, typename _Sequence> class _Safe_local_iterator : public _Safe_local_iterator_base { typedef _Safe_local_iterator _Self; typedef typename _Sequence::size_type size_type; /// The underlying iterator _Iterator _M_current; /// The bucket this local iterator belongs to size_type _M_bucket; /// Determine if this is a constant iterator. bool _M_constant() const { typedef typename _Sequence::const_local_iterator const_iterator; return std::__are_same<const_iterator, _Safe_local_iterator>::__value; } typedef std::iterator_traits<_Iterator> _Traits; public: typedef _Iterator iterator_type; typedef typename _Traits::iterator_category iterator_category; typedef typename _Traits::value_type value_type; typedef typename _Traits::difference_type difference_type; typedef typename _Traits::reference reference; typedef typename _Traits::pointer pointer; /// @post the iterator is singular and unattached _Safe_local_iterator() : _M_current() { } /** * @brief Safe iterator construction from an unsafe iterator and * its sequence. * * @pre @p seq is not NULL * @post this is not singular */ _Safe_local_iterator(const _Iterator& __i, size_type __bucket, const _Sequence* __seq) : _Safe_local_iterator_base(__seq, _M_constant()), _M_current(__i), _M_bucket(__bucket) { _GLIBCXX_DEBUG_VERIFY(!this->_M_singular(), _M_message(__msg_init_singular) ._M_iterator(*this, "this")); } /** * @brief Copy construction. */ _Safe_local_iterator(const _Safe_local_iterator& __x) : _Safe_local_iterator_base(__x, _M_constant()), _M_current(__x._M_current), _M_bucket(__x._M_bucket) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 408. Is vector<reverse_iterator<char*> > forbidden? _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() || __x._M_current == _Iterator(), _M_message(__msg_init_copy_singular) ._M_iterator(*this, "this") ._M_iterator(__x, "other")); } /** * @brief Converting constructor from a mutable iterator to a * constant iterator. */ template<typename _MutableIterator> _Safe_local_iterator( const _Safe_local_iterator<_MutableIterator, typename __gnu_cxx::__enable_if<std::__are_same< _MutableIterator, typename _Sequence::local_iterator::iterator_type>::__value, _Sequence>::__type>& __x) : _Safe_local_iterator_base(__x, _M_constant()), _M_current(__x.base()), _M_bucket(__x._M_bucket) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 408. Is vector<reverse_iterator<char*> > forbidden? _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() || __x.base() == _Iterator(), _M_message(__msg_init_const_singular) ._M_iterator(*this, "this") ._M_iterator(__x, "other")); } /** * @brief Copy assignment. */ _Safe_local_iterator& operator=(const _Safe_local_iterator& __x) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 408. Is vector<reverse_iterator<char*> > forbidden? _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() || __x._M_current == _Iterator(), _M_message(__msg_copy_singular) ._M_iterator(*this, "this") ._M_iterator(__x, "other")); _M_current = __x._M_current; _M_bucket = __x._M_bucket; this->_M_attach(__x._M_sequence); return *this; } /** * @brief Iterator dereference. * @pre iterator is dereferenceable */ reference operator*() const { _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), _M_message(__msg_bad_deref) ._M_iterator(*this, "this")); return *_M_current; } /** * @brief Iterator dereference. * @pre iterator is dereferenceable * @todo Make this correct w.r.t. iterators that return proxies * @todo Use addressof() instead of & operator */ pointer operator->() const { _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), _M_message(__msg_bad_deref) ._M_iterator(*this, "this")); return &*_M_current; } // ------ Input iterator requirements ------ /** * @brief Iterator preincrement * @pre iterator is incrementable */ _Safe_local_iterator& operator++() { _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), _M_message(__msg_bad_inc) ._M_iterator(*this, "this")); ++_M_current; return *this; } /** * @brief Iterator postincrement * @pre iterator is incrementable */ _Safe_local_iterator operator++(int) { _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), _M_message(__msg_bad_inc) ._M_iterator(*this, "this")); _Safe_local_iterator __tmp(*this); ++_M_current; return __tmp; } // ------ Utilities ------ /** * @brief Return the underlying iterator */ _Iterator base() const { return _M_current; } /** * @brief Return the bucket */ size_type bucket() const { return _M_bucket; } /** * @brief Conversion to underlying non-debug iterator to allow * better interaction with non-debug containers. */ operator _Iterator() const { return _M_current; } /** Attach iterator to the given sequence. */ void _M_attach(_Safe_sequence_base* __seq) { _Safe_iterator_base::_M_attach(__seq, _M_constant()); } /** Likewise, but not thread-safe. */ void _M_attach_single(_Safe_sequence_base* __seq) { _Safe_iterator_base::_M_attach_single(__seq, _M_constant()); } /// Is the iterator dereferenceable? bool _M_dereferenceable() const { return !this->_M_singular() && !_M_is_end(); } /// Is the iterator incrementable? bool _M_incrementable() const { return !this->_M_singular() && !_M_is_end(); } // Is the iterator range [*this, __rhs) valid? template<typename _Other> bool _M_valid_range(const _Safe_local_iterator<_Other, _Sequence>& __rhs) const; // The sequence this iterator references. const _Sequence* _M_get_sequence() const { return static_cast<const _Sequence*>(_M_sequence); } /// Is this iterator equal to the sequence's begin() iterator? bool _M_is_begin() const { return base() == _M_get_sequence()->_M_base().begin(_M_bucket); } /// Is this iterator equal to the sequence's end() iterator? bool _M_is_end() const { return base() == _M_get_sequence()->_M_base().end(_M_bucket); } /// Is this iterator part of the same bucket as the other one? template <typename _Other> bool _M_in_same_bucket(const _Safe_local_iterator<_Other, _Sequence>& __other) const { return _M_bucket == __other.bucket(); } }; template<typename _IteratorL, typename _IteratorR, typename _Sequence> inline bool operator==(const _Safe_local_iterator<_IteratorL, _Sequence>& __lhs, const _Safe_local_iterator<_IteratorR, _Sequence>& __rhs) { _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), _M_message(__msg_iter_compare_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), _M_message(__msg_compare_different) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), _M_message(__msg_compare_different) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_in_same_bucket(__rhs), _M_message(__msg_local_iter_compare_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); return __lhs.base() == __rhs.base(); } template<typename _Iterator, typename _Sequence> inline bool operator==(const _Safe_local_iterator<_Iterator, _Sequence>& __lhs, const _Safe_local_iterator<_Iterator, _Sequence>& __rhs) { _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), _M_message(__msg_iter_compare_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), _M_message(__msg_compare_different) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_in_same_bucket(__rhs), _M_message(__msg_local_iter_compare_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); return __lhs.base() == __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Sequence> inline bool operator!=(const _Safe_local_iterator<_IteratorL, _Sequence>& __lhs, const _Safe_local_iterator<_IteratorR, _Sequence>& __rhs) { _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), _M_message(__msg_iter_compare_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), _M_message(__msg_compare_different) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_in_same_bucket(__rhs), _M_message(__msg_local_iter_compare_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); return __lhs.base() != __rhs.base(); } template<typename _Iterator, typename _Sequence> inline bool operator!=(const _Safe_local_iterator<_Iterator, _Sequence>& __lhs, const _Safe_local_iterator<_Iterator, _Sequence>& __rhs) { _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), _M_message(__msg_iter_compare_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), _M_message(__msg_compare_different) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); _GLIBCXX_DEBUG_VERIFY(__lhs._M_in_same_bucket(__rhs), _M_message(__msg_local_iter_compare_bad) ._M_iterator(__lhs, "lhs") ._M_iterator(__rhs, "rhs")); return __lhs.base() != __rhs.base(); } } // namespace __gnu_debug #include <debug/safe_local_iterator.tcc> #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/map.h�������������������������������������������������������������������������������0000644�����������������00000034410�14763166030�0007611 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debugging map implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/map.h * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_MAP_H #define _GLIBCXX_DEBUG_MAP_H 1 #include <debug/safe_sequence.h> #include <debug/safe_iterator.h> #include <utility> namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { /// Class std::map with safety/checking/debug instrumentation. template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>, typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > > class map : public _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator>, public __gnu_debug::_Safe_sequence<map<_Key, _Tp, _Compare, _Allocator> > { typedef _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator> _Base; typedef typename _Base::const_iterator _Base_const_iterator; typedef typename _Base::iterator _Base_iterator; typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; public: // types: typedef _Key key_type; typedef _Tp mapped_type; typedef std::pair<const _Key, _Tp> value_type; typedef _Compare key_compare; typedef _Allocator allocator_type; typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef __gnu_debug::_Safe_iterator<_Base_iterator, map> iterator; typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, map> const_iterator; typedef typename _Base::size_type size_type; typedef typename _Base::difference_type difference_type; typedef typename _Base::pointer pointer; typedef typename _Base::const_pointer const_pointer; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // 23.3.1.1 construct/copy/destroy: explicit map(const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) : _Base(__comp, __a) { } template<typename _InputIterator> map(_InputIterator __first, _InputIterator __last, const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, __last)), __gnu_debug::__base(__last), __comp, __a) { } map(const map& __x) : _Base(__x) { } map(const _Base& __x) : _Base(__x) { } #if __cplusplus >= 201103L map(map&& __x) noexcept(is_nothrow_copy_constructible<_Compare>::value) : _Base(std::move(__x)) { this->_M_swap(__x); } map(initializer_list<value_type> __l, const _Compare& __c = _Compare(), const allocator_type& __a = allocator_type()) : _Base(__l, __c, __a) { } #endif ~map() _GLIBCXX_NOEXCEPT { } map& operator=(const map& __x) { *static_cast<_Base*>(this) = __x; this->_M_invalidate_all(); return *this; } #if __cplusplus >= 201103L map& operator=(map&& __x) { // NB: DR 1204. // NB: DR 675. __glibcxx_check_self_move_assign(__x); clear(); swap(__x); return *this; } map& operator=(initializer_list<value_type> __l) { this->clear(); this->insert(__l); return *this; } #endif // _GLIBCXX_RESOLVE_LIB_DEFECTS // 133. map missing get_allocator() using _Base::get_allocator; // iterators: iterator begin() _GLIBCXX_NOEXCEPT { return iterator(_Base::begin(), this); } const_iterator begin() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::begin(), this); } iterator end() _GLIBCXX_NOEXCEPT { return iterator(_Base::end(), this); } const_iterator end() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::end(), this); } reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(end()); } const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(end()); } reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(begin()); } const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(begin()); } #if __cplusplus >= 201103L const_iterator cbegin() const noexcept { return const_iterator(_Base::begin(), this); } const_iterator cend() const noexcept { return const_iterator(_Base::end(), this); } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } #endif // capacity: using _Base::empty; using _Base::size; using _Base::max_size; // 23.3.1.2 element access: using _Base::operator[]; // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 464. Suggestion for new member functions in standard containers. using _Base::at; // modifiers: #if __cplusplus >= 201103L template<typename... _Args> std::pair<iterator, bool> emplace(_Args&&... __args) { auto __res = _Base::emplace(std::forward<_Args>(__args)...); return std::pair<iterator, bool>(iterator(__res.first, this), __res.second); } template<typename... _Args> iterator emplace_hint(const_iterator __pos, _Args&&... __args) { __glibcxx_check_insert(__pos); return iterator(_Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...), this); } #endif std::pair<iterator, bool> insert(const value_type& __x) { std::pair<_Base_iterator, bool> __res = _Base::insert(__x); return std::pair<iterator, bool>(iterator(__res.first, this), __res.second); } #if __cplusplus >= 201103L template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> std::pair<iterator, bool> insert(_Pair&& __x) { std::pair<_Base_iterator, bool> __res = _Base::insert(std::forward<_Pair>(__x)); return std::pair<iterator, bool>(iterator(__res.first, this), __res.second); } #endif #if __cplusplus >= 201103L void insert(std::initializer_list<value_type> __list) { _Base::insert(__list); } #endif iterator #if __cplusplus >= 201103L insert(const_iterator __position, const value_type& __x) #else insert(iterator __position, const value_type& __x) #endif { __glibcxx_check_insert(__position); return iterator(_Base::insert(__position.base(), __x), this); } #if __cplusplus >= 201103L template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> iterator insert(const_iterator __position, _Pair&& __x) { __glibcxx_check_insert(__position); return iterator(_Base::insert(__position.base(), std::forward<_Pair>(__x)), this); } #endif template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) { __glibcxx_check_valid_range(__first, __last); _Base::insert(__gnu_debug::__base(__first), __gnu_debug::__base(__last)); } #if __cplusplus >= 201103L iterator erase(const_iterator __position) { __glibcxx_check_erase(__position); this->_M_invalidate_if(_Equal(__position.base())); return iterator(_Base::erase(__position.base()), this); } iterator erase(iterator __position) { return erase(const_iterator(__position)); } #else void erase(iterator __position) { __glibcxx_check_erase(__position); this->_M_invalidate_if(_Equal(__position.base())); _Base::erase(__position.base()); } #endif size_type erase(const key_type& __x) { _Base_iterator __victim = _Base::find(__x); if (__victim == _Base::end()) return 0; else { this->_M_invalidate_if(_Equal(__victim)); _Base::erase(__victim); return 1; } } #if __cplusplus >= 201103L iterator erase(const_iterator __first, const_iterator __last) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container __glibcxx_check_erase_range(__first, __last); for (_Base_const_iterator __victim = __first.base(); __victim != __last.base(); ++__victim) { _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), _M_message(__gnu_debug::__msg_valid_range) ._M_iterator(__first, "first") ._M_iterator(__last, "last")); this->_M_invalidate_if(_Equal(__victim)); } return iterator(_Base::erase(__first.base(), __last.base()), this); } #else void erase(iterator __first, iterator __last) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container __glibcxx_check_erase_range(__first, __last); for (_Base_iterator __victim = __first.base(); __victim != __last.base(); ++__victim) { _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), _M_message(__gnu_debug::__msg_valid_range) ._M_iterator(__first, "first") ._M_iterator(__last, "last")); this->_M_invalidate_if(_Equal(__victim)); } _Base::erase(__first.base(), __last.base()); } #endif void swap(map& __x) { _Base::swap(__x); this->_M_swap(__x); } void clear() _GLIBCXX_NOEXCEPT { this->_M_invalidate_all(); _Base::clear(); } // observers: using _Base::key_comp; using _Base::value_comp; // 23.3.1.3 map operations: iterator find(const key_type& __x) { return iterator(_Base::find(__x), this); } const_iterator find(const key_type& __x) const { return const_iterator(_Base::find(__x), this); } using _Base::count; iterator lower_bound(const key_type& __x) { return iterator(_Base::lower_bound(__x), this); } const_iterator lower_bound(const key_type& __x) const { return const_iterator(_Base::lower_bound(__x), this); } iterator upper_bound(const key_type& __x) { return iterator(_Base::upper_bound(__x), this); } const_iterator upper_bound(const key_type& __x) const { return const_iterator(_Base::upper_bound(__x), this); } std::pair<iterator,iterator> equal_range(const key_type& __x) { std::pair<_Base_iterator, _Base_iterator> __res = _Base::equal_range(__x); return std::make_pair(iterator(__res.first, this), iterator(__res.second, this)); } std::pair<const_iterator,const_iterator> equal_range(const key_type& __x) const { std::pair<_Base_const_iterator, _Base_const_iterator> __res = _Base::equal_range(__x); return std::make_pair(const_iterator(__res.first, this), const_iterator(__res.second, this)); } _Base& _M_base() _GLIBCXX_NOEXCEPT { return *this; } const _Base& _M_base() const _GLIBCXX_NOEXCEPT { return *this; } private: void _M_invalidate_all() { typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal; this->_M_invalidate_if(_Not_equal(_M_base().end())); } }; template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator==(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, const map<_Key, _Tp, _Compare, _Allocator>& __rhs) { return __lhs._M_base() == __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, const map<_Key, _Tp, _Compare, _Allocator>& __rhs) { return __lhs._M_base() != __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator<(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, const map<_Key, _Tp, _Compare, _Allocator>& __rhs) { return __lhs._M_base() < __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, const map<_Key, _Tp, _Compare, _Allocator>& __rhs) { return __lhs._M_base() <= __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, const map<_Key, _Tp, _Compare, _Allocator>& __rhs) { return __lhs._M_base() >= __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator>(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, const map<_Key, _Tp, _Compare, _Allocator>& __rhs) { return __lhs._M_base() > __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline void swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs, map<_Key, _Tp, _Compare, _Allocator>& __rhs) { __lhs.swap(__rhs); } } // namespace __debug } // namespace std #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/safe_unordered_container.h����������������������������������������������������������0000644�����������������00000006366�14763166030�0014074 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Safe container implementation -*- C++ -*- // Copyright (C) 2011-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/safe_unordered_container.h * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_SAFE_UNORDERED_CONTAINER_H #define _GLIBCXX_DEBUG_SAFE_UNORDERED_CONTAINER_H 1 #include <debug/debug.h> #include <debug/macros.h> #include <debug/functions.h> #include <debug/safe_unordered_base.h> namespace __gnu_debug { /** * @brief Base class for constructing a @a safe unordered container type * that tracks iterators that reference it. * * The class template %_Safe_unordered_container simplifies the * construction of @a safe unordered containers that track the iterators * that reference the container, so that the iterators are notified of * changes in the container that may affect their operation, e.g., if * the container invalidates its iterators or is destructed. This class * template may only be used by deriving from it and passing the name * of the derived class as its template parameter via the curiously * recurring template pattern. The derived class must have @c * iterator and @c const_iterator types that are instantiations of * class template _Safe_iterator for this container and @c local_iterator * and @c const_local_iterator types that are instantiations of class * template _Safe_local_iterator for this container. Iterators will * then be tracked automatically. */ template<typename _Container> class _Safe_unordered_container : public _Safe_unordered_container_base { public: /** Invalidates all iterators @c x that reference this container, are not singular, and for which @c __pred(x) returns @c true. @c __pred will be invoked with the normal iterators nested in the safe ones. */ template<typename _Predicate> void _M_invalidate_if(_Predicate __pred); /** Invalidates all local iterators @c x that reference this container, are not singular, and for which @c __pred(x) returns @c true. @c __pred will be invoked with the normal ilocal iterators nested in the safe ones. */ template<typename _Predicate> void _M_invalidate_local_if(_Predicate __pred); }; } // namespace __gnu_debug #include <debug/safe_unordered_container.tcc> #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/map���������������������������������������������������������������������������������0000644�����������������00000002446�14763166030�0007367 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debugging map/multimap implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/map * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_MAP #define _GLIBCXX_DEBUG_MAP 1 #include <map> #include <debug/map.h> #include <debug/multimap.h> #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/multimap.h��������������������������������������������������������������������������0000644�����������������00000033671�14763166030�0010674 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debugging multimap implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/multimap.h * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_MULTIMAP_H #define _GLIBCXX_DEBUG_MULTIMAP_H 1 #include <debug/safe_sequence.h> #include <debug/safe_iterator.h> #include <utility> namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { /// Class std::multimap with safety/checking/debug instrumentation. template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>, typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > > class multimap : public _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator>, public __gnu_debug::_Safe_sequence<multimap<_Key, _Tp, _Compare, _Allocator> > { typedef _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator> _Base; typedef typename _Base::const_iterator _Base_const_iterator; typedef typename _Base::iterator _Base_iterator; typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; public: // types: typedef _Key key_type; typedef _Tp mapped_type; typedef std::pair<const _Key, _Tp> value_type; typedef _Compare key_compare; typedef _Allocator allocator_type; typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef __gnu_debug::_Safe_iterator<_Base_iterator, multimap> iterator; typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, multimap> const_iterator; typedef typename _Base::size_type size_type; typedef typename _Base::difference_type difference_type; typedef typename _Base::pointer pointer; typedef typename _Base::const_pointer const_pointer; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // 23.3.1.1 construct/copy/destroy: explicit multimap(const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) : _Base(__comp, __a) { } template<typename _InputIterator> multimap(_InputIterator __first, _InputIterator __last, const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, __last)), __gnu_debug::__base(__last), __comp, __a) { } multimap(const multimap& __x) : _Base(__x) { } multimap(const _Base& __x) : _Base(__x) { } #if __cplusplus >= 201103L multimap(multimap&& __x) noexcept(is_nothrow_copy_constructible<_Compare>::value) : _Base(std::move(__x)) { this->_M_swap(__x); } multimap(initializer_list<value_type> __l, const _Compare& __c = _Compare(), const allocator_type& __a = allocator_type()) : _Base(__l, __c, __a) { } #endif ~multimap() _GLIBCXX_NOEXCEPT { } multimap& operator=(const multimap& __x) { *static_cast<_Base*>(this) = __x; this->_M_invalidate_all(); return *this; } #if __cplusplus >= 201103L multimap& operator=(multimap&& __x) { // NB: DR 1204. // NB: DR 675. __glibcxx_check_self_move_assign(__x); clear(); swap(__x); return *this; } multimap& operator=(initializer_list<value_type> __l) { this->clear(); this->insert(__l); return *this; } #endif using _Base::get_allocator; // iterators: iterator begin() _GLIBCXX_NOEXCEPT { return iterator(_Base::begin(), this); } const_iterator begin() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::begin(), this); } iterator end() _GLIBCXX_NOEXCEPT { return iterator(_Base::end(), this); } const_iterator end() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::end(), this); } reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(end()); } const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(end()); } reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(begin()); } const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(begin()); } #if __cplusplus >= 201103L const_iterator cbegin() const noexcept { return const_iterator(_Base::begin(), this); } const_iterator cend() const noexcept { return const_iterator(_Base::end(), this); } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } #endif // capacity: using _Base::empty; using _Base::size; using _Base::max_size; // modifiers: #if __cplusplus >= 201103L template<typename... _Args> iterator emplace(_Args&&... __args) { return iterator(_Base::emplace(std::forward<_Args>(__args)...), this); } template<typename... _Args> iterator emplace_hint(const_iterator __pos, _Args&&... __args) { __glibcxx_check_insert(__pos); return iterator(_Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...), this); } #endif iterator insert(const value_type& __x) { return iterator(_Base::insert(__x), this); } #if __cplusplus >= 201103L template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> iterator insert(_Pair&& __x) { return iterator(_Base::insert(std::forward<_Pair>(__x)), this); } #endif #if __cplusplus >= 201103L void insert(std::initializer_list<value_type> __list) { _Base::insert(__list); } #endif iterator #if __cplusplus >= 201103L insert(const_iterator __position, const value_type& __x) #else insert(iterator __position, const value_type& __x) #endif { __glibcxx_check_insert(__position); return iterator(_Base::insert(__position.base(), __x), this); } #if __cplusplus >= 201103L template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> iterator insert(const_iterator __position, _Pair&& __x) { __glibcxx_check_insert(__position); return iterator(_Base::insert(__position.base(), std::forward<_Pair>(__x)), this); } #endif template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) { __glibcxx_check_valid_range(__first, __last); _Base::insert(__gnu_debug::__base(__first), __gnu_debug::__base(__last)); } #if __cplusplus >= 201103L iterator erase(const_iterator __position) { __glibcxx_check_erase(__position); this->_M_invalidate_if(_Equal(__position.base())); return iterator(_Base::erase(__position.base()), this); } iterator erase(iterator __position) { return erase(const_iterator(__position)); } #else void erase(iterator __position) { __glibcxx_check_erase(__position); this->_M_invalidate_if(_Equal(__position.base())); _Base::erase(__position.base()); } #endif size_type erase(const key_type& __x) { std::pair<_Base_iterator, _Base_iterator> __victims = _Base::equal_range(__x); size_type __count = 0; _Base_iterator __victim = __victims.first; while (__victim != __victims.second) { this->_M_invalidate_if(_Equal(__victim)); _Base::erase(__victim++); ++__count; } return __count; } #if __cplusplus >= 201103L iterator erase(const_iterator __first, const_iterator __last) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container __glibcxx_check_erase_range(__first, __last); for (_Base_const_iterator __victim = __first.base(); __victim != __last.base(); ++__victim) { _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), _M_message(__gnu_debug::__msg_valid_range) ._M_iterator(__first, "first") ._M_iterator(__last, "last")); this->_M_invalidate_if(_Equal(__victim)); } return iterator(_Base::erase(__first.base(), __last.base()), this); } #else void erase(iterator __first, iterator __last) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container __glibcxx_check_erase_range(__first, __last); for (_Base_iterator __victim = __first.base(); __victim != __last.base(); ++__victim) { _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), _M_message(__gnu_debug::__msg_valid_range) ._M_iterator(__first, "first") ._M_iterator(__last, "last")); this->_M_invalidate_if(_Equal(__victim)); } _Base::erase(__first.base(), __last.base()); } #endif void swap(multimap& __x) { _Base::swap(__x); this->_M_swap(__x); } void clear() _GLIBCXX_NOEXCEPT { this->_M_invalidate_all(); _Base::clear(); } // observers: using _Base::key_comp; using _Base::value_comp; // 23.3.1.3 multimap operations: iterator find(const key_type& __x) { return iterator(_Base::find(__x), this); } const_iterator find(const key_type& __x) const { return const_iterator(_Base::find(__x), this); } using _Base::count; iterator lower_bound(const key_type& __x) { return iterator(_Base::lower_bound(__x), this); } const_iterator lower_bound(const key_type& __x) const { return const_iterator(_Base::lower_bound(__x), this); } iterator upper_bound(const key_type& __x) { return iterator(_Base::upper_bound(__x), this); } const_iterator upper_bound(const key_type& __x) const { return const_iterator(_Base::upper_bound(__x), this); } std::pair<iterator,iterator> equal_range(const key_type& __x) { std::pair<_Base_iterator, _Base_iterator> __res = _Base::equal_range(__x); return std::make_pair(iterator(__res.first, this), iterator(__res.second, this)); } std::pair<const_iterator,const_iterator> equal_range(const key_type& __x) const { std::pair<_Base_const_iterator, _Base_const_iterator> __res = _Base::equal_range(__x); return std::make_pair(const_iterator(__res.first, this), const_iterator(__res.second, this)); } _Base& _M_base() _GLIBCXX_NOEXCEPT { return *this; } const _Base& _M_base() const _GLIBCXX_NOEXCEPT { return *this; } private: void _M_invalidate_all() { typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal; this->_M_invalidate_if(_Not_equal(_Base::end())); } }; template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) { return __lhs._M_base() == __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) { return __lhs._M_base() != __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) { return __lhs._M_base() < __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) { return __lhs._M_base() <= __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) { return __lhs._M_base() >= __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline bool operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) { return __lhs._M_base() > __rhs._M_base(); } template<typename _Key, typename _Tp, typename _Compare, typename _Allocator> inline void swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) { __lhs.swap(__rhs); } } // namespace __debug } // namespace std #endif �����������������������������������������������������������������������c++/4.8.2/debug/array�������������������������������������������������������������������������������0000644�����������������00000021265�14763166030�0007730 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debugging array implementation -*- C++ -*- // Copyright (C) 2012-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/array * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_DEBUG_ARRAY #define _GLIBCXX_DEBUG_ARRAY 1 #pragma GCC system_header #include <debug/safe_sequence.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { template<typename _Tp, std::size_t _Nm> struct array { typedef _Tp value_type; typedef value_type* pointer; typedef const value_type* const_pointer; typedef value_type& reference; typedef const value_type& const_reference; typedef value_type* iterator; typedef const value_type* const_iterator; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // Support for zero-sized arrays mandatory. typedef _GLIBCXX_STD_C::__array_traits<_Tp, _Nm> _AT_Type; typename _AT_Type::_Type _M_elems; template<std::size_t _Size> struct _Array_check_subscript { std::size_t size() { return _Size; } _Array_check_subscript(std::size_t __index) { __glibcxx_check_subscript(__index); } }; template<std::size_t _Size> struct _Array_check_nonempty { bool empty() { return _Size == 0; } _Array_check_nonempty() { __glibcxx_check_nonempty(); } }; // No explicit construct/copy/destroy for aggregate type. // DR 776. void fill(const value_type& __u) { std::fill_n(begin(), size(), __u); } void swap(array& __other) noexcept(noexcept(swap(std::declval<_Tp&>(), std::declval<_Tp&>()))) { std::swap_ranges(begin(), end(), __other.begin()); } // Iterators. iterator begin() noexcept { return iterator(data()); } const_iterator begin() const noexcept { return const_iterator(data()); } iterator end() noexcept { return iterator(data() + _Nm); } const_iterator end() const noexcept { return const_iterator(data() + _Nm); } reverse_iterator rbegin() noexcept { return reverse_iterator(end()); } const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } reverse_iterator rend() noexcept { return reverse_iterator(begin()); } const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } const_iterator cbegin() const noexcept { return const_iterator(data()); } const_iterator cend() const noexcept { return const_iterator(data() + _Nm); } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } // Capacity. constexpr size_type size() const noexcept { return _Nm; } constexpr size_type max_size() const noexcept { return _Nm; } constexpr bool empty() const noexcept { return size() == 0; } // Element access. reference operator[](size_type __n) { __glibcxx_check_subscript(__n); return _AT_Type::_S_ref(_M_elems, __n); } constexpr const_reference operator[](size_type __n) const noexcept { return __n < _Nm ? _AT_Type::_S_ref(_M_elems, __n) : (_GLIBCXX_THROW_OR_ABORT(_Array_check_subscript<_Nm>(__n)), _AT_Type::_S_ref(_M_elems, 0)); } reference at(size_type __n) { if (__n >= _Nm) std::__throw_out_of_range(__N("array::at")); return _AT_Type::_S_ref(_M_elems, __n); } constexpr const_reference at(size_type __n) const { // Result of conditional expression must be an lvalue so use // boolean ? lvalue : (throw-expr, lvalue) return __n < _Nm ? _AT_Type::_S_ref(_M_elems, __n) : (std::__throw_out_of_range(__N("array::at")), _AT_Type::_S_ref(_M_elems, 0)); } reference front() { __glibcxx_check_nonempty(); return *begin(); } constexpr const_reference front() const { return _Nm ? _AT_Type::_S_ref(_M_elems, 0) : (_GLIBCXX_THROW_OR_ABORT(_Array_check_nonempty<_Nm>()), _AT_Type::_S_ref(_M_elems, 0)); } reference back() { __glibcxx_check_nonempty(); return _Nm ? *(end() - 1) : *end(); } constexpr const_reference back() const { return _Nm ? _AT_Type::_S_ref(_M_elems, _Nm - 1) : (_GLIBCXX_THROW_OR_ABORT(_Array_check_nonempty<_Nm>()), _AT_Type::_S_ref(_M_elems, 0)); } pointer data() noexcept { return std::__addressof(_AT_Type::_S_ref(_M_elems, 0)); } const_pointer data() const noexcept { return std::__addressof(_AT_Type::_S_ref(_M_elems, 0)); } }; // Array comparisons. template<typename _Tp, std::size_t _Nm> inline bool operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return std::equal(__one.begin(), __one.end(), __two.begin()); } template<typename _Tp, std::size_t _Nm> inline bool operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return !(__one == __two); } template<typename _Tp, std::size_t _Nm> inline bool operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b) { return std::lexicographical_compare(__a.begin(), __a.end(), __b.begin(), __b.end()); } template<typename _Tp, std::size_t _Nm> inline bool operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return __two < __one; } template<typename _Tp, std::size_t _Nm> inline bool operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return !(__one > __two); } template<typename _Tp, std::size_t _Nm> inline bool operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return !(__one < __two); } // Specialized algorithms. template<typename _Tp, std::size_t _Nm> inline void swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two) noexcept(noexcept(__one.swap(__two))) { __one.swap(__two); } template<std::size_t _Int, typename _Tp, std::size_t _Nm> constexpr _Tp& get(array<_Tp, _Nm>& __arr) noexcept { static_assert(_Int < _Nm, "index is out of bounds"); return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>:: _S_ref(__arr._M_elems, _Int); } template<std::size_t _Int, typename _Tp, std::size_t _Nm> constexpr _Tp&& get(array<_Tp, _Nm>&& __arr) noexcept { static_assert(_Int < _Nm, "index is out of bounds"); return std::move(get<_Int>(__arr)); } template<std::size_t _Int, typename _Tp, std::size_t _Nm> constexpr const _Tp& get(const array<_Tp, _Nm>& __arr) noexcept { static_assert(_Int < _Nm, "index is out of bounds"); return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>:: _S_ref(__arr._M_elems, _Int); } } // namespace __debug // Tuple interface to class template array. /// tuple_size template<typename _Tp, std::size_t _Nm> struct tuple_size<__debug::array<_Tp, _Nm>> : public integral_constant<std::size_t, _Nm> { }; /// tuple_element template<std::size_t _Int, typename _Tp, std::size_t _Nm> struct tuple_element<_Int, __debug::array<_Tp, _Nm>> { static_assert(_Int < _Nm, "index is out of bounds"); typedef _Tp type; }; } // namespace std #endif // _GLIBCXX_DEBUG_ARRAY �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/debug/list��������������������������������������������������������������������������������0000644�����������������00000046234�14763166030�0007570 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Debugging list implementation -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file debug/list * This file is a GNU debug extension to the Standard C++ Library. */ #ifndef _GLIBCXX_DEBUG_LIST #define _GLIBCXX_DEBUG_LIST 1 #include <list> #include <debug/safe_sequence.h> #include <debug/safe_iterator.h> namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { /// Class std::list with safety/checking/debug instrumentation. template<typename _Tp, typename _Allocator = std::allocator<_Tp> > class list : public _GLIBCXX_STD_C::list<_Tp, _Allocator>, public __gnu_debug::_Safe_sequence<list<_Tp, _Allocator> > { typedef _GLIBCXX_STD_C::list<_Tp, _Allocator> _Base; typedef typename _Base::iterator _Base_iterator; typedef typename _Base::const_iterator _Base_const_iterator; typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal; public: typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; typedef __gnu_debug::_Safe_iterator<_Base_iterator, list> iterator; typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, list> const_iterator; typedef typename _Base::size_type size_type; typedef typename _Base::difference_type difference_type; typedef _Tp value_type; typedef _Allocator allocator_type; typedef typename _Base::pointer pointer; typedef typename _Base::const_pointer const_pointer; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // 23.2.2.1 construct/copy/destroy: explicit list(const _Allocator& __a = _Allocator()) : _Base(__a) { } #if __cplusplus >= 201103L explicit list(size_type __n) : _Base(__n) { } list(size_type __n, const _Tp& __value, const _Allocator& __a = _Allocator()) : _Base(__n, __value, __a) { } #else explicit list(size_type __n, const _Tp& __value = _Tp(), const _Allocator& __a = _Allocator()) : _Base(__n, __value, __a) { } #endif #if __cplusplus >= 201103L template<class _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<class _InputIterator> #endif list(_InputIterator __first, _InputIterator __last, const _Allocator& __a = _Allocator()) : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, __last)), __gnu_debug::__base(__last), __a) { } list(const list& __x) : _Base(__x) { } list(const _Base& __x) : _Base(__x) { } #if __cplusplus >= 201103L list(list&& __x) noexcept : _Base(std::move(__x)) { this->_M_swap(__x); } list(initializer_list<value_type> __l, const allocator_type& __a = allocator_type()) : _Base(__l, __a) { } #endif ~list() _GLIBCXX_NOEXCEPT { } list& operator=(const list& __x) { static_cast<_Base&>(*this) = __x; this->_M_invalidate_all(); return *this; } #if __cplusplus >= 201103L list& operator=(list&& __x) { // NB: DR 1204. // NB: DR 675. __glibcxx_check_self_move_assign(__x); clear(); swap(__x); return *this; } list& operator=(initializer_list<value_type> __l) { static_cast<_Base&>(*this) = __l; this->_M_invalidate_all(); return *this; } void assign(initializer_list<value_type> __l) { _Base::assign(__l); this->_M_invalidate_all(); } #endif #if __cplusplus >= 201103L template<class _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<class _InputIterator> #endif void assign(_InputIterator __first, _InputIterator __last) { __glibcxx_check_valid_range(__first, __last); _Base::assign(__gnu_debug::__base(__first), __gnu_debug::__base(__last)); this->_M_invalidate_all(); } void assign(size_type __n, const _Tp& __t) { _Base::assign(__n, __t); this->_M_invalidate_all(); } using _Base::get_allocator; // iterators: iterator begin() _GLIBCXX_NOEXCEPT { return iterator(_Base::begin(), this); } const_iterator begin() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::begin(), this); } iterator end() _GLIBCXX_NOEXCEPT { return iterator(_Base::end(), this); } const_iterator end() const _GLIBCXX_NOEXCEPT { return const_iterator(_Base::end(), this); } reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(end()); } const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(end()); } reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(begin()); } const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(begin()); } #if __cplusplus >= 201103L const_iterator cbegin() const noexcept { return const_iterator(_Base::begin(), this); } const_iterator cend() const noexcept { return const_iterator(_Base::end(), this); } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } #endif // 23.2.2.2 capacity: using _Base::empty; using _Base::size; using _Base::max_size; #if __cplusplus >= 201103L void resize(size_type __sz) { this->_M_detach_singular(); // if __sz < size(), invalidate all iterators in [begin+__sz, end()) _Base_iterator __victim = _Base::begin(); _Base_iterator __end = _Base::end(); for (size_type __i = __sz; __victim != __end && __i > 0; --__i) ++__victim; for (; __victim != __end; ++__victim) { this->_M_invalidate_if(_Equal(__victim)); } __try { _Base::resize(__sz); } __catch(...) { this->_M_revalidate_singular(); __throw_exception_again; } } void resize(size_type __sz, const _Tp& __c) { this->_M_detach_singular(); // if __sz < size(), invalidate all iterators in [begin+__sz, end()) _Base_iterator __victim = _Base::begin(); _Base_iterator __end = _Base::end(); for (size_type __i = __sz; __victim != __end && __i > 0; --__i) ++__victim; for (; __victim != __end; ++__victim) { this->_M_invalidate_if(_Equal(__victim)); } __try { _Base::resize(__sz, __c); } __catch(...) { this->_M_revalidate_singular(); __throw_exception_again; } } #else void resize(size_type __sz, _Tp __c = _Tp()) { this->_M_detach_singular(); // if __sz < size(), invalidate all iterators in [begin+__sz, end()) _Base_iterator __victim = _Base::begin(); _Base_iterator __end = _Base::end(); for (size_type __i = __sz; __victim != __end && __i > 0; --__i) ++__victim; for (; __victim != __end; ++__victim) { this->_M_invalidate_if(_Equal(__victim)); } __try { _Base::resize(__sz, __c); } __catch(...) { this->_M_revalidate_singular(); __throw_exception_again; } } #endif // element access: reference front() { __glibcxx_check_nonempty(); return _Base::front(); } const_reference front() const { __glibcxx_check_nonempty(); return _Base::front(); } reference back() { __glibcxx_check_nonempty(); return _Base::back(); } const_reference back() const { __glibcxx_check_nonempty(); return _Base::back(); } // 23.2.2.3 modifiers: using _Base::push_front; #if __cplusplus >= 201103L using _Base::emplace_front; #endif void pop_front() { __glibcxx_check_nonempty(); this->_M_invalidate_if(_Equal(_Base::begin())); _Base::pop_front(); } using _Base::push_back; #if __cplusplus >= 201103L using _Base::emplace_back; #endif void pop_back() { __glibcxx_check_nonempty(); this->_M_invalidate_if(_Equal(--_Base::end())); _Base::pop_back(); } #if __cplusplus >= 201103L template<typename... _Args> iterator emplace(iterator __position, _Args&&... __args) { __glibcxx_check_insert(__position); return iterator(_Base::emplace(__position.base(), std::forward<_Args>(__args)...), this); } #endif iterator insert(iterator __position, const _Tp& __x) { __glibcxx_check_insert(__position); return iterator(_Base::insert(__position.base(), __x), this); } #if __cplusplus >= 201103L iterator insert(iterator __position, _Tp&& __x) { return emplace(__position, std::move(__x)); } void insert(iterator __p, initializer_list<value_type> __l) { __glibcxx_check_insert(__p); _Base::insert(__p.base(), __l); } #endif void insert(iterator __position, size_type __n, const _Tp& __x) { __glibcxx_check_insert(__position); _Base::insert(__position.base(), __n, __x); } #if __cplusplus >= 201103L template<class _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<class _InputIterator> #endif void insert(iterator __position, _InputIterator __first, _InputIterator __last) { __glibcxx_check_insert_range(__position, __first, __last); _Base::insert(__position.base(), __gnu_debug::__base(__first), __gnu_debug::__base(__last)); } private: _Base_iterator _M_erase(_Base_iterator __position) { this->_M_invalidate_if(_Equal(__position)); return _Base::erase(__position); } public: iterator erase(iterator __position) { __glibcxx_check_erase(__position); return iterator(_M_erase(__position.base()), this); } iterator erase(iterator __position, iterator __last) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container __glibcxx_check_erase_range(__position, __last); for (_Base_iterator __victim = __position.base(); __victim != __last.base(); ++__victim) { _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), _M_message(__gnu_debug::__msg_valid_range) ._M_iterator(__position, "position") ._M_iterator(__last, "last")); this->_M_invalidate_if(_Equal(__victim)); } return iterator(_Base::erase(__position.base(), __last.base()), this); } void swap(list& __x) { _Base::swap(__x); this->_M_swap(__x); } void clear() _GLIBCXX_NOEXCEPT { _Base::clear(); this->_M_invalidate_all(); } // 23.2.2.4 list operations: void #if __cplusplus >= 201103L splice(iterator __position, list&& __x) #else splice(iterator __position, list& __x) #endif { _GLIBCXX_DEBUG_VERIFY(&__x != this, _M_message(__gnu_debug::__msg_self_splice) ._M_sequence(*this, "this")); this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end())); _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base())); } #if __cplusplus >= 201103L void splice(iterator __position, list& __x) { splice(__position, std::move(__x)); } #endif void #if __cplusplus >= 201103L splice(iterator __position, list&& __x, iterator __i) #else splice(iterator __position, list& __x, iterator __i) #endif { __glibcxx_check_insert(__position); // We used to perform the splice_alloc check: not anymore, redundant // after implementing the relevant bits of N1599. _GLIBCXX_DEBUG_VERIFY(__i._M_dereferenceable(), _M_message(__gnu_debug::__msg_splice_bad) ._M_iterator(__i, "__i")); _GLIBCXX_DEBUG_VERIFY(__i._M_attached_to(&__x), _M_message(__gnu_debug::__msg_splice_other) ._M_iterator(__i, "__i")._M_sequence(__x, "__x")); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 250. splicing invalidates iterators this->_M_transfer_from_if(__x, _Equal(__i.base())); _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()), __i.base()); } #if __cplusplus >= 201103L void splice(iterator __position, list& __x, iterator __i) { splice(__position, std::move(__x), __i); } #endif void #if __cplusplus >= 201103L splice(iterator __position, list&& __x, iterator __first, iterator __last) #else splice(iterator __position, list& __x, iterator __first, iterator __last) #endif { __glibcxx_check_insert(__position); __glibcxx_check_valid_range(__first, __last); _GLIBCXX_DEBUG_VERIFY(__first._M_attached_to(&__x), _M_message(__gnu_debug::__msg_splice_other) ._M_sequence(__x, "x") ._M_iterator(__first, "first")); // We used to perform the splice_alloc check: not anymore, redundant // after implementing the relevant bits of N1599. for (_Base_iterator __tmp = __first.base(); __tmp != __last.base(); ++__tmp) { _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::end(), _M_message(__gnu_debug::__msg_valid_range) ._M_iterator(__first, "first") ._M_iterator(__last, "last")); _GLIBCXX_DEBUG_VERIFY(&__x != this || __tmp != __position, _M_message(__gnu_debug::__msg_splice_overlap) ._M_iterator(__tmp, "position") ._M_iterator(__first, "first") ._M_iterator(__last, "last")); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 250. splicing invalidates iterators this->_M_transfer_from_if(__x, _Equal(__tmp)); } _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()), __first.base(), __last.base()); } #if __cplusplus >= 201103L void splice(iterator __position, list& __x, iterator __first, iterator __last) { splice(__position, std::move(__x), __first, __last); } #endif void remove(const _Tp& __value) { for (_Base_iterator __x = _Base::begin(); __x != _Base::end(); ) { if (*__x == __value) __x = _M_erase(__x); else ++__x; } } template<class _Predicate> void remove_if(_Predicate __pred) { for (_Base_iterator __x = _Base::begin(); __x != _Base::end(); ) { if (__pred(*__x)) __x = _M_erase(__x); else ++__x; } } void unique() { _Base_iterator __first = _Base::begin(); _Base_iterator __last = _Base::end(); if (__first == __last) return; _Base_iterator __next = __first; ++__next; while (__next != __last) { if (*__first == *__next) __next = _M_erase(__next); else __first = __next++; } } template<class _BinaryPredicate> void unique(_BinaryPredicate __binary_pred) { _Base_iterator __first = _Base::begin(); _Base_iterator __last = _Base::end(); if (__first == __last) return; _Base_iterator __next = __first; ++__next; while (__next != __last) { if (__binary_pred(*__first, *__next)) __next = _M_erase(__next); else __first = __next++; } } void #if __cplusplus >= 201103L merge(list&& __x) #else merge(list& __x) #endif { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 300. list::merge() specification incomplete if (this != &__x) { __glibcxx_check_sorted(_Base::begin(), _Base::end()); __glibcxx_check_sorted(__x.begin().base(), __x.end().base()); this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end())); _Base::merge(_GLIBCXX_MOVE(__x._M_base())); } } #if __cplusplus >= 201103L void merge(list& __x) { merge(std::move(__x)); } #endif template<class _Compare> void #if __cplusplus >= 201103L merge(list&& __x, _Compare __comp) #else merge(list& __x, _Compare __comp) #endif { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 300. list::merge() specification incomplete if (this != &__x) { __glibcxx_check_sorted_pred(_Base::begin(), _Base::end(), __comp); __glibcxx_check_sorted_pred(__x.begin().base(), __x.end().base(), __comp); this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end())); _Base::merge(_GLIBCXX_MOVE(__x._M_base()), __comp); } } #if __cplusplus >= 201103L template<typename _Compare> void merge(list& __x, _Compare __comp) { merge(std::move(__x), __comp); } #endif void sort() { _Base::sort(); } template<typename _StrictWeakOrdering> void sort(_StrictWeakOrdering __pred) { _Base::sort(__pred); } using _Base::reverse; _Base& _M_base() _GLIBCXX_NOEXCEPT { return *this; } const _Base& _M_base() const _GLIBCXX_NOEXCEPT { return *this; } private: void _M_invalidate_all() { this->_M_invalidate_if(_Not_equal(_Base::end())); } }; template<typename _Tp, typename _Alloc> inline bool operator==(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs) { return __lhs._M_base() == __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator!=(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs) { return __lhs._M_base() != __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator<(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs) { return __lhs._M_base() < __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator<=(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs) { return __lhs._M_base() <= __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator>=(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs) { return __lhs._M_base() >= __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline bool operator>(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs) { return __lhs._M_base() > __rhs._M_base(); } template<typename _Tp, typename _Alloc> inline void swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs) { __lhs.swap(__rhs); } } // namespace __debug } // namespace std #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/fenv.h������������������������������������������������������������������������������������0000644�����������������00000003744�14763166030�0006712 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- compatibility header. // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file fenv.h * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_FENV_H #define _GLIBCXX_FENV_H 1 #pragma GCC system_header #include <bits/c++config.h> #if _GLIBCXX_HAVE_FENV_H # include_next <fenv.h> #endif #if __cplusplus >= 201103L #if _GLIBCXX_USE_C99_FENV_TR1 #undef feclearexcept #undef fegetexceptflag #undef feraiseexcept #undef fesetexceptflag #undef fetestexcept #undef fegetround #undef fesetround #undef fegetenv #undef feholdexcept #undef fesetenv #undef feupdateenv namespace std { // types using ::fenv_t; using ::fexcept_t; // functions using ::feclearexcept; using ::fegetexceptflag; using ::feraiseexcept; using ::fesetexceptflag; using ::fetestexcept; using ::fegetround; using ::fesetround; using ::fegetenv; using ::feholdexcept; using ::fesetenv; using ::feupdateenv; } // namespace #endif // _GLIBCXX_USE_C99_FENV_TR1 #endif // C++11 #endif // _GLIBCXX_FENV_H ����������������������������c++/4.8.2/unordered_set�����������������������������������������������������������������������������0000644�����������������00000003500�14763166030�0010356 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <unordered_set> -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/unordered_set * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_UNORDERED_SET #define _GLIBCXX_UNORDERED_SET 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <utility> #include <type_traits> #include <initializer_list> #include <tuple> #include <bits/stl_algobase.h> #include <bits/allocator.h> #include <bits/alloc_traits.h> #include <bits/stl_function.h> // equal_to, _Identity, _Select1st #include <bits/functional_hash.h> #include <bits/hashtable.h> #include <bits/unordered_set.h> #include <bits/range_access.h> #ifdef _GLIBCXX_DEBUG # include <debug/unordered_set> #endif #ifdef _GLIBCXX_PROFILE # include <profile/unordered_set> #endif #endif // C++11 #endif // _GLIBCXX_UNORDERED_SET ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/cstdbool����������������������������������������������������������������������������������0000644�����������������00000002571�14763166030�0007334 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <cstdbool> -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/cstdbool * This is a Standard C++ Library header. */ #pragma GCC system_header #ifndef _GLIBCXX_CSTDBOOL #define _GLIBCXX_CSTDBOOL 1 #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else # include <bits/c++config.h> # if _GLIBCXX_HAVE_STDBOOL_H # include <stdbool.h> # endif #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bitset������������������������������������������������������������������������������������0000644�����������������00000131060�14763166030�0007011 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <bitset> -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * Copyright (c) 1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file include/bitset * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_BITSET #define _GLIBCXX_BITSET 1 #pragma GCC system_header #include <string> #include <bits/functexcept.h> // For invalid_argument, out_of_range, // overflow_error #include <iosfwd> #include <bits/cxxabi_forced.h> #define _GLIBCXX_BITSET_BITS_PER_WORD (__CHAR_BIT__ * __SIZEOF_LONG__) #define _GLIBCXX_BITSET_WORDS(__n) \ ((__n) / _GLIBCXX_BITSET_BITS_PER_WORD + \ ((__n) % _GLIBCXX_BITSET_BITS_PER_WORD == 0 ? 0 : 1)) #define _GLIBCXX_BITSET_BITS_PER_ULL (__CHAR_BIT__ * __SIZEOF_LONG_LONG__) namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /** * Base class, general case. It is a class invariant that _Nw will be * nonnegative. * * See documentation for bitset. */ template<size_t _Nw> struct _Base_bitset { typedef unsigned long _WordT; /// 0 is the least significant word. _WordT _M_w[_Nw]; _GLIBCXX_CONSTEXPR _Base_bitset() _GLIBCXX_NOEXCEPT : _M_w() { } #if __cplusplus >= 201103L constexpr _Base_bitset(unsigned long long __val) noexcept : _M_w{ _WordT(__val) #if __SIZEOF_LONG_LONG__ > __SIZEOF_LONG__ , _WordT(__val >> _GLIBCXX_BITSET_BITS_PER_WORD) #endif } { } #else _Base_bitset(unsigned long __val) : _M_w() { _M_w[0] = __val; } #endif static _GLIBCXX_CONSTEXPR size_t _S_whichword(size_t __pos) _GLIBCXX_NOEXCEPT { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } static _GLIBCXX_CONSTEXPR size_t _S_whichbyte(size_t __pos) _GLIBCXX_NOEXCEPT { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; } static _GLIBCXX_CONSTEXPR size_t _S_whichbit(size_t __pos) _GLIBCXX_NOEXCEPT { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } static _GLIBCXX_CONSTEXPR _WordT _S_maskbit(size_t __pos) _GLIBCXX_NOEXCEPT { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } _WordT& _M_getword(size_t __pos) _GLIBCXX_NOEXCEPT { return _M_w[_S_whichword(__pos)]; } _GLIBCXX_CONSTEXPR _WordT _M_getword(size_t __pos) const _GLIBCXX_NOEXCEPT { return _M_w[_S_whichword(__pos)]; } #if __cplusplus >= 201103L const _WordT* _M_getdata() const noexcept { return _M_w; } #endif _WordT& _M_hiword() _GLIBCXX_NOEXCEPT { return _M_w[_Nw - 1]; } _GLIBCXX_CONSTEXPR _WordT _M_hiword() const _GLIBCXX_NOEXCEPT { return _M_w[_Nw - 1]; } void _M_do_and(const _Base_bitset<_Nw>& __x) _GLIBCXX_NOEXCEPT { for (size_t __i = 0; __i < _Nw; __i++) _M_w[__i] &= __x._M_w[__i]; } void _M_do_or(const _Base_bitset<_Nw>& __x) _GLIBCXX_NOEXCEPT { for (size_t __i = 0; __i < _Nw; __i++) _M_w[__i] |= __x._M_w[__i]; } void _M_do_xor(const _Base_bitset<_Nw>& __x) _GLIBCXX_NOEXCEPT { for (size_t __i = 0; __i < _Nw; __i++) _M_w[__i] ^= __x._M_w[__i]; } void _M_do_left_shift(size_t __shift) _GLIBCXX_NOEXCEPT; void _M_do_right_shift(size_t __shift) _GLIBCXX_NOEXCEPT; void _M_do_flip() _GLIBCXX_NOEXCEPT { for (size_t __i = 0; __i < _Nw; __i++) _M_w[__i] = ~_M_w[__i]; } void _M_do_set() _GLIBCXX_NOEXCEPT { for (size_t __i = 0; __i < _Nw; __i++) _M_w[__i] = ~static_cast<_WordT>(0); } void _M_do_reset() _GLIBCXX_NOEXCEPT { __builtin_memset(_M_w, 0, _Nw * sizeof(_WordT)); } bool _M_is_equal(const _Base_bitset<_Nw>& __x) const _GLIBCXX_NOEXCEPT { for (size_t __i = 0; __i < _Nw; ++__i) if (_M_w[__i] != __x._M_w[__i]) return false; return true; } template<size_t _Nb> bool _M_are_all() const _GLIBCXX_NOEXCEPT { for (size_t __i = 0; __i < _Nw - 1; __i++) if (_M_w[__i] != ~static_cast<_WordT>(0)) return false; return _M_hiword() == (~static_cast<_WordT>(0) >> (_Nw * _GLIBCXX_BITSET_BITS_PER_WORD - _Nb)); } bool _M_is_any() const _GLIBCXX_NOEXCEPT { for (size_t __i = 0; __i < _Nw; __i++) if (_M_w[__i] != static_cast<_WordT>(0)) return true; return false; } size_t _M_do_count() const _GLIBCXX_NOEXCEPT { size_t __result = 0; for (size_t __i = 0; __i < _Nw; __i++) __result += __builtin_popcountl(_M_w[__i]); return __result; } unsigned long _M_do_to_ulong() const; #if __cplusplus >= 201103L unsigned long long _M_do_to_ullong() const; #endif // find first "on" bit size_t _M_do_find_first(size_t) const _GLIBCXX_NOEXCEPT; // find the next "on" bit that follows "prev" size_t _M_do_find_next(size_t, size_t) const _GLIBCXX_NOEXCEPT; }; // Definitions of non-inline functions from _Base_bitset. template<size_t _Nw> void _Base_bitset<_Nw>::_M_do_left_shift(size_t __shift) _GLIBCXX_NOEXCEPT { if (__builtin_expect(__shift != 0, 1)) { const size_t __wshift = __shift / _GLIBCXX_BITSET_BITS_PER_WORD; const size_t __offset = __shift % _GLIBCXX_BITSET_BITS_PER_WORD; if (__offset == 0) for (size_t __n = _Nw - 1; __n >= __wshift; --__n) _M_w[__n] = _M_w[__n - __wshift]; else { const size_t __sub_offset = (_GLIBCXX_BITSET_BITS_PER_WORD - __offset); for (size_t __n = _Nw - 1; __n > __wshift; --__n) _M_w[__n] = ((_M_w[__n - __wshift] << __offset) | (_M_w[__n - __wshift - 1] >> __sub_offset)); _M_w[__wshift] = _M_w[0] << __offset; } std::fill(_M_w + 0, _M_w + __wshift, static_cast<_WordT>(0)); } } template<size_t _Nw> void _Base_bitset<_Nw>::_M_do_right_shift(size_t __shift) _GLIBCXX_NOEXCEPT { if (__builtin_expect(__shift != 0, 1)) { const size_t __wshift = __shift / _GLIBCXX_BITSET_BITS_PER_WORD; const size_t __offset = __shift % _GLIBCXX_BITSET_BITS_PER_WORD; const size_t __limit = _Nw - __wshift - 1; if (__offset == 0) for (size_t __n = 0; __n <= __limit; ++__n) _M_w[__n] = _M_w[__n + __wshift]; else { const size_t __sub_offset = (_GLIBCXX_BITSET_BITS_PER_WORD - __offset); for (size_t __n = 0; __n < __limit; ++__n) _M_w[__n] = ((_M_w[__n + __wshift] >> __offset) | (_M_w[__n + __wshift + 1] << __sub_offset)); _M_w[__limit] = _M_w[_Nw-1] >> __offset; } std::fill(_M_w + __limit + 1, _M_w + _Nw, static_cast<_WordT>(0)); } } template<size_t _Nw> unsigned long _Base_bitset<_Nw>::_M_do_to_ulong() const { for (size_t __i = 1; __i < _Nw; ++__i) if (_M_w[__i]) __throw_overflow_error(__N("_Base_bitset::_M_do_to_ulong")); return _M_w[0]; } #if __cplusplus >= 201103L template<size_t _Nw> unsigned long long _Base_bitset<_Nw>::_M_do_to_ullong() const { const bool __dw = sizeof(unsigned long long) > sizeof(unsigned long); for (size_t __i = 1 + __dw; __i < _Nw; ++__i) if (_M_w[__i]) __throw_overflow_error(__N("_Base_bitset::_M_do_to_ullong")); if (__dw) return _M_w[0] + (static_cast<unsigned long long>(_M_w[1]) << _GLIBCXX_BITSET_BITS_PER_WORD); return _M_w[0]; } #endif template<size_t _Nw> size_t _Base_bitset<_Nw>:: _M_do_find_first(size_t __not_found) const _GLIBCXX_NOEXCEPT { for (size_t __i = 0; __i < _Nw; __i++) { _WordT __thisword = _M_w[__i]; if (__thisword != static_cast<_WordT>(0)) return (__i * _GLIBCXX_BITSET_BITS_PER_WORD + __builtin_ctzl(__thisword)); } // not found, so return an indication of failure. return __not_found; } template<size_t _Nw> size_t _Base_bitset<_Nw>:: _M_do_find_next(size_t __prev, size_t __not_found) const _GLIBCXX_NOEXCEPT { // make bound inclusive ++__prev; // check out of bounds if (__prev >= _Nw * _GLIBCXX_BITSET_BITS_PER_WORD) return __not_found; // search first word size_t __i = _S_whichword(__prev); _WordT __thisword = _M_w[__i]; // mask off bits below bound __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev); if (__thisword != static_cast<_WordT>(0)) return (__i * _GLIBCXX_BITSET_BITS_PER_WORD + __builtin_ctzl(__thisword)); // check subsequent words __i++; for (; __i < _Nw; __i++) { __thisword = _M_w[__i]; if (__thisword != static_cast<_WordT>(0)) return (__i * _GLIBCXX_BITSET_BITS_PER_WORD + __builtin_ctzl(__thisword)); } // not found, so return an indication of failure. return __not_found; } // end _M_do_find_next /** * Base class, specialization for a single word. * * See documentation for bitset. */ template<> struct _Base_bitset<1> { typedef unsigned long _WordT; _WordT _M_w; _GLIBCXX_CONSTEXPR _Base_bitset() _GLIBCXX_NOEXCEPT : _M_w(0) { } #if __cplusplus >= 201103L constexpr _Base_bitset(unsigned long long __val) noexcept #else _Base_bitset(unsigned long __val) #endif : _M_w(__val) { } static _GLIBCXX_CONSTEXPR size_t _S_whichword(size_t __pos) _GLIBCXX_NOEXCEPT { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } static _GLIBCXX_CONSTEXPR size_t _S_whichbyte(size_t __pos) _GLIBCXX_NOEXCEPT { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; } static _GLIBCXX_CONSTEXPR size_t _S_whichbit(size_t __pos) _GLIBCXX_NOEXCEPT { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } static _GLIBCXX_CONSTEXPR _WordT _S_maskbit(size_t __pos) _GLIBCXX_NOEXCEPT { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } _WordT& _M_getword(size_t) _GLIBCXX_NOEXCEPT { return _M_w; } _GLIBCXX_CONSTEXPR _WordT _M_getword(size_t) const _GLIBCXX_NOEXCEPT { return _M_w; } #if __cplusplus >= 201103L const _WordT* _M_getdata() const noexcept { return &_M_w; } #endif _WordT& _M_hiword() _GLIBCXX_NOEXCEPT { return _M_w; } _GLIBCXX_CONSTEXPR _WordT _M_hiword() const _GLIBCXX_NOEXCEPT { return _M_w; } void _M_do_and(const _Base_bitset<1>& __x) _GLIBCXX_NOEXCEPT { _M_w &= __x._M_w; } void _M_do_or(const _Base_bitset<1>& __x) _GLIBCXX_NOEXCEPT { _M_w |= __x._M_w; } void _M_do_xor(const _Base_bitset<1>& __x) _GLIBCXX_NOEXCEPT { _M_w ^= __x._M_w; } void _M_do_left_shift(size_t __shift) _GLIBCXX_NOEXCEPT { _M_w <<= __shift; } void _M_do_right_shift(size_t __shift) _GLIBCXX_NOEXCEPT { _M_w >>= __shift; } void _M_do_flip() _GLIBCXX_NOEXCEPT { _M_w = ~_M_w; } void _M_do_set() _GLIBCXX_NOEXCEPT { _M_w = ~static_cast<_WordT>(0); } void _M_do_reset() _GLIBCXX_NOEXCEPT { _M_w = 0; } bool _M_is_equal(const _Base_bitset<1>& __x) const _GLIBCXX_NOEXCEPT { return _M_w == __x._M_w; } template<size_t _Nb> bool _M_are_all() const _GLIBCXX_NOEXCEPT { return _M_w == (~static_cast<_WordT>(0) >> (_GLIBCXX_BITSET_BITS_PER_WORD - _Nb)); } bool _M_is_any() const _GLIBCXX_NOEXCEPT { return _M_w != 0; } size_t _M_do_count() const _GLIBCXX_NOEXCEPT { return __builtin_popcountl(_M_w); } unsigned long _M_do_to_ulong() const _GLIBCXX_NOEXCEPT { return _M_w; } #if __cplusplus >= 201103L unsigned long long _M_do_to_ullong() const noexcept { return _M_w; } #endif size_t _M_do_find_first(size_t __not_found) const _GLIBCXX_NOEXCEPT { if (_M_w != 0) return __builtin_ctzl(_M_w); else return __not_found; } // find the next "on" bit that follows "prev" size_t _M_do_find_next(size_t __prev, size_t __not_found) const _GLIBCXX_NOEXCEPT { ++__prev; if (__prev >= ((size_t) _GLIBCXX_BITSET_BITS_PER_WORD)) return __not_found; _WordT __x = _M_w >> __prev; if (__x != 0) return __builtin_ctzl(__x) + __prev; else return __not_found; } }; /** * Base class, specialization for no storage (zero-length %bitset). * * See documentation for bitset. */ template<> struct _Base_bitset<0> { typedef unsigned long _WordT; _GLIBCXX_CONSTEXPR _Base_bitset() _GLIBCXX_NOEXCEPT { } #if __cplusplus >= 201103L constexpr _Base_bitset(unsigned long long) noexcept #else _Base_bitset(unsigned long) #endif { } static _GLIBCXX_CONSTEXPR size_t _S_whichword(size_t __pos) _GLIBCXX_NOEXCEPT { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } static _GLIBCXX_CONSTEXPR size_t _S_whichbyte(size_t __pos) _GLIBCXX_NOEXCEPT { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; } static _GLIBCXX_CONSTEXPR size_t _S_whichbit(size_t __pos) _GLIBCXX_NOEXCEPT { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } static _GLIBCXX_CONSTEXPR _WordT _S_maskbit(size_t __pos) _GLIBCXX_NOEXCEPT { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } // This would normally give access to the data. The bounds-checking // in the bitset class will prevent the user from getting this far, // but (1) it must still return an lvalue to compile, and (2) the // user might call _Unchecked_set directly, in which case this /needs/ // to fail. Let's not penalize zero-length users unless they actually // make an unchecked call; all the memory ugliness is therefore // localized to this single should-never-get-this-far function. _WordT& _M_getword(size_t) _GLIBCXX_NOEXCEPT { __throw_out_of_range(__N("_Base_bitset::_M_getword")); return *new _WordT; } _GLIBCXX_CONSTEXPR _WordT _M_getword(size_t __pos) const _GLIBCXX_NOEXCEPT { return 0; } _GLIBCXX_CONSTEXPR _WordT _M_hiword() const _GLIBCXX_NOEXCEPT { return 0; } void _M_do_and(const _Base_bitset<0>&) _GLIBCXX_NOEXCEPT { } void _M_do_or(const _Base_bitset<0>&) _GLIBCXX_NOEXCEPT { } void _M_do_xor(const _Base_bitset<0>&) _GLIBCXX_NOEXCEPT { } void _M_do_left_shift(size_t) _GLIBCXX_NOEXCEPT { } void _M_do_right_shift(size_t) _GLIBCXX_NOEXCEPT { } void _M_do_flip() _GLIBCXX_NOEXCEPT { } void _M_do_set() _GLIBCXX_NOEXCEPT { } void _M_do_reset() _GLIBCXX_NOEXCEPT { } // Are all empty bitsets equal to each other? Are they equal to // themselves? How to compare a thing which has no state? What is // the sound of one zero-length bitset clapping? bool _M_is_equal(const _Base_bitset<0>&) const _GLIBCXX_NOEXCEPT { return true; } template<size_t _Nb> bool _M_are_all() const _GLIBCXX_NOEXCEPT { return true; } bool _M_is_any() const _GLIBCXX_NOEXCEPT { return false; } size_t _M_do_count() const _GLIBCXX_NOEXCEPT { return 0; } unsigned long _M_do_to_ulong() const _GLIBCXX_NOEXCEPT { return 0; } #if __cplusplus >= 201103L unsigned long long _M_do_to_ullong() const noexcept { return 0; } #endif // Normally "not found" is the size, but that could also be // misinterpreted as an index in this corner case. Oh well. size_t _M_do_find_first(size_t) const _GLIBCXX_NOEXCEPT { return 0; } size_t _M_do_find_next(size_t, size_t) const _GLIBCXX_NOEXCEPT { return 0; } }; // Helper class to zero out the unused high-order bits in the highest word. template<size_t _Extrabits> struct _Sanitize { typedef unsigned long _WordT; static void _S_do_sanitize(_WordT& __val) _GLIBCXX_NOEXCEPT { __val &= ~((~static_cast<_WordT>(0)) << _Extrabits); } }; template<> struct _Sanitize<0> { typedef unsigned long _WordT; static void _S_do_sanitize(_WordT) _GLIBCXX_NOEXCEPT { } }; #if __cplusplus >= 201103L template<size_t _Nb, bool = _Nb < _GLIBCXX_BITSET_BITS_PER_ULL> struct _Sanitize_val { static constexpr unsigned long long _S_do_sanitize_val(unsigned long long __val) { return __val; } }; template<size_t _Nb> struct _Sanitize_val<_Nb, true> { static constexpr unsigned long long _S_do_sanitize_val(unsigned long long __val) { return __val & ~((~static_cast<unsigned long long>(0)) << _Nb); } }; #endif /** * The %bitset class represents a @e fixed-size sequence of bits. * * @ingroup containers * * (Note that %bitset does @e not meet the formal requirements of a * <a href="tables.html#65">container</a>. Mainly, it lacks iterators.) * * The template argument, @a Nb, may be any non-negative number, * specifying the number of bits (e.g., "0", "12", "1024*1024"). * * In the general unoptimized case, storage is allocated in word-sized * blocks. Let B be the number of bits in a word, then (Nb+(B-1))/B * words will be used for storage. B - Nb%B bits are unused. (They are * the high-order bits in the highest word.) It is a class invariant * that those unused bits are always zero. * * If you think of %bitset as <em>a simple array of bits</em>, be * aware that your mental picture is reversed: a %bitset behaves * the same way as bits in integers do, with the bit at index 0 in * the <em>least significant / right-hand</em> position, and the bit at * index Nb-1 in the <em>most significant / left-hand</em> position. * Thus, unlike other containers, a %bitset's index <em>counts from * right to left</em>, to put it very loosely. * * This behavior is preserved when translating to and from strings. For * example, the first line of the following program probably prints * <em>b('a') is 0001100001</em> on a modern ASCII system. * * @code * #include <bitset> * #include <iostream> * #include <sstream> * * using namespace std; * * int main() * { * long a = 'a'; * bitset<10> b(a); * * cout << "b('a') is " << b << endl; * * ostringstream s; * s << b; * string str = s.str(); * cout << "index 3 in the string is " << str[3] << " but\n" * << "index 3 in the bitset is " << b[3] << endl; * } * @endcode * * Also see: * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt12ch33s02.html * for a description of extensions. * * Most of the actual code isn't contained in %bitset<> itself, but in the * base class _Base_bitset. The base class works with whole words, not with * individual bits. This allows us to specialize _Base_bitset for the * important special case where the %bitset is only a single word. * * Extra confusion can result due to the fact that the storage for * _Base_bitset @e is a regular array, and is indexed as such. This is * carefully encapsulated. */ template<size_t _Nb> class bitset : private _Base_bitset<_GLIBCXX_BITSET_WORDS(_Nb)> { private: typedef _Base_bitset<_GLIBCXX_BITSET_WORDS(_Nb)> _Base; typedef unsigned long _WordT; void _M_do_sanitize() _GLIBCXX_NOEXCEPT { typedef _Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD> __sanitize_type; __sanitize_type::_S_do_sanitize(this->_M_hiword()); } #if __cplusplus >= 201103L template<typename> friend struct hash; #endif public: /** * This encapsulates the concept of a single bit. An instance of this * class is a proxy for an actual bit; this way the individual bit * operations are done as faster word-size bitwise instructions. * * Most users will never need to use this class directly; conversions * to and from bool are automatic and should be transparent. Overloaded * operators help to preserve the illusion. * * (On a typical system, this <em>bit %reference</em> is 64 * times the size of an actual bit. Ha.) */ class reference { friend class bitset; _WordT* _M_wp; size_t _M_bpos; // left undefined reference(); public: reference(bitset& __b, size_t __pos) _GLIBCXX_NOEXCEPT { _M_wp = &__b._M_getword(__pos); _M_bpos = _Base::_S_whichbit(__pos); } ~reference() _GLIBCXX_NOEXCEPT { } // For b[i] = __x; reference& operator=(bool __x) _GLIBCXX_NOEXCEPT { if (__x) *_M_wp |= _Base::_S_maskbit(_M_bpos); else *_M_wp &= ~_Base::_S_maskbit(_M_bpos); return *this; } // For b[i] = b[__j]; reference& operator=(const reference& __j) _GLIBCXX_NOEXCEPT { if ((*(__j._M_wp) & _Base::_S_maskbit(__j._M_bpos))) *_M_wp |= _Base::_S_maskbit(_M_bpos); else *_M_wp &= ~_Base::_S_maskbit(_M_bpos); return *this; } // Flips the bit bool operator~() const _GLIBCXX_NOEXCEPT { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) == 0; } // For __x = b[i]; operator bool() const _GLIBCXX_NOEXCEPT { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) != 0; } // For b[i].flip(); reference& flip() _GLIBCXX_NOEXCEPT { *_M_wp ^= _Base::_S_maskbit(_M_bpos); return *this; } }; friend class reference; // 23.3.5.1 constructors: /// All bits set to zero. _GLIBCXX_CONSTEXPR bitset() _GLIBCXX_NOEXCEPT { } /// Initial bits bitwise-copied from a single word (others set to zero). #if __cplusplus >= 201103L constexpr bitset(unsigned long long __val) noexcept : _Base(_Sanitize_val<_Nb>::_S_do_sanitize_val(__val)) { } #else bitset(unsigned long __val) : _Base(__val) { _M_do_sanitize(); } #endif /** * Use a subset of a string. * @param __s A string of @a 0 and @a 1 characters. * @param __position Index of the first character in @a __s to use; * defaults to zero. * @throw std::out_of_range If @a pos is bigger the size of @a __s. * @throw std::invalid_argument If a character appears in the string * which is neither @a 0 nor @a 1. */ template<class _CharT, class _Traits, class _Alloc> explicit bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s, size_t __position = 0) : _Base() { if (__position > __s.size()) __throw_out_of_range(__N("bitset::bitset initial position " "not valid")); _M_copy_from_string(__s, __position, std::basic_string<_CharT, _Traits, _Alloc>::npos, _CharT('0'), _CharT('1')); } /** * Use a subset of a string. * @param __s A string of @a 0 and @a 1 characters. * @param __position Index of the first character in @a __s to use. * @param __n The number of characters to copy. * @throw std::out_of_range If @a __position is bigger the size * of @a __s. * @throw std::invalid_argument If a character appears in the string * which is neither @a 0 nor @a 1. */ template<class _CharT, class _Traits, class _Alloc> bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s, size_t __position, size_t __n) : _Base() { if (__position > __s.size()) __throw_out_of_range(__N("bitset::bitset initial position " "not valid")); _M_copy_from_string(__s, __position, __n, _CharT('0'), _CharT('1')); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 396. what are characters zero and one. template<class _CharT, class _Traits, class _Alloc> bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s, size_t __position, size_t __n, _CharT __zero, _CharT __one = _CharT('1')) : _Base() { if (__position > __s.size()) __throw_out_of_range(__N("bitset::bitset initial position " "not valid")); _M_copy_from_string(__s, __position, __n, __zero, __one); } #if __cplusplus >= 201103L /** * Construct from a character %array. * @param __str An %array of characters @a zero and @a one. * @param __n The number of characters to use. * @param __zero The character corresponding to the value 0. * @param __one The character corresponding to the value 1. * @throw std::invalid_argument If a character appears in the string * which is neither @a __zero nor @a __one. */ template<typename _CharT> explicit bitset(const _CharT* __str, typename std::basic_string<_CharT>::size_type __n = std::basic_string<_CharT>::npos, _CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) : _Base() { if (!__str) __throw_logic_error(__N("bitset::bitset(const _CharT*, ...)")); if (__n == std::basic_string<_CharT>::npos) __n = std::char_traits<_CharT>::length(__str); _M_copy_from_ptr<_CharT, std::char_traits<_CharT>>(__str, __n, 0, __n, __zero, __one); } #endif // 23.3.5.2 bitset operations: //@{ /** * Operations on bitsets. * @param __rhs A same-sized bitset. * * These should be self-explanatory. */ bitset<_Nb>& operator&=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT { this->_M_do_and(__rhs); return *this; } bitset<_Nb>& operator|=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT { this->_M_do_or(__rhs); return *this; } bitset<_Nb>& operator^=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT { this->_M_do_xor(__rhs); return *this; } //@} //@{ /** * Operations on bitsets. * @param __position The number of places to shift. * * These should be self-explanatory. */ bitset<_Nb>& operator<<=(size_t __position) _GLIBCXX_NOEXCEPT { if (__builtin_expect(__position < _Nb, 1)) { this->_M_do_left_shift(__position); this->_M_do_sanitize(); } else this->_M_do_reset(); return *this; } bitset<_Nb>& operator>>=(size_t __position) _GLIBCXX_NOEXCEPT { if (__builtin_expect(__position < _Nb, 1)) { this->_M_do_right_shift(__position); this->_M_do_sanitize(); } else this->_M_do_reset(); return *this; } //@} //@{ /** * These versions of single-bit set, reset, flip, and test are * extensions from the SGI version. They do no range checking. * @ingroup SGIextensions */ bitset<_Nb>& _Unchecked_set(size_t __pos) _GLIBCXX_NOEXCEPT { this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); return *this; } bitset<_Nb>& _Unchecked_set(size_t __pos, int __val) _GLIBCXX_NOEXCEPT { if (__val) this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); else this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); return *this; } bitset<_Nb>& _Unchecked_reset(size_t __pos) _GLIBCXX_NOEXCEPT { this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); return *this; } bitset<_Nb>& _Unchecked_flip(size_t __pos) _GLIBCXX_NOEXCEPT { this->_M_getword(__pos) ^= _Base::_S_maskbit(__pos); return *this; } _GLIBCXX_CONSTEXPR bool _Unchecked_test(size_t __pos) const _GLIBCXX_NOEXCEPT { return ((this->_M_getword(__pos) & _Base::_S_maskbit(__pos)) != static_cast<_WordT>(0)); } //@} // Set, reset, and flip. /** * @brief Sets every bit to true. */ bitset<_Nb>& set() _GLIBCXX_NOEXCEPT { this->_M_do_set(); this->_M_do_sanitize(); return *this; } /** * @brief Sets a given bit to a particular value. * @param __position The index of the bit. * @param __val Either true or false, defaults to true. * @throw std::out_of_range If @a pos is bigger the size of the %set. */ bitset<_Nb>& set(size_t __position, bool __val = true) { if (__position >= _Nb) __throw_out_of_range(__N("bitset::set")); return _Unchecked_set(__position, __val); } /** * @brief Sets every bit to false. */ bitset<_Nb>& reset() _GLIBCXX_NOEXCEPT { this->_M_do_reset(); return *this; } /** * @brief Sets a given bit to false. * @param __position The index of the bit. * @throw std::out_of_range If @a pos is bigger the size of the %set. * * Same as writing @c set(pos,false). */ bitset<_Nb>& reset(size_t __position) { if (__position >= _Nb) __throw_out_of_range(__N("bitset::reset")); return _Unchecked_reset(__position); } /** * @brief Toggles every bit to its opposite value. */ bitset<_Nb>& flip() _GLIBCXX_NOEXCEPT { this->_M_do_flip(); this->_M_do_sanitize(); return *this; } /** * @brief Toggles a given bit to its opposite value. * @param __position The index of the bit. * @throw std::out_of_range If @a pos is bigger the size of the %set. */ bitset<_Nb>& flip(size_t __position) { if (__position >= _Nb) __throw_out_of_range(__N("bitset::flip")); return _Unchecked_flip(__position); } /// See the no-argument flip(). bitset<_Nb> operator~() const _GLIBCXX_NOEXCEPT { return bitset<_Nb>(*this).flip(); } //@{ /** * @brief Array-indexing support. * @param __position Index into the %bitset. * @return A bool for a <em>const %bitset</em>. For non-const * bitsets, an instance of the reference proxy class. * @note These operators do no range checking and throw no exceptions, * as required by DR 11 to the standard. * * _GLIBCXX_RESOLVE_LIB_DEFECTS Note that this implementation already * resolves DR 11 (items 1 and 2), but does not do the range-checking * required by that DR's resolution. -pme * The DR has since been changed: range-checking is a precondition * (users' responsibility), and these functions must not throw. -pme */ reference operator[](size_t __position) { return reference(*this, __position); } _GLIBCXX_CONSTEXPR bool operator[](size_t __position) const { return _Unchecked_test(__position); } //@} /** * @brief Returns a numerical interpretation of the %bitset. * @return The integral equivalent of the bits. * @throw std::overflow_error If there are too many bits to be * represented in an @c unsigned @c long. */ unsigned long to_ulong() const { return this->_M_do_to_ulong(); } #if __cplusplus >= 201103L unsigned long long to_ullong() const { return this->_M_do_to_ullong(); } #endif /** * @brief Returns a character interpretation of the %bitset. * @return The string equivalent of the bits. * * Note the ordering of the bits: decreasing character positions * correspond to increasing bit positions (see the main class notes for * an example). */ template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> to_string() const { std::basic_string<_CharT, _Traits, _Alloc> __result; _M_copy_to_string(__result, _CharT('0'), _CharT('1')); return __result; } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 396. what are characters zero and one. template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> to_string(_CharT __zero, _CharT __one = _CharT('1')) const { std::basic_string<_CharT, _Traits, _Alloc> __result; _M_copy_to_string(__result, __zero, __one); return __result; } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 434. bitset::to_string() hard to use. template<class _CharT, class _Traits> std::basic_string<_CharT, _Traits, std::allocator<_CharT> > to_string() const { return to_string<_CharT, _Traits, std::allocator<_CharT> >(); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 853. to_string needs updating with zero and one. template<class _CharT, class _Traits> std::basic_string<_CharT, _Traits, std::allocator<_CharT> > to_string(_CharT __zero, _CharT __one = _CharT('1')) const { return to_string<_CharT, _Traits, std::allocator<_CharT> >(__zero, __one); } template<class _CharT> std::basic_string<_CharT, std::char_traits<_CharT>, std::allocator<_CharT> > to_string() const { return to_string<_CharT, std::char_traits<_CharT>, std::allocator<_CharT> >(); } template<class _CharT> std::basic_string<_CharT, std::char_traits<_CharT>, std::allocator<_CharT> > to_string(_CharT __zero, _CharT __one = _CharT('1')) const { return to_string<_CharT, std::char_traits<_CharT>, std::allocator<_CharT> >(__zero, __one); } std::basic_string<char, std::char_traits<char>, std::allocator<char> > to_string() const { return to_string<char, std::char_traits<char>, std::allocator<char> >(); } std::basic_string<char, std::char_traits<char>, std::allocator<char> > to_string(char __zero, char __one = '1') const { return to_string<char, std::char_traits<char>, std::allocator<char> >(__zero, __one); } // Helper functions for string operations. template<class _CharT, class _Traits> void _M_copy_from_ptr(const _CharT*, size_t, size_t, size_t, _CharT, _CharT); template<class _CharT, class _Traits, class _Alloc> void _M_copy_from_string(const std::basic_string<_CharT, _Traits, _Alloc>& __s, size_t __pos, size_t __n, _CharT __zero, _CharT __one) { _M_copy_from_ptr<_CharT, _Traits>(__s.data(), __s.size(), __pos, __n, __zero, __one); } template<class _CharT, class _Traits, class _Alloc> void _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>&, _CharT, _CharT) const; // NB: Backward compat. template<class _CharT, class _Traits, class _Alloc> void _M_copy_from_string(const std::basic_string<_CharT, _Traits, _Alloc>& __s, size_t __pos, size_t __n) { _M_copy_from_string(__s, __pos, __n, _CharT('0'), _CharT('1')); } template<class _CharT, class _Traits, class _Alloc> void _M_copy_to_string(std::basic_string<_CharT, _Traits,_Alloc>& __s) const { _M_copy_to_string(__s, _CharT('0'), _CharT('1')); } /// Returns the number of bits which are set. size_t count() const _GLIBCXX_NOEXCEPT { return this->_M_do_count(); } /// Returns the total number of bits. _GLIBCXX_CONSTEXPR size_t size() const _GLIBCXX_NOEXCEPT { return _Nb; } //@{ /// These comparisons for equality/inequality are, well, @e bitwise. bool operator==(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT { return this->_M_is_equal(__rhs); } bool operator!=(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT { return !this->_M_is_equal(__rhs); } //@} /** * @brief Tests the value of a bit. * @param __position The index of a bit. * @return The value at @a pos. * @throw std::out_of_range If @a pos is bigger the size of the %set. */ bool test(size_t __position) const { if (__position >= _Nb) __throw_out_of_range(__N("bitset::test")); return _Unchecked_test(__position); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 693. std::bitset::all() missing. /** * @brief Tests whether all the bits are on. * @return True if all the bits are set. */ bool all() const _GLIBCXX_NOEXCEPT { return this->template _M_are_all<_Nb>(); } /** * @brief Tests whether any of the bits are on. * @return True if at least one bit is set. */ bool any() const _GLIBCXX_NOEXCEPT { return this->_M_is_any(); } /** * @brief Tests whether any of the bits are on. * @return True if none of the bits are set. */ bool none() const _GLIBCXX_NOEXCEPT { return !this->_M_is_any(); } //@{ /// Self-explanatory. bitset<_Nb> operator<<(size_t __position) const _GLIBCXX_NOEXCEPT { return bitset<_Nb>(*this) <<= __position; } bitset<_Nb> operator>>(size_t __position) const _GLIBCXX_NOEXCEPT { return bitset<_Nb>(*this) >>= __position; } //@} /** * @brief Finds the index of the first "on" bit. * @return The index of the first bit set, or size() if not found. * @ingroup SGIextensions * @sa _Find_next */ size_t _Find_first() const _GLIBCXX_NOEXCEPT { return this->_M_do_find_first(_Nb); } /** * @brief Finds the index of the next "on" bit after prev. * @return The index of the next bit set, or size() if not found. * @param __prev Where to start searching. * @ingroup SGIextensions * @sa _Find_first */ size_t _Find_next(size_t __prev) const _GLIBCXX_NOEXCEPT { return this->_M_do_find_next(__prev, _Nb); } }; // Definitions of non-inline member functions. template<size_t _Nb> template<class _CharT, class _Traits> void bitset<_Nb>:: _M_copy_from_ptr(const _CharT* __s, size_t __len, size_t __pos, size_t __n, _CharT __zero, _CharT __one) { reset(); const size_t __nbits = std::min(_Nb, std::min(__n, size_t(__len - __pos))); for (size_t __i = __nbits; __i > 0; --__i) { const _CharT __c = __s[__pos + __nbits - __i]; if (_Traits::eq(__c, __zero)) ; else if (_Traits::eq(__c, __one)) _Unchecked_set(__i - 1); else __throw_invalid_argument(__N("bitset::_M_copy_from_ptr")); } } template<size_t _Nb> template<class _CharT, class _Traits, class _Alloc> void bitset<_Nb>:: _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>& __s, _CharT __zero, _CharT __one) const { __s.assign(_Nb, __zero); for (size_t __i = _Nb; __i > 0; --__i) if (_Unchecked_test(__i - 1)) _Traits::assign(__s[_Nb - __i], __one); } // 23.3.5.3 bitset operations: //@{ /** * @brief Global bitwise operations on bitsets. * @param __x A bitset. * @param __y A bitset of the same size as @a __x. * @return A new bitset. * * These should be self-explanatory. */ template<size_t _Nb> inline bitset<_Nb> operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT { bitset<_Nb> __result(__x); __result &= __y; return __result; } template<size_t _Nb> inline bitset<_Nb> operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT { bitset<_Nb> __result(__x); __result |= __y; return __result; } template <size_t _Nb> inline bitset<_Nb> operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT { bitset<_Nb> __result(__x); __result ^= __y; return __result; } //@} //@{ /** * @brief Global I/O operators for bitsets. * * Direct I/O between streams and bitsets is supported. Output is * straightforward. Input will skip whitespace, only accept @a 0 and @a 1 * characters, and will only extract as many digits as the %bitset will * hold. */ template<class _CharT, class _Traits, size_t _Nb> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) { typedef typename _Traits::char_type char_type; typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; std::basic_string<_CharT, _Traits> __tmp; __tmp.reserve(_Nb); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 303. Bitset input operator underspecified const char_type __zero = __is.widen('0'); const char_type __one = __is.widen('1'); typename __ios_base::iostate __state = __ios_base::goodbit; typename __istream_type::sentry __sentry(__is); if (__sentry) { __try { for (size_t __i = _Nb; __i > 0; --__i) { static typename _Traits::int_type __eof = _Traits::eof(); typename _Traits::int_type __c1 = __is.rdbuf()->sbumpc(); if (_Traits::eq_int_type(__c1, __eof)) { __state |= __ios_base::eofbit; break; } else { const char_type __c2 = _Traits::to_char_type(__c1); if (_Traits::eq(__c2, __zero)) __tmp.push_back(__zero); else if (_Traits::eq(__c2, __one)) __tmp.push_back(__one); else if (_Traits:: eq_int_type(__is.rdbuf()->sputbackc(__c2), __eof)) { __state |= __ios_base::failbit; break; } } } } __catch(__cxxabiv1::__forced_unwind&) { __is._M_setstate(__ios_base::badbit); __throw_exception_again; } __catch(...) { __is._M_setstate(__ios_base::badbit); } } if (__tmp.empty() && _Nb) __state |= __ios_base::failbit; else __x._M_copy_from_string(__tmp, static_cast<size_t>(0), _Nb, __zero, __one); if (__state) __is.setstate(__state); return __is; } template <class _CharT, class _Traits, size_t _Nb> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const bitset<_Nb>& __x) { std::basic_string<_CharT, _Traits> __tmp; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 396. what are characters zero and one. const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__os.getloc()); __x._M_copy_to_string(__tmp, __ct.widen('0'), __ct.widen('1')); return __os << __tmp; } //@} _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std #undef _GLIBCXX_BITSET_WORDS #undef _GLIBCXX_BITSET_BITS_PER_WORD #undef _GLIBCXX_BITSET_BITS_PER_ULL #if __cplusplus >= 201103L #include <bits/functional_hash.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // DR 1182. /// std::hash specialization for bitset. template<size_t _Nb> struct hash<_GLIBCXX_STD_C::bitset<_Nb>> : public __hash_base<size_t, _GLIBCXX_STD_C::bitset<_Nb>> { size_t operator()(const _GLIBCXX_STD_C::bitset<_Nb>& __b) const noexcept { const size_t __clength = (_Nb + __CHAR_BIT__ - 1) / __CHAR_BIT__; return std::_Hash_impl::hash(__b._M_getdata(), __clength); } }; template<> struct hash<_GLIBCXX_STD_C::bitset<0>> : public __hash_base<size_t, _GLIBCXX_STD_C::bitset<0>> { size_t operator()(const _GLIBCXX_STD_C::bitset<0>&) const noexcept { return 0; } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // C++11 #ifdef _GLIBCXX_DEBUG # include <debug/bitset> #endif #ifdef _GLIBCXX_PROFILE # include <profile/bitset> #endif #endif /* _GLIBCXX_BITSET */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/locale������������������������������������������������������������������������������������0000644�����������������00000002616�14763166030�0006762 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Locale support -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // // ISO C++ 14882: 22.1 Locales // /** @file include/locale * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_LOCALE #define _GLIBCXX_LOCALE 1 #pragma GCC system_header #include <bits/localefwd.h> #include <bits/locale_classes.h> #include <bits/locale_facets.h> #include <bits/locale_facets_nonio.h> #endif /* _GLIBCXX_LOCALE */ ������������������������������������������������������������������������������������������������������������������c++/4.8.2/sstream�����������������������������������������������������������������������������������0000644�����������������00000047112�14763166030�0007201 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// String based streams -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/sstream * This is a Standard C++ Library header. */ // // ISO C++ 14882: 27.7 String-based streams // #ifndef _GLIBCXX_SSTREAM #define _GLIBCXX_SSTREAM 1 #pragma GCC system_header #include <istream> #include <ostream> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // [27.7.1] template class basic_stringbuf /** * @brief The actual work of input and output (for std::string). * @ingroup io * * @tparam _CharT Type of character stream. * @tparam _Traits Traits for character type, defaults to * char_traits<_CharT>. * @tparam _Alloc Allocator type, defaults to allocator<_CharT>. * * This class associates either or both of its input and output sequences * with a sequence of characters, which can be initialized from, or made * available as, a @c std::basic_string. (Paraphrased from [27.7.1]/1.) * * For this class, open modes (of type @c ios_base::openmode) have * @c in set if the input sequence can be read, and @c out set if the * output sequence can be written. */ template<typename _CharT, typename _Traits, typename _Alloc> class basic_stringbuf : public basic_streambuf<_CharT, _Traits> { public: // Types: typedef _CharT char_type; typedef _Traits traits_type; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 251. basic_stringbuf missing allocator_type typedef _Alloc allocator_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; typedef basic_streambuf<char_type, traits_type> __streambuf_type; typedef basic_string<char_type, _Traits, _Alloc> __string_type; typedef typename __string_type::size_type __size_type; protected: /// Place to stash in || out || in | out settings for current stringbuf. ios_base::openmode _M_mode; // Data Members: __string_type _M_string; public: // Constructors: /** * @brief Starts with an empty string buffer. * @param __mode Whether the buffer can read, or write, or both. * * The default constructor initializes the parent class using its * own default ctor. */ explicit basic_stringbuf(ios_base::openmode __mode = ios_base::in | ios_base::out) : __streambuf_type(), _M_mode(__mode), _M_string() { } /** * @brief Starts with an existing string buffer. * @param __str A string to copy as a starting buffer. * @param __mode Whether the buffer can read, or write, or both. * * This constructor initializes the parent class using its * own default ctor. */ explicit basic_stringbuf(const __string_type& __str, ios_base::openmode __mode = ios_base::in | ios_base::out) : __streambuf_type(), _M_mode(), _M_string(__str.data(), __str.size()) { _M_stringbuf_init(__mode); } // Get and set: /** * @brief Copying out the string buffer. * @return A copy of one of the underlying sequences. * * <em>If the buffer is only created in input mode, the underlying * character sequence is equal to the input sequence; otherwise, it * is equal to the output sequence.</em> [27.7.1.2]/1 */ __string_type str() const { __string_type __ret; if (this->pptr()) { // The current egptr() may not be the actual string end. if (this->pptr() > this->egptr()) __ret = __string_type(this->pbase(), this->pptr()); else __ret = __string_type(this->pbase(), this->egptr()); } else __ret = _M_string; return __ret; } /** * @brief Setting a new buffer. * @param __s The string to use as a new sequence. * * Deallocates any previous stored sequence, then copies @a s to * use as a new one. */ void str(const __string_type& __s) { // Cannot use _M_string = __s, since v3 strings are COW. _M_string.assign(__s.data(), __s.size()); _M_stringbuf_init(_M_mode); } protected: // Common initialization code goes here. void _M_stringbuf_init(ios_base::openmode __mode) { _M_mode = __mode; __size_type __len = 0; if (_M_mode & (ios_base::ate | ios_base::app)) __len = _M_string.size(); _M_sync(const_cast<char_type*>(_M_string.data()), 0, __len); } virtual streamsize showmanyc() { streamsize __ret = -1; if (_M_mode & ios_base::in) { _M_update_egptr(); __ret = this->egptr() - this->gptr(); } return __ret; } virtual int_type underflow(); virtual int_type pbackfail(int_type __c = traits_type::eof()); virtual int_type overflow(int_type __c = traits_type::eof()); /** * @brief Manipulates the buffer. * @param __s Pointer to a buffer area. * @param __n Size of @a __s. * @return @c this * * If no buffer has already been created, and both @a __s and @a __n are * non-zero, then @c __s is used as a buffer; see * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html * for more. */ virtual __streambuf_type* setbuf(char_type* __s, streamsize __n) { if (__s && __n >= 0) { // This is implementation-defined behavior, and assumes // that an external char_type array of length __n exists // and has been pre-allocated. If this is not the case, // things will quickly blow up. // Step 1: Destroy the current internal array. _M_string.clear(); // Step 2: Use the external array. _M_sync(__s, __n, 0); } return this; } virtual pos_type seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode = ios_base::in | ios_base::out); virtual pos_type seekpos(pos_type __sp, ios_base::openmode __mode = ios_base::in | ios_base::out); // Internal function for correctly updating the internal buffer // for a particular _M_string, due to initialization or re-sizing // of an existing _M_string. void _M_sync(char_type* __base, __size_type __i, __size_type __o); // Internal function for correctly updating egptr() to the actual // string end. void _M_update_egptr() { const bool __testin = _M_mode & ios_base::in; if (this->pptr() && this->pptr() > this->egptr()) { if (__testin) this->setg(this->eback(), this->gptr(), this->pptr()); else this->setg(this->pptr(), this->pptr(), this->pptr()); } } // Works around the issue with pbump, part of the protected // interface of basic_streambuf, taking just an int. void _M_pbump(char_type* __pbeg, char_type* __pend, off_type __off); }; // [27.7.2] Template class basic_istringstream /** * @brief Controlling input for std::string. * @ingroup io * * @tparam _CharT Type of character stream. * @tparam _Traits Traits for character type, defaults to * char_traits<_CharT>. * @tparam _Alloc Allocator type, defaults to allocator<_CharT>. * * This class supports reading from objects of type std::basic_string, * using the inherited functions from std::basic_istream. To control * the associated sequence, an instance of std::basic_stringbuf is used, * which this page refers to as @c sb. */ template<typename _CharT, typename _Traits, typename _Alloc> class basic_istringstream : public basic_istream<_CharT, _Traits> { public: // Types: typedef _CharT char_type; typedef _Traits traits_type; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 251. basic_stringbuf missing allocator_type typedef _Alloc allocator_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; // Non-standard types: typedef basic_string<_CharT, _Traits, _Alloc> __string_type; typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type; typedef basic_istream<char_type, traits_type> __istream_type; private: __stringbuf_type _M_stringbuf; public: // Constructors: /** * @brief Default constructor starts with an empty string buffer. * @param __mode Whether the buffer can read, or write, or both. * * @c ios_base::in is automatically included in @a __mode. * * Initializes @c sb using @c __mode|in, and passes @c &sb to the base * class initializer. Does not allocate any buffer. * * That's a lie. We initialize the base class with NULL, because the * string class does its own memory management. */ explicit basic_istringstream(ios_base::openmode __mode = ios_base::in) : __istream_type(), _M_stringbuf(__mode | ios_base::in) { this->init(&_M_stringbuf); } /** * @brief Starts with an existing string buffer. * @param __str A string to copy as a starting buffer. * @param __mode Whether the buffer can read, or write, or both. * * @c ios_base::in is automatically included in @a mode. * * Initializes @c sb using @a str and @c mode|in, and passes @c &sb * to the base class initializer. * * That's a lie. We initialize the base class with NULL, because the * string class does its own memory management. */ explicit basic_istringstream(const __string_type& __str, ios_base::openmode __mode = ios_base::in) : __istream_type(), _M_stringbuf(__str, __mode | ios_base::in) { this->init(&_M_stringbuf); } /** * @brief The destructor does nothing. * * The buffer is deallocated by the stringbuf object, not the * formatting stream. */ ~basic_istringstream() { } // Members: /** * @brief Accessing the underlying buffer. * @return The current basic_stringbuf buffer. * * This hides both signatures of std::basic_ios::rdbuf(). */ __stringbuf_type* rdbuf() const { return const_cast<__stringbuf_type*>(&_M_stringbuf); } /** * @brief Copying out the string buffer. * @return @c rdbuf()->str() */ __string_type str() const { return _M_stringbuf.str(); } /** * @brief Setting a new buffer. * @param __s The string to use as a new sequence. * * Calls @c rdbuf()->str(s). */ void str(const __string_type& __s) { _M_stringbuf.str(__s); } }; // [27.7.3] Template class basic_ostringstream /** * @brief Controlling output for std::string. * @ingroup io * * @tparam _CharT Type of character stream. * @tparam _Traits Traits for character type, defaults to * char_traits<_CharT>. * @tparam _Alloc Allocator type, defaults to allocator<_CharT>. * * This class supports writing to objects of type std::basic_string, * using the inherited functions from std::basic_ostream. To control * the associated sequence, an instance of std::basic_stringbuf is used, * which this page refers to as @c sb. */ template <typename _CharT, typename _Traits, typename _Alloc> class basic_ostringstream : public basic_ostream<_CharT, _Traits> { public: // Types: typedef _CharT char_type; typedef _Traits traits_type; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 251. basic_stringbuf missing allocator_type typedef _Alloc allocator_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; // Non-standard types: typedef basic_string<_CharT, _Traits, _Alloc> __string_type; typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type; typedef basic_ostream<char_type, traits_type> __ostream_type; private: __stringbuf_type _M_stringbuf; public: // Constructors/destructor: /** * @brief Default constructor starts with an empty string buffer. * @param __mode Whether the buffer can read, or write, or both. * * @c ios_base::out is automatically included in @a mode. * * Initializes @c sb using @c mode|out, and passes @c &sb to the base * class initializer. Does not allocate any buffer. * * That's a lie. We initialize the base class with NULL, because the * string class does its own memory management. */ explicit basic_ostringstream(ios_base::openmode __mode = ios_base::out) : __ostream_type(), _M_stringbuf(__mode | ios_base::out) { this->init(&_M_stringbuf); } /** * @brief Starts with an existing string buffer. * @param __str A string to copy as a starting buffer. * @param __mode Whether the buffer can read, or write, or both. * * @c ios_base::out is automatically included in @a mode. * * Initializes @c sb using @a str and @c mode|out, and passes @c &sb * to the base class initializer. * * That's a lie. We initialize the base class with NULL, because the * string class does its own memory management. */ explicit basic_ostringstream(const __string_type& __str, ios_base::openmode __mode = ios_base::out) : __ostream_type(), _M_stringbuf(__str, __mode | ios_base::out) { this->init(&_M_stringbuf); } /** * @brief The destructor does nothing. * * The buffer is deallocated by the stringbuf object, not the * formatting stream. */ ~basic_ostringstream() { } // Members: /** * @brief Accessing the underlying buffer. * @return The current basic_stringbuf buffer. * * This hides both signatures of std::basic_ios::rdbuf(). */ __stringbuf_type* rdbuf() const { return const_cast<__stringbuf_type*>(&_M_stringbuf); } /** * @brief Copying out the string buffer. * @return @c rdbuf()->str() */ __string_type str() const { return _M_stringbuf.str(); } /** * @brief Setting a new buffer. * @param __s The string to use as a new sequence. * * Calls @c rdbuf()->str(s). */ void str(const __string_type& __s) { _M_stringbuf.str(__s); } }; // [27.7.4] Template class basic_stringstream /** * @brief Controlling input and output for std::string. * @ingroup io * * @tparam _CharT Type of character stream. * @tparam _Traits Traits for character type, defaults to * char_traits<_CharT>. * @tparam _Alloc Allocator type, defaults to allocator<_CharT>. * * This class supports reading from and writing to objects of type * std::basic_string, using the inherited functions from * std::basic_iostream. To control the associated sequence, an instance * of std::basic_stringbuf is used, which this page refers to as @c sb. */ template <typename _CharT, typename _Traits, typename _Alloc> class basic_stringstream : public basic_iostream<_CharT, _Traits> { public: // Types: typedef _CharT char_type; typedef _Traits traits_type; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 251. basic_stringbuf missing allocator_type typedef _Alloc allocator_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; // Non-standard Types: typedef basic_string<_CharT, _Traits, _Alloc> __string_type; typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type; typedef basic_iostream<char_type, traits_type> __iostream_type; private: __stringbuf_type _M_stringbuf; public: // Constructors/destructors /** * @brief Default constructor starts with an empty string buffer. * @param __m Whether the buffer can read, or write, or both. * * Initializes @c sb using the mode from @c __m, and passes @c * &sb to the base class initializer. Does not allocate any * buffer. * * That's a lie. We initialize the base class with NULL, because the * string class does its own memory management. */ explicit basic_stringstream(ios_base::openmode __m = ios_base::out | ios_base::in) : __iostream_type(), _M_stringbuf(__m) { this->init(&_M_stringbuf); } /** * @brief Starts with an existing string buffer. * @param __str A string to copy as a starting buffer. * @param __m Whether the buffer can read, or write, or both. * * Initializes @c sb using @a __str and @c __m, and passes @c &sb * to the base class initializer. * * That's a lie. We initialize the base class with NULL, because the * string class does its own memory management. */ explicit basic_stringstream(const __string_type& __str, ios_base::openmode __m = ios_base::out | ios_base::in) : __iostream_type(), _M_stringbuf(__str, __m) { this->init(&_M_stringbuf); } /** * @brief The destructor does nothing. * * The buffer is deallocated by the stringbuf object, not the * formatting stream. */ ~basic_stringstream() { } // Members: /** * @brief Accessing the underlying buffer. * @return The current basic_stringbuf buffer. * * This hides both signatures of std::basic_ios::rdbuf(). */ __stringbuf_type* rdbuf() const { return const_cast<__stringbuf_type*>(&_M_stringbuf); } /** * @brief Copying out the string buffer. * @return @c rdbuf()->str() */ __string_type str() const { return _M_stringbuf.str(); } /** * @brief Setting a new buffer. * @param __s The string to use as a new sequence. * * Calls @c rdbuf()->str(s). */ void str(const __string_type& __s) { _M_stringbuf.str(__s); } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #include <bits/sstream.tcc> #endif /* _GLIBCXX_SSTREAM */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/cstdio������������������������������������������������������������������������������������0000644�����������������00000010265�14763166030�0007007 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- forwarding header. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/cstdio * This is a Standard C++ Library file. You should @c \#include this file * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c stdio.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std (except for names which are defined * as macros in C). */ // // ISO C++ 14882: 27.8.2 C Library files // #pragma GCC system_header #include <bits/c++config.h> #include <stdio.h> #ifndef _GLIBCXX_CSTDIO #define _GLIBCXX_CSTDIO 1 #ifndef _GLIBCXX_HAVE_GETS extern "C" char* gets (char* __s) __attribute__((deprecated)); #endif // Get rid of those macros defined in <stdio.h> in lieu of real functions. #undef clearerr #undef fclose #undef feof #undef ferror #undef fflush #undef fgetc #undef fgetpos #undef fgets #undef fopen #undef fprintf #undef fputc #undef fputs #undef fread #undef freopen #undef fscanf #undef fseek #undef fsetpos #undef ftell #undef fwrite #undef getc #undef getchar #undef gets #undef perror #undef printf #undef putc #undef putchar #undef puts #undef remove #undef rename #undef rewind #undef scanf #undef setbuf #undef setvbuf #undef sprintf #undef sscanf #undef tmpfile #undef tmpnam #undef ungetc #undef vfprintf #undef vprintf #undef vsprintf namespace std { using ::FILE; using ::fpos_t; using ::clearerr; using ::fclose; using ::feof; using ::ferror; using ::fflush; using ::fgetc; using ::fgetpos; using ::fgets; using ::fopen; using ::fprintf; using ::fputc; using ::fputs; using ::fread; using ::freopen; using ::fscanf; using ::fseek; using ::fsetpos; using ::ftell; using ::fwrite; using ::getc; using ::getchar; using ::gets; using ::perror; using ::printf; using ::putc; using ::putchar; using ::puts; using ::remove; using ::rename; using ::rewind; using ::scanf; using ::setbuf; using ::setvbuf; using ::sprintf; using ::sscanf; using ::tmpfile; using ::tmpnam; using ::ungetc; using ::vfprintf; using ::vprintf; using ::vsprintf; } // namespace #if _GLIBCXX_USE_C99 #undef snprintf #undef vfscanf #undef vscanf #undef vsnprintf #undef vsscanf namespace __gnu_cxx { #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC extern "C" int (snprintf)(char * __restrict, std::size_t, const char * __restrict, ...) throw (); extern "C" int (vfscanf)(FILE * __restrict, const char * __restrict, __gnuc_va_list); extern "C" int (vscanf)(const char * __restrict, __gnuc_va_list); extern "C" int (vsnprintf)(char * __restrict, std::size_t, const char * __restrict, __gnuc_va_list) throw (); extern "C" int (vsscanf)(const char * __restrict, const char * __restrict, __gnuc_va_list) throw (); #endif #if !_GLIBCXX_USE_C99_DYNAMIC using ::snprintf; using ::vfscanf; using ::vscanf; using ::vsnprintf; using ::vsscanf; #endif } // namespace __gnu_cxx namespace std { using ::__gnu_cxx::snprintf; using ::__gnu_cxx::vfscanf; using ::__gnu_cxx::vscanf; using ::__gnu_cxx::vsnprintf; using ::__gnu_cxx::vsscanf; } // namespace std #endif // _GLIBCXX_USE_C99 #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/type_traits�������������������������������������������������������������������������������0000644�����������������00000163063�14763166030�0010076 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// C++11 <type_traits> -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/type_traits * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_TYPE_TRAITS #define _GLIBCXX_TYPE_TRAITS 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <bits/c++config.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup metaprogramming Metaprogramming * @ingroup utilities * * Template utilities for compile-time introspection and modification, * including type classification traits, type property inspection traits * and type transformation traits. * * @{ */ /// integral_constant template<typename _Tp, _Tp __v> struct integral_constant { static constexpr _Tp value = __v; typedef _Tp value_type; typedef integral_constant<_Tp, __v> type; constexpr operator value_type() { return value; } }; template<typename _Tp, _Tp __v> constexpr _Tp integral_constant<_Tp, __v>::value; /// The type used as a compile-time boolean with true value. typedef integral_constant<bool, true> true_type; /// The type used as a compile-time boolean with false value. typedef integral_constant<bool, false> false_type; // Meta programming helper types. template<bool, typename, typename> struct conditional; template<typename...> struct __or_; template<> struct __or_<> : public false_type { }; template<typename _B1> struct __or_<_B1> : public _B1 { }; template<typename _B1, typename _B2> struct __or_<_B1, _B2> : public conditional<_B1::value, _B1, _B2>::type { }; template<typename _B1, typename _B2, typename _B3, typename... _Bn> struct __or_<_B1, _B2, _B3, _Bn...> : public conditional<_B1::value, _B1, __or_<_B2, _B3, _Bn...>>::type { }; template<typename...> struct __and_; template<> struct __and_<> : public true_type { }; template<typename _B1> struct __and_<_B1> : public _B1 { }; template<typename _B1, typename _B2> struct __and_<_B1, _B2> : public conditional<_B1::value, _B2, _B1>::type { }; template<typename _B1, typename _B2, typename _B3, typename... _Bn> struct __and_<_B1, _B2, _B3, _Bn...> : public conditional<_B1::value, __and_<_B2, _B3, _Bn...>, _B1>::type { }; template<typename _Pp> struct __not_ : public integral_constant<bool, !_Pp::value> { }; struct __sfinae_types { typedef char __one; typedef struct { char __arr[2]; } __two; }; // For several sfinae-friendly trait implementations we transport both the // result information (as the member type) and the failure information (no // member type). This is very similar to std::enable_if, but we cannot use // them, because we need to derive from them as an implementation detail. template<typename _Tp> struct __success_type { typedef _Tp type; }; struct __failure_type { }; // Primary type categories. template<typename> struct remove_cv; template<typename> struct __is_void_helper : public false_type { }; template<> struct __is_void_helper<void> : public true_type { }; /// is_void template<typename _Tp> struct is_void : public integral_constant<bool, (__is_void_helper<typename remove_cv<_Tp>::type>::value)> { }; template<typename> struct __is_integral_helper : public false_type { }; template<> struct __is_integral_helper<bool> : public true_type { }; template<> struct __is_integral_helper<char> : public true_type { }; template<> struct __is_integral_helper<signed char> : public true_type { }; template<> struct __is_integral_helper<unsigned char> : public true_type { }; #ifdef _GLIBCXX_USE_WCHAR_T template<> struct __is_integral_helper<wchar_t> : public true_type { }; #endif template<> struct __is_integral_helper<char16_t> : public true_type { }; template<> struct __is_integral_helper<char32_t> : public true_type { }; template<> struct __is_integral_helper<short> : public true_type { }; template<> struct __is_integral_helper<unsigned short> : public true_type { }; template<> struct __is_integral_helper<int> : public true_type { }; template<> struct __is_integral_helper<unsigned int> : public true_type { }; template<> struct __is_integral_helper<long> : public true_type { }; template<> struct __is_integral_helper<unsigned long> : public true_type { }; template<> struct __is_integral_helper<long long> : public true_type { }; template<> struct __is_integral_helper<unsigned long long> : public true_type { }; #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128) template<> struct __is_integral_helper<__int128> : public true_type { }; template<> struct __is_integral_helper<unsigned __int128> : public true_type { }; #endif /// is_integral template<typename _Tp> struct is_integral : public integral_constant<bool, (__is_integral_helper<typename remove_cv<_Tp>::type>::value)> { }; template<typename> struct __is_floating_point_helper : public false_type { }; template<> struct __is_floating_point_helper<float> : public true_type { }; template<> struct __is_floating_point_helper<double> : public true_type { }; template<> struct __is_floating_point_helper<long double> : public true_type { }; #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128) template<> struct __is_floating_point_helper<__float128> : public true_type { }; #endif /// is_floating_point template<typename _Tp> struct is_floating_point : public integral_constant<bool, (__is_floating_point_helper<typename remove_cv<_Tp>::type>::value)> { }; /// is_array template<typename> struct is_array : public false_type { }; template<typename _Tp, std::size_t _Size> struct is_array<_Tp[_Size]> : public true_type { }; template<typename _Tp> struct is_array<_Tp[]> : public true_type { }; template<typename> struct __is_pointer_helper : public false_type { }; template<typename _Tp> struct __is_pointer_helper<_Tp*> : public true_type { }; /// is_pointer template<typename _Tp> struct is_pointer : public integral_constant<bool, (__is_pointer_helper<typename remove_cv<_Tp>::type>::value)> { }; /// is_lvalue_reference template<typename> struct is_lvalue_reference : public false_type { }; template<typename _Tp> struct is_lvalue_reference<_Tp&> : public true_type { }; /// is_rvalue_reference template<typename> struct is_rvalue_reference : public false_type { }; template<typename _Tp> struct is_rvalue_reference<_Tp&&> : public true_type { }; template<typename> struct is_function; template<typename> struct __is_member_object_pointer_helper : public false_type { }; template<typename _Tp, typename _Cp> struct __is_member_object_pointer_helper<_Tp _Cp::*> : public integral_constant<bool, !is_function<_Tp>::value> { }; /// is_member_object_pointer template<typename _Tp> struct is_member_object_pointer : public integral_constant<bool, (__is_member_object_pointer_helper< typename remove_cv<_Tp>::type>::value)> { }; template<typename> struct __is_member_function_pointer_helper : public false_type { }; template<typename _Tp, typename _Cp> struct __is_member_function_pointer_helper<_Tp _Cp::*> : public integral_constant<bool, is_function<_Tp>::value> { }; /// is_member_function_pointer template<typename _Tp> struct is_member_function_pointer : public integral_constant<bool, (__is_member_function_pointer_helper< typename remove_cv<_Tp>::type>::value)> { }; /// is_enum template<typename _Tp> struct is_enum : public integral_constant<bool, __is_enum(_Tp)> { }; /// is_union template<typename _Tp> struct is_union : public integral_constant<bool, __is_union(_Tp)> { }; /// is_class template<typename _Tp> struct is_class : public integral_constant<bool, __is_class(_Tp)> { }; /// is_function template<typename> struct is_function : public false_type { }; template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes...)> : public true_type { }; template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes......)> : public true_type { }; template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes...) const> : public true_type { }; template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes......) const> : public true_type { }; template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes...) volatile> : public true_type { }; template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes......) volatile> : public true_type { }; template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes...) const volatile> : public true_type { }; template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes......) const volatile> : public true_type { }; template<typename> struct __is_nullptr_t_helper : public false_type { }; template<> struct __is_nullptr_t_helper<std::nullptr_t> : public true_type { }; // __is_nullptr_t (extension). template<typename _Tp> struct __is_nullptr_t : public integral_constant<bool, (__is_nullptr_t_helper<typename remove_cv<_Tp>::type>::value)> { }; // Composite type categories. /// is_reference template<typename _Tp> struct is_reference : public __or_<is_lvalue_reference<_Tp>, is_rvalue_reference<_Tp>>::type { }; /// is_arithmetic template<typename _Tp> struct is_arithmetic : public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type { }; /// is_fundamental template<typename _Tp> struct is_fundamental : public __or_<is_arithmetic<_Tp>, is_void<_Tp>, __is_nullptr_t<_Tp>>::type { }; /// is_object template<typename _Tp> struct is_object : public __not_<__or_<is_function<_Tp>, is_reference<_Tp>, is_void<_Tp>>>::type { }; template<typename> struct is_member_pointer; /// is_scalar template<typename _Tp> struct is_scalar : public __or_<is_arithmetic<_Tp>, is_enum<_Tp>, is_pointer<_Tp>, is_member_pointer<_Tp>, __is_nullptr_t<_Tp>>::type { }; /// is_compound template<typename _Tp> struct is_compound : public integral_constant<bool, !is_fundamental<_Tp>::value> { }; template<typename _Tp> struct __is_member_pointer_helper : public false_type { }; template<typename _Tp, typename _Cp> struct __is_member_pointer_helper<_Tp _Cp::*> : public true_type { }; /// is_member_pointer template<typename _Tp> struct is_member_pointer : public integral_constant<bool, (__is_member_pointer_helper< typename remove_cv<_Tp>::type>::value)> { }; // Type properties. /// is_const template<typename> struct is_const : public false_type { }; template<typename _Tp> struct is_const<_Tp const> : public true_type { }; /// is_volatile template<typename> struct is_volatile : public false_type { }; template<typename _Tp> struct is_volatile<_Tp volatile> : public true_type { }; /// is_trivial template<typename _Tp> struct is_trivial : public integral_constant<bool, __is_trivial(_Tp)> { }; // is_trivially_copyable (still unimplemented) /// is_standard_layout template<typename _Tp> struct is_standard_layout : public integral_constant<bool, __is_standard_layout(_Tp)> { }; /// is_pod // Could use is_standard_layout && is_trivial instead of the builtin. template<typename _Tp> struct is_pod : public integral_constant<bool, __is_pod(_Tp)> { }; /// is_literal_type template<typename _Tp> struct is_literal_type : public integral_constant<bool, __is_literal_type(_Tp)> { }; /// is_empty template<typename _Tp> struct is_empty : public integral_constant<bool, __is_empty(_Tp)> { }; /// is_polymorphic template<typename _Tp> struct is_polymorphic : public integral_constant<bool, __is_polymorphic(_Tp)> { }; /// is_abstract template<typename _Tp> struct is_abstract : public integral_constant<bool, __is_abstract(_Tp)> { }; template<typename _Tp, bool = is_integral<_Tp>::value, bool = is_floating_point<_Tp>::value> struct __is_signed_helper : public false_type { }; template<typename _Tp> struct __is_signed_helper<_Tp, false, true> : public true_type { }; template<typename _Tp> struct __is_signed_helper<_Tp, true, false> : public integral_constant<bool, static_cast<bool>(_Tp(-1) < _Tp(0))> { }; /// is_signed template<typename _Tp> struct is_signed : public integral_constant<bool, __is_signed_helper<_Tp>::value> { }; /// is_unsigned template<typename _Tp> struct is_unsigned : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>::type { }; // Destructible and constructible type properties. template<typename> struct add_rvalue_reference; /** * @brief Utility to simplify expressions used in unevaluated operands * @ingroup utilities */ template<typename _Tp> typename add_rvalue_reference<_Tp>::type declval() noexcept; template<typename, unsigned = 0> struct extent; template<typename> struct remove_all_extents; template<typename _Tp> struct __is_array_known_bounds : public integral_constant<bool, (extent<_Tp>::value > 0)> { }; template<typename _Tp> struct __is_array_unknown_bounds : public __and_<is_array<_Tp>, __not_<extent<_Tp>>>::type { }; // In N3290 is_destructible does not say anything about function // types and abstract types, see LWG 2049. This implementation // describes function types as non-destructible and all complete // object types as destructible, iff the explicit destructor // call expression is wellformed. struct __do_is_destructible_impl { template<typename _Tp, typename = decltype(declval<_Tp&>().~_Tp())> static true_type __test(int); template<typename> static false_type __test(...); }; template<typename _Tp> struct __is_destructible_impl : public __do_is_destructible_impl { typedef decltype(__test<_Tp>(0)) type; }; template<typename _Tp, bool = __or_<is_void<_Tp>, __is_array_unknown_bounds<_Tp>, is_function<_Tp>>::value, bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value> struct __is_destructible_safe; template<typename _Tp> struct __is_destructible_safe<_Tp, false, false> : public __is_destructible_impl<typename remove_all_extents<_Tp>::type>::type { }; template<typename _Tp> struct __is_destructible_safe<_Tp, true, false> : public false_type { }; template<typename _Tp> struct __is_destructible_safe<_Tp, false, true> : public true_type { }; /// is_destructible template<typename _Tp> struct is_destructible : public integral_constant<bool, (__is_destructible_safe<_Tp>::value)> { }; // is_nothrow_destructible requires that is_destructible is // satisfied as well. We realize that by mimicing the // implementation of is_destructible but refer to noexcept(expr) // instead of decltype(expr). struct __do_is_nt_destructible_impl { template<typename _Tp> static integral_constant<bool, noexcept(declval<_Tp&>().~_Tp())> __test(int); template<typename> static false_type __test(...); }; template<typename _Tp> struct __is_nt_destructible_impl : public __do_is_nt_destructible_impl { typedef decltype(__test<_Tp>(0)) type; }; template<typename _Tp, bool = __or_<is_void<_Tp>, __is_array_unknown_bounds<_Tp>, is_function<_Tp>>::value, bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value> struct __is_nt_destructible_safe; template<typename _Tp> struct __is_nt_destructible_safe<_Tp, false, false> : public __is_nt_destructible_impl<typename remove_all_extents<_Tp>::type>::type { }; template<typename _Tp> struct __is_nt_destructible_safe<_Tp, true, false> : public false_type { }; template<typename _Tp> struct __is_nt_destructible_safe<_Tp, false, true> : public true_type { }; /// is_nothrow_destructible template<typename _Tp> struct is_nothrow_destructible : public integral_constant<bool, (__is_nt_destructible_safe<_Tp>::value)> { }; struct __do_is_default_constructible_impl { template<typename _Tp, typename = decltype(_Tp())> static true_type __test(int); template<typename> static false_type __test(...); }; template<typename _Tp> struct __is_default_constructible_impl : public __do_is_default_constructible_impl { typedef decltype(__test<_Tp>(0)) type; }; template<typename _Tp> struct __is_default_constructible_atom : public __and_<__not_<is_void<_Tp>>, __is_default_constructible_impl<_Tp>>::type { }; template<typename _Tp, bool = is_array<_Tp>::value> struct __is_default_constructible_safe; // The following technique is a workaround for a current core language // restriction, which does not allow for array types to occur in // functional casts of the form T(). Complete arrays can be default- // constructed, if the element type is default-constructible, but // arrays with unknown bounds are not. template<typename _Tp> struct __is_default_constructible_safe<_Tp, true> : public __and_<__is_array_known_bounds<_Tp>, __is_default_constructible_atom<typename remove_all_extents<_Tp>::type>>::type { }; template<typename _Tp> struct __is_default_constructible_safe<_Tp, false> : public __is_default_constructible_atom<_Tp>::type { }; /// is_default_constructible template<typename _Tp> struct is_default_constructible : public integral_constant<bool, (__is_default_constructible_safe< _Tp>::value)> { }; // Implementation of is_constructible. // The hardest part of this trait is the binary direct-initialization // case, because we hit into a functional cast of the form T(arg). // This implementation uses different strategies depending on the // target type to reduce the test overhead as much as possible: // // a) For a reference target type, we use a static_cast expression // modulo its extra cases. // // b) For a non-reference target type we use a ::new expression. struct __do_is_static_castable_impl { template<typename _From, typename _To, typename = decltype(static_cast<_To>(declval<_From>()))> static true_type __test(int); template<typename, typename> static false_type __test(...); }; template<typename _From, typename _To> struct __is_static_castable_impl : public __do_is_static_castable_impl { typedef decltype(__test<_From, _To>(0)) type; }; template<typename _From, typename _To> struct __is_static_castable_safe : public __is_static_castable_impl<_From, _To>::type { }; // __is_static_castable template<typename _From, typename _To> struct __is_static_castable : public integral_constant<bool, (__is_static_castable_safe< _From, _To>::value)> { }; // Implementation for non-reference types. To meet the proper // variable definition semantics, we also need to test for // is_destructible in this case. // This form should be simplified by a single expression: // ::delete ::new _Tp(declval<_Arg>()), see c++/51222. struct __do_is_direct_constructible_impl { template<typename _Tp, typename _Arg, typename = decltype(::new _Tp(declval<_Arg>()))> static true_type __test(int); template<typename, typename> static false_type __test(...); }; template<typename _Tp, typename _Arg> struct __is_direct_constructible_impl : public __do_is_direct_constructible_impl { typedef decltype(__test<_Tp, _Arg>(0)) type; }; template<typename _Tp, typename _Arg> struct __is_direct_constructible_new_safe : public __and_<is_destructible<_Tp>, __is_direct_constructible_impl<_Tp, _Arg>>::type { }; template<typename, typename> struct is_same; template<typename, typename> struct is_base_of; template<typename> struct remove_reference; template<typename _From, typename _To, bool = __not_<__or_<is_void<_From>, is_function<_From>>>::value> struct __is_base_to_derived_ref; // Detect whether we have a downcast situation during // reference binding. template<typename _From, typename _To> struct __is_base_to_derived_ref<_From, _To, true> { typedef typename remove_cv<typename remove_reference<_From >::type>::type __src_t; typedef typename remove_cv<typename remove_reference<_To >::type>::type __dst_t; typedef __and_<__not_<is_same<__src_t, __dst_t>>, is_base_of<__src_t, __dst_t>> type; static constexpr bool value = type::value; }; template<typename _From, typename _To> struct __is_base_to_derived_ref<_From, _To, false> : public false_type { }; template<typename _From, typename _To, bool = __and_<is_lvalue_reference<_From>, is_rvalue_reference<_To>>::value> struct __is_lvalue_to_rvalue_ref; // Detect whether we have an lvalue of non-function type // bound to a reference-compatible rvalue-reference. template<typename _From, typename _To> struct __is_lvalue_to_rvalue_ref<_From, _To, true> { typedef typename remove_cv<typename remove_reference< _From>::type>::type __src_t; typedef typename remove_cv<typename remove_reference< _To>::type>::type __dst_t; typedef __and_<__not_<is_function<__src_t>>, __or_<is_same<__src_t, __dst_t>, is_base_of<__dst_t, __src_t>>> type; static constexpr bool value = type::value; }; template<typename _From, typename _To> struct __is_lvalue_to_rvalue_ref<_From, _To, false> : public false_type { }; // Here we handle direct-initialization to a reference type as // equivalent to a static_cast modulo overshooting conversions. // These are restricted to the following conversions: // a) A base class value to a derived class reference // b) An lvalue to an rvalue-reference of reference-compatible // types that are not functions template<typename _Tp, typename _Arg> struct __is_direct_constructible_ref_cast : public __and_<__is_static_castable<_Arg, _Tp>, __not_<__or_<__is_base_to_derived_ref<_Arg, _Tp>, __is_lvalue_to_rvalue_ref<_Arg, _Tp> >>>::type { }; template<typename _Tp, typename _Arg> struct __is_direct_constructible_new : public conditional<is_reference<_Tp>::value, __is_direct_constructible_ref_cast<_Tp, _Arg>, __is_direct_constructible_new_safe<_Tp, _Arg> >::type { }; template<typename _Tp, typename _Arg> struct __is_direct_constructible : public integral_constant<bool, (__is_direct_constructible_new< _Tp, _Arg>::value)> { }; // Since default-construction and binary direct-initialization have // been handled separately, the implementation of the remaining // n-ary construction cases is rather straightforward. We can use // here a functional cast, because array types are excluded anyway // and this form is never interpreted as a C cast. struct __do_is_nary_constructible_impl { template<typename _Tp, typename... _Args, typename = decltype(_Tp(declval<_Args>()...))> static true_type __test(int); template<typename, typename...> static false_type __test(...); }; template<typename _Tp, typename... _Args> struct __is_nary_constructible_impl : public __do_is_nary_constructible_impl { typedef decltype(__test<_Tp, _Args...>(0)) type; }; template<typename _Tp, typename... _Args> struct __is_nary_constructible : public __is_nary_constructible_impl<_Tp, _Args...>::type { static_assert(sizeof...(_Args) > 1, "Only useful for > 1 arguments"); }; template<typename _Tp, typename... _Args> struct __is_constructible_impl : public __is_nary_constructible<_Tp, _Args...> { }; template<typename _Tp, typename _Arg> struct __is_constructible_impl<_Tp, _Arg> : public __is_direct_constructible<_Tp, _Arg> { }; template<typename _Tp> struct __is_constructible_impl<_Tp> : public is_default_constructible<_Tp> { }; /// is_constructible template<typename _Tp, typename... _Args> struct is_constructible : public integral_constant<bool, (__is_constructible_impl<_Tp, _Args...>::value)> { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_copy_constructible_impl; template<typename _Tp> struct __is_copy_constructible_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_copy_constructible_impl<_Tp, false> : public is_constructible<_Tp, const _Tp&> { }; /// is_copy_constructible template<typename _Tp> struct is_copy_constructible : public __is_copy_constructible_impl<_Tp> { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_move_constructible_impl; template<typename _Tp> struct __is_move_constructible_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_move_constructible_impl<_Tp, false> : public is_constructible<_Tp, _Tp&&> { }; /// is_move_constructible template<typename _Tp> struct is_move_constructible : public __is_move_constructible_impl<_Tp> { }; template<typename _Tp> struct __is_nt_default_constructible_atom : public integral_constant<bool, noexcept(_Tp())> { }; template<typename _Tp, bool = is_array<_Tp>::value> struct __is_nt_default_constructible_impl; template<typename _Tp> struct __is_nt_default_constructible_impl<_Tp, true> : public __and_<__is_array_known_bounds<_Tp>, __is_nt_default_constructible_atom<typename remove_all_extents<_Tp>::type>>::type { }; template<typename _Tp> struct __is_nt_default_constructible_impl<_Tp, false> : public __is_nt_default_constructible_atom<_Tp> { }; /// is_nothrow_default_constructible template<typename _Tp> struct is_nothrow_default_constructible : public __and_<is_default_constructible<_Tp>, __is_nt_default_constructible_impl<_Tp>>::type { }; template<typename _Tp, typename... _Args> struct __is_nt_constructible_impl : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))> { }; template<typename _Tp, typename _Arg> struct __is_nt_constructible_impl<_Tp, _Arg> : public integral_constant<bool, noexcept(static_cast<_Tp>(declval<_Arg>()))> { }; template<typename _Tp> struct __is_nt_constructible_impl<_Tp> : public is_nothrow_default_constructible<_Tp> { }; /// is_nothrow_constructible template<typename _Tp, typename... _Args> struct is_nothrow_constructible : public __and_<is_constructible<_Tp, _Args...>, __is_nt_constructible_impl<_Tp, _Args...>>::type { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_nothrow_copy_constructible_impl; template<typename _Tp> struct __is_nothrow_copy_constructible_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_nothrow_copy_constructible_impl<_Tp, false> : public is_nothrow_constructible<_Tp, const _Tp&> { }; /// is_nothrow_copy_constructible template<typename _Tp> struct is_nothrow_copy_constructible : public __is_nothrow_copy_constructible_impl<_Tp> { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_nothrow_move_constructible_impl; template<typename _Tp> struct __is_nothrow_move_constructible_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_nothrow_move_constructible_impl<_Tp, false> : public is_nothrow_constructible<_Tp, _Tp&&> { }; /// is_nothrow_move_constructible template<typename _Tp> struct is_nothrow_move_constructible : public __is_nothrow_move_constructible_impl<_Tp> { }; template<typename _Tp, typename _Up> class __is_assignable_helper : public __sfinae_types { template<typename _Tp1, typename _Up1> static decltype(declval<_Tp1>() = declval<_Up1>(), __one()) __test(int); template<typename, typename> static __two __test(...); public: static constexpr bool value = sizeof(__test<_Tp, _Up>(0)) == 1; }; /// is_assignable template<typename _Tp, typename _Up> struct is_assignable : public integral_constant<bool, __is_assignable_helper<_Tp, _Up>::value> { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_copy_assignable_impl; template<typename _Tp> struct __is_copy_assignable_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_copy_assignable_impl<_Tp, false> : public is_assignable<_Tp&, const _Tp&> { }; /// is_copy_assignable template<typename _Tp> struct is_copy_assignable : public __is_copy_assignable_impl<_Tp> { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_move_assignable_impl; template<typename _Tp> struct __is_move_assignable_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_move_assignable_impl<_Tp, false> : public is_assignable<_Tp&, _Tp&&> { }; /// is_move_assignable template<typename _Tp> struct is_move_assignable : public __is_move_assignable_impl<_Tp> { }; template<typename _Tp, typename _Up> struct __is_nt_assignable_impl : public integral_constant<bool, noexcept(declval<_Tp>() = declval<_Up>())> { }; /// is_nothrow_assignable template<typename _Tp, typename _Up> struct is_nothrow_assignable : public __and_<is_assignable<_Tp, _Up>, __is_nt_assignable_impl<_Tp, _Up>>::type { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_nt_copy_assignable_impl; template<typename _Tp> struct __is_nt_copy_assignable_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_nt_copy_assignable_impl<_Tp, false> : public is_nothrow_assignable<_Tp&, const _Tp&> { }; /// is_nothrow_copy_assignable template<typename _Tp> struct is_nothrow_copy_assignable : public __is_nt_copy_assignable_impl<_Tp> { }; template<typename _Tp, bool = is_void<_Tp>::value> struct __is_nt_move_assignable_impl; template<typename _Tp> struct __is_nt_move_assignable_impl<_Tp, true> : public false_type { }; template<typename _Tp> struct __is_nt_move_assignable_impl<_Tp, false> : public is_nothrow_assignable<_Tp&, _Tp&&> { }; /// is_nothrow_move_assignable template<typename _Tp> struct is_nothrow_move_assignable : public __is_nt_move_assignable_impl<_Tp> { }; /// is_trivially_constructible (still unimplemented) /// is_trivially_default_constructible (still unimplemented) /// is_trivially_copy_constructible (still unimplemented) /// is_trivially_move_constructible (still unimplemented) /// is_trivially_assignable (still unimplemented) /// is_trivially_copy_assignable (still unimplemented) /// is_trivially_move_assignable (still unimplemented) /// is_trivially_destructible template<typename _Tp> struct is_trivially_destructible : public __and_<is_destructible<_Tp>, integral_constant<bool, __has_trivial_destructor(_Tp)>>::type { }; /// has_trivial_default_constructor (temporary legacy) template<typename _Tp> struct has_trivial_default_constructor : public integral_constant<bool, __has_trivial_constructor(_Tp)> { }; /// has_trivial_copy_constructor (temporary legacy) template<typename _Tp> struct has_trivial_copy_constructor : public integral_constant<bool, __has_trivial_copy(_Tp)> { }; /// has_trivial_copy_assign (temporary legacy) template<typename _Tp> struct has_trivial_copy_assign : public integral_constant<bool, __has_trivial_assign(_Tp)> { }; /// has_virtual_destructor template<typename _Tp> struct has_virtual_destructor : public integral_constant<bool, __has_virtual_destructor(_Tp)> { }; // type property queries. /// alignment_of template<typename _Tp> struct alignment_of : public integral_constant<std::size_t, __alignof__(_Tp)> { }; /// rank template<typename> struct rank : public integral_constant<std::size_t, 0> { }; template<typename _Tp, std::size_t _Size> struct rank<_Tp[_Size]> : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; template<typename _Tp> struct rank<_Tp[]> : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; /// extent template<typename, unsigned _Uint> struct extent : public integral_constant<std::size_t, 0> { }; template<typename _Tp, unsigned _Uint, std::size_t _Size> struct extent<_Tp[_Size], _Uint> : public integral_constant<std::size_t, _Uint == 0 ? _Size : extent<_Tp, _Uint - 1>::value> { }; template<typename _Tp, unsigned _Uint> struct extent<_Tp[], _Uint> : public integral_constant<std::size_t, _Uint == 0 ? 0 : extent<_Tp, _Uint - 1>::value> { }; // Type relations. /// is_same template<typename, typename> struct is_same : public false_type { }; template<typename _Tp> struct is_same<_Tp, _Tp> : public true_type { }; /// is_base_of template<typename _Base, typename _Derived> struct is_base_of : public integral_constant<bool, __is_base_of(_Base, _Derived)> { }; template<typename _From, typename _To, bool = __or_<is_void<_From>, is_function<_To>, is_array<_To>>::value> struct __is_convertible_helper { static constexpr bool value = is_void<_To>::value; }; template<typename _From, typename _To> class __is_convertible_helper<_From, _To, false> : public __sfinae_types { template<typename _To1> static void __test_aux(_To1); template<typename _From1, typename _To1> static decltype(__test_aux<_To1>(std::declval<_From1>()), __one()) __test(int); template<typename, typename> static __two __test(...); public: static constexpr bool value = sizeof(__test<_From, _To>(0)) == 1; }; /// is_convertible template<typename _From, typename _To> struct is_convertible : public integral_constant<bool, __is_convertible_helper<_From, _To>::value> { }; // Const-volatile modifications. /// remove_const template<typename _Tp> struct remove_const { typedef _Tp type; }; template<typename _Tp> struct remove_const<_Tp const> { typedef _Tp type; }; /// remove_volatile template<typename _Tp> struct remove_volatile { typedef _Tp type; }; template<typename _Tp> struct remove_volatile<_Tp volatile> { typedef _Tp type; }; /// remove_cv template<typename _Tp> struct remove_cv { typedef typename remove_const<typename remove_volatile<_Tp>::type>::type type; }; /// add_const template<typename _Tp> struct add_const { typedef _Tp const type; }; /// add_volatile template<typename _Tp> struct add_volatile { typedef _Tp volatile type; }; /// add_cv template<typename _Tp> struct add_cv { typedef typename add_const<typename add_volatile<_Tp>::type>::type type; }; // Reference transformations. /// remove_reference template<typename _Tp> struct remove_reference { typedef _Tp type; }; template<typename _Tp> struct remove_reference<_Tp&> { typedef _Tp type; }; template<typename _Tp> struct remove_reference<_Tp&&> { typedef _Tp type; }; template<typename _Tp, bool = __and_<__not_<is_reference<_Tp>>, __not_<is_void<_Tp>>>::value, bool = is_rvalue_reference<_Tp>::value> struct __add_lvalue_reference_helper { typedef _Tp type; }; template<typename _Tp> struct __add_lvalue_reference_helper<_Tp, true, false> { typedef _Tp& type; }; template<typename _Tp> struct __add_lvalue_reference_helper<_Tp, false, true> { typedef typename remove_reference<_Tp>::type& type; }; /// add_lvalue_reference template<typename _Tp> struct add_lvalue_reference : public __add_lvalue_reference_helper<_Tp> { }; template<typename _Tp, bool = __and_<__not_<is_reference<_Tp>>, __not_<is_void<_Tp>>>::value> struct __add_rvalue_reference_helper { typedef _Tp type; }; template<typename _Tp> struct __add_rvalue_reference_helper<_Tp, true> { typedef _Tp&& type; }; /// add_rvalue_reference template<typename _Tp> struct add_rvalue_reference : public __add_rvalue_reference_helper<_Tp> { }; // Sign modifications. // Utility for constructing identically cv-qualified types. template<typename _Unqualified, bool _IsConst, bool _IsVol> struct __cv_selector; template<typename _Unqualified> struct __cv_selector<_Unqualified, false, false> { typedef _Unqualified __type; }; template<typename _Unqualified> struct __cv_selector<_Unqualified, false, true> { typedef volatile _Unqualified __type; }; template<typename _Unqualified> struct __cv_selector<_Unqualified, true, false> { typedef const _Unqualified __type; }; template<typename _Unqualified> struct __cv_selector<_Unqualified, true, true> { typedef const volatile _Unqualified __type; }; template<typename _Qualified, typename _Unqualified, bool _IsConst = is_const<_Qualified>::value, bool _IsVol = is_volatile<_Qualified>::value> class __match_cv_qualifiers { typedef __cv_selector<_Unqualified, _IsConst, _IsVol> __match; public: typedef typename __match::__type __type; }; // Utility for finding the unsigned versions of signed integral types. template<typename _Tp> struct __make_unsigned { typedef _Tp __type; }; template<> struct __make_unsigned<char> { typedef unsigned char __type; }; template<> struct __make_unsigned<signed char> { typedef unsigned char __type; }; template<> struct __make_unsigned<short> { typedef unsigned short __type; }; template<> struct __make_unsigned<int> { typedef unsigned int __type; }; template<> struct __make_unsigned<long> { typedef unsigned long __type; }; template<> struct __make_unsigned<long long> { typedef unsigned long long __type; }; #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128) template<> struct __make_unsigned<__int128> { typedef unsigned __int128 __type; }; #endif // Select between integral and enum: not possible to be both. template<typename _Tp, bool _IsInt = is_integral<_Tp>::value, bool _IsEnum = is_enum<_Tp>::value> class __make_unsigned_selector; template<typename _Tp> class __make_unsigned_selector<_Tp, true, false> { typedef __make_unsigned<typename remove_cv<_Tp>::type> __unsignedt; typedef typename __unsignedt::__type __unsigned_type; typedef __match_cv_qualifiers<_Tp, __unsigned_type> __cv_unsigned; public: typedef typename __cv_unsigned::__type __type; }; template<typename _Tp> class __make_unsigned_selector<_Tp, false, true> { // With -fshort-enums, an enum may be as small as a char. typedef unsigned char __smallest; static const bool __b0 = sizeof(_Tp) <= sizeof(__smallest); static const bool __b1 = sizeof(_Tp) <= sizeof(unsigned short); static const bool __b2 = sizeof(_Tp) <= sizeof(unsigned int); typedef conditional<__b2, unsigned int, unsigned long> __cond2; typedef typename __cond2::type __cond2_type; typedef conditional<__b1, unsigned short, __cond2_type> __cond1; typedef typename __cond1::type __cond1_type; public: typedef typename conditional<__b0, __smallest, __cond1_type>::type __type; }; // Given an integral/enum type, return the corresponding unsigned // integer type. // Primary template. /// make_unsigned template<typename _Tp> struct make_unsigned { typedef typename __make_unsigned_selector<_Tp>::__type type; }; // Integral, but don't define. template<> struct make_unsigned<bool>; // Utility for finding the signed versions of unsigned integral types. template<typename _Tp> struct __make_signed { typedef _Tp __type; }; template<> struct __make_signed<char> { typedef signed char __type; }; template<> struct __make_signed<unsigned char> { typedef signed char __type; }; template<> struct __make_signed<unsigned short> { typedef signed short __type; }; template<> struct __make_signed<unsigned int> { typedef signed int __type; }; template<> struct __make_signed<unsigned long> { typedef signed long __type; }; template<> struct __make_signed<unsigned long long> { typedef signed long long __type; }; #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128) template<> struct __make_signed<unsigned __int128> { typedef __int128 __type; }; #endif // Select between integral and enum: not possible to be both. template<typename _Tp, bool _IsInt = is_integral<_Tp>::value, bool _IsEnum = is_enum<_Tp>::value> class __make_signed_selector; template<typename _Tp> class __make_signed_selector<_Tp, true, false> { typedef __make_signed<typename remove_cv<_Tp>::type> __signedt; typedef typename __signedt::__type __signed_type; typedef __match_cv_qualifiers<_Tp, __signed_type> __cv_signed; public: typedef typename __cv_signed::__type __type; }; template<typename _Tp> class __make_signed_selector<_Tp, false, true> { // With -fshort-enums, an enum may be as small as a char. typedef signed char __smallest; static const bool __b0 = sizeof(_Tp) <= sizeof(__smallest); static const bool __b1 = sizeof(_Tp) <= sizeof(signed short); static const bool __b2 = sizeof(_Tp) <= sizeof(signed int); typedef conditional<__b2, signed int, signed long> __cond2; typedef typename __cond2::type __cond2_type; typedef conditional<__b1, signed short, __cond2_type> __cond1; typedef typename __cond1::type __cond1_type; public: typedef typename conditional<__b0, __smallest, __cond1_type>::type __type; }; // Given an integral/enum type, return the corresponding signed // integer type. // Primary template. /// make_signed template<typename _Tp> struct make_signed { typedef typename __make_signed_selector<_Tp>::__type type; }; // Integral, but don't define. template<> struct make_signed<bool>; // Array modifications. /// remove_extent template<typename _Tp> struct remove_extent { typedef _Tp type; }; template<typename _Tp, std::size_t _Size> struct remove_extent<_Tp[_Size]> { typedef _Tp type; }; template<typename _Tp> struct remove_extent<_Tp[]> { typedef _Tp type; }; /// remove_all_extents template<typename _Tp> struct remove_all_extents { typedef _Tp type; }; template<typename _Tp, std::size_t _Size> struct remove_all_extents<_Tp[_Size]> { typedef typename remove_all_extents<_Tp>::type type; }; template<typename _Tp> struct remove_all_extents<_Tp[]> { typedef typename remove_all_extents<_Tp>::type type; }; // Pointer modifications. template<typename _Tp, typename> struct __remove_pointer_helper { typedef _Tp type; }; template<typename _Tp, typename _Up> struct __remove_pointer_helper<_Tp, _Up*> { typedef _Up type; }; /// remove_pointer template<typename _Tp> struct remove_pointer : public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type> { }; /// add_pointer template<typename _Tp> struct add_pointer { typedef typename remove_reference<_Tp>::type* type; }; template<std::size_t _Len> struct __aligned_storage_msa { union __type { unsigned char __data[_Len]; struct __attribute__((__aligned__)) { } __align; }; }; /** * @brief Alignment type. * * The value of _Align is a default-alignment which shall be the * most stringent alignment requirement for any C++ object type * whose size is no greater than _Len (3.9). The member typedef * type shall be a POD type suitable for use as uninitialized * storage for any object whose size is at most _Len and whose * alignment is a divisor of _Align. */ template<std::size_t _Len, std::size_t _Align = __alignof__(typename __aligned_storage_msa<_Len>::__type)> struct aligned_storage { union type { unsigned char __data[_Len]; struct __attribute__((__aligned__((_Align)))) { } __align; }; }; // Decay trait for arrays and functions, used for perfect forwarding // in make_pair, make_tuple, etc. template<typename _Up, bool _IsArray = is_array<_Up>::value, bool _IsFunction = is_function<_Up>::value> struct __decay_selector; // NB: DR 705. template<typename _Up> struct __decay_selector<_Up, false, false> { typedef typename remove_cv<_Up>::type __type; }; template<typename _Up> struct __decay_selector<_Up, true, false> { typedef typename remove_extent<_Up>::type* __type; }; template<typename _Up> struct __decay_selector<_Up, false, true> { typedef typename add_pointer<_Up>::type __type; }; /// decay template<typename _Tp> class decay { typedef typename remove_reference<_Tp>::type __remove_type; public: typedef typename __decay_selector<__remove_type>::__type type; }; template<typename _Tp> class reference_wrapper; // Helper which adds a reference to a type when given a reference_wrapper template<typename _Tp> struct __strip_reference_wrapper { typedef _Tp __type; }; template<typename _Tp> struct __strip_reference_wrapper<reference_wrapper<_Tp> > { typedef _Tp& __type; }; template<typename _Tp> struct __strip_reference_wrapper<const reference_wrapper<_Tp> > { typedef _Tp& __type; }; template<typename _Tp> struct __decay_and_strip { typedef typename __strip_reference_wrapper< typename decay<_Tp>::type>::__type __type; }; // Primary template. /// Define a member typedef @c type only if a boolean constant is true. template<bool, typename _Tp = void> struct enable_if { }; // Partial specialization for true. template<typename _Tp> struct enable_if<true, _Tp> { typedef _Tp type; }; template<typename... _Cond> using _Require = typename enable_if<__and_<_Cond...>::value>::type; // Primary template. /// Define a member typedef @c type to one of two argument types. template<bool _Cond, typename _Iftrue, typename _Iffalse> struct conditional { typedef _Iftrue type; }; // Partial specialization for false. template<typename _Iftrue, typename _Iffalse> struct conditional<false, _Iftrue, _Iffalse> { typedef _Iffalse type; }; /// common_type template<typename... _Tp> struct common_type; // Sfinae-friendly common_type implementation: struct __do_common_type_impl { template<typename _Tp, typename _Up> static __success_type<typename decay<decltype (true ? std::declval<_Tp>() : std::declval<_Up>())>::type> _S_test(int); template<typename, typename> static __failure_type _S_test(...); }; template<typename _Tp, typename _Up> struct __common_type_impl : private __do_common_type_impl { typedef decltype(_S_test<_Tp, _Up>(0)) type; }; struct __do_member_type_wrapper { template<typename _Tp> static __success_type<typename _Tp::type> _S_test(int); template<typename> static __failure_type _S_test(...); }; template<typename _Tp> struct __member_type_wrapper : private __do_member_type_wrapper { typedef decltype(_S_test<_Tp>(0)) type; }; template<typename _CTp, typename... _Args> struct __expanded_common_type_wrapper { typedef common_type<typename _CTp::type, _Args...> type; }; template<typename... _Args> struct __expanded_common_type_wrapper<__failure_type, _Args...> { typedef __failure_type type; }; template<typename _Tp> struct common_type<_Tp> { typedef typename decay<_Tp>::type type; }; template<typename _Tp, typename _Up> struct common_type<_Tp, _Up> : public __common_type_impl<_Tp, _Up>::type { }; template<typename _Tp, typename _Up, typename... _Vp> struct common_type<_Tp, _Up, _Vp...> : public __expanded_common_type_wrapper<typename __member_type_wrapper< common_type<_Tp, _Up>>::type, _Vp...>::type { }; /// The underlying type of an enum. template<typename _Tp> struct underlying_type { typedef __underlying_type(_Tp) type; }; template<typename _Tp> struct __declval_protector { static const bool __stop = false; static typename add_rvalue_reference<_Tp>::type __delegate(); }; template<typename _Tp> inline typename add_rvalue_reference<_Tp>::type declval() noexcept { static_assert(__declval_protector<_Tp>::__stop, "declval() must not be used!"); return __declval_protector<_Tp>::__delegate(); } /// result_of template<typename _Signature> class result_of; // Sfinae-friendly result_of implementation: // [func.require] paragraph 1 bullet 1: struct __result_of_memfun_ref_impl { template<typename _Fp, typename _Tp1, typename... _Args> static __success_type<decltype( (std::declval<_Tp1>().*std::declval<_Fp>())(std::declval<_Args>()...) )> _S_test(int); template<typename...> static __failure_type _S_test(...); }; template<typename _MemPtr, typename _Arg, typename... _Args> struct __result_of_memfun_ref : private __result_of_memfun_ref_impl { typedef decltype(_S_test<_MemPtr, _Arg, _Args...>(0)) type; }; // [func.require] paragraph 1 bullet 2: struct __result_of_memfun_deref_impl { template<typename _Fp, typename _Tp1, typename... _Args> static __success_type<decltype( ((*std::declval<_Tp1>()).*std::declval<_Fp>())(std::declval<_Args>()...) )> _S_test(int); template<typename...> static __failure_type _S_test(...); }; template<typename _MemPtr, typename _Arg, typename... _Args> struct __result_of_memfun_deref : private __result_of_memfun_deref_impl { typedef decltype(_S_test<_MemPtr, _Arg, _Args...>(0)) type; }; // [func.require] paragraph 1 bullet 3: struct __result_of_memobj_ref_impl { template<typename _Fp, typename _Tp1> static __success_type<decltype( std::declval<_Tp1>().*std::declval<_Fp>() )> _S_test(int); template<typename, typename> static __failure_type _S_test(...); }; template<typename _MemPtr, typename _Arg> struct __result_of_memobj_ref : private __result_of_memobj_ref_impl { typedef decltype(_S_test<_MemPtr, _Arg>(0)) type; }; // [func.require] paragraph 1 bullet 4: struct __result_of_memobj_deref_impl { template<typename _Fp, typename _Tp1> static __success_type<decltype( (*std::declval<_Tp1>()).*std::declval<_Fp>() )> _S_test(int); template<typename, typename> static __failure_type _S_test(...); }; template<typename _MemPtr, typename _Arg> struct __result_of_memobj_deref : private __result_of_memobj_deref_impl { typedef decltype(_S_test<_MemPtr, _Arg>(0)) type; }; template<typename _MemPtr, typename _Arg> struct __result_of_memobj; template<typename _Res, typename _Class, typename _Arg> struct __result_of_memobj<_Res _Class::*, _Arg> { typedef typename remove_cv<typename remove_reference< _Arg>::type>::type _Argval; typedef _Res _Class::* _MemPtr; typedef typename conditional<__or_<is_same<_Argval, _Class>, is_base_of<_Class, _Argval>>::value, __result_of_memobj_ref<_MemPtr, _Arg>, __result_of_memobj_deref<_MemPtr, _Arg> >::type::type type; }; template<typename _MemPtr, typename _Arg, typename... _Args> struct __result_of_memfun; template<typename _Res, typename _Class, typename _Arg, typename... _Args> struct __result_of_memfun<_Res _Class::*, _Arg, _Args...> { typedef typename remove_cv<typename remove_reference< _Arg>::type>::type _Argval; typedef _Res _Class::* _MemPtr; typedef typename conditional<__or_<is_same<_Argval, _Class>, is_base_of<_Class, _Argval>>::value, __result_of_memfun_ref<_MemPtr, _Arg, _Args...>, __result_of_memfun_deref<_MemPtr, _Arg, _Args...> >::type::type type; }; template<bool, bool, typename _Functor, typename... _ArgTypes> struct __result_of_impl { typedef __failure_type type; }; template<typename _MemPtr, typename _Arg> struct __result_of_impl<true, false, _MemPtr, _Arg> : public __result_of_memobj<typename decay<_MemPtr>::type, _Arg> { }; template<typename _MemPtr, typename _Arg, typename... _Args> struct __result_of_impl<false, true, _MemPtr, _Arg, _Args...> : public __result_of_memfun<typename decay<_MemPtr>::type, _Arg, _Args...> { }; // [func.require] paragraph 1 bullet 5: struct __result_of_other_impl { template<typename _Fn, typename... _Args> static __success_type<decltype( std::declval<_Fn>()(std::declval<_Args>()...) )> _S_test(int); template<typename...> static __failure_type _S_test(...); }; template<typename _Functor, typename... _ArgTypes> struct __result_of_impl<false, false, _Functor, _ArgTypes...> : private __result_of_other_impl { typedef decltype(_S_test<_Functor, _ArgTypes...>(0)) type; }; template<typename _Functor, typename... _ArgTypes> struct result_of<_Functor(_ArgTypes...)> : public __result_of_impl< is_member_object_pointer< typename remove_reference<_Functor>::type >::value, is_member_function_pointer< typename remove_reference<_Functor>::type >::value, _Functor, _ArgTypes... >::type { }; /// @} group metaprogramming /** * Use SFINAE to determine if the type _Tp has a publicly-accessible * member type _NTYPE. */ #define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) \ template<typename _Tp> \ class __has_##_NTYPE##_helper \ : __sfinae_types \ { \ template<typename _Up> \ struct _Wrap_type \ { }; \ \ template<typename _Up> \ static __one __test(_Wrap_type<typename _Up::_NTYPE>*); \ \ template<typename _Up> \ static __two __test(...); \ \ public: \ static constexpr bool value = sizeof(__test<_Tp>(0)) == 1; \ }; \ \ template<typename _Tp> \ struct __has_##_NTYPE \ : integral_constant<bool, __has_##_NTYPE##_helper \ <typename remove_cv<_Tp>::type>::value> \ { }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif // C++11 #endif // _GLIBCXX_TYPE_TRAITS �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/ctgmath�����������������������������������������������������������������������������������0000644�����������������00000002452�14763166030�0007150 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <ctgmath> -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/ctgmath * This is a Standard C++ Library header. */ #pragma GCC system_header #ifndef _GLIBCXX_CTGMATH #define _GLIBCXX_CTGMATH 1 #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else # include <cmath> #endif #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/iosfwd������������������������������������������������������������������������������������0000644�����������������00000015302�14763166030�0007012 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <iosfwd> Forward declarations -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/iosfwd * This is a Standard C++ Library header. */ // // ISO C++ 14882: 27.2 Forward declarations // #ifndef _GLIBCXX_IOSFWD #define _GLIBCXX_IOSFWD 1 #pragma GCC system_header #include <bits/c++config.h> #include <bits/stringfwd.h> // For string forward declarations. #include <bits/postypes.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup io I/O * * Nearly all of the I/O classes are parameterized on the type of * characters they read and write. (The major exception is ios_base at * the top of the hierarchy.) This is a change from pre-Standard * streams, which were not templates. * * For ease of use and compatibility, all of the basic_* I/O-related * classes are given typedef names for both of the builtin character * widths (wide and narrow). The typedefs are the same as the * pre-Standard names, for example: * * @code * typedef basic_ifstream<char> ifstream; * @endcode * * Because properly forward-declaring these classes can be difficult, you * should not do it yourself. Instead, include the <iosfwd> * header, which contains only declarations of all the I/O classes as * well as the typedefs. Trying to forward-declare the typedefs * themselves (e.g., <code>class ostream;</code>) is not valid ISO C++. * * For more specific declarations, see * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch24.html * * @{ */ class ios_base; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_ios; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_streambuf; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_istream; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_ostream; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_iostream; template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > class basic_stringbuf; template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > class basic_istringstream; template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > class basic_ostringstream; template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > class basic_stringstream; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_filebuf; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_ifstream; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_ofstream; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_fstream; template<typename _CharT, typename _Traits = char_traits<_CharT> > class istreambuf_iterator; template<typename _CharT, typename _Traits = char_traits<_CharT> > class ostreambuf_iterator; /// Base class for @c char streams. typedef basic_ios<char> ios; /// Base class for @c char buffers. typedef basic_streambuf<char> streambuf; /// Base class for @c char input streams. typedef basic_istream<char> istream; /// Base class for @c char output streams. typedef basic_ostream<char> ostream; /// Base class for @c char mixed input and output streams. typedef basic_iostream<char> iostream; /// Class for @c char memory buffers. typedef basic_stringbuf<char> stringbuf; /// Class for @c char input memory streams. typedef basic_istringstream<char> istringstream; /// Class for @c char output memory streams. typedef basic_ostringstream<char> ostringstream; /// Class for @c char mixed input and output memory streams. typedef basic_stringstream<char> stringstream; /// Class for @c char file buffers. typedef basic_filebuf<char> filebuf; /// Class for @c char input file streams. typedef basic_ifstream<char> ifstream; /// Class for @c char output file streams. typedef basic_ofstream<char> ofstream; /// Class for @c char mixed input and output file streams. typedef basic_fstream<char> fstream; #ifdef _GLIBCXX_USE_WCHAR_T /// Base class for @c wchar_t streams. typedef basic_ios<wchar_t> wios; /// Base class for @c wchar_t buffers. typedef basic_streambuf<wchar_t> wstreambuf; /// Base class for @c wchar_t input streams. typedef basic_istream<wchar_t> wistream; /// Base class for @c wchar_t output streams. typedef basic_ostream<wchar_t> wostream; /// Base class for @c wchar_t mixed input and output streams. typedef basic_iostream<wchar_t> wiostream; /// Class for @c wchar_t memory buffers. typedef basic_stringbuf<wchar_t> wstringbuf; /// Class for @c wchar_t input memory streams. typedef basic_istringstream<wchar_t> wistringstream; /// Class for @c wchar_t output memory streams. typedef basic_ostringstream<wchar_t> wostringstream; /// Class for @c wchar_t mixed input and output memory streams. typedef basic_stringstream<wchar_t> wstringstream; /// Class for @c wchar_t file buffers. typedef basic_filebuf<wchar_t> wfilebuf; /// Class for @c wchar_t input file streams. typedef basic_ifstream<wchar_t> wifstream; /// Class for @c wchar_t output file streams. typedef basic_ofstream<wchar_t> wofstream; /// Class for @c wchar_t mixed input and output file streams. typedef basic_fstream<wchar_t> wfstream; #endif /** @} */ _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _GLIBCXX_IOSFWD */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/condition_variable������������������������������������������������������������������������0000644�����������������00000017470�14763166030�0011362 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <condition_variable> -*- C++ -*- // Copyright (C) 2008-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/condition_variable * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_CONDITION_VARIABLE #define _GLIBCXX_CONDITION_VARIABLE 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <chrono> #include <mutex> // unique_lock #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup condition_variables Condition Variables * @ingroup concurrency * * Classes for condition_variable support. * @{ */ /// cv_status enum class cv_status { no_timeout, timeout }; /// condition_variable class condition_variable { typedef chrono::system_clock __clock_t; typedef __gthread_cond_t __native_type; #ifdef __GTHREAD_COND_INIT __native_type _M_cond = __GTHREAD_COND_INIT; #else __native_type _M_cond; #endif public: typedef __native_type* native_handle_type; condition_variable() noexcept; ~condition_variable() noexcept; condition_variable(const condition_variable&) = delete; condition_variable& operator=(const condition_variable&) = delete; void notify_one() noexcept; void notify_all() noexcept; void wait(unique_lock<mutex>& __lock); template<typename _Predicate> void wait(unique_lock<mutex>& __lock, _Predicate __p) { while (!__p()) wait(__lock); } template<typename _Duration> cv_status wait_until(unique_lock<mutex>& __lock, const chrono::time_point<__clock_t, _Duration>& __atime) { return __wait_until_impl(__lock, __atime); } template<typename _Clock, typename _Duration> cv_status wait_until(unique_lock<mutex>& __lock, const chrono::time_point<_Clock, _Duration>& __atime) { // DR 887 - Sync unknown clock to known clock. const typename _Clock::time_point __c_entry = _Clock::now(); const __clock_t::time_point __s_entry = __clock_t::now(); const auto __delta = __atime - __c_entry; const auto __s_atime = __s_entry + __delta; return __wait_until_impl(__lock, __s_atime); } template<typename _Clock, typename _Duration, typename _Predicate> bool wait_until(unique_lock<mutex>& __lock, const chrono::time_point<_Clock, _Duration>& __atime, _Predicate __p) { while (!__p()) if (wait_until(__lock, __atime) == cv_status::timeout) return __p(); return true; } template<typename _Rep, typename _Period> cv_status wait_for(unique_lock<mutex>& __lock, const chrono::duration<_Rep, _Period>& __rtime) { return wait_until(__lock, __clock_t::now() + __rtime); } template<typename _Rep, typename _Period, typename _Predicate> bool wait_for(unique_lock<mutex>& __lock, const chrono::duration<_Rep, _Period>& __rtime, _Predicate __p) { return wait_until(__lock, __clock_t::now() + __rtime, std::move(__p)); } native_handle_type native_handle() { return &_M_cond; } private: template<typename _Dur> cv_status __wait_until_impl(unique_lock<mutex>& __lock, const chrono::time_point<__clock_t, _Dur>& __atime) { auto __s = chrono::time_point_cast<chrono::seconds>(__atime); auto __ns = chrono::duration_cast<chrono::nanoseconds>(__atime - __s); __gthread_time_t __ts = { static_cast<std::time_t>(__s.time_since_epoch().count()), static_cast<long>(__ns.count()) }; __gthread_cond_timedwait(&_M_cond, __lock.mutex()->native_handle(), &__ts); return (__clock_t::now() < __atime ? cv_status::no_timeout : cv_status::timeout); } }; /// condition_variable_any // Like above, but mutex is not required to have try_lock. class condition_variable_any { typedef chrono::system_clock __clock_t; condition_variable _M_cond; mutex _M_mutex; // scoped unlock - unlocks in ctor, re-locks in dtor template<typename _Lock> struct _Unlock { explicit _Unlock(_Lock& __lk) : _M_lock(__lk) { __lk.unlock(); } ~_Unlock() noexcept(false) { if (uncaught_exception()) __try { _M_lock.lock(); } __catch(...) { } else _M_lock.lock(); } _Unlock(const _Unlock&) = delete; _Unlock& operator=(const _Unlock&) = delete; _Lock& _M_lock; }; public: condition_variable_any() noexcept; ~condition_variable_any() noexcept; condition_variable_any(const condition_variable_any&) = delete; condition_variable_any& operator=(const condition_variable_any&) = delete; void notify_one() noexcept { lock_guard<mutex> __lock(_M_mutex); _M_cond.notify_one(); } void notify_all() noexcept { lock_guard<mutex> __lock(_M_mutex); _M_cond.notify_all(); } template<typename _Lock> void wait(_Lock& __lock) { unique_lock<mutex> __my_lock(_M_mutex); _Unlock<_Lock> __unlock(__lock); // _M_mutex must be unlocked before re-locking __lock so move // ownership of _M_mutex lock to an object with shorter lifetime. unique_lock<mutex> __my_lock2(std::move(__my_lock)); _M_cond.wait(__my_lock2); } template<typename _Lock, typename _Predicate> void wait(_Lock& __lock, _Predicate __p) { while (!__p()) wait(__lock); } template<typename _Lock, typename _Clock, typename _Duration> cv_status wait_until(_Lock& __lock, const chrono::time_point<_Clock, _Duration>& __atime) { unique_lock<mutex> __my_lock(_M_mutex); _Unlock<_Lock> __unlock(__lock); // _M_mutex must be unlocked before re-locking __lock so move // ownership of _M_mutex lock to an object with shorter lifetime. unique_lock<mutex> __my_lock2(std::move(__my_lock)); return _M_cond.wait_until(__my_lock2, __atime); } template<typename _Lock, typename _Clock, typename _Duration, typename _Predicate> bool wait_until(_Lock& __lock, const chrono::time_point<_Clock, _Duration>& __atime, _Predicate __p) { while (!__p()) if (wait_until(__lock, __atime) == cv_status::timeout) return __p(); return true; } template<typename _Lock, typename _Rep, typename _Period> cv_status wait_for(_Lock& __lock, const chrono::duration<_Rep, _Period>& __rtime) { return wait_until(__lock, __clock_t::now() + __rtime); } template<typename _Lock, typename _Rep, typename _Period, typename _Predicate> bool wait_for(_Lock& __lock, const chrono::duration<_Rep, _Period>& __rtime, _Predicate __p) { return wait_until(__lock, __clock_t::now() + __rtime, std::move(__p)); } }; // @} group condition_variables _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1 #endif // C++11 #endif // _GLIBCXX_CONDITION_VARIABLE ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/cwctype�����������������������������������������������������������������������������������0000644�����������������00000005351�14763166030�0007200 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- forwarding header. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/cwctype * This is a Standard C++ Library file. You should @c \#include this file * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c wctype.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std (except for names which are defined * as macros in C). */ // // ISO C++ 14882: <cwctype> // #pragma GCC system_header #include <bits/c++config.h> #if _GLIBCXX_HAVE_WCTYPE_H #if __GLIBC__ == 2 && __GLIBC_MINOR__ < 10 // Work around glibc BZ 9694 #include <stddef.h> #endif #include <wctype.h> #endif // _GLIBCXX_HAVE_WCTYPE_H #ifndef _GLIBCXX_CWCTYPE #define _GLIBCXX_CWCTYPE 1 // Get rid of those macros defined in <wctype.h> in lieu of real functions. #undef iswalnum #undef iswalpha #if _GLIBCXX_HAVE_ISWBLANK # undef iswblank #endif #undef iswcntrl #undef iswctype #undef iswdigit #undef iswgraph #undef iswlower #undef iswprint #undef iswpunct #undef iswspace #undef iswupper #undef iswxdigit #undef towctrans #undef towlower #undef towupper #undef wctrans #undef wctype #if _GLIBCXX_USE_WCHAR_T namespace std { using ::wctrans_t; using ::wctype_t; using ::wint_t; using ::iswalnum; using ::iswalpha; #if _GLIBCXX_HAVE_ISWBLANK using ::iswblank; #endif using ::iswcntrl; using ::iswctype; using ::iswdigit; using ::iswgraph; using ::iswlower; using ::iswprint; using ::iswpunct; using ::iswspace; using ::iswupper; using ::iswxdigit; using ::towctrans; using ::towlower; using ::towupper; using ::wctrans; using ::wctype; } // namespace #endif //_GLIBCXX_USE_WCHAR_T #endif // _GLIBCXX_CWCTYPE ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/queue�������������������������������������������������������������������������������������0000644�����������������00000004643�14763166030�0006651 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <queue> -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file include/queue * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_QUEUE #define _GLIBCXX_QUEUE 1 #pragma GCC system_header #include <deque> #include <vector> #include <bits/stl_heap.h> #include <bits/stl_function.h> #include <bits/stl_queue.h> #endif /* _GLIBCXX_QUEUE */ ���������������������������������������������������������������������������������������������c++/4.8.2/ios���������������������������������������������������������������������������������������0000644�����������������00000003102�14763166030�0006304 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Iostreams base classes -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/ios * This is a Standard C++ Library header. */ // // ISO C++ 14882: 27.4 Iostreams base classes // #ifndef _GLIBCXX_IOS #define _GLIBCXX_IOS 1 #pragma GCC system_header #include <iosfwd> #include <exception> // For ios_base::failure #include <bits/char_traits.h> // For char_traits, streamoff, streamsize, fpos #include <bits/localefwd.h> // For class locale #include <bits/ios_base.h> // For ios_base declarations. #include <streambuf> #include <bits/basic_ios.h> #endif /* _GLIBCXX_IOS */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/cctype������������������������������������������������������������������������������������0000644�����������������00000004551�14763166030�0007012 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- forwarding header. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/cctype * This is a Standard C++ Library file. You should @c \#include this file * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c ctype.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std (except for names which are defined * as macros in C). */ // // ISO C++ 14882: <ccytpe> // #pragma GCC system_header #include <bits/c++config.h> #include <ctype.h> #ifndef _GLIBCXX_CCTYPE #define _GLIBCXX_CCTYPE 1 // Get rid of those macros defined in <ctype.h> in lieu of real functions. #undef isalnum #undef isalpha #undef iscntrl #undef isdigit #undef isgraph #undef islower #undef isprint #undef ispunct #undef isspace #undef isupper #undef isxdigit #undef tolower #undef toupper namespace std { using ::isalnum; using ::isalpha; using ::iscntrl; using ::isdigit; using ::isgraph; using ::islower; using ::isprint; using ::ispunct; using ::isspace; using ::isupper; using ::isxdigit; using ::tolower; using ::toupper; } // namespace std #if __cplusplus >= 201103L #ifdef _GLIBCXX_USE_C99_CTYPE_TR1 #undef isblank namespace std { using ::isblank; } // namespace std #endif // _GLIBCXX_USE_C99_CTYPE_TR1 #endif // C++11 #endif �������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/cstdlib�����������������������������������������������������������������������������������0000644�����������������00000014015�14763166030�0007143 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- forwarding header. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/cstdlib * This is a Standard C++ Library file. You should @c \#include this file * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c stdlib.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std (except for names which are defined * as macros in C). */ // // ISO C++ 14882: 20.4.6 C library // #pragma GCC system_header #include <bits/c++config.h> #ifndef _GLIBCXX_CSTDLIB #define _GLIBCXX_CSTDLIB 1 #if !_GLIBCXX_HOSTED // The C standard does not require a freestanding implementation to // provide <stdlib.h>. However, the C++ standard does still require // <cstdlib> -- but only the functionality mentioned in // [lib.support.start.term]. #define EXIT_SUCCESS 0 #define EXIT_FAILURE 1 namespace std { extern "C" void abort(void) throw () _GLIBCXX_NORETURN; extern "C" int atexit(void (*)()) throw (); extern "C" void exit(int) throw () _GLIBCXX_NORETURN; #if __cplusplus >= 201103L # ifdef _GLIBCXX_HAVE_AT_QUICK_EXIT extern "C" int at_quick_exit(void (*)()) throw (); # endif # ifdef _GLIBCXX_HAVE_QUICK_EXIT extern "C" void quick_exit(int) throw() _GLIBCXX_NORETURN; # endif #endif } // namespace std #else #include <stdlib.h> // Get rid of those macros defined in <stdlib.h> in lieu of real functions. #undef abort #undef abs #undef atexit #if __cplusplus >= 201103L # ifdef _GLIBCXX_HAVE_AT_QUICK_EXIT # undef at_quick_exit # endif #endif #undef atof #undef atoi #undef atol #undef bsearch #undef calloc #undef div #undef exit #undef free #undef getenv #undef labs #undef ldiv #undef malloc #undef mblen #undef mbstowcs #undef mbtowc #undef qsort #if __cplusplus >= 201103L # ifdef _GLIBCXX_HAVE_QUICK_EXIT # undef quick_exit # endif #endif #undef rand #undef realloc #undef srand #undef strtod #undef strtol #undef strtoul #undef system #undef wcstombs #undef wctomb namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION using ::div_t; using ::ldiv_t; using ::abort; using ::abs; using ::atexit; #if __cplusplus >= 201103L # ifdef _GLIBCXX_HAVE_AT_QUICK_EXIT using ::at_quick_exit; # endif #endif using ::atof; using ::atoi; using ::atol; using ::bsearch; using ::calloc; using ::div; using ::exit; using ::free; using ::getenv; using ::labs; using ::ldiv; using ::malloc; #ifdef _GLIBCXX_HAVE_MBSTATE_T using ::mblen; using ::mbstowcs; using ::mbtowc; #endif // _GLIBCXX_HAVE_MBSTATE_T using ::qsort; #if __cplusplus >= 201103L # ifdef _GLIBCXX_HAVE_QUICK_EXIT using ::quick_exit; # endif #endif using ::rand; using ::realloc; using ::srand; using ::strtod; using ::strtol; using ::strtoul; using ::system; #ifdef _GLIBCXX_USE_WCHAR_T using ::wcstombs; using ::wctomb; #endif // _GLIBCXX_USE_WCHAR_T #ifndef __CORRECT_ISO_CPP_STDLIB_H_PROTO inline long abs(long __i) { return __builtin_labs(__i); } inline ldiv_t div(long __i, long __j) { return ldiv(__i, __j); } #endif #ifdef _GLIBCXX_USE_LONG_LONG inline long long abs(long long __x) { return __builtin_llabs (__x); } #endif #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128) inline __int128 abs(__int128 __x) { return __x >= 0 ? __x : -__x; } #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #if _GLIBCXX_USE_C99 #undef _Exit #undef llabs #undef lldiv #undef atoll #undef strtoll #undef strtoull #undef strtof #undef strtold namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC using ::lldiv_t; #endif #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC extern "C" void (_Exit)(int) throw () _GLIBCXX_NORETURN; #endif #if !_GLIBCXX_USE_C99_DYNAMIC using ::_Exit; #endif #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC using ::llabs; inline lldiv_t div(long long __n, long long __d) { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; } using ::lldiv; #endif #if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC extern "C" long long int (atoll)(const char *) throw (); extern "C" long long int (strtoll)(const char * __restrict, char ** __restrict, int) throw (); extern "C" unsigned long long int (strtoull)(const char * __restrict, char ** __restrict, int) throw (); #endif #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC using ::atoll; using ::strtoll; using ::strtoull; #endif using ::strtof; using ::strtold; _GLIBCXX_END_NAMESPACE_VERSION } // namespace __gnu_cxx namespace std { #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC using ::__gnu_cxx::lldiv_t; #endif using ::__gnu_cxx::_Exit; #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC using ::__gnu_cxx::llabs; using ::__gnu_cxx::div; using ::__gnu_cxx::lldiv; #endif using ::__gnu_cxx::atoll; using ::__gnu_cxx::strtof; using ::__gnu_cxx::strtoll; using ::__gnu_cxx::strtoull; using ::__gnu_cxx::strtold; } // namespace std #endif // _GLIBCXX_USE_C99 #endif // !_GLIBCXX_HOSTED #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/cfloat������������������������������������������������������������������������������������0000644�����������������00000003505�14763166030�0006771 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- forwarding header. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/cfloat * This is a Standard C++ Library file. You should @c \#include this file * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c float.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std (except for names which are defined * as macros in C). */ // // ISO C++ 14882: 18.2.2 Implementation properties: C library // #pragma GCC system_header #include <float.h> #ifndef _GLIBCXX_CFLOAT #define _GLIBCXX_CFLOAT 1 #if __cplusplus >= 201103L # ifndef DECIMAL_DIG # define DECIMAL_DIG __DECIMAL_DIG__ # endif # ifndef FLT_EVAL_METHOD # define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ # endif #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/map���������������������������������������������������������������������������������������0000644�����������������00000004777�14763166030�0006312 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <map> -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file include/map * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_MAP #define _GLIBCXX_MAP 1 #pragma GCC system_header #include <bits/stl_tree.h> #include <bits/stl_map.h> #include <bits/stl_multimap.h> #include <bits/range_access.h> #ifdef _GLIBCXX_DEBUG # include <debug/map> #endif #ifdef _GLIBCXX_PROFILE # include <profile/map> #endif #endif /* _GLIBCXX_MAP */ �c++/4.8.2/csignal�����������������������������������������������������������������������������������0000644�����������������00000003477�14763166030�0007151 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- forwarding header. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file csignal * This is a Standard C++ Library file. You should @c \#include this file * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c signal.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std (except for names which are defined * as macros in C). */ // // ISO C++ 14882: 20.4.6 C library // #pragma GCC system_header #include <bits/c++config.h> #include <signal.h> #ifndef _GLIBCXX_CSIGNAL #define _GLIBCXX_CSIGNAL 1 // Get rid of those macros defined in <signal.h> in lieu of real functions. #undef raise namespace std { using ::sig_atomic_t; using ::signal; using ::raise; } // namespace std #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/system_error������������������������������������������������������������������������������0000644�����������������00000024154�14763166030�0010261 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <system_error> -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/system_error * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_SYSTEM_ERROR #define _GLIBCXX_SYSTEM_ERROR 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <bits/c++config.h> #include <bits/error_constants.h> #include <iosfwd> #include <stdexcept> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION class error_code; class error_condition; class error_category; class system_error; /// is_error_code_enum template<typename _Tp> struct is_error_code_enum : public false_type { }; /// is_error_condition_enum template<typename _Tp> struct is_error_condition_enum : public false_type { }; template<> struct is_error_condition_enum<errc> : public true_type { }; /// error_category class error_category { protected: error_category() noexcept; public: virtual ~error_category() noexcept; error_category(const error_category&) = delete; error_category& operator=(const error_category&) = delete; virtual const char* name() const noexcept = 0; virtual string message(int) const = 0; virtual error_condition default_error_condition(int __i) const noexcept; virtual bool equivalent(int __i, const error_condition& __cond) const noexcept; virtual bool equivalent(const error_code& __code, int __i) const noexcept; bool operator<(const error_category& __other) const noexcept { return less<const error_category*>()(this, &__other); } bool operator==(const error_category& __other) const noexcept { return this == &__other; } bool operator!=(const error_category& __other) const noexcept { return this != &__other; } }; // DR 890. _GLIBCXX_CONST const error_category& system_category() noexcept; _GLIBCXX_CONST const error_category& generic_category() noexcept; error_code make_error_code(errc) noexcept; template<typename _Tp> struct hash; /// error_code // Implementation-specific error identification struct error_code { error_code() noexcept : _M_value(0), _M_cat(&system_category()) { } error_code(int __v, const error_category& __cat) noexcept : _M_value(__v), _M_cat(&__cat) { } template<typename _ErrorCodeEnum, typename = typename enable_if<is_error_code_enum<_ErrorCodeEnum>::value>::type> error_code(_ErrorCodeEnum __e) noexcept { *this = make_error_code(__e); } void assign(int __v, const error_category& __cat) noexcept { _M_value = __v; _M_cat = &__cat; } void clear() noexcept { assign(0, system_category()); } // DR 804. template<typename _ErrorCodeEnum> typename enable_if<is_error_code_enum<_ErrorCodeEnum>::value, error_code&>::type operator=(_ErrorCodeEnum __e) noexcept { return *this = make_error_code(__e); } int value() const noexcept { return _M_value; } const error_category& category() const noexcept { return *_M_cat; } error_condition default_error_condition() const noexcept; string message() const { return category().message(value()); } explicit operator bool() const noexcept { return _M_value != 0 ? true : false; } // DR 804. private: friend class hash<error_code>; int _M_value; const error_category* _M_cat; }; // 19.4.2.6 non-member functions inline error_code make_error_code(errc __e) noexcept { return error_code(static_cast<int>(__e), generic_category()); } inline bool operator<(const error_code& __lhs, const error_code& __rhs) noexcept { return (__lhs.category() < __rhs.category() || (__lhs.category() == __rhs.category() && __lhs.value() < __rhs.value())); } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) { return (__os << __e.category().name() << ':' << __e.value()); } error_condition make_error_condition(errc) noexcept; /// error_condition // Portable error identification struct error_condition { error_condition() noexcept : _M_value(0), _M_cat(&generic_category()) { } error_condition(int __v, const error_category& __cat) noexcept : _M_value(__v), _M_cat(&__cat) { } template<typename _ErrorConditionEnum, typename = typename enable_if<is_error_condition_enum<_ErrorConditionEnum>::value>::type> error_condition(_ErrorConditionEnum __e) noexcept { *this = make_error_condition(__e); } void assign(int __v, const error_category& __cat) noexcept { _M_value = __v; _M_cat = &__cat; } // DR 804. template<typename _ErrorConditionEnum> typename enable_if<is_error_condition_enum <_ErrorConditionEnum>::value, error_condition&>::type operator=(_ErrorConditionEnum __e) noexcept { return *this = make_error_condition(__e); } void clear() noexcept { assign(0, generic_category()); } // 19.4.3.4 observers int value() const noexcept { return _M_value; } const error_category& category() const noexcept { return *_M_cat; } string message() const { return category().message(value()); } explicit operator bool() const noexcept { return _M_value != 0 ? true : false; } // DR 804. private: int _M_value; const error_category* _M_cat; }; // 19.4.3.6 non-member functions inline error_condition make_error_condition(errc __e) noexcept { return error_condition(static_cast<int>(__e), generic_category()); } inline bool operator<(const error_condition& __lhs, const error_condition& __rhs) noexcept { return (__lhs.category() < __rhs.category() || (__lhs.category() == __rhs.category() && __lhs.value() < __rhs.value())); } // 19.4.4 Comparison operators inline bool operator==(const error_code& __lhs, const error_code& __rhs) noexcept { return (__lhs.category() == __rhs.category() && __lhs.value() == __rhs.value()); } inline bool operator==(const error_code& __lhs, const error_condition& __rhs) noexcept { return (__lhs.category().equivalent(__lhs.value(), __rhs) || __rhs.category().equivalent(__lhs, __rhs.value())); } inline bool operator==(const error_condition& __lhs, const error_code& __rhs) noexcept { return (__rhs.category().equivalent(__rhs.value(), __lhs) || __lhs.category().equivalent(__rhs, __lhs.value())); } inline bool operator==(const error_condition& __lhs, const error_condition& __rhs) noexcept { return (__lhs.category() == __rhs.category() && __lhs.value() == __rhs.value()); } inline bool operator!=(const error_code& __lhs, const error_code& __rhs) noexcept { return !(__lhs == __rhs); } inline bool operator!=(const error_code& __lhs, const error_condition& __rhs) noexcept { return !(__lhs == __rhs); } inline bool operator!=(const error_condition& __lhs, const error_code& __rhs) noexcept { return !(__lhs == __rhs); } inline bool operator!=(const error_condition& __lhs, const error_condition& __rhs) noexcept { return !(__lhs == __rhs); } /** * @brief Thrown to indicate error code of underlying system. * * @ingroup exceptions */ class system_error : public std::runtime_error { private: error_code _M_code; public: system_error(error_code __ec = error_code()) : runtime_error(__ec.message()), _M_code(__ec) { } system_error(error_code __ec, const string& __what) : runtime_error(__what + ": " + __ec.message()), _M_code(__ec) { } /* * TODO: Add const char* ctors to all exceptions. * * system_error(error_code __ec, const char* __what) * : runtime_error(__what + (": " + __ec.message())), _M_code(__ec) { } * * system_error(int __v, const error_category& __ecat, const char* __what) * : runtime_error(__what + (": " + __ec.message())), * _M_code(error_code(__v, __ecat)) { } */ system_error(int __v, const error_category& __ecat) : runtime_error(error_code(__v, __ecat).message()), _M_code(__v, __ecat) { } system_error(int __v, const error_category& __ecat, const string& __what) : runtime_error(__what + ": " + error_code(__v, __ecat).message()), _M_code(__v, __ecat) { } virtual ~system_error() noexcept; const error_code& code() const noexcept { return _M_code; } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #ifndef _GLIBCXX_COMPATIBILITY_CXX0X #include <bits/functional_hash.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // DR 1182. /// std::hash specialization for error_code. template<> struct hash<error_code> : public __hash_base<size_t, error_code> { size_t operator()(const error_code& __e) const noexcept { const size_t __tmp = std::_Hash_impl::hash(__e._M_value); return std::_Hash_impl::__hash_combine(__e._M_cat, __tmp); } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // _GLIBCXX_COMPATIBILITY_CXX0X #endif // C++11 #endif // _GLIBCXX_SYSTEM_ERROR ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_set.h����������������������������������������������������������������������������0000644�����������������00000071157�14763166030�0010375 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Set implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_set.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{set} */ #ifndef _STL_SET_H #define _STL_SET_H 1 #include <bits/concept_check.h> #if __cplusplus >= 201103L #include <initializer_list> #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /** * @brief A standard container made up of unique keys, which can be * retrieved in logarithmic time. * * @ingroup associative_containers * * @tparam _Key Type of key objects. * @tparam _Compare Comparison function object type, defaults to less<_Key>. * @tparam _Alloc Allocator type, defaults to allocator<_Key>. * * Meets the requirements of a <a href="tables.html#65">container</a>, a * <a href="tables.html#66">reversible container</a>, and an * <a href="tables.html#69">associative container</a> (using unique keys). * * Sets support bidirectional iterators. * * The private tree data is declared exactly the same way for set and * multiset; the distinction is made entirely in how the tree functions are * called (*_unique versus *_equal, same as the standard). */ template<typename _Key, typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<_Key> > class set { // concept requirements typedef typename _Alloc::value_type _Alloc_value_type; __glibcxx_class_requires(_Key, _SGIAssignableConcept) __glibcxx_class_requires4(_Compare, bool, _Key, _Key, _BinaryFunctionConcept) __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept) public: // typedefs: //@{ /// Public typedefs. typedef _Key key_type; typedef _Key value_type; typedef _Compare key_compare; typedef _Compare value_compare; typedef _Alloc allocator_type; //@} private: typedef typename _Alloc::template rebind<_Key>::other _Key_alloc_type; typedef _Rb_tree<key_type, value_type, _Identity<value_type>, key_compare, _Key_alloc_type> _Rep_type; _Rep_type _M_t; // Red-black tree representing set. public: //@{ /// Iterator-related typedefs. typedef typename _Key_alloc_type::pointer pointer; typedef typename _Key_alloc_type::const_pointer const_pointer; typedef typename _Key_alloc_type::reference reference; typedef typename _Key_alloc_type::const_reference const_reference; // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 103. set::iterator is required to be modifiable, // but this allows modification of keys. typedef typename _Rep_type::const_iterator iterator; typedef typename _Rep_type::const_iterator const_iterator; typedef typename _Rep_type::const_reverse_iterator reverse_iterator; typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; typedef typename _Rep_type::size_type size_type; typedef typename _Rep_type::difference_type difference_type; //@} // allocation/deallocation /** * @brief Default constructor creates no elements. */ set() : _M_t() { } /** * @brief Creates a %set with no elements. * @param __comp Comparator to use. * @param __a An allocator object. */ explicit set(const _Compare& __comp, const allocator_type& __a = allocator_type()) : _M_t(__comp, _Key_alloc_type(__a)) { } /** * @brief Builds a %set from a range. * @param __first An input iterator. * @param __last An input iterator. * * Create a %set consisting of copies of the elements from * [__first,__last). This is linear in N if the range is * already sorted, and NlogN otherwise (where N is * distance(__first,__last)). */ template<typename _InputIterator> set(_InputIterator __first, _InputIterator __last) : _M_t() { _M_t._M_insert_unique(__first, __last); } /** * @brief Builds a %set from a range. * @param __first An input iterator. * @param __last An input iterator. * @param __comp A comparison functor. * @param __a An allocator object. * * Create a %set consisting of copies of the elements from * [__first,__last). This is linear in N if the range is * already sorted, and NlogN otherwise (where N is * distance(__first,__last)). */ template<typename _InputIterator> set(_InputIterator __first, _InputIterator __last, const _Compare& __comp, const allocator_type& __a = allocator_type()) : _M_t(__comp, _Key_alloc_type(__a)) { _M_t._M_insert_unique(__first, __last); } /** * @brief %Set copy constructor. * @param __x A %set of identical element and allocator types. * * The newly-created %set uses a copy of the allocation object used * by @a __x. */ set(const set& __x) : _M_t(__x._M_t) { } #if __cplusplus >= 201103L /** * @brief %Set move constructor * @param __x A %set of identical element and allocator types. * * The newly-created %set contains the exact contents of @a x. * The contents of @a x are a valid, but unspecified %set. */ set(set&& __x) noexcept(is_nothrow_copy_constructible<_Compare>::value) : _M_t(std::move(__x._M_t)) { } /** * @brief Builds a %set from an initializer_list. * @param __l An initializer_list. * @param __comp A comparison functor. * @param __a An allocator object. * * Create a %set consisting of copies of the elements in the list. * This is linear in N if the list is already sorted, and NlogN * otherwise (where N is @a __l.size()). */ set(initializer_list<value_type> __l, const _Compare& __comp = _Compare(), const allocator_type& __a = allocator_type()) : _M_t(__comp, _Key_alloc_type(__a)) { _M_t._M_insert_unique(__l.begin(), __l.end()); } #endif /** * @brief %Set assignment operator. * @param __x A %set of identical element and allocator types. * * All the elements of @a __x are copied, but unlike the copy * constructor, the allocator object is not copied. */ set& operator=(const set& __x) { _M_t = __x._M_t; return *this; } #if __cplusplus >= 201103L /** * @brief %Set move assignment operator. * @param __x A %set of identical element and allocator types. * * The contents of @a __x are moved into this %set (without copying). * @a __x is a valid, but unspecified %set. */ set& operator=(set&& __x) { // NB: DR 1204. // NB: DR 675. this->clear(); this->swap(__x); return *this; } /** * @brief %Set list assignment operator. * @param __l An initializer_list. * * This function fills a %set with copies of the elements in the * initializer list @a __l. * * Note that the assignment completely changes the %set and * that the resulting %set's size is the same as the number * of elements assigned. Old data may be lost. */ set& operator=(initializer_list<value_type> __l) { this->clear(); this->insert(__l.begin(), __l.end()); return *this; } #endif // accessors: /// Returns the comparison object with which the %set was constructed. key_compare key_comp() const { return _M_t.key_comp(); } /// Returns the comparison object with which the %set was constructed. value_compare value_comp() const { return _M_t.key_comp(); } /// Returns the allocator object with which the %set was constructed. allocator_type get_allocator() const _GLIBCXX_NOEXCEPT { return allocator_type(_M_t.get_allocator()); } /** * Returns a read-only (constant) iterator that points to the first * element in the %set. Iteration is done in ascending order according * to the keys. */ iterator begin() const _GLIBCXX_NOEXCEPT { return _M_t.begin(); } /** * Returns a read-only (constant) iterator that points one past the last * element in the %set. Iteration is done in ascending order according * to the keys. */ iterator end() const _GLIBCXX_NOEXCEPT { return _M_t.end(); } /** * Returns a read-only (constant) iterator that points to the last * element in the %set. Iteration is done in descending order according * to the keys. */ reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return _M_t.rbegin(); } /** * Returns a read-only (constant) reverse iterator that points to the * last pair in the %set. Iteration is done in descending order * according to the keys. */ reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return _M_t.rend(); } #if __cplusplus >= 201103L /** * Returns a read-only (constant) iterator that points to the first * element in the %set. Iteration is done in ascending order according * to the keys. */ iterator cbegin() const noexcept { return _M_t.begin(); } /** * Returns a read-only (constant) iterator that points one past the last * element in the %set. Iteration is done in ascending order according * to the keys. */ iterator cend() const noexcept { return _M_t.end(); } /** * Returns a read-only (constant) iterator that points to the last * element in the %set. Iteration is done in descending order according * to the keys. */ reverse_iterator crbegin() const noexcept { return _M_t.rbegin(); } /** * Returns a read-only (constant) reverse iterator that points to the * last pair in the %set. Iteration is done in descending order * according to the keys. */ reverse_iterator crend() const noexcept { return _M_t.rend(); } #endif /// Returns true if the %set is empty. bool empty() const _GLIBCXX_NOEXCEPT { return _M_t.empty(); } /// Returns the size of the %set. size_type size() const _GLIBCXX_NOEXCEPT { return _M_t.size(); } /// Returns the maximum size of the %set. size_type max_size() const _GLIBCXX_NOEXCEPT { return _M_t.max_size(); } /** * @brief Swaps data with another %set. * @param __x A %set of the same element and allocator types. * * This exchanges the elements between two sets in constant * time. (It is only swapping a pointer, an integer, and an * instance of the @c Compare type (which itself is often * stateless and empty), so it should be quite fast.) Note * that the global std::swap() function is specialized such * that std::swap(s1,s2) will feed to this function. */ void swap(set& __x) { _M_t.swap(__x._M_t); } // insert/erase #if __cplusplus >= 201103L /** * @brief Attempts to build and insert an element into the %set. * @param __args Arguments used to generate an element. * @return A pair, of which the first element is an iterator that points * to the possibly inserted element, and the second is a bool * that is true if the element was actually inserted. * * This function attempts to build and insert an element into the %set. * A %set relies on unique keys and thus an element is only inserted if * it is not already present in the %set. * * Insertion requires logarithmic time. */ template<typename... _Args> std::pair<iterator, bool> emplace(_Args&&... __args) { return _M_t._M_emplace_unique(std::forward<_Args>(__args)...); } /** * @brief Attempts to insert an element into the %set. * @param __pos An iterator that serves as a hint as to where the * element should be inserted. * @param __args Arguments used to generate the element to be * inserted. * @return An iterator that points to the element with key equivalent to * the one generated from @a __args (may or may not be the * element itself). * * This function is not concerned about whether the insertion took place, * and thus does not return a boolean like the single-argument emplace() * does. Note that the first parameter is only a hint and can * potentially improve the performance of the insertion process. A bad * hint would cause no gains in efficiency. * * For more on @a hinting, see: * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html * * Insertion requires logarithmic time (if the hint is not taken). */ template<typename... _Args> iterator emplace_hint(const_iterator __pos, _Args&&... __args) { return _M_t._M_emplace_hint_unique(__pos, std::forward<_Args>(__args)...); } #endif /** * @brief Attempts to insert an element into the %set. * @param __x Element to be inserted. * @return A pair, of which the first element is an iterator that points * to the possibly inserted element, and the second is a bool * that is true if the element was actually inserted. * * This function attempts to insert an element into the %set. A %set * relies on unique keys and thus an element is only inserted if it is * not already present in the %set. * * Insertion requires logarithmic time. */ std::pair<iterator, bool> insert(const value_type& __x) { std::pair<typename _Rep_type::iterator, bool> __p = _M_t._M_insert_unique(__x); return std::pair<iterator, bool>(__p.first, __p.second); } #if __cplusplus >= 201103L std::pair<iterator, bool> insert(value_type&& __x) { std::pair<typename _Rep_type::iterator, bool> __p = _M_t._M_insert_unique(std::move(__x)); return std::pair<iterator, bool>(__p.first, __p.second); } #endif /** * @brief Attempts to insert an element into the %set. * @param __position An iterator that serves as a hint as to where the * element should be inserted. * @param __x Element to be inserted. * @return An iterator that points to the element with key of * @a __x (may or may not be the element passed in). * * This function is not concerned about whether the insertion took place, * and thus does not return a boolean like the single-argument insert() * does. Note that the first parameter is only a hint and can * potentially improve the performance of the insertion process. A bad * hint would cause no gains in efficiency. * * For more on @a hinting, see: * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html * * Insertion requires logarithmic time (if the hint is not taken). */ iterator insert(const_iterator __position, const value_type& __x) { return _M_t._M_insert_unique_(__position, __x); } #if __cplusplus >= 201103L iterator insert(const_iterator __position, value_type&& __x) { return _M_t._M_insert_unique_(__position, std::move(__x)); } #endif /** * @brief A template function that attempts to insert a range * of elements. * @param __first Iterator pointing to the start of the range to be * inserted. * @param __last Iterator pointing to the end of the range. * * Complexity similar to that of the range constructor. */ template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) { _M_t._M_insert_unique(__first, __last); } #if __cplusplus >= 201103L /** * @brief Attempts to insert a list of elements into the %set. * @param __l A std::initializer_list<value_type> of elements * to be inserted. * * Complexity similar to that of the range constructor. */ void insert(initializer_list<value_type> __l) { this->insert(__l.begin(), __l.end()); } #endif #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 130. Associative erase should return an iterator. /** * @brief Erases an element from a %set. * @param __position An iterator pointing to the element to be erased. * @return An iterator pointing to the element immediately following * @a __position prior to the element being erased. If no such * element exists, end() is returned. * * This function erases an element, pointed to by the given iterator, * from a %set. Note that this function only erases the element, and * that if the element is itself a pointer, the pointed-to memory is not * touched in any way. Managing the pointer is the user's * responsibility. */ _GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __position) { return _M_t.erase(__position); } #else /** * @brief Erases an element from a %set. * @param position An iterator pointing to the element to be erased. * * This function erases an element, pointed to by the given iterator, * from a %set. Note that this function only erases the element, and * that if the element is itself a pointer, the pointed-to memory is not * touched in any way. Managing the pointer is the user's * responsibility. */ void erase(iterator __position) { _M_t.erase(__position); } #endif /** * @brief Erases elements according to the provided key. * @param __x Key of element to be erased. * @return The number of elements erased. * * This function erases all the elements located by the given key from * a %set. * Note that this function only erases the element, and that if * the element is itself a pointer, the pointed-to memory is not touched * in any way. Managing the pointer is the user's responsibility. */ size_type erase(const key_type& __x) { return _M_t.erase(__x); } #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 130. Associative erase should return an iterator. /** * @brief Erases a [__first,__last) range of elements from a %set. * @param __first Iterator pointing to the start of the range to be * erased. * @param __last Iterator pointing to the end of the range to * be erased. * @return The iterator @a __last. * * This function erases a sequence of elements from a %set. * Note that this function only erases the element, and that if * the element is itself a pointer, the pointed-to memory is not touched * in any way. Managing the pointer is the user's responsibility. */ _GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __first, const_iterator __last) { return _M_t.erase(__first, __last); } #else /** * @brief Erases a [first,last) range of elements from a %set. * @param __first Iterator pointing to the start of the range to be * erased. * @param __last Iterator pointing to the end of the range to * be erased. * * This function erases a sequence of elements from a %set. * Note that this function only erases the element, and that if * the element is itself a pointer, the pointed-to memory is not touched * in any way. Managing the pointer is the user's responsibility. */ void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last); } #endif /** * Erases all elements in a %set. Note that this function only erases * the elements, and that if the elements themselves are pointers, the * pointed-to memory is not touched in any way. Managing the pointer is * the user's responsibility. */ void clear() _GLIBCXX_NOEXCEPT { _M_t.clear(); } // set operations: /** * @brief Finds the number of elements. * @param __x Element to located. * @return Number of elements with specified key. * * This function only makes sense for multisets; for set the result will * either be 0 (not present) or 1 (present). */ size_type count(const key_type& __x) const { return _M_t.find(__x) == _M_t.end() ? 0 : 1; } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload //@{ /** * @brief Tries to locate an element in a %set. * @param __x Element to be located. * @return Iterator pointing to sought-after element, or end() if not * found. * * This function takes a key and tries to locate the element with which * the key matches. If successful the function returns an iterator * pointing to the sought after element. If unsuccessful it returns the * past-the-end ( @c end() ) iterator. */ iterator find(const key_type& __x) { return _M_t.find(__x); } const_iterator find(const key_type& __x) const { return _M_t.find(__x); } //@} //@{ /** * @brief Finds the beginning of a subsequence matching given key. * @param __x Key to be located. * @return Iterator pointing to first element equal to or greater * than key, or end(). * * This function returns the first element of a subsequence of elements * that matches the given key. If unsuccessful it returns an iterator * pointing to the first element that has a greater value than given key * or end() if no such element exists. */ iterator lower_bound(const key_type& __x) { return _M_t.lower_bound(__x); } const_iterator lower_bound(const key_type& __x) const { return _M_t.lower_bound(__x); } //@} //@{ /** * @brief Finds the end of a subsequence matching given key. * @param __x Key to be located. * @return Iterator pointing to the first element * greater than key, or end(). */ iterator upper_bound(const key_type& __x) { return _M_t.upper_bound(__x); } const_iterator upper_bound(const key_type& __x) const { return _M_t.upper_bound(__x); } //@} //@{ /** * @brief Finds a subsequence matching given key. * @param __x Key to be located. * @return Pair of iterators that possibly points to the subsequence * matching given key. * * This function is equivalent to * @code * std::make_pair(c.lower_bound(val), * c.upper_bound(val)) * @endcode * (but is faster than making the calls separately). * * This function probably only makes sense for multisets. */ std::pair<iterator, iterator> equal_range(const key_type& __x) { return _M_t.equal_range(__x); } std::pair<const_iterator, const_iterator> equal_range(const key_type& __x) const { return _M_t.equal_range(__x); } //@} template<typename _K1, typename _C1, typename _A1> friend bool operator==(const set<_K1, _C1, _A1>&, const set<_K1, _C1, _A1>&); template<typename _K1, typename _C1, typename _A1> friend bool operator<(const set<_K1, _C1, _A1>&, const set<_K1, _C1, _A1>&); }; /** * @brief Set equality comparison. * @param __x A %set. * @param __y A %set of the same type as @a x. * @return True iff the size and elements of the sets are equal. * * This is an equivalence relation. It is linear in the size of the sets. * Sets are considered equivalent if their sizes are equal, and if * corresponding elements compare equal. */ template<typename _Key, typename _Compare, typename _Alloc> inline bool operator==(const set<_Key, _Compare, _Alloc>& __x, const set<_Key, _Compare, _Alloc>& __y) { return __x._M_t == __y._M_t; } /** * @brief Set ordering relation. * @param __x A %set. * @param __y A %set of the same type as @a x. * @return True iff @a __x is lexicographically less than @a __y. * * This is a total ordering relation. It is linear in the size of the * maps. The elements must be comparable with @c <. * * See std::lexicographical_compare() for how the determination is made. */ template<typename _Key, typename _Compare, typename _Alloc> inline bool operator<(const set<_Key, _Compare, _Alloc>& __x, const set<_Key, _Compare, _Alloc>& __y) { return __x._M_t < __y._M_t; } /// Returns !(x == y). template<typename _Key, typename _Compare, typename _Alloc> inline bool operator!=(const set<_Key, _Compare, _Alloc>& __x, const set<_Key, _Compare, _Alloc>& __y) { return !(__x == __y); } /// Returns y < x. template<typename _Key, typename _Compare, typename _Alloc> inline bool operator>(const set<_Key, _Compare, _Alloc>& __x, const set<_Key, _Compare, _Alloc>& __y) { return __y < __x; } /// Returns !(y < x) template<typename _Key, typename _Compare, typename _Alloc> inline bool operator<=(const set<_Key, _Compare, _Alloc>& __x, const set<_Key, _Compare, _Alloc>& __y) { return !(__y < __x); } /// Returns !(x < y) template<typename _Key, typename _Compare, typename _Alloc> inline bool operator>=(const set<_Key, _Compare, _Alloc>& __x, const set<_Key, _Compare, _Alloc>& __y) { return !(__x < __y); } /// See std::set::swap(). template<typename _Key, typename _Compare, typename _Alloc> inline void swap(set<_Key, _Compare, _Alloc>& __x, set<_Key, _Compare, _Alloc>& __y) { __x.swap(__y); } _GLIBCXX_END_NAMESPACE_CONTAINER } //namespace std #endif /* _STL_SET_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_pair.h���������������������������������������������������������������������������0000644�����������������00000023211�14763166030�0010521 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Pair implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_pair.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{utility} */ #ifndef _STL_PAIR_H #define _STL_PAIR_H 1 #include <bits/move.h> // for std::move / std::forward, and std::swap #if __cplusplus >= 201103L #include <type_traits> // for std::__decay_and_strip too #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup utilities * @{ */ #if __cplusplus >= 201103L /// piecewise_construct_t struct piecewise_construct_t { }; /// piecewise_construct constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); // Forward declarations. template<typename...> class tuple; template<std::size_t...> struct _Index_tuple; #endif /** * @brief Struct holding two objects of arbitrary type. * * @tparam _T1 Type of first object. * @tparam _T2 Type of second object. */ template<class _T1, class _T2> struct pair { typedef _T1 first_type; /// @c first_type is the first bound type typedef _T2 second_type; /// @c second_type is the second bound type _T1 first; /// @c first is a copy of the first object _T2 second; /// @c second is a copy of the second object // _GLIBCXX_RESOLVE_LIB_DEFECTS // 265. std::pair::pair() effects overly restrictive /** The default constructor creates @c first and @c second using their * respective default constructors. */ _GLIBCXX_CONSTEXPR pair() : first(), second() { } /** Two objects may be passed to a @c pair constructor to be copied. */ _GLIBCXX_CONSTEXPR pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) { } /** There is also a templated copy ctor for the @c pair class itself. */ #if __cplusplus < 201103L template<class _U1, class _U2> pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) { } #else template<class _U1, class _U2, class = typename enable_if<__and_<is_convertible<const _U1&, _T1>, is_convertible<const _U2&, _T2>>::value>::type> constexpr pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) { } constexpr pair(const pair&) = default; constexpr pair(pair&&) = default; // DR 811. template<class _U1, class = typename enable_if<is_convertible<_U1, _T1>::value>::type> constexpr pair(_U1&& __x, const _T2& __y) : first(std::forward<_U1>(__x)), second(__y) { } template<class _U2, class = typename enable_if<is_convertible<_U2, _T2>::value>::type> constexpr pair(const _T1& __x, _U2&& __y) : first(__x), second(std::forward<_U2>(__y)) { } template<class _U1, class _U2, class = typename enable_if<__and_<is_convertible<_U1, _T1>, is_convertible<_U2, _T2>>::value>::type> constexpr pair(_U1&& __x, _U2&& __y) : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { } template<class _U1, class _U2, class = typename enable_if<__and_<is_convertible<_U1, _T1>, is_convertible<_U2, _T2>>::value>::type> constexpr pair(pair<_U1, _U2>&& __p) : first(std::forward<_U1>(__p.first)), second(std::forward<_U2>(__p.second)) { } template<typename... _Args1, typename... _Args2> pair(piecewise_construct_t, tuple<_Args1...>, tuple<_Args2...>); pair& operator=(const pair& __p) { first = __p.first; second = __p.second; return *this; } pair& operator=(pair&& __p) noexcept(__and_<is_nothrow_move_assignable<_T1>, is_nothrow_move_assignable<_T2>>::value) { first = std::forward<first_type>(__p.first); second = std::forward<second_type>(__p.second); return *this; } template<class _U1, class _U2> pair& operator=(const pair<_U1, _U2>& __p) { first = __p.first; second = __p.second; return *this; } template<class _U1, class _U2> pair& operator=(pair<_U1, _U2>&& __p) { first = std::forward<_U1>(__p.first); second = std::forward<_U2>(__p.second); return *this; } void swap(pair& __p) noexcept(noexcept(swap(first, __p.first)) && noexcept(swap(second, __p.second))) { using std::swap; swap(first, __p.first); swap(second, __p.second); } private: template<typename... _Args1, std::size_t... _Indexes1, typename... _Args2, std::size_t... _Indexes2> pair(tuple<_Args1...>&, tuple<_Args2...>&, _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>); #endif }; /// Two pairs of the same type are equal iff their members are equal. template<class _T1, class _T2> inline _GLIBCXX_CONSTEXPR bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return __x.first == __y.first && __x.second == __y.second; } /// <http://gcc.gnu.org/onlinedocs/libstdc++/manual/utilities.html> template<class _T1, class _T2> inline _GLIBCXX_CONSTEXPR bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return __x.first < __y.first || (!(__y.first < __x.first) && __x.second < __y.second); } /// Uses @c operator== to find the result. template<class _T1, class _T2> inline _GLIBCXX_CONSTEXPR bool operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return !(__x == __y); } /// Uses @c operator< to find the result. template<class _T1, class _T2> inline _GLIBCXX_CONSTEXPR bool operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return __y < __x; } /// Uses @c operator< to find the result. template<class _T1, class _T2> inline _GLIBCXX_CONSTEXPR bool operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return !(__y < __x); } /// Uses @c operator< to find the result. template<class _T1, class _T2> inline _GLIBCXX_CONSTEXPR bool operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { return !(__x < __y); } #if __cplusplus >= 201103L /// See std::pair::swap(). // Note: no std::swap overloads in C++03 mode, this has performance // implications, see, eg, libstdc++/38466. template<class _T1, class _T2> inline void swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } #endif /** * @brief A convenience wrapper for creating a pair from two objects. * @param __x The first object. * @param __y The second object. * @return A newly-constructed pair<> object of the appropriate type. * * The standard requires that the objects be passed by reference-to-const, * but LWG issue #181 says they should be passed by const value. We follow * the LWG by default. */ // _GLIBCXX_RESOLVE_LIB_DEFECTS // 181. make_pair() unintended behavior #if __cplusplus >= 201103L // NB: DR 706. template<class _T1, class _T2> constexpr pair<typename __decay_and_strip<_T1>::__type, typename __decay_and_strip<_T2>::__type> make_pair(_T1&& __x, _T2&& __y) { typedef typename __decay_and_strip<_T1>::__type __ds_type1; typedef typename __decay_and_strip<_T2>::__type __ds_type2; typedef pair<__ds_type1, __ds_type2> __pair_type; return __pair_type(std::forward<_T1>(__x), std::forward<_T2>(__y)); } #else template<class _T1, class _T2> inline pair<_T1, _T2> make_pair(_T1 __x, _T2 __y) { return pair<_T1, _T2>(__x, __y); } #endif /// @} _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif /* _STL_PAIR_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/boost_concept_check.h����������������������������������������������������������������0000644�����������������00000064650�14763166030�0012716 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2004-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify, // sell and distribute this software is granted provided this // copyright notice appears in all copies. This software is provided // "as is" without express or implied warranty, and with no claim as // to its suitability for any purpose. // /** @file bits/boost_concept_check.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{iterator} */ // GCC Note: based on version 1.12.0 of the Boost library. #ifndef _BOOST_CONCEPT_CHECK_H #define _BOOST_CONCEPT_CHECK_H 1 #pragma GCC system_header #include <bits/c++config.h> #include <bits/stl_iterator_base_types.h> // for traits and tags namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION #define _IsUnused __attribute__ ((__unused__)) // When the C-C code is in use, we would like this function to do as little // as possible at runtime, use as few resources as possible, and hopefully // be elided out of existence... hmmm. template <class _Concept> inline void __function_requires() { void (_Concept::*__x)() _IsUnused = &_Concept::__constraints; } // No definition: if this is referenced, there's a problem with // the instantiating type not being one of the required integer types. // Unfortunately, this results in a link-time error, not a compile-time error. void __error_type_must_be_an_integer_type(); void __error_type_must_be_an_unsigned_integer_type(); void __error_type_must_be_a_signed_integer_type(); // ??? Should the "concept_checking*" structs begin with more than _ ? #define _GLIBCXX_CLASS_REQUIRES(_type_var, _ns, _concept) \ typedef void (_ns::_concept <_type_var>::* _func##_type_var##_concept)(); \ template <_func##_type_var##_concept _Tp1> \ struct _concept_checking##_type_var##_concept { }; \ typedef _concept_checking##_type_var##_concept< \ &_ns::_concept <_type_var>::__constraints> \ _concept_checking_typedef##_type_var##_concept #define _GLIBCXX_CLASS_REQUIRES2(_type_var1, _type_var2, _ns, _concept) \ typedef void (_ns::_concept <_type_var1,_type_var2>::* _func##_type_var1##_type_var2##_concept)(); \ template <_func##_type_var1##_type_var2##_concept _Tp1> \ struct _concept_checking##_type_var1##_type_var2##_concept { }; \ typedef _concept_checking##_type_var1##_type_var2##_concept< \ &_ns::_concept <_type_var1,_type_var2>::__constraints> \ _concept_checking_typedef##_type_var1##_type_var2##_concept #define _GLIBCXX_CLASS_REQUIRES3(_type_var1, _type_var2, _type_var3, _ns, _concept) \ typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3>::* _func##_type_var1##_type_var2##_type_var3##_concept)(); \ template <_func##_type_var1##_type_var2##_type_var3##_concept _Tp1> \ struct _concept_checking##_type_var1##_type_var2##_type_var3##_concept { }; \ typedef _concept_checking##_type_var1##_type_var2##_type_var3##_concept< \ &_ns::_concept <_type_var1,_type_var2,_type_var3>::__constraints> \ _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_concept #define _GLIBCXX_CLASS_REQUIRES4(_type_var1, _type_var2, _type_var3, _type_var4, _ns, _concept) \ typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::* _func##_type_var1##_type_var2##_type_var3##_type_var4##_concept)(); \ template <_func##_type_var1##_type_var2##_type_var3##_type_var4##_concept _Tp1> \ struct _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept { }; \ typedef _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept< \ &_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::__constraints> \ _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_type_var4##_concept template <class _Tp1, class _Tp2> struct _Aux_require_same { }; template <class _Tp> struct _Aux_require_same<_Tp,_Tp> { typedef _Tp _Type; }; template <class _Tp1, class _Tp2> struct _SameTypeConcept { void __constraints() { typedef typename _Aux_require_same<_Tp1, _Tp2>::_Type _Required; } }; template <class _Tp> struct _IntegerConcept { void __constraints() { __error_type_must_be_an_integer_type(); } }; template <> struct _IntegerConcept<short> { void __constraints() {} }; template <> struct _IntegerConcept<unsigned short> { void __constraints(){} }; template <> struct _IntegerConcept<int> { void __constraints() {} }; template <> struct _IntegerConcept<unsigned int> { void __constraints() {} }; template <> struct _IntegerConcept<long> { void __constraints() {} }; template <> struct _IntegerConcept<unsigned long> { void __constraints() {} }; template <> struct _IntegerConcept<long long> { void __constraints() {} }; template <> struct _IntegerConcept<unsigned long long> { void __constraints() {} }; template <class _Tp> struct _SignedIntegerConcept { void __constraints() { __error_type_must_be_a_signed_integer_type(); } }; template <> struct _SignedIntegerConcept<short> { void __constraints() {} }; template <> struct _SignedIntegerConcept<int> { void __constraints() {} }; template <> struct _SignedIntegerConcept<long> { void __constraints() {} }; template <> struct _SignedIntegerConcept<long long> { void __constraints(){}}; template <class _Tp> struct _UnsignedIntegerConcept { void __constraints() { __error_type_must_be_an_unsigned_integer_type(); } }; template <> struct _UnsignedIntegerConcept<unsigned short> { void __constraints() {} }; template <> struct _UnsignedIntegerConcept<unsigned int> { void __constraints() {} }; template <> struct _UnsignedIntegerConcept<unsigned long> { void __constraints() {} }; template <> struct _UnsignedIntegerConcept<unsigned long long> { void __constraints() {} }; //=========================================================================== // Basic Concepts template <class _Tp> struct _DefaultConstructibleConcept { void __constraints() { _Tp __a _IsUnused; // require default constructor } }; template <class _Tp> struct _AssignableConcept { void __constraints() { __a = __a; // require assignment operator __const_constraints(__a); } void __const_constraints(const _Tp& __b) { __a = __b; // const required for argument to assignment } _Tp __a; // possibly should be "Tp* a;" and then dereference "a" in constraint // functions? present way would require a default ctor, i think... }; template <class _Tp> struct _CopyConstructibleConcept { void __constraints() { _Tp __a(__b); // require copy constructor _Tp* __ptr _IsUnused = &__a; // require address of operator __const_constraints(__a); } void __const_constraints(const _Tp& __a) { _Tp __c _IsUnused(__a); // require const copy constructor const _Tp* __ptr _IsUnused = &__a; // require const address of operator } _Tp __b; }; // The SGI STL version of Assignable requires copy constructor and operator= template <class _Tp> struct _SGIAssignableConcept { void __constraints() { _Tp __b _IsUnused(__a); __a = __a; // require assignment operator __const_constraints(__a); } void __const_constraints(const _Tp& __b) { _Tp __c _IsUnused(__b); __a = __b; // const required for argument to assignment } _Tp __a; }; template <class _From, class _To> struct _ConvertibleConcept { void __constraints() { _To __y _IsUnused = __x; } _From __x; }; // The C++ standard requirements for many concepts talk about return // types that must be "convertible to bool". The problem with this // requirement is that it leaves the door open for evil proxies that // define things like operator|| with strange return types. Two // possible solutions are: // 1) require the return type to be exactly bool // 2) stay with convertible to bool, and also // specify stuff about all the logical operators. // For now we just test for convertible to bool. template <class _Tp> void __aux_require_boolean_expr(const _Tp& __t) { bool __x _IsUnused = __t; } // FIXME template <class _Tp> struct _EqualityComparableConcept { void __constraints() { __aux_require_boolean_expr(__a == __b); } _Tp __a, __b; }; template <class _Tp> struct _LessThanComparableConcept { void __constraints() { __aux_require_boolean_expr(__a < __b); } _Tp __a, __b; }; // This is equivalent to SGI STL's LessThanComparable. template <class _Tp> struct _ComparableConcept { void __constraints() { __aux_require_boolean_expr(__a < __b); __aux_require_boolean_expr(__a > __b); __aux_require_boolean_expr(__a <= __b); __aux_require_boolean_expr(__a >= __b); } _Tp __a, __b; }; #define _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(_OP,_NAME) \ template <class _First, class _Second> \ struct _NAME { \ void __constraints() { (void)__constraints_(); } \ bool __constraints_() { \ return __a _OP __b; \ } \ _First __a; \ _Second __b; \ } #define _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(_OP,_NAME) \ template <class _Ret, class _First, class _Second> \ struct _NAME { \ void __constraints() { (void)__constraints_(); } \ _Ret __constraints_() { \ return __a _OP __b; \ } \ _First __a; \ _Second __b; \ } _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, _EqualOpConcept); _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, _NotEqualOpConcept); _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, _LessThanOpConcept); _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, _LessEqualOpConcept); _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, _GreaterThanOpConcept); _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, _GreaterEqualOpConcept); _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, _PlusOpConcept); _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, _TimesOpConcept); _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, _DivideOpConcept); _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, _SubtractOpConcept); _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, _ModOpConcept); #undef _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT #undef _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT //=========================================================================== // Function Object Concepts template <class _Func, class _Return> struct _GeneratorConcept { void __constraints() { const _Return& __r _IsUnused = __f();// require operator() member function } _Func __f; }; template <class _Func> struct _GeneratorConcept<_Func,void> { void __constraints() { __f(); // require operator() member function } _Func __f; }; template <class _Func, class _Return, class _Arg> struct _UnaryFunctionConcept { void __constraints() { __r = __f(__arg); // require operator() } _Func __f; _Arg __arg; _Return __r; }; template <class _Func, class _Arg> struct _UnaryFunctionConcept<_Func, void, _Arg> { void __constraints() { __f(__arg); // require operator() } _Func __f; _Arg __arg; }; template <class _Func, class _Return, class _First, class _Second> struct _BinaryFunctionConcept { void __constraints() { __r = __f(__first, __second); // require operator() } _Func __f; _First __first; _Second __second; _Return __r; }; template <class _Func, class _First, class _Second> struct _BinaryFunctionConcept<_Func, void, _First, _Second> { void __constraints() { __f(__first, __second); // require operator() } _Func __f; _First __first; _Second __second; }; template <class _Func, class _Arg> struct _UnaryPredicateConcept { void __constraints() { __aux_require_boolean_expr(__f(__arg)); // require op() returning bool } _Func __f; _Arg __arg; }; template <class _Func, class _First, class _Second> struct _BinaryPredicateConcept { void __constraints() { __aux_require_boolean_expr(__f(__a, __b)); // require op() returning bool } _Func __f; _First __a; _Second __b; }; // use this when functor is used inside a container class like std::set template <class _Func, class _First, class _Second> struct _Const_BinaryPredicateConcept { void __constraints() { __const_constraints(__f); } void __const_constraints(const _Func& __fun) { __function_requires<_BinaryPredicateConcept<_Func, _First, _Second> >(); // operator() must be a const member function __aux_require_boolean_expr(__fun(__a, __b)); } _Func __f; _First __a; _Second __b; }; //=========================================================================== // Iterator Concepts template <class _Tp> struct _TrivialIteratorConcept { void __constraints() { // __function_requires< _DefaultConstructibleConcept<_Tp> >(); __function_requires< _AssignableConcept<_Tp> >(); __function_requires< _EqualityComparableConcept<_Tp> >(); // typedef typename std::iterator_traits<_Tp>::value_type _V; (void)*__i; // require dereference operator } _Tp __i; }; template <class _Tp> struct _Mutable_TrivialIteratorConcept { void __constraints() { __function_requires< _TrivialIteratorConcept<_Tp> >(); *__i = *__j; // require dereference and assignment } _Tp __i, __j; }; template <class _Tp> struct _InputIteratorConcept { void __constraints() { __function_requires< _TrivialIteratorConcept<_Tp> >(); // require iterator_traits typedef's typedef typename std::iterator_traits<_Tp>::difference_type _Diff; // __function_requires< _SignedIntegerConcept<_Diff> >(); typedef typename std::iterator_traits<_Tp>::reference _Ref; typedef typename std::iterator_traits<_Tp>::pointer _Pt; typedef typename std::iterator_traits<_Tp>::iterator_category _Cat; __function_requires< _ConvertibleConcept< typename std::iterator_traits<_Tp>::iterator_category, std::input_iterator_tag> >(); ++__i; // require preincrement operator __i++; // require postincrement operator } _Tp __i; }; template <class _Tp, class _ValueT> struct _OutputIteratorConcept { void __constraints() { __function_requires< _AssignableConcept<_Tp> >(); ++__i; // require preincrement operator __i++; // require postincrement operator *__i++ = __t; // require postincrement and assignment } _Tp __i; _ValueT __t; }; template <class _Tp> struct _ForwardIteratorConcept { void __constraints() { __function_requires< _InputIteratorConcept<_Tp> >(); __function_requires< _DefaultConstructibleConcept<_Tp> >(); __function_requires< _ConvertibleConcept< typename std::iterator_traits<_Tp>::iterator_category, std::forward_iterator_tag> >(); typedef typename std::iterator_traits<_Tp>::reference _Ref; _Ref __r _IsUnused = *__i; } _Tp __i; }; template <class _Tp> struct _Mutable_ForwardIteratorConcept { void __constraints() { __function_requires< _ForwardIteratorConcept<_Tp> >(); *__i++ = *__i; // require postincrement and assignment } _Tp __i; }; template <class _Tp> struct _BidirectionalIteratorConcept { void __constraints() { __function_requires< _ForwardIteratorConcept<_Tp> >(); __function_requires< _ConvertibleConcept< typename std::iterator_traits<_Tp>::iterator_category, std::bidirectional_iterator_tag> >(); --__i; // require predecrement operator __i--; // require postdecrement operator } _Tp __i; }; template <class _Tp> struct _Mutable_BidirectionalIteratorConcept { void __constraints() { __function_requires< _BidirectionalIteratorConcept<_Tp> >(); __function_requires< _Mutable_ForwardIteratorConcept<_Tp> >(); *__i-- = *__i; // require postdecrement and assignment } _Tp __i; }; template <class _Tp> struct _RandomAccessIteratorConcept { void __constraints() { __function_requires< _BidirectionalIteratorConcept<_Tp> >(); __function_requires< _ComparableConcept<_Tp> >(); __function_requires< _ConvertibleConcept< typename std::iterator_traits<_Tp>::iterator_category, std::random_access_iterator_tag> >(); // ??? We don't use _Ref, are we just checking for "referenceability"? typedef typename std::iterator_traits<_Tp>::reference _Ref; __i += __n; // require assignment addition operator __i = __i + __n; __i = __n + __i; // require addition with difference type __i -= __n; // require assignment subtraction op __i = __i - __n; // require subtraction with // difference type __n = __i - __j; // require difference operator (void)__i[__n]; // require element access operator } _Tp __a, __b; _Tp __i, __j; typename std::iterator_traits<_Tp>::difference_type __n; }; template <class _Tp> struct _Mutable_RandomAccessIteratorConcept { void __constraints() { __function_requires< _RandomAccessIteratorConcept<_Tp> >(); __function_requires< _Mutable_BidirectionalIteratorConcept<_Tp> >(); __i[__n] = *__i; // require element access and assignment } _Tp __i; typename std::iterator_traits<_Tp>::difference_type __n; }; //=========================================================================== // Container Concepts template <class _Container> struct _ContainerConcept { typedef typename _Container::value_type _Value_type; typedef typename _Container::difference_type _Difference_type; typedef typename _Container::size_type _Size_type; typedef typename _Container::const_reference _Const_reference; typedef typename _Container::const_pointer _Const_pointer; typedef typename _Container::const_iterator _Const_iterator; void __constraints() { __function_requires< _InputIteratorConcept<_Const_iterator> >(); __function_requires< _AssignableConcept<_Container> >(); const _Container __c; __i = __c.begin(); __i = __c.end(); __n = __c.size(); __n = __c.max_size(); __b = __c.empty(); } bool __b; _Const_iterator __i; _Size_type __n; }; template <class _Container> struct _Mutable_ContainerConcept { typedef typename _Container::value_type _Value_type; typedef typename _Container::reference _Reference; typedef typename _Container::iterator _Iterator; typedef typename _Container::pointer _Pointer; void __constraints() { __function_requires< _ContainerConcept<_Container> >(); __function_requires< _AssignableConcept<_Value_type> >(); __function_requires< _InputIteratorConcept<_Iterator> >(); __i = __c.begin(); __i = __c.end(); __c.swap(__c2); } _Iterator __i; _Container __c, __c2; }; template <class _ForwardContainer> struct _ForwardContainerConcept { void __constraints() { __function_requires< _ContainerConcept<_ForwardContainer> >(); typedef typename _ForwardContainer::const_iterator _Const_iterator; __function_requires< _ForwardIteratorConcept<_Const_iterator> >(); } }; template <class _ForwardContainer> struct _Mutable_ForwardContainerConcept { void __constraints() { __function_requires< _ForwardContainerConcept<_ForwardContainer> >(); __function_requires< _Mutable_ContainerConcept<_ForwardContainer> >(); typedef typename _ForwardContainer::iterator _Iterator; __function_requires< _Mutable_ForwardIteratorConcept<_Iterator> >(); } }; template <class _ReversibleContainer> struct _ReversibleContainerConcept { typedef typename _ReversibleContainer::const_iterator _Const_iterator; typedef typename _ReversibleContainer::const_reverse_iterator _Const_reverse_iterator; void __constraints() { __function_requires< _ForwardContainerConcept<_ReversibleContainer> >(); __function_requires< _BidirectionalIteratorConcept<_Const_iterator> >(); __function_requires< _BidirectionalIteratorConcept<_Const_reverse_iterator> >(); const _ReversibleContainer __c; _Const_reverse_iterator __i = __c.rbegin(); __i = __c.rend(); } }; template <class _ReversibleContainer> struct _Mutable_ReversibleContainerConcept { typedef typename _ReversibleContainer::iterator _Iterator; typedef typename _ReversibleContainer::reverse_iterator _Reverse_iterator; void __constraints() { __function_requires<_ReversibleContainerConcept<_ReversibleContainer> >(); __function_requires< _Mutable_ForwardContainerConcept<_ReversibleContainer> >(); __function_requires<_Mutable_BidirectionalIteratorConcept<_Iterator> >(); __function_requires< _Mutable_BidirectionalIteratorConcept<_Reverse_iterator> >(); _Reverse_iterator __i = __c.rbegin(); __i = __c.rend(); } _ReversibleContainer __c; }; template <class _RandomAccessContainer> struct _RandomAccessContainerConcept { typedef typename _RandomAccessContainer::size_type _Size_type; typedef typename _RandomAccessContainer::const_reference _Const_reference; typedef typename _RandomAccessContainer::const_iterator _Const_iterator; typedef typename _RandomAccessContainer::const_reverse_iterator _Const_reverse_iterator; void __constraints() { __function_requires< _ReversibleContainerConcept<_RandomAccessContainer> >(); __function_requires< _RandomAccessIteratorConcept<_Const_iterator> >(); __function_requires< _RandomAccessIteratorConcept<_Const_reverse_iterator> >(); const _RandomAccessContainer __c; _Const_reference __r _IsUnused = __c[__n]; } _Size_type __n; }; template <class _RandomAccessContainer> struct _Mutable_RandomAccessContainerConcept { typedef typename _RandomAccessContainer::size_type _Size_type; typedef typename _RandomAccessContainer::reference _Reference; typedef typename _RandomAccessContainer::iterator _Iterator; typedef typename _RandomAccessContainer::reverse_iterator _Reverse_iterator; void __constraints() { __function_requires< _RandomAccessContainerConcept<_RandomAccessContainer> >(); __function_requires< _Mutable_ReversibleContainerConcept<_RandomAccessContainer> >(); __function_requires< _Mutable_RandomAccessIteratorConcept<_Iterator> >(); __function_requires< _Mutable_RandomAccessIteratorConcept<_Reverse_iterator> >(); _Reference __r _IsUnused = __c[__i]; } _Size_type __i; _RandomAccessContainer __c; }; // A Sequence is inherently mutable template <class _Sequence> struct _SequenceConcept { typedef typename _Sequence::reference _Reference; typedef typename _Sequence::const_reference _Const_reference; void __constraints() { // Matt Austern's book puts DefaultConstructible here, the C++ // standard places it in Container // function_requires< DefaultConstructible<Sequence> >(); __function_requires< _Mutable_ForwardContainerConcept<_Sequence> >(); __function_requires< _DefaultConstructibleConcept<_Sequence> >(); _Sequence __c _IsUnused(__n, __t), __c2 _IsUnused(__first, __last); __c.insert(__p, __t); __c.insert(__p, __n, __t); __c.insert(__p, __first, __last); __c.erase(__p); __c.erase(__p, __q); _Reference __r _IsUnused = __c.front(); __const_constraints(__c); } void __const_constraints(const _Sequence& __c) { _Const_reference __r _IsUnused = __c.front(); } typename _Sequence::value_type __t; typename _Sequence::size_type __n; typename _Sequence::value_type *__first, *__last; typename _Sequence::iterator __p, __q; }; template <class _FrontInsertionSequence> struct _FrontInsertionSequenceConcept { void __constraints() { __function_requires< _SequenceConcept<_FrontInsertionSequence> >(); __c.push_front(__t); __c.pop_front(); } _FrontInsertionSequence __c; typename _FrontInsertionSequence::value_type __t; }; template <class _BackInsertionSequence> struct _BackInsertionSequenceConcept { typedef typename _BackInsertionSequence::reference _Reference; typedef typename _BackInsertionSequence::const_reference _Const_reference; void __constraints() { __function_requires< _SequenceConcept<_BackInsertionSequence> >(); __c.push_back(__t); __c.pop_back(); _Reference __r _IsUnused = __c.back(); } void __const_constraints(const _BackInsertionSequence& __c) { _Const_reference __r _IsUnused = __c.back(); }; _BackInsertionSequence __c; typename _BackInsertionSequence::value_type __t; }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #undef _IsUnused #endif // _GLIBCXX_BOOST_CONCEPT_CHECK ����������������������������������������������������������������������������������������c++/4.8.2/bits/basic_string.tcc���������������������������������������������������������������������0000644�����������������00000114671�14763166030�0011710 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Components for manipulating sequences of characters -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/basic_string.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{string} */ // // ISO C++ 14882: 21 Strings library // // Written by Jason Merrill based upon the specification by Takanori Adachi // in ANSI X3J16/94-0013R2. Rewritten by Nathan Myers to ISO-14882. #ifndef _BASIC_STRING_TCC #define _BASIC_STRING_TCC 1 #pragma GCC system_header #include <bits/cxxabi_forced.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _CharT, typename _Traits, typename _Alloc> const typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: _Rep::_S_max_size = (((npos - sizeof(_Rep_base))/sizeof(_CharT)) - 1) / 4; template<typename _CharT, typename _Traits, typename _Alloc> const _CharT basic_string<_CharT, _Traits, _Alloc>:: _Rep::_S_terminal = _CharT(); template<typename _CharT, typename _Traits, typename _Alloc> const typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>::npos; // Linker sets _S_empty_rep_storage to all 0s (one reference, empty string) // at static init time (before static ctors are run). template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_empty_rep_storage[ (sizeof(_Rep_base) + sizeof(_CharT) + sizeof(size_type) - 1) / sizeof(size_type)]; // NB: This is the special case for Input Iterators, used in // istreambuf_iterators, etc. // Input Iterators have a cost structure very different from // pointers, calling for a different coding style. template<typename _CharT, typename _Traits, typename _Alloc> template<typename _InIterator> _CharT* basic_string<_CharT, _Traits, _Alloc>:: _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a, input_iterator_tag) { #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 if (__beg == __end && __a == _Alloc()) return _S_empty_rep()._M_refdata(); #endif // Avoid reallocation for common case. _CharT __buf[128]; size_type __len = 0; while (__beg != __end && __len < sizeof(__buf) / sizeof(_CharT)) { __buf[__len++] = *__beg; ++__beg; } _Rep* __r = _Rep::_S_create(__len, size_type(0), __a); _M_copy(__r->_M_refdata(), __buf, __len); __try { while (__beg != __end) { if (__len == __r->_M_capacity) { // Allocate more space. _Rep* __another = _Rep::_S_create(__len + 1, __len, __a); _M_copy(__another->_M_refdata(), __r->_M_refdata(), __len); __r->_M_destroy(__a); __r = __another; } __r->_M_refdata()[__len++] = *__beg; ++__beg; } } __catch(...) { __r->_M_destroy(__a); __throw_exception_again; } __r->_M_set_length_and_sharable(__len); return __r->_M_refdata(); } template<typename _CharT, typename _Traits, typename _Alloc> template <typename _InIterator> _CharT* basic_string<_CharT, _Traits, _Alloc>:: _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a, forward_iterator_tag) { #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 if (__beg == __end && __a == _Alloc()) return _S_empty_rep()._M_refdata(); #endif // NB: Not required, but considered best practice. if (__gnu_cxx::__is_null_pointer(__beg) && __beg != __end) __throw_logic_error(__N("basic_string::_S_construct null not valid")); const size_type __dnew = static_cast<size_type>(std::distance(__beg, __end)); // Check for out_of_range and length_error exceptions. _Rep* __r = _Rep::_S_create(__dnew, size_type(0), __a); __try { _S_copy_chars(__r->_M_refdata(), __beg, __end); } __catch(...) { __r->_M_destroy(__a); __throw_exception_again; } __r->_M_set_length_and_sharable(__dnew); return __r->_M_refdata(); } template<typename _CharT, typename _Traits, typename _Alloc> _CharT* basic_string<_CharT, _Traits, _Alloc>:: _S_construct(size_type __n, _CharT __c, const _Alloc& __a) { #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 if (__n == 0 && __a == _Alloc()) return _S_empty_rep()._M_refdata(); #endif // Check for out_of_range and length_error exceptions. _Rep* __r = _Rep::_S_create(__n, size_type(0), __a); if (__n) _M_assign(__r->_M_refdata(), __n, __c); __r->_M_set_length_and_sharable(__n); return __r->_M_refdata(); } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(const basic_string& __str) : _M_dataplus(__str._M_rep()->_M_grab(_Alloc(__str.get_allocator()), __str.get_allocator()), __str.get_allocator()) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(const _Alloc& __a) : _M_dataplus(_S_construct(size_type(), _CharT(), __a), __a) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(const basic_string& __str, size_type __pos, size_type __n) : _M_dataplus(_S_construct(__str._M_data() + __str._M_check(__pos, "basic_string::basic_string"), __str._M_data() + __str._M_limit(__pos, __n) + __pos, _Alloc()), _Alloc()) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(const basic_string& __str, size_type __pos, size_type __n, const _Alloc& __a) : _M_dataplus(_S_construct(__str._M_data() + __str._M_check(__pos, "basic_string::basic_string"), __str._M_data() + __str._M_limit(__pos, __n) + __pos, __a), __a) { } // TBD: DPG annotate template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(const _CharT* __s, size_type __n, const _Alloc& __a) : _M_dataplus(_S_construct(__s, __s + __n, __a), __a) { } // TBD: DPG annotate template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(const _CharT* __s, const _Alloc& __a) : _M_dataplus(_S_construct(__s, __s ? __s + traits_type::length(__s) : __s + npos, __a), __a) { } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(size_type __n, _CharT __c, const _Alloc& __a) : _M_dataplus(_S_construct(__n, __c, __a), __a) { } // TBD: DPG annotate template<typename _CharT, typename _Traits, typename _Alloc> template<typename _InputIterator> basic_string<_CharT, _Traits, _Alloc>:: basic_string(_InputIterator __beg, _InputIterator __end, const _Alloc& __a) : _M_dataplus(_S_construct(__beg, __end, __a), __a) { } #if __cplusplus >= 201103L template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: basic_string(initializer_list<_CharT> __l, const _Alloc& __a) : _M_dataplus(_S_construct(__l.begin(), __l.end(), __a), __a) { } #endif template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: assign(const basic_string& __str) { if (_M_rep() != __str._M_rep()) { // XXX MT const allocator_type __a = this->get_allocator(); _CharT* __tmp = __str._M_rep()->_M_grab(__a, __str.get_allocator()); _M_rep()->_M_dispose(__a); _M_data(__tmp); } return *this; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: assign(const _CharT* __s, size_type __n) { __glibcxx_requires_string_len(__s, __n); _M_check_length(this->size(), __n, "basic_string::assign"); if (_M_disjunct(__s) || _M_rep()->_M_is_shared()) return _M_replace_safe(size_type(0), this->size(), __s, __n); else { // Work in-place. const size_type __pos = __s - _M_data(); if (__pos >= __n) _M_copy(_M_data(), __s, __n); else if (__pos) _M_move(_M_data(), __s, __n); _M_rep()->_M_set_length_and_sharable(__n); return *this; } } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: append(size_type __n, _CharT __c) { if (__n) { _M_check_length(size_type(0), __n, "basic_string::append"); const size_type __len = __n + this->size(); if (__len > this->capacity() || _M_rep()->_M_is_shared()) this->reserve(__len); _M_assign(_M_data() + this->size(), __n, __c); _M_rep()->_M_set_length_and_sharable(__len); } return *this; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: append(const _CharT* __s, size_type __n) { __glibcxx_requires_string_len(__s, __n); if (__n) { _M_check_length(size_type(0), __n, "basic_string::append"); const size_type __len = __n + this->size(); if (__len > this->capacity() || _M_rep()->_M_is_shared()) { if (_M_disjunct(__s)) this->reserve(__len); else { const size_type __off = __s - _M_data(); this->reserve(__len); __s = _M_data() + __off; } } _M_copy(_M_data() + this->size(), __s, __n); _M_rep()->_M_set_length_and_sharable(__len); } return *this; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: append(const basic_string& __str) { const size_type __size = __str.size(); if (__size) { const size_type __len = __size + this->size(); if (__len > this->capacity() || _M_rep()->_M_is_shared()) this->reserve(__len); _M_copy(_M_data() + this->size(), __str._M_data(), __size); _M_rep()->_M_set_length_and_sharable(__len); } return *this; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: append(const basic_string& __str, size_type __pos, size_type __n) { __str._M_check(__pos, "basic_string::append"); __n = __str._M_limit(__pos, __n); if (__n) { const size_type __len = __n + this->size(); if (__len > this->capacity() || _M_rep()->_M_is_shared()) this->reserve(__len); _M_copy(_M_data() + this->size(), __str._M_data() + __pos, __n); _M_rep()->_M_set_length_and_sharable(__len); } return *this; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: insert(size_type __pos, const _CharT* __s, size_type __n) { __glibcxx_requires_string_len(__s, __n); _M_check(__pos, "basic_string::insert"); _M_check_length(size_type(0), __n, "basic_string::insert"); if (_M_disjunct(__s) || _M_rep()->_M_is_shared()) return _M_replace_safe(__pos, size_type(0), __s, __n); else { // Work in-place. const size_type __off = __s - _M_data(); _M_mutate(__pos, 0, __n); __s = _M_data() + __off; _CharT* __p = _M_data() + __pos; if (__s + __n <= __p) _M_copy(__p, __s, __n); else if (__s >= __p) _M_copy(__p, __s + __n, __n); else { const size_type __nleft = __p - __s; _M_copy(__p, __s, __nleft); _M_copy(__p + __nleft, __p + __n, __n - __nleft); } return *this; } } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::iterator basic_string<_CharT, _Traits, _Alloc>:: erase(iterator __first, iterator __last) { _GLIBCXX_DEBUG_PEDASSERT(__first >= _M_ibegin() && __first <= __last && __last <= _M_iend()); // NB: This isn't just an optimization (bail out early when // there is nothing to do, really), it's also a correctness // issue vs MT, see libstdc++/40518. const size_type __size = __last - __first; if (__size) { const size_type __pos = __first - _M_ibegin(); _M_mutate(__pos, __size, size_type(0)); _M_rep()->_M_set_leaked(); return iterator(_M_data() + __pos); } else return __first; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) { __glibcxx_requires_string_len(__s, __n2); _M_check(__pos, "basic_string::replace"); __n1 = _M_limit(__pos, __n1); _M_check_length(__n1, __n2, "basic_string::replace"); bool __left; if (_M_disjunct(__s) || _M_rep()->_M_is_shared()) return _M_replace_safe(__pos, __n1, __s, __n2); else if ((__left = __s + __n2 <= _M_data() + __pos) || _M_data() + __pos + __n1 <= __s) { // Work in-place: non-overlapping case. size_type __off = __s - _M_data(); __left ? __off : (__off += __n2 - __n1); _M_mutate(__pos, __n1, __n2); _M_copy(_M_data() + __pos, _M_data() + __off, __n2); return *this; } else { // Todo: overlapping case. const basic_string __tmp(__s, __n2); return _M_replace_safe(__pos, __n1, __tmp._M_data(), __n2); } } template<typename _CharT, typename _Traits, typename _Alloc> void basic_string<_CharT, _Traits, _Alloc>::_Rep:: _M_destroy(const _Alloc& __a) throw () { const size_type __size = sizeof(_Rep_base) + (this->_M_capacity + 1) * sizeof(_CharT); _Raw_bytes_alloc(__a).deallocate(reinterpret_cast<char*>(this), __size); } template<typename _CharT, typename _Traits, typename _Alloc> void basic_string<_CharT, _Traits, _Alloc>:: _M_leak_hard() { #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 if (_M_rep() == &_S_empty_rep()) return; #endif if (_M_rep()->_M_is_shared()) _M_mutate(0, 0, 0); _M_rep()->_M_set_leaked(); } template<typename _CharT, typename _Traits, typename _Alloc> void basic_string<_CharT, _Traits, _Alloc>:: _M_mutate(size_type __pos, size_type __len1, size_type __len2) { const size_type __old_size = this->size(); const size_type __new_size = __old_size + __len2 - __len1; const size_type __how_much = __old_size - __pos - __len1; if (__new_size > this->capacity() || _M_rep()->_M_is_shared()) { // Must reallocate. const allocator_type __a = get_allocator(); _Rep* __r = _Rep::_S_create(__new_size, this->capacity(), __a); if (__pos) _M_copy(__r->_M_refdata(), _M_data(), __pos); if (__how_much) _M_copy(__r->_M_refdata() + __pos + __len2, _M_data() + __pos + __len1, __how_much); _M_rep()->_M_dispose(__a); _M_data(__r->_M_refdata()); } else if (__how_much && __len1 != __len2) { // Work in-place. _M_move(_M_data() + __pos + __len2, _M_data() + __pos + __len1, __how_much); } _M_rep()->_M_set_length_and_sharable(__new_size); } template<typename _CharT, typename _Traits, typename _Alloc> void basic_string<_CharT, _Traits, _Alloc>:: reserve(size_type __res) { if (__res != this->capacity() || _M_rep()->_M_is_shared()) { // Make sure we don't shrink below the current size if (__res < this->size()) __res = this->size(); const allocator_type __a = get_allocator(); _CharT* __tmp = _M_rep()->_M_clone(__a, __res - this->size()); _M_rep()->_M_dispose(__a); _M_data(__tmp); } } template<typename _CharT, typename _Traits, typename _Alloc> void basic_string<_CharT, _Traits, _Alloc>:: swap(basic_string& __s) { if (_M_rep()->_M_is_leaked()) _M_rep()->_M_set_sharable(); if (__s._M_rep()->_M_is_leaked()) __s._M_rep()->_M_set_sharable(); if (this->get_allocator() == __s.get_allocator()) { _CharT* __tmp = _M_data(); _M_data(__s._M_data()); __s._M_data(__tmp); } // The code below can usually be optimized away. else { const basic_string __tmp1(_M_ibegin(), _M_iend(), __s.get_allocator()); const basic_string __tmp2(__s._M_ibegin(), __s._M_iend(), this->get_allocator()); *this = __tmp2; __s = __tmp1; } } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::_Rep* basic_string<_CharT, _Traits, _Alloc>::_Rep:: _S_create(size_type __capacity, size_type __old_capacity, const _Alloc& __alloc) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 83. String::npos vs. string::max_size() if (__capacity > _S_max_size) __throw_length_error(__N("basic_string::_S_create")); // The standard places no restriction on allocating more memory // than is strictly needed within this layer at the moment or as // requested by an explicit application call to reserve(). // Many malloc implementations perform quite poorly when an // application attempts to allocate memory in a stepwise fashion // growing each allocation size by only 1 char. Additionally, // it makes little sense to allocate less linear memory than the // natural blocking size of the malloc implementation. // Unfortunately, we would need a somewhat low-level calculation // with tuned parameters to get this perfect for any particular // malloc implementation. Fortunately, generalizations about // common features seen among implementations seems to suffice. // __pagesize need not match the actual VM page size for good // results in practice, thus we pick a common value on the low // side. __malloc_header_size is an estimate of the amount of // overhead per memory allocation (in practice seen N * sizeof // (void*) where N is 0, 2 or 4). According to folklore, // picking this value on the high side is better than // low-balling it (especially when this algorithm is used with // malloc implementations that allocate memory blocks rounded up // to a size which is a power of 2). const size_type __pagesize = 4096; const size_type __malloc_header_size = 4 * sizeof(void*); // The below implements an exponential growth policy, necessary to // meet amortized linear time requirements of the library: see // http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html. // It's active for allocations requiring an amount of memory above // system pagesize. This is consistent with the requirements of the // standard: http://gcc.gnu.org/ml/libstdc++/2001-07/msg00130.html if (__capacity > __old_capacity && __capacity < 2 * __old_capacity) __capacity = 2 * __old_capacity; // NB: Need an array of char_type[__capacity], plus a terminating // null char_type() element, plus enough for the _Rep data structure. // Whew. Seemingly so needy, yet so elemental. size_type __size = (__capacity + 1) * sizeof(_CharT) + sizeof(_Rep); const size_type __adj_size = __size + __malloc_header_size; if (__adj_size > __pagesize && __capacity > __old_capacity) { const size_type __extra = __pagesize - __adj_size % __pagesize; __capacity += __extra / sizeof(_CharT); // Never allocate a string bigger than _S_max_size. if (__capacity > _S_max_size) __capacity = _S_max_size; __size = (__capacity + 1) * sizeof(_CharT) + sizeof(_Rep); } // NB: Might throw, but no worries about a leak, mate: _Rep() // does not throw. void* __place = _Raw_bytes_alloc(__alloc).allocate(__size); _Rep *__p = new (__place) _Rep; __p->_M_capacity = __capacity; // ABI compatibility - 3.4.x set in _S_create both // _M_refcount and _M_length. All callers of _S_create // in basic_string.tcc then set just _M_length. // In 4.0.x and later both _M_refcount and _M_length // are initialized in the callers, unfortunately we can // have 3.4.x compiled code with _S_create callers inlined // calling 4.0.x+ _S_create. __p->_M_set_sharable(); return __p; } template<typename _CharT, typename _Traits, typename _Alloc> _CharT* basic_string<_CharT, _Traits, _Alloc>::_Rep:: _M_clone(const _Alloc& __alloc, size_type __res) { // Requested capacity of the clone. const size_type __requested_cap = this->_M_length + __res; _Rep* __r = _Rep::_S_create(__requested_cap, this->_M_capacity, __alloc); if (this->_M_length) _M_copy(__r->_M_refdata(), _M_refdata(), this->_M_length); __r->_M_set_length_and_sharable(this->_M_length); return __r->_M_refdata(); } template<typename _CharT, typename _Traits, typename _Alloc> void basic_string<_CharT, _Traits, _Alloc>:: resize(size_type __n, _CharT __c) { const size_type __size = this->size(); _M_check_length(__size, __n, "basic_string::resize"); if (__size < __n) this->append(__n - __size, __c); else if (__n < __size) this->erase(__n); // else nothing (in particular, avoid calling _M_mutate() unnecessarily.) } template<typename _CharT, typename _Traits, typename _Alloc> template<typename _InputIterator> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1, _InputIterator __k2, __false_type) { const basic_string __s(__k1, __k2); const size_type __n1 = __i2 - __i1; _M_check_length(__n1, __s.size(), "basic_string::_M_replace_dispatch"); return _M_replace_safe(__i1 - _M_ibegin(), __n1, __s._M_data(), __s.size()); } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, _CharT __c) { _M_check_length(__n1, __n2, "basic_string::_M_replace_aux"); _M_mutate(__pos1, __n1, __n2); if (__n2) _M_assign(_M_data() + __pos1, __n2, __c); return *this; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: _M_replace_safe(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) { _M_mutate(__pos1, __n1, __n2); if (__n2) _M_copy(_M_data() + __pos1, __s, __n2); return *this; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc> operator+(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { __glibcxx_requires_string(__lhs); typedef basic_string<_CharT, _Traits, _Alloc> __string_type; typedef typename __string_type::size_type __size_type; const __size_type __len = _Traits::length(__lhs); __string_type __str; __str.reserve(__len + __rhs.size()); __str.append(__lhs, __len); __str.append(__rhs); return __str; } template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc> operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { typedef basic_string<_CharT, _Traits, _Alloc> __string_type; typedef typename __string_type::size_type __size_type; __string_type __str; const __size_type __len = __rhs.size(); __str.reserve(__len + 1); __str.append(__size_type(1), __lhs); __str.append(__rhs); return __str; } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: copy(_CharT* __s, size_type __n, size_type __pos) const { _M_check(__pos, "basic_string::copy"); __n = _M_limit(__pos, __n); __glibcxx_requires_string_len(__s, __n); if (__n) _M_copy(__s, _M_data() + __pos, __n); // 21.3.5.7 par 3: do not append null. (good.) return __n; } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: find(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_requires_string_len(__s, __n); const size_type __size = this->size(); const _CharT* __data = _M_data(); if (__n == 0) return __pos <= __size ? __pos : npos; if (__n <= __size) { for (; __pos <= __size - __n; ++__pos) if (traits_type::eq(__data[__pos], __s[0]) && traits_type::compare(__data + __pos + 1, __s + 1, __n - 1) == 0) return __pos; } return npos; } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: find(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT { size_type __ret = npos; const size_type __size = this->size(); if (__pos < __size) { const _CharT* __data = _M_data(); const size_type __n = __size - __pos; const _CharT* __p = traits_type::find(__data + __pos, __n, __c); if (__p) __ret = __p - __data; } return __ret; } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: rfind(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_requires_string_len(__s, __n); const size_type __size = this->size(); if (__n <= __size) { __pos = std::min(size_type(__size - __n), __pos); const _CharT* __data = _M_data(); do { if (traits_type::compare(__data + __pos, __s, __n) == 0) return __pos; } while (__pos-- > 0); } return npos; } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: rfind(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT { size_type __size = this->size(); if (__size) { if (--__size > __pos) __size = __pos; for (++__size; __size-- > 0; ) if (traits_type::eq(_M_data()[__size], __c)) return __size; } return npos; } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: find_first_of(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_requires_string_len(__s, __n); for (; __n && __pos < this->size(); ++__pos) { const _CharT* __p = traits_type::find(__s, __n, _M_data()[__pos]); if (__p) return __pos; } return npos; } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: find_last_of(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_requires_string_len(__s, __n); size_type __size = this->size(); if (__size && __n) { if (--__size > __pos) __size = __pos; do { if (traits_type::find(__s, __n, _M_data()[__size])) return __size; } while (__size-- != 0); } return npos; } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_requires_string_len(__s, __n); for (; __pos < this->size(); ++__pos) if (!traits_type::find(__s, __n, _M_data()[__pos])) return __pos; return npos; } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: find_first_not_of(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT { for (; __pos < this->size(); ++__pos) if (!traits_type::eq(_M_data()[__pos], __c)) return __pos; return npos; } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const { __glibcxx_requires_string_len(__s, __n); size_type __size = this->size(); if (__size) { if (--__size > __pos) __size = __pos; do { if (!traits_type::find(__s, __n, _M_data()[__size])) return __size; } while (__size--); } return npos; } template<typename _CharT, typename _Traits, typename _Alloc> typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: find_last_not_of(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT { size_type __size = this->size(); if (__size) { if (--__size > __pos) __size = __pos; do { if (!traits_type::eq(_M_data()[__size], __c)) return __size; } while (__size--); } return npos; } template<typename _CharT, typename _Traits, typename _Alloc> int basic_string<_CharT, _Traits, _Alloc>:: compare(size_type __pos, size_type __n, const basic_string& __str) const { _M_check(__pos, "basic_string::compare"); __n = _M_limit(__pos, __n); const size_type __osize = __str.size(); const size_type __len = std::min(__n, __osize); int __r = traits_type::compare(_M_data() + __pos, __str.data(), __len); if (!__r) __r = _S_compare(__n, __osize); return __r; } template<typename _CharT, typename _Traits, typename _Alloc> int basic_string<_CharT, _Traits, _Alloc>:: compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const { _M_check(__pos1, "basic_string::compare"); __str._M_check(__pos2, "basic_string::compare"); __n1 = _M_limit(__pos1, __n1); __n2 = __str._M_limit(__pos2, __n2); const size_type __len = std::min(__n1, __n2); int __r = traits_type::compare(_M_data() + __pos1, __str.data() + __pos2, __len); if (!__r) __r = _S_compare(__n1, __n2); return __r; } template<typename _CharT, typename _Traits, typename _Alloc> int basic_string<_CharT, _Traits, _Alloc>:: compare(const _CharT* __s) const { __glibcxx_requires_string(__s); const size_type __size = this->size(); const size_type __osize = traits_type::length(__s); const size_type __len = std::min(__size, __osize); int __r = traits_type::compare(_M_data(), __s, __len); if (!__r) __r = _S_compare(__size, __osize); return __r; } template<typename _CharT, typename _Traits, typename _Alloc> int basic_string <_CharT, _Traits, _Alloc>:: compare(size_type __pos, size_type __n1, const _CharT* __s) const { __glibcxx_requires_string(__s); _M_check(__pos, "basic_string::compare"); __n1 = _M_limit(__pos, __n1); const size_type __osize = traits_type::length(__s); const size_type __len = std::min(__n1, __osize); int __r = traits_type::compare(_M_data() + __pos, __s, __len); if (!__r) __r = _S_compare(__n1, __osize); return __r; } template<typename _CharT, typename _Traits, typename _Alloc> int basic_string <_CharT, _Traits, _Alloc>:: compare(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) const { __glibcxx_requires_string_len(__s, __n2); _M_check(__pos, "basic_string::compare"); __n1 = _M_limit(__pos, __n1); const size_type __len = std::min(__n1, __n2); int __r = traits_type::compare(_M_data() + __pos, __s, __len); if (!__r) __r = _S_compare(__n1, __n2); return __r; } // 21.3.7.9 basic_string::getline and operators template<typename _CharT, typename _Traits, typename _Alloc> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __in, basic_string<_CharT, _Traits, _Alloc>& __str) { typedef basic_istream<_CharT, _Traits> __istream_type; typedef basic_string<_CharT, _Traits, _Alloc> __string_type; typedef typename __istream_type::ios_base __ios_base; typedef typename __istream_type::int_type __int_type; typedef typename __string_type::size_type __size_type; typedef ctype<_CharT> __ctype_type; typedef typename __ctype_type::ctype_base __ctype_base; __size_type __extracted = 0; typename __ios_base::iostate __err = __ios_base::goodbit; typename __istream_type::sentry __cerb(__in, false); if (__cerb) { __try { // Avoid reallocation for common case. __str.erase(); _CharT __buf[128]; __size_type __len = 0; const streamsize __w = __in.width(); const __size_type __n = __w > 0 ? static_cast<__size_type>(__w) : __str.max_size(); const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc()); const __int_type __eof = _Traits::eof(); __int_type __c = __in.rdbuf()->sgetc(); while (__extracted < __n && !_Traits::eq_int_type(__c, __eof) && !__ct.is(__ctype_base::space, _Traits::to_char_type(__c))) { if (__len == sizeof(__buf) / sizeof(_CharT)) { __str.append(__buf, sizeof(__buf) / sizeof(_CharT)); __len = 0; } __buf[__len++] = _Traits::to_char_type(__c); ++__extracted; __c = __in.rdbuf()->snextc(); } __str.append(__buf, __len); if (_Traits::eq_int_type(__c, __eof)) __err |= __ios_base::eofbit; __in.width(0); } __catch(__cxxabiv1::__forced_unwind&) { __in._M_setstate(__ios_base::badbit); __throw_exception_again; } __catch(...) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 91. Description of operator>> and getline() for string<> // might cause endless loop __in._M_setstate(__ios_base::badbit); } } // 211. operator>>(istream&, string&) doesn't set failbit if (!__extracted) __err |= __ios_base::failbit; if (__err) __in.setstate(__err); return __in; } template<typename _CharT, typename _Traits, typename _Alloc> basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>& __in, basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim) { typedef basic_istream<_CharT, _Traits> __istream_type; typedef basic_string<_CharT, _Traits, _Alloc> __string_type; typedef typename __istream_type::ios_base __ios_base; typedef typename __istream_type::int_type __int_type; typedef typename __string_type::size_type __size_type; __size_type __extracted = 0; const __size_type __n = __str.max_size(); typename __ios_base::iostate __err = __ios_base::goodbit; typename __istream_type::sentry __cerb(__in, true); if (__cerb) { __try { __str.erase(); const __int_type __idelim = _Traits::to_int_type(__delim); const __int_type __eof = _Traits::eof(); __int_type __c = __in.rdbuf()->sgetc(); while (__extracted < __n && !_Traits::eq_int_type(__c, __eof) && !_Traits::eq_int_type(__c, __idelim)) { __str += _Traits::to_char_type(__c); ++__extracted; __c = __in.rdbuf()->snextc(); } if (_Traits::eq_int_type(__c, __eof)) __err |= __ios_base::eofbit; else if (_Traits::eq_int_type(__c, __idelim)) { ++__extracted; __in.rdbuf()->sbumpc(); } else __err |= __ios_base::failbit; } __catch(__cxxabiv1::__forced_unwind&) { __in._M_setstate(__ios_base::badbit); __throw_exception_again; } __catch(...) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 91. Description of operator>> and getline() for string<> // might cause endless loop __in._M_setstate(__ios_base::badbit); } } if (!__extracted) __err |= __ios_base::failbit; if (__err) __in.setstate(__err); return __in; } // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. #if _GLIBCXX_EXTERN_TEMPLATE > 0 extern template class basic_string<char>; extern template basic_istream<char>& operator>>(basic_istream<char>&, string&); extern template basic_ostream<char>& operator<<(basic_ostream<char>&, const string&); extern template basic_istream<char>& getline(basic_istream<char>&, string&, char); extern template basic_istream<char>& getline(basic_istream<char>&, string&); #ifdef _GLIBCXX_USE_WCHAR_T extern template class basic_string<wchar_t>; extern template basic_istream<wchar_t>& operator>>(basic_istream<wchar_t>&, wstring&); extern template basic_ostream<wchar_t>& operator<<(basic_ostream<wchar_t>&, const wstring&); extern template basic_istream<wchar_t>& getline(basic_istream<wchar_t>&, wstring&, wchar_t); extern template basic_istream<wchar_t>& getline(basic_istream<wchar_t>&, wstring&); #endif #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif �����������������������������������������������������������������������c++/4.8.2/bits/valarray_after.h���������������������������������������������������������������������0000644�����������������00000054177�14763166030�0011725 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// The template and inlines for the -*- C++ -*- internal _Meta class. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/valarray_after.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{valarray} */ // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr> #ifndef _VALARRAY_AFTER_H #define _VALARRAY_AFTER_H 1 #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // // gslice_array closure. // template<class _Dom> class _GBase { public: typedef typename _Dom::value_type value_type; _GBase (const _Dom& __e, const valarray<size_t>& __i) : _M_expr (__e), _M_index(__i) {} value_type operator[] (size_t __i) const { return _M_expr[_M_index[__i]]; } size_t size () const { return _M_index.size(); } private: const _Dom& _M_expr; const valarray<size_t>& _M_index; }; template<typename _Tp> class _GBase<_Array<_Tp> > { public: typedef _Tp value_type; _GBase (_Array<_Tp> __a, const valarray<size_t>& __i) : _M_array (__a), _M_index(__i) {} value_type operator[] (size_t __i) const { return _M_array._M_data[_M_index[__i]]; } size_t size () const { return _M_index.size(); } private: const _Array<_Tp> _M_array; const valarray<size_t>& _M_index; }; template<class _Dom> struct _GClos<_Expr, _Dom> : _GBase<_Dom> { typedef _GBase<_Dom> _Base; typedef typename _Base::value_type value_type; _GClos (const _Dom& __e, const valarray<size_t>& __i) : _Base (__e, __i) {} }; template<typename _Tp> struct _GClos<_ValArray, _Tp> : _GBase<_Array<_Tp> > { typedef _GBase<_Array<_Tp> > _Base; typedef typename _Base::value_type value_type; _GClos (_Array<_Tp> __a, const valarray<size_t>& __i) : _Base (__a, __i) {} }; // // indirect_array closure // template<class _Dom> class _IBase { public: typedef typename _Dom::value_type value_type; _IBase (const _Dom& __e, const valarray<size_t>& __i) : _M_expr (__e), _M_index (__i) {} value_type operator[] (size_t __i) const { return _M_expr[_M_index[__i]]; } size_t size() const { return _M_index.size(); } private: const _Dom& _M_expr; const valarray<size_t>& _M_index; }; template<class _Dom> struct _IClos<_Expr, _Dom> : _IBase<_Dom> { typedef _IBase<_Dom> _Base; typedef typename _Base::value_type value_type; _IClos (const _Dom& __e, const valarray<size_t>& __i) : _Base (__e, __i) {} }; template<typename _Tp> struct _IClos<_ValArray, _Tp> : _IBase<valarray<_Tp> > { typedef _IBase<valarray<_Tp> > _Base; typedef _Tp value_type; _IClos (const valarray<_Tp>& __a, const valarray<size_t>& __i) : _Base (__a, __i) {} }; // // class _Expr // template<class _Clos, typename _Tp> class _Expr { public: typedef _Tp value_type; _Expr(const _Clos&); const _Clos& operator()() const; value_type operator[](size_t) const; valarray<value_type> operator[](slice) const; valarray<value_type> operator[](const gslice&) const; valarray<value_type> operator[](const valarray<bool>&) const; valarray<value_type> operator[](const valarray<size_t>&) const; _Expr<_UnClos<__unary_plus, std::_Expr, _Clos>, value_type> operator+() const; _Expr<_UnClos<__negate, std::_Expr, _Clos>, value_type> operator-() const; _Expr<_UnClos<__bitwise_not, std::_Expr, _Clos>, value_type> operator~() const; _Expr<_UnClos<__logical_not, std::_Expr, _Clos>, bool> operator!() const; size_t size() const; value_type sum() const; valarray<value_type> shift(int) const; valarray<value_type> cshift(int) const; value_type min() const; value_type max() const; valarray<value_type> apply(value_type (*)(const value_type&)) const; valarray<value_type> apply(value_type (*)(value_type)) const; private: const _Clos _M_closure; }; template<class _Clos, typename _Tp> inline _Expr<_Clos, _Tp>::_Expr(const _Clos& __c) : _M_closure(__c) {} template<class _Clos, typename _Tp> inline const _Clos& _Expr<_Clos, _Tp>::operator()() const { return _M_closure; } template<class _Clos, typename _Tp> inline _Tp _Expr<_Clos, _Tp>::operator[](size_t __i) const { return _M_closure[__i]; } template<class _Clos, typename _Tp> inline valarray<_Tp> _Expr<_Clos, _Tp>::operator[](slice __s) const { valarray<_Tp> __v = valarray<_Tp>(*this)[__s]; return __v; } template<class _Clos, typename _Tp> inline valarray<_Tp> _Expr<_Clos, _Tp>::operator[](const gslice& __gs) const { valarray<_Tp> __v = valarray<_Tp>(*this)[__gs]; return __v; } template<class _Clos, typename _Tp> inline valarray<_Tp> _Expr<_Clos, _Tp>::operator[](const valarray<bool>& __m) const { valarray<_Tp> __v = valarray<_Tp>(*this)[__m]; return __v; } template<class _Clos, typename _Tp> inline valarray<_Tp> _Expr<_Clos, _Tp>::operator[](const valarray<size_t>& __i) const { valarray<_Tp> __v = valarray<_Tp>(*this)[__i]; return __v; } template<class _Clos, typename _Tp> inline size_t _Expr<_Clos, _Tp>::size() const { return _M_closure.size(); } template<class _Clos, typename _Tp> inline valarray<_Tp> _Expr<_Clos, _Tp>::shift(int __n) const { valarray<_Tp> __v = valarray<_Tp>(*this).shift(__n); return __v; } template<class _Clos, typename _Tp> inline valarray<_Tp> _Expr<_Clos, _Tp>::cshift(int __n) const { valarray<_Tp> __v = valarray<_Tp>(*this).cshift(__n); return __v; } template<class _Clos, typename _Tp> inline valarray<_Tp> _Expr<_Clos, _Tp>::apply(_Tp __f(const _Tp&)) const { valarray<_Tp> __v = valarray<_Tp>(*this).apply(__f); return __v; } template<class _Clos, typename _Tp> inline valarray<_Tp> _Expr<_Clos, _Tp>::apply(_Tp __f(_Tp)) const { valarray<_Tp> __v = valarray<_Tp>(*this).apply(__f); return __v; } // XXX: replace this with a more robust summation algorithm. template<class _Clos, typename _Tp> inline _Tp _Expr<_Clos, _Tp>::sum() const { size_t __n = _M_closure.size(); if (__n == 0) return _Tp(); else { _Tp __s = _M_closure[--__n]; while (__n != 0) __s += _M_closure[--__n]; return __s; } } template<class _Clos, typename _Tp> inline _Tp _Expr<_Clos, _Tp>::min() const { return __valarray_min(_M_closure); } template<class _Clos, typename _Tp> inline _Tp _Expr<_Clos, _Tp>::max() const { return __valarray_max(_M_closure); } template<class _Dom, typename _Tp> inline _Expr<_UnClos<__logical_not, _Expr, _Dom>, bool> _Expr<_Dom, _Tp>::operator!() const { typedef _UnClos<__logical_not, std::_Expr, _Dom> _Closure; return _Expr<_Closure, bool>(_Closure(this->_M_closure)); } #define _DEFINE_EXPR_UNARY_OPERATOR(_Op, _Name) \ template<class _Dom, typename _Tp> \ inline _Expr<_UnClos<_Name, std::_Expr, _Dom>, _Tp> \ _Expr<_Dom, _Tp>::operator _Op() const \ { \ typedef _UnClos<_Name, std::_Expr, _Dom> _Closure; \ return _Expr<_Closure, _Tp>(_Closure(this->_M_closure)); \ } _DEFINE_EXPR_UNARY_OPERATOR(+, __unary_plus) _DEFINE_EXPR_UNARY_OPERATOR(-, __negate) _DEFINE_EXPR_UNARY_OPERATOR(~, __bitwise_not) #undef _DEFINE_EXPR_UNARY_OPERATOR #define _DEFINE_EXPR_BINARY_OPERATOR(_Op, _Name) \ template<class _Dom1, class _Dom2> \ inline _Expr<_BinClos<_Name, _Expr, _Expr, _Dom1, _Dom2>, \ typename __fun<_Name, typename _Dom1::value_type>::result_type> \ operator _Op(const _Expr<_Dom1, typename _Dom1::value_type>& __v, \ const _Expr<_Dom2, typename _Dom2::value_type>& __w) \ { \ typedef typename _Dom1::value_type _Arg; \ typedef typename __fun<_Name, _Arg>::result_type _Value; \ typedef _BinClos<_Name, _Expr, _Expr, _Dom1, _Dom2> _Closure; \ return _Expr<_Closure, _Value>(_Closure(__v(), __w())); \ } \ \ template<class _Dom> \ inline _Expr<_BinClos<_Name, _Expr, _Constant, _Dom, \ typename _Dom::value_type>, \ typename __fun<_Name, typename _Dom::value_type>::result_type> \ operator _Op(const _Expr<_Dom, typename _Dom::value_type>& __v, \ const typename _Dom::value_type& __t) \ { \ typedef typename _Dom::value_type _Arg; \ typedef typename __fun<_Name, _Arg>::result_type _Value; \ typedef _BinClos<_Name, _Expr, _Constant, _Dom, _Arg> _Closure; \ return _Expr<_Closure, _Value>(_Closure(__v(), __t)); \ } \ \ template<class _Dom> \ inline _Expr<_BinClos<_Name, _Constant, _Expr, \ typename _Dom::value_type, _Dom>, \ typename __fun<_Name, typename _Dom::value_type>::result_type> \ operator _Op(const typename _Dom::value_type& __t, \ const _Expr<_Dom, typename _Dom::value_type>& __v) \ { \ typedef typename _Dom::value_type _Arg; \ typedef typename __fun<_Name, _Arg>::result_type _Value; \ typedef _BinClos<_Name, _Constant, _Expr, _Arg, _Dom> _Closure; \ return _Expr<_Closure, _Value>(_Closure(__t, __v())); \ } \ \ template<class _Dom> \ inline _Expr<_BinClos<_Name, _Expr, _ValArray, \ _Dom, typename _Dom::value_type>, \ typename __fun<_Name, typename _Dom::value_type>::result_type> \ operator _Op(const _Expr<_Dom,typename _Dom::value_type>& __e, \ const valarray<typename _Dom::value_type>& __v) \ { \ typedef typename _Dom::value_type _Arg; \ typedef typename __fun<_Name, _Arg>::result_type _Value; \ typedef _BinClos<_Name, _Expr, _ValArray, _Dom, _Arg> _Closure; \ return _Expr<_Closure, _Value>(_Closure(__e(), __v)); \ } \ \ template<class _Dom> \ inline _Expr<_BinClos<_Name, _ValArray, _Expr, \ typename _Dom::value_type, _Dom>, \ typename __fun<_Name, typename _Dom::value_type>::result_type> \ operator _Op(const valarray<typename _Dom::value_type>& __v, \ const _Expr<_Dom, typename _Dom::value_type>& __e) \ { \ typedef typename _Dom::value_type _Tp; \ typedef typename __fun<_Name, _Tp>::result_type _Value; \ typedef _BinClos<_Name, _ValArray, _Expr, _Tp, _Dom> _Closure; \ return _Expr<_Closure, _Value>(_Closure(__v, __e ())); \ } _DEFINE_EXPR_BINARY_OPERATOR(+, __plus) _DEFINE_EXPR_BINARY_OPERATOR(-, __minus) _DEFINE_EXPR_BINARY_OPERATOR(*, __multiplies) _DEFINE_EXPR_BINARY_OPERATOR(/, __divides) _DEFINE_EXPR_BINARY_OPERATOR(%, __modulus) _DEFINE_EXPR_BINARY_OPERATOR(^, __bitwise_xor) _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and) _DEFINE_EXPR_BINARY_OPERATOR(|, __bitwise_or) _DEFINE_EXPR_BINARY_OPERATOR(<<, __shift_left) _DEFINE_EXPR_BINARY_OPERATOR(>>, __shift_right) _DEFINE_EXPR_BINARY_OPERATOR(&&, __logical_and) _DEFINE_EXPR_BINARY_OPERATOR(||, __logical_or) _DEFINE_EXPR_BINARY_OPERATOR(==, __equal_to) _DEFINE_EXPR_BINARY_OPERATOR(!=, __not_equal_to) _DEFINE_EXPR_BINARY_OPERATOR(<, __less) _DEFINE_EXPR_BINARY_OPERATOR(>, __greater) _DEFINE_EXPR_BINARY_OPERATOR(<=, __less_equal) _DEFINE_EXPR_BINARY_OPERATOR(>=, __greater_equal) #undef _DEFINE_EXPR_BINARY_OPERATOR #define _DEFINE_EXPR_UNARY_FUNCTION(_Name, _UName) \ template<class _Dom> \ inline _Expr<_UnClos<_UName, _Expr, _Dom>, \ typename _Dom::value_type> \ _Name(const _Expr<_Dom, typename _Dom::value_type>& __e) \ { \ typedef typename _Dom::value_type _Tp; \ typedef _UnClos<_UName, _Expr, _Dom> _Closure; \ return _Expr<_Closure, _Tp>(_Closure(__e())); \ } \ \ template<typename _Tp> \ inline _Expr<_UnClos<_UName, _ValArray, _Tp>, _Tp> \ _Name(const valarray<_Tp>& __v) \ { \ typedef _UnClos<_UName, _ValArray, _Tp> _Closure; \ return _Expr<_Closure, _Tp>(_Closure(__v)); \ } _DEFINE_EXPR_UNARY_FUNCTION(abs, _Abs) _DEFINE_EXPR_UNARY_FUNCTION(cos, _Cos) _DEFINE_EXPR_UNARY_FUNCTION(acos, _Acos) _DEFINE_EXPR_UNARY_FUNCTION(cosh, _Cosh) _DEFINE_EXPR_UNARY_FUNCTION(sin, _Sin) _DEFINE_EXPR_UNARY_FUNCTION(asin, _Asin) _DEFINE_EXPR_UNARY_FUNCTION(sinh, _Sinh) _DEFINE_EXPR_UNARY_FUNCTION(tan, _Tan) _DEFINE_EXPR_UNARY_FUNCTION(tanh, _Tanh) _DEFINE_EXPR_UNARY_FUNCTION(atan, _Atan) _DEFINE_EXPR_UNARY_FUNCTION(exp, _Exp) _DEFINE_EXPR_UNARY_FUNCTION(log, _Log) _DEFINE_EXPR_UNARY_FUNCTION(log10, _Log10) _DEFINE_EXPR_UNARY_FUNCTION(sqrt, _Sqrt) #undef _DEFINE_EXPR_UNARY_FUNCTION #define _DEFINE_EXPR_BINARY_FUNCTION(_Fun, _UFun) \ template<class _Dom1, class _Dom2> \ inline _Expr<_BinClos<_UFun, _Expr, _Expr, _Dom1, _Dom2>, \ typename _Dom1::value_type> \ _Fun(const _Expr<_Dom1, typename _Dom1::value_type>& __e1, \ const _Expr<_Dom2, typename _Dom2::value_type>& __e2) \ { \ typedef typename _Dom1::value_type _Tp; \ typedef _BinClos<_UFun, _Expr, _Expr, _Dom1, _Dom2> _Closure; \ return _Expr<_Closure, _Tp>(_Closure(__e1(), __e2())); \ } \ \ template<class _Dom> \ inline _Expr<_BinClos<_UFun, _Expr, _ValArray, _Dom, \ typename _Dom::value_type>, \ typename _Dom::value_type> \ _Fun(const _Expr<_Dom, typename _Dom::value_type>& __e, \ const valarray<typename _Dom::value_type>& __v) \ { \ typedef typename _Dom::value_type _Tp; \ typedef _BinClos<_UFun, _Expr, _ValArray, _Dom, _Tp> _Closure; \ return _Expr<_Closure, _Tp>(_Closure(__e(), __v)); \ } \ \ template<class _Dom> \ inline _Expr<_BinClos<_UFun, _ValArray, _Expr, \ typename _Dom::value_type, _Dom>, \ typename _Dom::value_type> \ _Fun(const valarray<typename _Dom::valarray>& __v, \ const _Expr<_Dom, typename _Dom::value_type>& __e) \ { \ typedef typename _Dom::value_type _Tp; \ typedef _BinClos<_UFun, _ValArray, _Expr, _Tp, _Dom> _Closure; \ return _Expr<_Closure, _Tp>(_Closure(__v, __e())); \ } \ \ template<class _Dom> \ inline _Expr<_BinClos<_UFun, _Expr, _Constant, _Dom, \ typename _Dom::value_type>, \ typename _Dom::value_type> \ _Fun(const _Expr<_Dom, typename _Dom::value_type>& __e, \ const typename _Dom::value_type& __t) \ { \ typedef typename _Dom::value_type _Tp; \ typedef _BinClos<_UFun, _Expr, _Constant, _Dom, _Tp> _Closure; \ return _Expr<_Closure, _Tp>(_Closure(__e(), __t)); \ } \ \ template<class _Dom> \ inline _Expr<_BinClos<_UFun, _Constant, _Expr, \ typename _Dom::value_type, _Dom>, \ typename _Dom::value_type> \ _Fun(const typename _Dom::value_type& __t, \ const _Expr<_Dom, typename _Dom::value_type>& __e) \ { \ typedef typename _Dom::value_type _Tp; \ typedef _BinClos<_UFun, _Constant, _Expr, _Tp, _Dom> _Closure; \ return _Expr<_Closure, _Tp>(_Closure(__t, __e())); \ } \ \ template<typename _Tp> \ inline _Expr<_BinClos<_UFun, _ValArray, _ValArray, _Tp, _Tp>, _Tp> \ _Fun(const valarray<_Tp>& __v, const valarray<_Tp>& __w) \ { \ typedef _BinClos<_UFun, _ValArray, _ValArray, _Tp, _Tp> _Closure;\ return _Expr<_Closure, _Tp>(_Closure(__v, __w)); \ } \ \ template<typename _Tp> \ inline _Expr<_BinClos<_UFun, _ValArray, _Constant, _Tp, _Tp>, _Tp> \ _Fun(const valarray<_Tp>& __v, const _Tp& __t) \ { \ typedef _BinClos<_UFun, _ValArray, _Constant, _Tp, _Tp> _Closure;\ return _Expr<_Closure, _Tp>(_Closure(__v, __t)); \ } \ \ template<typename _Tp> \ inline _Expr<_BinClos<_UFun, _Constant, _ValArray, _Tp, _Tp>, _Tp> \ _Fun(const _Tp& __t, const valarray<_Tp>& __v) \ { \ typedef _BinClos<_UFun, _Constant, _ValArray, _Tp, _Tp> _Closure;\ return _Expr<_Closure, _Tp>(_Closure(__t, __v)); \ } _DEFINE_EXPR_BINARY_FUNCTION(atan2, _Atan2) _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow) #undef _DEFINE_EXPR_BINARY_FUNCTION _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _CPP_VALARRAY_AFTER_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/functional_hash.h��������������������������������������������������������������������0000644�����������������00000014063�14763166030�0012056 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// functional_hash.h header -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/functional_hash.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{functional} */ #ifndef _FUNCTIONAL_HASH_H #define _FUNCTIONAL_HASH_H 1 #pragma GCC system_header #include <bits/hash_bytes.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** @defgroup hashes Hashes * @ingroup functors * * Hashing functors taking a variable type and returning a @c std::size_t. * * @{ */ template<typename _Result, typename _Arg> struct __hash_base { typedef _Result result_type; typedef _Arg argument_type; }; /// Primary class template hash. template<typename _Tp> struct hash; /// Partial specializations for pointer types. template<typename _Tp> struct hash<_Tp*> : public __hash_base<size_t, _Tp*> { size_t operator()(_Tp* __p) const noexcept { return reinterpret_cast<size_t>(__p); } }; // Explicit specializations for integer types. #define _Cxx_hashtable_define_trivial_hash(_Tp) \ template<> \ struct hash<_Tp> : public __hash_base<size_t, _Tp> \ { \ size_t \ operator()(_Tp __val) const noexcept \ { return static_cast<size_t>(__val); } \ }; /// Explicit specialization for bool. _Cxx_hashtable_define_trivial_hash(bool) /// Explicit specialization for char. _Cxx_hashtable_define_trivial_hash(char) /// Explicit specialization for signed char. _Cxx_hashtable_define_trivial_hash(signed char) /// Explicit specialization for unsigned char. _Cxx_hashtable_define_trivial_hash(unsigned char) /// Explicit specialization for wchar_t. _Cxx_hashtable_define_trivial_hash(wchar_t) /// Explicit specialization for char16_t. _Cxx_hashtable_define_trivial_hash(char16_t) /// Explicit specialization for char32_t. _Cxx_hashtable_define_trivial_hash(char32_t) /// Explicit specialization for short. _Cxx_hashtable_define_trivial_hash(short) /// Explicit specialization for int. _Cxx_hashtable_define_trivial_hash(int) /// Explicit specialization for long. _Cxx_hashtable_define_trivial_hash(long) /// Explicit specialization for long long. _Cxx_hashtable_define_trivial_hash(long long) /// Explicit specialization for unsigned short. _Cxx_hashtable_define_trivial_hash(unsigned short) /// Explicit specialization for unsigned int. _Cxx_hashtable_define_trivial_hash(unsigned int) /// Explicit specialization for unsigned long. _Cxx_hashtable_define_trivial_hash(unsigned long) /// Explicit specialization for unsigned long long. _Cxx_hashtable_define_trivial_hash(unsigned long long) #undef _Cxx_hashtable_define_trivial_hash struct _Hash_impl { static size_t hash(const void* __ptr, size_t __clength, size_t __seed = static_cast<size_t>(0xc70f6907UL)) { return _Hash_bytes(__ptr, __clength, __seed); } template<typename _Tp> static size_t hash(const _Tp& __val) { return hash(&__val, sizeof(__val)); } template<typename _Tp> static size_t __hash_combine(const _Tp& __val, size_t __hash) { return hash(&__val, sizeof(__val), __hash); } }; struct _Fnv_hash_impl { static size_t hash(const void* __ptr, size_t __clength, size_t __seed = static_cast<size_t>(2166136261UL)) { return _Fnv_hash_bytes(__ptr, __clength, __seed); } template<typename _Tp> static size_t hash(const _Tp& __val) { return hash(&__val, sizeof(__val)); } template<typename _Tp> static size_t __hash_combine(const _Tp& __val, size_t __hash) { return hash(&__val, sizeof(__val), __hash); } }; /// Specialization for float. template<> struct hash<float> : public __hash_base<size_t, float> { size_t operator()(float __val) const noexcept { // 0 and -0 both hash to zero. return __val != 0.0f ? std::_Hash_impl::hash(__val) : 0; } }; /// Specialization for double. template<> struct hash<double> : public __hash_base<size_t, double> { size_t operator()(double __val) const noexcept { // 0 and -0 both hash to zero. return __val != 0.0 ? std::_Hash_impl::hash(__val) : 0; } }; /// Specialization for long double. template<> struct hash<long double> : public __hash_base<size_t, long double> { _GLIBCXX_PURE size_t operator()(long double __val) const noexcept; }; // @} group hashes // Hint about performance of hash functor. If not fast the hash based // containers will cache the hash code. // Default behavior is to consider that hasher are fast unless specified // otherwise. template<typename _Hash> struct __is_fast_hash : public std::true_type { }; template<> struct __is_fast_hash<hash<long double>> : public std::false_type { }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // _FUNCTIONAL_HASH_H �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/fstream.tcc��������������������������������������������������������������������������0000644�����������������00000070462�14763166030�0010701 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// File based streams -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/fstream.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{fstream} */ // // ISO C++ 14882: 27.8 File-based streams // #ifndef _FSTREAM_TCC #define _FSTREAM_TCC 1 #pragma GCC system_header #include <bits/cxxabi_forced.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _CharT, typename _Traits> void basic_filebuf<_CharT, _Traits>:: _M_allocate_internal_buffer() { // Allocate internal buffer only if one doesn't already exist // (either allocated or provided by the user via setbuf). if (!_M_buf_allocated && !_M_buf) { _M_buf = new char_type[_M_buf_size]; _M_buf_allocated = true; } } template<typename _CharT, typename _Traits> void basic_filebuf<_CharT, _Traits>:: _M_destroy_internal_buffer() throw() { if (_M_buf_allocated) { delete [] _M_buf; _M_buf = 0; _M_buf_allocated = false; } delete [] _M_ext_buf; _M_ext_buf = 0; _M_ext_buf_size = 0; _M_ext_next = 0; _M_ext_end = 0; } template<typename _CharT, typename _Traits> basic_filebuf<_CharT, _Traits>:: basic_filebuf() : __streambuf_type(), _M_lock(), _M_file(&_M_lock), _M_mode(ios_base::openmode(0)), _M_state_beg(), _M_state_cur(), _M_state_last(), _M_buf(0), _M_buf_size(BUFSIZ), _M_buf_allocated(false), _M_reading(false), _M_writing(false), _M_pback(), _M_pback_cur_save(0), _M_pback_end_save(0), _M_pback_init(false), _M_codecvt(0), _M_ext_buf(0), _M_ext_buf_size(0), _M_ext_next(0), _M_ext_end(0) { if (has_facet<__codecvt_type>(this->_M_buf_locale)) _M_codecvt = &use_facet<__codecvt_type>(this->_M_buf_locale); } template<typename _CharT, typename _Traits> typename basic_filebuf<_CharT, _Traits>::__filebuf_type* basic_filebuf<_CharT, _Traits>:: open(const char* __s, ios_base::openmode __mode) { __filebuf_type *__ret = 0; if (!this->is_open()) { _M_file.open(__s, __mode); if (this->is_open()) { _M_allocate_internal_buffer(); _M_mode = __mode; // Setup initial buffer to 'uncommitted' mode. _M_reading = false; _M_writing = false; _M_set_buffer(-1); // Reset to initial state. _M_state_last = _M_state_cur = _M_state_beg; // 27.8.1.3,4 if ((__mode & ios_base::ate) && this->seekoff(0, ios_base::end, __mode) == pos_type(off_type(-1))) this->close(); else __ret = this; } } return __ret; } template<typename _CharT, typename _Traits> typename basic_filebuf<_CharT, _Traits>::__filebuf_type* basic_filebuf<_CharT, _Traits>:: close() { if (!this->is_open()) return 0; bool __testfail = false; { // NB: Do this here so that re-opened filebufs will be cool... struct __close_sentry { basic_filebuf *__fb; __close_sentry (basic_filebuf *__fbi): __fb(__fbi) { } ~__close_sentry () { __fb->_M_mode = ios_base::openmode(0); __fb->_M_pback_init = false; __fb->_M_destroy_internal_buffer(); __fb->_M_reading = false; __fb->_M_writing = false; __fb->_M_set_buffer(-1); __fb->_M_state_last = __fb->_M_state_cur = __fb->_M_state_beg; } } __cs (this); __try { if (!_M_terminate_output()) __testfail = true; } __catch(__cxxabiv1::__forced_unwind&) { _M_file.close(); __throw_exception_again; } __catch(...) { __testfail = true; } } if (!_M_file.close()) __testfail = true; if (__testfail) return 0; else return this; } template<typename _CharT, typename _Traits> streamsize basic_filebuf<_CharT, _Traits>:: showmanyc() { streamsize __ret = -1; const bool __testin = _M_mode & ios_base::in; if (__testin && this->is_open()) { // For a stateful encoding (-1) the pending sequence might be just // shift and unshift prefixes with no actual character. __ret = this->egptr() - this->gptr(); #if _GLIBCXX_HAVE_DOS_BASED_FILESYSTEM // About this workaround, see libstdc++/20806. const bool __testbinary = _M_mode & ios_base::binary; if (__check_facet(_M_codecvt).encoding() >= 0 && __testbinary) #else if (__check_facet(_M_codecvt).encoding() >= 0) #endif __ret += _M_file.showmanyc() / _M_codecvt->max_length(); } return __ret; } template<typename _CharT, typename _Traits> typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>:: underflow() { int_type __ret = traits_type::eof(); const bool __testin = _M_mode & ios_base::in; if (__testin) { if (_M_writing) { if (overflow() == traits_type::eof()) return __ret; _M_set_buffer(-1); _M_writing = false; } // Check for pback madness, and if so switch back to the // normal buffers and jet outta here before expensive // fileops happen... _M_destroy_pback(); if (this->gptr() < this->egptr()) return traits_type::to_int_type(*this->gptr()); // Get and convert input sequence. const size_t __buflen = _M_buf_size > 1 ? _M_buf_size - 1 : 1; // Will be set to true if ::read() returns 0 indicating EOF. bool __got_eof = false; // Number of internal characters produced. streamsize __ilen = 0; codecvt_base::result __r = codecvt_base::ok; if (__check_facet(_M_codecvt).always_noconv()) { __ilen = _M_file.xsgetn(reinterpret_cast<char*>(this->eback()), __buflen); if (__ilen == 0) __got_eof = true; } else { // Worst-case number of external bytes. // XXX Not done encoding() == -1. const int __enc = _M_codecvt->encoding(); streamsize __blen; // Minimum buffer size. streamsize __rlen; // Number of chars to read. if (__enc > 0) __blen = __rlen = __buflen * __enc; else { __blen = __buflen + _M_codecvt->max_length() - 1; __rlen = __buflen; } const streamsize __remainder = _M_ext_end - _M_ext_next; __rlen = __rlen > __remainder ? __rlen - __remainder : 0; // An imbue in 'read' mode implies first converting the external // chars already present. if (_M_reading && this->egptr() == this->eback() && __remainder) __rlen = 0; // Allocate buffer if necessary and move unconverted // bytes to front. if (_M_ext_buf_size < __blen) { char* __buf = new char[__blen]; if (__remainder) __builtin_memcpy(__buf, _M_ext_next, __remainder); delete [] _M_ext_buf; _M_ext_buf = __buf; _M_ext_buf_size = __blen; } else if (__remainder) __builtin_memmove(_M_ext_buf, _M_ext_next, __remainder); _M_ext_next = _M_ext_buf; _M_ext_end = _M_ext_buf + __remainder; _M_state_last = _M_state_cur; do { if (__rlen > 0) { // Sanity check! // This may fail if the return value of // codecvt::max_length() is bogus. if (_M_ext_end - _M_ext_buf + __rlen > _M_ext_buf_size) { __throw_ios_failure(__N("basic_filebuf::underflow " "codecvt::max_length() " "is not valid")); } streamsize __elen = _M_file.xsgetn(_M_ext_end, __rlen); if (__elen == 0) __got_eof = true; else if (__elen == -1) break; _M_ext_end += __elen; } char_type* __iend = this->eback(); if (_M_ext_next < _M_ext_end) __r = _M_codecvt->in(_M_state_cur, _M_ext_next, _M_ext_end, _M_ext_next, this->eback(), this->eback() + __buflen, __iend); if (__r == codecvt_base::noconv) { size_t __avail = _M_ext_end - _M_ext_buf; __ilen = std::min(__avail, __buflen); traits_type::copy(this->eback(), reinterpret_cast<char_type*> (_M_ext_buf), __ilen); _M_ext_next = _M_ext_buf + __ilen; } else __ilen = __iend - this->eback(); // _M_codecvt->in may return error while __ilen > 0: this is // ok, and actually occurs in case of mixed encodings (e.g., // XML files). if (__r == codecvt_base::error) break; __rlen = 1; } while (__ilen == 0 && !__got_eof); } if (__ilen > 0) { _M_set_buffer(__ilen); _M_reading = true; __ret = traits_type::to_int_type(*this->gptr()); } else if (__got_eof) { // If the actual end of file is reached, set 'uncommitted' // mode, thus allowing an immediate write without an // intervening seek. _M_set_buffer(-1); _M_reading = false; // However, reaching it while looping on partial means that // the file has got an incomplete character. if (__r == codecvt_base::partial) __throw_ios_failure(__N("basic_filebuf::underflow " "incomplete character in file")); } else if (__r == codecvt_base::error) __throw_ios_failure(__N("basic_filebuf::underflow " "invalid byte sequence in file")); else __throw_ios_failure(__N("basic_filebuf::underflow " "error reading the file")); } return __ret; } template<typename _CharT, typename _Traits> typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>:: pbackfail(int_type __i) { int_type __ret = traits_type::eof(); const bool __testin = _M_mode & ios_base::in; if (__testin) { if (_M_writing) { if (overflow() == traits_type::eof()) return __ret; _M_set_buffer(-1); _M_writing = false; } // Remember whether the pback buffer is active, otherwise below // we may try to store in it a second char (libstdc++/9761). const bool __testpb = _M_pback_init; const bool __testeof = traits_type::eq_int_type(__i, __ret); int_type __tmp; if (this->eback() < this->gptr()) { this->gbump(-1); __tmp = traits_type::to_int_type(*this->gptr()); } else if (this->seekoff(-1, ios_base::cur) != pos_type(off_type(-1))) { __tmp = this->underflow(); if (traits_type::eq_int_type(__tmp, __ret)) return __ret; } else { // At the beginning of the buffer, need to make a // putback position available. But the seek may fail // (f.i., at the beginning of a file, see // libstdc++/9439) and in that case we return // traits_type::eof(). return __ret; } // Try to put back __i into input sequence in one of three ways. // Order these tests done in is unspecified by the standard. if (!__testeof && traits_type::eq_int_type(__i, __tmp)) __ret = __i; else if (__testeof) __ret = traits_type::not_eof(__i); else if (!__testpb) { _M_create_pback(); _M_reading = true; *this->gptr() = traits_type::to_char_type(__i); __ret = __i; } } return __ret; } template<typename _CharT, typename _Traits> typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>:: overflow(int_type __c) { int_type __ret = traits_type::eof(); const bool __testeof = traits_type::eq_int_type(__c, __ret); const bool __testout = _M_mode & ios_base::out; if (__testout) { if (_M_reading) { _M_destroy_pback(); const int __gptr_off = _M_get_ext_pos(_M_state_last); if (_M_seek(__gptr_off, ios_base::cur, _M_state_last) == pos_type(off_type(-1))) return __ret; } if (this->pbase() < this->pptr()) { // If appropriate, append the overflow char. if (!__testeof) { *this->pptr() = traits_type::to_char_type(__c); this->pbump(1); } // Convert pending sequence to external representation, // and output. if (_M_convert_to_external(this->pbase(), this->pptr() - this->pbase())) { _M_set_buffer(0); __ret = traits_type::not_eof(__c); } } else if (_M_buf_size > 1) { // Overflow in 'uncommitted' mode: set _M_writing, set // the buffer to the initial 'write' mode, and put __c // into the buffer. _M_set_buffer(0); _M_writing = true; if (!__testeof) { *this->pptr() = traits_type::to_char_type(__c); this->pbump(1); } __ret = traits_type::not_eof(__c); } else { // Unbuffered. char_type __conv = traits_type::to_char_type(__c); if (__testeof || _M_convert_to_external(&__conv, 1)) { _M_writing = true; __ret = traits_type::not_eof(__c); } } } return __ret; } template<typename _CharT, typename _Traits> bool basic_filebuf<_CharT, _Traits>:: _M_convert_to_external(_CharT* __ibuf, streamsize __ilen) { // Sizes of external and pending output. streamsize __elen; streamsize __plen; if (__check_facet(_M_codecvt).always_noconv()) { __elen = _M_file.xsputn(reinterpret_cast<char*>(__ibuf), __ilen); __plen = __ilen; } else { // Worst-case number of external bytes needed. // XXX Not done encoding() == -1. streamsize __blen = __ilen * _M_codecvt->max_length(); char* __buf = static_cast<char*>(__builtin_alloca(__blen)); char* __bend; const char_type* __iend; codecvt_base::result __r; __r = _M_codecvt->out(_M_state_cur, __ibuf, __ibuf + __ilen, __iend, __buf, __buf + __blen, __bend); if (__r == codecvt_base::ok || __r == codecvt_base::partial) __blen = __bend - __buf; else if (__r == codecvt_base::noconv) { // Same as the always_noconv case above. __buf = reinterpret_cast<char*>(__ibuf); __blen = __ilen; } else __throw_ios_failure(__N("basic_filebuf::_M_convert_to_external " "conversion error")); __elen = _M_file.xsputn(__buf, __blen); __plen = __blen; // Try once more for partial conversions. if (__r == codecvt_base::partial && __elen == __plen) { const char_type* __iresume = __iend; streamsize __rlen = this->pptr() - __iend; __r = _M_codecvt->out(_M_state_cur, __iresume, __iresume + __rlen, __iend, __buf, __buf + __blen, __bend); if (__r != codecvt_base::error) { __rlen = __bend - __buf; __elen = _M_file.xsputn(__buf, __rlen); __plen = __rlen; } else __throw_ios_failure(__N("basic_filebuf::_M_convert_to_external " "conversion error")); } } return __elen == __plen; } template<typename _CharT, typename _Traits> streamsize basic_filebuf<_CharT, _Traits>:: xsgetn(_CharT* __s, streamsize __n) { // Clear out pback buffer before going on to the real deal... streamsize __ret = 0; if (_M_pback_init) { if (__n > 0 && this->gptr() == this->eback()) { *__s++ = *this->gptr(); // emulate non-underflowing sbumpc this->gbump(1); __ret = 1; --__n; } _M_destroy_pback(); } else if (_M_writing) { if (overflow() == traits_type::eof()) return __ret; _M_set_buffer(-1); _M_writing = false; } // Optimization in the always_noconv() case, to be generalized in the // future: when __n > __buflen we read directly instead of using the // buffer repeatedly. const bool __testin = _M_mode & ios_base::in; const streamsize __buflen = _M_buf_size > 1 ? _M_buf_size - 1 : 1; if (__n > __buflen && __check_facet(_M_codecvt).always_noconv() && __testin) { // First, copy the chars already present in the buffer. const streamsize __avail = this->egptr() - this->gptr(); if (__avail != 0) { traits_type::copy(__s, this->gptr(), __avail); __s += __avail; this->setg(this->eback(), this->gptr() + __avail, this->egptr()); __ret += __avail; __n -= __avail; } // Need to loop in case of short reads (relatively common // with pipes). streamsize __len; for (;;) { __len = _M_file.xsgetn(reinterpret_cast<char*>(__s), __n); if (__len == -1) __throw_ios_failure(__N("basic_filebuf::xsgetn " "error reading the file")); if (__len == 0) break; __n -= __len; __ret += __len; if (__n == 0) break; __s += __len; } if (__n == 0) { // Set _M_reading. Buffer is already in initial 'read' mode. _M_reading = true; } else if (__len == 0) { // If end of file is reached, set 'uncommitted' // mode, thus allowing an immediate write without // an intervening seek. _M_set_buffer(-1); _M_reading = false; } } else __ret += __streambuf_type::xsgetn(__s, __n); return __ret; } template<typename _CharT, typename _Traits> streamsize basic_filebuf<_CharT, _Traits>:: xsputn(const _CharT* __s, streamsize __n) { streamsize __ret = 0; // Optimization in the always_noconv() case, to be generalized in the // future: when __n is sufficiently large we write directly instead of // using the buffer. const bool __testout = _M_mode & ios_base::out; if (__check_facet(_M_codecvt).always_noconv() && __testout && !_M_reading) { // Measurement would reveal the best choice. const streamsize __chunk = 1ul << 10; streamsize __bufavail = this->epptr() - this->pptr(); // Don't mistake 'uncommitted' mode buffered with unbuffered. if (!_M_writing && _M_buf_size > 1) __bufavail = _M_buf_size - 1; const streamsize __limit = std::min(__chunk, __bufavail); if (__n >= __limit) { const streamsize __buffill = this->pptr() - this->pbase(); const char* __buf = reinterpret_cast<const char*>(this->pbase()); __ret = _M_file.xsputn_2(__buf, __buffill, reinterpret_cast<const char*>(__s), __n); if (__ret == __buffill + __n) { _M_set_buffer(0); _M_writing = true; } if (__ret > __buffill) __ret -= __buffill; else __ret = 0; } else __ret = __streambuf_type::xsputn(__s, __n); } else __ret = __streambuf_type::xsputn(__s, __n); return __ret; } template<typename _CharT, typename _Traits> typename basic_filebuf<_CharT, _Traits>::__streambuf_type* basic_filebuf<_CharT, _Traits>:: setbuf(char_type* __s, streamsize __n) { if (!this->is_open()) { if (__s == 0 && __n == 0) _M_buf_size = 1; else if (__s && __n > 0) { // This is implementation-defined behavior, and assumes that // an external char_type array of length __n exists and has // been pre-allocated. If this is not the case, things will // quickly blow up. When __n > 1, __n - 1 positions will be // used for the get area, __n - 1 for the put area and 1 // position to host the overflow char of a full put area. // When __n == 1, 1 position will be used for the get area // and 0 for the put area, as in the unbuffered case above. _M_buf = __s; _M_buf_size = __n; } } return this; } // According to 27.8.1.4 p11 - 13, seekoff should ignore the last // argument (of type openmode). template<typename _CharT, typename _Traits> typename basic_filebuf<_CharT, _Traits>::pos_type basic_filebuf<_CharT, _Traits>:: seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode) { int __width = 0; if (_M_codecvt) __width = _M_codecvt->encoding(); if (__width < 0) __width = 0; pos_type __ret = pos_type(off_type(-1)); const bool __testfail = __off != 0 && __width <= 0; if (this->is_open() && !__testfail) { // tellg and tellp queries do not affect any state, unless // ! always_noconv and the put sequence is not empty. // In that case, determining the position requires converting the // put sequence. That doesn't use ext_buf, so requires a flush. bool __no_movement = __way == ios_base::cur && __off == 0 && (!_M_writing || _M_codecvt->always_noconv()); // Ditch any pback buffers to avoid confusion. if (!__no_movement) _M_destroy_pback(); // Correct state at destination. Note that this is the correct // state for the current position during output, because // codecvt::unshift() returns the state to the initial state. // This is also the correct state at the end of the file because // an unshift sequence should have been written at the end. __state_type __state = _M_state_beg; off_type __computed_off = __off * __width; if (_M_reading && __way == ios_base::cur) { __state = _M_state_last; __computed_off += _M_get_ext_pos(__state); } if (!__no_movement) __ret = _M_seek(__computed_off, __way, __state); else { if (_M_writing) __computed_off = this->pptr() - this->pbase(); off_type __file_off = _M_file.seekoff(0, ios_base::cur); if (__file_off != off_type(-1)) { __ret = __file_off + __computed_off; __ret.state(__state); } } } return __ret; } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 171. Strange seekpos() semantics due to joint position // According to the resolution of DR 171, seekpos should ignore the last // argument (of type openmode). template<typename _CharT, typename _Traits> typename basic_filebuf<_CharT, _Traits>::pos_type basic_filebuf<_CharT, _Traits>:: seekpos(pos_type __pos, ios_base::openmode) { pos_type __ret = pos_type(off_type(-1)); if (this->is_open()) { // Ditch any pback buffers to avoid confusion. _M_destroy_pback(); __ret = _M_seek(off_type(__pos), ios_base::beg, __pos.state()); } return __ret; } template<typename _CharT, typename _Traits> typename basic_filebuf<_CharT, _Traits>::pos_type basic_filebuf<_CharT, _Traits>:: _M_seek(off_type __off, ios_base::seekdir __way, __state_type __state) { pos_type __ret = pos_type(off_type(-1)); if (_M_terminate_output()) { off_type __file_off = _M_file.seekoff(__off, __way); if (__file_off != off_type(-1)) { _M_reading = false; _M_writing = false; _M_ext_next = _M_ext_end = _M_ext_buf; _M_set_buffer(-1); _M_state_cur = __state; __ret = __file_off; __ret.state(_M_state_cur); } } return __ret; } // Returns the distance from the end of the ext buffer to the point // corresponding to gptr(). This is a negative value. Updates __state // from eback() correspondence to gptr(). template<typename _CharT, typename _Traits> int basic_filebuf<_CharT, _Traits>:: _M_get_ext_pos(__state_type& __state) { if (_M_codecvt->always_noconv()) return this->gptr() - this->egptr(); else { // Calculate offset from _M_ext_buf that corresponds to // gptr(). Precondition: __state == _M_state_last, which // corresponds to eback(). const int __gptr_off = _M_codecvt->length(__state, _M_ext_buf, _M_ext_next, this->gptr() - this->eback()); return _M_ext_buf + __gptr_off - _M_ext_end; } } template<typename _CharT, typename _Traits> bool basic_filebuf<_CharT, _Traits>:: _M_terminate_output() { // Part one: update the output sequence. bool __testvalid = true; if (this->pbase() < this->pptr()) { const int_type __tmp = this->overflow(); if (traits_type::eq_int_type(__tmp, traits_type::eof())) __testvalid = false; } // Part two: output unshift sequence. if (_M_writing && !__check_facet(_M_codecvt).always_noconv() && __testvalid) { // Note: this value is arbitrary, since there is no way to // get the length of the unshift sequence from codecvt, // without calling unshift. const size_t __blen = 128; char __buf[__blen]; codecvt_base::result __r; streamsize __ilen = 0; do { char* __next; __r = _M_codecvt->unshift(_M_state_cur, __buf, __buf + __blen, __next); if (__r == codecvt_base::error) __testvalid = false; else if (__r == codecvt_base::ok || __r == codecvt_base::partial) { __ilen = __next - __buf; if (__ilen > 0) { const streamsize __elen = _M_file.xsputn(__buf, __ilen); if (__elen != __ilen) __testvalid = false; } } } while (__r == codecvt_base::partial && __ilen > 0 && __testvalid); if (__testvalid) { // This second call to overflow() is required by the standard, // but it's not clear why it's needed, since the output buffer // should be empty by this point (it should have been emptied // in the first call to overflow()). const int_type __tmp = this->overflow(); if (traits_type::eq_int_type(__tmp, traits_type::eof())) __testvalid = false; } } return __testvalid; } template<typename _CharT, typename _Traits> int basic_filebuf<_CharT, _Traits>:: sync() { // Make sure that the internal buffer resyncs its idea of // the file position with the external file. int __ret = 0; if (this->pbase() < this->pptr()) { const int_type __tmp = this->overflow(); if (traits_type::eq_int_type(__tmp, traits_type::eof())) __ret = -1; } return __ret; } template<typename _CharT, typename _Traits> void basic_filebuf<_CharT, _Traits>:: imbue(const locale& __loc) { bool __testvalid = true; const __codecvt_type* _M_codecvt_tmp = 0; if (__builtin_expect(has_facet<__codecvt_type>(__loc), true)) _M_codecvt_tmp = &use_facet<__codecvt_type>(__loc); if (this->is_open()) { // encoding() == -1 is ok only at the beginning. if ((_M_reading || _M_writing) && __check_facet(_M_codecvt).encoding() == -1) __testvalid = false; else { if (_M_reading) { if (__check_facet(_M_codecvt).always_noconv()) { if (_M_codecvt_tmp && !__check_facet(_M_codecvt_tmp).always_noconv()) __testvalid = this->seekoff(0, ios_base::cur, _M_mode) != pos_type(off_type(-1)); } else { // External position corresponding to gptr(). _M_ext_next = _M_ext_buf + _M_codecvt->length(_M_state_last, _M_ext_buf, _M_ext_next, this->gptr() - this->eback()); const streamsize __remainder = _M_ext_end - _M_ext_next; if (__remainder) __builtin_memmove(_M_ext_buf, _M_ext_next, __remainder); _M_ext_next = _M_ext_buf; _M_ext_end = _M_ext_buf + __remainder; _M_set_buffer(-1); _M_state_last = _M_state_cur = _M_state_beg; } } else if (_M_writing && (__testvalid = _M_terminate_output())) _M_set_buffer(-1); } } if (__testvalid) _M_codecvt = _M_codecvt_tmp; else _M_codecvt = 0; } // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. #if _GLIBCXX_EXTERN_TEMPLATE extern template class basic_filebuf<char>; extern template class basic_ifstream<char>; extern template class basic_ofstream<char>; extern template class basic_fstream<char>; #ifdef _GLIBCXX_USE_WCHAR_T extern template class basic_filebuf<wchar_t>; extern template class basic_ifstream<wchar_t>; extern template class basic_ofstream<wchar_t>; extern template class basic_fstream<wchar_t>; #endif #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_heap.h���������������������������������������������������������������������������0000644�����������������00000047770�14763166030�0010523 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Heap implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * Copyright (c) 1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_heap.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{queue} */ #ifndef _STL_HEAP_H #define _STL_HEAP_H 1 #include <debug/debug.h> #include <bits/move.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup heap_algorithms Heap * @ingroup sorting_algorithms */ template<typename _RandomAccessIterator, typename _Distance> _Distance __is_heap_until(_RandomAccessIterator __first, _Distance __n) { _Distance __parent = 0; for (_Distance __child = 1; __child < __n; ++__child) { if (__first[__parent] < __first[__child]) return __child; if ((__child & 1) == 0) ++__parent; } return __n; } template<typename _RandomAccessIterator, typename _Distance, typename _Compare> _Distance __is_heap_until(_RandomAccessIterator __first, _Distance __n, _Compare __comp) { _Distance __parent = 0; for (_Distance __child = 1; __child < __n; ++__child) { if (__comp(__first[__parent], __first[__child])) return __child; if ((__child & 1) == 0) ++__parent; } return __n; } // __is_heap, a predicate testing whether or not a range is a heap. // This function is an extension, not part of the C++ standard. template<typename _RandomAccessIterator, typename _Distance> inline bool __is_heap(_RandomAccessIterator __first, _Distance __n) { return std::__is_heap_until(__first, __n) == __n; } template<typename _RandomAccessIterator, typename _Compare, typename _Distance> inline bool __is_heap(_RandomAccessIterator __first, _Compare __comp, _Distance __n) { return std::__is_heap_until(__first, __n, __comp) == __n; } template<typename _RandomAccessIterator> inline bool __is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { return std::__is_heap(__first, std::distance(__first, __last)); } template<typename _RandomAccessIterator, typename _Compare> inline bool __is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { return std::__is_heap(__first, __comp, std::distance(__first, __last)); } // Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap, // + is_heap and is_heap_until in C++0x. template<typename _RandomAccessIterator, typename _Distance, typename _Tp> void __push_heap(_RandomAccessIterator __first, _Distance __holeIndex, _Distance __topIndex, _Tp __value) { _Distance __parent = (__holeIndex - 1) / 2; while (__holeIndex > __topIndex && *(__first + __parent) < __value) { *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __parent)); __holeIndex = __parent; __parent = (__holeIndex - 1) / 2; } *(__first + __holeIndex) = _GLIBCXX_MOVE(__value); } /** * @brief Push an element onto a heap. * @param __first Start of heap. * @param __last End of heap + element. * @ingroup heap_algorithms * * This operation pushes the element at last-1 onto the valid heap * over the range [__first,__last-1). After completion, * [__first,__last) is a valid heap. */ template<typename _RandomAccessIterator> inline void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; typedef typename iterator_traits<_RandomAccessIterator>::difference_type _DistanceType; // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>) __glibcxx_requires_valid_range(__first, __last); __glibcxx_requires_heap(__first, __last - 1); _ValueType __value = _GLIBCXX_MOVE(*(__last - 1)); std::__push_heap(__first, _DistanceType((__last - __first) - 1), _DistanceType(0), _GLIBCXX_MOVE(__value)); } template<typename _RandomAccessIterator, typename _Distance, typename _Tp, typename _Compare> void __push_heap(_RandomAccessIterator __first, _Distance __holeIndex, _Distance __topIndex, _Tp __value, _Compare __comp) { _Distance __parent = (__holeIndex - 1) / 2; while (__holeIndex > __topIndex && __comp(*(__first + __parent), __value)) { *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __parent)); __holeIndex = __parent; __parent = (__holeIndex - 1) / 2; } *(__first + __holeIndex) = _GLIBCXX_MOVE(__value); } /** * @brief Push an element onto a heap using comparison functor. * @param __first Start of heap. * @param __last End of heap + element. * @param __comp Comparison functor. * @ingroup heap_algorithms * * This operation pushes the element at __last-1 onto the valid * heap over the range [__first,__last-1). After completion, * [__first,__last) is a valid heap. Compare operations are * performed using comp. */ template<typename _RandomAccessIterator, typename _Compare> inline void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; typedef typename iterator_traits<_RandomAccessIterator>::difference_type _DistanceType; // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_requires_valid_range(__first, __last); __glibcxx_requires_heap_pred(__first, __last - 1, __comp); _ValueType __value = _GLIBCXX_MOVE(*(__last - 1)); std::__push_heap(__first, _DistanceType((__last - __first) - 1), _DistanceType(0), _GLIBCXX_MOVE(__value), __comp); } template<typename _RandomAccessIterator, typename _Distance, typename _Tp> void __adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex, _Distance __len, _Tp __value) { const _Distance __topIndex = __holeIndex; _Distance __secondChild = __holeIndex; while (__secondChild < (__len - 1) / 2) { __secondChild = 2 * (__secondChild + 1); if (*(__first + __secondChild) < *(__first + (__secondChild - 1))) __secondChild--; *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild)); __holeIndex = __secondChild; } if ((__len & 1) == 0 && __secondChild == (__len - 2) / 2) { __secondChild = 2 * (__secondChild + 1); *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + (__secondChild - 1))); __holeIndex = __secondChild - 1; } std::__push_heap(__first, __holeIndex, __topIndex, _GLIBCXX_MOVE(__value)); } template<typename _RandomAccessIterator> inline void __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _RandomAccessIterator __result) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; typedef typename iterator_traits<_RandomAccessIterator>::difference_type _DistanceType; _ValueType __value = _GLIBCXX_MOVE(*__result); *__result = _GLIBCXX_MOVE(*__first); std::__adjust_heap(__first, _DistanceType(0), _DistanceType(__last - __first), _GLIBCXX_MOVE(__value)); } /** * @brief Pop an element off a heap. * @param __first Start of heap. * @param __last End of heap. * @pre [__first, __last) is a valid, non-empty range. * @ingroup heap_algorithms * * This operation pops the top of the heap. The elements __first * and __last-1 are swapped and [__first,__last-1) is made into a * heap. */ template<typename _RandomAccessIterator> inline void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>) __glibcxx_requires_non_empty_range(__first, __last); __glibcxx_requires_valid_range(__first, __last); __glibcxx_requires_heap(__first, __last); if (__last - __first > 1) { --__last; std::__pop_heap(__first, __last, __last); } } template<typename _RandomAccessIterator, typename _Distance, typename _Tp, typename _Compare> void __adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex, _Distance __len, _Tp __value, _Compare __comp) { const _Distance __topIndex = __holeIndex; _Distance __secondChild = __holeIndex; while (__secondChild < (__len - 1) / 2) { __secondChild = 2 * (__secondChild + 1); if (__comp(*(__first + __secondChild), *(__first + (__secondChild - 1)))) __secondChild--; *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild)); __holeIndex = __secondChild; } if ((__len & 1) == 0 && __secondChild == (__len - 2) / 2) { __secondChild = 2 * (__secondChild + 1); *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + (__secondChild - 1))); __holeIndex = __secondChild - 1; } std::__push_heap(__first, __holeIndex, __topIndex, _GLIBCXX_MOVE(__value), __comp); } template<typename _RandomAccessIterator, typename _Compare> inline void __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _RandomAccessIterator __result, _Compare __comp) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; typedef typename iterator_traits<_RandomAccessIterator>::difference_type _DistanceType; _ValueType __value = _GLIBCXX_MOVE(*__result); *__result = _GLIBCXX_MOVE(*__first); std::__adjust_heap(__first, _DistanceType(0), _DistanceType(__last - __first), _GLIBCXX_MOVE(__value), __comp); } /** * @brief Pop an element off a heap using comparison functor. * @param __first Start of heap. * @param __last End of heap. * @param __comp Comparison functor to use. * @ingroup heap_algorithms * * This operation pops the top of the heap. The elements __first * and __last-1 are swapped and [__first,__last-1) is made into a * heap. Comparisons are made using comp. */ template<typename _RandomAccessIterator, typename _Compare> inline void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_requires_valid_range(__first, __last); __glibcxx_requires_non_empty_range(__first, __last); __glibcxx_requires_heap_pred(__first, __last, __comp); if (__last - __first > 1) { --__last; std::__pop_heap(__first, __last, __last, __comp); } } /** * @brief Construct a heap over a range. * @param __first Start of heap. * @param __last End of heap. * @ingroup heap_algorithms * * This operation makes the elements in [__first,__last) into a heap. */ template<typename _RandomAccessIterator> void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; typedef typename iterator_traits<_RandomAccessIterator>::difference_type _DistanceType; // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>) __glibcxx_requires_valid_range(__first, __last); if (__last - __first < 2) return; const _DistanceType __len = __last - __first; _DistanceType __parent = (__len - 2) / 2; while (true) { _ValueType __value = _GLIBCXX_MOVE(*(__first + __parent)); std::__adjust_heap(__first, __parent, __len, _GLIBCXX_MOVE(__value)); if (__parent == 0) return; __parent--; } } /** * @brief Construct a heap over a range using comparison functor. * @param __first Start of heap. * @param __last End of heap. * @param __comp Comparison functor to use. * @ingroup heap_algorithms * * This operation makes the elements in [__first,__last) into a heap. * Comparisons are made using __comp. */ template<typename _RandomAccessIterator, typename _Compare> void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; typedef typename iterator_traits<_RandomAccessIterator>::difference_type _DistanceType; // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_requires_valid_range(__first, __last); if (__last - __first < 2) return; const _DistanceType __len = __last - __first; _DistanceType __parent = (__len - 2) / 2; while (true) { _ValueType __value = _GLIBCXX_MOVE(*(__first + __parent)); std::__adjust_heap(__first, __parent, __len, _GLIBCXX_MOVE(__value), __comp); if (__parent == 0) return; __parent--; } } /** * @brief Sort a heap. * @param __first Start of heap. * @param __last End of heap. * @ingroup heap_algorithms * * This operation sorts the valid heap in the range [__first,__last). */ template<typename _RandomAccessIterator> void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_function_requires(_LessThanComparableConcept< typename iterator_traits<_RandomAccessIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); __glibcxx_requires_heap(__first, __last); while (__last - __first > 1) { --__last; std::__pop_heap(__first, __last, __last); } } /** * @brief Sort a heap using comparison functor. * @param __first Start of heap. * @param __last End of heap. * @param __comp Comparison functor to use. * @ingroup heap_algorithms * * This operation sorts the valid heap in the range [__first,__last). * Comparisons are made using __comp. */ template<typename _RandomAccessIterator, typename _Compare> void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_requires_valid_range(__first, __last); __glibcxx_requires_heap_pred(__first, __last, __comp); while (__last - __first > 1) { --__last; std::__pop_heap(__first, __last, __last, __comp); } } #if __cplusplus >= 201103L /** * @brief Search the end of a heap. * @param __first Start of range. * @param __last End of range. * @return An iterator pointing to the first element not in the heap. * @ingroup heap_algorithms * * This operation returns the last iterator i in [__first, __last) for which * the range [__first, i) is a heap. */ template<typename _RandomAccessIterator> inline _RandomAccessIterator is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last) { // concept requirements __glibcxx_function_requires(_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_function_requires(_LessThanComparableConcept< typename iterator_traits<_RandomAccessIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); return __first + std::__is_heap_until(__first, std::distance(__first, __last)); } /** * @brief Search the end of a heap using comparison functor. * @param __first Start of range. * @param __last End of range. * @param __comp Comparison functor to use. * @return An iterator pointing to the first element not in the heap. * @ingroup heap_algorithms * * This operation returns the last iterator i in [__first, __last) for which * the range [__first, i) is a heap. Comparisons are made using __comp. */ template<typename _RandomAccessIterator, typename _Compare> inline _RandomAccessIterator is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { // concept requirements __glibcxx_function_requires(_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_requires_valid_range(__first, __last); return __first + std::__is_heap_until(__first, std::distance(__first, __last), __comp); } /** * @brief Determines whether a range is a heap. * @param __first Start of range. * @param __last End of range. * @return True if range is a heap, false otherwise. * @ingroup heap_algorithms */ template<typename _RandomAccessIterator> inline bool is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { return std::is_heap_until(__first, __last) == __last; } /** * @brief Determines whether a range is a heap using comparison functor. * @param __first Start of range. * @param __last End of range. * @param __comp Comparison functor to use. * @return True if range is a heap, false otherwise. * @ingroup heap_algorithms */ template<typename _RandomAccessIterator, typename _Compare> inline bool is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { return std::is_heap_until(__first, __last, __comp) == __last; } #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _STL_HEAP_H */ ��������c++/4.8.2/bits/ostream_insert.h���������������������������������������������������������������������0000644�����������������00000007642�14763166030�0011754 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Helpers for ostream inserters -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/ostream_insert.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ostream} */ #ifndef _OSTREAM_INSERT_H #define _OSTREAM_INSERT_H 1 #pragma GCC system_header #include <iosfwd> #include <bits/cxxabi_forced.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _CharT, typename _Traits> inline void __ostream_write(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s, streamsize __n) { typedef basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const streamsize __put = __out.rdbuf()->sputn(__s, __n); if (__put != __n) __out.setstate(__ios_base::badbit); } template<typename _CharT, typename _Traits> inline void __ostream_fill(basic_ostream<_CharT, _Traits>& __out, streamsize __n) { typedef basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const _CharT __c = __out.fill(); for (; __n > 0; --__n) { const typename _Traits::int_type __put = __out.rdbuf()->sputc(__c); if (_Traits::eq_int_type(__put, _Traits::eof())) { __out.setstate(__ios_base::badbit); break; } } } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& __ostream_insert(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s, streamsize __n) { typedef basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; typename __ostream_type::sentry __cerb(__out); if (__cerb) { __try { const streamsize __w = __out.width(); if (__w > __n) { const bool __left = ((__out.flags() & __ios_base::adjustfield) == __ios_base::left); if (!__left) __ostream_fill(__out, __w - __n); if (__out.good()) __ostream_write(__out, __s, __n); if (__left && __out.good()) __ostream_fill(__out, __w - __n); } else __ostream_write(__out, __s, __n); __out.width(0); } __catch(__cxxabiv1::__forced_unwind&) { __out._M_setstate(__ios_base::badbit); __throw_exception_again; } __catch(...) { __out._M_setstate(__ios_base::badbit); } } return __out; } // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. #if _GLIBCXX_EXTERN_TEMPLATE extern template ostream& __ostream_insert(ostream&, const char*, streamsize); #ifdef _GLIBCXX_USE_WCHAR_T extern template wostream& __ostream_insert(wostream&, const wchar_t*, streamsize); #endif #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif /* _OSTREAM_INSERT_H */ ����������������������������������������������������������������������������������������������c++/4.8.2/bits/vector.tcc���������������������������������������������������������������������������0000644�����������������00000063064�14763166030�0010542 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Vector implementation (out of line) -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/vector.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{vector} */ #ifndef _VECTOR_TCC #define _VECTOR_TCC 1 namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER template<typename _Tp, typename _Alloc> void vector<_Tp, _Alloc>:: reserve(size_type __n) { if (__n > this->max_size()) __throw_length_error(__N("vector::reserve")); if (this->capacity() < __n) { const size_type __old_size = size(); pointer __tmp = _M_allocate_and_copy(__n, _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(this->_M_impl._M_start), _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(this->_M_impl._M_finish)); std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, _M_get_Tp_allocator()); _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); this->_M_impl._M_start = __tmp; this->_M_impl._M_finish = __tmp + __old_size; this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n; } } #if __cplusplus >= 201103L template<typename _Tp, typename _Alloc> template<typename... _Args> void vector<_Tp, _Alloc>:: emplace_back(_Args&&... __args) { if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage) { _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, std::forward<_Args>(__args)...); ++this->_M_impl._M_finish; } else _M_emplace_back_aux(std::forward<_Args>(__args)...); } #endif template<typename _Tp, typename _Alloc> typename vector<_Tp, _Alloc>::iterator vector<_Tp, _Alloc>:: insert(iterator __position, const value_type& __x) { const size_type __n = __position - begin(); if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage && __position == end()) { _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, __x); ++this->_M_impl._M_finish; } else { #if __cplusplus >= 201103L if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage) { _Tp __x_copy = __x; _M_insert_aux(__position, std::move(__x_copy)); } else #endif _M_insert_aux(__position, __x); } return iterator(this->_M_impl._M_start + __n); } template<typename _Tp, typename _Alloc> typename vector<_Tp, _Alloc>::iterator vector<_Tp, _Alloc>:: erase(iterator __position) { if (__position + 1 != end()) _GLIBCXX_MOVE3(__position + 1, end(), __position); --this->_M_impl._M_finish; _Alloc_traits::destroy(this->_M_impl, this->_M_impl._M_finish); return __position; } template<typename _Tp, typename _Alloc> typename vector<_Tp, _Alloc>::iterator vector<_Tp, _Alloc>:: erase(iterator __first, iterator __last) { if (__first != __last) { if (__last != end()) _GLIBCXX_MOVE3(__last, end(), __first); _M_erase_at_end(__first.base() + (end() - __last)); } return __first; } template<typename _Tp, typename _Alloc> vector<_Tp, _Alloc>& vector<_Tp, _Alloc>:: operator=(const vector<_Tp, _Alloc>& __x) { if (&__x != this) { #if __cplusplus >= 201103L if (_Alloc_traits::_S_propagate_on_copy_assign()) { if (!_Alloc_traits::_S_always_equal() && _M_get_Tp_allocator() != __x._M_get_Tp_allocator()) { // replacement allocator cannot free existing storage this->clear(); _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); this->_M_impl._M_start = nullptr; this->_M_impl._M_finish = nullptr; this->_M_impl._M_end_of_storage = nullptr; } std::__alloc_on_copy(_M_get_Tp_allocator(), __x._M_get_Tp_allocator()); } #endif const size_type __xlen = __x.size(); if (__xlen > capacity()) { pointer __tmp = _M_allocate_and_copy(__xlen, __x.begin(), __x.end()); std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, _M_get_Tp_allocator()); _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); this->_M_impl._M_start = __tmp; this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __xlen; } else if (size() >= __xlen) { std::_Destroy(std::copy(__x.begin(), __x.end(), begin()), end(), _M_get_Tp_allocator()); } else { std::copy(__x._M_impl._M_start, __x._M_impl._M_start + size(), this->_M_impl._M_start); std::__uninitialized_copy_a(__x._M_impl._M_start + size(), __x._M_impl._M_finish, this->_M_impl._M_finish, _M_get_Tp_allocator()); } this->_M_impl._M_finish = this->_M_impl._M_start + __xlen; } return *this; } template<typename _Tp, typename _Alloc> void vector<_Tp, _Alloc>:: _M_fill_assign(size_t __n, const value_type& __val) { if (__n > capacity()) { vector __tmp(__n, __val, _M_get_Tp_allocator()); __tmp.swap(*this); } else if (__n > size()) { std::fill(begin(), end(), __val); std::__uninitialized_fill_n_a(this->_M_impl._M_finish, __n - size(), __val, _M_get_Tp_allocator()); this->_M_impl._M_finish += __n - size(); } else _M_erase_at_end(std::fill_n(this->_M_impl._M_start, __n, __val)); } template<typename _Tp, typename _Alloc> template<typename _InputIterator> void vector<_Tp, _Alloc>:: _M_assign_aux(_InputIterator __first, _InputIterator __last, std::input_iterator_tag) { pointer __cur(this->_M_impl._M_start); for (; __first != __last && __cur != this->_M_impl._M_finish; ++__cur, ++__first) *__cur = *__first; if (__first == __last) _M_erase_at_end(__cur); else insert(end(), __first, __last); } template<typename _Tp, typename _Alloc> template<typename _ForwardIterator> void vector<_Tp, _Alloc>:: _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag) { const size_type __len = std::distance(__first, __last); if (__len > capacity()) { pointer __tmp(_M_allocate_and_copy(__len, __first, __last)); std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, _M_get_Tp_allocator()); _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); this->_M_impl._M_start = __tmp; this->_M_impl._M_finish = this->_M_impl._M_start + __len; this->_M_impl._M_end_of_storage = this->_M_impl._M_finish; } else if (size() >= __len) _M_erase_at_end(std::copy(__first, __last, this->_M_impl._M_start)); else { _ForwardIterator __mid = __first; std::advance(__mid, size()); std::copy(__first, __mid, this->_M_impl._M_start); this->_M_impl._M_finish = std::__uninitialized_copy_a(__mid, __last, this->_M_impl._M_finish, _M_get_Tp_allocator()); } } #if __cplusplus >= 201103L template<typename _Tp, typename _Alloc> template<typename... _Args> typename vector<_Tp, _Alloc>::iterator vector<_Tp, _Alloc>:: emplace(iterator __position, _Args&&... __args) { const size_type __n = __position - begin(); if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage && __position == end()) { _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, std::forward<_Args>(__args)...); ++this->_M_impl._M_finish; } else _M_insert_aux(__position, std::forward<_Args>(__args)...); return iterator(this->_M_impl._M_start + __n); } template<typename _Tp, typename _Alloc> template<typename... _Args> void vector<_Tp, _Alloc>:: _M_insert_aux(iterator __position, _Args&&... __args) #else template<typename _Tp, typename _Alloc> void vector<_Tp, _Alloc>:: _M_insert_aux(iterator __position, const _Tp& __x) #endif { if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage) { _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, _GLIBCXX_MOVE(*(this->_M_impl._M_finish - 1))); ++this->_M_impl._M_finish; #if __cplusplus < 201103L _Tp __x_copy = __x; #endif _GLIBCXX_MOVE_BACKWARD3(__position.base(), this->_M_impl._M_finish - 2, this->_M_impl._M_finish - 1); #if __cplusplus < 201103L *__position = __x_copy; #else *__position = _Tp(std::forward<_Args>(__args)...); #endif } else { const size_type __len = _M_check_len(size_type(1), "vector::_M_insert_aux"); const size_type __elems_before = __position - begin(); pointer __new_start(this->_M_allocate(__len)); pointer __new_finish(__new_start); __try { // The order of the three operations is dictated by the C++0x // case, where the moves could alter a new element belonging // to the existing vector. This is an issue only for callers // taking the element by const lvalue ref (see 23.1/13). _Alloc_traits::construct(this->_M_impl, __new_start + __elems_before, #if __cplusplus >= 201103L std::forward<_Args>(__args)...); #else __x); #endif __new_finish = 0; __new_finish = std::__uninitialized_move_if_noexcept_a (this->_M_impl._M_start, __position.base(), __new_start, _M_get_Tp_allocator()); ++__new_finish; __new_finish = std::__uninitialized_move_if_noexcept_a (__position.base(), this->_M_impl._M_finish, __new_finish, _M_get_Tp_allocator()); } __catch(...) { if (!__new_finish) _Alloc_traits::destroy(this->_M_impl, __new_start + __elems_before); else std::_Destroy(__new_start, __new_finish, _M_get_Tp_allocator()); _M_deallocate(__new_start, __len); __throw_exception_again; } std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, _M_get_Tp_allocator()); _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); this->_M_impl._M_start = __new_start; this->_M_impl._M_finish = __new_finish; this->_M_impl._M_end_of_storage = __new_start + __len; } } #if __cplusplus >= 201103L template<typename _Tp, typename _Alloc> template<typename... _Args> void vector<_Tp, _Alloc>:: _M_emplace_back_aux(_Args&&... __args) { const size_type __len = _M_check_len(size_type(1), "vector::_M_emplace_back_aux"); pointer __new_start(this->_M_allocate(__len)); pointer __new_finish(__new_start); __try { _Alloc_traits::construct(this->_M_impl, __new_start + size(), std::forward<_Args>(__args)...); __new_finish = 0; __new_finish = std::__uninitialized_move_if_noexcept_a (this->_M_impl._M_start, this->_M_impl._M_finish, __new_start, _M_get_Tp_allocator()); ++__new_finish; } __catch(...) { if (!__new_finish) _Alloc_traits::destroy(this->_M_impl, __new_start + size()); else std::_Destroy(__new_start, __new_finish, _M_get_Tp_allocator()); _M_deallocate(__new_start, __len); __throw_exception_again; } std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, _M_get_Tp_allocator()); _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); this->_M_impl._M_start = __new_start; this->_M_impl._M_finish = __new_finish; this->_M_impl._M_end_of_storage = __new_start + __len; } #endif template<typename _Tp, typename _Alloc> void vector<_Tp, _Alloc>:: _M_fill_insert(iterator __position, size_type __n, const value_type& __x) { if (__n != 0) { if (size_type(this->_M_impl._M_end_of_storage - this->_M_impl._M_finish) >= __n) { value_type __x_copy = __x; const size_type __elems_after = end() - __position; pointer __old_finish(this->_M_impl._M_finish); if (__elems_after > __n) { std::__uninitialized_move_a(this->_M_impl._M_finish - __n, this->_M_impl._M_finish, this->_M_impl._M_finish, _M_get_Tp_allocator()); this->_M_impl._M_finish += __n; _GLIBCXX_MOVE_BACKWARD3(__position.base(), __old_finish - __n, __old_finish); std::fill(__position.base(), __position.base() + __n, __x_copy); } else { std::__uninitialized_fill_n_a(this->_M_impl._M_finish, __n - __elems_after, __x_copy, _M_get_Tp_allocator()); this->_M_impl._M_finish += __n - __elems_after; std::__uninitialized_move_a(__position.base(), __old_finish, this->_M_impl._M_finish, _M_get_Tp_allocator()); this->_M_impl._M_finish += __elems_after; std::fill(__position.base(), __old_finish, __x_copy); } } else { const size_type __len = _M_check_len(__n, "vector::_M_fill_insert"); const size_type __elems_before = __position - begin(); pointer __new_start(this->_M_allocate(__len)); pointer __new_finish(__new_start); __try { // See _M_insert_aux above. std::__uninitialized_fill_n_a(__new_start + __elems_before, __n, __x, _M_get_Tp_allocator()); __new_finish = 0; __new_finish = std::__uninitialized_move_if_noexcept_a (this->_M_impl._M_start, __position.base(), __new_start, _M_get_Tp_allocator()); __new_finish += __n; __new_finish = std::__uninitialized_move_if_noexcept_a (__position.base(), this->_M_impl._M_finish, __new_finish, _M_get_Tp_allocator()); } __catch(...) { if (!__new_finish) std::_Destroy(__new_start + __elems_before, __new_start + __elems_before + __n, _M_get_Tp_allocator()); else std::_Destroy(__new_start, __new_finish, _M_get_Tp_allocator()); _M_deallocate(__new_start, __len); __throw_exception_again; } std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, _M_get_Tp_allocator()); _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); this->_M_impl._M_start = __new_start; this->_M_impl._M_finish = __new_finish; this->_M_impl._M_end_of_storage = __new_start + __len; } } } #if __cplusplus >= 201103L template<typename _Tp, typename _Alloc> void vector<_Tp, _Alloc>:: _M_default_append(size_type __n) { if (__n != 0) { if (size_type(this->_M_impl._M_end_of_storage - this->_M_impl._M_finish) >= __n) { std::__uninitialized_default_n_a(this->_M_impl._M_finish, __n, _M_get_Tp_allocator()); this->_M_impl._M_finish += __n; } else { const size_type __len = _M_check_len(__n, "vector::_M_default_append"); const size_type __old_size = this->size(); pointer __new_start(this->_M_allocate(__len)); pointer __new_finish(__new_start); __try { __new_finish = std::__uninitialized_move_if_noexcept_a (this->_M_impl._M_start, this->_M_impl._M_finish, __new_start, _M_get_Tp_allocator()); std::__uninitialized_default_n_a(__new_finish, __n, _M_get_Tp_allocator()); __new_finish += __n; } __catch(...) { std::_Destroy(__new_start, __new_finish, _M_get_Tp_allocator()); _M_deallocate(__new_start, __len); __throw_exception_again; } std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, _M_get_Tp_allocator()); _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); this->_M_impl._M_start = __new_start; this->_M_impl._M_finish = __new_finish; this->_M_impl._M_end_of_storage = __new_start + __len; } } } template<typename _Tp, typename _Alloc> bool vector<_Tp, _Alloc>:: _M_shrink_to_fit() { if (capacity() == size()) return false; return std::__shrink_to_fit_aux<vector>::_S_do_it(*this); } #endif template<typename _Tp, typename _Alloc> template<typename _InputIterator> void vector<_Tp, _Alloc>:: _M_range_insert(iterator __pos, _InputIterator __first, _InputIterator __last, std::input_iterator_tag) { for (; __first != __last; ++__first) { __pos = insert(__pos, *__first); ++__pos; } } template<typename _Tp, typename _Alloc> template<typename _ForwardIterator> void vector<_Tp, _Alloc>:: _M_range_insert(iterator __position, _ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag) { if (__first != __last) { const size_type __n = std::distance(__first, __last); if (size_type(this->_M_impl._M_end_of_storage - this->_M_impl._M_finish) >= __n) { const size_type __elems_after = end() - __position; pointer __old_finish(this->_M_impl._M_finish); if (__elems_after > __n) { std::__uninitialized_move_a(this->_M_impl._M_finish - __n, this->_M_impl._M_finish, this->_M_impl._M_finish, _M_get_Tp_allocator()); this->_M_impl._M_finish += __n; _GLIBCXX_MOVE_BACKWARD3(__position.base(), __old_finish - __n, __old_finish); std::copy(__first, __last, __position); } else { _ForwardIterator __mid = __first; std::advance(__mid, __elems_after); std::__uninitialized_copy_a(__mid, __last, this->_M_impl._M_finish, _M_get_Tp_allocator()); this->_M_impl._M_finish += __n - __elems_after; std::__uninitialized_move_a(__position.base(), __old_finish, this->_M_impl._M_finish, _M_get_Tp_allocator()); this->_M_impl._M_finish += __elems_after; std::copy(__first, __mid, __position); } } else { const size_type __len = _M_check_len(__n, "vector::_M_range_insert"); pointer __new_start(this->_M_allocate(__len)); pointer __new_finish(__new_start); __try { __new_finish = std::__uninitialized_move_if_noexcept_a (this->_M_impl._M_start, __position.base(), __new_start, _M_get_Tp_allocator()); __new_finish = std::__uninitialized_copy_a(__first, __last, __new_finish, _M_get_Tp_allocator()); __new_finish = std::__uninitialized_move_if_noexcept_a (__position.base(), this->_M_impl._M_finish, __new_finish, _M_get_Tp_allocator()); } __catch(...) { std::_Destroy(__new_start, __new_finish, _M_get_Tp_allocator()); _M_deallocate(__new_start, __len); __throw_exception_again; } std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, _M_get_Tp_allocator()); _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); this->_M_impl._M_start = __new_start; this->_M_impl._M_finish = __new_finish; this->_M_impl._M_end_of_storage = __new_start + __len; } } } // vector<bool> template<typename _Alloc> void vector<bool, _Alloc>:: _M_reallocate(size_type __n) { _Bit_type* __q = this->_M_allocate(__n); this->_M_impl._M_finish = _M_copy_aligned(begin(), end(), iterator(__q, 0)); this->_M_deallocate(); this->_M_impl._M_start = iterator(__q, 0); this->_M_impl._M_end_of_storage = __q + _S_nword(__n); } template<typename _Alloc> void vector<bool, _Alloc>:: _M_fill_insert(iterator __position, size_type __n, bool __x) { if (__n == 0) return; if (capacity() - size() >= __n) { std::copy_backward(__position, end(), this->_M_impl._M_finish + difference_type(__n)); std::fill(__position, __position + difference_type(__n), __x); this->_M_impl._M_finish += difference_type(__n); } else { const size_type __len = _M_check_len(__n, "vector<bool>::_M_fill_insert"); _Bit_type * __q = this->_M_allocate(__len); iterator __i = _M_copy_aligned(begin(), __position, iterator(__q, 0)); std::fill(__i, __i + difference_type(__n), __x); this->_M_impl._M_finish = std::copy(__position, end(), __i + difference_type(__n)); this->_M_deallocate(); this->_M_impl._M_end_of_storage = __q + _S_nword(__len); this->_M_impl._M_start = iterator(__q, 0); } } template<typename _Alloc> template<typename _ForwardIterator> void vector<bool, _Alloc>:: _M_insert_range(iterator __position, _ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag) { if (__first != __last) { size_type __n = std::distance(__first, __last); if (capacity() - size() >= __n) { std::copy_backward(__position, end(), this->_M_impl._M_finish + difference_type(__n)); std::copy(__first, __last, __position); this->_M_impl._M_finish += difference_type(__n); } else { const size_type __len = _M_check_len(__n, "vector<bool>::_M_insert_range"); _Bit_type * __q = this->_M_allocate(__len); iterator __i = _M_copy_aligned(begin(), __position, iterator(__q, 0)); __i = std::copy(__first, __last, __i); this->_M_impl._M_finish = std::copy(__position, end(), __i); this->_M_deallocate(); this->_M_impl._M_end_of_storage = __q + _S_nword(__len); this->_M_impl._M_start = iterator(__q, 0); } } } template<typename _Alloc> void vector<bool, _Alloc>:: _M_insert_aux(iterator __position, bool __x) { if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage) { std::copy_backward(__position, this->_M_impl._M_finish, this->_M_impl._M_finish + 1); *__position = __x; ++this->_M_impl._M_finish; } else { const size_type __len = _M_check_len(size_type(1), "vector<bool>::_M_insert_aux"); _Bit_type * __q = this->_M_allocate(__len); iterator __i = _M_copy_aligned(begin(), __position, iterator(__q, 0)); *__i++ = __x; this->_M_impl._M_finish = std::copy(__position, end(), __i); this->_M_deallocate(); this->_M_impl._M_end_of_storage = __q + _S_nword(__len); this->_M_impl._M_start = iterator(__q, 0); } } #if __cplusplus >= 201103L template<typename _Alloc> bool vector<bool, _Alloc>:: _M_shrink_to_fit() { if (capacity() - size() < int(_S_word_bit)) return false; __try { _M_reallocate(size()); return true; } __catch(...) { return false; } } #endif _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std #if __cplusplus >= 201103L namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Alloc> size_t hash<_GLIBCXX_STD_C::vector<bool, _Alloc>>:: operator()(const _GLIBCXX_STD_C::vector<bool, _Alloc>& __b) const noexcept { size_t __hash = 0; using _GLIBCXX_STD_C::_S_word_bit; using _GLIBCXX_STD_C::_Bit_type; const size_t __words = __b.size() / _S_word_bit; if (__words) { const size_t __clength = __words * sizeof(_Bit_type); __hash = std::_Hash_impl::hash(__b._M_impl._M_start._M_p, __clength); } const size_t __extrabits = __b.size() % _S_word_bit; if (__extrabits) { _Bit_type __hiword = *__b._M_impl._M_finish._M_p; __hiword &= ~((~static_cast<_Bit_type>(0)) << __extrabits); const size_t __clength = (__extrabits + __CHAR_BIT__ - 1) / __CHAR_BIT__; if (__words) __hash = std::_Hash_impl::hash(&__hiword, __clength, __hash); else __hash = std::_Hash_impl::hash(&__hiword, __clength); } return __hash; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif // C++11 #endif /* _VECTOR_TCC */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/valarray_array.h���������������������������������������������������������������������0000644�����������������00000052357�14763166030�0011740 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// The template and inlines for the -*- C++ -*- internal _Array helper class. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/valarray_array.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{valarray} */ // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr> #ifndef _VALARRAY_ARRAY_H #define _VALARRAY_ARRAY_H 1 #pragma GCC system_header #include <bits/c++config.h> #include <bits/cpp_type_traits.h> #include <cstdlib> #include <new> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // // Helper functions on raw pointers // // We get memory by the old fashion way inline void* __valarray_get_memory(size_t __n) { return operator new(__n); } template<typename _Tp> inline _Tp*__restrict__ __valarray_get_storage(size_t __n) { return static_cast<_Tp*__restrict__> (std::__valarray_get_memory(__n * sizeof(_Tp))); } // Return memory to the system inline void __valarray_release_memory(void* __p) { operator delete(__p); } // Turn a raw-memory into an array of _Tp filled with _Tp() // This is required in 'valarray<T> v(n);' template<typename _Tp, bool> struct _Array_default_ctor { // Please note that this isn't exception safe. But // valarrays aren't required to be exception safe. inline static void _S_do_it(_Tp* __b, _Tp* __e) { while (__b != __e) new(__b++) _Tp(); } }; template<typename _Tp> struct _Array_default_ctor<_Tp, true> { // For fundamental types, it suffices to say 'memset()' inline static void _S_do_it(_Tp* __b, _Tp* __e) { __builtin_memset(__b, 0, (__e - __b) * sizeof(_Tp)); } }; template<typename _Tp> inline void __valarray_default_construct(_Tp* __b, _Tp* __e) { _Array_default_ctor<_Tp, __is_scalar<_Tp>::__value>::_S_do_it(__b, __e); } // Turn a raw-memory into an array of _Tp filled with __t // This is the required in valarray<T> v(n, t). Also // used in valarray<>::resize(). template<typename _Tp, bool> struct _Array_init_ctor { // Please note that this isn't exception safe. But // valarrays aren't required to be exception safe. inline static void _S_do_it(_Tp* __b, _Tp* __e, const _Tp __t) { while (__b != __e) new(__b++) _Tp(__t); } }; template<typename _Tp> struct _Array_init_ctor<_Tp, true> { inline static void _S_do_it(_Tp* __b, _Tp* __e, const _Tp __t) { while (__b != __e) *__b++ = __t; } }; template<typename _Tp> inline void __valarray_fill_construct(_Tp* __b, _Tp* __e, const _Tp __t) { _Array_init_ctor<_Tp, __is_trivial(_Tp)>::_S_do_it(__b, __e, __t); } // // copy-construct raw array [__o, *) from plain array [__b, __e) // We can't just say 'memcpy()' // template<typename _Tp, bool> struct _Array_copy_ctor { // Please note that this isn't exception safe. But // valarrays aren't required to be exception safe. inline static void _S_do_it(const _Tp* __b, const _Tp* __e, _Tp* __restrict__ __o) { while (__b != __e) new(__o++) _Tp(*__b++); } }; template<typename _Tp> struct _Array_copy_ctor<_Tp, true> { inline static void _S_do_it(const _Tp* __b, const _Tp* __e, _Tp* __restrict__ __o) { __builtin_memcpy(__o, __b, (__e - __b) * sizeof(_Tp)); } }; template<typename _Tp> inline void __valarray_copy_construct(const _Tp* __b, const _Tp* __e, _Tp* __restrict__ __o) { _Array_copy_ctor<_Tp, __is_trivial(_Tp)>::_S_do_it(__b, __e, __o); } // copy-construct raw array [__o, *) from strided array __a[<__n : __s>] template<typename _Tp> inline void __valarray_copy_construct (const _Tp* __restrict__ __a, size_t __n, size_t __s, _Tp* __restrict__ __o) { if (__is_trivial(_Tp)) while (__n--) { *__o++ = *__a; __a += __s; } else while (__n--) { new(__o++) _Tp(*__a); __a += __s; } } // copy-construct raw array [__o, *) from indexed array __a[__i[<__n>]] template<typename _Tp> inline void __valarray_copy_construct (const _Tp* __restrict__ __a, const size_t* __restrict__ __i, _Tp* __restrict__ __o, size_t __n) { if (__is_trivial(_Tp)) while (__n--) *__o++ = __a[*__i++]; else while (__n--) new (__o++) _Tp(__a[*__i++]); } // Do the necessary cleanup when we're done with arrays. template<typename _Tp> inline void __valarray_destroy_elements(_Tp* __b, _Tp* __e) { if (!__is_trivial(_Tp)) while (__b != __e) { __b->~_Tp(); ++__b; } } // Fill a plain array __a[<__n>] with __t template<typename _Tp> inline void __valarray_fill(_Tp* __restrict__ __a, size_t __n, const _Tp& __t) { while (__n--) *__a++ = __t; } // fill strided array __a[<__n-1 : __s>] with __t template<typename _Tp> inline void __valarray_fill(_Tp* __restrict__ __a, size_t __n, size_t __s, const _Tp& __t) { for (size_t __i = 0; __i < __n; ++__i, __a += __s) *__a = __t; } // fill indirect array __a[__i[<__n>]] with __i template<typename _Tp> inline void __valarray_fill(_Tp* __restrict__ __a, const size_t* __restrict__ __i, size_t __n, const _Tp& __t) { for (size_t __j = 0; __j < __n; ++__j, ++__i) __a[*__i] = __t; } // copy plain array __a[<__n>] in __b[<__n>] // For non-fundamental types, it is wrong to say 'memcpy()' template<typename _Tp, bool> struct _Array_copier { inline static void _S_do_it(const _Tp* __restrict__ __a, size_t __n, _Tp* __restrict__ __b) { while(__n--) *__b++ = *__a++; } }; template<typename _Tp> struct _Array_copier<_Tp, true> { inline static void _S_do_it(const _Tp* __restrict__ __a, size_t __n, _Tp* __restrict__ __b) { __builtin_memcpy(__b, __a, __n * sizeof (_Tp)); } }; // Copy a plain array __a[<__n>] into a play array __b[<>] template<typename _Tp> inline void __valarray_copy(const _Tp* __restrict__ __a, size_t __n, _Tp* __restrict__ __b) { _Array_copier<_Tp, __is_trivial(_Tp)>::_S_do_it(__a, __n, __b); } // Copy strided array __a[<__n : __s>] in plain __b[<__n>] template<typename _Tp> inline void __valarray_copy(const _Tp* __restrict__ __a, size_t __n, size_t __s, _Tp* __restrict__ __b) { for (size_t __i = 0; __i < __n; ++__i, ++__b, __a += __s) *__b = *__a; } // Copy a plain array __a[<__n>] into a strided array __b[<__n : __s>] template<typename _Tp> inline void __valarray_copy(const _Tp* __restrict__ __a, _Tp* __restrict__ __b, size_t __n, size_t __s) { for (size_t __i = 0; __i < __n; ++__i, ++__a, __b += __s) *__b = *__a; } // Copy strided array __src[<__n : __s1>] into another // strided array __dst[< : __s2>]. Their sizes must match. template<typename _Tp> inline void __valarray_copy(const _Tp* __restrict__ __src, size_t __n, size_t __s1, _Tp* __restrict__ __dst, size_t __s2) { for (size_t __i = 0; __i < __n; ++__i) __dst[__i * __s2] = __src[__i * __s1]; } // Copy an indexed array __a[__i[<__n>]] in plain array __b[<__n>] template<typename _Tp> inline void __valarray_copy(const _Tp* __restrict__ __a, const size_t* __restrict__ __i, _Tp* __restrict__ __b, size_t __n) { for (size_t __j = 0; __j < __n; ++__j, ++__b, ++__i) *__b = __a[*__i]; } // Copy a plain array __a[<__n>] in an indexed array __b[__i[<__n>]] template<typename _Tp> inline void __valarray_copy(const _Tp* __restrict__ __a, size_t __n, _Tp* __restrict__ __b, const size_t* __restrict__ __i) { for (size_t __j = 0; __j < __n; ++__j, ++__a, ++__i) __b[*__i] = *__a; } // Copy the __n first elements of an indexed array __src[<__i>] into // another indexed array __dst[<__j>]. template<typename _Tp> inline void __valarray_copy(const _Tp* __restrict__ __src, size_t __n, const size_t* __restrict__ __i, _Tp* __restrict__ __dst, const size_t* __restrict__ __j) { for (size_t __k = 0; __k < __n; ++__k) __dst[*__j++] = __src[*__i++]; } // // Compute the sum of elements in range [__f, __l) // This is a naive algorithm. It suffers from cancelling. // In the future try to specialize // for _Tp = float, double, long double using a more accurate // algorithm. // template<typename _Tp> inline _Tp __valarray_sum(const _Tp* __f, const _Tp* __l) { _Tp __r = _Tp(); while (__f != __l) __r += *__f++; return __r; } // Compute the product of all elements in range [__f, __l) template<typename _Tp> inline _Tp __valarray_product(const _Tp* __f, const _Tp* __l) { _Tp __r = _Tp(1); while (__f != __l) __r = __r * *__f++; return __r; } // Compute the min/max of an array-expression template<typename _Ta> inline typename _Ta::value_type __valarray_min(const _Ta& __a) { size_t __s = __a.size(); typedef typename _Ta::value_type _Value_type; _Value_type __r = __s == 0 ? _Value_type() : __a[0]; for (size_t __i = 1; __i < __s; ++__i) { _Value_type __t = __a[__i]; if (__t < __r) __r = __t; } return __r; } template<typename _Ta> inline typename _Ta::value_type __valarray_max(const _Ta& __a) { size_t __s = __a.size(); typedef typename _Ta::value_type _Value_type; _Value_type __r = __s == 0 ? _Value_type() : __a[0]; for (size_t __i = 1; __i < __s; ++__i) { _Value_type __t = __a[__i]; if (__t > __r) __r = __t; } return __r; } // // Helper class _Array, first layer of valarray abstraction. // All operations on valarray should be forwarded to this class // whenever possible. -- gdr // template<typename _Tp> struct _Array { explicit _Array(size_t); explicit _Array(_Tp* const __restrict__); explicit _Array(const valarray<_Tp>&); _Array(const _Tp* __restrict__, size_t); _Tp* begin() const; _Tp* const __restrict__ _M_data; }; // Copy-construct plain array __b[<__n>] from indexed array __a[__i[<__n>]] template<typename _Tp> inline void __valarray_copy_construct(_Array<_Tp> __a, _Array<size_t> __i, _Array<_Tp> __b, size_t __n) { std::__valarray_copy_construct(__a._M_data, __i._M_data, __b._M_data, __n); } // Copy-construct plain array __b[<__n>] from strided array __a[<__n : __s>] template<typename _Tp> inline void __valarray_copy_construct(_Array<_Tp> __a, size_t __n, size_t __s, _Array<_Tp> __b) { std::__valarray_copy_construct(__a._M_data, __n, __s, __b._M_data); } template<typename _Tp> inline void __valarray_fill (_Array<_Tp> __a, size_t __n, const _Tp& __t) { std::__valarray_fill(__a._M_data, __n, __t); } template<typename _Tp> inline void __valarray_fill(_Array<_Tp> __a, size_t __n, size_t __s, const _Tp& __t) { std::__valarray_fill(__a._M_data, __n, __s, __t); } template<typename _Tp> inline void __valarray_fill(_Array<_Tp> __a, _Array<size_t> __i, size_t __n, const _Tp& __t) { std::__valarray_fill(__a._M_data, __i._M_data, __n, __t); } // Copy a plain array __a[<__n>] into a play array __b[<>] template<typename _Tp> inline void __valarray_copy(_Array<_Tp> __a, size_t __n, _Array<_Tp> __b) { std::__valarray_copy(__a._M_data, __n, __b._M_data); } // Copy strided array __a[<__n : __s>] in plain __b[<__n>] template<typename _Tp> inline void __valarray_copy(_Array<_Tp> __a, size_t __n, size_t __s, _Array<_Tp> __b) { std::__valarray_copy(__a._M_data, __n, __s, __b._M_data); } // Copy a plain array __a[<__n>] into a strided array __b[<__n : __s>] template<typename _Tp> inline void __valarray_copy(_Array<_Tp> __a, _Array<_Tp> __b, size_t __n, size_t __s) { __valarray_copy(__a._M_data, __b._M_data, __n, __s); } // Copy strided array __src[<__n : __s1>] into another // strided array __dst[< : __s2>]. Their sizes must match. template<typename _Tp> inline void __valarray_copy(_Array<_Tp> __a, size_t __n, size_t __s1, _Array<_Tp> __b, size_t __s2) { std::__valarray_copy(__a._M_data, __n, __s1, __b._M_data, __s2); } // Copy an indexed array __a[__i[<__n>]] in plain array __b[<__n>] template<typename _Tp> inline void __valarray_copy(_Array<_Tp> __a, _Array<size_t> __i, _Array<_Tp> __b, size_t __n) { std::__valarray_copy(__a._M_data, __i._M_data, __b._M_data, __n); } // Copy a plain array __a[<__n>] in an indexed array __b[__i[<__n>]] template<typename _Tp> inline void __valarray_copy(_Array<_Tp> __a, size_t __n, _Array<_Tp> __b, _Array<size_t> __i) { std::__valarray_copy(__a._M_data, __n, __b._M_data, __i._M_data); } // Copy the __n first elements of an indexed array __src[<__i>] into // another indexed array __dst[<__j>]. template<typename _Tp> inline void __valarray_copy(_Array<_Tp> __src, size_t __n, _Array<size_t> __i, _Array<_Tp> __dst, _Array<size_t> __j) { std::__valarray_copy(__src._M_data, __n, __i._M_data, __dst._M_data, __j._M_data); } template<typename _Tp> inline _Array<_Tp>::_Array(size_t __n) : _M_data(__valarray_get_storage<_Tp>(__n)) { std::__valarray_default_construct(_M_data, _M_data + __n); } template<typename _Tp> inline _Array<_Tp>::_Array(_Tp* const __restrict__ __p) : _M_data (__p) {} template<typename _Tp> inline _Array<_Tp>::_Array(const valarray<_Tp>& __v) : _M_data (__v._M_data) {} template<typename _Tp> inline _Array<_Tp>::_Array(const _Tp* __restrict__ __b, size_t __s) : _M_data(__valarray_get_storage<_Tp>(__s)) { std::__valarray_copy_construct(__b, __s, _M_data); } template<typename _Tp> inline _Tp* _Array<_Tp>::begin () const { return _M_data; } #define _DEFINE_ARRAY_FUNCTION(_Op, _Name) \ template<typename _Tp> \ inline void \ _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, const _Tp& __t) \ { \ for (_Tp* __p = __a._M_data; __p < __a._M_data + __n; ++__p) \ *__p _Op##= __t; \ } \ \ template<typename _Tp> \ inline void \ _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, _Array<_Tp> __b) \ { \ _Tp* __p = __a._M_data; \ for (_Tp* __q = __b._M_data; __q < __b._M_data + __n; ++__p, ++__q) \ *__p _Op##= *__q; \ } \ \ template<typename _Tp, class _Dom> \ void \ _Array_augmented_##_Name(_Array<_Tp> __a, \ const _Expr<_Dom, _Tp>& __e, size_t __n) \ { \ _Tp* __p(__a._M_data); \ for (size_t __i = 0; __i < __n; ++__i, ++__p) \ *__p _Op##= __e[__i]; \ } \ \ template<typename _Tp> \ inline void \ _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, size_t __s, \ _Array<_Tp> __b) \ { \ _Tp* __q(__b._M_data); \ for (_Tp* __p = __a._M_data; __p < __a._M_data + __s * __n; \ __p += __s, ++__q) \ *__p _Op##= *__q; \ } \ \ template<typename _Tp> \ inline void \ _Array_augmented_##_Name(_Array<_Tp> __a, _Array<_Tp> __b, \ size_t __n, size_t __s) \ { \ _Tp* __q(__b._M_data); \ for (_Tp* __p = __a._M_data; __p < __a._M_data + __n; \ ++__p, __q += __s) \ *__p _Op##= *__q; \ } \ \ template<typename _Tp, class _Dom> \ void \ _Array_augmented_##_Name(_Array<_Tp> __a, size_t __s, \ const _Expr<_Dom, _Tp>& __e, size_t __n) \ { \ _Tp* __p(__a._M_data); \ for (size_t __i = 0; __i < __n; ++__i, __p += __s) \ *__p _Op##= __e[__i]; \ } \ \ template<typename _Tp> \ inline void \ _Array_augmented_##_Name(_Array<_Tp> __a, _Array<size_t> __i, \ _Array<_Tp> __b, size_t __n) \ { \ _Tp* __q(__b._M_data); \ for (size_t* __j = __i._M_data; __j < __i._M_data + __n; \ ++__j, ++__q) \ __a._M_data[*__j] _Op##= *__q; \ } \ \ template<typename _Tp> \ inline void \ _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, \ _Array<_Tp> __b, _Array<size_t> __i) \ { \ _Tp* __p(__a._M_data); \ for (size_t* __j = __i._M_data; __j<__i._M_data + __n; \ ++__j, ++__p) \ *__p _Op##= __b._M_data[*__j]; \ } \ \ template<typename _Tp, class _Dom> \ void \ _Array_augmented_##_Name(_Array<_Tp> __a, _Array<size_t> __i, \ const _Expr<_Dom, _Tp>& __e, size_t __n) \ { \ size_t* __j(__i._M_data); \ for (size_t __k = 0; __k<__n; ++__k, ++__j) \ __a._M_data[*__j] _Op##= __e[__k]; \ } \ \ template<typename _Tp> \ void \ _Array_augmented_##_Name(_Array<_Tp> __a, _Array<bool> __m, \ _Array<_Tp> __b, size_t __n) \ { \ bool* __ok(__m._M_data); \ _Tp* __p(__a._M_data); \ for (_Tp* __q = __b._M_data; __q < __b._M_data + __n; \ ++__q, ++__ok, ++__p) \ { \ while (! *__ok) \ { \ ++__ok; \ ++__p; \ } \ *__p _Op##= *__q; \ } \ } \ \ template<typename _Tp> \ void \ _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, \ _Array<_Tp> __b, _Array<bool> __m) \ { \ bool* __ok(__m._M_data); \ _Tp* __q(__b._M_data); \ for (_Tp* __p = __a._M_data; __p < __a._M_data + __n; \ ++__p, ++__ok, ++__q) \ { \ while (! *__ok) \ { \ ++__ok; \ ++__q; \ } \ *__p _Op##= *__q; \ } \ } \ \ template<typename _Tp, class _Dom> \ void \ _Array_augmented_##_Name(_Array<_Tp> __a, _Array<bool> __m, \ const _Expr<_Dom, _Tp>& __e, size_t __n) \ { \ bool* __ok(__m._M_data); \ _Tp* __p(__a._M_data); \ for (size_t __i = 0; __i < __n; ++__i, ++__ok, ++__p) \ { \ while (! *__ok) \ { \ ++__ok; \ ++__p; \ } \ *__p _Op##= __e[__i]; \ } \ } _DEFINE_ARRAY_FUNCTION(+, __plus) _DEFINE_ARRAY_FUNCTION(-, __minus) _DEFINE_ARRAY_FUNCTION(*, __multiplies) _DEFINE_ARRAY_FUNCTION(/, __divides) _DEFINE_ARRAY_FUNCTION(%, __modulus) _DEFINE_ARRAY_FUNCTION(^, __bitwise_xor) _DEFINE_ARRAY_FUNCTION(|, __bitwise_or) _DEFINE_ARRAY_FUNCTION(&, __bitwise_and) _DEFINE_ARRAY_FUNCTION(<<, __shift_left) _DEFINE_ARRAY_FUNCTION(>>, __shift_right) #undef _DEFINE_ARRAY_FUNCTION _GLIBCXX_END_NAMESPACE_VERSION } // namespace # include <bits/valarray_array.tcc> #endif /* _ARRAY_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/regex_grep_matcher.tcc���������������������������������������������������������������0000644�����������������00000012645�14763166030�0013071 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// class template regex -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** * @file bits/regex_grep_matcher.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{regex} */ #include <regex> namespace std _GLIBCXX_VISIBILITY(default) { namespace { // A stack of states used in evaluating the NFA. typedef std::stack<std::__detail::_StateIdT, std::vector<std::__detail::_StateIdT> > _StateStack; // Obtains the next state set given the current state set __s and the current // input character. inline std::__detail::_StateSet __move(const std::__detail::_PatternCursor& __p, const std::__detail::_Nfa& __nfa, const std::__detail::_StateSet& __s) { std::__detail::_StateSet __m; for (std::__detail::_StateSet::const_iterator __i = __s.begin(); __i != __s.end(); ++__i) { if (*__i == std::__detail::_S_invalid_state_id) continue; const std::__detail::_State& __state = __nfa[*__i]; if (__state._M_opcode == std::__detail::_S_opcode_match && __state._M_matches(__p)) __m.insert(__state._M_next); } return __m; } // returns true if (__s intersect __t) is not empty inline bool __includes_some(const std::__detail::_StateSet& __s, const std::__detail::_StateSet& __t) { if (__s.size() > 0 && __t.size() > 0) { std::__detail::_StateSet::const_iterator __first = __s.begin(); std::__detail::_StateSet::const_iterator __second = __t.begin(); while (__first != __s.end() && __second != __t.end()) { if (*__first < *__second) ++__first; else if (*__second < *__first) ++__second; else return true; } } return false; } // If an identified state __u is not already in the current state set __e, // insert it and push it on the current state stack __s. inline void __add_visited_state(const std::__detail::_StateIdT __u, _StateStack& __s, std::__detail::_StateSet& __e) { if (__e.count(__u) == 0) { __e.insert(__u); __s.push(__u); } } } // anonymous namespace namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION inline _Grep_matcher:: _Grep_matcher(_PatternCursor& __p, _Results& __r, const _AutomatonPtr& __nfa, regex_constants::match_flag_type __flags) : _M_nfa(static_pointer_cast<_Nfa>(__nfa)), _M_pattern(__p), _M_results(__r) { __detail::_StateSet __t = this->_M_e_closure(_M_nfa->_M_start()); for (; !_M_pattern._M_at_end(); _M_pattern._M_next()) __t = this->_M_e_closure(__move(_M_pattern, *_M_nfa, __t)); _M_results._M_set_matched(0, __includes_some(_M_nfa->_M_final_states(), __t)); } // Creates the e-closure set for the initial state __i. inline _StateSet _Grep_matcher:: _M_e_closure(_StateIdT __i) { _StateSet __s; __s.insert(__i); _StateStack __stack; __stack.push(__i); return this->_M_e_closure(__stack, __s); } // Creates the e-closure set for an arbitrary state set __s. inline _StateSet _Grep_matcher:: _M_e_closure(const _StateSet& __s) { _StateStack __stack; for (_StateSet::const_iterator __i = __s.begin(); __i != __s.end(); ++__i) __stack.push(*__i); return this->_M_e_closure(__stack, __s); } inline _StateSet _Grep_matcher:: _M_e_closure(_StateStack& __stack, const _StateSet& __s) { _StateSet __e = __s; while (!__stack.empty()) { _StateIdT __t = __stack.top(); __stack.pop(); if (__t == _S_invalid_state_id) continue; // for each __u with edge from __t to __u labeled e do ... const _State& __state = _M_nfa->operator[](__t); switch (__state._M_opcode) { case _S_opcode_alternative: __add_visited_state(__state._M_next, __stack, __e); __add_visited_state(__state._M_alt, __stack, __e); break; case _S_opcode_subexpr_begin: __add_visited_state(__state._M_next, __stack, __e); __state._M_tagger(_M_pattern, _M_results); break; case _S_opcode_subexpr_end: __add_visited_state(__state._M_next, __stack, __e); __state._M_tagger(_M_pattern, _M_results); _M_results._M_set_matched(__state._M_subexpr, true); break; case _S_opcode_accept: __add_visited_state(__state._M_next, __stack, __e); break; default: break; } } return __e; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace __detail } // namespace �������������������������������������������������������������������������������������������c++/4.8.2/bits/hashtable_policy.h�������������������������������������������������������������������0000644�����������������00000151343�14763166030�0012226 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Internal policy header for unordered_set and unordered_map -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/hashtable_policy.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. * @headername{unordered_map,unordered_set} */ #ifndef _HASHTABLE_POLICY_H #define _HASHTABLE_POLICY_H 1 namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> class _Hashtable; _GLIBCXX_END_NAMESPACE_VERSION namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup hashtable-detail Base and Implementation Classes * @ingroup unordered_associative_containers * @{ */ template<typename _Key, typename _Value, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _Traits> struct _Hashtable_base; // Helper function: return distance(first, last) for forward // iterators, or 0 for input iterators. template<class _Iterator> inline typename std::iterator_traits<_Iterator>::difference_type __distance_fw(_Iterator __first, _Iterator __last, std::input_iterator_tag) { return 0; } template<class _Iterator> inline typename std::iterator_traits<_Iterator>::difference_type __distance_fw(_Iterator __first, _Iterator __last, std::forward_iterator_tag) { return std::distance(__first, __last); } template<class _Iterator> inline typename std::iterator_traits<_Iterator>::difference_type __distance_fw(_Iterator __first, _Iterator __last) { typedef typename std::iterator_traits<_Iterator>::iterator_category _Tag; return __distance_fw(__first, __last, _Tag()); } // Helper type used to detect whether the hash functor is noexcept. template <typename _Key, typename _Hash> struct __is_noexcept_hash : std::integral_constant<bool, noexcept(declval<const _Hash&>()(declval<const _Key&>()))> { }; struct _Identity { template<typename _Tp> _Tp&& operator()(_Tp&& __x) const { return std::forward<_Tp>(__x); } }; struct _Select1st { template<typename _Tp> auto operator()(_Tp&& __x) const -> decltype(std::get<0>(std::forward<_Tp>(__x))) { return std::get<0>(std::forward<_Tp>(__x)); } }; // Auxiliary types used for all instantiations of _Hashtable nodes // and iterators. /** * struct _Hashtable_traits * * Important traits for hash tables. * * @tparam _Cache_hash_code Boolean value. True if the value of * the hash function is stored along with the value. This is a * time-space tradeoff. Storing it may improve lookup speed by * reducing the number of times we need to call the _Equal * function. * * @tparam _Constant_iterators Boolean value. True if iterator and * const_iterator are both constant iterator types. This is true * for unordered_set and unordered_multiset, false for * unordered_map and unordered_multimap. * * @tparam _Unique_keys Boolean value. True if the return value * of _Hashtable::count(k) is always at most one, false if it may * be an arbitrary number. This is true for unordered_set and * unordered_map, false for unordered_multiset and * unordered_multimap. */ template<bool _Cache_hash_code, bool _Constant_iterators, bool _Unique_keys> struct _Hashtable_traits { template<bool _Cond> using __bool_constant = integral_constant<bool, _Cond>; using __hash_cached = __bool_constant<_Cache_hash_code>; using __constant_iterators = __bool_constant<_Constant_iterators>; using __unique_keys = __bool_constant<_Unique_keys>; }; /** * struct _Hash_node_base * * Nodes, used to wrap elements stored in the hash table. A policy * template parameter of class template _Hashtable controls whether * nodes also store a hash code. In some cases (e.g. strings) this * may be a performance win. */ struct _Hash_node_base { _Hash_node_base* _M_nxt; _Hash_node_base() : _M_nxt() { } _Hash_node_base(_Hash_node_base* __next) : _M_nxt(__next) { } }; /** * Primary template struct _Hash_node. */ template<typename _Value, bool _Cache_hash_code> struct _Hash_node; /** * Specialization for nodes with caches, struct _Hash_node. * * Base class is __detail::_Hash_node_base. */ template<typename _Value> struct _Hash_node<_Value, true> : _Hash_node_base { _Value _M_v; std::size_t _M_hash_code; template<typename... _Args> _Hash_node(_Args&&... __args) : _M_v(std::forward<_Args>(__args)...), _M_hash_code() { } _Hash_node* _M_next() const { return static_cast<_Hash_node*>(_M_nxt); } }; /** * Specialization for nodes without caches, struct _Hash_node. * * Base class is __detail::_Hash_node_base. */ template<typename _Value> struct _Hash_node<_Value, false> : _Hash_node_base { _Value _M_v; template<typename... _Args> _Hash_node(_Args&&... __args) : _M_v(std::forward<_Args>(__args)...) { } _Hash_node* _M_next() const { return static_cast<_Hash_node*>(_M_nxt); } }; /// Base class for node iterators. template<typename _Value, bool _Cache_hash_code> struct _Node_iterator_base { using __node_type = _Hash_node<_Value, _Cache_hash_code>; __node_type* _M_cur; _Node_iterator_base(__node_type* __p) : _M_cur(__p) { } void _M_incr() { _M_cur = _M_cur->_M_next(); } }; template<typename _Value, bool _Cache_hash_code> inline bool operator==(const _Node_iterator_base<_Value, _Cache_hash_code>& __x, const _Node_iterator_base<_Value, _Cache_hash_code >& __y) { return __x._M_cur == __y._M_cur; } template<typename _Value, bool _Cache_hash_code> inline bool operator!=(const _Node_iterator_base<_Value, _Cache_hash_code>& __x, const _Node_iterator_base<_Value, _Cache_hash_code>& __y) { return __x._M_cur != __y._M_cur; } /// Node iterators, used to iterate through all the hashtable. template<typename _Value, bool __constant_iterators, bool __cache> struct _Node_iterator : public _Node_iterator_base<_Value, __cache> { private: using __base_type = _Node_iterator_base<_Value, __cache>; using __node_type = typename __base_type::__node_type; public: typedef _Value value_type; typedef std::ptrdiff_t difference_type; typedef std::forward_iterator_tag iterator_category; using pointer = typename std::conditional<__constant_iterators, const _Value*, _Value*>::type; using reference = typename std::conditional<__constant_iterators, const _Value&, _Value&>::type; _Node_iterator() : __base_type(0) { } explicit _Node_iterator(__node_type* __p) : __base_type(__p) { } reference operator*() const { return this->_M_cur->_M_v; } pointer operator->() const { return std::__addressof(this->_M_cur->_M_v); } _Node_iterator& operator++() { this->_M_incr(); return *this; } _Node_iterator operator++(int) { _Node_iterator __tmp(*this); this->_M_incr(); return __tmp; } }; /// Node const_iterators, used to iterate through all the hashtable. template<typename _Value, bool __constant_iterators, bool __cache> struct _Node_const_iterator : public _Node_iterator_base<_Value, __cache> { private: using __base_type = _Node_iterator_base<_Value, __cache>; using __node_type = typename __base_type::__node_type; public: typedef _Value value_type; typedef std::ptrdiff_t difference_type; typedef std::forward_iterator_tag iterator_category; typedef const _Value* pointer; typedef const _Value& reference; _Node_const_iterator() : __base_type(0) { } explicit _Node_const_iterator(__node_type* __p) : __base_type(__p) { } _Node_const_iterator(const _Node_iterator<_Value, __constant_iterators, __cache>& __x) : __base_type(__x._M_cur) { } reference operator*() const { return this->_M_cur->_M_v; } pointer operator->() const { return std::__addressof(this->_M_cur->_M_v); } _Node_const_iterator& operator++() { this->_M_incr(); return *this; } _Node_const_iterator operator++(int) { _Node_const_iterator __tmp(*this); this->_M_incr(); return __tmp; } }; // Many of class template _Hashtable's template parameters are policy // classes. These are defaults for the policies. /// Default range hashing function: use division to fold a large number /// into the range [0, N). struct _Mod_range_hashing { typedef std::size_t first_argument_type; typedef std::size_t second_argument_type; typedef std::size_t result_type; result_type operator()(first_argument_type __num, second_argument_type __den) const { return __num % __den; } }; /// Default ranged hash function H. In principle it should be a /// function object composed from objects of type H1 and H2 such that /// h(k, N) = h2(h1(k), N), but that would mean making extra copies of /// h1 and h2. So instead we'll just use a tag to tell class template /// hashtable to do that composition. struct _Default_ranged_hash { }; /// Default value for rehash policy. Bucket size is (usually) the /// smallest prime that keeps the load factor small enough. struct _Prime_rehash_policy { _Prime_rehash_policy(float __z = 1.0) : _M_max_load_factor(__z), _M_next_resize(0) { } float max_load_factor() const noexcept { return _M_max_load_factor; } // Return a bucket size no smaller than n. std::size_t _M_next_bkt(std::size_t __n) const; // Return a bucket count appropriate for n elements std::size_t _M_bkt_for_elements(std::size_t __n) const { return __builtin_ceil(__n / (long double)_M_max_load_factor); } // __n_bkt is current bucket count, __n_elt is current element count, // and __n_ins is number of elements to be inserted. Do we need to // increase bucket count? If so, return make_pair(true, n), where n // is the new bucket count. If not, return make_pair(false, 0). std::pair<bool, std::size_t> _M_need_rehash(std::size_t __n_bkt, std::size_t __n_elt, std::size_t __n_ins) const; typedef std::size_t _State; _State _M_state() const { return _M_next_resize; } void _M_reset(_State __state) { _M_next_resize = __state; } enum { _S_n_primes = sizeof(unsigned long) != 8 ? 256 : 256 + 48 }; static const std::size_t _S_growth_factor = 2; float _M_max_load_factor; mutable std::size_t _M_next_resize; }; // Base classes for std::_Hashtable. We define these base classes // because in some cases we want to do different things depending on // the value of a policy class. In some cases the policy class // affects which member functions and nested typedefs are defined; // we handle that by specializing base class templates. Several of // the base class templates need to access other members of class // template _Hashtable, so we use a variant of the "Curiously // Recurring Template Pattern" (CRTP) technique. /** * Primary class template _Map_base. * * If the hashtable has a value type of the form pair<T1, T2> and a * key extraction policy (_ExtractKey) that returns the first part * of the pair, the hashtable gets a mapped_type typedef. If it * satisfies those criteria and also has unique keys, then it also * gets an operator[]. */ template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits, bool _Unique_keys = _Traits::__unique_keys::value> struct _Map_base { }; /// Partial specialization, __unique_keys set to false. template<typename _Key, typename _Pair, typename _Alloc, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> struct _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, false> { using mapped_type = typename std::tuple_element<1, _Pair>::type; }; /// Partial specialization, __unique_keys set to true. template<typename _Key, typename _Pair, typename _Alloc, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> struct _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true> { private: using __hashtable_base = __detail::_Hashtable_base<_Key, _Pair, _Select1st, _Equal, _H1, _H2, _Hash, _Traits>; using __hashtable = _Hashtable<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>; using __hash_code = typename __hashtable_base::__hash_code; using __node_type = typename __hashtable_base::__node_type; public: using key_type = typename __hashtable_base::key_type; using iterator = typename __hashtable_base::iterator; using mapped_type = typename std::tuple_element<1, _Pair>::type; mapped_type& operator[](const key_type& __k); mapped_type& operator[](key_type&& __k); // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 761. unordered_map needs an at() member function. mapped_type& at(const key_type& __k); const mapped_type& at(const key_type& __k) const; }; template<typename _Key, typename _Pair, typename _Alloc, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> typename _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true> ::mapped_type& _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>:: operator[](const key_type& __k) { __hashtable* __h = static_cast<__hashtable*>(this); __hash_code __code = __h->_M_hash_code(__k); std::size_t __n = __h->_M_bucket_index(__k, __code); __node_type* __p = __h->_M_find_node(__n, __k, __code); if (!__p) { __p = __h->_M_allocate_node(std::piecewise_construct, std::tuple<const key_type&>(__k), std::tuple<>()); return __h->_M_insert_unique_node(__n, __code, __p)->second; } return (__p->_M_v).second; } template<typename _Key, typename _Pair, typename _Alloc, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> typename _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true> ::mapped_type& _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>:: operator[](key_type&& __k) { __hashtable* __h = static_cast<__hashtable*>(this); __hash_code __code = __h->_M_hash_code(__k); std::size_t __n = __h->_M_bucket_index(__k, __code); __node_type* __p = __h->_M_find_node(__n, __k, __code); if (!__p) { __p = __h->_M_allocate_node(std::piecewise_construct, std::forward_as_tuple(std::move(__k)), std::tuple<>()); return __h->_M_insert_unique_node(__n, __code, __p)->second; } return (__p->_M_v).second; } template<typename _Key, typename _Pair, typename _Alloc, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> typename _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true> ::mapped_type& _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>:: at(const key_type& __k) { __hashtable* __h = static_cast<__hashtable*>(this); __hash_code __code = __h->_M_hash_code(__k); std::size_t __n = __h->_M_bucket_index(__k, __code); __node_type* __p = __h->_M_find_node(__n, __k, __code); if (!__p) __throw_out_of_range(__N("_Map_base::at")); return (__p->_M_v).second; } template<typename _Key, typename _Pair, typename _Alloc, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> const typename _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::mapped_type& _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>:: at(const key_type& __k) const { const __hashtable* __h = static_cast<const __hashtable*>(this); __hash_code __code = __h->_M_hash_code(__k); std::size_t __n = __h->_M_bucket_index(__k, __code); __node_type* __p = __h->_M_find_node(__n, __k, __code); if (!__p) __throw_out_of_range(__N("_Map_base::at")); return (__p->_M_v).second; } /** * Primary class template _Insert_base. * * insert member functions appropriate to all _Hashtables. */ template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> struct _Insert_base { using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>; using __hashtable_base = _Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, _Traits>; using value_type = typename __hashtable_base::value_type; using iterator = typename __hashtable_base::iterator; using const_iterator = typename __hashtable_base::const_iterator; using size_type = typename __hashtable_base::size_type; using __unique_keys = typename __hashtable_base::__unique_keys; using __ireturn_type = typename __hashtable_base::__ireturn_type; using __iconv_type = typename __hashtable_base::__iconv_type; __hashtable& _M_conjure_hashtable() { return *(static_cast<__hashtable*>(this)); } __ireturn_type insert(const value_type& __v) { __hashtable& __h = _M_conjure_hashtable(); return __h._M_insert(__v, __unique_keys()); } iterator insert(const_iterator, const value_type& __v) { return __iconv_type()(insert(__v)); } void insert(initializer_list<value_type> __l) { this->insert(__l.begin(), __l.end()); } template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last); }; template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> template<typename _InputIterator> void _Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: insert(_InputIterator __first, _InputIterator __last) { using __rehash_type = typename __hashtable::__rehash_type; using __rehash_state = typename __hashtable::__rehash_state; using pair_type = std::pair<bool, std::size_t>; size_type __n_elt = __detail::__distance_fw(__first, __last); __hashtable& __h = _M_conjure_hashtable(); __rehash_type& __rehash = __h._M_rehash_policy; const __rehash_state& __saved_state = __rehash._M_state(); pair_type __do_rehash = __rehash._M_need_rehash(__h._M_bucket_count, __h._M_element_count, __n_elt); if (__do_rehash.first) __h._M_rehash(__do_rehash.second, __saved_state); for (; __first != __last; ++__first) __h._M_insert(*__first, __unique_keys()); } /** * Primary class template _Insert. * * Select insert member functions appropriate to _Hashtable policy choices. */ template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits, bool _Constant_iterators = _Traits::__constant_iterators::value, bool _Unique_keys = _Traits::__unique_keys::value> struct _Insert; /// Specialization. template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> struct _Insert<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true, true> : public _Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits> { using __base_type = _Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>; using value_type = typename __base_type::value_type; using iterator = typename __base_type::iterator; using const_iterator = typename __base_type::const_iterator; using __unique_keys = typename __base_type::__unique_keys; using __hashtable = typename __base_type::__hashtable; using __base_type::insert; std::pair<iterator, bool> insert(value_type&& __v) { __hashtable& __h = this->_M_conjure_hashtable(); return __h._M_insert(std::move(__v), __unique_keys()); } iterator insert(const_iterator, value_type&& __v) { return insert(std::move(__v)).first; } }; /// Specialization. template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> struct _Insert<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true, false> : public _Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits> { using __base_type = _Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>; using value_type = typename __base_type::value_type; using iterator = typename __base_type::iterator; using const_iterator = typename __base_type::const_iterator; using __unique_keys = typename __base_type::__unique_keys; using __hashtable = typename __base_type::__hashtable; using __base_type::insert; iterator insert(value_type&& __v) { __hashtable& __h = this->_M_conjure_hashtable(); return __h._M_insert(std::move(__v), __unique_keys()); } iterator insert(const_iterator, value_type&& __v) { return insert(std::move(__v)); } }; /// Specialization. template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits, bool _Unique_keys> struct _Insert<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, false, _Unique_keys> : public _Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits> { using __base_type = _Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>; using value_type = typename __base_type::value_type; using iterator = typename __base_type::iterator; using const_iterator = typename __base_type::const_iterator; using __unique_keys = typename __base_type::__unique_keys; using __hashtable = typename __base_type::__hashtable; using __ireturn_type = typename __base_type::__ireturn_type; using __iconv_type = typename __base_type::__iconv_type; using __base_type::insert; template<typename _Pair> using __is_cons = std::is_constructible<value_type, _Pair&&>; template<typename _Pair> using _IFcons = std::enable_if<__is_cons<_Pair>::value>; template<typename _Pair> using _IFconsp = typename _IFcons<_Pair>::type; template<typename _Pair, typename = _IFconsp<_Pair>> __ireturn_type insert(_Pair&& __v) { __hashtable& __h = this->_M_conjure_hashtable(); return __h._M_emplace(__unique_keys(), std::forward<_Pair>(__v)); } template<typename _Pair, typename = _IFconsp<_Pair>> iterator insert(const_iterator, _Pair&& __v) { return __iconv_type()(insert(std::forward<_Pair>(__v))); } }; /** * Primary class template _Rehash_base. * * Give hashtable the max_load_factor functions and reserve iff the * rehash policy is _Prime_rehash_policy. */ template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> struct _Rehash_base; /// Specialization. template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _Traits> struct _Rehash_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _Prime_rehash_policy, _Traits> { using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _Prime_rehash_policy, _Traits>; float max_load_factor() const noexcept { const __hashtable* __this = static_cast<const __hashtable*>(this); return __this->__rehash_policy().max_load_factor(); } void max_load_factor(float __z) { __hashtable* __this = static_cast<__hashtable*>(this); __this->__rehash_policy(_Prime_rehash_policy(__z)); } void reserve(std::size_t __n) { __hashtable* __this = static_cast<__hashtable*>(this); __this->rehash(__builtin_ceil(__n / max_load_factor())); } }; /** * Primary class template _Hashtable_ebo_helper. * * Helper class using EBO when it is not forbidden, type is not * final, and when it worth it, type is empty. */ template<int _Nm, typename _Tp, bool __use_ebo = !__is_final(_Tp) && __is_empty(_Tp)> struct _Hashtable_ebo_helper; /// Specialization using EBO. template<int _Nm, typename _Tp> struct _Hashtable_ebo_helper<_Nm, _Tp, true> : private _Tp { _Hashtable_ebo_helper() = default; _Hashtable_ebo_helper(const _Tp& __tp) : _Tp(__tp) { } static const _Tp& _S_cget(const _Hashtable_ebo_helper& __eboh) { return static_cast<const _Tp&>(__eboh); } static _Tp& _S_get(_Hashtable_ebo_helper& __eboh) { return static_cast<_Tp&>(__eboh); } }; /// Specialization not using EBO. template<int _Nm, typename _Tp> struct _Hashtable_ebo_helper<_Nm, _Tp, false> { _Hashtable_ebo_helper() = default; _Hashtable_ebo_helper(const _Tp& __tp) : _M_tp(__tp) { } static const _Tp& _S_cget(const _Hashtable_ebo_helper& __eboh) { return __eboh._M_tp; } static _Tp& _S_get(_Hashtable_ebo_helper& __eboh) { return __eboh._M_tp; } private: _Tp _M_tp; }; /** * Primary class template _Local_iterator_base. * * Base class for local iterators, used to iterate within a bucket * but not between buckets. */ template<typename _Key, typename _Value, typename _ExtractKey, typename _H1, typename _H2, typename _Hash, bool __cache_hash_code> struct _Local_iterator_base; /** * Primary class template _Hash_code_base. * * Encapsulates two policy issues that aren't quite orthogonal. * (1) the difference between using a ranged hash function and using * the combination of a hash function and a range-hashing function. * In the former case we don't have such things as hash codes, so * we have a dummy type as placeholder. * (2) Whether or not we cache hash codes. Caching hash codes is * meaningless if we have a ranged hash function. * * We also put the key extraction objects here, for convenience. * Each specialization derives from one or more of the template * parameters to benefit from Ebo. This is important as this type * is inherited in some cases by the _Local_iterator_base type used * to implement local_iterator and const_local_iterator. As with * any iterator type we prefer to make it as small as possible. * * Primary template is unused except as a hook for specializations. */ template<typename _Key, typename _Value, typename _ExtractKey, typename _H1, typename _H2, typename _Hash, bool __cache_hash_code> struct _Hash_code_base; /// Specialization: ranged hash function, no caching hash codes. H1 /// and H2 are provided but ignored. We define a dummy hash code type. template<typename _Key, typename _Value, typename _ExtractKey, typename _H1, typename _H2, typename _Hash> struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false> : private _Hashtable_ebo_helper<0, _ExtractKey>, private _Hashtable_ebo_helper<1, _Hash> { private: using __ebo_extract_key = _Hashtable_ebo_helper<0, _ExtractKey>; using __ebo_hash = _Hashtable_ebo_helper<1, _Hash>; protected: typedef void* __hash_code; typedef _Hash_node<_Value, false> __node_type; // We need the default constructor for the local iterators. _Hash_code_base() = default; _Hash_code_base(const _ExtractKey& __ex, const _H1&, const _H2&, const _Hash& __h) : __ebo_extract_key(__ex), __ebo_hash(__h) { } __hash_code _M_hash_code(const _Key& __key) const { return 0; } std::size_t _M_bucket_index(const _Key& __k, __hash_code, std::size_t __n) const { return _M_ranged_hash()(__k, __n); } std::size_t _M_bucket_index(const __node_type* __p, std::size_t __n) const { return _M_ranged_hash()(_M_extract()(__p->_M_v), __n); } void _M_store_code(__node_type*, __hash_code) const { } void _M_copy_code(__node_type*, const __node_type*) const { } void _M_swap(_Hash_code_base& __x) { std::swap(_M_extract(), __x._M_extract()); std::swap(_M_ranged_hash(), __x._M_ranged_hash()); } const _ExtractKey& _M_extract() const { return __ebo_extract_key::_S_cget(*this); } _ExtractKey& _M_extract() { return __ebo_extract_key::_S_get(*this); } const _Hash& _M_ranged_hash() const { return __ebo_hash::_S_cget(*this); } _Hash& _M_ranged_hash() { return __ebo_hash::_S_get(*this); } }; // No specialization for ranged hash function while caching hash codes. // That combination is meaningless, and trying to do it is an error. /// Specialization: ranged hash function, cache hash codes. This /// combination is meaningless, so we provide only a declaration /// and no definition. template<typename _Key, typename _Value, typename _ExtractKey, typename _H1, typename _H2, typename _Hash> struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>; /// Specialization: hash function and range-hashing function, no /// caching of hash codes. /// Provides typedef and accessor required by C++ 11. template<typename _Key, typename _Value, typename _ExtractKey, typename _H1, typename _H2> struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Default_ranged_hash, false> : private _Hashtable_ebo_helper<0, _ExtractKey>, private _Hashtable_ebo_helper<1, _H1>, private _Hashtable_ebo_helper<2, _H2> { private: using __ebo_extract_key = _Hashtable_ebo_helper<0, _ExtractKey>; using __ebo_h1 = _Hashtable_ebo_helper<1, _H1>; using __ebo_h2 = _Hashtable_ebo_helper<2, _H2>; public: typedef _H1 hasher; hasher hash_function() const { return _M_h1(); } protected: typedef std::size_t __hash_code; typedef _Hash_node<_Value, false> __node_type; // We need the default constructor for the local iterators. _Hash_code_base() = default; _Hash_code_base(const _ExtractKey& __ex, const _H1& __h1, const _H2& __h2, const _Default_ranged_hash&) : __ebo_extract_key(__ex), __ebo_h1(__h1), __ebo_h2(__h2) { } __hash_code _M_hash_code(const _Key& __k) const { return _M_h1()(__k); } std::size_t _M_bucket_index(const _Key&, __hash_code __c, std::size_t __n) const { return _M_h2()(__c, __n); } std::size_t _M_bucket_index(const __node_type* __p, std::size_t __n) const { return _M_h2()(_M_h1()(_M_extract()(__p->_M_v)), __n); } void _M_store_code(__node_type*, __hash_code) const { } void _M_copy_code(__node_type*, const __node_type*) const { } void _M_swap(_Hash_code_base& __x) { std::swap(_M_extract(), __x._M_extract()); std::swap(_M_h1(), __x._M_h1()); std::swap(_M_h2(), __x._M_h2()); } const _ExtractKey& _M_extract() const { return __ebo_extract_key::_S_cget(*this); } _ExtractKey& _M_extract() { return __ebo_extract_key::_S_get(*this); } const _H1& _M_h1() const { return __ebo_h1::_S_cget(*this); } _H1& _M_h1() { return __ebo_h1::_S_get(*this); } const _H2& _M_h2() const { return __ebo_h2::_S_cget(*this); } _H2& _M_h2() { return __ebo_h2::_S_get(*this); } }; /// Specialization: hash function and range-hashing function, /// caching hash codes. H is provided but ignored. Provides /// typedef and accessor required by C++ 11. template<typename _Key, typename _Value, typename _ExtractKey, typename _H1, typename _H2> struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Default_ranged_hash, true> : private _Hashtable_ebo_helper<0, _ExtractKey>, private _Hashtable_ebo_helper<1, _H1>, private _Hashtable_ebo_helper<2, _H2> { private: // Gives access to _M_h2() to the local iterator implementation. friend struct _Local_iterator_base<_Key, _Value, _ExtractKey, _H1, _H2, _Default_ranged_hash, true>; using __ebo_extract_key = _Hashtable_ebo_helper<0, _ExtractKey>; using __ebo_h1 = _Hashtable_ebo_helper<1, _H1>; using __ebo_h2 = _Hashtable_ebo_helper<2, _H2>; public: typedef _H1 hasher; hasher hash_function() const { return _M_h1(); } protected: typedef std::size_t __hash_code; typedef _Hash_node<_Value, true> __node_type; _Hash_code_base(const _ExtractKey& __ex, const _H1& __h1, const _H2& __h2, const _Default_ranged_hash&) : __ebo_extract_key(__ex), __ebo_h1(__h1), __ebo_h2(__h2) { } __hash_code _M_hash_code(const _Key& __k) const { return _M_h1()(__k); } std::size_t _M_bucket_index(const _Key&, __hash_code __c, std::size_t __n) const { return _M_h2()(__c, __n); } std::size_t _M_bucket_index(const __node_type* __p, std::size_t __n) const { return _M_h2()(__p->_M_hash_code, __n); } void _M_store_code(__node_type* __n, __hash_code __c) const { __n->_M_hash_code = __c; } void _M_copy_code(__node_type* __to, const __node_type* __from) const { __to->_M_hash_code = __from->_M_hash_code; } void _M_swap(_Hash_code_base& __x) { std::swap(_M_extract(), __x._M_extract()); std::swap(_M_h1(), __x._M_h1()); std::swap(_M_h2(), __x._M_h2()); } const _ExtractKey& _M_extract() const { return __ebo_extract_key::_S_cget(*this); } _ExtractKey& _M_extract() { return __ebo_extract_key::_S_get(*this); } const _H1& _M_h1() const { return __ebo_h1::_S_cget(*this); } _H1& _M_h1() { return __ebo_h1::_S_get(*this); } const _H2& _M_h2() const { return __ebo_h2::_S_cget(*this); } _H2& _M_h2() { return __ebo_h2::_S_get(*this); } }; /** * Primary class template _Equal_helper. * */ template <typename _Key, typename _Value, typename _ExtractKey, typename _Equal, typename _HashCodeType, bool __cache_hash_code> struct _Equal_helper; /// Specialization. template<typename _Key, typename _Value, typename _ExtractKey, typename _Equal, typename _HashCodeType> struct _Equal_helper<_Key, _Value, _ExtractKey, _Equal, _HashCodeType, true> { static bool _S_equals(const _Equal& __eq, const _ExtractKey& __extract, const _Key& __k, _HashCodeType __c, _Hash_node<_Value, true>* __n) { return __c == __n->_M_hash_code && __eq(__k, __extract(__n->_M_v)); } }; /// Specialization. template<typename _Key, typename _Value, typename _ExtractKey, typename _Equal, typename _HashCodeType> struct _Equal_helper<_Key, _Value, _ExtractKey, _Equal, _HashCodeType, false> { static bool _S_equals(const _Equal& __eq, const _ExtractKey& __extract, const _Key& __k, _HashCodeType, _Hash_node<_Value, false>* __n) { return __eq(__k, __extract(__n->_M_v)); } }; /// Specialization. template<typename _Key, typename _Value, typename _ExtractKey, typename _H1, typename _H2, typename _Hash> struct _Local_iterator_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true> : private _Hashtable_ebo_helper<0, _H2> { protected: using __base_type = _Hashtable_ebo_helper<0, _H2>; using __hash_code_base = _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>; public: _Local_iterator_base() = default; _Local_iterator_base(const __hash_code_base& __base, _Hash_node<_Value, true>* __p, std::size_t __bkt, std::size_t __bkt_count) : __base_type(__base._M_h2()), _M_cur(__p), _M_bucket(__bkt), _M_bucket_count(__bkt_count) { } void _M_incr() { _M_cur = _M_cur->_M_next(); if (_M_cur) { std::size_t __bkt = __base_type::_S_get(*this)(_M_cur->_M_hash_code, _M_bucket_count); if (__bkt != _M_bucket) _M_cur = nullptr; } } _Hash_node<_Value, true>* _M_cur; std::size_t _M_bucket; std::size_t _M_bucket_count; }; /// Specialization. template<typename _Key, typename _Value, typename _ExtractKey, typename _H1, typename _H2, typename _Hash> struct _Local_iterator_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false> : private _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false> { protected: using __hash_code_base = _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>; public: _Local_iterator_base() = default; _Local_iterator_base(const __hash_code_base& __base, _Hash_node<_Value, false>* __p, std::size_t __bkt, std::size_t __bkt_count) : __hash_code_base(__base), _M_cur(__p), _M_bucket(__bkt), _M_bucket_count(__bkt_count) { } void _M_incr() { _M_cur = _M_cur->_M_next(); if (_M_cur) { std::size_t __bkt = this->_M_bucket_index(_M_cur, _M_bucket_count); if (__bkt != _M_bucket) _M_cur = nullptr; } } _Hash_node<_Value, false>* _M_cur; std::size_t _M_bucket; std::size_t _M_bucket_count; }; template<typename _Key, typename _Value, typename _ExtractKey, typename _H1, typename _H2, typename _Hash, bool __cache> inline bool operator==(const _Local_iterator_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, __cache>& __x, const _Local_iterator_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, __cache>& __y) { return __x._M_cur == __y._M_cur; } template<typename _Key, typename _Value, typename _ExtractKey, typename _H1, typename _H2, typename _Hash, bool __cache> inline bool operator!=(const _Local_iterator_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, __cache>& __x, const _Local_iterator_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, __cache>& __y) { return __x._M_cur != __y._M_cur; } /// local iterators template<typename _Key, typename _Value, typename _ExtractKey, typename _H1, typename _H2, typename _Hash, bool __constant_iterators, bool __cache> struct _Local_iterator : public _Local_iterator_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, __cache> { private: using __base_type = _Local_iterator_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, __cache>; using __hash_code_base = typename __base_type::__hash_code_base; public: typedef _Value value_type; typedef typename std::conditional<__constant_iterators, const _Value*, _Value*>::type pointer; typedef typename std::conditional<__constant_iterators, const _Value&, _Value&>::type reference; typedef std::ptrdiff_t difference_type; typedef std::forward_iterator_tag iterator_category; _Local_iterator() = default; _Local_iterator(const __hash_code_base& __base, _Hash_node<_Value, __cache>* __p, std::size_t __bkt, std::size_t __bkt_count) : __base_type(__base, __p, __bkt, __bkt_count) { } reference operator*() const { return this->_M_cur->_M_v; } pointer operator->() const { return std::__addressof(this->_M_cur->_M_v); } _Local_iterator& operator++() { this->_M_incr(); return *this; } _Local_iterator operator++(int) { _Local_iterator __tmp(*this); this->_M_incr(); return __tmp; } }; /// local const_iterators template<typename _Key, typename _Value, typename _ExtractKey, typename _H1, typename _H2, typename _Hash, bool __constant_iterators, bool __cache> struct _Local_const_iterator : public _Local_iterator_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, __cache> { private: using __base_type = _Local_iterator_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, __cache>; using __hash_code_base = typename __base_type::__hash_code_base; public: typedef _Value value_type; typedef const _Value* pointer; typedef const _Value& reference; typedef std::ptrdiff_t difference_type; typedef std::forward_iterator_tag iterator_category; _Local_const_iterator() = default; _Local_const_iterator(const __hash_code_base& __base, _Hash_node<_Value, __cache>* __p, std::size_t __bkt, std::size_t __bkt_count) : __base_type(__base, __p, __bkt, __bkt_count) { } _Local_const_iterator(const _Local_iterator<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, __constant_iterators, __cache>& __x) : __base_type(__x) { } reference operator*() const { return this->_M_cur->_M_v; } pointer operator->() const { return std::__addressof(this->_M_cur->_M_v); } _Local_const_iterator& operator++() { this->_M_incr(); return *this; } _Local_const_iterator operator++(int) { _Local_const_iterator __tmp(*this); this->_M_incr(); return __tmp; } }; /** * Primary class template _Hashtable_base. * * Helper class adding management of _Equal functor to * _Hash_code_base type. * * Base class templates are: * - __detail::_Hash_code_base * - __detail::_Hashtable_ebo_helper */ template<typename _Key, typename _Value, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _Traits> struct _Hashtable_base : public _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, _Traits::__hash_cached::value>, private _Hashtable_ebo_helper<0, _Equal> { public: typedef _Key key_type; typedef _Value value_type; typedef _Equal key_equal; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; using __traits_type = _Traits; using __hash_cached = typename __traits_type::__hash_cached; using __constant_iterators = typename __traits_type::__constant_iterators; using __unique_keys = typename __traits_type::__unique_keys; using __hash_code_base = _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, __hash_cached::value>; using __hash_code = typename __hash_code_base::__hash_code; using __node_type = typename __hash_code_base::__node_type; using iterator = __detail::_Node_iterator<value_type, __constant_iterators::value, __hash_cached::value>; using const_iterator = __detail::_Node_const_iterator<value_type, __constant_iterators::value, __hash_cached::value>; using local_iterator = __detail::_Local_iterator<key_type, value_type, _ExtractKey, _H1, _H2, _Hash, __constant_iterators::value, __hash_cached::value>; using const_local_iterator = __detail::_Local_const_iterator<key_type, value_type, _ExtractKey, _H1, _H2, _Hash, __constant_iterators::value, __hash_cached::value>; using __ireturn_type = typename std::conditional<__unique_keys::value, std::pair<iterator, bool>, iterator>::type; using __iconv_type = typename std::conditional<__unique_keys::value, _Select1st, _Identity >::type; private: using _EqualEBO = _Hashtable_ebo_helper<0, _Equal>; using _EqualHelper = _Equal_helper<_Key, _Value, _ExtractKey, _Equal, __hash_code, __hash_cached::value>; protected: using __node_base = __detail::_Hash_node_base; using __bucket_type = __node_base*; _Hashtable_base(const _ExtractKey& __ex, const _H1& __h1, const _H2& __h2, const _Hash& __hash, const _Equal& __eq) : __hash_code_base(__ex, __h1, __h2, __hash), _EqualEBO(__eq) { } bool _M_equals(const _Key& __k, __hash_code __c, __node_type* __n) const { return _EqualHelper::_S_equals(_M_eq(), this->_M_extract(), __k, __c, __n); } void _M_swap(_Hashtable_base& __x) { __hash_code_base::_M_swap(__x); std::swap(_M_eq(), __x._M_eq()); } const _Equal& _M_eq() const { return _EqualEBO::_S_cget(*this); } _Equal& _M_eq() { return _EqualEBO::_S_get(*this); } }; /** * struct _Equality_base. * * Common types and functions for class _Equality. */ struct _Equality_base { protected: template<typename _Uiterator> static bool _S_is_permutation(_Uiterator, _Uiterator, _Uiterator); }; // See std::is_permutation in N3068. template<typename _Uiterator> bool _Equality_base:: _S_is_permutation(_Uiterator __first1, _Uiterator __last1, _Uiterator __first2) { for (; __first1 != __last1; ++__first1, ++__first2) if (!(*__first1 == *__first2)) break; if (__first1 == __last1) return true; _Uiterator __last2 = __first2; std::advance(__last2, std::distance(__first1, __last1)); for (_Uiterator __it1 = __first1; __it1 != __last1; ++__it1) { _Uiterator __tmp = __first1; while (__tmp != __it1 && !bool(*__tmp == *__it1)) ++__tmp; // We've seen this one before. if (__tmp != __it1) continue; std::ptrdiff_t __n2 = 0; for (__tmp = __first2; __tmp != __last2; ++__tmp) if (*__tmp == *__it1) ++__n2; if (!__n2) return false; std::ptrdiff_t __n1 = 0; for (__tmp = __it1; __tmp != __last1; ++__tmp) if (*__tmp == *__it1) ++__n1; if (__n1 != __n2) return false; } return true; } /** * Primary class template _Equality. * * This is for implementing equality comparison for unordered * containers, per N3068, by John Lakos and Pablo Halpern. * Algorithmically, we follow closely the reference implementations * therein. */ template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits, bool _Unique_keys = _Traits::__unique_keys::value> struct _Equality; /// Specialization. template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> struct _Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true> { using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>; bool _M_equal(const __hashtable&) const; }; template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> bool _Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>:: _M_equal(const __hashtable& __other) const { const __hashtable* __this = static_cast<const __hashtable*>(this); if (__this->size() != __other.size()) return false; for (auto __itx = __this->begin(); __itx != __this->end(); ++__itx) { const auto __ity = __other.find(_ExtractKey()(*__itx)); if (__ity == __other.end() || !bool(*__ity == *__itx)) return false; } return true; } /// Specialization. template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> struct _Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, false> : public _Equality_base { using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>; bool _M_equal(const __hashtable&) const; }; template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> bool _Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, false>:: _M_equal(const __hashtable& __other) const { const __hashtable* __this = static_cast<const __hashtable*>(this); if (__this->size() != __other.size()) return false; for (auto __itx = __this->begin(); __itx != __this->end();) { const auto __xrange = __this->equal_range(_ExtractKey()(*__itx)); const auto __yrange = __other.equal_range(_ExtractKey()(*__itx)); if (std::distance(__xrange.first, __xrange.second) != std::distance(__yrange.first, __yrange.second)) return false; if (!_S_is_permutation(__xrange.first, __xrange.second, __yrange.first)) return false; __itx = __xrange.second; } return true; } /** * This type is to combine a _Hash_node_base instance with an allocator * instance through inheritance to benefit from EBO when possible. */ template<typename _NodeAlloc> struct _Before_begin : public _NodeAlloc { _Hash_node_base _M_node; _Before_begin(const _Before_begin&) = default; _Before_begin(_Before_begin&&) = default; template<typename _Alloc> _Before_begin(_Alloc&& __a) : _NodeAlloc(std::forward<_Alloc>(__a)) { } }; //@} hashtable-detail _GLIBCXX_END_NAMESPACE_VERSION } // namespace __detail } // namespace std #endif // _HASHTABLE_POLICY_H ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_raw_storage_iter.h���������������������������������������������������������������0000644�����������������00000006577�14763166030�0013146 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_raw_storage_iter.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{memory} */ #ifndef _STL_RAW_STORAGE_ITERATOR_H #define _STL_RAW_STORAGE_ITERATOR_H 1 namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * This iterator class lets algorithms store their results into * uninitialized memory. */ template <class _OutputIterator, class _Tp> class raw_storage_iterator : public iterator<output_iterator_tag, void, void, void, void> { protected: _OutputIterator _M_iter; public: explicit raw_storage_iterator(_OutputIterator __x) : _M_iter(__x) {} raw_storage_iterator& operator*() { return *this; } raw_storage_iterator& operator=(const _Tp& __element) { std::_Construct(std::__addressof(*_M_iter), __element); return *this; } raw_storage_iterator<_OutputIterator, _Tp>& operator++() { ++_M_iter; return *this; } raw_storage_iterator<_OutputIterator, _Tp> operator++(int) { raw_storage_iterator<_OutputIterator, _Tp> __tmp = *this; ++_M_iter; return __tmp; } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ���������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/regex_grep_matcher.h�����������������������������������������������������������������0000644�����������������00000010354�14763166030�0012542 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// class template regex -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** * @file bits/regex_grep_matcher.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{regex} */ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _BiIter> class sub_match; template<typename _Bi_iter, typename _Allocator> class match_results; _GLIBCXX_END_NAMESPACE_VERSION namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup regex-detail Base and Implementation Classes * @ingroup regex * @{ */ /// A _Results facade specialized for wrapping a templated match_results. template<typename _FwdIterT, typename _Alloc> class _SpecializedResults : public _Results { public: _SpecializedResults(const _Automaton::_SizeT __size, const _SpecializedCursor<_FwdIterT>& __cursor, match_results<_FwdIterT, _Alloc>& __m); void _M_set_pos(int __i, int __j, const _PatternCursor& __pc); void _M_set_matched(int __i, bool __is_matched) { _M_results.at(__i).matched = __is_matched; } private: match_results<_FwdIterT, _Alloc>& _M_results; }; template<typename _FwdIterT, typename _Alloc> _SpecializedResults<_FwdIterT, _Alloc>:: _SpecializedResults(const _Automaton::_SizeT __size, const _SpecializedCursor<_FwdIterT>& __cursor, match_results<_FwdIterT, _Alloc>& __m) : _M_results(__m) { _M_results.clear(); _M_results.reserve(__size + 2); _M_results.resize(__size); typename match_results<_FwdIterT, _Alloc>::value_type __sm; __sm.first = __sm.second = __cursor._M_begin(); _M_results.push_back(__sm); __sm.first = __sm.second = __cursor._M_end(); _M_results.push_back(__sm); } template<typename _FwdIterT, typename _Alloc> void _SpecializedResults<_FwdIterT, _Alloc>:: _M_set_pos(int __i, int __j, const _PatternCursor& __pc) { typedef const _SpecializedCursor<_FwdIterT>& _CursorT; _CursorT __c = static_cast<_CursorT>(__pc); if (__j == 0) _M_results.at(__i).first = __c._M_pos(); else _M_results.at(__i).second = __c._M_pos()+1; } /// A stack of states used in evaluating the NFA. typedef std::stack<_StateIdT, std::vector<_StateIdT> > _StateStack; /// Executes a regular expression NFA/DFA over a range using a /// variant of the parallel execution algorithm featured in the grep /// utility, modified to use Laurikari tags. class _Grep_matcher { public: _Grep_matcher(_PatternCursor& __p, _Results& __r, const _AutomatonPtr& __automaton, regex_constants::match_flag_type __flags); private: _StateSet _M_e_closure(_StateIdT __i); _StateSet _M_e_closure(const _StateSet& __s); _StateSet _M_e_closure(_StateStack& __stack, const _StateSet& __s); const std::shared_ptr<_Nfa> _M_nfa; _PatternCursor& _M_pattern; _Results& _M_results; }; //@} regex-detail _GLIBCXX_END_NAMESPACE_VERSION } // namespace __detail } // namespace std #include <bits/regex_grep_matcher.tcc> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/basic_ios.tcc������������������������������������������������������������������������0000644�����������������00000013620�14763166030�0011164 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// basic_ios member functions -*- C++ -*- // Copyright (C) 1999-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/basic_ios.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ios} */ #ifndef _BASIC_IOS_TCC #define _BASIC_IOS_TCC 1 #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _CharT, typename _Traits> void basic_ios<_CharT, _Traits>::clear(iostate __state) { if (this->rdbuf()) _M_streambuf_state = __state; else _M_streambuf_state = __state | badbit; if (this->exceptions() & this->rdstate()) __throw_ios_failure(__N("basic_ios::clear")); } template<typename _CharT, typename _Traits> basic_streambuf<_CharT, _Traits>* basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __sb) { basic_streambuf<_CharT, _Traits>* __old = _M_streambuf; _M_streambuf = __sb; this->clear(); return __old; } template<typename _CharT, typename _Traits> basic_ios<_CharT, _Traits>& basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 292. effects of a.copyfmt (a) if (this != &__rhs) { // Per 27.1.1, do not call imbue, yet must trash all caches // associated with imbue() // Alloc any new word array first, so if it fails we have "rollback". _Words* __words = (__rhs._M_word_size <= _S_local_word_size) ? _M_local_word : new _Words[__rhs._M_word_size]; // Bump refs before doing callbacks, for safety. _Callback_list* __cb = __rhs._M_callbacks; if (__cb) __cb->_M_add_reference(); _M_call_callbacks(erase_event); if (_M_word != _M_local_word) { delete [] _M_word; _M_word = 0; } _M_dispose_callbacks(); // NB: Don't want any added during above. _M_callbacks = __cb; for (int __i = 0; __i < __rhs._M_word_size; ++__i) __words[__i] = __rhs._M_word[__i]; _M_word = __words; _M_word_size = __rhs._M_word_size; this->flags(__rhs.flags()); this->width(__rhs.width()); this->precision(__rhs.precision()); this->tie(__rhs.tie()); this->fill(__rhs.fill()); _M_ios_locale = __rhs.getloc(); _M_cache_locale(_M_ios_locale); _M_call_callbacks(copyfmt_event); // The next is required to be the last assignment. this->exceptions(__rhs.exceptions()); } return *this; } // Locales: template<typename _CharT, typename _Traits> locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc) { locale __old(this->getloc()); ios_base::imbue(__loc); _M_cache_locale(__loc); if (this->rdbuf() != 0) this->rdbuf()->pubimbue(__loc); return __old; } template<typename _CharT, typename _Traits> void basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb) { // NB: This may be called more than once on the same object. ios_base::_M_init(); // Cache locale data and specific facets used by iostreams. _M_cache_locale(_M_ios_locale); // NB: The 27.4.4.1 Postconditions Table specifies requirements // after basic_ios::init() has been called. As part of this, // fill() must return widen(' ') any time after init() has been // called, which needs an imbued ctype facet of char_type to // return without throwing an exception. Unfortunately, // ctype<char_type> is not necessarily a required facet, so // streams with char_type != [char, wchar_t] will not have it by // default. Because of this, the correct value for _M_fill is // constructed on the first call of fill(). That way, // unformatted input and output with non-required basic_ios // instantiations is possible even without imbuing the expected // ctype<char_type> facet. _M_fill = _CharT(); _M_fill_init = false; _M_tie = 0; _M_exception = goodbit; _M_streambuf = __sb; _M_streambuf_state = __sb ? goodbit : badbit; } template<typename _CharT, typename _Traits> void basic_ios<_CharT, _Traits>::_M_cache_locale(const locale& __loc) { if (__builtin_expect(has_facet<__ctype_type>(__loc), true)) _M_ctype = &use_facet<__ctype_type>(__loc); else _M_ctype = 0; if (__builtin_expect(has_facet<__num_put_type>(__loc), true)) _M_num_put = &use_facet<__num_put_type>(__loc); else _M_num_put = 0; if (__builtin_expect(has_facet<__num_get_type>(__loc), true)) _M_num_get = &use_facet<__num_get_type>(__loc); else _M_num_get = 0; } // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. #if _GLIBCXX_EXTERN_TEMPLATE extern template class basic_ios<char>; #ifdef _GLIBCXX_USE_WCHAR_T extern template class basic_ios<wchar_t>; #endif #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif ����������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/exception_defines.h������������������������������������������������������������������0000644�����������������00000003153�14763166030�0012402 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -fno-exceptions Support -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/exception_defines.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{exception} */ #ifndef _EXCEPTION_DEFINES_H #define _EXCEPTION_DEFINES_H 1 #ifndef __EXCEPTIONS // Iff -fno-exceptions, transform error handling code to work without it. # define __try if (true) # define __catch(X) if (false) # define __throw_exception_again #else // Else proceed normally. # define __try try # define __catch(X) catch(X) # define __throw_exception_again throw #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_iterator_base_funcs.h������������������������������������������������������������0000644�����������������00000015461�14763166030�0013617 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Functions used by iterators -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996-1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_iterator_base_funcs.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{iterator} * * This file contains all of the general iterator-related utility * functions, such as distance() and advance(). */ #ifndef _STL_ITERATOR_BASE_FUNCS_H #define _STL_ITERATOR_BASE_FUNCS_H 1 #pragma GCC system_header #include <bits/concept_check.h> #include <debug/debug.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _InputIterator> inline typename iterator_traits<_InputIterator>::difference_type __distance(_InputIterator __first, _InputIterator __last, input_iterator_tag) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) typename iterator_traits<_InputIterator>::difference_type __n = 0; while (__first != __last) { ++__first; ++__n; } return __n; } template<typename _RandomAccessIterator> inline typename iterator_traits<_RandomAccessIterator>::difference_type __distance(_RandomAccessIterator __first, _RandomAccessIterator __last, random_access_iterator_tag) { // concept requirements __glibcxx_function_requires(_RandomAccessIteratorConcept< _RandomAccessIterator>) return __last - __first; } /** * @brief A generalization of pointer arithmetic. * @param __first An input iterator. * @param __last An input iterator. * @return The distance between them. * * Returns @c n such that __first + n == __last. This requires * that @p __last must be reachable from @p __first. Note that @c * n may be negative. * * For random access iterators, this uses their @c + and @c - operations * and are constant time. For other %iterator classes they are linear time. */ template<typename _InputIterator> inline typename iterator_traits<_InputIterator>::difference_type distance(_InputIterator __first, _InputIterator __last) { // concept requirements -- taken care of in __distance return std::__distance(__first, __last, std::__iterator_category(__first)); } template<typename _InputIterator, typename _Distance> inline void __advance(_InputIterator& __i, _Distance __n, input_iterator_tag) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) _GLIBCXX_DEBUG_ASSERT(__n >= 0); while (__n--) ++__i; } template<typename _BidirectionalIterator, typename _Distance> inline void __advance(_BidirectionalIterator& __i, _Distance __n, bidirectional_iterator_tag) { // concept requirements __glibcxx_function_requires(_BidirectionalIteratorConcept< _BidirectionalIterator>) if (__n > 0) while (__n--) ++__i; else while (__n++) --__i; } template<typename _RandomAccessIterator, typename _Distance> inline void __advance(_RandomAccessIterator& __i, _Distance __n, random_access_iterator_tag) { // concept requirements __glibcxx_function_requires(_RandomAccessIteratorConcept< _RandomAccessIterator>) __i += __n; } /** * @brief A generalization of pointer arithmetic. * @param __i An input iterator. * @param __n The @a delta by which to change @p __i. * @return Nothing. * * This increments @p i by @p n. For bidirectional and random access * iterators, @p __n may be negative, in which case @p __i is decremented. * * For random access iterators, this uses their @c + and @c - operations * and are constant time. For other %iterator classes they are linear time. */ template<typename _InputIterator, typename _Distance> inline void advance(_InputIterator& __i, _Distance __n) { // concept requirements -- taken care of in __advance typename iterator_traits<_InputIterator>::difference_type __d = __n; std::__advance(__i, __d, std::__iterator_category(__i)); } #if __cplusplus >= 201103L template<typename _ForwardIterator> inline _ForwardIterator next(_ForwardIterator __x, typename iterator_traits<_ForwardIterator>::difference_type __n = 1) { std::advance(__x, __n); return __x; } template<typename _BidirectionalIterator> inline _BidirectionalIterator prev(_BidirectionalIterator __x, typename iterator_traits<_BidirectionalIterator>::difference_type __n = 1) { std::advance(__x, -__n); return __x; } #endif // C++11 _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _STL_ITERATOR_BASE_FUNCS_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/memoryfwd.h��������������������������������������������������������������������������0000644�����������������00000004563�14763166030�0010726 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <memory> Forward declarations -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * Copyright (c) 1996-1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/memoryfwd.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{memory} */ #ifndef _MEMORYFWD_H #define _MEMORYFWD_H 1 #pragma GCC system_header #include <bits/c++config.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup allocators Allocators * @ingroup memory * * Classes encapsulating memory operations. * * @{ */ template<typename> class allocator; template<> class allocator<void>; /// Declare uses_allocator so it can be specialized in \<queue\> etc. template<typename, typename> struct uses_allocator; /// @} group memory _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif ���������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/ios_base.h���������������������������������������������������������������������������0000644�����������������00000067543�14763166030�0010510 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Iostreams base classes -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/ios_base.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ios} */ // // ISO C++ 14882: 27.4 Iostreams base classes // #ifndef _IOS_BASE_H #define _IOS_BASE_H 1 #pragma GCC system_header #include <ext/atomicity.h> #include <bits/localefwd.h> #include <bits/locale_classes.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // The following definitions of bitmask types are enums, not ints, // as permitted (but not required) in the standard, in order to provide // better type safety in iostream calls. A side effect is that // expressions involving them are no longer compile-time constants. enum _Ios_Fmtflags { _S_boolalpha = 1L << 0, _S_dec = 1L << 1, _S_fixed = 1L << 2, _S_hex = 1L << 3, _S_internal = 1L << 4, _S_left = 1L << 5, _S_oct = 1L << 6, _S_right = 1L << 7, _S_scientific = 1L << 8, _S_showbase = 1L << 9, _S_showpoint = 1L << 10, _S_showpos = 1L << 11, _S_skipws = 1L << 12, _S_unitbuf = 1L << 13, _S_uppercase = 1L << 14, _S_adjustfield = _S_left | _S_right | _S_internal, _S_basefield = _S_dec | _S_oct | _S_hex, _S_floatfield = _S_scientific | _S_fixed, _S_ios_fmtflags_end = 1L << 16 }; inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) { return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); } inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b) { return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); } inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b) { return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); } inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags operator~(_Ios_Fmtflags __a) { return _Ios_Fmtflags(~static_cast<int>(__a)); } inline const _Ios_Fmtflags& operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) { return __a = __a | __b; } inline const _Ios_Fmtflags& operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) { return __a = __a & __b; } inline const _Ios_Fmtflags& operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) { return __a = __a ^ __b; } enum _Ios_Openmode { _S_app = 1L << 0, _S_ate = 1L << 1, _S_bin = 1L << 2, _S_in = 1L << 3, _S_out = 1L << 4, _S_trunc = 1L << 5, _S_ios_openmode_end = 1L << 16 }; inline _GLIBCXX_CONSTEXPR _Ios_Openmode operator&(_Ios_Openmode __a, _Ios_Openmode __b) { return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); } inline _GLIBCXX_CONSTEXPR _Ios_Openmode operator|(_Ios_Openmode __a, _Ios_Openmode __b) { return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); } inline _GLIBCXX_CONSTEXPR _Ios_Openmode operator^(_Ios_Openmode __a, _Ios_Openmode __b) { return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); } inline _GLIBCXX_CONSTEXPR _Ios_Openmode operator~(_Ios_Openmode __a) { return _Ios_Openmode(~static_cast<int>(__a)); } inline const _Ios_Openmode& operator|=(_Ios_Openmode& __a, _Ios_Openmode __b) { return __a = __a | __b; } inline const _Ios_Openmode& operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) { return __a = __a & __b; } inline const _Ios_Openmode& operator^=(_Ios_Openmode& __a, _Ios_Openmode __b) { return __a = __a ^ __b; } enum _Ios_Iostate { _S_goodbit = 0, _S_badbit = 1L << 0, _S_eofbit = 1L << 1, _S_failbit = 1L << 2, _S_ios_iostate_end = 1L << 16 }; inline _GLIBCXX_CONSTEXPR _Ios_Iostate operator&(_Ios_Iostate __a, _Ios_Iostate __b) { return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); } inline _GLIBCXX_CONSTEXPR _Ios_Iostate operator|(_Ios_Iostate __a, _Ios_Iostate __b) { return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); } inline _GLIBCXX_CONSTEXPR _Ios_Iostate operator^(_Ios_Iostate __a, _Ios_Iostate __b) { return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); } inline _GLIBCXX_CONSTEXPR _Ios_Iostate operator~(_Ios_Iostate __a) { return _Ios_Iostate(~static_cast<int>(__a)); } inline const _Ios_Iostate& operator|=(_Ios_Iostate& __a, _Ios_Iostate __b) { return __a = __a | __b; } inline const _Ios_Iostate& operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) { return __a = __a & __b; } inline const _Ios_Iostate& operator^=(_Ios_Iostate& __a, _Ios_Iostate __b) { return __a = __a ^ __b; } enum _Ios_Seekdir { _S_beg = 0, _S_cur = _GLIBCXX_STDIO_SEEK_CUR, _S_end = _GLIBCXX_STDIO_SEEK_END, _S_ios_seekdir_end = 1L << 16 }; // 27.4.2 Class ios_base /** * @brief The base of the I/O class hierarchy. * @ingroup io * * This class defines everything that can be defined about I/O that does * not depend on the type of characters being input or output. Most * people will only see @c ios_base when they need to specify the full * name of the various I/O flags (e.g., the openmodes). */ class ios_base { public: /** * @brief These are thrown to indicate problems with io. * @ingroup exceptions * * 27.4.2.1.1 Class ios_base::failure */ class failure : public exception { public: // _GLIBCXX_RESOLVE_LIB_DEFECTS // 48. Use of non-existent exception constructor explicit failure(const string& __str) throw(); // This declaration is not useless: // http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Vague-Linkage.html virtual ~failure() throw(); virtual const char* what() const throw(); private: string _M_msg; }; // 27.4.2.1.2 Type ios_base::fmtflags /** * @brief This is a bitmask type. * * @c @a _Ios_Fmtflags is implementation-defined, but it is valid to * perform bitwise operations on these values and expect the Right * Thing to happen. Defined objects of type fmtflags are: * - boolalpha * - dec * - fixed * - hex * - internal * - left * - oct * - right * - scientific * - showbase * - showpoint * - showpos * - skipws * - unitbuf * - uppercase * - adjustfield * - basefield * - floatfield */ typedef _Ios_Fmtflags fmtflags; /// Insert/extract @c bool in alphabetic rather than numeric format. static const fmtflags boolalpha = _S_boolalpha; /// Converts integer input or generates integer output in decimal base. static const fmtflags dec = _S_dec; /// Generate floating-point output in fixed-point notation. static const fmtflags fixed = _S_fixed; /// Converts integer input or generates integer output in hexadecimal base. static const fmtflags hex = _S_hex; /// Adds fill characters at a designated internal point in certain /// generated output, or identical to @c right if no such point is /// designated. static const fmtflags internal = _S_internal; /// Adds fill characters on the right (final positions) of certain /// generated output. (I.e., the thing you print is flush left.) static const fmtflags left = _S_left; /// Converts integer input or generates integer output in octal base. static const fmtflags oct = _S_oct; /// Adds fill characters on the left (initial positions) of certain /// generated output. (I.e., the thing you print is flush right.) static const fmtflags right = _S_right; /// Generates floating-point output in scientific notation. static const fmtflags scientific = _S_scientific; /// Generates a prefix indicating the numeric base of generated integer /// output. static const fmtflags showbase = _S_showbase; /// Generates a decimal-point character unconditionally in generated /// floating-point output. static const fmtflags showpoint = _S_showpoint; /// Generates a + sign in non-negative generated numeric output. static const fmtflags showpos = _S_showpos; /// Skips leading white space before certain input operations. static const fmtflags skipws = _S_skipws; /// Flushes output after each output operation. static const fmtflags unitbuf = _S_unitbuf; /// Replaces certain lowercase letters with their uppercase equivalents /// in generated output. static const fmtflags uppercase = _S_uppercase; /// A mask of left|right|internal. Useful for the 2-arg form of @c setf. static const fmtflags adjustfield = _S_adjustfield; /// A mask of dec|oct|hex. Useful for the 2-arg form of @c setf. static const fmtflags basefield = _S_basefield; /// A mask of scientific|fixed. Useful for the 2-arg form of @c setf. static const fmtflags floatfield = _S_floatfield; // 27.4.2.1.3 Type ios_base::iostate /** * @brief This is a bitmask type. * * @c @a _Ios_Iostate is implementation-defined, but it is valid to * perform bitwise operations on these values and expect the Right * Thing to happen. Defined objects of type iostate are: * - badbit * - eofbit * - failbit * - goodbit */ typedef _Ios_Iostate iostate; /// Indicates a loss of integrity in an input or output sequence (such /// as an irrecoverable read error from a file). static const iostate badbit = _S_badbit; /// Indicates that an input operation reached the end of an input sequence. static const iostate eofbit = _S_eofbit; /// Indicates that an input operation failed to read the expected /// characters, or that an output operation failed to generate the /// desired characters. static const iostate failbit = _S_failbit; /// Indicates all is well. static const iostate goodbit = _S_goodbit; // 27.4.2.1.4 Type ios_base::openmode /** * @brief This is a bitmask type. * * @c @a _Ios_Openmode is implementation-defined, but it is valid to * perform bitwise operations on these values and expect the Right * Thing to happen. Defined objects of type openmode are: * - app * - ate * - binary * - in * - out * - trunc */ typedef _Ios_Openmode openmode; /// Seek to end before each write. static const openmode app = _S_app; /// Open and seek to end immediately after opening. static const openmode ate = _S_ate; /// Perform input and output in binary mode (as opposed to text mode). /// This is probably not what you think it is; see /// http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch27s02.html static const openmode binary = _S_bin; /// Open for input. Default for @c ifstream and fstream. static const openmode in = _S_in; /// Open for output. Default for @c ofstream and fstream. static const openmode out = _S_out; /// Open for input. Default for @c ofstream. static const openmode trunc = _S_trunc; // 27.4.2.1.5 Type ios_base::seekdir /** * @brief This is an enumerated type. * * @c @a _Ios_Seekdir is implementation-defined. Defined values * of type seekdir are: * - beg * - cur, equivalent to @c SEEK_CUR in the C standard library. * - end, equivalent to @c SEEK_END in the C standard library. */ typedef _Ios_Seekdir seekdir; /// Request a seek relative to the beginning of the stream. static const seekdir beg = _S_beg; /// Request a seek relative to the current position within the sequence. static const seekdir cur = _S_cur; /// Request a seek relative to the current end of the sequence. static const seekdir end = _S_end; // Annex D.6 typedef int io_state; typedef int open_mode; typedef int seek_dir; typedef std::streampos streampos; typedef std::streamoff streamoff; // Callbacks; /** * @brief The set of events that may be passed to an event callback. * * erase_event is used during ~ios() and copyfmt(). imbue_event is used * during imbue(). copyfmt_event is used during copyfmt(). */ enum event { erase_event, imbue_event, copyfmt_event }; /** * @brief The type of an event callback function. * @param __e One of the members of the event enum. * @param __b Reference to the ios_base object. * @param __i The integer provided when the callback was registered. * * Event callbacks are user defined functions that get called during * several ios_base and basic_ios functions, specifically imbue(), * copyfmt(), and ~ios(). */ typedef void (*event_callback) (event __e, ios_base& __b, int __i); /** * @brief Add the callback __fn with parameter __index. * @param __fn The function to add. * @param __index The integer to pass to the function when invoked. * * Registers a function as an event callback with an integer parameter to * be passed to the function when invoked. Multiple copies of the * function are allowed. If there are multiple callbacks, they are * invoked in the order they were registered. */ void register_callback(event_callback __fn, int __index); protected: streamsize _M_precision; streamsize _M_width; fmtflags _M_flags; iostate _M_exception; iostate _M_streambuf_state; // 27.4.2.6 Members for callbacks // 27.4.2.6 ios_base callbacks struct _Callback_list { // Data Members _Callback_list* _M_next; ios_base::event_callback _M_fn; int _M_index; _Atomic_word _M_refcount; // 0 means one reference. _Callback_list(ios_base::event_callback __fn, int __index, _Callback_list* __cb) : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { } void _M_add_reference() { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); } // 0 => OK to delete. int _M_remove_reference() { // Be race-detector-friendly. For more info see bits/c++config. _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount); int __res = __gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1); if (__res == 0) { _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount); } return __res; } }; _Callback_list* _M_callbacks; void _M_call_callbacks(event __ev) throw(); void _M_dispose_callbacks(void) throw(); // 27.4.2.5 Members for iword/pword storage struct _Words { void* _M_pword; long _M_iword; _Words() : _M_pword(0), _M_iword(0) { } }; // Only for failed iword/pword calls. _Words _M_word_zero; // Guaranteed storage. // The first 5 iword and pword slots are reserved for internal use. enum { _S_local_word_size = 8 }; _Words _M_local_word[_S_local_word_size]; // Allocated storage. int _M_word_size; _Words* _M_word; _Words& _M_grow_words(int __index, bool __iword); // Members for locale and locale caching. locale _M_ios_locale; void _M_init() throw(); public: // 27.4.2.1.6 Class ios_base::Init // Used to initialize standard streams. In theory, g++ could use // -finit-priority to order this stuff correctly without going // through these machinations. class Init { friend class ios_base; public: Init(); ~Init(); private: static _Atomic_word _S_refcount; static bool _S_synced_with_stdio; }; // [27.4.2.2] fmtflags state functions /** * @brief Access to format flags. * @return The format control flags for both input and output. */ fmtflags flags() const { return _M_flags; } /** * @brief Setting new format flags all at once. * @param __fmtfl The new flags to set. * @return The previous format control flags. * * This function overwrites all the format flags with @a __fmtfl. */ fmtflags flags(fmtflags __fmtfl) { fmtflags __old = _M_flags; _M_flags = __fmtfl; return __old; } /** * @brief Setting new format flags. * @param __fmtfl Additional flags to set. * @return The previous format control flags. * * This function sets additional flags in format control. Flags that * were previously set remain set. */ fmtflags setf(fmtflags __fmtfl) { fmtflags __old = _M_flags; _M_flags |= __fmtfl; return __old; } /** * @brief Setting new format flags. * @param __fmtfl Additional flags to set. * @param __mask The flags mask for @a fmtfl. * @return The previous format control flags. * * This function clears @a mask in the format flags, then sets * @a fmtfl @c & @a mask. An example mask is @c ios_base::adjustfield. */ fmtflags setf(fmtflags __fmtfl, fmtflags __mask) { fmtflags __old = _M_flags; _M_flags &= ~__mask; _M_flags |= (__fmtfl & __mask); return __old; } /** * @brief Clearing format flags. * @param __mask The flags to unset. * * This function clears @a __mask in the format flags. */ void unsetf(fmtflags __mask) { _M_flags &= ~__mask; } /** * @brief Flags access. * @return The precision to generate on certain output operations. * * Be careful if you try to give a definition of @a precision here; see * DR 189. */ streamsize precision() const { return _M_precision; } /** * @brief Changing flags. * @param __prec The new precision value. * @return The previous value of precision(). */ streamsize precision(streamsize __prec) { streamsize __old = _M_precision; _M_precision = __prec; return __old; } /** * @brief Flags access. * @return The minimum field width to generate on output operations. * * <em>Minimum field width</em> refers to the number of characters. */ streamsize width() const { return _M_width; } /** * @brief Changing flags. * @param __wide The new width value. * @return The previous value of width(). */ streamsize width(streamsize __wide) { streamsize __old = _M_width; _M_width = __wide; return __old; } // [27.4.2.4] ios_base static members /** * @brief Interaction with the standard C I/O objects. * @param __sync Whether to synchronize or not. * @return True if the standard streams were previously synchronized. * * The synchronization referred to is @e only that between the standard * C facilities (e.g., stdout) and the standard C++ objects (e.g., * cout). User-declared streams are unaffected. See * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch28s02.html */ static bool sync_with_stdio(bool __sync = true); // [27.4.2.3] ios_base locale functions /** * @brief Setting a new locale. * @param __loc The new locale. * @return The previous locale. * * Sets the new locale for this stream, and then invokes each callback * with imbue_event. */ locale imbue(const locale& __loc) throw(); /** * @brief Locale access * @return A copy of the current locale. * * If @c imbue(loc) has previously been called, then this function * returns @c loc. Otherwise, it returns a copy of @c std::locale(), * the global C++ locale. */ locale getloc() const { return _M_ios_locale; } /** * @brief Locale access * @return A reference to the current locale. * * Like getloc above, but returns a reference instead of * generating a copy. */ const locale& _M_getloc() const { return _M_ios_locale; } // [27.4.2.5] ios_base storage functions /** * @brief Access to unique indices. * @return An integer different from all previous calls. * * This function returns a unique integer every time it is called. It * can be used for any purpose, but is primarily intended to be a unique * index for the iword and pword functions. The expectation is that an * application calls xalloc in order to obtain an index in the iword and * pword arrays that can be used without fear of conflict. * * The implementation maintains a static variable that is incremented and * returned on each invocation. xalloc is guaranteed to return an index * that is safe to use in the iword and pword arrays. */ static int xalloc() throw(); /** * @brief Access to integer array. * @param __ix Index into the array. * @return A reference to an integer associated with the index. * * The iword function provides access to an array of integers that can be * used for any purpose. The array grows as required to hold the * supplied index. All integers in the array are initialized to 0. * * The implementation reserves several indices. You should use xalloc to * obtain an index that is safe to use. Also note that since the array * can grow dynamically, it is not safe to hold onto the reference. */ long& iword(int __ix) { _Words& __word = (__ix < _M_word_size) ? _M_word[__ix] : _M_grow_words(__ix, true); return __word._M_iword; } /** * @brief Access to void pointer array. * @param __ix Index into the array. * @return A reference to a void* associated with the index. * * The pword function provides access to an array of pointers that can be * used for any purpose. The array grows as required to hold the * supplied index. All pointers in the array are initialized to 0. * * The implementation reserves several indices. You should use xalloc to * obtain an index that is safe to use. Also note that since the array * can grow dynamically, it is not safe to hold onto the reference. */ void*& pword(int __ix) { _Words& __word = (__ix < _M_word_size) ? _M_word[__ix] : _M_grow_words(__ix, false); return __word._M_pword; } // Destructor /** * Invokes each callback with erase_event. Destroys local storage. * * Note that the ios_base object for the standard streams never gets * destroyed. As a result, any callbacks registered with the standard * streams will not get invoked with erase_event (unless copyfmt is * used). */ virtual ~ios_base(); protected: ios_base() throw (); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 50. Copy constructor and assignment operator of ios_base private: ios_base(const ios_base&); ios_base& operator=(const ios_base&); }; // [27.4.5.1] fmtflags manipulators /// Calls base.setf(ios_base::boolalpha). inline ios_base& boolalpha(ios_base& __base) { __base.setf(ios_base::boolalpha); return __base; } /// Calls base.unsetf(ios_base::boolalpha). inline ios_base& noboolalpha(ios_base& __base) { __base.unsetf(ios_base::boolalpha); return __base; } /// Calls base.setf(ios_base::showbase). inline ios_base& showbase(ios_base& __base) { __base.setf(ios_base::showbase); return __base; } /// Calls base.unsetf(ios_base::showbase). inline ios_base& noshowbase(ios_base& __base) { __base.unsetf(ios_base::showbase); return __base; } /// Calls base.setf(ios_base::showpoint). inline ios_base& showpoint(ios_base& __base) { __base.setf(ios_base::showpoint); return __base; } /// Calls base.unsetf(ios_base::showpoint). inline ios_base& noshowpoint(ios_base& __base) { __base.unsetf(ios_base::showpoint); return __base; } /// Calls base.setf(ios_base::showpos). inline ios_base& showpos(ios_base& __base) { __base.setf(ios_base::showpos); return __base; } /// Calls base.unsetf(ios_base::showpos). inline ios_base& noshowpos(ios_base& __base) { __base.unsetf(ios_base::showpos); return __base; } /// Calls base.setf(ios_base::skipws). inline ios_base& skipws(ios_base& __base) { __base.setf(ios_base::skipws); return __base; } /// Calls base.unsetf(ios_base::skipws). inline ios_base& noskipws(ios_base& __base) { __base.unsetf(ios_base::skipws); return __base; } /// Calls base.setf(ios_base::uppercase). inline ios_base& uppercase(ios_base& __base) { __base.setf(ios_base::uppercase); return __base; } /// Calls base.unsetf(ios_base::uppercase). inline ios_base& nouppercase(ios_base& __base) { __base.unsetf(ios_base::uppercase); return __base; } /// Calls base.setf(ios_base::unitbuf). inline ios_base& unitbuf(ios_base& __base) { __base.setf(ios_base::unitbuf); return __base; } /// Calls base.unsetf(ios_base::unitbuf). inline ios_base& nounitbuf(ios_base& __base) { __base.unsetf(ios_base::unitbuf); return __base; } // [27.4.5.2] adjustfield manipulators /// Calls base.setf(ios_base::internal, ios_base::adjustfield). inline ios_base& internal(ios_base& __base) { __base.setf(ios_base::internal, ios_base::adjustfield); return __base; } /// Calls base.setf(ios_base::left, ios_base::adjustfield). inline ios_base& left(ios_base& __base) { __base.setf(ios_base::left, ios_base::adjustfield); return __base; } /// Calls base.setf(ios_base::right, ios_base::adjustfield). inline ios_base& right(ios_base& __base) { __base.setf(ios_base::right, ios_base::adjustfield); return __base; } // [27.4.5.3] basefield manipulators /// Calls base.setf(ios_base::dec, ios_base::basefield). inline ios_base& dec(ios_base& __base) { __base.setf(ios_base::dec, ios_base::basefield); return __base; } /// Calls base.setf(ios_base::hex, ios_base::basefield). inline ios_base& hex(ios_base& __base) { __base.setf(ios_base::hex, ios_base::basefield); return __base; } /// Calls base.setf(ios_base::oct, ios_base::basefield). inline ios_base& oct(ios_base& __base) { __base.setf(ios_base::oct, ios_base::basefield); return __base; } // [27.4.5.4] floatfield manipulators /// Calls base.setf(ios_base::fixed, ios_base::floatfield). inline ios_base& fixed(ios_base& __base) { __base.setf(ios_base::fixed, ios_base::floatfield); return __base; } /// Calls base.setf(ios_base::scientific, ios_base::floatfield). inline ios_base& scientific(ios_base& __base) { __base.setf(ios_base::scientific, ios_base::floatfield); return __base; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _IOS_BASE_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/locale_classes.h���������������������������������������������������������������������0000644�����������������00000054711�14763166030�0011671 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Locale support -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/locale_classes.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{locale} */ // // ISO C++ 14882: 22.1 Locales // #ifndef _LOCALE_CLASSES_H #define _LOCALE_CLASSES_H 1 #pragma GCC system_header #include <bits/localefwd.h> #include <string> #include <ext/atomicity.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // 22.1.1 Class locale /** * @brief Container class for localization functionality. * @ingroup locales * * The locale class is first a class wrapper for C library locales. It is * also an extensible container for user-defined localization. A locale is * a collection of facets that implement various localization features such * as money, time, and number printing. * * Constructing C++ locales does not change the C library locale. * * This library supports efficient construction and copying of locales * through a reference counting implementation of the locale class. */ class locale { public: // Types: /// Definition of locale::category. typedef int category; // Forward decls and friends: class facet; class id; class _Impl; friend class facet; friend class _Impl; template<typename _Facet> friend bool has_facet(const locale&) throw(); template<typename _Facet> friend const _Facet& use_facet(const locale&); template<typename _Cache> friend struct __use_cache; //@{ /** * @brief Category values. * * The standard category values are none, ctype, numeric, collate, time, * monetary, and messages. They form a bitmask that supports union and * intersection. The category all is the union of these values. * * NB: Order must match _S_facet_categories definition in locale.cc */ static const category none = 0; static const category ctype = 1L << 0; static const category numeric = 1L << 1; static const category collate = 1L << 2; static const category time = 1L << 3; static const category monetary = 1L << 4; static const category messages = 1L << 5; static const category all = (ctype | numeric | collate | time | monetary | messages); //@} // Construct/copy/destroy: /** * @brief Default constructor. * * Constructs a copy of the global locale. If no locale has been * explicitly set, this is the C locale. */ locale() throw(); /** * @brief Copy constructor. * * Constructs a copy of @a other. * * @param __other The locale to copy. */ locale(const locale& __other) throw(); /** * @brief Named locale constructor. * * Constructs a copy of the named C library locale. * * @param __s Name of the locale to construct. * @throw std::runtime_error if __s is null or an undefined locale. */ explicit locale(const char* __s); /** * @brief Construct locale with facets from another locale. * * Constructs a copy of the locale @a base. The facets specified by @a * cat are replaced with those from the locale named by @a s. If base is * named, this locale instance will also be named. * * @param __base The locale to copy. * @param __s Name of the locale to use facets from. * @param __cat Set of categories defining the facets to use from __s. * @throw std::runtime_error if __s is null or an undefined locale. */ locale(const locale& __base, const char* __s, category __cat); /** * @brief Construct locale with facets from another locale. * * Constructs a copy of the locale @a base. The facets specified by @a * cat are replaced with those from the locale @a add. If @a base and @a * add are named, this locale instance will also be named. * * @param __base The locale to copy. * @param __add The locale to use facets from. * @param __cat Set of categories defining the facets to use from add. */ locale(const locale& __base, const locale& __add, category __cat); /** * @brief Construct locale with another facet. * * Constructs a copy of the locale @a __other. The facet @a __f * is added to @a __other, replacing an existing facet of type * Facet if there is one. If @a __f is null, this locale is a * copy of @a __other. * * @param __other The locale to copy. * @param __f The facet to add in. */ template<typename _Facet> locale(const locale& __other, _Facet* __f); /// Locale destructor. ~locale() throw(); /** * @brief Assignment operator. * * Set this locale to be a copy of @a other. * * @param __other The locale to copy. * @return A reference to this locale. */ const locale& operator=(const locale& __other) throw(); /** * @brief Construct locale with another facet. * * Constructs and returns a new copy of this locale. Adds or replaces an * existing facet of type Facet from the locale @a other into the new * locale. * * @tparam _Facet The facet type to copy from other * @param __other The locale to copy from. * @return Newly constructed locale. * @throw std::runtime_error if __other has no facet of type _Facet. */ template<typename _Facet> locale combine(const locale& __other) const; // Locale operations: /** * @brief Return locale name. * @return Locale name or "*" if unnamed. */ string name() const; /** * @brief Locale equality. * * @param __other The locale to compare against. * @return True if other and this refer to the same locale instance, are * copies, or have the same name. False otherwise. */ bool operator==(const locale& __other) const throw(); /** * @brief Locale inequality. * * @param __other The locale to compare against. * @return ! (*this == __other) */ bool operator!=(const locale& __other) const throw() { return !(this->operator==(__other)); } /** * @brief Compare two strings according to collate. * * Template operator to compare two strings using the compare function of * the collate facet in this locale. One use is to provide the locale to * the sort function. For example, a vector v of strings could be sorted * according to locale loc by doing: * @code * std::sort(v.begin(), v.end(), loc); * @endcode * * @param __s1 First string to compare. * @param __s2 Second string to compare. * @return True if collate<_Char> facet compares __s1 < __s2, else false. */ template<typename _Char, typename _Traits, typename _Alloc> bool operator()(const basic_string<_Char, _Traits, _Alloc>& __s1, const basic_string<_Char, _Traits, _Alloc>& __s2) const; // Global locale objects: /** * @brief Set global locale * * This function sets the global locale to the argument and returns a * copy of the previous global locale. If the argument has a name, it * will also call std::setlocale(LC_ALL, loc.name()). * * @param __loc The new locale to make global. * @return Copy of the old global locale. */ static locale global(const locale& __loc); /** * @brief Return reference to the C locale. */ static const locale& classic(); private: // The (shared) implementation _Impl* _M_impl; // The "C" reference locale static _Impl* _S_classic; // Current global locale static _Impl* _S_global; // Names of underlying locale categories. // NB: locale::global() has to know how to modify all the // underlying categories, not just the ones required by the C++ // standard. static const char* const* const _S_categories; // Number of standard categories. For C++, these categories are // collate, ctype, monetary, numeric, time, and messages. These // directly correspond to ISO C99 macros LC_COLLATE, LC_CTYPE, // LC_MONETARY, LC_NUMERIC, and LC_TIME. In addition, POSIX (IEEE // 1003.1-2001) specifies LC_MESSAGES. // In addition to the standard categories, the underlying // operating system is allowed to define extra LC_* // macros. For GNU systems, the following are also valid: // LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT, // and LC_IDENTIFICATION. enum { _S_categories_size = 6 + _GLIBCXX_NUM_CATEGORIES }; #ifdef __GTHREADS static __gthread_once_t _S_once; #endif explicit locale(_Impl*) throw(); static void _S_initialize(); static void _S_initialize_once() throw(); static category _S_normalize_category(category); void _M_coalesce(const locale& __base, const locale& __add, category __cat); }; // 22.1.1.1.2 Class locale::facet /** * @brief Localization functionality base class. * @ingroup locales * * The facet class is the base class for a localization feature, such as * money, time, and number printing. It provides common support for facets * and reference management. * * Facets may not be copied or assigned. */ class locale::facet { private: friend class locale; friend class locale::_Impl; mutable _Atomic_word _M_refcount; // Contains data from the underlying "C" library for the classic locale. static __c_locale _S_c_locale; // String literal for the name of the classic locale. static const char _S_c_name[2]; #ifdef __GTHREADS static __gthread_once_t _S_once; #endif static void _S_initialize_once(); protected: /** * @brief Facet constructor. * * This is the constructor provided by the standard. If refs is 0, the * facet is destroyed when the last referencing locale is destroyed. * Otherwise the facet will never be destroyed. * * @param __refs The initial value for reference count. */ explicit facet(size_t __refs = 0) throw() : _M_refcount(__refs ? 1 : 0) { } /// Facet destructor. virtual ~facet(); static void _S_create_c_locale(__c_locale& __cloc, const char* __s, __c_locale __old = 0); static __c_locale _S_clone_c_locale(__c_locale& __cloc) throw(); static void _S_destroy_c_locale(__c_locale& __cloc); static __c_locale _S_lc_ctype_c_locale(__c_locale __cloc, const char* __s); // Returns data from the underlying "C" library data for the // classic locale. static __c_locale _S_get_c_locale(); _GLIBCXX_CONST static const char* _S_get_c_name() throw(); private: void _M_add_reference() const throw() { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); } void _M_remove_reference() const throw() { // Be race-detector-friendly. For more info see bits/c++config. _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount); if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1) { _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount); __try { delete this; } __catch(...) { } } } facet(const facet&); // Not defined. facet& operator=(const facet&); // Not defined. }; // 22.1.1.1.3 Class locale::id /** * @brief Facet ID class. * @ingroup locales * * The ID class provides facets with an index used to identify them. * Every facet class must define a public static member locale::id, or be * derived from a facet that provides this member, otherwise the facet * cannot be used in a locale. The locale::id ensures that each class * type gets a unique identifier. */ class locale::id { private: friend class locale; friend class locale::_Impl; template<typename _Facet> friend const _Facet& use_facet(const locale&); template<typename _Facet> friend bool has_facet(const locale&) throw(); // NB: There is no accessor for _M_index because it may be used // before the constructor is run; the effect of calling a member // function (even an inline) would be undefined. mutable size_t _M_index; // Last id number assigned. static _Atomic_word _S_refcount; void operator=(const id&); // Not defined. id(const id&); // Not defined. public: // NB: This class is always a static data member, and thus can be // counted on to be zero-initialized. /// Constructor. id() { } size_t _M_id() const throw(); }; // Implementation object for locale. class locale::_Impl { public: // Friends. friend class locale; friend class locale::facet; template<typename _Facet> friend bool has_facet(const locale&) throw(); template<typename _Facet> friend const _Facet& use_facet(const locale&); template<typename _Cache> friend struct __use_cache; private: // Data Members. _Atomic_word _M_refcount; const facet** _M_facets; size_t _M_facets_size; const facet** _M_caches; char** _M_names; static const locale::id* const _S_id_ctype[]; static const locale::id* const _S_id_numeric[]; static const locale::id* const _S_id_collate[]; static const locale::id* const _S_id_time[]; static const locale::id* const _S_id_monetary[]; static const locale::id* const _S_id_messages[]; static const locale::id* const* const _S_facet_categories[]; void _M_add_reference() throw() { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); } void _M_remove_reference() throw() { // Be race-detector-friendly. For more info see bits/c++config. _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount); if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1) { _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount); __try { delete this; } __catch(...) { } } } _Impl(const _Impl&, size_t); _Impl(const char*, size_t); _Impl(size_t) throw(); ~_Impl() throw(); _Impl(const _Impl&); // Not defined. void operator=(const _Impl&); // Not defined. bool _M_check_same_name() { bool __ret = true; if (_M_names[1]) // We must actually compare all the _M_names: can be all equal! for (size_t __i = 0; __ret && __i < _S_categories_size - 1; ++__i) __ret = __builtin_strcmp(_M_names[__i], _M_names[__i + 1]) == 0; return __ret; } void _M_replace_categories(const _Impl*, category); void _M_replace_category(const _Impl*, const locale::id* const*); void _M_replace_facet(const _Impl*, const locale::id*); void _M_install_facet(const locale::id*, const facet*); template<typename _Facet> void _M_init_facet(_Facet* __facet) { _M_install_facet(&_Facet::id, __facet); } void _M_install_cache(const facet*, size_t); }; /** * @brief Facet for localized string comparison. * * This facet encapsulates the code to compare strings in a localized * manner. * * The collate template uses protected virtual functions to provide * the actual results. The public accessors forward the call to * the virtual functions. These virtual functions are hooks for * developers to implement the behavior they require from the * collate facet. */ template<typename _CharT> class collate : public locale::facet { public: // Types: //@{ /// Public typedefs typedef _CharT char_type; typedef basic_string<_CharT> string_type; //@} protected: // Underlying "C" library locale information saved from // initialization, needed by collate_byname as well. __c_locale _M_c_locale_collate; public: /// Numpunct facet id. static locale::id id; /** * @brief Constructor performs initialization. * * This is the constructor provided by the standard. * * @param __refs Passed to the base facet class. */ explicit collate(size_t __refs = 0) : facet(__refs), _M_c_locale_collate(_S_get_c_locale()) { } /** * @brief Internal constructor. Not for general use. * * This is a constructor for use by the library itself to set up new * locales. * * @param __cloc The C locale. * @param __refs Passed to the base facet class. */ explicit collate(__c_locale __cloc, size_t __refs = 0) : facet(__refs), _M_c_locale_collate(_S_clone_c_locale(__cloc)) { } /** * @brief Compare two strings. * * This function compares two strings and returns the result by calling * collate::do_compare(). * * @param __lo1 Start of string 1. * @param __hi1 End of string 1. * @param __lo2 Start of string 2. * @param __hi2 End of string 2. * @return 1 if string1 > string2, -1 if string1 < string2, else 0. */ int compare(const _CharT* __lo1, const _CharT* __hi1, const _CharT* __lo2, const _CharT* __hi2) const { return this->do_compare(__lo1, __hi1, __lo2, __hi2); } /** * @brief Transform string to comparable form. * * This function is a wrapper for strxfrm functionality. It takes the * input string and returns a modified string that can be directly * compared to other transformed strings. In the C locale, this * function just returns a copy of the input string. In some other * locales, it may replace two chars with one, change a char for * another, etc. It does so by returning collate::do_transform(). * * @param __lo Start of string. * @param __hi End of string. * @return Transformed string_type. */ string_type transform(const _CharT* __lo, const _CharT* __hi) const { return this->do_transform(__lo, __hi); } /** * @brief Return hash of a string. * * This function computes and returns a hash on the input string. It * does so by returning collate::do_hash(). * * @param __lo Start of string. * @param __hi End of string. * @return Hash value. */ long hash(const _CharT* __lo, const _CharT* __hi) const { return this->do_hash(__lo, __hi); } // Used to abstract out _CharT bits in virtual member functions, below. int _M_compare(const _CharT*, const _CharT*) const throw(); size_t _M_transform(_CharT*, const _CharT*, size_t) const throw(); protected: /// Destructor. virtual ~collate() { _S_destroy_c_locale(_M_c_locale_collate); } /** * @brief Compare two strings. * * This function is a hook for derived classes to change the value * returned. @see compare(). * * @param __lo1 Start of string 1. * @param __hi1 End of string 1. * @param __lo2 Start of string 2. * @param __hi2 End of string 2. * @return 1 if string1 > string2, -1 if string1 < string2, else 0. */ virtual int do_compare(const _CharT* __lo1, const _CharT* __hi1, const _CharT* __lo2, const _CharT* __hi2) const; /** * @brief Transform string to comparable form. * * This function is a hook for derived classes to change the value * returned. * * @param __lo Start. * @param __hi End. * @return transformed string. */ virtual string_type do_transform(const _CharT* __lo, const _CharT* __hi) const; /** * @brief Return hash of a string. * * This function computes and returns a hash on the input string. This * function is a hook for derived classes to change the value returned. * * @param __lo Start of string. * @param __hi End of string. * @return Hash value. */ virtual long do_hash(const _CharT* __lo, const _CharT* __hi) const; }; template<typename _CharT> locale::id collate<_CharT>::id; // Specializations. template<> int collate<char>::_M_compare(const char*, const char*) const throw(); template<> size_t collate<char>::_M_transform(char*, const char*, size_t) const throw(); #ifdef _GLIBCXX_USE_WCHAR_T template<> int collate<wchar_t>::_M_compare(const wchar_t*, const wchar_t*) const throw(); template<> size_t collate<wchar_t>::_M_transform(wchar_t*, const wchar_t*, size_t) const throw(); #endif /// class collate_byname [22.2.4.2]. template<typename _CharT> class collate_byname : public collate<_CharT> { public: //@{ /// Public typedefs typedef _CharT char_type; typedef basic_string<_CharT> string_type; //@} explicit collate_byname(const char* __s, size_t __refs = 0) : collate<_CharT>(__refs) { if (__builtin_strcmp(__s, "C") != 0 && __builtin_strcmp(__s, "POSIX") != 0) { this->_S_destroy_c_locale(this->_M_c_locale_collate); this->_S_create_c_locale(this->_M_c_locale_collate, __s); } } protected: virtual ~collate_byname() { } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace # include <bits/locale_classes.tcc> #endif �������������������������������������������������������c++/4.8.2/bits/stl_relops.h�������������������������������������������������������������������������0000644�����������������00000010767�14763166030�0011106 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// std::rel_ops implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the, 2009 Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * Copyright (c) 1996,1997 * Silicon Graphics * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * */ /** @file bits/stl_relops.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{utility} * * Inclusion of this file has been removed from * all of the other STL headers for safety reasons, except std_utility.h. * For more information, see the thread of about twenty messages starting * with http://gcc.gnu.org/ml/libstdc++/2001-01/msg00223.html, or * http://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.ambiguous_overloads * * Short summary: the rel_ops operators should be avoided for the present. */ #ifndef _STL_RELOPS_H #define _STL_RELOPS_H 1 namespace std _GLIBCXX_VISIBILITY(default) { namespace rel_ops { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** @namespace std::rel_ops * @brief The generated relational operators are sequestered here. */ /** * @brief Defines @c != for arbitrary types, in terms of @c ==. * @param __x A thing. * @param __y Another thing. * @return __x != __y * * This function uses @c == to determine its result. */ template <class _Tp> inline bool operator!=(const _Tp& __x, const _Tp& __y) { return !(__x == __y); } /** * @brief Defines @c > for arbitrary types, in terms of @c <. * @param __x A thing. * @param __y Another thing. * @return __x > __y * * This function uses @c < to determine its result. */ template <class _Tp> inline bool operator>(const _Tp& __x, const _Tp& __y) { return __y < __x; } /** * @brief Defines @c <= for arbitrary types, in terms of @c <. * @param __x A thing. * @param __y Another thing. * @return __x <= __y * * This function uses @c < to determine its result. */ template <class _Tp> inline bool operator<=(const _Tp& __x, const _Tp& __y) { return !(__y < __x); } /** * @brief Defines @c >= for arbitrary types, in terms of @c <. * @param __x A thing. * @param __y Another thing. * @return __x >= __y * * This function uses @c < to determine its result. */ template <class _Tp> inline bool operator>=(const _Tp& __x, const _Tp& __y) { return !(__x < __y); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace rel_ops } // namespace std #endif /* _STL_RELOPS_H */ ���������c++/4.8.2/bits/gslice_array.h�����������������������������������������������������������������������0000644�����������������00000017131�14763166030�0011354 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// The template and inlines for the -*- C++ -*- gslice_array class. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/gslice_array.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{valarray} */ // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr> #ifndef _GSLICE_ARRAY_H #define _GSLICE_ARRAY_H 1 #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup numeric_arrays * @{ */ /** * @brief Reference to multi-dimensional subset of an array. * * A gslice_array is a reference to the actual elements of an array * specified by a gslice. The way to get a gslice_array is to call * operator[](gslice) on a valarray. The returned gslice_array then * permits carrying operations out on the referenced subset of elements in * the original valarray. For example, operator+=(valarray) will add * values to the subset of elements in the underlying valarray this * gslice_array refers to. * * @param Tp Element type. */ template<typename _Tp> class gslice_array { public: typedef _Tp value_type; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 253. valarray helper functions are almost entirely useless /// Copy constructor. Both slices refer to the same underlying array. gslice_array(const gslice_array&); /// Assignment operator. Assigns slice elements to corresponding /// elements of @a a. gslice_array& operator=(const gslice_array&); /// Assign slice elements to corresponding elements of @a v. void operator=(const valarray<_Tp>&) const; /// Multiply slice elements by corresponding elements of @a v. void operator*=(const valarray<_Tp>&) const; /// Divide slice elements by corresponding elements of @a v. void operator/=(const valarray<_Tp>&) const; /// Modulo slice elements by corresponding elements of @a v. void operator%=(const valarray<_Tp>&) const; /// Add corresponding elements of @a v to slice elements. void operator+=(const valarray<_Tp>&) const; /// Subtract corresponding elements of @a v from slice elements. void operator-=(const valarray<_Tp>&) const; /// Logical xor slice elements with corresponding elements of @a v. void operator^=(const valarray<_Tp>&) const; /// Logical and slice elements with corresponding elements of @a v. void operator&=(const valarray<_Tp>&) const; /// Logical or slice elements with corresponding elements of @a v. void operator|=(const valarray<_Tp>&) const; /// Left shift slice elements by corresponding elements of @a v. void operator<<=(const valarray<_Tp>&) const; /// Right shift slice elements by corresponding elements of @a v. void operator>>=(const valarray<_Tp>&) const; /// Assign all slice elements to @a t. void operator=(const _Tp&) const; template<class _Dom> void operator=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator*=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator/=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator%=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator+=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator-=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator^=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator&=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator|=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator<<=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator>>=(const _Expr<_Dom, _Tp>&) const; private: _Array<_Tp> _M_array; const valarray<size_t>& _M_index; friend class valarray<_Tp>; gslice_array(_Array<_Tp>, const valarray<size_t>&); // not implemented gslice_array(); }; template<typename _Tp> inline gslice_array<_Tp>::gslice_array(_Array<_Tp> __a, const valarray<size_t>& __i) : _M_array(__a), _M_index(__i) {} template<typename _Tp> inline gslice_array<_Tp>::gslice_array(const gslice_array<_Tp>& __a) : _M_array(__a._M_array), _M_index(__a._M_index) {} template<typename _Tp> inline gslice_array<_Tp>& gslice_array<_Tp>::operator=(const gslice_array<_Tp>& __a) { std::__valarray_copy(_Array<_Tp>(__a._M_array), _Array<size_t>(__a._M_index), _M_index.size(), _M_array, _Array<size_t>(_M_index)); return *this; } template<typename _Tp> inline void gslice_array<_Tp>::operator=(const _Tp& __t) const { std::__valarray_fill(_M_array, _Array<size_t>(_M_index), _M_index.size(), __t); } template<typename _Tp> inline void gslice_array<_Tp>::operator=(const valarray<_Tp>& __v) const { std::__valarray_copy(_Array<_Tp>(__v), __v.size(), _M_array, _Array<size_t>(_M_index)); } template<typename _Tp> template<class _Dom> inline void gslice_array<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e) const { std::__valarray_copy (__e, _M_index.size(), _M_array, _Array<size_t>(_M_index)); } #undef _DEFINE_VALARRAY_OPERATOR #define _DEFINE_VALARRAY_OPERATOR(_Op, _Name) \ template<typename _Tp> \ inline void \ gslice_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const \ { \ _Array_augmented_##_Name(_M_array, _Array<size_t>(_M_index), \ _Array<_Tp>(__v), __v.size()); \ } \ \ template<typename _Tp> \ template<class _Dom> \ inline void \ gslice_array<_Tp>::operator _Op##= (const _Expr<_Dom, _Tp>& __e) const\ { \ _Array_augmented_##_Name(_M_array, _Array<size_t>(_M_index), __e,\ _M_index.size()); \ } _DEFINE_VALARRAY_OPERATOR(*, __multiplies) _DEFINE_VALARRAY_OPERATOR(/, __divides) _DEFINE_VALARRAY_OPERATOR(%, __modulus) _DEFINE_VALARRAY_OPERATOR(+, __plus) _DEFINE_VALARRAY_OPERATOR(-, __minus) _DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor) _DEFINE_VALARRAY_OPERATOR(&, __bitwise_and) _DEFINE_VALARRAY_OPERATOR(|, __bitwise_or) _DEFINE_VALARRAY_OPERATOR(<<, __shift_left) _DEFINE_VALARRAY_OPERATOR(>>, __shift_right) #undef _DEFINE_VALARRAY_OPERATOR // @} group numeric_arrays _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _GSLICE_ARRAY_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/atomic_base.h������������������������������������������������������������������������0000644�����������������00000061771�14763166030�0011167 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- header. // Copyright (C) 2008-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/atomic_base.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{atomic} */ #ifndef _GLIBCXX_ATOMIC_BASE_H #define _GLIBCXX_ATOMIC_BASE_H 1 #pragma GCC system_header #include <bits/c++config.h> #include <stdbool.h> #include <stdint.h> #include <bits/atomic_lockfree_defines.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup atomics Atomics * * Components for performing atomic operations. * @{ */ /// Enumeration for memory_order typedef enum memory_order { memory_order_relaxed, memory_order_consume, memory_order_acquire, memory_order_release, memory_order_acq_rel, memory_order_seq_cst } memory_order; enum __memory_order_modifier { __memory_order_mask = 0x0ffff, __memory_order_modifier_mask = 0xffff0000, __memory_order_hle_acquire = 0x10000, __memory_order_hle_release = 0x20000 }; constexpr memory_order operator|(memory_order __m, __memory_order_modifier __mod) { return memory_order(__m | int(__mod)); } constexpr memory_order operator&(memory_order __m, __memory_order_modifier __mod) { return memory_order(__m & int(__mod)); } // Drop release ordering as per [atomics.types.operations.req]/21 constexpr memory_order __cmpexch_failure_order2(memory_order __m) noexcept { return __m == memory_order_acq_rel ? memory_order_acquire : __m == memory_order_release ? memory_order_relaxed : __m; } constexpr memory_order __cmpexch_failure_order(memory_order __m) noexcept { return memory_order(__cmpexch_failure_order2(__m & __memory_order_mask) | (__m & __memory_order_modifier_mask)); } inline void atomic_thread_fence(memory_order __m) noexcept { __atomic_thread_fence(__m); } inline void atomic_signal_fence(memory_order __m) noexcept { __atomic_signal_fence(__m); } /// kill_dependency template<typename _Tp> inline _Tp kill_dependency(_Tp __y) noexcept { _Tp __ret(__y); return __ret; } // Base types for atomics. template<typename _IntTp> struct __atomic_base; /// atomic_char typedef __atomic_base<char> atomic_char; /// atomic_schar typedef __atomic_base<signed char> atomic_schar; /// atomic_uchar typedef __atomic_base<unsigned char> atomic_uchar; /// atomic_short typedef __atomic_base<short> atomic_short; /// atomic_ushort typedef __atomic_base<unsigned short> atomic_ushort; /// atomic_int typedef __atomic_base<int> atomic_int; /// atomic_uint typedef __atomic_base<unsigned int> atomic_uint; /// atomic_long typedef __atomic_base<long> atomic_long; /// atomic_ulong typedef __atomic_base<unsigned long> atomic_ulong; /// atomic_llong typedef __atomic_base<long long> atomic_llong; /// atomic_ullong typedef __atomic_base<unsigned long long> atomic_ullong; /// atomic_wchar_t typedef __atomic_base<wchar_t> atomic_wchar_t; /// atomic_char16_t typedef __atomic_base<char16_t> atomic_char16_t; /// atomic_char32_t typedef __atomic_base<char32_t> atomic_char32_t; /// atomic_char32_t typedef __atomic_base<char32_t> atomic_char32_t; /// atomic_int_least8_t typedef __atomic_base<int_least8_t> atomic_int_least8_t; /// atomic_uint_least8_t typedef __atomic_base<uint_least8_t> atomic_uint_least8_t; /// atomic_int_least16_t typedef __atomic_base<int_least16_t> atomic_int_least16_t; /// atomic_uint_least16_t typedef __atomic_base<uint_least16_t> atomic_uint_least16_t; /// atomic_int_least32_t typedef __atomic_base<int_least32_t> atomic_int_least32_t; /// atomic_uint_least32_t typedef __atomic_base<uint_least32_t> atomic_uint_least32_t; /// atomic_int_least64_t typedef __atomic_base<int_least64_t> atomic_int_least64_t; /// atomic_uint_least64_t typedef __atomic_base<uint_least64_t> atomic_uint_least64_t; /// atomic_int_fast8_t typedef __atomic_base<int_fast8_t> atomic_int_fast8_t; /// atomic_uint_fast8_t typedef __atomic_base<uint_fast8_t> atomic_uint_fast8_t; /// atomic_int_fast16_t typedef __atomic_base<int_fast16_t> atomic_int_fast16_t; /// atomic_uint_fast16_t typedef __atomic_base<uint_fast16_t> atomic_uint_fast16_t; /// atomic_int_fast32_t typedef __atomic_base<int_fast32_t> atomic_int_fast32_t; /// atomic_uint_fast32_t typedef __atomic_base<uint_fast32_t> atomic_uint_fast32_t; /// atomic_int_fast64_t typedef __atomic_base<int_fast64_t> atomic_int_fast64_t; /// atomic_uint_fast64_t typedef __atomic_base<uint_fast64_t> atomic_uint_fast64_t; /// atomic_intptr_t typedef __atomic_base<intptr_t> atomic_intptr_t; /// atomic_uintptr_t typedef __atomic_base<uintptr_t> atomic_uintptr_t; /// atomic_size_t typedef __atomic_base<size_t> atomic_size_t; /// atomic_intmax_t typedef __atomic_base<intmax_t> atomic_intmax_t; /// atomic_uintmax_t typedef __atomic_base<uintmax_t> atomic_uintmax_t; /// atomic_ptrdiff_t typedef __atomic_base<ptrdiff_t> atomic_ptrdiff_t; #define ATOMIC_VAR_INIT(_VI) { _VI } template<typename _Tp> struct atomic; template<typename _Tp> struct atomic<_Tp*>; /* The target's "set" value for test-and-set may not be exactly 1. */ #if __GCC_ATOMIC_TEST_AND_SET_TRUEVAL == 1 typedef bool __atomic_flag_data_type; #else typedef unsigned char __atomic_flag_data_type; #endif /** * @brief Base type for atomic_flag. * * Base type is POD with data, allowing atomic_flag to derive from * it and meet the standard layout type requirement. In addition to * compatibilty with a C interface, this allows different * implementations of atomic_flag to use the same atomic operation * functions, via a standard conversion to the __atomic_flag_base * argument. */ _GLIBCXX_BEGIN_EXTERN_C struct __atomic_flag_base { __atomic_flag_data_type _M_i; }; _GLIBCXX_END_EXTERN_C #define ATOMIC_FLAG_INIT { 0 } /// atomic_flag struct atomic_flag : public __atomic_flag_base { atomic_flag() noexcept = default; ~atomic_flag() noexcept = default; atomic_flag(const atomic_flag&) = delete; atomic_flag& operator=(const atomic_flag&) = delete; atomic_flag& operator=(const atomic_flag&) volatile = delete; // Conversion to ATOMIC_FLAG_INIT. constexpr atomic_flag(bool __i) noexcept : __atomic_flag_base{ _S_init(__i) } { } bool test_and_set(memory_order __m = memory_order_seq_cst) noexcept { return __atomic_test_and_set (&_M_i, __m); } bool test_and_set(memory_order __m = memory_order_seq_cst) volatile noexcept { return __atomic_test_and_set (&_M_i, __m); } void clear(memory_order __m = memory_order_seq_cst) noexcept { memory_order __b = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_consume); __glibcxx_assert(__b != memory_order_acquire); __glibcxx_assert(__b != memory_order_acq_rel); __atomic_clear (&_M_i, __m); } void clear(memory_order __m = memory_order_seq_cst) volatile noexcept { memory_order __b = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_consume); __glibcxx_assert(__b != memory_order_acquire); __glibcxx_assert(__b != memory_order_acq_rel); __atomic_clear (&_M_i, __m); } private: static constexpr __atomic_flag_data_type _S_init(bool __i) { return __i ? __GCC_ATOMIC_TEST_AND_SET_TRUEVAL : 0; } }; /// Base class for atomic integrals. // // For each of the integral types, define atomic_[integral type] struct // // atomic_bool bool // atomic_char char // atomic_schar signed char // atomic_uchar unsigned char // atomic_short short // atomic_ushort unsigned short // atomic_int int // atomic_uint unsigned int // atomic_long long // atomic_ulong unsigned long // atomic_llong long long // atomic_ullong unsigned long long // atomic_char16_t char16_t // atomic_char32_t char32_t // atomic_wchar_t wchar_t // // NB: Assuming _ITp is an integral scalar type that is 1, 2, 4, or // 8 bytes, since that is what GCC built-in functions for atomic // memory access expect. template<typename _ITp> struct __atomic_base { private: typedef _ITp __int_type; __int_type _M_i; public: __atomic_base() noexcept = default; ~__atomic_base() noexcept = default; __atomic_base(const __atomic_base&) = delete; __atomic_base& operator=(const __atomic_base&) = delete; __atomic_base& operator=(const __atomic_base&) volatile = delete; // Requires __int_type convertible to _M_i. constexpr __atomic_base(__int_type __i) noexcept : _M_i (__i) { } operator __int_type() const noexcept { return load(); } operator __int_type() const volatile noexcept { return load(); } __int_type operator=(__int_type __i) noexcept { store(__i); return __i; } __int_type operator=(__int_type __i) volatile noexcept { store(__i); return __i; } __int_type operator++(int) noexcept { return fetch_add(1); } __int_type operator++(int) volatile noexcept { return fetch_add(1); } __int_type operator--(int) noexcept { return fetch_sub(1); } __int_type operator--(int) volatile noexcept { return fetch_sub(1); } __int_type operator++() noexcept { return __atomic_add_fetch(&_M_i, 1, memory_order_seq_cst); } __int_type operator++() volatile noexcept { return __atomic_add_fetch(&_M_i, 1, memory_order_seq_cst); } __int_type operator--() noexcept { return __atomic_sub_fetch(&_M_i, 1, memory_order_seq_cst); } __int_type operator--() volatile noexcept { return __atomic_sub_fetch(&_M_i, 1, memory_order_seq_cst); } __int_type operator+=(__int_type __i) noexcept { return __atomic_add_fetch(&_M_i, __i, memory_order_seq_cst); } __int_type operator+=(__int_type __i) volatile noexcept { return __atomic_add_fetch(&_M_i, __i, memory_order_seq_cst); } __int_type operator-=(__int_type __i) noexcept { return __atomic_sub_fetch(&_M_i, __i, memory_order_seq_cst); } __int_type operator-=(__int_type __i) volatile noexcept { return __atomic_sub_fetch(&_M_i, __i, memory_order_seq_cst); } __int_type operator&=(__int_type __i) noexcept { return __atomic_and_fetch(&_M_i, __i, memory_order_seq_cst); } __int_type operator&=(__int_type __i) volatile noexcept { return __atomic_and_fetch(&_M_i, __i, memory_order_seq_cst); } __int_type operator|=(__int_type __i) noexcept { return __atomic_or_fetch(&_M_i, __i, memory_order_seq_cst); } __int_type operator|=(__int_type __i) volatile noexcept { return __atomic_or_fetch(&_M_i, __i, memory_order_seq_cst); } __int_type operator^=(__int_type __i) noexcept { return __atomic_xor_fetch(&_M_i, __i, memory_order_seq_cst); } __int_type operator^=(__int_type __i) volatile noexcept { return __atomic_xor_fetch(&_M_i, __i, memory_order_seq_cst); } bool is_lock_free() const noexcept { return __atomic_is_lock_free(sizeof(_M_i), nullptr); } bool is_lock_free() const volatile noexcept { return __atomic_is_lock_free(sizeof(_M_i), nullptr); } void store(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { memory_order __b = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_acquire); __glibcxx_assert(__b != memory_order_acq_rel); __glibcxx_assert(__b != memory_order_consume); __atomic_store_n(&_M_i, __i, __m); } void store(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { memory_order __b = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_acquire); __glibcxx_assert(__b != memory_order_acq_rel); __glibcxx_assert(__b != memory_order_consume); __atomic_store_n(&_M_i, __i, __m); } __int_type load(memory_order __m = memory_order_seq_cst) const noexcept { memory_order __b = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_release); __glibcxx_assert(__b != memory_order_acq_rel); return __atomic_load_n(&_M_i, __m); } __int_type load(memory_order __m = memory_order_seq_cst) const volatile noexcept { memory_order __b = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_release); __glibcxx_assert(__b != memory_order_acq_rel); return __atomic_load_n(&_M_i, __m); } __int_type exchange(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { return __atomic_exchange_n(&_M_i, __i, __m); } __int_type exchange(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return __atomic_exchange_n(&_M_i, __i, __m); } bool compare_exchange_weak(__int_type& __i1, __int_type __i2, memory_order __m1, memory_order __m2) noexcept { memory_order __b2 = __m2 & __memory_order_mask; memory_order __b1 = __m1 & __memory_order_mask; __glibcxx_assert(__b2 != memory_order_release); __glibcxx_assert(__b2 != memory_order_acq_rel); __glibcxx_assert(__b2 <= __b1); return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 1, __m1, __m2); } bool compare_exchange_weak(__int_type& __i1, __int_type __i2, memory_order __m1, memory_order __m2) volatile noexcept { memory_order __b2 = __m2 & __memory_order_mask; memory_order __b1 = __m1 & __memory_order_mask; __glibcxx_assert(__b2 != memory_order_release); __glibcxx_assert(__b2 != memory_order_acq_rel); __glibcxx_assert(__b2 <= __b1); return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 1, __m1, __m2); } bool compare_exchange_weak(__int_type& __i1, __int_type __i2, memory_order __m = memory_order_seq_cst) noexcept { return compare_exchange_weak(__i1, __i2, __m, __cmpexch_failure_order(__m)); } bool compare_exchange_weak(__int_type& __i1, __int_type __i2, memory_order __m = memory_order_seq_cst) volatile noexcept { return compare_exchange_weak(__i1, __i2, __m, __cmpexch_failure_order(__m)); } bool compare_exchange_strong(__int_type& __i1, __int_type __i2, memory_order __m1, memory_order __m2) noexcept { memory_order __b2 = __m2 & __memory_order_mask; memory_order __b1 = __m1 & __memory_order_mask; __glibcxx_assert(__b2 != memory_order_release); __glibcxx_assert(__b2 != memory_order_acq_rel); __glibcxx_assert(__b2 <= __b1); return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 0, __m1, __m2); } bool compare_exchange_strong(__int_type& __i1, __int_type __i2, memory_order __m1, memory_order __m2) volatile noexcept { memory_order __b2 = __m2 & __memory_order_mask; memory_order __b1 = __m1 & __memory_order_mask; __glibcxx_assert(__b2 != memory_order_release); __glibcxx_assert(__b2 != memory_order_acq_rel); __glibcxx_assert(__b2 <= __b1); return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 0, __m1, __m2); } bool compare_exchange_strong(__int_type& __i1, __int_type __i2, memory_order __m = memory_order_seq_cst) noexcept { return compare_exchange_strong(__i1, __i2, __m, __cmpexch_failure_order(__m)); } bool compare_exchange_strong(__int_type& __i1, __int_type __i2, memory_order __m = memory_order_seq_cst) volatile noexcept { return compare_exchange_strong(__i1, __i2, __m, __cmpexch_failure_order(__m)); } __int_type fetch_add(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { return __atomic_fetch_add(&_M_i, __i, __m); } __int_type fetch_add(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return __atomic_fetch_add(&_M_i, __i, __m); } __int_type fetch_sub(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { return __atomic_fetch_sub(&_M_i, __i, __m); } __int_type fetch_sub(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return __atomic_fetch_sub(&_M_i, __i, __m); } __int_type fetch_and(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { return __atomic_fetch_and(&_M_i, __i, __m); } __int_type fetch_and(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return __atomic_fetch_and(&_M_i, __i, __m); } __int_type fetch_or(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { return __atomic_fetch_or(&_M_i, __i, __m); } __int_type fetch_or(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return __atomic_fetch_or(&_M_i, __i, __m); } __int_type fetch_xor(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { return __atomic_fetch_xor(&_M_i, __i, __m); } __int_type fetch_xor(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { return __atomic_fetch_xor(&_M_i, __i, __m); } }; /// Partial specialization for pointer types. template<typename _PTp> struct __atomic_base<_PTp*> { private: typedef _PTp* __pointer_type; __pointer_type _M_p; // Factored out to facilitate explicit specialization. constexpr ptrdiff_t _M_type_size(ptrdiff_t __d) { return __d * sizeof(_PTp); } constexpr ptrdiff_t _M_type_size(ptrdiff_t __d) volatile { return __d * sizeof(_PTp); } public: __atomic_base() noexcept = default; ~__atomic_base() noexcept = default; __atomic_base(const __atomic_base&) = delete; __atomic_base& operator=(const __atomic_base&) = delete; __atomic_base& operator=(const __atomic_base&) volatile = delete; // Requires __pointer_type convertible to _M_p. constexpr __atomic_base(__pointer_type __p) noexcept : _M_p (__p) { } operator __pointer_type() const noexcept { return load(); } operator __pointer_type() const volatile noexcept { return load(); } __pointer_type operator=(__pointer_type __p) noexcept { store(__p); return __p; } __pointer_type operator=(__pointer_type __p) volatile noexcept { store(__p); return __p; } __pointer_type operator++(int) noexcept { return fetch_add(1); } __pointer_type operator++(int) volatile noexcept { return fetch_add(1); } __pointer_type operator--(int) noexcept { return fetch_sub(1); } __pointer_type operator--(int) volatile noexcept { return fetch_sub(1); } __pointer_type operator++() noexcept { return __atomic_add_fetch(&_M_p, _M_type_size(1), memory_order_seq_cst); } __pointer_type operator++() volatile noexcept { return __atomic_add_fetch(&_M_p, _M_type_size(1), memory_order_seq_cst); } __pointer_type operator--() noexcept { return __atomic_sub_fetch(&_M_p, _M_type_size(1), memory_order_seq_cst); } __pointer_type operator--() volatile noexcept { return __atomic_sub_fetch(&_M_p, _M_type_size(1), memory_order_seq_cst); } __pointer_type operator+=(ptrdiff_t __d) noexcept { return __atomic_add_fetch(&_M_p, _M_type_size(__d), memory_order_seq_cst); } __pointer_type operator+=(ptrdiff_t __d) volatile noexcept { return __atomic_add_fetch(&_M_p, _M_type_size(__d), memory_order_seq_cst); } __pointer_type operator-=(ptrdiff_t __d) noexcept { return __atomic_sub_fetch(&_M_p, _M_type_size(__d), memory_order_seq_cst); } __pointer_type operator-=(ptrdiff_t __d) volatile noexcept { return __atomic_sub_fetch(&_M_p, _M_type_size(__d), memory_order_seq_cst); } bool is_lock_free() const noexcept { return __atomic_is_lock_free(sizeof(__pointer_type), nullptr); } bool is_lock_free() const volatile noexcept { return __atomic_is_lock_free(sizeof(__pointer_type), nullptr); } void store(__pointer_type __p, memory_order __m = memory_order_seq_cst) noexcept { memory_order __b = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_acquire); __glibcxx_assert(__b != memory_order_acq_rel); __glibcxx_assert(__b != memory_order_consume); __atomic_store_n(&_M_p, __p, __m); } void store(__pointer_type __p, memory_order __m = memory_order_seq_cst) volatile noexcept { memory_order __b = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_acquire); __glibcxx_assert(__b != memory_order_acq_rel); __glibcxx_assert(__b != memory_order_consume); __atomic_store_n(&_M_p, __p, __m); } __pointer_type load(memory_order __m = memory_order_seq_cst) const noexcept { memory_order __b = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_release); __glibcxx_assert(__b != memory_order_acq_rel); return __atomic_load_n(&_M_p, __m); } __pointer_type load(memory_order __m = memory_order_seq_cst) const volatile noexcept { memory_order __b = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_release); __glibcxx_assert(__b != memory_order_acq_rel); return __atomic_load_n(&_M_p, __m); } __pointer_type exchange(__pointer_type __p, memory_order __m = memory_order_seq_cst) noexcept { return __atomic_exchange_n(&_M_p, __p, __m); } __pointer_type exchange(__pointer_type __p, memory_order __m = memory_order_seq_cst) volatile noexcept { return __atomic_exchange_n(&_M_p, __p, __m); } bool compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, memory_order __m1, memory_order __m2) noexcept { memory_order __b2 = __m2 & __memory_order_mask; memory_order __b1 = __m1 & __memory_order_mask; __glibcxx_assert(__b2 != memory_order_release); __glibcxx_assert(__b2 != memory_order_acq_rel); __glibcxx_assert(__b2 <= __b1); return __atomic_compare_exchange_n(&_M_p, &__p1, __p2, 0, __m1, __m2); } bool compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, memory_order __m1, memory_order __m2) volatile noexcept { memory_order __b2 = __m2 & __memory_order_mask; memory_order __b1 = __m1 & __memory_order_mask; __glibcxx_assert(__b2 != memory_order_release); __glibcxx_assert(__b2 != memory_order_acq_rel); __glibcxx_assert(__b2 <= __b1); return __atomic_compare_exchange_n(&_M_p, &__p1, __p2, 0, __m1, __m2); } __pointer_type fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) noexcept { return __atomic_fetch_add(&_M_p, _M_type_size(__d), __m); } __pointer_type fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile noexcept { return __atomic_fetch_add(&_M_p, _M_type_size(__d), __m); } __pointer_type fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) noexcept { return __atomic_fetch_sub(&_M_p, _M_type_size(__d), __m); } __pointer_type fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile noexcept { return __atomic_fetch_sub(&_M_p, _M_type_size(__d), __m); } }; // @} group atomics _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif �������c++/4.8.2/bits/cpp_type_traits.h��������������������������������������������������������������������0000644�����������������00000023075�14763166030�0012125 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// The -*- C++ -*- type traits classes for internal use in libstdc++ // Copyright (C) 2000-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/cpp_type_traits.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ext/type_traits} */ // Written by Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr> #ifndef _CPP_TYPE_TRAITS_H #define _CPP_TYPE_TRAITS_H 1 #pragma GCC system_header #include <bits/c++config.h> // // This file provides some compile-time information about various types. // These representations were designed, on purpose, to be constant-expressions // and not types as found in <bits/type_traits.h>. In particular, they // can be used in control structures and the optimizer hopefully will do // the obvious thing. // // Why integral expressions, and not functions nor types? // Firstly, these compile-time entities are used as template-arguments // so function return values won't work: We need compile-time entities. // We're left with types and constant integral expressions. // Secondly, from the point of view of ease of use, type-based compile-time // information is -not- *that* convenient. On has to write lots of // overloaded functions and to hope that the compiler will select the right // one. As a net effect, the overall structure isn't very clear at first // glance. // Thirdly, partial ordering and overload resolution (of function templates) // is highly costly in terms of compiler-resource. It is a Good Thing to // keep these resource consumption as least as possible. // // See valarray_array.h for a case use. // // -- Gaby (dosreis@cmla.ens-cachan.fr) 2000-03-06. // // Update 2005: types are also provided and <bits/type_traits.h> has been // removed. // // Forward declaration hack, should really include this from somewhere. namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Iterator, typename _Container> class __normal_iterator; _GLIBCXX_END_NAMESPACE_VERSION } // namespace namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION struct __true_type { }; struct __false_type { }; template<bool> struct __truth_type { typedef __false_type __type; }; template<> struct __truth_type<true> { typedef __true_type __type; }; // N.B. The conversions to bool are needed due to the issue // explained in c++/19404. template<class _Sp, class _Tp> struct __traitor { enum { __value = bool(_Sp::__value) || bool(_Tp::__value) }; typedef typename __truth_type<__value>::__type __type; }; // Compare for equality of types. template<typename, typename> struct __are_same { enum { __value = 0 }; typedef __false_type __type; }; template<typename _Tp> struct __are_same<_Tp, _Tp> { enum { __value = 1 }; typedef __true_type __type; }; // Holds if the template-argument is a void type. template<typename _Tp> struct __is_void { enum { __value = 0 }; typedef __false_type __type; }; template<> struct __is_void<void> { enum { __value = 1 }; typedef __true_type __type; }; // // Integer types // template<typename _Tp> struct __is_integer { enum { __value = 0 }; typedef __false_type __type; }; // Thirteen specializations (yes there are eleven standard integer // types; <em>long long</em> and <em>unsigned long long</em> are // supported as extensions) template<> struct __is_integer<bool> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<char> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<signed char> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<unsigned char> { enum { __value = 1 }; typedef __true_type __type; }; # ifdef _GLIBCXX_USE_WCHAR_T template<> struct __is_integer<wchar_t> { enum { __value = 1 }; typedef __true_type __type; }; # endif #if __cplusplus >= 201103L template<> struct __is_integer<char16_t> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<char32_t> { enum { __value = 1 }; typedef __true_type __type; }; #endif template<> struct __is_integer<short> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<unsigned short> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<int> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<unsigned int> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<long> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<unsigned long> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<long long> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_integer<unsigned long long> { enum { __value = 1 }; typedef __true_type __type; }; // // Floating point types // template<typename _Tp> struct __is_floating { enum { __value = 0 }; typedef __false_type __type; }; // three specializations (float, double and 'long double') template<> struct __is_floating<float> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_floating<double> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_floating<long double> { enum { __value = 1 }; typedef __true_type __type; }; // // Pointer types // template<typename _Tp> struct __is_pointer { enum { __value = 0 }; typedef __false_type __type; }; template<typename _Tp> struct __is_pointer<_Tp*> { enum { __value = 1 }; typedef __true_type __type; }; // // Normal iterator type // template<typename _Tp> struct __is_normal_iterator { enum { __value = 0 }; typedef __false_type __type; }; template<typename _Iterator, typename _Container> struct __is_normal_iterator< __gnu_cxx::__normal_iterator<_Iterator, _Container> > { enum { __value = 1 }; typedef __true_type __type; }; // // An arithmetic type is an integer type or a floating point type // template<typename _Tp> struct __is_arithmetic : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> > { }; // // A fundamental type is `void' or and arithmetic type // template<typename _Tp> struct __is_fundamental : public __traitor<__is_void<_Tp>, __is_arithmetic<_Tp> > { }; // // A scalar type is an arithmetic type or a pointer type // template<typename _Tp> struct __is_scalar : public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> > { }; // // For use in std::copy and std::find overloads for streambuf iterators. // template<typename _Tp> struct __is_char { enum { __value = 0 }; typedef __false_type __type; }; template<> struct __is_char<char> { enum { __value = 1 }; typedef __true_type __type; }; #ifdef _GLIBCXX_USE_WCHAR_T template<> struct __is_char<wchar_t> { enum { __value = 1 }; typedef __true_type __type; }; #endif template<typename _Tp> struct __is_byte { enum { __value = 0 }; typedef __false_type __type; }; template<> struct __is_byte<char> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_byte<signed char> { enum { __value = 1 }; typedef __true_type __type; }; template<> struct __is_byte<unsigned char> { enum { __value = 1 }; typedef __true_type __type; }; // // Move iterator type // template<typename _Tp> struct __is_move_iterator { enum { __value = 0 }; typedef __false_type __type; }; #if __cplusplus >= 201103L template<typename _Iterator> class move_iterator; template<typename _Iterator> struct __is_move_iterator< move_iterator<_Iterator> > { enum { __value = 1 }; typedef __true_type __type; }; #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif //_CPP_TYPE_TRAITS_H �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_bvector.h������������������������������������������������������������������������0000644�����������������00000071753�14763166030�0011250 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// vector<bool> specialization -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996-1999 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_bvector.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{vector} */ #ifndef _STL_BVECTOR_H #define _STL_BVECTOR_H 1 #if __cplusplus >= 201103L #include <initializer_list> #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typedef unsigned long _Bit_type; enum { _S_word_bit = int(__CHAR_BIT__ * sizeof(_Bit_type)) }; struct _Bit_reference { _Bit_type * _M_p; _Bit_type _M_mask; _Bit_reference(_Bit_type * __x, _Bit_type __y) : _M_p(__x), _M_mask(__y) { } _Bit_reference() _GLIBCXX_NOEXCEPT : _M_p(0), _M_mask(0) { } operator bool() const _GLIBCXX_NOEXCEPT { return !!(*_M_p & _M_mask); } _Bit_reference& operator=(bool __x) _GLIBCXX_NOEXCEPT { if (__x) *_M_p |= _M_mask; else *_M_p &= ~_M_mask; return *this; } _Bit_reference& operator=(const _Bit_reference& __x) _GLIBCXX_NOEXCEPT { return *this = bool(__x); } bool operator==(const _Bit_reference& __x) const { return bool(*this) == bool(__x); } bool operator<(const _Bit_reference& __x) const { return !bool(*this) && bool(__x); } void flip() _GLIBCXX_NOEXCEPT { *_M_p ^= _M_mask; } }; #if __cplusplus >= 201103L inline void swap(_Bit_reference __x, _Bit_reference __y) noexcept { bool __tmp = __x; __x = __y; __y = __tmp; } inline void swap(_Bit_reference __x, bool& __y) noexcept { bool __tmp = __x; __x = __y; __y = __tmp; } inline void swap(bool& __x, _Bit_reference __y) noexcept { bool __tmp = __x; __x = __y; __y = __tmp; } #endif struct _Bit_iterator_base : public std::iterator<std::random_access_iterator_tag, bool> { _Bit_type * _M_p; unsigned int _M_offset; _Bit_iterator_base(_Bit_type * __x, unsigned int __y) : _M_p(__x), _M_offset(__y) { } void _M_bump_up() { if (_M_offset++ == int(_S_word_bit) - 1) { _M_offset = 0; ++_M_p; } } void _M_bump_down() { if (_M_offset-- == 0) { _M_offset = int(_S_word_bit) - 1; --_M_p; } } void _M_incr(ptrdiff_t __i) { difference_type __n = __i + _M_offset; _M_p += __n / int(_S_word_bit); __n = __n % int(_S_word_bit); if (__n < 0) { __n += int(_S_word_bit); --_M_p; } _M_offset = static_cast<unsigned int>(__n); } bool operator==(const _Bit_iterator_base& __i) const { return _M_p == __i._M_p && _M_offset == __i._M_offset; } bool operator<(const _Bit_iterator_base& __i) const { return _M_p < __i._M_p || (_M_p == __i._M_p && _M_offset < __i._M_offset); } bool operator!=(const _Bit_iterator_base& __i) const { return !(*this == __i); } bool operator>(const _Bit_iterator_base& __i) const { return __i < *this; } bool operator<=(const _Bit_iterator_base& __i) const { return !(__i < *this); } bool operator>=(const _Bit_iterator_base& __i) const { return !(*this < __i); } }; inline ptrdiff_t operator-(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) { return (int(_S_word_bit) * (__x._M_p - __y._M_p) + __x._M_offset - __y._M_offset); } struct _Bit_iterator : public _Bit_iterator_base { typedef _Bit_reference reference; typedef _Bit_reference* pointer; typedef _Bit_iterator iterator; _Bit_iterator() : _Bit_iterator_base(0, 0) { } _Bit_iterator(_Bit_type * __x, unsigned int __y) : _Bit_iterator_base(__x, __y) { } reference operator*() const { return reference(_M_p, 1UL << _M_offset); } iterator& operator++() { _M_bump_up(); return *this; } iterator operator++(int) { iterator __tmp = *this; _M_bump_up(); return __tmp; } iterator& operator--() { _M_bump_down(); return *this; } iterator operator--(int) { iterator __tmp = *this; _M_bump_down(); return __tmp; } iterator& operator+=(difference_type __i) { _M_incr(__i); return *this; } iterator& operator-=(difference_type __i) { *this += -__i; return *this; } iterator operator+(difference_type __i) const { iterator __tmp = *this; return __tmp += __i; } iterator operator-(difference_type __i) const { iterator __tmp = *this; return __tmp -= __i; } reference operator[](difference_type __i) const { return *(*this + __i); } }; inline _Bit_iterator operator+(ptrdiff_t __n, const _Bit_iterator& __x) { return __x + __n; } struct _Bit_const_iterator : public _Bit_iterator_base { typedef bool reference; typedef bool const_reference; typedef const bool* pointer; typedef _Bit_const_iterator const_iterator; _Bit_const_iterator() : _Bit_iterator_base(0, 0) { } _Bit_const_iterator(_Bit_type * __x, unsigned int __y) : _Bit_iterator_base(__x, __y) { } _Bit_const_iterator(const _Bit_iterator& __x) : _Bit_iterator_base(__x._M_p, __x._M_offset) { } const_reference operator*() const { return _Bit_reference(_M_p, 1UL << _M_offset); } const_iterator& operator++() { _M_bump_up(); return *this; } const_iterator operator++(int) { const_iterator __tmp = *this; _M_bump_up(); return __tmp; } const_iterator& operator--() { _M_bump_down(); return *this; } const_iterator operator--(int) { const_iterator __tmp = *this; _M_bump_down(); return __tmp; } const_iterator& operator+=(difference_type __i) { _M_incr(__i); return *this; } const_iterator& operator-=(difference_type __i) { *this += -__i; return *this; } const_iterator operator+(difference_type __i) const { const_iterator __tmp = *this; return __tmp += __i; } const_iterator operator-(difference_type __i) const { const_iterator __tmp = *this; return __tmp -= __i; } const_reference operator[](difference_type __i) const { return *(*this + __i); } }; inline _Bit_const_iterator operator+(ptrdiff_t __n, const _Bit_const_iterator& __x) { return __x + __n; } inline void __fill_bvector(_Bit_iterator __first, _Bit_iterator __last, bool __x) { for (; __first != __last; ++__first) *__first = __x; } inline void fill(_Bit_iterator __first, _Bit_iterator __last, const bool& __x) { if (__first._M_p != __last._M_p) { std::fill(__first._M_p + 1, __last._M_p, __x ? ~0 : 0); __fill_bvector(__first, _Bit_iterator(__first._M_p + 1, 0), __x); __fill_bvector(_Bit_iterator(__last._M_p, 0), __last, __x); } else __fill_bvector(__first, __last, __x); } template<typename _Alloc> struct _Bvector_base { typedef typename _Alloc::template rebind<_Bit_type>::other _Bit_alloc_type; struct _Bvector_impl : public _Bit_alloc_type { _Bit_iterator _M_start; _Bit_iterator _M_finish; _Bit_type* _M_end_of_storage; _Bvector_impl() : _Bit_alloc_type(), _M_start(), _M_finish(), _M_end_of_storage(0) { } _Bvector_impl(const _Bit_alloc_type& __a) : _Bit_alloc_type(__a), _M_start(), _M_finish(), _M_end_of_storage(0) { } #if __cplusplus >= 201103L _Bvector_impl(_Bit_alloc_type&& __a) : _Bit_alloc_type(std::move(__a)), _M_start(), _M_finish(), _M_end_of_storage(0) { } #endif }; public: typedef _Alloc allocator_type; _Bit_alloc_type& _M_get_Bit_allocator() _GLIBCXX_NOEXCEPT { return *static_cast<_Bit_alloc_type*>(&this->_M_impl); } const _Bit_alloc_type& _M_get_Bit_allocator() const _GLIBCXX_NOEXCEPT { return *static_cast<const _Bit_alloc_type*>(&this->_M_impl); } allocator_type get_allocator() const _GLIBCXX_NOEXCEPT { return allocator_type(_M_get_Bit_allocator()); } _Bvector_base() : _M_impl() { } _Bvector_base(const allocator_type& __a) : _M_impl(__a) { } #if __cplusplus >= 201103L _Bvector_base(_Bvector_base&& __x) noexcept : _M_impl(std::move(__x._M_get_Bit_allocator())) { this->_M_impl._M_start = __x._M_impl._M_start; this->_M_impl._M_finish = __x._M_impl._M_finish; this->_M_impl._M_end_of_storage = __x._M_impl._M_end_of_storage; __x._M_impl._M_start = _Bit_iterator(); __x._M_impl._M_finish = _Bit_iterator(); __x._M_impl._M_end_of_storage = 0; } #endif ~_Bvector_base() { this->_M_deallocate(); } protected: _Bvector_impl _M_impl; _Bit_type* _M_allocate(size_t __n) { return _M_impl.allocate(_S_nword(__n)); } void _M_deallocate() { if (_M_impl._M_start._M_p) _M_impl.deallocate(_M_impl._M_start._M_p, _M_impl._M_end_of_storage - _M_impl._M_start._M_p); } static size_t _S_nword(size_t __n) { return (__n + int(_S_word_bit) - 1) / int(_S_word_bit); } }; _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std // Declare a partial specialization of vector<T, Alloc>. #include <bits/stl_vector.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /** * @brief A specialization of vector for booleans which offers fixed time * access to individual elements in any order. * * @ingroup sequences * * @tparam _Alloc Allocator type. * * Note that vector<bool> does not actually meet the requirements for being * a container. This is because the reference and pointer types are not * really references and pointers to bool. See DR96 for details. @see * vector for function documentation. * * In some terminology a %vector can be described as a dynamic * C-style array, it offers fast and efficient access to individual * elements in any order and saves the user from worrying about * memory and size allocation. Subscripting ( @c [] ) access is * also provided as with C-style arrays. */ template<typename _Alloc> class vector<bool, _Alloc> : protected _Bvector_base<_Alloc> { typedef _Bvector_base<_Alloc> _Base; #if __cplusplus >= 201103L template<typename> friend struct hash; #endif public: typedef bool value_type; typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Bit_reference reference; typedef bool const_reference; typedef _Bit_reference* pointer; typedef const bool* const_pointer; typedef _Bit_iterator iterator; typedef _Bit_const_iterator const_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<iterator> reverse_iterator; typedef _Alloc allocator_type; allocator_type get_allocator() const { return _Base::get_allocator(); } protected: using _Base::_M_allocate; using _Base::_M_deallocate; using _Base::_S_nword; using _Base::_M_get_Bit_allocator; public: vector() : _Base() { } explicit vector(const allocator_type& __a) : _Base(__a) { } #if __cplusplus >= 201103L explicit vector(size_type __n, const allocator_type& __a = allocator_type()) : vector(__n, false, __a) { } vector(size_type __n, const bool& __value, const allocator_type& __a = allocator_type()) : _Base(__a) { _M_initialize(__n); std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_of_storage, __value ? ~0 : 0); } #else explicit vector(size_type __n, const bool& __value = bool(), const allocator_type& __a = allocator_type()) : _Base(__a) { _M_initialize(__n); std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_of_storage, __value ? ~0 : 0); } #endif vector(const vector& __x) : _Base(__x._M_get_Bit_allocator()) { _M_initialize(__x.size()); _M_copy_aligned(__x.begin(), __x.end(), this->_M_impl._M_start); } #if __cplusplus >= 201103L vector(vector&& __x) noexcept : _Base(std::move(__x)) { } vector(initializer_list<bool> __l, const allocator_type& __a = allocator_type()) : _Base(__a) { _M_initialize_range(__l.begin(), __l.end(), random_access_iterator_tag()); } #endif #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a = allocator_type()) : _Base(__a) { _M_initialize_dispatch(__first, __last, __false_type()); } #else template<typename _InputIterator> vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a = allocator_type()) : _Base(__a) { typedef typename std::__is_integer<_InputIterator>::__type _Integral; _M_initialize_dispatch(__first, __last, _Integral()); } #endif ~vector() _GLIBCXX_NOEXCEPT { } vector& operator=(const vector& __x) { if (&__x == this) return *this; if (__x.size() > capacity()) { this->_M_deallocate(); _M_initialize(__x.size()); } this->_M_impl._M_finish = _M_copy_aligned(__x.begin(), __x.end(), begin()); return *this; } #if __cplusplus >= 201103L vector& operator=(vector&& __x) { // NB: DR 1204. // NB: DR 675. this->clear(); this->swap(__x); return *this; } vector& operator=(initializer_list<bool> __l) { this->assign (__l.begin(), __l.end()); return *this; } #endif // assign(), a generalized assignment member function. Two // versions: one that takes a count, and one that takes a range. // The range version is a member template, so we dispatch on whether // or not the type is an integer. void assign(size_type __n, const bool& __x) { _M_fill_assign(__n, __x); } #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> void assign(_InputIterator __first, _InputIterator __last) { _M_assign_dispatch(__first, __last, __false_type()); } #else template<typename _InputIterator> void assign(_InputIterator __first, _InputIterator __last) { typedef typename std::__is_integer<_InputIterator>::__type _Integral; _M_assign_dispatch(__first, __last, _Integral()); } #endif #if __cplusplus >= 201103L void assign(initializer_list<bool> __l) { this->assign(__l.begin(), __l.end()); } #endif iterator begin() _GLIBCXX_NOEXCEPT { return this->_M_impl._M_start; } const_iterator begin() const _GLIBCXX_NOEXCEPT { return this->_M_impl._M_start; } iterator end() _GLIBCXX_NOEXCEPT { return this->_M_impl._M_finish; } const_iterator end() const _GLIBCXX_NOEXCEPT { return this->_M_impl._M_finish; } reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(end()); } const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(end()); } reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(begin()); } const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(begin()); } #if __cplusplus >= 201103L const_iterator cbegin() const noexcept { return this->_M_impl._M_start; } const_iterator cend() const noexcept { return this->_M_impl._M_finish; } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } #endif size_type size() const _GLIBCXX_NOEXCEPT { return size_type(end() - begin()); } size_type max_size() const _GLIBCXX_NOEXCEPT { const size_type __isize = __gnu_cxx::__numeric_traits<difference_type>::__max - int(_S_word_bit) + 1; const size_type __asize = _M_get_Bit_allocator().max_size(); return (__asize <= __isize / int(_S_word_bit) ? __asize * int(_S_word_bit) : __isize); } size_type capacity() const _GLIBCXX_NOEXCEPT { return size_type(const_iterator(this->_M_impl._M_end_of_storage, 0) - begin()); } bool empty() const _GLIBCXX_NOEXCEPT { return begin() == end(); } reference operator[](size_type __n) { return *iterator(this->_M_impl._M_start._M_p + __n / int(_S_word_bit), __n % int(_S_word_bit)); } const_reference operator[](size_type __n) const { return *const_iterator(this->_M_impl._M_start._M_p + __n / int(_S_word_bit), __n % int(_S_word_bit)); } protected: void _M_range_check(size_type __n) const { if (__n >= this->size()) __throw_out_of_range(__N("vector<bool>::_M_range_check")); } public: reference at(size_type __n) { _M_range_check(__n); return (*this)[__n]; } const_reference at(size_type __n) const { _M_range_check(__n); return (*this)[__n]; } void reserve(size_type __n) { if (__n > max_size()) __throw_length_error(__N("vector::reserve")); if (capacity() < __n) _M_reallocate(__n); } reference front() { return *begin(); } const_reference front() const { return *begin(); } reference back() { return *(end() - 1); } const_reference back() const { return *(end() - 1); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 464. Suggestion for new member functions in standard containers. // N.B. DR 464 says nothing about vector<bool> but we need something // here due to the way we are implementing DR 464 in the debug-mode // vector class. void data() _GLIBCXX_NOEXCEPT { } void push_back(bool __x) { if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage) *this->_M_impl._M_finish++ = __x; else _M_insert_aux(end(), __x); } void swap(vector& __x) { std::swap(this->_M_impl._M_start, __x._M_impl._M_start); std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish); std::swap(this->_M_impl._M_end_of_storage, __x._M_impl._M_end_of_storage); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 431. Swapping containers with unequal allocators. std::__alloc_swap<typename _Base::_Bit_alloc_type>:: _S_do_it(_M_get_Bit_allocator(), __x._M_get_Bit_allocator()); } // [23.2.5]/1, third-to-last entry in synopsis listing static void swap(reference __x, reference __y) _GLIBCXX_NOEXCEPT { bool __tmp = __x; __x = __y; __y = __tmp; } iterator insert(iterator __position, const bool& __x = bool()) { const difference_type __n = __position - begin(); if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage && __position == end()) *this->_M_impl._M_finish++ = __x; else _M_insert_aux(__position, __x); return begin() + __n; } #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> void insert(iterator __position, _InputIterator __first, _InputIterator __last) { _M_insert_dispatch(__position, __first, __last, __false_type()); } #else template<typename _InputIterator> void insert(iterator __position, _InputIterator __first, _InputIterator __last) { typedef typename std::__is_integer<_InputIterator>::__type _Integral; _M_insert_dispatch(__position, __first, __last, _Integral()); } #endif void insert(iterator __position, size_type __n, const bool& __x) { _M_fill_insert(__position, __n, __x); } #if __cplusplus >= 201103L void insert(iterator __p, initializer_list<bool> __l) { this->insert(__p, __l.begin(), __l.end()); } #endif void pop_back() { --this->_M_impl._M_finish; } iterator erase(iterator __position) { if (__position + 1 != end()) std::copy(__position + 1, end(), __position); --this->_M_impl._M_finish; return __position; } iterator erase(iterator __first, iterator __last) { if (__first != __last) _M_erase_at_end(std::copy(__last, end(), __first)); return __first; } void resize(size_type __new_size, bool __x = bool()) { if (__new_size < size()) _M_erase_at_end(begin() + difference_type(__new_size)); else insert(end(), __new_size - size(), __x); } #if __cplusplus >= 201103L void shrink_to_fit() { _M_shrink_to_fit(); } #endif void flip() _GLIBCXX_NOEXCEPT { for (_Bit_type * __p = this->_M_impl._M_start._M_p; __p != this->_M_impl._M_end_of_storage; ++__p) *__p = ~*__p; } void clear() _GLIBCXX_NOEXCEPT { _M_erase_at_end(begin()); } protected: // Precondition: __first._M_offset == 0 && __result._M_offset == 0. iterator _M_copy_aligned(const_iterator __first, const_iterator __last, iterator __result) { _Bit_type* __q = std::copy(__first._M_p, __last._M_p, __result._M_p); return std::copy(const_iterator(__last._M_p, 0), __last, iterator(__q, 0)); } void _M_initialize(size_type __n) { _Bit_type* __q = this->_M_allocate(__n); this->_M_impl._M_end_of_storage = __q + _S_nword(__n); this->_M_impl._M_start = iterator(__q, 0); this->_M_impl._M_finish = this->_M_impl._M_start + difference_type(__n); } void _M_reallocate(size_type __n); #if __cplusplus >= 201103L bool _M_shrink_to_fit(); #endif // Check whether it's an integral type. If so, it's not an iterator. // _GLIBCXX_RESOLVE_LIB_DEFECTS // 438. Ambiguity in the "do the right thing" clause template<typename _Integer> void _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) { _M_initialize(static_cast<size_type>(__n)); std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_of_storage, __x ? ~0 : 0); } template<typename _InputIterator> void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, __false_type) { _M_initialize_range(__first, __last, std::__iterator_category(__first)); } template<typename _InputIterator> void _M_initialize_range(_InputIterator __first, _InputIterator __last, std::input_iterator_tag) { for (; __first != __last; ++__first) push_back(*__first); } template<typename _ForwardIterator> void _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag) { const size_type __n = std::distance(__first, __last); _M_initialize(__n); std::copy(__first, __last, this->_M_impl._M_start); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 438. Ambiguity in the "do the right thing" clause template<typename _Integer> void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) { _M_fill_assign(__n, __val); } template<class _InputIterator> void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, __false_type) { _M_assign_aux(__first, __last, std::__iterator_category(__first)); } void _M_fill_assign(size_t __n, bool __x) { if (__n > size()) { std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_of_storage, __x ? ~0 : 0); insert(end(), __n - size(), __x); } else { _M_erase_at_end(begin() + __n); std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_of_storage, __x ? ~0 : 0); } } template<typename _InputIterator> void _M_assign_aux(_InputIterator __first, _InputIterator __last, std::input_iterator_tag) { iterator __cur = begin(); for (; __first != __last && __cur != end(); ++__cur, ++__first) *__cur = *__first; if (__first == __last) _M_erase_at_end(__cur); else insert(end(), __first, __last); } template<typename _ForwardIterator> void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag) { const size_type __len = std::distance(__first, __last); if (__len < size()) _M_erase_at_end(std::copy(__first, __last, begin())); else { _ForwardIterator __mid = __first; std::advance(__mid, size()); std::copy(__first, __mid, begin()); insert(end(), __mid, __last); } } // Check whether it's an integral type. If so, it's not an iterator. // _GLIBCXX_RESOLVE_LIB_DEFECTS // 438. Ambiguity in the "do the right thing" clause template<typename _Integer> void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, __true_type) { _M_fill_insert(__pos, __n, __x); } template<typename _InputIterator> void _M_insert_dispatch(iterator __pos, _InputIterator __first, _InputIterator __last, __false_type) { _M_insert_range(__pos, __first, __last, std::__iterator_category(__first)); } void _M_fill_insert(iterator __position, size_type __n, bool __x); template<typename _InputIterator> void _M_insert_range(iterator __pos, _InputIterator __first, _InputIterator __last, std::input_iterator_tag) { for (; __first != __last; ++__first) { __pos = insert(__pos, *__first); ++__pos; } } template<typename _ForwardIterator> void _M_insert_range(iterator __position, _ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag); void _M_insert_aux(iterator __position, bool __x); size_type _M_check_len(size_type __n, const char* __s) const { if (max_size() - size() < __n) __throw_length_error(__N(__s)); const size_type __len = size() + std::max(size(), __n); return (__len < size() || __len > max_size()) ? max_size() : __len; } void _M_erase_at_end(iterator __pos) { this->_M_impl._M_finish = __pos; } }; _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std #if __cplusplus >= 201103L #include <bits/functional_hash.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // DR 1182. /// std::hash specialization for vector<bool>. template<typename _Alloc> struct hash<_GLIBCXX_STD_C::vector<bool, _Alloc>> : public __hash_base<size_t, _GLIBCXX_STD_C::vector<bool, _Alloc>> { size_t operator()(const _GLIBCXX_STD_C::vector<bool, _Alloc>&) const noexcept; }; _GLIBCXX_END_NAMESPACE_VERSION }// namespace std #endif // C++11 #endif ���������������������c++/4.8.2/bits/unordered_set.h����������������������������������������������������������������������0000644�����������������00000126404�14763166030�0011556 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// unordered_set implementation -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/unordered_set.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{unordered_set} */ #ifndef _UNORDERED_SET_H #define _UNORDERED_SET_H namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /// Base types for unordered_set. template<bool _Cache> using __uset_traits = __detail::_Hashtable_traits<_Cache, true, true>; template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = std::equal_to<_Value>, typename _Alloc = std::allocator<_Value>, typename _Tr = __uset_traits<__cache_default<_Value, _Hash>::value>> using __uset_hashtable = _Hashtable<_Value, _Value, _Alloc, __detail::_Identity, _Pred, _Hash, __detail::_Mod_range_hashing, __detail::_Default_ranged_hash, __detail::_Prime_rehash_policy, _Tr>; /// Base types for unordered_multiset. template<bool _Cache> using __umset_traits = __detail::_Hashtable_traits<_Cache, true, false>; template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = std::equal_to<_Value>, typename _Alloc = std::allocator<_Value>, typename _Tr = __umset_traits<__cache_default<_Value, _Hash>::value>> using __umset_hashtable = _Hashtable<_Value, _Value, _Alloc, __detail::_Identity, _Pred, _Hash, __detail::_Mod_range_hashing, __detail::_Default_ranged_hash, __detail::_Prime_rehash_policy, _Tr>; /** * @brief A standard container composed of unique keys (containing * at most one of each key value) in which the elements' keys are * the elements themselves. * * @ingroup unordered_associative_containers * * @tparam _Value Type of key objects. * @tparam _Hash Hashing function object type, defaults to hash<_Value>. * @tparam _Pred Predicate function object type, defaults to * equal_to<_Value>. * * @tparam _Alloc Allocator type, defaults to allocator<_Key>. * * Meets the requirements of a <a href="tables.html#65">container</a>, and * <a href="tables.html#xx">unordered associative container</a> * * Base is _Hashtable, dispatched at compile time via template * alias __uset_hashtable. */ template<class _Value, class _Hash = hash<_Value>, class _Pred = std::equal_to<_Value>, class _Alloc = std::allocator<_Value> > class unordered_set : __check_copy_constructible<_Alloc> { typedef __uset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable; _Hashtable _M_h; public: // typedefs: //@{ /// Public typedefs. typedef typename _Hashtable::key_type key_type; typedef typename _Hashtable::value_type value_type; typedef typename _Hashtable::hasher hasher; typedef typename _Hashtable::key_equal key_equal; typedef typename _Hashtable::allocator_type allocator_type; //@} //@{ /// Iterator-related typedefs. typedef typename allocator_type::pointer pointer; typedef typename allocator_type::const_pointer const_pointer; typedef typename allocator_type::reference reference; typedef typename allocator_type::const_reference const_reference; typedef typename _Hashtable::iterator iterator; typedef typename _Hashtable::const_iterator const_iterator; typedef typename _Hashtable::local_iterator local_iterator; typedef typename _Hashtable::const_local_iterator const_local_iterator; typedef typename _Hashtable::size_type size_type; typedef typename _Hashtable::difference_type difference_type; //@} // construct/destroy/copy /** * @brief Default constructor creates no elements. * @param __n Initial number of buckets. * @param __hf A hash functor. * @param __eql A key equality functor. * @param __a An allocator object. */ explicit unordered_set(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _M_h(__n, __hf, __eql, __a) { } /** * @brief Builds an %unordered_set from a range. * @param __first An input iterator. * @param __last An input iterator. * @param __n Minimal initial number of buckets. * @param __hf A hash functor. * @param __eql A key equality functor. * @param __a An allocator object. * * Create an %unordered_set consisting of copies of the elements from * [__first,__last). This is linear in N (where N is * distance(__first,__last)). */ template<typename _InputIterator> unordered_set(_InputIterator __f, _InputIterator __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _M_h(__f, __l, __n, __hf, __eql, __a) { } /// Copy constructor. unordered_set(const unordered_set&) = default; /// Move constructor. unordered_set(unordered_set&&) = default; /** * @brief Builds an %unordered_set from an initializer_list. * @param __l An initializer_list. * @param __n Minimal initial number of buckets. * @param __hf A hash functor. * @param __eql A key equality functor. * @param __a An allocator object. * * Create an %unordered_set consisting of copies of the elements in the * list. This is linear in N (where N is @a __l.size()). */ unordered_set(initializer_list<value_type> __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _M_h(__l, __n, __hf, __eql, __a) { } /// Copy assignment operator. unordered_set& operator=(const unordered_set&) = default; /// Move assignment operator. unordered_set& operator=(unordered_set&&) = default; /** * @brief %Unordered_set list assignment operator. * @param __l An initializer_list. * * This function fills an %unordered_set with copies of the elements in * the initializer list @a __l. * * Note that the assignment completely changes the %unordered_set and * that the resulting %unordered_set's size is the same as the number * of elements assigned. Old data may be lost. */ unordered_set& operator=(initializer_list<value_type> __l) { _M_h = __l; return *this; } /// Returns the allocator object with which the %unordered_set was /// constructed. allocator_type get_allocator() const noexcept { return _M_h.get_allocator(); } // size and capacity: /// Returns true if the %unordered_set is empty. bool empty() const noexcept { return _M_h.empty(); } /// Returns the size of the %unordered_set. size_type size() const noexcept { return _M_h.size(); } /// Returns the maximum size of the %unordered_set. size_type max_size() const noexcept { return _M_h.max_size(); } // iterators. //@{ /** * Returns a read-only (constant) iterator that points to the first * element in the %unordered_set. */ iterator begin() noexcept { return _M_h.begin(); } const_iterator begin() const noexcept { return _M_h.begin(); } //@} //@{ /** * Returns a read-only (constant) iterator that points one past the last * element in the %unordered_set. */ iterator end() noexcept { return _M_h.end(); } const_iterator end() const noexcept { return _M_h.end(); } //@} /** * Returns a read-only (constant) iterator that points to the first * element in the %unordered_set. */ const_iterator cbegin() const noexcept { return _M_h.begin(); } /** * Returns a read-only (constant) iterator that points one past the last * element in the %unordered_set. */ const_iterator cend() const noexcept { return _M_h.end(); } // modifiers. /** * @brief Attempts to build and insert an element into the * %unordered_set. * @param __args Arguments used to generate an element. * @return A pair, of which the first element is an iterator that points * to the possibly inserted element, and the second is a bool * that is true if the element was actually inserted. * * This function attempts to build and insert an element into the * %unordered_set. An %unordered_set relies on unique keys and thus an * element is only inserted if it is not already present in the * %unordered_set. * * Insertion requires amortized constant time. */ template<typename... _Args> std::pair<iterator, bool> emplace(_Args&&... __args) { return _M_h.emplace(std::forward<_Args>(__args)...); } /** * @brief Attempts to insert an element into the %unordered_set. * @param __pos An iterator that serves as a hint as to where the * element should be inserted. * @param __args Arguments used to generate the element to be * inserted. * @return An iterator that points to the element with key equivalent to * the one generated from @a __args (may or may not be the * element itself). * * This function is not concerned about whether the insertion took place, * and thus does not return a boolean like the single-argument emplace() * does. Note that the first parameter is only a hint and can * potentially improve the performance of the insertion process. A bad * hint would cause no gains in efficiency. * * For more on @a hinting, see: * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html * * Insertion requires amortized constant time. */ template<typename... _Args> iterator emplace_hint(const_iterator __pos, _Args&&... __args) { return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); } //@{ /** * @brief Attempts to insert an element into the %unordered_set. * @param __x Element to be inserted. * @return A pair, of which the first element is an iterator that points * to the possibly inserted element, and the second is a bool * that is true if the element was actually inserted. * * This function attempts to insert an element into the %unordered_set. * An %unordered_set relies on unique keys and thus an element is only * inserted if it is not already present in the %unordered_set. * * Insertion requires amortized constant time. */ std::pair<iterator, bool> insert(const value_type& __x) { return _M_h.insert(__x); } std::pair<iterator, bool> insert(value_type&& __x) { return _M_h.insert(std::move(__x)); } //@} //@{ /** * @brief Attempts to insert an element into the %unordered_set. * @param __hint An iterator that serves as a hint as to where the * element should be inserted. * @param __x Element to be inserted. * @return An iterator that points to the element with key of * @a __x (may or may not be the element passed in). * * This function is not concerned about whether the insertion took place, * and thus does not return a boolean like the single-argument insert() * does. Note that the first parameter is only a hint and can * potentially improve the performance of the insertion process. A bad * hint would cause no gains in efficiency. * * For more on @a hinting, see: * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html * * Insertion requires amortized constant. */ iterator insert(const_iterator __hint, const value_type& __x) { return _M_h.insert(__hint, __x); } iterator insert(const_iterator __hint, value_type&& __x) { return _M_h.insert(__hint, std::move(__x)); } //@} /** * @brief A template function that attempts to insert a range of * elements. * @param __first Iterator pointing to the start of the range to be * inserted. * @param __last Iterator pointing to the end of the range. * * Complexity similar to that of the range constructor. */ template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) { _M_h.insert(__first, __last); } /** * @brief Attempts to insert a list of elements into the %unordered_set. * @param __l A std::initializer_list<value_type> of elements * to be inserted. * * Complexity similar to that of the range constructor. */ void insert(initializer_list<value_type> __l) { _M_h.insert(__l); } //@{ /** * @brief Erases an element from an %unordered_set. * @param __position An iterator pointing to the element to be erased. * @return An iterator pointing to the element immediately following * @a __position prior to the element being erased. If no such * element exists, end() is returned. * * This function erases an element, pointed to by the given iterator, * from an %unordered_set. Note that this function only erases the * element, and that if the element is itself a pointer, the pointed-to * memory is not touched in any way. Managing the pointer is the user's * responsibility. */ iterator erase(const_iterator __position) { return _M_h.erase(__position); } // LWG 2059. iterator erase(iterator __it) { return _M_h.erase(__it); } //@} /** * @brief Erases elements according to the provided key. * @param __x Key of element to be erased. * @return The number of elements erased. * * This function erases all the elements located by the given key from * an %unordered_set. For an %unordered_set the result of this function * can only be 0 (not present) or 1 (present). * Note that this function only erases the element, and that if * the element is itself a pointer, the pointed-to memory is not touched * in any way. Managing the pointer is the user's responsibility. */ size_type erase(const key_type& __x) { return _M_h.erase(__x); } /** * @brief Erases a [__first,__last) range of elements from an * %unordered_set. * @param __first Iterator pointing to the start of the range to be * erased. * @param __last Iterator pointing to the end of the range to * be erased. * @return The iterator @a __last. * * This function erases a sequence of elements from an %unordered_set. * Note that this function only erases the element, and that if * the element is itself a pointer, the pointed-to memory is not touched * in any way. Managing the pointer is the user's responsibility. */ iterator erase(const_iterator __first, const_iterator __last) { return _M_h.erase(__first, __last); } /** * Erases all elements in an %unordered_set. Note that this function only * erases the elements, and that if the elements themselves are pointers, * the pointed-to memory is not touched in any way. Managing the pointer * is the user's responsibility. */ void clear() noexcept { _M_h.clear(); } /** * @brief Swaps data with another %unordered_set. * @param __x An %unordered_set of the same element and allocator * types. * * This exchanges the elements between two sets in constant time. * Note that the global std::swap() function is specialized such that * std::swap(s1,s2) will feed to this function. */ void swap(unordered_set& __x) { _M_h.swap(__x._M_h); } // observers. /// Returns the hash functor object with which the %unordered_set was /// constructed. hasher hash_function() const { return _M_h.hash_function(); } /// Returns the key comparison object with which the %unordered_set was /// constructed. key_equal key_eq() const { return _M_h.key_eq(); } // lookup. //@{ /** * @brief Tries to locate an element in an %unordered_set. * @param __x Element to be located. * @return Iterator pointing to sought-after element, or end() if not * found. * * This function takes a key and tries to locate the element with which * the key matches. If successful the function returns an iterator * pointing to the sought after element. If unsuccessful it returns the * past-the-end ( @c end() ) iterator. */ iterator find(const key_type& __x) { return _M_h.find(__x); } const_iterator find(const key_type& __x) const { return _M_h.find(__x); } //@} /** * @brief Finds the number of elements. * @param __x Element to located. * @return Number of elements with specified key. * * This function only makes sense for unordered_multisets; for * unordered_set the result will either be 0 (not present) or 1 * (present). */ size_type count(const key_type& __x) const { return _M_h.count(__x); } //@{ /** * @brief Finds a subsequence matching given key. * @param __x Key to be located. * @return Pair of iterators that possibly points to the subsequence * matching given key. * * This function probably only makes sense for multisets. */ std::pair<iterator, iterator> equal_range(const key_type& __x) { return _M_h.equal_range(__x); } std::pair<const_iterator, const_iterator> equal_range(const key_type& __x) const { return _M_h.equal_range(__x); } //@} // bucket interface. /// Returns the number of buckets of the %unordered_set. size_type bucket_count() const noexcept { return _M_h.bucket_count(); } /// Returns the maximum number of buckets of the %unordered_set. size_type max_bucket_count() const noexcept { return _M_h.max_bucket_count(); } /* * @brief Returns the number of elements in a given bucket. * @param __n A bucket index. * @return The number of elements in the bucket. */ size_type bucket_size(size_type __n) const { return _M_h.bucket_size(__n); } /* * @brief Returns the bucket index of a given element. * @param __key A key instance. * @return The key bucket index. */ size_type bucket(const key_type& __key) const { return _M_h.bucket(__key); } //@{ /** * @brief Returns a read-only (constant) iterator pointing to the first * bucket element. * @param __n The bucket index. * @return A read-only local iterator. */ local_iterator begin(size_type __n) { return _M_h.begin(__n); } const_local_iterator begin(size_type __n) const { return _M_h.begin(__n); } const_local_iterator cbegin(size_type __n) const { return _M_h.cbegin(__n); } //@} //@{ /** * @brief Returns a read-only (constant) iterator pointing to one past * the last bucket elements. * @param __n The bucket index. * @return A read-only local iterator. */ local_iterator end(size_type __n) { return _M_h.end(__n); } const_local_iterator end(size_type __n) const { return _M_h.end(__n); } const_local_iterator cend(size_type __n) const { return _M_h.cend(__n); } //@} // hash policy. /// Returns the average number of elements per bucket. float load_factor() const noexcept { return _M_h.load_factor(); } /// Returns a positive number that the %unordered_set tries to keep the /// load factor less than or equal to. float max_load_factor() const noexcept { return _M_h.max_load_factor(); } /** * @brief Change the %unordered_set maximum load factor. * @param __z The new maximum load factor. */ void max_load_factor(float __z) { _M_h.max_load_factor(__z); } /** * @brief May rehash the %unordered_set. * @param __n The new number of buckets. * * Rehash will occur only if the new number of buckets respect the * %unordered_set maximum load factor. */ void rehash(size_type __n) { _M_h.rehash(__n); } /** * @brief Prepare the %unordered_set for a specified number of * elements. * @param __n Number of elements required. * * Same as rehash(ceil(n / max_load_factor())). */ void reserve(size_type __n) { _M_h.reserve(__n); } template<typename _Value1, typename _Hash1, typename _Pred1, typename _Alloc1> friend bool operator==(const unordered_set<_Value1, _Hash1, _Pred1, _Alloc1>&, const unordered_set<_Value1, _Hash1, _Pred1, _Alloc1>&); }; /** * @brief A standard container composed of equivalent keys * (possibly containing multiple of each key value) in which the * elements' keys are the elements themselves. * * @ingroup unordered_associative_containers * * @tparam _Value Type of key objects. * @tparam _Hash Hashing function object type, defaults to hash<_Value>. * @tparam _Pred Predicate function object type, defaults * to equal_to<_Value>. * @tparam _Alloc Allocator type, defaults to allocator<_Key>. * * Meets the requirements of a <a href="tables.html#65">container</a>, and * <a href="tables.html#xx">unordered associative container</a> * * Base is _Hashtable, dispatched at compile time via template * alias __umset_hashtable. */ template<class _Value, class _Hash = hash<_Value>, class _Pred = std::equal_to<_Value>, class _Alloc = std::allocator<_Value> > class unordered_multiset : __check_copy_constructible<_Alloc> { typedef __umset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable; _Hashtable _M_h; public: // typedefs: //@{ /// Public typedefs. typedef typename _Hashtable::key_type key_type; typedef typename _Hashtable::value_type value_type; typedef typename _Hashtable::hasher hasher; typedef typename _Hashtable::key_equal key_equal; typedef typename _Hashtable::allocator_type allocator_type; //@} //@{ /// Iterator-related typedefs. typedef typename allocator_type::pointer pointer; typedef typename allocator_type::const_pointer const_pointer; typedef typename allocator_type::reference reference; typedef typename allocator_type::const_reference const_reference; typedef typename _Hashtable::iterator iterator; typedef typename _Hashtable::const_iterator const_iterator; typedef typename _Hashtable::local_iterator local_iterator; typedef typename _Hashtable::const_local_iterator const_local_iterator; typedef typename _Hashtable::size_type size_type; typedef typename _Hashtable::difference_type difference_type; //@} // construct/destroy/copy /** * @brief Default constructor creates no elements. * @param __n Initial number of buckets. * @param __hf A hash functor. * @param __eql A key equality functor. * @param __a An allocator object. */ explicit unordered_multiset(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _M_h(__n, __hf, __eql, __a) { } /** * @brief Builds an %unordered_multiset from a range. * @param __first An input iterator. * @param __last An input iterator. * @param __n Minimal initial number of buckets. * @param __hf A hash functor. * @param __eql A key equality functor. * @param __a An allocator object. * * Create an %unordered_multiset consisting of copies of the elements * from [__first,__last). This is linear in N (where N is * distance(__first,__last)). */ template<typename _InputIterator> unordered_multiset(_InputIterator __f, _InputIterator __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _M_h(__f, __l, __n, __hf, __eql, __a) { } /// Copy constructor. unordered_multiset(const unordered_multiset&) = default; /// Move constructor. unordered_multiset(unordered_multiset&&) = default; /** * @brief Builds an %unordered_multiset from an initializer_list. * @param __l An initializer_list. * @param __n Minimal initial number of buckets. * @param __hf A hash functor. * @param __eql A key equality functor. * @param __a An allocator object. * * Create an %unordered_multiset consisting of copies of the elements in * the list. This is linear in N (where N is @a __l.size()). */ unordered_multiset(initializer_list<value_type> __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _M_h(__l, __n, __hf, __eql, __a) { } /// Copy assignment operator. unordered_multiset& operator=(const unordered_multiset&) = default; /// Move assignment operator. unordered_multiset& operator=(unordered_multiset&& __x) = default; /** * @brief %Unordered_multiset list assignment operator. * @param __l An initializer_list. * * This function fills an %unordered_multiset with copies of the elements * in the initializer list @a __l. * * Note that the assignment completely changes the %unordered_multiset * and that the resulting %unordered_set's size is the same as the number * of elements assigned. Old data may be lost. */ unordered_multiset& operator=(initializer_list<value_type> __l) { _M_h = __l; return *this; } /// Returns the allocator object with which the %unordered_multiset was /// constructed. allocator_type get_allocator() const noexcept { return _M_h.get_allocator(); } // size and capacity: /// Returns true if the %unordered_multiset is empty. bool empty() const noexcept { return _M_h.empty(); } /// Returns the size of the %unordered_multiset. size_type size() const noexcept { return _M_h.size(); } /// Returns the maximum size of the %unordered_multiset. size_type max_size() const noexcept { return _M_h.max_size(); } // iterators. //@{ /** * Returns a read-only (constant) iterator that points to the first * element in the %unordered_multiset. */ iterator begin() noexcept { return _M_h.begin(); } const_iterator begin() const noexcept { return _M_h.begin(); } //@} //@{ /** * Returns a read-only (constant) iterator that points one past the last * element in the %unordered_multiset. */ iterator end() noexcept { return _M_h.end(); } const_iterator end() const noexcept { return _M_h.end(); } //@} /** * Returns a read-only (constant) iterator that points to the first * element in the %unordered_multiset. */ const_iterator cbegin() const noexcept { return _M_h.begin(); } /** * Returns a read-only (constant) iterator that points one past the last * element in the %unordered_multiset. */ const_iterator cend() const noexcept { return _M_h.end(); } // modifiers. /** * @brief Builds and insert an element into the %unordered_multiset. * @param __args Arguments used to generate an element. * @return An iterator that points to the inserted element. * * Insertion requires amortized constant time. */ template<typename... _Args> iterator emplace(_Args&&... __args) { return _M_h.emplace(std::forward<_Args>(__args)...); } /** * @brief Inserts an element into the %unordered_multiset. * @param __pos An iterator that serves as a hint as to where the * element should be inserted. * @param __args Arguments used to generate the element to be * inserted. * @return An iterator that points to the inserted element. * * Note that the first parameter is only a hint and can potentially * improve the performance of the insertion process. A bad hint would * cause no gains in efficiency. * * For more on @a hinting, see: * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html * * Insertion requires amortized constant time. */ template<typename... _Args> iterator emplace_hint(const_iterator __pos, _Args&&... __args) { return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); } //@{ /** * @brief Inserts an element into the %unordered_multiset. * @param __x Element to be inserted. * @return An iterator that points to the inserted element. * * Insertion requires amortized constant time. */ iterator insert(const value_type& __x) { return _M_h.insert(__x); } iterator insert(value_type&& __x) { return _M_h.insert(std::move(__x)); } //@} //@{ /** * @brief Inserts an element into the %unordered_multiset. * @param __hint An iterator that serves as a hint as to where the * element should be inserted. * @param __x Element to be inserted. * @return An iterator that points to the inserted element. * * Note that the first parameter is only a hint and can potentially * improve the performance of the insertion process. A bad hint would * cause no gains in efficiency. * * For more on @a hinting, see: * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html * * Insertion requires amortized constant. */ iterator insert(const_iterator __hint, const value_type& __x) { return _M_h.insert(__hint, __x); } iterator insert(const_iterator __hint, value_type&& __x) { return _M_h.insert(__hint, std::move(__x)); } //@} /** * @brief A template function that inserts a range of elements. * @param __first Iterator pointing to the start of the range to be * inserted. * @param __last Iterator pointing to the end of the range. * * Complexity similar to that of the range constructor. */ template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) { _M_h.insert(__first, __last); } /** * @brief Inserts a list of elements into the %unordered_multiset. * @param __l A std::initializer_list<value_type> of elements to be * inserted. * * Complexity similar to that of the range constructor. */ void insert(initializer_list<value_type> __l) { _M_h.insert(__l); } //@{ /** * @brief Erases an element from an %unordered_multiset. * @param __position An iterator pointing to the element to be erased. * @return An iterator pointing to the element immediately following * @a __position prior to the element being erased. If no such * element exists, end() is returned. * * This function erases an element, pointed to by the given iterator, * from an %unordered_multiset. * * Note that this function only erases the element, and that if the * element is itself a pointer, the pointed-to memory is not touched in * any way. Managing the pointer is the user's responsibility. */ iterator erase(const_iterator __position) { return _M_h.erase(__position); } // LWG 2059. iterator erase(iterator __it) { return _M_h.erase(__it); } //@} /** * @brief Erases elements according to the provided key. * @param __x Key of element to be erased. * @return The number of elements erased. * * This function erases all the elements located by the given key from * an %unordered_multiset. * * Note that this function only erases the element, and that if the * element is itself a pointer, the pointed-to memory is not touched in * any way. Managing the pointer is the user's responsibility. */ size_type erase(const key_type& __x) { return _M_h.erase(__x); } /** * @brief Erases a [__first,__last) range of elements from an * %unordered_multiset. * @param __first Iterator pointing to the start of the range to be * erased. * @param __last Iterator pointing to the end of the range to * be erased. * @return The iterator @a __last. * * This function erases a sequence of elements from an * %unordered_multiset. * * Note that this function only erases the element, and that if * the element is itself a pointer, the pointed-to memory is not touched * in any way. Managing the pointer is the user's responsibility. */ iterator erase(const_iterator __first, const_iterator __last) { return _M_h.erase(__first, __last); } /** * Erases all elements in an %unordered_multiset. * * Note that this function only erases the elements, and that if the * elements themselves are pointers, the pointed-to memory is not touched * in any way. Managing the pointer is the user's responsibility. */ void clear() noexcept { _M_h.clear(); } /** * @brief Swaps data with another %unordered_multiset. * @param __x An %unordered_multiset of the same element and allocator * types. * * This exchanges the elements between two sets in constant time. * Note that the global std::swap() function is specialized such that * std::swap(s1,s2) will feed to this function. */ void swap(unordered_multiset& __x) { _M_h.swap(__x._M_h); } // observers. /// Returns the hash functor object with which the %unordered_multiset /// was constructed. hasher hash_function() const { return _M_h.hash_function(); } /// Returns the key comparison object with which the %unordered_multiset /// was constructed. key_equal key_eq() const { return _M_h.key_eq(); } // lookup. //@{ /** * @brief Tries to locate an element in an %unordered_multiset. * @param __x Element to be located. * @return Iterator pointing to sought-after element, or end() if not * found. * * This function takes a key and tries to locate the element with which * the key matches. If successful the function returns an iterator * pointing to the sought after element. If unsuccessful it returns the * past-the-end ( @c end() ) iterator. */ iterator find(const key_type& __x) { return _M_h.find(__x); } const_iterator find(const key_type& __x) const { return _M_h.find(__x); } //@} /** * @brief Finds the number of elements. * @param __x Element to located. * @return Number of elements with specified key. */ size_type count(const key_type& __x) const { return _M_h.count(__x); } //@{ /** * @brief Finds a subsequence matching given key. * @param __x Key to be located. * @return Pair of iterators that possibly points to the subsequence * matching given key. */ std::pair<iterator, iterator> equal_range(const key_type& __x) { return _M_h.equal_range(__x); } std::pair<const_iterator, const_iterator> equal_range(const key_type& __x) const { return _M_h.equal_range(__x); } //@} // bucket interface. /// Returns the number of buckets of the %unordered_multiset. size_type bucket_count() const noexcept { return _M_h.bucket_count(); } /// Returns the maximum number of buckets of the %unordered_multiset. size_type max_bucket_count() const noexcept { return _M_h.max_bucket_count(); } /* * @brief Returns the number of elements in a given bucket. * @param __n A bucket index. * @return The number of elements in the bucket. */ size_type bucket_size(size_type __n) const { return _M_h.bucket_size(__n); } /* * @brief Returns the bucket index of a given element. * @param __key A key instance. * @return The key bucket index. */ size_type bucket(const key_type& __key) const { return _M_h.bucket(__key); } //@{ /** * @brief Returns a read-only (constant) iterator pointing to the first * bucket element. * @param __n The bucket index. * @return A read-only local iterator. */ local_iterator begin(size_type __n) { return _M_h.begin(__n); } const_local_iterator begin(size_type __n) const { return _M_h.begin(__n); } const_local_iterator cbegin(size_type __n) const { return _M_h.cbegin(__n); } //@} //@{ /** * @brief Returns a read-only (constant) iterator pointing to one past * the last bucket elements. * @param __n The bucket index. * @return A read-only local iterator. */ local_iterator end(size_type __n) { return _M_h.end(__n); } const_local_iterator end(size_type __n) const { return _M_h.end(__n); } const_local_iterator cend(size_type __n) const { return _M_h.cend(__n); } //@} // hash policy. /// Returns the average number of elements per bucket. float load_factor() const noexcept { return _M_h.load_factor(); } /// Returns a positive number that the %unordered_multiset tries to keep the /// load factor less than or equal to. float max_load_factor() const noexcept { return _M_h.max_load_factor(); } /** * @brief Change the %unordered_multiset maximum load factor. * @param __z The new maximum load factor. */ void max_load_factor(float __z) { _M_h.max_load_factor(__z); } /** * @brief May rehash the %unordered_multiset. * @param __n The new number of buckets. * * Rehash will occur only if the new number of buckets respect the * %unordered_multiset maximum load factor. */ void rehash(size_type __n) { _M_h.rehash(__n); } /** * @brief Prepare the %unordered_multiset for a specified number of * elements. * @param __n Number of elements required. * * Same as rehash(ceil(n / max_load_factor())). */ void reserve(size_type __n) { _M_h.reserve(__n); } template<typename _Value1, typename _Hash1, typename _Pred1, typename _Alloc1> friend bool operator==(const unordered_multiset<_Value1, _Hash1, _Pred1, _Alloc1>&, const unordered_multiset<_Value1, _Hash1, _Pred1, _Alloc1>&); }; template<class _Value, class _Hash, class _Pred, class _Alloc> inline void swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) { __x.swap(__y); } template<class _Value, class _Hash, class _Pred, class _Alloc> inline void swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) { __x.swap(__y); } template<class _Value, class _Hash, class _Pred, class _Alloc> inline bool operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) { return __x._M_h._M_equal(__y._M_h); } template<class _Value, class _Hash, class _Pred, class _Alloc> inline bool operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) { return !(__x == __y); } template<class _Value, class _Hash, class _Pred, class _Alloc> inline bool operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) { return __x._M_h._M_equal(__y._M_h); } template<class _Value, class _Hash, class _Pred, class _Alloc> inline bool operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) { return !(__x == __y); } _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std #endif /* _UNORDERED_SET_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/codecvt.h����������������������������������������������������������������������������0000644�����������������00000040351�14763166030�0010337 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Locale support (codecvt) -*- C++ -*- // Copyright (C) 2000-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/codecvt.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{locale} */ // // ISO C++ 14882: 22.2.1.5 Template class codecvt // // Written by Benjamin Kosnik <bkoz@redhat.com> #ifndef _CODECVT_H #define _CODECVT_H 1 #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /// Empty base class for codecvt facet [22.2.1.5]. class codecvt_base { public: enum result { ok, partial, error, noconv }; }; /** * @brief Common base for codecvt functions. * * This template class provides implementations of the public functions * that forward to the protected virtual functions. * * This template also provides abstract stubs for the protected virtual * functions. */ template<typename _InternT, typename _ExternT, typename _StateT> class __codecvt_abstract_base : public locale::facet, public codecvt_base { public: // Types: typedef codecvt_base::result result; typedef _InternT intern_type; typedef _ExternT extern_type; typedef _StateT state_type; // 22.2.1.5.1 codecvt members /** * @brief Convert from internal to external character set. * * Converts input string of intern_type to output string of * extern_type. This is analogous to wcsrtombs. It does this by * calling codecvt::do_out. * * The source and destination character sets are determined by the * facet's locale, internal and external types. * * The characters in [from,from_end) are converted and written to * [to,to_end). from_next and to_next are set to point to the * character following the last successfully converted character, * respectively. If the result needed no conversion, from_next and * to_next are not affected. * * The @a state argument should be initialized if the input is at the * beginning and carried from a previous call if continuing * conversion. There are no guarantees about how @a state is used. * * The result returned is a member of codecvt_base::result. If * all the input is converted, returns codecvt_base::ok. If no * conversion is necessary, returns codecvt_base::noconv. If * the input ends early or there is insufficient space in the * output, returns codecvt_base::partial. Otherwise the * conversion failed and codecvt_base::error is returned. * * @param __state Persistent conversion state data. * @param __from Start of input. * @param __from_end End of input. * @param __from_next Returns start of unconverted data. * @param __to Start of output buffer. * @param __to_end End of output buffer. * @param __to_next Returns start of unused output area. * @return codecvt_base::result. */ result out(state_type& __state, const intern_type* __from, const intern_type* __from_end, const intern_type*& __from_next, extern_type* __to, extern_type* __to_end, extern_type*& __to_next) const { return this->do_out(__state, __from, __from_end, __from_next, __to, __to_end, __to_next); } /** * @brief Reset conversion state. * * Writes characters to output that would restore @a state to initial * conditions. The idea is that if a partial conversion occurs, then * the converting the characters written by this function would leave * the state in initial conditions, rather than partial conversion * state. It does this by calling codecvt::do_unshift(). * * For example, if 4 external characters always converted to 1 internal * character, and input to in() had 6 external characters with state * saved, this function would write two characters to the output and * set the state to initialized conditions. * * The source and destination character sets are determined by the * facet's locale, internal and external types. * * The result returned is a member of codecvt_base::result. If the * state could be reset and data written, returns codecvt_base::ok. If * no conversion is necessary, returns codecvt_base::noconv. If the * output has insufficient space, returns codecvt_base::partial. * Otherwise the reset failed and codecvt_base::error is returned. * * @param __state Persistent conversion state data. * @param __to Start of output buffer. * @param __to_end End of output buffer. * @param __to_next Returns start of unused output area. * @return codecvt_base::result. */ result unshift(state_type& __state, extern_type* __to, extern_type* __to_end, extern_type*& __to_next) const { return this->do_unshift(__state, __to,__to_end,__to_next); } /** * @brief Convert from external to internal character set. * * Converts input string of extern_type to output string of * intern_type. This is analogous to mbsrtowcs. It does this by * calling codecvt::do_in. * * The source and destination character sets are determined by the * facet's locale, internal and external types. * * The characters in [from,from_end) are converted and written to * [to,to_end). from_next and to_next are set to point to the * character following the last successfully converted character, * respectively. If the result needed no conversion, from_next and * to_next are not affected. * * The @a state argument should be initialized if the input is at the * beginning and carried from a previous call if continuing * conversion. There are no guarantees about how @a state is used. * * The result returned is a member of codecvt_base::result. If * all the input is converted, returns codecvt_base::ok. If no * conversion is necessary, returns codecvt_base::noconv. If * the input ends early or there is insufficient space in the * output, returns codecvt_base::partial. Otherwise the * conversion failed and codecvt_base::error is returned. * * @param __state Persistent conversion state data. * @param __from Start of input. * @param __from_end End of input. * @param __from_next Returns start of unconverted data. * @param __to Start of output buffer. * @param __to_end End of output buffer. * @param __to_next Returns start of unused output area. * @return codecvt_base::result. */ result in(state_type& __state, const extern_type* __from, const extern_type* __from_end, const extern_type*& __from_next, intern_type* __to, intern_type* __to_end, intern_type*& __to_next) const { return this->do_in(__state, __from, __from_end, __from_next, __to, __to_end, __to_next); } int encoding() const throw() { return this->do_encoding(); } bool always_noconv() const throw() { return this->do_always_noconv(); } int length(state_type& __state, const extern_type* __from, const extern_type* __end, size_t __max) const { return this->do_length(__state, __from, __end, __max); } int max_length() const throw() { return this->do_max_length(); } protected: explicit __codecvt_abstract_base(size_t __refs = 0) : locale::facet(__refs) { } virtual ~__codecvt_abstract_base() { } /** * @brief Convert from internal to external character set. * * Converts input string of intern_type to output string of * extern_type. This function is a hook for derived classes to change * the value returned. @see out for more information. */ virtual result do_out(state_type& __state, const intern_type* __from, const intern_type* __from_end, const intern_type*& __from_next, extern_type* __to, extern_type* __to_end, extern_type*& __to_next) const = 0; virtual result do_unshift(state_type& __state, extern_type* __to, extern_type* __to_end, extern_type*& __to_next) const = 0; virtual result do_in(state_type& __state, const extern_type* __from, const extern_type* __from_end, const extern_type*& __from_next, intern_type* __to, intern_type* __to_end, intern_type*& __to_next) const = 0; virtual int do_encoding() const throw() = 0; virtual bool do_always_noconv() const throw() = 0; virtual int do_length(state_type&, const extern_type* __from, const extern_type* __end, size_t __max) const = 0; virtual int do_max_length() const throw() = 0; }; /** * @brief Primary class template codecvt. * @ingroup locales * * NB: Generic, mostly useless implementation. * */ template<typename _InternT, typename _ExternT, typename _StateT> class codecvt : public __codecvt_abstract_base<_InternT, _ExternT, _StateT> { public: // Types: typedef codecvt_base::result result; typedef _InternT intern_type; typedef _ExternT extern_type; typedef _StateT state_type; protected: __c_locale _M_c_locale_codecvt; public: static locale::id id; explicit codecvt(size_t __refs = 0) : __codecvt_abstract_base<_InternT, _ExternT, _StateT> (__refs), _M_c_locale_codecvt(0) { } explicit codecvt(__c_locale __cloc, size_t __refs = 0); protected: virtual ~codecvt() { } virtual result do_out(state_type& __state, const intern_type* __from, const intern_type* __from_end, const intern_type*& __from_next, extern_type* __to, extern_type* __to_end, extern_type*& __to_next) const; virtual result do_unshift(state_type& __state, extern_type* __to, extern_type* __to_end, extern_type*& __to_next) const; virtual result do_in(state_type& __state, const extern_type* __from, const extern_type* __from_end, const extern_type*& __from_next, intern_type* __to, intern_type* __to_end, intern_type*& __to_next) const; virtual int do_encoding() const throw(); virtual bool do_always_noconv() const throw(); virtual int do_length(state_type&, const extern_type* __from, const extern_type* __end, size_t __max) const; virtual int do_max_length() const throw(); }; template<typename _InternT, typename _ExternT, typename _StateT> locale::id codecvt<_InternT, _ExternT, _StateT>::id; /// class codecvt<char, char, mbstate_t> specialization. template<> class codecvt<char, char, mbstate_t> : public __codecvt_abstract_base<char, char, mbstate_t> { public: // Types: typedef char intern_type; typedef char extern_type; typedef mbstate_t state_type; protected: __c_locale _M_c_locale_codecvt; public: static locale::id id; explicit codecvt(size_t __refs = 0); explicit codecvt(__c_locale __cloc, size_t __refs = 0); protected: virtual ~codecvt(); virtual result do_out(state_type& __state, const intern_type* __from, const intern_type* __from_end, const intern_type*& __from_next, extern_type* __to, extern_type* __to_end, extern_type*& __to_next) const; virtual result do_unshift(state_type& __state, extern_type* __to, extern_type* __to_end, extern_type*& __to_next) const; virtual result do_in(state_type& __state, const extern_type* __from, const extern_type* __from_end, const extern_type*& __from_next, intern_type* __to, intern_type* __to_end, intern_type*& __to_next) const; virtual int do_encoding() const throw(); virtual bool do_always_noconv() const throw(); virtual int do_length(state_type&, const extern_type* __from, const extern_type* __end, size_t __max) const; virtual int do_max_length() const throw(); }; #ifdef _GLIBCXX_USE_WCHAR_T /// class codecvt<wchar_t, char, mbstate_t> specialization. template<> class codecvt<wchar_t, char, mbstate_t> : public __codecvt_abstract_base<wchar_t, char, mbstate_t> { public: // Types: typedef wchar_t intern_type; typedef char extern_type; typedef mbstate_t state_type; protected: __c_locale _M_c_locale_codecvt; public: static locale::id id; explicit codecvt(size_t __refs = 0); explicit codecvt(__c_locale __cloc, size_t __refs = 0); protected: virtual ~codecvt(); virtual result do_out(state_type& __state, const intern_type* __from, const intern_type* __from_end, const intern_type*& __from_next, extern_type* __to, extern_type* __to_end, extern_type*& __to_next) const; virtual result do_unshift(state_type& __state, extern_type* __to, extern_type* __to_end, extern_type*& __to_next) const; virtual result do_in(state_type& __state, const extern_type* __from, const extern_type* __from_end, const extern_type*& __from_next, intern_type* __to, intern_type* __to_end, intern_type*& __to_next) const; virtual int do_encoding() const throw(); virtual bool do_always_noconv() const throw(); virtual int do_length(state_type&, const extern_type* __from, const extern_type* __end, size_t __max) const; virtual int do_max_length() const throw(); }; #endif //_GLIBCXX_USE_WCHAR_T /// class codecvt_byname [22.2.1.6]. template<typename _InternT, typename _ExternT, typename _StateT> class codecvt_byname : public codecvt<_InternT, _ExternT, _StateT> { public: explicit codecvt_byname(const char* __s, size_t __refs = 0) : codecvt<_InternT, _ExternT, _StateT>(__refs) { if (__builtin_strcmp(__s, "C") != 0 && __builtin_strcmp(__s, "POSIX") != 0) { this->_S_destroy_c_locale(this->_M_c_locale_codecvt); this->_S_create_c_locale(this->_M_c_locale_codecvt, __s); } } protected: virtual ~codecvt_byname() { } }; // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. #if _GLIBCXX_EXTERN_TEMPLATE extern template class codecvt_byname<char, char, mbstate_t>; extern template const codecvt<char, char, mbstate_t>& use_facet<codecvt<char, char, mbstate_t> >(const locale&); extern template bool has_facet<codecvt<char, char, mbstate_t> >(const locale&); #ifdef _GLIBCXX_USE_WCHAR_T extern template class codecvt_byname<wchar_t, char, mbstate_t>; extern template const codecvt<wchar_t, char, mbstate_t>& use_facet<codecvt<wchar_t, char, mbstate_t> >(const locale&); extern template bool has_facet<codecvt<wchar_t, char, mbstate_t> >(const locale&); #endif #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif // _CODECVT_H ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/basic_string.h�����������������������������������������������������������������������0000644�����������������00000332765�14763166030�0011374 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Components for manipulating sequences of characters -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/basic_string.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{string} */ // // ISO C++ 14882: 21 Strings library // #ifndef _BASIC_STRING_H #define _BASIC_STRING_H 1 #pragma GCC system_header #include <ext/atomicity.h> #include <debug/debug.h> #if __cplusplus >= 201103L #include <initializer_list> #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @class basic_string basic_string.h <string> * @brief Managing sequences of characters and character-like objects. * * @ingroup strings * @ingroup sequences * * @tparam _CharT Type of character * @tparam _Traits Traits for character type, defaults to * char_traits<_CharT>. * @tparam _Alloc Allocator type, defaults to allocator<_CharT>. * * Meets the requirements of a <a href="tables.html#65">container</a>, a * <a href="tables.html#66">reversible container</a>, and a * <a href="tables.html#67">sequence</a>. Of the * <a href="tables.html#68">optional sequence requirements</a>, only * @c push_back, @c at, and @c %array access are supported. * * @doctodo * * * Documentation? What's that? * Nathan Myers <ncm@cantrip.org>. * * A string looks like this: * * @code * [_Rep] * _M_length * [basic_string<char_type>] _M_capacity * _M_dataplus _M_refcount * _M_p ----------------> unnamed array of char_type * @endcode * * Where the _M_p points to the first character in the string, and * you cast it to a pointer-to-_Rep and subtract 1 to get a * pointer to the header. * * This approach has the enormous advantage that a string object * requires only one allocation. All the ugliness is confined * within a single %pair of inline functions, which each compile to * a single @a add instruction: _Rep::_M_data(), and * string::_M_rep(); and the allocation function which gets a * block of raw bytes and with room enough and constructs a _Rep * object at the front. * * The reason you want _M_data pointing to the character %array and * not the _Rep is so that the debugger can see the string * contents. (Probably we should add a non-inline member to get * the _Rep for the debugger to use, so users can check the actual * string length.) * * Note that the _Rep object is a POD so that you can have a * static <em>empty string</em> _Rep object already @a constructed before * static constructors have run. The reference-count encoding is * chosen so that a 0 indicates one reference, so you never try to * destroy the empty-string _Rep object. * * All but the last paragraph is considered pretty conventional * for a C++ string implementation. */ // 21.3 Template class basic_string template<typename _CharT, typename _Traits, typename _Alloc> class basic_string { typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type; // Types: public: typedef _Traits traits_type; typedef typename _Traits::char_type value_type; typedef _Alloc allocator_type; typedef typename _CharT_alloc_type::size_type size_type; typedef typename _CharT_alloc_type::difference_type difference_type; typedef typename _CharT_alloc_type::reference reference; typedef typename _CharT_alloc_type::const_reference const_reference; typedef typename _CharT_alloc_type::pointer pointer; typedef typename _CharT_alloc_type::const_pointer const_pointer; typedef __gnu_cxx::__normal_iterator<pointer, basic_string> iterator; typedef __gnu_cxx::__normal_iterator<const_pointer, basic_string> const_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<iterator> reverse_iterator; private: // _Rep: string representation // Invariants: // 1. String really contains _M_length + 1 characters: due to 21.3.4 // must be kept null-terminated. // 2. _M_capacity >= _M_length // Allocated memory is always (_M_capacity + 1) * sizeof(_CharT). // 3. _M_refcount has three states: // -1: leaked, one reference, no ref-copies allowed, non-const. // 0: one reference, non-const. // n>0: n + 1 references, operations require a lock, const. // 4. All fields==0 is an empty string, given the extra storage // beyond-the-end for a null terminator; thus, the shared // empty string representation needs no constructor. struct _Rep_base { size_type _M_length; size_type _M_capacity; _Atomic_word _M_refcount; }; struct _Rep : _Rep_base { // Types: typedef typename _Alloc::template rebind<char>::other _Raw_bytes_alloc; // (Public) Data members: // The maximum number of individual char_type elements of an // individual string is determined by _S_max_size. This is the // value that will be returned by max_size(). (Whereas npos // is the maximum number of bytes the allocator can allocate.) // If one was to divvy up the theoretical largest size string, // with a terminating character and m _CharT elements, it'd // look like this: // npos = sizeof(_Rep) + (m * sizeof(_CharT)) + sizeof(_CharT) // Solving for m: // m = ((npos - sizeof(_Rep))/sizeof(CharT)) - 1 // In addition, this implementation quarters this amount. static const size_type _S_max_size; static const _CharT _S_terminal; // The following storage is init'd to 0 by the linker, resulting // (carefully) in an empty string with one reference. static size_type _S_empty_rep_storage[]; static _Rep& _S_empty_rep() { // NB: Mild hack to avoid strict-aliasing warnings. Note that // _S_empty_rep_storage is never modified and the punning should // be reasonably safe in this case. void* __p = reinterpret_cast<void*>(&_S_empty_rep_storage); return *reinterpret_cast<_Rep*>(__p); } bool _M_is_leaked() const { return this->_M_refcount < 0; } bool _M_is_shared() const { return this->_M_refcount > 0; } void _M_set_leaked() { this->_M_refcount = -1; } void _M_set_sharable() { this->_M_refcount = 0; } void _M_set_length_and_sharable(size_type __n) { #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 if (__builtin_expect(this != &_S_empty_rep(), false)) #endif { this->_M_set_sharable(); // One reference. this->_M_length = __n; traits_type::assign(this->_M_refdata()[__n], _S_terminal); // grrr. (per 21.3.4) // You cannot leave those LWG people alone for a second. } } _CharT* _M_refdata() throw() { return reinterpret_cast<_CharT*>(this + 1); } _CharT* _M_grab(const _Alloc& __alloc1, const _Alloc& __alloc2) { return (!_M_is_leaked() && __alloc1 == __alloc2) ? _M_refcopy() : _M_clone(__alloc1); } // Create & Destroy static _Rep* _S_create(size_type, size_type, const _Alloc&); void _M_dispose(const _Alloc& __a) { #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 if (__builtin_expect(this != &_S_empty_rep(), false)) #endif { // Be race-detector-friendly. For more info see bits/c++config. _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount); if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0) { _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount); _M_destroy(__a); } } } // XXX MT void _M_destroy(const _Alloc&) throw(); _CharT* _M_refcopy() throw() { #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 if (__builtin_expect(this != &_S_empty_rep(), false)) #endif __gnu_cxx::__atomic_add_dispatch(&this->_M_refcount, 1); return _M_refdata(); } // XXX MT _CharT* _M_clone(const _Alloc&, size_type __res = 0); }; // Use empty-base optimization: http://www.cantrip.org/emptyopt.html struct _Alloc_hider : _Alloc { _Alloc_hider(_CharT* __dat, const _Alloc& __a) : _Alloc(__a), _M_p(__dat) { } _CharT* _M_p; // The actual data. }; public: // Data Members (public): // NB: This is an unsigned type, and thus represents the maximum // size that the allocator can hold. /// Value returned by various member functions when they fail. static const size_type npos = static_cast<size_type>(-1); private: // Data Members (private): mutable _Alloc_hider _M_dataplus; _CharT* _M_data() const { return _M_dataplus._M_p; } _CharT* _M_data(_CharT* __p) { return (_M_dataplus._M_p = __p); } _Rep* _M_rep() const { return &((reinterpret_cast<_Rep*> (_M_data()))[-1]); } // For the internal use we have functions similar to `begin'/`end' // but they do not call _M_leak. iterator _M_ibegin() const { return iterator(_M_data()); } iterator _M_iend() const { return iterator(_M_data() + this->size()); } void _M_leak() // for use in begin() & non-const op[] { if (!_M_rep()->_M_is_leaked()) _M_leak_hard(); } size_type _M_check(size_type __pos, const char* __s) const { if (__pos > this->size()) __throw_out_of_range(__N(__s)); return __pos; } void _M_check_length(size_type __n1, size_type __n2, const char* __s) const { if (this->max_size() - (this->size() - __n1) < __n2) __throw_length_error(__N(__s)); } // NB: _M_limit doesn't check for a bad __pos value. size_type _M_limit(size_type __pos, size_type __off) const { const bool __testoff = __off < this->size() - __pos; return __testoff ? __off : this->size() - __pos; } // True if _Rep and source do not overlap. bool _M_disjunct(const _CharT* __s) const { return (less<const _CharT*>()(__s, _M_data()) || less<const _CharT*>()(_M_data() + this->size(), __s)); } // When __n = 1 way faster than the general multichar // traits_type::copy/move/assign. static void _M_copy(_CharT* __d, const _CharT* __s, size_type __n) { if (__n == 1) traits_type::assign(*__d, *__s); else traits_type::copy(__d, __s, __n); } static void _M_move(_CharT* __d, const _CharT* __s, size_type __n) { if (__n == 1) traits_type::assign(*__d, *__s); else traits_type::move(__d, __s, __n); } static void _M_assign(_CharT* __d, size_type __n, _CharT __c) { if (__n == 1) traits_type::assign(*__d, __c); else traits_type::assign(__d, __n, __c); } // _S_copy_chars is a separate template to permit specialization // to optimize for the common case of pointers as iterators. template<class _Iterator> static void _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2) { for (; __k1 != __k2; ++__k1, ++__p) traits_type::assign(*__p, *__k1); // These types are off. } static void _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) { _S_copy_chars(__p, __k1.base(), __k2.base()); } static void _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2) { _S_copy_chars(__p, __k1.base(), __k2.base()); } static void _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) { _M_copy(__p, __k1, __k2 - __k1); } static void _S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2) { _M_copy(__p, __k1, __k2 - __k1); } static int _S_compare(size_type __n1, size_type __n2) { const difference_type __d = difference_type(__n1 - __n2); if (__d > __gnu_cxx::__numeric_traits<int>::__max) return __gnu_cxx::__numeric_traits<int>::__max; else if (__d < __gnu_cxx::__numeric_traits<int>::__min) return __gnu_cxx::__numeric_traits<int>::__min; else return int(__d); } void _M_mutate(size_type __pos, size_type __len1, size_type __len2); void _M_leak_hard(); static _Rep& _S_empty_rep() { return _Rep::_S_empty_rep(); } public: // Construct/copy/destroy: // NB: We overload ctors in some cases instead of using default // arguments, per 17.4.4.4 para. 2 item 2. /** * @brief Default constructor creates an empty string. */ basic_string() #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 : _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { } #else : _M_dataplus(_S_construct(size_type(), _CharT(), _Alloc()), _Alloc()){ } #endif /** * @brief Construct an empty string using allocator @a a. */ explicit basic_string(const _Alloc& __a); // NB: per LWG issue 42, semantics different from IS: /** * @brief Construct string with copy of value of @a str. * @param __str Source string. */ basic_string(const basic_string& __str); /** * @brief Construct string as copy of a substring. * @param __str Source string. * @param __pos Index of first character to copy from. * @param __n Number of characters to copy (default remainder). */ basic_string(const basic_string& __str, size_type __pos, size_type __n = npos); /** * @brief Construct string as copy of a substring. * @param __str Source string. * @param __pos Index of first character to copy from. * @param __n Number of characters to copy. * @param __a Allocator to use. */ basic_string(const basic_string& __str, size_type __pos, size_type __n, const _Alloc& __a); /** * @brief Construct string initialized by a character %array. * @param __s Source character %array. * @param __n Number of characters to copy. * @param __a Allocator to use (default is default allocator). * * NB: @a __s must have at least @a __n characters, '\\0' * has no special meaning. */ basic_string(const _CharT* __s, size_type __n, const _Alloc& __a = _Alloc()); /** * @brief Construct string as copy of a C string. * @param __s Source C string. * @param __a Allocator to use (default is default allocator). */ basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()); /** * @brief Construct string as multiple characters. * @param __n Number of characters. * @param __c Character to use. * @param __a Allocator to use (default is default allocator). */ basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()); #if __cplusplus >= 201103L /** * @brief Move construct string. * @param __str Source string. * * The newly-created string contains the exact contents of @a __str. * @a __str is a valid, but unspecified string. **/ basic_string(basic_string&& __str) noexcept : _M_dataplus(__str._M_dataplus) { #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 __str._M_data(_S_empty_rep()._M_refdata()); #else __str._M_data(_S_construct(size_type(), _CharT(), get_allocator())); #endif } /** * @brief Construct string from an initializer %list. * @param __l std::initializer_list of characters. * @param __a Allocator to use (default is default allocator). */ basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()); #endif // C++11 /** * @brief Construct string as copy of a range. * @param __beg Start of range. * @param __end End of range. * @param __a Allocator to use (default is default allocator). */ template<class _InputIterator> basic_string(_InputIterator __beg, _InputIterator __end, const _Alloc& __a = _Alloc()); /** * @brief Destroy the string instance. */ ~basic_string() _GLIBCXX_NOEXCEPT { _M_rep()->_M_dispose(this->get_allocator()); } /** * @brief Assign the value of @a str to this string. * @param __str Source string. */ basic_string& operator=(const basic_string& __str) { return this->assign(__str); } /** * @brief Copy contents of @a s into this string. * @param __s Source null-terminated string. */ basic_string& operator=(const _CharT* __s) { return this->assign(__s); } /** * @brief Set value to string of length 1. * @param __c Source character. * * Assigning to a character makes this string length 1 and * (*this)[0] == @a c. */ basic_string& operator=(_CharT __c) { this->assign(1, __c); return *this; } #if __cplusplus >= 201103L /** * @brief Move assign the value of @a str to this string. * @param __str Source string. * * The contents of @a str are moved into this string (without copying). * @a str is a valid, but unspecified string. **/ basic_string& operator=(basic_string&& __str) { // NB: DR 1204. this->swap(__str); return *this; } /** * @brief Set value to string constructed from initializer %list. * @param __l std::initializer_list. */ basic_string& operator=(initializer_list<_CharT> __l) { this->assign(__l.begin(), __l.size()); return *this; } #endif // C++11 // Iterators: /** * Returns a read/write iterator that points to the first character in * the %string. Unshares the string. */ iterator begin() _GLIBCXX_NOEXCEPT { _M_leak(); return iterator(_M_data()); } /** * Returns a read-only (constant) iterator that points to the first * character in the %string. */ const_iterator begin() const _GLIBCXX_NOEXCEPT { return const_iterator(_M_data()); } /** * Returns a read/write iterator that points one past the last * character in the %string. Unshares the string. */ iterator end() _GLIBCXX_NOEXCEPT { _M_leak(); return iterator(_M_data() + this->size()); } /** * Returns a read-only (constant) iterator that points one past the * last character in the %string. */ const_iterator end() const _GLIBCXX_NOEXCEPT { return const_iterator(_M_data() + this->size()); } /** * Returns a read/write reverse iterator that points to the last * character in the %string. Iteration is done in reverse element * order. Unshares the string. */ reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(this->end()); } /** * Returns a read-only (constant) reverse iterator that points * to the last character in the %string. Iteration is done in * reverse element order. */ const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(this->end()); } /** * Returns a read/write reverse iterator that points to one before the * first character in the %string. Iteration is done in reverse * element order. Unshares the string. */ reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(this->begin()); } /** * Returns a read-only (constant) reverse iterator that points * to one before the first character in the %string. Iteration * is done in reverse element order. */ const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(this->begin()); } #if __cplusplus >= 201103L /** * Returns a read-only (constant) iterator that points to the first * character in the %string. */ const_iterator cbegin() const noexcept { return const_iterator(this->_M_data()); } /** * Returns a read-only (constant) iterator that points one past the * last character in the %string. */ const_iterator cend() const noexcept { return const_iterator(this->_M_data() + this->size()); } /** * Returns a read-only (constant) reverse iterator that points * to the last character in the %string. Iteration is done in * reverse element order. */ const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(this->end()); } /** * Returns a read-only (constant) reverse iterator that points * to one before the first character in the %string. Iteration * is done in reverse element order. */ const_reverse_iterator crend() const noexcept { return const_reverse_iterator(this->begin()); } #endif public: // Capacity: /// Returns the number of characters in the string, not including any /// null-termination. size_type size() const _GLIBCXX_NOEXCEPT { return _M_rep()->_M_length; } /// Returns the number of characters in the string, not including any /// null-termination. size_type length() const _GLIBCXX_NOEXCEPT { return _M_rep()->_M_length; } /// Returns the size() of the largest possible %string. size_type max_size() const _GLIBCXX_NOEXCEPT { return _Rep::_S_max_size; } /** * @brief Resizes the %string to the specified number of characters. * @param __n Number of characters the %string should contain. * @param __c Character to fill any new elements. * * This function will %resize the %string to the specified * number of characters. If the number is smaller than the * %string's current size the %string is truncated, otherwise * the %string is extended and new elements are %set to @a __c. */ void resize(size_type __n, _CharT __c); /** * @brief Resizes the %string to the specified number of characters. * @param __n Number of characters the %string should contain. * * This function will resize the %string to the specified length. If * the new size is smaller than the %string's current size the %string * is truncated, otherwise the %string is extended and new characters * are default-constructed. For basic types such as char, this means * setting them to 0. */ void resize(size_type __n) { this->resize(__n, _CharT()); } #if __cplusplus >= 201103L /// A non-binding request to reduce capacity() to size(). void shrink_to_fit() { if (capacity() > size()) { __try { reserve(0); } __catch(...) { } } } #endif /** * Returns the total number of characters that the %string can hold * before needing to allocate more memory. */ size_type capacity() const _GLIBCXX_NOEXCEPT { return _M_rep()->_M_capacity; } /** * @brief Attempt to preallocate enough memory for specified number of * characters. * @param __res_arg Number of characters required. * @throw std::length_error If @a __res_arg exceeds @c max_size(). * * This function attempts to reserve enough memory for the * %string to hold the specified number of characters. If the * number requested is more than max_size(), length_error is * thrown. * * The advantage of this function is that if optimal code is a * necessity and the user can determine the string length that will be * required, the user can reserve the memory in %advance, and thus * prevent a possible reallocation of memory and copying of %string * data. */ void reserve(size_type __res_arg = 0); /** * Erases the string, making it empty. */ void clear() _GLIBCXX_NOEXCEPT { _M_mutate(0, this->size(), 0); } /** * Returns true if the %string is empty. Equivalent to * <code>*this == ""</code>. */ bool empty() const _GLIBCXX_NOEXCEPT { return this->size() == 0; } // Element access: /** * @brief Subscript access to the data contained in the %string. * @param __pos The index of the character to access. * @return Read-only (constant) reference to the character. * * This operator allows for easy, array-style, data access. * Note that data access with this operator is unchecked and * out_of_range lookups are not defined. (For checked lookups * see at().) */ const_reference operator[] (size_type __pos) const { _GLIBCXX_DEBUG_ASSERT(__pos <= size()); return _M_data()[__pos]; } /** * @brief Subscript access to the data contained in the %string. * @param __pos The index of the character to access. * @return Read/write reference to the character. * * This operator allows for easy, array-style, data access. * Note that data access with this operator is unchecked and * out_of_range lookups are not defined. (For checked lookups * see at().) Unshares the string. */ reference operator[](size_type __pos) { // allow pos == size() as v3 extension: _GLIBCXX_DEBUG_ASSERT(__pos <= size()); // but be strict in pedantic mode: _GLIBCXX_DEBUG_PEDASSERT(__pos < size()); _M_leak(); return _M_data()[__pos]; } /** * @brief Provides access to the data contained in the %string. * @param __n The index of the character to access. * @return Read-only (const) reference to the character. * @throw std::out_of_range If @a n is an invalid index. * * This function provides for safer data access. The parameter is * first checked that it is in the range of the string. The function * throws out_of_range if the check fails. */ const_reference at(size_type __n) const { if (__n >= this->size()) __throw_out_of_range(__N("basic_string::at")); return _M_data()[__n]; } /** * @brief Provides access to the data contained in the %string. * @param __n The index of the character to access. * @return Read/write reference to the character. * @throw std::out_of_range If @a n is an invalid index. * * This function provides for safer data access. The parameter is * first checked that it is in the range of the string. The function * throws out_of_range if the check fails. Success results in * unsharing the string. */ reference at(size_type __n) { if (__n >= size()) __throw_out_of_range(__N("basic_string::at")); _M_leak(); return _M_data()[__n]; } #if __cplusplus >= 201103L /** * Returns a read/write reference to the data at the first * element of the %string. */ reference front() { return operator[](0); } /** * Returns a read-only (constant) reference to the data at the first * element of the %string. */ const_reference front() const { return operator[](0); } /** * Returns a read/write reference to the data at the last * element of the %string. */ reference back() { return operator[](this->size() - 1); } /** * Returns a read-only (constant) reference to the data at the * last element of the %string. */ const_reference back() const { return operator[](this->size() - 1); } #endif // Modifiers: /** * @brief Append a string to this string. * @param __str The string to append. * @return Reference to this string. */ basic_string& operator+=(const basic_string& __str) { return this->append(__str); } /** * @brief Append a C string. * @param __s The C string to append. * @return Reference to this string. */ basic_string& operator+=(const _CharT* __s) { return this->append(__s); } /** * @brief Append a character. * @param __c The character to append. * @return Reference to this string. */ basic_string& operator+=(_CharT __c) { this->push_back(__c); return *this; } #if __cplusplus >= 201103L /** * @brief Append an initializer_list of characters. * @param __l The initializer_list of characters to be appended. * @return Reference to this string. */ basic_string& operator+=(initializer_list<_CharT> __l) { return this->append(__l.begin(), __l.size()); } #endif // C++11 /** * @brief Append a string to this string. * @param __str The string to append. * @return Reference to this string. */ basic_string& append(const basic_string& __str); /** * @brief Append a substring. * @param __str The string to append. * @param __pos Index of the first character of str to append. * @param __n The number of characters to append. * @return Reference to this string. * @throw std::out_of_range if @a __pos is not a valid index. * * This function appends @a __n characters from @a __str * starting at @a __pos to this string. If @a __n is is larger * than the number of available characters in @a __str, the * remainder of @a __str is appended. */ basic_string& append(const basic_string& __str, size_type __pos, size_type __n); /** * @brief Append a C substring. * @param __s The C string to append. * @param __n The number of characters to append. * @return Reference to this string. */ basic_string& append(const _CharT* __s, size_type __n); /** * @brief Append a C string. * @param __s The C string to append. * @return Reference to this string. */ basic_string& append(const _CharT* __s) { __glibcxx_requires_string(__s); return this->append(__s, traits_type::length(__s)); } /** * @brief Append multiple characters. * @param __n The number of characters to append. * @param __c The character to use. * @return Reference to this string. * * Appends __n copies of __c to this string. */ basic_string& append(size_type __n, _CharT __c); #if __cplusplus >= 201103L /** * @brief Append an initializer_list of characters. * @param __l The initializer_list of characters to append. * @return Reference to this string. */ basic_string& append(initializer_list<_CharT> __l) { return this->append(__l.begin(), __l.size()); } #endif // C++11 /** * @brief Append a range of characters. * @param __first Iterator referencing the first character to append. * @param __last Iterator marking the end of the range. * @return Reference to this string. * * Appends characters in the range [__first,__last) to this string. */ template<class _InputIterator> basic_string& append(_InputIterator __first, _InputIterator __last) { return this->replace(_M_iend(), _M_iend(), __first, __last); } /** * @brief Append a single character. * @param __c Character to append. */ void push_back(_CharT __c) { const size_type __len = 1 + this->size(); if (__len > this->capacity() || _M_rep()->_M_is_shared()) this->reserve(__len); traits_type::assign(_M_data()[this->size()], __c); _M_rep()->_M_set_length_and_sharable(__len); } /** * @brief Set value to contents of another string. * @param __str Source string to use. * @return Reference to this string. */ basic_string& assign(const basic_string& __str); #if __cplusplus >= 201103L /** * @brief Set value to contents of another string. * @param __str Source string to use. * @return Reference to this string. * * This function sets this string to the exact contents of @a __str. * @a __str is a valid, but unspecified string. */ basic_string& assign(basic_string&& __str) { this->swap(__str); return *this; } #endif // C++11 /** * @brief Set value to a substring of a string. * @param __str The string to use. * @param __pos Index of the first character of str. * @param __n Number of characters to use. * @return Reference to this string. * @throw std::out_of_range if @a pos is not a valid index. * * This function sets this string to the substring of @a __str * consisting of @a __n characters at @a __pos. If @a __n is * is larger than the number of available characters in @a * __str, the remainder of @a __str is used. */ basic_string& assign(const basic_string& __str, size_type __pos, size_type __n) { return this->assign(__str._M_data() + __str._M_check(__pos, "basic_string::assign"), __str._M_limit(__pos, __n)); } /** * @brief Set value to a C substring. * @param __s The C string to use. * @param __n Number of characters to use. * @return Reference to this string. * * This function sets the value of this string to the first @a __n * characters of @a __s. If @a __n is is larger than the number of * available characters in @a __s, the remainder of @a __s is used. */ basic_string& assign(const _CharT* __s, size_type __n); /** * @brief Set value to contents of a C string. * @param __s The C string to use. * @return Reference to this string. * * This function sets the value of this string to the value of @a __s. * The data is copied, so there is no dependence on @a __s once the * function returns. */ basic_string& assign(const _CharT* __s) { __glibcxx_requires_string(__s); return this->assign(__s, traits_type::length(__s)); } /** * @brief Set value to multiple characters. * @param __n Length of the resulting string. * @param __c The character to use. * @return Reference to this string. * * This function sets the value of this string to @a __n copies of * character @a __c. */ basic_string& assign(size_type __n, _CharT __c) { return _M_replace_aux(size_type(0), this->size(), __n, __c); } /** * @brief Set value to a range of characters. * @param __first Iterator referencing the first character to append. * @param __last Iterator marking the end of the range. * @return Reference to this string. * * Sets value of string to characters in the range [__first,__last). */ template<class _InputIterator> basic_string& assign(_InputIterator __first, _InputIterator __last) { return this->replace(_M_ibegin(), _M_iend(), __first, __last); } #if __cplusplus >= 201103L /** * @brief Set value to an initializer_list of characters. * @param __l The initializer_list of characters to assign. * @return Reference to this string. */ basic_string& assign(initializer_list<_CharT> __l) { return this->assign(__l.begin(), __l.size()); } #endif // C++11 /** * @brief Insert multiple characters. * @param __p Iterator referencing location in string to insert at. * @param __n Number of characters to insert * @param __c The character to insert. * @throw std::length_error If new length exceeds @c max_size(). * * Inserts @a __n copies of character @a __c starting at the * position referenced by iterator @a __p. If adding * characters causes the length to exceed max_size(), * length_error is thrown. The value of the string doesn't * change if an error is thrown. */ void insert(iterator __p, size_type __n, _CharT __c) { this->replace(__p, __p, __n, __c); } /** * @brief Insert a range of characters. * @param __p Iterator referencing location in string to insert at. * @param __beg Start of range. * @param __end End of range. * @throw std::length_error If new length exceeds @c max_size(). * * Inserts characters in range [__beg,__end). If adding * characters causes the length to exceed max_size(), * length_error is thrown. The value of the string doesn't * change if an error is thrown. */ template<class _InputIterator> void insert(iterator __p, _InputIterator __beg, _InputIterator __end) { this->replace(__p, __p, __beg, __end); } #if __cplusplus >= 201103L /** * @brief Insert an initializer_list of characters. * @param __p Iterator referencing location in string to insert at. * @param __l The initializer_list of characters to insert. * @throw std::length_error If new length exceeds @c max_size(). */ void insert(iterator __p, initializer_list<_CharT> __l) { _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend()); this->insert(__p - _M_ibegin(), __l.begin(), __l.size()); } #endif // C++11 /** * @brief Insert value of a string. * @param __pos1 Iterator referencing location in string to insert at. * @param __str The string to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * * Inserts value of @a __str starting at @a __pos1. If adding * characters causes the length to exceed max_size(), * length_error is thrown. The value of the string doesn't * change if an error is thrown. */ basic_string& insert(size_type __pos1, const basic_string& __str) { return this->insert(__pos1, __str, size_type(0), __str.size()); } /** * @brief Insert a substring. * @param __pos1 Iterator referencing location in string to insert at. * @param __str The string to insert. * @param __pos2 Start of characters in str to insert. * @param __n Number of characters to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * @throw std::out_of_range If @a pos1 > size() or * @a __pos2 > @a str.size(). * * Starting at @a pos1, insert @a __n character of @a __str * beginning with @a __pos2. If adding characters causes the * length to exceed max_size(), length_error is thrown. If @a * __pos1 is beyond the end of this string or @a __pos2 is * beyond the end of @a __str, out_of_range is thrown. The * value of the string doesn't change if an error is thrown. */ basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n) { return this->insert(__pos1, __str._M_data() + __str._M_check(__pos2, "basic_string::insert"), __str._M_limit(__pos2, __n)); } /** * @brief Insert a C substring. * @param __pos Iterator referencing location in string to insert at. * @param __s The C string to insert. * @param __n The number of characters to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * @throw std::out_of_range If @a __pos is beyond the end of this * string. * * Inserts the first @a __n characters of @a __s starting at @a * __pos. If adding characters causes the length to exceed * max_size(), length_error is thrown. If @a __pos is beyond * end(), out_of_range is thrown. The value of the string * doesn't change if an error is thrown. */ basic_string& insert(size_type __pos, const _CharT* __s, size_type __n); /** * @brief Insert a C string. * @param __pos Iterator referencing location in string to insert at. * @param __s The C string to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * @throw std::out_of_range If @a pos is beyond the end of this * string. * * Inserts the first @a n characters of @a __s starting at @a __pos. If * adding characters causes the length to exceed max_size(), * length_error is thrown. If @a __pos is beyond end(), out_of_range is * thrown. The value of the string doesn't change if an error is * thrown. */ basic_string& insert(size_type __pos, const _CharT* __s) { __glibcxx_requires_string(__s); return this->insert(__pos, __s, traits_type::length(__s)); } /** * @brief Insert multiple characters. * @param __pos Index in string to insert at. * @param __n Number of characters to insert * @param __c The character to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * @throw std::out_of_range If @a __pos is beyond the end of this * string. * * Inserts @a __n copies of character @a __c starting at index * @a __pos. If adding characters causes the length to exceed * max_size(), length_error is thrown. If @a __pos > length(), * out_of_range is thrown. The value of the string doesn't * change if an error is thrown. */ basic_string& insert(size_type __pos, size_type __n, _CharT __c) { return _M_replace_aux(_M_check(__pos, "basic_string::insert"), size_type(0), __n, __c); } /** * @brief Insert one character. * @param __p Iterator referencing position in string to insert at. * @param __c The character to insert. * @return Iterator referencing newly inserted char. * @throw std::length_error If new length exceeds @c max_size(). * * Inserts character @a __c at position referenced by @a __p. * If adding character causes the length to exceed max_size(), * length_error is thrown. If @a __p is beyond end of string, * out_of_range is thrown. The value of the string doesn't * change if an error is thrown. */ iterator insert(iterator __p, _CharT __c) { _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend()); const size_type __pos = __p - _M_ibegin(); _M_replace_aux(__pos, size_type(0), size_type(1), __c); _M_rep()->_M_set_leaked(); return iterator(_M_data() + __pos); } /** * @brief Remove characters. * @param __pos Index of first character to remove (default 0). * @param __n Number of characters to remove (default remainder). * @return Reference to this string. * @throw std::out_of_range If @a pos is beyond the end of this * string. * * Removes @a __n characters from this string starting at @a * __pos. The length of the string is reduced by @a __n. If * there are < @a __n characters to remove, the remainder of * the string is truncated. If @a __p is beyond end of string, * out_of_range is thrown. The value of the string doesn't * change if an error is thrown. */ basic_string& erase(size_type __pos = 0, size_type __n = npos) { _M_mutate(_M_check(__pos, "basic_string::erase"), _M_limit(__pos, __n), size_type(0)); return *this; } /** * @brief Remove one character. * @param __position Iterator referencing the character to remove. * @return iterator referencing same location after removal. * * Removes the character at @a __position from this string. The value * of the string doesn't change if an error is thrown. */ iterator erase(iterator __position) { _GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin() && __position < _M_iend()); const size_type __pos = __position - _M_ibegin(); _M_mutate(__pos, size_type(1), size_type(0)); _M_rep()->_M_set_leaked(); return iterator(_M_data() + __pos); } /** * @brief Remove a range of characters. * @param __first Iterator referencing the first character to remove. * @param __last Iterator referencing the end of the range. * @return Iterator referencing location of first after removal. * * Removes the characters in the range [first,last) from this string. * The value of the string doesn't change if an error is thrown. */ iterator erase(iterator __first, iterator __last); #if __cplusplus >= 201103L /** * @brief Remove the last character. * * The string must be non-empty. */ void pop_back() { erase(size()-1, 1); } #endif // C++11 /** * @brief Replace characters with value from another string. * @param __pos Index of first character to replace. * @param __n Number of characters to be replaced. * @param __str String to insert. * @return Reference to this string. * @throw std::out_of_range If @a pos is beyond the end of this * string. * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [__pos,__pos+__n) from * this string. In place, the value of @a __str is inserted. * If @a __pos is beyond end of string, out_of_range is thrown. * If the length of the result exceeds max_size(), length_error * is thrown. The value of the string doesn't change if an * error is thrown. */ basic_string& replace(size_type __pos, size_type __n, const basic_string& __str) { return this->replace(__pos, __n, __str._M_data(), __str.size()); } /** * @brief Replace characters with value from another string. * @param __pos1 Index of first character to replace. * @param __n1 Number of characters to be replaced. * @param __str String to insert. * @param __pos2 Index of first character of str to use. * @param __n2 Number of characters from str to use. * @return Reference to this string. * @throw std::out_of_range If @a __pos1 > size() or @a __pos2 > * __str.size(). * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [__pos1,__pos1 + n) from this * string. In place, the value of @a __str is inserted. If @a __pos is * beyond end of string, out_of_range is thrown. If the length of the * result exceeds max_size(), length_error is thrown. The value of the * string doesn't change if an error is thrown. */ basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) { return this->replace(__pos1, __n1, __str._M_data() + __str._M_check(__pos2, "basic_string::replace"), __str._M_limit(__pos2, __n2)); } /** * @brief Replace characters with value of a C substring. * @param __pos Index of first character to replace. * @param __n1 Number of characters to be replaced. * @param __s C string to insert. * @param __n2 Number of characters from @a s to use. * @return Reference to this string. * @throw std::out_of_range If @a pos1 > size(). * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [__pos,__pos + __n1) * from this string. In place, the first @a __n2 characters of * @a __s are inserted, or all of @a __s if @a __n2 is too large. If * @a __pos is beyond end of string, out_of_range is thrown. If * the length of result exceeds max_size(), length_error is * thrown. The value of the string doesn't change if an error * is thrown. */ basic_string& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2); /** * @brief Replace characters with value of a C string. * @param __pos Index of first character to replace. * @param __n1 Number of characters to be replaced. * @param __s C string to insert. * @return Reference to this string. * @throw std::out_of_range If @a pos > size(). * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [__pos,__pos + __n1) * from this string. In place, the characters of @a __s are * inserted. If @a __pos is beyond end of string, out_of_range * is thrown. If the length of result exceeds max_size(), * length_error is thrown. The value of the string doesn't * change if an error is thrown. */ basic_string& replace(size_type __pos, size_type __n1, const _CharT* __s) { __glibcxx_requires_string(__s); return this->replace(__pos, __n1, __s, traits_type::length(__s)); } /** * @brief Replace characters with multiple characters. * @param __pos Index of first character to replace. * @param __n1 Number of characters to be replaced. * @param __n2 Number of characters to insert. * @param __c Character to insert. * @return Reference to this string. * @throw std::out_of_range If @a __pos > size(). * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [pos,pos + n1) from this * string. In place, @a __n2 copies of @a __c are inserted. * If @a __pos is beyond end of string, out_of_range is thrown. * If the length of result exceeds max_size(), length_error is * thrown. The value of the string doesn't change if an error * is thrown. */ basic_string& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) { return _M_replace_aux(_M_check(__pos, "basic_string::replace"), _M_limit(__pos, __n1), __n2, __c); } /** * @brief Replace range of characters with string. * @param __i1 Iterator referencing start of range to replace. * @param __i2 Iterator referencing end of range to replace. * @param __str String value to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [__i1,__i2). In place, * the value of @a __str is inserted. If the length of result * exceeds max_size(), length_error is thrown. The value of * the string doesn't change if an error is thrown. */ basic_string& replace(iterator __i1, iterator __i2, const basic_string& __str) { return this->replace(__i1, __i2, __str._M_data(), __str.size()); } /** * @brief Replace range of characters with C substring. * @param __i1 Iterator referencing start of range to replace. * @param __i2 Iterator referencing end of range to replace. * @param __s C string value to insert. * @param __n Number of characters from s to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [__i1,__i2). In place, * the first @a __n characters of @a __s are inserted. If the * length of result exceeds max_size(), length_error is thrown. * The value of the string doesn't change if an error is * thrown. */ basic_string& replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n) { _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 && __i2 <= _M_iend()); return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n); } /** * @brief Replace range of characters with C string. * @param __i1 Iterator referencing start of range to replace. * @param __i2 Iterator referencing end of range to replace. * @param __s C string value to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [__i1,__i2). In place, * the characters of @a __s are inserted. If the length of * result exceeds max_size(), length_error is thrown. The * value of the string doesn't change if an error is thrown. */ basic_string& replace(iterator __i1, iterator __i2, const _CharT* __s) { __glibcxx_requires_string(__s); return this->replace(__i1, __i2, __s, traits_type::length(__s)); } /** * @brief Replace range of characters with multiple characters * @param __i1 Iterator referencing start of range to replace. * @param __i2 Iterator referencing end of range to replace. * @param __n Number of characters to insert. * @param __c Character to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [__i1,__i2). In place, * @a __n copies of @a __c are inserted. If the length of * result exceeds max_size(), length_error is thrown. The * value of the string doesn't change if an error is thrown. */ basic_string& replace(iterator __i1, iterator __i2, size_type __n, _CharT __c) { _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 && __i2 <= _M_iend()); return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c); } /** * @brief Replace range of characters with range. * @param __i1 Iterator referencing start of range to replace. * @param __i2 Iterator referencing end of range to replace. * @param __k1 Iterator referencing start of range to insert. * @param __k2 Iterator referencing end of range to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [__i1,__i2). In place, * characters in the range [__k1,__k2) are inserted. If the * length of result exceeds max_size(), length_error is thrown. * The value of the string doesn't change if an error is * thrown. */ template<class _InputIterator> basic_string& replace(iterator __i1, iterator __i2, _InputIterator __k1, _InputIterator __k2) { _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 && __i2 <= _M_iend()); __glibcxx_requires_valid_range(__k1, __k2); typedef typename std::__is_integer<_InputIterator>::__type _Integral; return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral()); } // Specializations for the common case of pointer and iterator: // useful to avoid the overhead of temporary buffering in _M_replace. basic_string& replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2) { _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 && __i2 <= _M_iend()); __glibcxx_requires_valid_range(__k1, __k2); return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __k1, __k2 - __k1); } basic_string& replace(iterator __i1, iterator __i2, const _CharT* __k1, const _CharT* __k2) { _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 && __i2 <= _M_iend()); __glibcxx_requires_valid_range(__k1, __k2); return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __k1, __k2 - __k1); } basic_string& replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2) { _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 && __i2 <= _M_iend()); __glibcxx_requires_valid_range(__k1, __k2); return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __k1.base(), __k2 - __k1); } basic_string& replace(iterator __i1, iterator __i2, const_iterator __k1, const_iterator __k2) { _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 && __i2 <= _M_iend()); __glibcxx_requires_valid_range(__k1, __k2); return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __k1.base(), __k2 - __k1); } #if __cplusplus >= 201103L /** * @brief Replace range of characters with initializer_list. * @param __i1 Iterator referencing start of range to replace. * @param __i2 Iterator referencing end of range to replace. * @param __l The initializer_list of characters to insert. * @return Reference to this string. * @throw std::length_error If new length exceeds @c max_size(). * * Removes the characters in the range [__i1,__i2). In place, * characters in the range [__k1,__k2) are inserted. If the * length of result exceeds max_size(), length_error is thrown. * The value of the string doesn't change if an error is * thrown. */ basic_string& replace(iterator __i1, iterator __i2, initializer_list<_CharT> __l) { return this->replace(__i1, __i2, __l.begin(), __l.end()); } #endif // C++11 private: template<class _Integer> basic_string& _M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n, _Integer __val, __true_type) { return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); } template<class _InputIterator> basic_string& _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1, _InputIterator __k2, __false_type); basic_string& _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, _CharT __c); basic_string& _M_replace_safe(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2); // _S_construct_aux is used to implement the 21.3.1 para 15 which // requires special behaviour if _InIter is an integral type template<class _InIterator> static _CharT* _S_construct_aux(_InIterator __beg, _InIterator __end, const _Alloc& __a, __false_type) { typedef typename iterator_traits<_InIterator>::iterator_category _Tag; return _S_construct(__beg, __end, __a, _Tag()); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 438. Ambiguity in the "do the right thing" clause template<class _Integer> static _CharT* _S_construct_aux(_Integer __beg, _Integer __end, const _Alloc& __a, __true_type) { return _S_construct_aux_2(static_cast<size_type>(__beg), __end, __a); } static _CharT* _S_construct_aux_2(size_type __req, _CharT __c, const _Alloc& __a) { return _S_construct(__req, __c, __a); } template<class _InIterator> static _CharT* _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a) { typedef typename std::__is_integer<_InIterator>::__type _Integral; return _S_construct_aux(__beg, __end, __a, _Integral()); } // For Input Iterators, used in istreambuf_iterators, etc. template<class _InIterator> static _CharT* _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a, input_iterator_tag); // For forward_iterators up to random_access_iterators, used for // string::iterator, _CharT*, etc. template<class _FwdIterator> static _CharT* _S_construct(_FwdIterator __beg, _FwdIterator __end, const _Alloc& __a, forward_iterator_tag); static _CharT* _S_construct(size_type __req, _CharT __c, const _Alloc& __a); public: /** * @brief Copy substring into C string. * @param __s C string to copy value into. * @param __n Number of characters to copy. * @param __pos Index of first character to copy. * @return Number of characters actually copied * @throw std::out_of_range If __pos > size(). * * Copies up to @a __n characters starting at @a __pos into the * C string @a __s. If @a __pos is %greater than size(), * out_of_range is thrown. */ size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const; /** * @brief Swap contents with another string. * @param __s String to swap with. * * Exchanges the contents of this string with that of @a __s in constant * time. */ void swap(basic_string& __s); // String operations: /** * @brief Return const pointer to null-terminated contents. * * This is a handle to internal data. Do not modify or dire things may * happen. */ const _CharT* c_str() const _GLIBCXX_NOEXCEPT { return _M_data(); } /** * @brief Return const pointer to contents. * * This is a handle to internal data. Do not modify or dire things may * happen. */ const _CharT* data() const _GLIBCXX_NOEXCEPT { return _M_data(); } /** * @brief Return copy of allocator used to construct this string. */ allocator_type get_allocator() const _GLIBCXX_NOEXCEPT { return _M_dataplus; } /** * @brief Find position of a C substring. * @param __s C string to locate. * @param __pos Index of character to search from. * @param __n Number of characters from @a s to search for. * @return Index of start of first occurrence. * * Starting from @a __pos, searches forward for the first @a * __n characters in @a __s within this string. If found, * returns the index where it begins. If not found, returns * npos. */ size_type find(const _CharT* __s, size_type __pos, size_type __n) const; /** * @brief Find position of a string. * @param __str String to locate. * @param __pos Index of character to search from (default 0). * @return Index of start of first occurrence. * * Starting from @a __pos, searches forward for value of @a __str within * this string. If found, returns the index where it begins. If not * found, returns npos. */ size_type find(const basic_string& __str, size_type __pos = 0) const _GLIBCXX_NOEXCEPT { return this->find(__str.data(), __pos, __str.size()); } /** * @brief Find position of a C string. * @param __s C string to locate. * @param __pos Index of character to search from (default 0). * @return Index of start of first occurrence. * * Starting from @a __pos, searches forward for the value of @a * __s within this string. If found, returns the index where * it begins. If not found, returns npos. */ size_type find(const _CharT* __s, size_type __pos = 0) const { __glibcxx_requires_string(__s); return this->find(__s, __pos, traits_type::length(__s)); } /** * @brief Find position of a character. * @param __c Character to locate. * @param __pos Index of character to search from (default 0). * @return Index of first occurrence. * * Starting from @a __pos, searches forward for @a __c within * this string. If found, returns the index where it was * found. If not found, returns npos. */ size_type find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT; /** * @brief Find last position of a string. * @param __str String to locate. * @param __pos Index of character to search back from (default end). * @return Index of start of last occurrence. * * Starting from @a __pos, searches backward for value of @a * __str within this string. If found, returns the index where * it begins. If not found, returns npos. */ size_type rfind(const basic_string& __str, size_type __pos = npos) const _GLIBCXX_NOEXCEPT { return this->rfind(__str.data(), __pos, __str.size()); } /** * @brief Find last position of a C substring. * @param __s C string to locate. * @param __pos Index of character to search back from. * @param __n Number of characters from s to search for. * @return Index of start of last occurrence. * * Starting from @a __pos, searches backward for the first @a * __n characters in @a __s within this string. If found, * returns the index where it begins. If not found, returns * npos. */ size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const; /** * @brief Find last position of a C string. * @param __s C string to locate. * @param __pos Index of character to start search at (default end). * @return Index of start of last occurrence. * * Starting from @a __pos, searches backward for the value of * @a __s within this string. If found, returns the index * where it begins. If not found, returns npos. */ size_type rfind(const _CharT* __s, size_type __pos = npos) const { __glibcxx_requires_string(__s); return this->rfind(__s, __pos, traits_type::length(__s)); } /** * @brief Find last position of a character. * @param __c Character to locate. * @param __pos Index of character to search back from (default end). * @return Index of last occurrence. * * Starting from @a __pos, searches backward for @a __c within * this string. If found, returns the index where it was * found. If not found, returns npos. */ size_type rfind(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT; /** * @brief Find position of a character of string. * @param __str String containing characters to locate. * @param __pos Index of character to search from (default 0). * @return Index of first occurrence. * * Starting from @a __pos, searches forward for one of the * characters of @a __str within this string. If found, * returns the index where it was found. If not found, returns * npos. */ size_type find_first_of(const basic_string& __str, size_type __pos = 0) const _GLIBCXX_NOEXCEPT { return this->find_first_of(__str.data(), __pos, __str.size()); } /** * @brief Find position of a character of C substring. * @param __s String containing characters to locate. * @param __pos Index of character to search from. * @param __n Number of characters from s to search for. * @return Index of first occurrence. * * Starting from @a __pos, searches forward for one of the * first @a __n characters of @a __s within this string. If * found, returns the index where it was found. If not found, * returns npos. */ size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const; /** * @brief Find position of a character of C string. * @param __s String containing characters to locate. * @param __pos Index of character to search from (default 0). * @return Index of first occurrence. * * Starting from @a __pos, searches forward for one of the * characters of @a __s within this string. If found, returns * the index where it was found. If not found, returns npos. */ size_type find_first_of(const _CharT* __s, size_type __pos = 0) const { __glibcxx_requires_string(__s); return this->find_first_of(__s, __pos, traits_type::length(__s)); } /** * @brief Find position of a character. * @param __c Character to locate. * @param __pos Index of character to search from (default 0). * @return Index of first occurrence. * * Starting from @a __pos, searches forward for the character * @a __c within this string. If found, returns the index * where it was found. If not found, returns npos. * * Note: equivalent to find(__c, __pos). */ size_type find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT { return this->find(__c, __pos); } /** * @brief Find last position of a character of string. * @param __str String containing characters to locate. * @param __pos Index of character to search back from (default end). * @return Index of last occurrence. * * Starting from @a __pos, searches backward for one of the * characters of @a __str within this string. If found, * returns the index where it was found. If not found, returns * npos. */ size_type find_last_of(const basic_string& __str, size_type __pos = npos) const _GLIBCXX_NOEXCEPT { return this->find_last_of(__str.data(), __pos, __str.size()); } /** * @brief Find last position of a character of C substring. * @param __s C string containing characters to locate. * @param __pos Index of character to search back from. * @param __n Number of characters from s to search for. * @return Index of last occurrence. * * Starting from @a __pos, searches backward for one of the * first @a __n characters of @a __s within this string. If * found, returns the index where it was found. If not found, * returns npos. */ size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const; /** * @brief Find last position of a character of C string. * @param __s C string containing characters to locate. * @param __pos Index of character to search back from (default end). * @return Index of last occurrence. * * Starting from @a __pos, searches backward for one of the * characters of @a __s within this string. If found, returns * the index where it was found. If not found, returns npos. */ size_type find_last_of(const _CharT* __s, size_type __pos = npos) const { __glibcxx_requires_string(__s); return this->find_last_of(__s, __pos, traits_type::length(__s)); } /** * @brief Find last position of a character. * @param __c Character to locate. * @param __pos Index of character to search back from (default end). * @return Index of last occurrence. * * Starting from @a __pos, searches backward for @a __c within * this string. If found, returns the index where it was * found. If not found, returns npos. * * Note: equivalent to rfind(__c, __pos). */ size_type find_last_of(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT { return this->rfind(__c, __pos); } /** * @brief Find position of a character not in string. * @param __str String containing characters to avoid. * @param __pos Index of character to search from (default 0). * @return Index of first occurrence. * * Starting from @a __pos, searches forward for a character not contained * in @a __str within this string. If found, returns the index where it * was found. If not found, returns npos. */ size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const _GLIBCXX_NOEXCEPT { return this->find_first_not_of(__str.data(), __pos, __str.size()); } /** * @brief Find position of a character not in C substring. * @param __s C string containing characters to avoid. * @param __pos Index of character to search from. * @param __n Number of characters from __s to consider. * @return Index of first occurrence. * * Starting from @a __pos, searches forward for a character not * contained in the first @a __n characters of @a __s within * this string. If found, returns the index where it was * found. If not found, returns npos. */ size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const; /** * @brief Find position of a character not in C string. * @param __s C string containing characters to avoid. * @param __pos Index of character to search from (default 0). * @return Index of first occurrence. * * Starting from @a __pos, searches forward for a character not * contained in @a __s within this string. If found, returns * the index where it was found. If not found, returns npos. */ size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const { __glibcxx_requires_string(__s); return this->find_first_not_of(__s, __pos, traits_type::length(__s)); } /** * @brief Find position of a different character. * @param __c Character to avoid. * @param __pos Index of character to search from (default 0). * @return Index of first occurrence. * * Starting from @a __pos, searches forward for a character * other than @a __c within this string. If found, returns the * index where it was found. If not found, returns npos. */ size_type find_first_not_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT; /** * @brief Find last position of a character not in string. * @param __str String containing characters to avoid. * @param __pos Index of character to search back from (default end). * @return Index of last occurrence. * * Starting from @a __pos, searches backward for a character * not contained in @a __str within this string. If found, * returns the index where it was found. If not found, returns * npos. */ size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const _GLIBCXX_NOEXCEPT { return this->find_last_not_of(__str.data(), __pos, __str.size()); } /** * @brief Find last position of a character not in C substring. * @param __s C string containing characters to avoid. * @param __pos Index of character to search back from. * @param __n Number of characters from s to consider. * @return Index of last occurrence. * * Starting from @a __pos, searches backward for a character not * contained in the first @a __n characters of @a __s within this string. * If found, returns the index where it was found. If not found, * returns npos. */ size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const; /** * @brief Find last position of a character not in C string. * @param __s C string containing characters to avoid. * @param __pos Index of character to search back from (default end). * @return Index of last occurrence. * * Starting from @a __pos, searches backward for a character * not contained in @a __s within this string. If found, * returns the index where it was found. If not found, returns * npos. */ size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const { __glibcxx_requires_string(__s); return this->find_last_not_of(__s, __pos, traits_type::length(__s)); } /** * @brief Find last position of a different character. * @param __c Character to avoid. * @param __pos Index of character to search back from (default end). * @return Index of last occurrence. * * Starting from @a __pos, searches backward for a character other than * @a __c within this string. If found, returns the index where it was * found. If not found, returns npos. */ size_type find_last_not_of(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT; /** * @brief Get a substring. * @param __pos Index of first character (default 0). * @param __n Number of characters in substring (default remainder). * @return The new string. * @throw std::out_of_range If __pos > size(). * * Construct and return a new string using the @a __n * characters starting at @a __pos. If the string is too * short, use the remainder of the characters. If @a __pos is * beyond the end of the string, out_of_range is thrown. */ basic_string substr(size_type __pos = 0, size_type __n = npos) const { return basic_string(*this, _M_check(__pos, "basic_string::substr"), __n); } /** * @brief Compare to a string. * @param __str String to compare against. * @return Integer < 0, 0, or > 0. * * Returns an integer < 0 if this string is ordered before @a * __str, 0 if their values are equivalent, or > 0 if this * string is ordered after @a __str. Determines the effective * length rlen of the strings to compare as the smallest of * size() and str.size(). The function then compares the two * strings by calling traits::compare(data(), str.data(),rlen). * If the result of the comparison is nonzero returns it, * otherwise the shorter one is ordered first. */ int compare(const basic_string& __str) const { const size_type __size = this->size(); const size_type __osize = __str.size(); const size_type __len = std::min(__size, __osize); int __r = traits_type::compare(_M_data(), __str.data(), __len); if (!__r) __r = _S_compare(__size, __osize); return __r; } /** * @brief Compare substring to a string. * @param __pos Index of first character of substring. * @param __n Number of characters in substring. * @param __str String to compare against. * @return Integer < 0, 0, or > 0. * * Form the substring of this string from the @a __n characters * starting at @a __pos. Returns an integer < 0 if the * substring is ordered before @a __str, 0 if their values are * equivalent, or > 0 if the substring is ordered after @a * __str. Determines the effective length rlen of the strings * to compare as the smallest of the length of the substring * and @a __str.size(). The function then compares the two * strings by calling * traits::compare(substring.data(),str.data(),rlen). If the * result of the comparison is nonzero returns it, otherwise * the shorter one is ordered first. */ int compare(size_type __pos, size_type __n, const basic_string& __str) const; /** * @brief Compare substring to a substring. * @param __pos1 Index of first character of substring. * @param __n1 Number of characters in substring. * @param __str String to compare against. * @param __pos2 Index of first character of substring of str. * @param __n2 Number of characters in substring of str. * @return Integer < 0, 0, or > 0. * * Form the substring of this string from the @a __n1 * characters starting at @a __pos1. Form the substring of @a * __str from the @a __n2 characters starting at @a __pos2. * Returns an integer < 0 if this substring is ordered before * the substring of @a __str, 0 if their values are equivalent, * or > 0 if this substring is ordered after the substring of * @a __str. Determines the effective length rlen of the * strings to compare as the smallest of the lengths of the * substrings. The function then compares the two strings by * calling * traits::compare(substring.data(),str.substr(pos2,n2).data(),rlen). * If the result of the comparison is nonzero returns it, * otherwise the shorter one is ordered first. */ int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const; /** * @brief Compare to a C string. * @param __s C string to compare against. * @return Integer < 0, 0, or > 0. * * Returns an integer < 0 if this string is ordered before @a __s, 0 if * their values are equivalent, or > 0 if this string is ordered after * @a __s. Determines the effective length rlen of the strings to * compare as the smallest of size() and the length of a string * constructed from @a __s. The function then compares the two strings * by calling traits::compare(data(),s,rlen). If the result of the * comparison is nonzero returns it, otherwise the shorter one is * ordered first. */ int compare(const _CharT* __s) const; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 5 String::compare specification questionable /** * @brief Compare substring to a C string. * @param __pos Index of first character of substring. * @param __n1 Number of characters in substring. * @param __s C string to compare against. * @return Integer < 0, 0, or > 0. * * Form the substring of this string from the @a __n1 * characters starting at @a pos. Returns an integer < 0 if * the substring is ordered before @a __s, 0 if their values * are equivalent, or > 0 if the substring is ordered after @a * __s. Determines the effective length rlen of the strings to * compare as the smallest of the length of the substring and * the length of a string constructed from @a __s. The * function then compares the two string by calling * traits::compare(substring.data(),__s,rlen). If the result of * the comparison is nonzero returns it, otherwise the shorter * one is ordered first. */ int compare(size_type __pos, size_type __n1, const _CharT* __s) const; /** * @brief Compare substring against a character %array. * @param __pos Index of first character of substring. * @param __n1 Number of characters in substring. * @param __s character %array to compare against. * @param __n2 Number of characters of s. * @return Integer < 0, 0, or > 0. * * Form the substring of this string from the @a __n1 * characters starting at @a __pos. Form a string from the * first @a __n2 characters of @a __s. Returns an integer < 0 * if this substring is ordered before the string from @a __s, * 0 if their values are equivalent, or > 0 if this substring * is ordered after the string from @a __s. Determines the * effective length rlen of the strings to compare as the * smallest of the length of the substring and @a __n2. The * function then compares the two strings by calling * traits::compare(substring.data(),s,rlen). If the result of * the comparison is nonzero returns it, otherwise the shorter * one is ordered first. * * NB: s must have at least n2 characters, '\\0' has * no special meaning. */ int compare(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) const; }; // operator+ /** * @brief Concatenate two strings. * @param __lhs First string. * @param __rhs Last string. * @return New string with value of @a __lhs followed by @a __rhs. */ template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc> operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { basic_string<_CharT, _Traits, _Alloc> __str(__lhs); __str.append(__rhs); return __str; } /** * @brief Concatenate C string and string. * @param __lhs First string. * @param __rhs Last string. * @return New string with value of @a __lhs followed by @a __rhs. */ template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT,_Traits,_Alloc> operator+(const _CharT* __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs); /** * @brief Concatenate character and string. * @param __lhs First string. * @param __rhs Last string. * @return New string with @a __lhs followed by @a __rhs. */ template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT,_Traits,_Alloc> operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs); /** * @brief Concatenate string and C string. * @param __lhs First string. * @param __rhs Last string. * @return New string with @a __lhs followed by @a __rhs. */ template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { basic_string<_CharT, _Traits, _Alloc> __str(__lhs); __str.append(__rhs); return __str; } /** * @brief Concatenate string and character. * @param __lhs First string. * @param __rhs Last string. * @return New string with @a __lhs followed by @a __rhs. */ template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) { typedef basic_string<_CharT, _Traits, _Alloc> __string_type; typedef typename __string_type::size_type __size_type; __string_type __str(__lhs); __str.append(__size_type(1), __rhs); return __str; } #if __cplusplus >= 201103L template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return std::move(__lhs.append(__rhs)); } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, basic_string<_CharT, _Traits, _Alloc>&& __rhs) { return std::move(__rhs.insert(0, __lhs)); } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, basic_string<_CharT, _Traits, _Alloc>&& __rhs) { const auto __size = __lhs.size() + __rhs.size(); const bool __cond = (__size > __lhs.capacity() && __size <= __rhs.capacity()); return __cond ? std::move(__rhs.insert(0, __lhs)) : std::move(__lhs.append(__rhs)); } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(const _CharT* __lhs, basic_string<_CharT, _Traits, _Alloc>&& __rhs) { return std::move(__rhs.insert(0, __lhs)); } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(_CharT __lhs, basic_string<_CharT, _Traits, _Alloc>&& __rhs) { return std::move(__rhs.insert(0, 1, __lhs)); } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, const _CharT* __rhs) { return std::move(__lhs.append(__rhs)); } template<typename _CharT, typename _Traits, typename _Alloc> inline basic_string<_CharT, _Traits, _Alloc> operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, _CharT __rhs) { return std::move(__lhs.append(1, __rhs)); } #endif // operator == /** * @brief Test equivalence of two strings. * @param __lhs First string. * @param __rhs Second string. * @return True if @a __lhs.compare(@a __rhs) == 0. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __lhs.compare(__rhs) == 0; } template<typename _CharT> inline typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, bool>::__type operator==(const basic_string<_CharT>& __lhs, const basic_string<_CharT>& __rhs) { return (__lhs.size() == __rhs.size() && !std::char_traits<_CharT>::compare(__lhs.data(), __rhs.data(), __lhs.size())); } /** * @brief Test equivalence of C string and string. * @param __lhs C string. * @param __rhs String. * @return True if @a __rhs.compare(@a __lhs) == 0. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator==(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __rhs.compare(__lhs) == 0; } /** * @brief Test equivalence of string and C string. * @param __lhs String. * @param __rhs C string. * @return True if @a __lhs.compare(@a __rhs) == 0. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) == 0; } // operator != /** * @brief Test difference of two strings. * @param __lhs First string. * @param __rhs Second string. * @return True if @a __lhs.compare(@a __rhs) != 0. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return !(__lhs == __rhs); } /** * @brief Test difference of C string and string. * @param __lhs C string. * @param __rhs String. * @return True if @a __rhs.compare(@a __lhs) != 0. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator!=(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return !(__lhs == __rhs); } /** * @brief Test difference of string and C string. * @param __lhs String. * @param __rhs C string. * @return True if @a __lhs.compare(@a __rhs) != 0. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { return !(__lhs == __rhs); } // operator < /** * @brief Test if string precedes string. * @param __lhs First string. * @param __rhs Second string. * @return True if @a __lhs precedes @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __lhs.compare(__rhs) < 0; } /** * @brief Test if string precedes C string. * @param __lhs String. * @param __rhs C string. * @return True if @a __lhs precedes @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) < 0; } /** * @brief Test if C string precedes string. * @param __lhs C string. * @param __rhs String. * @return True if @a __lhs precedes @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator<(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __rhs.compare(__lhs) > 0; } // operator > /** * @brief Test if string follows string. * @param __lhs First string. * @param __rhs Second string. * @return True if @a __lhs follows @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __lhs.compare(__rhs) > 0; } /** * @brief Test if string follows C string. * @param __lhs String. * @param __rhs C string. * @return True if @a __lhs follows @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) > 0; } /** * @brief Test if C string follows string. * @param __lhs C string. * @param __rhs String. * @return True if @a __lhs follows @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator>(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __rhs.compare(__lhs) < 0; } // operator <= /** * @brief Test if string doesn't follow string. * @param __lhs First string. * @param __rhs Second string. * @return True if @a __lhs doesn't follow @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __lhs.compare(__rhs) <= 0; } /** * @brief Test if string doesn't follow C string. * @param __lhs String. * @param __rhs C string. * @return True if @a __lhs doesn't follow @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) <= 0; } /** * @brief Test if C string doesn't follow string. * @param __lhs C string. * @param __rhs String. * @return True if @a __lhs doesn't follow @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator<=(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __rhs.compare(__lhs) >= 0; } // operator >= /** * @brief Test if string doesn't precede string. * @param __lhs First string. * @param __rhs Second string. * @return True if @a __lhs doesn't precede @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __lhs.compare(__rhs) >= 0; } /** * @brief Test if string doesn't precede C string. * @param __lhs String. * @param __rhs C string. * @return True if @a __lhs doesn't precede @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) { return __lhs.compare(__rhs) >= 0; } /** * @brief Test if C string doesn't precede string. * @param __lhs C string. * @param __rhs String. * @return True if @a __lhs doesn't precede @a __rhs. False otherwise. */ template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator>=(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) { return __rhs.compare(__lhs) <= 0; } /** * @brief Swap contents of two strings. * @param __lhs First string. * @param __rhs Second string. * * Exchanges the contents of @a __lhs and @a __rhs in constant time. */ template<typename _CharT, typename _Traits, typename _Alloc> inline void swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, basic_string<_CharT, _Traits, _Alloc>& __rhs) { __lhs.swap(__rhs); } /** * @brief Read stream into a string. * @param __is Input stream. * @param __str Buffer to store into. * @return Reference to the input stream. * * Stores characters from @a __is into @a __str until whitespace is * found, the end of the stream is encountered, or str.max_size() * is reached. If is.width() is non-zero, that is the limit on the * number of characters stored into @a __str. Any previous * contents of @a __str are erased. */ template<typename _CharT, typename _Traits, typename _Alloc> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Alloc>& __str); template<> basic_istream<char>& operator>>(basic_istream<char>& __is, basic_string<char>& __str); /** * @brief Write string to a stream. * @param __os Output stream. * @param __str String to write out. * @return Reference to the output stream. * * Output characters of @a __str into os following the same rules as for * writing a C string. */ template<typename _CharT, typename _Traits, typename _Alloc> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const basic_string<_CharT, _Traits, _Alloc>& __str) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 586. string inserter not a formatted function return __ostream_insert(__os, __str.data(), __str.size()); } /** * @brief Read a line from stream into a string. * @param __is Input stream. * @param __str Buffer to store into. * @param __delim Character marking end of line. * @return Reference to the input stream. * * Stores characters from @a __is into @a __str until @a __delim is * found, the end of the stream is encountered, or str.max_size() * is reached. Any previous contents of @a __str are erased. If * @a __delim is encountered, it is extracted but not stored into * @a __str. */ template<typename _CharT, typename _Traits, typename _Alloc> basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim); /** * @brief Read a line from stream into a string. * @param __is Input stream. * @param __str Buffer to store into. * @return Reference to the input stream. * * Stores characters from is into @a __str until '\n' is * found, the end of the stream is encountered, or str.max_size() * is reached. Any previous contents of @a __str are erased. If * end of line is encountered, it is extracted but not stored into * @a __str. */ template<typename _CharT, typename _Traits, typename _Alloc> inline basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Alloc>& __str) { return getline(__is, __str, __is.widen('\n')); } template<> basic_istream<char>& getline(basic_istream<char>& __in, basic_string<char>& __str, char __delim); #ifdef _GLIBCXX_USE_WCHAR_T template<> basic_istream<wchar_t>& getline(basic_istream<wchar_t>& __in, basic_string<wchar_t>& __str, wchar_t __delim); #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \ && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) #include <ext/string_conversions.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // 21.4 Numeric Conversions [string.conversions]. inline int stoi(const string& __str, size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa<long, int>(&std::strtol, "stoi", __str.c_str(), __idx, __base); } inline long stol(const string& __str, size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::strtol, "stol", __str.c_str(), __idx, __base); } inline unsigned long stoul(const string& __str, size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::strtoul, "stoul", __str.c_str(), __idx, __base); } inline long long stoll(const string& __str, size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::strtoll, "stoll", __str.c_str(), __idx, __base); } inline unsigned long long stoull(const string& __str, size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::strtoull, "stoull", __str.c_str(), __idx, __base); } // NB: strtof vs strtod. inline float stof(const string& __str, size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::strtof, "stof", __str.c_str(), __idx); } inline double stod(const string& __str, size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::strtod, "stod", __str.c_str(), __idx); } inline long double stold(const string& __str, size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __idx); } // NB: (v)snprintf vs sprintf. // DR 1261. inline string to_string(int __val) { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(int), "%d", __val); } inline string to_string(unsigned __val) { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(unsigned), "%u", __val); } inline string to_string(long __val) { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(long), "%ld", __val); } inline string to_string(unsigned long __val) { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(unsigned long), "%lu", __val); } inline string to_string(long long __val) { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(long long), "%lld", __val); } inline string to_string(unsigned long long __val) { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(unsigned long long), "%llu", __val); } inline string to_string(float __val) { const int __n = __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20; return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n, "%f", __val); } inline string to_string(double __val) { const int __n = __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20; return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n, "%f", __val); } inline string to_string(long double __val) { const int __n = __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20; return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n, "%Lf", __val); } #ifdef _GLIBCXX_USE_WCHAR_T inline int stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa<long, int>(&std::wcstol, "stoi", __str.c_str(), __idx, __base); } inline long stol(const wstring& __str, size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::wcstol, "stol", __str.c_str(), __idx, __base); } inline unsigned long stoul(const wstring& __str, size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::wcstoul, "stoul", __str.c_str(), __idx, __base); } inline long long stoll(const wstring& __str, size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::wcstoll, "stoll", __str.c_str(), __idx, __base); } inline unsigned long long stoull(const wstring& __str, size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::wcstoull, "stoull", __str.c_str(), __idx, __base); } // NB: wcstof vs wcstod. inline float stof(const wstring& __str, size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::wcstof, "stof", __str.c_str(), __idx); } inline double stod(const wstring& __str, size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::wcstod, "stod", __str.c_str(), __idx); } inline long double stold(const wstring& __str, size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::wcstold, "stold", __str.c_str(), __idx); } // DR 1261. inline wstring to_wstring(int __val) { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 * sizeof(int), L"%d", __val); } inline wstring to_wstring(unsigned __val) { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 * sizeof(unsigned), L"%u", __val); } inline wstring to_wstring(long __val) { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 * sizeof(long), L"%ld", __val); } inline wstring to_wstring(unsigned long __val) { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 * sizeof(unsigned long), L"%lu", __val); } inline wstring to_wstring(long long __val) { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 * sizeof(long long), L"%lld", __val); } inline wstring to_wstring(unsigned long long __val) { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 * sizeof(unsigned long long), L"%llu", __val); } inline wstring to_wstring(float __val) { const int __n = __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20; return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n, L"%f", __val); } inline wstring to_wstring(double __val) { const int __n = __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20; return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n, L"%f", __val); } inline wstring to_wstring(long double __val) { const int __n = __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20; return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n, L"%Lf", __val); } #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* C++11 && _GLIBCXX_USE_C99 ... */ #if __cplusplus >= 201103L #include <bits/functional_hash.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // DR 1182. #ifndef _GLIBCXX_COMPATIBILITY_CXX0X /// std::hash specialization for string. template<> struct hash<string> : public __hash_base<size_t, string> { size_t operator()(const string& __s) const noexcept { return std::_Hash_impl::hash(__s.data(), __s.length()); } }; template<> struct __is_fast_hash<hash<string>> : std::false_type { }; #ifdef _GLIBCXX_USE_WCHAR_T /// std::hash specialization for wstring. template<> struct hash<wstring> : public __hash_base<size_t, wstring> { size_t operator()(const wstring& __s) const noexcept { return std::_Hash_impl::hash(__s.data(), __s.length() * sizeof(wchar_t)); } }; template<> struct __is_fast_hash<hash<wstring>> : std::false_type { }; #endif #endif /* _GLIBCXX_COMPATIBILITY_CXX0X */ #ifdef _GLIBCXX_USE_C99_STDINT_TR1 /// std::hash specialization for u16string. template<> struct hash<u16string> : public __hash_base<size_t, u16string> { size_t operator()(const u16string& __s) const noexcept { return std::_Hash_impl::hash(__s.data(), __s.length() * sizeof(char16_t)); } }; template<> struct __is_fast_hash<hash<u16string>> : std::false_type { }; /// std::hash specialization for u32string. template<> struct hash<u32string> : public __hash_base<size_t, u32string> { size_t operator()(const u32string& __s) const noexcept { return std::_Hash_impl::hash(__s.data(), __s.length() * sizeof(char32_t)); } }; template<> struct __is_fast_hash<hash<u32string>> : std::false_type { }; #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // C++11 #endif /* _BASIC_STRING_H */ �����������c++/4.8.2/bits/alloc_traits.h�����������������������������������������������������������������������0000644�����������������00000043244�14763166030�0011374 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Allocator traits -*- C++ -*- // Copyright (C) 2011-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/alloc_traits.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{memory} */ #ifndef _ALLOC_TRAITS_H #define _ALLOC_TRAITS_H 1 #if __cplusplus >= 201103L #include <bits/memoryfwd.h> #include <bits/ptr_traits.h> #include <ext/numeric_traits.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Alloc, typename _Tp> class __alloctr_rebind_helper { template<typename _Alloc2, typename _Tp2> static constexpr bool _S_chk(typename _Alloc2::template rebind<_Tp2>::other*) { return true; } template<typename, typename> static constexpr bool _S_chk(...) { return false; } public: static const bool __value = _S_chk<_Alloc, _Tp>(nullptr); }; template<typename _Alloc, typename _Tp> const bool __alloctr_rebind_helper<_Alloc, _Tp>::__value; template<typename _Alloc, typename _Tp, bool = __alloctr_rebind_helper<_Alloc, _Tp>::__value> struct __alloctr_rebind; template<typename _Alloc, typename _Tp> struct __alloctr_rebind<_Alloc, _Tp, true> { typedef typename _Alloc::template rebind<_Tp>::other __type; }; template<template<typename, typename...> class _Alloc, typename _Tp, typename _Up, typename... _Args> struct __alloctr_rebind<_Alloc<_Up, _Args...>, _Tp, false> { typedef _Alloc<_Tp, _Args...> __type; }; /** * @brief Uniform interface to all allocator types. * @ingroup allocators */ template<typename _Alloc> struct allocator_traits { /// The allocator type typedef _Alloc allocator_type; /// The allocated type typedef typename _Alloc::value_type value_type; #define _GLIBCXX_ALLOC_TR_NESTED_TYPE(_NTYPE, _ALT) \ private: \ template<typename _Tp> \ static typename _Tp::_NTYPE _S_##_NTYPE##_helper(_Tp*); \ static _ALT _S_##_NTYPE##_helper(...); \ typedef decltype(_S_##_NTYPE##_helper((_Alloc*)0)) __##_NTYPE; \ public: _GLIBCXX_ALLOC_TR_NESTED_TYPE(pointer, value_type*) /** * @brief The allocator's pointer type. * * @c Alloc::pointer if that type exists, otherwise @c value_type* */ typedef __pointer pointer; _GLIBCXX_ALLOC_TR_NESTED_TYPE(const_pointer, typename pointer_traits<pointer>::template rebind<const value_type>) /** * @brief The allocator's const pointer type. * * @c Alloc::const_pointer if that type exists, otherwise * <tt> pointer_traits<pointer>::rebind<const value_type> </tt> */ typedef __const_pointer const_pointer; _GLIBCXX_ALLOC_TR_NESTED_TYPE(void_pointer, typename pointer_traits<pointer>::template rebind<void>) /** * @brief The allocator's void pointer type. * * @c Alloc::void_pointer if that type exists, otherwise * <tt> pointer_traits<pointer>::rebind<void> </tt> */ typedef __void_pointer void_pointer; _GLIBCXX_ALLOC_TR_NESTED_TYPE(const_void_pointer, typename pointer_traits<pointer>::template rebind<const void>) /** * @brief The allocator's const void pointer type. * * @c Alloc::const_void_pointer if that type exists, otherwise * <tt> pointer_traits<pointer>::rebind<const void> </tt> */ typedef __const_void_pointer const_void_pointer; _GLIBCXX_ALLOC_TR_NESTED_TYPE(difference_type, typename pointer_traits<pointer>::difference_type) /** * @brief The allocator's difference type * * @c Alloc::difference_type if that type exists, otherwise * <tt> pointer_traits<pointer>::difference_type </tt> */ typedef __difference_type difference_type; _GLIBCXX_ALLOC_TR_NESTED_TYPE(size_type, typename make_unsigned<difference_type>::type) /** * @brief The allocator's size type * * @c Alloc::size_type if that type exists, otherwise * <tt> make_unsigned<difference_type>::type </tt> */ typedef __size_type size_type; _GLIBCXX_ALLOC_TR_NESTED_TYPE(propagate_on_container_copy_assignment, false_type) /** * @brief How the allocator is propagated on copy assignment * * @c Alloc::propagate_on_container_copy_assignment if that type exists, * otherwise @c false_type */ typedef __propagate_on_container_copy_assignment propagate_on_container_copy_assignment; _GLIBCXX_ALLOC_TR_NESTED_TYPE(propagate_on_container_move_assignment, false_type) /** * @brief How the allocator is propagated on move assignment * * @c Alloc::propagate_on_container_move_assignment if that type exists, * otherwise @c false_type */ typedef __propagate_on_container_move_assignment propagate_on_container_move_assignment; _GLIBCXX_ALLOC_TR_NESTED_TYPE(propagate_on_container_swap, false_type) /** * @brief How the allocator is propagated on swap * * @c Alloc::propagate_on_container_swap if that type exists, * otherwise @c false_type */ typedef __propagate_on_container_swap propagate_on_container_swap; #undef _GLIBCXX_ALLOC_TR_NESTED_TYPE template<typename _Tp> using rebind_alloc = typename __alloctr_rebind<_Alloc, _Tp>::__type; template<typename _Tp> using rebind_traits = allocator_traits<rebind_alloc<_Tp>>; private: template<typename _Alloc2> struct __allocate_helper { template<typename _Alloc3, typename = decltype(std::declval<_Alloc3*>()->allocate( std::declval<size_type>(), std::declval<const_void_pointer>()))> static true_type __test(int); template<typename> static false_type __test(...); typedef decltype(__test<_Alloc>(0)) type; static const bool value = type::value; }; template<typename _Alloc2> static typename enable_if<__allocate_helper<_Alloc2>::value, pointer>::type _S_allocate(_Alloc2& __a, size_type __n, const_void_pointer __hint) { return __a.allocate(__n, __hint); } template<typename _Alloc2> static typename enable_if<!__allocate_helper<_Alloc2>::value, pointer>::type _S_allocate(_Alloc2& __a, size_type __n, ...) { return __a.allocate(__n); } template<typename _Tp, typename... _Args> struct __construct_helper { template<typename _Alloc2, typename = decltype(std::declval<_Alloc2*>()->construct( std::declval<_Tp*>(), std::declval<_Args>()...))> static true_type __test(int); template<typename> static false_type __test(...); typedef decltype(__test<_Alloc>(0)) type; static const bool value = type::value; }; template<typename _Tp, typename... _Args> static typename enable_if<__construct_helper<_Tp, _Args...>::value, void>::type _S_construct(_Alloc& __a, _Tp* __p, _Args&&... __args) { __a.construct(__p, std::forward<_Args>(__args)...); } template<typename _Tp, typename... _Args> static typename enable_if<__and_<__not_<__construct_helper<_Tp, _Args...>>, is_constructible<_Tp, _Args...>>::value, void>::type _S_construct(_Alloc&, _Tp* __p, _Args&&... __args) { ::new((void*)__p) _Tp(std::forward<_Args>(__args)...); } template<typename _Tp> struct __destroy_helper { template<typename _Alloc2, typename = decltype(std::declval<_Alloc2*>()->destroy( std::declval<_Tp*>()))> static true_type __test(int); template<typename> static false_type __test(...); typedef decltype(__test<_Alloc>(0)) type; static const bool value = type::value; }; template<typename _Tp> static typename enable_if<__destroy_helper<_Tp>::value, void>::type _S_destroy(_Alloc& __a, _Tp* __p) { __a.destroy(__p); } template<typename _Tp> static typename enable_if<!__destroy_helper<_Tp>::value, void>::type _S_destroy(_Alloc&, _Tp* __p) { __p->~_Tp(); } template<typename _Alloc2> struct __maxsize_helper { template<typename _Alloc3, typename = decltype(std::declval<_Alloc3*>()->max_size())> static true_type __test(int); template<typename> static false_type __test(...); typedef decltype(__test<_Alloc2>(0)) type; static const bool value = type::value; }; template<typename _Alloc2> static typename enable_if<__maxsize_helper<_Alloc2>::value, size_type>::type _S_max_size(_Alloc2& __a) { return __a.max_size(); } template<typename _Alloc2> static typename enable_if<!__maxsize_helper<_Alloc2>::value, size_type>::type _S_max_size(_Alloc2&) { return __gnu_cxx::__numeric_traits<size_type>::__max; } template<typename _Alloc2> struct __select_helper { template<typename _Alloc3, typename = decltype(std::declval<_Alloc3*>() ->select_on_container_copy_construction())> static true_type __test(int); template<typename> static false_type __test(...); typedef decltype(__test<_Alloc2>(0)) type; static const bool value = type::value; }; template<typename _Alloc2> static typename enable_if<__select_helper<_Alloc2>::value, _Alloc2>::type _S_select(_Alloc2& __a) { return __a.select_on_container_copy_construction(); } template<typename _Alloc2> static typename enable_if<!__select_helper<_Alloc2>::value, _Alloc2>::type _S_select(_Alloc2& __a) { return __a; } public: /** * @brief Allocate memory. * @param __a An allocator. * @param __n The number of objects to allocate space for. * * Calls @c a.allocate(n) */ static pointer allocate(_Alloc& __a, size_type __n) { return __a.allocate(__n); } /** * @brief Allocate memory. * @param __a An allocator. * @param __n The number of objects to allocate space for. * @param __hint Aid to locality. * @return Memory of suitable size and alignment for @a n objects * of type @c value_type * * Returns <tt> a.allocate(n, hint) </tt> if that expression is * well-formed, otherwise returns @c a.allocate(n) */ static pointer allocate(_Alloc& __a, size_type __n, const_void_pointer __hint) { return _S_allocate(__a, __n, __hint); } /** * @brief Deallocate memory. * @param __a An allocator. * @param __p Pointer to the memory to deallocate. * @param __n The number of objects space was allocated for. * * Calls <tt> a.deallocate(p, n) </tt> */ static void deallocate(_Alloc& __a, pointer __p, size_type __n) { __a.deallocate(__p, __n); } /** * @brief Construct an object of type @a _Tp * @param __a An allocator. * @param __p Pointer to memory of suitable size and alignment for Tp * @param __args Constructor arguments. * * Calls <tt> __a.construct(__p, std::forward<Args>(__args)...) </tt> * if that expression is well-formed, otherwise uses placement-new * to construct an object of type @a _Tp at location @a __p from the * arguments @a __args... */ template<typename _Tp, typename... _Args> static auto construct(_Alloc& __a, _Tp* __p, _Args&&... __args) -> decltype(_S_construct(__a, __p, std::forward<_Args>(__args)...)) { _S_construct(__a, __p, std::forward<_Args>(__args)...); } /** * @brief Destroy an object of type @a _Tp * @param __a An allocator. * @param __p Pointer to the object to destroy * * Calls @c __a.destroy(__p) if that expression is well-formed, * otherwise calls @c __p->~_Tp() */ template <class _Tp> static void destroy(_Alloc& __a, _Tp* __p) { _S_destroy(__a, __p); } /** * @brief The maximum supported allocation size * @param __a An allocator. * @return @c __a.max_size() or @c numeric_limits<size_type>::max() * * Returns @c __a.max_size() if that expression is well-formed, * otherwise returns @c numeric_limits<size_type>::max() */ static size_type max_size(const _Alloc& __a) { return _S_max_size(__a); } /** * @brief Obtain an allocator to use when copying a container. * @param __rhs An allocator. * @return @c __rhs.select_on_container_copy_construction() or @a __rhs * * Returns @c __rhs.select_on_container_copy_construction() if that * expression is well-formed, otherwise returns @a __rhs */ static _Alloc select_on_container_copy_construction(const _Alloc& __rhs) { return _S_select(__rhs); } }; template<typename _Alloc> template<typename _Alloc2> const bool allocator_traits<_Alloc>::__allocate_helper<_Alloc2>::value; template<typename _Alloc> template<typename _Tp, typename... _Args> const bool allocator_traits<_Alloc>::__construct_helper<_Tp, _Args...>::value; template<typename _Alloc> template<typename _Tp> const bool allocator_traits<_Alloc>::__destroy_helper<_Tp>::value; template<typename _Alloc> template<typename _Alloc2> const bool allocator_traits<_Alloc>::__maxsize_helper<_Alloc2>::value; template<typename _Alloc> template<typename _Alloc2> const bool allocator_traits<_Alloc>::__select_helper<_Alloc2>::value; template<typename _Alloc> inline void __do_alloc_on_copy(_Alloc& __one, const _Alloc& __two, true_type) { __one = __two; } template<typename _Alloc> inline void __do_alloc_on_copy(_Alloc&, const _Alloc&, false_type) { } template<typename _Alloc> inline void __alloc_on_copy(_Alloc& __one, const _Alloc& __two) { typedef allocator_traits<_Alloc> __traits; typedef typename __traits::propagate_on_container_copy_assignment __pocca; __do_alloc_on_copy(__one, __two, __pocca()); } template<typename _Alloc> inline _Alloc __alloc_on_copy(const _Alloc& __a) { typedef allocator_traits<_Alloc> __traits; return __traits::select_on_container_copy_construction(__a); } template<typename _Alloc> inline void __do_alloc_on_move(_Alloc& __one, _Alloc& __two, true_type) { __one = std::move(__two); } template<typename _Alloc> inline void __do_alloc_on_move(_Alloc&, _Alloc&, false_type) { } template<typename _Alloc> inline void __alloc_on_move(_Alloc& __one, _Alloc& __two) { typedef allocator_traits<_Alloc> __traits; typedef typename __traits::propagate_on_container_move_assignment __pocma; __do_alloc_on_move(__one, __two, __pocma()); } template<typename _Alloc> inline void __do_alloc_on_swap(_Alloc& __one, _Alloc& __two, true_type) { using std::swap; swap(__one, __two); } template<typename _Alloc> inline void __do_alloc_on_swap(_Alloc&, _Alloc&, false_type) { } template<typename _Alloc> inline void __alloc_on_swap(_Alloc& __one, _Alloc& __two) { typedef allocator_traits<_Alloc> __traits; typedef typename __traits::propagate_on_container_swap __pocs; __do_alloc_on_swap(__one, __two, __pocs()); } template<typename _Alloc> class __is_copy_insertable_impl { typedef allocator_traits<_Alloc> _Traits; template<typename _Up, typename = decltype(_Traits::construct(std::declval<_Alloc&>(), std::declval<_Up*>(), std::declval<const _Up&>()))> static true_type _M_select(int); template<typename _Up> static false_type _M_select(...); public: typedef decltype(_M_select<typename _Alloc::value_type>(0)) type; }; // true if _Alloc::value_type is CopyInsertable into containers using _Alloc template<typename _Alloc> struct __is_copy_insertable : __is_copy_insertable_impl<_Alloc>::type { }; // std::allocator<_Tp> just requires CopyConstructible template<typename _Tp> struct __is_copy_insertable<allocator<_Tp>> : is_copy_constructible<_Tp> { }; // Used to allow copy construction of unordered containers template<bool> struct __allow_copy_cons { }; // Used to delete copy constructor of unordered containers template<> struct __allow_copy_cons<false> { __allow_copy_cons() = default; __allow_copy_cons(const __allow_copy_cons&) = delete; __allow_copy_cons(__allow_copy_cons&&) = default; __allow_copy_cons& operator=(const __allow_copy_cons&) = default; __allow_copy_cons& operator=(__allow_copy_cons&&) = default; }; template<typename _Alloc> using __check_copy_constructible = __allow_copy_cons<__is_copy_insertable<_Alloc>::value>; _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/list.tcc�����������������������������������������������������������������������������0000644�����������������00000030316�14763166030�0010205 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// List implementation (out of line) -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/list.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{list} */ #ifndef _LIST_TCC #define _LIST_TCC 1 namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER template<typename _Tp, typename _Alloc> void _List_base<_Tp, _Alloc>:: _M_clear() { typedef _List_node<_Tp> _Node; _Node* __cur = static_cast<_Node*>(_M_impl._M_node._M_next); while (__cur != &_M_impl._M_node) { _Node* __tmp = __cur; __cur = static_cast<_Node*>(__cur->_M_next); #if __cplusplus >= 201103L _M_get_Node_allocator().destroy(__tmp); #else _M_get_Tp_allocator().destroy(std::__addressof(__tmp->_M_data)); #endif _M_put_node(__tmp); } } #if __cplusplus >= 201103L template<typename _Tp, typename _Alloc> template<typename... _Args> typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>:: emplace(iterator __position, _Args&&... __args) { _Node* __tmp = _M_create_node(std::forward<_Args>(__args)...); __tmp->_M_hook(__position._M_node); return iterator(__tmp); } #endif template<typename _Tp, typename _Alloc> typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>:: insert(iterator __position, const value_type& __x) { _Node* __tmp = _M_create_node(__x); __tmp->_M_hook(__position._M_node); return iterator(__tmp); } template<typename _Tp, typename _Alloc> typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>:: erase(iterator __position) { iterator __ret = iterator(__position._M_node->_M_next); _M_erase(__position); return __ret; } #if __cplusplus >= 201103L template<typename _Tp, typename _Alloc> void list<_Tp, _Alloc>:: _M_default_append(size_type __n) { size_type __i = 0; __try { for (; __i < __n; ++__i) emplace_back(); } __catch(...) { for (; __i; --__i) pop_back(); __throw_exception_again; } } template<typename _Tp, typename _Alloc> void list<_Tp, _Alloc>:: resize(size_type __new_size) { iterator __i = begin(); size_type __len = 0; for (; __i != end() && __len < __new_size; ++__i, ++__len) ; if (__len == __new_size) erase(__i, end()); else // __i == end() _M_default_append(__new_size - __len); } template<typename _Tp, typename _Alloc> void list<_Tp, _Alloc>:: resize(size_type __new_size, const value_type& __x) { iterator __i = begin(); size_type __len = 0; for (; __i != end() && __len < __new_size; ++__i, ++__len) ; if (__len == __new_size) erase(__i, end()); else // __i == end() insert(end(), __new_size - __len, __x); } #else template<typename _Tp, typename _Alloc> void list<_Tp, _Alloc>:: resize(size_type __new_size, value_type __x) { iterator __i = begin(); size_type __len = 0; for (; __i != end() && __len < __new_size; ++__i, ++__len) ; if (__len == __new_size) erase(__i, end()); else // __i == end() insert(end(), __new_size - __len, __x); } #endif template<typename _Tp, typename _Alloc> list<_Tp, _Alloc>& list<_Tp, _Alloc>:: operator=(const list& __x) { if (this != &__x) { iterator __first1 = begin(); iterator __last1 = end(); const_iterator __first2 = __x.begin(); const_iterator __last2 = __x.end(); for (; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2) *__first1 = *__first2; if (__first2 == __last2) erase(__first1, __last1); else insert(__last1, __first2, __last2); } return *this; } template<typename _Tp, typename _Alloc> void list<_Tp, _Alloc>:: _M_fill_assign(size_type __n, const value_type& __val) { iterator __i = begin(); for (; __i != end() && __n > 0; ++__i, --__n) *__i = __val; if (__n > 0) insert(end(), __n, __val); else erase(__i, end()); } template<typename _Tp, typename _Alloc> template <typename _InputIterator> void list<_Tp, _Alloc>:: _M_assign_dispatch(_InputIterator __first2, _InputIterator __last2, __false_type) { iterator __first1 = begin(); iterator __last1 = end(); for (; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2) *__first1 = *__first2; if (__first2 == __last2) erase(__first1, __last1); else insert(__last1, __first2, __last2); } template<typename _Tp, typename _Alloc> void list<_Tp, _Alloc>:: remove(const value_type& __value) { iterator __first = begin(); iterator __last = end(); iterator __extra = __last; while (__first != __last) { iterator __next = __first; ++__next; if (*__first == __value) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 526. Is it undefined if a function in the standard changes // in parameters? if (std::__addressof(*__first) != std::__addressof(__value)) _M_erase(__first); else __extra = __first; } __first = __next; } if (__extra != __last) _M_erase(__extra); } template<typename _Tp, typename _Alloc> void list<_Tp, _Alloc>:: unique() { iterator __first = begin(); iterator __last = end(); if (__first == __last) return; iterator __next = __first; while (++__next != __last) { if (*__first == *__next) _M_erase(__next); else __first = __next; __next = __first; } } template<typename _Tp, typename _Alloc> void list<_Tp, _Alloc>:: #if __cplusplus >= 201103L merge(list&& __x) #else merge(list& __x) #endif { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 300. list::merge() specification incomplete if (this != &__x) { _M_check_equal_allocators(__x); iterator __first1 = begin(); iterator __last1 = end(); iterator __first2 = __x.begin(); iterator __last2 = __x.end(); while (__first1 != __last1 && __first2 != __last2) if (*__first2 < *__first1) { iterator __next = __first2; _M_transfer(__first1, __first2, ++__next); __first2 = __next; } else ++__first1; if (__first2 != __last2) _M_transfer(__last1, __first2, __last2); } } template<typename _Tp, typename _Alloc> template <typename _StrictWeakOrdering> void list<_Tp, _Alloc>:: #if __cplusplus >= 201103L merge(list&& __x, _StrictWeakOrdering __comp) #else merge(list& __x, _StrictWeakOrdering __comp) #endif { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 300. list::merge() specification incomplete if (this != &__x) { _M_check_equal_allocators(__x); iterator __first1 = begin(); iterator __last1 = end(); iterator __first2 = __x.begin(); iterator __last2 = __x.end(); while (__first1 != __last1 && __first2 != __last2) if (__comp(*__first2, *__first1)) { iterator __next = __first2; _M_transfer(__first1, __first2, ++__next); __first2 = __next; } else ++__first1; if (__first2 != __last2) _M_transfer(__last1, __first2, __last2); } } template<typename _Tp, typename _Alloc> void list<_Tp, _Alloc>:: sort() { // Do nothing if the list has length 0 or 1. if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node) { list __carry; list __tmp[64]; list * __fill = &__tmp[0]; list * __counter; do { __carry.splice(__carry.begin(), *this, begin()); for(__counter = &__tmp[0]; __counter != __fill && !__counter->empty(); ++__counter) { __counter->merge(__carry); __carry.swap(*__counter); } __carry.swap(*__counter); if (__counter == __fill) ++__fill; } while ( !empty() ); for (__counter = &__tmp[1]; __counter != __fill; ++__counter) __counter->merge(*(__counter - 1)); swap( *(__fill - 1) ); } } template<typename _Tp, typename _Alloc> template <typename _Predicate> void list<_Tp, _Alloc>:: remove_if(_Predicate __pred) { iterator __first = begin(); iterator __last = end(); while (__first != __last) { iterator __next = __first; ++__next; if (__pred(*__first)) _M_erase(__first); __first = __next; } } template<typename _Tp, typename _Alloc> template <typename _BinaryPredicate> void list<_Tp, _Alloc>:: unique(_BinaryPredicate __binary_pred) { iterator __first = begin(); iterator __last = end(); if (__first == __last) return; iterator __next = __first; while (++__next != __last) { if (__binary_pred(*__first, *__next)) _M_erase(__next); else __first = __next; __next = __first; } } template<typename _Tp, typename _Alloc> template <typename _StrictWeakOrdering> void list<_Tp, _Alloc>:: sort(_StrictWeakOrdering __comp) { // Do nothing if the list has length 0 or 1. if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node) { list __carry; list __tmp[64]; list * __fill = &__tmp[0]; list * __counter; do { __carry.splice(__carry.begin(), *this, begin()); for(__counter = &__tmp[0]; __counter != __fill && !__counter->empty(); ++__counter) { __counter->merge(__carry, __comp); __carry.swap(*__counter); } __carry.swap(*__counter); if (__counter == __fill) ++__fill; } while ( !empty() ); for (__counter = &__tmp[1]; __counter != __fill; ++__counter) __counter->merge(*(__counter - 1), __comp); swap(*(__fill - 1)); } } _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std #endif /* _LIST_TCC */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/forward_list.tcc���������������������������������������������������������������������0000644�����������������00000036253�14763166030�0011737 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <forward_list.tcc> -*- C++ -*- // Copyright (C) 2008-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/forward_list.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{forward_list} */ #ifndef _FORWARD_LIST_TCC #define _FORWARD_LIST_TCC 1 namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER template<typename _Tp, typename _Alloc> _Fwd_list_base<_Tp, _Alloc>:: _Fwd_list_base(_Fwd_list_base&& __lst, const _Node_alloc_type& __a) : _M_impl(__a) { if (__lst._M_get_Node_allocator() == __a) { this->_M_impl._M_head._M_next = __lst._M_impl._M_head._M_next; __lst._M_impl._M_head._M_next = 0; } else { this->_M_impl._M_head._M_next = 0; _Fwd_list_node_base* __to = &this->_M_impl._M_head; _Node* __curr = static_cast<_Node*>(__lst._M_impl._M_head._M_next); while (__curr) { __to->_M_next = _M_create_node(std::move_if_noexcept(*__curr->_M_valptr())); __to = __to->_M_next; __curr = static_cast<_Node*>(__curr->_M_next); } } } template<typename _Tp, typename _Alloc> template<typename... _Args> _Fwd_list_node_base* _Fwd_list_base<_Tp, _Alloc>:: _M_insert_after(const_iterator __pos, _Args&&... __args) { _Fwd_list_node_base* __to = const_cast<_Fwd_list_node_base*>(__pos._M_node); _Node* __thing = _M_create_node(std::forward<_Args>(__args)...); __thing->_M_next = __to->_M_next; __to->_M_next = __thing; return __to->_M_next; } template<typename _Tp, typename _Alloc> _Fwd_list_node_base* _Fwd_list_base<_Tp, _Alloc>:: _M_erase_after(_Fwd_list_node_base* __pos) { _Node* __curr = static_cast<_Node*>(__pos->_M_next); __pos->_M_next = __curr->_M_next; _Tp_alloc_type __a(_M_get_Node_allocator()); allocator_traits<_Tp_alloc_type>::destroy(__a, __curr->_M_valptr()); __curr->~_Node(); _M_put_node(__curr); return __pos->_M_next; } template<typename _Tp, typename _Alloc> _Fwd_list_node_base* _Fwd_list_base<_Tp, _Alloc>:: _M_erase_after(_Fwd_list_node_base* __pos, _Fwd_list_node_base* __last) { _Node* __curr = static_cast<_Node*>(__pos->_M_next); while (__curr != __last) { _Node* __temp = __curr; __curr = static_cast<_Node*>(__curr->_M_next); _Tp_alloc_type __a(_M_get_Node_allocator()); allocator_traits<_Tp_alloc_type>::destroy(__a, __temp->_M_valptr()); __temp->~_Node(); _M_put_node(__temp); } __pos->_M_next = __last; return __last; } // Called by the range constructor to implement [23.3.4.2]/9 template<typename _Tp, typename _Alloc> template<typename _InputIterator> void forward_list<_Tp, _Alloc>:: _M_range_initialize(_InputIterator __first, _InputIterator __last) { _Node_base* __to = &this->_M_impl._M_head; for (; __first != __last; ++__first) { __to->_M_next = this->_M_create_node(*__first); __to = __to->_M_next; } } // Called by forward_list(n,v,a). template<typename _Tp, typename _Alloc> void forward_list<_Tp, _Alloc>:: _M_fill_initialize(size_type __n, const value_type& __value) { _Node_base* __to = &this->_M_impl._M_head; for (; __n; --__n) { __to->_M_next = this->_M_create_node(__value); __to = __to->_M_next; } } template<typename _Tp, typename _Alloc> void forward_list<_Tp, _Alloc>:: _M_default_initialize(size_type __n) { _Node_base* __to = &this->_M_impl._M_head; for (; __n; --__n) { __to->_M_next = this->_M_create_node(); __to = __to->_M_next; } } template<typename _Tp, typename _Alloc> forward_list<_Tp, _Alloc>& forward_list<_Tp, _Alloc>:: operator=(const forward_list& __list) { if (&__list != this) { if (_Node_alloc_traits::_S_propagate_on_copy_assign()) { auto& __this_alloc = this->_M_get_Node_allocator(); auto& __that_alloc = __list._M_get_Node_allocator(); if (!_Node_alloc_traits::_S_always_equal() && __this_alloc != __that_alloc) { // replacement allocator cannot free existing storage clear(); } std::__alloc_on_copy(__this_alloc, __that_alloc); } assign(__list.cbegin(), __list.cend()); } return *this; } template<typename _Tp, typename _Alloc> void forward_list<_Tp, _Alloc>:: _M_default_insert_after(const_iterator __pos, size_type __n) { const_iterator __saved_pos = __pos; __try { for (; __n; --__n) __pos = emplace_after(__pos); } __catch(...) { erase_after(__saved_pos, ++__pos); __throw_exception_again; } } template<typename _Tp, typename _Alloc> void forward_list<_Tp, _Alloc>:: resize(size_type __sz) { iterator __k = before_begin(); size_type __len = 0; while (__k._M_next() != end() && __len < __sz) { ++__k; ++__len; } if (__len == __sz) erase_after(__k, end()); else _M_default_insert_after(__k, __sz - __len); } template<typename _Tp, typename _Alloc> void forward_list<_Tp, _Alloc>:: resize(size_type __sz, const value_type& __val) { iterator __k = before_begin(); size_type __len = 0; while (__k._M_next() != end() && __len < __sz) { ++__k; ++__len; } if (__len == __sz) erase_after(__k, end()); else insert_after(__k, __sz - __len, __val); } template<typename _Tp, typename _Alloc> typename forward_list<_Tp, _Alloc>::iterator forward_list<_Tp, _Alloc>:: _M_splice_after(const_iterator __pos, const_iterator __before, const_iterator __last) { _Node_base* __tmp = const_cast<_Node_base*>(__pos._M_node); _Node_base* __b = const_cast<_Node_base*>(__before._M_node); _Node_base* __end = __b; while (__end && __end->_M_next != __last._M_node) __end = __end->_M_next; if (__b != __end) return iterator(__tmp->_M_transfer_after(__b, __end)); else return iterator(__tmp); } template<typename _Tp, typename _Alloc> void forward_list<_Tp, _Alloc>:: splice_after(const_iterator __pos, forward_list&&, const_iterator __i) { const_iterator __j = __i; ++__j; if (__pos == __i || __pos == __j) return; _Node_base* __tmp = const_cast<_Node_base*>(__pos._M_node); __tmp->_M_transfer_after(const_cast<_Node_base*>(__i._M_node), const_cast<_Node_base*>(__j._M_node)); } template<typename _Tp, typename _Alloc> typename forward_list<_Tp, _Alloc>::iterator forward_list<_Tp, _Alloc>:: insert_after(const_iterator __pos, size_type __n, const _Tp& __val) { if (__n) { forward_list __tmp(__n, __val, get_allocator()); return _M_splice_after(__pos, __tmp.before_begin(), __tmp.end()); } else return iterator(const_cast<_Node_base*>(__pos._M_node)); } template<typename _Tp, typename _Alloc> template<typename _InputIterator, typename> typename forward_list<_Tp, _Alloc>::iterator forward_list<_Tp, _Alloc>:: insert_after(const_iterator __pos, _InputIterator __first, _InputIterator __last) { forward_list __tmp(__first, __last, get_allocator()); if (!__tmp.empty()) return _M_splice_after(__pos, __tmp.before_begin(), __tmp.end()); else return iterator(const_cast<_Node_base*>(__pos._M_node)); } template<typename _Tp, typename _Alloc> void forward_list<_Tp, _Alloc>:: remove(const _Tp& __val) { _Node* __curr = static_cast<_Node*>(&this->_M_impl._M_head); _Node* __extra = 0; while (_Node* __tmp = static_cast<_Node*>(__curr->_M_next)) { if (*__tmp->_M_valptr() == __val) { if (__tmp->_M_valptr() != std::__addressof(__val)) { this->_M_erase_after(__curr); continue; } else __extra = __curr; } __curr = static_cast<_Node*>(__curr->_M_next); } if (__extra) this->_M_erase_after(__extra); } template<typename _Tp, typename _Alloc> template<typename _Pred> void forward_list<_Tp, _Alloc>:: remove_if(_Pred __pred) { _Node* __curr = static_cast<_Node*>(&this->_M_impl._M_head); while (_Node* __tmp = static_cast<_Node*>(__curr->_M_next)) { if (__pred(*__tmp->_M_valptr())) this->_M_erase_after(__curr); else __curr = static_cast<_Node*>(__curr->_M_next); } } template<typename _Tp, typename _Alloc> template<typename _BinPred> void forward_list<_Tp, _Alloc>:: unique(_BinPred __binary_pred) { iterator __first = begin(); iterator __last = end(); if (__first == __last) return; iterator __next = __first; while (++__next != __last) { if (__binary_pred(*__first, *__next)) erase_after(__first); else __first = __next; __next = __first; } } template<typename _Tp, typename _Alloc> template<typename _Comp> void forward_list<_Tp, _Alloc>:: merge(forward_list&& __list, _Comp __comp) { _Node_base* __node = &this->_M_impl._M_head; while (__node->_M_next && __list._M_impl._M_head._M_next) { if (__comp(*static_cast<_Node*> (__list._M_impl._M_head._M_next)->_M_valptr(), *static_cast<_Node*> (__node->_M_next)->_M_valptr())) __node->_M_transfer_after(&__list._M_impl._M_head, __list._M_impl._M_head._M_next); __node = __node->_M_next; } if (__list._M_impl._M_head._M_next) { __node->_M_next = __list._M_impl._M_head._M_next; __list._M_impl._M_head._M_next = 0; } } template<typename _Tp, typename _Alloc> bool operator==(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly) { // We don't have size() so we need to walk through both lists // making sure both iterators are valid. auto __ix = __lx.cbegin(); auto __iy = __ly.cbegin(); while (__ix != __lx.cend() && __iy != __ly.cend()) { if (*__ix != *__iy) return false; ++__ix; ++__iy; } if (__ix == __lx.cend() && __iy == __ly.cend()) return true; else return false; } template<typename _Tp, class _Alloc> template<typename _Comp> void forward_list<_Tp, _Alloc>:: sort(_Comp __comp) { // If `next' is 0, return immediately. _Node* __list = static_cast<_Node*>(this->_M_impl._M_head._M_next); if (!__list) return; unsigned long __insize = 1; while (1) { _Node* __p = __list; __list = 0; _Node* __tail = 0; // Count number of merges we do in this pass. unsigned long __nmerges = 0; while (__p) { ++__nmerges; // There exists a merge to be done. // Step `insize' places along from p. _Node* __q = __p; unsigned long __psize = 0; for (unsigned long __i = 0; __i < __insize; ++__i) { ++__psize; __q = static_cast<_Node*>(__q->_M_next); if (!__q) break; } // If q hasn't fallen off end, we have two lists to merge. unsigned long __qsize = __insize; // Now we have two lists; merge them. while (__psize > 0 || (__qsize > 0 && __q)) { // Decide whether next node of merge comes from p or q. _Node* __e; if (__psize == 0) { // p is empty; e must come from q. __e = __q; __q = static_cast<_Node*>(__q->_M_next); --__qsize; } else if (__qsize == 0 || !__q) { // q is empty; e must come from p. __e = __p; __p = static_cast<_Node*>(__p->_M_next); --__psize; } else if (__comp(*__p->_M_valptr(), *__q->_M_valptr())) { // First node of p is lower; e must come from p. __e = __p; __p = static_cast<_Node*>(__p->_M_next); --__psize; } else { // First node of q is lower; e must come from q. __e = __q; __q = static_cast<_Node*>(__q->_M_next); --__qsize; } // Add the next node to the merged list. if (__tail) __tail->_M_next = __e; else __list = __e; __tail = __e; } // Now p has stepped `insize' places along, and q has too. __p = __q; } __tail->_M_next = 0; // If we have done only one merge, we're finished. // Allow for nmerges == 0, the empty list case. if (__nmerges <= 1) { this->_M_impl._M_head._M_next = __list; return; } // Otherwise repeat, merging lists twice the size. __insize *= 2; } } _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std #endif /* _FORWARD_LIST_TCC */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/locale_facets.h����������������������������������������������������������������������0000644�����������������00000261533�14763166030�0011503 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Locale support -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/locale_facets.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{locale} */ // // ISO C++ 14882: 22.1 Locales // #ifndef _LOCALE_FACETS_H #define _LOCALE_FACETS_H 1 #pragma GCC system_header #include <cwctype> // For wctype_t #include <cctype> #include <bits/ctype_base.h> #include <iosfwd> #include <bits/ios_base.h> // For ios_base, ios_base::iostate #include <streambuf> #include <bits/cpp_type_traits.h> #include <ext/type_traits.h> #include <ext/numeric_traits.h> #include <bits/streambuf_iterator.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // NB: Don't instantiate required wchar_t facets if no wchar_t support. #ifdef _GLIBCXX_USE_WCHAR_T # define _GLIBCXX_NUM_FACETS 28 #else # define _GLIBCXX_NUM_FACETS 14 #endif // Convert string to numeric value of type _Tp and store results. // NB: This is specialized for all required types, there is no // generic definition. template<typename _Tp> void __convert_to_v(const char*, _Tp&, ios_base::iostate&, const __c_locale&) throw(); // Explicit specializations for required types. template<> void __convert_to_v(const char*, float&, ios_base::iostate&, const __c_locale&) throw(); template<> void __convert_to_v(const char*, double&, ios_base::iostate&, const __c_locale&) throw(); template<> void __convert_to_v(const char*, long double&, ios_base::iostate&, const __c_locale&) throw(); // NB: __pad is a struct, rather than a function, so it can be // partially-specialized. template<typename _CharT, typename _Traits> struct __pad { static void _S_pad(ios_base& __io, _CharT __fill, _CharT* __news, const _CharT* __olds, streamsize __newlen, streamsize __oldlen); }; // Used by both numeric and monetary facets. // Inserts "group separator" characters into an array of characters. // It's recursive, one iteration per group. It moves the characters // in the buffer this way: "xxxx12345" -> "12,345xxx". Call this // only with __gsize != 0. template<typename _CharT> _CharT* __add_grouping(_CharT* __s, _CharT __sep, const char* __gbeg, size_t __gsize, const _CharT* __first, const _CharT* __last); // This template permits specializing facet output code for // ostreambuf_iterator. For ostreambuf_iterator, sputn is // significantly more efficient than incrementing iterators. template<typename _CharT> inline ostreambuf_iterator<_CharT> __write(ostreambuf_iterator<_CharT> __s, const _CharT* __ws, int __len) { __s._M_put(__ws, __len); return __s; } // This is the unspecialized form of the template. template<typename _CharT, typename _OutIter> inline _OutIter __write(_OutIter __s, const _CharT* __ws, int __len) { for (int __j = 0; __j < __len; __j++, ++__s) *__s = __ws[__j]; return __s; } // 22.2.1.1 Template class ctype // Include host and configuration specific ctype enums for ctype_base. /** * @brief Common base for ctype facet * * This template class provides implementations of the public functions * that forward to the protected virtual functions. * * This template also provides abstract stubs for the protected virtual * functions. */ template<typename _CharT> class __ctype_abstract_base : public locale::facet, public ctype_base { public: // Types: /// Typedef for the template parameter typedef _CharT char_type; /** * @brief Test char_type classification. * * This function finds a mask M for @a __c and compares it to * mask @a __m. It does so by returning the value of * ctype<char_type>::do_is(). * * @param __c The char_type to compare the mask of. * @param __m The mask to compare against. * @return (M & __m) != 0. */ bool is(mask __m, char_type __c) const { return this->do_is(__m, __c); } /** * @brief Return a mask array. * * This function finds the mask for each char_type in the range [lo,hi) * and successively writes it to vec. vec must have as many elements * as the char array. It does so by returning the value of * ctype<char_type>::do_is(). * * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @param __vec Pointer to an array of mask storage. * @return @a __hi. */ const char_type* is(const char_type *__lo, const char_type *__hi, mask *__vec) const { return this->do_is(__lo, __hi, __vec); } /** * @brief Find char_type matching a mask * * This function searches for and returns the first char_type c in * [lo,hi) for which is(m,c) is true. It does so by returning * ctype<char_type>::do_scan_is(). * * @param __m The mask to compare against. * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @return Pointer to matching char_type if found, else @a __hi. */ const char_type* scan_is(mask __m, const char_type* __lo, const char_type* __hi) const { return this->do_scan_is(__m, __lo, __hi); } /** * @brief Find char_type not matching a mask * * This function searches for and returns the first char_type c in * [lo,hi) for which is(m,c) is false. It does so by returning * ctype<char_type>::do_scan_not(). * * @param __m The mask to compare against. * @param __lo Pointer to first char in range. * @param __hi Pointer to end of range. * @return Pointer to non-matching char if found, else @a __hi. */ const char_type* scan_not(mask __m, const char_type* __lo, const char_type* __hi) const { return this->do_scan_not(__m, __lo, __hi); } /** * @brief Convert to uppercase. * * This function converts the argument to uppercase if possible. * If not possible (for example, '2'), returns the argument. It does * so by returning ctype<char_type>::do_toupper(). * * @param __c The char_type to convert. * @return The uppercase char_type if convertible, else @a __c. */ char_type toupper(char_type __c) const { return this->do_toupper(__c); } /** * @brief Convert array to uppercase. * * This function converts each char_type in the range [lo,hi) to * uppercase if possible. Other elements remain untouched. It does so * by returning ctype<char_type>:: do_toupper(lo, hi). * * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @return @a __hi. */ const char_type* toupper(char_type *__lo, const char_type* __hi) const { return this->do_toupper(__lo, __hi); } /** * @brief Convert to lowercase. * * This function converts the argument to lowercase if possible. If * not possible (for example, '2'), returns the argument. It does so * by returning ctype<char_type>::do_tolower(c). * * @param __c The char_type to convert. * @return The lowercase char_type if convertible, else @a __c. */ char_type tolower(char_type __c) const { return this->do_tolower(__c); } /** * @brief Convert array to lowercase. * * This function converts each char_type in the range [__lo,__hi) to * lowercase if possible. Other elements remain untouched. It does so * by returning ctype<char_type>:: do_tolower(__lo, __hi). * * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @return @a __hi. */ const char_type* tolower(char_type* __lo, const char_type* __hi) const { return this->do_tolower(__lo, __hi); } /** * @brief Widen char to char_type * * This function converts the char argument to char_type using the * simplest reasonable transformation. It does so by returning * ctype<char_type>::do_widen(c). * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __c The char to convert. * @return The converted char_type. */ char_type widen(char __c) const { return this->do_widen(__c); } /** * @brief Widen array to char_type * * This function converts each char in the input to char_type using the * simplest reasonable transformation. It does so by returning * ctype<char_type>::do_widen(c). * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @param __to Pointer to the destination array. * @return @a __hi. */ const char* widen(const char* __lo, const char* __hi, char_type* __to) const { return this->do_widen(__lo, __hi, __to); } /** * @brief Narrow char_type to char * * This function converts the char_type to char using the simplest * reasonable transformation. If the conversion fails, dfault is * returned instead. It does so by returning * ctype<char_type>::do_narrow(__c). * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __c The char_type to convert. * @param __dfault Char to return if conversion fails. * @return The converted char. */ char narrow(char_type __c, char __dfault) const { return this->do_narrow(__c, __dfault); } /** * @brief Narrow array to char array * * This function converts each char_type in the input to char using the * simplest reasonable transformation and writes the results to the * destination array. For any char_type in the input that cannot be * converted, @a dfault is used instead. It does so by returning * ctype<char_type>::do_narrow(__lo, __hi, __dfault, __to). * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @param __dfault Char to use if conversion fails. * @param __to Pointer to the destination array. * @return @a __hi. */ const char_type* narrow(const char_type* __lo, const char_type* __hi, char __dfault, char* __to) const { return this->do_narrow(__lo, __hi, __dfault, __to); } protected: explicit __ctype_abstract_base(size_t __refs = 0): facet(__refs) { } virtual ~__ctype_abstract_base() { } /** * @brief Test char_type classification. * * This function finds a mask M for @a c and compares it to mask @a m. * * do_is() is a hook for a derived facet to change the behavior of * classifying. do_is() must always return the same result for the * same input. * * @param __c The char_type to find the mask of. * @param __m The mask to compare against. * @return (M & __m) != 0. */ virtual bool do_is(mask __m, char_type __c) const = 0; /** * @brief Return a mask array. * * This function finds the mask for each char_type in the range [lo,hi) * and successively writes it to vec. vec must have as many elements * as the input. * * do_is() is a hook for a derived facet to change the behavior of * classifying. do_is() must always return the same result for the * same input. * * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @param __vec Pointer to an array of mask storage. * @return @a __hi. */ virtual const char_type* do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const = 0; /** * @brief Find char_type matching mask * * This function searches for and returns the first char_type c in * [__lo,__hi) for which is(__m,c) is true. * * do_scan_is() is a hook for a derived facet to change the behavior of * match searching. do_is() must always return the same result for the * same input. * * @param __m The mask to compare against. * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @return Pointer to a matching char_type if found, else @a __hi. */ virtual const char_type* do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const = 0; /** * @brief Find char_type not matching mask * * This function searches for and returns a pointer to the first * char_type c of [lo,hi) for which is(m,c) is false. * * do_scan_is() is a hook for a derived facet to change the behavior of * match searching. do_is() must always return the same result for the * same input. * * @param __m The mask to compare against. * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @return Pointer to a non-matching char_type if found, else @a __hi. */ virtual const char_type* do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const = 0; /** * @brief Convert to uppercase. * * This virtual function converts the char_type argument to uppercase * if possible. If not possible (for example, '2'), returns the * argument. * * do_toupper() is a hook for a derived facet to change the behavior of * uppercasing. do_toupper() must always return the same result for * the same input. * * @param __c The char_type to convert. * @return The uppercase char_type if convertible, else @a __c. */ virtual char_type do_toupper(char_type __c) const = 0; /** * @brief Convert array to uppercase. * * This virtual function converts each char_type in the range [__lo,__hi) * to uppercase if possible. Other elements remain untouched. * * do_toupper() is a hook for a derived facet to change the behavior of * uppercasing. do_toupper() must always return the same result for * the same input. * * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @return @a __hi. */ virtual const char_type* do_toupper(char_type* __lo, const char_type* __hi) const = 0; /** * @brief Convert to lowercase. * * This virtual function converts the argument to lowercase if * possible. If not possible (for example, '2'), returns the argument. * * do_tolower() is a hook for a derived facet to change the behavior of * lowercasing. do_tolower() must always return the same result for * the same input. * * @param __c The char_type to convert. * @return The lowercase char_type if convertible, else @a __c. */ virtual char_type do_tolower(char_type __c) const = 0; /** * @brief Convert array to lowercase. * * This virtual function converts each char_type in the range [__lo,__hi) * to lowercase if possible. Other elements remain untouched. * * do_tolower() is a hook for a derived facet to change the behavior of * lowercasing. do_tolower() must always return the same result for * the same input. * * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @return @a __hi. */ virtual const char_type* do_tolower(char_type* __lo, const char_type* __hi) const = 0; /** * @brief Widen char * * This virtual function converts the char to char_type using the * simplest reasonable transformation. * * do_widen() is a hook for a derived facet to change the behavior of * widening. do_widen() must always return the same result for the * same input. * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __c The char to convert. * @return The converted char_type */ virtual char_type do_widen(char __c) const = 0; /** * @brief Widen char array * * This function converts each char in the input to char_type using the * simplest reasonable transformation. * * do_widen() is a hook for a derived facet to change the behavior of * widening. do_widen() must always return the same result for the * same input. * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __lo Pointer to start range. * @param __hi Pointer to end of range. * @param __to Pointer to the destination array. * @return @a __hi. */ virtual const char* do_widen(const char* __lo, const char* __hi, char_type* __to) const = 0; /** * @brief Narrow char_type to char * * This virtual function converts the argument to char using the * simplest reasonable transformation. If the conversion fails, dfault * is returned instead. * * do_narrow() is a hook for a derived facet to change the behavior of * narrowing. do_narrow() must always return the same result for the * same input. * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __c The char_type to convert. * @param __dfault Char to return if conversion fails. * @return The converted char. */ virtual char do_narrow(char_type __c, char __dfault) const = 0; /** * @brief Narrow char_type array to char * * This virtual function converts each char_type in the range * [__lo,__hi) to char using the simplest reasonable * transformation and writes the results to the destination * array. For any element in the input that cannot be * converted, @a __dfault is used instead. * * do_narrow() is a hook for a derived facet to change the behavior of * narrowing. do_narrow() must always return the same result for the * same input. * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @param __dfault Char to use if conversion fails. * @param __to Pointer to the destination array. * @return @a __hi. */ virtual const char_type* do_narrow(const char_type* __lo, const char_type* __hi, char __dfault, char* __to) const = 0; }; /** * @brief Primary class template ctype facet. * @ingroup locales * * This template class defines classification and conversion functions for * character sets. It wraps cctype functionality. Ctype gets used by * streams for many I/O operations. * * This template provides the protected virtual functions the developer * will have to replace in a derived class or specialization to make a * working facet. The public functions that access them are defined in * __ctype_abstract_base, to allow for implementation flexibility. See * ctype<wchar_t> for an example. The functions are documented in * __ctype_abstract_base. * * Note: implementations are provided for all the protected virtual * functions, but will likely not be useful. */ template<typename _CharT> class ctype : public __ctype_abstract_base<_CharT> { public: // Types: typedef _CharT char_type; typedef typename __ctype_abstract_base<_CharT>::mask mask; /// The facet id for ctype<char_type> static locale::id id; explicit ctype(size_t __refs = 0) : __ctype_abstract_base<_CharT>(__refs) { } protected: virtual ~ctype(); virtual bool do_is(mask __m, char_type __c) const; virtual const char_type* do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const; virtual const char_type* do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const; virtual const char_type* do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const; virtual char_type do_toupper(char_type __c) const; virtual const char_type* do_toupper(char_type* __lo, const char_type* __hi) const; virtual char_type do_tolower(char_type __c) const; virtual const char_type* do_tolower(char_type* __lo, const char_type* __hi) const; virtual char_type do_widen(char __c) const; virtual const char* do_widen(const char* __lo, const char* __hi, char_type* __dest) const; virtual char do_narrow(char_type, char __dfault) const; virtual const char_type* do_narrow(const char_type* __lo, const char_type* __hi, char __dfault, char* __to) const; }; template<typename _CharT> locale::id ctype<_CharT>::id; /** * @brief The ctype<char> specialization. * @ingroup locales * * This class defines classification and conversion functions for * the char type. It gets used by char streams for many I/O * operations. The char specialization provides a number of * optimizations as well. */ template<> class ctype<char> : public locale::facet, public ctype_base { public: // Types: /// Typedef for the template parameter char. typedef char char_type; protected: // Data Members: __c_locale _M_c_locale_ctype; bool _M_del; __to_type _M_toupper; __to_type _M_tolower; const mask* _M_table; mutable char _M_widen_ok; mutable char _M_widen[1 + static_cast<unsigned char>(-1)]; mutable char _M_narrow[1 + static_cast<unsigned char>(-1)]; mutable char _M_narrow_ok; // 0 uninitialized, 1 init, // 2 memcpy can't be used public: /// The facet id for ctype<char> static locale::id id; /// The size of the mask table. It is SCHAR_MAX + 1. static const size_t table_size = 1 + static_cast<unsigned char>(-1); /** * @brief Constructor performs initialization. * * This is the constructor provided by the standard. * * @param __table If non-zero, table is used as the per-char mask. * Else classic_table() is used. * @param __del If true, passes ownership of table to this facet. * @param __refs Passed to the base facet class. */ explicit ctype(const mask* __table = 0, bool __del = false, size_t __refs = 0); /** * @brief Constructor performs static initialization. * * This constructor is used to construct the initial C locale facet. * * @param __cloc Handle to C locale data. * @param __table If non-zero, table is used as the per-char mask. * @param __del If true, passes ownership of table to this facet. * @param __refs Passed to the base facet class. */ explicit ctype(__c_locale __cloc, const mask* __table = 0, bool __del = false, size_t __refs = 0); /** * @brief Test char classification. * * This function compares the mask table[c] to @a __m. * * @param __c The char to compare the mask of. * @param __m The mask to compare against. * @return True if __m & table[__c] is true, false otherwise. */ inline bool is(mask __m, char __c) const; /** * @brief Return a mask array. * * This function finds the mask for each char in the range [lo, hi) and * successively writes it to vec. vec must have as many elements as * the char array. * * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @param __vec Pointer to an array of mask storage. * @return @a __hi. */ inline const char* is(const char* __lo, const char* __hi, mask* __vec) const; /** * @brief Find char matching a mask * * This function searches for and returns the first char in [lo,hi) for * which is(m,char) is true. * * @param __m The mask to compare against. * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @return Pointer to a matching char if found, else @a __hi. */ inline const char* scan_is(mask __m, const char* __lo, const char* __hi) const; /** * @brief Find char not matching a mask * * This function searches for and returns a pointer to the first char * in [__lo,__hi) for which is(m,char) is false. * * @param __m The mask to compare against. * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @return Pointer to a non-matching char if found, else @a __hi. */ inline const char* scan_not(mask __m, const char* __lo, const char* __hi) const; /** * @brief Convert to uppercase. * * This function converts the char argument to uppercase if possible. * If not possible (for example, '2'), returns the argument. * * toupper() acts as if it returns ctype<char>::do_toupper(c). * do_toupper() must always return the same result for the same input. * * @param __c The char to convert. * @return The uppercase char if convertible, else @a __c. */ char_type toupper(char_type __c) const { return this->do_toupper(__c); } /** * @brief Convert array to uppercase. * * This function converts each char in the range [__lo,__hi) to uppercase * if possible. Other chars remain untouched. * * toupper() acts as if it returns ctype<char>:: do_toupper(__lo, __hi). * do_toupper() must always return the same result for the same input. * * @param __lo Pointer to first char in range. * @param __hi Pointer to end of range. * @return @a __hi. */ const char_type* toupper(char_type *__lo, const char_type* __hi) const { return this->do_toupper(__lo, __hi); } /** * @brief Convert to lowercase. * * This function converts the char argument to lowercase if possible. * If not possible (for example, '2'), returns the argument. * * tolower() acts as if it returns ctype<char>::do_tolower(__c). * do_tolower() must always return the same result for the same input. * * @param __c The char to convert. * @return The lowercase char if convertible, else @a __c. */ char_type tolower(char_type __c) const { return this->do_tolower(__c); } /** * @brief Convert array to lowercase. * * This function converts each char in the range [lo,hi) to lowercase * if possible. Other chars remain untouched. * * tolower() acts as if it returns ctype<char>:: do_tolower(__lo, __hi). * do_tolower() must always return the same result for the same input. * * @param __lo Pointer to first char in range. * @param __hi Pointer to end of range. * @return @a __hi. */ const char_type* tolower(char_type* __lo, const char_type* __hi) const { return this->do_tolower(__lo, __hi); } /** * @brief Widen char * * This function converts the char to char_type using the simplest * reasonable transformation. For an underived ctype<char> facet, the * argument will be returned unchanged. * * This function works as if it returns ctype<char>::do_widen(c). * do_widen() must always return the same result for the same input. * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __c The char to convert. * @return The converted character. */ char_type widen(char __c) const { if (_M_widen_ok) return _M_widen[static_cast<unsigned char>(__c)]; this->_M_widen_init(); return this->do_widen(__c); } /** * @brief Widen char array * * This function converts each char in the input to char using the * simplest reasonable transformation. For an underived ctype<char> * facet, the argument will be copied unchanged. * * This function works as if it returns ctype<char>::do_widen(c). * do_widen() must always return the same result for the same input. * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __lo Pointer to first char in range. * @param __hi Pointer to end of range. * @param __to Pointer to the destination array. * @return @a __hi. */ const char* widen(const char* __lo, const char* __hi, char_type* __to) const { if (_M_widen_ok == 1) { __builtin_memcpy(__to, __lo, __hi - __lo); return __hi; } if (!_M_widen_ok) _M_widen_init(); return this->do_widen(__lo, __hi, __to); } /** * @brief Narrow char * * This function converts the char to char using the simplest * reasonable transformation. If the conversion fails, dfault is * returned instead. For an underived ctype<char> facet, @a c * will be returned unchanged. * * This function works as if it returns ctype<char>::do_narrow(c). * do_narrow() must always return the same result for the same input. * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __c The char to convert. * @param __dfault Char to return if conversion fails. * @return The converted character. */ char narrow(char_type __c, char __dfault) const { if (_M_narrow[static_cast<unsigned char>(__c)]) return _M_narrow[static_cast<unsigned char>(__c)]; const char __t = do_narrow(__c, __dfault); if (__t != __dfault) _M_narrow[static_cast<unsigned char>(__c)] = __t; return __t; } /** * @brief Narrow char array * * This function converts each char in the input to char using the * simplest reasonable transformation and writes the results to the * destination array. For any char in the input that cannot be * converted, @a dfault is used instead. For an underived ctype<char> * facet, the argument will be copied unchanged. * * This function works as if it returns ctype<char>::do_narrow(lo, hi, * dfault, to). do_narrow() must always return the same result for the * same input. * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @param __dfault Char to use if conversion fails. * @param __to Pointer to the destination array. * @return @a __hi. */ const char_type* narrow(const char_type* __lo, const char_type* __hi, char __dfault, char* __to) const { if (__builtin_expect(_M_narrow_ok == 1, true)) { __builtin_memcpy(__to, __lo, __hi - __lo); return __hi; } if (!_M_narrow_ok) _M_narrow_init(); return this->do_narrow(__lo, __hi, __dfault, __to); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 695. ctype<char>::classic_table() not accessible. /// Returns a pointer to the mask table provided to the constructor, or /// the default from classic_table() if none was provided. const mask* table() const throw() { return _M_table; } /// Returns a pointer to the C locale mask table. static const mask* classic_table() throw(); protected: /** * @brief Destructor. * * This function deletes table() if @a del was true in the * constructor. */ virtual ~ctype(); /** * @brief Convert to uppercase. * * This virtual function converts the char argument to uppercase if * possible. If not possible (for example, '2'), returns the argument. * * do_toupper() is a hook for a derived facet to change the behavior of * uppercasing. do_toupper() must always return the same result for * the same input. * * @param __c The char to convert. * @return The uppercase char if convertible, else @a __c. */ virtual char_type do_toupper(char_type __c) const; /** * @brief Convert array to uppercase. * * This virtual function converts each char in the range [lo,hi) to * uppercase if possible. Other chars remain untouched. * * do_toupper() is a hook for a derived facet to change the behavior of * uppercasing. do_toupper() must always return the same result for * the same input. * * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @return @a __hi. */ virtual const char_type* do_toupper(char_type* __lo, const char_type* __hi) const; /** * @brief Convert to lowercase. * * This virtual function converts the char argument to lowercase if * possible. If not possible (for example, '2'), returns the argument. * * do_tolower() is a hook for a derived facet to change the behavior of * lowercasing. do_tolower() must always return the same result for * the same input. * * @param __c The char to convert. * @return The lowercase char if convertible, else @a __c. */ virtual char_type do_tolower(char_type __c) const; /** * @brief Convert array to lowercase. * * This virtual function converts each char in the range [lo,hi) to * lowercase if possible. Other chars remain untouched. * * do_tolower() is a hook for a derived facet to change the behavior of * lowercasing. do_tolower() must always return the same result for * the same input. * * @param __lo Pointer to first char in range. * @param __hi Pointer to end of range. * @return @a __hi. */ virtual const char_type* do_tolower(char_type* __lo, const char_type* __hi) const; /** * @brief Widen char * * This virtual function converts the char to char using the simplest * reasonable transformation. For an underived ctype<char> facet, the * argument will be returned unchanged. * * do_widen() is a hook for a derived facet to change the behavior of * widening. do_widen() must always return the same result for the * same input. * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __c The char to convert. * @return The converted character. */ virtual char_type do_widen(char __c) const { return __c; } /** * @brief Widen char array * * This function converts each char in the range [lo,hi) to char using * the simplest reasonable transformation. For an underived * ctype<char> facet, the argument will be copied unchanged. * * do_widen() is a hook for a derived facet to change the behavior of * widening. do_widen() must always return the same result for the * same input. * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @param __to Pointer to the destination array. * @return @a __hi. */ virtual const char* do_widen(const char* __lo, const char* __hi, char_type* __to) const { __builtin_memcpy(__to, __lo, __hi - __lo); return __hi; } /** * @brief Narrow char * * This virtual function converts the char to char using the simplest * reasonable transformation. If the conversion fails, dfault is * returned instead. For an underived ctype<char> facet, @a c will be * returned unchanged. * * do_narrow() is a hook for a derived facet to change the behavior of * narrowing. do_narrow() must always return the same result for the * same input. * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __c The char to convert. * @param __dfault Char to return if conversion fails. * @return The converted char. */ virtual char do_narrow(char_type __c, char __dfault) const { return __c; } /** * @brief Narrow char array to char array * * This virtual function converts each char in the range [lo,hi) to * char using the simplest reasonable transformation and writes the * results to the destination array. For any char in the input that * cannot be converted, @a dfault is used instead. For an underived * ctype<char> facet, the argument will be copied unchanged. * * do_narrow() is a hook for a derived facet to change the behavior of * narrowing. do_narrow() must always return the same result for the * same input. * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @param __dfault Char to use if conversion fails. * @param __to Pointer to the destination array. * @return @a __hi. */ virtual const char_type* do_narrow(const char_type* __lo, const char_type* __hi, char __dfault, char* __to) const { __builtin_memcpy(__to, __lo, __hi - __lo); return __hi; } private: void _M_narrow_init() const; void _M_widen_init() const; }; #ifdef _GLIBCXX_USE_WCHAR_T /** * @brief The ctype<wchar_t> specialization. * @ingroup locales * * This class defines classification and conversion functions for the * wchar_t type. It gets used by wchar_t streams for many I/O operations. * The wchar_t specialization provides a number of optimizations as well. * * ctype<wchar_t> inherits its public methods from * __ctype_abstract_base<wchar_t>. */ template<> class ctype<wchar_t> : public __ctype_abstract_base<wchar_t> { public: // Types: /// Typedef for the template parameter wchar_t. typedef wchar_t char_type; typedef wctype_t __wmask_type; protected: __c_locale _M_c_locale_ctype; // Pre-computed narrowed and widened chars. bool _M_narrow_ok; char _M_narrow[128]; wint_t _M_widen[1 + static_cast<unsigned char>(-1)]; // Pre-computed elements for do_is. mask _M_bit[16]; __wmask_type _M_wmask[16]; public: // Data Members: /// The facet id for ctype<wchar_t> static locale::id id; /** * @brief Constructor performs initialization. * * This is the constructor provided by the standard. * * @param __refs Passed to the base facet class. */ explicit ctype(size_t __refs = 0); /** * @brief Constructor performs static initialization. * * This constructor is used to construct the initial C locale facet. * * @param __cloc Handle to C locale data. * @param __refs Passed to the base facet class. */ explicit ctype(__c_locale __cloc, size_t __refs = 0); protected: __wmask_type _M_convert_to_wmask(const mask __m) const throw(); /// Destructor virtual ~ctype(); /** * @brief Test wchar_t classification. * * This function finds a mask M for @a c and compares it to mask @a m. * * do_is() is a hook for a derived facet to change the behavior of * classifying. do_is() must always return the same result for the * same input. * * @param __c The wchar_t to find the mask of. * @param __m The mask to compare against. * @return (M & __m) != 0. */ virtual bool do_is(mask __m, char_type __c) const; /** * @brief Return a mask array. * * This function finds the mask for each wchar_t in the range [lo,hi) * and successively writes it to vec. vec must have as many elements * as the input. * * do_is() is a hook for a derived facet to change the behavior of * classifying. do_is() must always return the same result for the * same input. * * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @param __vec Pointer to an array of mask storage. * @return @a __hi. */ virtual const char_type* do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const; /** * @brief Find wchar_t matching mask * * This function searches for and returns the first wchar_t c in * [__lo,__hi) for which is(__m,c) is true. * * do_scan_is() is a hook for a derived facet to change the behavior of * match searching. do_is() must always return the same result for the * same input. * * @param __m The mask to compare against. * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @return Pointer to a matching wchar_t if found, else @a __hi. */ virtual const char_type* do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const; /** * @brief Find wchar_t not matching mask * * This function searches for and returns a pointer to the first * wchar_t c of [__lo,__hi) for which is(__m,c) is false. * * do_scan_is() is a hook for a derived facet to change the behavior of * match searching. do_is() must always return the same result for the * same input. * * @param __m The mask to compare against. * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @return Pointer to a non-matching wchar_t if found, else @a __hi. */ virtual const char_type* do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const; /** * @brief Convert to uppercase. * * This virtual function converts the wchar_t argument to uppercase if * possible. If not possible (for example, '2'), returns the argument. * * do_toupper() is a hook for a derived facet to change the behavior of * uppercasing. do_toupper() must always return the same result for * the same input. * * @param __c The wchar_t to convert. * @return The uppercase wchar_t if convertible, else @a __c. */ virtual char_type do_toupper(char_type __c) const; /** * @brief Convert array to uppercase. * * This virtual function converts each wchar_t in the range [lo,hi) to * uppercase if possible. Other elements remain untouched. * * do_toupper() is a hook for a derived facet to change the behavior of * uppercasing. do_toupper() must always return the same result for * the same input. * * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @return @a __hi. */ virtual const char_type* do_toupper(char_type* __lo, const char_type* __hi) const; /** * @brief Convert to lowercase. * * This virtual function converts the argument to lowercase if * possible. If not possible (for example, '2'), returns the argument. * * do_tolower() is a hook for a derived facet to change the behavior of * lowercasing. do_tolower() must always return the same result for * the same input. * * @param __c The wchar_t to convert. * @return The lowercase wchar_t if convertible, else @a __c. */ virtual char_type do_tolower(char_type __c) const; /** * @brief Convert array to lowercase. * * This virtual function converts each wchar_t in the range [lo,hi) to * lowercase if possible. Other elements remain untouched. * * do_tolower() is a hook for a derived facet to change the behavior of * lowercasing. do_tolower() must always return the same result for * the same input. * * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @return @a __hi. */ virtual const char_type* do_tolower(char_type* __lo, const char_type* __hi) const; /** * @brief Widen char to wchar_t * * This virtual function converts the char to wchar_t using the * simplest reasonable transformation. For an underived ctype<wchar_t> * facet, the argument will be cast to wchar_t. * * do_widen() is a hook for a derived facet to change the behavior of * widening. do_widen() must always return the same result for the * same input. * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __c The char to convert. * @return The converted wchar_t. */ virtual char_type do_widen(char __c) const; /** * @brief Widen char array to wchar_t array * * This function converts each char in the input to wchar_t using the * simplest reasonable transformation. For an underived ctype<wchar_t> * facet, the argument will be copied, casting each element to wchar_t. * * do_widen() is a hook for a derived facet to change the behavior of * widening. do_widen() must always return the same result for the * same input. * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __lo Pointer to start range. * @param __hi Pointer to end of range. * @param __to Pointer to the destination array. * @return @a __hi. */ virtual const char* do_widen(const char* __lo, const char* __hi, char_type* __to) const; /** * @brief Narrow wchar_t to char * * This virtual function converts the argument to char using * the simplest reasonable transformation. If the conversion * fails, dfault is returned instead. For an underived * ctype<wchar_t> facet, @a c will be cast to char and * returned. * * do_narrow() is a hook for a derived facet to change the * behavior of narrowing. do_narrow() must always return the * same result for the same input. * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __c The wchar_t to convert. * @param __dfault Char to return if conversion fails. * @return The converted char. */ virtual char do_narrow(char_type __c, char __dfault) const; /** * @brief Narrow wchar_t array to char array * * This virtual function converts each wchar_t in the range [lo,hi) to * char using the simplest reasonable transformation and writes the * results to the destination array. For any wchar_t in the input that * cannot be converted, @a dfault is used instead. For an underived * ctype<wchar_t> facet, the argument will be copied, casting each * element to char. * * do_narrow() is a hook for a derived facet to change the behavior of * narrowing. do_narrow() must always return the same result for the * same input. * * Note: this is not what you want for codepage conversions. See * codecvt for that. * * @param __lo Pointer to start of range. * @param __hi Pointer to end of range. * @param __dfault Char to use if conversion fails. * @param __to Pointer to the destination array. * @return @a __hi. */ virtual const char_type* do_narrow(const char_type* __lo, const char_type* __hi, char __dfault, char* __to) const; // For use at construction time only. void _M_initialize_ctype() throw(); }; #endif //_GLIBCXX_USE_WCHAR_T /// class ctype_byname [22.2.1.2]. template<typename _CharT> class ctype_byname : public ctype<_CharT> { public: typedef typename ctype<_CharT>::mask mask; explicit ctype_byname(const char* __s, size_t __refs = 0); protected: virtual ~ctype_byname() { }; }; /// 22.2.1.4 Class ctype_byname specializations. template<> class ctype_byname<char> : public ctype<char> { public: explicit ctype_byname(const char* __s, size_t __refs = 0); protected: virtual ~ctype_byname(); }; #ifdef _GLIBCXX_USE_WCHAR_T template<> class ctype_byname<wchar_t> : public ctype<wchar_t> { public: explicit ctype_byname(const char* __s, size_t __refs = 0); protected: virtual ~ctype_byname(); }; #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace // Include host and configuration specific ctype inlines. #include <bits/ctype_inline.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // 22.2.2 The numeric category. class __num_base { public: // NB: Code depends on the order of _S_atoms_out elements. // Below are the indices into _S_atoms_out. enum { _S_ominus, _S_oplus, _S_ox, _S_oX, _S_odigits, _S_odigits_end = _S_odigits + 16, _S_oudigits = _S_odigits_end, _S_oudigits_end = _S_oudigits + 16, _S_oe = _S_odigits + 14, // For scientific notation, 'e' _S_oE = _S_oudigits + 14, // For scientific notation, 'E' _S_oend = _S_oudigits_end }; // A list of valid numeric literals for output. This array // contains chars that will be passed through the current locale's // ctype<_CharT>.widen() and then used to render numbers. // For the standard "C" locale, this is // "-+xX0123456789abcdef0123456789ABCDEF". static const char* _S_atoms_out; // String literal of acceptable (narrow) input, for num_get. // "-+xX0123456789abcdefABCDEF" static const char* _S_atoms_in; enum { _S_iminus, _S_iplus, _S_ix, _S_iX, _S_izero, _S_ie = _S_izero + 14, _S_iE = _S_izero + 20, _S_iend = 26 }; // num_put // Construct and return valid scanf format for floating point types. static void _S_format_float(const ios_base& __io, char* __fptr, char __mod) throw(); }; template<typename _CharT> struct __numpunct_cache : public locale::facet { const char* _M_grouping; size_t _M_grouping_size; bool _M_use_grouping; const _CharT* _M_truename; size_t _M_truename_size; const _CharT* _M_falsename; size_t _M_falsename_size; _CharT _M_decimal_point; _CharT _M_thousands_sep; // A list of valid numeric literals for output: in the standard // "C" locale, this is "-+xX0123456789abcdef0123456789ABCDEF". // This array contains the chars after having been passed // through the current locale's ctype<_CharT>.widen(). _CharT _M_atoms_out[__num_base::_S_oend]; // A list of valid numeric literals for input: in the standard // "C" locale, this is "-+xX0123456789abcdefABCDEF" // This array contains the chars after having been passed // through the current locale's ctype<_CharT>.widen(). _CharT _M_atoms_in[__num_base::_S_iend]; bool _M_allocated; __numpunct_cache(size_t __refs = 0) : facet(__refs), _M_grouping(0), _M_grouping_size(0), _M_use_grouping(false), _M_truename(0), _M_truename_size(0), _M_falsename(0), _M_falsename_size(0), _M_decimal_point(_CharT()), _M_thousands_sep(_CharT()), _M_allocated(false) { } ~__numpunct_cache(); void _M_cache(const locale& __loc); private: __numpunct_cache& operator=(const __numpunct_cache&); explicit __numpunct_cache(const __numpunct_cache&); }; template<typename _CharT> __numpunct_cache<_CharT>::~__numpunct_cache() { if (_M_allocated) { delete [] _M_grouping; delete [] _M_truename; delete [] _M_falsename; } } /** * @brief Primary class template numpunct. * @ingroup locales * * This facet stores several pieces of information related to printing and * scanning numbers, such as the decimal point character. It takes a * template parameter specifying the char type. The numpunct facet is * used by streams for many I/O operations involving numbers. * * The numpunct template uses protected virtual functions to provide the * actual results. The public accessors forward the call to the virtual * functions. These virtual functions are hooks for developers to * implement the behavior they require from a numpunct facet. */ template<typename _CharT> class numpunct : public locale::facet { public: // Types: //@{ /// Public typedefs typedef _CharT char_type; typedef basic_string<_CharT> string_type; //@} typedef __numpunct_cache<_CharT> __cache_type; protected: __cache_type* _M_data; public: /// Numpunct facet id. static locale::id id; /** * @brief Numpunct constructor. * * @param __refs Refcount to pass to the base class. */ explicit numpunct(size_t __refs = 0) : facet(__refs), _M_data(0) { _M_initialize_numpunct(); } /** * @brief Internal constructor. Not for general use. * * This is a constructor for use by the library itself to set up the * predefined locale facets. * * @param __cache __numpunct_cache object. * @param __refs Refcount to pass to the base class. */ explicit numpunct(__cache_type* __cache, size_t __refs = 0) : facet(__refs), _M_data(__cache) { _M_initialize_numpunct(); } /** * @brief Internal constructor. Not for general use. * * This is a constructor for use by the library itself to set up new * locales. * * @param __cloc The C locale. * @param __refs Refcount to pass to the base class. */ explicit numpunct(__c_locale __cloc, size_t __refs = 0) : facet(__refs), _M_data(0) { _M_initialize_numpunct(__cloc); } /** * @brief Return decimal point character. * * This function returns a char_type to use as a decimal point. It * does so by returning returning * numpunct<char_type>::do_decimal_point(). * * @return @a char_type representing a decimal point. */ char_type decimal_point() const { return this->do_decimal_point(); } /** * @brief Return thousands separator character. * * This function returns a char_type to use as a thousands * separator. It does so by returning returning * numpunct<char_type>::do_thousands_sep(). * * @return char_type representing a thousands separator. */ char_type thousands_sep() const { return this->do_thousands_sep(); } /** * @brief Return grouping specification. * * This function returns a string representing groupings for the * integer part of a number. Groupings indicate where thousands * separators should be inserted in the integer part of a number. * * Each char in the return string is interpret as an integer * rather than a character. These numbers represent the number * of digits in a group. The first char in the string * represents the number of digits in the least significant * group. If a char is negative, it indicates an unlimited * number of digits for the group. If more chars from the * string are required to group a number, the last char is used * repeatedly. * * For example, if the grouping() returns "\003\002" and is * applied to the number 123456789, this corresponds to * 12,34,56,789. Note that if the string was "32", this would * put more than 50 digits into the least significant group if * the character set is ASCII. * * The string is returned by calling * numpunct<char_type>::do_grouping(). * * @return string representing grouping specification. */ string grouping() const { return this->do_grouping(); } /** * @brief Return string representation of bool true. * * This function returns a string_type containing the text * representation for true bool variables. It does so by calling * numpunct<char_type>::do_truename(). * * @return string_type representing printed form of true. */ string_type truename() const { return this->do_truename(); } /** * @brief Return string representation of bool false. * * This function returns a string_type containing the text * representation for false bool variables. It does so by calling * numpunct<char_type>::do_falsename(). * * @return string_type representing printed form of false. */ string_type falsename() const { return this->do_falsename(); } protected: /// Destructor. virtual ~numpunct(); /** * @brief Return decimal point character. * * Returns a char_type to use as a decimal point. This function is a * hook for derived classes to change the value returned. * * @return @a char_type representing a decimal point. */ virtual char_type do_decimal_point() const { return _M_data->_M_decimal_point; } /** * @brief Return thousands separator character. * * Returns a char_type to use as a thousands separator. This function * is a hook for derived classes to change the value returned. * * @return @a char_type representing a thousands separator. */ virtual char_type do_thousands_sep() const { return _M_data->_M_thousands_sep; } /** * @brief Return grouping specification. * * Returns a string representing groupings for the integer part of a * number. This function is a hook for derived classes to change the * value returned. @see grouping() for details. * * @return String representing grouping specification. */ virtual string do_grouping() const { return _M_data->_M_grouping; } /** * @brief Return string representation of bool true. * * Returns a string_type containing the text representation for true * bool variables. This function is a hook for derived classes to * change the value returned. * * @return string_type representing printed form of true. */ virtual string_type do_truename() const { return _M_data->_M_truename; } /** * @brief Return string representation of bool false. * * Returns a string_type containing the text representation for false * bool variables. This function is a hook for derived classes to * change the value returned. * * @return string_type representing printed form of false. */ virtual string_type do_falsename() const { return _M_data->_M_falsename; } // For use at construction time only. void _M_initialize_numpunct(__c_locale __cloc = 0); }; template<typename _CharT> locale::id numpunct<_CharT>::id; template<> numpunct<char>::~numpunct(); template<> void numpunct<char>::_M_initialize_numpunct(__c_locale __cloc); #ifdef _GLIBCXX_USE_WCHAR_T template<> numpunct<wchar_t>::~numpunct(); template<> void numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc); #endif /// class numpunct_byname [22.2.3.2]. template<typename _CharT> class numpunct_byname : public numpunct<_CharT> { public: typedef _CharT char_type; typedef basic_string<_CharT> string_type; explicit numpunct_byname(const char* __s, size_t __refs = 0) : numpunct<_CharT>(__refs) { if (__builtin_strcmp(__s, "C") != 0 && __builtin_strcmp(__s, "POSIX") != 0) { __c_locale __tmp; this->_S_create_c_locale(__tmp, __s); this->_M_initialize_numpunct(__tmp); this->_S_destroy_c_locale(__tmp); } } protected: virtual ~numpunct_byname() { } }; _GLIBCXX_BEGIN_NAMESPACE_LDBL /** * @brief Primary class template num_get. * @ingroup locales * * This facet encapsulates the code to parse and return a number * from a string. It is used by the istream numeric extraction * operators. * * The num_get template uses protected virtual functions to provide the * actual results. The public accessors forward the call to the virtual * functions. These virtual functions are hooks for developers to * implement the behavior they require from the num_get facet. */ template<typename _CharT, typename _InIter> class num_get : public locale::facet { public: // Types: //@{ /// Public typedefs typedef _CharT char_type; typedef _InIter iter_type; //@} /// Numpunct facet id. static locale::id id; /** * @brief Constructor performs initialization. * * This is the constructor provided by the standard. * * @param __refs Passed to the base facet class. */ explicit num_get(size_t __refs = 0) : facet(__refs) { } /** * @brief Numeric parsing. * * Parses the input stream into the bool @a v. It does so by calling * num_get::do_get(). * * If ios_base::boolalpha is set, attempts to read * ctype<CharT>::truename() or ctype<CharT>::falsename(). Sets * @a v to true or false if successful. Sets err to * ios_base::failbit if reading the string fails. Sets err to * ios_base::eofbit if the stream is emptied. * * If ios_base::boolalpha is not set, proceeds as with reading a long, * except if the value is 1, sets @a v to true, if the value is 0, sets * @a v to false, and otherwise set err to ios_base::failbit. * * @param __in Start of input stream. * @param __end End of input stream. * @param __io Source of locale and flags. * @param __err Error flags to set. * @param __v Value to format and insert. * @return Iterator after reading. */ iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, bool& __v) const { return this->do_get(__in, __end, __io, __err, __v); } //@{ /** * @brief Numeric parsing. * * Parses the input stream into the integral variable @a v. It does so * by calling num_get::do_get(). * * Parsing is affected by the flag settings in @a io. * * The basic parse is affected by the value of io.flags() & * ios_base::basefield. If equal to ios_base::oct, parses like the * scanf %o specifier. Else if equal to ios_base::hex, parses like %X * specifier. Else if basefield equal to 0, parses like the %i * specifier. Otherwise, parses like %d for signed and %u for unsigned * types. The matching type length modifier is also used. * * Digit grouping is interpreted according to * numpunct::grouping() and numpunct::thousands_sep(). If the * pattern of digit groups isn't consistent, sets err to * ios_base::failbit. * * If parsing the string yields a valid value for @a v, @a v is set. * Otherwise, sets err to ios_base::failbit and leaves @a v unaltered. * Sets err to ios_base::eofbit if the stream is emptied. * * @param __in Start of input stream. * @param __end End of input stream. * @param __io Source of locale and flags. * @param __err Error flags to set. * @param __v Value to format and insert. * @return Iterator after reading. */ iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, long& __v) const { return this->do_get(__in, __end, __io, __err, __v); } iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, unsigned short& __v) const { return this->do_get(__in, __end, __io, __err, __v); } iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, unsigned int& __v) const { return this->do_get(__in, __end, __io, __err, __v); } iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, unsigned long& __v) const { return this->do_get(__in, __end, __io, __err, __v); } #ifdef _GLIBCXX_USE_LONG_LONG iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, long long& __v) const { return this->do_get(__in, __end, __io, __err, __v); } iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, unsigned long long& __v) const { return this->do_get(__in, __end, __io, __err, __v); } #endif //@} //@{ /** * @brief Numeric parsing. * * Parses the input stream into the integral variable @a v. It does so * by calling num_get::do_get(). * * The input characters are parsed like the scanf %g specifier. The * matching type length modifier is also used. * * The decimal point character used is numpunct::decimal_point(). * Digit grouping is interpreted according to * numpunct::grouping() and numpunct::thousands_sep(). If the * pattern of digit groups isn't consistent, sets err to * ios_base::failbit. * * If parsing the string yields a valid value for @a v, @a v is set. * Otherwise, sets err to ios_base::failbit and leaves @a v unaltered. * Sets err to ios_base::eofbit if the stream is emptied. * * @param __in Start of input stream. * @param __end End of input stream. * @param __io Source of locale and flags. * @param __err Error flags to set. * @param __v Value to format and insert. * @return Iterator after reading. */ iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, float& __v) const { return this->do_get(__in, __end, __io, __err, __v); } iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, double& __v) const { return this->do_get(__in, __end, __io, __err, __v); } iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, long double& __v) const { return this->do_get(__in, __end, __io, __err, __v); } //@} /** * @brief Numeric parsing. * * Parses the input stream into the pointer variable @a v. It does so * by calling num_get::do_get(). * * The input characters are parsed like the scanf %p specifier. * * Digit grouping is interpreted according to * numpunct::grouping() and numpunct::thousands_sep(). If the * pattern of digit groups isn't consistent, sets err to * ios_base::failbit. * * Note that the digit grouping effect for pointers is a bit ambiguous * in the standard and shouldn't be relied on. See DR 344. * * If parsing the string yields a valid value for @a v, @a v is set. * Otherwise, sets err to ios_base::failbit and leaves @a v unaltered. * Sets err to ios_base::eofbit if the stream is emptied. * * @param __in Start of input stream. * @param __end End of input stream. * @param __io Source of locale and flags. * @param __err Error flags to set. * @param __v Value to format and insert. * @return Iterator after reading. */ iter_type get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, void*& __v) const { return this->do_get(__in, __end, __io, __err, __v); } protected: /// Destructor. virtual ~num_get() { } iter_type _M_extract_float(iter_type, iter_type, ios_base&, ios_base::iostate&, string&) const; template<typename _ValueT> iter_type _M_extract_int(iter_type, iter_type, ios_base&, ios_base::iostate&, _ValueT&) const; template<typename _CharT2> typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, int>::__type _M_find(const _CharT2*, size_t __len, _CharT2 __c) const { int __ret = -1; if (__len <= 10) { if (__c >= _CharT2('0') && __c < _CharT2(_CharT2('0') + __len)) __ret = __c - _CharT2('0'); } else { if (__c >= _CharT2('0') && __c <= _CharT2('9')) __ret = __c - _CharT2('0'); else if (__c >= _CharT2('a') && __c <= _CharT2('f')) __ret = 10 + (__c - _CharT2('a')); else if (__c >= _CharT2('A') && __c <= _CharT2('F')) __ret = 10 + (__c - _CharT2('A')); } return __ret; } template<typename _CharT2> typename __gnu_cxx::__enable_if<!__is_char<_CharT2>::__value, int>::__type _M_find(const _CharT2* __zero, size_t __len, _CharT2 __c) const { int __ret = -1; const char_type* __q = char_traits<_CharT2>::find(__zero, __len, __c); if (__q) { __ret = __q - __zero; if (__ret > 15) __ret -= 6; } return __ret; } //@{ /** * @brief Numeric parsing. * * Parses the input stream into the variable @a v. This function is a * hook for derived classes to change the value returned. @see get() * for more details. * * @param __beg Start of input stream. * @param __end End of input stream. * @param __io Source of locale and flags. * @param __err Error flags to set. * @param __v Value to format and insert. * @return Iterator after reading. */ virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const; virtual iter_type do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, long& __v) const { return _M_extract_int(__beg, __end, __io, __err, __v); } virtual iter_type do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, unsigned short& __v) const { return _M_extract_int(__beg, __end, __io, __err, __v); } virtual iter_type do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, unsigned int& __v) const { return _M_extract_int(__beg, __end, __io, __err, __v); } virtual iter_type do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, unsigned long& __v) const { return _M_extract_int(__beg, __end, __io, __err, __v); } #ifdef _GLIBCXX_USE_LONG_LONG virtual iter_type do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, long long& __v) const { return _M_extract_int(__beg, __end, __io, __err, __v); } virtual iter_type do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, unsigned long long& __v) const { return _M_extract_int(__beg, __end, __io, __err, __v); } #endif virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, float&) const; virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, double&) const; // XXX GLIBCXX_ABI Deprecated #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ virtual iter_type __do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, double&) const; #else virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, long double&) const; #endif virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, void*&) const; // XXX GLIBCXX_ABI Deprecated #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ virtual iter_type do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, long double&) const; #endif //@} }; template<typename _CharT, typename _InIter> locale::id num_get<_CharT, _InIter>::id; /** * @brief Primary class template num_put. * @ingroup locales * * This facet encapsulates the code to convert a number to a string. It is * used by the ostream numeric insertion operators. * * The num_put template uses protected virtual functions to provide the * actual results. The public accessors forward the call to the virtual * functions. These virtual functions are hooks for developers to * implement the behavior they require from the num_put facet. */ template<typename _CharT, typename _OutIter> class num_put : public locale::facet { public: // Types: //@{ /// Public typedefs typedef _CharT char_type; typedef _OutIter iter_type; //@} /// Numpunct facet id. static locale::id id; /** * @brief Constructor performs initialization. * * This is the constructor provided by the standard. * * @param __refs Passed to the base facet class. */ explicit num_put(size_t __refs = 0) : facet(__refs) { } /** * @brief Numeric formatting. * * Formats the boolean @a v and inserts it into a stream. It does so * by calling num_put::do_put(). * * If ios_base::boolalpha is set, writes ctype<CharT>::truename() or * ctype<CharT>::falsename(). Otherwise formats @a v as an int. * * @param __s Stream to write to. * @param __io Source of locale and flags. * @param __fill Char_type to use for filling. * @param __v Value to format and insert. * @return Iterator after writing. */ iter_type put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const { return this->do_put(__s, __io, __fill, __v); } //@{ /** * @brief Numeric formatting. * * Formats the integral value @a v and inserts it into a * stream. It does so by calling num_put::do_put(). * * Formatting is affected by the flag settings in @a io. * * The basic format is affected by the value of io.flags() & * ios_base::basefield. If equal to ios_base::oct, formats like the * printf %o specifier. Else if equal to ios_base::hex, formats like * %x or %X with ios_base::uppercase unset or set respectively. * Otherwise, formats like %d, %ld, %lld for signed and %u, %lu, %llu * for unsigned values. Note that if both oct and hex are set, neither * will take effect. * * If ios_base::showpos is set, '+' is output before positive values. * If ios_base::showbase is set, '0' precedes octal values (except 0) * and '0[xX]' precedes hex values. * * The decimal point character used is numpunct::decimal_point(). * Thousands separators are inserted according to * numpunct::grouping() and numpunct::thousands_sep(). * * If io.width() is non-zero, enough @a fill characters are inserted to * make the result at least that wide. If * (io.flags() & ios_base::adjustfield) == ios_base::left, result is * padded at the end. If ios_base::internal, then padding occurs * immediately after either a '+' or '-' or after '0x' or '0X'. * Otherwise, padding occurs at the beginning. * * @param __s Stream to write to. * @param __io Source of locale and flags. * @param __fill Char_type to use for filling. * @param __v Value to format and insert. * @return Iterator after writing. */ iter_type put(iter_type __s, ios_base& __io, char_type __fill, long __v) const { return this->do_put(__s, __io, __fill, __v); } iter_type put(iter_type __s, ios_base& __io, char_type __fill, unsigned long __v) const { return this->do_put(__s, __io, __fill, __v); } #ifdef _GLIBCXX_USE_LONG_LONG iter_type put(iter_type __s, ios_base& __io, char_type __fill, long long __v) const { return this->do_put(__s, __io, __fill, __v); } iter_type put(iter_type __s, ios_base& __io, char_type __fill, unsigned long long __v) const { return this->do_put(__s, __io, __fill, __v); } #endif //@} //@{ /** * @brief Numeric formatting. * * Formats the floating point value @a v and inserts it into a stream. * It does so by calling num_put::do_put(). * * Formatting is affected by the flag settings in @a io. * * The basic format is affected by the value of io.flags() & * ios_base::floatfield. If equal to ios_base::fixed, formats like the * printf %f specifier. Else if equal to ios_base::scientific, formats * like %e or %E with ios_base::uppercase unset or set respectively. * Otherwise, formats like %g or %G depending on uppercase. Note that * if both fixed and scientific are set, the effect will also be like * %g or %G. * * The output precision is given by io.precision(). This precision is * capped at numeric_limits::digits10 + 2 (different for double and * long double). The default precision is 6. * * If ios_base::showpos is set, '+' is output before positive values. * If ios_base::showpoint is set, a decimal point will always be * output. * * The decimal point character used is numpunct::decimal_point(). * Thousands separators are inserted according to * numpunct::grouping() and numpunct::thousands_sep(). * * If io.width() is non-zero, enough @a fill characters are inserted to * make the result at least that wide. If * (io.flags() & ios_base::adjustfield) == ios_base::left, result is * padded at the end. If ios_base::internal, then padding occurs * immediately after either a '+' or '-' or after '0x' or '0X'. * Otherwise, padding occurs at the beginning. * * @param __s Stream to write to. * @param __io Source of locale and flags. * @param __fill Char_type to use for filling. * @param __v Value to format and insert. * @return Iterator after writing. */ iter_type put(iter_type __s, ios_base& __io, char_type __fill, double __v) const { return this->do_put(__s, __io, __fill, __v); } iter_type put(iter_type __s, ios_base& __io, char_type __fill, long double __v) const { return this->do_put(__s, __io, __fill, __v); } //@} /** * @brief Numeric formatting. * * Formats the pointer value @a v and inserts it into a stream. It * does so by calling num_put::do_put(). * * This function formats @a v as an unsigned long with ios_base::hex * and ios_base::showbase set. * * @param __s Stream to write to. * @param __io Source of locale and flags. * @param __fill Char_type to use for filling. * @param __v Value to format and insert. * @return Iterator after writing. */ iter_type put(iter_type __s, ios_base& __io, char_type __fill, const void* __v) const { return this->do_put(__s, __io, __fill, __v); } protected: template<typename _ValueT> iter_type _M_insert_float(iter_type, ios_base& __io, char_type __fill, char __mod, _ValueT __v) const; void _M_group_float(const char* __grouping, size_t __grouping_size, char_type __sep, const char_type* __p, char_type* __new, char_type* __cs, int& __len) const; template<typename _ValueT> iter_type _M_insert_int(iter_type, ios_base& __io, char_type __fill, _ValueT __v) const; void _M_group_int(const char* __grouping, size_t __grouping_size, char_type __sep, ios_base& __io, char_type* __new, char_type* __cs, int& __len) const; void _M_pad(char_type __fill, streamsize __w, ios_base& __io, char_type* __new, const char_type* __cs, int& __len) const; /// Destructor. virtual ~num_put() { }; //@{ /** * @brief Numeric formatting. * * These functions do the work of formatting numeric values and * inserting them into a stream. This function is a hook for derived * classes to change the value returned. * * @param __s Stream to write to. * @param __io Source of locale and flags. * @param __fill Char_type to use for filling. * @param __v Value to format and insert. * @return Iterator after writing. */ virtual iter_type do_put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const; virtual iter_type do_put(iter_type __s, ios_base& __io, char_type __fill, long __v) const { return _M_insert_int(__s, __io, __fill, __v); } virtual iter_type do_put(iter_type __s, ios_base& __io, char_type __fill, unsigned long __v) const { return _M_insert_int(__s, __io, __fill, __v); } #ifdef _GLIBCXX_USE_LONG_LONG virtual iter_type do_put(iter_type __s, ios_base& __io, char_type __fill, long long __v) const { return _M_insert_int(__s, __io, __fill, __v); } virtual iter_type do_put(iter_type __s, ios_base& __io, char_type __fill, unsigned long long __v) const { return _M_insert_int(__s, __io, __fill, __v); } #endif virtual iter_type do_put(iter_type, ios_base&, char_type, double) const; // XXX GLIBCXX_ABI Deprecated #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ virtual iter_type __do_put(iter_type, ios_base&, char_type, double) const; #else virtual iter_type do_put(iter_type, ios_base&, char_type, long double) const; #endif virtual iter_type do_put(iter_type, ios_base&, char_type, const void*) const; // XXX GLIBCXX_ABI Deprecated #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ virtual iter_type do_put(iter_type, ios_base&, char_type, long double) const; #endif //@} }; template <typename _CharT, typename _OutIter> locale::id num_put<_CharT, _OutIter>::id; _GLIBCXX_END_NAMESPACE_LDBL // Subclause convenience interfaces, inlines. // NB: These are inline because, when used in a loop, some compilers // can hoist the body out of the loop; then it's just as fast as the // C is*() function. /// Convenience interface to ctype.is(ctype_base::space, __c). template<typename _CharT> inline bool isspace(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c); } /// Convenience interface to ctype.is(ctype_base::print, __c). template<typename _CharT> inline bool isprint(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c); } /// Convenience interface to ctype.is(ctype_base::cntrl, __c). template<typename _CharT> inline bool iscntrl(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c); } /// Convenience interface to ctype.is(ctype_base::upper, __c). template<typename _CharT> inline bool isupper(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c); } /// Convenience interface to ctype.is(ctype_base::lower, __c). template<typename _CharT> inline bool islower(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); } /// Convenience interface to ctype.is(ctype_base::alpha, __c). template<typename _CharT> inline bool isalpha(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c); } /// Convenience interface to ctype.is(ctype_base::digit, __c). template<typename _CharT> inline bool isdigit(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c); } /// Convenience interface to ctype.is(ctype_base::punct, __c). template<typename _CharT> inline bool ispunct(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c); } /// Convenience interface to ctype.is(ctype_base::xdigit, __c). template<typename _CharT> inline bool isxdigit(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c); } /// Convenience interface to ctype.is(ctype_base::alnum, __c). template<typename _CharT> inline bool isalnum(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c); } /// Convenience interface to ctype.is(ctype_base::graph, __c). template<typename _CharT> inline bool isgraph(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c); } /// Convenience interface to ctype.toupper(__c). template<typename _CharT> inline _CharT toupper(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).toupper(__c); } /// Convenience interface to ctype.tolower(__c). template<typename _CharT> inline _CharT tolower(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).tolower(__c); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std # include <bits/locale_facets.tcc> #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/locale_facets.tcc��������������������������������������������������������������������0000644�����������������00000114027�14763166030�0012020 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Locale support -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/locale_facets.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{locale} */ #ifndef _LOCALE_FACETS_TCC #define _LOCALE_FACETS_TCC 1 #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Routine to access a cache for the facet. If the cache didn't // exist before, it gets constructed on the fly. template<typename _Facet> struct __use_cache { const _Facet* operator() (const locale& __loc) const; }; // Specializations. template<typename _CharT> struct __use_cache<__numpunct_cache<_CharT> > { const __numpunct_cache<_CharT>* operator() (const locale& __loc) const { const size_t __i = numpunct<_CharT>::id._M_id(); const locale::facet** __caches = __loc._M_impl->_M_caches; if (!__caches[__i]) { __numpunct_cache<_CharT>* __tmp = 0; __try { __tmp = new __numpunct_cache<_CharT>; __tmp->_M_cache(__loc); } __catch(...) { delete __tmp; __throw_exception_again; } __loc._M_impl->_M_install_cache(__tmp, __i); } return static_cast<const __numpunct_cache<_CharT>*>(__caches[__i]); } }; template<typename _CharT> void __numpunct_cache<_CharT>::_M_cache(const locale& __loc) { _M_allocated = true; const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc); char* __grouping = 0; _CharT* __truename = 0; _CharT* __falsename = 0; __try { _M_grouping_size = __np.grouping().size(); __grouping = new char[_M_grouping_size]; __np.grouping().copy(__grouping, _M_grouping_size); _M_grouping = __grouping; _M_use_grouping = (_M_grouping_size && static_cast<signed char>(_M_grouping[0]) > 0 && (_M_grouping[0] != __gnu_cxx::__numeric_traits<char>::__max)); _M_truename_size = __np.truename().size(); __truename = new _CharT[_M_truename_size]; __np.truename().copy(__truename, _M_truename_size); _M_truename = __truename; _M_falsename_size = __np.falsename().size(); __falsename = new _CharT[_M_falsename_size]; __np.falsename().copy(__falsename, _M_falsename_size); _M_falsename = __falsename; _M_decimal_point = __np.decimal_point(); _M_thousands_sep = __np.thousands_sep(); const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc); __ct.widen(__num_base::_S_atoms_out, __num_base::_S_atoms_out + __num_base::_S_oend, _M_atoms_out); __ct.widen(__num_base::_S_atoms_in, __num_base::_S_atoms_in + __num_base::_S_iend, _M_atoms_in); } __catch(...) { delete [] __grouping; delete [] __truename; delete [] __falsename; __throw_exception_again; } } // Used by both numeric and monetary facets. // Check to make sure that the __grouping_tmp string constructed in // money_get or num_get matches the canonical grouping for a given // locale. // __grouping_tmp is parsed L to R // 1,222,444 == __grouping_tmp of "\1\3\3" // __grouping is parsed R to L // 1,222,444 == __grouping of "\3" == "\3\3\3" _GLIBCXX_PURE bool __verify_grouping(const char* __grouping, size_t __grouping_size, const string& __grouping_tmp) throw (); _GLIBCXX_BEGIN_NAMESPACE_LDBL template<typename _CharT, typename _InIter> _InIter num_get<_CharT, _InIter>:: _M_extract_float(_InIter __beg, _InIter __end, ios_base& __io, ios_base::iostate& __err, string& __xtrc) const { typedef char_traits<_CharT> __traits_type; typedef __numpunct_cache<_CharT> __cache_type; __use_cache<__cache_type> __uc; const locale& __loc = __io._M_getloc(); const __cache_type* __lc = __uc(__loc); const _CharT* __lit = __lc->_M_atoms_in; char_type __c = char_type(); // True if __beg becomes equal to __end. bool __testeof = __beg == __end; // First check for sign. if (!__testeof) { __c = *__beg; const bool __plus = __c == __lit[__num_base::_S_iplus]; if ((__plus || __c == __lit[__num_base::_S_iminus]) && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) && !(__c == __lc->_M_decimal_point)) { __xtrc += __plus ? '+' : '-'; if (++__beg != __end) __c = *__beg; else __testeof = true; } } // Next, look for leading zeros. bool __found_mantissa = false; int __sep_pos = 0; while (!__testeof) { if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) || __c == __lc->_M_decimal_point) break; else if (__c == __lit[__num_base::_S_izero]) { if (!__found_mantissa) { __xtrc += '0'; __found_mantissa = true; } ++__sep_pos; if (++__beg != __end) __c = *__beg; else __testeof = true; } else break; } // Only need acceptable digits for floating point numbers. bool __found_dec = false; bool __found_sci = false; string __found_grouping; if (__lc->_M_use_grouping) __found_grouping.reserve(32); const char_type* __lit_zero = __lit + __num_base::_S_izero; if (!__lc->_M_allocated) // "C" locale while (!__testeof) { const int __digit = _M_find(__lit_zero, 10, __c); if (__digit != -1) { __xtrc += '0' + __digit; __found_mantissa = true; } else if (__c == __lc->_M_decimal_point && !__found_dec && !__found_sci) { __xtrc += '.'; __found_dec = true; } else if ((__c == __lit[__num_base::_S_ie] || __c == __lit[__num_base::_S_iE]) && !__found_sci && __found_mantissa) { // Scientific notation. __xtrc += 'e'; __found_sci = true; // Remove optional plus or minus sign, if they exist. if (++__beg != __end) { __c = *__beg; const bool __plus = __c == __lit[__num_base::_S_iplus]; if (__plus || __c == __lit[__num_base::_S_iminus]) __xtrc += __plus ? '+' : '-'; else continue; } else { __testeof = true; break; } } else break; if (++__beg != __end) __c = *__beg; else __testeof = true; } else while (!__testeof) { // According to 22.2.2.1.2, p8-9, first look for thousands_sep // and decimal_point. if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) { if (!__found_dec && !__found_sci) { // NB: Thousands separator at the beginning of a string // is a no-no, as is two consecutive thousands separators. if (__sep_pos) { __found_grouping += static_cast<char>(__sep_pos); __sep_pos = 0; } else { // NB: __convert_to_v will not assign __v and will // set the failbit. __xtrc.clear(); break; } } else break; } else if (__c == __lc->_M_decimal_point) { if (!__found_dec && !__found_sci) { // If no grouping chars are seen, no grouping check // is applied. Therefore __found_grouping is adjusted // only if decimal_point comes after some thousands_sep. if (__found_grouping.size()) __found_grouping += static_cast<char>(__sep_pos); __xtrc += '.'; __found_dec = true; } else break; } else { const char_type* __q = __traits_type::find(__lit_zero, 10, __c); if (__q) { __xtrc += '0' + (__q - __lit_zero); __found_mantissa = true; ++__sep_pos; } else if ((__c == __lit[__num_base::_S_ie] || __c == __lit[__num_base::_S_iE]) && !__found_sci && __found_mantissa) { // Scientific notation. if (__found_grouping.size() && !__found_dec) __found_grouping += static_cast<char>(__sep_pos); __xtrc += 'e'; __found_sci = true; // Remove optional plus or minus sign, if they exist. if (++__beg != __end) { __c = *__beg; const bool __plus = __c == __lit[__num_base::_S_iplus]; if ((__plus || __c == __lit[__num_base::_S_iminus]) && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) && !(__c == __lc->_M_decimal_point)) __xtrc += __plus ? '+' : '-'; else continue; } else { __testeof = true; break; } } else break; } if (++__beg != __end) __c = *__beg; else __testeof = true; } // Digit grouping is checked. If grouping and found_grouping don't // match, then get very very upset, and set failbit. if (__found_grouping.size()) { // Add the ending grouping if a decimal or 'e'/'E' wasn't found. if (!__found_dec && !__found_sci) __found_grouping += static_cast<char>(__sep_pos); if (!std::__verify_grouping(__lc->_M_grouping, __lc->_M_grouping_size, __found_grouping)) __err = ios_base::failbit; } return __beg; } template<typename _CharT, typename _InIter> template<typename _ValueT> _InIter num_get<_CharT, _InIter>:: _M_extract_int(_InIter __beg, _InIter __end, ios_base& __io, ios_base::iostate& __err, _ValueT& __v) const { typedef char_traits<_CharT> __traits_type; using __gnu_cxx::__add_unsigned; typedef typename __add_unsigned<_ValueT>::__type __unsigned_type; typedef __numpunct_cache<_CharT> __cache_type; __use_cache<__cache_type> __uc; const locale& __loc = __io._M_getloc(); const __cache_type* __lc = __uc(__loc); const _CharT* __lit = __lc->_M_atoms_in; char_type __c = char_type(); // NB: Iff __basefield == 0, __base can change based on contents. const ios_base::fmtflags __basefield = __io.flags() & ios_base::basefield; const bool __oct = __basefield == ios_base::oct; int __base = __oct ? 8 : (__basefield == ios_base::hex ? 16 : 10); // True if __beg becomes equal to __end. bool __testeof = __beg == __end; // First check for sign. bool __negative = false; if (!__testeof) { __c = *__beg; __negative = __c == __lit[__num_base::_S_iminus]; if ((__negative || __c == __lit[__num_base::_S_iplus]) && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) && !(__c == __lc->_M_decimal_point)) { if (++__beg != __end) __c = *__beg; else __testeof = true; } } // Next, look for leading zeros and check required digits // for base formats. bool __found_zero = false; int __sep_pos = 0; while (!__testeof) { if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) || __c == __lc->_M_decimal_point) break; else if (__c == __lit[__num_base::_S_izero] && (!__found_zero || __base == 10)) { __found_zero = true; ++__sep_pos; if (__basefield == 0) __base = 8; if (__base == 8) __sep_pos = 0; } else if (__found_zero && (__c == __lit[__num_base::_S_ix] || __c == __lit[__num_base::_S_iX])) { if (__basefield == 0) __base = 16; if (__base == 16) { __found_zero = false; __sep_pos = 0; } else break; } else break; if (++__beg != __end) { __c = *__beg; if (!__found_zero) break; } else __testeof = true; } // At this point, base is determined. If not hex, only allow // base digits as valid input. const size_t __len = (__base == 16 ? __num_base::_S_iend - __num_base::_S_izero : __base); // Extract. string __found_grouping; if (__lc->_M_use_grouping) __found_grouping.reserve(32); bool __testfail = false; bool __testoverflow = false; const __unsigned_type __max = (__negative && __gnu_cxx::__numeric_traits<_ValueT>::__is_signed) ? -__gnu_cxx::__numeric_traits<_ValueT>::__min : __gnu_cxx::__numeric_traits<_ValueT>::__max; const __unsigned_type __smax = __max / __base; __unsigned_type __result = 0; int __digit = 0; const char_type* __lit_zero = __lit + __num_base::_S_izero; if (!__lc->_M_allocated) // "C" locale while (!__testeof) { __digit = _M_find(__lit_zero, __len, __c); if (__digit == -1) break; if (__result > __smax) __testoverflow = true; else { __result *= __base; __testoverflow |= __result > __max - __digit; __result += __digit; ++__sep_pos; } if (++__beg != __end) __c = *__beg; else __testeof = true; } else while (!__testeof) { // According to 22.2.2.1.2, p8-9, first look for thousands_sep // and decimal_point. if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) { // NB: Thousands separator at the beginning of a string // is a no-no, as is two consecutive thousands separators. if (__sep_pos) { __found_grouping += static_cast<char>(__sep_pos); __sep_pos = 0; } else { __testfail = true; break; } } else if (__c == __lc->_M_decimal_point) break; else { const char_type* __q = __traits_type::find(__lit_zero, __len, __c); if (!__q) break; __digit = __q - __lit_zero; if (__digit > 15) __digit -= 6; if (__result > __smax) __testoverflow = true; else { __result *= __base; __testoverflow |= __result > __max - __digit; __result += __digit; ++__sep_pos; } } if (++__beg != __end) __c = *__beg; else __testeof = true; } // Digit grouping is checked. If grouping and found_grouping don't // match, then get very very upset, and set failbit. if (__found_grouping.size()) { // Add the ending grouping. __found_grouping += static_cast<char>(__sep_pos); if (!std::__verify_grouping(__lc->_M_grouping, __lc->_M_grouping_size, __found_grouping)) __err = ios_base::failbit; } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 23. Num_get overflow result. if ((!__sep_pos && !__found_zero && !__found_grouping.size()) || __testfail) { __v = 0; __err = ios_base::failbit; } else if (__testoverflow) { if (__negative && __gnu_cxx::__numeric_traits<_ValueT>::__is_signed) __v = __gnu_cxx::__numeric_traits<_ValueT>::__min; else __v = __gnu_cxx::__numeric_traits<_ValueT>::__max; __err = ios_base::failbit; } else __v = __negative ? -__result : __result; if (__testeof) __err |= ios_base::eofbit; return __beg; } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 17. Bad bool parsing template<typename _CharT, typename _InIter> _InIter num_get<_CharT, _InIter>:: do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, bool& __v) const { if (!(__io.flags() & ios_base::boolalpha)) { // Parse bool values as long. // NB: We can't just call do_get(long) here, as it might // refer to a derived class. long __l = -1; __beg = _M_extract_int(__beg, __end, __io, __err, __l); if (__l == 0 || __l == 1) __v = bool(__l); else { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 23. Num_get overflow result. __v = true; __err = ios_base::failbit; if (__beg == __end) __err |= ios_base::eofbit; } } else { // Parse bool values as alphanumeric. typedef __numpunct_cache<_CharT> __cache_type; __use_cache<__cache_type> __uc; const locale& __loc = __io._M_getloc(); const __cache_type* __lc = __uc(__loc); bool __testf = true; bool __testt = true; bool __donef = __lc->_M_falsename_size == 0; bool __donet = __lc->_M_truename_size == 0; bool __testeof = false; size_t __n = 0; while (!__donef || !__donet) { if (__beg == __end) { __testeof = true; break; } const char_type __c = *__beg; if (!__donef) __testf = __c == __lc->_M_falsename[__n]; if (!__testf && __donet) break; if (!__donet) __testt = __c == __lc->_M_truename[__n]; if (!__testt && __donef) break; if (!__testt && !__testf) break; ++__n; ++__beg; __donef = !__testf || __n >= __lc->_M_falsename_size; __donet = !__testt || __n >= __lc->_M_truename_size; } if (__testf && __n == __lc->_M_falsename_size && __n) { __v = false; if (__testt && __n == __lc->_M_truename_size) __err = ios_base::failbit; else __err = __testeof ? ios_base::eofbit : ios_base::goodbit; } else if (__testt && __n == __lc->_M_truename_size && __n) { __v = true; __err = __testeof ? ios_base::eofbit : ios_base::goodbit; } else { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 23. Num_get overflow result. __v = false; __err = ios_base::failbit; if (__testeof) __err |= ios_base::eofbit; } } return __beg; } template<typename _CharT, typename _InIter> _InIter num_get<_CharT, _InIter>:: do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, float& __v) const { string __xtrc; __xtrc.reserve(32); __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc); std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale()); if (__beg == __end) __err |= ios_base::eofbit; return __beg; } template<typename _CharT, typename _InIter> _InIter num_get<_CharT, _InIter>:: do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, double& __v) const { string __xtrc; __xtrc.reserve(32); __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc); std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale()); if (__beg == __end) __err |= ios_base::eofbit; return __beg; } #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ template<typename _CharT, typename _InIter> _InIter num_get<_CharT, _InIter>:: __do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, double& __v) const { string __xtrc; __xtrc.reserve(32); __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc); std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale()); if (__beg == __end) __err |= ios_base::eofbit; return __beg; } #endif template<typename _CharT, typename _InIter> _InIter num_get<_CharT, _InIter>:: do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, long double& __v) const { string __xtrc; __xtrc.reserve(32); __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc); std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale()); if (__beg == __end) __err |= ios_base::eofbit; return __beg; } template<typename _CharT, typename _InIter> _InIter num_get<_CharT, _InIter>:: do_get(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, void*& __v) const { // Prepare for hex formatted input. typedef ios_base::fmtflags fmtflags; const fmtflags __fmt = __io.flags(); __io.flags((__fmt & ~ios_base::basefield) | ios_base::hex); typedef __gnu_cxx::__conditional_type<(sizeof(void*) <= sizeof(unsigned long)), unsigned long, unsigned long long>::__type _UIntPtrType; _UIntPtrType __ul; __beg = _M_extract_int(__beg, __end, __io, __err, __ul); // Reset from hex formatted input. __io.flags(__fmt); __v = reinterpret_cast<void*>(__ul); return __beg; } // For use by integer and floating-point types after they have been // converted into a char_type string. template<typename _CharT, typename _OutIter> void num_put<_CharT, _OutIter>:: _M_pad(_CharT __fill, streamsize __w, ios_base& __io, _CharT* __new, const _CharT* __cs, int& __len) const { // [22.2.2.2.2] Stage 3. // If necessary, pad. __pad<_CharT, char_traits<_CharT> >::_S_pad(__io, __fill, __new, __cs, __w, __len); __len = static_cast<int>(__w); } _GLIBCXX_END_NAMESPACE_LDBL template<typename _CharT, typename _ValueT> int __int_to_char(_CharT* __bufend, _ValueT __v, const _CharT* __lit, ios_base::fmtflags __flags, bool __dec) { _CharT* __buf = __bufend; if (__builtin_expect(__dec, true)) { // Decimal. do { *--__buf = __lit[(__v % 10) + __num_base::_S_odigits]; __v /= 10; } while (__v != 0); } else if ((__flags & ios_base::basefield) == ios_base::oct) { // Octal. do { *--__buf = __lit[(__v & 0x7) + __num_base::_S_odigits]; __v >>= 3; } while (__v != 0); } else { // Hex. const bool __uppercase = __flags & ios_base::uppercase; const int __case_offset = __uppercase ? __num_base::_S_oudigits : __num_base::_S_odigits; do { *--__buf = __lit[(__v & 0xf) + __case_offset]; __v >>= 4; } while (__v != 0); } return __bufend - __buf; } _GLIBCXX_BEGIN_NAMESPACE_LDBL template<typename _CharT, typename _OutIter> void num_put<_CharT, _OutIter>:: _M_group_int(const char* __grouping, size_t __grouping_size, _CharT __sep, ios_base&, _CharT* __new, _CharT* __cs, int& __len) const { _CharT* __p = std::__add_grouping(__new, __sep, __grouping, __grouping_size, __cs, __cs + __len); __len = __p - __new; } template<typename _CharT, typename _OutIter> template<typename _ValueT> _OutIter num_put<_CharT, _OutIter>:: _M_insert_int(_OutIter __s, ios_base& __io, _CharT __fill, _ValueT __v) const { using __gnu_cxx::__add_unsigned; typedef typename __add_unsigned<_ValueT>::__type __unsigned_type; typedef __numpunct_cache<_CharT> __cache_type; __use_cache<__cache_type> __uc; const locale& __loc = __io._M_getloc(); const __cache_type* __lc = __uc(__loc); const _CharT* __lit = __lc->_M_atoms_out; const ios_base::fmtflags __flags = __io.flags(); // Long enough to hold hex, dec, and octal representations. const int __ilen = 5 * sizeof(_ValueT); _CharT* __cs = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __ilen)); // [22.2.2.2.2] Stage 1, numeric conversion to character. // Result is returned right-justified in the buffer. const ios_base::fmtflags __basefield = __flags & ios_base::basefield; const bool __dec = (__basefield != ios_base::oct && __basefield != ios_base::hex); const __unsigned_type __u = ((__v > 0 || !__dec) ? __unsigned_type(__v) : -__unsigned_type(__v)); int __len = __int_to_char(__cs + __ilen, __u, __lit, __flags, __dec); __cs += __ilen - __len; // Add grouping, if necessary. if (__lc->_M_use_grouping) { // Grouping can add (almost) as many separators as the number // of digits + space is reserved for numeric base or sign. _CharT* __cs2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * (__len + 1) * 2)); _M_group_int(__lc->_M_grouping, __lc->_M_grouping_size, __lc->_M_thousands_sep, __io, __cs2 + 2, __cs, __len); __cs = __cs2 + 2; } // Complete Stage 1, prepend numeric base or sign. if (__builtin_expect(__dec, true)) { // Decimal. if (__v >= 0) { if (bool(__flags & ios_base::showpos) && __gnu_cxx::__numeric_traits<_ValueT>::__is_signed) *--__cs = __lit[__num_base::_S_oplus], ++__len; } else *--__cs = __lit[__num_base::_S_ominus], ++__len; } else if (bool(__flags & ios_base::showbase) && __v) { if (__basefield == ios_base::oct) *--__cs = __lit[__num_base::_S_odigits], ++__len; else { // 'x' or 'X' const bool __uppercase = __flags & ios_base::uppercase; *--__cs = __lit[__num_base::_S_ox + __uppercase]; // '0' *--__cs = __lit[__num_base::_S_odigits]; __len += 2; } } // Pad. const streamsize __w = __io.width(); if (__w > static_cast<streamsize>(__len)) { _CharT* __cs3 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __w)); _M_pad(__fill, __w, __io, __cs3, __cs, __len); __cs = __cs3; } __io.width(0); // [22.2.2.2.2] Stage 4. // Write resulting, fully-formatted string to output iterator. return std::__write(__s, __cs, __len); } template<typename _CharT, typename _OutIter> void num_put<_CharT, _OutIter>:: _M_group_float(const char* __grouping, size_t __grouping_size, _CharT __sep, const _CharT* __p, _CharT* __new, _CharT* __cs, int& __len) const { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 282. What types does numpunct grouping refer to? // Add grouping, if necessary. const int __declen = __p ? __p - __cs : __len; _CharT* __p2 = std::__add_grouping(__new, __sep, __grouping, __grouping_size, __cs, __cs + __declen); // Tack on decimal part. int __newlen = __p2 - __new; if (__p) { char_traits<_CharT>::copy(__p2, __p, __len - __declen); __newlen += __len - __declen; } __len = __newlen; } // The following code uses vsnprintf (or vsprintf(), when // _GLIBCXX_USE_C99 is not defined) to convert floating point values // for insertion into a stream. An optimization would be to replace // them with code that works directly on a wide buffer and then use // __pad to do the padding. It would be good to replace them anyway // to gain back the efficiency that C++ provides by knowing up front // the type of the values to insert. Also, sprintf is dangerous // since may lead to accidental buffer overruns. This // implementation follows the C++ standard fairly directly as // outlined in 22.2.2.2 [lib.locale.num.put] template<typename _CharT, typename _OutIter> template<typename _ValueT> _OutIter num_put<_CharT, _OutIter>:: _M_insert_float(_OutIter __s, ios_base& __io, _CharT __fill, char __mod, _ValueT __v) const { typedef __numpunct_cache<_CharT> __cache_type; __use_cache<__cache_type> __uc; const locale& __loc = __io._M_getloc(); const __cache_type* __lc = __uc(__loc); // Use default precision if out of range. const streamsize __prec = __io.precision() < 0 ? 6 : __io.precision(); const int __max_digits = __gnu_cxx::__numeric_traits<_ValueT>::__digits10; // [22.2.2.2.2] Stage 1, numeric conversion to character. int __len; // Long enough for the max format spec. char __fbuf[16]; __num_base::_S_format_float(__io, __fbuf, __mod); #ifdef _GLIBCXX_USE_C99 // First try a buffer perhaps big enough (most probably sufficient // for non-ios_base::fixed outputs) int __cs_size = __max_digits * 3; char* __cs = static_cast<char*>(__builtin_alloca(__cs_size)); __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, __fbuf, __prec, __v); // If the buffer was not large enough, try again with the correct size. if (__len >= __cs_size) { __cs_size = __len + 1; __cs = static_cast<char*>(__builtin_alloca(__cs_size)); __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, __fbuf, __prec, __v); } #else // Consider the possibility of long ios_base::fixed outputs const bool __fixed = __io.flags() & ios_base::fixed; const int __max_exp = __gnu_cxx::__numeric_traits<_ValueT>::__max_exponent10; // The size of the output string is computed as follows. // ios_base::fixed outputs may need up to __max_exp + 1 chars // for the integer part + __prec chars for the fractional part // + 3 chars for sign, decimal point, '\0'. On the other hand, // for non-fixed outputs __max_digits * 2 + __prec chars are // largely sufficient. const int __cs_size = __fixed ? __max_exp + __prec + 4 : __max_digits * 2 + __prec; char* __cs = static_cast<char*>(__builtin_alloca(__cs_size)); __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, __fbuf, __prec, __v); #endif // [22.2.2.2.2] Stage 2, convert to char_type, using correct // numpunct.decimal_point() values for '.' and adding grouping. const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); _CharT* __ws = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __len)); __ctype.widen(__cs, __cs + __len, __ws); // Replace decimal point. _CharT* __wp = 0; const char* __p = char_traits<char>::find(__cs, __len, '.'); if (__p) { __wp = __ws + (__p - __cs); *__wp = __lc->_M_decimal_point; } // Add grouping, if necessary. // N.B. Make sure to not group things like 2e20, i.e., no decimal // point, scientific notation. if (__lc->_M_use_grouping && (__wp || __len < 3 || (__cs[1] <= '9' && __cs[2] <= '9' && __cs[1] >= '0' && __cs[2] >= '0'))) { // Grouping can add (almost) as many separators as the // number of digits, but no more. _CharT* __ws2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __len * 2)); streamsize __off = 0; if (__cs[0] == '-' || __cs[0] == '+') { __off = 1; __ws2[0] = __ws[0]; __len -= 1; } _M_group_float(__lc->_M_grouping, __lc->_M_grouping_size, __lc->_M_thousands_sep, __wp, __ws2 + __off, __ws + __off, __len); __len += __off; __ws = __ws2; } // Pad. const streamsize __w = __io.width(); if (__w > static_cast<streamsize>(__len)) { _CharT* __ws3 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __w)); _M_pad(__fill, __w, __io, __ws3, __ws, __len); __ws = __ws3; } __io.width(0); // [22.2.2.2.2] Stage 4. // Write resulting, fully-formatted string to output iterator. return std::__write(__s, __ws, __len); } template<typename _CharT, typename _OutIter> _OutIter num_put<_CharT, _OutIter>:: do_put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const { const ios_base::fmtflags __flags = __io.flags(); if ((__flags & ios_base::boolalpha) == 0) { const long __l = __v; __s = _M_insert_int(__s, __io, __fill, __l); } else { typedef __numpunct_cache<_CharT> __cache_type; __use_cache<__cache_type> __uc; const locale& __loc = __io._M_getloc(); const __cache_type* __lc = __uc(__loc); const _CharT* __name = __v ? __lc->_M_truename : __lc->_M_falsename; int __len = __v ? __lc->_M_truename_size : __lc->_M_falsename_size; const streamsize __w = __io.width(); if (__w > static_cast<streamsize>(__len)) { const streamsize __plen = __w - __len; _CharT* __ps = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __plen)); char_traits<_CharT>::assign(__ps, __plen, __fill); __io.width(0); if ((__flags & ios_base::adjustfield) == ios_base::left) { __s = std::__write(__s, __name, __len); __s = std::__write(__s, __ps, __plen); } else { __s = std::__write(__s, __ps, __plen); __s = std::__write(__s, __name, __len); } return __s; } __io.width(0); __s = std::__write(__s, __name, __len); } return __s; } template<typename _CharT, typename _OutIter> _OutIter num_put<_CharT, _OutIter>:: do_put(iter_type __s, ios_base& __io, char_type __fill, double __v) const { return _M_insert_float(__s, __io, __fill, char(), __v); } #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ template<typename _CharT, typename _OutIter> _OutIter num_put<_CharT, _OutIter>:: __do_put(iter_type __s, ios_base& __io, char_type __fill, double __v) const { return _M_insert_float(__s, __io, __fill, char(), __v); } #endif template<typename _CharT, typename _OutIter> _OutIter num_put<_CharT, _OutIter>:: do_put(iter_type __s, ios_base& __io, char_type __fill, long double __v) const { return _M_insert_float(__s, __io, __fill, 'L', __v); } template<typename _CharT, typename _OutIter> _OutIter num_put<_CharT, _OutIter>:: do_put(iter_type __s, ios_base& __io, char_type __fill, const void* __v) const { const ios_base::fmtflags __flags = __io.flags(); const ios_base::fmtflags __fmt = ~(ios_base::basefield | ios_base::uppercase); __io.flags((__flags & __fmt) | (ios_base::hex | ios_base::showbase)); typedef __gnu_cxx::__conditional_type<(sizeof(const void*) <= sizeof(unsigned long)), unsigned long, unsigned long long>::__type _UIntPtrType; __s = _M_insert_int(__s, __io, __fill, reinterpret_cast<_UIntPtrType>(__v)); __io.flags(__flags); return __s; } _GLIBCXX_END_NAMESPACE_LDBL // Construct correctly padded string, as per 22.2.2.2.2 // Assumes // __newlen > __oldlen // __news is allocated for __newlen size // NB: Of the two parameters, _CharT can be deduced from the // function arguments. The other (_Traits) has to be explicitly specified. template<typename _CharT, typename _Traits> void __pad<_CharT, _Traits>::_S_pad(ios_base& __io, _CharT __fill, _CharT* __news, const _CharT* __olds, streamsize __newlen, streamsize __oldlen) { const size_t __plen = static_cast<size_t>(__newlen - __oldlen); const ios_base::fmtflags __adjust = __io.flags() & ios_base::adjustfield; // Padding last. if (__adjust == ios_base::left) { _Traits::copy(__news, __olds, __oldlen); _Traits::assign(__news + __oldlen, __plen, __fill); return; } size_t __mod = 0; if (__adjust == ios_base::internal) { // Pad after the sign, if there is one. // Pad after 0[xX], if there is one. // Who came up with these rules, anyway? Jeeze. const locale& __loc = __io._M_getloc(); const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); if (__ctype.widen('-') == __olds[0] || __ctype.widen('+') == __olds[0]) { __news[0] = __olds[0]; __mod = 1; ++__news; } else if (__ctype.widen('0') == __olds[0] && __oldlen > 1 && (__ctype.widen('x') == __olds[1] || __ctype.widen('X') == __olds[1])) { __news[0] = __olds[0]; __news[1] = __olds[1]; __mod = 2; __news += 2; } // else Padding first. } _Traits::assign(__news, __plen, __fill); _Traits::copy(__news + __plen, __olds + __mod, __oldlen - __mod); } template<typename _CharT> _CharT* __add_grouping(_CharT* __s, _CharT __sep, const char* __gbeg, size_t __gsize, const _CharT* __first, const _CharT* __last) { size_t __idx = 0; size_t __ctr = 0; while (__last - __first > __gbeg[__idx] && static_cast<signed char>(__gbeg[__idx]) > 0 && __gbeg[__idx] != __gnu_cxx::__numeric_traits<char>::__max) { __last -= __gbeg[__idx]; __idx < __gsize - 1 ? ++__idx : ++__ctr; } while (__first != __last) *__s++ = *__first++; while (__ctr--) { *__s++ = __sep; for (char __i = __gbeg[__idx]; __i > 0; --__i) *__s++ = *__first++; } while (__idx--) { *__s++ = __sep; for (char __i = __gbeg[__idx]; __i > 0; --__i) *__s++ = *__first++; } return __s; } // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. #if _GLIBCXX_EXTERN_TEMPLATE extern template class numpunct<char>; extern template class numpunct_byname<char>; extern template class _GLIBCXX_NAMESPACE_LDBL num_get<char>; extern template class _GLIBCXX_NAMESPACE_LDBL num_put<char>; extern template class ctype_byname<char>; extern template const ctype<char>& use_facet<ctype<char> >(const locale&); extern template const numpunct<char>& use_facet<numpunct<char> >(const locale&); extern template const num_put<char>& use_facet<num_put<char> >(const locale&); extern template const num_get<char>& use_facet<num_get<char> >(const locale&); extern template bool has_facet<ctype<char> >(const locale&); extern template bool has_facet<numpunct<char> >(const locale&); extern template bool has_facet<num_put<char> >(const locale&); extern template bool has_facet<num_get<char> >(const locale&); #ifdef _GLIBCXX_USE_WCHAR_T extern template class numpunct<wchar_t>; extern template class numpunct_byname<wchar_t>; extern template class _GLIBCXX_NAMESPACE_LDBL num_get<wchar_t>; extern template class _GLIBCXX_NAMESPACE_LDBL num_put<wchar_t>; extern template class ctype_byname<wchar_t>; extern template const ctype<wchar_t>& use_facet<ctype<wchar_t> >(const locale&); extern template const numpunct<wchar_t>& use_facet<numpunct<wchar_t> >(const locale&); extern template const num_put<wchar_t>& use_facet<num_put<wchar_t> >(const locale&); extern template const num_get<wchar_t>& use_facet<num_get<wchar_t> >(const locale&); extern template bool has_facet<ctype<wchar_t> >(const locale&); extern template bool has_facet<numpunct<wchar_t> >(const locale&); extern template bool has_facet<num_put<wchar_t> >(const locale&); extern template bool has_facet<num_get<wchar_t> >(const locale&); #endif #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/unique_ptr.h�������������������������������������������������������������������������0000644�����������������00000042301�14763166030�0011100 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// unique_ptr implementation -*- C++ -*- // Copyright (C) 2008-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/unique_ptr.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{memory} */ #ifndef _UNIQUE_PTR_H #define _UNIQUE_PTR_H 1 #include <bits/c++config.h> #include <debug/debug.h> #include <type_traits> #include <utility> #include <tuple> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup pointer_abstractions * @{ */ #if _GLIBCXX_USE_DEPRECATED template<typename> class auto_ptr; #endif /// Primary template, default_delete. template<typename _Tp> struct default_delete { constexpr default_delete() noexcept = default; template<typename _Up, typename = typename enable_if<is_convertible<_Up*, _Tp*>::value>::type> default_delete(const default_delete<_Up>&) noexcept { } void operator()(_Tp* __ptr) const { static_assert(sizeof(_Tp)>0, "can't delete pointer to incomplete type"); delete __ptr; } }; // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 740 - omit specialization for array objects with a compile time length /// Specialization, default_delete. template<typename _Tp> struct default_delete<_Tp[]> { private: template<typename _Up> using __remove_cv = typename remove_cv<_Up>::type; // Like is_base_of<_Tp, _Up> but false if unqualified types are the same template<typename _Up> using __is_derived_Tp = __and_< is_base_of<_Tp, _Up>, __not_<is_same<__remove_cv<_Tp>, __remove_cv<_Up>>> >; public: constexpr default_delete() noexcept = default; template<typename _Up, typename = typename enable_if<!__is_derived_Tp<_Up>::value>::type> default_delete(const default_delete<_Up[]>&) noexcept { } void operator()(_Tp* __ptr) const { static_assert(sizeof(_Tp)>0, "can't delete pointer to incomplete type"); delete [] __ptr; } template<typename _Up> typename enable_if<__is_derived_Tp<_Up>::value>::type operator()(_Up*) const = delete; }; /// 20.7.1.2 unique_ptr for single objects. template <typename _Tp, typename _Dp = default_delete<_Tp> > class unique_ptr { // use SFINAE to determine whether _Del::pointer exists class _Pointer { template<typename _Up> static typename _Up::pointer __test(typename _Up::pointer*); template<typename _Up> static _Tp* __test(...); typedef typename remove_reference<_Dp>::type _Del; public: typedef decltype(__test<_Del>(0)) type; }; typedef std::tuple<typename _Pointer::type, _Dp> __tuple_type; __tuple_type _M_t; public: typedef typename _Pointer::type pointer; typedef _Tp element_type; typedef _Dp deleter_type; // Constructors. constexpr unique_ptr() noexcept : _M_t() { static_assert(!is_pointer<deleter_type>::value, "constructed with null function pointer deleter"); } explicit unique_ptr(pointer __p) noexcept : _M_t(__p, deleter_type()) { static_assert(!is_pointer<deleter_type>::value, "constructed with null function pointer deleter"); } unique_ptr(pointer __p, typename conditional<is_reference<deleter_type>::value, deleter_type, const deleter_type&>::type __d) noexcept : _M_t(__p, __d) { } unique_ptr(pointer __p, typename remove_reference<deleter_type>::type&& __d) noexcept : _M_t(std::move(__p), std::move(__d)) { static_assert(!std::is_reference<deleter_type>::value, "rvalue deleter bound to reference"); } constexpr unique_ptr(nullptr_t) noexcept : unique_ptr() { } // Move constructors. unique_ptr(unique_ptr&& __u) noexcept : _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter())) { } template<typename _Up, typename _Ep, typename = _Require< is_convertible<typename unique_ptr<_Up, _Ep>::pointer, pointer>, __not_<is_array<_Up>>, typename conditional<is_reference<_Dp>::value, is_same<_Ep, _Dp>, is_convertible<_Ep, _Dp>>::type>> unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter())) { } #if _GLIBCXX_USE_DEPRECATED template<typename _Up, typename = _Require< is_convertible<_Up*, _Tp*>, is_same<_Dp, default_delete<_Tp>>>> unique_ptr(auto_ptr<_Up>&& __u) noexcept; #endif // Destructor. ~unique_ptr() noexcept { auto& __ptr = std::get<0>(_M_t); if (__ptr != nullptr) get_deleter()(__ptr); __ptr = pointer(); } // Assignment. unique_ptr& operator=(unique_ptr&& __u) noexcept { reset(__u.release()); get_deleter() = std::forward<deleter_type>(__u.get_deleter()); return *this; } template<typename _Up, typename _Ep> typename enable_if< __and_< is_convertible<typename unique_ptr<_Up, _Ep>::pointer, pointer>, __not_<is_array<_Up>> >::value, unique_ptr&>::type operator=(unique_ptr<_Up, _Ep>&& __u) noexcept { reset(__u.release()); get_deleter() = std::forward<_Ep>(__u.get_deleter()); return *this; } unique_ptr& operator=(nullptr_t) noexcept { reset(); return *this; } // Observers. typename add_lvalue_reference<element_type>::type operator*() const { _GLIBCXX_DEBUG_ASSERT(get() != pointer()); return *get(); } pointer operator->() const noexcept { _GLIBCXX_DEBUG_ASSERT(get() != pointer()); return get(); } pointer get() const noexcept { return std::get<0>(_M_t); } deleter_type& get_deleter() noexcept { return std::get<1>(_M_t); } const deleter_type& get_deleter() const noexcept { return std::get<1>(_M_t); } explicit operator bool() const noexcept { return get() == pointer() ? false : true; } // Modifiers. pointer release() noexcept { pointer __p = get(); std::get<0>(_M_t) = pointer(); return __p; } void reset(pointer __p = pointer()) noexcept { using std::swap; swap(std::get<0>(_M_t), __p); if (__p != pointer()) get_deleter()(__p); } void swap(unique_ptr& __u) noexcept { using std::swap; swap(_M_t, __u._M_t); } // Disable copy from lvalue. unique_ptr(const unique_ptr&) = delete; unique_ptr& operator=(const unique_ptr&) = delete; }; /// 20.7.1.3 unique_ptr for array objects with a runtime length // [unique.ptr.runtime] // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 740 - omit specialization for array objects with a compile time length template<typename _Tp, typename _Dp> class unique_ptr<_Tp[], _Dp> { // use SFINAE to determine whether _Del::pointer exists class _Pointer { template<typename _Up> static typename _Up::pointer __test(typename _Up::pointer*); template<typename _Up> static _Tp* __test(...); typedef typename remove_reference<_Dp>::type _Del; public: typedef decltype(__test<_Del>(0)) type; }; typedef std::tuple<typename _Pointer::type, _Dp> __tuple_type; __tuple_type _M_t; template<typename _Up> using __remove_cv = typename remove_cv<_Up>::type; // like is_base_of<_Tp, _Up> but false if unqualified types are the same template<typename _Up> using __is_derived_Tp = __and_< is_base_of<_Tp, _Up>, __not_<is_same<__remove_cv<_Tp>, __remove_cv<_Up>>> >; template<typename _Up, typename _Ep, typename _Tp_pointer = typename _Pointer::type, typename _Up_pointer = typename unique_ptr<_Up, _Ep>::pointer> using __safe_conversion = __and_< is_convertible<_Up_pointer, _Tp_pointer>, is_array<_Up>, __or_<__not_<is_pointer<_Up_pointer>>, __not_<is_pointer<_Tp_pointer>>, __not_<__is_derived_Tp<typename remove_extent<_Up>::type>> > >; public: typedef typename _Pointer::type pointer; typedef _Tp element_type; typedef _Dp deleter_type; // Constructors. constexpr unique_ptr() noexcept : _M_t() { static_assert(!std::is_pointer<deleter_type>::value, "constructed with null function pointer deleter"); } explicit unique_ptr(pointer __p) noexcept : _M_t(__p, deleter_type()) { static_assert(!is_pointer<deleter_type>::value, "constructed with null function pointer deleter"); } template<typename _Up, typename = _Require<is_pointer<pointer>, is_convertible<_Up*, pointer>, __is_derived_Tp<_Up>>> explicit unique_ptr(_Up* __p) = delete; unique_ptr(pointer __p, typename conditional<is_reference<deleter_type>::value, deleter_type, const deleter_type&>::type __d) noexcept : _M_t(__p, __d) { } unique_ptr(pointer __p, typename remove_reference<deleter_type>::type&& __d) noexcept : _M_t(std::move(__p), std::move(__d)) { static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference"); } // Move constructor. unique_ptr(unique_ptr&& __u) noexcept : _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter())) { } constexpr unique_ptr(nullptr_t) noexcept : unique_ptr() { } template<typename _Up, typename _Ep, typename = _Require<__safe_conversion<_Up, _Ep>, typename conditional<is_reference<_Dp>::value, is_same<_Ep, _Dp>, is_convertible<_Ep, _Dp>>::type >> unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter())) { } // Destructor. ~unique_ptr() { auto& __ptr = std::get<0>(_M_t); if (__ptr != nullptr) get_deleter()(__ptr); __ptr = pointer(); } // Assignment. unique_ptr& operator=(unique_ptr&& __u) noexcept { reset(__u.release()); get_deleter() = std::forward<deleter_type>(__u.get_deleter()); return *this; } template<typename _Up, typename _Ep> typename enable_if<__safe_conversion<_Up, _Ep>::value, unique_ptr&>::type operator=(unique_ptr<_Up, _Ep>&& __u) noexcept { reset(__u.release()); get_deleter() = std::forward<_Ep>(__u.get_deleter()); return *this; } unique_ptr& operator=(nullptr_t) noexcept { reset(); return *this; } // Observers. typename std::add_lvalue_reference<element_type>::type operator[](size_t __i) const { _GLIBCXX_DEBUG_ASSERT(get() != pointer()); return get()[__i]; } pointer get() const noexcept { return std::get<0>(_M_t); } deleter_type& get_deleter() noexcept { return std::get<1>(_M_t); } const deleter_type& get_deleter() const noexcept { return std::get<1>(_M_t); } explicit operator bool() const noexcept { return get() == pointer() ? false : true; } // Modifiers. pointer release() noexcept { pointer __p = get(); std::get<0>(_M_t) = pointer(); return __p; } void reset() noexcept { reset(pointer()); } void reset(pointer __p) noexcept { using std::swap; swap(std::get<0>(_M_t), __p); if (__p != nullptr) get_deleter()(__p); } template<typename _Up, typename = _Require<is_pointer<pointer>, is_convertible<_Up*, pointer>, __is_derived_Tp<_Up>>> void reset(_Up*) = delete; void swap(unique_ptr& __u) noexcept { using std::swap; swap(_M_t, __u._M_t); } // Disable copy from lvalue. unique_ptr(const unique_ptr&) = delete; unique_ptr& operator=(const unique_ptr&) = delete; // Disable construction from convertible pointer types. template<typename _Up, typename = _Require<is_pointer<pointer>, is_convertible<_Up*, pointer>, __is_derived_Tp<_Up>>> unique_ptr(_Up*, typename conditional<is_reference<deleter_type>::value, deleter_type, const deleter_type&>::type) = delete; template<typename _Up, typename = _Require<is_pointer<pointer>, is_convertible<_Up*, pointer>, __is_derived_Tp<_Up>>> unique_ptr(_Up*, typename remove_reference<deleter_type>::type&&) = delete; }; template<typename _Tp, typename _Dp> inline void swap(unique_ptr<_Tp, _Dp>& __x, unique_ptr<_Tp, _Dp>& __y) noexcept { __x.swap(__y); } template<typename _Tp, typename _Dp, typename _Up, typename _Ep> inline bool operator==(const unique_ptr<_Tp, _Dp>& __x, const unique_ptr<_Up, _Ep>& __y) { return __x.get() == __y.get(); } template<typename _Tp, typename _Dp> inline bool operator==(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) noexcept { return !__x; } template<typename _Tp, typename _Dp> inline bool operator==(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) noexcept { return !__x; } template<typename _Tp, typename _Dp, typename _Up, typename _Ep> inline bool operator!=(const unique_ptr<_Tp, _Dp>& __x, const unique_ptr<_Up, _Ep>& __y) { return __x.get() != __y.get(); } template<typename _Tp, typename _Dp> inline bool operator!=(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) noexcept { return (bool)__x; } template<typename _Tp, typename _Dp> inline bool operator!=(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) noexcept { return (bool)__x; } template<typename _Tp, typename _Dp, typename _Up, typename _Ep> inline bool operator<(const unique_ptr<_Tp, _Dp>& __x, const unique_ptr<_Up, _Ep>& __y) { typedef typename std::common_type<typename unique_ptr<_Tp, _Dp>::pointer, typename unique_ptr<_Up, _Ep>::pointer>::type _CT; return std::less<_CT>()(__x.get(), __y.get()); } template<typename _Tp, typename _Dp> inline bool operator<(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) { return std::less<typename unique_ptr<_Tp, _Dp>::pointer>()(__x.get(), nullptr); } template<typename _Tp, typename _Dp> inline bool operator<(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) { return std::less<typename unique_ptr<_Tp, _Dp>::pointer>()(nullptr, __x.get()); } template<typename _Tp, typename _Dp, typename _Up, typename _Ep> inline bool operator<=(const unique_ptr<_Tp, _Dp>& __x, const unique_ptr<_Up, _Ep>& __y) { return !(__y < __x); } template<typename _Tp, typename _Dp> inline bool operator<=(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) { return !(nullptr < __x); } template<typename _Tp, typename _Dp> inline bool operator<=(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) { return !(__x < nullptr); } template<typename _Tp, typename _Dp, typename _Up, typename _Ep> inline bool operator>(const unique_ptr<_Tp, _Dp>& __x, const unique_ptr<_Up, _Ep>& __y) { return (__y < __x); } template<typename _Tp, typename _Dp> inline bool operator>(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) { return std::less<typename unique_ptr<_Tp, _Dp>::pointer>()(nullptr, __x.get()); } template<typename _Tp, typename _Dp> inline bool operator>(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) { return std::less<typename unique_ptr<_Tp, _Dp>::pointer>()(__x.get(), nullptr); } template<typename _Tp, typename _Dp, typename _Up, typename _Ep> inline bool operator>=(const unique_ptr<_Tp, _Dp>& __x, const unique_ptr<_Up, _Ep>& __y) { return !(__x < __y); } template<typename _Tp, typename _Dp> inline bool operator>=(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) { return !(__x < nullptr); } template<typename _Tp, typename _Dp> inline bool operator>=(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) { return !(nullptr < __x); } /// std::hash specialization for unique_ptr. template<typename _Tp, typename _Dp> struct hash<unique_ptr<_Tp, _Dp>> : public __hash_base<size_t, unique_ptr<_Tp, _Dp>> { size_t operator()(const unique_ptr<_Tp, _Dp>& __u) const noexcept { typedef unique_ptr<_Tp, _Dp> _UP; return std::hash<typename _UP::pointer>()(__u.get()); } }; // @} group pointer_abstractions _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _UNIQUE_PTR_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/regex_nfa.tcc������������������������������������������������������������������������0000644�����������������00000011545�14763166030�0011173 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// class template regex -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** * @file bits/regex_nfa.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{regex} */ #include <regex> namespace std _GLIBCXX_VISIBILITY(default) { namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION #ifdef _GLIBCXX_DEBUG inline std::ostream& _State:: _M_print(std::ostream& ostr) const { switch (_M_opcode) { case _S_opcode_alternative: ostr << "alt next=" << _M_next << " alt=" << _M_alt; break; case _S_opcode_subexpr_begin: ostr << "subexpr begin next=" << _M_next << " index=" << _M_subexpr; break; case _S_opcode_subexpr_end: ostr << "subexpr end next=" << _M_next << " index=" << _M_subexpr; break; case _S_opcode_match: ostr << "match next=" << _M_next; break; case _S_opcode_accept: ostr << "accept next=" << _M_next; break; default: ostr << "unknown next=" << _M_next; break; } return ostr; } // Prints graphviz dot commands for state. inline std::ostream& _State:: _M_dot(std::ostream& __ostr, _StateIdT __id) const { switch (_M_opcode) { case _S_opcode_alternative: __ostr << __id << " [label=\"" << __id << "\\nALT\"];\n" << __id << " -> " << _M_next << " [label=\"epsilon\", tailport=\"s\"];\n" << __id << " -> " << _M_alt << " [label=\"epsilon\", tailport=\"n\"];\n"; break; case _S_opcode_subexpr_begin: __ostr << __id << " [label=\"" << __id << "\\nSBEGIN " << _M_subexpr << "\"];\n" << __id << " -> " << _M_next << " [label=\"epsilon\"];\n"; break; case _S_opcode_subexpr_end: __ostr << __id << " [label=\"" << __id << "\\nSEND " << _M_subexpr << "\"];\n" << __id << " -> " << _M_next << " [label=\"epsilon\"];\n"; break; case _S_opcode_match: __ostr << __id << " [label=\"" << __id << "\\nMATCH\"];\n" << __id << " -> " << _M_next << " [label=\"<match>\"];\n"; break; case _S_opcode_accept: __ostr << __id << " [label=\"" << __id << "\\nACC\"];\n" ; break; default: __ostr << __id << " [label=\"" << __id << "\\nUNK\"];\n" << __id << " -> " << _M_next << " [label=\"?\"];\n"; break; } return __ostr; } inline std::ostream& _Nfa:: _M_dot(std::ostream& __ostr) const { __ostr << "digraph _Nfa {\n" << " rankdir=LR;\n"; for (unsigned int __i = 0; __i < this->size(); ++__i) { this->at(__i)._M_dot(__ostr, __i); } __ostr << "}\n"; return __ostr; } #endif inline _StateSeq& _StateSeq:: operator=(const _StateSeq& __rhs) { _M_start = __rhs._M_start; _M_end1 = __rhs._M_end1; _M_end2 = __rhs._M_end2; return *this; } inline void _StateSeq:: _M_push_back(_StateIdT __id) { if (_M_end1 != _S_invalid_state_id) _M_nfa[_M_end1]._M_next = __id; _M_end1 = __id; } inline void _StateSeq:: _M_append(_StateIdT __id) { if (_M_end2 != _S_invalid_state_id) { if (_M_end2 == _M_end1) _M_nfa[_M_end2]._M_alt = __id; else _M_nfa[_M_end2]._M_next = __id; _M_end2 = _S_invalid_state_id; } if (_M_end1 != _S_invalid_state_id) _M_nfa[_M_end1]._M_next = __id; _M_end1 = __id; } inline void _StateSeq:: _M_append(_StateSeq& __rhs) { if (_M_end2 != _S_invalid_state_id) { if (_M_end2 == _M_end1) _M_nfa[_M_end2]._M_alt = __rhs._M_start; else _M_nfa[_M_end2]._M_next = __rhs._M_start; _M_end2 = _S_invalid_state_id; } if (__rhs._M_end2 != _S_invalid_state_id) _M_end2 = __rhs._M_end2; if (_M_end1 != _S_invalid_state_id) _M_nfa[_M_end1]._M_next = __rhs._M_start; _M_end1 = __rhs._M_end1; } // @todo implement this function. inline _StateIdT _StateSeq:: _M_clone() { return 0; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace __detail } // namespace �����������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stream_iterator.h��������������������������������������������������������������������0000644�����������������00000014705�14763166030�0012120 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Stream iterators // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/stream_iterator.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{iterator} */ #ifndef _STREAM_ITERATOR_H #define _STREAM_ITERATOR_H 1 #pragma GCC system_header #include <debug/debug.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup iterators * @{ */ /// Provides input iterator semantics for streams. template<typename _Tp, typename _CharT = char, typename _Traits = char_traits<_CharT>, typename _Dist = ptrdiff_t> class istream_iterator : public iterator<input_iterator_tag, _Tp, _Dist, const _Tp*, const _Tp&> { public: typedef _CharT char_type; typedef _Traits traits_type; typedef basic_istream<_CharT, _Traits> istream_type; private: istream_type* _M_stream; _Tp _M_value; bool _M_ok; public: /// Construct end of input stream iterator. _GLIBCXX_CONSTEXPR istream_iterator() : _M_stream(0), _M_value(), _M_ok(false) {} /// Construct start of input stream iterator. istream_iterator(istream_type& __s) : _M_stream(&__s) { _M_read(); } istream_iterator(const istream_iterator& __obj) : _M_stream(__obj._M_stream), _M_value(__obj._M_value), _M_ok(__obj._M_ok) { } const _Tp& operator*() const { __glibcxx_requires_cond(_M_ok, _M_message(__gnu_debug::__msg_deref_istream) ._M_iterator(*this)); return _M_value; } const _Tp* operator->() const { return &(operator*()); } istream_iterator& operator++() { __glibcxx_requires_cond(_M_ok, _M_message(__gnu_debug::__msg_inc_istream) ._M_iterator(*this)); _M_read(); return *this; } istream_iterator operator++(int) { __glibcxx_requires_cond(_M_ok, _M_message(__gnu_debug::__msg_inc_istream) ._M_iterator(*this)); istream_iterator __tmp = *this; _M_read(); return __tmp; } bool _M_equal(const istream_iterator& __x) const { return (_M_ok == __x._M_ok) && (!_M_ok || _M_stream == __x._M_stream); } private: void _M_read() { _M_ok = (_M_stream && *_M_stream) ? true : false; if (_M_ok) { *_M_stream >> _M_value; _M_ok = *_M_stream ? true : false; } } }; /// Return true if x and y are both end or not end, or x and y are the same. template<typename _Tp, typename _CharT, typename _Traits, typename _Dist> inline bool operator==(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x, const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y) { return __x._M_equal(__y); } /// Return false if x and y are both end or not end, or x and y are the same. template <class _Tp, class _CharT, class _Traits, class _Dist> inline bool operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x, const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y) { return !__x._M_equal(__y); } /** * @brief Provides output iterator semantics for streams. * * This class provides an iterator to write to an ostream. The type Tp is * the only type written by this iterator and there must be an * operator<<(Tp) defined. * * @tparam _Tp The type to write to the ostream. * @tparam _CharT The ostream char_type. * @tparam _Traits The ostream char_traits. */ template<typename _Tp, typename _CharT = char, typename _Traits = char_traits<_CharT> > class ostream_iterator : public iterator<output_iterator_tag, void, void, void, void> { public: //@{ /// Public typedef typedef _CharT char_type; typedef _Traits traits_type; typedef basic_ostream<_CharT, _Traits> ostream_type; //@} private: ostream_type* _M_stream; const _CharT* _M_string; public: /// Construct from an ostream. ostream_iterator(ostream_type& __s) : _M_stream(&__s), _M_string(0) {} /** * Construct from an ostream. * * The delimiter string @a c is written to the stream after every Tp * written to the stream. The delimiter is not copied, and thus must * not be destroyed while this iterator is in use. * * @param __s Underlying ostream to write to. * @param __c CharT delimiter string to insert. */ ostream_iterator(ostream_type& __s, const _CharT* __c) : _M_stream(&__s), _M_string(__c) { } /// Copy constructor. ostream_iterator(const ostream_iterator& __obj) : _M_stream(__obj._M_stream), _M_string(__obj._M_string) { } /// Writes @a value to underlying ostream using operator<<. If /// constructed with delimiter string, writes delimiter to ostream. ostream_iterator& operator=(const _Tp& __value) { __glibcxx_requires_cond(_M_stream != 0, _M_message(__gnu_debug::__msg_output_ostream) ._M_iterator(*this)); *_M_stream << __value; if (_M_string) *_M_stream << _M_string; return *this; } ostream_iterator& operator*() { return *this; } ostream_iterator& operator++() { return *this; } ostream_iterator& operator++(int) { return *this; } }; // @} group iterators _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif �����������������������������������������������������������c++/4.8.2/bits/stl_multiset.h�����������������������������������������������������������������������0000644�����������������00000070577�14763166030�0011455 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Multiset implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_multiset.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{set} */ #ifndef _STL_MULTISET_H #define _STL_MULTISET_H 1 #include <bits/concept_check.h> #if __cplusplus >= 201103L #include <initializer_list> #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /** * @brief A standard container made up of elements, which can be retrieved * in logarithmic time. * * @ingroup associative_containers * * * @tparam _Key Type of key objects. * @tparam _Compare Comparison function object type, defaults to less<_Key>. * @tparam _Alloc Allocator type, defaults to allocator<_Key>. * * Meets the requirements of a <a href="tables.html#65">container</a>, a * <a href="tables.html#66">reversible container</a>, and an * <a href="tables.html#69">associative container</a> (using equivalent * keys). For a @c multiset<Key> the key_type and value_type are Key. * * Multisets support bidirectional iterators. * * The private tree data is declared exactly the same way for set and * multiset; the distinction is made entirely in how the tree functions are * called (*_unique versus *_equal, same as the standard). */ template <typename _Key, typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<_Key> > class multiset { // concept requirements typedef typename _Alloc::value_type _Alloc_value_type; __glibcxx_class_requires(_Key, _SGIAssignableConcept) __glibcxx_class_requires4(_Compare, bool, _Key, _Key, _BinaryFunctionConcept) __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept) public: // typedefs: typedef _Key key_type; typedef _Key value_type; typedef _Compare key_compare; typedef _Compare value_compare; typedef _Alloc allocator_type; private: /// This turns a red-black tree into a [multi]set. typedef typename _Alloc::template rebind<_Key>::other _Key_alloc_type; typedef _Rb_tree<key_type, value_type, _Identity<value_type>, key_compare, _Key_alloc_type> _Rep_type; /// The actual tree structure. _Rep_type _M_t; public: typedef typename _Key_alloc_type::pointer pointer; typedef typename _Key_alloc_type::const_pointer const_pointer; typedef typename _Key_alloc_type::reference reference; typedef typename _Key_alloc_type::const_reference const_reference; // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 103. set::iterator is required to be modifiable, // but this allows modification of keys. typedef typename _Rep_type::const_iterator iterator; typedef typename _Rep_type::const_iterator const_iterator; typedef typename _Rep_type::const_reverse_iterator reverse_iterator; typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; typedef typename _Rep_type::size_type size_type; typedef typename _Rep_type::difference_type difference_type; // allocation/deallocation /** * @brief Default constructor creates no elements. */ multiset() : _M_t() { } /** * @brief Creates a %multiset with no elements. * @param __comp Comparator to use. * @param __a An allocator object. */ explicit multiset(const _Compare& __comp, const allocator_type& __a = allocator_type()) : _M_t(__comp, _Key_alloc_type(__a)) { } /** * @brief Builds a %multiset from a range. * @param __first An input iterator. * @param __last An input iterator. * * Create a %multiset consisting of copies of the elements from * [first,last). This is linear in N if the range is already sorted, * and NlogN otherwise (where N is distance(__first,__last)). */ template<typename _InputIterator> multiset(_InputIterator __first, _InputIterator __last) : _M_t() { _M_t._M_insert_equal(__first, __last); } /** * @brief Builds a %multiset from a range. * @param __first An input iterator. * @param __last An input iterator. * @param __comp A comparison functor. * @param __a An allocator object. * * Create a %multiset consisting of copies of the elements from * [__first,__last). This is linear in N if the range is already sorted, * and NlogN otherwise (where N is distance(__first,__last)). */ template<typename _InputIterator> multiset(_InputIterator __first, _InputIterator __last, const _Compare& __comp, const allocator_type& __a = allocator_type()) : _M_t(__comp, _Key_alloc_type(__a)) { _M_t._M_insert_equal(__first, __last); } /** * @brief %Multiset copy constructor. * @param __x A %multiset of identical element and allocator types. * * The newly-created %multiset uses a copy of the allocation object used * by @a __x. */ multiset(const multiset& __x) : _M_t(__x._M_t) { } #if __cplusplus >= 201103L /** * @brief %Multiset move constructor. * @param __x A %multiset of identical element and allocator types. * * The newly-created %multiset contains the exact contents of @a __x. * The contents of @a __x are a valid, but unspecified %multiset. */ multiset(multiset&& __x) noexcept(is_nothrow_copy_constructible<_Compare>::value) : _M_t(std::move(__x._M_t)) { } /** * @brief Builds a %multiset from an initializer_list. * @param __l An initializer_list. * @param __comp A comparison functor. * @param __a An allocator object. * * Create a %multiset consisting of copies of the elements from * the list. This is linear in N if the list is already sorted, * and NlogN otherwise (where N is @a __l.size()). */ multiset(initializer_list<value_type> __l, const _Compare& __comp = _Compare(), const allocator_type& __a = allocator_type()) : _M_t(__comp, _Key_alloc_type(__a)) { _M_t._M_insert_equal(__l.begin(), __l.end()); } #endif /** * @brief %Multiset assignment operator. * @param __x A %multiset of identical element and allocator types. * * All the elements of @a __x are copied, but unlike the copy * constructor, the allocator object is not copied. */ multiset& operator=(const multiset& __x) { _M_t = __x._M_t; return *this; } #if __cplusplus >= 201103L /** * @brief %Multiset move assignment operator. * @param __x A %multiset of identical element and allocator types. * * The contents of @a __x are moved into this %multiset * (without copying). @a __x is a valid, but unspecified * %multiset. */ multiset& operator=(multiset&& __x) { // NB: DR 1204. // NB: DR 675. this->clear(); this->swap(__x); return *this; } /** * @brief %Multiset list assignment operator. * @param __l An initializer_list. * * This function fills a %multiset with copies of the elements in the * initializer list @a __l. * * Note that the assignment completely changes the %multiset and * that the resulting %multiset's size is the same as the number * of elements assigned. Old data may be lost. */ multiset& operator=(initializer_list<value_type> __l) { this->clear(); this->insert(__l.begin(), __l.end()); return *this; } #endif // accessors: /// Returns the comparison object. key_compare key_comp() const { return _M_t.key_comp(); } /// Returns the comparison object. value_compare value_comp() const { return _M_t.key_comp(); } /// Returns the memory allocation object. allocator_type get_allocator() const _GLIBCXX_NOEXCEPT { return allocator_type(_M_t.get_allocator()); } /** * Returns a read-only (constant) iterator that points to the first * element in the %multiset. Iteration is done in ascending order * according to the keys. */ iterator begin() const _GLIBCXX_NOEXCEPT { return _M_t.begin(); } /** * Returns a read-only (constant) iterator that points one past the last * element in the %multiset. Iteration is done in ascending order * according to the keys. */ iterator end() const _GLIBCXX_NOEXCEPT { return _M_t.end(); } /** * Returns a read-only (constant) reverse iterator that points to the * last element in the %multiset. Iteration is done in descending order * according to the keys. */ reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return _M_t.rbegin(); } /** * Returns a read-only (constant) reverse iterator that points to the * last element in the %multiset. Iteration is done in descending order * according to the keys. */ reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return _M_t.rend(); } #if __cplusplus >= 201103L /** * Returns a read-only (constant) iterator that points to the first * element in the %multiset. Iteration is done in ascending order * according to the keys. */ iterator cbegin() const noexcept { return _M_t.begin(); } /** * Returns a read-only (constant) iterator that points one past the last * element in the %multiset. Iteration is done in ascending order * according to the keys. */ iterator cend() const noexcept { return _M_t.end(); } /** * Returns a read-only (constant) reverse iterator that points to the * last element in the %multiset. Iteration is done in descending order * according to the keys. */ reverse_iterator crbegin() const noexcept { return _M_t.rbegin(); } /** * Returns a read-only (constant) reverse iterator that points to the * last element in the %multiset. Iteration is done in descending order * according to the keys. */ reverse_iterator crend() const noexcept { return _M_t.rend(); } #endif /// Returns true if the %set is empty. bool empty() const _GLIBCXX_NOEXCEPT { return _M_t.empty(); } /// Returns the size of the %set. size_type size() const _GLIBCXX_NOEXCEPT { return _M_t.size(); } /// Returns the maximum size of the %set. size_type max_size() const _GLIBCXX_NOEXCEPT { return _M_t.max_size(); } /** * @brief Swaps data with another %multiset. * @param __x A %multiset of the same element and allocator types. * * This exchanges the elements between two multisets in constant time. * (It is only swapping a pointer, an integer, and an instance of the @c * Compare type (which itself is often stateless and empty), so it should * be quite fast.) * Note that the global std::swap() function is specialized such that * std::swap(s1,s2) will feed to this function. */ void swap(multiset& __x) { _M_t.swap(__x._M_t); } // insert/erase #if __cplusplus >= 201103L /** * @brief Builds and inserts an element into the %multiset. * @param __args Arguments used to generate the element instance to be * inserted. * @return An iterator that points to the inserted element. * * This function inserts an element into the %multiset. Contrary * to a std::set the %multiset does not rely on unique keys and thus * multiple copies of the same element can be inserted. * * Insertion requires logarithmic time. */ template<typename... _Args> iterator emplace(_Args&&... __args) { return _M_t._M_emplace_equal(std::forward<_Args>(__args)...); } /** * @brief Builds and inserts an element into the %multiset. * @param __pos An iterator that serves as a hint as to where the * element should be inserted. * @param __args Arguments used to generate the element instance to be * inserted. * @return An iterator that points to the inserted element. * * This function inserts an element into the %multiset. Contrary * to a std::set the %multiset does not rely on unique keys and thus * multiple copies of the same element can be inserted. * * Note that the first parameter is only a hint and can potentially * improve the performance of the insertion process. A bad hint would * cause no gains in efficiency. * * See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html * for more on @a hinting. * * Insertion requires logarithmic time (if the hint is not taken). */ template<typename... _Args> iterator emplace_hint(const_iterator __pos, _Args&&... __args) { return _M_t._M_emplace_hint_equal(__pos, std::forward<_Args>(__args)...); } #endif /** * @brief Inserts an element into the %multiset. * @param __x Element to be inserted. * @return An iterator that points to the inserted element. * * This function inserts an element into the %multiset. Contrary * to a std::set the %multiset does not rely on unique keys and thus * multiple copies of the same element can be inserted. * * Insertion requires logarithmic time. */ iterator insert(const value_type& __x) { return _M_t._M_insert_equal(__x); } #if __cplusplus >= 201103L iterator insert(value_type&& __x) { return _M_t._M_insert_equal(std::move(__x)); } #endif /** * @brief Inserts an element into the %multiset. * @param __position An iterator that serves as a hint as to where the * element should be inserted. * @param __x Element to be inserted. * @return An iterator that points to the inserted element. * * This function inserts an element into the %multiset. Contrary * to a std::set the %multiset does not rely on unique keys and thus * multiple copies of the same element can be inserted. * * Note that the first parameter is only a hint and can potentially * improve the performance of the insertion process. A bad hint would * cause no gains in efficiency. * * See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html * for more on @a hinting. * * Insertion requires logarithmic time (if the hint is not taken). */ iterator insert(const_iterator __position, const value_type& __x) { return _M_t._M_insert_equal_(__position, __x); } #if __cplusplus >= 201103L iterator insert(const_iterator __position, value_type&& __x) { return _M_t._M_insert_equal_(__position, std::move(__x)); } #endif /** * @brief A template function that tries to insert a range of elements. * @param __first Iterator pointing to the start of the range to be * inserted. * @param __last Iterator pointing to the end of the range. * * Complexity similar to that of the range constructor. */ template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) { _M_t._M_insert_equal(__first, __last); } #if __cplusplus >= 201103L /** * @brief Attempts to insert a list of elements into the %multiset. * @param __l A std::initializer_list<value_type> of elements * to be inserted. * * Complexity similar to that of the range constructor. */ void insert(initializer_list<value_type> __l) { this->insert(__l.begin(), __l.end()); } #endif #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 130. Associative erase should return an iterator. /** * @brief Erases an element from a %multiset. * @param __position An iterator pointing to the element to be erased. * @return An iterator pointing to the element immediately following * @a position prior to the element being erased. If no such * element exists, end() is returned. * * This function erases an element, pointed to by the given iterator, * from a %multiset. Note that this function only erases the element, * and that if the element is itself a pointer, the pointed-to memory is * not touched in any way. Managing the pointer is the user's * responsibility. */ _GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __position) { return _M_t.erase(__position); } #else /** * @brief Erases an element from a %multiset. * @param __position An iterator pointing to the element to be erased. * * This function erases an element, pointed to by the given iterator, * from a %multiset. Note that this function only erases the element, * and that if the element is itself a pointer, the pointed-to memory is * not touched in any way. Managing the pointer is the user's * responsibility. */ void erase(iterator __position) { _M_t.erase(__position); } #endif /** * @brief Erases elements according to the provided key. * @param __x Key of element to be erased. * @return The number of elements erased. * * This function erases all elements located by the given key from a * %multiset. * Note that this function only erases the element, and that if * the element is itself a pointer, the pointed-to memory is not touched * in any way. Managing the pointer is the user's responsibility. */ size_type erase(const key_type& __x) { return _M_t.erase(__x); } #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 130. Associative erase should return an iterator. /** * @brief Erases a [first,last) range of elements from a %multiset. * @param __first Iterator pointing to the start of the range to be * erased. * @param __last Iterator pointing to the end of the range to * be erased. * @return The iterator @a last. * * This function erases a sequence of elements from a %multiset. * Note that this function only erases the elements, and that if * the elements themselves are pointers, the pointed-to memory is not * touched in any way. Managing the pointer is the user's * responsibility. */ _GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __first, const_iterator __last) { return _M_t.erase(__first, __last); } #else /** * @brief Erases a [first,last) range of elements from a %multiset. * @param first Iterator pointing to the start of the range to be * erased. * @param last Iterator pointing to the end of the range to be erased. * * This function erases a sequence of elements from a %multiset. * Note that this function only erases the elements, and that if * the elements themselves are pointers, the pointed-to memory is not * touched in any way. Managing the pointer is the user's * responsibility. */ void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last); } #endif /** * Erases all elements in a %multiset. Note that this function only * erases the elements, and that if the elements themselves are pointers, * the pointed-to memory is not touched in any way. Managing the pointer * is the user's responsibility. */ void clear() _GLIBCXX_NOEXCEPT { _M_t.clear(); } // multiset operations: /** * @brief Finds the number of elements with given key. * @param __x Key of elements to be located. * @return Number of elements with specified key. */ size_type count(const key_type& __x) const { return _M_t.count(__x); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload //@{ /** * @brief Tries to locate an element in a %set. * @param __x Element to be located. * @return Iterator pointing to sought-after element, or end() if not * found. * * This function takes a key and tries to locate the element with which * the key matches. If successful the function returns an iterator * pointing to the sought after element. If unsuccessful it returns the * past-the-end ( @c end() ) iterator. */ iterator find(const key_type& __x) { return _M_t.find(__x); } const_iterator find(const key_type& __x) const { return _M_t.find(__x); } //@} //@{ /** * @brief Finds the beginning of a subsequence matching given key. * @param __x Key to be located. * @return Iterator pointing to first element equal to or greater * than key, or end(). * * This function returns the first element of a subsequence of elements * that matches the given key. If unsuccessful it returns an iterator * pointing to the first element that has a greater value than given key * or end() if no such element exists. */ iterator lower_bound(const key_type& __x) { return _M_t.lower_bound(__x); } const_iterator lower_bound(const key_type& __x) const { return _M_t.lower_bound(__x); } //@} //@{ /** * @brief Finds the end of a subsequence matching given key. * @param __x Key to be located. * @return Iterator pointing to the first element * greater than key, or end(). */ iterator upper_bound(const key_type& __x) { return _M_t.upper_bound(__x); } const_iterator upper_bound(const key_type& __x) const { return _M_t.upper_bound(__x); } //@} //@{ /** * @brief Finds a subsequence matching given key. * @param __x Key to be located. * @return Pair of iterators that possibly points to the subsequence * matching given key. * * This function is equivalent to * @code * std::make_pair(c.lower_bound(val), * c.upper_bound(val)) * @endcode * (but is faster than making the calls separately). * * This function probably only makes sense for multisets. */ std::pair<iterator, iterator> equal_range(const key_type& __x) { return _M_t.equal_range(__x); } std::pair<const_iterator, const_iterator> equal_range(const key_type& __x) const { return _M_t.equal_range(__x); } //@} template<typename _K1, typename _C1, typename _A1> friend bool operator==(const multiset<_K1, _C1, _A1>&, const multiset<_K1, _C1, _A1>&); template<typename _K1, typename _C1, typename _A1> friend bool operator< (const multiset<_K1, _C1, _A1>&, const multiset<_K1, _C1, _A1>&); }; /** * @brief Multiset equality comparison. * @param __x A %multiset. * @param __y A %multiset of the same type as @a __x. * @return True iff the size and elements of the multisets are equal. * * This is an equivalence relation. It is linear in the size of the * multisets. * Multisets are considered equivalent if their sizes are equal, and if * corresponding elements compare equal. */ template<typename _Key, typename _Compare, typename _Alloc> inline bool operator==(const multiset<_Key, _Compare, _Alloc>& __x, const multiset<_Key, _Compare, _Alloc>& __y) { return __x._M_t == __y._M_t; } /** * @brief Multiset ordering relation. * @param __x A %multiset. * @param __y A %multiset of the same type as @a __x. * @return True iff @a __x is lexicographically less than @a __y. * * This is a total ordering relation. It is linear in the size of the * maps. The elements must be comparable with @c <. * * See std::lexicographical_compare() for how the determination is made. */ template<typename _Key, typename _Compare, typename _Alloc> inline bool operator<(const multiset<_Key, _Compare, _Alloc>& __x, const multiset<_Key, _Compare, _Alloc>& __y) { return __x._M_t < __y._M_t; } /// Returns !(x == y). template<typename _Key, typename _Compare, typename _Alloc> inline bool operator!=(const multiset<_Key, _Compare, _Alloc>& __x, const multiset<_Key, _Compare, _Alloc>& __y) { return !(__x == __y); } /// Returns y < x. template<typename _Key, typename _Compare, typename _Alloc> inline bool operator>(const multiset<_Key,_Compare,_Alloc>& __x, const multiset<_Key,_Compare,_Alloc>& __y) { return __y < __x; } /// Returns !(y < x) template<typename _Key, typename _Compare, typename _Alloc> inline bool operator<=(const multiset<_Key, _Compare, _Alloc>& __x, const multiset<_Key, _Compare, _Alloc>& __y) { return !(__y < __x); } /// Returns !(x < y) template<typename _Key, typename _Compare, typename _Alloc> inline bool operator>=(const multiset<_Key, _Compare, _Alloc>& __x, const multiset<_Key, _Compare, _Alloc>& __y) { return !(__x < __y); } /// See std::multiset::swap(). template<typename _Key, typename _Compare, typename _Alloc> inline void swap(multiset<_Key, _Compare, _Alloc>& __x, multiset<_Key, _Compare, _Alloc>& __y) { __x.swap(__y); } _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std #endif /* _STL_MULTISET_H */ ���������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/shared_ptr_base.h��������������������������������������������������������������������0000644�����������������00000121226�14763166030�0012036 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// shared_ptr and weak_ptr implementation details -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // GCC Note: Based on files from version 1.32.0 of the Boost library. // shared_count.hpp // Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. // shared_ptr.hpp // Copyright (C) 1998, 1999 Greg Colvin and Beman Dawes. // Copyright (C) 2001, 2002, 2003 Peter Dimov // weak_ptr.hpp // Copyright (C) 2001, 2002, 2003 Peter Dimov // enable_shared_from_this.hpp // Copyright (C) 2002 Peter Dimov // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) /** @file bits/shared_ptr_base.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{memory} */ #ifndef _SHARED_PTR_BASE_H #define _SHARED_PTR_BASE_H 1 namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION #if _GLIBCXX_USE_DEPRECATED template<typename> class auto_ptr; #endif /** * @brief Exception possibly thrown by @c shared_ptr. * @ingroup exceptions */ class bad_weak_ptr : public std::exception { public: virtual char const* what() const noexcept; virtual ~bad_weak_ptr() noexcept; }; // Substitute for bad_weak_ptr object in the case of -fno-exceptions. inline void __throw_bad_weak_ptr() { _GLIBCXX_THROW_OR_ABORT(bad_weak_ptr()); } using __gnu_cxx::_Lock_policy; using __gnu_cxx::__default_lock_policy; using __gnu_cxx::_S_single; using __gnu_cxx::_S_mutex; using __gnu_cxx::_S_atomic; // Empty helper class except when the template argument is _S_mutex. template<_Lock_policy _Lp> class _Mutex_base { protected: // The atomic policy uses fully-fenced builtins, single doesn't care. enum { _S_need_barriers = 0 }; }; template<> class _Mutex_base<_S_mutex> : public __gnu_cxx::__mutex { protected: // This policy is used when atomic builtins are not available. // The replacement atomic operations might not have the necessary // memory barriers. enum { _S_need_barriers = 1 }; }; template<_Lock_policy _Lp = __default_lock_policy> class _Sp_counted_base : public _Mutex_base<_Lp> { public: _Sp_counted_base() noexcept : _M_use_count(1), _M_weak_count(1) { } virtual ~_Sp_counted_base() noexcept { } // Called when _M_use_count drops to zero, to release the resources // managed by *this. virtual void _M_dispose() noexcept = 0; // Called when _M_weak_count drops to zero. virtual void _M_destroy() noexcept { delete this; } virtual void* _M_get_deleter(const std::type_info&) = 0; void _M_add_ref_copy() { __gnu_cxx::__atomic_add_dispatch(&_M_use_count, 1); } void _M_add_ref_lock(); void _M_release() noexcept { // Be race-detector-friendly. For more info see bits/c++config. _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_use_count); if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1) { _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count); _M_dispose(); // There must be a memory barrier between dispose() and destroy() // to ensure that the effects of dispose() are observed in the // thread that runs destroy(). // See http://gcc.gnu.org/ml/libstdc++/2005-11/msg00136.html if (_Mutex_base<_Lp>::_S_need_barriers) { _GLIBCXX_READ_MEM_BARRIER; _GLIBCXX_WRITE_MEM_BARRIER; } // Be race-detector-friendly. For more info see bits/c++config. _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count); if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, -1) == 1) { _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count); _M_destroy(); } } } void _M_weak_add_ref() noexcept { __gnu_cxx::__atomic_add_dispatch(&_M_weak_count, 1); } void _M_weak_release() noexcept { // Be race-detector-friendly. For more info see bits/c++config. _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count); if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, -1) == 1) { _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count); if (_Mutex_base<_Lp>::_S_need_barriers) { // See _M_release(), // destroy() must observe results of dispose() _GLIBCXX_READ_MEM_BARRIER; _GLIBCXX_WRITE_MEM_BARRIER; } _M_destroy(); } } long _M_get_use_count() const noexcept { // No memory barrier is used here so there is no synchronization // with other threads. return __atomic_load_n(&_M_use_count, __ATOMIC_RELAXED); } private: _Sp_counted_base(_Sp_counted_base const&) = delete; _Sp_counted_base& operator=(_Sp_counted_base const&) = delete; _Atomic_word _M_use_count; // #shared _Atomic_word _M_weak_count; // #weak + (#shared != 0) }; template<> inline void _Sp_counted_base<_S_single>:: _M_add_ref_lock() { if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0) { _M_use_count = 0; __throw_bad_weak_ptr(); } } template<> inline void _Sp_counted_base<_S_mutex>:: _M_add_ref_lock() { __gnu_cxx::__scoped_lock sentry(*this); if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0) { _M_use_count = 0; __throw_bad_weak_ptr(); } } template<> inline void _Sp_counted_base<_S_atomic>:: _M_add_ref_lock() { // Perform lock-free add-if-not-zero operation. _Atomic_word __count = _M_get_use_count(); do { if (__count == 0) __throw_bad_weak_ptr(); // Replace the current counter value with the old value + 1, as // long as it's not changed meanwhile. } while (!__atomic_compare_exchange_n(&_M_use_count, &__count, __count + 1, true, __ATOMIC_ACQ_REL, __ATOMIC_RELAXED)); } // Forward declarations. template<typename _Tp, _Lock_policy _Lp = __default_lock_policy> class __shared_ptr; template<typename _Tp, _Lock_policy _Lp = __default_lock_policy> class __weak_ptr; template<typename _Tp, _Lock_policy _Lp = __default_lock_policy> class __enable_shared_from_this; template<typename _Tp> class shared_ptr; template<typename _Tp> class weak_ptr; template<typename _Tp> struct owner_less; template<typename _Tp> class enable_shared_from_this; template<_Lock_policy _Lp = __default_lock_policy> class __weak_count; template<_Lock_policy _Lp = __default_lock_policy> class __shared_count; // Counted ptr with no deleter or allocator support template<typename _Ptr, _Lock_policy _Lp> class _Sp_counted_ptr final : public _Sp_counted_base<_Lp> { public: explicit _Sp_counted_ptr(_Ptr __p) : _M_ptr(__p) { } virtual void _M_dispose() noexcept { delete _M_ptr; } virtual void _M_destroy() noexcept { delete this; } virtual void* _M_get_deleter(const std::type_info&) { return 0; } _Sp_counted_ptr(const _Sp_counted_ptr&) = delete; _Sp_counted_ptr& operator=(const _Sp_counted_ptr&) = delete; protected: _Ptr _M_ptr; // copy constructor must not throw }; template<> inline void _Sp_counted_ptr<nullptr_t, _S_single>::_M_dispose() noexcept { } template<> inline void _Sp_counted_ptr<nullptr_t, _S_mutex>::_M_dispose() noexcept { } template<> inline void _Sp_counted_ptr<nullptr_t, _S_atomic>::_M_dispose() noexcept { } // Support for custom deleter and/or allocator template<typename _Ptr, typename _Deleter, typename _Alloc, _Lock_policy _Lp> class _Sp_counted_deleter final : public _Sp_counted_base<_Lp> { // Helper class that stores the Deleter and also acts as an allocator. // Used to dispose of the owned pointer and the internal refcount // Requires that copies of _Alloc can free each other's memory. struct _My_Deleter : public _Alloc // copy constructor must not throw { _Deleter _M_del; // copy constructor must not throw _My_Deleter(_Deleter __d, const _Alloc& __a) : _Alloc(__a), _M_del(__d) { } }; public: // __d(__p) must not throw. _Sp_counted_deleter(_Ptr __p, _Deleter __d) : _M_ptr(__p), _M_del(__d, _Alloc()) { } // __d(__p) must not throw. _Sp_counted_deleter(_Ptr __p, _Deleter __d, const _Alloc& __a) : _M_ptr(__p), _M_del(__d, __a) { } ~_Sp_counted_deleter() noexcept { } virtual void _M_dispose() noexcept { _M_del._M_del(_M_ptr); } virtual void _M_destroy() noexcept { typedef typename allocator_traits<_Alloc>::template rebind_traits<_Sp_counted_deleter> _Alloc_traits; typename _Alloc_traits::allocator_type __a(_M_del); _Alloc_traits::destroy(__a, this); _Alloc_traits::deallocate(__a, this, 1); } virtual void* _M_get_deleter(const std::type_info& __ti) { #ifdef __GXX_RTTI return __ti == typeid(_Deleter) ? &_M_del._M_del : 0; #else return 0; #endif } protected: _Ptr _M_ptr; // copy constructor must not throw _My_Deleter _M_del; // copy constructor must not throw }; // helpers for make_shared / allocate_shared struct _Sp_make_shared_tag { }; template<typename _Tp, typename _Alloc, _Lock_policy _Lp> class _Sp_counted_ptr_inplace final : public _Sp_counted_base<_Lp> { // Helper class that stores the pointer and also acts as an allocator. // Used to dispose of the owned pointer and the internal refcount // Requires that copies of _Alloc can free each other's memory. struct _Impl : public _Alloc // copy constructor must not throw { _Impl(_Alloc __a) : _Alloc(__a), _M_ptr() { } _Tp* _M_ptr; }; public: template<typename... _Args> _Sp_counted_ptr_inplace(_Alloc __a, _Args&&... __args) : _M_impl(__a) { _M_impl._M_ptr = static_cast<_Tp*>(static_cast<void*>(&_M_storage)); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2070. allocate_shared should use allocator_traits<A>::construct allocator_traits<_Alloc>::construct(__a, _M_impl._M_ptr, std::forward<_Args>(__args)...); // might throw } ~_Sp_counted_ptr_inplace() noexcept { } virtual void _M_dispose() noexcept { allocator_traits<_Alloc>::destroy(_M_impl, _M_impl._M_ptr); } // Override because the allocator needs to know the dynamic type virtual void _M_destroy() noexcept { typedef typename allocator_traits<_Alloc>::template rebind_traits<_Sp_counted_ptr_inplace> _Alloc_traits; typename _Alloc_traits::allocator_type __a(_M_impl); _Alloc_traits::destroy(__a, this); _Alloc_traits::deallocate(__a, this, 1); } // Sneaky trick so __shared_ptr can get the managed pointer virtual void* _M_get_deleter(const std::type_info& __ti) noexcept { #ifdef __GXX_RTTI return __ti == typeid(_Sp_make_shared_tag) ? static_cast<void*>(&_M_storage) : 0; #else return 0; #endif } private: _Impl _M_impl; typename aligned_storage<sizeof(_Tp), alignment_of<_Tp>::value>::type _M_storage; }; template<_Lock_policy _Lp> class __shared_count { public: constexpr __shared_count() noexcept : _M_pi(0) { } template<typename _Ptr> explicit __shared_count(_Ptr __p) : _M_pi(0) { __try { _M_pi = new _Sp_counted_ptr<_Ptr, _Lp>(__p); } __catch(...) { delete __p; __throw_exception_again; } } template<typename _Ptr, typename _Deleter> __shared_count(_Ptr __p, _Deleter __d) : __shared_count(__p, std::move(__d), allocator<int>()) { } template<typename _Ptr, typename _Deleter, typename _Alloc> __shared_count(_Ptr __p, _Deleter __d, _Alloc __a) : _M_pi(0) { typedef _Sp_counted_deleter<_Ptr, _Deleter, _Alloc, _Lp> _Sp_cd_type; typedef typename allocator_traits<_Alloc>::template rebind_traits<_Sp_cd_type> _Alloc_traits; typename _Alloc_traits::allocator_type __a2(__a); _Sp_cd_type* __mem = 0; __try { __mem = _Alloc_traits::allocate(__a2, 1); _Alloc_traits::construct(__a2, __mem, __p, std::move(__d), std::move(__a)); _M_pi = __mem; } __catch(...) { __d(__p); // Call _Deleter on __p. if (__mem) _Alloc_traits::deallocate(__a2, __mem, 1); __throw_exception_again; } } template<typename _Tp, typename _Alloc, typename... _Args> __shared_count(_Sp_make_shared_tag, _Tp*, const _Alloc& __a, _Args&&... __args) : _M_pi(0) { typedef _Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp> _Sp_cp_type; typedef typename allocator_traits<_Alloc>::template rebind_traits<_Sp_cp_type> _Alloc_traits; typename _Alloc_traits::allocator_type __a2(__a); _Sp_cp_type* __mem = _Alloc_traits::allocate(__a2, 1); __try { _Alloc_traits::construct(__a2, __mem, std::move(__a), std::forward<_Args>(__args)...); _M_pi = __mem; } __catch(...) { _Alloc_traits::deallocate(__a2, __mem, 1); __throw_exception_again; } } #if _GLIBCXX_USE_DEPRECATED // Special case for auto_ptr<_Tp> to provide the strong guarantee. template<typename _Tp> explicit __shared_count(std::auto_ptr<_Tp>&& __r); #endif // Special case for unique_ptr<_Tp,_Del> to provide the strong guarantee. template<typename _Tp, typename _Del> explicit __shared_count(std::unique_ptr<_Tp, _Del>&& __r) : _M_pi(0) { using _Ptr = typename unique_ptr<_Tp, _Del>::pointer; using _Del2 = typename conditional<is_reference<_Del>::value, reference_wrapper<typename remove_reference<_Del>::type>, _Del>::type; using _Sp_cd_type = _Sp_counted_deleter<_Ptr, _Del2, allocator<void>, _Lp>; using _Alloc = allocator<_Sp_cd_type>; using _Alloc_traits = allocator_traits<_Alloc>; _Alloc __a; _Sp_cd_type* __mem = _Alloc_traits::allocate(__a, 1); _Alloc_traits::construct(__a, __mem, __r.release(), __r.get_deleter()); // non-throwing _M_pi = __mem; } // Throw bad_weak_ptr when __r._M_get_use_count() == 0. explicit __shared_count(const __weak_count<_Lp>& __r); ~__shared_count() noexcept { if (_M_pi != nullptr) _M_pi->_M_release(); } __shared_count(const __shared_count& __r) noexcept : _M_pi(__r._M_pi) { if (_M_pi != 0) _M_pi->_M_add_ref_copy(); } __shared_count& operator=(const __shared_count& __r) noexcept { _Sp_counted_base<_Lp>* __tmp = __r._M_pi; if (__tmp != _M_pi) { if (__tmp != 0) __tmp->_M_add_ref_copy(); if (_M_pi != 0) _M_pi->_M_release(); _M_pi = __tmp; } return *this; } void _M_swap(__shared_count& __r) noexcept { _Sp_counted_base<_Lp>* __tmp = __r._M_pi; __r._M_pi = _M_pi; _M_pi = __tmp; } long _M_get_use_count() const noexcept { return _M_pi != 0 ? _M_pi->_M_get_use_count() : 0; } bool _M_unique() const noexcept { return this->_M_get_use_count() == 1; } void* _M_get_deleter(const std::type_info& __ti) const noexcept { return _M_pi ? _M_pi->_M_get_deleter(__ti) : 0; } bool _M_less(const __shared_count& __rhs) const noexcept { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); } bool _M_less(const __weak_count<_Lp>& __rhs) const noexcept { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); } // Friend function injected into enclosing namespace and found by ADL friend inline bool operator==(const __shared_count& __a, const __shared_count& __b) noexcept { return __a._M_pi == __b._M_pi; } private: friend class __weak_count<_Lp>; _Sp_counted_base<_Lp>* _M_pi; }; template<_Lock_policy _Lp> class __weak_count { public: constexpr __weak_count() noexcept : _M_pi(0) { } __weak_count(const __shared_count<_Lp>& __r) noexcept : _M_pi(__r._M_pi) { if (_M_pi != 0) _M_pi->_M_weak_add_ref(); } __weak_count(const __weak_count<_Lp>& __r) noexcept : _M_pi(__r._M_pi) { if (_M_pi != 0) _M_pi->_M_weak_add_ref(); } ~__weak_count() noexcept { if (_M_pi != 0) _M_pi->_M_weak_release(); } __weak_count<_Lp>& operator=(const __shared_count<_Lp>& __r) noexcept { _Sp_counted_base<_Lp>* __tmp = __r._M_pi; if (__tmp != 0) __tmp->_M_weak_add_ref(); if (_M_pi != 0) _M_pi->_M_weak_release(); _M_pi = __tmp; return *this; } __weak_count<_Lp>& operator=(const __weak_count<_Lp>& __r) noexcept { _Sp_counted_base<_Lp>* __tmp = __r._M_pi; if (__tmp != 0) __tmp->_M_weak_add_ref(); if (_M_pi != 0) _M_pi->_M_weak_release(); _M_pi = __tmp; return *this; } void _M_swap(__weak_count<_Lp>& __r) noexcept { _Sp_counted_base<_Lp>* __tmp = __r._M_pi; __r._M_pi = _M_pi; _M_pi = __tmp; } long _M_get_use_count() const noexcept { return _M_pi != 0 ? _M_pi->_M_get_use_count() : 0; } bool _M_less(const __weak_count& __rhs) const noexcept { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); } bool _M_less(const __shared_count<_Lp>& __rhs) const noexcept { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); } // Friend function injected into enclosing namespace and found by ADL friend inline bool operator==(const __weak_count& __a, const __weak_count& __b) noexcept { return __a._M_pi == __b._M_pi; } private: friend class __shared_count<_Lp>; _Sp_counted_base<_Lp>* _M_pi; }; // Now that __weak_count is defined we can define this constructor: template<_Lock_policy _Lp> inline __shared_count<_Lp>:: __shared_count(const __weak_count<_Lp>& __r) : _M_pi(__r._M_pi) { if (_M_pi != 0) _M_pi->_M_add_ref_lock(); else __throw_bad_weak_ptr(); } // Support for enable_shared_from_this. // Friend of __enable_shared_from_this. template<_Lock_policy _Lp, typename _Tp1, typename _Tp2> void __enable_shared_from_this_helper(const __shared_count<_Lp>&, const __enable_shared_from_this<_Tp1, _Lp>*, const _Tp2*) noexcept; // Friend of enable_shared_from_this. template<typename _Tp1, typename _Tp2> void __enable_shared_from_this_helper(const __shared_count<>&, const enable_shared_from_this<_Tp1>*, const _Tp2*) noexcept; template<_Lock_policy _Lp> inline void __enable_shared_from_this_helper(const __shared_count<_Lp>&, ...) noexcept { } template<typename _Tp, _Lock_policy _Lp> class __shared_ptr { public: typedef _Tp element_type; constexpr __shared_ptr() noexcept : _M_ptr(0), _M_refcount() { } template<typename _Tp1> explicit __shared_ptr(_Tp1* __p) : _M_ptr(__p), _M_refcount(__p) { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) static_assert( sizeof(_Tp1) > 0, "incomplete type" ); __enable_shared_from_this_helper(_M_refcount, __p, __p); } template<typename _Tp1, typename _Deleter> __shared_ptr(_Tp1* __p, _Deleter __d) : _M_ptr(__p), _M_refcount(__p, __d) { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) // TODO requires _Deleter CopyConstructible and __d(__p) well-formed __enable_shared_from_this_helper(_M_refcount, __p, __p); } template<typename _Tp1, typename _Deleter, typename _Alloc> __shared_ptr(_Tp1* __p, _Deleter __d, _Alloc __a) : _M_ptr(__p), _M_refcount(__p, __d, std::move(__a)) { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) // TODO requires _Deleter CopyConstructible and __d(__p) well-formed __enable_shared_from_this_helper(_M_refcount, __p, __p); } template<typename _Deleter> __shared_ptr(nullptr_t __p, _Deleter __d) : _M_ptr(0), _M_refcount(__p, __d) { } template<typename _Deleter, typename _Alloc> __shared_ptr(nullptr_t __p, _Deleter __d, _Alloc __a) : _M_ptr(0), _M_refcount(__p, __d, std::move(__a)) { } template<typename _Tp1> __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, _Tp* __p) noexcept : _M_ptr(__p), _M_refcount(__r._M_refcount) // never throws { } __shared_ptr(const __shared_ptr&) noexcept = default; __shared_ptr& operator=(const __shared_ptr&) noexcept = default; ~__shared_ptr() = default; template<typename _Tp1, typename = typename std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type> __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r) noexcept : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) { } __shared_ptr(__shared_ptr&& __r) noexcept : _M_ptr(__r._M_ptr), _M_refcount() { _M_refcount._M_swap(__r._M_refcount); __r._M_ptr = 0; } template<typename _Tp1, typename = typename std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type> __shared_ptr(__shared_ptr<_Tp1, _Lp>&& __r) noexcept : _M_ptr(__r._M_ptr), _M_refcount() { _M_refcount._M_swap(__r._M_refcount); __r._M_ptr = 0; } template<typename _Tp1> explicit __shared_ptr(const __weak_ptr<_Tp1, _Lp>& __r) : _M_refcount(__r._M_refcount) // may throw { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) // It is now safe to copy __r._M_ptr, as // _M_refcount(__r._M_refcount) did not throw. _M_ptr = __r._M_ptr; } // If an exception is thrown this constructor has no effect. template<typename _Tp1, typename _Del> __shared_ptr(std::unique_ptr<_Tp1, _Del>&& __r) : _M_ptr(__r.get()), _M_refcount() { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) auto __tmp = __r.get(); _M_refcount = __shared_count<_Lp>(std::move(__r)); __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp); } #if _GLIBCXX_USE_DEPRECATED // Postcondition: use_count() == 1 and __r.get() == 0 template<typename _Tp1> __shared_ptr(std::auto_ptr<_Tp1>&& __r); #endif /* TODO: use delegating constructor */ constexpr __shared_ptr(nullptr_t) noexcept : _M_ptr(0), _M_refcount() { } template<typename _Tp1> __shared_ptr& operator=(const __shared_ptr<_Tp1, _Lp>& __r) noexcept { _M_ptr = __r._M_ptr; _M_refcount = __r._M_refcount; // __shared_count::op= doesn't throw return *this; } #if _GLIBCXX_USE_DEPRECATED template<typename _Tp1> __shared_ptr& operator=(std::auto_ptr<_Tp1>&& __r) { __shared_ptr(std::move(__r)).swap(*this); return *this; } #endif __shared_ptr& operator=(__shared_ptr&& __r) noexcept { __shared_ptr(std::move(__r)).swap(*this); return *this; } template<class _Tp1> __shared_ptr& operator=(__shared_ptr<_Tp1, _Lp>&& __r) noexcept { __shared_ptr(std::move(__r)).swap(*this); return *this; } template<typename _Tp1, typename _Del> __shared_ptr& operator=(std::unique_ptr<_Tp1, _Del>&& __r) { __shared_ptr(std::move(__r)).swap(*this); return *this; } void reset() noexcept { __shared_ptr().swap(*this); } template<typename _Tp1> void reset(_Tp1* __p) // _Tp1 must be complete. { // Catch self-reset errors. _GLIBCXX_DEBUG_ASSERT(__p == 0 || __p != _M_ptr); __shared_ptr(__p).swap(*this); } template<typename _Tp1, typename _Deleter> void reset(_Tp1* __p, _Deleter __d) { __shared_ptr(__p, __d).swap(*this); } template<typename _Tp1, typename _Deleter, typename _Alloc> void reset(_Tp1* __p, _Deleter __d, _Alloc __a) { __shared_ptr(__p, __d, std::move(__a)).swap(*this); } // Allow class instantiation when _Tp is [cv-qual] void. typename std::add_lvalue_reference<_Tp>::type operator*() const noexcept { _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); return *_M_ptr; } _Tp* operator->() const noexcept { _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); return _M_ptr; } _Tp* get() const noexcept { return _M_ptr; } explicit operator bool() const // never throws { return _M_ptr == 0 ? false : true; } bool unique() const noexcept { return _M_refcount._M_unique(); } long use_count() const noexcept { return _M_refcount._M_get_use_count(); } void swap(__shared_ptr<_Tp, _Lp>& __other) noexcept { std::swap(_M_ptr, __other._M_ptr); _M_refcount._M_swap(__other._M_refcount); } template<typename _Tp1> bool owner_before(__shared_ptr<_Tp1, _Lp> const& __rhs) const { return _M_refcount._M_less(__rhs._M_refcount); } template<typename _Tp1> bool owner_before(__weak_ptr<_Tp1, _Lp> const& __rhs) const { return _M_refcount._M_less(__rhs._M_refcount); } #ifdef __GXX_RTTI protected: // This constructor is non-standard, it is used by allocate_shared. template<typename _Alloc, typename... _Args> __shared_ptr(_Sp_make_shared_tag __tag, const _Alloc& __a, _Args&&... __args) : _M_ptr(), _M_refcount(__tag, (_Tp*)0, __a, std::forward<_Args>(__args)...) { // _M_ptr needs to point to the newly constructed object. // This relies on _Sp_counted_ptr_inplace::_M_get_deleter. void* __p = _M_refcount._M_get_deleter(typeid(__tag)); _M_ptr = static_cast<_Tp*>(__p); __enable_shared_from_this_helper(_M_refcount, _M_ptr, _M_ptr); } #else template<typename _Alloc> struct _Deleter { void operator()(_Tp* __ptr) { typedef allocator_traits<_Alloc> _Alloc_traits; _Alloc_traits::destroy(_M_alloc, __ptr); _Alloc_traits::deallocate(_M_alloc, __ptr, 1); } _Alloc _M_alloc; }; template<typename _Alloc, typename... _Args> __shared_ptr(_Sp_make_shared_tag __tag, const _Alloc& __a, _Args&&... __args) : _M_ptr(), _M_refcount() { typedef typename _Alloc::template rebind<_Tp>::other _Alloc2; _Deleter<_Alloc2> __del = { _Alloc2(__a) }; typedef allocator_traits<_Alloc2> __traits; _M_ptr = __traits::allocate(__del._M_alloc, 1); __try { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2070. allocate_shared should use allocator_traits<A>::construct __traits::construct(__del._M_alloc, _M_ptr, std::forward<_Args>(__args)...); } __catch(...) { __traits::deallocate(__del._M_alloc, _M_ptr, 1); __throw_exception_again; } __shared_count<_Lp> __count(_M_ptr, __del, __del._M_alloc); _M_refcount._M_swap(__count); __enable_shared_from_this_helper(_M_refcount, _M_ptr, _M_ptr); } #endif template<typename _Tp1, _Lock_policy _Lp1, typename _Alloc, typename... _Args> friend __shared_ptr<_Tp1, _Lp1> __allocate_shared(const _Alloc& __a, _Args&&... __args); private: void* _M_get_deleter(const std::type_info& __ti) const noexcept { return _M_refcount._M_get_deleter(__ti); } template<typename _Tp1, _Lock_policy _Lp1> friend class __shared_ptr; template<typename _Tp1, _Lock_policy _Lp1> friend class __weak_ptr; template<typename _Del, typename _Tp1, _Lock_policy _Lp1> friend _Del* get_deleter(const __shared_ptr<_Tp1, _Lp1>&) noexcept; _Tp* _M_ptr; // Contained pointer. __shared_count<_Lp> _M_refcount; // Reference counter. }; // 20.7.2.2.7 shared_ptr comparisons template<typename _Tp1, typename _Tp2, _Lock_policy _Lp> inline bool operator==(const __shared_ptr<_Tp1, _Lp>& __a, const __shared_ptr<_Tp2, _Lp>& __b) noexcept { return __a.get() == __b.get(); } template<typename _Tp, _Lock_policy _Lp> inline bool operator==(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept { return !__a; } template<typename _Tp, _Lock_policy _Lp> inline bool operator==(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept { return !__a; } template<typename _Tp1, typename _Tp2, _Lock_policy _Lp> inline bool operator!=(const __shared_ptr<_Tp1, _Lp>& __a, const __shared_ptr<_Tp2, _Lp>& __b) noexcept { return __a.get() != __b.get(); } template<typename _Tp, _Lock_policy _Lp> inline bool operator!=(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept { return (bool)__a; } template<typename _Tp, _Lock_policy _Lp> inline bool operator!=(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept { return (bool)__a; } template<typename _Tp1, typename _Tp2, _Lock_policy _Lp> inline bool operator<(const __shared_ptr<_Tp1, _Lp>& __a, const __shared_ptr<_Tp2, _Lp>& __b) noexcept { typedef typename std::common_type<_Tp1*, _Tp2*>::type _CT; return std::less<_CT>()(__a.get(), __b.get()); } template<typename _Tp, _Lock_policy _Lp> inline bool operator<(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept { return std::less<_Tp*>()(__a.get(), nullptr); } template<typename _Tp, _Lock_policy _Lp> inline bool operator<(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept { return std::less<_Tp*>()(nullptr, __a.get()); } template<typename _Tp1, typename _Tp2, _Lock_policy _Lp> inline bool operator<=(const __shared_ptr<_Tp1, _Lp>& __a, const __shared_ptr<_Tp2, _Lp>& __b) noexcept { return !(__b < __a); } template<typename _Tp, _Lock_policy _Lp> inline bool operator<=(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept { return !(nullptr < __a); } template<typename _Tp, _Lock_policy _Lp> inline bool operator<=(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept { return !(__a < nullptr); } template<typename _Tp1, typename _Tp2, _Lock_policy _Lp> inline bool operator>(const __shared_ptr<_Tp1, _Lp>& __a, const __shared_ptr<_Tp2, _Lp>& __b) noexcept { return (__b < __a); } template<typename _Tp, _Lock_policy _Lp> inline bool operator>(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept { return std::less<_Tp*>()(nullptr, __a.get()); } template<typename _Tp, _Lock_policy _Lp> inline bool operator>(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept { return std::less<_Tp*>()(__a.get(), nullptr); } template<typename _Tp1, typename _Tp2, _Lock_policy _Lp> inline bool operator>=(const __shared_ptr<_Tp1, _Lp>& __a, const __shared_ptr<_Tp2, _Lp>& __b) noexcept { return !(__a < __b); } template<typename _Tp, _Lock_policy _Lp> inline bool operator>=(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept { return !(__a < nullptr); } template<typename _Tp, _Lock_policy _Lp> inline bool operator>=(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept { return !(nullptr < __a); } template<typename _Sp> struct _Sp_less : public binary_function<_Sp, _Sp, bool> { bool operator()(const _Sp& __lhs, const _Sp& __rhs) const noexcept { typedef typename _Sp::element_type element_type; return std::less<element_type*>()(__lhs.get(), __rhs.get()); } }; template<typename _Tp, _Lock_policy _Lp> struct less<__shared_ptr<_Tp, _Lp>> : public _Sp_less<__shared_ptr<_Tp, _Lp>> { }; // 2.2.3.8 shared_ptr specialized algorithms. template<typename _Tp, _Lock_policy _Lp> inline void swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>& __b) noexcept { __a.swap(__b); } // 2.2.3.9 shared_ptr casts // The seemingly equivalent code: // shared_ptr<_Tp, _Lp>(static_cast<_Tp*>(__r.get())) // will eventually result in undefined behaviour, attempting to // delete the same object twice. /// static_pointer_cast template<typename _Tp, typename _Tp1, _Lock_policy _Lp> inline __shared_ptr<_Tp, _Lp> static_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r) noexcept { return __shared_ptr<_Tp, _Lp>(__r, static_cast<_Tp*>(__r.get())); } // The seemingly equivalent code: // shared_ptr<_Tp, _Lp>(const_cast<_Tp*>(__r.get())) // will eventually result in undefined behaviour, attempting to // delete the same object twice. /// const_pointer_cast template<typename _Tp, typename _Tp1, _Lock_policy _Lp> inline __shared_ptr<_Tp, _Lp> const_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r) noexcept { return __shared_ptr<_Tp, _Lp>(__r, const_cast<_Tp*>(__r.get())); } // The seemingly equivalent code: // shared_ptr<_Tp, _Lp>(dynamic_cast<_Tp*>(__r.get())) // will eventually result in undefined behaviour, attempting to // delete the same object twice. /// dynamic_pointer_cast template<typename _Tp, typename _Tp1, _Lock_policy _Lp> inline __shared_ptr<_Tp, _Lp> dynamic_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r) noexcept { if (_Tp* __p = dynamic_cast<_Tp*>(__r.get())) return __shared_ptr<_Tp, _Lp>(__r, __p); return __shared_ptr<_Tp, _Lp>(); } template<typename _Tp, _Lock_policy _Lp> class __weak_ptr { public: typedef _Tp element_type; constexpr __weak_ptr() noexcept : _M_ptr(0), _M_refcount() { } __weak_ptr(const __weak_ptr&) noexcept = default; __weak_ptr& operator=(const __weak_ptr&) noexcept = default; ~__weak_ptr() = default; // The "obvious" converting constructor implementation: // // template<typename _Tp1> // __weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r) // : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws // { } // // has a serious problem. // // __r._M_ptr may already have been invalidated. The _M_ptr(__r._M_ptr) // conversion may require access to *__r._M_ptr (virtual inheritance). // // It is not possible to avoid spurious access violations since // in multithreaded programs __r._M_ptr may be invalidated at any point. template<typename _Tp1, typename = typename std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type> __weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r) noexcept : _M_refcount(__r._M_refcount) { _M_ptr = __r.lock().get(); } template<typename _Tp1, typename = typename std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type> __weak_ptr(const __shared_ptr<_Tp1, _Lp>& __r) noexcept : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) { } template<typename _Tp1> __weak_ptr& operator=(const __weak_ptr<_Tp1, _Lp>& __r) noexcept { _M_ptr = __r.lock().get(); _M_refcount = __r._M_refcount; return *this; } template<typename _Tp1> __weak_ptr& operator=(const __shared_ptr<_Tp1, _Lp>& __r) noexcept { _M_ptr = __r._M_ptr; _M_refcount = __r._M_refcount; return *this; } __shared_ptr<_Tp, _Lp> lock() const noexcept { #ifdef __GTHREADS // Optimization: avoid throw overhead. if (expired()) return __shared_ptr<element_type, _Lp>(); __try { return __shared_ptr<element_type, _Lp>(*this); } __catch(const bad_weak_ptr&) { // Q: How can we get here? // A: Another thread may have invalidated r after the // use_count test above. return __shared_ptr<element_type, _Lp>(); } #else // Optimization: avoid try/catch overhead when single threaded. return expired() ? __shared_ptr<element_type, _Lp>() : __shared_ptr<element_type, _Lp>(*this); #endif } // XXX MT long use_count() const noexcept { return _M_refcount._M_get_use_count(); } bool expired() const noexcept { return _M_refcount._M_get_use_count() == 0; } template<typename _Tp1> bool owner_before(const __shared_ptr<_Tp1, _Lp>& __rhs) const { return _M_refcount._M_less(__rhs._M_refcount); } template<typename _Tp1> bool owner_before(const __weak_ptr<_Tp1, _Lp>& __rhs) const { return _M_refcount._M_less(__rhs._M_refcount); } void reset() noexcept { __weak_ptr().swap(*this); } void swap(__weak_ptr& __s) noexcept { std::swap(_M_ptr, __s._M_ptr); _M_refcount._M_swap(__s._M_refcount); } private: // Used by __enable_shared_from_this. void _M_assign(_Tp* __ptr, const __shared_count<_Lp>& __refcount) noexcept { _M_ptr = __ptr; _M_refcount = __refcount; } template<typename _Tp1, _Lock_policy _Lp1> friend class __shared_ptr; template<typename _Tp1, _Lock_policy _Lp1> friend class __weak_ptr; friend class __enable_shared_from_this<_Tp, _Lp>; friend class enable_shared_from_this<_Tp>; _Tp* _M_ptr; // Contained pointer. __weak_count<_Lp> _M_refcount; // Reference counter. }; // 20.7.2.3.6 weak_ptr specialized algorithms. template<typename _Tp, _Lock_policy _Lp> inline void swap(__weak_ptr<_Tp, _Lp>& __a, __weak_ptr<_Tp, _Lp>& __b) noexcept { __a.swap(__b); } template<typename _Tp, typename _Tp1> struct _Sp_owner_less : public binary_function<_Tp, _Tp, bool> { bool operator()(const _Tp& __lhs, const _Tp& __rhs) const { return __lhs.owner_before(__rhs); } bool operator()(const _Tp& __lhs, const _Tp1& __rhs) const { return __lhs.owner_before(__rhs); } bool operator()(const _Tp1& __lhs, const _Tp& __rhs) const { return __lhs.owner_before(__rhs); } }; template<typename _Tp, _Lock_policy _Lp> struct owner_less<__shared_ptr<_Tp, _Lp>> : public _Sp_owner_less<__shared_ptr<_Tp, _Lp>, __weak_ptr<_Tp, _Lp>> { }; template<typename _Tp, _Lock_policy _Lp> struct owner_less<__weak_ptr<_Tp, _Lp>> : public _Sp_owner_less<__weak_ptr<_Tp, _Lp>, __shared_ptr<_Tp, _Lp>> { }; template<typename _Tp, _Lock_policy _Lp> class __enable_shared_from_this { protected: constexpr __enable_shared_from_this() noexcept { } __enable_shared_from_this(const __enable_shared_from_this&) noexcept { } __enable_shared_from_this& operator=(const __enable_shared_from_this&) noexcept { return *this; } ~__enable_shared_from_this() { } public: __shared_ptr<_Tp, _Lp> shared_from_this() { return __shared_ptr<_Tp, _Lp>(this->_M_weak_this); } __shared_ptr<const _Tp, _Lp> shared_from_this() const { return __shared_ptr<const _Tp, _Lp>(this->_M_weak_this); } private: template<typename _Tp1> void _M_weak_assign(_Tp1* __p, const __shared_count<_Lp>& __n) const noexcept { _M_weak_this._M_assign(__p, __n); } template<typename _Tp1> friend void __enable_shared_from_this_helper(const __shared_count<_Lp>& __pn, const __enable_shared_from_this* __pe, const _Tp1* __px) noexcept { if (__pe != 0) __pe->_M_weak_assign(const_cast<_Tp1*>(__px), __pn); } mutable __weak_ptr<_Tp, _Lp> _M_weak_this; }; template<typename _Tp, _Lock_policy _Lp, typename _Alloc, typename... _Args> inline __shared_ptr<_Tp, _Lp> __allocate_shared(const _Alloc& __a, _Args&&... __args) { return __shared_ptr<_Tp, _Lp>(_Sp_make_shared_tag(), __a, std::forward<_Args>(__args)...); } template<typename _Tp, _Lock_policy _Lp, typename... _Args> inline __shared_ptr<_Tp, _Lp> __make_shared(_Args&&... __args) { typedef typename std::remove_const<_Tp>::type _Tp_nc; return std::__allocate_shared<_Tp, _Lp>(std::allocator<_Tp_nc>(), std::forward<_Args>(__args)...); } /// std::hash specialization for __shared_ptr. template<typename _Tp, _Lock_policy _Lp> struct hash<__shared_ptr<_Tp, _Lp>> : public __hash_base<size_t, __shared_ptr<_Tp, _Lp>> { size_t operator()(const __shared_ptr<_Tp, _Lp>& __s) const noexcept { return std::hash<_Tp*>()(__s.get()); } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // _SHARED_PTR_BASE_H ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_map.h����������������������������������������������������������������������������0000644�����������������00000111434�14763166030�0010350 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Map implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_map.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{map} */ #ifndef _STL_MAP_H #define _STL_MAP_H 1 #include <bits/functexcept.h> #include <bits/concept_check.h> #if __cplusplus >= 201103L #include <initializer_list> #include <tuple> #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /** * @brief A standard container made up of (key,value) pairs, which can be * retrieved based on a key, in logarithmic time. * * @ingroup associative_containers * * @tparam _Key Type of key objects. * @tparam _Tp Type of mapped objects. * @tparam _Compare Comparison function object type, defaults to less<_Key>. * @tparam _Alloc Allocator type, defaults to * allocator<pair<const _Key, _Tp>. * * Meets the requirements of a <a href="tables.html#65">container</a>, a * <a href="tables.html#66">reversible container</a>, and an * <a href="tables.html#69">associative container</a> (using unique keys). * For a @c map<Key,T> the key_type is Key, the mapped_type is T, and the * value_type is std::pair<const Key,T>. * * Maps support bidirectional iterators. * * The private tree data is declared exactly the same way for map and * multimap; the distinction is made entirely in how the tree functions are * called (*_unique versus *_equal, same as the standard). */ template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > > class map { public: typedef _Key key_type; typedef _Tp mapped_type; typedef std::pair<const _Key, _Tp> value_type; typedef _Compare key_compare; typedef _Alloc allocator_type; private: // concept requirements typedef typename _Alloc::value_type _Alloc_value_type; __glibcxx_class_requires(_Tp, _SGIAssignableConcept) __glibcxx_class_requires4(_Compare, bool, _Key, _Key, _BinaryFunctionConcept) __glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept) public: class value_compare : public std::binary_function<value_type, value_type, bool> { friend class map<_Key, _Tp, _Compare, _Alloc>; protected: _Compare comp; value_compare(_Compare __c) : comp(__c) { } public: bool operator()(const value_type& __x, const value_type& __y) const { return comp(__x.first, __y.first); } }; private: /// This turns a red-black tree into a [multi]map. typedef typename _Alloc::template rebind<value_type>::other _Pair_alloc_type; typedef _Rb_tree<key_type, value_type, _Select1st<value_type>, key_compare, _Pair_alloc_type> _Rep_type; /// The actual tree structure. _Rep_type _M_t; public: // many of these are specified differently in ISO, but the following are // "functionally equivalent" typedef typename _Pair_alloc_type::pointer pointer; typedef typename _Pair_alloc_type::const_pointer const_pointer; typedef typename _Pair_alloc_type::reference reference; typedef typename _Pair_alloc_type::const_reference const_reference; typedef typename _Rep_type::iterator iterator; typedef typename _Rep_type::const_iterator const_iterator; typedef typename _Rep_type::size_type size_type; typedef typename _Rep_type::difference_type difference_type; typedef typename _Rep_type::reverse_iterator reverse_iterator; typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; // [23.3.1.1] construct/copy/destroy // (get_allocator() is normally listed in this section, but seems to have // been accidentally omitted in the printed standard) /** * @brief Default constructor creates no elements. */ map() : _M_t() { } /** * @brief Creates a %map with no elements. * @param __comp A comparison object. * @param __a An allocator object. */ explicit map(const _Compare& __comp, const allocator_type& __a = allocator_type()) : _M_t(__comp, _Pair_alloc_type(__a)) { } /** * @brief %Map copy constructor. * @param __x A %map of identical element and allocator types. * * The newly-created %map uses a copy of the allocation object * used by @a __x. */ map(const map& __x) : _M_t(__x._M_t) { } #if __cplusplus >= 201103L /** * @brief %Map move constructor. * @param __x A %map of identical element and allocator types. * * The newly-created %map contains the exact contents of @a __x. * The contents of @a __x are a valid, but unspecified %map. */ map(map&& __x) noexcept(is_nothrow_copy_constructible<_Compare>::value) : _M_t(std::move(__x._M_t)) { } /** * @brief Builds a %map from an initializer_list. * @param __l An initializer_list. * @param __comp A comparison object. * @param __a An allocator object. * * Create a %map consisting of copies of the elements in the * initializer_list @a __l. * This is linear in N if the range is already sorted, and NlogN * otherwise (where N is @a __l.size()). */ map(initializer_list<value_type> __l, const _Compare& __comp = _Compare(), const allocator_type& __a = allocator_type()) : _M_t(__comp, _Pair_alloc_type(__a)) { _M_t._M_insert_unique(__l.begin(), __l.end()); } #endif /** * @brief Builds a %map from a range. * @param __first An input iterator. * @param __last An input iterator. * * Create a %map consisting of copies of the elements from * [__first,__last). This is linear in N if the range is * already sorted, and NlogN otherwise (where N is * distance(__first,__last)). */ template<typename _InputIterator> map(_InputIterator __first, _InputIterator __last) : _M_t() { _M_t._M_insert_unique(__first, __last); } /** * @brief Builds a %map from a range. * @param __first An input iterator. * @param __last An input iterator. * @param __comp A comparison functor. * @param __a An allocator object. * * Create a %map consisting of copies of the elements from * [__first,__last). This is linear in N if the range is * already sorted, and NlogN otherwise (where N is * distance(__first,__last)). */ template<typename _InputIterator> map(_InputIterator __first, _InputIterator __last, const _Compare& __comp, const allocator_type& __a = allocator_type()) : _M_t(__comp, _Pair_alloc_type(__a)) { _M_t._M_insert_unique(__first, __last); } // FIXME There is no dtor declared, but we should have something // generated by Doxygen. I don't know what tags to add to this // paragraph to make that happen: /** * The dtor only erases the elements, and note that if the elements * themselves are pointers, the pointed-to memory is not touched in any * way. Managing the pointer is the user's responsibility. */ /** * @brief %Map assignment operator. * @param __x A %map of identical element and allocator types. * * All the elements of @a __x are copied, but unlike the copy * constructor, the allocator object is not copied. */ map& operator=(const map& __x) { _M_t = __x._M_t; return *this; } #if __cplusplus >= 201103L /** * @brief %Map move assignment operator. * @param __x A %map of identical element and allocator types. * * The contents of @a __x are moved into this map (without copying). * @a __x is a valid, but unspecified %map. */ map& operator=(map&& __x) { // NB: DR 1204. // NB: DR 675. this->clear(); this->swap(__x); return *this; } /** * @brief %Map list assignment operator. * @param __l An initializer_list. * * This function fills a %map with copies of the elements in the * initializer list @a __l. * * Note that the assignment completely changes the %map and * that the resulting %map's size is the same as the number * of elements assigned. Old data may be lost. */ map& operator=(initializer_list<value_type> __l) { this->clear(); this->insert(__l.begin(), __l.end()); return *this; } #endif /// Get a copy of the memory allocation object. allocator_type get_allocator() const _GLIBCXX_NOEXCEPT { return allocator_type(_M_t.get_allocator()); } // iterators /** * Returns a read/write iterator that points to the first pair in the * %map. * Iteration is done in ascending order according to the keys. */ iterator begin() _GLIBCXX_NOEXCEPT { return _M_t.begin(); } /** * Returns a read-only (constant) iterator that points to the first pair * in the %map. Iteration is done in ascending order according to the * keys. */ const_iterator begin() const _GLIBCXX_NOEXCEPT { return _M_t.begin(); } /** * Returns a read/write iterator that points one past the last * pair in the %map. Iteration is done in ascending order * according to the keys. */ iterator end() _GLIBCXX_NOEXCEPT { return _M_t.end(); } /** * Returns a read-only (constant) iterator that points one past the last * pair in the %map. Iteration is done in ascending order according to * the keys. */ const_iterator end() const _GLIBCXX_NOEXCEPT { return _M_t.end(); } /** * Returns a read/write reverse iterator that points to the last pair in * the %map. Iteration is done in descending order according to the * keys. */ reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return _M_t.rbegin(); } /** * Returns a read-only (constant) reverse iterator that points to the * last pair in the %map. Iteration is done in descending order * according to the keys. */ const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return _M_t.rbegin(); } /** * Returns a read/write reverse iterator that points to one before the * first pair in the %map. Iteration is done in descending order * according to the keys. */ reverse_iterator rend() _GLIBCXX_NOEXCEPT { return _M_t.rend(); } /** * Returns a read-only (constant) reverse iterator that points to one * before the first pair in the %map. Iteration is done in descending * order according to the keys. */ const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return _M_t.rend(); } #if __cplusplus >= 201103L /** * Returns a read-only (constant) iterator that points to the first pair * in the %map. Iteration is done in ascending order according to the * keys. */ const_iterator cbegin() const noexcept { return _M_t.begin(); } /** * Returns a read-only (constant) iterator that points one past the last * pair in the %map. Iteration is done in ascending order according to * the keys. */ const_iterator cend() const noexcept { return _M_t.end(); } /** * Returns a read-only (constant) reverse iterator that points to the * last pair in the %map. Iteration is done in descending order * according to the keys. */ const_reverse_iterator crbegin() const noexcept { return _M_t.rbegin(); } /** * Returns a read-only (constant) reverse iterator that points to one * before the first pair in the %map. Iteration is done in descending * order according to the keys. */ const_reverse_iterator crend() const noexcept { return _M_t.rend(); } #endif // capacity /** Returns true if the %map is empty. (Thus begin() would equal * end().) */ bool empty() const _GLIBCXX_NOEXCEPT { return _M_t.empty(); } /** Returns the size of the %map. */ size_type size() const _GLIBCXX_NOEXCEPT { return _M_t.size(); } /** Returns the maximum size of the %map. */ size_type max_size() const _GLIBCXX_NOEXCEPT { return _M_t.max_size(); } // [23.3.1.2] element access /** * @brief Subscript ( @c [] ) access to %map data. * @param __k The key for which data should be retrieved. * @return A reference to the data of the (key,data) %pair. * * Allows for easy lookup with the subscript ( @c [] ) * operator. Returns data associated with the key specified in * subscript. If the key does not exist, a pair with that key * is created using default values, which is then returned. * * Lookup requires logarithmic time. */ mapped_type& operator[](const key_type& __k) { // concept requirements __glibcxx_function_requires(_DefaultConstructibleConcept<mapped_type>) iterator __i = lower_bound(__k); // __i->first is greater than or equivalent to __k. if (__i == end() || key_comp()(__k, (*__i).first)) #if __cplusplus >= 201103L __i = _M_t._M_emplace_hint_unique(__i, std::piecewise_construct, std::tuple<const key_type&>(__k), std::tuple<>()); #else __i = insert(__i, value_type(__k, mapped_type())); #endif return (*__i).second; } #if __cplusplus >= 201103L mapped_type& operator[](key_type&& __k) { // concept requirements __glibcxx_function_requires(_DefaultConstructibleConcept<mapped_type>) iterator __i = lower_bound(__k); // __i->first is greater than or equivalent to __k. if (__i == end() || key_comp()(__k, (*__i).first)) __i = _M_t._M_emplace_hint_unique(__i, std::piecewise_construct, std::forward_as_tuple(std::move(__k)), std::tuple<>()); return (*__i).second; } #endif // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 464. Suggestion for new member functions in standard containers. /** * @brief Access to %map data. * @param __k The key for which data should be retrieved. * @return A reference to the data whose key is equivalent to @a __k, if * such a data is present in the %map. * @throw std::out_of_range If no such data is present. */ mapped_type& at(const key_type& __k) { iterator __i = lower_bound(__k); if (__i == end() || key_comp()(__k, (*__i).first)) __throw_out_of_range(__N("map::at")); return (*__i).second; } const mapped_type& at(const key_type& __k) const { const_iterator __i = lower_bound(__k); if (__i == end() || key_comp()(__k, (*__i).first)) __throw_out_of_range(__N("map::at")); return (*__i).second; } // modifiers #if __cplusplus >= 201103L /** * @brief Attempts to build and insert a std::pair into the %map. * * @param __args Arguments used to generate a new pair instance (see * std::piecewise_contruct for passing arguments to each * part of the pair constructor). * * @return A pair, of which the first element is an iterator that points * to the possibly inserted pair, and the second is a bool that * is true if the pair was actually inserted. * * This function attempts to build and insert a (key, value) %pair into * the %map. * A %map relies on unique keys and thus a %pair is only inserted if its * first element (the key) is not already present in the %map. * * Insertion requires logarithmic time. */ template<typename... _Args> std::pair<iterator, bool> emplace(_Args&&... __args) { return _M_t._M_emplace_unique(std::forward<_Args>(__args)...); } /** * @brief Attempts to build and insert a std::pair into the %map. * * @param __pos An iterator that serves as a hint as to where the pair * should be inserted. * @param __args Arguments used to generate a new pair instance (see * std::piecewise_contruct for passing arguments to each * part of the pair constructor). * @return An iterator that points to the element with key of the * std::pair built from @a __args (may or may not be that * std::pair). * * This function is not concerned about whether the insertion took place, * and thus does not return a boolean like the single-argument emplace() * does. * Note that the first parameter is only a hint and can potentially * improve the performance of the insertion process. A bad hint would * cause no gains in efficiency. * * See * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html * for more on @a hinting. * * Insertion requires logarithmic time (if the hint is not taken). */ template<typename... _Args> iterator emplace_hint(const_iterator __pos, _Args&&... __args) { return _M_t._M_emplace_hint_unique(__pos, std::forward<_Args>(__args)...); } #endif /** * @brief Attempts to insert a std::pair into the %map. * @param __x Pair to be inserted (see std::make_pair for easy * creation of pairs). * * @return A pair, of which the first element is an iterator that * points to the possibly inserted pair, and the second is * a bool that is true if the pair was actually inserted. * * This function attempts to insert a (key, value) %pair into the %map. * A %map relies on unique keys and thus a %pair is only inserted if its * first element (the key) is not already present in the %map. * * Insertion requires logarithmic time. */ std::pair<iterator, bool> insert(const value_type& __x) { return _M_t._M_insert_unique(__x); } #if __cplusplus >= 201103L template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> std::pair<iterator, bool> insert(_Pair&& __x) { return _M_t._M_insert_unique(std::forward<_Pair>(__x)); } #endif #if __cplusplus >= 201103L /** * @brief Attempts to insert a list of std::pairs into the %map. * @param __list A std::initializer_list<value_type> of pairs to be * inserted. * * Complexity similar to that of the range constructor. */ void insert(std::initializer_list<value_type> __list) { insert(__list.begin(), __list.end()); } #endif /** * @brief Attempts to insert a std::pair into the %map. * @param __position An iterator that serves as a hint as to where the * pair should be inserted. * @param __x Pair to be inserted (see std::make_pair for easy creation * of pairs). * @return An iterator that points to the element with key of * @a __x (may or may not be the %pair passed in). * * This function is not concerned about whether the insertion * took place, and thus does not return a boolean like the * single-argument insert() does. Note that the first * parameter is only a hint and can potentially improve the * performance of the insertion process. A bad hint would * cause no gains in efficiency. * * See * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html * for more on @a hinting. * * Insertion requires logarithmic time (if the hint is not taken). */ iterator #if __cplusplus >= 201103L insert(const_iterator __position, const value_type& __x) #else insert(iterator __position, const value_type& __x) #endif { return _M_t._M_insert_unique_(__position, __x); } #if __cplusplus >= 201103L template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> iterator insert(const_iterator __position, _Pair&& __x) { return _M_t._M_insert_unique_(__position, std::forward<_Pair>(__x)); } #endif /** * @brief Template function that attempts to insert a range of elements. * @param __first Iterator pointing to the start of the range to be * inserted. * @param __last Iterator pointing to the end of the range. * * Complexity similar to that of the range constructor. */ template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) { _M_t._M_insert_unique(__first, __last); } #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 130. Associative erase should return an iterator. /** * @brief Erases an element from a %map. * @param __position An iterator pointing to the element to be erased. * @return An iterator pointing to the element immediately following * @a position prior to the element being erased. If no such * element exists, end() is returned. * * This function erases an element, pointed to by the given * iterator, from a %map. Note that this function only erases * the element, and that if the element is itself a pointer, * the pointed-to memory is not touched in any way. Managing * the pointer is the user's responsibility. */ iterator erase(const_iterator __position) { return _M_t.erase(__position); } // LWG 2059 _GLIBCXX_ABI_TAG_CXX11 iterator erase(iterator __position) { return _M_t.erase(__position); } #else /** * @brief Erases an element from a %map. * @param __position An iterator pointing to the element to be erased. * * This function erases an element, pointed to by the given * iterator, from a %map. Note that this function only erases * the element, and that if the element is itself a pointer, * the pointed-to memory is not touched in any way. Managing * the pointer is the user's responsibility. */ void erase(iterator __position) { _M_t.erase(__position); } #endif /** * @brief Erases elements according to the provided key. * @param __x Key of element to be erased. * @return The number of elements erased. * * This function erases all the elements located by the given key from * a %map. * Note that this function only erases the element, and that if * the element is itself a pointer, the pointed-to memory is not touched * in any way. Managing the pointer is the user's responsibility. */ size_type erase(const key_type& __x) { return _M_t.erase(__x); } #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 130. Associative erase should return an iterator. /** * @brief Erases a [first,last) range of elements from a %map. * @param __first Iterator pointing to the start of the range to be * erased. * @param __last Iterator pointing to the end of the range to * be erased. * @return The iterator @a __last. * * This function erases a sequence of elements from a %map. * Note that this function only erases the element, and that if * the element is itself a pointer, the pointed-to memory is not touched * in any way. Managing the pointer is the user's responsibility. */ iterator erase(const_iterator __first, const_iterator __last) { return _M_t.erase(__first, __last); } #else /** * @brief Erases a [__first,__last) range of elements from a %map. * @param __first Iterator pointing to the start of the range to be * erased. * @param __last Iterator pointing to the end of the range to * be erased. * * This function erases a sequence of elements from a %map. * Note that this function only erases the element, and that if * the element is itself a pointer, the pointed-to memory is not touched * in any way. Managing the pointer is the user's responsibility. */ void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last); } #endif /** * @brief Swaps data with another %map. * @param __x A %map of the same element and allocator types. * * This exchanges the elements between two maps in constant * time. (It is only swapping a pointer, an integer, and an * instance of the @c Compare type (which itself is often * stateless and empty), so it should be quite fast.) Note * that the global std::swap() function is specialized such * that std::swap(m1,m2) will feed to this function. */ void swap(map& __x) { _M_t.swap(__x._M_t); } /** * Erases all elements in a %map. Note that this function only * erases the elements, and that if the elements themselves are * pointers, the pointed-to memory is not touched in any way. * Managing the pointer is the user's responsibility. */ void clear() _GLIBCXX_NOEXCEPT { _M_t.clear(); } // observers /** * Returns the key comparison object out of which the %map was * constructed. */ key_compare key_comp() const { return _M_t.key_comp(); } /** * Returns a value comparison object, built from the key comparison * object out of which the %map was constructed. */ value_compare value_comp() const { return value_compare(_M_t.key_comp()); } // [23.3.1.3] map operations /** * @brief Tries to locate an element in a %map. * @param __x Key of (key, value) %pair to be located. * @return Iterator pointing to sought-after element, or end() if not * found. * * This function takes a key and tries to locate the element with which * the key matches. If successful the function returns an iterator * pointing to the sought after %pair. If unsuccessful it returns the * past-the-end ( @c end() ) iterator. */ iterator find(const key_type& __x) { return _M_t.find(__x); } /** * @brief Tries to locate an element in a %map. * @param __x Key of (key, value) %pair to be located. * @return Read-only (constant) iterator pointing to sought-after * element, or end() if not found. * * This function takes a key and tries to locate the element with which * the key matches. If successful the function returns a constant * iterator pointing to the sought after %pair. If unsuccessful it * returns the past-the-end ( @c end() ) iterator. */ const_iterator find(const key_type& __x) const { return _M_t.find(__x); } /** * @brief Finds the number of elements with given key. * @param __x Key of (key, value) pairs to be located. * @return Number of elements with specified key. * * This function only makes sense for multimaps; for map the result will * either be 0 (not present) or 1 (present). */ size_type count(const key_type& __x) const { return _M_t.find(__x) == _M_t.end() ? 0 : 1; } /** * @brief Finds the beginning of a subsequence matching given key. * @param __x Key of (key, value) pair to be located. * @return Iterator pointing to first element equal to or greater * than key, or end(). * * This function returns the first element of a subsequence of elements * that matches the given key. If unsuccessful it returns an iterator * pointing to the first element that has a greater value than given key * or end() if no such element exists. */ iterator lower_bound(const key_type& __x) { return _M_t.lower_bound(__x); } /** * @brief Finds the beginning of a subsequence matching given key. * @param __x Key of (key, value) pair to be located. * @return Read-only (constant) iterator pointing to first element * equal to or greater than key, or end(). * * This function returns the first element of a subsequence of elements * that matches the given key. If unsuccessful it returns an iterator * pointing to the first element that has a greater value than given key * or end() if no such element exists. */ const_iterator lower_bound(const key_type& __x) const { return _M_t.lower_bound(__x); } /** * @brief Finds the end of a subsequence matching given key. * @param __x Key of (key, value) pair to be located. * @return Iterator pointing to the first element * greater than key, or end(). */ iterator upper_bound(const key_type& __x) { return _M_t.upper_bound(__x); } /** * @brief Finds the end of a subsequence matching given key. * @param __x Key of (key, value) pair to be located. * @return Read-only (constant) iterator pointing to first iterator * greater than key, or end(). */ const_iterator upper_bound(const key_type& __x) const { return _M_t.upper_bound(__x); } /** * @brief Finds a subsequence matching given key. * @param __x Key of (key, value) pairs to be located. * @return Pair of iterators that possibly points to the subsequence * matching given key. * * This function is equivalent to * @code * std::make_pair(c.lower_bound(val), * c.upper_bound(val)) * @endcode * (but is faster than making the calls separately). * * This function probably only makes sense for multimaps. */ std::pair<iterator, iterator> equal_range(const key_type& __x) { return _M_t.equal_range(__x); } /** * @brief Finds a subsequence matching given key. * @param __x Key of (key, value) pairs to be located. * @return Pair of read-only (constant) iterators that possibly points * to the subsequence matching given key. * * This function is equivalent to * @code * std::make_pair(c.lower_bound(val), * c.upper_bound(val)) * @endcode * (but is faster than making the calls separately). * * This function probably only makes sense for multimaps. */ std::pair<const_iterator, const_iterator> equal_range(const key_type& __x) const { return _M_t.equal_range(__x); } template<typename _K1, typename _T1, typename _C1, typename _A1> friend bool operator==(const map<_K1, _T1, _C1, _A1>&, const map<_K1, _T1, _C1, _A1>&); template<typename _K1, typename _T1, typename _C1, typename _A1> friend bool operator<(const map<_K1, _T1, _C1, _A1>&, const map<_K1, _T1, _C1, _A1>&); }; /** * @brief Map equality comparison. * @param __x A %map. * @param __y A %map of the same type as @a x. * @return True iff the size and elements of the maps are equal. * * This is an equivalence relation. It is linear in the size of the * maps. Maps are considered equivalent if their sizes are equal, * and if corresponding elements compare equal. */ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc> inline bool operator==(const map<_Key, _Tp, _Compare, _Alloc>& __x, const map<_Key, _Tp, _Compare, _Alloc>& __y) { return __x._M_t == __y._M_t; } /** * @brief Map ordering relation. * @param __x A %map. * @param __y A %map of the same type as @a x. * @return True iff @a x is lexicographically less than @a y. * * This is a total ordering relation. It is linear in the size of the * maps. The elements must be comparable with @c <. * * See std::lexicographical_compare() for how the determination is made. */ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc> inline bool operator<(const map<_Key, _Tp, _Compare, _Alloc>& __x, const map<_Key, _Tp, _Compare, _Alloc>& __y) { return __x._M_t < __y._M_t; } /// Based on operator== template<typename _Key, typename _Tp, typename _Compare, typename _Alloc> inline bool operator!=(const map<_Key, _Tp, _Compare, _Alloc>& __x, const map<_Key, _Tp, _Compare, _Alloc>& __y) { return !(__x == __y); } /// Based on operator< template<typename _Key, typename _Tp, typename _Compare, typename _Alloc> inline bool operator>(const map<_Key, _Tp, _Compare, _Alloc>& __x, const map<_Key, _Tp, _Compare, _Alloc>& __y) { return __y < __x; } /// Based on operator< template<typename _Key, typename _Tp, typename _Compare, typename _Alloc> inline bool operator<=(const map<_Key, _Tp, _Compare, _Alloc>& __x, const map<_Key, _Tp, _Compare, _Alloc>& __y) { return !(__y < __x); } /// Based on operator< template<typename _Key, typename _Tp, typename _Compare, typename _Alloc> inline bool operator>=(const map<_Key, _Tp, _Compare, _Alloc>& __x, const map<_Key, _Tp, _Compare, _Alloc>& __y) { return !(__x < __y); } /// See std::map::swap(). template<typename _Key, typename _Tp, typename _Compare, typename _Alloc> inline void swap(map<_Key, _Tp, _Compare, _Alloc>& __x, map<_Key, _Tp, _Compare, _Alloc>& __y) { __x.swap(__y); } _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std #endif /* _STL_MAP_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/atomic_lockfree_defines.h������������������������������������������������������������0000644�����������������00000004315�14763166030�0013533 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// -*- C++ -*- header. // Copyright (C) 2008-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/atomic_lockfree_defines.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{atomic} */ #ifndef _GLIBCXX_ATOMIC_LOCK_FREE_H #define _GLIBCXX_ATOMIC_LOCK_FREE_H 1 #pragma GCC system_header /** * @addtogroup atomics * @{ */ /** * Lock-free property. * * 0 indicates that the types are never lock-free. * 1 indicates that the types are sometimes lock-free. * 2 indicates that the types are always lock-free. */ #if __cplusplus >= 201103L #define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE #define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE #define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE #define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE #define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE #define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE #define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE #define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE #define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE #define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE #endif // @} group atomics #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_algobase.h�����������������������������������������������������������������������0000644�����������������00000122640�14763166030�0011351 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Core algorithmic facilities -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996-1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_algobase.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{algorithm} */ #ifndef _STL_ALGOBASE_H #define _STL_ALGOBASE_H 1 #include <bits/c++config.h> #include <bits/functexcept.h> #include <bits/cpp_type_traits.h> #include <ext/type_traits.h> #include <ext/numeric_traits.h> #include <bits/stl_pair.h> #include <bits/stl_iterator_base_types.h> #include <bits/stl_iterator_base_funcs.h> #include <bits/stl_iterator.h> #include <bits/concept_check.h> #include <debug/debug.h> #include <bits/move.h> // For std::swap and _GLIBCXX_MOVE namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus < 201103L // See http://gcc.gnu.org/ml/libstdc++/2004-08/msg00167.html: in a // nutshell, we are partially implementing the resolution of DR 187, // when it's safe, i.e., the value_types are equal. template<bool _BoolType> struct __iter_swap { template<typename _ForwardIterator1, typename _ForwardIterator2> static void iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) { typedef typename iterator_traits<_ForwardIterator1>::value_type _ValueType1; _ValueType1 __tmp = _GLIBCXX_MOVE(*__a); *__a = _GLIBCXX_MOVE(*__b); *__b = _GLIBCXX_MOVE(__tmp); } }; template<> struct __iter_swap<true> { template<typename _ForwardIterator1, typename _ForwardIterator2> static void iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) { swap(*__a, *__b); } }; #endif /** * @brief Swaps the contents of two iterators. * @ingroup mutating_algorithms * @param __a An iterator. * @param __b Another iterator. * @return Nothing. * * This function swaps the values pointed to by two iterators, not the * iterators themselves. */ template<typename _ForwardIterator1, typename _ForwardIterator2> inline void iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) { // concept requirements __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< _ForwardIterator1>) __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< _ForwardIterator2>) #if __cplusplus < 201103L typedef typename iterator_traits<_ForwardIterator1>::value_type _ValueType1; typedef typename iterator_traits<_ForwardIterator2>::value_type _ValueType2; __glibcxx_function_requires(_ConvertibleConcept<_ValueType1, _ValueType2>) __glibcxx_function_requires(_ConvertibleConcept<_ValueType2, _ValueType1>) typedef typename iterator_traits<_ForwardIterator1>::reference _ReferenceType1; typedef typename iterator_traits<_ForwardIterator2>::reference _ReferenceType2; std::__iter_swap<__are_same<_ValueType1, _ValueType2>::__value && __are_same<_ValueType1&, _ReferenceType1>::__value && __are_same<_ValueType2&, _ReferenceType2>::__value>:: iter_swap(__a, __b); #else swap(*__a, *__b); #endif } /** * @brief Swap the elements of two sequences. * @ingroup mutating_algorithms * @param __first1 A forward iterator. * @param __last1 A forward iterator. * @param __first2 A forward iterator. * @return An iterator equal to @p first2+(last1-first1). * * Swaps each element in the range @p [first1,last1) with the * corresponding element in the range @p [first2,(last1-first1)). * The ranges must not overlap. */ template<typename _ForwardIterator1, typename _ForwardIterator2> _ForwardIterator2 swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) { // concept requirements __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< _ForwardIterator1>) __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< _ForwardIterator2>) __glibcxx_requires_valid_range(__first1, __last1); for (; __first1 != __last1; ++__first1, ++__first2) std::iter_swap(__first1, __first2); return __first2; } /** * @brief This does what you think it does. * @ingroup sorting_algorithms * @param __a A thing of arbitrary type. * @param __b Another thing of arbitrary type. * @return The lesser of the parameters. * * This is the simple classic generic implementation. It will work on * temporary expressions, since they are only evaluated once, unlike a * preprocessor macro. */ template<typename _Tp> inline const _Tp& min(const _Tp& __a, const _Tp& __b) { // concept requirements __glibcxx_function_requires(_LessThanComparableConcept<_Tp>) //return __b < __a ? __b : __a; if (__b < __a) return __b; return __a; } /** * @brief This does what you think it does. * @ingroup sorting_algorithms * @param __a A thing of arbitrary type. * @param __b Another thing of arbitrary type. * @return The greater of the parameters. * * This is the simple classic generic implementation. It will work on * temporary expressions, since they are only evaluated once, unlike a * preprocessor macro. */ template<typename _Tp> inline const _Tp& max(const _Tp& __a, const _Tp& __b) { // concept requirements __glibcxx_function_requires(_LessThanComparableConcept<_Tp>) //return __a < __b ? __b : __a; if (__a < __b) return __b; return __a; } /** * @brief This does what you think it does. * @ingroup sorting_algorithms * @param __a A thing of arbitrary type. * @param __b Another thing of arbitrary type. * @param __comp A @link comparison_functors comparison functor@endlink. * @return The lesser of the parameters. * * This will work on temporary expressions, since they are only evaluated * once, unlike a preprocessor macro. */ template<typename _Tp, typename _Compare> inline const _Tp& min(const _Tp& __a, const _Tp& __b, _Compare __comp) { //return __comp(__b, __a) ? __b : __a; if (__comp(__b, __a)) return __b; return __a; } /** * @brief This does what you think it does. * @ingroup sorting_algorithms * @param __a A thing of arbitrary type. * @param __b Another thing of arbitrary type. * @param __comp A @link comparison_functors comparison functor@endlink. * @return The greater of the parameters. * * This will work on temporary expressions, since they are only evaluated * once, unlike a preprocessor macro. */ template<typename _Tp, typename _Compare> inline const _Tp& max(const _Tp& __a, const _Tp& __b, _Compare __comp) { //return __comp(__a, __b) ? __b : __a; if (__comp(__a, __b)) return __b; return __a; } // If _Iterator is a __normal_iterator return its base (a plain pointer, // normally) otherwise return it untouched. See copy, fill, ... template<typename _Iterator> struct _Niter_base : _Iter_base<_Iterator, __is_normal_iterator<_Iterator>::__value> { }; template<typename _Iterator> inline typename _Niter_base<_Iterator>::iterator_type __niter_base(_Iterator __it) { return std::_Niter_base<_Iterator>::_S_base(__it); } // Likewise, for move_iterator. template<typename _Iterator> struct _Miter_base : _Iter_base<_Iterator, __is_move_iterator<_Iterator>::__value> { }; template<typename _Iterator> inline typename _Miter_base<_Iterator>::iterator_type __miter_base(_Iterator __it) { return std::_Miter_base<_Iterator>::_S_base(__it); } // All of these auxiliary structs serve two purposes. (1) Replace // calls to copy with memmove whenever possible. (Memmove, not memcpy, // because the input and output ranges are permitted to overlap.) // (2) If we're using random access iterators, then write the loop as // a for loop with an explicit count. template<bool, bool, typename> struct __copy_move { template<typename _II, typename _OI> static _OI __copy_m(_II __first, _II __last, _OI __result) { for (; __first != __last; ++__result, ++__first) *__result = *__first; return __result; } }; #if __cplusplus >= 201103L template<typename _Category> struct __copy_move<true, false, _Category> { template<typename _II, typename _OI> static _OI __copy_m(_II __first, _II __last, _OI __result) { for (; __first != __last; ++__result, ++__first) *__result = std::move(*__first); return __result; } }; #endif template<> struct __copy_move<false, false, random_access_iterator_tag> { template<typename _II, typename _OI> static _OI __copy_m(_II __first, _II __last, _OI __result) { typedef typename iterator_traits<_II>::difference_type _Distance; for(_Distance __n = __last - __first; __n > 0; --__n) { *__result = *__first; ++__first; ++__result; } return __result; } }; #if __cplusplus >= 201103L template<> struct __copy_move<true, false, random_access_iterator_tag> { template<typename _II, typename _OI> static _OI __copy_m(_II __first, _II __last, _OI __result) { typedef typename iterator_traits<_II>::difference_type _Distance; for(_Distance __n = __last - __first; __n > 0; --__n) { *__result = std::move(*__first); ++__first; ++__result; } return __result; } }; #endif template<bool _IsMove> struct __copy_move<_IsMove, true, random_access_iterator_tag> { template<typename _Tp> static _Tp* __copy_m(const _Tp* __first, const _Tp* __last, _Tp* __result) { const ptrdiff_t _Num = __last - __first; if (_Num) __builtin_memmove(__result, __first, sizeof(_Tp) * _Num); return __result + _Num; } }; template<bool _IsMove, typename _II, typename _OI> inline _OI __copy_move_a(_II __first, _II __last, _OI __result) { typedef typename iterator_traits<_II>::value_type _ValueTypeI; typedef typename iterator_traits<_OI>::value_type _ValueTypeO; typedef typename iterator_traits<_II>::iterator_category _Category; const bool __simple = (__is_trivial(_ValueTypeI) && __is_pointer<_II>::__value && __is_pointer<_OI>::__value && __are_same<_ValueTypeI, _ValueTypeO>::__value); return std::__copy_move<_IsMove, __simple, _Category>::__copy_m(__first, __last, __result); } // Helpers for streambuf iterators (either istream or ostream). // NB: avoid including <iosfwd>, relatively large. template<typename _CharT> struct char_traits; template<typename _CharT, typename _Traits> class istreambuf_iterator; template<typename _CharT, typename _Traits> class ostreambuf_iterator; template<bool _IsMove, typename _CharT> typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type __copy_move_a2(_CharT*, _CharT*, ostreambuf_iterator<_CharT, char_traits<_CharT> >); template<bool _IsMove, typename _CharT> typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type __copy_move_a2(const _CharT*, const _CharT*, ostreambuf_iterator<_CharT, char_traits<_CharT> >); template<bool _IsMove, typename _CharT> typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, _CharT*>::__type __copy_move_a2(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, _CharT*); template<bool _IsMove, typename _II, typename _OI> inline _OI __copy_move_a2(_II __first, _II __last, _OI __result) { return _OI(std::__copy_move_a<_IsMove>(std::__niter_base(__first), std::__niter_base(__last), std::__niter_base(__result))); } /** * @brief Copies the range [first,last) into result. * @ingroup mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __result An output iterator. * @return result + (first - last) * * This inline function will boil down to a call to @c memmove whenever * possible. Failing that, if random access iterators are passed, then the * loop count will be known (and therefore a candidate for compiler * optimizations such as unrolling). Result may not be contained within * [first,last); the copy_backward function should be used instead. * * Note that the end of the output range is permitted to be contained * within [first,last). */ template<typename _II, typename _OI> inline _OI copy(_II __first, _II __last, _OI __result) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_II>) __glibcxx_function_requires(_OutputIteratorConcept<_OI, typename iterator_traits<_II>::value_type>) __glibcxx_requires_valid_range(__first, __last); return (std::__copy_move_a2<__is_move_iterator<_II>::__value> (std::__miter_base(__first), std::__miter_base(__last), __result)); } #if __cplusplus >= 201103L /** * @brief Moves the range [first,last) into result. * @ingroup mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __result An output iterator. * @return result + (first - last) * * This inline function will boil down to a call to @c memmove whenever * possible. Failing that, if random access iterators are passed, then the * loop count will be known (and therefore a candidate for compiler * optimizations such as unrolling). Result may not be contained within * [first,last); the move_backward function should be used instead. * * Note that the end of the output range is permitted to be contained * within [first,last). */ template<typename _II, typename _OI> inline _OI move(_II __first, _II __last, _OI __result) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_II>) __glibcxx_function_requires(_OutputIteratorConcept<_OI, typename iterator_traits<_II>::value_type>) __glibcxx_requires_valid_range(__first, __last); return std::__copy_move_a2<true>(std::__miter_base(__first), std::__miter_base(__last), __result); } #define _GLIBCXX_MOVE3(_Tp, _Up, _Vp) std::move(_Tp, _Up, _Vp) #else #define _GLIBCXX_MOVE3(_Tp, _Up, _Vp) std::copy(_Tp, _Up, _Vp) #endif template<bool, bool, typename> struct __copy_move_backward { template<typename _BI1, typename _BI2> static _BI2 __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) { while (__first != __last) *--__result = *--__last; return __result; } }; #if __cplusplus >= 201103L template<typename _Category> struct __copy_move_backward<true, false, _Category> { template<typename _BI1, typename _BI2> static _BI2 __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) { while (__first != __last) *--__result = std::move(*--__last); return __result; } }; #endif template<> struct __copy_move_backward<false, false, random_access_iterator_tag> { template<typename _BI1, typename _BI2> static _BI2 __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) { typename iterator_traits<_BI1>::difference_type __n; for (__n = __last - __first; __n > 0; --__n) *--__result = *--__last; return __result; } }; #if __cplusplus >= 201103L template<> struct __copy_move_backward<true, false, random_access_iterator_tag> { template<typename _BI1, typename _BI2> static _BI2 __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) { typename iterator_traits<_BI1>::difference_type __n; for (__n = __last - __first; __n > 0; --__n) *--__result = std::move(*--__last); return __result; } }; #endif template<bool _IsMove> struct __copy_move_backward<_IsMove, true, random_access_iterator_tag> { template<typename _Tp> static _Tp* __copy_move_b(const _Tp* __first, const _Tp* __last, _Tp* __result) { const ptrdiff_t _Num = __last - __first; if (_Num) __builtin_memmove(__result - _Num, __first, sizeof(_Tp) * _Num); return __result - _Num; } }; template<bool _IsMove, typename _BI1, typename _BI2> inline _BI2 __copy_move_backward_a(_BI1 __first, _BI1 __last, _BI2 __result) { typedef typename iterator_traits<_BI1>::value_type _ValueType1; typedef typename iterator_traits<_BI2>::value_type _ValueType2; typedef typename iterator_traits<_BI1>::iterator_category _Category; const bool __simple = (__is_trivial(_ValueType1) && __is_pointer<_BI1>::__value && __is_pointer<_BI2>::__value && __are_same<_ValueType1, _ValueType2>::__value); return std::__copy_move_backward<_IsMove, __simple, _Category>::__copy_move_b(__first, __last, __result); } template<bool _IsMove, typename _BI1, typename _BI2> inline _BI2 __copy_move_backward_a2(_BI1 __first, _BI1 __last, _BI2 __result) { return _BI2(std::__copy_move_backward_a<_IsMove> (std::__niter_base(__first), std::__niter_base(__last), std::__niter_base(__result))); } /** * @brief Copies the range [first,last) into result. * @ingroup mutating_algorithms * @param __first A bidirectional iterator. * @param __last A bidirectional iterator. * @param __result A bidirectional iterator. * @return result - (first - last) * * The function has the same effect as copy, but starts at the end of the * range and works its way to the start, returning the start of the result. * This inline function will boil down to a call to @c memmove whenever * possible. Failing that, if random access iterators are passed, then the * loop count will be known (and therefore a candidate for compiler * optimizations such as unrolling). * * Result may not be in the range (first,last]. Use copy instead. Note * that the start of the output range may overlap [first,last). */ template<typename _BI1, typename _BI2> inline _BI2 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) { // concept requirements __glibcxx_function_requires(_BidirectionalIteratorConcept<_BI1>) __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<_BI2>) __glibcxx_function_requires(_ConvertibleConcept< typename iterator_traits<_BI1>::value_type, typename iterator_traits<_BI2>::value_type>) __glibcxx_requires_valid_range(__first, __last); return (std::__copy_move_backward_a2<__is_move_iterator<_BI1>::__value> (std::__miter_base(__first), std::__miter_base(__last), __result)); } #if __cplusplus >= 201103L /** * @brief Moves the range [first,last) into result. * @ingroup mutating_algorithms * @param __first A bidirectional iterator. * @param __last A bidirectional iterator. * @param __result A bidirectional iterator. * @return result - (first - last) * * The function has the same effect as move, but starts at the end of the * range and works its way to the start, returning the start of the result. * This inline function will boil down to a call to @c memmove whenever * possible. Failing that, if random access iterators are passed, then the * loop count will be known (and therefore a candidate for compiler * optimizations such as unrolling). * * Result may not be in the range (first,last]. Use move instead. Note * that the start of the output range may overlap [first,last). */ template<typename _BI1, typename _BI2> inline _BI2 move_backward(_BI1 __first, _BI1 __last, _BI2 __result) { // concept requirements __glibcxx_function_requires(_BidirectionalIteratorConcept<_BI1>) __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<_BI2>) __glibcxx_function_requires(_ConvertibleConcept< typename iterator_traits<_BI1>::value_type, typename iterator_traits<_BI2>::value_type>) __glibcxx_requires_valid_range(__first, __last); return std::__copy_move_backward_a2<true>(std::__miter_base(__first), std::__miter_base(__last), __result); } #define _GLIBCXX_MOVE_BACKWARD3(_Tp, _Up, _Vp) std::move_backward(_Tp, _Up, _Vp) #else #define _GLIBCXX_MOVE_BACKWARD3(_Tp, _Up, _Vp) std::copy_backward(_Tp, _Up, _Vp) #endif template<typename _ForwardIterator, typename _Tp> inline typename __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, void>::__type __fill_a(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { for (; __first != __last; ++__first) *__first = __value; } template<typename _ForwardIterator, typename _Tp> inline typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type __fill_a(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { const _Tp __tmp = __value; for (; __first != __last; ++__first) *__first = __tmp; } // Specialization: for char types we can use memset. template<typename _Tp> inline typename __gnu_cxx::__enable_if<__is_byte<_Tp>::__value, void>::__type __fill_a(_Tp* __first, _Tp* __last, const _Tp& __c) { const _Tp __tmp = __c; __builtin_memset(__first, static_cast<unsigned char>(__tmp), __last - __first); } /** * @brief Fills the range [first,last) with copies of value. * @ingroup mutating_algorithms * @param __first A forward iterator. * @param __last A forward iterator. * @param __value A reference-to-const of arbitrary type. * @return Nothing. * * This function fills a range with copies of the same value. For char * types filling contiguous areas of memory, this becomes an inline call * to @c memset or @c wmemset. */ template<typename _ForwardIterator, typename _Tp> inline void fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { // concept requirements __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< _ForwardIterator>) __glibcxx_requires_valid_range(__first, __last); std::__fill_a(std::__niter_base(__first), std::__niter_base(__last), __value); } template<typename _OutputIterator, typename _Size, typename _Tp> inline typename __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, _OutputIterator>::__type __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value) { for (__decltype(__n + 0) __niter = __n; __niter > 0; --__niter, ++__first) *__first = __value; return __first; } template<typename _OutputIterator, typename _Size, typename _Tp> inline typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, _OutputIterator>::__type __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value) { const _Tp __tmp = __value; for (__decltype(__n + 0) __niter = __n; __niter > 0; --__niter, ++__first) *__first = __tmp; return __first; } template<typename _Size, typename _Tp> inline typename __gnu_cxx::__enable_if<__is_byte<_Tp>::__value, _Tp*>::__type __fill_n_a(_Tp* __first, _Size __n, const _Tp& __c) { std::__fill_a(__first, __first + __n, __c); return __first + __n; } /** * @brief Fills the range [first,first+n) with copies of value. * @ingroup mutating_algorithms * @param __first An output iterator. * @param __n The count of copies to perform. * @param __value A reference-to-const of arbitrary type. * @return The iterator at first+n. * * This function fills a range with copies of the same value. For char * types filling contiguous areas of memory, this becomes an inline call * to @c memset or @ wmemset. * * _GLIBCXX_RESOLVE_LIB_DEFECTS * DR 865. More algorithms that throw away information */ template<typename _OI, typename _Size, typename _Tp> inline _OI fill_n(_OI __first, _Size __n, const _Tp& __value) { // concept requirements __glibcxx_function_requires(_OutputIteratorConcept<_OI, _Tp>) return _OI(std::__fill_n_a(std::__niter_base(__first), __n, __value)); } template<bool _BoolType> struct __equal { template<typename _II1, typename _II2> static bool equal(_II1 __first1, _II1 __last1, _II2 __first2) { for (; __first1 != __last1; ++__first1, ++__first2) if (!(*__first1 == *__first2)) return false; return true; } }; template<> struct __equal<true> { template<typename _Tp> static bool equal(const _Tp* __first1, const _Tp* __last1, const _Tp* __first2) { return !__builtin_memcmp(__first1, __first2, sizeof(_Tp) * (__last1 - __first1)); } }; template<typename _II1, typename _II2> inline bool __equal_aux(_II1 __first1, _II1 __last1, _II2 __first2) { typedef typename iterator_traits<_II1>::value_type _ValueType1; typedef typename iterator_traits<_II2>::value_type _ValueType2; const bool __simple = ((__is_integer<_ValueType1>::__value || __is_pointer<_ValueType1>::__value) && __is_pointer<_II1>::__value && __is_pointer<_II2>::__value && __are_same<_ValueType1, _ValueType2>::__value); return std::__equal<__simple>::equal(__first1, __last1, __first2); } template<typename, typename> struct __lc_rai { template<typename _II1, typename _II2> static _II1 __newlast1(_II1, _II1 __last1, _II2, _II2) { return __last1; } template<typename _II> static bool __cnd2(_II __first, _II __last) { return __first != __last; } }; template<> struct __lc_rai<random_access_iterator_tag, random_access_iterator_tag> { template<typename _RAI1, typename _RAI2> static _RAI1 __newlast1(_RAI1 __first1, _RAI1 __last1, _RAI2 __first2, _RAI2 __last2) { const typename iterator_traits<_RAI1>::difference_type __diff1 = __last1 - __first1; const typename iterator_traits<_RAI2>::difference_type __diff2 = __last2 - __first2; return __diff2 < __diff1 ? __first1 + __diff2 : __last1; } template<typename _RAI> static bool __cnd2(_RAI, _RAI) { return true; } }; template<bool _BoolType> struct __lexicographical_compare { template<typename _II1, typename _II2> static bool __lc(_II1, _II1, _II2, _II2); }; template<bool _BoolType> template<typename _II1, typename _II2> bool __lexicographical_compare<_BoolType>:: __lc(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2) { typedef typename iterator_traits<_II1>::iterator_category _Category1; typedef typename iterator_traits<_II2>::iterator_category _Category2; typedef std::__lc_rai<_Category1, _Category2> __rai_type; __last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2); for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2); ++__first1, ++__first2) { if (*__first1 < *__first2) return true; if (*__first2 < *__first1) return false; } return __first1 == __last1 && __first2 != __last2; } template<> struct __lexicographical_compare<true> { template<typename _Tp, typename _Up> static bool __lc(const _Tp* __first1, const _Tp* __last1, const _Up* __first2, const _Up* __last2) { const size_t __len1 = __last1 - __first1; const size_t __len2 = __last2 - __first2; const int __result = __builtin_memcmp(__first1, __first2, std::min(__len1, __len2)); return __result != 0 ? __result < 0 : __len1 < __len2; } }; template<typename _II1, typename _II2> inline bool __lexicographical_compare_aux(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2) { typedef typename iterator_traits<_II1>::value_type _ValueType1; typedef typename iterator_traits<_II2>::value_type _ValueType2; const bool __simple = (__is_byte<_ValueType1>::__value && __is_byte<_ValueType2>::__value && !__gnu_cxx::__numeric_traits<_ValueType1>::__is_signed && !__gnu_cxx::__numeric_traits<_ValueType2>::__is_signed && __is_pointer<_II1>::__value && __is_pointer<_II2>::__value); return std::__lexicographical_compare<__simple>::__lc(__first1, __last1, __first2, __last2); } /** * @brief Finds the first position in which @a val could be inserted * without changing the ordering. * @param __first An iterator. * @param __last Another iterator. * @param __val The search term. * @return An iterator pointing to the first element <em>not less * than</em> @a val, or end() if every element is less than * @a val. * @ingroup binary_search_algorithms */ template<typename _ForwardIterator, typename _Tp> _ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __val) { #ifdef _GLIBCXX_CONCEPT_CHECKS typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; #endif typedef typename iterator_traits<_ForwardIterator>::difference_type _DistanceType; // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_LessThanOpConcept<_ValueType, _Tp>) __glibcxx_requires_partitioned_lower(__first, __last, __val); _DistanceType __len = std::distance(__first, __last); while (__len > 0) { _DistanceType __half = __len >> 1; _ForwardIterator __middle = __first; std::advance(__middle, __half); if (*__middle < __val) { __first = __middle; ++__first; __len = __len - __half - 1; } else __len = __half; } return __first; } /// This is a helper function for the sort routines and for random.tcc. // Precondition: __n > 0. inline _GLIBCXX_CONSTEXPR int __lg(int __n) { return sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); } inline _GLIBCXX_CONSTEXPR unsigned __lg(unsigned __n) { return sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); } inline _GLIBCXX_CONSTEXPR long __lg(long __n) { return sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); } inline _GLIBCXX_CONSTEXPR unsigned long __lg(unsigned long __n) { return sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); } inline _GLIBCXX_CONSTEXPR long long __lg(long long __n) { return sizeof(long long) * __CHAR_BIT__ - 1 - __builtin_clzll(__n); } inline _GLIBCXX_CONSTEXPR unsigned long long __lg(unsigned long long __n) { return sizeof(long long) * __CHAR_BIT__ - 1 - __builtin_clzll(__n); } _GLIBCXX_END_NAMESPACE_VERSION _GLIBCXX_BEGIN_NAMESPACE_ALGO /** * @brief Tests a range for element-wise equality. * @ingroup non_mutating_algorithms * @param __first1 An input iterator. * @param __last1 An input iterator. * @param __first2 An input iterator. * @return A boolean true or false. * * This compares the elements of two ranges using @c == and returns true or * false depending on whether all of the corresponding elements of the * ranges are equal. */ template<typename _II1, typename _II2> inline bool equal(_II1 __first1, _II1 __last1, _II2 __first2) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_II1>) __glibcxx_function_requires(_InputIteratorConcept<_II2>) __glibcxx_function_requires(_EqualOpConcept< typename iterator_traits<_II1>::value_type, typename iterator_traits<_II2>::value_type>) __glibcxx_requires_valid_range(__first1, __last1); return std::__equal_aux(std::__niter_base(__first1), std::__niter_base(__last1), std::__niter_base(__first2)); } /** * @brief Tests a range for element-wise equality. * @ingroup non_mutating_algorithms * @param __first1 An input iterator. * @param __last1 An input iterator. * @param __first2 An input iterator. * @param __binary_pred A binary predicate @link functors * functor@endlink. * @return A boolean true or false. * * This compares the elements of two ranges using the binary_pred * parameter, and returns true or * false depending on whether all of the corresponding elements of the * ranges are equal. */ template<typename _IIter1, typename _IIter2, typename _BinaryPredicate> inline bool equal(_IIter1 __first1, _IIter1 __last1, _IIter2 __first2, _BinaryPredicate __binary_pred) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_IIter1>) __glibcxx_function_requires(_InputIteratorConcept<_IIter2>) __glibcxx_requires_valid_range(__first1, __last1); for (; __first1 != __last1; ++__first1, ++__first2) if (!bool(__binary_pred(*__first1, *__first2))) return false; return true; } /** * @brief Performs @b dictionary comparison on ranges. * @ingroup sorting_algorithms * @param __first1 An input iterator. * @param __last1 An input iterator. * @param __first2 An input iterator. * @param __last2 An input iterator. * @return A boolean true or false. * * <em>Returns true if the sequence of elements defined by the range * [first1,last1) is lexicographically less than the sequence of elements * defined by the range [first2,last2). Returns false otherwise.</em> * (Quoted from [25.3.8]/1.) If the iterators are all character pointers, * then this is an inline call to @c memcmp. */ template<typename _II1, typename _II2> inline bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2) { #ifdef _GLIBCXX_CONCEPT_CHECKS // concept requirements typedef typename iterator_traits<_II1>::value_type _ValueType1; typedef typename iterator_traits<_II2>::value_type _ValueType2; #endif __glibcxx_function_requires(_InputIteratorConcept<_II1>) __glibcxx_function_requires(_InputIteratorConcept<_II2>) __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>) __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>) __glibcxx_requires_valid_range(__first1, __last1); __glibcxx_requires_valid_range(__first2, __last2); return std::__lexicographical_compare_aux(std::__niter_base(__first1), std::__niter_base(__last1), std::__niter_base(__first2), std::__niter_base(__last2)); } /** * @brief Performs @b dictionary comparison on ranges. * @ingroup sorting_algorithms * @param __first1 An input iterator. * @param __last1 An input iterator. * @param __first2 An input iterator. * @param __last2 An input iterator. * @param __comp A @link comparison_functors comparison functor@endlink. * @return A boolean true or false. * * The same as the four-parameter @c lexicographical_compare, but uses the * comp parameter instead of @c <. */ template<typename _II1, typename _II2, typename _Compare> bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2, _Compare __comp) { typedef typename iterator_traits<_II1>::iterator_category _Category1; typedef typename iterator_traits<_II2>::iterator_category _Category2; typedef std::__lc_rai<_Category1, _Category2> __rai_type; // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_II1>) __glibcxx_function_requires(_InputIteratorConcept<_II2>) __glibcxx_requires_valid_range(__first1, __last1); __glibcxx_requires_valid_range(__first2, __last2); __last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2); for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2); ++__first1, ++__first2) { if (__comp(*__first1, *__first2)) return true; if (__comp(*__first2, *__first1)) return false; } return __first1 == __last1 && __first2 != __last2; } /** * @brief Finds the places in ranges which don't match. * @ingroup non_mutating_algorithms * @param __first1 An input iterator. * @param __last1 An input iterator. * @param __first2 An input iterator. * @return A pair of iterators pointing to the first mismatch. * * This compares the elements of two ranges using @c == and returns a pair * of iterators. The first iterator points into the first range, the * second iterator points into the second range, and the elements pointed * to by the iterators are not equal. */ template<typename _InputIterator1, typename _InputIterator2> pair<_InputIterator1, _InputIterator2> mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_function_requires(_EqualOpConcept< typename iterator_traits<_InputIterator1>::value_type, typename iterator_traits<_InputIterator2>::value_type>) __glibcxx_requires_valid_range(__first1, __last1); while (__first1 != __last1 && *__first1 == *__first2) { ++__first1; ++__first2; } return pair<_InputIterator1, _InputIterator2>(__first1, __first2); } /** * @brief Finds the places in ranges which don't match. * @ingroup non_mutating_algorithms * @param __first1 An input iterator. * @param __last1 An input iterator. * @param __first2 An input iterator. * @param __binary_pred A binary predicate @link functors * functor@endlink. * @return A pair of iterators pointing to the first mismatch. * * This compares the elements of two ranges using the binary_pred * parameter, and returns a pair * of iterators. The first iterator points into the first range, the * second iterator points into the second range, and the elements pointed * to by the iterators are not equal. */ template<typename _InputIterator1, typename _InputIterator2, typename _BinaryPredicate> pair<_InputIterator1, _InputIterator2> mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __binary_pred) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_requires_valid_range(__first1, __last1); while (__first1 != __last1 && bool(__binary_pred(*__first1, *__first2))) { ++__first1; ++__first2; } return pair<_InputIterator1, _InputIterator2>(__first1, __first2); } _GLIBCXX_END_NAMESPACE_ALGO } // namespace std // NB: This file is included within many other C++ includes, as a way // of getting the base algorithms. So, make sure that parallel bits // come in too if requested. #ifdef _GLIBCXX_PARALLEL # include <parallel/algobase.h> #endif #endif ������������������������������������������������������������������������������������������������c++/4.8.2/bits/regex_cursor.h�����������������������������������������������������������������������0000644�����������������00000005311�14763166030�0011414 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// class template regex -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** * @file bits/regex_cursor.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{regex} */ namespace std _GLIBCXX_VISIBILITY(default) { namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup regex-detail Base and Implementation Classes * @ingroup regex * @{ */ /// ABC for pattern matching struct _PatternCursor { virtual ~_PatternCursor() { }; virtual void _M_next() = 0; virtual bool _M_at_end() const = 0; }; /// Provides a cursor into the specific target string. template<typename _FwdIterT> class _SpecializedCursor : public _PatternCursor { public: _SpecializedCursor(const _FwdIterT& __b, const _FwdIterT __e) : _M_b(__b), _M_c(__b), _M_e(__e) { } typename std::iterator_traits<_FwdIterT>::value_type _M_current() const { return *_M_c; } void _M_next() { ++_M_c; } _FwdIterT _M_pos() const { return _M_c; } const _FwdIterT& _M_begin() const { return _M_b; } const _FwdIterT& _M_end() const { return _M_e; } bool _M_at_end() const { return _M_c == _M_e; } private: _FwdIterT _M_b; _FwdIterT _M_c; _FwdIterT _M_e; }; // Helper function to create a cursor specialized for an iterator class. template<typename _FwdIterT> inline _SpecializedCursor<_FwdIterT> __cursor(const _FwdIterT& __b, const _FwdIterT __e) { return _SpecializedCursor<_FwdIterT>(__b, __e); } //@} regex-detail _GLIBCXX_END_NAMESPACE_VERSION } // namespace __detail } // namespace �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/mask_array.h�������������������������������������������������������������������������0000644�����������������00000016643�14763166030�0011050 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// The template and inlines for the -*- C++ -*- mask_array class. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/mask_array.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{valarray} */ // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr> #ifndef _MASK_ARRAY_H #define _MASK_ARRAY_H 1 #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup numeric_arrays * @{ */ /** * @brief Reference to selected subset of an array. * * A mask_array is a reference to the actual elements of an array specified * by a bitmask in the form of an array of bool. The way to get a * mask_array is to call operator[](valarray<bool>) on a valarray. The * returned mask_array then permits carrying operations out on the * referenced subset of elements in the original valarray. * * For example, if a mask_array is obtained using the array (false, true, * false, true) as an argument, the mask array has two elements referring * to array[1] and array[3] in the underlying array. * * @param Tp Element type. */ template <class _Tp> class mask_array { public: typedef _Tp value_type; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 253. valarray helper functions are almost entirely useless /// Copy constructor. Both slices refer to the same underlying array. mask_array (const mask_array&); /// Assignment operator. Assigns elements to corresponding elements /// of @a a. mask_array& operator=(const mask_array&); void operator=(const valarray<_Tp>&) const; /// Multiply slice elements by corresponding elements of @a v. void operator*=(const valarray<_Tp>&) const; /// Divide slice elements by corresponding elements of @a v. void operator/=(const valarray<_Tp>&) const; /// Modulo slice elements by corresponding elements of @a v. void operator%=(const valarray<_Tp>&) const; /// Add corresponding elements of @a v to slice elements. void operator+=(const valarray<_Tp>&) const; /// Subtract corresponding elements of @a v from slice elements. void operator-=(const valarray<_Tp>&) const; /// Logical xor slice elements with corresponding elements of @a v. void operator^=(const valarray<_Tp>&) const; /// Logical and slice elements with corresponding elements of @a v. void operator&=(const valarray<_Tp>&) const; /// Logical or slice elements with corresponding elements of @a v. void operator|=(const valarray<_Tp>&) const; /// Left shift slice elements by corresponding elements of @a v. void operator<<=(const valarray<_Tp>&) const; /// Right shift slice elements by corresponding elements of @a v. void operator>>=(const valarray<_Tp>&) const; /// Assign all slice elements to @a t. void operator=(const _Tp&) const; // ~mask_array (); template<class _Dom> void operator=(const _Expr<_Dom,_Tp>&) const; template<class _Dom> void operator*=(const _Expr<_Dom,_Tp>&) const; template<class _Dom> void operator/=(const _Expr<_Dom,_Tp>&) const; template<class _Dom> void operator%=(const _Expr<_Dom,_Tp>&) const; template<class _Dom> void operator+=(const _Expr<_Dom,_Tp>&) const; template<class _Dom> void operator-=(const _Expr<_Dom,_Tp>&) const; template<class _Dom> void operator^=(const _Expr<_Dom,_Tp>&) const; template<class _Dom> void operator&=(const _Expr<_Dom,_Tp>&) const; template<class _Dom> void operator|=(const _Expr<_Dom,_Tp>&) const; template<class _Dom> void operator<<=(const _Expr<_Dom,_Tp>&) const; template<class _Dom> void operator>>=(const _Expr<_Dom,_Tp>&) const; private: mask_array(_Array<_Tp>, size_t, _Array<bool>); friend class valarray<_Tp>; const size_t _M_sz; const _Array<bool> _M_mask; const _Array<_Tp> _M_array; // not implemented mask_array(); }; template<typename _Tp> inline mask_array<_Tp>::mask_array(const mask_array<_Tp>& a) : _M_sz(a._M_sz), _M_mask(a._M_mask), _M_array(a._M_array) {} template<typename _Tp> inline mask_array<_Tp>::mask_array(_Array<_Tp> __a, size_t __s, _Array<bool> __m) : _M_sz(__s), _M_mask(__m), _M_array(__a) {} template<typename _Tp> inline mask_array<_Tp>& mask_array<_Tp>::operator=(const mask_array<_Tp>& __a) { std::__valarray_copy(__a._M_array, __a._M_mask, _M_sz, _M_array, _M_mask); return *this; } template<typename _Tp> inline void mask_array<_Tp>::operator=(const _Tp& __t) const { std::__valarray_fill(_M_array, _M_sz, _M_mask, __t); } template<typename _Tp> inline void mask_array<_Tp>::operator=(const valarray<_Tp>& __v) const { std::__valarray_copy(_Array<_Tp>(__v), __v.size(), _M_array, _M_mask); } template<typename _Tp> template<class _Ex> inline void mask_array<_Tp>::operator=(const _Expr<_Ex, _Tp>& __e) const { std::__valarray_copy(__e, __e.size(), _M_array, _M_mask); } #undef _DEFINE_VALARRAY_OPERATOR #define _DEFINE_VALARRAY_OPERATOR(_Op, _Name) \ template<typename _Tp> \ inline void \ mask_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const \ { \ _Array_augmented_##_Name(_M_array, _M_mask, \ _Array<_Tp>(__v), __v.size()); \ } \ \ template<typename _Tp> \ template<class _Dom> \ inline void \ mask_array<_Tp>::operator _Op##=(const _Expr<_Dom, _Tp>& __e) const\ { \ _Array_augmented_##_Name(_M_array, _M_mask, __e, __e.size()); \ } _DEFINE_VALARRAY_OPERATOR(*, __multiplies) _DEFINE_VALARRAY_OPERATOR(/, __divides) _DEFINE_VALARRAY_OPERATOR(%, __modulus) _DEFINE_VALARRAY_OPERATOR(+, __plus) _DEFINE_VALARRAY_OPERATOR(-, __minus) _DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor) _DEFINE_VALARRAY_OPERATOR(&, __bitwise_and) _DEFINE_VALARRAY_OPERATOR(|, __bitwise_or) _DEFINE_VALARRAY_OPERATOR(<<, __shift_left) _DEFINE_VALARRAY_OPERATOR(>>, __shift_right) #undef _DEFINE_VALARRAY_OPERATOR // @} group numeric_arrays _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _MASK_ARRAY_H */ ���������������������������������������������������������������������������������������������c++/4.8.2/bits/sstream.tcc��������������������������������������������������������������������������0000644�����������������00000022422�14763166030�0010707 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// String based streams -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/sstream.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{sstream} */ // // ISO C++ 14882: 27.7 String-based streams // #ifndef _SSTREAM_TCC #define _SSTREAM_TCC 1 #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template <class _CharT, class _Traits, class _Alloc> typename basic_stringbuf<_CharT, _Traits, _Alloc>::int_type basic_stringbuf<_CharT, _Traits, _Alloc>:: pbackfail(int_type __c) { int_type __ret = traits_type::eof(); if (this->eback() < this->gptr()) { // Try to put back __c into input sequence in one of three ways. // Order these tests done in is unspecified by the standard. const bool __testeof = traits_type::eq_int_type(__c, __ret); if (!__testeof) { const bool __testeq = traits_type::eq(traits_type:: to_char_type(__c), this->gptr()[-1]); const bool __testout = this->_M_mode & ios_base::out; if (__testeq || __testout) { this->gbump(-1); if (!__testeq) *this->gptr() = traits_type::to_char_type(__c); __ret = __c; } } else { this->gbump(-1); __ret = traits_type::not_eof(__c); } } return __ret; } template <class _CharT, class _Traits, class _Alloc> typename basic_stringbuf<_CharT, _Traits, _Alloc>::int_type basic_stringbuf<_CharT, _Traits, _Alloc>:: overflow(int_type __c) { const bool __testout = this->_M_mode & ios_base::out; if (__builtin_expect(!__testout, false)) return traits_type::eof(); const bool __testeof = traits_type::eq_int_type(__c, traits_type::eof()); if (__builtin_expect(__testeof, false)) return traits_type::not_eof(__c); const __size_type __capacity = _M_string.capacity(); const __size_type __max_size = _M_string.max_size(); const bool __testput = this->pptr() < this->epptr(); if (__builtin_expect(!__testput && __capacity == __max_size, false)) return traits_type::eof(); // Try to append __c into output sequence in one of two ways. // Order these tests done in is unspecified by the standard. const char_type __conv = traits_type::to_char_type(__c); if (!__testput) { // NB: Start ostringstream buffers at 512 chars. This is an // experimental value (pronounced "arbitrary" in some of the // hipper English-speaking countries), and can be changed to // suit particular needs. // // _GLIBCXX_RESOLVE_LIB_DEFECTS // 169. Bad efficiency of overflow() mandated // 432. stringbuf::overflow() makes only one write position // available const __size_type __opt_len = std::max(__size_type(2 * __capacity), __size_type(512)); const __size_type __len = std::min(__opt_len, __max_size); __string_type __tmp; __tmp.reserve(__len); if (this->pbase()) __tmp.assign(this->pbase(), this->epptr() - this->pbase()); __tmp.push_back(__conv); _M_string.swap(__tmp); _M_sync(const_cast<char_type*>(_M_string.data()), this->gptr() - this->eback(), this->pptr() - this->pbase()); } else *this->pptr() = __conv; this->pbump(1); return __c; } template <class _CharT, class _Traits, class _Alloc> typename basic_stringbuf<_CharT, _Traits, _Alloc>::int_type basic_stringbuf<_CharT, _Traits, _Alloc>:: underflow() { int_type __ret = traits_type::eof(); const bool __testin = this->_M_mode & ios_base::in; if (__testin) { // Update egptr() to match the actual string end. _M_update_egptr(); if (this->gptr() < this->egptr()) __ret = traits_type::to_int_type(*this->gptr()); } return __ret; } template <class _CharT, class _Traits, class _Alloc> typename basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type basic_stringbuf<_CharT, _Traits, _Alloc>:: seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode) { pos_type __ret = pos_type(off_type(-1)); bool __testin = (ios_base::in & this->_M_mode & __mode) != 0; bool __testout = (ios_base::out & this->_M_mode & __mode) != 0; const bool __testboth = __testin && __testout && __way != ios_base::cur; __testin &= !(__mode & ios_base::out); __testout &= !(__mode & ios_base::in); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 453. basic_stringbuf::seekoff need not always fail for an empty stream. const char_type* __beg = __testin ? this->eback() : this->pbase(); if ((__beg || !__off) && (__testin || __testout || __testboth)) { _M_update_egptr(); off_type __newoffi = __off; off_type __newoffo = __newoffi; if (__way == ios_base::cur) { __newoffi += this->gptr() - __beg; __newoffo += this->pptr() - __beg; } else if (__way == ios_base::end) __newoffo = __newoffi += this->egptr() - __beg; if ((__testin || __testboth) && __newoffi >= 0 && this->egptr() - __beg >= __newoffi) { this->setg(this->eback(), this->eback() + __newoffi, this->egptr()); __ret = pos_type(__newoffi); } if ((__testout || __testboth) && __newoffo >= 0 && this->egptr() - __beg >= __newoffo) { _M_pbump(this->pbase(), this->epptr(), __newoffo); __ret = pos_type(__newoffo); } } return __ret; } template <class _CharT, class _Traits, class _Alloc> typename basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type basic_stringbuf<_CharT, _Traits, _Alloc>:: seekpos(pos_type __sp, ios_base::openmode __mode) { pos_type __ret = pos_type(off_type(-1)); const bool __testin = (ios_base::in & this->_M_mode & __mode) != 0; const bool __testout = (ios_base::out & this->_M_mode & __mode) != 0; const char_type* __beg = __testin ? this->eback() : this->pbase(); if ((__beg || !off_type(__sp)) && (__testin || __testout)) { _M_update_egptr(); const off_type __pos(__sp); const bool __testpos = (0 <= __pos && __pos <= this->egptr() - __beg); if (__testpos) { if (__testin) this->setg(this->eback(), this->eback() + __pos, this->egptr()); if (__testout) _M_pbump(this->pbase(), this->epptr(), __pos); __ret = __sp; } } return __ret; } template <class _CharT, class _Traits, class _Alloc> void basic_stringbuf<_CharT, _Traits, _Alloc>:: _M_sync(char_type* __base, __size_type __i, __size_type __o) { const bool __testin = _M_mode & ios_base::in; const bool __testout = _M_mode & ios_base::out; char_type* __endg = __base + _M_string.size(); char_type* __endp = __base + _M_string.capacity(); if (__base != _M_string.data()) { // setbuf: __i == size of buffer area (_M_string.size() == 0). __endg += __i; __i = 0; __endp = __endg; } if (__testin) this->setg(__base, __base + __i, __endg); if (__testout) { _M_pbump(__base, __endp, __o); // egptr() always tracks the string end. When !__testin, // for the correct functioning of the streambuf inlines // the other get area pointers are identical. if (!__testin) this->setg(__endg, __endg, __endg); } } template <class _CharT, class _Traits, class _Alloc> void basic_stringbuf<_CharT, _Traits, _Alloc>:: _M_pbump(char_type* __pbeg, char_type* __pend, off_type __off) { this->setp(__pbeg, __pend); while (__off > __gnu_cxx::__numeric_traits<int>::__max) { this->pbump(__gnu_cxx::__numeric_traits<int>::__max); __off -= __gnu_cxx::__numeric_traits<int>::__max; } this->pbump(__off); } // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. #if _GLIBCXX_EXTERN_TEMPLATE extern template class basic_stringbuf<char>; extern template class basic_istringstream<char>; extern template class basic_ostringstream<char>; extern template class basic_stringstream<char>; #ifdef _GLIBCXX_USE_WCHAR_T extern template class basic_stringbuf<wchar_t>; extern template class basic_istringstream<wchar_t>; extern template class basic_ostringstream<wchar_t>; extern template class basic_stringstream<wchar_t>; #endif #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/postypes.h���������������������������������������������������������������������������0000644�����������������00000020020�14763166030�0010565 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Position types -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/postypes.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{iosfwd} */ // // ISO C++ 14882: 27.4.1 - Types // ISO C++ 14882: 27.4.3 - Template class fpos // #ifndef _GLIBCXX_POSTYPES_H #define _GLIBCXX_POSTYPES_H 1 #pragma GCC system_header #include <cwchar> // For mbstate_t // XXX If <stdint.h> is really needed, make sure to define the macros // before including it, in order not to break <tr1/cstdint> (and <cstdint> // in C++0x). Reconsider all this as soon as possible... #if (defined(_GLIBCXX_HAVE_INT64_T) && !defined(_GLIBCXX_HAVE_INT64_T_LONG) \ && !defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG)) #ifndef __STDC_LIMIT_MACROS # define _UNDEF__STDC_LIMIT_MACROS # define __STDC_LIMIT_MACROS #endif #ifndef __STDC_CONSTANT_MACROS # define _UNDEF__STDC_CONSTANT_MACROS # define __STDC_CONSTANT_MACROS #endif #include <stdint.h> // For int64_t #ifdef _UNDEF__STDC_LIMIT_MACROS # undef __STDC_LIMIT_MACROS # undef _UNDEF__STDC_LIMIT_MACROS #endif #ifdef _UNDEF__STDC_CONSTANT_MACROS # undef __STDC_CONSTANT_MACROS # undef _UNDEF__STDC_CONSTANT_MACROS #endif #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // The types streamoff, streampos and wstreampos and the class // template fpos<> are described in clauses 21.1.2, 21.1.3, 27.1.2, // 27.2, 27.4.1, 27.4.3 and D.6. Despite all this verbiage, the // behaviour of these types is mostly implementation defined or // unspecified. The behaviour in this implementation is as noted // below. /** * @brief Type used by fpos, char_traits<char>, and char_traits<wchar_t>. * * In clauses 21.1.3.1 and 27.4.1 streamoff is described as an * implementation defined type. * Note: In versions of GCC up to and including GCC 3.3, streamoff * was typedef long. */ #ifdef _GLIBCXX_HAVE_INT64_T_LONG typedef long streamoff; #elif defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG) typedef long long streamoff; #elif defined(_GLIBCXX_HAVE_INT64_T) typedef int64_t streamoff; #else typedef long long streamoff; #endif /// Integral type for I/O operation counts and buffer sizes. typedef ptrdiff_t streamsize; // Signed integral type /** * @brief Class representing stream positions. * * The standard places no requirements upon the template parameter StateT. * In this implementation StateT must be DefaultConstructible, * CopyConstructible and Assignable. The standard only requires that fpos * should contain a member of type StateT. In this implementation it also * contains an offset stored as a signed integer. * * @param StateT Type passed to and returned from state(). */ template<typename _StateT> class fpos { private: streamoff _M_off; _StateT _M_state; public: // The standard doesn't require that fpos objects can be default // constructed. This implementation provides a default // constructor that initializes the offset to 0 and default // constructs the state. fpos() : _M_off(0), _M_state() { } // The standard requires that fpos objects can be constructed // from streamoff objects using the constructor syntax, and // fails to give any meaningful semantics. In this // implementation implicit conversion is also allowed, and this // constructor stores the streamoff as the offset and default // constructs the state. /// Construct position from offset. fpos(streamoff __off) : _M_off(__off), _M_state() { } /// Convert to streamoff. operator streamoff() const { return _M_off; } /// Remember the value of @a st. void state(_StateT __st) { _M_state = __st; } /// Return the last set value of @a st. _StateT state() const { return _M_state; } // The standard requires that this operator must be defined, but // gives no semantics. In this implementation it just adds its // argument to the stored offset and returns *this. /// Add offset to this position. fpos& operator+=(streamoff __off) { _M_off += __off; return *this; } // The standard requires that this operator must be defined, but // gives no semantics. In this implementation it just subtracts // its argument from the stored offset and returns *this. /// Subtract offset from this position. fpos& operator-=(streamoff __off) { _M_off -= __off; return *this; } // The standard requires that this operator must be defined, but // defines its semantics only in terms of operator-. In this // implementation it constructs a copy of *this, adds the // argument to that copy using operator+= and then returns the // copy. /// Add position and offset. fpos operator+(streamoff __off) const { fpos __pos(*this); __pos += __off; return __pos; } // The standard requires that this operator must be defined, but // defines its semantics only in terms of operator+. In this // implementation it constructs a copy of *this, subtracts the // argument from that copy using operator-= and then returns the // copy. /// Subtract offset from position. fpos operator-(streamoff __off) const { fpos __pos(*this); __pos -= __off; return __pos; } // The standard requires that this operator must be defined, but // defines its semantics only in terms of operator+. In this // implementation it returns the difference between the offset // stored in *this and in the argument. /// Subtract position to return offset. streamoff operator-(const fpos& __other) const { return _M_off - __other._M_off; } }; // The standard only requires that operator== must be an // equivalence relation. In this implementation two fpos<StateT> // objects belong to the same equivalence class if the contained // offsets compare equal. /// Test if equivalent to another position. template<typename _StateT> inline bool operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) { return streamoff(__lhs) == streamoff(__rhs); } template<typename _StateT> inline bool operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) { return streamoff(__lhs) != streamoff(__rhs); } // Clauses 21.1.3.1 and 21.1.3.2 describe streampos and wstreampos // as implementation defined types, but clause 27.2 requires that // they must both be typedefs for fpos<mbstate_t> /// File position for char streams. typedef fpos<mbstate_t> streampos; /// File position for wchar_t streams. typedef fpos<mbstate_t> wstreampos; #if __cplusplus >= 201103L /// File position for char16_t streams. typedef fpos<mbstate_t> u16streampos; /// File position for char32_t streams. typedef fpos<mbstate_t> u32streampos; #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_numeric.h������������������������������������������������������������������������0000644�����������������00000032774�14763166030�0011246 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Numeric functions implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_numeric.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{numeric} */ #ifndef _STL_NUMERIC_H #define _STL_NUMERIC_H 1 #include <bits/concept_check.h> #include <debug/debug.h> #include <bits/move.h> // For _GLIBCXX_MOVE #if __cplusplus >= 201103L namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Create a range of sequentially increasing values. * * For each element in the range @p [first,last) assigns @p value and * increments @p value as if by @p ++value. * * @param __first Start of range. * @param __last End of range. * @param __value Starting value. * @return Nothing. */ template<typename _ForwardIterator, typename _Tp> void iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value) { // concept requirements __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< _ForwardIterator>) __glibcxx_function_requires(_ConvertibleConcept<_Tp, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); for (; __first != __last; ++__first) { *__first = __value; ++__value; } } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_ALGO /** * @brief Accumulate values in a range. * * Accumulates the values in the range [first,last) using operator+(). The * initial value is @a init. The values are processed in order. * * @param __first Start of range. * @param __last End of range. * @param __init Starting value to add other values to. * @return The final sum. */ template<typename _InputIterator, typename _Tp> inline _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_requires_valid_range(__first, __last); for (; __first != __last; ++__first) __init = __init + *__first; return __init; } /** * @brief Accumulate values in a range with operation. * * Accumulates the values in the range [first,last) using the function * object @p __binary_op. The initial value is @p __init. The values are * processed in order. * * @param __first Start of range. * @param __last End of range. * @param __init Starting value to add other values to. * @param __binary_op Function object to accumulate with. * @return The final sum. */ template<typename _InputIterator, typename _Tp, typename _BinaryOperation> inline _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_requires_valid_range(__first, __last); for (; __first != __last; ++__first) __init = __binary_op(__init, *__first); return __init; } /** * @brief Compute inner product of two ranges. * * Starting with an initial value of @p __init, multiplies successive * elements from the two ranges and adds each product into the accumulated * value using operator+(). The values in the ranges are processed in * order. * * @param __first1 Start of range 1. * @param __last1 End of range 1. * @param __first2 Start of range 2. * @param __init Starting value to add other values to. * @return The final inner product. */ template<typename _InputIterator1, typename _InputIterator2, typename _Tp> inline _Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_requires_valid_range(__first1, __last1); for (; __first1 != __last1; ++__first1, ++__first2) __init = __init + (*__first1 * *__first2); return __init; } /** * @brief Compute inner product of two ranges. * * Starting with an initial value of @p __init, applies @p __binary_op2 to * successive elements from the two ranges and accumulates each result into * the accumulated value using @p __binary_op1. The values in the ranges are * processed in order. * * @param __first1 Start of range 1. * @param __last1 End of range 1. * @param __first2 Start of range 2. * @param __init Starting value to add other values to. * @param __binary_op1 Function object to accumulate with. * @param __binary_op2 Function object to apply to pairs of input values. * @return The final inner product. */ template<typename _InputIterator1, typename _InputIterator2, typename _Tp, typename _BinaryOperation1, typename _BinaryOperation2> inline _Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_requires_valid_range(__first1, __last1); for (; __first1 != __last1; ++__first1, ++__first2) __init = __binary_op1(__init, __binary_op2(*__first1, *__first2)); return __init; } /** * @brief Return list of partial sums * * Accumulates the values in the range [first,last) using the @c + operator. * As each successive input value is added into the total, that partial sum * is written to @p __result. Therefore, the first value in @p __result is * the first value of the input, the second value in @p __result is the sum * of the first and second input values, and so on. * * @param __first Start of input range. * @param __last End of input range. * @param __result Output sum. * @return Iterator pointing just beyond the values written to __result. */ template<typename _InputIterator, typename _OutputIterator> _OutputIterator partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { typedef typename iterator_traits<_InputIterator>::value_type _ValueType; // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return __result; _ValueType __value = *__first; *__result = __value; while (++__first != __last) { __value = __value + *__first; *++__result = __value; } return ++__result; } /** * @brief Return list of partial sums * * Accumulates the values in the range [first,last) using @p __binary_op. * As each successive input value is added into the total, that partial sum * is written to @p __result. Therefore, the first value in @p __result is * the first value of the input, the second value in @p __result is the sum * of the first and second input values, and so on. * * @param __first Start of input range. * @param __last End of input range. * @param __result Output sum. * @param __binary_op Function object. * @return Iterator pointing just beyond the values written to __result. */ template<typename _InputIterator, typename _OutputIterator, typename _BinaryOperation> _OutputIterator partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOperation __binary_op) { typedef typename iterator_traits<_InputIterator>::value_type _ValueType; // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return __result; _ValueType __value = *__first; *__result = __value; while (++__first != __last) { __value = __binary_op(__value, *__first); *++__result = __value; } return ++__result; } /** * @brief Return differences between adjacent values. * * Computes the difference between adjacent values in the range * [first,last) using operator-() and writes the result to @p __result. * * @param __first Start of input range. * @param __last End of input range. * @param __result Output sums. * @return Iterator pointing just beyond the values written to result. * * _GLIBCXX_RESOLVE_LIB_DEFECTS * DR 539. partial_sum and adjacent_difference should mention requirements */ template<typename _InputIterator, typename _OutputIterator> _OutputIterator adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { typedef typename iterator_traits<_InputIterator>::value_type _ValueType; // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return __result; _ValueType __value = *__first; *__result = __value; while (++__first != __last) { _ValueType __tmp = *__first; *++__result = __tmp - __value; __value = _GLIBCXX_MOVE(__tmp); } return ++__result; } /** * @brief Return differences between adjacent values. * * Computes the difference between adjacent values in the range * [__first,__last) using the function object @p __binary_op and writes the * result to @p __result. * * @param __first Start of input range. * @param __last End of input range. * @param __result Output sum. * @param __binary_op Function object. * @return Iterator pointing just beyond the values written to result. * * _GLIBCXX_RESOLVE_LIB_DEFECTS * DR 539. partial_sum and adjacent_difference should mention requirements */ template<typename _InputIterator, typename _OutputIterator, typename _BinaryOperation> _OutputIterator adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOperation __binary_op) { typedef typename iterator_traits<_InputIterator>::value_type _ValueType; // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return __result; _ValueType __value = *__first; *__result = __value; while (++__first != __last) { _ValueType __tmp = *__first; *++__result = __binary_op(__tmp, __value); __value = _GLIBCXX_MOVE(__tmp); } return ++__result; } _GLIBCXX_END_NAMESPACE_ALGO } // namespace std #endif /* _STL_NUMERIC_H */ ����c++/4.8.2/bits/hash_bytes.h�������������������������������������������������������������������������0000644�����������������00000004142�14763166030�0011037 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Declarations for hash functions. -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/hash_bytes.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{functional} */ #ifndef _HASH_BYTES_H #define _HASH_BYTES_H 1 #pragma GCC system_header #include <bits/c++config.h> namespace std { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Hash function implementation for the nontrivial specialization. // All of them are based on a primitive that hashes a pointer to a // byte array. The actual hash algorithm is not guaranteed to stay // the same from release to release -- it may be updated or tuned to // improve hash quality or speed. size_t _Hash_bytes(const void* __ptr, size_t __len, size_t __seed); // A similar hash primitive, using the FNV hash algorithm. This // algorithm is guaranteed to stay the same from release to release. // (although it might not produce the same values on different // machines.) size_t _Fnv_hash_bytes(const void* __ptr, size_t __len, size_t __seed); _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/c++0x_warning.h����������������������������������������������������������������������0000644�����������������00000002741�14763166030�0011256 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/c++0x_warning.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{iosfwd} */ #ifndef _CXX0X_WARNING_H #define _CXX0X_WARNING_H 1 #if __cplusplus < 201103L #error This file requires compiler and library support for the \ ISO C++ 2011 standard. This support is currently experimental, and must be \ enabled with the -std=c++11 or -std=gnu++11 compiler options. #endif #endif �������������������������������c++/4.8.2/bits/localefwd.h��������������������������������������������������������������������������0000644�����������������00000012144�14763166030�0010647 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <locale> Forward declarations -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/localefwd.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{locale} */ // // ISO C++ 14882: 22.1 Locales // #ifndef _LOCALE_FWD_H #define _LOCALE_FWD_H 1 #pragma GCC system_header #include <bits/c++config.h> #include <bits/c++locale.h> // Defines __c_locale, config-specific include #include <iosfwd> // For ostreambuf_iterator, istreambuf_iterator #include <cctype> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup locales Locales * * Classes and functions for internationalization and localization. */ // 22.1.1 Locale class locale; template<typename _Facet> bool has_facet(const locale&) throw(); template<typename _Facet> const _Facet& use_facet(const locale&); // 22.1.3 Convenience interfaces template<typename _CharT> bool isspace(_CharT, const locale&); template<typename _CharT> bool isprint(_CharT, const locale&); template<typename _CharT> bool iscntrl(_CharT, const locale&); template<typename _CharT> bool isupper(_CharT, const locale&); template<typename _CharT> bool islower(_CharT, const locale&); template<typename _CharT> bool isalpha(_CharT, const locale&); template<typename _CharT> bool isdigit(_CharT, const locale&); template<typename _CharT> bool ispunct(_CharT, const locale&); template<typename _CharT> bool isxdigit(_CharT, const locale&); template<typename _CharT> bool isalnum(_CharT, const locale&); template<typename _CharT> bool isgraph(_CharT, const locale&); template<typename _CharT> _CharT toupper(_CharT, const locale&); template<typename _CharT> _CharT tolower(_CharT, const locale&); // 22.2.1 and 22.2.1.3 ctype class ctype_base; template<typename _CharT> class ctype; template<> class ctype<char>; #ifdef _GLIBCXX_USE_WCHAR_T template<> class ctype<wchar_t>; #endif template<typename _CharT> class ctype_byname; // NB: Specialized for char and wchar_t in locale_facets.h. class codecvt_base; template<typename _InternT, typename _ExternT, typename _StateT> class codecvt; template<> class codecvt<char, char, mbstate_t>; #ifdef _GLIBCXX_USE_WCHAR_T template<> class codecvt<wchar_t, char, mbstate_t>; #endif template<typename _InternT, typename _ExternT, typename _StateT> class codecvt_byname; // 22.2.2 and 22.2.3 numeric _GLIBCXX_BEGIN_NAMESPACE_LDBL template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> > class num_get; template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> > class num_put; _GLIBCXX_END_NAMESPACE_LDBL template<typename _CharT> class numpunct; template<typename _CharT> class numpunct_byname; // 22.2.4 collation template<typename _CharT> class collate; template<typename _CharT> class collate_byname; // 22.2.5 date and time class time_base; template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> > class time_get; template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> > class time_get_byname; template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> > class time_put; template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> > class time_put_byname; // 22.2.6 money class money_base; _GLIBCXX_BEGIN_NAMESPACE_LDBL template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> > class money_get; template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> > class money_put; _GLIBCXX_END_NAMESPACE_LDBL template<typename _CharT, bool _Intl = false> class moneypunct; template<typename _CharT, bool _Intl = false> class moneypunct_byname; // 22.2.7 message retrieval class messages_base; template<typename _CharT> class messages; template<typename _CharT> class messages_byname; _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/regex_constants.h��������������������������������������������������������������������0000644�����������������00000025472�14763166030�0012125 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// class template regex -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** * @file bits/regex_constants.h * @brief Constant definitions for the std regex library. * * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{regex} */ namespace std _GLIBCXX_VISIBILITY(default) { /** * @defgroup regex Regular Expressions * * A facility for performing regular expression pattern matching. * @{ */ /** * @namespace std::regex_constants * @brief ISO C++-0x entities sub namespace for regex. */ namespace regex_constants { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @name 5.1 Regular Expression Syntax Options */ //@{ enum __syntax_option { _S_icase, _S_nosubs, _S_optimize, _S_collate, _S_ECMAScript, _S_basic, _S_extended, _S_awk, _S_grep, _S_egrep, _S_syntax_last }; /** * @brief This is a bitmask type indicating how to interpret the regex. * * The @c syntax_option_type is implementation defined but it is valid to * perform bitwise operations on these values and expect the right thing to * happen. * * A valid value of type syntax_option_type shall have exactly one of the * elements @c ECMAScript, @c basic, @c extended, @c awk, @c grep, @c egrep * %set. */ typedef unsigned int syntax_option_type; /** * Specifies that the matching of regular expressions against a character * sequence shall be performed without regard to case. */ constexpr syntax_option_type icase = 1 << _S_icase; /** * Specifies that when a regular expression is matched against a character * container sequence, no sub-expression matches are to be stored in the * supplied match_results structure. */ constexpr syntax_option_type nosubs = 1 << _S_nosubs; /** * Specifies that the regular expression engine should pay more attention to * the speed with which regular expressions are matched, and less to the * speed with which regular expression objects are constructed. Otherwise * it has no detectable effect on the program output. */ constexpr syntax_option_type optimize = 1 << _S_optimize; /** * Specifies that character ranges of the form [a-b] should be locale * sensitive. */ constexpr syntax_option_type collate = 1 << _S_collate; /** * Specifies that the grammar recognized by the regular expression engine is * that used by ECMAScript in ECMA-262 [Ecma International, ECMAScript * Language Specification, Standard Ecma-262, third edition, 1999], as * modified in section [28.13]. This grammar is similar to that defined * in the PERL scripting language but extended with elements found in the * POSIX regular expression grammar. */ constexpr syntax_option_type ECMAScript = 1 << _S_ECMAScript; /** * Specifies that the grammar recognized by the regular expression engine is * that used by POSIX basic regular expressions in IEEE Std 1003.1-2001, * Portable Operating System Interface (POSIX), Base Definitions and * Headers, Section 9, Regular Expressions [IEEE, Information Technology -- * Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001]. */ constexpr syntax_option_type basic = 1 << _S_basic; /** * Specifies that the grammar recognized by the regular expression engine is * that used by POSIX extended regular expressions in IEEE Std 1003.1-2001, * Portable Operating System Interface (POSIX), Base Definitions and Headers, * Section 9, Regular Expressions. */ constexpr syntax_option_type extended = 1 << _S_extended; /** * Specifies that the grammar recognized by the regular expression engine is * that used by POSIX utility awk in IEEE Std 1003.1-2001. This option is * identical to syntax_option_type extended, except that C-style escape * sequences are supported. These sequences are: * \\\\, \\a, \\b, \\f, \\n, \\r, \\t , \\v, \\', ', * and \\ddd (where ddd is one, two, or three octal digits). */ constexpr syntax_option_type awk = 1 << _S_awk; /** * Specifies that the grammar recognized by the regular expression engine is * that used by POSIX utility grep in IEEE Std 1003.1-2001. This option is * identical to syntax_option_type basic, except that newlines are treated * as whitespace. */ constexpr syntax_option_type grep = 1 << _S_grep; /** * Specifies that the grammar recognized by the regular expression engine is * that used by POSIX utility grep when given the -E option in * IEEE Std 1003.1-2001. This option is identical to syntax_option_type * extended, except that newlines are treated as whitespace. */ constexpr syntax_option_type egrep = 1 << _S_egrep; //@} /** * @name 5.2 Matching Rules * * Matching a regular expression against a sequence of characters [first, * last) proceeds according to the rules of the grammar specified for the * regular expression object, modified according to the effects listed * below for any bitmask elements set. * */ //@{ enum __match_flag { _S_not_bol, _S_not_eol, _S_not_bow, _S_not_eow, _S_any, _S_not_null, _S_continuous, _S_prev_avail, _S_sed, _S_no_copy, _S_first_only, _S_match_flag_last }; /** * @brief This is a bitmask type indicating regex matching rules. * * The @c match_flag_type is implementation defined but it is valid to * perform bitwise operations on these values and expect the right thing to * happen. */ typedef std::bitset<_S_match_flag_last> match_flag_type; /** * The default matching rules. */ constexpr match_flag_type match_default = 0; /** * The first character in the sequence [first, last) is treated as though it * is not at the beginning of a line, so the character (^) in the regular * expression shall not match [first, first). */ constexpr match_flag_type match_not_bol = 1 << _S_not_bol; /** * The last character in the sequence [first, last) is treated as though it * is not at the end of a line, so the character ($) in the regular * expression shall not match [last, last). */ constexpr match_flag_type match_not_eol = 1 << _S_not_eol; /** * The expression \\b is not matched against the sub-sequence * [first,first). */ constexpr match_flag_type match_not_bow = 1 << _S_not_bow; /** * The expression \\b should not be matched against the sub-sequence * [last,last). */ constexpr match_flag_type match_not_eow = 1 << _S_not_eow; /** * If more than one match is possible then any match is an acceptable * result. */ constexpr match_flag_type match_any = 1 << _S_any; /** * The expression does not match an empty sequence. */ constexpr match_flag_type match_not_null = 1 << _S_not_null; /** * The expression only matches a sub-sequence that begins at first . */ constexpr match_flag_type match_continuous = 1 << _S_continuous; /** * --first is a valid iterator position. When this flag is set then the * flags match_not_bol and match_not_bow are ignored by the regular * expression algorithms 28.11 and iterators 28.12. */ constexpr match_flag_type match_prev_avail = 1 << _S_prev_avail; /** * When a regular expression match is to be replaced by a new string, the * new string is constructed using the rules used by the ECMAScript replace * function in ECMA- 262 [Ecma International, ECMAScript Language * Specification, Standard Ecma-262, third edition, 1999], part 15.5.4.11 * String.prototype.replace. In addition, during search and replace * operations all non-overlapping occurrences of the regular expression * are located and replaced, and sections of the input that did not match * the expression are copied unchanged to the output string. * * Format strings (from ECMA-262 [15.5.4.11]): * @li $$ The dollar-sign itself ($) * @li $& The matched substring. * @li $` The portion of @a string that precedes the matched substring. * This would be match_results::prefix(). * @li $' The portion of @a string that follows the matched substring. * This would be match_results::suffix(). * @li $n The nth capture, where n is in [1,9] and $n is not followed by a * decimal digit. If n <= match_results::size() and the nth capture * is undefined, use the empty string instead. If n > * match_results::size(), the result is implementation-defined. * @li $nn The nnth capture, where nn is a two-digit decimal number on * [01, 99]. If nn <= match_results::size() and the nth capture is * undefined, use the empty string instead. If * nn > match_results::size(), the result is implementation-defined. */ constexpr match_flag_type format_default = 0; /** * When a regular expression match is to be replaced by a new string, the * new string is constructed using the rules used by the POSIX sed utility * in IEEE Std 1003.1- 2001 [IEEE, Information Technology -- Portable * Operating System Interface (POSIX), IEEE Standard 1003.1-2001]. */ constexpr match_flag_type format_sed = 1 << _S_sed; /** * During a search and replace operation, sections of the character * container sequence being searched that do not match the regular * expression shall not be copied to the output string. */ constexpr match_flag_type format_no_copy = 1 << _S_no_copy; /** * When specified during a search and replace operation, only the first * occurrence of the regular expression shall be replaced. */ constexpr match_flag_type format_first_only = 1 << _S_first_only; //@} _GLIBCXX_END_NAMESPACE_VERSION } // namespace regex_constants /* @} */ // group regex } // namespace std ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/streambuf_iterator.h�����������������������������������������������������������������0000644�����������������00000030520�14763166030�0012606 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Streambuf iterators // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/streambuf_iterator.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{iterator} */ #ifndef _STREAMBUF_ITERATOR_H #define _STREAMBUF_ITERATOR_H 1 #pragma GCC system_header #include <streambuf> #include <debug/debug.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup iterators * @{ */ // 24.5.3 Template class istreambuf_iterator /// Provides input iterator semantics for streambufs. template<typename _CharT, typename _Traits> class istreambuf_iterator : public iterator<input_iterator_tag, _CharT, typename _Traits::off_type, _CharT*, #if __cplusplus >= 201103L // LWG 445. _CharT> #else _CharT&> #endif { public: // Types: //@{ /// Public typedefs typedef _CharT char_type; typedef _Traits traits_type; typedef typename _Traits::int_type int_type; typedef basic_streambuf<_CharT, _Traits> streambuf_type; typedef basic_istream<_CharT, _Traits> istream_type; //@} template<typename _CharT2> friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, ostreambuf_iterator<_CharT2> >::__type copy(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, ostreambuf_iterator<_CharT2>); template<bool _IsMove, typename _CharT2> friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, _CharT2*>::__type __copy_move_a2(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, _CharT2*); template<typename _CharT2> friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, istreambuf_iterator<_CharT2> >::__type find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, const _CharT2&); private: // 24.5.3 istreambuf_iterator // p 1 // If the end of stream is reached (streambuf_type::sgetc() // returns traits_type::eof()), the iterator becomes equal to // the "end of stream" iterator value. // NB: This implementation assumes the "end of stream" value // is EOF, or -1. mutable streambuf_type* _M_sbuf; mutable int_type _M_c; public: /// Construct end of input stream iterator. _GLIBCXX_CONSTEXPR istreambuf_iterator() _GLIBCXX_USE_NOEXCEPT : _M_sbuf(0), _M_c(traits_type::eof()) { } #if __cplusplus >= 201103L istreambuf_iterator(const istreambuf_iterator&) noexcept = default; ~istreambuf_iterator() = default; #endif /// Construct start of input stream iterator. istreambuf_iterator(istream_type& __s) _GLIBCXX_USE_NOEXCEPT : _M_sbuf(__s.rdbuf()), _M_c(traits_type::eof()) { } /// Construct start of streambuf iterator. istreambuf_iterator(streambuf_type* __s) _GLIBCXX_USE_NOEXCEPT : _M_sbuf(__s), _M_c(traits_type::eof()) { } /// Return the current character pointed to by iterator. This returns /// streambuf.sgetc(). It cannot be assigned. NB: The result of /// operator*() on an end of stream is undefined. char_type operator*() const { #ifdef _GLIBCXX_DEBUG_PEDANTIC // Dereferencing a past-the-end istreambuf_iterator is a // libstdc++ extension __glibcxx_requires_cond(!_M_at_eof(), _M_message(__gnu_debug::__msg_deref_istreambuf) ._M_iterator(*this)); #endif return traits_type::to_char_type(_M_get()); } /// Advance the iterator. Calls streambuf.sbumpc(). istreambuf_iterator& operator++() { __glibcxx_requires_cond(!_M_at_eof(), _M_message(__gnu_debug::__msg_inc_istreambuf) ._M_iterator(*this)); if (_M_sbuf) { _M_sbuf->sbumpc(); _M_c = traits_type::eof(); } return *this; } /// Advance the iterator. Calls streambuf.sbumpc(). istreambuf_iterator operator++(int) { __glibcxx_requires_cond(!_M_at_eof(), _M_message(__gnu_debug::__msg_inc_istreambuf) ._M_iterator(*this)); istreambuf_iterator __old = *this; if (_M_sbuf) { __old._M_c = _M_sbuf->sbumpc(); _M_c = traits_type::eof(); } return __old; } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 110 istreambuf_iterator::equal not const // NB: there is also number 111 (NAD, Future) pending on this function. /// Return true both iterators are end or both are not end. bool equal(const istreambuf_iterator& __b) const { return _M_at_eof() == __b._M_at_eof(); } private: int_type _M_get() const { const int_type __eof = traits_type::eof(); int_type __ret = __eof; if (_M_sbuf) { if (!traits_type::eq_int_type(_M_c, __eof)) __ret = _M_c; else if (!traits_type::eq_int_type((__ret = _M_sbuf->sgetc()), __eof)) _M_c = __ret; else _M_sbuf = 0; } return __ret; } bool _M_at_eof() const { const int_type __eof = traits_type::eof(); return traits_type::eq_int_type(_M_get(), __eof); } }; template<typename _CharT, typename _Traits> inline bool operator==(const istreambuf_iterator<_CharT, _Traits>& __a, const istreambuf_iterator<_CharT, _Traits>& __b) { return __a.equal(__b); } template<typename _CharT, typename _Traits> inline bool operator!=(const istreambuf_iterator<_CharT, _Traits>& __a, const istreambuf_iterator<_CharT, _Traits>& __b) { return !__a.equal(__b); } /// Provides output iterator semantics for streambufs. template<typename _CharT, typename _Traits> class ostreambuf_iterator : public iterator<output_iterator_tag, void, void, void, void> { public: // Types: //@{ /// Public typedefs typedef _CharT char_type; typedef _Traits traits_type; typedef basic_streambuf<_CharT, _Traits> streambuf_type; typedef basic_ostream<_CharT, _Traits> ostream_type; //@} template<typename _CharT2> friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, ostreambuf_iterator<_CharT2> >::__type copy(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, ostreambuf_iterator<_CharT2>); private: streambuf_type* _M_sbuf; bool _M_failed; public: /// Construct output iterator from ostream. ostreambuf_iterator(ostream_type& __s) _GLIBCXX_USE_NOEXCEPT : _M_sbuf(__s.rdbuf()), _M_failed(!_M_sbuf) { } /// Construct output iterator from streambuf. ostreambuf_iterator(streambuf_type* __s) _GLIBCXX_USE_NOEXCEPT : _M_sbuf(__s), _M_failed(!_M_sbuf) { } /// Write character to streambuf. Calls streambuf.sputc(). ostreambuf_iterator& operator=(_CharT __c) { if (!_M_failed && _Traits::eq_int_type(_M_sbuf->sputc(__c), _Traits::eof())) _M_failed = true; return *this; } /// Return *this. ostreambuf_iterator& operator*() { return *this; } /// Return *this. ostreambuf_iterator& operator++(int) { return *this; } /// Return *this. ostreambuf_iterator& operator++() { return *this; } /// Return true if previous operator=() failed. bool failed() const _GLIBCXX_USE_NOEXCEPT { return _M_failed; } ostreambuf_iterator& _M_put(const _CharT* __ws, streamsize __len) { if (__builtin_expect(!_M_failed, true) && __builtin_expect(this->_M_sbuf->sputn(__ws, __len) != __len, false)) _M_failed = true; return *this; } }; // Overloads for streambuf iterators. template<typename _CharT> typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, ostreambuf_iterator<_CharT> >::__type copy(istreambuf_iterator<_CharT> __first, istreambuf_iterator<_CharT> __last, ostreambuf_iterator<_CharT> __result) { if (__first._M_sbuf && !__last._M_sbuf && !__result._M_failed) { bool __ineof; __copy_streambufs_eof(__first._M_sbuf, __result._M_sbuf, __ineof); if (!__ineof) __result._M_failed = true; } return __result; } template<bool _IsMove, typename _CharT> typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, ostreambuf_iterator<_CharT> >::__type __copy_move_a2(_CharT* __first, _CharT* __last, ostreambuf_iterator<_CharT> __result) { const streamsize __num = __last - __first; if (__num > 0) __result._M_put(__first, __num); return __result; } template<bool _IsMove, typename _CharT> typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, ostreambuf_iterator<_CharT> >::__type __copy_move_a2(const _CharT* __first, const _CharT* __last, ostreambuf_iterator<_CharT> __result) { const streamsize __num = __last - __first; if (__num > 0) __result._M_put(__first, __num); return __result; } template<bool _IsMove, typename _CharT> typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, _CharT*>::__type __copy_move_a2(istreambuf_iterator<_CharT> __first, istreambuf_iterator<_CharT> __last, _CharT* __result) { typedef istreambuf_iterator<_CharT> __is_iterator_type; typedef typename __is_iterator_type::traits_type traits_type; typedef typename __is_iterator_type::streambuf_type streambuf_type; typedef typename traits_type::int_type int_type; if (__first._M_sbuf && !__last._M_sbuf) { streambuf_type* __sb = __first._M_sbuf; int_type __c = __sb->sgetc(); while (!traits_type::eq_int_type(__c, traits_type::eof())) { const streamsize __n = __sb->egptr() - __sb->gptr(); if (__n > 1) { traits_type::copy(__result, __sb->gptr(), __n); __sb->__safe_gbump(__n); __result += __n; __c = __sb->underflow(); } else { *__result++ = traits_type::to_char_type(__c); __c = __sb->snextc(); } } } return __result; } template<typename _CharT> typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, istreambuf_iterator<_CharT> >::__type find(istreambuf_iterator<_CharT> __first, istreambuf_iterator<_CharT> __last, const _CharT& __val) { typedef istreambuf_iterator<_CharT> __is_iterator_type; typedef typename __is_iterator_type::traits_type traits_type; typedef typename __is_iterator_type::streambuf_type streambuf_type; typedef typename traits_type::int_type int_type; if (__first._M_sbuf && !__last._M_sbuf) { const int_type __ival = traits_type::to_int_type(__val); streambuf_type* __sb = __first._M_sbuf; int_type __c = __sb->sgetc(); while (!traits_type::eq_int_type(__c, traits_type::eof()) && !traits_type::eq_int_type(__c, __ival)) { streamsize __n = __sb->egptr() - __sb->gptr(); if (__n > 1) { const _CharT* __p = traits_type::find(__sb->gptr(), __n, __val); if (__p) __n = __p - __sb->gptr(); __sb->__safe_gbump(__n); __c = __sb->sgetc(); } else __c = __sb->snextc(); } if (!traits_type::eq_int_type(__c, traits_type::eof())) __first._M_c = __c; else __first._M_sbuf = 0; } return __first; } // @} group iterators _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_uninitialized.h������������������������������������������������������������������0000644�����������������00000047721�14763166030�0012452 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Raw memory manipulators -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_uninitialized.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{memory} */ #ifndef _STL_UNINITIALIZED_H #define _STL_UNINITIALIZED_H 1 namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<bool _TrivialValueTypes> struct __uninitialized_copy { template<typename _InputIterator, typename _ForwardIterator> static _ForwardIterator __uninit_copy(_InputIterator __first, _InputIterator __last, _ForwardIterator __result) { _ForwardIterator __cur = __result; __try { for (; __first != __last; ++__first, ++__cur) std::_Construct(std::__addressof(*__cur), *__first); return __cur; } __catch(...) { std::_Destroy(__result, __cur); __throw_exception_again; } } }; template<> struct __uninitialized_copy<true> { template<typename _InputIterator, typename _ForwardIterator> static _ForwardIterator __uninit_copy(_InputIterator __first, _InputIterator __last, _ForwardIterator __result) { return std::copy(__first, __last, __result); } }; /** * @brief Copies the range [first,last) into result. * @param __first An input iterator. * @param __last An input iterator. * @param __result An output iterator. * @return __result + (__first - __last) * * Like copy(), but does not require an initialized output range. */ template<typename _InputIterator, typename _ForwardIterator> inline _ForwardIterator uninitialized_copy(_InputIterator __first, _InputIterator __last, _ForwardIterator __result) { typedef typename iterator_traits<_InputIterator>::value_type _ValueType1; typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType2; return std::__uninitialized_copy<(__is_trivial(_ValueType1) && __is_trivial(_ValueType2))>:: __uninit_copy(__first, __last, __result); } template<bool _TrivialValueType> struct __uninitialized_fill { template<typename _ForwardIterator, typename _Tp> static void __uninit_fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __x) { _ForwardIterator __cur = __first; __try { for (; __cur != __last; ++__cur) std::_Construct(std::__addressof(*__cur), __x); } __catch(...) { std::_Destroy(__first, __cur); __throw_exception_again; } } }; template<> struct __uninitialized_fill<true> { template<typename _ForwardIterator, typename _Tp> static void __uninit_fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __x) { std::fill(__first, __last, __x); } }; /** * @brief Copies the value x into the range [first,last). * @param __first An input iterator. * @param __last An input iterator. * @param __x The source value. * @return Nothing. * * Like fill(), but does not require an initialized output range. */ template<typename _ForwardIterator, typename _Tp> inline void uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __x) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; std::__uninitialized_fill<__is_trivial(_ValueType)>:: __uninit_fill(__first, __last, __x); } template<bool _TrivialValueType> struct __uninitialized_fill_n { template<typename _ForwardIterator, typename _Size, typename _Tp> static void __uninit_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) { _ForwardIterator __cur = __first; __try { for (; __n > 0; --__n, ++__cur) std::_Construct(std::__addressof(*__cur), __x); } __catch(...) { std::_Destroy(__first, __cur); __throw_exception_again; } } }; template<> struct __uninitialized_fill_n<true> { template<typename _ForwardIterator, typename _Size, typename _Tp> static void __uninit_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) { std::fill_n(__first, __n, __x); } }; /** * @brief Copies the value x into the range [first,first+n). * @param __first An input iterator. * @param __n The number of copies to make. * @param __x The source value. * @return Nothing. * * Like fill_n(), but does not require an initialized output range. */ template<typename _ForwardIterator, typename _Size, typename _Tp> inline void uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; std::__uninitialized_fill_n<__is_trivial(_ValueType)>:: __uninit_fill_n(__first, __n, __x); } // Extensions: versions of uninitialized_copy, uninitialized_fill, // and uninitialized_fill_n that take an allocator parameter. // We dispatch back to the standard versions when we're given the // default allocator. For nondefault allocators we do not use // any of the POD optimizations. template<typename _InputIterator, typename _ForwardIterator, typename _Allocator> _ForwardIterator __uninitialized_copy_a(_InputIterator __first, _InputIterator __last, _ForwardIterator __result, _Allocator& __alloc) { _ForwardIterator __cur = __result; __try { typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; for (; __first != __last; ++__first, ++__cur) __traits::construct(__alloc, std::__addressof(*__cur), *__first); return __cur; } __catch(...) { std::_Destroy(__result, __cur, __alloc); __throw_exception_again; } } template<typename _InputIterator, typename _ForwardIterator, typename _Tp> inline _ForwardIterator __uninitialized_copy_a(_InputIterator __first, _InputIterator __last, _ForwardIterator __result, allocator<_Tp>&) { return std::uninitialized_copy(__first, __last, __result); } template<typename _InputIterator, typename _ForwardIterator, typename _Allocator> inline _ForwardIterator __uninitialized_move_a(_InputIterator __first, _InputIterator __last, _ForwardIterator __result, _Allocator& __alloc) { return std::__uninitialized_copy_a(_GLIBCXX_MAKE_MOVE_ITERATOR(__first), _GLIBCXX_MAKE_MOVE_ITERATOR(__last), __result, __alloc); } template<typename _InputIterator, typename _ForwardIterator, typename _Allocator> inline _ForwardIterator __uninitialized_move_if_noexcept_a(_InputIterator __first, _InputIterator __last, _ForwardIterator __result, _Allocator& __alloc) { return std::__uninitialized_copy_a (_GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__first), _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__last), __result, __alloc); } template<typename _ForwardIterator, typename _Tp, typename _Allocator> void __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __x, _Allocator& __alloc) { _ForwardIterator __cur = __first; __try { typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; for (; __cur != __last; ++__cur) __traits::construct(__alloc, std::__addressof(*__cur), __x); } __catch(...) { std::_Destroy(__first, __cur, __alloc); __throw_exception_again; } } template<typename _ForwardIterator, typename _Tp, typename _Tp2> inline void __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __x, allocator<_Tp2>&) { std::uninitialized_fill(__first, __last, __x); } template<typename _ForwardIterator, typename _Size, typename _Tp, typename _Allocator> void __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, const _Tp& __x, _Allocator& __alloc) { _ForwardIterator __cur = __first; __try { typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; for (; __n > 0; --__n, ++__cur) __traits::construct(__alloc, std::__addressof(*__cur), __x); } __catch(...) { std::_Destroy(__first, __cur, __alloc); __throw_exception_again; } } template<typename _ForwardIterator, typename _Size, typename _Tp, typename _Tp2> inline void __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, const _Tp& __x, allocator<_Tp2>&) { std::uninitialized_fill_n(__first, __n, __x); } // Extensions: __uninitialized_copy_move, __uninitialized_move_copy, // __uninitialized_fill_move, __uninitialized_move_fill. // All of these algorithms take a user-supplied allocator, which is used // for construction and destruction. // __uninitialized_copy_move // Copies [first1, last1) into [result, result + (last1 - first1)), and // move [first2, last2) into // [result, result + (last1 - first1) + (last2 - first2)). template<typename _InputIterator1, typename _InputIterator2, typename _ForwardIterator, typename _Allocator> inline _ForwardIterator __uninitialized_copy_move(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _ForwardIterator __result, _Allocator& __alloc) { _ForwardIterator __mid = std::__uninitialized_copy_a(__first1, __last1, __result, __alloc); __try { return std::__uninitialized_move_a(__first2, __last2, __mid, __alloc); } __catch(...) { std::_Destroy(__result, __mid, __alloc); __throw_exception_again; } } // __uninitialized_move_copy // Moves [first1, last1) into [result, result + (last1 - first1)), and // copies [first2, last2) into // [result, result + (last1 - first1) + (last2 - first2)). template<typename _InputIterator1, typename _InputIterator2, typename _ForwardIterator, typename _Allocator> inline _ForwardIterator __uninitialized_move_copy(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _ForwardIterator __result, _Allocator& __alloc) { _ForwardIterator __mid = std::__uninitialized_move_a(__first1, __last1, __result, __alloc); __try { return std::__uninitialized_copy_a(__first2, __last2, __mid, __alloc); } __catch(...) { std::_Destroy(__result, __mid, __alloc); __throw_exception_again; } } // __uninitialized_fill_move // Fills [result, mid) with x, and moves [first, last) into // [mid, mid + (last - first)). template<typename _ForwardIterator, typename _Tp, typename _InputIterator, typename _Allocator> inline _ForwardIterator __uninitialized_fill_move(_ForwardIterator __result, _ForwardIterator __mid, const _Tp& __x, _InputIterator __first, _InputIterator __last, _Allocator& __alloc) { std::__uninitialized_fill_a(__result, __mid, __x, __alloc); __try { return std::__uninitialized_move_a(__first, __last, __mid, __alloc); } __catch(...) { std::_Destroy(__result, __mid, __alloc); __throw_exception_again; } } // __uninitialized_move_fill // Moves [first1, last1) into [first2, first2 + (last1 - first1)), and // fills [first2 + (last1 - first1), last2) with x. template<typename _InputIterator, typename _ForwardIterator, typename _Tp, typename _Allocator> inline void __uninitialized_move_fill(_InputIterator __first1, _InputIterator __last1, _ForwardIterator __first2, _ForwardIterator __last2, const _Tp& __x, _Allocator& __alloc) { _ForwardIterator __mid2 = std::__uninitialized_move_a(__first1, __last1, __first2, __alloc); __try { std::__uninitialized_fill_a(__mid2, __last2, __x, __alloc); } __catch(...) { std::_Destroy(__first2, __mid2, __alloc); __throw_exception_again; } } #if __cplusplus >= 201103L // Extensions: __uninitialized_default, __uninitialized_default_n, // __uninitialized_default_a, __uninitialized_default_n_a. template<bool _TrivialValueType> struct __uninitialized_default_1 { template<typename _ForwardIterator> static void __uninit_default(_ForwardIterator __first, _ForwardIterator __last) { _ForwardIterator __cur = __first; __try { for (; __cur != __last; ++__cur) std::_Construct(std::__addressof(*__cur)); } __catch(...) { std::_Destroy(__first, __cur); __throw_exception_again; } } }; template<> struct __uninitialized_default_1<true> { template<typename _ForwardIterator> static void __uninit_default(_ForwardIterator __first, _ForwardIterator __last) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; std::fill(__first, __last, _ValueType()); } }; template<bool _TrivialValueType> struct __uninitialized_default_n_1 { template<typename _ForwardIterator, typename _Size> static void __uninit_default_n(_ForwardIterator __first, _Size __n) { _ForwardIterator __cur = __first; __try { for (; __n > 0; --__n, ++__cur) std::_Construct(std::__addressof(*__cur)); } __catch(...) { std::_Destroy(__first, __cur); __throw_exception_again; } } }; template<> struct __uninitialized_default_n_1<true> { template<typename _ForwardIterator, typename _Size> static void __uninit_default_n(_ForwardIterator __first, _Size __n) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; std::fill_n(__first, __n, _ValueType()); } }; // __uninitialized_default // Fills [first, last) with std::distance(first, last) default // constructed value_types(s). template<typename _ForwardIterator> inline void __uninitialized_default(_ForwardIterator __first, _ForwardIterator __last) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; std::__uninitialized_default_1<__is_trivial(_ValueType)>:: __uninit_default(__first, __last); } // __uninitialized_default_n // Fills [first, first + n) with n default constructed value_type(s). template<typename _ForwardIterator, typename _Size> inline void __uninitialized_default_n(_ForwardIterator __first, _Size __n) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; std::__uninitialized_default_n_1<__is_trivial(_ValueType)>:: __uninit_default_n(__first, __n); } // __uninitialized_default_a // Fills [first, last) with std::distance(first, last) default // constructed value_types(s), constructed with the allocator alloc. template<typename _ForwardIterator, typename _Allocator> void __uninitialized_default_a(_ForwardIterator __first, _ForwardIterator __last, _Allocator& __alloc) { _ForwardIterator __cur = __first; __try { typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; for (; __cur != __last; ++__cur) __traits::construct(__alloc, std::__addressof(*__cur)); } __catch(...) { std::_Destroy(__first, __cur, __alloc); __throw_exception_again; } } template<typename _ForwardIterator, typename _Tp> inline void __uninitialized_default_a(_ForwardIterator __first, _ForwardIterator __last, allocator<_Tp>&) { std::__uninitialized_default(__first, __last); } // __uninitialized_default_n_a // Fills [first, first + n) with n default constructed value_types(s), // constructed with the allocator alloc. template<typename _ForwardIterator, typename _Size, typename _Allocator> void __uninitialized_default_n_a(_ForwardIterator __first, _Size __n, _Allocator& __alloc) { _ForwardIterator __cur = __first; __try { typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; for (; __n > 0; --__n, ++__cur) __traits::construct(__alloc, std::__addressof(*__cur)); } __catch(...) { std::_Destroy(__first, __cur, __alloc); __throw_exception_again; } } template<typename _ForwardIterator, typename _Size, typename _Tp> inline void __uninitialized_default_n_a(_ForwardIterator __first, _Size __n, allocator<_Tp>&) { std::__uninitialized_default_n(__first, __n); } template<typename _InputIterator, typename _Size, typename _ForwardIterator> _ForwardIterator __uninitialized_copy_n(_InputIterator __first, _Size __n, _ForwardIterator __result, input_iterator_tag) { _ForwardIterator __cur = __result; __try { for (; __n > 0; --__n, ++__first, ++__cur) std::_Construct(std::__addressof(*__cur), *__first); return __cur; } __catch(...) { std::_Destroy(__result, __cur); __throw_exception_again; } } template<typename _RandomAccessIterator, typename _Size, typename _ForwardIterator> inline _ForwardIterator __uninitialized_copy_n(_RandomAccessIterator __first, _Size __n, _ForwardIterator __result, random_access_iterator_tag) { return std::uninitialized_copy(__first, __first + __n, __result); } /** * @brief Copies the range [first,first+n) into result. * @param __first An input iterator. * @param __n The number of elements to copy. * @param __result An output iterator. * @return __result + __n * * Like copy_n(), but does not require an initialized output range. */ template<typename _InputIterator, typename _Size, typename _ForwardIterator> inline _ForwardIterator uninitialized_copy_n(_InputIterator __first, _Size __n, _ForwardIterator __result) { return std::__uninitialized_copy_n(__first, __n, __result, std::__iterator_category(__first)); } #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _STL_UNINITIALIZED_H */ �����������������������������������������������c++/4.8.2/bits/forward_list.h�����������������������������������������������������������������������0000644�����������������00000135342�14763166030�0011414 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <forward_list.h> -*- C++ -*- // Copyright (C) 2008-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/forward_list.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{forward_list} */ #ifndef _FORWARD_LIST_H #define _FORWARD_LIST_H 1 #pragma GCC system_header #include <memory> #if __cplusplus >= 201103L #include <initializer_list> #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /** * @brief A helper basic node class for %forward_list. * This is just a linked list with nothing inside it. * There are purely list shuffling utility methods here. */ struct _Fwd_list_node_base { _Fwd_list_node_base() = default; _Fwd_list_node_base* _M_next = nullptr; _Fwd_list_node_base* _M_transfer_after(_Fwd_list_node_base* __begin, _Fwd_list_node_base* __end) { _Fwd_list_node_base* __keep = __begin->_M_next; if (__end) { __begin->_M_next = __end->_M_next; __end->_M_next = _M_next; } else __begin->_M_next = 0; _M_next = __keep; return __end; } void _M_reverse_after() noexcept { _Fwd_list_node_base* __tail = _M_next; if (!__tail) return; while (_Fwd_list_node_base* __temp = __tail->_M_next) { _Fwd_list_node_base* __keep = _M_next; _M_next = __temp; __tail->_M_next = __temp->_M_next; _M_next->_M_next = __keep; } } }; /** * @brief A helper node class for %forward_list. * This is just a linked list with uninitialized storage for a * data value in each node. * There is a sorting utility method. */ template<typename _Tp> struct _Fwd_list_node : public _Fwd_list_node_base { _Fwd_list_node() = default; typename aligned_storage<sizeof(_Tp), alignment_of<_Tp>::value>::type _M_storage; _Tp* _M_valptr() noexcept { return static_cast<_Tp*>(static_cast<void*>(&_M_storage)); } const _Tp* _M_valptr() const noexcept { return static_cast<const _Tp*>(static_cast<const void*>(&_M_storage)); } }; /** * @brief A forward_list::iterator. * * All the functions are op overloads. */ template<typename _Tp> struct _Fwd_list_iterator { typedef _Fwd_list_iterator<_Tp> _Self; typedef _Fwd_list_node<_Tp> _Node; typedef _Tp value_type; typedef _Tp* pointer; typedef _Tp& reference; typedef ptrdiff_t difference_type; typedef std::forward_iterator_tag iterator_category; _Fwd_list_iterator() : _M_node() { } explicit _Fwd_list_iterator(_Fwd_list_node_base* __n) : _M_node(__n) { } reference operator*() const { return *static_cast<_Node*>(this->_M_node)->_M_valptr(); } pointer operator->() const { return static_cast<_Node*>(this->_M_node)->_M_valptr(); } _Self& operator++() { _M_node = _M_node->_M_next; return *this; } _Self operator++(int) { _Self __tmp(*this); _M_node = _M_node->_M_next; return __tmp; } bool operator==(const _Self& __x) const { return _M_node == __x._M_node; } bool operator!=(const _Self& __x) const { return _M_node != __x._M_node; } _Self _M_next() const { if (_M_node) return _Fwd_list_iterator(_M_node->_M_next); else return _Fwd_list_iterator(0); } _Fwd_list_node_base* _M_node; }; /** * @brief A forward_list::const_iterator. * * All the functions are op overloads. */ template<typename _Tp> struct _Fwd_list_const_iterator { typedef _Fwd_list_const_iterator<_Tp> _Self; typedef const _Fwd_list_node<_Tp> _Node; typedef _Fwd_list_iterator<_Tp> iterator; typedef _Tp value_type; typedef const _Tp* pointer; typedef const _Tp& reference; typedef ptrdiff_t difference_type; typedef std::forward_iterator_tag iterator_category; _Fwd_list_const_iterator() : _M_node() { } explicit _Fwd_list_const_iterator(const _Fwd_list_node_base* __n) : _M_node(__n) { } _Fwd_list_const_iterator(const iterator& __iter) : _M_node(__iter._M_node) { } reference operator*() const { return *static_cast<_Node*>(this->_M_node)->_M_valptr(); } pointer operator->() const { return static_cast<_Node*>(this->_M_node)->_M_valptr(); } _Self& operator++() { _M_node = _M_node->_M_next; return *this; } _Self operator++(int) { _Self __tmp(*this); _M_node = _M_node->_M_next; return __tmp; } bool operator==(const _Self& __x) const { return _M_node == __x._M_node; } bool operator!=(const _Self& __x) const { return _M_node != __x._M_node; } _Self _M_next() const { if (this->_M_node) return _Fwd_list_const_iterator(_M_node->_M_next); else return _Fwd_list_const_iterator(0); } const _Fwd_list_node_base* _M_node; }; /** * @brief Forward list iterator equality comparison. */ template<typename _Tp> inline bool operator==(const _Fwd_list_iterator<_Tp>& __x, const _Fwd_list_const_iterator<_Tp>& __y) { return __x._M_node == __y._M_node; } /** * @brief Forward list iterator inequality comparison. */ template<typename _Tp> inline bool operator!=(const _Fwd_list_iterator<_Tp>& __x, const _Fwd_list_const_iterator<_Tp>& __y) { return __x._M_node != __y._M_node; } /** * @brief Base class for %forward_list. */ template<typename _Tp, typename _Alloc> struct _Fwd_list_base { protected: typedef typename __gnu_cxx::__alloc_traits<_Alloc> _Alloc_traits; typedef typename _Alloc_traits::template rebind<_Tp>::other _Tp_alloc_type; typedef typename _Alloc_traits::template rebind<_Fwd_list_node<_Tp>>::other _Node_alloc_type; typedef __gnu_cxx::__alloc_traits<_Node_alloc_type> _Node_alloc_traits; struct _Fwd_list_impl : public _Node_alloc_type { _Fwd_list_node_base _M_head; _Fwd_list_impl() : _Node_alloc_type(), _M_head() { } _Fwd_list_impl(const _Node_alloc_type& __a) : _Node_alloc_type(__a), _M_head() { } _Fwd_list_impl(_Node_alloc_type&& __a) : _Node_alloc_type(std::move(__a)), _M_head() { } }; _Fwd_list_impl _M_impl; public: typedef _Fwd_list_iterator<_Tp> iterator; typedef _Fwd_list_const_iterator<_Tp> const_iterator; typedef _Fwd_list_node<_Tp> _Node; _Node_alloc_type& _M_get_Node_allocator() noexcept { return *static_cast<_Node_alloc_type*>(&this->_M_impl); } const _Node_alloc_type& _M_get_Node_allocator() const noexcept { return *static_cast<const _Node_alloc_type*>(&this->_M_impl); } _Fwd_list_base() : _M_impl() { } _Fwd_list_base(const _Node_alloc_type& __a) : _M_impl(__a) { } _Fwd_list_base(_Fwd_list_base&& __lst, const _Node_alloc_type& __a); _Fwd_list_base(_Fwd_list_base&& __lst) : _M_impl(std::move(__lst._M_get_Node_allocator())) { this->_M_impl._M_head._M_next = __lst._M_impl._M_head._M_next; __lst._M_impl._M_head._M_next = 0; } ~_Fwd_list_base() { _M_erase_after(&_M_impl._M_head, 0); } protected: _Node* _M_get_node() { return _Node_alloc_traits::allocate(_M_get_Node_allocator(), 1); } template<typename... _Args> _Node* _M_create_node(_Args&&... __args) { _Node* __node = this->_M_get_node(); __try { _Tp_alloc_type __a(_M_get_Node_allocator()); typedef allocator_traits<_Tp_alloc_type> _Alloc_traits; ::new ((void*)__node) _Node(); _Alloc_traits::construct(__a, __node->_M_valptr(), std::forward<_Args>(__args)...); } __catch(...) { this->_M_put_node(__node); __throw_exception_again; } return __node; } template<typename... _Args> _Fwd_list_node_base* _M_insert_after(const_iterator __pos, _Args&&... __args); void _M_put_node(_Node* __p) { _Node_alloc_traits::deallocate(_M_get_Node_allocator(), __p, 1); } _Fwd_list_node_base* _M_erase_after(_Fwd_list_node_base* __pos); _Fwd_list_node_base* _M_erase_after(_Fwd_list_node_base* __pos, _Fwd_list_node_base* __last); }; /** * @brief A standard container with linear time access to elements, * and fixed time insertion/deletion at any point in the sequence. * * @ingroup sequences * * @tparam _Tp Type of element. * @tparam _Alloc Allocator type, defaults to allocator<_Tp>. * * Meets the requirements of a <a href="tables.html#65">container</a>, a * <a href="tables.html#67">sequence</a>, including the * <a href="tables.html#68">optional sequence requirements</a> with the * %exception of @c at and @c operator[]. * * This is a @e singly @e linked %list. Traversal up the * %list requires linear time, but adding and removing elements (or * @e nodes) is done in constant time, regardless of where the * change takes place. Unlike std::vector and std::deque, * random-access iterators are not provided, so subscripting ( @c * [] ) access is not allowed. For algorithms which only need * sequential access, this lack makes no difference. * * Also unlike the other standard containers, std::forward_list provides * specialized algorithms %unique to linked lists, such as * splicing, sorting, and in-place reversal. */ template<typename _Tp, typename _Alloc = allocator<_Tp> > class forward_list : private _Fwd_list_base<_Tp, _Alloc> { private: typedef _Fwd_list_base<_Tp, _Alloc> _Base; typedef _Fwd_list_node<_Tp> _Node; typedef _Fwd_list_node_base _Node_base; typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; typedef typename _Base::_Node_alloc_type _Node_alloc_type; typedef typename _Base::_Node_alloc_traits _Node_alloc_traits; typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Alloc_traits; public: // types: typedef _Tp value_type; typedef typename _Alloc_traits::pointer pointer; typedef typename _Alloc_traits::const_pointer const_pointer; typedef typename _Alloc_traits::reference reference; typedef typename _Alloc_traits::const_reference const_reference; typedef _Fwd_list_iterator<_Tp> iterator; typedef _Fwd_list_const_iterator<_Tp> const_iterator; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; typedef _Alloc allocator_type; // 23.3.4.2 construct/copy/destroy: /** * @brief Creates a %forward_list with no elements. * @param __al An allocator object. */ explicit forward_list(const _Alloc& __al = _Alloc()) : _Base(_Node_alloc_type(__al)) { } /** * @brief Copy constructor with allocator argument. * @param __list Input list to copy. * @param __al An allocator object. */ forward_list(const forward_list& __list, const _Alloc& __al) : _Base(_Node_alloc_type(__al)) { _M_range_initialize(__list.begin(), __list.end()); } /** * @brief Move constructor with allocator argument. * @param __list Input list to move. * @param __al An allocator object. */ forward_list(forward_list&& __list, const _Alloc& __al) noexcept(_Node_alloc_traits::_S_always_equal()) : _Base(std::move(__list), _Node_alloc_type(__al)) { } /** * @brief Creates a %forward_list with default constructed elements. * @param __n The number of elements to initially create. * * This constructor creates the %forward_list with @a __n default * constructed elements. */ explicit forward_list(size_type __n, const _Alloc& __al = _Alloc()) : _Base(_Node_alloc_type(__al)) { _M_default_initialize(__n); } /** * @brief Creates a %forward_list with copies of an exemplar element. * @param __n The number of elements to initially create. * @param __value An element to copy. * @param __al An allocator object. * * This constructor fills the %forward_list with @a __n copies of * @a __value. */ forward_list(size_type __n, const _Tp& __value, const _Alloc& __al = _Alloc()) : _Base(_Node_alloc_type(__al)) { _M_fill_initialize(__n, __value); } /** * @brief Builds a %forward_list from a range. * @param __first An input iterator. * @param __last An input iterator. * @param __al An allocator object. * * Create a %forward_list consisting of copies of the elements from * [@a __first,@a __last). This is linear in N (where N is * distance(@a __first,@a __last)). */ template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> forward_list(_InputIterator __first, _InputIterator __last, const _Alloc& __al = _Alloc()) : _Base(_Node_alloc_type(__al)) { _M_range_initialize(__first, __last); } /** * @brief The %forward_list copy constructor. * @param __list A %forward_list of identical element and allocator * types. */ forward_list(const forward_list& __list) : _Base(_Node_alloc_traits::_S_select_on_copy( __list._M_get_Node_allocator())) { _M_range_initialize(__list.begin(), __list.end()); } /** * @brief The %forward_list move constructor. * @param __list A %forward_list of identical element and allocator * types. * * The newly-created %forward_list contains the exact contents of @a * __list. The contents of @a __list are a valid, but unspecified * %forward_list. */ forward_list(forward_list&& __list) noexcept : _Base(std::move(__list)) { } /** * @brief Builds a %forward_list from an initializer_list * @param __il An initializer_list of value_type. * @param __al An allocator object. * * Create a %forward_list consisting of copies of the elements * in the initializer_list @a __il. This is linear in __il.size(). */ forward_list(std::initializer_list<_Tp> __il, const _Alloc& __al = _Alloc()) : _Base(_Node_alloc_type(__al)) { _M_range_initialize(__il.begin(), __il.end()); } /** * @brief The forward_list dtor. */ ~forward_list() noexcept { } /** * @brief The %forward_list assignment operator. * @param __list A %forward_list of identical element and allocator * types. * * All the elements of @a __list are copied, but unlike the copy * constructor, the allocator object is not copied. */ forward_list& operator=(const forward_list& __list); /** * @brief The %forward_list move assignment operator. * @param __list A %forward_list of identical element and allocator * types. * * The contents of @a __list are moved into this %forward_list * (without copying, if the allocators permit it). * @a __list is a valid, but unspecified %forward_list */ forward_list& operator=(forward_list&& __list) noexcept(_Node_alloc_traits::_S_nothrow_move()) { constexpr bool __move_storage = _Node_alloc_traits::_S_propagate_on_move_assign() || _Node_alloc_traits::_S_always_equal(); _M_move_assign(std::move(__list), integral_constant<bool, __move_storage>()); return *this; } /** * @brief The %forward_list initializer list assignment operator. * @param __il An initializer_list of value_type. * * Replace the contents of the %forward_list with copies of the * elements in the initializer_list @a __il. This is linear in * __il.size(). */ forward_list& operator=(std::initializer_list<_Tp> __il) { assign(__il); return *this; } /** * @brief Assigns a range to a %forward_list. * @param __first An input iterator. * @param __last An input iterator. * * This function fills a %forward_list with copies of the elements * in the range [@a __first,@a __last). * * Note that the assignment completely changes the %forward_list and * that the number of elements of the resulting %forward_list is the * same as the number of elements assigned. Old data is lost. */ template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> void assign(_InputIterator __first, _InputIterator __last) { typedef is_assignable<_Tp, decltype(*__first)> __assignable; _M_assign(__first, __last, __assignable()); } /** * @brief Assigns a given value to a %forward_list. * @param __n Number of elements to be assigned. * @param __val Value to be assigned. * * This function fills a %forward_list with @a __n copies of the * given value. Note that the assignment completely changes the * %forward_list, and that the resulting %forward_list has __n * elements. Old data is lost. */ void assign(size_type __n, const _Tp& __val) { _M_assign_n(__n, __val, is_copy_assignable<_Tp>()); } /** * @brief Assigns an initializer_list to a %forward_list. * @param __il An initializer_list of value_type. * * Replace the contents of the %forward_list with copies of the * elements in the initializer_list @a __il. This is linear in * il.size(). */ void assign(std::initializer_list<_Tp> __il) { assign(__il.begin(), __il.end()); } /// Get a copy of the memory allocation object. allocator_type get_allocator() const noexcept { return allocator_type(this->_M_get_Node_allocator()); } // 23.3.4.3 iterators: /** * Returns a read/write iterator that points before the first element * in the %forward_list. Iteration is done in ordinary element order. */ iterator before_begin() noexcept { return iterator(&this->_M_impl._M_head); } /** * Returns a read-only (constant) iterator that points before the * first element in the %forward_list. Iteration is done in ordinary * element order. */ const_iterator before_begin() const noexcept { return const_iterator(&this->_M_impl._M_head); } /** * Returns a read/write iterator that points to the first element * in the %forward_list. Iteration is done in ordinary element order. */ iterator begin() noexcept { return iterator(this->_M_impl._M_head._M_next); } /** * Returns a read-only (constant) iterator that points to the first * element in the %forward_list. Iteration is done in ordinary * element order. */ const_iterator begin() const noexcept { return const_iterator(this->_M_impl._M_head._M_next); } /** * Returns a read/write iterator that points one past the last * element in the %forward_list. Iteration is done in ordinary * element order. */ iterator end() noexcept { return iterator(0); } /** * Returns a read-only iterator that points one past the last * element in the %forward_list. Iteration is done in ordinary * element order. */ const_iterator end() const noexcept { return const_iterator(0); } /** * Returns a read-only (constant) iterator that points to the * first element in the %forward_list. Iteration is done in ordinary * element order. */ const_iterator cbegin() const noexcept { return const_iterator(this->_M_impl._M_head._M_next); } /** * Returns a read-only (constant) iterator that points before the * first element in the %forward_list. Iteration is done in ordinary * element order. */ const_iterator cbefore_begin() const noexcept { return const_iterator(&this->_M_impl._M_head); } /** * Returns a read-only (constant) iterator that points one past * the last element in the %forward_list. Iteration is done in * ordinary element order. */ const_iterator cend() const noexcept { return const_iterator(0); } /** * Returns true if the %forward_list is empty. (Thus begin() would * equal end().) */ bool empty() const noexcept { return this->_M_impl._M_head._M_next == 0; } /** * Returns the largest possible number of elements of %forward_list. */ size_type max_size() const noexcept { return _Node_alloc_traits::max_size(this->_M_get_Node_allocator()); } // 23.3.4.4 element access: /** * Returns a read/write reference to the data at the first * element of the %forward_list. */ reference front() { _Node* __front = static_cast<_Node*>(this->_M_impl._M_head._M_next); return *__front->_M_valptr(); } /** * Returns a read-only (constant) reference to the data at the first * element of the %forward_list. */ const_reference front() const { _Node* __front = static_cast<_Node*>(this->_M_impl._M_head._M_next); return *__front->_M_valptr(); } // 23.3.4.5 modifiers: /** * @brief Constructs object in %forward_list at the front of the * list. * @param __args Arguments. * * This function will insert an object of type Tp constructed * with Tp(std::forward<Args>(args)...) at the front of the list * Due to the nature of a %forward_list this operation can * be done in constant time, and does not invalidate iterators * and references. */ template<typename... _Args> void emplace_front(_Args&&... __args) { this->_M_insert_after(cbefore_begin(), std::forward<_Args>(__args)...); } /** * @brief Add data to the front of the %forward_list. * @param __val Data to be added. * * This is a typical stack operation. The function creates an * element at the front of the %forward_list and assigns the given * data to it. Due to the nature of a %forward_list this operation * can be done in constant time, and does not invalidate iterators * and references. */ void push_front(const _Tp& __val) { this->_M_insert_after(cbefore_begin(), __val); } /** * */ void push_front(_Tp&& __val) { this->_M_insert_after(cbefore_begin(), std::move(__val)); } /** * @brief Removes first element. * * This is a typical stack operation. It shrinks the %forward_list * by one. Due to the nature of a %forward_list this operation can * be done in constant time, and only invalidates iterators/references * to the element being removed. * * Note that no data is returned, and if the first element's data * is needed, it should be retrieved before pop_front() is * called. */ void pop_front() { this->_M_erase_after(&this->_M_impl._M_head); } /** * @brief Constructs object in %forward_list after the specified * iterator. * @param __pos A const_iterator into the %forward_list. * @param __args Arguments. * @return An iterator that points to the inserted data. * * This function will insert an object of type T constructed * with T(std::forward<Args>(args)...) after the specified * location. Due to the nature of a %forward_list this operation can * be done in constant time, and does not invalidate iterators * and references. */ template<typename... _Args> iterator emplace_after(const_iterator __pos, _Args&&... __args) { return iterator(this->_M_insert_after(__pos, std::forward<_Args>(__args)...)); } /** * @brief Inserts given value into %forward_list after specified * iterator. * @param __pos An iterator into the %forward_list. * @param __val Data to be inserted. * @return An iterator that points to the inserted data. * * This function will insert a copy of the given value after * the specified location. Due to the nature of a %forward_list this * operation can be done in constant time, and does not * invalidate iterators and references. */ iterator insert_after(const_iterator __pos, const _Tp& __val) { return iterator(this->_M_insert_after(__pos, __val)); } /** * */ iterator insert_after(const_iterator __pos, _Tp&& __val) { return iterator(this->_M_insert_after(__pos, std::move(__val))); } /** * @brief Inserts a number of copies of given data into the * %forward_list. * @param __pos An iterator into the %forward_list. * @param __n Number of elements to be inserted. * @param __val Data to be inserted. * @return An iterator pointing to the last inserted copy of * @a val or @a pos if @a n == 0. * * This function will insert a specified number of copies of the * given data after the location specified by @a pos. * * This operation is linear in the number of elements inserted and * does not invalidate iterators and references. */ iterator insert_after(const_iterator __pos, size_type __n, const _Tp& __val); /** * @brief Inserts a range into the %forward_list. * @param __pos An iterator into the %forward_list. * @param __first An input iterator. * @param __last An input iterator. * @return An iterator pointing to the last inserted element or * @a __pos if @a __first == @a __last. * * This function will insert copies of the data in the range * [@a __first,@a __last) into the %forward_list after the * location specified by @a __pos. * * This operation is linear in the number of elements inserted and * does not invalidate iterators and references. */ template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> iterator insert_after(const_iterator __pos, _InputIterator __first, _InputIterator __last); /** * @brief Inserts the contents of an initializer_list into * %forward_list after the specified iterator. * @param __pos An iterator into the %forward_list. * @param __il An initializer_list of value_type. * @return An iterator pointing to the last inserted element * or @a __pos if @a __il is empty. * * This function will insert copies of the data in the * initializer_list @a __il into the %forward_list before the location * specified by @a __pos. * * This operation is linear in the number of elements inserted and * does not invalidate iterators and references. */ iterator insert_after(const_iterator __pos, std::initializer_list<_Tp> __il) { return insert_after(__pos, __il.begin(), __il.end()); } /** * @brief Removes the element pointed to by the iterator following * @c pos. * @param __pos Iterator pointing before element to be erased. * @return An iterator pointing to the element following the one * that was erased, or end() if no such element exists. * * This function will erase the element at the given position and * thus shorten the %forward_list by one. * * Due to the nature of a %forward_list this operation can be done * in constant time, and only invalidates iterators/references to * the element being removed. The user is also cautioned that * this function only erases the element, and that if the element * is itself a pointer, the pointed-to memory is not touched in * any way. Managing the pointer is the user's responsibility. */ iterator erase_after(const_iterator __pos) { return iterator(this->_M_erase_after(const_cast<_Node_base*> (__pos._M_node))); } /** * @brief Remove a range of elements. * @param __pos Iterator pointing before the first element to be * erased. * @param __last Iterator pointing to one past the last element to be * erased. * @return @ __last. * * This function will erase the elements in the range * @a (__pos,__last) and shorten the %forward_list accordingly. * * This operation is linear time in the size of the range and only * invalidates iterators/references to the element being removed. * The user is also cautioned that this function only erases the * elements, and that if the elements themselves are pointers, the * pointed-to memory is not touched in any way. Managing the pointer * is the user's responsibility. */ iterator erase_after(const_iterator __pos, const_iterator __last) { return iterator(this->_M_erase_after(const_cast<_Node_base*> (__pos._M_node), const_cast<_Node_base*> (__last._M_node))); } /** * @brief Swaps data with another %forward_list. * @param __list A %forward_list of the same element and allocator * types. * * This exchanges the elements between two lists in constant * time. Note that the global std::swap() function is * specialized such that std::swap(l1,l2) will feed to this * function. */ void swap(forward_list& __list) noexcept(_Node_alloc_traits::_S_nothrow_swap()) { std::swap(this->_M_impl._M_head._M_next, __list._M_impl._M_head._M_next); _Node_alloc_traits::_S_on_swap(this->_M_get_Node_allocator(), __list._M_get_Node_allocator()); } /** * @brief Resizes the %forward_list to the specified number of * elements. * @param __sz Number of elements the %forward_list should contain. * * This function will %resize the %forward_list to the specified * number of elements. If the number is smaller than the * %forward_list's current number of elements the %forward_list * is truncated, otherwise the %forward_list is extended and the * new elements are default constructed. */ void resize(size_type __sz); /** * @brief Resizes the %forward_list to the specified number of * elements. * @param __sz Number of elements the %forward_list should contain. * @param __val Data with which new elements should be populated. * * This function will %resize the %forward_list to the specified * number of elements. If the number is smaller than the * %forward_list's current number of elements the %forward_list * is truncated, otherwise the %forward_list is extended and new * elements are populated with given data. */ void resize(size_type __sz, const value_type& __val); /** * @brief Erases all the elements. * * Note that this function only erases * the elements, and that if the elements themselves are * pointers, the pointed-to memory is not touched in any way. * Managing the pointer is the user's responsibility. */ void clear() noexcept { this->_M_erase_after(&this->_M_impl._M_head, 0); } // 23.3.4.6 forward_list operations: /** * @brief Insert contents of another %forward_list. * @param __pos Iterator referencing the element to insert after. * @param __list Source list. * * The elements of @a list are inserted in constant time after * the element referenced by @a pos. @a list becomes an empty * list. * * Requires this != @a x. */ void splice_after(const_iterator __pos, forward_list&& __list) { if (!__list.empty()) _M_splice_after(__pos, __list.before_begin(), __list.end()); } void splice_after(const_iterator __pos, forward_list& __list) { splice_after(__pos, std::move(__list)); } /** * @brief Insert element from another %forward_list. * @param __pos Iterator referencing the element to insert after. * @param __list Source list. * @param __i Iterator referencing the element before the element * to move. * * Removes the element in list @a list referenced by @a i and * inserts it into the current list after @a pos. */ void splice_after(const_iterator __pos, forward_list&& __list, const_iterator __i); void splice_after(const_iterator __pos, forward_list& __list, const_iterator __i) { splice_after(__pos, std::move(__list), __i); } /** * @brief Insert range from another %forward_list. * @param __pos Iterator referencing the element to insert after. * @param __list Source list. * @param __before Iterator referencing before the start of range * in list. * @param __last Iterator referencing the end of range in list. * * Removes elements in the range (__before,__last) and inserts them * after @a __pos in constant time. * * Undefined if @a __pos is in (__before,__last). */ void splice_after(const_iterator __pos, forward_list&&, const_iterator __before, const_iterator __last) { _M_splice_after(__pos, __before, __last); } void splice_after(const_iterator __pos, forward_list&, const_iterator __before, const_iterator __last) { _M_splice_after(__pos, __before, __last); } /** * @brief Remove all elements equal to value. * @param __val The value to remove. * * Removes every element in the list equal to @a __val. * Remaining elements stay in list order. Note that this * function only erases the elements, and that if the elements * themselves are pointers, the pointed-to memory is not * touched in any way. Managing the pointer is the user's * responsibility. */ void remove(const _Tp& __val); /** * @brief Remove all elements satisfying a predicate. * @param __pred Unary predicate function or object. * * Removes every element in the list for which the predicate * returns true. Remaining elements stay in list order. Note * that this function only erases the elements, and that if the * elements themselves are pointers, the pointed-to memory is * not touched in any way. Managing the pointer is the user's * responsibility. */ template<typename _Pred> void remove_if(_Pred __pred); /** * @brief Remove consecutive duplicate elements. * * For each consecutive set of elements with the same value, * remove all but the first one. Remaining elements stay in * list order. Note that this function only erases the * elements, and that if the elements themselves are pointers, * the pointed-to memory is not touched in any way. Managing * the pointer is the user's responsibility. */ void unique() { unique(std::equal_to<_Tp>()); } /** * @brief Remove consecutive elements satisfying a predicate. * @param __binary_pred Binary predicate function or object. * * For each consecutive set of elements [first,last) that * satisfy predicate(first,i) where i is an iterator in * [first,last), remove all but the first one. Remaining * elements stay in list order. Note that this function only * erases the elements, and that if the elements themselves are * pointers, the pointed-to memory is not touched in any way. * Managing the pointer is the user's responsibility. */ template<typename _BinPred> void unique(_BinPred __binary_pred); /** * @brief Merge sorted lists. * @param __list Sorted list to merge. * * Assumes that both @a list and this list are sorted according to * operator<(). Merges elements of @a __list into this list in * sorted order, leaving @a __list empty when complete. Elements in * this list precede elements in @a __list that are equal. */ void merge(forward_list&& __list) { merge(std::move(__list), std::less<_Tp>()); } void merge(forward_list& __list) { merge(std::move(__list)); } /** * @brief Merge sorted lists according to comparison function. * @param __list Sorted list to merge. * @param __comp Comparison function defining sort order. * * Assumes that both @a __list and this list are sorted according to * comp. Merges elements of @a __list into this list * in sorted order, leaving @a __list empty when complete. Elements * in this list precede elements in @a __list that are equivalent * according to comp(). */ template<typename _Comp> void merge(forward_list&& __list, _Comp __comp); template<typename _Comp> void merge(forward_list& __list, _Comp __comp) { merge(std::move(__list), __comp); } /** * @brief Sort the elements of the list. * * Sorts the elements of this list in NlogN time. Equivalent * elements remain in list order. */ void sort() { sort(std::less<_Tp>()); } /** * @brief Sort the forward_list using a comparison function. * * Sorts the elements of this list in NlogN time. Equivalent * elements remain in list order. */ template<typename _Comp> void sort(_Comp __comp); /** * @brief Reverse the elements in list. * * Reverse the order of elements in the list in linear time. */ void reverse() noexcept { this->_M_impl._M_head._M_reverse_after(); } private: // Called by the range constructor to implement [23.3.4.2]/9 template<typename _InputIterator> void _M_range_initialize(_InputIterator __first, _InputIterator __last); // Called by forward_list(n,v,a), and the range constructor when it // turns out to be the same thing. void _M_fill_initialize(size_type __n, const value_type& __value); // Called by splice_after and insert_after. iterator _M_splice_after(const_iterator __pos, const_iterator __before, const_iterator __last); // Called by forward_list(n). void _M_default_initialize(size_type __n); // Called by resize(sz). void _M_default_insert_after(const_iterator __pos, size_type __n); // Called by operator=(forward_list&&) void _M_move_assign(forward_list&& __list, std::true_type) noexcept { clear(); std::swap(this->_M_impl._M_head._M_next, __list._M_impl._M_head._M_next); std::__alloc_on_move(this->_M_get_Node_allocator(), __list._M_get_Node_allocator()); } // Called by operator=(forward_list&&) void _M_move_assign(forward_list&& __list, std::false_type) { if (__list._M_get_Node_allocator() == this->_M_get_Node_allocator()) _M_move_assign(std::move(__list), std::true_type()); else // The rvalue's allocator cannot be moved, or is not equal, // so we need to individually move each element. this->assign(std::__make_move_if_noexcept_iterator(__list.begin()), std::__make_move_if_noexcept_iterator(__list.end())); } // Called by assign(_InputIterator, _InputIterator) if _Tp is // CopyAssignable. template<typename _InputIterator> void _M_assign(_InputIterator __first, _InputIterator __last, true_type) { auto __prev = before_begin(); auto __curr = begin(); auto __end = end(); while (__curr != __end && __first != __last) { *__curr = *__first; ++__prev; ++__curr; ++__first; } if (__first != __last) insert_after(__prev, __first, __last); else if (__curr != __end) erase_after(__prev, __end); } // Called by assign(_InputIterator, _InputIterator) if _Tp is not // CopyAssignable. template<typename _InputIterator> void _M_assign(_InputIterator __first, _InputIterator __last, false_type) { clear(); insert_after(cbefore_begin(), __first, __last); } // Called by assign(size_type, const _Tp&) if Tp is CopyAssignable void _M_assign_n(size_type __n, const _Tp& __val, true_type) { auto __prev = before_begin(); auto __curr = begin(); auto __end = end(); while (__curr != __end && __n > 0) { *__curr = __val; ++__prev; ++__curr; --__n; } if (__n > 0) insert_after(__prev, __n, __val); else if (__curr != __end) erase_after(__prev, __end); } // Called by assign(size_type, const _Tp&) if Tp is non-CopyAssignable void _M_assign_n(size_type __n, const _Tp& __val, false_type) { clear(); insert_after(cbefore_begin(), __n, __val); } }; /** * @brief Forward list equality comparison. * @param __lx A %forward_list * @param __ly A %forward_list of the same type as @a __lx. * @return True iff the elements of the forward lists are equal. * * This is an equivalence relation. It is linear in the number of * elements of the forward lists. Deques are considered equivalent * if corresponding elements compare equal. */ template<typename _Tp, typename _Alloc> bool operator==(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly); /** * @brief Forward list ordering relation. * @param __lx A %forward_list. * @param __ly A %forward_list of the same type as @a __lx. * @return True iff @a __lx is lexicographically less than @a __ly. * * This is a total ordering relation. It is linear in the number of * elements of the forward lists. The elements must be comparable * with @c <. * * See std::lexicographical_compare() for how the determination is made. */ template<typename _Tp, typename _Alloc> inline bool operator<(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly) { return std::lexicographical_compare(__lx.cbegin(), __lx.cend(), __ly.cbegin(), __ly.cend()); } /// Based on operator== template<typename _Tp, typename _Alloc> inline bool operator!=(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly) { return !(__lx == __ly); } /// Based on operator< template<typename _Tp, typename _Alloc> inline bool operator>(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly) { return (__ly < __lx); } /// Based on operator< template<typename _Tp, typename _Alloc> inline bool operator>=(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly) { return !(__lx < __ly); } /// Based on operator< template<typename _Tp, typename _Alloc> inline bool operator<=(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly) { return !(__ly < __lx); } /// See std::forward_list::swap(). template<typename _Tp, typename _Alloc> inline void swap(forward_list<_Tp, _Alloc>& __lx, forward_list<_Tp, _Alloc>& __ly) { __lx.swap(__ly); } _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std #endif // _FORWARD_LIST_H ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/locale_facets_nonio.h����������������������������������������������������������������0000644�����������������00000177013�14763166030�0012704 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Locale support -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/locale_facets_nonio.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{locale} */ // // ISO C++ 14882: 22.1 Locales // #ifndef _LOCALE_FACETS_NONIO_H #define _LOCALE_FACETS_NONIO_H 1 #pragma GCC system_header #include <ctime> // For struct tm namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Time format ordering data. * @ingroup locales * * This class provides an enum representing different orderings of * time: day, month, and year. */ class time_base { public: enum dateorder { no_order, dmy, mdy, ymd, ydm }; }; template<typename _CharT> struct __timepunct_cache : public locale::facet { // List of all known timezones, with GMT first. static const _CharT* _S_timezones[14]; const _CharT* _M_date_format; const _CharT* _M_date_era_format; const _CharT* _M_time_format; const _CharT* _M_time_era_format; const _CharT* _M_date_time_format; const _CharT* _M_date_time_era_format; const _CharT* _M_am; const _CharT* _M_pm; const _CharT* _M_am_pm_format; // Day names, starting with "C"'s Sunday. const _CharT* _M_day1; const _CharT* _M_day2; const _CharT* _M_day3; const _CharT* _M_day4; const _CharT* _M_day5; const _CharT* _M_day6; const _CharT* _M_day7; // Abbreviated day names, starting with "C"'s Sun. const _CharT* _M_aday1; const _CharT* _M_aday2; const _CharT* _M_aday3; const _CharT* _M_aday4; const _CharT* _M_aday5; const _CharT* _M_aday6; const _CharT* _M_aday7; // Month names, starting with "C"'s January. const _CharT* _M_month01; const _CharT* _M_month02; const _CharT* _M_month03; const _CharT* _M_month04; const _CharT* _M_month05; const _CharT* _M_month06; const _CharT* _M_month07; const _CharT* _M_month08; const _CharT* _M_month09; const _CharT* _M_month10; const _CharT* _M_month11; const _CharT* _M_month12; // Abbreviated month names, starting with "C"'s Jan. const _CharT* _M_amonth01; const _CharT* _M_amonth02; const _CharT* _M_amonth03; const _CharT* _M_amonth04; const _CharT* _M_amonth05; const _CharT* _M_amonth06; const _CharT* _M_amonth07; const _CharT* _M_amonth08; const _CharT* _M_amonth09; const _CharT* _M_amonth10; const _CharT* _M_amonth11; const _CharT* _M_amonth12; bool _M_allocated; __timepunct_cache(size_t __refs = 0) : facet(__refs), _M_date_format(0), _M_date_era_format(0), _M_time_format(0), _M_time_era_format(0), _M_date_time_format(0), _M_date_time_era_format(0), _M_am(0), _M_pm(0), _M_am_pm_format(0), _M_day1(0), _M_day2(0), _M_day3(0), _M_day4(0), _M_day5(0), _M_day6(0), _M_day7(0), _M_aday1(0), _M_aday2(0), _M_aday3(0), _M_aday4(0), _M_aday5(0), _M_aday6(0), _M_aday7(0), _M_month01(0), _M_month02(0), _M_month03(0), _M_month04(0), _M_month05(0), _M_month06(0), _M_month07(0), _M_month08(0), _M_month09(0), _M_month10(0), _M_month11(0), _M_month12(0), _M_amonth01(0), _M_amonth02(0), _M_amonth03(0), _M_amonth04(0), _M_amonth05(0), _M_amonth06(0), _M_amonth07(0), _M_amonth08(0), _M_amonth09(0), _M_amonth10(0), _M_amonth11(0), _M_amonth12(0), _M_allocated(false) { } ~__timepunct_cache(); void _M_cache(const locale& __loc); private: __timepunct_cache& operator=(const __timepunct_cache&); explicit __timepunct_cache(const __timepunct_cache&); }; template<typename _CharT> __timepunct_cache<_CharT>::~__timepunct_cache() { if (_M_allocated) { // Unused. } } // Specializations. template<> const char* __timepunct_cache<char>::_S_timezones[14]; #ifdef _GLIBCXX_USE_WCHAR_T template<> const wchar_t* __timepunct_cache<wchar_t>::_S_timezones[14]; #endif // Generic. template<typename _CharT> const _CharT* __timepunct_cache<_CharT>::_S_timezones[14]; template<typename _CharT> class __timepunct : public locale::facet { public: // Types: typedef _CharT __char_type; typedef basic_string<_CharT> __string_type; typedef __timepunct_cache<_CharT> __cache_type; protected: __cache_type* _M_data; __c_locale _M_c_locale_timepunct; const char* _M_name_timepunct; public: /// Numpunct facet id. static locale::id id; explicit __timepunct(size_t __refs = 0); explicit __timepunct(__cache_type* __cache, size_t __refs = 0); /** * @brief Internal constructor. Not for general use. * * This is a constructor for use by the library itself to set up new * locales. * * @param __cloc The C locale. * @param __s The name of a locale. * @param refs Passed to the base facet class. */ explicit __timepunct(__c_locale __cloc, const char* __s, size_t __refs = 0); // FIXME: for error checking purposes _M_put should return the return // value of strftime/wcsftime. void _M_put(_CharT* __s, size_t __maxlen, const _CharT* __format, const tm* __tm) const throw (); void _M_date_formats(const _CharT** __date) const { // Always have default first. __date[0] = _M_data->_M_date_format; __date[1] = _M_data->_M_date_era_format; } void _M_time_formats(const _CharT** __time) const { // Always have default first. __time[0] = _M_data->_M_time_format; __time[1] = _M_data->_M_time_era_format; } void _M_date_time_formats(const _CharT** __dt) const { // Always have default first. __dt[0] = _M_data->_M_date_time_format; __dt[1] = _M_data->_M_date_time_era_format; } void _M_am_pm_format(const _CharT* __ampm) const { __ampm = _M_data->_M_am_pm_format; } void _M_am_pm(const _CharT** __ampm) const { __ampm[0] = _M_data->_M_am; __ampm[1] = _M_data->_M_pm; } void _M_days(const _CharT** __days) const { __days[0] = _M_data->_M_day1; __days[1] = _M_data->_M_day2; __days[2] = _M_data->_M_day3; __days[3] = _M_data->_M_day4; __days[4] = _M_data->_M_day5; __days[5] = _M_data->_M_day6; __days[6] = _M_data->_M_day7; } void _M_days_abbreviated(const _CharT** __days) const { __days[0] = _M_data->_M_aday1; __days[1] = _M_data->_M_aday2; __days[2] = _M_data->_M_aday3; __days[3] = _M_data->_M_aday4; __days[4] = _M_data->_M_aday5; __days[5] = _M_data->_M_aday6; __days[6] = _M_data->_M_aday7; } void _M_months(const _CharT** __months) const { __months[0] = _M_data->_M_month01; __months[1] = _M_data->_M_month02; __months[2] = _M_data->_M_month03; __months[3] = _M_data->_M_month04; __months[4] = _M_data->_M_month05; __months[5] = _M_data->_M_month06; __months[6] = _M_data->_M_month07; __months[7] = _M_data->_M_month08; __months[8] = _M_data->_M_month09; __months[9] = _M_data->_M_month10; __months[10] = _M_data->_M_month11; __months[11] = _M_data->_M_month12; } void _M_months_abbreviated(const _CharT** __months) const { __months[0] = _M_data->_M_amonth01; __months[1] = _M_data->_M_amonth02; __months[2] = _M_data->_M_amonth03; __months[3] = _M_data->_M_amonth04; __months[4] = _M_data->_M_amonth05; __months[5] = _M_data->_M_amonth06; __months[6] = _M_data->_M_amonth07; __months[7] = _M_data->_M_amonth08; __months[8] = _M_data->_M_amonth09; __months[9] = _M_data->_M_amonth10; __months[10] = _M_data->_M_amonth11; __months[11] = _M_data->_M_amonth12; } protected: virtual ~__timepunct(); // For use at construction time only. void _M_initialize_timepunct(__c_locale __cloc = 0); }; template<typename _CharT> locale::id __timepunct<_CharT>::id; // Specializations. template<> void __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc); template<> void __timepunct<char>::_M_put(char*, size_t, const char*, const tm*) const throw (); #ifdef _GLIBCXX_USE_WCHAR_T template<> void __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc); template<> void __timepunct<wchar_t>::_M_put(wchar_t*, size_t, const wchar_t*, const tm*) const throw (); #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace // Include host and configuration specific timepunct functions. #include <bits/time_members.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Primary class template time_get. * @ingroup locales * * This facet encapsulates the code to parse and return a date or * time from a string. It is used by the istream numeric * extraction operators. * * The time_get template uses protected virtual functions to provide the * actual results. The public accessors forward the call to the virtual * functions. These virtual functions are hooks for developers to * implement the behavior they require from the time_get facet. */ template<typename _CharT, typename _InIter> class time_get : public locale::facet, public time_base { public: // Types: //@{ /// Public typedefs typedef _CharT char_type; typedef _InIter iter_type; //@} typedef basic_string<_CharT> __string_type; /// Numpunct facet id. static locale::id id; /** * @brief Constructor performs initialization. * * This is the constructor provided by the standard. * * @param __refs Passed to the base facet class. */ explicit time_get(size_t __refs = 0) : facet (__refs) { } /** * @brief Return preferred order of month, day, and year. * * This function returns an enum from timebase::dateorder giving the * preferred ordering if the format @a x given to time_put::put() only * uses month, day, and year. If the format @a x for the associated * locale uses other fields, this function returns * timebase::dateorder::noorder. * * NOTE: The library always returns noorder at the moment. * * @return A member of timebase::dateorder. */ dateorder date_order() const { return this->do_date_order(); } /** * @brief Parse input time string. * * This function parses a time according to the format @a X and puts the * results into a user-supplied struct tm. The result is returned by * calling time_get::do_get_time(). * * If there is a valid time string according to format @a X, @a tm will * be filled in accordingly and the returned iterator will point to the * first character beyond the time string. If an error occurs before * the end, err |= ios_base::failbit. If parsing reads all the * characters, err |= ios_base::eofbit. * * @param __beg Start of string to parse. * @param __end End of string to parse. * @param __io Source of the locale. * @param __err Error flags to set. * @param __tm Pointer to struct tm to fill in. * @return Iterator to first char beyond time string. */ iter_type get_time(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, tm* __tm) const { return this->do_get_time(__beg, __end, __io, __err, __tm); } /** * @brief Parse input date string. * * This function parses a date according to the format @a x and puts the * results into a user-supplied struct tm. The result is returned by * calling time_get::do_get_date(). * * If there is a valid date string according to format @a x, @a tm will * be filled in accordingly and the returned iterator will point to the * first character beyond the date string. If an error occurs before * the end, err |= ios_base::failbit. If parsing reads all the * characters, err |= ios_base::eofbit. * * @param __beg Start of string to parse. * @param __end End of string to parse. * @param __io Source of the locale. * @param __err Error flags to set. * @param __tm Pointer to struct tm to fill in. * @return Iterator to first char beyond date string. */ iter_type get_date(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, tm* __tm) const { return this->do_get_date(__beg, __end, __io, __err, __tm); } /** * @brief Parse input weekday string. * * This function parses a weekday name and puts the results into a * user-supplied struct tm. The result is returned by calling * time_get::do_get_weekday(). * * Parsing starts by parsing an abbreviated weekday name. If a valid * abbreviation is followed by a character that would lead to the full * weekday name, parsing continues until the full name is found or an * error occurs. Otherwise parsing finishes at the end of the * abbreviated name. * * If an error occurs before the end, err |= ios_base::failbit. If * parsing reads all the characters, err |= ios_base::eofbit. * * @param __beg Start of string to parse. * @param __end End of string to parse. * @param __io Source of the locale. * @param __err Error flags to set. * @param __tm Pointer to struct tm to fill in. * @return Iterator to first char beyond weekday name. */ iter_type get_weekday(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, tm* __tm) const { return this->do_get_weekday(__beg, __end, __io, __err, __tm); } /** * @brief Parse input month string. * * This function parses a month name and puts the results into a * user-supplied struct tm. The result is returned by calling * time_get::do_get_monthname(). * * Parsing starts by parsing an abbreviated month name. If a valid * abbreviation is followed by a character that would lead to the full * month name, parsing continues until the full name is found or an * error occurs. Otherwise parsing finishes at the end of the * abbreviated name. * * If an error occurs before the end, err |= ios_base::failbit. If * parsing reads all the characters, err |= * ios_base::eofbit. * * @param __beg Start of string to parse. * @param __end End of string to parse. * @param __io Source of the locale. * @param __err Error flags to set. * @param __tm Pointer to struct tm to fill in. * @return Iterator to first char beyond month name. */ iter_type get_monthname(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, tm* __tm) const { return this->do_get_monthname(__beg, __end, __io, __err, __tm); } /** * @brief Parse input year string. * * This function reads up to 4 characters to parse a year string and * puts the results into a user-supplied struct tm. The result is * returned by calling time_get::do_get_year(). * * 4 consecutive digits are interpreted as a full year. If there are * exactly 2 consecutive digits, the library interprets this as the * number of years since 1900. * * If an error occurs before the end, err |= ios_base::failbit. If * parsing reads all the characters, err |= ios_base::eofbit. * * @param __beg Start of string to parse. * @param __end End of string to parse. * @param __io Source of the locale. * @param __err Error flags to set. * @param __tm Pointer to struct tm to fill in. * @return Iterator to first char beyond year. */ iter_type get_year(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, tm* __tm) const { return this->do_get_year(__beg, __end, __io, __err, __tm); } protected: /// Destructor. virtual ~time_get() { } /** * @brief Return preferred order of month, day, and year. * * This function returns an enum from timebase::dateorder giving the * preferred ordering if the format @a x given to time_put::put() only * uses month, day, and year. This function is a hook for derived * classes to change the value returned. * * @return A member of timebase::dateorder. */ virtual dateorder do_date_order() const; /** * @brief Parse input time string. * * This function parses a time according to the format @a x and puts the * results into a user-supplied struct tm. This function is a hook for * derived classes to change the value returned. @see get_time() for * details. * * @param __beg Start of string to parse. * @param __end End of string to parse. * @param __io Source of the locale. * @param __err Error flags to set. * @param __tm Pointer to struct tm to fill in. * @return Iterator to first char beyond time string. */ virtual iter_type do_get_time(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, tm* __tm) const; /** * @brief Parse input date string. * * This function parses a date according to the format @a X and puts the * results into a user-supplied struct tm. This function is a hook for * derived classes to change the value returned. @see get_date() for * details. * * @param __beg Start of string to parse. * @param __end End of string to parse. * @param __io Source of the locale. * @param __err Error flags to set. * @param __tm Pointer to struct tm to fill in. * @return Iterator to first char beyond date string. */ virtual iter_type do_get_date(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, tm* __tm) const; /** * @brief Parse input weekday string. * * This function parses a weekday name and puts the results into a * user-supplied struct tm. This function is a hook for derived * classes to change the value returned. @see get_weekday() for * details. * * @param __beg Start of string to parse. * @param __end End of string to parse. * @param __io Source of the locale. * @param __err Error flags to set. * @param __tm Pointer to struct tm to fill in. * @return Iterator to first char beyond weekday name. */ virtual iter_type do_get_weekday(iter_type __beg, iter_type __end, ios_base&, ios_base::iostate& __err, tm* __tm) const; /** * @brief Parse input month string. * * This function parses a month name and puts the results into a * user-supplied struct tm. This function is a hook for derived * classes to change the value returned. @see get_monthname() for * details. * * @param __beg Start of string to parse. * @param __end End of string to parse. * @param __io Source of the locale. * @param __err Error flags to set. * @param __tm Pointer to struct tm to fill in. * @return Iterator to first char beyond month name. */ virtual iter_type do_get_monthname(iter_type __beg, iter_type __end, ios_base&, ios_base::iostate& __err, tm* __tm) const; /** * @brief Parse input year string. * * This function reads up to 4 characters to parse a year string and * puts the results into a user-supplied struct tm. This function is a * hook for derived classes to change the value returned. @see * get_year() for details. * * @param __beg Start of string to parse. * @param __end End of string to parse. * @param __io Source of the locale. * @param __err Error flags to set. * @param __tm Pointer to struct tm to fill in. * @return Iterator to first char beyond year. */ virtual iter_type do_get_year(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, tm* __tm) const; // Extract numeric component of length __len. iter_type _M_extract_num(iter_type __beg, iter_type __end, int& __member, int __min, int __max, size_t __len, ios_base& __io, ios_base::iostate& __err) const; // Extract any unique array of string literals in a const _CharT* array. iter_type _M_extract_name(iter_type __beg, iter_type __end, int& __member, const _CharT** __names, size_t __indexlen, ios_base& __io, ios_base::iostate& __err) const; // Extract day or month name in a const _CharT* array. iter_type _M_extract_wday_or_month(iter_type __beg, iter_type __end, int& __member, const _CharT** __names, size_t __indexlen, ios_base& __io, ios_base::iostate& __err) const; // Extract on a component-by-component basis, via __format argument. iter_type _M_extract_via_format(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, tm* __tm, const _CharT* __format) const; }; template<typename _CharT, typename _InIter> locale::id time_get<_CharT, _InIter>::id; /// class time_get_byname [22.2.5.2]. template<typename _CharT, typename _InIter> class time_get_byname : public time_get<_CharT, _InIter> { public: // Types: typedef _CharT char_type; typedef _InIter iter_type; explicit time_get_byname(const char*, size_t __refs = 0) : time_get<_CharT, _InIter>(__refs) { } protected: virtual ~time_get_byname() { } }; /** * @brief Primary class template time_put. * @ingroup locales * * This facet encapsulates the code to format and output dates and times * according to formats used by strftime(). * * The time_put template uses protected virtual functions to provide the * actual results. The public accessors forward the call to the virtual * functions. These virtual functions are hooks for developers to * implement the behavior they require from the time_put facet. */ template<typename _CharT, typename _OutIter> class time_put : public locale::facet { public: // Types: //@{ /// Public typedefs typedef _CharT char_type; typedef _OutIter iter_type; //@} /// Numpunct facet id. static locale::id id; /** * @brief Constructor performs initialization. * * This is the constructor provided by the standard. * * @param __refs Passed to the base facet class. */ explicit time_put(size_t __refs = 0) : facet(__refs) { } /** * @brief Format and output a time or date. * * This function formats the data in struct tm according to the * provided format string. The format string is interpreted as by * strftime(). * * @param __s The stream to write to. * @param __io Source of locale. * @param __fill char_type to use for padding. * @param __tm Struct tm with date and time info to format. * @param __beg Start of format string. * @param __end End of format string. * @return Iterator after writing. */ iter_type put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm, const _CharT* __beg, const _CharT* __end) const; /** * @brief Format and output a time or date. * * This function formats the data in struct tm according to the * provided format char and optional modifier. The format and modifier * are interpreted as by strftime(). It does so by returning * time_put::do_put(). * * @param __s The stream to write to. * @param __io Source of locale. * @param __fill char_type to use for padding. * @param __tm Struct tm with date and time info to format. * @param __format Format char. * @param __mod Optional modifier char. * @return Iterator after writing. */ iter_type put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm, char __format, char __mod = 0) const { return this->do_put(__s, __io, __fill, __tm, __format, __mod); } protected: /// Destructor. virtual ~time_put() { } /** * @brief Format and output a time or date. * * This function formats the data in struct tm according to the * provided format char and optional modifier. This function is a hook * for derived classes to change the value returned. @see put() for * more details. * * @param __s The stream to write to. * @param __io Source of locale. * @param __fill char_type to use for padding. * @param __tm Struct tm with date and time info to format. * @param __format Format char. * @param __mod Optional modifier char. * @return Iterator after writing. */ virtual iter_type do_put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm, char __format, char __mod) const; }; template<typename _CharT, typename _OutIter> locale::id time_put<_CharT, _OutIter>::id; /// class time_put_byname [22.2.5.4]. template<typename _CharT, typename _OutIter> class time_put_byname : public time_put<_CharT, _OutIter> { public: // Types: typedef _CharT char_type; typedef _OutIter iter_type; explicit time_put_byname(const char*, size_t __refs = 0) : time_put<_CharT, _OutIter>(__refs) { }; protected: virtual ~time_put_byname() { } }; /** * @brief Money format ordering data. * @ingroup locales * * This class contains an ordered array of 4 fields to represent the * pattern for formatting a money amount. Each field may contain one entry * from the part enum. symbol, sign, and value must be present and the * remaining field must contain either none or space. @see * moneypunct::pos_format() and moneypunct::neg_format() for details of how * these fields are interpreted. */ class money_base { public: enum part { none, space, symbol, sign, value }; struct pattern { char field[4]; }; static const pattern _S_default_pattern; enum { _S_minus, _S_zero, _S_end = 11 }; // String literal of acceptable (narrow) input/output, for // money_get/money_put. "-0123456789" static const char* _S_atoms; // Construct and return valid pattern consisting of some combination of: // space none symbol sign value _GLIBCXX_CONST static pattern _S_construct_pattern(char __precedes, char __space, char __posn) throw (); }; template<typename _CharT, bool _Intl> struct __moneypunct_cache : public locale::facet { const char* _M_grouping; size_t _M_grouping_size; bool _M_use_grouping; _CharT _M_decimal_point; _CharT _M_thousands_sep; const _CharT* _M_curr_symbol; size_t _M_curr_symbol_size; const _CharT* _M_positive_sign; size_t _M_positive_sign_size; const _CharT* _M_negative_sign; size_t _M_negative_sign_size; int _M_frac_digits; money_base::pattern _M_pos_format; money_base::pattern _M_neg_format; // A list of valid numeric literals for input and output: in the standard // "C" locale, this is "-0123456789". This array contains the chars after // having been passed through the current locale's ctype<_CharT>.widen(). _CharT _M_atoms[money_base::_S_end]; bool _M_allocated; __moneypunct_cache(size_t __refs = 0) : facet(__refs), _M_grouping(0), _M_grouping_size(0), _M_use_grouping(false), _M_decimal_point(_CharT()), _M_thousands_sep(_CharT()), _M_curr_symbol(0), _M_curr_symbol_size(0), _M_positive_sign(0), _M_positive_sign_size(0), _M_negative_sign(0), _M_negative_sign_size(0), _M_frac_digits(0), _M_pos_format(money_base::pattern()), _M_neg_format(money_base::pattern()), _M_allocated(false) { } ~__moneypunct_cache(); void _M_cache(const locale& __loc); private: __moneypunct_cache& operator=(const __moneypunct_cache&); explicit __moneypunct_cache(const __moneypunct_cache&); }; template<typename _CharT, bool _Intl> __moneypunct_cache<_CharT, _Intl>::~__moneypunct_cache() { if (_M_allocated) { delete [] _M_grouping; delete [] _M_curr_symbol; delete [] _M_positive_sign; delete [] _M_negative_sign; } } /** * @brief Primary class template moneypunct. * @ingroup locales * * This facet encapsulates the punctuation, grouping and other formatting * features of money amount string representations. */ template<typename _CharT, bool _Intl> class moneypunct : public locale::facet, public money_base { public: // Types: //@{ /// Public typedefs typedef _CharT char_type; typedef basic_string<_CharT> string_type; //@} typedef __moneypunct_cache<_CharT, _Intl> __cache_type; private: __cache_type* _M_data; public: /// This value is provided by the standard, but no reason for its /// existence. static const bool intl = _Intl; /// Numpunct facet id. static locale::id id; /** * @brief Constructor performs initialization. * * This is the constructor provided by the standard. * * @param __refs Passed to the base facet class. */ explicit moneypunct(size_t __refs = 0) : facet(__refs), _M_data(0) { _M_initialize_moneypunct(); } /** * @brief Constructor performs initialization. * * This is an internal constructor. * * @param __cache Cache for optimization. * @param __refs Passed to the base facet class. */ explicit moneypunct(__cache_type* __cache, size_t __refs = 0) : facet(__refs), _M_data(__cache) { _M_initialize_moneypunct(); } /** * @brief Internal constructor. Not for general use. * * This is a constructor for use by the library itself to set up new * locales. * * @param __cloc The C locale. * @param __s The name of a locale. * @param __refs Passed to the base facet class. */ explicit moneypunct(__c_locale __cloc, const char* __s, size_t __refs = 0) : facet(__refs), _M_data(0) { _M_initialize_moneypunct(__cloc, __s); } /** * @brief Return decimal point character. * * This function returns a char_type to use as a decimal point. It * does so by returning returning * moneypunct<char_type>::do_decimal_point(). * * @return @a char_type representing a decimal point. */ char_type decimal_point() const { return this->do_decimal_point(); } /** * @brief Return thousands separator character. * * This function returns a char_type to use as a thousands * separator. It does so by returning returning * moneypunct<char_type>::do_thousands_sep(). * * @return char_type representing a thousands separator. */ char_type thousands_sep() const { return this->do_thousands_sep(); } /** * @brief Return grouping specification. * * This function returns a string representing groupings for the * integer part of an amount. Groupings indicate where thousands * separators should be inserted. * * Each char in the return string is interpret as an integer rather * than a character. These numbers represent the number of digits in a * group. The first char in the string represents the number of digits * in the least significant group. If a char is negative, it indicates * an unlimited number of digits for the group. If more chars from the * string are required to group a number, the last char is used * repeatedly. * * For example, if the grouping() returns <code>\003\002</code> * and is applied to the number 123456789, this corresponds to * 12,34,56,789. Note that if the string was <code>32</code>, this would * put more than 50 digits into the least significant group if * the character set is ASCII. * * The string is returned by calling * moneypunct<char_type>::do_grouping(). * * @return string representing grouping specification. */ string grouping() const { return this->do_grouping(); } /** * @brief Return currency symbol string. * * This function returns a string_type to use as a currency symbol. It * does so by returning returning * moneypunct<char_type>::do_curr_symbol(). * * @return @a string_type representing a currency symbol. */ string_type curr_symbol() const { return this->do_curr_symbol(); } /** * @brief Return positive sign string. * * This function returns a string_type to use as a sign for positive * amounts. It does so by returning returning * moneypunct<char_type>::do_positive_sign(). * * If the return value contains more than one character, the first * character appears in the position indicated by pos_format() and the * remainder appear at the end of the formatted string. * * @return @a string_type representing a positive sign. */ string_type positive_sign() const { return this->do_positive_sign(); } /** * @brief Return negative sign string. * * This function returns a string_type to use as a sign for negative * amounts. It does so by returning returning * moneypunct<char_type>::do_negative_sign(). * * If the return value contains more than one character, the first * character appears in the position indicated by neg_format() and the * remainder appear at the end of the formatted string. * * @return @a string_type representing a negative sign. */ string_type negative_sign() const { return this->do_negative_sign(); } /** * @brief Return number of digits in fraction. * * This function returns the exact number of digits that make up the * fractional part of a money amount. It does so by returning * returning moneypunct<char_type>::do_frac_digits(). * * The fractional part of a money amount is optional. But if it is * present, there must be frac_digits() digits. * * @return Number of digits in amount fraction. */ int frac_digits() const { return this->do_frac_digits(); } //@{ /** * @brief Return pattern for money values. * * This function returns a pattern describing the formatting of a * positive or negative valued money amount. It does so by returning * returning moneypunct<char_type>::do_pos_format() or * moneypunct<char_type>::do_neg_format(). * * The pattern has 4 fields describing the ordering of symbol, sign, * value, and none or space. There must be one of each in the pattern. * The none and space enums may not appear in the first field and space * may not appear in the final field. * * The parts of a money string must appear in the order indicated by * the fields of the pattern. The symbol field indicates that the * value of curr_symbol() may be present. The sign field indicates * that the value of positive_sign() or negative_sign() must be * present. The value field indicates that the absolute value of the * money amount is present. none indicates 0 or more whitespace * characters, except at the end, where it permits no whitespace. * space indicates that 1 or more whitespace characters must be * present. * * For example, for the US locale and pos_format() pattern * {symbol,sign,value,none}, curr_symbol() == '$' * positive_sign() == '+', and value 10.01, and * options set to force the symbol, the corresponding string is * <code>$+10.01</code>. * * @return Pattern for money values. */ pattern pos_format() const { return this->do_pos_format(); } pattern neg_format() const { return this->do_neg_format(); } //@} protected: /// Destructor. virtual ~moneypunct(); /** * @brief Return decimal point character. * * Returns a char_type to use as a decimal point. This function is a * hook for derived classes to change the value returned. * * @return @a char_type representing a decimal point. */ virtual char_type do_decimal_point() const { return _M_data->_M_decimal_point; } /** * @brief Return thousands separator character. * * Returns a char_type to use as a thousands separator. This function * is a hook for derived classes to change the value returned. * * @return @a char_type representing a thousands separator. */ virtual char_type do_thousands_sep() const { return _M_data->_M_thousands_sep; } /** * @brief Return grouping specification. * * Returns a string representing groupings for the integer part of a * number. This function is a hook for derived classes to change the * value returned. @see grouping() for details. * * @return String representing grouping specification. */ virtual string do_grouping() const { return _M_data->_M_grouping; } /** * @brief Return currency symbol string. * * This function returns a string_type to use as a currency symbol. * This function is a hook for derived classes to change the value * returned. @see curr_symbol() for details. * * @return @a string_type representing a currency symbol. */ virtual string_type do_curr_symbol() const { return _M_data->_M_curr_symbol; } /** * @brief Return positive sign string. * * This function returns a string_type to use as a sign for positive * amounts. This function is a hook for derived classes to change the * value returned. @see positive_sign() for details. * * @return @a string_type representing a positive sign. */ virtual string_type do_positive_sign() const { return _M_data->_M_positive_sign; } /** * @brief Return negative sign string. * * This function returns a string_type to use as a sign for negative * amounts. This function is a hook for derived classes to change the * value returned. @see negative_sign() for details. * * @return @a string_type representing a negative sign. */ virtual string_type do_negative_sign() const { return _M_data->_M_negative_sign; } /** * @brief Return number of digits in fraction. * * This function returns the exact number of digits that make up the * fractional part of a money amount. This function is a hook for * derived classes to change the value returned. @see frac_digits() * for details. * * @return Number of digits in amount fraction. */ virtual int do_frac_digits() const { return _M_data->_M_frac_digits; } /** * @brief Return pattern for money values. * * This function returns a pattern describing the formatting of a * positive valued money amount. This function is a hook for derived * classes to change the value returned. @see pos_format() for * details. * * @return Pattern for money values. */ virtual pattern do_pos_format() const { return _M_data->_M_pos_format; } /** * @brief Return pattern for money values. * * This function returns a pattern describing the formatting of a * negative valued money amount. This function is a hook for derived * classes to change the value returned. @see neg_format() for * details. * * @return Pattern for money values. */ virtual pattern do_neg_format() const { return _M_data->_M_neg_format; } // For use at construction time only. void _M_initialize_moneypunct(__c_locale __cloc = 0, const char* __name = 0); }; template<typename _CharT, bool _Intl> locale::id moneypunct<_CharT, _Intl>::id; template<typename _CharT, bool _Intl> const bool moneypunct<_CharT, _Intl>::intl; template<> moneypunct<char, true>::~moneypunct(); template<> moneypunct<char, false>::~moneypunct(); template<> void moneypunct<char, true>::_M_initialize_moneypunct(__c_locale, const char*); template<> void moneypunct<char, false>::_M_initialize_moneypunct(__c_locale, const char*); #ifdef _GLIBCXX_USE_WCHAR_T template<> moneypunct<wchar_t, true>::~moneypunct(); template<> moneypunct<wchar_t, false>::~moneypunct(); template<> void moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale, const char*); template<> void moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale, const char*); #endif /// class moneypunct_byname [22.2.6.4]. template<typename _CharT, bool _Intl> class moneypunct_byname : public moneypunct<_CharT, _Intl> { public: typedef _CharT char_type; typedef basic_string<_CharT> string_type; static const bool intl = _Intl; explicit moneypunct_byname(const char* __s, size_t __refs = 0) : moneypunct<_CharT, _Intl>(__refs) { if (__builtin_strcmp(__s, "C") != 0 && __builtin_strcmp(__s, "POSIX") != 0) { __c_locale __tmp; this->_S_create_c_locale(__tmp, __s); this->_M_initialize_moneypunct(__tmp); this->_S_destroy_c_locale(__tmp); } } protected: virtual ~moneypunct_byname() { } }; template<typename _CharT, bool _Intl> const bool moneypunct_byname<_CharT, _Intl>::intl; _GLIBCXX_BEGIN_NAMESPACE_LDBL /** * @brief Primary class template money_get. * @ingroup locales * * This facet encapsulates the code to parse and return a monetary * amount from a string. * * The money_get template uses protected virtual functions to * provide the actual results. The public accessors forward the * call to the virtual functions. These virtual functions are * hooks for developers to implement the behavior they require from * the money_get facet. */ template<typename _CharT, typename _InIter> class money_get : public locale::facet { public: // Types: //@{ /// Public typedefs typedef _CharT char_type; typedef _InIter iter_type; typedef basic_string<_CharT> string_type; //@} /// Numpunct facet id. static locale::id id; /** * @brief Constructor performs initialization. * * This is the constructor provided by the standard. * * @param __refs Passed to the base facet class. */ explicit money_get(size_t __refs = 0) : facet(__refs) { } /** * @brief Read and parse a monetary value. * * This function reads characters from @a __s, interprets them as a * monetary value according to moneypunct and ctype facets retrieved * from io.getloc(), and returns the result in @a units as an integral * value moneypunct::frac_digits() * the actual amount. For example, * the string $10.01 in a US locale would store 1001 in @a units. * * Any characters not part of a valid money amount are not consumed. * * If a money value cannot be parsed from the input stream, sets * err=(err|io.failbit). If the stream is consumed before finishing * parsing, sets err=(err|io.failbit|io.eofbit). @a units is * unchanged if parsing fails. * * This function works by returning the result of do_get(). * * @param __s Start of characters to parse. * @param __end End of characters to parse. * @param __intl Parameter to use_facet<moneypunct<CharT,intl> >. * @param __io Source of facets and io state. * @param __err Error field to set if parsing fails. * @param __units Place to store result of parsing. * @return Iterator referencing first character beyond valid money * amount. */ iter_type get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, ios_base::iostate& __err, long double& __units) const { return this->do_get(__s, __end, __intl, __io, __err, __units); } /** * @brief Read and parse a monetary value. * * This function reads characters from @a __s, interprets them as * a monetary value according to moneypunct and ctype facets * retrieved from io.getloc(), and returns the result in @a * digits. For example, the string $10.01 in a US locale would * store <code>1001</code> in @a digits. * * Any characters not part of a valid money amount are not consumed. * * If a money value cannot be parsed from the input stream, sets * err=(err|io.failbit). If the stream is consumed before finishing * parsing, sets err=(err|io.failbit|io.eofbit). * * This function works by returning the result of do_get(). * * @param __s Start of characters to parse. * @param __end End of characters to parse. * @param __intl Parameter to use_facet<moneypunct<CharT,intl> >. * @param __io Source of facets and io state. * @param __err Error field to set if parsing fails. * @param __digits Place to store result of parsing. * @return Iterator referencing first character beyond valid money * amount. */ iter_type get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, ios_base::iostate& __err, string_type& __digits) const { return this->do_get(__s, __end, __intl, __io, __err, __digits); } protected: /// Destructor. virtual ~money_get() { } /** * @brief Read and parse a monetary value. * * This function reads and parses characters representing a monetary * value. This function is a hook for derived classes to change the * value returned. @see get() for details. */ // XXX GLIBCXX_ABI Deprecated #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ virtual iter_type __do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, ios_base::iostate& __err, double& __units) const; #else virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, ios_base::iostate& __err, long double& __units) const; #endif /** * @brief Read and parse a monetary value. * * This function reads and parses characters representing a monetary * value. This function is a hook for derived classes to change the * value returned. @see get() for details. */ virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, ios_base::iostate& __err, string_type& __digits) const; // XXX GLIBCXX_ABI Deprecated #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, ios_base::iostate& __err, long double& __units) const; #endif template<bool _Intl> iter_type _M_extract(iter_type __s, iter_type __end, ios_base& __io, ios_base::iostate& __err, string& __digits) const; }; template<typename _CharT, typename _InIter> locale::id money_get<_CharT, _InIter>::id; /** * @brief Primary class template money_put. * @ingroup locales * * This facet encapsulates the code to format and output a monetary * amount. * * The money_put template uses protected virtual functions to * provide the actual results. The public accessors forward the * call to the virtual functions. These virtual functions are * hooks for developers to implement the behavior they require from * the money_put facet. */ template<typename _CharT, typename _OutIter> class money_put : public locale::facet { public: //@{ /// Public typedefs typedef _CharT char_type; typedef _OutIter iter_type; typedef basic_string<_CharT> string_type; //@} /// Numpunct facet id. static locale::id id; /** * @brief Constructor performs initialization. * * This is the constructor provided by the standard. * * @param __refs Passed to the base facet class. */ explicit money_put(size_t __refs = 0) : facet(__refs) { } /** * @brief Format and output a monetary value. * * This function formats @a units as a monetary value according to * moneypunct and ctype facets retrieved from io.getloc(), and writes * the resulting characters to @a __s. For example, the value 1001 in a * US locale would write <code>$10.01</code> to @a __s. * * This function works by returning the result of do_put(). * * @param __s The stream to write to. * @param __intl Parameter to use_facet<moneypunct<CharT,intl> >. * @param __io Source of facets and io state. * @param __fill char_type to use for padding. * @param __units Place to store result of parsing. * @return Iterator after writing. */ iter_type put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, long double __units) const { return this->do_put(__s, __intl, __io, __fill, __units); } /** * @brief Format and output a monetary value. * * This function formats @a digits as a monetary value * according to moneypunct and ctype facets retrieved from * io.getloc(), and writes the resulting characters to @a __s. * For example, the string <code>1001</code> in a US locale * would write <code>$10.01</code> to @a __s. * * This function works by returning the result of do_put(). * * @param __s The stream to write to. * @param __intl Parameter to use_facet<moneypunct<CharT,intl> >. * @param __io Source of facets and io state. * @param __fill char_type to use for padding. * @param __digits Place to store result of parsing. * @return Iterator after writing. */ iter_type put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, const string_type& __digits) const { return this->do_put(__s, __intl, __io, __fill, __digits); } protected: /// Destructor. virtual ~money_put() { } /** * @brief Format and output a monetary value. * * This function formats @a units as a monetary value according to * moneypunct and ctype facets retrieved from io.getloc(), and writes * the resulting characters to @a __s. For example, the value 1001 in a * US locale would write <code>$10.01</code> to @a __s. * * This function is a hook for derived classes to change the value * returned. @see put(). * * @param __s The stream to write to. * @param __intl Parameter to use_facet<moneypunct<CharT,intl> >. * @param __io Source of facets and io state. * @param __fill char_type to use for padding. * @param __units Place to store result of parsing. * @return Iterator after writing. */ // XXX GLIBCXX_ABI Deprecated #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ virtual iter_type __do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, double __units) const; #else virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, long double __units) const; #endif /** * @brief Format and output a monetary value. * * This function formats @a digits as a monetary value * according to moneypunct and ctype facets retrieved from * io.getloc(), and writes the resulting characters to @a __s. * For example, the string <code>1001</code> in a US locale * would write <code>$10.01</code> to @a __s. * * This function is a hook for derived classes to change the value * returned. @see put(). * * @param __s The stream to write to. * @param __intl Parameter to use_facet<moneypunct<CharT,intl> >. * @param __io Source of facets and io state. * @param __fill char_type to use for padding. * @param __digits Place to store result of parsing. * @return Iterator after writing. */ virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, const string_type& __digits) const; // XXX GLIBCXX_ABI Deprecated #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, long double __units) const; #endif template<bool _Intl> iter_type _M_insert(iter_type __s, ios_base& __io, char_type __fill, const string_type& __digits) const; }; template<typename _CharT, typename _OutIter> locale::id money_put<_CharT, _OutIter>::id; _GLIBCXX_END_NAMESPACE_LDBL /** * @brief Messages facet base class providing catalog typedef. * @ingroup locales */ struct messages_base { typedef int catalog; }; /** * @brief Primary class template messages. * @ingroup locales * * This facet encapsulates the code to retrieve messages from * message catalogs. The only thing defined by the standard for this facet * is the interface. All underlying functionality is * implementation-defined. * * This library currently implements 3 versions of the message facet. The * first version (gnu) is a wrapper around gettext, provided by libintl. * The second version (ieee) is a wrapper around catgets. The final * version (default) does no actual translation. These implementations are * only provided for char and wchar_t instantiations. * * The messages template uses protected virtual functions to * provide the actual results. The public accessors forward the * call to the virtual functions. These virtual functions are * hooks for developers to implement the behavior they require from * the messages facet. */ template<typename _CharT> class messages : public locale::facet, public messages_base { public: // Types: //@{ /// Public typedefs typedef _CharT char_type; typedef basic_string<_CharT> string_type; //@} protected: // Underlying "C" library locale information saved from // initialization, needed by messages_byname as well. __c_locale _M_c_locale_messages; const char* _M_name_messages; public: /// Numpunct facet id. static locale::id id; /** * @brief Constructor performs initialization. * * This is the constructor provided by the standard. * * @param __refs Passed to the base facet class. */ explicit messages(size_t __refs = 0); // Non-standard. /** * @brief Internal constructor. Not for general use. * * This is a constructor for use by the library itself to set up new * locales. * * @param __cloc The C locale. * @param __s The name of a locale. * @param __refs Refcount to pass to the base class. */ explicit messages(__c_locale __cloc, const char* __s, size_t __refs = 0); /* * @brief Open a message catalog. * * This function opens and returns a handle to a message catalog by * returning do_open(__s, __loc). * * @param __s The catalog to open. * @param __loc Locale to use for character set conversions. * @return Handle to the catalog or value < 0 if open fails. */ catalog open(const basic_string<char>& __s, const locale& __loc) const { return this->do_open(__s, __loc); } // Non-standard and unorthodox, yet effective. /* * @brief Open a message catalog. * * This non-standard function opens and returns a handle to a message * catalog by returning do_open(s, loc). The third argument provides a * message catalog root directory for gnu gettext and is ignored * otherwise. * * @param __s The catalog to open. * @param __loc Locale to use for character set conversions. * @param __dir Message catalog root directory. * @return Handle to the catalog or value < 0 if open fails. */ catalog open(const basic_string<char>&, const locale&, const char*) const; /* * @brief Look up a string in a message catalog. * * This function retrieves and returns a message from a catalog by * returning do_get(c, set, msgid, s). * * For gnu, @a __set and @a msgid are ignored. Returns gettext(s). * For default, returns s. For ieee, returns catgets(c,set,msgid,s). * * @param __c The catalog to access. * @param __set Implementation-defined. * @param __msgid Implementation-defined. * @param __s Default return value if retrieval fails. * @return Retrieved message or @a __s if get fails. */ string_type get(catalog __c, int __set, int __msgid, const string_type& __s) const { return this->do_get(__c, __set, __msgid, __s); } /* * @brief Close a message catalog. * * Closes catalog @a c by calling do_close(c). * * @param __c The catalog to close. */ void close(catalog __c) const { return this->do_close(__c); } protected: /// Destructor. virtual ~messages(); /* * @brief Open a message catalog. * * This function opens and returns a handle to a message catalog in an * implementation-defined manner. This function is a hook for derived * classes to change the value returned. * * @param __s The catalog to open. * @param __loc Locale to use for character set conversions. * @return Handle to the opened catalog, value < 0 if open failed. */ virtual catalog do_open(const basic_string<char>&, const locale&) const; /* * @brief Look up a string in a message catalog. * * This function retrieves and returns a message from a catalog in an * implementation-defined manner. This function is a hook for derived * classes to change the value returned. * * For gnu, @a __set and @a __msgid are ignored. Returns gettext(s). * For default, returns s. For ieee, returns catgets(c,set,msgid,s). * * @param __c The catalog to access. * @param __set Implementation-defined. * @param __msgid Implementation-defined. * @param __s Default return value if retrieval fails. * @return Retrieved message or @a __s if get fails. */ virtual string_type do_get(catalog, int, int, const string_type& __dfault) const; /* * @brief Close a message catalog. * * @param __c The catalog to close. */ virtual void do_close(catalog) const; // Returns a locale and codeset-converted string, given a char* message. char* _M_convert_to_char(const string_type& __msg) const { // XXX return reinterpret_cast<char*>(const_cast<_CharT*>(__msg.c_str())); } // Returns a locale and codeset-converted string, given a char* message. string_type _M_convert_from_char(char*) const { // XXX return string_type(); } }; template<typename _CharT> locale::id messages<_CharT>::id; /// Specializations for required instantiations. template<> string messages<char>::do_get(catalog, int, int, const string&) const; #ifdef _GLIBCXX_USE_WCHAR_T template<> wstring messages<wchar_t>::do_get(catalog, int, int, const wstring&) const; #endif /// class messages_byname [22.2.7.2]. template<typename _CharT> class messages_byname : public messages<_CharT> { public: typedef _CharT char_type; typedef basic_string<_CharT> string_type; explicit messages_byname(const char* __s, size_t __refs = 0); protected: virtual ~messages_byname() { } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace // Include host and configuration specific messages functions. #include <bits/messages_members.h> // 22.2.1.5 Template class codecvt #include <bits/codecvt.h> #include <bits/locale_facets_nonio.tcc> #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/shared_ptr.h�������������������������������������������������������������������������0000644�����������������00000045737�14763166030�0011060 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// shared_ptr and weak_ptr implementation -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. // GCC Note: Based on files from version 1.32.0 of the Boost library. // shared_count.hpp // Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. // shared_ptr.hpp // Copyright (C) 1998, 1999 Greg Colvin and Beman Dawes. // Copyright (C) 2001, 2002, 2003 Peter Dimov // weak_ptr.hpp // Copyright (C) 2001, 2002, 2003 Peter Dimov // enable_shared_from_this.hpp // Copyright (C) 2002 Peter Dimov // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) /** @file bits/shared_ptr.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{memory} */ #ifndef _SHARED_PTR_H #define _SHARED_PTR_H 1 #include <bits/shared_ptr_base.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup pointer_abstractions * @{ */ /// 2.2.3.7 shared_ptr I/O template<typename _Ch, typename _Tr, typename _Tp, _Lock_policy _Lp> inline std::basic_ostream<_Ch, _Tr>& operator<<(std::basic_ostream<_Ch, _Tr>& __os, const __shared_ptr<_Tp, _Lp>& __p) { __os << __p.get(); return __os; } /// 2.2.3.10 shared_ptr get_deleter (experimental) template<typename _Del, typename _Tp, _Lock_policy _Lp> inline _Del* get_deleter(const __shared_ptr<_Tp, _Lp>& __p) noexcept { #ifdef __GXX_RTTI return static_cast<_Del*>(__p._M_get_deleter(typeid(_Del))); #else return 0; #endif } /** * @brief A smart pointer with reference-counted copy semantics. * * The object pointed to is deleted when the last shared_ptr pointing to * it is destroyed or reset. */ template<typename _Tp> class shared_ptr : public __shared_ptr<_Tp> { public: /** * @brief Construct an empty %shared_ptr. * @post use_count()==0 && get()==0 */ constexpr shared_ptr() noexcept : __shared_ptr<_Tp>() { } shared_ptr(const shared_ptr&) noexcept = default; /** * @brief Construct a %shared_ptr that owns the pointer @a __p. * @param __p A pointer that is convertible to element_type*. * @post use_count() == 1 && get() == __p * @throw std::bad_alloc, in which case @c delete @a __p is called. */ template<typename _Tp1> explicit shared_ptr(_Tp1* __p) : __shared_ptr<_Tp>(__p) { } /** * @brief Construct a %shared_ptr that owns the pointer @a __p * and the deleter @a __d. * @param __p A pointer. * @param __d A deleter. * @post use_count() == 1 && get() == __p * @throw std::bad_alloc, in which case @a __d(__p) is called. * * Requirements: _Deleter's copy constructor and destructor must * not throw * * __shared_ptr will release __p by calling __d(__p) */ template<typename _Tp1, typename _Deleter> shared_ptr(_Tp1* __p, _Deleter __d) : __shared_ptr<_Tp>(__p, __d) { } /** * @brief Construct a %shared_ptr that owns a null pointer * and the deleter @a __d. * @param __p A null pointer constant. * @param __d A deleter. * @post use_count() == 1 && get() == __p * @throw std::bad_alloc, in which case @a __d(__p) is called. * * Requirements: _Deleter's copy constructor and destructor must * not throw * * The last owner will call __d(__p) */ template<typename _Deleter> shared_ptr(nullptr_t __p, _Deleter __d) : __shared_ptr<_Tp>(__p, __d) { } /** * @brief Construct a %shared_ptr that owns the pointer @a __p * and the deleter @a __d. * @param __p A pointer. * @param __d A deleter. * @param __a An allocator. * @post use_count() == 1 && get() == __p * @throw std::bad_alloc, in which case @a __d(__p) is called. * * Requirements: _Deleter's copy constructor and destructor must * not throw _Alloc's copy constructor and destructor must not * throw. * * __shared_ptr will release __p by calling __d(__p) */ template<typename _Tp1, typename _Deleter, typename _Alloc> shared_ptr(_Tp1* __p, _Deleter __d, _Alloc __a) : __shared_ptr<_Tp>(__p, __d, std::move(__a)) { } /** * @brief Construct a %shared_ptr that owns a null pointer * and the deleter @a __d. * @param __p A null pointer constant. * @param __d A deleter. * @param __a An allocator. * @post use_count() == 1 && get() == __p * @throw std::bad_alloc, in which case @a __d(__p) is called. * * Requirements: _Deleter's copy constructor and destructor must * not throw _Alloc's copy constructor and destructor must not * throw. * * The last owner will call __d(__p) */ template<typename _Deleter, typename _Alloc> shared_ptr(nullptr_t __p, _Deleter __d, _Alloc __a) : __shared_ptr<_Tp>(__p, __d, std::move(__a)) { } // Aliasing constructor /** * @brief Constructs a %shared_ptr instance that stores @a __p * and shares ownership with @a __r. * @param __r A %shared_ptr. * @param __p A pointer that will remain valid while @a *__r is valid. * @post get() == __p && use_count() == __r.use_count() * * This can be used to construct a @c shared_ptr to a sub-object * of an object managed by an existing @c shared_ptr. * * @code * shared_ptr< pair<int,int> > pii(new pair<int,int>()); * shared_ptr<int> pi(pii, &pii->first); * assert(pii.use_count() == 2); * @endcode */ template<typename _Tp1> shared_ptr(const shared_ptr<_Tp1>& __r, _Tp* __p) noexcept : __shared_ptr<_Tp>(__r, __p) { } /** * @brief If @a __r is empty, constructs an empty %shared_ptr; * otherwise construct a %shared_ptr that shares ownership * with @a __r. * @param __r A %shared_ptr. * @post get() == __r.get() && use_count() == __r.use_count() */ template<typename _Tp1, typename = typename std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type> shared_ptr(const shared_ptr<_Tp1>& __r) noexcept : __shared_ptr<_Tp>(__r) { } /** * @brief Move-constructs a %shared_ptr instance from @a __r. * @param __r A %shared_ptr rvalue. * @post *this contains the old value of @a __r, @a __r is empty. */ shared_ptr(shared_ptr&& __r) noexcept : __shared_ptr<_Tp>(std::move(__r)) { } /** * @brief Move-constructs a %shared_ptr instance from @a __r. * @param __r A %shared_ptr rvalue. * @post *this contains the old value of @a __r, @a __r is empty. */ template<typename _Tp1, typename = typename std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type> shared_ptr(shared_ptr<_Tp1>&& __r) noexcept : __shared_ptr<_Tp>(std::move(__r)) { } /** * @brief Constructs a %shared_ptr that shares ownership with @a __r * and stores a copy of the pointer stored in @a __r. * @param __r A weak_ptr. * @post use_count() == __r.use_count() * @throw bad_weak_ptr when __r.expired(), * in which case the constructor has no effect. */ template<typename _Tp1> explicit shared_ptr(const weak_ptr<_Tp1>& __r) : __shared_ptr<_Tp>(__r) { } #if _GLIBCXX_USE_DEPRECATED template<typename _Tp1> shared_ptr(std::auto_ptr<_Tp1>&& __r); #endif template<typename _Tp1, typename _Del> shared_ptr(std::unique_ptr<_Tp1, _Del>&& __r) : __shared_ptr<_Tp>(std::move(__r)) { } /** * @brief Construct an empty %shared_ptr. * @param __p A null pointer constant. * @post use_count() == 0 && get() == nullptr */ constexpr shared_ptr(nullptr_t __p) noexcept : __shared_ptr<_Tp>(__p) { } shared_ptr& operator=(const shared_ptr&) noexcept = default; template<typename _Tp1> shared_ptr& operator=(const shared_ptr<_Tp1>& __r) noexcept { this->__shared_ptr<_Tp>::operator=(__r); return *this; } #if _GLIBCXX_USE_DEPRECATED template<typename _Tp1> shared_ptr& operator=(std::auto_ptr<_Tp1>&& __r) { this->__shared_ptr<_Tp>::operator=(std::move(__r)); return *this; } #endif shared_ptr& operator=(shared_ptr&& __r) noexcept { this->__shared_ptr<_Tp>::operator=(std::move(__r)); return *this; } template<class _Tp1> shared_ptr& operator=(shared_ptr<_Tp1>&& __r) noexcept { this->__shared_ptr<_Tp>::operator=(std::move(__r)); return *this; } template<typename _Tp1, typename _Del> shared_ptr& operator=(std::unique_ptr<_Tp1, _Del>&& __r) { this->__shared_ptr<_Tp>::operator=(std::move(__r)); return *this; } private: // This constructor is non-standard, it is used by allocate_shared. template<typename _Alloc, typename... _Args> shared_ptr(_Sp_make_shared_tag __tag, const _Alloc& __a, _Args&&... __args) : __shared_ptr<_Tp>(__tag, __a, std::forward<_Args>(__args)...) { } template<typename _Tp1, typename _Alloc, typename... _Args> friend shared_ptr<_Tp1> allocate_shared(const _Alloc& __a, _Args&&... __args); }; // 20.7.2.2.7 shared_ptr comparisons template<typename _Tp1, typename _Tp2> inline bool operator==(const shared_ptr<_Tp1>& __a, const shared_ptr<_Tp2>& __b) noexcept { return __a.get() == __b.get(); } template<typename _Tp> inline bool operator==(const shared_ptr<_Tp>& __a, nullptr_t) noexcept { return !__a; } template<typename _Tp> inline bool operator==(nullptr_t, const shared_ptr<_Tp>& __a) noexcept { return !__a; } template<typename _Tp1, typename _Tp2> inline bool operator!=(const shared_ptr<_Tp1>& __a, const shared_ptr<_Tp2>& __b) noexcept { return __a.get() != __b.get(); } template<typename _Tp> inline bool operator!=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept { return (bool)__a; } template<typename _Tp> inline bool operator!=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept { return (bool)__a; } template<typename _Tp1, typename _Tp2> inline bool operator<(const shared_ptr<_Tp1>& __a, const shared_ptr<_Tp2>& __b) noexcept { typedef typename std::common_type<_Tp1*, _Tp2*>::type _CT; return std::less<_CT>()(__a.get(), __b.get()); } template<typename _Tp> inline bool operator<(const shared_ptr<_Tp>& __a, nullptr_t) noexcept { return std::less<_Tp*>()(__a.get(), nullptr); } template<typename _Tp> inline bool operator<(nullptr_t, const shared_ptr<_Tp>& __a) noexcept { return std::less<_Tp*>()(nullptr, __a.get()); } template<typename _Tp1, typename _Tp2> inline bool operator<=(const shared_ptr<_Tp1>& __a, const shared_ptr<_Tp2>& __b) noexcept { return !(__b < __a); } template<typename _Tp> inline bool operator<=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept { return !(nullptr < __a); } template<typename _Tp> inline bool operator<=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept { return !(__a < nullptr); } template<typename _Tp1, typename _Tp2> inline bool operator>(const shared_ptr<_Tp1>& __a, const shared_ptr<_Tp2>& __b) noexcept { return (__b < __a); } template<typename _Tp> inline bool operator>(const shared_ptr<_Tp>& __a, nullptr_t) noexcept { return std::less<_Tp*>()(nullptr, __a.get()); } template<typename _Tp> inline bool operator>(nullptr_t, const shared_ptr<_Tp>& __a) noexcept { return std::less<_Tp*>()(__a.get(), nullptr); } template<typename _Tp1, typename _Tp2> inline bool operator>=(const shared_ptr<_Tp1>& __a, const shared_ptr<_Tp2>& __b) noexcept { return !(__a < __b); } template<typename _Tp> inline bool operator>=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept { return !(__a < nullptr); } template<typename _Tp> inline bool operator>=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept { return !(nullptr < __a); } template<typename _Tp> struct less<shared_ptr<_Tp>> : public _Sp_less<shared_ptr<_Tp>> { }; // 20.7.2.2.8 shared_ptr specialized algorithms. template<typename _Tp> inline void swap(shared_ptr<_Tp>& __a, shared_ptr<_Tp>& __b) noexcept { __a.swap(__b); } // 20.7.2.2.9 shared_ptr casts. template<typename _Tp, typename _Tp1> inline shared_ptr<_Tp> static_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept { return shared_ptr<_Tp>(__r, static_cast<_Tp*>(__r.get())); } template<typename _Tp, typename _Tp1> inline shared_ptr<_Tp> const_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept { return shared_ptr<_Tp>(__r, const_cast<_Tp*>(__r.get())); } template<typename _Tp, typename _Tp1> inline shared_ptr<_Tp> dynamic_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept { if (_Tp* __p = dynamic_cast<_Tp*>(__r.get())) return shared_ptr<_Tp>(__r, __p); return shared_ptr<_Tp>(); } /** * @brief A smart pointer with weak semantics. * * With forwarding constructors and assignment operators. */ template<typename _Tp> class weak_ptr : public __weak_ptr<_Tp> { public: constexpr weak_ptr() noexcept : __weak_ptr<_Tp>() { } template<typename _Tp1, typename = typename std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type> weak_ptr(const weak_ptr<_Tp1>& __r) noexcept : __weak_ptr<_Tp>(__r) { } template<typename _Tp1, typename = typename std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type> weak_ptr(const shared_ptr<_Tp1>& __r) noexcept : __weak_ptr<_Tp>(__r) { } template<typename _Tp1> weak_ptr& operator=(const weak_ptr<_Tp1>& __r) noexcept { this->__weak_ptr<_Tp>::operator=(__r); return *this; } template<typename _Tp1> weak_ptr& operator=(const shared_ptr<_Tp1>& __r) noexcept { this->__weak_ptr<_Tp>::operator=(__r); return *this; } shared_ptr<_Tp> lock() const noexcept { #ifdef __GTHREADS if (this->expired()) return shared_ptr<_Tp>(); __try { return shared_ptr<_Tp>(*this); } __catch(const bad_weak_ptr&) { return shared_ptr<_Tp>(); } #else return this->expired() ? shared_ptr<_Tp>() : shared_ptr<_Tp>(*this); #endif } }; // 20.7.2.3.6 weak_ptr specialized algorithms. template<typename _Tp> inline void swap(weak_ptr<_Tp>& __a, weak_ptr<_Tp>& __b) noexcept { __a.swap(__b); } /// Primary template owner_less template<typename _Tp> struct owner_less; /// Partial specialization of owner_less for shared_ptr. template<typename _Tp> struct owner_less<shared_ptr<_Tp>> : public _Sp_owner_less<shared_ptr<_Tp>, weak_ptr<_Tp>> { }; /// Partial specialization of owner_less for weak_ptr. template<typename _Tp> struct owner_less<weak_ptr<_Tp>> : public _Sp_owner_less<weak_ptr<_Tp>, shared_ptr<_Tp>> { }; /** * @brief Base class allowing use of member function shared_from_this. */ template<typename _Tp> class enable_shared_from_this { protected: constexpr enable_shared_from_this() noexcept { } enable_shared_from_this(const enable_shared_from_this&) noexcept { } enable_shared_from_this& operator=(const enable_shared_from_this&) noexcept { return *this; } ~enable_shared_from_this() { } public: shared_ptr<_Tp> shared_from_this() { return shared_ptr<_Tp>(this->_M_weak_this); } shared_ptr<const _Tp> shared_from_this() const { return shared_ptr<const _Tp>(this->_M_weak_this); } private: template<typename _Tp1> void _M_weak_assign(_Tp1* __p, const __shared_count<>& __n) const noexcept { _M_weak_this._M_assign(__p, __n); } template<typename _Tp1> friend void __enable_shared_from_this_helper(const __shared_count<>& __pn, const enable_shared_from_this* __pe, const _Tp1* __px) noexcept { if (__pe != 0) __pe->_M_weak_assign(const_cast<_Tp1*>(__px), __pn); } mutable weak_ptr<_Tp> _M_weak_this; }; /** * @brief Create an object that is owned by a shared_ptr. * @param __a An allocator. * @param __args Arguments for the @a _Tp object's constructor. * @return A shared_ptr that owns the newly created object. * @throw An exception thrown from @a _Alloc::allocate or from the * constructor of @a _Tp. * * A copy of @a __a will be used to allocate memory for the shared_ptr * and the new object. */ template<typename _Tp, typename _Alloc, typename... _Args> inline shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&&... __args) { return shared_ptr<_Tp>(_Sp_make_shared_tag(), __a, std::forward<_Args>(__args)...); } /** * @brief Create an object that is owned by a shared_ptr. * @param __args Arguments for the @a _Tp object's constructor. * @return A shared_ptr that owns the newly created object. * @throw std::bad_alloc, or an exception thrown from the * constructor of @a _Tp. */ template<typename _Tp, typename... _Args> inline shared_ptr<_Tp> make_shared(_Args&&... __args) { typedef typename std::remove_const<_Tp>::type _Tp_nc; return std::allocate_shared<_Tp>(std::allocator<_Tp_nc>(), std::forward<_Args>(__args)...); } /// std::hash specialization for shared_ptr. template<typename _Tp> struct hash<shared_ptr<_Tp>> : public __hash_base<size_t, shared_ptr<_Tp>> { size_t operator()(const shared_ptr<_Tp>& __s) const noexcept { return std::hash<_Tp*>()(__s.get()); } }; // @} group pointer_abstractions _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // _SHARED_PTR_H ���������������������������������c++/4.8.2/bits/regex_nfa.h��������������������������������������������������������������������������0000644�����������������00000025236�14763166030�0010653 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// class template regex -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** * @file bits/regex_nfa.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{regex} */ namespace std _GLIBCXX_VISIBILITY(default) { namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup regex-detail * @{ */ /// Base class for, um, automata. Could be an NFA or a DFA. Your choice. class _Automaton { public: typedef unsigned int _SizeT; public: virtual ~_Automaton() { } virtual _SizeT _M_sub_count() const = 0; #ifdef _GLIBCXX_DEBUG virtual std::ostream& _M_dot(std::ostream& __ostr) const = 0; #endif }; /// Generic shared pointer to an automaton. typedef std::shared_ptr<_Automaton> _AutomatonPtr; /// Operation codes that define the type of transitions within the base NFA /// that represents the regular expression. enum _Opcode { _S_opcode_unknown = 0, _S_opcode_alternative = 1, _S_opcode_subexpr_begin = 4, _S_opcode_subexpr_end = 5, _S_opcode_match = 100, _S_opcode_accept = 255 }; /// Provides a generic facade for a templated match_results. struct _Results { virtual void _M_set_pos(int __i, int __j, const _PatternCursor& __p) = 0; virtual void _M_set_matched(int __i, bool __is_matched) = 0; }; /// Tags current state (for subexpr begin/end). typedef std::function<void (const _PatternCursor&, _Results&)> _Tagger; /// Start state tag. template<typename _FwdIterT, typename _TraitsT> struct _StartTagger { explicit _StartTagger(int __i) : _M_index(__i) { } void operator()(const _PatternCursor& __pc, _Results& __r) { __r._M_set_pos(_M_index, 0, __pc); } int _M_index; }; /// End state tag. template<typename _FwdIterT, typename _TraitsT> struct _EndTagger { explicit _EndTagger(int __i) : _M_index(__i) { } void operator()(const _PatternCursor& __pc, _Results& __r) { __r._M_set_pos(_M_index, 1, __pc); } int _M_index; _FwdIterT _M_pos; }; /// Indicates if current state matches cursor current. typedef std::function<bool (const _PatternCursor&)> _Matcher; /// Matches any character inline bool _AnyMatcher(const _PatternCursor&) { return true; } /// Matches a single character template<typename _InIterT, typename _TraitsT> struct _CharMatcher { typedef typename _TraitsT::char_type char_type; explicit _CharMatcher(char_type __c, const _TraitsT& __t = _TraitsT()) : _M_traits(__t), _M_c(_M_traits.translate(__c)) { } bool operator()(const _PatternCursor& __pc) const { typedef const _SpecializedCursor<_InIterT>& _CursorT; _CursorT __c = static_cast<_CursorT>(__pc); return _M_traits.translate(__c._M_current()) == _M_c; } const _TraitsT& _M_traits; char_type _M_c; }; /// Matches a character range (bracket expression) template<typename _InIterT, typename _TraitsT> struct _RangeMatcher { typedef typename _TraitsT::char_type _CharT; typedef std::basic_string<_CharT> _StringT; explicit _RangeMatcher(bool __is_non_matching, const _TraitsT& __t = _TraitsT()) : _M_traits(__t), _M_is_non_matching(__is_non_matching) { } bool operator()(const _PatternCursor& __pc) const { typedef const _SpecializedCursor<_InIterT>& _CursorT; _CursorT __c = static_cast<_CursorT>(__pc); return true; } void _M_add_char(_CharT __c) { } void _M_add_collating_element(const _StringT& __s) { } void _M_add_equivalence_class(const _StringT& __s) { } void _M_add_character_class(const _StringT& __s) { } void _M_make_range() { } const _TraitsT& _M_traits; bool _M_is_non_matching; }; /// Identifies a state in the NFA. typedef int _StateIdT; /// The special case in which a state identifier is not an index. static const _StateIdT _S_invalid_state_id = -1; /** * @brief struct _State * * An individual state in an NFA * * In this case a "state" is an entry in the NFA definition coupled * with its outgoing transition(s). All states have a single outgoing * transition, except for accepting states (which have no outgoing * transitions) and alt states, which have two outgoing transitions. */ struct _State { typedef int _OpcodeT; _OpcodeT _M_opcode; // type of outgoing transition _StateIdT _M_next; // outgoing transition _StateIdT _M_alt; // for _S_opcode_alternative unsigned int _M_subexpr; // for _S_opcode_subexpr_* _Tagger _M_tagger; // for _S_opcode_subexpr_* _Matcher _M_matches; // for _S_opcode_match explicit _State(_OpcodeT __opcode) : _M_opcode(__opcode), _M_next(_S_invalid_state_id) { } _State(const _Matcher& __m) : _M_opcode(_S_opcode_match), _M_next(_S_invalid_state_id), _M_matches(__m) { } _State(_OpcodeT __opcode, unsigned int __s, const _Tagger& __t) : _M_opcode(__opcode), _M_next(_S_invalid_state_id), _M_subexpr(__s), _M_tagger(__t) { } _State(_StateIdT __next, _StateIdT __alt) : _M_opcode(_S_opcode_alternative), _M_next(__next), _M_alt(__alt) { } #ifdef _GLIBCXX_DEBUG std::ostream& _M_print(std::ostream& ostr) const; // Prints graphviz dot commands for state. std::ostream& _M_dot(std::ostream& __ostr, _StateIdT __id) const; #endif }; /// The Grep Matcher works on sets of states. Here are sets of states. typedef std::set<_StateIdT> _StateSet; /** * @brief struct _Nfa * * A collection of all states making up an NFA. * * An NFA is a 4-tuple M = (K, S, s, F), where * K is a finite set of states, * S is the alphabet of the NFA, * s is the initial state, * F is a set of final (accepting) states. * * This NFA class is templated on S, a type that will hold values of the * underlying alphabet (without regard to semantics of that alphabet). The * other elements of the tuple are generated during construction of the NFA * and are available through accessor member functions. */ class _Nfa : public _Automaton, public std::vector<_State> { public: typedef _State _StateT; typedef unsigned int _SizeT; typedef regex_constants::syntax_option_type _FlagT; _Nfa(_FlagT __f) : _M_flags(__f), _M_start_state(0), _M_subexpr_count(0) { } ~_Nfa() { } _FlagT _M_options() const { return _M_flags; } _StateIdT _M_start() const { return _M_start_state; } const _StateSet& _M_final_states() const { return _M_accepting_states; } _SizeT _M_sub_count() const { return _M_subexpr_count; } _StateIdT _M_insert_accept() { this->push_back(_StateT(_S_opcode_accept)); _M_accepting_states.insert(this->size()-1); return this->size()-1; } _StateIdT _M_insert_alt(_StateIdT __next, _StateIdT __alt) { this->push_back(_StateT(__next, __alt)); return this->size()-1; } _StateIdT _M_insert_matcher(_Matcher __m) { this->push_back(_StateT(__m)); return this->size()-1; } _StateIdT _M_insert_subexpr_begin(const _Tagger& __t) { this->push_back(_StateT(_S_opcode_subexpr_begin, _M_subexpr_count++, __t)); return this->size()-1; } _StateIdT _M_insert_subexpr_end(unsigned int __i, const _Tagger& __t) { this->push_back(_StateT(_S_opcode_subexpr_end, __i, __t)); return this->size()-1; } #ifdef _GLIBCXX_DEBUG std::ostream& _M_dot(std::ostream& __ostr) const; #endif private: _FlagT _M_flags; _StateIdT _M_start_state; _StateSet _M_accepting_states; _SizeT _M_subexpr_count; }; /// Describes a sequence of one or more %_State, its current start /// and end(s). This structure contains fragments of an NFA during /// construction. class _StateSeq { public: // Constructs a single-node sequence _StateSeq(_Nfa& __ss, _StateIdT __s, _StateIdT __e = _S_invalid_state_id) : _M_nfa(__ss), _M_start(__s), _M_end1(__s), _M_end2(__e) { } // Constructs a split sequence from two other sequencces _StateSeq(const _StateSeq& __e1, const _StateSeq& __e2) : _M_nfa(__e1._M_nfa), _M_start(_M_nfa._M_insert_alt(__e1._M_start, __e2._M_start)), _M_end1(__e1._M_end1), _M_end2(__e2._M_end1) { } // Constructs a split sequence from a single sequence _StateSeq(const _StateSeq& __e, _StateIdT __id) : _M_nfa(__e._M_nfa), _M_start(_M_nfa._M_insert_alt(__id, __e._M_start)), _M_end1(__id), _M_end2(__e._M_end1) { } // Constructs a copy of a %_StateSeq _StateSeq(const _StateSeq& __rhs) : _M_nfa(__rhs._M_nfa), _M_start(__rhs._M_start), _M_end1(__rhs._M_end1), _M_end2(__rhs._M_end2) { } _StateSeq& operator=(const _StateSeq& __rhs); _StateIdT _M_front() const { return _M_start; } // Extends a sequence by one. void _M_push_back(_StateIdT __id); // Extends and maybe joins a sequence. void _M_append(_StateIdT __id); void _M_append(_StateSeq& __rhs); // Clones an entire sequence. _StateIdT _M_clone(); private: _Nfa& _M_nfa; _StateIdT _M_start; _StateIdT _M_end1; _StateIdT _M_end2; }; //@} regex-detail _GLIBCXX_END_NAMESPACE_VERSION } // namespace __detail } // namespace std #include <bits/regex_nfa.tcc> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_iterator_base_types.h������������������������������������������������������������0000644�����������������00000020304�14763166030�0013635 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Types used in iterator implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996-1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_iterator_base_types.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{iterator} * * This file contains all of the general iterator-related utility types, * such as iterator_traits and struct iterator. */ #ifndef _STL_ITERATOR_BASE_TYPES_H #define _STL_ITERATOR_BASE_TYPES_H 1 #pragma GCC system_header #include <bits/c++config.h> #if __cplusplus >= 201103L # include <type_traits> // For _GLIBCXX_HAS_NESTED_TYPE, is_convertible #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup iterators Iterators * Abstractions for uniform iterating through various underlying types. */ //@{ /** * @defgroup iterator_tags Iterator Tags * These are empty types, used to distinguish different iterators. The * distinction is not made by what they contain, but simply by what they * are. Different underlying algorithms can then be used based on the * different operations supported by different iterator types. */ //@{ /// Marking input iterators. struct input_iterator_tag { }; /// Marking output iterators. struct output_iterator_tag { }; /// Forward iterators support a superset of input iterator operations. struct forward_iterator_tag : public input_iterator_tag { }; /// Bidirectional iterators support a superset of forward iterator /// operations. struct bidirectional_iterator_tag : public forward_iterator_tag { }; /// Random-access iterators support a superset of bidirectional /// iterator operations. struct random_access_iterator_tag : public bidirectional_iterator_tag { }; //@} /** * @brief Common %iterator class. * * This class does nothing but define nested typedefs. %Iterator classes * can inherit from this class to save some work. The typedefs are then * used in specializations and overloading. * * In particular, there are no default implementations of requirements * such as @c operator++ and the like. (How could there be?) */ template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t, typename _Pointer = _Tp*, typename _Reference = _Tp&> struct iterator { /// One of the @link iterator_tags tag types@endlink. typedef _Category iterator_category; /// The type "pointed to" by the iterator. typedef _Tp value_type; /// Distance between iterators is represented as this type. typedef _Distance difference_type; /// This type represents a pointer-to-value_type. typedef _Pointer pointer; /// This type represents a reference-to-value_type. typedef _Reference reference; }; /** * @brief Traits class for iterators. * * This class does nothing but define nested typedefs. The general * version simply @a forwards the nested typedefs from the Iterator * argument. Specialized versions for pointers and pointers-to-const * provide tighter, more correct semantics. */ #if __cplusplus >= 201103L _GLIBCXX_HAS_NESTED_TYPE(iterator_category) template<typename _Iterator, bool = __has_iterator_category<_Iterator>::value> struct __iterator_traits { }; template<typename _Iterator> struct __iterator_traits<_Iterator, true> { typedef typename _Iterator::iterator_category iterator_category; typedef typename _Iterator::value_type value_type; typedef typename _Iterator::difference_type difference_type; typedef typename _Iterator::pointer pointer; typedef typename _Iterator::reference reference; }; template<typename _Iterator> struct iterator_traits : public __iterator_traits<_Iterator> { }; #else template<typename _Iterator> struct iterator_traits { typedef typename _Iterator::iterator_category iterator_category; typedef typename _Iterator::value_type value_type; typedef typename _Iterator::difference_type difference_type; typedef typename _Iterator::pointer pointer; typedef typename _Iterator::reference reference; }; #endif /// Partial specialization for pointer types. template<typename _Tp> struct iterator_traits<_Tp*> { typedef random_access_iterator_tag iterator_category; typedef _Tp value_type; typedef ptrdiff_t difference_type; typedef _Tp* pointer; typedef _Tp& reference; }; /// Partial specialization for const pointer types. template<typename _Tp> struct iterator_traits<const _Tp*> { typedef random_access_iterator_tag iterator_category; typedef _Tp value_type; typedef ptrdiff_t difference_type; typedef const _Tp* pointer; typedef const _Tp& reference; }; /** * This function is not a part of the C++ standard but is syntactic * sugar for internal library use only. */ template<typename _Iter> inline typename iterator_traits<_Iter>::iterator_category __iterator_category(const _Iter&) { return typename iterator_traits<_Iter>::iterator_category(); } //@} // If _Iterator has a base returns it otherwise _Iterator is returned // untouched template<typename _Iterator, bool _HasBase> struct _Iter_base { typedef _Iterator iterator_type; static iterator_type _S_base(_Iterator __it) { return __it; } }; template<typename _Iterator> struct _Iter_base<_Iterator, true> { typedef typename _Iterator::iterator_type iterator_type; static iterator_type _S_base(_Iterator __it) { return __it.base(); } }; #if __cplusplus >= 201103L template<typename _InIter> using _RequireInputIter = typename enable_if<is_convertible<typename iterator_traits<_InIter>::iterator_category, input_iterator_tag>::value>::type; #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _STL_ITERATOR_BASE_TYPES_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_iterator.h�����������������������������������������������������������������������0000644�����������������00000107421�14763166030�0011425 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Iterators -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996-1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_iterator.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{iterator} * * This file implements reverse_iterator, back_insert_iterator, * front_insert_iterator, insert_iterator, __normal_iterator, and their * supporting functions and overloaded operators. */ #ifndef _STL_ITERATOR_H #define _STL_ITERATOR_H 1 #include <bits/cpp_type_traits.h> #include <ext/type_traits.h> #include <bits/move.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup iterators * @{ */ // 24.4.1 Reverse iterators /** * Bidirectional and random access iterators have corresponding reverse * %iterator adaptors that iterate through the data structure in the * opposite direction. They have the same signatures as the corresponding * iterators. The fundamental relation between a reverse %iterator and its * corresponding %iterator @c i is established by the identity: * @code * &*(reverse_iterator(i)) == &*(i - 1) * @endcode * * <em>This mapping is dictated by the fact that while there is always a * pointer past the end of an array, there might not be a valid pointer * before the beginning of an array.</em> [24.4.1]/1,2 * * Reverse iterators can be tricky and surprising at first. Their * semantics make sense, however, and the trickiness is a side effect of * the requirement that the iterators must be safe. */ template<typename _Iterator> class reverse_iterator : public iterator<typename iterator_traits<_Iterator>::iterator_category, typename iterator_traits<_Iterator>::value_type, typename iterator_traits<_Iterator>::difference_type, typename iterator_traits<_Iterator>::pointer, typename iterator_traits<_Iterator>::reference> { protected: _Iterator current; typedef iterator_traits<_Iterator> __traits_type; public: typedef _Iterator iterator_type; typedef typename __traits_type::difference_type difference_type; typedef typename __traits_type::pointer pointer; typedef typename __traits_type::reference reference; /** * The default constructor value-initializes member @p current. * If it is a pointer, that means it is zero-initialized. */ // _GLIBCXX_RESOLVE_LIB_DEFECTS // 235 No specification of default ctor for reverse_iterator reverse_iterator() : current() { } /** * This %iterator will move in the opposite direction that @p x does. */ explicit reverse_iterator(iterator_type __x) : current(__x) { } /** * The copy constructor is normal. */ reverse_iterator(const reverse_iterator& __x) : current(__x.current) { } /** * A %reverse_iterator across other types can be copied if the * underlying %iterator can be converted to the type of @c current. */ template<typename _Iter> reverse_iterator(const reverse_iterator<_Iter>& __x) : current(__x.base()) { } /** * @return @c current, the %iterator used for underlying work. */ iterator_type base() const { return current; } /** * @return A reference to the value at @c --current * * This requires that @c --current is dereferenceable. * * @warning This implementation requires that for an iterator of the * underlying iterator type, @c x, a reference obtained by * @c *x remains valid after @c x has been modified or * destroyed. This is a bug: http://gcc.gnu.org/PR51823 */ reference operator*() const { _Iterator __tmp = current; return *--__tmp; } /** * @return A pointer to the value at @c --current * * This requires that @c --current is dereferenceable. */ pointer operator->() const { return &(operator*()); } /** * @return @c *this * * Decrements the underlying iterator. */ reverse_iterator& operator++() { --current; return *this; } /** * @return The original value of @c *this * * Decrements the underlying iterator. */ reverse_iterator operator++(int) { reverse_iterator __tmp = *this; --current; return __tmp; } /** * @return @c *this * * Increments the underlying iterator. */ reverse_iterator& operator--() { ++current; return *this; } /** * @return A reverse_iterator with the previous value of @c *this * * Increments the underlying iterator. */ reverse_iterator operator--(int) { reverse_iterator __tmp = *this; ++current; return __tmp; } /** * @return A reverse_iterator that refers to @c current - @a __n * * The underlying iterator must be a Random Access Iterator. */ reverse_iterator operator+(difference_type __n) const { return reverse_iterator(current - __n); } /** * @return *this * * Moves the underlying iterator backwards @a __n steps. * The underlying iterator must be a Random Access Iterator. */ reverse_iterator& operator+=(difference_type __n) { current -= __n; return *this; } /** * @return A reverse_iterator that refers to @c current - @a __n * * The underlying iterator must be a Random Access Iterator. */ reverse_iterator operator-(difference_type __n) const { return reverse_iterator(current + __n); } /** * @return *this * * Moves the underlying iterator forwards @a __n steps. * The underlying iterator must be a Random Access Iterator. */ reverse_iterator& operator-=(difference_type __n) { current += __n; return *this; } /** * @return The value at @c current - @a __n - 1 * * The underlying iterator must be a Random Access Iterator. */ reference operator[](difference_type __n) const { return *(*this + __n); } }; //@{ /** * @param __x A %reverse_iterator. * @param __y A %reverse_iterator. * @return A simple bool. * * Reverse iterators forward many operations to their underlying base() * iterators. Others are implemented in terms of one another. * */ template<typename _Iterator> inline bool operator==(const reverse_iterator<_Iterator>& __x, const reverse_iterator<_Iterator>& __y) { return __x.base() == __y.base(); } template<typename _Iterator> inline bool operator<(const reverse_iterator<_Iterator>& __x, const reverse_iterator<_Iterator>& __y) { return __y.base() < __x.base(); } template<typename _Iterator> inline bool operator!=(const reverse_iterator<_Iterator>& __x, const reverse_iterator<_Iterator>& __y) { return !(__x == __y); } template<typename _Iterator> inline bool operator>(const reverse_iterator<_Iterator>& __x, const reverse_iterator<_Iterator>& __y) { return __y < __x; } template<typename _Iterator> inline bool operator<=(const reverse_iterator<_Iterator>& __x, const reverse_iterator<_Iterator>& __y) { return !(__y < __x); } template<typename _Iterator> inline bool operator>=(const reverse_iterator<_Iterator>& __x, const reverse_iterator<_Iterator>& __y) { return !(__x < __y); } template<typename _Iterator> inline typename reverse_iterator<_Iterator>::difference_type operator-(const reverse_iterator<_Iterator>& __x, const reverse_iterator<_Iterator>& __y) { return __y.base() - __x.base(); } template<typename _Iterator> inline reverse_iterator<_Iterator> operator+(typename reverse_iterator<_Iterator>::difference_type __n, const reverse_iterator<_Iterator>& __x) { return reverse_iterator<_Iterator>(__x.base() - __n); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 280. Comparison of reverse_iterator to const reverse_iterator. template<typename _IteratorL, typename _IteratorR> inline bool operator==(const reverse_iterator<_IteratorL>& __x, const reverse_iterator<_IteratorR>& __y) { return __x.base() == __y.base(); } template<typename _IteratorL, typename _IteratorR> inline bool operator<(const reverse_iterator<_IteratorL>& __x, const reverse_iterator<_IteratorR>& __y) { return __y.base() < __x.base(); } template<typename _IteratorL, typename _IteratorR> inline bool operator!=(const reverse_iterator<_IteratorL>& __x, const reverse_iterator<_IteratorR>& __y) { return !(__x == __y); } template<typename _IteratorL, typename _IteratorR> inline bool operator>(const reverse_iterator<_IteratorL>& __x, const reverse_iterator<_IteratorR>& __y) { return __y < __x; } template<typename _IteratorL, typename _IteratorR> inline bool operator<=(const reverse_iterator<_IteratorL>& __x, const reverse_iterator<_IteratorR>& __y) { return !(__y < __x); } template<typename _IteratorL, typename _IteratorR> inline bool operator>=(const reverse_iterator<_IteratorL>& __x, const reverse_iterator<_IteratorR>& __y) { return !(__x < __y); } template<typename _IteratorL, typename _IteratorR> #if __cplusplus >= 201103L // DR 685. inline auto operator-(const reverse_iterator<_IteratorL>& __x, const reverse_iterator<_IteratorR>& __y) -> decltype(__y.base() - __x.base()) #else inline typename reverse_iterator<_IteratorL>::difference_type operator-(const reverse_iterator<_IteratorL>& __x, const reverse_iterator<_IteratorR>& __y) #endif { return __y.base() - __x.base(); } //@} // 24.4.2.2.1 back_insert_iterator /** * @brief Turns assignment into insertion. * * These are output iterators, constructed from a container-of-T. * Assigning a T to the iterator appends it to the container using * push_back. * * Tip: Using the back_inserter function to create these iterators can * save typing. */ template<typename _Container> class back_insert_iterator : public iterator<output_iterator_tag, void, void, void, void> { protected: _Container* container; public: /// A nested typedef for the type of whatever container you used. typedef _Container container_type; /// The only way to create this %iterator is with a container. explicit back_insert_iterator(_Container& __x) : container(&__x) { } /** * @param __value An instance of whatever type * container_type::const_reference is; presumably a * reference-to-const T for container<T>. * @return This %iterator, for chained operations. * * This kind of %iterator doesn't really have a @a position in the * container (you can think of the position as being permanently at * the end, if you like). Assigning a value to the %iterator will * always append the value to the end of the container. */ #if __cplusplus < 201103L back_insert_iterator& operator=(typename _Container::const_reference __value) { container->push_back(__value); return *this; } #else back_insert_iterator& operator=(const typename _Container::value_type& __value) { container->push_back(__value); return *this; } back_insert_iterator& operator=(typename _Container::value_type&& __value) { container->push_back(std::move(__value)); return *this; } #endif /// Simply returns *this. back_insert_iterator& operator*() { return *this; } /// Simply returns *this. (This %iterator does not @a move.) back_insert_iterator& operator++() { return *this; } /// Simply returns *this. (This %iterator does not @a move.) back_insert_iterator operator++(int) { return *this; } }; /** * @param __x A container of arbitrary type. * @return An instance of back_insert_iterator working on @p __x. * * This wrapper function helps in creating back_insert_iterator instances. * Typing the name of the %iterator requires knowing the precise full * type of the container, which can be tedious and impedes generic * programming. Using this function lets you take advantage of automatic * template parameter deduction, making the compiler match the correct * types for you. */ template<typename _Container> inline back_insert_iterator<_Container> back_inserter(_Container& __x) { return back_insert_iterator<_Container>(__x); } /** * @brief Turns assignment into insertion. * * These are output iterators, constructed from a container-of-T. * Assigning a T to the iterator prepends it to the container using * push_front. * * Tip: Using the front_inserter function to create these iterators can * save typing. */ template<typename _Container> class front_insert_iterator : public iterator<output_iterator_tag, void, void, void, void> { protected: _Container* container; public: /// A nested typedef for the type of whatever container you used. typedef _Container container_type; /// The only way to create this %iterator is with a container. explicit front_insert_iterator(_Container& __x) : container(&__x) { } /** * @param __value An instance of whatever type * container_type::const_reference is; presumably a * reference-to-const T for container<T>. * @return This %iterator, for chained operations. * * This kind of %iterator doesn't really have a @a position in the * container (you can think of the position as being permanently at * the front, if you like). Assigning a value to the %iterator will * always prepend the value to the front of the container. */ #if __cplusplus < 201103L front_insert_iterator& operator=(typename _Container::const_reference __value) { container->push_front(__value); return *this; } #else front_insert_iterator& operator=(const typename _Container::value_type& __value) { container->push_front(__value); return *this; } front_insert_iterator& operator=(typename _Container::value_type&& __value) { container->push_front(std::move(__value)); return *this; } #endif /// Simply returns *this. front_insert_iterator& operator*() { return *this; } /// Simply returns *this. (This %iterator does not @a move.) front_insert_iterator& operator++() { return *this; } /// Simply returns *this. (This %iterator does not @a move.) front_insert_iterator operator++(int) { return *this; } }; /** * @param __x A container of arbitrary type. * @return An instance of front_insert_iterator working on @p x. * * This wrapper function helps in creating front_insert_iterator instances. * Typing the name of the %iterator requires knowing the precise full * type of the container, which can be tedious and impedes generic * programming. Using this function lets you take advantage of automatic * template parameter deduction, making the compiler match the correct * types for you. */ template<typename _Container> inline front_insert_iterator<_Container> front_inserter(_Container& __x) { return front_insert_iterator<_Container>(__x); } /** * @brief Turns assignment into insertion. * * These are output iterators, constructed from a container-of-T. * Assigning a T to the iterator inserts it in the container at the * %iterator's position, rather than overwriting the value at that * position. * * (Sequences will actually insert a @e copy of the value before the * %iterator's position.) * * Tip: Using the inserter function to create these iterators can * save typing. */ template<typename _Container> class insert_iterator : public iterator<output_iterator_tag, void, void, void, void> { protected: _Container* container; typename _Container::iterator iter; public: /// A nested typedef for the type of whatever container you used. typedef _Container container_type; /** * The only way to create this %iterator is with a container and an * initial position (a normal %iterator into the container). */ insert_iterator(_Container& __x, typename _Container::iterator __i) : container(&__x), iter(__i) {} /** * @param __value An instance of whatever type * container_type::const_reference is; presumably a * reference-to-const T for container<T>. * @return This %iterator, for chained operations. * * This kind of %iterator maintains its own position in the * container. Assigning a value to the %iterator will insert the * value into the container at the place before the %iterator. * * The position is maintained such that subsequent assignments will * insert values immediately after one another. For example, * @code * // vector v contains A and Z * * insert_iterator i (v, ++v.begin()); * i = 1; * i = 2; * i = 3; * * // vector v contains A, 1, 2, 3, and Z * @endcode */ #if __cplusplus < 201103L insert_iterator& operator=(typename _Container::const_reference __value) { iter = container->insert(iter, __value); ++iter; return *this; } #else insert_iterator& operator=(const typename _Container::value_type& __value) { iter = container->insert(iter, __value); ++iter; return *this; } insert_iterator& operator=(typename _Container::value_type&& __value) { iter = container->insert(iter, std::move(__value)); ++iter; return *this; } #endif /// Simply returns *this. insert_iterator& operator*() { return *this; } /// Simply returns *this. (This %iterator does not @a move.) insert_iterator& operator++() { return *this; } /// Simply returns *this. (This %iterator does not @a move.) insert_iterator& operator++(int) { return *this; } }; /** * @param __x A container of arbitrary type. * @return An instance of insert_iterator working on @p __x. * * This wrapper function helps in creating insert_iterator instances. * Typing the name of the %iterator requires knowing the precise full * type of the container, which can be tedious and impedes generic * programming. Using this function lets you take advantage of automatic * template parameter deduction, making the compiler match the correct * types for you. */ template<typename _Container, typename _Iterator> inline insert_iterator<_Container> inserter(_Container& __x, _Iterator __i) { return insert_iterator<_Container>(__x, typename _Container::iterator(__i)); } // @} group iterators _GLIBCXX_END_NAMESPACE_VERSION } // namespace namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // This iterator adapter is @a normal in the sense that it does not // change the semantics of any of the operators of its iterator // parameter. Its primary purpose is to convert an iterator that is // not a class, e.g. a pointer, into an iterator that is a class. // The _Container parameter exists solely so that different containers // using this template can instantiate different types, even if the // _Iterator parameter is the same. using std::iterator_traits; using std::iterator; template<typename _Iterator, typename _Container> class __normal_iterator { protected: _Iterator _M_current; typedef iterator_traits<_Iterator> __traits_type; public: typedef _Iterator iterator_type; typedef typename __traits_type::iterator_category iterator_category; typedef typename __traits_type::value_type value_type; typedef typename __traits_type::difference_type difference_type; typedef typename __traits_type::reference reference; typedef typename __traits_type::pointer pointer; _GLIBCXX_CONSTEXPR __normal_iterator() : _M_current(_Iterator()) { } explicit __normal_iterator(const _Iterator& __i) : _M_current(__i) { } // Allow iterator to const_iterator conversion template<typename _Iter> __normal_iterator(const __normal_iterator<_Iter, typename __enable_if< (std::__are_same<_Iter, typename _Container::pointer>::__value), _Container>::__type>& __i) : _M_current(__i.base()) { } // Forward iterator requirements reference operator*() const { return *_M_current; } pointer operator->() const { return _M_current; } __normal_iterator& operator++() { ++_M_current; return *this; } __normal_iterator operator++(int) { return __normal_iterator(_M_current++); } // Bidirectional iterator requirements __normal_iterator& operator--() { --_M_current; return *this; } __normal_iterator operator--(int) { return __normal_iterator(_M_current--); } // Random access iterator requirements reference operator[](const difference_type& __n) const { return _M_current[__n]; } __normal_iterator& operator+=(const difference_type& __n) { _M_current += __n; return *this; } __normal_iterator operator+(const difference_type& __n) const { return __normal_iterator(_M_current + __n); } __normal_iterator& operator-=(const difference_type& __n) { _M_current -= __n; return *this; } __normal_iterator operator-(const difference_type& __n) const { return __normal_iterator(_M_current - __n); } const _Iterator& base() const { return _M_current; } }; // Note: In what follows, the left- and right-hand-side iterators are // allowed to vary in types (conceptually in cv-qualification) so that // comparison between cv-qualified and non-cv-qualified iterators be // valid. However, the greedy and unfriendly operators in std::rel_ops // will make overload resolution ambiguous (when in scope) if we don't // provide overloads whose operands are of the same type. Can someone // remind me what generic programming is about? -- Gaby // Forward iterator requirements template<typename _IteratorL, typename _IteratorR, typename _Container> inline bool operator==(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) { return __lhs.base() == __rhs.base(); } template<typename _Iterator, typename _Container> inline bool operator==(const __normal_iterator<_Iterator, _Container>& __lhs, const __normal_iterator<_Iterator, _Container>& __rhs) { return __lhs.base() == __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Container> inline bool operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) { return __lhs.base() != __rhs.base(); } template<typename _Iterator, typename _Container> inline bool operator!=(const __normal_iterator<_Iterator, _Container>& __lhs, const __normal_iterator<_Iterator, _Container>& __rhs) { return __lhs.base() != __rhs.base(); } // Random access iterator requirements template<typename _IteratorL, typename _IteratorR, typename _Container> inline bool operator<(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) { return __lhs.base() < __rhs.base(); } template<typename _Iterator, typename _Container> inline bool operator<(const __normal_iterator<_Iterator, _Container>& __lhs, const __normal_iterator<_Iterator, _Container>& __rhs) { return __lhs.base() < __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Container> inline bool operator>(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) { return __lhs.base() > __rhs.base(); } template<typename _Iterator, typename _Container> inline bool operator>(const __normal_iterator<_Iterator, _Container>& __lhs, const __normal_iterator<_Iterator, _Container>& __rhs) { return __lhs.base() > __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Container> inline bool operator<=(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) { return __lhs.base() <= __rhs.base(); } template<typename _Iterator, typename _Container> inline bool operator<=(const __normal_iterator<_Iterator, _Container>& __lhs, const __normal_iterator<_Iterator, _Container>& __rhs) { return __lhs.base() <= __rhs.base(); } template<typename _IteratorL, typename _IteratorR, typename _Container> inline bool operator>=(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) { return __lhs.base() >= __rhs.base(); } template<typename _Iterator, typename _Container> inline bool operator>=(const __normal_iterator<_Iterator, _Container>& __lhs, const __normal_iterator<_Iterator, _Container>& __rhs) { return __lhs.base() >= __rhs.base(); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // According to the resolution of DR179 not only the various comparison // operators but also operator- must accept mixed iterator/const_iterator // parameters. template<typename _IteratorL, typename _IteratorR, typename _Container> #if __cplusplus >= 201103L // DR 685. inline auto operator-(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) -> decltype(__lhs.base() - __rhs.base()) #else inline typename __normal_iterator<_IteratorL, _Container>::difference_type operator-(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) #endif { return __lhs.base() - __rhs.base(); } template<typename _Iterator, typename _Container> inline typename __normal_iterator<_Iterator, _Container>::difference_type operator-(const __normal_iterator<_Iterator, _Container>& __lhs, const __normal_iterator<_Iterator, _Container>& __rhs) { return __lhs.base() - __rhs.base(); } template<typename _Iterator, typename _Container> inline __normal_iterator<_Iterator, _Container> operator+(typename __normal_iterator<_Iterator, _Container>::difference_type __n, const __normal_iterator<_Iterator, _Container>& __i) { return __normal_iterator<_Iterator, _Container>(__i.base() + __n); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #if __cplusplus >= 201103L namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup iterators * @{ */ // 24.4.3 Move iterators /** * Class template move_iterator is an iterator adapter with the same * behavior as the underlying iterator except that its dereference * operator implicitly converts the value returned by the underlying * iterator's dereference operator to an rvalue reference. Some * generic algorithms can be called with move iterators to replace * copying with moving. */ template<typename _Iterator> class move_iterator { protected: _Iterator _M_current; typedef iterator_traits<_Iterator> __traits_type; public: typedef _Iterator iterator_type; typedef typename __traits_type::iterator_category iterator_category; typedef typename __traits_type::value_type value_type; typedef typename __traits_type::difference_type difference_type; // NB: DR 680. typedef _Iterator pointer; typedef value_type&& reference; move_iterator() : _M_current() { } explicit move_iterator(iterator_type __i) : _M_current(__i) { } template<typename _Iter> move_iterator(const move_iterator<_Iter>& __i) : _M_current(__i.base()) { } iterator_type base() const { return _M_current; } reference operator*() const { return std::move(*_M_current); } pointer operator->() const { return _M_current; } move_iterator& operator++() { ++_M_current; return *this; } move_iterator operator++(int) { move_iterator __tmp = *this; ++_M_current; return __tmp; } move_iterator& operator--() { --_M_current; return *this; } move_iterator operator--(int) { move_iterator __tmp = *this; --_M_current; return __tmp; } move_iterator operator+(difference_type __n) const { return move_iterator(_M_current + __n); } move_iterator& operator+=(difference_type __n) { _M_current += __n; return *this; } move_iterator operator-(difference_type __n) const { return move_iterator(_M_current - __n); } move_iterator& operator-=(difference_type __n) { _M_current -= __n; return *this; } reference operator[](difference_type __n) const { return std::move(_M_current[__n]); } }; // Note: See __normal_iterator operators note from Gaby to understand // why there are always 2 versions for most of the move_iterator // operators. template<typename _IteratorL, typename _IteratorR> inline bool operator==(const move_iterator<_IteratorL>& __x, const move_iterator<_IteratorR>& __y) { return __x.base() == __y.base(); } template<typename _Iterator> inline bool operator==(const move_iterator<_Iterator>& __x, const move_iterator<_Iterator>& __y) { return __x.base() == __y.base(); } template<typename _IteratorL, typename _IteratorR> inline bool operator!=(const move_iterator<_IteratorL>& __x, const move_iterator<_IteratorR>& __y) { return !(__x == __y); } template<typename _Iterator> inline bool operator!=(const move_iterator<_Iterator>& __x, const move_iterator<_Iterator>& __y) { return !(__x == __y); } template<typename _IteratorL, typename _IteratorR> inline bool operator<(const move_iterator<_IteratorL>& __x, const move_iterator<_IteratorR>& __y) { return __x.base() < __y.base(); } template<typename _Iterator> inline bool operator<(const move_iterator<_Iterator>& __x, const move_iterator<_Iterator>& __y) { return __x.base() < __y.base(); } template<typename _IteratorL, typename _IteratorR> inline bool operator<=(const move_iterator<_IteratorL>& __x, const move_iterator<_IteratorR>& __y) { return !(__y < __x); } template<typename _Iterator> inline bool operator<=(const move_iterator<_Iterator>& __x, const move_iterator<_Iterator>& __y) { return !(__y < __x); } template<typename _IteratorL, typename _IteratorR> inline bool operator>(const move_iterator<_IteratorL>& __x, const move_iterator<_IteratorR>& __y) { return __y < __x; } template<typename _Iterator> inline bool operator>(const move_iterator<_Iterator>& __x, const move_iterator<_Iterator>& __y) { return __y < __x; } template<typename _IteratorL, typename _IteratorR> inline bool operator>=(const move_iterator<_IteratorL>& __x, const move_iterator<_IteratorR>& __y) { return !(__x < __y); } template<typename _Iterator> inline bool operator>=(const move_iterator<_Iterator>& __x, const move_iterator<_Iterator>& __y) { return !(__x < __y); } // DR 685. template<typename _IteratorL, typename _IteratorR> inline auto operator-(const move_iterator<_IteratorL>& __x, const move_iterator<_IteratorR>& __y) -> decltype(__x.base() - __y.base()) { return __x.base() - __y.base(); } template<typename _Iterator> inline auto operator-(const move_iterator<_Iterator>& __x, const move_iterator<_Iterator>& __y) -> decltype(__x.base() - __y.base()) { return __x.base() - __y.base(); } template<typename _Iterator> inline move_iterator<_Iterator> operator+(typename move_iterator<_Iterator>::difference_type __n, const move_iterator<_Iterator>& __x) { return __x + __n; } template<typename _Iterator> inline move_iterator<_Iterator> make_move_iterator(_Iterator __i) { return move_iterator<_Iterator>(__i); } template<typename _Iterator, typename _ReturnType = typename conditional<__move_if_noexcept_cond <typename iterator_traits<_Iterator>::value_type>::value, _Iterator, move_iterator<_Iterator>>::type> inline _ReturnType __make_move_if_noexcept_iterator(_Iterator __i) { return _ReturnType(__i); } // @} group iterators _GLIBCXX_END_NAMESPACE_VERSION } // namespace #define _GLIBCXX_MAKE_MOVE_ITERATOR(_Iter) std::make_move_iterator(_Iter) #define _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(_Iter) \ std::__make_move_if_noexcept_iterator(_Iter) #else #define _GLIBCXX_MAKE_MOVE_ITERATOR(_Iter) (_Iter) #define _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(_Iter) (_Iter) #endif // C++11 #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/ptr_traits.h�������������������������������������������������������������������������0000644�����������������00000012256�14763166030�0011106 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Pointer Traits -*- C++ -*- // Copyright (C) 2011-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/ptr_traits.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{memory} */ #ifndef _PTR_TRAITS_H #define _PTR_TRAITS_H 1 #if __cplusplus >= 201103L #include <type_traits> // For _GLIBCXX_HAS_NESTED_TYPE namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_HAS_NESTED_TYPE(element_type) _GLIBCXX_HAS_NESTED_TYPE(difference_type) template<typename _Tp, bool = __has_element_type<_Tp>::value> struct __ptrtr_elt_type; template<typename _Tp> struct __ptrtr_elt_type<_Tp, true> { typedef typename _Tp::element_type __type; }; template<template<typename, typename...> class _SomePtr, typename _Tp, typename... _Args> struct __ptrtr_elt_type<_SomePtr<_Tp, _Args...>, false> { typedef _Tp __type; }; template<typename _Tp, bool = __has_difference_type<_Tp>::value> struct __ptrtr_diff_type { typedef typename _Tp::difference_type __type; }; template<typename _Tp> struct __ptrtr_diff_type<_Tp, false> { typedef ptrdiff_t __type; }; template<typename _Ptr, typename _Up> class __ptrtr_rebind_helper { template<typename _Ptr2, typename _Up2> static constexpr bool _S_chk(typename _Ptr2::template rebind<_Up2>*) { return true; } template<typename, typename> static constexpr bool _S_chk(...) { return false; } public: static const bool __value = _S_chk<_Ptr, _Up>(nullptr); }; template<typename _Ptr, typename _Up> const bool __ptrtr_rebind_helper<_Ptr, _Up>::__value; template<typename _Tp, typename _Up, bool = __ptrtr_rebind_helper<_Tp, _Up>::__value> struct __ptrtr_rebind; template<typename _Tp, typename _Up> struct __ptrtr_rebind<_Tp, _Up, true> { typedef typename _Tp::template rebind<_Up> __type; }; template<template<typename, typename...> class _SomePtr, typename _Up, typename _Tp, typename... _Args> struct __ptrtr_rebind<_SomePtr<_Tp, _Args...>, _Up, false> { typedef _SomePtr<_Up, _Args...> __type; }; template<typename _Tp, typename = typename remove_cv<_Tp>::type> struct __ptrtr_not_void { typedef _Tp __type; }; template<typename _Tp> struct __ptrtr_not_void<_Tp, void> { struct __type { }; }; template<typename _Ptr> class __ptrtr_pointer_to { typedef typename __ptrtr_elt_type<_Ptr>::__type __orig_type; typedef typename __ptrtr_not_void<__orig_type>::__type __element_type; public: static _Ptr pointer_to(__element_type& __e) { return _Ptr::pointer_to(__e); } }; /** * @brief Uniform interface to all pointer-like types * @ingroup pointer_abstractions */ template<typename _Ptr> struct pointer_traits : __ptrtr_pointer_to<_Ptr> { /// The pointer type typedef _Ptr pointer; /// The type pointed to typedef typename __ptrtr_elt_type<_Ptr>::__type element_type; /// Type used to represent the difference between two pointers typedef typename __ptrtr_diff_type<_Ptr>::__type difference_type; template<typename _Up> using rebind = typename __ptrtr_rebind<_Ptr, _Up>::__type; }; /** * @brief Partial specialization for built-in pointers. * @ingroup pointer_abstractions */ template<typename _Tp> struct pointer_traits<_Tp*> { /// The pointer type typedef _Tp* pointer; /// The type pointed to typedef _Tp element_type; /// Type used to represent the difference between two pointers typedef ptrdiff_t difference_type; template<typename _Up> using rebind = _Up*; /** * @brief Obtain a pointer to an object * @param __r A reference to an object of type @c element_type * @return @c addressof(__r) */ static pointer pointer_to(typename __ptrtr_not_void<element_type>::__type& __r) noexcept { return std::addressof(__r); } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_multimap.h�����������������������������������������������������������������������0000644�����������������00000103677�14763166030�0011435 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Multimap implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_multimap.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{map} */ #ifndef _STL_MULTIMAP_H #define _STL_MULTIMAP_H 1 #include <bits/concept_check.h> #if __cplusplus >= 201103L #include <initializer_list> #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /** * @brief A standard container made up of (key,value) pairs, which can be * retrieved based on a key, in logarithmic time. * * @ingroup associative_containers * * @tparam _Key Type of key objects. * @tparam _Tp Type of mapped objects. * @tparam _Compare Comparison function object type, defaults to less<_Key>. * @tparam _Alloc Allocator type, defaults to * allocator<pair<const _Key, _Tp>. * * Meets the requirements of a <a href="tables.html#65">container</a>, a * <a href="tables.html#66">reversible container</a>, and an * <a href="tables.html#69">associative container</a> (using equivalent * keys). For a @c multimap<Key,T> the key_type is Key, the mapped_type * is T, and the value_type is std::pair<const Key,T>. * * Multimaps support bidirectional iterators. * * The private tree data is declared exactly the same way for map and * multimap; the distinction is made entirely in how the tree functions are * called (*_unique versus *_equal, same as the standard). */ template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > > class multimap { public: typedef _Key key_type; typedef _Tp mapped_type; typedef std::pair<const _Key, _Tp> value_type; typedef _Compare key_compare; typedef _Alloc allocator_type; private: // concept requirements typedef typename _Alloc::value_type _Alloc_value_type; __glibcxx_class_requires(_Tp, _SGIAssignableConcept) __glibcxx_class_requires4(_Compare, bool, _Key, _Key, _BinaryFunctionConcept) __glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept) public: class value_compare : public std::binary_function<value_type, value_type, bool> { friend class multimap<_Key, _Tp, _Compare, _Alloc>; protected: _Compare comp; value_compare(_Compare __c) : comp(__c) { } public: bool operator()(const value_type& __x, const value_type& __y) const { return comp(__x.first, __y.first); } }; private: /// This turns a red-black tree into a [multi]map. typedef typename _Alloc::template rebind<value_type>::other _Pair_alloc_type; typedef _Rb_tree<key_type, value_type, _Select1st<value_type>, key_compare, _Pair_alloc_type> _Rep_type; /// The actual tree structure. _Rep_type _M_t; public: // many of these are specified differently in ISO, but the following are // "functionally equivalent" typedef typename _Pair_alloc_type::pointer pointer; typedef typename _Pair_alloc_type::const_pointer const_pointer; typedef typename _Pair_alloc_type::reference reference; typedef typename _Pair_alloc_type::const_reference const_reference; typedef typename _Rep_type::iterator iterator; typedef typename _Rep_type::const_iterator const_iterator; typedef typename _Rep_type::size_type size_type; typedef typename _Rep_type::difference_type difference_type; typedef typename _Rep_type::reverse_iterator reverse_iterator; typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; // [23.3.2] construct/copy/destroy // (get_allocator() is also listed in this section) /** * @brief Default constructor creates no elements. */ multimap() : _M_t() { } /** * @brief Creates a %multimap with no elements. * @param __comp A comparison object. * @param __a An allocator object. */ explicit multimap(const _Compare& __comp, const allocator_type& __a = allocator_type()) : _M_t(__comp, _Pair_alloc_type(__a)) { } /** * @brief %Multimap copy constructor. * @param __x A %multimap of identical element and allocator types. * * The newly-created %multimap uses a copy of the allocation object * used by @a __x. */ multimap(const multimap& __x) : _M_t(__x._M_t) { } #if __cplusplus >= 201103L /** * @brief %Multimap move constructor. * @param __x A %multimap of identical element and allocator types. * * The newly-created %multimap contains the exact contents of @a __x. * The contents of @a __x are a valid, but unspecified %multimap. */ multimap(multimap&& __x) noexcept(is_nothrow_copy_constructible<_Compare>::value) : _M_t(std::move(__x._M_t)) { } /** * @brief Builds a %multimap from an initializer_list. * @param __l An initializer_list. * @param __comp A comparison functor. * @param __a An allocator object. * * Create a %multimap consisting of copies of the elements from * the initializer_list. This is linear in N if the list is already * sorted, and NlogN otherwise (where N is @a __l.size()). */ multimap(initializer_list<value_type> __l, const _Compare& __comp = _Compare(), const allocator_type& __a = allocator_type()) : _M_t(__comp, _Pair_alloc_type(__a)) { _M_t._M_insert_equal(__l.begin(), __l.end()); } #endif /** * @brief Builds a %multimap from a range. * @param __first An input iterator. * @param __last An input iterator. * * Create a %multimap consisting of copies of the elements from * [__first,__last). This is linear in N if the range is already sorted, * and NlogN otherwise (where N is distance(__first,__last)). */ template<typename _InputIterator> multimap(_InputIterator __first, _InputIterator __last) : _M_t() { _M_t._M_insert_equal(__first, __last); } /** * @brief Builds a %multimap from a range. * @param __first An input iterator. * @param __last An input iterator. * @param __comp A comparison functor. * @param __a An allocator object. * * Create a %multimap consisting of copies of the elements from * [__first,__last). This is linear in N if the range is already sorted, * and NlogN otherwise (where N is distance(__first,__last)). */ template<typename _InputIterator> multimap(_InputIterator __first, _InputIterator __last, const _Compare& __comp, const allocator_type& __a = allocator_type()) : _M_t(__comp, _Pair_alloc_type(__a)) { _M_t._M_insert_equal(__first, __last); } // FIXME There is no dtor declared, but we should have something generated // by Doxygen. I don't know what tags to add to this paragraph to make // that happen: /** * The dtor only erases the elements, and note that if the elements * themselves are pointers, the pointed-to memory is not touched in any * way. Managing the pointer is the user's responsibility. */ /** * @brief %Multimap assignment operator. * @param __x A %multimap of identical element and allocator types. * * All the elements of @a __x are copied, but unlike the copy * constructor, the allocator object is not copied. */ multimap& operator=(const multimap& __x) { _M_t = __x._M_t; return *this; } #if __cplusplus >= 201103L /** * @brief %Multimap move assignment operator. * @param __x A %multimap of identical element and allocator types. * * The contents of @a __x are moved into this multimap (without copying). * @a __x is a valid, but unspecified multimap. */ multimap& operator=(multimap&& __x) { // NB: DR 1204. // NB: DR 675. this->clear(); this->swap(__x); return *this; } /** * @brief %Multimap list assignment operator. * @param __l An initializer_list. * * This function fills a %multimap with copies of the elements * in the initializer list @a __l. * * Note that the assignment completely changes the %multimap and * that the resulting %multimap's size is the same as the number * of elements assigned. Old data may be lost. */ multimap& operator=(initializer_list<value_type> __l) { this->clear(); this->insert(__l.begin(), __l.end()); return *this; } #endif /// Get a copy of the memory allocation object. allocator_type get_allocator() const _GLIBCXX_NOEXCEPT { return allocator_type(_M_t.get_allocator()); } // iterators /** * Returns a read/write iterator that points to the first pair in the * %multimap. Iteration is done in ascending order according to the * keys. */ iterator begin() _GLIBCXX_NOEXCEPT { return _M_t.begin(); } /** * Returns a read-only (constant) iterator that points to the first pair * in the %multimap. Iteration is done in ascending order according to * the keys. */ const_iterator begin() const _GLIBCXX_NOEXCEPT { return _M_t.begin(); } /** * Returns a read/write iterator that points one past the last pair in * the %multimap. Iteration is done in ascending order according to the * keys. */ iterator end() _GLIBCXX_NOEXCEPT { return _M_t.end(); } /** * Returns a read-only (constant) iterator that points one past the last * pair in the %multimap. Iteration is done in ascending order according * to the keys. */ const_iterator end() const _GLIBCXX_NOEXCEPT { return _M_t.end(); } /** * Returns a read/write reverse iterator that points to the last pair in * the %multimap. Iteration is done in descending order according to the * keys. */ reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return _M_t.rbegin(); } /** * Returns a read-only (constant) reverse iterator that points to the * last pair in the %multimap. Iteration is done in descending order * according to the keys. */ const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return _M_t.rbegin(); } /** * Returns a read/write reverse iterator that points to one before the * first pair in the %multimap. Iteration is done in descending order * according to the keys. */ reverse_iterator rend() _GLIBCXX_NOEXCEPT { return _M_t.rend(); } /** * Returns a read-only (constant) reverse iterator that points to one * before the first pair in the %multimap. Iteration is done in * descending order according to the keys. */ const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return _M_t.rend(); } #if __cplusplus >= 201103L /** * Returns a read-only (constant) iterator that points to the first pair * in the %multimap. Iteration is done in ascending order according to * the keys. */ const_iterator cbegin() const noexcept { return _M_t.begin(); } /** * Returns a read-only (constant) iterator that points one past the last * pair in the %multimap. Iteration is done in ascending order according * to the keys. */ const_iterator cend() const noexcept { return _M_t.end(); } /** * Returns a read-only (constant) reverse iterator that points to the * last pair in the %multimap. Iteration is done in descending order * according to the keys. */ const_reverse_iterator crbegin() const noexcept { return _M_t.rbegin(); } /** * Returns a read-only (constant) reverse iterator that points to one * before the first pair in the %multimap. Iteration is done in * descending order according to the keys. */ const_reverse_iterator crend() const noexcept { return _M_t.rend(); } #endif // capacity /** Returns true if the %multimap is empty. */ bool empty() const _GLIBCXX_NOEXCEPT { return _M_t.empty(); } /** Returns the size of the %multimap. */ size_type size() const _GLIBCXX_NOEXCEPT { return _M_t.size(); } /** Returns the maximum size of the %multimap. */ size_type max_size() const _GLIBCXX_NOEXCEPT { return _M_t.max_size(); } // modifiers #if __cplusplus >= 201103L /** * @brief Build and insert a std::pair into the %multimap. * * @param __args Arguments used to generate a new pair instance (see * std::piecewise_contruct for passing arguments to each * part of the pair constructor). * * @return An iterator that points to the inserted (key,value) pair. * * This function builds and inserts a (key, value) %pair into the * %multimap. * Contrary to a std::map the %multimap does not rely on unique keys and * thus multiple pairs with the same key can be inserted. * * Insertion requires logarithmic time. */ template<typename... _Args> iterator emplace(_Args&&... __args) { return _M_t._M_emplace_equal(std::forward<_Args>(__args)...); } /** * @brief Builds and inserts a std::pair into the %multimap. * * @param __pos An iterator that serves as a hint as to where the pair * should be inserted. * @param __args Arguments used to generate a new pair instance (see * std::piecewise_contruct for passing arguments to each * part of the pair constructor). * @return An iterator that points to the inserted (key,value) pair. * * This function inserts a (key, value) pair into the %multimap. * Contrary to a std::map the %multimap does not rely on unique keys and * thus multiple pairs with the same key can be inserted. * Note that the first parameter is only a hint and can potentially * improve the performance of the insertion process. A bad hint would * cause no gains in efficiency. * * For more on @a hinting, see: * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html * * Insertion requires logarithmic time (if the hint is not taken). */ template<typename... _Args> iterator emplace_hint(const_iterator __pos, _Args&&... __args) { return _M_t._M_emplace_hint_equal(__pos, std::forward<_Args>(__args)...); } #endif /** * @brief Inserts a std::pair into the %multimap. * @param __x Pair to be inserted (see std::make_pair for easy creation * of pairs). * @return An iterator that points to the inserted (key,value) pair. * * This function inserts a (key, value) pair into the %multimap. * Contrary to a std::map the %multimap does not rely on unique keys and * thus multiple pairs with the same key can be inserted. * * Insertion requires logarithmic time. */ iterator insert(const value_type& __x) { return _M_t._M_insert_equal(__x); } #if __cplusplus >= 201103L template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> iterator insert(_Pair&& __x) { return _M_t._M_insert_equal(std::forward<_Pair>(__x)); } #endif /** * @brief Inserts a std::pair into the %multimap. * @param __position An iterator that serves as a hint as to where the * pair should be inserted. * @param __x Pair to be inserted (see std::make_pair for easy creation * of pairs). * @return An iterator that points to the inserted (key,value) pair. * * This function inserts a (key, value) pair into the %multimap. * Contrary to a std::map the %multimap does not rely on unique keys and * thus multiple pairs with the same key can be inserted. * Note that the first parameter is only a hint and can potentially * improve the performance of the insertion process. A bad hint would * cause no gains in efficiency. * * For more on @a hinting, see: * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html * * Insertion requires logarithmic time (if the hint is not taken). */ iterator #if __cplusplus >= 201103L insert(const_iterator __position, const value_type& __x) #else insert(iterator __position, const value_type& __x) #endif { return _M_t._M_insert_equal_(__position, __x); } #if __cplusplus >= 201103L template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> iterator insert(const_iterator __position, _Pair&& __x) { return _M_t._M_insert_equal_(__position, std::forward<_Pair>(__x)); } #endif /** * @brief A template function that attempts to insert a range * of elements. * @param __first Iterator pointing to the start of the range to be * inserted. * @param __last Iterator pointing to the end of the range. * * Complexity similar to that of the range constructor. */ template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) { _M_t._M_insert_equal(__first, __last); } #if __cplusplus >= 201103L /** * @brief Attempts to insert a list of std::pairs into the %multimap. * @param __l A std::initializer_list<value_type> of pairs to be * inserted. * * Complexity similar to that of the range constructor. */ void insert(initializer_list<value_type> __l) { this->insert(__l.begin(), __l.end()); } #endif #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 130. Associative erase should return an iterator. /** * @brief Erases an element from a %multimap. * @param __position An iterator pointing to the element to be erased. * @return An iterator pointing to the element immediately following * @a position prior to the element being erased. If no such * element exists, end() is returned. * * This function erases an element, pointed to by the given iterator, * from a %multimap. Note that this function only erases the element, * and that if the element is itself a pointer, the pointed-to memory is * not touched in any way. Managing the pointer is the user's * responsibility. */ iterator erase(const_iterator __position) { return _M_t.erase(__position); } // LWG 2059. _GLIBCXX_ABI_TAG_CXX11 iterator erase(iterator __position) { return _M_t.erase(__position); } #else /** * @brief Erases an element from a %multimap. * @param __position An iterator pointing to the element to be erased. * * This function erases an element, pointed to by the given iterator, * from a %multimap. Note that this function only erases the element, * and that if the element is itself a pointer, the pointed-to memory is * not touched in any way. Managing the pointer is the user's * responsibility. */ void erase(iterator __position) { _M_t.erase(__position); } #endif /** * @brief Erases elements according to the provided key. * @param __x Key of element to be erased. * @return The number of elements erased. * * This function erases all elements located by the given key from a * %multimap. * Note that this function only erases the element, and that if * the element is itself a pointer, the pointed-to memory is not touched * in any way. Managing the pointer is the user's responsibility. */ size_type erase(const key_type& __x) { return _M_t.erase(__x); } #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 130. Associative erase should return an iterator. /** * @brief Erases a [first,last) range of elements from a %multimap. * @param __first Iterator pointing to the start of the range to be * erased. * @param __last Iterator pointing to the end of the range to be * erased . * @return The iterator @a __last. * * This function erases a sequence of elements from a %multimap. * Note that this function only erases the elements, and that if * the elements themselves are pointers, the pointed-to memory is not * touched in any way. Managing the pointer is the user's * responsibility. */ iterator erase(const_iterator __first, const_iterator __last) { return _M_t.erase(__first, __last); } #else // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 130. Associative erase should return an iterator. /** * @brief Erases a [first,last) range of elements from a %multimap. * @param __first Iterator pointing to the start of the range to be * erased. * @param __last Iterator pointing to the end of the range to * be erased. * * This function erases a sequence of elements from a %multimap. * Note that this function only erases the elements, and that if * the elements themselves are pointers, the pointed-to memory is not * touched in any way. Managing the pointer is the user's * responsibility. */ void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last); } #endif /** * @brief Swaps data with another %multimap. * @param __x A %multimap of the same element and allocator types. * * This exchanges the elements between two multimaps in constant time. * (It is only swapping a pointer, an integer, and an instance of * the @c Compare type (which itself is often stateless and empty), so it * should be quite fast.) * Note that the global std::swap() function is specialized such that * std::swap(m1,m2) will feed to this function. */ void swap(multimap& __x) { _M_t.swap(__x._M_t); } /** * Erases all elements in a %multimap. Note that this function only * erases the elements, and that if the elements themselves are pointers, * the pointed-to memory is not touched in any way. Managing the pointer * is the user's responsibility. */ void clear() _GLIBCXX_NOEXCEPT { _M_t.clear(); } // observers /** * Returns the key comparison object out of which the %multimap * was constructed. */ key_compare key_comp() const { return _M_t.key_comp(); } /** * Returns a value comparison object, built from the key comparison * object out of which the %multimap was constructed. */ value_compare value_comp() const { return value_compare(_M_t.key_comp()); } // multimap operations /** * @brief Tries to locate an element in a %multimap. * @param __x Key of (key, value) pair to be located. * @return Iterator pointing to sought-after element, * or end() if not found. * * This function takes a key and tries to locate the element with which * the key matches. If successful the function returns an iterator * pointing to the sought after %pair. If unsuccessful it returns the * past-the-end ( @c end() ) iterator. */ iterator find(const key_type& __x) { return _M_t.find(__x); } /** * @brief Tries to locate an element in a %multimap. * @param __x Key of (key, value) pair to be located. * @return Read-only (constant) iterator pointing to sought-after * element, or end() if not found. * * This function takes a key and tries to locate the element with which * the key matches. If successful the function returns a constant * iterator pointing to the sought after %pair. If unsuccessful it * returns the past-the-end ( @c end() ) iterator. */ const_iterator find(const key_type& __x) const { return _M_t.find(__x); } /** * @brief Finds the number of elements with given key. * @param __x Key of (key, value) pairs to be located. * @return Number of elements with specified key. */ size_type count(const key_type& __x) const { return _M_t.count(__x); } /** * @brief Finds the beginning of a subsequence matching given key. * @param __x Key of (key, value) pair to be located. * @return Iterator pointing to first element equal to or greater * than key, or end(). * * This function returns the first element of a subsequence of elements * that matches the given key. If unsuccessful it returns an iterator * pointing to the first element that has a greater value than given key * or end() if no such element exists. */ iterator lower_bound(const key_type& __x) { return _M_t.lower_bound(__x); } /** * @brief Finds the beginning of a subsequence matching given key. * @param __x Key of (key, value) pair to be located. * @return Read-only (constant) iterator pointing to first element * equal to or greater than key, or end(). * * This function returns the first element of a subsequence of * elements that matches the given key. If unsuccessful the * iterator will point to the next greatest element or, if no * such greater element exists, to end(). */ const_iterator lower_bound(const key_type& __x) const { return _M_t.lower_bound(__x); } /** * @brief Finds the end of a subsequence matching given key. * @param __x Key of (key, value) pair to be located. * @return Iterator pointing to the first element * greater than key, or end(). */ iterator upper_bound(const key_type& __x) { return _M_t.upper_bound(__x); } /** * @brief Finds the end of a subsequence matching given key. * @param __x Key of (key, value) pair to be located. * @return Read-only (constant) iterator pointing to first iterator * greater than key, or end(). */ const_iterator upper_bound(const key_type& __x) const { return _M_t.upper_bound(__x); } /** * @brief Finds a subsequence matching given key. * @param __x Key of (key, value) pairs to be located. * @return Pair of iterators that possibly points to the subsequence * matching given key. * * This function is equivalent to * @code * std::make_pair(c.lower_bound(val), * c.upper_bound(val)) * @endcode * (but is faster than making the calls separately). */ std::pair<iterator, iterator> equal_range(const key_type& __x) { return _M_t.equal_range(__x); } /** * @brief Finds a subsequence matching given key. * @param __x Key of (key, value) pairs to be located. * @return Pair of read-only (constant) iterators that possibly points * to the subsequence matching given key. * * This function is equivalent to * @code * std::make_pair(c.lower_bound(val), * c.upper_bound(val)) * @endcode * (but is faster than making the calls separately). */ std::pair<const_iterator, const_iterator> equal_range(const key_type& __x) const { return _M_t.equal_range(__x); } template<typename _K1, typename _T1, typename _C1, typename _A1> friend bool operator==(const multimap<_K1, _T1, _C1, _A1>&, const multimap<_K1, _T1, _C1, _A1>&); template<typename _K1, typename _T1, typename _C1, typename _A1> friend bool operator<(const multimap<_K1, _T1, _C1, _A1>&, const multimap<_K1, _T1, _C1, _A1>&); }; /** * @brief Multimap equality comparison. * @param __x A %multimap. * @param __y A %multimap of the same type as @a __x. * @return True iff the size and elements of the maps are equal. * * This is an equivalence relation. It is linear in the size of the * multimaps. Multimaps are considered equivalent if their sizes are equal, * and if corresponding elements compare equal. */ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc> inline bool operator==(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, const multimap<_Key, _Tp, _Compare, _Alloc>& __y) { return __x._M_t == __y._M_t; } /** * @brief Multimap ordering relation. * @param __x A %multimap. * @param __y A %multimap of the same type as @a __x. * @return True iff @a x is lexicographically less than @a y. * * This is a total ordering relation. It is linear in the size of the * multimaps. The elements must be comparable with @c <. * * See std::lexicographical_compare() for how the determination is made. */ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc> inline bool operator<(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, const multimap<_Key, _Tp, _Compare, _Alloc>& __y) { return __x._M_t < __y._M_t; } /// Based on operator== template<typename _Key, typename _Tp, typename _Compare, typename _Alloc> inline bool operator!=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, const multimap<_Key, _Tp, _Compare, _Alloc>& __y) { return !(__x == __y); } /// Based on operator< template<typename _Key, typename _Tp, typename _Compare, typename _Alloc> inline bool operator>(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, const multimap<_Key, _Tp, _Compare, _Alloc>& __y) { return __y < __x; } /// Based on operator< template<typename _Key, typename _Tp, typename _Compare, typename _Alloc> inline bool operator<=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, const multimap<_Key, _Tp, _Compare, _Alloc>& __y) { return !(__y < __x); } /// Based on operator< template<typename _Key, typename _Tp, typename _Compare, typename _Alloc> inline bool operator>=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, const multimap<_Key, _Tp, _Compare, _Alloc>& __y) { return !(__x < __y); } /// See std::multimap::swap(). template<typename _Key, typename _Tp, typename _Compare, typename _Alloc> inline void swap(multimap<_Key, _Tp, _Compare, _Alloc>& __x, multimap<_Key, _Tp, _Compare, _Alloc>& __y) { __x.swap(__y); } _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std #endif /* _STL_MULTIMAP_H */ �����������������������������������������������������������������c++/4.8.2/bits/range_access.h�����������������������������������������������������������������������0000644�����������������00000006074�14763166030�0011331 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <range_access.h> -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/range_access.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{iterator} */ #ifndef _GLIBCXX_RANGE_ACCESS_H #define _GLIBCXX_RANGE_ACCESS_H 1 #pragma GCC system_header #if __cplusplus >= 201103L namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Return an iterator pointing to the first element of * the container. * @param __cont Container. */ template<class _Container> inline auto begin(_Container& __cont) -> decltype(__cont.begin()) { return __cont.begin(); } /** * @brief Return an iterator pointing to the first element of * the const container. * @param __cont Container. */ template<class _Container> inline auto begin(const _Container& __cont) -> decltype(__cont.begin()) { return __cont.begin(); } /** * @brief Return an iterator pointing to one past the last element of * the container. * @param __cont Container. */ template<class _Container> inline auto end(_Container& __cont) -> decltype(__cont.end()) { return __cont.end(); } /** * @brief Return an iterator pointing to one past the last element of * the const container. * @param __cont Container. */ template<class _Container> inline auto end(const _Container& __cont) -> decltype(__cont.end()) { return __cont.end(); } /** * @brief Return an iterator pointing to the first element of the array. * @param __arr Array. */ template<class _Tp, size_t _Nm> inline _Tp* begin(_Tp (&__arr)[_Nm]) { return __arr; } /** * @brief Return an iterator pointing to one past the last element * of the array. * @param __arr Array. */ template<class _Tp, size_t _Nm> inline _Tp* end(_Tp (&__arr)[_Nm]) { return __arr + _Nm; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // C++11 #endif // _GLIBCXX_RANGE_ACCESS_H ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/indirect_array.h���������������������������������������������������������������������0000644�����������������00000017265�14763166030�0011717 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// The template and inlines for the -*- C++ -*- indirect_array class. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/indirect_array.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{valarray} */ // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr> #ifndef _INDIRECT_ARRAY_H #define _INDIRECT_ARRAY_H 1 #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup numeric_arrays * @{ */ /** * @brief Reference to arbitrary subset of an array. * * An indirect_array is a reference to the actual elements of an array * specified by an ordered array of indices. The way to get an * indirect_array is to call operator[](valarray<size_t>) on a valarray. * The returned indirect_array then permits carrying operations out on the * referenced subset of elements in the original valarray. * * For example, if an indirect_array is obtained using the array (4,2,0) as * an argument, and then assigned to an array containing (1,2,3), then the * underlying array will have array[0]==3, array[2]==2, and array[4]==1. * * @param Tp Element type. */ template <class _Tp> class indirect_array { public: typedef _Tp value_type; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 253. valarray helper functions are almost entirely useless /// Copy constructor. Both slices refer to the same underlying array. indirect_array(const indirect_array&); /// Assignment operator. Assigns elements to corresponding elements /// of @a a. indirect_array& operator=(const indirect_array&); /// Assign slice elements to corresponding elements of @a v. void operator=(const valarray<_Tp>&) const; /// Multiply slice elements by corresponding elements of @a v. void operator*=(const valarray<_Tp>&) const; /// Divide slice elements by corresponding elements of @a v. void operator/=(const valarray<_Tp>&) const; /// Modulo slice elements by corresponding elements of @a v. void operator%=(const valarray<_Tp>&) const; /// Add corresponding elements of @a v to slice elements. void operator+=(const valarray<_Tp>&) const; /// Subtract corresponding elements of @a v from slice elements. void operator-=(const valarray<_Tp>&) const; /// Logical xor slice elements with corresponding elements of @a v. void operator^=(const valarray<_Tp>&) const; /// Logical and slice elements with corresponding elements of @a v. void operator&=(const valarray<_Tp>&) const; /// Logical or slice elements with corresponding elements of @a v. void operator|=(const valarray<_Tp>&) const; /// Left shift slice elements by corresponding elements of @a v. void operator<<=(const valarray<_Tp>&) const; /// Right shift slice elements by corresponding elements of @a v. void operator>>=(const valarray<_Tp>&) const; /// Assign all slice elements to @a t. void operator= (const _Tp&) const; // ~indirect_array(); template<class _Dom> void operator=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator*=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator/=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator%=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator+=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator-=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator^=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator&=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator|=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator<<=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator>>=(const _Expr<_Dom, _Tp>&) const; private: /// Copy constructor. Both slices refer to the same underlying array. indirect_array(_Array<_Tp>, size_t, _Array<size_t>); friend class valarray<_Tp>; friend class gslice_array<_Tp>; const size_t _M_sz; const _Array<size_t> _M_index; const _Array<_Tp> _M_array; // not implemented indirect_array(); }; template<typename _Tp> inline indirect_array<_Tp>::indirect_array(const indirect_array<_Tp>& __a) : _M_sz(__a._M_sz), _M_index(__a._M_index), _M_array(__a._M_array) {} template<typename _Tp> inline indirect_array<_Tp>::indirect_array(_Array<_Tp> __a, size_t __s, _Array<size_t> __i) : _M_sz(__s), _M_index(__i), _M_array(__a) {} template<typename _Tp> inline indirect_array<_Tp>& indirect_array<_Tp>::operator=(const indirect_array<_Tp>& __a) { std::__valarray_copy(__a._M_array, _M_sz, __a._M_index, _M_array, _M_index); return *this; } template<typename _Tp> inline void indirect_array<_Tp>::operator=(const _Tp& __t) const { std::__valarray_fill(_M_array, _M_index, _M_sz, __t); } template<typename _Tp> inline void indirect_array<_Tp>::operator=(const valarray<_Tp>& __v) const { std::__valarray_copy(_Array<_Tp>(__v), _M_sz, _M_array, _M_index); } template<typename _Tp> template<class _Dom> inline void indirect_array<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e) const { std::__valarray_copy(__e, _M_sz, _M_array, _M_index); } #undef _DEFINE_VALARRAY_OPERATOR #define _DEFINE_VALARRAY_OPERATOR(_Op, _Name) \ template<typename _Tp> \ inline void \ indirect_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const\ { \ _Array_augmented_##_Name(_M_array, _M_index, _Array<_Tp>(__v), _M_sz); \ } \ \ template<typename _Tp> \ template<class _Dom> \ inline void \ indirect_array<_Tp>::operator _Op##=(const _Expr<_Dom,_Tp>& __e) const\ { \ _Array_augmented_##_Name(_M_array, _M_index, __e, _M_sz); \ } _DEFINE_VALARRAY_OPERATOR(*, __multiplies) _DEFINE_VALARRAY_OPERATOR(/, __divides) _DEFINE_VALARRAY_OPERATOR(%, __modulus) _DEFINE_VALARRAY_OPERATOR(+, __plus) _DEFINE_VALARRAY_OPERATOR(-, __minus) _DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor) _DEFINE_VALARRAY_OPERATOR(&, __bitwise_and) _DEFINE_VALARRAY_OPERATOR(|, __bitwise_or) _DEFINE_VALARRAY_OPERATOR(<<, __shift_left) _DEFINE_VALARRAY_OPERATOR(>>, __shift_right) #undef _DEFINE_VALARRAY_OPERATOR // @} group numeric_arrays _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _INDIRECT_ARRAY_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/unordered_map.h����������������������������������������������������������������������0000644�����������������00000137406�14763166030�0011544 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// unordered_map implementation -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/unordered_map.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{unordered_map} */ #ifndef _UNORDERED_MAP_H #define _UNORDERED_MAP_H namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /// Base types for unordered_map. template<bool _Cache> using __umap_traits = __detail::_Hashtable_traits<_Cache, false, true>; template<typename _Key, typename _Tp, typename _Hash = hash<_Key>, typename _Pred = std::equal_to<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >, typename _Tr = __umap_traits<__cache_default<_Key, _Hash>::value>> using __umap_hashtable = _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc, __detail::_Select1st, _Pred, _Hash, __detail::_Mod_range_hashing, __detail::_Default_ranged_hash, __detail::_Prime_rehash_policy, _Tr>; /// Base types for unordered_multimap. template<bool _Cache> using __ummap_traits = __detail::_Hashtable_traits<_Cache, false, false>; template<typename _Key, typename _Tp, typename _Hash = hash<_Key>, typename _Pred = std::equal_to<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >, typename _Tr = __ummap_traits<__cache_default<_Key, _Hash>::value>> using __ummap_hashtable = _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc, __detail::_Select1st, _Pred, _Hash, __detail::_Mod_range_hashing, __detail::_Default_ranged_hash, __detail::_Prime_rehash_policy, _Tr>; /** * @brief A standard container composed of unique keys (containing * at most one of each key value) that associates values of another type * with the keys. * * @ingroup unordered_associative_containers * * @tparam _Key Type of key objects. * @tparam _Tp Type of mapped objects. * @tparam _Hash Hashing function object type, defaults to hash<_Value>. * @tparam _Pred Predicate function object type, defaults * to equal_to<_Value>. * @tparam _Alloc Allocator type, defaults to allocator<_Key>. * * Meets the requirements of a <a href="tables.html#65">container</a>, and * <a href="tables.html#xx">unordered associative container</a> * * The resulting value type of the container is std::pair<const _Key, _Tp>. * * Base is _Hashtable, dispatched at compile time via template * alias __umap_hashtable. */ template<class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = std::equal_to<_Key>, class _Alloc = std::allocator<std::pair<const _Key, _Tp> > > class unordered_map : __check_copy_constructible<_Alloc> { typedef __umap_hashtable<_Key, _Tp, _Hash, _Pred, _Alloc> _Hashtable; _Hashtable _M_h; public: // typedefs: //@{ /// Public typedefs. typedef typename _Hashtable::key_type key_type; typedef typename _Hashtable::value_type value_type; typedef typename _Hashtable::mapped_type mapped_type; typedef typename _Hashtable::hasher hasher; typedef typename _Hashtable::key_equal key_equal; typedef typename _Hashtable::allocator_type allocator_type; //@} //@{ /// Iterator-related typedefs. typedef typename allocator_type::pointer pointer; typedef typename allocator_type::const_pointer const_pointer; typedef typename allocator_type::reference reference; typedef typename allocator_type::const_reference const_reference; typedef typename _Hashtable::iterator iterator; typedef typename _Hashtable::const_iterator const_iterator; typedef typename _Hashtable::local_iterator local_iterator; typedef typename _Hashtable::const_local_iterator const_local_iterator; typedef typename _Hashtable::size_type size_type; typedef typename _Hashtable::difference_type difference_type; //@} //construct/destroy/copy /** * @brief Default constructor creates no elements. * @param __n Initial number of buckets. * @param __hf A hash functor. * @param __eql A key equality functor. * @param __a An allocator object. */ explicit unordered_map(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _M_h(__n, __hf, __eql, __a) { } /** * @brief Builds an %unordered_map from a range. * @param __first An input iterator. * @param __last An input iterator. * @param __n Minimal initial number of buckets. * @param __hf A hash functor. * @param __eql A key equality functor. * @param __a An allocator object. * * Create an %unordered_map consisting of copies of the elements from * [__first,__last). This is linear in N (where N is * distance(__first,__last)). */ template<typename _InputIterator> unordered_map(_InputIterator __f, _InputIterator __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _M_h(__f, __l, __n, __hf, __eql, __a) { } /// Copy constructor. unordered_map(const unordered_map&) = default; /// Move constructor. unordered_map(unordered_map&&) = default; /** * @brief Builds an %unordered_map from an initializer_list. * @param __l An initializer_list. * @param __n Minimal initial number of buckets. * @param __hf A hash functor. * @param __eql A key equality functor. * @param __a An allocator object. * * Create an %unordered_map consisting of copies of the elements in the * list. This is linear in N (where N is @a __l.size()). */ unordered_map(initializer_list<value_type> __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _M_h(__l, __n, __hf, __eql, __a) { } /// Copy assignment operator. unordered_map& operator=(const unordered_map&) = default; /// Move assignment operator. unordered_map& operator=(unordered_map&&) = default; /** * @brief %Unordered_map list assignment operator. * @param __l An initializer_list. * * This function fills an %unordered_map with copies of the elements in * the initializer list @a __l. * * Note that the assignment completely changes the %unordered_map and * that the resulting %unordered_map's size is the same as the number * of elements assigned. Old data may be lost. */ unordered_map& operator=(initializer_list<value_type> __l) { _M_h = __l; return *this; } /// Returns the allocator object with which the %unordered_map was /// constructed. allocator_type get_allocator() const noexcept { return _M_h.get_allocator(); } // size and capacity: /// Returns true if the %unordered_map is empty. bool empty() const noexcept { return _M_h.empty(); } /// Returns the size of the %unordered_map. size_type size() const noexcept { return _M_h.size(); } /// Returns the maximum size of the %unordered_map. size_type max_size() const noexcept { return _M_h.max_size(); } // iterators. /** * Returns a read/write iterator that points to the first element in the * %unordered_map. */ iterator begin() noexcept { return _M_h.begin(); } //@{ /** * Returns a read-only (constant) iterator that points to the first * element in the %unordered_map. */ const_iterator begin() const noexcept { return _M_h.begin(); } const_iterator cbegin() const noexcept { return _M_h.begin(); } //@} /** * Returns a read/write iterator that points one past the last element in * the %unordered_map. */ iterator end() noexcept { return _M_h.end(); } //@{ /** * Returns a read-only (constant) iterator that points one past the last * element in the %unordered_map. */ const_iterator end() const noexcept { return _M_h.end(); } const_iterator cend() const noexcept { return _M_h.end(); } //@} // modifiers. /** * @brief Attempts to build and insert a std::pair into the %unordered_map. * * @param __args Arguments used to generate a new pair instance (see * std::piecewise_contruct for passing arguments to each * part of the pair constructor). * * @return A pair, of which the first element is an iterator that points * to the possibly inserted pair, and the second is a bool that * is true if the pair was actually inserted. * * This function attempts to build and insert a (key, value) %pair into * the %unordered_map. * An %unordered_map relies on unique keys and thus a %pair is only * inserted if its first element (the key) is not already present in the * %unordered_map. * * Insertion requires amortized constant time. */ template<typename... _Args> std::pair<iterator, bool> emplace(_Args&&... __args) { return _M_h.emplace(std::forward<_Args>(__args)...); } /** * @brief Attempts to build and insert a std::pair into the %unordered_map. * * @param __pos An iterator that serves as a hint as to where the pair * should be inserted. * @param __args Arguments used to generate a new pair instance (see * std::piecewise_contruct for passing arguments to each * part of the pair constructor). * @return An iterator that points to the element with key of the * std::pair built from @a __args (may or may not be that * std::pair). * * This function is not concerned about whether the insertion took place, * and thus does not return a boolean like the single-argument emplace() * does. * Note that the first parameter is only a hint and can potentially * improve the performance of the insertion process. A bad hint would * cause no gains in efficiency. * * See * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html * for more on @a hinting. * * Insertion requires amortized constant time. */ template<typename... _Args> iterator emplace_hint(const_iterator __pos, _Args&&... __args) { return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); } //@{ /** * @brief Attempts to insert a std::pair into the %unordered_map. * @param __x Pair to be inserted (see std::make_pair for easy * creation of pairs). * * @return A pair, of which the first element is an iterator that * points to the possibly inserted pair, and the second is * a bool that is true if the pair was actually inserted. * * This function attempts to insert a (key, value) %pair into the * %unordered_map. An %unordered_map relies on unique keys and thus a * %pair is only inserted if its first element (the key) is not already * present in the %unordered_map. * * Insertion requires amortized constant time. */ std::pair<iterator, bool> insert(const value_type& __x) { return _M_h.insert(__x); } template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> std::pair<iterator, bool> insert(_Pair&& __x) { return _M_h.insert(std::forward<_Pair>(__x)); } //@} //@{ /** * @brief Attempts to insert a std::pair into the %unordered_map. * @param __hint An iterator that serves as a hint as to where the * pair should be inserted. * @param __x Pair to be inserted (see std::make_pair for easy creation * of pairs). * @return An iterator that points to the element with key of * @a __x (may or may not be the %pair passed in). * * This function is not concerned about whether the insertion took place, * and thus does not return a boolean like the single-argument insert() * does. Note that the first parameter is only a hint and can * potentially improve the performance of the insertion process. A bad * hint would cause no gains in efficiency. * * See * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html * for more on @a hinting. * * Insertion requires amortized constant time. */ iterator insert(const_iterator __hint, const value_type& __x) { return _M_h.insert(__hint, __x); } template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> iterator insert(const_iterator __hint, _Pair&& __x) { return _M_h.insert(__hint, std::forward<_Pair>(__x)); } //@} /** * @brief A template function that attempts to insert a range of * elements. * @param __first Iterator pointing to the start of the range to be * inserted. * @param __last Iterator pointing to the end of the range. * * Complexity similar to that of the range constructor. */ template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) { _M_h.insert(__first, __last); } /** * @brief Attempts to insert a list of elements into the %unordered_map. * @param __l A std::initializer_list<value_type> of elements * to be inserted. * * Complexity similar to that of the range constructor. */ void insert(initializer_list<value_type> __l) { _M_h.insert(__l); } //@{ /** * @brief Erases an element from an %unordered_map. * @param __position An iterator pointing to the element to be erased. * @return An iterator pointing to the element immediately following * @a __position prior to the element being erased. If no such * element exists, end() is returned. * * This function erases an element, pointed to by the given iterator, * from an %unordered_map. * Note that this function only erases the element, and that if the * element is itself a pointer, the pointed-to memory is not touched in * any way. Managing the pointer is the user's responsibility. */ iterator erase(const_iterator __position) { return _M_h.erase(__position); } // LWG 2059. iterator erase(iterator __it) { return _M_h.erase(__it); } //@} /** * @brief Erases elements according to the provided key. * @param __x Key of element to be erased. * @return The number of elements erased. * * This function erases all the elements located by the given key from * an %unordered_map. For an %unordered_map the result of this function * can only be 0 (not present) or 1 (present). * Note that this function only erases the element, and that if the * element is itself a pointer, the pointed-to memory is not touched in * any way. Managing the pointer is the user's responsibility. */ size_type erase(const key_type& __x) { return _M_h.erase(__x); } /** * @brief Erases a [__first,__last) range of elements from an * %unordered_map. * @param __first Iterator pointing to the start of the range to be * erased. * @param __last Iterator pointing to the end of the range to * be erased. * @return The iterator @a __last. * * This function erases a sequence of elements from an %unordered_map. * Note that this function only erases the elements, and that if * the element is itself a pointer, the pointed-to memory is not touched * in any way. Managing the pointer is the user's responsibility. */ iterator erase(const_iterator __first, const_iterator __last) { return _M_h.erase(__first, __last); } /** * Erases all elements in an %unordered_map. * Note that this function only erases the elements, and that if the * elements themselves are pointers, the pointed-to memory is not touched * in any way. Managing the pointer is the user's responsibility. */ void clear() noexcept { _M_h.clear(); } /** * @brief Swaps data with another %unordered_map. * @param __x An %unordered_map of the same element and allocator * types. * * This exchanges the elements between two %unordered_map in constant time. * Note that the global std::swap() function is specialized such that * std::swap(m1,m2) will feed to this function. */ void swap(unordered_map& __x) { _M_h.swap(__x._M_h); } // observers. /// Returns the hash functor object with which the %unordered_map was /// constructed. hasher hash_function() const { return _M_h.hash_function(); } /// Returns the key comparison object with which the %unordered_map was /// constructed. key_equal key_eq() const { return _M_h.key_eq(); } // lookup. //@{ /** * @brief Tries to locate an element in an %unordered_map. * @param __x Key to be located. * @return Iterator pointing to sought-after element, or end() if not * found. * * This function takes a key and tries to locate the element with which * the key matches. If successful the function returns an iterator * pointing to the sought after element. If unsuccessful it returns the * past-the-end ( @c end() ) iterator. */ iterator find(const key_type& __x) { return _M_h.find(__x); } const_iterator find(const key_type& __x) const { return _M_h.find(__x); } //@} /** * @brief Finds the number of elements. * @param __x Key to count. * @return Number of elements with specified key. * * This function only makes sense for %unordered_multimap; for * %unordered_map the result will either be 0 (not present) or 1 * (present). */ size_type count(const key_type& __x) const { return _M_h.count(__x); } //@{ /** * @brief Finds a subsequence matching given key. * @param __x Key to be located. * @return Pair of iterators that possibly points to the subsequence * matching given key. * * This function probably only makes sense for %unordered_multimap. */ std::pair<iterator, iterator> equal_range(const key_type& __x) { return _M_h.equal_range(__x); } std::pair<const_iterator, const_iterator> equal_range(const key_type& __x) const { return _M_h.equal_range(__x); } //@} //@{ /** * @brief Subscript ( @c [] ) access to %unordered_map data. * @param __k The key for which data should be retrieved. * @return A reference to the data of the (key,data) %pair. * * Allows for easy lookup with the subscript ( @c [] )operator. Returns * data associated with the key specified in subscript. If the key does * not exist, a pair with that key is created using default values, which * is then returned. * * Lookup requires constant time. */ mapped_type& operator[](const key_type& __k) { return _M_h[__k]; } mapped_type& operator[](key_type&& __k) { return _M_h[std::move(__k)]; } //@} //@{ /** * @brief Access to %unordered_map data. * @param __k The key for which data should be retrieved. * @return A reference to the data whose key is equal to @a __k, if * such a data is present in the %unordered_map. * @throw std::out_of_range If no such data is present. */ mapped_type& at(const key_type& __k) { return _M_h.at(__k); } const mapped_type& at(const key_type& __k) const { return _M_h.at(__k); } //@} // bucket interface. /// Returns the number of buckets of the %unordered_map. size_type bucket_count() const noexcept { return _M_h.bucket_count(); } /// Returns the maximum number of buckets of the %unordered_map. size_type max_bucket_count() const noexcept { return _M_h.max_bucket_count(); } /* * @brief Returns the number of elements in a given bucket. * @param __n A bucket index. * @return The number of elements in the bucket. */ size_type bucket_size(size_type __n) const { return _M_h.bucket_size(__n); } /* * @brief Returns the bucket index of a given element. * @param __key A key instance. * @return The key bucket index. */ size_type bucket(const key_type& __key) const { return _M_h.bucket(__key); } /** * @brief Returns a read/write iterator pointing to the first bucket * element. * @param __n The bucket index. * @return A read/write local iterator. */ local_iterator begin(size_type __n) { return _M_h.begin(__n); } //@{ /** * @brief Returns a read-only (constant) iterator pointing to the first * bucket element. * @param __n The bucket index. * @return A read-only local iterator. */ const_local_iterator begin(size_type __n) const { return _M_h.begin(__n); } const_local_iterator cbegin(size_type __n) const { return _M_h.cbegin(__n); } //@} /** * @brief Returns a read/write iterator pointing to one past the last * bucket elements. * @param __n The bucket index. * @return A read/write local iterator. */ local_iterator end(size_type __n) { return _M_h.end(__n); } //@{ /** * @brief Returns a read-only (constant) iterator pointing to one past * the last bucket elements. * @param __n The bucket index. * @return A read-only local iterator. */ const_local_iterator end(size_type __n) const { return _M_h.end(__n); } const_local_iterator cend(size_type __n) const { return _M_h.cend(__n); } //@} // hash policy. /// Returns the average number of elements per bucket. float load_factor() const noexcept { return _M_h.load_factor(); } /// Returns a positive number that the %unordered_map tries to keep the /// load factor less than or equal to. float max_load_factor() const noexcept { return _M_h.max_load_factor(); } /** * @brief Change the %unordered_map maximum load factor. * @param __z The new maximum load factor. */ void max_load_factor(float __z) { _M_h.max_load_factor(__z); } /** * @brief May rehash the %unordered_map. * @param __n The new number of buckets. * * Rehash will occur only if the new number of buckets respect the * %unordered_map maximum load factor. */ void rehash(size_type __n) { _M_h.rehash(__n); } /** * @brief Prepare the %unordered_map for a specified number of * elements. * @param __n Number of elements required. * * Same as rehash(ceil(n / max_load_factor())). */ void reserve(size_type __n) { _M_h.reserve(__n); } template<typename _Key1, typename _Tp1, typename _Hash1, typename _Pred1, typename _Alloc1> friend bool operator==(const unordered_map<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&, const unordered_map<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&); }; /** * @brief A standard container composed of equivalent keys * (possibly containing multiple of each key value) that associates * values of another type with the keys. * * @ingroup unordered_associative_containers * * @tparam _Key Type of key objects. * @tparam _Tp Type of mapped objects. * @tparam _Hash Hashing function object type, defaults to hash<_Value>. * @tparam _Pred Predicate function object type, defaults * to equal_to<_Value>. * @tparam _Alloc Allocator type, defaults to allocator<_Key>. * * Meets the requirements of a <a href="tables.html#65">container</a>, and * <a href="tables.html#xx">unordered associative container</a> * * The resulting value type of the container is std::pair<const _Key, _Tp>. * * Base is _Hashtable, dispatched at compile time via template * alias __ummap_hashtable. */ template<class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = std::equal_to<_Key>, class _Alloc = std::allocator<std::pair<const _Key, _Tp> > > class unordered_multimap : __check_copy_constructible<_Alloc> { typedef __ummap_hashtable<_Key, _Tp, _Hash, _Pred, _Alloc> _Hashtable; _Hashtable _M_h; public: // typedefs: //@{ /// Public typedefs. typedef typename _Hashtable::key_type key_type; typedef typename _Hashtable::value_type value_type; typedef typename _Hashtable::mapped_type mapped_type; typedef typename _Hashtable::hasher hasher; typedef typename _Hashtable::key_equal key_equal; typedef typename _Hashtable::allocator_type allocator_type; //@} //@{ /// Iterator-related typedefs. typedef typename allocator_type::pointer pointer; typedef typename allocator_type::const_pointer const_pointer; typedef typename allocator_type::reference reference; typedef typename allocator_type::const_reference const_reference; typedef typename _Hashtable::iterator iterator; typedef typename _Hashtable::const_iterator const_iterator; typedef typename _Hashtable::local_iterator local_iterator; typedef typename _Hashtable::const_local_iterator const_local_iterator; typedef typename _Hashtable::size_type size_type; typedef typename _Hashtable::difference_type difference_type; //@} //construct/destroy/copy /** * @brief Default constructor creates no elements. * @param __n Initial number of buckets. * @param __hf A hash functor. * @param __eql A key equality functor. * @param __a An allocator object. */ explicit unordered_multimap(size_type __n = 10, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _M_h(__n, __hf, __eql, __a) { } /** * @brief Builds an %unordered_multimap from a range. * @param __first An input iterator. * @param __last An input iterator. * @param __n Minimal initial number of buckets. * @param __hf A hash functor. * @param __eql A key equality functor. * @param __a An allocator object. * * Create an %unordered_multimap consisting of copies of the elements * from [__first,__last). This is linear in N (where N is * distance(__first,__last)). */ template<typename _InputIterator> unordered_multimap(_InputIterator __f, _InputIterator __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _M_h(__f, __l, __n, __hf, __eql, __a) { } /// Copy constructor. unordered_multimap(const unordered_multimap&) = default; /// Move constructor. unordered_multimap(unordered_multimap&&) = default; /** * @brief Builds an %unordered_multimap from an initializer_list. * @param __l An initializer_list. * @param __n Minimal initial number of buckets. * @param __hf A hash functor. * @param __eql A key equality functor. * @param __a An allocator object. * * Create an %unordered_multimap consisting of copies of the elements in * the list. This is linear in N (where N is @a __l.size()). */ unordered_multimap(initializer_list<value_type> __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _M_h(__l, __n, __hf, __eql, __a) { } /// Copy assignment operator. unordered_multimap& operator=(const unordered_multimap&) = default; /// Move assignment operator. unordered_multimap& operator=(unordered_multimap&&) = default; /** * @brief %Unordered_multimap list assignment operator. * @param __l An initializer_list. * * This function fills an %unordered_multimap with copies of the elements * in the initializer list @a __l. * * Note that the assignment completely changes the %unordered_multimap * and that the resulting %unordered_multimap's size is the same as the * number of elements assigned. Old data may be lost. */ unordered_multimap& operator=(initializer_list<value_type> __l) { _M_h = __l; return *this; } /// Returns the allocator object with which the %unordered_multimap was /// constructed. allocator_type get_allocator() const noexcept { return _M_h.get_allocator(); } // size and capacity: /// Returns true if the %unordered_multimap is empty. bool empty() const noexcept { return _M_h.empty(); } /// Returns the size of the %unordered_multimap. size_type size() const noexcept { return _M_h.size(); } /// Returns the maximum size of the %unordered_multimap. size_type max_size() const noexcept { return _M_h.max_size(); } // iterators. /** * Returns a read/write iterator that points to the first element in the * %unordered_multimap. */ iterator begin() noexcept { return _M_h.begin(); } //@{ /** * Returns a read-only (constant) iterator that points to the first * element in the %unordered_multimap. */ const_iterator begin() const noexcept { return _M_h.begin(); } const_iterator cbegin() const noexcept { return _M_h.begin(); } //@} /** * Returns a read/write iterator that points one past the last element in * the %unordered_multimap. */ iterator end() noexcept { return _M_h.end(); } //@{ /** * Returns a read-only (constant) iterator that points one past the last * element in the %unordered_multimap. */ const_iterator end() const noexcept { return _M_h.end(); } const_iterator cend() const noexcept { return _M_h.end(); } //@} // modifiers. /** * @brief Attempts to build and insert a std::pair into the * %unordered_multimap. * * @param __args Arguments used to generate a new pair instance (see * std::piecewise_contruct for passing arguments to each * part of the pair constructor). * * @return An iterator that points to the inserted pair. * * This function attempts to build and insert a (key, value) %pair into * the %unordered_multimap. * * Insertion requires amortized constant time. */ template<typename... _Args> iterator emplace(_Args&&... __args) { return _M_h.emplace(std::forward<_Args>(__args)...); } /** * @brief Attempts to build and insert a std::pair into the %unordered_multimap. * * @param __pos An iterator that serves as a hint as to where the pair * should be inserted. * @param __args Arguments used to generate a new pair instance (see * std::piecewise_contruct for passing arguments to each * part of the pair constructor). * @return An iterator that points to the element with key of the * std::pair built from @a __args. * * Note that the first parameter is only a hint and can potentially * improve the performance of the insertion process. A bad hint would * cause no gains in efficiency. * * See * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html * for more on @a hinting. * * Insertion requires amortized constant time. */ template<typename... _Args> iterator emplace_hint(const_iterator __pos, _Args&&... __args) { return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); } //@{ /** * @brief Inserts a std::pair into the %unordered_multimap. * @param __x Pair to be inserted (see std::make_pair for easy * creation of pairs). * * @return An iterator that points to the inserted pair. * * Insertion requires amortized constant time. */ iterator insert(const value_type& __x) { return _M_h.insert(__x); } template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> iterator insert(_Pair&& __x) { return _M_h.insert(std::forward<_Pair>(__x)); } //@} //@{ /** * @brief Inserts a std::pair into the %unordered_multimap. * @param __hint An iterator that serves as a hint as to where the * pair should be inserted. * @param __x Pair to be inserted (see std::make_pair for easy creation * of pairs). * @return An iterator that points to the element with key of * @a __x (may or may not be the %pair passed in). * * Note that the first parameter is only a hint and can potentially * improve the performance of the insertion process. A bad hint would * cause no gains in efficiency. * * See * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html * for more on @a hinting. * * Insertion requires amortized constant time. */ iterator insert(const_iterator __hint, const value_type& __x) { return _M_h.insert(__hint, __x); } template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> iterator insert(const_iterator __hint, _Pair&& __x) { return _M_h.insert(__hint, std::forward<_Pair>(__x)); } //@} /** * @brief A template function that attempts to insert a range of * elements. * @param __first Iterator pointing to the start of the range to be * inserted. * @param __last Iterator pointing to the end of the range. * * Complexity similar to that of the range constructor. */ template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) { _M_h.insert(__first, __last); } /** * @brief Attempts to insert a list of elements into the * %unordered_multimap. * @param __l A std::initializer_list<value_type> of elements * to be inserted. * * Complexity similar to that of the range constructor. */ void insert(initializer_list<value_type> __l) { _M_h.insert(__l); } //@{ /** * @brief Erases an element from an %unordered_multimap. * @param __position An iterator pointing to the element to be erased. * @return An iterator pointing to the element immediately following * @a __position prior to the element being erased. If no such * element exists, end() is returned. * * This function erases an element, pointed to by the given iterator, * from an %unordered_multimap. * Note that this function only erases the element, and that if the * element is itself a pointer, the pointed-to memory is not touched in * any way. Managing the pointer is the user's responsibility. */ iterator erase(const_iterator __position) { return _M_h.erase(__position); } // LWG 2059. iterator erase(iterator __it) { return _M_h.erase(__it); } //@} /** * @brief Erases elements according to the provided key. * @param __x Key of elements to be erased. * @return The number of elements erased. * * This function erases all the elements located by the given key from * an %unordered_multimap. * Note that this function only erases the element, and that if the * element is itself a pointer, the pointed-to memory is not touched in * any way. Managing the pointer is the user's responsibility. */ size_type erase(const key_type& __x) { return _M_h.erase(__x); } /** * @brief Erases a [__first,__last) range of elements from an * %unordered_multimap. * @param __first Iterator pointing to the start of the range to be * erased. * @param __last Iterator pointing to the end of the range to * be erased. * @return The iterator @a __last. * * This function erases a sequence of elements from an * %unordered_multimap. * Note that this function only erases the elements, and that if * the element is itself a pointer, the pointed-to memory is not touched * in any way. Managing the pointer is the user's responsibility. */ iterator erase(const_iterator __first, const_iterator __last) { return _M_h.erase(__first, __last); } /** * Erases all elements in an %unordered_multimap. * Note that this function only erases the elements, and that if the * elements themselves are pointers, the pointed-to memory is not touched * in any way. Managing the pointer is the user's responsibility. */ void clear() noexcept { _M_h.clear(); } /** * @brief Swaps data with another %unordered_multimap. * @param __x An %unordered_multimap of the same element and allocator * types. * * This exchanges the elements between two %unordered_multimap in * constant time. * Note that the global std::swap() function is specialized such that * std::swap(m1,m2) will feed to this function. */ void swap(unordered_multimap& __x) { _M_h.swap(__x._M_h); } // observers. /// Returns the hash functor object with which the %unordered_multimap /// was constructed. hasher hash_function() const { return _M_h.hash_function(); } /// Returns the key comparison object with which the %unordered_multimap /// was constructed. key_equal key_eq() const { return _M_h.key_eq(); } // lookup. //@{ /** * @brief Tries to locate an element in an %unordered_multimap. * @param __x Key to be located. * @return Iterator pointing to sought-after element, or end() if not * found. * * This function takes a key and tries to locate the element with which * the key matches. If successful the function returns an iterator * pointing to the sought after element. If unsuccessful it returns the * past-the-end ( @c end() ) iterator. */ iterator find(const key_type& __x) { return _M_h.find(__x); } const_iterator find(const key_type& __x) const { return _M_h.find(__x); } //@} /** * @brief Finds the number of elements. * @param __x Key to count. * @return Number of elements with specified key. */ size_type count(const key_type& __x) const { return _M_h.count(__x); } //@{ /** * @brief Finds a subsequence matching given key. * @param __x Key to be located. * @return Pair of iterators that possibly points to the subsequence * matching given key. */ std::pair<iterator, iterator> equal_range(const key_type& __x) { return _M_h.equal_range(__x); } std::pair<const_iterator, const_iterator> equal_range(const key_type& __x) const { return _M_h.equal_range(__x); } //@} // bucket interface. /// Returns the number of buckets of the %unordered_multimap. size_type bucket_count() const noexcept { return _M_h.bucket_count(); } /// Returns the maximum number of buckets of the %unordered_multimap. size_type max_bucket_count() const noexcept { return _M_h.max_bucket_count(); } /* * @brief Returns the number of elements in a given bucket. * @param __n A bucket index. * @return The number of elements in the bucket. */ size_type bucket_size(size_type __n) const { return _M_h.bucket_size(__n); } /* * @brief Returns the bucket index of a given element. * @param __key A key instance. * @return The key bucket index. */ size_type bucket(const key_type& __key) const { return _M_h.bucket(__key); } /** * @brief Returns a read/write iterator pointing to the first bucket * element. * @param __n The bucket index. * @return A read/write local iterator. */ local_iterator begin(size_type __n) { return _M_h.begin(__n); } //@{ /** * @brief Returns a read-only (constant) iterator pointing to the first * bucket element. * @param __n The bucket index. * @return A read-only local iterator. */ const_local_iterator begin(size_type __n) const { return _M_h.begin(__n); } const_local_iterator cbegin(size_type __n) const { return _M_h.cbegin(__n); } //@} /** * @brief Returns a read/write iterator pointing to one past the last * bucket elements. * @param __n The bucket index. * @return A read/write local iterator. */ local_iterator end(size_type __n) { return _M_h.end(__n); } //@{ /** * @brief Returns a read-only (constant) iterator pointing to one past * the last bucket elements. * @param __n The bucket index. * @return A read-only local iterator. */ const_local_iterator end(size_type __n) const { return _M_h.end(__n); } const_local_iterator cend(size_type __n) const { return _M_h.cend(__n); } //@} // hash policy. /// Returns the average number of elements per bucket. float load_factor() const noexcept { return _M_h.load_factor(); } /// Returns a positive number that the %unordered_multimap tries to keep /// the load factor less than or equal to. float max_load_factor() const noexcept { return _M_h.max_load_factor(); } /** * @brief Change the %unordered_multimap maximum load factor. * @param __z The new maximum load factor. */ void max_load_factor(float __z) { _M_h.max_load_factor(__z); } /** * @brief May rehash the %unordered_multimap. * @param __n The new number of buckets. * * Rehash will occur only if the new number of buckets respect the * %unordered_multimap maximum load factor. */ void rehash(size_type __n) { _M_h.rehash(__n); } /** * @brief Prepare the %unordered_multimap for a specified number of * elements. * @param __n Number of elements required. * * Same as rehash(ceil(n / max_load_factor())). */ void reserve(size_type __n) { _M_h.reserve(__n); } template<typename _Key1, typename _Tp1, typename _Hash1, typename _Pred1, typename _Alloc1> friend bool operator==(const unordered_multimap<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&, const unordered_multimap<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&); }; template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline void swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { __x.swap(__y); } template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline void swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { __x.swap(__y); } template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline bool operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { return __x._M_h._M_equal(__y._M_h); } template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline bool operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { return !(__x == __y); } template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline bool operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { return __x._M_h._M_equal(__y._M_h); } template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline bool operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { return !(__x == __y); } _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std #endif /* _UNORDERED_MAP_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/allocator.h��������������������������������������������������������������������������0000644�����������������00000014145�14763166030�0010672 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Allocators -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * Copyright (c) 1996-1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/allocator.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{memory} */ #ifndef _ALLOCATOR_H #define _ALLOCATOR_H 1 #include <bits/c++allocator.h> // Define the base class to std::allocator. #include <bits/memoryfwd.h> #if __cplusplus >= 201103L #include <type_traits> #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup allocators * @{ */ /// allocator<void> specialization. template<> class allocator<void> { public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef void* pointer; typedef const void* const_pointer; typedef void value_type; template<typename _Tp1> struct rebind { typedef allocator<_Tp1> other; }; #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2103. std::allocator propagate_on_container_move_assignment typedef true_type propagate_on_container_move_assignment; #endif }; /** * @brief The @a standard allocator, as per [20.4]. * * See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt04ch11.html * for further details. * * @tparam _Tp Type of allocated object. */ template<typename _Tp> class allocator: public __allocator_base<_Tp> { public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Tp* pointer; typedef const _Tp* const_pointer; typedef _Tp& reference; typedef const _Tp& const_reference; typedef _Tp value_type; template<typename _Tp1> struct rebind { typedef allocator<_Tp1> other; }; #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2103. std::allocator propagate_on_container_move_assignment typedef true_type propagate_on_container_move_assignment; #endif allocator() throw() { } allocator(const allocator& __a) throw() : __allocator_base<_Tp>(__a) { } template<typename _Tp1> allocator(const allocator<_Tp1>&) throw() { } ~allocator() throw() { } // Inherit everything else. }; template<typename _T1, typename _T2> inline bool operator==(const allocator<_T1>&, const allocator<_T2>&) { return true; } template<typename _Tp> inline bool operator==(const allocator<_Tp>&, const allocator<_Tp>&) { return true; } template<typename _T1, typename _T2> inline bool operator!=(const allocator<_T1>&, const allocator<_T2>&) { return false; } template<typename _Tp> inline bool operator!=(const allocator<_Tp>&, const allocator<_Tp>&) { return false; } /// @} group allocator // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. #if _GLIBCXX_EXTERN_TEMPLATE extern template class allocator<char>; extern template class allocator<wchar_t>; #endif // Undefine. #undef __allocator_base // To implement Option 3 of DR 431. template<typename _Alloc, bool = __is_empty(_Alloc)> struct __alloc_swap { static void _S_do_it(_Alloc&, _Alloc&) { } }; template<typename _Alloc> struct __alloc_swap<_Alloc, false> { static void _S_do_it(_Alloc& __one, _Alloc& __two) { // Precondition: swappable allocators. if (__one != __two) swap(__one, __two); } }; // Optimize for stateless allocators. template<typename _Alloc, bool = __is_empty(_Alloc)> struct __alloc_neq { static bool _S_do_it(const _Alloc&, const _Alloc&) { return false; } }; template<typename _Alloc> struct __alloc_neq<_Alloc, false> { static bool _S_do_it(const _Alloc& __one, const _Alloc& __two) { return __one != __two; } }; #if __cplusplus >= 201103L template<typename _Tp, bool = __or_<is_copy_constructible<typename _Tp::value_type>, is_nothrow_move_constructible<typename _Tp::value_type>>::value> struct __shrink_to_fit_aux { static bool _S_do_it(_Tp&) { return false; } }; template<typename _Tp> struct __shrink_to_fit_aux<_Tp, true> { static bool _S_do_it(_Tp& __c) { __try { _Tp(__make_move_if_noexcept_iterator(__c.begin()), __make_move_if_noexcept_iterator(__c.end()), __c.get_allocator()).swap(__c); return true; } __catch(...) { return false; } } }; #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/ostream.tcc��������������������������������������������������������������������������0000644�����������������00000030033�14763166030�0010700 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// ostream classes -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/ostream.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ostream} */ // // ISO C++ 14882: 27.6.2 Output streams // #ifndef _OSTREAM_TCC #define _OSTREAM_TCC 1 #pragma GCC system_header #include <bits/cxxabi_forced.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>::sentry:: sentry(basic_ostream<_CharT, _Traits>& __os) : _M_ok(false), _M_os(__os) { // XXX MT if (__os.tie() && __os.good()) __os.tie()->flush(); if (__os.good()) _M_ok = true; else __os.setstate(ios_base::failbit); } template<typename _CharT, typename _Traits> template<typename _ValueT> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: _M_insert(_ValueT __v) { sentry __cerb(*this); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; __try { const __num_put_type& __np = __check_facet(this->_M_num_put); if (__np.put(*this, *this, this->fill(), __v).failed()) __err |= ios_base::badbit; } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: operator<<(short __n) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 117. basic_ostream uses nonexistent num_put member functions. const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield; if (__fmt == ios_base::oct || __fmt == ios_base::hex) return _M_insert(static_cast<long>(static_cast<unsigned short>(__n))); else return _M_insert(static_cast<long>(__n)); } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: operator<<(int __n) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 117. basic_ostream uses nonexistent num_put member functions. const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield; if (__fmt == ios_base::oct || __fmt == ios_base::hex) return _M_insert(static_cast<long>(static_cast<unsigned int>(__n))); else return _M_insert(static_cast<long>(__n)); } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: operator<<(__streambuf_type* __sbin) { ios_base::iostate __err = ios_base::goodbit; sentry __cerb(*this); if (__cerb && __sbin) { __try { if (!__copy_streambufs(__sbin, this->rdbuf())) __err |= ios_base::failbit; } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::failbit); } } else if (!__sbin) __err |= ios_base::badbit; if (__err) this->setstate(__err); return *this; } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: put(char_type __c) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 60. What is a formatted input function? // basic_ostream::put(char_type) is an unformatted output function. // DR 63. Exception-handling policy for unformatted output. // Unformatted output functions should catch exceptions thrown // from streambuf members. sentry __cerb(*this); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; __try { const int_type __put = this->rdbuf()->sputc(__c); if (traits_type::eq_int_type(__put, traits_type::eof())) __err |= ios_base::badbit; } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: write(const _CharT* __s, streamsize __n) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 60. What is a formatted input function? // basic_ostream::write(const char_type*, streamsize) is an // unformatted output function. // DR 63. Exception-handling policy for unformatted output. // Unformatted output functions should catch exceptions thrown // from streambuf members. sentry __cerb(*this); if (__cerb) { __try { _M_write(__s, __n); } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } } return *this; } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: flush() { // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 60. What is a formatted input function? // basic_ostream::flush() is *not* an unformatted output function. ios_base::iostate __err = ios_base::goodbit; __try { if (this->rdbuf() && this->rdbuf()->pubsync() == -1) __err |= ios_base::badbit; } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); return *this; } template<typename _CharT, typename _Traits> typename basic_ostream<_CharT, _Traits>::pos_type basic_ostream<_CharT, _Traits>:: tellp() { pos_type __ret = pos_type(-1); __try { if (!this->fail()) __ret = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out); } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } return __ret; } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: seekp(pos_type __pos) { ios_base::iostate __err = ios_base::goodbit; __try { if (!this->fail()) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 136. seekp, seekg setting wrong streams? const pos_type __p = this->rdbuf()->pubseekpos(__pos, ios_base::out); // 129. Need error indication from seekp() and seekg() if (__p == pos_type(off_type(-1))) __err |= ios_base::failbit; } } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); return *this; } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: seekp(off_type __off, ios_base::seekdir __dir) { ios_base::iostate __err = ios_base::goodbit; __try { if (!this->fail()) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 136. seekp, seekg setting wrong streams? const pos_type __p = this->rdbuf()->pubseekoff(__off, __dir, ios_base::out); // 129. Need error indication from seekp() and seekg() if (__p == pos_type(off_type(-1))) __err |= ios_base::failbit; } } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); return *this; } template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) { if (!__s) __out.setstate(ios_base::badbit); else { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 167. Improper use of traits_type::length() const size_t __clen = char_traits<char>::length(__s); __try { struct __ptr_guard { _CharT *__p; __ptr_guard (_CharT *__ip): __p(__ip) { } ~__ptr_guard() { delete[] __p; } _CharT* __get() { return __p; } } __pg (new _CharT[__clen]); _CharT *__ws = __pg.__get(); for (size_t __i = 0; __i < __clen; ++__i) __ws[__i] = __out.widen(__s[__i]); __ostream_insert(__out, __ws, __clen); } __catch(__cxxabiv1::__forced_unwind&) { __out._M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { __out._M_setstate(ios_base::badbit); } } return __out; } // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. #if _GLIBCXX_EXTERN_TEMPLATE extern template class basic_ostream<char>; extern template ostream& endl(ostream&); extern template ostream& ends(ostream&); extern template ostream& flush(ostream&); extern template ostream& operator<<(ostream&, char); extern template ostream& operator<<(ostream&, unsigned char); extern template ostream& operator<<(ostream&, signed char); extern template ostream& operator<<(ostream&, const char*); extern template ostream& operator<<(ostream&, const unsigned char*); extern template ostream& operator<<(ostream&, const signed char*); extern template ostream& ostream::_M_insert(long); extern template ostream& ostream::_M_insert(unsigned long); extern template ostream& ostream::_M_insert(bool); #ifdef _GLIBCXX_USE_LONG_LONG extern template ostream& ostream::_M_insert(long long); extern template ostream& ostream::_M_insert(unsigned long long); #endif extern template ostream& ostream::_M_insert(double); extern template ostream& ostream::_M_insert(long double); extern template ostream& ostream::_M_insert(const void*); #ifdef _GLIBCXX_USE_WCHAR_T extern template class basic_ostream<wchar_t>; extern template wostream& endl(wostream&); extern template wostream& ends(wostream&); extern template wostream& flush(wostream&); extern template wostream& operator<<(wostream&, wchar_t); extern template wostream& operator<<(wostream&, char); extern template wostream& operator<<(wostream&, const wchar_t*); extern template wostream& operator<<(wostream&, const char*); extern template wostream& wostream::_M_insert(long); extern template wostream& wostream::_M_insert(unsigned long); extern template wostream& wostream::_M_insert(bool); #ifdef _GLIBCXX_USE_LONG_LONG extern template wostream& wostream::_M_insert(long long); extern template wostream& wostream::_M_insert(unsigned long long); #endif extern template wostream& wostream::_M_insert(double); extern template wostream& wostream::_M_insert(long double); extern template wostream& wostream::_M_insert(const void*); #endif #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/functexcept.h������������������������������������������������������������������������0000644�����������������00000006054�14763166030�0011242 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Function-Based Exception Support -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/functexcept.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{exception} * * This header provides support for -fno-exceptions. */ // // ISO C++ 14882: 19.1 Exception classes // #ifndef _FUNCTEXCEPT_H #define _FUNCTEXCEPT_H 1 #include <bits/c++config.h> #include <bits/exception_defines.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Helper for exception objects in <except> void __throw_bad_exception(void) __attribute__((__noreturn__)); // Helper for exception objects in <new> void __throw_bad_alloc(void) __attribute__((__noreturn__)); // Helper for exception objects in <typeinfo> void __throw_bad_cast(void) __attribute__((__noreturn__)); void __throw_bad_typeid(void) __attribute__((__noreturn__)); // Helpers for exception objects in <stdexcept> void __throw_logic_error(const char*) __attribute__((__noreturn__)); void __throw_domain_error(const char*) __attribute__((__noreturn__)); void __throw_invalid_argument(const char*) __attribute__((__noreturn__)); void __throw_length_error(const char*) __attribute__((__noreturn__)); void __throw_out_of_range(const char*) __attribute__((__noreturn__)); void __throw_runtime_error(const char*) __attribute__((__noreturn__)); void __throw_range_error(const char*) __attribute__((__noreturn__)); void __throw_overflow_error(const char*) __attribute__((__noreturn__)); void __throw_underflow_error(const char*) __attribute__((__noreturn__)); // Helpers for exception objects in <ios> void __throw_ios_failure(const char*) __attribute__((__noreturn__)); void __throw_system_error(int) __attribute__((__noreturn__)); void __throw_future_error(int) __attribute__((__noreturn__)); // Helpers for exception objects in <functional> void __throw_bad_function_call() __attribute__((__noreturn__)); _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_deque.h��������������������������������������������������������������������������0000644�����������������00000204641�14763166030�0010701 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Deque implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_deque.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{deque} */ #ifndef _STL_DEQUE_H #define _STL_DEQUE_H 1 #include <bits/concept_check.h> #include <bits/stl_iterator_base_types.h> #include <bits/stl_iterator_base_funcs.h> #if __cplusplus >= 201103L #include <initializer_list> #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /** * @brief This function controls the size of memory nodes. * @param __size The size of an element. * @return The number (not byte size) of elements per node. * * This function started off as a compiler kludge from SGI, but * seems to be a useful wrapper around a repeated constant * expression. The @b 512 is tunable (and no other code needs to * change), but no investigation has been done since inheriting the * SGI code. Touch _GLIBCXX_DEQUE_BUF_SIZE only if you know what * you are doing, however: changing it breaks the binary * compatibility!! */ #ifndef _GLIBCXX_DEQUE_BUF_SIZE #define _GLIBCXX_DEQUE_BUF_SIZE 512 #endif inline size_t __deque_buf_size(size_t __size) { return (__size < _GLIBCXX_DEQUE_BUF_SIZE ? size_t(_GLIBCXX_DEQUE_BUF_SIZE / __size) : size_t(1)); } /** * @brief A deque::iterator. * * Quite a bit of intelligence here. Much of the functionality of * deque is actually passed off to this class. A deque holds two * of these internally, marking its valid range. Access to * elements is done as offsets of either of those two, relying on * operator overloading in this class. * * All the functions are op overloads except for _M_set_node. */ template<typename _Tp, typename _Ref, typename _Ptr> struct _Deque_iterator { typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator; typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator; static size_t _S_buffer_size() { return __deque_buf_size(sizeof(_Tp)); } typedef std::random_access_iterator_tag iterator_category; typedef _Tp value_type; typedef _Ptr pointer; typedef _Ref reference; typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Tp** _Map_pointer; typedef _Deque_iterator _Self; _Tp* _M_cur; _Tp* _M_first; _Tp* _M_last; _Map_pointer _M_node; _Deque_iterator(_Tp* __x, _Map_pointer __y) : _M_cur(__x), _M_first(*__y), _M_last(*__y + _S_buffer_size()), _M_node(__y) { } _Deque_iterator() : _M_cur(0), _M_first(0), _M_last(0), _M_node(0) { } _Deque_iterator(const iterator& __x) : _M_cur(__x._M_cur), _M_first(__x._M_first), _M_last(__x._M_last), _M_node(__x._M_node) { } reference operator*() const { return *_M_cur; } pointer operator->() const { return _M_cur; } _Self& operator++() { ++_M_cur; if (_M_cur == _M_last) { _M_set_node(_M_node + 1); _M_cur = _M_first; } return *this; } _Self operator++(int) { _Self __tmp = *this; ++*this; return __tmp; } _Self& operator--() { if (_M_cur == _M_first) { _M_set_node(_M_node - 1); _M_cur = _M_last; } --_M_cur; return *this; } _Self operator--(int) { _Self __tmp = *this; --*this; return __tmp; } _Self& operator+=(difference_type __n) { const difference_type __offset = __n + (_M_cur - _M_first); if (__offset >= 0 && __offset < difference_type(_S_buffer_size())) _M_cur += __n; else { const difference_type __node_offset = __offset > 0 ? __offset / difference_type(_S_buffer_size()) : -difference_type((-__offset - 1) / _S_buffer_size()) - 1; _M_set_node(_M_node + __node_offset); _M_cur = _M_first + (__offset - __node_offset * difference_type(_S_buffer_size())); } return *this; } _Self operator+(difference_type __n) const { _Self __tmp = *this; return __tmp += __n; } _Self& operator-=(difference_type __n) { return *this += -__n; } _Self operator-(difference_type __n) const { _Self __tmp = *this; return __tmp -= __n; } reference operator[](difference_type __n) const { return *(*this + __n); } /** * Prepares to traverse new_node. Sets everything except * _M_cur, which should therefore be set by the caller * immediately afterwards, based on _M_first and _M_last. */ void _M_set_node(_Map_pointer __new_node) { _M_node = __new_node; _M_first = *__new_node; _M_last = _M_first + difference_type(_S_buffer_size()); } }; // Note: we also provide overloads whose operands are of the same type in // order to avoid ambiguous overload resolution when std::rel_ops operators // are in scope (for additional details, see libstdc++/3628) template<typename _Tp, typename _Ref, typename _Ptr> inline bool operator==(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) { return __x._M_cur == __y._M_cur; } template<typename _Tp, typename _RefL, typename _PtrL, typename _RefR, typename _PtrR> inline bool operator==(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) { return __x._M_cur == __y._M_cur; } template<typename _Tp, typename _Ref, typename _Ptr> inline bool operator!=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) { return !(__x == __y); } template<typename _Tp, typename _RefL, typename _PtrL, typename _RefR, typename _PtrR> inline bool operator!=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) { return !(__x == __y); } template<typename _Tp, typename _Ref, typename _Ptr> inline bool operator<(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) { return (__x._M_node == __y._M_node) ? (__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node); } template<typename _Tp, typename _RefL, typename _PtrL, typename _RefR, typename _PtrR> inline bool operator<(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) { return (__x._M_node == __y._M_node) ? (__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node); } template<typename _Tp, typename _Ref, typename _Ptr> inline bool operator>(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) { return __y < __x; } template<typename _Tp, typename _RefL, typename _PtrL, typename _RefR, typename _PtrR> inline bool operator>(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) { return __y < __x; } template<typename _Tp, typename _Ref, typename _Ptr> inline bool operator<=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) { return !(__y < __x); } template<typename _Tp, typename _RefL, typename _PtrL, typename _RefR, typename _PtrR> inline bool operator<=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) { return !(__y < __x); } template<typename _Tp, typename _Ref, typename _Ptr> inline bool operator>=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) { return !(__x < __y); } template<typename _Tp, typename _RefL, typename _PtrL, typename _RefR, typename _PtrR> inline bool operator>=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) { return !(__x < __y); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // According to the resolution of DR179 not only the various comparison // operators but also operator- must accept mixed iterator/const_iterator // parameters. template<typename _Tp, typename _Ref, typename _Ptr> inline typename _Deque_iterator<_Tp, _Ref, _Ptr>::difference_type operator-(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) { return typename _Deque_iterator<_Tp, _Ref, _Ptr>::difference_type (_Deque_iterator<_Tp, _Ref, _Ptr>::_S_buffer_size()) * (__x._M_node - __y._M_node - 1) + (__x._M_cur - __x._M_first) + (__y._M_last - __y._M_cur); } template<typename _Tp, typename _RefL, typename _PtrL, typename _RefR, typename _PtrR> inline typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type operator-(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) { return typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type (_Deque_iterator<_Tp, _RefL, _PtrL>::_S_buffer_size()) * (__x._M_node - __y._M_node - 1) + (__x._M_cur - __x._M_first) + (__y._M_last - __y._M_cur); } template<typename _Tp, typename _Ref, typename _Ptr> inline _Deque_iterator<_Tp, _Ref, _Ptr> operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Ref, _Ptr>& __x) { return __x + __n; } template<typename _Tp> void fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>&, const _Deque_iterator<_Tp, _Tp&, _Tp*>&, const _Tp&); template<typename _Tp> _Deque_iterator<_Tp, _Tp&, _Tp*> copy(_Deque_iterator<_Tp, const _Tp&, const _Tp*>, _Deque_iterator<_Tp, const _Tp&, const _Tp*>, _Deque_iterator<_Tp, _Tp&, _Tp*>); template<typename _Tp> inline _Deque_iterator<_Tp, _Tp&, _Tp*> copy(_Deque_iterator<_Tp, _Tp&, _Tp*> __first, _Deque_iterator<_Tp, _Tp&, _Tp*> __last, _Deque_iterator<_Tp, _Tp&, _Tp*> __result) { return std::copy(_Deque_iterator<_Tp, const _Tp&, const _Tp*>(__first), _Deque_iterator<_Tp, const _Tp&, const _Tp*>(__last), __result); } template<typename _Tp> _Deque_iterator<_Tp, _Tp&, _Tp*> copy_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*>, _Deque_iterator<_Tp, const _Tp&, const _Tp*>, _Deque_iterator<_Tp, _Tp&, _Tp*>); template<typename _Tp> inline _Deque_iterator<_Tp, _Tp&, _Tp*> copy_backward(_Deque_iterator<_Tp, _Tp&, _Tp*> __first, _Deque_iterator<_Tp, _Tp&, _Tp*> __last, _Deque_iterator<_Tp, _Tp&, _Tp*> __result) { return std::copy_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*>(__first), _Deque_iterator<_Tp, const _Tp&, const _Tp*>(__last), __result); } #if __cplusplus >= 201103L template<typename _Tp> _Deque_iterator<_Tp, _Tp&, _Tp*> move(_Deque_iterator<_Tp, const _Tp&, const _Tp*>, _Deque_iterator<_Tp, const _Tp&, const _Tp*>, _Deque_iterator<_Tp, _Tp&, _Tp*>); template<typename _Tp> inline _Deque_iterator<_Tp, _Tp&, _Tp*> move(_Deque_iterator<_Tp, _Tp&, _Tp*> __first, _Deque_iterator<_Tp, _Tp&, _Tp*> __last, _Deque_iterator<_Tp, _Tp&, _Tp*> __result) { return std::move(_Deque_iterator<_Tp, const _Tp&, const _Tp*>(__first), _Deque_iterator<_Tp, const _Tp&, const _Tp*>(__last), __result); } template<typename _Tp> _Deque_iterator<_Tp, _Tp&, _Tp*> move_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*>, _Deque_iterator<_Tp, const _Tp&, const _Tp*>, _Deque_iterator<_Tp, _Tp&, _Tp*>); template<typename _Tp> inline _Deque_iterator<_Tp, _Tp&, _Tp*> move_backward(_Deque_iterator<_Tp, _Tp&, _Tp*> __first, _Deque_iterator<_Tp, _Tp&, _Tp*> __last, _Deque_iterator<_Tp, _Tp&, _Tp*> __result) { return std::move_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*>(__first), _Deque_iterator<_Tp, const _Tp&, const _Tp*>(__last), __result); } #endif /** * Deque base class. This class provides the unified face for %deque's * allocation. This class's constructor and destructor allocate and * deallocate (but do not initialize) storage. This makes %exception * safety easier. * * Nothing in this class ever constructs or destroys an actual Tp element. * (Deque handles that itself.) Only/All memory management is performed * here. */ template<typename _Tp, typename _Alloc> class _Deque_base { public: typedef _Alloc allocator_type; allocator_type get_allocator() const _GLIBCXX_NOEXCEPT { return allocator_type(_M_get_Tp_allocator()); } typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator; typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator; _Deque_base() : _M_impl() { _M_initialize_map(0); } _Deque_base(size_t __num_elements) : _M_impl() { _M_initialize_map(__num_elements); } _Deque_base(const allocator_type& __a, size_t __num_elements) : _M_impl(__a) { _M_initialize_map(__num_elements); } _Deque_base(const allocator_type& __a) : _M_impl(__a) { } #if __cplusplus >= 201103L _Deque_base(_Deque_base&& __x) : _M_impl(std::move(__x._M_get_Tp_allocator())) { _M_initialize_map(0); if (__x._M_impl._M_map) { std::swap(this->_M_impl._M_start, __x._M_impl._M_start); std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish); std::swap(this->_M_impl._M_map, __x._M_impl._M_map); std::swap(this->_M_impl._M_map_size, __x._M_impl._M_map_size); } } #endif ~_Deque_base(); protected: //This struct encapsulates the implementation of the std::deque //standard container and at the same time makes use of the EBO //for empty allocators. typedef typename _Alloc::template rebind<_Tp*>::other _Map_alloc_type; typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type; struct _Deque_impl : public _Tp_alloc_type { _Tp** _M_map; size_t _M_map_size; iterator _M_start; iterator _M_finish; _Deque_impl() : _Tp_alloc_type(), _M_map(0), _M_map_size(0), _M_start(), _M_finish() { } _Deque_impl(const _Tp_alloc_type& __a) : _Tp_alloc_type(__a), _M_map(0), _M_map_size(0), _M_start(), _M_finish() { } #if __cplusplus >= 201103L _Deque_impl(_Tp_alloc_type&& __a) : _Tp_alloc_type(std::move(__a)), _M_map(0), _M_map_size(0), _M_start(), _M_finish() { } #endif }; _Tp_alloc_type& _M_get_Tp_allocator() _GLIBCXX_NOEXCEPT { return *static_cast<_Tp_alloc_type*>(&this->_M_impl); } const _Tp_alloc_type& _M_get_Tp_allocator() const _GLIBCXX_NOEXCEPT { return *static_cast<const _Tp_alloc_type*>(&this->_M_impl); } _Map_alloc_type _M_get_map_allocator() const _GLIBCXX_NOEXCEPT { return _Map_alloc_type(_M_get_Tp_allocator()); } _Tp* _M_allocate_node() { return _M_impl._Tp_alloc_type::allocate(__deque_buf_size(sizeof(_Tp))); } void _M_deallocate_node(_Tp* __p) { _M_impl._Tp_alloc_type::deallocate(__p, __deque_buf_size(sizeof(_Tp))); } _Tp** _M_allocate_map(size_t __n) { return _M_get_map_allocator().allocate(__n); } void _M_deallocate_map(_Tp** __p, size_t __n) { _M_get_map_allocator().deallocate(__p, __n); } protected: void _M_initialize_map(size_t); void _M_create_nodes(_Tp** __nstart, _Tp** __nfinish); void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish); enum { _S_initial_map_size = 8 }; _Deque_impl _M_impl; }; template<typename _Tp, typename _Alloc> _Deque_base<_Tp, _Alloc>:: ~_Deque_base() { if (this->_M_impl._M_map) { _M_destroy_nodes(this->_M_impl._M_start._M_node, this->_M_impl._M_finish._M_node + 1); _M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size); } } /** * @brief Layout storage. * @param __num_elements The count of T's for which to allocate space * at first. * @return Nothing. * * The initial underlying memory layout is a bit complicated... */ template<typename _Tp, typename _Alloc> void _Deque_base<_Tp, _Alloc>:: _M_initialize_map(size_t __num_elements) { const size_t __num_nodes = (__num_elements/ __deque_buf_size(sizeof(_Tp)) + 1); this->_M_impl._M_map_size = std::max((size_t) _S_initial_map_size, size_t(__num_nodes + 2)); this->_M_impl._M_map = _M_allocate_map(this->_M_impl._M_map_size); // For "small" maps (needing less than _M_map_size nodes), allocation // starts in the middle elements and grows outwards. So nstart may be // the beginning of _M_map, but for small maps it may be as far in as // _M_map+3. _Tp** __nstart = (this->_M_impl._M_map + (this->_M_impl._M_map_size - __num_nodes) / 2); _Tp** __nfinish = __nstart + __num_nodes; __try { _M_create_nodes(__nstart, __nfinish); } __catch(...) { _M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size); this->_M_impl._M_map = 0; this->_M_impl._M_map_size = 0; __throw_exception_again; } this->_M_impl._M_start._M_set_node(__nstart); this->_M_impl._M_finish._M_set_node(__nfinish - 1); this->_M_impl._M_start._M_cur = _M_impl._M_start._M_first; this->_M_impl._M_finish._M_cur = (this->_M_impl._M_finish._M_first + __num_elements % __deque_buf_size(sizeof(_Tp))); } template<typename _Tp, typename _Alloc> void _Deque_base<_Tp, _Alloc>:: _M_create_nodes(_Tp** __nstart, _Tp** __nfinish) { _Tp** __cur; __try { for (__cur = __nstart; __cur < __nfinish; ++__cur) *__cur = this->_M_allocate_node(); } __catch(...) { _M_destroy_nodes(__nstart, __cur); __throw_exception_again; } } template<typename _Tp, typename _Alloc> void _Deque_base<_Tp, _Alloc>:: _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish) { for (_Tp** __n = __nstart; __n < __nfinish; ++__n) _M_deallocate_node(*__n); } /** * @brief A standard container using fixed-size memory allocation and * constant-time manipulation of elements at either end. * * @ingroup sequences * * @tparam _Tp Type of element. * @tparam _Alloc Allocator type, defaults to allocator<_Tp>. * * Meets the requirements of a <a href="tables.html#65">container</a>, a * <a href="tables.html#66">reversible container</a>, and a * <a href="tables.html#67">sequence</a>, including the * <a href="tables.html#68">optional sequence requirements</a>. * * In previous HP/SGI versions of deque, there was an extra template * parameter so users could control the node size. This extension turned * out to violate the C++ standard (it can be detected using template * template parameters), and it was removed. * * Here's how a deque<Tp> manages memory. Each deque has 4 members: * * - Tp** _M_map * - size_t _M_map_size * - iterator _M_start, _M_finish * * map_size is at least 8. %map is an array of map_size * pointers-to-@a nodes. (The name %map has nothing to do with the * std::map class, and @b nodes should not be confused with * std::list's usage of @a node.) * * A @a node has no specific type name as such, but it is referred * to as @a node in this file. It is a simple array-of-Tp. If Tp * is very large, there will be one Tp element per node (i.e., an * @a array of one). For non-huge Tp's, node size is inversely * related to Tp size: the larger the Tp, the fewer Tp's will fit * in a node. The goal here is to keep the total size of a node * relatively small and constant over different Tp's, to improve * allocator efficiency. * * Not every pointer in the %map array will point to a node. If * the initial number of elements in the deque is small, the * /middle/ %map pointers will be valid, and the ones at the edges * will be unused. This same situation will arise as the %map * grows: available %map pointers, if any, will be on the ends. As * new nodes are created, only a subset of the %map's pointers need * to be copied @a outward. * * Class invariants: * - For any nonsingular iterator i: * - i.node points to a member of the %map array. (Yes, you read that * correctly: i.node does not actually point to a node.) The member of * the %map array is what actually points to the node. * - i.first == *(i.node) (This points to the node (first Tp element).) * - i.last == i.first + node_size * - i.cur is a pointer in the range [i.first, i.last). NOTE: * the implication of this is that i.cur is always a dereferenceable * pointer, even if i is a past-the-end iterator. * - Start and Finish are always nonsingular iterators. NOTE: this * means that an empty deque must have one node, a deque with <N * elements (where N is the node buffer size) must have one node, a * deque with N through (2N-1) elements must have two nodes, etc. * - For every node other than start.node and finish.node, every * element in the node is an initialized object. If start.node == * finish.node, then [start.cur, finish.cur) are initialized * objects, and the elements outside that range are uninitialized * storage. Otherwise, [start.cur, start.last) and [finish.first, * finish.cur) are initialized objects, and [start.first, start.cur) * and [finish.cur, finish.last) are uninitialized storage. * - [%map, %map + map_size) is a valid, non-empty range. * - [start.node, finish.node] is a valid range contained within * [%map, %map + map_size). * - A pointer in the range [%map, %map + map_size) points to an allocated * node if and only if the pointer is in the range * [start.node, finish.node]. * * Here's the magic: nothing in deque is @b aware of the discontiguous * storage! * * The memory setup and layout occurs in the parent, _Base, and the iterator * class is entirely responsible for @a leaping from one node to the next. * All the implementation routines for deque itself work only through the * start and finish iterators. This keeps the routines simple and sane, * and we can use other standard algorithms as well. */ template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class deque : protected _Deque_base<_Tp, _Alloc> { // concept requirements typedef typename _Alloc::value_type _Alloc_value_type; __glibcxx_class_requires(_Tp, _SGIAssignableConcept) __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept) typedef _Deque_base<_Tp, _Alloc> _Base; typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; public: typedef _Tp value_type; typedef typename _Tp_alloc_type::pointer pointer; typedef typename _Tp_alloc_type::const_pointer const_pointer; typedef typename _Tp_alloc_type::reference reference; typedef typename _Tp_alloc_type::const_reference const_reference; typedef typename _Base::iterator iterator; typedef typename _Base::const_iterator const_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<iterator> reverse_iterator; typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Alloc allocator_type; protected: typedef pointer* _Map_pointer; static size_t _S_buffer_size() { return __deque_buf_size(sizeof(_Tp)); } // Functions controlling memory layout, and nothing else. using _Base::_M_initialize_map; using _Base::_M_create_nodes; using _Base::_M_destroy_nodes; using _Base::_M_allocate_node; using _Base::_M_deallocate_node; using _Base::_M_allocate_map; using _Base::_M_deallocate_map; using _Base::_M_get_Tp_allocator; /** * A total of four data members accumulated down the hierarchy. * May be accessed via _M_impl.* */ using _Base::_M_impl; public: // [23.2.1.1] construct/copy/destroy // (assign() and get_allocator() are also listed in this section) /** * @brief Default constructor creates no elements. */ deque() : _Base() { } /** * @brief Creates a %deque with no elements. * @param __a An allocator object. */ explicit deque(const allocator_type& __a) : _Base(__a, 0) { } #if __cplusplus >= 201103L /** * @brief Creates a %deque with default constructed elements. * @param __n The number of elements to initially create. * * This constructor fills the %deque with @a n default * constructed elements. */ explicit deque(size_type __n) : _Base(__n) { _M_default_initialize(); } /** * @brief Creates a %deque with copies of an exemplar element. * @param __n The number of elements to initially create. * @param __value An element to copy. * @param __a An allocator. * * This constructor fills the %deque with @a __n copies of @a __value. */ deque(size_type __n, const value_type& __value, const allocator_type& __a = allocator_type()) : _Base(__a, __n) { _M_fill_initialize(__value); } #else /** * @brief Creates a %deque with copies of an exemplar element. * @param __n The number of elements to initially create. * @param __value An element to copy. * @param __a An allocator. * * This constructor fills the %deque with @a __n copies of @a __value. */ explicit deque(size_type __n, const value_type& __value = value_type(), const allocator_type& __a = allocator_type()) : _Base(__a, __n) { _M_fill_initialize(__value); } #endif /** * @brief %Deque copy constructor. * @param __x A %deque of identical element and allocator types. * * The newly-created %deque uses a copy of the allocation object used * by @a __x. */ deque(const deque& __x) : _Base(__x._M_get_Tp_allocator(), __x.size()) { std::__uninitialized_copy_a(__x.begin(), __x.end(), this->_M_impl._M_start, _M_get_Tp_allocator()); } #if __cplusplus >= 201103L /** * @brief %Deque move constructor. * @param __x A %deque of identical element and allocator types. * * The newly-created %deque contains the exact contents of @a __x. * The contents of @a __x are a valid, but unspecified %deque. */ deque(deque&& __x) : _Base(std::move(__x)) { } /** * @brief Builds a %deque from an initializer list. * @param __l An initializer_list. * @param __a An allocator object. * * Create a %deque consisting of copies of the elements in the * initializer_list @a __l. * * This will call the element type's copy constructor N times * (where N is __l.size()) and do no memory reallocation. */ deque(initializer_list<value_type> __l, const allocator_type& __a = allocator_type()) : _Base(__a) { _M_range_initialize(__l.begin(), __l.end(), random_access_iterator_tag()); } #endif /** * @brief Builds a %deque from a range. * @param __first An input iterator. * @param __last An input iterator. * @param __a An allocator object. * * Create a %deque consisting of copies of the elements from [__first, * __last). * * If the iterators are forward, bidirectional, or random-access, then * this will call the elements' copy constructor N times (where N is * distance(__first,__last)) and do no memory reallocation. But if only * input iterators are used, then this will do at most 2N calls to the * copy constructor, and logN memory reallocations. */ #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> deque(_InputIterator __first, _InputIterator __last, const allocator_type& __a = allocator_type()) : _Base(__a) { _M_initialize_dispatch(__first, __last, __false_type()); } #else template<typename _InputIterator> deque(_InputIterator __first, _InputIterator __last, const allocator_type& __a = allocator_type()) : _Base(__a) { // Check whether it's an integral type. If so, it's not an iterator. typedef typename std::__is_integer<_InputIterator>::__type _Integral; _M_initialize_dispatch(__first, __last, _Integral()); } #endif /** * The dtor only erases the elements, and note that if the elements * themselves are pointers, the pointed-to memory is not touched in any * way. Managing the pointer is the user's responsibility. */ ~deque() _GLIBCXX_NOEXCEPT { _M_destroy_data(begin(), end(), _M_get_Tp_allocator()); } /** * @brief %Deque assignment operator. * @param __x A %deque of identical element and allocator types. * * All the elements of @a x are copied, but unlike the copy constructor, * the allocator object is not copied. */ deque& operator=(const deque& __x); #if __cplusplus >= 201103L /** * @brief %Deque move assignment operator. * @param __x A %deque of identical element and allocator types. * * The contents of @a __x are moved into this deque (without copying). * @a __x is a valid, but unspecified %deque. */ deque& operator=(deque&& __x) { // NB: DR 1204. // NB: DR 675. this->clear(); this->swap(__x); return *this; } /** * @brief Assigns an initializer list to a %deque. * @param __l An initializer_list. * * This function fills a %deque with copies of the elements in the * initializer_list @a __l. * * Note that the assignment completely changes the %deque and that the * resulting %deque's size is the same as the number of elements * assigned. Old data may be lost. */ deque& operator=(initializer_list<value_type> __l) { this->assign(__l.begin(), __l.end()); return *this; } #endif /** * @brief Assigns a given value to a %deque. * @param __n Number of elements to be assigned. * @param __val Value to be assigned. * * This function fills a %deque with @a n copies of the given * value. Note that the assignment completely changes the * %deque and that the resulting %deque's size is the same as * the number of elements assigned. Old data may be lost. */ void assign(size_type __n, const value_type& __val) { _M_fill_assign(__n, __val); } /** * @brief Assigns a range to a %deque. * @param __first An input iterator. * @param __last An input iterator. * * This function fills a %deque with copies of the elements in the * range [__first,__last). * * Note that the assignment completely changes the %deque and that the * resulting %deque's size is the same as the number of elements * assigned. Old data may be lost. */ #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> void assign(_InputIterator __first, _InputIterator __last) { _M_assign_dispatch(__first, __last, __false_type()); } #else template<typename _InputIterator> void assign(_InputIterator __first, _InputIterator __last) { typedef typename std::__is_integer<_InputIterator>::__type _Integral; _M_assign_dispatch(__first, __last, _Integral()); } #endif #if __cplusplus >= 201103L /** * @brief Assigns an initializer list to a %deque. * @param __l An initializer_list. * * This function fills a %deque with copies of the elements in the * initializer_list @a __l. * * Note that the assignment completely changes the %deque and that the * resulting %deque's size is the same as the number of elements * assigned. Old data may be lost. */ void assign(initializer_list<value_type> __l) { this->assign(__l.begin(), __l.end()); } #endif /// Get a copy of the memory allocation object. allocator_type get_allocator() const _GLIBCXX_NOEXCEPT { return _Base::get_allocator(); } // iterators /** * Returns a read/write iterator that points to the first element in the * %deque. Iteration is done in ordinary element order. */ iterator begin() _GLIBCXX_NOEXCEPT { return this->_M_impl._M_start; } /** * Returns a read-only (constant) iterator that points to the first * element in the %deque. Iteration is done in ordinary element order. */ const_iterator begin() const _GLIBCXX_NOEXCEPT { return this->_M_impl._M_start; } /** * Returns a read/write iterator that points one past the last * element in the %deque. Iteration is done in ordinary * element order. */ iterator end() _GLIBCXX_NOEXCEPT { return this->_M_impl._M_finish; } /** * Returns a read-only (constant) iterator that points one past * the last element in the %deque. Iteration is done in * ordinary element order. */ const_iterator end() const _GLIBCXX_NOEXCEPT { return this->_M_impl._M_finish; } /** * Returns a read/write reverse iterator that points to the * last element in the %deque. Iteration is done in reverse * element order. */ reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(this->_M_impl._M_finish); } /** * Returns a read-only (constant) reverse iterator that points * to the last element in the %deque. Iteration is done in * reverse element order. */ const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(this->_M_impl._M_finish); } /** * Returns a read/write reverse iterator that points to one * before the first element in the %deque. Iteration is done * in reverse element order. */ reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(this->_M_impl._M_start); } /** * Returns a read-only (constant) reverse iterator that points * to one before the first element in the %deque. Iteration is * done in reverse element order. */ const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(this->_M_impl._M_start); } #if __cplusplus >= 201103L /** * Returns a read-only (constant) iterator that points to the first * element in the %deque. Iteration is done in ordinary element order. */ const_iterator cbegin() const noexcept { return this->_M_impl._M_start; } /** * Returns a read-only (constant) iterator that points one past * the last element in the %deque. Iteration is done in * ordinary element order. */ const_iterator cend() const noexcept { return this->_M_impl._M_finish; } /** * Returns a read-only (constant) reverse iterator that points * to the last element in the %deque. Iteration is done in * reverse element order. */ const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(this->_M_impl._M_finish); } /** * Returns a read-only (constant) reverse iterator that points * to one before the first element in the %deque. Iteration is * done in reverse element order. */ const_reverse_iterator crend() const noexcept { return const_reverse_iterator(this->_M_impl._M_start); } #endif // [23.2.1.2] capacity /** Returns the number of elements in the %deque. */ size_type size() const _GLIBCXX_NOEXCEPT { return this->_M_impl._M_finish - this->_M_impl._M_start; } /** Returns the size() of the largest possible %deque. */ size_type max_size() const _GLIBCXX_NOEXCEPT { return _M_get_Tp_allocator().max_size(); } #if __cplusplus >= 201103L /** * @brief Resizes the %deque to the specified number of elements. * @param __new_size Number of elements the %deque should contain. * * This function will %resize the %deque to the specified * number of elements. If the number is smaller than the * %deque's current size the %deque is truncated, otherwise * default constructed elements are appended. */ void resize(size_type __new_size) { const size_type __len = size(); if (__new_size > __len) _M_default_append(__new_size - __len); else if (__new_size < __len) _M_erase_at_end(this->_M_impl._M_start + difference_type(__new_size)); } /** * @brief Resizes the %deque to the specified number of elements. * @param __new_size Number of elements the %deque should contain. * @param __x Data with which new elements should be populated. * * This function will %resize the %deque to the specified * number of elements. If the number is smaller than the * %deque's current size the %deque is truncated, otherwise the * %deque is extended and new elements are populated with given * data. */ void resize(size_type __new_size, const value_type& __x) { const size_type __len = size(); if (__new_size > __len) insert(this->_M_impl._M_finish, __new_size - __len, __x); else if (__new_size < __len) _M_erase_at_end(this->_M_impl._M_start + difference_type(__new_size)); } #else /** * @brief Resizes the %deque to the specified number of elements. * @param __new_size Number of elements the %deque should contain. * @param __x Data with which new elements should be populated. * * This function will %resize the %deque to the specified * number of elements. If the number is smaller than the * %deque's current size the %deque is truncated, otherwise the * %deque is extended and new elements are populated with given * data. */ void resize(size_type __new_size, value_type __x = value_type()) { const size_type __len = size(); if (__new_size > __len) insert(this->_M_impl._M_finish, __new_size - __len, __x); else if (__new_size < __len) _M_erase_at_end(this->_M_impl._M_start + difference_type(__new_size)); } #endif #if __cplusplus >= 201103L /** A non-binding request to reduce memory use. */ void shrink_to_fit() { _M_shrink_to_fit(); } #endif /** * Returns true if the %deque is empty. (Thus begin() would * equal end().) */ bool empty() const _GLIBCXX_NOEXCEPT { return this->_M_impl._M_finish == this->_M_impl._M_start; } // element access /** * @brief Subscript access to the data contained in the %deque. * @param __n The index of the element for which data should be * accessed. * @return Read/write reference to data. * * This operator allows for easy, array-style, data access. * Note that data access with this operator is unchecked and * out_of_range lookups are not defined. (For checked lookups * see at().) */ reference operator[](size_type __n) { return this->_M_impl._M_start[difference_type(__n)]; } /** * @brief Subscript access to the data contained in the %deque. * @param __n The index of the element for which data should be * accessed. * @return Read-only (constant) reference to data. * * This operator allows for easy, array-style, data access. * Note that data access with this operator is unchecked and * out_of_range lookups are not defined. (For checked lookups * see at().) */ const_reference operator[](size_type __n) const { return this->_M_impl._M_start[difference_type(__n)]; } protected: /// Safety check used only from at(). void _M_range_check(size_type __n) const { if (__n >= this->size()) __throw_out_of_range(__N("deque::_M_range_check")); } public: /** * @brief Provides access to the data contained in the %deque. * @param __n The index of the element for which data should be * accessed. * @return Read/write reference to data. * @throw std::out_of_range If @a __n is an invalid index. * * This function provides for safer data access. The parameter * is first checked that it is in the range of the deque. The * function throws out_of_range if the check fails. */ reference at(size_type __n) { _M_range_check(__n); return (*this)[__n]; } /** * @brief Provides access to the data contained in the %deque. * @param __n The index of the element for which data should be * accessed. * @return Read-only (constant) reference to data. * @throw std::out_of_range If @a __n is an invalid index. * * This function provides for safer data access. The parameter is first * checked that it is in the range of the deque. The function throws * out_of_range if the check fails. */ const_reference at(size_type __n) const { _M_range_check(__n); return (*this)[__n]; } /** * Returns a read/write reference to the data at the first * element of the %deque. */ reference front() { return *begin(); } /** * Returns a read-only (constant) reference to the data at the first * element of the %deque. */ const_reference front() const { return *begin(); } /** * Returns a read/write reference to the data at the last element of the * %deque. */ reference back() { iterator __tmp = end(); --__tmp; return *__tmp; } /** * Returns a read-only (constant) reference to the data at the last * element of the %deque. */ const_reference back() const { const_iterator __tmp = end(); --__tmp; return *__tmp; } // [23.2.1.2] modifiers /** * @brief Add data to the front of the %deque. * @param __x Data to be added. * * This is a typical stack operation. The function creates an * element at the front of the %deque and assigns the given * data to it. Due to the nature of a %deque this operation * can be done in constant time. */ void push_front(const value_type& __x) { if (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_first) { this->_M_impl.construct(this->_M_impl._M_start._M_cur - 1, __x); --this->_M_impl._M_start._M_cur; } else _M_push_front_aux(__x); } #if __cplusplus >= 201103L void push_front(value_type&& __x) { emplace_front(std::move(__x)); } template<typename... _Args> void emplace_front(_Args&&... __args); #endif /** * @brief Add data to the end of the %deque. * @param __x Data to be added. * * This is a typical stack operation. The function creates an * element at the end of the %deque and assigns the given data * to it. Due to the nature of a %deque this operation can be * done in constant time. */ void push_back(const value_type& __x) { if (this->_M_impl._M_finish._M_cur != this->_M_impl._M_finish._M_last - 1) { this->_M_impl.construct(this->_M_impl._M_finish._M_cur, __x); ++this->_M_impl._M_finish._M_cur; } else _M_push_back_aux(__x); } #if __cplusplus >= 201103L void push_back(value_type&& __x) { emplace_back(std::move(__x)); } template<typename... _Args> void emplace_back(_Args&&... __args); #endif /** * @brief Removes first element. * * This is a typical stack operation. It shrinks the %deque by one. * * Note that no data is returned, and if the first element's data is * needed, it should be retrieved before pop_front() is called. */ void pop_front() { if (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_last - 1) { this->_M_impl.destroy(this->_M_impl._M_start._M_cur); ++this->_M_impl._M_start._M_cur; } else _M_pop_front_aux(); } /** * @brief Removes last element. * * This is a typical stack operation. It shrinks the %deque by one. * * Note that no data is returned, and if the last element's data is * needed, it should be retrieved before pop_back() is called. */ void pop_back() { if (this->_M_impl._M_finish._M_cur != this->_M_impl._M_finish._M_first) { --this->_M_impl._M_finish._M_cur; this->_M_impl.destroy(this->_M_impl._M_finish._M_cur); } else _M_pop_back_aux(); } #if __cplusplus >= 201103L /** * @brief Inserts an object in %deque before specified iterator. * @param __position An iterator into the %deque. * @param __args Arguments. * @return An iterator that points to the inserted data. * * This function will insert an object of type T constructed * with T(std::forward<Args>(args)...) before the specified location. */ template<typename... _Args> iterator emplace(iterator __position, _Args&&... __args); #endif /** * @brief Inserts given value into %deque before specified iterator. * @param __position An iterator into the %deque. * @param __x Data to be inserted. * @return An iterator that points to the inserted data. * * This function will insert a copy of the given value before the * specified location. */ iterator insert(iterator __position, const value_type& __x); #if __cplusplus >= 201103L /** * @brief Inserts given rvalue into %deque before specified iterator. * @param __position An iterator into the %deque. * @param __x Data to be inserted. * @return An iterator that points to the inserted data. * * This function will insert a copy of the given rvalue before the * specified location. */ iterator insert(iterator __position, value_type&& __x) { return emplace(__position, std::move(__x)); } /** * @brief Inserts an initializer list into the %deque. * @param __p An iterator into the %deque. * @param __l An initializer_list. * * This function will insert copies of the data in the * initializer_list @a __l into the %deque before the location * specified by @a __p. This is known as <em>list insert</em>. */ void insert(iterator __p, initializer_list<value_type> __l) { this->insert(__p, __l.begin(), __l.end()); } #endif /** * @brief Inserts a number of copies of given data into the %deque. * @param __position An iterator into the %deque. * @param __n Number of elements to be inserted. * @param __x Data to be inserted. * * This function will insert a specified number of copies of the given * data before the location specified by @a __position. */ void insert(iterator __position, size_type __n, const value_type& __x) { _M_fill_insert(__position, __n, __x); } /** * @brief Inserts a range into the %deque. * @param __position An iterator into the %deque. * @param __first An input iterator. * @param __last An input iterator. * * This function will insert copies of the data in the range * [__first,__last) into the %deque before the location specified * by @a __position. This is known as <em>range insert</em>. */ #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> void insert(iterator __position, _InputIterator __first, _InputIterator __last) { _M_insert_dispatch(__position, __first, __last, __false_type()); } #else template<typename _InputIterator> void insert(iterator __position, _InputIterator __first, _InputIterator __last) { // Check whether it's an integral type. If so, it's not an iterator. typedef typename std::__is_integer<_InputIterator>::__type _Integral; _M_insert_dispatch(__position, __first, __last, _Integral()); } #endif /** * @brief Remove element at given position. * @param __position Iterator pointing to element to be erased. * @return An iterator pointing to the next element (or end()). * * This function will erase the element at the given position and thus * shorten the %deque by one. * * The user is cautioned that * this function only erases the element, and that if the element is * itself a pointer, the pointed-to memory is not touched in any way. * Managing the pointer is the user's responsibility. */ iterator erase(iterator __position); /** * @brief Remove a range of elements. * @param __first Iterator pointing to the first element to be erased. * @param __last Iterator pointing to one past the last element to be * erased. * @return An iterator pointing to the element pointed to by @a last * prior to erasing (or end()). * * This function will erase the elements in the range * [__first,__last) and shorten the %deque accordingly. * * The user is cautioned that * this function only erases the elements, and that if the elements * themselves are pointers, the pointed-to memory is not touched in any * way. Managing the pointer is the user's responsibility. */ iterator erase(iterator __first, iterator __last); /** * @brief Swaps data with another %deque. * @param __x A %deque of the same element and allocator types. * * This exchanges the elements between two deques in constant time. * (Four pointers, so it should be quite fast.) * Note that the global std::swap() function is specialized such that * std::swap(d1,d2) will feed to this function. */ void swap(deque& __x) { std::swap(this->_M_impl._M_start, __x._M_impl._M_start); std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish); std::swap(this->_M_impl._M_map, __x._M_impl._M_map); std::swap(this->_M_impl._M_map_size, __x._M_impl._M_map_size); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 431. Swapping containers with unequal allocators. std::__alloc_swap<_Tp_alloc_type>::_S_do_it(_M_get_Tp_allocator(), __x._M_get_Tp_allocator()); } /** * Erases all the elements. Note that this function only erases the * elements, and that if the elements themselves are pointers, the * pointed-to memory is not touched in any way. Managing the pointer is * the user's responsibility. */ void clear() _GLIBCXX_NOEXCEPT { _M_erase_at_end(begin()); } protected: // Internal constructor functions follow. // called by the range constructor to implement [23.1.1]/9 // _GLIBCXX_RESOLVE_LIB_DEFECTS // 438. Ambiguity in the "do the right thing" clause template<typename _Integer> void _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) { _M_initialize_map(static_cast<size_type>(__n)); _M_fill_initialize(__x); } // called by the range constructor to implement [23.1.1]/9 template<typename _InputIterator> void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, __false_type) { typedef typename std::iterator_traits<_InputIterator>:: iterator_category _IterCategory; _M_range_initialize(__first, __last, _IterCategory()); } // called by the second initialize_dispatch above //@{ /** * @brief Fills the deque with whatever is in [first,last). * @param __first An input iterator. * @param __last An input iterator. * @return Nothing. * * If the iterators are actually forward iterators (or better), then the * memory layout can be done all at once. Else we move forward using * push_back on each value from the iterator. */ template<typename _InputIterator> void _M_range_initialize(_InputIterator __first, _InputIterator __last, std::input_iterator_tag); // called by the second initialize_dispatch above template<typename _ForwardIterator> void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag); //@} /** * @brief Fills the %deque with copies of value. * @param __value Initial value. * @return Nothing. * @pre _M_start and _M_finish have already been initialized, * but none of the %deque's elements have yet been constructed. * * This function is called only when the user provides an explicit size * (with or without an explicit exemplar value). */ void _M_fill_initialize(const value_type& __value); #if __cplusplus >= 201103L // called by deque(n). void _M_default_initialize(); #endif // Internal assign functions follow. The *_aux functions do the actual // assignment work for the range versions. // called by the range assign to implement [23.1.1]/9 // _GLIBCXX_RESOLVE_LIB_DEFECTS // 438. Ambiguity in the "do the right thing" clause template<typename _Integer> void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) { _M_fill_assign(__n, __val); } // called by the range assign to implement [23.1.1]/9 template<typename _InputIterator> void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, __false_type) { typedef typename std::iterator_traits<_InputIterator>:: iterator_category _IterCategory; _M_assign_aux(__first, __last, _IterCategory()); } // called by the second assign_dispatch above template<typename _InputIterator> void _M_assign_aux(_InputIterator __first, _InputIterator __last, std::input_iterator_tag); // called by the second assign_dispatch above template<typename _ForwardIterator> void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag) { const size_type __len = std::distance(__first, __last); if (__len > size()) { _ForwardIterator __mid = __first; std::advance(__mid, size()); std::copy(__first, __mid, begin()); insert(end(), __mid, __last); } else _M_erase_at_end(std::copy(__first, __last, begin())); } // Called by assign(n,t), and the range assign when it turns out // to be the same thing. void _M_fill_assign(size_type __n, const value_type& __val) { if (__n > size()) { std::fill(begin(), end(), __val); insert(end(), __n - size(), __val); } else { _M_erase_at_end(begin() + difference_type(__n)); std::fill(begin(), end(), __val); } } //@{ /// Helper functions for push_* and pop_*. #if __cplusplus < 201103L void _M_push_back_aux(const value_type&); void _M_push_front_aux(const value_type&); #else template<typename... _Args> void _M_push_back_aux(_Args&&... __args); template<typename... _Args> void _M_push_front_aux(_Args&&... __args); #endif void _M_pop_back_aux(); void _M_pop_front_aux(); //@} // Internal insert functions follow. The *_aux functions do the actual // insertion work when all shortcuts fail. // called by the range insert to implement [23.1.1]/9 // _GLIBCXX_RESOLVE_LIB_DEFECTS // 438. Ambiguity in the "do the right thing" clause template<typename _Integer> void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, __true_type) { _M_fill_insert(__pos, __n, __x); } // called by the range insert to implement [23.1.1]/9 template<typename _InputIterator> void _M_insert_dispatch(iterator __pos, _InputIterator __first, _InputIterator __last, __false_type) { typedef typename std::iterator_traits<_InputIterator>:: iterator_category _IterCategory; _M_range_insert_aux(__pos, __first, __last, _IterCategory()); } // called by the second insert_dispatch above template<typename _InputIterator> void _M_range_insert_aux(iterator __pos, _InputIterator __first, _InputIterator __last, std::input_iterator_tag); // called by the second insert_dispatch above template<typename _ForwardIterator> void _M_range_insert_aux(iterator __pos, _ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag); // Called by insert(p,n,x), and the range insert when it turns out to be // the same thing. Can use fill functions in optimal situations, // otherwise passes off to insert_aux(p,n,x). void _M_fill_insert(iterator __pos, size_type __n, const value_type& __x); // called by insert(p,x) #if __cplusplus < 201103L iterator _M_insert_aux(iterator __pos, const value_type& __x); #else template<typename... _Args> iterator _M_insert_aux(iterator __pos, _Args&&... __args); #endif // called by insert(p,n,x) via fill_insert void _M_insert_aux(iterator __pos, size_type __n, const value_type& __x); // called by range_insert_aux for forward iterators template<typename _ForwardIterator> void _M_insert_aux(iterator __pos, _ForwardIterator __first, _ForwardIterator __last, size_type __n); // Internal erase functions follow. void _M_destroy_data_aux(iterator __first, iterator __last); // Called by ~deque(). // NB: Doesn't deallocate the nodes. template<typename _Alloc1> void _M_destroy_data(iterator __first, iterator __last, const _Alloc1&) { _M_destroy_data_aux(__first, __last); } void _M_destroy_data(iterator __first, iterator __last, const std::allocator<_Tp>&) { if (!__has_trivial_destructor(value_type)) _M_destroy_data_aux(__first, __last); } // Called by erase(q1, q2). void _M_erase_at_begin(iterator __pos) { _M_destroy_data(begin(), __pos, _M_get_Tp_allocator()); _M_destroy_nodes(this->_M_impl._M_start._M_node, __pos._M_node); this->_M_impl._M_start = __pos; } // Called by erase(q1, q2), resize(), clear(), _M_assign_aux, // _M_fill_assign, operator=. void _M_erase_at_end(iterator __pos) { _M_destroy_data(__pos, end(), _M_get_Tp_allocator()); _M_destroy_nodes(__pos._M_node + 1, this->_M_impl._M_finish._M_node + 1); this->_M_impl._M_finish = __pos; } #if __cplusplus >= 201103L // Called by resize(sz). void _M_default_append(size_type __n); bool _M_shrink_to_fit(); #endif //@{ /// Memory-handling helpers for the previous internal insert functions. iterator _M_reserve_elements_at_front(size_type __n) { const size_type __vacancies = this->_M_impl._M_start._M_cur - this->_M_impl._M_start._M_first; if (__n > __vacancies) _M_new_elements_at_front(__n - __vacancies); return this->_M_impl._M_start - difference_type(__n); } iterator _M_reserve_elements_at_back(size_type __n) { const size_type __vacancies = (this->_M_impl._M_finish._M_last - this->_M_impl._M_finish._M_cur) - 1; if (__n > __vacancies) _M_new_elements_at_back(__n - __vacancies); return this->_M_impl._M_finish + difference_type(__n); } void _M_new_elements_at_front(size_type __new_elements); void _M_new_elements_at_back(size_type __new_elements); //@} //@{ /** * @brief Memory-handling helpers for the major %map. * * Makes sure the _M_map has space for new nodes. Does not * actually add the nodes. Can invalidate _M_map pointers. * (And consequently, %deque iterators.) */ void _M_reserve_map_at_back(size_type __nodes_to_add = 1) { if (__nodes_to_add + 1 > this->_M_impl._M_map_size - (this->_M_impl._M_finish._M_node - this->_M_impl._M_map)) _M_reallocate_map(__nodes_to_add, false); } void _M_reserve_map_at_front(size_type __nodes_to_add = 1) { if (__nodes_to_add > size_type(this->_M_impl._M_start._M_node - this->_M_impl._M_map)) _M_reallocate_map(__nodes_to_add, true); } void _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front); //@} }; /** * @brief Deque equality comparison. * @param __x A %deque. * @param __y A %deque of the same type as @a __x. * @return True iff the size and elements of the deques are equal. * * This is an equivalence relation. It is linear in the size of the * deques. Deques are considered equivalent if their sizes are equal, * and if corresponding elements compare equal. */ template<typename _Tp, typename _Alloc> inline bool operator==(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y) { return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin()); } /** * @brief Deque ordering relation. * @param __x A %deque. * @param __y A %deque of the same type as @a __x. * @return True iff @a x is lexicographically less than @a __y. * * This is a total ordering relation. It is linear in the size of the * deques. The elements must be comparable with @c <. * * See std::lexicographical_compare() for how the determination is made. */ template<typename _Tp, typename _Alloc> inline bool operator<(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y) { return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); } /// Based on operator== template<typename _Tp, typename _Alloc> inline bool operator!=(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y) { return !(__x == __y); } /// Based on operator< template<typename _Tp, typename _Alloc> inline bool operator>(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y) { return __y < __x; } /// Based on operator< template<typename _Tp, typename _Alloc> inline bool operator<=(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y) { return !(__y < __x); } /// Based on operator< template<typename _Tp, typename _Alloc> inline bool operator>=(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y) { return !(__x < __y); } /// See std::deque::swap(). template<typename _Tp, typename _Alloc> inline void swap(deque<_Tp,_Alloc>& __x, deque<_Tp,_Alloc>& __y) { __x.swap(__y); } #undef _GLIBCXX_DEQUE_BUF_SIZE _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std #endif /* _STL_DEQUE_H */ �����������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_construct.h����������������������������������������������������������������������0000644�����������������00000012062�14763166030�0011614 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// nonstandard construct and destroy functions -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_construct.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{memory} */ #ifndef _STL_CONSTRUCT_H #define _STL_CONSTRUCT_H 1 #include <new> #include <bits/move.h> #include <ext/alloc_traits.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * Constructs an object in existing memory by invoking an allocated * object's constructor with an initializer. */ #if __cplusplus >= 201103L template<typename _T1, typename... _Args> inline void _Construct(_T1* __p, _Args&&... __args) { ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); } #else template<typename _T1, typename _T2> inline void _Construct(_T1* __p, const _T2& __value) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 402. wrong new expression in [some_]allocator::construct ::new(static_cast<void*>(__p)) _T1(__value); } #endif /** * Destroy the object pointed to by a pointer type. */ template<typename _Tp> inline void _Destroy(_Tp* __pointer) { __pointer->~_Tp(); } template<bool> struct _Destroy_aux { template<typename _ForwardIterator> static void __destroy(_ForwardIterator __first, _ForwardIterator __last) { for (; __first != __last; ++__first) std::_Destroy(std::__addressof(*__first)); } }; template<> struct _Destroy_aux<true> { template<typename _ForwardIterator> static void __destroy(_ForwardIterator, _ForwardIterator) { } }; /** * Destroy a range of objects. If the value_type of the object has * a trivial destructor, the compiler should optimize all of this * away, otherwise the objects' destructors must be invoked. */ template<typename _ForwardIterator> inline void _Destroy(_ForwardIterator __first, _ForwardIterator __last) { typedef typename iterator_traits<_ForwardIterator>::value_type _Value_type; std::_Destroy_aux<__has_trivial_destructor(_Value_type)>:: __destroy(__first, __last); } /** * Destroy a range of objects using the supplied allocator. For * nondefault allocators we do not optimize away invocation of * destroy() even if _Tp has a trivial destructor. */ template<typename _ForwardIterator, typename _Allocator> void _Destroy(_ForwardIterator __first, _ForwardIterator __last, _Allocator& __alloc) { typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; for (; __first != __last; ++__first) __traits::destroy(__alloc, std::__addressof(*__first)); } template<typename _ForwardIterator, typename _Tp> inline void _Destroy(_ForwardIterator __first, _ForwardIterator __last, allocator<_Tp>&) { _Destroy(__first, __last); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif /* _STL_CONSTRUCT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/char_traits.h������������������������������������������������������������������������0000644�����������������00000041720�14763166030�0011214 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Character Traits for use by standard string and iostream -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/char_traits.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{string} */ // // ISO C++ 14882: 21 Strings library // #ifndef _CHAR_TRAITS_H #define _CHAR_TRAITS_H 1 #pragma GCC system_header #include <bits/stl_algobase.h> // std::copy, std::fill_n #include <bits/postypes.h> // For streampos #include <cwchar> // For WEOF, wmemmove, wmemset, etc. namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Mapping from character type to associated types. * * @note This is an implementation class for the generic version * of char_traits. It defines int_type, off_type, pos_type, and * state_type. By default these are unsigned long, streamoff, * streampos, and mbstate_t. Users who need a different set of * types, but who don't need to change the definitions of any function * defined in char_traits, can specialize __gnu_cxx::_Char_types * while leaving __gnu_cxx::char_traits alone. */ template<typename _CharT> struct _Char_types { typedef unsigned long int_type; typedef std::streampos pos_type; typedef std::streamoff off_type; typedef std::mbstate_t state_type; }; /** * @brief Base class used to implement std::char_traits. * * @note For any given actual character type, this definition is * probably wrong. (Most of the member functions are likely to be * right, but the int_type and state_type typedefs, and the eof() * member function, are likely to be wrong.) The reason this class * exists is so users can specialize it. Classes in namespace std * may not be specialized for fundamental types, but classes in * namespace __gnu_cxx may be. * * See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt05ch13s03.html * for advice on how to make use of this class for @a unusual character * types. Also, check out include/ext/pod_char_traits.h. */ template<typename _CharT> struct char_traits { typedef _CharT char_type; typedef typename _Char_types<_CharT>::int_type int_type; typedef typename _Char_types<_CharT>::pos_type pos_type; typedef typename _Char_types<_CharT>::off_type off_type; typedef typename _Char_types<_CharT>::state_type state_type; static void assign(char_type& __c1, const char_type& __c2) { __c1 = __c2; } static _GLIBCXX_CONSTEXPR bool eq(const char_type& __c1, const char_type& __c2) { return __c1 == __c2; } static _GLIBCXX_CONSTEXPR bool lt(const char_type& __c1, const char_type& __c2) { return __c1 < __c2; } static int compare(const char_type* __s1, const char_type* __s2, std::size_t __n); static std::size_t length(const char_type* __s); static const char_type* find(const char_type* __s, std::size_t __n, const char_type& __a); static char_type* move(char_type* __s1, const char_type* __s2, std::size_t __n); static char_type* copy(char_type* __s1, const char_type* __s2, std::size_t __n); static char_type* assign(char_type* __s, std::size_t __n, char_type __a); static _GLIBCXX_CONSTEXPR char_type to_char_type(const int_type& __c) { return static_cast<char_type>(__c); } static _GLIBCXX_CONSTEXPR int_type to_int_type(const char_type& __c) { return static_cast<int_type>(__c); } static _GLIBCXX_CONSTEXPR bool eq_int_type(const int_type& __c1, const int_type& __c2) { return __c1 == __c2; } static _GLIBCXX_CONSTEXPR int_type eof() { return static_cast<int_type>(_GLIBCXX_STDIO_EOF); } static _GLIBCXX_CONSTEXPR int_type not_eof(const int_type& __c) { return !eq_int_type(__c, eof()) ? __c : to_int_type(char_type()); } }; template<typename _CharT> int char_traits<_CharT>:: compare(const char_type* __s1, const char_type* __s2, std::size_t __n) { for (std::size_t __i = 0; __i < __n; ++__i) if (lt(__s1[__i], __s2[__i])) return -1; else if (lt(__s2[__i], __s1[__i])) return 1; return 0; } template<typename _CharT> std::size_t char_traits<_CharT>:: length(const char_type* __p) { std::size_t __i = 0; while (!eq(__p[__i], char_type())) ++__i; return __i; } template<typename _CharT> const typename char_traits<_CharT>::char_type* char_traits<_CharT>:: find(const char_type* __s, std::size_t __n, const char_type& __a) { for (std::size_t __i = 0; __i < __n; ++__i) if (eq(__s[__i], __a)) return __s + __i; return 0; } template<typename _CharT> typename char_traits<_CharT>::char_type* char_traits<_CharT>:: move(char_type* __s1, const char_type* __s2, std::size_t __n) { return static_cast<_CharT*>(__builtin_memmove(__s1, __s2, __n * sizeof(char_type))); } template<typename _CharT> typename char_traits<_CharT>::char_type* char_traits<_CharT>:: copy(char_type* __s1, const char_type* __s2, std::size_t __n) { // NB: Inline std::copy so no recursive dependencies. std::copy(__s2, __s2 + __n, __s1); return __s1; } template<typename _CharT> typename char_traits<_CharT>::char_type* char_traits<_CharT>:: assign(char_type* __s, std::size_t __n, char_type __a) { // NB: Inline std::fill_n so no recursive dependencies. std::fill_n(__s, __n, __a); return __s; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // 21.1 /** * @brief Basis for explicit traits specializations. * * @note For any given actual character type, this definition is * probably wrong. Since this is just a thin wrapper around * __gnu_cxx::char_traits, it is possible to achieve a more * appropriate definition by specializing __gnu_cxx::char_traits. * * See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt05ch13s03.html * for advice on how to make use of this class for @a unusual character * types. Also, check out include/ext/pod_char_traits.h. */ template<class _CharT> struct char_traits : public __gnu_cxx::char_traits<_CharT> { }; /// 21.1.3.1 char_traits specializations template<> struct char_traits<char> { typedef char char_type; typedef int int_type; typedef streampos pos_type; typedef streamoff off_type; typedef mbstate_t state_type; static void assign(char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT { __c1 = __c2; } static _GLIBCXX_CONSTEXPR bool eq(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT { return __c1 == __c2; } static _GLIBCXX_CONSTEXPR bool lt(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT { return __c1 < __c2; } static int compare(const char_type* __s1, const char_type* __s2, size_t __n) { return __builtin_memcmp(__s1, __s2, __n); } static size_t length(const char_type* __s) { return __builtin_strlen(__s); } static const char_type* find(const char_type* __s, size_t __n, const char_type& __a) { return static_cast<const char_type*>(__builtin_memchr(__s, __a, __n)); } static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) { return static_cast<char_type*>(__builtin_memmove(__s1, __s2, __n)); } static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) { return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n)); } static char_type* assign(char_type* __s, size_t __n, char_type __a) { return static_cast<char_type*>(__builtin_memset(__s, __a, __n)); } static _GLIBCXX_CONSTEXPR char_type to_char_type(const int_type& __c) _GLIBCXX_NOEXCEPT { return static_cast<char_type>(__c); } // To keep both the byte 0xff and the eof symbol 0xffffffff // from ending up as 0xffffffff. static _GLIBCXX_CONSTEXPR int_type to_int_type(const char_type& __c) _GLIBCXX_NOEXCEPT { return static_cast<int_type>(static_cast<unsigned char>(__c)); } static _GLIBCXX_CONSTEXPR bool eq_int_type(const int_type& __c1, const int_type& __c2) _GLIBCXX_NOEXCEPT { return __c1 == __c2; } static _GLIBCXX_CONSTEXPR int_type eof() _GLIBCXX_NOEXCEPT { return static_cast<int_type>(_GLIBCXX_STDIO_EOF); } static _GLIBCXX_CONSTEXPR int_type not_eof(const int_type& __c) _GLIBCXX_NOEXCEPT { return (__c == eof()) ? 0 : __c; } }; #ifdef _GLIBCXX_USE_WCHAR_T /// 21.1.3.2 char_traits specializations template<> struct char_traits<wchar_t> { typedef wchar_t char_type; typedef wint_t int_type; typedef streamoff off_type; typedef wstreampos pos_type; typedef mbstate_t state_type; static void assign(char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT { __c1 = __c2; } static _GLIBCXX_CONSTEXPR bool eq(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT { return __c1 == __c2; } static _GLIBCXX_CONSTEXPR bool lt(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT { return __c1 < __c2; } static int compare(const char_type* __s1, const char_type* __s2, size_t __n) { return wmemcmp(__s1, __s2, __n); } static size_t length(const char_type* __s) { return wcslen(__s); } static const char_type* find(const char_type* __s, size_t __n, const char_type& __a) { return wmemchr(__s, __a, __n); } static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) { return wmemmove(__s1, __s2, __n); } static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) { return wmemcpy(__s1, __s2, __n); } static char_type* assign(char_type* __s, size_t __n, char_type __a) { return wmemset(__s, __a, __n); } static _GLIBCXX_CONSTEXPR char_type to_char_type(const int_type& __c) _GLIBCXX_NOEXCEPT { return char_type(__c); } static _GLIBCXX_CONSTEXPR int_type to_int_type(const char_type& __c) _GLIBCXX_NOEXCEPT { return int_type(__c); } static _GLIBCXX_CONSTEXPR bool eq_int_type(const int_type& __c1, const int_type& __c2) _GLIBCXX_NOEXCEPT { return __c1 == __c2; } static _GLIBCXX_CONSTEXPR int_type eof() _GLIBCXX_NOEXCEPT { return static_cast<int_type>(WEOF); } static _GLIBCXX_CONSTEXPR int_type not_eof(const int_type& __c) _GLIBCXX_NOEXCEPT { return eq_int_type(__c, eof()) ? 0 : __c; } }; #endif //_GLIBCXX_USE_WCHAR_T _GLIBCXX_END_NAMESPACE_VERSION } // namespace #if ((__cplusplus >= 201103L) \ && defined(_GLIBCXX_USE_C99_STDINT_TR1)) #include <cstdint> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<> struct char_traits<char16_t> { typedef char16_t char_type; typedef uint_least16_t int_type; typedef streamoff off_type; typedef u16streampos pos_type; typedef mbstate_t state_type; static void assign(char_type& __c1, const char_type& __c2) noexcept { __c1 = __c2; } static constexpr bool eq(const char_type& __c1, const char_type& __c2) noexcept { return __c1 == __c2; } static constexpr bool lt(const char_type& __c1, const char_type& __c2) noexcept { return __c1 < __c2; } static int compare(const char_type* __s1, const char_type* __s2, size_t __n) { for (size_t __i = 0; __i < __n; ++__i) if (lt(__s1[__i], __s2[__i])) return -1; else if (lt(__s2[__i], __s1[__i])) return 1; return 0; } static size_t length(const char_type* __s) { size_t __i = 0; while (!eq(__s[__i], char_type())) ++__i; return __i; } static const char_type* find(const char_type* __s, size_t __n, const char_type& __a) { for (size_t __i = 0; __i < __n; ++__i) if (eq(__s[__i], __a)) return __s + __i; return 0; } static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) { return (static_cast<char_type*> (__builtin_memmove(__s1, __s2, __n * sizeof(char_type)))); } static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) { return (static_cast<char_type*> (__builtin_memcpy(__s1, __s2, __n * sizeof(char_type)))); } static char_type* assign(char_type* __s, size_t __n, char_type __a) { for (size_t __i = 0; __i < __n; ++__i) assign(__s[__i], __a); return __s; } static constexpr char_type to_char_type(const int_type& __c) noexcept { return char_type(__c); } static constexpr int_type to_int_type(const char_type& __c) noexcept { return int_type(__c); } static constexpr bool eq_int_type(const int_type& __c1, const int_type& __c2) noexcept { return __c1 == __c2; } static constexpr int_type eof() noexcept { return static_cast<int_type>(-1); } static constexpr int_type not_eof(const int_type& __c) noexcept { return eq_int_type(__c, eof()) ? 0 : __c; } }; template<> struct char_traits<char32_t> { typedef char32_t char_type; typedef uint_least32_t int_type; typedef streamoff off_type; typedef u32streampos pos_type; typedef mbstate_t state_type; static void assign(char_type& __c1, const char_type& __c2) noexcept { __c1 = __c2; } static constexpr bool eq(const char_type& __c1, const char_type& __c2) noexcept { return __c1 == __c2; } static constexpr bool lt(const char_type& __c1, const char_type& __c2) noexcept { return __c1 < __c2; } static int compare(const char_type* __s1, const char_type* __s2, size_t __n) { for (size_t __i = 0; __i < __n; ++__i) if (lt(__s1[__i], __s2[__i])) return -1; else if (lt(__s2[__i], __s1[__i])) return 1; return 0; } static size_t length(const char_type* __s) { size_t __i = 0; while (!eq(__s[__i], char_type())) ++__i; return __i; } static const char_type* find(const char_type* __s, size_t __n, const char_type& __a) { for (size_t __i = 0; __i < __n; ++__i) if (eq(__s[__i], __a)) return __s + __i; return 0; } static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) { return (static_cast<char_type*> (__builtin_memmove(__s1, __s2, __n * sizeof(char_type)))); } static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) { return (static_cast<char_type*> (__builtin_memcpy(__s1, __s2, __n * sizeof(char_type)))); } static char_type* assign(char_type* __s, size_t __n, char_type __a) { for (size_t __i = 0; __i < __n; ++__i) assign(__s[__i], __a); return __s; } static constexpr char_type to_char_type(const int_type& __c) noexcept { return char_type(__c); } static constexpr int_type to_int_type(const char_type& __c) noexcept { return int_type(__c); } static constexpr bool eq_int_type(const int_type& __c1, const int_type& __c2) noexcept { return __c1 == __c2; } static constexpr int_type eof() noexcept { return static_cast<int_type>(-1); } static constexpr int_type not_eof(const int_type& __c) noexcept { return eq_int_type(__c, eof()) ? 0 : __c; } }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif #endif // _CHAR_TRAITS_H ������������������������������������������������c++/4.8.2/bits/regex_error.h������������������������������������������������������������������������0000644�����������������00000011003�14763166030�0011223 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// class template regex -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** * @file bits/regex_error.h * @brief Error and exception objects for the std regex library. * * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{regex} */ namespace std _GLIBCXX_VISIBILITY(default) { /** * @addtogroup regex * @{ */ namespace regex_constants { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @name 5.3 Error Types */ //@{ enum error_type { _S_error_collate, _S_error_ctype, _S_error_escape, _S_error_backref, _S_error_brack, _S_error_paren, _S_error_brace, _S_error_badbrace, _S_error_range, _S_error_space, _S_error_badrepeat, _S_error_complexity, _S_error_stack, _S_error_last }; /** The expression contained an invalid collating element name. */ constexpr error_type error_collate(_S_error_collate); /** The expression contained an invalid character class name. */ constexpr error_type error_ctype(_S_error_ctype); /** * The expression contained an invalid escaped character, or a trailing * escape. */ constexpr error_type error_escape(_S_error_escape); /** The expression contained an invalid back reference. */ constexpr error_type error_backref(_S_error_backref); /** The expression contained mismatched [ and ]. */ constexpr error_type error_brack(_S_error_brack); /** The expression contained mismatched ( and ). */ constexpr error_type error_paren(_S_error_paren); /** The expression contained mismatched { and } */ constexpr error_type error_brace(_S_error_brace); /** The expression contained an invalid range in a {} expression. */ constexpr error_type error_badbrace(_S_error_badbrace); /** * The expression contained an invalid character range, * such as [b-a] in most encodings. */ constexpr error_type error_range(_S_error_range); /** * There was insufficient memory to convert the expression into a * finite state machine. */ constexpr error_type error_space(_S_error_space); /** * One of <em>*?+{</em> was not preceded by a valid regular expression. */ constexpr error_type error_badrepeat(_S_error_badrepeat); /** * The complexity of an attempted match against a regular expression * exceeded a pre-set level. */ constexpr error_type error_complexity(_S_error_complexity); /** * There was insufficient memory to determine whether the * regular expression could match the specified character sequence. */ constexpr error_type error_stack(_S_error_stack); //@} _GLIBCXX_END_NAMESPACE_VERSION } // namespace regex_constants _GLIBCXX_BEGIN_NAMESPACE_VERSION // [7.8] Class regex_error /** * @brief A regular expression exception class. * @ingroup exceptions * * The regular expression library throws objects of this class on error. */ class regex_error : public std::runtime_error { regex_constants::error_type _M_code; public: /** * @brief Constructs a regex_error object. * * @param __ecode the regex error code. */ explicit regex_error(regex_constants::error_type __ecode); virtual ~regex_error() throw(); /** * @brief Gets the regex error code. * * @returns the regex error code. */ regex_constants::error_type code() const { return _M_code; } }; //@} // group regex void __throw_regex_error(regex_constants::error_type __ecode); _GLIBCXX_END_NAMESPACE_VERSION } // namespace std �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/concept_check.h����������������������������������������������������������������������0000644�����������������00000006414�14763166030�0011502 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Concept-checking control -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/concept_check.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{iterator} */ #ifndef _CONCEPT_CHECK_H #define _CONCEPT_CHECK_H 1 #pragma GCC system_header #include <bits/c++config.h> // All places in libstdc++-v3 where these are used, or /might/ be used, or // don't need to be used, or perhaps /should/ be used, are commented with // "concept requirements" (and maybe some more text). So grep like crazy // if you're looking for additional places to use these. // Concept-checking code is off by default unless users turn it on via // configure options or editing c++config.h. #ifndef _GLIBCXX_CONCEPT_CHECKS #define __glibcxx_function_requires(...) #define __glibcxx_class_requires(_a,_b) #define __glibcxx_class_requires2(_a,_b,_c) #define __glibcxx_class_requires3(_a,_b,_c,_d) #define __glibcxx_class_requires4(_a,_b,_c,_d,_e) #else // the checks are on #include <bits/boost_concept_check.h> // Note that the obvious and elegant approach of // //#define glibcxx_function_requires(C) debug::function_requires< debug::C >() // // won't work due to concept templates with more than one parameter, e.g., // BinaryPredicateConcept. The preprocessor tries to split things up on // the commas in the template argument list. We can't use an inner pair of // parenthesis to hide the commas, because "debug::(Temp<Foo,Bar>)" isn't // a valid instantiation pattern. Thus, we steal a feature from C99. #define __glibcxx_function_requires(...) \ __gnu_cxx::__function_requires< __gnu_cxx::__VA_ARGS__ >(); #define __glibcxx_class_requires(_a,_C) \ _GLIBCXX_CLASS_REQUIRES(_a, __gnu_cxx, _C); #define __glibcxx_class_requires2(_a,_b,_C) \ _GLIBCXX_CLASS_REQUIRES2(_a, _b, __gnu_cxx, _C); #define __glibcxx_class_requires3(_a,_b,_c,_C) \ _GLIBCXX_CLASS_REQUIRES3(_a, _b, _c, __gnu_cxx, _C); #define __glibcxx_class_requires4(_a,_b,_c,_d,_C) \ _GLIBCXX_CLASS_REQUIRES4(_a, _b, _c, _d, __gnu_cxx, _C); #endif // enable/disable #endif // _GLIBCXX_CONCEPT_CHECK ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/streambuf.tcc������������������������������������������������������������������������0000644�����������������00000011501�14763166030�0011215 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Stream buffer classes -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/streambuf.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{streambuf} */ // // ISO C++ 14882: 27.5 Stream buffers // #ifndef _STREAMBUF_TCC #define _STREAMBUF_TCC 1 #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _CharT, typename _Traits> streamsize basic_streambuf<_CharT, _Traits>:: xsgetn(char_type* __s, streamsize __n) { streamsize __ret = 0; while (__ret < __n) { const streamsize __buf_len = this->egptr() - this->gptr(); if (__buf_len) { const streamsize __remaining = __n - __ret; const streamsize __len = std::min(__buf_len, __remaining); traits_type::copy(__s, this->gptr(), __len); __ret += __len; __s += __len; this->__safe_gbump(__len); } if (__ret < __n) { const int_type __c = this->uflow(); if (!traits_type::eq_int_type(__c, traits_type::eof())) { traits_type::assign(*__s++, traits_type::to_char_type(__c)); ++__ret; } else break; } } return __ret; } template<typename _CharT, typename _Traits> streamsize basic_streambuf<_CharT, _Traits>:: xsputn(const char_type* __s, streamsize __n) { streamsize __ret = 0; while (__ret < __n) { const streamsize __buf_len = this->epptr() - this->pptr(); if (__buf_len) { const streamsize __remaining = __n - __ret; const streamsize __len = std::min(__buf_len, __remaining); traits_type::copy(this->pptr(), __s, __len); __ret += __len; __s += __len; this->__safe_pbump(__len); } if (__ret < __n) { int_type __c = this->overflow(traits_type::to_int_type(*__s)); if (!traits_type::eq_int_type(__c, traits_type::eof())) { ++__ret; ++__s; } else break; } } return __ret; } // Conceivably, this could be used to implement buffer-to-buffer // copies, if this was ever desired in an un-ambiguous way by the // standard. template<typename _CharT, typename _Traits> streamsize __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>* __sbin, basic_streambuf<_CharT, _Traits>* __sbout, bool& __ineof) { streamsize __ret = 0; __ineof = true; typename _Traits::int_type __c = __sbin->sgetc(); while (!_Traits::eq_int_type(__c, _Traits::eof())) { __c = __sbout->sputc(_Traits::to_char_type(__c)); if (_Traits::eq_int_type(__c, _Traits::eof())) { __ineof = false; break; } ++__ret; __c = __sbin->snextc(); } return __ret; } template<typename _CharT, typename _Traits> inline streamsize __copy_streambufs(basic_streambuf<_CharT, _Traits>* __sbin, basic_streambuf<_CharT, _Traits>* __sbout) { bool __ineof; return __copy_streambufs_eof(__sbin, __sbout, __ineof); } // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. #if _GLIBCXX_EXTERN_TEMPLATE extern template class basic_streambuf<char>; extern template streamsize __copy_streambufs(basic_streambuf<char>*, basic_streambuf<char>*); extern template streamsize __copy_streambufs_eof(basic_streambuf<char>*, basic_streambuf<char>*, bool&); #ifdef _GLIBCXX_USE_WCHAR_T extern template class basic_streambuf<wchar_t>; extern template streamsize __copy_streambufs(basic_streambuf<wchar_t>*, basic_streambuf<wchar_t>*); extern template streamsize __copy_streambufs_eof(basic_streambuf<wchar_t>*, basic_streambuf<wchar_t>*, bool&); #endif #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/algorithmfwd.h�����������������������������������������������������������������������0000644�����������������00000051245�14763166030�0011403 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <algorithm> Forward declarations -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/algorithmfwd.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{algorithm} */ #ifndef _GLIBCXX_ALGORITHMFWD_H #define _GLIBCXX_ALGORITHMFWD_H 1 #pragma GCC system_header #include <bits/c++config.h> #include <bits/stl_pair.h> #include <bits/stl_iterator_base_types.h> #if __cplusplus >= 201103L #include <initializer_list> #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /* adjacent_find all_of (C++0x) any_of (C++0x) binary_search copy copy_backward copy_if (C++0x) copy_n (C++0x) count count_if equal equal_range fill fill_n find find_end find_first_of find_if find_if_not (C++0x) for_each generate generate_n includes inplace_merge is_heap (C++0x) is_heap_until (C++0x) is_partitioned (C++0x) is_sorted (C++0x) is_sorted_until (C++0x) iter_swap lexicographical_compare lower_bound make_heap max max_element merge min min_element minmax (C++0x) minmax_element (C++0x) mismatch next_permutation none_of (C++0x) nth_element partial_sort partial_sort_copy partition partition_copy (C++0x) partition_point (C++0x) pop_heap prev_permutation push_heap random_shuffle remove remove_copy remove_copy_if remove_if replace replace_copy replace_copy_if replace_if reverse reverse_copy rotate rotate_copy search search_n set_difference set_intersection set_symmetric_difference set_union shuffle (C++0x) sort sort_heap stable_partition stable_sort swap swap_ranges transform unique unique_copy upper_bound */ /** * @defgroup algorithms Algorithms * * Components for performing algorithmic operations. Includes * non-modifying sequence, modifying (mutating) sequence, sorting, * searching, merge, partition, heap, set, minima, maxima, and * permutation operations. */ /** * @defgroup mutating_algorithms Mutating * @ingroup algorithms */ /** * @defgroup non_mutating_algorithms Non-Mutating * @ingroup algorithms */ /** * @defgroup sorting_algorithms Sorting * @ingroup algorithms */ /** * @defgroup set_algorithms Set Operation * @ingroup sorting_algorithms * * These algorithms are common set operations performed on sequences * that are already sorted. The number of comparisons will be * linear. */ /** * @defgroup binary_search_algorithms Binary Search * @ingroup sorting_algorithms * * These algorithms are variations of a classic binary search, and * all assume that the sequence being searched is already sorted. * * The number of comparisons will be logarithmic (and as few as * possible). The number of steps through the sequence will be * logarithmic for random-access iterators (e.g., pointers), and * linear otherwise. * * The LWG has passed Defect Report 270, which notes: <em>The * proposed resolution reinterprets binary search. Instead of * thinking about searching for a value in a sorted range, we view * that as an important special case of a more general algorithm: * searching for the partition point in a partitioned range. We * also add a guarantee that the old wording did not: we ensure that * the upper bound is no earlier than the lower bound, that the pair * returned by equal_range is a valid range, and that the first part * of that pair is the lower bound.</em> * * The actual effect of the first sentence is that a comparison * functor passed by the user doesn't necessarily need to induce a * strict weak ordering relation. Rather, it partitions the range. */ // adjacent_find #if __cplusplus >= 201103L template<typename _IIter, typename _Predicate> bool all_of(_IIter, _IIter, _Predicate); template<typename _IIter, typename _Predicate> bool any_of(_IIter, _IIter, _Predicate); #endif template<typename _FIter, typename _Tp> bool binary_search(_FIter, _FIter, const _Tp&); template<typename _FIter, typename _Tp, typename _Compare> bool binary_search(_FIter, _FIter, const _Tp&, _Compare); template<typename _IIter, typename _OIter> _OIter copy(_IIter, _IIter, _OIter); template<typename _BIter1, typename _BIter2> _BIter2 copy_backward(_BIter1, _BIter1, _BIter2); #if __cplusplus >= 201103L template<typename _IIter, typename _OIter, typename _Predicate> _OIter copy_if(_IIter, _IIter, _OIter, _Predicate); template<typename _IIter, typename _Size, typename _OIter> _OIter copy_n(_IIter, _Size, _OIter); #endif // count // count_if template<typename _FIter, typename _Tp> pair<_FIter, _FIter> equal_range(_FIter, _FIter, const _Tp&); template<typename _FIter, typename _Tp, typename _Compare> pair<_FIter, _FIter> equal_range(_FIter, _FIter, const _Tp&, _Compare); template<typename _FIter, typename _Tp> void fill(_FIter, _FIter, const _Tp&); template<typename _OIter, typename _Size, typename _Tp> _OIter fill_n(_OIter, _Size, const _Tp&); // find template<typename _FIter1, typename _FIter2> _FIter1 find_end(_FIter1, _FIter1, _FIter2, _FIter2); template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> _FIter1 find_end(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); // find_first_of // find_if #if __cplusplus >= 201103L template<typename _IIter, typename _Predicate> _IIter find_if_not(_IIter, _IIter, _Predicate); #endif // for_each // generate // generate_n template<typename _IIter1, typename _IIter2> bool includes(_IIter1, _IIter1, _IIter2, _IIter2); template<typename _IIter1, typename _IIter2, typename _Compare> bool includes(_IIter1, _IIter1, _IIter2, _IIter2, _Compare); template<typename _BIter> void inplace_merge(_BIter, _BIter, _BIter); template<typename _BIter, typename _Compare> void inplace_merge(_BIter, _BIter, _BIter, _Compare); #if __cplusplus >= 201103L template<typename _RAIter> bool is_heap(_RAIter, _RAIter); template<typename _RAIter, typename _Compare> bool is_heap(_RAIter, _RAIter, _Compare); template<typename _RAIter> _RAIter is_heap_until(_RAIter, _RAIter); template<typename _RAIter, typename _Compare> _RAIter is_heap_until(_RAIter, _RAIter, _Compare); template<typename _IIter, typename _Predicate> bool is_partitioned(_IIter, _IIter, _Predicate); template<typename _FIter1, typename _FIter2> bool is_permutation(_FIter1, _FIter1, _FIter2); template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> bool is_permutation(_FIter1, _FIter1, _FIter2, _BinaryPredicate); template<typename _FIter> bool is_sorted(_FIter, _FIter); template<typename _FIter, typename _Compare> bool is_sorted(_FIter, _FIter, _Compare); template<typename _FIter> _FIter is_sorted_until(_FIter, _FIter); template<typename _FIter, typename _Compare> _FIter is_sorted_until(_FIter, _FIter, _Compare); #endif template<typename _FIter1, typename _FIter2> void iter_swap(_FIter1, _FIter2); template<typename _FIter, typename _Tp> _FIter lower_bound(_FIter, _FIter, const _Tp&); template<typename _FIter, typename _Tp, typename _Compare> _FIter lower_bound(_FIter, _FIter, const _Tp&, _Compare); template<typename _RAIter> void make_heap(_RAIter, _RAIter); template<typename _RAIter, typename _Compare> void make_heap(_RAIter, _RAIter, _Compare); template<typename _Tp> const _Tp& max(const _Tp&, const _Tp&); template<typename _Tp, typename _Compare> const _Tp& max(const _Tp&, const _Tp&, _Compare); // max_element // merge template<typename _Tp> const _Tp& min(const _Tp&, const _Tp&); template<typename _Tp, typename _Compare> const _Tp& min(const _Tp&, const _Tp&, _Compare); // min_element #if __cplusplus >= 201103L template<typename _Tp> pair<const _Tp&, const _Tp&> minmax(const _Tp&, const _Tp&); template<typename _Tp, typename _Compare> pair<const _Tp&, const _Tp&> minmax(const _Tp&, const _Tp&, _Compare); template<typename _FIter> pair<_FIter, _FIter> minmax_element(_FIter, _FIter); template<typename _FIter, typename _Compare> pair<_FIter, _FIter> minmax_element(_FIter, _FIter, _Compare); template<typename _Tp> _Tp min(initializer_list<_Tp>); template<typename _Tp, typename _Compare> _Tp min(initializer_list<_Tp>, _Compare); template<typename _Tp> _Tp max(initializer_list<_Tp>); template<typename _Tp, typename _Compare> _Tp max(initializer_list<_Tp>, _Compare); template<typename _Tp> pair<_Tp, _Tp> minmax(initializer_list<_Tp>); template<typename _Tp, typename _Compare> pair<_Tp, _Tp> minmax(initializer_list<_Tp>, _Compare); #endif // mismatch template<typename _BIter> bool next_permutation(_BIter, _BIter); template<typename _BIter, typename _Compare> bool next_permutation(_BIter, _BIter, _Compare); #if __cplusplus >= 201103L template<typename _IIter, typename _Predicate> bool none_of(_IIter, _IIter, _Predicate); #endif // nth_element // partial_sort template<typename _IIter, typename _RAIter> _RAIter partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter); template<typename _IIter, typename _RAIter, typename _Compare> _RAIter partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter, _Compare); // partition #if __cplusplus >= 201103L template<typename _IIter, typename _OIter1, typename _OIter2, typename _Predicate> pair<_OIter1, _OIter2> partition_copy(_IIter, _IIter, _OIter1, _OIter2, _Predicate); template<typename _FIter, typename _Predicate> _FIter partition_point(_FIter, _FIter, _Predicate); #endif template<typename _RAIter> void pop_heap(_RAIter, _RAIter); template<typename _RAIter, typename _Compare> void pop_heap(_RAIter, _RAIter, _Compare); template<typename _BIter> bool prev_permutation(_BIter, _BIter); template<typename _BIter, typename _Compare> bool prev_permutation(_BIter, _BIter, _Compare); template<typename _RAIter> void push_heap(_RAIter, _RAIter); template<typename _RAIter, typename _Compare> void push_heap(_RAIter, _RAIter, _Compare); // random_shuffle template<typename _FIter, typename _Tp> _FIter remove(_FIter, _FIter, const _Tp&); template<typename _FIter, typename _Predicate> _FIter remove_if(_FIter, _FIter, _Predicate); template<typename _IIter, typename _OIter, typename _Tp> _OIter remove_copy(_IIter, _IIter, _OIter, const _Tp&); template<typename _IIter, typename _OIter, typename _Predicate> _OIter remove_copy_if(_IIter, _IIter, _OIter, _Predicate); // replace template<typename _IIter, typename _OIter, typename _Tp> _OIter replace_copy(_IIter, _IIter, _OIter, const _Tp&, const _Tp&); template<typename _Iter, typename _OIter, typename _Predicate, typename _Tp> _OIter replace_copy_if(_Iter, _Iter, _OIter, _Predicate, const _Tp&); // replace_if template<typename _BIter> void reverse(_BIter, _BIter); template<typename _BIter, typename _OIter> _OIter reverse_copy(_BIter, _BIter, _OIter); template<typename _FIter> void rotate(_FIter, _FIter, _FIter); template<typename _FIter, typename _OIter> _OIter rotate_copy(_FIter, _FIter, _FIter, _OIter); // search // search_n // set_difference // set_intersection // set_symmetric_difference // set_union #if (__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99_STDINT_TR1) template<typename _RAIter, typename _UGenerator> void shuffle(_RAIter, _RAIter, _UGenerator&&); #endif template<typename _RAIter> void sort_heap(_RAIter, _RAIter); template<typename _RAIter, typename _Compare> void sort_heap(_RAIter, _RAIter, _Compare); template<typename _BIter, typename _Predicate> _BIter stable_partition(_BIter, _BIter, _Predicate); template<typename _Tp> void swap(_Tp&, _Tp&) #if __cplusplus >= 201103L noexcept(__and_<is_nothrow_move_constructible<_Tp>, is_nothrow_move_assignable<_Tp>>::value) #endif ; template<typename _Tp, size_t _Nm> void swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) #if __cplusplus >= 201103L noexcept(noexcept(swap(*__a, *__b))) #endif ; template<typename _FIter1, typename _FIter2> _FIter2 swap_ranges(_FIter1, _FIter1, _FIter2); // transform template<typename _FIter> _FIter unique(_FIter, _FIter); template<typename _FIter, typename _BinaryPredicate> _FIter unique(_FIter, _FIter, _BinaryPredicate); // unique_copy template<typename _FIter, typename _Tp> _FIter upper_bound(_FIter, _FIter, const _Tp&); template<typename _FIter, typename _Tp, typename _Compare> _FIter upper_bound(_FIter, _FIter, const _Tp&, _Compare); _GLIBCXX_END_NAMESPACE_VERSION _GLIBCXX_BEGIN_NAMESPACE_ALGO template<typename _FIter> _FIter adjacent_find(_FIter, _FIter); template<typename _FIter, typename _BinaryPredicate> _FIter adjacent_find(_FIter, _FIter, _BinaryPredicate); template<typename _IIter, typename _Tp> typename iterator_traits<_IIter>::difference_type count(_IIter, _IIter, const _Tp&); template<typename _IIter, typename _Predicate> typename iterator_traits<_IIter>::difference_type count_if(_IIter, _IIter, _Predicate); template<typename _IIter1, typename _IIter2> bool equal(_IIter1, _IIter1, _IIter2); template<typename _IIter1, typename _IIter2, typename _BinaryPredicate> bool equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate); template<typename _IIter, typename _Tp> _IIter find(_IIter, _IIter, const _Tp&); template<typename _FIter1, typename _FIter2> _FIter1 find_first_of(_FIter1, _FIter1, _FIter2, _FIter2); template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> _FIter1 find_first_of(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); template<typename _IIter, typename _Predicate> _IIter find_if(_IIter, _IIter, _Predicate); template<typename _IIter, typename _Funct> _Funct for_each(_IIter, _IIter, _Funct); template<typename _FIter, typename _Generator> void generate(_FIter, _FIter, _Generator); template<typename _OIter, typename _Size, typename _Generator> _OIter generate_n(_OIter, _Size, _Generator); template<typename _IIter1, typename _IIter2> bool lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2); template<typename _IIter1, typename _IIter2, typename _Compare> bool lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Compare); template<typename _FIter> _FIter max_element(_FIter, _FIter); template<typename _FIter, typename _Compare> _FIter max_element(_FIter, _FIter, _Compare); template<typename _IIter1, typename _IIter2, typename _OIter> _OIter merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); template<typename _IIter1, typename _IIter2, typename _OIter, typename _Compare> _OIter merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); template<typename _FIter> _FIter min_element(_FIter, _FIter); template<typename _FIter, typename _Compare> _FIter min_element(_FIter, _FIter, _Compare); template<typename _IIter1, typename _IIter2> pair<_IIter1, _IIter2> mismatch(_IIter1, _IIter1, _IIter2); template<typename _IIter1, typename _IIter2, typename _BinaryPredicate> pair<_IIter1, _IIter2> mismatch(_IIter1, _IIter1, _IIter2, _BinaryPredicate); template<typename _RAIter> void nth_element(_RAIter, _RAIter, _RAIter); template<typename _RAIter, typename _Compare> void nth_element(_RAIter, _RAIter, _RAIter, _Compare); template<typename _RAIter> void partial_sort(_RAIter, _RAIter, _RAIter); template<typename _RAIter, typename _Compare> void partial_sort(_RAIter, _RAIter, _RAIter, _Compare); template<typename _BIter, typename _Predicate> _BIter partition(_BIter, _BIter, _Predicate); template<typename _RAIter> void random_shuffle(_RAIter, _RAIter); template<typename _RAIter, typename _Generator> void random_shuffle(_RAIter, _RAIter, #if __cplusplus >= 201103L _Generator&&); #else _Generator&); #endif template<typename _FIter, typename _Tp> void replace(_FIter, _FIter, const _Tp&, const _Tp&); template<typename _FIter, typename _Predicate, typename _Tp> void replace_if(_FIter, _FIter, _Predicate, const _Tp&); template<typename _FIter1, typename _FIter2> _FIter1 search(_FIter1, _FIter1, _FIter2, _FIter2); template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> _FIter1 search(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); template<typename _FIter, typename _Size, typename _Tp> _FIter search_n(_FIter, _FIter, _Size, const _Tp&); template<typename _FIter, typename _Size, typename _Tp, typename _BinaryPredicate> _FIter search_n(_FIter, _FIter, _Size, const _Tp&, _BinaryPredicate); template<typename _IIter1, typename _IIter2, typename _OIter> _OIter set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); template<typename _IIter1, typename _IIter2, typename _OIter, typename _Compare> _OIter set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); template<typename _IIter1, typename _IIter2, typename _OIter> _OIter set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); template<typename _IIter1, typename _IIter2, typename _OIter, typename _Compare> _OIter set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); template<typename _IIter1, typename _IIter2, typename _OIter> _OIter set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); template<typename _IIter1, typename _IIter2, typename _OIter, typename _Compare> _OIter set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); template<typename _IIter1, typename _IIter2, typename _OIter> _OIter set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); template<typename _IIter1, typename _IIter2, typename _OIter, typename _Compare> _OIter set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); template<typename _RAIter> void sort(_RAIter, _RAIter); template<typename _RAIter, typename _Compare> void sort(_RAIter, _RAIter, _Compare); template<typename _RAIter> void stable_sort(_RAIter, _RAIter); template<typename _RAIter, typename _Compare> void stable_sort(_RAIter, _RAIter, _Compare); template<typename _IIter, typename _OIter, typename _UnaryOperation> _OIter transform(_IIter, _IIter, _OIter, _UnaryOperation); template<typename _IIter1, typename _IIter2, typename _OIter, typename _BinaryOperation> _OIter transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation); template<typename _IIter, typename _OIter> _OIter unique_copy(_IIter, _IIter, _OIter); template<typename _IIter, typename _OIter, typename _BinaryPredicate> _OIter unique_copy(_IIter, _IIter, _OIter, _BinaryPredicate); _GLIBCXX_END_NAMESPACE_ALGO } // namespace std #ifdef _GLIBCXX_PARALLEL # include <parallel/algorithmfwd.h> #endif #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stringfwd.h��������������������������������������������������������������������������0000644�����������������00000004572�14763166030�0010724 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <string> Forward declarations -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/stringfwd.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{string} */ // // ISO C++ 14882: 21 Strings library // #ifndef _STRINGFWD_H #define _STRINGFWD_H 1 #pragma GCC system_header #include <bits/c++config.h> #include <bits/memoryfwd.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup strings Strings * * @{ */ template<class _CharT> struct char_traits; template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > class basic_string; template<> struct char_traits<char>; /// A string of @c char typedef basic_string<char> string; #ifdef _GLIBCXX_USE_WCHAR_T template<> struct char_traits<wchar_t>; /// A string of @c wchar_t typedef basic_string<wchar_t> wstring; #endif #if ((__cplusplus >= 201103L) \ && defined(_GLIBCXX_USE_C99_STDINT_TR1)) template<> struct char_traits<char16_t>; template<> struct char_traits<char32_t>; /// A string of @c char16_t typedef basic_string<char16_t> u16string; /// A string of @c char32_t typedef basic_string<char32_t> u32string; #endif /** @} */ _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif // _STRINGFWD_H ��������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_vector.h�������������������������������������������������������������������������0000644�����������������00000141222�14763166030�0011073 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Vector implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_vector.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{vector} */ #ifndef _STL_VECTOR_H #define _STL_VECTOR_H 1 #include <bits/stl_iterator_base_funcs.h> #include <bits/functexcept.h> #include <bits/concept_check.h> #if __cplusplus >= 201103L #include <initializer_list> #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /// See bits/stl_deque.h's _Deque_base for an explanation. template<typename _Tp, typename _Alloc> struct _Vector_base { typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template rebind<_Tp>::other _Tp_alloc_type; typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer pointer; struct _Vector_impl : public _Tp_alloc_type { pointer _M_start; pointer _M_finish; pointer _M_end_of_storage; _Vector_impl() : _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0) { } _Vector_impl(_Tp_alloc_type const& __a) : _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0) { } #if __cplusplus >= 201103L _Vector_impl(_Tp_alloc_type&& __a) : _Tp_alloc_type(std::move(__a)), _M_start(0), _M_finish(0), _M_end_of_storage(0) { } #endif void _M_swap_data(_Vector_impl& __x) { std::swap(_M_start, __x._M_start); std::swap(_M_finish, __x._M_finish); std::swap(_M_end_of_storage, __x._M_end_of_storage); } }; public: typedef _Alloc allocator_type; _Tp_alloc_type& _M_get_Tp_allocator() _GLIBCXX_NOEXCEPT { return *static_cast<_Tp_alloc_type*>(&this->_M_impl); } const _Tp_alloc_type& _M_get_Tp_allocator() const _GLIBCXX_NOEXCEPT { return *static_cast<const _Tp_alloc_type*>(&this->_M_impl); } allocator_type get_allocator() const _GLIBCXX_NOEXCEPT { return allocator_type(_M_get_Tp_allocator()); } _Vector_base() : _M_impl() { } _Vector_base(const allocator_type& __a) : _M_impl(__a) { } _Vector_base(size_t __n) : _M_impl() { _M_create_storage(__n); } _Vector_base(size_t __n, const allocator_type& __a) : _M_impl(__a) { _M_create_storage(__n); } #if __cplusplus >= 201103L _Vector_base(_Tp_alloc_type&& __a) : _M_impl(std::move(__a)) { } _Vector_base(_Vector_base&& __x) : _M_impl(std::move(__x._M_get_Tp_allocator())) { this->_M_impl._M_swap_data(__x._M_impl); } _Vector_base(_Vector_base&& __x, const allocator_type& __a) : _M_impl(__a) { if (__x.get_allocator() == __a) this->_M_impl._M_swap_data(__x._M_impl); else { size_t __n = __x._M_impl._M_finish - __x._M_impl._M_start; _M_create_storage(__n); } } #endif ~_Vector_base() { _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); } public: _Vector_impl _M_impl; pointer _M_allocate(size_t __n) { return __n != 0 ? _M_impl.allocate(__n) : 0; } void _M_deallocate(pointer __p, size_t __n) { if (__p) _M_impl.deallocate(__p, __n); } private: void _M_create_storage(size_t __n) { this->_M_impl._M_start = this->_M_allocate(__n); this->_M_impl._M_finish = this->_M_impl._M_start; this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n; } }; /** * @brief A standard container which offers fixed time access to * individual elements in any order. * * @ingroup sequences * * @tparam _Tp Type of element. * @tparam _Alloc Allocator type, defaults to allocator<_Tp>. * * Meets the requirements of a <a href="tables.html#65">container</a>, a * <a href="tables.html#66">reversible container</a>, and a * <a href="tables.html#67">sequence</a>, including the * <a href="tables.html#68">optional sequence requirements</a> with the * %exception of @c push_front and @c pop_front. * * In some terminology a %vector can be described as a dynamic * C-style array, it offers fast and efficient access to individual * elements in any order and saves the user from worrying about * memory and size allocation. Subscripting ( @c [] ) access is * also provided as with C-style arrays. */ template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class vector : protected _Vector_base<_Tp, _Alloc> { // Concept requirements. typedef typename _Alloc::value_type _Alloc_value_type; __glibcxx_class_requires(_Tp, _SGIAssignableConcept) __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept) typedef _Vector_base<_Tp, _Alloc> _Base; typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Alloc_traits; public: typedef _Tp value_type; typedef typename _Base::pointer pointer; typedef typename _Alloc_traits::const_pointer const_pointer; typedef typename _Alloc_traits::reference reference; typedef typename _Alloc_traits::const_reference const_reference; typedef __gnu_cxx::__normal_iterator<pointer, vector> iterator; typedef __gnu_cxx::__normal_iterator<const_pointer, vector> const_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<iterator> reverse_iterator; typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Alloc allocator_type; protected: using _Base::_M_allocate; using _Base::_M_deallocate; using _Base::_M_impl; using _Base::_M_get_Tp_allocator; public: // [23.2.4.1] construct/copy/destroy // (assign() and get_allocator() are also listed in this section) /** * @brief Default constructor creates no elements. */ vector() : _Base() { } /** * @brief Creates a %vector with no elements. * @param __a An allocator object. */ explicit vector(const allocator_type& __a) : _Base(__a) { } #if __cplusplus >= 201103L /** * @brief Creates a %vector with default constructed elements. * @param __n The number of elements to initially create. * @param __a An allocator. * * This constructor fills the %vector with @a __n default * constructed elements. */ explicit vector(size_type __n, const allocator_type& __a = allocator_type()) : _Base(__n, __a) { _M_default_initialize(__n); } /** * @brief Creates a %vector with copies of an exemplar element. * @param __n The number of elements to initially create. * @param __value An element to copy. * @param __a An allocator. * * This constructor fills the %vector with @a __n copies of @a __value. */ vector(size_type __n, const value_type& __value, const allocator_type& __a = allocator_type()) : _Base(__n, __a) { _M_fill_initialize(__n, __value); } #else /** * @brief Creates a %vector with copies of an exemplar element. * @param __n The number of elements to initially create. * @param __value An element to copy. * @param __a An allocator. * * This constructor fills the %vector with @a __n copies of @a __value. */ explicit vector(size_type __n, const value_type& __value = value_type(), const allocator_type& __a = allocator_type()) : _Base(__n, __a) { _M_fill_initialize(__n, __value); } #endif /** * @brief %Vector copy constructor. * @param __x A %vector of identical element and allocator types. * * The newly-created %vector uses a copy of the allocation * object used by @a __x. All the elements of @a __x are copied, * but any extra memory in * @a __x (for fast expansion) will not be copied. */ vector(const vector& __x) : _Base(__x.size(), _Alloc_traits::_S_select_on_copy(__x._M_get_Tp_allocator())) { this->_M_impl._M_finish = std::__uninitialized_copy_a(__x.begin(), __x.end(), this->_M_impl._M_start, _M_get_Tp_allocator()); } #if __cplusplus >= 201103L /** * @brief %Vector move constructor. * @param __x A %vector of identical element and allocator types. * * The newly-created %vector contains the exact contents of @a __x. * The contents of @a __x are a valid, but unspecified %vector. */ vector(vector&& __x) noexcept : _Base(std::move(__x)) { } /// Copy constructor with alternative allocator vector(const vector& __x, const allocator_type& __a) : _Base(__x.size(), __a) { this->_M_impl._M_finish = std::__uninitialized_copy_a(__x.begin(), __x.end(), this->_M_impl._M_start, _M_get_Tp_allocator()); } /// Move constructor with alternative allocator vector(vector&& __rv, const allocator_type& __m) : _Base(std::move(__rv), __m) { if (__rv.get_allocator() != __m) { this->_M_impl._M_finish = std::__uninitialized_move_a(__rv.begin(), __rv.end(), this->_M_impl._M_start, _M_get_Tp_allocator()); __rv.clear(); } } /** * @brief Builds a %vector from an initializer list. * @param __l An initializer_list. * @param __a An allocator. * * Create a %vector consisting of copies of the elements in the * initializer_list @a __l. * * This will call the element type's copy constructor N times * (where N is @a __l.size()) and do no memory reallocation. */ vector(initializer_list<value_type> __l, const allocator_type& __a = allocator_type()) : _Base(__a) { _M_range_initialize(__l.begin(), __l.end(), random_access_iterator_tag()); } #endif /** * @brief Builds a %vector from a range. * @param __first An input iterator. * @param __last An input iterator. * @param __a An allocator. * * Create a %vector consisting of copies of the elements from * [first,last). * * If the iterators are forward, bidirectional, or * random-access, then this will call the elements' copy * constructor N times (where N is distance(first,last)) and do * no memory reallocation. But if only input iterators are * used, then this will do at most 2N calls to the copy * constructor, and logN memory reallocations. */ #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a = allocator_type()) : _Base(__a) { _M_initialize_dispatch(__first, __last, __false_type()); } #else template<typename _InputIterator> vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a = allocator_type()) : _Base(__a) { // Check whether it's an integral type. If so, it's not an iterator. typedef typename std::__is_integer<_InputIterator>::__type _Integral; _M_initialize_dispatch(__first, __last, _Integral()); } #endif /** * The dtor only erases the elements, and note that if the * elements themselves are pointers, the pointed-to memory is * not touched in any way. Managing the pointer is the user's * responsibility. */ ~vector() _GLIBCXX_NOEXCEPT { std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, _M_get_Tp_allocator()); } /** * @brief %Vector assignment operator. * @param __x A %vector of identical element and allocator types. * * All the elements of @a __x are copied, but any extra memory in * @a __x (for fast expansion) will not be copied. Unlike the * copy constructor, the allocator object is not copied. */ vector& operator=(const vector& __x); #if __cplusplus >= 201103L /** * @brief %Vector move assignment operator. * @param __x A %vector of identical element and allocator types. * * The contents of @a __x are moved into this %vector (without copying, * if the allocators permit it). * @a __x is a valid, but unspecified %vector. */ vector& operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) { constexpr bool __move_storage = _Alloc_traits::_S_propagate_on_move_assign() || _Alloc_traits::_S_always_equal(); _M_move_assign(std::move(__x), integral_constant<bool, __move_storage>()); return *this; } /** * @brief %Vector list assignment operator. * @param __l An initializer_list. * * This function fills a %vector with copies of the elements in the * initializer list @a __l. * * Note that the assignment completely changes the %vector and * that the resulting %vector's size is the same as the number * of elements assigned. Old data may be lost. */ vector& operator=(initializer_list<value_type> __l) { this->assign(__l.begin(), __l.end()); return *this; } #endif /** * @brief Assigns a given value to a %vector. * @param __n Number of elements to be assigned. * @param __val Value to be assigned. * * This function fills a %vector with @a __n copies of the given * value. Note that the assignment completely changes the * %vector and that the resulting %vector's size is the same as * the number of elements assigned. Old data may be lost. */ void assign(size_type __n, const value_type& __val) { _M_fill_assign(__n, __val); } /** * @brief Assigns a range to a %vector. * @param __first An input iterator. * @param __last An input iterator. * * This function fills a %vector with copies of the elements in the * range [__first,__last). * * Note that the assignment completely changes the %vector and * that the resulting %vector's size is the same as the number * of elements assigned. Old data may be lost. */ #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> void assign(_InputIterator __first, _InputIterator __last) { _M_assign_dispatch(__first, __last, __false_type()); } #else template<typename _InputIterator> void assign(_InputIterator __first, _InputIterator __last) { // Check whether it's an integral type. If so, it's not an iterator. typedef typename std::__is_integer<_InputIterator>::__type _Integral; _M_assign_dispatch(__first, __last, _Integral()); } #endif #if __cplusplus >= 201103L /** * @brief Assigns an initializer list to a %vector. * @param __l An initializer_list. * * This function fills a %vector with copies of the elements in the * initializer list @a __l. * * Note that the assignment completely changes the %vector and * that the resulting %vector's size is the same as the number * of elements assigned. Old data may be lost. */ void assign(initializer_list<value_type> __l) { this->assign(__l.begin(), __l.end()); } #endif /// Get a copy of the memory allocation object. using _Base::get_allocator; // iterators /** * Returns a read/write iterator that points to the first * element in the %vector. Iteration is done in ordinary * element order. */ iterator begin() _GLIBCXX_NOEXCEPT { return iterator(this->_M_impl._M_start); } /** * Returns a read-only (constant) iterator that points to the * first element in the %vector. Iteration is done in ordinary * element order. */ const_iterator begin() const _GLIBCXX_NOEXCEPT { return const_iterator(this->_M_impl._M_start); } /** * Returns a read/write iterator that points one past the last * element in the %vector. Iteration is done in ordinary * element order. */ iterator end() _GLIBCXX_NOEXCEPT { return iterator(this->_M_impl._M_finish); } /** * Returns a read-only (constant) iterator that points one past * the last element in the %vector. Iteration is done in * ordinary element order. */ const_iterator end() const _GLIBCXX_NOEXCEPT { return const_iterator(this->_M_impl._M_finish); } /** * Returns a read/write reverse iterator that points to the * last element in the %vector. Iteration is done in reverse * element order. */ reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(end()); } /** * Returns a read-only (constant) reverse iterator that points * to the last element in the %vector. Iteration is done in * reverse element order. */ const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(end()); } /** * Returns a read/write reverse iterator that points to one * before the first element in the %vector. Iteration is done * in reverse element order. */ reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(begin()); } /** * Returns a read-only (constant) reverse iterator that points * to one before the first element in the %vector. Iteration * is done in reverse element order. */ const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(begin()); } #if __cplusplus >= 201103L /** * Returns a read-only (constant) iterator that points to the * first element in the %vector. Iteration is done in ordinary * element order. */ const_iterator cbegin() const noexcept { return const_iterator(this->_M_impl._M_start); } /** * Returns a read-only (constant) iterator that points one past * the last element in the %vector. Iteration is done in * ordinary element order. */ const_iterator cend() const noexcept { return const_iterator(this->_M_impl._M_finish); } /** * Returns a read-only (constant) reverse iterator that points * to the last element in the %vector. Iteration is done in * reverse element order. */ const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } /** * Returns a read-only (constant) reverse iterator that points * to one before the first element in the %vector. Iteration * is done in reverse element order. */ const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } #endif // [23.2.4.2] capacity /** Returns the number of elements in the %vector. */ size_type size() const _GLIBCXX_NOEXCEPT { return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); } /** Returns the size() of the largest possible %vector. */ size_type max_size() const _GLIBCXX_NOEXCEPT { return _Alloc_traits::max_size(_M_get_Tp_allocator()); } #if __cplusplus >= 201103L /** * @brief Resizes the %vector to the specified number of elements. * @param __new_size Number of elements the %vector should contain. * * This function will %resize the %vector to the specified * number of elements. If the number is smaller than the * %vector's current size the %vector is truncated, otherwise * default constructed elements are appended. */ void resize(size_type __new_size) { if (__new_size > size()) _M_default_append(__new_size - size()); else if (__new_size < size()) _M_erase_at_end(this->_M_impl._M_start + __new_size); } /** * @brief Resizes the %vector to the specified number of elements. * @param __new_size Number of elements the %vector should contain. * @param __x Data with which new elements should be populated. * * This function will %resize the %vector to the specified * number of elements. If the number is smaller than the * %vector's current size the %vector is truncated, otherwise * the %vector is extended and new elements are populated with * given data. */ void resize(size_type __new_size, const value_type& __x) { if (__new_size > size()) insert(end(), __new_size - size(), __x); else if (__new_size < size()) _M_erase_at_end(this->_M_impl._M_start + __new_size); } #else /** * @brief Resizes the %vector to the specified number of elements. * @param __new_size Number of elements the %vector should contain. * @param __x Data with which new elements should be populated. * * This function will %resize the %vector to the specified * number of elements. If the number is smaller than the * %vector's current size the %vector is truncated, otherwise * the %vector is extended and new elements are populated with * given data. */ void resize(size_type __new_size, value_type __x = value_type()) { if (__new_size > size()) insert(end(), __new_size - size(), __x); else if (__new_size < size()) _M_erase_at_end(this->_M_impl._M_start + __new_size); } #endif #if __cplusplus >= 201103L /** A non-binding request to reduce capacity() to size(). */ void shrink_to_fit() { _M_shrink_to_fit(); } #endif /** * Returns the total number of elements that the %vector can * hold before needing to allocate more memory. */ size_type capacity() const _GLIBCXX_NOEXCEPT { return size_type(this->_M_impl._M_end_of_storage - this->_M_impl._M_start); } /** * Returns true if the %vector is empty. (Thus begin() would * equal end().) */ bool empty() const _GLIBCXX_NOEXCEPT { return begin() == end(); } /** * @brief Attempt to preallocate enough memory for specified number of * elements. * @param __n Number of elements required. * @throw std::length_error If @a n exceeds @c max_size(). * * This function attempts to reserve enough memory for the * %vector to hold the specified number of elements. If the * number requested is more than max_size(), length_error is * thrown. * * The advantage of this function is that if optimal code is a * necessity and the user can determine the number of elements * that will be required, the user can reserve the memory in * %advance, and thus prevent a possible reallocation of memory * and copying of %vector data. */ void reserve(size_type __n); // element access /** * @brief Subscript access to the data contained in the %vector. * @param __n The index of the element for which data should be * accessed. * @return Read/write reference to data. * * This operator allows for easy, array-style, data access. * Note that data access with this operator is unchecked and * out_of_range lookups are not defined. (For checked lookups * see at().) */ reference operator[](size_type __n) { return *(this->_M_impl._M_start + __n); } /** * @brief Subscript access to the data contained in the %vector. * @param __n The index of the element for which data should be * accessed. * @return Read-only (constant) reference to data. * * This operator allows for easy, array-style, data access. * Note that data access with this operator is unchecked and * out_of_range lookups are not defined. (For checked lookups * see at().) */ const_reference operator[](size_type __n) const { return *(this->_M_impl._M_start + __n); } protected: /// Safety check used only from at(). void _M_range_check(size_type __n) const { if (__n >= this->size()) __throw_out_of_range(__N("vector::_M_range_check")); } public: /** * @brief Provides access to the data contained in the %vector. * @param __n The index of the element for which data should be * accessed. * @return Read/write reference to data. * @throw std::out_of_range If @a __n is an invalid index. * * This function provides for safer data access. The parameter * is first checked that it is in the range of the vector. The * function throws out_of_range if the check fails. */ reference at(size_type __n) { _M_range_check(__n); return (*this)[__n]; } /** * @brief Provides access to the data contained in the %vector. * @param __n The index of the element for which data should be * accessed. * @return Read-only (constant) reference to data. * @throw std::out_of_range If @a __n is an invalid index. * * This function provides for safer data access. The parameter * is first checked that it is in the range of the vector. The * function throws out_of_range if the check fails. */ const_reference at(size_type __n) const { _M_range_check(__n); return (*this)[__n]; } /** * Returns a read/write reference to the data at the first * element of the %vector. */ reference front() { return *begin(); } /** * Returns a read-only (constant) reference to the data at the first * element of the %vector. */ const_reference front() const { return *begin(); } /** * Returns a read/write reference to the data at the last * element of the %vector. */ reference back() { return *(end() - 1); } /** * Returns a read-only (constant) reference to the data at the * last element of the %vector. */ const_reference back() const { return *(end() - 1); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 464. Suggestion for new member functions in standard containers. // data access /** * Returns a pointer such that [data(), data() + size()) is a valid * range. For a non-empty %vector, data() == &front(). */ #if __cplusplus >= 201103L _Tp* #else pointer #endif data() _GLIBCXX_NOEXCEPT { return std::__addressof(front()); } #if __cplusplus >= 201103L const _Tp* #else const_pointer #endif data() const _GLIBCXX_NOEXCEPT { return std::__addressof(front()); } // [23.2.4.3] modifiers /** * @brief Add data to the end of the %vector. * @param __x Data to be added. * * This is a typical stack operation. The function creates an * element at the end of the %vector and assigns the given data * to it. Due to the nature of a %vector this operation can be * done in constant time if the %vector has preallocated space * available. */ void push_back(const value_type& __x) { if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage) { _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, __x); ++this->_M_impl._M_finish; } else #if __cplusplus >= 201103L _M_emplace_back_aux(__x); #else _M_insert_aux(end(), __x); #endif } #if __cplusplus >= 201103L void push_back(value_type&& __x) { emplace_back(std::move(__x)); } template<typename... _Args> void emplace_back(_Args&&... __args); #endif /** * @brief Removes last element. * * This is a typical stack operation. It shrinks the %vector by one. * * Note that no data is returned, and if the last element's * data is needed, it should be retrieved before pop_back() is * called. */ void pop_back() { --this->_M_impl._M_finish; _Alloc_traits::destroy(this->_M_impl, this->_M_impl._M_finish); } #if __cplusplus >= 201103L /** * @brief Inserts an object in %vector before specified iterator. * @param __position An iterator into the %vector. * @param __args Arguments. * @return An iterator that points to the inserted data. * * This function will insert an object of type T constructed * with T(std::forward<Args>(args)...) before the specified location. * Note that this kind of operation could be expensive for a %vector * and if it is frequently used the user should consider using * std::list. */ template<typename... _Args> iterator emplace(iterator __position, _Args&&... __args); #endif /** * @brief Inserts given value into %vector before specified iterator. * @param __position An iterator into the %vector. * @param __x Data to be inserted. * @return An iterator that points to the inserted data. * * This function will insert a copy of the given value before * the specified location. Note that this kind of operation * could be expensive for a %vector and if it is frequently * used the user should consider using std::list. */ iterator insert(iterator __position, const value_type& __x); #if __cplusplus >= 201103L /** * @brief Inserts given rvalue into %vector before specified iterator. * @param __position An iterator into the %vector. * @param __x Data to be inserted. * @return An iterator that points to the inserted data. * * This function will insert a copy of the given rvalue before * the specified location. Note that this kind of operation * could be expensive for a %vector and if it is frequently * used the user should consider using std::list. */ iterator insert(iterator __position, value_type&& __x) { return emplace(__position, std::move(__x)); } /** * @brief Inserts an initializer_list into the %vector. * @param __position An iterator into the %vector. * @param __l An initializer_list. * * This function will insert copies of the data in the * initializer_list @a l into the %vector before the location * specified by @a position. * * Note that this kind of operation could be expensive for a * %vector and if it is frequently used the user should * consider using std::list. */ void insert(iterator __position, initializer_list<value_type> __l) { this->insert(__position, __l.begin(), __l.end()); } #endif /** * @brief Inserts a number of copies of given data into the %vector. * @param __position An iterator into the %vector. * @param __n Number of elements to be inserted. * @param __x Data to be inserted. * * This function will insert a specified number of copies of * the given data before the location specified by @a position. * * Note that this kind of operation could be expensive for a * %vector and if it is frequently used the user should * consider using std::list. */ void insert(iterator __position, size_type __n, const value_type& __x) { _M_fill_insert(__position, __n, __x); } /** * @brief Inserts a range into the %vector. * @param __position An iterator into the %vector. * @param __first An input iterator. * @param __last An input iterator. * * This function will insert copies of the data in the range * [__first,__last) into the %vector before the location specified * by @a pos. * * Note that this kind of operation could be expensive for a * %vector and if it is frequently used the user should * consider using std::list. */ #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> void insert(iterator __position, _InputIterator __first, _InputIterator __last) { _M_insert_dispatch(__position, __first, __last, __false_type()); } #else template<typename _InputIterator> void insert(iterator __position, _InputIterator __first, _InputIterator __last) { // Check whether it's an integral type. If so, it's not an iterator. typedef typename std::__is_integer<_InputIterator>::__type _Integral; _M_insert_dispatch(__position, __first, __last, _Integral()); } #endif /** * @brief Remove element at given position. * @param __position Iterator pointing to element to be erased. * @return An iterator pointing to the next element (or end()). * * This function will erase the element at the given position and thus * shorten the %vector by one. * * Note This operation could be expensive and if it is * frequently used the user should consider using std::list. * The user is also cautioned that this function only erases * the element, and that if the element is itself a pointer, * the pointed-to memory is not touched in any way. Managing * the pointer is the user's responsibility. */ iterator erase(iterator __position); /** * @brief Remove a range of elements. * @param __first Iterator pointing to the first element to be erased. * @param __last Iterator pointing to one past the last element to be * erased. * @return An iterator pointing to the element pointed to by @a __last * prior to erasing (or end()). * * This function will erase the elements in the range * [__first,__last) and shorten the %vector accordingly. * * Note This operation could be expensive and if it is * frequently used the user should consider using std::list. * The user is also cautioned that this function only erases * the elements, and that if the elements themselves are * pointers, the pointed-to memory is not touched in any way. * Managing the pointer is the user's responsibility. */ iterator erase(iterator __first, iterator __last); /** * @brief Swaps data with another %vector. * @param __x A %vector of the same element and allocator types. * * This exchanges the elements between two vectors in constant time. * (Three pointers, so it should be quite fast.) * Note that the global std::swap() function is specialized such that * std::swap(v1,v2) will feed to this function. */ void swap(vector& __x) #if __cplusplus >= 201103L noexcept(_Alloc_traits::_S_nothrow_swap()) #endif { this->_M_impl._M_swap_data(__x._M_impl); _Alloc_traits::_S_on_swap(_M_get_Tp_allocator(), __x._M_get_Tp_allocator()); } /** * Erases all the elements. Note that this function only erases the * elements, and that if the elements themselves are pointers, the * pointed-to memory is not touched in any way. Managing the pointer is * the user's responsibility. */ void clear() _GLIBCXX_NOEXCEPT { _M_erase_at_end(this->_M_impl._M_start); } protected: /** * Memory expansion handler. Uses the member allocation function to * obtain @a n bytes of memory, and then copies [first,last) into it. */ template<typename _ForwardIterator> pointer _M_allocate_and_copy(size_type __n, _ForwardIterator __first, _ForwardIterator __last) { pointer __result = this->_M_allocate(__n); __try { std::__uninitialized_copy_a(__first, __last, __result, _M_get_Tp_allocator()); return __result; } __catch(...) { _M_deallocate(__result, __n); __throw_exception_again; } } // Internal constructor functions follow. // Called by the range constructor to implement [23.1.1]/9 // _GLIBCXX_RESOLVE_LIB_DEFECTS // 438. Ambiguity in the "do the right thing" clause template<typename _Integer> void _M_initialize_dispatch(_Integer __n, _Integer __value, __true_type) { this->_M_impl._M_start = _M_allocate(static_cast<size_type>(__n)); this->_M_impl._M_end_of_storage = this->_M_impl._M_start + static_cast<size_type>(__n); _M_fill_initialize(static_cast<size_type>(__n), __value); } // Called by the range constructor to implement [23.1.1]/9 template<typename _InputIterator> void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, __false_type) { typedef typename std::iterator_traits<_InputIterator>:: iterator_category _IterCategory; _M_range_initialize(__first, __last, _IterCategory()); } // Called by the second initialize_dispatch above template<typename _InputIterator> void _M_range_initialize(_InputIterator __first, _InputIterator __last, std::input_iterator_tag) { for (; __first != __last; ++__first) #if __cplusplus >= 201103L emplace_back(*__first); #else push_back(*__first); #endif } // Called by the second initialize_dispatch above template<typename _ForwardIterator> void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag) { const size_type __n = std::distance(__first, __last); this->_M_impl._M_start = this->_M_allocate(__n); this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n; this->_M_impl._M_finish = std::__uninitialized_copy_a(__first, __last, this->_M_impl._M_start, _M_get_Tp_allocator()); } // Called by the first initialize_dispatch above and by the // vector(n,value,a) constructor. void _M_fill_initialize(size_type __n, const value_type& __value) { std::__uninitialized_fill_n_a(this->_M_impl._M_start, __n, __value, _M_get_Tp_allocator()); this->_M_impl._M_finish = this->_M_impl._M_end_of_storage; } #if __cplusplus >= 201103L // Called by the vector(n) constructor. void _M_default_initialize(size_type __n) { std::__uninitialized_default_n_a(this->_M_impl._M_start, __n, _M_get_Tp_allocator()); this->_M_impl._M_finish = this->_M_impl._M_end_of_storage; } #endif // Internal assign functions follow. The *_aux functions do the actual // assignment work for the range versions. // Called by the range assign to implement [23.1.1]/9 // _GLIBCXX_RESOLVE_LIB_DEFECTS // 438. Ambiguity in the "do the right thing" clause template<typename _Integer> void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) { _M_fill_assign(__n, __val); } // Called by the range assign to implement [23.1.1]/9 template<typename _InputIterator> void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, __false_type) { typedef typename std::iterator_traits<_InputIterator>:: iterator_category _IterCategory; _M_assign_aux(__first, __last, _IterCategory()); } // Called by the second assign_dispatch above template<typename _InputIterator> void _M_assign_aux(_InputIterator __first, _InputIterator __last, std::input_iterator_tag); // Called by the second assign_dispatch above template<typename _ForwardIterator> void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag); // Called by assign(n,t), and the range assign when it turns out // to be the same thing. void _M_fill_assign(size_type __n, const value_type& __val); // Internal insert functions follow. // Called by the range insert to implement [23.1.1]/9 // _GLIBCXX_RESOLVE_LIB_DEFECTS // 438. Ambiguity in the "do the right thing" clause template<typename _Integer> void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val, __true_type) { _M_fill_insert(__pos, __n, __val); } // Called by the range insert to implement [23.1.1]/9 template<typename _InputIterator> void _M_insert_dispatch(iterator __pos, _InputIterator __first, _InputIterator __last, __false_type) { typedef typename std::iterator_traits<_InputIterator>:: iterator_category _IterCategory; _M_range_insert(__pos, __first, __last, _IterCategory()); } // Called by the second insert_dispatch above template<typename _InputIterator> void _M_range_insert(iterator __pos, _InputIterator __first, _InputIterator __last, std::input_iterator_tag); // Called by the second insert_dispatch above template<typename _ForwardIterator> void _M_range_insert(iterator __pos, _ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag); // Called by insert(p,n,x), and the range insert when it turns out to be // the same thing. void _M_fill_insert(iterator __pos, size_type __n, const value_type& __x); #if __cplusplus >= 201103L // Called by resize(n). void _M_default_append(size_type __n); bool _M_shrink_to_fit(); #endif // Called by insert(p,x) #if __cplusplus < 201103L void _M_insert_aux(iterator __position, const value_type& __x); #else template<typename... _Args> void _M_insert_aux(iterator __position, _Args&&... __args); template<typename... _Args> void _M_emplace_back_aux(_Args&&... __args); #endif // Called by the latter. size_type _M_check_len(size_type __n, const char* __s) const { if (max_size() - size() < __n) __throw_length_error(__N(__s)); const size_type __len = size() + std::max(size(), __n); return (__len < size() || __len > max_size()) ? max_size() : __len; } // Internal erase functions follow. // Called by erase(q1,q2), clear(), resize(), _M_fill_assign, // _M_assign_aux. void _M_erase_at_end(pointer __pos) { std::_Destroy(__pos, this->_M_impl._M_finish, _M_get_Tp_allocator()); this->_M_impl._M_finish = __pos; } #if __cplusplus >= 201103L private: // Constant-time move assignment when source object's memory can be // moved, either because the source's allocator will move too // or because the allocators are equal. void _M_move_assign(vector&& __x, std::true_type) noexcept { vector __tmp(get_allocator()); this->_M_impl._M_swap_data(__tmp._M_impl); this->_M_impl._M_swap_data(__x._M_impl); if (_Alloc_traits::_S_propagate_on_move_assign()) std::__alloc_on_move(_M_get_Tp_allocator(), __x._M_get_Tp_allocator()); } // Do move assignment when it might not be possible to move source // object's memory, resulting in a linear-time operation. void _M_move_assign(vector&& __x, std::false_type) { if (__x._M_get_Tp_allocator() == this->_M_get_Tp_allocator()) _M_move_assign(std::move(__x), std::true_type()); else { // The rvalue's allocator cannot be moved and is not equal, // so we need to individually move each element. this->assign(std::__make_move_if_noexcept_iterator(__x.begin()), std::__make_move_if_noexcept_iterator(__x.end())); __x.clear(); } } #endif }; /** * @brief Vector equality comparison. * @param __x A %vector. * @param __y A %vector of the same type as @a __x. * @return True iff the size and elements of the vectors are equal. * * This is an equivalence relation. It is linear in the size of the * vectors. Vectors are considered equivalent if their sizes are equal, * and if corresponding elements compare equal. */ template<typename _Tp, typename _Alloc> inline bool operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { return (__x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin())); } /** * @brief Vector ordering relation. * @param __x A %vector. * @param __y A %vector of the same type as @a __x. * @return True iff @a __x is lexicographically less than @a __y. * * This is a total ordering relation. It is linear in the size of the * vectors. The elements must be comparable with @c <. * * See std::lexicographical_compare() for how the determination is made. */ template<typename _Tp, typename _Alloc> inline bool operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); } /// Based on operator== template<typename _Tp, typename _Alloc> inline bool operator!=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { return !(__x == __y); } /// Based on operator< template<typename _Tp, typename _Alloc> inline bool operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { return __y < __x; } /// Based on operator< template<typename _Tp, typename _Alloc> inline bool operator<=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { return !(__y < __x); } /// Based on operator< template<typename _Tp, typename _Alloc> inline bool operator>=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { return !(__x < __y); } /// See std::vector::swap(). template<typename _Tp, typename _Alloc> inline void swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y) { __x.swap(__y); } _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std #endif /* _STL_VECTOR_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/uses_allocator.h���������������������������������������������������������������������0000644�����������������00000006771�14763166030�0011737 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Uses-allocator Construction -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. #ifndef _USES_ALLOCATOR_H #define _USES_ALLOCATOR_H 1 #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <type_traits> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /// [allocator.tag] struct allocator_arg_t { }; constexpr allocator_arg_t allocator_arg = allocator_arg_t(); _GLIBCXX_HAS_NESTED_TYPE(allocator_type) template<typename _Tp, typename _Alloc, bool = __has_allocator_type<_Tp>::value> struct __uses_allocator_helper : public false_type { }; template<typename _Tp, typename _Alloc> struct __uses_allocator_helper<_Tp, _Alloc, true> : public integral_constant<bool, is_convertible<_Alloc, typename _Tp::allocator_type>::value> { }; /// [allocator.uses.trait] template<typename _Tp, typename _Alloc> struct uses_allocator : public integral_constant<bool, __uses_allocator_helper<_Tp, _Alloc>::value> { }; template<typename _Tp, typename _Alloc, typename... _Args> struct __uses_allocator_arg : is_constructible<_Tp, _Alloc, _Args...> { static_assert( uses_allocator<_Tp, _Alloc>::value, "uses allocator" ); }; struct __uses_alloc_base { }; struct __uses_alloc0 : __uses_alloc_base { struct _Anything { _Anything(...) { } } _M_a; }; template<typename _Alloc> struct __uses_alloc1 : __uses_alloc_base { const _Alloc* _M_a; }; template<typename _Alloc> struct __uses_alloc2 : __uses_alloc_base { const _Alloc* _M_a; }; template<bool, typename _Alloc, typename... _Args> struct __uses_alloc; template<typename _Tp, typename _Alloc, typename... _Args> struct __uses_alloc<true, _Tp, _Alloc, _Args...> : conditional< is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value, __uses_alloc1<_Alloc>, __uses_alloc2<_Alloc>>::type { }; template<typename _Tp, typename _Alloc, typename... _Args> struct __uses_alloc<false, _Tp, _Alloc, _Args...> : __uses_alloc0 { }; template<typename _Tp, typename _Alloc, typename... _Args> struct __uses_alloc_impl : __uses_alloc<uses_allocator<_Tp, _Alloc>::value, _Tp, _Alloc, _Args...> { }; template<typename _Tp, typename _Alloc, typename... _Args> __uses_alloc_impl<_Tp, _Alloc, _Args...> __use_alloc(const _Alloc& __a) { __uses_alloc_impl<_Tp, _Alloc, _Args...> __ret; __ret._M_a = &__a; return __ret; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif #endif �������c++/4.8.2/bits/basic_ios.h��������������������������������������������������������������������������0000644�����������������00000035413�14763166030�0010646 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Iostreams base classes -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/basic_ios.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{ios} */ #ifndef _BASIC_IOS_H #define _BASIC_IOS_H 1 #pragma GCC system_header #include <bits/localefwd.h> #include <bits/locale_classes.h> #include <bits/locale_facets.h> #include <bits/streambuf_iterator.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Facet> inline const _Facet& __check_facet(const _Facet* __f) { if (!__f) __throw_bad_cast(); return *__f; } /** * @brief Template class basic_ios, virtual base class for all * stream classes. * @ingroup io * * @tparam _CharT Type of character stream. * @tparam _Traits Traits for character type, defaults to * char_traits<_CharT>. * * Most of the member functions called dispatched on stream objects * (e.g., @c std::cout.foo(bar);) are consolidated in this class. */ template<typename _CharT, typename _Traits> class basic_ios : public ios_base { public: //@{ /** * These are standard types. They permit a standardized way of * referring to names of (or names dependent on) the template * parameters, which are specific to the implementation. */ typedef _CharT char_type; typedef typename _Traits::int_type int_type; typedef typename _Traits::pos_type pos_type; typedef typename _Traits::off_type off_type; typedef _Traits traits_type; //@} //@{ /** * These are non-standard types. */ typedef ctype<_CharT> __ctype_type; typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > __num_put_type; typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > __num_get_type; //@} // Data members: protected: basic_ostream<_CharT, _Traits>* _M_tie; mutable char_type _M_fill; mutable bool _M_fill_init; basic_streambuf<_CharT, _Traits>* _M_streambuf; // Cached use_facet<ctype>, which is based on the current locale info. const __ctype_type* _M_ctype; // For ostream. const __num_put_type* _M_num_put; // For istream. const __num_get_type* _M_num_get; public: //@{ /** * @brief The quick-and-easy status check. * * This allows you to write constructs such as * <code>if (!a_stream) ...</code> and <code>while (a_stream) ...</code> */ operator void*() const { return this->fail() ? 0 : const_cast<basic_ios*>(this); } bool operator!() const { return this->fail(); } //@} /** * @brief Returns the error state of the stream buffer. * @return A bit pattern (well, isn't everything?) * * See std::ios_base::iostate for the possible bit values. Most * users will call one of the interpreting wrappers, e.g., good(). */ iostate rdstate() const { return _M_streambuf_state; } /** * @brief [Re]sets the error state. * @param __state The new state flag(s) to set. * * See std::ios_base::iostate for the possible bit values. Most * users will not need to pass an argument. */ void clear(iostate __state = goodbit); /** * @brief Sets additional flags in the error state. * @param __state The additional state flag(s) to set. * * See std::ios_base::iostate for the possible bit values. */ void setstate(iostate __state) { this->clear(this->rdstate() | __state); } // Flip the internal state on for the proper state bits, then // rethrows the propagated exception if bit also set in // exceptions(). void _M_setstate(iostate __state) { // 27.6.1.2.1 Common requirements. // Turn this on without causing an ios::failure to be thrown. _M_streambuf_state |= __state; if (this->exceptions() & __state) __throw_exception_again; } /** * @brief Fast error checking. * @return True if no error flags are set. * * A wrapper around rdstate. */ bool good() const { return this->rdstate() == 0; } /** * @brief Fast error checking. * @return True if the eofbit is set. * * Note that other iostate flags may also be set. */ bool eof() const { return (this->rdstate() & eofbit) != 0; } /** * @brief Fast error checking. * @return True if either the badbit or the failbit is set. * * Checking the badbit in fail() is historical practice. * Note that other iostate flags may also be set. */ bool fail() const { return (this->rdstate() & (badbit | failbit)) != 0; } /** * @brief Fast error checking. * @return True if the badbit is set. * * Note that other iostate flags may also be set. */ bool bad() const { return (this->rdstate() & badbit) != 0; } /** * @brief Throwing exceptions on errors. * @return The current exceptions mask. * * This changes nothing in the stream. See the one-argument version * of exceptions(iostate) for the meaning of the return value. */ iostate exceptions() const { return _M_exception; } /** * @brief Throwing exceptions on errors. * @param __except The new exceptions mask. * * By default, error flags are set silently. You can set an * exceptions mask for each stream; if a bit in the mask becomes set * in the error flags, then an exception of type * std::ios_base::failure is thrown. * * If the error flag is already set when the exceptions mask is * added, the exception is immediately thrown. Try running the * following under GCC 3.1 or later: * @code * #include <iostream> * #include <fstream> * #include <exception> * * int main() * { * std::set_terminate (__gnu_cxx::__verbose_terminate_handler); * * std::ifstream f ("/etc/motd"); * * std::cerr << "Setting badbit\n"; * f.setstate (std::ios_base::badbit); * * std::cerr << "Setting exception mask\n"; * f.exceptions (std::ios_base::badbit); * } * @endcode */ void exceptions(iostate __except) { _M_exception = __except; this->clear(_M_streambuf_state); } // Constructor/destructor: /** * @brief Constructor performs initialization. * * The parameter is passed by derived streams. */ explicit basic_ios(basic_streambuf<_CharT, _Traits>* __sb) : ios_base(), _M_tie(0), _M_fill(), _M_fill_init(false), _M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0) { this->init(__sb); } /** * @brief Empty. * * The destructor does nothing. More specifically, it does not * destroy the streambuf held by rdbuf(). */ virtual ~basic_ios() { } // Members: /** * @brief Fetches the current @e tied stream. * @return A pointer to the tied stream, or NULL if the stream is * not tied. * * A stream may be @e tied (or synchronized) to a second output * stream. When this stream performs any I/O, the tied stream is * first flushed. For example, @c std::cin is tied to @c std::cout. */ basic_ostream<_CharT, _Traits>* tie() const { return _M_tie; } /** * @brief Ties this stream to an output stream. * @param __tiestr The output stream. * @return The previously tied output stream, or NULL if the stream * was not tied. * * This sets up a new tie; see tie() for more. */ basic_ostream<_CharT, _Traits>* tie(basic_ostream<_CharT, _Traits>* __tiestr) { basic_ostream<_CharT, _Traits>* __old = _M_tie; _M_tie = __tiestr; return __old; } /** * @brief Accessing the underlying buffer. * @return The current stream buffer. * * This does not change the state of the stream. */ basic_streambuf<_CharT, _Traits>* rdbuf() const { return _M_streambuf; } /** * @brief Changing the underlying buffer. * @param __sb The new stream buffer. * @return The previous stream buffer. * * Associates a new buffer with the current stream, and clears the * error state. * * Due to historical accidents which the LWG refuses to correct, the * I/O library suffers from a design error: this function is hidden * in derived classes by overrides of the zero-argument @c rdbuf(), * which is non-virtual for hysterical raisins. As a result, you * must use explicit qualifications to access this function via any * derived class. For example: * * @code * std::fstream foo; // or some other derived type * std::streambuf* p = .....; * * foo.ios::rdbuf(p); // ios == basic_ios<char> * @endcode */ basic_streambuf<_CharT, _Traits>* rdbuf(basic_streambuf<_CharT, _Traits>* __sb); /** * @brief Copies fields of __rhs into this. * @param __rhs The source values for the copies. * @return Reference to this object. * * All fields of __rhs are copied into this object except that rdbuf() * and rdstate() remain unchanged. All values in the pword and iword * arrays are copied. Before copying, each callback is invoked with * erase_event. After copying, each (new) callback is invoked with * copyfmt_event. The final step is to copy exceptions(). */ basic_ios& copyfmt(const basic_ios& __rhs); /** * @brief Retrieves the @a empty character. * @return The current fill character. * * It defaults to a space (' ') in the current locale. */ char_type fill() const { if (!_M_fill_init) { _M_fill = this->widen(' '); _M_fill_init = true; } return _M_fill; } /** * @brief Sets a new @a empty character. * @param __ch The new character. * @return The previous fill character. * * The fill character is used to fill out space when P+ characters * have been requested (e.g., via setw), Q characters are actually * used, and Q<P. It defaults to a space (' ') in the current locale. */ char_type fill(char_type __ch) { char_type __old = this->fill(); _M_fill = __ch; return __old; } // Locales: /** * @brief Moves to a new locale. * @param __loc The new locale. * @return The previous locale. * * Calls @c ios_base::imbue(loc), and if a stream buffer is associated * with this stream, calls that buffer's @c pubimbue(loc). * * Additional l10n notes are at * http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html */ locale imbue(const locale& __loc); /** * @brief Squeezes characters. * @param __c The character to narrow. * @param __dfault The character to narrow. * @return The narrowed character. * * Maps a character of @c char_type to a character of @c char, * if possible. * * Returns the result of * @code * std::use_facet<ctype<char_type> >(getloc()).narrow(c,dfault) * @endcode * * Additional l10n notes are at * http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html */ char narrow(char_type __c, char __dfault) const { return __check_facet(_M_ctype).narrow(__c, __dfault); } /** * @brief Widens characters. * @param __c The character to widen. * @return The widened character. * * Maps a character of @c char to a character of @c char_type. * * Returns the result of * @code * std::use_facet<ctype<char_type> >(getloc()).widen(c) * @endcode * * Additional l10n notes are at * http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html */ char_type widen(char __c) const { return __check_facet(_M_ctype).widen(__c); } protected: // 27.4.5.1 basic_ios constructors /** * @brief Empty. * * The default constructor does nothing and is not normally * accessible to users. */ basic_ios() : ios_base(), _M_tie(0), _M_fill(char_type()), _M_fill_init(false), _M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0) { } /** * @brief All setup is performed here. * * This is called from the public constructor. It is not virtual and * cannot be redefined. */ void init(basic_streambuf<_CharT, _Traits>* __sb); void _M_cache_locale(const locale& __loc); }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #include <bits/basic_ios.tcc> #endif /* _BASIC_IOS_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/regex_compiler.h���������������������������������������������������������������������0000644�����������������00000067274�14763166030�0011731 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// class template regex -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** * @file bits/regex_compiler.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{regex} */ namespace std _GLIBCXX_VISIBILITY(default) { namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup regex-detail * @{ */ /// Base class for scanner. struct _Scanner_base { typedef unsigned int _StateT; static constexpr _StateT _S_state_at_start = 1 << 0; static constexpr _StateT _S_state_in_brace = 1 << 2; static constexpr _StateT _S_state_in_bracket = 1 << 3; virtual ~_Scanner_base() { }; }; /** * @brief struct _Scanner. Scans an input range for regex tokens. * * The %_Scanner class interprets the regular expression pattern in * the input range passed to its constructor as a sequence of parse * tokens passed to the regular expression compiler. The sequence * of tokens provided depends on the flag settings passed to the * constructor: different regular expression grammars will interpret * the same input pattern in syntactically different ways. */ template<typename _InputIterator> class _Scanner: public _Scanner_base { public: typedef _InputIterator _IteratorT; typedef typename std::iterator_traits<_IteratorT>::value_type _CharT; typedef std::basic_string<_CharT> _StringT; typedef regex_constants::syntax_option_type _FlagT; typedef const std::ctype<_CharT> _CtypeT; /// Token types returned from the scanner. enum _TokenT { _S_token_anychar, _S_token_backref, _S_token_bracket_begin, _S_token_bracket_end, _S_token_inverse_class, _S_token_char_class_name, _S_token_closure0, _S_token_closure1, _S_token_collelem_multi, _S_token_collelem_single, _S_token_collsymbol, _S_token_comma, _S_token_dash, _S_token_dup_count, _S_token_eof, _S_token_equiv_class_name, _S_token_interval_begin, _S_token_interval_end, _S_token_line_begin, _S_token_line_end, _S_token_opt, _S_token_or, _S_token_ord_char, _S_token_quoted_char, _S_token_subexpr_begin, _S_token_subexpr_end, _S_token_word_begin, _S_token_word_end, _S_token_unknown }; _Scanner(_IteratorT __begin, _IteratorT __end, _FlagT __flags, std::locale __loc) : _M_current(__begin) , _M_end(__end) , _M_flags(__flags), _M_ctype(std::use_facet<_CtypeT>(__loc)), _M_state(_S_state_at_start) { _M_advance(); } void _M_advance(); _TokenT _M_token() const { return _M_curToken; } const _StringT& _M_value() const { return _M_curValue; } #ifdef _GLIBCXX_DEBUG std::ostream& _M_print(std::ostream&); #endif private: void _M_eat_escape(); void _M_scan_in_brace(); void _M_scan_in_bracket(); void _M_eat_charclass(); void _M_eat_equivclass(); void _M_eat_collsymbol(); _IteratorT _M_current; _IteratorT _M_end; _FlagT _M_flags; _CtypeT& _M_ctype; _TokenT _M_curToken; _StringT _M_curValue; _StateT _M_state; }; template<typename _InputIterator> void _Scanner<_InputIterator>:: _M_advance() { if (_M_current == _M_end) { _M_curToken = _S_token_eof; return; } _CharT __c = *_M_current; if (_M_state & _S_state_in_bracket) { _M_scan_in_bracket(); return; } if (_M_state & _S_state_in_brace) { _M_scan_in_brace(); return; } #if 0 // TODO: re-enable line anchors when _M_assertion is implemented. // See PR libstdc++/47724 else if (_M_state & _S_state_at_start && __c == _M_ctype.widen('^')) { _M_curToken = _S_token_line_begin; ++_M_current; return; } else if (__c == _M_ctype.widen('$')) { _M_curToken = _S_token_line_end; ++_M_current; return; } #endif else if (__c == _M_ctype.widen('.')) { _M_curToken = _S_token_anychar; ++_M_current; return; } else if (__c == _M_ctype.widen('*')) { _M_curToken = _S_token_closure0; ++_M_current; return; } else if (__c == _M_ctype.widen('+')) { _M_curToken = _S_token_closure1; ++_M_current; return; } else if (__c == _M_ctype.widen('|')) { _M_curToken = _S_token_or; ++_M_current; return; } else if (__c == _M_ctype.widen('[')) { _M_curToken = _S_token_bracket_begin; _M_state |= (_S_state_in_bracket | _S_state_at_start); ++_M_current; return; } else if (__c == _M_ctype.widen('\\')) { _M_eat_escape(); return; } else if (!(_M_flags & (regex_constants::basic | regex_constants::grep))) { if (__c == _M_ctype.widen('(')) { _M_curToken = _S_token_subexpr_begin; ++_M_current; return; } else if (__c == _M_ctype.widen(')')) { _M_curToken = _S_token_subexpr_end; ++_M_current; return; } else if (__c == _M_ctype.widen('{')) { _M_curToken = _S_token_interval_begin; _M_state |= _S_state_in_brace; ++_M_current; return; } } _M_curToken = _S_token_ord_char; _M_curValue.assign(1, __c); ++_M_current; } template<typename _InputIterator> void _Scanner<_InputIterator>:: _M_scan_in_brace() { if (_M_ctype.is(_CtypeT::digit, *_M_current)) { _M_curToken = _S_token_dup_count; _M_curValue.assign(1, *_M_current); ++_M_current; while (_M_current != _M_end && _M_ctype.is(_CtypeT::digit, *_M_current)) { _M_curValue += *_M_current; ++_M_current; } return; } else if (*_M_current == _M_ctype.widen(',')) { _M_curToken = _S_token_comma; ++_M_current; return; } if (_M_flags & (regex_constants::basic | regex_constants::grep)) { if (*_M_current == _M_ctype.widen('\\')) _M_eat_escape(); } else { if (*_M_current == _M_ctype.widen('}')) { _M_curToken = _S_token_interval_end; _M_state &= ~_S_state_in_brace; ++_M_current; return; } } } template<typename _InputIterator> void _Scanner<_InputIterator>:: _M_scan_in_bracket() { if (_M_state & _S_state_at_start && *_M_current == _M_ctype.widen('^')) { _M_curToken = _S_token_inverse_class; _M_state &= ~_S_state_at_start; ++_M_current; return; } else if (*_M_current == _M_ctype.widen('[')) { ++_M_current; if (_M_current == _M_end) { _M_curToken = _S_token_eof; return; } if (*_M_current == _M_ctype.widen('.')) { _M_curToken = _S_token_collsymbol; _M_eat_collsymbol(); return; } else if (*_M_current == _M_ctype.widen(':')) { _M_curToken = _S_token_char_class_name; _M_eat_charclass(); return; } else if (*_M_current == _M_ctype.widen('=')) { _M_curToken = _S_token_equiv_class_name; _M_eat_equivclass(); return; } } else if (*_M_current == _M_ctype.widen('-')) { _M_curToken = _S_token_dash; ++_M_current; return; } else if (*_M_current == _M_ctype.widen(']')) { if (!(_M_flags & regex_constants::ECMAScript) || !(_M_state & _S_state_at_start)) { // special case: only if _not_ chr first after // '[' or '[^' and if not ECMAscript _M_curToken = _S_token_bracket_end; ++_M_current; return; } } _M_curToken = _S_token_collelem_single; _M_curValue.assign(1, *_M_current); ++_M_current; } template<typename _InputIterator> void _Scanner<_InputIterator>:: _M_eat_escape() { ++_M_current; if (_M_current == _M_end) { _M_curToken = _S_token_eof; return; } _CharT __c = *_M_current; ++_M_current; if (__c == _M_ctype.widen('(')) { if (!(_M_flags & (regex_constants::basic | regex_constants::grep))) { _M_curToken = _S_token_ord_char; _M_curValue.assign(1, __c); } else _M_curToken = _S_token_subexpr_begin; } else if (__c == _M_ctype.widen(')')) { if (!(_M_flags & (regex_constants::basic | regex_constants::grep))) { _M_curToken = _S_token_ord_char; _M_curValue.assign(1, __c); } else _M_curToken = _S_token_subexpr_end; } else if (__c == _M_ctype.widen('{')) { if (!(_M_flags & (regex_constants::basic | regex_constants::grep))) { _M_curToken = _S_token_ord_char; _M_curValue.assign(1, __c); } else { _M_curToken = _S_token_interval_begin; _M_state |= _S_state_in_brace; } } else if (__c == _M_ctype.widen('}')) { if (!(_M_flags & (regex_constants::basic | regex_constants::grep))) { _M_curToken = _S_token_ord_char; _M_curValue.assign(1, __c); } else { if (!(_M_state && _S_state_in_brace)) __throw_regex_error(regex_constants::error_badbrace); _M_state &= ~_S_state_in_brace; _M_curToken = _S_token_interval_end; } } else if (__c == _M_ctype.widen('x')) { ++_M_current; if (_M_current == _M_end) { _M_curToken = _S_token_eof; return; } if (_M_ctype.is(_CtypeT::digit, *_M_current)) { _M_curValue.assign(1, *_M_current); ++_M_current; if (_M_current == _M_end) { _M_curToken = _S_token_eof; return; } if (_M_ctype.is(_CtypeT::digit, *_M_current)) { _M_curValue += *_M_current; ++_M_current; return; } } } else if (__c == _M_ctype.widen('^') || __c == _M_ctype.widen('.') || __c == _M_ctype.widen('*') || __c == _M_ctype.widen('$') || __c == _M_ctype.widen('\\')) { _M_curToken = _S_token_ord_char; _M_curValue.assign(1, __c); } else if (_M_ctype.is(_CtypeT::digit, __c)) { _M_curToken = _S_token_backref; _M_curValue.assign(1, __c); } else __throw_regex_error(regex_constants::error_escape); } // Eats a character class or throwns an exception. // current point to ':' delimiter on entry, char after ']' on return template<typename _InputIterator> void _Scanner<_InputIterator>:: _M_eat_charclass() { ++_M_current; // skip ':' if (_M_current == _M_end) __throw_regex_error(regex_constants::error_ctype); for (_M_curValue.clear(); _M_current != _M_end && *_M_current != _M_ctype.widen(':'); ++_M_current) _M_curValue += *_M_current; if (_M_current == _M_end) __throw_regex_error(regex_constants::error_ctype); ++_M_current; // skip ':' if (*_M_current != _M_ctype.widen(']')) __throw_regex_error(regex_constants::error_ctype); ++_M_current; // skip ']' } template<typename _InputIterator> void _Scanner<_InputIterator>:: _M_eat_equivclass() { ++_M_current; // skip '=' if (_M_current == _M_end) __throw_regex_error(regex_constants::error_collate); for (_M_curValue.clear(); _M_current != _M_end && *_M_current != _M_ctype.widen('='); ++_M_current) _M_curValue += *_M_current; if (_M_current == _M_end) __throw_regex_error(regex_constants::error_collate); ++_M_current; // skip '=' if (*_M_current != _M_ctype.widen(']')) __throw_regex_error(regex_constants::error_collate); ++_M_current; // skip ']' } template<typename _InputIterator> void _Scanner<_InputIterator>:: _M_eat_collsymbol() { ++_M_current; // skip '.' if (_M_current == _M_end) __throw_regex_error(regex_constants::error_collate); for (_M_curValue.clear(); _M_current != _M_end && *_M_current != _M_ctype.widen('.'); ++_M_current) _M_curValue += *_M_current; if (_M_current == _M_end) __throw_regex_error(regex_constants::error_collate); ++_M_current; // skip '.' if (*_M_current != _M_ctype.widen(']')) __throw_regex_error(regex_constants::error_collate); ++_M_current; // skip ']' } #ifdef _GLIBCXX_DEBUG template<typename _InputIterator> std::ostream& _Scanner<_InputIterator>:: _M_print(std::ostream& ostr) { switch (_M_curToken) { case _S_token_anychar: ostr << "any-character\n"; break; case _S_token_backref: ostr << "backref\n"; break; case _S_token_bracket_begin: ostr << "bracket-begin\n"; break; case _S_token_bracket_end: ostr << "bracket-end\n"; break; case _S_token_char_class_name: ostr << "char-class-name \"" << _M_curValue << "\"\n"; break; case _S_token_closure0: ostr << "closure0\n"; break; case _S_token_closure1: ostr << "closure1\n"; break; case _S_token_collelem_multi: ostr << "coll-elem-multi \"" << _M_curValue << "\"\n"; break; case _S_token_collelem_single: ostr << "coll-elem-single \"" << _M_curValue << "\"\n"; break; case _S_token_collsymbol: ostr << "collsymbol \"" << _M_curValue << "\"\n"; break; case _S_token_comma: ostr << "comma\n"; break; case _S_token_dash: ostr << "dash\n"; break; case _S_token_dup_count: ostr << "dup count: " << _M_curValue << "\n"; break; case _S_token_eof: ostr << "EOF\n"; break; case _S_token_equiv_class_name: ostr << "equiv-class-name \"" << _M_curValue << "\"\n"; break; case _S_token_interval_begin: ostr << "interval begin\n"; break; case _S_token_interval_end: ostr << "interval end\n"; break; case _S_token_line_begin: ostr << "line begin\n"; break; case _S_token_line_end: ostr << "line end\n"; break; case _S_token_opt: ostr << "opt\n"; break; case _S_token_or: ostr << "or\n"; break; case _S_token_ord_char: ostr << "ordinary character: \"" << _M_value() << "\"\n"; break; case _S_token_quoted_char: ostr << "quoted char\n"; break; case _S_token_subexpr_begin: ostr << "subexpr begin\n"; break; case _S_token_subexpr_end: ostr << "subexpr end\n"; break; case _S_token_word_begin: ostr << "word begin\n"; break; case _S_token_word_end: ostr << "word end\n"; break; case _S_token_unknown: ostr << "-- unknown token --\n"; break; } return ostr; } #endif /// Builds an NFA from an input iterator interval. template<typename _InIter, typename _TraitsT> class _Compiler { public: typedef _InIter _IterT; typedef typename std::iterator_traits<_InIter>::value_type _CharT; typedef std::basic_string<_CharT> _StringT; typedef regex_constants::syntax_option_type _FlagT; _Compiler(const _InIter& __b, const _InIter& __e, _TraitsT& __traits, _FlagT __flags); const _Nfa& _M_nfa() const { return _M_state_store; } private: typedef _Scanner<_InIter> _ScannerT; typedef typename _ScannerT::_TokenT _TokenT; typedef std::stack<_StateSeq, std::vector<_StateSeq> > _StackT; typedef _RangeMatcher<_InIter, _TraitsT> _RMatcherT; // accepts a specific token or returns false. bool _M_match_token(_TokenT __token); void _M_disjunction(); bool _M_alternative(); bool _M_term(); bool _M_assertion(); bool _M_quantifier(); bool _M_atom(); bool _M_bracket_expression(); bool _M_bracket_list(_RMatcherT& __matcher); bool _M_follow_list(_RMatcherT& __matcher); bool _M_follow_list2(_RMatcherT& __matcher); bool _M_expression_term(_RMatcherT& __matcher); bool _M_range_expression(_RMatcherT& __matcher); bool _M_start_range(_RMatcherT& __matcher); bool _M_collating_symbol(_RMatcherT& __matcher); bool _M_equivalence_class(_RMatcherT& __matcher); bool _M_character_class(_RMatcherT& __matcher); int _M_cur_int_value(int __radix); _TraitsT& _M_traits; _ScannerT _M_scanner; _StringT _M_cur_value; _Nfa _M_state_store; _StackT _M_stack; }; template<typename _InIter, typename _TraitsT> _Compiler<_InIter, _TraitsT>:: _Compiler(const _InIter& __b, const _InIter& __e, _TraitsT& __traits, _Compiler<_InIter, _TraitsT>::_FlagT __flags) : _M_traits(__traits), _M_scanner(__b, __e, __flags, _M_traits.getloc()), _M_state_store(__flags) { typedef _StartTagger<_InIter, _TraitsT> _Start; typedef _EndTagger<_InIter, _TraitsT> _End; _StateSeq __r(_M_state_store, _M_state_store._M_insert_subexpr_begin(_Start(0))); _M_disjunction(); if (!_M_stack.empty()) { __r._M_append(_M_stack.top()); _M_stack.pop(); } __r._M_append(_M_state_store._M_insert_subexpr_end(0, _End(0))); __r._M_append(_M_state_store._M_insert_accept()); } template<typename _InIter, typename _TraitsT> bool _Compiler<_InIter, _TraitsT>:: _M_match_token(_Compiler<_InIter, _TraitsT>::_TokenT token) { if (token == _M_scanner._M_token()) { _M_cur_value = _M_scanner._M_value(); _M_scanner._M_advance(); return true; } return false; } template<typename _InIter, typename _TraitsT> void _Compiler<_InIter, _TraitsT>:: _M_disjunction() { this->_M_alternative(); if (_M_match_token(_ScannerT::_S_token_or)) { _StateSeq __alt1 = _M_stack.top(); _M_stack.pop(); this->_M_disjunction(); _StateSeq __alt2 = _M_stack.top(); _M_stack.pop(); _M_stack.push(_StateSeq(__alt1, __alt2)); } } template<typename _InIter, typename _TraitsT> bool _Compiler<_InIter, _TraitsT>:: _M_alternative() { if (this->_M_term()) { _StateSeq __re = _M_stack.top(); _M_stack.pop(); this->_M_alternative(); if (!_M_stack.empty()) { __re._M_append(_M_stack.top()); _M_stack.pop(); } _M_stack.push(__re); return true; } return false; } template<typename _InIter, typename _TraitsT> bool _Compiler<_InIter, _TraitsT>:: _M_term() { if (this->_M_assertion()) return true; if (this->_M_atom()) { this->_M_quantifier(); return true; } return false; } template<typename _InIter, typename _TraitsT> bool _Compiler<_InIter, _TraitsT>:: _M_assertion() { if (_M_match_token(_ScannerT::_S_token_line_begin)) { // __m.push(_Matcher::_S_opcode_line_begin); return true; } if (_M_match_token(_ScannerT::_S_token_line_end)) { // __m.push(_Matcher::_S_opcode_line_end); return true; } if (_M_match_token(_ScannerT::_S_token_word_begin)) { // __m.push(_Matcher::_S_opcode_word_begin); return true; } if (_M_match_token(_ScannerT::_S_token_word_end)) { // __m.push(_Matcher::_S_opcode_word_end); return true; } return false; } template<typename _InIter, typename _TraitsT> bool _Compiler<_InIter, _TraitsT>:: _M_quantifier() { if (_M_match_token(_ScannerT::_S_token_closure0)) { if (_M_stack.empty()) __throw_regex_error(regex_constants::error_badrepeat); _StateSeq __r(_M_stack.top(), -1); __r._M_append(__r._M_front()); _M_stack.pop(); _M_stack.push(__r); return true; } if (_M_match_token(_ScannerT::_S_token_closure1)) { if (_M_stack.empty()) __throw_regex_error(regex_constants::error_badrepeat); _StateSeq __r(_M_state_store, _M_state_store. _M_insert_alt(_S_invalid_state_id, _M_stack.top()._M_front())); _M_stack.top()._M_append(__r); return true; } if (_M_match_token(_ScannerT::_S_token_opt)) { if (_M_stack.empty()) __throw_regex_error(regex_constants::error_badrepeat); _StateSeq __r(_M_stack.top(), -1); _M_stack.pop(); _M_stack.push(__r); return true; } if (_M_match_token(_ScannerT::_S_token_interval_begin)) { if (_M_stack.empty()) __throw_regex_error(regex_constants::error_badrepeat); if (!_M_match_token(_ScannerT::_S_token_dup_count)) __throw_regex_error(regex_constants::error_badbrace); _StateSeq __r(_M_stack.top()); int __min_rep = _M_cur_int_value(10); for (int __i = 1; __i < __min_rep; ++__i) _M_stack.top()._M_append(__r._M_clone()); if (_M_match_token(_ScannerT::_S_token_comma)) if (_M_match_token(_ScannerT::_S_token_dup_count)) { int __n = _M_cur_int_value(10) - __min_rep; if (__n < 0) __throw_regex_error(regex_constants::error_badbrace); for (int __i = 0; __i < __n; ++__i) { _StateSeq __r(_M_state_store, _M_state_store. _M_insert_alt(_S_invalid_state_id, _M_stack.top()._M_front())); _M_stack.top()._M_append(__r); } } else { _StateSeq __r(_M_stack.top(), -1); __r._M_push_back(__r._M_front()); _M_stack.pop(); _M_stack.push(__r); } if (!_M_match_token(_ScannerT::_S_token_interval_end)) __throw_regex_error(regex_constants::error_brace); return true; } return false; } template<typename _InIter, typename _TraitsT> bool _Compiler<_InIter, _TraitsT>:: _M_atom() { typedef _CharMatcher<_InIter, _TraitsT> _CMatcher; typedef _StartTagger<_InIter, _TraitsT> _Start; typedef _EndTagger<_InIter, _TraitsT> _End; if (_M_match_token(_ScannerT::_S_token_anychar)) { _M_stack.push(_StateSeq(_M_state_store, _M_state_store._M_insert_matcher (_AnyMatcher))); return true; } if (_M_match_token(_ScannerT::_S_token_ord_char)) { _M_stack.push(_StateSeq(_M_state_store, _M_state_store._M_insert_matcher (_CMatcher(_M_cur_value[0], _M_traits)))); return true; } if (_M_match_token(_ScannerT::_S_token_quoted_char)) { // note that in the ECMA grammar, this case covers backrefs. _M_stack.push(_StateSeq(_M_state_store, _M_state_store._M_insert_matcher (_CMatcher(_M_cur_value[0], _M_traits)))); return true; } if (_M_match_token(_ScannerT::_S_token_backref)) { // __m.push(_Matcher::_S_opcode_ordchar, _M_cur_value); return true; } if (_M_match_token(_ScannerT::_S_token_subexpr_begin)) { int __mark = _M_state_store._M_sub_count(); _StateSeq __r(_M_state_store, _M_state_store. _M_insert_subexpr_begin(_Start(__mark))); this->_M_disjunction(); if (!_M_match_token(_ScannerT::_S_token_subexpr_end)) __throw_regex_error(regex_constants::error_paren); if (!_M_stack.empty()) { __r._M_append(_M_stack.top()); _M_stack.pop(); } __r._M_append(_M_state_store._M_insert_subexpr_end (__mark, _End(__mark))); _M_stack.push(__r); return true; } return _M_bracket_expression(); } template<typename _InIter, typename _TraitsT> bool _Compiler<_InIter, _TraitsT>:: _M_bracket_expression() { if (_M_match_token(_ScannerT::_S_token_bracket_begin)) { _RMatcherT __matcher(_M_match_token(_ScannerT::_S_token_line_begin), _M_traits); if (!_M_bracket_list(__matcher) || !_M_match_token(_ScannerT::_S_token_bracket_end)) __throw_regex_error(regex_constants::error_brack); _M_stack.push(_StateSeq(_M_state_store, _M_state_store._M_insert_matcher(__matcher))); return true; } return false; } // If the dash is the last character in the bracket expression, it is not // special. template<typename _InIter, typename _TraitsT> bool _Compiler<_InIter, _TraitsT>:: _M_bracket_list(_RMatcherT& __matcher) { if (_M_follow_list(__matcher)) { if (_M_match_token(_ScannerT::_S_token_dash)) __matcher._M_add_char(_M_cur_value[0]); return true; } return false; } template<typename _InIter, typename _TraitsT> bool _Compiler<_InIter, _TraitsT>:: _M_follow_list(_RMatcherT& __matcher) { return _M_expression_term(__matcher) && _M_follow_list2(__matcher); } template<typename _InIter, typename _TraitsT> bool _Compiler<_InIter, _TraitsT>:: _M_follow_list2(_RMatcherT& __matcher) { if (_M_expression_term(__matcher)) return _M_follow_list2(__matcher); return true; } template<typename _InIter, typename _TraitsT> bool _Compiler<_InIter, _TraitsT>:: _M_expression_term(_RMatcherT& __matcher) { return (_M_collating_symbol(__matcher) || _M_character_class(__matcher) || _M_equivalence_class(__matcher) || (_M_start_range(__matcher) && _M_range_expression(__matcher))); } template<typename _InIter, typename _TraitsT> bool _Compiler<_InIter, _TraitsT>:: _M_range_expression(_RMatcherT& __matcher) { if (!_M_collating_symbol(__matcher)) if (!_M_match_token(_ScannerT::_S_token_dash)) __throw_regex_error(regex_constants::error_range); __matcher._M_make_range(); return true; } template<typename _InIter, typename _TraitsT> bool _Compiler<_InIter, _TraitsT>:: _M_start_range(_RMatcherT& __matcher) { return _M_match_token(_ScannerT::_S_token_dash); } template<typename _InIter, typename _TraitsT> bool _Compiler<_InIter, _TraitsT>:: _M_collating_symbol(_RMatcherT& __matcher) { if (_M_match_token(_ScannerT::_S_token_collelem_single)) { __matcher._M_add_char(_M_cur_value[0]); return true; } if (_M_match_token(_ScannerT::_S_token_collsymbol)) { __matcher._M_add_collating_element(_M_cur_value); return true; } return false; } template<typename _InIter, typename _TraitsT> bool _Compiler<_InIter, _TraitsT>:: _M_equivalence_class(_RMatcherT& __matcher) { if (_M_match_token(_ScannerT::_S_token_equiv_class_name)) { __matcher._M_add_equivalence_class(_M_cur_value); return true; } return false; } template<typename _InIter, typename _TraitsT> bool _Compiler<_InIter, _TraitsT>:: _M_character_class(_RMatcherT& __matcher) { if (_M_match_token(_ScannerT::_S_token_char_class_name)) { __matcher._M_add_character_class(_M_cur_value); return true; } return false; } template<typename _InIter, typename _TraitsT> int _Compiler<_InIter, _TraitsT>:: _M_cur_int_value(int __radix) { int __v = 0; for (typename _StringT::size_type __i = 0; __i < _M_cur_value.length(); ++__i) __v =__v * __radix + _M_traits.value(_M_cur_value[__i], __radix); return __v; } template<typename _InIter, typename _TraitsT> _AutomatonPtr __compile(const _InIter& __b, const _InIter& __e, _TraitsT& __t, regex_constants::syntax_option_type __f) { return _AutomatonPtr(new _Nfa(_Compiler<_InIter, _TraitsT>(__b, __e, __t, __f)._M_nfa())); } //@} regex-detail _GLIBCXX_END_NAMESPACE_VERSION } // namespace __detail } // namespace std ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/deque.tcc����������������������������������������������������������������������������0000644�����������������00000077640�14763166030�0010350 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Deque implementation (out of line) -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/deque.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{deque} */ #ifndef _DEQUE_TCC #define _DEQUE_TCC 1 namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER #if __cplusplus >= 201103L template <typename _Tp, typename _Alloc> void deque<_Tp, _Alloc>:: _M_default_initialize() { _Map_pointer __cur; __try { for (__cur = this->_M_impl._M_start._M_node; __cur < this->_M_impl._M_finish._M_node; ++__cur) std::__uninitialized_default_a(*__cur, *__cur + _S_buffer_size(), _M_get_Tp_allocator()); std::__uninitialized_default_a(this->_M_impl._M_finish._M_first, this->_M_impl._M_finish._M_cur, _M_get_Tp_allocator()); } __catch(...) { std::_Destroy(this->_M_impl._M_start, iterator(*__cur, __cur), _M_get_Tp_allocator()); __throw_exception_again; } } #endif template <typename _Tp, typename _Alloc> deque<_Tp, _Alloc>& deque<_Tp, _Alloc>:: operator=(const deque& __x) { const size_type __len = size(); if (&__x != this) { if (__len >= __x.size()) _M_erase_at_end(std::copy(__x.begin(), __x.end(), this->_M_impl._M_start)); else { const_iterator __mid = __x.begin() + difference_type(__len); std::copy(__x.begin(), __mid, this->_M_impl._M_start); insert(this->_M_impl._M_finish, __mid, __x.end()); } } return *this; } #if __cplusplus >= 201103L template<typename _Tp, typename _Alloc> template<typename... _Args> void deque<_Tp, _Alloc>:: emplace_front(_Args&&... __args) { if (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_first) { this->_M_impl.construct(this->_M_impl._M_start._M_cur - 1, std::forward<_Args>(__args)...); --this->_M_impl._M_start._M_cur; } else _M_push_front_aux(std::forward<_Args>(__args)...); } template<typename _Tp, typename _Alloc> template<typename... _Args> void deque<_Tp, _Alloc>:: emplace_back(_Args&&... __args) { if (this->_M_impl._M_finish._M_cur != this->_M_impl._M_finish._M_last - 1) { this->_M_impl.construct(this->_M_impl._M_finish._M_cur, std::forward<_Args>(__args)...); ++this->_M_impl._M_finish._M_cur; } else _M_push_back_aux(std::forward<_Args>(__args)...); } #endif template <typename _Tp, typename _Alloc> typename deque<_Tp, _Alloc>::iterator deque<_Tp, _Alloc>:: insert(iterator __position, const value_type& __x) { if (__position._M_cur == this->_M_impl._M_start._M_cur) { push_front(__x); return this->_M_impl._M_start; } else if (__position._M_cur == this->_M_impl._M_finish._M_cur) { push_back(__x); iterator __tmp = this->_M_impl._M_finish; --__tmp; return __tmp; } else return _M_insert_aux(__position, __x); } #if __cplusplus >= 201103L template<typename _Tp, typename _Alloc> template<typename... _Args> typename deque<_Tp, _Alloc>::iterator deque<_Tp, _Alloc>:: emplace(iterator __position, _Args&&... __args) { if (__position._M_cur == this->_M_impl._M_start._M_cur) { emplace_front(std::forward<_Args>(__args)...); return this->_M_impl._M_start; } else if (__position._M_cur == this->_M_impl._M_finish._M_cur) { emplace_back(std::forward<_Args>(__args)...); iterator __tmp = this->_M_impl._M_finish; --__tmp; return __tmp; } else return _M_insert_aux(__position, std::forward<_Args>(__args)...); } #endif template <typename _Tp, typename _Alloc> typename deque<_Tp, _Alloc>::iterator deque<_Tp, _Alloc>:: erase(iterator __position) { iterator __next = __position; ++__next; const difference_type __index = __position - begin(); if (static_cast<size_type>(__index) < (size() >> 1)) { if (__position != begin()) _GLIBCXX_MOVE_BACKWARD3(begin(), __position, __next); pop_front(); } else { if (__next != end()) _GLIBCXX_MOVE3(__next, end(), __position); pop_back(); } return begin() + __index; } template <typename _Tp, typename _Alloc> typename deque<_Tp, _Alloc>::iterator deque<_Tp, _Alloc>:: erase(iterator __first, iterator __last) { if (__first == __last) return __first; else if (__first == begin() && __last == end()) { clear(); return end(); } else { const difference_type __n = __last - __first; const difference_type __elems_before = __first - begin(); if (static_cast<size_type>(__elems_before) <= (size() - __n) / 2) { if (__first != begin()) _GLIBCXX_MOVE_BACKWARD3(begin(), __first, __last); _M_erase_at_begin(begin() + __n); } else { if (__last != end()) _GLIBCXX_MOVE3(__last, end(), __first); _M_erase_at_end(end() - __n); } return begin() + __elems_before; } } template <typename _Tp, class _Alloc> template <typename _InputIterator> void deque<_Tp, _Alloc>:: _M_assign_aux(_InputIterator __first, _InputIterator __last, std::input_iterator_tag) { iterator __cur = begin(); for (; __first != __last && __cur != end(); ++__cur, ++__first) *__cur = *__first; if (__first == __last) _M_erase_at_end(__cur); else insert(end(), __first, __last); } template <typename _Tp, typename _Alloc> void deque<_Tp, _Alloc>:: _M_fill_insert(iterator __pos, size_type __n, const value_type& __x) { if (__pos._M_cur == this->_M_impl._M_start._M_cur) { iterator __new_start = _M_reserve_elements_at_front(__n); __try { std::__uninitialized_fill_a(__new_start, this->_M_impl._M_start, __x, _M_get_Tp_allocator()); this->_M_impl._M_start = __new_start; } __catch(...) { _M_destroy_nodes(__new_start._M_node, this->_M_impl._M_start._M_node); __throw_exception_again; } } else if (__pos._M_cur == this->_M_impl._M_finish._M_cur) { iterator __new_finish = _M_reserve_elements_at_back(__n); __try { std::__uninitialized_fill_a(this->_M_impl._M_finish, __new_finish, __x, _M_get_Tp_allocator()); this->_M_impl._M_finish = __new_finish; } __catch(...) { _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1, __new_finish._M_node + 1); __throw_exception_again; } } else _M_insert_aux(__pos, __n, __x); } #if __cplusplus >= 201103L template <typename _Tp, typename _Alloc> void deque<_Tp, _Alloc>:: _M_default_append(size_type __n) { if (__n) { iterator __new_finish = _M_reserve_elements_at_back(__n); __try { std::__uninitialized_default_a(this->_M_impl._M_finish, __new_finish, _M_get_Tp_allocator()); this->_M_impl._M_finish = __new_finish; } __catch(...) { _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1, __new_finish._M_node + 1); __throw_exception_again; } } } template <typename _Tp, typename _Alloc> bool deque<_Tp, _Alloc>:: _M_shrink_to_fit() { const difference_type __front_capacity = (this->_M_impl._M_start._M_cur - this->_M_impl._M_start._M_first); if (__front_capacity == 0) return false; const difference_type __back_capacity = (this->_M_impl._M_finish._M_last - this->_M_impl._M_finish._M_cur); if (__front_capacity + __back_capacity < _S_buffer_size()) return false; return std::__shrink_to_fit_aux<deque>::_S_do_it(*this); } #endif template <typename _Tp, typename _Alloc> void deque<_Tp, _Alloc>:: _M_fill_initialize(const value_type& __value) { _Map_pointer __cur; __try { for (__cur = this->_M_impl._M_start._M_node; __cur < this->_M_impl._M_finish._M_node; ++__cur) std::__uninitialized_fill_a(*__cur, *__cur + _S_buffer_size(), __value, _M_get_Tp_allocator()); std::__uninitialized_fill_a(this->_M_impl._M_finish._M_first, this->_M_impl._M_finish._M_cur, __value, _M_get_Tp_allocator()); } __catch(...) { std::_Destroy(this->_M_impl._M_start, iterator(*__cur, __cur), _M_get_Tp_allocator()); __throw_exception_again; } } template <typename _Tp, typename _Alloc> template <typename _InputIterator> void deque<_Tp, _Alloc>:: _M_range_initialize(_InputIterator __first, _InputIterator __last, std::input_iterator_tag) { this->_M_initialize_map(0); __try { for (; __first != __last; ++__first) #if __cplusplus >= 201103L emplace_back(*__first); #else push_back(*__first); #endif } __catch(...) { clear(); __throw_exception_again; } } template <typename _Tp, typename _Alloc> template <typename _ForwardIterator> void deque<_Tp, _Alloc>:: _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag) { const size_type __n = std::distance(__first, __last); this->_M_initialize_map(__n); _Map_pointer __cur_node; __try { for (__cur_node = this->_M_impl._M_start._M_node; __cur_node < this->_M_impl._M_finish._M_node; ++__cur_node) { _ForwardIterator __mid = __first; std::advance(__mid, _S_buffer_size()); std::__uninitialized_copy_a(__first, __mid, *__cur_node, _M_get_Tp_allocator()); __first = __mid; } std::__uninitialized_copy_a(__first, __last, this->_M_impl._M_finish._M_first, _M_get_Tp_allocator()); } __catch(...) { std::_Destroy(this->_M_impl._M_start, iterator(*__cur_node, __cur_node), _M_get_Tp_allocator()); __throw_exception_again; } } // Called only if _M_impl._M_finish._M_cur == _M_impl._M_finish._M_last - 1. template<typename _Tp, typename _Alloc> #if __cplusplus >= 201103L template<typename... _Args> void deque<_Tp, _Alloc>:: _M_push_back_aux(_Args&&... __args) #else void deque<_Tp, _Alloc>:: _M_push_back_aux(const value_type& __t) #endif { _M_reserve_map_at_back(); *(this->_M_impl._M_finish._M_node + 1) = this->_M_allocate_node(); __try { #if __cplusplus >= 201103L this->_M_impl.construct(this->_M_impl._M_finish._M_cur, std::forward<_Args>(__args)...); #else this->_M_impl.construct(this->_M_impl._M_finish._M_cur, __t); #endif this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node + 1); this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_first; } __catch(...) { _M_deallocate_node(*(this->_M_impl._M_finish._M_node + 1)); __throw_exception_again; } } // Called only if _M_impl._M_start._M_cur == _M_impl._M_start._M_first. template<typename _Tp, typename _Alloc> #if __cplusplus >= 201103L template<typename... _Args> void deque<_Tp, _Alloc>:: _M_push_front_aux(_Args&&... __args) #else void deque<_Tp, _Alloc>:: _M_push_front_aux(const value_type& __t) #endif { _M_reserve_map_at_front(); *(this->_M_impl._M_start._M_node - 1) = this->_M_allocate_node(); __try { this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node - 1); this->_M_impl._M_start._M_cur = this->_M_impl._M_start._M_last - 1; #if __cplusplus >= 201103L this->_M_impl.construct(this->_M_impl._M_start._M_cur, std::forward<_Args>(__args)...); #else this->_M_impl.construct(this->_M_impl._M_start._M_cur, __t); #endif } __catch(...) { ++this->_M_impl._M_start; _M_deallocate_node(*(this->_M_impl._M_start._M_node - 1)); __throw_exception_again; } } // Called only if _M_impl._M_finish._M_cur == _M_impl._M_finish._M_first. template <typename _Tp, typename _Alloc> void deque<_Tp, _Alloc>:: _M_pop_back_aux() { _M_deallocate_node(this->_M_impl._M_finish._M_first); this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node - 1); this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_last - 1; this->_M_impl.destroy(this->_M_impl._M_finish._M_cur); } // Called only if _M_impl._M_start._M_cur == _M_impl._M_start._M_last - 1. // Note that if the deque has at least one element (a precondition for this // member function), and if // _M_impl._M_start._M_cur == _M_impl._M_start._M_last, // then the deque must have at least two nodes. template <typename _Tp, typename _Alloc> void deque<_Tp, _Alloc>:: _M_pop_front_aux() { this->_M_impl.destroy(this->_M_impl._M_start._M_cur); _M_deallocate_node(this->_M_impl._M_start._M_first); this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node + 1); this->_M_impl._M_start._M_cur = this->_M_impl._M_start._M_first; } template <typename _Tp, typename _Alloc> template <typename _InputIterator> void deque<_Tp, _Alloc>:: _M_range_insert_aux(iterator __pos, _InputIterator __first, _InputIterator __last, std::input_iterator_tag) { std::copy(__first, __last, std::inserter(*this, __pos)); } template <typename _Tp, typename _Alloc> template <typename _ForwardIterator> void deque<_Tp, _Alloc>:: _M_range_insert_aux(iterator __pos, _ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag) { const size_type __n = std::distance(__first, __last); if (__pos._M_cur == this->_M_impl._M_start._M_cur) { iterator __new_start = _M_reserve_elements_at_front(__n); __try { std::__uninitialized_copy_a(__first, __last, __new_start, _M_get_Tp_allocator()); this->_M_impl._M_start = __new_start; } __catch(...) { _M_destroy_nodes(__new_start._M_node, this->_M_impl._M_start._M_node); __throw_exception_again; } } else if (__pos._M_cur == this->_M_impl._M_finish._M_cur) { iterator __new_finish = _M_reserve_elements_at_back(__n); __try { std::__uninitialized_copy_a(__first, __last, this->_M_impl._M_finish, _M_get_Tp_allocator()); this->_M_impl._M_finish = __new_finish; } __catch(...) { _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1, __new_finish._M_node + 1); __throw_exception_again; } } else _M_insert_aux(__pos, __first, __last, __n); } template<typename _Tp, typename _Alloc> #if __cplusplus >= 201103L template<typename... _Args> typename deque<_Tp, _Alloc>::iterator deque<_Tp, _Alloc>:: _M_insert_aux(iterator __pos, _Args&&... __args) { value_type __x_copy(std::forward<_Args>(__args)...); // XXX copy #else typename deque<_Tp, _Alloc>::iterator deque<_Tp, _Alloc>:: _M_insert_aux(iterator __pos, const value_type& __x) { value_type __x_copy = __x; // XXX copy #endif difference_type __index = __pos - this->_M_impl._M_start; if (static_cast<size_type>(__index) < size() / 2) { push_front(_GLIBCXX_MOVE(front())); iterator __front1 = this->_M_impl._M_start; ++__front1; iterator __front2 = __front1; ++__front2; __pos = this->_M_impl._M_start + __index; iterator __pos1 = __pos; ++__pos1; _GLIBCXX_MOVE3(__front2, __pos1, __front1); } else { push_back(_GLIBCXX_MOVE(back())); iterator __back1 = this->_M_impl._M_finish; --__back1; iterator __back2 = __back1; --__back2; __pos = this->_M_impl._M_start + __index; _GLIBCXX_MOVE_BACKWARD3(__pos, __back2, __back1); } *__pos = _GLIBCXX_MOVE(__x_copy); return __pos; } template <typename _Tp, typename _Alloc> void deque<_Tp, _Alloc>:: _M_insert_aux(iterator __pos, size_type __n, const value_type& __x) { const difference_type __elems_before = __pos - this->_M_impl._M_start; const size_type __length = this->size(); value_type __x_copy = __x; if (__elems_before < difference_type(__length / 2)) { iterator __new_start = _M_reserve_elements_at_front(__n); iterator __old_start = this->_M_impl._M_start; __pos = this->_M_impl._M_start + __elems_before; __try { if (__elems_before >= difference_type(__n)) { iterator __start_n = (this->_M_impl._M_start + difference_type(__n)); std::__uninitialized_move_a(this->_M_impl._M_start, __start_n, __new_start, _M_get_Tp_allocator()); this->_M_impl._M_start = __new_start; _GLIBCXX_MOVE3(__start_n, __pos, __old_start); std::fill(__pos - difference_type(__n), __pos, __x_copy); } else { std::__uninitialized_move_fill(this->_M_impl._M_start, __pos, __new_start, this->_M_impl._M_start, __x_copy, _M_get_Tp_allocator()); this->_M_impl._M_start = __new_start; std::fill(__old_start, __pos, __x_copy); } } __catch(...) { _M_destroy_nodes(__new_start._M_node, this->_M_impl._M_start._M_node); __throw_exception_again; } } else { iterator __new_finish = _M_reserve_elements_at_back(__n); iterator __old_finish = this->_M_impl._M_finish; const difference_type __elems_after = difference_type(__length) - __elems_before; __pos = this->_M_impl._M_finish - __elems_after; __try { if (__elems_after > difference_type(__n)) { iterator __finish_n = (this->_M_impl._M_finish - difference_type(__n)); std::__uninitialized_move_a(__finish_n, this->_M_impl._M_finish, this->_M_impl._M_finish, _M_get_Tp_allocator()); this->_M_impl._M_finish = __new_finish; _GLIBCXX_MOVE_BACKWARD3(__pos, __finish_n, __old_finish); std::fill(__pos, __pos + difference_type(__n), __x_copy); } else { std::__uninitialized_fill_move(this->_M_impl._M_finish, __pos + difference_type(__n), __x_copy, __pos, this->_M_impl._M_finish, _M_get_Tp_allocator()); this->_M_impl._M_finish = __new_finish; std::fill(__pos, __old_finish, __x_copy); } } __catch(...) { _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1, __new_finish._M_node + 1); __throw_exception_again; } } } template <typename _Tp, typename _Alloc> template <typename _ForwardIterator> void deque<_Tp, _Alloc>:: _M_insert_aux(iterator __pos, _ForwardIterator __first, _ForwardIterator __last, size_type __n) { const difference_type __elemsbefore = __pos - this->_M_impl._M_start; const size_type __length = size(); if (static_cast<size_type>(__elemsbefore) < __length / 2) { iterator __new_start = _M_reserve_elements_at_front(__n); iterator __old_start = this->_M_impl._M_start; __pos = this->_M_impl._M_start + __elemsbefore; __try { if (__elemsbefore >= difference_type(__n)) { iterator __start_n = (this->_M_impl._M_start + difference_type(__n)); std::__uninitialized_move_a(this->_M_impl._M_start, __start_n, __new_start, _M_get_Tp_allocator()); this->_M_impl._M_start = __new_start; _GLIBCXX_MOVE3(__start_n, __pos, __old_start); std::copy(__first, __last, __pos - difference_type(__n)); } else { _ForwardIterator __mid = __first; std::advance(__mid, difference_type(__n) - __elemsbefore); std::__uninitialized_move_copy(this->_M_impl._M_start, __pos, __first, __mid, __new_start, _M_get_Tp_allocator()); this->_M_impl._M_start = __new_start; std::copy(__mid, __last, __old_start); } } __catch(...) { _M_destroy_nodes(__new_start._M_node, this->_M_impl._M_start._M_node); __throw_exception_again; } } else { iterator __new_finish = _M_reserve_elements_at_back(__n); iterator __old_finish = this->_M_impl._M_finish; const difference_type __elemsafter = difference_type(__length) - __elemsbefore; __pos = this->_M_impl._M_finish - __elemsafter; __try { if (__elemsafter > difference_type(__n)) { iterator __finish_n = (this->_M_impl._M_finish - difference_type(__n)); std::__uninitialized_move_a(__finish_n, this->_M_impl._M_finish, this->_M_impl._M_finish, _M_get_Tp_allocator()); this->_M_impl._M_finish = __new_finish; _GLIBCXX_MOVE_BACKWARD3(__pos, __finish_n, __old_finish); std::copy(__first, __last, __pos); } else { _ForwardIterator __mid = __first; std::advance(__mid, __elemsafter); std::__uninitialized_copy_move(__mid, __last, __pos, this->_M_impl._M_finish, this->_M_impl._M_finish, _M_get_Tp_allocator()); this->_M_impl._M_finish = __new_finish; std::copy(__first, __mid, __pos); } } __catch(...) { _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1, __new_finish._M_node + 1); __throw_exception_again; } } } template<typename _Tp, typename _Alloc> void deque<_Tp, _Alloc>:: _M_destroy_data_aux(iterator __first, iterator __last) { for (_Map_pointer __node = __first._M_node + 1; __node < __last._M_node; ++__node) std::_Destroy(*__node, *__node + _S_buffer_size(), _M_get_Tp_allocator()); if (__first._M_node != __last._M_node) { std::_Destroy(__first._M_cur, __first._M_last, _M_get_Tp_allocator()); std::_Destroy(__last._M_first, __last._M_cur, _M_get_Tp_allocator()); } else std::_Destroy(__first._M_cur, __last._M_cur, _M_get_Tp_allocator()); } template <typename _Tp, typename _Alloc> void deque<_Tp, _Alloc>:: _M_new_elements_at_front(size_type __new_elems) { if (this->max_size() - this->size() < __new_elems) __throw_length_error(__N("deque::_M_new_elements_at_front")); const size_type __new_nodes = ((__new_elems + _S_buffer_size() - 1) / _S_buffer_size()); _M_reserve_map_at_front(__new_nodes); size_type __i; __try { for (__i = 1; __i <= __new_nodes; ++__i) *(this->_M_impl._M_start._M_node - __i) = this->_M_allocate_node(); } __catch(...) { for (size_type __j = 1; __j < __i; ++__j) _M_deallocate_node(*(this->_M_impl._M_start._M_node - __j)); __throw_exception_again; } } template <typename _Tp, typename _Alloc> void deque<_Tp, _Alloc>:: _M_new_elements_at_back(size_type __new_elems) { if (this->max_size() - this->size() < __new_elems) __throw_length_error(__N("deque::_M_new_elements_at_back")); const size_type __new_nodes = ((__new_elems + _S_buffer_size() - 1) / _S_buffer_size()); _M_reserve_map_at_back(__new_nodes); size_type __i; __try { for (__i = 1; __i <= __new_nodes; ++__i) *(this->_M_impl._M_finish._M_node + __i) = this->_M_allocate_node(); } __catch(...) { for (size_type __j = 1; __j < __i; ++__j) _M_deallocate_node(*(this->_M_impl._M_finish._M_node + __j)); __throw_exception_again; } } template <typename _Tp, typename _Alloc> void deque<_Tp, _Alloc>:: _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front) { const size_type __old_num_nodes = this->_M_impl._M_finish._M_node - this->_M_impl._M_start._M_node + 1; const size_type __new_num_nodes = __old_num_nodes + __nodes_to_add; _Map_pointer __new_nstart; if (this->_M_impl._M_map_size > 2 * __new_num_nodes) { __new_nstart = this->_M_impl._M_map + (this->_M_impl._M_map_size - __new_num_nodes) / 2 + (__add_at_front ? __nodes_to_add : 0); if (__new_nstart < this->_M_impl._M_start._M_node) std::copy(this->_M_impl._M_start._M_node, this->_M_impl._M_finish._M_node + 1, __new_nstart); else std::copy_backward(this->_M_impl._M_start._M_node, this->_M_impl._M_finish._M_node + 1, __new_nstart + __old_num_nodes); } else { size_type __new_map_size = this->_M_impl._M_map_size + std::max(this->_M_impl._M_map_size, __nodes_to_add) + 2; _Map_pointer __new_map = this->_M_allocate_map(__new_map_size); __new_nstart = __new_map + (__new_map_size - __new_num_nodes) / 2 + (__add_at_front ? __nodes_to_add : 0); std::copy(this->_M_impl._M_start._M_node, this->_M_impl._M_finish._M_node + 1, __new_nstart); _M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size); this->_M_impl._M_map = __new_map; this->_M_impl._M_map_size = __new_map_size; } this->_M_impl._M_start._M_set_node(__new_nstart); this->_M_impl._M_finish._M_set_node(__new_nstart + __old_num_nodes - 1); } // Overload for deque::iterators, exploiting the "segmented-iterator // optimization". template<typename _Tp> void fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>& __first, const _Deque_iterator<_Tp, _Tp&, _Tp*>& __last, const _Tp& __value) { typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self; for (typename _Self::_Map_pointer __node = __first._M_node + 1; __node < __last._M_node; ++__node) std::fill(*__node, *__node + _Self::_S_buffer_size(), __value); if (__first._M_node != __last._M_node) { std::fill(__first._M_cur, __first._M_last, __value); std::fill(__last._M_first, __last._M_cur, __value); } else std::fill(__first._M_cur, __last._M_cur, __value); } template<typename _Tp> _Deque_iterator<_Tp, _Tp&, _Tp*> copy(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first, _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last, _Deque_iterator<_Tp, _Tp&, _Tp*> __result) { typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self; typedef typename _Self::difference_type difference_type; difference_type __len = __last - __first; while (__len > 0) { const difference_type __clen = std::min(__len, std::min(__first._M_last - __first._M_cur, __result._M_last - __result._M_cur)); std::copy(__first._M_cur, __first._M_cur + __clen, __result._M_cur); __first += __clen; __result += __clen; __len -= __clen; } return __result; } template<typename _Tp> _Deque_iterator<_Tp, _Tp&, _Tp*> copy_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first, _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last, _Deque_iterator<_Tp, _Tp&, _Tp*> __result) { typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self; typedef typename _Self::difference_type difference_type; difference_type __len = __last - __first; while (__len > 0) { difference_type __llen = __last._M_cur - __last._M_first; _Tp* __lend = __last._M_cur; difference_type __rlen = __result._M_cur - __result._M_first; _Tp* __rend = __result._M_cur; if (!__llen) { __llen = _Self::_S_buffer_size(); __lend = *(__last._M_node - 1) + __llen; } if (!__rlen) { __rlen = _Self::_S_buffer_size(); __rend = *(__result._M_node - 1) + __rlen; } const difference_type __clen = std::min(__len, std::min(__llen, __rlen)); std::copy_backward(__lend - __clen, __lend, __rend); __last -= __clen; __result -= __clen; __len -= __clen; } return __result; } #if __cplusplus >= 201103L template<typename _Tp> _Deque_iterator<_Tp, _Tp&, _Tp*> move(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first, _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last, _Deque_iterator<_Tp, _Tp&, _Tp*> __result) { typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self; typedef typename _Self::difference_type difference_type; difference_type __len = __last - __first; while (__len > 0) { const difference_type __clen = std::min(__len, std::min(__first._M_last - __first._M_cur, __result._M_last - __result._M_cur)); std::move(__first._M_cur, __first._M_cur + __clen, __result._M_cur); __first += __clen; __result += __clen; __len -= __clen; } return __result; } template<typename _Tp> _Deque_iterator<_Tp, _Tp&, _Tp*> move_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first, _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last, _Deque_iterator<_Tp, _Tp&, _Tp*> __result) { typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self; typedef typename _Self::difference_type difference_type; difference_type __len = __last - __first; while (__len > 0) { difference_type __llen = __last._M_cur - __last._M_first; _Tp* __lend = __last._M_cur; difference_type __rlen = __result._M_cur - __result._M_first; _Tp* __rend = __result._M_cur; if (!__llen) { __llen = _Self::_S_buffer_size(); __lend = *(__last._M_node - 1) + __llen; } if (!__rlen) { __rlen = _Self::_S_buffer_size(); __rend = *(__result._M_node - 1) + __rlen; } const difference_type __clen = std::min(__len, std::min(__llen, __rlen)); std::move_backward(__lend - __clen, __lend, __rend); __last -= __clen; __result -= __clen; __len -= __clen; } return __result; } #endif _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std #endif ������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_tempbuf.h������������������������������������������������������������������������0000644�����������������00000020230�14763166030�0011226 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Temporary buffer implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_tempbuf.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{memory} */ #ifndef _STL_TEMPBUF_H #define _STL_TEMPBUF_H 1 #include <bits/stl_algobase.h> #include <bits/stl_construct.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Allocates a temporary buffer. * @param __len The number of objects of type Tp. * @return See full description. * * Reinventing the wheel, but this time with prettier spokes! * * This function tries to obtain storage for @c __len adjacent Tp * objects. The objects themselves are not constructed, of course. * A pair<> is returned containing <em>the buffer s address and * capacity (in the units of sizeof(_Tp)), or a pair of 0 values if * no storage can be obtained.</em> Note that the capacity obtained * may be less than that requested if the memory is unavailable; * you should compare len with the .second return value. * * Provides the nothrow exception guarantee. */ template<typename _Tp> pair<_Tp*, ptrdiff_t> get_temporary_buffer(ptrdiff_t __len) _GLIBCXX_NOEXCEPT { const ptrdiff_t __max = __gnu_cxx::__numeric_traits<ptrdiff_t>::__max / sizeof(_Tp); if (__len > __max) __len = __max; while (__len > 0) { _Tp* __tmp = static_cast<_Tp*>(::operator new(__len * sizeof(_Tp), std::nothrow)); if (__tmp != 0) return std::pair<_Tp*, ptrdiff_t>(__tmp, __len); __len /= 2; } return std::pair<_Tp*, ptrdiff_t>(static_cast<_Tp*>(0), 0); } /** * @brief The companion to get_temporary_buffer(). * @param __p A buffer previously allocated by get_temporary_buffer. * @return None. * * Frees the memory pointed to by __p. */ template<typename _Tp> inline void return_temporary_buffer(_Tp* __p) { ::operator delete(__p, std::nothrow); } /** * This class is used in two places: stl_algo.h and ext/memory, * where it is wrapped as the temporary_buffer class. See * temporary_buffer docs for more notes. */ template<typename _ForwardIterator, typename _Tp> class _Temporary_buffer { // concept requirements __glibcxx_class_requires(_ForwardIterator, _ForwardIteratorConcept) public: typedef _Tp value_type; typedef value_type* pointer; typedef pointer iterator; typedef ptrdiff_t size_type; protected: size_type _M_original_len; size_type _M_len; pointer _M_buffer; public: /// As per Table mumble. size_type size() const { return _M_len; } /// Returns the size requested by the constructor; may be >size(). size_type requested_size() const { return _M_original_len; } /// As per Table mumble. iterator begin() { return _M_buffer; } /// As per Table mumble. iterator end() { return _M_buffer + _M_len; } /** * Constructs a temporary buffer of a size somewhere between * zero and the size of the given range. */ _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last); ~_Temporary_buffer() { std::_Destroy(_M_buffer, _M_buffer + _M_len); std::return_temporary_buffer(_M_buffer); } private: // Disable copy constructor and assignment operator. _Temporary_buffer(const _Temporary_buffer&); void operator=(const _Temporary_buffer&); }; template<bool> struct __uninitialized_construct_buf_dispatch { template<typename _Pointer, typename _ForwardIterator> static void __ucr(_Pointer __first, _Pointer __last, _ForwardIterator __seed) { if(__first == __last) return; _Pointer __cur = __first; __try { std::_Construct(std::__addressof(*__first), _GLIBCXX_MOVE(*__seed)); _Pointer __prev = __cur; ++__cur; for(; __cur != __last; ++__cur, ++__prev) std::_Construct(std::__addressof(*__cur), _GLIBCXX_MOVE(*__prev)); *__seed = _GLIBCXX_MOVE(*__prev); } __catch(...) { std::_Destroy(__first, __cur); __throw_exception_again; } } }; template<> struct __uninitialized_construct_buf_dispatch<true> { template<typename _Pointer, typename _ForwardIterator> static void __ucr(_Pointer, _Pointer, _ForwardIterator) { } }; // Constructs objects in the range [first, last). // Note that while these new objects will take valid values, // their exact value is not defined. In particular they may // be 'moved from'. // // While *__seed may be altered during this algorithm, it will have // the same value when the algorithm finishes, unless one of the // constructions throws. // // Requirements: _Pointer::value_type(_Tp&&) is valid. template<typename _Pointer, typename _ForwardIterator> inline void __uninitialized_construct_buf(_Pointer __first, _Pointer __last, _ForwardIterator __seed) { typedef typename std::iterator_traits<_Pointer>::value_type _ValueType; std::__uninitialized_construct_buf_dispatch< __has_trivial_constructor(_ValueType)>:: __ucr(__first, __last, __seed); } template<typename _ForwardIterator, typename _Tp> _Temporary_buffer<_ForwardIterator, _Tp>:: _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) : _M_original_len(std::distance(__first, __last)), _M_len(0), _M_buffer(0) { __try { std::pair<pointer, size_type> __p(std::get_temporary_buffer< value_type>(_M_original_len)); _M_buffer = __p.first; _M_len = __p.second; if (_M_buffer) std::__uninitialized_construct_buf(_M_buffer, _M_buffer + _M_len, __first); } __catch(...) { std::return_temporary_buffer(_M_buffer); _M_buffer = 0; _M_len = 0; __throw_exception_again; } } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _STL_TEMPBUF_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/regex.h������������������������������������������������������������������������������0000644�����������������00000246772�14763166030�0010041 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// class template regex -*- C++ -*- // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** * @file bits/regex.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{regex} */ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup regex * @{ */ /** * @brief Class regex_traits. Describes aspects of a regular expression. * * A regular expression traits class that satisfies the requirements of * section [28.7]. * * The class %regex is parameterized around a set of related types and * functions used to complete the definition of its semantics. This class * satisfies the requirements of such a traits class. */ template<typename _Ch_type> struct regex_traits { public: typedef _Ch_type char_type; typedef std::basic_string<char_type> string_type; typedef std::locale locale_type; typedef std::ctype_base::mask char_class_type; public: /** * @brief Constructs a default traits object. */ regex_traits() { } /** * @brief Gives the length of a C-style string starting at @p __p. * * @param __p a pointer to the start of a character sequence. * * @returns the number of characters between @p *__p and the first * default-initialized value of type @p char_type. In other words, uses * the C-string algorithm for determining the length of a sequence of * characters. */ static std::size_t length(const char_type* __p) { return string_type::traits_type::length(__p); } /** * @brief Performs the identity translation. * * @param __c A character to the locale-specific character set. * * @returns __c. */ char_type translate(char_type __c) const { return __c; } /** * @brief Translates a character into a case-insensitive equivalent. * * @param __c A character to the locale-specific character set. * * @returns the locale-specific lower-case equivalent of __c. * @throws std::bad_cast if the imbued locale does not support the ctype * facet. */ char_type translate_nocase(char_type __c) const { typedef std::ctype<char_type> __ctype_type; const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale)); return __fctyp.tolower(__c); } /** * @brief Gets a sort key for a character sequence. * * @param __first beginning of the character sequence. * @param __last one-past-the-end of the character sequence. * * Returns a sort key for the character sequence designated by the * iterator range [F1, F2) such that if the character sequence [G1, G2) * sorts before the character sequence [H1, H2) then * v.transform(G1, G2) < v.transform(H1, H2). * * What this really does is provide a more efficient way to compare a * string to multiple other strings in locales with fancy collation * rules and equivalence classes. * * @returns a locale-specific sort key equivalent to the input range. * * @throws std::bad_cast if the current locale does not have a collate * facet. */ template<typename _Fwd_iter> string_type transform(_Fwd_iter __first, _Fwd_iter __last) const { typedef std::collate<char_type> __collate_type; const __collate_type& __fclt(use_facet<__collate_type>(_M_locale)); string_type __s(__first, __last); return __fclt.transform(__s.data(), __s.data() + __s.size()); } /** * @brief Gets a sort key for a character sequence, independent of case. * * @param __first beginning of the character sequence. * @param __last one-past-the-end of the character sequence. * * Effects: if typeid(use_facet<collate<_Ch_type> >) == * typeid(collate_byname<_Ch_type>) and the form of the sort key * returned by collate_byname<_Ch_type>::transform(__first, __last) * is known and can be converted into a primary sort key * then returns that key, otherwise returns an empty string. * * @todo Implement this function. */ template<typename _Fwd_iter> string_type transform_primary(_Fwd_iter __first, _Fwd_iter __last) const { return string_type(); } /** * @brief Gets a collation element by name. * * @param __first beginning of the collation element name. * @param __last one-past-the-end of the collation element name. * * @returns a sequence of one or more characters that represents the * collating element consisting of the character sequence designated by * the iterator range [__first, __last). Returns an empty string if the * character sequence is not a valid collating element. * * @todo Implement this function. */ template<typename _Fwd_iter> string_type lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const { return string_type(); } /** * @brief Maps one or more characters to a named character * classification. * * @param __first beginning of the character sequence. * @param __last one-past-the-end of the character sequence. * @param __icase ignores the case of the classification name. * * @returns an unspecified value that represents the character * classification named by the character sequence designated by * the iterator range [__first, __last). If @p icase is true, * the returned mask identifies the classification regardless of * the case of the characters to be matched (for example, * [[:lower:]] is the same as [[:alpha:]]), otherwise a * case-dependent classification is returned. The value * returned shall be independent of the case of the characters * in the character sequence. If the name is not recognized then * returns a value that compares equal to 0. * * At least the following names (or their wide-character equivalent) are * supported. * - d * - w * - s * - alnum * - alpha * - blank * - cntrl * - digit * - graph * - lower * - print * - punct * - space * - upper * - xdigit * * @todo Implement this function. */ template<typename _Fwd_iter> char_class_type lookup_classname(_Fwd_iter __first, _Fwd_iter __last, bool __icase = false) const { return 0; } /** * @brief Determines if @p c is a member of an identified class. * * @param __c a character. * @param __f a class type (as returned from lookup_classname). * * @returns true if the character @p __c is a member of the classification * represented by @p __f, false otherwise. * * @throws std::bad_cast if the current locale does not have a ctype * facet. */ bool isctype(_Ch_type __c, char_class_type __f) const; /** * @brief Converts a digit to an int. * * @param __ch a character representing a digit. * @param __radix the radix if the numeric conversion (limited to 8, 10, * or 16). * * @returns the value represented by the digit __ch in base radix if the * character __ch is a valid digit in base radix; otherwise returns -1. */ int value(_Ch_type __ch, int __radix) const; /** * @brief Imbues the regex_traits object with a copy of a new locale. * * @param __loc A locale. * * @returns a copy of the previous locale in use by the regex_traits * object. * * @note Calling imbue with a different locale than the one currently in * use invalidates all cached data held by *this. */ locale_type imbue(locale_type __loc) { std::swap(_M_locale, __loc); return __loc; } /** * @brief Gets a copy of the current locale in use by the regex_traits * object. */ locale_type getloc() const { return _M_locale; } protected: locale_type _M_locale; }; template<typename _Ch_type> bool regex_traits<_Ch_type>:: isctype(_Ch_type __c, char_class_type __f) const { typedef std::ctype<char_type> __ctype_type; const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale)); if (__fctyp.is(__f, __c)) return true; // special case of underscore in [[:w:]] if (__c == __fctyp.widen('_')) { const char __wb[] = "w"; char_class_type __wt = this->lookup_classname(__wb, __wb + sizeof(__wb)); if (__f | __wt) return true; } // special case of [[:space:]] in [[:blank:]] if (__fctyp.is(std::ctype_base::space, __c)) { const char __bb[] = "blank"; char_class_type __bt = this->lookup_classname(__bb, __bb + sizeof(__bb)); if (__f | __bt) return true; } return false; } template<typename _Ch_type> int regex_traits<_Ch_type>:: value(_Ch_type __ch, int __radix) const { std::basic_istringstream<char_type> __is(string_type(1, __ch)); int __v; if (__radix == 8) __is >> std::oct; else if (__radix == 16) __is >> std::hex; __is >> __v; return __is.fail() ? -1 : __v; } // [7.8] Class basic_regex /** * Objects of specializations of this class represent regular expressions * constructed from sequences of character type @p _Ch_type. * * Storage for the regular expression is allocated and deallocated as * necessary by the member functions of this class. */ template<typename _Ch_type, typename _Rx_traits = regex_traits<_Ch_type> > class basic_regex { public: // types: typedef _Ch_type value_type; typedef _Rx_traits traits_type; typedef typename traits_type::string_type string_type; typedef regex_constants::syntax_option_type flag_type; typedef typename traits_type::locale_type locale_type; /** * @name Constants * std [28.8.1](1) */ //@{ static constexpr flag_type icase = regex_constants::icase; static constexpr flag_type nosubs = regex_constants::nosubs; static constexpr flag_type optimize = regex_constants::optimize; static constexpr flag_type collate = regex_constants::collate; static constexpr flag_type ECMAScript = regex_constants::ECMAScript; static constexpr flag_type basic = regex_constants::basic; static constexpr flag_type extended = regex_constants::extended; static constexpr flag_type awk = regex_constants::awk; static constexpr flag_type grep = regex_constants::grep; static constexpr flag_type egrep = regex_constants::egrep; //@} // [7.8.2] construct/copy/destroy /** * Constructs a basic regular expression that does not match any * character sequence. */ basic_regex() : _M_flags(ECMAScript), _M_automaton(__detail::__compile<const _Ch_type*, _Rx_traits>(0, 0, _M_traits, _M_flags)) { } /** * @brief Constructs a basic regular expression from the * sequence [__p, __p + char_traits<_Ch_type>::length(__p)) * interpreted according to the flags in @p __f. * * @param __p A pointer to the start of a C-style null-terminated string * containing a regular expression. * @param __f Flags indicating the syntax rules and options. * * @throws regex_error if @p __p is not a valid regular expression. */ explicit basic_regex(const _Ch_type* __p, flag_type __f = ECMAScript) : _M_flags(__f), _M_automaton(__detail::__compile(__p, __p + _Rx_traits::length(__p), _M_traits, _M_flags)) { } /** * @brief Constructs a basic regular expression from the sequence * [p, p + len) interpreted according to the flags in @p f. * * @param __p A pointer to the start of a string containing a regular * expression. * @param __len The length of the string containing the regular * expression. * @param __f Flags indicating the syntax rules and options. * * @throws regex_error if @p __p is not a valid regular expression. */ basic_regex(const _Ch_type* __p, std::size_t __len, flag_type __f) : _M_flags(__f), _M_automaton(__detail::__compile(__p, __p + __len, _M_traits, _M_flags)) { } /** * @brief Copy-constructs a basic regular expression. * * @param __rhs A @p regex object. */ basic_regex(const basic_regex& __rhs) : _M_flags(__rhs._M_flags), _M_traits(__rhs._M_traits), _M_automaton(__rhs._M_automaton) { } /** * @brief Move-constructs a basic regular expression. * * @param __rhs A @p regex object. */ basic_regex(const basic_regex&& __rhs) noexcept : _M_flags(__rhs._M_flags), _M_traits(__rhs._M_traits), _M_automaton(std::move(__rhs._M_automaton)) { } /** * @brief Constructs a basic regular expression from the string * @p s interpreted according to the flags in @p f. * * @param __s A string containing a regular expression. * @param __f Flags indicating the syntax rules and options. * * @throws regex_error if @p __s is not a valid regular expression. */ template<typename _Ch_traits, typename _Ch_alloc> explicit basic_regex(const std::basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s, flag_type __f = ECMAScript) : _M_flags(__f), _M_automaton(__detail::__compile(__s.begin(), __s.end(), _M_traits, _M_flags)) { } /** * @brief Constructs a basic regular expression from the range * [first, last) interpreted according to the flags in @p f. * * @param __first The start of a range containing a valid regular * expression. * @param __last The end of a range containing a valid regular * expression. * @param __f The format flags of the regular expression. * * @throws regex_error if @p [__first, __last) is not a valid regular * expression. */ template<typename _InputIterator> basic_regex(_InputIterator __first, _InputIterator __last, flag_type __f = ECMAScript) : _M_flags(__f), _M_automaton(__detail::__compile(__first, __last, _M_traits, _M_flags)) { } /** * @brief Constructs a basic regular expression from an initializer list. * * @param __l The initializer list. * @param __f The format flags of the regular expression. * * @throws regex_error if @p __l is not a valid regular expression. */ basic_regex(initializer_list<_Ch_type> __l, flag_type __f = ECMAScript) : _M_flags(__f), _M_automaton(__detail::__compile(__l.begin(), __l.end(), _M_traits, _M_flags)) { } /** * @brief Destroys a basic regular expression. */ ~basic_regex() { } /** * @brief Assigns one regular expression to another. */ basic_regex& operator=(const basic_regex& __rhs) { return this->assign(__rhs); } /** * @brief Move-assigns one regular expression to another. */ basic_regex& operator=(basic_regex&& __rhs) noexcept { return this->assign(std::move(__rhs)); } /** * @brief Replaces a regular expression with a new one constructed from * a C-style null-terminated string. * * @param __p A pointer to the start of a null-terminated C-style string * containing a regular expression. */ basic_regex& operator=(const _Ch_type* __p) { return this->assign(__p, flags()); } /** * @brief Replaces a regular expression with a new one constructed from * a string. * * @param __s A pointer to a string containing a regular expression. */ template<typename _Ch_typeraits, typename _Alloc> basic_regex& operator=(const basic_string<_Ch_type, _Ch_typeraits, _Alloc>& __s) { return this->assign(__s, flags()); } // [7.8.3] assign /** * @brief the real assignment operator. * * @param __rhs Another regular expression object. */ basic_regex& assign(const basic_regex& __rhs) { basic_regex __tmp(__rhs); this->swap(__tmp); return *this; } /** * @brief The move-assignment operator. * * @param __rhs Another regular expression object. */ basic_regex& assign(basic_regex&& __rhs) noexcept { basic_regex __tmp(std::move(__rhs)); this->swap(__tmp); return *this; } /** * @brief Assigns a new regular expression to a regex object from a * C-style null-terminated string containing a regular expression * pattern. * * @param __p A pointer to a C-style null-terminated string containing * a regular expression pattern. * @param __flags Syntax option flags. * * @throws regex_error if __p does not contain a valid regular * expression pattern interpreted according to @p __flags. If * regex_error is thrown, *this remains unchanged. */ basic_regex& assign(const _Ch_type* __p, flag_type __flags = ECMAScript) { return this->assign(string_type(__p), __flags); } /** * @brief Assigns a new regular expression to a regex object from a * C-style string containing a regular expression pattern. * * @param __p A pointer to a C-style string containing a * regular expression pattern. * @param __len The length of the regular expression pattern string. * @param __flags Syntax option flags. * * @throws regex_error if p does not contain a valid regular * expression pattern interpreted according to @p __flags. If * regex_error is thrown, *this remains unchanged. */ basic_regex& assign(const _Ch_type* __p, std::size_t __len, flag_type __flags) { return this->assign(string_type(__p, __len), __flags); } /** * @brief Assigns a new regular expression to a regex object from a * string containing a regular expression pattern. * * @param __s A string containing a regular expression pattern. * @param __flags Syntax option flags. * * @throws regex_error if __s does not contain a valid regular * expression pattern interpreted according to @p __flags. If * regex_error is thrown, *this remains unchanged. */ template<typename _Ch_typeraits, typename _Alloc> basic_regex& assign(const basic_string<_Ch_type, _Ch_typeraits, _Alloc>& __s, flag_type __flags = ECMAScript) { basic_regex __tmp(__s, __flags); this->swap(__tmp); return *this; } /** * @brief Assigns a new regular expression to a regex object. * * @param __first The start of a range containing a valid regular * expression. * @param __last The end of a range containing a valid regular * expression. * @param __flags Syntax option flags. * * @throws regex_error if p does not contain a valid regular * expression pattern interpreted according to @p __flags. If * regex_error is thrown, the object remains unchanged. */ template<typename _InputIterator> basic_regex& assign(_InputIterator __first, _InputIterator __last, flag_type __flags = ECMAScript) { return this->assign(string_type(__first, __last), __flags); } /** * @brief Assigns a new regular expression to a regex object. * * @param __l An initializer list representing a regular expression. * @param __flags Syntax option flags. * * @throws regex_error if @p __l does not contain a valid * regular expression pattern interpreted according to @p * __flags. If regex_error is thrown, the object remains * unchanged. */ basic_regex& assign(initializer_list<_Ch_type> __l, flag_type __flags = ECMAScript) { return this->assign(__l.begin(), __l.end(), __flags); } // [7.8.4] const operations /** * @brief Gets the number of marked subexpressions within the regular * expression. */ unsigned int mark_count() const { return _M_automaton->_M_sub_count() - 1; } /** * @brief Gets the flags used to construct the regular expression * or in the last call to assign(). */ flag_type flags() const { return _M_flags; } // [7.8.5] locale /** * @brief Imbues the regular expression object with the given locale. * * @param __loc A locale. */ locale_type imbue(locale_type __loc) { return _M_traits.imbue(__loc); } /** * @brief Gets the locale currently imbued in the regular expression * object. */ locale_type getloc() const { return _M_traits.getloc(); } // [7.8.6] swap /** * @brief Swaps the contents of two regular expression objects. * * @param __rhs Another regular expression object. */ void swap(basic_regex& __rhs) { std::swap(_M_flags, __rhs._M_flags); std::swap(_M_traits, __rhs._M_traits); std::swap(_M_automaton, __rhs._M_automaton); } #ifdef _GLIBCXX_DEBUG void _M_dot(std::ostream& __ostr) { _M_automaton->_M_dot(__ostr); } #endif const __detail::_AutomatonPtr& _M_get_automaton() const { return _M_automaton; } protected: flag_type _M_flags; _Rx_traits _M_traits; __detail::_AutomatonPtr _M_automaton; }; /** @brief Standard regular expressions. */ typedef basic_regex<char> regex; #ifdef _GLIBCXX_USE_WCHAR_T /** @brief Standard wide-character regular expressions. */ typedef basic_regex<wchar_t> wregex; #endif // [7.8.6] basic_regex swap /** * @brief Swaps the contents of two regular expression objects. * @param __lhs First regular expression. * @param __rhs Second regular expression. */ template<typename _Ch_type, typename _Rx_traits> inline void swap(basic_regex<_Ch_type, _Rx_traits>& __lhs, basic_regex<_Ch_type, _Rx_traits>& __rhs) { __lhs.swap(__rhs); } // [7.9] Class template sub_match /** * A sequence of characters matched by a particular marked sub-expression. * * An object of this class is essentially a pair of iterators marking a * matched subexpression within a regular expression pattern match. Such * objects can be converted to and compared with std::basic_string objects * of a similar base character type as the pattern matched by the regular * expression. * * The iterators that make up the pair are the usual half-open interval * referencing the actual original pattern matched. */ template<typename _BiIter> class sub_match : public std::pair<_BiIter, _BiIter> { typedef iterator_traits<_BiIter> __iter_traits; public: typedef typename __iter_traits::value_type value_type; typedef typename __iter_traits::difference_type difference_type; typedef _BiIter iterator; typedef std::basic_string<value_type> string_type; bool matched; constexpr sub_match() : matched() { } /** * Gets the length of the matching sequence. */ difference_type length() const { return this->matched ? std::distance(this->first, this->second) : 0; } /** * @brief Gets the matching sequence as a string. * * @returns the matching sequence as a string. * * This is the implicit conversion operator. It is identical to the * str() member function except that it will want to pop up in * unexpected places and cause a great deal of confusion and cursing * from the unwary. */ operator string_type() const { return this->matched ? string_type(this->first, this->second) : string_type(); } /** * @brief Gets the matching sequence as a string. * * @returns the matching sequence as a string. */ string_type str() const { return this->matched ? string_type(this->first, this->second) : string_type(); } /** * @brief Compares this and another matched sequence. * * @param __s Another matched sequence to compare to this one. * * @retval <0 this matched sequence will collate before @p __s. * @retval =0 this matched sequence is equivalent to @p __s. * @retval <0 this matched sequence will collate after @p __s. */ int compare(const sub_match& __s) const { return this->str().compare(__s.str()); } /** * @brief Compares this sub_match to a string. * * @param __s A string to compare to this sub_match. * * @retval <0 this matched sequence will collate before @p __s. * @retval =0 this matched sequence is equivalent to @p __s. * @retval <0 this matched sequence will collate after @p __s. */ int compare(const string_type& __s) const { return this->str().compare(__s); } /** * @brief Compares this sub_match to a C-style string. * * @param __s A C-style string to compare to this sub_match. * * @retval <0 this matched sequence will collate before @p __s. * @retval =0 this matched sequence is equivalent to @p __s. * @retval <0 this matched sequence will collate after @p __s. */ int compare(const value_type* __s) const { return this->str().compare(__s); } }; /** @brief Standard regex submatch over a C-style null-terminated string. */ typedef sub_match<const char*> csub_match; /** @brief Standard regex submatch over a standard string. */ typedef sub_match<string::const_iterator> ssub_match; #ifdef _GLIBCXX_USE_WCHAR_T /** @brief Regex submatch over a C-style null-terminated wide string. */ typedef sub_match<const wchar_t*> wcsub_match; /** @brief Regex submatch over a standard wide string. */ typedef sub_match<wstring::const_iterator> wssub_match; #endif // [7.9.2] sub_match non-member operators /** * @brief Tests the equivalence of two regular expression submatches. * @param __lhs First regular expression submatch. * @param __rhs Second regular expression submatch. * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. */ template<typename _BiIter> inline bool operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) { return __lhs.compare(__rhs) == 0; } /** * @brief Tests the inequivalence of two regular expression submatches. * @param __lhs First regular expression submatch. * @param __rhs Second regular expression submatch. * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. */ template<typename _BiIter> inline bool operator!=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) { return __lhs.compare(__rhs) != 0; } /** * @brief Tests the ordering of two regular expression submatches. * @param __lhs First regular expression submatch. * @param __rhs Second regular expression submatch. * @returns true if @a __lhs precedes @a __rhs, false otherwise. */ template<typename _BiIter> inline bool operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) { return __lhs.compare(__rhs) < 0; } /** * @brief Tests the ordering of two regular expression submatches. * @param __lhs First regular expression submatch. * @param __rhs Second regular expression submatch. * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. */ template<typename _BiIter> inline bool operator<=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) { return __lhs.compare(__rhs) <= 0; } /** * @brief Tests the ordering of two regular expression submatches. * @param __lhs First regular expression submatch. * @param __rhs Second regular expression submatch. * @returns true if @a __lhs does not precede @a __rhs, false otherwise. */ template<typename _BiIter> inline bool operator>=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) { return __lhs.compare(__rhs) >= 0; } /** * @brief Tests the ordering of two regular expression submatches. * @param __lhs First regular expression submatch. * @param __rhs Second regular expression submatch. * @returns true if @a __lhs succeeds @a __rhs, false otherwise. */ template<typename _BiIter> inline bool operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) { return __lhs.compare(__rhs) > 0; } // Alias for sub_match'd string. template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc> using __sub_match_string = basic_string< typename iterator_traits<_Bi_iter>::value_type, _Ch_traits, _Ch_alloc>; /** * @brief Tests the equivalence of a string and a regular expression * submatch. * @param __lhs A string. * @param __rhs A regular expression submatch. * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. */ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc> inline bool operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs) { return __rhs.compare(__lhs.c_str()) == 0; } /** * @brief Tests the inequivalence of a string and a regular expression * submatch. * @param __lhs A string. * @param __rhs A regular expression submatch. * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. */ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc> inline bool operator!=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs) { return !(__lhs == __rhs); } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param __lhs A string. * @param __rhs A regular expression submatch. * @returns true if @a __lhs precedes @a __rhs, false otherwise. */ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc> inline bool operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs) { return __rhs.compare(__lhs.c_str()) > 0; } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param __lhs A string. * @param __rhs A regular expression submatch. * @returns true if @a __lhs succeeds @a __rhs, false otherwise. */ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc> inline bool operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs) { return __rhs < __lhs; } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param __lhs A string. * @param __rhs A regular expression submatch. * @returns true if @a __lhs does not precede @a __rhs, false otherwise. */ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc> inline bool operator>=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs) { return !(__lhs < __rhs); } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param __lhs A string. * @param __rhs A regular expression submatch. * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. */ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc> inline bool operator<=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs) { return !(__rhs < __lhs); } /** * @brief Tests the equivalence of a regular expression submatch and a * string. * @param __lhs A regular expression submatch. * @param __rhs A string. * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. */ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc> inline bool operator==(const sub_match<_Bi_iter>& __lhs, const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs) { return __lhs.compare(__rhs.c_str()) == 0; } /** * @brief Tests the inequivalence of a regular expression submatch and a * string. * @param __lhs A regular expression submatch. * @param __rhs A string. * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. */ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc> inline bool operator!=(const sub_match<_Bi_iter>& __lhs, const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs) { return !(__lhs == __rhs); } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param __lhs A regular expression submatch. * @param __rhs A string. * @returns true if @a __lhs precedes @a __rhs, false otherwise. */ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc> inline bool operator<(const sub_match<_Bi_iter>& __lhs, const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs) { return __lhs.compare(__rhs.c_str()) < 0; } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param __lhs A regular expression submatch. * @param __rhs A string. * @returns true if @a __lhs succeeds @a __rhs, false otherwise. */ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc> inline bool operator>(const sub_match<_Bi_iter>& __lhs, const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs) { return __rhs < __lhs; } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param __lhs A regular expression submatch. * @param __rhs A string. * @returns true if @a __lhs does not precede @a __rhs, false otherwise. */ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc> inline bool operator>=(const sub_match<_Bi_iter>& __lhs, const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs) { return !(__lhs < __rhs); } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param __lhs A regular expression submatch. * @param __rhs A string. * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. */ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc> inline bool operator<=(const sub_match<_Bi_iter>& __lhs, const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs) { return !(__rhs < __lhs); } /** * @brief Tests the equivalence of a C string and a regular expression * submatch. * @param __lhs A C string. * @param __rhs A regular expression submatch. * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, const sub_match<_Bi_iter>& __rhs) { return __rhs.compare(__lhs) == 0; } /** * @brief Tests the inequivalence of an iterator value and a regular * expression submatch. * @param __lhs A regular expression submatch. * @param __rhs A string. * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, const sub_match<_Bi_iter>& __rhs) { return !(__lhs == __rhs); } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param __lhs A string. * @param __rhs A regular expression submatch. * @returns true if @a __lhs precedes @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, const sub_match<_Bi_iter>& __rhs) { return __rhs.compare(__lhs) > 0; } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param __lhs A string. * @param __rhs A regular expression submatch. * @returns true if @a __lhs succeeds @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs, const sub_match<_Bi_iter>& __rhs) { return __rhs < __lhs; } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param __lhs A string. * @param __rhs A regular expression submatch. * @returns true if @a __lhs does not precede @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator>=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, const sub_match<_Bi_iter>& __rhs) { return !(__lhs < __rhs); } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param __lhs A string. * @param __rhs A regular expression submatch. * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator<=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, const sub_match<_Bi_iter>& __rhs) { return !(__rhs < __lhs); } /** * @brief Tests the equivalence of a regular expression submatch and a * string. * @param __lhs A regular expression submatch. * @param __rhs A pointer to a string? * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator==(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const* __rhs) { return __lhs.compare(__rhs) == 0; } /** * @brief Tests the inequivalence of a regular expression submatch and a * string. * @param __lhs A regular expression submatch. * @param __rhs A pointer to a string. * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator!=(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const* __rhs) { return !(__lhs == __rhs); } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param __lhs A regular expression submatch. * @param __rhs A string. * @returns true if @a __lhs precedes @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator<(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const* __rhs) { return __lhs.compare(__rhs) < 0; } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param __lhs A regular expression submatch. * @param __rhs A string. * @returns true if @a __lhs succeeds @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator>(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const* __rhs) { return __rhs < __lhs; } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param __lhs A regular expression submatch. * @param __rhs A string. * @returns true if @a __lhs does not precede @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator>=(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const* __rhs) { return !(__lhs < __rhs); } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param __lhs A regular expression submatch. * @param __rhs A string. * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator<=(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const* __rhs) { return !(__rhs < __lhs); } /** * @brief Tests the equivalence of a string and a regular expression * submatch. * @param __lhs A string. * @param __rhs A regular expression submatch. * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, const sub_match<_Bi_iter>& __rhs) { typedef typename sub_match<_Bi_iter>::string_type string_type; return __rhs.compare(string_type(1, __lhs)) == 0; } /** * @brief Tests the inequivalence of a string and a regular expression * submatch. * @param __lhs A string. * @param __rhs A regular expression submatch. * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, const sub_match<_Bi_iter>& __rhs) { return !(__lhs == __rhs); } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param __lhs A string. * @param __rhs A regular expression submatch. * @returns true if @a __lhs precedes @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, const sub_match<_Bi_iter>& __rhs) { typedef typename sub_match<_Bi_iter>::string_type string_type; return __rhs.compare(string_type(1, __lhs)) > 0; } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param __lhs A string. * @param __rhs A regular expression submatch. * @returns true if @a __lhs succeeds @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs, const sub_match<_Bi_iter>& __rhs) { return __rhs < __lhs; } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param __lhs A string. * @param __rhs A regular expression submatch. * @returns true if @a __lhs does not precede @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator>=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, const sub_match<_Bi_iter>& __rhs) { return !(__lhs < __rhs); } /** * @brief Tests the ordering of a string and a regular expression submatch. * @param __lhs A string. * @param __rhs A regular expression submatch. * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator<=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, const sub_match<_Bi_iter>& __rhs) { return !(__rhs < __lhs); } /** * @brief Tests the equivalence of a regular expression submatch and a * string. * @param __lhs A regular expression submatch. * @param __rhs A const string reference. * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator==(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const& __rhs) { typedef typename sub_match<_Bi_iter>::string_type string_type; return __lhs.compare(string_type(1, __rhs)) == 0; } /** * @brief Tests the inequivalence of a regular expression submatch and a * string. * @param __lhs A regular expression submatch. * @param __rhs A const string reference. * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator!=(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const& __rhs) { return !(__lhs == __rhs); } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param __lhs A regular expression submatch. * @param __rhs A const string reference. * @returns true if @a __lhs precedes @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator<(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const& __rhs) { typedef typename sub_match<_Bi_iter>::string_type string_type; return __lhs.compare(string_type(1, __rhs)) < 0; } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param __lhs A regular expression submatch. * @param __rhs A const string reference. * @returns true if @a __lhs succeeds @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator>(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const& __rhs) { return __rhs < __lhs; } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param __lhs A regular expression submatch. * @param __rhs A const string reference. * @returns true if @a __lhs does not precede @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator>=(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const& __rhs) { return !(__lhs < __rhs); } /** * @brief Tests the ordering of a regular expression submatch and a string. * @param __lhs A regular expression submatch. * @param __rhs A const string reference. * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. */ template<typename _Bi_iter> inline bool operator<=(const sub_match<_Bi_iter>& __lhs, typename iterator_traits<_Bi_iter>::value_type const& __rhs) { return !(__rhs < __lhs); } /** * @brief Inserts a matched string into an output stream. * * @param __os The output stream. * @param __m A submatch string. * * @returns the output stream with the submatch string inserted. */ template<typename _Ch_type, typename _Ch_traits, typename _Bi_iter> inline basic_ostream<_Ch_type, _Ch_traits>& operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os, const sub_match<_Bi_iter>& __m) { return __os << __m.str(); } // [7.10] Class template match_results /* * Special sub_match object representing an unmatched sub-expression. */ template<typename _Bi_iter> inline const sub_match<_Bi_iter>& __unmatched_sub() { static const sub_match<_Bi_iter> __unmatched = sub_match<_Bi_iter>(); return __unmatched; } /** * @brief The results of a match or search operation. * * A collection of character sequences representing the result of a regular * expression match. Storage for the collection is allocated and freed as * necessary by the member functions of class template match_results. * * This class satisfies the Sequence requirements, with the exception that * only the operations defined for a const-qualified Sequence are supported. * * The sub_match object stored at index 0 represents sub-expression 0, i.e. * the whole match. In this case the %sub_match member matched is always true. * The sub_match object stored at index n denotes what matched the marked * sub-expression n within the matched expression. If the sub-expression n * participated in a regular expression match then the %sub_match member * matched evaluates to true, and members first and second denote the range * of characters [first, second) which formed that match. Otherwise matched * is false, and members first and second point to the end of the sequence * that was searched. * * @nosubgrouping */ template<typename _Bi_iter, typename _Alloc = allocator<sub_match<_Bi_iter> > > class match_results : private std::vector<sub_match<_Bi_iter>, _Alloc> { private: /* * The vector base is empty if this does not represent a successful match. * Otherwise it contains n+3 elements where n is the number of marked * sub-expressions: * [0] entire match * [1] 1st marked subexpression * ... * [n] nth marked subexpression * [n+1] prefix * [n+2] suffix */ typedef std::vector<sub_match<_Bi_iter>, _Alloc> _Base_type; typedef std::iterator_traits<_Bi_iter> __iter_traits; typedef regex_constants::match_flag_type match_flag_type; public: /** * @name 10.? Public Types */ //@{ typedef _Alloc allocator_type; typedef sub_match<_Bi_iter> value_type; typedef const value_type& const_reference; typedef const_reference reference; typedef typename _Base_type::const_iterator const_iterator; typedef const_iterator iterator; typedef typename __iter_traits::difference_type difference_type; typedef typename __iter_traits::value_type char_type; typedef typename allocator_traits<_Alloc>::size_type size_type; typedef std::basic_string<char_type> string_type; //@} public: /** * @name 28.10.1 Construction, Copying, and Destruction */ //@{ /** * @brief Constructs a default %match_results container. * @post size() returns 0 and str() returns an empty string. */ explicit match_results(const _Alloc& __a = _Alloc()) : _Base_type(__a) { } /** * @brief Copy constructs a %match_results. */ match_results(const match_results& __rhs) : _Base_type(__rhs) { } /** * @brief Move constructs a %match_results. */ match_results(match_results&& __rhs) noexcept : _Base_type(std::move(__rhs)) { } /** * @brief Assigns rhs to *this. */ match_results& operator=(const match_results& __rhs) { match_results(__rhs).swap(*this); return *this; } /** * @brief Move-assigns rhs to *this. */ match_results& operator=(match_results&& __rhs) { match_results(std::move(__rhs)).swap(*this); return *this; } /** * @brief Destroys a %match_results object. */ ~match_results() { } //@} // 28.10.2, state: /** * @brief Indicates if the %match_results is ready. * @retval true The object has a fully-established result state. * @retval false The object is not ready. */ bool ready() const { return !_Base_type::empty(); } /** * @name 28.10.2 Size */ //@{ /** * @brief Gets the number of matches and submatches. * * The number of matches for a given regular expression will be either 0 * if there was no match or mark_count() + 1 if a match was successful. * Some matches may be empty. * * @returns the number of matches found. */ size_type size() const { size_type __size = _Base_type::size(); return (__size && _Base_type::operator[](0).matched) ? __size - 2 : 0; } size_type max_size() const { return _Base_type::max_size(); } /** * @brief Indicates if the %match_results contains no results. * @retval true The %match_results object is empty. * @retval false The %match_results object is not empty. */ bool empty() const { return size() == 0; } //@} /** * @name 10.3 Element Access */ //@{ /** * @brief Gets the length of the indicated submatch. * @param __sub indicates the submatch. * @pre ready() == true * * This function returns the length of the indicated submatch, or the * length of the entire match if @p __sub is zero (the default). */ difference_type length(size_type __sub = 0) const { return (*this)[__sub].length(); } /** * @brief Gets the offset of the beginning of the indicated submatch. * @param __sub indicates the submatch. * @pre ready() == true * * This function returns the offset from the beginning of the target * sequence to the beginning of the submatch, unless the value of @p __sub * is zero (the default), in which case this function returns the offset * from the beginning of the target sequence to the beginning of the * match. * * Returns -1 if @p __sub is out of range. */ difference_type position(size_type __sub = 0) const { return __sub < size() ? std::distance(this->prefix().first, (*this)[__sub].first) : -1; } /** * @brief Gets the match or submatch converted to a string type. * @param __sub indicates the submatch. * @pre ready() == true * * This function gets the submatch (or match, if @p __sub is * zero) extracted from the target range and converted to the * associated string type. */ string_type str(size_type __sub = 0) const { return (*this)[__sub].str(); } /** * @brief Gets a %sub_match reference for the match or submatch. * @param __sub indicates the submatch. * @pre ready() == true * * This function gets a reference to the indicated submatch, or * the entire match if @p __sub is zero. * * If @p __sub >= size() then this function returns a %sub_match with a * special value indicating no submatch. */ const_reference operator[](size_type __sub) const { _GLIBCXX_DEBUG_ASSERT( ready() ); return __sub < size() ? _Base_type::operator[](__sub) : __unmatched_sub<_Bi_iter>(); } /** * @brief Gets a %sub_match representing the match prefix. * @pre ready() == true * * This function gets a reference to a %sub_match object representing the * part of the target range between the start of the target range and the * start of the match. */ const_reference prefix() const { _GLIBCXX_DEBUG_ASSERT( ready() ); return !empty() ? _Base_type::operator[](_Base_type::size() - 2) : __unmatched_sub<_Bi_iter>(); } /** * @brief Gets a %sub_match representing the match suffix. * @pre ready() == true * * This function gets a reference to a %sub_match object representing the * part of the target range between the end of the match and the end of * the target range. */ const_reference suffix() const { _GLIBCXX_DEBUG_ASSERT( ready() ); return !empty() ? _Base_type::operator[](_Base_type::size() - 1) : __unmatched_sub<_Bi_iter>(); } /** * @brief Gets an iterator to the start of the %sub_match collection. */ const_iterator begin() const { return _Base_type::begin(); } /** * @brief Gets an iterator to the start of the %sub_match collection. */ const_iterator cbegin() const { return _Base_type::cbegin(); } /** * @brief Gets an iterator to one-past-the-end of the collection. */ const_iterator end() const { return !empty() ? _Base_type::end() - 2 : _Base_type::end(); } /** * @brief Gets an iterator to one-past-the-end of the collection. */ const_iterator cend() const { return end(); } //@} /** * @name 10.4 Formatting * * These functions perform formatted substitution of the matched * character sequences into their target. The format specifiers and * escape sequences accepted by these functions are determined by * their @p flags parameter as documented above. */ //@{ /** * @pre ready() == true * @todo Implement this function. */ template<typename _Out_iter> _Out_iter format(_Out_iter __out, const char_type* __fmt_first, const char_type* __fmt_last, match_flag_type __flags = regex_constants::format_default) const { return __out; } /** * @pre ready() == true */ template<typename _Out_iter, typename _St, typename _Sa> _Out_iter format(_Out_iter __out, const basic_string<char_type, _St, _Sa>& __fmt, match_flag_type __flags = regex_constants::format_default) const { return format(__out, __fmt.data(), __fmt.data() + __fmt.size(), __flags); } /** * @pre ready() == true */ template<typename _Out_iter, typename _St, typename _Sa> basic_string<char_type, _St, _Sa> format(const basic_string<char_type, _St, _Sa>& __fmt, match_flag_type __flags = regex_constants::format_default) const { basic_string<char_type, _St, _Sa> __result; format(std::back_inserter(__result), __fmt, __flags); return __result; } /** * @pre ready() == true */ string_type format(const char_type* __fmt, match_flag_type __flags = regex_constants::format_default) const { string_type __result; format(std::back_inserter(__result), __fmt + char_traits<char_type>::length(__fmt), __flags); return __result; } //@} /** * @name 10.5 Allocator */ //@{ /** * @brief Gets a copy of the allocator. */ allocator_type get_allocator() const { return _Base_type::get_allocator(); } //@} /** * @name 10.6 Swap */ //@{ /** * @brief Swaps the contents of two match_results. */ void swap(match_results& __that) { _Base_type::swap(__that); } //@} private: friend class __detail::_SpecializedResults<_Bi_iter, _Alloc>; }; typedef match_results<const char*> cmatch; typedef match_results<string::const_iterator> smatch; #ifdef _GLIBCXX_USE_WCHAR_T typedef match_results<const wchar_t*> wcmatch; typedef match_results<wstring::const_iterator> wsmatch; #endif // match_results comparisons /** * @brief Compares two match_results for equality. * @returns true if the two objects refer to the same match, * false otherwise. */ template<typename _Bi_iter, typename _Alloc> inline bool operator==(const match_results<_Bi_iter, _Alloc>& __m1, const match_results<_Bi_iter, _Alloc>& __m2) { if (__m1.ready() != __m2.ready()) return false; if (!__m1.ready()) // both are not ready return true; if (__m1.empty() != __m2.empty()) return false; if (__m1.empty()) // both are empty return true; return __m1.prefix() == __m2.prefix() && __m1.size() == __m2.size() && std::equal(__m1.begin(), __m1.end(), __m2.begin()) && __m1.suffix() == __m2.suffix(); } /** * @brief Compares two match_results for inequality. * @returns true if the two objects do not refer to the same match, * false otherwise. */ template<typename _Bi_iter, class _Alloc> inline bool operator!=(const match_results<_Bi_iter, _Alloc>& __m1, const match_results<_Bi_iter, _Alloc>& __m2) { return !(__m1 == __m2); } // [7.10.6] match_results swap /** * @brief Swaps two match results. * @param __lhs A match result. * @param __rhs A match result. * * The contents of the two match_results objects are swapped. */ template<typename _Bi_iter, typename _Alloc> inline void swap(match_results<_Bi_iter, _Alloc>& __lhs, match_results<_Bi_iter, _Alloc>& __rhs) { __lhs.swap(__rhs); } // [7.11.2] Function template regex_match /** * @name Matching, Searching, and Replacing */ //@{ /** * @brief Determines if there is a match between the regular expression @p e * and all of the character sequence [first, last). * * @param __s Start of the character sequence to match. * @param __e One-past-the-end of the character sequence to match. * @param __m The match results. * @param __re The regular expression. * @param __flags Controls how the regular expression is matched. * * @retval true A match exists. * @retval false Otherwise. * * @throws an exception of type regex_error. * * @todo Implement this function. */ template<typename _Bi_iter, typename _Alloc, typename _Ch_type, typename _Rx_traits> bool regex_match(_Bi_iter __s, _Bi_iter __e, match_results<_Bi_iter, _Alloc>& __m, const basic_regex<_Ch_type, _Rx_traits>& __re, regex_constants::match_flag_type __flags = regex_constants::match_default) { __detail::_AutomatonPtr __a = __re._M_get_automaton(); __detail::_Automaton::_SizeT __sz = __a->_M_sub_count(); __detail::_SpecializedCursor<_Bi_iter> __cs(__s, __e); __detail::_SpecializedResults<_Bi_iter, _Alloc> __r(__sz, __cs, __m); __detail::_Grep_matcher __matcher(__cs, __r, __a, __flags); return __m[0].matched; } /** * @brief Indicates if there is a match between the regular expression @p e * and all of the character sequence [first, last). * * @param __first Beginning of the character sequence to match. * @param __last One-past-the-end of the character sequence to match. * @param __re The regular expression. * @param __flags Controls how the regular expression is matched. * * @retval true A match exists. * @retval false Otherwise. * * @throws an exception of type regex_error. */ template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits> bool regex_match(_Bi_iter __first, _Bi_iter __last, const basic_regex<_Ch_type, _Rx_traits>& __re, regex_constants::match_flag_type __flags = regex_constants::match_default) { match_results<_Bi_iter> __what; return regex_match(__first, __last, __what, __re, __flags); } /** * @brief Determines if there is a match between the regular expression @p e * and a C-style null-terminated string. * * @param __s The C-style null-terminated string to match. * @param __m The match results. * @param __re The regular expression. * @param __f Controls how the regular expression is matched. * * @retval true A match exists. * @retval false Otherwise. * * @throws an exception of type regex_error. */ template<typename _Ch_type, typename _Alloc, typename _Rx_traits> inline bool regex_match(const _Ch_type* __s, match_results<const _Ch_type*, _Alloc>& __m, const basic_regex<_Ch_type, _Rx_traits>& __re, regex_constants::match_flag_type __f = regex_constants::match_default) { return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); } /** * @brief Determines if there is a match between the regular expression @p e * and a string. * * @param __s The string to match. * @param __m The match results. * @param __re The regular expression. * @param __flags Controls how the regular expression is matched. * * @retval true A match exists. * @retval false Otherwise. * * @throws an exception of type regex_error. */ template<typename _Ch_traits, typename _Ch_alloc, typename _Alloc, typename _Ch_type, typename _Rx_traits> inline bool regex_match(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s, match_results<typename basic_string<_Ch_type, _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m, const basic_regex<_Ch_type, _Rx_traits>& __re, regex_constants::match_flag_type __flags = regex_constants::match_default) { return regex_match(__s.begin(), __s.end(), __m, __re, __flags); } /** * @brief Indicates if there is a match between the regular expression @p e * and a C-style null-terminated string. * * @param __s The C-style null-terminated string to match. * @param __re The regular expression. * @param __f Controls how the regular expression is matched. * * @retval true A match exists. * @retval false Otherwise. * * @throws an exception of type regex_error. */ template<typename _Ch_type, class _Rx_traits> inline bool regex_match(const _Ch_type* __s, const basic_regex<_Ch_type, _Rx_traits>& __re, regex_constants::match_flag_type __f = regex_constants::match_default) { return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); } /** * @brief Indicates if there is a match between the regular expression @p e * and a string. * * @param __s [IN] The string to match. * @param __re [IN] The regular expression. * @param __flags [IN] Controls how the regular expression is matched. * * @retval true A match exists. * @retval false Otherwise. * * @throws an exception of type regex_error. */ template<typename _Ch_traits, typename _Str_allocator, typename _Ch_type, typename _Rx_traits> inline bool regex_match(const basic_string<_Ch_type, _Ch_traits, _Str_allocator>& __s, const basic_regex<_Ch_type, _Rx_traits>& __re, regex_constants::match_flag_type __flags = regex_constants::match_default) { return regex_match(__s.begin(), __s.end(), __re, __flags); } // [7.11.3] Function template regex_search /** * Searches for a regular expression within a range. * @param __first [IN] The start of the string to search. * @param __last [IN] One-past-the-end of the string to search. * @param __m [OUT] The match results. * @param __re [IN] The regular expression to search for. * @param __flags [IN] Search policy flags. * @retval true A match was found within the string. * @retval false No match was found within the string, the content of %m is * undefined. * * @throws an exception of type regex_error. * * @todo Implement this function. */ template<typename _Bi_iter, typename _Alloc, typename _Ch_type, typename _Rx_traits> inline bool regex_search(_Bi_iter __first, _Bi_iter __last, match_results<_Bi_iter, _Alloc>& __m, const basic_regex<_Ch_type, _Rx_traits>& __re, regex_constants::match_flag_type __flags = regex_constants::match_default) { return false; } /** * Searches for a regular expression within a range. * @param __first [IN] The start of the string to search. * @param __last [IN] One-past-the-end of the string to search. * @param __re [IN] The regular expression to search for. * @param __flags [IN] Search policy flags. * @retval true A match was found within the string. * @retval false No match was found within the string. * @doctodo * * @throws an exception of type regex_error. */ template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits> inline bool regex_search(_Bi_iter __first, _Bi_iter __last, const basic_regex<_Ch_type, _Rx_traits>& __re, regex_constants::match_flag_type __flags = regex_constants::match_default) { match_results<_Bi_iter> __what; return regex_search(__first, __last, __what, __re, __flags); } /** * @brief Searches for a regular expression within a C-string. * @param __s [IN] A C-string to search for the regex. * @param __m [OUT] The set of regex matches. * @param __e [IN] The regex to search for in @p s. * @param __f [IN] The search flags. * @retval true A match was found within the string. * @retval false No match was found within the string, the content of %m is * undefined. * @doctodo * * @throws an exception of type regex_error. */ template<typename _Ch_type, class _Alloc, class _Rx_traits> inline bool regex_search(const _Ch_type* __s, match_results<const _Ch_type*, _Alloc>& __m, const basic_regex<_Ch_type, _Rx_traits>& __e, regex_constants::match_flag_type __f = regex_constants::match_default) { return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); } /** * @brief Searches for a regular expression within a C-string. * @param __s [IN] The C-string to search. * @param __e [IN] The regular expression to search for. * @param __f [IN] Search policy flags. * @retval true A match was found within the string. * @retval false No match was found within the string. * @doctodo * * @throws an exception of type regex_error. */ template<typename _Ch_type, typename _Rx_traits> inline bool regex_search(const _Ch_type* __s, const basic_regex<_Ch_type, _Rx_traits>& __e, regex_constants::match_flag_type __f = regex_constants::match_default) { return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); } /** * @brief Searches for a regular expression within a string. * @param __s [IN] The string to search. * @param __e [IN] The regular expression to search for. * @param __flags [IN] Search policy flags. * @retval true A match was found within the string. * @retval false No match was found within the string. * @doctodo * * @throws an exception of type regex_error. */ template<typename _Ch_traits, typename _String_allocator, typename _Ch_type, typename _Rx_traits> inline bool regex_search(const basic_string<_Ch_type, _Ch_traits, _String_allocator>& __s, const basic_regex<_Ch_type, _Rx_traits>& __e, regex_constants::match_flag_type __flags = regex_constants::match_default) { return regex_search(__s.begin(), __s.end(), __e, __flags); } /** * @brief Searches for a regular expression within a string. * @param __s [IN] A C++ string to search for the regex. * @param __m [OUT] The set of regex matches. * @param __e [IN] The regex to search for in @p s. * @param __f [IN] The search flags. * @retval true A match was found within the string. * @retval false No match was found within the string, the content of %m is * undefined. * * @throws an exception of type regex_error. */ template<typename _Ch_traits, typename _Ch_alloc, typename _Alloc, typename _Ch_type, typename _Rx_traits> inline bool regex_search(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s, match_results<typename basic_string<_Ch_type, _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m, const basic_regex<_Ch_type, _Rx_traits>& __e, regex_constants::match_flag_type __f = regex_constants::match_default) { return regex_search(__s.begin(), __s.end(), __m, __e, __f); } // std [28.11.4] Function template regex_replace /** * @doctodo * @param __out * @param __first * @param __last * @param __e * @param __fmt * @param __flags * * @returns out * @throws an exception of type regex_error. * * @todo Implement this function. */ template<typename _Out_iter, typename _Bi_iter, typename _Rx_traits, typename _Ch_type> inline _Out_iter regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, const basic_regex<_Ch_type, _Rx_traits>& __e, const basic_string<_Ch_type>& __fmt, regex_constants::match_flag_type __flags = regex_constants::match_default) { return __out; } /** * @doctodo * @param __s * @param __e * @param __fmt * @param __flags * * @returns a copy of string @p s with replacements. * * @throws an exception of type regex_error. */ template<typename _Rx_traits, typename _Ch_type> inline basic_string<_Ch_type> regex_replace(const basic_string<_Ch_type>& __s, const basic_regex<_Ch_type, _Rx_traits>& __e, const basic_string<_Ch_type>& __fmt, regex_constants::match_flag_type __flags = regex_constants::match_default) { basic_string<_Ch_type> __result; regex_replace(std::back_inserter(__result), __s.begin(), __s.end(), __e, __fmt, __flags); return __result; } //@} // std [28.12] Class template regex_iterator /** * An iterator adaptor that will provide repeated calls of regex_search over * a range until no more matches remain. */ template<typename _Bi_iter, typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type, typename _Rx_traits = regex_traits<_Ch_type> > class regex_iterator { public: typedef basic_regex<_Ch_type, _Rx_traits> regex_type; typedef match_results<_Bi_iter> value_type; typedef std::ptrdiff_t difference_type; typedef const value_type* pointer; typedef const value_type& reference; typedef std::forward_iterator_tag iterator_category; /** * @brief Provides a singular iterator, useful for indicating * one-past-the-end of a range. * @todo Implement this function. * @doctodo */ regex_iterator(); /** * Constructs a %regex_iterator... * @param __a [IN] The start of a text range to search. * @param __b [IN] One-past-the-end of the text range to search. * @param __re [IN] The regular expression to match. * @param __m [IN] Policy flags for match rules. * @todo Implement this function. * @doctodo */ regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re, regex_constants::match_flag_type __m = regex_constants::match_default); /** * Copy constructs a %regex_iterator. * @todo Implement this function. * @doctodo */ regex_iterator(const regex_iterator& __rhs); /** * @todo Implement this function. * @doctodo */ regex_iterator& operator=(const regex_iterator& __rhs); /** * @todo Implement this function. * @doctodo */ bool operator==(const regex_iterator& __rhs); /** * @todo Implement this function. * @doctodo */ bool operator!=(const regex_iterator& __rhs); /** * @todo Implement this function. * @doctodo */ const value_type& operator*(); /** * @todo Implement this function. * @doctodo */ const value_type* operator->(); /** * @todo Implement this function. * @doctodo */ regex_iterator& operator++(); /** * @todo Implement this function. * @doctodo */ regex_iterator operator++(int); private: // these members are shown for exposition only: _Bi_iter begin; _Bi_iter end; const regex_type* pregex; regex_constants::match_flag_type flags; match_results<_Bi_iter> match; }; typedef regex_iterator<const char*> cregex_iterator; typedef regex_iterator<string::const_iterator> sregex_iterator; #ifdef _GLIBCXX_USE_WCHAR_T typedef regex_iterator<const wchar_t*> wcregex_iterator; typedef regex_iterator<wstring::const_iterator> wsregex_iterator; #endif // [7.12.2] Class template regex_token_iterator /** * Iterates over submatches in a range (or @a splits a text string). * * The purpose of this iterator is to enumerate all, or all specified, * matches of a regular expression within a text range. The dereferenced * value of an iterator of this class is a std::sub_match object. */ template<typename _Bi_iter, typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type, typename _Rx_traits = regex_traits<_Ch_type> > class regex_token_iterator { public: typedef basic_regex<_Ch_type, _Rx_traits> regex_type; typedef sub_match<_Bi_iter> value_type; typedef std::ptrdiff_t difference_type; typedef const value_type* pointer; typedef const value_type& reference; typedef std::forward_iterator_tag iterator_category; public: /** * @brief Default constructs a %regex_token_iterator. * @todo Implement this function. * * A default-constructed %regex_token_iterator is a singular iterator * that will compare equal to the one-past-the-end value for any * iterator of the same type. */ regex_token_iterator(); /** * Constructs a %regex_token_iterator... * @param __a [IN] The start of the text to search. * @param __b [IN] One-past-the-end of the text to search. * @param __re [IN] The regular expression to search for. * @param __submatch [IN] Which submatch to return. There are some * special values for this parameter: * - -1 each enumerated subexpression does NOT * match the regular expression (aka field * splitting) * - 0 the entire string matching the * subexpression is returned for each match * within the text. * - >0 enumerates only the indicated * subexpression from a match within the text. * @param __m [IN] Policy flags for match rules. * * @todo Implement this function. * @doctodo */ regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re, int __submatch = 0, regex_constants::match_flag_type __m = regex_constants::match_default); /** * Constructs a %regex_token_iterator... * @param __a [IN] The start of the text to search. * @param __b [IN] One-past-the-end of the text to search. * @param __re [IN] The regular expression to search for. * @param __submatches [IN] A list of subexpressions to return for each * regular expression match within the text. * @param __m [IN] Policy flags for match rules. * * @todo Implement this function. * @doctodo */ regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re, const std::vector<int>& __submatches, regex_constants::match_flag_type __m = regex_constants::match_default); /** * Constructs a %regex_token_iterator... * @param __a [IN] The start of the text to search. * @param __b [IN] One-past-the-end of the text to search. * @param __re [IN] The regular expression to search for. * @param __submatches [IN] A list of subexpressions to return for each * regular expression match within the text. * @param __m [IN] Policy flags for match rules. * @todo Implement this function. * @doctodo */ template<std::size_t _Nm> regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re, const int (&__submatches)[_Nm], regex_constants::match_flag_type __m = regex_constants::match_default); /** * @brief Copy constructs a %regex_token_iterator. * @param __rhs [IN] A %regex_token_iterator to copy. * @todo Implement this function. */ regex_token_iterator(const regex_token_iterator& __rhs); /** * @brief Assigns a %regex_token_iterator to another. * @param __rhs [IN] A %regex_token_iterator to copy. * @todo Implement this function. */ regex_token_iterator& operator=(const regex_token_iterator& __rhs); /** * @brief Compares a %regex_token_iterator to another for equality. * @todo Implement this function. */ bool operator==(const regex_token_iterator& __rhs); /** * @brief Compares a %regex_token_iterator to another for inequality. * @todo Implement this function. */ bool operator!=(const regex_token_iterator& __rhs); /** * @brief Dereferences a %regex_token_iterator. * @todo Implement this function. */ const value_type& operator*(); /** * @brief Selects a %regex_token_iterator member. * @todo Implement this function. */ const value_type* operator->(); /** * @brief Increments a %regex_token_iterator. * @todo Implement this function. */ regex_token_iterator& operator++(); /** * @brief Postincrements a %regex_token_iterator. * @todo Implement this function. */ regex_token_iterator operator++(int); private: // data members for exposition only: typedef regex_iterator<_Bi_iter, _Ch_type, _Rx_traits> position_iterator; position_iterator __position; const value_type* __result; value_type __suffix; std::size_t __n; std::vector<int> __subs; }; /** @brief Token iterator for C-style NULL-terminated strings. */ typedef regex_token_iterator<const char*> cregex_token_iterator; /** @brief Token iterator for standard strings. */ typedef regex_token_iterator<string::const_iterator> sregex_token_iterator; #ifdef _GLIBCXX_USE_WCHAR_T /** @brief Token iterator for C-style NULL-terminated wide strings. */ typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator; /** @brief Token iterator for standard wide-character strings. */ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator; #endif //@} // group regex _GLIBCXX_END_NAMESPACE_VERSION } // namespace ������c++/4.8.2/bits/random.h�����������������������������������������������������������������������������0000644�����������������00000532302�14763166030�0010172 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// random number generation -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** * @file bits/random.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{random} */ #ifndef _RANDOM_H #define _RANDOM_H 1 #include <vector> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // [26.4] Random number generation /** * @defgroup random Random Number Generation * @ingroup numerics * * A facility for generating random numbers on selected distributions. * @{ */ /** * @brief A function template for converting the output of a (integral) * uniform random number generator to a floatng point result in the range * [0-1). */ template<typename _RealType, size_t __bits, typename _UniformRandomNumberGenerator> _RealType generate_canonical(_UniformRandomNumberGenerator& __g); _GLIBCXX_END_NAMESPACE_VERSION /* * Implementation-space details. */ namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _UIntType, size_t __w, bool = __w < static_cast<size_t> (std::numeric_limits<_UIntType>::digits)> struct _Shift { static const _UIntType __value = 0; }; template<typename _UIntType, size_t __w> struct _Shift<_UIntType, __w, true> { static const _UIntType __value = _UIntType(1) << __w; }; template<int __s, int __which = ((__s <= __CHAR_BIT__ * sizeof (int)) + (__s <= __CHAR_BIT__ * sizeof (long)) + (__s <= __CHAR_BIT__ * sizeof (long long)) /* assume long long no bigger than __int128 */ + (__s <= 128))> struct _Select_uint_least_t { static_assert(__which < 0, /* needs to be dependent */ "sorry, would be too much trouble for a slow result"); }; template<int __s> struct _Select_uint_least_t<__s, 4> { typedef unsigned int type; }; template<int __s> struct _Select_uint_least_t<__s, 3> { typedef unsigned long type; }; template<int __s> struct _Select_uint_least_t<__s, 2> { typedef unsigned long long type; }; #ifdef _GLIBCXX_USE_INT128 template<int __s> struct _Select_uint_least_t<__s, 1> { typedef unsigned __int128 type; }; #endif // Assume a != 0, a < m, c < m, x < m. template<typename _Tp, _Tp __m, _Tp __a, _Tp __c, bool __big_enough = (!(__m & (__m - 1)) || (_Tp(-1) - __c) / __a >= __m - 1), bool __schrage_ok = __m % __a < __m / __a> struct _Mod { typedef typename _Select_uint_least_t<std::__lg(__a) + std::__lg(__m) + 2>::type _Tp2; static _Tp __calc(_Tp __x) { return static_cast<_Tp>((_Tp2(__a) * __x + __c) % __m); } }; // Schrage. template<typename _Tp, _Tp __m, _Tp __a, _Tp __c> struct _Mod<_Tp, __m, __a, __c, false, true> { static _Tp __calc(_Tp __x); }; // Special cases: // - for m == 2^n or m == 0, unsigned integer overflow is safe. // - a * (m - 1) + c fits in _Tp, there is no overflow. template<typename _Tp, _Tp __m, _Tp __a, _Tp __c, bool __s> struct _Mod<_Tp, __m, __a, __c, true, __s> { static _Tp __calc(_Tp __x) { _Tp __res = __a * __x + __c; if (__m) __res %= __m; return __res; } }; template<typename _Tp, _Tp __m, _Tp __a = 1, _Tp __c = 0> inline _Tp __mod(_Tp __x) { return _Mod<_Tp, __m, __a, __c>::__calc(__x); } /* Determine whether number is a power of 2. */ template<typename _Tp> inline bool _Power_of_2(_Tp __x) { return ((__x - 1) & __x) == 0; }; /* * An adaptor class for converting the output of any Generator into * the input for a specific Distribution. */ template<typename _Engine, typename _DInputType> struct _Adaptor { public: _Adaptor(_Engine& __g) : _M_g(__g) { } _DInputType min() const { return _DInputType(0); } _DInputType max() const { return _DInputType(1); } /* * Converts a value generated by the adapted random number generator * into a value in the input domain for the dependent random number * distribution. */ _DInputType operator()() { return std::generate_canonical<_DInputType, std::numeric_limits<_DInputType>::digits, _Engine>(_M_g); } private: _Engine& _M_g; }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace __detail _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup random_generators Random Number Generators * @ingroup random * * These classes define objects which provide random or pseudorandom * numbers, either from a discrete or a continuous interval. The * random number generator supplied as a part of this library are * all uniform random number generators which provide a sequence of * random number uniformly distributed over their range. * * A number generator is a function object with an operator() that * takes zero arguments and returns a number. * * A compliant random number generator must satisfy the following * requirements. <table border=1 cellpadding=10 cellspacing=0> * <caption align=top>Random Number Generator Requirements</caption> * <tr><td>To be documented.</td></tr> </table> * * @{ */ /** * @brief A model of a linear congruential random number generator. * * A random number generator that produces pseudorandom numbers via * linear function: * @f[ * x_{i+1}\leftarrow(ax_{i} + c) \bmod m * @f] * * The template parameter @p _UIntType must be an unsigned integral type * large enough to store values up to (__m-1). If the template parameter * @p __m is 0, the modulus @p __m used is * std::numeric_limits<_UIntType>::max() plus 1. Otherwise, the template * parameters @p __a and @p __c must be less than @p __m. * * The size of the state is @f$1@f$. */ template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> class linear_congruential_engine { static_assert(std::is_unsigned<_UIntType>::value, "template argument " "substituting _UIntType not an unsigned integral type"); static_assert(__m == 0u || (__a < __m && __c < __m), "template argument substituting __m out of bounds"); public: /** The type of the generated random value. */ typedef _UIntType result_type; /** The multiplier. */ static constexpr result_type multiplier = __a; /** An increment. */ static constexpr result_type increment = __c; /** The modulus. */ static constexpr result_type modulus = __m; static constexpr result_type default_seed = 1u; /** * @brief Constructs a %linear_congruential_engine random number * generator engine with seed @p __s. The default seed value * is 1. * * @param __s The initial seed value. */ explicit linear_congruential_engine(result_type __s = default_seed) { seed(__s); } /** * @brief Constructs a %linear_congruential_engine random number * generator engine seeded from the seed sequence @p __q. * * @param __q the seed sequence. */ template<typename _Sseq, typename = typename std::enable_if<!std::is_same<_Sseq, linear_congruential_engine>::value> ::type> explicit linear_congruential_engine(_Sseq& __q) { seed(__q); } /** * @brief Reseeds the %linear_congruential_engine random number generator * engine sequence to the seed @p __s. * * @param __s The new seed. */ void seed(result_type __s = default_seed); /** * @brief Reseeds the %linear_congruential_engine random number generator * engine * sequence using values from the seed sequence @p __q. * * @param __q the seed sequence. */ template<typename _Sseq> typename std::enable_if<std::is_class<_Sseq>::value>::type seed(_Sseq& __q); /** * @brief Gets the smallest possible value in the output range. * * The minimum depends on the @p __c parameter: if it is zero, the * minimum generated must be > 0, otherwise 0 is allowed. */ static constexpr result_type min() { return __c == 0u ? 1u : 0u; } /** * @brief Gets the largest possible value in the output range. */ static constexpr result_type max() { return __m - 1u; } /** * @brief Discard a sequence of random numbers. */ void discard(unsigned long long __z) { for (; __z != 0ULL; --__z) (*this)(); } /** * @brief Gets the next random number in the sequence. */ result_type operator()() { _M_x = __detail::__mod<_UIntType, __m, __a, __c>(_M_x); return _M_x; } /** * @brief Compares two linear congruential random number generator * objects of the same type for equality. * * @param __lhs A linear congruential random number generator object. * @param __rhs Another linear congruential random number generator * object. * * @returns true if the infinite sequences of generated values * would be equal, false otherwise. */ friend bool operator==(const linear_congruential_engine& __lhs, const linear_congruential_engine& __rhs) { return __lhs._M_x == __rhs._M_x; } /** * @brief Writes the textual representation of the state x(i) of x to * @p __os. * * @param __os The output stream. * @param __lcr A % linear_congruential_engine random number generator. * @returns __os. */ template<typename _UIntType1, _UIntType1 __a1, _UIntType1 __c1, _UIntType1 __m1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::linear_congruential_engine<_UIntType1, __a1, __c1, __m1>& __lcr); /** * @brief Sets the state of the engine by reading its textual * representation from @p __is. * * The textual representation must have been previously written using * an output stream whose imbued locale and whose type's template * specialization arguments _CharT and _Traits were the same as those * of @p __is. * * @param __is The input stream. * @param __lcr A % linear_congruential_engine random number generator. * @returns __is. */ template<typename _UIntType1, _UIntType1 __a1, _UIntType1 __c1, _UIntType1 __m1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::linear_congruential_engine<_UIntType1, __a1, __c1, __m1>& __lcr); private: _UIntType _M_x; }; /** * @brief Compares two linear congruential random number generator * objects of the same type for inequality. * * @param __lhs A linear congruential random number generator object. * @param __rhs Another linear congruential random number generator * object. * * @returns true if the infinite sequences of generated values * would be different, false otherwise. */ template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> inline bool operator!=(const std::linear_congruential_engine<_UIntType, __a, __c, __m>& __lhs, const std::linear_congruential_engine<_UIntType, __a, __c, __m>& __rhs) { return !(__lhs == __rhs); } /** * A generalized feedback shift register discrete random number generator. * * This algorithm avoids multiplication and division and is designed to be * friendly to a pipelined architecture. If the parameters are chosen * correctly, this generator will produce numbers with a very long period and * fairly good apparent entropy, although still not cryptographically strong. * * The best way to use this generator is with the predefined mt19937 class. * * This algorithm was originally invented by Makoto Matsumoto and * Takuji Nishimura. * * @tparam __w Word size, the number of bits in each element of * the state vector. * @tparam __n The degree of recursion. * @tparam __m The period parameter. * @tparam __r The separation point bit index. * @tparam __a The last row of the twist matrix. * @tparam __u The first right-shift tempering matrix parameter. * @tparam __d The first right-shift tempering matrix mask. * @tparam __s The first left-shift tempering matrix parameter. * @tparam __b The first left-shift tempering matrix mask. * @tparam __t The second left-shift tempering matrix parameter. * @tparam __c The second left-shift tempering matrix mask. * @tparam __l The second right-shift tempering matrix parameter. * @tparam __f Initialization multiplier. */ template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> class mersenne_twister_engine { static_assert(std::is_unsigned<_UIntType>::value, "template argument " "substituting _UIntType not an unsigned integral type"); static_assert(1u <= __m && __m <= __n, "template argument substituting __m out of bounds"); static_assert(__r <= __w, "template argument substituting " "__r out of bound"); static_assert(__u <= __w, "template argument substituting " "__u out of bound"); static_assert(__s <= __w, "template argument substituting " "__s out of bound"); static_assert(__t <= __w, "template argument substituting " "__t out of bound"); static_assert(__l <= __w, "template argument substituting " "__l out of bound"); static_assert(__w <= std::numeric_limits<_UIntType>::digits, "template argument substituting __w out of bound"); static_assert(__a <= (__detail::_Shift<_UIntType, __w>::__value - 1), "template argument substituting __a out of bound"); static_assert(__b <= (__detail::_Shift<_UIntType, __w>::__value - 1), "template argument substituting __b out of bound"); static_assert(__c <= (__detail::_Shift<_UIntType, __w>::__value - 1), "template argument substituting __c out of bound"); static_assert(__d <= (__detail::_Shift<_UIntType, __w>::__value - 1), "template argument substituting __d out of bound"); static_assert(__f <= (__detail::_Shift<_UIntType, __w>::__value - 1), "template argument substituting __f out of bound"); public: /** The type of the generated random value. */ typedef _UIntType result_type; // parameter values static constexpr size_t word_size = __w; static constexpr size_t state_size = __n; static constexpr size_t shift_size = __m; static constexpr size_t mask_bits = __r; static constexpr result_type xor_mask = __a; static constexpr size_t tempering_u = __u; static constexpr result_type tempering_d = __d; static constexpr size_t tempering_s = __s; static constexpr result_type tempering_b = __b; static constexpr size_t tempering_t = __t; static constexpr result_type tempering_c = __c; static constexpr size_t tempering_l = __l; static constexpr result_type initialization_multiplier = __f; static constexpr result_type default_seed = 5489u; // constructors and member function explicit mersenne_twister_engine(result_type __sd = default_seed) { seed(__sd); } /** * @brief Constructs a %mersenne_twister_engine random number generator * engine seeded from the seed sequence @p __q. * * @param __q the seed sequence. */ template<typename _Sseq, typename = typename std::enable_if<!std::is_same<_Sseq, mersenne_twister_engine>::value> ::type> explicit mersenne_twister_engine(_Sseq& __q) { seed(__q); } void seed(result_type __sd = default_seed); template<typename _Sseq> typename std::enable_if<std::is_class<_Sseq>::value>::type seed(_Sseq& __q); /** * @brief Gets the smallest possible value in the output range. */ static constexpr result_type min() { return 0; }; /** * @brief Gets the largest possible value in the output range. */ static constexpr result_type max() { return __detail::_Shift<_UIntType, __w>::__value - 1; } /** * @brief Discard a sequence of random numbers. */ void discard(unsigned long long __z); result_type operator()(); /** * @brief Compares two % mersenne_twister_engine random number generator * objects of the same type for equality. * * @param __lhs A % mersenne_twister_engine random number generator * object. * @param __rhs Another % mersenne_twister_engine random number * generator object. * * @returns true if the infinite sequences of generated values * would be equal, false otherwise. */ friend bool operator==(const mersenne_twister_engine& __lhs, const mersenne_twister_engine& __rhs) { return (std::equal(__lhs._M_x, __lhs._M_x + state_size, __rhs._M_x) && __lhs._M_p == __rhs._M_p); } /** * @brief Inserts the current state of a % mersenne_twister_engine * random number generator engine @p __x into the output stream * @p __os. * * @param __os An output stream. * @param __x A % mersenne_twister_engine random number generator * engine. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _UIntType1, size_t __w1, size_t __n1, size_t __m1, size_t __r1, _UIntType1 __a1, size_t __u1, _UIntType1 __d1, size_t __s1, _UIntType1 __b1, size_t __t1, _UIntType1 __c1, size_t __l1, _UIntType1 __f1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::mersenne_twister_engine<_UIntType1, __w1, __n1, __m1, __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1, __l1, __f1>& __x); /** * @brief Extracts the current state of a % mersenne_twister_engine * random number generator engine @p __x from the input stream * @p __is. * * @param __is An input stream. * @param __x A % mersenne_twister_engine random number generator * engine. * * @returns The input stream with the state of @p __x extracted or in * an error state. */ template<typename _UIntType1, size_t __w1, size_t __n1, size_t __m1, size_t __r1, _UIntType1 __a1, size_t __u1, _UIntType1 __d1, size_t __s1, _UIntType1 __b1, size_t __t1, _UIntType1 __c1, size_t __l1, _UIntType1 __f1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::mersenne_twister_engine<_UIntType1, __w1, __n1, __m1, __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1, __l1, __f1>& __x); private: void _M_gen_rand(); _UIntType _M_x[state_size]; size_t _M_p; }; /** * @brief Compares two % mersenne_twister_engine random number generator * objects of the same type for inequality. * * @param __lhs A % mersenne_twister_engine random number generator * object. * @param __rhs Another % mersenne_twister_engine random number * generator object. * * @returns true if the infinite sequences of generated values * would be different, false otherwise. */ template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> inline bool operator!=(const std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __lhs, const std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __rhs) { return !(__lhs == __rhs); } /** * @brief The Marsaglia-Zaman generator. * * This is a model of a Generalized Fibonacci discrete random number * generator, sometimes referred to as the SWC generator. * * A discrete random number generator that produces pseudorandom * numbers using: * @f[ * x_{i}\leftarrow(x_{i - s} - x_{i - r} - carry_{i-1}) \bmod m * @f] * * The size of the state is @f$r@f$ * and the maximum period of the generator is @f$(m^r - m^s - 1)@f$. * * @var _M_x The state of the generator. This is a ring buffer. * @var _M_carry The carry. * @var _M_p Current index of x(i - r). */ template<typename _UIntType, size_t __w, size_t __s, size_t __r> class subtract_with_carry_engine { static_assert(std::is_unsigned<_UIntType>::value, "template argument " "substituting _UIntType not an unsigned integral type"); static_assert(0u < __s && __s < __r, "template argument substituting __s out of bounds"); static_assert(0u < __w && __w <= std::numeric_limits<_UIntType>::digits, "template argument substituting __w out of bounds"); public: /** The type of the generated random value. */ typedef _UIntType result_type; // parameter values static constexpr size_t word_size = __w; static constexpr size_t short_lag = __s; static constexpr size_t long_lag = __r; static constexpr result_type default_seed = 19780503u; /** * @brief Constructs an explicitly seeded % subtract_with_carry_engine * random number generator. */ explicit subtract_with_carry_engine(result_type __sd = default_seed) { seed(__sd); } /** * @brief Constructs a %subtract_with_carry_engine random number engine * seeded from the seed sequence @p __q. * * @param __q the seed sequence. */ template<typename _Sseq, typename = typename std::enable_if<!std::is_same<_Sseq, subtract_with_carry_engine>::value> ::type> explicit subtract_with_carry_engine(_Sseq& __q) { seed(__q); } /** * @brief Seeds the initial state @f$x_0@f$ of the random number * generator. * * N1688[4.19] modifies this as follows. If @p __value == 0, * sets value to 19780503. In any case, with a linear * congruential generator lcg(i) having parameters @f$ m_{lcg} = * 2147483563, a_{lcg} = 40014, c_{lcg} = 0, and lcg(0) = value * @f$, sets @f$ x_{-r} \dots x_{-1} @f$ to @f$ lcg(1) \bmod m * \dots lcg(r) \bmod m @f$ respectively. If @f$ x_{-1} = 0 @f$ * set carry to 1, otherwise sets carry to 0. */ void seed(result_type __sd = default_seed); /** * @brief Seeds the initial state @f$x_0@f$ of the * % subtract_with_carry_engine random number generator. */ template<typename _Sseq> typename std::enable_if<std::is_class<_Sseq>::value>::type seed(_Sseq& __q); /** * @brief Gets the inclusive minimum value of the range of random * integers returned by this generator. */ static constexpr result_type min() { return 0; } /** * @brief Gets the inclusive maximum value of the range of random * integers returned by this generator. */ static constexpr result_type max() { return __detail::_Shift<_UIntType, __w>::__value - 1; } /** * @brief Discard a sequence of random numbers. */ void discard(unsigned long long __z) { for (; __z != 0ULL; --__z) (*this)(); } /** * @brief Gets the next random number in the sequence. */ result_type operator()(); /** * @brief Compares two % subtract_with_carry_engine random number * generator objects of the same type for equality. * * @param __lhs A % subtract_with_carry_engine random number generator * object. * @param __rhs Another % subtract_with_carry_engine random number * generator object. * * @returns true if the infinite sequences of generated values * would be equal, false otherwise. */ friend bool operator==(const subtract_with_carry_engine& __lhs, const subtract_with_carry_engine& __rhs) { return (std::equal(__lhs._M_x, __lhs._M_x + long_lag, __rhs._M_x) && __lhs._M_carry == __rhs._M_carry && __lhs._M_p == __rhs._M_p); } /** * @brief Inserts the current state of a % subtract_with_carry_engine * random number generator engine @p __x into the output stream * @p __os. * * @param __os An output stream. * @param __x A % subtract_with_carry_engine random number generator * engine. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _UIntType1, size_t __w1, size_t __s1, size_t __r1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>&, const std::subtract_with_carry_engine<_UIntType1, __w1, __s1, __r1>&); /** * @brief Extracts the current state of a % subtract_with_carry_engine * random number generator engine @p __x from the input stream * @p __is. * * @param __is An input stream. * @param __x A % subtract_with_carry_engine random number generator * engine. * * @returns The input stream with the state of @p __x extracted or in * an error state. */ template<typename _UIntType1, size_t __w1, size_t __s1, size_t __r1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>&, std::subtract_with_carry_engine<_UIntType1, __w1, __s1, __r1>&); private: _UIntType _M_x[long_lag]; _UIntType _M_carry; size_t _M_p; }; /** * @brief Compares two % subtract_with_carry_engine random number * generator objects of the same type for inequality. * * @param __lhs A % subtract_with_carry_engine random number generator * object. * @param __rhs Another % subtract_with_carry_engine random number * generator object. * * @returns true if the infinite sequences of generated values * would be different, false otherwise. */ template<typename _UIntType, size_t __w, size_t __s, size_t __r> inline bool operator!=(const std::subtract_with_carry_engine<_UIntType, __w, __s, __r>& __lhs, const std::subtract_with_carry_engine<_UIntType, __w, __s, __r>& __rhs) { return !(__lhs == __rhs); } /** * Produces random numbers from some base engine by discarding blocks of * data. * * 0 <= @p __r <= @p __p */ template<typename _RandomNumberEngine, size_t __p, size_t __r> class discard_block_engine { static_assert(1 <= __r && __r <= __p, "template argument substituting __r out of bounds"); public: /** The type of the generated random value. */ typedef typename _RandomNumberEngine::result_type result_type; // parameter values static constexpr size_t block_size = __p; static constexpr size_t used_block = __r; /** * @brief Constructs a default %discard_block_engine engine. * * The underlying engine is default constructed as well. */ discard_block_engine() : _M_b(), _M_n(0) { } /** * @brief Copy constructs a %discard_block_engine engine. * * Copies an existing base class random number generator. * @param __rng An existing (base class) engine object. */ explicit discard_block_engine(const _RandomNumberEngine& __rng) : _M_b(__rng), _M_n(0) { } /** * @brief Move constructs a %discard_block_engine engine. * * Copies an existing base class random number generator. * @param __rng An existing (base class) engine object. */ explicit discard_block_engine(_RandomNumberEngine&& __rng) : _M_b(std::move(__rng)), _M_n(0) { } /** * @brief Seed constructs a %discard_block_engine engine. * * Constructs the underlying generator engine seeded with @p __s. * @param __s A seed value for the base class engine. */ explicit discard_block_engine(result_type __s) : _M_b(__s), _M_n(0) { } /** * @brief Generator construct a %discard_block_engine engine. * * @param __q A seed sequence. */ template<typename _Sseq, typename = typename std::enable_if<!std::is_same<_Sseq, discard_block_engine>::value && !std::is_same<_Sseq, _RandomNumberEngine>::value> ::type> explicit discard_block_engine(_Sseq& __q) : _M_b(__q), _M_n(0) { } /** * @brief Reseeds the %discard_block_engine object with the default * seed for the underlying base class generator engine. */ void seed() { _M_b.seed(); _M_n = 0; } /** * @brief Reseeds the %discard_block_engine object with the default * seed for the underlying base class generator engine. */ void seed(result_type __s) { _M_b.seed(__s); _M_n = 0; } /** * @brief Reseeds the %discard_block_engine object with the given seed * sequence. * @param __q A seed generator function. */ template<typename _Sseq> void seed(_Sseq& __q) { _M_b.seed(__q); _M_n = 0; } /** * @brief Gets a const reference to the underlying generator engine * object. */ const _RandomNumberEngine& base() const noexcept { return _M_b; } /** * @brief Gets the minimum value in the generated random number range. */ static constexpr result_type min() { return _RandomNumberEngine::min(); } /** * @brief Gets the maximum value in the generated random number range. */ static constexpr result_type max() { return _RandomNumberEngine::max(); } /** * @brief Discard a sequence of random numbers. */ void discard(unsigned long long __z) { for (; __z != 0ULL; --__z) (*this)(); } /** * @brief Gets the next value in the generated random number sequence. */ result_type operator()(); /** * @brief Compares two %discard_block_engine random number generator * objects of the same type for equality. * * @param __lhs A %discard_block_engine random number generator object. * @param __rhs Another %discard_block_engine random number generator * object. * * @returns true if the infinite sequences of generated values * would be equal, false otherwise. */ friend bool operator==(const discard_block_engine& __lhs, const discard_block_engine& __rhs) { return __lhs._M_b == __rhs._M_b && __lhs._M_n == __rhs._M_n; } /** * @brief Inserts the current state of a %discard_block_engine random * number generator engine @p __x into the output stream * @p __os. * * @param __os An output stream. * @param __x A %discard_block_engine random number generator engine. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RandomNumberEngine1, size_t __p1, size_t __r1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::discard_block_engine<_RandomNumberEngine1, __p1, __r1>& __x); /** * @brief Extracts the current state of a % subtract_with_carry_engine * random number generator engine @p __x from the input stream * @p __is. * * @param __is An input stream. * @param __x A %discard_block_engine random number generator engine. * * @returns The input stream with the state of @p __x extracted or in * an error state. */ template<typename _RandomNumberEngine1, size_t __p1, size_t __r1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::discard_block_engine<_RandomNumberEngine1, __p1, __r1>& __x); private: _RandomNumberEngine _M_b; size_t _M_n; }; /** * @brief Compares two %discard_block_engine random number generator * objects of the same type for inequality. * * @param __lhs A %discard_block_engine random number generator object. * @param __rhs Another %discard_block_engine random number generator * object. * * @returns true if the infinite sequences of generated values * would be different, false otherwise. */ template<typename _RandomNumberEngine, size_t __p, size_t __r> inline bool operator!=(const std::discard_block_engine<_RandomNumberEngine, __p, __r>& __lhs, const std::discard_block_engine<_RandomNumberEngine, __p, __r>& __rhs) { return !(__lhs == __rhs); } /** * Produces random numbers by combining random numbers from some base * engine to produce random numbers with a specifies number of bits @p __w. */ template<typename _RandomNumberEngine, size_t __w, typename _UIntType> class independent_bits_engine { static_assert(std::is_unsigned<_UIntType>::value, "template argument " "substituting _UIntType not an unsigned integral type"); static_assert(0u < __w && __w <= std::numeric_limits<_UIntType>::digits, "template argument substituting __w out of bounds"); public: /** The type of the generated random value. */ typedef _UIntType result_type; /** * @brief Constructs a default %independent_bits_engine engine. * * The underlying engine is default constructed as well. */ independent_bits_engine() : _M_b() { } /** * @brief Copy constructs a %independent_bits_engine engine. * * Copies an existing base class random number generator. * @param __rng An existing (base class) engine object. */ explicit independent_bits_engine(const _RandomNumberEngine& __rng) : _M_b(__rng) { } /** * @brief Move constructs a %independent_bits_engine engine. * * Copies an existing base class random number generator. * @param __rng An existing (base class) engine object. */ explicit independent_bits_engine(_RandomNumberEngine&& __rng) : _M_b(std::move(__rng)) { } /** * @brief Seed constructs a %independent_bits_engine engine. * * Constructs the underlying generator engine seeded with @p __s. * @param __s A seed value for the base class engine. */ explicit independent_bits_engine(result_type __s) : _M_b(__s) { } /** * @brief Generator construct a %independent_bits_engine engine. * * @param __q A seed sequence. */ template<typename _Sseq, typename = typename std::enable_if<!std::is_same<_Sseq, independent_bits_engine>::value && !std::is_same<_Sseq, _RandomNumberEngine>::value> ::type> explicit independent_bits_engine(_Sseq& __q) : _M_b(__q) { } /** * @brief Reseeds the %independent_bits_engine object with the default * seed for the underlying base class generator engine. */ void seed() { _M_b.seed(); } /** * @brief Reseeds the %independent_bits_engine object with the default * seed for the underlying base class generator engine. */ void seed(result_type __s) { _M_b.seed(__s); } /** * @brief Reseeds the %independent_bits_engine object with the given * seed sequence. * @param __q A seed generator function. */ template<typename _Sseq> void seed(_Sseq& __q) { _M_b.seed(__q); } /** * @brief Gets a const reference to the underlying generator engine * object. */ const _RandomNumberEngine& base() const noexcept { return _M_b; } /** * @brief Gets the minimum value in the generated random number range. */ static constexpr result_type min() { return 0U; } /** * @brief Gets the maximum value in the generated random number range. */ static constexpr result_type max() { return __detail::_Shift<_UIntType, __w>::__value - 1; } /** * @brief Discard a sequence of random numbers. */ void discard(unsigned long long __z) { for (; __z != 0ULL; --__z) (*this)(); } /** * @brief Gets the next value in the generated random number sequence. */ result_type operator()(); /** * @brief Compares two %independent_bits_engine random number generator * objects of the same type for equality. * * @param __lhs A %independent_bits_engine random number generator * object. * @param __rhs Another %independent_bits_engine random number generator * object. * * @returns true if the infinite sequences of generated values * would be equal, false otherwise. */ friend bool operator==(const independent_bits_engine& __lhs, const independent_bits_engine& __rhs) { return __lhs._M_b == __rhs._M_b; } /** * @brief Extracts the current state of a % subtract_with_carry_engine * random number generator engine @p __x from the input stream * @p __is. * * @param __is An input stream. * @param __x A %independent_bits_engine random number generator * engine. * * @returns The input stream with the state of @p __x extracted or in * an error state. */ template<typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::independent_bits_engine<_RandomNumberEngine, __w, _UIntType>& __x) { __is >> __x._M_b; return __is; } private: _RandomNumberEngine _M_b; }; /** * @brief Compares two %independent_bits_engine random number generator * objects of the same type for inequality. * * @param __lhs A %independent_bits_engine random number generator * object. * @param __rhs Another %independent_bits_engine random number generator * object. * * @returns true if the infinite sequences of generated values * would be different, false otherwise. */ template<typename _RandomNumberEngine, size_t __w, typename _UIntType> inline bool operator!=(const std::independent_bits_engine<_RandomNumberEngine, __w, _UIntType>& __lhs, const std::independent_bits_engine<_RandomNumberEngine, __w, _UIntType>& __rhs) { return !(__lhs == __rhs); } /** * @brief Inserts the current state of a %independent_bits_engine random * number generator engine @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %independent_bits_engine random number generator engine. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RandomNumberEngine, size_t __w, typename _UIntType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::independent_bits_engine<_RandomNumberEngine, __w, _UIntType>& __x) { __os << __x.base(); return __os; } /** * @brief Produces random numbers by combining random numbers from some * base engine to produce random numbers with a specifies number of bits * @p __w. */ template<typename _RandomNumberEngine, size_t __k> class shuffle_order_engine { static_assert(1u <= __k, "template argument substituting " "__k out of bound"); public: /** The type of the generated random value. */ typedef typename _RandomNumberEngine::result_type result_type; static constexpr size_t table_size = __k; /** * @brief Constructs a default %shuffle_order_engine engine. * * The underlying engine is default constructed as well. */ shuffle_order_engine() : _M_b() { _M_initialize(); } /** * @brief Copy constructs a %shuffle_order_engine engine. * * Copies an existing base class random number generator. * @param __rng An existing (base class) engine object. */ explicit shuffle_order_engine(const _RandomNumberEngine& __rng) : _M_b(__rng) { _M_initialize(); } /** * @brief Move constructs a %shuffle_order_engine engine. * * Copies an existing base class random number generator. * @param __rng An existing (base class) engine object. */ explicit shuffle_order_engine(_RandomNumberEngine&& __rng) : _M_b(std::move(__rng)) { _M_initialize(); } /** * @brief Seed constructs a %shuffle_order_engine engine. * * Constructs the underlying generator engine seeded with @p __s. * @param __s A seed value for the base class engine. */ explicit shuffle_order_engine(result_type __s) : _M_b(__s) { _M_initialize(); } /** * @brief Generator construct a %shuffle_order_engine engine. * * @param __q A seed sequence. */ template<typename _Sseq, typename = typename std::enable_if<!std::is_same<_Sseq, shuffle_order_engine>::value && !std::is_same<_Sseq, _RandomNumberEngine>::value> ::type> explicit shuffle_order_engine(_Sseq& __q) : _M_b(__q) { _M_initialize(); } /** * @brief Reseeds the %shuffle_order_engine object with the default seed for the underlying base class generator engine. */ void seed() { _M_b.seed(); _M_initialize(); } /** * @brief Reseeds the %shuffle_order_engine object with the default seed * for the underlying base class generator engine. */ void seed(result_type __s) { _M_b.seed(__s); _M_initialize(); } /** * @brief Reseeds the %shuffle_order_engine object with the given seed * sequence. * @param __q A seed generator function. */ template<typename _Sseq> void seed(_Sseq& __q) { _M_b.seed(__q); _M_initialize(); } /** * Gets a const reference to the underlying generator engine object. */ const _RandomNumberEngine& base() const noexcept { return _M_b; } /** * Gets the minimum value in the generated random number range. */ static constexpr result_type min() { return _RandomNumberEngine::min(); } /** * Gets the maximum value in the generated random number range. */ static constexpr result_type max() { return _RandomNumberEngine::max(); } /** * Discard a sequence of random numbers. */ void discard(unsigned long long __z) { for (; __z != 0ULL; --__z) (*this)(); } /** * Gets the next value in the generated random number sequence. */ result_type operator()(); /** * Compares two %shuffle_order_engine random number generator objects * of the same type for equality. * * @param __lhs A %shuffle_order_engine random number generator object. * @param __rhs Another %shuffle_order_engine random number generator * object. * * @returns true if the infinite sequences of generated values * would be equal, false otherwise. */ friend bool operator==(const shuffle_order_engine& __lhs, const shuffle_order_engine& __rhs) { return (__lhs._M_b == __rhs._M_b && std::equal(__lhs._M_v, __lhs._M_v + __k, __rhs._M_v) && __lhs._M_y == __rhs._M_y); } /** * @brief Inserts the current state of a %shuffle_order_engine random * number generator engine @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %shuffle_order_engine random number generator engine. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RandomNumberEngine1, size_t __k1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::shuffle_order_engine<_RandomNumberEngine1, __k1>& __x); /** * @brief Extracts the current state of a % subtract_with_carry_engine * random number generator engine @p __x from the input stream * @p __is. * * @param __is An input stream. * @param __x A %shuffle_order_engine random number generator engine. * * @returns The input stream with the state of @p __x extracted or in * an error state. */ template<typename _RandomNumberEngine1, size_t __k1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::shuffle_order_engine<_RandomNumberEngine1, __k1>& __x); private: void _M_initialize() { for (size_t __i = 0; __i < __k; ++__i) _M_v[__i] = _M_b(); _M_y = _M_b(); } _RandomNumberEngine _M_b; result_type _M_v[__k]; result_type _M_y; }; /** * Compares two %shuffle_order_engine random number generator objects * of the same type for inequality. * * @param __lhs A %shuffle_order_engine random number generator object. * @param __rhs Another %shuffle_order_engine random number generator * object. * * @returns true if the infinite sequences of generated values * would be different, false otherwise. */ template<typename _RandomNumberEngine, size_t __k> inline bool operator!=(const std::shuffle_order_engine<_RandomNumberEngine, __k>& __lhs, const std::shuffle_order_engine<_RandomNumberEngine, __k>& __rhs) { return !(__lhs == __rhs); } /** * The classic Minimum Standard rand0 of Lewis, Goodman, and Miller. */ typedef linear_congruential_engine<uint_fast32_t, 16807UL, 0UL, 2147483647UL> minstd_rand0; /** * An alternative LCR (Lehmer Generator function). */ typedef linear_congruential_engine<uint_fast32_t, 48271UL, 0UL, 2147483647UL> minstd_rand; /** * The classic Mersenne Twister. * * Reference: * M. Matsumoto and T. Nishimura, Mersenne Twister: A 623-Dimensionally * Equidistributed Uniform Pseudo-Random Number Generator, ACM Transactions * on Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30. */ typedef mersenne_twister_engine< uint_fast32_t, 32, 624, 397, 31, 0x9908b0dfUL, 11, 0xffffffffUL, 7, 0x9d2c5680UL, 15, 0xefc60000UL, 18, 1812433253UL> mt19937; /** * An alternative Mersenne Twister. */ typedef mersenne_twister_engine< uint_fast64_t, 64, 312, 156, 31, 0xb5026f5aa96619e9ULL, 29, 0x5555555555555555ULL, 17, 0x71d67fffeda60000ULL, 37, 0xfff7eee000000000ULL, 43, 6364136223846793005ULL> mt19937_64; typedef subtract_with_carry_engine<uint_fast32_t, 24, 10, 24> ranlux24_base; typedef subtract_with_carry_engine<uint_fast64_t, 48, 5, 12> ranlux48_base; typedef discard_block_engine<ranlux24_base, 223, 23> ranlux24; typedef discard_block_engine<ranlux48_base, 389, 11> ranlux48; typedef shuffle_order_engine<minstd_rand0, 256> knuth_b; typedef minstd_rand0 default_random_engine; /** * A standard interface to a platform-specific non-deterministic * random number generator (if any are available). */ class random_device { public: /** The type of the generated random value. */ typedef unsigned int result_type; // constructors, destructors and member functions #ifdef _GLIBCXX_USE_RANDOM_TR1 explicit random_device(const std::string& __token = "default") { _M_init(__token); } ~random_device() { _M_fini(); } #else explicit random_device(const std::string& __token = "mt19937") { _M_init_pretr1(__token); } public: #endif static constexpr result_type min() { return std::numeric_limits<result_type>::min(); } static constexpr result_type max() { return std::numeric_limits<result_type>::max(); } double entropy() const noexcept { return 0.0; } result_type operator()() { #ifdef _GLIBCXX_USE_RANDOM_TR1 return this->_M_getval(); #else return this->_M_getval_pretr1(); #endif } // No copy functions. random_device(const random_device&) = delete; void operator=(const random_device&) = delete; private: void _M_init(const std::string& __token); void _M_init_pretr1(const std::string& __token); void _M_fini(); result_type _M_getval(); result_type _M_getval_pretr1(); union { FILE* _M_file; mt19937 _M_mt; }; }; /* @} */ // group random_generators /** * @addtogroup random_distributions Random Number Distributions * @ingroup random * @{ */ /** * @addtogroup random_distributions_uniform Uniform Distributions * @ingroup random_distributions * @{ */ /** * @brief Uniform discrete distribution for random numbers. * A discrete random distribution on the range @f$[min, max]@f$ with equal * probability throughout the range. */ template<typename _IntType = int> class uniform_int_distribution { static_assert(std::is_integral<_IntType>::value, "template argument not an integral type"); public: /** The type of the range of the distribution. */ typedef _IntType result_type; /** Parameter type. */ struct param_type { typedef uniform_int_distribution<_IntType> distribution_type; explicit param_type(_IntType __a = 0, _IntType __b = std::numeric_limits<_IntType>::max()) : _M_a(__a), _M_b(__b) { _GLIBCXX_DEBUG_ASSERT(_M_a <= _M_b); } result_type a() const { return _M_a; } result_type b() const { return _M_b; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; } private: _IntType _M_a; _IntType _M_b; }; public: /** * @brief Constructs a uniform distribution object. */ explicit uniform_int_distribution(_IntType __a = 0, _IntType __b = std::numeric_limits<_IntType>::max()) : _M_param(__a, __b) { } explicit uniform_int_distribution(const param_type& __p) : _M_param(__p) { } /** * @brief Resets the distribution state. * * Does nothing for the uniform integer distribution. */ void reset() { } result_type a() const { return _M_param.a(); } result_type b() const { return _M_param.b(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the inclusive lower bound of the distribution range. */ result_type min() const { return this->a(); } /** * @brief Returns the inclusive upper bound of the distribution range. */ result_type max() const { return this->b(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two uniform integer distributions have * the same parameters. */ friend bool operator==(const uniform_int_distribution& __d1, const uniform_int_distribution& __d2) { return __d1._M_param == __d2._M_param; } private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; }; /** * @brief Return true if two uniform integer distributions have * different parameters. */ template<typename _IntType> inline bool operator!=(const std::uniform_int_distribution<_IntType>& __d1, const std::uniform_int_distribution<_IntType>& __d2) { return !(__d1 == __d2); } /** * @brief Inserts a %uniform_int_distribution random number * distribution @p __x into the output stream @p os. * * @param __os An output stream. * @param __x A %uniform_int_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _IntType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>&, const std::uniform_int_distribution<_IntType>&); /** * @brief Extracts a %uniform_int_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %uniform_int_distribution random number generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _IntType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>&, std::uniform_int_distribution<_IntType>&); /** * @brief Uniform continuous distribution for random numbers. * * A continuous random distribution on the range [min, max) with equal * probability throughout the range. The URNG should be real-valued and * deliver number in the range [0, 1). */ template<typename _RealType = double> class uniform_real_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef uniform_real_distribution<_RealType> distribution_type; explicit param_type(_RealType __a = _RealType(0), _RealType __b = _RealType(1)) : _M_a(__a), _M_b(__b) { _GLIBCXX_DEBUG_ASSERT(_M_a <= _M_b); } result_type a() const { return _M_a; } result_type b() const { return _M_b; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; } private: _RealType _M_a; _RealType _M_b; }; public: /** * @brief Constructs a uniform_real_distribution object. * * @param __a [IN] The lower bound of the distribution. * @param __b [IN] The upper bound of the distribution. */ explicit uniform_real_distribution(_RealType __a = _RealType(0), _RealType __b = _RealType(1)) : _M_param(__a, __b) { } explicit uniform_real_distribution(const param_type& __p) : _M_param(__p) { } /** * @brief Resets the distribution state. * * Does nothing for the uniform real distribution. */ void reset() { } result_type a() const { return _M_param.a(); } result_type b() const { return _M_param.b(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the inclusive lower bound of the distribution range. */ result_type min() const { return this->a(); } /** * @brief Returns the inclusive upper bound of the distribution range. */ result_type max() const { return this->b(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); return (__aurng() * (__p.b() - __p.a())) + __p.a(); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two uniform real distributions have * the same parameters. */ friend bool operator==(const uniform_real_distribution& __d1, const uniform_real_distribution& __d2) { return __d1._M_param == __d2._M_param; } private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; }; /** * @brief Return true if two uniform real distributions have * different parameters. */ template<typename _IntType> inline bool operator!=(const std::uniform_real_distribution<_IntType>& __d1, const std::uniform_real_distribution<_IntType>& __d2) { return !(__d1 == __d2); } /** * @brief Inserts a %uniform_real_distribution random number * distribution @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %uniform_real_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>&, const std::uniform_real_distribution<_RealType>&); /** * @brief Extracts a %uniform_real_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %uniform_real_distribution random number generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>&, std::uniform_real_distribution<_RealType>&); /* @} */ // group random_distributions_uniform /** * @addtogroup random_distributions_normal Normal Distributions * @ingroup random_distributions * @{ */ /** * @brief A normal continuous distribution for random numbers. * * The formula for the normal probability density function is * @f[ * p(x|\mu,\sigma) = \frac{1}{\sigma \sqrt{2 \pi}} * e^{- \frac{{x - \mu}^ {2}}{2 \sigma ^ {2}} } * @f] */ template<typename _RealType = double> class normal_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef normal_distribution<_RealType> distribution_type; explicit param_type(_RealType __mean = _RealType(0), _RealType __stddev = _RealType(1)) : _M_mean(__mean), _M_stddev(__stddev) { _GLIBCXX_DEBUG_ASSERT(_M_stddev > _RealType(0)); } _RealType mean() const { return _M_mean; } _RealType stddev() const { return _M_stddev; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return (__p1._M_mean == __p2._M_mean && __p1._M_stddev == __p2._M_stddev); } private: _RealType _M_mean; _RealType _M_stddev; }; public: /** * Constructs a normal distribution with parameters @f$mean@f$ and * standard deviation. */ explicit normal_distribution(result_type __mean = result_type(0), result_type __stddev = result_type(1)) : _M_param(__mean, __stddev), _M_saved_available(false) { } explicit normal_distribution(const param_type& __p) : _M_param(__p), _M_saved_available(false) { } /** * @brief Resets the distribution state. */ void reset() { _M_saved_available = false; } /** * @brief Returns the mean of the distribution. */ _RealType mean() const { return _M_param.mean(); } /** * @brief Returns the standard deviation of the distribution. */ _RealType stddev() const { return _M_param.stddev(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return std::numeric_limits<result_type>::lowest(); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return std::numeric_limits<result_type>::max(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two normal distributions have * the same parameters and the sequences that would * be generated are equal. */ template<typename _RealType1> friend bool operator==(const std::normal_distribution<_RealType1>& __d1, const std::normal_distribution<_RealType1>& __d2); /** * @brief Inserts a %normal_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %normal_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::normal_distribution<_RealType1>& __x); /** * @brief Extracts a %normal_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %normal_distribution random number generator engine. * * @returns The input stream with @p __x extracted or in an error * state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::normal_distribution<_RealType1>& __x); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; result_type _M_saved; bool _M_saved_available; }; /** * @brief Return true if two normal distributions are different. */ template<typename _RealType> inline bool operator!=(const std::normal_distribution<_RealType>& __d1, const std::normal_distribution<_RealType>& __d2) { return !(__d1 == __d2); } /** * @brief A lognormal_distribution random number distribution. * * The formula for the normal probability mass function is * @f[ * p(x|m,s) = \frac{1}{sx\sqrt{2\pi}} * \exp{-\frac{(\ln{x} - m)^2}{2s^2}} * @f] */ template<typename _RealType = double> class lognormal_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef lognormal_distribution<_RealType> distribution_type; explicit param_type(_RealType __m = _RealType(0), _RealType __s = _RealType(1)) : _M_m(__m), _M_s(__s) { } _RealType m() const { return _M_m; } _RealType s() const { return _M_s; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_m == __p2._M_m && __p1._M_s == __p2._M_s; } private: _RealType _M_m; _RealType _M_s; }; explicit lognormal_distribution(_RealType __m = _RealType(0), _RealType __s = _RealType(1)) : _M_param(__m, __s), _M_nd() { } explicit lognormal_distribution(const param_type& __p) : _M_param(__p), _M_nd() { } /** * Resets the distribution state. */ void reset() { _M_nd.reset(); } /** * */ _RealType m() const { return _M_param.m(); } _RealType s() const { return _M_param.s(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return result_type(0); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return std::numeric_limits<result_type>::max(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { return std::exp(__p.s() * _M_nd(__urng) + __p.m()); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two lognormal distributions have * the same parameters and the sequences that would * be generated are equal. */ friend bool operator==(const lognormal_distribution& __d1, const lognormal_distribution& __d2) { return (__d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd); } /** * @brief Inserts a %lognormal_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %lognormal_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::lognormal_distribution<_RealType1>& __x); /** * @brief Extracts a %lognormal_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %lognormal_distribution random number * generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::lognormal_distribution<_RealType1>& __x); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; std::normal_distribution<result_type> _M_nd; }; /** * @brief Return true if two lognormal distributions are different. */ template<typename _RealType> inline bool operator!=(const std::lognormal_distribution<_RealType>& __d1, const std::lognormal_distribution<_RealType>& __d2) { return !(__d1 == __d2); } /** * @brief A gamma continuous distribution for random numbers. * * The formula for the gamma probability density function is: * @f[ * p(x|\alpha,\beta) = \frac{1}{\beta\Gamma(\alpha)} * (x/\beta)^{\alpha - 1} e^{-x/\beta} * @f] */ template<typename _RealType = double> class gamma_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef gamma_distribution<_RealType> distribution_type; friend class gamma_distribution<_RealType>; explicit param_type(_RealType __alpha_val = _RealType(1), _RealType __beta_val = _RealType(1)) : _M_alpha(__alpha_val), _M_beta(__beta_val) { _GLIBCXX_DEBUG_ASSERT(_M_alpha > _RealType(0)); _M_initialize(); } _RealType alpha() const { return _M_alpha; } _RealType beta() const { return _M_beta; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return (__p1._M_alpha == __p2._M_alpha && __p1._M_beta == __p2._M_beta); } private: void _M_initialize(); _RealType _M_alpha; _RealType _M_beta; _RealType _M_malpha, _M_a2; }; public: /** * @brief Constructs a gamma distribution with parameters * @f$\alpha@f$ and @f$\beta@f$. */ explicit gamma_distribution(_RealType __alpha_val = _RealType(1), _RealType __beta_val = _RealType(1)) : _M_param(__alpha_val, __beta_val), _M_nd() { } explicit gamma_distribution(const param_type& __p) : _M_param(__p), _M_nd() { } /** * @brief Resets the distribution state. */ void reset() { _M_nd.reset(); } /** * @brief Returns the @f$\alpha@f$ of the distribution. */ _RealType alpha() const { return _M_param.alpha(); } /** * @brief Returns the @f$\beta@f$ of the distribution. */ _RealType beta() const { return _M_param.beta(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return result_type(0); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return std::numeric_limits<result_type>::max(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two gamma distributions have the same * parameters and the sequences that would be generated * are equal. */ friend bool operator==(const gamma_distribution& __d1, const gamma_distribution& __d2) { return (__d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd); } /** * @brief Inserts a %gamma_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %gamma_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::gamma_distribution<_RealType1>& __x); /** * @brief Extracts a %gamma_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %gamma_distribution random number generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::gamma_distribution<_RealType1>& __x); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; std::normal_distribution<result_type> _M_nd; }; /** * @brief Return true if two gamma distributions are different. */ template<typename _RealType> inline bool operator!=(const std::gamma_distribution<_RealType>& __d1, const std::gamma_distribution<_RealType>& __d2) { return !(__d1 == __d2); } /** * @brief A chi_squared_distribution random number distribution. * * The formula for the normal probability mass function is * @f$p(x|n) = \frac{x^{(n/2) - 1}e^{-x/2}}{\Gamma(n/2) 2^{n/2}}@f$ */ template<typename _RealType = double> class chi_squared_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef chi_squared_distribution<_RealType> distribution_type; explicit param_type(_RealType __n = _RealType(1)) : _M_n(__n) { } _RealType n() const { return _M_n; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_n == __p2._M_n; } private: _RealType _M_n; }; explicit chi_squared_distribution(_RealType __n = _RealType(1)) : _M_param(__n), _M_gd(__n / 2) { } explicit chi_squared_distribution(const param_type& __p) : _M_param(__p), _M_gd(__p.n() / 2) { } /** * @brief Resets the distribution state. */ void reset() { _M_gd.reset(); } /** * */ _RealType n() const { return _M_param.n(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return result_type(0); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return std::numeric_limits<result_type>::max(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return 2 * _M_gd(__urng); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { typedef typename std::gamma_distribution<result_type>::param_type param_type; return 2 * _M_gd(__urng, param_type(__p.n() / 2)); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate_impl(__f, __t, __urng); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { typename std::gamma_distribution<result_type>::param_type __p2(__p.n() / 2); this->__generate_impl(__f, __t, __urng, __p2); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng) { this->__generate_impl(__f, __t, __urng); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { typename std::gamma_distribution<result_type>::param_type __p2(__p.n() / 2); this->__generate_impl(__f, __t, __urng, __p2); } /** * @brief Return true if two Chi-squared distributions have * the same parameters and the sequences that would be * generated are equal. */ friend bool operator==(const chi_squared_distribution& __d1, const chi_squared_distribution& __d2) { return __d1._M_param == __d2._M_param && __d1._M_gd == __d2._M_gd; } /** * @brief Inserts a %chi_squared_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %chi_squared_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::chi_squared_distribution<_RealType1>& __x); /** * @brief Extracts a %chi_squared_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %chi_squared_distribution random number * generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::chi_squared_distribution<_RealType1>& __x); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const typename std::gamma_distribution<result_type>::param_type& __p); param_type _M_param; std::gamma_distribution<result_type> _M_gd; }; /** * @brief Return true if two Chi-squared distributions are different. */ template<typename _RealType> inline bool operator!=(const std::chi_squared_distribution<_RealType>& __d1, const std::chi_squared_distribution<_RealType>& __d2) { return !(__d1 == __d2); } /** * @brief A cauchy_distribution random number distribution. * * The formula for the normal probability mass function is * @f$p(x|a,b) = (\pi b (1 + (\frac{x-a}{b})^2))^{-1}@f$ */ template<typename _RealType = double> class cauchy_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef cauchy_distribution<_RealType> distribution_type; explicit param_type(_RealType __a = _RealType(0), _RealType __b = _RealType(1)) : _M_a(__a), _M_b(__b) { } _RealType a() const { return _M_a; } _RealType b() const { return _M_b; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; } private: _RealType _M_a; _RealType _M_b; }; explicit cauchy_distribution(_RealType __a = _RealType(0), _RealType __b = _RealType(1)) : _M_param(__a, __b) { } explicit cauchy_distribution(const param_type& __p) : _M_param(__p) { } /** * @brief Resets the distribution state. */ void reset() { } /** * */ _RealType a() const { return _M_param.a(); } _RealType b() const { return _M_param.b(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return std::numeric_limits<result_type>::lowest(); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return std::numeric_limits<result_type>::max(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two Cauchy distributions have * the same parameters. */ friend bool operator==(const cauchy_distribution& __d1, const cauchy_distribution& __d2) { return __d1._M_param == __d2._M_param; } private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; }; /** * @brief Return true if two Cauchy distributions have * different parameters. */ template<typename _RealType> inline bool operator!=(const std::cauchy_distribution<_RealType>& __d1, const std::cauchy_distribution<_RealType>& __d2) { return !(__d1 == __d2); } /** * @brief Inserts a %cauchy_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %cauchy_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::cauchy_distribution<_RealType>& __x); /** * @brief Extracts a %cauchy_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %cauchy_distribution random number * generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::cauchy_distribution<_RealType>& __x); /** * @brief A fisher_f_distribution random number distribution. * * The formula for the normal probability mass function is * @f[ * p(x|m,n) = \frac{\Gamma((m+n)/2)}{\Gamma(m/2)\Gamma(n/2)} * (\frac{m}{n})^{m/2} x^{(m/2)-1} * (1 + \frac{mx}{n})^{-(m+n)/2} * @f] */ template<typename _RealType = double> class fisher_f_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef fisher_f_distribution<_RealType> distribution_type; explicit param_type(_RealType __m = _RealType(1), _RealType __n = _RealType(1)) : _M_m(__m), _M_n(__n) { } _RealType m() const { return _M_m; } _RealType n() const { return _M_n; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_m == __p2._M_m && __p1._M_n == __p2._M_n; } private: _RealType _M_m; _RealType _M_n; }; explicit fisher_f_distribution(_RealType __m = _RealType(1), _RealType __n = _RealType(1)) : _M_param(__m, __n), _M_gd_x(__m / 2), _M_gd_y(__n / 2) { } explicit fisher_f_distribution(const param_type& __p) : _M_param(__p), _M_gd_x(__p.m() / 2), _M_gd_y(__p.n() / 2) { } /** * @brief Resets the distribution state. */ void reset() { _M_gd_x.reset(); _M_gd_y.reset(); } /** * */ _RealType m() const { return _M_param.m(); } _RealType n() const { return _M_param.n(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return result_type(0); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return std::numeric_limits<result_type>::max(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return (_M_gd_x(__urng) * n()) / (_M_gd_y(__urng) * m()); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { typedef typename std::gamma_distribution<result_type>::param_type param_type; return ((_M_gd_x(__urng, param_type(__p.m() / 2)) * n()) / (_M_gd_y(__urng, param_type(__p.n() / 2)) * m())); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate_impl(__f, __t, __urng); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng) { this->__generate_impl(__f, __t, __urng); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two Fisher f distributions have * the same parameters and the sequences that would * be generated are equal. */ friend bool operator==(const fisher_f_distribution& __d1, const fisher_f_distribution& __d2) { return (__d1._M_param == __d2._M_param && __d1._M_gd_x == __d2._M_gd_x && __d1._M_gd_y == __d2._M_gd_y); } /** * @brief Inserts a %fisher_f_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %fisher_f_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::fisher_f_distribution<_RealType1>& __x); /** * @brief Extracts a %fisher_f_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %fisher_f_distribution random number * generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::fisher_f_distribution<_RealType1>& __x); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; std::gamma_distribution<result_type> _M_gd_x, _M_gd_y; }; /** * @brief Return true if two Fisher f distributions are diferent. */ template<typename _RealType> inline bool operator!=(const std::fisher_f_distribution<_RealType>& __d1, const std::fisher_f_distribution<_RealType>& __d2) { return !(__d1 == __d2); } /** * @brief A student_t_distribution random number distribution. * * The formula for the normal probability mass function is: * @f[ * p(x|n) = \frac{1}{\sqrt(n\pi)} \frac{\Gamma((n+1)/2)}{\Gamma(n/2)} * (1 + \frac{x^2}{n}) ^{-(n+1)/2} * @f] */ template<typename _RealType = double> class student_t_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef student_t_distribution<_RealType> distribution_type; explicit param_type(_RealType __n = _RealType(1)) : _M_n(__n) { } _RealType n() const { return _M_n; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_n == __p2._M_n; } private: _RealType _M_n; }; explicit student_t_distribution(_RealType __n = _RealType(1)) : _M_param(__n), _M_nd(), _M_gd(__n / 2, 2) { } explicit student_t_distribution(const param_type& __p) : _M_param(__p), _M_nd(), _M_gd(__p.n() / 2, 2) { } /** * @brief Resets the distribution state. */ void reset() { _M_nd.reset(); _M_gd.reset(); } /** * */ _RealType n() const { return _M_param.n(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return std::numeric_limits<result_type>::lowest(); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return std::numeric_limits<result_type>::max(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return _M_nd(__urng) * std::sqrt(n() / _M_gd(__urng)); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { typedef typename std::gamma_distribution<result_type>::param_type param_type; const result_type __g = _M_gd(__urng, param_type(__p.n() / 2, 2)); return _M_nd(__urng) * std::sqrt(__p.n() / __g); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate_impl(__f, __t, __urng); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng) { this->__generate_impl(__f, __t, __urng); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two Student t distributions have * the same parameters and the sequences that would * be generated are equal. */ friend bool operator==(const student_t_distribution& __d1, const student_t_distribution& __d2) { return (__d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd && __d1._M_gd == __d2._M_gd); } /** * @brief Inserts a %student_t_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %student_t_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::student_t_distribution<_RealType1>& __x); /** * @brief Extracts a %student_t_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %student_t_distribution random number * generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::student_t_distribution<_RealType1>& __x); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; std::normal_distribution<result_type> _M_nd; std::gamma_distribution<result_type> _M_gd; }; /** * @brief Return true if two Student t distributions are different. */ template<typename _RealType> inline bool operator!=(const std::student_t_distribution<_RealType>& __d1, const std::student_t_distribution<_RealType>& __d2) { return !(__d1 == __d2); } /* @} */ // group random_distributions_normal /** * @addtogroup random_distributions_bernoulli Bernoulli Distributions * @ingroup random_distributions * @{ */ /** * @brief A Bernoulli random number distribution. * * Generates a sequence of true and false values with likelihood @f$p@f$ * that true will come up and @f$(1 - p)@f$ that false will appear. */ class bernoulli_distribution { public: /** The type of the range of the distribution. */ typedef bool result_type; /** Parameter type. */ struct param_type { typedef bernoulli_distribution distribution_type; explicit param_type(double __p = 0.5) : _M_p(__p) { _GLIBCXX_DEBUG_ASSERT((_M_p >= 0.0) && (_M_p <= 1.0)); } double p() const { return _M_p; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_p == __p2._M_p; } private: double _M_p; }; public: /** * @brief Constructs a Bernoulli distribution with likelihood @p p. * * @param __p [IN] The likelihood of a true result being returned. * Must be in the interval @f$[0, 1]@f$. */ explicit bernoulli_distribution(double __p = 0.5) : _M_param(__p) { } explicit bernoulli_distribution(const param_type& __p) : _M_param(__p) { } /** * @brief Resets the distribution state. * * Does nothing for a Bernoulli distribution. */ void reset() { } /** * @brief Returns the @p p parameter of the distribution. */ double p() const { return _M_param.p(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return std::numeric_limits<result_type>::min(); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return std::numeric_limits<result_type>::max(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { __detail::_Adaptor<_UniformRandomNumberGenerator, double> __aurng(__urng); if ((__aurng() - __aurng.min()) < __p.p() * (__aurng.max() - __aurng.min())) return true; return false; } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two Bernoulli distributions have * the same parameters. */ friend bool operator==(const bernoulli_distribution& __d1, const bernoulli_distribution& __d2) { return __d1._M_param == __d2._M_param; } private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; }; /** * @brief Return true if two Bernoulli distributions have * different parameters. */ inline bool operator!=(const std::bernoulli_distribution& __d1, const std::bernoulli_distribution& __d2) { return !(__d1 == __d2); } /** * @brief Inserts a %bernoulli_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %bernoulli_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::bernoulli_distribution& __x); /** * @brief Extracts a %bernoulli_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %bernoulli_distribution random number generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::bernoulli_distribution& __x) { double __p; __is >> __p; __x.param(bernoulli_distribution::param_type(__p)); return __is; } /** * @brief A discrete binomial random number distribution. * * The formula for the binomial probability density function is * @f$p(i|t,p) = \binom{t}{i} p^i (1 - p)^{t - i}@f$ where @f$t@f$ * and @f$p@f$ are the parameters of the distribution. */ template<typename _IntType = int> class binomial_distribution { static_assert(std::is_integral<_IntType>::value, "template argument not an integral type"); public: /** The type of the range of the distribution. */ typedef _IntType result_type; /** Parameter type. */ struct param_type { typedef binomial_distribution<_IntType> distribution_type; friend class binomial_distribution<_IntType>; explicit param_type(_IntType __t = _IntType(1), double __p = 0.5) : _M_t(__t), _M_p(__p) { _GLIBCXX_DEBUG_ASSERT((_M_t >= _IntType(0)) && (_M_p >= 0.0) && (_M_p <= 1.0)); _M_initialize(); } _IntType t() const { return _M_t; } double p() const { return _M_p; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_t == __p2._M_t && __p1._M_p == __p2._M_p; } private: void _M_initialize(); _IntType _M_t; double _M_p; double _M_q; #if _GLIBCXX_USE_C99_MATH_TR1 double _M_d1, _M_d2, _M_s1, _M_s2, _M_c, _M_a1, _M_a123, _M_s, _M_lf, _M_lp1p; #endif bool _M_easy; }; // constructors and member function explicit binomial_distribution(_IntType __t = _IntType(1), double __p = 0.5) : _M_param(__t, __p), _M_nd() { } explicit binomial_distribution(const param_type& __p) : _M_param(__p), _M_nd() { } /** * @brief Resets the distribution state. */ void reset() { _M_nd.reset(); } /** * @brief Returns the distribution @p t parameter. */ _IntType t() const { return _M_param.t(); } /** * @brief Returns the distribution @p p parameter. */ double p() const { return _M_param.p(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return 0; } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return _M_param.t(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two binomial distributions have * the same parameters and the sequences that would * be generated are equal. */ friend bool operator==(const binomial_distribution& __d1, const binomial_distribution& __d2) #ifdef _GLIBCXX_USE_C99_MATH_TR1 { return __d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd; } #else { return __d1._M_param == __d2._M_param; } #endif /** * @brief Inserts a %binomial_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %binomial_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _IntType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::binomial_distribution<_IntType1>& __x); /** * @brief Extracts a %binomial_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %binomial_distribution random number generator engine. * * @returns The input stream with @p __x extracted or in an error * state. */ template<typename _IntType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::binomial_distribution<_IntType1>& __x); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); template<typename _UniformRandomNumberGenerator> result_type _M_waiting(_UniformRandomNumberGenerator& __urng, _IntType __t, double __q); param_type _M_param; // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined. std::normal_distribution<double> _M_nd; }; /** * @brief Return true if two binomial distributions are different. */ template<typename _IntType> inline bool operator!=(const std::binomial_distribution<_IntType>& __d1, const std::binomial_distribution<_IntType>& __d2) { return !(__d1 == __d2); } /** * @brief A discrete geometric random number distribution. * * The formula for the geometric probability density function is * @f$p(i|p) = p(1 - p)^{i}@f$ where @f$p@f$ is the parameter of the * distribution. */ template<typename _IntType = int> class geometric_distribution { static_assert(std::is_integral<_IntType>::value, "template argument not an integral type"); public: /** The type of the range of the distribution. */ typedef _IntType result_type; /** Parameter type. */ struct param_type { typedef geometric_distribution<_IntType> distribution_type; friend class geometric_distribution<_IntType>; explicit param_type(double __p = 0.5) : _M_p(__p) { _GLIBCXX_DEBUG_ASSERT((_M_p > 0.0) && (_M_p < 1.0)); _M_initialize(); } double p() const { return _M_p; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_p == __p2._M_p; } private: void _M_initialize() { _M_log_1_p = std::log(1.0 - _M_p); } double _M_p; double _M_log_1_p; }; // constructors and member function explicit geometric_distribution(double __p = 0.5) : _M_param(__p) { } explicit geometric_distribution(const param_type& __p) : _M_param(__p) { } /** * @brief Resets the distribution state. * * Does nothing for the geometric distribution. */ void reset() { } /** * @brief Returns the distribution parameter @p p. */ double p() const { return _M_param.p(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return 0; } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return std::numeric_limits<result_type>::max(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two geometric distributions have * the same parameters. */ friend bool operator==(const geometric_distribution& __d1, const geometric_distribution& __d2) { return __d1._M_param == __d2._M_param; } private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; }; /** * @brief Return true if two geometric distributions have * different parameters. */ template<typename _IntType> inline bool operator!=(const std::geometric_distribution<_IntType>& __d1, const std::geometric_distribution<_IntType>& __d2) { return !(__d1 == __d2); } /** * @brief Inserts a %geometric_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %geometric_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _IntType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::geometric_distribution<_IntType>& __x); /** * @brief Extracts a %geometric_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %geometric_distribution random number generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _IntType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::geometric_distribution<_IntType>& __x); /** * @brief A negative_binomial_distribution random number distribution. * * The formula for the negative binomial probability mass function is * @f$p(i) = \binom{n}{i} p^i (1 - p)^{t - i}@f$ where @f$t@f$ * and @f$p@f$ are the parameters of the distribution. */ template<typename _IntType = int> class negative_binomial_distribution { static_assert(std::is_integral<_IntType>::value, "template argument not an integral type"); public: /** The type of the range of the distribution. */ typedef _IntType result_type; /** Parameter type. */ struct param_type { typedef negative_binomial_distribution<_IntType> distribution_type; explicit param_type(_IntType __k = 1, double __p = 0.5) : _M_k(__k), _M_p(__p) { _GLIBCXX_DEBUG_ASSERT((_M_k > 0) && (_M_p > 0.0) && (_M_p <= 1.0)); } _IntType k() const { return _M_k; } double p() const { return _M_p; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_k == __p2._M_k && __p1._M_p == __p2._M_p; } private: _IntType _M_k; double _M_p; }; explicit negative_binomial_distribution(_IntType __k = 1, double __p = 0.5) : _M_param(__k, __p), _M_gd(__k, (1.0 - __p) / __p) { } explicit negative_binomial_distribution(const param_type& __p) : _M_param(__p), _M_gd(__p.k(), (1.0 - __p.p()) / __p.p()) { } /** * @brief Resets the distribution state. */ void reset() { _M_gd.reset(); } /** * @brief Return the @f$k@f$ parameter of the distribution. */ _IntType k() const { return _M_param.k(); } /** * @brief Return the @f$p@f$ parameter of the distribution. */ double p() const { return _M_param.p(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return result_type(0); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return std::numeric_limits<result_type>::max(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng); template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate_impl(__f, __t, __urng); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng) { this->__generate_impl(__f, __t, __urng); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two negative binomial distributions have * the same parameters and the sequences that would be * generated are equal. */ friend bool operator==(const negative_binomial_distribution& __d1, const negative_binomial_distribution& __d2) { return __d1._M_param == __d2._M_param && __d1._M_gd == __d2._M_gd; } /** * @brief Inserts a %negative_binomial_distribution random * number distribution @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %negative_binomial_distribution random number * distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _IntType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::negative_binomial_distribution<_IntType1>& __x); /** * @brief Extracts a %negative_binomial_distribution random number * distribution @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %negative_binomial_distribution random number * generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _IntType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::negative_binomial_distribution<_IntType1>& __x); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; std::gamma_distribution<double> _M_gd; }; /** * @brief Return true if two negative binomial distributions are different. */ template<typename _IntType> inline bool operator!=(const std::negative_binomial_distribution<_IntType>& __d1, const std::negative_binomial_distribution<_IntType>& __d2) { return !(__d1 == __d2); } /* @} */ // group random_distributions_bernoulli /** * @addtogroup random_distributions_poisson Poisson Distributions * @ingroup random_distributions * @{ */ /** * @brief A discrete Poisson random number distribution. * * The formula for the Poisson probability density function is * @f$p(i|\mu) = \frac{\mu^i}{i!} e^{-\mu}@f$ where @f$\mu@f$ is the * parameter of the distribution. */ template<typename _IntType = int> class poisson_distribution { static_assert(std::is_integral<_IntType>::value, "template argument not an integral type"); public: /** The type of the range of the distribution. */ typedef _IntType result_type; /** Parameter type. */ struct param_type { typedef poisson_distribution<_IntType> distribution_type; friend class poisson_distribution<_IntType>; explicit param_type(double __mean = 1.0) : _M_mean(__mean) { _GLIBCXX_DEBUG_ASSERT(_M_mean > 0.0); _M_initialize(); } double mean() const { return _M_mean; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_mean == __p2._M_mean; } private: // Hosts either log(mean) or the threshold of the simple method. void _M_initialize(); double _M_mean; double _M_lm_thr; #if _GLIBCXX_USE_C99_MATH_TR1 double _M_lfm, _M_sm, _M_d, _M_scx, _M_1cx, _M_c2b, _M_cb; #endif }; // constructors and member function explicit poisson_distribution(double __mean = 1.0) : _M_param(__mean), _M_nd() { } explicit poisson_distribution(const param_type& __p) : _M_param(__p), _M_nd() { } /** * @brief Resets the distribution state. */ void reset() { _M_nd.reset(); } /** * @brief Returns the distribution parameter @p mean. */ double mean() const { return _M_param.mean(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return 0; } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return std::numeric_limits<result_type>::max(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two Poisson distributions have the same * parameters and the sequences that would be generated * are equal. */ friend bool operator==(const poisson_distribution& __d1, const poisson_distribution& __d2) #ifdef _GLIBCXX_USE_C99_MATH_TR1 { return __d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd; } #else { return __d1._M_param == __d2._M_param; } #endif /** * @brief Inserts a %poisson_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %poisson_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _IntType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::poisson_distribution<_IntType1>& __x); /** * @brief Extracts a %poisson_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %poisson_distribution random number generator engine. * * @returns The input stream with @p __x extracted or in an error * state. */ template<typename _IntType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::poisson_distribution<_IntType1>& __x); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined. std::normal_distribution<double> _M_nd; }; /** * @brief Return true if two Poisson distributions are different. */ template<typename _IntType> inline bool operator!=(const std::poisson_distribution<_IntType>& __d1, const std::poisson_distribution<_IntType>& __d2) { return !(__d1 == __d2); } /** * @brief An exponential continuous distribution for random numbers. * * The formula for the exponential probability density function is * @f$p(x|\lambda) = \lambda e^{-\lambda x}@f$. * * <table border=1 cellpadding=10 cellspacing=0> * <caption align=top>Distribution Statistics</caption> * <tr><td>Mean</td><td>@f$\frac{1}{\lambda}@f$</td></tr> * <tr><td>Median</td><td>@f$\frac{\ln 2}{\lambda}@f$</td></tr> * <tr><td>Mode</td><td>@f$zero@f$</td></tr> * <tr><td>Range</td><td>@f$[0, \infty]@f$</td></tr> * <tr><td>Standard Deviation</td><td>@f$\frac{1}{\lambda}@f$</td></tr> * </table> */ template<typename _RealType = double> class exponential_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef exponential_distribution<_RealType> distribution_type; explicit param_type(_RealType __lambda = _RealType(1)) : _M_lambda(__lambda) { _GLIBCXX_DEBUG_ASSERT(_M_lambda > _RealType(0)); } _RealType lambda() const { return _M_lambda; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_lambda == __p2._M_lambda; } private: _RealType _M_lambda; }; public: /** * @brief Constructs an exponential distribution with inverse scale * parameter @f$\lambda@f$. */ explicit exponential_distribution(const result_type& __lambda = result_type(1)) : _M_param(__lambda) { } explicit exponential_distribution(const param_type& __p) : _M_param(__p) { } /** * @brief Resets the distribution state. * * Has no effect on exponential distributions. */ void reset() { } /** * @brief Returns the inverse scale parameter of the distribution. */ _RealType lambda() const { return _M_param.lambda(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return result_type(0); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return std::numeric_limits<result_type>::max(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); return -std::log(result_type(1) - __aurng()) / __p.lambda(); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two exponential distributions have the same * parameters. */ friend bool operator==(const exponential_distribution& __d1, const exponential_distribution& __d2) { return __d1._M_param == __d2._M_param; } private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; }; /** * @brief Return true if two exponential distributions have different * parameters. */ template<typename _RealType> inline bool operator!=(const std::exponential_distribution<_RealType>& __d1, const std::exponential_distribution<_RealType>& __d2) { return !(__d1 == __d2); } /** * @brief Inserts a %exponential_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %exponential_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::exponential_distribution<_RealType>& __x); /** * @brief Extracts a %exponential_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %exponential_distribution random number * generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::exponential_distribution<_RealType>& __x); /** * @brief A weibull_distribution random number distribution. * * The formula for the normal probability density function is: * @f[ * p(x|\alpha,\beta) = \frac{\alpha}{\beta} (\frac{x}{\beta})^{\alpha-1} * \exp{(-(\frac{x}{\beta})^\alpha)} * @f] */ template<typename _RealType = double> class weibull_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef weibull_distribution<_RealType> distribution_type; explicit param_type(_RealType __a = _RealType(1), _RealType __b = _RealType(1)) : _M_a(__a), _M_b(__b) { } _RealType a() const { return _M_a; } _RealType b() const { return _M_b; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; } private: _RealType _M_a; _RealType _M_b; }; explicit weibull_distribution(_RealType __a = _RealType(1), _RealType __b = _RealType(1)) : _M_param(__a, __b) { } explicit weibull_distribution(const param_type& __p) : _M_param(__p) { } /** * @brief Resets the distribution state. */ void reset() { } /** * @brief Return the @f$a@f$ parameter of the distribution. */ _RealType a() const { return _M_param.a(); } /** * @brief Return the @f$b@f$ parameter of the distribution. */ _RealType b() const { return _M_param.b(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return result_type(0); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return std::numeric_limits<result_type>::max(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two Weibull distributions have the same * parameters. */ friend bool operator==(const weibull_distribution& __d1, const weibull_distribution& __d2) { return __d1._M_param == __d2._M_param; } private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; }; /** * @brief Return true if two Weibull distributions have different * parameters. */ template<typename _RealType> inline bool operator!=(const std::weibull_distribution<_RealType>& __d1, const std::weibull_distribution<_RealType>& __d2) { return !(__d1 == __d2); } /** * @brief Inserts a %weibull_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %weibull_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::weibull_distribution<_RealType>& __x); /** * @brief Extracts a %weibull_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %weibull_distribution random number * generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::weibull_distribution<_RealType>& __x); /** * @brief A extreme_value_distribution random number distribution. * * The formula for the normal probability mass function is * @f[ * p(x|a,b) = \frac{1}{b} * \exp( \frac{a-x}{b} - \exp(\frac{a-x}{b})) * @f] */ template<typename _RealType = double> class extreme_value_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef extreme_value_distribution<_RealType> distribution_type; explicit param_type(_RealType __a = _RealType(0), _RealType __b = _RealType(1)) : _M_a(__a), _M_b(__b) { } _RealType a() const { return _M_a; } _RealType b() const { return _M_b; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; } private: _RealType _M_a; _RealType _M_b; }; explicit extreme_value_distribution(_RealType __a = _RealType(0), _RealType __b = _RealType(1)) : _M_param(__a, __b) { } explicit extreme_value_distribution(const param_type& __p) : _M_param(__p) { } /** * @brief Resets the distribution state. */ void reset() { } /** * @brief Return the @f$a@f$ parameter of the distribution. */ _RealType a() const { return _M_param.a(); } /** * @brief Return the @f$b@f$ parameter of the distribution. */ _RealType b() const { return _M_param.b(); } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return std::numeric_limits<result_type>::lowest(); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return std::numeric_limits<result_type>::max(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two extreme value distributions have the same * parameters. */ friend bool operator==(const extreme_value_distribution& __d1, const extreme_value_distribution& __d2) { return __d1._M_param == __d2._M_param; } private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; }; /** * @brief Return true if two extreme value distributions have different * parameters. */ template<typename _RealType> inline bool operator!=(const std::extreme_value_distribution<_RealType>& __d1, const std::extreme_value_distribution<_RealType>& __d2) { return !(__d1 == __d2); } /** * @brief Inserts a %extreme_value_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %extreme_value_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::extreme_value_distribution<_RealType>& __x); /** * @brief Extracts a %extreme_value_distribution random number * distribution @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %extreme_value_distribution random number * generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::extreme_value_distribution<_RealType>& __x); /** * @brief A discrete_distribution random number distribution. * * The formula for the discrete probability mass function is * */ template<typename _IntType = int> class discrete_distribution { static_assert(std::is_integral<_IntType>::value, "template argument not an integral type"); public: /** The type of the range of the distribution. */ typedef _IntType result_type; /** Parameter type. */ struct param_type { typedef discrete_distribution<_IntType> distribution_type; friend class discrete_distribution<_IntType>; param_type() : _M_prob(), _M_cp() { } template<typename _InputIterator> param_type(_InputIterator __wbegin, _InputIterator __wend) : _M_prob(__wbegin, __wend), _M_cp() { _M_initialize(); } param_type(initializer_list<double> __wil) : _M_prob(__wil.begin(), __wil.end()), _M_cp() { _M_initialize(); } template<typename _Func> param_type(size_t __nw, double __xmin, double __xmax, _Func __fw); // See: http://cpp-next.com/archive/2010/10/implicit-move-must-go/ param_type(const param_type&) = default; param_type& operator=(const param_type&) = default; std::vector<double> probabilities() const { return _M_prob.empty() ? std::vector<double>(1, 1.0) : _M_prob; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_prob == __p2._M_prob; } private: void _M_initialize(); std::vector<double> _M_prob; std::vector<double> _M_cp; }; discrete_distribution() : _M_param() { } template<typename _InputIterator> discrete_distribution(_InputIterator __wbegin, _InputIterator __wend) : _M_param(__wbegin, __wend) { } discrete_distribution(initializer_list<double> __wl) : _M_param(__wl) { } template<typename _Func> discrete_distribution(size_t __nw, double __xmin, double __xmax, _Func __fw) : _M_param(__nw, __xmin, __xmax, __fw) { } explicit discrete_distribution(const param_type& __p) : _M_param(__p) { } /** * @brief Resets the distribution state. */ void reset() { } /** * @brief Returns the probabilities of the distribution. */ std::vector<double> probabilities() const { return _M_param._M_prob.empty() ? std::vector<double>(1, 1.0) : _M_param._M_prob; } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return result_type(0); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return _M_param._M_prob.empty() ? result_type(0) : result_type(_M_param._M_prob.size() - 1); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two discrete distributions have the same * parameters. */ friend bool operator==(const discrete_distribution& __d1, const discrete_distribution& __d2) { return __d1._M_param == __d2._M_param; } /** * @brief Inserts a %discrete_distribution random number distribution * @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %discrete_distribution random number distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _IntType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::discrete_distribution<_IntType1>& __x); /** * @brief Extracts a %discrete_distribution random number distribution * @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %discrete_distribution random number * generator engine. * * @returns The input stream with @p __x extracted or in an error * state. */ template<typename _IntType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::discrete_distribution<_IntType1>& __x); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; }; /** * @brief Return true if two discrete distributions have different * parameters. */ template<typename _IntType> inline bool operator!=(const std::discrete_distribution<_IntType>& __d1, const std::discrete_distribution<_IntType>& __d2) { return !(__d1 == __d2); } /** * @brief A piecewise_constant_distribution random number distribution. * * The formula for the piecewise constant probability mass function is * */ template<typename _RealType = double> class piecewise_constant_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef piecewise_constant_distribution<_RealType> distribution_type; friend class piecewise_constant_distribution<_RealType>; param_type() : _M_int(), _M_den(), _M_cp() { } template<typename _InputIteratorB, typename _InputIteratorW> param_type(_InputIteratorB __bfirst, _InputIteratorB __bend, _InputIteratorW __wbegin); template<typename _Func> param_type(initializer_list<_RealType> __bi, _Func __fw); template<typename _Func> param_type(size_t __nw, _RealType __xmin, _RealType __xmax, _Func __fw); // See: http://cpp-next.com/archive/2010/10/implicit-move-must-go/ param_type(const param_type&) = default; param_type& operator=(const param_type&) = default; std::vector<_RealType> intervals() const { if (_M_int.empty()) { std::vector<_RealType> __tmp(2); __tmp[1] = _RealType(1); return __tmp; } else return _M_int; } std::vector<double> densities() const { return _M_den.empty() ? std::vector<double>(1, 1.0) : _M_den; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return __p1._M_int == __p2._M_int && __p1._M_den == __p2._M_den; } private: void _M_initialize(); std::vector<_RealType> _M_int; std::vector<double> _M_den; std::vector<double> _M_cp; }; explicit piecewise_constant_distribution() : _M_param() { } template<typename _InputIteratorB, typename _InputIteratorW> piecewise_constant_distribution(_InputIteratorB __bfirst, _InputIteratorB __bend, _InputIteratorW __wbegin) : _M_param(__bfirst, __bend, __wbegin) { } template<typename _Func> piecewise_constant_distribution(initializer_list<_RealType> __bl, _Func __fw) : _M_param(__bl, __fw) { } template<typename _Func> piecewise_constant_distribution(size_t __nw, _RealType __xmin, _RealType __xmax, _Func __fw) : _M_param(__nw, __xmin, __xmax, __fw) { } explicit piecewise_constant_distribution(const param_type& __p) : _M_param(__p) { } /** * @brief Resets the distribution state. */ void reset() { } /** * @brief Returns a vector of the intervals. */ std::vector<_RealType> intervals() const { if (_M_param._M_int.empty()) { std::vector<_RealType> __tmp(2); __tmp[1] = _RealType(1); return __tmp; } else return _M_param._M_int; } /** * @brief Returns a vector of the probability densities. */ std::vector<double> densities() const { return _M_param._M_den.empty() ? std::vector<double>(1, 1.0) : _M_param._M_den; } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return _M_param._M_int.empty() ? result_type(0) : _M_param._M_int.front(); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return _M_param._M_int.empty() ? result_type(1) : _M_param._M_int.back(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two piecewise constant distributions have the * same parameters. */ friend bool operator==(const piecewise_constant_distribution& __d1, const piecewise_constant_distribution& __d2) { return __d1._M_param == __d2._M_param; } /** * @brief Inserts a %piecewise_constan_distribution random * number distribution @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %piecewise_constan_distribution random number * distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::piecewise_constant_distribution<_RealType1>& __x); /** * @brief Extracts a %piecewise_constan_distribution random * number distribution @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %piecewise_constan_distribution random number * generator engine. * * @returns The input stream with @p __x extracted or in an error * state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::piecewise_constant_distribution<_RealType1>& __x); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; }; /** * @brief Return true if two piecewise constant distributions have * different parameters. */ template<typename _RealType> inline bool operator!=(const std::piecewise_constant_distribution<_RealType>& __d1, const std::piecewise_constant_distribution<_RealType>& __d2) { return !(__d1 == __d2); } /** * @brief A piecewise_linear_distribution random number distribution. * * The formula for the piecewise linear probability mass function is * */ template<typename _RealType = double> class piecewise_linear_distribution { static_assert(std::is_floating_point<_RealType>::value, "template argument not a floating point type"); public: /** The type of the range of the distribution. */ typedef _RealType result_type; /** Parameter type. */ struct param_type { typedef piecewise_linear_distribution<_RealType> distribution_type; friend class piecewise_linear_distribution<_RealType>; param_type() : _M_int(), _M_den(), _M_cp(), _M_m() { } template<typename _InputIteratorB, typename _InputIteratorW> param_type(_InputIteratorB __bfirst, _InputIteratorB __bend, _InputIteratorW __wbegin); template<typename _Func> param_type(initializer_list<_RealType> __bl, _Func __fw); template<typename _Func> param_type(size_t __nw, _RealType __xmin, _RealType __xmax, _Func __fw); // See: http://cpp-next.com/archive/2010/10/implicit-move-must-go/ param_type(const param_type&) = default; param_type& operator=(const param_type&) = default; std::vector<_RealType> intervals() const { if (_M_int.empty()) { std::vector<_RealType> __tmp(2); __tmp[1] = _RealType(1); return __tmp; } else return _M_int; } std::vector<double> densities() const { return _M_den.empty() ? std::vector<double>(2, 1.0) : _M_den; } friend bool operator==(const param_type& __p1, const param_type& __p2) { return (__p1._M_int == __p2._M_int && __p1._M_den == __p2._M_den); } private: void _M_initialize(); std::vector<_RealType> _M_int; std::vector<double> _M_den; std::vector<double> _M_cp; std::vector<double> _M_m; }; explicit piecewise_linear_distribution() : _M_param() { } template<typename _InputIteratorB, typename _InputIteratorW> piecewise_linear_distribution(_InputIteratorB __bfirst, _InputIteratorB __bend, _InputIteratorW __wbegin) : _M_param(__bfirst, __bend, __wbegin) { } template<typename _Func> piecewise_linear_distribution(initializer_list<_RealType> __bl, _Func __fw) : _M_param(__bl, __fw) { } template<typename _Func> piecewise_linear_distribution(size_t __nw, _RealType __xmin, _RealType __xmax, _Func __fw) : _M_param(__nw, __xmin, __xmax, __fw) { } explicit piecewise_linear_distribution(const param_type& __p) : _M_param(__p) { } /** * Resets the distribution state. */ void reset() { } /** * @brief Return the intervals of the distribution. */ std::vector<_RealType> intervals() const { if (_M_param._M_int.empty()) { std::vector<_RealType> __tmp(2); __tmp[1] = _RealType(1); return __tmp; } else return _M_param._M_int; } /** * @brief Return a vector of the probability densities of the * distribution. */ std::vector<double> densities() const { return _M_param._M_den.empty() ? std::vector<double>(2, 1.0) : _M_param._M_den; } /** * @brief Returns the parameter set of the distribution. */ param_type param() const { return _M_param; } /** * @brief Sets the parameter set of the distribution. * @param __param The new parameter set of the distribution. */ void param(const param_type& __param) { _M_param = __param; } /** * @brief Returns the greatest lower bound value of the distribution. */ result_type min() const { return _M_param._M_int.empty() ? result_type(0) : _M_param._M_int.front(); } /** * @brief Returns the least upper bound value of the distribution. */ result_type max() const { return _M_param._M_int.empty() ? result_type(1) : _M_param._M_int.back(); } /** * @brief Generating functions. */ template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng) { return this->operator()(__urng, _M_param); } template<typename _UniformRandomNumberGenerator> result_type operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p); template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { this->__generate(__f, __t, __urng, _M_param); } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } template<typename _UniformRandomNumberGenerator> void __generate(result_type* __f, result_type* __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { this->__generate_impl(__f, __t, __urng, __p); } /** * @brief Return true if two piecewise linear distributions have the * same parameters. */ friend bool operator==(const piecewise_linear_distribution& __d1, const piecewise_linear_distribution& __d2) { return __d1._M_param == __d2._M_param; } /** * @brief Inserts a %piecewise_linear_distribution random number * distribution @p __x into the output stream @p __os. * * @param __os An output stream. * @param __x A %piecewise_linear_distribution random number * distribution. * * @returns The output stream with the state of @p __x inserted or in * an error state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const std::piecewise_linear_distribution<_RealType1>& __x); /** * @brief Extracts a %piecewise_linear_distribution random number * distribution @p __x from the input stream @p __is. * * @param __is An input stream. * @param __x A %piecewise_linear_distribution random number * generator engine. * * @returns The input stream with @p __x extracted or in an error * state. */ template<typename _RealType1, typename _CharT, typename _Traits> friend std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, std::piecewise_linear_distribution<_RealType1>& __x); private: template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p); param_type _M_param; }; /** * @brief Return true if two piecewise linear distributions have * different parameters. */ template<typename _RealType> inline bool operator!=(const std::piecewise_linear_distribution<_RealType>& __d1, const std::piecewise_linear_distribution<_RealType>& __d2) { return !(__d1 == __d2); } /* @} */ // group random_distributions_poisson /* @} */ // group random_distributions /** * @addtogroup random_utilities Random Number Utilities * @ingroup random * @{ */ /** * @brief The seed_seq class generates sequences of seeds for random * number generators. */ class seed_seq { public: /** The type of the seed vales. */ typedef uint_least32_t result_type; /** Default constructor. */ seed_seq() : _M_v() { } template<typename _IntType> seed_seq(std::initializer_list<_IntType> il); template<typename _InputIterator> seed_seq(_InputIterator __begin, _InputIterator __end); // generating functions template<typename _RandomAccessIterator> void generate(_RandomAccessIterator __begin, _RandomAccessIterator __end); // property functions size_t size() const { return _M_v.size(); } template<typename OutputIterator> void param(OutputIterator __dest) const { std::copy(_M_v.begin(), _M_v.end(), __dest); } private: /// std::vector<result_type> _M_v; }; /* @} */ // group random_utilities /* @} */ // group random _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/locale_classes.tcc�������������������������������������������������������������������0000644�����������������00000020275�14763166030�0012211 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Locale support -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/locale_classes.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{locale} */ // // ISO C++ 14882: 22.1 Locales // #ifndef _LOCALE_CLASSES_TCC #define _LOCALE_CLASSES_TCC 1 #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Facet> locale:: locale(const locale& __other, _Facet* __f) { _M_impl = new _Impl(*__other._M_impl, 1); __try { _M_impl->_M_install_facet(&_Facet::id, __f); } __catch(...) { _M_impl->_M_remove_reference(); __throw_exception_again; } delete [] _M_impl->_M_names[0]; _M_impl->_M_names[0] = 0; // Unnamed. } template<typename _Facet> locale locale:: combine(const locale& __other) const { _Impl* __tmp = new _Impl(*_M_impl, 1); __try { __tmp->_M_replace_facet(__other._M_impl, &_Facet::id); } __catch(...) { __tmp->_M_remove_reference(); __throw_exception_again; } return locale(__tmp); } template<typename _CharT, typename _Traits, typename _Alloc> bool locale:: operator()(const basic_string<_CharT, _Traits, _Alloc>& __s1, const basic_string<_CharT, _Traits, _Alloc>& __s2) const { typedef std::collate<_CharT> __collate_type; const __collate_type& __collate = use_facet<__collate_type>(*this); return (__collate.compare(__s1.data(), __s1.data() + __s1.length(), __s2.data(), __s2.data() + __s2.length()) < 0); } /** * @brief Test for the presence of a facet. * @ingroup locales * * has_facet tests the locale argument for the presence of the facet type * provided as the template parameter. Facets derived from the facet * parameter will also return true. * * @tparam _Facet The facet type to test the presence of. * @param __loc The locale to test. * @return true if @p __loc contains a facet of type _Facet, else false. */ template<typename _Facet> bool has_facet(const locale& __loc) throw() { const size_t __i = _Facet::id._M_id(); const locale::facet** __facets = __loc._M_impl->_M_facets; return (__i < __loc._M_impl->_M_facets_size #ifdef __GXX_RTTI && dynamic_cast<const _Facet*>(__facets[__i])); #else && static_cast<const _Facet*>(__facets[__i])); #endif } /** * @brief Return a facet. * @ingroup locales * * use_facet looks for and returns a reference to a facet of type Facet * where Facet is the template parameter. If has_facet(locale) is true, * there is a suitable facet to return. It throws std::bad_cast if the * locale doesn't contain a facet of type Facet. * * @tparam _Facet The facet type to access. * @param __loc The locale to use. * @return Reference to facet of type Facet. * @throw std::bad_cast if @p __loc doesn't contain a facet of type _Facet. */ template<typename _Facet> const _Facet& use_facet(const locale& __loc) { const size_t __i = _Facet::id._M_id(); const locale::facet** __facets = __loc._M_impl->_M_facets; if (__i >= __loc._M_impl->_M_facets_size || !__facets[__i]) __throw_bad_cast(); #ifdef __GXX_RTTI return dynamic_cast<const _Facet&>(*__facets[__i]); #else return static_cast<const _Facet&>(*__facets[__i]); #endif } // Generic version does nothing. template<typename _CharT> int collate<_CharT>::_M_compare(const _CharT*, const _CharT*) const throw () { return 0; } // Generic version does nothing. template<typename _CharT> size_t collate<_CharT>::_M_transform(_CharT*, const _CharT*, size_t) const throw () { return 0; } template<typename _CharT> int collate<_CharT>:: do_compare(const _CharT* __lo1, const _CharT* __hi1, const _CharT* __lo2, const _CharT* __hi2) const { // strcoll assumes zero-terminated strings so we make a copy // and then put a zero at the end. const string_type __one(__lo1, __hi1); const string_type __two(__lo2, __hi2); const _CharT* __p = __one.c_str(); const _CharT* __pend = __one.data() + __one.length(); const _CharT* __q = __two.c_str(); const _CharT* __qend = __two.data() + __two.length(); // strcoll stops when it sees a nul character so we break // the strings into zero-terminated substrings and pass those // to strcoll. for (;;) { const int __res = _M_compare(__p, __q); if (__res) return __res; __p += char_traits<_CharT>::length(__p); __q += char_traits<_CharT>::length(__q); if (__p == __pend && __q == __qend) return 0; else if (__p == __pend) return -1; else if (__q == __qend) return 1; __p++; __q++; } } template<typename _CharT> typename collate<_CharT>::string_type collate<_CharT>:: do_transform(const _CharT* __lo, const _CharT* __hi) const { string_type __ret; // strxfrm assumes zero-terminated strings so we make a copy const string_type __str(__lo, __hi); const _CharT* __p = __str.c_str(); const _CharT* __pend = __str.data() + __str.length(); size_t __len = (__hi - __lo) * 2; _CharT* __c = new _CharT[__len]; __try { // strxfrm stops when it sees a nul character so we break // the string into zero-terminated substrings and pass those // to strxfrm. for (;;) { // First try a buffer perhaps big enough. size_t __res = _M_transform(__c, __p, __len); // If the buffer was not large enough, try again with the // correct size. if (__res >= __len) { __len = __res + 1; delete [] __c, __c = 0; __c = new _CharT[__len]; __res = _M_transform(__c, __p, __len); } __ret.append(__c, __res); __p += char_traits<_CharT>::length(__p); if (__p == __pend) break; __p++; __ret.push_back(_CharT()); } } __catch(...) { delete [] __c; __throw_exception_again; } delete [] __c; return __ret; } template<typename _CharT> long collate<_CharT>:: do_hash(const _CharT* __lo, const _CharT* __hi) const { unsigned long __val = 0; for (; __lo < __hi; ++__lo) __val = *__lo + ((__val << 7) | (__val >> (__gnu_cxx::__numeric_traits<unsigned long>:: __digits - 7))); return static_cast<long>(__val); } // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. #if _GLIBCXX_EXTERN_TEMPLATE extern template class collate<char>; extern template class collate_byname<char>; extern template const collate<char>& use_facet<collate<char> >(const locale&); extern template bool has_facet<collate<char> >(const locale&); #ifdef _GLIBCXX_USE_WCHAR_T extern template class collate<wchar_t>; extern template class collate_byname<wchar_t>; extern template const collate<wchar_t>& use_facet<collate<wchar_t> >(const locale&); extern template bool has_facet<collate<wchar_t> >(const locale&); #endif #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_function.h�����������������������������������������������������������������������0000644�����������������00000054071�14763166030�0011423 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Functor implementations -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996-1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_function.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{functional} */ #ifndef _STL_FUNCTION_H #define _STL_FUNCTION_H 1 namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // 20.3.1 base classes /** @defgroup functors Function Objects * @ingroup utilities * * Function objects, or @e functors, are objects with an @c operator() * defined and accessible. They can be passed as arguments to algorithm * templates and used in place of a function pointer. Not only is the * resulting expressiveness of the library increased, but the generated * code can be more efficient than what you might write by hand. When we * refer to @a functors, then, generally we include function pointers in * the description as well. * * Often, functors are only created as temporaries passed to algorithm * calls, rather than being created as named variables. * * Two examples taken from the standard itself follow. To perform a * by-element addition of two vectors @c a and @c b containing @c double, * and put the result in @c a, use * \code * transform (a.begin(), a.end(), b.begin(), a.begin(), plus<double>()); * \endcode * To negate every element in @c a, use * \code * transform(a.begin(), a.end(), a.begin(), negate<double>()); * \endcode * The addition and negation functions will be inlined directly. * * The standard functors are derived from structs named @c unary_function * and @c binary_function. These two classes contain nothing but typedefs, * to aid in generic (template) programming. If you write your own * functors, you might consider doing the same. * * @{ */ /** * This is one of the @link functors functor base classes@endlink. */ template<typename _Arg, typename _Result> struct unary_function { /// @c argument_type is the type of the argument typedef _Arg argument_type; /// @c result_type is the return type typedef _Result result_type; }; /** * This is one of the @link functors functor base classes@endlink. */ template<typename _Arg1, typename _Arg2, typename _Result> struct binary_function { /// @c first_argument_type is the type of the first argument typedef _Arg1 first_argument_type; /// @c second_argument_type is the type of the second argument typedef _Arg2 second_argument_type; /// @c result_type is the return type typedef _Result result_type; }; /** @} */ // 20.3.2 arithmetic /** @defgroup arithmetic_functors Arithmetic Classes * @ingroup functors * * Because basic math often needs to be done during an algorithm, * the library provides functors for those operations. See the * documentation for @link functors the base classes@endlink * for examples of their use. * * @{ */ /// One of the @link arithmetic_functors math functors@endlink. template<typename _Tp> struct plus : public binary_function<_Tp, _Tp, _Tp> { _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x + __y; } }; /// One of the @link arithmetic_functors math functors@endlink. template<typename _Tp> struct minus : public binary_function<_Tp, _Tp, _Tp> { _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x - __y; } }; /// One of the @link arithmetic_functors math functors@endlink. template<typename _Tp> struct multiplies : public binary_function<_Tp, _Tp, _Tp> { _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x * __y; } }; /// One of the @link arithmetic_functors math functors@endlink. template<typename _Tp> struct divides : public binary_function<_Tp, _Tp, _Tp> { _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x / __y; } }; /// One of the @link arithmetic_functors math functors@endlink. template<typename _Tp> struct modulus : public binary_function<_Tp, _Tp, _Tp> { _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x % __y; } }; /// One of the @link arithmetic_functors math functors@endlink. template<typename _Tp> struct negate : public unary_function<_Tp, _Tp> { _Tp operator()(const _Tp& __x) const { return -__x; } }; /** @} */ // 20.3.3 comparisons /** @defgroup comparison_functors Comparison Classes * @ingroup functors * * The library provides six wrapper functors for all the basic comparisons * in C++, like @c <. * * @{ */ /// One of the @link comparison_functors comparison functors@endlink. template<typename _Tp> struct equal_to : public binary_function<_Tp, _Tp, bool> { bool operator()(const _Tp& __x, const _Tp& __y) const { return __x == __y; } }; /// One of the @link comparison_functors comparison functors@endlink. template<typename _Tp> struct not_equal_to : public binary_function<_Tp, _Tp, bool> { bool operator()(const _Tp& __x, const _Tp& __y) const { return __x != __y; } }; /// One of the @link comparison_functors comparison functors@endlink. template<typename _Tp> struct greater : public binary_function<_Tp, _Tp, bool> { bool operator()(const _Tp& __x, const _Tp& __y) const { return __x > __y; } }; /// One of the @link comparison_functors comparison functors@endlink. template<typename _Tp> struct less : public binary_function<_Tp, _Tp, bool> { bool operator()(const _Tp& __x, const _Tp& __y) const { return __x < __y; } }; /// One of the @link comparison_functors comparison functors@endlink. template<typename _Tp> struct greater_equal : public binary_function<_Tp, _Tp, bool> { bool operator()(const _Tp& __x, const _Tp& __y) const { return __x >= __y; } }; /// One of the @link comparison_functors comparison functors@endlink. template<typename _Tp> struct less_equal : public binary_function<_Tp, _Tp, bool> { bool operator()(const _Tp& __x, const _Tp& __y) const { return __x <= __y; } }; /** @} */ // 20.3.4 logical operations /** @defgroup logical_functors Boolean Operations Classes * @ingroup functors * * Here are wrapper functors for Boolean operations: @c &&, @c ||, * and @c !. * * @{ */ /// One of the @link logical_functors Boolean operations functors@endlink. template<typename _Tp> struct logical_and : public binary_function<_Tp, _Tp, bool> { bool operator()(const _Tp& __x, const _Tp& __y) const { return __x && __y; } }; /// One of the @link logical_functors Boolean operations functors@endlink. template<typename _Tp> struct logical_or : public binary_function<_Tp, _Tp, bool> { bool operator()(const _Tp& __x, const _Tp& __y) const { return __x || __y; } }; /// One of the @link logical_functors Boolean operations functors@endlink. template<typename _Tp> struct logical_not : public unary_function<_Tp, bool> { bool operator()(const _Tp& __x) const { return !__x; } }; /** @} */ // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 660. Missing Bitwise Operations. template<typename _Tp> struct bit_and : public binary_function<_Tp, _Tp, _Tp> { _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x & __y; } }; template<typename _Tp> struct bit_or : public binary_function<_Tp, _Tp, _Tp> { _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x | __y; } }; template<typename _Tp> struct bit_xor : public binary_function<_Tp, _Tp, _Tp> { _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x ^ __y; } }; // 20.3.5 negators /** @defgroup negators Negators * @ingroup functors * * The functions @c not1 and @c not2 each take a predicate functor * and return an instance of @c unary_negate or * @c binary_negate, respectively. These classes are functors whose * @c operator() performs the stored predicate function and then returns * the negation of the result. * * For example, given a vector of integers and a trivial predicate, * \code * struct IntGreaterThanThree * : public std::unary_function<int, bool> * { * bool operator() (int x) { return x > 3; } * }; * * std::find_if (v.begin(), v.end(), not1(IntGreaterThanThree())); * \endcode * The call to @c find_if will locate the first index (i) of @c v for which * <code>!(v[i] > 3)</code> is true. * * The not1/unary_negate combination works on predicates taking a single * argument. The not2/binary_negate combination works on predicates which * take two arguments. * * @{ */ /// One of the @link negators negation functors@endlink. template<typename _Predicate> class unary_negate : public unary_function<typename _Predicate::argument_type, bool> { protected: _Predicate _M_pred; public: explicit unary_negate(const _Predicate& __x) : _M_pred(__x) { } bool operator()(const typename _Predicate::argument_type& __x) const { return !_M_pred(__x); } }; /// One of the @link negators negation functors@endlink. template<typename _Predicate> inline unary_negate<_Predicate> not1(const _Predicate& __pred) { return unary_negate<_Predicate>(__pred); } /// One of the @link negators negation functors@endlink. template<typename _Predicate> class binary_negate : public binary_function<typename _Predicate::first_argument_type, typename _Predicate::second_argument_type, bool> { protected: _Predicate _M_pred; public: explicit binary_negate(const _Predicate& __x) : _M_pred(__x) { } bool operator()(const typename _Predicate::first_argument_type& __x, const typename _Predicate::second_argument_type& __y) const { return !_M_pred(__x, __y); } }; /// One of the @link negators negation functors@endlink. template<typename _Predicate> inline binary_negate<_Predicate> not2(const _Predicate& __pred) { return binary_negate<_Predicate>(__pred); } /** @} */ // 20.3.7 adaptors pointers functions /** @defgroup pointer_adaptors Adaptors for pointers to functions * @ingroup functors * * The advantage of function objects over pointers to functions is that * the objects in the standard library declare nested typedefs describing * their argument and result types with uniform names (e.g., @c result_type * from the base classes @c unary_function and @c binary_function). * Sometimes those typedefs are required, not just optional. * * Adaptors are provided to turn pointers to unary (single-argument) and * binary (double-argument) functions into function objects. The * long-winded functor @c pointer_to_unary_function is constructed with a * function pointer @c f, and its @c operator() called with argument @c x * returns @c f(x). The functor @c pointer_to_binary_function does the same * thing, but with a double-argument @c f and @c operator(). * * The function @c ptr_fun takes a pointer-to-function @c f and constructs * an instance of the appropriate functor. * * @{ */ /// One of the @link pointer_adaptors adaptors for function pointers@endlink. template<typename _Arg, typename _Result> class pointer_to_unary_function : public unary_function<_Arg, _Result> { protected: _Result (*_M_ptr)(_Arg); public: pointer_to_unary_function() { } explicit pointer_to_unary_function(_Result (*__x)(_Arg)) : _M_ptr(__x) { } _Result operator()(_Arg __x) const { return _M_ptr(__x); } }; /// One of the @link pointer_adaptors adaptors for function pointers@endlink. template<typename _Arg, typename _Result> inline pointer_to_unary_function<_Arg, _Result> ptr_fun(_Result (*__x)(_Arg)) { return pointer_to_unary_function<_Arg, _Result>(__x); } /// One of the @link pointer_adaptors adaptors for function pointers@endlink. template<typename _Arg1, typename _Arg2, typename _Result> class pointer_to_binary_function : public binary_function<_Arg1, _Arg2, _Result> { protected: _Result (*_M_ptr)(_Arg1, _Arg2); public: pointer_to_binary_function() { } explicit pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2)) : _M_ptr(__x) { } _Result operator()(_Arg1 __x, _Arg2 __y) const { return _M_ptr(__x, __y); } }; /// One of the @link pointer_adaptors adaptors for function pointers@endlink. template<typename _Arg1, typename _Arg2, typename _Result> inline pointer_to_binary_function<_Arg1, _Arg2, _Result> ptr_fun(_Result (*__x)(_Arg1, _Arg2)) { return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__x); } /** @} */ template<typename _Tp> struct _Identity : public unary_function<_Tp,_Tp> { _Tp& operator()(_Tp& __x) const { return __x; } const _Tp& operator()(const _Tp& __x) const { return __x; } }; template<typename _Pair> struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> { typename _Pair::first_type& operator()(_Pair& __x) const { return __x.first; } const typename _Pair::first_type& operator()(const _Pair& __x) const { return __x.first; } #if __cplusplus >= 201103L template<typename _Pair2> typename _Pair2::first_type& operator()(_Pair2& __x) const { return __x.first; } template<typename _Pair2> const typename _Pair2::first_type& operator()(const _Pair2& __x) const { return __x.first; } #endif }; template<typename _Pair> struct _Select2nd : public unary_function<_Pair, typename _Pair::second_type> { typename _Pair::second_type& operator()(_Pair& __x) const { return __x.second; } const typename _Pair::second_type& operator()(const _Pair& __x) const { return __x.second; } }; // 20.3.8 adaptors pointers members /** @defgroup memory_adaptors Adaptors for pointers to members * @ingroup functors * * There are a total of 8 = 2^3 function objects in this family. * (1) Member functions taking no arguments vs member functions taking * one argument. * (2) Call through pointer vs call through reference. * (3) Const vs non-const member function. * * All of this complexity is in the function objects themselves. You can * ignore it by using the helper function mem_fun and mem_fun_ref, * which create whichever type of adaptor is appropriate. * * @{ */ /// One of the @link memory_adaptors adaptors for member /// pointers@endlink. template<typename _Ret, typename _Tp> class mem_fun_t : public unary_function<_Tp*, _Ret> { public: explicit mem_fun_t(_Ret (_Tp::*__pf)()) : _M_f(__pf) { } _Ret operator()(_Tp* __p) const { return (__p->*_M_f)(); } private: _Ret (_Tp::*_M_f)(); }; /// One of the @link memory_adaptors adaptors for member /// pointers@endlink. template<typename _Ret, typename _Tp> class const_mem_fun_t : public unary_function<const _Tp*, _Ret> { public: explicit const_mem_fun_t(_Ret (_Tp::*__pf)() const) : _M_f(__pf) { } _Ret operator()(const _Tp* __p) const { return (__p->*_M_f)(); } private: _Ret (_Tp::*_M_f)() const; }; /// One of the @link memory_adaptors adaptors for member /// pointers@endlink. template<typename _Ret, typename _Tp> class mem_fun_ref_t : public unary_function<_Tp, _Ret> { public: explicit mem_fun_ref_t(_Ret (_Tp::*__pf)()) : _M_f(__pf) { } _Ret operator()(_Tp& __r) const { return (__r.*_M_f)(); } private: _Ret (_Tp::*_M_f)(); }; /// One of the @link memory_adaptors adaptors for member /// pointers@endlink. template<typename _Ret, typename _Tp> class const_mem_fun_ref_t : public unary_function<_Tp, _Ret> { public: explicit const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const) : _M_f(__pf) { } _Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); } private: _Ret (_Tp::*_M_f)() const; }; /// One of the @link memory_adaptors adaptors for member /// pointers@endlink. template<typename _Ret, typename _Tp, typename _Arg> class mem_fun1_t : public binary_function<_Tp*, _Arg, _Ret> { public: explicit mem_fun1_t(_Ret (_Tp::*__pf)(_Arg)) : _M_f(__pf) { } _Ret operator()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); } private: _Ret (_Tp::*_M_f)(_Arg); }; /// One of the @link memory_adaptors adaptors for member /// pointers@endlink. template<typename _Ret, typename _Tp, typename _Arg> class const_mem_fun1_t : public binary_function<const _Tp*, _Arg, _Ret> { public: explicit const_mem_fun1_t(_Ret (_Tp::*__pf)(_Arg) const) : _M_f(__pf) { } _Ret operator()(const _Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); } private: _Ret (_Tp::*_M_f)(_Arg) const; }; /// One of the @link memory_adaptors adaptors for member /// pointers@endlink. template<typename _Ret, typename _Tp, typename _Arg> class mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret> { public: explicit mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg)) : _M_f(__pf) { } _Ret operator()(_Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); } private: _Ret (_Tp::*_M_f)(_Arg); }; /// One of the @link memory_adaptors adaptors for member /// pointers@endlink. template<typename _Ret, typename _Tp, typename _Arg> class const_mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret> { public: explicit const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg) const) : _M_f(__pf) { } _Ret operator()(const _Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); } private: _Ret (_Tp::*_M_f)(_Arg) const; }; // Mem_fun adaptor helper functions. There are only two: // mem_fun and mem_fun_ref. template<typename _Ret, typename _Tp> inline mem_fun_t<_Ret, _Tp> mem_fun(_Ret (_Tp::*__f)()) { return mem_fun_t<_Ret, _Tp>(__f); } template<typename _Ret, typename _Tp> inline const_mem_fun_t<_Ret, _Tp> mem_fun(_Ret (_Tp::*__f)() const) { return const_mem_fun_t<_Ret, _Tp>(__f); } template<typename _Ret, typename _Tp> inline mem_fun_ref_t<_Ret, _Tp> mem_fun_ref(_Ret (_Tp::*__f)()) { return mem_fun_ref_t<_Ret, _Tp>(__f); } template<typename _Ret, typename _Tp> inline const_mem_fun_ref_t<_Ret, _Tp> mem_fun_ref(_Ret (_Tp::*__f)() const) { return const_mem_fun_ref_t<_Ret, _Tp>(__f); } template<typename _Ret, typename _Tp, typename _Arg> inline mem_fun1_t<_Ret, _Tp, _Arg> mem_fun(_Ret (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); } template<typename _Ret, typename _Tp, typename _Arg> inline const_mem_fun1_t<_Ret, _Tp, _Arg> mem_fun(_Ret (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); } template<typename _Ret, typename _Tp, typename _Arg> inline mem_fun1_ref_t<_Ret, _Tp, _Arg> mem_fun_ref(_Ret (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } template<typename _Ret, typename _Tp, typename _Arg> inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg> mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } /** @} */ _GLIBCXX_END_NAMESPACE_VERSION } // namespace #if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED # include <backward/binders.h> #endif #endif /* _STL_FUNCTION_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/valarray_array.tcc�������������������������������������������������������������������0000644�����������������00000016126�14763166030�0012254 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// The template and inlines for the -*- C++ -*- internal _Array helper class. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/valarray_array.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{valarray} */ // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr> #ifndef _VALARRAY_ARRAY_TCC #define _VALARRAY_ARRAY_TCC 1 namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Tp> void __valarray_fill(_Array<_Tp> __a, size_t __n, _Array<bool> __m, const _Tp& __t) { _Tp* __p = __a._M_data; bool* __ok (__m._M_data); for (size_t __i=0; __i < __n; ++__i, ++__ok, ++__p) { while (!*__ok) { ++__ok; ++__p; } *__p = __t; } } // Copy n elements of a into consecutive elements of b. When m is // false, the corresponding element of a is skipped. m must contain // at least n true elements. a must contain at least n elements and // enough elements to match up with m through the nth true element // of m. I.e. if n is 10, m has 15 elements with 5 false followed // by 10 true, a must have 15 elements. template<typename _Tp> void __valarray_copy(_Array<_Tp> __a, _Array<bool> __m, _Array<_Tp> __b, size_t __n) { _Tp* __p (__a._M_data); bool* __ok (__m._M_data); for (_Tp* __q = __b._M_data; __q < __b._M_data + __n; ++__q, ++__ok, ++__p) { while (! *__ok) { ++__ok; ++__p; } *__q = *__p; } } // Copy n consecutive elements from a into elements of b. Elements // of b are skipped if the corresponding element of m is false. m // must contain at least n true elements. b must have at least as // many elements as the index of the nth true element of m. I.e. if // m has 15 elements with 5 false followed by 10 true, b must have // at least 15 elements. template<typename _Tp> void __valarray_copy(_Array<_Tp> __a, size_t __n, _Array<_Tp> __b, _Array<bool> __m) { _Tp* __q (__b._M_data); bool* __ok (__m._M_data); for (_Tp* __p = __a._M_data; __p < __a._M_data+__n; ++__p, ++__ok, ++__q) { while (! *__ok) { ++__ok; ++__q; } *__q = *__p; } } // Copy n elements from a into elements of b. Elements of a are // skipped if the corresponding element of m is false. Elements of // b are skipped if the corresponding element of k is false. m and // k must contain at least n true elements. a and b must have at // least as many elements as the index of the nth true element of m. template<typename _Tp> void __valarray_copy(_Array<_Tp> __a, _Array<bool> __m, size_t __n, _Array<_Tp> __b, _Array<bool> __k) { _Tp* __p (__a._M_data); _Tp* __q (__b._M_data); bool* __srcok (__m._M_data); bool* __dstok (__k._M_data); for (size_t __i = 0; __i < __n; ++__srcok, ++__p, ++__dstok, ++__q, ++__i) { while (! *__srcok) { ++__srcok; ++__p; } while (! *__dstok) { ++__dstok; ++__q; } *__q = *__p; } } // Copy n consecutive elements of e into consecutive elements of a. // I.e. a[i] = e[i]. template<typename _Tp, class _Dom> void __valarray_copy(const _Expr<_Dom, _Tp>& __e, size_t __n, _Array<_Tp> __a) { _Tp* __p (__a._M_data); for (size_t __i = 0; __i < __n; ++__i, ++__p) *__p = __e[__i]; } // Copy n consecutive elements of e into elements of a using stride // s. I.e., a[0] = e[0], a[s] = e[1], a[2*s] = e[2]. template<typename _Tp, class _Dom> void __valarray_copy(const _Expr<_Dom, _Tp>& __e, size_t __n, _Array<_Tp> __a, size_t __s) { _Tp* __p (__a._M_data); for (size_t __i = 0; __i < __n; ++__i, __p += __s) *__p = __e[__i]; } // Copy n consecutive elements of e into elements of a indexed by // contents of i. I.e., a[i[0]] = e[0]. template<typename _Tp, class _Dom> void __valarray_copy(const _Expr<_Dom, _Tp>& __e, size_t __n, _Array<_Tp> __a, _Array<size_t> __i) { size_t* __j (__i._M_data); for (size_t __k = 0; __k < __n; ++__k, ++__j) __a._M_data[*__j] = __e[__k]; } // Copy n elements of e indexed by contents of f into elements of a // indexed by contents of i. I.e., a[i[0]] = e[f[0]]. template<typename _Tp> void __valarray_copy(_Array<_Tp> __e, _Array<size_t> __f, size_t __n, _Array<_Tp> __a, _Array<size_t> __i) { size_t* __g (__f._M_data); size_t* __j (__i._M_data); for (size_t __k = 0; __k < __n; ++__k, ++__j, ++__g) __a._M_data[*__j] = __e._M_data[*__g]; } // Copy n consecutive elements of e into elements of a. Elements of // a are skipped if the corresponding element of m is false. m must // have at least n true elements and a must have at least as many // elements as the index of the nth true element of m. I.e. if m // has 5 false followed by 10 true elements and n == 10, a must have // at least 15 elements. template<typename _Tp, class _Dom> void __valarray_copy(const _Expr<_Dom, _Tp>& __e, size_t __n, _Array<_Tp> __a, _Array<bool> __m) { bool* __ok (__m._M_data); _Tp* __p (__a._M_data); for (size_t __i = 0; __i < __n; ++__i, ++__ok, ++__p) { while (! *__ok) { ++__ok; ++__p; } *__p = __e[__i]; } } template<typename _Tp, class _Dom> void __valarray_copy_construct(const _Expr<_Dom, _Tp>& __e, size_t __n, _Array<_Tp> __a) { _Tp* __p (__a._M_data); for (size_t __i = 0; __i < __n; ++__i, ++__p) new (__p) _Tp(__e[__i]); } template<typename _Tp> void __valarray_copy_construct(_Array<_Tp> __a, _Array<bool> __m, _Array<_Tp> __b, size_t __n) { _Tp* __p (__a._M_data); bool* __ok (__m._M_data); for (_Tp* __q = __b._M_data; __q < __b._M_data+__n; ++__q, ++__ok, ++__p) { while (! *__ok) { ++__ok; ++__p; } new (__q) _Tp(*__p); } } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _VALARRAY_ARRAY_TCC */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_queue.h��������������������������������������������������������������������������0000644�����������������00000044334�14763166030�0010723 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Queue implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_queue.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{queue} */ #ifndef _STL_QUEUE_H #define _STL_QUEUE_H 1 #include <bits/concept_check.h> #include <debug/debug.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief A standard container giving FIFO behavior. * * @ingroup sequences * * @tparam _Tp Type of element. * @tparam _Sequence Type of underlying sequence, defaults to deque<_Tp>. * * Meets many of the requirements of a * <a href="tables.html#65">container</a>, * but does not define anything to do with iterators. Very few of the * other standard container interfaces are defined. * * This is not a true container, but an @e adaptor. It holds another * container, and provides a wrapper interface to that container. The * wrapper is what enforces strict first-in-first-out %queue behavior. * * The second template parameter defines the type of the underlying * sequence/container. It defaults to std::deque, but it can be any type * that supports @c front, @c back, @c push_back, and @c pop_front, * such as std::list or an appropriate user-defined type. * * Members not found in @a normal containers are @c container_type, * which is a typedef for the second Sequence parameter, and @c push and * @c pop, which are standard %queue/FIFO operations. */ template<typename _Tp, typename _Sequence = deque<_Tp> > class queue { // concept requirements typedef typename _Sequence::value_type _Sequence_value_type; __glibcxx_class_requires(_Tp, _SGIAssignableConcept) __glibcxx_class_requires(_Sequence, _FrontInsertionSequenceConcept) __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept) __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept) template<typename _Tp1, typename _Seq1> friend bool operator==(const queue<_Tp1, _Seq1>&, const queue<_Tp1, _Seq1>&); template<typename _Tp1, typename _Seq1> friend bool operator<(const queue<_Tp1, _Seq1>&, const queue<_Tp1, _Seq1>&); public: typedef typename _Sequence::value_type value_type; typedef typename _Sequence::reference reference; typedef typename _Sequence::const_reference const_reference; typedef typename _Sequence::size_type size_type; typedef _Sequence container_type; protected: /** * 'c' is the underlying container. Maintainers wondering why * this isn't uglified as per style guidelines should note that * this name is specified in the standard, [23.2.3.1]. (Why? * Presumably for the same reason that it's protected instead * of private: to allow derivation. But none of the other * containers allow for derivation. Odd.) */ _Sequence c; public: /** * @brief Default constructor creates no elements. */ #if __cplusplus < 201103L explicit queue(const _Sequence& __c = _Sequence()) : c(__c) { } #else explicit queue(const _Sequence& __c) : c(__c) { } explicit queue(_Sequence&& __c = _Sequence()) : c(std::move(__c)) { } #endif /** * Returns true if the %queue is empty. */ bool empty() const { return c.empty(); } /** Returns the number of elements in the %queue. */ size_type size() const { return c.size(); } /** * Returns a read/write reference to the data at the first * element of the %queue. */ reference front() { __glibcxx_requires_nonempty(); return c.front(); } /** * Returns a read-only (constant) reference to the data at the first * element of the %queue. */ const_reference front() const { __glibcxx_requires_nonempty(); return c.front(); } /** * Returns a read/write reference to the data at the last * element of the %queue. */ reference back() { __glibcxx_requires_nonempty(); return c.back(); } /** * Returns a read-only (constant) reference to the data at the last * element of the %queue. */ const_reference back() const { __glibcxx_requires_nonempty(); return c.back(); } /** * @brief Add data to the end of the %queue. * @param __x Data to be added. * * This is a typical %queue operation. The function creates an * element at the end of the %queue and assigns the given data * to it. The time complexity of the operation depends on the * underlying sequence. */ void push(const value_type& __x) { c.push_back(__x); } #if __cplusplus >= 201103L void push(value_type&& __x) { c.push_back(std::move(__x)); } template<typename... _Args> void emplace(_Args&&... __args) { c.emplace_back(std::forward<_Args>(__args)...); } #endif /** * @brief Removes first element. * * This is a typical %queue operation. It shrinks the %queue by one. * The time complexity of the operation depends on the underlying * sequence. * * Note that no data is returned, and if the first element's * data is needed, it should be retrieved before pop() is * called. */ void pop() { __glibcxx_requires_nonempty(); c.pop_front(); } #if __cplusplus >= 201103L void swap(queue& __q) noexcept(noexcept(swap(c, __q.c))) { using std::swap; swap(c, __q.c); } #endif }; /** * @brief Queue equality comparison. * @param __x A %queue. * @param __y A %queue of the same type as @a __x. * @return True iff the size and elements of the queues are equal. * * This is an equivalence relation. Complexity and semantics depend on the * underlying sequence type, but the expected rules are: this relation is * linear in the size of the sequences, and queues are considered equivalent * if their sequences compare equal. */ template<typename _Tp, typename _Seq> inline bool operator==(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) { return __x.c == __y.c; } /** * @brief Queue ordering relation. * @param __x A %queue. * @param __y A %queue of the same type as @a x. * @return True iff @a __x is lexicographically less than @a __y. * * This is an total ordering relation. Complexity and semantics * depend on the underlying sequence type, but the expected rules * are: this relation is linear in the size of the sequences, the * elements must be comparable with @c <, and * std::lexicographical_compare() is usually used to make the * determination. */ template<typename _Tp, typename _Seq> inline bool operator<(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) { return __x.c < __y.c; } /// Based on operator== template<typename _Tp, typename _Seq> inline bool operator!=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) { return !(__x == __y); } /// Based on operator< template<typename _Tp, typename _Seq> inline bool operator>(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) { return __y < __x; } /// Based on operator< template<typename _Tp, typename _Seq> inline bool operator<=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) { return !(__y < __x); } /// Based on operator< template<typename _Tp, typename _Seq> inline bool operator>=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) { return !(__x < __y); } #if __cplusplus >= 201103L template<typename _Tp, typename _Seq> inline void swap(queue<_Tp, _Seq>& __x, queue<_Tp, _Seq>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } template<typename _Tp, typename _Seq, typename _Alloc> struct uses_allocator<queue<_Tp, _Seq>, _Alloc> : public uses_allocator<_Seq, _Alloc>::type { }; #endif /** * @brief A standard container automatically sorting its contents. * * @ingroup sequences * * @tparam _Tp Type of element. * @tparam _Sequence Type of underlying sequence, defaults to vector<_Tp>. * @tparam _Compare Comparison function object type, defaults to * less<_Sequence::value_type>. * * This is not a true container, but an @e adaptor. It holds * another container, and provides a wrapper interface to that * container. The wrapper is what enforces priority-based sorting * and %queue behavior. Very few of the standard container/sequence * interface requirements are met (e.g., iterators). * * The second template parameter defines the type of the underlying * sequence/container. It defaults to std::vector, but it can be * any type that supports @c front(), @c push_back, @c pop_back, * and random-access iterators, such as std::deque or an * appropriate user-defined type. * * The third template parameter supplies the means of making * priority comparisons. It defaults to @c less<value_type> but * can be anything defining a strict weak ordering. * * Members not found in @a normal containers are @c container_type, * which is a typedef for the second Sequence parameter, and @c * push, @c pop, and @c top, which are standard %queue operations. * * @note No equality/comparison operators are provided for * %priority_queue. * * @note Sorting of the elements takes place as they are added to, * and removed from, the %priority_queue using the * %priority_queue's member functions. If you access the elements * by other means, and change their data such that the sorting * order would be different, the %priority_queue will not re-sort * the elements for you. (How could it know to do so?) */ template<typename _Tp, typename _Sequence = vector<_Tp>, typename _Compare = less<typename _Sequence::value_type> > class priority_queue { // concept requirements typedef typename _Sequence::value_type _Sequence_value_type; __glibcxx_class_requires(_Tp, _SGIAssignableConcept) __glibcxx_class_requires(_Sequence, _SequenceConcept) __glibcxx_class_requires(_Sequence, _RandomAccessContainerConcept) __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept) __glibcxx_class_requires4(_Compare, bool, _Tp, _Tp, _BinaryFunctionConcept) public: typedef typename _Sequence::value_type value_type; typedef typename _Sequence::reference reference; typedef typename _Sequence::const_reference const_reference; typedef typename _Sequence::size_type size_type; typedef _Sequence container_type; protected: // See queue::c for notes on these names. _Sequence c; _Compare comp; public: /** * @brief Default constructor creates no elements. */ #if __cplusplus < 201103L explicit priority_queue(const _Compare& __x = _Compare(), const _Sequence& __s = _Sequence()) : c(__s), comp(__x) { std::make_heap(c.begin(), c.end(), comp); } #else explicit priority_queue(const _Compare& __x, const _Sequence& __s) : c(__s), comp(__x) { std::make_heap(c.begin(), c.end(), comp); } explicit priority_queue(const _Compare& __x = _Compare(), _Sequence&& __s = _Sequence()) : c(std::move(__s)), comp(__x) { std::make_heap(c.begin(), c.end(), comp); } #endif /** * @brief Builds a %queue from a range. * @param __first An input iterator. * @param __last An input iterator. * @param __x A comparison functor describing a strict weak ordering. * @param __s An initial sequence with which to start. * * Begins by copying @a __s, inserting a copy of the elements * from @a [first,last) into the copy of @a __s, then ordering * the copy according to @a __x. * * For more information on function objects, see the * documentation on @link functors functor base * classes@endlink. */ #if __cplusplus < 201103L template<typename _InputIterator> priority_queue(_InputIterator __first, _InputIterator __last, const _Compare& __x = _Compare(), const _Sequence& __s = _Sequence()) : c(__s), comp(__x) { __glibcxx_requires_valid_range(__first, __last); c.insert(c.end(), __first, __last); std::make_heap(c.begin(), c.end(), comp); } #else template<typename _InputIterator> priority_queue(_InputIterator __first, _InputIterator __last, const _Compare& __x, const _Sequence& __s) : c(__s), comp(__x) { __glibcxx_requires_valid_range(__first, __last); c.insert(c.end(), __first, __last); std::make_heap(c.begin(), c.end(), comp); } template<typename _InputIterator> priority_queue(_InputIterator __first, _InputIterator __last, const _Compare& __x = _Compare(), _Sequence&& __s = _Sequence()) : c(std::move(__s)), comp(__x) { __glibcxx_requires_valid_range(__first, __last); c.insert(c.end(), __first, __last); std::make_heap(c.begin(), c.end(), comp); } #endif /** * Returns true if the %queue is empty. */ bool empty() const { return c.empty(); } /** Returns the number of elements in the %queue. */ size_type size() const { return c.size(); } /** * Returns a read-only (constant) reference to the data at the first * element of the %queue. */ const_reference top() const { __glibcxx_requires_nonempty(); return c.front(); } /** * @brief Add data to the %queue. * @param __x Data to be added. * * This is a typical %queue operation. * The time complexity of the operation depends on the underlying * sequence. */ void push(const value_type& __x) { c.push_back(__x); std::push_heap(c.begin(), c.end(), comp); } #if __cplusplus >= 201103L void push(value_type&& __x) { c.push_back(std::move(__x)); std::push_heap(c.begin(), c.end(), comp); } template<typename... _Args> void emplace(_Args&&... __args) { c.emplace_back(std::forward<_Args>(__args)...); std::push_heap(c.begin(), c.end(), comp); } #endif /** * @brief Removes first element. * * This is a typical %queue operation. It shrinks the %queue * by one. The time complexity of the operation depends on the * underlying sequence. * * Note that no data is returned, and if the first element's * data is needed, it should be retrieved before pop() is * called. */ void pop() { __glibcxx_requires_nonempty(); std::pop_heap(c.begin(), c.end(), comp); c.pop_back(); } #if __cplusplus >= 201103L void swap(priority_queue& __pq) noexcept(noexcept(swap(c, __pq.c)) && noexcept(swap(comp, __pq.comp))) { using std::swap; swap(c, __pq.c); swap(comp, __pq.comp); } #endif }; // No equality/comparison operators are provided for priority_queue. #if __cplusplus >= 201103L template<typename _Tp, typename _Sequence, typename _Compare> inline void swap(priority_queue<_Tp, _Sequence, _Compare>& __x, priority_queue<_Tp, _Sequence, _Compare>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } template<typename _Tp, typename _Sequence, typename _Compare, typename _Alloc> struct uses_allocator<priority_queue<_Tp, _Sequence, _Compare>, _Alloc> : public uses_allocator<_Sequence, _Alloc>::type { }; #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _STL_QUEUE_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/locale_facets_nonio.tcc��������������������������������������������������������������0000644�����������������00000121546�14763166030�0013226 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Locale support -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/locale_facets_nonio.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{locale} */ #ifndef _LOCALE_FACETS_NONIO_TCC #define _LOCALE_FACETS_NONIO_TCC 1 #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _CharT, bool _Intl> struct __use_cache<__moneypunct_cache<_CharT, _Intl> > { const __moneypunct_cache<_CharT, _Intl>* operator() (const locale& __loc) const { const size_t __i = moneypunct<_CharT, _Intl>::id._M_id(); const locale::facet** __caches = __loc._M_impl->_M_caches; if (!__caches[__i]) { __moneypunct_cache<_CharT, _Intl>* __tmp = 0; __try { __tmp = new __moneypunct_cache<_CharT, _Intl>; __tmp->_M_cache(__loc); } __catch(...) { delete __tmp; __throw_exception_again; } __loc._M_impl->_M_install_cache(__tmp, __i); } return static_cast< const __moneypunct_cache<_CharT, _Intl>*>(__caches[__i]); } }; template<typename _CharT, bool _Intl> void __moneypunct_cache<_CharT, _Intl>::_M_cache(const locale& __loc) { _M_allocated = true; const moneypunct<_CharT, _Intl>& __mp = use_facet<moneypunct<_CharT, _Intl> >(__loc); _M_decimal_point = __mp.decimal_point(); _M_thousands_sep = __mp.thousands_sep(); _M_frac_digits = __mp.frac_digits(); char* __grouping = 0; _CharT* __curr_symbol = 0; _CharT* __positive_sign = 0; _CharT* __negative_sign = 0; __try { _M_grouping_size = __mp.grouping().size(); __grouping = new char[_M_grouping_size]; __mp.grouping().copy(__grouping, _M_grouping_size); _M_grouping = __grouping; _M_use_grouping = (_M_grouping_size && static_cast<signed char>(_M_grouping[0]) > 0 && (_M_grouping[0] != __gnu_cxx::__numeric_traits<char>::__max)); _M_curr_symbol_size = __mp.curr_symbol().size(); __curr_symbol = new _CharT[_M_curr_symbol_size]; __mp.curr_symbol().copy(__curr_symbol, _M_curr_symbol_size); _M_curr_symbol = __curr_symbol; _M_positive_sign_size = __mp.positive_sign().size(); __positive_sign = new _CharT[_M_positive_sign_size]; __mp.positive_sign().copy(__positive_sign, _M_positive_sign_size); _M_positive_sign = __positive_sign; _M_negative_sign_size = __mp.negative_sign().size(); __negative_sign = new _CharT[_M_negative_sign_size]; __mp.negative_sign().copy(__negative_sign, _M_negative_sign_size); _M_negative_sign = __negative_sign; _M_pos_format = __mp.pos_format(); _M_neg_format = __mp.neg_format(); const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc); __ct.widen(money_base::_S_atoms, money_base::_S_atoms + money_base::_S_end, _M_atoms); } __catch(...) { delete [] __grouping; delete [] __curr_symbol; delete [] __positive_sign; delete [] __negative_sign; __throw_exception_again; } } _GLIBCXX_BEGIN_NAMESPACE_LDBL template<typename _CharT, typename _InIter> template<bool _Intl> _InIter money_get<_CharT, _InIter>:: _M_extract(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, string& __units) const { typedef char_traits<_CharT> __traits_type; typedef typename string_type::size_type size_type; typedef money_base::part part; typedef __moneypunct_cache<_CharT, _Intl> __cache_type; const locale& __loc = __io._M_getloc(); const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); __use_cache<__cache_type> __uc; const __cache_type* __lc = __uc(__loc); const char_type* __lit = __lc->_M_atoms; // Deduced sign. bool __negative = false; // Sign size. size_type __sign_size = 0; // True if sign is mandatory. const bool __mandatory_sign = (__lc->_M_positive_sign_size && __lc->_M_negative_sign_size); // String of grouping info from thousands_sep plucked from __units. string __grouping_tmp; if (__lc->_M_use_grouping) __grouping_tmp.reserve(32); // Last position before the decimal point. int __last_pos = 0; // Separator positions, then, possibly, fractional digits. int __n = 0; // If input iterator is in a valid state. bool __testvalid = true; // Flag marking when a decimal point is found. bool __testdecfound = false; // The tentative returned string is stored here. string __res; __res.reserve(32); const char_type* __lit_zero = __lit + money_base::_S_zero; const money_base::pattern __p = __lc->_M_neg_format; for (int __i = 0; __i < 4 && __testvalid; ++__i) { const part __which = static_cast<part>(__p.field[__i]); switch (__which) { case money_base::symbol: // According to 22.2.6.1.2, p2, symbol is required // if (__io.flags() & ios_base::showbase), otherwise // is optional and consumed only if other characters // are needed to complete the format. if (__io.flags() & ios_base::showbase || __sign_size > 1 || __i == 0 || (__i == 1 && (__mandatory_sign || (static_cast<part>(__p.field[0]) == money_base::sign) || (static_cast<part>(__p.field[2]) == money_base::space))) || (__i == 2 && ((static_cast<part>(__p.field[3]) == money_base::value) || (__mandatory_sign && (static_cast<part>(__p.field[3]) == money_base::sign))))) { const size_type __len = __lc->_M_curr_symbol_size; size_type __j = 0; for (; __beg != __end && __j < __len && *__beg == __lc->_M_curr_symbol[__j]; ++__beg, ++__j); if (__j != __len && (__j || __io.flags() & ios_base::showbase)) __testvalid = false; } break; case money_base::sign: // Sign might not exist, or be more than one character long. if (__lc->_M_positive_sign_size && __beg != __end && *__beg == __lc->_M_positive_sign[0]) { __sign_size = __lc->_M_positive_sign_size; ++__beg; } else if (__lc->_M_negative_sign_size && __beg != __end && *__beg == __lc->_M_negative_sign[0]) { __negative = true; __sign_size = __lc->_M_negative_sign_size; ++__beg; } else if (__lc->_M_positive_sign_size && !__lc->_M_negative_sign_size) // "... if no sign is detected, the result is given the sign // that corresponds to the source of the empty string" __negative = true; else if (__mandatory_sign) __testvalid = false; break; case money_base::value: // Extract digits, remove and stash away the // grouping of found thousands separators. for (; __beg != __end; ++__beg) { const char_type __c = *__beg; const char_type* __q = __traits_type::find(__lit_zero, 10, __c); if (__q != 0) { __res += money_base::_S_atoms[__q - __lit]; ++__n; } else if (__c == __lc->_M_decimal_point && !__testdecfound) { if (__lc->_M_frac_digits <= 0) break; __last_pos = __n; __n = 0; __testdecfound = true; } else if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep && !__testdecfound) { if (__n) { // Mark position for later analysis. __grouping_tmp += static_cast<char>(__n); __n = 0; } else { __testvalid = false; break; } } else break; } if (__res.empty()) __testvalid = false; break; case money_base::space: // At least one space is required. if (__beg != __end && __ctype.is(ctype_base::space, *__beg)) ++__beg; else __testvalid = false; case money_base::none: // Only if not at the end of the pattern. if (__i != 3) for (; __beg != __end && __ctype.is(ctype_base::space, *__beg); ++__beg); break; } } // Need to get the rest of the sign characters, if they exist. if (__sign_size > 1 && __testvalid) { const char_type* __sign = __negative ? __lc->_M_negative_sign : __lc->_M_positive_sign; size_type __i = 1; for (; __beg != __end && __i < __sign_size && *__beg == __sign[__i]; ++__beg, ++__i); if (__i != __sign_size) __testvalid = false; } if (__testvalid) { // Strip leading zeros. if (__res.size() > 1) { const size_type __first = __res.find_first_not_of('0'); const bool __only_zeros = __first == string::npos; if (__first) __res.erase(0, __only_zeros ? __res.size() - 1 : __first); } // 22.2.6.1.2, p4 if (__negative && __res[0] != '0') __res.insert(__res.begin(), '-'); // Test for grouping fidelity. if (__grouping_tmp.size()) { // Add the ending grouping. __grouping_tmp += static_cast<char>(__testdecfound ? __last_pos : __n); if (!std::__verify_grouping(__lc->_M_grouping, __lc->_M_grouping_size, __grouping_tmp)) __err |= ios_base::failbit; } // Iff not enough digits were supplied after the decimal-point. if (__testdecfound && __n != __lc->_M_frac_digits) __testvalid = false; } // Iff valid sequence is not recognized. if (!__testvalid) __err |= ios_base::failbit; else __units.swap(__res); // Iff no more characters are available. if (__beg == __end) __err |= ios_base::eofbit; return __beg; } #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ template<typename _CharT, typename _InIter> _InIter money_get<_CharT, _InIter>:: __do_get(iter_type __beg, iter_type __end, bool __intl, ios_base& __io, ios_base::iostate& __err, double& __units) const { string __str; __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str) : _M_extract<false>(__beg, __end, __io, __err, __str); std::__convert_to_v(__str.c_str(), __units, __err, _S_get_c_locale()); return __beg; } #endif template<typename _CharT, typename _InIter> _InIter money_get<_CharT, _InIter>:: do_get(iter_type __beg, iter_type __end, bool __intl, ios_base& __io, ios_base::iostate& __err, long double& __units) const { string __str; __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str) : _M_extract<false>(__beg, __end, __io, __err, __str); std::__convert_to_v(__str.c_str(), __units, __err, _S_get_c_locale()); return __beg; } template<typename _CharT, typename _InIter> _InIter money_get<_CharT, _InIter>:: do_get(iter_type __beg, iter_type __end, bool __intl, ios_base& __io, ios_base::iostate& __err, string_type& __digits) const { typedef typename string::size_type size_type; const locale& __loc = __io._M_getloc(); const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); string __str; __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str) : _M_extract<false>(__beg, __end, __io, __err, __str); const size_type __len = __str.size(); if (__len) { __digits.resize(__len); __ctype.widen(__str.data(), __str.data() + __len, &__digits[0]); } return __beg; } template<typename _CharT, typename _OutIter> template<bool _Intl> _OutIter money_put<_CharT, _OutIter>:: _M_insert(iter_type __s, ios_base& __io, char_type __fill, const string_type& __digits) const { typedef typename string_type::size_type size_type; typedef money_base::part part; typedef __moneypunct_cache<_CharT, _Intl> __cache_type; const locale& __loc = __io._M_getloc(); const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); __use_cache<__cache_type> __uc; const __cache_type* __lc = __uc(__loc); const char_type* __lit = __lc->_M_atoms; // Determine if negative or positive formats are to be used, and // discard leading negative_sign if it is present. const char_type* __beg = __digits.data(); money_base::pattern __p; const char_type* __sign; size_type __sign_size; if (!(*__beg == __lit[money_base::_S_minus])) { __p = __lc->_M_pos_format; __sign = __lc->_M_positive_sign; __sign_size = __lc->_M_positive_sign_size; } else { __p = __lc->_M_neg_format; __sign = __lc->_M_negative_sign; __sign_size = __lc->_M_negative_sign_size; if (__digits.size()) ++__beg; } // Look for valid numbers in the ctype facet within input digits. size_type __len = __ctype.scan_not(ctype_base::digit, __beg, __beg + __digits.size()) - __beg; if (__len) { // Assume valid input, and attempt to format. // Break down input numbers into base components, as follows: // final_value = grouped units + (decimal point) + (digits) string_type __value; __value.reserve(2 * __len); // Add thousands separators to non-decimal digits, per // grouping rules. long __paddec = __len - __lc->_M_frac_digits; if (__paddec > 0) { if (__lc->_M_frac_digits < 0) __paddec = __len; if (__lc->_M_grouping_size) { __value.assign(2 * __paddec, char_type()); _CharT* __vend = std::__add_grouping(&__value[0], __lc->_M_thousands_sep, __lc->_M_grouping, __lc->_M_grouping_size, __beg, __beg + __paddec); __value.erase(__vend - &__value[0]); } else __value.assign(__beg, __paddec); } // Deal with decimal point, decimal digits. if (__lc->_M_frac_digits > 0) { __value += __lc->_M_decimal_point; if (__paddec >= 0) __value.append(__beg + __paddec, __lc->_M_frac_digits); else { // Have to pad zeros in the decimal position. __value.append(-__paddec, __lit[money_base::_S_zero]); __value.append(__beg, __len); } } // Calculate length of resulting string. const ios_base::fmtflags __f = __io.flags() & ios_base::adjustfield; __len = __value.size() + __sign_size; __len += ((__io.flags() & ios_base::showbase) ? __lc->_M_curr_symbol_size : 0); string_type __res; __res.reserve(2 * __len); const size_type __width = static_cast<size_type>(__io.width()); const bool __testipad = (__f == ios_base::internal && __len < __width); // Fit formatted digits into the required pattern. for (int __i = 0; __i < 4; ++__i) { const part __which = static_cast<part>(__p.field[__i]); switch (__which) { case money_base::symbol: if (__io.flags() & ios_base::showbase) __res.append(__lc->_M_curr_symbol, __lc->_M_curr_symbol_size); break; case money_base::sign: // Sign might not exist, or be more than one // character long. In that case, add in the rest // below. if (__sign_size) __res += __sign[0]; break; case money_base::value: __res += __value; break; case money_base::space: // At least one space is required, but if internal // formatting is required, an arbitrary number of // fill spaces will be necessary. if (__testipad) __res.append(__width - __len, __fill); else __res += __fill; break; case money_base::none: if (__testipad) __res.append(__width - __len, __fill); break; } } // Special case of multi-part sign parts. if (__sign_size > 1) __res.append(__sign + 1, __sign_size - 1); // Pad, if still necessary. __len = __res.size(); if (__width > __len) { if (__f == ios_base::left) // After. __res.append(__width - __len, __fill); else // Before. __res.insert(0, __width - __len, __fill); __len = __width; } // Write resulting, fully-formatted string to output iterator. __s = std::__write(__s, __res.data(), __len); } __io.width(0); return __s; } #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ template<typename _CharT, typename _OutIter> _OutIter money_put<_CharT, _OutIter>:: __do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, double __units) const { return this->do_put(__s, __intl, __io, __fill, (long double) __units); } #endif template<typename _CharT, typename _OutIter> _OutIter money_put<_CharT, _OutIter>:: do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, long double __units) const { const locale __loc = __io.getloc(); const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); #ifdef _GLIBCXX_USE_C99 // First try a buffer perhaps big enough. int __cs_size = 64; char* __cs = static_cast<char*>(__builtin_alloca(__cs_size)); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 328. Bad sprintf format modifier in money_put<>::do_put() int __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, "%.*Lf", 0, __units); // If the buffer was not large enough, try again with the correct size. if (__len >= __cs_size) { __cs_size = __len + 1; __cs = static_cast<char*>(__builtin_alloca(__cs_size)); __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, "%.*Lf", 0, __units); } #else // max_exponent10 + 1 for the integer part, + 2 for sign and '\0'. const int __cs_size = __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 3; char* __cs = static_cast<char*>(__builtin_alloca(__cs_size)); int __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, "%.*Lf", 0, __units); #endif string_type __digits(__len, char_type()); __ctype.widen(__cs, __cs + __len, &__digits[0]); return __intl ? _M_insert<true>(__s, __io, __fill, __digits) : _M_insert<false>(__s, __io, __fill, __digits); } template<typename _CharT, typename _OutIter> _OutIter money_put<_CharT, _OutIter>:: do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, const string_type& __digits) const { return __intl ? _M_insert<true>(__s, __io, __fill, __digits) : _M_insert<false>(__s, __io, __fill, __digits); } _GLIBCXX_END_NAMESPACE_LDBL // NB: Not especially useful. Without an ios_base object or some // kind of locale reference, we are left clawing at the air where // the side of the mountain used to be... template<typename _CharT, typename _InIter> time_base::dateorder time_get<_CharT, _InIter>::do_date_order() const { return time_base::no_order; } // Expand a strftime format string and parse it. E.g., do_get_date() may // pass %m/%d/%Y => extracted characters. template<typename _CharT, typename _InIter> _InIter time_get<_CharT, _InIter>:: _M_extract_via_format(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, tm* __tm, const _CharT* __format) const { const locale& __loc = __io._M_getloc(); const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); const size_t __len = char_traits<_CharT>::length(__format); ios_base::iostate __tmperr = ios_base::goodbit; size_t __i = 0; for (; __beg != __end && __i < __len && !__tmperr; ++__i) { if (__ctype.narrow(__format[__i], 0) == '%') { // Verify valid formatting code, attempt to extract. char __c = __ctype.narrow(__format[++__i], 0); int __mem = 0; if (__c == 'E' || __c == 'O') __c = __ctype.narrow(__format[++__i], 0); switch (__c) { const char* __cs; _CharT __wcs[10]; case 'a': // Abbreviated weekday name [tm_wday] const char_type* __days1[7]; __tp._M_days_abbreviated(__days1); __beg = _M_extract_name(__beg, __end, __tm->tm_wday, __days1, 7, __io, __tmperr); break; case 'A': // Weekday name [tm_wday]. const char_type* __days2[7]; __tp._M_days(__days2); __beg = _M_extract_name(__beg, __end, __tm->tm_wday, __days2, 7, __io, __tmperr); break; case 'h': case 'b': // Abbreviated month name [tm_mon] const char_type* __months1[12]; __tp._M_months_abbreviated(__months1); __beg = _M_extract_name(__beg, __end, __tm->tm_mon, __months1, 12, __io, __tmperr); break; case 'B': // Month name [tm_mon]. const char_type* __months2[12]; __tp._M_months(__months2); __beg = _M_extract_name(__beg, __end, __tm->tm_mon, __months2, 12, __io, __tmperr); break; case 'c': // Default time and date representation. const char_type* __dt[2]; __tp._M_date_time_formats(__dt); __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, __tm, __dt[0]); break; case 'd': // Day [01, 31]. [tm_mday] __beg = _M_extract_num(__beg, __end, __tm->tm_mday, 1, 31, 2, __io, __tmperr); break; case 'e': // Day [1, 31], with single digits preceded by // space. [tm_mday] if (__ctype.is(ctype_base::space, *__beg)) __beg = _M_extract_num(++__beg, __end, __tm->tm_mday, 1, 9, 1, __io, __tmperr); else __beg = _M_extract_num(__beg, __end, __tm->tm_mday, 10, 31, 2, __io, __tmperr); break; case 'D': // Equivalent to %m/%d/%y.[tm_mon, tm_mday, tm_year] __cs = "%m/%d/%y"; __ctype.widen(__cs, __cs + 9, __wcs); __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, __tm, __wcs); break; case 'H': // Hour [00, 23]. [tm_hour] __beg = _M_extract_num(__beg, __end, __tm->tm_hour, 0, 23, 2, __io, __tmperr); break; case 'I': // Hour [01, 12]. [tm_hour] __beg = _M_extract_num(__beg, __end, __tm->tm_hour, 1, 12, 2, __io, __tmperr); break; case 'm': // Month [01, 12]. [tm_mon] __beg = _M_extract_num(__beg, __end, __mem, 1, 12, 2, __io, __tmperr); if (!__tmperr) __tm->tm_mon = __mem - 1; break; case 'M': // Minute [00, 59]. [tm_min] __beg = _M_extract_num(__beg, __end, __tm->tm_min, 0, 59, 2, __io, __tmperr); break; case 'n': if (__ctype.narrow(*__beg, 0) == '\n') ++__beg; else __tmperr |= ios_base::failbit; break; case 'R': // Equivalent to (%H:%M). __cs = "%H:%M"; __ctype.widen(__cs, __cs + 6, __wcs); __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, __tm, __wcs); break; case 'S': // Seconds. [tm_sec] // [00, 60] in C99 (one leap-second), [00, 61] in C89. #ifdef _GLIBCXX_USE_C99 __beg = _M_extract_num(__beg, __end, __tm->tm_sec, 0, 60, 2, #else __beg = _M_extract_num(__beg, __end, __tm->tm_sec, 0, 61, 2, #endif __io, __tmperr); break; case 't': if (__ctype.narrow(*__beg, 0) == '\t') ++__beg; else __tmperr |= ios_base::failbit; break; case 'T': // Equivalent to (%H:%M:%S). __cs = "%H:%M:%S"; __ctype.widen(__cs, __cs + 9, __wcs); __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, __tm, __wcs); break; case 'x': // Locale's date. const char_type* __dates[2]; __tp._M_date_formats(__dates); __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, __tm, __dates[0]); break; case 'X': // Locale's time. const char_type* __times[2]; __tp._M_time_formats(__times); __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, __tm, __times[0]); break; case 'y': case 'C': // C99 // Two digit year. case 'Y': // Year [1900). // NB: We parse either two digits, implicitly years since // 1900, or 4 digits, full year. In both cases we can // reconstruct [tm_year]. See also libstdc++/26701. __beg = _M_extract_num(__beg, __end, __mem, 0, 9999, 4, __io, __tmperr); if (!__tmperr) __tm->tm_year = __mem < 0 ? __mem + 100 : __mem - 1900; break; case 'Z': // Timezone info. if (__ctype.is(ctype_base::upper, *__beg)) { int __tmp; __beg = _M_extract_name(__beg, __end, __tmp, __timepunct_cache<_CharT>::_S_timezones, 14, __io, __tmperr); // GMT requires special effort. if (__beg != __end && !__tmperr && __tmp == 0 && (*__beg == __ctype.widen('-') || *__beg == __ctype.widen('+'))) { __beg = _M_extract_num(__beg, __end, __tmp, 0, 23, 2, __io, __tmperr); __beg = _M_extract_num(__beg, __end, __tmp, 0, 59, 2, __io, __tmperr); } } else __tmperr |= ios_base::failbit; break; default: // Not recognized. __tmperr |= ios_base::failbit; } } else { // Verify format and input match, extract and discard. if (__format[__i] == *__beg) ++__beg; else __tmperr |= ios_base::failbit; } } if (__tmperr || __i != __len) __err |= ios_base::failbit; return __beg; } template<typename _CharT, typename _InIter> _InIter time_get<_CharT, _InIter>:: _M_extract_num(iter_type __beg, iter_type __end, int& __member, int __min, int __max, size_t __len, ios_base& __io, ios_base::iostate& __err) const { const locale& __loc = __io._M_getloc(); const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); // As-is works for __len = 1, 2, 4, the values actually used. int __mult = __len == 2 ? 10 : (__len == 4 ? 1000 : 1); ++__min; size_t __i = 0; int __value = 0; for (; __beg != __end && __i < __len; ++__beg, ++__i) { const char __c = __ctype.narrow(*__beg, '*'); if (__c >= '0' && __c <= '9') { __value = __value * 10 + (__c - '0'); const int __valuec = __value * __mult; if (__valuec > __max || __valuec + __mult < __min) break; __mult /= 10; } else break; } if (__i == __len) __member = __value; // Special encoding for do_get_year, 'y', and 'Y' above. else if (__len == 4 && __i == 2) __member = __value - 100; else __err |= ios_base::failbit; return __beg; } // Assumptions: // All elements in __names are unique. template<typename _CharT, typename _InIter> _InIter time_get<_CharT, _InIter>:: _M_extract_name(iter_type __beg, iter_type __end, int& __member, const _CharT** __names, size_t __indexlen, ios_base& __io, ios_base::iostate& __err) const { typedef char_traits<_CharT> __traits_type; const locale& __loc = __io._M_getloc(); const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); int* __matches = static_cast<int*>(__builtin_alloca(sizeof(int) * __indexlen)); size_t __nmatches = 0; size_t __pos = 0; bool __testvalid = true; const char_type* __name; // Look for initial matches. // NB: Some of the locale data is in the form of all lowercase // names, and some is in the form of initially-capitalized // names. Look for both. if (__beg != __end) { const char_type __c = *__beg; for (size_t __i1 = 0; __i1 < __indexlen; ++__i1) if (__c == __names[__i1][0] || __c == __ctype.toupper(__names[__i1][0])) __matches[__nmatches++] = __i1; } while (__nmatches > 1) { // Find smallest matching string. size_t __minlen = __traits_type::length(__names[__matches[0]]); for (size_t __i2 = 1; __i2 < __nmatches; ++__i2) __minlen = std::min(__minlen, __traits_type::length(__names[__matches[__i2]])); ++__beg, ++__pos; if (__pos < __minlen && __beg != __end) for (size_t __i3 = 0; __i3 < __nmatches;) { __name = __names[__matches[__i3]]; if (!(__name[__pos] == *__beg)) __matches[__i3] = __matches[--__nmatches]; else ++__i3; } else break; } if (__nmatches == 1) { // Make sure found name is completely extracted. ++__beg, ++__pos; __name = __names[__matches[0]]; const size_t __len = __traits_type::length(__name); while (__pos < __len && __beg != __end && __name[__pos] == *__beg) ++__beg, ++__pos; if (__len == __pos) __member = __matches[0]; else __testvalid = false; } else __testvalid = false; if (!__testvalid) __err |= ios_base::failbit; return __beg; } template<typename _CharT, typename _InIter> _InIter time_get<_CharT, _InIter>:: _M_extract_wday_or_month(iter_type __beg, iter_type __end, int& __member, const _CharT** __names, size_t __indexlen, ios_base& __io, ios_base::iostate& __err) const { typedef char_traits<_CharT> __traits_type; const locale& __loc = __io._M_getloc(); const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); int* __matches = static_cast<int*>(__builtin_alloca(2 * sizeof(int) * __indexlen)); size_t __nmatches = 0; size_t* __matches_lengths = 0; size_t __pos = 0; if (__beg != __end) { const char_type __c = *__beg; for (size_t __i = 0; __i < 2 * __indexlen; ++__i) if (__c == __names[__i][0] || __c == __ctype.toupper(__names[__i][0])) __matches[__nmatches++] = __i; } if (__nmatches) { ++__beg, ++__pos; __matches_lengths = static_cast<size_t*>(__builtin_alloca(sizeof(size_t) * __nmatches)); for (size_t __i = 0; __i < __nmatches; ++__i) __matches_lengths[__i] = __traits_type::length(__names[__matches[__i]]); } for (; __beg != __end; ++__beg, ++__pos) { size_t __nskipped = 0; const char_type __c = *__beg; for (size_t __i = 0; __i < __nmatches;) { const char_type* __name = __names[__matches[__i]]; if (__pos >= __matches_lengths[__i]) ++__nskipped, ++__i; else if (!(__name[__pos] == __c)) { --__nmatches; __matches[__i] = __matches[__nmatches]; __matches_lengths[__i] = __matches_lengths[__nmatches]; } else ++__i; } if (__nskipped == __nmatches) break; } if ((__nmatches == 1 && __matches_lengths[0] == __pos) || (__nmatches == 2 && (__matches_lengths[0] == __pos || __matches_lengths[1] == __pos))) __member = (__matches[0] >= __indexlen ? __matches[0] - __indexlen : __matches[0]); else __err |= ios_base::failbit; return __beg; } template<typename _CharT, typename _InIter> _InIter time_get<_CharT, _InIter>:: do_get_time(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, tm* __tm) const { const locale& __loc = __io._M_getloc(); const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); const char_type* __times[2]; __tp._M_time_formats(__times); __beg = _M_extract_via_format(__beg, __end, __io, __err, __tm, __times[0]); if (__beg == __end) __err |= ios_base::eofbit; return __beg; } template<typename _CharT, typename _InIter> _InIter time_get<_CharT, _InIter>:: do_get_date(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, tm* __tm) const { const locale& __loc = __io._M_getloc(); const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); const char_type* __dates[2]; __tp._M_date_formats(__dates); __beg = _M_extract_via_format(__beg, __end, __io, __err, __tm, __dates[0]); if (__beg == __end) __err |= ios_base::eofbit; return __beg; } template<typename _CharT, typename _InIter> _InIter time_get<_CharT, _InIter>:: do_get_weekday(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, tm* __tm) const { typedef char_traits<_CharT> __traits_type; const locale& __loc = __io._M_getloc(); const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); const char_type* __days[14]; __tp._M_days_abbreviated(__days); __tp._M_days(__days + 7); int __tmpwday; ios_base::iostate __tmperr = ios_base::goodbit; __beg = _M_extract_wday_or_month(__beg, __end, __tmpwday, __days, 7, __io, __tmperr); if (!__tmperr) __tm->tm_wday = __tmpwday; else __err |= ios_base::failbit; if (__beg == __end) __err |= ios_base::eofbit; return __beg; } template<typename _CharT, typename _InIter> _InIter time_get<_CharT, _InIter>:: do_get_monthname(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, tm* __tm) const { typedef char_traits<_CharT> __traits_type; const locale& __loc = __io._M_getloc(); const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); const char_type* __months[24]; __tp._M_months_abbreviated(__months); __tp._M_months(__months + 12); int __tmpmon; ios_base::iostate __tmperr = ios_base::goodbit; __beg = _M_extract_wday_or_month(__beg, __end, __tmpmon, __months, 12, __io, __tmperr); if (!__tmperr) __tm->tm_mon = __tmpmon; else __err |= ios_base::failbit; if (__beg == __end) __err |= ios_base::eofbit; return __beg; } template<typename _CharT, typename _InIter> _InIter time_get<_CharT, _InIter>:: do_get_year(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, tm* __tm) const { const locale& __loc = __io._M_getloc(); const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); int __tmpyear; ios_base::iostate __tmperr = ios_base::goodbit; __beg = _M_extract_num(__beg, __end, __tmpyear, 0, 9999, 4, __io, __tmperr); if (!__tmperr) __tm->tm_year = __tmpyear < 0 ? __tmpyear + 100 : __tmpyear - 1900; else __err |= ios_base::failbit; if (__beg == __end) __err |= ios_base::eofbit; return __beg; } template<typename _CharT, typename _OutIter> _OutIter time_put<_CharT, _OutIter>:: put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm, const _CharT* __beg, const _CharT* __end) const { const locale& __loc = __io._M_getloc(); ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc); for (; __beg != __end; ++__beg) if (__ctype.narrow(*__beg, 0) != '%') { *__s = *__beg; ++__s; } else if (++__beg != __end) { char __format; char __mod = 0; const char __c = __ctype.narrow(*__beg, 0); if (__c != 'E' && __c != 'O') __format = __c; else if (++__beg != __end) { __mod = __c; __format = __ctype.narrow(*__beg, 0); } else break; __s = this->do_put(__s, __io, __fill, __tm, __format, __mod); } else break; return __s; } template<typename _CharT, typename _OutIter> _OutIter time_put<_CharT, _OutIter>:: do_put(iter_type __s, ios_base& __io, char_type, const tm* __tm, char __format, char __mod) const { const locale& __loc = __io._M_getloc(); ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc); __timepunct<_CharT> const& __tp = use_facet<__timepunct<_CharT> >(__loc); // NB: This size is arbitrary. Should this be a data member, // initialized at construction? const size_t __maxlen = 128; char_type __res[__maxlen]; // NB: In IEE 1003.1-200x, and perhaps other locale models, it // is possible that the format character will be longer than one // character. Possibilities include 'E' or 'O' followed by a // format character: if __mod is not the default argument, assume // it's a valid modifier. char_type __fmt[4]; __fmt[0] = __ctype.widen('%'); if (!__mod) { __fmt[1] = __format; __fmt[2] = char_type(); } else { __fmt[1] = __mod; __fmt[2] = __format; __fmt[3] = char_type(); } __tp._M_put(__res, __maxlen, __fmt, __tm); // Write resulting, fully-formatted string to output iterator. return std::__write(__s, __res, char_traits<char_type>::length(__res)); } // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. #if _GLIBCXX_EXTERN_TEMPLATE extern template class moneypunct<char, false>; extern template class moneypunct<char, true>; extern template class moneypunct_byname<char, false>; extern template class moneypunct_byname<char, true>; extern template class _GLIBCXX_NAMESPACE_LDBL money_get<char>; extern template class _GLIBCXX_NAMESPACE_LDBL money_put<char>; extern template class __timepunct<char>; extern template class time_put<char>; extern template class time_put_byname<char>; extern template class time_get<char>; extern template class time_get_byname<char>; extern template class messages<char>; extern template class messages_byname<char>; extern template const moneypunct<char, true>& use_facet<moneypunct<char, true> >(const locale&); extern template const moneypunct<char, false>& use_facet<moneypunct<char, false> >(const locale&); extern template const money_put<char>& use_facet<money_put<char> >(const locale&); extern template const money_get<char>& use_facet<money_get<char> >(const locale&); extern template const __timepunct<char>& use_facet<__timepunct<char> >(const locale&); extern template const time_put<char>& use_facet<time_put<char> >(const locale&); extern template const time_get<char>& use_facet<time_get<char> >(const locale&); extern template const messages<char>& use_facet<messages<char> >(const locale&); extern template bool has_facet<moneypunct<char> >(const locale&); extern template bool has_facet<money_put<char> >(const locale&); extern template bool has_facet<money_get<char> >(const locale&); extern template bool has_facet<__timepunct<char> >(const locale&); extern template bool has_facet<time_put<char> >(const locale&); extern template bool has_facet<time_get<char> >(const locale&); extern template bool has_facet<messages<char> >(const locale&); #ifdef _GLIBCXX_USE_WCHAR_T extern template class moneypunct<wchar_t, false>; extern template class moneypunct<wchar_t, true>; extern template class moneypunct_byname<wchar_t, false>; extern template class moneypunct_byname<wchar_t, true>; extern template class _GLIBCXX_NAMESPACE_LDBL money_get<wchar_t>; extern template class _GLIBCXX_NAMESPACE_LDBL money_put<wchar_t>; extern template class __timepunct<wchar_t>; extern template class time_put<wchar_t>; extern template class time_put_byname<wchar_t>; extern template class time_get<wchar_t>; extern template class time_get_byname<wchar_t>; extern template class messages<wchar_t>; extern template class messages_byname<wchar_t>; extern template const moneypunct<wchar_t, true>& use_facet<moneypunct<wchar_t, true> >(const locale&); extern template const moneypunct<wchar_t, false>& use_facet<moneypunct<wchar_t, false> >(const locale&); extern template const money_put<wchar_t>& use_facet<money_put<wchar_t> >(const locale&); extern template const money_get<wchar_t>& use_facet<money_get<wchar_t> >(const locale&); extern template const __timepunct<wchar_t>& use_facet<__timepunct<wchar_t> >(const locale&); extern template const time_put<wchar_t>& use_facet<time_put<wchar_t> >(const locale&); extern template const time_get<wchar_t>& use_facet<time_get<wchar_t> >(const locale&); extern template const messages<wchar_t>& use_facet<messages<wchar_t> >(const locale&); extern template bool has_facet<moneypunct<wchar_t> >(const locale&); extern template bool has_facet<money_put<wchar_t> >(const locale&); extern template bool has_facet<money_get<wchar_t> >(const locale&); extern template bool has_facet<__timepunct<wchar_t> >(const locale&); extern template bool has_facet<time_put<wchar_t> >(const locale&); extern template bool has_facet<time_get<wchar_t> >(const locale&); extern template bool has_facet<messages<wchar_t> >(const locale&); #endif #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_list.h���������������������������������������������������������������������������0000644�����������������00000151516�14763166030�0010553 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// List implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_list.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{list} */ #ifndef _STL_LIST_H #define _STL_LIST_H 1 #include <bits/concept_check.h> #if __cplusplus >= 201103L #include <initializer_list> #endif namespace std _GLIBCXX_VISIBILITY(default) { namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Supporting structures are split into common and templated // types; the latter publicly inherits from the former in an // effort to reduce code duplication. This results in some // "needless" static_cast'ing later on, but it's all safe // downcasting. /// Common part of a node in the %list. struct _List_node_base { _List_node_base* _M_next; _List_node_base* _M_prev; static void swap(_List_node_base& __x, _List_node_base& __y) _GLIBCXX_USE_NOEXCEPT; void _M_transfer(_List_node_base* const __first, _List_node_base* const __last) _GLIBCXX_USE_NOEXCEPT; void _M_reverse() _GLIBCXX_USE_NOEXCEPT; void _M_hook(_List_node_base* const __position) _GLIBCXX_USE_NOEXCEPT; void _M_unhook() _GLIBCXX_USE_NOEXCEPT; }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace detail _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /// An actual node in the %list. template<typename _Tp> struct _List_node : public __detail::_List_node_base { ///< User's data. _Tp _M_data; #if __cplusplus >= 201103L template<typename... _Args> _List_node(_Args&&... __args) : __detail::_List_node_base(), _M_data(std::forward<_Args>(__args)...) { } #endif }; /** * @brief A list::iterator. * * All the functions are op overloads. */ template<typename _Tp> struct _List_iterator { typedef _List_iterator<_Tp> _Self; typedef _List_node<_Tp> _Node; typedef ptrdiff_t difference_type; typedef std::bidirectional_iterator_tag iterator_category; typedef _Tp value_type; typedef _Tp* pointer; typedef _Tp& reference; _List_iterator() : _M_node() { } explicit _List_iterator(__detail::_List_node_base* __x) : _M_node(__x) { } // Must downcast from _List_node_base to _List_node to get to _M_data. reference operator*() const { return static_cast<_Node*>(_M_node)->_M_data; } pointer operator->() const { return std::__addressof(static_cast<_Node*>(_M_node)->_M_data); } _Self& operator++() { _M_node = _M_node->_M_next; return *this; } _Self operator++(int) { _Self __tmp = *this; _M_node = _M_node->_M_next; return __tmp; } _Self& operator--() { _M_node = _M_node->_M_prev; return *this; } _Self operator--(int) { _Self __tmp = *this; _M_node = _M_node->_M_prev; return __tmp; } bool operator==(const _Self& __x) const { return _M_node == __x._M_node; } bool operator!=(const _Self& __x) const { return _M_node != __x._M_node; } // The only member points to the %list element. __detail::_List_node_base* _M_node; }; /** * @brief A list::const_iterator. * * All the functions are op overloads. */ template<typename _Tp> struct _List_const_iterator { typedef _List_const_iterator<_Tp> _Self; typedef const _List_node<_Tp> _Node; typedef _List_iterator<_Tp> iterator; typedef ptrdiff_t difference_type; typedef std::bidirectional_iterator_tag iterator_category; typedef _Tp value_type; typedef const _Tp* pointer; typedef const _Tp& reference; _List_const_iterator() : _M_node() { } explicit _List_const_iterator(const __detail::_List_node_base* __x) : _M_node(__x) { } _List_const_iterator(const iterator& __x) : _M_node(__x._M_node) { } // Must downcast from List_node_base to _List_node to get to // _M_data. reference operator*() const { return static_cast<_Node*>(_M_node)->_M_data; } pointer operator->() const { return std::__addressof(static_cast<_Node*>(_M_node)->_M_data); } _Self& operator++() { _M_node = _M_node->_M_next; return *this; } _Self operator++(int) { _Self __tmp = *this; _M_node = _M_node->_M_next; return __tmp; } _Self& operator--() { _M_node = _M_node->_M_prev; return *this; } _Self operator--(int) { _Self __tmp = *this; _M_node = _M_node->_M_prev; return __tmp; } bool operator==(const _Self& __x) const { return _M_node == __x._M_node; } bool operator!=(const _Self& __x) const { return _M_node != __x._M_node; } // The only member points to the %list element. const __detail::_List_node_base* _M_node; }; template<typename _Val> inline bool operator==(const _List_iterator<_Val>& __x, const _List_const_iterator<_Val>& __y) { return __x._M_node == __y._M_node; } template<typename _Val> inline bool operator!=(const _List_iterator<_Val>& __x, const _List_const_iterator<_Val>& __y) { return __x._M_node != __y._M_node; } /// See bits/stl_deque.h's _Deque_base for an explanation. template<typename _Tp, typename _Alloc> class _List_base { protected: // NOTA BENE // The stored instance is not actually of "allocator_type"'s // type. Instead we rebind the type to // Allocator<List_node<Tp>>, which according to [20.1.5]/4 // should probably be the same. List_node<Tp> is not the same // size as Tp (it's two pointers larger), and specializations on // Tp may go unused because List_node<Tp> is being bound // instead. // // We put this to the test in the constructors and in // get_allocator, where we use conversions between // allocator_type and _Node_alloc_type. The conversion is // required by table 32 in [20.1.5]. typedef typename _Alloc::template rebind<_List_node<_Tp> >::other _Node_alloc_type; typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type; struct _List_impl : public _Node_alloc_type { __detail::_List_node_base _M_node; _List_impl() : _Node_alloc_type(), _M_node() { } _List_impl(const _Node_alloc_type& __a) : _Node_alloc_type(__a), _M_node() { } #if __cplusplus >= 201103L _List_impl(_Node_alloc_type&& __a) : _Node_alloc_type(std::move(__a)), _M_node() { } #endif }; _List_impl _M_impl; _List_node<_Tp>* _M_get_node() { return _M_impl._Node_alloc_type::allocate(1); } void _M_put_node(_List_node<_Tp>* __p) { _M_impl._Node_alloc_type::deallocate(__p, 1); } public: typedef _Alloc allocator_type; _Node_alloc_type& _M_get_Node_allocator() _GLIBCXX_NOEXCEPT { return *static_cast<_Node_alloc_type*>(&_M_impl); } const _Node_alloc_type& _M_get_Node_allocator() const _GLIBCXX_NOEXCEPT { return *static_cast<const _Node_alloc_type*>(&_M_impl); } _Tp_alloc_type _M_get_Tp_allocator() const _GLIBCXX_NOEXCEPT { return _Tp_alloc_type(_M_get_Node_allocator()); } allocator_type get_allocator() const _GLIBCXX_NOEXCEPT { return allocator_type(_M_get_Node_allocator()); } _List_base() : _M_impl() { _M_init(); } _List_base(const _Node_alloc_type& __a) : _M_impl(__a) { _M_init(); } #if __cplusplus >= 201103L _List_base(_List_base&& __x) : _M_impl(std::move(__x._M_get_Node_allocator())) { _M_init(); __detail::_List_node_base::swap(_M_impl._M_node, __x._M_impl._M_node); } #endif // This is what actually destroys the list. ~_List_base() _GLIBCXX_NOEXCEPT { _M_clear(); } void _M_clear(); void _M_init() { this->_M_impl._M_node._M_next = &this->_M_impl._M_node; this->_M_impl._M_node._M_prev = &this->_M_impl._M_node; } }; /** * @brief A standard container with linear time access to elements, * and fixed time insertion/deletion at any point in the sequence. * * @ingroup sequences * * @tparam _Tp Type of element. * @tparam _Alloc Allocator type, defaults to allocator<_Tp>. * * Meets the requirements of a <a href="tables.html#65">container</a>, a * <a href="tables.html#66">reversible container</a>, and a * <a href="tables.html#67">sequence</a>, including the * <a href="tables.html#68">optional sequence requirements</a> with the * %exception of @c at and @c operator[]. * * This is a @e doubly @e linked %list. Traversal up and down the * %list requires linear time, but adding and removing elements (or * @e nodes) is done in constant time, regardless of where the * change takes place. Unlike std::vector and std::deque, * random-access iterators are not provided, so subscripting ( @c * [] ) access is not allowed. For algorithms which only need * sequential access, this lack makes no difference. * * Also unlike the other standard containers, std::list provides * specialized algorithms %unique to linked lists, such as * splicing, sorting, and in-place reversal. * * A couple points on memory allocation for list<Tp>: * * First, we never actually allocate a Tp, we allocate * List_node<Tp>'s and trust [20.1.5]/4 to DTRT. This is to ensure * that after elements from %list<X,Alloc1> are spliced into * %list<X,Alloc2>, destroying the memory of the second %list is a * valid operation, i.e., Alloc1 giveth and Alloc2 taketh away. * * Second, a %list conceptually represented as * @code * A <---> B <---> C <---> D * @endcode * is actually circular; a link exists between A and D. The %list * class holds (as its only data member) a private list::iterator * pointing to @e D, not to @e A! To get to the head of the %list, * we start at the tail and move forward by one. When this member * iterator's next/previous pointers refer to itself, the %list is * %empty. */ template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class list : protected _List_base<_Tp, _Alloc> { // concept requirements typedef typename _Alloc::value_type _Alloc_value_type; __glibcxx_class_requires(_Tp, _SGIAssignableConcept) __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept) typedef _List_base<_Tp, _Alloc> _Base; typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; typedef typename _Base::_Node_alloc_type _Node_alloc_type; public: typedef _Tp value_type; typedef typename _Tp_alloc_type::pointer pointer; typedef typename _Tp_alloc_type::const_pointer const_pointer; typedef typename _Tp_alloc_type::reference reference; typedef typename _Tp_alloc_type::const_reference const_reference; typedef _List_iterator<_Tp> iterator; typedef _List_const_iterator<_Tp> const_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<iterator> reverse_iterator; typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Alloc allocator_type; protected: // Note that pointers-to-_Node's can be ctor-converted to // iterator types. typedef _List_node<_Tp> _Node; using _Base::_M_impl; using _Base::_M_put_node; using _Base::_M_get_node; using _Base::_M_get_Tp_allocator; using _Base::_M_get_Node_allocator; /** * @param __args An instance of user data. * * Allocates space for a new node and constructs a copy of * @a __args in it. */ #if __cplusplus < 201103L _Node* _M_create_node(const value_type& __x) { _Node* __p = this->_M_get_node(); __try { _M_get_Tp_allocator().construct (std::__addressof(__p->_M_data), __x); } __catch(...) { _M_put_node(__p); __throw_exception_again; } return __p; } #else template<typename... _Args> _Node* _M_create_node(_Args&&... __args) { _Node* __p = this->_M_get_node(); __try { _M_get_Node_allocator().construct(__p, std::forward<_Args>(__args)...); } __catch(...) { _M_put_node(__p); __throw_exception_again; } return __p; } #endif public: // [23.2.2.1] construct/copy/destroy // (assign() and get_allocator() are also listed in this section) /** * @brief Default constructor creates no elements. */ list() : _Base() { } /** * @brief Creates a %list with no elements. * @param __a An allocator object. */ explicit list(const allocator_type& __a) : _Base(_Node_alloc_type(__a)) { } #if __cplusplus >= 201103L /** * @brief Creates a %list with default constructed elements. * @param __n The number of elements to initially create. * * This constructor fills the %list with @a __n default * constructed elements. */ explicit list(size_type __n) : _Base() { _M_default_initialize(__n); } /** * @brief Creates a %list with copies of an exemplar element. * @param __n The number of elements to initially create. * @param __value An element to copy. * @param __a An allocator object. * * This constructor fills the %list with @a __n copies of @a __value. */ list(size_type __n, const value_type& __value, const allocator_type& __a = allocator_type()) : _Base(_Node_alloc_type(__a)) { _M_fill_initialize(__n, __value); } #else /** * @brief Creates a %list with copies of an exemplar element. * @param __n The number of elements to initially create. * @param __value An element to copy. * @param __a An allocator object. * * This constructor fills the %list with @a __n copies of @a __value. */ explicit list(size_type __n, const value_type& __value = value_type(), const allocator_type& __a = allocator_type()) : _Base(_Node_alloc_type(__a)) { _M_fill_initialize(__n, __value); } #endif /** * @brief %List copy constructor. * @param __x A %list of identical element and allocator types. * * The newly-created %list uses a copy of the allocation object used * by @a __x. */ list(const list& __x) : _Base(__x._M_get_Node_allocator()) { _M_initialize_dispatch(__x.begin(), __x.end(), __false_type()); } #if __cplusplus >= 201103L /** * @brief %List move constructor. * @param __x A %list of identical element and allocator types. * * The newly-created %list contains the exact contents of @a __x. * The contents of @a __x are a valid, but unspecified %list. */ list(list&& __x) noexcept : _Base(std::move(__x)) { } /** * @brief Builds a %list from an initializer_list * @param __l An initializer_list of value_type. * @param __a An allocator object. * * Create a %list consisting of copies of the elements in the * initializer_list @a __l. This is linear in __l.size(). */ list(initializer_list<value_type> __l, const allocator_type& __a = allocator_type()) : _Base(_Node_alloc_type(__a)) { _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); } #endif /** * @brief Builds a %list from a range. * @param __first An input iterator. * @param __last An input iterator. * @param __a An allocator object. * * Create a %list consisting of copies of the elements from * [@a __first,@a __last). This is linear in N (where N is * distance(@a __first,@a __last)). */ #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> list(_InputIterator __first, _InputIterator __last, const allocator_type& __a = allocator_type()) : _Base(_Node_alloc_type(__a)) { _M_initialize_dispatch(__first, __last, __false_type()); } #else template<typename _InputIterator> list(_InputIterator __first, _InputIterator __last, const allocator_type& __a = allocator_type()) : _Base(_Node_alloc_type(__a)) { // Check whether it's an integral type. If so, it's not an iterator. typedef typename std::__is_integer<_InputIterator>::__type _Integral; _M_initialize_dispatch(__first, __last, _Integral()); } #endif /** * No explicit dtor needed as the _Base dtor takes care of * things. The _Base dtor only erases the elements, and note * that if the elements themselves are pointers, the pointed-to * memory is not touched in any way. Managing the pointer is * the user's responsibility. */ /** * @brief %List assignment operator. * @param __x A %list of identical element and allocator types. * * All the elements of @a __x are copied, but unlike the copy * constructor, the allocator object is not copied. */ list& operator=(const list& __x); #if __cplusplus >= 201103L /** * @brief %List move assignment operator. * @param __x A %list of identical element and allocator types. * * The contents of @a __x are moved into this %list (without copying). * @a __x is a valid, but unspecified %list */ list& operator=(list&& __x) { // NB: DR 1204. // NB: DR 675. this->clear(); this->swap(__x); return *this; } /** * @brief %List initializer list assignment operator. * @param __l An initializer_list of value_type. * * Replace the contents of the %list with copies of the elements * in the initializer_list @a __l. This is linear in l.size(). */ list& operator=(initializer_list<value_type> __l) { this->assign(__l.begin(), __l.end()); return *this; } #endif /** * @brief Assigns a given value to a %list. * @param __n Number of elements to be assigned. * @param __val Value to be assigned. * * This function fills a %list with @a __n copies of the given * value. Note that the assignment completely changes the %list * and that the resulting %list's size is the same as the number * of elements assigned. Old data may be lost. */ void assign(size_type __n, const value_type& __val) { _M_fill_assign(__n, __val); } /** * @brief Assigns a range to a %list. * @param __first An input iterator. * @param __last An input iterator. * * This function fills a %list with copies of the elements in the * range [@a __first,@a __last). * * Note that the assignment completely changes the %list and * that the resulting %list's size is the same as the number of * elements assigned. Old data may be lost. */ #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> void assign(_InputIterator __first, _InputIterator __last) { _M_assign_dispatch(__first, __last, __false_type()); } #else template<typename _InputIterator> void assign(_InputIterator __first, _InputIterator __last) { // Check whether it's an integral type. If so, it's not an iterator. typedef typename std::__is_integer<_InputIterator>::__type _Integral; _M_assign_dispatch(__first, __last, _Integral()); } #endif #if __cplusplus >= 201103L /** * @brief Assigns an initializer_list to a %list. * @param __l An initializer_list of value_type. * * Replace the contents of the %list with copies of the elements * in the initializer_list @a __l. This is linear in __l.size(). */ void assign(initializer_list<value_type> __l) { this->assign(__l.begin(), __l.end()); } #endif /// Get a copy of the memory allocation object. allocator_type get_allocator() const _GLIBCXX_NOEXCEPT { return _Base::get_allocator(); } // iterators /** * Returns a read/write iterator that points to the first element in the * %list. Iteration is done in ordinary element order. */ iterator begin() _GLIBCXX_NOEXCEPT { return iterator(this->_M_impl._M_node._M_next); } /** * Returns a read-only (constant) iterator that points to the * first element in the %list. Iteration is done in ordinary * element order. */ const_iterator begin() const _GLIBCXX_NOEXCEPT { return const_iterator(this->_M_impl._M_node._M_next); } /** * Returns a read/write iterator that points one past the last * element in the %list. Iteration is done in ordinary element * order. */ iterator end() _GLIBCXX_NOEXCEPT { return iterator(&this->_M_impl._M_node); } /** * Returns a read-only (constant) iterator that points one past * the last element in the %list. Iteration is done in ordinary * element order. */ const_iterator end() const _GLIBCXX_NOEXCEPT { return const_iterator(&this->_M_impl._M_node); } /** * Returns a read/write reverse iterator that points to the last * element in the %list. Iteration is done in reverse element * order. */ reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(end()); } /** * Returns a read-only (constant) reverse iterator that points to * the last element in the %list. Iteration is done in reverse * element order. */ const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(end()); } /** * Returns a read/write reverse iterator that points to one * before the first element in the %list. Iteration is done in * reverse element order. */ reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(begin()); } /** * Returns a read-only (constant) reverse iterator that points to one * before the first element in the %list. Iteration is done in reverse * element order. */ const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(begin()); } #if __cplusplus >= 201103L /** * Returns a read-only (constant) iterator that points to the * first element in the %list. Iteration is done in ordinary * element order. */ const_iterator cbegin() const noexcept { return const_iterator(this->_M_impl._M_node._M_next); } /** * Returns a read-only (constant) iterator that points one past * the last element in the %list. Iteration is done in ordinary * element order. */ const_iterator cend() const noexcept { return const_iterator(&this->_M_impl._M_node); } /** * Returns a read-only (constant) reverse iterator that points to * the last element in the %list. Iteration is done in reverse * element order. */ const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } /** * Returns a read-only (constant) reverse iterator that points to one * before the first element in the %list. Iteration is done in reverse * element order. */ const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } #endif // [23.2.2.2] capacity /** * Returns true if the %list is empty. (Thus begin() would equal * end().) */ bool empty() const _GLIBCXX_NOEXCEPT { return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; } /** Returns the number of elements in the %list. */ size_type size() const _GLIBCXX_NOEXCEPT { return std::distance(begin(), end()); } /** Returns the size() of the largest possible %list. */ size_type max_size() const _GLIBCXX_NOEXCEPT { return _M_get_Node_allocator().max_size(); } #if __cplusplus >= 201103L /** * @brief Resizes the %list to the specified number of elements. * @param __new_size Number of elements the %list should contain. * * This function will %resize the %list to the specified number * of elements. If the number is smaller than the %list's * current size the %list is truncated, otherwise default * constructed elements are appended. */ void resize(size_type __new_size); /** * @brief Resizes the %list to the specified number of elements. * @param __new_size Number of elements the %list should contain. * @param __x Data with which new elements should be populated. * * This function will %resize the %list to the specified number * of elements. If the number is smaller than the %list's * current size the %list is truncated, otherwise the %list is * extended and new elements are populated with given data. */ void resize(size_type __new_size, const value_type& __x); #else /** * @brief Resizes the %list to the specified number of elements. * @param __new_size Number of elements the %list should contain. * @param __x Data with which new elements should be populated. * * This function will %resize the %list to the specified number * of elements. If the number is smaller than the %list's * current size the %list is truncated, otherwise the %list is * extended and new elements are populated with given data. */ void resize(size_type __new_size, value_type __x = value_type()); #endif // element access /** * Returns a read/write reference to the data at the first * element of the %list. */ reference front() { return *begin(); } /** * Returns a read-only (constant) reference to the data at the first * element of the %list. */ const_reference front() const { return *begin(); } /** * Returns a read/write reference to the data at the last element * of the %list. */ reference back() { iterator __tmp = end(); --__tmp; return *__tmp; } /** * Returns a read-only (constant) reference to the data at the last * element of the %list. */ const_reference back() const { const_iterator __tmp = end(); --__tmp; return *__tmp; } // [23.2.2.3] modifiers /** * @brief Add data to the front of the %list. * @param __x Data to be added. * * This is a typical stack operation. The function creates an * element at the front of the %list and assigns the given data * to it. Due to the nature of a %list this operation can be * done in constant time, and does not invalidate iterators and * references. */ void push_front(const value_type& __x) { this->_M_insert(begin(), __x); } #if __cplusplus >= 201103L void push_front(value_type&& __x) { this->_M_insert(begin(), std::move(__x)); } template<typename... _Args> void emplace_front(_Args&&... __args) { this->_M_insert(begin(), std::forward<_Args>(__args)...); } #endif /** * @brief Removes first element. * * This is a typical stack operation. It shrinks the %list by * one. Due to the nature of a %list this operation can be done * in constant time, and only invalidates iterators/references to * the element being removed. * * Note that no data is returned, and if the first element's data * is needed, it should be retrieved before pop_front() is * called. */ void pop_front() { this->_M_erase(begin()); } /** * @brief Add data to the end of the %list. * @param __x Data to be added. * * This is a typical stack operation. The function creates an * element at the end of the %list and assigns the given data to * it. Due to the nature of a %list this operation can be done * in constant time, and does not invalidate iterators and * references. */ void push_back(const value_type& __x) { this->_M_insert(end(), __x); } #if __cplusplus >= 201103L void push_back(value_type&& __x) { this->_M_insert(end(), std::move(__x)); } template<typename... _Args> void emplace_back(_Args&&... __args) { this->_M_insert(end(), std::forward<_Args>(__args)...); } #endif /** * @brief Removes last element. * * This is a typical stack operation. It shrinks the %list by * one. Due to the nature of a %list this operation can be done * in constant time, and only invalidates iterators/references to * the element being removed. * * Note that no data is returned, and if the last element's data * is needed, it should be retrieved before pop_back() is called. */ void pop_back() { this->_M_erase(iterator(this->_M_impl._M_node._M_prev)); } #if __cplusplus >= 201103L /** * @brief Constructs object in %list before specified iterator. * @param __position A const_iterator into the %list. * @param __args Arguments. * @return An iterator that points to the inserted data. * * This function will insert an object of type T constructed * with T(std::forward<Args>(args)...) before the specified * location. Due to the nature of a %list this operation can * be done in constant time, and does not invalidate iterators * and references. */ template<typename... _Args> iterator emplace(iterator __position, _Args&&... __args); #endif /** * @brief Inserts given value into %list before specified iterator. * @param __position An iterator into the %list. * @param __x Data to be inserted. * @return An iterator that points to the inserted data. * * This function will insert a copy of the given value before * the specified location. Due to the nature of a %list this * operation can be done in constant time, and does not * invalidate iterators and references. */ iterator insert(iterator __position, const value_type& __x); #if __cplusplus >= 201103L /** * @brief Inserts given rvalue into %list before specified iterator. * @param __position An iterator into the %list. * @param __x Data to be inserted. * @return An iterator that points to the inserted data. * * This function will insert a copy of the given rvalue before * the specified location. Due to the nature of a %list this * operation can be done in constant time, and does not * invalidate iterators and references. */ iterator insert(iterator __position, value_type&& __x) { return emplace(__position, std::move(__x)); } /** * @brief Inserts the contents of an initializer_list into %list * before specified iterator. * @param __p An iterator into the %list. * @param __l An initializer_list of value_type. * * This function will insert copies of the data in the * initializer_list @a l into the %list before the location * specified by @a p. * * This operation is linear in the number of elements inserted and * does not invalidate iterators and references. */ void insert(iterator __p, initializer_list<value_type> __l) { this->insert(__p, __l.begin(), __l.end()); } #endif /** * @brief Inserts a number of copies of given data into the %list. * @param __position An iterator into the %list. * @param __n Number of elements to be inserted. * @param __x Data to be inserted. * * This function will insert a specified number of copies of the * given data before the location specified by @a position. * * This operation is linear in the number of elements inserted and * does not invalidate iterators and references. */ void insert(iterator __position, size_type __n, const value_type& __x) { list __tmp(__n, __x, get_allocator()); splice(__position, __tmp); } /** * @brief Inserts a range into the %list. * @param __position An iterator into the %list. * @param __first An input iterator. * @param __last An input iterator. * * This function will insert copies of the data in the range [@a * first,@a last) into the %list before the location specified by * @a position. * * This operation is linear in the number of elements inserted and * does not invalidate iterators and references. */ #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> #else template<typename _InputIterator> #endif void insert(iterator __position, _InputIterator __first, _InputIterator __last) { list __tmp(__first, __last, get_allocator()); splice(__position, __tmp); } /** * @brief Remove element at given position. * @param __position Iterator pointing to element to be erased. * @return An iterator pointing to the next element (or end()). * * This function will erase the element at the given position and thus * shorten the %list by one. * * Due to the nature of a %list this operation can be done in * constant time, and only invalidates iterators/references to * the element being removed. The user is also cautioned that * this function only erases the element, and that if the element * is itself a pointer, the pointed-to memory is not touched in * any way. Managing the pointer is the user's responsibility. */ iterator erase(iterator __position); /** * @brief Remove a range of elements. * @param __first Iterator pointing to the first element to be erased. * @param __last Iterator pointing to one past the last element to be * erased. * @return An iterator pointing to the element pointed to by @a last * prior to erasing (or end()). * * This function will erase the elements in the range @a * [first,last) and shorten the %list accordingly. * * This operation is linear time in the size of the range and only * invalidates iterators/references to the element being removed. * The user is also cautioned that this function only erases the * elements, and that if the elements themselves are pointers, the * pointed-to memory is not touched in any way. Managing the pointer * is the user's responsibility. */ iterator erase(iterator __first, iterator __last) { while (__first != __last) __first = erase(__first); return __last; } /** * @brief Swaps data with another %list. * @param __x A %list of the same element and allocator types. * * This exchanges the elements between two lists in constant * time. Note that the global std::swap() function is * specialized such that std::swap(l1,l2) will feed to this * function. */ void swap(list& __x) { __detail::_List_node_base::swap(this->_M_impl._M_node, __x._M_impl._M_node); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 431. Swapping containers with unequal allocators. std::__alloc_swap<typename _Base::_Node_alloc_type>:: _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator()); } /** * Erases all the elements. Note that this function only erases * the elements, and that if the elements themselves are * pointers, the pointed-to memory is not touched in any way. * Managing the pointer is the user's responsibility. */ void clear() _GLIBCXX_NOEXCEPT { _Base::_M_clear(); _Base::_M_init(); } // [23.2.2.4] list operations /** * @brief Insert contents of another %list. * @param __position Iterator referencing the element to insert before. * @param __x Source list. * * The elements of @a __x are inserted in constant time in front of * the element referenced by @a __position. @a __x becomes an empty * list. * * Requires this != @a __x. */ void #if __cplusplus >= 201103L splice(iterator __position, list&& __x) #else splice(iterator __position, list& __x) #endif { if (!__x.empty()) { _M_check_equal_allocators(__x); this->_M_transfer(__position, __x.begin(), __x.end()); } } #if __cplusplus >= 201103L void splice(iterator __position, list& __x) { splice(__position, std::move(__x)); } #endif /** * @brief Insert element from another %list. * @param __position Iterator referencing the element to insert before. * @param __x Source list. * @param __i Iterator referencing the element to move. * * Removes the element in list @a __x referenced by @a __i and * inserts it into the current list before @a __position. */ void #if __cplusplus >= 201103L splice(iterator __position, list&& __x, iterator __i) #else splice(iterator __position, list& __x, iterator __i) #endif { iterator __j = __i; ++__j; if (__position == __i || __position == __j) return; if (this != &__x) _M_check_equal_allocators(__x); this->_M_transfer(__position, __i, __j); } #if __cplusplus >= 201103L void splice(iterator __position, list& __x, iterator __i) { splice(__position, std::move(__x), __i); } #endif /** * @brief Insert range from another %list. * @param __position Iterator referencing the element to insert before. * @param __x Source list. * @param __first Iterator referencing the start of range in x. * @param __last Iterator referencing the end of range in x. * * Removes elements in the range [__first,__last) and inserts them * before @a __position in constant time. * * Undefined if @a __position is in [__first,__last). */ void #if __cplusplus >= 201103L splice(iterator __position, list&& __x, iterator __first, iterator __last) #else splice(iterator __position, list& __x, iterator __first, iterator __last) #endif { if (__first != __last) { if (this != &__x) _M_check_equal_allocators(__x); this->_M_transfer(__position, __first, __last); } } #if __cplusplus >= 201103L void splice(iterator __position, list& __x, iterator __first, iterator __last) { splice(__position, std::move(__x), __first, __last); } #endif /** * @brief Remove all elements equal to value. * @param __value The value to remove. * * Removes every element in the list equal to @a value. * Remaining elements stay in list order. Note that this * function only erases the elements, and that if the elements * themselves are pointers, the pointed-to memory is not * touched in any way. Managing the pointer is the user's * responsibility. */ void remove(const _Tp& __value); /** * @brief Remove all elements satisfying a predicate. * @tparam _Predicate Unary predicate function or object. * * Removes every element in the list for which the predicate * returns true. Remaining elements stay in list order. Note * that this function only erases the elements, and that if the * elements themselves are pointers, the pointed-to memory is * not touched in any way. Managing the pointer is the user's * responsibility. */ template<typename _Predicate> void remove_if(_Predicate); /** * @brief Remove consecutive duplicate elements. * * For each consecutive set of elements with the same value, * remove all but the first one. Remaining elements stay in * list order. Note that this function only erases the * elements, and that if the elements themselves are pointers, * the pointed-to memory is not touched in any way. Managing * the pointer is the user's responsibility. */ void unique(); /** * @brief Remove consecutive elements satisfying a predicate. * @tparam _BinaryPredicate Binary predicate function or object. * * For each consecutive set of elements [first,last) that * satisfy predicate(first,i) where i is an iterator in * [first,last), remove all but the first one. Remaining * elements stay in list order. Note that this function only * erases the elements, and that if the elements themselves are * pointers, the pointed-to memory is not touched in any way. * Managing the pointer is the user's responsibility. */ template<typename _BinaryPredicate> void unique(_BinaryPredicate); /** * @brief Merge sorted lists. * @param __x Sorted list to merge. * * Assumes that both @a __x and this list are sorted according to * operator<(). Merges elements of @a __x into this list in * sorted order, leaving @a __x empty when complete. Elements in * this list precede elements in @a __x that are equal. */ #if __cplusplus >= 201103L void merge(list&& __x); void merge(list& __x) { merge(std::move(__x)); } #else void merge(list& __x); #endif /** * @brief Merge sorted lists according to comparison function. * @tparam _StrictWeakOrdering Comparison function defining * sort order. * @param __x Sorted list to merge. * @param __comp Comparison functor. * * Assumes that both @a __x and this list are sorted according to * StrictWeakOrdering. Merges elements of @a __x into this list * in sorted order, leaving @a __x empty when complete. Elements * in this list precede elements in @a __x that are equivalent * according to StrictWeakOrdering(). */ #if __cplusplus >= 201103L template<typename _StrictWeakOrdering> void merge(list&& __x, _StrictWeakOrdering __comp); template<typename _StrictWeakOrdering> void merge(list& __x, _StrictWeakOrdering __comp) { merge(std::move(__x), __comp); } #else template<typename _StrictWeakOrdering> void merge(list& __x, _StrictWeakOrdering __comp); #endif /** * @brief Reverse the elements in list. * * Reverse the order of elements in the list in linear time. */ void reverse() _GLIBCXX_NOEXCEPT { this->_M_impl._M_node._M_reverse(); } /** * @brief Sort the elements. * * Sorts the elements of this list in NlogN time. Equivalent * elements remain in list order. */ void sort(); /** * @brief Sort the elements according to comparison function. * * Sorts the elements of this list in NlogN time. Equivalent * elements remain in list order. */ template<typename _StrictWeakOrdering> void sort(_StrictWeakOrdering); protected: // Internal constructor functions follow. // Called by the range constructor to implement [23.1.1]/9 // _GLIBCXX_RESOLVE_LIB_DEFECTS // 438. Ambiguity in the "do the right thing" clause template<typename _Integer> void _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) { _M_fill_initialize(static_cast<size_type>(__n), __x); } // Called by the range constructor to implement [23.1.1]/9 template<typename _InputIterator> void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, __false_type) { for (; __first != __last; ++__first) #if __cplusplus >= 201103L emplace_back(*__first); #else push_back(*__first); #endif } // Called by list(n,v,a), and the range constructor when it turns out // to be the same thing. void _M_fill_initialize(size_type __n, const value_type& __x) { for (; __n; --__n) push_back(__x); } #if __cplusplus >= 201103L // Called by list(n). void _M_default_initialize(size_type __n) { for (; __n; --__n) emplace_back(); } // Called by resize(sz). void _M_default_append(size_type __n); #endif // Internal assign functions follow. // Called by the range assign to implement [23.1.1]/9 // _GLIBCXX_RESOLVE_LIB_DEFECTS // 438. Ambiguity in the "do the right thing" clause template<typename _Integer> void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) { _M_fill_assign(__n, __val); } // Called by the range assign to implement [23.1.1]/9 template<typename _InputIterator> void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, __false_type); // Called by assign(n,t), and the range assign when it turns out // to be the same thing. void _M_fill_assign(size_type __n, const value_type& __val); // Moves the elements from [first,last) before position. void _M_transfer(iterator __position, iterator __first, iterator __last) { __position._M_node->_M_transfer(__first._M_node, __last._M_node); } // Inserts new element at position given and with value given. #if __cplusplus < 201103L void _M_insert(iterator __position, const value_type& __x) { _Node* __tmp = _M_create_node(__x); __tmp->_M_hook(__position._M_node); } #else template<typename... _Args> void _M_insert(iterator __position, _Args&&... __args) { _Node* __tmp = _M_create_node(std::forward<_Args>(__args)...); __tmp->_M_hook(__position._M_node); } #endif // Erases element at position given. void _M_erase(iterator __position) { __position._M_node->_M_unhook(); _Node* __n = static_cast<_Node*>(__position._M_node); #if __cplusplus >= 201103L _M_get_Node_allocator().destroy(__n); #else _M_get_Tp_allocator().destroy(std::__addressof(__n->_M_data)); #endif _M_put_node(__n); } // To implement the splice (and merge) bits of N1599. void _M_check_equal_allocators(list& __x) { if (std::__alloc_neq<typename _Base::_Node_alloc_type>:: _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator())) __throw_runtime_error(__N("list::_M_check_equal_allocators")); } }; /** * @brief List equality comparison. * @param __x A %list. * @param __y A %list of the same type as @a __x. * @return True iff the size and elements of the lists are equal. * * This is an equivalence relation. It is linear in the size of * the lists. Lists are considered equivalent if their sizes are * equal, and if corresponding elements compare equal. */ template<typename _Tp, typename _Alloc> inline bool operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) { typedef typename list<_Tp, _Alloc>::const_iterator const_iterator; const_iterator __end1 = __x.end(); const_iterator __end2 = __y.end(); const_iterator __i1 = __x.begin(); const_iterator __i2 = __y.begin(); while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) { ++__i1; ++__i2; } return __i1 == __end1 && __i2 == __end2; } /** * @brief List ordering relation. * @param __x A %list. * @param __y A %list of the same type as @a __x. * @return True iff @a __x is lexicographically less than @a __y. * * This is a total ordering relation. It is linear in the size of the * lists. The elements must be comparable with @c <. * * See std::lexicographical_compare() for how the determination is made. */ template<typename _Tp, typename _Alloc> inline bool operator<(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) { return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); } /// Based on operator== template<typename _Tp, typename _Alloc> inline bool operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) { return !(__x == __y); } /// Based on operator< template<typename _Tp, typename _Alloc> inline bool operator>(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) { return __y < __x; } /// Based on operator< template<typename _Tp, typename _Alloc> inline bool operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) { return !(__y < __x); } /// Based on operator< template<typename _Tp, typename _Alloc> inline bool operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) { return !(__x < __y); } /// See std::list::swap(). template<typename _Tp, typename _Alloc> inline void swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y) { __x.swap(__y); } _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std #endif /* _STL_LIST_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/nested_exception.h�������������������������������������������������������������������0000644�����������������00000011126�14763166030�0012246 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Nested Exception support header (nested_exception class) for -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/nested_exception.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{exception} */ #ifndef _GLIBCXX_NESTED_EXCEPTION_H #define _GLIBCXX_NESTED_EXCEPTION_H 1 #pragma GCC visibility push(default) #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <bits/c++config.h> #if ATOMIC_INT_LOCK_FREE < 2 # error This platform does not support exception propagation. #endif extern "C++" { namespace std { /** * @addtogroup exceptions * @{ */ /// Exception class with exception_ptr data member. class nested_exception { exception_ptr _M_ptr; public: nested_exception() noexcept : _M_ptr(current_exception()) { } nested_exception(const nested_exception&) = default; nested_exception& operator=(const nested_exception&) = default; virtual ~nested_exception() noexcept; void rethrow_nested() const __attribute__ ((__noreturn__)) { rethrow_exception(_M_ptr); } exception_ptr nested_ptr() const { return _M_ptr; } }; template<typename _Except> struct _Nested_exception : public _Except, public nested_exception { explicit _Nested_exception(_Except&& __ex) : _Except(static_cast<_Except&&>(__ex)) { } }; template<typename _Ex> struct __get_nested_helper { static const nested_exception* _S_get(const _Ex& __ex) { return dynamic_cast<const nested_exception*>(&__ex); } }; template<typename _Ex> struct __get_nested_helper<_Ex*> { static const nested_exception* _S_get(const _Ex* __ex) { return dynamic_cast<const nested_exception*>(__ex); } }; template<typename _Ex> inline const nested_exception* __get_nested_exception(const _Ex& __ex) { return __get_nested_helper<_Ex>::_S_get(__ex); } template<typename _Ex> void __throw_with_nested(_Ex&&, const nested_exception* = 0) __attribute__ ((__noreturn__)); template<typename _Ex> void __throw_with_nested(_Ex&&, ...) __attribute__ ((__noreturn__)); // This function should never be called, but is needed to avoid a warning // about ambiguous base classes when instantiating throw_with_nested<_Ex>() // with a type that has an accessible nested_exception base. template<typename _Ex> inline void __throw_with_nested(_Ex&& __ex, const nested_exception*) { throw __ex; } template<typename _Ex> inline void __throw_with_nested(_Ex&& __ex, ...) { throw _Nested_exception<_Ex>(static_cast<_Ex&&>(__ex)); } template<typename _Ex> void throw_with_nested(_Ex __ex) __attribute__ ((__noreturn__)); /// If @p __ex is derived from nested_exception, @p __ex. /// Else, an implementation-defined object derived from both. template<typename _Ex> inline void throw_with_nested(_Ex __ex) { if (__get_nested_exception(__ex)) throw __ex; __throw_with_nested(static_cast<_Ex&&>(__ex), &__ex); } /// If @p __ex is derived from nested_exception, @p __ex.rethrow_nested(). template<typename _Ex> inline void rethrow_if_nested(const _Ex& __ex) { if (const nested_exception* __nested = __get_nested_exception(__ex)) __nested->rethrow_nested(); } /// Overload, See N2619 inline void rethrow_if_nested(const nested_exception& __ex) { __ex.rethrow_nested(); } // @} group exceptions } // namespace std } // extern "C++" #endif // C++11 #pragma GCC visibility pop #endif // _GLIBCXX_NESTED_EXCEPTION_H ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/cxxabi_forced.h����������������������������������������������������������������������0000644�����������������00000003423�14763166030�0011507 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// cxxabi.h subset for cancellation -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of GCC. // // GCC 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 3, or (at your option) // any later version. // // GCC 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. // // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/cxxabi_forced.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{cxxabi.h} */ #ifndef _CXXABI_FORCED_H #define _CXXABI_FORCED_H 1 #pragma GCC system_header #pragma GCC visibility push(default) #ifdef __cplusplus namespace __cxxabiv1 { /** * @brief Thrown as part of forced unwinding. * @ingroup exceptions * * A magic placeholder class that can be caught by reference to * recognize forced unwinding. */ class __forced_unwind { virtual ~__forced_unwind() throw(); // Prevent catch by value. virtual void __pure_dummy() = 0; }; } #endif // __cplusplus #pragma GCC visibility pop #endif // __CXXABI_FORCED_H ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_stack.h��������������������������������������������������������������������������0000644�����������������00000023225�14763166030�0010700 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Stack implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_stack.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{stack} */ #ifndef _STL_STACK_H #define _STL_STACK_H 1 #include <bits/concept_check.h> #include <debug/debug.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief A standard container giving FILO behavior. * * @ingroup sequences * * @tparam _Tp Type of element. * @tparam _Sequence Type of underlying sequence, defaults to deque<_Tp>. * * Meets many of the requirements of a * <a href="tables.html#65">container</a>, * but does not define anything to do with iterators. Very few of the * other standard container interfaces are defined. * * This is not a true container, but an @e adaptor. It holds * another container, and provides a wrapper interface to that * container. The wrapper is what enforces strict * first-in-last-out %stack behavior. * * The second template parameter defines the type of the underlying * sequence/container. It defaults to std::deque, but it can be * any type that supports @c back, @c push_back, and @c pop_front, * such as std::list, std::vector, or an appropriate user-defined * type. * * Members not found in @a normal containers are @c container_type, * which is a typedef for the second Sequence parameter, and @c * push, @c pop, and @c top, which are standard %stack/FILO * operations. */ template<typename _Tp, typename _Sequence = deque<_Tp> > class stack { // concept requirements typedef typename _Sequence::value_type _Sequence_value_type; __glibcxx_class_requires(_Tp, _SGIAssignableConcept) __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept) __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept) template<typename _Tp1, typename _Seq1> friend bool operator==(const stack<_Tp1, _Seq1>&, const stack<_Tp1, _Seq1>&); template<typename _Tp1, typename _Seq1> friend bool operator<(const stack<_Tp1, _Seq1>&, const stack<_Tp1, _Seq1>&); public: typedef typename _Sequence::value_type value_type; typedef typename _Sequence::reference reference; typedef typename _Sequence::const_reference const_reference; typedef typename _Sequence::size_type size_type; typedef _Sequence container_type; protected: // See queue::c for notes on this name. _Sequence c; public: // XXX removed old def ctor, added def arg to this one to match 14882 /** * @brief Default constructor creates no elements. */ #if __cplusplus < 201103L explicit stack(const _Sequence& __c = _Sequence()) : c(__c) { } #else explicit stack(const _Sequence& __c) : c(__c) { } explicit stack(_Sequence&& __c = _Sequence()) : c(std::move(__c)) { } #endif /** * Returns true if the %stack is empty. */ bool empty() const { return c.empty(); } /** Returns the number of elements in the %stack. */ size_type size() const { return c.size(); } /** * Returns a read/write reference to the data at the first * element of the %stack. */ reference top() { __glibcxx_requires_nonempty(); return c.back(); } /** * Returns a read-only (constant) reference to the data at the first * element of the %stack. */ const_reference top() const { __glibcxx_requires_nonempty(); return c.back(); } /** * @brief Add data to the top of the %stack. * @param __x Data to be added. * * This is a typical %stack operation. The function creates an * element at the top of the %stack and assigns the given data * to it. The time complexity of the operation depends on the * underlying sequence. */ void push(const value_type& __x) { c.push_back(__x); } #if __cplusplus >= 201103L void push(value_type&& __x) { c.push_back(std::move(__x)); } template<typename... _Args> void emplace(_Args&&... __args) { c.emplace_back(std::forward<_Args>(__args)...); } #endif /** * @brief Removes first element. * * This is a typical %stack operation. It shrinks the %stack * by one. The time complexity of the operation depends on the * underlying sequence. * * Note that no data is returned, and if the first element's * data is needed, it should be retrieved before pop() is * called. */ void pop() { __glibcxx_requires_nonempty(); c.pop_back(); } #if __cplusplus >= 201103L void swap(stack& __s) noexcept(noexcept(swap(c, __s.c))) { using std::swap; swap(c, __s.c); } #endif }; /** * @brief Stack equality comparison. * @param __x A %stack. * @param __y A %stack of the same type as @a __x. * @return True iff the size and elements of the stacks are equal. * * This is an equivalence relation. Complexity and semantics * depend on the underlying sequence type, but the expected rules * are: this relation is linear in the size of the sequences, and * stacks are considered equivalent if their sequences compare * equal. */ template<typename _Tp, typename _Seq> inline bool operator==(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) { return __x.c == __y.c; } /** * @brief Stack ordering relation. * @param __x A %stack. * @param __y A %stack of the same type as @a x. * @return True iff @a x is lexicographically less than @a __y. * * This is an total ordering relation. Complexity and semantics * depend on the underlying sequence type, but the expected rules * are: this relation is linear in the size of the sequences, the * elements must be comparable with @c <, and * std::lexicographical_compare() is usually used to make the * determination. */ template<typename _Tp, typename _Seq> inline bool operator<(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) { return __x.c < __y.c; } /// Based on operator== template<typename _Tp, typename _Seq> inline bool operator!=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) { return !(__x == __y); } /// Based on operator< template<typename _Tp, typename _Seq> inline bool operator>(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) { return __y < __x; } /// Based on operator< template<typename _Tp, typename _Seq> inline bool operator<=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) { return !(__y < __x); } /// Based on operator< template<typename _Tp, typename _Seq> inline bool operator>=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) { return !(__x < __y); } #if __cplusplus >= 201103L template<typename _Tp, typename _Seq> inline void swap(stack<_Tp, _Seq>& __x, stack<_Tp, _Seq>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } template<typename _Tp, typename _Seq, typename _Alloc> struct uses_allocator<stack<_Tp, _Seq>, _Alloc> : public uses_allocator<_Seq, _Alloc>::type { }; #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _STL_STACK_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/move.h�������������������������������������������������������������������������������0000644�����������������00000013254�14763166030�0007660 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Move, forward and identity for C++0x + swap -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/move.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{utility} */ #ifndef _MOVE_H #define _MOVE_H 1 #include <bits/c++config.h> #include <bits/concept_check.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Used, in C++03 mode too, by allocators, etc. /** * @brief Same as C++11 std::addressof * @ingroup utilities */ template<typename _Tp> inline _Tp* __addressof(_Tp& __r) _GLIBCXX_NOEXCEPT { return reinterpret_cast<_Tp*> (&const_cast<char&>(reinterpret_cast<const volatile char&>(__r))); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #if __cplusplus >= 201103L #include <type_traits> // Brings in std::declval too. namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup utilities * @{ */ /** * @brief Forward an lvalue. * @return The parameter cast to the specified type. * * This function is used to implement "perfect forwarding". */ template<typename _Tp> constexpr _Tp&& forward(typename std::remove_reference<_Tp>::type& __t) noexcept { return static_cast<_Tp&&>(__t); } /** * @brief Forward an rvalue. * @return The parameter cast to the specified type. * * This function is used to implement "perfect forwarding". */ template<typename _Tp> constexpr _Tp&& forward(typename std::remove_reference<_Tp>::type&& __t) noexcept { static_assert(!std::is_lvalue_reference<_Tp>::value, "template argument" " substituting _Tp is an lvalue reference type"); return static_cast<_Tp&&>(__t); } /** * @brief Convert a value to an rvalue. * @param __t A thing of arbitrary type. * @return The parameter cast to an rvalue-reference to allow moving it. */ template<typename _Tp> constexpr typename std::remove_reference<_Tp>::type&& move(_Tp&& __t) noexcept { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); } template<typename _Tp> struct __move_if_noexcept_cond : public __and_<__not_<is_nothrow_move_constructible<_Tp>>, is_copy_constructible<_Tp>>::type { }; /** * @brief Conditionally convert a value to an rvalue. * @param __x A thing of arbitrary type. * @return The parameter, possibly cast to an rvalue-reference. * * Same as std::move unless the type's move constructor could throw and the * type is copyable, in which case an lvalue-reference is returned instead. */ template<typename _Tp> inline constexpr typename conditional<__move_if_noexcept_cond<_Tp>::value, const _Tp&, _Tp&&>::type move_if_noexcept(_Tp& __x) noexcept { return std::move(__x); } // declval, from type_traits. /** * @brief Returns the actual address of the object or function * referenced by r, even in the presence of an overloaded * operator&. * @param __r Reference to an object or function. * @return The actual address. */ template<typename _Tp> inline _Tp* addressof(_Tp& __r) noexcept { return std::__addressof(__r); } /// @} group utilities _GLIBCXX_END_NAMESPACE_VERSION } // namespace #define _GLIBCXX_MOVE(__val) std::move(__val) #define _GLIBCXX_FORWARD(_Tp, __val) std::forward<_Tp>(__val) #else #define _GLIBCXX_MOVE(__val) (__val) #define _GLIBCXX_FORWARD(_Tp, __val) (__val) #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup utilities * @{ */ /** * @brief Swaps two values. * @param __a A thing of arbitrary type. * @param __b Another thing of arbitrary type. * @return Nothing. */ template<typename _Tp> inline void swap(_Tp& __a, _Tp& __b) #if __cplusplus >= 201103L noexcept(__and_<is_nothrow_move_constructible<_Tp>, is_nothrow_move_assignable<_Tp>>::value) #endif { // concept requirements __glibcxx_function_requires(_SGIAssignableConcept<_Tp>) _Tp __tmp = _GLIBCXX_MOVE(__a); __a = _GLIBCXX_MOVE(__b); __b = _GLIBCXX_MOVE(__tmp); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 809. std::swap should be overloaded for array types. /// Swap the contents of two arrays. template<typename _Tp, size_t _Nm> inline void swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) #if __cplusplus >= 201103L noexcept(noexcept(swap(*__a, *__b))) #endif { for (size_t __n = 0; __n < _Nm; ++__n) swap(__a[__n], __b[__n]); } /// @} group utilities _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _MOVE_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/exception_ptr.h����������������������������������������������������������������������0000644�����������������00000012445�14763166030�0011576 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Exception Handling support header (exception_ptr class) for -*- C++ -*- // Copyright (C) 2008-2013 Free Software Foundation, Inc. // // This file is part of GCC. // // GCC 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 3, or (at your option) // any later version. // // GCC 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. // // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/exception_ptr.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{exception} */ #ifndef _EXCEPTION_PTR_H #define _EXCEPTION_PTR_H #pragma GCC visibility push(default) #include <bits/c++config.h> #include <bits/exception_defines.h> #if ATOMIC_INT_LOCK_FREE < 2 # error This platform does not support exception propagation. #endif extern "C++" { namespace std { class type_info; /** * @addtogroup exceptions * @{ */ namespace __exception_ptr { class exception_ptr; } using __exception_ptr::exception_ptr; /** Obtain an exception_ptr to the currently handled exception. If there * is none, or the currently handled exception is foreign, return the null * value. */ exception_ptr current_exception() _GLIBCXX_USE_NOEXCEPT; /// Throw the object pointed to by the exception_ptr. void rethrow_exception(exception_ptr) __attribute__ ((__noreturn__)); namespace __exception_ptr { /** * @brief An opaque pointer to an arbitrary exception. * @ingroup exceptions */ class exception_ptr { void* _M_exception_object; explicit exception_ptr(void* __e) _GLIBCXX_USE_NOEXCEPT; void _M_addref() _GLIBCXX_USE_NOEXCEPT; void _M_release() _GLIBCXX_USE_NOEXCEPT; void *_M_get() const _GLIBCXX_NOEXCEPT __attribute__ ((__pure__)); friend exception_ptr std::current_exception() _GLIBCXX_USE_NOEXCEPT; friend void std::rethrow_exception(exception_ptr); public: exception_ptr() _GLIBCXX_USE_NOEXCEPT; exception_ptr(const exception_ptr&) _GLIBCXX_USE_NOEXCEPT; #if __cplusplus >= 201103L exception_ptr(nullptr_t) noexcept : _M_exception_object(0) { } exception_ptr(exception_ptr&& __o) noexcept : _M_exception_object(__o._M_exception_object) { __o._M_exception_object = 0; } #endif #if (__cplusplus < 201103L) || defined (_GLIBCXX_EH_PTR_COMPAT) typedef void (exception_ptr::*__safe_bool)(); // For construction from nullptr or 0. exception_ptr(__safe_bool) _GLIBCXX_USE_NOEXCEPT; #endif exception_ptr& operator=(const exception_ptr&) _GLIBCXX_USE_NOEXCEPT; #if __cplusplus >= 201103L exception_ptr& operator=(exception_ptr&& __o) noexcept { exception_ptr(static_cast<exception_ptr&&>(__o)).swap(*this); return *this; } #endif ~exception_ptr() _GLIBCXX_USE_NOEXCEPT; void swap(exception_ptr&) _GLIBCXX_USE_NOEXCEPT; #ifdef _GLIBCXX_EH_PTR_COMPAT // Retained for compatibility with CXXABI_1.3. void _M_safe_bool_dummy() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__const__)); bool operator!() const _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); operator __safe_bool() const _GLIBCXX_USE_NOEXCEPT; #endif #if __cplusplus >= 201103L explicit operator bool() const { return _M_exception_object; } #endif friend bool operator==(const exception_ptr&, const exception_ptr&) _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); const class std::type_info* __cxa_exception_type() const _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); }; bool operator==(const exception_ptr&, const exception_ptr&) _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); bool operator!=(const exception_ptr&, const exception_ptr&) _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); inline void swap(exception_ptr& __lhs, exception_ptr& __rhs) { __lhs.swap(__rhs); } } // namespace __exception_ptr /// Obtain an exception_ptr pointing to a copy of the supplied object. template<typename _Ex> exception_ptr copy_exception(_Ex __ex) _GLIBCXX_USE_NOEXCEPT { __try { #ifdef __EXCEPTIONS throw __ex; #endif } __catch(...) { return current_exception(); } } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 1130. copy_exception name misleading /// Obtain an exception_ptr pointing to a copy of the supplied object. template<typename _Ex> exception_ptr make_exception_ptr(_Ex __ex) _GLIBCXX_USE_NOEXCEPT { return std::copy_exception<_Ex>(__ex); } // @} group exceptions } // namespace std } // extern "C++" #pragma GCC visibility pop #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/slice_array.h������������������������������������������������������������������������0000644�����������������00000022174�14763166030�0011210 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// The template and inlines for the -*- C++ -*- slice_array class. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/slice_array.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{valarray} */ // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr> #ifndef _SLICE_ARRAY_H #define _SLICE_ARRAY_H 1 #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup numeric_arrays * @{ */ /** * @brief Class defining one-dimensional subset of an array. * * The slice class represents a one-dimensional subset of an array, * specified by three parameters: start offset, size, and stride. The * start offset is the index of the first element of the array that is part * of the subset. The size is the total number of elements in the subset. * Stride is the distance between each successive array element to include * in the subset. * * For example, with an array of size 10, and a slice with offset 1, size 3 * and stride 2, the subset consists of array elements 1, 3, and 5. */ class slice { public: /// Construct an empty slice. slice(); /** * @brief Construct a slice. * * @param __o Offset in array of first element. * @param __d Number of elements in slice. * @param __s Stride between array elements. */ slice(size_t __o, size_t __d, size_t __s); /// Return array offset of first slice element. size_t start() const; /// Return size of slice. size_t size() const; /// Return array stride of slice. size_t stride() const; private: size_t _M_off; // offset size_t _M_sz; // size size_t _M_st; // stride unit }; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 543. valarray slice default constructor inline slice::slice() : _M_off(0), _M_sz(0), _M_st(0) {} inline slice::slice(size_t __o, size_t __d, size_t __s) : _M_off(__o), _M_sz(__d), _M_st(__s) {} inline size_t slice::start() const { return _M_off; } inline size_t slice::size() const { return _M_sz; } inline size_t slice::stride() const { return _M_st; } /** * @brief Reference to one-dimensional subset of an array. * * A slice_array is a reference to the actual elements of an array * specified by a slice. The way to get a slice_array is to call * operator[](slice) on a valarray. The returned slice_array then permits * carrying operations out on the referenced subset of elements in the * original valarray. For example, operator+=(valarray) will add values * to the subset of elements in the underlying valarray this slice_array * refers to. * * @param Tp Element type. */ template<typename _Tp> class slice_array { public: typedef _Tp value_type; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 253. valarray helper functions are almost entirely useless /// Copy constructor. Both slices refer to the same underlying array. slice_array(const slice_array&); /// Assignment operator. Assigns slice elements to corresponding /// elements of @a a. slice_array& operator=(const slice_array&); /// Assign slice elements to corresponding elements of @a v. void operator=(const valarray<_Tp>&) const; /// Multiply slice elements by corresponding elements of @a v. void operator*=(const valarray<_Tp>&) const; /// Divide slice elements by corresponding elements of @a v. void operator/=(const valarray<_Tp>&) const; /// Modulo slice elements by corresponding elements of @a v. void operator%=(const valarray<_Tp>&) const; /// Add corresponding elements of @a v to slice elements. void operator+=(const valarray<_Tp>&) const; /// Subtract corresponding elements of @a v from slice elements. void operator-=(const valarray<_Tp>&) const; /// Logical xor slice elements with corresponding elements of @a v. void operator^=(const valarray<_Tp>&) const; /// Logical and slice elements with corresponding elements of @a v. void operator&=(const valarray<_Tp>&) const; /// Logical or slice elements with corresponding elements of @a v. void operator|=(const valarray<_Tp>&) const; /// Left shift slice elements by corresponding elements of @a v. void operator<<=(const valarray<_Tp>&) const; /// Right shift slice elements by corresponding elements of @a v. void operator>>=(const valarray<_Tp>&) const; /// Assign all slice elements to @a t. void operator=(const _Tp &) const; // ~slice_array (); template<class _Dom> void operator=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator*=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator/=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator%=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator+=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator-=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator^=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator&=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator|=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator<<=(const _Expr<_Dom, _Tp>&) const; template<class _Dom> void operator>>=(const _Expr<_Dom, _Tp>&) const; private: friend class valarray<_Tp>; slice_array(_Array<_Tp>, const slice&); const size_t _M_sz; const size_t _M_stride; const _Array<_Tp> _M_array; // not implemented slice_array(); }; template<typename _Tp> inline slice_array<_Tp>::slice_array(_Array<_Tp> __a, const slice& __s) : _M_sz(__s.size()), _M_stride(__s.stride()), _M_array(__a.begin() + __s.start()) {} template<typename _Tp> inline slice_array<_Tp>::slice_array(const slice_array<_Tp>& a) : _M_sz(a._M_sz), _M_stride(a._M_stride), _M_array(a._M_array) {} // template<typename _Tp> // inline slice_array<_Tp>::~slice_array () {} template<typename _Tp> inline slice_array<_Tp>& slice_array<_Tp>::operator=(const slice_array<_Tp>& __a) { std::__valarray_copy(__a._M_array, __a._M_sz, __a._M_stride, _M_array, _M_stride); return *this; } template<typename _Tp> inline void slice_array<_Tp>::operator=(const _Tp& __t) const { std::__valarray_fill(_M_array, _M_sz, _M_stride, __t); } template<typename _Tp> inline void slice_array<_Tp>::operator=(const valarray<_Tp>& __v) const { std::__valarray_copy(_Array<_Tp>(__v), _M_array, _M_sz, _M_stride); } template<typename _Tp> template<class _Dom> inline void slice_array<_Tp>::operator=(const _Expr<_Dom,_Tp>& __e) const { std::__valarray_copy(__e, _M_sz, _M_array, _M_stride); } #undef _DEFINE_VALARRAY_OPERATOR #define _DEFINE_VALARRAY_OPERATOR(_Op,_Name) \ template<typename _Tp> \ inline void \ slice_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const \ { \ _Array_augmented_##_Name(_M_array, _M_sz, _M_stride, _Array<_Tp>(__v));\ } \ \ template<typename _Tp> \ template<class _Dom> \ inline void \ slice_array<_Tp>::operator _Op##=(const _Expr<_Dom,_Tp>& __e) const\ { \ _Array_augmented_##_Name(_M_array, _M_stride, __e, _M_sz); \ } _DEFINE_VALARRAY_OPERATOR(*, __multiplies) _DEFINE_VALARRAY_OPERATOR(/, __divides) _DEFINE_VALARRAY_OPERATOR(%, __modulus) _DEFINE_VALARRAY_OPERATOR(+, __plus) _DEFINE_VALARRAY_OPERATOR(-, __minus) _DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor) _DEFINE_VALARRAY_OPERATOR(&, __bitwise_and) _DEFINE_VALARRAY_OPERATOR(|, __bitwise_or) _DEFINE_VALARRAY_OPERATOR(<<, __shift_left) _DEFINE_VALARRAY_OPERATOR(>>, __shift_right) #undef _DEFINE_VALARRAY_OPERATOR // @} group numeric_arrays _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _SLICE_ARRAY_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_tree.h���������������������������������������������������������������������������0000644�����������������00000153100�14763166030�0010526 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// RB tree implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * */ /** @file bits/stl_tree.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{map,set} */ #ifndef _STL_TREE_H #define _STL_TREE_H 1 #include <bits/stl_algobase.h> #include <bits/allocator.h> #include <bits/stl_function.h> #include <bits/cpp_type_traits.h> #if __cplusplus >= 201103L #include <bits/alloc_traits.h> #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Red-black tree class, designed for use in implementing STL // associative containers (set, multiset, map, and multimap). The // insertion and deletion algorithms are based on those in Cormen, // Leiserson, and Rivest, Introduction to Algorithms (MIT Press, // 1990), except that // // (1) the header cell is maintained with links not only to the root // but also to the leftmost node of the tree, to enable constant // time begin(), and to the rightmost node of the tree, to enable // linear time performance when used with the generic set algorithms // (set_union, etc.) // // (2) when a node being deleted has two children its successor node // is relinked into its place, rather than copied, so that the only // iterators invalidated are those referring to the deleted node. enum _Rb_tree_color { _S_red = false, _S_black = true }; struct _Rb_tree_node_base { typedef _Rb_tree_node_base* _Base_ptr; typedef const _Rb_tree_node_base* _Const_Base_ptr; _Rb_tree_color _M_color; _Base_ptr _M_parent; _Base_ptr _M_left; _Base_ptr _M_right; static _Base_ptr _S_minimum(_Base_ptr __x) { while (__x->_M_left != 0) __x = __x->_M_left; return __x; } static _Const_Base_ptr _S_minimum(_Const_Base_ptr __x) { while (__x->_M_left != 0) __x = __x->_M_left; return __x; } static _Base_ptr _S_maximum(_Base_ptr __x) { while (__x->_M_right != 0) __x = __x->_M_right; return __x; } static _Const_Base_ptr _S_maximum(_Const_Base_ptr __x) { while (__x->_M_right != 0) __x = __x->_M_right; return __x; } }; template<typename _Val> struct _Rb_tree_node : public _Rb_tree_node_base { typedef _Rb_tree_node<_Val>* _Link_type; _Val _M_value_field; #if __cplusplus >= 201103L template<typename... _Args> _Rb_tree_node(_Args&&... __args) : _Rb_tree_node_base(), _M_value_field(std::forward<_Args>(__args)...) { } #endif }; _GLIBCXX_PURE _Rb_tree_node_base* _Rb_tree_increment(_Rb_tree_node_base* __x) throw (); _GLIBCXX_PURE const _Rb_tree_node_base* _Rb_tree_increment(const _Rb_tree_node_base* __x) throw (); _GLIBCXX_PURE _Rb_tree_node_base* _Rb_tree_decrement(_Rb_tree_node_base* __x) throw (); _GLIBCXX_PURE const _Rb_tree_node_base* _Rb_tree_decrement(const _Rb_tree_node_base* __x) throw (); template<typename _Tp> struct _Rb_tree_iterator { typedef _Tp value_type; typedef _Tp& reference; typedef _Tp* pointer; typedef bidirectional_iterator_tag iterator_category; typedef ptrdiff_t difference_type; typedef _Rb_tree_iterator<_Tp> _Self; typedef _Rb_tree_node_base::_Base_ptr _Base_ptr; typedef _Rb_tree_node<_Tp>* _Link_type; _Rb_tree_iterator() : _M_node() { } explicit _Rb_tree_iterator(_Link_type __x) : _M_node(__x) { } reference operator*() const { return static_cast<_Link_type>(_M_node)->_M_value_field; } pointer operator->() const { return std::__addressof(static_cast<_Link_type> (_M_node)->_M_value_field); } _Self& operator++() { _M_node = _Rb_tree_increment(_M_node); return *this; } _Self operator++(int) { _Self __tmp = *this; _M_node = _Rb_tree_increment(_M_node); return __tmp; } _Self& operator--() { _M_node = _Rb_tree_decrement(_M_node); return *this; } _Self operator--(int) { _Self __tmp = *this; _M_node = _Rb_tree_decrement(_M_node); return __tmp; } bool operator==(const _Self& __x) const { return _M_node == __x._M_node; } bool operator!=(const _Self& __x) const { return _M_node != __x._M_node; } _Base_ptr _M_node; }; template<typename _Tp> struct _Rb_tree_const_iterator { typedef _Tp value_type; typedef const _Tp& reference; typedef const _Tp* pointer; typedef _Rb_tree_iterator<_Tp> iterator; typedef bidirectional_iterator_tag iterator_category; typedef ptrdiff_t difference_type; typedef _Rb_tree_const_iterator<_Tp> _Self; typedef _Rb_tree_node_base::_Const_Base_ptr _Base_ptr; typedef const _Rb_tree_node<_Tp>* _Link_type; _Rb_tree_const_iterator() : _M_node() { } explicit _Rb_tree_const_iterator(_Link_type __x) : _M_node(__x) { } _Rb_tree_const_iterator(const iterator& __it) : _M_node(__it._M_node) { } iterator _M_const_cast() const { return iterator(static_cast<typename iterator::_Link_type> (const_cast<typename iterator::_Base_ptr>(_M_node))); } reference operator*() const { return static_cast<_Link_type>(_M_node)->_M_value_field; } pointer operator->() const { return std::__addressof(static_cast<_Link_type> (_M_node)->_M_value_field); } _Self& operator++() { _M_node = _Rb_tree_increment(_M_node); return *this; } _Self operator++(int) { _Self __tmp = *this; _M_node = _Rb_tree_increment(_M_node); return __tmp; } _Self& operator--() { _M_node = _Rb_tree_decrement(_M_node); return *this; } _Self operator--(int) { _Self __tmp = *this; _M_node = _Rb_tree_decrement(_M_node); return __tmp; } bool operator==(const _Self& __x) const { return _M_node == __x._M_node; } bool operator!=(const _Self& __x) const { return _M_node != __x._M_node; } _Base_ptr _M_node; }; template<typename _Val> inline bool operator==(const _Rb_tree_iterator<_Val>& __x, const _Rb_tree_const_iterator<_Val>& __y) { return __x._M_node == __y._M_node; } template<typename _Val> inline bool operator!=(const _Rb_tree_iterator<_Val>& __x, const _Rb_tree_const_iterator<_Val>& __y) { return __x._M_node != __y._M_node; } void _Rb_tree_insert_and_rebalance(const bool __insert_left, _Rb_tree_node_base* __x, _Rb_tree_node_base* __p, _Rb_tree_node_base& __header) throw (); _Rb_tree_node_base* _Rb_tree_rebalance_for_erase(_Rb_tree_node_base* const __z, _Rb_tree_node_base& __header) throw (); template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc = allocator<_Val> > class _Rb_tree { typedef typename _Alloc::template rebind<_Rb_tree_node<_Val> >::other _Node_allocator; protected: typedef _Rb_tree_node_base* _Base_ptr; typedef const _Rb_tree_node_base* _Const_Base_ptr; public: typedef _Key key_type; typedef _Val value_type; typedef value_type* pointer; typedef const value_type* const_pointer; typedef value_type& reference; typedef const value_type& const_reference; typedef _Rb_tree_node<_Val>* _Link_type; typedef const _Rb_tree_node<_Val>* _Const_Link_type; typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Alloc allocator_type; _Node_allocator& _M_get_Node_allocator() _GLIBCXX_NOEXCEPT { return *static_cast<_Node_allocator*>(&this->_M_impl); } const _Node_allocator& _M_get_Node_allocator() const _GLIBCXX_NOEXCEPT { return *static_cast<const _Node_allocator*>(&this->_M_impl); } allocator_type get_allocator() const _GLIBCXX_NOEXCEPT { return allocator_type(_M_get_Node_allocator()); } protected: _Link_type _M_get_node() { return _M_impl._Node_allocator::allocate(1); } void _M_put_node(_Link_type __p) { _M_impl._Node_allocator::deallocate(__p, 1); } #if __cplusplus < 201103L _Link_type _M_create_node(const value_type& __x) { _Link_type __tmp = _M_get_node(); __try { get_allocator().construct (std::__addressof(__tmp->_M_value_field), __x); } __catch(...) { _M_put_node(__tmp); __throw_exception_again; } return __tmp; } void _M_destroy_node(_Link_type __p) { get_allocator().destroy(std::__addressof(__p->_M_value_field)); _M_put_node(__p); } #else template<typename... _Args> _Link_type _M_create_node(_Args&&... __args) { _Link_type __tmp = _M_get_node(); __try { allocator_traits<_Node_allocator>:: construct(_M_get_Node_allocator(), __tmp, std::forward<_Args>(__args)...); } __catch(...) { _M_put_node(__tmp); __throw_exception_again; } return __tmp; } void _M_destroy_node(_Link_type __p) { _M_get_Node_allocator().destroy(__p); _M_put_node(__p); } #endif _Link_type _M_clone_node(_Const_Link_type __x) { _Link_type __tmp = _M_create_node(__x->_M_value_field); __tmp->_M_color = __x->_M_color; __tmp->_M_left = 0; __tmp->_M_right = 0; return __tmp; } protected: template<typename _Key_compare, bool _Is_pod_comparator = __is_pod(_Key_compare)> struct _Rb_tree_impl : public _Node_allocator { _Key_compare _M_key_compare; _Rb_tree_node_base _M_header; size_type _M_node_count; // Keeps track of size of tree. _Rb_tree_impl() : _Node_allocator(), _M_key_compare(), _M_header(), _M_node_count(0) { _M_initialize(); } _Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a) : _Node_allocator(__a), _M_key_compare(__comp), _M_header(), _M_node_count(0) { _M_initialize(); } #if __cplusplus >= 201103L _Rb_tree_impl(const _Key_compare& __comp, _Node_allocator&& __a) : _Node_allocator(std::move(__a)), _M_key_compare(__comp), _M_header(), _M_node_count(0) { _M_initialize(); } #endif private: void _M_initialize() { this->_M_header._M_color = _S_red; this->_M_header._M_parent = 0; this->_M_header._M_left = &this->_M_header; this->_M_header._M_right = &this->_M_header; } }; _Rb_tree_impl<_Compare> _M_impl; protected: _Base_ptr& _M_root() { return this->_M_impl._M_header._M_parent; } _Const_Base_ptr _M_root() const { return this->_M_impl._M_header._M_parent; } _Base_ptr& _M_leftmost() { return this->_M_impl._M_header._M_left; } _Const_Base_ptr _M_leftmost() const { return this->_M_impl._M_header._M_left; } _Base_ptr& _M_rightmost() { return this->_M_impl._M_header._M_right; } _Const_Base_ptr _M_rightmost() const { return this->_M_impl._M_header._M_right; } _Link_type _M_begin() { return static_cast<_Link_type>(this->_M_impl._M_header._M_parent); } _Const_Link_type _M_begin() const { return static_cast<_Const_Link_type> (this->_M_impl._M_header._M_parent); } _Link_type _M_end() { return reinterpret_cast<_Link_type>(&this->_M_impl._M_header); } _Const_Link_type _M_end() const { return reinterpret_cast<_Const_Link_type>(&this->_M_impl._M_header); } static const_reference _S_value(_Const_Link_type __x) { return __x->_M_value_field; } static const _Key& _S_key(_Const_Link_type __x) { return _KeyOfValue()(_S_value(__x)); } static _Link_type _S_left(_Base_ptr __x) { return static_cast<_Link_type>(__x->_M_left); } static _Const_Link_type _S_left(_Const_Base_ptr __x) { return static_cast<_Const_Link_type>(__x->_M_left); } static _Link_type _S_right(_Base_ptr __x) { return static_cast<_Link_type>(__x->_M_right); } static _Const_Link_type _S_right(_Const_Base_ptr __x) { return static_cast<_Const_Link_type>(__x->_M_right); } static const_reference _S_value(_Const_Base_ptr __x) { return static_cast<_Const_Link_type>(__x)->_M_value_field; } static const _Key& _S_key(_Const_Base_ptr __x) { return _KeyOfValue()(_S_value(__x)); } static _Base_ptr _S_minimum(_Base_ptr __x) { return _Rb_tree_node_base::_S_minimum(__x); } static _Const_Base_ptr _S_minimum(_Const_Base_ptr __x) { return _Rb_tree_node_base::_S_minimum(__x); } static _Base_ptr _S_maximum(_Base_ptr __x) { return _Rb_tree_node_base::_S_maximum(__x); } static _Const_Base_ptr _S_maximum(_Const_Base_ptr __x) { return _Rb_tree_node_base::_S_maximum(__x); } public: typedef _Rb_tree_iterator<value_type> iterator; typedef _Rb_tree_const_iterator<value_type> const_iterator; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; private: pair<_Base_ptr, _Base_ptr> _M_get_insert_unique_pos(const key_type& __k); pair<_Base_ptr, _Base_ptr> _M_get_insert_equal_pos(const key_type& __k); pair<_Base_ptr, _Base_ptr> _M_get_insert_hint_unique_pos(const_iterator __pos, const key_type& __k); pair<_Base_ptr, _Base_ptr> _M_get_insert_hint_equal_pos(const_iterator __pos, const key_type& __k); #if __cplusplus >= 201103L template<typename _Arg> iterator _M_insert_(_Base_ptr __x, _Base_ptr __y, _Arg&& __v); iterator _M_insert_node(_Base_ptr __x, _Base_ptr __y, _Link_type __z); template<typename _Arg> iterator _M_insert_lower(_Base_ptr __y, _Arg&& __v); template<typename _Arg> iterator _M_insert_equal_lower(_Arg&& __x); iterator _M_insert_lower_node(_Base_ptr __p, _Link_type __z); iterator _M_insert_equal_lower_node(_Link_type __z); #else iterator _M_insert_(_Base_ptr __x, _Base_ptr __y, const value_type& __v); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 233. Insertion hints in associative containers. iterator _M_insert_lower(_Base_ptr __y, const value_type& __v); iterator _M_insert_equal_lower(const value_type& __x); #endif _Link_type _M_copy(_Const_Link_type __x, _Link_type __p); void _M_erase(_Link_type __x); iterator _M_lower_bound(_Link_type __x, _Link_type __y, const _Key& __k); const_iterator _M_lower_bound(_Const_Link_type __x, _Const_Link_type __y, const _Key& __k) const; iterator _M_upper_bound(_Link_type __x, _Link_type __y, const _Key& __k); const_iterator _M_upper_bound(_Const_Link_type __x, _Const_Link_type __y, const _Key& __k) const; public: // allocation/deallocation _Rb_tree() { } _Rb_tree(const _Compare& __comp, const allocator_type& __a = allocator_type()) : _M_impl(__comp, _Node_allocator(__a)) { } _Rb_tree(const _Rb_tree& __x) : _M_impl(__x._M_impl._M_key_compare, __x._M_get_Node_allocator()) { if (__x._M_root() != 0) { _M_root() = _M_copy(__x._M_begin(), _M_end()); _M_leftmost() = _S_minimum(_M_root()); _M_rightmost() = _S_maximum(_M_root()); _M_impl._M_node_count = __x._M_impl._M_node_count; } } #if __cplusplus >= 201103L _Rb_tree(_Rb_tree&& __x); #endif ~_Rb_tree() _GLIBCXX_NOEXCEPT { _M_erase(_M_begin()); } _Rb_tree& operator=(const _Rb_tree& __x); // Accessors. _Compare key_comp() const { return _M_impl._M_key_compare; } iterator begin() _GLIBCXX_NOEXCEPT { return iterator(static_cast<_Link_type> (this->_M_impl._M_header._M_left)); } const_iterator begin() const _GLIBCXX_NOEXCEPT { return const_iterator(static_cast<_Const_Link_type> (this->_M_impl._M_header._M_left)); } iterator end() _GLIBCXX_NOEXCEPT { return iterator(static_cast<_Link_type>(&this->_M_impl._M_header)); } const_iterator end() const _GLIBCXX_NOEXCEPT { return const_iterator(static_cast<_Const_Link_type> (&this->_M_impl._M_header)); } reverse_iterator rbegin() _GLIBCXX_NOEXCEPT { return reverse_iterator(end()); } const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(end()); } reverse_iterator rend() _GLIBCXX_NOEXCEPT { return reverse_iterator(begin()); } const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT { return const_reverse_iterator(begin()); } bool empty() const _GLIBCXX_NOEXCEPT { return _M_impl._M_node_count == 0; } size_type size() const _GLIBCXX_NOEXCEPT { return _M_impl._M_node_count; } size_type max_size() const _GLIBCXX_NOEXCEPT { return _M_get_Node_allocator().max_size(); } void swap(_Rb_tree& __t); // Insert/erase. #if __cplusplus >= 201103L template<typename _Arg> pair<iterator, bool> _M_insert_unique(_Arg&& __x); template<typename _Arg> iterator _M_insert_equal(_Arg&& __x); template<typename _Arg> iterator _M_insert_unique_(const_iterator __position, _Arg&& __x); template<typename _Arg> iterator _M_insert_equal_(const_iterator __position, _Arg&& __x); template<typename... _Args> pair<iterator, bool> _M_emplace_unique(_Args&&... __args); template<typename... _Args> iterator _M_emplace_equal(_Args&&... __args); template<typename... _Args> iterator _M_emplace_hint_unique(const_iterator __pos, _Args&&... __args); template<typename... _Args> iterator _M_emplace_hint_equal(const_iterator __pos, _Args&&... __args); #else pair<iterator, bool> _M_insert_unique(const value_type& __x); iterator _M_insert_equal(const value_type& __x); iterator _M_insert_unique_(const_iterator __position, const value_type& __x); iterator _M_insert_equal_(const_iterator __position, const value_type& __x); #endif template<typename _InputIterator> void _M_insert_unique(_InputIterator __first, _InputIterator __last); template<typename _InputIterator> void _M_insert_equal(_InputIterator __first, _InputIterator __last); private: void _M_erase_aux(const_iterator __position); void _M_erase_aux(const_iterator __first, const_iterator __last); public: #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 130. Associative erase should return an iterator. _GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __position) { const_iterator __result = __position; ++__result; _M_erase_aux(__position); return __result._M_const_cast(); } // LWG 2059. _GLIBCXX_ABI_TAG_CXX11 iterator erase(iterator __position) { iterator __result = __position; ++__result; _M_erase_aux(__position); return __result; } #else void erase(iterator __position) { _M_erase_aux(__position); } void erase(const_iterator __position) { _M_erase_aux(__position); } #endif size_type erase(const key_type& __x); #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 130. Associative erase should return an iterator. _GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __first, const_iterator __last) { _M_erase_aux(__first, __last); return __last._M_const_cast(); } #else void erase(iterator __first, iterator __last) { _M_erase_aux(__first, __last); } void erase(const_iterator __first, const_iterator __last) { _M_erase_aux(__first, __last); } #endif void erase(const key_type* __first, const key_type* __last); void clear() _GLIBCXX_NOEXCEPT { _M_erase(_M_begin()); _M_leftmost() = _M_end(); _M_root() = 0; _M_rightmost() = _M_end(); _M_impl._M_node_count = 0; } // Set operations. iterator find(const key_type& __k); const_iterator find(const key_type& __k) const; size_type count(const key_type& __k) const; iterator lower_bound(const key_type& __k) { return _M_lower_bound(_M_begin(), _M_end(), __k); } const_iterator lower_bound(const key_type& __k) const { return _M_lower_bound(_M_begin(), _M_end(), __k); } iterator upper_bound(const key_type& __k) { return _M_upper_bound(_M_begin(), _M_end(), __k); } const_iterator upper_bound(const key_type& __k) const { return _M_upper_bound(_M_begin(), _M_end(), __k); } pair<iterator, iterator> equal_range(const key_type& __k); pair<const_iterator, const_iterator> equal_range(const key_type& __k) const; // Debugging. bool __rb_verify() const; }; template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> inline bool operator==(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) { return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin()); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> inline bool operator<(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) { return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> inline bool operator!=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) { return !(__x == __y); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> inline bool operator>(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) { return __y < __x; } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> inline bool operator<=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) { return !(__y < __x); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> inline bool operator>=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) { return !(__x < __y); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> inline void swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) { __x.swap(__y); } #if __cplusplus >= 201103L template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _Rb_tree(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&& __x) : _M_impl(__x._M_impl._M_key_compare, std::move(__x._M_get_Node_allocator())) { if (__x._M_root() != 0) { _M_root() = __x._M_root(); _M_leftmost() = __x._M_leftmost(); _M_rightmost() = __x._M_rightmost(); _M_root()->_M_parent = _M_end(); __x._M_root() = 0; __x._M_leftmost() = __x._M_end(); __x._M_rightmost() = __x._M_end(); this->_M_impl._M_node_count = __x._M_impl._M_node_count; __x._M_impl._M_node_count = 0; } } #endif template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: operator=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x) { if (this != &__x) { // Note that _Key may be a constant type. clear(); _M_impl._M_key_compare = __x._M_impl._M_key_compare; if (__x._M_root() != 0) { _M_root() = _M_copy(__x._M_begin(), _M_end()); _M_leftmost() = _S_minimum(_M_root()); _M_rightmost() = _S_maximum(_M_root()); _M_impl._M_node_count = __x._M_impl._M_node_count; } } return *this; } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> #if __cplusplus >= 201103L template<typename _Arg> #endif typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: #if __cplusplus >= 201103L _M_insert_(_Base_ptr __x, _Base_ptr __p, _Arg&& __v) #else _M_insert_(_Base_ptr __x, _Base_ptr __p, const _Val& __v) #endif { bool __insert_left = (__x != 0 || __p == _M_end() || _M_impl._M_key_compare(_KeyOfValue()(__v), _S_key(__p))); _Link_type __z = _M_create_node(_GLIBCXX_FORWARD(_Arg, __v)); _Rb_tree_insert_and_rebalance(__insert_left, __z, __p, this->_M_impl._M_header); ++_M_impl._M_node_count; return iterator(__z); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> #if __cplusplus >= 201103L template<typename _Arg> #endif typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: #if __cplusplus >= 201103L _M_insert_lower(_Base_ptr __p, _Arg&& __v) #else _M_insert_lower(_Base_ptr __p, const _Val& __v) #endif { bool __insert_left = (__p == _M_end() || !_M_impl._M_key_compare(_S_key(__p), _KeyOfValue()(__v))); _Link_type __z = _M_create_node(_GLIBCXX_FORWARD(_Arg, __v)); _Rb_tree_insert_and_rebalance(__insert_left, __z, __p, this->_M_impl._M_header); ++_M_impl._M_node_count; return iterator(__z); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> #if __cplusplus >= 201103L template<typename _Arg> #endif typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: #if __cplusplus >= 201103L _M_insert_equal_lower(_Arg&& __v) #else _M_insert_equal_lower(const _Val& __v) #endif { _Link_type __x = _M_begin(); _Link_type __y = _M_end(); while (__x != 0) { __y = __x; __x = !_M_impl._M_key_compare(_S_key(__x), _KeyOfValue()(__v)) ? _S_left(__x) : _S_right(__x); } return _M_insert_lower(__y, _GLIBCXX_FORWARD(_Arg, __v)); } template<typename _Key, typename _Val, typename _KoV, typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::_Link_type _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>:: _M_copy(_Const_Link_type __x, _Link_type __p) { // Structural copy. __x and __p must be non-null. _Link_type __top = _M_clone_node(__x); __top->_M_parent = __p; __try { if (__x->_M_right) __top->_M_right = _M_copy(_S_right(__x), __top); __p = __top; __x = _S_left(__x); while (__x != 0) { _Link_type __y = _M_clone_node(__x); __p->_M_left = __y; __y->_M_parent = __p; if (__x->_M_right) __y->_M_right = _M_copy(_S_right(__x), __y); __p = __y; __x = _S_left(__x); } } __catch(...) { _M_erase(__top); __throw_exception_again; } return __top; } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> void _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_erase(_Link_type __x) { // Erase without rebalancing. while (__x != 0) { _M_erase(_S_right(__x)); _Link_type __y = _S_left(__x); _M_destroy_node(__x); __x = __y; } } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_lower_bound(_Link_type __x, _Link_type __y, const _Key& __k) { while (__x != 0) if (!_M_impl._M_key_compare(_S_key(__x), __k)) __y = __x, __x = _S_left(__x); else __x = _S_right(__x); return iterator(__y); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_lower_bound(_Const_Link_type __x, _Const_Link_type __y, const _Key& __k) const { while (__x != 0) if (!_M_impl._M_key_compare(_S_key(__x), __k)) __y = __x, __x = _S_left(__x); else __x = _S_right(__x); return const_iterator(__y); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_upper_bound(_Link_type __x, _Link_type __y, const _Key& __k) { while (__x != 0) if (_M_impl._M_key_compare(__k, _S_key(__x))) __y = __x, __x = _S_left(__x); else __x = _S_right(__x); return iterator(__y); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_upper_bound(_Const_Link_type __x, _Const_Link_type __y, const _Key& __k) const { while (__x != 0) if (_M_impl._M_key_compare(__k, _S_key(__x))) __y = __x, __x = _S_left(__x); else __x = _S_right(__x); return const_iterator(__y); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> pair<typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator, typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator> _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: equal_range(const _Key& __k) { _Link_type __x = _M_begin(); _Link_type __y = _M_end(); while (__x != 0) { if (_M_impl._M_key_compare(_S_key(__x), __k)) __x = _S_right(__x); else if (_M_impl._M_key_compare(__k, _S_key(__x))) __y = __x, __x = _S_left(__x); else { _Link_type __xu(__x), __yu(__y); __y = __x, __x = _S_left(__x); __xu = _S_right(__xu); return pair<iterator, iterator>(_M_lower_bound(__x, __y, __k), _M_upper_bound(__xu, __yu, __k)); } } return pair<iterator, iterator>(iterator(__y), iterator(__y)); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> pair<typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator, typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator> _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: equal_range(const _Key& __k) const { _Const_Link_type __x = _M_begin(); _Const_Link_type __y = _M_end(); while (__x != 0) { if (_M_impl._M_key_compare(_S_key(__x), __k)) __x = _S_right(__x); else if (_M_impl._M_key_compare(__k, _S_key(__x))) __y = __x, __x = _S_left(__x); else { _Const_Link_type __xu(__x), __yu(__y); __y = __x, __x = _S_left(__x); __xu = _S_right(__xu); return pair<const_iterator, const_iterator>(_M_lower_bound(__x, __y, __k), _M_upper_bound(__xu, __yu, __k)); } } return pair<const_iterator, const_iterator>(const_iterator(__y), const_iterator(__y)); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> void _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t) { if (_M_root() == 0) { if (__t._M_root() != 0) { _M_root() = __t._M_root(); _M_leftmost() = __t._M_leftmost(); _M_rightmost() = __t._M_rightmost(); _M_root()->_M_parent = _M_end(); __t._M_root() = 0; __t._M_leftmost() = __t._M_end(); __t._M_rightmost() = __t._M_end(); } } else if (__t._M_root() == 0) { __t._M_root() = _M_root(); __t._M_leftmost() = _M_leftmost(); __t._M_rightmost() = _M_rightmost(); __t._M_root()->_M_parent = __t._M_end(); _M_root() = 0; _M_leftmost() = _M_end(); _M_rightmost() = _M_end(); } else { std::swap(_M_root(),__t._M_root()); std::swap(_M_leftmost(),__t._M_leftmost()); std::swap(_M_rightmost(),__t._M_rightmost()); _M_root()->_M_parent = _M_end(); __t._M_root()->_M_parent = __t._M_end(); } // No need to swap header's color as it does not change. std::swap(this->_M_impl._M_node_count, __t._M_impl._M_node_count); std::swap(this->_M_impl._M_key_compare, __t._M_impl._M_key_compare); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 431. Swapping containers with unequal allocators. std::__alloc_swap<_Node_allocator>:: _S_do_it(_M_get_Node_allocator(), __t._M_get_Node_allocator()); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> pair<typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Base_ptr, typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Base_ptr> _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_get_insert_unique_pos(const key_type& __k) { typedef pair<_Base_ptr, _Base_ptr> _Res; _Link_type __x = _M_begin(); _Link_type __y = _M_end(); bool __comp = true; while (__x != 0) { __y = __x; __comp = _M_impl._M_key_compare(__k, _S_key(__x)); __x = __comp ? _S_left(__x) : _S_right(__x); } iterator __j = iterator(__y); if (__comp) { if (__j == begin()) return _Res(__x, __y); else --__j; } if (_M_impl._M_key_compare(_S_key(__j._M_node), __k)) return _Res(__x, __y); return _Res(__j._M_node, 0); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> pair<typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Base_ptr, typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Base_ptr> _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_get_insert_equal_pos(const key_type& __k) { typedef pair<_Base_ptr, _Base_ptr> _Res; _Link_type __x = _M_begin(); _Link_type __y = _M_end(); while (__x != 0) { __y = __x; __x = _M_impl._M_key_compare(__k, _S_key(__x)) ? _S_left(__x) : _S_right(__x); } return _Res(__x, __y); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> #if __cplusplus >= 201103L template<typename _Arg> #endif pair<typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator, bool> _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: #if __cplusplus >= 201103L _M_insert_unique(_Arg&& __v) #else _M_insert_unique(const _Val& __v) #endif { typedef pair<iterator, bool> _Res; pair<_Base_ptr, _Base_ptr> __res = _M_get_insert_unique_pos(_KeyOfValue()(__v)); if (__res.second) return _Res(_M_insert_(__res.first, __res.second, _GLIBCXX_FORWARD(_Arg, __v)), true); return _Res(iterator(static_cast<_Link_type>(__res.first)), false); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> #if __cplusplus >= 201103L template<typename _Arg> #endif typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: #if __cplusplus >= 201103L _M_insert_equal(_Arg&& __v) #else _M_insert_equal(const _Val& __v) #endif { pair<_Base_ptr, _Base_ptr> __res = _M_get_insert_equal_pos(_KeyOfValue()(__v)); return _M_insert_(__res.first, __res.second, _GLIBCXX_FORWARD(_Arg, __v)); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> pair<typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Base_ptr, typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Base_ptr> _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_get_insert_hint_unique_pos(const_iterator __position, const key_type& __k) { iterator __pos = __position._M_const_cast(); typedef pair<_Base_ptr, _Base_ptr> _Res; // end() if (__pos._M_node == _M_end()) { if (size() > 0 && _M_impl._M_key_compare(_S_key(_M_rightmost()), __k)) return _Res(0, _M_rightmost()); else return _M_get_insert_unique_pos(__k); } else if (_M_impl._M_key_compare(__k, _S_key(__pos._M_node))) { // First, try before... iterator __before = __pos; if (__pos._M_node == _M_leftmost()) // begin() return _Res(_M_leftmost(), _M_leftmost()); else if (_M_impl._M_key_compare(_S_key((--__before)._M_node), __k)) { if (_S_right(__before._M_node) == 0) return _Res(0, __before._M_node); else return _Res(__pos._M_node, __pos._M_node); } else return _M_get_insert_unique_pos(__k); } else if (_M_impl._M_key_compare(_S_key(__pos._M_node), __k)) { // ... then try after. iterator __after = __pos; if (__pos._M_node == _M_rightmost()) return _Res(0, _M_rightmost()); else if (_M_impl._M_key_compare(__k, _S_key((++__after)._M_node))) { if (_S_right(__pos._M_node) == 0) return _Res(0, __pos._M_node); else return _Res(__after._M_node, __after._M_node); } else return _M_get_insert_unique_pos(__k); } else // Equivalent keys. return _Res(__pos._M_node, 0); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> #if __cplusplus >= 201103L template<typename _Arg> #endif typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: #if __cplusplus >= 201103L _M_insert_unique_(const_iterator __position, _Arg&& __v) #else _M_insert_unique_(const_iterator __position, const _Val& __v) #endif { pair<_Base_ptr, _Base_ptr> __res = _M_get_insert_hint_unique_pos(__position, _KeyOfValue()(__v)); if (__res.second) return _M_insert_(__res.first, __res.second, _GLIBCXX_FORWARD(_Arg, __v)); return iterator(static_cast<_Link_type>(__res.first)); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> pair<typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Base_ptr, typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Base_ptr> _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_get_insert_hint_equal_pos(const_iterator __position, const key_type& __k) { iterator __pos = __position._M_const_cast(); typedef pair<_Base_ptr, _Base_ptr> _Res; // end() if (__pos._M_node == _M_end()) { if (size() > 0 && !_M_impl._M_key_compare(__k, _S_key(_M_rightmost()))) return _Res(0, _M_rightmost()); else return _M_get_insert_equal_pos(__k); } else if (!_M_impl._M_key_compare(_S_key(__pos._M_node), __k)) { // First, try before... iterator __before = __pos; if (__pos._M_node == _M_leftmost()) // begin() return _Res(_M_leftmost(), _M_leftmost()); else if (!_M_impl._M_key_compare(__k, _S_key((--__before)._M_node))) { if (_S_right(__before._M_node) == 0) return _Res(0, __before._M_node); else return _Res(__pos._M_node, __pos._M_node); } else return _M_get_insert_equal_pos(__k); } else { // ... then try after. iterator __after = __pos; if (__pos._M_node == _M_rightmost()) return _Res(0, _M_rightmost()); else if (!_M_impl._M_key_compare(_S_key((++__after)._M_node), __k)) { if (_S_right(__pos._M_node) == 0) return _Res(0, __pos._M_node); else return _Res(__after._M_node, __after._M_node); } else return _Res(0, 0); } } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> #if __cplusplus >= 201103L template<typename _Arg> #endif typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: #if __cplusplus >= 201103L _M_insert_equal_(const_iterator __position, _Arg&& __v) #else _M_insert_equal_(const_iterator __position, const _Val& __v) #endif { pair<_Base_ptr, _Base_ptr> __res = _M_get_insert_hint_equal_pos(__position, _KeyOfValue()(__v)); if (__res.second) return _M_insert_(__res.first, __res.second, _GLIBCXX_FORWARD(_Arg, __v)); return _M_insert_equal_lower(_GLIBCXX_FORWARD(_Arg, __v)); } #if __cplusplus >= 201103L template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_insert_node(_Base_ptr __x, _Base_ptr __p, _Link_type __z) { bool __insert_left = (__x != 0 || __p == _M_end() || _M_impl._M_key_compare(_S_key(__z), _S_key(__p))); _Rb_tree_insert_and_rebalance(__insert_left, __z, __p, this->_M_impl._M_header); ++_M_impl._M_node_count; return iterator(__z); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_insert_lower_node(_Base_ptr __p, _Link_type __z) { bool __insert_left = (__p == _M_end() || !_M_impl._M_key_compare(_S_key(__p), _S_key(__z))); _Rb_tree_insert_and_rebalance(__insert_left, __z, __p, this->_M_impl._M_header); ++_M_impl._M_node_count; return iterator(__z); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_insert_equal_lower_node(_Link_type __z) { _Link_type __x = _M_begin(); _Link_type __y = _M_end(); while (__x != 0) { __y = __x; __x = !_M_impl._M_key_compare(_S_key(__x), _S_key(__z)) ? _S_left(__x) : _S_right(__x); } return _M_insert_lower_node(__y, __z); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> template<typename... _Args> pair<typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator, bool> _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_emplace_unique(_Args&&... __args) { _Link_type __z = _M_create_node(std::forward<_Args>(__args)...); __try { typedef pair<iterator, bool> _Res; auto __res = _M_get_insert_unique_pos(_S_key(__z)); if (__res.second) return _Res(_M_insert_node(__res.first, __res.second, __z), true); _M_destroy_node(__z); return _Res(iterator(static_cast<_Link_type>(__res.first)), false); } __catch(...) { _M_destroy_node(__z); __throw_exception_again; } } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> template<typename... _Args> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_emplace_equal(_Args&&... __args) { _Link_type __z = _M_create_node(std::forward<_Args>(__args)...); __try { auto __res = _M_get_insert_equal_pos(_S_key(__z)); return _M_insert_node(__res.first, __res.second, __z); } __catch(...) { _M_destroy_node(__z); __throw_exception_again; } } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> template<typename... _Args> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_emplace_hint_unique(const_iterator __pos, _Args&&... __args) { _Link_type __z = _M_create_node(std::forward<_Args>(__args)...); __try { auto __res = _M_get_insert_hint_unique_pos(__pos, _S_key(__z)); if (__res.second) return _M_insert_node(__res.first, __res.second, __z); _M_destroy_node(__z); return iterator(static_cast<_Link_type>(__res.first)); } __catch(...) { _M_destroy_node(__z); __throw_exception_again; } } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> template<typename... _Args> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_emplace_hint_equal(const_iterator __pos, _Args&&... __args) { _Link_type __z = _M_create_node(std::forward<_Args>(__args)...); __try { auto __res = _M_get_insert_hint_equal_pos(__pos, _S_key(__z)); if (__res.second) return _M_insert_node(__res.first, __res.second, __z); return _M_insert_equal_lower_node(__z); } __catch(...) { _M_destroy_node(__z); __throw_exception_again; } } #endif template<typename _Key, typename _Val, typename _KoV, typename _Cmp, typename _Alloc> template<class _II> void _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>:: _M_insert_unique(_II __first, _II __last) { for (; __first != __last; ++__first) _M_insert_unique_(end(), *__first); } template<typename _Key, typename _Val, typename _KoV, typename _Cmp, typename _Alloc> template<class _II> void _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>:: _M_insert_equal(_II __first, _II __last) { for (; __first != __last; ++__first) _M_insert_equal_(end(), *__first); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> void _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_erase_aux(const_iterator __position) { _Link_type __y = static_cast<_Link_type>(_Rb_tree_rebalance_for_erase (const_cast<_Base_ptr>(__position._M_node), this->_M_impl._M_header)); _M_destroy_node(__y); --_M_impl._M_node_count; } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> void _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_erase_aux(const_iterator __first, const_iterator __last) { if (__first == begin() && __last == end()) clear(); else while (__first != __last) erase(__first++); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: erase(const _Key& __x) { pair<iterator, iterator> __p = equal_range(__x); const size_type __old_size = size(); erase(__p.first, __p.second); return __old_size - size(); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> void _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: erase(const _Key* __first, const _Key* __last) { while (__first != __last) erase(*__first++); } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: find(const _Key& __k) { iterator __j = _M_lower_bound(_M_begin(), _M_end(), __k); return (__j == end() || _M_impl._M_key_compare(__k, _S_key(__j._M_node))) ? end() : __j; } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: find(const _Key& __k) const { const_iterator __j = _M_lower_bound(_M_begin(), _M_end(), __k); return (__j == end() || _M_impl._M_key_compare(__k, _S_key(__j._M_node))) ? end() : __j; } template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: count(const _Key& __k) const { pair<const_iterator, const_iterator> __p = equal_range(__k); const size_type __n = std::distance(__p.first, __p.second); return __n; } _GLIBCXX_PURE unsigned int _Rb_tree_black_count(const _Rb_tree_node_base* __node, const _Rb_tree_node_base* __root) throw (); template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> bool _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::__rb_verify() const { if (_M_impl._M_node_count == 0 || begin() == end()) return _M_impl._M_node_count == 0 && begin() == end() && this->_M_impl._M_header._M_left == _M_end() && this->_M_impl._M_header._M_right == _M_end(); unsigned int __len = _Rb_tree_black_count(_M_leftmost(), _M_root()); for (const_iterator __it = begin(); __it != end(); ++__it) { _Const_Link_type __x = static_cast<_Const_Link_type>(__it._M_node); _Const_Link_type __L = _S_left(__x); _Const_Link_type __R = _S_right(__x); if (__x->_M_color == _S_red) if ((__L && __L->_M_color == _S_red) || (__R && __R->_M_color == _S_red)) return false; if (__L && _M_impl._M_key_compare(_S_key(__x), _S_key(__L))) return false; if (__R && _M_impl._M_key_compare(_S_key(__R), _S_key(__x))) return false; if (!__L && !__R && _Rb_tree_black_count(__x, _M_root()) != __len) return false; } if (_M_leftmost() != _Rb_tree_node_base::_S_minimum(_M_root())) return false; if (_M_rightmost() != _Rb_tree_node_base::_S_maximum(_M_root())) return false; return true; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/random.tcc���������������������������������������������������������������������������0000644�����������������00000325135�14763166030�0010520 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// random number generation (out of line) -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/random.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{random} */ #ifndef _RANDOM_TCC #define _RANDOM_TCC 1 #include <numeric> // std::accumulate and std::partial_sum namespace std _GLIBCXX_VISIBILITY(default) { /* * (Further) implementation-space details. */ namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION // General case for x = (ax + c) mod m -- use Schrage's algorithm // to avoid integer overflow. // // Preconditions: a > 0, m > 0. // // Note: only works correctly for __m % __a < __m / __a. template<typename _Tp, _Tp __m, _Tp __a, _Tp __c> _Tp _Mod<_Tp, __m, __a, __c, false, true>:: __calc(_Tp __x) { if (__a == 1) __x %= __m; else { static const _Tp __q = __m / __a; static const _Tp __r = __m % __a; _Tp __t1 = __a * (__x % __q); _Tp __t2 = __r * (__x / __q); if (__t1 >= __t2) __x = __t1 - __t2; else __x = __m - __t2 + __t1; } if (__c != 0) { const _Tp __d = __m - __x; if (__d > __c) __x += __c; else __x = __c - __d; } return __x; } template<typename _InputIterator, typename _OutputIterator, typename _Tp> _OutputIterator __normalize(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __factor) { for (; __first != __last; ++__first, ++__result) *__result = *__first / __factor; return __result; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace __detail _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> constexpr _UIntType linear_congruential_engine<_UIntType, __a, __c, __m>::multiplier; template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> constexpr _UIntType linear_congruential_engine<_UIntType, __a, __c, __m>::increment; template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> constexpr _UIntType linear_congruential_engine<_UIntType, __a, __c, __m>::modulus; template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> constexpr _UIntType linear_congruential_engine<_UIntType, __a, __c, __m>::default_seed; /** * Seeds the LCR with integral value @p __s, adjusted so that the * ring identity is never a member of the convergence set. */ template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> void linear_congruential_engine<_UIntType, __a, __c, __m>:: seed(result_type __s) { if ((__detail::__mod<_UIntType, __m>(__c) == 0) && (__detail::__mod<_UIntType, __m>(__s) == 0)) _M_x = 1; else _M_x = __detail::__mod<_UIntType, __m>(__s); } /** * Seeds the LCR engine with a value generated by @p __q. */ template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> template<typename _Sseq> typename std::enable_if<std::is_class<_Sseq>::value>::type linear_congruential_engine<_UIntType, __a, __c, __m>:: seed(_Sseq& __q) { const _UIntType __k0 = __m == 0 ? std::numeric_limits<_UIntType>::digits : std::__lg(__m); const _UIntType __k = (__k0 + 31) / 32; uint_least32_t __arr[__k + 3]; __q.generate(__arr + 0, __arr + __k + 3); _UIntType __factor = 1u; _UIntType __sum = 0u; for (size_t __j = 0; __j < __k; ++__j) { __sum += __arr[__j + 3] * __factor; __factor *= __detail::_Shift<_UIntType, 32>::__value; } seed(__sum); } template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const linear_congruential_engine<_UIntType, __a, __c, __m>& __lcr) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left); __os.fill(__os.widen(' ')); __os << __lcr._M_x; __os.flags(__flags); __os.fill(__fill); return __os; } template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, linear_congruential_engine<_UIntType, __a, __c, __m>& __lcr) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec); __is >> __lcr._M_x; __is.flags(__flags); return __is; } template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> constexpr size_t mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::word_size; template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> constexpr size_t mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::state_size; template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> constexpr size_t mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::shift_size; template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> constexpr size_t mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::mask_bits; template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> constexpr _UIntType mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::xor_mask; template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> constexpr size_t mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_u; template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> constexpr _UIntType mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_d; template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> constexpr size_t mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_s; template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> constexpr _UIntType mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_b; template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> constexpr size_t mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_t; template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> constexpr _UIntType mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_c; template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> constexpr size_t mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_l; template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> constexpr _UIntType mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>:: initialization_multiplier; template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> constexpr _UIntType mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::default_seed; template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> void mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>:: seed(result_type __sd) { _M_x[0] = __detail::__mod<_UIntType, __detail::_Shift<_UIntType, __w>::__value>(__sd); for (size_t __i = 1; __i < state_size; ++__i) { _UIntType __x = _M_x[__i - 1]; __x ^= __x >> (__w - 2); __x *= __f; __x += __detail::__mod<_UIntType, __n>(__i); _M_x[__i] = __detail::__mod<_UIntType, __detail::_Shift<_UIntType, __w>::__value>(__x); } _M_p = state_size; } template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> template<typename _Sseq> typename std::enable_if<std::is_class<_Sseq>::value>::type mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>:: seed(_Sseq& __q) { const _UIntType __upper_mask = (~_UIntType()) << __r; const size_t __k = (__w + 31) / 32; uint_least32_t __arr[__n * __k]; __q.generate(__arr + 0, __arr + __n * __k); bool __zero = true; for (size_t __i = 0; __i < state_size; ++__i) { _UIntType __factor = 1u; _UIntType __sum = 0u; for (size_t __j = 0; __j < __k; ++__j) { __sum += __arr[__k * __i + __j] * __factor; __factor *= __detail::_Shift<_UIntType, 32>::__value; } _M_x[__i] = __detail::__mod<_UIntType, __detail::_Shift<_UIntType, __w>::__value>(__sum); if (__zero) { if (__i == 0) { if ((_M_x[0] & __upper_mask) != 0u) __zero = false; } else if (_M_x[__i] != 0u) __zero = false; } } if (__zero) _M_x[0] = __detail::_Shift<_UIntType, __w - 1>::__value; _M_p = state_size; } template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> void mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>:: _M_gen_rand(void) { const _UIntType __upper_mask = (~_UIntType()) << __r; const _UIntType __lower_mask = ~__upper_mask; for (size_t __k = 0; __k < (__n - __m); ++__k) { _UIntType __y = ((_M_x[__k] & __upper_mask) | (_M_x[__k + 1] & __lower_mask)); _M_x[__k] = (_M_x[__k + __m] ^ (__y >> 1) ^ ((__y & 0x01) ? __a : 0)); } for (size_t __k = (__n - __m); __k < (__n - 1); ++__k) { _UIntType __y = ((_M_x[__k] & __upper_mask) | (_M_x[__k + 1] & __lower_mask)); _M_x[__k] = (_M_x[__k + (__m - __n)] ^ (__y >> 1) ^ ((__y & 0x01) ? __a : 0)); } _UIntType __y = ((_M_x[__n - 1] & __upper_mask) | (_M_x[0] & __lower_mask)); _M_x[__n - 1] = (_M_x[__m - 1] ^ (__y >> 1) ^ ((__y & 0x01) ? __a : 0)); _M_p = 0; } template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> void mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>:: discard(unsigned long long __z) { while (__z > state_size - _M_p) { __z -= state_size - _M_p; _M_gen_rand(); } _M_p += __z; } template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f> typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>:: operator()() { // Reload the vector - cost is O(n) amortized over n calls. if (_M_p >= state_size) _M_gen_rand(); // Calculate o(x(i)). result_type __z = _M_x[_M_p++]; __z ^= (__z >> __u) & __d; __z ^= (__z << __s) & __b; __z ^= (__z << __t) & __c; __z ^= (__z >> __l); return __z; } template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left); __os.fill(__space); for (size_t __i = 0; __i < __n; ++__i) __os << __x._M_x[__i] << __space; __os << __x._M_p; __os.flags(__flags); __os.fill(__fill); return __os; } template<typename _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); for (size_t __i = 0; __i < __n; ++__i) __is >> __x._M_x[__i]; __is >> __x._M_p; __is.flags(__flags); return __is; } template<typename _UIntType, size_t __w, size_t __s, size_t __r> constexpr size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::word_size; template<typename _UIntType, size_t __w, size_t __s, size_t __r> constexpr size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::short_lag; template<typename _UIntType, size_t __w, size_t __s, size_t __r> constexpr size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::long_lag; template<typename _UIntType, size_t __w, size_t __s, size_t __r> constexpr _UIntType subtract_with_carry_engine<_UIntType, __w, __s, __r>::default_seed; template<typename _UIntType, size_t __w, size_t __s, size_t __r> void subtract_with_carry_engine<_UIntType, __w, __s, __r>:: seed(result_type __value) { std::linear_congruential_engine<result_type, 40014u, 0u, 2147483563u> __lcg(__value == 0u ? default_seed : __value); const size_t __n = (__w + 31) / 32; for (size_t __i = 0; __i < long_lag; ++__i) { _UIntType __sum = 0u; _UIntType __factor = 1u; for (size_t __j = 0; __j < __n; ++__j) { __sum += __detail::__mod<uint_least32_t, __detail::_Shift<uint_least32_t, 32>::__value> (__lcg()) * __factor; __factor *= __detail::_Shift<_UIntType, 32>::__value; } _M_x[__i] = __detail::__mod<_UIntType, __detail::_Shift<_UIntType, __w>::__value>(__sum); } _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0; _M_p = 0; } template<typename _UIntType, size_t __w, size_t __s, size_t __r> template<typename _Sseq> typename std::enable_if<std::is_class<_Sseq>::value>::type subtract_with_carry_engine<_UIntType, __w, __s, __r>:: seed(_Sseq& __q) { const size_t __k = (__w + 31) / 32; uint_least32_t __arr[__r * __k]; __q.generate(__arr + 0, __arr + __r * __k); for (size_t __i = 0; __i < long_lag; ++__i) { _UIntType __sum = 0u; _UIntType __factor = 1u; for (size_t __j = 0; __j < __k; ++__j) { __sum += __arr[__k * __i + __j] * __factor; __factor *= __detail::_Shift<_UIntType, 32>::__value; } _M_x[__i] = __detail::__mod<_UIntType, __detail::_Shift<_UIntType, __w>::__value>(__sum); } _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0; _M_p = 0; } template<typename _UIntType, size_t __w, size_t __s, size_t __r> typename subtract_with_carry_engine<_UIntType, __w, __s, __r>:: result_type subtract_with_carry_engine<_UIntType, __w, __s, __r>:: operator()() { // Derive short lag index from current index. long __ps = _M_p - short_lag; if (__ps < 0) __ps += long_lag; // Calculate new x(i) without overflow or division. // NB: Thanks to the requirements for _UIntType, _M_x[_M_p] + _M_carry // cannot overflow. _UIntType __xi; if (_M_x[__ps] >= _M_x[_M_p] + _M_carry) { __xi = _M_x[__ps] - _M_x[_M_p] - _M_carry; _M_carry = 0; } else { __xi = (__detail::_Shift<_UIntType, __w>::__value - _M_x[_M_p] - _M_carry + _M_x[__ps]); _M_carry = 1; } _M_x[_M_p] = __xi; // Adjust current index to loop around in ring buffer. if (++_M_p >= long_lag) _M_p = 0; return __xi; } template<typename _UIntType, size_t __w, size_t __s, size_t __r, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const subtract_with_carry_engine<_UIntType, __w, __s, __r>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left); __os.fill(__space); for (size_t __i = 0; __i < __r; ++__i) __os << __x._M_x[__i] << __space; __os << __x._M_carry << __space << __x._M_p; __os.flags(__flags); __os.fill(__fill); return __os; } template<typename _UIntType, size_t __w, size_t __s, size_t __r, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, subtract_with_carry_engine<_UIntType, __w, __s, __r>& __x) { typedef std::basic_ostream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); for (size_t __i = 0; __i < __r; ++__i) __is >> __x._M_x[__i]; __is >> __x._M_carry; __is >> __x._M_p; __is.flags(__flags); return __is; } template<typename _RandomNumberEngine, size_t __p, size_t __r> constexpr size_t discard_block_engine<_RandomNumberEngine, __p, __r>::block_size; template<typename _RandomNumberEngine, size_t __p, size_t __r> constexpr size_t discard_block_engine<_RandomNumberEngine, __p, __r>::used_block; template<typename _RandomNumberEngine, size_t __p, size_t __r> typename discard_block_engine<_RandomNumberEngine, __p, __r>::result_type discard_block_engine<_RandomNumberEngine, __p, __r>:: operator()() { if (_M_n >= used_block) { _M_b.discard(block_size - _M_n); _M_n = 0; } ++_M_n; return _M_b(); } template<typename _RandomNumberEngine, size_t __p, size_t __r, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const discard_block_engine<_RandomNumberEngine, __p, __r>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left); __os.fill(__space); __os << __x.base() << __space << __x._M_n; __os.flags(__flags); __os.fill(__fill); return __os; } template<typename _RandomNumberEngine, size_t __p, size_t __r, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, discard_block_engine<_RandomNumberEngine, __p, __r>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); __is >> __x._M_b >> __x._M_n; __is.flags(__flags); return __is; } template<typename _RandomNumberEngine, size_t __w, typename _UIntType> typename independent_bits_engine<_RandomNumberEngine, __w, _UIntType>:: result_type independent_bits_engine<_RandomNumberEngine, __w, _UIntType>:: operator()() { typedef typename _RandomNumberEngine::result_type _Eresult_type; const _Eresult_type __r = (_M_b.max() - _M_b.min() < std::numeric_limits<_Eresult_type>::max() ? _M_b.max() - _M_b.min() + 1 : 0); const unsigned __edig = std::numeric_limits<_Eresult_type>::digits; const unsigned __m = __r ? std::__lg(__r) : __edig; typedef typename std::common_type<_Eresult_type, result_type>::type __ctype; const unsigned __cdig = std::numeric_limits<__ctype>::digits; unsigned __n, __n0; __ctype __s0, __s1, __y0, __y1; for (size_t __i = 0; __i < 2; ++__i) { __n = (__w + __m - 1) / __m + __i; __n0 = __n - __w % __n; const unsigned __w0 = __w / __n; // __w0 <= __m __s0 = 0; __s1 = 0; if (__w0 < __cdig) { __s0 = __ctype(1) << __w0; __s1 = __s0 << 1; } __y0 = 0; __y1 = 0; if (__r) { __y0 = __s0 * (__r / __s0); if (__s1) __y1 = __s1 * (__r / __s1); if (__r - __y0 <= __y0 / __n) break; } else break; } result_type __sum = 0; for (size_t __k = 0; __k < __n0; ++__k) { __ctype __u; do __u = _M_b() - _M_b.min(); while (__y0 && __u >= __y0); __sum = __s0 * __sum + (__s0 ? __u % __s0 : __u); } for (size_t __k = __n0; __k < __n; ++__k) { __ctype __u; do __u = _M_b() - _M_b.min(); while (__y1 && __u >= __y1); __sum = __s1 * __sum + (__s1 ? __u % __s1 : __u); } return __sum; } template<typename _RandomNumberEngine, size_t __k> constexpr size_t shuffle_order_engine<_RandomNumberEngine, __k>::table_size; template<typename _RandomNumberEngine, size_t __k> typename shuffle_order_engine<_RandomNumberEngine, __k>::result_type shuffle_order_engine<_RandomNumberEngine, __k>:: operator()() { size_t __j = __k * ((_M_y - _M_b.min()) / (_M_b.max() - _M_b.min() + 1.0L)); _M_y = _M_v[__j]; _M_v[__j] = _M_b(); return _M_y; } template<typename _RandomNumberEngine, size_t __k, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const shuffle_order_engine<_RandomNumberEngine, __k>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left); __os.fill(__space); __os << __x.base(); for (size_t __i = 0; __i < __k; ++__i) __os << __space << __x._M_v[__i]; __os << __space << __x._M_y; __os.flags(__flags); __os.fill(__fill); return __os; } template<typename _RandomNumberEngine, size_t __k, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, shuffle_order_engine<_RandomNumberEngine, __k>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); __is >> __x._M_b; for (size_t __i = 0; __i < __k; ++__i) __is >> __x._M_v[__i]; __is >> __x._M_y; __is.flags(__flags); return __is; } template<typename _IntType> template<typename _UniformRandomNumberGenerator> typename uniform_int_distribution<_IntType>::result_type uniform_int_distribution<_IntType>:: operator()(_UniformRandomNumberGenerator& __urng, const param_type& __param) { typedef typename _UniformRandomNumberGenerator::result_type _Gresult_type; typedef typename std::make_unsigned<result_type>::type __utype; typedef typename std::common_type<_Gresult_type, __utype>::type __uctype; const __uctype __urngmin = __urng.min(); const __uctype __urngmax = __urng.max(); const __uctype __urngrange = __urngmax - __urngmin; const __uctype __urange = __uctype(__param.b()) - __uctype(__param.a()); __uctype __ret; if (__urngrange > __urange) { // downscaling const __uctype __uerange = __urange + 1; // __urange can be zero const __uctype __scaling = __urngrange / __uerange; const __uctype __past = __uerange * __scaling; do __ret = __uctype(__urng()) - __urngmin; while (__ret >= __past); __ret /= __scaling; } else if (__urngrange < __urange) { // upscaling /* Note that every value in [0, urange] can be written uniquely as (urngrange + 1) * high + low where high in [0, urange / (urngrange + 1)] and low in [0, urngrange]. */ __uctype __tmp; // wraparound control do { const __uctype __uerngrange = __urngrange + 1; __tmp = (__uerngrange * operator() (__urng, param_type(0, __urange / __uerngrange))); __ret = __tmp + (__uctype(__urng()) - __urngmin); } while (__ret > __urange || __ret < __tmp); } else __ret = __uctype(__urng()) - __urngmin; return __ret + __param.a(); } template<typename _IntType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void uniform_int_distribution<_IntType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __param) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) typedef typename _UniformRandomNumberGenerator::result_type _Gresult_type; typedef typename std::make_unsigned<result_type>::type __utype; typedef typename std::common_type<_Gresult_type, __utype>::type __uctype; const __uctype __urngmin = __urng.min(); const __uctype __urngmax = __urng.max(); const __uctype __urngrange = __urngmax - __urngmin; const __uctype __urange = __uctype(__param.b()) - __uctype(__param.a()); __uctype __ret; if (__urngrange > __urange) { if (__detail::_Power_of_2(__urngrange + 1) && __detail::_Power_of_2(__urange + 1)) { while (__f != __t) { __ret = __uctype(__urng()) - __urngmin; *__f++ = (__ret & __urange) + __param.a(); } } else { // downscaling const __uctype __uerange = __urange + 1; // __urange can be zero const __uctype __scaling = __urngrange / __uerange; const __uctype __past = __uerange * __scaling; while (__f != __t) { do __ret = __uctype(__urng()) - __urngmin; while (__ret >= __past); *__f++ = __ret / __scaling + __param.a(); } } } else if (__urngrange < __urange) { // upscaling /* Note that every value in [0, urange] can be written uniquely as (urngrange + 1) * high + low where high in [0, urange / (urngrange + 1)] and low in [0, urngrange]. */ __uctype __tmp; // wraparound control while (__f != __t) { do { const __uctype __uerngrange = __urngrange + 1; __tmp = (__uerngrange * operator() (__urng, param_type(0, __urange / __uerngrange))); __ret = __tmp + (__uctype(__urng()) - __urngmin); } while (__ret > __urange || __ret < __tmp); *__f++ = __ret; } } else while (__f != __t) *__f++ = __uctype(__urng()) - __urngmin + __param.a(); } template<typename _IntType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const uniform_int_distribution<_IntType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os << __x.a() << __space << __x.b(); __os.flags(__flags); __os.fill(__fill); return __os; } template<typename _IntType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, uniform_int_distribution<_IntType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _IntType __a, __b; __is >> __a >> __b; __x.param(typename uniform_int_distribution<_IntType>:: param_type(__a, __b)); __is.flags(__flags); return __is; } template<typename _RealType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void uniform_real_distribution<_RealType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); auto __range = __p.b() - __p.a(); while (__f != __t) *__f++ = __aurng() * __range + __p.a(); } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const uniform_real_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.a() << __space << __x.b(); __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, uniform_real_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::skipws); _RealType __a, __b; __is >> __a >> __b; __x.param(typename uniform_real_distribution<_RealType>:: param_type(__a, __b)); __is.flags(__flags); return __is; } template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void std::bernoulli_distribution:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __detail::_Adaptor<_UniformRandomNumberGenerator, double> __aurng(__urng); auto __limit = __p.p() * (__aurng.max() - __aurng.min()); while (__f != __t) *__f++ = (__aurng() - __aurng.min()) < __limit; } template<typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const bernoulli_distribution& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__os.widen(' ')); __os.precision(std::numeric_limits<double>::max_digits10); __os << __x.p(); __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _IntType> template<typename _UniformRandomNumberGenerator> typename geometric_distribution<_IntType>::result_type geometric_distribution<_IntType>:: operator()(_UniformRandomNumberGenerator& __urng, const param_type& __param) { // About the epsilon thing see this thread: // http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00971.html const double __naf = (1 - std::numeric_limits<double>::epsilon()) / 2; // The largest _RealType convertible to _IntType. const double __thr = std::numeric_limits<_IntType>::max() + __naf; __detail::_Adaptor<_UniformRandomNumberGenerator, double> __aurng(__urng); double __cand; do __cand = std::floor(std::log(1.0 - __aurng()) / __param._M_log_1_p); while (__cand >= __thr); return result_type(__cand + __naf); } template<typename _IntType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void geometric_distribution<_IntType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __param) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) // About the epsilon thing see this thread: // http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00971.html const double __naf = (1 - std::numeric_limits<double>::epsilon()) / 2; // The largest _RealType convertible to _IntType. const double __thr = std::numeric_limits<_IntType>::max() + __naf; __detail::_Adaptor<_UniformRandomNumberGenerator, double> __aurng(__urng); while (__f != __t) { double __cand; do __cand = std::floor(std::log(1.0 - __aurng()) / __param._M_log_1_p); while (__cand >= __thr); *__f++ = __cand + __naf; } } template<typename _IntType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const geometric_distribution<_IntType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__os.widen(' ')); __os.precision(std::numeric_limits<double>::max_digits10); __os << __x.p(); __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _IntType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, geometric_distribution<_IntType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::skipws); double __p; __is >> __p; __x.param(typename geometric_distribution<_IntType>::param_type(__p)); __is.flags(__flags); return __is; } // This is Leger's algorithm, also in Devroye, Ch. X, Example 1.5. template<typename _IntType> template<typename _UniformRandomNumberGenerator> typename negative_binomial_distribution<_IntType>::result_type negative_binomial_distribution<_IntType>:: operator()(_UniformRandomNumberGenerator& __urng) { const double __y = _M_gd(__urng); // XXX Is the constructor too slow? std::poisson_distribution<result_type> __poisson(__y); return __poisson(__urng); } template<typename _IntType> template<typename _UniformRandomNumberGenerator> typename negative_binomial_distribution<_IntType>::result_type negative_binomial_distribution<_IntType>:: operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { typedef typename std::gamma_distribution<double>::param_type param_type; const double __y = _M_gd(__urng, param_type(__p.k(), (1.0 - __p.p()) / __p.p())); std::poisson_distribution<result_type> __poisson(__y); return __poisson(__urng); } template<typename _IntType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void negative_binomial_distribution<_IntType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) while (__f != __t) { const double __y = _M_gd(__urng); // XXX Is the constructor too slow? std::poisson_distribution<result_type> __poisson(__y); *__f++ = __poisson(__urng); } } template<typename _IntType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void negative_binomial_distribution<_IntType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) typename std::gamma_distribution<result_type>::param_type __p2(__p.k(), (1.0 - __p.p()) / __p.p()); while (__f != __t) { const double __y = _M_gd(__urng, __p2); std::poisson_distribution<result_type> __poisson(__y); *__f++ = __poisson(__urng); } } template<typename _IntType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const negative_binomial_distribution<_IntType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__os.widen(' ')); __os.precision(std::numeric_limits<double>::max_digits10); __os << __x.k() << __space << __x.p() << __space << __x._M_gd; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _IntType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, negative_binomial_distribution<_IntType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::skipws); _IntType __k; double __p; __is >> __k >> __p >> __x._M_gd; __x.param(typename negative_binomial_distribution<_IntType>:: param_type(__k, __p)); __is.flags(__flags); return __is; } template<typename _IntType> void poisson_distribution<_IntType>::param_type:: _M_initialize() { #if _GLIBCXX_USE_C99_MATH_TR1 if (_M_mean >= 12) { const double __m = std::floor(_M_mean); _M_lm_thr = std::log(_M_mean); _M_lfm = std::lgamma(__m + 1); _M_sm = std::sqrt(__m); const double __pi_4 = 0.7853981633974483096156608458198757L; const double __dx = std::sqrt(2 * __m * std::log(32 * __m / __pi_4)); _M_d = std::round(std::max(6.0, std::min(__m, __dx))); const double __cx = 2 * __m + _M_d; _M_scx = std::sqrt(__cx / 2); _M_1cx = 1 / __cx; _M_c2b = std::sqrt(__pi_4 * __cx) * std::exp(_M_1cx); _M_cb = 2 * __cx * std::exp(-_M_d * _M_1cx * (1 + _M_d / 2)) / _M_d; } else #endif _M_lm_thr = std::exp(-_M_mean); } /** * A rejection algorithm when mean >= 12 and a simple method based * upon the multiplication of uniform random variates otherwise. * NB: The former is available only if _GLIBCXX_USE_C99_MATH_TR1 * is defined. * * Reference: * Devroye, L. Non-Uniform Random Variates Generation. Springer-Verlag, * New York, 1986, Ch. X, Sects. 3.3 & 3.4 (+ Errata!). */ template<typename _IntType> template<typename _UniformRandomNumberGenerator> typename poisson_distribution<_IntType>::result_type poisson_distribution<_IntType>:: operator()(_UniformRandomNumberGenerator& __urng, const param_type& __param) { __detail::_Adaptor<_UniformRandomNumberGenerator, double> __aurng(__urng); #if _GLIBCXX_USE_C99_MATH_TR1 if (__param.mean() >= 12) { double __x; // See comments above... const double __naf = (1 - std::numeric_limits<double>::epsilon()) / 2; const double __thr = std::numeric_limits<_IntType>::max() + __naf; const double __m = std::floor(__param.mean()); // sqrt(pi / 2) const double __spi_2 = 1.2533141373155002512078826424055226L; const double __c1 = __param._M_sm * __spi_2; const double __c2 = __param._M_c2b + __c1; const double __c3 = __c2 + 1; const double __c4 = __c3 + 1; // e^(1 / 78) const double __e178 = 1.0129030479320018583185514777512983L; const double __c5 = __c4 + __e178; const double __c = __param._M_cb + __c5; const double __2cx = 2 * (2 * __m + __param._M_d); bool __reject = true; do { const double __u = __c * __aurng(); const double __e = -std::log(1.0 - __aurng()); double __w = 0.0; if (__u <= __c1) { const double __n = _M_nd(__urng); const double __y = -std::abs(__n) * __param._M_sm - 1; __x = std::floor(__y); __w = -__n * __n / 2; if (__x < -__m) continue; } else if (__u <= __c2) { const double __n = _M_nd(__urng); const double __y = 1 + std::abs(__n) * __param._M_scx; __x = std::ceil(__y); __w = __y * (2 - __y) * __param._M_1cx; if (__x > __param._M_d) continue; } else if (__u <= __c3) // NB: This case not in the book, nor in the Errata, // but should be ok... __x = -1; else if (__u <= __c4) __x = 0; else if (__u <= __c5) __x = 1; else { const double __v = -std::log(1.0 - __aurng()); const double __y = __param._M_d + __v * __2cx / __param._M_d; __x = std::ceil(__y); __w = -__param._M_d * __param._M_1cx * (1 + __y / 2); } __reject = (__w - __e - __x * __param._M_lm_thr > __param._M_lfm - std::lgamma(__x + __m + 1)); __reject |= __x + __m >= __thr; } while (__reject); return result_type(__x + __m + __naf); } else #endif { _IntType __x = 0; double __prod = 1.0; do { __prod *= __aurng(); __x += 1; } while (__prod > __param._M_lm_thr); return __x - 1; } } template<typename _IntType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void poisson_distribution<_IntType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __param) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) // We could duplicate everything from operator()... while (__f != __t) *__f++ = this->operator()(__urng, __param); } template<typename _IntType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const poisson_distribution<_IntType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<double>::max_digits10); __os << __x.mean() << __space << __x._M_nd; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _IntType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, poisson_distribution<_IntType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::skipws); double __mean; __is >> __mean >> __x._M_nd; __x.param(typename poisson_distribution<_IntType>::param_type(__mean)); __is.flags(__flags); return __is; } template<typename _IntType> void binomial_distribution<_IntType>::param_type:: _M_initialize() { const double __p12 = _M_p <= 0.5 ? _M_p : 1.0 - _M_p; _M_easy = true; #if _GLIBCXX_USE_C99_MATH_TR1 if (_M_t * __p12 >= 8) { _M_easy = false; const double __np = std::floor(_M_t * __p12); const double __pa = __np / _M_t; const double __1p = 1 - __pa; const double __pi_4 = 0.7853981633974483096156608458198757L; const double __d1x = std::sqrt(__np * __1p * std::log(32 * __np / (81 * __pi_4 * __1p))); _M_d1 = std::round(std::max(1.0, __d1x)); const double __d2x = std::sqrt(__np * __1p * std::log(32 * _M_t * __1p / (__pi_4 * __pa))); _M_d2 = std::round(std::max(1.0, __d2x)); // sqrt(pi / 2) const double __spi_2 = 1.2533141373155002512078826424055226L; _M_s1 = std::sqrt(__np * __1p) * (1 + _M_d1 / (4 * __np)); _M_s2 = std::sqrt(__np * __1p) * (1 + _M_d2 / (4 * _M_t * __1p)); _M_c = 2 * _M_d1 / __np; _M_a1 = std::exp(_M_c) * _M_s1 * __spi_2; const double __a12 = _M_a1 + _M_s2 * __spi_2; const double __s1s = _M_s1 * _M_s1; _M_a123 = __a12 + (std::exp(_M_d1 / (_M_t * __1p)) * 2 * __s1s / _M_d1 * std::exp(-_M_d1 * _M_d1 / (2 * __s1s))); const double __s2s = _M_s2 * _M_s2; _M_s = (_M_a123 + 2 * __s2s / _M_d2 * std::exp(-_M_d2 * _M_d2 / (2 * __s2s))); _M_lf = (std::lgamma(__np + 1) + std::lgamma(_M_t - __np + 1)); _M_lp1p = std::log(__pa / __1p); _M_q = -std::log(1 - (__p12 - __pa) / __1p); } else #endif _M_q = -std::log(1 - __p12); } template<typename _IntType> template<typename _UniformRandomNumberGenerator> typename binomial_distribution<_IntType>::result_type binomial_distribution<_IntType>:: _M_waiting(_UniformRandomNumberGenerator& __urng, _IntType __t, double __q) { _IntType __x = 0; double __sum = 0.0; __detail::_Adaptor<_UniformRandomNumberGenerator, double> __aurng(__urng); do { if (__t == __x) return __x; const double __e = -std::log(1.0 - __aurng()); __sum += __e / (__t - __x); __x += 1; } while (__sum <= __q); return __x - 1; } /** * A rejection algorithm when t * p >= 8 and a simple waiting time * method - the second in the referenced book - otherwise. * NB: The former is available only if _GLIBCXX_USE_C99_MATH_TR1 * is defined. * * Reference: * Devroye, L. Non-Uniform Random Variates Generation. Springer-Verlag, * New York, 1986, Ch. X, Sect. 4 (+ Errata!). */ template<typename _IntType> template<typename _UniformRandomNumberGenerator> typename binomial_distribution<_IntType>::result_type binomial_distribution<_IntType>:: operator()(_UniformRandomNumberGenerator& __urng, const param_type& __param) { result_type __ret; const _IntType __t = __param.t(); const double __p = __param.p(); const double __p12 = __p <= 0.5 ? __p : 1.0 - __p; __detail::_Adaptor<_UniformRandomNumberGenerator, double> __aurng(__urng); #if _GLIBCXX_USE_C99_MATH_TR1 if (!__param._M_easy) { double __x; // See comments above... const double __naf = (1 - std::numeric_limits<double>::epsilon()) / 2; const double __thr = std::numeric_limits<_IntType>::max() + __naf; const double __np = std::floor(__t * __p12); // sqrt(pi / 2) const double __spi_2 = 1.2533141373155002512078826424055226L; const double __a1 = __param._M_a1; const double __a12 = __a1 + __param._M_s2 * __spi_2; const double __a123 = __param._M_a123; const double __s1s = __param._M_s1 * __param._M_s1; const double __s2s = __param._M_s2 * __param._M_s2; bool __reject; do { const double __u = __param._M_s * __aurng(); double __v; if (__u <= __a1) { const double __n = _M_nd(__urng); const double __y = __param._M_s1 * std::abs(__n); __reject = __y >= __param._M_d1; if (!__reject) { const double __e = -std::log(1.0 - __aurng()); __x = std::floor(__y); __v = -__e - __n * __n / 2 + __param._M_c; } } else if (__u <= __a12) { const double __n = _M_nd(__urng); const double __y = __param._M_s2 * std::abs(__n); __reject = __y >= __param._M_d2; if (!__reject) { const double __e = -std::log(1.0 - __aurng()); __x = std::floor(-__y); __v = -__e - __n * __n / 2; } } else if (__u <= __a123) { const double __e1 = -std::log(1.0 - __aurng()); const double __e2 = -std::log(1.0 - __aurng()); const double __y = __param._M_d1 + 2 * __s1s * __e1 / __param._M_d1; __x = std::floor(__y); __v = (-__e2 + __param._M_d1 * (1 / (__t - __np) -__y / (2 * __s1s))); __reject = false; } else { const double __e1 = -std::log(1.0 - __aurng()); const double __e2 = -std::log(1.0 - __aurng()); const double __y = __param._M_d2 + 2 * __s2s * __e1 / __param._M_d2; __x = std::floor(-__y); __v = -__e2 - __param._M_d2 * __y / (2 * __s2s); __reject = false; } __reject = __reject || __x < -__np || __x > __t - __np; if (!__reject) { const double __lfx = std::lgamma(__np + __x + 1) + std::lgamma(__t - (__np + __x) + 1); __reject = __v > __param._M_lf - __lfx + __x * __param._M_lp1p; } __reject |= __x + __np >= __thr; } while (__reject); __x += __np + __naf; const _IntType __z = _M_waiting(__urng, __t - _IntType(__x), __param._M_q); __ret = _IntType(__x) + __z; } else #endif __ret = _M_waiting(__urng, __t, __param._M_q); if (__p12 != __p) __ret = __t - __ret; return __ret; } template<typename _IntType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void binomial_distribution<_IntType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __param) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) // We could duplicate everything from operator()... while (__f != __t) *__f++ = this->operator()(__urng, __param); } template<typename _IntType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const binomial_distribution<_IntType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<double>::max_digits10); __os << __x.t() << __space << __x.p() << __space << __x._M_nd; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _IntType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, binomial_distribution<_IntType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _IntType __t; double __p; __is >> __t >> __p >> __x._M_nd; __x.param(typename binomial_distribution<_IntType>:: param_type(__t, __p)); __is.flags(__flags); return __is; } template<typename _RealType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void std::exponential_distribution<_RealType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); while (__f != __t) *__f++ = -std::log(result_type(1) - __aurng()) / __p.lambda(); } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const exponential_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__os.widen(' ')); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.lambda(); __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, exponential_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _RealType __lambda; __is >> __lambda; __x.param(typename exponential_distribution<_RealType>:: param_type(__lambda)); __is.flags(__flags); return __is; } /** * Polar method due to Marsaglia. * * Devroye, L. Non-Uniform Random Variates Generation. Springer-Verlag, * New York, 1986, Ch. V, Sect. 4.4. */ template<typename _RealType> template<typename _UniformRandomNumberGenerator> typename normal_distribution<_RealType>::result_type normal_distribution<_RealType>:: operator()(_UniformRandomNumberGenerator& __urng, const param_type& __param) { result_type __ret; __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); if (_M_saved_available) { _M_saved_available = false; __ret = _M_saved; } else { result_type __x, __y, __r2; do { __x = result_type(2.0) * __aurng() - 1.0; __y = result_type(2.0) * __aurng() - 1.0; __r2 = __x * __x + __y * __y; } while (__r2 > 1.0 || __r2 == 0.0); const result_type __mult = std::sqrt(-2 * std::log(__r2) / __r2); _M_saved = __x * __mult; _M_saved_available = true; __ret = __y * __mult; } __ret = __ret * __param.stddev() + __param.mean(); return __ret; } template<typename _RealType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void normal_distribution<_RealType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __param) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) if (__f == __t) return; if (_M_saved_available) { _M_saved_available = false; *__f++ = _M_saved * __param.stddev() + __param.mean(); if (__f == __t) return; } __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); while (__f + 1 < __t) { result_type __x, __y, __r2; do { __x = result_type(2.0) * __aurng() - 1.0; __y = result_type(2.0) * __aurng() - 1.0; __r2 = __x * __x + __y * __y; } while (__r2 > 1.0 || __r2 == 0.0); const result_type __mult = std::sqrt(-2 * std::log(__r2) / __r2); *__f++ = __y * __mult * __param.stddev() + __param.mean(); *__f++ = __x * __mult * __param.stddev() + __param.mean(); } if (__f != __t) { result_type __x, __y, __r2; do { __x = result_type(2.0) * __aurng() - 1.0; __y = result_type(2.0) * __aurng() - 1.0; __r2 = __x * __x + __y * __y; } while (__r2 > 1.0 || __r2 == 0.0); const result_type __mult = std::sqrt(-2 * std::log(__r2) / __r2); _M_saved = __x * __mult; _M_saved_available = true; *__f = __y * __mult * __param.stddev() + __param.mean(); } } template<typename _RealType> bool operator==(const std::normal_distribution<_RealType>& __d1, const std::normal_distribution<_RealType>& __d2) { if (__d1._M_param == __d2._M_param && __d1._M_saved_available == __d2._M_saved_available) { if (__d1._M_saved_available && __d1._M_saved == __d2._M_saved) return true; else if(!__d1._M_saved_available) return true; else return false; } else return false; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const normal_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.mean() << __space << __x.stddev() << __space << __x._M_saved_available; if (__x._M_saved_available) __os << __space << __x._M_saved; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, normal_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); double __mean, __stddev; __is >> __mean >> __stddev >> __x._M_saved_available; if (__x._M_saved_available) __is >> __x._M_saved; __x.param(typename normal_distribution<_RealType>:: param_type(__mean, __stddev)); __is.flags(__flags); return __is; } template<typename _RealType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void lognormal_distribution<_RealType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) while (__f != __t) *__f++ = std::exp(__p.s() * _M_nd(__urng) + __p.m()); } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const lognormal_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.m() << __space << __x.s() << __space << __x._M_nd; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, lognormal_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _RealType __m, __s; __is >> __m >> __s >> __x._M_nd; __x.param(typename lognormal_distribution<_RealType>:: param_type(__m, __s)); __is.flags(__flags); return __is; } template<typename _RealType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void std::chi_squared_distribution<_RealType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) while (__f != __t) *__f++ = 2 * _M_gd(__urng); } template<typename _RealType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void std::chi_squared_distribution<_RealType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const typename std::gamma_distribution<result_type>::param_type& __p) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) while (__f != __t) *__f++ = 2 * _M_gd(__urng, __p); } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const chi_squared_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.n() << __space << __x._M_gd; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, chi_squared_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _RealType __n; __is >> __n >> __x._M_gd; __x.param(typename chi_squared_distribution<_RealType>:: param_type(__n)); __is.flags(__flags); return __is; } template<typename _RealType> template<typename _UniformRandomNumberGenerator> typename cauchy_distribution<_RealType>::result_type cauchy_distribution<_RealType>:: operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); _RealType __u; do __u = __aurng(); while (__u == 0.5); const _RealType __pi = 3.1415926535897932384626433832795029L; return __p.a() + __p.b() * std::tan(__pi * __u); } template<typename _RealType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void cauchy_distribution<_RealType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) const _RealType __pi = 3.1415926535897932384626433832795029L; __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); while (__f != __t) { _RealType __u; do __u = __aurng(); while (__u == 0.5); *__f++ = __p.a() + __p.b() * std::tan(__pi * __u); } } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const cauchy_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.a() << __space << __x.b(); __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, cauchy_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _RealType __a, __b; __is >> __a >> __b; __x.param(typename cauchy_distribution<_RealType>:: param_type(__a, __b)); __is.flags(__flags); return __is; } template<typename _RealType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void std::fisher_f_distribution<_RealType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) while (__f != __t) *__f++ = ((_M_gd_x(__urng) * n()) / (_M_gd_y(__urng) * m())); } template<typename _RealType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void std::fisher_f_distribution<_RealType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) typedef typename std::gamma_distribution<result_type>::param_type param_type; param_type __p1(__p.m() / 2); param_type __p2(__p.n() / 2); while (__f != __t) *__f++ = ((_M_gd_x(__urng, __p1) * n()) / (_M_gd_y(__urng, __p2) * m())); } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const fisher_f_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.m() << __space << __x.n() << __space << __x._M_gd_x << __space << __x._M_gd_y; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, fisher_f_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _RealType __m, __n; __is >> __m >> __n >> __x._M_gd_x >> __x._M_gd_y; __x.param(typename fisher_f_distribution<_RealType>:: param_type(__m, __n)); __is.flags(__flags); return __is; } template<typename _RealType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void std::student_t_distribution<_RealType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) while (__f != __t) *__f++ = _M_nd(__urng) * std::sqrt(n() / _M_gd(__urng)); } template<typename _RealType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void std::student_t_distribution<_RealType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) typename std::gamma_distribution<result_type>::param_type __p2(__p.n() / 2, 2); while (__f != __t) *__f++ = _M_nd(__urng) * std::sqrt(__p.n() / _M_gd(__urng, __p2)); } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const student_t_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.n() << __space << __x._M_nd << __space << __x._M_gd; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, student_t_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _RealType __n; __is >> __n >> __x._M_nd >> __x._M_gd; __x.param(typename student_t_distribution<_RealType>::param_type(__n)); __is.flags(__flags); return __is; } template<typename _RealType> void gamma_distribution<_RealType>::param_type:: _M_initialize() { _M_malpha = _M_alpha < 1.0 ? _M_alpha + _RealType(1.0) : _M_alpha; const _RealType __a1 = _M_malpha - _RealType(1.0) / _RealType(3.0); _M_a2 = _RealType(1.0) / std::sqrt(_RealType(9.0) * __a1); } /** * Marsaglia, G. and Tsang, W. W. * "A Simple Method for Generating Gamma Variables" * ACM Transactions on Mathematical Software, 26, 3, 363-372, 2000. */ template<typename _RealType> template<typename _UniformRandomNumberGenerator> typename gamma_distribution<_RealType>::result_type gamma_distribution<_RealType>:: operator()(_UniformRandomNumberGenerator& __urng, const param_type& __param) { __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); result_type __u, __v, __n; const result_type __a1 = (__param._M_malpha - _RealType(1.0) / _RealType(3.0)); do { do { __n = _M_nd(__urng); __v = result_type(1.0) + __param._M_a2 * __n; } while (__v <= 0.0); __v = __v * __v * __v; __u = __aurng(); } while (__u > result_type(1.0) - 0.331 * __n * __n * __n * __n && (std::log(__u) > (0.5 * __n * __n + __a1 * (1.0 - __v + std::log(__v))))); if (__param.alpha() == __param._M_malpha) return __a1 * __v * __param.beta(); else { do __u = __aurng(); while (__u == 0.0); return (std::pow(__u, result_type(1.0) / __param.alpha()) * __a1 * __v * __param.beta()); } } template<typename _RealType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void gamma_distribution<_RealType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __param) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); result_type __u, __v, __n; const result_type __a1 = (__param._M_malpha - _RealType(1.0) / _RealType(3.0)); if (__param.alpha() == __param._M_malpha) while (__f != __t) { do { do { __n = _M_nd(__urng); __v = result_type(1.0) + __param._M_a2 * __n; } while (__v <= 0.0); __v = __v * __v * __v; __u = __aurng(); } while (__u > result_type(1.0) - 0.331 * __n * __n * __n * __n && (std::log(__u) > (0.5 * __n * __n + __a1 * (1.0 - __v + std::log(__v))))); *__f++ = __a1 * __v * __param.beta(); } else while (__f != __t) { do { do { __n = _M_nd(__urng); __v = result_type(1.0) + __param._M_a2 * __n; } while (__v <= 0.0); __v = __v * __v * __v; __u = __aurng(); } while (__u > result_type(1.0) - 0.331 * __n * __n * __n * __n && (std::log(__u) > (0.5 * __n * __n + __a1 * (1.0 - __v + std::log(__v))))); do __u = __aurng(); while (__u == 0.0); *__f++ = (std::pow(__u, result_type(1.0) / __param.alpha()) * __a1 * __v * __param.beta()); } } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const gamma_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.alpha() << __space << __x.beta() << __space << __x._M_nd; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, gamma_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _RealType __alpha_val, __beta_val; __is >> __alpha_val >> __beta_val >> __x._M_nd; __x.param(typename gamma_distribution<_RealType>:: param_type(__alpha_val, __beta_val)); __is.flags(__flags); return __is; } template<typename _RealType> template<typename _UniformRandomNumberGenerator> typename weibull_distribution<_RealType>::result_type weibull_distribution<_RealType>:: operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); return __p.b() * std::pow(-std::log(result_type(1) - __aurng()), result_type(1) / __p.a()); } template<typename _RealType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void weibull_distribution<_RealType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); auto __inv_a = result_type(1) / __p.a(); while (__f != __t) *__f++ = __p.b() * std::pow(-std::log(result_type(1) - __aurng()), __inv_a); } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const weibull_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.a() << __space << __x.b(); __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, weibull_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _RealType __a, __b; __is >> __a >> __b; __x.param(typename weibull_distribution<_RealType>:: param_type(__a, __b)); __is.flags(__flags); return __is; } template<typename _RealType> template<typename _UniformRandomNumberGenerator> typename extreme_value_distribution<_RealType>::result_type extreme_value_distribution<_RealType>:: operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); return __p.a() - __p.b() * std::log(-std::log(result_type(1) - __aurng())); } template<typename _RealType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void extreme_value_distribution<_RealType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __p) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> __aurng(__urng); while (__f != __t) *__f++ = __p.a() - __p.b() * std::log(-std::log(result_type(1) - __aurng())); } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const extreme_value_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); __os << __x.a() << __space << __x.b(); __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, extreme_value_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); _RealType __a, __b; __is >> __a >> __b; __x.param(typename extreme_value_distribution<_RealType>:: param_type(__a, __b)); __is.flags(__flags); return __is; } template<typename _IntType> void discrete_distribution<_IntType>::param_type:: _M_initialize() { if (_M_prob.size() < 2) { _M_prob.clear(); return; } const double __sum = std::accumulate(_M_prob.begin(), _M_prob.end(), 0.0); // Now normalize the probabilites. __detail::__normalize(_M_prob.begin(), _M_prob.end(), _M_prob.begin(), __sum); // Accumulate partial sums. _M_cp.reserve(_M_prob.size()); std::partial_sum(_M_prob.begin(), _M_prob.end(), std::back_inserter(_M_cp)); // Make sure the last cumulative probability is one. _M_cp[_M_cp.size() - 1] = 1.0; } template<typename _IntType> template<typename _Func> discrete_distribution<_IntType>::param_type:: param_type(size_t __nw, double __xmin, double __xmax, _Func __fw) : _M_prob(), _M_cp() { const size_t __n = __nw == 0 ? 1 : __nw; const double __delta = (__xmax - __xmin) / __n; _M_prob.reserve(__n); for (size_t __k = 0; __k < __nw; ++__k) _M_prob.push_back(__fw(__xmin + __k * __delta + 0.5 * __delta)); _M_initialize(); } template<typename _IntType> template<typename _UniformRandomNumberGenerator> typename discrete_distribution<_IntType>::result_type discrete_distribution<_IntType>:: operator()(_UniformRandomNumberGenerator& __urng, const param_type& __param) { if (__param._M_cp.empty()) return result_type(0); __detail::_Adaptor<_UniformRandomNumberGenerator, double> __aurng(__urng); const double __p = __aurng(); auto __pos = std::lower_bound(__param._M_cp.begin(), __param._M_cp.end(), __p); return __pos - __param._M_cp.begin(); } template<typename _IntType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void discrete_distribution<_IntType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __param) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) if (__param._M_cp.empty()) { while (__f != __t) *__f++ = result_type(0); return; } __detail::_Adaptor<_UniformRandomNumberGenerator, double> __aurng(__urng); while (__f != __t) { const double __p = __aurng(); auto __pos = std::lower_bound(__param._M_cp.begin(), __param._M_cp.end(), __p); *__f++ = __pos - __param._M_cp.begin(); } } template<typename _IntType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const discrete_distribution<_IntType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<double>::max_digits10); std::vector<double> __prob = __x.probabilities(); __os << __prob.size(); for (auto __dit = __prob.begin(); __dit != __prob.end(); ++__dit) __os << __space << *__dit; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _IntType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, discrete_distribution<_IntType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); size_t __n; __is >> __n; std::vector<double> __prob_vec; __prob_vec.reserve(__n); for (; __n != 0; --__n) { double __prob; __is >> __prob; __prob_vec.push_back(__prob); } __x.param(typename discrete_distribution<_IntType>:: param_type(__prob_vec.begin(), __prob_vec.end())); __is.flags(__flags); return __is; } template<typename _RealType> void piecewise_constant_distribution<_RealType>::param_type:: _M_initialize() { if (_M_int.size() < 2 || (_M_int.size() == 2 && _M_int[0] == _RealType(0) && _M_int[1] == _RealType(1))) { _M_int.clear(); _M_den.clear(); return; } const double __sum = std::accumulate(_M_den.begin(), _M_den.end(), 0.0); __detail::__normalize(_M_den.begin(), _M_den.end(), _M_den.begin(), __sum); _M_cp.reserve(_M_den.size()); std::partial_sum(_M_den.begin(), _M_den.end(), std::back_inserter(_M_cp)); // Make sure the last cumulative probability is one. _M_cp[_M_cp.size() - 1] = 1.0; for (size_t __k = 0; __k < _M_den.size(); ++__k) _M_den[__k] /= _M_int[__k + 1] - _M_int[__k]; } template<typename _RealType> template<typename _InputIteratorB, typename _InputIteratorW> piecewise_constant_distribution<_RealType>::param_type:: param_type(_InputIteratorB __bbegin, _InputIteratorB __bend, _InputIteratorW __wbegin) : _M_int(), _M_den(), _M_cp() { if (__bbegin != __bend) { for (;;) { _M_int.push_back(*__bbegin); ++__bbegin; if (__bbegin == __bend) break; _M_den.push_back(*__wbegin); ++__wbegin; } } _M_initialize(); } template<typename _RealType> template<typename _Func> piecewise_constant_distribution<_RealType>::param_type:: param_type(initializer_list<_RealType> __bl, _Func __fw) : _M_int(), _M_den(), _M_cp() { _M_int.reserve(__bl.size()); for (auto __biter = __bl.begin(); __biter != __bl.end(); ++__biter) _M_int.push_back(*__biter); _M_den.reserve(_M_int.size() - 1); for (size_t __k = 0; __k < _M_int.size() - 1; ++__k) _M_den.push_back(__fw(0.5 * (_M_int[__k + 1] + _M_int[__k]))); _M_initialize(); } template<typename _RealType> template<typename _Func> piecewise_constant_distribution<_RealType>::param_type:: param_type(size_t __nw, _RealType __xmin, _RealType __xmax, _Func __fw) : _M_int(), _M_den(), _M_cp() { const size_t __n = __nw == 0 ? 1 : __nw; const _RealType __delta = (__xmax - __xmin) / __n; _M_int.reserve(__n + 1); for (size_t __k = 0; __k <= __nw; ++__k) _M_int.push_back(__xmin + __k * __delta); _M_den.reserve(__n); for (size_t __k = 0; __k < __nw; ++__k) _M_den.push_back(__fw(_M_int[__k] + 0.5 * __delta)); _M_initialize(); } template<typename _RealType> template<typename _UniformRandomNumberGenerator> typename piecewise_constant_distribution<_RealType>::result_type piecewise_constant_distribution<_RealType>:: operator()(_UniformRandomNumberGenerator& __urng, const param_type& __param) { __detail::_Adaptor<_UniformRandomNumberGenerator, double> __aurng(__urng); const double __p = __aurng(); if (__param._M_cp.empty()) return __p; auto __pos = std::lower_bound(__param._M_cp.begin(), __param._M_cp.end(), __p); const size_t __i = __pos - __param._M_cp.begin(); const double __pref = __i > 0 ? __param._M_cp[__i - 1] : 0.0; return __param._M_int[__i] + (__p - __pref) / __param._M_den[__i]; } template<typename _RealType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void piecewise_constant_distribution<_RealType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __param) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __detail::_Adaptor<_UniformRandomNumberGenerator, double> __aurng(__urng); if (__param._M_cp.empty()) { while (__f != __t) *__f++ = __aurng(); return; } while (__f != __t) { const double __p = __aurng(); auto __pos = std::lower_bound(__param._M_cp.begin(), __param._M_cp.end(), __p); const size_t __i = __pos - __param._M_cp.begin(); const double __pref = __i > 0 ? __param._M_cp[__i - 1] : 0.0; *__f++ = (__param._M_int[__i] + (__p - __pref) / __param._M_den[__i]); } } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const piecewise_constant_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); std::vector<_RealType> __int = __x.intervals(); __os << __int.size() - 1; for (auto __xit = __int.begin(); __xit != __int.end(); ++__xit) __os << __space << *__xit; std::vector<double> __den = __x.densities(); for (auto __dit = __den.begin(); __dit != __den.end(); ++__dit) __os << __space << *__dit; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, piecewise_constant_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); size_t __n; __is >> __n; std::vector<_RealType> __int_vec; __int_vec.reserve(__n + 1); for (size_t __i = 0; __i <= __n; ++__i) { _RealType __int; __is >> __int; __int_vec.push_back(__int); } std::vector<double> __den_vec; __den_vec.reserve(__n); for (size_t __i = 0; __i < __n; ++__i) { double __den; __is >> __den; __den_vec.push_back(__den); } __x.param(typename piecewise_constant_distribution<_RealType>:: param_type(__int_vec.begin(), __int_vec.end(), __den_vec.begin())); __is.flags(__flags); return __is; } template<typename _RealType> void piecewise_linear_distribution<_RealType>::param_type:: _M_initialize() { if (_M_int.size() < 2 || (_M_int.size() == 2 && _M_int[0] == _RealType(0) && _M_int[1] == _RealType(1) && _M_den[0] == _M_den[1])) { _M_int.clear(); _M_den.clear(); return; } double __sum = 0.0; _M_cp.reserve(_M_int.size() - 1); _M_m.reserve(_M_int.size() - 1); for (size_t __k = 0; __k < _M_int.size() - 1; ++__k) { const _RealType __delta = _M_int[__k + 1] - _M_int[__k]; __sum += 0.5 * (_M_den[__k + 1] + _M_den[__k]) * __delta; _M_cp.push_back(__sum); _M_m.push_back((_M_den[__k + 1] - _M_den[__k]) / __delta); } // Now normalize the densities... __detail::__normalize(_M_den.begin(), _M_den.end(), _M_den.begin(), __sum); // ... and partial sums... __detail::__normalize(_M_cp.begin(), _M_cp.end(), _M_cp.begin(), __sum); // ... and slopes. __detail::__normalize(_M_m.begin(), _M_m.end(), _M_m.begin(), __sum); // Make sure the last cumulative probablility is one. _M_cp[_M_cp.size() - 1] = 1.0; } template<typename _RealType> template<typename _InputIteratorB, typename _InputIteratorW> piecewise_linear_distribution<_RealType>::param_type:: param_type(_InputIteratorB __bbegin, _InputIteratorB __bend, _InputIteratorW __wbegin) : _M_int(), _M_den(), _M_cp(), _M_m() { for (; __bbegin != __bend; ++__bbegin, ++__wbegin) { _M_int.push_back(*__bbegin); _M_den.push_back(*__wbegin); } _M_initialize(); } template<typename _RealType> template<typename _Func> piecewise_linear_distribution<_RealType>::param_type:: param_type(initializer_list<_RealType> __bl, _Func __fw) : _M_int(), _M_den(), _M_cp(), _M_m() { _M_int.reserve(__bl.size()); _M_den.reserve(__bl.size()); for (auto __biter = __bl.begin(); __biter != __bl.end(); ++__biter) { _M_int.push_back(*__biter); _M_den.push_back(__fw(*__biter)); } _M_initialize(); } template<typename _RealType> template<typename _Func> piecewise_linear_distribution<_RealType>::param_type:: param_type(size_t __nw, _RealType __xmin, _RealType __xmax, _Func __fw) : _M_int(), _M_den(), _M_cp(), _M_m() { const size_t __n = __nw == 0 ? 1 : __nw; const _RealType __delta = (__xmax - __xmin) / __n; _M_int.reserve(__n + 1); _M_den.reserve(__n + 1); for (size_t __k = 0; __k <= __nw; ++__k) { _M_int.push_back(__xmin + __k * __delta); _M_den.push_back(__fw(_M_int[__k] + __delta)); } _M_initialize(); } template<typename _RealType> template<typename _UniformRandomNumberGenerator> typename piecewise_linear_distribution<_RealType>::result_type piecewise_linear_distribution<_RealType>:: operator()(_UniformRandomNumberGenerator& __urng, const param_type& __param) { __detail::_Adaptor<_UniformRandomNumberGenerator, double> __aurng(__urng); const double __p = __aurng(); if (__param._M_cp.empty()) return __p; auto __pos = std::lower_bound(__param._M_cp.begin(), __param._M_cp.end(), __p); const size_t __i = __pos - __param._M_cp.begin(); const double __pref = __i > 0 ? __param._M_cp[__i - 1] : 0.0; const double __a = 0.5 * __param._M_m[__i]; const double __b = __param._M_den[__i]; const double __cm = __p - __pref; _RealType __x = __param._M_int[__i]; if (__a == 0) __x += __cm / __b; else { const double __d = __b * __b + 4.0 * __a * __cm; __x += 0.5 * (std::sqrt(__d) - __b) / __a; } return __x; } template<typename _RealType> template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void piecewise_linear_distribution<_RealType>:: __generate_impl(_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator& __urng, const param_type& __param) { __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) // We could duplicate everything from operator()... while (__f != __t) *__f++ = this->operator()(__urng, __param); } template<typename _RealType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, const piecewise_linear_distribution<_RealType>& __x) { typedef std::basic_ostream<_CharT, _Traits> __ostream_type; typedef typename __ostream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __os.flags(); const _CharT __fill = __os.fill(); const std::streamsize __precision = __os.precision(); const _CharT __space = __os.widen(' '); __os.flags(__ios_base::scientific | __ios_base::left); __os.fill(__space); __os.precision(std::numeric_limits<_RealType>::max_digits10); std::vector<_RealType> __int = __x.intervals(); __os << __int.size() - 1; for (auto __xit = __int.begin(); __xit != __int.end(); ++__xit) __os << __space << *__xit; std::vector<double> __den = __x.densities(); for (auto __dit = __den.begin(); __dit != __den.end(); ++__dit) __os << __space << *__dit; __os.flags(__flags); __os.fill(__fill); __os.precision(__precision); return __os; } template<typename _RealType, typename _CharT, typename _Traits> std::basic_istream<_CharT, _Traits>& operator>>(std::basic_istream<_CharT, _Traits>& __is, piecewise_linear_distribution<_RealType>& __x) { typedef std::basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::ios_base __ios_base; const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); size_t __n; __is >> __n; std::vector<_RealType> __int_vec; __int_vec.reserve(__n + 1); for (size_t __i = 0; __i <= __n; ++__i) { _RealType __int; __is >> __int; __int_vec.push_back(__int); } std::vector<double> __den_vec; __den_vec.reserve(__n + 1); for (size_t __i = 0; __i <= __n; ++__i) { double __den; __is >> __den; __den_vec.push_back(__den); } __x.param(typename piecewise_linear_distribution<_RealType>:: param_type(__int_vec.begin(), __int_vec.end(), __den_vec.begin())); __is.flags(__flags); return __is; } template<typename _IntType> seed_seq::seed_seq(std::initializer_list<_IntType> __il) { for (auto __iter = __il.begin(); __iter != __il.end(); ++__iter) _M_v.push_back(__detail::__mod<result_type, __detail::_Shift<result_type, 32>::__value>(*__iter)); } template<typename _InputIterator> seed_seq::seed_seq(_InputIterator __begin, _InputIterator __end) { for (_InputIterator __iter = __begin; __iter != __end; ++__iter) _M_v.push_back(__detail::__mod<result_type, __detail::_Shift<result_type, 32>::__value>(*__iter)); } template<typename _RandomAccessIterator> void seed_seq::generate(_RandomAccessIterator __begin, _RandomAccessIterator __end) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _Type; if (__begin == __end) return; std::fill(__begin, __end, _Type(0x8b8b8b8bu)); const size_t __n = __end - __begin; const size_t __s = _M_v.size(); const size_t __t = (__n >= 623) ? 11 : (__n >= 68) ? 7 : (__n >= 39) ? 5 : (__n >= 7) ? 3 : (__n - 1) / 2; const size_t __p = (__n - __t) / 2; const size_t __q = __p + __t; const size_t __m = std::max(size_t(__s + 1), __n); for (size_t __k = 0; __k < __m; ++__k) { _Type __arg = (__begin[__k % __n] ^ __begin[(__k + __p) % __n] ^ __begin[(__k - 1) % __n]); _Type __r1 = __arg ^ (__arg >> 27); __r1 = __detail::__mod<_Type, __detail::_Shift<_Type, 32>::__value>(1664525u * __r1); _Type __r2 = __r1; if (__k == 0) __r2 += __s; else if (__k <= __s) __r2 += __k % __n + _M_v[__k - 1]; else __r2 += __k % __n; __r2 = __detail::__mod<_Type, __detail::_Shift<_Type, 32>::__value>(__r2); __begin[(__k + __p) % __n] += __r1; __begin[(__k + __q) % __n] += __r2; __begin[__k % __n] = __r2; } for (size_t __k = __m; __k < __m + __n; ++__k) { _Type __arg = (__begin[__k % __n] + __begin[(__k + __p) % __n] + __begin[(__k - 1) % __n]); _Type __r3 = __arg ^ (__arg >> 27); __r3 = __detail::__mod<_Type, __detail::_Shift<_Type, 32>::__value>(1566083941u * __r3); _Type __r4 = __r3 - __k % __n; __r4 = __detail::__mod<_Type, __detail::_Shift<_Type, 32>::__value>(__r4); __begin[(__k + __p) % __n] ^= __r3; __begin[(__k + __q) % __n] ^= __r4; __begin[__k % __n] = __r4; } } template<typename _RealType, size_t __bits, typename _UniformRandomNumberGenerator> _RealType generate_canonical(_UniformRandomNumberGenerator& __urng) { const size_t __b = std::min(static_cast<size_t>(std::numeric_limits<_RealType>::digits), __bits); const long double __r = static_cast<long double>(__urng.max()) - static_cast<long double>(__urng.min()) + 1.0L; const size_t __log2r = std::log(__r) / std::log(2.0L); size_t __k = std::max<size_t>(1UL, (__b + __log2r - 1UL) / __log2r); _RealType __sum = _RealType(0); _RealType __tmp = _RealType(1); for (; __k != 0; --__k) { __sum += _RealType(__urng() - __urng.min()) * __tmp; __tmp *= __r; } return __sum / __tmp; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/gslice.h�����������������������������������������������������������������������������0000644�����������������00000012616�14763166030�0010161 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// The template and inlines for the -*- C++ -*- gslice class. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/gslice.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{valarray} */ // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr> #ifndef _GSLICE_H #define _GSLICE_H 1 #pragma GCC system_header namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup numeric_arrays * @{ */ /** * @brief Class defining multi-dimensional subset of an array. * * The slice class represents a multi-dimensional subset of an array, * specified by three parameter sets: start offset, size array, and stride * array. The start offset is the index of the first element of the array * that is part of the subset. The size and stride array describe each * dimension of the slice. Size is the number of elements in that * dimension, and stride is the distance in the array between successive * elements in that dimension. Each dimension's size and stride is taken * to begin at an array element described by the previous dimension. The * size array and stride array must be the same size. * * For example, if you have offset==3, stride[0]==11, size[1]==3, * stride[1]==3, then slice[0,0]==array[3], slice[0,1]==array[6], * slice[0,2]==array[9], slice[1,0]==array[14], slice[1,1]==array[17], * slice[1,2]==array[20]. */ class gslice { public: /// Construct an empty slice. gslice(); /** * @brief Construct a slice. * * Constructs a slice with as many dimensions as the length of the @a l * and @a s arrays. * * @param __o Offset in array of first element. * @param __l Array of dimension lengths. * @param __s Array of dimension strides between array elements. */ gslice(size_t __o, const valarray<size_t>& __l, const valarray<size_t>& __s); // XXX: the IS says the copy-ctor and copy-assignment operators are // synthesized by the compiler but they are just unsuitable // for a ref-counted semantic /// Copy constructor. gslice(const gslice&); /// Destructor. ~gslice(); // XXX: See the note above. /// Assignment operator. gslice& operator=(const gslice&); /// Return array offset of first slice element. size_t start() const; /// Return array of sizes of slice dimensions. valarray<size_t> size() const; /// Return array of array strides for each dimension. valarray<size_t> stride() const; private: struct _Indexer { size_t _M_count; size_t _M_start; valarray<size_t> _M_size; valarray<size_t> _M_stride; valarray<size_t> _M_index; // Linear array of referenced indices _Indexer() : _M_count(1), _M_start(0), _M_size(), _M_stride(), _M_index() {} _Indexer(size_t, const valarray<size_t>&, const valarray<size_t>&); void _M_increment_use() { ++_M_count; } size_t _M_decrement_use() { return --_M_count; } }; _Indexer* _M_index; template<typename _Tp> friend class valarray; }; inline size_t gslice::start() const { return _M_index ? _M_index->_M_start : 0; } inline valarray<size_t> gslice::size() const { return _M_index ? _M_index->_M_size : valarray<size_t>(); } inline valarray<size_t> gslice::stride() const { return _M_index ? _M_index->_M_stride : valarray<size_t>(); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 543. valarray slice default constructor inline gslice::gslice() : _M_index(new gslice::_Indexer()) {} inline gslice::gslice(size_t __o, const valarray<size_t>& __l, const valarray<size_t>& __s) : _M_index(new gslice::_Indexer(__o, __l, __s)) {} inline gslice::gslice(const gslice& __g) : _M_index(__g._M_index) { if (_M_index) _M_index->_M_increment_use(); } inline gslice::~gslice() { if (_M_index && _M_index->_M_decrement_use() == 0) delete _M_index; } inline gslice& gslice::operator=(const gslice& __g) { if (__g._M_index) __g._M_index->_M_increment_use(); if (_M_index && _M_index->_M_decrement_use() == 0) delete _M_index; _M_index = __g._M_index; return *this; } // @} group numeric_arrays _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _GSLICE_H */ ������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/hashtable.h��������������������������������������������������������������������������0000644�����������������00000172061�14763166030�0010647 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// hashtable.h header -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/hashtable.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{unordered_map, unordered_set} */ #ifndef _HASHTABLE_H #define _HASHTABLE_H 1 #pragma GCC system_header #include <bits/hashtable_policy.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Tp, typename _Hash> using __cache_default = __not_<__and_<// Do not cache for fast hasher. __is_fast_hash<_Hash>, // Mandatory to make local_iterator default // constructible and assignable. is_default_constructible<_Hash>, is_copy_assignable<_Hash>, // Mandatory to have erase not throwing. __detail::__is_noexcept_hash<_Tp, _Hash>>>; /** * Primary class template _Hashtable. * * @ingroup hashtable-detail * * @tparam _Value CopyConstructible type. * * @tparam _Key CopyConstructible type. * * @tparam _Alloc An allocator type * ([lib.allocator.requirements]) whose _Alloc::value_type is * _Value. As a conforming extension, we allow for * _Alloc::value_type != _Value. * * @tparam _ExtractKey Function object that takes an object of type * _Value and returns a value of type _Key. * * @tparam _Equal Function object that takes two objects of type k * and returns a bool-like value that is true if the two objects * are considered equal. * * @tparam _H1 The hash function. A unary function object with * argument type _Key and result type size_t. Return values should * be distributed over the entire range [0, numeric_limits<size_t>:::max()]. * * @tparam _H2 The range-hashing function (in the terminology of * Tavori and Dreizin). A binary function object whose argument * types and result type are all size_t. Given arguments r and N, * the return value is in the range [0, N). * * @tparam _Hash The ranged hash function (Tavori and Dreizin). A * binary function whose argument types are _Key and size_t and * whose result type is size_t. Given arguments k and N, the * return value is in the range [0, N). Default: hash(k, N) = * h2(h1(k), N). If _Hash is anything other than the default, _H1 * and _H2 are ignored. * * @tparam _RehashPolicy Policy class with three members, all of * which govern the bucket count. _M_next_bkt(n) returns a bucket * count no smaller than n. _M_bkt_for_elements(n) returns a * bucket count appropriate for an element count of n. * _M_need_rehash(n_bkt, n_elt, n_ins) determines whether, if the * current bucket count is n_bkt and the current element count is * n_elt, we need to increase the bucket count. If so, returns * make_pair(true, n), where n is the new bucket count. If not, * returns make_pair(false, <anything>) * * @tparam _Traits Compile-time class with three boolean * std::integral_constant members: __cache_hash_code, __constant_iterators, * __unique_keys. * * Each _Hashtable data structure has: * * - _Bucket[] _M_buckets * - _Hash_node_base _M_bbegin * - size_type _M_bucket_count * - size_type _M_element_count * * with _Bucket being _Hash_node* and _Hash_node containing: * * - _Hash_node* _M_next * - Tp _M_value * - size_t _M_hash_code if cache_hash_code is true * * In terms of Standard containers the hashtable is like the aggregation of: * * - std::forward_list<_Node> containing the elements * - std::vector<std::forward_list<_Node>::iterator> representing the buckets * * The non-empty buckets contain the node before the first node in the * bucket. This design makes it possible to implement something like a * std::forward_list::insert_after on container insertion and * std::forward_list::erase_after on container erase * calls. _M_before_begin is equivalent to * std::forward_list::before_begin. Empty buckets contain * nullptr. Note that one of the non-empty buckets contains * &_M_before_begin which is not a dereferenceable node so the * node pointer in a bucket shall never be dereferenced, only its * next node can be. * * Walking through a bucket's nodes requires a check on the hash code to * see if each node is still in the bucket. Such a design assumes a * quite efficient hash functor and is one of the reasons it is * highly advisable to set __cache_hash_code to true. * * The container iterators are simply built from nodes. This way * incrementing the iterator is perfectly efficient independent of * how many empty buckets there are in the container. * * On insert we compute the element's hash code and use it to find the * bucket index. If the element must be inserted in an empty bucket * we add it at the beginning of the singly linked list and make the * bucket point to _M_before_begin. The bucket that used to point to * _M_before_begin, if any, is updated to point to its new before * begin node. * * On erase, the simple iterator design requires using the hash * functor to get the index of the bucket to update. For this * reason, when __cache_hash_code is set to false the hash functor must * not throw and this is enforced by a static assertion. * * Functionality is implemented by decomposition into base classes, * where the derived _Hashtable class is used in _Map_base, * _Insert, _Rehash_base, and _Equality base classes to access the * "this" pointer. _Hashtable_base is used in the base classes as a * non-recursive, fully-completed-type so that detailed nested type * information, such as iterator type and node type, can be * used. This is similar to the "Curiously Recurring Template * Pattern" (CRTP) technique, but uses a reconstructed, not * explicitly passed, template pattern. * * Base class templates are: * - __detail::_Hashtable_base * - __detail::_Map_base * - __detail::_Insert * - __detail::_Rehash_base * - __detail::_Equality */ template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> class _Hashtable : public __detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, _Traits>, public __detail::_Map_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>, public __detail::_Insert<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>, public __detail::_Rehash_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>, public __detail::_Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits> { public: typedef _Key key_type; typedef _Value value_type; typedef _Alloc allocator_type; typedef _Equal key_equal; // mapped_type, if present, comes from _Map_base. // hasher, if present, comes from _Hash_code_base/_Hashtable_base. typedef typename _Alloc::pointer pointer; typedef typename _Alloc::const_pointer const_pointer; typedef typename _Alloc::reference reference; typedef typename _Alloc::const_reference const_reference; private: using __rehash_type = _RehashPolicy; using __rehash_state = typename __rehash_type::_State; using __traits_type = _Traits; using __hash_cached = typename __traits_type::__hash_cached; using __constant_iterators = typename __traits_type::__constant_iterators; using __unique_keys = typename __traits_type::__unique_keys; using __key_extract = typename std::conditional< __constant_iterators::value, __detail::_Identity, __detail::_Select1st>::type; using __hashtable_base = __detail:: _Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, _Traits>; using __hash_code_base = typename __hashtable_base::__hash_code_base; using __hash_code = typename __hashtable_base::__hash_code; using __node_type = typename __hashtable_base::__node_type; using __node_base = typename __hashtable_base::__node_base; using __bucket_type = typename __hashtable_base::__bucket_type; using __ireturn_type = typename __hashtable_base::__ireturn_type; using __iconv_type = typename __hashtable_base::__iconv_type; using __map_base = __detail::_Map_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>; using __rehash_base = __detail::_Rehash_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>; using __eq_base = __detail::_Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>; // Metaprogramming for picking apart hash caching. using __hash_noexcept = __detail::__is_noexcept_hash<_Key, _H1>; template<typename _Cond> using __if_hash_cached = __or_<__not_<__hash_cached>, _Cond>; template<typename _Cond> using __if_hash_not_cached = __or_<__hash_cached, _Cond>; // Compile-time diagnostics. // When hash codes are not cached the hash functor shall not // throw because it is used in methods (erase, swap...) that // shall not throw. static_assert(__if_hash_not_cached<__hash_noexcept>::value, "Cache the hash code" " or qualify your hash functor with noexcept"); // Following two static assertions are necessary to guarantee // that local_iterator will be default constructible. // When hash codes are cached local iterator inherits from H2 functor // which must then be default constructible. static_assert(__if_hash_cached<is_default_constructible<_H2>>::value, "Functor used to map hash code to bucket index" " must be default constructible"); // When hash codes are not cached local iterator inherits from // __hash_code_base above to compute node bucket index so it has to be // default constructible. static_assert(__if_hash_not_cached< is_default_constructible< // We use _Hashtable_ebo_helper to access the protected // default constructor. __detail::_Hashtable_ebo_helper<0, __hash_code_base>>>::value, "Cache the hash code or make functors involved in hash code" " and bucket index computation default constructible"); // When hash codes are not cached local iterator inherits from // __hash_code_base above to compute node bucket index so it has to be // assignable. static_assert(__if_hash_not_cached< is_copy_assignable<__hash_code_base>>::value, "Cache the hash code or make functors involved in hash code" " and bucket index computation copy assignable"); public: template<typename _Keya, typename _Valuea, typename _Alloca, typename _ExtractKeya, typename _Equala, typename _H1a, typename _H2a, typename _Hasha, typename _RehashPolicya, typename _Traitsa, bool _Unique_keysa> friend struct __detail::_Map_base; template<typename _Keya, typename _Valuea, typename _Alloca, typename _ExtractKeya, typename _Equala, typename _H1a, typename _H2a, typename _Hasha, typename _RehashPolicya, typename _Traitsa> friend struct __detail::_Insert_base; template<typename _Keya, typename _Valuea, typename _Alloca, typename _ExtractKeya, typename _Equala, typename _H1a, typename _H2a, typename _Hasha, typename _RehashPolicya, typename _Traitsa, bool _Constant_iteratorsa, bool _Unique_keysa> friend struct __detail::_Insert; using size_type = typename __hashtable_base::size_type; using difference_type = typename __hashtable_base::difference_type; using iterator = typename __hashtable_base::iterator; using const_iterator = typename __hashtable_base::const_iterator; using local_iterator = typename __hashtable_base::local_iterator; using const_local_iterator = typename __hashtable_base:: const_local_iterator; private: typedef typename _Alloc::template rebind<__node_type>::other _Node_allocator_type; typedef typename _Alloc::template rebind<__bucket_type>::other _Bucket_allocator_type; using __before_begin = __detail::_Before_begin<_Node_allocator_type>; __bucket_type* _M_buckets; size_type _M_bucket_count; __before_begin _M_bbegin; size_type _M_element_count; _RehashPolicy _M_rehash_policy; _Node_allocator_type& _M_node_allocator() { return _M_bbegin; } const _Node_allocator_type& _M_node_allocator() const { return _M_bbegin; } __node_base& _M_before_begin() { return _M_bbegin._M_node; } const __node_base& _M_before_begin() const { return _M_bbegin._M_node; } template<typename... _Args> __node_type* _M_allocate_node(_Args&&... __args); void _M_deallocate_node(__node_type* __n); // Deallocate the linked list of nodes pointed to by __n void _M_deallocate_nodes(__node_type* __n); __bucket_type* _M_allocate_buckets(size_type __n); void _M_deallocate_buckets(__bucket_type*, size_type __n); // Gets bucket begin, deals with the fact that non-empty buckets contain // their before begin node. __node_type* _M_bucket_begin(size_type __bkt) const; __node_type* _M_begin() const { return static_cast<__node_type*>(_M_before_begin()._M_nxt); } public: // Constructor, destructor, assignment, swap _Hashtable(size_type __bucket_hint, const _H1&, const _H2&, const _Hash&, const _Equal&, const _ExtractKey&, const allocator_type&); template<typename _InputIterator> _Hashtable(_InputIterator __first, _InputIterator __last, size_type __bucket_hint, const _H1&, const _H2&, const _Hash&, const _Equal&, const _ExtractKey&, const allocator_type&); _Hashtable(const _Hashtable&); _Hashtable(_Hashtable&&); // Use delegating constructors. explicit _Hashtable(size_type __n = 10, const _H1& __hf = _H1(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Hashtable(__n, __hf, __detail::_Mod_range_hashing(), __detail::_Default_ranged_hash(), __eql, __key_extract(), __a) { } template<typename _InputIterator> _Hashtable(_InputIterator __f, _InputIterator __l, size_type __n = 0, const _H1& __hf = _H1(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Hashtable(__f, __l, __n, __hf, __detail::_Mod_range_hashing(), __detail::_Default_ranged_hash(), __eql, __key_extract(), __a) { } _Hashtable(initializer_list<value_type> __l, size_type __n = 0, const _H1& __hf = _H1(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Hashtable(__l.begin(), __l.end(), __n, __hf, __detail::_Mod_range_hashing(), __detail::_Default_ranged_hash(), __eql, __key_extract(), __a) { } _Hashtable& operator=(const _Hashtable& __ht) { _Hashtable __tmp(__ht); this->swap(__tmp); return *this; } _Hashtable& operator=(_Hashtable&& __ht) { // NB: DR 1204. // NB: DR 675. this->clear(); this->swap(__ht); return *this; } _Hashtable& operator=(initializer_list<value_type> __l) { this->clear(); this->insert(__l.begin(), __l.end()); return *this; } ~_Hashtable() noexcept; void swap(_Hashtable&); // Basic container operations iterator begin() noexcept { return iterator(_M_begin()); } const_iterator begin() const noexcept { return const_iterator(_M_begin()); } iterator end() noexcept { return iterator(nullptr); } const_iterator end() const noexcept { return const_iterator(nullptr); } const_iterator cbegin() const noexcept { return const_iterator(_M_begin()); } const_iterator cend() const noexcept { return const_iterator(nullptr); } size_type size() const noexcept { return _M_element_count; } bool empty() const noexcept { return size() == 0; } allocator_type get_allocator() const noexcept { return allocator_type(_M_node_allocator()); } size_type max_size() const noexcept { return _M_node_allocator().max_size(); } // Observers key_equal key_eq() const { return this->_M_eq(); } // hash_function, if present, comes from _Hash_code_base. // Bucket operations size_type bucket_count() const noexcept { return _M_bucket_count; } size_type max_bucket_count() const noexcept { return max_size(); } size_type bucket_size(size_type __n) const { return std::distance(begin(__n), end(__n)); } size_type bucket(const key_type& __k) const { return _M_bucket_index(__k, this->_M_hash_code(__k)); } local_iterator begin(size_type __n) { return local_iterator(*this, _M_bucket_begin(__n), __n, _M_bucket_count); } local_iterator end(size_type __n) { return local_iterator(*this, nullptr, __n, _M_bucket_count); } const_local_iterator begin(size_type __n) const { return const_local_iterator(*this, _M_bucket_begin(__n), __n, _M_bucket_count); } const_local_iterator end(size_type __n) const { return const_local_iterator(*this, nullptr, __n, _M_bucket_count); } // DR 691. const_local_iterator cbegin(size_type __n) const { return const_local_iterator(*this, _M_bucket_begin(__n), __n, _M_bucket_count); } const_local_iterator cend(size_type __n) const { return const_local_iterator(*this, nullptr, __n, _M_bucket_count); } float load_factor() const noexcept { return static_cast<float>(size()) / static_cast<float>(bucket_count()); } // max_load_factor, if present, comes from _Rehash_base. // Generalization of max_load_factor. Extension, not found in // TR1. Only useful if _RehashPolicy is something other than // the default. const _RehashPolicy& __rehash_policy() const { return _M_rehash_policy; } void __rehash_policy(const _RehashPolicy&); // Lookup. iterator find(const key_type& __k); const_iterator find(const key_type& __k) const; size_type count(const key_type& __k) const; std::pair<iterator, iterator> equal_range(const key_type& __k); std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const; protected: // Bucket index computation helpers. size_type _M_bucket_index(__node_type* __n) const { return __hash_code_base::_M_bucket_index(__n, _M_bucket_count); } size_type _M_bucket_index(const key_type& __k, __hash_code __c) const { return __hash_code_base::_M_bucket_index(__k, __c, _M_bucket_count); } // Find and insert helper functions and types // Find the node before the one matching the criteria. __node_base* _M_find_before_node(size_type, const key_type&, __hash_code) const; __node_type* _M_find_node(size_type __bkt, const key_type& __key, __hash_code __c) const { __node_base* __before_n = _M_find_before_node(__bkt, __key, __c); if (__before_n) return static_cast<__node_type*>(__before_n->_M_nxt); return nullptr; } // Insert a node at the beginning of a bucket. void _M_insert_bucket_begin(size_type, __node_type*); // Remove the bucket first node void _M_remove_bucket_begin(size_type __bkt, __node_type* __next_n, size_type __next_bkt); // Get the node before __n in the bucket __bkt __node_base* _M_get_previous_node(size_type __bkt, __node_base* __n); // Insert node with hash code __code, in bucket bkt if no rehash (assumes // no element with its key already present). Take ownership of the node, // deallocate it on exception. iterator _M_insert_unique_node(size_type __bkt, __hash_code __code, __node_type* __n); // Insert node with hash code __code. Take ownership of the node, // deallocate it on exception. iterator _M_insert_multi_node(__hash_code __code, __node_type* __n); template<typename... _Args> std::pair<iterator, bool> _M_emplace(std::true_type, _Args&&... __args); template<typename... _Args> iterator _M_emplace(std::false_type, _Args&&... __args); template<typename _Arg> std::pair<iterator, bool> _M_insert(_Arg&&, std::true_type); template<typename _Arg> iterator _M_insert(_Arg&&, std::false_type); size_type _M_erase(std::true_type, const key_type&); size_type _M_erase(std::false_type, const key_type&); iterator _M_erase(size_type __bkt, __node_base* __prev_n, __node_type* __n); public: // Emplace template<typename... _Args> __ireturn_type emplace(_Args&&... __args) { return _M_emplace(__unique_keys(), std::forward<_Args>(__args)...); } template<typename... _Args> iterator emplace_hint(const_iterator, _Args&&... __args) { return __iconv_type()(emplace(std::forward<_Args>(__args)...)); } // Insert member functions via inheritance. // Erase iterator erase(const_iterator); // LWG 2059. iterator erase(iterator __it) { return erase(const_iterator(__it)); } size_type erase(const key_type& __k) { return _M_erase(__unique_keys(), __k); } iterator erase(const_iterator, const_iterator); void clear() noexcept; // Set number of buckets to be appropriate for container of n element. void rehash(size_type __n); // DR 1189. // reserve, if present, comes from _Rehash_base. private: // Helper rehash method used when keys are unique. void _M_rehash_aux(size_type __n, std::true_type); // Helper rehash method used when keys can be non-unique. void _M_rehash_aux(size_type __n, std::false_type); // Unconditionally change size of bucket array to n, restore // hash policy state to __state on exception. void _M_rehash(size_type __n, const __rehash_state& __state); }; // Definitions of class template _Hashtable's out-of-line member functions. template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> template<typename... _Args> typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::__node_type* _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_allocate_node(_Args&&... __args) { __node_type* __n = _M_node_allocator().allocate(1); __try { _M_node_allocator().construct(__n, std::forward<_Args>(__args)...); return __n; } __catch(...) { _M_node_allocator().deallocate(__n, 1); __throw_exception_again; } } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> void _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_deallocate_node(__node_type* __n) { _M_node_allocator().destroy(__n); _M_node_allocator().deallocate(__n, 1); } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> void _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_deallocate_nodes(__node_type* __n) { while (__n) { __node_type* __tmp = __n; __n = __n->_M_next(); _M_deallocate_node(__tmp); } } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::__bucket_type* _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_allocate_buckets(size_type __n) { _Bucket_allocator_type __alloc(_M_node_allocator()); __bucket_type* __p = __alloc.allocate(__n); __builtin_memset(__p, 0, __n * sizeof(__bucket_type)); return __p; } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> void _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_deallocate_buckets(__bucket_type* __p, size_type __n) { _Bucket_allocator_type __alloc(_M_node_allocator()); __alloc.deallocate(__p, __n); } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::__node_type* _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_bucket_begin(size_type __bkt) const { __node_base* __n = _M_buckets[__bkt]; return __n ? static_cast<__node_type*>(__n->_M_nxt) : nullptr; } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _Hashtable(size_type __bucket_hint, const _H1& __h1, const _H2& __h2, const _Hash& __h, const _Equal& __eq, const _ExtractKey& __exk, const allocator_type& __a) : __hashtable_base(__exk, __h1, __h2, __h, __eq), __map_base(), __rehash_base(), _M_bucket_count(0), _M_bbegin(__a), _M_element_count(0), _M_rehash_policy() { _M_bucket_count = _M_rehash_policy._M_next_bkt(__bucket_hint); _M_buckets = _M_allocate_buckets(_M_bucket_count); } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> template<typename _InputIterator> _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _Hashtable(_InputIterator __f, _InputIterator __l, size_type __bucket_hint, const _H1& __h1, const _H2& __h2, const _Hash& __h, const _Equal& __eq, const _ExtractKey& __exk, const allocator_type& __a) : __hashtable_base(__exk, __h1, __h2, __h, __eq), __map_base(), __rehash_base(), _M_bucket_count(0), _M_bbegin(__a), _M_element_count(0), _M_rehash_policy() { auto __nb_elems = __detail::__distance_fw(__f, __l); _M_bucket_count = _M_rehash_policy._M_next_bkt( std::max(_M_rehash_policy._M_bkt_for_elements(__nb_elems), __bucket_hint)); _M_buckets = _M_allocate_buckets(_M_bucket_count); __try { for (; __f != __l; ++__f) this->insert(*__f); } __catch(...) { clear(); _M_deallocate_buckets(_M_buckets, _M_bucket_count); __throw_exception_again; } } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _Hashtable(const _Hashtable& __ht) : __hashtable_base(__ht), __map_base(__ht), __rehash_base(__ht), _M_bucket_count(__ht._M_bucket_count), _M_bbegin(__ht._M_bbegin), _M_element_count(__ht._M_element_count), _M_rehash_policy(__ht._M_rehash_policy) { _M_buckets = _M_allocate_buckets(_M_bucket_count); __try { if (!__ht._M_before_begin()._M_nxt) return; // First deal with the special first node pointed to by // _M_before_begin. const __node_type* __ht_n = __ht._M_begin(); __node_type* __this_n = _M_allocate_node(__ht_n->_M_v); this->_M_copy_code(__this_n, __ht_n); _M_before_begin()._M_nxt = __this_n; _M_buckets[_M_bucket_index(__this_n)] = &_M_before_begin(); // Then deal with other nodes. __node_base* __prev_n = __this_n; for (__ht_n = __ht_n->_M_next(); __ht_n; __ht_n = __ht_n->_M_next()) { __this_n = _M_allocate_node(__ht_n->_M_v); __prev_n->_M_nxt = __this_n; this->_M_copy_code(__this_n, __ht_n); size_type __bkt = _M_bucket_index(__this_n); if (!_M_buckets[__bkt]) _M_buckets[__bkt] = __prev_n; __prev_n = __this_n; } } __catch(...) { clear(); _M_deallocate_buckets(_M_buckets, _M_bucket_count); __throw_exception_again; } } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _Hashtable(_Hashtable&& __ht) : __hashtable_base(__ht), __map_base(__ht), __rehash_base(__ht), _M_buckets(__ht._M_buckets), _M_bucket_count(__ht._M_bucket_count), _M_bbegin(std::move(__ht._M_bbegin)), _M_element_count(__ht._M_element_count), _M_rehash_policy(__ht._M_rehash_policy) { // Update, if necessary, bucket pointing to before begin that hasn't moved. if (_M_begin()) _M_buckets[_M_bucket_index(_M_begin())] = &_M_before_begin(); __ht._M_rehash_policy = _RehashPolicy(); __ht._M_bucket_count = __ht._M_rehash_policy._M_next_bkt(0); __ht._M_buckets = __ht._M_allocate_buckets(__ht._M_bucket_count); __ht._M_before_begin()._M_nxt = nullptr; __ht._M_element_count = 0; } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: ~_Hashtable() noexcept { clear(); _M_deallocate_buckets(_M_buckets, _M_bucket_count); } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> void _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: swap(_Hashtable& __x) { // The only base class with member variables is hash_code_base. // We define _Hash_code_base::_M_swap because different // specializations have different members. this->_M_swap(__x); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 431. Swapping containers with unequal allocators. std::__alloc_swap<_Node_allocator_type>::_S_do_it(_M_node_allocator(), __x._M_node_allocator()); std::swap(_M_rehash_policy, __x._M_rehash_policy); std::swap(_M_buckets, __x._M_buckets); std::swap(_M_bucket_count, __x._M_bucket_count); std::swap(_M_before_begin()._M_nxt, __x._M_before_begin()._M_nxt); std::swap(_M_element_count, __x._M_element_count); // Fix buckets containing the _M_before_begin pointers that // can't be swapped. if (_M_begin()) _M_buckets[_M_bucket_index(_M_begin())] = &_M_before_begin(); if (__x._M_begin()) __x._M_buckets[__x._M_bucket_index(__x._M_begin())] = &(__x._M_before_begin()); } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> void _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: __rehash_policy(const _RehashPolicy& __pol) { size_type __n_bkt = __pol._M_bkt_for_elements(_M_element_count); __n_bkt = __pol._M_next_bkt(__n_bkt); if (__n_bkt != _M_bucket_count) _M_rehash(__n_bkt, _M_rehash_policy._M_state()); _M_rehash_policy = __pol; } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::iterator _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: find(const key_type& __k) { __hash_code __code = this->_M_hash_code(__k); std::size_t __n = _M_bucket_index(__k, __code); __node_type* __p = _M_find_node(__n, __k, __code); return __p ? iterator(__p) : this->end(); } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::const_iterator _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: find(const key_type& __k) const { __hash_code __code = this->_M_hash_code(__k); std::size_t __n = _M_bucket_index(__k, __code); __node_type* __p = _M_find_node(__n, __k, __code); return __p ? const_iterator(__p) : this->end(); } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::size_type _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: count(const key_type& __k) const { __hash_code __code = this->_M_hash_code(__k); std::size_t __n = _M_bucket_index(__k, __code); __node_type* __p = _M_bucket_begin(__n); if (!__p) return 0; std::size_t __result = 0; for (;; __p = __p->_M_next()) { if (this->_M_equals(__k, __code, __p)) ++__result; else if (__result) // All equivalent values are next to each other, if we // found a non-equivalent value after an equivalent one it // means that we won't find any more equivalent values. break; if (!__p->_M_nxt || _M_bucket_index(__p->_M_next()) != __n) break; } return __result; } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> std::pair<typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::iterator, typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::iterator> _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: equal_range(const key_type& __k) { __hash_code __code = this->_M_hash_code(__k); std::size_t __n = _M_bucket_index(__k, __code); __node_type* __p = _M_find_node(__n, __k, __code); if (__p) { __node_type* __p1 = __p->_M_next(); while (__p1 && _M_bucket_index(__p1) == __n && this->_M_equals(__k, __code, __p1)) __p1 = __p1->_M_next(); return std::make_pair(iterator(__p), iterator(__p1)); } else return std::make_pair(this->end(), this->end()); } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> std::pair<typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::const_iterator, typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::const_iterator> _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: equal_range(const key_type& __k) const { __hash_code __code = this->_M_hash_code(__k); std::size_t __n = _M_bucket_index(__k, __code); __node_type* __p = _M_find_node(__n, __k, __code); if (__p) { __node_type* __p1 = __p->_M_next(); while (__p1 && _M_bucket_index(__p1) == __n && this->_M_equals(__k, __code, __p1)) __p1 = __p1->_M_next(); return std::make_pair(const_iterator(__p), const_iterator(__p1)); } else return std::make_pair(this->end(), this->end()); } // Find the node whose key compares equal to k in the bucket n. // Return nullptr if no node is found. template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::__node_base* _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_find_before_node(size_type __n, const key_type& __k, __hash_code __code) const { __node_base* __prev_p = _M_buckets[__n]; if (!__prev_p) return nullptr; __node_type* __p = static_cast<__node_type*>(__prev_p->_M_nxt); for (;; __p = __p->_M_next()) { if (this->_M_equals(__k, __code, __p)) return __prev_p; if (!__p->_M_nxt || _M_bucket_index(__p->_M_next()) != __n) break; __prev_p = __p; } return nullptr; } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> void _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_insert_bucket_begin(size_type __bkt, __node_type* __node) { if (_M_buckets[__bkt]) { // Bucket is not empty, we just need to insert the new node // after the bucket before begin. __node->_M_nxt = _M_buckets[__bkt]->_M_nxt; _M_buckets[__bkt]->_M_nxt = __node; } else { // The bucket is empty, the new node is inserted at the // beginning of the singly-linked list and the bucket will // contain _M_before_begin pointer. __node->_M_nxt = _M_before_begin()._M_nxt; _M_before_begin()._M_nxt = __node; if (__node->_M_nxt) // We must update former begin bucket that is pointing to // _M_before_begin. _M_buckets[_M_bucket_index(__node->_M_next())] = __node; _M_buckets[__bkt] = &_M_before_begin(); } } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> void _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_remove_bucket_begin(size_type __bkt, __node_type* __next, size_type __next_bkt) { if (!__next || __next_bkt != __bkt) { // Bucket is now empty // First update next bucket if any if (__next) _M_buckets[__next_bkt] = _M_buckets[__bkt]; // Second update before begin node if necessary if (&_M_before_begin() == _M_buckets[__bkt]) _M_before_begin()._M_nxt = __next; _M_buckets[__bkt] = nullptr; } } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::__node_base* _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_get_previous_node(size_type __bkt, __node_base* __n) { __node_base* __prev_n = _M_buckets[__bkt]; while (__prev_n->_M_nxt != __n) __prev_n = __prev_n->_M_nxt; return __prev_n; } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> template<typename... _Args> std::pair<typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::iterator, bool> _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_emplace(std::true_type, _Args&&... __args) { // First build the node to get access to the hash code __node_type* __node = _M_allocate_node(std::forward<_Args>(__args)...); const key_type& __k = this->_M_extract()(__node->_M_v); __hash_code __code; __try { __code = this->_M_hash_code(__k); } __catch(...) { _M_deallocate_node(__node); __throw_exception_again; } size_type __bkt = _M_bucket_index(__k, __code); if (__node_type* __p = _M_find_node(__bkt, __k, __code)) { // There is already an equivalent node, no insertion _M_deallocate_node(__node); return std::make_pair(iterator(__p), false); } // Insert the node return std::make_pair(_M_insert_unique_node(__bkt, __code, __node), true); } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> template<typename... _Args> typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::iterator _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_emplace(std::false_type, _Args&&... __args) { // First build the node to get its hash code. __node_type* __node = _M_allocate_node(std::forward<_Args>(__args)...); __hash_code __code; __try { __code = this->_M_hash_code(this->_M_extract()(__node->_M_v)); } __catch(...) { _M_deallocate_node(__node); __throw_exception_again; } return _M_insert_multi_node(__code, __node); } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::iterator _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_insert_unique_node(size_type __bkt, __hash_code __code, __node_type* __node) { const __rehash_state& __saved_state = _M_rehash_policy._M_state(); std::pair<bool, std::size_t> __do_rehash = _M_rehash_policy._M_need_rehash(_M_bucket_count, _M_element_count, 1); __try { if (__do_rehash.first) { _M_rehash(__do_rehash.second, __saved_state); __bkt = _M_bucket_index(this->_M_extract()(__node->_M_v), __code); } this->_M_store_code(__node, __code); // Always insert at the begining of the bucket. _M_insert_bucket_begin(__bkt, __node); ++_M_element_count; return iterator(__node); } __catch(...) { _M_deallocate_node(__node); __throw_exception_again; } } // Insert node, in bucket bkt if no rehash (assumes no element with its key // already present). Take ownership of the node, deallocate it on exception. template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::iterator _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_insert_multi_node(__hash_code __code, __node_type* __node) { const __rehash_state& __saved_state = _M_rehash_policy._M_state(); std::pair<bool, std::size_t> __do_rehash = _M_rehash_policy._M_need_rehash(_M_bucket_count, _M_element_count, 1); __try { if (__do_rehash.first) _M_rehash(__do_rehash.second, __saved_state); this->_M_store_code(__node, __code); const key_type& __k = this->_M_extract()(__node->_M_v); size_type __bkt = _M_bucket_index(__k, __code); // Find the node before an equivalent one. __node_base* __prev = _M_find_before_node(__bkt, __k, __code); if (__prev) { // Insert after the node before the equivalent one. __node->_M_nxt = __prev->_M_nxt; __prev->_M_nxt = __node; } else // The inserted node has no equivalent in the // hashtable. We must insert the new node at the // beginning of the bucket to preserve equivalent // elements' relative positions. _M_insert_bucket_begin(__bkt, __node); ++_M_element_count; return iterator(__node); } __catch(...) { _M_deallocate_node(__node); __throw_exception_again; } } // Insert v if no element with its key is already present. template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> template<typename _Arg> std::pair<typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::iterator, bool> _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_insert(_Arg&& __v, std::true_type) { const key_type& __k = this->_M_extract()(__v); __hash_code __code = this->_M_hash_code(__k); size_type __bkt = _M_bucket_index(__k, __code); __node_type* __n = _M_find_node(__bkt, __k, __code); if (__n) return std::make_pair(iterator(__n), false); __n = _M_allocate_node(std::forward<_Arg>(__v)); return std::make_pair(_M_insert_unique_node(__bkt, __code, __n), true); } // Insert v unconditionally. template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> template<typename _Arg> typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::iterator _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_insert(_Arg&& __v, std::false_type) { // First compute the hash code so that we don't do anything if it // throws. __hash_code __code = this->_M_hash_code(this->_M_extract()(__v)); // Second allocate new node so that we don't rehash if it throws. __node_type* __node = _M_allocate_node(std::forward<_Arg>(__v)); return _M_insert_multi_node(__code, __node); } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::iterator _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: erase(const_iterator __it) { __node_type* __n = __it._M_cur; std::size_t __bkt = _M_bucket_index(__n); // Look for previous node to unlink it from the erased one, this // is why we need buckets to contain the before begin to make // this search fast. __node_base* __prev_n = _M_get_previous_node(__bkt, __n); return _M_erase(__bkt, __prev_n, __n); } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::iterator _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_erase(size_type __bkt, __node_base* __prev_n, __node_type* __n) { if (__prev_n == _M_buckets[__bkt]) _M_remove_bucket_begin(__bkt, __n->_M_next(), __n->_M_nxt ? _M_bucket_index(__n->_M_next()) : 0); else if (__n->_M_nxt) { size_type __next_bkt = _M_bucket_index(__n->_M_next()); if (__next_bkt != __bkt) _M_buckets[__next_bkt] = __prev_n; } __prev_n->_M_nxt = __n->_M_nxt; iterator __result(__n->_M_next()); _M_deallocate_node(__n); --_M_element_count; return __result; } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::size_type _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_erase(std::true_type, const key_type& __k) { __hash_code __code = this->_M_hash_code(__k); std::size_t __bkt = _M_bucket_index(__k, __code); // Look for the node before the first matching node. __node_base* __prev_n = _M_find_before_node(__bkt, __k, __code); if (!__prev_n) return 0; // We found a matching node, erase it. __node_type* __n = static_cast<__node_type*>(__prev_n->_M_nxt); _M_erase(__bkt, __prev_n, __n); return 1; } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::size_type _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_erase(std::false_type, const key_type& __k) { __hash_code __code = this->_M_hash_code(__k); std::size_t __bkt = _M_bucket_index(__k, __code); // Look for the node before the first matching node. __node_base* __prev_n = _M_find_before_node(__bkt, __k, __code); if (!__prev_n) return 0; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 526. Is it undefined if a function in the standard changes // in parameters? // We use one loop to find all matching nodes and another to deallocate // them so that the key stays valid during the first loop. It might be // invalidated indirectly when destroying nodes. __node_type* __n = static_cast<__node_type*>(__prev_n->_M_nxt); __node_type* __n_last = __n; std::size_t __n_last_bkt = __bkt; do { __n_last = __n_last->_M_next(); if (!__n_last) break; __n_last_bkt = _M_bucket_index(__n_last); } while (__n_last_bkt == __bkt && this->_M_equals(__k, __code, __n_last)); // Deallocate nodes. size_type __result = 0; do { __node_type* __p = __n->_M_next(); _M_deallocate_node(__n); __n = __p; ++__result; --_M_element_count; } while (__n != __n_last); if (__prev_n == _M_buckets[__bkt]) _M_remove_bucket_begin(__bkt, __n_last, __n_last_bkt); else if (__n_last && __n_last_bkt != __bkt) _M_buckets[__n_last_bkt] = __prev_n; __prev_n->_M_nxt = __n_last; return __result; } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> typename _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::iterator _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: erase(const_iterator __first, const_iterator __last) { __node_type* __n = __first._M_cur; __node_type* __last_n = __last._M_cur; if (__n == __last_n) return iterator(__n); std::size_t __bkt = _M_bucket_index(__n); __node_base* __prev_n = _M_get_previous_node(__bkt, __n); bool __is_bucket_begin = __n == _M_bucket_begin(__bkt); std::size_t __n_bkt = __bkt; for (;;) { do { __node_type* __tmp = __n; __n = __n->_M_next(); _M_deallocate_node(__tmp); --_M_element_count; if (!__n) break; __n_bkt = _M_bucket_index(__n); } while (__n != __last_n && __n_bkt == __bkt); if (__is_bucket_begin) _M_remove_bucket_begin(__bkt, __n, __n_bkt); if (__n == __last_n) break; __is_bucket_begin = true; __bkt = __n_bkt; } if (__n && (__n_bkt != __bkt || __is_bucket_begin)) _M_buckets[__n_bkt] = __prev_n; __prev_n->_M_nxt = __n; return iterator(__n); } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> void _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: clear() noexcept { _M_deallocate_nodes(_M_begin()); __builtin_memset(_M_buckets, 0, _M_bucket_count * sizeof(__bucket_type)); _M_element_count = 0; _M_before_begin()._M_nxt = nullptr; } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> void _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: rehash(size_type __n) { const __rehash_state& __saved_state = _M_rehash_policy._M_state(); std::size_t __buckets = std::max(_M_rehash_policy._M_bkt_for_elements(_M_element_count + 1), __n); __buckets = _M_rehash_policy._M_next_bkt(__buckets); if (__buckets != _M_bucket_count) _M_rehash(__buckets, __saved_state); else // No rehash, restore previous state to keep a consistent state. _M_rehash_policy._M_reset(__saved_state); } template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> void _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_rehash(size_type __n, const __rehash_state& __state) { __try { _M_rehash_aux(__n, __unique_keys()); } __catch(...) { // A failure here means that buckets allocation failed. We only // have to restore hash policy previous state. _M_rehash_policy._M_reset(__state); __throw_exception_again; } } // Rehash when there is no equivalent elements. template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> void _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_rehash_aux(size_type __n, std::true_type) { __bucket_type* __new_buckets = _M_allocate_buckets(__n); __node_type* __p = _M_begin(); _M_before_begin()._M_nxt = nullptr; std::size_t __bbegin_bkt = 0; while (__p) { __node_type* __next = __p->_M_next(); std::size_t __bkt = __hash_code_base::_M_bucket_index(__p, __n); if (!__new_buckets[__bkt]) { __p->_M_nxt = _M_before_begin()._M_nxt; _M_before_begin()._M_nxt = __p; __new_buckets[__bkt] = &_M_before_begin(); if (__p->_M_nxt) __new_buckets[__bbegin_bkt] = __p; __bbegin_bkt = __bkt; } else { __p->_M_nxt = __new_buckets[__bkt]->_M_nxt; __new_buckets[__bkt]->_M_nxt = __p; } __p = __next; } _M_deallocate_buckets(_M_buckets, _M_bucket_count); _M_bucket_count = __n; _M_buckets = __new_buckets; } // Rehash when there can be equivalent elements, preserve their relative // order. template<typename _Key, typename _Value, typename _Alloc, typename _ExtractKey, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> void _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_rehash_aux(size_type __n, std::false_type) { __bucket_type* __new_buckets = _M_allocate_buckets(__n); __node_type* __p = _M_begin(); _M_before_begin()._M_nxt = nullptr; std::size_t __bbegin_bkt = 0; std::size_t __prev_bkt = 0; __node_type* __prev_p = nullptr; bool __check_bucket = false; while (__p) { __node_type* __next = __p->_M_next(); std::size_t __bkt = __hash_code_base::_M_bucket_index(__p, __n); if (__prev_p && __prev_bkt == __bkt) { // Previous insert was already in this bucket, we insert after // the previously inserted one to preserve equivalent elements // relative order. __p->_M_nxt = __prev_p->_M_nxt; __prev_p->_M_nxt = __p; // Inserting after a node in a bucket require to check that we // haven't change the bucket last node, in this case next // bucket containing its before begin node must be updated. We // schedule a check as soon as we move out of the sequence of // equivalent nodes to limit the number of checks. __check_bucket = true; } else { if (__check_bucket) { // Check if we shall update the next bucket because of // insertions into __prev_bkt bucket. if (__prev_p->_M_nxt) { std::size_t __next_bkt = __hash_code_base::_M_bucket_index(__prev_p->_M_next(), __n); if (__next_bkt != __prev_bkt) __new_buckets[__next_bkt] = __prev_p; } __check_bucket = false; } if (!__new_buckets[__bkt]) { __p->_M_nxt = _M_before_begin()._M_nxt; _M_before_begin()._M_nxt = __p; __new_buckets[__bkt] = &_M_before_begin(); if (__p->_M_nxt) __new_buckets[__bbegin_bkt] = __p; __bbegin_bkt = __bkt; } else { __p->_M_nxt = __new_buckets[__bkt]->_M_nxt; __new_buckets[__bkt]->_M_nxt = __p; } } __prev_p = __p; __prev_bkt = __bkt; __p = __next; } if (__check_bucket && __prev_p->_M_nxt) { std::size_t __next_bkt = __hash_code_base::_M_bucket_index(__prev_p->_M_next(), __n); if (__next_bkt != __prev_bkt) __new_buckets[__next_bkt] = __prev_p; } _M_deallocate_buckets(_M_buckets, _M_bucket_count); _M_bucket_count = __n; _M_buckets = __new_buckets; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif // _HASHTABLE_H �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/istream.tcc��������������������������������������������������������������������������0000644�����������������00000074565�14763166030�0010714 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// istream classes -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/istream.tcc * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{istream} */ // // ISO C++ 14882: 27.6.1 Input streams // #ifndef _ISTREAM_TCC #define _ISTREAM_TCC 1 #pragma GCC system_header #include <bits/cxxabi_forced.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>::sentry:: sentry(basic_istream<_CharT, _Traits>& __in, bool __noskip) : _M_ok(false) { ios_base::iostate __err = ios_base::goodbit; if (__in.good()) __try { if (__in.tie()) __in.tie()->flush(); if (!__noskip && bool(__in.flags() & ios_base::skipws)) { const __int_type __eof = traits_type::eof(); __streambuf_type* __sb = __in.rdbuf(); __int_type __c = __sb->sgetc(); const __ctype_type& __ct = __check_facet(__in._M_ctype); while (!traits_type::eq_int_type(__c, __eof) && __ct.is(ctype_base::space, traits_type::to_char_type(__c))) __c = __sb->snextc(); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 195. Should basic_istream::sentry's constructor ever // set eofbit? if (traits_type::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; } } __catch(__cxxabiv1::__forced_unwind&) { __in._M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { __in._M_setstate(ios_base::badbit); } if (__in.good() && __err == ios_base::goodbit) _M_ok = true; else { __err |= ios_base::failbit; __in.setstate(__err); } } template<typename _CharT, typename _Traits> template<typename _ValueT> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: _M_extract(_ValueT& __v) { sentry __cerb(*this, false); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; __try { const __num_get_type& __ng = __check_facet(this->_M_num_get); __ng.get(*this, 0, *this, __err, __v); } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: operator>>(short& __n) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 118. basic_istream uses nonexistent num_get member functions. sentry __cerb(*this, false); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; __try { long __l; const __num_get_type& __ng = __check_facet(this->_M_num_get); __ng.get(*this, 0, *this, __err, __l); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 696. istream::operator>>(int&) broken. if (__l < __gnu_cxx::__numeric_traits<short>::__min) { __err |= ios_base::failbit; __n = __gnu_cxx::__numeric_traits<short>::__min; } else if (__l > __gnu_cxx::__numeric_traits<short>::__max) { __err |= ios_base::failbit; __n = __gnu_cxx::__numeric_traits<short>::__max; } else __n = short(__l); } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: operator>>(int& __n) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 118. basic_istream uses nonexistent num_get member functions. sentry __cerb(*this, false); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; __try { long __l; const __num_get_type& __ng = __check_facet(this->_M_num_get); __ng.get(*this, 0, *this, __err, __l); // _GLIBCXX_RESOLVE_LIB_DEFECTS // 696. istream::operator>>(int&) broken. if (__l < __gnu_cxx::__numeric_traits<int>::__min) { __err |= ios_base::failbit; __n = __gnu_cxx::__numeric_traits<int>::__min; } else if (__l > __gnu_cxx::__numeric_traits<int>::__max) { __err |= ios_base::failbit; __n = __gnu_cxx::__numeric_traits<int>::__max; } else __n = int(__l); } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: operator>>(__streambuf_type* __sbout) { ios_base::iostate __err = ios_base::goodbit; sentry __cerb(*this, false); if (__cerb && __sbout) { __try { bool __ineof; if (!__copy_streambufs_eof(this->rdbuf(), __sbout, __ineof)) __err |= ios_base::failbit; if (__ineof) __err |= ios_base::eofbit; } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::failbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::failbit); } } else if (!__sbout) __err |= ios_base::failbit; if (__err) this->setstate(__err); return *this; } template<typename _CharT, typename _Traits> typename basic_istream<_CharT, _Traits>::int_type basic_istream<_CharT, _Traits>:: get(void) { const int_type __eof = traits_type::eof(); int_type __c = __eof; _M_gcount = 0; ios_base::iostate __err = ios_base::goodbit; sentry __cerb(*this, true); if (__cerb) { __try { __c = this->rdbuf()->sbumpc(); // 27.6.1.1 paragraph 3 if (!traits_type::eq_int_type(__c, __eof)) _M_gcount = 1; else __err |= ios_base::eofbit; } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } } if (!_M_gcount) __err |= ios_base::failbit; if (__err) this->setstate(__err); return __c; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: get(char_type& __c) { _M_gcount = 0; ios_base::iostate __err = ios_base::goodbit; sentry __cerb(*this, true); if (__cerb) { __try { const int_type __cb = this->rdbuf()->sbumpc(); // 27.6.1.1 paragraph 3 if (!traits_type::eq_int_type(__cb, traits_type::eof())) { _M_gcount = 1; __c = traits_type::to_char_type(__cb); } else __err |= ios_base::eofbit; } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } } if (!_M_gcount) __err |= ios_base::failbit; if (__err) this->setstate(__err); return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: get(char_type* __s, streamsize __n, char_type __delim) { _M_gcount = 0; ios_base::iostate __err = ios_base::goodbit; sentry __cerb(*this, true); if (__cerb) { __try { const int_type __idelim = traits_type::to_int_type(__delim); const int_type __eof = traits_type::eof(); __streambuf_type* __sb = this->rdbuf(); int_type __c = __sb->sgetc(); while (_M_gcount + 1 < __n && !traits_type::eq_int_type(__c, __eof) && !traits_type::eq_int_type(__c, __idelim)) { *__s++ = traits_type::to_char_type(__c); ++_M_gcount; __c = __sb->snextc(); } if (traits_type::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 243. get and getline when sentry reports failure. if (__n > 0) *__s = char_type(); if (!_M_gcount) __err |= ios_base::failbit; if (__err) this->setstate(__err); return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: get(__streambuf_type& __sb, char_type __delim) { _M_gcount = 0; ios_base::iostate __err = ios_base::goodbit; sentry __cerb(*this, true); if (__cerb) { __try { const int_type __idelim = traits_type::to_int_type(__delim); const int_type __eof = traits_type::eof(); __streambuf_type* __this_sb = this->rdbuf(); int_type __c = __this_sb->sgetc(); char_type __c2 = traits_type::to_char_type(__c); while (!traits_type::eq_int_type(__c, __eof) && !traits_type::eq_int_type(__c, __idelim) && !traits_type::eq_int_type(__sb.sputc(__c2), __eof)) { ++_M_gcount; __c = __this_sb->snextc(); __c2 = traits_type::to_char_type(__c); } if (traits_type::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } } if (!_M_gcount) __err |= ios_base::failbit; if (__err) this->setstate(__err); return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: getline(char_type* __s, streamsize __n, char_type __delim) { _M_gcount = 0; ios_base::iostate __err = ios_base::goodbit; sentry __cerb(*this, true); if (__cerb) { __try { const int_type __idelim = traits_type::to_int_type(__delim); const int_type __eof = traits_type::eof(); __streambuf_type* __sb = this->rdbuf(); int_type __c = __sb->sgetc(); while (_M_gcount + 1 < __n && !traits_type::eq_int_type(__c, __eof) && !traits_type::eq_int_type(__c, __idelim)) { *__s++ = traits_type::to_char_type(__c); __c = __sb->snextc(); ++_M_gcount; } if (traits_type::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; else { if (traits_type::eq_int_type(__c, __idelim)) { __sb->sbumpc(); ++_M_gcount; } else __err |= ios_base::failbit; } } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 243. get and getline when sentry reports failure. if (__n > 0) *__s = char_type(); if (!_M_gcount) __err |= ios_base::failbit; if (__err) this->setstate(__err); return *this; } // We provide three overloads, since the first two are much simpler // than the general case. Also, the latter two can thus adopt the // same "batchy" strategy used by getline above. template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: ignore(void) { _M_gcount = 0; sentry __cerb(*this, true); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; __try { const int_type __eof = traits_type::eof(); __streambuf_type* __sb = this->rdbuf(); if (traits_type::eq_int_type(__sb->sbumpc(), __eof)) __err |= ios_base::eofbit; else _M_gcount = 1; } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: ignore(streamsize __n) { _M_gcount = 0; sentry __cerb(*this, true); if (__cerb && __n > 0) { ios_base::iostate __err = ios_base::goodbit; __try { const int_type __eof = traits_type::eof(); __streambuf_type* __sb = this->rdbuf(); int_type __c = __sb->sgetc(); // N.B. On LFS-enabled platforms streamsize is still 32 bits // wide: if we want to implement the standard mandated behavior // for n == max() (see 27.6.1.3/24) we are at risk of signed // integer overflow: thus these contortions. Also note that, // by definition, when more than 2G chars are actually ignored, // _M_gcount (the return value of gcount, that is) cannot be // really correct, being unavoidably too small. bool __large_ignore = false; while (true) { while (_M_gcount < __n && !traits_type::eq_int_type(__c, __eof)) { ++_M_gcount; __c = __sb->snextc(); } if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max && !traits_type::eq_int_type(__c, __eof)) { _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__min; __large_ignore = true; } else break; } if (__large_ignore) _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max; if (traits_type::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: ignore(streamsize __n, int_type __delim) { _M_gcount = 0; sentry __cerb(*this, true); if (__cerb && __n > 0) { ios_base::iostate __err = ios_base::goodbit; __try { const int_type __eof = traits_type::eof(); __streambuf_type* __sb = this->rdbuf(); int_type __c = __sb->sgetc(); // See comment above. bool __large_ignore = false; while (true) { while (_M_gcount < __n && !traits_type::eq_int_type(__c, __eof) && !traits_type::eq_int_type(__c, __delim)) { ++_M_gcount; __c = __sb->snextc(); } if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max && !traits_type::eq_int_type(__c, __eof) && !traits_type::eq_int_type(__c, __delim)) { _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__min; __large_ignore = true; } else break; } if (__large_ignore) _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max; if (traits_type::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; else if (traits_type::eq_int_type(__c, __delim)) { if (_M_gcount < __gnu_cxx::__numeric_traits<streamsize>::__max) ++_M_gcount; __sb->sbumpc(); } } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> typename basic_istream<_CharT, _Traits>::int_type basic_istream<_CharT, _Traits>:: peek(void) { int_type __c = traits_type::eof(); _M_gcount = 0; sentry __cerb(*this, true); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; __try { __c = this->rdbuf()->sgetc(); if (traits_type::eq_int_type(__c, traits_type::eof())) __err |= ios_base::eofbit; } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return __c; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: read(char_type* __s, streamsize __n) { _M_gcount = 0; sentry __cerb(*this, true); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; __try { _M_gcount = this->rdbuf()->sgetn(__s, __n); if (_M_gcount != __n) __err |= (ios_base::eofbit | ios_base::failbit); } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> streamsize basic_istream<_CharT, _Traits>:: readsome(char_type* __s, streamsize __n) { _M_gcount = 0; sentry __cerb(*this, true); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; __try { // Cannot compare int_type with streamsize generically. const streamsize __num = this->rdbuf()->in_avail(); if (__num > 0) _M_gcount = this->rdbuf()->sgetn(__s, std::min(__num, __n)); else if (__num == -1) __err |= ios_base::eofbit; } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return _M_gcount; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: putback(char_type __c) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 60. What is a formatted input function? _M_gcount = 0; // Clear eofbit per N3168. this->clear(this->rdstate() & ~ios_base::eofbit); sentry __cerb(*this, true); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; __try { const int_type __eof = traits_type::eof(); __streambuf_type* __sb = this->rdbuf(); if (!__sb || traits_type::eq_int_type(__sb->sputbackc(__c), __eof)) __err |= ios_base::badbit; } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: unget(void) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 60. What is a formatted input function? _M_gcount = 0; // Clear eofbit per N3168. this->clear(this->rdstate() & ~ios_base::eofbit); sentry __cerb(*this, true); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; __try { const int_type __eof = traits_type::eof(); __streambuf_type* __sb = this->rdbuf(); if (!__sb || traits_type::eq_int_type(__sb->sungetc(), __eof)) __err |= ios_base::badbit; } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> int basic_istream<_CharT, _Traits>:: sync(void) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR60. Do not change _M_gcount. int __ret = -1; sentry __cerb(*this, true); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; __try { __streambuf_type* __sb = this->rdbuf(); if (__sb) { if (__sb->pubsync() == -1) __err |= ios_base::badbit; else __ret = 0; } } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return __ret; } template<typename _CharT, typename _Traits> typename basic_istream<_CharT, _Traits>::pos_type basic_istream<_CharT, _Traits>:: tellg(void) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR60. Do not change _M_gcount. pos_type __ret = pos_type(-1); sentry __cerb(*this, true); if (__cerb) { __try { if (!this->fail()) __ret = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in); } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } } return __ret; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: seekg(pos_type __pos) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR60. Do not change _M_gcount. // Clear eofbit per N3168. this->clear(this->rdstate() & ~ios_base::eofbit); sentry __cerb(*this, true); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; __try { if (!this->fail()) { // 136. seekp, seekg setting wrong streams? const pos_type __p = this->rdbuf()->pubseekpos(__pos, ios_base::in); // 129. Need error indication from seekp() and seekg() if (__p == pos_type(off_type(-1))) __err |= ios_base::failbit; } } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>:: seekg(off_type __off, ios_base::seekdir __dir) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR60. Do not change _M_gcount. // Clear eofbit per N3168. this->clear(this->rdstate() & ~ios_base::eofbit); sentry __cerb(*this, true); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; __try { if (!this->fail()) { // 136. seekp, seekg setting wrong streams? const pos_type __p = this->rdbuf()->pubseekoff(__off, __dir, ios_base::in); // 129. Need error indication from seekp() and seekg() if (__p == pos_type(off_type(-1))) __err |= ios_base::failbit; } } __catch(__cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { this->_M_setstate(ios_base::badbit); } if (__err) this->setstate(__err); } return *this; } // 27.6.1.2.3 Character extraction templates template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) { typedef basic_istream<_CharT, _Traits> __istream_type; typedef typename __istream_type::int_type __int_type; typename __istream_type::sentry __cerb(__in, false); if (__cerb) { ios_base::iostate __err = ios_base::goodbit; __try { const __int_type __cb = __in.rdbuf()->sbumpc(); if (!_Traits::eq_int_type(__cb, _Traits::eof())) __c = _Traits::to_char_type(__cb); else __err |= (ios_base::eofbit | ios_base::failbit); } __catch(__cxxabiv1::__forced_unwind&) { __in._M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { __in._M_setstate(ios_base::badbit); } if (__err) __in.setstate(__err); } return __in; } template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) { typedef basic_istream<_CharT, _Traits> __istream_type; typedef basic_streambuf<_CharT, _Traits> __streambuf_type; typedef typename _Traits::int_type int_type; typedef _CharT char_type; typedef ctype<_CharT> __ctype_type; streamsize __extracted = 0; ios_base::iostate __err = ios_base::goodbit; typename __istream_type::sentry __cerb(__in, false); if (__cerb) { __try { // Figure out how many characters to extract. streamsize __num = __in.width(); if (__num <= 0) __num = __gnu_cxx::__numeric_traits<streamsize>::__max; const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc()); const int_type __eof = _Traits::eof(); __streambuf_type* __sb = __in.rdbuf(); int_type __c = __sb->sgetc(); while (__extracted < __num - 1 && !_Traits::eq_int_type(__c, __eof) && !__ct.is(ctype_base::space, _Traits::to_char_type(__c))) { *__s++ = _Traits::to_char_type(__c); ++__extracted; __c = __sb->snextc(); } if (_Traits::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; // _GLIBCXX_RESOLVE_LIB_DEFECTS // 68. Extractors for char* should store null at end *__s = char_type(); __in.width(0); } __catch(__cxxabiv1::__forced_unwind&) { __in._M_setstate(ios_base::badbit); __throw_exception_again; } __catch(...) { __in._M_setstate(ios_base::badbit); } } if (!__extracted) __err |= ios_base::failbit; if (__err) __in.setstate(__err); return __in; } // 27.6.1.4 Standard basic_istream manipulators template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& ws(basic_istream<_CharT, _Traits>& __in) { typedef basic_istream<_CharT, _Traits> __istream_type; typedef basic_streambuf<_CharT, _Traits> __streambuf_type; typedef typename __istream_type::int_type __int_type; typedef ctype<_CharT> __ctype_type; const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc()); const __int_type __eof = _Traits::eof(); __streambuf_type* __sb = __in.rdbuf(); __int_type __c = __sb->sgetc(); while (!_Traits::eq_int_type(__c, __eof) && __ct.is(ctype_base::space, _Traits::to_char_type(__c))) __c = __sb->snextc(); if (_Traits::eq_int_type(__c, __eof)) __in.setstate(ios_base::eofbit); return __in; } // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. #if _GLIBCXX_EXTERN_TEMPLATE extern template class basic_istream<char>; extern template istream& ws(istream&); extern template istream& operator>>(istream&, char&); extern template istream& operator>>(istream&, char*); extern template istream& operator>>(istream&, unsigned char&); extern template istream& operator>>(istream&, signed char&); extern template istream& operator>>(istream&, unsigned char*); extern template istream& operator>>(istream&, signed char*); extern template istream& istream::_M_extract(unsigned short&); extern template istream& istream::_M_extract(unsigned int&); extern template istream& istream::_M_extract(long&); extern template istream& istream::_M_extract(unsigned long&); extern template istream& istream::_M_extract(bool&); #ifdef _GLIBCXX_USE_LONG_LONG extern template istream& istream::_M_extract(long long&); extern template istream& istream::_M_extract(unsigned long long&); #endif extern template istream& istream::_M_extract(float&); extern template istream& istream::_M_extract(double&); extern template istream& istream::_M_extract(long double&); extern template istream& istream::_M_extract(void*&); extern template class basic_iostream<char>; #ifdef _GLIBCXX_USE_WCHAR_T extern template class basic_istream<wchar_t>; extern template wistream& ws(wistream&); extern template wistream& operator>>(wistream&, wchar_t&); extern template wistream& operator>>(wistream&, wchar_t*); extern template wistream& wistream::_M_extract(unsigned short&); extern template wistream& wistream::_M_extract(unsigned int&); extern template wistream& wistream::_M_extract(long&); extern template wistream& wistream::_M_extract(unsigned long&); extern template wistream& wistream::_M_extract(bool&); #ifdef _GLIBCXX_USE_LONG_LONG extern template wistream& wistream::_M_extract(long long&); extern template wistream& wistream::_M_extract(unsigned long long&); #endif extern template wistream& wistream::_M_extract(float&); extern template wistream& wistream::_M_extract(double&); extern template wistream& wistream::_M_extract(long double&); extern template wistream& wistream::_M_extract(void*&); extern template class basic_iostream<wchar_t>; #endif #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif �������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/valarray_before.h��������������������������������������������������������������������0000644�����������������00000044121�14763166030�0012052 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// The template and inlines for the -*- C++ -*- internal _Meta class. // Copyright (C) 1997-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file bits/valarray_before.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{valarray} */ // Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr> #ifndef _VALARRAY_BEFORE_H #define _VALARRAY_BEFORE_H 1 #pragma GCC system_header #include <bits/slice_array.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // // Implementing a loosened valarray return value is tricky. // First we need to meet 26.3.1/3: we should not add more than // two levels of template nesting. Therefore we resort to template // template to "flatten" loosened return value types. // At some point we use partial specialization to remove one level // template nesting due to _Expr<> // // This class is NOT defined. It doesn't need to. template<typename _Tp1, typename _Tp2> class _Constant; // Implementations of unary functions applied to valarray<>s. // I use hard-coded object functions here instead of a generic // approach like pointers to function: // 1) correctness: some functions take references, others values. // we can't deduce the correct type afterwards. // 2) efficiency -- object functions can be easily inlined // 3) be Koenig-lookup-friendly struct _Abs { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return abs(__t); } }; struct _Cos { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return cos(__t); } }; struct _Acos { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return acos(__t); } }; struct _Cosh { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return cosh(__t); } }; struct _Sin { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return sin(__t); } }; struct _Asin { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return asin(__t); } }; struct _Sinh { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return sinh(__t); } }; struct _Tan { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return tan(__t); } }; struct _Atan { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return atan(__t); } }; struct _Tanh { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return tanh(__t); } }; struct _Exp { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return exp(__t); } }; struct _Log { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return log(__t); } }; struct _Log10 { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return log10(__t); } }; struct _Sqrt { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return sqrt(__t); } }; // In the past, we used to tailor operator applications semantics // to the specialization of standard function objects (i.e. plus<>, etc.) // That is incorrect. Therefore we provide our own surrogates. struct __unary_plus { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return +__t; } }; struct __negate { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return -__t; } }; struct __bitwise_not { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return ~__t; } }; struct __plus { template<typename _Tp> _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x + __y; } }; struct __minus { template<typename _Tp> _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x - __y; } }; struct __multiplies { template<typename _Tp> _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x * __y; } }; struct __divides { template<typename _Tp> _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x / __y; } }; struct __modulus { template<typename _Tp> _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x % __y; } }; struct __bitwise_xor { template<typename _Tp> _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x ^ __y; } }; struct __bitwise_and { template<typename _Tp> _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x & __y; } }; struct __bitwise_or { template<typename _Tp> _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x | __y; } }; struct __shift_left { template<typename _Tp> _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x << __y; } }; struct __shift_right { template<typename _Tp> _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x >> __y; } }; struct __logical_and { template<typename _Tp> bool operator()(const _Tp& __x, const _Tp& __y) const { return __x && __y; } }; struct __logical_or { template<typename _Tp> bool operator()(const _Tp& __x, const _Tp& __y) const { return __x || __y; } }; struct __logical_not { template<typename _Tp> bool operator()(const _Tp& __x) const { return !__x; } }; struct __equal_to { template<typename _Tp> bool operator()(const _Tp& __x, const _Tp& __y) const { return __x == __y; } }; struct __not_equal_to { template<typename _Tp> bool operator()(const _Tp& __x, const _Tp& __y) const { return __x != __y; } }; struct __less { template<typename _Tp> bool operator()(const _Tp& __x, const _Tp& __y) const { return __x < __y; } }; struct __greater { template<typename _Tp> bool operator()(const _Tp& __x, const _Tp& __y) const { return __x > __y; } }; struct __less_equal { template<typename _Tp> bool operator()(const _Tp& __x, const _Tp& __y) const { return __x <= __y; } }; struct __greater_equal { template<typename _Tp> bool operator()(const _Tp& __x, const _Tp& __y) const { return __x >= __y; } }; // The few binary functions we miss. struct _Atan2 { template<typename _Tp> _Tp operator()(const _Tp& __x, const _Tp& __y) const { return atan2(__x, __y); } }; struct _Pow { template<typename _Tp> _Tp operator()(const _Tp& __x, const _Tp& __y) const { return pow(__x, __y); } }; template<typename _Tp, bool _IsValidValarrayValue = !__is_abstract(_Tp)> struct __fun_with_valarray { typedef _Tp result_type; }; template<typename _Tp> struct __fun_with_valarray<_Tp, false> { // No result type defined for invalid value types. }; // We need these bits in order to recover the return type of // some functions/operators now that we're no longer using // function templates. template<typename, typename _Tp> struct __fun : __fun_with_valarray<_Tp> { }; // several specializations for relational operators. template<typename _Tp> struct __fun<__logical_not, _Tp> { typedef bool result_type; }; template<typename _Tp> struct __fun<__logical_and, _Tp> { typedef bool result_type; }; template<typename _Tp> struct __fun<__logical_or, _Tp> { typedef bool result_type; }; template<typename _Tp> struct __fun<__less, _Tp> { typedef bool result_type; }; template<typename _Tp> struct __fun<__greater, _Tp> { typedef bool result_type; }; template<typename _Tp> struct __fun<__less_equal, _Tp> { typedef bool result_type; }; template<typename _Tp> struct __fun<__greater_equal, _Tp> { typedef bool result_type; }; template<typename _Tp> struct __fun<__equal_to, _Tp> { typedef bool result_type; }; template<typename _Tp> struct __fun<__not_equal_to, _Tp> { typedef bool result_type; }; // // Apply function taking a value/const reference closure // template<typename _Dom, typename _Arg> class _FunBase { public: typedef typename _Dom::value_type value_type; _FunBase(const _Dom& __e, value_type __f(_Arg)) : _M_expr(__e), _M_func(__f) {} value_type operator[](size_t __i) const { return _M_func (_M_expr[__i]); } size_t size() const { return _M_expr.size ();} private: const _Dom& _M_expr; value_type (*_M_func)(_Arg); }; template<class _Dom> struct _ValFunClos<_Expr,_Dom> : _FunBase<_Dom, typename _Dom::value_type> { typedef _FunBase<_Dom, typename _Dom::value_type> _Base; typedef typename _Base::value_type value_type; typedef value_type _Tp; _ValFunClos(const _Dom& __e, _Tp __f(_Tp)) : _Base(__e, __f) {} }; template<typename _Tp> struct _ValFunClos<_ValArray,_Tp> : _FunBase<valarray<_Tp>, _Tp> { typedef _FunBase<valarray<_Tp>, _Tp> _Base; typedef _Tp value_type; _ValFunClos(const valarray<_Tp>& __v, _Tp __f(_Tp)) : _Base(__v, __f) {} }; template<class _Dom> struct _RefFunClos<_Expr, _Dom> : _FunBase<_Dom, const typename _Dom::value_type&> { typedef _FunBase<_Dom, const typename _Dom::value_type&> _Base; typedef typename _Base::value_type value_type; typedef value_type _Tp; _RefFunClos(const _Dom& __e, _Tp __f(const _Tp&)) : _Base(__e, __f) {} }; template<typename _Tp> struct _RefFunClos<_ValArray, _Tp> : _FunBase<valarray<_Tp>, const _Tp&> { typedef _FunBase<valarray<_Tp>, const _Tp&> _Base; typedef _Tp value_type; _RefFunClos(const valarray<_Tp>& __v, _Tp __f(const _Tp&)) : _Base(__v, __f) {} }; // // Unary expression closure. // template<class _Oper, class _Arg> class _UnBase { public: typedef typename _Arg::value_type _Vt; typedef typename __fun<_Oper, _Vt>::result_type value_type; _UnBase(const _Arg& __e) : _M_expr(__e) {} value_type operator[](size_t __i) const { return _Oper()(_M_expr[__i]); } size_t size() const { return _M_expr.size(); } private: const _Arg& _M_expr; }; template<class _Oper, class _Dom> struct _UnClos<_Oper, _Expr, _Dom> : _UnBase<_Oper, _Dom> { typedef _Dom _Arg; typedef _UnBase<_Oper, _Dom> _Base; typedef typename _Base::value_type value_type; _UnClos(const _Arg& __e) : _Base(__e) {} }; template<class _Oper, typename _Tp> struct _UnClos<_Oper, _ValArray, _Tp> : _UnBase<_Oper, valarray<_Tp> > { typedef valarray<_Tp> _Arg; typedef _UnBase<_Oper, valarray<_Tp> > _Base; typedef typename _Base::value_type value_type; _UnClos(const _Arg& __e) : _Base(__e) {} }; // // Binary expression closure. // template<class _Oper, class _FirstArg, class _SecondArg> class _BinBase { public: typedef typename _FirstArg::value_type _Vt; typedef typename __fun<_Oper, _Vt>::result_type value_type; _BinBase(const _FirstArg& __e1, const _SecondArg& __e2) : _M_expr1(__e1), _M_expr2(__e2) {} value_type operator[](size_t __i) const { return _Oper()(_M_expr1[__i], _M_expr2[__i]); } size_t size() const { return _M_expr1.size(); } private: const _FirstArg& _M_expr1; const _SecondArg& _M_expr2; }; template<class _Oper, class _Clos> class _BinBase2 { public: typedef typename _Clos::value_type _Vt; typedef typename __fun<_Oper, _Vt>::result_type value_type; _BinBase2(const _Clos& __e, const _Vt& __t) : _M_expr1(__e), _M_expr2(__t) {} value_type operator[](size_t __i) const { return _Oper()(_M_expr1[__i], _M_expr2); } size_t size() const { return _M_expr1.size(); } private: const _Clos& _M_expr1; const _Vt& _M_expr2; }; template<class _Oper, class _Clos> class _BinBase1 { public: typedef typename _Clos::value_type _Vt; typedef typename __fun<_Oper, _Vt>::result_type value_type; _BinBase1(const _Vt& __t, const _Clos& __e) : _M_expr1(__t), _M_expr2(__e) {} value_type operator[](size_t __i) const { return _Oper()(_M_expr1, _M_expr2[__i]); } size_t size() const { return _M_expr2.size(); } private: const _Vt& _M_expr1; const _Clos& _M_expr2; }; template<class _Oper, class _Dom1, class _Dom2> struct _BinClos<_Oper, _Expr, _Expr, _Dom1, _Dom2> : _BinBase<_Oper, _Dom1, _Dom2> { typedef _BinBase<_Oper, _Dom1, _Dom2> _Base; typedef typename _Base::value_type value_type; _BinClos(const _Dom1& __e1, const _Dom2& __e2) : _Base(__e1, __e2) {} }; template<class _Oper, typename _Tp> struct _BinClos<_Oper,_ValArray, _ValArray, _Tp, _Tp> : _BinBase<_Oper, valarray<_Tp>, valarray<_Tp> > { typedef _BinBase<_Oper, valarray<_Tp>, valarray<_Tp> > _Base; typedef typename _Base::value_type value_type; _BinClos(const valarray<_Tp>& __v, const valarray<_Tp>& __w) : _Base(__v, __w) {} }; template<class _Oper, class _Dom> struct _BinClos<_Oper, _Expr, _ValArray, _Dom, typename _Dom::value_type> : _BinBase<_Oper, _Dom, valarray<typename _Dom::value_type> > { typedef typename _Dom::value_type _Tp; typedef _BinBase<_Oper,_Dom,valarray<_Tp> > _Base; typedef typename _Base::value_type value_type; _BinClos(const _Dom& __e1, const valarray<_Tp>& __e2) : _Base(__e1, __e2) {} }; template<class _Oper, class _Dom> struct _BinClos<_Oper, _ValArray, _Expr, typename _Dom::value_type, _Dom> : _BinBase<_Oper, valarray<typename _Dom::value_type>,_Dom> { typedef typename _Dom::value_type _Tp; typedef _BinBase<_Oper, valarray<_Tp>, _Dom> _Base; typedef typename _Base::value_type value_type; _BinClos(const valarray<_Tp>& __e1, const _Dom& __e2) : _Base(__e1, __e2) {} }; template<class _Oper, class _Dom> struct _BinClos<_Oper, _Expr, _Constant, _Dom, typename _Dom::value_type> : _BinBase2<_Oper, _Dom> { typedef typename _Dom::value_type _Tp; typedef _BinBase2<_Oper,_Dom> _Base; typedef typename _Base::value_type value_type; _BinClos(const _Dom& __e1, const _Tp& __e2) : _Base(__e1, __e2) {} }; template<class _Oper, class _Dom> struct _BinClos<_Oper, _Constant, _Expr, typename _Dom::value_type, _Dom> : _BinBase1<_Oper, _Dom> { typedef typename _Dom::value_type _Tp; typedef _BinBase1<_Oper, _Dom> _Base; typedef typename _Base::value_type value_type; _BinClos(const _Tp& __e1, const _Dom& __e2) : _Base(__e1, __e2) {} }; template<class _Oper, typename _Tp> struct _BinClos<_Oper, _ValArray, _Constant, _Tp, _Tp> : _BinBase2<_Oper, valarray<_Tp> > { typedef _BinBase2<_Oper,valarray<_Tp> > _Base; typedef typename _Base::value_type value_type; _BinClos(const valarray<_Tp>& __v, const _Tp& __t) : _Base(__v, __t) {} }; template<class _Oper, typename _Tp> struct _BinClos<_Oper, _Constant, _ValArray, _Tp, _Tp> : _BinBase1<_Oper, valarray<_Tp> > { typedef _BinBase1<_Oper, valarray<_Tp> > _Base; typedef typename _Base::value_type value_type; _BinClos(const _Tp& __t, const valarray<_Tp>& __v) : _Base(__t, __v) {} }; // // slice_array closure. // template<typename _Dom> class _SBase { public: typedef typename _Dom::value_type value_type; _SBase (const _Dom& __e, const slice& __s) : _M_expr (__e), _M_slice (__s) {} value_type operator[] (size_t __i) const { return _M_expr[_M_slice.start () + __i * _M_slice.stride ()]; } size_t size() const { return _M_slice.size (); } private: const _Dom& _M_expr; const slice& _M_slice; }; template<typename _Tp> class _SBase<_Array<_Tp> > { public: typedef _Tp value_type; _SBase (_Array<_Tp> __a, const slice& __s) : _M_array (__a._M_data+__s.start()), _M_size (__s.size()), _M_stride (__s.stride()) {} value_type operator[] (size_t __i) const { return _M_array._M_data[__i * _M_stride]; } size_t size() const { return _M_size; } private: const _Array<_Tp> _M_array; const size_t _M_size; const size_t _M_stride; }; template<class _Dom> struct _SClos<_Expr, _Dom> : _SBase<_Dom> { typedef _SBase<_Dom> _Base; typedef typename _Base::value_type value_type; _SClos (const _Dom& __e, const slice& __s) : _Base (__e, __s) {} }; template<typename _Tp> struct _SClos<_ValArray, _Tp> : _SBase<_Array<_Tp> > { typedef _SBase<_Array<_Tp> > _Base; typedef _Tp value_type; _SClos (_Array<_Tp> __a, const slice& __s) : _Base (__a, __s) {} }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _CPP_VALARRAY_BEFORE_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/bits/stl_algo.h���������������������������������������������������������������������������0000644�����������������00000651061�14763166030�0010522 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Algorithm implementation -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_algo.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{algorithm} */ #ifndef _STL_ALGO_H #define _STL_ALGO_H 1 #include <cstdlib> // for rand #include <bits/algorithmfwd.h> #include <bits/stl_heap.h> #include <bits/stl_tempbuf.h> // for _Temporary_buffer #if __cplusplus >= 201103L #include <random> // for std::uniform_int_distribution #include <functional> // for std::bind #endif // See concept_check.h for the __glibcxx_*_requires macros. namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /// Swaps the median value of *__a, *__b and *__c to *__result template<typename _Iterator> void __move_median_to_first(_Iterator __result, _Iterator __a, _Iterator __b, _Iterator __c) { // concept requirements __glibcxx_function_requires(_LessThanComparableConcept< typename iterator_traits<_Iterator>::value_type>) if (*__a < *__b) { if (*__b < *__c) std::iter_swap(__result, __b); else if (*__a < *__c) std::iter_swap(__result, __c); else std::iter_swap(__result, __a); } else if (*__a < *__c) std::iter_swap(__result, __a); else if (*__b < *__c) std::iter_swap(__result, __c); else std::iter_swap(__result, __b); } /// Swaps the median value of *__a, *__b and *__c under __comp to *__result template<typename _Iterator, typename _Compare> void __move_median_to_first(_Iterator __result, _Iterator __a, _Iterator __b, _Iterator __c, _Compare __comp) { // concept requirements __glibcxx_function_requires(_BinaryFunctionConcept<_Compare, bool, typename iterator_traits<_Iterator>::value_type, typename iterator_traits<_Iterator>::value_type>) if (__comp(*__a, *__b)) { if (__comp(*__b, *__c)) std::iter_swap(__result, __b); else if (__comp(*__a, *__c)) std::iter_swap(__result, __c); else std::iter_swap(__result, __a); } else if (__comp(*__a, *__c)) std::iter_swap(__result, __a); else if (__comp(*__b, *__c)) std::iter_swap(__result, __c); else std::iter_swap(__result, __b); } // for_each /// This is an overload used by find() for the Input Iterator case. template<typename _InputIterator, typename _Tp> inline _InputIterator __find(_InputIterator __first, _InputIterator __last, const _Tp& __val, input_iterator_tag) { while (__first != __last && !(*__first == __val)) ++__first; return __first; } /// This is an overload used by find_if() for the Input Iterator case. template<typename _InputIterator, typename _Predicate> inline _InputIterator __find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred, input_iterator_tag) { while (__first != __last && !bool(__pred(*__first))) ++__first; return __first; } /// This is an overload used by find() for the RAI case. template<typename _RandomAccessIterator, typename _Tp> _RandomAccessIterator __find(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __val, random_access_iterator_tag) { typename iterator_traits<_RandomAccessIterator>::difference_type __trip_count = (__last - __first) >> 2; for (; __trip_count > 0; --__trip_count) { if (*__first == __val) return __first; ++__first; if (*__first == __val) return __first; ++__first; if (*__first == __val) return __first; ++__first; if (*__first == __val) return __first; ++__first; } switch (__last - __first) { case 3: if (*__first == __val) return __first; ++__first; case 2: if (*__first == __val) return __first; ++__first; case 1: if (*__first == __val) return __first; ++__first; case 0: default: return __last; } } /// This is an overload used by find_if() for the RAI case. template<typename _RandomAccessIterator, typename _Predicate> _RandomAccessIterator __find_if(_RandomAccessIterator __first, _RandomAccessIterator __last, _Predicate __pred, random_access_iterator_tag) { typename iterator_traits<_RandomAccessIterator>::difference_type __trip_count = (__last - __first) >> 2; for (; __trip_count > 0; --__trip_count) { if (__pred(*__first)) return __first; ++__first; if (__pred(*__first)) return __first; ++__first; if (__pred(*__first)) return __first; ++__first; if (__pred(*__first)) return __first; ++__first; } switch (__last - __first) { case 3: if (__pred(*__first)) return __first; ++__first; case 2: if (__pred(*__first)) return __first; ++__first; case 1: if (__pred(*__first)) return __first; ++__first; case 0: default: return __last; } } /// This is an overload used by find_if_not() for the Input Iterator case. template<typename _InputIterator, typename _Predicate> inline _InputIterator __find_if_not(_InputIterator __first, _InputIterator __last, _Predicate __pred, input_iterator_tag) { while (__first != __last && bool(__pred(*__first))) ++__first; return __first; } /// This is an overload used by find_if_not() for the RAI case. template<typename _RandomAccessIterator, typename _Predicate> _RandomAccessIterator __find_if_not(_RandomAccessIterator __first, _RandomAccessIterator __last, _Predicate __pred, random_access_iterator_tag) { typename iterator_traits<_RandomAccessIterator>::difference_type __trip_count = (__last - __first) >> 2; for (; __trip_count > 0; --__trip_count) { if (!bool(__pred(*__first))) return __first; ++__first; if (!bool(__pred(*__first))) return __first; ++__first; if (!bool(__pred(*__first))) return __first; ++__first; if (!bool(__pred(*__first))) return __first; ++__first; } switch (__last - __first) { case 3: if (!bool(__pred(*__first))) return __first; ++__first; case 2: if (!bool(__pred(*__first))) return __first; ++__first; case 1: if (!bool(__pred(*__first))) return __first; ++__first; case 0: default: return __last; } } /// Provided for stable_partition to use. template<typename _InputIterator, typename _Predicate> inline _InputIterator __find_if_not(_InputIterator __first, _InputIterator __last, _Predicate __pred) { return std::__find_if_not(__first, __last, __pred, std::__iterator_category(__first)); } /// Like find_if_not(), but uses and updates a count of the /// remaining range length instead of comparing against an end /// iterator. template<typename _InputIterator, typename _Predicate, typename _Distance> _InputIterator __find_if_not_n(_InputIterator __first, _Distance& __len, _Predicate __pred) { for (; __len; --__len, ++__first) if (!bool(__pred(*__first))) break; return __first; } // set_difference // set_intersection // set_symmetric_difference // set_union // for_each // find // find_if // find_first_of // adjacent_find // count // count_if // search /** * This is an uglified * search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&) * overloaded for forward iterators. */ template<typename _ForwardIterator, typename _Integer, typename _Tp> _ForwardIterator __search_n(_ForwardIterator __first, _ForwardIterator __last, _Integer __count, const _Tp& __val, std::forward_iterator_tag) { __first = _GLIBCXX_STD_A::find(__first, __last, __val); while (__first != __last) { typename iterator_traits<_ForwardIterator>::difference_type __n = __count; _ForwardIterator __i = __first; ++__i; while (__i != __last && __n != 1 && *__i == __val) { ++__i; --__n; } if (__n == 1) return __first; if (__i == __last) return __last; __first = _GLIBCXX_STD_A::find(++__i, __last, __val); } return __last; } /** * This is an uglified * search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&) * overloaded for random access iterators. */ template<typename _RandomAccessIter, typename _Integer, typename _Tp> _RandomAccessIter __search_n(_RandomAccessIter __first, _RandomAccessIter __last, _Integer __count, const _Tp& __val, std::random_access_iterator_tag) { typedef typename std::iterator_traits<_RandomAccessIter>::difference_type _DistanceType; _DistanceType __tailSize = __last - __first; _DistanceType __remainder = __count; while (__remainder <= __tailSize) // the main loop... { __first += __remainder; __tailSize -= __remainder; // __first here is always pointing to one past the last element of // next possible match. _RandomAccessIter __backTrack = __first; while (*--__backTrack == __val) { if (--__remainder == 0) return (__first - __count); // Success } __remainder = __count + 1 - (__first - __backTrack); } return __last; // Failure } // search_n /** * This is an uglified * search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&, * _BinaryPredicate) * overloaded for forward iterators. */ template<typename _ForwardIterator, typename _Integer, typename _Tp, typename _BinaryPredicate> _ForwardIterator __search_n(_ForwardIterator __first, _ForwardIterator __last, _Integer __count, const _Tp& __val, _BinaryPredicate __binary_pred, std::forward_iterator_tag) { while (__first != __last && !bool(__binary_pred(*__first, __val))) ++__first; while (__first != __last) { typename iterator_traits<_ForwardIterator>::difference_type __n = __count; _ForwardIterator __i = __first; ++__i; while (__i != __last && __n != 1 && bool(__binary_pred(*__i, __val))) { ++__i; --__n; } if (__n == 1) return __first; if (__i == __last) return __last; __first = ++__i; while (__first != __last && !bool(__binary_pred(*__first, __val))) ++__first; } return __last; } /** * This is an uglified * search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&, * _BinaryPredicate) * overloaded for random access iterators. */ template<typename _RandomAccessIter, typename _Integer, typename _Tp, typename _BinaryPredicate> _RandomAccessIter __search_n(_RandomAccessIter __first, _RandomAccessIter __last, _Integer __count, const _Tp& __val, _BinaryPredicate __binary_pred, std::random_access_iterator_tag) { typedef typename std::iterator_traits<_RandomAccessIter>::difference_type _DistanceType; _DistanceType __tailSize = __last - __first; _DistanceType __remainder = __count; while (__remainder <= __tailSize) // the main loop... { __first += __remainder; __tailSize -= __remainder; // __first here is always pointing to one past the last element of // next possible match. _RandomAccessIter __backTrack = __first; while (__binary_pred(*--__backTrack, __val)) { if (--__remainder == 0) return (__first - __count); // Success } __remainder = __count + 1 - (__first - __backTrack); } return __last; // Failure } // find_end for forward iterators. template<typename _ForwardIterator1, typename _ForwardIterator2> _ForwardIterator1 __find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, forward_iterator_tag, forward_iterator_tag) { if (__first2 == __last2) return __last1; else { _ForwardIterator1 __result = __last1; while (1) { _ForwardIterator1 __new_result = _GLIBCXX_STD_A::search(__first1, __last1, __first2, __last2); if (__new_result == __last1) return __result; else { __result = __new_result; __first1 = __new_result; ++__first1; } } } } template<typename _ForwardIterator1, typename _ForwardIterator2, typename _BinaryPredicate> _ForwardIterator1 __find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, forward_iterator_tag, forward_iterator_tag, _BinaryPredicate __comp) { if (__first2 == __last2) return __last1; else { _ForwardIterator1 __result = __last1; while (1) { _ForwardIterator1 __new_result = _GLIBCXX_STD_A::search(__first1, __last1, __first2, __last2, __comp); if (__new_result == __last1) return __result; else { __result = __new_result; __first1 = __new_result; ++__first1; } } } } // find_end for bidirectional iterators (much faster). template<typename _BidirectionalIterator1, typename _BidirectionalIterator2> _BidirectionalIterator1 __find_end(_BidirectionalIterator1 __first1, _BidirectionalIterator1 __last1, _BidirectionalIterator2 __first2, _BidirectionalIterator2 __last2, bidirectional_iterator_tag, bidirectional_iterator_tag) { // concept requirements __glibcxx_function_requires(_BidirectionalIteratorConcept< _BidirectionalIterator1>) __glibcxx_function_requires(_BidirectionalIteratorConcept< _BidirectionalIterator2>) typedef reverse_iterator<_BidirectionalIterator1> _RevIterator1; typedef reverse_iterator<_BidirectionalIterator2> _RevIterator2; _RevIterator1 __rlast1(__first1); _RevIterator2 __rlast2(__first2); _RevIterator1 __rresult = _GLIBCXX_STD_A::search(_RevIterator1(__last1), __rlast1, _RevIterator2(__last2), __rlast2); if (__rresult == __rlast1) return __last1; else { _BidirectionalIterator1 __result = __rresult.base(); std::advance(__result, -std::distance(__first2, __last2)); return __result; } } template<typename _BidirectionalIterator1, typename _BidirectionalIterator2, typename _BinaryPredicate> _BidirectionalIterator1 __find_end(_BidirectionalIterator1 __first1, _BidirectionalIterator1 __last1, _BidirectionalIterator2 __first2, _BidirectionalIterator2 __last2, bidirectional_iterator_tag, bidirectional_iterator_tag, _BinaryPredicate __comp) { // concept requirements __glibcxx_function_requires(_BidirectionalIteratorConcept< _BidirectionalIterator1>) __glibcxx_function_requires(_BidirectionalIteratorConcept< _BidirectionalIterator2>) typedef reverse_iterator<_BidirectionalIterator1> _RevIterator1; typedef reverse_iterator<_BidirectionalIterator2> _RevIterator2; _RevIterator1 __rlast1(__first1); _RevIterator2 __rlast2(__first2); _RevIterator1 __rresult = std::search(_RevIterator1(__last1), __rlast1, _RevIterator2(__last2), __rlast2, __comp); if (__rresult == __rlast1) return __last1; else { _BidirectionalIterator1 __result = __rresult.base(); std::advance(__result, -std::distance(__first2, __last2)); return __result; } } /** * @brief Find last matching subsequence in a sequence. * @ingroup non_mutating_algorithms * @param __first1 Start of range to search. * @param __last1 End of range to search. * @param __first2 Start of sequence to match. * @param __last2 End of sequence to match. * @return The last iterator @c i in the range * @p [__first1,__last1-(__last2-__first2)) such that @c *(i+N) == * @p *(__first2+N) for each @c N in the range @p * [0,__last2-__first2), or @p __last1 if no such iterator exists. * * Searches the range @p [__first1,__last1) for a sub-sequence that * compares equal value-by-value with the sequence given by @p * [__first2,__last2) and returns an iterator to the __first * element of the sub-sequence, or @p __last1 if the sub-sequence * is not found. The sub-sequence will be the last such * subsequence contained in [__first,__last1). * * Because the sub-sequence must lie completely within the range @p * [__first1,__last1) it must start at a position less than @p * __last1-(__last2-__first2) where @p __last2-__first2 is the * length of the sub-sequence. This means that the returned * iterator @c i will be in the range @p * [__first1,__last1-(__last2-__first2)) */ template<typename _ForwardIterator1, typename _ForwardIterator2> inline _ForwardIterator1 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) __glibcxx_function_requires(_EqualOpConcept< typename iterator_traits<_ForwardIterator1>::value_type, typename iterator_traits<_ForwardIterator2>::value_type>) __glibcxx_requires_valid_range(__first1, __last1); __glibcxx_requires_valid_range(__first2, __last2); return std::__find_end(__first1, __last1, __first2, __last2, std::__iterator_category(__first1), std::__iterator_category(__first2)); } /** * @brief Find last matching subsequence in a sequence using a predicate. * @ingroup non_mutating_algorithms * @param __first1 Start of range to search. * @param __last1 End of range to search. * @param __first2 Start of sequence to match. * @param __last2 End of sequence to match. * @param __comp The predicate to use. * @return The last iterator @c i in the range @p * [__first1,__last1-(__last2-__first2)) such that @c * predicate(*(i+N), @p (__first2+N)) is true for each @c N in the * range @p [0,__last2-__first2), or @p __last1 if no such iterator * exists. * * Searches the range @p [__first1,__last1) for a sub-sequence that * compares equal value-by-value with the sequence given by @p * [__first2,__last2) using comp as a predicate and returns an * iterator to the first element of the sub-sequence, or @p __last1 * if the sub-sequence is not found. The sub-sequence will be the * last such subsequence contained in [__first,__last1). * * Because the sub-sequence must lie completely within the range @p * [__first1,__last1) it must start at a position less than @p * __last1-(__last2-__first2) where @p __last2-__first2 is the * length of the sub-sequence. This means that the returned * iterator @c i will be in the range @p * [__first1,__last1-(__last2-__first2)) */ template<typename _ForwardIterator1, typename _ForwardIterator2, typename _BinaryPredicate> inline _ForwardIterator1 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __comp) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, typename iterator_traits<_ForwardIterator1>::value_type, typename iterator_traits<_ForwardIterator2>::value_type>) __glibcxx_requires_valid_range(__first1, __last1); __glibcxx_requires_valid_range(__first2, __last2); return std::__find_end(__first1, __last1, __first2, __last2, std::__iterator_category(__first1), std::__iterator_category(__first2), __comp); } #if __cplusplus >= 201103L /** * @brief Checks that a predicate is true for all the elements * of a sequence. * @ingroup non_mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __pred A predicate. * @return True if the check is true, false otherwise. * * Returns true if @p __pred is true for each element in the range * @p [__first,__last), and false otherwise. */ template<typename _InputIterator, typename _Predicate> inline bool all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) { return __last == std::find_if_not(__first, __last, __pred); } /** * @brief Checks that a predicate is false for all the elements * of a sequence. * @ingroup non_mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __pred A predicate. * @return True if the check is true, false otherwise. * * Returns true if @p __pred is false for each element in the range * @p [__first,__last), and false otherwise. */ template<typename _InputIterator, typename _Predicate> inline bool none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) { return __last == _GLIBCXX_STD_A::find_if(__first, __last, __pred); } /** * @brief Checks that a predicate is false for at least an element * of a sequence. * @ingroup non_mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __pred A predicate. * @return True if the check is true, false otherwise. * * Returns true if an element exists in the range @p * [__first,__last) such that @p __pred is true, and false * otherwise. */ template<typename _InputIterator, typename _Predicate> inline bool any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) { return !std::none_of(__first, __last, __pred); } /** * @brief Find the first element in a sequence for which a * predicate is false. * @ingroup non_mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __pred A predicate. * @return The first iterator @c i in the range @p [__first,__last) * such that @p __pred(*i) is false, or @p __last if no such iterator exists. */ template<typename _InputIterator, typename _Predicate> inline _InputIterator find_if_not(_InputIterator __first, _InputIterator __last, _Predicate __pred) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, typename iterator_traits<_InputIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); return std::__find_if_not(__first, __last, __pred); } /** * @brief Checks whether the sequence is partitioned. * @ingroup mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __pred A predicate. * @return True if the range @p [__first,__last) is partioned by @p __pred, * i.e. if all elements that satisfy @p __pred appear before those that * do not. */ template<typename _InputIterator, typename _Predicate> inline bool is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred) { __first = std::find_if_not(__first, __last, __pred); return std::none_of(__first, __last, __pred); } /** * @brief Find the partition point of a partitioned range. * @ingroup mutating_algorithms * @param __first An iterator. * @param __last Another iterator. * @param __pred A predicate. * @return An iterator @p mid such that @p all_of(__first, mid, __pred) * and @p none_of(mid, __last, __pred) are both true. */ template<typename _ForwardIterator, typename _Predicate> _ForwardIterator partition_point(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, typename iterator_traits<_ForwardIterator>::value_type>) // A specific debug-mode test will be necessary... __glibcxx_requires_valid_range(__first, __last); typedef typename iterator_traits<_ForwardIterator>::difference_type _DistanceType; _DistanceType __len = std::distance(__first, __last); _DistanceType __half; _ForwardIterator __middle; while (__len > 0) { __half = __len >> 1; __middle = __first; std::advance(__middle, __half); if (__pred(*__middle)) { __first = __middle; ++__first; __len = __len - __half - 1; } else __len = __half; } return __first; } #endif /** * @brief Copy a sequence, removing elements of a given value. * @ingroup mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __result An output iterator. * @param __value The value to be removed. * @return An iterator designating the end of the resulting sequence. * * Copies each element in the range @p [__first,__last) not equal * to @p __value to the range beginning at @p __result. * remove_copy() is stable, so the relative order of elements that * are copied is unchanged. */ template<typename _InputIterator, typename _OutputIterator, typename _Tp> _OutputIterator remove_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __value) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, typename iterator_traits<_InputIterator>::value_type>) __glibcxx_function_requires(_EqualOpConcept< typename iterator_traits<_InputIterator>::value_type, _Tp>) __glibcxx_requires_valid_range(__first, __last); for (; __first != __last; ++__first) if (!(*__first == __value)) { *__result = *__first; ++__result; } return __result; } /** * @brief Copy a sequence, removing elements for which a predicate is true. * @ingroup mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __result An output iterator. * @param __pred A predicate. * @return An iterator designating the end of the resulting sequence. * * Copies each element in the range @p [__first,__last) for which * @p __pred returns false to the range beginning at @p __result. * * remove_copy_if() is stable, so the relative order of elements that are * copied is unchanged. */ template<typename _InputIterator, typename _OutputIterator, typename _Predicate> _OutputIterator remove_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, typename iterator_traits<_InputIterator>::value_type>) __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, typename iterator_traits<_InputIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); for (; __first != __last; ++__first) if (!bool(__pred(*__first))) { *__result = *__first; ++__result; } return __result; } #if __cplusplus >= 201103L /** * @brief Copy the elements of a sequence for which a predicate is true. * @ingroup mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __result An output iterator. * @param __pred A predicate. * @return An iterator designating the end of the resulting sequence. * * Copies each element in the range @p [__first,__last) for which * @p __pred returns true to the range beginning at @p __result. * * copy_if() is stable, so the relative order of elements that are * copied is unchanged. */ template<typename _InputIterator, typename _OutputIterator, typename _Predicate> _OutputIterator copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, typename iterator_traits<_InputIterator>::value_type>) __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, typename iterator_traits<_InputIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); for (; __first != __last; ++__first) if (__pred(*__first)) { *__result = *__first; ++__result; } return __result; } template<typename _InputIterator, typename _Size, typename _OutputIterator> _OutputIterator __copy_n(_InputIterator __first, _Size __n, _OutputIterator __result, input_iterator_tag) { if (__n > 0) { while (true) { *__result = *__first; ++__result; if (--__n > 0) ++__first; else break; } } return __result; } template<typename _RandomAccessIterator, typename _Size, typename _OutputIterator> inline _OutputIterator __copy_n(_RandomAccessIterator __first, _Size __n, _OutputIterator __result, random_access_iterator_tag) { return std::copy(__first, __first + __n, __result); } /** * @brief Copies the range [first,first+n) into [result,result+n). * @ingroup mutating_algorithms * @param __first An input iterator. * @param __n The number of elements to copy. * @param __result An output iterator. * @return result+n. * * This inline function will boil down to a call to @c memmove whenever * possible. Failing that, if random access iterators are passed, then the * loop count will be known (and therefore a candidate for compiler * optimizations such as unrolling). */ template<typename _InputIterator, typename _Size, typename _OutputIterator> inline _OutputIterator copy_n(_InputIterator __first, _Size __n, _OutputIterator __result) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, typename iterator_traits<_InputIterator>::value_type>) return std::__copy_n(__first, __n, __result, std::__iterator_category(__first)); } /** * @brief Copy the elements of a sequence to separate output sequences * depending on the truth value of a predicate. * @ingroup mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __out_true An output iterator. * @param __out_false An output iterator. * @param __pred A predicate. * @return A pair designating the ends of the resulting sequences. * * Copies each element in the range @p [__first,__last) for which * @p __pred returns true to the range beginning at @p out_true * and each element for which @p __pred returns false to @p __out_false. */ template<typename _InputIterator, typename _OutputIterator1, typename _OutputIterator2, typename _Predicate> pair<_OutputIterator1, _OutputIterator2> partition_copy(_InputIterator __first, _InputIterator __last, _OutputIterator1 __out_true, _OutputIterator2 __out_false, _Predicate __pred) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator1, typename iterator_traits<_InputIterator>::value_type>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator2, typename iterator_traits<_InputIterator>::value_type>) __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, typename iterator_traits<_InputIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); for (; __first != __last; ++__first) if (__pred(*__first)) { *__out_true = *__first; ++__out_true; } else { *__out_false = *__first; ++__out_false; } return pair<_OutputIterator1, _OutputIterator2>(__out_true, __out_false); } #endif /** * @brief Remove elements from a sequence. * @ingroup mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __value The value to be removed. * @return An iterator designating the end of the resulting sequence. * * All elements equal to @p __value are removed from the range * @p [__first,__last). * * remove() is stable, so the relative order of elements that are * not removed is unchanged. * * Elements between the end of the resulting sequence and @p __last * are still present, but their value is unspecified. */ template<typename _ForwardIterator, typename _Tp> _ForwardIterator remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { // concept requirements __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< _ForwardIterator>) __glibcxx_function_requires(_EqualOpConcept< typename iterator_traits<_ForwardIterator>::value_type, _Tp>) __glibcxx_requires_valid_range(__first, __last); __first = _GLIBCXX_STD_A::find(__first, __last, __value); if(__first == __last) return __first; _ForwardIterator __result = __first; ++__first; for(; __first != __last; ++__first) if(!(*__first == __value)) { *__result = _GLIBCXX_MOVE(*__first); ++__result; } return __result; } /** * @brief Remove elements from a sequence using a predicate. * @ingroup mutating_algorithms * @param __first A forward iterator. * @param __last A forward iterator. * @param __pred A predicate. * @return An iterator designating the end of the resulting sequence. * * All elements for which @p __pred returns true are removed from the range * @p [__first,__last). * * remove_if() is stable, so the relative order of elements that are * not removed is unchanged. * * Elements between the end of the resulting sequence and @p __last * are still present, but their value is unspecified. */ template<typename _ForwardIterator, typename _Predicate> _ForwardIterator remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) { // concept requirements __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< _ForwardIterator>) __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); __first = _GLIBCXX_STD_A::find_if(__first, __last, __pred); if(__first == __last) return __first; _ForwardIterator __result = __first; ++__first; for(; __first != __last; ++__first) if(!bool(__pred(*__first))) { *__result = _GLIBCXX_MOVE(*__first); ++__result; } return __result; } /** * @brief Remove consecutive duplicate values from a sequence. * @ingroup mutating_algorithms * @param __first A forward iterator. * @param __last A forward iterator. * @return An iterator designating the end of the resulting sequence. * * Removes all but the first element from each group of consecutive * values that compare equal. * unique() is stable, so the relative order of elements that are * not removed is unchanged. * Elements between the end of the resulting sequence and @p __last * are still present, but their value is unspecified. */ template<typename _ForwardIterator> _ForwardIterator unique(_ForwardIterator __first, _ForwardIterator __last) { // concept requirements __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< _ForwardIterator>) __glibcxx_function_requires(_EqualityComparableConcept< typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); // Skip the beginning, if already unique. __first = _GLIBCXX_STD_A::adjacent_find(__first, __last); if (__first == __last) return __last; // Do the real copy work. _ForwardIterator __dest = __first; ++__first; while (++__first != __last) if (!(*__dest == *__first)) *++__dest = _GLIBCXX_MOVE(*__first); return ++__dest; } /** * @brief Remove consecutive values from a sequence using a predicate. * @ingroup mutating_algorithms * @param __first A forward iterator. * @param __last A forward iterator. * @param __binary_pred A binary predicate. * @return An iterator designating the end of the resulting sequence. * * Removes all but the first element from each group of consecutive * values for which @p __binary_pred returns true. * unique() is stable, so the relative order of elements that are * not removed is unchanged. * Elements between the end of the resulting sequence and @p __last * are still present, but their value is unspecified. */ template<typename _ForwardIterator, typename _BinaryPredicate> _ForwardIterator unique(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __binary_pred) { // concept requirements __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< _ForwardIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, typename iterator_traits<_ForwardIterator>::value_type, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); // Skip the beginning, if already unique. __first = _GLIBCXX_STD_A::adjacent_find(__first, __last, __binary_pred); if (__first == __last) return __last; // Do the real copy work. _ForwardIterator __dest = __first; ++__first; while (++__first != __last) if (!bool(__binary_pred(*__dest, *__first))) *++__dest = _GLIBCXX_MOVE(*__first); return ++__dest; } /** * This is an uglified unique_copy(_InputIterator, _InputIterator, * _OutputIterator) * overloaded for forward iterators and output iterator as result. */ template<typename _ForwardIterator, typename _OutputIterator> _OutputIterator __unique_copy(_ForwardIterator __first, _ForwardIterator __last, _OutputIterator __result, forward_iterator_tag, output_iterator_tag) { // concept requirements -- taken care of in dispatching function _ForwardIterator __next = __first; *__result = *__first; while (++__next != __last) if (!(*__first == *__next)) { __first = __next; *++__result = *__first; } return ++__result; } /** * This is an uglified unique_copy(_InputIterator, _InputIterator, * _OutputIterator) * overloaded for input iterators and output iterator as result. */ template<typename _InputIterator, typename _OutputIterator> _OutputIterator __unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, input_iterator_tag, output_iterator_tag) { // concept requirements -- taken care of in dispatching function typename iterator_traits<_InputIterator>::value_type __value = *__first; *__result = __value; while (++__first != __last) if (!(__value == *__first)) { __value = *__first; *++__result = __value; } return ++__result; } /** * This is an uglified unique_copy(_InputIterator, _InputIterator, * _OutputIterator) * overloaded for input iterators and forward iterator as result. */ template<typename _InputIterator, typename _ForwardIterator> _ForwardIterator __unique_copy(_InputIterator __first, _InputIterator __last, _ForwardIterator __result, input_iterator_tag, forward_iterator_tag) { // concept requirements -- taken care of in dispatching function *__result = *__first; while (++__first != __last) if (!(*__result == *__first)) *++__result = *__first; return ++__result; } /** * This is an uglified * unique_copy(_InputIterator, _InputIterator, _OutputIterator, * _BinaryPredicate) * overloaded for forward iterators and output iterator as result. */ template<typename _ForwardIterator, typename _OutputIterator, typename _BinaryPredicate> _OutputIterator __unique_copy(_ForwardIterator __first, _ForwardIterator __last, _OutputIterator __result, _BinaryPredicate __binary_pred, forward_iterator_tag, output_iterator_tag) { // concept requirements -- iterators already checked __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, typename iterator_traits<_ForwardIterator>::value_type, typename iterator_traits<_ForwardIterator>::value_type>) _ForwardIterator __next = __first; *__result = *__first; while (++__next != __last) if (!bool(__binary_pred(*__first, *__next))) { __first = __next; *++__result = *__first; } return ++__result; } /** * This is an uglified * unique_copy(_InputIterator, _InputIterator, _OutputIterator, * _BinaryPredicate) * overloaded for input iterators and output iterator as result. */ template<typename _InputIterator, typename _OutputIterator, typename _BinaryPredicate> _OutputIterator __unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryPredicate __binary_pred, input_iterator_tag, output_iterator_tag) { // concept requirements -- iterators already checked __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, typename iterator_traits<_InputIterator>::value_type, typename iterator_traits<_InputIterator>::value_type>) typename iterator_traits<_InputIterator>::value_type __value = *__first; *__result = __value; while (++__first != __last) if (!bool(__binary_pred(__value, *__first))) { __value = *__first; *++__result = __value; } return ++__result; } /** * This is an uglified * unique_copy(_InputIterator, _InputIterator, _OutputIterator, * _BinaryPredicate) * overloaded for input iterators and forward iterator as result. */ template<typename _InputIterator, typename _ForwardIterator, typename _BinaryPredicate> _ForwardIterator __unique_copy(_InputIterator __first, _InputIterator __last, _ForwardIterator __result, _BinaryPredicate __binary_pred, input_iterator_tag, forward_iterator_tag) { // concept requirements -- iterators already checked __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, typename iterator_traits<_ForwardIterator>::value_type, typename iterator_traits<_InputIterator>::value_type>) *__result = *__first; while (++__first != __last) if (!bool(__binary_pred(*__result, *__first))) *++__result = *__first; return ++__result; } /** * This is an uglified reverse(_BidirectionalIterator, * _BidirectionalIterator) * overloaded for bidirectional iterators. */ template<typename _BidirectionalIterator> void __reverse(_BidirectionalIterator __first, _BidirectionalIterator __last, bidirectional_iterator_tag) { while (true) if (__first == __last || __first == --__last) return; else { std::iter_swap(__first, __last); ++__first; } } /** * This is an uglified reverse(_BidirectionalIterator, * _BidirectionalIterator) * overloaded for random access iterators. */ template<typename _RandomAccessIterator> void __reverse(_RandomAccessIterator __first, _RandomAccessIterator __last, random_access_iterator_tag) { if (__first == __last) return; --__last; while (__first < __last) { std::iter_swap(__first, __last); ++__first; --__last; } } /** * @brief Reverse a sequence. * @ingroup mutating_algorithms * @param __first A bidirectional iterator. * @param __last A bidirectional iterator. * @return reverse() returns no value. * * Reverses the order of the elements in the range @p [__first,__last), * so that the first element becomes the last etc. * For every @c i such that @p 0<=i<=(__last-__first)/2), @p reverse() * swaps @p *(__first+i) and @p *(__last-(i+1)) */ template<typename _BidirectionalIterator> inline void reverse(_BidirectionalIterator __first, _BidirectionalIterator __last) { // concept requirements __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept< _BidirectionalIterator>) __glibcxx_requires_valid_range(__first, __last); std::__reverse(__first, __last, std::__iterator_category(__first)); } /** * @brief Copy a sequence, reversing its elements. * @ingroup mutating_algorithms * @param __first A bidirectional iterator. * @param __last A bidirectional iterator. * @param __result An output iterator. * @return An iterator designating the end of the resulting sequence. * * Copies the elements in the range @p [__first,__last) to the * range @p [__result,__result+(__last-__first)) such that the * order of the elements is reversed. For every @c i such that @p * 0<=i<=(__last-__first), @p reverse_copy() performs the * assignment @p *(__result+(__last-__first)-1-i) = *(__first+i). * The ranges @p [__first,__last) and @p * [__result,__result+(__last-__first)) must not overlap. */ template<typename _BidirectionalIterator, typename _OutputIterator> _OutputIterator reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result) { // concept requirements __glibcxx_function_requires(_BidirectionalIteratorConcept< _BidirectionalIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, typename iterator_traits<_BidirectionalIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); while (__first != __last) { --__last; *__result = *__last; ++__result; } return __result; } /** * This is a helper function for the rotate algorithm specialized on RAIs. * It returns the greatest common divisor of two integer values. */ template<typename _EuclideanRingElement> _EuclideanRingElement __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n) { while (__n != 0) { _EuclideanRingElement __t = __m % __n; __m = __n; __n = __t; } return __m; } /// This is a helper function for the rotate algorithm. template<typename _ForwardIterator> void __rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, forward_iterator_tag) { if (__first == __middle || __last == __middle) return; _ForwardIterator __first2 = __middle; do { std::iter_swap(__first, __first2); ++__first; ++__first2; if (__first == __middle) __middle = __first2; } while (__first2 != __last); __first2 = __middle; while (__first2 != __last) { std::iter_swap(__first, __first2); ++__first; ++__first2; if (__first == __middle) __middle = __first2; else if (__first2 == __last) __first2 = __middle; } } /// This is a helper function for the rotate algorithm. template<typename _BidirectionalIterator> void __rotate(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, bidirectional_iterator_tag) { // concept requirements __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept< _BidirectionalIterator>) if (__first == __middle || __last == __middle) return; std::__reverse(__first, __middle, bidirectional_iterator_tag()); std::__reverse(__middle, __last, bidirectional_iterator_tag()); while (__first != __middle && __middle != __last) { std::iter_swap(__first, --__last); ++__first; } if (__first == __middle) std::__reverse(__middle, __last, bidirectional_iterator_tag()); else std::__reverse(__first, __middle, bidirectional_iterator_tag()); } /// This is a helper function for the rotate algorithm. template<typename _RandomAccessIterator> void __rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, random_access_iterator_tag) { // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) if (__first == __middle || __last == __middle) return; typedef typename iterator_traits<_RandomAccessIterator>::difference_type _Distance; typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; _Distance __n = __last - __first; _Distance __k = __middle - __first; if (__k == __n - __k) { std::swap_ranges(__first, __middle, __middle); return; } _RandomAccessIterator __p = __first; for (;;) { if (__k < __n - __k) { if (__is_pod(_ValueType) && __k == 1) { _ValueType __t = _GLIBCXX_MOVE(*__p); _GLIBCXX_MOVE3(__p + 1, __p + __n, __p); *(__p + __n - 1) = _GLIBCXX_MOVE(__t); return; } _RandomAccessIterator __q = __p + __k; for (_Distance __i = 0; __i < __n - __k; ++ __i) { std::iter_swap(__p, __q); ++__p; ++__q; } __n %= __k; if (__n == 0) return; std::swap(__n, __k); __k = __n - __k; } else { __k = __n - __k; if (__is_pod(_ValueType) && __k == 1) { _ValueType __t = _GLIBCXX_MOVE(*(__p + __n - 1)); _GLIBCXX_MOVE_BACKWARD3(__p, __p + __n - 1, __p + __n); *__p = _GLIBCXX_MOVE(__t); return; } _RandomAccessIterator __q = __p + __n; __p = __q - __k; for (_Distance __i = 0; __i < __n - __k; ++ __i) { --__p; --__q; std::iter_swap(__p, __q); } __n %= __k; if (__n == 0) return; std::swap(__n, __k); } } } /** * @brief Rotate the elements of a sequence. * @ingroup mutating_algorithms * @param __first A forward iterator. * @param __middle A forward iterator. * @param __last A forward iterator. * @return Nothing. * * Rotates the elements of the range @p [__first,__last) by * @p (__middle - __first) positions so that the element at @p __middle * is moved to @p __first, the element at @p __middle+1 is moved to * @p __first+1 and so on for each element in the range * @p [__first,__last). * * This effectively swaps the ranges @p [__first,__middle) and * @p [__middle,__last). * * Performs * @p *(__first+(n+(__last-__middle))%(__last-__first))=*(__first+n) * for each @p n in the range @p [0,__last-__first). */ template<typename _ForwardIterator> inline void rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last) { // concept requirements __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< _ForwardIterator>) __glibcxx_requires_valid_range(__first, __middle); __glibcxx_requires_valid_range(__middle, __last); typedef typename iterator_traits<_ForwardIterator>::iterator_category _IterType; std::__rotate(__first, __middle, __last, _IterType()); } /** * @brief Copy a sequence, rotating its elements. * @ingroup mutating_algorithms * @param __first A forward iterator. * @param __middle A forward iterator. * @param __last A forward iterator. * @param __result An output iterator. * @return An iterator designating the end of the resulting sequence. * * Copies the elements of the range @p [__first,__last) to the * range beginning at @result, rotating the copied elements by * @p (__middle-__first) positions so that the element at @p __middle * is moved to @p __result, the element at @p __middle+1 is moved * to @p __result+1 and so on for each element in the range @p * [__first,__last). * * Performs * @p *(__result+(n+(__last-__middle))%(__last-__first))=*(__first+n) * for each @p n in the range @p [0,__last-__first). */ template<typename _ForwardIterator, typename _OutputIterator> _OutputIterator rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, _OutputIterator __result) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __middle); __glibcxx_requires_valid_range(__middle, __last); return std::copy(__first, __middle, std::copy(__middle, __last, __result)); } /// This is a helper function... template<typename _ForwardIterator, typename _Predicate> _ForwardIterator __partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, forward_iterator_tag) { if (__first == __last) return __first; while (__pred(*__first)) if (++__first == __last) return __first; _ForwardIterator __next = __first; while (++__next != __last) if (__pred(*__next)) { std::iter_swap(__first, __next); ++__first; } return __first; } /// This is a helper function... template<typename _BidirectionalIterator, typename _Predicate> _BidirectionalIterator __partition(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred, bidirectional_iterator_tag) { while (true) { while (true) if (__first == __last) return __first; else if (__pred(*__first)) ++__first; else break; --__last; while (true) if (__first == __last) return __first; else if (!bool(__pred(*__last))) --__last; else break; std::iter_swap(__first, __last); ++__first; } } // partition /// This is a helper function... /// Requires __len != 0 and !__pred(*__first), /// same as __stable_partition_adaptive. template<typename _ForwardIterator, typename _Predicate, typename _Distance> _ForwardIterator __inplace_stable_partition(_ForwardIterator __first, _Predicate __pred, _Distance __len) { if (__len == 1) return __first; _ForwardIterator __middle = __first; std::advance(__middle, __len / 2); _ForwardIterator __left_split = std::__inplace_stable_partition(__first, __pred, __len / 2); // Advance past true-predicate values to satisfy this // function's preconditions. _Distance __right_len = __len - __len / 2; _ForwardIterator __right_split = std::__find_if_not_n(__middle, __right_len, __pred); if (__right_len) __right_split = std::__inplace_stable_partition(__middle, __pred, __right_len); std::rotate(__left_split, __middle, __right_split); std::advance(__left_split, std::distance(__middle, __right_split)); return __left_split; } /// This is a helper function... /// Requires __first != __last and !__pred(*__first) /// and __len == distance(__first, __last). /// /// !__pred(*__first) allows us to guarantee that we don't /// move-assign an element onto itself. template<typename _ForwardIterator, typename _Pointer, typename _Predicate, typename _Distance> _ForwardIterator __stable_partition_adaptive(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, _Distance __len, _Pointer __buffer, _Distance __buffer_size) { if (__len <= __buffer_size) { _ForwardIterator __result1 = __first; _Pointer __result2 = __buffer; // The precondition guarantees that !__pred(*__first), so // move that element to the buffer before starting the loop. // This ensures that we only call __pred once per element. *__result2 = _GLIBCXX_MOVE(*__first); ++__result2; ++__first; for (; __first != __last; ++__first) if (__pred(*__first)) { *__result1 = _GLIBCXX_MOVE(*__first); ++__result1; } else { *__result2 = _GLIBCXX_MOVE(*__first); ++__result2; } _GLIBCXX_MOVE3(__buffer, __result2, __result1); return __result1; } else { _ForwardIterator __middle = __first; std::advance(__middle, __len / 2); _ForwardIterator __left_split = std::__stable_partition_adaptive(__first, __middle, __pred, __len / 2, __buffer, __buffer_size); // Advance past true-predicate values to satisfy this // function's preconditions. _Distance __right_len = __len - __len / 2; _ForwardIterator __right_split = std::__find_if_not_n(__middle, __right_len, __pred); if (__right_len) __right_split = std::__stable_partition_adaptive(__right_split, __last, __pred, __right_len, __buffer, __buffer_size); std::rotate(__left_split, __middle, __right_split); std::advance(__left_split, std::distance(__middle, __right_split)); return __left_split; } } /** * @brief Move elements for which a predicate is true to the beginning * of a sequence, preserving relative ordering. * @ingroup mutating_algorithms * @param __first A forward iterator. * @param __last A forward iterator. * @param __pred A predicate functor. * @return An iterator @p middle such that @p __pred(i) is true for each * iterator @p i in the range @p [first,middle) and false for each @p i * in the range @p [middle,last). * * Performs the same function as @p partition() with the additional * guarantee that the relative ordering of elements in each group is * preserved, so any two elements @p x and @p y in the range * @p [__first,__last) such that @p __pred(x)==__pred(y) will have the same * relative ordering after calling @p stable_partition(). */ template<typename _ForwardIterator, typename _Predicate> _ForwardIterator stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) { // concept requirements __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< _ForwardIterator>) __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); __first = std::__find_if_not(__first, __last, __pred); if (__first == __last) return __first; else { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; typedef typename iterator_traits<_ForwardIterator>::difference_type _DistanceType; _Temporary_buffer<_ForwardIterator, _ValueType> __buf(__first, __last); if (__buf.size() > 0) return std::__stable_partition_adaptive(__first, __last, __pred, _DistanceType(__buf.requested_size()), __buf.begin(), _DistanceType(__buf.size())); else return std::__inplace_stable_partition(__first, __pred, _DistanceType(__buf.requested_size())); } } /// This is a helper function for the sort routines. template<typename _RandomAccessIterator> void __heap_select(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last) { std::make_heap(__first, __middle); for (_RandomAccessIterator __i = __middle; __i < __last; ++__i) if (*__i < *__first) std::__pop_heap(__first, __middle, __i); } /// This is a helper function for the sort routines. template<typename _RandomAccessIterator, typename _Compare> void __heap_select(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, _Compare __comp) { std::make_heap(__first, __middle, __comp); for (_RandomAccessIterator __i = __middle; __i < __last; ++__i) if (__comp(*__i, *__first)) std::__pop_heap(__first, __middle, __i, __comp); } // partial_sort /** * @brief Copy the smallest elements of a sequence. * @ingroup sorting_algorithms * @param __first An iterator. * @param __last Another iterator. * @param __result_first A random-access iterator. * @param __result_last Another random-access iterator. * @return An iterator indicating the end of the resulting sequence. * * Copies and sorts the smallest N values from the range @p [__first,__last) * to the range beginning at @p __result_first, where the number of * elements to be copied, @p N, is the smaller of @p (__last-__first) and * @p (__result_last-__result_first). * After the sort if @e i and @e j are iterators in the range * @p [__result_first,__result_first+N) such that i precedes j then * *j<*i is false. * The value returned is @p __result_first+N. */ template<typename _InputIterator, typename _RandomAccessIterator> _RandomAccessIterator partial_sort_copy(_InputIterator __first, _InputIterator __last, _RandomAccessIterator __result_first, _RandomAccessIterator __result_last) { typedef typename iterator_traits<_InputIterator>::value_type _InputValueType; typedef typename iterator_traits<_RandomAccessIterator>::value_type _OutputValueType; typedef typename iterator_traits<_RandomAccessIterator>::difference_type _DistanceType; // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_ConvertibleConcept<_InputValueType, _OutputValueType>) __glibcxx_function_requires(_LessThanOpConcept<_InputValueType, _OutputValueType>) __glibcxx_function_requires(_LessThanComparableConcept<_OutputValueType>) __glibcxx_requires_valid_range(__first, __last); __glibcxx_requires_valid_range(__result_first, __result_last); if (__result_first == __result_last) return __result_last; _RandomAccessIterator __result_real_last = __result_first; while(__first != __last && __result_real_last != __result_last) { *__result_real_last = *__first; ++__result_real_last; ++__first; } std::make_heap(__result_first, __result_real_last); while (__first != __last) { if (*__first < *__result_first) std::__adjust_heap(__result_first, _DistanceType(0), _DistanceType(__result_real_last - __result_first), _InputValueType(*__first)); ++__first; } std::sort_heap(__result_first, __result_real_last); return __result_real_last; } /** * @brief Copy the smallest elements of a sequence using a predicate for * comparison. * @ingroup sorting_algorithms * @param __first An input iterator. * @param __last Another input iterator. * @param __result_first A random-access iterator. * @param __result_last Another random-access iterator. * @param __comp A comparison functor. * @return An iterator indicating the end of the resulting sequence. * * Copies and sorts the smallest N values from the range @p [__first,__last) * to the range beginning at @p result_first, where the number of * elements to be copied, @p N, is the smaller of @p (__last-__first) and * @p (__result_last-__result_first). * After the sort if @e i and @e j are iterators in the range * @p [__result_first,__result_first+N) such that i precedes j then * @p __comp(*j,*i) is false. * The value returned is @p __result_first+N. */ template<typename _InputIterator, typename _RandomAccessIterator, typename _Compare> _RandomAccessIterator partial_sort_copy(_InputIterator __first, _InputIterator __last, _RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp) { typedef typename iterator_traits<_InputIterator>::value_type _InputValueType; typedef typename iterator_traits<_RandomAccessIterator>::value_type _OutputValueType; typedef typename iterator_traits<_RandomAccessIterator>::difference_type _DistanceType; // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_function_requires(_ConvertibleConcept<_InputValueType, _OutputValueType>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _InputValueType, _OutputValueType>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _OutputValueType, _OutputValueType>) __glibcxx_requires_valid_range(__first, __last); __glibcxx_requires_valid_range(__result_first, __result_last); if (__result_first == __result_last) return __result_last; _RandomAccessIterator __result_real_last = __result_first; while(__first != __last && __result_real_last != __result_last) { *__result_real_last = *__first; ++__result_real_last; ++__first; } std::make_heap(__result_first, __result_real_last, __comp); while (__first != __last) { if (__comp(*__first, *__result_first)) std::__adjust_heap(__result_first, _DistanceType(0), _DistanceType(__result_real_last - __result_first), _InputValueType(*__first), __comp); ++__first; } std::sort_heap(__result_first, __result_real_last, __comp); return __result_real_last; } /// This is a helper function for the sort routine. template<typename _RandomAccessIterator> void __unguarded_linear_insert(_RandomAccessIterator __last) { typename iterator_traits<_RandomAccessIterator>::value_type __val = _GLIBCXX_MOVE(*__last); _RandomAccessIterator __next = __last; --__next; while (__val < *__next) { *__last = _GLIBCXX_MOVE(*__next); __last = __next; --__next; } *__last = _GLIBCXX_MOVE(__val); } /// This is a helper function for the sort routine. template<typename _RandomAccessIterator, typename _Compare> void __unguarded_linear_insert(_RandomAccessIterator __last, _Compare __comp) { typename iterator_traits<_RandomAccessIterator>::value_type __val = _GLIBCXX_MOVE(*__last); _RandomAccessIterator __next = __last; --__next; while (__comp(__val, *__next)) { *__last = _GLIBCXX_MOVE(*__next); __last = __next; --__next; } *__last = _GLIBCXX_MOVE(__val); } /// This is a helper function for the sort routine. template<typename _RandomAccessIterator> void __insertion_sort(_RandomAccessIterator __first, _RandomAccessIterator __last) { if (__first == __last) return; for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) { if (*__i < *__first) { typename iterator_traits<_RandomAccessIterator>::value_type __val = _GLIBCXX_MOVE(*__i); _GLIBCXX_MOVE_BACKWARD3(__first, __i, __i + 1); *__first = _GLIBCXX_MOVE(__val); } else std::__unguarded_linear_insert(__i); } } /// This is a helper function for the sort routine. template<typename _RandomAccessIterator, typename _Compare> void __insertion_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { if (__first == __last) return; for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) { if (__comp(*__i, *__first)) { typename iterator_traits<_RandomAccessIterator>::value_type __val = _GLIBCXX_MOVE(*__i); _GLIBCXX_MOVE_BACKWARD3(__first, __i, __i + 1); *__first = _GLIBCXX_MOVE(__val); } else std::__unguarded_linear_insert(__i, __comp); } } /// This is a helper function for the sort routine. template<typename _RandomAccessIterator> inline void __unguarded_insertion_sort(_RandomAccessIterator __first, _RandomAccessIterator __last) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; for (_RandomAccessIterator __i = __first; __i != __last; ++__i) std::__unguarded_linear_insert(__i); } /// This is a helper function for the sort routine. template<typename _RandomAccessIterator, typename _Compare> inline void __unguarded_insertion_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; for (_RandomAccessIterator __i = __first; __i != __last; ++__i) std::__unguarded_linear_insert(__i, __comp); } /** * @doctodo * This controls some aspect of the sort routines. */ enum { _S_threshold = 16 }; /// This is a helper function for the sort routine. template<typename _RandomAccessIterator> void __final_insertion_sort(_RandomAccessIterator __first, _RandomAccessIterator __last) { if (__last - __first > int(_S_threshold)) { std::__insertion_sort(__first, __first + int(_S_threshold)); std::__unguarded_insertion_sort(__first + int(_S_threshold), __last); } else std::__insertion_sort(__first, __last); } /// This is a helper function for the sort routine. template<typename _RandomAccessIterator, typename _Compare> void __final_insertion_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { if (__last - __first > int(_S_threshold)) { std::__insertion_sort(__first, __first + int(_S_threshold), __comp); std::__unguarded_insertion_sort(__first + int(_S_threshold), __last, __comp); } else std::__insertion_sort(__first, __last, __comp); } /// This is a helper function... template<typename _RandomAccessIterator, typename _Tp> _RandomAccessIterator __unguarded_partition(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __pivot) { while (true) { while (*__first < __pivot) ++__first; --__last; while (__pivot < *__last) --__last; if (!(__first < __last)) return __first; std::iter_swap(__first, __last); ++__first; } } /// This is a helper function... template<typename _RandomAccessIterator, typename _Tp, typename _Compare> _RandomAccessIterator __unguarded_partition(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __pivot, _Compare __comp) { while (true) { while (__comp(*__first, __pivot)) ++__first; --__last; while (__comp(__pivot, *__last)) --__last; if (!(__first < __last)) return __first; std::iter_swap(__first, __last); ++__first; } } /// This is a helper function... template<typename _RandomAccessIterator> inline _RandomAccessIterator __unguarded_partition_pivot(_RandomAccessIterator __first, _RandomAccessIterator __last) { _RandomAccessIterator __mid = __first + (__last - __first) / 2; std::__move_median_to_first(__first, __first + 1, __mid, __last - 1); return std::__unguarded_partition(__first + 1, __last, *__first); } /// This is a helper function... template<typename _RandomAccessIterator, typename _Compare> inline _RandomAccessIterator __unguarded_partition_pivot(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { _RandomAccessIterator __mid = __first + (__last - __first) / 2; std::__move_median_to_first(__first, __first + 1, __mid, __last - 1, __comp); return std::__unguarded_partition(__first + 1, __last, *__first, __comp); } /// This is a helper function for the sort routine. template<typename _RandomAccessIterator, typename _Size> void __introsort_loop(_RandomAccessIterator __first, _RandomAccessIterator __last, _Size __depth_limit) { while (__last - __first > int(_S_threshold)) { if (__depth_limit == 0) { _GLIBCXX_STD_A::partial_sort(__first, __last, __last); return; } --__depth_limit; _RandomAccessIterator __cut = std::__unguarded_partition_pivot(__first, __last); std::__introsort_loop(__cut, __last, __depth_limit); __last = __cut; } } /// This is a helper function for the sort routine. template<typename _RandomAccessIterator, typename _Size, typename _Compare> void __introsort_loop(_RandomAccessIterator __first, _RandomAccessIterator __last, _Size __depth_limit, _Compare __comp) { while (__last - __first > int(_S_threshold)) { if (__depth_limit == 0) { _GLIBCXX_STD_A::partial_sort(__first, __last, __last, __comp); return; } --__depth_limit; _RandomAccessIterator __cut = std::__unguarded_partition_pivot(__first, __last, __comp); std::__introsort_loop(__cut, __last, __depth_limit, __comp); __last = __cut; } } // sort template<typename _RandomAccessIterator, typename _Size> void __introselect(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Size __depth_limit) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; while (__last - __first > 3) { if (__depth_limit == 0) { std::__heap_select(__first, __nth + 1, __last); // Place the nth largest element in its final position. std::iter_swap(__first, __nth); return; } --__depth_limit; _RandomAccessIterator __cut = std::__unguarded_partition_pivot(__first, __last); if (__cut <= __nth) __first = __cut; else __last = __cut; } std::__insertion_sort(__first, __last); } template<typename _RandomAccessIterator, typename _Size, typename _Compare> void __introselect(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Size __depth_limit, _Compare __comp) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; while (__last - __first > 3) { if (__depth_limit == 0) { std::__heap_select(__first, __nth + 1, __last, __comp); // Place the nth largest element in its final position. std::iter_swap(__first, __nth); return; } --__depth_limit; _RandomAccessIterator __cut = std::__unguarded_partition_pivot(__first, __last, __comp); if (__cut <= __nth) __first = __cut; else __last = __cut; } std::__insertion_sort(__first, __last, __comp); } // nth_element // lower_bound moved to stl_algobase.h /** * @brief Finds the first position in which @p __val could be inserted * without changing the ordering. * @ingroup binary_search_algorithms * @param __first An iterator. * @param __last Another iterator. * @param __val The search term. * @param __comp A functor to use for comparisons. * @return An iterator pointing to the first element <em>not less * than</em> @p __val, or end() if every element is less * than @p __val. * @ingroup binary_search_algorithms * * The comparison function should have the same effects on ordering as * the function used for the initial sort. */ template<typename _ForwardIterator, typename _Tp, typename _Compare> _ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __val, _Compare __comp) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; typedef typename iterator_traits<_ForwardIterator>::difference_type _DistanceType; // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType, _Tp>) __glibcxx_requires_partitioned_lower_pred(__first, __last, __val, __comp); _DistanceType __len = std::distance(__first, __last); while (__len > 0) { _DistanceType __half = __len >> 1; _ForwardIterator __middle = __first; std::advance(__middle, __half); if (__comp(*__middle, __val)) { __first = __middle; ++__first; __len = __len - __half - 1; } else __len = __half; } return __first; } /** * @brief Finds the last position in which @p __val could be inserted * without changing the ordering. * @ingroup binary_search_algorithms * @param __first An iterator. * @param __last Another iterator. * @param __val The search term. * @return An iterator pointing to the first element greater than @p __val, * or end() if no elements are greater than @p __val. * @ingroup binary_search_algorithms */ template<typename _ForwardIterator, typename _Tp> _ForwardIterator upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __val) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; typedef typename iterator_traits<_ForwardIterator>::difference_type _DistanceType; // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>) __glibcxx_requires_partitioned_upper(__first, __last, __val); _DistanceType __len = std::distance(__first, __last); while (__len > 0) { _DistanceType __half = __len >> 1; _ForwardIterator __middle = __first; std::advance(__middle, __half); if (__val < *__middle) __len = __half; else { __first = __middle; ++__first; __len = __len - __half - 1; } } return __first; } /** * @brief Finds the last position in which @p __val could be inserted * without changing the ordering. * @ingroup binary_search_algorithms * @param __first An iterator. * @param __last Another iterator. * @param __val The search term. * @param __comp A functor to use for comparisons. * @return An iterator pointing to the first element greater than @p __val, * or end() if no elements are greater than @p __val. * @ingroup binary_search_algorithms * * The comparison function should have the same effects on ordering as * the function used for the initial sort. */ template<typename _ForwardIterator, typename _Tp, typename _Compare> _ForwardIterator upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __val, _Compare __comp) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; typedef typename iterator_traits<_ForwardIterator>::difference_type _DistanceType; // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _Tp, _ValueType>) __glibcxx_requires_partitioned_upper_pred(__first, __last, __val, __comp); _DistanceType __len = std::distance(__first, __last); while (__len > 0) { _DistanceType __half = __len >> 1; _ForwardIterator __middle = __first; std::advance(__middle, __half); if (__comp(__val, *__middle)) __len = __half; else { __first = __middle; ++__first; __len = __len - __half - 1; } } return __first; } /** * @brief Finds the largest subrange in which @p __val could be inserted * at any place in it without changing the ordering. * @ingroup binary_search_algorithms * @param __first An iterator. * @param __last Another iterator. * @param __val The search term. * @return An pair of iterators defining the subrange. * @ingroup binary_search_algorithms * * This is equivalent to * @code * std::make_pair(lower_bound(__first, __last, __val), * upper_bound(__first, __last, __val)) * @endcode * but does not actually call those functions. */ template<typename _ForwardIterator, typename _Tp> pair<_ForwardIterator, _ForwardIterator> equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __val) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; typedef typename iterator_traits<_ForwardIterator>::difference_type _DistanceType; // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_LessThanOpConcept<_ValueType, _Tp>) __glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>) __glibcxx_requires_partitioned_lower(__first, __last, __val); __glibcxx_requires_partitioned_upper(__first, __last, __val); _DistanceType __len = std::distance(__first, __last); while (__len > 0) { _DistanceType __half = __len >> 1; _ForwardIterator __middle = __first; std::advance(__middle, __half); if (*__middle < __val) { __first = __middle; ++__first; __len = __len - __half - 1; } else if (__val < *__middle) __len = __half; else { _ForwardIterator __left = std::lower_bound(__first, __middle, __val); std::advance(__first, __len); _ForwardIterator __right = std::upper_bound(++__middle, __first, __val); return pair<_ForwardIterator, _ForwardIterator>(__left, __right); } } return pair<_ForwardIterator, _ForwardIterator>(__first, __first); } /** * @brief Finds the largest subrange in which @p __val could be inserted * at any place in it without changing the ordering. * @param __first An iterator. * @param __last Another iterator. * @param __val The search term. * @param __comp A functor to use for comparisons. * @return An pair of iterators defining the subrange. * @ingroup binary_search_algorithms * * This is equivalent to * @code * std::make_pair(lower_bound(__first, __last, __val, __comp), * upper_bound(__first, __last, __val, __comp)) * @endcode * but does not actually call those functions. */ template<typename _ForwardIterator, typename _Tp, typename _Compare> pair<_ForwardIterator, _ForwardIterator> equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __val, _Compare __comp) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; typedef typename iterator_traits<_ForwardIterator>::difference_type _DistanceType; // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType, _Tp>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _Tp, _ValueType>) __glibcxx_requires_partitioned_lower_pred(__first, __last, __val, __comp); __glibcxx_requires_partitioned_upper_pred(__first, __last, __val, __comp); _DistanceType __len = std::distance(__first, __last); while (__len > 0) { _DistanceType __half = __len >> 1; _ForwardIterator __middle = __first; std::advance(__middle, __half); if (__comp(*__middle, __val)) { __first = __middle; ++__first; __len = __len - __half - 1; } else if (__comp(__val, *__middle)) __len = __half; else { _ForwardIterator __left = std::lower_bound(__first, __middle, __val, __comp); std::advance(__first, __len); _ForwardIterator __right = std::upper_bound(++__middle, __first, __val, __comp); return pair<_ForwardIterator, _ForwardIterator>(__left, __right); } } return pair<_ForwardIterator, _ForwardIterator>(__first, __first); } /** * @brief Determines whether an element exists in a range. * @ingroup binary_search_algorithms * @param __first An iterator. * @param __last Another iterator. * @param __val The search term. * @return True if @p __val (or its equivalent) is in [@p * __first,@p __last ]. * * Note that this does not actually return an iterator to @p __val. For * that, use std::find or a container's specialized find member functions. */ template<typename _ForwardIterator, typename _Tp> bool binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __val) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>) __glibcxx_requires_partitioned_lower(__first, __last, __val); __glibcxx_requires_partitioned_upper(__first, __last, __val); _ForwardIterator __i = std::lower_bound(__first, __last, __val); return __i != __last && !(__val < *__i); } /** * @brief Determines whether an element exists in a range. * @ingroup binary_search_algorithms * @param __first An iterator. * @param __last Another iterator. * @param __val The search term. * @param __comp A functor to use for comparisons. * @return True if @p __val (or its equivalent) is in @p [__first,__last]. * * Note that this does not actually return an iterator to @p __val. For * that, use std::find or a container's specialized find member functions. * * The comparison function should have the same effects on ordering as * the function used for the initial sort. */ template<typename _ForwardIterator, typename _Tp, typename _Compare> bool binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __val, _Compare __comp) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _Tp, _ValueType>) __glibcxx_requires_partitioned_lower_pred(__first, __last, __val, __comp); __glibcxx_requires_partitioned_upper_pred(__first, __last, __val, __comp); _ForwardIterator __i = std::lower_bound(__first, __last, __val, __comp); return __i != __last && !bool(__comp(__val, *__i)); } // merge /// This is a helper function for the __merge_adaptive routines. template<typename _InputIterator1, typename _InputIterator2, typename _OutputIterator> void __move_merge_adaptive(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) { while (__first1 != __last1 && __first2 != __last2) { if (*__first2 < *__first1) { *__result = _GLIBCXX_MOVE(*__first2); ++__first2; } else { *__result = _GLIBCXX_MOVE(*__first1); ++__first1; } ++__result; } if (__first1 != __last1) _GLIBCXX_MOVE3(__first1, __last1, __result); } /// This is a helper function for the __merge_adaptive routines. template<typename _InputIterator1, typename _InputIterator2, typename _OutputIterator, typename _Compare> void __move_merge_adaptive(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) { while (__first1 != __last1 && __first2 != __last2) { if (__comp(*__first2, *__first1)) { *__result = _GLIBCXX_MOVE(*__first2); ++__first2; } else { *__result = _GLIBCXX_MOVE(*__first1); ++__first1; } ++__result; } if (__first1 != __last1) _GLIBCXX_MOVE3(__first1, __last1, __result); } /// This is a helper function for the __merge_adaptive routines. template<typename _BidirectionalIterator1, typename _BidirectionalIterator2, typename _BidirectionalIterator3> void __move_merge_adaptive_backward(_BidirectionalIterator1 __first1, _BidirectionalIterator1 __last1, _BidirectionalIterator2 __first2, _BidirectionalIterator2 __last2, _BidirectionalIterator3 __result) { if (__first1 == __last1) { _GLIBCXX_MOVE_BACKWARD3(__first2, __last2, __result); return; } else if (__first2 == __last2) return; --__last1; --__last2; while (true) { if (*__last2 < *__last1) { *--__result = _GLIBCXX_MOVE(*__last1); if (__first1 == __last1) { _GLIBCXX_MOVE_BACKWARD3(__first2, ++__last2, __result); return; } --__last1; } else { *--__result = _GLIBCXX_MOVE(*__last2); if (__first2 == __last2) return; --__last2; } } } /// This is a helper function for the __merge_adaptive routines. template<typename _BidirectionalIterator1, typename _BidirectionalIterator2, typename _BidirectionalIterator3, typename _Compare> void __move_merge_adaptive_backward(_BidirectionalIterator1 __first1, _BidirectionalIterator1 __last1, _BidirectionalIterator2 __first2, _BidirectionalIterator2 __last2, _BidirectionalIterator3 __result, _Compare __comp) { if (__first1 == __last1) { _GLIBCXX_MOVE_BACKWARD3(__first2, __last2, __result); return; } else if (__first2 == __last2) return; --__last1; --__last2; while (true) { if (__comp(*__last2, *__last1)) { *--__result = _GLIBCXX_MOVE(*__last1); if (__first1 == __last1) { _GLIBCXX_MOVE_BACKWARD3(__first2, ++__last2, __result); return; } --__last1; } else { *--__result = _GLIBCXX_MOVE(*__last2); if (__first2 == __last2) return; --__last2; } } } /// This is a helper function for the merge routines. template<typename _BidirectionalIterator1, typename _BidirectionalIterator2, typename _Distance> _BidirectionalIterator1 __rotate_adaptive(_BidirectionalIterator1 __first, _BidirectionalIterator1 __middle, _BidirectionalIterator1 __last, _Distance __len1, _Distance __len2, _BidirectionalIterator2 __buffer, _Distance __buffer_size) { _BidirectionalIterator2 __buffer_end; if (__len1 > __len2 && __len2 <= __buffer_size) { if (__len2) { __buffer_end = _GLIBCXX_MOVE3(__middle, __last, __buffer); _GLIBCXX_MOVE_BACKWARD3(__first, __middle, __last); return _GLIBCXX_MOVE3(__buffer, __buffer_end, __first); } else return __first; } else if (__len1 <= __buffer_size) { if (__len1) { __buffer_end = _GLIBCXX_MOVE3(__first, __middle, __buffer); _GLIBCXX_MOVE3(__middle, __last, __first); return _GLIBCXX_MOVE_BACKWARD3(__buffer, __buffer_end, __last); } else return __last; } else { std::rotate(__first, __middle, __last); std::advance(__first, std::distance(__middle, __last)); return __first; } } /// This is a helper function for the merge routines. template<typename _BidirectionalIterator, typename _Distance, typename _Pointer> void __merge_adaptive(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, _Distance __len1, _Distance __len2, _Pointer __buffer, _Distance __buffer_size) { if (__len1 <= __len2 && __len1 <= __buffer_size) { _Pointer __buffer_end = _GLIBCXX_MOVE3(__first, __middle, __buffer); std::__move_merge_adaptive(__buffer, __buffer_end, __middle, __last, __first); } else if (__len2 <= __buffer_size) { _Pointer __buffer_end = _GLIBCXX_MOVE3(__middle, __last, __buffer); std::__move_merge_adaptive_backward(__first, __middle, __buffer, __buffer_end, __last); } else { _BidirectionalIterator __first_cut = __first; _BidirectionalIterator __second_cut = __middle; _Distance __len11 = 0; _Distance __len22 = 0; if (__len1 > __len2) { __len11 = __len1 / 2; std::advance(__first_cut, __len11); __second_cut = std::lower_bound(__middle, __last, *__first_cut); __len22 = std::distance(__middle, __second_cut); } else { __len22 = __len2 / 2; std::advance(__second_cut, __len22); __first_cut = std::upper_bound(__first, __middle, *__second_cut); __len11 = std::distance(__first, __first_cut); } _BidirectionalIterator __new_middle = std::__rotate_adaptive(__first_cut, __middle, __second_cut, __len1 - __len11, __len22, __buffer, __buffer_size); std::__merge_adaptive(__first, __first_cut, __new_middle, __len11, __len22, __buffer, __buffer_size); std::__merge_adaptive(__new_middle, __second_cut, __last, __len1 - __len11, __len2 - __len22, __buffer, __buffer_size); } } /// This is a helper function for the merge routines. template<typename _BidirectionalIterator, typename _Distance, typename _Pointer, typename _Compare> void __merge_adaptive(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, _Distance __len1, _Distance __len2, _Pointer __buffer, _Distance __buffer_size, _Compare __comp) { if (__len1 <= __len2 && __len1 <= __buffer_size) { _Pointer __buffer_end = _GLIBCXX_MOVE3(__first, __middle, __buffer); std::__move_merge_adaptive(__buffer, __buffer_end, __middle, __last, __first, __comp); } else if (__len2 <= __buffer_size) { _Pointer __buffer_end = _GLIBCXX_MOVE3(__middle, __last, __buffer); std::__move_merge_adaptive_backward(__first, __middle, __buffer, __buffer_end, __last, __comp); } else { _BidirectionalIterator __first_cut = __first; _BidirectionalIterator __second_cut = __middle; _Distance __len11 = 0; _Distance __len22 = 0; if (__len1 > __len2) { __len11 = __len1 / 2; std::advance(__first_cut, __len11); __second_cut = std::lower_bound(__middle, __last, *__first_cut, __comp); __len22 = std::distance(__middle, __second_cut); } else { __len22 = __len2 / 2; std::advance(__second_cut, __len22); __first_cut = std::upper_bound(__first, __middle, *__second_cut, __comp); __len11 = std::distance(__first, __first_cut); } _BidirectionalIterator __new_middle = std::__rotate_adaptive(__first_cut, __middle, __second_cut, __len1 - __len11, __len22, __buffer, __buffer_size); std::__merge_adaptive(__first, __first_cut, __new_middle, __len11, __len22, __buffer, __buffer_size, __comp); std::__merge_adaptive(__new_middle, __second_cut, __last, __len1 - __len11, __len2 - __len22, __buffer, __buffer_size, __comp); } } /// This is a helper function for the merge routines. template<typename _BidirectionalIterator, typename _Distance> void __merge_without_buffer(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, _Distance __len1, _Distance __len2) { if (__len1 == 0 || __len2 == 0) return; if (__len1 + __len2 == 2) { if (*__middle < *__first) std::iter_swap(__first, __middle); return; } _BidirectionalIterator __first_cut = __first; _BidirectionalIterator __second_cut = __middle; _Distance __len11 = 0; _Distance __len22 = 0; if (__len1 > __len2) { __len11 = __len1 / 2; std::advance(__first_cut, __len11); __second_cut = std::lower_bound(__middle, __last, *__first_cut); __len22 = std::distance(__middle, __second_cut); } else { __len22 = __len2 / 2; std::advance(__second_cut, __len22); __first_cut = std::upper_bound(__first, __middle, *__second_cut); __len11 = std::distance(__first, __first_cut); } std::rotate(__first_cut, __middle, __second_cut); _BidirectionalIterator __new_middle = __first_cut; std::advance(__new_middle, std::distance(__middle, __second_cut)); std::__merge_without_buffer(__first, __first_cut, __new_middle, __len11, __len22); std::__merge_without_buffer(__new_middle, __second_cut, __last, __len1 - __len11, __len2 - __len22); } /// This is a helper function for the merge routines. template<typename _BidirectionalIterator, typename _Distance, typename _Compare> void __merge_without_buffer(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, _Distance __len1, _Distance __len2, _Compare __comp) { if (__len1 == 0 || __len2 == 0) return; if (__len1 + __len2 == 2) { if (__comp(*__middle, *__first)) std::iter_swap(__first, __middle); return; } _BidirectionalIterator __first_cut = __first; _BidirectionalIterator __second_cut = __middle; _Distance __len11 = 0; _Distance __len22 = 0; if (__len1 > __len2) { __len11 = __len1 / 2; std::advance(__first_cut, __len11); __second_cut = std::lower_bound(__middle, __last, *__first_cut, __comp); __len22 = std::distance(__middle, __second_cut); } else { __len22 = __len2 / 2; std::advance(__second_cut, __len22); __first_cut = std::upper_bound(__first, __middle, *__second_cut, __comp); __len11 = std::distance(__first, __first_cut); } std::rotate(__first_cut, __middle, __second_cut); _BidirectionalIterator __new_middle = __first_cut; std::advance(__new_middle, std::distance(__middle, __second_cut)); std::__merge_without_buffer(__first, __first_cut, __new_middle, __len11, __len22, __comp); std::__merge_without_buffer(__new_middle, __second_cut, __last, __len1 - __len11, __len2 - __len22, __comp); } /** * @brief Merges two sorted ranges in place. * @ingroup sorting_algorithms * @param __first An iterator. * @param __middle Another iterator. * @param __last Another iterator. * @return Nothing. * * Merges two sorted and consecutive ranges, [__first,__middle) and * [__middle,__last), and puts the result in [__first,__last). The * output will be sorted. The sort is @e stable, that is, for * equivalent elements in the two ranges, elements from the first * range will always come before elements from the second. * * If enough additional memory is available, this takes (__last-__first)-1 * comparisons. Otherwise an NlogN algorithm is used, where N is * distance(__first,__last). */ template<typename _BidirectionalIterator> void inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last) { typedef typename iterator_traits<_BidirectionalIterator>::value_type _ValueType; typedef typename iterator_traits<_BidirectionalIterator>::difference_type _DistanceType; // concept requirements __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept< _BidirectionalIterator>) __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>) __glibcxx_requires_sorted(__first, __middle); __glibcxx_requires_sorted(__middle, __last); if (__first == __middle || __middle == __last) return; _DistanceType __len1 = std::distance(__first, __middle); _DistanceType __len2 = std::distance(__middle, __last); _Temporary_buffer<_BidirectionalIterator, _ValueType> __buf(__first, __last); if (__buf.begin() == 0) std::__merge_without_buffer(__first, __middle, __last, __len1, __len2); else std::__merge_adaptive(__first, __middle, __last, __len1, __len2, __buf.begin(), _DistanceType(__buf.size())); } /** * @brief Merges two sorted ranges in place. * @ingroup sorting_algorithms * @param __first An iterator. * @param __middle Another iterator. * @param __last Another iterator. * @param __comp A functor to use for comparisons. * @return Nothing. * * Merges two sorted and consecutive ranges, [__first,__middle) and * [middle,last), and puts the result in [__first,__last). The output will * be sorted. The sort is @e stable, that is, for equivalent * elements in the two ranges, elements from the first range will always * come before elements from the second. * * If enough additional memory is available, this takes (__last-__first)-1 * comparisons. Otherwise an NlogN algorithm is used, where N is * distance(__first,__last). * * The comparison function should have the same effects on ordering as * the function used for the initial sort. */ template<typename _BidirectionalIterator, typename _Compare> void inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, _Compare __comp) { typedef typename iterator_traits<_BidirectionalIterator>::value_type _ValueType; typedef typename iterator_traits<_BidirectionalIterator>::difference_type _DistanceType; // concept requirements __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept< _BidirectionalIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType, _ValueType>) __glibcxx_requires_sorted_pred(__first, __middle, __comp); __glibcxx_requires_sorted_pred(__middle, __last, __comp); if (__first == __middle || __middle == __last) return; const _DistanceType __len1 = std::distance(__first, __middle); const _DistanceType __len2 = std::distance(__middle, __last); _Temporary_buffer<_BidirectionalIterator, _ValueType> __buf(__first, __last); if (__buf.begin() == 0) std::__merge_without_buffer(__first, __middle, __last, __len1, __len2, __comp); else std::__merge_adaptive(__first, __middle, __last, __len1, __len2, __buf.begin(), _DistanceType(__buf.size()), __comp); } /// This is a helper function for the __merge_sort_loop routines. template<typename _InputIterator1, typename _InputIterator2, typename _OutputIterator> _OutputIterator __move_merge(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) { while (__first1 != __last1 && __first2 != __last2) { if (*__first2 < *__first1) { *__result = _GLIBCXX_MOVE(*__first2); ++__first2; } else { *__result = _GLIBCXX_MOVE(*__first1); ++__first1; } ++__result; } return _GLIBCXX_MOVE3(__first2, __last2, _GLIBCXX_MOVE3(__first1, __last1, __result)); } /// This is a helper function for the __merge_sort_loop routines. template<typename _InputIterator1, typename _InputIterator2, typename _OutputIterator, typename _Compare> _OutputIterator __move_merge(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) { while (__first1 != __last1 && __first2 != __last2) { if (__comp(*__first2, *__first1)) { *__result = _GLIBCXX_MOVE(*__first2); ++__first2; } else { *__result = _GLIBCXX_MOVE(*__first1); ++__first1; } ++__result; } return _GLIBCXX_MOVE3(__first2, __last2, _GLIBCXX_MOVE3(__first1, __last1, __result)); } template<typename _RandomAccessIterator1, typename _RandomAccessIterator2, typename _Distance> void __merge_sort_loop(_RandomAccessIterator1 __first, _RandomAccessIterator1 __last, _RandomAccessIterator2 __result, _Distance __step_size) { const _Distance __two_step = 2 * __step_size; while (__last - __first >= __two_step) { __result = std::__move_merge(__first, __first + __step_size, __first + __step_size, __first + __two_step, __result); __first += __two_step; } __step_size = std::min(_Distance(__last - __first), __step_size); std::__move_merge(__first, __first + __step_size, __first + __step_size, __last, __result); } template<typename _RandomAccessIterator1, typename _RandomAccessIterator2, typename _Distance, typename _Compare> void __merge_sort_loop(_RandomAccessIterator1 __first, _RandomAccessIterator1 __last, _RandomAccessIterator2 __result, _Distance __step_size, _Compare __comp) { const _Distance __two_step = 2 * __step_size; while (__last - __first >= __two_step) { __result = std::__move_merge(__first, __first + __step_size, __first + __step_size, __first + __two_step, __result, __comp); __first += __two_step; } __step_size = std::min(_Distance(__last - __first), __step_size); std::__move_merge(__first,__first + __step_size, __first + __step_size, __last, __result, __comp); } template<typename _RandomAccessIterator, typename _Distance> void __chunk_insertion_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Distance __chunk_size) { while (__last - __first >= __chunk_size) { std::__insertion_sort(__first, __first + __chunk_size); __first += __chunk_size; } std::__insertion_sort(__first, __last); } template<typename _RandomAccessIterator, typename _Distance, typename _Compare> void __chunk_insertion_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Distance __chunk_size, _Compare __comp) { while (__last - __first >= __chunk_size) { std::__insertion_sort(__first, __first + __chunk_size, __comp); __first += __chunk_size; } std::__insertion_sort(__first, __last, __comp); } enum { _S_chunk_size = 7 }; template<typename _RandomAccessIterator, typename _Pointer> void __merge_sort_with_buffer(_RandomAccessIterator __first, _RandomAccessIterator __last, _Pointer __buffer) { typedef typename iterator_traits<_RandomAccessIterator>::difference_type _Distance; const _Distance __len = __last - __first; const _Pointer __buffer_last = __buffer + __len; _Distance __step_size = _S_chunk_size; std::__chunk_insertion_sort(__first, __last, __step_size); while (__step_size < __len) { std::__merge_sort_loop(__first, __last, __buffer, __step_size); __step_size *= 2; std::__merge_sort_loop(__buffer, __buffer_last, __first, __step_size); __step_size *= 2; } } template<typename _RandomAccessIterator, typename _Pointer, typename _Compare> void __merge_sort_with_buffer(_RandomAccessIterator __first, _RandomAccessIterator __last, _Pointer __buffer, _Compare __comp) { typedef typename iterator_traits<_RandomAccessIterator>::difference_type _Distance; const _Distance __len = __last - __first; const _Pointer __buffer_last = __buffer + __len; _Distance __step_size = _S_chunk_size; std::__chunk_insertion_sort(__first, __last, __step_size, __comp); while (__step_size < __len) { std::__merge_sort_loop(__first, __last, __buffer, __step_size, __comp); __step_size *= 2; std::__merge_sort_loop(__buffer, __buffer_last, __first, __step_size, __comp); __step_size *= 2; } } template<typename _RandomAccessIterator, typename _Pointer, typename _Distance> void __stable_sort_adaptive(_RandomAccessIterator __first, _RandomAccessIterator __last, _Pointer __buffer, _Distance __buffer_size) { const _Distance __len = (__last - __first + 1) / 2; const _RandomAccessIterator __middle = __first + __len; if (__len > __buffer_size) { std::__stable_sort_adaptive(__first, __middle, __buffer, __buffer_size); std::__stable_sort_adaptive(__middle, __last, __buffer, __buffer_size); } else { std::__merge_sort_with_buffer(__first, __middle, __buffer); std::__merge_sort_with_buffer(__middle, __last, __buffer); } std::__merge_adaptive(__first, __middle, __last, _Distance(__middle - __first), _Distance(__last - __middle), __buffer, __buffer_size); } template<typename _RandomAccessIterator, typename _Pointer, typename _Distance, typename _Compare> void __stable_sort_adaptive(_RandomAccessIterator __first, _RandomAccessIterator __last, _Pointer __buffer, _Distance __buffer_size, _Compare __comp) { const _Distance __len = (__last - __first + 1) / 2; const _RandomAccessIterator __middle = __first + __len; if (__len > __buffer_size) { std::__stable_sort_adaptive(__first, __middle, __buffer, __buffer_size, __comp); std::__stable_sort_adaptive(__middle, __last, __buffer, __buffer_size, __comp); } else { std::__merge_sort_with_buffer(__first, __middle, __buffer, __comp); std::__merge_sort_with_buffer(__middle, __last, __buffer, __comp); } std::__merge_adaptive(__first, __middle, __last, _Distance(__middle - __first), _Distance(__last - __middle), __buffer, __buffer_size, __comp); } /// This is a helper function for the stable sorting routines. template<typename _RandomAccessIterator> void __inplace_stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last) { if (__last - __first < 15) { std::__insertion_sort(__first, __last); return; } _RandomAccessIterator __middle = __first + (__last - __first) / 2; std::__inplace_stable_sort(__first, __middle); std::__inplace_stable_sort(__middle, __last); std::__merge_without_buffer(__first, __middle, __last, __middle - __first, __last - __middle); } /// This is a helper function for the stable sorting routines. template<typename _RandomAccessIterator, typename _Compare> void __inplace_stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { if (__last - __first < 15) { std::__insertion_sort(__first, __last, __comp); return; } _RandomAccessIterator __middle = __first + (__last - __first) / 2; std::__inplace_stable_sort(__first, __middle, __comp); std::__inplace_stable_sort(__middle, __last, __comp); std::__merge_without_buffer(__first, __middle, __last, __middle - __first, __last - __middle, __comp); } // stable_sort // Set algorithms: includes, set_union, set_intersection, set_difference, // set_symmetric_difference. All of these algorithms have the precondition // that their input ranges are sorted and the postcondition that their output // ranges are sorted. /** * @brief Determines whether all elements of a sequence exists in a range. * @param __first1 Start of search range. * @param __last1 End of search range. * @param __first2 Start of sequence * @param __last2 End of sequence. * @return True if each element in [__first2,__last2) is contained in order * within [__first1,__last1). False otherwise. * @ingroup set_algorithms * * This operation expects both [__first1,__last1) and * [__first2,__last2) to be sorted. Searches for the presence of * each element in [__first2,__last2) within [__first1,__last1). * The iterators over each range only move forward, so this is a * linear algorithm. If an element in [__first2,__last2) is not * found before the search iterator reaches @p __last2, false is * returned. */ template<typename _InputIterator1, typename _InputIterator2> bool includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { typedef typename iterator_traits<_InputIterator1>::value_type _ValueType1; typedef typename iterator_traits<_InputIterator2>::value_type _ValueType2; // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>) __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>) __glibcxx_requires_sorted_set(__first1, __last1, __first2); __glibcxx_requires_sorted_set(__first2, __last2, __first1); while (__first1 != __last1 && __first2 != __last2) if (*__first2 < *__first1) return false; else if(*__first1 < *__first2) ++__first1; else ++__first1, ++__first2; return __first2 == __last2; } /** * @brief Determines whether all elements of a sequence exists in a range * using comparison. * @ingroup set_algorithms * @param __first1 Start of search range. * @param __last1 End of search range. * @param __first2 Start of sequence * @param __last2 End of sequence. * @param __comp Comparison function to use. * @return True if each element in [__first2,__last2) is contained * in order within [__first1,__last1) according to comp. False * otherwise. @ingroup set_algorithms * * This operation expects both [__first1,__last1) and * [__first2,__last2) to be sorted. Searches for the presence of * each element in [__first2,__last2) within [__first1,__last1), * using comp to decide. The iterators over each range only move * forward, so this is a linear algorithm. If an element in * [__first2,__last2) is not found before the search iterator * reaches @p __last2, false is returned. */ template<typename _InputIterator1, typename _InputIterator2, typename _Compare> bool includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp) { typedef typename iterator_traits<_InputIterator1>::value_type _ValueType1; typedef typename iterator_traits<_InputIterator2>::value_type _ValueType2; // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType1, _ValueType2>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType2, _ValueType1>) __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); while (__first1 != __last1 && __first2 != __last2) if (__comp(*__first2, *__first1)) return false; else if(__comp(*__first1, *__first2)) ++__first1; else ++__first1, ++__first2; return __first2 == __last2; } // nth_element // merge // set_difference // set_intersection // set_union // stable_sort // set_symmetric_difference // min_element // max_element /** * @brief Permute range into the next @e dictionary ordering. * @ingroup sorting_algorithms * @param __first Start of range. * @param __last End of range. * @return False if wrapped to first permutation, true otherwise. * * Treats all permutations of the range as a set of @e dictionary sorted * sequences. Permutes the current sequence into the next one of this set. * Returns true if there are more sequences to generate. If the sequence * is the largest of the set, the smallest is generated and false returned. */ template<typename _BidirectionalIterator> bool next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last) { // concept requirements __glibcxx_function_requires(_BidirectionalIteratorConcept< _BidirectionalIterator>) __glibcxx_function_requires(_LessThanComparableConcept< typename iterator_traits<_BidirectionalIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return false; _BidirectionalIterator __i = __first; ++__i; if (__i == __last) return false; __i = __last; --__i; for(;;) { _BidirectionalIterator __ii = __i; --__i; if (*__i < *__ii) { _BidirectionalIterator __j = __last; while (!(*__i < *--__j)) {} std::iter_swap(__i, __j); std::reverse(__ii, __last); return true; } if (__i == __first) { std::reverse(__first, __last); return false; } } } /** * @brief Permute range into the next @e dictionary ordering using * comparison functor. * @ingroup sorting_algorithms * @param __first Start of range. * @param __last End of range. * @param __comp A comparison functor. * @return False if wrapped to first permutation, true otherwise. * * Treats all permutations of the range [__first,__last) as a set of * @e dictionary sorted sequences ordered by @p __comp. Permutes the current * sequence into the next one of this set. Returns true if there are more * sequences to generate. If the sequence is the largest of the set, the * smallest is generated and false returned. */ template<typename _BidirectionalIterator, typename _Compare> bool next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) { // concept requirements __glibcxx_function_requires(_BidirectionalIteratorConcept< _BidirectionalIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, typename iterator_traits<_BidirectionalIterator>::value_type, typename iterator_traits<_BidirectionalIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return false; _BidirectionalIterator __i = __first; ++__i; if (__i == __last) return false; __i = __last; --__i; for(;;) { _BidirectionalIterator __ii = __i; --__i; if (__comp(*__i, *__ii)) { _BidirectionalIterator __j = __last; while (!bool(__comp(*__i, *--__j))) {} std::iter_swap(__i, __j); std::reverse(__ii, __last); return true; } if (__i == __first) { std::reverse(__first, __last); return false; } } } /** * @brief Permute range into the previous @e dictionary ordering. * @ingroup sorting_algorithms * @param __first Start of range. * @param __last End of range. * @return False if wrapped to last permutation, true otherwise. * * Treats all permutations of the range as a set of @e dictionary sorted * sequences. Permutes the current sequence into the previous one of this * set. Returns true if there are more sequences to generate. If the * sequence is the smallest of the set, the largest is generated and false * returned. */ template<typename _BidirectionalIterator> bool prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last) { // concept requirements __glibcxx_function_requires(_BidirectionalIteratorConcept< _BidirectionalIterator>) __glibcxx_function_requires(_LessThanComparableConcept< typename iterator_traits<_BidirectionalIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return false; _BidirectionalIterator __i = __first; ++__i; if (__i == __last) return false; __i = __last; --__i; for(;;) { _BidirectionalIterator __ii = __i; --__i; if (*__ii < *__i) { _BidirectionalIterator __j = __last; while (!(*--__j < *__i)) {} std::iter_swap(__i, __j); std::reverse(__ii, __last); return true; } if (__i == __first) { std::reverse(__first, __last); return false; } } } /** * @brief Permute range into the previous @e dictionary ordering using * comparison functor. * @ingroup sorting_algorithms * @param __first Start of range. * @param __last End of range. * @param __comp A comparison functor. * @return False if wrapped to last permutation, true otherwise. * * Treats all permutations of the range [__first,__last) as a set of * @e dictionary sorted sequences ordered by @p __comp. Permutes the current * sequence into the previous one of this set. Returns true if there are * more sequences to generate. If the sequence is the smallest of the set, * the largest is generated and false returned. */ template<typename _BidirectionalIterator, typename _Compare> bool prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) { // concept requirements __glibcxx_function_requires(_BidirectionalIteratorConcept< _BidirectionalIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, typename iterator_traits<_BidirectionalIterator>::value_type, typename iterator_traits<_BidirectionalIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return false; _BidirectionalIterator __i = __first; ++__i; if (__i == __last) return false; __i = __last; --__i; for(;;) { _BidirectionalIterator __ii = __i; --__i; if (__comp(*__ii, *__i)) { _BidirectionalIterator __j = __last; while (!bool(__comp(*--__j, *__i))) {} std::iter_swap(__i, __j); std::reverse(__ii, __last); return true; } if (__i == __first) { std::reverse(__first, __last); return false; } } } // replace // replace_if /** * @brief Copy a sequence, replacing each element of one value with another * value. * @param __first An input iterator. * @param __last An input iterator. * @param __result An output iterator. * @param __old_value The value to be replaced. * @param __new_value The replacement value. * @return The end of the output sequence, @p result+(last-first). * * Copies each element in the input range @p [__first,__last) to the * output range @p [__result,__result+(__last-__first)) replacing elements * equal to @p __old_value with @p __new_value. */ template<typename _InputIterator, typename _OutputIterator, typename _Tp> _OutputIterator replace_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __old_value, const _Tp& __new_value) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, typename iterator_traits<_InputIterator>::value_type>) __glibcxx_function_requires(_EqualOpConcept< typename iterator_traits<_InputIterator>::value_type, _Tp>) __glibcxx_requires_valid_range(__first, __last); for (; __first != __last; ++__first, ++__result) if (*__first == __old_value) *__result = __new_value; else *__result = *__first; return __result; } /** * @brief Copy a sequence, replacing each value for which a predicate * returns true with another value. * @ingroup mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __result An output iterator. * @param __pred A predicate. * @param __new_value The replacement value. * @return The end of the output sequence, @p __result+(__last-__first). * * Copies each element in the range @p [__first,__last) to the range * @p [__result,__result+(__last-__first)) replacing elements for which * @p __pred returns true with @p __new_value. */ template<typename _InputIterator, typename _OutputIterator, typename _Predicate, typename _Tp> _OutputIterator replace_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred, const _Tp& __new_value) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, typename iterator_traits<_InputIterator>::value_type>) __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, typename iterator_traits<_InputIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); for (; __first != __last; ++__first, ++__result) if (__pred(*__first)) *__result = __new_value; else *__result = *__first; return __result; } #if __cplusplus >= 201103L /** * @brief Determines whether the elements of a sequence are sorted. * @ingroup sorting_algorithms * @param __first An iterator. * @param __last Another iterator. * @return True if the elements are sorted, false otherwise. */ template<typename _ForwardIterator> inline bool is_sorted(_ForwardIterator __first, _ForwardIterator __last) { return std::is_sorted_until(__first, __last) == __last; } /** * @brief Determines whether the elements of a sequence are sorted * according to a comparison functor. * @ingroup sorting_algorithms * @param __first An iterator. * @param __last Another iterator. * @param __comp A comparison functor. * @return True if the elements are sorted, false otherwise. */ template<typename _ForwardIterator, typename _Compare> inline bool is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { return std::is_sorted_until(__first, __last, __comp) == __last; } /** * @brief Determines the end of a sorted sequence. * @ingroup sorting_algorithms * @param __first An iterator. * @param __last Another iterator. * @return An iterator pointing to the last iterator i in [__first, __last) * for which the range [__first, i) is sorted. */ template<typename _ForwardIterator> _ForwardIterator is_sorted_until(_ForwardIterator __first, _ForwardIterator __last) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_LessThanComparableConcept< typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return __last; _ForwardIterator __next = __first; for (++__next; __next != __last; __first = __next, ++__next) if (*__next < *__first) return __next; return __next; } /** * @brief Determines the end of a sorted sequence using comparison functor. * @ingroup sorting_algorithms * @param __first An iterator. * @param __last Another iterator. * @param __comp A comparison functor. * @return An iterator pointing to the last iterator i in [__first, __last) * for which the range [__first, i) is sorted. */ template<typename _ForwardIterator, typename _Compare> _ForwardIterator is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, typename iterator_traits<_ForwardIterator>::value_type, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return __last; _ForwardIterator __next = __first; for (++__next; __next != __last; __first = __next, ++__next) if (__comp(*__next, *__first)) return __next; return __next; } /** * @brief Determines min and max at once as an ordered pair. * @ingroup sorting_algorithms * @param __a A thing of arbitrary type. * @param __b Another thing of arbitrary type. * @return A pair(__b, __a) if __b is smaller than __a, pair(__a, * __b) otherwise. */ template<typename _Tp> inline pair<const _Tp&, const _Tp&> minmax(const _Tp& __a, const _Tp& __b) { // concept requirements __glibcxx_function_requires(_LessThanComparableConcept<_Tp>) return __b < __a ? pair<const _Tp&, const _Tp&>(__b, __a) : pair<const _Tp&, const _Tp&>(__a, __b); } /** * @brief Determines min and max at once as an ordered pair. * @ingroup sorting_algorithms * @param __a A thing of arbitrary type. * @param __b Another thing of arbitrary type. * @param __comp A @link comparison_functors comparison functor @endlink. * @return A pair(__b, __a) if __b is smaller than __a, pair(__a, * __b) otherwise. */ template<typename _Tp, typename _Compare> inline pair<const _Tp&, const _Tp&> minmax(const _Tp& __a, const _Tp& __b, _Compare __comp) { return __comp(__b, __a) ? pair<const _Tp&, const _Tp&>(__b, __a) : pair<const _Tp&, const _Tp&>(__a, __b); } /** * @brief Return a pair of iterators pointing to the minimum and maximum * elements in a range. * @ingroup sorting_algorithms * @param __first Start of range. * @param __last End of range. * @return make_pair(m, M), where m is the first iterator i in * [__first, __last) such that no other element in the range is * smaller, and where M is the last iterator i in [__first, __last) * such that no other element in the range is larger. */ template<typename _ForwardIterator> pair<_ForwardIterator, _ForwardIterator> minmax_element(_ForwardIterator __first, _ForwardIterator __last) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_LessThanComparableConcept< typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); _ForwardIterator __next = __first; if (__first == __last || ++__next == __last) return std::make_pair(__first, __first); _ForwardIterator __min, __max; if (*__next < *__first) { __min = __next; __max = __first; } else { __min = __first; __max = __next; } __first = __next; ++__first; while (__first != __last) { __next = __first; if (++__next == __last) { if (*__first < *__min) __min = __first; else if (!(*__first < *__max)) __max = __first; break; } if (*__next < *__first) { if (*__next < *__min) __min = __next; if (!(*__first < *__max)) __max = __first; } else { if (*__first < *__min) __min = __first; if (!(*__next < *__max)) __max = __next; } __first = __next; ++__first; } return std::make_pair(__min, __max); } /** * @brief Return a pair of iterators pointing to the minimum and maximum * elements in a range. * @ingroup sorting_algorithms * @param __first Start of range. * @param __last End of range. * @param __comp Comparison functor. * @return make_pair(m, M), where m is the first iterator i in * [__first, __last) such that no other element in the range is * smaller, and where M is the last iterator i in [__first, __last) * such that no other element in the range is larger. */ template<typename _ForwardIterator, typename _Compare> pair<_ForwardIterator, _ForwardIterator> minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, typename iterator_traits<_ForwardIterator>::value_type, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); _ForwardIterator __next = __first; if (__first == __last || ++__next == __last) return std::make_pair(__first, __first); _ForwardIterator __min, __max; if (__comp(*__next, *__first)) { __min = __next; __max = __first; } else { __min = __first; __max = __next; } __first = __next; ++__first; while (__first != __last) { __next = __first; if (++__next == __last) { if (__comp(*__first, *__min)) __min = __first; else if (!__comp(*__first, *__max)) __max = __first; break; } if (__comp(*__next, *__first)) { if (__comp(*__next, *__min)) __min = __next; if (!__comp(*__first, *__max)) __max = __first; } else { if (__comp(*__first, *__min)) __min = __first; if (!__comp(*__next, *__max)) __max = __next; } __first = __next; ++__first; } return std::make_pair(__min, __max); } // N2722 + DR 915. template<typename _Tp> inline _Tp min(initializer_list<_Tp> __l) { return *std::min_element(__l.begin(), __l.end()); } template<typename _Tp, typename _Compare> inline _Tp min(initializer_list<_Tp> __l, _Compare __comp) { return *std::min_element(__l.begin(), __l.end(), __comp); } template<typename _Tp> inline _Tp max(initializer_list<_Tp> __l) { return *std::max_element(__l.begin(), __l.end()); } template<typename _Tp, typename _Compare> inline _Tp max(initializer_list<_Tp> __l, _Compare __comp) { return *std::max_element(__l.begin(), __l.end(), __comp); } template<typename _Tp> inline pair<_Tp, _Tp> minmax(initializer_list<_Tp> __l) { pair<const _Tp*, const _Tp*> __p = std::minmax_element(__l.begin(), __l.end()); return std::make_pair(*__p.first, *__p.second); } template<typename _Tp, typename _Compare> inline pair<_Tp, _Tp> minmax(initializer_list<_Tp> __l, _Compare __comp) { pair<const _Tp*, const _Tp*> __p = std::minmax_element(__l.begin(), __l.end(), __comp); return std::make_pair(*__p.first, *__p.second); } /** * @brief Checks whether a permutaion of the second sequence is equal * to the first sequence. * @ingroup non_mutating_algorithms * @param __first1 Start of first range. * @param __last1 End of first range. * @param __first2 Start of second range. * @return true if there exists a permutation of the elements in the range * [__first2, __first2 + (__last1 - __first1)), beginning with * ForwardIterator2 begin, such that equal(__first1, __last1, begin) * returns true; otherwise, returns false. */ template<typename _ForwardIterator1, typename _ForwardIterator2> bool is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) { // Efficiently compare identical prefixes: O(N) if sequences // have the same elements in the same order. for (; __first1 != __last1; ++__first1, ++__first2) if (!(*__first1 == *__first2)) break; if (__first1 == __last1) return true; // Establish __last2 assuming equal ranges by iterating over the // rest of the list. _ForwardIterator2 __last2 = __first2; std::advance(__last2, std::distance(__first1, __last1)); for (_ForwardIterator1 __scan = __first1; __scan != __last1; ++__scan) { if (__scan != _GLIBCXX_STD_A::find(__first1, __scan, *__scan)) continue; // We've seen this one before. auto __matches = std::count(__first2, __last2, *__scan); if (0 == __matches || std::count(__scan, __last1, *__scan) != __matches) return false; } return true; } /** * @brief Checks whether a permutation of the second sequence is equal * to the first sequence. * @ingroup non_mutating_algorithms * @param __first1 Start of first range. * @param __last1 End of first range. * @param __first2 Start of second range. * @param __pred A binary predicate. * @return true if there exists a permutation of the elements in * the range [__first2, __first2 + (__last1 - __first1)), * beginning with ForwardIterator2 begin, such that * equal(__first1, __last1, __begin, __pred) returns true; * otherwise, returns false. */ template<typename _ForwardIterator1, typename _ForwardIterator2, typename _BinaryPredicate> bool is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _BinaryPredicate __pred) { // Efficiently compare identical prefixes: O(N) if sequences // have the same elements in the same order. for (; __first1 != __last1; ++__first1, ++__first2) if (!bool(__pred(*__first1, *__first2))) break; if (__first1 == __last1) return true; // Establish __last2 assuming equal ranges by iterating over the // rest of the list. _ForwardIterator2 __last2 = __first2; std::advance(__last2, std::distance(__first1, __last1)); for (_ForwardIterator1 __scan = __first1; __scan != __last1; ++__scan) { using std::placeholders::_1; if (__scan != _GLIBCXX_STD_A::find_if(__first1, __scan, std::bind(__pred, _1, *__scan))) continue; // We've seen this one before. auto __matches = std::count_if(__first2, __last2, std::bind(__pred, _1, *__scan)); if (0 == __matches || std::count_if(__scan, __last1, std::bind(__pred, _1, *__scan)) != __matches) return false; } return true; } #ifdef _GLIBCXX_USE_C99_STDINT_TR1 /** * @brief Shuffle the elements of a sequence using a uniform random * number generator. * @ingroup mutating_algorithms * @param __first A forward iterator. * @param __last A forward iterator. * @param __g A UniformRandomNumberGenerator (26.5.1.3). * @return Nothing. * * Reorders the elements in the range @p [__first,__last) using @p __g to * provide random numbers. */ template<typename _RandomAccessIterator, typename _UniformRandomNumberGenerator> void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, _UniformRandomNumberGenerator&& __g) { // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return; typedef typename iterator_traits<_RandomAccessIterator>::difference_type _DistanceType; typedef typename std::make_unsigned<_DistanceType>::type __ud_type; typedef typename std::uniform_int_distribution<__ud_type> __distr_type; typedef typename __distr_type::param_type __p_type; __distr_type __d; for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) std::iter_swap(__i, __first + __d(__g, __p_type(0, __i - __first))); } #endif #endif // C++11 _GLIBCXX_END_NAMESPACE_VERSION _GLIBCXX_BEGIN_NAMESPACE_ALGO /** * @brief Apply a function to every element of a sequence. * @ingroup non_mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __f A unary function object. * @return @p __f (std::move(@p __f) in C++0x). * * Applies the function object @p __f to each element in the range * @p [first,last). @p __f must not modify the order of the sequence. * If @p __f has a return value it is ignored. */ template<typename _InputIterator, typename _Function> _Function for_each(_InputIterator __first, _InputIterator __last, _Function __f) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_requires_valid_range(__first, __last); for (; __first != __last; ++__first) __f(*__first); return _GLIBCXX_MOVE(__f); } /** * @brief Find the first occurrence of a value in a sequence. * @ingroup non_mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __val The value to find. * @return The first iterator @c i in the range @p [__first,__last) * such that @c *i == @p __val, or @p __last if no such iterator exists. */ template<typename _InputIterator, typename _Tp> inline _InputIterator find(_InputIterator __first, _InputIterator __last, const _Tp& __val) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_EqualOpConcept< typename iterator_traits<_InputIterator>::value_type, _Tp>) __glibcxx_requires_valid_range(__first, __last); return std::__find(__first, __last, __val, std::__iterator_category(__first)); } /** * @brief Find the first element in a sequence for which a * predicate is true. * @ingroup non_mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __pred A predicate. * @return The first iterator @c i in the range @p [__first,__last) * such that @p __pred(*i) is true, or @p __last if no such iterator exists. */ template<typename _InputIterator, typename _Predicate> inline _InputIterator find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, typename iterator_traits<_InputIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); return std::__find_if(__first, __last, __pred, std::__iterator_category(__first)); } /** * @brief Find element from a set in a sequence. * @ingroup non_mutating_algorithms * @param __first1 Start of range to search. * @param __last1 End of range to search. * @param __first2 Start of match candidates. * @param __last2 End of match candidates. * @return The first iterator @c i in the range * @p [__first1,__last1) such that @c *i == @p *(i2) such that i2 is an * iterator in [__first2,__last2), or @p __last1 if no such iterator exists. * * Searches the range @p [__first1,__last1) for an element that is * equal to some element in the range [__first2,__last2). If * found, returns an iterator in the range [__first1,__last1), * otherwise returns @p __last1. */ template<typename _InputIterator, typename _ForwardIterator> _InputIterator find_first_of(_InputIterator __first1, _InputIterator __last1, _ForwardIterator __first2, _ForwardIterator __last2) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_EqualOpConcept< typename iterator_traits<_InputIterator>::value_type, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first1, __last1); __glibcxx_requires_valid_range(__first2, __last2); for (; __first1 != __last1; ++__first1) for (_ForwardIterator __iter = __first2; __iter != __last2; ++__iter) if (*__first1 == *__iter) return __first1; return __last1; } /** * @brief Find element from a set in a sequence using a predicate. * @ingroup non_mutating_algorithms * @param __first1 Start of range to search. * @param __last1 End of range to search. * @param __first2 Start of match candidates. * @param __last2 End of match candidates. * @param __comp Predicate to use. * @return The first iterator @c i in the range * @p [__first1,__last1) such that @c comp(*i, @p *(i2)) is true * and i2 is an iterator in [__first2,__last2), or @p __last1 if no * such iterator exists. * * Searches the range @p [__first1,__last1) for an element that is * equal to some element in the range [__first2,__last2). If * found, returns an iterator in the range [__first1,__last1), * otherwise returns @p __last1. */ template<typename _InputIterator, typename _ForwardIterator, typename _BinaryPredicate> _InputIterator find_first_of(_InputIterator __first1, _InputIterator __last1, _ForwardIterator __first2, _ForwardIterator __last2, _BinaryPredicate __comp) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, typename iterator_traits<_InputIterator>::value_type, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first1, __last1); __glibcxx_requires_valid_range(__first2, __last2); for (; __first1 != __last1; ++__first1) for (_ForwardIterator __iter = __first2; __iter != __last2; ++__iter) if (__comp(*__first1, *__iter)) return __first1; return __last1; } /** * @brief Find two adjacent values in a sequence that are equal. * @ingroup non_mutating_algorithms * @param __first A forward iterator. * @param __last A forward iterator. * @return The first iterator @c i such that @c i and @c i+1 are both * valid iterators in @p [__first,__last) and such that @c *i == @c *(i+1), * or @p __last if no such iterator exists. */ template<typename _ForwardIterator> _ForwardIterator adjacent_find(_ForwardIterator __first, _ForwardIterator __last) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_EqualityComparableConcept< typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return __last; _ForwardIterator __next = __first; while(++__next != __last) { if (*__first == *__next) return __first; __first = __next; } return __last; } /** * @brief Find two adjacent values in a sequence using a predicate. * @ingroup non_mutating_algorithms * @param __first A forward iterator. * @param __last A forward iterator. * @param __binary_pred A binary predicate. * @return The first iterator @c i such that @c i and @c i+1 are both * valid iterators in @p [__first,__last) and such that * @p __binary_pred(*i,*(i+1)) is true, or @p __last if no such iterator * exists. */ template<typename _ForwardIterator, typename _BinaryPredicate> _ForwardIterator adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __binary_pred) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, typename iterator_traits<_ForwardIterator>::value_type, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return __last; _ForwardIterator __next = __first; while(++__next != __last) { if (__binary_pred(*__first, *__next)) return __first; __first = __next; } return __last; } /** * @brief Count the number of copies of a value in a sequence. * @ingroup non_mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __value The value to be counted. * @return The number of iterators @c i in the range @p [__first,__last) * for which @c *i == @p __value */ template<typename _InputIterator, typename _Tp> typename iterator_traits<_InputIterator>::difference_type count(_InputIterator __first, _InputIterator __last, const _Tp& __value) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_EqualOpConcept< typename iterator_traits<_InputIterator>::value_type, _Tp>) __glibcxx_requires_valid_range(__first, __last); typename iterator_traits<_InputIterator>::difference_type __n = 0; for (; __first != __last; ++__first) if (*__first == __value) ++__n; return __n; } /** * @brief Count the elements of a sequence for which a predicate is true. * @ingroup non_mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __pred A predicate. * @return The number of iterators @c i in the range @p [__first,__last) * for which @p __pred(*i) is true. */ template<typename _InputIterator, typename _Predicate> typename iterator_traits<_InputIterator>::difference_type count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, typename iterator_traits<_InputIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); typename iterator_traits<_InputIterator>::difference_type __n = 0; for (; __first != __last; ++__first) if (__pred(*__first)) ++__n; return __n; } /** * @brief Search a sequence for a matching sub-sequence. * @ingroup non_mutating_algorithms * @param __first1 A forward iterator. * @param __last1 A forward iterator. * @param __first2 A forward iterator. * @param __last2 A forward iterator. * @return The first iterator @c i in the range @p * [__first1,__last1-(__last2-__first2)) such that @c *(i+N) == @p * *(__first2+N) for each @c N in the range @p * [0,__last2-__first2), or @p __last1 if no such iterator exists. * * Searches the range @p [__first1,__last1) for a sub-sequence that * compares equal value-by-value with the sequence given by @p * [__first2,__last2) and returns an iterator to the first element * of the sub-sequence, or @p __last1 if the sub-sequence is not * found. * * Because the sub-sequence must lie completely within the range @p * [__first1,__last1) it must start at a position less than @p * __last1-(__last2-__first2) where @p __last2-__first2 is the * length of the sub-sequence. * * This means that the returned iterator @c i will be in the range * @p [__first1,__last1-(__last2-__first2)) */ template<typename _ForwardIterator1, typename _ForwardIterator2> _ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) __glibcxx_function_requires(_EqualOpConcept< typename iterator_traits<_ForwardIterator1>::value_type, typename iterator_traits<_ForwardIterator2>::value_type>) __glibcxx_requires_valid_range(__first1, __last1); __glibcxx_requires_valid_range(__first2, __last2); // Test for empty ranges if (__first1 == __last1 || __first2 == __last2) return __first1; // Test for a pattern of length 1. _ForwardIterator2 __p1(__first2); if (++__p1 == __last2) return _GLIBCXX_STD_A::find(__first1, __last1, *__first2); // General case. _ForwardIterator2 __p; _ForwardIterator1 __current = __first1; for (;;) { __first1 = _GLIBCXX_STD_A::find(__first1, __last1, *__first2); if (__first1 == __last1) return __last1; __p = __p1; __current = __first1; if (++__current == __last1) return __last1; while (*__current == *__p) { if (++__p == __last2) return __first1; if (++__current == __last1) return __last1; } ++__first1; } return __first1; } /** * @brief Search a sequence for a matching sub-sequence using a predicate. * @ingroup non_mutating_algorithms * @param __first1 A forward iterator. * @param __last1 A forward iterator. * @param __first2 A forward iterator. * @param __last2 A forward iterator. * @param __predicate A binary predicate. * @return The first iterator @c i in the range * @p [__first1,__last1-(__last2-__first2)) such that * @p __predicate(*(i+N),*(__first2+N)) is true for each @c N in the range * @p [0,__last2-__first2), or @p __last1 if no such iterator exists. * * Searches the range @p [__first1,__last1) for a sub-sequence that * compares equal value-by-value with the sequence given by @p * [__first2,__last2), using @p __predicate to determine equality, * and returns an iterator to the first element of the * sub-sequence, or @p __last1 if no such iterator exists. * * @see search(_ForwardIter1, _ForwardIter1, _ForwardIter2, _ForwardIter2) */ template<typename _ForwardIterator1, typename _ForwardIterator2, typename _BinaryPredicate> _ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __predicate) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, typename iterator_traits<_ForwardIterator1>::value_type, typename iterator_traits<_ForwardIterator2>::value_type>) __glibcxx_requires_valid_range(__first1, __last1); __glibcxx_requires_valid_range(__first2, __last2); // Test for empty ranges if (__first1 == __last1 || __first2 == __last2) return __first1; // Test for a pattern of length 1. _ForwardIterator2 __p1(__first2); if (++__p1 == __last2) { while (__first1 != __last1 && !bool(__predicate(*__first1, *__first2))) ++__first1; return __first1; } // General case. _ForwardIterator2 __p; _ForwardIterator1 __current = __first1; for (;;) { while (__first1 != __last1 && !bool(__predicate(*__first1, *__first2))) ++__first1; if (__first1 == __last1) return __last1; __p = __p1; __current = __first1; if (++__current == __last1) return __last1; while (__predicate(*__current, *__p)) { if (++__p == __last2) return __first1; if (++__current == __last1) return __last1; } ++__first1; } return __first1; } /** * @brief Search a sequence for a number of consecutive values. * @ingroup non_mutating_algorithms * @param __first A forward iterator. * @param __last A forward iterator. * @param __count The number of consecutive values. * @param __val The value to find. * @return The first iterator @c i in the range @p * [__first,__last-__count) such that @c *(i+N) == @p __val for * each @c N in the range @p [0,__count), or @p __last if no such * iterator exists. * * Searches the range @p [__first,__last) for @p count consecutive elements * equal to @p __val. */ template<typename _ForwardIterator, typename _Integer, typename _Tp> _ForwardIterator search_n(_ForwardIterator __first, _ForwardIterator __last, _Integer __count, const _Tp& __val) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_EqualOpConcept< typename iterator_traits<_ForwardIterator>::value_type, _Tp>) __glibcxx_requires_valid_range(__first, __last); if (__count <= 0) return __first; if (__count == 1) return _GLIBCXX_STD_A::find(__first, __last, __val); return std::__search_n(__first, __last, __count, __val, std::__iterator_category(__first)); } /** * @brief Search a sequence for a number of consecutive values using a * predicate. * @ingroup non_mutating_algorithms * @param __first A forward iterator. * @param __last A forward iterator. * @param __count The number of consecutive values. * @param __val The value to find. * @param __binary_pred A binary predicate. * @return The first iterator @c i in the range @p * [__first,__last-__count) such that @p * __binary_pred(*(i+N),__val) is true for each @c N in the range * @p [0,__count), or @p __last if no such iterator exists. * * Searches the range @p [__first,__last) for @p __count * consecutive elements for which the predicate returns true. */ template<typename _ForwardIterator, typename _Integer, typename _Tp, typename _BinaryPredicate> _ForwardIterator search_n(_ForwardIterator __first, _ForwardIterator __last, _Integer __count, const _Tp& __val, _BinaryPredicate __binary_pred) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, typename iterator_traits<_ForwardIterator>::value_type, _Tp>) __glibcxx_requires_valid_range(__first, __last); if (__count <= 0) return __first; if (__count == 1) { while (__first != __last && !bool(__binary_pred(*__first, __val))) ++__first; return __first; } return std::__search_n(__first, __last, __count, __val, __binary_pred, std::__iterator_category(__first)); } /** * @brief Perform an operation on a sequence. * @ingroup mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __result An output iterator. * @param __unary_op A unary operator. * @return An output iterator equal to @p __result+(__last-__first). * * Applies the operator to each element in the input range and assigns * the results to successive elements of the output sequence. * Evaluates @p *(__result+N)=unary_op(*(__first+N)) for each @c N in the * range @p [0,__last-__first). * * @p unary_op must not alter its argument. */ template<typename _InputIterator, typename _OutputIterator, typename _UnaryOperation> _OutputIterator transform(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _UnaryOperation __unary_op) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, // "the type returned by a _UnaryOperation" __typeof__(__unary_op(*__first))>) __glibcxx_requires_valid_range(__first, __last); for (; __first != __last; ++__first, ++__result) *__result = __unary_op(*__first); return __result; } /** * @brief Perform an operation on corresponding elements of two sequences. * @ingroup mutating_algorithms * @param __first1 An input iterator. * @param __last1 An input iterator. * @param __first2 An input iterator. * @param __result An output iterator. * @param __binary_op A binary operator. * @return An output iterator equal to @p result+(last-first). * * Applies the operator to the corresponding elements in the two * input ranges and assigns the results to successive elements of the * output sequence. * Evaluates @p * *(__result+N)=__binary_op(*(__first1+N),*(__first2+N)) for each * @c N in the range @p [0,__last1-__first1). * * @p binary_op must not alter either of its arguments. */ template<typename _InputIterator1, typename _InputIterator2, typename _OutputIterator, typename _BinaryOperation> _OutputIterator transform(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _OutputIterator __result, _BinaryOperation __binary_op) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, // "the type returned by a _BinaryOperation" __typeof__(__binary_op(*__first1,*__first2))>) __glibcxx_requires_valid_range(__first1, __last1); for (; __first1 != __last1; ++__first1, ++__first2, ++__result) *__result = __binary_op(*__first1, *__first2); return __result; } /** * @brief Replace each occurrence of one value in a sequence with another * value. * @ingroup mutating_algorithms * @param __first A forward iterator. * @param __last A forward iterator. * @param __old_value The value to be replaced. * @param __new_value The replacement value. * @return replace() returns no value. * * For each iterator @c i in the range @p [__first,__last) if @c *i == * @p __old_value then the assignment @c *i = @p __new_value is performed. */ template<typename _ForwardIterator, typename _Tp> void replace(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value, const _Tp& __new_value) { // concept requirements __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< _ForwardIterator>) __glibcxx_function_requires(_EqualOpConcept< typename iterator_traits<_ForwardIterator>::value_type, _Tp>) __glibcxx_function_requires(_ConvertibleConcept<_Tp, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); for (; __first != __last; ++__first) if (*__first == __old_value) *__first = __new_value; } /** * @brief Replace each value in a sequence for which a predicate returns * true with another value. * @ingroup mutating_algorithms * @param __first A forward iterator. * @param __last A forward iterator. * @param __pred A predicate. * @param __new_value The replacement value. * @return replace_if() returns no value. * * For each iterator @c i in the range @p [__first,__last) if @p __pred(*i) * is true then the assignment @c *i = @p __new_value is performed. */ template<typename _ForwardIterator, typename _Predicate, typename _Tp> void replace_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, const _Tp& __new_value) { // concept requirements __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< _ForwardIterator>) __glibcxx_function_requires(_ConvertibleConcept<_Tp, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); for (; __first != __last; ++__first) if (__pred(*__first)) *__first = __new_value; } /** * @brief Assign the result of a function object to each value in a * sequence. * @ingroup mutating_algorithms * @param __first A forward iterator. * @param __last A forward iterator. * @param __gen A function object taking no arguments and returning * std::iterator_traits<_ForwardIterator>::value_type * @return generate() returns no value. * * Performs the assignment @c *i = @p __gen() for each @c i in the range * @p [__first,__last). */ template<typename _ForwardIterator, typename _Generator> void generate(_ForwardIterator __first, _ForwardIterator __last, _Generator __gen) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_GeneratorConcept<_Generator, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); for (; __first != __last; ++__first) *__first = __gen(); } /** * @brief Assign the result of a function object to each value in a * sequence. * @ingroup mutating_algorithms * @param __first A forward iterator. * @param __n The length of the sequence. * @param __gen A function object taking no arguments and returning * std::iterator_traits<_ForwardIterator>::value_type * @return The end of the sequence, @p __first+__n * * Performs the assignment @c *i = @p __gen() for each @c i in the range * @p [__first,__first+__n). * * _GLIBCXX_RESOLVE_LIB_DEFECTS * DR 865. More algorithms that throw away information */ template<typename _OutputIterator, typename _Size, typename _Generator> _OutputIterator generate_n(_OutputIterator __first, _Size __n, _Generator __gen) { // concept requirements __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, // "the type returned by a _Generator" __typeof__(__gen())>) for (__decltype(__n + 0) __niter = __n; __niter > 0; --__niter, ++__first) *__first = __gen(); return __first; } /** * @brief Copy a sequence, removing consecutive duplicate values. * @ingroup mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __result An output iterator. * @return An iterator designating the end of the resulting sequence. * * Copies each element in the range @p [__first,__last) to the range * beginning at @p __result, except that only the first element is copied * from groups of consecutive elements that compare equal. * unique_copy() is stable, so the relative order of elements that are * copied is unchanged. * * _GLIBCXX_RESOLVE_LIB_DEFECTS * DR 241. Does unique_copy() require CopyConstructible and Assignable? * * _GLIBCXX_RESOLVE_LIB_DEFECTS * DR 538. 241 again: Does unique_copy() require CopyConstructible and * Assignable? */ template<typename _InputIterator, typename _OutputIterator> inline _OutputIterator unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, typename iterator_traits<_InputIterator>::value_type>) __glibcxx_function_requires(_EqualityComparableConcept< typename iterator_traits<_InputIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return __result; return std::__unique_copy(__first, __last, __result, std::__iterator_category(__first), std::__iterator_category(__result)); } /** * @brief Copy a sequence, removing consecutive values using a predicate. * @ingroup mutating_algorithms * @param __first An input iterator. * @param __last An input iterator. * @param __result An output iterator. * @param __binary_pred A binary predicate. * @return An iterator designating the end of the resulting sequence. * * Copies each element in the range @p [__first,__last) to the range * beginning at @p __result, except that only the first element is copied * from groups of consecutive elements for which @p __binary_pred returns * true. * unique_copy() is stable, so the relative order of elements that are * copied is unchanged. * * _GLIBCXX_RESOLVE_LIB_DEFECTS * DR 241. Does unique_copy() require CopyConstructible and Assignable? */ template<typename _InputIterator, typename _OutputIterator, typename _BinaryPredicate> inline _OutputIterator unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryPredicate __binary_pred) { // concept requirements -- predicates checked later __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, typename iterator_traits<_InputIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return __result; return std::__unique_copy(__first, __last, __result, __binary_pred, std::__iterator_category(__first), std::__iterator_category(__result)); } /** * @brief Randomly shuffle the elements of a sequence. * @ingroup mutating_algorithms * @param __first A forward iterator. * @param __last A forward iterator. * @return Nothing. * * Reorder the elements in the range @p [__first,__last) using a random * distribution, so that every possible ordering of the sequence is * equally likely. */ template<typename _RandomAccessIterator> inline void random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last) { // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_requires_valid_range(__first, __last); if (__first != __last) for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) { _RandomAccessIterator __j = __first + std::rand() % ((__i - __first) + 1); if (__i != __j) std::iter_swap(__i, __j); } } /** * @brief Shuffle the elements of a sequence using a random number * generator. * @ingroup mutating_algorithms * @param __first A forward iterator. * @param __last A forward iterator. * @param __rand The RNG functor or function. * @return Nothing. * * Reorders the elements in the range @p [__first,__last) using @p __rand to * provide a random distribution. Calling @p __rand(N) for a positive * integer @p N should return a randomly chosen integer from the * range [0,N). */ template<typename _RandomAccessIterator, typename _RandomNumberGenerator> void random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, #if __cplusplus >= 201103L _RandomNumberGenerator&& __rand) #else _RandomNumberGenerator& __rand) #endif { // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return; for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) { _RandomAccessIterator __j = __first + __rand((__i - __first) + 1); if (__i != __j) std::iter_swap(__i, __j); } } /** * @brief Move elements for which a predicate is true to the beginning * of a sequence. * @ingroup mutating_algorithms * @param __first A forward iterator. * @param __last A forward iterator. * @param __pred A predicate functor. * @return An iterator @p middle such that @p __pred(i) is true for each * iterator @p i in the range @p [__first,middle) and false for each @p i * in the range @p [middle,__last). * * @p __pred must not modify its operand. @p partition() does not preserve * the relative ordering of elements in each group, use * @p stable_partition() if this is needed. */ template<typename _ForwardIterator, typename _Predicate> inline _ForwardIterator partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) { // concept requirements __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< _ForwardIterator>) __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); return std::__partition(__first, __last, __pred, std::__iterator_category(__first)); } /** * @brief Sort the smallest elements of a sequence. * @ingroup sorting_algorithms * @param __first An iterator. * @param __middle Another iterator. * @param __last Another iterator. * @return Nothing. * * Sorts the smallest @p (__middle-__first) elements in the range * @p [first,last) and moves them to the range @p [__first,__middle). The * order of the remaining elements in the range @p [__middle,__last) is * undefined. * After the sort if @e i and @e j are iterators in the range * @p [__first,__middle) such that i precedes j and @e k is an iterator in * the range @p [__middle,__last) then *j<*i and *k<*i are both false. */ template<typename _RandomAccessIterator> inline void partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>) __glibcxx_requires_valid_range(__first, __middle); __glibcxx_requires_valid_range(__middle, __last); std::__heap_select(__first, __middle, __last); std::sort_heap(__first, __middle); } /** * @brief Sort the smallest elements of a sequence using a predicate * for comparison. * @ingroup sorting_algorithms * @param __first An iterator. * @param __middle Another iterator. * @param __last Another iterator. * @param __comp A comparison functor. * @return Nothing. * * Sorts the smallest @p (__middle-__first) elements in the range * @p [__first,__last) and moves them to the range @p [__first,__middle). The * order of the remaining elements in the range @p [__middle,__last) is * undefined. * After the sort if @e i and @e j are iterators in the range * @p [__first,__middle) such that i precedes j and @e k is an iterator in * the range @p [__middle,__last) then @p *__comp(j,*i) and @p __comp(*k,*i) * are both false. */ template<typename _RandomAccessIterator, typename _Compare> inline void partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, _Compare __comp) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType, _ValueType>) __glibcxx_requires_valid_range(__first, __middle); __glibcxx_requires_valid_range(__middle, __last); std::__heap_select(__first, __middle, __last, __comp); std::sort_heap(__first, __middle, __comp); } /** * @brief Sort a sequence just enough to find a particular position. * @ingroup sorting_algorithms * @param __first An iterator. * @param __nth Another iterator. * @param __last Another iterator. * @return Nothing. * * Rearranges the elements in the range @p [__first,__last) so that @p *__nth * is the same element that would have been in that position had the * whole sequence been sorted. The elements either side of @p *__nth are * not completely sorted, but for any iterator @e i in the range * @p [__first,__nth) and any iterator @e j in the range @p [__nth,__last) it * holds that *j < *i is false. */ template<typename _RandomAccessIterator> inline void nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>) __glibcxx_requires_valid_range(__first, __nth); __glibcxx_requires_valid_range(__nth, __last); if (__first == __last || __nth == __last) return; std::__introselect(__first, __nth, __last, std::__lg(__last - __first) * 2); } /** * @brief Sort a sequence just enough to find a particular position * using a predicate for comparison. * @ingroup sorting_algorithms * @param __first An iterator. * @param __nth Another iterator. * @param __last Another iterator. * @param __comp A comparison functor. * @return Nothing. * * Rearranges the elements in the range @p [__first,__last) so that @p *__nth * is the same element that would have been in that position had the * whole sequence been sorted. The elements either side of @p *__nth are * not completely sorted, but for any iterator @e i in the range * @p [__first,__nth) and any iterator @e j in the range @p [__nth,__last) it * holds that @p __comp(*j,*i) is false. */ template<typename _RandomAccessIterator, typename _Compare> inline void nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType, _ValueType>) __glibcxx_requires_valid_range(__first, __nth); __glibcxx_requires_valid_range(__nth, __last); if (__first == __last || __nth == __last) return; std::__introselect(__first, __nth, __last, std::__lg(__last - __first) * 2, __comp); } /** * @brief Sort the elements of a sequence. * @ingroup sorting_algorithms * @param __first An iterator. * @param __last Another iterator. * @return Nothing. * * Sorts the elements in the range @p [__first,__last) in ascending order, * such that for each iterator @e i in the range @p [__first,__last-1), * *(i+1)<*i is false. * * The relative ordering of equivalent elements is not preserved, use * @p stable_sort() if this is needed. */ template<typename _RandomAccessIterator> inline void sort(_RandomAccessIterator __first, _RandomAccessIterator __last) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>) __glibcxx_requires_valid_range(__first, __last); if (__first != __last) { std::__introsort_loop(__first, __last, std::__lg(__last - __first) * 2); std::__final_insertion_sort(__first, __last); } } /** * @brief Sort the elements of a sequence using a predicate for comparison. * @ingroup sorting_algorithms * @param __first An iterator. * @param __last Another iterator. * @param __comp A comparison functor. * @return Nothing. * * Sorts the elements in the range @p [__first,__last) in ascending order, * such that @p __comp(*(i+1),*i) is false for every iterator @e i in the * range @p [__first,__last-1). * * The relative ordering of equivalent elements is not preserved, use * @p stable_sort() if this is needed. */ template<typename _RandomAccessIterator, typename _Compare> inline void sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType, _ValueType>) __glibcxx_requires_valid_range(__first, __last); if (__first != __last) { std::__introsort_loop(__first, __last, std::__lg(__last - __first) * 2, __comp); std::__final_insertion_sort(__first, __last, __comp); } } /** * @brief Merges two sorted ranges. * @ingroup sorting_algorithms * @param __first1 An iterator. * @param __first2 Another iterator. * @param __last1 Another iterator. * @param __last2 Another iterator. * @param __result An iterator pointing to the end of the merged range. * @return An iterator pointing to the first element <em>not less * than</em> @e val. * * Merges the ranges @p [__first1,__last1) and @p [__first2,__last2) into * the sorted range @p [__result, __result + (__last1-__first1) + * (__last2-__first2)). Both input ranges must be sorted, and the * output range must not overlap with either of the input ranges. * The sort is @e stable, that is, for equivalent elements in the * two ranges, elements from the first range will always come * before elements from the second. */ template<typename _InputIterator1, typename _InputIterator2, typename _OutputIterator> _OutputIterator merge(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) { typedef typename iterator_traits<_InputIterator1>::value_type _ValueType1; typedef typename iterator_traits<_InputIterator2>::value_type _ValueType2; // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType1>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType2>) __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>) __glibcxx_requires_sorted_set(__first1, __last1, __first2); __glibcxx_requires_sorted_set(__first2, __last2, __first1); while (__first1 != __last1 && __first2 != __last2) { if (*__first2 < *__first1) { *__result = *__first2; ++__first2; } else { *__result = *__first1; ++__first1; } ++__result; } return std::copy(__first2, __last2, std::copy(__first1, __last1, __result)); } /** * @brief Merges two sorted ranges. * @ingroup sorting_algorithms * @param __first1 An iterator. * @param __first2 Another iterator. * @param __last1 Another iterator. * @param __last2 Another iterator. * @param __result An iterator pointing to the end of the merged range. * @param __comp A functor to use for comparisons. * @return An iterator pointing to the first element "not less * than" @e val. * * Merges the ranges @p [__first1,__last1) and @p [__first2,__last2) into * the sorted range @p [__result, __result + (__last1-__first1) + * (__last2-__first2)). Both input ranges must be sorted, and the * output range must not overlap with either of the input ranges. * The sort is @e stable, that is, for equivalent elements in the * two ranges, elements from the first range will always come * before elements from the second. * * The comparison function should have the same effects on ordering as * the function used for the initial sort. */ template<typename _InputIterator1, typename _InputIterator2, typename _OutputIterator, typename _Compare> _OutputIterator merge(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) { typedef typename iterator_traits<_InputIterator1>::value_type _ValueType1; typedef typename iterator_traits<_InputIterator2>::value_type _ValueType2; // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType1>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType2>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType2, _ValueType1>) __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); while (__first1 != __last1 && __first2 != __last2) { if (__comp(*__first2, *__first1)) { *__result = *__first2; ++__first2; } else { *__result = *__first1; ++__first1; } ++__result; } return std::copy(__first2, __last2, std::copy(__first1, __last1, __result)); } /** * @brief Sort the elements of a sequence, preserving the relative order * of equivalent elements. * @ingroup sorting_algorithms * @param __first An iterator. * @param __last Another iterator. * @return Nothing. * * Sorts the elements in the range @p [__first,__last) in ascending order, * such that for each iterator @p i in the range @p [__first,__last-1), * @p *(i+1)<*i is false. * * The relative ordering of equivalent elements is preserved, so any two * elements @p x and @p y in the range @p [__first,__last) such that * @p x<y is false and @p y<x is false will have the same relative * ordering after calling @p stable_sort(). */ template<typename _RandomAccessIterator> inline void stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; typedef typename iterator_traits<_RandomAccessIterator>::difference_type _DistanceType; // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>) __glibcxx_requires_valid_range(__first, __last); _Temporary_buffer<_RandomAccessIterator, _ValueType> __buf(__first, __last); if (__buf.begin() == 0) std::__inplace_stable_sort(__first, __last); else std::__stable_sort_adaptive(__first, __last, __buf.begin(), _DistanceType(__buf.size())); } /** * @brief Sort the elements of a sequence using a predicate for comparison, * preserving the relative order of equivalent elements. * @ingroup sorting_algorithms * @param __first An iterator. * @param __last Another iterator. * @param __comp A comparison functor. * @return Nothing. * * Sorts the elements in the range @p [__first,__last) in ascending order, * such that for each iterator @p i in the range @p [__first,__last-1), * @p __comp(*(i+1),*i) is false. * * The relative ordering of equivalent elements is preserved, so any two * elements @p x and @p y in the range @p [__first,__last) such that * @p __comp(x,y) is false and @p __comp(y,x) is false will have the same * relative ordering after calling @p stable_sort(). */ template<typename _RandomAccessIterator, typename _Compare> inline void stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { typedef typename iterator_traits<_RandomAccessIterator>::value_type _ValueType; typedef typename iterator_traits<_RandomAccessIterator>::difference_type _DistanceType; // concept requirements __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType, _ValueType>) __glibcxx_requires_valid_range(__first, __last); _Temporary_buffer<_RandomAccessIterator, _ValueType> __buf(__first, __last); if (__buf.begin() == 0) std::__inplace_stable_sort(__first, __last, __comp); else std::__stable_sort_adaptive(__first, __last, __buf.begin(), _DistanceType(__buf.size()), __comp); } /** * @brief Return the union of two sorted ranges. * @ingroup set_algorithms * @param __first1 Start of first range. * @param __last1 End of first range. * @param __first2 Start of second range. * @param __last2 End of second range. * @return End of the output range. * @ingroup set_algorithms * * This operation iterates over both ranges, copying elements present in * each range in order to the output range. Iterators increment for each * range. When the current element of one range is less than the other, * that element is copied and the iterator advanced. If an element is * contained in both ranges, the element from the first range is copied and * both ranges advance. The output range may not overlap either input * range. */ template<typename _InputIterator1, typename _InputIterator2, typename _OutputIterator> _OutputIterator set_union(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) { typedef typename iterator_traits<_InputIterator1>::value_type _ValueType1; typedef typename iterator_traits<_InputIterator2>::value_type _ValueType2; // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType1>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType2>) __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>) __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>) __glibcxx_requires_sorted_set(__first1, __last1, __first2); __glibcxx_requires_sorted_set(__first2, __last2, __first1); while (__first1 != __last1 && __first2 != __last2) { if (*__first1 < *__first2) { *__result = *__first1; ++__first1; } else if (*__first2 < *__first1) { *__result = *__first2; ++__first2; } else { *__result = *__first1; ++__first1; ++__first2; } ++__result; } return std::copy(__first2, __last2, std::copy(__first1, __last1, __result)); } /** * @brief Return the union of two sorted ranges using a comparison functor. * @ingroup set_algorithms * @param __first1 Start of first range. * @param __last1 End of first range. * @param __first2 Start of second range. * @param __last2 End of second range. * @param __comp The comparison functor. * @return End of the output range. * @ingroup set_algorithms * * This operation iterates over both ranges, copying elements present in * each range in order to the output range. Iterators increment for each * range. When the current element of one range is less than the other * according to @p __comp, that element is copied and the iterator advanced. * If an equivalent element according to @p __comp is contained in both * ranges, the element from the first range is copied and both ranges * advance. The output range may not overlap either input range. */ template<typename _InputIterator1, typename _InputIterator2, typename _OutputIterator, typename _Compare> _OutputIterator set_union(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) { typedef typename iterator_traits<_InputIterator1>::value_type _ValueType1; typedef typename iterator_traits<_InputIterator2>::value_type _ValueType2; // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType1>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType2>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType1, _ValueType2>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType2, _ValueType1>) __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); while (__first1 != __last1 && __first2 != __last2) { if (__comp(*__first1, *__first2)) { *__result = *__first1; ++__first1; } else if (__comp(*__first2, *__first1)) { *__result = *__first2; ++__first2; } else { *__result = *__first1; ++__first1; ++__first2; } ++__result; } return std::copy(__first2, __last2, std::copy(__first1, __last1, __result)); } /** * @brief Return the intersection of two sorted ranges. * @ingroup set_algorithms * @param __first1 Start of first range. * @param __last1 End of first range. * @param __first2 Start of second range. * @param __last2 End of second range. * @return End of the output range. * @ingroup set_algorithms * * This operation iterates over both ranges, copying elements present in * both ranges in order to the output range. Iterators increment for each * range. When the current element of one range is less than the other, * that iterator advances. If an element is contained in both ranges, the * element from the first range is copied and both ranges advance. The * output range may not overlap either input range. */ template<typename _InputIterator1, typename _InputIterator2, typename _OutputIterator> _OutputIterator set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) { typedef typename iterator_traits<_InputIterator1>::value_type _ValueType1; typedef typename iterator_traits<_InputIterator2>::value_type _ValueType2; // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType1>) __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>) __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>) __glibcxx_requires_sorted_set(__first1, __last1, __first2); __glibcxx_requires_sorted_set(__first2, __last2, __first1); while (__first1 != __last1 && __first2 != __last2) if (*__first1 < *__first2) ++__first1; else if (*__first2 < *__first1) ++__first2; else { *__result = *__first1; ++__first1; ++__first2; ++__result; } return __result; } /** * @brief Return the intersection of two sorted ranges using comparison * functor. * @ingroup set_algorithms * @param __first1 Start of first range. * @param __last1 End of first range. * @param __first2 Start of second range. * @param __last2 End of second range. * @param __comp The comparison functor. * @return End of the output range. * @ingroup set_algorithms * * This operation iterates over both ranges, copying elements present in * both ranges in order to the output range. Iterators increment for each * range. When the current element of one range is less than the other * according to @p __comp, that iterator advances. If an element is * contained in both ranges according to @p __comp, the element from the * first range is copied and both ranges advance. The output range may not * overlap either input range. */ template<typename _InputIterator1, typename _InputIterator2, typename _OutputIterator, typename _Compare> _OutputIterator set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) { typedef typename iterator_traits<_InputIterator1>::value_type _ValueType1; typedef typename iterator_traits<_InputIterator2>::value_type _ValueType2; // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType1>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType1, _ValueType2>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType2, _ValueType1>) __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); while (__first1 != __last1 && __first2 != __last2) if (__comp(*__first1, *__first2)) ++__first1; else if (__comp(*__first2, *__first1)) ++__first2; else { *__result = *__first1; ++__first1; ++__first2; ++__result; } return __result; } /** * @brief Return the difference of two sorted ranges. * @ingroup set_algorithms * @param __first1 Start of first range. * @param __last1 End of first range. * @param __first2 Start of second range. * @param __last2 End of second range. * @return End of the output range. * @ingroup set_algorithms * * This operation iterates over both ranges, copying elements present in * the first range but not the second in order to the output range. * Iterators increment for each range. When the current element of the * first range is less than the second, that element is copied and the * iterator advances. If the current element of the second range is less, * the iterator advances, but no element is copied. If an element is * contained in both ranges, no elements are copied and both ranges * advance. The output range may not overlap either input range. */ template<typename _InputIterator1, typename _InputIterator2, typename _OutputIterator> _OutputIterator set_difference(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) { typedef typename iterator_traits<_InputIterator1>::value_type _ValueType1; typedef typename iterator_traits<_InputIterator2>::value_type _ValueType2; // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType1>) __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>) __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>) __glibcxx_requires_sorted_set(__first1, __last1, __first2); __glibcxx_requires_sorted_set(__first2, __last2, __first1); while (__first1 != __last1 && __first2 != __last2) if (*__first1 < *__first2) { *__result = *__first1; ++__first1; ++__result; } else if (*__first2 < *__first1) ++__first2; else { ++__first1; ++__first2; } return std::copy(__first1, __last1, __result); } /** * @brief Return the difference of two sorted ranges using comparison * functor. * @ingroup set_algorithms * @param __first1 Start of first range. * @param __last1 End of first range. * @param __first2 Start of second range. * @param __last2 End of second range. * @param __comp The comparison functor. * @return End of the output range. * @ingroup set_algorithms * * This operation iterates over both ranges, copying elements present in * the first range but not the second in order to the output range. * Iterators increment for each range. When the current element of the * first range is less than the second according to @p __comp, that element * is copied and the iterator advances. If the current element of the * second range is less, no element is copied and the iterator advances. * If an element is contained in both ranges according to @p __comp, no * elements are copied and both ranges advance. The output range may not * overlap either input range. */ template<typename _InputIterator1, typename _InputIterator2, typename _OutputIterator, typename _Compare> _OutputIterator set_difference(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) { typedef typename iterator_traits<_InputIterator1>::value_type _ValueType1; typedef typename iterator_traits<_InputIterator2>::value_type _ValueType2; // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType1>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType1, _ValueType2>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType2, _ValueType1>) __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); while (__first1 != __last1 && __first2 != __last2) if (__comp(*__first1, *__first2)) { *__result = *__first1; ++__first1; ++__result; } else if (__comp(*__first2, *__first1)) ++__first2; else { ++__first1; ++__first2; } return std::copy(__first1, __last1, __result); } /** * @brief Return the symmetric difference of two sorted ranges. * @ingroup set_algorithms * @param __first1 Start of first range. * @param __last1 End of first range. * @param __first2 Start of second range. * @param __last2 End of second range. * @return End of the output range. * @ingroup set_algorithms * * This operation iterates over both ranges, copying elements present in * one range but not the other in order to the output range. Iterators * increment for each range. When the current element of one range is less * than the other, that element is copied and the iterator advances. If an * element is contained in both ranges, no elements are copied and both * ranges advance. The output range may not overlap either input range. */ template<typename _InputIterator1, typename _InputIterator2, typename _OutputIterator> _OutputIterator set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) { typedef typename iterator_traits<_InputIterator1>::value_type _ValueType1; typedef typename iterator_traits<_InputIterator2>::value_type _ValueType2; // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType1>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType2>) __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>) __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>) __glibcxx_requires_sorted_set(__first1, __last1, __first2); __glibcxx_requires_sorted_set(__first2, __last2, __first1); while (__first1 != __last1 && __first2 != __last2) if (*__first1 < *__first2) { *__result = *__first1; ++__first1; ++__result; } else if (*__first2 < *__first1) { *__result = *__first2; ++__first2; ++__result; } else { ++__first1; ++__first2; } return std::copy(__first2, __last2, std::copy(__first1, __last1, __result)); } /** * @brief Return the symmetric difference of two sorted ranges using * comparison functor. * @ingroup set_algorithms * @param __first1 Start of first range. * @param __last1 End of first range. * @param __first2 Start of second range. * @param __last2 End of second range. * @param __comp The comparison functor. * @return End of the output range. * @ingroup set_algorithms * * This operation iterates over both ranges, copying elements present in * one range but not the other in order to the output range. Iterators * increment for each range. When the current element of one range is less * than the other according to @p comp, that element is copied and the * iterator advances. If an element is contained in both ranges according * to @p __comp, no elements are copied and both ranges advance. The output * range may not overlap either input range. */ template<typename _InputIterator1, typename _InputIterator2, typename _OutputIterator, typename _Compare> _OutputIterator set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) { typedef typename iterator_traits<_InputIterator1>::value_type _ValueType1; typedef typename iterator_traits<_InputIterator2>::value_type _ValueType2; // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType1>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _ValueType2>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType1, _ValueType2>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType2, _ValueType1>) __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); while (__first1 != __last1 && __first2 != __last2) if (__comp(*__first1, *__first2)) { *__result = *__first1; ++__first1; ++__result; } else if (__comp(*__first2, *__first1)) { *__result = *__first2; ++__first2; ++__result; } else { ++__first1; ++__first2; } return std::copy(__first2, __last2, std::copy(__first1, __last1, __result)); } /** * @brief Return the minimum element in a range. * @ingroup sorting_algorithms * @param __first Start of range. * @param __last End of range. * @return Iterator referencing the first instance of the smallest value. */ template<typename _ForwardIterator> _ForwardIterator min_element(_ForwardIterator __first, _ForwardIterator __last) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_LessThanComparableConcept< typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return __first; _ForwardIterator __result = __first; while (++__first != __last) if (*__first < *__result) __result = __first; return __result; } /** * @brief Return the minimum element in a range using comparison functor. * @ingroup sorting_algorithms * @param __first Start of range. * @param __last End of range. * @param __comp Comparison functor. * @return Iterator referencing the first instance of the smallest value * according to __comp. */ template<typename _ForwardIterator, typename _Compare> _ForwardIterator min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, typename iterator_traits<_ForwardIterator>::value_type, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return __first; _ForwardIterator __result = __first; while (++__first != __last) if (__comp(*__first, *__result)) __result = __first; return __result; } /** * @brief Return the maximum element in a range. * @ingroup sorting_algorithms * @param __first Start of range. * @param __last End of range. * @return Iterator referencing the first instance of the largest value. */ template<typename _ForwardIterator> _ForwardIterator max_element(_ForwardIterator __first, _ForwardIterator __last) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_LessThanComparableConcept< typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return __first; _ForwardIterator __result = __first; while (++__first != __last) if (*__result < *__first) __result = __first; return __result; } /** * @brief Return the maximum element in a range using comparison functor. * @ingroup sorting_algorithms * @param __first Start of range. * @param __last End of range. * @param __comp Comparison functor. * @return Iterator referencing the first instance of the largest value * according to __comp. */ template<typename _ForwardIterator, typename _Compare> _ForwardIterator max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, typename iterator_traits<_ForwardIterator>::value_type, typename iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) return __first; _ForwardIterator __result = __first; while (++__first != __last) if (__comp(*__result, *__first)) __result = __first; return __result; } _GLIBCXX_END_NAMESPACE_ALGO } // namespace std #endif /* _STL_ALGO_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/array�������������������������������������������������������������������������������������0000644�����������������00000022427�14763166030�0006643 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <array> -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/array * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_ARRAY #define _GLIBCXX_ARRAY 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <stdexcept> #include <bits/stl_algobase.h> #include <bits/range_access.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER template<typename _Tp, std::size_t _Nm> struct __array_traits { typedef _Tp _Type[_Nm]; static constexpr _Tp& _S_ref(const _Type& __t, std::size_t __n) noexcept { return const_cast<_Tp&>(__t[__n]); } }; template<typename _Tp> struct __array_traits<_Tp, 0> { struct _Type { }; static constexpr _Tp& _S_ref(const _Type&, std::size_t) noexcept { return *static_cast<_Tp*>(nullptr); } }; /** * @brief A standard container for storing a fixed size sequence of elements. * * @ingroup sequences * * Meets the requirements of a <a href="tables.html#65">container</a>, a * <a href="tables.html#66">reversible container</a>, and a * <a href="tables.html#67">sequence</a>. * * Sets support random access iterators. * * @tparam Tp Type of element. Required to be a complete type. * @tparam N Number of elements. */ template<typename _Tp, std::size_t _Nm> struct array { typedef _Tp value_type; typedef value_type* pointer; typedef const value_type* const_pointer; typedef value_type& reference; typedef const value_type& const_reference; typedef value_type* iterator; typedef const value_type* const_iterator; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // Support for zero-sized arrays mandatory. typedef _GLIBCXX_STD_C::__array_traits<_Tp, _Nm> _AT_Type; typename _AT_Type::_Type _M_elems; // No explicit construct/copy/destroy for aggregate type. // DR 776. void fill(const value_type& __u) { std::fill_n(begin(), size(), __u); } void swap(array& __other) noexcept(noexcept(swap(std::declval<_Tp&>(), std::declval<_Tp&>()))) { std::swap_ranges(begin(), end(), __other.begin()); } // Iterators. iterator begin() noexcept { return iterator(data()); } const_iterator begin() const noexcept { return const_iterator(data()); } iterator end() noexcept { return iterator(data() + _Nm); } const_iterator end() const noexcept { return const_iterator(data() + _Nm); } reverse_iterator rbegin() noexcept { return reverse_iterator(end()); } const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } reverse_iterator rend() noexcept { return reverse_iterator(begin()); } const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } const_iterator cbegin() const noexcept { return const_iterator(data()); } const_iterator cend() const noexcept { return const_iterator(data() + _Nm); } const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } // Capacity. constexpr size_type size() const noexcept { return _Nm; } constexpr size_type max_size() const noexcept { return _Nm; } constexpr bool empty() const noexcept { return size() == 0; } // Element access. reference operator[](size_type __n) { return _AT_Type::_S_ref(_M_elems, __n); } constexpr const_reference operator[](size_type __n) const noexcept { return _AT_Type::_S_ref(_M_elems, __n); } reference at(size_type __n) { if (__n >= _Nm) std::__throw_out_of_range(__N("array::at")); return _AT_Type::_S_ref(_M_elems, __n); } constexpr const_reference at(size_type __n) const { // Result of conditional expression must be an lvalue so use // boolean ? lvalue : (throw-expr, lvalue) return __n < _Nm ? _AT_Type::_S_ref(_M_elems, __n) : (std::__throw_out_of_range(__N("array::at")), _AT_Type::_S_ref(_M_elems, 0)); } reference front() { return *begin(); } constexpr const_reference front() const { return _AT_Type::_S_ref(_M_elems, 0); } reference back() { return _Nm ? *(end() - 1) : *end(); } constexpr const_reference back() const { return _Nm ? _AT_Type::_S_ref(_M_elems, _Nm - 1) : _AT_Type::_S_ref(_M_elems, 0); } pointer data() noexcept { return std::__addressof(_AT_Type::_S_ref(_M_elems, 0)); } const_pointer data() const noexcept { return std::__addressof(_AT_Type::_S_ref(_M_elems, 0)); } }; // Array comparisons. template<typename _Tp, std::size_t _Nm> inline bool operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return std::equal(__one.begin(), __one.end(), __two.begin()); } template<typename _Tp, std::size_t _Nm> inline bool operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return !(__one == __two); } template<typename _Tp, std::size_t _Nm> inline bool operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b) { return std::lexicographical_compare(__a.begin(), __a.end(), __b.begin(), __b.end()); } template<typename _Tp, std::size_t _Nm> inline bool operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return __two < __one; } template<typename _Tp, std::size_t _Nm> inline bool operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return !(__one > __two); } template<typename _Tp, std::size_t _Nm> inline bool operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return !(__one < __two); } // Specialized algorithms. template<typename _Tp, std::size_t _Nm> inline void swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two) noexcept(noexcept(__one.swap(__two))) { __one.swap(__two); } template<std::size_t _Int, typename _Tp, std::size_t _Nm> constexpr _Tp& get(array<_Tp, _Nm>& __arr) noexcept { static_assert(_Int < _Nm, "index is out of bounds"); return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>:: _S_ref(__arr._M_elems, _Int); } template<std::size_t _Int, typename _Tp, std::size_t _Nm> constexpr _Tp&& get(array<_Tp, _Nm>&& __arr) noexcept { static_assert(_Int < _Nm, "index is out of bounds"); return std::move(get<_Int>(__arr)); } template<std::size_t _Int, typename _Tp, std::size_t _Nm> constexpr const _Tp& get(const array<_Tp, _Nm>& __arr) noexcept { static_assert(_Int < _Nm, "index is out of bounds"); return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>:: _S_ref(__arr._M_elems, _Int); } _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // Tuple interface to class template array. /// tuple_size template<typename _Tp> class tuple_size; template<typename _Tp, std::size_t _Nm> struct tuple_size<_GLIBCXX_STD_C::array<_Tp, _Nm>> : public integral_constant<std::size_t, _Nm> { }; /// tuple_element template<std::size_t _Int, typename _Tp> class tuple_element; template<std::size_t _Int, typename _Tp, std::size_t _Nm> struct tuple_element<_Int, _GLIBCXX_STD_C::array<_Tp, _Nm>> { static_assert(_Int < _Nm, "index is out of bounds"); typedef _Tp type; }; _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #ifdef _GLIBCXX_DEBUG # include <debug/array> #endif #ifdef _GLIBCXX_PROFILE # include <profile/array> #endif #endif // C++11 #endif // _GLIBCXX_ARRAY �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/list��������������������������������������������������������������������������������������0000644�����������������00000005042�14763166030�0006472 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <list> -*- C++ -*- // Copyright (C) 2001-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file include/list * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_LIST #define _GLIBCXX_LIST 1 #pragma GCC system_header #include <bits/stl_algobase.h> #include <bits/allocator.h> #include <bits/range_access.h> #include <bits/stl_list.h> #include <bits/list.tcc> #ifdef _GLIBCXX_DEBUG # include <debug/list> #endif #ifdef _GLIBCXX_PROFILE # include <profile/list> #endif #endif /* _GLIBCXX_LIST */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/future������������������������������������������������������������������������������������0000644�����������������00000123320�14763166030�0007031 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// <future> -*- C++ -*- // Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) // any later version. // This library 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. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/future * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_FUTURE #define _GLIBCXX_FUTURE 1 #pragma GCC system_header #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else #include <functional> #include <mutex> #include <thread> #include <condition_variable> #include <system_error> #include <atomic> #include <bits/functexcept.h> #include <bits/unique_ptr.h> #include <bits/shared_ptr.h> #include <bits/uses_allocator.h> #include <bits/alloc_traits.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup futures Futures * @ingroup concurrency * * Classes for futures support. * @{ */ /// Error code for futures enum class future_errc { future_already_retrieved = 1, promise_already_satisfied, no_state, broken_promise }; /// Specialization. template<> struct is_error_code_enum<future_errc> : public true_type { }; /// Points to a statically-allocated object derived from error_category. const error_category& future_category() noexcept; /// Overload for make_error_code. inline error_code make_error_code(future_errc __errc) noexcept { return error_code(static_cast<int>(__errc), future_category()); } /// Overload for make_error_condition. inline error_condition make_error_condition(future_errc __errc) noexcept { return error_condition(static_cast<int>(__errc), future_category()); } /** * @brief Exception type thrown by futures. * @ingroup exceptions */ class future_error : public logic_error { error_code _M_code; public: explicit future_error(error_code __ec) : logic_error("std::future_error"), _M_code(__ec) { } virtual ~future_error() noexcept; virtual const char* what() const noexcept; const error_code& code() const noexcept { return _M_code; } }; // Forward declarations. template<typename _Res> class future; template<typename _Res> class shared_future; template<typename _Signature> class packaged_task; template<typename _Res> class promise; /// Launch code for futures enum class launch { async = 1, deferred = 2 }; constexpr launch operator&(launch __x, launch __y) { return static_cast<launch>( static_cast<int>(__x) & static_cast<int>(__y)); } constexpr launch operator|(launch __x, launch __y) { return static_cast<launch>( static_cast<int>(__x) | static_cast<int>(__y)); } constexpr launch operator^(launch __x, launch __y) { return static_cast<launch>( static_cast<int>(__x) ^ static_cast<int>(__y)); } constexpr launch operator~(launch __x) { return static_cast<launch>(~static_cast<int>(__x)); } inline launch& operator&=(launch& __x, launch __y) { return __x = __x & __y; } inline launch& operator|=(launch& __x, launch __y) { return __x = __x | __y; } inline launch& operator^=(launch& __x, launch __y) { return __x = __x ^ __y; } /// Status code for futures enum class future_status { ready, timeout, deferred }; template<typename _Fn, typename... _Args> future<typename result_of<_Fn(_Args...)>::type> async(launch __policy, _Fn&& __fn, _Args&&... __args); template<typename _Fn, typename... _Args> future<typename result_of<_Fn(_Args...)>::type> async(_Fn&& __fn, _Args&&... __args); #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \ && (ATOMIC_INT_LOCK_FREE > 1) /// Base class and enclosing scope. struct __future_base { /// Base class for results. struct _Result_base { exception_ptr _M_error; _Result_base(const _Result_base&) = delete; _Result_base& operator=(const _Result_base&) = delete; // _M_destroy() allows derived classes to control deallocation virtual void _M_destroy() = 0; struct _Deleter { void operator()(_Result_base* __fr) const { __fr->_M_destroy(); } }; protected: _Result_base(); virtual ~_Result_base(); }; /// Result. template<typename _Res> struct _Result : _Result_base { private: typedef alignment_of<_Res> __a_of; typedef aligned_storage<sizeof(_Res), __a_of::value> __align_storage; typedef typename __align_storage::type __align_type; __align_type _M_storage; bool _M_initialized; public: typedef _Res result_type; _Result() noexcept : _M_initialized() { } ~_Result() { if (_M_initialized) _M_value().~_Res(); } // Return lvalue, future will add const or rvalue-reference _Res& _M_value() noexcept { return *static_cast<_Res*>(_M_addr()); } void _M_set(const _Res& __res) { ::new (_M_addr()) _Res(__res); _M_initialized = true; } void _M_set(_Res&& __res) { ::new (_M_addr()) _Res(std::move(__res)); _M_initialized = true; } private: void _M_destroy() { delete this; } void* _M_addr() noexcept { return static_cast<void*>(&_M_storage); } }; /// A unique_ptr based on the instantiating type. template<typename _Res> using _Ptr = unique_ptr<_Res, _Result_base::_Deleter>; /// Result_alloc. template<typename _Res, typename _Alloc> struct _Result_alloc final : _Result<_Res>, _Alloc { typedef typename allocator_traits<_Alloc>::template rebind_alloc<_Result_alloc> __allocator_type; explicit _Result_alloc(const _Alloc& __a) : _Result<_Res>(), _Alloc(__a) { } private: void _M_destroy() { typedef allocator_traits<__allocator_type> __traits; __allocator_type __a(*this); __traits::destroy(__a, this); __traits::deallocate(__a, this, 1); } }; template<typename _Res, typename _Allocator> static _Ptr<_Result_alloc<_Res, _Allocator>> _S_allocate_result(const _Allocator& __a) { typedef _Result_alloc<_Res, _Allocator> __result_type; typedef allocator_traits<typename __result_type::__allocator_type> __traits; typename __traits::allocator_type __a2(__a); __result_type* __p = __traits::allocate(__a2, 1); __try { __traits::construct(__a2, __p, __a); } __catch(...) { __traits::deallocate(__a2, __p, 1); __throw_exception_again; } return _Ptr<__result_type>(__p); } template<typename _Res, typename _Tp> static _Ptr<_Result<_Res>> _S_allocate_result(const std::allocator<_Tp>& __a) { return _Ptr<_Result<_Res>>(new _Result<_Res>); } /// Base class for state between a promise and one or more /// associated futures. class _State_base { typedef _Ptr<_Result_base> _Ptr_type; _Ptr_type _M_result; mutex _M_mutex; condition_variable _M_cond; atomic_flag _M_retrieved; once_flag _M_once; public: _State_base() noexcept : _M_result(), _M_retrieved(ATOMIC_FLAG_INIT) { } _State_base(const _State_base&) = delete; _State_base& operator=(const _State_base&) = delete; virtual ~_State_base(); _Result_base& wait() { _M_run_deferred(); unique_lock<mutex> __lock(_M_mutex); _M_cond.wait(__lock, [&] { return _M_ready(); }); return *_M_result; } template<typename _Rep, typename _Period> future_status wait_for(const chrono::duration<_Rep, _Period>& __rel) { unique_lock<mutex> __lock(_M_mutex); if (_M_cond.wait_for(__lock, __rel, [&] { return _M_ready(); })) return future_status::ready; return future_status::timeout; } template<typename _Clock, typename _Duration> future_status wait_until(const chrono::time_point<_Clock, _Duration>& __abs) { unique_lock<mutex> __lock(_M_mutex); if (_M_cond.wait_until(__lock, __abs, [&] { return _M_ready(); })) return future_status::ready; return future_status::timeout; } void _M_set_result(function<_Ptr_type()> __res, bool __ignore_failure = false) { bool __set = false; // all calls to this function are serialized, // side-effects of invoking __res only happen once call_once(_M_once, &_State_base::_M_do_set, this, ref(__res), ref(__set)); if (__set) _M_cond.notify_all(); else if (!__ignore_failure) __throw_future_error(int(future_errc::promise_already_satisfied)); } void _M_break_promise(_Ptr_type __res) { if (static_cast<bool>(__res)) { error_code __ec(make_error_code(future_errc::broken_promise)); __res->_M_error = copy_exception(future_error(__ec)); { lock_guard<mutex> __lock(_M_mutex); _M_result.swap(__res); } _M_cond.notify_all(); } } // Called when this object is passed to a future. void _M_set_retrieved_flag() { if (_M_retrieved.test_and_set()) __throw_future_error(int(future_errc::future_already_retrieved)); } template<typename _Res, typename _Arg> struct _Setter; // set lvalues template<typename _Res, typename _Arg> struct _Setter<_Res, _Arg&> { // check this is only used by promise<R>::set_value(const R&) // or promise<R>::set_value(R&) static_assert(is_same<_Res, _Arg&>::value // promise<R&> || is_same<const _Res, _Arg>::value, // promise<R> "Invalid specialisation"); typename promise<_Res>::_Ptr_type operator()() { _State_base::_S_check(_M_promise->_M_future); _M_promise->_M_storage->_M_set(_M_arg); return std::move(_M_promise->_M_storage); } promise<_Res>* _M_promise; _Arg& _M_arg; }; // set rvalues template<typename _Res> struct _Setter<_Res, _Res&&> { typename promise<_Res>::_Ptr_type operator()() { _State_base::_S_check(_M_promise->_M_future); _M_promise->_M_storage->_M_set(std::move(_M_arg)); return std::move(_M_promise->_M_storage); } promise<_Res>* _M_promise; _Res& _M_arg; }; struct __exception_ptr_tag { }; // set exceptions template<typename _Res> struct _Setter<_Res, __exception_ptr_tag> { typename promise<_Res>::_Ptr_type operator()() { _State_base::_S_check(_M_promise->_M_future); _M_promise->_M_storage->_M_error = _M_ex; return std::move(_M_promise->_M_storage); } promise<_Res>* _M_promise; exception_ptr& _M_ex; }; template<typename _Res, typename _Arg> static _Setter<_Res, _Arg&&> __setter(promise<_Res>* __prom, _Arg&& __arg) { return _Setter<_Res, _Arg&&>{ __prom, __arg }; } template<typename _Res> static _Setter<_Res, __exception_ptr_tag> __setter(exception_ptr& __ex, promise<_Res>* __prom) { return _Setter<_Res, __exception_ptr_tag>{ __prom, __ex }; } static _Setter<void, void> __setter(promise<void>* __prom); template<typename _Tp> static void _S_check(const shared_ptr<_Tp>& __p) { if (!static_cast<bool>(__p)) __throw_future_error((int)future_errc::no_state); } private: void _M_do_set(function<_Ptr_type()>& __f, bool& __set) { _Ptr_type __res = __f(); { lock_guard<mutex> __lock(_M_mutex); _M_result.swap(__res); } __set = true; } bool _M_ready() const noexcept { return static_cast<bool>(_M_result); } // Misnamed: waits for completion of async function. virtual void _M_run_deferred() { } }; template<typename _BoundFn, typename = typename _BoundFn::result_type> class _Deferred_state; class _Async_state_common; template<typename _BoundFn, typename = typename _BoundFn::result_type> class _Async_state_impl; template<typename _Signature> class _Task_state_base; template<typename _Fn, typename _Alloc, typename _Signature> class _Task_state; template<typename _BoundFn> static std::shared_ptr<_State_base> _S_make_deferred_state(_BoundFn&& __fn); template<typename _BoundFn> static std::shared_ptr<_State_base> _S_make_async_state(_BoundFn&& __fn); template<typename _Res_ptr, typename _Res = typename _Res_ptr::element_type::result_type> struct _Task_setter; template<typename _Res_ptr, typename _BoundFn> static _Task_setter<_Res_ptr> _S_task_setter(_Res_ptr& __ptr, _BoundFn&& __call) { return _Task_setter<_Res_ptr>{ __ptr, std::ref(__call) }; } }; /// Partial specialization for reference types. template<typename _Res> struct __future_base::_Result<_Res&> : __future_base::_Result_base { typedef _Res& result_type; _Result() noexcept : _M_value_ptr() { } void _M_set(_Res& __res) noexcept { _M_value_ptr = &__res; } _Res& _M_get() noexcept { return *_M_value_ptr; } private: _Res* _M_value_ptr; void _M_destroy() { delete this; } }; /// Explicit specialization for void. template<> struct __future_base::_Result<void> : __future_base::_Result_base { typedef void result_type; private: void _M_destroy() { delete this; } }; /// Common implementation for future and shared_future. template<typename _Res> class __basic_future : public __future_base { protected: typedef shared_ptr<_State_base> __state_type; typedef __future_base::_Result<_Res>& __result_type; private: __state_type _M_state; public: // Disable copying. __basic_future(const __basic_future&) = delete; __basic_future& operator=(const __basic_future&) = delete; bool valid() const noexcept { return static_cast<bool>(_M_state); } void wait() const { _State_base::_S_check(_M_state); _M_state->wait(); } template<typename _Rep, typename _Period> future_status wait_for(const chrono::duration<_Rep, _Period>& __rel) const { _State_base::_S_check(_M_state); return _M_state->wait_for(__rel); } template<typename _Clock, typename _Duration> future_status wait_until(const chrono::time_point<_Clock, _Duration>& __abs) const { _State_base::_S_check(_M_state); return _M_state->wait_until(__abs); } protected: /// Wait for the state to be ready and rethrow any stored exception __result_type _M_get_result() const { _State_base::_S_check(_M_state); _Result_base& __res = _M_state->wait(); if (!(__res._M_error == 0)) rethrow_exception(__res._M_error); return static_cast<__result_type>(__res); } void _M_swap(__basic_future& __that) noexcept { _M_state.swap(__that._M_state); } // Construction of a future by promise::get_future() explicit __basic_future(const __state_type& __state) : _M_state(__state) { _State_base::_S_check(_M_state); _M_state->_M_set_retrieved_flag(); } // Copy construction from a shared_future explicit __basic_future(const shared_future<_Res>&) noexcept; // Move construction from a shared_future explicit __basic_future(shared_future<_Res>&&) noexcept; // Move construction from a future explicit __basic_future(future<_Res>&&) noexcept; constexpr __basic_future() noexcept : _M_state() { } struct _Reset { explicit _Reset(__basic_future& __fut) noexcept : _M_fut(__fut) { } ~_Reset() { _M_fut._M_state.reset(); } __basic_future& _M_fut; }; }; /// Primary template for future. template<typename _Res> class future : public __basic_future<_Res> { friend class promise<_Res>; template<typename> friend class packaged_task; template<typename _Fn, typename... _Args> friend future<typename result_of<_Fn(_Args...)>::type> async(launch, _Fn&&, _Args&&...); typedef __basic_future<_Res> _Base_type; typedef typename _Base_type::__state_type __state_type; explicit future(const __state_type& __state) : _Base_type(__state) { } public: constexpr future() noexcept : _Base_type() { } /// Move constructor future(future&& __uf) noexcept : _Base_type(std::move(__uf)) { } // Disable copying future(const future&) = delete; future& operator=(const future&) = delete; future& operator=(future&& __fut) noexcept { future(std::move(__fut))._M_swap(*this); return *this; } /// Retrieving the value _Res get() { typename _Base_type::_Reset __reset(*this); return std::move(this->_M_get_result()._M_value()); } shared_future<_Res> share(); }; /// Partial specialization for future<R&> template<typename _Res> class future<_Res&> : public __basic_future<_Res&> { friend class promise<_Res&>; template<typename> friend class packaged_task; template<typename _Fn, typename... _Args> friend future<typename result_of<_Fn(_Args...)>::type> async(launch, _Fn&&, _Args&&...); typedef __basic_future<_Res&> _Base_type; typedef typename _Base_type::__state_type __state_type; explicit future(const __state_type& __state) : _Base_type(__state) { } public: constexpr future() noexcept : _Base_type() { } /// Move constructor future(future&& __uf) noexcept : _Base_type(std::move(__uf)) { } // Disable copying future(const future&) = delete; future& operator=(const future&) = delete; future& operator=(future&& __fut) noexcept { future(std::move(__fut))._M_swap(*this); return *this; } /// Retrieving the value _Res& get() { typename _Base_type::_Reset __reset(*this); return this->_M_get_result()._M_get(); } shared_future<_Res&> share(); }; /// Explicit specialization for future<void> template<> class future<void> : public __basic_future<void> { friend class promise<void>; template<typename> friend class packaged_task; template<typename _Fn, typename... _Args> friend future<typename result_of<_Fn(_Args...)>::type> async(launch, _Fn&&, _Args&&...); typedef __basic_future<void> _Base_type; typedef typename _Base_type::__state_type __state_type; explicit future(const __state_type& __state) : _Base_type(__state) { } public: constexpr future() noexcept : _Base_type() { } /// Move constructor future(future&& __uf) noexcept : _Base_type(std::move(__uf)) { } // Disable copying future(const future&) = delete; future& operator=(const future&) = delete; future& operator=(future&& __fut) noexcept { future(std::move(__fut))._M_swap(*this); return *this; } /// Retrieving the value void get() { typename _Base_type::_Reset __reset(*this); this->_M_get_result(); } shared_future<void> share(); }; /// Primary template for shared_future. template<typename _Res> class shared_future : public __basic_future<_Res> { typedef __basic_future<_Res> _Base_type; public: constexpr shared_future() noexcept : _Base_type() { } /// Copy constructor shared_future(const shared_future& __sf) : _Base_type(__sf) { } /// Construct from a future rvalue shared_future(future<_Res>&& __uf) noexcept : _Base_type(std::move(__uf)) { } /// Construct from a shared_future rvalue shared_future(shared_future&& __sf) noexcept : _Base_type(std::move(__sf)) { } shared_future& operator=(const shared_future& __sf) { shared_future(__sf)._M_swap(*this); return *this; } shared_future& operator=(shared_future&& __sf) noexcept { shared_future(std::move(__sf))._M_swap(*this); return *this; } /// Retrieving the value const _Res& get() const { return this->_M_get_result()._M_value(); } }; /// Partial specialization for shared_future<R&> template<typename _Res> class shared_future<_Res&> : public __basic_future<_Res&> { typedef __basic_future<_Res&> _Base_type; public: constexpr shared_future() noexcept : _Base_type() { } /// Copy constructor shared_future(const shared_future& __sf) : _Base_type(__sf) { } /// Construct from a future rvalue shared_future(future<_Res&>&& __uf) noexcept : _Base_type(std::move(__uf)) { } /// Construct from a shared_future rvalue shared_future(shared_future&& __sf) noexcept : _Base_type(std::move(__sf)) { } shared_future& operator=(const shared_future& __sf) { shared_future(__sf)._M_swap(*this); return *this; } shared_future& operator=(shared_future&& __sf) noexcept { shared_future(std::move(__sf))._M_swap(*this); return *this; } /// Retrieving the value _Res& get() const { return this->_M_get_result()._M_get(); } }; /// Explicit specialization for shared_future<void> template<> class shared_future<void> : public __basic_future<void> { typedef __basic_future<void> _Base_type; public: constexpr shared_future() noexcept : _Base_type() { } /// Copy constructor shared_future(const shared_future& __sf) : _Base_type(__sf) { } /// Construct from a future rvalue shared_future(future<void>&& __uf) noexcept : _Base_type(std::move(__uf)) { } /// Construct from a shared_future rvalue shared_future(shared_future&& __sf) noexcept : _Base_type(std::move(__sf)) { } shared_future& operator=(const shared_future& __sf) { shared_future(__sf)._M_swap(*this); return *this; } shared_future& operator=(shared_future&& __sf) noexcept { shared_future(std::move(__sf))._M_swap(*this); return *this; } // Retrieving the value void get() const { this->_M_get_result(); } }; // Now we can define the protected __basic_future constructors. template<typename _Res> inline __basic_future<_Res>:: __basic_future(const shared_future<_Res>& __sf) noexcept : _M_state(__sf._M_state) { } template<typename _Res> inline __basic_future<_Res>:: __basic_future(shared_future<_Res>&& __sf) noexcept : _M_state(std::move(__sf._M_state)) { } template<typename _Res> inline __basic_future<_Res>:: __basic_future(future<_Res>&& __uf) noexcept : _M_state(std::move(__uf._M_state)) { } template<typename _Res> inline shared_future<_Res> future<_Res>::share() { return shared_future<_Res>(std::move(*this)); } template<typename _Res> inline shared_future<_Res&> future<_Res&>::share() { return shared_future<_Res&>(std::move(*this)); } inline shared_future<void> future<void>::share() { return shared_future<void>(std::move(*this)); } /// Primary template for promise template<typename _Res> class promise { typedef __future_base::_State_base _State; typedef __future_base::_Result<_Res> _Res_type; typedef __future_base::_Ptr<_Res_type> _Ptr_type; template<typename, typename> friend class _State::_Setter; shared_ptr<_State> _M_future; _Ptr_type _M_storage; public: promise() : _M_future(std::make_shared<_State>()), _M_storage(new _Res_type()) { } promise(promise&& __rhs) noexcept : _M_future(std::move(__rhs._M_future)), _M_storage(std::move(__rhs._M_storage)) { } template<typename _Allocator> promise(allocator_arg_t, const _Allocator& __a) : _M_future(std::allocate_shared<_State>(__a)), _M_storage(__future_base::_S_allocate_result<_Res>(__a)) { } template<typename _Allocator> promise(allocator_arg_t, const _Allocator&, promise&& __rhs) : _M_future(std::move(__rhs._M_future)), _M_storage(std::move(__rhs._M_storage)) { } promise(const promise&) = delete; ~promise() { if (static_cast<bool>(_M_future) && !_M_future.unique()) _M_future->_M_break_promise(std::move(_M_storage)); } // Assignment promise& operator=(promise&& __rhs) noexcept { promise(std::move(__rhs)).swap(*this); return *this; } promise& operator=(const promise&) = delete; void swap(promise& __rhs) noexcept { _M_future.swap(__rhs._M_future); _M_storage.swap(__rhs._M_storage); } // Retrieving the result future<_Res> get_future() { return future<_Res>(_M_future); } // Setting the result void set_value(const _Res& __r) { auto __future = _M_future; auto __setter = _State::__setter(this, __r); __future->_M_set_result(std::move(__setter)); } void set_value(_Res&& __r) { auto __future = _M_future; auto __setter = _State::__setter(this, std::move(__r)); __future->_M_set_result(std::move(__setter)); } void set_exception(exception_ptr __p) { auto __future = _M_future; auto __setter = _State::__setter(__p, this); __future->_M_set_result(std::move(__setter)); } }; template<typename _Res> inline void swap(promise<_Res>& __x, promise<_Res>& __y) noexcept { __x.swap(__y); } template<typename _Res, typename _Alloc> struct uses_allocator<promise<_Res>, _Alloc> : public true_type { }; /// Partial specialization for promise<R&> template<typename _Res> class promise<_Res&> { typedef __future_base::_State_base _State; typedef __future_base::_Result<_Res&> _Res_type; typedef __future_base::_Ptr<_Res_type> _Ptr_type; template<typename, typename> friend class _State::_Setter; shared_ptr<_State> _M_future; _Ptr_type _M_storage; public: promise() : _M_future(std::make_shared<_State>()), _M_storage(new _Res_type()) { } promise(promise&& __rhs) noexcept : _M_future(std::move(__rhs._M_future)), _M_storage(std::move(__rhs._M_storage)) { } template<typename _Allocator> promise(allocator_arg_t, const _Allocator& __a) : _M_future(std::allocate_shared<_State>(__a)), _M_storage(__future_base::_S_allocate_result<_Res&>(__a)) { } template<typename _Allocator> promise(allocator_arg_t, const _Allocator&, promise&& __rhs) : _M_future(std::move(__rhs._M_future)), _M_storage(std::move(__rhs._M_storage)) { } promise(const promise&) = delete; ~promise() { if (static_cast<bool>(_M_future) && !_M_future.unique()) _M_future->_M_break_promise(std::move(_M_storage)); } // Assignment promise& operator=(promise&& __rhs) noexcept { promise(std::move(__rhs)).swap(*this); return *this; } promise& operator=(const promise&) = delete; void swap(promise& __rhs) noexcept { _M_future.swap(__rhs._M_future); _M_storage.swap(__rhs._M_storage); } // Retrieving the result future<_Res&> get_future() { return future<_Res&>(_M_future); } // Setting the result void set_value(_Res& __r) { auto __future = _M_future; auto __setter = _State::__setter(this, __r); __future->_M_set_result(std::move(__setter)); } void set_exception(exception_ptr __p) { auto __future = _M_future; auto __setter = _State::__setter(__p, this); __future->_M_set_result(std::move(__setter)); } }; /// Explicit specialization for promise<void> template<> class promise<void> { typedef __future_base::_State_base _State; typedef __future_base::_Result<void> _Res_type; typedef __future_base::_Ptr<_Res_type> _Ptr_type; template<typename, typename> friend class _State::_Setter; shared_ptr<_State> _M_future; _Ptr_type _M_storage; public: promise() : _M_future(std::make_shared<_State>()), _M_storage(new _Res_type()) { } promise(promise&& __rhs) noexcept : _M_future(std::move(__rhs._M_future)), _M_storage(std::move(__rhs._M_storage)) { } template<typename _Allocator> promise(allocator_arg_t, const _Allocator& __a) : _M_future(std::allocate_shared<_State>(__a)), _M_storage(__future_base::_S_allocate_result<void>(__a)) { } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2095. missing constructors needed for uses-allocator construction template<typename _Allocator> promise(allocator_arg_t, const _Allocator&, promise&& __rhs) : _M_future(std::move(__rhs._M_future)), _M_storage(std::move(__rhs._M_storage)) { } promise(const promise&) = delete; ~promise() { if (static_cast<bool>(_M_future) && !_M_future.unique()) _M_future->_M_break_promise(std::move(_M_storage)); } // Assignment promise& operator=(promise&& __rhs) noexcept { promise(std::move(__rhs)).swap(*this); return *this; } promise& operator=(const promise&) = delete; void swap(promise& __rhs) noexcept { _M_future.swap(__rhs._M_future); _M_storage.swap(__rhs._M_storage); } // Retrieving the result future<void> get_future() { return future<void>(_M_future); } // Setting the result void set_value(); void set_exception(exception_ptr __p) { auto __future = _M_future; auto __setter = _State::__setter(__p, this); __future->_M_set_result(std::move(__setter)); } }; // set void template<> struct __future_base::_State_base::_Setter<void, void> { promise<void>::_Ptr_type operator()() { _State_base::_S_check(_M_promise->_M_future); return std::move(_M_promise->_M_storage); } promise<void>* _M_promise; }; inline __future_base::_State_base::_Setter<void, void> __future_base::_State_base::__setter(promise<void>* __prom) { return _Setter<void, void>{ __prom }; } inline void promise<void>::set_value() { auto __future = _M_future; auto __setter = _State::__setter(this); __future->_M_set_result(std::move(__setter)); } template<typename _Ptr_type, typename _Res> struct __future_base::_Task_setter { _Ptr_type operator()() { __try { _M_result->_M_set(_M_fn()); } __catch(...) { _M_result->_M_error = current_exception(); } return std::move(_M_result); } _Ptr_type& _M_result; std::function<_Res()> _M_fn; }; template<typename _Ptr_type> struct __future_base::_Task_setter<_Ptr_type, void> { _Ptr_type operator()() { __try { _M_fn(); } __catch(...) { _M_result->_M_error = current_exception(); } return std::move(_M_result); } _Ptr_type& _M_result; std::function<void()> _M_fn; }; template<typename _Res, typename... _Args> struct __future_base::_Task_state_base<_Res(_Args...)> : __future_base::_State_base { typedef _Res _Res_type; template<typename _Alloc> _Task_state_base(const _Alloc& __a) : _M_result(_S_allocate_result<_Res>(__a)) { } virtual void _M_run(_Args... __args) = 0; virtual shared_ptr<_Task_state_base> _M_reset() = 0; typedef __future_base::_Ptr<_Result<_Res>> _Ptr_type; _Ptr_type _M_result; }; template<typename _Fn, typename _Alloc, typename _Res, typename... _Args> struct __future_base::_Task_state<_Fn, _Alloc, _Res(_Args...)> final : __future_base::_Task_state_base<_Res(_Args...)> { template<typename _Fn2> _Task_state(_Fn2&& __fn, const _Alloc& __a) : _Task_state_base<_Res(_Args...)>(__a), _M_impl(std::forward<_Fn2>(__fn), __a) { } private: virtual void _M_run(_Args... __args) { // bound arguments decay so wrap lvalue references auto __boundfn = std::__bind_simple(std::ref(_M_impl._M_fn), _S_maybe_wrap_ref(std::forward<_Args>(__args))...); auto __setter = _S_task_setter(this->_M_result, std::move(__boundfn)); this->_M_set_result(std::move(__setter)); } virtual shared_ptr<_Task_state_base<_Res(_Args...)>> _M_reset(); template<typename _Tp> static reference_wrapper<_Tp> _S_maybe_wrap_ref(_Tp& __t) { return std::ref(__t); } template<typename _Tp> static typename enable_if<!is_lvalue_reference<_Tp>::value, _Tp>::type&& _S_maybe_wrap_ref(_Tp&& __t) { return std::forward<_Tp>(__t); } struct _Impl : _Alloc { template<typename _Fn2> _Impl(_Fn2&& __fn, const _Alloc& __a) : _Alloc(__a), _M_fn(std::forward<_Fn2>(__fn)) { } _Fn _M_fn; } _M_impl; }; template<typename _Signature, typename _Fn, typename _Alloc> static shared_ptr<__future_base::_Task_state_base<_Signature>> __create_task_state(_Fn&& __fn, const _Alloc& __a) { typedef typename decay<_Fn>::type _Fn2; typedef __future_base::_Task_state<_Fn2, _Alloc, _Signature> _State; return std::allocate_shared<_State>(__a, std::forward<_Fn>(__fn), __a); } template<typename _Fn, typename _Alloc, typename _Res, typename... _Args> shared_ptr<__future_base::_Task_state_base<_Res(_Args...)>> __future_base::_Task_state<_Fn, _Alloc, _Res(_Args...)>::_M_reset() { return __create_task_state<_Res(_Args...)>(std::move(_M_impl._M_fn), static_cast<_Alloc&>(_M_impl)); } template<typename _Task, typename _Fn, bool = is_same<_Task, typename decay<_Fn>::type>::value> struct __constrain_pkgdtask { typedef void __type; }; template<typename _Task, typename _Fn> struct __constrain_pkgdtask<_Task, _Fn, true> { }; /// packaged_task template<typename _Res, typename... _ArgTypes> class packaged_task<_Res(_ArgTypes...)> { typedef __future_base::_Task_state_base<_Res(_ArgTypes...)> _State_type; shared_ptr<_State_type> _M_state; public: // Construction and destruction packaged_task() noexcept { } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2095. missing constructors needed for uses-allocator construction template<typename _Allocator> packaged_task(allocator_arg_t, const _Allocator& __a) noexcept { } template<typename _Fn, typename = typename __constrain_pkgdtask<packaged_task, _Fn>::__type> explicit packaged_task(_Fn&& __fn) : packaged_task(allocator_arg, std::allocator<int>(), std::forward<_Fn>(__fn)) { } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2097. packaged_task constructors should be constrained template<typename _Fn, typename _Alloc, typename = typename __constrain_pkgdtask<packaged_task, _Fn>::__type> explicit packaged_task(allocator_arg_t, const _Alloc& __a, _Fn&& __fn) : _M_state(__create_task_state<_Res(_ArgTypes...)>( std::forward<_Fn>(__fn), __a)) { } ~packaged_task() { if (static_cast<bool>(_M_state) && !_M_state.unique()) _M_state->_M_break_promise(std::move(_M_state->_M_result)); } // No copy packaged_task(const packaged_task&) = delete; packaged_task& operator=(const packaged_task&) = delete; template<typename _Allocator> packaged_task(allocator_arg_t, const _Allocator&, const packaged_task&) = delete; // Move support packaged_task(packaged_task&& __other) noexcept { this->swap(__other); } template<typename _Allocator> packaged_task(allocator_arg_t, const _Allocator&, packaged_task&& __other) noexcept { this->swap(__other); } packaged_task& operator=(packaged_task&& __other) noexcept { packaged_task(std::move(__other)).swap(*this); return *this; } void swap(packaged_task& __other) noexcept { _M_state.swap(__other._M_state); } bool valid() const noexcept { return static_cast<bool>(_M_state); } // Result retrieval future<_Res> get_future() { return future<_Res>(_M_state); } // Execution void operator()(_ArgTypes... __args) { __future_base::_State_base::_S_check(_M_state); auto __state = _M_state; __state->_M_run(std::forward<_ArgTypes>(__args)...); } void reset() { __future_base::_State_base::_S_check(_M_state); packaged_task __tmp; __tmp._M_state = _M_state; _M_state = _M_state->_M_reset(); } }; /// swap template<typename _Res, typename... _ArgTypes> inline void swap(packaged_task<_Res(_ArgTypes...)>& __x, packaged_task<_Res(_ArgTypes...)>& __y) noexcept { __x.swap(__y); } template<typename _Res, typename _Alloc> struct uses_allocator<packaged_task<_Res>, _Alloc> : public true_type { }; template<typename _BoundFn, typename _Res> class __future_base::_Deferred_state final : public __future_base::_State_base { public: explicit _Deferred_state(_BoundFn&& __fn) : _M_result(new _Result<_Res>()), _M_fn(std::move(__fn)) { } private: typedef __future_base::_Ptr<_Result<_Res>> _Ptr_type; _Ptr_type _M_result; _BoundFn _M_fn; virtual void _M_run_deferred() { // safe to call multiple times so ignore failure _M_set_result(_S_task_setter(_M_result, _M_fn), true); } }; class __future_base::_Async_state_common : public __future_base::_State_base { protected: #ifdef _GLIBCXX_ASYNC_ABI_COMPAT ~_Async_state_common(); #else ~_Async_state_common() = default; #endif // Allow non-timed waiting functions to block until the thread completes, // as if joined. virtual void _M_run_deferred() { _M_join(); } void _M_join() { std::call_once(_M_once, &thread::join, ref(_M_thread)); } thread _M_thread; once_flag _M_once; }; template<typename _BoundFn, typename _Res> class __future_base::_Async_state_impl final : public __future_base::_Async_state_common { public: explicit _Async_state_impl(_BoundFn&& __fn) : _M_result(new _Result<_Res>()), _M_fn(std::move(__fn)) { _M_thread = std::thread{ [this] { _M_set_result(_S_task_setter(_M_result, _M_fn)); } }; } ~_Async_state_impl() { _M_join(); } private: typedef __future_base::_Ptr<_Result<_Res>> _Ptr_type; _Ptr_type _M_result; _BoundFn _M_fn; }; template<typename _BoundFn> inline std::shared_ptr<__future_base::_State_base> __future_base::_S_make_deferred_state(_BoundFn&& __fn) { typedef typename remove_reference<_BoundFn>::type __fn_type; typedef _Deferred_state<__fn_type> __state_type; return std::make_shared<__state_type>(std::move(__fn)); } template<typename _BoundFn> inline std::shared_ptr<__future_base::_State_base> __future_base::_S_make_async_state(_BoundFn&& __fn) { typedef typename remove_reference<_BoundFn>::type __fn_type; typedef _Async_state_impl<__fn_type> __state_type; return std::make_shared<__state_type>(std::move(__fn)); } /// async template<typename _Fn, typename... _Args> future<typename result_of<_Fn(_Args...)>::type> async(launch __policy, _Fn&& __fn, _Args&&... __args) { typedef typename result_of<_Fn(_Args...)>::type result_type; std::shared_ptr<__future_base::_State_base> __state; if ((__policy & (launch::async|launch::deferred)) == launch::async) { __state = __future_base::_S_make_async_state(std::__bind_simple( std::forward<_Fn>(__fn), std::forward<_Args>(__args)...)); } else { __state = __future_base::_S_make_deferred_state(std::__bind_simple( std::forward<_Fn>(__fn), std::forward<_Args>(__args)...)); } return future<result_type>(__state); } /// async, potential overload template<typename _Fn, typename... _Args> inline future<typename result_of<_Fn(_Args...)>::type> async(_Fn&& __fn, _Args&&... __args) { return async(launch::async|launch::deferred, std::forward<_Fn>(__fn), std::forward<_Args>(__args)...); } #endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1 // && ATOMIC_INT_LOCK_FREE // @} group futures _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // C++11 #endif // _GLIBCXX_FUTURE ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c++/4.8.2/exception���������������������������������������������������������������������������������0000644�����������������00000011715�14763166030�0007521 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Exception Handling support header for -*- C++ -*- // Copyright (C) 1995-2013 Free Software Foundation, Inc. // // This file is part of GCC. // // GCC 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 3, or (at your option) // any later version. // // GCC 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. // // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file exception * This is a Standard C++ Library header. */ #ifndef __EXCEPTION__ #define __EXCEPTION__ #pragma GCC system_header #pragma GCC visibility push(default) #include <bits/c++config.h> #include <bits/atomic_lockfree_defines.h> extern "C++" { namespace std { /** * @defgroup exceptions Exceptions * @ingroup diagnostics * * Classes and functions for reporting errors via exception classes. * @{ */ /** * @brief Base class for all library exceptions. * * This is the base class for all exceptions thrown by the standard * library, and by certain language expressions. You are free to derive * your own %exception classes, or use a different hierarchy, or to * throw non-class data (e.g., fundamental types). */ class exception { public: exception() _GLIBCXX_USE_NOEXCEPT { } virtual ~exception() _GLIBCXX_USE_NOEXCEPT; /** Returns a C-style character string describing the general cause * of the current error. */ virtual const char* what() const _GLIBCXX_USE_NOEXCEPT; }; /** If an %exception is thrown which is not listed in a function's * %exception specification, one of these may be thrown. */ class bad_exception : public exception { public: bad_exception() _GLIBCXX_USE_NOEXCEPT { } // This declaration is not useless: // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 virtual ~bad_exception() _GLIBCXX_USE_NOEXCEPT; // See comment in eh_exception.cc. virtual const char* what() const _GLIBCXX_USE_NOEXCEPT; }; /// If you write a replacement %terminate handler, it must be of this type. typedef void (*terminate_handler) (); /// If you write a replacement %unexpected handler, it must be of this type. typedef void (*unexpected_handler) (); /// Takes a new handler function as an argument, returns the old function. terminate_handler set_terminate(terminate_handler) _GLIBCXX_USE_NOEXCEPT; /** The runtime will call this function if %exception handling must be * abandoned for any reason. It can also be called by the user. */ void terminate() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__noreturn__)); /// Takes a new handler function as an argument, returns the old function. unexpected_handler set_unexpected(unexpected_handler) _GLIBCXX_USE_NOEXCEPT; /** The runtime will call this function if an %exception is thrown which * violates the function's %exception specification. */ void unexpected() __attribute__ ((__noreturn__)); /** [18.6.4]/1: 'Returns true after completing evaluation of a * throw-expression until either completing initialization of the * exception-declaration in the matching handler or entering @c unexpected() * due to the throw; or after entering @c terminate() for any reason * other than an explicit call to @c terminate(). [Note: This includes * stack unwinding [15.2]. end note]' * * 2: 'When @c uncaught_exception() is true, throwing an * %exception can result in a call of @c terminate() * (15.5.1).' */ bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); // @} group exceptions } // namespace std namespace __gnu_cxx { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief A replacement for the standard terminate_handler which * prints more information about the terminating exception (if any) * on stderr. * * @ingroup exceptions * * Call * @code * std::set_terminate(__gnu_cxx::__verbose_terminate_handler) * @endcode * to use. For more info, see * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt02ch06s02.html * * In 3.4 and later, this is on by default. */ void __verbose_terminate_handler(); _GLIBCXX_END_NAMESPACE_VERSION } // namespace } // extern "C++" #pragma GCC visibility pop #if (__cplusplus >= 201103L) && (ATOMIC_INT_LOCK_FREE > 1) #include <bits/exception_ptr.h> #include <bits/nested_exception.h> #endif #endif ���������������������������������������������������tiffio.hxx������������������������������������������������������������������������������������������0000644�����������������00000003246�14763166030�0006570 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* $Id: tiffio.hxx,v 1.3 2010-06-08 18:55:15 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _TIFFIO_HXX_ #define _TIFFIO_HXX_ /* * TIFF I/O library definitions which provide C++ streams API. */ #include <iostream> #include "tiff.h" extern TIFF* TIFFStreamOpen(const char*, std::ostream *); extern TIFF* TIFFStreamOpen(const char*, std::istream *); #endif /* _TIFFIO_HXX_ */ /* vim: set ts=8 sts=8 sw=8 noet: */ /* * Local Variables: * mode: c++ * c-basic-offset: 8 * fill-column: 78 * End: */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ucontext.h������������������������������������������������������������������������������������������0000644�����������������00000003652�14763166030�0006602 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997, 1998, 1999, 2000, 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* System V ABI compliant user-level context switching support. */ #ifndef _UCONTEXT_H #define _UCONTEXT_H 1 #include <features.h> /* Get machine dependent definition of data structures. */ #include <sys/ucontext.h> __BEGIN_DECLS /* Get user context and store it in variable pointed to by UCP. */ extern int getcontext (ucontext_t *__ucp) __THROWNL; /* Set user context from information of variable pointed to by UCP. */ extern int setcontext (const ucontext_t *__ucp) __THROWNL; /* Save current context in context variable pointed to by OUCP and set context from variable pointed to by UCP. */ extern int swapcontext (ucontext_t *__restrict __oucp, const ucontext_t *__restrict __ucp) __THROWNL; /* Manipulate user context UCP to continue with calling functions FUNC and the ARGC-1 parameters following ARGC when the context is used the next time in `setcontext' or `swapcontext'. We cannot say anything about the parameters FUNC takes; `void' is as good as any other choice. */ extern void makecontext (ucontext_t *__ucp, void (*__func) (void), int __argc, ...) __THROW; __END_DECLS #endif /* ucontext.h */ ��������������������������������������������������������������������������������������pcrecpparg.h����������������������������������������������������������������������������������������0000644�����������������00000015177�14763166030�0007064 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Copyright (c) 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Author: Sanjay Ghemawat #ifndef _PCRECPPARG_H #define _PCRECPPARG_H #include <stdlib.h> // for NULL #include <string> #include <pcre.h> namespace pcrecpp { class StringPiece; // Hex/Octal/Binary? // Special class for parsing into objects that define a ParseFrom() method template <class T> class _RE_MatchObject { public: static inline bool Parse(const char* str, int n, void* dest) { if (dest == NULL) return true; T* object = reinterpret_cast<T*>(dest); return object->ParseFrom(str, n); } }; class PCRECPP_EXP_DEFN Arg { public: // Empty constructor so we can declare arrays of Arg Arg(); // Constructor specially designed for NULL arguments Arg(void*); typedef bool (*Parser)(const char* str, int n, void* dest); // Type-specific parsers #define PCRE_MAKE_PARSER(type,name) \ Arg(type* p) : arg_(p), parser_(name) { } \ Arg(type* p, Parser parser) : arg_(p), parser_(parser) { } PCRE_MAKE_PARSER(char, parse_char); PCRE_MAKE_PARSER(unsigned char, parse_uchar); PCRE_MAKE_PARSER(short, parse_short); PCRE_MAKE_PARSER(unsigned short, parse_ushort); PCRE_MAKE_PARSER(int, parse_int); PCRE_MAKE_PARSER(unsigned int, parse_uint); PCRE_MAKE_PARSER(long, parse_long); PCRE_MAKE_PARSER(unsigned long, parse_ulong); #if 1 PCRE_MAKE_PARSER(long long, parse_longlong); #endif #if 1 PCRE_MAKE_PARSER(unsigned long long, parse_ulonglong); #endif PCRE_MAKE_PARSER(float, parse_float); PCRE_MAKE_PARSER(double, parse_double); PCRE_MAKE_PARSER(std::string, parse_string); PCRE_MAKE_PARSER(StringPiece, parse_stringpiece); #undef PCRE_MAKE_PARSER // Generic constructor template <class T> Arg(T*, Parser parser); // Generic constructor template template <class T> Arg(T* p) : arg_(p), parser_(_RE_MatchObject<T>::Parse) { } // Parse the data bool Parse(const char* str, int n) const; private: void* arg_; Parser parser_; static bool parse_null (const char* str, int n, void* dest); static bool parse_char (const char* str, int n, void* dest); static bool parse_uchar (const char* str, int n, void* dest); static bool parse_float (const char* str, int n, void* dest); static bool parse_double (const char* str, int n, void* dest); static bool parse_string (const char* str, int n, void* dest); static bool parse_stringpiece (const char* str, int n, void* dest); #define PCRE_DECLARE_INTEGER_PARSER(name) \ private: \ static bool parse_ ## name(const char* str, int n, void* dest); \ static bool parse_ ## name ## _radix( \ const char* str, int n, void* dest, int radix); \ public: \ static bool parse_ ## name ## _hex(const char* str, int n, void* dest); \ static bool parse_ ## name ## _octal(const char* str, int n, void* dest); \ static bool parse_ ## name ## _cradix(const char* str, int n, void* dest) PCRE_DECLARE_INTEGER_PARSER(short); PCRE_DECLARE_INTEGER_PARSER(ushort); PCRE_DECLARE_INTEGER_PARSER(int); PCRE_DECLARE_INTEGER_PARSER(uint); PCRE_DECLARE_INTEGER_PARSER(long); PCRE_DECLARE_INTEGER_PARSER(ulong); PCRE_DECLARE_INTEGER_PARSER(longlong); PCRE_DECLARE_INTEGER_PARSER(ulonglong); #undef PCRE_DECLARE_INTEGER_PARSER }; inline Arg::Arg() : arg_(NULL), parser_(parse_null) { } inline Arg::Arg(void* p) : arg_(p), parser_(parse_null) { } inline bool Arg::Parse(const char* str, int n) const { return (*parser_)(str, n, arg_); } // This part of the parser, appropriate only for ints, deals with bases #define MAKE_INTEGER_PARSER(type, name) \ inline Arg Hex(type* ptr) { \ return Arg(ptr, Arg::parse_ ## name ## _hex); } \ inline Arg Octal(type* ptr) { \ return Arg(ptr, Arg::parse_ ## name ## _octal); } \ inline Arg CRadix(type* ptr) { \ return Arg(ptr, Arg::parse_ ## name ## _cradix); } MAKE_INTEGER_PARSER(short, short) /* */ MAKE_INTEGER_PARSER(unsigned short, ushort) /* */ MAKE_INTEGER_PARSER(int, int) /* Don't use semicolons */ MAKE_INTEGER_PARSER(unsigned int, uint) /* after these statement */ MAKE_INTEGER_PARSER(long, long) /* because they can cause */ MAKE_INTEGER_PARSER(unsigned long, ulong) /* compiler warnings if */ #if 1 /* the checking level is */ MAKE_INTEGER_PARSER(long long, longlong) /* turned up high enough. */ #endif /* */ #if 1 /* */ MAKE_INTEGER_PARSER(unsigned long long, ulonglong) /* */ #endif #undef PCRE_IS_SET #undef PCRE_SET_OR_CLEAR #undef MAKE_INTEGER_PARSER } // namespace pcrecpp #endif /* _PCRECPPARG_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������spawn.h���������������������������������������������������������������������������������������������0000644�����������������00000015037�14763166030�0006061 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Definitions for POSIX spawn interface. Copyright (C) 2000,2003,2004,2009,2011,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SPAWN_H #define _SPAWN_H 1 #include <features.h> #include <sched.h> #define __need_sigset_t #include <signal.h> #include <sys/types.h> /* Data structure to contain attributes for thread creation. */ typedef struct { short int __flags; pid_t __pgrp; sigset_t __sd; sigset_t __ss; struct sched_param __sp; int __policy; int __pad[16]; } posix_spawnattr_t; /* Data structure to contain information about the actions to be performed in the new process with respect to file descriptors. */ typedef struct { int __allocated; int __used; struct __spawn_action *__actions; int __pad[16]; } posix_spawn_file_actions_t; /* Flags to be set in the `posix_spawnattr_t'. */ #define POSIX_SPAWN_RESETIDS 0x01 #define POSIX_SPAWN_SETPGROUP 0x02 #define POSIX_SPAWN_SETSIGDEF 0x04 #define POSIX_SPAWN_SETSIGMASK 0x08 #define POSIX_SPAWN_SETSCHEDPARAM 0x10 #define POSIX_SPAWN_SETSCHEDULER 0x20 #ifdef __USE_GNU # define POSIX_SPAWN_USEVFORK 0x40 #endif __BEGIN_DECLS /* Spawn a new process executing PATH with the attributes describes in *ATTRP. Before running the process perform the actions described in FILE-ACTIONS. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int posix_spawn (pid_t *__restrict __pid, const char *__restrict __path, const posix_spawn_file_actions_t *__restrict __file_actions, const posix_spawnattr_t *__restrict __attrp, char *const __argv[__restrict_arr], char *const __envp[__restrict_arr]); /* Similar to `posix_spawn' but search for FILE in the PATH. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int posix_spawnp (pid_t *__pid, const char *__file, const posix_spawn_file_actions_t *__file_actions, const posix_spawnattr_t *__attrp, char *const __argv[], char *const __envp[]); /* Initialize data structure with attributes for `spawn' to default values. */ extern int posix_spawnattr_init (posix_spawnattr_t *__attr) __THROW; /* Free resources associated with ATTR. */ extern int posix_spawnattr_destroy (posix_spawnattr_t *__attr) __THROW; /* Store signal mask for signals with default handling from ATTR in SIGDEFAULT. */ extern int posix_spawnattr_getsigdefault (const posix_spawnattr_t * __restrict __attr, sigset_t *__restrict __sigdefault) __THROW; /* Set signal mask for signals with default handling in ATTR to SIGDEFAULT. */ extern int posix_spawnattr_setsigdefault (posix_spawnattr_t *__restrict __attr, const sigset_t *__restrict __sigdefault) __THROW; /* Store signal mask for the new process from ATTR in SIGMASK. */ extern int posix_spawnattr_getsigmask (const posix_spawnattr_t *__restrict __attr, sigset_t *__restrict __sigmask) __THROW; /* Set signal mask for the new process in ATTR to SIGMASK. */ extern int posix_spawnattr_setsigmask (posix_spawnattr_t *__restrict __attr, const sigset_t *__restrict __sigmask) __THROW; /* Get flag word from the attribute structure. */ extern int posix_spawnattr_getflags (const posix_spawnattr_t *__restrict __attr, short int *__restrict __flags) __THROW; /* Store flags in the attribute structure. */ extern int posix_spawnattr_setflags (posix_spawnattr_t *_attr, short int __flags) __THROW; /* Get process group ID from the attribute structure. */ extern int posix_spawnattr_getpgroup (const posix_spawnattr_t *__restrict __attr, pid_t *__restrict __pgroup) __THROW; /* Store process group ID in the attribute structure. */ extern int posix_spawnattr_setpgroup (posix_spawnattr_t *__attr, pid_t __pgroup) __THROW; /* Get scheduling policy from the attribute structure. */ extern int posix_spawnattr_getschedpolicy (const posix_spawnattr_t * __restrict __attr, int *__restrict __schedpolicy) __THROW; /* Store scheduling policy in the attribute structure. */ extern int posix_spawnattr_setschedpolicy (posix_spawnattr_t *__attr, int __schedpolicy) __THROW; /* Get scheduling parameters from the attribute structure. */ extern int posix_spawnattr_getschedparam (const posix_spawnattr_t * __restrict __attr, struct sched_param *__restrict __schedparam) __THROW; /* Store scheduling parameters in the attribute structure. */ extern int posix_spawnattr_setschedparam (posix_spawnattr_t *__restrict __attr, const struct sched_param * __restrict __schedparam) __THROW; /* Initialize data structure for file attribute for `spawn' call. */ extern int posix_spawn_file_actions_init (posix_spawn_file_actions_t * __file_actions) __THROW; /* Free resources associated with FILE-ACTIONS. */ extern int posix_spawn_file_actions_destroy (posix_spawn_file_actions_t * __file_actions) __THROW; /* Add an action to FILE-ACTIONS which tells the implementation to call `open' for the given file during the `spawn' call. */ extern int posix_spawn_file_actions_addopen (posix_spawn_file_actions_t * __restrict __file_actions, int __fd, const char *__restrict __path, int __oflag, mode_t __mode) __THROW; /* Add an action to FILE-ACTIONS which tells the implementation to call `close' for the given file descriptor during the `spawn' call. */ extern int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t * __file_actions, int __fd) __THROW; /* Add an action to FILE-ACTIONS which tells the implementation to call `dup2' for the given file descriptors during the `spawn' call. */ extern int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t * __file_actions, int __fd, int __newfd) __THROW; __END_DECLS #endif /* spawn.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������uchar.h���������������������������������������������������������������������������������������������0000644�����������������00000004663�14763166030�0006036 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C11 Standard: 7.28 * Unicode utilities <uchar.h> */ #ifndef _UCHAR_H #define _UCHAR_H 1 #include <features.h> #define __need_size_t #include <stddef.h> #define __need_mbstate_t #include <wchar.h> #ifndef __mbstate_t_defined __BEGIN_NAMESPACE_C99 /* Public type. */ typedef __mbstate_t mbstate_t; __END_NAMESPACE_C99 # define __mbstate_t_defined 1 #endif #if defined __GNUC__ && !defined __USE_ISOCXX11 /* Define the 16-bit and 32-bit character types. Use the information provided by the compiler. */ # if !defined __CHAR16_TYPE__ || !defined __CHAR32_TYPE__ # if defined __STDC_VERSION__ && __STDC_VERSION__ < 201000L # error "<uchar.h> requires ISO C11 mode" # else # error "definitions of __CHAR16_TYPE__ and/or __CHAR32_TYPE__ missing" # endif # endif typedef __CHAR16_TYPE__ char16_t; typedef __CHAR32_TYPE__ char32_t; #endif __BEGIN_DECLS /* Write char16_t representation of multibyte character pointed to by S to PC16. */ extern size_t mbrtoc16 (char16_t *__restrict __pc16, const char *__restrict __s, size_t __n, mbstate_t *__restrict __p) __THROW; /* Write multibyte representation of char16_t C16 to S. */ extern size_t c16rtomb (char *__restrict __s, char16_t __c16, mbstate_t *__restrict __ps) __THROW; /* Write char32_t representation of multibyte character pointed to by S to PC32. */ extern size_t mbrtoc32 (char32_t *__restrict __pc32, const char *__restrict __s, size_t __n, mbstate_t *__restrict __p) __THROW; /* Write multibyte representation of char32_t C32 to S. */ extern size_t c32rtomb (char *__restrict __s, char32_t __c32, mbstate_t *__restrict __ps) __THROW; __END_DECLS #endif /* uchar.h */ �����������������������������������������������������������������������������link.h����������������������������������������������������������������������������������������������0000644�����������������00000015762�14763166030�0005673 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Data structure for communication from the run-time dynamic linker for loaded ELF shared objects. Copyright (C) 1995-2001, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _LINK_H #define _LINK_H 1 #include <features.h> #include <elf.h> #include <dlfcn.h> #include <sys/types.h> /* We use this macro to refer to ELF types independent of the native wordsize. `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */ #define ElfW(type) _ElfW (Elf, __ELF_NATIVE_CLASS, type) #define _ElfW(e,w,t) _ElfW_1 (e, w, _##t) #define _ElfW_1(e,w,t) e##w##t #include <bits/elfclass.h> /* Defines __ELF_NATIVE_CLASS. */ #include <bits/link.h> /* Rendezvous structure used by the run-time dynamic linker to communicate details of shared object loading to the debugger. If the executable's dynamic section has a DT_DEBUG element, the run-time linker sets that element's value to the address where this structure can be found. */ struct r_debug { int r_version; /* Version number for this protocol. */ struct link_map *r_map; /* Head of the chain of loaded objects. */ /* This is the address of a function internal to the run-time linker, that will always be called when the linker begins to map in a library or unmap it, and again when the mapping change is complete. The debugger can set a breakpoint at this address if it wants to notice shared object mapping changes. */ ElfW(Addr) r_brk; enum { /* This state value describes the mapping change taking place when the `r_brk' address is called. */ RT_CONSISTENT, /* Mapping change is complete. */ RT_ADD, /* Beginning to add a new object. */ RT_DELETE /* Beginning to remove an object mapping. */ } r_state; ElfW(Addr) r_ldbase; /* Base address the linker is loaded at. */ }; /* This is the instance of that structure used by the dynamic linker. */ extern struct r_debug _r_debug; /* This symbol refers to the "dynamic structure" in the `.dynamic' section of whatever module refers to `_DYNAMIC'. So, to find its own `struct r_debug', a program could do: for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL; ++dyn) if (dyn->d_tag == DT_DEBUG) r_debug = (struct r_debug *) dyn->d_un.d_ptr; */ extern ElfW(Dyn) _DYNAMIC[]; /* Structure describing a loaded shared object. The `l_next' and `l_prev' members form a chain of all the shared objects loaded at startup. These data structures exist in space used by the run-time dynamic linker; modifying them may have disastrous results. */ struct link_map { /* These first few members are part of the protocol with the debugger. This is the same format used in SVR4. */ ElfW(Addr) l_addr; /* Base address shared object is loaded at. */ char *l_name; /* Absolute file name object was found in. */ ElfW(Dyn) *l_ld; /* Dynamic section of the shared object. */ struct link_map *l_next, *l_prev; /* Chain of loaded objects. */ }; #ifdef __USE_GNU /* Version numbers for la_version handshake interface. */ #define LAV_CURRENT 1 /* Activity types signaled through la_activity. */ enum { LA_ACT_CONSISTENT, /* Link map consistent again. */ LA_ACT_ADD, /* New object will be added. */ LA_ACT_DELETE /* Objects will be removed. */ }; /* Values representing origin of name for dynamic loading. */ enum { LA_SER_ORIG = 0x01, /* Original name. */ LA_SER_LIBPATH = 0x02, /* Directory from LD_LIBRARY_PATH. */ LA_SER_RUNPATH = 0x04, /* Directory from RPATH/RUNPATH. */ LA_SER_CONFIG = 0x08, /* Found through ldconfig. */ LA_SER_DEFAULT = 0x40, /* Default directory. */ LA_SER_SECURE = 0x80 /* Unused. */ }; /* Values for la_objopen return value. */ enum { LA_FLG_BINDTO = 0x01, /* Audit symbols bound to this object. */ LA_FLG_BINDFROM = 0x02 /* Audit symbols bound from this object. */ }; /* Values for la_symbind flags parameter. */ enum { LA_SYMB_NOPLTENTER = 0x01, /* la_pltenter will not be called. */ LA_SYMB_NOPLTEXIT = 0x02, /* la_pltexit will not be called. */ LA_SYMB_STRUCTCALL = 0x04, /* Return value is a structure. */ LA_SYMB_DLSYM = 0x08, /* Binding due to dlsym call. */ LA_SYMB_ALTVALUE = 0x10 /* Value has been changed by a previous la_symbind call. */ }; struct dl_phdr_info { ElfW(Addr) dlpi_addr; const char *dlpi_name; const ElfW(Phdr) *dlpi_phdr; ElfW(Half) dlpi_phnum; /* Note: Following members were introduced after the first version of this structure was available. Check the SIZE argument passed to the dl_iterate_phdr callback to determine whether or not each later member is available. */ /* Incremented when a new object may have been added. */ unsigned long long int dlpi_adds; /* Incremented when an object may have been removed. */ unsigned long long int dlpi_subs; /* If there is a PT_TLS segment, its module ID as used in TLS relocations, else zero. */ size_t dlpi_tls_modid; /* The address of the calling thread's instance of this module's PT_TLS segment, if it has one and it has been allocated in the calling thread, otherwise a null pointer. */ void *dlpi_tls_data; }; __BEGIN_DECLS extern int dl_iterate_phdr (int (*__callback) (struct dl_phdr_info *, size_t, void *), void *__data); /* Prototypes for the ld.so auditing interfaces. These are not defined anywhere in ld.so but instead have to be provided by the auditing DSO. */ extern unsigned int la_version (unsigned int __version); extern void la_activity (uintptr_t *__cookie, unsigned int __flag); extern char *la_objsearch (const char *__name, uintptr_t *__cookie, unsigned int __flag); extern unsigned int la_objopen (struct link_map *__map, Lmid_t __lmid, uintptr_t *__cookie); extern void la_preinit (uintptr_t *__cookie); extern uintptr_t la_symbind32 (Elf32_Sym *__sym, unsigned int __ndx, uintptr_t *__refcook, uintptr_t *__defcook, unsigned int *__flags, const char *__symname); extern uintptr_t la_symbind64 (Elf64_Sym *__sym, unsigned int __ndx, uintptr_t *__refcook, uintptr_t *__defcook, unsigned int *__flags, const char *__symname); extern unsigned int la_objclose (uintptr_t *__cookie); __END_DECLS #endif #endif /* link.h */ ��������������gdfontl.h�������������������������������������������������������������������������������������������0000644�����������������00000001155�14763166030�0006362 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifdef __cplusplus extern "C" { #endif #ifndef _GDFONTL_H_ #define _GDFONTL_H_ 1 #ifdef __cplusplus extern "C" { #endif /* This is a header file for gd font, generated using bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz from bdf font -misc-fixed-medium-r-normal--16-140-75-75-c-80-iso8859-2 at Tue Jan 6 19:39:27 1998. The original bdf was holding following copyright: "Libor Skarvada, libor@informatics.muni.cz" */ #include "gd.h" BGD_EXPORT_DATA_PROT gdFontPtr gdFontLarge; BGD_DECLARE(gdFontPtr) gdFontGetLarge(void); #ifdef __cplusplus } #endif #endif #ifdef __cplusplus } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rdma/mthca-abi.h������������������������������������������������������������������������������������0000644�����������������00000005757�14763166030�0007511 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2005 Topspin Communications. All rights reserved. * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef MTHCA_ABI_USER_H #define MTHCA_ABI_USER_H #include <linux/types.h> /* * Increment this value if any changes that break userspace ABI * compatibility are made. */ #define MTHCA_UVERBS_ABI_VERSION 1 /* * Make sure that all structs defined in this file remain laid out so * that they pack the same way on 32-bit and 64-bit architectures (to * avoid incompatibility between 32-bit userspace and 64-bit kernels). * In particular do not use pointer types -- pass pointers in __u64 * instead. */ struct mthca_alloc_ucontext_resp { __u32 qp_tab_size; __u32 uarc_size; }; struct mthca_alloc_pd_resp { __u32 pdn; __u32 reserved; }; /* * Mark the memory region with a DMA attribute that causes * in-flight DMA to be flushed when the region is written to: */ #define MTHCA_MR_DMASYNC 0x1 struct mthca_reg_mr { __u32 mr_attrs; __u32 reserved; }; struct mthca_create_cq { __u32 lkey; __u32 pdn; __aligned_u64 arm_db_page; __aligned_u64 set_db_page; __u32 arm_db_index; __u32 set_db_index; }; struct mthca_create_cq_resp { __u32 cqn; __u32 reserved; }; struct mthca_resize_cq { __u32 lkey; __u32 reserved; }; struct mthca_create_srq { __u32 lkey; __u32 db_index; __aligned_u64 db_page; }; struct mthca_create_srq_resp { __u32 srqn; __u32 reserved; }; struct mthca_create_qp { __u32 lkey; __u32 reserved; __aligned_u64 sq_db_page; __aligned_u64 rq_db_page; __u32 sq_db_index; __u32 rq_db_index; }; #endif /* MTHCA_ABI_USER_H */ �����������������rdma/qedr-abi.h�������������������������������������������������������������������������������������0000644�����������������00000006130�14763166030�0007332 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* QLogic qedr NIC Driver * Copyright (c) 2015-2016 QLogic Corporation * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and /or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef __QEDR_USER_H__ #define __QEDR_USER_H__ #include <linux/types.h> #define QEDR_ABI_VERSION (8) /* user kernel communication data structures. */ struct qedr_alloc_ucontext_resp { __aligned_u64 db_pa; __u32 db_size; __u32 max_send_wr; __u32 max_recv_wr; __u32 max_srq_wr; __u32 sges_per_send_wr; __u32 sges_per_recv_wr; __u32 sges_per_srq_wr; __u32 max_cqes; __u8 dpm_enabled; __u8 wids_enabled; __u16 wid_count; __u32 reserved; }; struct qedr_alloc_pd_ureq { __aligned_u64 rsvd1; }; struct qedr_alloc_pd_uresp { __u32 pd_id; __u32 reserved; }; struct qedr_create_cq_ureq { __aligned_u64 addr; __aligned_u64 len; }; struct qedr_create_cq_uresp { __u32 db_offset; __u16 icid; __u16 reserved; }; struct qedr_create_qp_ureq { __u32 qp_handle_hi; __u32 qp_handle_lo; /* SQ */ /* user space virtual address of SQ buffer */ __aligned_u64 sq_addr; /* length of SQ buffer */ __aligned_u64 sq_len; /* RQ */ /* user space virtual address of RQ buffer */ __aligned_u64 rq_addr; /* length of RQ buffer */ __aligned_u64 rq_len; }; struct qedr_create_qp_uresp { __u32 qp_id; __u32 atomic_supported; /* SQ */ __u32 sq_db_offset; __u16 sq_icid; /* RQ */ __u32 rq_db_offset; __u16 rq_icid; __u32 rq_db2_offset; __u32 reserved; }; struct qedr_create_srq_ureq { /* user space virtual address of producer pair */ __aligned_u64 prod_pair_addr; /* user space virtual address of SRQ buffer */ __aligned_u64 srq_addr; /* length of SRQ buffer */ __aligned_u64 srq_len; }; struct qedr_create_srq_uresp { __u16 srq_id; __u16 reserved0; __u32 reserved1; }; #endif /* __QEDR_USER_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rdma/rdma_netlink.h���������������������������������������������������������������������������������0000644�����������������00000024655�14763166030�0010331 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _RDMA_NETLINK_H #define _RDMA_NETLINK_H #include <linux/types.h> enum { RDMA_NL_RDMA_CM = 1, RDMA_NL_IWCM, RDMA_NL_RSVD, RDMA_NL_LS, /* RDMA Local Services */ RDMA_NL_NLDEV, /* RDMA device interface */ RDMA_NL_NUM_CLIENTS }; enum { RDMA_NL_GROUP_CM = 1, RDMA_NL_GROUP_IWPM, RDMA_NL_GROUP_LS, RDMA_NL_NUM_GROUPS }; #define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10) #define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1)) #define RDMA_NL_GET_TYPE(client, op) ((client << 10) + op) enum { RDMA_NL_RDMA_CM_ID_STATS = 0, RDMA_NL_RDMA_CM_NUM_OPS }; enum { RDMA_NL_RDMA_CM_ATTR_SRC_ADDR = 1, RDMA_NL_RDMA_CM_ATTR_DST_ADDR, RDMA_NL_RDMA_CM_NUM_ATTR, }; /* iwarp port mapper op-codes */ enum { RDMA_NL_IWPM_REG_PID = 0, RDMA_NL_IWPM_ADD_MAPPING, RDMA_NL_IWPM_QUERY_MAPPING, RDMA_NL_IWPM_REMOVE_MAPPING, RDMA_NL_IWPM_REMOTE_INFO, RDMA_NL_IWPM_HANDLE_ERR, RDMA_NL_IWPM_MAPINFO, RDMA_NL_IWPM_MAPINFO_NUM, RDMA_NL_IWPM_NUM_OPS }; struct rdma_cm_id_stats { __u32 qp_num; __u32 bound_dev_if; __u32 port_space; __s32 pid; __u8 cm_state; __u8 node_type; __u8 port_num; __u8 qp_type; }; enum { IWPM_NLA_REG_PID_UNSPEC = 0, IWPM_NLA_REG_PID_SEQ, IWPM_NLA_REG_IF_NAME, IWPM_NLA_REG_IBDEV_NAME, IWPM_NLA_REG_ULIB_NAME, IWPM_NLA_REG_PID_MAX }; enum { IWPM_NLA_RREG_PID_UNSPEC = 0, IWPM_NLA_RREG_PID_SEQ, IWPM_NLA_RREG_IBDEV_NAME, IWPM_NLA_RREG_ULIB_NAME, IWPM_NLA_RREG_ULIB_VER, IWPM_NLA_RREG_PID_ERR, IWPM_NLA_RREG_PID_MAX }; enum { IWPM_NLA_MANAGE_MAPPING_UNSPEC = 0, IWPM_NLA_MANAGE_MAPPING_SEQ, IWPM_NLA_MANAGE_ADDR, IWPM_NLA_MANAGE_MAPPED_LOC_ADDR, IWPM_NLA_RMANAGE_MAPPING_ERR, IWPM_NLA_RMANAGE_MAPPING_MAX }; #define IWPM_NLA_MANAGE_MAPPING_MAX 3 #define IWPM_NLA_QUERY_MAPPING_MAX 4 #define IWPM_NLA_MAPINFO_SEND_MAX 3 enum { IWPM_NLA_QUERY_MAPPING_UNSPEC = 0, IWPM_NLA_QUERY_MAPPING_SEQ, IWPM_NLA_QUERY_LOCAL_ADDR, IWPM_NLA_QUERY_REMOTE_ADDR, IWPM_NLA_RQUERY_MAPPED_LOC_ADDR, IWPM_NLA_RQUERY_MAPPED_REM_ADDR, IWPM_NLA_RQUERY_MAPPING_ERR, IWPM_NLA_RQUERY_MAPPING_MAX }; enum { IWPM_NLA_MAPINFO_REQ_UNSPEC = 0, IWPM_NLA_MAPINFO_ULIB_NAME, IWPM_NLA_MAPINFO_ULIB_VER, IWPM_NLA_MAPINFO_REQ_MAX }; enum { IWPM_NLA_MAPINFO_UNSPEC = 0, IWPM_NLA_MAPINFO_LOCAL_ADDR, IWPM_NLA_MAPINFO_MAPPED_ADDR, IWPM_NLA_MAPINFO_MAX }; enum { IWPM_NLA_MAPINFO_NUM_UNSPEC = 0, IWPM_NLA_MAPINFO_SEQ, IWPM_NLA_MAPINFO_SEND_NUM, IWPM_NLA_MAPINFO_ACK_NUM, IWPM_NLA_MAPINFO_NUM_MAX }; enum { IWPM_NLA_ERR_UNSPEC = 0, IWPM_NLA_ERR_SEQ, IWPM_NLA_ERR_CODE, IWPM_NLA_ERR_MAX }; /* * Local service operations: * RESOLVE - The client requests the local service to resolve a path. * SET_TIMEOUT - The local service requests the client to set the timeout. * IP_RESOLVE - The client requests the local service to resolve an IP to GID. */ enum { RDMA_NL_LS_OP_RESOLVE = 0, RDMA_NL_LS_OP_SET_TIMEOUT, RDMA_NL_LS_OP_IP_RESOLVE, RDMA_NL_LS_NUM_OPS }; /* Local service netlink message flags */ #define RDMA_NL_LS_F_ERR 0x0100 /* Failed response */ /* * Local service resolve operation family header. * The layout for the resolve operation: * nlmsg header * family header * attributes */ /* * Local service path use: * Specify how the path(s) will be used. * ALL - For connected CM operation (6 pathrecords) * UNIDIRECTIONAL - For unidirectional UD (1 pathrecord) * GMP - For miscellaneous GMP like operation (at least 1 reversible * pathrecord) */ enum { LS_RESOLVE_PATH_USE_ALL = 0, LS_RESOLVE_PATH_USE_UNIDIRECTIONAL, LS_RESOLVE_PATH_USE_GMP, LS_RESOLVE_PATH_USE_MAX }; #define LS_DEVICE_NAME_MAX 64 struct rdma_ls_resolve_header { __u8 device_name[LS_DEVICE_NAME_MAX]; __u8 port_num; __u8 path_use; }; struct rdma_ls_ip_resolve_header { __u32 ifindex; }; /* Local service attribute type */ #define RDMA_NLA_F_MANDATORY (1 << 13) #define RDMA_NLA_TYPE_MASK (~(NLA_F_NESTED | NLA_F_NET_BYTEORDER | \ RDMA_NLA_F_MANDATORY)) /* * Local service attributes: * Attr Name Size Byte order * ----------------------------------------------------- * PATH_RECORD struct ib_path_rec_data * TIMEOUT u32 cpu * SERVICE_ID u64 cpu * DGID u8[16] BE * SGID u8[16] BE * TCLASS u8 * PKEY u16 cpu * QOS_CLASS u16 cpu * IPV4 u32 BE * IPV6 u8[16] BE */ enum { LS_NLA_TYPE_UNSPEC = 0, LS_NLA_TYPE_PATH_RECORD, LS_NLA_TYPE_TIMEOUT, LS_NLA_TYPE_SERVICE_ID, LS_NLA_TYPE_DGID, LS_NLA_TYPE_SGID, LS_NLA_TYPE_TCLASS, LS_NLA_TYPE_PKEY, LS_NLA_TYPE_QOS_CLASS, LS_NLA_TYPE_IPV4, LS_NLA_TYPE_IPV6, LS_NLA_TYPE_MAX }; /* Local service DGID/SGID attribute: big endian */ struct rdma_nla_ls_gid { __u8 gid[16]; }; enum rdma_nldev_command { RDMA_NLDEV_CMD_UNSPEC, RDMA_NLDEV_CMD_GET, /* can dump */ /* 2 - 4 are free to use */ RDMA_NLDEV_CMD_PORT_GET = 5, /* can dump */ /* 6 - 8 are free to use */ RDMA_NLDEV_CMD_RES_GET = 9, /* can dump */ RDMA_NLDEV_CMD_RES_QP_GET, /* can dump */ RDMA_NLDEV_CMD_RES_CM_ID_GET, /* can dump */ RDMA_NLDEV_CMD_RES_CQ_GET, /* can dump */ RDMA_NLDEV_CMD_RES_MR_GET, /* can dump */ RDMA_NLDEV_CMD_RES_PD_GET, /* can dump */ RDMA_NLDEV_NUM_OPS }; enum { RDMA_NLDEV_ATTR_ENTRY_STRLEN = 16, }; enum rdma_nldev_print_type { RDMA_NLDEV_PRINT_TYPE_UNSPEC, RDMA_NLDEV_PRINT_TYPE_HEX, }; enum rdma_nldev_attr { /* don't change the order or add anything between, this is ABI! */ RDMA_NLDEV_ATTR_UNSPEC, /* Pad attribute for 64b alignment */ RDMA_NLDEV_ATTR_PAD = RDMA_NLDEV_ATTR_UNSPEC, /* Identifier for ib_device */ RDMA_NLDEV_ATTR_DEV_INDEX, /* u32 */ RDMA_NLDEV_ATTR_DEV_NAME, /* string */ /* * Device index together with port index are identifiers * for port/link properties. * * For RDMA_NLDEV_CMD_GET commamnd, port index will return number * of available ports in ib_device, while for port specific operations, * it will be real port index as it appears in sysfs. Port index follows * sysfs notation and starts from 1 for the first port. */ RDMA_NLDEV_ATTR_PORT_INDEX, /* u32 */ /* * Device and port capabilities */ RDMA_NLDEV_ATTR_CAP_FLAGS, /* u64 */ /* * FW version */ RDMA_NLDEV_ATTR_FW_VERSION, /* string */ /* * Node GUID (in host byte order) associated with the RDMA device. */ RDMA_NLDEV_ATTR_NODE_GUID, /* u64 */ /* * System image GUID (in host byte order) associated with * this RDMA device and other devices which are part of a * single system. */ RDMA_NLDEV_ATTR_SYS_IMAGE_GUID, /* u64 */ /* * Subnet prefix (in host byte order) */ RDMA_NLDEV_ATTR_SUBNET_PREFIX, /* u64 */ /* * Local Identifier (LID), * According to IB specification, It is 16-bit address assigned * by the Subnet Manager. Extended to be 32-bit for OmniPath users. */ RDMA_NLDEV_ATTR_LID, /* u32 */ RDMA_NLDEV_ATTR_SM_LID, /* u32 */ /* * LID mask control (LMC) */ RDMA_NLDEV_ATTR_LMC, /* u8 */ RDMA_NLDEV_ATTR_PORT_STATE, /* u8 */ RDMA_NLDEV_ATTR_PORT_PHYS_STATE, /* u8 */ RDMA_NLDEV_ATTR_DEV_NODE_TYPE, /* u8 */ RDMA_NLDEV_ATTR_RES_SUMMARY, /* nested table */ RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY, /* nested table */ RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_NAME, /* string */ RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR, /* u64 */ RDMA_NLDEV_ATTR_RES_QP, /* nested table */ RDMA_NLDEV_ATTR_RES_QP_ENTRY, /* nested table */ /* * Local QPN */ RDMA_NLDEV_ATTR_RES_LQPN, /* u32 */ /* * Remote QPN, * Applicable for RC and UC only IBTA 11.2.5.3 QUERY QUEUE PAIR */ RDMA_NLDEV_ATTR_RES_RQPN, /* u32 */ /* * Receive Queue PSN, * Applicable for RC and UC only 11.2.5.3 QUERY QUEUE PAIR */ RDMA_NLDEV_ATTR_RES_RQ_PSN, /* u32 */ /* * Send Queue PSN */ RDMA_NLDEV_ATTR_RES_SQ_PSN, /* u32 */ RDMA_NLDEV_ATTR_RES_PATH_MIG_STATE, /* u8 */ /* * QP types as visible to RDMA/core, the reserved QPT * are not exported through this interface. */ RDMA_NLDEV_ATTR_RES_TYPE, /* u8 */ RDMA_NLDEV_ATTR_RES_STATE, /* u8 */ /* * Process ID which created object, * in case of kernel origin, PID won't exist. */ RDMA_NLDEV_ATTR_RES_PID, /* u32 */ /* * The name of process created following resource. * It will exist only for kernel objects. * For user created objects, the user is supposed * to read /proc/PID/comm file. */ RDMA_NLDEV_ATTR_RES_KERN_NAME, /* string */ RDMA_NLDEV_ATTR_RES_CM_ID, /* nested table */ RDMA_NLDEV_ATTR_RES_CM_ID_ENTRY, /* nested table */ /* * rdma_cm_id port space. */ RDMA_NLDEV_ATTR_RES_PS, /* u32 */ /* * Source and destination socket addresses */ RDMA_NLDEV_ATTR_RES_SRC_ADDR, /* __kernel_sockaddr_storage */ RDMA_NLDEV_ATTR_RES_DST_ADDR, /* __kernel_sockaddr_storage */ RDMA_NLDEV_ATTR_RES_CQ, /* nested table */ RDMA_NLDEV_ATTR_RES_CQ_ENTRY, /* nested table */ RDMA_NLDEV_ATTR_RES_CQE, /* u32 */ RDMA_NLDEV_ATTR_RES_USECNT, /* u64 */ RDMA_NLDEV_ATTR_RES_POLL_CTX, /* u8 */ RDMA_NLDEV_ATTR_RES_MR, /* nested table */ RDMA_NLDEV_ATTR_RES_MR_ENTRY, /* nested table */ RDMA_NLDEV_ATTR_RES_RKEY, /* u32 */ RDMA_NLDEV_ATTR_RES_LKEY, /* u32 */ RDMA_NLDEV_ATTR_RES_IOVA, /* u64 */ RDMA_NLDEV_ATTR_RES_MRLEN, /* u64 */ RDMA_NLDEV_ATTR_RES_PD, /* nested table */ RDMA_NLDEV_ATTR_RES_PD_ENTRY, /* nested table */ RDMA_NLDEV_ATTR_RES_LOCAL_DMA_LKEY, /* u32 */ RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY, /* u32 */ /* * Provides logical name and index of netdevice which is * connected to physical port. This information is relevant * for RoCE and iWARP. * * The netdevices which are associated with containers are * supposed to be exported together with GID table once it * will be exposed through the netlink. Because the * associated netdevices are properties of GIDs. */ RDMA_NLDEV_ATTR_NDEV_INDEX, /* u32 */ RDMA_NLDEV_ATTR_NDEV_NAME, /* string */ /* * driver-specific attributes. */ RDMA_NLDEV_ATTR_DRIVER, /* nested table */ RDMA_NLDEV_ATTR_DRIVER_ENTRY, /* nested table */ RDMA_NLDEV_ATTR_DRIVER_STRING, /* string */ /* * u8 values from enum rdma_nldev_print_type */ RDMA_NLDEV_ATTR_DRIVER_PRINT_TYPE, /* u8 */ RDMA_NLDEV_ATTR_DRIVER_S32, /* s32 */ RDMA_NLDEV_ATTR_DRIVER_U32, /* u32 */ RDMA_NLDEV_ATTR_DRIVER_S64, /* s64 */ RDMA_NLDEV_ATTR_DRIVER_U64, /* u64 */ /* * Always the end */ RDMA_NLDEV_ATTR_MAX }; #endif /* _RDMA_NETLINK_H */ �����������������������������������������������������������������������������������rdma/mlx4-abi.h�������������������������������������������������������������������������������������0000644�����������������00000011775�14763166030�0007276 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mellanox Technologies. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef MLX4_ABI_USER_H #define MLX4_ABI_USER_H #include <linux/types.h> /* * Increment this value if any changes that break userspace ABI * compatibility are made. */ #define MLX4_IB_UVERBS_NO_DEV_CAPS_ABI_VERSION 3 #define MLX4_IB_UVERBS_ABI_VERSION 4 /* * Make sure that all structs defined in this file remain laid out so * that they pack the same way on 32-bit and 64-bit architectures (to * avoid incompatibility between 32-bit userspace and 64-bit kernels). * In particular do not use pointer types -- pass pointers in __u64 * instead. */ struct mlx4_ib_alloc_ucontext_resp_v3 { __u32 qp_tab_size; __u16 bf_reg_size; __u16 bf_regs_per_page; }; enum { MLX4_USER_DEV_CAP_LARGE_CQE = 1L << 0, }; struct mlx4_ib_alloc_ucontext_resp { __u32 dev_caps; __u32 qp_tab_size; __u16 bf_reg_size; __u16 bf_regs_per_page; __u32 cqe_size; }; struct mlx4_ib_alloc_pd_resp { __u32 pdn; __u32 reserved; }; struct mlx4_ib_create_cq { __aligned_u64 buf_addr; __aligned_u64 db_addr; }; struct mlx4_ib_create_cq_resp { __u32 cqn; __u32 reserved; }; struct mlx4_ib_resize_cq { __aligned_u64 buf_addr; }; struct mlx4_ib_create_srq { __aligned_u64 buf_addr; __aligned_u64 db_addr; }; struct mlx4_ib_create_srq_resp { __u32 srqn; __u32 reserved; }; struct mlx4_ib_create_qp_rss { __aligned_u64 rx_hash_fields_mask; /* Use enum mlx4_ib_rx_hash_fields */ __u8 rx_hash_function; /* Use enum mlx4_ib_rx_hash_function_flags */ __u8 reserved[7]; __u8 rx_hash_key[40]; __u32 comp_mask; __u32 reserved1; }; struct mlx4_ib_create_qp { __aligned_u64 buf_addr; __aligned_u64 db_addr; __u8 log_sq_bb_count; __u8 log_sq_stride; __u8 sq_no_prefetch; __u8 reserved; __u32 inl_recv_sz; }; struct mlx4_ib_create_wq { __aligned_u64 buf_addr; __aligned_u64 db_addr; __u8 log_range_size; __u8 reserved[3]; __u32 comp_mask; }; struct mlx4_ib_modify_wq { __u32 comp_mask; __u32 reserved; }; struct mlx4_ib_create_rwq_ind_tbl_resp { __u32 response_length; __u32 reserved; }; /* RX Hash function flags */ enum mlx4_ib_rx_hash_function_flags { MLX4_IB_RX_HASH_FUNC_TOEPLITZ = 1 << 0, }; /* * RX Hash flags, these flags allows to set which incoming packet's field should * participates in RX Hash. Each flag represent certain packet's field, * when the flag is set the field that is represented by the flag will * participate in RX Hash calculation. */ enum mlx4_ib_rx_hash_fields { MLX4_IB_RX_HASH_SRC_IPV4 = 1 << 0, MLX4_IB_RX_HASH_DST_IPV4 = 1 << 1, MLX4_IB_RX_HASH_SRC_IPV6 = 1 << 2, MLX4_IB_RX_HASH_DST_IPV6 = 1 << 3, MLX4_IB_RX_HASH_SRC_PORT_TCP = 1 << 4, MLX4_IB_RX_HASH_DST_PORT_TCP = 1 << 5, MLX4_IB_RX_HASH_SRC_PORT_UDP = 1 << 6, MLX4_IB_RX_HASH_DST_PORT_UDP = 1 << 7, MLX4_IB_RX_HASH_INNER = 1ULL << 31, }; struct mlx4_ib_rss_caps { __aligned_u64 rx_hash_fields_mask; /* enum mlx4_ib_rx_hash_fields */ __u8 rx_hash_function; /* enum mlx4_ib_rx_hash_function_flags */ __u8 reserved[7]; }; enum query_device_resp_mask { MLX4_IB_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET = 1UL << 0, }; struct mlx4_ib_tso_caps { __u32 max_tso; /* Maximum tso payload size in bytes */ /* Corresponding bit will be set if qp type from * 'enum ib_qp_type' is supported. */ __u32 supported_qpts; }; struct mlx4_uverbs_ex_query_device_resp { __u32 comp_mask; __u32 response_length; __aligned_u64 hca_core_clock_offset; __u32 max_inl_recv_sz; __u32 reserved; struct mlx4_ib_rss_caps rss_caps; struct mlx4_ib_tso_caps tso_caps; }; #endif /* MLX4_ABI_USER_H */ ���rdma/cxgb4-abi.h������������������������������������������������������������������������������������0000644�����������������00000006062�14763166030�0007412 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2009-2010 Chelsio, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef CXGB4_ABI_USER_H #define CXGB4_ABI_USER_H #include <linux/types.h> #define C4IW_UVERBS_ABI_VERSION 3 /* * Make sure that all structs defined in this file remain laid out so * that they pack the same way on 32-bit and 64-bit architectures (to * avoid incompatibility between 32-bit userspace and 64-bit kernels). * In particular do not use pointer types -- pass pointers in __aligned_u64 * instead. */ enum { C4IW_64B_CQE = (1 << 0) }; struct c4iw_create_cq { __u32 flags; __u32 reserved; }; struct c4iw_create_cq_resp { __aligned_u64 key; __aligned_u64 gts_key; __aligned_u64 memsize; __u32 cqid; __u32 size; __u32 qid_mask; __u32 flags; }; enum { C4IW_QPF_ONCHIP = (1 << 0), C4IW_QPF_WRITE_W_IMM = (1 << 1) }; struct c4iw_create_qp_resp { __aligned_u64 ma_sync_key; __aligned_u64 sq_key; __aligned_u64 rq_key; __aligned_u64 sq_db_gts_key; __aligned_u64 rq_db_gts_key; __aligned_u64 sq_memsize; __aligned_u64 rq_memsize; __u32 sqid; __u32 rqid; __u32 sq_size; __u32 rq_size; __u32 qid_mask; __u32 flags; }; struct c4iw_create_srq_resp { __aligned_u64 srq_key; __aligned_u64 srq_db_gts_key; __aligned_u64 srq_memsize; __u32 srqid; __u32 srq_size; __u32 rqt_abs_idx; __u32 qid_mask; __u32 flags; __u32 reserved; /* explicit padding */ }; enum { /* HW supports SRQ_LIMIT_REACHED event */ T4_SRQ_LIMIT_SUPPORT = 1 << 0, }; struct c4iw_alloc_ucontext_resp { __aligned_u64 status_page_key; __u32 status_page_size; __u32 reserved; /* explicit padding (optional for i386) */ }; struct c4iw_alloc_pd_resp { __u32 pdid; }; #endif /* CXGB4_ABI_USER_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rdma/ib_user_ioctl_cmds.h���������������������������������������������������������������������������0000644�����������������00000010542�14763166030�0011500 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2018, Mellanox Technologies inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef IB_USER_IOCTL_CMDS_H #define IB_USER_IOCTL_CMDS_H #define UVERBS_ID_NS_MASK 0xF000 #define UVERBS_ID_NS_SHIFT 12 #define UVERBS_UDATA_DRIVER_DATA_NS 1 #define UVERBS_UDATA_DRIVER_DATA_FLAG (1UL << UVERBS_ID_NS_SHIFT) enum uverbs_default_objects { UVERBS_OBJECT_DEVICE, /* No instances of DEVICE are allowed */ UVERBS_OBJECT_PD, UVERBS_OBJECT_COMP_CHANNEL, UVERBS_OBJECT_CQ, UVERBS_OBJECT_QP, UVERBS_OBJECT_SRQ, UVERBS_OBJECT_AH, UVERBS_OBJECT_MR, UVERBS_OBJECT_MW, UVERBS_OBJECT_FLOW, UVERBS_OBJECT_XRCD, UVERBS_OBJECT_RWQ_IND_TBL, UVERBS_OBJECT_WQ, UVERBS_OBJECT_FLOW_ACTION, UVERBS_OBJECT_DM, UVERBS_OBJECT_COUNTERS, }; enum { UVERBS_ATTR_UHW_IN = UVERBS_UDATA_DRIVER_DATA_FLAG, UVERBS_ATTR_UHW_OUT, }; enum uverbs_attrs_create_cq_cmd_attr_ids { UVERBS_ATTR_CREATE_CQ_HANDLE, UVERBS_ATTR_CREATE_CQ_CQE, UVERBS_ATTR_CREATE_CQ_USER_HANDLE, UVERBS_ATTR_CREATE_CQ_COMP_CHANNEL, UVERBS_ATTR_CREATE_CQ_COMP_VECTOR, UVERBS_ATTR_CREATE_CQ_FLAGS, UVERBS_ATTR_CREATE_CQ_RESP_CQE, }; enum uverbs_attrs_destroy_cq_cmd_attr_ids { UVERBS_ATTR_DESTROY_CQ_HANDLE, UVERBS_ATTR_DESTROY_CQ_RESP, }; enum uverbs_attrs_create_flow_action_esp { UVERBS_ATTR_CREATE_FLOW_ACTION_ESP_HANDLE, UVERBS_ATTR_FLOW_ACTION_ESP_ATTRS, UVERBS_ATTR_FLOW_ACTION_ESP_ESN, UVERBS_ATTR_FLOW_ACTION_ESP_KEYMAT, UVERBS_ATTR_FLOW_ACTION_ESP_REPLAY, UVERBS_ATTR_FLOW_ACTION_ESP_ENCAP, }; enum uverbs_attrs_modify_flow_action_esp { UVERBS_ATTR_MODIFY_FLOW_ACTION_ESP_HANDLE = UVERBS_ATTR_CREATE_FLOW_ACTION_ESP_HANDLE, }; enum uverbs_attrs_destroy_flow_action_esp { UVERBS_ATTR_DESTROY_FLOW_ACTION_HANDLE, }; enum uverbs_methods_cq { UVERBS_METHOD_CQ_CREATE, UVERBS_METHOD_CQ_DESTROY, }; enum uverbs_methods_actions_flow_action_ops { UVERBS_METHOD_FLOW_ACTION_ESP_CREATE, UVERBS_METHOD_FLOW_ACTION_DESTROY, UVERBS_METHOD_FLOW_ACTION_ESP_MODIFY, }; enum uverbs_attrs_alloc_dm_cmd_attr_ids { UVERBS_ATTR_ALLOC_DM_HANDLE, UVERBS_ATTR_ALLOC_DM_LENGTH, UVERBS_ATTR_ALLOC_DM_ALIGNMENT, }; enum uverbs_attrs_free_dm_cmd_attr_ids { UVERBS_ATTR_FREE_DM_HANDLE, }; enum uverbs_methods_dm { UVERBS_METHOD_DM_ALLOC, UVERBS_METHOD_DM_FREE, }; enum uverbs_attrs_reg_dm_mr_cmd_attr_ids { UVERBS_ATTR_REG_DM_MR_HANDLE, UVERBS_ATTR_REG_DM_MR_OFFSET, UVERBS_ATTR_REG_DM_MR_LENGTH, UVERBS_ATTR_REG_DM_MR_PD_HANDLE, UVERBS_ATTR_REG_DM_MR_ACCESS_FLAGS, UVERBS_ATTR_REG_DM_MR_DM_HANDLE, UVERBS_ATTR_REG_DM_MR_RESP_LKEY, UVERBS_ATTR_REG_DM_MR_RESP_RKEY, }; enum uverbs_methods_mr { UVERBS_METHOD_DM_MR_REG, }; enum uverbs_attrs_create_counters_cmd_attr_ids { UVERBS_ATTR_CREATE_COUNTERS_HANDLE, }; enum uverbs_attrs_destroy_counters_cmd_attr_ids { UVERBS_ATTR_DESTROY_COUNTERS_HANDLE, }; enum uverbs_attrs_read_counters_cmd_attr_ids { UVERBS_ATTR_READ_COUNTERS_HANDLE, UVERBS_ATTR_READ_COUNTERS_BUFF, UVERBS_ATTR_READ_COUNTERS_FLAGS, }; enum uverbs_methods_actions_counters_ops { UVERBS_METHOD_COUNTERS_CREATE, UVERBS_METHOD_COUNTERS_DESTROY, UVERBS_METHOD_COUNTERS_READ, }; #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������rdma/i40iw-abi.h������������������������������������������������������������������������������������0000644�����������������00000005726�14763166030�0007345 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2006 - 2016 Intel Corporation. All rights reserved. * Copyright (c) 2005 Topspin Communications. All rights reserved. * Copyright (c) 2005 Cisco Systems. All rights reserved. * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ #ifndef I40IW_ABI_H #define I40IW_ABI_H #include <linux/types.h> #define I40IW_ABI_VER 5 struct i40iw_alloc_ucontext_req { __u32 reserved32; __u8 userspace_ver; __u8 reserved8[3]; }; struct i40iw_alloc_ucontext_resp { __u32 max_pds; /* maximum pds allowed for this user process */ __u32 max_qps; /* maximum qps allowed for this user process */ __u32 wq_size; /* size of the WQs (sq+rq) allocated to the mmaped area */ __u8 kernel_ver; __u8 reserved[3]; }; struct i40iw_alloc_pd_resp { __u32 pd_id; __u8 reserved[4]; }; struct i40iw_create_cq_req { __aligned_u64 user_cq_buffer; __aligned_u64 user_shadow_area; }; struct i40iw_create_qp_req { __aligned_u64 user_wqe_buffers; __aligned_u64 user_compl_ctx; /* UDA QP PHB */ __aligned_u64 user_sq_phb; /* place for VA of the sq phb buff */ __aligned_u64 user_rq_phb; /* place for VA of the rq phb buff */ }; enum i40iw_memreg_type { IW_MEMREG_TYPE_MEM = 0x0000, IW_MEMREG_TYPE_QP = 0x0001, IW_MEMREG_TYPE_CQ = 0x0002, }; struct i40iw_mem_reg_req { __u16 reg_type; /* Memory, QP or CQ */ __u16 cq_pages; __u16 rq_pages; __u16 sq_pages; }; struct i40iw_create_cq_resp { __u32 cq_id; __u32 cq_size; __u32 mmap_db_index; __u32 reserved; }; struct i40iw_create_qp_resp { __u32 qp_id; __u32 actual_sq_size; __u32 actual_rq_size; __u32 i40iw_drv_opt; __u16 push_idx; __u8 lsmm; __u8 rsvd2; }; #endif ������������������������������������������rdma/ib_user_cm.h�����������������������������������������������������������������������������������0000644�����������������00000015221�14763166030�0007756 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2005 Topspin Communications. All rights reserved. * Copyright (c) 2005 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef IB_USER_CM_H #define IB_USER_CM_H #include <linux/types.h> #include <rdma/ib_user_sa.h> #define IB_USER_CM_ABI_VERSION 5 enum { IB_USER_CM_CMD_CREATE_ID, IB_USER_CM_CMD_DESTROY_ID, IB_USER_CM_CMD_ATTR_ID, IB_USER_CM_CMD_LISTEN, IB_USER_CM_CMD_NOTIFY, IB_USER_CM_CMD_SEND_REQ, IB_USER_CM_CMD_SEND_REP, IB_USER_CM_CMD_SEND_RTU, IB_USER_CM_CMD_SEND_DREQ, IB_USER_CM_CMD_SEND_DREP, IB_USER_CM_CMD_SEND_REJ, IB_USER_CM_CMD_SEND_MRA, IB_USER_CM_CMD_SEND_LAP, IB_USER_CM_CMD_SEND_APR, IB_USER_CM_CMD_SEND_SIDR_REQ, IB_USER_CM_CMD_SEND_SIDR_REP, IB_USER_CM_CMD_EVENT, IB_USER_CM_CMD_INIT_QP_ATTR, }; /* * command ABI structures. */ struct ib_ucm_cmd_hdr { __u32 cmd; __u16 in; __u16 out; }; struct ib_ucm_create_id { __aligned_u64 uid; __aligned_u64 response; }; struct ib_ucm_create_id_resp { __u32 id; }; struct ib_ucm_destroy_id { __aligned_u64 response; __u32 id; __u32 reserved; }; struct ib_ucm_destroy_id_resp { __u32 events_reported; }; struct ib_ucm_attr_id { __aligned_u64 response; __u32 id; __u32 reserved; }; struct ib_ucm_attr_id_resp { __be64 service_id; __be64 service_mask; __be32 local_id; __be32 remote_id; }; struct ib_ucm_init_qp_attr { __aligned_u64 response; __u32 id; __u32 qp_state; }; struct ib_ucm_listen { __be64 service_id; __be64 service_mask; __u32 id; __u32 reserved; }; struct ib_ucm_notify { __u32 id; __u32 event; }; struct ib_ucm_private_data { __aligned_u64 data; __u32 id; __u8 len; __u8 reserved[3]; }; struct ib_ucm_req { __u32 id; __u32 qpn; __u32 qp_type; __u32 psn; __be64 sid; __aligned_u64 data; __aligned_u64 primary_path; __aligned_u64 alternate_path; __u8 len; __u8 peer_to_peer; __u8 responder_resources; __u8 initiator_depth; __u8 remote_cm_response_timeout; __u8 flow_control; __u8 local_cm_response_timeout; __u8 retry_count; __u8 rnr_retry_count; __u8 max_cm_retries; __u8 srq; __u8 reserved[5]; }; struct ib_ucm_rep { __aligned_u64 uid; __aligned_u64 data; __u32 id; __u32 qpn; __u32 psn; __u8 len; __u8 responder_resources; __u8 initiator_depth; __u8 target_ack_delay; __u8 failover_accepted; __u8 flow_control; __u8 rnr_retry_count; __u8 srq; __u8 reserved[4]; }; struct ib_ucm_info { __u32 id; __u32 status; __aligned_u64 info; __aligned_u64 data; __u8 info_len; __u8 data_len; __u8 reserved[6]; }; struct ib_ucm_mra { __aligned_u64 data; __u32 id; __u8 len; __u8 timeout; __u8 reserved[2]; }; struct ib_ucm_lap { __aligned_u64 path; __aligned_u64 data; __u32 id; __u8 len; __u8 reserved[3]; }; struct ib_ucm_sidr_req { __u32 id; __u32 timeout; __be64 sid; __aligned_u64 data; __aligned_u64 path; __u16 reserved_pkey; __u8 len; __u8 max_cm_retries; __u8 reserved[4]; }; struct ib_ucm_sidr_rep { __u32 id; __u32 qpn; __u32 qkey; __u32 status; __aligned_u64 info; __aligned_u64 data; __u8 info_len; __u8 data_len; __u8 reserved[6]; }; /* * event notification ABI structures. */ struct ib_ucm_event_get { __aligned_u64 response; __aligned_u64 data; __aligned_u64 info; __u8 data_len; __u8 info_len; __u8 reserved[6]; }; struct ib_ucm_req_event_resp { struct ib_user_path_rec primary_path; struct ib_user_path_rec alternate_path; __be64 remote_ca_guid; __u32 remote_qkey; __u32 remote_qpn; __u32 qp_type; __u32 starting_psn; __u8 responder_resources; __u8 initiator_depth; __u8 local_cm_response_timeout; __u8 flow_control; __u8 remote_cm_response_timeout; __u8 retry_count; __u8 rnr_retry_count; __u8 srq; __u8 port; __u8 reserved[7]; }; struct ib_ucm_rep_event_resp { __be64 remote_ca_guid; __u32 remote_qkey; __u32 remote_qpn; __u32 starting_psn; __u8 responder_resources; __u8 initiator_depth; __u8 target_ack_delay; __u8 failover_accepted; __u8 flow_control; __u8 rnr_retry_count; __u8 srq; __u8 reserved[5]; }; struct ib_ucm_rej_event_resp { __u32 reason; /* ari in ib_ucm_event_get info field. */ }; struct ib_ucm_mra_event_resp { __u8 timeout; __u8 reserved[3]; }; struct ib_ucm_lap_event_resp { struct ib_user_path_rec path; }; struct ib_ucm_apr_event_resp { __u32 status; /* apr info in ib_ucm_event_get info field. */ }; struct ib_ucm_sidr_req_event_resp { __u16 pkey; __u8 port; __u8 reserved; }; struct ib_ucm_sidr_rep_event_resp { __u32 status; __u32 qkey; __u32 qpn; /* info in ib_ucm_event_get info field. */ }; #define IB_UCM_PRES_DATA 0x01 #define IB_UCM_PRES_INFO 0x02 #define IB_UCM_PRES_PRIMARY 0x04 #define IB_UCM_PRES_ALTERNATE 0x08 struct ib_ucm_event_resp { __aligned_u64 uid; __u32 id; __u32 event; __u32 present; __u32 reserved; union { struct ib_ucm_req_event_resp req_resp; struct ib_ucm_rep_event_resp rep_resp; struct ib_ucm_rej_event_resp rej_resp; struct ib_ucm_mra_event_resp mra_resp; struct ib_ucm_lap_event_resp lap_resp; struct ib_ucm_apr_event_resp apr_resp; struct ib_ucm_sidr_req_event_resp sidr_req_resp; struct ib_ucm_sidr_rep_event_resp sidr_rep_resp; __u32 send_status; } u; }; #endif /* IB_USER_CM_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rdma/rdma_user_rxe.h��������������������������������������������������������������������������������0000644�����������������00000007426�14763166030�0010516 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef RDMA_USER_RXE_H #define RDMA_USER_RXE_H #include <linux/types.h> #include <linux/socket.h> #include <linux/in.h> #include <linux/in6.h> union rxe_gid { __u8 raw[16]; struct { __be64 subnet_prefix; __be64 interface_id; } global; }; struct rxe_global_route { union rxe_gid dgid; __u32 flow_label; __u8 sgid_index; __u8 hop_limit; __u8 traffic_class; }; struct rxe_av { __u8 port_num; __u8 network_type; __u16 reserved1; __u32 reserved2; struct rxe_global_route grh; union { struct sockaddr_in _sockaddr_in; struct sockaddr_in6 _sockaddr_in6; } sgid_addr, dgid_addr; }; struct rxe_send_wr { __aligned_u64 wr_id; __u32 num_sge; __u32 opcode; __u32 send_flags; union { __be32 imm_data; __u32 invalidate_rkey; } ex; union { struct { __aligned_u64 remote_addr; __u32 rkey; __u32 reserved; } rdma; struct { __aligned_u64 remote_addr; __aligned_u64 compare_add; __aligned_u64 swap; __u32 rkey; __u32 reserved; } atomic; struct { __u32 remote_qpn; __u32 remote_qkey; __u16 pkey_index; } ud; /* reg is only used by the kernel and is not part of the uapi */ struct { union { struct ib_mr *mr; __aligned_u64 reserved; }; __u32 key; __u32 access; } reg; } wr; }; struct rxe_sge { __aligned_u64 addr; __u32 length; __u32 lkey; }; struct mminfo { __aligned_u64 offset; __u32 size; __u32 pad; }; struct rxe_dma_info { __u32 length; __u32 resid; __u32 cur_sge; __u32 num_sge; __u32 sge_offset; __u32 reserved; union { __u8 inline_data[0]; struct rxe_sge sge[0]; }; }; struct rxe_send_wqe { struct rxe_send_wr wr; struct rxe_av av; __u32 status; __u32 state; __aligned_u64 iova; __u32 mask; __u32 first_psn; __u32 last_psn; __u32 ack_length; __u32 ssn; __u32 has_rd_atomic; struct rxe_dma_info dma; }; struct rxe_recv_wqe { __aligned_u64 wr_id; __u32 num_sge; __u32 padding; struct rxe_dma_info dma; }; struct rxe_create_cq_resp { struct mminfo mi; }; struct rxe_resize_cq_resp { struct mminfo mi; }; struct rxe_create_qp_resp { struct mminfo rq_mi; struct mminfo sq_mi; }; struct rxe_create_srq_resp { struct mminfo mi; __u32 srq_num; __u32 reserved; }; struct rxe_modify_srq_cmd { __aligned_u64 mmap_info_addr; }; #endif /* RDMA_USER_RXE_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rdma/ocrdma-abi.h�����������������������������������������������������������������������������������0000644�����������������00000010024�14763166030�0007641 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ /* This file is part of the Emulex RoCE Device Driver for * RoCE (RDMA over Converged Ethernet) adapters. * Copyright (C) 2012-2015 Emulex. All rights reserved. * EMULEX and SLI are trademarks of Emulex. * www.emulex.com * * This software is available to you under a choice of one of two licenses. * You may choose to be licensed under the terms of the GNU General Public * License (GPL) Version 2, available from the file COPYING in the main * directory of this source tree, or the BSD license below: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Contact Information: * linux-drivers@emulex.com * * Emulex * 3333 Susan Street * Costa Mesa, CA 92626 */ #ifndef OCRDMA_ABI_USER_H #define OCRDMA_ABI_USER_H #include <linux/types.h> #define OCRDMA_ABI_VERSION 2 #define OCRDMA_BE_ROCE_ABI_VERSION 1 /* user kernel communication data structures. */ struct ocrdma_alloc_ucontext_resp { __u32 dev_id; __u32 wqe_size; __u32 max_inline_data; __u32 dpp_wqe_size; __aligned_u64 ah_tbl_page; __u32 ah_tbl_len; __u32 rqe_size; __u8 fw_ver[32]; /* for future use/new features in progress */ __aligned_u64 rsvd1; __aligned_u64 rsvd2; }; struct ocrdma_alloc_pd_ureq { __u32 rsvd[2]; }; struct ocrdma_alloc_pd_uresp { __u32 id; __u32 dpp_enabled; __u32 dpp_page_addr_hi; __u32 dpp_page_addr_lo; __u32 rsvd[2]; }; struct ocrdma_create_cq_ureq { __u32 dpp_cq; __u32 rsvd; /* pad */ }; #define MAX_CQ_PAGES 8 struct ocrdma_create_cq_uresp { __u32 cq_id; __u32 page_size; __u32 num_pages; __u32 max_hw_cqe; __aligned_u64 page_addr[MAX_CQ_PAGES]; __aligned_u64 db_page_addr; __u32 db_page_size; __u32 phase_change; /* for future use/new features in progress */ __aligned_u64 rsvd1; __aligned_u64 rsvd2; }; #define MAX_QP_PAGES 8 #define MAX_UD_AV_PAGES 8 struct ocrdma_create_qp_ureq { __u8 enable_dpp_cq; __u8 rsvd; __u16 dpp_cq_id; __u32 rsvd1; /* pad */ }; struct ocrdma_create_qp_uresp { __u16 qp_id; __u16 sq_dbid; __u16 rq_dbid; __u16 resv0; /* pad */ __u32 sq_page_size; __u32 rq_page_size; __u32 num_sq_pages; __u32 num_rq_pages; __aligned_u64 sq_page_addr[MAX_QP_PAGES]; __aligned_u64 rq_page_addr[MAX_QP_PAGES]; __aligned_u64 db_page_addr; __u32 db_page_size; __u32 dpp_credit; __u32 dpp_offset; __u32 num_wqe_allocated; __u32 num_rqe_allocated; __u32 db_sq_offset; __u32 db_rq_offset; __u32 db_shift; __aligned_u64 rsvd[11]; }; struct ocrdma_create_srq_uresp { __u16 rq_dbid; __u16 resv0; /* pad */ __u32 resv1; __u32 rq_page_size; __u32 num_rq_pages; __aligned_u64 rq_page_addr[MAX_QP_PAGES]; __aligned_u64 db_page_addr; __u32 db_page_size; __u32 num_rqe_allocated; __u32 db_rq_offset; __u32 db_shift; __aligned_u64 rsvd2; __aligned_u64 rsvd3; }; #endif /* OCRDMA_ABI_USER_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rdma/bnxt_re-abi.h����������������������������������������������������������������������������������0000644�����������������00000005747�14763166030�0010055 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ /* * Broadcom NetXtreme-E RoCE driver. * * Copyright (c) 2016 - 2017, Broadcom. All rights reserved. The term * Broadcom refers to Broadcom Limited and/or its subsidiaries. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * BSD license below: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Description: Uverbs ABI header file */ #ifndef __BNXT_RE_UVERBS_ABI_H__ #define __BNXT_RE_UVERBS_ABI_H__ #include <linux/types.h> #define BNXT_RE_ABI_VERSION 1 struct bnxt_re_uctx_resp { __u32 dev_id; __u32 max_qp; __u32 pg_size; __u32 cqe_sz; __u32 max_cqd; __u32 rsvd; }; /* * This struct is placed after the ib_uverbs_alloc_pd_resp struct, which is * not 8 byted aligned. To avoid undesired padding in various cases we have to * set this struct to packed. */ struct bnxt_re_pd_resp { __u32 pdid; __u32 dpi; __u64 dbr; } __attribute__((packed, aligned(4))); struct bnxt_re_cq_req { __aligned_u64 cq_va; __aligned_u64 cq_handle; }; struct bnxt_re_cq_resp { __u32 cqid; __u32 tail; __u32 phase; __u32 rsvd; }; struct bnxt_re_qp_req { __aligned_u64 qpsva; __aligned_u64 qprva; __aligned_u64 qp_handle; }; struct bnxt_re_qp_resp { __u32 qpid; __u32 rsvd; }; struct bnxt_re_srq_req { __aligned_u64 srqva; __aligned_u64 srq_handle; }; struct bnxt_re_srq_resp { __u32 srqid; }; enum bnxt_re_shpg_offt { BNXT_RE_BEG_RESV_OFFT = 0x00, BNXT_RE_AVID_OFFT = 0x10, BNXT_RE_AVID_SIZE = 0x04, BNXT_RE_END_RESV_OFFT = 0xFF0 }; #endif /* __BNXT_RE_UVERBS_ABI_H__*/ �������������������������rdma/hns-abi.h��������������������������������������������������������������������������������������0000644�����������������00000004237�14763166030�0007175 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2016 Hisilicon Limited. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef HNS_ABI_USER_H #define HNS_ABI_USER_H #include <linux/types.h> struct hns_roce_ib_create_cq { __aligned_u64 buf_addr; __aligned_u64 db_addr; }; struct hns_roce_ib_create_cq_resp { __aligned_u64 cqn; /* Only 32 bits used, 64 for compat */ __aligned_u64 cap_flags; }; struct hns_roce_ib_create_qp { __aligned_u64 buf_addr; __aligned_u64 db_addr; __u8 log_sq_bb_count; __u8 log_sq_stride; __u8 sq_no_prefetch; __u8 reserved[5]; __aligned_u64 sdb_addr; }; struct hns_roce_ib_create_qp_resp { __aligned_u64 cap_flags; }; struct hns_roce_ib_alloc_ucontext_resp { __u32 qp_tab_size; __u32 reserved; }; struct hns_roce_ib_alloc_pd_resp { __u32 pdn; }; #endif /* HNS_ABI_USER_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rdma/ib_user_mad.h����������������������������������������������������������������������������������0000644�����������������00000020523�14763166030�0010121 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2004 Topspin Communications. All rights reserved. * Copyright (c) 2005 Voltaire, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef IB_USER_MAD_H #define IB_USER_MAD_H #include <linux/types.h> #include <rdma/rdma_user_ioctl.h> /* * Increment this value if any changes that break userspace ABI * compatibility are made. */ #define IB_USER_MAD_ABI_VERSION 5 /* * Make sure that all structs defined in this file remain laid out so * that they pack the same way on 32-bit and 64-bit architectures (to * avoid incompatibility between 32-bit userspace and 64-bit kernels). */ /** * ib_user_mad_hdr_old - Old version of MAD packet header without pkey_index * @id - ID of agent MAD received with/to be sent with * @status - 0 on successful receive, ETIMEDOUT if no response * received (transaction ID in data[] will be set to TID of original * request) (ignored on send) * @timeout_ms - Milliseconds to wait for response (unset on receive) * @retries - Number of automatic retries to attempt * @qpn - Remote QP number received from/to be sent to * @qkey - Remote Q_Key to be sent with (unset on receive) * @lid - Remote lid received from/to be sent to * @sl - Service level received with/to be sent with * @path_bits - Local path bits received with/to be sent with * @grh_present - If set, GRH was received/should be sent * @gid_index - Local GID index to send with (unset on receive) * @hop_limit - Hop limit in GRH * @traffic_class - Traffic class in GRH * @gid - Remote GID in GRH * @flow_label - Flow label in GRH */ struct ib_user_mad_hdr_old { __u32 id; __u32 status; __u32 timeout_ms; __u32 retries; __u32 length; __be32 qpn; __be32 qkey; __be16 lid; __u8 sl; __u8 path_bits; __u8 grh_present; __u8 gid_index; __u8 hop_limit; __u8 traffic_class; __u8 gid[16]; __be32 flow_label; }; /** * ib_user_mad_hdr - MAD packet header * This layout allows specifying/receiving the P_Key index. To use * this capability, an application must call the * IB_USER_MAD_ENABLE_PKEY ioctl on the user MAD file handle before * any other actions with the file handle. * @id - ID of agent MAD received with/to be sent with * @status - 0 on successful receive, ETIMEDOUT if no response * received (transaction ID in data[] will be set to TID of original * request) (ignored on send) * @timeout_ms - Milliseconds to wait for response (unset on receive) * @retries - Number of automatic retries to attempt * @qpn - Remote QP number received from/to be sent to * @qkey - Remote Q_Key to be sent with (unset on receive) * @lid - Remote lid received from/to be sent to * @sl - Service level received with/to be sent with * @path_bits - Local path bits received with/to be sent with * @grh_present - If set, GRH was received/should be sent * @gid_index - Local GID index to send with (unset on receive) * @hop_limit - Hop limit in GRH * @traffic_class - Traffic class in GRH * @gid - Remote GID in GRH * @flow_label - Flow label in GRH * @pkey_index - P_Key index */ struct ib_user_mad_hdr { __u32 id; __u32 status; __u32 timeout_ms; __u32 retries; __u32 length; __be32 qpn; __be32 qkey; __be16 lid; __u8 sl; __u8 path_bits; __u8 grh_present; __u8 gid_index; __u8 hop_limit; __u8 traffic_class; __u8 gid[16]; __be32 flow_label; __u16 pkey_index; __u8 reserved[6]; }; /** * ib_user_mad - MAD packet * @hdr - MAD packet header * @data - Contents of MAD * */ struct ib_user_mad { struct ib_user_mad_hdr hdr; __aligned_u64 data[0]; }; /* * Earlier versions of this interface definition declared the * method_mask[] member as an array of __u32 but treated it as a * bitmap made up of longs in the kernel. This ambiguity meant that * 32-bit big-endian applications that can run on both 32-bit and * 64-bit kernels had no consistent ABI to rely on, and 64-bit * big-endian applications that treated method_mask as being made up * of 32-bit words would have their bitmap misinterpreted. * * To clear up this confusion, we change the declaration of * method_mask[] to use unsigned long and handle the conversion from * 32-bit userspace to 64-bit kernel for big-endian systems in the * compat_ioctl method. Unfortunately, to keep the structure layout * the same, we need the method_mask[] array to be aligned only to 4 * bytes even when long is 64 bits, which forces us into this ugly * typedef. */ typedef unsigned long __attribute__((aligned(4))) packed_ulong; #define IB_USER_MAD_LONGS_PER_METHOD_MASK (128 / (8 * sizeof (long))) /** * ib_user_mad_reg_req - MAD registration request * @id - Set by the kernel; used to identify agent in future requests. * @qpn - Queue pair number; must be 0 or 1. * @method_mask - The caller will receive unsolicited MADs for any method * where @method_mask = 1. * @mgmt_class - Indicates which management class of MADs should be receive * by the caller. This field is only required if the user wishes to * receive unsolicited MADs, otherwise it should be 0. * @mgmt_class_version - Indicates which version of MADs for the given * management class to receive. * @oui: Indicates IEEE OUI when mgmt_class is a vendor class * in the range from 0x30 to 0x4f. Otherwise not used. * @rmpp_version: If set, indicates the RMPP version used. * */ struct ib_user_mad_reg_req { __u32 id; packed_ulong method_mask[IB_USER_MAD_LONGS_PER_METHOD_MASK]; __u8 qpn; __u8 mgmt_class; __u8 mgmt_class_version; __u8 oui[3]; __u8 rmpp_version; }; /** * ib_user_mad_reg_req2 - MAD registration request * * @id - Set by the _kernel_; used by userspace to identify the * registered agent in future requests. * @qpn - Queue pair number; must be 0 or 1. * @mgmt_class - Indicates which management class of MADs should be * receive by the caller. This field is only required if * the user wishes to receive unsolicited MADs, otherwise * it should be 0. * @mgmt_class_version - Indicates which version of MADs for the given * management class to receive. * @res - Ignored. * @flags - additional registration flags; Must be in the set of * flags defined in IB_USER_MAD_REG_FLAGS_CAP * @method_mask - The caller wishes to receive unsolicited MADs for the * methods whose bit(s) is(are) set. * @oui - Indicates IEEE OUI to use when mgmt_class is a vendor * class in the range from 0x30 to 0x4f. Otherwise not * used. * @rmpp_version - If set, indicates the RMPP version to use. */ enum { IB_USER_MAD_USER_RMPP = (1 << 0), }; #define IB_USER_MAD_REG_FLAGS_CAP (IB_USER_MAD_USER_RMPP) struct ib_user_mad_reg_req2 { __u32 id; __u32 qpn; __u8 mgmt_class; __u8 mgmt_class_version; __u16 res; __u32 flags; __aligned_u64 method_mask[2]; __u32 oui; __u8 rmpp_version; __u8 reserved[3]; }; #endif /* IB_USER_MAD_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������rdma/cxgb3-abi.h������������������������������������������������������������������������������������0000644�����������������00000004644�14763166030�0007415 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2006 Chelsio, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef CXGB3_ABI_USER_H #define CXGB3_ABI_USER_H #include <linux/types.h> #define IWCH_UVERBS_ABI_VERSION 1 /* * Make sure that all structs defined in this file remain laid out so * that they pack the same way on 32-bit and 64-bit architectures (to * avoid incompatibility between 32-bit userspace and 64-bit kernels). * In particular do not use pointer types -- pass pointers in __aligned_u64 * instead. */ struct iwch_create_cq_req { __aligned_u64 user_rptr_addr; }; struct iwch_create_cq_resp_v0 { __aligned_u64 key; __u32 cqid; __u32 size_log2; }; struct iwch_create_cq_resp { __aligned_u64 key; __u32 cqid; __u32 size_log2; __u32 memsize; __u32 reserved; }; struct iwch_create_qp_resp { __aligned_u64 key; __aligned_u64 db_key; __u32 qpid; __u32 size_log2; __u32 sq_size_log2; __u32 rq_size_log2; }; struct iwch_reg_user_mr_resp { __u32 pbl_addr; }; struct iwch_alloc_pd_resp { __u32 pdid; }; #endif /* CXGB3_ABI_USER_H */ ��������������������������������������������������������������������������������������������rdma/ib_user_ioctl_verbs.h��������������������������������������������������������������������������0000644�����������������00000012254�14763166030�0011675 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2017-2018, Mellanox Technologies inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef IB_USER_IOCTL_VERBS_H #define IB_USER_IOCTL_VERBS_H #include <linux/types.h> #ifndef RDMA_UAPI_PTR #define RDMA_UAPI_PTR(_type, _name) __aligned_u64 _name #endif enum ib_uverbs_access_flags { IB_UVERBS_ACCESS_LOCAL_WRITE = 1 << 0, IB_UVERBS_ACCESS_REMOTE_WRITE = 1 << 1, IB_UVERBS_ACCESS_REMOTE_READ = 1 << 2, IB_UVERBS_ACCESS_REMOTE_ATOMIC = 1 << 3, IB_UVERBS_ACCESS_MW_BIND = 1 << 4, IB_UVERBS_ACCESS_ZERO_BASED = 1 << 5, IB_UVERBS_ACCESS_ON_DEMAND = 1 << 6, IB_UVERBS_ACCESS_HUGETLB = 1 << 7, }; enum ib_uverbs_query_port_cap_flags { IB_UVERBS_PCF_SM = 1 << 1, IB_UVERBS_PCF_NOTICE_SUP = 1 << 2, IB_UVERBS_PCF_TRAP_SUP = 1 << 3, IB_UVERBS_PCF_OPT_IPD_SUP = 1 << 4, IB_UVERBS_PCF_AUTO_MIGR_SUP = 1 << 5, IB_UVERBS_PCF_SL_MAP_SUP = 1 << 6, IB_UVERBS_PCF_MKEY_NVRAM = 1 << 7, IB_UVERBS_PCF_PKEY_NVRAM = 1 << 8, IB_UVERBS_PCF_LED_INFO_SUP = 1 << 9, IB_UVERBS_PCF_SM_DISABLED = 1 << 10, IB_UVERBS_PCF_SYS_IMAGE_GUID_SUP = 1 << 11, IB_UVERBS_PCF_PKEY_SW_EXT_PORT_TRAP_SUP = 1 << 12, IB_UVERBS_PCF_EXTENDED_SPEEDS_SUP = 1 << 14, IB_UVERBS_PCF_CM_SUP = 1 << 16, IB_UVERBS_PCF_SNMP_TUNNEL_SUP = 1 << 17, IB_UVERBS_PCF_REINIT_SUP = 1 << 18, IB_UVERBS_PCF_DEVICE_MGMT_SUP = 1 << 19, IB_UVERBS_PCF_VENDOR_CLASS_SUP = 1 << 20, IB_UVERBS_PCF_DR_NOTICE_SUP = 1 << 21, IB_UVERBS_PCF_CAP_MASK_NOTICE_SUP = 1 << 22, IB_UVERBS_PCF_BOOT_MGMT_SUP = 1 << 23, IB_UVERBS_PCF_LINK_LATENCY_SUP = 1 << 24, IB_UVERBS_PCF_CLIENT_REG_SUP = 1 << 25, /* * IsOtherLocalChangesNoticeSupported is aliased by IP_BASED_GIDS and * is inaccessible */ IB_UVERBS_PCF_LINK_SPEED_WIDTH_TABLE_SUP = 1 << 27, IB_UVERBS_PCF_VENDOR_SPECIFIC_MADS_TABLE_SUP = 1 << 28, IB_UVERBS_PCF_MCAST_PKEY_TRAP_SUPPRESSION_SUP = 1 << 29, IB_UVERBS_PCF_MCAST_FDB_TOP_SUP = 1 << 30, IB_UVERBS_PCF_HIERARCHY_INFO_SUP = 1ULL << 31, /* NOTE this is an internal flag, not an IBA flag */ IB_UVERBS_PCF_IP_BASED_GIDS = 1 << 26, }; enum ib_uverbs_query_port_flags { IB_UVERBS_QPF_GRH_REQUIRED = 1 << 0, }; enum ib_uverbs_flow_action_esp_keymat { IB_UVERBS_FLOW_ACTION_ESP_KEYMAT_AES_GCM, }; enum ib_uverbs_flow_action_esp_keymat_aes_gcm_iv_algo { IB_UVERBS_FLOW_ACTION_IV_ALGO_SEQ, }; struct ib_uverbs_flow_action_esp_keymat_aes_gcm { __aligned_u64 iv; __u32 iv_algo; /* Use enum ib_uverbs_flow_action_esp_keymat_aes_gcm_iv_algo */ __u32 salt; __u32 icv_len; __u32 key_len; __u32 aes_key[256 / 32]; }; enum ib_uverbs_flow_action_esp_replay { IB_UVERBS_FLOW_ACTION_ESP_REPLAY_NONE, IB_UVERBS_FLOW_ACTION_ESP_REPLAY_BMP, }; struct ib_uverbs_flow_action_esp_replay_bmp { __u32 size; }; enum ib_uverbs_flow_action_esp_flags { IB_UVERBS_FLOW_ACTION_ESP_FLAGS_INLINE_CRYPTO = 0UL << 0, /* Default */ IB_UVERBS_FLOW_ACTION_ESP_FLAGS_FULL_OFFLOAD = 1UL << 0, IB_UVERBS_FLOW_ACTION_ESP_FLAGS_TUNNEL = 0UL << 1, /* Default */ IB_UVERBS_FLOW_ACTION_ESP_FLAGS_TRANSPORT = 1UL << 1, IB_UVERBS_FLOW_ACTION_ESP_FLAGS_DECRYPT = 0UL << 2, /* Default */ IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ENCRYPT = 1UL << 2, IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ESN_NEW_WINDOW = 1UL << 3, }; struct ib_uverbs_flow_action_esp_encap { /* This struct represents a list of pointers to flow_xxxx_filter that * encapsulates the payload in ESP tunnel mode. */ RDMA_UAPI_PTR(void *, val_ptr); /* pointer to a flow_xxxx_filter */ RDMA_UAPI_PTR(struct ib_uverbs_flow_action_esp_encap *, next_ptr); __u16 len; /* Len of the filter struct val_ptr points to */ __u16 type; /* Use flow_spec_type enum */ }; struct ib_uverbs_flow_action_esp { __u32 spi; __u32 seq; __u32 tfc_pad; __u32 flags; __aligned_u64 hard_limit_pkts; }; enum ib_uverbs_read_counters_flags { /* prefer read values from driver cache */ IB_UVERBS_READ_COUNTERS_PREFER_CACHED = 1 << 0, }; #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rdma/nes-abi.h��������������������������������������������������������������������������������������0000644�����������������00000006637�14763166030�0007200 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. * Copyright (c) 2005 Topspin Communications. All rights reserved. * Copyright (c) 2005 Cisco Systems. All rights reserved. * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ #ifndef NES_ABI_USER_H #define NES_ABI_USER_H #include <linux/types.h> #define NES_ABI_USERSPACE_VER 2 #define NES_ABI_KERNEL_VER 2 /* * Make sure that all structs defined in this file remain laid out so * that they pack the same way on 32-bit and 64-bit architectures (to * avoid incompatibility between 32-bit userspace and 64-bit kernels). * In particular do not use pointer types -- pass pointers in __u64 * instead. */ struct nes_alloc_ucontext_req { __u32 reserved32; __u8 userspace_ver; __u8 reserved8[3]; }; struct nes_alloc_ucontext_resp { __u32 max_pds; /* maximum pds allowed for this user process */ __u32 max_qps; /* maximum qps allowed for this user process */ __u32 wq_size; /* size of the WQs (sq+rq) allocated to the mmaped area */ __u8 virtwq; /* flag to indicate if virtual WQ are to be used or not */ __u8 kernel_ver; __u8 reserved[2]; }; struct nes_alloc_pd_resp { __u32 pd_id; __u32 mmap_db_index; }; struct nes_create_cq_req { __aligned_u64 user_cq_buffer; __u32 mcrqf; __u8 reserved[4]; }; struct nes_create_qp_req { __aligned_u64 user_wqe_buffers; __aligned_u64 user_qp_buffer; }; enum iwnes_memreg_type { IWNES_MEMREG_TYPE_MEM = 0x0000, IWNES_MEMREG_TYPE_QP = 0x0001, IWNES_MEMREG_TYPE_CQ = 0x0002, IWNES_MEMREG_TYPE_MW = 0x0003, IWNES_MEMREG_TYPE_FMR = 0x0004, IWNES_MEMREG_TYPE_FMEM = 0x0005, }; struct nes_mem_reg_req { __u32 reg_type; /* indicates if id is memory, QP or CQ */ __u32 reserved; }; struct nes_create_cq_resp { __u32 cq_id; __u32 cq_size; __u32 mmap_db_index; __u32 reserved; }; struct nes_create_qp_resp { __u32 qp_id; __u32 actual_sq_size; __u32 actual_rq_size; __u32 mmap_sq_db_index; __u32 mmap_rq_db_index; __u32 nes_drv_opt; }; #endif /* NES_ABI_USER_H */ �������������������������������������������������������������������������������������������������rdma/ib_user_verbs.h��������������������������������������������������������������������������������0000644�����������������00000063406�14763166030�0010510 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2005 Topspin Communications. All rights reserved. * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. * Copyright (c) 2005 PathScale, Inc. All rights reserved. * Copyright (c) 2006 Mellanox Technologies. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef IB_USER_VERBS_H #define IB_USER_VERBS_H #include <linux/types.h> /* * Increment this value if any changes that break userspace ABI * compatibility are made. */ #define IB_USER_VERBS_ABI_VERSION 6 #define IB_USER_VERBS_CMD_THRESHOLD 50 enum { IB_USER_VERBS_CMD_GET_CONTEXT, IB_USER_VERBS_CMD_QUERY_DEVICE, IB_USER_VERBS_CMD_QUERY_PORT, IB_USER_VERBS_CMD_ALLOC_PD, IB_USER_VERBS_CMD_DEALLOC_PD, IB_USER_VERBS_CMD_CREATE_AH, IB_USER_VERBS_CMD_MODIFY_AH, IB_USER_VERBS_CMD_QUERY_AH, IB_USER_VERBS_CMD_DESTROY_AH, IB_USER_VERBS_CMD_REG_MR, IB_USER_VERBS_CMD_REG_SMR, IB_USER_VERBS_CMD_REREG_MR, IB_USER_VERBS_CMD_QUERY_MR, IB_USER_VERBS_CMD_DEREG_MR, IB_USER_VERBS_CMD_ALLOC_MW, IB_USER_VERBS_CMD_BIND_MW, IB_USER_VERBS_CMD_DEALLOC_MW, IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL, IB_USER_VERBS_CMD_CREATE_CQ, IB_USER_VERBS_CMD_RESIZE_CQ, IB_USER_VERBS_CMD_DESTROY_CQ, IB_USER_VERBS_CMD_POLL_CQ, IB_USER_VERBS_CMD_PEEK_CQ, IB_USER_VERBS_CMD_REQ_NOTIFY_CQ, IB_USER_VERBS_CMD_CREATE_QP, IB_USER_VERBS_CMD_QUERY_QP, IB_USER_VERBS_CMD_MODIFY_QP, IB_USER_VERBS_CMD_DESTROY_QP, IB_USER_VERBS_CMD_POST_SEND, IB_USER_VERBS_CMD_POST_RECV, IB_USER_VERBS_CMD_ATTACH_MCAST, IB_USER_VERBS_CMD_DETACH_MCAST, IB_USER_VERBS_CMD_CREATE_SRQ, IB_USER_VERBS_CMD_MODIFY_SRQ, IB_USER_VERBS_CMD_QUERY_SRQ, IB_USER_VERBS_CMD_DESTROY_SRQ, IB_USER_VERBS_CMD_POST_SRQ_RECV, IB_USER_VERBS_CMD_OPEN_XRCD, IB_USER_VERBS_CMD_CLOSE_XRCD, IB_USER_VERBS_CMD_CREATE_XSRQ, IB_USER_VERBS_CMD_OPEN_QP, }; enum { IB_USER_VERBS_EX_CMD_QUERY_DEVICE = IB_USER_VERBS_CMD_QUERY_DEVICE, IB_USER_VERBS_EX_CMD_CREATE_CQ = IB_USER_VERBS_CMD_CREATE_CQ, IB_USER_VERBS_EX_CMD_CREATE_QP = IB_USER_VERBS_CMD_CREATE_QP, IB_USER_VERBS_EX_CMD_MODIFY_QP = IB_USER_VERBS_CMD_MODIFY_QP, IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD, IB_USER_VERBS_EX_CMD_DESTROY_FLOW, IB_USER_VERBS_EX_CMD_CREATE_WQ, IB_USER_VERBS_EX_CMD_MODIFY_WQ, IB_USER_VERBS_EX_CMD_DESTROY_WQ, IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL, IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL, IB_USER_VERBS_EX_CMD_MODIFY_CQ }; /* * Make sure that all structs defined in this file remain laid out so * that they pack the same way on 32-bit and 64-bit architectures (to * avoid incompatibility between 32-bit userspace and 64-bit kernels). * Specifically: * - Do not use pointer types -- pass pointers in __u64 instead. * - Make sure that any structure larger than 4 bytes is padded to a * multiple of 8 bytes. Otherwise the structure size will be * different between 32-bit and 64-bit architectures. */ struct ib_uverbs_async_event_desc { __aligned_u64 element; __u32 event_type; /* enum ib_event_type */ __u32 reserved; }; struct ib_uverbs_comp_event_desc { __aligned_u64 cq_handle; }; struct ib_uverbs_cq_moderation_caps { __u16 max_cq_moderation_count; __u16 max_cq_moderation_period; __u32 reserved; }; /* * All commands from userspace should start with a __u32 command field * followed by __u16 in_words and out_words fields (which give the * length of the command block and response buffer if any in 32-bit * words). The kernel driver will read these fields first and read * the rest of the command struct based on these value. */ #define IB_USER_VERBS_CMD_COMMAND_MASK 0xff #define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80000000u struct ib_uverbs_cmd_hdr { __u32 command; __u16 in_words; __u16 out_words; }; struct ib_uverbs_ex_cmd_hdr { __aligned_u64 response; __u16 provider_in_words; __u16 provider_out_words; __u32 cmd_hdr_reserved; }; struct ib_uverbs_get_context { __aligned_u64 response; __aligned_u64 driver_data[0]; }; struct ib_uverbs_get_context_resp { __u32 async_fd; __u32 num_comp_vectors; }; struct ib_uverbs_query_device { __aligned_u64 response; __aligned_u64 driver_data[0]; }; struct ib_uverbs_query_device_resp { __aligned_u64 fw_ver; __be64 node_guid; __be64 sys_image_guid; __aligned_u64 max_mr_size; __aligned_u64 page_size_cap; __u32 vendor_id; __u32 vendor_part_id; __u32 hw_ver; __u32 max_qp; __u32 max_qp_wr; __u32 device_cap_flags; __u32 max_sge; __u32 max_sge_rd; __u32 max_cq; __u32 max_cqe; __u32 max_mr; __u32 max_pd; __u32 max_qp_rd_atom; __u32 max_ee_rd_atom; __u32 max_res_rd_atom; __u32 max_qp_init_rd_atom; __u32 max_ee_init_rd_atom; __u32 atomic_cap; __u32 max_ee; __u32 max_rdd; __u32 max_mw; __u32 max_raw_ipv6_qp; __u32 max_raw_ethy_qp; __u32 max_mcast_grp; __u32 max_mcast_qp_attach; __u32 max_total_mcast_qp_attach; __u32 max_ah; __u32 max_fmr; __u32 max_map_per_fmr; __u32 max_srq; __u32 max_srq_wr; __u32 max_srq_sge; __u16 max_pkeys; __u8 local_ca_ack_delay; __u8 phys_port_cnt; __u8 reserved[4]; }; struct ib_uverbs_ex_query_device { __u32 comp_mask; __u32 reserved; }; struct ib_uverbs_odp_caps { __aligned_u64 general_caps; struct { __u32 rc_odp_caps; __u32 uc_odp_caps; __u32 ud_odp_caps; } per_transport_caps; __u32 reserved; }; struct ib_uverbs_rss_caps { /* Corresponding bit will be set if qp type from * 'enum ib_qp_type' is supported, e.g. * supported_qpts |= 1 << IB_QPT_UD */ __u32 supported_qpts; __u32 max_rwq_indirection_tables; __u32 max_rwq_indirection_table_size; __u32 reserved; }; struct ib_uverbs_tm_caps { /* Max size of rendezvous request message */ __u32 max_rndv_hdr_size; /* Max number of entries in tag matching list */ __u32 max_num_tags; /* TM flags */ __u32 flags; /* Max number of outstanding list operations */ __u32 max_ops; /* Max number of SGE in tag matching entry */ __u32 max_sge; __u32 reserved; }; struct ib_uverbs_ex_query_device_resp { struct ib_uverbs_query_device_resp base; __u32 comp_mask; __u32 response_length; struct ib_uverbs_odp_caps odp_caps; __aligned_u64 timestamp_mask; __aligned_u64 hca_core_clock; /* in KHZ */ __aligned_u64 device_cap_flags_ex; struct ib_uverbs_rss_caps rss_caps; __u32 max_wq_type_rq; __u32 raw_packet_caps; struct ib_uverbs_tm_caps tm_caps; struct ib_uverbs_cq_moderation_caps cq_moderation_caps; __aligned_u64 max_dm_size; }; struct ib_uverbs_query_port { __aligned_u64 response; __u8 port_num; __u8 reserved[7]; __aligned_u64 driver_data[0]; }; struct ib_uverbs_query_port_resp { __u32 port_cap_flags; /* see ib_uverbs_query_port_cap_flags */ __u32 max_msg_sz; __u32 bad_pkey_cntr; __u32 qkey_viol_cntr; __u32 gid_tbl_len; __u16 pkey_tbl_len; __u16 lid; __u16 sm_lid; __u8 state; __u8 max_mtu; __u8 active_mtu; __u8 lmc; __u8 max_vl_num; __u8 sm_sl; __u8 subnet_timeout; __u8 init_type_reply; __u8 active_width; __u8 active_speed; __u8 phys_state; __u8 link_layer; __u8 flags; /* see ib_uverbs_query_port_flags */ __u8 reserved; }; struct ib_uverbs_alloc_pd { __aligned_u64 response; __aligned_u64 driver_data[0]; }; struct ib_uverbs_alloc_pd_resp { __u32 pd_handle; }; struct ib_uverbs_dealloc_pd { __u32 pd_handle; }; struct ib_uverbs_open_xrcd { __aligned_u64 response; __u32 fd; __u32 oflags; __aligned_u64 driver_data[0]; }; struct ib_uverbs_open_xrcd_resp { __u32 xrcd_handle; }; struct ib_uverbs_close_xrcd { __u32 xrcd_handle; }; struct ib_uverbs_reg_mr { __aligned_u64 response; __aligned_u64 start; __aligned_u64 length; __aligned_u64 hca_va; __u32 pd_handle; __u32 access_flags; __aligned_u64 driver_data[0]; }; struct ib_uverbs_reg_mr_resp { __u32 mr_handle; __u32 lkey; __u32 rkey; }; struct ib_uverbs_rereg_mr { __aligned_u64 response; __u32 mr_handle; __u32 flags; __aligned_u64 start; __aligned_u64 length; __aligned_u64 hca_va; __u32 pd_handle; __u32 access_flags; }; struct ib_uverbs_rereg_mr_resp { __u32 lkey; __u32 rkey; }; struct ib_uverbs_dereg_mr { __u32 mr_handle; }; struct ib_uverbs_alloc_mw { __aligned_u64 response; __u32 pd_handle; __u8 mw_type; __u8 reserved[3]; }; struct ib_uverbs_alloc_mw_resp { __u32 mw_handle; __u32 rkey; }; struct ib_uverbs_dealloc_mw { __u32 mw_handle; }; struct ib_uverbs_create_comp_channel { __aligned_u64 response; }; struct ib_uverbs_create_comp_channel_resp { __u32 fd; }; struct ib_uverbs_create_cq { __aligned_u64 response; __aligned_u64 user_handle; __u32 cqe; __u32 comp_vector; __s32 comp_channel; __u32 reserved; __aligned_u64 driver_data[0]; }; enum ib_uverbs_ex_create_cq_flags { IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION = 1 << 0, IB_UVERBS_CQ_FLAGS_IGNORE_OVERRUN = 1 << 1, }; struct ib_uverbs_ex_create_cq { __aligned_u64 user_handle; __u32 cqe; __u32 comp_vector; __s32 comp_channel; __u32 comp_mask; __u32 flags; /* bitmask of ib_uverbs_ex_create_cq_flags */ __u32 reserved; }; struct ib_uverbs_create_cq_resp { __u32 cq_handle; __u32 cqe; }; struct ib_uverbs_ex_create_cq_resp { struct ib_uverbs_create_cq_resp base; __u32 comp_mask; __u32 response_length; }; struct ib_uverbs_resize_cq { __aligned_u64 response; __u32 cq_handle; __u32 cqe; __aligned_u64 driver_data[0]; }; struct ib_uverbs_resize_cq_resp { __u32 cqe; __u32 reserved; __aligned_u64 driver_data[0]; }; struct ib_uverbs_poll_cq { __aligned_u64 response; __u32 cq_handle; __u32 ne; }; struct ib_uverbs_wc { __aligned_u64 wr_id; __u32 status; __u32 opcode; __u32 vendor_err; __u32 byte_len; union { __be32 imm_data; __u32 invalidate_rkey; } ex; __u32 qp_num; __u32 src_qp; __u32 wc_flags; __u16 pkey_index; __u16 slid; __u8 sl; __u8 dlid_path_bits; __u8 port_num; __u8 reserved; }; struct ib_uverbs_poll_cq_resp { __u32 count; __u32 reserved; struct ib_uverbs_wc wc[0]; }; struct ib_uverbs_req_notify_cq { __u32 cq_handle; __u32 solicited_only; }; struct ib_uverbs_destroy_cq { __aligned_u64 response; __u32 cq_handle; __u32 reserved; }; struct ib_uverbs_destroy_cq_resp { __u32 comp_events_reported; __u32 async_events_reported; }; struct ib_uverbs_global_route { __u8 dgid[16]; __u32 flow_label; __u8 sgid_index; __u8 hop_limit; __u8 traffic_class; __u8 reserved; }; struct ib_uverbs_ah_attr { struct ib_uverbs_global_route grh; __u16 dlid; __u8 sl; __u8 src_path_bits; __u8 static_rate; __u8 is_global; __u8 port_num; __u8 reserved; }; struct ib_uverbs_qp_attr { __u32 qp_attr_mask; __u32 qp_state; __u32 cur_qp_state; __u32 path_mtu; __u32 path_mig_state; __u32 qkey; __u32 rq_psn; __u32 sq_psn; __u32 dest_qp_num; __u32 qp_access_flags; struct ib_uverbs_ah_attr ah_attr; struct ib_uverbs_ah_attr alt_ah_attr; /* ib_qp_cap */ __u32 max_send_wr; __u32 max_recv_wr; __u32 max_send_sge; __u32 max_recv_sge; __u32 max_inline_data; __u16 pkey_index; __u16 alt_pkey_index; __u8 en_sqd_async_notify; __u8 sq_draining; __u8 max_rd_atomic; __u8 max_dest_rd_atomic; __u8 min_rnr_timer; __u8 port_num; __u8 timeout; __u8 retry_cnt; __u8 rnr_retry; __u8 alt_port_num; __u8 alt_timeout; __u8 reserved[5]; }; struct ib_uverbs_create_qp { __aligned_u64 response; __aligned_u64 user_handle; __u32 pd_handle; __u32 send_cq_handle; __u32 recv_cq_handle; __u32 srq_handle; __u32 max_send_wr; __u32 max_recv_wr; __u32 max_send_sge; __u32 max_recv_sge; __u32 max_inline_data; __u8 sq_sig_all; __u8 qp_type; __u8 is_srq; __u8 reserved; __aligned_u64 driver_data[0]; }; enum ib_uverbs_create_qp_mask { IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1UL << 0, }; enum { IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE, }; enum { /* * This value is equal to IB_QP_DEST_QPN. */ IB_USER_LEGACY_LAST_QP_ATTR_MASK = 1ULL << 20, }; enum { /* * This value is equal to IB_QP_RATE_LIMIT. */ IB_USER_LAST_QP_ATTR_MASK = 1ULL << 25, }; struct ib_uverbs_ex_create_qp { __aligned_u64 user_handle; __u32 pd_handle; __u32 send_cq_handle; __u32 recv_cq_handle; __u32 srq_handle; __u32 max_send_wr; __u32 max_recv_wr; __u32 max_send_sge; __u32 max_recv_sge; __u32 max_inline_data; __u8 sq_sig_all; __u8 qp_type; __u8 is_srq; __u8 reserved; __u32 comp_mask; __u32 create_flags; __u32 rwq_ind_tbl_handle; __u32 source_qpn; }; struct ib_uverbs_open_qp { __aligned_u64 response; __aligned_u64 user_handle; __u32 pd_handle; __u32 qpn; __u8 qp_type; __u8 reserved[7]; __aligned_u64 driver_data[0]; }; /* also used for open response */ struct ib_uverbs_create_qp_resp { __u32 qp_handle; __u32 qpn; __u32 max_send_wr; __u32 max_recv_wr; __u32 max_send_sge; __u32 max_recv_sge; __u32 max_inline_data; __u32 reserved; }; struct ib_uverbs_ex_create_qp_resp { struct ib_uverbs_create_qp_resp base; __u32 comp_mask; __u32 response_length; }; /* * This struct needs to remain a multiple of 8 bytes to keep the * alignment of the modify QP parameters. */ struct ib_uverbs_qp_dest { __u8 dgid[16]; __u32 flow_label; __u16 dlid; __u16 reserved; __u8 sgid_index; __u8 hop_limit; __u8 traffic_class; __u8 sl; __u8 src_path_bits; __u8 static_rate; __u8 is_global; __u8 port_num; }; struct ib_uverbs_query_qp { __aligned_u64 response; __u32 qp_handle; __u32 attr_mask; __aligned_u64 driver_data[0]; }; struct ib_uverbs_query_qp_resp { struct ib_uverbs_qp_dest dest; struct ib_uverbs_qp_dest alt_dest; __u32 max_send_wr; __u32 max_recv_wr; __u32 max_send_sge; __u32 max_recv_sge; __u32 max_inline_data; __u32 qkey; __u32 rq_psn; __u32 sq_psn; __u32 dest_qp_num; __u32 qp_access_flags; __u16 pkey_index; __u16 alt_pkey_index; __u8 qp_state; __u8 cur_qp_state; __u8 path_mtu; __u8 path_mig_state; __u8 sq_draining; __u8 max_rd_atomic; __u8 max_dest_rd_atomic; __u8 min_rnr_timer; __u8 port_num; __u8 timeout; __u8 retry_cnt; __u8 rnr_retry; __u8 alt_port_num; __u8 alt_timeout; __u8 sq_sig_all; __u8 reserved[5]; __aligned_u64 driver_data[0]; }; struct ib_uverbs_modify_qp { struct ib_uverbs_qp_dest dest; struct ib_uverbs_qp_dest alt_dest; __u32 qp_handle; __u32 attr_mask; __u32 qkey; __u32 rq_psn; __u32 sq_psn; __u32 dest_qp_num; __u32 qp_access_flags; __u16 pkey_index; __u16 alt_pkey_index; __u8 qp_state; __u8 cur_qp_state; __u8 path_mtu; __u8 path_mig_state; __u8 en_sqd_async_notify; __u8 max_rd_atomic; __u8 max_dest_rd_atomic; __u8 min_rnr_timer; __u8 port_num; __u8 timeout; __u8 retry_cnt; __u8 rnr_retry; __u8 alt_port_num; __u8 alt_timeout; __u8 reserved[2]; __aligned_u64 driver_data[0]; }; struct ib_uverbs_ex_modify_qp { struct ib_uverbs_modify_qp base; __u32 rate_limit; __u32 reserved; }; struct ib_uverbs_modify_qp_resp { }; struct ib_uverbs_ex_modify_qp_resp { __u32 comp_mask; __u32 response_length; }; struct ib_uverbs_destroy_qp { __aligned_u64 response; __u32 qp_handle; __u32 reserved; }; struct ib_uverbs_destroy_qp_resp { __u32 events_reported; }; /* * The ib_uverbs_sge structure isn't used anywhere, since we assume * the ib_sge structure is packed the same way on 32-bit and 64-bit * architectures in both kernel and user space. It's just here to * document the ABI. */ struct ib_uverbs_sge { __aligned_u64 addr; __u32 length; __u32 lkey; }; enum ib_uverbs_wr_opcode { IB_UVERBS_WR_RDMA_WRITE = 0, IB_UVERBS_WR_RDMA_WRITE_WITH_IMM = 1, IB_UVERBS_WR_SEND = 2, IB_UVERBS_WR_SEND_WITH_IMM = 3, IB_UVERBS_WR_RDMA_READ = 4, IB_UVERBS_WR_ATOMIC_CMP_AND_SWP = 5, IB_UVERBS_WR_ATOMIC_FETCH_AND_ADD = 6, IB_UVERBS_WR_LOCAL_INV = 7, IB_UVERBS_WR_BIND_MW = 8, IB_UVERBS_WR_SEND_WITH_INV = 9, IB_UVERBS_WR_TSO = 10, IB_UVERBS_WR_RDMA_READ_WITH_INV = 11, IB_UVERBS_WR_MASKED_ATOMIC_CMP_AND_SWP = 12, IB_UVERBS_WR_MASKED_ATOMIC_FETCH_AND_ADD = 13, /* Review enum ib_wr_opcode before modifying this */ }; struct ib_uverbs_send_wr { __aligned_u64 wr_id; __u32 num_sge; __u32 opcode; /* see enum ib_uverbs_wr_opcode */ __u32 send_flags; union { __be32 imm_data; __u32 invalidate_rkey; } ex; union { struct { __aligned_u64 remote_addr; __u32 rkey; __u32 reserved; } rdma; struct { __aligned_u64 remote_addr; __aligned_u64 compare_add; __aligned_u64 swap; __u32 rkey; __u32 reserved; } atomic; struct { __u32 ah; __u32 remote_qpn; __u32 remote_qkey; __u32 reserved; } ud; } wr; }; struct ib_uverbs_post_send { __aligned_u64 response; __u32 qp_handle; __u32 wr_count; __u32 sge_count; __u32 wqe_size; struct ib_uverbs_send_wr send_wr[0]; }; struct ib_uverbs_post_send_resp { __u32 bad_wr; }; struct ib_uverbs_recv_wr { __aligned_u64 wr_id; __u32 num_sge; __u32 reserved; }; struct ib_uverbs_post_recv { __aligned_u64 response; __u32 qp_handle; __u32 wr_count; __u32 sge_count; __u32 wqe_size; struct ib_uverbs_recv_wr recv_wr[0]; }; struct ib_uverbs_post_recv_resp { __u32 bad_wr; }; struct ib_uverbs_post_srq_recv { __aligned_u64 response; __u32 srq_handle; __u32 wr_count; __u32 sge_count; __u32 wqe_size; struct ib_uverbs_recv_wr recv[0]; }; struct ib_uverbs_post_srq_recv_resp { __u32 bad_wr; }; struct ib_uverbs_create_ah { __aligned_u64 response; __aligned_u64 user_handle; __u32 pd_handle; __u32 reserved; struct ib_uverbs_ah_attr attr; }; struct ib_uverbs_create_ah_resp { __u32 ah_handle; }; struct ib_uverbs_destroy_ah { __u32 ah_handle; }; struct ib_uverbs_attach_mcast { __u8 gid[16]; __u32 qp_handle; __u16 mlid; __u16 reserved; __aligned_u64 driver_data[0]; }; struct ib_uverbs_detach_mcast { __u8 gid[16]; __u32 qp_handle; __u16 mlid; __u16 reserved; __aligned_u64 driver_data[0]; }; struct ib_uverbs_flow_spec_hdr { __u32 type; __u16 size; __u16 reserved; /* followed by flow_spec */ __aligned_u64 flow_spec_data[0]; }; struct ib_uverbs_flow_eth_filter { __u8 dst_mac[6]; __u8 src_mac[6]; __be16 ether_type; __be16 vlan_tag; }; struct ib_uverbs_flow_spec_eth { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; struct ib_uverbs_flow_eth_filter val; struct ib_uverbs_flow_eth_filter mask; }; struct ib_uverbs_flow_ipv4_filter { __be32 src_ip; __be32 dst_ip; __u8 proto; __u8 tos; __u8 ttl; __u8 flags; }; struct ib_uverbs_flow_spec_ipv4 { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; struct ib_uverbs_flow_ipv4_filter val; struct ib_uverbs_flow_ipv4_filter mask; }; struct ib_uverbs_flow_tcp_udp_filter { __be16 dst_port; __be16 src_port; }; struct ib_uverbs_flow_spec_tcp_udp { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; struct ib_uverbs_flow_tcp_udp_filter val; struct ib_uverbs_flow_tcp_udp_filter mask; }; struct ib_uverbs_flow_ipv6_filter { __u8 src_ip[16]; __u8 dst_ip[16]; __be32 flow_label; __u8 next_hdr; __u8 traffic_class; __u8 hop_limit; __u8 reserved; }; struct ib_uverbs_flow_spec_ipv6 { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; struct ib_uverbs_flow_ipv6_filter val; struct ib_uverbs_flow_ipv6_filter mask; }; struct ib_uverbs_flow_spec_action_tag { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; __u32 tag_id; __u32 reserved1; }; struct ib_uverbs_flow_spec_action_drop { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; }; struct ib_uverbs_flow_spec_action_handle { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; __u32 handle; __u32 reserved1; }; struct ib_uverbs_flow_spec_action_count { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; __u32 handle; __u32 reserved1; }; struct ib_uverbs_flow_tunnel_filter { __be32 tunnel_id; }; struct ib_uverbs_flow_spec_tunnel { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; struct ib_uverbs_flow_tunnel_filter val; struct ib_uverbs_flow_tunnel_filter mask; }; struct ib_uverbs_flow_spec_esp_filter { __u32 spi; __u32 seq; }; struct ib_uverbs_flow_spec_esp { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; struct ib_uverbs_flow_spec_esp_filter val; struct ib_uverbs_flow_spec_esp_filter mask; }; struct ib_uverbs_flow_gre_filter { /* c_ks_res0_ver field is bits 0-15 in offset 0 of a standard GRE header: * bit 0 - C - checksum bit. * bit 1 - reserved. set to 0. * bit 2 - key bit. * bit 3 - sequence number bit. * bits 4:12 - reserved. set to 0. * bits 13:15 - GRE version. */ __be16 c_ks_res0_ver; __be16 protocol; __be32 key; }; struct ib_uverbs_flow_spec_gre { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; struct ib_uverbs_flow_gre_filter val; struct ib_uverbs_flow_gre_filter mask; }; struct ib_uverbs_flow_mpls_filter { /* The field includes the entire MPLS label: * bits 0:19 - label field. * bits 20:22 - traffic class field. * bits 23 - bottom of stack bit. * bits 24:31 - ttl field. */ __be32 label; }; struct ib_uverbs_flow_spec_mpls { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; struct ib_uverbs_flow_mpls_filter val; struct ib_uverbs_flow_mpls_filter mask; }; struct ib_uverbs_flow_attr { __u32 type; __u16 size; __u16 priority; __u8 num_of_specs; __u8 reserved[2]; __u8 port; __u32 flags; /* Following are the optional layers according to user request * struct ib_flow_spec_xxx * struct ib_flow_spec_yyy */ struct ib_uverbs_flow_spec_hdr flow_specs[0]; }; struct ib_uverbs_create_flow { __u32 comp_mask; __u32 qp_handle; struct ib_uverbs_flow_attr flow_attr; }; struct ib_uverbs_create_flow_resp { __u32 comp_mask; __u32 flow_handle; }; struct ib_uverbs_destroy_flow { __u32 comp_mask; __u32 flow_handle; }; struct ib_uverbs_create_srq { __aligned_u64 response; __aligned_u64 user_handle; __u32 pd_handle; __u32 max_wr; __u32 max_sge; __u32 srq_limit; __aligned_u64 driver_data[0]; }; struct ib_uverbs_create_xsrq { __aligned_u64 response; __aligned_u64 user_handle; __u32 srq_type; __u32 pd_handle; __u32 max_wr; __u32 max_sge; __u32 srq_limit; __u32 max_num_tags; __u32 xrcd_handle; __u32 cq_handle; __aligned_u64 driver_data[0]; }; struct ib_uverbs_create_srq_resp { __u32 srq_handle; __u32 max_wr; __u32 max_sge; __u32 srqn; }; struct ib_uverbs_modify_srq { __u32 srq_handle; __u32 attr_mask; __u32 max_wr; __u32 srq_limit; __aligned_u64 driver_data[0]; }; struct ib_uverbs_query_srq { __aligned_u64 response; __u32 srq_handle; __u32 reserved; __aligned_u64 driver_data[0]; }; struct ib_uverbs_query_srq_resp { __u32 max_wr; __u32 max_sge; __u32 srq_limit; __u32 reserved; }; struct ib_uverbs_destroy_srq { __aligned_u64 response; __u32 srq_handle; __u32 reserved; }; struct ib_uverbs_destroy_srq_resp { __u32 events_reported; }; struct ib_uverbs_ex_create_wq { __u32 comp_mask; __u32 wq_type; __aligned_u64 user_handle; __u32 pd_handle; __u32 cq_handle; __u32 max_wr; __u32 max_sge; __u32 create_flags; /* Use enum ib_wq_flags */ __u32 reserved; }; struct ib_uverbs_ex_create_wq_resp { __u32 comp_mask; __u32 response_length; __u32 wq_handle; __u32 max_wr; __u32 max_sge; __u32 wqn; }; struct ib_uverbs_ex_destroy_wq { __u32 comp_mask; __u32 wq_handle; }; struct ib_uverbs_ex_destroy_wq_resp { __u32 comp_mask; __u32 response_length; __u32 events_reported; __u32 reserved; }; struct ib_uverbs_ex_modify_wq { __u32 attr_mask; __u32 wq_handle; __u32 wq_state; __u32 curr_wq_state; __u32 flags; /* Use enum ib_wq_flags */ __u32 flags_mask; /* Use enum ib_wq_flags */ }; /* Prevent memory allocation rather than max expected size */ #define IB_USER_VERBS_MAX_LOG_IND_TBL_SIZE 0x0d struct ib_uverbs_ex_create_rwq_ind_table { __u32 comp_mask; __u32 log_ind_tbl_size; /* Following are the wq handles according to log_ind_tbl_size * wq_handle1 * wq_handle2 */ __u32 wq_handles[0]; }; struct ib_uverbs_ex_create_rwq_ind_table_resp { __u32 comp_mask; __u32 response_length; __u32 ind_tbl_handle; __u32 ind_tbl_num; }; struct ib_uverbs_ex_destroy_rwq_ind_table { __u32 comp_mask; __u32 ind_tbl_handle; }; struct ib_uverbs_cq_moderation { __u16 cq_count; __u16 cq_period; }; struct ib_uverbs_ex_modify_cq { __u32 cq_handle; __u32 attr_mask; struct ib_uverbs_cq_moderation attr; __u32 reserved; }; #define IB_DEVICE_NAME_MAX 64 #endif /* IB_USER_VERBS_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rdma/vmw_pvrdma-abi.h�������������������������������������������������������������������������������0000644�����������������00000017177�14763166030�0010576 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ /* * Copyright (c) 2012-2016 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of EITHER the GNU General Public License * version 2 as published by the Free Software Foundation or the BSD * 2-Clause License. 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 version 2 for more details at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html. * * You should have received a copy of the GNU General Public License * along with this program available in the file COPYING in the main * directory of this source tree. * * The BSD 2-Clause License * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef __VMW_PVRDMA_ABI_H__ #define __VMW_PVRDMA_ABI_H__ #include <linux/types.h> #define PVRDMA_UVERBS_ABI_VERSION 3 /* ABI Version. */ #define PVRDMA_UAR_HANDLE_MASK 0x00FFFFFF /* Bottom 24 bits. */ #define PVRDMA_UAR_QP_OFFSET 0 /* QP doorbell. */ #define PVRDMA_UAR_QP_SEND (1 << 30) /* Send bit. */ #define PVRDMA_UAR_QP_RECV (1 << 31) /* Recv bit. */ #define PVRDMA_UAR_CQ_OFFSET 4 /* CQ doorbell. */ #define PVRDMA_UAR_CQ_ARM_SOL (1 << 29) /* Arm solicited bit. */ #define PVRDMA_UAR_CQ_ARM (1 << 30) /* Arm bit. */ #define PVRDMA_UAR_CQ_POLL (1 << 31) /* Poll bit. */ #define PVRDMA_UAR_SRQ_OFFSET 8 /* SRQ doorbell. */ #define PVRDMA_UAR_SRQ_RECV (1 << 30) /* Recv bit. */ enum pvrdma_wr_opcode { PVRDMA_WR_RDMA_WRITE, PVRDMA_WR_RDMA_WRITE_WITH_IMM, PVRDMA_WR_SEND, PVRDMA_WR_SEND_WITH_IMM, PVRDMA_WR_RDMA_READ, PVRDMA_WR_ATOMIC_CMP_AND_SWP, PVRDMA_WR_ATOMIC_FETCH_AND_ADD, PVRDMA_WR_LSO, PVRDMA_WR_SEND_WITH_INV, PVRDMA_WR_RDMA_READ_WITH_INV, PVRDMA_WR_LOCAL_INV, PVRDMA_WR_FAST_REG_MR, PVRDMA_WR_MASKED_ATOMIC_CMP_AND_SWP, PVRDMA_WR_MASKED_ATOMIC_FETCH_AND_ADD, PVRDMA_WR_BIND_MW, PVRDMA_WR_REG_SIG_MR, PVRDMA_WR_ERROR, }; enum pvrdma_wc_status { PVRDMA_WC_SUCCESS, PVRDMA_WC_LOC_LEN_ERR, PVRDMA_WC_LOC_QP_OP_ERR, PVRDMA_WC_LOC_EEC_OP_ERR, PVRDMA_WC_LOC_PROT_ERR, PVRDMA_WC_WR_FLUSH_ERR, PVRDMA_WC_MW_BIND_ERR, PVRDMA_WC_BAD_RESP_ERR, PVRDMA_WC_LOC_ACCESS_ERR, PVRDMA_WC_REM_INV_REQ_ERR, PVRDMA_WC_REM_ACCESS_ERR, PVRDMA_WC_REM_OP_ERR, PVRDMA_WC_RETRY_EXC_ERR, PVRDMA_WC_RNR_RETRY_EXC_ERR, PVRDMA_WC_LOC_RDD_VIOL_ERR, PVRDMA_WC_REM_INV_RD_REQ_ERR, PVRDMA_WC_REM_ABORT_ERR, PVRDMA_WC_INV_EECN_ERR, PVRDMA_WC_INV_EEC_STATE_ERR, PVRDMA_WC_FATAL_ERR, PVRDMA_WC_RESP_TIMEOUT_ERR, PVRDMA_WC_GENERAL_ERR, }; enum pvrdma_wc_opcode { PVRDMA_WC_SEND, PVRDMA_WC_RDMA_WRITE, PVRDMA_WC_RDMA_READ, PVRDMA_WC_COMP_SWAP, PVRDMA_WC_FETCH_ADD, PVRDMA_WC_BIND_MW, PVRDMA_WC_LSO, PVRDMA_WC_LOCAL_INV, PVRDMA_WC_FAST_REG_MR, PVRDMA_WC_MASKED_COMP_SWAP, PVRDMA_WC_MASKED_FETCH_ADD, PVRDMA_WC_RECV = 1 << 7, PVRDMA_WC_RECV_RDMA_WITH_IMM, }; enum pvrdma_wc_flags { PVRDMA_WC_GRH = 1 << 0, PVRDMA_WC_WITH_IMM = 1 << 1, PVRDMA_WC_WITH_INVALIDATE = 1 << 2, PVRDMA_WC_IP_CSUM_OK = 1 << 3, PVRDMA_WC_WITH_SMAC = 1 << 4, PVRDMA_WC_WITH_VLAN = 1 << 5, PVRDMA_WC_WITH_NETWORK_HDR_TYPE = 1 << 6, PVRDMA_WC_FLAGS_MAX = PVRDMA_WC_WITH_NETWORK_HDR_TYPE, }; struct pvrdma_alloc_ucontext_resp { __u32 qp_tab_size; __u32 reserved; }; struct pvrdma_alloc_pd_resp { __u32 pdn; __u32 reserved; }; struct pvrdma_create_cq { __aligned_u64 buf_addr; __u32 buf_size; __u32 reserved; }; struct pvrdma_create_cq_resp { __u32 cqn; __u32 reserved; }; struct pvrdma_resize_cq { __aligned_u64 buf_addr; __u32 buf_size; __u32 reserved; }; struct pvrdma_create_srq { __aligned_u64 buf_addr; __u32 buf_size; __u32 reserved; }; struct pvrdma_create_srq_resp { __u32 srqn; __u32 reserved; }; struct pvrdma_create_qp { __aligned_u64 rbuf_addr; __aligned_u64 sbuf_addr; __u32 rbuf_size; __u32 sbuf_size; __aligned_u64 qp_addr; }; /* PVRDMA masked atomic compare and swap */ struct pvrdma_ex_cmp_swap { __aligned_u64 swap_val; __aligned_u64 compare_val; __aligned_u64 swap_mask; __aligned_u64 compare_mask; }; /* PVRDMA masked atomic fetch and add */ struct pvrdma_ex_fetch_add { __aligned_u64 add_val; __aligned_u64 field_boundary; }; /* PVRDMA address vector. */ struct pvrdma_av { __u32 port_pd; __u32 sl_tclass_flowlabel; __u8 dgid[16]; __u8 src_path_bits; __u8 gid_index; __u8 stat_rate; __u8 hop_limit; __u8 dmac[6]; __u8 reserved[6]; }; /* PVRDMA scatter/gather entry */ struct pvrdma_sge { __aligned_u64 addr; __u32 length; __u32 lkey; }; /* PVRDMA receive queue work request */ struct pvrdma_rq_wqe_hdr { __aligned_u64 wr_id; /* wr id */ __u32 num_sge; /* size of s/g array */ __u32 total_len; /* reserved */ }; /* Use pvrdma_sge (ib_sge) for receive queue s/g array elements. */ /* PVRDMA send queue work request */ struct pvrdma_sq_wqe_hdr { __aligned_u64 wr_id; /* wr id */ __u32 num_sge; /* size of s/g array */ __u32 total_len; /* reserved */ __u32 opcode; /* operation type */ __u32 send_flags; /* wr flags */ union { __be32 imm_data; __u32 invalidate_rkey; } ex; __u32 reserved; union { struct { __aligned_u64 remote_addr; __u32 rkey; __u8 reserved[4]; } rdma; struct { __aligned_u64 remote_addr; __aligned_u64 compare_add; __aligned_u64 swap; __u32 rkey; __u32 reserved; } atomic; struct { __aligned_u64 remote_addr; __u32 log_arg_sz; __u32 rkey; union { struct pvrdma_ex_cmp_swap cmp_swap; struct pvrdma_ex_fetch_add fetch_add; } wr_data; } masked_atomics; struct { __aligned_u64 iova_start; __aligned_u64 pl_pdir_dma; __u32 page_shift; __u32 page_list_len; __u32 length; __u32 access_flags; __u32 rkey; __u32 reserved; } fast_reg; struct { __u32 remote_qpn; __u32 remote_qkey; struct pvrdma_av av; } ud; } wr; }; /* Use pvrdma_sge (ib_sge) for send queue s/g array elements. */ /* Completion queue element. */ struct pvrdma_cqe { __aligned_u64 wr_id; __aligned_u64 qp; __u32 opcode; __u32 status; __u32 byte_len; __be32 imm_data; __u32 src_qp; __u32 wc_flags; __u32 vendor_err; __u16 pkey_index; __u16 slid; __u8 sl; __u8 dlid_path_bits; __u8 port_num; __u8 smac[6]; __u8 network_hdr_type; __u8 reserved2[6]; /* Pad to next power of 2 (64). */ }; #endif /* __VMW_PVRDMA_ABI_H__ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rdma/rdma_user_ioctl.h������������������������������������������������������������������������������0000644�����������������00000007245�14763166030�0011031 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2016 Mellanox Technologies, LTD. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef RDMA_USER_IOCTL_H #define RDMA_USER_IOCTL_H #include <rdma/ib_user_mad.h> #include <rdma/hfi/hfi1_ioctl.h> #include <rdma/rdma_user_ioctl_cmds.h> /* Legacy name, for user space application which already use it */ #define IB_IOCTL_MAGIC RDMA_IOCTL_MAGIC /* * General blocks assignments * It is closed on purpose do not expose it it user space * #define MAD_CMD_BASE 0x00 * #define HFI1_CMD_BAS 0xE0 */ /* MAD specific section */ #define IB_USER_MAD_REGISTER_AGENT _IOWR(RDMA_IOCTL_MAGIC, 0x01, struct ib_user_mad_reg_req) #define IB_USER_MAD_UNREGISTER_AGENT _IOW(RDMA_IOCTL_MAGIC, 0x02, __u32) #define IB_USER_MAD_ENABLE_PKEY _IO(RDMA_IOCTL_MAGIC, 0x03) #define IB_USER_MAD_REGISTER_AGENT2 _IOWR(RDMA_IOCTL_MAGIC, 0x04, struct ib_user_mad_reg_req2) /* HFI specific section */ /* allocate HFI and context */ #define HFI1_IOCTL_ASSIGN_CTXT _IOWR(RDMA_IOCTL_MAGIC, 0xE1, struct hfi1_user_info) /* find out what resources we got */ #define HFI1_IOCTL_CTXT_INFO _IOW(RDMA_IOCTL_MAGIC, 0xE2, struct hfi1_ctxt_info) /* set up userspace */ #define HFI1_IOCTL_USER_INFO _IOW(RDMA_IOCTL_MAGIC, 0xE3, struct hfi1_base_info) /* update expected TID entries */ #define HFI1_IOCTL_TID_UPDATE _IOWR(RDMA_IOCTL_MAGIC, 0xE4, struct hfi1_tid_info) /* free expected TID entries */ #define HFI1_IOCTL_TID_FREE _IOWR(RDMA_IOCTL_MAGIC, 0xE5, struct hfi1_tid_info) /* force an update of PIO credit */ #define HFI1_IOCTL_CREDIT_UPD _IO(RDMA_IOCTL_MAGIC, 0xE6) /* control receipt of packets */ #define HFI1_IOCTL_RECV_CTRL _IOW(RDMA_IOCTL_MAGIC, 0xE8, int) /* set the kind of polling we want */ #define HFI1_IOCTL_POLL_TYPE _IOW(RDMA_IOCTL_MAGIC, 0xE9, int) /* ack & clear user status bits */ #define HFI1_IOCTL_ACK_EVENT _IOW(RDMA_IOCTL_MAGIC, 0xEA, unsigned long) /* set context's pkey */ #define HFI1_IOCTL_SET_PKEY _IOW(RDMA_IOCTL_MAGIC, 0xEB, __u16) /* reset context's HW send context */ #define HFI1_IOCTL_CTXT_RESET _IO(RDMA_IOCTL_MAGIC, 0xEC) /* read TID cache invalidations */ #define HFI1_IOCTL_TID_INVAL_READ _IOWR(RDMA_IOCTL_MAGIC, 0xED, struct hfi1_tid_info) /* get the version of the user cdev */ #define HFI1_IOCTL_GET_VERS _IOR(RDMA_IOCTL_MAGIC, 0xEE, int) #endif /* RDMA_USER_IOCTL_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rdma/mlx5_user_ioctl_verbs.h������������������������������������������������������������������������0000644�����������������00000003150�14763166030�0012163 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2018, Mellanox Technologies inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef MLX5_USER_IOCTL_VERBS_H #define MLX5_USER_IOCTL_VERBS_H #include <linux/types.h> enum mlx5_ib_uapi_flow_action_flags { MLX5_IB_UAPI_FLOW_ACTION_FLAGS_REQUIRE_METADATA = 1 << 0, }; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rdma/mlx5-abi.h�������������������������������������������������������������������������������������0000644�����������������00000030000�14763166030�0007255 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef MLX5_ABI_USER_H #define MLX5_ABI_USER_H #include <linux/types.h> #include <linux/if_ether.h> /* For ETH_ALEN. */ #include <rdma/ib_user_ioctl_verbs.h> enum { MLX5_QP_FLAG_SIGNATURE = 1 << 0, MLX5_QP_FLAG_SCATTER_CQE = 1 << 1, MLX5_QP_FLAG_TUNNEL_OFFLOADS = 1 << 2, MLX5_QP_FLAG_BFREG_INDEX = 1 << 3, MLX5_QP_FLAG_TYPE_DCT = 1 << 4, MLX5_QP_FLAG_TYPE_DCI = 1 << 5, }; enum { MLX5_SRQ_FLAG_SIGNATURE = 1 << 0, }; enum { MLX5_WQ_FLAG_SIGNATURE = 1 << 0, }; /* Increment this value if any changes that break userspace ABI * compatibility are made. */ #define MLX5_IB_UVERBS_ABI_VERSION 1 /* Make sure that all structs defined in this file remain laid out so * that they pack the same way on 32-bit and 64-bit architectures (to * avoid incompatibility between 32-bit userspace and 64-bit kernels). * In particular do not use pointer types -- pass pointers in __u64 * instead. */ struct mlx5_ib_alloc_ucontext_req { __u32 total_num_bfregs; __u32 num_low_latency_bfregs; }; enum mlx5_lib_caps { MLX5_LIB_CAP_4K_UAR = (__u64)1 << 0, }; enum mlx5_ib_alloc_uctx_v2_flags { MLX5_IB_ALLOC_UCTX_DEVX = 1 << 0, }; struct mlx5_ib_alloc_ucontext_req_v2 { __u32 total_num_bfregs; __u32 num_low_latency_bfregs; __u32 flags; __u32 comp_mask; __u8 max_cqe_version; __u8 reserved0; __u16 reserved1; __u32 reserved2; __aligned_u64 lib_caps; }; enum mlx5_ib_alloc_ucontext_resp_mask { MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_CORE_CLOCK_OFFSET = 1UL << 0, MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_DUMP_FILL_MKEY = 1UL << 1, }; enum mlx5_user_cmds_supp_uhw { MLX5_USER_CMDS_SUPP_UHW_QUERY_DEVICE = 1 << 0, MLX5_USER_CMDS_SUPP_UHW_CREATE_AH = 1 << 1, }; /* The eth_min_inline response value is set to off-by-one vs the FW * returned value to allow user-space to deal with older kernels. */ enum mlx5_user_inline_mode { MLX5_USER_INLINE_MODE_NA, MLX5_USER_INLINE_MODE_NONE, MLX5_USER_INLINE_MODE_L2, MLX5_USER_INLINE_MODE_IP, MLX5_USER_INLINE_MODE_TCP_UDP, }; enum { MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM = 1 << 0, MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM_REQ_METADATA = 1 << 1, MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM_SPI_STEERING = 1 << 2, MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM_FULL_OFFLOAD = 1 << 3, MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM_TX_IV_IS_ESN = 1 << 4, }; struct mlx5_ib_alloc_ucontext_resp { __u32 qp_tab_size; __u32 bf_reg_size; __u32 tot_bfregs; __u32 cache_line_size; __u16 max_sq_desc_sz; __u16 max_rq_desc_sz; __u32 max_send_wqebb; __u32 max_recv_wr; __u32 max_srq_recv_wr; __u16 num_ports; __u16 flow_action_flags; __u32 comp_mask; __u32 response_length; __u8 cqe_version; __u8 cmds_supp_uhw; __u8 eth_min_inline; __u8 clock_info_versions; __aligned_u64 hca_core_clock_offset; __u32 log_uar_size; __u32 num_uars_per_page; __u32 num_dyn_bfregs; __u32 dump_fill_mkey; }; struct mlx5_ib_alloc_pd_resp { __u32 pdn; }; struct mlx5_ib_tso_caps { __u32 max_tso; /* Maximum tso payload size in bytes */ /* Corresponding bit will be set if qp type from * 'enum ib_qp_type' is supported, e.g. * supported_qpts |= 1 << IB_QPT_UD */ __u32 supported_qpts; }; struct mlx5_ib_rss_caps { __aligned_u64 rx_hash_fields_mask; /* enum mlx5_rx_hash_fields */ __u8 rx_hash_function; /* enum mlx5_rx_hash_function_flags */ __u8 reserved[7]; }; enum mlx5_ib_cqe_comp_res_format { MLX5_IB_CQE_RES_FORMAT_HASH = 1 << 0, MLX5_IB_CQE_RES_FORMAT_CSUM = 1 << 1, MLX5_IB_CQE_RES_FORMAT_CSUM_STRIDX = 1 << 2, }; struct mlx5_ib_cqe_comp_caps { __u32 max_num; __u32 supported_format; /* enum mlx5_ib_cqe_comp_res_format */ }; enum mlx5_ib_packet_pacing_cap_flags { MLX5_IB_PP_SUPPORT_BURST = 1 << 0, }; struct mlx5_packet_pacing_caps { __u32 qp_rate_limit_min; __u32 qp_rate_limit_max; /* In kpbs */ /* Corresponding bit will be set if qp type from * 'enum ib_qp_type' is supported, e.g. * supported_qpts |= 1 << IB_QPT_RAW_PACKET */ __u32 supported_qpts; __u8 cap_flags; /* enum mlx5_ib_packet_pacing_cap_flags */ __u8 reserved[3]; }; enum mlx5_ib_mpw_caps { MPW_RESERVED = 1 << 0, MLX5_IB_ALLOW_MPW = 1 << 1, MLX5_IB_SUPPORT_EMPW = 1 << 2, }; enum mlx5_ib_sw_parsing_offloads { MLX5_IB_SW_PARSING = 1 << 0, MLX5_IB_SW_PARSING_CSUM = 1 << 1, MLX5_IB_SW_PARSING_LSO = 1 << 2, }; struct mlx5_ib_sw_parsing_caps { __u32 sw_parsing_offloads; /* enum mlx5_ib_sw_parsing_offloads */ /* Corresponding bit will be set if qp type from * 'enum ib_qp_type' is supported, e.g. * supported_qpts |= 1 << IB_QPT_RAW_PACKET */ __u32 supported_qpts; }; struct mlx5_ib_striding_rq_caps { __u32 min_single_stride_log_num_of_bytes; __u32 max_single_stride_log_num_of_bytes; __u32 min_single_wqe_log_num_of_strides; __u32 max_single_wqe_log_num_of_strides; /* Corresponding bit will be set if qp type from * 'enum ib_qp_type' is supported, e.g. * supported_qpts |= 1 << IB_QPT_RAW_PACKET */ __u32 supported_qpts; __u32 reserved; }; enum mlx5_ib_query_dev_resp_flags { /* Support 128B CQE compression */ MLX5_IB_QUERY_DEV_RESP_FLAGS_CQE_128B_COMP = 1 << 0, MLX5_IB_QUERY_DEV_RESP_FLAGS_CQE_128B_PAD = 1 << 1, }; enum mlx5_ib_tunnel_offloads { MLX5_IB_TUNNELED_OFFLOADS_VXLAN = 1 << 0, MLX5_IB_TUNNELED_OFFLOADS_GRE = 1 << 1, MLX5_IB_TUNNELED_OFFLOADS_GENEVE = 1 << 2, MLX5_IB_TUNNELED_OFFLOADS_MPLS_GRE = 1 << 3, MLX5_IB_TUNNELED_OFFLOADS_MPLS_UDP = 1 << 4, }; struct mlx5_ib_query_device_resp { __u32 comp_mask; __u32 response_length; struct mlx5_ib_tso_caps tso_caps; struct mlx5_ib_rss_caps rss_caps; struct mlx5_ib_cqe_comp_caps cqe_comp_caps; struct mlx5_packet_pacing_caps packet_pacing_caps; __u32 mlx5_ib_support_multi_pkt_send_wqes; __u32 flags; /* Use enum mlx5_ib_query_dev_resp_flags */ struct mlx5_ib_sw_parsing_caps sw_parsing_caps; struct mlx5_ib_striding_rq_caps striding_rq_caps; __u32 tunnel_offloads_caps; /* enum mlx5_ib_tunnel_offloads */ __u32 reserved; }; enum mlx5_ib_create_cq_flags { MLX5_IB_CREATE_CQ_FLAGS_CQE_128B_PAD = 1 << 0, }; struct mlx5_ib_create_cq { __aligned_u64 buf_addr; __aligned_u64 db_addr; __u32 cqe_size; __u8 cqe_comp_en; __u8 cqe_comp_res_format; __u16 flags; }; struct mlx5_ib_create_cq_resp { __u32 cqn; __u32 reserved; }; struct mlx5_ib_resize_cq { __aligned_u64 buf_addr; __u16 cqe_size; __u16 reserved0; __u32 reserved1; }; struct mlx5_ib_create_srq { __aligned_u64 buf_addr; __aligned_u64 db_addr; __u32 flags; __u32 reserved0; /* explicit padding (optional on i386) */ __u32 uidx; __u32 reserved1; }; struct mlx5_ib_create_srq_resp { __u32 srqn; __u32 reserved; }; struct mlx5_ib_create_qp { __aligned_u64 buf_addr; __aligned_u64 db_addr; __u32 sq_wqe_count; __u32 rq_wqe_count; __u32 rq_wqe_shift; __u32 flags; __u32 uidx; __u32 bfreg_index; union { __aligned_u64 sq_buf_addr; __aligned_u64 access_key; }; }; /* RX Hash function flags */ enum mlx5_rx_hash_function_flags { MLX5_RX_HASH_FUNC_TOEPLITZ = 1 << 0, }; /* * RX Hash flags, these flags allows to set which incoming packet's field should * participates in RX Hash. Each flag represent certain packet's field, * when the flag is set the field that is represented by the flag will * participate in RX Hash calculation. * Note: *IPV4 and *IPV6 flags can't be enabled together on the same QP * and *TCP and *UDP flags can't be enabled together on the same QP. */ enum mlx5_rx_hash_fields { MLX5_RX_HASH_SRC_IPV4 = 1 << 0, MLX5_RX_HASH_DST_IPV4 = 1 << 1, MLX5_RX_HASH_SRC_IPV6 = 1 << 2, MLX5_RX_HASH_DST_IPV6 = 1 << 3, MLX5_RX_HASH_SRC_PORT_TCP = 1 << 4, MLX5_RX_HASH_DST_PORT_TCP = 1 << 5, MLX5_RX_HASH_SRC_PORT_UDP = 1 << 6, MLX5_RX_HASH_DST_PORT_UDP = 1 << 7, MLX5_RX_HASH_IPSEC_SPI = 1 << 8, /* Save bits for future fields */ MLX5_RX_HASH_INNER = (1UL << 31), }; struct mlx5_ib_create_qp_rss { __aligned_u64 rx_hash_fields_mask; /* enum mlx5_rx_hash_fields */ __u8 rx_hash_function; /* enum mlx5_rx_hash_function_flags */ __u8 rx_key_len; /* valid only for Toeplitz */ __u8 reserved[6]; __u8 rx_hash_key[128]; /* valid only for Toeplitz */ __u32 comp_mask; __u32 flags; }; struct mlx5_ib_create_qp_resp { __u32 bfreg_index; __u32 reserved; }; struct mlx5_ib_alloc_mw { __u32 comp_mask; __u8 num_klms; __u8 reserved1; __u16 reserved2; }; enum mlx5_ib_create_wq_mask { MLX5_IB_CREATE_WQ_STRIDING_RQ = (1 << 0), }; struct mlx5_ib_create_wq { __aligned_u64 buf_addr; __aligned_u64 db_addr; __u32 rq_wqe_count; __u32 rq_wqe_shift; __u32 user_index; __u32 flags; __u32 comp_mask; __u32 single_stride_log_num_of_bytes; __u32 single_wqe_log_num_of_strides; __u32 two_byte_shift_en; }; struct mlx5_ib_create_ah_resp { __u32 response_length; __u8 dmac[ETH_ALEN]; __u8 reserved[6]; }; struct mlx5_ib_burst_info { __u32 max_burst_sz; __u16 typical_pkt_sz; __u16 reserved; }; struct mlx5_ib_modify_qp { __u32 comp_mask; struct mlx5_ib_burst_info burst_info; __u32 reserved; }; struct mlx5_ib_modify_qp_resp { __u32 response_length; __u32 dctn; }; struct mlx5_ib_create_wq_resp { __u32 response_length; __u32 reserved; }; struct mlx5_ib_create_rwq_ind_tbl_resp { __u32 response_length; __u32 reserved; }; struct mlx5_ib_modify_wq { __u32 comp_mask; __u32 reserved; }; struct mlx5_ib_clock_info { __u32 sign; __u32 resv; __aligned_u64 nsec; __aligned_u64 cycles; __aligned_u64 frac; __u32 mult; __u32 shift; __aligned_u64 mask; __aligned_u64 overflow_period; }; enum mlx5_ib_mmap_cmd { MLX5_IB_MMAP_REGULAR_PAGE = 0, MLX5_IB_MMAP_GET_CONTIGUOUS_PAGES = 1, MLX5_IB_MMAP_WC_PAGE = 2, MLX5_IB_MMAP_NC_PAGE = 3, /* 5 is chosen in order to be compatible with old versions of libmlx5 */ MLX5_IB_MMAP_CORE_CLOCK = 5, MLX5_IB_MMAP_ALLOC_WC = 6, MLX5_IB_MMAP_CLOCK_INFO = 7, MLX5_IB_MMAP_DEVICE_MEM = 8, }; enum { MLX5_IB_CLOCK_INFO_KERNEL_UPDATING = 1, }; /* Bit indexes for the mlx5_alloc_ucontext_resp.clock_info_versions bitmap */ enum { MLX5_IB_CLOCK_INFO_V1 = 0, }; struct mlx5_ib_flow_counters_desc { __u32 description; __u32 index; }; struct mlx5_ib_flow_counters_data { RDMA_UAPI_PTR(struct mlx5_ib_flow_counters_desc *, counters_data); __u32 ncounters; __u32 reserved; }; struct mlx5_ib_create_flow { __u32 ncounters_data; __u32 reserved; /* * Following are counters data based on ncounters_data, each * entry in the data[] should match a corresponding counter object * that was pointed by a counters spec upon the flow creation */ struct mlx5_ib_flow_counters_data data[]; }; #endif /* MLX5_ABI_USER_H */ rdma/rdma_user_ioctl_cmds.h�������������������������������������������������������������������������0000644�����������������00000005536�14763166030�0012040 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2018, Mellanox Technologies inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef RDMA_USER_IOCTL_CMDS_H #define RDMA_USER_IOCTL_CMDS_H #include <linux/types.h> #include <linux/ioctl.h> /* Documentation/ioctl/ioctl-number.txt */ #define RDMA_IOCTL_MAGIC 0x1b #define RDMA_VERBS_IOCTL \ _IOWR(RDMA_IOCTL_MAGIC, 1, struct ib_uverbs_ioctl_hdr) enum { /* User input */ UVERBS_ATTR_F_MANDATORY = 1U << 0, /* * Valid output bit should be ignored and considered set in * mandatory fields. This bit is kernel output. */ UVERBS_ATTR_F_VALID_OUTPUT = 1U << 1, }; struct ib_uverbs_attr { __u16 attr_id; /* command specific type attribute */ __u16 len; /* only for pointers */ __u16 flags; /* combination of UVERBS_ATTR_F_XXXX */ union { struct { __u8 elem_id; __u8 reserved; } enum_data; __u16 reserved; } attr_data; union { /* Used by PTR_IN/OUT, ENUM_IN and IDR */ __aligned_u64 data; /* Used by FD_IN and FD_OUT */ __s64 data_s64; }; }; struct ib_uverbs_ioctl_hdr { __u16 length; __u16 object_id; __u16 method_id; __u16 num_attrs; __aligned_u64 reserved1; __u32 driver_id; __u32 reserved2; struct ib_uverbs_attr attrs[0]; }; enum rdma_driver_id { RDMA_DRIVER_UNKNOWN, RDMA_DRIVER_MLX5, RDMA_DRIVER_MLX4, RDMA_DRIVER_CXGB3, RDMA_DRIVER_CXGB4, RDMA_DRIVER_MTHCA, RDMA_DRIVER_BNXT_RE, RDMA_DRIVER_OCRDMA, RDMA_DRIVER_NES, RDMA_DRIVER_I40IW, RDMA_DRIVER_VMW_PVRDMA, RDMA_DRIVER_QEDR, RDMA_DRIVER_HNS, RDMA_DRIVER_USNIC, RDMA_DRIVER_RXE, RDMA_DRIVER_HFI1, RDMA_DRIVER_QIB, }; #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������rdma/mlx5_user_ioctl_cmds.h�������������������������������������������������������������������������0000644�����������������00000012111�14763166030�0011765 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2018, Mellanox Technologies inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef MLX5_USER_IOCTL_CMDS_H #define MLX5_USER_IOCTL_CMDS_H #include <linux/types.h> #include <rdma/ib_user_ioctl_cmds.h> enum mlx5_ib_create_flow_action_attrs { /* This attribute belong to the driver namespace */ MLX5_IB_ATTR_CREATE_FLOW_ACTION_FLAGS = (1U << UVERBS_ID_NS_SHIFT), }; enum mlx5_ib_alloc_dm_attrs { MLX5_IB_ATTR_ALLOC_DM_RESP_START_OFFSET = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_ALLOC_DM_RESP_PAGE_INDEX, }; enum mlx5_ib_devx_methods { MLX5_IB_METHOD_DEVX_OTHER = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_METHOD_DEVX_QUERY_UAR, MLX5_IB_METHOD_DEVX_QUERY_EQN, }; enum mlx5_ib_devx_other_attrs { MLX5_IB_ATTR_DEVX_OTHER_CMD_IN = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_DEVX_OTHER_CMD_OUT, }; enum mlx5_ib_devx_obj_create_attrs { MLX5_IB_ATTR_DEVX_OBJ_CREATE_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_DEVX_OBJ_CREATE_CMD_IN, MLX5_IB_ATTR_DEVX_OBJ_CREATE_CMD_OUT, }; enum mlx5_ib_devx_query_uar_attrs { MLX5_IB_ATTR_DEVX_QUERY_UAR_USER_IDX = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_DEVX_QUERY_UAR_DEV_IDX, }; enum mlx5_ib_devx_obj_destroy_attrs { MLX5_IB_ATTR_DEVX_OBJ_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT), }; enum mlx5_ib_devx_obj_modify_attrs { MLX5_IB_ATTR_DEVX_OBJ_MODIFY_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_DEVX_OBJ_MODIFY_CMD_IN, MLX5_IB_ATTR_DEVX_OBJ_MODIFY_CMD_OUT, }; enum mlx5_ib_devx_obj_query_attrs { MLX5_IB_ATTR_DEVX_OBJ_QUERY_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_DEVX_OBJ_QUERY_CMD_IN, MLX5_IB_ATTR_DEVX_OBJ_QUERY_CMD_OUT, }; enum mlx5_ib_devx_query_eqn_attrs { MLX5_IB_ATTR_DEVX_QUERY_EQN_USER_VEC = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_DEVX_QUERY_EQN_DEV_EQN, }; enum mlx5_ib_devx_obj_methods { MLX5_IB_METHOD_DEVX_OBJ_CREATE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_METHOD_DEVX_OBJ_DESTROY, MLX5_IB_METHOD_DEVX_OBJ_MODIFY, MLX5_IB_METHOD_DEVX_OBJ_QUERY, }; enum mlx5_ib_devx_umem_reg_attrs { MLX5_IB_ATTR_DEVX_UMEM_REG_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_DEVX_UMEM_REG_ADDR, MLX5_IB_ATTR_DEVX_UMEM_REG_LEN, MLX5_IB_ATTR_DEVX_UMEM_REG_ACCESS, MLX5_IB_ATTR_DEVX_UMEM_REG_OUT_ID, }; enum mlx5_ib_devx_umem_dereg_attrs { MLX5_IB_ATTR_DEVX_UMEM_DEREG_HANDLE = (1U << UVERBS_ID_NS_SHIFT), }; enum mlx5_ib_devx_umem_methods { MLX5_IB_METHOD_DEVX_UMEM_REG = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_METHOD_DEVX_UMEM_DEREG, }; enum mlx5_ib_objects { MLX5_IB_OBJECT_DEVX = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_OBJECT_DEVX_OBJ, MLX5_IB_OBJECT_DEVX_UMEM, MLX5_IB_OBJECT_FLOW_MATCHER, }; enum mlx5_ib_flow_matcher_create_attrs { MLX5_IB_ATTR_FLOW_MATCHER_CREATE_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_FLOW_MATCHER_MATCH_MASK, MLX5_IB_ATTR_FLOW_MATCHER_FLOW_TYPE, MLX5_IB_ATTR_FLOW_MATCHER_MATCH_CRITERIA, }; enum mlx5_ib_flow_matcher_destroy_attrs { MLX5_IB_ATTR_FLOW_MATCHER_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT), }; enum mlx5_ib_flow_matcher_methods { MLX5_IB_METHOD_FLOW_MATCHER_CREATE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_METHOD_FLOW_MATCHER_DESTROY, }; #define MLX5_IB_DW_MATCH_PARAM 0x80 struct mlx5_ib_match_params { __u32 match_params[MLX5_IB_DW_MATCH_PARAM]; }; enum mlx5_ib_flow_type { MLX5_IB_FLOW_TYPE_NORMAL, MLX5_IB_FLOW_TYPE_SNIFFER, MLX5_IB_FLOW_TYPE_ALL_DEFAULT, MLX5_IB_FLOW_TYPE_MC_DEFAULT, }; enum mlx5_ib_create_flow_attrs { MLX5_IB_ATTR_CREATE_FLOW_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_CREATE_FLOW_MATCH_VALUE, MLX5_IB_ATTR_CREATE_FLOW_DEST_QP, MLX5_IB_ATTR_CREATE_FLOW_DEST_DEVX, MLX5_IB_ATTR_CREATE_FLOW_MATCHER, }; enum mlx5_ib_destoy_flow_attrs { MLX5_IB_ATTR_DESTROY_FLOW_HANDLE = (1U << UVERBS_ID_NS_SHIFT), }; enum mlx5_ib_flow_methods { MLX5_IB_METHOD_CREATE_FLOW = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_METHOD_DESTROY_FLOW, }; #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rdma/ib_user_sa.h�����������������������������������������������������������������������������������0000644�����������������00000004401�14763166030�0007760 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2005 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef IB_USER_SA_H #define IB_USER_SA_H #include <linux/types.h> enum { IB_PATH_GMP = 1, IB_PATH_PRIMARY = (1<<1), IB_PATH_ALTERNATE = (1<<2), IB_PATH_OUTBOUND = (1<<3), IB_PATH_INBOUND = (1<<4), IB_PATH_INBOUND_REVERSE = (1<<5), IB_PATH_BIDIRECTIONAL = IB_PATH_OUTBOUND | IB_PATH_INBOUND_REVERSE }; struct ib_path_rec_data { __u32 flags; __u32 reserved; __u32 path_rec[16]; }; struct ib_user_path_rec { __u8 dgid[16]; __u8 sgid[16]; __be16 dlid; __be16 slid; __u32 raw_traffic; __be32 flow_label; __u32 reversible; __u32 mtu; __be16 pkey; __u8 hop_limit; __u8 traffic_class; __u8 numb_path; __u8 sl; __u8 mtu_selector; __u8 rate_selector; __u8 rate; __u8 packet_life_time_selector; __u8 packet_life_time; __u8 preference; }; #endif /* IB_USER_SA_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rdma/hfi/hfi1_ioctl.h�������������������������������������������������������������������������������0000644�����������������00000014732�14763166030�0010444 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license. * * GPL LICENSE SUMMARY * * Copyright(c) 2015 Intel Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * 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. * * BSD LICENSE * * Copyright(c) 2015 Intel Corporation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * - Neither the name of Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef _LINUX__HFI1_IOCTL_H #define _LINUX__HFI1_IOCTL_H #include <linux/types.h> /* * This structure is passed to the driver to tell it where * user code buffers are, sizes, etc. The offsets and sizes of the * fields must remain unchanged, for binary compatibility. It can * be extended, if userversion is changed so user code can tell, if needed */ struct hfi1_user_info { /* * version of user software, to detect compatibility issues. * Should be set to HFI1_USER_SWVERSION. */ __u32 userversion; __u32 pad; /* * If two or more processes wish to share a context, each process * must set the subcontext_cnt and subcontext_id to the same * values. The only restriction on the subcontext_id is that * it be unique for a given node. */ __u16 subctxt_cnt; __u16 subctxt_id; /* 128bit UUID passed in by PSM. */ __u8 uuid[16]; }; struct hfi1_ctxt_info { __aligned_u64 runtime_flags; /* chip/drv runtime flags (HFI1_CAP_*) */ __u32 rcvegr_size; /* size of each eager buffer */ __u16 num_active; /* number of active units */ __u16 unit; /* unit (chip) assigned to caller */ __u16 ctxt; /* ctxt on unit assigned to caller */ __u16 subctxt; /* subctxt on unit assigned to caller */ __u16 rcvtids; /* number of Rcv TIDs for this context */ __u16 credits; /* number of PIO credits for this context */ __u16 numa_node; /* NUMA node of the assigned device */ __u16 rec_cpu; /* cpu # for affinity (0xffff if none) */ __u16 send_ctxt; /* send context in use by this user context */ __u16 egrtids; /* number of RcvArray entries for Eager Rcvs */ __u16 rcvhdrq_cnt; /* number of RcvHdrQ entries */ __u16 rcvhdrq_entsize; /* size (in bytes) for each RcvHdrQ entry */ __u16 sdma_ring_size; /* number of entries in SDMA request ring */ }; struct hfi1_tid_info { /* virtual address of first page in transfer */ __aligned_u64 vaddr; /* pointer to tid array. this array is big enough */ __aligned_u64 tidlist; /* number of tids programmed by this request */ __u32 tidcnt; /* length of transfer buffer programmed by this request */ __u32 length; }; /* * This structure is returned by the driver immediately after * open to get implementation-specific info, and info specific to this * instance. * * This struct must have explicit pad fields where type sizes * may result in different alignments between 32 and 64 bit * programs, since the 64 bit * bit kernel requires the user code * to have matching offsets */ struct hfi1_base_info { /* version of hardware, for feature checking. */ __u32 hw_version; /* version of software, for feature checking. */ __u32 sw_version; /* Job key */ __u16 jkey; __u16 padding1; /* * The special QP (queue pair) value that identifies PSM * protocol packet from standard IB packets. */ __u32 bthqp; /* PIO credit return address, */ __aligned_u64 sc_credits_addr; /* * Base address of write-only pio buffers for this process. * Each buffer has sendpio_credits*64 bytes. */ __aligned_u64 pio_bufbase_sop; /* * Base address of write-only pio buffers for this process. * Each buffer has sendpio_credits*64 bytes. */ __aligned_u64 pio_bufbase; /* address where receive buffer queue is mapped into */ __aligned_u64 rcvhdr_bufbase; /* base address of Eager receive buffers. */ __aligned_u64 rcvegr_bufbase; /* base address of SDMA completion ring */ __aligned_u64 sdma_comp_bufbase; /* * User register base for init code, not to be used directly by * protocol or applications. Always maps real chip register space. * the register addresses are: * ur_rcvhdrhead, ur_rcvhdrtail, ur_rcvegrhead, ur_rcvegrtail, * ur_rcvtidflow */ __aligned_u64 user_regbase; /* notification events */ __aligned_u64 events_bufbase; /* status page */ __aligned_u64 status_bufbase; /* rcvhdrtail update */ __aligned_u64 rcvhdrtail_base; /* * shared memory pages for subctxts if ctxt is shared; these cover * all the processes in the group sharing a single context. * all have enough space for the num_subcontexts value on this job. */ __aligned_u64 subctxt_uregbase; __aligned_u64 subctxt_rcvegrbuf; __aligned_u64 subctxt_rcvhdrbuf; }; #endif /* _LINIUX__HFI1_IOCTL_H */ ��������������������������������������rdma/hfi/hfi1_user.h��������������������������������������������������������������������������������0000644�����������������00000021623�14763166030�0010305 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license. * * GPL LICENSE SUMMARY * * Copyright(c) 2015 Intel Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * 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. * * BSD LICENSE * * Copyright(c) 2015 Intel Corporation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * - Neither the name of Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /* * This file contains defines, structures, etc. that are used * to communicate between kernel and user code. */ #ifndef _LINUX__HFI1_USER_H #define _LINUX__HFI1_USER_H #include <linux/types.h> #include <rdma/rdma_user_ioctl.h> /* * This version number is given to the driver by the user code during * initialization in the spu_userversion field of hfi1_user_info, so * the driver can check for compatibility with user code. * * The major version changes when data structures change in an incompatible * way. The driver must be the same for initialization to succeed. */ #define HFI1_USER_SWMAJOR 6 /* * Minor version differences are always compatible * a within a major version, however if user software is larger * than driver software, some new features and/or structure fields * may not be implemented; the user code must deal with this if it * cares, or it must abort after initialization reports the difference. */ #define HFI1_USER_SWMINOR 3 /* * We will encode the major/minor inside a single 32bit version number. */ #define HFI1_SWMAJOR_SHIFT 16 /* * Set of HW and driver capability/feature bits. * These bit values are used to configure enabled/disabled HW and * driver features. The same set of bits are communicated to user * space. */ #define HFI1_CAP_DMA_RTAIL (1UL << 0) /* Use DMA'ed RTail value */ #define HFI1_CAP_SDMA (1UL << 1) /* Enable SDMA support */ #define HFI1_CAP_SDMA_AHG (1UL << 2) /* Enable SDMA AHG support */ #define HFI1_CAP_EXTENDED_PSN (1UL << 3) /* Enable Extended PSN support */ #define HFI1_CAP_HDRSUPP (1UL << 4) /* Enable Header Suppression */ /* 1UL << 5 unused */ #define HFI1_CAP_USE_SDMA_HEAD (1UL << 6) /* DMA Hdr Q tail vs. use CSR */ #define HFI1_CAP_MULTI_PKT_EGR (1UL << 7) /* Enable multi-packet Egr buffs*/ #define HFI1_CAP_NODROP_RHQ_FULL (1UL << 8) /* Don't drop on Hdr Q full */ #define HFI1_CAP_NODROP_EGR_FULL (1UL << 9) /* Don't drop on EGR buffs full */ #define HFI1_CAP_TID_UNMAP (1UL << 10) /* Disable Expected TID caching */ #define HFI1_CAP_PRINT_UNIMPL (1UL << 11) /* Show for unimplemented feats */ #define HFI1_CAP_ALLOW_PERM_JKEY (1UL << 12) /* Allow use of permissive JKEY */ #define HFI1_CAP_NO_INTEGRITY (1UL << 13) /* Enable ctxt integrity checks */ #define HFI1_CAP_PKEY_CHECK (1UL << 14) /* Enable ctxt PKey checking */ #define HFI1_CAP_STATIC_RATE_CTRL (1UL << 15) /* Allow PBC.StaticRateControl */ /* 1UL << 16 unused */ #define HFI1_CAP_SDMA_HEAD_CHECK (1UL << 17) /* SDMA head checking */ #define HFI1_CAP_EARLY_CREDIT_RETURN (1UL << 18) /* early credit return */ #define HFI1_RCVHDR_ENTSIZE_2 (1UL << 0) #define HFI1_RCVHDR_ENTSIZE_16 (1UL << 1) #define HFI1_RCVDHR_ENTSIZE_32 (1UL << 2) #define _HFI1_EVENT_FROZEN_BIT 0 #define _HFI1_EVENT_LINKDOWN_BIT 1 #define _HFI1_EVENT_LID_CHANGE_BIT 2 #define _HFI1_EVENT_LMC_CHANGE_BIT 3 #define _HFI1_EVENT_SL2VL_CHANGE_BIT 4 #define _HFI1_EVENT_TID_MMU_NOTIFY_BIT 5 #define _HFI1_MAX_EVENT_BIT _HFI1_EVENT_TID_MMU_NOTIFY_BIT #define HFI1_EVENT_FROZEN (1UL << _HFI1_EVENT_FROZEN_BIT) #define HFI1_EVENT_LINKDOWN (1UL << _HFI1_EVENT_LINKDOWN_BIT) #define HFI1_EVENT_LID_CHANGE (1UL << _HFI1_EVENT_LID_CHANGE_BIT) #define HFI1_EVENT_LMC_CHANGE (1UL << _HFI1_EVENT_LMC_CHANGE_BIT) #define HFI1_EVENT_SL2VL_CHANGE (1UL << _HFI1_EVENT_SL2VL_CHANGE_BIT) #define HFI1_EVENT_TID_MMU_NOTIFY (1UL << _HFI1_EVENT_TID_MMU_NOTIFY_BIT) /* * These are the status bits readable (in ASCII form, 64bit value) * from the "status" sysfs file. For binary compatibility, values * must remain as is; removed states can be reused for different * purposes. */ #define HFI1_STATUS_INITTED 0x1 /* basic initialization done */ /* Chip has been found and initialized */ #define HFI1_STATUS_CHIP_PRESENT 0x20 /* IB link is at ACTIVE, usable for data traffic */ #define HFI1_STATUS_IB_READY 0x40 /* link is configured, LID, MTU, etc. have been set */ #define HFI1_STATUS_IB_CONF 0x80 /* A Fatal hardware error has occurred. */ #define HFI1_STATUS_HWERROR 0x200 /* * Number of supported shared contexts. * This is the maximum number of software contexts that can share * a hardware send/receive context. */ #define HFI1_MAX_SHARED_CTXTS 8 /* * Poll types */ #define HFI1_POLL_TYPE_ANYRCV 0x0 #define HFI1_POLL_TYPE_URGENT 0x1 enum hfi1_sdma_comp_state { FREE = 0, QUEUED, COMPLETE, ERROR }; /* * SDMA completion ring entry */ struct hfi1_sdma_comp_entry { __u32 status; __u32 errcode; }; /* * Device status and notifications from driver to user-space. */ struct hfi1_status { __aligned_u64 dev; /* device/hw status bits */ __aligned_u64 port; /* port state and status bits */ char freezemsg[0]; }; enum sdma_req_opcode { EXPECTED = 0, EAGER }; #define HFI1_SDMA_REQ_VERSION_MASK 0xF #define HFI1_SDMA_REQ_VERSION_SHIFT 0x0 #define HFI1_SDMA_REQ_OPCODE_MASK 0xF #define HFI1_SDMA_REQ_OPCODE_SHIFT 0x4 #define HFI1_SDMA_REQ_IOVCNT_MASK 0xFF #define HFI1_SDMA_REQ_IOVCNT_SHIFT 0x8 struct sdma_req_info { /* * bits 0-3 - version (currently unused) * bits 4-7 - opcode (enum sdma_req_opcode) * bits 8-15 - io vector count */ __u16 ctrl; /* * Number of fragments contained in this request. * User-space has already computed how many * fragment-sized packet the user buffer will be * split into. */ __u16 npkts; /* * Size of each fragment the user buffer will be * split into. */ __u16 fragsize; /* * Index of the slot in the SDMA completion ring * this request should be using. User-space is * in charge of managing its own ring. */ __u16 comp_idx; } __attribute__((__packed__)); /* * SW KDETH header. * swdata is SW defined portion. */ struct hfi1_kdeth_header { __le32 ver_tid_offset; __le16 jkey; __le16 hcrc; __le32 swdata[7]; } __attribute__((__packed__)); /* * Structure describing the headers that User space uses. The * structure above is a subset of this one. */ struct hfi1_pkt_header { __le16 pbc[4]; __be16 lrh[4]; __be32 bth[3]; struct hfi1_kdeth_header kdeth; } __attribute__((__packed__)); /* * The list of usermode accessible registers. */ enum hfi1_ureg { /* (RO) DMA RcvHdr to be used next. */ ur_rcvhdrtail = 0, /* (RW) RcvHdr entry to be processed next by host. */ ur_rcvhdrhead = 1, /* (RO) Index of next Eager index to use. */ ur_rcvegrindextail = 2, /* (RW) Eager TID to be processed next */ ur_rcvegrindexhead = 3, /* (RO) Receive Eager Offset Tail */ ur_rcvegroffsettail = 4, /* For internal use only; max register number. */ ur_maxreg, /* (RW) Receive TID flow table */ ur_rcvtidflowtable = 256 }; #endif /* _LINIUX__HFI1_USER_H */ �������������������������������������������������������������������������������������������������������������rdma/rdma_user_cm.h���������������������������������������������������������������������������������0000644�����������������00000015314�14763166030�0010312 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2005-2006 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef RDMA_USER_CM_H #define RDMA_USER_CM_H #include <linux/types.h> #include <linux/socket.h> #include <linux/in6.h> #include <rdma/ib_user_verbs.h> #include <rdma/ib_user_sa.h> #define RDMA_USER_CM_ABI_VERSION 4 #define RDMA_MAX_PRIVATE_DATA 256 enum { RDMA_USER_CM_CMD_CREATE_ID, RDMA_USER_CM_CMD_DESTROY_ID, RDMA_USER_CM_CMD_BIND_IP, RDMA_USER_CM_CMD_RESOLVE_IP, RDMA_USER_CM_CMD_RESOLVE_ROUTE, RDMA_USER_CM_CMD_QUERY_ROUTE, RDMA_USER_CM_CMD_CONNECT, RDMA_USER_CM_CMD_LISTEN, RDMA_USER_CM_CMD_ACCEPT, RDMA_USER_CM_CMD_REJECT, RDMA_USER_CM_CMD_DISCONNECT, RDMA_USER_CM_CMD_INIT_QP_ATTR, RDMA_USER_CM_CMD_GET_EVENT, RDMA_USER_CM_CMD_GET_OPTION, RDMA_USER_CM_CMD_SET_OPTION, RDMA_USER_CM_CMD_NOTIFY, RDMA_USER_CM_CMD_JOIN_IP_MCAST, RDMA_USER_CM_CMD_LEAVE_MCAST, RDMA_USER_CM_CMD_MIGRATE_ID, RDMA_USER_CM_CMD_QUERY, RDMA_USER_CM_CMD_BIND, RDMA_USER_CM_CMD_RESOLVE_ADDR, RDMA_USER_CM_CMD_JOIN_MCAST }; /* See IBTA Annex A11, servies ID bytes 4 & 5 */ enum rdma_ucm_port_space { RDMA_PS_IPOIB = 0x0002, RDMA_PS_IB = 0x013F, RDMA_PS_TCP = 0x0106, RDMA_PS_UDP = 0x0111, }; /* * command ABI structures. */ struct rdma_ucm_cmd_hdr { __u32 cmd; __u16 in; __u16 out; }; struct rdma_ucm_create_id { __aligned_u64 uid; __aligned_u64 response; __u16 ps; /* use enum rdma_ucm_port_space */ __u8 qp_type; __u8 reserved[5]; }; struct rdma_ucm_create_id_resp { __u32 id; }; struct rdma_ucm_destroy_id { __aligned_u64 response; __u32 id; __u32 reserved; }; struct rdma_ucm_destroy_id_resp { __u32 events_reported; }; struct rdma_ucm_bind_ip { __aligned_u64 response; struct sockaddr_in6 addr; __u32 id; }; struct rdma_ucm_bind { __u32 id; __u16 addr_size; __u16 reserved; struct __kernel_sockaddr_storage addr; }; struct rdma_ucm_resolve_ip { struct sockaddr_in6 src_addr; struct sockaddr_in6 dst_addr; __u32 id; __u32 timeout_ms; }; struct rdma_ucm_resolve_addr { __u32 id; __u32 timeout_ms; __u16 src_size; __u16 dst_size; __u32 reserved; struct __kernel_sockaddr_storage src_addr; struct __kernel_sockaddr_storage dst_addr; }; struct rdma_ucm_resolve_route { __u32 id; __u32 timeout_ms; }; enum { RDMA_USER_CM_QUERY_ADDR, RDMA_USER_CM_QUERY_PATH, RDMA_USER_CM_QUERY_GID }; struct rdma_ucm_query { __aligned_u64 response; __u32 id; __u32 option; }; struct rdma_ucm_query_route_resp { __aligned_u64 node_guid; struct ib_user_path_rec ib_route[2]; struct sockaddr_in6 src_addr; struct sockaddr_in6 dst_addr; __u32 num_paths; __u8 port_num; __u8 reserved[3]; }; struct rdma_ucm_query_addr_resp { __aligned_u64 node_guid; __u8 port_num; __u8 reserved; __u16 pkey; __u16 src_size; __u16 dst_size; struct __kernel_sockaddr_storage src_addr; struct __kernel_sockaddr_storage dst_addr; }; struct rdma_ucm_query_path_resp { __u32 num_paths; __u32 reserved; struct ib_path_rec_data path_data[0]; }; struct rdma_ucm_conn_param { __u32 qp_num; __u32 qkey; __u8 private_data[RDMA_MAX_PRIVATE_DATA]; __u8 private_data_len; __u8 srq; __u8 responder_resources; __u8 initiator_depth; __u8 flow_control; __u8 retry_count; __u8 rnr_retry_count; __u8 valid; }; struct rdma_ucm_ud_param { __u32 qp_num; __u32 qkey; struct ib_uverbs_ah_attr ah_attr; __u8 private_data[RDMA_MAX_PRIVATE_DATA]; __u8 private_data_len; __u8 reserved[7]; }; struct rdma_ucm_connect { struct rdma_ucm_conn_param conn_param; __u32 id; __u32 reserved; }; struct rdma_ucm_listen { __u32 id; __u32 backlog; }; struct rdma_ucm_accept { __aligned_u64 uid; struct rdma_ucm_conn_param conn_param; __u32 id; __u32 reserved; }; struct rdma_ucm_reject { __u32 id; __u8 private_data_len; __u8 reserved[3]; __u8 private_data[RDMA_MAX_PRIVATE_DATA]; }; struct rdma_ucm_disconnect { __u32 id; }; struct rdma_ucm_init_qp_attr { __aligned_u64 response; __u32 id; __u32 qp_state; }; struct rdma_ucm_notify { __u32 id; __u32 event; }; struct rdma_ucm_join_ip_mcast { __aligned_u64 response; /* rdma_ucm_create_id_resp */ __aligned_u64 uid; struct sockaddr_in6 addr; __u32 id; }; /* Multicast join flags */ enum { RDMA_MC_JOIN_FLAG_FULLMEMBER, RDMA_MC_JOIN_FLAG_SENDONLY_FULLMEMBER, RDMA_MC_JOIN_FLAG_RESERVED, }; struct rdma_ucm_join_mcast { __aligned_u64 response; /* rdma_ucma_create_id_resp */ __aligned_u64 uid; __u32 id; __u16 addr_size; __u16 join_flags; struct __kernel_sockaddr_storage addr; }; struct rdma_ucm_get_event { __aligned_u64 response; }; struct rdma_ucm_event_resp { __aligned_u64 uid; __u32 id; __u32 event; __u32 status; /* * NOTE: This union is not aligned to 8 bytes so none of the union * members may contain a u64 or anything with higher alignment than 4. */ union { struct rdma_ucm_conn_param conn; struct rdma_ucm_ud_param ud; } param; __u32 reserved; }; /* Option levels */ enum { RDMA_OPTION_ID = 0, RDMA_OPTION_IB = 1 }; /* Option details */ enum { RDMA_OPTION_ID_TOS = 0, RDMA_OPTION_ID_REUSEADDR = 1, RDMA_OPTION_ID_AFONLY = 2, RDMA_OPTION_IB_PATH = 1 }; struct rdma_ucm_set_option { __aligned_u64 optval; __u32 id; __u32 level; __u32 optname; __u32 optlen; }; struct rdma_ucm_migrate_id { __aligned_u64 response; __u32 id; __u32 fd; }; struct rdma_ucm_migrate_resp { __u32 events_reported; }; #endif /* RDMA_USER_CM_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netinet/ip.h����������������������������������������������������������������������������������������0000644�����������������00000022350�14763166030�0007003 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-1993,1995-2000,2009,2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __NETINET_IP_H #define __NETINET_IP_H 1 #include <features.h> #include <sys/types.h> #include <netinet/in.h> __BEGIN_DECLS struct timestamp { u_int8_t len; u_int8_t ptr; #if __BYTE_ORDER == __LITTLE_ENDIAN unsigned int flags:4; unsigned int overflow:4; #elif __BYTE_ORDER == __BIG_ENDIAN unsigned int overflow:4; unsigned int flags:4; #else # error "Please fix <bits/endian.h>" #endif u_int32_t data[9]; }; struct iphdr { #if __BYTE_ORDER == __LITTLE_ENDIAN unsigned int ihl:4; unsigned int version:4; #elif __BYTE_ORDER == __BIG_ENDIAN unsigned int version:4; unsigned int ihl:4; #else # error "Please fix <bits/endian.h>" #endif u_int8_t tos; u_int16_t tot_len; u_int16_t id; u_int16_t frag_off; u_int8_t ttl; u_int8_t protocol; u_int16_t check; u_int32_t saddr; u_int32_t daddr; /*The options start here. */ }; #ifdef __USE_BSD /* * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)ip.h 8.1 (Berkeley) 6/10/93 */ /* * Definitions for internet protocol version 4. * Per RFC 791, September 1981. */ /* * Structure of an internet header, naked of options. */ struct ip { #if __BYTE_ORDER == __LITTLE_ENDIAN unsigned int ip_hl:4; /* header length */ unsigned int ip_v:4; /* version */ #endif #if __BYTE_ORDER == __BIG_ENDIAN unsigned int ip_v:4; /* version */ unsigned int ip_hl:4; /* header length */ #endif u_int8_t ip_tos; /* type of service */ u_short ip_len; /* total length */ u_short ip_id; /* identification */ u_short ip_off; /* fragment offset field */ #define IP_RF 0x8000 /* reserved fragment flag */ #define IP_DF 0x4000 /* dont fragment flag */ #define IP_MF 0x2000 /* more fragments flag */ #define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ u_int8_t ip_ttl; /* time to live */ u_int8_t ip_p; /* protocol */ u_short ip_sum; /* checksum */ struct in_addr ip_src, ip_dst; /* source and dest address */ }; /* * Time stamp option structure. */ struct ip_timestamp { u_int8_t ipt_code; /* IPOPT_TS */ u_int8_t ipt_len; /* size of structure (variable) */ u_int8_t ipt_ptr; /* index of current entry */ #if __BYTE_ORDER == __LITTLE_ENDIAN unsigned int ipt_flg:4; /* flags, see below */ unsigned int ipt_oflw:4; /* overflow counter */ #endif #if __BYTE_ORDER == __BIG_ENDIAN unsigned int ipt_oflw:4; /* overflow counter */ unsigned int ipt_flg:4; /* flags, see below */ #endif u_int32_t data[9]; }; #endif /* __USE_BSD */ #define IPVERSION 4 /* IP version number */ #define IP_MAXPACKET 65535 /* maximum packet size */ /* * Definitions for Explicit Congestion Notification (ECN) * * Taken from RFC-3168, Section 5. */ #define IPTOS_ECN_MASK 0x03 #define IPTOS_ECN(x) ((x) & IPTOS_ECN_MASK) #define IPTOS_ECN_NOT_ECT 0x00 #define IPTOS_ECN_ECT1 0x01 #define IPTOS_ECN_ECT0 0x02 #define IPTOS_ECN_CE 0x03 /* * Definitions for IP differentiated services code points (DSCP) * * Taken from RFC-2597, Section 6 and RFC-2598, Section 2.3. */ #define IPTOS_DSCP_MASK 0xfc #define IPTOS_DSCP(x) ((x) & IPTOS_DSCP_MASK) #define IPTOS_DSCP_AF11 0x28 #define IPTOS_DSCP_AF12 0x30 #define IPTOS_DSCP_AF13 0x38 #define IPTOS_DSCP_AF21 0x48 #define IPTOS_DSCP_AF22 0x50 #define IPTOS_DSCP_AF23 0x58 #define IPTOS_DSCP_AF31 0x68 #define IPTOS_DSCP_AF32 0x70 #define IPTOS_DSCP_AF33 0x78 #define IPTOS_DSCP_AF41 0x88 #define IPTOS_DSCP_AF42 0x90 #define IPTOS_DSCP_AF43 0x98 #define IPTOS_DSCP_EF 0xb8 /* * In RFC 2474, Section 4.2.2.1, the Class Selector Codepoints subsume * the old ToS Precedence values. */ #define IPTOS_CLASS_MASK 0xe0 #define IPTOS_CLASS(class) ((class) & IPTOS_CLASS_MASK) #define IPTOS_CLASS_CS0 0x00 #define IPTOS_CLASS_CS1 0x20 #define IPTOS_CLASS_CS2 0x40 #define IPTOS_CLASS_CS3 0x60 #define IPTOS_CLASS_CS4 0x80 #define IPTOS_CLASS_CS5 0xa0 #define IPTOS_CLASS_CS6 0xc0 #define IPTOS_CLASS_CS7 0xe0 #define IPTOS_CLASS_DEFAULT IPTOS_CLASS_CS0 /* * Definitions for IP type of service (ip_tos) [deprecated; use DSCP * and CS definitions above instead.] */ #define IPTOS_TOS_MASK 0x1E #define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK) #define IPTOS_LOWDELAY 0x10 #define IPTOS_THROUGHPUT 0x08 #define IPTOS_RELIABILITY 0x04 #define IPTOS_LOWCOST 0x02 #define IPTOS_MINCOST IPTOS_LOWCOST /* * Definitions for IP precedence (also in ip_tos) [also deprecated.] */ #define IPTOS_PREC_MASK IPTOS_CLASS_MASK #define IPTOS_PREC(tos) IPTOS_CLASS(tos) #define IPTOS_PREC_NETCONTROL IPTOS_CLASS_CS7 #define IPTOS_PREC_INTERNETCONTROL IPTOS_CLASS_CS6 #define IPTOS_PREC_CRITIC_ECP IPTOS_CLASS_CS5 #define IPTOS_PREC_FLASHOVERRIDE IPTOS_CLASS_CS4 #define IPTOS_PREC_FLASH IPTOS_CLASS_CS3 #define IPTOS_PREC_IMMEDIATE IPTOS_CLASS_CS2 #define IPTOS_PREC_PRIORITY IPTOS_CLASS_CS1 #define IPTOS_PREC_ROUTINE IPTOS_CLASS_CS0 /* * Definitions for options. */ #define IPOPT_COPY 0x80 #define IPOPT_CLASS_MASK 0x60 #define IPOPT_NUMBER_MASK 0x1f #define IPOPT_COPIED(o) ((o) & IPOPT_COPY) #define IPOPT_CLASS(o) ((o) & IPOPT_CLASS_MASK) #define IPOPT_NUMBER(o) ((o) & IPOPT_NUMBER_MASK) #define IPOPT_CONTROL 0x00 #define IPOPT_RESERVED1 0x20 #define IPOPT_DEBMEAS 0x40 #define IPOPT_MEASUREMENT IPOPT_DEBMEAS #define IPOPT_RESERVED2 0x60 #define IPOPT_EOL 0 /* end of option list */ #define IPOPT_END IPOPT_EOL #define IPOPT_NOP 1 /* no operation */ #define IPOPT_NOOP IPOPT_NOP #define IPOPT_RR 7 /* record packet route */ #define IPOPT_TS 68 /* timestamp */ #define IPOPT_TIMESTAMP IPOPT_TS #define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ #define IPOPT_SEC IPOPT_SECURITY #define IPOPT_LSRR 131 /* loose source route */ #define IPOPT_SATID 136 /* satnet id */ #define IPOPT_SID IPOPT_SATID #define IPOPT_SSRR 137 /* strict source route */ #define IPOPT_RA 148 /* router alert */ /* * Offsets to fields in options other than EOL and NOP. */ #define IPOPT_OPTVAL 0 /* option ID */ #define IPOPT_OLEN 1 /* option length */ #define IPOPT_OFFSET 2 /* offset within option */ #define IPOPT_MINOFF 4 /* min value of above */ #define MAX_IPOPTLEN 40 /* flag bits for ipt_flg */ #define IPOPT_TS_TSONLY 0 /* timestamps only */ #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ #define IPOPT_TS_PRESPEC 3 /* specified modules only */ /* bits for security (not byte swapped) */ #define IPOPT_SECUR_UNCLASS 0x0000 #define IPOPT_SECUR_CONFID 0xf135 #define IPOPT_SECUR_EFTO 0x789a #define IPOPT_SECUR_MMMM 0xbc4d #define IPOPT_SECUR_RESTR 0xaf13 #define IPOPT_SECUR_SECRET 0xd788 #define IPOPT_SECUR_TOPSECRET 0x6bc5 /* * Internet implementation parameters. */ #define MAXTTL 255 /* maximum time to live (seconds) */ #define IPDEFTTL 64 /* default ttl, from RFC 1340 */ #define IPFRAGTTL 60 /* time to live for frags, slowhz */ #define IPTTLDEC 1 /* subtracted when forwarding */ #define IP_MSS 576 /* default maximum segment size */ __END_DECLS #endif /* netinet/ip.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netinet/ip_icmp.h�����������������������������������������������������������������������������������0000644�����������������00000023656�14763166030�0010025 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991, 92, 93, 95, 96, 97, 99 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __NETINET_IP_ICMP_H #define __NETINET_IP_ICMP_H 1 #include <sys/cdefs.h> #include <sys/types.h> __BEGIN_DECLS struct icmphdr { u_int8_t type; /* message type */ u_int8_t code; /* type sub-code */ u_int16_t checksum; union { struct { u_int16_t id; u_int16_t sequence; } echo; /* echo datagram */ u_int32_t gateway; /* gateway address */ struct { u_int16_t __unused; u_int16_t mtu; } frag; /* path mtu discovery */ } un; }; #define ICMP_ECHOREPLY 0 /* Echo Reply */ #define ICMP_DEST_UNREACH 3 /* Destination Unreachable */ #define ICMP_SOURCE_QUENCH 4 /* Source Quench */ #define ICMP_REDIRECT 5 /* Redirect (change route) */ #define ICMP_ECHO 8 /* Echo Request */ #define ICMP_TIME_EXCEEDED 11 /* Time Exceeded */ #define ICMP_PARAMETERPROB 12 /* Parameter Problem */ #define ICMP_TIMESTAMP 13 /* Timestamp Request */ #define ICMP_TIMESTAMPREPLY 14 /* Timestamp Reply */ #define ICMP_INFO_REQUEST 15 /* Information Request */ #define ICMP_INFO_REPLY 16 /* Information Reply */ #define ICMP_ADDRESS 17 /* Address Mask Request */ #define ICMP_ADDRESSREPLY 18 /* Address Mask Reply */ #define NR_ICMP_TYPES 18 /* Codes for UNREACH. */ #define ICMP_NET_UNREACH 0 /* Network Unreachable */ #define ICMP_HOST_UNREACH 1 /* Host Unreachable */ #define ICMP_PROT_UNREACH 2 /* Protocol Unreachable */ #define ICMP_PORT_UNREACH 3 /* Port Unreachable */ #define ICMP_FRAG_NEEDED 4 /* Fragmentation Needed/DF set */ #define ICMP_SR_FAILED 5 /* Source Route failed */ #define ICMP_NET_UNKNOWN 6 #define ICMP_HOST_UNKNOWN 7 #define ICMP_HOST_ISOLATED 8 #define ICMP_NET_ANO 9 #define ICMP_HOST_ANO 10 #define ICMP_NET_UNR_TOS 11 #define ICMP_HOST_UNR_TOS 12 #define ICMP_PKT_FILTERED 13 /* Packet filtered */ #define ICMP_PREC_VIOLATION 14 /* Precedence violation */ #define ICMP_PREC_CUTOFF 15 /* Precedence cut off */ #define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */ /* Codes for REDIRECT. */ #define ICMP_REDIR_NET 0 /* Redirect Net */ #define ICMP_REDIR_HOST 1 /* Redirect Host */ #define ICMP_REDIR_NETTOS 2 /* Redirect Net for TOS */ #define ICMP_REDIR_HOSTTOS 3 /* Redirect Host for TOS */ /* Codes for TIME_EXCEEDED. */ #define ICMP_EXC_TTL 0 /* TTL count exceeded */ #define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */ #ifdef __USE_BSD /* * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 */ #include <netinet/in.h> #include <netinet/ip.h> /* * Internal of an ICMP Router Advertisement */ struct icmp_ra_addr { u_int32_t ira_addr; u_int32_t ira_preference; }; struct icmp { u_int8_t icmp_type; /* type of message, see below */ u_int8_t icmp_code; /* type sub code */ u_int16_t icmp_cksum; /* ones complement checksum of struct */ union { u_char ih_pptr; /* ICMP_PARAMPROB */ struct in_addr ih_gwaddr; /* gateway address */ struct ih_idseq /* echo datagram */ { u_int16_t icd_id; u_int16_t icd_seq; } ih_idseq; u_int32_t ih_void; /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */ struct ih_pmtu { u_int16_t ipm_void; u_int16_t ipm_nextmtu; } ih_pmtu; struct ih_rtradv { u_int8_t irt_num_addrs; u_int8_t irt_wpa; u_int16_t irt_lifetime; } ih_rtradv; } icmp_hun; #define icmp_pptr icmp_hun.ih_pptr #define icmp_gwaddr icmp_hun.ih_gwaddr #define icmp_id icmp_hun.ih_idseq.icd_id #define icmp_seq icmp_hun.ih_idseq.icd_seq #define icmp_void icmp_hun.ih_void #define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void #define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu #define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs #define icmp_wpa icmp_hun.ih_rtradv.irt_wpa #define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime union { struct { u_int32_t its_otime; u_int32_t its_rtime; u_int32_t its_ttime; } id_ts; struct { struct ip idi_ip; /* options and then 64 bits of data */ } id_ip; struct icmp_ra_addr id_radv; u_int32_t id_mask; u_int8_t id_data[1]; } icmp_dun; #define icmp_otime icmp_dun.id_ts.its_otime #define icmp_rtime icmp_dun.id_ts.its_rtime #define icmp_ttime icmp_dun.id_ts.its_ttime #define icmp_ip icmp_dun.id_ip.idi_ip #define icmp_radv icmp_dun.id_radv #define icmp_mask icmp_dun.id_mask #define icmp_data icmp_dun.id_data }; /* * Lower bounds on packet lengths for various types. * For the error advice packets must first insure that the * packet is large enough to contain the returned ip header. * Only then can we do the check to see if 64 bits of packet * data have been returned, since we need to check the returned * ip header length. */ #define ICMP_MINLEN 8 /* abs minimum */ #define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */ #define ICMP_MASKLEN 12 /* address mask */ #define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */ #ifndef _IP_VHL #define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8) /* N.B.: must separately check that ip_hl >= 5 */ #else #define ICMP_ADVLEN(p) (8 + (IP_VHL_HL((p)->icmp_ip.ip_vhl) << 2) + 8) /* N.B.: must separately check that header length >= 5 */ #endif /* Definition of type and code fields. */ /* defined above: ICMP_ECHOREPLY, ICMP_REDIRECT, ICMP_ECHO */ #define ICMP_UNREACH 3 /* dest unreachable, codes: */ #define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */ #define ICMP_ROUTERADVERT 9 /* router advertisement */ #define ICMP_ROUTERSOLICIT 10 /* router solicitation */ #define ICMP_TIMXCEED 11 /* time exceeded, code: */ #define ICMP_PARAMPROB 12 /* ip header bad */ #define ICMP_TSTAMP 13 /* timestamp request */ #define ICMP_TSTAMPREPLY 14 /* timestamp reply */ #define ICMP_IREQ 15 /* information request */ #define ICMP_IREQREPLY 16 /* information reply */ #define ICMP_MASKREQ 17 /* address mask request */ #define ICMP_MASKREPLY 18 /* address mask reply */ #define ICMP_MAXTYPE 18 /* UNREACH codes */ #define ICMP_UNREACH_NET 0 /* bad net */ #define ICMP_UNREACH_HOST 1 /* bad host */ #define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */ #define ICMP_UNREACH_PORT 3 /* bad port */ #define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */ #define ICMP_UNREACH_SRCFAIL 5 /* src route failed */ #define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */ #define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */ #define ICMP_UNREACH_ISOLATED 8 /* src host isolated */ #define ICMP_UNREACH_NET_PROHIB 9 /* net denied */ #define ICMP_UNREACH_HOST_PROHIB 10 /* host denied */ #define ICMP_UNREACH_TOSNET 11 /* bad tos for net */ #define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */ #define ICMP_UNREACH_FILTER_PROHIB 13 /* admin prohib */ #define ICMP_UNREACH_HOST_PRECEDENCE 14 /* host prec vio. */ #define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 /* prec cutoff */ /* REDIRECT codes */ #define ICMP_REDIRECT_NET 0 /* for network */ #define ICMP_REDIRECT_HOST 1 /* for host */ #define ICMP_REDIRECT_TOSNET 2 /* for tos and net */ #define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */ /* TIMEXCEED codes */ #define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */ #define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */ /* PARAMPROB code */ #define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */ #define ICMP_INFOTYPE(type) \ ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \ (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \ (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \ (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \ (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY) #endif /* __USE_BSD */ __END_DECLS #endif /* netinet/ip_icmp.h */ ����������������������������������������������������������������������������������netinet/icmp6.h�������������������������������������������������������������������������������������0000644�����������������00000026361�14763166030�0007417 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-1997,2000,2006,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _NETINET_ICMP6_H #define _NETINET_ICMP6_H 1 #include <inttypes.h> #include <string.h> #include <sys/types.h> #include <netinet/in.h> #define ICMP6_FILTER 1 #define ICMP6_FILTER_BLOCK 1 #define ICMP6_FILTER_PASS 2 #define ICMP6_FILTER_BLOCKOTHERS 3 #define ICMP6_FILTER_PASSONLY 4 struct icmp6_filter { uint32_t icmp6_filt[8]; }; struct icmp6_hdr { uint8_t icmp6_type; /* type field */ uint8_t icmp6_code; /* code field */ uint16_t icmp6_cksum; /* checksum field */ union { uint32_t icmp6_un_data32[1]; /* type-specific field */ uint16_t icmp6_un_data16[2]; /* type-specific field */ uint8_t icmp6_un_data8[4]; /* type-specific field */ } icmp6_dataun; }; #define icmp6_data32 icmp6_dataun.icmp6_un_data32 #define icmp6_data16 icmp6_dataun.icmp6_un_data16 #define icmp6_data8 icmp6_dataun.icmp6_un_data8 #define icmp6_pptr icmp6_data32[0] /* parameter prob */ #define icmp6_mtu icmp6_data32[0] /* packet too big */ #define icmp6_id icmp6_data16[0] /* echo request/reply */ #define icmp6_seq icmp6_data16[1] /* echo request/reply */ #define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */ #define ICMP6_DST_UNREACH 1 #define ICMP6_PACKET_TOO_BIG 2 #define ICMP6_TIME_EXCEEDED 3 #define ICMP6_PARAM_PROB 4 #define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */ #define ICMP6_ECHO_REQUEST 128 #define ICMP6_ECHO_REPLY 129 #define MLD_LISTENER_QUERY 130 #define MLD_LISTENER_REPORT 131 #define MLD_LISTENER_REDUCTION 132 #define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */ #define ICMP6_DST_UNREACH_ADMIN 1 /* communication with destination */ /* administratively prohibited */ #define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */ #define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */ #define ICMP6_DST_UNREACH_NOPORT 4 /* bad port */ #define ICMP6_TIME_EXCEED_TRANSIT 0 /* Hop Limit == 0 in transit */ #define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* Reassembly time out */ #define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */ #define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized Next Header */ #define ICMP6_PARAMPROB_OPTION 2 /* unrecognized IPv6 option */ #define ICMP6_FILTER_WILLPASS(type, filterp) \ ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0) #define ICMP6_FILTER_WILLBLOCK(type, filterp) \ ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0) #define ICMP6_FILTER_SETPASS(type, filterp) \ ((((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31)))) #define ICMP6_FILTER_SETBLOCK(type, filterp) \ ((((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))) #define ICMP6_FILTER_SETPASSALL(filterp) \ memset (filterp, 0, sizeof (struct icmp6_filter)); #define ICMP6_FILTER_SETBLOCKALL(filterp) \ memset (filterp, 0xFF, sizeof (struct icmp6_filter)); #define ND_ROUTER_SOLICIT 133 #define ND_ROUTER_ADVERT 134 #define ND_NEIGHBOR_SOLICIT 135 #define ND_NEIGHBOR_ADVERT 136 #define ND_REDIRECT 137 struct nd_router_solicit /* router solicitation */ { struct icmp6_hdr nd_rs_hdr; /* could be followed by options */ }; #define nd_rs_type nd_rs_hdr.icmp6_type #define nd_rs_code nd_rs_hdr.icmp6_code #define nd_rs_cksum nd_rs_hdr.icmp6_cksum #define nd_rs_reserved nd_rs_hdr.icmp6_data32[0] struct nd_router_advert /* router advertisement */ { struct icmp6_hdr nd_ra_hdr; uint32_t nd_ra_reachable; /* reachable time */ uint32_t nd_ra_retransmit; /* retransmit timer */ /* could be followed by options */ }; #define nd_ra_type nd_ra_hdr.icmp6_type #define nd_ra_code nd_ra_hdr.icmp6_code #define nd_ra_cksum nd_ra_hdr.icmp6_cksum #define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0] #define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1] #define ND_RA_FLAG_MANAGED 0x80 #define ND_RA_FLAG_OTHER 0x40 #define ND_RA_FLAG_HOME_AGENT 0x20 #define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1] struct nd_neighbor_solicit /* neighbor solicitation */ { struct icmp6_hdr nd_ns_hdr; struct in6_addr nd_ns_target; /* target address */ /* could be followed by options */ }; #define nd_ns_type nd_ns_hdr.icmp6_type #define nd_ns_code nd_ns_hdr.icmp6_code #define nd_ns_cksum nd_ns_hdr.icmp6_cksum #define nd_ns_reserved nd_ns_hdr.icmp6_data32[0] struct nd_neighbor_advert /* neighbor advertisement */ { struct icmp6_hdr nd_na_hdr; struct in6_addr nd_na_target; /* target address */ /* could be followed by options */ }; #define nd_na_type nd_na_hdr.icmp6_type #define nd_na_code nd_na_hdr.icmp6_code #define nd_na_cksum nd_na_hdr.icmp6_cksum #define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0] #if BYTE_ORDER == BIG_ENDIAN #define ND_NA_FLAG_ROUTER 0x80000000 #define ND_NA_FLAG_SOLICITED 0x40000000 #define ND_NA_FLAG_OVERRIDE 0x20000000 #else /* BYTE_ORDER == LITTLE_ENDIAN */ #define ND_NA_FLAG_ROUTER 0x00000080 #define ND_NA_FLAG_SOLICITED 0x00000040 #define ND_NA_FLAG_OVERRIDE 0x00000020 #endif struct nd_redirect /* redirect */ { struct icmp6_hdr nd_rd_hdr; struct in6_addr nd_rd_target; /* target address */ struct in6_addr nd_rd_dst; /* destination address */ /* could be followed by options */ }; #define nd_rd_type nd_rd_hdr.icmp6_type #define nd_rd_code nd_rd_hdr.icmp6_code #define nd_rd_cksum nd_rd_hdr.icmp6_cksum #define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] struct nd_opt_hdr /* Neighbor discovery option header */ { uint8_t nd_opt_type; uint8_t nd_opt_len; /* in units of 8 octets */ /* followed by option specific data */ }; #define ND_OPT_SOURCE_LINKADDR 1 #define ND_OPT_TARGET_LINKADDR 2 #define ND_OPT_PREFIX_INFORMATION 3 #define ND_OPT_REDIRECTED_HEADER 4 #define ND_OPT_MTU 5 #define ND_OPT_RTR_ADV_INTERVAL 7 #define ND_OPT_HOME_AGENT_INFO 8 struct nd_opt_prefix_info /* prefix information */ { uint8_t nd_opt_pi_type; uint8_t nd_opt_pi_len; uint8_t nd_opt_pi_prefix_len; uint8_t nd_opt_pi_flags_reserved; uint32_t nd_opt_pi_valid_time; uint32_t nd_opt_pi_preferred_time; uint32_t nd_opt_pi_reserved2; struct in6_addr nd_opt_pi_prefix; }; #define ND_OPT_PI_FLAG_ONLINK 0x80 #define ND_OPT_PI_FLAG_AUTO 0x40 #define ND_OPT_PI_FLAG_RADDR 0x20 struct nd_opt_rd_hdr /* redirected header */ { uint8_t nd_opt_rh_type; uint8_t nd_opt_rh_len; uint16_t nd_opt_rh_reserved1; uint32_t nd_opt_rh_reserved2; /* followed by IP header and data */ }; struct nd_opt_mtu /* MTU option */ { uint8_t nd_opt_mtu_type; uint8_t nd_opt_mtu_len; uint16_t nd_opt_mtu_reserved; uint32_t nd_opt_mtu_mtu; }; struct mld_hdr { struct icmp6_hdr mld_icmp6_hdr; struct in6_addr mld_addr; /* multicast address */ }; #define mld_type mld_icmp6_hdr.icmp6_type #define mld_code mld_icmp6_hdr.icmp6_code #define mld_cksum mld_icmp6_hdr.icmp6_cksum #define mld_maxdelay mld_icmp6_hdr.icmp6_data16[0] #define mld_reserved mld_icmp6_hdr.icmp6_data16[1] #define ICMP6_ROUTER_RENUMBERING 138 struct icmp6_router_renum /* router renumbering header */ { struct icmp6_hdr rr_hdr; uint8_t rr_segnum; uint8_t rr_flags; uint16_t rr_maxdelay; uint32_t rr_reserved; }; #define rr_type rr_hdr.icmp6_type #define rr_code rr_hdr.icmp6_code #define rr_cksum rr_hdr.icmp6_cksum #define rr_seqnum rr_hdr.icmp6_data32[0] /* Router renumbering flags */ #define ICMP6_RR_FLAGS_TEST 0x80 #define ICMP6_RR_FLAGS_REQRESULT 0x40 #define ICMP6_RR_FLAGS_FORCEAPPLY 0x20 #define ICMP6_RR_FLAGS_SPECSITE 0x10 #define ICMP6_RR_FLAGS_PREVDONE 0x08 struct rr_pco_match /* match prefix part */ { uint8_t rpm_code; uint8_t rpm_len; uint8_t rpm_ordinal; uint8_t rpm_matchlen; uint8_t rpm_minlen; uint8_t rpm_maxlen; uint16_t rpm_reserved; struct in6_addr rpm_prefix; }; /* PCO code values */ #define RPM_PCO_ADD 1 #define RPM_PCO_CHANGE 2 #define RPM_PCO_SETGLOBAL 3 struct rr_pco_use /* use prefix part */ { uint8_t rpu_uselen; uint8_t rpu_keeplen; uint8_t rpu_ramask; uint8_t rpu_raflags; uint32_t rpu_vltime; uint32_t rpu_pltime; uint32_t rpu_flags; struct in6_addr rpu_prefix; }; #define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x20 #define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x10 #if BYTE_ORDER == BIG_ENDIAN # define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000 # define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000 #elif BYTE_ORDER == LITTLE_ENDIAN # define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80 # define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40 #endif struct rr_result /* router renumbering result message */ { uint16_t rrr_flags; uint8_t rrr_ordinal; uint8_t rrr_matchedlen; uint32_t rrr_ifid; struct in6_addr rrr_prefix; }; #if BYTE_ORDER == BIG_ENDIAN # define ICMP6_RR_RESULT_FLAGS_OOB 0x0002 # define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001 #elif BYTE_ORDER == LITTLE_ENDIAN # define ICMP6_RR_RESULT_FLAGS_OOB 0x0200 # define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100 #endif /* Mobile IPv6 extension: Advertisement Interval. */ struct nd_opt_adv_interval { uint8_t nd_opt_adv_interval_type; uint8_t nd_opt_adv_interval_len; uint16_t nd_opt_adv_interval_reserved; uint32_t nd_opt_adv_interval_ival; }; /* Mobile IPv6 extension: Home Agent Info. */ struct nd_opt_home_agent_info { uint8_t nd_opt_home_agent_info_type; uint8_t nd_opt_home_agent_info_len; uint16_t nd_opt_home_agent_info_reserved; uint16_t nd_opt_home_agent_info_preference; uint16_t nd_opt_home_agent_info_lifetime; }; #endif /* netinet/icmpv6.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netinet/igmp.h��������������������������������������������������������������������������������������0000644�����������������00000011014�14763166030�0007322 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997, 1999, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _NETINET_IGMP_H #define _NETINET_IGMP_H 1 #include <sys/cdefs.h> #include <sys/types.h> #ifdef __USE_BSD #include <netinet/in.h> __BEGIN_DECLS /* * Copyright (c) 1988 Stephen Deering. * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Stephen Deering of Stanford University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)igmp.h 8.1 (Berkeley) 6/10/93 * $FreeBSD$ */ struct igmp { u_int8_t igmp_type; /* IGMP type */ u_int8_t igmp_code; /* routing code */ u_int16_t igmp_cksum; /* checksum */ struct in_addr igmp_group; /* group address */ }; #define IGMP_MINLEN 8 /* * Message types, including version number. */ #define IGMP_MEMBERSHIP_QUERY 0x11 /* membership query */ #define IGMP_V1_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */ #define IGMP_V2_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */ #define IGMP_V2_LEAVE_GROUP 0x17 /* Leave-group message */ #define IGMP_DVMRP 0x13 /* DVMRP routing message */ #define IGMP_PIM 0x14 /* PIM routing message */ #define IGMP_TRACE 0x15 #define IGMP_MTRACE_RESP 0x1e /* traceroute resp.(to sender)*/ #define IGMP_MTRACE 0x1f /* mcast traceroute messages */ #define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */ /* query (in seconds) according */ /* to RFC1112 */ #define IGMP_TIMER_SCALE 10 /* denotes that the igmp code field */ /* specifies time in 10th of seconds*/ /* * States for the IGMP v2 state table. */ #define IGMP_DELAYING_MEMBER 1 #define IGMP_IDLE_MEMBER 2 #define IGMP_LAZY_MEMBER 3 #define IGMP_SLEEPING_MEMBER 4 #define IGMP_AWAKENING_MEMBER 5 /* * States for IGMP router version cache. */ #define IGMP_v1_ROUTER 1 #define IGMP_v2_ROUTER 2 /* * The following four defininitions are for backwards compatibility. * They should be removed as soon as all applications are updated to * use the new constant names. */ #define IGMP_HOST_MEMBERSHIP_QUERY IGMP_MEMBERSHIP_QUERY #define IGMP_HOST_MEMBERSHIP_REPORT IGMP_V1_MEMBERSHIP_REPORT #define IGMP_HOST_NEW_MEMBERSHIP_REPORT IGMP_V2_MEMBERSHIP_REPORT #define IGMP_HOST_LEAVE_MESSAGE IGMP_V2_LEAVE_GROUP __END_DECLS #endif #endif /* netinet/igmp.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netinet/ip6.h���������������������������������������������������������������������������������������0000644�����������������00000012423�14763166030�0007071 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-1997, 2001, 2003, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _NETINET_IP6_H #define _NETINET_IP6_H 1 #include <inttypes.h> #include <netinet/in.h> struct ip6_hdr { union { struct ip6_hdrctl { uint32_t ip6_un1_flow; /* 4 bits version, 8 bits TC, 20 bits flow-ID */ uint16_t ip6_un1_plen; /* payload length */ uint8_t ip6_un1_nxt; /* next header */ uint8_t ip6_un1_hlim; /* hop limit */ } ip6_un1; uint8_t ip6_un2_vfc; /* 4 bits version, top 4 bits tclass */ } ip6_ctlun; struct in6_addr ip6_src; /* source address */ struct in6_addr ip6_dst; /* destination address */ }; #define ip6_vfc ip6_ctlun.ip6_un2_vfc #define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow #define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen #define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt #define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim #define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim /* Generic extension header. */ struct ip6_ext { uint8_t ip6e_nxt; /* next header. */ uint8_t ip6e_len; /* length in units of 8 octets. */ }; /* Hop-by-Hop options header. */ struct ip6_hbh { uint8_t ip6h_nxt; /* next header. */ uint8_t ip6h_len; /* length in units of 8 octets. */ /* followed by options */ }; /* Destination options header */ struct ip6_dest { uint8_t ip6d_nxt; /* next header */ uint8_t ip6d_len; /* length in units of 8 octets */ /* followed by options */ }; /* Routing header */ struct ip6_rthdr { uint8_t ip6r_nxt; /* next header */ uint8_t ip6r_len; /* length in units of 8 octets */ uint8_t ip6r_type; /* routing type */ uint8_t ip6r_segleft; /* segments left */ /* followed by routing type specific data */ }; /* Type 0 Routing header */ struct ip6_rthdr0 { uint8_t ip6r0_nxt; /* next header */ uint8_t ip6r0_len; /* length in units of 8 octets */ uint8_t ip6r0_type; /* always zero */ uint8_t ip6r0_segleft; /* segments left */ uint8_t ip6r0_reserved; /* reserved field */ uint8_t ip6r0_slmap[3]; /* strict/loose bit map */ /* followed by up to 127 struct in6_addr */ struct in6_addr ip6r0_addr[0]; }; /* Fragment header */ struct ip6_frag { uint8_t ip6f_nxt; /* next header */ uint8_t ip6f_reserved; /* reserved field */ uint16_t ip6f_offlg; /* offset, reserved, and flag */ uint32_t ip6f_ident; /* identification */ }; #if BYTE_ORDER == BIG_ENDIAN # define IP6F_OFF_MASK 0xfff8 /* mask out offset from _offlg */ # define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */ # define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */ #else /* BYTE_ORDER == LITTLE_ENDIAN */ # define IP6F_OFF_MASK 0xf8ff /* mask out offset from _offlg */ # define IP6F_RESERVED_MASK 0x0600 /* reserved bits in ip6f_offlg */ # define IP6F_MORE_FRAG 0x0100 /* more-fragments flag */ #endif /* IPv6 options */ struct ip6_opt { uint8_t ip6o_type; uint8_t ip6o_len; }; /* The high-order 3 bits of the option type define the behavior * when processing an unknown option and whether or not the option * content changes in flight. */ #define IP6OPT_TYPE(o) ((o) & 0xc0) #define IP6OPT_TYPE_SKIP 0x00 #define IP6OPT_TYPE_DISCARD 0x40 #define IP6OPT_TYPE_FORCEICMP 0x80 #define IP6OPT_TYPE_ICMP 0xc0 #define IP6OPT_TYPE_MUTABLE 0x20 /* Special option types for padding. */ #define IP6OPT_PAD1 0 #define IP6OPT_PADN 1 #define IP6OPT_JUMBO 0xc2 #define IP6OPT_NSAP_ADDR 0xc3 #define IP6OPT_TUNNEL_LIMIT 0x04 #define IP6OPT_ROUTER_ALERT 0x05 /* Jumbo Payload Option */ struct ip6_opt_jumbo { uint8_t ip6oj_type; uint8_t ip6oj_len; uint8_t ip6oj_jumbo_len[4]; }; #define IP6OPT_JUMBO_LEN 6 /* NSAP Address Option */ struct ip6_opt_nsap { uint8_t ip6on_type; uint8_t ip6on_len; uint8_t ip6on_src_nsap_len; uint8_t ip6on_dst_nsap_len; /* followed by source NSAP */ /* followed by destination NSAP */ }; /* Tunnel Limit Option */ struct ip6_opt_tunnel { uint8_t ip6ot_type; uint8_t ip6ot_len; uint8_t ip6ot_encap_limit; }; /* Router Alert Option */ struct ip6_opt_router { uint8_t ip6or_type; uint8_t ip6or_len; uint8_t ip6or_value[2]; }; /* Router alert values (in network byte order) */ #if BYTE_ORDER == BIG_ENDIAN # define IP6_ALERT_MLD 0x0000 # define IP6_ALERT_RSVP 0x0001 # define IP6_ALERT_AN 0x0002 #else /* BYTE_ORDER == LITTLE_ENDING */ # define IP6_ALERT_MLD 0x0000 # define IP6_ALERT_RSVP 0x0100 # define IP6_ALERT_AN 0x0200 #endif #endif /* netinet/ip6.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netinet/if_tr.h�������������������������������������������������������������������������������������0000644�����������������00000007175�14763166030�0007506 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _NETINET_IF_TR_H #define _NETINET_IF_TR_H 1 #include <sys/cdefs.h> #include <sys/types.h> /* IEEE 802.5 Token-Ring magic constants. The frame sizes omit the preamble and FCS/CRC (frame check sequence). */ #define TR_ALEN 6 /* Octets in one token-ring addr */ #define TR_HLEN (sizeof (struct trh_hdr) + sizeof (struct trllc)) #define AC 0x10 #define LLC_FRAME 0x40 /* LLC and SNAP constants */ #define EXTENDED_SAP 0xAA #define UI_CMD 0x03 /* This is an Token-Ring frame header. */ struct trh_hdr { u_int8_t ac; /* access control field */ u_int8_t fc; /* frame control field */ u_int8_t daddr[TR_ALEN]; /* destination address */ u_int8_t saddr[TR_ALEN]; /* source address */ u_int16_t rcf; /* route control field */ u_int16_t rseg[8]; /* routing registers */ }; /* This is an Token-Ring LLC structure */ struct trllc { u_int8_t dsap; /* destination SAP */ u_int8_t ssap; /* source SAP */ u_int8_t llc; /* LLC control field */ u_int8_t protid[3]; /* protocol id */ u_int16_t ethertype; /* ether type field */ }; /* Token-Ring statistics collection data. */ struct tr_statistics { unsigned long rx_packets; /* total packets received */ unsigned long tx_packets; /* total packets transmitted */ unsigned long rx_bytes; /* total bytes received */ unsigned long tx_bytes; /* total bytes transmitted */ unsigned long rx_errors; /* bad packets received */ unsigned long tx_errors; /* packet transmit problems */ unsigned long rx_dropped; /* no space in linux buffers */ unsigned long tx_dropped; /* no space available in linux */ unsigned long multicast; /* multicast packets received */ unsigned long transmit_collision; /* detailed Token-Ring errors. See IBM Token-Ring Network Architecture for more info */ unsigned long line_errors; unsigned long internal_errors; unsigned long burst_errors; unsigned long A_C_errors; unsigned long abort_delimiters; unsigned long lost_frames; unsigned long recv_congest_count; unsigned long frame_copied_errors; unsigned long frequency_errors; unsigned long token_errors; unsigned long dummy1; }; /* source routing stuff */ #define TR_RII 0x80 #define TR_RCF_DIR_BIT 0x80 #define TR_RCF_LEN_MASK 0x1f00 #define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */ #define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */ #define TR_RCF_FRAME2K 0x20 #define TR_RCF_BROADCAST_MASK 0xC000 #define TR_MAXRIFLEN 18 #ifdef __USE_BSD struct trn_hdr { u_int8_t trn_ac; /* access control field */ u_int8_t trn_fc; /* field control field */ u_int8_t trn_dhost[TR_ALEN]; /* destination host */ u_int8_t trn_shost[TR_ALEN]; /* source host */ u_int16_t trn_rcf; /* route control field */ u_int16_t trn_rseg[8]; /* routing registers */ }; #endif #endif /* netinet/if_tr.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netinet/ether.h�������������������������������������������������������������������������������������0000644�����������������00000003643�14763166030�0007506 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Functions for storing Ethernet addresses in ASCII and mapping to hostnames. Copyright (C) 1996, 1997, 1999, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _NETINET_ETHER_H #define _NETINET_ETHER_H 1 #include <features.h> /* Get definition of `struct ether_addr'. */ #include <netinet/if_ether.h> __BEGIN_DECLS /* Convert 48 bit Ethernet ADDRess to ASCII. */ extern char *ether_ntoa (const struct ether_addr *__addr) __THROW; extern char *ether_ntoa_r (const struct ether_addr *__addr, char *__buf) __THROW; /* Convert ASCII string S to 48 bit Ethernet address. */ extern struct ether_addr *ether_aton (const char *__asc) __THROW; extern struct ether_addr *ether_aton_r (const char *__asc, struct ether_addr *__addr) __THROW; /* Map 48 bit Ethernet number ADDR to HOSTNAME. */ extern int ether_ntohost (char *__hostname, const struct ether_addr *__addr) __THROW; /* Map HOSTNAME to 48 bit Ethernet address. */ extern int ether_hostton (const char *__hostname, struct ether_addr *__addr) __THROW; /* Scan LINE and set ADDR and HOSTNAME. */ extern int ether_line (const char *__line, struct ether_addr *__addr, char *__hostname) __THROW; __END_DECLS #endif /* netinet/ether.h */ ���������������������������������������������������������������������������������������������netinet/if_fddi.h�����������������������������������������������������������������������������������0000644�����������������00000002271�14763166030�0007757 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _NETINET_IF_FDDI_H #define _NETINET_IF_FDDI_H 1 #include <sys/cdefs.h> #include <sys/types.h> #include <asm/types.h> #include <linux/if_fddi.h> #ifdef __USE_BSD struct fddi_header { u_int8_t fddi_fc; /* Frame Control (FC) value */ u_int8_t fddi_dhost[FDDI_K_ALEN]; /* Destination host */ u_int8_t fddi_shost[FDDI_K_ALEN]; /* Source host */ }; #endif #endif /* netinet/if_fddi.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netinet/udp.h���������������������������������������������������������������������������������������0000644�����������������00000006430�14763166030�0007164 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-1993,1995-1997,2004,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * Copyright (C) 1982, 1986 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef __NETINET_UDP_H #define __NETINET_UDP_H 1 #include <features.h> #include <sys/types.h> /* UDP header as specified by RFC 768, August 1980. */ #ifdef __FAVOR_BSD struct udphdr { u_int16_t uh_sport; /* source port */ u_int16_t uh_dport; /* destination port */ u_int16_t uh_ulen; /* udp length */ u_int16_t uh_sum; /* udp checksum */ }; #else struct udphdr { u_int16_t source; u_int16_t dest; u_int16_t len; u_int16_t check; }; #endif /* UDP socket options */ #define UDP_CORK 1 /* Never send partially complete segments. */ #define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets. */ /* UDP encapsulation types */ #define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */ #define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */ #define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */ #define SOL_UDP 17 /* sockopt level for UDP */ #endif /* netinet/udp.h */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netinet/if_ether.h����������������������������������������������������������������������������������0000644�����������������00000007625�14763166030�0010170 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __NETINET_IF_ETHER_H #define __NETINET_IF_ETHER_H 1 #include <features.h> #include <sys/types.h> /* Get definitions from kernel header file. */ #include <linux/if_ether.h> #ifdef __USE_BSD /* * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)if_ether.h 8.3 (Berkeley) 5/2/95 * $FreeBSD$ */ #include <net/ethernet.h> #include <net/if_arp.h> __BEGIN_DECLS /* * Ethernet Address Resolution Protocol. * * See RFC 826 for protocol description. Structure below is adapted * to resolving internet addresses. Field names used correspond to * RFC 826. */ struct ether_arp { struct arphdr ea_hdr; /* fixed-size header */ u_int8_t arp_sha[ETH_ALEN]; /* sender hardware address */ u_int8_t arp_spa[4]; /* sender protocol address */ u_int8_t arp_tha[ETH_ALEN]; /* target hardware address */ u_int8_t arp_tpa[4]; /* target protocol address */ }; #define arp_hrd ea_hdr.ar_hrd #define arp_pro ea_hdr.ar_pro #define arp_hln ea_hdr.ar_hln #define arp_pln ea_hdr.ar_pln #define arp_op ea_hdr.ar_op /* * Macro to map an IP multicast address to an Ethernet multicast address. * The high-order 25 bits of the Ethernet address are statically assigned, * and the low-order 23 bits are taken from the low end of the IP address. */ #define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \ /* struct in_addr *ipaddr; */ \ /* u_char enaddr[ETH_ALEN]; */ \ { \ (enaddr)[0] = 0x01; \ (enaddr)[1] = 0x00; \ (enaddr)[2] = 0x5e; \ (enaddr)[3] = ((u_int8_t *)ipaddr)[1] & 0x7f; \ (enaddr)[4] = ((u_int8_t *)ipaddr)[2]; \ (enaddr)[5] = ((u_int8_t *)ipaddr)[3]; \ } __END_DECLS #endif /* __USE_BSD */ #endif /* netinet/if_ether.h */ �����������������������������������������������������������������������������������������������������������netinet/in.h����������������������������������������������������������������������������������������0000644�����������������00000051767�14763166030�0007017 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-2001, 2003, 2004, 2006, 2007, 2008, 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _NETINET_IN_H #define _NETINET_IN_H 1 #include <features.h> #include <stdint.h> #include <sys/socket.h> #include <bits/types.h> __BEGIN_DECLS /* Internet address. */ typedef uint32_t in_addr_t; struct in_addr { in_addr_t s_addr; }; /* Get system-specific definitions. */ #include <bits/in.h> /* Standard well-defined IP protocols. */ enum { IPPROTO_IP = 0, /* Dummy protocol for TCP. */ #define IPPROTO_IP IPPROTO_IP IPPROTO_ICMP = 1, /* Internet Control Message Protocol. */ #define IPPROTO_ICMP IPPROTO_ICMP IPPROTO_IGMP = 2, /* Internet Group Management Protocol. */ #define IPPROTO_IGMP IPPROTO_IGMP IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94). */ #define IPPROTO_IPIP IPPROTO_IPIP IPPROTO_TCP = 6, /* Transmission Control Protocol. */ #define IPPROTO_TCP IPPROTO_TCP IPPROTO_EGP = 8, /* Exterior Gateway Protocol. */ #define IPPROTO_EGP IPPROTO_EGP IPPROTO_PUP = 12, /* PUP protocol. */ #define IPPROTO_PUP IPPROTO_PUP IPPROTO_UDP = 17, /* User Datagram Protocol. */ #define IPPROTO_UDP IPPROTO_UDP IPPROTO_IDP = 22, /* XNS IDP protocol. */ #define IPPROTO_IDP IPPROTO_IDP IPPROTO_TP = 29, /* SO Transport Protocol Class 4. */ #define IPPROTO_TP IPPROTO_TP IPPROTO_DCCP = 33, /* Datagram Congestion Control Protocol. */ #define IPPROTO_DCCP IPPROTO_DCCP IPPROTO_IPV6 = 41, /* IPv6 header. */ #define IPPROTO_IPV6 IPPROTO_IPV6 IPPROTO_RSVP = 46, /* Reservation Protocol. */ #define IPPROTO_RSVP IPPROTO_RSVP IPPROTO_GRE = 47, /* General Routing Encapsulation. */ #define IPPROTO_GRE IPPROTO_GRE IPPROTO_ESP = 50, /* encapsulating security payload. */ #define IPPROTO_ESP IPPROTO_ESP IPPROTO_AH = 51, /* authentication header. */ #define IPPROTO_AH IPPROTO_AH IPPROTO_MTP = 92, /* Multicast Transport Protocol. */ #define IPPROTO_MTP IPPROTO_MTP IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET. */ #define IPPROTO_BEETPH IPPROTO_BEETPH IPPROTO_ENCAP = 98, /* Encapsulation Header. */ #define IPPROTO_ENCAP IPPROTO_ENCAP IPPROTO_PIM = 103, /* Protocol Independent Multicast. */ #define IPPROTO_PIM IPPROTO_PIM IPPROTO_COMP = 108, /* Compression Header Protocol. */ #define IPPROTO_COMP IPPROTO_COMP IPPROTO_SCTP = 132, /* Stream Control Transmission Protocol. */ #define IPPROTO_SCTP IPPROTO_SCTP IPPROTO_UDPLITE = 136, /* UDP-Lite protocol. */ #define IPPROTO_UDPLITE IPPROTO_UDPLITE IPPROTO_MPLS = 137, /* MPLS in IP. */ #define IPPROTO_MPLS IPPROTO_MPLS IPPROTO_RAW = 255, /* Raw IP packets. */ #define IPPROTO_RAW IPPROTO_RAW IPPROTO_MAX }; /* If __USE_KERNEL_IPV6_DEFS is 1 then the user has included the kernel network headers first and we should use those ABI-identical definitions instead of our own, otherwise 0. */ #if !__USE_KERNEL_IPV6_DEFS enum { IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */ #define IPPROTO_HOPOPTS IPPROTO_HOPOPTS IPPROTO_ROUTING = 43, /* IPv6 routing header. */ #define IPPROTO_ROUTING IPPROTO_ROUTING IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header. */ #define IPPROTO_FRAGMENT IPPROTO_FRAGMENT IPPROTO_ICMPV6 = 58, /* ICMPv6. */ #define IPPROTO_ICMPV6 IPPROTO_ICMPV6 IPPROTO_NONE = 59, /* IPv6 no next header. */ #define IPPROTO_NONE IPPROTO_NONE IPPROTO_DSTOPTS = 60, /* IPv6 destination options. */ #define IPPROTO_DSTOPTS IPPROTO_DSTOPTS IPPROTO_MH = 135 /* IPv6 mobility header. */ #define IPPROTO_MH IPPROTO_MH }; #endif /* !__USE_KERNEL_IPV6_DEFS */ /* Type to represent a port. */ typedef uint16_t in_port_t; /* Standard well-known ports. */ enum { IPPORT_ECHO = 7, /* Echo service. */ IPPORT_DISCARD = 9, /* Discard transmissions service. */ IPPORT_SYSTAT = 11, /* System status service. */ IPPORT_DAYTIME = 13, /* Time of day service. */ IPPORT_NETSTAT = 15, /* Network status service. */ IPPORT_FTP = 21, /* File Transfer Protocol. */ IPPORT_TELNET = 23, /* Telnet protocol. */ IPPORT_SMTP = 25, /* Simple Mail Transfer Protocol. */ IPPORT_TIMESERVER = 37, /* Timeserver service. */ IPPORT_NAMESERVER = 42, /* Domain Name Service. */ IPPORT_WHOIS = 43, /* Internet Whois service. */ IPPORT_MTP = 57, IPPORT_TFTP = 69, /* Trivial File Transfer Protocol. */ IPPORT_RJE = 77, IPPORT_FINGER = 79, /* Finger service. */ IPPORT_TTYLINK = 87, IPPORT_SUPDUP = 95, /* SUPDUP protocol. */ IPPORT_EXECSERVER = 512, /* execd service. */ IPPORT_LOGINSERVER = 513, /* rlogind service. */ IPPORT_CMDSERVER = 514, IPPORT_EFSSERVER = 520, /* UDP ports. */ IPPORT_BIFFUDP = 512, IPPORT_WHOSERVER = 513, IPPORT_ROUTESERVER = 520, /* Ports less than this value are reserved for privileged processes. */ IPPORT_RESERVED = 1024, /* Ports greater this value are reserved for (non-privileged) servers. */ IPPORT_USERRESERVED = 5000 }; /* Definitions of the bits in an Internet address integer. On subnets, host and network parts are found according to the subnet mask, not these masks. */ #define IN_CLASSA(a) ((((in_addr_t)(a)) & 0x80000000) == 0) #define IN_CLASSA_NET 0xff000000 #define IN_CLASSA_NSHIFT 24 #define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) #define IN_CLASSA_MAX 128 #define IN_CLASSB(a) ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000) #define IN_CLASSB_NET 0xffff0000 #define IN_CLASSB_NSHIFT 16 #define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) #define IN_CLASSB_MAX 65536 #define IN_CLASSC(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000) #define IN_CLASSC_NET 0xffffff00 #define IN_CLASSC_NSHIFT 8 #define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) #define IN_CLASSD(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000) #define IN_MULTICAST(a) IN_CLASSD(a) #define IN_EXPERIMENTAL(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000) #define IN_BADCLASS(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000) /* Address to accept any incoming messages. */ #define INADDR_ANY ((in_addr_t) 0x00000000) /* Address to send to all hosts. */ #define INADDR_BROADCAST ((in_addr_t) 0xffffffff) /* Address indicating an error return. */ #define INADDR_NONE ((in_addr_t) 0xffffffff) /* Network number for local host loopback. */ #define IN_LOOPBACKNET 127 /* Address to loopback in software to local host. */ #ifndef INADDR_LOOPBACK # define INADDR_LOOPBACK ((in_addr_t) 0x7f000001) /* Inet 127.0.0.1. */ #endif /* Defines for Multicast INADDR. */ #define INADDR_UNSPEC_GROUP ((in_addr_t) 0xe0000000) /* 224.0.0.0 */ #define INADDR_ALLHOSTS_GROUP ((in_addr_t) 0xe0000001) /* 224.0.0.1 */ #define INADDR_ALLRTRS_GROUP ((in_addr_t) 0xe0000002) /* 224.0.0.2 */ #define INADDR_MAX_LOCAL_GROUP ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */ #if !__USE_KERNEL_IPV6_DEFS /* IPv6 address */ struct in6_addr { union { uint8_t __u6_addr8[16]; #if defined __USE_MISC || defined __USE_GNU uint16_t __u6_addr16[8]; uint32_t __u6_addr32[4]; #endif } __in6_u; #define s6_addr __in6_u.__u6_addr8 #if defined __USE_MISC || defined __USE_GNU # define s6_addr16 __in6_u.__u6_addr16 # define s6_addr32 __in6_u.__u6_addr32 #endif }; #endif /* !__USE_KERNEL_IPV6_DEFS */ extern const struct in6_addr in6addr_any; /* :: */ extern const struct in6_addr in6addr_loopback; /* ::1 */ #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } #define INET_ADDRSTRLEN 16 #define INET6_ADDRSTRLEN 46 /* Structure describing an Internet socket address. */ struct sockaddr_in { __SOCKADDR_COMMON (sin_); in_port_t sin_port; /* Port number. */ struct in_addr sin_addr; /* Internet address. */ /* Pad to size of `struct sockaddr'. */ unsigned char sin_zero[sizeof (struct sockaddr) - __SOCKADDR_COMMON_SIZE - sizeof (in_port_t) - sizeof (struct in_addr)]; }; #if !__USE_KERNEL_IPV6_DEFS /* Ditto, for IPv6. */ struct sockaddr_in6 { __SOCKADDR_COMMON (sin6_); in_port_t sin6_port; /* Transport layer port # */ uint32_t sin6_flowinfo; /* IPv6 flow information */ struct in6_addr sin6_addr; /* IPv6 address */ uint32_t sin6_scope_id; /* IPv6 scope-id */ }; #endif /* !__USE_KERNEL_IPV6_DEFS */ #if defined __USE_MISC || defined __USE_GNU /* IPv4 multicast request. */ struct ip_mreq { /* IP multicast address of group. */ struct in_addr imr_multiaddr; /* Local IP address of interface. */ struct in_addr imr_interface; }; struct ip_mreq_source { /* IP multicast address of group. */ struct in_addr imr_multiaddr; /* IP address of source. */ struct in_addr imr_interface; /* IP address of interface. */ struct in_addr imr_sourceaddr; }; #endif #if !__USE_KERNEL_IPV6_DEFS /* Likewise, for IPv6. */ struct ipv6_mreq { /* IPv6 multicast address of group */ struct in6_addr ipv6mr_multiaddr; /* local interface */ unsigned int ipv6mr_interface; }; #endif /* !__USE_KERNEL_IPV6_DEFS */ #if defined __USE_MISC || defined __USE_GNU /* Multicast group request. */ struct group_req { /* Interface index. */ uint32_t gr_interface; /* Group address. */ struct sockaddr_storage gr_group; }; struct group_source_req { /* Interface index. */ uint32_t gsr_interface; /* Group address. */ struct sockaddr_storage gsr_group; /* Source address. */ struct sockaddr_storage gsr_source; }; /* Full-state filter operations. */ struct ip_msfilter { /* IP multicast address of group. */ struct in_addr imsf_multiaddr; /* Local IP address of interface. */ struct in_addr imsf_interface; /* Filter mode. */ uint32_t imsf_fmode; /* Number of source addresses. */ uint32_t imsf_numsrc; /* Source addresses. */ struct in_addr imsf_slist[1]; }; #define IP_MSFILTER_SIZE(numsrc) (sizeof (struct ip_msfilter) \ - sizeof (struct in_addr) \ + (numsrc) * sizeof (struct in_addr)) struct group_filter { /* Interface index. */ uint32_t gf_interface; /* Group address. */ struct sockaddr_storage gf_group; /* Filter mode. */ uint32_t gf_fmode; /* Number of source addresses. */ uint32_t gf_numsrc; /* Source addresses. */ struct sockaddr_storage gf_slist[1]; }; #define GROUP_FILTER_SIZE(numsrc) (sizeof (struct group_filter) \ - sizeof (struct sockaddr_storage) \ + ((numsrc) \ * sizeof (struct sockaddr_storage))) #endif /* Functions to convert between host and network byte order. Please note that these functions normally take `unsigned long int' or `unsigned short int' values as arguments and also return them. But this was a short-sighted decision since on different systems the types may have different representations but the values are always the same. */ extern uint32_t ntohl (uint32_t __netlong) __THROW __attribute__ ((__const__)); extern uint16_t ntohs (uint16_t __netshort) __THROW __attribute__ ((__const__)); extern uint32_t htonl (uint32_t __hostlong) __THROW __attribute__ ((__const__)); extern uint16_t htons (uint16_t __hostshort) __THROW __attribute__ ((__const__)); #include <endian.h> /* Get machine dependent optimized versions of byte swapping functions. */ #include <bits/byteswap.h> #ifdef __OPTIMIZE__ /* We can optimize calls to the conversion functions. Either nothing has to be done or we are using directly the byte-swapping functions which often can be inlined. */ # if __BYTE_ORDER == __BIG_ENDIAN /* The host byte order is the same as network byte order, so these functions are all just identity. */ # define ntohl(x) (x) # define ntohs(x) (x) # define htonl(x) (x) # define htons(x) (x) # else # if __BYTE_ORDER == __LITTLE_ENDIAN # define ntohl(x) __bswap_32 (x) # define ntohs(x) __bswap_16 (x) # define htonl(x) __bswap_32 (x) # define htons(x) __bswap_16 (x) # endif # endif #endif #ifdef __GNUC__ # define IN6_IS_ADDR_UNSPECIFIED(a) \ (__extension__ \ ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \ __a->s6_addr32[0] == 0 \ && __a->s6_addr32[1] == 0 \ && __a->s6_addr32[2] == 0 \ && __a->s6_addr32[3] == 0; })) # define IN6_IS_ADDR_LOOPBACK(a) \ (__extension__ \ ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \ __a->s6_addr32[0] == 0 \ && __a->s6_addr32[1] == 0 \ && __a->s6_addr32[2] == 0 \ && __a->s6_addr32[3] == htonl (1); })) # define IN6_IS_ADDR_LINKLOCAL(a) \ (__extension__ \ ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \ (__a->s6_addr32[0] & htonl (0xffc00000)) == htonl (0xfe800000); })) # define IN6_IS_ADDR_SITELOCAL(a) \ (__extension__ \ ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \ (__a->s6_addr32[0] & htonl (0xffc00000)) == htonl (0xfec00000); })) # define IN6_IS_ADDR_V4MAPPED(a) \ (__extension__ \ ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \ __a->s6_addr32[0] == 0 \ && __a->s6_addr32[1] == 0 \ && __a->s6_addr32[2] == htonl (0xffff); })) # define IN6_IS_ADDR_V4COMPAT(a) \ (__extension__ \ ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \ __a->s6_addr32[0] == 0 \ && __a->s6_addr32[1] == 0 \ && __a->s6_addr32[2] == 0 \ && ntohl (__a->s6_addr32[3]) > 1; })) # define IN6_ARE_ADDR_EQUAL(a,b) \ (__extension__ \ ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \ const struct in6_addr *__b = (const struct in6_addr *) (b); \ __a->s6_addr32[0] == __b->s6_addr32[0] \ && __a->s6_addr32[1] == __b->s6_addr32[1] \ && __a->s6_addr32[2] == __b->s6_addr32[2] \ && __a->s6_addr32[3] == __b->s6_addr32[3]; })) #else # define IN6_IS_ADDR_UNSPECIFIED(a) \ (((const uint32_t *) (a))[0] == 0 \ && ((const uint32_t *) (a))[1] == 0 \ && ((const uint32_t *) (a))[2] == 0 \ && ((const uint32_t *) (a))[3] == 0) # define IN6_IS_ADDR_LOOPBACK(a) \ (((const uint32_t *) (a))[0] == 0 \ && ((const uint32_t *) (a))[1] == 0 \ && ((const uint32_t *) (a))[2] == 0 \ && ((const uint32_t *) (a))[3] == htonl (1)) # define IN6_IS_ADDR_LINKLOCAL(a) \ ((((const uint32_t *) (a))[0] & htonl (0xffc00000)) \ == htonl (0xfe800000)) # define IN6_IS_ADDR_SITELOCAL(a) \ ((((const uint32_t *) (a))[0] & htonl (0xffc00000)) \ == htonl (0xfec00000)) # define IN6_IS_ADDR_V4MAPPED(a) \ ((((const uint32_t *) (a))[0] == 0) \ && (((const uint32_t *) (a))[1] == 0) \ && (((const uint32_t *) (a))[2] == htonl (0xffff))) # define IN6_IS_ADDR_V4COMPAT(a) \ ((((const uint32_t *) (a))[0] == 0) \ && (((const uint32_t *) (a))[1] == 0) \ && (((const uint32_t *) (a))[2] == 0) \ && (ntohl (((const uint32_t *) (a))[3]) > 1)) # define IN6_ARE_ADDR_EQUAL(a,b) \ ((((const uint32_t *) (a))[0] == ((const uint32_t *) (b))[0]) \ && (((const uint32_t *) (a))[1] == ((const uint32_t *) (b))[1]) \ && (((const uint32_t *) (a))[2] == ((const uint32_t *) (b))[2]) \ && (((const uint32_t *) (a))[3] == ((const uint32_t *) (b))[3])) #endif #define IN6_IS_ADDR_MULTICAST(a) (((const uint8_t *) (a))[0] == 0xff) #if defined __USE_MISC || defined __USE_GNU /* Bind socket to a privileged IP port. */ extern int bindresvport (int __sockfd, struct sockaddr_in *__sock_in) __THROW; /* The IPv6 version of this function. */ extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in) __THROW; #endif #define IN6_IS_ADDR_MC_NODELOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) \ && ((((const uint8_t *) (a))[1] & 0xf) == 0x1)) #define IN6_IS_ADDR_MC_LINKLOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) \ && ((((const uint8_t *) (a))[1] & 0xf) == 0x2)) #define IN6_IS_ADDR_MC_SITELOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) \ && ((((const uint8_t *) (a))[1] & 0xf) == 0x5)) #define IN6_IS_ADDR_MC_ORGLOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) \ && ((((const uint8_t *) (a))[1] & 0xf) == 0x8)) #define IN6_IS_ADDR_MC_GLOBAL(a) \ (IN6_IS_ADDR_MULTICAST(a) \ && ((((const uint8_t *) (a))[1] & 0xf) == 0xe)) #ifdef __USE_GNU struct cmsghdr; /* Forward declaration. */ #if !__USE_KERNEL_IPV6_DEFS /* IPv6 packet information. */ struct in6_pktinfo { struct in6_addr ipi6_addr; /* src/dst IPv6 address */ unsigned int ipi6_ifindex; /* send/recv interface index */ }; /* IPv6 MTU information. */ struct ip6_mtuinfo { struct sockaddr_in6 ip6m_addr; /* dst address including zone ID */ uint32_t ip6m_mtu; /* path MTU in host byte order */ }; #endif /* !__USE_KERNEL_IPV6_DEFS */ /* Obsolete hop-by-hop and Destination Options Processing (RFC 2292). */ extern int inet6_option_space (int __nbytes) __THROW __attribute_deprecated__; extern int inet6_option_init (void *__bp, struct cmsghdr **__cmsgp, int __type) __THROW __attribute_deprecated__; extern int inet6_option_append (struct cmsghdr *__cmsg, const uint8_t *__typep, int __multx, int __plusy) __THROW __attribute_deprecated__; extern uint8_t *inet6_option_alloc (struct cmsghdr *__cmsg, int __datalen, int __multx, int __plusy) __THROW __attribute_deprecated__; extern int inet6_option_next (const struct cmsghdr *__cmsg, uint8_t **__tptrp) __THROW __attribute_deprecated__; extern int inet6_option_find (const struct cmsghdr *__cmsg, uint8_t **__tptrp, int __type) __THROW __attribute_deprecated__; /* Hop-by-Hop and Destination Options Processing (RFC 3542). */ extern int inet6_opt_init (void *__extbuf, socklen_t __extlen) __THROW; extern int inet6_opt_append (void *__extbuf, socklen_t __extlen, int __offset, uint8_t __type, socklen_t __len, uint8_t __align, void **__databufp) __THROW; extern int inet6_opt_finish (void *__extbuf, socklen_t __extlen, int __offset) __THROW; extern int inet6_opt_set_val (void *__databuf, int __offset, void *__val, socklen_t __vallen) __THROW; extern int inet6_opt_next (void *__extbuf, socklen_t __extlen, int __offset, uint8_t *__typep, socklen_t *__lenp, void **__databufp) __THROW; extern int inet6_opt_find (void *__extbuf, socklen_t __extlen, int __offset, uint8_t __type, socklen_t *__lenp, void **__databufp) __THROW; extern int inet6_opt_get_val (void *__databuf, int __offset, void *__val, socklen_t __vallen) __THROW; /* Routing Header Option (RFC 3542). */ extern socklen_t inet6_rth_space (int __type, int __segments) __THROW; extern void *inet6_rth_init (void *__bp, socklen_t __bp_len, int __type, int __segments) __THROW; extern int inet6_rth_add (void *__bp, const struct in6_addr *__addr) __THROW; extern int inet6_rth_reverse (const void *__in, void *__out) __THROW; extern int inet6_rth_segments (const void *__bp) __THROW; extern struct in6_addr *inet6_rth_getaddr (const void *__bp, int __index) __THROW; /* Multicast source filter support. */ /* Get IPv4 source filter. */ extern int getipv4sourcefilter (int __s, struct in_addr __interface_addr, struct in_addr __group, uint32_t *__fmode, uint32_t *__numsrc, struct in_addr *__slist) __THROW; /* Set IPv4 source filter. */ extern int setipv4sourcefilter (int __s, struct in_addr __interface_addr, struct in_addr __group, uint32_t __fmode, uint32_t __numsrc, const struct in_addr *__slist) __THROW; /* Get source filter. */ extern int getsourcefilter (int __s, uint32_t __interface_addr, const struct sockaddr *__group, socklen_t __grouplen, uint32_t *__fmode, uint32_t *__numsrc, struct sockaddr_storage *__slist) __THROW; /* Set source filter. */ extern int setsourcefilter (int __s, uint32_t __interface_addr, const struct sockaddr *__group, socklen_t __grouplen, uint32_t __fmode, uint32_t __numsrc, const struct sockaddr_storage *__slist) __THROW; #endif /* use GNU */ __END_DECLS #endif /* netinet/in.h */ ���������netinet/tcp.h���������������������������������������������������������������������������������������0000644�����������������00000021150�14763166030�0007156 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)tcp.h 8.1 (Berkeley) 6/10/93 */ #ifndef _NETINET_TCP_H #define _NETINET_TCP_H 1 #include <features.h> /* * User-settable options (used with setsockopt). */ #define TCP_NODELAY 1 /* Don't delay send to coalesce packets */ #define TCP_MAXSEG 2 /* Set maximum segment size */ #define TCP_CORK 3 /* Control sending of partial frames */ #define TCP_KEEPIDLE 4 /* Start keeplives after this period */ #define TCP_KEEPINTVL 5 /* Interval between keepalives */ #define TCP_KEEPCNT 6 /* Number of keepalives before death */ #define TCP_SYNCNT 7 /* Number of SYN retransmits */ #define TCP_LINGER2 8 /* Life time of orphaned FIN-WAIT-2 state */ #define TCP_DEFER_ACCEPT 9 /* Wake up listener only when data arrive */ #define TCP_WINDOW_CLAMP 10 /* Bound advertised window */ #define TCP_INFO 11 /* Information about this connection. */ #define TCP_QUICKACK 12 /* Bock/reenable quick ACKs. */ #define TCP_CONGESTION 13 /* Congestion control algorithm. */ #define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */ #define TCP_COOKIE_TRANSACTIONS 15 /* TCP Cookie Transactions */ #define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/ #define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */ #define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */ #define TCP_REPAIR 19 /* TCP sock is under repair right now */ #define TCP_REPAIR_QUEUE 20 /* Set TCP queue to repair */ #define TCP_QUEUE_SEQ 21 /* Set sequence number of repaired queue. */ #define TCP_REPAIR_OPTIONS 22 /* Repair TCP connection options */ #define TCP_FASTOPEN 23 /* Enable FastOpen on listeners */ #define TCP_TIMESTAMP 24 /* TCP time stamp */ #ifdef __USE_MISC # include <sys/types.h> # include <sys/socket.h> # ifdef __FAVOR_BSD typedef u_int32_t tcp_seq; /* * TCP header. * Per RFC 793, September, 1981. */ struct tcphdr { u_int16_t th_sport; /* source port */ u_int16_t th_dport; /* destination port */ tcp_seq th_seq; /* sequence number */ tcp_seq th_ack; /* acknowledgement number */ # if __BYTE_ORDER == __LITTLE_ENDIAN u_int8_t th_x2:4; /* (unused) */ u_int8_t th_off:4; /* data offset */ # endif # if __BYTE_ORDER == __BIG_ENDIAN u_int8_t th_off:4; /* data offset */ u_int8_t th_x2:4; /* (unused) */ # endif u_int8_t th_flags; # define TH_FIN 0x01 # define TH_SYN 0x02 # define TH_RST 0x04 # define TH_PUSH 0x08 # define TH_ACK 0x10 # define TH_URG 0x20 u_int16_t th_win; /* window */ u_int16_t th_sum; /* checksum */ u_int16_t th_urp; /* urgent pointer */ }; # else /* !__FAVOR_BSD */ struct tcphdr { u_int16_t source; u_int16_t dest; u_int32_t seq; u_int32_t ack_seq; # if __BYTE_ORDER == __LITTLE_ENDIAN u_int16_t res1:4; u_int16_t doff:4; u_int16_t fin:1; u_int16_t syn:1; u_int16_t rst:1; u_int16_t psh:1; u_int16_t ack:1; u_int16_t urg:1; u_int16_t res2:2; # elif __BYTE_ORDER == __BIG_ENDIAN u_int16_t doff:4; u_int16_t res1:4; u_int16_t res2:2; u_int16_t urg:1; u_int16_t ack:1; u_int16_t psh:1; u_int16_t rst:1; u_int16_t syn:1; u_int16_t fin:1; # else # error "Adjust your <bits/endian.h> defines" # endif u_int16_t window; u_int16_t check; u_int16_t urg_ptr; }; # endif /* __FAVOR_BSD */ enum { TCP_ESTABLISHED = 1, TCP_SYN_SENT, TCP_SYN_RECV, TCP_FIN_WAIT1, TCP_FIN_WAIT2, TCP_TIME_WAIT, TCP_CLOSE, TCP_CLOSE_WAIT, TCP_LAST_ACK, TCP_LISTEN, TCP_CLOSING /* now a valid state */ }; # define TCPOPT_EOL 0 # define TCPOPT_NOP 1 # define TCPOPT_MAXSEG 2 # define TCPOLEN_MAXSEG 4 # define TCPOPT_WINDOW 3 # define TCPOLEN_WINDOW 3 # define TCPOPT_SACK_PERMITTED 4 /* Experimental */ # define TCPOLEN_SACK_PERMITTED 2 # define TCPOPT_SACK 5 /* Experimental */ # define TCPOPT_TIMESTAMP 8 # define TCPOLEN_TIMESTAMP 10 # define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */ # define TCPOPT_TSTAMP_HDR \ (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP) /* * Default maximum segment size for TCP. * With an IP MSS of 576, this is 536, * but 512 is probably more convenient. * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)). */ # define TCP_MSS 512 # define TCP_MAXWIN 65535 /* largest value for (unscaled) window */ # define TCP_MAX_WINSHIFT 14 /* maximum window shift */ # define SOL_TCP 6 /* TCP level */ # define TCPI_OPT_TIMESTAMPS 1 # define TCPI_OPT_SACK 2 # define TCPI_OPT_WSCALE 4 # define TCPI_OPT_ECN 8 /* Values for tcpi_state. */ enum tcp_ca_state { TCP_CA_Open = 0, TCP_CA_Disorder = 1, TCP_CA_CWR = 2, TCP_CA_Recovery = 3, TCP_CA_Loss = 4 }; struct tcp_info { u_int8_t tcpi_state; u_int8_t tcpi_ca_state; u_int8_t tcpi_retransmits; u_int8_t tcpi_probes; u_int8_t tcpi_backoff; u_int8_t tcpi_options; u_int8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4; u_int32_t tcpi_rto; u_int32_t tcpi_ato; u_int32_t tcpi_snd_mss; u_int32_t tcpi_rcv_mss; u_int32_t tcpi_unacked; u_int32_t tcpi_sacked; u_int32_t tcpi_lost; u_int32_t tcpi_retrans; u_int32_t tcpi_fackets; /* Times. */ u_int32_t tcpi_last_data_sent; u_int32_t tcpi_last_ack_sent; /* Not remembered, sorry. */ u_int32_t tcpi_last_data_recv; u_int32_t tcpi_last_ack_recv; /* Metrics. */ u_int32_t tcpi_pmtu; u_int32_t tcpi_rcv_ssthresh; u_int32_t tcpi_rtt; u_int32_t tcpi_rttvar; u_int32_t tcpi_snd_ssthresh; u_int32_t tcpi_snd_cwnd; u_int32_t tcpi_advmss; u_int32_t tcpi_reordering; u_int32_t tcpi_rcv_rtt; u_int32_t tcpi_rcv_space; u_int32_t tcpi_total_retrans; }; /* For TCP_MD5SIG socket option. */ #define TCP_MD5SIG_MAXKEYLEN 80 struct tcp_md5sig { struct sockaddr_storage tcpm_addr; /* Address associated. */ u_int16_t __tcpm_pad1; /* Zero. */ u_int16_t tcpm_keylen; /* Key length. */ u_int32_t __tcpm_pad2; /* Zero. */ u_int8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* Key (binary). */ }; /* For socket repair options. */ struct tcp_repair_opt { u_int32_t opt_code; u_int32_t opt_val; }; /* Queue to repair, for TCP_REPAIR_QUEUE. */ enum { TCP_NO_QUEUE, TCP_RECV_QUEUE, TCP_SEND_QUEUE, TCP_QUEUES_NR, }; /* For cookie transactions socket options. */ #define TCP_COOKIE_MIN 8 /* 64-bits */ #define TCP_COOKIE_MAX 16 /* 128-bits */ #define TCP_COOKIE_PAIR_SIZE (2*TCP_COOKIE_MAX) /* Flags for both getsockopt and setsockopt */ #define TCP_COOKIE_IN_ALWAYS (1 << 0) /* Discard SYN without cookie */ #define TCP_COOKIE_OUT_NEVER (1 << 1) /* Prohibit outgoing cookies, * supercedes everything. */ /* Flags for getsockopt */ #define TCP_S_DATA_IN (1 << 2) /* Was data received? */ #define TCP_S_DATA_OUT (1 << 3) /* Was data sent? */ #define TCP_MSS_DEFAULT 536U /* IPv4 (RFC1122, RFC2581) */ #define TCP_MSS_DESIRED 1220U /* IPv6 (tunneled), EDNS0 (RFC3226) */ struct tcp_cookie_transactions { u_int16_t tcpct_flags; u_int8_t __tcpct_pad1; u_int8_t tcpct_cookie_desired; u_int16_t tcpct_s_data_desired; u_int16_t tcpct_used; u_int8_t tcpct_value[TCP_MSS_DEFAULT]; }; #endif /* Misc. */ #endif /* netinet/tcp.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netinet/in_systm.h����������������������������������������������������������������������������������0000644�����������������00000002726�14763166030�0010245 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* System specific type definitions for networking code. Copyright (C) 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _NETINET_IN_SYSTM_H #define _NETINET_IN_SYSTM_H 1 #include <sys/cdefs.h> #include <sys/types.h> __BEGIN_DECLS /* * Network order versions of various data types. Unfortunately, BSD * assumes specific sizes for shorts (16 bit) and longs (32 bit) which * don't hold in general. As a consequence, the network order versions * may not reflect the actual size of the native data types. */ typedef u_int16_t n_short; /* short as received from the net */ typedef u_int32_t n_long; /* long as received from the net */ typedef u_int32_t n_time; /* ms since 00:00 GMT, byte rev */ __END_DECLS #endif /* netinet/in_systm.h */ ������������������������������������������gdcache.h�������������������������������������������������������������������������������������������0000644�����������������00000005374�14763166030�0006312 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifdef __cplusplus extern "C" { #endif /* * gdcache.h * * Caches of pointers to user structs in which the least-recently-used * element is replaced in the event of a cache miss after the cache has * reached a given size. * * John Ellson (ellson@graphviz.org) Oct 31, 1997 * * Test this with: * gcc -o gdcache -g -Wall -DTEST gdcache.c * * The cache is implemented by a singly-linked list of elements * each containing a pointer to a user struct that is being managed by * the cache. * * The head structure has a pointer to the most-recently-used * element, and elements are moved to this position in the list each * time they are used. The head also contains pointers to three * user defined functions: * - a function to test if a cached userdata matches some keydata * - a function to provide a new userdata struct to the cache * if there has been a cache miss. * - a function to release a userdata struct when it is * no longer being managed by the cache * * In the event of a cache miss the cache is allowed to grow up to * a specified maximum size. After the maximum size is reached then * the least-recently-used element is discarded to make room for the * new. The most-recently-returned value is always left at the * beginning of the list after retrieval. * * In the current implementation the cache is traversed by a linear * search from most-recent to least-recent. This linear search * probably limits the usefulness of this implementation to cache * sizes of a few tens of elements. */ /*********************************************************/ /* header */ /*********************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <stdlib.h> #ifndef NULL #define NULL (void *)0 #endif /* user defined function templates */ typedef int (*gdCacheTestFn_t) (void *userdata, void *keydata); typedef void *(*gdCacheFetchFn_t) (char **error, void *keydata); typedef void (*gdCacheReleaseFn_t) (void *userdata); /* element structure */ typedef struct gdCache_element_s gdCache_element_t; struct gdCache_element_s { gdCache_element_t *next; void *userdata; }; /* head structure */ typedef struct gdCache_head_s gdCache_head_t; struct gdCache_head_s { gdCache_element_t *mru; int size; char *error; gdCacheTestFn_t gdCacheTest; gdCacheFetchFn_t gdCacheFetch; gdCacheReleaseFn_t gdCacheRelease; }; /* function templates */ gdCache_head_t *gdCacheCreate (int size, gdCacheTestFn_t gdCacheTest, gdCacheFetchFn_t gdCacheFetch, gdCacheReleaseFn_t gdCacheRelease); void gdCacheDelete (gdCache_head_t * head); void *gdCacheGet (gdCache_head_t * head, void *keydata); #ifdef __cplusplus } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������elf.h�����������������������������������������������������������������������������������������������0000644�����������������00000432015�14763166030�0005476 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* This file defines standard ELF types, structures, and macros. Copyright (C) 1995-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ELF_H #define _ELF_H 1 #include <features.h> __BEGIN_DECLS /* Standard ELF types. */ #include <stdint.h> /* Type for a 16-bit quantity. */ typedef uint16_t Elf32_Half; typedef uint16_t Elf64_Half; /* Types for signed and unsigned 32-bit quantities. */ typedef uint32_t Elf32_Word; typedef int32_t Elf32_Sword; typedef uint32_t Elf64_Word; typedef int32_t Elf64_Sword; /* Types for signed and unsigned 64-bit quantities. */ typedef uint64_t Elf32_Xword; typedef int64_t Elf32_Sxword; typedef uint64_t Elf64_Xword; typedef int64_t Elf64_Sxword; /* Type of addresses. */ typedef uint32_t Elf32_Addr; typedef uint64_t Elf64_Addr; /* Type of file offsets. */ typedef uint32_t Elf32_Off; typedef uint64_t Elf64_Off; /* Type for section indices, which are 16-bit quantities. */ typedef uint16_t Elf32_Section; typedef uint16_t Elf64_Section; /* Type for version symbol information. */ typedef Elf32_Half Elf32_Versym; typedef Elf64_Half Elf64_Versym; /* The ELF file header. This appears at the start of every ELF file. */ #define EI_NIDENT (16) typedef struct { unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ Elf32_Half e_type; /* Object file type */ Elf32_Half e_machine; /* Architecture */ Elf32_Word e_version; /* Object file version */ Elf32_Addr e_entry; /* Entry point virtual address */ Elf32_Off e_phoff; /* Program header table file offset */ Elf32_Off e_shoff; /* Section header table file offset */ Elf32_Word e_flags; /* Processor-specific flags */ Elf32_Half e_ehsize; /* ELF header size in bytes */ Elf32_Half e_phentsize; /* Program header table entry size */ Elf32_Half e_phnum; /* Program header table entry count */ Elf32_Half e_shentsize; /* Section header table entry size */ Elf32_Half e_shnum; /* Section header table entry count */ Elf32_Half e_shstrndx; /* Section header string table index */ } Elf32_Ehdr; typedef struct { unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ Elf64_Half e_type; /* Object file type */ Elf64_Half e_machine; /* Architecture */ Elf64_Word e_version; /* Object file version */ Elf64_Addr e_entry; /* Entry point virtual address */ Elf64_Off e_phoff; /* Program header table file offset */ Elf64_Off e_shoff; /* Section header table file offset */ Elf64_Word e_flags; /* Processor-specific flags */ Elf64_Half e_ehsize; /* ELF header size in bytes */ Elf64_Half e_phentsize; /* Program header table entry size */ Elf64_Half e_phnum; /* Program header table entry count */ Elf64_Half e_shentsize; /* Section header table entry size */ Elf64_Half e_shnum; /* Section header table entry count */ Elf64_Half e_shstrndx; /* Section header string table index */ } Elf64_Ehdr; /* Fields in the e_ident array. The EI_* macros are indices into the array. The macros under each EI_* macro are the values the byte may have. */ #define EI_MAG0 0 /* File identification byte 0 index */ #define ELFMAG0 0x7f /* Magic number byte 0 */ #define EI_MAG1 1 /* File identification byte 1 index */ #define ELFMAG1 'E' /* Magic number byte 1 */ #define EI_MAG2 2 /* File identification byte 2 index */ #define ELFMAG2 'L' /* Magic number byte 2 */ #define EI_MAG3 3 /* File identification byte 3 index */ #define ELFMAG3 'F' /* Magic number byte 3 */ /* Conglomeration of the identification bytes, for easy testing as a word. */ #define ELFMAG "\177ELF" #define SELFMAG 4 #define EI_CLASS 4 /* File class byte index */ #define ELFCLASSNONE 0 /* Invalid class */ #define ELFCLASS32 1 /* 32-bit objects */ #define ELFCLASS64 2 /* 64-bit objects */ #define ELFCLASSNUM 3 #define EI_DATA 5 /* Data encoding byte index */ #define ELFDATANONE 0 /* Invalid data encoding */ #define ELFDATA2LSB 1 /* 2's complement, little endian */ #define ELFDATA2MSB 2 /* 2's complement, big endian */ #define ELFDATANUM 3 #define EI_VERSION 6 /* File version byte index */ /* Value must be EV_CURRENT */ #define EI_OSABI 7 /* OS ABI identification */ #define ELFOSABI_NONE 0 /* UNIX System V ABI */ #define ELFOSABI_SYSV 0 /* Alias. */ #define ELFOSABI_HPUX 1 /* HP-UX */ #define ELFOSABI_NETBSD 2 /* NetBSD. */ #define ELFOSABI_GNU 3 /* Object uses GNU ELF extensions. */ #define ELFOSABI_LINUX ELFOSABI_GNU /* Compatibility alias. */ #define ELFOSABI_SOLARIS 6 /* Sun Solaris. */ #define ELFOSABI_AIX 7 /* IBM AIX. */ #define ELFOSABI_IRIX 8 /* SGI Irix. */ #define ELFOSABI_FREEBSD 9 /* FreeBSD. */ #define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */ #define ELFOSABI_MODESTO 11 /* Novell Modesto. */ #define ELFOSABI_OPENBSD 12 /* OpenBSD. */ #define ELFOSABI_ARM_AEABI 64 /* ARM EABI */ #define ELFOSABI_ARM 97 /* ARM */ #define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ #define EI_ABIVERSION 8 /* ABI version */ #define EI_PAD 9 /* Byte index of padding bytes */ /* Legal values for e_type (object file type). */ #define ET_NONE 0 /* No file type */ #define ET_REL 1 /* Relocatable file */ #define ET_EXEC 2 /* Executable file */ #define ET_DYN 3 /* Shared object file */ #define ET_CORE 4 /* Core file */ #define ET_NUM 5 /* Number of defined types */ #define ET_LOOS 0xfe00 /* OS-specific range start */ #define ET_HIOS 0xfeff /* OS-specific range end */ #define ET_LOPROC 0xff00 /* Processor-specific range start */ #define ET_HIPROC 0xffff /* Processor-specific range end */ /* Legal values for e_machine (architecture). */ #define EM_NONE 0 /* No machine */ #define EM_M32 1 /* AT&T WE 32100 */ #define EM_SPARC 2 /* SUN SPARC */ #define EM_386 3 /* Intel 80386 */ #define EM_68K 4 /* Motorola m68k family */ #define EM_88K 5 /* Motorola m88k family */ #define EM_860 7 /* Intel 80860 */ #define EM_MIPS 8 /* MIPS R3000 big-endian */ #define EM_S370 9 /* IBM System/370 */ #define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ #define EM_PARISC 15 /* HPPA */ #define EM_VPP500 17 /* Fujitsu VPP500 */ #define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ #define EM_960 19 /* Intel 80960 */ #define EM_PPC 20 /* PowerPC */ #define EM_PPC64 21 /* PowerPC 64-bit */ #define EM_S390 22 /* IBM S390 */ #define EM_V800 36 /* NEC V800 series */ #define EM_FR20 37 /* Fujitsu FR20 */ #define EM_RH32 38 /* TRW RH-32 */ #define EM_RCE 39 /* Motorola RCE */ #define EM_ARM 40 /* ARM */ #define EM_FAKE_ALPHA 41 /* Digital Alpha */ #define EM_SH 42 /* Hitachi SH */ #define EM_SPARCV9 43 /* SPARC v9 64-bit */ #define EM_TRICORE 44 /* Siemens Tricore */ #define EM_ARC 45 /* Argonaut RISC Core */ #define EM_H8_300 46 /* Hitachi H8/300 */ #define EM_H8_300H 47 /* Hitachi H8/300H */ #define EM_H8S 48 /* Hitachi H8S */ #define EM_H8_500 49 /* Hitachi H8/500 */ #define EM_IA_64 50 /* Intel Merced */ #define EM_MIPS_X 51 /* Stanford MIPS-X */ #define EM_COLDFIRE 52 /* Motorola Coldfire */ #define EM_68HC12 53 /* Motorola M68HC12 */ #define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/ #define EM_PCP 55 /* Siemens PCP */ #define EM_NCPU 56 /* Sony nCPU embeeded RISC */ #define EM_NDR1 57 /* Denso NDR1 microprocessor */ #define EM_STARCORE 58 /* Motorola Start*Core processor */ #define EM_ME16 59 /* Toyota ME16 processor */ #define EM_ST100 60 /* STMicroelectronic ST100 processor */ #define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/ #define EM_X86_64 62 /* AMD x86-64 architecture */ #define EM_PDSP 63 /* Sony DSP Processor */ #define EM_FX66 66 /* Siemens FX66 microcontroller */ #define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ #define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ #define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ #define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ #define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ #define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ #define EM_SVX 73 /* Silicon Graphics SVx */ #define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */ #define EM_VAX 75 /* Digital VAX */ #define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ #define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded processor */ #define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ #define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ #define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */ #define EM_HUANY 81 /* Harvard University machine-independent object files */ #define EM_PRISM 82 /* SiTera Prism */ #define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ #define EM_FR30 84 /* Fujitsu FR30 */ #define EM_D10V 85 /* Mitsubishi D10V */ #define EM_D30V 86 /* Mitsubishi D30V */ #define EM_V850 87 /* NEC v850 */ #define EM_M32R 88 /* Mitsubishi M32R */ #define EM_MN10300 89 /* Matsushita MN10300 */ #define EM_MN10200 90 /* Matsushita MN10200 */ #define EM_PJ 91 /* picoJava */ #define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ #define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */ #define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ #define EM_AARCH64 183 /* ARM AARCH64 */ #define EM_TILEPRO 188 /* Tilera TILEPro */ #define EM_TILEGX 191 /* Tilera TILE-Gx */ #define EM_NUM 192 /* If it is necessary to assign new unofficial EM_* values, please pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision with official or non-GNU unofficial values. */ #define EM_ALPHA 0x9026 /* Legal values for e_version (version). */ #define EV_NONE 0 /* Invalid ELF version */ #define EV_CURRENT 1 /* Current version */ #define EV_NUM 2 /* Section header. */ typedef struct { Elf32_Word sh_name; /* Section name (string tbl index) */ Elf32_Word sh_type; /* Section type */ Elf32_Word sh_flags; /* Section flags */ Elf32_Addr sh_addr; /* Section virtual addr at execution */ Elf32_Off sh_offset; /* Section file offset */ Elf32_Word sh_size; /* Section size in bytes */ Elf32_Word sh_link; /* Link to another section */ Elf32_Word sh_info; /* Additional section information */ Elf32_Word sh_addralign; /* Section alignment */ Elf32_Word sh_entsize; /* Entry size if section holds table */ } Elf32_Shdr; typedef struct { Elf64_Word sh_name; /* Section name (string tbl index) */ Elf64_Word sh_type; /* Section type */ Elf64_Xword sh_flags; /* Section flags */ Elf64_Addr sh_addr; /* Section virtual addr at execution */ Elf64_Off sh_offset; /* Section file offset */ Elf64_Xword sh_size; /* Section size in bytes */ Elf64_Word sh_link; /* Link to another section */ Elf64_Word sh_info; /* Additional section information */ Elf64_Xword sh_addralign; /* Section alignment */ Elf64_Xword sh_entsize; /* Entry size if section holds table */ } Elf64_Shdr; /* Special section indices. */ #define SHN_UNDEF 0 /* Undefined section */ #define SHN_LORESERVE 0xff00 /* Start of reserved indices */ #define SHN_LOPROC 0xff00 /* Start of processor-specific */ #define SHN_BEFORE 0xff00 /* Order section before all others (Solaris). */ #define SHN_AFTER 0xff01 /* Order section after all others (Solaris). */ #define SHN_HIPROC 0xff1f /* End of processor-specific */ #define SHN_LOOS 0xff20 /* Start of OS-specific */ #define SHN_HIOS 0xff3f /* End of OS-specific */ #define SHN_ABS 0xfff1 /* Associated symbol is absolute */ #define SHN_COMMON 0xfff2 /* Associated symbol is common */ #define SHN_XINDEX 0xffff /* Index is in extra table. */ #define SHN_HIRESERVE 0xffff /* End of reserved indices */ /* Legal values for sh_type (section type). */ #define SHT_NULL 0 /* Section header table entry unused */ #define SHT_PROGBITS 1 /* Program data */ #define SHT_SYMTAB 2 /* Symbol table */ #define SHT_STRTAB 3 /* String table */ #define SHT_RELA 4 /* Relocation entries with addends */ #define SHT_HASH 5 /* Symbol hash table */ #define SHT_DYNAMIC 6 /* Dynamic linking information */ #define SHT_NOTE 7 /* Notes */ #define SHT_NOBITS 8 /* Program space with no data (bss) */ #define SHT_REL 9 /* Relocation entries, no addends */ #define SHT_SHLIB 10 /* Reserved */ #define SHT_DYNSYM 11 /* Dynamic linker symbol table */ #define SHT_INIT_ARRAY 14 /* Array of constructors */ #define SHT_FINI_ARRAY 15 /* Array of destructors */ #define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ #define SHT_GROUP 17 /* Section group */ #define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ #define SHT_NUM 19 /* Number of defined types. */ #define SHT_LOOS 0x60000000 /* Start OS-specific. */ #define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */ #define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */ #define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */ #define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */ #define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */ #define SHT_SUNW_move 0x6ffffffa #define SHT_SUNW_COMDAT 0x6ffffffb #define SHT_SUNW_syminfo 0x6ffffffc #define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */ #define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */ #define SHT_GNU_versym 0x6fffffff /* Version symbol table. */ #define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */ #define SHT_HIOS 0x6fffffff /* End OS-specific type */ #define SHT_LOPROC 0x70000000 /* Start of processor-specific */ #define SHT_HIPROC 0x7fffffff /* End of processor-specific */ #define SHT_LOUSER 0x80000000 /* Start of application-specific */ #define SHT_HIUSER 0x8fffffff /* End of application-specific */ /* Legal values for sh_flags (section flags). */ #define SHF_WRITE (1 << 0) /* Writable */ #define SHF_ALLOC (1 << 1) /* Occupies memory during execution */ #define SHF_EXECINSTR (1 << 2) /* Executable */ #define SHF_MERGE (1 << 4) /* Might be merged */ #define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */ #define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */ #define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */ #define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling required */ #define SHF_GROUP (1 << 9) /* Section is member of a group. */ #define SHF_TLS (1 << 10) /* Section hold thread-local data. */ #define SHF_MASKOS 0x0ff00000 /* OS-specific. */ #define SHF_MASKPROC 0xf0000000 /* Processor-specific */ #define SHF_ORDERED (1 << 30) /* Special ordering requirement (Solaris). */ #define SHF_EXCLUDE (1 << 31) /* Section is excluded unless referenced or allocated (Solaris).*/ /* Section group handling. */ #define GRP_COMDAT 0x1 /* Mark group as COMDAT. */ /* Symbol table entry. */ typedef struct { Elf32_Word st_name; /* Symbol name (string tbl index) */ Elf32_Addr st_value; /* Symbol value */ Elf32_Word st_size; /* Symbol size */ unsigned char st_info; /* Symbol type and binding */ unsigned char st_other; /* Symbol visibility */ Elf32_Section st_shndx; /* Section index */ } Elf32_Sym; typedef struct { Elf64_Word st_name; /* Symbol name (string tbl index) */ unsigned char st_info; /* Symbol type and binding */ unsigned char st_other; /* Symbol visibility */ Elf64_Section st_shndx; /* Section index */ Elf64_Addr st_value; /* Symbol value */ Elf64_Xword st_size; /* Symbol size */ } Elf64_Sym; /* The syminfo section if available contains additional information about every dynamic symbol. */ typedef struct { Elf32_Half si_boundto; /* Direct bindings, symbol bound to */ Elf32_Half si_flags; /* Per symbol flags */ } Elf32_Syminfo; typedef struct { Elf64_Half si_boundto; /* Direct bindings, symbol bound to */ Elf64_Half si_flags; /* Per symbol flags */ } Elf64_Syminfo; /* Possible values for si_boundto. */ #define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */ #define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */ #define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */ /* Possible bitmasks for si_flags. */ #define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */ #define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */ #define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */ #define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy loaded */ /* Syminfo version values. */ #define SYMINFO_NONE 0 #define SYMINFO_CURRENT 1 #define SYMINFO_NUM 2 /* How to extract and insert information held in the st_info field. */ #define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4) #define ELF32_ST_TYPE(val) ((val) & 0xf) #define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) /* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */ #define ELF64_ST_BIND(val) ELF32_ST_BIND (val) #define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val) #define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type)) /* Legal values for ST_BIND subfield of st_info (symbol binding). */ #define STB_LOCAL 0 /* Local symbol */ #define STB_GLOBAL 1 /* Global symbol */ #define STB_WEAK 2 /* Weak symbol */ #define STB_NUM 3 /* Number of defined types. */ #define STB_LOOS 10 /* Start of OS-specific */ #define STB_GNU_UNIQUE 10 /* Unique symbol. */ #define STB_HIOS 12 /* End of OS-specific */ #define STB_LOPROC 13 /* Start of processor-specific */ #define STB_HIPROC 15 /* End of processor-specific */ /* Legal values for ST_TYPE subfield of st_info (symbol type). */ #define STT_NOTYPE 0 /* Symbol type is unspecified */ #define STT_OBJECT 1 /* Symbol is a data object */ #define STT_FUNC 2 /* Symbol is a code object */ #define STT_SECTION 3 /* Symbol associated with a section */ #define STT_FILE 4 /* Symbol's name is file name */ #define STT_COMMON 5 /* Symbol is a common data object */ #define STT_TLS 6 /* Symbol is thread-local data object*/ #define STT_NUM 7 /* Number of defined types. */ #define STT_LOOS 10 /* Start of OS-specific */ #define STT_GNU_IFUNC 10 /* Symbol is indirect code object */ #define STT_HIOS 12 /* End of OS-specific */ #define STT_LOPROC 13 /* Start of processor-specific */ #define STT_HIPROC 15 /* End of processor-specific */ /* Symbol table indices are found in the hash buckets and chain table of a symbol hash table section. This special index value indicates the end of a chain, meaning no further symbols are found in that bucket. */ #define STN_UNDEF 0 /* End of a chain. */ /* How to extract and insert information held in the st_other field. */ #define ELF32_ST_VISIBILITY(o) ((o) & 0x03) /* For ELF64 the definitions are the same. */ #define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o) /* Symbol visibility specification encoded in the st_other field. */ #define STV_DEFAULT 0 /* Default symbol visibility rules */ #define STV_INTERNAL 1 /* Processor specific hidden class */ #define STV_HIDDEN 2 /* Sym unavailable in other modules */ #define STV_PROTECTED 3 /* Not preemptible, not exported */ /* Relocation table entry without addend (in section of type SHT_REL). */ typedef struct { Elf32_Addr r_offset; /* Address */ Elf32_Word r_info; /* Relocation type and symbol index */ } Elf32_Rel; /* I have seen two different definitions of the Elf64_Rel and Elf64_Rela structures, so we'll leave them out until Novell (or whoever) gets their act together. */ /* The following, at least, is used on Sparc v9, MIPS, and Alpha. */ typedef struct { Elf64_Addr r_offset; /* Address */ Elf64_Xword r_info; /* Relocation type and symbol index */ } Elf64_Rel; /* Relocation table entry with addend (in section of type SHT_RELA). */ typedef struct { Elf32_Addr r_offset; /* Address */ Elf32_Word r_info; /* Relocation type and symbol index */ Elf32_Sword r_addend; /* Addend */ } Elf32_Rela; typedef struct { Elf64_Addr r_offset; /* Address */ Elf64_Xword r_info; /* Relocation type and symbol index */ Elf64_Sxword r_addend; /* Addend */ } Elf64_Rela; /* How to extract and insert information held in the r_info field. */ #define ELF32_R_SYM(val) ((val) >> 8) #define ELF32_R_TYPE(val) ((val) & 0xff) #define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff)) #define ELF64_R_SYM(i) ((i) >> 32) #define ELF64_R_TYPE(i) ((i) & 0xffffffff) #define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type)) /* Program segment header. */ typedef struct { Elf32_Word p_type; /* Segment type */ Elf32_Off p_offset; /* Segment file offset */ Elf32_Addr p_vaddr; /* Segment virtual address */ Elf32_Addr p_paddr; /* Segment physical address */ Elf32_Word p_filesz; /* Segment size in file */ Elf32_Word p_memsz; /* Segment size in memory */ Elf32_Word p_flags; /* Segment flags */ Elf32_Word p_align; /* Segment alignment */ } Elf32_Phdr; typedef struct { Elf64_Word p_type; /* Segment type */ Elf64_Word p_flags; /* Segment flags */ Elf64_Off p_offset; /* Segment file offset */ Elf64_Addr p_vaddr; /* Segment virtual address */ Elf64_Addr p_paddr; /* Segment physical address */ Elf64_Xword p_filesz; /* Segment size in file */ Elf64_Xword p_memsz; /* Segment size in memory */ Elf64_Xword p_align; /* Segment alignment */ } Elf64_Phdr; /* Special value for e_phnum. This indicates that the real number of program headers is too large to fit into e_phnum. Instead the real value is in the field sh_info of section 0. */ #define PN_XNUM 0xffff /* Legal values for p_type (segment type). */ #define PT_NULL 0 /* Program header table entry unused */ #define PT_LOAD 1 /* Loadable program segment */ #define PT_DYNAMIC 2 /* Dynamic linking information */ #define PT_INTERP 3 /* Program interpreter */ #define PT_NOTE 4 /* Auxiliary information */ #define PT_SHLIB 5 /* Reserved */ #define PT_PHDR 6 /* Entry for header table itself */ #define PT_TLS 7 /* Thread-local storage segment */ #define PT_NUM 8 /* Number of defined types */ #define PT_LOOS 0x60000000 /* Start of OS-specific */ #define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */ #define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */ #define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */ #define PT_LOSUNW 0x6ffffffa #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ #define PT_SUNWSTACK 0x6ffffffb /* Stack segment */ #define PT_HISUNW 0x6fffffff #define PT_HIOS 0x6fffffff /* End of OS-specific */ #define PT_LOPROC 0x70000000 /* Start of processor-specific */ #define PT_HIPROC 0x7fffffff /* End of processor-specific */ /* Legal values for p_flags (segment flags). */ #define PF_X (1 << 0) /* Segment is executable */ #define PF_W (1 << 1) /* Segment is writable */ #define PF_R (1 << 2) /* Segment is readable */ #define PF_MASKOS 0x0ff00000 /* OS-specific */ #define PF_MASKPROC 0xf0000000 /* Processor-specific */ /* Legal values for note segment descriptor types for core files. */ #define NT_PRSTATUS 1 /* Contains copy of prstatus struct */ #define NT_FPREGSET 2 /* Contains copy of fpregset struct */ #define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */ #define NT_PRXREG 4 /* Contains copy of prxregset struct */ #define NT_TASKSTRUCT 4 /* Contains copy of task structure */ #define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */ #define NT_AUXV 6 /* Contains copy of auxv array */ #define NT_GWINDOWS 7 /* Contains copy of gwindows struct */ #define NT_ASRS 8 /* Contains copy of asrset struct */ #define NT_PSTATUS 10 /* Contains copy of pstatus struct */ #define NT_PSINFO 13 /* Contains copy of psinfo struct */ #define NT_PRCRED 14 /* Contains copy of prcred struct */ #define NT_UTSNAME 15 /* Contains copy of utsname struct */ #define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */ #define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */ #define NT_PRFPXREG 20 /* Contains copy of fprxregset struct */ #define NT_PRXFPREG 0x46e62b7f /* Contains copy of user_fxsr_struct */ #define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ #define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ #define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */ #define NT_S390_TIMER 0x301 /* s390 timer register */ #define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */ #define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */ #define NT_S390_CTRS 0x304 /* s390 control registers */ #define NT_S390_PREFIX 0x305 /* s390 prefix register */ #define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */ #define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */ #define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */ #define NT_ARM_TLS 0x401 /* ARM TLS register */ #define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */ #define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */ /* Legal values for the note segment descriptor types for object files. */ #define NT_VERSION 1 /* Contains a version string. */ /* Dynamic section entry. */ typedef struct { Elf32_Sword d_tag; /* Dynamic entry type */ union { Elf32_Word d_val; /* Integer value */ Elf32_Addr d_ptr; /* Address value */ } d_un; } Elf32_Dyn; typedef struct { Elf64_Sxword d_tag; /* Dynamic entry type */ union { Elf64_Xword d_val; /* Integer value */ Elf64_Addr d_ptr; /* Address value */ } d_un; } Elf64_Dyn; /* Legal values for d_tag (dynamic entry type). */ #define DT_NULL 0 /* Marks end of dynamic section */ #define DT_NEEDED 1 /* Name of needed library */ #define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */ #define DT_PLTGOT 3 /* Processor defined value */ #define DT_HASH 4 /* Address of symbol hash table */ #define DT_STRTAB 5 /* Address of string table */ #define DT_SYMTAB 6 /* Address of symbol table */ #define DT_RELA 7 /* Address of Rela relocs */ #define DT_RELASZ 8 /* Total size of Rela relocs */ #define DT_RELAENT 9 /* Size of one Rela reloc */ #define DT_STRSZ 10 /* Size of string table */ #define DT_SYMENT 11 /* Size of one symbol table entry */ #define DT_INIT 12 /* Address of init function */ #define DT_FINI 13 /* Address of termination function */ #define DT_SONAME 14 /* Name of shared object */ #define DT_RPATH 15 /* Library search path (deprecated) */ #define DT_SYMBOLIC 16 /* Start symbol search here */ #define DT_REL 17 /* Address of Rel relocs */ #define DT_RELSZ 18 /* Total size of Rel relocs */ #define DT_RELENT 19 /* Size of one Rel reloc */ #define DT_PLTREL 20 /* Type of reloc in PLT */ #define DT_DEBUG 21 /* For debugging; unspecified */ #define DT_TEXTREL 22 /* Reloc might modify .text */ #define DT_JMPREL 23 /* Address of PLT relocs */ #define DT_BIND_NOW 24 /* Process relocations of object */ #define DT_INIT_ARRAY 25 /* Array with addresses of init fct */ #define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */ #define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */ #define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */ #define DT_RUNPATH 29 /* Library search path */ #define DT_FLAGS 30 /* Flags for the object being loaded */ #define DT_ENCODING 32 /* Start of encoded range */ #define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ #define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ #define DT_NUM 34 /* Number used */ #define DT_LOOS 0x6000000d /* Start of OS-specific */ #define DT_HIOS 0x6ffff000 /* End of OS-specific */ #define DT_LOPROC 0x70000000 /* Start of processor-specific */ #define DT_HIPROC 0x7fffffff /* End of processor-specific */ #define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */ /* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's approach. */ #define DT_VALRNGLO 0x6ffffd00 #define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */ #define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */ #define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */ #define DT_CHECKSUM 0x6ffffdf8 #define DT_PLTPADSZ 0x6ffffdf9 #define DT_MOVEENT 0x6ffffdfa #define DT_MOVESZ 0x6ffffdfb #define DT_FEATURE_1 0x6ffffdfc /* Feature selection (DTF_*). */ #define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting the following DT_* entry. */ #define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */ #define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */ #define DT_VALRNGHI 0x6ffffdff #define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */ #define DT_VALNUM 12 /* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the Dyn.d_un.d_ptr field of the Elf*_Dyn structure. If any adjustment is made to the ELF object after it has been built these entries will need to be adjusted. */ #define DT_ADDRRNGLO 0x6ffffe00 #define DT_GNU_HASH 0x6ffffef5 /* GNU-style hash table. */ #define DT_TLSDESC_PLT 0x6ffffef6 #define DT_TLSDESC_GOT 0x6ffffef7 #define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */ #define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */ #define DT_CONFIG 0x6ffffefa /* Configuration information. */ #define DT_DEPAUDIT 0x6ffffefb /* Dependency auditing. */ #define DT_AUDIT 0x6ffffefc /* Object auditing. */ #define DT_PLTPAD 0x6ffffefd /* PLT padding. */ #define DT_MOVETAB 0x6ffffefe /* Move table. */ #define DT_SYMINFO 0x6ffffeff /* Syminfo table. */ #define DT_ADDRRNGHI 0x6ffffeff #define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */ #define DT_ADDRNUM 11 /* The versioning entry types. The next are defined as part of the GNU extension. */ #define DT_VERSYM 0x6ffffff0 #define DT_RELACOUNT 0x6ffffff9 #define DT_RELCOUNT 0x6ffffffa /* These were chosen by Sun. */ #define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */ #define DT_VERDEF 0x6ffffffc /* Address of version definition table */ #define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */ #define DT_VERNEED 0x6ffffffe /* Address of table with needed versions */ #define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */ #define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */ #define DT_VERSIONTAGNUM 16 /* Sun added these machine-independent extensions in the "processor-specific" range. Be compatible. */ #define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */ #define DT_FILTER 0x7fffffff /* Shared object to get values from */ #define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1) #define DT_EXTRANUM 3 /* Values of `d_un.d_val' in the DT_FLAGS entry. */ #define DF_ORIGIN 0x00000001 /* Object may use DF_ORIGIN */ #define DF_SYMBOLIC 0x00000002 /* Symbol resolutions starts here */ #define DF_TEXTREL 0x00000004 /* Object contains text relocations */ #define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */ #define DF_STATIC_TLS 0x00000010 /* Module uses the static TLS model */ /* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1 entry in the dynamic section. */ #define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */ #define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */ #define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */ #define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/ #define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/ #define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/ #define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */ #define DF_1_ORIGIN 0x00000080 /* $ORIGIN must be handled. */ #define DF_1_DIRECT 0x00000100 /* Direct binding enabled. */ #define DF_1_TRANS 0x00000200 #define DF_1_INTERPOSE 0x00000400 /* Object is used to interpose. */ #define DF_1_NODEFLIB 0x00000800 /* Ignore default lib search path. */ #define DF_1_NODUMP 0x00001000 /* Object can't be dldump'ed. */ #define DF_1_CONFALT 0x00002000 /* Configuration alternative created.*/ #define DF_1_ENDFILTEE 0x00004000 /* Filtee terminates filters search. */ #define DF_1_DISPRELDNE 0x00008000 /* Disp reloc applied at build time. */ #define DF_1_DISPRELPND 0x00010000 /* Disp reloc applied at run-time. */ #define DF_1_NODIRECT 0x00020000 /* Object has no-direct binding. */ #define DF_1_IGNMULDEF 0x00040000 #define DF_1_NOKSYMS 0x00080000 #define DF_1_NOHDR 0x00100000 #define DF_1_EDITED 0x00200000 /* Object is modified after built. */ #define DF_1_NORELOC 0x00400000 #define DF_1_SYMINTPOSE 0x00800000 /* Object has individual interposers. */ #define DF_1_GLOBAUDIT 0x01000000 /* Global auditin required. */ #define DF_1_SINGLETON 0x02000000 /* Singleton symbols are used. */ /* Flags for the feature selection in DT_FEATURE_1. */ #define DTF_1_PARINIT 0x00000001 #define DTF_1_CONFEXP 0x00000002 /* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. */ #define DF_P1_LAZYLOAD 0x00000001 /* Lazyload following object. */ #define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not generally available. */ /* Version definition sections. */ typedef struct { Elf32_Half vd_version; /* Version revision */ Elf32_Half vd_flags; /* Version information */ Elf32_Half vd_ndx; /* Version Index */ Elf32_Half vd_cnt; /* Number of associated aux entries */ Elf32_Word vd_hash; /* Version name hash value */ Elf32_Word vd_aux; /* Offset in bytes to verdaux array */ Elf32_Word vd_next; /* Offset in bytes to next verdef entry */ } Elf32_Verdef; typedef struct { Elf64_Half vd_version; /* Version revision */ Elf64_Half vd_flags; /* Version information */ Elf64_Half vd_ndx; /* Version Index */ Elf64_Half vd_cnt; /* Number of associated aux entries */ Elf64_Word vd_hash; /* Version name hash value */ Elf64_Word vd_aux; /* Offset in bytes to verdaux array */ Elf64_Word vd_next; /* Offset in bytes to next verdef entry */ } Elf64_Verdef; /* Legal values for vd_version (version revision). */ #define VER_DEF_NONE 0 /* No version */ #define VER_DEF_CURRENT 1 /* Current version */ #define VER_DEF_NUM 2 /* Given version number */ /* Legal values for vd_flags (version information flags). */ #define VER_FLG_BASE 0x1 /* Version definition of file itself */ #define VER_FLG_WEAK 0x2 /* Weak version identifier */ /* Versym symbol index values. */ #define VER_NDX_LOCAL 0 /* Symbol is local. */ #define VER_NDX_GLOBAL 1 /* Symbol is global. */ #define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */ #define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */ /* Auxialiary version information. */ typedef struct { Elf32_Word vda_name; /* Version or dependency names */ Elf32_Word vda_next; /* Offset in bytes to next verdaux entry */ } Elf32_Verdaux; typedef struct { Elf64_Word vda_name; /* Version or dependency names */ Elf64_Word vda_next; /* Offset in bytes to next verdaux entry */ } Elf64_Verdaux; /* Version dependency section. */ typedef struct { Elf32_Half vn_version; /* Version of structure */ Elf32_Half vn_cnt; /* Number of associated aux entries */ Elf32_Word vn_file; /* Offset of filename for this dependency */ Elf32_Word vn_aux; /* Offset in bytes to vernaux array */ Elf32_Word vn_next; /* Offset in bytes to next verneed entry */ } Elf32_Verneed; typedef struct { Elf64_Half vn_version; /* Version of structure */ Elf64_Half vn_cnt; /* Number of associated aux entries */ Elf64_Word vn_file; /* Offset of filename for this dependency */ Elf64_Word vn_aux; /* Offset in bytes to vernaux array */ Elf64_Word vn_next; /* Offset in bytes to next verneed entry */ } Elf64_Verneed; /* Legal values for vn_version (version revision). */ #define VER_NEED_NONE 0 /* No version */ #define VER_NEED_CURRENT 1 /* Current version */ #define VER_NEED_NUM 2 /* Given version number */ /* Auxiliary needed version information. */ typedef struct { Elf32_Word vna_hash; /* Hash value of dependency name */ Elf32_Half vna_flags; /* Dependency specific information */ Elf32_Half vna_other; /* Unused */ Elf32_Word vna_name; /* Dependency name string offset */ Elf32_Word vna_next; /* Offset in bytes to next vernaux entry */ } Elf32_Vernaux; typedef struct { Elf64_Word vna_hash; /* Hash value of dependency name */ Elf64_Half vna_flags; /* Dependency specific information */ Elf64_Half vna_other; /* Unused */ Elf64_Word vna_name; /* Dependency name string offset */ Elf64_Word vna_next; /* Offset in bytes to next vernaux entry */ } Elf64_Vernaux; /* Legal values for vna_flags. */ #define VER_FLG_WEAK 0x2 /* Weak version identifier */ /* Auxiliary vector. */ /* This vector is normally only used by the program interpreter. The usual definition in an ABI supplement uses the name auxv_t. The vector is not usually defined in a standard <elf.h> file, but it can't hurt. We rename it to avoid conflicts. The sizes of these types are an arrangement between the exec server and the program interpreter, so we don't fully specify them here. */ typedef struct { uint32_t a_type; /* Entry type */ union { uint32_t a_val; /* Integer value */ /* We use to have pointer elements added here. We cannot do that, though, since it does not work when using 32-bit definitions on 64-bit platforms and vice versa. */ } a_un; } Elf32_auxv_t; typedef struct { uint64_t a_type; /* Entry type */ union { uint64_t a_val; /* Integer value */ /* We use to have pointer elements added here. We cannot do that, though, since it does not work when using 32-bit definitions on 64-bit platforms and vice versa. */ } a_un; } Elf64_auxv_t; /* Legal values for a_type (entry type). */ #define AT_NULL 0 /* End of vector */ #define AT_IGNORE 1 /* Entry should be ignored */ #define AT_EXECFD 2 /* File descriptor of program */ #define AT_PHDR 3 /* Program headers for program */ #define AT_PHENT 4 /* Size of program header entry */ #define AT_PHNUM 5 /* Number of program headers */ #define AT_PAGESZ 6 /* System page size */ #define AT_BASE 7 /* Base address of interpreter */ #define AT_FLAGS 8 /* Flags */ #define AT_ENTRY 9 /* Entry point of program */ #define AT_NOTELF 10 /* Program is not ELF */ #define AT_UID 11 /* Real uid */ #define AT_EUID 12 /* Effective uid */ #define AT_GID 13 /* Real gid */ #define AT_EGID 14 /* Effective gid */ #define AT_CLKTCK 17 /* Frequency of times() */ /* Some more special a_type values describing the hardware. */ #define AT_PLATFORM 15 /* String identifying platform. */ #define AT_HWCAP 16 /* Machine-dependent hints about processor capabilities. */ /* This entry gives some information about the FPU initialization performed by the kernel. */ #define AT_FPUCW 18 /* Used FPU control word. */ /* Cache block sizes. */ #define AT_DCACHEBSIZE 19 /* Data cache block size. */ #define AT_ICACHEBSIZE 20 /* Instruction cache block size. */ #define AT_UCACHEBSIZE 21 /* Unified cache block size. */ /* A special ignored value for PPC, used by the kernel to control the interpretation of the AUXV. Must be > 16. */ #define AT_IGNOREPPC 22 /* Entry should be ignored. */ #define AT_SECURE 23 /* Boolean, was exec setuid-like? */ #define AT_BASE_PLATFORM 24 /* String identifying real platforms.*/ #define AT_RANDOM 25 /* Address of 16 random bytes. */ #define AT_HWCAP2 26 /* More machine-dependent hints about processor capabilities. */ #define AT_EXECFN 31 /* Filename of executable. */ /* Pointer to the global system page used for system calls and other nice things. */ #define AT_SYSINFO 32 #define AT_SYSINFO_EHDR 33 /* Shapes of the caches. Bits 0-3 contains associativity; bits 4-7 contains log2 of line size; mask those to get cache size. */ #define AT_L1I_CACHESHAPE 34 #define AT_L1D_CACHESHAPE 35 #define AT_L2_CACHESHAPE 36 #define AT_L3_CACHESHAPE 37 /* Note section contents. Each entry in the note section begins with a header of a fixed form. */ typedef struct { Elf32_Word n_namesz; /* Length of the note's name. */ Elf32_Word n_descsz; /* Length of the note's descriptor. */ Elf32_Word n_type; /* Type of the note. */ } Elf32_Nhdr; typedef struct { Elf64_Word n_namesz; /* Length of the note's name. */ Elf64_Word n_descsz; /* Length of the note's descriptor. */ Elf64_Word n_type; /* Type of the note. */ } Elf64_Nhdr; /* Known names of notes. */ /* Solaris entries in the note section have this name. */ #define ELF_NOTE_SOLARIS "SUNW Solaris" /* Note entries for GNU systems have this name. */ #define ELF_NOTE_GNU "GNU" /* Defined types of notes for Solaris. */ /* Value of descriptor (one word) is desired pagesize for the binary. */ #define ELF_NOTE_PAGESIZE_HINT 1 /* Defined note types for GNU systems. */ /* ABI information. The descriptor consists of words: word 0: OS descriptor word 1: major version of the ABI word 2: minor version of the ABI word 3: subminor version of the ABI */ #define NT_GNU_ABI_TAG 1 #define ELF_NOTE_ABI NT_GNU_ABI_TAG /* Old name. */ /* Known OSes. These values can appear in word 0 of an NT_GNU_ABI_TAG note section entry. */ #define ELF_NOTE_OS_LINUX 0 #define ELF_NOTE_OS_GNU 1 #define ELF_NOTE_OS_SOLARIS2 2 #define ELF_NOTE_OS_FREEBSD 3 /* Synthetic hwcap information. The descriptor begins with two words: word 0: number of entries word 1: bitmask of enabled entries Then follow variable-length entries, one byte followed by a '\0'-terminated hwcap name string. The byte gives the bit number to test if enabled, (1U << bit) & bitmask. */ #define NT_GNU_HWCAP 2 /* Build ID bits as generated by ld --build-id. The descriptor consists of any nonzero number of bytes. */ #define NT_GNU_BUILD_ID 3 /* Version note generated by GNU gold containing a version string. */ #define NT_GNU_GOLD_VERSION 4 /* Move records. */ typedef struct { Elf32_Xword m_value; /* Symbol value. */ Elf32_Word m_info; /* Size and index. */ Elf32_Word m_poffset; /* Symbol offset. */ Elf32_Half m_repeat; /* Repeat count. */ Elf32_Half m_stride; /* Stride info. */ } Elf32_Move; typedef struct { Elf64_Xword m_value; /* Symbol value. */ Elf64_Xword m_info; /* Size and index. */ Elf64_Xword m_poffset; /* Symbol offset. */ Elf64_Half m_repeat; /* Repeat count. */ Elf64_Half m_stride; /* Stride info. */ } Elf64_Move; /* Macro to construct move records. */ #define ELF32_M_SYM(info) ((info) >> 8) #define ELF32_M_SIZE(info) ((unsigned char) (info)) #define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size)) #define ELF64_M_SYM(info) ELF32_M_SYM (info) #define ELF64_M_SIZE(info) ELF32_M_SIZE (info) #define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size) /* Motorola 68k specific definitions. */ /* Values for Elf32_Ehdr.e_flags. */ #define EF_CPU32 0x00810000 /* m68k relocs. */ #define R_68K_NONE 0 /* No reloc */ #define R_68K_32 1 /* Direct 32 bit */ #define R_68K_16 2 /* Direct 16 bit */ #define R_68K_8 3 /* Direct 8 bit */ #define R_68K_PC32 4 /* PC relative 32 bit */ #define R_68K_PC16 5 /* PC relative 16 bit */ #define R_68K_PC8 6 /* PC relative 8 bit */ #define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */ #define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */ #define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */ #define R_68K_GOT32O 10 /* 32 bit GOT offset */ #define R_68K_GOT16O 11 /* 16 bit GOT offset */ #define R_68K_GOT8O 12 /* 8 bit GOT offset */ #define R_68K_PLT32 13 /* 32 bit PC relative PLT address */ #define R_68K_PLT16 14 /* 16 bit PC relative PLT address */ #define R_68K_PLT8 15 /* 8 bit PC relative PLT address */ #define R_68K_PLT32O 16 /* 32 bit PLT offset */ #define R_68K_PLT16O 17 /* 16 bit PLT offset */ #define R_68K_PLT8O 18 /* 8 bit PLT offset */ #define R_68K_COPY 19 /* Copy symbol at runtime */ #define R_68K_GLOB_DAT 20 /* Create GOT entry */ #define R_68K_JMP_SLOT 21 /* Create PLT entry */ #define R_68K_RELATIVE 22 /* Adjust by program base */ #define R_68K_TLS_GD32 25 /* 32 bit GOT offset for GD */ #define R_68K_TLS_GD16 26 /* 16 bit GOT offset for GD */ #define R_68K_TLS_GD8 27 /* 8 bit GOT offset for GD */ #define R_68K_TLS_LDM32 28 /* 32 bit GOT offset for LDM */ #define R_68K_TLS_LDM16 29 /* 16 bit GOT offset for LDM */ #define R_68K_TLS_LDM8 30 /* 8 bit GOT offset for LDM */ #define R_68K_TLS_LDO32 31 /* 32 bit module-relative offset */ #define R_68K_TLS_LDO16 32 /* 16 bit module-relative offset */ #define R_68K_TLS_LDO8 33 /* 8 bit module-relative offset */ #define R_68K_TLS_IE32 34 /* 32 bit GOT offset for IE */ #define R_68K_TLS_IE16 35 /* 16 bit GOT offset for IE */ #define R_68K_TLS_IE8 36 /* 8 bit GOT offset for IE */ #define R_68K_TLS_LE32 37 /* 32 bit offset relative to static TLS block */ #define R_68K_TLS_LE16 38 /* 16 bit offset relative to static TLS block */ #define R_68K_TLS_LE8 39 /* 8 bit offset relative to static TLS block */ #define R_68K_TLS_DTPMOD32 40 /* 32 bit module number */ #define R_68K_TLS_DTPREL32 41 /* 32 bit module-relative offset */ #define R_68K_TLS_TPREL32 42 /* 32 bit TP-relative offset */ /* Keep this the last entry. */ #define R_68K_NUM 43 /* Intel 80386 specific definitions. */ /* i386 relocs. */ #define R_386_NONE 0 /* No reloc */ #define R_386_32 1 /* Direct 32 bit */ #define R_386_PC32 2 /* PC relative 32 bit */ #define R_386_GOT32 3 /* 32 bit GOT entry */ #define R_386_PLT32 4 /* 32 bit PLT address */ #define R_386_COPY 5 /* Copy symbol at runtime */ #define R_386_GLOB_DAT 6 /* Create GOT entry */ #define R_386_JMP_SLOT 7 /* Create PLT entry */ #define R_386_RELATIVE 8 /* Adjust by program base */ #define R_386_GOTOFF 9 /* 32 bit offset to GOT */ #define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */ #define R_386_32PLT 11 #define R_386_TLS_TPOFF 14 /* Offset in static TLS block */ #define R_386_TLS_IE 15 /* Address of GOT entry for static TLS block offset */ #define R_386_TLS_GOTIE 16 /* GOT entry for static TLS block offset */ #define R_386_TLS_LE 17 /* Offset relative to static TLS block */ #define R_386_TLS_GD 18 /* Direct 32 bit for GNU version of general dynamic thread local data */ #define R_386_TLS_LDM 19 /* Direct 32 bit for GNU version of local dynamic thread local data in LE code */ #define R_386_16 20 #define R_386_PC16 21 #define R_386_8 22 #define R_386_PC8 23 #define R_386_TLS_GD_32 24 /* Direct 32 bit for general dynamic thread local data */ #define R_386_TLS_GD_PUSH 25 /* Tag for pushl in GD TLS code */ #define R_386_TLS_GD_CALL 26 /* Relocation for call to __tls_get_addr() */ #define R_386_TLS_GD_POP 27 /* Tag for popl in GD TLS code */ #define R_386_TLS_LDM_32 28 /* Direct 32 bit for local dynamic thread local data in LE code */ #define R_386_TLS_LDM_PUSH 29 /* Tag for pushl in LDM TLS code */ #define R_386_TLS_LDM_CALL 30 /* Relocation for call to __tls_get_addr() in LDM code */ #define R_386_TLS_LDM_POP 31 /* Tag for popl in LDM TLS code */ #define R_386_TLS_LDO_32 32 /* Offset relative to TLS block */ #define R_386_TLS_IE_32 33 /* GOT entry for negated static TLS block offset */ #define R_386_TLS_LE_32 34 /* Negated offset relative to static TLS block */ #define R_386_TLS_DTPMOD32 35 /* ID of module containing symbol */ #define R_386_TLS_DTPOFF32 36 /* Offset in TLS block */ #define R_386_TLS_TPOFF32 37 /* Negated offset in static TLS block */ /* 38? */ #define R_386_TLS_GOTDESC 39 /* GOT offset for TLS descriptor. */ #define R_386_TLS_DESC_CALL 40 /* Marker of call through TLS descriptor for relaxation. */ #define R_386_TLS_DESC 41 /* TLS descriptor containing pointer to code and to argument, returning the TLS offset for the symbol. */ #define R_386_IRELATIVE 42 /* Adjust indirectly by program base */ /* Keep this the last entry. */ #define R_386_NUM 43 /* SUN SPARC specific definitions. */ /* Legal values for ST_TYPE subfield of st_info (symbol type). */ #define STT_SPARC_REGISTER 13 /* Global register reserved to app. */ /* Values for Elf64_Ehdr.e_flags. */ #define EF_SPARCV9_MM 3 #define EF_SPARCV9_TSO 0 #define EF_SPARCV9_PSO 1 #define EF_SPARCV9_RMO 2 #define EF_SPARC_LEDATA 0x800000 /* little endian data */ #define EF_SPARC_EXT_MASK 0xFFFF00 #define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */ #define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */ #define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */ #define EF_SPARC_SUN_US3 0x000800 /* Sun UltraSPARCIII extensions */ /* SPARC relocs. */ #define R_SPARC_NONE 0 /* No reloc */ #define R_SPARC_8 1 /* Direct 8 bit */ #define R_SPARC_16 2 /* Direct 16 bit */ #define R_SPARC_32 3 /* Direct 32 bit */ #define R_SPARC_DISP8 4 /* PC relative 8 bit */ #define R_SPARC_DISP16 5 /* PC relative 16 bit */ #define R_SPARC_DISP32 6 /* PC relative 32 bit */ #define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */ #define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */ #define R_SPARC_HI22 9 /* High 22 bit */ #define R_SPARC_22 10 /* Direct 22 bit */ #define R_SPARC_13 11 /* Direct 13 bit */ #define R_SPARC_LO10 12 /* Truncated 10 bit */ #define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */ #define R_SPARC_GOT13 14 /* 13 bit GOT entry */ #define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */ #define R_SPARC_PC10 16 /* PC relative 10 bit truncated */ #define R_SPARC_PC22 17 /* PC relative 22 bit shifted */ #define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */ #define R_SPARC_COPY 19 /* Copy symbol at runtime */ #define R_SPARC_GLOB_DAT 20 /* Create GOT entry */ #define R_SPARC_JMP_SLOT 21 /* Create PLT entry */ #define R_SPARC_RELATIVE 22 /* Adjust by program base */ #define R_SPARC_UA32 23 /* Direct 32 bit unaligned */ /* Additional Sparc64 relocs. */ #define R_SPARC_PLT32 24 /* Direct 32 bit ref to PLT entry */ #define R_SPARC_HIPLT22 25 /* High 22 bit PLT entry */ #define R_SPARC_LOPLT10 26 /* Truncated 10 bit PLT entry */ #define R_SPARC_PCPLT32 27 /* PC rel 32 bit ref to PLT entry */ #define R_SPARC_PCPLT22 28 /* PC rel high 22 bit PLT entry */ #define R_SPARC_PCPLT10 29 /* PC rel trunc 10 bit PLT entry */ #define R_SPARC_10 30 /* Direct 10 bit */ #define R_SPARC_11 31 /* Direct 11 bit */ #define R_SPARC_64 32 /* Direct 64 bit */ #define R_SPARC_OLO10 33 /* 10bit with secondary 13bit addend */ #define R_SPARC_HH22 34 /* Top 22 bits of direct 64 bit */ #define R_SPARC_HM10 35 /* High middle 10 bits of ... */ #define R_SPARC_LM22 36 /* Low middle 22 bits of ... */ #define R_SPARC_PC_HH22 37 /* Top 22 bits of pc rel 64 bit */ #define R_SPARC_PC_HM10 38 /* High middle 10 bit of ... */ #define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */ #define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */ #define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */ #define R_SPARC_GLOB_JMP 42 /* was part of v9 ABI but was removed */ #define R_SPARC_7 43 /* Direct 7 bit */ #define R_SPARC_5 44 /* Direct 5 bit */ #define R_SPARC_6 45 /* Direct 6 bit */ #define R_SPARC_DISP64 46 /* PC relative 64 bit */ #define R_SPARC_PLT64 47 /* Direct 64 bit ref to PLT entry */ #define R_SPARC_HIX22 48 /* High 22 bit complemented */ #define R_SPARC_LOX10 49 /* Truncated 11 bit complemented */ #define R_SPARC_H44 50 /* Direct high 12 of 44 bit */ #define R_SPARC_M44 51 /* Direct mid 22 of 44 bit */ #define R_SPARC_L44 52 /* Direct low 10 of 44 bit */ #define R_SPARC_REGISTER 53 /* Global register usage */ #define R_SPARC_UA64 54 /* Direct 64 bit unaligned */ #define R_SPARC_UA16 55 /* Direct 16 bit unaligned */ #define R_SPARC_TLS_GD_HI22 56 #define R_SPARC_TLS_GD_LO10 57 #define R_SPARC_TLS_GD_ADD 58 #define R_SPARC_TLS_GD_CALL 59 #define R_SPARC_TLS_LDM_HI22 60 #define R_SPARC_TLS_LDM_LO10 61 #define R_SPARC_TLS_LDM_ADD 62 #define R_SPARC_TLS_LDM_CALL 63 #define R_SPARC_TLS_LDO_HIX22 64 #define R_SPARC_TLS_LDO_LOX10 65 #define R_SPARC_TLS_LDO_ADD 66 #define R_SPARC_TLS_IE_HI22 67 #define R_SPARC_TLS_IE_LO10 68 #define R_SPARC_TLS_IE_LD 69 #define R_SPARC_TLS_IE_LDX 70 #define R_SPARC_TLS_IE_ADD 71 #define R_SPARC_TLS_LE_HIX22 72 #define R_SPARC_TLS_LE_LOX10 73 #define R_SPARC_TLS_DTPMOD32 74 #define R_SPARC_TLS_DTPMOD64 75 #define R_SPARC_TLS_DTPOFF32 76 #define R_SPARC_TLS_DTPOFF64 77 #define R_SPARC_TLS_TPOFF32 78 #define R_SPARC_TLS_TPOFF64 79 #define R_SPARC_GOTDATA_HIX22 80 #define R_SPARC_GOTDATA_LOX10 81 #define R_SPARC_GOTDATA_OP_HIX22 82 #define R_SPARC_GOTDATA_OP_LOX10 83 #define R_SPARC_GOTDATA_OP 84 #define R_SPARC_H34 85 #define R_SPARC_SIZE32 86 #define R_SPARC_SIZE64 87 #define R_SPARC_WDISP10 88 #define R_SPARC_JMP_IREL 248 #define R_SPARC_IRELATIVE 249 #define R_SPARC_GNU_VTINHERIT 250 #define R_SPARC_GNU_VTENTRY 251 #define R_SPARC_REV32 252 /* Keep this the last entry. */ #define R_SPARC_NUM 253 /* For Sparc64, legal values for d_tag of Elf64_Dyn. */ #define DT_SPARC_REGISTER 0x70000001 #define DT_SPARC_NUM 2 /* MIPS R3000 specific definitions. */ /* Legal values for e_flags field of Elf32_Ehdr. */ #define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used */ #define EF_MIPS_PIC 2 /* Contains PIC code */ #define EF_MIPS_CPIC 4 /* Uses PIC calling sequence */ #define EF_MIPS_XGOT 8 #define EF_MIPS_64BIT_WHIRL 16 #define EF_MIPS_ABI2 32 #define EF_MIPS_ABI_ON32 64 #define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */ /* Legal values for MIPS architecture level. */ #define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ #define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ #define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ #define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ #define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ #define EF_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ #define EF_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ /* The following are non-official names and should not be used. */ #define E_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ #define E_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ #define E_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ #define E_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ #define E_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ #define E_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ #define E_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ /* Special section indices. */ #define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */ #define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */ #define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */ #define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */ #define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */ /* Legal values for sh_type field of Elf32_Shdr. */ #define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */ #define SHT_MIPS_MSYM 0x70000001 #define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */ #define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */ #define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */ #define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information*/ #define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */ #define SHT_MIPS_PACKAGE 0x70000007 #define SHT_MIPS_PACKSYM 0x70000008 #define SHT_MIPS_RELD 0x70000009 #define SHT_MIPS_IFACE 0x7000000b #define SHT_MIPS_CONTENT 0x7000000c #define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */ #define SHT_MIPS_SHDR 0x70000010 #define SHT_MIPS_FDESC 0x70000011 #define SHT_MIPS_EXTSYM 0x70000012 #define SHT_MIPS_DENSE 0x70000013 #define SHT_MIPS_PDESC 0x70000014 #define SHT_MIPS_LOCSYM 0x70000015 #define SHT_MIPS_AUXSYM 0x70000016 #define SHT_MIPS_OPTSYM 0x70000017 #define SHT_MIPS_LOCSTR 0x70000018 #define SHT_MIPS_LINE 0x70000019 #define SHT_MIPS_RFDESC 0x7000001a #define SHT_MIPS_DELTASYM 0x7000001b #define SHT_MIPS_DELTAINST 0x7000001c #define SHT_MIPS_DELTACLASS 0x7000001d #define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */ #define SHT_MIPS_DELTADECL 0x7000001f #define SHT_MIPS_SYMBOL_LIB 0x70000020 #define SHT_MIPS_EVENTS 0x70000021 /* Event section. */ #define SHT_MIPS_TRANSLATE 0x70000022 #define SHT_MIPS_PIXIE 0x70000023 #define SHT_MIPS_XLATE 0x70000024 #define SHT_MIPS_XLATE_DEBUG 0x70000025 #define SHT_MIPS_WHIRL 0x70000026 #define SHT_MIPS_EH_REGION 0x70000027 #define SHT_MIPS_XLATE_OLD 0x70000028 #define SHT_MIPS_PDR_EXCEPTION 0x70000029 /* Legal values for sh_flags field of Elf32_Shdr. */ #define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */ #define SHF_MIPS_MERGE 0x20000000 #define SHF_MIPS_ADDR 0x40000000 #define SHF_MIPS_STRINGS 0x80000000 #define SHF_MIPS_NOSTRIP 0x08000000 #define SHF_MIPS_LOCAL 0x04000000 #define SHF_MIPS_NAMES 0x02000000 #define SHF_MIPS_NODUPE 0x01000000 /* Symbol tables. */ /* MIPS specific values for `st_other'. */ #define STO_MIPS_DEFAULT 0x0 #define STO_MIPS_INTERNAL 0x1 #define STO_MIPS_HIDDEN 0x2 #define STO_MIPS_PROTECTED 0x3 #define STO_MIPS_PLT 0x8 #define STO_MIPS_SC_ALIGN_UNUSED 0xff /* MIPS specific values for `st_info'. */ #define STB_MIPS_SPLIT_COMMON 13 /* Entries found in sections of type SHT_MIPS_GPTAB. */ typedef union { struct { Elf32_Word gt_current_g_value; /* -G value used for compilation */ Elf32_Word gt_unused; /* Not used */ } gt_header; /* First entry in section */ struct { Elf32_Word gt_g_value; /* If this value were used for -G */ Elf32_Word gt_bytes; /* This many bytes would be used */ } gt_entry; /* Subsequent entries in section */ } Elf32_gptab; /* Entry found in sections of type SHT_MIPS_REGINFO. */ typedef struct { Elf32_Word ri_gprmask; /* General registers used */ Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */ Elf32_Sword ri_gp_value; /* $gp register value */ } Elf32_RegInfo; /* Entries found in sections of type SHT_MIPS_OPTIONS. */ typedef struct { unsigned char kind; /* Determines interpretation of the variable part of descriptor. */ unsigned char size; /* Size of descriptor, including header. */ Elf32_Section section; /* Section header index of section affected, 0 for global options. */ Elf32_Word info; /* Kind-specific information. */ } Elf_Options; /* Values for `kind' field in Elf_Options. */ #define ODK_NULL 0 /* Undefined. */ #define ODK_REGINFO 1 /* Register usage information. */ #define ODK_EXCEPTIONS 2 /* Exception processing options. */ #define ODK_PAD 3 /* Section padding options. */ #define ODK_HWPATCH 4 /* Hardware workarounds performed */ #define ODK_FILL 5 /* record the fill value used by the linker. */ #define ODK_TAGS 6 /* reserve space for desktop tools to write. */ #define ODK_HWAND 7 /* HW workarounds. 'AND' bits when merging. */ #define ODK_HWOR 8 /* HW workarounds. 'OR' bits when merging. */ /* Values for `info' in Elf_Options for ODK_EXCEPTIONS entries. */ #define OEX_FPU_MIN 0x1f /* FPE's which MUST be enabled. */ #define OEX_FPU_MAX 0x1f00 /* FPE's which MAY be enabled. */ #define OEX_PAGE0 0x10000 /* page zero must be mapped. */ #define OEX_SMM 0x20000 /* Force sequential memory mode? */ #define OEX_FPDBUG 0x40000 /* Force floating point debug mode? */ #define OEX_PRECISEFP OEX_FPDBUG #define OEX_DISMISS 0x80000 /* Dismiss invalid address faults? */ #define OEX_FPU_INVAL 0x10 #define OEX_FPU_DIV0 0x08 #define OEX_FPU_OFLO 0x04 #define OEX_FPU_UFLO 0x02 #define OEX_FPU_INEX 0x01 /* Masks for `info' in Elf_Options for an ODK_HWPATCH entry. */ #define OHW_R4KEOP 0x1 /* R4000 end-of-page patch. */ #define OHW_R8KPFETCH 0x2 /* may need R8000 prefetch patch. */ #define OHW_R5KEOP 0x4 /* R5000 end-of-page patch. */ #define OHW_R5KCVTL 0x8 /* R5000 cvt.[ds].l bug. clean=1. */ #define OPAD_PREFIX 0x1 #define OPAD_POSTFIX 0x2 #define OPAD_SYMBOL 0x4 /* Entry found in `.options' section. */ typedef struct { Elf32_Word hwp_flags1; /* Extra flags. */ Elf32_Word hwp_flags2; /* Extra flags. */ } Elf_Options_Hw; /* Masks for `info' in ElfOptions for ODK_HWAND and ODK_HWOR entries. */ #define OHWA0_R4KEOP_CHECKED 0x00000001 #define OHWA1_R4KEOP_CLEAN 0x00000002 /* MIPS relocs. */ #define R_MIPS_NONE 0 /* No reloc */ #define R_MIPS_16 1 /* Direct 16 bit */ #define R_MIPS_32 2 /* Direct 32 bit */ #define R_MIPS_REL32 3 /* PC relative 32 bit */ #define R_MIPS_26 4 /* Direct 26 bit shifted */ #define R_MIPS_HI16 5 /* High 16 bit */ #define R_MIPS_LO16 6 /* Low 16 bit */ #define R_MIPS_GPREL16 7 /* GP relative 16 bit */ #define R_MIPS_LITERAL 8 /* 16 bit literal entry */ #define R_MIPS_GOT16 9 /* 16 bit GOT entry */ #define R_MIPS_PC16 10 /* PC relative 16 bit */ #define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */ #define R_MIPS_GPREL32 12 /* GP relative 32 bit */ #define R_MIPS_SHIFT5 16 #define R_MIPS_SHIFT6 17 #define R_MIPS_64 18 #define R_MIPS_GOT_DISP 19 #define R_MIPS_GOT_PAGE 20 #define R_MIPS_GOT_OFST 21 #define R_MIPS_GOT_HI16 22 #define R_MIPS_GOT_LO16 23 #define R_MIPS_SUB 24 #define R_MIPS_INSERT_A 25 #define R_MIPS_INSERT_B 26 #define R_MIPS_DELETE 27 #define R_MIPS_HIGHER 28 #define R_MIPS_HIGHEST 29 #define R_MIPS_CALL_HI16 30 #define R_MIPS_CALL_LO16 31 #define R_MIPS_SCN_DISP 32 #define R_MIPS_REL16 33 #define R_MIPS_ADD_IMMEDIATE 34 #define R_MIPS_PJUMP 35 #define R_MIPS_RELGOT 36 #define R_MIPS_JALR 37 #define R_MIPS_TLS_DTPMOD32 38 /* Module number 32 bit */ #define R_MIPS_TLS_DTPREL32 39 /* Module-relative offset 32 bit */ #define R_MIPS_TLS_DTPMOD64 40 /* Module number 64 bit */ #define R_MIPS_TLS_DTPREL64 41 /* Module-relative offset 64 bit */ #define R_MIPS_TLS_GD 42 /* 16 bit GOT offset for GD */ #define R_MIPS_TLS_LDM 43 /* 16 bit GOT offset for LDM */ #define R_MIPS_TLS_DTPREL_HI16 44 /* Module-relative offset, high 16 bits */ #define R_MIPS_TLS_DTPREL_LO16 45 /* Module-relative offset, low 16 bits */ #define R_MIPS_TLS_GOTTPREL 46 /* 16 bit GOT offset for IE */ #define R_MIPS_TLS_TPREL32 47 /* TP-relative offset, 32 bit */ #define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */ #define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */ #define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */ #define R_MIPS_GLOB_DAT 51 #define R_MIPS_COPY 126 #define R_MIPS_JUMP_SLOT 127 /* Keep this the last entry. */ #define R_MIPS_NUM 128 /* Legal values for p_type field of Elf32_Phdr. */ #define PT_MIPS_REGINFO 0x70000000 /* Register usage information */ #define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */ #define PT_MIPS_OPTIONS 0x70000002 /* Special program header types. */ #define PF_MIPS_LOCAL 0x10000000 /* Legal values for d_tag field of Elf32_Dyn. */ #define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */ #define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */ #define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */ #define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */ #define DT_MIPS_FLAGS 0x70000005 /* Flags */ #define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */ #define DT_MIPS_MSYM 0x70000007 #define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */ #define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */ #define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */ #define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */ #define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */ #define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */ #define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */ #define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */ #define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */ #define DT_MIPS_RLD_MAP 0x70000016 /* Address of run time loader map. */ #define DT_MIPS_DELTA_CLASS 0x70000017 /* Delta C++ class definition. */ #define DT_MIPS_DELTA_CLASS_NO 0x70000018 /* Number of entries in DT_MIPS_DELTA_CLASS. */ #define DT_MIPS_DELTA_INSTANCE 0x70000019 /* Delta C++ class instances. */ #define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in DT_MIPS_DELTA_INSTANCE. */ #define DT_MIPS_DELTA_RELOC 0x7000001b /* Delta relocations. */ #define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in DT_MIPS_DELTA_RELOC. */ #define DT_MIPS_DELTA_SYM 0x7000001d /* Delta symbols that Delta relocations refer to. */ #define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in DT_MIPS_DELTA_SYM. */ #define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the class declaration. */ #define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in DT_MIPS_DELTA_CLASSSYM. */ #define DT_MIPS_CXX_FLAGS 0x70000022 /* Flags indicating for C++ flavor. */ #define DT_MIPS_PIXIE_INIT 0x70000023 #define DT_MIPS_SYMBOL_LIB 0x70000024 #define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025 #define DT_MIPS_LOCAL_GOTIDX 0x70000026 #define DT_MIPS_HIDDEN_GOTIDX 0x70000027 #define DT_MIPS_PROTECTED_GOTIDX 0x70000028 #define DT_MIPS_OPTIONS 0x70000029 /* Address of .options. */ #define DT_MIPS_INTERFACE 0x7000002a /* Address of .interface. */ #define DT_MIPS_DYNSTR_ALIGN 0x7000002b #define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */ #define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve function stored in GOT. */ #define DT_MIPS_PERF_SUFFIX 0x7000002e /* Default suffix of dso to be added by rld on dlopen() calls. */ #define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */ #define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */ #define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */ /* The address of .got.plt in an executable using the new non-PIC ABI. */ #define DT_MIPS_PLTGOT 0x70000032 /* The base of the PLT in an executable using the new non-PIC ABI if that PLT is writable. For a non-writable PLT, this is omitted or has a zero value. */ #define DT_MIPS_RWPLT 0x70000034 #define DT_MIPS_NUM 0x35 /* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */ #define RHF_NONE 0 /* No flags */ #define RHF_QUICKSTART (1 << 0) /* Use quickstart */ #define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */ #define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */ #define RHF_NO_MOVE (1 << 3) #define RHF_SGI_ONLY (1 << 4) #define RHF_GUARANTEE_INIT (1 << 5) #define RHF_DELTA_C_PLUS_PLUS (1 << 6) #define RHF_GUARANTEE_START_INIT (1 << 7) #define RHF_PIXIE (1 << 8) #define RHF_DEFAULT_DELAY_LOAD (1 << 9) #define RHF_REQUICKSTART (1 << 10) #define RHF_REQUICKSTARTED (1 << 11) #define RHF_CORD (1 << 12) #define RHF_NO_UNRES_UNDEF (1 << 13) #define RHF_RLD_ORDER_SAFE (1 << 14) /* Entries found in sections of type SHT_MIPS_LIBLIST. */ typedef struct { Elf32_Word l_name; /* Name (string table index) */ Elf32_Word l_time_stamp; /* Timestamp */ Elf32_Word l_checksum; /* Checksum */ Elf32_Word l_version; /* Interface version */ Elf32_Word l_flags; /* Flags */ } Elf32_Lib; typedef struct { Elf64_Word l_name; /* Name (string table index) */ Elf64_Word l_time_stamp; /* Timestamp */ Elf64_Word l_checksum; /* Checksum */ Elf64_Word l_version; /* Interface version */ Elf64_Word l_flags; /* Flags */ } Elf64_Lib; /* Legal values for l_flags. */ #define LL_NONE 0 #define LL_EXACT_MATCH (1 << 0) /* Require exact match */ #define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */ #define LL_REQUIRE_MINOR (1 << 2) #define LL_EXPORTS (1 << 3) #define LL_DELAY_LOAD (1 << 4) #define LL_DELTA (1 << 5) /* Entries found in sections of type SHT_MIPS_CONFLICT. */ typedef Elf32_Addr Elf32_Conflict; /* HPPA specific definitions. */ /* Legal values for e_flags field of Elf32_Ehdr. */ #define EF_PARISC_TRAPNIL 0x00010000 /* Trap nil pointer dereference. */ #define EF_PARISC_EXT 0x00020000 /* Program uses arch. extensions. */ #define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */ #define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */ #define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch prediction. */ #define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */ #define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */ /* Defined values for `e_flags & EF_PARISC_ARCH' are: */ #define EFA_PARISC_1_0 0x020b /* PA-RISC 1.0 big-endian. */ #define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */ #define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */ /* Additional section indeces. */ #define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared symbols in ANSI C. */ #define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */ /* Legal values for sh_type field of Elf32_Shdr. */ #define SHT_PARISC_EXT 0x70000000 /* Contains product specific ext. */ #define SHT_PARISC_UNWIND 0x70000001 /* Unwind information. */ #define SHT_PARISC_DOC 0x70000002 /* Debug info for optimized code. */ /* Legal values for sh_flags field of Elf32_Shdr. */ #define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */ #define SHF_PARISC_HUGE 0x40000000 /* Section far from gp. */ #define SHF_PARISC_SBP 0x80000000 /* Static branch prediction code. */ /* Legal values for ST_TYPE subfield of st_info (symbol type). */ #define STT_PARISC_MILLICODE 13 /* Millicode function entry point. */ #define STT_HP_OPAQUE (STT_LOOS + 0x1) #define STT_HP_STUB (STT_LOOS + 0x2) /* HPPA relocs. */ #define R_PARISC_NONE 0 /* No reloc. */ #define R_PARISC_DIR32 1 /* Direct 32-bit reference. */ #define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */ #define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */ #define R_PARISC_DIR17F 4 /* 17 bits of eff. address. */ #define R_PARISC_DIR14R 6 /* Right 14 bits of eff. address. */ #define R_PARISC_PCREL32 9 /* 32-bit rel. address. */ #define R_PARISC_PCREL21L 10 /* Left 21 bits of rel. address. */ #define R_PARISC_PCREL17R 11 /* Right 17 bits of rel. address. */ #define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */ #define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */ #define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */ #define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */ #define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */ #define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */ #define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */ #define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */ #define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */ #define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */ #define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */ #define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */ #define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */ #define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */ #define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */ #define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */ #define R_PARISC_FPTR64 64 /* 64 bits function address. */ #define R_PARISC_PLABEL32 65 /* 32 bits function address. */ #define R_PARISC_PLABEL21L 66 /* Left 21 bits of fdesc address. */ #define R_PARISC_PLABEL14R 70 /* Right 14 bits of fdesc address. */ #define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */ #define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */ #define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */ #define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */ #define R_PARISC_PCREL16F 77 /* 16 bits PC-rel. address. */ #define R_PARISC_PCREL16WF 78 /* 16 bits PC-rel. address. */ #define R_PARISC_PCREL16DF 79 /* 16 bits PC-rel. address. */ #define R_PARISC_DIR64 80 /* 64 bits of eff. address. */ #define R_PARISC_DIR14WR 83 /* 14 bits of eff. address. */ #define R_PARISC_DIR14DR 84 /* 14 bits of eff. address. */ #define R_PARISC_DIR16F 85 /* 16 bits of eff. address. */ #define R_PARISC_DIR16WF 86 /* 16 bits of eff. address. */ #define R_PARISC_DIR16DF 87 /* 16 bits of eff. address. */ #define R_PARISC_GPREL64 88 /* 64 bits of GP-rel. address. */ #define R_PARISC_GPREL14WR 91 /* GP-rel. address, right 14 bits. */ #define R_PARISC_GPREL14DR 92 /* GP-rel. address, right 14 bits. */ #define R_PARISC_GPREL16F 93 /* 16 bits GP-rel. address. */ #define R_PARISC_GPREL16WF 94 /* 16 bits GP-rel. address. */ #define R_PARISC_GPREL16DF 95 /* 16 bits GP-rel. address. */ #define R_PARISC_LTOFF64 96 /* 64 bits LT-rel. address. */ #define R_PARISC_LTOFF14WR 99 /* LT-rel. address, right 14 bits. */ #define R_PARISC_LTOFF14DR 100 /* LT-rel. address, right 14 bits. */ #define R_PARISC_LTOFF16F 101 /* 16 bits LT-rel. address. */ #define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */ #define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */ #define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */ #define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */ #define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */ #define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */ #define R_PARISC_PLTOFF16F 117 /* 16 bits LT-rel. address. */ #define R_PARISC_PLTOFF16WF 118 /* 16 bits PLT-rel. address. */ #define R_PARISC_PLTOFF16DF 119 /* 16 bits PLT-rel. address. */ #define R_PARISC_LTOFF_FPTR64 120 /* 64 bits LT-rel. function ptr. */ #define R_PARISC_LTOFF_FPTR14WR 123 /* LT-rel. fct. ptr., right 14 bits. */ #define R_PARISC_LTOFF_FPTR14DR 124 /* LT-rel. fct. ptr., right 14 bits. */ #define R_PARISC_LTOFF_FPTR16F 125 /* 16 bits LT-rel. function ptr. */ #define R_PARISC_LTOFF_FPTR16WF 126 /* 16 bits LT-rel. function ptr. */ #define R_PARISC_LTOFF_FPTR16DF 127 /* 16 bits LT-rel. function ptr. */ #define R_PARISC_LORESERVE 128 #define R_PARISC_COPY 128 /* Copy relocation. */ #define R_PARISC_IPLT 129 /* Dynamic reloc, imported PLT */ #define R_PARISC_EPLT 130 /* Dynamic reloc, exported PLT */ #define R_PARISC_TPREL32 153 /* 32 bits TP-rel. address. */ #define R_PARISC_TPREL21L 154 /* TP-rel. address, left 21 bits. */ #define R_PARISC_TPREL14R 158 /* TP-rel. address, right 14 bits. */ #define R_PARISC_LTOFF_TP21L 162 /* LT-TP-rel. address, left 21 bits. */ #define R_PARISC_LTOFF_TP14R 166 /* LT-TP-rel. address, right 14 bits.*/ #define R_PARISC_LTOFF_TP14F 167 /* 14 bits LT-TP-rel. address. */ #define R_PARISC_TPREL64 216 /* 64 bits TP-rel. address. */ #define R_PARISC_TPREL14WR 219 /* TP-rel. address, right 14 bits. */ #define R_PARISC_TPREL14DR 220 /* TP-rel. address, right 14 bits. */ #define R_PARISC_TPREL16F 221 /* 16 bits TP-rel. address. */ #define R_PARISC_TPREL16WF 222 /* 16 bits TP-rel. address. */ #define R_PARISC_TPREL16DF 223 /* 16 bits TP-rel. address. */ #define R_PARISC_LTOFF_TP64 224 /* 64 bits LT-TP-rel. address. */ #define R_PARISC_LTOFF_TP14WR 227 /* LT-TP-rel. address, right 14 bits.*/ #define R_PARISC_LTOFF_TP14DR 228 /* LT-TP-rel. address, right 14 bits.*/ #define R_PARISC_LTOFF_TP16F 229 /* 16 bits LT-TP-rel. address. */ #define R_PARISC_LTOFF_TP16WF 230 /* 16 bits LT-TP-rel. address. */ #define R_PARISC_LTOFF_TP16DF 231 /* 16 bits LT-TP-rel. address. */ #define R_PARISC_GNU_VTENTRY 232 #define R_PARISC_GNU_VTINHERIT 233 #define R_PARISC_TLS_GD21L 234 /* GD 21-bit left. */ #define R_PARISC_TLS_GD14R 235 /* GD 14-bit right. */ #define R_PARISC_TLS_GDCALL 236 /* GD call to __t_g_a. */ #define R_PARISC_TLS_LDM21L 237 /* LD module 21-bit left. */ #define R_PARISC_TLS_LDM14R 238 /* LD module 14-bit right. */ #define R_PARISC_TLS_LDMCALL 239 /* LD module call to __t_g_a. */ #define R_PARISC_TLS_LDO21L 240 /* LD offset 21-bit left. */ #define R_PARISC_TLS_LDO14R 241 /* LD offset 14-bit right. */ #define R_PARISC_TLS_DTPMOD32 242 /* DTP module 32-bit. */ #define R_PARISC_TLS_DTPMOD64 243 /* DTP module 64-bit. */ #define R_PARISC_TLS_DTPOFF32 244 /* DTP offset 32-bit. */ #define R_PARISC_TLS_DTPOFF64 245 /* DTP offset 32-bit. */ #define R_PARISC_TLS_LE21L R_PARISC_TPREL21L #define R_PARISC_TLS_LE14R R_PARISC_TPREL14R #define R_PARISC_TLS_IE21L R_PARISC_LTOFF_TP21L #define R_PARISC_TLS_IE14R R_PARISC_LTOFF_TP14R #define R_PARISC_TLS_TPREL32 R_PARISC_TPREL32 #define R_PARISC_TLS_TPREL64 R_PARISC_TPREL64 #define R_PARISC_HIRESERVE 255 /* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */ #define PT_HP_TLS (PT_LOOS + 0x0) #define PT_HP_CORE_NONE (PT_LOOS + 0x1) #define PT_HP_CORE_VERSION (PT_LOOS + 0x2) #define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) #define PT_HP_CORE_COMM (PT_LOOS + 0x4) #define PT_HP_CORE_PROC (PT_LOOS + 0x5) #define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6) #define PT_HP_CORE_STACK (PT_LOOS + 0x7) #define PT_HP_CORE_SHM (PT_LOOS + 0x8) #define PT_HP_CORE_MMF (PT_LOOS + 0x9) #define PT_HP_PARALLEL (PT_LOOS + 0x10) #define PT_HP_FASTBIND (PT_LOOS + 0x11) #define PT_HP_OPT_ANNOT (PT_LOOS + 0x12) #define PT_HP_HSL_ANNOT (PT_LOOS + 0x13) #define PT_HP_STACK (PT_LOOS + 0x14) #define PT_PARISC_ARCHEXT 0x70000000 #define PT_PARISC_UNWIND 0x70000001 /* Legal values for p_flags field of Elf32_Phdr/Elf64_Phdr. */ #define PF_PARISC_SBP 0x08000000 #define PF_HP_PAGE_SIZE 0x00100000 #define PF_HP_FAR_SHARED 0x00200000 #define PF_HP_NEAR_SHARED 0x00400000 #define PF_HP_CODE 0x01000000 #define PF_HP_MODIFY 0x02000000 #define PF_HP_LAZYSWAP 0x04000000 #define PF_HP_SBP 0x08000000 /* Alpha specific definitions. */ /* Legal values for e_flags field of Elf64_Ehdr. */ #define EF_ALPHA_32BIT 1 /* All addresses must be < 2GB. */ #define EF_ALPHA_CANRELAX 2 /* Relocations for relaxing exist. */ /* Legal values for sh_type field of Elf64_Shdr. */ /* These two are primerily concerned with ECOFF debugging info. */ #define SHT_ALPHA_DEBUG 0x70000001 #define SHT_ALPHA_REGINFO 0x70000002 /* Legal values for sh_flags field of Elf64_Shdr. */ #define SHF_ALPHA_GPREL 0x10000000 /* Legal values for st_other field of Elf64_Sym. */ #define STO_ALPHA_NOPV 0x80 /* No PV required. */ #define STO_ALPHA_STD_GPLOAD 0x88 /* PV only used for initial ldgp. */ /* Alpha relocs. */ #define R_ALPHA_NONE 0 /* No reloc */ #define R_ALPHA_REFLONG 1 /* Direct 32 bit */ #define R_ALPHA_REFQUAD 2 /* Direct 64 bit */ #define R_ALPHA_GPREL32 3 /* GP relative 32 bit */ #define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */ #define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */ #define R_ALPHA_GPDISP 6 /* Add displacement to GP */ #define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */ #define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */ #define R_ALPHA_SREL16 9 /* PC relative 16 bit */ #define R_ALPHA_SREL32 10 /* PC relative 32 bit */ #define R_ALPHA_SREL64 11 /* PC relative 64 bit */ #define R_ALPHA_GPRELHIGH 17 /* GP relative 32 bit, high 16 bits */ #define R_ALPHA_GPRELLOW 18 /* GP relative 32 bit, low 16 bits */ #define R_ALPHA_GPREL16 19 /* GP relative 16 bit */ #define R_ALPHA_COPY 24 /* Copy symbol at runtime */ #define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */ #define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */ #define R_ALPHA_RELATIVE 27 /* Adjust by program base */ #define R_ALPHA_TLS_GD_HI 28 #define R_ALPHA_TLSGD 29 #define R_ALPHA_TLS_LDM 30 #define R_ALPHA_DTPMOD64 31 #define R_ALPHA_GOTDTPREL 32 #define R_ALPHA_DTPREL64 33 #define R_ALPHA_DTPRELHI 34 #define R_ALPHA_DTPRELLO 35 #define R_ALPHA_DTPREL16 36 #define R_ALPHA_GOTTPREL 37 #define R_ALPHA_TPREL64 38 #define R_ALPHA_TPRELHI 39 #define R_ALPHA_TPRELLO 40 #define R_ALPHA_TPREL16 41 /* Keep this the last entry. */ #define R_ALPHA_NUM 46 /* Magic values of the LITUSE relocation addend. */ #define LITUSE_ALPHA_ADDR 0 #define LITUSE_ALPHA_BASE 1 #define LITUSE_ALPHA_BYTOFF 2 #define LITUSE_ALPHA_JSR 3 #define LITUSE_ALPHA_TLS_GD 4 #define LITUSE_ALPHA_TLS_LDM 5 /* Legal values for d_tag of Elf64_Dyn. */ #define DT_ALPHA_PLTRO (DT_LOPROC + 0) #define DT_ALPHA_NUM 1 /* PowerPC specific declarations */ /* Values for Elf32/64_Ehdr.e_flags. */ #define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */ /* Cygnus local bits below */ #define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/ #define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib flag */ /* PowerPC relocations defined by the ABIs */ #define R_PPC_NONE 0 #define R_PPC_ADDR32 1 /* 32bit absolute address */ #define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ #define R_PPC_ADDR16 3 /* 16bit absolute address */ #define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ #define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ #define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ #define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ #define R_PPC_ADDR14_BRTAKEN 8 #define R_PPC_ADDR14_BRNTAKEN 9 #define R_PPC_REL24 10 /* PC relative 26 bit */ #define R_PPC_REL14 11 /* PC relative 16 bit */ #define R_PPC_REL14_BRTAKEN 12 #define R_PPC_REL14_BRNTAKEN 13 #define R_PPC_GOT16 14 #define R_PPC_GOT16_LO 15 #define R_PPC_GOT16_HI 16 #define R_PPC_GOT16_HA 17 #define R_PPC_PLTREL24 18 #define R_PPC_COPY 19 #define R_PPC_GLOB_DAT 20 #define R_PPC_JMP_SLOT 21 #define R_PPC_RELATIVE 22 #define R_PPC_LOCAL24PC 23 #define R_PPC_UADDR32 24 #define R_PPC_UADDR16 25 #define R_PPC_REL32 26 #define R_PPC_PLT32 27 #define R_PPC_PLTREL32 28 #define R_PPC_PLT16_LO 29 #define R_PPC_PLT16_HI 30 #define R_PPC_PLT16_HA 31 #define R_PPC_SDAREL16 32 #define R_PPC_SECTOFF 33 #define R_PPC_SECTOFF_LO 34 #define R_PPC_SECTOFF_HI 35 #define R_PPC_SECTOFF_HA 36 /* PowerPC relocations defined for the TLS access ABI. */ #define R_PPC_TLS 67 /* none (sym+add)@tls */ #define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */ #define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */ #define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ #define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ #define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ #define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */ #define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */ #define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ #define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ #define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ #define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */ #define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ #define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ #define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ #define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ #define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ #define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ #define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ #define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ #define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */ #define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */ #define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ #define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ #define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */ #define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */ #define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */ #define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */ /* The remaining relocs are from the Embedded ELF ABI, and are not in the SVR4 ELF ABI. */ #define R_PPC_EMB_NADDR32 101 #define R_PPC_EMB_NADDR16 102 #define R_PPC_EMB_NADDR16_LO 103 #define R_PPC_EMB_NADDR16_HI 104 #define R_PPC_EMB_NADDR16_HA 105 #define R_PPC_EMB_SDAI16 106 #define R_PPC_EMB_SDA2I16 107 #define R_PPC_EMB_SDA2REL 108 #define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */ #define R_PPC_EMB_MRKREF 110 #define R_PPC_EMB_RELSEC16 111 #define R_PPC_EMB_RELST_LO 112 #define R_PPC_EMB_RELST_HI 113 #define R_PPC_EMB_RELST_HA 114 #define R_PPC_EMB_BIT_FLD 115 #define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */ /* Diab tool relocations. */ #define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */ #define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */ #define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */ #define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */ #define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ #define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ /* GNU extension to support local ifunc. */ #define R_PPC_IRELATIVE 248 /* GNU relocs used in PIC code sequences. */ #define R_PPC_REL16 249 /* half16 (sym+add-.) */ #define R_PPC_REL16_LO 250 /* half16 (sym+add-.)@l */ #define R_PPC_REL16_HI 251 /* half16 (sym+add-.)@h */ #define R_PPC_REL16_HA 252 /* half16 (sym+add-.)@ha */ /* This is a phony reloc to handle any old fashioned TOC16 references that may still be in object files. */ #define R_PPC_TOC16 255 /* PowerPC specific values for the Dyn d_tag field. */ #define DT_PPC_GOT (DT_LOPROC + 0) #define DT_PPC_NUM 1 /* PowerPC64 relocations defined by the ABIs */ #define R_PPC64_NONE R_PPC_NONE #define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address */ #define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned */ #define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address */ #define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of address */ #define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of address. */ #define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */ #define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned */ #define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN #define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN #define R_PPC64_REL24 R_PPC_REL24 /* PC-rel. 26 bit, word aligned */ #define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit */ #define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN #define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN #define R_PPC64_GOT16 R_PPC_GOT16 #define R_PPC64_GOT16_LO R_PPC_GOT16_LO #define R_PPC64_GOT16_HI R_PPC_GOT16_HI #define R_PPC64_GOT16_HA R_PPC_GOT16_HA #define R_PPC64_COPY R_PPC_COPY #define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT #define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT #define R_PPC64_RELATIVE R_PPC_RELATIVE #define R_PPC64_UADDR32 R_PPC_UADDR32 #define R_PPC64_UADDR16 R_PPC_UADDR16 #define R_PPC64_REL32 R_PPC_REL32 #define R_PPC64_PLT32 R_PPC_PLT32 #define R_PPC64_PLTREL32 R_PPC_PLTREL32 #define R_PPC64_PLT16_LO R_PPC_PLT16_LO #define R_PPC64_PLT16_HI R_PPC_PLT16_HI #define R_PPC64_PLT16_HA R_PPC_PLT16_HA #define R_PPC64_SECTOFF R_PPC_SECTOFF #define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO #define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI #define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA #define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2 */ #define R_PPC64_ADDR64 38 /* doubleword64 S + A */ #define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A) */ #define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A) */ #define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A) */ #define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A) */ #define R_PPC64_UADDR64 43 /* doubleword64 S + A */ #define R_PPC64_REL64 44 /* doubleword64 S + A - P */ #define R_PPC64_PLT64 45 /* doubleword64 L + A */ #define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P */ #define R_PPC64_TOC16 47 /* half16* S + A - .TOC */ #define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.) */ #define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.) */ #define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.) */ #define R_PPC64_TOC 51 /* doubleword64 .TOC */ #define R_PPC64_PLTGOT16 52 /* half16* M + A */ #define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A) */ #define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A) */ #define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A) */ #define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2 */ #define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2 */ #define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2 */ #define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2 */ #define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2 */ #define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2 */ #define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2 */ #define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2 */ #define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2 */ #define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2 */ #define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2 */ /* PowerPC64 relocations defined for the TLS access ABI. */ #define R_PPC64_TLS 67 /* none (sym+add)@tls */ #define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */ #define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */ #define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ #define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ #define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ #define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */ #define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */ #define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ #define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ #define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ #define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */ #define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ #define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ #define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ #define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ #define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ #define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ #define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ #define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ #define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */ #define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */ #define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ #define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ #define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */ #define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */ #define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */ #define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */ #define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */ #define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */ #define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */ #define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */ #define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */ #define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */ #define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */ #define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */ #define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */ #define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */ #define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */ #define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */ #define R_PPC64_TLSGD 107 /* none (sym+add)@tlsgd */ #define R_PPC64_TLSLD 108 /* none (sym+add)@tlsld */ #define R_PPC64_TOCSAVE 109 /* none */ /* Added when HA and HI relocs were changed to report overflows. */ #define R_PPC64_ADDR16_HIGH 110 #define R_PPC64_ADDR16_HIGHA 111 #define R_PPC64_TPREL16_HIGH 112 #define R_PPC64_TPREL16_HIGHA 113 #define R_PPC64_DTPREL16_HIGH 114 #define R_PPC64_DTPREL16_HIGHA 115 /* GNU extension to support local ifunc. */ #define R_PPC64_JMP_IREL 247 #define R_PPC64_IRELATIVE 248 #define R_PPC64_REL16 249 /* half16 (sym+add-.) */ #define R_PPC64_REL16_LO 250 /* half16 (sym+add-.)@l */ #define R_PPC64_REL16_HI 251 /* half16 (sym+add-.)@h */ #define R_PPC64_REL16_HA 252 /* half16 (sym+add-.)@ha */ /* e_flags bits specifying ABI. 1 for original function descriptor using ABI, 2 for revised ABI without function descriptors, 0 for unspecified or not using any features affected by the differences. */ #define EF_PPC64_ABI 3 /* PowerPC64 specific values for the Dyn d_tag field. */ #define DT_PPC64_GLINK (DT_LOPROC + 0) #define DT_PPC64_OPD (DT_LOPROC + 1) #define DT_PPC64_OPDSZ (DT_LOPROC + 2) #define DT_PPC64_OPT (DT_LOPROC + 3) #define DT_PPC64_NUM 4 /* PowerPC64 specific values for the DT_PPC64_OPT Dyn entry. */ #define PPC64_OPT_TLS 1 #define PPC64_OPT_MULTI_TOC 2 /* PowerPC64 specific values for the Elf64_Sym st_other field. */ #define STO_PPC64_LOCAL_BIT 5 #define STO_PPC64_LOCAL_MASK (7 << STO_PPC64_LOCAL_BIT) #define PPC64_LOCAL_ENTRY_OFFSET(other) \ (((1 << (((other) & STO_PPC64_LOCAL_MASK) >> STO_PPC64_LOCAL_BIT)) >> 2) << 2) /* ARM specific declarations */ /* Processor specific flags for the ELF header e_flags field. */ #define EF_ARM_RELEXEC 0x01 #define EF_ARM_HASENTRY 0x02 #define EF_ARM_INTERWORK 0x04 #define EF_ARM_APCS_26 0x08 #define EF_ARM_APCS_FLOAT 0x10 #define EF_ARM_PIC 0x20 #define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use */ #define EF_ARM_NEW_ABI 0x80 #define EF_ARM_OLD_ABI 0x100 #define EF_ARM_SOFT_FLOAT 0x200 #define EF_ARM_VFP_FLOAT 0x400 #define EF_ARM_MAVERICK_FLOAT 0x800 #define EF_ARM_ABI_FLOAT_SOFT 0x200 /* NB conflicts with EF_ARM_SOFT_FLOAT */ #define EF_ARM_ABI_FLOAT_HARD 0x400 /* NB conflicts with EF_ARM_VFP_FLOAT */ /* Other constants defined in the ARM ELF spec. version B-01. */ /* NB. These conflict with values defined above. */ #define EF_ARM_SYMSARESORTED 0x04 #define EF_ARM_DYNSYMSUSESEGIDX 0x08 #define EF_ARM_MAPSYMSFIRST 0x10 #define EF_ARM_EABIMASK 0XFF000000 /* Constants defined in AAELF. */ #define EF_ARM_BE8 0x00800000 #define EF_ARM_LE8 0x00400000 #define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK) #define EF_ARM_EABI_UNKNOWN 0x00000000 #define EF_ARM_EABI_VER1 0x01000000 #define EF_ARM_EABI_VER2 0x02000000 #define EF_ARM_EABI_VER3 0x03000000 #define EF_ARM_EABI_VER4 0x04000000 #define EF_ARM_EABI_VER5 0x05000000 /* Additional symbol types for Thumb. */ #define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */ #define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */ /* ARM-specific values for sh_flags */ #define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */ #define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined in the input to a link step. */ /* ARM-specific program header flags */ #define PF_ARM_SB 0x10000000 /* Segment contains the location addressed by the static base. */ #define PF_ARM_PI 0x20000000 /* Position-independent segment. */ #define PF_ARM_ABS 0x40000000 /* Absolute segment. */ /* Processor specific values for the Phdr p_type field. */ #define PT_ARM_EXIDX (PT_LOPROC + 1) /* ARM unwind segment. */ /* Processor specific values for the Shdr sh_type field. */ #define SHT_ARM_EXIDX (SHT_LOPROC + 1) /* ARM unwind section. */ #define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) /* Preemption details. */ #define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) /* ARM attributes section. */ /* AArch64 relocs. */ #define R_AARCH64_NONE 0 /* No relocation. */ #define R_AARCH64_ABS64 257 /* Direct 64 bit. */ #define R_AARCH64_ABS32 258 /* Direct 32 bit. */ #define R_AARCH64_ABS16 259 /* Direct 16-bit. */ #define R_AARCH64_PREL64 260 /* PC-relative 64-bit. */ #define R_AARCH64_PREL32 261 /* PC-relative 32-bit. */ #define R_AARCH64_PREL16 262 /* PC-relative 16-bit. */ #define R_AARCH64_MOVW_UABS_G0 263 /* Dir. MOVZ imm. from bits 15:0. */ #define R_AARCH64_MOVW_UABS_G0_NC 264 /* Likewise for MOVK; no check. */ #define R_AARCH64_MOVW_UABS_G1 265 /* Dir. MOVZ imm. from bits 31:16. */ #define R_AARCH64_MOVW_UABS_G1_NC 266 /* Likewise for MOVK; no check. */ #define R_AARCH64_MOVW_UABS_G2 267 /* Dir. MOVZ imm. from bits 47:32. */ #define R_AARCH64_MOVW_UABS_G2_NC 268 /* Likewise for MOVK; no check. */ #define R_AARCH64_MOVW_UABS_G3 269 /* Dir. MOV{K,Z} imm. from 63:48. */ #define R_AARCH64_MOVW_SABS_G0 270 /* Dir. MOV{N,Z} imm. from 15:0. */ #define R_AARCH64_MOVW_SABS_G1 271 /* Dir. MOV{N,Z} imm. from 31:16. */ #define R_AARCH64_MOVW_SABS_G2 272 /* Dir. MOV{N,Z} imm. from 47:32. */ #define R_AARCH64_LD_PREL_LO19 273 /* PC-rel. LD imm. from bits 20:2. */ #define R_AARCH64_ADR_PREL_LO21 274 /* PC-rel. ADR imm. from bits 20:0. */ #define R_AARCH64_ADR_PREL_PG_HI21 275 /* Page-rel. ADRP imm. from 32:12. */ #define R_AARCH64_ADR_PREL_PG_HI21_NC 276 /* Likewise; no overflow check. */ #define R_AARCH64_ADD_ABS_LO12_NC 277 /* Dir. ADD imm. from bits 11:0. */ #define R_AARCH64_LDST8_ABS_LO12_NC 278 /* Likewise for LD/ST; no check. */ #define R_AARCH64_TSTBR14 279 /* PC-rel. TBZ/TBNZ imm. from 15:2. */ #define R_AARCH64_CONDBR19 280 /* PC-rel. cond. br. imm. from 20:2. */ #define R_AARCH64_JUMP26 282 /* PC-rel. B imm. from bits 27:2. */ #define R_AARCH64_CALL26 283 /* Likewise for CALL. */ #define R_AARCH64_LDST16_ABS_LO12_NC 284 /* Dir. ADD imm. from bits 11:1. */ #define R_AARCH64_LDST32_ABS_LO12_NC 285 /* Likewise for bits 11:2. */ #define R_AARCH64_LDST64_ABS_LO12_NC 286 /* Likewise for bits 11:3. */ #define R_AARCH64_MOVW_PREL_G0 287 /* PC-rel. MOV{N,Z} imm. from 15:0. */ #define R_AARCH64_MOVW_PREL_G0_NC 288 /* Likewise for MOVK; no check. */ #define R_AARCH64_MOVW_PREL_G1 289 /* PC-rel. MOV{N,Z} imm. from 31:16. */ #define R_AARCH64_MOVW_PREL_G1_NC 290 /* Likewise for MOVK; no check. */ #define R_AARCH64_MOVW_PREL_G2 291 /* PC-rel. MOV{N,Z} imm. from 47:32. */ #define R_AARCH64_MOVW_PREL_G2_NC 292 /* Likewise for MOVK; no check. */ #define R_AARCH64_MOVW_PREL_G3 293 /* PC-rel. MOV{N,Z} imm. from 63:48. */ #define R_AARCH64_LDST128_ABS_LO12_NC 299 /* Dir. ADD imm. from bits 11:4. */ #define R_AARCH64_MOVW_GOTOFF_G0 300 /* GOT-rel. off. MOV{N,Z} imm. 15:0. */ #define R_AARCH64_MOVW_GOTOFF_G0_NC 301 /* Likewise for MOVK; no check. */ #define R_AARCH64_MOVW_GOTOFF_G1 302 /* GOT-rel. o. MOV{N,Z} imm. 31:16. */ #define R_AARCH64_MOVW_GOTOFF_G1_NC 303 /* Likewise for MOVK; no check. */ #define R_AARCH64_MOVW_GOTOFF_G2 304 /* GOT-rel. o. MOV{N,Z} imm. 47:32. */ #define R_AARCH64_MOVW_GOTOFF_G2_NC 305 /* Likewise for MOVK; no check. */ #define R_AARCH64_MOVW_GOTOFF_G3 306 /* GOT-rel. o. MOV{N,Z} imm. 63:48. */ #define R_AARCH64_GOTREL64 307 /* GOT-relative 64-bit. */ #define R_AARCH64_GOTREL32 308 /* GOT-relative 32-bit. */ #define R_AARCH64_GOT_LD_PREL19 309 /* PC-rel. GOT off. load imm. 20:2. */ #define R_AARCH64_LD64_GOTOFF_LO15 310 /* GOT-rel. off. LD/ST imm. 14:3. */ #define R_AARCH64_ADR_GOT_PAGE 311 /* P-page-rel. GOT off. ADRP 32:12. */ #define R_AARCH64_LD64_GOT_LO12_NC 312 /* Dir. GOT off. LD/ST imm. 11:3. */ #define R_AARCH64_LD64_GOTPAGE_LO15 313 /* GOT-page-rel. GOT off. LD/ST 14:3 */ #define R_AARCH64_TLSGD_ADR_PREL21 512 /* PC-relative ADR imm. 20:0. */ #define R_AARCH64_TLSGD_ADR_PAGE21 513 /* page-rel. ADRP imm. 32:12. */ #define R_AARCH64_TLSGD_ADD_LO12_NC 514 /* direct ADD imm. from 11:0. */ #define R_AARCH64_TLSGD_MOVW_G1 515 /* GOT-rel. MOV{N,Z} 31:16. */ #define R_AARCH64_TLSGD_MOVW_G0_NC 516 /* GOT-rel. MOVK imm. 15:0. */ #define R_AARCH64_TLSLD_ADR_PREL21 517 /* Like 512; local dynamic model. */ #define R_AARCH64_TLSLD_ADR_PAGE21 518 /* Like 513; local dynamic model. */ #define R_AARCH64_TLSLD_ADD_LO12_NC 519 /* Like 514; local dynamic model. */ #define R_AARCH64_TLSLD_MOVW_G1 520 /* Like 515; local dynamic model. */ #define R_AARCH64_TLSLD_MOVW_G0_NC 521 /* Like 516; local dynamic model. */ #define R_AARCH64_TLSLD_LD_PREL19 522 /* TLS PC-rel. load imm. 20:2. */ #define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523 /* TLS DTP-rel. MOV{N,Z} 47:32. */ #define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524 /* TLS DTP-rel. MOV{N,Z} 31:16. */ #define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525 /* Likewise; MOVK; no check. */ #define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526 /* TLS DTP-rel. MOV{N,Z} 15:0. */ #define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527 /* Likewise; MOVK; no check. */ #define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528 /* DTP-rel. ADD imm. from 23:12. */ #define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529 /* DTP-rel. ADD imm. from 11:0. */ #define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530 /* Likewise; no ovfl. check. */ #define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531 /* DTP-rel. LD/ST imm. 11:0. */ #define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532 /* Likewise; no check. */ #define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533 /* DTP-rel. LD/ST imm. 11:1. */ #define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534 /* Likewise; no check. */ #define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535 /* DTP-rel. LD/ST imm. 11:2. */ #define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536 /* Likewise; no check. */ #define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537 /* DTP-rel. LD/ST imm. 11:3. */ #define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538 /* Likewise; no check. */ #define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539 /* GOT-rel. MOV{N,Z} 31:16. */ #define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540 /* GOT-rel. MOVK 15:0. */ #define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541 /* Page-rel. ADRP 32:12. */ #define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542 /* Direct LD off. 11:3. */ #define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543 /* PC-rel. load imm. 20:2. */ #define R_AARCH64_TLSLE_MOVW_TPREL_G2 544 /* TLS TP-rel. MOV{N,Z} 47:32. */ #define R_AARCH64_TLSLE_MOVW_TPREL_G1 545 /* TLS TP-rel. MOV{N,Z} 31:16. */ #define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546 /* Likewise; MOVK; no check. */ #define R_AARCH64_TLSLE_MOVW_TPREL_G0 547 /* TLS TP-rel. MOV{N,Z} 15:0. */ #define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548 /* Likewise; MOVK; no check. */ #define R_AARCH64_TLSLE_ADD_TPREL_HI12 549 /* TP-rel. ADD imm. 23:12. */ #define R_AARCH64_TLSLE_ADD_TPREL_LO12 550 /* TP-rel. ADD imm. 11:0. */ #define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551 /* Likewise; no ovfl. check. */ #define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552 /* TP-rel. LD/ST off. 11:0. */ #define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553 /* Likewise; no ovfl. check. */ #define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554 /* TP-rel. LD/ST off. 11:1. */ #define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555 /* Likewise; no check. */ #define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556 /* TP-rel. LD/ST off. 11:2. */ #define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557 /* Likewise; no check. */ #define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558 /* TP-rel. LD/ST off. 11:3. */ #define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559 /* Likewise; no check. */ #define R_AARCH64_TLSDESC_LD_PREL19 560 /* PC-rel. load immediate 20:2. */ #define R_AARCH64_TLSDESC_ADR_PREL21 561 /* PC-rel. ADR immediate 20:0. */ #define R_AARCH64_TLSDESC_ADR_PAGE21 562 /* Page-rel. ADRP imm. 32:12. */ #define R_AARCH64_TLSDESC_LD64_LO12 563 /* Direct LD off. from 11:3. */ #define R_AARCH64_TLSDESC_ADD_LO12 564 /* Direct ADD imm. from 11:0. */ #define R_AARCH64_TLSDESC_OFF_G1 565 /* GOT-rel. MOV{N,Z} imm. 31:16. */ #define R_AARCH64_TLSDESC_OFF_G0_NC 566 /* GOT-rel. MOVK imm. 15:0; no ck. */ #define R_AARCH64_TLSDESC_LDR 567 /* Relax LDR. */ #define R_AARCH64_TLSDESC_ADD 568 /* Relax ADD. */ #define R_AARCH64_TLSDESC_CALL 569 /* Relax BLR. */ #define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570 /* TP-rel. LD/ST off. 11:4. */ #define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571 /* Likewise; no check. */ #define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572 /* DTP-rel. LD/ST imm. 11:4. */ #define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573 /* Likewise; no check. */ #define R_AARCH64_COPY 1024 /* Copy symbol at runtime. */ #define R_AARCH64_GLOB_DAT 1025 /* Create GOT entry. */ #define R_AARCH64_JUMP_SLOT 1026 /* Create PLT entry. */ #define R_AARCH64_RELATIVE 1027 /* Adjust by program base. */ #define R_AARCH64_TLS_DTPMOD64 1028 /* Module number, 64 bit. */ #define R_AARCH64_TLS_DTPREL64 1029 /* Module-relative offset, 64 bit. */ #define R_AARCH64_TLS_TPREL64 1030 /* TP-relative offset, 64 bit. */ #define R_AARCH64_TLSDESC 1031 /* TLS Descriptor. */ #define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */ /* ARM relocs. */ #define R_ARM_NONE 0 /* No reloc */ #define R_ARM_PC24 1 /* PC relative 26 bit branch */ #define R_ARM_ABS32 2 /* Direct 32 bit */ #define R_ARM_REL32 3 /* PC relative 32 bit */ #define R_ARM_PC13 4 #define R_ARM_ABS16 5 /* Direct 16 bit */ #define R_ARM_ABS12 6 /* Direct 12 bit */ #define R_ARM_THM_ABS5 7 #define R_ARM_ABS8 8 /* Direct 8 bit */ #define R_ARM_SBREL32 9 #define R_ARM_THM_PC22 10 #define R_ARM_THM_PC8 11 #define R_ARM_AMP_VCALL9 12 #define R_ARM_SWI24 13 /* Obsolete static relocation. */ #define R_ARM_TLS_DESC 13 /* Dynamic relocation. */ #define R_ARM_THM_SWI8 14 #define R_ARM_XPC25 15 #define R_ARM_THM_XPC22 16 #define R_ARM_TLS_DTPMOD32 17 /* ID of module containing symbol */ #define R_ARM_TLS_DTPOFF32 18 /* Offset in TLS block */ #define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */ #define R_ARM_COPY 20 /* Copy symbol at runtime */ #define R_ARM_GLOB_DAT 21 /* Create GOT entry */ #define R_ARM_JUMP_SLOT 22 /* Create PLT entry */ #define R_ARM_RELATIVE 23 /* Adjust by program base */ #define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */ #define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */ #define R_ARM_GOT32 26 /* 32 bit GOT entry */ #define R_ARM_PLT32 27 /* 32 bit PLT address */ #define R_ARM_ALU_PCREL_7_0 32 #define R_ARM_ALU_PCREL_15_8 33 #define R_ARM_ALU_PCREL_23_15 34 #define R_ARM_LDR_SBREL_11_0 35 #define R_ARM_ALU_SBREL_19_12 36 #define R_ARM_ALU_SBREL_27_20 37 #define R_ARM_TLS_GOTDESC 90 #define R_ARM_TLS_CALL 91 #define R_ARM_TLS_DESCSEQ 92 #define R_ARM_THM_TLS_CALL 93 #define R_ARM_GNU_VTENTRY 100 #define R_ARM_GNU_VTINHERIT 101 #define R_ARM_THM_PC11 102 /* thumb unconditional branch */ #define R_ARM_THM_PC9 103 /* thumb conditional branch */ #define R_ARM_TLS_GD32 104 /* PC-rel 32 bit for global dynamic thread local data */ #define R_ARM_TLS_LDM32 105 /* PC-rel 32 bit for local dynamic thread local data */ #define R_ARM_TLS_LDO32 106 /* 32 bit offset relative to TLS block */ #define R_ARM_TLS_IE32 107 /* PC-rel 32 bit for GOT entry of static TLS block offset */ #define R_ARM_TLS_LE32 108 /* 32 bit offset relative to static TLS block */ #define R_ARM_THM_TLS_DESCSEQ 129 #define R_ARM_IRELATIVE 160 #define R_ARM_RXPC25 249 #define R_ARM_RSBREL32 250 #define R_ARM_THM_RPC22 251 #define R_ARM_RREL32 252 #define R_ARM_RABS22 253 #define R_ARM_RPC24 254 #define R_ARM_RBASE 255 /* Keep this the last entry. */ #define R_ARM_NUM 256 /* IA-64 specific declarations. */ /* Processor specific flags for the Ehdr e_flags field. */ #define EF_IA_64_MASKOS 0x0000000f /* os-specific flags */ #define EF_IA_64_ABI64 0x00000010 /* 64-bit ABI */ #define EF_IA_64_ARCH 0xff000000 /* arch. version mask */ /* Processor specific values for the Phdr p_type field. */ #define PT_IA_64_ARCHEXT (PT_LOPROC + 0) /* arch extension bits */ #define PT_IA_64_UNWIND (PT_LOPROC + 1) /* ia64 unwind bits */ #define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12) #define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13) #define PT_IA_64_HP_STACK (PT_LOOS + 0x14) /* Processor specific flags for the Phdr p_flags field. */ #define PF_IA_64_NORECOV 0x80000000 /* spec insns w/o recovery */ /* Processor specific values for the Shdr sh_type field. */ #define SHT_IA_64_EXT (SHT_LOPROC + 0) /* extension bits */ #define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */ /* Processor specific flags for the Shdr sh_flags field. */ #define SHF_IA_64_SHORT 0x10000000 /* section near gp */ #define SHF_IA_64_NORECOV 0x20000000 /* spec insns w/o recovery */ /* Processor specific values for the Dyn d_tag field. */ #define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0) #define DT_IA_64_NUM 1 /* IA-64 relocations. */ #define R_IA64_NONE 0x00 /* none */ #define R_IA64_IMM14 0x21 /* symbol + addend, add imm14 */ #define R_IA64_IMM22 0x22 /* symbol + addend, add imm22 */ #define R_IA64_IMM64 0x23 /* symbol + addend, mov imm64 */ #define R_IA64_DIR32MSB 0x24 /* symbol + addend, data4 MSB */ #define R_IA64_DIR32LSB 0x25 /* symbol + addend, data4 LSB */ #define R_IA64_DIR64MSB 0x26 /* symbol + addend, data8 MSB */ #define R_IA64_DIR64LSB 0x27 /* symbol + addend, data8 LSB */ #define R_IA64_GPREL22 0x2a /* @gprel(sym + add), add imm22 */ #define R_IA64_GPREL64I 0x2b /* @gprel(sym + add), mov imm64 */ #define R_IA64_GPREL32MSB 0x2c /* @gprel(sym + add), data4 MSB */ #define R_IA64_GPREL32LSB 0x2d /* @gprel(sym + add), data4 LSB */ #define R_IA64_GPREL64MSB 0x2e /* @gprel(sym + add), data8 MSB */ #define R_IA64_GPREL64LSB 0x2f /* @gprel(sym + add), data8 LSB */ #define R_IA64_LTOFF22 0x32 /* @ltoff(sym + add), add imm22 */ #define R_IA64_LTOFF64I 0x33 /* @ltoff(sym + add), mov imm64 */ #define R_IA64_PLTOFF22 0x3a /* @pltoff(sym + add), add imm22 */ #define R_IA64_PLTOFF64I 0x3b /* @pltoff(sym + add), mov imm64 */ #define R_IA64_PLTOFF64MSB 0x3e /* @pltoff(sym + add), data8 MSB */ #define R_IA64_PLTOFF64LSB 0x3f /* @pltoff(sym + add), data8 LSB */ #define R_IA64_FPTR64I 0x43 /* @fptr(sym + add), mov imm64 */ #define R_IA64_FPTR32MSB 0x44 /* @fptr(sym + add), data4 MSB */ #define R_IA64_FPTR32LSB 0x45 /* @fptr(sym + add), data4 LSB */ #define R_IA64_FPTR64MSB 0x46 /* @fptr(sym + add), data8 MSB */ #define R_IA64_FPTR64LSB 0x47 /* @fptr(sym + add), data8 LSB */ #define R_IA64_PCREL60B 0x48 /* @pcrel(sym + add), brl */ #define R_IA64_PCREL21B 0x49 /* @pcrel(sym + add), ptb, call */ #define R_IA64_PCREL21M 0x4a /* @pcrel(sym + add), chk.s */ #define R_IA64_PCREL21F 0x4b /* @pcrel(sym + add), fchkf */ #define R_IA64_PCREL32MSB 0x4c /* @pcrel(sym + add), data4 MSB */ #define R_IA64_PCREL32LSB 0x4d /* @pcrel(sym + add), data4 LSB */ #define R_IA64_PCREL64MSB 0x4e /* @pcrel(sym + add), data8 MSB */ #define R_IA64_PCREL64LSB 0x4f /* @pcrel(sym + add), data8 LSB */ #define R_IA64_LTOFF_FPTR22 0x52 /* @ltoff(@fptr(s+a)), imm22 */ #define R_IA64_LTOFF_FPTR64I 0x53 /* @ltoff(@fptr(s+a)), imm64 */ #define R_IA64_LTOFF_FPTR32MSB 0x54 /* @ltoff(@fptr(s+a)), data4 MSB */ #define R_IA64_LTOFF_FPTR32LSB 0x55 /* @ltoff(@fptr(s+a)), data4 LSB */ #define R_IA64_LTOFF_FPTR64MSB 0x56 /* @ltoff(@fptr(s+a)), data8 MSB */ #define R_IA64_LTOFF_FPTR64LSB 0x57 /* @ltoff(@fptr(s+a)), data8 LSB */ #define R_IA64_SEGREL32MSB 0x5c /* @segrel(sym + add), data4 MSB */ #define R_IA64_SEGREL32LSB 0x5d /* @segrel(sym + add), data4 LSB */ #define R_IA64_SEGREL64MSB 0x5e /* @segrel(sym + add), data8 MSB */ #define R_IA64_SEGREL64LSB 0x5f /* @segrel(sym + add), data8 LSB */ #define R_IA64_SECREL32MSB 0x64 /* @secrel(sym + add), data4 MSB */ #define R_IA64_SECREL32LSB 0x65 /* @secrel(sym + add), data4 LSB */ #define R_IA64_SECREL64MSB 0x66 /* @secrel(sym + add), data8 MSB */ #define R_IA64_SECREL64LSB 0x67 /* @secrel(sym + add), data8 LSB */ #define R_IA64_REL32MSB 0x6c /* data 4 + REL */ #define R_IA64_REL32LSB 0x6d /* data 4 + REL */ #define R_IA64_REL64MSB 0x6e /* data 8 + REL */ #define R_IA64_REL64LSB 0x6f /* data 8 + REL */ #define R_IA64_LTV32MSB 0x74 /* symbol + addend, data4 MSB */ #define R_IA64_LTV32LSB 0x75 /* symbol + addend, data4 LSB */ #define R_IA64_LTV64MSB 0x76 /* symbol + addend, data8 MSB */ #define R_IA64_LTV64LSB 0x77 /* symbol + addend, data8 LSB */ #define R_IA64_PCREL21BI 0x79 /* @pcrel(sym + add), 21bit inst */ #define R_IA64_PCREL22 0x7a /* @pcrel(sym + add), 22bit inst */ #define R_IA64_PCREL64I 0x7b /* @pcrel(sym + add), 64bit inst */ #define R_IA64_IPLTMSB 0x80 /* dynamic reloc, imported PLT, MSB */ #define R_IA64_IPLTLSB 0x81 /* dynamic reloc, imported PLT, LSB */ #define R_IA64_COPY 0x84 /* copy relocation */ #define R_IA64_SUB 0x85 /* Addend and symbol difference */ #define R_IA64_LTOFF22X 0x86 /* LTOFF22, relaxable. */ #define R_IA64_LDXMOV 0x87 /* Use of LTOFF22X. */ #define R_IA64_TPREL14 0x91 /* @tprel(sym + add), imm14 */ #define R_IA64_TPREL22 0x92 /* @tprel(sym + add), imm22 */ #define R_IA64_TPREL64I 0x93 /* @tprel(sym + add), imm64 */ #define R_IA64_TPREL64MSB 0x96 /* @tprel(sym + add), data8 MSB */ #define R_IA64_TPREL64LSB 0x97 /* @tprel(sym + add), data8 LSB */ #define R_IA64_LTOFF_TPREL22 0x9a /* @ltoff(@tprel(s+a)), imm2 */ #define R_IA64_DTPMOD64MSB 0xa6 /* @dtpmod(sym + add), data8 MSB */ #define R_IA64_DTPMOD64LSB 0xa7 /* @dtpmod(sym + add), data8 LSB */ #define R_IA64_LTOFF_DTPMOD22 0xaa /* @ltoff(@dtpmod(sym + add)), imm22 */ #define R_IA64_DTPREL14 0xb1 /* @dtprel(sym + add), imm14 */ #define R_IA64_DTPREL22 0xb2 /* @dtprel(sym + add), imm22 */ #define R_IA64_DTPREL64I 0xb3 /* @dtprel(sym + add), imm64 */ #define R_IA64_DTPREL32MSB 0xb4 /* @dtprel(sym + add), data4 MSB */ #define R_IA64_DTPREL32LSB 0xb5 /* @dtprel(sym + add), data4 LSB */ #define R_IA64_DTPREL64MSB 0xb6 /* @dtprel(sym + add), data8 MSB */ #define R_IA64_DTPREL64LSB 0xb7 /* @dtprel(sym + add), data8 LSB */ #define R_IA64_LTOFF_DTPREL22 0xba /* @ltoff(@dtprel(s+a)), imm22 */ /* SH specific declarations */ /* Processor specific flags for the ELF header e_flags field. */ #define EF_SH_MACH_MASK 0x1f #define EF_SH_UNKNOWN 0x0 #define EF_SH1 0x1 #define EF_SH2 0x2 #define EF_SH3 0x3 #define EF_SH_DSP 0x4 #define EF_SH3_DSP 0x5 #define EF_SH4AL_DSP 0x6 #define EF_SH3E 0x8 #define EF_SH4 0x9 #define EF_SH2E 0xb #define EF_SH4A 0xc #define EF_SH2A 0xd #define EF_SH4_NOFPU 0x10 #define EF_SH4A_NOFPU 0x11 #define EF_SH4_NOMMU_NOFPU 0x12 #define EF_SH2A_NOFPU 0x13 #define EF_SH3_NOMMU 0x14 #define EF_SH2A_SH4_NOFPU 0x15 #define EF_SH2A_SH3_NOFPU 0x16 #define EF_SH2A_SH4 0x17 #define EF_SH2A_SH3E 0x18 /* SH relocs. */ #define R_SH_NONE 0 #define R_SH_DIR32 1 #define R_SH_REL32 2 #define R_SH_DIR8WPN 3 #define R_SH_IND12W 4 #define R_SH_DIR8WPL 5 #define R_SH_DIR8WPZ 6 #define R_SH_DIR8BP 7 #define R_SH_DIR8W 8 #define R_SH_DIR8L 9 #define R_SH_SWITCH16 25 #define R_SH_SWITCH32 26 #define R_SH_USES 27 #define R_SH_COUNT 28 #define R_SH_ALIGN 29 #define R_SH_CODE 30 #define R_SH_DATA 31 #define R_SH_LABEL 32 #define R_SH_SWITCH8 33 #define R_SH_GNU_VTINHERIT 34 #define R_SH_GNU_VTENTRY 35 #define R_SH_TLS_GD_32 144 #define R_SH_TLS_LD_32 145 #define R_SH_TLS_LDO_32 146 #define R_SH_TLS_IE_32 147 #define R_SH_TLS_LE_32 148 #define R_SH_TLS_DTPMOD32 149 #define R_SH_TLS_DTPOFF32 150 #define R_SH_TLS_TPOFF32 151 #define R_SH_GOT32 160 #define R_SH_PLT32 161 #define R_SH_COPY 162 #define R_SH_GLOB_DAT 163 #define R_SH_JMP_SLOT 164 #define R_SH_RELATIVE 165 #define R_SH_GOTOFF 166 #define R_SH_GOTPC 167 /* Keep this the last entry. */ #define R_SH_NUM 256 /* S/390 specific definitions. */ /* Valid values for the e_flags field. */ #define EF_S390_HIGH_GPRS 0x00000001 /* High GPRs kernel facility needed. */ /* Additional s390 relocs */ #define R_390_NONE 0 /* No reloc. */ #define R_390_8 1 /* Direct 8 bit. */ #define R_390_12 2 /* Direct 12 bit. */ #define R_390_16 3 /* Direct 16 bit. */ #define R_390_32 4 /* Direct 32 bit. */ #define R_390_PC32 5 /* PC relative 32 bit. */ #define R_390_GOT12 6 /* 12 bit GOT offset. */ #define R_390_GOT32 7 /* 32 bit GOT offset. */ #define R_390_PLT32 8 /* 32 bit PC relative PLT address. */ #define R_390_COPY 9 /* Copy symbol at runtime. */ #define R_390_GLOB_DAT 10 /* Create GOT entry. */ #define R_390_JMP_SLOT 11 /* Create PLT entry. */ #define R_390_RELATIVE 12 /* Adjust by program base. */ #define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */ #define R_390_GOTPC 14 /* 32 bit PC relative offset to GOT. */ #define R_390_GOT16 15 /* 16 bit GOT offset. */ #define R_390_PC16 16 /* PC relative 16 bit. */ #define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */ #define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */ #define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */ #define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */ #define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */ #define R_390_64 22 /* Direct 64 bit. */ #define R_390_PC64 23 /* PC relative 64 bit. */ #define R_390_GOT64 24 /* 64 bit GOT offset. */ #define R_390_PLT64 25 /* 64 bit PC relative PLT address. */ #define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */ #define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */ #define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */ #define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */ #define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */ #define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */ #define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */ #define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */ #define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */ #define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */ #define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */ #define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */ #define R_390_TLS_GDCALL 38 /* Tag for function call in general dynamic TLS code. */ #define R_390_TLS_LDCALL 39 /* Tag for function call in local dynamic TLS code. */ #define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic thread local data. */ #define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic thread local data. */ #define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS block offset. */ #define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS block offset. */ #define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS block offset. */ #define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic thread local data in LE code. */ #define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic thread local data in LE code. */ #define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for negated static TLS block offset. */ #define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for negated static TLS block offset. */ #define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for negated static TLS block offset. */ #define R_390_TLS_LE32 50 /* 32 bit negated offset relative to static TLS block. */ #define R_390_TLS_LE64 51 /* 64 bit negated offset relative to static TLS block. */ #define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS block. */ #define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS block. */ #define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */ #define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */ #define R_390_TLS_TPOFF 56 /* Negated offset in static TLS block. */ #define R_390_20 57 /* Direct 20 bit. */ #define R_390_GOT20 58 /* 20 bit GOT offset. */ #define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */ #define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS block offset. */ #define R_390_IRELATIVE 61 /* STT_GNU_IFUNC relocation. */ /* Keep this the last entry. */ #define R_390_NUM 62 /* CRIS relocations. */ #define R_CRIS_NONE 0 #define R_CRIS_8 1 #define R_CRIS_16 2 #define R_CRIS_32 3 #define R_CRIS_8_PCREL 4 #define R_CRIS_16_PCREL 5 #define R_CRIS_32_PCREL 6 #define R_CRIS_GNU_VTINHERIT 7 #define R_CRIS_GNU_VTENTRY 8 #define R_CRIS_COPY 9 #define R_CRIS_GLOB_DAT 10 #define R_CRIS_JUMP_SLOT 11 #define R_CRIS_RELATIVE 12 #define R_CRIS_16_GOT 13 #define R_CRIS_32_GOT 14 #define R_CRIS_16_GOTPLT 15 #define R_CRIS_32_GOTPLT 16 #define R_CRIS_32_GOTREL 17 #define R_CRIS_32_PLT_GOTREL 18 #define R_CRIS_32_PLT_PCREL 19 #define R_CRIS_NUM 20 /* AMD x86-64 relocations. */ #define R_X86_64_NONE 0 /* No reloc */ #define R_X86_64_64 1 /* Direct 64 bit */ #define R_X86_64_PC32 2 /* PC relative 32 bit signed */ #define R_X86_64_GOT32 3 /* 32 bit GOT entry */ #define R_X86_64_PLT32 4 /* 32 bit PLT address */ #define R_X86_64_COPY 5 /* Copy symbol at runtime */ #define R_X86_64_GLOB_DAT 6 /* Create GOT entry */ #define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */ #define R_X86_64_RELATIVE 8 /* Adjust by program base */ #define R_X86_64_GOTPCREL 9 /* 32 bit signed PC relative offset to GOT */ #define R_X86_64_32 10 /* Direct 32 bit zero extended */ #define R_X86_64_32S 11 /* Direct 32 bit sign extended */ #define R_X86_64_16 12 /* Direct 16 bit zero extended */ #define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */ #define R_X86_64_8 14 /* Direct 8 bit sign extended */ #define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */ #define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */ #define R_X86_64_DTPOFF64 17 /* Offset in module's TLS block */ #define R_X86_64_TPOFF64 18 /* Offset in initial TLS block */ #define R_X86_64_TLSGD 19 /* 32 bit signed PC relative offset to two GOT entries for GD symbol */ #define R_X86_64_TLSLD 20 /* 32 bit signed PC relative offset to two GOT entries for LD symbol */ #define R_X86_64_DTPOFF32 21 /* Offset in TLS block */ #define R_X86_64_GOTTPOFF 22 /* 32 bit signed PC relative offset to GOT entry for IE symbol */ #define R_X86_64_TPOFF32 23 /* Offset in initial TLS block */ #define R_X86_64_PC64 24 /* PC relative 64 bit */ #define R_X86_64_GOTOFF64 25 /* 64 bit offset to GOT */ #define R_X86_64_GOTPC32 26 /* 32 bit signed pc relative offset to GOT */ #define R_X86_64_GOT64 27 /* 64-bit GOT entry offset */ #define R_X86_64_GOTPCREL64 28 /* 64-bit PC relative offset to GOT entry */ #define R_X86_64_GOTPC64 29 /* 64-bit PC relative offset to GOT */ #define R_X86_64_GOTPLT64 30 /* like GOT64, says PLT entry needed */ #define R_X86_64_PLTOFF64 31 /* 64-bit GOT relative offset to PLT entry */ #define R_X86_64_SIZE32 32 /* Size of symbol plus 32-bit addend */ #define R_X86_64_SIZE64 33 /* Size of symbol plus 64-bit addend */ #define R_X86_64_GOTPC32_TLSDESC 34 /* GOT offset for TLS descriptor. */ #define R_X86_64_TLSDESC_CALL 35 /* Marker for call through TLS descriptor. */ #define R_X86_64_TLSDESC 36 /* TLS descriptor. */ #define R_X86_64_IRELATIVE 37 /* Adjust indirectly by program base */ #define R_X86_64_RELATIVE64 38 /* 64-bit adjust by program base */ #define R_X86_64_NUM 39 /* AM33 relocations. */ #define R_MN10300_NONE 0 /* No reloc. */ #define R_MN10300_32 1 /* Direct 32 bit. */ #define R_MN10300_16 2 /* Direct 16 bit. */ #define R_MN10300_8 3 /* Direct 8 bit. */ #define R_MN10300_PCREL32 4 /* PC-relative 32-bit. */ #define R_MN10300_PCREL16 5 /* PC-relative 16-bit signed. */ #define R_MN10300_PCREL8 6 /* PC-relative 8-bit signed. */ #define R_MN10300_GNU_VTINHERIT 7 /* Ancient C++ vtable garbage... */ #define R_MN10300_GNU_VTENTRY 8 /* ... collection annotation. */ #define R_MN10300_24 9 /* Direct 24 bit. */ #define R_MN10300_GOTPC32 10 /* 32-bit PCrel offset to GOT. */ #define R_MN10300_GOTPC16 11 /* 16-bit PCrel offset to GOT. */ #define R_MN10300_GOTOFF32 12 /* 32-bit offset from GOT. */ #define R_MN10300_GOTOFF24 13 /* 24-bit offset from GOT. */ #define R_MN10300_GOTOFF16 14 /* 16-bit offset from GOT. */ #define R_MN10300_PLT32 15 /* 32-bit PCrel to PLT entry. */ #define R_MN10300_PLT16 16 /* 16-bit PCrel to PLT entry. */ #define R_MN10300_GOT32 17 /* 32-bit offset to GOT entry. */ #define R_MN10300_GOT24 18 /* 24-bit offset to GOT entry. */ #define R_MN10300_GOT16 19 /* 16-bit offset to GOT entry. */ #define R_MN10300_COPY 20 /* Copy symbol at runtime. */ #define R_MN10300_GLOB_DAT 21 /* Create GOT entry. */ #define R_MN10300_JMP_SLOT 22 /* Create PLT entry. */ #define R_MN10300_RELATIVE 23 /* Adjust by program base. */ #define R_MN10300_TLS_GD 24 /* 32-bit offset for global dynamic. */ #define R_MN10300_TLS_LD 25 /* 32-bit offset for local dynamic. */ #define R_MN10300_TLS_LDO 26 /* Module-relative offset. */ #define R_MN10300_TLS_GOTIE 27 /* GOT offset for static TLS block offset. */ #define R_MN10300_TLS_IE 28 /* GOT address for static TLS block offset. */ #define R_MN10300_TLS_LE 29 /* Offset relative to static TLS block. */ #define R_MN10300_TLS_DTPMOD 30 /* ID of module containing symbol. */ #define R_MN10300_TLS_DTPOFF 31 /* Offset in module TLS block. */ #define R_MN10300_TLS_TPOFF 32 /* Offset in static TLS block. */ #define R_MN10300_SYM_DIFF 33 /* Adjustment for next reloc as needed by linker relaxation. */ #define R_MN10300_ALIGN 34 /* Alignment requirement for linker relaxation. */ #define R_MN10300_NUM 35 /* M32R relocs. */ #define R_M32R_NONE 0 /* No reloc. */ #define R_M32R_16 1 /* Direct 16 bit. */ #define R_M32R_32 2 /* Direct 32 bit. */ #define R_M32R_24 3 /* Direct 24 bit. */ #define R_M32R_10_PCREL 4 /* PC relative 10 bit shifted. */ #define R_M32R_18_PCREL 5 /* PC relative 18 bit shifted. */ #define R_M32R_26_PCREL 6 /* PC relative 26 bit shifted. */ #define R_M32R_HI16_ULO 7 /* High 16 bit with unsigned low. */ #define R_M32R_HI16_SLO 8 /* High 16 bit with signed low. */ #define R_M32R_LO16 9 /* Low 16 bit. */ #define R_M32R_SDA16 10 /* 16 bit offset in SDA. */ #define R_M32R_GNU_VTINHERIT 11 #define R_M32R_GNU_VTENTRY 12 /* M32R relocs use SHT_RELA. */ #define R_M32R_16_RELA 33 /* Direct 16 bit. */ #define R_M32R_32_RELA 34 /* Direct 32 bit. */ #define R_M32R_24_RELA 35 /* Direct 24 bit. */ #define R_M32R_10_PCREL_RELA 36 /* PC relative 10 bit shifted. */ #define R_M32R_18_PCREL_RELA 37 /* PC relative 18 bit shifted. */ #define R_M32R_26_PCREL_RELA 38 /* PC relative 26 bit shifted. */ #define R_M32R_HI16_ULO_RELA 39 /* High 16 bit with unsigned low */ #define R_M32R_HI16_SLO_RELA 40 /* High 16 bit with signed low */ #define R_M32R_LO16_RELA 41 /* Low 16 bit */ #define R_M32R_SDA16_RELA 42 /* 16 bit offset in SDA */ #define R_M32R_RELA_GNU_VTINHERIT 43 #define R_M32R_RELA_GNU_VTENTRY 44 #define R_M32R_REL32 45 /* PC relative 32 bit. */ #define R_M32R_GOT24 48 /* 24 bit GOT entry */ #define R_M32R_26_PLTREL 49 /* 26 bit PC relative to PLT shifted */ #define R_M32R_COPY 50 /* Copy symbol at runtime */ #define R_M32R_GLOB_DAT 51 /* Create GOT entry */ #define R_M32R_JMP_SLOT 52 /* Create PLT entry */ #define R_M32R_RELATIVE 53 /* Adjust by program base */ #define R_M32R_GOTOFF 54 /* 24 bit offset to GOT */ #define R_M32R_GOTPC24 55 /* 24 bit PC relative offset to GOT */ #define R_M32R_GOT16_HI_ULO 56 /* High 16 bit GOT entry with unsigned low */ #define R_M32R_GOT16_HI_SLO 57 /* High 16 bit GOT entry with signed low */ #define R_M32R_GOT16_LO 58 /* Low 16 bit GOT entry */ #define R_M32R_GOTPC_HI_ULO 59 /* High 16 bit PC relative offset to GOT with unsigned low */ #define R_M32R_GOTPC_HI_SLO 60 /* High 16 bit PC relative offset to GOT with signed low */ #define R_M32R_GOTPC_LO 61 /* Low 16 bit PC relative offset to GOT */ #define R_M32R_GOTOFF_HI_ULO 62 /* High 16 bit offset to GOT with unsigned low */ #define R_M32R_GOTOFF_HI_SLO 63 /* High 16 bit offset to GOT with signed low */ #define R_M32R_GOTOFF_LO 64 /* Low 16 bit offset to GOT */ #define R_M32R_NUM 256 /* Keep this the last entry. */ /* TILEPro relocations. */ #define R_TILEPRO_NONE 0 /* No reloc */ #define R_TILEPRO_32 1 /* Direct 32 bit */ #define R_TILEPRO_16 2 /* Direct 16 bit */ #define R_TILEPRO_8 3 /* Direct 8 bit */ #define R_TILEPRO_32_PCREL 4 /* PC relative 32 bit */ #define R_TILEPRO_16_PCREL 5 /* PC relative 16 bit */ #define R_TILEPRO_8_PCREL 6 /* PC relative 8 bit */ #define R_TILEPRO_LO16 7 /* Low 16 bit */ #define R_TILEPRO_HI16 8 /* High 16 bit */ #define R_TILEPRO_HA16 9 /* High 16 bit, adjusted */ #define R_TILEPRO_COPY 10 /* Copy relocation */ #define R_TILEPRO_GLOB_DAT 11 /* Create GOT entry */ #define R_TILEPRO_JMP_SLOT 12 /* Create PLT entry */ #define R_TILEPRO_RELATIVE 13 /* Adjust by program base */ #define R_TILEPRO_BROFF_X1 14 /* X1 pipe branch offset */ #define R_TILEPRO_JOFFLONG_X1 15 /* X1 pipe jump offset */ #define R_TILEPRO_JOFFLONG_X1_PLT 16 /* X1 pipe jump offset to PLT */ #define R_TILEPRO_IMM8_X0 17 /* X0 pipe 8-bit */ #define R_TILEPRO_IMM8_Y0 18 /* Y0 pipe 8-bit */ #define R_TILEPRO_IMM8_X1 19 /* X1 pipe 8-bit */ #define R_TILEPRO_IMM8_Y1 20 /* Y1 pipe 8-bit */ #define R_TILEPRO_MT_IMM15_X1 21 /* X1 pipe mtspr */ #define R_TILEPRO_MF_IMM15_X1 22 /* X1 pipe mfspr */ #define R_TILEPRO_IMM16_X0 23 /* X0 pipe 16-bit */ #define R_TILEPRO_IMM16_X1 24 /* X1 pipe 16-bit */ #define R_TILEPRO_IMM16_X0_LO 25 /* X0 pipe low 16-bit */ #define R_TILEPRO_IMM16_X1_LO 26 /* X1 pipe low 16-bit */ #define R_TILEPRO_IMM16_X0_HI 27 /* X0 pipe high 16-bit */ #define R_TILEPRO_IMM16_X1_HI 28 /* X1 pipe high 16-bit */ #define R_TILEPRO_IMM16_X0_HA 29 /* X0 pipe high 16-bit, adjusted */ #define R_TILEPRO_IMM16_X1_HA 30 /* X1 pipe high 16-bit, adjusted */ #define R_TILEPRO_IMM16_X0_PCREL 31 /* X0 pipe PC relative 16 bit */ #define R_TILEPRO_IMM16_X1_PCREL 32 /* X1 pipe PC relative 16 bit */ #define R_TILEPRO_IMM16_X0_LO_PCREL 33 /* X0 pipe PC relative low 16 bit */ #define R_TILEPRO_IMM16_X1_LO_PCREL 34 /* X1 pipe PC relative low 16 bit */ #define R_TILEPRO_IMM16_X0_HI_PCREL 35 /* X0 pipe PC relative high 16 bit */ #define R_TILEPRO_IMM16_X1_HI_PCREL 36 /* X1 pipe PC relative high 16 bit */ #define R_TILEPRO_IMM16_X0_HA_PCREL 37 /* X0 pipe PC relative ha() 16 bit */ #define R_TILEPRO_IMM16_X1_HA_PCREL 38 /* X1 pipe PC relative ha() 16 bit */ #define R_TILEPRO_IMM16_X0_GOT 39 /* X0 pipe 16-bit GOT offset */ #define R_TILEPRO_IMM16_X1_GOT 40 /* X1 pipe 16-bit GOT offset */ #define R_TILEPRO_IMM16_X0_GOT_LO 41 /* X0 pipe low 16-bit GOT offset */ #define R_TILEPRO_IMM16_X1_GOT_LO 42 /* X1 pipe low 16-bit GOT offset */ #define R_TILEPRO_IMM16_X0_GOT_HI 43 /* X0 pipe high 16-bit GOT offset */ #define R_TILEPRO_IMM16_X1_GOT_HI 44 /* X1 pipe high 16-bit GOT offset */ #define R_TILEPRO_IMM16_X0_GOT_HA 45 /* X0 pipe ha() 16-bit GOT offset */ #define R_TILEPRO_IMM16_X1_GOT_HA 46 /* X1 pipe ha() 16-bit GOT offset */ #define R_TILEPRO_MMSTART_X0 47 /* X0 pipe mm "start" */ #define R_TILEPRO_MMEND_X0 48 /* X0 pipe mm "end" */ #define R_TILEPRO_MMSTART_X1 49 /* X1 pipe mm "start" */ #define R_TILEPRO_MMEND_X1 50 /* X1 pipe mm "end" */ #define R_TILEPRO_SHAMT_X0 51 /* X0 pipe shift amount */ #define R_TILEPRO_SHAMT_X1 52 /* X1 pipe shift amount */ #define R_TILEPRO_SHAMT_Y0 53 /* Y0 pipe shift amount */ #define R_TILEPRO_SHAMT_Y1 54 /* Y1 pipe shift amount */ #define R_TILEPRO_DEST_IMM8_X1 55 /* X1 pipe destination 8-bit */ /* Relocs 56-59 are currently not defined. */ #define R_TILEPRO_TLS_GD_CALL 60 /* "jal" for TLS GD */ #define R_TILEPRO_IMM8_X0_TLS_GD_ADD 61 /* X0 pipe "addi" for TLS GD */ #define R_TILEPRO_IMM8_X1_TLS_GD_ADD 62 /* X1 pipe "addi" for TLS GD */ #define R_TILEPRO_IMM8_Y0_TLS_GD_ADD 63 /* Y0 pipe "addi" for TLS GD */ #define R_TILEPRO_IMM8_Y1_TLS_GD_ADD 64 /* Y1 pipe "addi" for TLS GD */ #define R_TILEPRO_TLS_IE_LOAD 65 /* "lw_tls" for TLS IE */ #define R_TILEPRO_IMM16_X0_TLS_GD 66 /* X0 pipe 16-bit TLS GD offset */ #define R_TILEPRO_IMM16_X1_TLS_GD 67 /* X1 pipe 16-bit TLS GD offset */ #define R_TILEPRO_IMM16_X0_TLS_GD_LO 68 /* X0 pipe low 16-bit TLS GD offset */ #define R_TILEPRO_IMM16_X1_TLS_GD_LO 69 /* X1 pipe low 16-bit TLS GD offset */ #define R_TILEPRO_IMM16_X0_TLS_GD_HI 70 /* X0 pipe high 16-bit TLS GD offset */ #define R_TILEPRO_IMM16_X1_TLS_GD_HI 71 /* X1 pipe high 16-bit TLS GD offset */ #define R_TILEPRO_IMM16_X0_TLS_GD_HA 72 /* X0 pipe ha() 16-bit TLS GD offset */ #define R_TILEPRO_IMM16_X1_TLS_GD_HA 73 /* X1 pipe ha() 16-bit TLS GD offset */ #define R_TILEPRO_IMM16_X0_TLS_IE 74 /* X0 pipe 16-bit TLS IE offset */ #define R_TILEPRO_IMM16_X1_TLS_IE 75 /* X1 pipe 16-bit TLS IE offset */ #define R_TILEPRO_IMM16_X0_TLS_IE_LO 76 /* X0 pipe low 16-bit TLS IE offset */ #define R_TILEPRO_IMM16_X1_TLS_IE_LO 77 /* X1 pipe low 16-bit TLS IE offset */ #define R_TILEPRO_IMM16_X0_TLS_IE_HI 78 /* X0 pipe high 16-bit TLS IE offset */ #define R_TILEPRO_IMM16_X1_TLS_IE_HI 79 /* X1 pipe high 16-bit TLS IE offset */ #define R_TILEPRO_IMM16_X0_TLS_IE_HA 80 /* X0 pipe ha() 16-bit TLS IE offset */ #define R_TILEPRO_IMM16_X1_TLS_IE_HA 81 /* X1 pipe ha() 16-bit TLS IE offset */ #define R_TILEPRO_TLS_DTPMOD32 82 /* ID of module containing symbol */ #define R_TILEPRO_TLS_DTPOFF32 83 /* Offset in TLS block */ #define R_TILEPRO_TLS_TPOFF32 84 /* Offset in static TLS block */ #define R_TILEPRO_IMM16_X0_TLS_LE 85 /* X0 pipe 16-bit TLS LE offset */ #define R_TILEPRO_IMM16_X1_TLS_LE 86 /* X1 pipe 16-bit TLS LE offset */ #define R_TILEPRO_IMM16_X0_TLS_LE_LO 87 /* X0 pipe low 16-bit TLS LE offset */ #define R_TILEPRO_IMM16_X1_TLS_LE_LO 88 /* X1 pipe low 16-bit TLS LE offset */ #define R_TILEPRO_IMM16_X0_TLS_LE_HI 89 /* X0 pipe high 16-bit TLS LE offset */ #define R_TILEPRO_IMM16_X1_TLS_LE_HI 90 /* X1 pipe high 16-bit TLS LE offset */ #define R_TILEPRO_IMM16_X0_TLS_LE_HA 91 /* X0 pipe ha() 16-bit TLS LE offset */ #define R_TILEPRO_IMM16_X1_TLS_LE_HA 92 /* X1 pipe ha() 16-bit TLS LE offset */ #define R_TILEPRO_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */ #define R_TILEPRO_GNU_VTENTRY 129 /* GNU C++ vtable member usage */ #define R_TILEPRO_NUM 130 /* TILE-Gx relocations. */ #define R_TILEGX_NONE 0 /* No reloc */ #define R_TILEGX_64 1 /* Direct 64 bit */ #define R_TILEGX_32 2 /* Direct 32 bit */ #define R_TILEGX_16 3 /* Direct 16 bit */ #define R_TILEGX_8 4 /* Direct 8 bit */ #define R_TILEGX_64_PCREL 5 /* PC relative 64 bit */ #define R_TILEGX_32_PCREL 6 /* PC relative 32 bit */ #define R_TILEGX_16_PCREL 7 /* PC relative 16 bit */ #define R_TILEGX_8_PCREL 8 /* PC relative 8 bit */ #define R_TILEGX_HW0 9 /* hword 0 16-bit */ #define R_TILEGX_HW1 10 /* hword 1 16-bit */ #define R_TILEGX_HW2 11 /* hword 2 16-bit */ #define R_TILEGX_HW3 12 /* hword 3 16-bit */ #define R_TILEGX_HW0_LAST 13 /* last hword 0 16-bit */ #define R_TILEGX_HW1_LAST 14 /* last hword 1 16-bit */ #define R_TILEGX_HW2_LAST 15 /* last hword 2 16-bit */ #define R_TILEGX_COPY 16 /* Copy relocation */ #define R_TILEGX_GLOB_DAT 17 /* Create GOT entry */ #define R_TILEGX_JMP_SLOT 18 /* Create PLT entry */ #define R_TILEGX_RELATIVE 19 /* Adjust by program base */ #define R_TILEGX_BROFF_X1 20 /* X1 pipe branch offset */ #define R_TILEGX_JUMPOFF_X1 21 /* X1 pipe jump offset */ #define R_TILEGX_JUMPOFF_X1_PLT 22 /* X1 pipe jump offset to PLT */ #define R_TILEGX_IMM8_X0 23 /* X0 pipe 8-bit */ #define R_TILEGX_IMM8_Y0 24 /* Y0 pipe 8-bit */ #define R_TILEGX_IMM8_X1 25 /* X1 pipe 8-bit */ #define R_TILEGX_IMM8_Y1 26 /* Y1 pipe 8-bit */ #define R_TILEGX_DEST_IMM8_X1 27 /* X1 pipe destination 8-bit */ #define R_TILEGX_MT_IMM14_X1 28 /* X1 pipe mtspr */ #define R_TILEGX_MF_IMM14_X1 29 /* X1 pipe mfspr */ #define R_TILEGX_MMSTART_X0 30 /* X0 pipe mm "start" */ #define R_TILEGX_MMEND_X0 31 /* X0 pipe mm "end" */ #define R_TILEGX_SHAMT_X0 32 /* X0 pipe shift amount */ #define R_TILEGX_SHAMT_X1 33 /* X1 pipe shift amount */ #define R_TILEGX_SHAMT_Y0 34 /* Y0 pipe shift amount */ #define R_TILEGX_SHAMT_Y1 35 /* Y1 pipe shift amount */ #define R_TILEGX_IMM16_X0_HW0 36 /* X0 pipe hword 0 */ #define R_TILEGX_IMM16_X1_HW0 37 /* X1 pipe hword 0 */ #define R_TILEGX_IMM16_X0_HW1 38 /* X0 pipe hword 1 */ #define R_TILEGX_IMM16_X1_HW1 39 /* X1 pipe hword 1 */ #define R_TILEGX_IMM16_X0_HW2 40 /* X0 pipe hword 2 */ #define R_TILEGX_IMM16_X1_HW2 41 /* X1 pipe hword 2 */ #define R_TILEGX_IMM16_X0_HW3 42 /* X0 pipe hword 3 */ #define R_TILEGX_IMM16_X1_HW3 43 /* X1 pipe hword 3 */ #define R_TILEGX_IMM16_X0_HW0_LAST 44 /* X0 pipe last hword 0 */ #define R_TILEGX_IMM16_X1_HW0_LAST 45 /* X1 pipe last hword 0 */ #define R_TILEGX_IMM16_X0_HW1_LAST 46 /* X0 pipe last hword 1 */ #define R_TILEGX_IMM16_X1_HW1_LAST 47 /* X1 pipe last hword 1 */ #define R_TILEGX_IMM16_X0_HW2_LAST 48 /* X0 pipe last hword 2 */ #define R_TILEGX_IMM16_X1_HW2_LAST 49 /* X1 pipe last hword 2 */ #define R_TILEGX_IMM16_X0_HW0_PCREL 50 /* X0 pipe PC relative hword 0 */ #define R_TILEGX_IMM16_X1_HW0_PCREL 51 /* X1 pipe PC relative hword 0 */ #define R_TILEGX_IMM16_X0_HW1_PCREL 52 /* X0 pipe PC relative hword 1 */ #define R_TILEGX_IMM16_X1_HW1_PCREL 53 /* X1 pipe PC relative hword 1 */ #define R_TILEGX_IMM16_X0_HW2_PCREL 54 /* X0 pipe PC relative hword 2 */ #define R_TILEGX_IMM16_X1_HW2_PCREL 55 /* X1 pipe PC relative hword 2 */ #define R_TILEGX_IMM16_X0_HW3_PCREL 56 /* X0 pipe PC relative hword 3 */ #define R_TILEGX_IMM16_X1_HW3_PCREL 57 /* X1 pipe PC relative hword 3 */ #define R_TILEGX_IMM16_X0_HW0_LAST_PCREL 58 /* X0 pipe PC-rel last hword 0 */ #define R_TILEGX_IMM16_X1_HW0_LAST_PCREL 59 /* X1 pipe PC-rel last hword 0 */ #define R_TILEGX_IMM16_X0_HW1_LAST_PCREL 60 /* X0 pipe PC-rel last hword 1 */ #define R_TILEGX_IMM16_X1_HW1_LAST_PCREL 61 /* X1 pipe PC-rel last hword 1 */ #define R_TILEGX_IMM16_X0_HW2_LAST_PCREL 62 /* X0 pipe PC-rel last hword 2 */ #define R_TILEGX_IMM16_X1_HW2_LAST_PCREL 63 /* X1 pipe PC-rel last hword 2 */ #define R_TILEGX_IMM16_X0_HW0_GOT 64 /* X0 pipe hword 0 GOT offset */ #define R_TILEGX_IMM16_X1_HW0_GOT 65 /* X1 pipe hword 0 GOT offset */ #define R_TILEGX_IMM16_X0_HW0_PLT_PCREL 66 /* X0 pipe PC-rel PLT hword 0 */ #define R_TILEGX_IMM16_X1_HW0_PLT_PCREL 67 /* X1 pipe PC-rel PLT hword 0 */ #define R_TILEGX_IMM16_X0_HW1_PLT_PCREL 68 /* X0 pipe PC-rel PLT hword 1 */ #define R_TILEGX_IMM16_X1_HW1_PLT_PCREL 69 /* X1 pipe PC-rel PLT hword 1 */ #define R_TILEGX_IMM16_X0_HW2_PLT_PCREL 70 /* X0 pipe PC-rel PLT hword 2 */ #define R_TILEGX_IMM16_X1_HW2_PLT_PCREL 71 /* X1 pipe PC-rel PLT hword 2 */ #define R_TILEGX_IMM16_X0_HW0_LAST_GOT 72 /* X0 pipe last hword 0 GOT offset */ #define R_TILEGX_IMM16_X1_HW0_LAST_GOT 73 /* X1 pipe last hword 0 GOT offset */ #define R_TILEGX_IMM16_X0_HW1_LAST_GOT 74 /* X0 pipe last hword 1 GOT offset */ #define R_TILEGX_IMM16_X1_HW1_LAST_GOT 75 /* X1 pipe last hword 1 GOT offset */ #define R_TILEGX_IMM16_X0_HW3_PLT_PCREL 76 /* X0 pipe PC-rel PLT hword 3 */ #define R_TILEGX_IMM16_X1_HW3_PLT_PCREL 77 /* X1 pipe PC-rel PLT hword 3 */ #define R_TILEGX_IMM16_X0_HW0_TLS_GD 78 /* X0 pipe hword 0 TLS GD offset */ #define R_TILEGX_IMM16_X1_HW0_TLS_GD 79 /* X1 pipe hword 0 TLS GD offset */ #define R_TILEGX_IMM16_X0_HW0_TLS_LE 80 /* X0 pipe hword 0 TLS LE offset */ #define R_TILEGX_IMM16_X1_HW0_TLS_LE 81 /* X1 pipe hword 0 TLS LE offset */ #define R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE 82 /* X0 pipe last hword 0 LE off */ #define R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE 83 /* X1 pipe last hword 0 LE off */ #define R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE 84 /* X0 pipe last hword 1 LE off */ #define R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE 85 /* X1 pipe last hword 1 LE off */ #define R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD 86 /* X0 pipe last hword 0 GD off */ #define R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD 87 /* X1 pipe last hword 0 GD off */ #define R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD 88 /* X0 pipe last hword 1 GD off */ #define R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD 89 /* X1 pipe last hword 1 GD off */ /* Relocs 90-91 are currently not defined. */ #define R_TILEGX_IMM16_X0_HW0_TLS_IE 92 /* X0 pipe hword 0 TLS IE offset */ #define R_TILEGX_IMM16_X1_HW0_TLS_IE 93 /* X1 pipe hword 0 TLS IE offset */ #define R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL 94 /* X0 pipe PC-rel PLT last hword 0 */ #define R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL 95 /* X1 pipe PC-rel PLT last hword 0 */ #define R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL 96 /* X0 pipe PC-rel PLT last hword 1 */ #define R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL 97 /* X1 pipe PC-rel PLT last hword 1 */ #define R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL 98 /* X0 pipe PC-rel PLT last hword 2 */ #define R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL 99 /* X1 pipe PC-rel PLT last hword 2 */ #define R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE 100 /* X0 pipe last hword 0 IE off */ #define R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE 101 /* X1 pipe last hword 0 IE off */ #define R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE 102 /* X0 pipe last hword 1 IE off */ #define R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE 103 /* X1 pipe last hword 1 IE off */ /* Relocs 104-105 are currently not defined. */ #define R_TILEGX_TLS_DTPMOD64 106 /* 64-bit ID of symbol's module */ #define R_TILEGX_TLS_DTPOFF64 107 /* 64-bit offset in TLS block */ #define R_TILEGX_TLS_TPOFF64 108 /* 64-bit offset in static TLS block */ #define R_TILEGX_TLS_DTPMOD32 109 /* 32-bit ID of symbol's module */ #define R_TILEGX_TLS_DTPOFF32 110 /* 32-bit offset in TLS block */ #define R_TILEGX_TLS_TPOFF32 111 /* 32-bit offset in static TLS block */ #define R_TILEGX_TLS_GD_CALL 112 /* "jal" for TLS GD */ #define R_TILEGX_IMM8_X0_TLS_GD_ADD 113 /* X0 pipe "addi" for TLS GD */ #define R_TILEGX_IMM8_X1_TLS_GD_ADD 114 /* X1 pipe "addi" for TLS GD */ #define R_TILEGX_IMM8_Y0_TLS_GD_ADD 115 /* Y0 pipe "addi" for TLS GD */ #define R_TILEGX_IMM8_Y1_TLS_GD_ADD 116 /* Y1 pipe "addi" for TLS GD */ #define R_TILEGX_TLS_IE_LOAD 117 /* "ld_tls" for TLS IE */ #define R_TILEGX_IMM8_X0_TLS_ADD 118 /* X0 pipe "addi" for TLS GD/IE */ #define R_TILEGX_IMM8_X1_TLS_ADD 119 /* X1 pipe "addi" for TLS GD/IE */ #define R_TILEGX_IMM8_Y0_TLS_ADD 120 /* Y0 pipe "addi" for TLS GD/IE */ #define R_TILEGX_IMM8_Y1_TLS_ADD 121 /* Y1 pipe "addi" for TLS GD/IE */ #define R_TILEGX_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */ #define R_TILEGX_GNU_VTENTRY 129 /* GNU C++ vtable member usage */ #define R_TILEGX_NUM 130 __END_DECLS #endif /* elf.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gd_io.h���������������������������������������������������������������������������������������������0000644�����������������00000002202�14763166030�0006000 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifdef __cplusplus extern "C" { #endif #ifndef GD_IO_H #define GD_IO_H 1 #include <stdio.h> #ifdef VMS #define Putchar gdPutchar #endif typedef struct gdIOCtx { int (*getC) (struct gdIOCtx *); int (*getBuf) (struct gdIOCtx *, void *, int); void (*putC) (struct gdIOCtx *, int); int (*putBuf) (struct gdIOCtx *, const void *, int); /* seek must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek! */ int (*seek) (struct gdIOCtx *, const int); long (*tell) (struct gdIOCtx *); void (*gd_free) (struct gdIOCtx *); } gdIOCtx; typedef struct gdIOCtx *gdIOCtxPtr; void Putword (int w, gdIOCtx * ctx); void Putchar (int c, gdIOCtx * ctx); void gdPutC (const unsigned char c, gdIOCtx * ctx); int gdPutBuf (const void *, int, gdIOCtx *); void gdPutWord (int w, gdIOCtx * ctx); void gdPutInt (int w, gdIOCtx * ctx); int gdGetC (gdIOCtx * ctx); int gdGetBuf (void *, int, gdIOCtx *); int gdGetByte (int *result, gdIOCtx * ctx); int gdGetWord (int *result, gdIOCtx * ctx); int gdGetInt (int *result, gdIOCtx * ctx); int gdSeek (gdIOCtx * ctx, const int offset); long gdTell (gdIOCtx * ctx); #endif #ifdef __cplusplus } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������expat_external.h������������������������������������������������������������������������������������0000644�����������������00000006444�14763166030�0007756 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ #ifndef Expat_External_INCLUDED #define Expat_External_INCLUDED 1 /* External API definitions */ #if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) #define XML_USE_MSC_EXTENSIONS 1 #endif /* Expat tries very hard to make the API boundary very specifically defined. There are two macros defined to control this boundary; each of these can be defined before including this header to achieve some different behavior, but doing so it not recommended or tested frequently. XMLCALL - The calling convention to use for all calls across the "library boundary." This will default to cdecl, and try really hard to tell the compiler that's what we want. XMLIMPORT - Whatever magic is needed to note that a function is to be imported from a dynamically loaded library (.dll, .so, or .sl, depending on your platform). The XMLCALL macro was added in Expat 1.95.7. The only one which is expected to be directly useful in client code is XMLCALL. Note that on at least some Unix versions, the Expat library must be compiled with the cdecl calling convention as the default since system headers may assume the cdecl convention. */ #ifndef XMLCALL #if defined(_MSC_VER) #define XMLCALL __cdecl #elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER) #define XMLCALL __attribute__((cdecl)) #else /* For any platform which uses this definition and supports more than one calling convention, we need to extend this definition to declare the convention used on that platform, if it's possible to do so. If this is the case for your platform, please file a bug report with information on how to identify your platform via the C pre-processor and how to specify the same calling convention as the platform's malloc() implementation. */ #define XMLCALL #endif #endif /* not defined XMLCALL */ #if !defined(XML_STATIC) && !defined(XMLIMPORT) #ifndef XML_BUILDING_EXPAT /* using Expat from an application */ #ifdef XML_USE_MSC_EXTENSIONS #define XMLIMPORT __declspec(dllimport) #endif #endif #endif /* not defined XML_STATIC */ /* If we didn't define it above, define it away: */ #ifndef XMLIMPORT #define XMLIMPORT #endif #define XMLPARSEAPI(type) XMLIMPORT type XMLCALL #ifdef __cplusplus extern "C" { #endif #ifdef XML_UNICODE_WCHAR_T #define XML_UNICODE #endif #ifdef XML_UNICODE /* Information is UTF-16 encoded. */ #ifdef XML_UNICODE_WCHAR_T typedef wchar_t XML_Char; typedef wchar_t XML_LChar; #else typedef unsigned short XML_Char; typedef char XML_LChar; #endif /* XML_UNICODE_WCHAR_T */ #else /* Information is UTF-8 encoded. */ typedef char XML_Char; typedef char XML_LChar; #endif /* XML_UNICODE */ #ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */ #if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 typedef __int64 XML_Index; typedef unsigned __int64 XML_Size; #else typedef long long XML_Index; typedef unsigned long long XML_Size; #endif #else typedef long XML_Index; typedef unsigned long XML_Size; #endif /* XML_LARGE_SIZE */ #ifdef __cplusplus } #endif #endif /* not Expat_External_INCLUDED */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������math.h����������������������������������������������������������������������������������������������0000644�����������������00000037315�14763166030�0005665 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Declarations for math functions. Copyright (C) 1991-1993, 1995-1999, 2001, 2002, 2004, 2006, 2009, 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 Standard: 7.12 Mathematics <math.h> */ #ifndef _MATH_H #define _MATH_H 1 #include <features.h> __BEGIN_DECLS /* Get machine-dependent HUGE_VAL value (returned on overflow). On all IEEE754 machines, this is +Infinity. */ #include <bits/huge_val.h> #ifdef __USE_ISOC99 # include <bits/huge_valf.h> # include <bits/huge_vall.h> /* Get machine-dependent INFINITY value. */ # include <bits/inf.h> /* Get machine-dependent NAN value (returned for some domain errors). */ # include <bits/nan.h> #endif /* __USE_ISOC99 */ /* Get general and ISO C99 specific information. */ #include <bits/mathdef.h> /* The file <bits/mathcalls.h> contains the prototypes for all the actual math functions. These macros are used for those prototypes, so we can easily declare each function as both `name' and `__name', and can declare the float versions `namef' and `__namef'. */ #define __MATHCALL(function,suffix, args) \ __MATHDECL (_Mdouble_,function,suffix, args) #define __MATHDECL(type, function,suffix, args) \ __MATHDECL_1(type, function,suffix, args); \ __MATHDECL_1(type, __CONCAT(__,function),suffix, args) #define __MATHCALLX(function,suffix, args, attrib) \ __MATHDECLX (_Mdouble_,function,suffix, args, attrib) #define __MATHDECLX(type, function,suffix, args, attrib) \ __MATHDECL_1(type, function,suffix, args) __attribute__ (attrib); \ __MATHDECL_1(type, __CONCAT(__,function),suffix, args) __attribute__ (attrib) #define __MATHDECL_1(type, function,suffix, args) \ extern type __MATH_PRECNAME(function,suffix) args __THROW #define _Mdouble_ double #define __MATH_PRECNAME(name,r) __CONCAT(name,r) #define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_STD #define _Mdouble_END_NAMESPACE __END_NAMESPACE_STD #include <bits/mathcalls.h> #undef _Mdouble_ #undef _Mdouble_BEGIN_NAMESPACE #undef _Mdouble_END_NAMESPACE #undef __MATH_PRECNAME #if defined __USE_MISC || defined __USE_ISOC99 /* Include the file of declarations again, this time using `float' instead of `double' and appending f to each function name. */ # ifndef _Mfloat_ # define _Mfloat_ float # endif # define _Mdouble_ _Mfloat_ # define __MATH_PRECNAME(name,r) name##f##r # define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_C99 # define _Mdouble_END_NAMESPACE __END_NAMESPACE_C99 # include <bits/mathcalls.h> # undef _Mdouble_ # undef _Mdouble_BEGIN_NAMESPACE # undef _Mdouble_END_NAMESPACE # undef __MATH_PRECNAME # if !(defined __NO_LONG_DOUBLE_MATH && defined _LIBC) \ || defined __LDBL_COMPAT # ifdef __LDBL_COMPAT # ifdef __USE_ISOC99 extern float __nldbl_nexttowardf (float __x, long double __y) __THROW __attribute__ ((__const__)); # ifdef __REDIRECT_NTH extern float __REDIRECT_NTH (nexttowardf, (float __x, long double __y), __nldbl_nexttowardf) __attribute__ ((__const__)); extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y), nextafter) __attribute__ ((__const__)); extern long double __REDIRECT_NTH (nexttowardl, (long double __x, long double __y), nextafter) __attribute__ ((__const__)); # endif # endif # undef __MATHDECL_1 # define __MATHDECL_2(type, function,suffix, args, alias) \ extern type __REDIRECT_NTH(__MATH_PRECNAME(function,suffix), \ args, alias) # define __MATHDECL_1(type, function,suffix, args) \ __MATHDECL_2(type, function,suffix, args, __CONCAT(function,suffix)) # endif /* Include the file of declarations again, this time using `long double' instead of `double' and appending l to each function name. */ # ifndef _Mlong_double_ # define _Mlong_double_ long double # endif # define _Mdouble_ _Mlong_double_ # define __MATH_PRECNAME(name,r) name##l##r # define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_C99 # define _Mdouble_END_NAMESPACE __END_NAMESPACE_C99 # define __MATH_DECLARE_LDOUBLE 1 # include <bits/mathcalls.h> # undef _Mdouble_ # undef _Mdouble_BEGIN_NAMESPACE # undef _Mdouble_END_NAMESPACE # undef __MATH_PRECNAME # endif /* !(__NO_LONG_DOUBLE_MATH && _LIBC) || __LDBL_COMPAT */ #endif /* Use misc or ISO C99. */ #undef __MATHDECL_1 #undef __MATHDECL #undef __MATHCALL #if defined __USE_MISC || defined __USE_XOPEN /* This variable is used by `gamma' and `lgamma'. */ extern int signgam; #endif /* ISO C99 defines some generic macros which work on any data type. */ #ifdef __USE_ISOC99 /* Get the architecture specific values describing the floating-point evaluation. The following symbols will get defined: float_t floating-point type at least as wide as `float' used to evaluate `float' expressions double_t floating-point type at least as wide as `double' used to evaluate `double' expressions FLT_EVAL_METHOD Defined to 0 if `float_t' is `float' and `double_t' is `double' 1 if `float_t' and `double_t' are `double' 2 if `float_t' and `double_t' are `long double' else `float_t' and `double_t' are unspecified INFINITY representation of the infinity value of type `float' FP_FAST_FMA FP_FAST_FMAF FP_FAST_FMAL If defined it indicates that the `fma' function generally executes about as fast as a multiply and an add. This macro is defined only iff the `fma' function is implemented directly with a hardware multiply-add instructions. FP_ILOGB0 Expands to a value returned by `ilogb (0.0)'. FP_ILOGBNAN Expands to a value returned by `ilogb (NAN)'. DECIMAL_DIG Number of decimal digits supported by conversion between decimal and all internal floating-point formats. */ /* All floating-point numbers can be put in one of these categories. */ enum { FP_NAN = # define FP_NAN 0 FP_NAN, FP_INFINITE = # define FP_INFINITE 1 FP_INFINITE, FP_ZERO = # define FP_ZERO 2 FP_ZERO, FP_SUBNORMAL = # define FP_SUBNORMAL 3 FP_SUBNORMAL, FP_NORMAL = # define FP_NORMAL 4 FP_NORMAL }; /* Return number of classification appropriate for X. */ # ifdef __NO_LONG_DOUBLE_MATH # define fpclassify(x) \ (sizeof (x) == sizeof (float) ? __fpclassifyf (x) : __fpclassify (x)) # else # define fpclassify(x) \ (sizeof (x) == sizeof (float) \ ? __fpclassifyf (x) \ : sizeof (x) == sizeof (double) \ ? __fpclassify (x) : __fpclassifyl (x)) # endif /* Return nonzero value if sign of X is negative. */ # ifdef __NO_LONG_DOUBLE_MATH # define signbit(x) \ (sizeof (x) == sizeof (float) ? __signbitf (x) : __signbit (x)) # else # define signbit(x) \ (sizeof (x) == sizeof (float) \ ? __signbitf (x) \ : sizeof (x) == sizeof (double) \ ? __signbit (x) : __signbitl (x)) # endif /* Return nonzero value if X is not +-Inf or NaN. */ # ifdef __NO_LONG_DOUBLE_MATH # define isfinite(x) \ (sizeof (x) == sizeof (float) ? __finitef (x) : __finite (x)) # else # define isfinite(x) \ (sizeof (x) == sizeof (float) \ ? __finitef (x) \ : sizeof (x) == sizeof (double) \ ? __finite (x) : __finitel (x)) # endif /* Return nonzero value if X is neither zero, subnormal, Inf, nor NaN. */ # define isnormal(x) (fpclassify (x) == FP_NORMAL) /* Return nonzero value if X is a NaN. We could use `fpclassify' but we already have this functions `__isnan' and it is faster. */ # ifdef __NO_LONG_DOUBLE_MATH # define isnan(x) \ (sizeof (x) == sizeof (float) ? __isnanf (x) : __isnan (x)) # else # define isnan(x) \ (sizeof (x) == sizeof (float) \ ? __isnanf (x) \ : sizeof (x) == sizeof (double) \ ? __isnan (x) : __isnanl (x)) # endif /* Return nonzero value if X is positive or negative infinity. */ # ifdef __NO_LONG_DOUBLE_MATH # define isinf(x) \ (sizeof (x) == sizeof (float) ? __isinff (x) : __isinf (x)) # else # define isinf(x) \ (sizeof (x) == sizeof (float) \ ? __isinff (x) \ : sizeof (x) == sizeof (double) \ ? __isinf (x) : __isinfl (x)) # endif /* Bitmasks for the math_errhandling macro. */ # define MATH_ERRNO 1 /* errno set by math functions. */ # define MATH_ERREXCEPT 2 /* Exceptions raised by math functions. */ /* By default all functions support both errno and exception handling. In gcc's fast math mode and if inline functions are defined this might not be true. */ # ifndef __FAST_MATH__ # define math_errhandling (MATH_ERRNO | MATH_ERREXCEPT) # endif #endif /* Use ISO C99. */ #ifdef __USE_MISC /* Support for various different standard error handling behaviors. */ typedef enum { _IEEE_ = -1, /* According to IEEE 754/IEEE 854. */ _SVID_, /* According to System V, release 4. */ _XOPEN_, /* Nowadays also Unix98. */ _POSIX_, _ISOC_ /* Actually this is ISO C99. */ } _LIB_VERSION_TYPE; /* This variable can be changed at run-time to any of the values above to affect floating point error handling behavior (it may also be necessary to change the hardware FPU exception settings). */ extern _LIB_VERSION_TYPE _LIB_VERSION; #endif #ifdef __USE_SVID /* In SVID error handling, `matherr' is called with this description of the exceptional condition. We have a problem when using C++ since `exception' is a reserved name in C++. */ # ifdef __cplusplus struct __exception # else struct exception # endif { int type; char *name; double arg1; double arg2; double retval; }; # ifdef __cplusplus extern int matherr (struct __exception *__exc) throw (); # else extern int matherr (struct exception *__exc); # endif # define X_TLOSS 1.41484755040568800000e+16 /* Types of exceptions in the `type' field. */ # define DOMAIN 1 # define SING 2 # define OVERFLOW 3 # define UNDERFLOW 4 # define TLOSS 5 # define PLOSS 6 /* SVID mode specifies returning this large value instead of infinity. */ # define HUGE 3.40282347e+38F #else /* !SVID */ # ifdef __USE_XOPEN /* X/Open wants another strange constant. */ # define MAXFLOAT 3.40282347e+38F # endif #endif /* SVID */ /* Some useful constants. */ #if defined __USE_BSD || defined __USE_XOPEN # define M_E 2.7182818284590452354 /* e */ # define M_LOG2E 1.4426950408889634074 /* log_2 e */ # define M_LOG10E 0.43429448190325182765 /* log_10 e */ # define M_LN2 0.69314718055994530942 /* log_e 2 */ # define M_LN10 2.30258509299404568402 /* log_e 10 */ # define M_PI 3.14159265358979323846 /* pi */ # define M_PI_2 1.57079632679489661923 /* pi/2 */ # define M_PI_4 0.78539816339744830962 /* pi/4 */ # define M_1_PI 0.31830988618379067154 /* 1/pi */ # define M_2_PI 0.63661977236758134308 /* 2/pi */ # define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ # define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ # define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ #endif /* The above constants are not adequate for computation using `long double's. Therefore we provide as an extension constants with similar names as a GNU extension. Provide enough digits for the 128-bit IEEE quad. */ #ifdef __USE_GNU # define M_El 2.718281828459045235360287471352662498L /* e */ # define M_LOG2El 1.442695040888963407359924681001892137L /* log_2 e */ # define M_LOG10El 0.434294481903251827651128918916605082L /* log_10 e */ # define M_LN2l 0.693147180559945309417232121458176568L /* log_e 2 */ # define M_LN10l 2.302585092994045684017991454684364208L /* log_e 10 */ # define M_PIl 3.141592653589793238462643383279502884L /* pi */ # define M_PI_2l 1.570796326794896619231321691639751442L /* pi/2 */ # define M_PI_4l 0.785398163397448309615660845819875721L /* pi/4 */ # define M_1_PIl 0.318309886183790671537767526745028724L /* 1/pi */ # define M_2_PIl 0.636619772367581343075535053490057448L /* 2/pi */ # define M_2_SQRTPIl 1.128379167095512573896158903121545172L /* 2/sqrt(pi) */ # define M_SQRT2l 1.414213562373095048801688724209698079L /* sqrt(2) */ # define M_SQRT1_2l 0.707106781186547524400844362104849039L /* 1/sqrt(2) */ #endif /* When compiling in strict ISO C compatible mode we must not use the inline functions since they, among other things, do not set the `errno' variable correctly. */ #if defined __STRICT_ANSI__ && !defined __NO_MATH_INLINES # define __NO_MATH_INLINES 1 #endif #if defined __USE_ISOC99 && __GNUC_PREREQ(2,97) /* ISO C99 defines some macros to compare number while taking care for unordered numbers. Many FPUs provide special instructions to support these operations. Generic support in GCC for these as builtins went in before 3.0.0, but not all cpus added their patterns. We define versions that use the builtins here, and <bits/mathinline.h> will undef/redefine as appropriate for the specific GCC version in use. */ # define isgreater(x, y) __builtin_isgreater(x, y) # define isgreaterequal(x, y) __builtin_isgreaterequal(x, y) # define isless(x, y) __builtin_isless(x, y) # define islessequal(x, y) __builtin_islessequal(x, y) # define islessgreater(x, y) __builtin_islessgreater(x, y) # define isunordered(u, v) __builtin_isunordered(u, v) #endif /* Get machine-dependent inline versions (if there are any). */ #ifdef __USE_EXTERN_INLINES # include <bits/mathinline.h> #endif /* Define special entry points to use when the compiler got told to only expect finite results. */ #if defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0 # include <bits/math-finite.h> #endif #ifdef __USE_ISOC99 /* If we've still got undefined comparison macros, provide defaults. */ /* Return nonzero value if X is greater than Y. */ # ifndef isgreater # define isgreater(x, y) \ (__extension__ \ ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ !isunordered (__x, __y) && __x > __y; })) # endif /* Return nonzero value if X is greater than or equal to Y. */ # ifndef isgreaterequal # define isgreaterequal(x, y) \ (__extension__ \ ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ !isunordered (__x, __y) && __x >= __y; })) # endif /* Return nonzero value if X is less than Y. */ # ifndef isless # define isless(x, y) \ (__extension__ \ ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ !isunordered (__x, __y) && __x < __y; })) # endif /* Return nonzero value if X is less than or equal to Y. */ # ifndef islessequal # define islessequal(x, y) \ (__extension__ \ ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ !isunordered (__x, __y) && __x <= __y; })) # endif /* Return nonzero value if either X is less than Y or Y is less than X. */ # ifndef islessgreater # define islessgreater(x, y) \ (__extension__ \ ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ !isunordered (__x, __y) && (__x < __y || __y < __x); })) # endif /* Return nonzero value if arguments are unordered. */ # ifndef isunordered # define isunordered(u, v) \ (__extension__ \ ({ __typeof__(u) __u = (u); __typeof__(v) __v = (v); \ fpclassify (__u) == FP_NAN || fpclassify (__v) == FP_NAN; })) # endif #endif __END_DECLS #endif /* math.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������verto.h���������������������������������������������������������������������������������������������0000644�����������������00000045104�14763166030�0006066 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright 2011 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation files * (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef VERTO_H_ #define VERTO_H_ #include <time.h> /* For time_t */ #include <unistd.h> /* For pid_t */ #ifdef WIN32 #include <windows.h> typedef HANDLE verto_proc; typedef DWORD verto_proc_status; #else typedef pid_t verto_proc; typedef int verto_proc_status; #endif #define VERTO_SIG_IGN ((verto_callback *) 1) #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ typedef struct verto_ctx verto_ctx; typedef struct verto_ev verto_ev; typedef enum { VERTO_EV_TYPE_NONE = 0, VERTO_EV_TYPE_IO = 1, VERTO_EV_TYPE_TIMEOUT = 1 << 1, VERTO_EV_TYPE_IDLE = 1 << 2, VERTO_EV_TYPE_SIGNAL = 1 << 3, VERTO_EV_TYPE_CHILD = 1 << 4 } verto_ev_type; typedef enum { VERTO_EV_FLAG_NONE = 0, VERTO_EV_FLAG_PERSIST = 1, VERTO_EV_FLAG_PRIORITY_LOW = 1 << 1, VERTO_EV_FLAG_PRIORITY_MEDIUM = 1 << 2, VERTO_EV_FLAG_PRIORITY_HIGH = 1 << 3, VERTO_EV_FLAG_IO_READ = 1 << 4, VERTO_EV_FLAG_IO_WRITE = 1 << 5, VERTO_EV_FLAG_IO_ERROR = 1 << 7, VERTO_EV_FLAG_IO_CLOSE_FD = 1 << 8, VERTO_EV_FLAG_REINITIABLE = 1 << 6, _VERTO_EV_FLAG_MUTABLE_MASK = VERTO_EV_FLAG_PRIORITY_LOW | VERTO_EV_FLAG_PRIORITY_MEDIUM | VERTO_EV_FLAG_PRIORITY_HIGH | VERTO_EV_FLAG_IO_READ | VERTO_EV_FLAG_IO_WRITE, _VERTO_EV_FLAG_MAX = VERTO_EV_FLAG_IO_CLOSE_FD } verto_ev_flag; typedef void (verto_callback)(verto_ctx *ctx, verto_ev *ev); /** * Creates a new event context using an optionally specified implementation * and/or optionally specified required features. * * If you are an application that has already decided on using a particular * event loop implementation, you should not call this function, but instead * import the verto-NAME.h header and link against the verto-NAME.so, where * NAME is the implementation you wish to use. * * If you are a library, you should generally avoid creating event contexts * on your own but allow applications to pass in a verto_ctx you can use. * * There are two cases where you should use this function. The first is * where you have a need to choose an implementation at run time, usually * for testing purposes. The second and more common is when you simply * wish to remain implementation agnostic. In this later case, you should * always call like this: verto_new(NULL, ...). This lets verto choose the best * implementation to use. * * If impl is not NULL, a new context is returned which is backed by the * implementation specified. If the implementation specified is not * available or if the required types (reqtypes) are not provided by the * named implementation, NULL is returned. The parameter 'impl' can specify: * * The full path to an implementation library * * The name of the implementation library (i.e. - "glib" or "libev") * * If impl is NULL, verto will attempt to automatically determine the * best implementation to use. * * First, verto will attempt to use an existing, previously loaded * implementation. This is handled automatically by internal caching of either * the first implementation loaded or the one specified by verto_set_default(). * * Second, verto will attempt to discern if you are already linked to any * of the supported implementations (to avoid wasting memory by loading * extra unnecessary libraries). If you are linked to one supported * implementation, that implementation will be chosen. If you are linked * to more than one supported implementation one of the ones linked to * will be chosen, but the order of the particular choice is undefined. * * Third, verto will attempt to load the compile-time default, if defined at * build time and available at runtime. * * Last, verto will attempt to load any implementation installed. The specific * order of this step is undefined. * * In all cases above, if the implementation does not support all the specified * features (reqtypes), it will be skipped and processing will continue from * where it left off. This means that if verto_new() returns non-NULL it is * guaranteed to support the features you specified. * * @see verto_set_default() * @param impl The implementation to use, or NULL. * @param reqtypes A bitwise or'd list of required event type features. * @return A new verto_ctx, or NULL on error. Call verto_free() when done. */ verto_ctx * verto_new(const char *impl, verto_ev_type reqtypes); /** * Gets the default event context using an optionally specified implementation. * * This function is essentially a singleton version of verto_new(). However, * since this function must return the same loop as the *_default() call of * the underlying implementation (if such a function exists), it is NOT a * global singleton, but a per-implementation singleton. For this reason, you * must call verto_free() when you are done with this loop. Even after calling * verto_free() on the default verto_ctx, you can safely call verto_default() * again and receive a new reference to the same (internally default) loop. * * In all other respects, verto_default() acts exactly like verto_new(). * * @see verto_new() * @see verto_free() * @param impl The implementation to use, or NULL. * @param reqtypes A bitwise or'd list of required event type features. * @return The default verto_ctx, or NULL on error. Call verto_free() when done. */ verto_ctx * verto_default(const char *impl, verto_ev_type reqtypes); /** * Sets the default implementation to use by its name. * * This function returns 1 on success and 0 on failure. It can fail for the * following reasons: * 1. The default implementation was already set via verto_set_default(). * 2. The implementation specified could not be found. * 3. The implementation specified didn't support the features specified. * 4. The impl argument was NULL. * 5. verto_new() was already called. * 6. verto_default() was already called. * 7. verto_new_NAME() was already called. * 8. verto_default_NAME() was already called. * 9. verto_convert_NAME() was already called. * * @see verto_new() * @see verto_default() * @param impl The implementation to use. * @param reqtypes A bitwise or'd list of required event type features. * @return The default verto_ctx, or NULL on error. Call verto_free() when done. */ int verto_set_default(const char *impl, verto_ev_type reqtypes); /** * Sets the allocator to use for verto_ctx and verto_ev objects. * * If you plan to set the allocator, you MUST call this function before any * other verto_*() calls. * * @see verto_new() * @see verto_default() * @see verto_add_io() * @see verto_add_timeout() * @see verto_add_idle() * @see verto_add_signal() * @see verto_add_child() * @param resize The allocator to use (behaves like realloc()) * @param hierarchical Zero if the allocator is not hierarchical */ int verto_set_allocator(void *(*resize)(void *mem, size_t size), int hierarchical); /** * Frees a verto_ctx. * * When called on a default verto_ctx, the reference will be freed but the * internal default loop will still be available via another call to * verto_default(). * * @see verto_new() * @see verto_default() * @param ctx The verto_ctx to free. */ void verto_free(verto_ctx *ctx); /** * Run the verto_ctx forever, or at least until verto_break() is called. * * @see verto_break() * @param ctx The verto_ctx to run. */ void verto_run(verto_ctx *ctx); /** * Run the verto_ctx once. May block. * * @param ctx The verto_ctx to run once. */ void verto_run_once(verto_ctx *ctx); /** * Exits the currently running verto_ctx. * * @see verto_run() * @param ctx The verto_ctx to exit. */ void verto_break(verto_ctx *ctx); /** * Re-initializes the verto_ctx. * * This function deletes all events, except those which have set the * VERTO_EV_FLAG_REINITIABLE flag. If you fork(), you MUST call this in the * child process after the fork! * * If this function fails it indicates that at least one * VERTO_EV_FLAG_REINITIABLE event was not rearmed or that ctx was NULL. * * @see verto_new() * @see verto_default() * @param ctx The verto_ctx to re-initialize. * @return Non-zero on success, 0 on error. */ int verto_reinitialize(verto_ctx *ctx); /** * Adds a callback executed when a file descriptor is ready to be read/written. * * All verto_ev events are automatically freed when their parent verto_ctx is * freed. You do not need to free them manually. If VERTO_EV_FLAG_PERSIST is * provided, the event will repeat until verto_del() is called. If * VERTO_EV_FLAG_PERSIST is not provided, the event will be freed automatically * after its execution. In either case, you may call verto_del() at any time * to prevent the event from executing. * If VERTO_EV_FLAG_IO_CLOSE_FD is provided the passed in fd is automatically * closed when the event is freed with verto_del() * * NOTE: On Windows, the underlying select() only works with sockets. As such, * any attempt to add a non-socket io event on Windows will produce undefined * results and may even crash. * * @see verto_del() * @param ctx The verto_ctx which will fire the callback. * @param flags The flags to set (at least one VERTO_EV_FLAG_IO* required). * @param callback The callback to fire. * @param fd The file descriptor to watch for reads. * @return The verto_ev registered with the event context or NULL on error. */ verto_ev * verto_add_io(verto_ctx *ctx, verto_ev_flag flags, verto_callback *callback, int fd); /** * Adds a callback executed after a period of time. * * All verto_ev events are automatically freed when their parent verto_ctx is * freed. You do not need to free them manually. If VERTO_EV_FLAG_PERSIST is * provided, the event will repeat until verto_del() is called. If * VERTO_EV_FLAG_PERSIST is not provided, the event will be freed automatically * after its execution. In either case, you may call verto_del() at any time * to prevent the event from executing. * * @see verto_del() * @param ctx The verto_ctx which will fire the callback. * @param flags The flags to set. * @param callback The callback to fire. * @param interval Time period to wait before firing (in milliseconds). * @return The verto_ev registered with the event context. */ verto_ev * verto_add_timeout(verto_ctx *ctx, verto_ev_flag flags, verto_callback *callback, time_t interval); /** * Adds a callback executed when there is nothing else to do. * * All verto_ev events are automatically freed when their parent verto_ctx is * freed. You do not need to free them manually. If VERTO_EV_FLAG_PERSIST is * provided, the event will repeat until verto_del() is called. If * VERTO_EV_FLAG_PERSIST is not provided, the event will be freed automatically * after its execution. In either case, you may call verto_del() at any time * to prevent the event from executing. * * @see verto_del() * @param ctx The verto_ctx which will fire the callback. * @param flags The flags to set. * @param callback The callback to fire. * @return The verto_ev registered with the event context. */ verto_ev * verto_add_idle(verto_ctx *ctx, verto_ev_flag flags, verto_callback *callback); /** * Adds a callback executed when a signal is received. * * All verto_ev events are automatically freed when their parent verto_ctx is * freed. You do not need to free them manually. If VERTO_EV_FLAG_PERSIST is * provided, the event will repeat until verto_del() is called. If * VERTO_EV_FLAG_PERSIST is not provided, the event will be freed automatically * after its execution. In either case, you may call verto_del() at any time * to prevent the event from executing. * * NOTE: If you attempt to ignore a signal without the VERTO_EV_FLAG_PERSIST * flag, this function fails. * * NOTE: SIGCHLD is expressly not supported. If you want this notification, * please use verto_add_child(). * * WARNNIG: Signal events can only be reliably received in the default verto_ctx * in some implementations. Attempting to receive signal events in non-default * loops may result in assert() failures. * * WARNING: While verto does its best to protect you from crashes, there is * essentially no way to do signal events if you mix multiple implementations in * a single process. Attempting to do so will result in undefined behavior, * and potentially even a crash. You have been warned. * * @see verto_add_child() * @see verto_repeat() * @see verto_del() * @param ctx The verto_ctx which will fire the callback. * @param flags The flags to set. * @param callback The callback to fire. * @param signal The signal to watch for. * @return The verto_ev registered with the event context. */ verto_ev * verto_add_signal(verto_ctx *ctx, verto_ev_flag flags, verto_callback *callback, int signal); /** * Adds a callback executed when a child process exits. * * This event will be freed automatically after its execution. Due to the * nature of a process' life-cycle, child events cannot persist (processes only * exit once). This function returns NULL if you attempt to use * VERTO_EV_FLAG_PERSIST. You may, of course, call verto_del() at any time to * prevent the callback from firing. * * @see verto_del() * @param ctx The verto_ctx which will fire the callback. * @param flags The flags to set. * @param callback The callback to fire. * @param child The pid (POSIX) or handle (Win32) of the child to watch for. * @return The verto_ev registered with the event context. */ verto_ev * verto_add_child(verto_ctx *ctx, verto_ev_flag flags, verto_callback *callback, verto_proc proc); /** * Sets the private pointer of the verto_ev. * * The free callback will be called in two cases: * 1. When the event is deleted (manually or automatically) * 2. When verto_set_private() is called again, unless * free is NULL. * * @see verto_get_private() * @param ev The verto_ev * @param priv The private value to store * @param free The callback used to free the data or NULL */ void verto_set_private(verto_ev *ev, void *priv, verto_callback *free); /** * Gets the private pointer of the verto_ev. * * @see verto_set_private() * @param ev The verto_ev * @return The verto_ev private pointer */ void * verto_get_private(const verto_ev *ev); /** * Gets the type of the verto_ev. * * @see verto_add_io() * @see verto_add_timeout() * @see verto_add_idle() * @see verto_add_signal() * @see verto_add_child() * @param ev The verto_ev * @return The verto_ev type */ verto_ev_type verto_get_type(const verto_ev *ev); /** * Gets the flags associated with the given verto_ev. * * @see verto_add_io() * @see verto_add_timeout() * @see verto_add_idle() * @see verto_add_signal() * @see verto_add_child() * @see verto_set_flags() * @param ev The verto_ev * @return The verto_ev type */ verto_ev_flag verto_get_flags(const verto_ev *ev); /** * Sets the flags associated with the given verto_ev. * * See _VERTO_EV_FLAG_MUTABLE_MASK for the flags that can be changed * with this function. All others will be ignored. * * @see verto_add_io() * @see verto_add_timeout() * @see verto_add_idle() * @see verto_add_signal() * @see verto_add_child() * @see verto_get_flags() * @param ev The verto_ev * @param flags The flags for the event */ void verto_set_flags(verto_ev *ev, verto_ev_flag flags); /** * Gets the file descriptor associated with a read/write verto_ev. * * @see verto_add_io() * @param ev The verto_ev to retrieve the file descriptor from. * @return The file descriptor, or -1 if not a read/write event. */ int verto_get_fd(const verto_ev *ev); /** * Gets the file descriptor state from when the event fires. * * @see verto_add_io() * @param ev The verto_ev to retrieve the fd state from. * @return The fd state. */ verto_ev_flag verto_get_fd_state(const verto_ev *ev); /** * Gets the interval associated with a timeout verto_ev. * * @see verto_add_timeout() * @param ev The verto_ev to retrieve the interval from. * @return The interval, or 0 if not a timeout event. */ time_t verto_get_interval(const verto_ev *ev); /** * Gets the signal associated with a signal verto_ev. * * @see verto_add_signal() * @param ev The verto_ev to retrieve the signal from. * @return The signal, or -1 if not a signal event. */ int verto_get_signal(const verto_ev *ev); /** * Gets the process associated with a child verto_ev. * * @see verto_add_child() * @param ev The verto_ev to retrieve the process from. * @return The pid/handle, or 0/NULL if not a child event (POSIX/Win32). */ verto_proc verto_get_proc(const verto_ev *ev); /** * Gets the status of the process which caused this event to fire. * * @see verto_add_child() * @param ev The verto_ev to retrieve the status from. * @return The pid/handle status. */ verto_proc_status verto_get_proc_status(const verto_ev *ev); /** * Gets the verto_ctx associated with a verto_ev. * * This is a borrowed reference, don't attempt to free it! * * @param ev The verto_ev to retrieve the verto_ctx from. * @return The verto_ctx. */ verto_ctx * verto_get_ctx(const verto_ev *ev); /** * Removes an event from from the event context and frees it. * * The event and its contents cannot be used after this call. * * @see verto_add_io() * @see verto_add_timeout() * @see verto_add_idle() * @see verto_add_signal() * @see verto_add_child() * @param ev The event to delete. */ void verto_del(verto_ev *ev); /** * Returns the event types supported by this implementation. * * @param ctx The verto_ctx to query. * @return The event types supported. */ verto_ev_type verto_get_supported_types(verto_ctx *ctx); #ifdef __cplusplus } /* extern "C" */ #endif /* __cplusplus */ #endif /* VERTO_H_ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libpq/libpq-fs.h������������������������������������������������������������������������������������0000644�����������������00000001171�14763166030�0007547 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------------------------------- * * libpq-fs.h * definitions for using Inversion file system routines (ie, large objects) * * * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/libpq/libpq-fs.h * *------------------------------------------------------------------------- */ #ifndef LIBPQ_FS_H #define LIBPQ_FS_H /* * Read/write mode flags for inversion (large object) calls */ #define INV_WRITE 0x00020000 #define INV_READ 0x00040000 #endif /* LIBPQ_FS_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/HTMLtree.h���������������������������������������������������������������������������0000644�����������������00000007076�14763166030�0011221 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: specific APIs to process HTML tree, especially serialization * Description: this module implements a few function needed to process * tree in an HTML specific way. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __HTML_TREE_H__ #define __HTML_TREE_H__ #include <stdio.h> #include <libxml/xmlversion.h> #include <libxml/tree.h> #include <libxml/HTMLparser.h> #ifdef LIBXML_HTML_ENABLED #ifdef __cplusplus extern "C" { #endif /** * HTML_TEXT_NODE: * * Macro. A text node in a HTML document is really implemented * the same way as a text node in an XML document. */ #define HTML_TEXT_NODE XML_TEXT_NODE /** * HTML_ENTITY_REF_NODE: * * Macro. An entity reference in a HTML document is really implemented * the same way as an entity reference in an XML document. */ #define HTML_ENTITY_REF_NODE XML_ENTITY_REF_NODE /** * HTML_COMMENT_NODE: * * Macro. A comment in a HTML document is really implemented * the same way as a comment in an XML document. */ #define HTML_COMMENT_NODE XML_COMMENT_NODE /** * HTML_PRESERVE_NODE: * * Macro. A preserved node in a HTML document is really implemented * the same way as a CDATA section in an XML document. */ #define HTML_PRESERVE_NODE XML_CDATA_SECTION_NODE /** * HTML_PI_NODE: * * Macro. A processing instruction in a HTML document is really implemented * the same way as a processing instruction in an XML document. */ #define HTML_PI_NODE XML_PI_NODE XMLPUBFUN htmlDocPtr XMLCALL htmlNewDoc (const xmlChar *URI, const xmlChar *ExternalID); XMLPUBFUN htmlDocPtr XMLCALL htmlNewDocNoDtD (const xmlChar *URI, const xmlChar *ExternalID); XMLPUBFUN const xmlChar * XMLCALL htmlGetMetaEncoding (htmlDocPtr doc); XMLPUBFUN int XMLCALL htmlSetMetaEncoding (htmlDocPtr doc, const xmlChar *encoding); #ifdef LIBXML_OUTPUT_ENABLED XMLPUBFUN void XMLCALL htmlDocDumpMemory (xmlDocPtr cur, xmlChar **mem, int *size); XMLPUBFUN void XMLCALL htmlDocDumpMemoryFormat (xmlDocPtr cur, xmlChar **mem, int *size, int format); XMLPUBFUN int XMLCALL htmlDocDump (FILE *f, xmlDocPtr cur); XMLPUBFUN int XMLCALL htmlSaveFile (const char *filename, xmlDocPtr cur); XMLPUBFUN int XMLCALL htmlNodeDump (xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur); XMLPUBFUN void XMLCALL htmlNodeDumpFile (FILE *out, xmlDocPtr doc, xmlNodePtr cur); XMLPUBFUN int XMLCALL htmlNodeDumpFileFormat (FILE *out, xmlDocPtr doc, xmlNodePtr cur, const char *encoding, int format); XMLPUBFUN int XMLCALL htmlSaveFileEnc (const char *filename, xmlDocPtr cur, const char *encoding); XMLPUBFUN int XMLCALL htmlSaveFileFormat (const char *filename, xmlDocPtr cur, const char *encoding, int format); XMLPUBFUN void XMLCALL htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, const char *encoding, int format); XMLPUBFUN void XMLCALL htmlDocContentDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding); XMLPUBFUN void XMLCALL htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding, int format); XMLPUBFUN void XMLCALL htmlNodeDumpOutput (xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, const char *encoding); #endif /* LIBXML_OUTPUT_ENABLED */ XMLPUBFUN int XMLCALL htmlIsBooleanAttr (const xmlChar *name); #ifdef __cplusplus } #endif #endif /* LIBXML_HTML_ENABLED */ #endif /* __HTML_TREE_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/xpathInternals.h���������������������������������������������������������������������0000644�����������������00000045631�14763166030�0012600 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: internal interfaces for XML Path Language implementation * Description: internal interfaces for XML Path Language implementation * used to build new modules on top of XPath like XPointer and * XSLT * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XPATH_INTERNALS_H__ #define __XML_XPATH_INTERNALS_H__ #include <libxml/xmlversion.h> #include <libxml/xpath.h> #ifdef LIBXML_XPATH_ENABLED #ifdef __cplusplus extern "C" { #endif /************************************************************************ * * * Helpers * * * ************************************************************************/ /* * Many of these macros may later turn into functions. They * shouldn't be used in #ifdef's preprocessor instructions. */ /** * xmlXPathSetError: * @ctxt: an XPath parser context * @err: an xmlXPathError code * * Raises an error. */ #define xmlXPathSetError(ctxt, err) \ { xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \ if ((ctxt) != NULL) (ctxt)->error = (err); } /** * xmlXPathSetArityError: * @ctxt: an XPath parser context * * Raises an XPATH_INVALID_ARITY error. */ #define xmlXPathSetArityError(ctxt) \ xmlXPathSetError((ctxt), XPATH_INVALID_ARITY) /** * xmlXPathSetTypeError: * @ctxt: an XPath parser context * * Raises an XPATH_INVALID_TYPE error. */ #define xmlXPathSetTypeError(ctxt) \ xmlXPathSetError((ctxt), XPATH_INVALID_TYPE) /** * xmlXPathGetError: * @ctxt: an XPath parser context * * Get the error code of an XPath context. * * Returns the context error. */ #define xmlXPathGetError(ctxt) ((ctxt)->error) /** * xmlXPathCheckError: * @ctxt: an XPath parser context * * Check if an XPath error was raised. * * Returns true if an error has been raised, false otherwise. */ #define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK) /** * xmlXPathGetDocument: * @ctxt: an XPath parser context * * Get the document of an XPath context. * * Returns the context document. */ #define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc) /** * xmlXPathGetContextNode: * @ctxt: an XPath parser context * * Get the context node of an XPath context. * * Returns the context node. */ #define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node) XMLPUBFUN int XMLCALL xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt); XMLPUBFUN double XMLCALL xmlXPathPopNumber (xmlXPathParserContextPtr ctxt); XMLPUBFUN xmlChar * XMLCALL xmlXPathPopString (xmlXPathParserContextPtr ctxt); XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt); XMLPUBFUN void * XMLCALL xmlXPathPopExternal (xmlXPathParserContextPtr ctxt); /** * xmlXPathReturnBoolean: * @ctxt: an XPath parser context * @val: a boolean * * Pushes the boolean @val on the context stack. */ #define xmlXPathReturnBoolean(ctxt, val) \ valuePush((ctxt), xmlXPathNewBoolean(val)) /** * xmlXPathReturnTrue: * @ctxt: an XPath parser context * * Pushes true on the context stack. */ #define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1) /** * xmlXPathReturnFalse: * @ctxt: an XPath parser context * * Pushes false on the context stack. */ #define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0) /** * xmlXPathReturnNumber: * @ctxt: an XPath parser context * @val: a double * * Pushes the double @val on the context stack. */ #define xmlXPathReturnNumber(ctxt, val) \ valuePush((ctxt), xmlXPathNewFloat(val)) /** * xmlXPathReturnString: * @ctxt: an XPath parser context * @str: a string * * Pushes the string @str on the context stack. */ #define xmlXPathReturnString(ctxt, str) \ valuePush((ctxt), xmlXPathWrapString(str)) /** * xmlXPathReturnEmptyString: * @ctxt: an XPath parser context * * Pushes an empty string on the stack. */ #define xmlXPathReturnEmptyString(ctxt) \ valuePush((ctxt), xmlXPathNewCString("")) /** * xmlXPathReturnNodeSet: * @ctxt: an XPath parser context * @ns: a node-set * * Pushes the node-set @ns on the context stack. */ #define xmlXPathReturnNodeSet(ctxt, ns) \ valuePush((ctxt), xmlXPathWrapNodeSet(ns)) /** * xmlXPathReturnEmptyNodeSet: * @ctxt: an XPath parser context * * Pushes an empty node-set on the context stack. */ #define xmlXPathReturnEmptyNodeSet(ctxt) \ valuePush((ctxt), xmlXPathNewNodeSet(NULL)) /** * xmlXPathReturnExternal: * @ctxt: an XPath parser context * @val: user data * * Pushes user data on the context stack. */ #define xmlXPathReturnExternal(ctxt, val) \ valuePush((ctxt), xmlXPathWrapExternal(val)) /** * xmlXPathStackIsNodeSet: * @ctxt: an XPath parser context * * Check if the current value on the XPath stack is a node set or * an XSLT value tree. * * Returns true if the current object on the stack is a node-set. */ #define xmlXPathStackIsNodeSet(ctxt) \ (((ctxt)->value != NULL) \ && (((ctxt)->value->type == XPATH_NODESET) \ || ((ctxt)->value->type == XPATH_XSLT_TREE))) /** * xmlXPathStackIsExternal: * @ctxt: an XPath parser context * * Checks if the current value on the XPath stack is an external * object. * * Returns true if the current object on the stack is an external * object. */ #define xmlXPathStackIsExternal(ctxt) \ ((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS)) /** * xmlXPathEmptyNodeSet: * @ns: a node-set * * Empties a node-set. */ #define xmlXPathEmptyNodeSet(ns) \ { while ((ns)->nodeNr > 0) (ns)->nodeTab[(ns)->nodeNr--] = NULL; } /** * CHECK_ERROR: * * Macro to return from the function if an XPath error was detected. */ #define CHECK_ERROR \ if (ctxt->error != XPATH_EXPRESSION_OK) return /** * CHECK_ERROR0: * * Macro to return 0 from the function if an XPath error was detected. */ #define CHECK_ERROR0 \ if (ctxt->error != XPATH_EXPRESSION_OK) return(0) /** * XP_ERROR: * @X: the error code * * Macro to raise an XPath error and return. */ #define XP_ERROR(X) \ { xmlXPathErr(ctxt, X); return; } /** * XP_ERROR0: * @X: the error code * * Macro to raise an XPath error and return 0. */ #define XP_ERROR0(X) \ { xmlXPathErr(ctxt, X); return(0); } /** * CHECK_TYPE: * @typeval: the XPath type * * Macro to check that the value on top of the XPath stack is of a given * type. */ #define CHECK_TYPE(typeval) \ if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ XP_ERROR(XPATH_INVALID_TYPE) /** * CHECK_TYPE0: * @typeval: the XPath type * * Macro to check that the value on top of the XPath stack is of a given * type. Return(0) in case of failure */ #define CHECK_TYPE0(typeval) \ if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ XP_ERROR0(XPATH_INVALID_TYPE) /** * CHECK_ARITY: * @x: the number of expected args * * Macro to check that the number of args passed to an XPath function matches. */ #define CHECK_ARITY(x) \ if (ctxt == NULL) return; \ if (nargs != (x)) \ XP_ERROR(XPATH_INVALID_ARITY); \ if (ctxt->valueNr < ctxt->valueFrame + (x)) \ XP_ERROR(XPATH_STACK_ERROR); /** * CAST_TO_STRING: * * Macro to try to cast the value on the top of the XPath stack to a string. */ #define CAST_TO_STRING \ if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \ xmlXPathStringFunction(ctxt, 1); /** * CAST_TO_NUMBER: * * Macro to try to cast the value on the top of the XPath stack to a number. */ #define CAST_TO_NUMBER \ if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \ xmlXPathNumberFunction(ctxt, 1); /** * CAST_TO_BOOLEAN: * * Macro to try to cast the value on the top of the XPath stack to a boolean. */ #define CAST_TO_BOOLEAN \ if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \ xmlXPathBooleanFunction(ctxt, 1); /* * Variable Lookup forwarding. */ XMLPUBFUN void XMLCALL xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt, xmlXPathVariableLookupFunc f, void *data); /* * Function Lookup forwarding. */ XMLPUBFUN void XMLCALL xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt, xmlXPathFuncLookupFunc f, void *funcCtxt); /* * Error reporting. */ XMLPUBFUN void XMLCALL xmlXPatherror (xmlXPathParserContextPtr ctxt, const char *file, int line, int no); XMLPUBFUN void XMLCALL xmlXPathErr (xmlXPathParserContextPtr ctxt, int error); #ifdef LIBXML_DEBUG_ENABLED XMLPUBFUN void XMLCALL xmlXPathDebugDumpObject (FILE *output, xmlXPathObjectPtr cur, int depth); XMLPUBFUN void XMLCALL xmlXPathDebugDumpCompExpr(FILE *output, xmlXPathCompExprPtr comp, int depth); #endif /** * NodeSet handling. */ XMLPUBFUN int XMLCALL xmlXPathNodeSetContains (xmlNodeSetPtr cur, xmlNodePtr val); XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathDifference (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathIntersection (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathDistinctSorted (xmlNodeSetPtr nodes); XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathDistinct (xmlNodeSetPtr nodes); XMLPUBFUN int XMLCALL xmlXPathHasSameNodes (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes, xmlNodePtr node); XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathLeadingSorted (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathNodeLeading (xmlNodeSetPtr nodes, xmlNodePtr node); XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathLeading (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node); XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathTrailingSorted (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathNodeTrailing (xmlNodeSetPtr nodes, xmlNodePtr node); XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathTrailing (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); /** * Extending a context. */ XMLPUBFUN int XMLCALL xmlXPathRegisterNs (xmlXPathContextPtr ctxt, const xmlChar *prefix, const xmlChar *ns_uri); XMLPUBFUN const xmlChar * XMLCALL xmlXPathNsLookup (xmlXPathContextPtr ctxt, const xmlChar *prefix); XMLPUBFUN void XMLCALL xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt); XMLPUBFUN int XMLCALL xmlXPathRegisterFunc (xmlXPathContextPtr ctxt, const xmlChar *name, xmlXPathFunction f); XMLPUBFUN int XMLCALL xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt, const xmlChar *name, const xmlChar *ns_uri, xmlXPathFunction f); XMLPUBFUN int XMLCALL xmlXPathRegisterVariable (xmlXPathContextPtr ctxt, const xmlChar *name, xmlXPathObjectPtr value); XMLPUBFUN int XMLCALL xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt, const xmlChar *name, const xmlChar *ns_uri, xmlXPathObjectPtr value); XMLPUBFUN xmlXPathFunction XMLCALL xmlXPathFunctionLookup (xmlXPathContextPtr ctxt, const xmlChar *name); XMLPUBFUN xmlXPathFunction XMLCALL xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt, const xmlChar *name, const xmlChar *ns_uri); XMLPUBFUN void XMLCALL xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathVariableLookup (xmlXPathContextPtr ctxt, const xmlChar *name); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt, const xmlChar *name, const xmlChar *ns_uri); XMLPUBFUN void XMLCALL xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt); /** * Utilities to extend XPath. */ XMLPUBFUN xmlXPathParserContextPtr XMLCALL xmlXPathNewParserContext (const xmlChar *str, xmlXPathContextPtr ctxt); XMLPUBFUN void XMLCALL xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt); /* TODO: remap to xmlXPathValuePop and Push. */ XMLPUBFUN xmlXPathObjectPtr XMLCALL valuePop (xmlXPathParserContextPtr ctxt); XMLPUBFUN int XMLCALL valuePush (xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr value); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewString (const xmlChar *val); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewCString (const char *val); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathWrapString (xmlChar *val); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathWrapCString (char * val); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewFloat (double val); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewBoolean (int val); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewNodeSet (xmlNodePtr val); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewValueTree (xmlNodePtr val); XMLPUBFUN int XMLCALL xmlXPathNodeSetAdd (xmlNodeSetPtr cur, xmlNodePtr val); XMLPUBFUN int XMLCALL xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur, xmlNodePtr val); XMLPUBFUN int XMLCALL xmlXPathNodeSetAddNs (xmlNodeSetPtr cur, xmlNodePtr node, xmlNsPtr ns); XMLPUBFUN void XMLCALL xmlXPathNodeSetSort (xmlNodeSetPtr set); XMLPUBFUN void XMLCALL xmlXPathRoot (xmlXPathParserContextPtr ctxt); XMLPUBFUN void XMLCALL xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt); XMLPUBFUN xmlChar * XMLCALL xmlXPathParseName (xmlXPathParserContextPtr ctxt); XMLPUBFUN xmlChar * XMLCALL xmlXPathParseNCName (xmlXPathParserContextPtr ctxt); /* * Existing functions. */ XMLPUBFUN double XMLCALL xmlXPathStringEvalNumber (const xmlChar *str); XMLPUBFUN int XMLCALL xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr res); XMLPUBFUN void XMLCALL xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt); XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathNodeSetMerge (xmlNodeSetPtr val1, xmlNodeSetPtr val2); XMLPUBFUN void XMLCALL xmlXPathNodeSetDel (xmlNodeSetPtr cur, xmlNodePtr val); XMLPUBFUN void XMLCALL xmlXPathNodeSetRemove (xmlNodeSetPtr cur, int val); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewNodeSetList (xmlNodeSetPtr val); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathWrapNodeSet (xmlNodeSetPtr val); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathWrapExternal (void *val); XMLPUBFUN int XMLCALL xmlXPathEqualValues(xmlXPathParserContextPtr ctxt); XMLPUBFUN int XMLCALL xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt); XMLPUBFUN int XMLCALL xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict); XMLPUBFUN void XMLCALL xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt); XMLPUBFUN void XMLCALL xmlXPathAddValues(xmlXPathParserContextPtr ctxt); XMLPUBFUN void XMLCALL xmlXPathSubValues(xmlXPathParserContextPtr ctxt); XMLPUBFUN void XMLCALL xmlXPathMultValues(xmlXPathParserContextPtr ctxt); XMLPUBFUN void XMLCALL xmlXPathDivValues(xmlXPathParserContextPtr ctxt); XMLPUBFUN void XMLCALL xmlXPathModValues(xmlXPathParserContextPtr ctxt); XMLPUBFUN int XMLCALL xmlXPathIsNodeType(const xmlChar *name); /* * Some of the axis navigation routines. */ XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextChild(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextParent(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); /* * The official core of XPath functions. */ XMLPUBFUN void XMLCALL xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN void XMLCALL xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs); /** * Really internal functions */ XMLPUBFUN void XMLCALL xmlXPathNodeSetFreeNs(xmlNsPtr ns); #ifdef __cplusplus } #endif #endif /* LIBXML_XPATH_ENABLED */ #endif /* ! __XML_XPATH_INTERNALS_H__ */ �������������������������������������������������������������������������������������������������������libxml2/libxml/debugXML.h���������������������������������������������������������������������������0000644�����������������00000012040�14763166030�0011227 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: Tree debugging APIs * Description: Interfaces to a set of routines used for debugging the tree * produced by the XML parser. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __DEBUG_XML__ #define __DEBUG_XML__ #include <stdio.h> #include <libxml/xmlversion.h> #include <libxml/tree.h> #ifdef LIBXML_DEBUG_ENABLED #include <libxml/xpath.h> #ifdef __cplusplus extern "C" { #endif /* * The standard Dump routines. */ XMLPUBFUN void XMLCALL xmlDebugDumpString (FILE *output, const xmlChar *str); XMLPUBFUN void XMLCALL xmlDebugDumpAttr (FILE *output, xmlAttrPtr attr, int depth); XMLPUBFUN void XMLCALL xmlDebugDumpAttrList (FILE *output, xmlAttrPtr attr, int depth); XMLPUBFUN void XMLCALL xmlDebugDumpOneNode (FILE *output, xmlNodePtr node, int depth); XMLPUBFUN void XMLCALL xmlDebugDumpNode (FILE *output, xmlNodePtr node, int depth); XMLPUBFUN void XMLCALL xmlDebugDumpNodeList (FILE *output, xmlNodePtr node, int depth); XMLPUBFUN void XMLCALL xmlDebugDumpDocumentHead(FILE *output, xmlDocPtr doc); XMLPUBFUN void XMLCALL xmlDebugDumpDocument (FILE *output, xmlDocPtr doc); XMLPUBFUN void XMLCALL xmlDebugDumpDTD (FILE *output, xmlDtdPtr dtd); XMLPUBFUN void XMLCALL xmlDebugDumpEntities (FILE *output, xmlDocPtr doc); /**************************************************************** * * * Checking routines * * * ****************************************************************/ XMLPUBFUN int XMLCALL xmlDebugCheckDocument (FILE * output, xmlDocPtr doc); /**************************************************************** * * * XML shell helpers * * * ****************************************************************/ XMLPUBFUN void XMLCALL xmlLsOneNode (FILE *output, xmlNodePtr node); XMLPUBFUN int XMLCALL xmlLsCountNode (xmlNodePtr node); XMLPUBFUN const char * XMLCALL xmlBoolToText (int boolval); /**************************************************************** * * * The XML shell related structures and functions * * * ****************************************************************/ #ifdef LIBXML_XPATH_ENABLED /** * xmlShellReadlineFunc: * @prompt: a string prompt * * This is a generic signature for the XML shell input function. * * Returns a string which will be freed by the Shell. */ typedef char * (* xmlShellReadlineFunc)(char *prompt); /** * xmlShellCtxt: * * A debugging shell context. * TODO: add the defined function tables. */ typedef struct _xmlShellCtxt xmlShellCtxt; typedef xmlShellCtxt *xmlShellCtxtPtr; struct _xmlShellCtxt { char *filename; xmlDocPtr doc; xmlNodePtr node; xmlXPathContextPtr pctxt; int loaded; FILE *output; xmlShellReadlineFunc input; }; /** * xmlShellCmd: * @ctxt: a shell context * @arg: a string argument * @node: a first node * @node2: a second node * * This is a generic signature for the XML shell functions. * * Returns an int, negative returns indicating errors. */ typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node, xmlNodePtr node2); XMLPUBFUN void XMLCALL xmlShellPrintXPathError (int errorType, const char *arg); XMLPUBFUN void XMLCALL xmlShellPrintXPathResult(xmlXPathObjectPtr list); XMLPUBFUN int XMLCALL xmlShellList (xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node, xmlNodePtr node2); XMLPUBFUN int XMLCALL xmlShellBase (xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node, xmlNodePtr node2); XMLPUBFUN int XMLCALL xmlShellDir (xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node, xmlNodePtr node2); XMLPUBFUN int XMLCALL xmlShellLoad (xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node, xmlNodePtr node2); #ifdef LIBXML_OUTPUT_ENABLED XMLPUBFUN void XMLCALL xmlShellPrintNode (xmlNodePtr node); XMLPUBFUN int XMLCALL xmlShellCat (xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node, xmlNodePtr node2); XMLPUBFUN int XMLCALL xmlShellWrite (xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node, xmlNodePtr node2); XMLPUBFUN int XMLCALL xmlShellSave (xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node, xmlNodePtr node2); #endif /* LIBXML_OUTPUT_ENABLED */ #ifdef LIBXML_VALID_ENABLED XMLPUBFUN int XMLCALL xmlShellValidate (xmlShellCtxtPtr ctxt, char *dtd, xmlNodePtr node, xmlNodePtr node2); #endif /* LIBXML_VALID_ENABLED */ XMLPUBFUN int XMLCALL xmlShellDu (xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr tree, xmlNodePtr node2); XMLPUBFUN int XMLCALL xmlShellPwd (xmlShellCtxtPtr ctxt, char *buffer, xmlNodePtr node, xmlNodePtr node2); /* * The Shell interface. */ XMLPUBFUN void XMLCALL xmlShell (xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, FILE *output); #endif /* LIBXML_XPATH_ENABLED */ #ifdef __cplusplus } #endif #endif /* LIBXML_DEBUG_ENABLED */ #endif /* __DEBUG_XML__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/xmlstring.h��������������������������������������������������������������������������0000644�����������������00000012607�14763166030�0011620 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: set of routines to process strings * Description: type and interfaces needed for the internal string handling * of the library, especially UTF8 processing. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_STRING_H__ #define __XML_STRING_H__ #include <stdarg.h> #include <libxml/xmlversion.h> #ifdef __cplusplus extern "C" { #endif /** * xmlChar: * * This is a basic byte in an UTF-8 encoded string. * It's unsigned allowing to pinpoint case where char * are assigned * to xmlChar * (possibly making serialization back impossible). */ typedef unsigned char xmlChar; /** * BAD_CAST: * * Macro to cast a string to an xmlChar * when one know its safe. */ #define BAD_CAST (xmlChar *) /* * xmlChar handling */ XMLPUBFUN xmlChar * XMLCALL xmlStrdup (const xmlChar *cur); XMLPUBFUN xmlChar * XMLCALL xmlStrndup (const xmlChar *cur, int len); XMLPUBFUN xmlChar * XMLCALL xmlCharStrndup (const char *cur, int len); XMLPUBFUN xmlChar * XMLCALL xmlCharStrdup (const char *cur); XMLPUBFUN xmlChar * XMLCALL xmlStrsub (const xmlChar *str, int start, int len); XMLPUBFUN const xmlChar * XMLCALL xmlStrchr (const xmlChar *str, xmlChar val); XMLPUBFUN const xmlChar * XMLCALL xmlStrstr (const xmlChar *str, const xmlChar *val); XMLPUBFUN const xmlChar * XMLCALL xmlStrcasestr (const xmlChar *str, const xmlChar *val); XMLPUBFUN int XMLCALL xmlStrcmp (const xmlChar *str1, const xmlChar *str2); XMLPUBFUN int XMLCALL xmlStrncmp (const xmlChar *str1, const xmlChar *str2, int len); XMLPUBFUN int XMLCALL xmlStrcasecmp (const xmlChar *str1, const xmlChar *str2); XMLPUBFUN int XMLCALL xmlStrncasecmp (const xmlChar *str1, const xmlChar *str2, int len); XMLPUBFUN int XMLCALL xmlStrEqual (const xmlChar *str1, const xmlChar *str2); XMLPUBFUN int XMLCALL xmlStrQEqual (const xmlChar *pref, const xmlChar *name, const xmlChar *str); XMLPUBFUN int XMLCALL xmlStrlen (const xmlChar *str); XMLPUBFUN xmlChar * XMLCALL xmlStrcat (xmlChar *cur, const xmlChar *add); XMLPUBFUN xmlChar * XMLCALL xmlStrncat (xmlChar *cur, const xmlChar *add, int len); XMLPUBFUN xmlChar * XMLCALL xmlStrncatNew (const xmlChar *str1, const xmlChar *str2, int len); XMLPUBFUN int XMLCALL xmlStrPrintf (xmlChar *buf, int len, const char *msg, ...) LIBXML_ATTR_FORMAT(3,4); XMLPUBFUN int XMLCALL xmlStrVPrintf (xmlChar *buf, int len, const char *msg, va_list ap) LIBXML_ATTR_FORMAT(3,0); XMLPUBFUN int XMLCALL xmlGetUTF8Char (const unsigned char *utf, int *len); XMLPUBFUN int XMLCALL xmlCheckUTF8 (const unsigned char *utf); XMLPUBFUN int XMLCALL xmlUTF8Strsize (const xmlChar *utf, int len); XMLPUBFUN xmlChar * XMLCALL xmlUTF8Strndup (const xmlChar *utf, int len); XMLPUBFUN const xmlChar * XMLCALL xmlUTF8Strpos (const xmlChar *utf, int pos); XMLPUBFUN int XMLCALL xmlUTF8Strloc (const xmlChar *utf, const xmlChar *utfchar); XMLPUBFUN xmlChar * XMLCALL xmlUTF8Strsub (const xmlChar *utf, int start, int len); XMLPUBFUN int XMLCALL xmlUTF8Strlen (const xmlChar *utf); XMLPUBFUN int XMLCALL xmlUTF8Size (const xmlChar *utf); XMLPUBFUN int XMLCALL xmlUTF8Charcmp (const xmlChar *utf1, const xmlChar *utf2); #ifdef __cplusplus } #endif #endif /* __XML_STRING_H__ */ �������������������������������������������������������������������������������������������������������������������������libxml2/libxml/xmlmodule.h��������������������������������������������������������������������������0000644�����������������00000002222�14763166030�0011567 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: dynamic module loading * Description: basic API for dynamic module loading, used by * libexslt added in 2.6.17 * * Copy: See Copyright for the status of this software. * * Author: Joel W. Reed */ #ifndef __XML_MODULE_H__ #define __XML_MODULE_H__ #include <libxml/xmlversion.h> #ifdef LIBXML_MODULES_ENABLED #ifdef __cplusplus extern "C" { #endif /** * xmlModulePtr: * * A handle to a dynamically loaded module */ typedef struct _xmlModule xmlModule; typedef xmlModule *xmlModulePtr; /** * xmlModuleOption: * * enumeration of options that can be passed down to xmlModuleOpen() */ typedef enum { XML_MODULE_LAZY = 1, /* lazy binding */ XML_MODULE_LOCAL= 2 /* local binding */ } xmlModuleOption; XMLPUBFUN xmlModulePtr XMLCALL xmlModuleOpen (const char *filename, int options); XMLPUBFUN int XMLCALL xmlModuleSymbol (xmlModulePtr module, const char* name, void **result); XMLPUBFUN int XMLCALL xmlModuleClose (xmlModulePtr module); XMLPUBFUN int XMLCALL xmlModuleFree (xmlModulePtr module); #ifdef __cplusplus } #endif #endif /* LIBXML_MODULES_ENABLED */ #endif /*__XML_MODULE_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/xmlunicode.h�������������������������������������������������������������������������0000644�����������������00000023411�14763166030�0011733 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: Unicode character APIs * Description: API for the Unicode character APIs * * This file is automatically generated from the * UCS description files of the Unicode Character Database * http://www.unicode.org/Public/4.0-Update1/UCD-4.0.1.html * using the genUnicode.py Python script. * * Generation date: Mon Mar 27 11:09:52 2006 * Sources: Blocks-4.0.1.txt UnicodeData-4.0.1.txt * Author: Daniel Veillard */ #ifndef __XML_UNICODE_H__ #define __XML_UNICODE_H__ #include <libxml/xmlversion.h> #ifdef LIBXML_UNICODE_ENABLED #ifdef __cplusplus extern "C" { #endif XMLPUBFUN int XMLCALL xmlUCSIsAegeanNumbers (int code); XMLPUBFUN int XMLCALL xmlUCSIsAlphabeticPresentationForms (int code); XMLPUBFUN int XMLCALL xmlUCSIsArabic (int code); XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsA (int code); XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsB (int code); XMLPUBFUN int XMLCALL xmlUCSIsArmenian (int code); XMLPUBFUN int XMLCALL xmlUCSIsArrows (int code); XMLPUBFUN int XMLCALL xmlUCSIsBasicLatin (int code); XMLPUBFUN int XMLCALL xmlUCSIsBengali (int code); XMLPUBFUN int XMLCALL xmlUCSIsBlockElements (int code); XMLPUBFUN int XMLCALL xmlUCSIsBopomofo (int code); XMLPUBFUN int XMLCALL xmlUCSIsBopomofoExtended (int code); XMLPUBFUN int XMLCALL xmlUCSIsBoxDrawing (int code); XMLPUBFUN int XMLCALL xmlUCSIsBraillePatterns (int code); XMLPUBFUN int XMLCALL xmlUCSIsBuhid (int code); XMLPUBFUN int XMLCALL xmlUCSIsByzantineMusicalSymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibility (int code); XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityForms (int code); XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographs (int code); XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographsSupplement (int code); XMLPUBFUN int XMLCALL xmlUCSIsCJKRadicalsSupplement (int code); XMLPUBFUN int XMLCALL xmlUCSIsCJKSymbolsandPunctuation (int code); XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographs (int code); XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionA (int code); XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionB (int code); XMLPUBFUN int XMLCALL xmlUCSIsCherokee (int code); XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarks (int code); XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarksforSymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsCombiningHalfMarks (int code); XMLPUBFUN int XMLCALL xmlUCSIsCombiningMarksforSymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsControlPictures (int code); XMLPUBFUN int XMLCALL xmlUCSIsCurrencySymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsCypriotSyllabary (int code); XMLPUBFUN int XMLCALL xmlUCSIsCyrillic (int code); XMLPUBFUN int XMLCALL xmlUCSIsCyrillicSupplement (int code); XMLPUBFUN int XMLCALL xmlUCSIsDeseret (int code); XMLPUBFUN int XMLCALL xmlUCSIsDevanagari (int code); XMLPUBFUN int XMLCALL xmlUCSIsDingbats (int code); XMLPUBFUN int XMLCALL xmlUCSIsEnclosedAlphanumerics (int code); XMLPUBFUN int XMLCALL xmlUCSIsEnclosedCJKLettersandMonths (int code); XMLPUBFUN int XMLCALL xmlUCSIsEthiopic (int code); XMLPUBFUN int XMLCALL xmlUCSIsGeneralPunctuation (int code); XMLPUBFUN int XMLCALL xmlUCSIsGeometricShapes (int code); XMLPUBFUN int XMLCALL xmlUCSIsGeorgian (int code); XMLPUBFUN int XMLCALL xmlUCSIsGothic (int code); XMLPUBFUN int XMLCALL xmlUCSIsGreek (int code); XMLPUBFUN int XMLCALL xmlUCSIsGreekExtended (int code); XMLPUBFUN int XMLCALL xmlUCSIsGreekandCoptic (int code); XMLPUBFUN int XMLCALL xmlUCSIsGujarati (int code); XMLPUBFUN int XMLCALL xmlUCSIsGurmukhi (int code); XMLPUBFUN int XMLCALL xmlUCSIsHalfwidthandFullwidthForms (int code); XMLPUBFUN int XMLCALL xmlUCSIsHangulCompatibilityJamo (int code); XMLPUBFUN int XMLCALL xmlUCSIsHangulJamo (int code); XMLPUBFUN int XMLCALL xmlUCSIsHangulSyllables (int code); XMLPUBFUN int XMLCALL xmlUCSIsHanunoo (int code); XMLPUBFUN int XMLCALL xmlUCSIsHebrew (int code); XMLPUBFUN int XMLCALL xmlUCSIsHighPrivateUseSurrogates (int code); XMLPUBFUN int XMLCALL xmlUCSIsHighSurrogates (int code); XMLPUBFUN int XMLCALL xmlUCSIsHiragana (int code); XMLPUBFUN int XMLCALL xmlUCSIsIPAExtensions (int code); XMLPUBFUN int XMLCALL xmlUCSIsIdeographicDescriptionCharacters (int code); XMLPUBFUN int XMLCALL xmlUCSIsKanbun (int code); XMLPUBFUN int XMLCALL xmlUCSIsKangxiRadicals (int code); XMLPUBFUN int XMLCALL xmlUCSIsKannada (int code); XMLPUBFUN int XMLCALL xmlUCSIsKatakana (int code); XMLPUBFUN int XMLCALL xmlUCSIsKatakanaPhoneticExtensions (int code); XMLPUBFUN int XMLCALL xmlUCSIsKhmer (int code); XMLPUBFUN int XMLCALL xmlUCSIsKhmerSymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsLao (int code); XMLPUBFUN int XMLCALL xmlUCSIsLatin1Supplement (int code); XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedA (int code); XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedB (int code); XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedAdditional (int code); XMLPUBFUN int XMLCALL xmlUCSIsLetterlikeSymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsLimbu (int code); XMLPUBFUN int XMLCALL xmlUCSIsLinearBIdeograms (int code); XMLPUBFUN int XMLCALL xmlUCSIsLinearBSyllabary (int code); XMLPUBFUN int XMLCALL xmlUCSIsLowSurrogates (int code); XMLPUBFUN int XMLCALL xmlUCSIsMalayalam (int code); XMLPUBFUN int XMLCALL xmlUCSIsMathematicalAlphanumericSymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsMathematicalOperators (int code); XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsA (int code); XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsB (int code); XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbolsandArrows (int code); XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousTechnical (int code); XMLPUBFUN int XMLCALL xmlUCSIsMongolian (int code); XMLPUBFUN int XMLCALL xmlUCSIsMusicalSymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsMyanmar (int code); XMLPUBFUN int XMLCALL xmlUCSIsNumberForms (int code); XMLPUBFUN int XMLCALL xmlUCSIsOgham (int code); XMLPUBFUN int XMLCALL xmlUCSIsOldItalic (int code); XMLPUBFUN int XMLCALL xmlUCSIsOpticalCharacterRecognition (int code); XMLPUBFUN int XMLCALL xmlUCSIsOriya (int code); XMLPUBFUN int XMLCALL xmlUCSIsOsmanya (int code); XMLPUBFUN int XMLCALL xmlUCSIsPhoneticExtensions (int code); XMLPUBFUN int XMLCALL xmlUCSIsPrivateUse (int code); XMLPUBFUN int XMLCALL xmlUCSIsPrivateUseArea (int code); XMLPUBFUN int XMLCALL xmlUCSIsRunic (int code); XMLPUBFUN int XMLCALL xmlUCSIsShavian (int code); XMLPUBFUN int XMLCALL xmlUCSIsSinhala (int code); XMLPUBFUN int XMLCALL xmlUCSIsSmallFormVariants (int code); XMLPUBFUN int XMLCALL xmlUCSIsSpacingModifierLetters (int code); XMLPUBFUN int XMLCALL xmlUCSIsSpecials (int code); XMLPUBFUN int XMLCALL xmlUCSIsSuperscriptsandSubscripts (int code); XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsA (int code); XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsB (int code); XMLPUBFUN int XMLCALL xmlUCSIsSupplementalMathematicalOperators (int code); XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaA (int code); XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaB (int code); XMLPUBFUN int XMLCALL xmlUCSIsSyriac (int code); XMLPUBFUN int XMLCALL xmlUCSIsTagalog (int code); XMLPUBFUN int XMLCALL xmlUCSIsTagbanwa (int code); XMLPUBFUN int XMLCALL xmlUCSIsTags (int code); XMLPUBFUN int XMLCALL xmlUCSIsTaiLe (int code); XMLPUBFUN int XMLCALL xmlUCSIsTaiXuanJingSymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsTamil (int code); XMLPUBFUN int XMLCALL xmlUCSIsTelugu (int code); XMLPUBFUN int XMLCALL xmlUCSIsThaana (int code); XMLPUBFUN int XMLCALL xmlUCSIsThai (int code); XMLPUBFUN int XMLCALL xmlUCSIsTibetan (int code); XMLPUBFUN int XMLCALL xmlUCSIsUgaritic (int code); XMLPUBFUN int XMLCALL xmlUCSIsUnifiedCanadianAboriginalSyllabics (int code); XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectors (int code); XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectorsSupplement (int code); XMLPUBFUN int XMLCALL xmlUCSIsYiRadicals (int code); XMLPUBFUN int XMLCALL xmlUCSIsYiSyllables (int code); XMLPUBFUN int XMLCALL xmlUCSIsYijingHexagramSymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsBlock (int code, const char *block); XMLPUBFUN int XMLCALL xmlUCSIsCatC (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatCc (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatCf (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatCo (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatCs (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatL (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatLl (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatLm (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatLo (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatLt (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatLu (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatM (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatMc (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatMe (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatMn (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatN (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatNd (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatNl (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatNo (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatP (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatPc (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatPd (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatPe (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatPf (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatPi (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatPo (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatPs (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatS (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatSc (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatSk (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatSm (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatSo (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatZ (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatZl (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatZp (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatZs (int code); XMLPUBFUN int XMLCALL xmlUCSIsCat (int code, const char *cat); #ifdef __cplusplus } #endif #endif /* LIBXML_UNICODE_ENABLED */ #endif /* __XML_UNICODE_H__ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/xmlIO.h������������������������������������������������������������������������������0000644�����������������00000024567�14763166030�0010631 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: interface for the I/O interfaces used by the parser * Description: interface for the I/O interfaces used by the parser * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_IO_H__ #define __XML_IO_H__ #include <stdio.h> #include <libxml/xmlversion.h> #ifdef __cplusplus extern "C" { #endif /* * Those are the functions and datatypes for the parser input * I/O structures. */ /** * xmlInputMatchCallback: * @filename: the filename or URI * * Callback used in the I/O Input API to detect if the current handler * can provide input fonctionnalities for this resource. * * Returns 1 if yes and 0 if another Input module should be used */ typedef int (XMLCALL *xmlInputMatchCallback) (char const *filename); /** * xmlInputOpenCallback: * @filename: the filename or URI * * Callback used in the I/O Input API to open the resource * * Returns an Input context or NULL in case or error */ typedef void * (XMLCALL *xmlInputOpenCallback) (char const *filename); /** * xmlInputReadCallback: * @context: an Input context * @buffer: the buffer to store data read * @len: the length of the buffer in bytes * * Callback used in the I/O Input API to read the resource * * Returns the number of bytes read or -1 in case of error */ typedef int (XMLCALL *xmlInputReadCallback) (void * context, char * buffer, int len); /** * xmlInputCloseCallback: * @context: an Input context * * Callback used in the I/O Input API to close the resource * * Returns 0 or -1 in case of error */ typedef int (XMLCALL *xmlInputCloseCallback) (void * context); #ifdef LIBXML_OUTPUT_ENABLED /* * Those are the functions and datatypes for the library output * I/O structures. */ /** * xmlOutputMatchCallback: * @filename: the filename or URI * * Callback used in the I/O Output API to detect if the current handler * can provide output fonctionnalities for this resource. * * Returns 1 if yes and 0 if another Output module should be used */ typedef int (XMLCALL *xmlOutputMatchCallback) (char const *filename); /** * xmlOutputOpenCallback: * @filename: the filename or URI * * Callback used in the I/O Output API to open the resource * * Returns an Output context or NULL in case or error */ typedef void * (XMLCALL *xmlOutputOpenCallback) (char const *filename); /** * xmlOutputWriteCallback: * @context: an Output context * @buffer: the buffer of data to write * @len: the length of the buffer in bytes * * Callback used in the I/O Output API to write to the resource * * Returns the number of bytes written or -1 in case of error */ typedef int (XMLCALL *xmlOutputWriteCallback) (void * context, const char * buffer, int len); /** * xmlOutputCloseCallback: * @context: an Output context * * Callback used in the I/O Output API to close the resource * * Returns 0 or -1 in case of error */ typedef int (XMLCALL *xmlOutputCloseCallback) (void * context); #endif /* LIBXML_OUTPUT_ENABLED */ #ifdef __cplusplus } #endif #include <libxml/globals.h> #include <libxml/tree.h> #include <libxml/parser.h> #include <libxml/encoding.h> #ifdef __cplusplus extern "C" { #endif struct _xmlParserInputBuffer { void* context; xmlInputReadCallback readcallback; xmlInputCloseCallback closecallback; xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ xmlBufPtr buffer; /* Local buffer encoded in UTF-8 */ xmlBufPtr raw; /* if encoder != NULL buffer for raw input */ int compressed; /* -1=unknown, 0=not compressed, 1=compressed */ int error; unsigned long rawconsumed;/* amount consumed from raw */ }; #ifdef LIBXML_OUTPUT_ENABLED struct _xmlOutputBuffer { void* context; xmlOutputWriteCallback writecallback; xmlOutputCloseCallback closecallback; xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ xmlBufPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */ xmlBufPtr conv; /* if encoder != NULL buffer for output */ int written; /* total number of byte written */ int error; }; #endif /* LIBXML_OUTPUT_ENABLED */ /* * Interfaces for input */ XMLPUBFUN void XMLCALL xmlCleanupInputCallbacks (void); XMLPUBFUN int XMLCALL xmlPopInputCallbacks (void); XMLPUBFUN void XMLCALL xmlRegisterDefaultInputCallbacks (void); XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlAllocParserInputBuffer (xmlCharEncoding enc); XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateFilename (const char *URI, xmlCharEncoding enc); XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateFile (FILE *file, xmlCharEncoding enc); XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateFd (int fd, xmlCharEncoding enc); XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateMem (const char *mem, int size, xmlCharEncoding enc); XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateStatic (const char *mem, int size, xmlCharEncoding enc); XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateIO (xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, xmlCharEncoding enc); XMLPUBFUN int XMLCALL xmlParserInputBufferRead (xmlParserInputBufferPtr in, int len); XMLPUBFUN int XMLCALL xmlParserInputBufferGrow (xmlParserInputBufferPtr in, int len); XMLPUBFUN int XMLCALL xmlParserInputBufferPush (xmlParserInputBufferPtr in, int len, const char *buf); XMLPUBFUN void XMLCALL xmlFreeParserInputBuffer (xmlParserInputBufferPtr in); XMLPUBFUN char * XMLCALL xmlParserGetDirectory (const char *filename); XMLPUBFUN int XMLCALL xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc, xmlInputOpenCallback openFunc, xmlInputReadCallback readFunc, xmlInputCloseCallback closeFunc); xmlParserInputBufferPtr __xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc); #ifdef LIBXML_OUTPUT_ENABLED /* * Interfaces for output */ XMLPUBFUN void XMLCALL xmlCleanupOutputCallbacks (void); XMLPUBFUN void XMLCALL xmlRegisterDefaultOutputCallbacks(void); XMLPUBFUN xmlOutputBufferPtr XMLCALL xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder); XMLPUBFUN xmlOutputBufferPtr XMLCALL xmlOutputBufferCreateFilename (const char *URI, xmlCharEncodingHandlerPtr encoder, int compression); XMLPUBFUN xmlOutputBufferPtr XMLCALL xmlOutputBufferCreateFile (FILE *file, xmlCharEncodingHandlerPtr encoder); XMLPUBFUN xmlOutputBufferPtr XMLCALL xmlOutputBufferCreateBuffer (xmlBufferPtr buffer, xmlCharEncodingHandlerPtr encoder); XMLPUBFUN xmlOutputBufferPtr XMLCALL xmlOutputBufferCreateFd (int fd, xmlCharEncodingHandlerPtr encoder); XMLPUBFUN xmlOutputBufferPtr XMLCALL xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite, xmlOutputCloseCallback ioclose, void *ioctx, xmlCharEncodingHandlerPtr encoder); /* Couple of APIs to get the output without digging into the buffers */ XMLPUBFUN const xmlChar * XMLCALL xmlOutputBufferGetContent (xmlOutputBufferPtr out); XMLPUBFUN size_t XMLCALL xmlOutputBufferGetSize (xmlOutputBufferPtr out); XMLPUBFUN int XMLCALL xmlOutputBufferWrite (xmlOutputBufferPtr out, int len, const char *buf); XMLPUBFUN int XMLCALL xmlOutputBufferWriteString (xmlOutputBufferPtr out, const char *str); XMLPUBFUN int XMLCALL xmlOutputBufferWriteEscape (xmlOutputBufferPtr out, const xmlChar *str, xmlCharEncodingOutputFunc escaping); XMLPUBFUN int XMLCALL xmlOutputBufferFlush (xmlOutputBufferPtr out); XMLPUBFUN int XMLCALL xmlOutputBufferClose (xmlOutputBufferPtr out); XMLPUBFUN int XMLCALL xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc, xmlOutputOpenCallback openFunc, xmlOutputWriteCallback writeFunc, xmlOutputCloseCallback closeFunc); xmlOutputBufferPtr __xmlOutputBufferCreateFilename(const char *URI, xmlCharEncodingHandlerPtr encoder, int compression); #ifdef LIBXML_HTTP_ENABLED /* This function only exists if HTTP support built into the library */ XMLPUBFUN void XMLCALL xmlRegisterHTTPPostCallbacks (void ); #endif /* LIBXML_HTTP_ENABLED */ #endif /* LIBXML_OUTPUT_ENABLED */ XMLPUBFUN xmlParserInputPtr XMLCALL xmlCheckHTTPInput (xmlParserCtxtPtr ctxt, xmlParserInputPtr ret); /* * A predefined entity loader disabling network accesses */ XMLPUBFUN xmlParserInputPtr XMLCALL xmlNoNetExternalEntityLoader (const char *URL, const char *ID, xmlParserCtxtPtr ctxt); /* * xmlNormalizeWindowsPath is obsolete, don't use it. * Check xmlCanonicPath in uri.h for a better alternative. */ XMLPUBFUN xmlChar * XMLCALL xmlNormalizeWindowsPath (const xmlChar *path); XMLPUBFUN int XMLCALL xmlCheckFilename (const char *path); /** * Default 'file://' protocol callbacks */ XMLPUBFUN int XMLCALL xmlFileMatch (const char *filename); XMLPUBFUN void * XMLCALL xmlFileOpen (const char *filename); XMLPUBFUN int XMLCALL xmlFileRead (void * context, char * buffer, int len); XMLPUBFUN int XMLCALL xmlFileClose (void * context); /** * Default 'http://' protocol callbacks */ #ifdef LIBXML_HTTP_ENABLED XMLPUBFUN int XMLCALL xmlIOHTTPMatch (const char *filename); XMLPUBFUN void * XMLCALL xmlIOHTTPOpen (const char *filename); #ifdef LIBXML_OUTPUT_ENABLED XMLPUBFUN void * XMLCALL xmlIOHTTPOpenW (const char * post_uri, int compression ); #endif /* LIBXML_OUTPUT_ENABLED */ XMLPUBFUN int XMLCALL xmlIOHTTPRead (void * context, char * buffer, int len); XMLPUBFUN int XMLCALL xmlIOHTTPClose (void * context); #endif /* LIBXML_HTTP_ENABLED */ /** * Default 'ftp://' protocol callbacks */ #ifdef LIBXML_FTP_ENABLED XMLPUBFUN int XMLCALL xmlIOFTPMatch (const char *filename); XMLPUBFUN void * XMLCALL xmlIOFTPOpen (const char *filename); XMLPUBFUN int XMLCALL xmlIOFTPRead (void * context, char * buffer, int len); XMLPUBFUN int XMLCALL xmlIOFTPClose (void * context); #endif /* LIBXML_FTP_ENABLED */ #ifdef __cplusplus } #endif #endif /* __XML_IO_H__ */ �����������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/nanohttp.h���������������������������������������������������������������������������0000644�����������������00000003725�14763166030�0011425 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: minimal HTTP implementation * Description: minimal HTTP implementation allowing to fetch resources * like external subset. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __NANO_HTTP_H__ #define __NANO_HTTP_H__ #include <libxml/xmlversion.h> #ifdef LIBXML_HTTP_ENABLED #ifdef __cplusplus extern "C" { #endif XMLPUBFUN void XMLCALL xmlNanoHTTPInit (void); XMLPUBFUN void XMLCALL xmlNanoHTTPCleanup (void); XMLPUBFUN void XMLCALL xmlNanoHTTPScanProxy (const char *URL); XMLPUBFUN int XMLCALL xmlNanoHTTPFetch (const char *URL, const char *filename, char **contentType); XMLPUBFUN void * XMLCALL xmlNanoHTTPMethod (const char *URL, const char *method, const char *input, char **contentType, const char *headers, int ilen); XMLPUBFUN void * XMLCALL xmlNanoHTTPMethodRedir (const char *URL, const char *method, const char *input, char **contentType, char **redir, const char *headers, int ilen); XMLPUBFUN void * XMLCALL xmlNanoHTTPOpen (const char *URL, char **contentType); XMLPUBFUN void * XMLCALL xmlNanoHTTPOpenRedir (const char *URL, char **contentType, char **redir); XMLPUBFUN int XMLCALL xmlNanoHTTPReturnCode (void *ctx); XMLPUBFUN const char * XMLCALL xmlNanoHTTPAuthHeader (void *ctx); XMLPUBFUN const char * XMLCALL xmlNanoHTTPRedir (void *ctx); XMLPUBFUN int XMLCALL xmlNanoHTTPContentLength( void * ctx ); XMLPUBFUN const char * XMLCALL xmlNanoHTTPEncoding (void *ctx); XMLPUBFUN const char * XMLCALL xmlNanoHTTPMimeType (void *ctx); XMLPUBFUN int XMLCALL xmlNanoHTTPRead (void *ctx, void *dest, int len); #ifdef LIBXML_OUTPUT_ENABLED XMLPUBFUN int XMLCALL xmlNanoHTTPSave (void *ctxt, const char *filename); #endif /* LIBXML_OUTPUT_ENABLED */ XMLPUBFUN void XMLCALL xmlNanoHTTPClose (void *ctx); #ifdef __cplusplus } #endif #endif /* LIBXML_HTTP_ENABLED */ #endif /* __NANO_HTTP_H__ */ �������������������������������������������libxml2/libxml/xmlversion.h�������������������������������������������������������������������������0000644�����������������00000017667�14763166030�0012012 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: compile-time version informations * Description: compile-time version informations for the XML library * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_VERSION_H__ #define __XML_VERSION_H__ #include <libxml/xmlexports.h> #ifdef __cplusplus extern "C" { #endif /* * use those to be sure nothing nasty will happen if * your library and includes mismatch */ #ifndef LIBXML2_COMPILING_MSCCDEF XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #endif /* LIBXML2_COMPILING_MSCCDEF */ /** * LIBXML_DOTTED_VERSION: * * the version string like "1.2.3" */ #define LIBXML_DOTTED_VERSION "2.9.1" /** * LIBXML_VERSION: * * the version number: 1.2.3 value is 10203 */ #define LIBXML_VERSION 20901 /** * LIBXML_VERSION_STRING: * * the version number string, 1.2.3 value is "10203" */ #define LIBXML_VERSION_STRING "20901" /** * LIBXML_VERSION_EXTRA: * * extra version information, used to show a CVS compilation */ #define LIBXML_VERSION_EXTRA "" /** * LIBXML_TEST_VERSION: * * Macro to check that the libxml version in use is compatible with * the version the software has been compiled against */ #define LIBXML_TEST_VERSION xmlCheckVersion(20901); #ifndef VMS #if 0 /** * WITH_TRIO: * * defined if the trio support need to be configured in */ #define WITH_TRIO #else /** * WITHOUT_TRIO: * * defined if the trio support should not be configured in */ #define WITHOUT_TRIO #endif #else /* VMS */ /** * WITH_TRIO: * * defined if the trio support need to be configured in */ #define WITH_TRIO 1 #endif /* VMS */ /** * LIBXML_THREAD_ENABLED: * * Whether the thread support is configured in */ #if 1 #if defined(_REENTRANT) || defined(__MT__) || \ (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L)) #define LIBXML_THREAD_ENABLED #endif #endif /** * LIBXML_THREAD_ALLOC_ENABLED: * * Whether the allocation hooks are per-thread */ #if 0 #define LIBXML_THREAD_ALLOC_ENABLED #endif /** * LIBXML_TREE_ENABLED: * * Whether the DOM like tree manipulation API support is configured in */ #if 1 #define LIBXML_TREE_ENABLED #endif /** * LIBXML_OUTPUT_ENABLED: * * Whether the serialization/saving support is configured in */ #if 1 #define LIBXML_OUTPUT_ENABLED #endif /** * LIBXML_PUSH_ENABLED: * * Whether the push parsing interfaces are configured in */ #if 1 #define LIBXML_PUSH_ENABLED #endif /** * LIBXML_READER_ENABLED: * * Whether the xmlReader parsing interface is configured in */ #if 1 #define LIBXML_READER_ENABLED #endif /** * LIBXML_PATTERN_ENABLED: * * Whether the xmlPattern node selection interface is configured in */ #if 1 #define LIBXML_PATTERN_ENABLED #endif /** * LIBXML_WRITER_ENABLED: * * Whether the xmlWriter saving interface is configured in */ #if 1 #define LIBXML_WRITER_ENABLED #endif /** * LIBXML_SAX1_ENABLED: * * Whether the older SAX1 interface is configured in */ #if 1 #define LIBXML_SAX1_ENABLED #endif /** * LIBXML_FTP_ENABLED: * * Whether the FTP support is configured in */ #if 1 #define LIBXML_FTP_ENABLED #endif /** * LIBXML_HTTP_ENABLED: * * Whether the HTTP support is configured in */ #if 1 #define LIBXML_HTTP_ENABLED #endif /** * LIBXML_VALID_ENABLED: * * Whether the DTD validation support is configured in */ #if 1 #define LIBXML_VALID_ENABLED #endif /** * LIBXML_HTML_ENABLED: * * Whether the HTML support is configured in */ #if 1 #define LIBXML_HTML_ENABLED #endif /** * LIBXML_LEGACY_ENABLED: * * Whether the deprecated APIs are compiled in for compatibility */ #if 1 #define LIBXML_LEGACY_ENABLED #endif /** * LIBXML_C14N_ENABLED: * * Whether the Canonicalization support is configured in */ #if 1 #define LIBXML_C14N_ENABLED #endif /** * LIBXML_CATALOG_ENABLED: * * Whether the Catalog support is configured in */ #if 1 #define LIBXML_CATALOG_ENABLED #endif /** * LIBXML_DOCB_ENABLED: * * Whether the SGML Docbook support is configured in */ #if 1 #define LIBXML_DOCB_ENABLED #endif /** * LIBXML_XPATH_ENABLED: * * Whether XPath is configured in */ #if 1 #define LIBXML_XPATH_ENABLED #endif /** * LIBXML_XPTR_ENABLED: * * Whether XPointer is configured in */ #if 1 #define LIBXML_XPTR_ENABLED #endif /** * LIBXML_XINCLUDE_ENABLED: * * Whether XInclude is configured in */ #if 1 #define LIBXML_XINCLUDE_ENABLED #endif /** * LIBXML_ICONV_ENABLED: * * Whether iconv support is available */ #if 1 #define LIBXML_ICONV_ENABLED #endif /** * LIBXML_ICU_ENABLED: * * Whether icu support is available */ #if 0 #define LIBXML_ICU_ENABLED #endif /** * LIBXML_ISO8859X_ENABLED: * * Whether ISO-8859-* support is made available in case iconv is not */ #if 1 #define LIBXML_ISO8859X_ENABLED #endif /** * LIBXML_DEBUG_ENABLED: * * Whether Debugging module is configured in */ #if 1 #define LIBXML_DEBUG_ENABLED #endif /** * DEBUG_MEMORY_LOCATION: * * Whether the memory debugging is configured in */ #if 0 #define DEBUG_MEMORY_LOCATION #endif /** * LIBXML_DEBUG_RUNTIME: * * Whether the runtime debugging is configured in */ #if 0 #define LIBXML_DEBUG_RUNTIME #endif /** * LIBXML_UNICODE_ENABLED: * * Whether the Unicode related interfaces are compiled in */ #if 1 #define LIBXML_UNICODE_ENABLED #endif /** * LIBXML_REGEXP_ENABLED: * * Whether the regular expressions interfaces are compiled in */ #if 1 #define LIBXML_REGEXP_ENABLED #endif /** * LIBXML_AUTOMATA_ENABLED: * * Whether the automata interfaces are compiled in */ #if 1 #define LIBXML_AUTOMATA_ENABLED #endif /** * LIBXML_EXPR_ENABLED: * * Whether the formal expressions interfaces are compiled in */ #if 1 #define LIBXML_EXPR_ENABLED #endif /** * LIBXML_SCHEMAS_ENABLED: * * Whether the Schemas validation interfaces are compiled in */ #if 1 #define LIBXML_SCHEMAS_ENABLED #endif /** * LIBXML_SCHEMATRON_ENABLED: * * Whether the Schematron validation interfaces are compiled in */ #if 1 #define LIBXML_SCHEMATRON_ENABLED #endif /** * LIBXML_MODULES_ENABLED: * * Whether the module interfaces are compiled in */ #if 1 #define LIBXML_MODULES_ENABLED /** * LIBXML_MODULE_EXTENSION: * * the string suffix used by dynamic modules (usually shared libraries) */ #define LIBXML_MODULE_EXTENSION ".so" #endif /** * LIBXML_ZLIB_ENABLED: * * Whether the Zlib support is compiled in */ #if 1 #define LIBXML_ZLIB_ENABLED #endif /** * LIBXML_LZMA_ENABLED: * * Whether the Lzma support is compiled in */ #if 1 #define LIBXML_LZMA_ENABLED #endif #ifdef __GNUC__ #ifdef HAVE_ANSIDECL_H #include <ansidecl.h> #endif /** * ATTRIBUTE_UNUSED: * * Macro used to signal to GCC unused function parameters */ #ifndef ATTRIBUTE_UNUSED # if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) # define ATTRIBUTE_UNUSED __attribute__((unused)) # else # define ATTRIBUTE_UNUSED # endif #endif /** * LIBXML_ATTR_ALLOC_SIZE: * * Macro used to indicate to GCC this is an allocator function */ #ifndef LIBXML_ATTR_ALLOC_SIZE # if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))) # define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x))) # else # define LIBXML_ATTR_ALLOC_SIZE(x) # endif #else # define LIBXML_ATTR_ALLOC_SIZE(x) #endif /** * LIBXML_ATTR_FORMAT: * * Macro used to indicate to GCC the parameter are printf like */ #ifndef LIBXML_ATTR_FORMAT # if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) # define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args))) # else # define LIBXML_ATTR_FORMAT(fmt,args) # endif #else # define LIBXML_ATTR_FORMAT(fmt,args) #endif #else /* ! __GNUC__ */ /** * ATTRIBUTE_UNUSED: * * Macro used to signal to GCC unused function parameters */ #define ATTRIBUTE_UNUSED /** * LIBXML_ATTR_ALLOC_SIZE: * * Macro used to indicate to GCC this is an allocator function */ #define LIBXML_ATTR_ALLOC_SIZE(x) /** * LIBXML_ATTR_FORMAT: * * Macro used to indicate to GCC the parameter are printf like */ #define LIBXML_ATTR_FORMAT(fmt,args) #endif /* __GNUC__ */ #ifdef __cplusplus } #endif /* __cplusplus */ #endif �������������������������������������������������������������������������libxml2/libxml/xpath.h������������������������������������������������������������������������������0000644�����������������00000040016�14763166030�0010710 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: XML Path Language implementation * Description: API for the XML Path Language implementation * * XML Path Language implementation * XPath is a language for addressing parts of an XML document, * designed to be used by both XSLT and XPointer * http://www.w3.org/TR/xpath * * Implements * W3C Recommendation 16 November 1999 * http://www.w3.org/TR/1999/REC-xpath-19991116 * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XPATH_H__ #define __XML_XPATH_H__ #include <libxml/xmlversion.h> #ifdef LIBXML_XPATH_ENABLED #include <libxml/xmlerror.h> #include <libxml/tree.h> #include <libxml/hash.h> #endif /* LIBXML_XPATH_ENABLED */ #if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) #ifdef __cplusplus extern "C" { #endif #endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED */ #ifdef LIBXML_XPATH_ENABLED typedef struct _xmlXPathContext xmlXPathContext; typedef xmlXPathContext *xmlXPathContextPtr; typedef struct _xmlXPathParserContext xmlXPathParserContext; typedef xmlXPathParserContext *xmlXPathParserContextPtr; /** * The set of XPath error codes. */ typedef enum { XPATH_EXPRESSION_OK = 0, XPATH_NUMBER_ERROR, XPATH_UNFINISHED_LITERAL_ERROR, XPATH_START_LITERAL_ERROR, XPATH_VARIABLE_REF_ERROR, XPATH_UNDEF_VARIABLE_ERROR, XPATH_INVALID_PREDICATE_ERROR, XPATH_EXPR_ERROR, XPATH_UNCLOSED_ERROR, XPATH_UNKNOWN_FUNC_ERROR, XPATH_INVALID_OPERAND, XPATH_INVALID_TYPE, XPATH_INVALID_ARITY, XPATH_INVALID_CTXT_SIZE, XPATH_INVALID_CTXT_POSITION, XPATH_MEMORY_ERROR, XPTR_SYNTAX_ERROR, XPTR_RESOURCE_ERROR, XPTR_SUB_RESOURCE_ERROR, XPATH_UNDEF_PREFIX_ERROR, XPATH_ENCODING_ERROR, XPATH_INVALID_CHAR_ERROR, XPATH_INVALID_CTXT, XPATH_STACK_ERROR, XPATH_FORBID_VARIABLE_ERROR } xmlXPathError; /* * A node-set (an unordered collection of nodes without duplicates). */ typedef struct _xmlNodeSet xmlNodeSet; typedef xmlNodeSet *xmlNodeSetPtr; struct _xmlNodeSet { int nodeNr; /* number of nodes in the set */ int nodeMax; /* size of the array as allocated */ xmlNodePtr *nodeTab; /* array of nodes in no particular order */ /* @@ with_ns to check wether namespace nodes should be looked at @@ */ }; /* * An expression is evaluated to yield an object, which * has one of the following four basic types: * - node-set * - boolean * - number * - string * * @@ XPointer will add more types ! */ typedef enum { XPATH_UNDEFINED = 0, XPATH_NODESET = 1, XPATH_BOOLEAN = 2, XPATH_NUMBER = 3, XPATH_STRING = 4, XPATH_POINT = 5, XPATH_RANGE = 6, XPATH_LOCATIONSET = 7, XPATH_USERS = 8, XPATH_XSLT_TREE = 9 /* An XSLT value tree, non modifiable */ } xmlXPathObjectType; typedef struct _xmlXPathObject xmlXPathObject; typedef xmlXPathObject *xmlXPathObjectPtr; struct _xmlXPathObject { xmlXPathObjectType type; xmlNodeSetPtr nodesetval; int boolval; double floatval; xmlChar *stringval; void *user; int index; void *user2; int index2; }; /** * xmlXPathConvertFunc: * @obj: an XPath object * @type: the number of the target type * * A conversion function is associated to a type and used to cast * the new type to primitive values. * * Returns -1 in case of error, 0 otherwise */ typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type); /* * Extra type: a name and a conversion function. */ typedef struct _xmlXPathType xmlXPathType; typedef xmlXPathType *xmlXPathTypePtr; struct _xmlXPathType { const xmlChar *name; /* the type name */ xmlXPathConvertFunc func; /* the conversion function */ }; /* * Extra variable: a name and a value. */ typedef struct _xmlXPathVariable xmlXPathVariable; typedef xmlXPathVariable *xmlXPathVariablePtr; struct _xmlXPathVariable { const xmlChar *name; /* the variable name */ xmlXPathObjectPtr value; /* the value */ }; /** * xmlXPathEvalFunc: * @ctxt: an XPath parser context * @nargs: the number of arguments passed to the function * * An XPath evaluation function, the parameters are on the XPath context stack. */ typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt, int nargs); /* * Extra function: a name and a evaluation function. */ typedef struct _xmlXPathFunct xmlXPathFunct; typedef xmlXPathFunct *xmlXPathFuncPtr; struct _xmlXPathFunct { const xmlChar *name; /* the function name */ xmlXPathEvalFunc func; /* the evaluation function */ }; /** * xmlXPathAxisFunc: * @ctxt: the XPath interpreter context * @cur: the previous node being explored on that axis * * An axis traversal function. To traverse an axis, the engine calls * the first time with cur == NULL and repeat until the function returns * NULL indicating the end of the axis traversal. * * Returns the next node in that axis or NULL if at the end of the axis. */ typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr cur); /* * Extra axis: a name and an axis function. */ typedef struct _xmlXPathAxis xmlXPathAxis; typedef xmlXPathAxis *xmlXPathAxisPtr; struct _xmlXPathAxis { const xmlChar *name; /* the axis name */ xmlXPathAxisFunc func; /* the search function */ }; /** * xmlXPathFunction: * @ctxt: the XPath interprestation context * @nargs: the number of arguments * * An XPath function. * The arguments (if any) are popped out from the context stack * and the result is pushed on the stack. */ typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs); /* * Function and Variable Lookup. */ /** * xmlXPathVariableLookupFunc: * @ctxt: an XPath context * @name: name of the variable * @ns_uri: the namespace name hosting this variable * * Prototype for callbacks used to plug variable lookup in the XPath * engine. * * Returns the XPath object value or NULL if not found. */ typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt, const xmlChar *name, const xmlChar *ns_uri); /** * xmlXPathFuncLookupFunc: * @ctxt: an XPath context * @name: name of the function * @ns_uri: the namespace name hosting this function * * Prototype for callbacks used to plug function lookup in the XPath * engine. * * Returns the XPath function or NULL if not found. */ typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt, const xmlChar *name, const xmlChar *ns_uri); /** * xmlXPathFlags: * Flags for XPath engine compilation and runtime */ /** * XML_XPATH_CHECKNS: * * check namespaces at compilation */ #define XML_XPATH_CHECKNS (1<<0) /** * XML_XPATH_NOVAR: * * forbid variables in expression */ #define XML_XPATH_NOVAR (1<<1) /** * xmlXPathContext: * * Expression evaluation occurs with respect to a context. * he context consists of: * - a node (the context node) * - a node list (the context node list) * - a set of variable bindings * - a function library * - the set of namespace declarations in scope for the expression * Following the switch to hash tables, this need to be trimmed up at * the next binary incompatible release. * The node may be modified when the context is passed to libxml2 * for an XPath evaluation so you may need to initialize it again * before the next call. */ struct _xmlXPathContext { xmlDocPtr doc; /* The current document */ xmlNodePtr node; /* The current node */ int nb_variables_unused; /* unused (hash table) */ int max_variables_unused; /* unused (hash table) */ xmlHashTablePtr varHash; /* Hash table of defined variables */ int nb_types; /* number of defined types */ int max_types; /* max number of types */ xmlXPathTypePtr types; /* Array of defined types */ int nb_funcs_unused; /* unused (hash table) */ int max_funcs_unused; /* unused (hash table) */ xmlHashTablePtr funcHash; /* Hash table of defined funcs */ int nb_axis; /* number of defined axis */ int max_axis; /* max number of axis */ xmlXPathAxisPtr axis; /* Array of defined axis */ /* the namespace nodes of the context node */ xmlNsPtr *namespaces; /* Array of namespaces */ int nsNr; /* number of namespace in scope */ void *user; /* function to free */ /* extra variables */ int contextSize; /* the context size */ int proximityPosition; /* the proximity position */ /* extra stuff for XPointer */ int xptr; /* is this an XPointer context? */ xmlNodePtr here; /* for here() */ xmlNodePtr origin; /* for origin() */ /* the set of namespace declarations in scope for the expression */ xmlHashTablePtr nsHash; /* The namespaces hash table */ xmlXPathVariableLookupFunc varLookupFunc;/* variable lookup func */ void *varLookupData; /* variable lookup data */ /* Possibility to link in an extra item */ void *extra; /* needed for XSLT */ /* The function name and URI when calling a function */ const xmlChar *function; const xmlChar *functionURI; /* function lookup function and data */ xmlXPathFuncLookupFunc funcLookupFunc;/* function lookup func */ void *funcLookupData; /* function lookup data */ /* temporary namespace lists kept for walking the namespace axis */ xmlNsPtr *tmpNsList; /* Array of namespaces */ int tmpNsNr; /* number of namespaces in scope */ /* error reporting mechanism */ void *userData; /* user specific data block */ xmlStructuredErrorFunc error; /* the callback in case of errors */ xmlError lastError; /* the last error */ xmlNodePtr debugNode; /* the source node XSLT */ /* dictionary */ xmlDictPtr dict; /* dictionary if any */ int flags; /* flags to control compilation */ /* Cache for reusal of XPath objects */ void *cache; }; /* * The structure of a compiled expression form is not public. */ typedef struct _xmlXPathCompExpr xmlXPathCompExpr; typedef xmlXPathCompExpr *xmlXPathCompExprPtr; /** * xmlXPathParserContext: * * An XPath parser context. It contains pure parsing informations, * an xmlXPathContext, and the stack of objects. */ struct _xmlXPathParserContext { const xmlChar *cur; /* the current char being parsed */ const xmlChar *base; /* the full expression */ int error; /* error code */ xmlXPathContextPtr context; /* the evaluation context */ xmlXPathObjectPtr value; /* the current value */ int valueNr; /* number of values stacked */ int valueMax; /* max number of values stacked */ xmlXPathObjectPtr *valueTab; /* stack of values */ xmlXPathCompExprPtr comp; /* the precompiled expression */ int xptr; /* it this an XPointer expression */ xmlNodePtr ancestor; /* used for walking preceding axis */ int valueFrame; /* used to limit Pop on the stack */ }; /************************************************************************ * * * Public API * * * ************************************************************************/ /** * Objects and Nodesets handling */ XMLPUBVAR double xmlXPathNAN; XMLPUBVAR double xmlXPathPINF; XMLPUBVAR double xmlXPathNINF; /* These macros may later turn into functions */ /** * xmlXPathNodeSetGetLength: * @ns: a node-set * * Implement a functionality similar to the DOM NodeList.length. * * Returns the number of nodes in the node-set. */ #define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0) /** * xmlXPathNodeSetItem: * @ns: a node-set * @index: index of a node in the set * * Implements a functionality similar to the DOM NodeList.item(). * * Returns the xmlNodePtr at the given @index in @ns or NULL if * @index is out of range (0 to length-1) */ #define xmlXPathNodeSetItem(ns, index) \ ((((ns) != NULL) && \ ((index) >= 0) && ((index) < (ns)->nodeNr)) ? \ (ns)->nodeTab[(index)] \ : NULL) /** * xmlXPathNodeSetIsEmpty: * @ns: a node-set * * Checks whether @ns is empty or not. * * Returns %TRUE if @ns is an empty node-set. */ #define xmlXPathNodeSetIsEmpty(ns) \ (((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL)) XMLPUBFUN void XMLCALL xmlXPathFreeObject (xmlXPathObjectPtr obj); XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathNodeSetCreate (xmlNodePtr val); XMLPUBFUN void XMLCALL xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj); XMLPUBFUN void XMLCALL xmlXPathFreeNodeSet (xmlNodeSetPtr obj); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathObjectCopy (xmlXPathObjectPtr val); XMLPUBFUN int XMLCALL xmlXPathCmpNodes (xmlNodePtr node1, xmlNodePtr node2); /** * Conversion functions to basic types. */ XMLPUBFUN int XMLCALL xmlXPathCastNumberToBoolean (double val); XMLPUBFUN int XMLCALL xmlXPathCastStringToBoolean (const xmlChar * val); XMLPUBFUN int XMLCALL xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns); XMLPUBFUN int XMLCALL xmlXPathCastToBoolean (xmlXPathObjectPtr val); XMLPUBFUN double XMLCALL xmlXPathCastBooleanToNumber (int val); XMLPUBFUN double XMLCALL xmlXPathCastStringToNumber (const xmlChar * val); XMLPUBFUN double XMLCALL xmlXPathCastNodeToNumber (xmlNodePtr node); XMLPUBFUN double XMLCALL xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns); XMLPUBFUN double XMLCALL xmlXPathCastToNumber (xmlXPathObjectPtr val); XMLPUBFUN xmlChar * XMLCALL xmlXPathCastBooleanToString (int val); XMLPUBFUN xmlChar * XMLCALL xmlXPathCastNumberToString (double val); XMLPUBFUN xmlChar * XMLCALL xmlXPathCastNodeToString (xmlNodePtr node); XMLPUBFUN xmlChar * XMLCALL xmlXPathCastNodeSetToString (xmlNodeSetPtr ns); XMLPUBFUN xmlChar * XMLCALL xmlXPathCastToString (xmlXPathObjectPtr val); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathConvertBoolean (xmlXPathObjectPtr val); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathConvertNumber (xmlXPathObjectPtr val); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathConvertString (xmlXPathObjectPtr val); /** * Context handling. */ XMLPUBFUN xmlXPathContextPtr XMLCALL xmlXPathNewContext (xmlDocPtr doc); XMLPUBFUN void XMLCALL xmlXPathFreeContext (xmlXPathContextPtr ctxt); XMLPUBFUN int XMLCALL xmlXPathContextSetCache(xmlXPathContextPtr ctxt, int active, int value, int options); /** * Evaluation functions. */ XMLPUBFUN long XMLCALL xmlXPathOrderDocElems (xmlDocPtr doc); XMLPUBFUN int XMLCALL xmlXPathSetContextNode (xmlNodePtr node, xmlXPathContextPtr ctx); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNodeEval (xmlNodePtr node, const xmlChar *str, xmlXPathContextPtr ctx); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathEval (const xmlChar *str, xmlXPathContextPtr ctx); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathEvalExpression (const xmlChar *str, xmlXPathContextPtr ctxt); XMLPUBFUN int XMLCALL xmlXPathEvalPredicate (xmlXPathContextPtr ctxt, xmlXPathObjectPtr res); /** * Separate compilation/evaluation entry points. */ XMLPUBFUN xmlXPathCompExprPtr XMLCALL xmlXPathCompile (const xmlChar *str); XMLPUBFUN xmlXPathCompExprPtr XMLCALL xmlXPathCtxtCompile (xmlXPathContextPtr ctxt, const xmlChar *str); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathCompiledEval (xmlXPathCompExprPtr comp, xmlXPathContextPtr ctx); XMLPUBFUN int XMLCALL xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctxt); XMLPUBFUN void XMLCALL xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp); #endif /* LIBXML_XPATH_ENABLED */ #if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) XMLPUBFUN void XMLCALL xmlXPathInit (void); XMLPUBFUN int XMLCALL xmlXPathIsNaN (double val); XMLPUBFUN int XMLCALL xmlXPathIsInf (double val); #ifdef __cplusplus } #endif #endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED*/ #endif /* ! __XML_XPATH_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/nanoftp.h����������������������������������������������������������������������������0000644�����������������00000007262�14763166030�0011237 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: minimal FTP implementation * Description: minimal FTP implementation allowing to fetch resources * like external subset. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __NANO_FTP_H__ #define __NANO_FTP_H__ #include <libxml/xmlversion.h> #ifdef LIBXML_FTP_ENABLED /* Needed for portability to Windows 64 bits */ #if defined(__MINGW32__) || defined(_WIN32_WCE) #include <winsock2.h> #else /** * SOCKET: * * macro used to provide portability of code to windows sockets */ #define SOCKET int /** * INVALID_SOCKET: * * macro used to provide portability of code to windows sockets * the value to be used when the socket is not valid */ #undef INVALID_SOCKET #define INVALID_SOCKET (-1) #endif #ifdef __cplusplus extern "C" { #endif /** * ftpListCallback: * @userData: user provided data for the callback * @filename: the file name (including "->" when links are shown) * @attrib: the attribute string * @owner: the owner string * @group: the group string * @size: the file size * @links: the link count * @year: the year * @month: the month * @day: the day * @hour: the hour * @minute: the minute * * A callback for the xmlNanoFTPList command. * Note that only one of year and day:minute are specified. */ typedef void (*ftpListCallback) (void *userData, const char *filename, const char *attrib, const char *owner, const char *group, unsigned long size, int links, int year, const char *month, int day, int hour, int minute); /** * ftpDataCallback: * @userData: the user provided context * @data: the data received * @len: its size in bytes * * A callback for the xmlNanoFTPGet command. */ typedef void (*ftpDataCallback) (void *userData, const char *data, int len); /* * Init */ XMLPUBFUN void XMLCALL xmlNanoFTPInit (void); XMLPUBFUN void XMLCALL xmlNanoFTPCleanup (void); /* * Creating/freeing contexts. */ XMLPUBFUN void * XMLCALL xmlNanoFTPNewCtxt (const char *URL); XMLPUBFUN void XMLCALL xmlNanoFTPFreeCtxt (void * ctx); XMLPUBFUN void * XMLCALL xmlNanoFTPConnectTo (const char *server, int port); /* * Opening/closing session connections. */ XMLPUBFUN void * XMLCALL xmlNanoFTPOpen (const char *URL); XMLPUBFUN int XMLCALL xmlNanoFTPConnect (void *ctx); XMLPUBFUN int XMLCALL xmlNanoFTPClose (void *ctx); XMLPUBFUN int XMLCALL xmlNanoFTPQuit (void *ctx); XMLPUBFUN void XMLCALL xmlNanoFTPScanProxy (const char *URL); XMLPUBFUN void XMLCALL xmlNanoFTPProxy (const char *host, int port, const char *user, const char *passwd, int type); XMLPUBFUN int XMLCALL xmlNanoFTPUpdateURL (void *ctx, const char *URL); /* * Rather internal commands. */ XMLPUBFUN int XMLCALL xmlNanoFTPGetResponse (void *ctx); XMLPUBFUN int XMLCALL xmlNanoFTPCheckResponse (void *ctx); /* * CD/DIR/GET handlers. */ XMLPUBFUN int XMLCALL xmlNanoFTPCwd (void *ctx, const char *directory); XMLPUBFUN int XMLCALL xmlNanoFTPDele (void *ctx, const char *file); XMLPUBFUN SOCKET XMLCALL xmlNanoFTPGetConnection (void *ctx); XMLPUBFUN int XMLCALL xmlNanoFTPCloseConnection(void *ctx); XMLPUBFUN int XMLCALL xmlNanoFTPList (void *ctx, ftpListCallback callback, void *userData, const char *filename); XMLPUBFUN SOCKET XMLCALL xmlNanoFTPGetSocket (void *ctx, const char *filename); XMLPUBFUN int XMLCALL xmlNanoFTPGet (void *ctx, ftpDataCallback callback, void *userData, const char *filename); XMLPUBFUN int XMLCALL xmlNanoFTPRead (void *ctx, void *dest, int len); #ifdef __cplusplus } #endif #endif /* LIBXML_FTP_ENABLED */ #endif /* __NANO_FTP_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/pattern.h����������������������������������������������������������������������������0000644�����������������00000005032�14763166030�0011240 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: pattern expression handling * Description: allows to compile and test pattern expressions for nodes * either in a tree or based on a parser state. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_PATTERN_H__ #define __XML_PATTERN_H__ #include <libxml/xmlversion.h> #include <libxml/tree.h> #include <libxml/dict.h> #ifdef LIBXML_PATTERN_ENABLED #ifdef __cplusplus extern "C" { #endif /** * xmlPattern: * * A compiled (XPath based) pattern to select nodes */ typedef struct _xmlPattern xmlPattern; typedef xmlPattern *xmlPatternPtr; /** * xmlPatternFlags: * * This is the set of options affecting the behaviour of pattern * matching with this module * */ typedef enum { XML_PATTERN_DEFAULT = 0, /* simple pattern match */ XML_PATTERN_XPATH = 1<<0, /* standard XPath pattern */ XML_PATTERN_XSSEL = 1<<1, /* XPath subset for schema selector */ XML_PATTERN_XSFIELD = 1<<2 /* XPath subset for schema field */ } xmlPatternFlags; XMLPUBFUN void XMLCALL xmlFreePattern (xmlPatternPtr comp); XMLPUBFUN void XMLCALL xmlFreePatternList (xmlPatternPtr comp); XMLPUBFUN xmlPatternPtr XMLCALL xmlPatterncompile (const xmlChar *pattern, xmlDict *dict, int flags, const xmlChar **namespaces); XMLPUBFUN int XMLCALL xmlPatternMatch (xmlPatternPtr comp, xmlNodePtr node); /* streaming interfaces */ typedef struct _xmlStreamCtxt xmlStreamCtxt; typedef xmlStreamCtxt *xmlStreamCtxtPtr; XMLPUBFUN int XMLCALL xmlPatternStreamable (xmlPatternPtr comp); XMLPUBFUN int XMLCALL xmlPatternMaxDepth (xmlPatternPtr comp); XMLPUBFUN int XMLCALL xmlPatternMinDepth (xmlPatternPtr comp); XMLPUBFUN int XMLCALL xmlPatternFromRoot (xmlPatternPtr comp); XMLPUBFUN xmlStreamCtxtPtr XMLCALL xmlPatternGetStreamCtxt (xmlPatternPtr comp); XMLPUBFUN void XMLCALL xmlFreeStreamCtxt (xmlStreamCtxtPtr stream); XMLPUBFUN int XMLCALL xmlStreamPushNode (xmlStreamCtxtPtr stream, const xmlChar *name, const xmlChar *ns, int nodeType); XMLPUBFUN int XMLCALL xmlStreamPush (xmlStreamCtxtPtr stream, const xmlChar *name, const xmlChar *ns); XMLPUBFUN int XMLCALL xmlStreamPushAttr (xmlStreamCtxtPtr stream, const xmlChar *name, const xmlChar *ns); XMLPUBFUN int XMLCALL xmlStreamPop (xmlStreamCtxtPtr stream); XMLPUBFUN int XMLCALL xmlStreamWantsAnyNode (xmlStreamCtxtPtr stream); #ifdef __cplusplus } #endif #endif /* LIBXML_PATTERN_ENABLED */ #endif /* __XML_PATTERN_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/xmlautomata.h������������������������������������������������������������������������0000644�����������������00000007564�14763166030�0012133 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: API to build regexp automata * Description: the API to build regexp automata * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_AUTOMATA_H__ #define __XML_AUTOMATA_H__ #include <libxml/xmlversion.h> #include <libxml/tree.h> #ifdef LIBXML_REGEXP_ENABLED #ifdef LIBXML_AUTOMATA_ENABLED #include <libxml/xmlregexp.h> #ifdef __cplusplus extern "C" { #endif /** * xmlAutomataPtr: * * A libxml automata description, It can be compiled into a regexp */ typedef struct _xmlAutomata xmlAutomata; typedef xmlAutomata *xmlAutomataPtr; /** * xmlAutomataStatePtr: * * A state int the automata description, */ typedef struct _xmlAutomataState xmlAutomataState; typedef xmlAutomataState *xmlAutomataStatePtr; /* * Building API */ XMLPUBFUN xmlAutomataPtr XMLCALL xmlNewAutomata (void); XMLPUBFUN void XMLCALL xmlFreeAutomata (xmlAutomataPtr am); XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataGetInitState (xmlAutomataPtr am); XMLPUBFUN int XMLCALL xmlAutomataSetFinalState (xmlAutomataPtr am, xmlAutomataStatePtr state); XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewState (xmlAutomataPtr am); XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewTransition (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, const xmlChar *token, void *data); XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewTransition2 (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, const xmlChar *token, const xmlChar *token2, void *data); XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewNegTrans (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, const xmlChar *token, const xmlChar *token2, void *data); XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewCountTrans (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, const xmlChar *token, int min, int max, void *data); XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewCountTrans2 (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, const xmlChar *token, const xmlChar *token2, int min, int max, void *data); XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewOnceTrans (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, const xmlChar *token, int min, int max, void *data); XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewOnceTrans2 (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, const xmlChar *token, const xmlChar *token2, int min, int max, void *data); XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewAllTrans (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, int lax); XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewEpsilon (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to); XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewCountedTrans (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, int counter); XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewCounterTrans (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, int counter); XMLPUBFUN int XMLCALL xmlAutomataNewCounter (xmlAutomataPtr am, int min, int max); XMLPUBFUN xmlRegexpPtr XMLCALL xmlAutomataCompile (xmlAutomataPtr am); XMLPUBFUN int XMLCALL xmlAutomataIsDeterminist (xmlAutomataPtr am); #ifdef __cplusplus } #endif #endif /* LIBXML_AUTOMATA_ENABLED */ #endif /* LIBXML_REGEXP_ENABLED */ #endif /* __XML_AUTOMATA_H__ */ ��������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/globals.h����������������������������������������������������������������������������0000644�����������������00000034473�14763166030�0011221 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: interface for all global variables of the library * Description: all the global variables and thread handling for * those variables is handled by this module. * * The bottom of this file is automatically generated by build_glob.py * based on the description file global.data * * Copy: See Copyright for the status of this software. * * Author: Gary Pennington <Gary.Pennington@uk.sun.com>, Daniel Veillard */ #ifndef __XML_GLOBALS_H #define __XML_GLOBALS_H #include <libxml/xmlversion.h> #include <libxml/parser.h> #include <libxml/xmlerror.h> #include <libxml/SAX.h> #include <libxml/SAX2.h> #include <libxml/xmlmemory.h> #ifdef __cplusplus extern "C" { #endif XMLPUBFUN void XMLCALL xmlInitGlobals(void); XMLPUBFUN void XMLCALL xmlCleanupGlobals(void); /** * xmlParserInputBufferCreateFilenameFunc: * @URI: the URI to read from * @enc: the requested source encoding * * Signature for the function doing the lookup for a suitable input method * corresponding to an URI. * * Returns the new xmlParserInputBufferPtr in case of success or NULL if no * method was found. */ typedef xmlParserInputBufferPtr (*xmlParserInputBufferCreateFilenameFunc) (const char *URI, xmlCharEncoding enc); /** * xmlOutputBufferCreateFilenameFunc: * @URI: the URI to write to * @enc: the requested target encoding * * Signature for the function doing the lookup for a suitable output method * corresponding to an URI. * * Returns the new xmlOutputBufferPtr in case of success or NULL if no * method was found. */ typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI, xmlCharEncodingHandlerPtr encoder, int compression); XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func); XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func); /* * Externally global symbols which need to be protected for backwards * compatibility support. */ #undef docbDefaultSAXHandler #undef htmlDefaultSAXHandler #undef oldXMLWDcompatibility #undef xmlBufferAllocScheme #undef xmlDefaultBufferSize #undef xmlDefaultSAXHandler #undef xmlDefaultSAXLocator #undef xmlDoValidityCheckingDefaultValue #undef xmlFree #undef xmlGenericError #undef xmlStructuredError #undef xmlGenericErrorContext #undef xmlStructuredErrorContext #undef xmlGetWarningsDefaultValue #undef xmlIndentTreeOutput #undef xmlTreeIndentString #undef xmlKeepBlanksDefaultValue #undef xmlLineNumbersDefaultValue #undef xmlLoadExtDtdDefaultValue #undef xmlMalloc #undef xmlMallocAtomic #undef xmlMemStrdup #undef xmlParserDebugEntities #undef xmlParserVersion #undef xmlPedanticParserDefaultValue #undef xmlRealloc #undef xmlSaveNoEmptyTags #undef xmlSubstituteEntitiesDefaultValue #undef xmlRegisterNodeDefaultValue #undef xmlDeregisterNodeDefaultValue #undef xmlLastError #undef xmlParserInputBufferCreateFilenameValue #undef xmlOutputBufferCreateFilenameValue /** * xmlRegisterNodeFunc: * @node: the current node * * Signature for the registration callback of a created node */ typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node); /** * xmlDeregisterNodeFunc: * @node: the current node * * Signature for the deregistration callback of a discarded node */ typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node); typedef struct _xmlGlobalState xmlGlobalState; typedef xmlGlobalState *xmlGlobalStatePtr; struct _xmlGlobalState { const char *xmlParserVersion; xmlSAXLocator xmlDefaultSAXLocator; xmlSAXHandlerV1 xmlDefaultSAXHandler; xmlSAXHandlerV1 docbDefaultSAXHandler; xmlSAXHandlerV1 htmlDefaultSAXHandler; xmlFreeFunc xmlFree; xmlMallocFunc xmlMalloc; xmlStrdupFunc xmlMemStrdup; xmlReallocFunc xmlRealloc; xmlGenericErrorFunc xmlGenericError; xmlStructuredErrorFunc xmlStructuredError; void *xmlGenericErrorContext; int oldXMLWDcompatibility; xmlBufferAllocationScheme xmlBufferAllocScheme; int xmlDefaultBufferSize; int xmlSubstituteEntitiesDefaultValue; int xmlDoValidityCheckingDefaultValue; int xmlGetWarningsDefaultValue; int xmlKeepBlanksDefaultValue; int xmlLineNumbersDefaultValue; int xmlLoadExtDtdDefaultValue; int xmlParserDebugEntities; int xmlPedanticParserDefaultValue; int xmlSaveNoEmptyTags; int xmlIndentTreeOutput; const char *xmlTreeIndentString; xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; xmlMallocFunc xmlMallocAtomic; xmlError xmlLastError; xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue; xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue; void *xmlStructuredErrorContext; }; #ifdef __cplusplus } #endif #include <libxml/threads.h> #ifdef __cplusplus extern "C" { #endif XMLPUBFUN void XMLCALL xmlInitializeGlobalState(xmlGlobalStatePtr gs); XMLPUBFUN void XMLCALL xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler); XMLPUBFUN void XMLCALL xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler); XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlRegisterNodeDefault(xmlRegisterNodeFunc func); XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func); XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func); XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func); XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func); XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func); /** DOC_DISABLE */ /* * In general the memory allocation entry points are not kept * thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED * - xmlMalloc * - xmlMallocAtomic * - xmlRealloc * - xmlMemStrdup * - xmlFree */ #ifdef LIBXML_THREAD_ALLOC_ENABLED #ifdef LIBXML_THREAD_ENABLED XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMalloc(void); #define xmlMalloc \ (*(__xmlMalloc())) #else XMLPUBVAR xmlMallocFunc xmlMalloc; #endif #ifdef LIBXML_THREAD_ENABLED XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMallocAtomic(void); #define xmlMallocAtomic \ (*(__xmlMallocAtomic())) #else XMLPUBVAR xmlMallocFunc xmlMallocAtomic; #endif #ifdef LIBXML_THREAD_ENABLED XMLPUBFUN xmlReallocFunc * XMLCALL __xmlRealloc(void); #define xmlRealloc \ (*(__xmlRealloc())) #else XMLPUBVAR xmlReallocFunc xmlRealloc; #endif #ifdef LIBXML_THREAD_ENABLED XMLPUBFUN xmlFreeFunc * XMLCALL __xmlFree(void); #define xmlFree \ (*(__xmlFree())) #else XMLPUBVAR xmlFreeFunc xmlFree; #endif #ifdef LIBXML_THREAD_ENABLED XMLPUBFUN xmlStrdupFunc * XMLCALL __xmlMemStrdup(void); #define xmlMemStrdup \ (*(__xmlMemStrdup())) #else XMLPUBVAR xmlStrdupFunc xmlMemStrdup; #endif #else /* !LIBXML_THREAD_ALLOC_ENABLED */ XMLPUBVAR xmlMallocFunc xmlMalloc; XMLPUBVAR xmlMallocFunc xmlMallocAtomic; XMLPUBVAR xmlReallocFunc xmlRealloc; XMLPUBVAR xmlFreeFunc xmlFree; XMLPUBVAR xmlStrdupFunc xmlMemStrdup; #endif /* LIBXML_THREAD_ALLOC_ENABLED */ #ifdef LIBXML_DOCB_ENABLED XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __docbDefaultSAXHandler(void); #ifdef LIBXML_THREAD_ENABLED #define docbDefaultSAXHandler \ (*(__docbDefaultSAXHandler())) #else XMLPUBVAR xmlSAXHandlerV1 docbDefaultSAXHandler; #endif #endif #ifdef LIBXML_HTML_ENABLED XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __htmlDefaultSAXHandler(void); #ifdef LIBXML_THREAD_ENABLED #define htmlDefaultSAXHandler \ (*(__htmlDefaultSAXHandler())) #else XMLPUBVAR xmlSAXHandlerV1 htmlDefaultSAXHandler; #endif #endif XMLPUBFUN xmlError * XMLCALL __xmlLastError(void); #ifdef LIBXML_THREAD_ENABLED #define xmlLastError \ (*(__xmlLastError())) #else XMLPUBVAR xmlError xmlLastError; #endif /* * Everything starting from the line below is * Automatically generated by build_glob.py. * Do not modify the previous line. */ XMLPUBFUN int * XMLCALL __oldXMLWDcompatibility(void); #ifdef LIBXML_THREAD_ENABLED #define oldXMLWDcompatibility \ (*(__oldXMLWDcompatibility())) #else XMLPUBVAR int oldXMLWDcompatibility; #endif XMLPUBFUN xmlBufferAllocationScheme * XMLCALL __xmlBufferAllocScheme(void); #ifdef LIBXML_THREAD_ENABLED #define xmlBufferAllocScheme \ (*(__xmlBufferAllocScheme())) #else XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme; #endif XMLPUBFUN xmlBufferAllocationScheme XMLCALL xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v); XMLPUBFUN int * XMLCALL __xmlDefaultBufferSize(void); #ifdef LIBXML_THREAD_ENABLED #define xmlDefaultBufferSize \ (*(__xmlDefaultBufferSize())) #else XMLPUBVAR int xmlDefaultBufferSize; #endif XMLPUBFUN int XMLCALL xmlThrDefDefaultBufferSize(int v); XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __xmlDefaultSAXHandler(void); #ifdef LIBXML_THREAD_ENABLED #define xmlDefaultSAXHandler \ (*(__xmlDefaultSAXHandler())) #else XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler; #endif XMLPUBFUN xmlSAXLocator * XMLCALL __xmlDefaultSAXLocator(void); #ifdef LIBXML_THREAD_ENABLED #define xmlDefaultSAXLocator \ (*(__xmlDefaultSAXLocator())) #else XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator; #endif XMLPUBFUN int * XMLCALL __xmlDoValidityCheckingDefaultValue(void); #ifdef LIBXML_THREAD_ENABLED #define xmlDoValidityCheckingDefaultValue \ (*(__xmlDoValidityCheckingDefaultValue())) #else XMLPUBVAR int xmlDoValidityCheckingDefaultValue; #endif XMLPUBFUN int XMLCALL xmlThrDefDoValidityCheckingDefaultValue(int v); XMLPUBFUN xmlGenericErrorFunc * XMLCALL __xmlGenericError(void); #ifdef LIBXML_THREAD_ENABLED #define xmlGenericError \ (*(__xmlGenericError())) #else XMLPUBVAR xmlGenericErrorFunc xmlGenericError; #endif XMLPUBFUN xmlStructuredErrorFunc * XMLCALL __xmlStructuredError(void); #ifdef LIBXML_THREAD_ENABLED #define xmlStructuredError \ (*(__xmlStructuredError())) #else XMLPUBVAR xmlStructuredErrorFunc xmlStructuredError; #endif XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void); #ifdef LIBXML_THREAD_ENABLED #define xmlGenericErrorContext \ (*(__xmlGenericErrorContext())) #else XMLPUBVAR void * xmlGenericErrorContext; #endif XMLPUBFUN void * * XMLCALL __xmlStructuredErrorContext(void); #ifdef LIBXML_THREAD_ENABLED #define xmlStructuredErrorContext \ (*(__xmlStructuredErrorContext())) #else XMLPUBVAR void * xmlStructuredErrorContext; #endif XMLPUBFUN int * XMLCALL __xmlGetWarningsDefaultValue(void); #ifdef LIBXML_THREAD_ENABLED #define xmlGetWarningsDefaultValue \ (*(__xmlGetWarningsDefaultValue())) #else XMLPUBVAR int xmlGetWarningsDefaultValue; #endif XMLPUBFUN int XMLCALL xmlThrDefGetWarningsDefaultValue(int v); XMLPUBFUN int * XMLCALL __xmlIndentTreeOutput(void); #ifdef LIBXML_THREAD_ENABLED #define xmlIndentTreeOutput \ (*(__xmlIndentTreeOutput())) #else XMLPUBVAR int xmlIndentTreeOutput; #endif XMLPUBFUN int XMLCALL xmlThrDefIndentTreeOutput(int v); XMLPUBFUN const char * * XMLCALL __xmlTreeIndentString(void); #ifdef LIBXML_THREAD_ENABLED #define xmlTreeIndentString \ (*(__xmlTreeIndentString())) #else XMLPUBVAR const char * xmlTreeIndentString; #endif XMLPUBFUN const char * XMLCALL xmlThrDefTreeIndentString(const char * v); XMLPUBFUN int * XMLCALL __xmlKeepBlanksDefaultValue(void); #ifdef LIBXML_THREAD_ENABLED #define xmlKeepBlanksDefaultValue \ (*(__xmlKeepBlanksDefaultValue())) #else XMLPUBVAR int xmlKeepBlanksDefaultValue; #endif XMLPUBFUN int XMLCALL xmlThrDefKeepBlanksDefaultValue(int v); XMLPUBFUN int * XMLCALL __xmlLineNumbersDefaultValue(void); #ifdef LIBXML_THREAD_ENABLED #define xmlLineNumbersDefaultValue \ (*(__xmlLineNumbersDefaultValue())) #else XMLPUBVAR int xmlLineNumbersDefaultValue; #endif XMLPUBFUN int XMLCALL xmlThrDefLineNumbersDefaultValue(int v); XMLPUBFUN int * XMLCALL __xmlLoadExtDtdDefaultValue(void); #ifdef LIBXML_THREAD_ENABLED #define xmlLoadExtDtdDefaultValue \ (*(__xmlLoadExtDtdDefaultValue())) #else XMLPUBVAR int xmlLoadExtDtdDefaultValue; #endif XMLPUBFUN int XMLCALL xmlThrDefLoadExtDtdDefaultValue(int v); XMLPUBFUN int * XMLCALL __xmlParserDebugEntities(void); #ifdef LIBXML_THREAD_ENABLED #define xmlParserDebugEntities \ (*(__xmlParserDebugEntities())) #else XMLPUBVAR int xmlParserDebugEntities; #endif XMLPUBFUN int XMLCALL xmlThrDefParserDebugEntities(int v); XMLPUBFUN const char * * XMLCALL __xmlParserVersion(void); #ifdef LIBXML_THREAD_ENABLED #define xmlParserVersion \ (*(__xmlParserVersion())) #else XMLPUBVAR const char * xmlParserVersion; #endif XMLPUBFUN int * XMLCALL __xmlPedanticParserDefaultValue(void); #ifdef LIBXML_THREAD_ENABLED #define xmlPedanticParserDefaultValue \ (*(__xmlPedanticParserDefaultValue())) #else XMLPUBVAR int xmlPedanticParserDefaultValue; #endif XMLPUBFUN int XMLCALL xmlThrDefPedanticParserDefaultValue(int v); XMLPUBFUN int * XMLCALL __xmlSaveNoEmptyTags(void); #ifdef LIBXML_THREAD_ENABLED #define xmlSaveNoEmptyTags \ (*(__xmlSaveNoEmptyTags())) #else XMLPUBVAR int xmlSaveNoEmptyTags; #endif XMLPUBFUN int XMLCALL xmlThrDefSaveNoEmptyTags(int v); XMLPUBFUN int * XMLCALL __xmlSubstituteEntitiesDefaultValue(void); #ifdef LIBXML_THREAD_ENABLED #define xmlSubstituteEntitiesDefaultValue \ (*(__xmlSubstituteEntitiesDefaultValue())) #else XMLPUBVAR int xmlSubstituteEntitiesDefaultValue; #endif XMLPUBFUN int XMLCALL xmlThrDefSubstituteEntitiesDefaultValue(int v); XMLPUBFUN xmlRegisterNodeFunc * XMLCALL __xmlRegisterNodeDefaultValue(void); #ifdef LIBXML_THREAD_ENABLED #define xmlRegisterNodeDefaultValue \ (*(__xmlRegisterNodeDefaultValue())) #else XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; #endif XMLPUBFUN xmlDeregisterNodeFunc * XMLCALL __xmlDeregisterNodeDefaultValue(void); #ifdef LIBXML_THREAD_ENABLED #define xmlDeregisterNodeDefaultValue \ (*(__xmlDeregisterNodeDefaultValue())) #else XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; #endif XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * XMLCALL __xmlParserInputBufferCreateFilenameValue(void); #ifdef LIBXML_THREAD_ENABLED #define xmlParserInputBufferCreateFilenameValue \ (*(__xmlParserInputBufferCreateFilenameValue())) #else XMLPUBVAR xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue; #endif XMLPUBFUN xmlOutputBufferCreateFilenameFunc * XMLCALL __xmlOutputBufferCreateFilenameValue(void); #ifdef LIBXML_THREAD_ENABLED #define xmlOutputBufferCreateFilenameValue \ (*(__xmlOutputBufferCreateFilenameValue())) #else XMLPUBVAR xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue; #endif #ifdef __cplusplus } #endif #endif /* __XML_GLOBALS_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/uri.h��������������������������������������������������������������������������������0000644�����������������00000005150�14763166030�0010363 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * Summary: library of generic URI related routines * Description: library of generic URI related routines * Implements RFC 2396 * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_URI_H__ #define __XML_URI_H__ #include <libxml/xmlversion.h> #include <libxml/tree.h> #ifdef __cplusplus extern "C" { #endif /** * xmlURI: * * A parsed URI reference. This is a struct containing the various fields * as described in RFC 2396 but separated for further processing. * * Note: query is a deprecated field which is incorrectly unescaped. * query_raw takes precedence over query if the former is set. * See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00127 */ typedef struct _xmlURI xmlURI; typedef xmlURI *xmlURIPtr; struct _xmlURI { char *scheme; /* the URI scheme */ char *opaque; /* opaque part */ char *authority; /* the authority part */ char *server; /* the server part */ char *user; /* the user part */ int port; /* the port number */ char *path; /* the path string */ char *query; /* the query string (deprecated - use with caution) */ char *fragment; /* the fragment identifier */ int cleanup; /* parsing potentially unclean URI */ char *query_raw; /* the query string (as it appears in the URI) */ }; /* * This function is in tree.h: * xmlChar * xmlNodeGetBase (xmlDocPtr doc, * xmlNodePtr cur); */ XMLPUBFUN xmlURIPtr XMLCALL xmlCreateURI (void); XMLPUBFUN xmlChar * XMLCALL xmlBuildURI (const xmlChar *URI, const xmlChar *base); XMLPUBFUN xmlChar * XMLCALL xmlBuildRelativeURI (const xmlChar *URI, const xmlChar *base); XMLPUBFUN xmlURIPtr XMLCALL xmlParseURI (const char *str); XMLPUBFUN xmlURIPtr XMLCALL xmlParseURIRaw (const char *str, int raw); XMLPUBFUN int XMLCALL xmlParseURIReference (xmlURIPtr uri, const char *str); XMLPUBFUN xmlChar * XMLCALL xmlSaveUri (xmlURIPtr uri); XMLPUBFUN void XMLCALL xmlPrintURI (FILE *stream, xmlURIPtr uri); XMLPUBFUN xmlChar * XMLCALL xmlURIEscapeStr (const xmlChar *str, const xmlChar *list); XMLPUBFUN char * XMLCALL xmlURIUnescapeString (const char *str, int len, char *target); XMLPUBFUN int XMLCALL xmlNormalizeURIPath (char *path); XMLPUBFUN xmlChar * XMLCALL xmlURIEscape (const xmlChar *str); XMLPUBFUN void XMLCALL xmlFreeURI (xmlURIPtr uri); XMLPUBFUN xmlChar* XMLCALL xmlCanonicPath (const xmlChar *path); XMLPUBFUN xmlChar* XMLCALL xmlPathToURI (const xmlChar *path); #ifdef __cplusplus } #endif #endif /* __XML_URI_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/schemasInternals.h�������������������������������������������������������������������0000644�����������������00000062645�14763166030�0013103 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: internal interfaces for XML Schemas * Description: internal interfaces for the XML Schemas handling * and schema validity checking * The Schemas development is a Work In Progress. * Some of those interfaces are not garanteed to be API or ABI stable ! * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_SCHEMA_INTERNALS_H__ #define __XML_SCHEMA_INTERNALS_H__ #include <libxml/xmlversion.h> #ifdef LIBXML_SCHEMAS_ENABLED #include <libxml/xmlregexp.h> #include <libxml/hash.h> #include <libxml/dict.h> #ifdef __cplusplus extern "C" { #endif typedef enum { XML_SCHEMAS_UNKNOWN = 0, XML_SCHEMAS_STRING, XML_SCHEMAS_NORMSTRING, XML_SCHEMAS_DECIMAL, XML_SCHEMAS_TIME, XML_SCHEMAS_GDAY, XML_SCHEMAS_GMONTH, XML_SCHEMAS_GMONTHDAY, XML_SCHEMAS_GYEAR, XML_SCHEMAS_GYEARMONTH, XML_SCHEMAS_DATE, XML_SCHEMAS_DATETIME, XML_SCHEMAS_DURATION, XML_SCHEMAS_FLOAT, XML_SCHEMAS_DOUBLE, XML_SCHEMAS_BOOLEAN, XML_SCHEMAS_TOKEN, XML_SCHEMAS_LANGUAGE, XML_SCHEMAS_NMTOKEN, XML_SCHEMAS_NMTOKENS, XML_SCHEMAS_NAME, XML_SCHEMAS_QNAME, XML_SCHEMAS_NCNAME, XML_SCHEMAS_ID, XML_SCHEMAS_IDREF, XML_SCHEMAS_IDREFS, XML_SCHEMAS_ENTITY, XML_SCHEMAS_ENTITIES, XML_SCHEMAS_NOTATION, XML_SCHEMAS_ANYURI, XML_SCHEMAS_INTEGER, XML_SCHEMAS_NPINTEGER, XML_SCHEMAS_NINTEGER, XML_SCHEMAS_NNINTEGER, XML_SCHEMAS_PINTEGER, XML_SCHEMAS_INT, XML_SCHEMAS_UINT, XML_SCHEMAS_LONG, XML_SCHEMAS_ULONG, XML_SCHEMAS_SHORT, XML_SCHEMAS_USHORT, XML_SCHEMAS_BYTE, XML_SCHEMAS_UBYTE, XML_SCHEMAS_HEXBINARY, XML_SCHEMAS_BASE64BINARY, XML_SCHEMAS_ANYTYPE, XML_SCHEMAS_ANYSIMPLETYPE } xmlSchemaValType; /* * XML Schemas defines multiple type of types. */ typedef enum { XML_SCHEMA_TYPE_BASIC = 1, /* A built-in datatype */ XML_SCHEMA_TYPE_ANY, XML_SCHEMA_TYPE_FACET, XML_SCHEMA_TYPE_SIMPLE, XML_SCHEMA_TYPE_COMPLEX, XML_SCHEMA_TYPE_SEQUENCE = 6, XML_SCHEMA_TYPE_CHOICE, XML_SCHEMA_TYPE_ALL, XML_SCHEMA_TYPE_SIMPLE_CONTENT, XML_SCHEMA_TYPE_COMPLEX_CONTENT, XML_SCHEMA_TYPE_UR, XML_SCHEMA_TYPE_RESTRICTION, XML_SCHEMA_TYPE_EXTENSION, XML_SCHEMA_TYPE_ELEMENT, XML_SCHEMA_TYPE_ATTRIBUTE, XML_SCHEMA_TYPE_ATTRIBUTEGROUP, XML_SCHEMA_TYPE_GROUP, XML_SCHEMA_TYPE_NOTATION, XML_SCHEMA_TYPE_LIST, XML_SCHEMA_TYPE_UNION, XML_SCHEMA_TYPE_ANY_ATTRIBUTE, XML_SCHEMA_TYPE_IDC_UNIQUE, XML_SCHEMA_TYPE_IDC_KEY, XML_SCHEMA_TYPE_IDC_KEYREF, XML_SCHEMA_TYPE_PARTICLE = 25, XML_SCHEMA_TYPE_ATTRIBUTE_USE, XML_SCHEMA_FACET_MININCLUSIVE = 1000, XML_SCHEMA_FACET_MINEXCLUSIVE, XML_SCHEMA_FACET_MAXINCLUSIVE, XML_SCHEMA_FACET_MAXEXCLUSIVE, XML_SCHEMA_FACET_TOTALDIGITS, XML_SCHEMA_FACET_FRACTIONDIGITS, XML_SCHEMA_FACET_PATTERN, XML_SCHEMA_FACET_ENUMERATION, XML_SCHEMA_FACET_WHITESPACE, XML_SCHEMA_FACET_LENGTH, XML_SCHEMA_FACET_MAXLENGTH, XML_SCHEMA_FACET_MINLENGTH, XML_SCHEMA_EXTRA_QNAMEREF = 2000, XML_SCHEMA_EXTRA_ATTR_USE_PROHIB } xmlSchemaTypeType; typedef enum { XML_SCHEMA_CONTENT_UNKNOWN = 0, XML_SCHEMA_CONTENT_EMPTY = 1, XML_SCHEMA_CONTENT_ELEMENTS, XML_SCHEMA_CONTENT_MIXED, XML_SCHEMA_CONTENT_SIMPLE, XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, /* Obsolete */ XML_SCHEMA_CONTENT_BASIC, XML_SCHEMA_CONTENT_ANY } xmlSchemaContentType; typedef struct _xmlSchemaVal xmlSchemaVal; typedef xmlSchemaVal *xmlSchemaValPtr; typedef struct _xmlSchemaType xmlSchemaType; typedef xmlSchemaType *xmlSchemaTypePtr; typedef struct _xmlSchemaFacet xmlSchemaFacet; typedef xmlSchemaFacet *xmlSchemaFacetPtr; /** * Annotation */ typedef struct _xmlSchemaAnnot xmlSchemaAnnot; typedef xmlSchemaAnnot *xmlSchemaAnnotPtr; struct _xmlSchemaAnnot { struct _xmlSchemaAnnot *next; xmlNodePtr content; /* the annotation */ }; /** * XML_SCHEMAS_ANYATTR_SKIP: * * Skip unknown attribute from validation * Obsolete, not used anymore. */ #define XML_SCHEMAS_ANYATTR_SKIP 1 /** * XML_SCHEMAS_ANYATTR_LAX: * * Ignore validation non definition on attributes * Obsolete, not used anymore. */ #define XML_SCHEMAS_ANYATTR_LAX 2 /** * XML_SCHEMAS_ANYATTR_STRICT: * * Apply strict validation rules on attributes * Obsolete, not used anymore. */ #define XML_SCHEMAS_ANYATTR_STRICT 3 /** * XML_SCHEMAS_ANY_SKIP: * * Skip unknown attribute from validation */ #define XML_SCHEMAS_ANY_SKIP 1 /** * XML_SCHEMAS_ANY_LAX: * * Used by wildcards. * Validate if type found, don't worry if not found */ #define XML_SCHEMAS_ANY_LAX 2 /** * XML_SCHEMAS_ANY_STRICT: * * Used by wildcards. * Apply strict validation rules */ #define XML_SCHEMAS_ANY_STRICT 3 /** * XML_SCHEMAS_ATTR_USE_PROHIBITED: * * Used by wildcards. * The attribute is prohibited. */ #define XML_SCHEMAS_ATTR_USE_PROHIBITED 0 /** * XML_SCHEMAS_ATTR_USE_REQUIRED: * * The attribute is required. */ #define XML_SCHEMAS_ATTR_USE_REQUIRED 1 /** * XML_SCHEMAS_ATTR_USE_OPTIONAL: * * The attribute is optional. */ #define XML_SCHEMAS_ATTR_USE_OPTIONAL 2 /** * XML_SCHEMAS_ATTR_GLOBAL: * * allow elements in no namespace */ #define XML_SCHEMAS_ATTR_GLOBAL 1 << 0 /** * XML_SCHEMAS_ATTR_NSDEFAULT: * * allow elements in no namespace */ #define XML_SCHEMAS_ATTR_NSDEFAULT 1 << 7 /** * XML_SCHEMAS_ATTR_INTERNAL_RESOLVED: * * this is set when the "type" and "ref" references * have been resolved. */ #define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED 1 << 8 /** * XML_SCHEMAS_ATTR_FIXED: * * the attribute has a fixed value */ #define XML_SCHEMAS_ATTR_FIXED 1 << 9 /** * xmlSchemaAttribute: * An attribute definition. */ typedef struct _xmlSchemaAttribute xmlSchemaAttribute; typedef xmlSchemaAttribute *xmlSchemaAttributePtr; struct _xmlSchemaAttribute { xmlSchemaTypeType type; struct _xmlSchemaAttribute *next; /* the next attribute (not used?) */ const xmlChar *name; /* the name of the declaration */ const xmlChar *id; /* Deprecated; not used */ const xmlChar *ref; /* Deprecated; not used */ const xmlChar *refNs; /* Deprecated; not used */ const xmlChar *typeName; /* the local name of the type definition */ const xmlChar *typeNs; /* the ns URI of the type definition */ xmlSchemaAnnotPtr annot; xmlSchemaTypePtr base; /* Deprecated; not used */ int occurs; /* Deprecated; not used */ const xmlChar *defValue; /* The initial value of the value constraint */ xmlSchemaTypePtr subtypes; /* the type definition */ xmlNodePtr node; const xmlChar *targetNamespace; int flags; const xmlChar *refPrefix; /* Deprecated; not used */ xmlSchemaValPtr defVal; /* The compiled value constraint */ xmlSchemaAttributePtr refDecl; /* Deprecated; not used */ }; /** * xmlSchemaAttributeLink: * Used to build a list of attribute uses on complexType definitions. * WARNING: Deprecated; not used. */ typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink; typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr; struct _xmlSchemaAttributeLink { struct _xmlSchemaAttributeLink *next;/* the next attribute link ... */ struct _xmlSchemaAttribute *attr;/* the linked attribute */ }; /** * XML_SCHEMAS_WILDCARD_COMPLETE: * * If the wildcard is complete. */ #define XML_SCHEMAS_WILDCARD_COMPLETE 1 << 0 /** * xmlSchemaCharValueLink: * Used to build a list of namespaces on wildcards. */ typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs; typedef xmlSchemaWildcardNs *xmlSchemaWildcardNsPtr; struct _xmlSchemaWildcardNs { struct _xmlSchemaWildcardNs *next;/* the next constraint link ... */ const xmlChar *value;/* the value */ }; /** * xmlSchemaWildcard. * A wildcard. */ typedef struct _xmlSchemaWildcard xmlSchemaWildcard; typedef xmlSchemaWildcard *xmlSchemaWildcardPtr; struct _xmlSchemaWildcard { xmlSchemaTypeType type; /* The kind of type */ const xmlChar *id; /* Deprecated; not used */ xmlSchemaAnnotPtr annot; xmlNodePtr node; int minOccurs; /* Deprecated; not used */ int maxOccurs; /* Deprecated; not used */ int processContents; int any; /* Indicates if the ns constraint is of ##any */ xmlSchemaWildcardNsPtr nsSet; /* The list of allowed namespaces */ xmlSchemaWildcardNsPtr negNsSet; /* The negated namespace */ int flags; }; /** * XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED: * * The attribute wildcard has been already builded. */ #define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0 /** * XML_SCHEMAS_ATTRGROUP_GLOBAL: * * The attribute wildcard has been already builded. */ #define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1 /** * XML_SCHEMAS_ATTRGROUP_MARKED: * * Marks the attr group as marked; used for circular checks. */ #define XML_SCHEMAS_ATTRGROUP_MARKED 1 << 2 /** * XML_SCHEMAS_ATTRGROUP_REDEFINED: * * The attr group was redefined. */ #define XML_SCHEMAS_ATTRGROUP_REDEFINED 1 << 3 /** * XML_SCHEMAS_ATTRGROUP_HAS_REFS: * * Whether this attr. group contains attr. group references. */ #define XML_SCHEMAS_ATTRGROUP_HAS_REFS 1 << 4 /** * An attribute group definition. * * xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures * must be kept similar */ typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup; typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr; struct _xmlSchemaAttributeGroup { xmlSchemaTypeType type; /* The kind of type */ struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */ const xmlChar *name; const xmlChar *id; const xmlChar *ref; /* Deprecated; not used */ const xmlChar *refNs; /* Deprecated; not used */ xmlSchemaAnnotPtr annot; xmlSchemaAttributePtr attributes; /* Deprecated; not used */ xmlNodePtr node; int flags; xmlSchemaWildcardPtr attributeWildcard; const xmlChar *refPrefix; /* Deprecated; not used */ xmlSchemaAttributeGroupPtr refItem; /* Deprecated; not used */ const xmlChar *targetNamespace; void *attrUses; }; /** * xmlSchemaTypeLink: * Used to build a list of types (e.g. member types of * simpleType with variety "union"). */ typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink; typedef xmlSchemaTypeLink *xmlSchemaTypeLinkPtr; struct _xmlSchemaTypeLink { struct _xmlSchemaTypeLink *next;/* the next type link ... */ xmlSchemaTypePtr type;/* the linked type */ }; /** * xmlSchemaFacetLink: * Used to build a list of facets. */ typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink; typedef xmlSchemaFacetLink *xmlSchemaFacetLinkPtr; struct _xmlSchemaFacetLink { struct _xmlSchemaFacetLink *next;/* the next facet link ... */ xmlSchemaFacetPtr facet;/* the linked facet */ }; /** * XML_SCHEMAS_TYPE_MIXED: * * the element content type is mixed */ #define XML_SCHEMAS_TYPE_MIXED 1 << 0 /** * XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION: * * the simple or complex type has a derivation method of "extension". */ #define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION 1 << 1 /** * XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION: * * the simple or complex type has a derivation method of "restriction". */ #define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION 1 << 2 /** * XML_SCHEMAS_TYPE_GLOBAL: * * the type is global */ #define XML_SCHEMAS_TYPE_GLOBAL 1 << 3 /** * XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD: * * the complexType owns an attribute wildcard, i.e. * it can be freed by the complexType */ #define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD 1 << 4 /* Obsolete. */ /** * XML_SCHEMAS_TYPE_VARIETY_ABSENT: * * the simpleType has a variety of "absent". * TODO: Actually not necessary :-/, since if * none of the variety flags occur then it's * automatically absent. */ #define XML_SCHEMAS_TYPE_VARIETY_ABSENT 1 << 5 /** * XML_SCHEMAS_TYPE_VARIETY_LIST: * * the simpleType has a variety of "list". */ #define XML_SCHEMAS_TYPE_VARIETY_LIST 1 << 6 /** * XML_SCHEMAS_TYPE_VARIETY_UNION: * * the simpleType has a variety of "union". */ #define XML_SCHEMAS_TYPE_VARIETY_UNION 1 << 7 /** * XML_SCHEMAS_TYPE_VARIETY_ATOMIC: * * the simpleType has a variety of "union". */ #define XML_SCHEMAS_TYPE_VARIETY_ATOMIC 1 << 8 /** * XML_SCHEMAS_TYPE_FINAL_EXTENSION: * * the complexType has a final of "extension". */ #define XML_SCHEMAS_TYPE_FINAL_EXTENSION 1 << 9 /** * XML_SCHEMAS_TYPE_FINAL_RESTRICTION: * * the simpleType/complexType has a final of "restriction". */ #define XML_SCHEMAS_TYPE_FINAL_RESTRICTION 1 << 10 /** * XML_SCHEMAS_TYPE_FINAL_LIST: * * the simpleType has a final of "list". */ #define XML_SCHEMAS_TYPE_FINAL_LIST 1 << 11 /** * XML_SCHEMAS_TYPE_FINAL_UNION: * * the simpleType has a final of "union". */ #define XML_SCHEMAS_TYPE_FINAL_UNION 1 << 12 /** * XML_SCHEMAS_TYPE_FINAL_DEFAULT: * * the simpleType has a final of "default". */ #define XML_SCHEMAS_TYPE_FINAL_DEFAULT 1 << 13 /** * XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE: * * Marks the item as a builtin primitive. */ #define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE 1 << 14 /** * XML_SCHEMAS_TYPE_MARKED: * * Marks the item as marked; used for circular checks. */ #define XML_SCHEMAS_TYPE_MARKED 1 << 16 /** * XML_SCHEMAS_TYPE_BLOCK_DEFAULT: * * the complexType did not specify 'block' so use the default of the * <schema> item. */ #define XML_SCHEMAS_TYPE_BLOCK_DEFAULT 1 << 17 /** * XML_SCHEMAS_TYPE_BLOCK_EXTENSION: * * the complexType has a 'block' of "extension". */ #define XML_SCHEMAS_TYPE_BLOCK_EXTENSION 1 << 18 /** * XML_SCHEMAS_TYPE_BLOCK_RESTRICTION: * * the complexType has a 'block' of "restriction". */ #define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION 1 << 19 /** * XML_SCHEMAS_TYPE_ABSTRACT: * * the simple/complexType is abstract. */ #define XML_SCHEMAS_TYPE_ABSTRACT 1 << 20 /** * XML_SCHEMAS_TYPE_FACETSNEEDVALUE: * * indicates if the facets need a computed value */ #define XML_SCHEMAS_TYPE_FACETSNEEDVALUE 1 << 21 /** * XML_SCHEMAS_TYPE_INTERNAL_RESOLVED: * * indicates that the type was typefixed */ #define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED 1 << 22 /** * XML_SCHEMAS_TYPE_INTERNAL_INVALID: * * indicates that the type is invalid */ #define XML_SCHEMAS_TYPE_INTERNAL_INVALID 1 << 23 /** * XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE: * * a whitespace-facet value of "preserve" */ #define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE 1 << 24 /** * XML_SCHEMAS_TYPE_WHITESPACE_REPLACE: * * a whitespace-facet value of "replace" */ #define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE 1 << 25 /** * XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE: * * a whitespace-facet value of "collapse" */ #define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE 1 << 26 /** * XML_SCHEMAS_TYPE_HAS_FACETS: * * has facets */ #define XML_SCHEMAS_TYPE_HAS_FACETS 1 << 27 /** * XML_SCHEMAS_TYPE_NORMVALUENEEDED: * * indicates if the facets (pattern) need a normalized value */ #define XML_SCHEMAS_TYPE_NORMVALUENEEDED 1 << 28 /** * XML_SCHEMAS_TYPE_FIXUP_1: * * First stage of fixup was done. */ #define XML_SCHEMAS_TYPE_FIXUP_1 1 << 29 /** * XML_SCHEMAS_TYPE_REDEFINED: * * The type was redefined. */ #define XML_SCHEMAS_TYPE_REDEFINED 1 << 30 /** * XML_SCHEMAS_TYPE_REDEFINING: * * The type redefines an other type. */ /* #define XML_SCHEMAS_TYPE_REDEFINING 1 << 31 */ /** * _xmlSchemaType: * * Schemas type definition. */ struct _xmlSchemaType { xmlSchemaTypeType type; /* The kind of type */ struct _xmlSchemaType *next; /* the next type if in a sequence ... */ const xmlChar *name; const xmlChar *id ; /* Deprecated; not used */ const xmlChar *ref; /* Deprecated; not used */ const xmlChar *refNs; /* Deprecated; not used */ xmlSchemaAnnotPtr annot; xmlSchemaTypePtr subtypes; xmlSchemaAttributePtr attributes; /* Deprecated; not used */ xmlNodePtr node; int minOccurs; /* Deprecated; not used */ int maxOccurs; /* Deprecated; not used */ int flags; xmlSchemaContentType contentType; const xmlChar *base; /* Base type's local name */ const xmlChar *baseNs; /* Base type's target namespace */ xmlSchemaTypePtr baseType; /* The base type component */ xmlSchemaFacetPtr facets; /* Local facets */ struct _xmlSchemaType *redef; /* Deprecated; not used */ int recurse; /* Obsolete */ xmlSchemaAttributeLinkPtr *attributeUses; /* Deprecated; not used */ xmlSchemaWildcardPtr attributeWildcard; int builtInType; /* Type of built-in types. */ xmlSchemaTypeLinkPtr memberTypes; /* member-types if a union type. */ xmlSchemaFacetLinkPtr facetSet; /* All facets (incl. inherited) */ const xmlChar *refPrefix; /* Deprecated; not used */ xmlSchemaTypePtr contentTypeDef; /* Used for the simple content of complex types. Could we use @subtypes for this? */ xmlRegexpPtr contModel; /* Holds the automaton of the content model */ const xmlChar *targetNamespace; void *attrUses; }; /* * xmlSchemaElement: * An element definition. * * xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of * structures must be kept similar */ /** * XML_SCHEMAS_ELEM_NILLABLE: * * the element is nillable */ #define XML_SCHEMAS_ELEM_NILLABLE 1 << 0 /** * XML_SCHEMAS_ELEM_GLOBAL: * * the element is global */ #define XML_SCHEMAS_ELEM_GLOBAL 1 << 1 /** * XML_SCHEMAS_ELEM_DEFAULT: * * the element has a default value */ #define XML_SCHEMAS_ELEM_DEFAULT 1 << 2 /** * XML_SCHEMAS_ELEM_FIXED: * * the element has a fixed value */ #define XML_SCHEMAS_ELEM_FIXED 1 << 3 /** * XML_SCHEMAS_ELEM_ABSTRACT: * * the element is abstract */ #define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4 /** * XML_SCHEMAS_ELEM_TOPLEVEL: * * the element is top level * obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead */ #define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5 /** * XML_SCHEMAS_ELEM_REF: * * the element is a reference to a type */ #define XML_SCHEMAS_ELEM_REF 1 << 6 /** * XML_SCHEMAS_ELEM_NSDEFAULT: * * allow elements in no namespace * Obsolete, not used anymore. */ #define XML_SCHEMAS_ELEM_NSDEFAULT 1 << 7 /** * XML_SCHEMAS_ELEM_INTERNAL_RESOLVED: * * this is set when "type", "ref", "substitutionGroup" * references have been resolved. */ #define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED 1 << 8 /** * XML_SCHEMAS_ELEM_CIRCULAR: * * a helper flag for the search of circular references. */ #define XML_SCHEMAS_ELEM_CIRCULAR 1 << 9 /** * XML_SCHEMAS_ELEM_BLOCK_ABSENT: * * the "block" attribute is absent */ #define XML_SCHEMAS_ELEM_BLOCK_ABSENT 1 << 10 /** * XML_SCHEMAS_ELEM_BLOCK_EXTENSION: * * disallowed substitutions are absent */ #define XML_SCHEMAS_ELEM_BLOCK_EXTENSION 1 << 11 /** * XML_SCHEMAS_ELEM_BLOCK_RESTRICTION: * * disallowed substitutions: "restriction" */ #define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION 1 << 12 /** * XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION: * * disallowed substitutions: "substituion" */ #define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13 /** * XML_SCHEMAS_ELEM_FINAL_ABSENT: * * substitution group exclusions are absent */ #define XML_SCHEMAS_ELEM_FINAL_ABSENT 1 << 14 /** * XML_SCHEMAS_ELEM_FINAL_EXTENSION: * * substitution group exclusions: "extension" */ #define XML_SCHEMAS_ELEM_FINAL_EXTENSION 1 << 15 /** * XML_SCHEMAS_ELEM_FINAL_RESTRICTION: * * substitution group exclusions: "restriction" */ #define XML_SCHEMAS_ELEM_FINAL_RESTRICTION 1 << 16 /** * XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD: * * the declaration is a substitution group head */ #define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD 1 << 17 /** * XML_SCHEMAS_ELEM_INTERNAL_CHECKED: * * this is set when the elem decl has been checked against * all constraints */ #define XML_SCHEMAS_ELEM_INTERNAL_CHECKED 1 << 18 typedef struct _xmlSchemaElement xmlSchemaElement; typedef xmlSchemaElement *xmlSchemaElementPtr; struct _xmlSchemaElement { xmlSchemaTypeType type; /* The kind of type */ struct _xmlSchemaType *next; /* Not used? */ const xmlChar *name; const xmlChar *id; /* Deprecated; not used */ const xmlChar *ref; /* Deprecated; not used */ const xmlChar *refNs; /* Deprecated; not used */ xmlSchemaAnnotPtr annot; xmlSchemaTypePtr subtypes; /* the type definition */ xmlSchemaAttributePtr attributes; xmlNodePtr node; int minOccurs; /* Deprecated; not used */ int maxOccurs; /* Deprecated; not used */ int flags; const xmlChar *targetNamespace; const xmlChar *namedType; const xmlChar *namedTypeNs; const xmlChar *substGroup; const xmlChar *substGroupNs; const xmlChar *scope; const xmlChar *value; /* The original value of the value constraint. */ struct _xmlSchemaElement *refDecl; /* This will now be used for the substitution group affiliation */ xmlRegexpPtr contModel; /* Obsolete for WXS, maybe used for RelaxNG */ xmlSchemaContentType contentType; const xmlChar *refPrefix; /* Deprecated; not used */ xmlSchemaValPtr defVal; /* The compiled value contraint. */ void *idcs; /* The identity-constraint defs */ }; /* * XML_SCHEMAS_FACET_UNKNOWN: * * unknown facet handling */ #define XML_SCHEMAS_FACET_UNKNOWN 0 /* * XML_SCHEMAS_FACET_PRESERVE: * * preserve the type of the facet */ #define XML_SCHEMAS_FACET_PRESERVE 1 /* * XML_SCHEMAS_FACET_REPLACE: * * replace the type of the facet */ #define XML_SCHEMAS_FACET_REPLACE 2 /* * XML_SCHEMAS_FACET_COLLAPSE: * * collapse the types of the facet */ #define XML_SCHEMAS_FACET_COLLAPSE 3 /** * A facet definition. */ struct _xmlSchemaFacet { xmlSchemaTypeType type; /* The kind of type */ struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */ const xmlChar *value; /* The original value */ const xmlChar *id; /* Obsolete */ xmlSchemaAnnotPtr annot; xmlNodePtr node; int fixed; /* XML_SCHEMAS_FACET_PRESERVE, etc. */ int whitespace; xmlSchemaValPtr val; /* The compiled value */ xmlRegexpPtr regexp; /* The regex for patterns */ }; /** * A notation definition. */ typedef struct _xmlSchemaNotation xmlSchemaNotation; typedef xmlSchemaNotation *xmlSchemaNotationPtr; struct _xmlSchemaNotation { xmlSchemaTypeType type; /* The kind of type */ const xmlChar *name; xmlSchemaAnnotPtr annot; const xmlChar *identifier; const xmlChar *targetNamespace; }; /* * TODO: Actually all those flags used for the schema should sit * on the schema parser context, since they are used only * during parsing an XML schema document, and not available * on the component level as per spec. */ /** * XML_SCHEMAS_QUALIF_ELEM: * * Reflects elementFormDefault == qualified in * an XML schema document. */ #define XML_SCHEMAS_QUALIF_ELEM 1 << 0 /** * XML_SCHEMAS_QUALIF_ATTR: * * Reflects attributeFormDefault == qualified in * an XML schema document. */ #define XML_SCHEMAS_QUALIF_ATTR 1 << 1 /** * XML_SCHEMAS_FINAL_DEFAULT_EXTENSION: * * the schema has "extension" in the set of finalDefault. */ #define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION 1 << 2 /** * XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION: * * the schema has "restriction" in the set of finalDefault. */ #define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION 1 << 3 /** * XML_SCHEMAS_FINAL_DEFAULT_LIST: * * the cshema has "list" in the set of finalDefault. */ #define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4 /** * XML_SCHEMAS_FINAL_DEFAULT_UNION: * * the schema has "union" in the set of finalDefault. */ #define XML_SCHEMAS_FINAL_DEFAULT_UNION 1 << 5 /** * XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION: * * the schema has "extension" in the set of blockDefault. */ #define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION 1 << 6 /** * XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION: * * the schema has "restriction" in the set of blockDefault. */ #define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION 1 << 7 /** * XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION: * * the schema has "substitution" in the set of blockDefault. */ #define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION 1 << 8 /** * XML_SCHEMAS_INCLUDING_CONVERT_NS: * * the schema is currently including an other schema with * no target namespace. */ #define XML_SCHEMAS_INCLUDING_CONVERT_NS 1 << 9 /** * _xmlSchema: * * A Schemas definition */ struct _xmlSchema { const xmlChar *name; /* schema name */ const xmlChar *targetNamespace; /* the target namespace */ const xmlChar *version; const xmlChar *id; /* Obsolete */ xmlDocPtr doc; xmlSchemaAnnotPtr annot; int flags; xmlHashTablePtr typeDecl; xmlHashTablePtr attrDecl; xmlHashTablePtr attrgrpDecl; xmlHashTablePtr elemDecl; xmlHashTablePtr notaDecl; xmlHashTablePtr schemasImports; void *_private; /* unused by the library for users or bindings */ xmlHashTablePtr groupDecl; xmlDictPtr dict; void *includes; /* the includes, this is opaque for now */ int preserve; /* whether to free the document */ int counter; /* used to give ononymous components unique names */ xmlHashTablePtr idcDef; /* All identity-constraint defs. */ void *volatiles; /* Obsolete */ }; XMLPUBFUN void XMLCALL xmlSchemaFreeType (xmlSchemaTypePtr type); XMLPUBFUN void XMLCALL xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard); #ifdef __cplusplus } #endif #endif /* LIBXML_SCHEMAS_ENABLED */ #endif /* __XML_SCHEMA_INTERNALS_H__ */ �������������������������������������������������������������������������������������������libxml2/libxml/relaxng.h����������������������������������������������������������������������������0000644�����������������00000013506�14763166030�0011230 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: implementation of the Relax-NG validation * Description: implementation of the Relax-NG validation * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_RELAX_NG__ #define __XML_RELAX_NG__ #include <libxml/xmlversion.h> #include <libxml/hash.h> #include <libxml/xmlstring.h> #ifdef LIBXML_SCHEMAS_ENABLED #ifdef __cplusplus extern "C" { #endif typedef struct _xmlRelaxNG xmlRelaxNG; typedef xmlRelaxNG *xmlRelaxNGPtr; /** * xmlRelaxNGValidityErrorFunc: * @ctx: the validation context * @msg: the message * @...: extra arguments * * Signature of an error callback from a Relax-NG validation */ typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); /** * xmlRelaxNGValidityWarningFunc: * @ctx: the validation context * @msg: the message * @...: extra arguments * * Signature of a warning callback from a Relax-NG validation */ typedef void (XMLCDECL *xmlRelaxNGValidityWarningFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); /** * A schemas validation context */ typedef struct _xmlRelaxNGParserCtxt xmlRelaxNGParserCtxt; typedef xmlRelaxNGParserCtxt *xmlRelaxNGParserCtxtPtr; typedef struct _xmlRelaxNGValidCtxt xmlRelaxNGValidCtxt; typedef xmlRelaxNGValidCtxt *xmlRelaxNGValidCtxtPtr; /* * xmlRelaxNGValidErr: * * List of possible Relax NG validation errors */ typedef enum { XML_RELAXNG_OK = 0, XML_RELAXNG_ERR_MEMORY, XML_RELAXNG_ERR_TYPE, XML_RELAXNG_ERR_TYPEVAL, XML_RELAXNG_ERR_DUPID, XML_RELAXNG_ERR_TYPECMP, XML_RELAXNG_ERR_NOSTATE, XML_RELAXNG_ERR_NODEFINE, XML_RELAXNG_ERR_LISTEXTRA, XML_RELAXNG_ERR_LISTEMPTY, XML_RELAXNG_ERR_INTERNODATA, XML_RELAXNG_ERR_INTERSEQ, XML_RELAXNG_ERR_INTEREXTRA, XML_RELAXNG_ERR_ELEMNAME, XML_RELAXNG_ERR_ATTRNAME, XML_RELAXNG_ERR_ELEMNONS, XML_RELAXNG_ERR_ATTRNONS, XML_RELAXNG_ERR_ELEMWRONGNS, XML_RELAXNG_ERR_ATTRWRONGNS, XML_RELAXNG_ERR_ELEMEXTRANS, XML_RELAXNG_ERR_ATTREXTRANS, XML_RELAXNG_ERR_ELEMNOTEMPTY, XML_RELAXNG_ERR_NOELEM, XML_RELAXNG_ERR_NOTELEM, XML_RELAXNG_ERR_ATTRVALID, XML_RELAXNG_ERR_CONTENTVALID, XML_RELAXNG_ERR_EXTRACONTENT, XML_RELAXNG_ERR_INVALIDATTR, XML_RELAXNG_ERR_DATAELEM, XML_RELAXNG_ERR_VALELEM, XML_RELAXNG_ERR_LISTELEM, XML_RELAXNG_ERR_DATATYPE, XML_RELAXNG_ERR_VALUE, XML_RELAXNG_ERR_LIST, XML_RELAXNG_ERR_NOGRAMMAR, XML_RELAXNG_ERR_EXTRADATA, XML_RELAXNG_ERR_LACKDATA, XML_RELAXNG_ERR_INTERNAL, XML_RELAXNG_ERR_ELEMWRONG, XML_RELAXNG_ERR_TEXTWRONG } xmlRelaxNGValidErr; /* * xmlRelaxNGParserFlags: * * List of possible Relax NG Parser flags */ typedef enum { XML_RELAXNGP_NONE = 0, XML_RELAXNGP_FREE_DOC = 1, XML_RELAXNGP_CRNG = 2 } xmlRelaxNGParserFlag; XMLPUBFUN int XMLCALL xmlRelaxNGInitTypes (void); XMLPUBFUN void XMLCALL xmlRelaxNGCleanupTypes (void); /* * Interfaces for parsing. */ XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL xmlRelaxNGNewParserCtxt (const char *URL); XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL xmlRelaxNGNewMemParserCtxt (const char *buffer, int size); XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL xmlRelaxNGNewDocParserCtxt (xmlDocPtr doc); XMLPUBFUN int XMLCALL xmlRelaxParserSetFlag (xmlRelaxNGParserCtxtPtr ctxt, int flag); XMLPUBFUN void XMLCALL xmlRelaxNGFreeParserCtxt (xmlRelaxNGParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt, xmlRelaxNGValidityErrorFunc err, xmlRelaxNGValidityWarningFunc warn, void *ctx); XMLPUBFUN int XMLCALL xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxtPtr ctxt, xmlRelaxNGValidityErrorFunc *err, xmlRelaxNGValidityWarningFunc *warn, void **ctx); XMLPUBFUN void XMLCALL xmlRelaxNGSetParserStructuredErrors( xmlRelaxNGParserCtxtPtr ctxt, xmlStructuredErrorFunc serror, void *ctx); XMLPUBFUN xmlRelaxNGPtr XMLCALL xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlRelaxNGFree (xmlRelaxNGPtr schema); #ifdef LIBXML_OUTPUT_ENABLED XMLPUBFUN void XMLCALL xmlRelaxNGDump (FILE *output, xmlRelaxNGPtr schema); XMLPUBFUN void XMLCALL xmlRelaxNGDumpTree (FILE * output, xmlRelaxNGPtr schema); #endif /* LIBXML_OUTPUT_ENABLED */ /* * Interfaces for validating */ XMLPUBFUN void XMLCALL xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt, xmlRelaxNGValidityErrorFunc err, xmlRelaxNGValidityWarningFunc warn, void *ctx); XMLPUBFUN int XMLCALL xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt, xmlRelaxNGValidityErrorFunc *err, xmlRelaxNGValidityWarningFunc *warn, void **ctx); XMLPUBFUN void XMLCALL xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt, xmlStructuredErrorFunc serror, void *ctx); XMLPUBFUN xmlRelaxNGValidCtxtPtr XMLCALL xmlRelaxNGNewValidCtxt (xmlRelaxNGPtr schema); XMLPUBFUN void XMLCALL xmlRelaxNGFreeValidCtxt (xmlRelaxNGValidCtxtPtr ctxt); XMLPUBFUN int XMLCALL xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxtPtr ctxt, xmlDocPtr doc); /* * Interfaces for progressive validation when possible */ XMLPUBFUN int XMLCALL xmlRelaxNGValidatePushElement (xmlRelaxNGValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem); XMLPUBFUN int XMLCALL xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxtPtr ctxt, const xmlChar *data, int len); XMLPUBFUN int XMLCALL xmlRelaxNGValidatePopElement (xmlRelaxNGValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem); XMLPUBFUN int XMLCALL xmlRelaxNGValidateFullElement (xmlRelaxNGValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem); #ifdef __cplusplus } #endif #endif /* LIBXML_SCHEMAS_ENABLED */ #endif /* __XML_RELAX_NG__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/xmlreader.h��������������������������������������������������������������������������0000644�����������������00000030476�14763166030�0011560 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: the XMLReader implementation * Description: API of the XML streaming API based on C# interfaces. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XMLREADER_H__ #define __XML_XMLREADER_H__ #include <libxml/xmlversion.h> #include <libxml/tree.h> #include <libxml/xmlIO.h> #ifdef LIBXML_SCHEMAS_ENABLED #include <libxml/relaxng.h> #include <libxml/xmlschemas.h> #endif #ifdef __cplusplus extern "C" { #endif /** * xmlParserSeverities: * * How severe an error callback is when the per-reader error callback API * is used. */ typedef enum { XML_PARSER_SEVERITY_VALIDITY_WARNING = 1, XML_PARSER_SEVERITY_VALIDITY_ERROR = 2, XML_PARSER_SEVERITY_WARNING = 3, XML_PARSER_SEVERITY_ERROR = 4 } xmlParserSeverities; #ifdef LIBXML_READER_ENABLED /** * xmlTextReaderMode: * * Internal state values for the reader. */ typedef enum { XML_TEXTREADER_MODE_INITIAL = 0, XML_TEXTREADER_MODE_INTERACTIVE = 1, XML_TEXTREADER_MODE_ERROR = 2, XML_TEXTREADER_MODE_EOF =3, XML_TEXTREADER_MODE_CLOSED = 4, XML_TEXTREADER_MODE_READING = 5 } xmlTextReaderMode; /** * xmlParserProperties: * * Some common options to use with xmlTextReaderSetParserProp, but it * is better to use xmlParserOption and the xmlReaderNewxxx and * xmlReaderForxxx APIs now. */ typedef enum { XML_PARSER_LOADDTD = 1, XML_PARSER_DEFAULTATTRS = 2, XML_PARSER_VALIDATE = 3, XML_PARSER_SUBST_ENTITIES = 4 } xmlParserProperties; /** * xmlReaderTypes: * * Predefined constants for the different types of nodes. */ typedef enum { XML_READER_TYPE_NONE = 0, XML_READER_TYPE_ELEMENT = 1, XML_READER_TYPE_ATTRIBUTE = 2, XML_READER_TYPE_TEXT = 3, XML_READER_TYPE_CDATA = 4, XML_READER_TYPE_ENTITY_REFERENCE = 5, XML_READER_TYPE_ENTITY = 6, XML_READER_TYPE_PROCESSING_INSTRUCTION = 7, XML_READER_TYPE_COMMENT = 8, XML_READER_TYPE_DOCUMENT = 9, XML_READER_TYPE_DOCUMENT_TYPE = 10, XML_READER_TYPE_DOCUMENT_FRAGMENT = 11, XML_READER_TYPE_NOTATION = 12, XML_READER_TYPE_WHITESPACE = 13, XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14, XML_READER_TYPE_END_ELEMENT = 15, XML_READER_TYPE_END_ENTITY = 16, XML_READER_TYPE_XML_DECLARATION = 17 } xmlReaderTypes; /** * xmlTextReader: * * Structure for an xmlReader context. */ typedef struct _xmlTextReader xmlTextReader; /** * xmlTextReaderPtr: * * Pointer to an xmlReader context. */ typedef xmlTextReader *xmlTextReaderPtr; /* * Constructors & Destructor */ XMLPUBFUN xmlTextReaderPtr XMLCALL xmlNewTextReader (xmlParserInputBufferPtr input, const char *URI); XMLPUBFUN xmlTextReaderPtr XMLCALL xmlNewTextReaderFilename(const char *URI); XMLPUBFUN void XMLCALL xmlFreeTextReader (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderSetup(xmlTextReaderPtr reader, xmlParserInputBufferPtr input, const char *URL, const char *encoding, int options); /* * Iterators */ XMLPUBFUN int XMLCALL xmlTextReaderRead (xmlTextReaderPtr reader); #ifdef LIBXML_WRITER_ENABLED XMLPUBFUN xmlChar * XMLCALL xmlTextReaderReadInnerXml(xmlTextReaderPtr reader); XMLPUBFUN xmlChar * XMLCALL xmlTextReaderReadOuterXml(xmlTextReaderPtr reader); #endif XMLPUBFUN xmlChar * XMLCALL xmlTextReaderReadString (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderReadAttributeValue(xmlTextReaderPtr reader); /* * Attributes of the node */ XMLPUBFUN int XMLCALL xmlTextReaderAttributeCount(xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderDepth (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderHasAttributes(xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderHasValue(xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderIsDefault (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderNodeType (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderQuoteChar (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderReadState (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader); XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstBaseUri (xmlTextReaderPtr reader); XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstLocalName (xmlTextReaderPtr reader); XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstName (xmlTextReaderPtr reader); XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader); XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstPrefix (xmlTextReaderPtr reader); XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstXmlLang (xmlTextReaderPtr reader); XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstString (xmlTextReaderPtr reader, const xmlChar *str); XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstValue (xmlTextReaderPtr reader); /* * use the Const version of the routine for * better performance and simpler code */ XMLPUBFUN xmlChar * XMLCALL xmlTextReaderBaseUri (xmlTextReaderPtr reader); XMLPUBFUN xmlChar * XMLCALL xmlTextReaderLocalName (xmlTextReaderPtr reader); XMLPUBFUN xmlChar * XMLCALL xmlTextReaderName (xmlTextReaderPtr reader); XMLPUBFUN xmlChar * XMLCALL xmlTextReaderNamespaceUri(xmlTextReaderPtr reader); XMLPUBFUN xmlChar * XMLCALL xmlTextReaderPrefix (xmlTextReaderPtr reader); XMLPUBFUN xmlChar * XMLCALL xmlTextReaderXmlLang (xmlTextReaderPtr reader); XMLPUBFUN xmlChar * XMLCALL xmlTextReaderValue (xmlTextReaderPtr reader); /* * Methods of the XmlTextReader */ XMLPUBFUN int XMLCALL xmlTextReaderClose (xmlTextReaderPtr reader); XMLPUBFUN xmlChar * XMLCALL xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader, int no); XMLPUBFUN xmlChar * XMLCALL xmlTextReaderGetAttribute (xmlTextReaderPtr reader, const xmlChar *name); XMLPUBFUN xmlChar * XMLCALL xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader, const xmlChar *localName, const xmlChar *namespaceURI); XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlTextReaderGetRemainder (xmlTextReaderPtr reader); XMLPUBFUN xmlChar * XMLCALL xmlTextReaderLookupNamespace(xmlTextReaderPtr reader, const xmlChar *prefix); XMLPUBFUN int XMLCALL xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader, int no); XMLPUBFUN int XMLCALL xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader, const xmlChar *name); XMLPUBFUN int XMLCALL xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader, const xmlChar *localName, const xmlChar *namespaceURI); XMLPUBFUN int XMLCALL xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderMoveToElement (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderNormalization (xmlTextReaderPtr reader); XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstEncoding (xmlTextReaderPtr reader); /* * Extensions */ XMLPUBFUN int XMLCALL xmlTextReaderSetParserProp (xmlTextReaderPtr reader, int prop, int value); XMLPUBFUN int XMLCALL xmlTextReaderGetParserProp (xmlTextReaderPtr reader, int prop); XMLPUBFUN xmlNodePtr XMLCALL xmlTextReaderCurrentNode (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderGetParserLineNumber(xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader); XMLPUBFUN xmlNodePtr XMLCALL xmlTextReaderPreserve (xmlTextReaderPtr reader); #ifdef LIBXML_PATTERN_ENABLED XMLPUBFUN int XMLCALL xmlTextReaderPreservePattern(xmlTextReaderPtr reader, const xmlChar *pattern, const xmlChar **namespaces); #endif /* LIBXML_PATTERN_ENABLED */ XMLPUBFUN xmlDocPtr XMLCALL xmlTextReaderCurrentDoc (xmlTextReaderPtr reader); XMLPUBFUN xmlNodePtr XMLCALL xmlTextReaderExpand (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderNext (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderNextSibling (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderIsValid (xmlTextReaderPtr reader); #ifdef LIBXML_SCHEMAS_ENABLED XMLPUBFUN int XMLCALL xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, const char *rng); XMLPUBFUN int XMLCALL xmlTextReaderRelaxNGValidateCtxt(xmlTextReaderPtr reader, xmlRelaxNGValidCtxtPtr ctxt, int options); XMLPUBFUN int XMLCALL xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, xmlRelaxNGPtr schema); XMLPUBFUN int XMLCALL xmlTextReaderSchemaValidate (xmlTextReaderPtr reader, const char *xsd); XMLPUBFUN int XMLCALL xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader, xmlSchemaValidCtxtPtr ctxt, int options); XMLPUBFUN int XMLCALL xmlTextReaderSetSchema (xmlTextReaderPtr reader, xmlSchemaPtr schema); #endif XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderStandalone (xmlTextReaderPtr reader); /* * Index lookup */ XMLPUBFUN long XMLCALL xmlTextReaderByteConsumed (xmlTextReaderPtr reader); /* * New more complete APIs for simpler creation and reuse of readers */ XMLPUBFUN xmlTextReaderPtr XMLCALL xmlReaderWalker (xmlDocPtr doc); XMLPUBFUN xmlTextReaderPtr XMLCALL xmlReaderForDoc (const xmlChar * cur, const char *URL, const char *encoding, int options); XMLPUBFUN xmlTextReaderPtr XMLCALL xmlReaderForFile (const char *filename, const char *encoding, int options); XMLPUBFUN xmlTextReaderPtr XMLCALL xmlReaderForMemory (const char *buffer, int size, const char *URL, const char *encoding, int options); XMLPUBFUN xmlTextReaderPtr XMLCALL xmlReaderForFd (int fd, const char *URL, const char *encoding, int options); XMLPUBFUN xmlTextReaderPtr XMLCALL xmlReaderForIO (xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options); XMLPUBFUN int XMLCALL xmlReaderNewWalker (xmlTextReaderPtr reader, xmlDocPtr doc); XMLPUBFUN int XMLCALL xmlReaderNewDoc (xmlTextReaderPtr reader, const xmlChar * cur, const char *URL, const char *encoding, int options); XMLPUBFUN int XMLCALL xmlReaderNewFile (xmlTextReaderPtr reader, const char *filename, const char *encoding, int options); XMLPUBFUN int XMLCALL xmlReaderNewMemory (xmlTextReaderPtr reader, const char *buffer, int size, const char *URL, const char *encoding, int options); XMLPUBFUN int XMLCALL xmlReaderNewFd (xmlTextReaderPtr reader, int fd, const char *URL, const char *encoding, int options); XMLPUBFUN int XMLCALL xmlReaderNewIO (xmlTextReaderPtr reader, xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options); /* * Error handling extensions */ typedef void * xmlTextReaderLocatorPtr; /** * xmlTextReaderErrorFunc: * @arg: the user argument * @msg: the message * @severity: the severity of the error * @locator: a locator indicating where the error occured * * Signature of an error callback from a reader parser */ typedef void (XMLCALL *xmlTextReaderErrorFunc)(void *arg, const char *msg, xmlParserSeverities severity, xmlTextReaderLocatorPtr locator); XMLPUBFUN int XMLCALL xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator); XMLPUBFUN xmlChar * XMLCALL xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator); XMLPUBFUN void XMLCALL xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, xmlTextReaderErrorFunc f, void *arg); XMLPUBFUN void XMLCALL xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, xmlStructuredErrorFunc f, void *arg); XMLPUBFUN void XMLCALL xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, xmlTextReaderErrorFunc *f, void **arg); #endif /* LIBXML_READER_ENABLED */ #ifdef __cplusplus } #endif #endif /* __XML_XMLREADER_H__ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/schematron.h�������������������������������������������������������������������������0000644�����������������00000010423�14763166030�0011726 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: XML Schemastron implementation * Description: interface to the XML Schematron validity checking. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_SCHEMATRON_H__ #define __XML_SCHEMATRON_H__ #include <libxml/xmlversion.h> #ifdef LIBXML_SCHEMATRON_ENABLED #include <libxml/tree.h> #ifdef __cplusplus extern "C" { #endif typedef enum { XML_SCHEMATRON_OUT_QUIET = 1 << 0, /* quiet no report */ XML_SCHEMATRON_OUT_TEXT = 1 << 1, /* build a textual report */ XML_SCHEMATRON_OUT_XML = 1 << 2, /* output SVRL */ XML_SCHEMATRON_OUT_ERROR = 1 << 3, /* output via xmlStructuredErrorFunc */ XML_SCHEMATRON_OUT_FILE = 1 << 8, /* output to a file descriptor */ XML_SCHEMATRON_OUT_BUFFER = 1 << 9, /* output to a buffer */ XML_SCHEMATRON_OUT_IO = 1 << 10 /* output to I/O mechanism */ } xmlSchematronValidOptions; /** * The schemas related types are kept internal */ typedef struct _xmlSchematron xmlSchematron; typedef xmlSchematron *xmlSchematronPtr; /** * xmlSchematronValidityErrorFunc: * @ctx: the validation context * @msg: the message * @...: extra arguments * * Signature of an error callback from a Schematron validation */ typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...); /** * xmlSchematronValidityWarningFunc: * @ctx: the validation context * @msg: the message * @...: extra arguments * * Signature of a warning callback from a Schematron validation */ typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...); /** * A schemas validation context */ typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt; typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr; typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt; typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr; /* * Interfaces for parsing. */ XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL xmlSchematronNewParserCtxt (const char *URL); XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL xmlSchematronNewMemParserCtxt(const char *buffer, int size); XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL xmlSchematronNewDocParserCtxt(xmlDocPtr doc); XMLPUBFUN void XMLCALL xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt); /***** XMLPUBFUN void XMLCALL xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt, xmlSchematronValidityErrorFunc err, xmlSchematronValidityWarningFunc warn, void *ctx); XMLPUBFUN int XMLCALL xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt, xmlSchematronValidityErrorFunc * err, xmlSchematronValidityWarningFunc * warn, void **ctx); XMLPUBFUN int XMLCALL xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt); *****/ XMLPUBFUN xmlSchematronPtr XMLCALL xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlSchematronFree (xmlSchematronPtr schema); /* * Interfaces for validating */ XMLPUBFUN void XMLCALL xmlSchematronSetValidStructuredErrors( xmlSchematronValidCtxtPtr ctxt, xmlStructuredErrorFunc serror, void *ctx); /****** XMLPUBFUN void XMLCALL xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt, xmlSchematronValidityErrorFunc err, xmlSchematronValidityWarningFunc warn, void *ctx); XMLPUBFUN int XMLCALL xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt, xmlSchematronValidityErrorFunc *err, xmlSchematronValidityWarningFunc *warn, void **ctx); XMLPUBFUN int XMLCALL xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt, int options); XMLPUBFUN int XMLCALL xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt); XMLPUBFUN int XMLCALL xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt, xmlNodePtr elem); *******/ XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL xmlSchematronNewValidCtxt (xmlSchematronPtr schema, int options); XMLPUBFUN void XMLCALL xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt); XMLPUBFUN int XMLCALL xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt, xmlDocPtr instance); #ifdef __cplusplus } #endif #endif /* LIBXML_SCHEMATRON_ENABLED */ #endif /* __XML_SCHEMATRON_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/catalog.h����������������������������������������������������������������������������0000644�����������������00000011451�14763166030�0011177 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * Summary: interfaces to the Catalog handling system * Description: the catalog module implements the support for * XML Catalogs and SGML catalogs * * SGML Open Technical Resolution TR9401:1997. * http://www.jclark.com/sp/catalog.htm * * XML Catalogs Working Draft 06 August 2001 * http://www.oasis-open.org/committees/entity/spec-2001-08-06.html * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_CATALOG_H__ #define __XML_CATALOG_H__ #include <stdio.h> #include <libxml/xmlversion.h> #include <libxml/xmlstring.h> #include <libxml/tree.h> #ifdef LIBXML_CATALOG_ENABLED #ifdef __cplusplus extern "C" { #endif /** * XML_CATALOGS_NAMESPACE: * * The namespace for the XML Catalogs elements. */ #define XML_CATALOGS_NAMESPACE \ (const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog" /** * XML_CATALOG_PI: * * The specific XML Catalog Processing Instuction name. */ #define XML_CATALOG_PI \ (const xmlChar *) "oasis-xml-catalog" /* * The API is voluntarily limited to general cataloging. */ typedef enum { XML_CATA_PREFER_NONE = 0, XML_CATA_PREFER_PUBLIC = 1, XML_CATA_PREFER_SYSTEM } xmlCatalogPrefer; typedef enum { XML_CATA_ALLOW_NONE = 0, XML_CATA_ALLOW_GLOBAL = 1, XML_CATA_ALLOW_DOCUMENT = 2, XML_CATA_ALLOW_ALL = 3 } xmlCatalogAllow; typedef struct _xmlCatalog xmlCatalog; typedef xmlCatalog *xmlCatalogPtr; /* * Operations on a given catalog. */ XMLPUBFUN xmlCatalogPtr XMLCALL xmlNewCatalog (int sgml); XMLPUBFUN xmlCatalogPtr XMLCALL xmlLoadACatalog (const char *filename); XMLPUBFUN xmlCatalogPtr XMLCALL xmlLoadSGMLSuperCatalog (const char *filename); XMLPUBFUN int XMLCALL xmlConvertSGMLCatalog (xmlCatalogPtr catal); XMLPUBFUN int XMLCALL xmlACatalogAdd (xmlCatalogPtr catal, const xmlChar *type, const xmlChar *orig, const xmlChar *replace); XMLPUBFUN int XMLCALL xmlACatalogRemove (xmlCatalogPtr catal, const xmlChar *value); XMLPUBFUN xmlChar * XMLCALL xmlACatalogResolve (xmlCatalogPtr catal, const xmlChar *pubID, const xmlChar *sysID); XMLPUBFUN xmlChar * XMLCALL xmlACatalogResolveSystem(xmlCatalogPtr catal, const xmlChar *sysID); XMLPUBFUN xmlChar * XMLCALL xmlACatalogResolvePublic(xmlCatalogPtr catal, const xmlChar *pubID); XMLPUBFUN xmlChar * XMLCALL xmlACatalogResolveURI (xmlCatalogPtr catal, const xmlChar *URI); #ifdef LIBXML_OUTPUT_ENABLED XMLPUBFUN void XMLCALL xmlACatalogDump (xmlCatalogPtr catal, FILE *out); #endif /* LIBXML_OUTPUT_ENABLED */ XMLPUBFUN void XMLCALL xmlFreeCatalog (xmlCatalogPtr catal); XMLPUBFUN int XMLCALL xmlCatalogIsEmpty (xmlCatalogPtr catal); /* * Global operations. */ XMLPUBFUN void XMLCALL xmlInitializeCatalog (void); XMLPUBFUN int XMLCALL xmlLoadCatalog (const char *filename); XMLPUBFUN void XMLCALL xmlLoadCatalogs (const char *paths); XMLPUBFUN void XMLCALL xmlCatalogCleanup (void); #ifdef LIBXML_OUTPUT_ENABLED XMLPUBFUN void XMLCALL xmlCatalogDump (FILE *out); #endif /* LIBXML_OUTPUT_ENABLED */ XMLPUBFUN xmlChar * XMLCALL xmlCatalogResolve (const xmlChar *pubID, const xmlChar *sysID); XMLPUBFUN xmlChar * XMLCALL xmlCatalogResolveSystem (const xmlChar *sysID); XMLPUBFUN xmlChar * XMLCALL xmlCatalogResolvePublic (const xmlChar *pubID); XMLPUBFUN xmlChar * XMLCALL xmlCatalogResolveURI (const xmlChar *URI); XMLPUBFUN int XMLCALL xmlCatalogAdd (const xmlChar *type, const xmlChar *orig, const xmlChar *replace); XMLPUBFUN int XMLCALL xmlCatalogRemove (const xmlChar *value); XMLPUBFUN xmlDocPtr XMLCALL xmlParseCatalogFile (const char *filename); XMLPUBFUN int XMLCALL xmlCatalogConvert (void); /* * Strictly minimal interfaces for per-document catalogs used * by the parser. */ XMLPUBFUN void XMLCALL xmlCatalogFreeLocal (void *catalogs); XMLPUBFUN void * XMLCALL xmlCatalogAddLocal (void *catalogs, const xmlChar *URL); XMLPUBFUN xmlChar * XMLCALL xmlCatalogLocalResolve (void *catalogs, const xmlChar *pubID, const xmlChar *sysID); XMLPUBFUN xmlChar * XMLCALL xmlCatalogLocalResolveURI(void *catalogs, const xmlChar *URI); /* * Preference settings. */ XMLPUBFUN int XMLCALL xmlCatalogSetDebug (int level); XMLPUBFUN xmlCatalogPrefer XMLCALL xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer); XMLPUBFUN void XMLCALL xmlCatalogSetDefaults (xmlCatalogAllow allow); XMLPUBFUN xmlCatalogAllow XMLCALL xmlCatalogGetDefaults (void); /* DEPRECATED interfaces */ XMLPUBFUN const xmlChar * XMLCALL xmlCatalogGetSystem (const xmlChar *sysID); XMLPUBFUN const xmlChar * XMLCALL xmlCatalogGetPublic (const xmlChar *pubID); #ifdef __cplusplus } #endif #endif /* LIBXML_CATALOG_ENABLED */ #endif /* __XML_CATALOG_H__ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/parser.h�����������������������������������������������������������������������������0000644�����������������00000115447�14763166030�0011073 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: the core parser module * Description: Interfaces, constants and types related to the XML parser * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_PARSER_H__ #define __XML_PARSER_H__ #include <stdarg.h> #include <libxml/xmlversion.h> #include <libxml/tree.h> #include <libxml/dict.h> #include <libxml/hash.h> #include <libxml/valid.h> #include <libxml/entities.h> #include <libxml/xmlerror.h> #include <libxml/xmlstring.h> #ifdef __cplusplus extern "C" { #endif /** * XML_DEFAULT_VERSION: * * The default version of XML used: 1.0 */ #define XML_DEFAULT_VERSION "1.0" /** * xmlParserInput: * * An xmlParserInput is an input flow for the XML processor. * Each entity parsed is associated an xmlParserInput (except the * few predefined ones). This is the case both for internal entities * - in which case the flow is already completely in memory - or * external entities - in which case we use the buf structure for * progressive reading and I18N conversions to the internal UTF-8 format. */ /** * xmlParserInputDeallocate: * @str: the string to deallocate * * Callback for freeing some parser input allocations. */ typedef void (* xmlParserInputDeallocate)(xmlChar *str); struct _xmlParserInput { /* Input buffer */ xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */ const char *filename; /* The file analyzed, if any */ const char *directory; /* the directory/base of the file */ const xmlChar *base; /* Base of the array to parse */ const xmlChar *cur; /* Current char being parsed */ const xmlChar *end; /* end of the array to parse */ int length; /* length if known */ int line; /* Current line */ int col; /* Current column */ /* * NOTE: consumed is only tested for equality in the parser code, * so even if there is an overflow this should not give troubles * for parsing very large instances. */ unsigned long consumed; /* How many xmlChars already consumed */ xmlParserInputDeallocate free; /* function to deallocate the base */ const xmlChar *encoding; /* the encoding string for entity */ const xmlChar *version; /* the version string for entity */ int standalone; /* Was that entity marked standalone */ int id; /* an unique identifier for the entity */ }; /** * xmlParserNodeInfo: * * The parser can be asked to collect Node informations, i.e. at what * place in the file they were detected. * NOTE: This is off by default and not very well tested. */ typedef struct _xmlParserNodeInfo xmlParserNodeInfo; typedef xmlParserNodeInfo *xmlParserNodeInfoPtr; struct _xmlParserNodeInfo { const struct _xmlNode* node; /* Position & line # that text that created the node begins & ends on */ unsigned long begin_pos; unsigned long begin_line; unsigned long end_pos; unsigned long end_line; }; typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq; typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr; struct _xmlParserNodeInfoSeq { unsigned long maximum; unsigned long length; xmlParserNodeInfo* buffer; }; /** * xmlParserInputState: * * The parser is now working also as a state based parser. * The recursive one use the state info for entities processing. */ typedef enum { XML_PARSER_EOF = -1, /* nothing is to be parsed */ XML_PARSER_START = 0, /* nothing has been parsed */ XML_PARSER_MISC, /* Misc* before int subset */ XML_PARSER_PI, /* Within a processing instruction */ XML_PARSER_DTD, /* within some DTD content */ XML_PARSER_PROLOG, /* Misc* after internal subset */ XML_PARSER_COMMENT, /* within a comment */ XML_PARSER_START_TAG, /* within a start tag */ XML_PARSER_CONTENT, /* within the content */ XML_PARSER_CDATA_SECTION, /* within a CDATA section */ XML_PARSER_END_TAG, /* within a closing tag */ XML_PARSER_ENTITY_DECL, /* within an entity declaration */ XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */ XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */ XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */ XML_PARSER_EPILOG, /* the Misc* after the last end tag */ XML_PARSER_IGNORE, /* within an IGNORED section */ XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */ } xmlParserInputState; /** * XML_DETECT_IDS: * * Bit in the loadsubset context field to tell to do ID/REFs lookups. * Use it to initialize xmlLoadExtDtdDefaultValue. */ #define XML_DETECT_IDS 2 /** * XML_COMPLETE_ATTRS: * * Bit in the loadsubset context field to tell to do complete the * elements attributes lists with the ones defaulted from the DTDs. * Use it to initialize xmlLoadExtDtdDefaultValue. */ #define XML_COMPLETE_ATTRS 4 /** * XML_SKIP_IDS: * * Bit in the loadsubset context field to tell to not do ID/REFs registration. * Used to initialize xmlLoadExtDtdDefaultValue in some special cases. */ #define XML_SKIP_IDS 8 /** * xmlParserMode: * * A parser can operate in various modes */ typedef enum { XML_PARSE_UNKNOWN = 0, XML_PARSE_DOM = 1, XML_PARSE_SAX = 2, XML_PARSE_PUSH_DOM = 3, XML_PARSE_PUSH_SAX = 4, XML_PARSE_READER = 5 } xmlParserMode; /** * xmlParserCtxt: * * The parser context. * NOTE This doesn't completely define the parser state, the (current ?) * design of the parser uses recursive function calls since this allow * and easy mapping from the production rules of the specification * to the actual code. The drawback is that the actual function call * also reflect the parser state. However most of the parsing routines * takes as the only argument the parser context pointer, so migrating * to a state based parser for progressive parsing shouldn't be too hard. */ struct _xmlParserCtxt { struct _xmlSAXHandler *sax; /* The SAX handler */ void *userData; /* For SAX interface only, used by DOM build */ xmlDocPtr myDoc; /* the document being built */ int wellFormed; /* is the document well formed */ int replaceEntities; /* shall we replace entities ? */ const xmlChar *version; /* the XML version string */ const xmlChar *encoding; /* the declared encoding, if any */ int standalone; /* standalone document */ int html; /* an HTML(1)/Docbook(2) document * 3 is HTML after <head> * 10 is HTML after <body> */ /* Input stream stack */ xmlParserInputPtr input; /* Current input stream */ int inputNr; /* Number of current input streams */ int inputMax; /* Max number of input streams */ xmlParserInputPtr *inputTab; /* stack of inputs */ /* Node analysis stack only used for DOM building */ xmlNodePtr node; /* Current parsed Node */ int nodeNr; /* Depth of the parsing stack */ int nodeMax; /* Max depth of the parsing stack */ xmlNodePtr *nodeTab; /* array of nodes */ int record_info; /* Whether node info should be kept */ xmlParserNodeInfoSeq node_seq; /* info about each node parsed */ int errNo; /* error code */ int hasExternalSubset; /* reference and external subset */ int hasPErefs; /* the internal subset has PE refs */ int external; /* are we parsing an external entity */ int valid; /* is the document valid */ int validate; /* shall we try to validate ? */ xmlValidCtxt vctxt; /* The validity context */ xmlParserInputState instate; /* current type of input */ int token; /* next char look-ahead */ char *directory; /* the data directory */ /* Node name stack */ const xmlChar *name; /* Current parsed Node */ int nameNr; /* Depth of the parsing stack */ int nameMax; /* Max depth of the parsing stack */ const xmlChar * *nameTab; /* array of nodes */ long nbChars; /* number of xmlChar processed */ long checkIndex; /* used by progressive parsing lookup */ int keepBlanks; /* ugly but ... */ int disableSAX; /* SAX callbacks are disabled */ int inSubset; /* Parsing is in int 1/ext 2 subset */ const xmlChar * intSubName; /* name of subset */ xmlChar * extSubURI; /* URI of external subset */ xmlChar * extSubSystem; /* SYSTEM ID of external subset */ /* xml:space values */ int * space; /* Should the parser preserve spaces */ int spaceNr; /* Depth of the parsing stack */ int spaceMax; /* Max depth of the parsing stack */ int * spaceTab; /* array of space infos */ int depth; /* to prevent entity substitution loops */ xmlParserInputPtr entity; /* used to check entities boundaries */ int charset; /* encoding of the in-memory content actually an xmlCharEncoding */ int nodelen; /* Those two fields are there to */ int nodemem; /* Speed up large node parsing */ int pedantic; /* signal pedantic warnings */ void *_private; /* For user data, libxml won't touch it */ int loadsubset; /* should the external subset be loaded */ int linenumbers; /* set line number in element content */ void *catalogs; /* document's own catalog */ int recovery; /* run in recovery mode */ int progressive; /* is this a progressive parsing */ xmlDictPtr dict; /* dictionnary for the parser */ const xmlChar * *atts; /* array for the attributes callbacks */ int maxatts; /* the size of the array */ int docdict; /* use strings from dict to build tree */ /* * pre-interned strings */ const xmlChar *str_xml; const xmlChar *str_xmlns; const xmlChar *str_xml_ns; /* * Everything below is used only by the new SAX mode */ int sax2; /* operating in the new SAX mode */ int nsNr; /* the number of inherited namespaces */ int nsMax; /* the size of the arrays */ const xmlChar * *nsTab; /* the array of prefix/namespace name */ int *attallocs; /* which attribute were allocated */ void * *pushTab; /* array of data for push */ xmlHashTablePtr attsDefault; /* defaulted attributes if any */ xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */ int nsWellFormed; /* is the document XML Nanespace okay */ int options; /* Extra options */ /* * Those fields are needed only for treaming parsing so far */ int dictNames; /* Use dictionary names for the tree */ int freeElemsNr; /* number of freed element nodes */ xmlNodePtr freeElems; /* List of freed element nodes */ int freeAttrsNr; /* number of freed attributes nodes */ xmlAttrPtr freeAttrs; /* List of freed attributes nodes */ /* * the complete error informations for the last error. */ xmlError lastError; xmlParserMode parseMode; /* the parser mode */ unsigned long nbentities; /* number of entities references */ unsigned long sizeentities; /* size of parsed entities */ /* for use by HTML non-recursive parser */ xmlParserNodeInfo *nodeInfo; /* Current NodeInfo */ int nodeInfoNr; /* Depth of the parsing stack */ int nodeInfoMax; /* Max depth of the parsing stack */ xmlParserNodeInfo *nodeInfoTab; /* array of nodeInfos */ int input_id; /* we need to label inputs */ unsigned long sizeentcopy; /* volume of entity copy */ }; /** * xmlSAXLocator: * * A SAX Locator. */ struct _xmlSAXLocator { const xmlChar *(*getPublicId)(void *ctx); const xmlChar *(*getSystemId)(void *ctx); int (*getLineNumber)(void *ctx); int (*getColumnNumber)(void *ctx); }; /** * xmlSAXHandler: * * A SAX handler is bunch of callbacks called by the parser when processing * of the input generate data or structure informations. */ /** * resolveEntitySAXFunc: * @ctx: the user data (XML parser context) * @publicId: The public ID of the entity * @systemId: The system ID of the entity * * Callback: * The entity loader, to control the loading of external entities, * the application can either: * - override this resolveEntity() callback in the SAX block * - or better use the xmlSetExternalEntityLoader() function to * set up it's own entity resolution routine * * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. */ typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx, const xmlChar *publicId, const xmlChar *systemId); /** * internalSubsetSAXFunc: * @ctx: the user data (XML parser context) * @name: the root element name * @ExternalID: the external ID * @SystemID: the SYSTEM ID (e.g. filename or URL) * * Callback on internal subset declaration. */ typedef void (*internalSubsetSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); /** * externalSubsetSAXFunc: * @ctx: the user data (XML parser context) * @name: the root element name * @ExternalID: the external ID * @SystemID: the SYSTEM ID (e.g. filename or URL) * * Callback on external subset declaration. */ typedef void (*externalSubsetSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); /** * getEntitySAXFunc: * @ctx: the user data (XML parser context) * @name: The entity name * * Get an entity by name. * * Returns the xmlEntityPtr if found. */ typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx, const xmlChar *name); /** * getParameterEntitySAXFunc: * @ctx: the user data (XML parser context) * @name: The entity name * * Get a parameter entity by name. * * Returns the xmlEntityPtr if found. */ typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx, const xmlChar *name); /** * entityDeclSAXFunc: * @ctx: the user data (XML parser context) * @name: the entity name * @type: the entity type * @publicId: The public ID of the entity * @systemId: The system ID of the entity * @content: the entity value (without processing). * * An entity definition has been parsed. */ typedef void (*entityDeclSAXFunc) (void *ctx, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content); /** * notationDeclSAXFunc: * @ctx: the user data (XML parser context) * @name: The name of the notation * @publicId: The public ID of the entity * @systemId: The system ID of the entity * * What to do when a notation declaration has been parsed. */ typedef void (*notationDeclSAXFunc)(void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId); /** * attributeDeclSAXFunc: * @ctx: the user data (XML parser context) * @elem: the name of the element * @fullname: the attribute name * @type: the attribute type * @def: the type of default value * @defaultValue: the attribute default value * @tree: the tree of enumerated value set * * An attribute definition has been parsed. */ typedef void (*attributeDeclSAXFunc)(void *ctx, const xmlChar *elem, const xmlChar *fullname, int type, int def, const xmlChar *defaultValue, xmlEnumerationPtr tree); /** * elementDeclSAXFunc: * @ctx: the user data (XML parser context) * @name: the element name * @type: the element type * @content: the element value tree * * An element definition has been parsed. */ typedef void (*elementDeclSAXFunc)(void *ctx, const xmlChar *name, int type, xmlElementContentPtr content); /** * unparsedEntityDeclSAXFunc: * @ctx: the user data (XML parser context) * @name: The name of the entity * @publicId: The public ID of the entity * @systemId: The system ID of the entity * @notationName: the name of the notation * * What to do when an unparsed entity declaration is parsed. */ typedef void (*unparsedEntityDeclSAXFunc)(void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName); /** * setDocumentLocatorSAXFunc: * @ctx: the user data (XML parser context) * @loc: A SAX Locator * * Receive the document locator at startup, actually xmlDefaultSAXLocator. * Everything is available on the context, so this is useless in our case. */ typedef void (*setDocumentLocatorSAXFunc) (void *ctx, xmlSAXLocatorPtr loc); /** * startDocumentSAXFunc: * @ctx: the user data (XML parser context) * * Called when the document start being processed. */ typedef void (*startDocumentSAXFunc) (void *ctx); /** * endDocumentSAXFunc: * @ctx: the user data (XML parser context) * * Called when the document end has been detected. */ typedef void (*endDocumentSAXFunc) (void *ctx); /** * startElementSAXFunc: * @ctx: the user data (XML parser context) * @name: The element name, including namespace prefix * @atts: An array of name/value attributes pairs, NULL terminated * * Called when an opening tag has been processed. */ typedef void (*startElementSAXFunc) (void *ctx, const xmlChar *name, const xmlChar **atts); /** * endElementSAXFunc: * @ctx: the user data (XML parser context) * @name: The element name * * Called when the end of an element has been detected. */ typedef void (*endElementSAXFunc) (void *ctx, const xmlChar *name); /** * attributeSAXFunc: * @ctx: the user data (XML parser context) * @name: The attribute name, including namespace prefix * @value: The attribute value * * Handle an attribute that has been read by the parser. * The default handling is to convert the attribute into an * DOM subtree and past it in a new xmlAttr element added to * the element. */ typedef void (*attributeSAXFunc) (void *ctx, const xmlChar *name, const xmlChar *value); /** * referenceSAXFunc: * @ctx: the user data (XML parser context) * @name: The entity name * * Called when an entity reference is detected. */ typedef void (*referenceSAXFunc) (void *ctx, const xmlChar *name); /** * charactersSAXFunc: * @ctx: the user data (XML parser context) * @ch: a xmlChar string * @len: the number of xmlChar * * Receiving some chars from the parser. */ typedef void (*charactersSAXFunc) (void *ctx, const xmlChar *ch, int len); /** * ignorableWhitespaceSAXFunc: * @ctx: the user data (XML parser context) * @ch: a xmlChar string * @len: the number of xmlChar * * Receiving some ignorable whitespaces from the parser. * UNUSED: by default the DOM building will use characters. */ typedef void (*ignorableWhitespaceSAXFunc) (void *ctx, const xmlChar *ch, int len); /** * processingInstructionSAXFunc: * @ctx: the user data (XML parser context) * @target: the target name * @data: the PI data's * * A processing instruction has been parsed. */ typedef void (*processingInstructionSAXFunc) (void *ctx, const xmlChar *target, const xmlChar *data); /** * commentSAXFunc: * @ctx: the user data (XML parser context) * @value: the comment content * * A comment has been parsed. */ typedef void (*commentSAXFunc) (void *ctx, const xmlChar *value); /** * cdataBlockSAXFunc: * @ctx: the user data (XML parser context) * @value: The pcdata content * @len: the block length * * Called when a pcdata block has been parsed. */ typedef void (*cdataBlockSAXFunc) ( void *ctx, const xmlChar *value, int len); /** * warningSAXFunc: * @ctx: an XML parser context * @msg: the message to display/transmit * @...: extra parameters for the message display * * Display and format a warning messages, callback. */ typedef void (XMLCDECL *warningSAXFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); /** * errorSAXFunc: * @ctx: an XML parser context * @msg: the message to display/transmit * @...: extra parameters for the message display * * Display and format an error messages, callback. */ typedef void (XMLCDECL *errorSAXFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); /** * fatalErrorSAXFunc: * @ctx: an XML parser context * @msg: the message to display/transmit * @...: extra parameters for the message display * * Display and format fatal error messages, callback. * Note: so far fatalError() SAX callbacks are not used, error() * get all the callbacks for errors. */ typedef void (XMLCDECL *fatalErrorSAXFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); /** * isStandaloneSAXFunc: * @ctx: the user data (XML parser context) * * Is this document tagged standalone? * * Returns 1 if true */ typedef int (*isStandaloneSAXFunc) (void *ctx); /** * hasInternalSubsetSAXFunc: * @ctx: the user data (XML parser context) * * Does this document has an internal subset. * * Returns 1 if true */ typedef int (*hasInternalSubsetSAXFunc) (void *ctx); /** * hasExternalSubsetSAXFunc: * @ctx: the user data (XML parser context) * * Does this document has an external subset? * * Returns 1 if true */ typedef int (*hasExternalSubsetSAXFunc) (void *ctx); /************************************************************************ * * * The SAX version 2 API extensions * * * ************************************************************************/ /** * XML_SAX2_MAGIC: * * Special constant found in SAX2 blocks initialized fields */ #define XML_SAX2_MAGIC 0xDEEDBEAF /** * startElementNsSAX2Func: * @ctx: the user data (XML parser context) * @localname: the local name of the element * @prefix: the element namespace prefix if available * @URI: the element namespace name if available * @nb_namespaces: number of namespace definitions on that node * @namespaces: pointer to the array of prefix/URI pairs namespace definitions * @nb_attributes: the number of attributes on that node * @nb_defaulted: the number of defaulted attributes. The defaulted * ones are at the end of the array * @attributes: pointer to the array of (localname/prefix/URI/value/end) * attribute values. * * SAX2 callback when an element start has been detected by the parser. * It provides the namespace informations for the element, as well as * the new namespace declarations on the element. */ typedef void (*startElementNsSAX2Func) (void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, const xmlChar **attributes); /** * endElementNsSAX2Func: * @ctx: the user data (XML parser context) * @localname: the local name of the element * @prefix: the element namespace prefix if available * @URI: the element namespace name if available * * SAX2 callback when an element end has been detected by the parser. * It provides the namespace informations for the element. */ typedef void (*endElementNsSAX2Func) (void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI); struct _xmlSAXHandler { internalSubsetSAXFunc internalSubset; isStandaloneSAXFunc isStandalone; hasInternalSubsetSAXFunc hasInternalSubset; hasExternalSubsetSAXFunc hasExternalSubset; resolveEntitySAXFunc resolveEntity; getEntitySAXFunc getEntity; entityDeclSAXFunc entityDecl; notationDeclSAXFunc notationDecl; attributeDeclSAXFunc attributeDecl; elementDeclSAXFunc elementDecl; unparsedEntityDeclSAXFunc unparsedEntityDecl; setDocumentLocatorSAXFunc setDocumentLocator; startDocumentSAXFunc startDocument; endDocumentSAXFunc endDocument; startElementSAXFunc startElement; endElementSAXFunc endElement; referenceSAXFunc reference; charactersSAXFunc characters; ignorableWhitespaceSAXFunc ignorableWhitespace; processingInstructionSAXFunc processingInstruction; commentSAXFunc comment; warningSAXFunc warning; errorSAXFunc error; fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ getParameterEntitySAXFunc getParameterEntity; cdataBlockSAXFunc cdataBlock; externalSubsetSAXFunc externalSubset; unsigned int initialized; /* The following fields are extensions available only on version 2 */ void *_private; startElementNsSAX2Func startElementNs; endElementNsSAX2Func endElementNs; xmlStructuredErrorFunc serror; }; /* * SAX Version 1 */ typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1; typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr; struct _xmlSAXHandlerV1 { internalSubsetSAXFunc internalSubset; isStandaloneSAXFunc isStandalone; hasInternalSubsetSAXFunc hasInternalSubset; hasExternalSubsetSAXFunc hasExternalSubset; resolveEntitySAXFunc resolveEntity; getEntitySAXFunc getEntity; entityDeclSAXFunc entityDecl; notationDeclSAXFunc notationDecl; attributeDeclSAXFunc attributeDecl; elementDeclSAXFunc elementDecl; unparsedEntityDeclSAXFunc unparsedEntityDecl; setDocumentLocatorSAXFunc setDocumentLocator; startDocumentSAXFunc startDocument; endDocumentSAXFunc endDocument; startElementSAXFunc startElement; endElementSAXFunc endElement; referenceSAXFunc reference; charactersSAXFunc characters; ignorableWhitespaceSAXFunc ignorableWhitespace; processingInstructionSAXFunc processingInstruction; commentSAXFunc comment; warningSAXFunc warning; errorSAXFunc error; fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ getParameterEntitySAXFunc getParameterEntity; cdataBlockSAXFunc cdataBlock; externalSubsetSAXFunc externalSubset; unsigned int initialized; }; /** * xmlExternalEntityLoader: * @URL: The System ID of the resource requested * @ID: The Public ID of the resource requested * @context: the XML parser context * * External entity loaders types. * * Returns the entity input parser. */ typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL, const char *ID, xmlParserCtxtPtr context); #ifdef __cplusplus } #endif #include <libxml/encoding.h> #include <libxml/xmlIO.h> #include <libxml/globals.h> #ifdef __cplusplus extern "C" { #endif /* * Init/Cleanup */ XMLPUBFUN void XMLCALL xmlInitParser (void); XMLPUBFUN void XMLCALL xmlCleanupParser (void); /* * Input functions */ XMLPUBFUN int XMLCALL xmlParserInputRead (xmlParserInputPtr in, int len); XMLPUBFUN int XMLCALL xmlParserInputGrow (xmlParserInputPtr in, int len); /* * Basic parsing Interfaces */ #ifdef LIBXML_SAX1_ENABLED XMLPUBFUN xmlDocPtr XMLCALL xmlParseDoc (const xmlChar *cur); XMLPUBFUN xmlDocPtr XMLCALL xmlParseFile (const char *filename); XMLPUBFUN xmlDocPtr XMLCALL xmlParseMemory (const char *buffer, int size); #endif /* LIBXML_SAX1_ENABLED */ XMLPUBFUN int XMLCALL xmlSubstituteEntitiesDefault(int val); XMLPUBFUN int XMLCALL xmlKeepBlanksDefault (int val); XMLPUBFUN void XMLCALL xmlStopParser (xmlParserCtxtPtr ctxt); XMLPUBFUN int XMLCALL xmlPedanticParserDefault(int val); XMLPUBFUN int XMLCALL xmlLineNumbersDefault (int val); #ifdef LIBXML_SAX1_ENABLED /* * Recovery mode */ XMLPUBFUN xmlDocPtr XMLCALL xmlRecoverDoc (const xmlChar *cur); XMLPUBFUN xmlDocPtr XMLCALL xmlRecoverMemory (const char *buffer, int size); XMLPUBFUN xmlDocPtr XMLCALL xmlRecoverFile (const char *filename); #endif /* LIBXML_SAX1_ENABLED */ /* * Less common routines and SAX interfaces */ XMLPUBFUN int XMLCALL xmlParseDocument (xmlParserCtxtPtr ctxt); XMLPUBFUN int XMLCALL xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt); #ifdef LIBXML_SAX1_ENABLED XMLPUBFUN int XMLCALL xmlSAXUserParseFile (xmlSAXHandlerPtr sax, void *user_data, const char *filename); XMLPUBFUN int XMLCALL xmlSAXUserParseMemory (xmlSAXHandlerPtr sax, void *user_data, const char *buffer, int size); XMLPUBFUN xmlDocPtr XMLCALL xmlSAXParseDoc (xmlSAXHandlerPtr sax, const xmlChar *cur, int recovery); XMLPUBFUN xmlDocPtr XMLCALL xmlSAXParseMemory (xmlSAXHandlerPtr sax, const char *buffer, int size, int recovery); XMLPUBFUN xmlDocPtr XMLCALL xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax, const char *buffer, int size, int recovery, void *data); XMLPUBFUN xmlDocPtr XMLCALL xmlSAXParseFile (xmlSAXHandlerPtr sax, const char *filename, int recovery); XMLPUBFUN xmlDocPtr XMLCALL xmlSAXParseFileWithData (xmlSAXHandlerPtr sax, const char *filename, int recovery, void *data); XMLPUBFUN xmlDocPtr XMLCALL xmlSAXParseEntity (xmlSAXHandlerPtr sax, const char *filename); XMLPUBFUN xmlDocPtr XMLCALL xmlParseEntity (const char *filename); #endif /* LIBXML_SAX1_ENABLED */ #ifdef LIBXML_VALID_ENABLED XMLPUBFUN xmlDtdPtr XMLCALL xmlSAXParseDTD (xmlSAXHandlerPtr sax, const xmlChar *ExternalID, const xmlChar *SystemID); XMLPUBFUN xmlDtdPtr XMLCALL xmlParseDTD (const xmlChar *ExternalID, const xmlChar *SystemID); XMLPUBFUN xmlDtdPtr XMLCALL xmlIOParseDTD (xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input, xmlCharEncoding enc); #endif /* LIBXML_VALID_ENABLE */ #ifdef LIBXML_SAX1_ENABLED XMLPUBFUN int XMLCALL xmlParseBalancedChunkMemory(xmlDocPtr doc, xmlSAXHandlerPtr sax, void *user_data, int depth, const xmlChar *string, xmlNodePtr *lst); #endif /* LIBXML_SAX1_ENABLED */ XMLPUBFUN xmlParserErrors XMLCALL xmlParseInNodeContext (xmlNodePtr node, const char *data, int datalen, int options, xmlNodePtr *lst); #ifdef LIBXML_SAX1_ENABLED XMLPUBFUN int XMLCALL xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax, void *user_data, int depth, const xmlChar *string, xmlNodePtr *lst, int recover); XMLPUBFUN int XMLCALL xmlParseExternalEntity (xmlDocPtr doc, xmlSAXHandlerPtr sax, void *user_data, int depth, const xmlChar *URL, const xmlChar *ID, xmlNodePtr *lst); #endif /* LIBXML_SAX1_ENABLED */ XMLPUBFUN int XMLCALL xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL, const xmlChar *ID, xmlNodePtr *lst); /* * Parser contexts handling. */ XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlNewParserCtxt (void); XMLPUBFUN int XMLCALL xmlInitParserCtxt (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlClearParserCtxt (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlFreeParserCtxt (xmlParserCtxtPtr ctxt); #ifdef LIBXML_SAX1_ENABLED XMLPUBFUN void XMLCALL xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt, const xmlChar* buffer, const char *filename); #endif /* LIBXML_SAX1_ENABLED */ XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlCreateDocParserCtxt (const xmlChar *cur); #ifdef LIBXML_LEGACY_ENABLED /* * Reading/setting optional parsing features. */ XMLPUBFUN int XMLCALL xmlGetFeaturesList (int *len, const char **result); XMLPUBFUN int XMLCALL xmlGetFeature (xmlParserCtxtPtr ctxt, const char *name, void *result); XMLPUBFUN int XMLCALL xmlSetFeature (xmlParserCtxtPtr ctxt, const char *name, void *value); #endif /* LIBXML_LEGACY_ENABLED */ #ifdef LIBXML_PUSH_ENABLED /* * Interfaces for the Push mode. */ XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data, const char *chunk, int size, const char *filename); XMLPUBFUN int XMLCALL xmlParseChunk (xmlParserCtxtPtr ctxt, const char *chunk, int size, int terminate); #endif /* LIBXML_PUSH_ENABLED */ /* * Special I/O mode. */ XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax, void *user_data, xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, xmlCharEncoding enc); XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewIOInputStream (xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input, xmlCharEncoding enc); /* * Node infos. */ XMLPUBFUN const xmlParserNodeInfo* XMLCALL xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt, const xmlNodePtr node); XMLPUBFUN void XMLCALL xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); XMLPUBFUN void XMLCALL xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); XMLPUBFUN unsigned long XMLCALL xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq, const xmlNodePtr node); XMLPUBFUN void XMLCALL xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt, const xmlParserNodeInfoPtr info); /* * External entities handling actually implemented in xmlIO. */ XMLPUBFUN void XMLCALL xmlSetExternalEntityLoader(xmlExternalEntityLoader f); XMLPUBFUN xmlExternalEntityLoader XMLCALL xmlGetExternalEntityLoader(void); XMLPUBFUN xmlParserInputPtr XMLCALL xmlLoadExternalEntity (const char *URL, const char *ID, xmlParserCtxtPtr ctxt); /* * Index lookup, actually implemented in the encoding module */ XMLPUBFUN long XMLCALL xmlByteConsumed (xmlParserCtxtPtr ctxt); /* * New set of simpler/more flexible APIs */ /** * xmlParserOption: * * This is the set of XML parser options that can be passed down * to the xmlReadDoc() and similar calls. */ typedef enum { XML_PARSE_RECOVER = 1<<0, /* recover on errors */ XML_PARSE_NOENT = 1<<1, /* substitute entities */ XML_PARSE_DTDLOAD = 1<<2, /* load the external subset */ XML_PARSE_DTDATTR = 1<<3, /* default DTD attributes */ XML_PARSE_DTDVALID = 1<<4, /* validate with the DTD */ XML_PARSE_NOERROR = 1<<5, /* suppress error reports */ XML_PARSE_NOWARNING = 1<<6, /* suppress warning reports */ XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ XML_PARSE_SAX1 = 1<<9, /* use the SAX1 interface internally */ XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitition */ XML_PARSE_NONET = 1<<11,/* Forbid network access */ XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionnary */ XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */ XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */ XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */ XML_PARSE_COMPACT = 1<<16,/* compact small text nodes; no modification of the tree allowed afterwards (will possibly crash if you try to modify the tree) */ XML_PARSE_OLD10 = 1<<17,/* parse using XML-1.0 before update 5 */ XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */ XML_PARSE_HUGE = 1<<19,/* relax any hardcoded limit from the parser */ XML_PARSE_OLDSAX = 1<<20,/* parse using SAX2 interface before 2.7.0 */ XML_PARSE_IGNORE_ENC= 1<<21,/* ignore internal document encoding hint */ XML_PARSE_BIG_LINES = 1<<22 /* Store big lines numbers in text PSVI field */ } xmlParserOption; XMLPUBFUN void XMLCALL xmlCtxtReset (xmlParserCtxtPtr ctxt); XMLPUBFUN int XMLCALL xmlCtxtResetPush (xmlParserCtxtPtr ctxt, const char *chunk, int size, const char *filename, const char *encoding); XMLPUBFUN int XMLCALL xmlCtxtUseOptions (xmlParserCtxtPtr ctxt, int options); XMLPUBFUN xmlDocPtr XMLCALL xmlReadDoc (const xmlChar *cur, const char *URL, const char *encoding, int options); XMLPUBFUN xmlDocPtr XMLCALL xmlReadFile (const char *URL, const char *encoding, int options); XMLPUBFUN xmlDocPtr XMLCALL xmlReadMemory (const char *buffer, int size, const char *URL, const char *encoding, int options); XMLPUBFUN xmlDocPtr XMLCALL xmlReadFd (int fd, const char *URL, const char *encoding, int options); XMLPUBFUN xmlDocPtr XMLCALL xmlReadIO (xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options); XMLPUBFUN xmlDocPtr XMLCALL xmlCtxtReadDoc (xmlParserCtxtPtr ctxt, const xmlChar *cur, const char *URL, const char *encoding, int options); XMLPUBFUN xmlDocPtr XMLCALL xmlCtxtReadFile (xmlParserCtxtPtr ctxt, const char *filename, const char *encoding, int options); XMLPUBFUN xmlDocPtr XMLCALL xmlCtxtReadMemory (xmlParserCtxtPtr ctxt, const char *buffer, int size, const char *URL, const char *encoding, int options); XMLPUBFUN xmlDocPtr XMLCALL xmlCtxtReadFd (xmlParserCtxtPtr ctxt, int fd, const char *URL, const char *encoding, int options); XMLPUBFUN xmlDocPtr XMLCALL xmlCtxtReadIO (xmlParserCtxtPtr ctxt, xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options); /* * Library wide options */ /** * xmlFeature: * * Used to examine the existance of features that can be enabled * or disabled at compile-time. * They used to be called XML_FEATURE_xxx but this clashed with Expat */ typedef enum { XML_WITH_THREAD = 1, XML_WITH_TREE = 2, XML_WITH_OUTPUT = 3, XML_WITH_PUSH = 4, XML_WITH_READER = 5, XML_WITH_PATTERN = 6, XML_WITH_WRITER = 7, XML_WITH_SAX1 = 8, XML_WITH_FTP = 9, XML_WITH_HTTP = 10, XML_WITH_VALID = 11, XML_WITH_HTML = 12, XML_WITH_LEGACY = 13, XML_WITH_C14N = 14, XML_WITH_CATALOG = 15, XML_WITH_XPATH = 16, XML_WITH_XPTR = 17, XML_WITH_XINCLUDE = 18, XML_WITH_ICONV = 19, XML_WITH_ISO8859X = 20, XML_WITH_UNICODE = 21, XML_WITH_REGEXP = 22, XML_WITH_AUTOMATA = 23, XML_WITH_EXPR = 24, XML_WITH_SCHEMAS = 25, XML_WITH_SCHEMATRON = 26, XML_WITH_MODULES = 27, XML_WITH_DEBUG = 28, XML_WITH_DEBUG_MEM = 29, XML_WITH_DEBUG_RUN = 30, XML_WITH_ZLIB = 31, XML_WITH_ICU = 32, XML_WITH_LZMA = 33, XML_WITH_NONE = 99999 /* just to be sure of allocation size */ } xmlFeature; XMLPUBFUN int XMLCALL xmlHasFeature (xmlFeature feature); #ifdef __cplusplus } #endif #endif /* __XML_PARSER_H__ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/SAX.h��������������������������������������������������������������������������������0000644�����������������00000010365�14763166030�0010223 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: Old SAX version 1 handler, deprecated * Description: DEPRECATED set of SAX version 1 interfaces used to * build the DOM tree. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_SAX_H__ #define __XML_SAX_H__ #include <stdio.h> #include <stdlib.h> #include <libxml/xmlversion.h> #include <libxml/parser.h> #include <libxml/xlink.h> #ifdef LIBXML_LEGACY_ENABLED #ifdef __cplusplus extern "C" { #endif XMLPUBFUN const xmlChar * XMLCALL getPublicId (void *ctx); XMLPUBFUN const xmlChar * XMLCALL getSystemId (void *ctx); XMLPUBFUN void XMLCALL setDocumentLocator (void *ctx, xmlSAXLocatorPtr loc); XMLPUBFUN int XMLCALL getLineNumber (void *ctx); XMLPUBFUN int XMLCALL getColumnNumber (void *ctx); XMLPUBFUN int XMLCALL isStandalone (void *ctx); XMLPUBFUN int XMLCALL hasInternalSubset (void *ctx); XMLPUBFUN int XMLCALL hasExternalSubset (void *ctx); XMLPUBFUN void XMLCALL internalSubset (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); XMLPUBFUN void XMLCALL externalSubset (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); XMLPUBFUN xmlEntityPtr XMLCALL getEntity (void *ctx, const xmlChar *name); XMLPUBFUN xmlEntityPtr XMLCALL getParameterEntity (void *ctx, const xmlChar *name); XMLPUBFUN xmlParserInputPtr XMLCALL resolveEntity (void *ctx, const xmlChar *publicId, const xmlChar *systemId); XMLPUBFUN void XMLCALL entityDecl (void *ctx, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content); XMLPUBFUN void XMLCALL attributeDecl (void *ctx, const xmlChar *elem, const xmlChar *fullname, int type, int def, const xmlChar *defaultValue, xmlEnumerationPtr tree); XMLPUBFUN void XMLCALL elementDecl (void *ctx, const xmlChar *name, int type, xmlElementContentPtr content); XMLPUBFUN void XMLCALL notationDecl (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId); XMLPUBFUN void XMLCALL unparsedEntityDecl (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName); XMLPUBFUN void XMLCALL startDocument (void *ctx); XMLPUBFUN void XMLCALL endDocument (void *ctx); XMLPUBFUN void XMLCALL attribute (void *ctx, const xmlChar *fullname, const xmlChar *value); XMLPUBFUN void XMLCALL startElement (void *ctx, const xmlChar *fullname, const xmlChar **atts); XMLPUBFUN void XMLCALL endElement (void *ctx, const xmlChar *name); XMLPUBFUN void XMLCALL reference (void *ctx, const xmlChar *name); XMLPUBFUN void XMLCALL characters (void *ctx, const xmlChar *ch, int len); XMLPUBFUN void XMLCALL ignorableWhitespace (void *ctx, const xmlChar *ch, int len); XMLPUBFUN void XMLCALL processingInstruction (void *ctx, const xmlChar *target, const xmlChar *data); XMLPUBFUN void XMLCALL globalNamespace (void *ctx, const xmlChar *href, const xmlChar *prefix); XMLPUBFUN void XMLCALL setNamespace (void *ctx, const xmlChar *name); XMLPUBFUN xmlNsPtr XMLCALL getNamespace (void *ctx); XMLPUBFUN int XMLCALL checkNamespace (void *ctx, xmlChar *nameSpace); XMLPUBFUN void XMLCALL namespaceDecl (void *ctx, const xmlChar *href, const xmlChar *prefix); XMLPUBFUN void XMLCALL comment (void *ctx, const xmlChar *value); XMLPUBFUN void XMLCALL cdataBlock (void *ctx, const xmlChar *value, int len); #ifdef LIBXML_SAX1_ENABLED XMLPUBFUN void XMLCALL initxmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr, int warning); #ifdef LIBXML_HTML_ENABLED XMLPUBFUN void XMLCALL inithtmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); #endif #ifdef LIBXML_DOCB_ENABLED XMLPUBFUN void XMLCALL initdocbDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); #endif #endif /* LIBXML_SAX1_ENABLED */ #ifdef __cplusplus } #endif #endif /* LIBXML_LEGACY_ENABLED */ #endif /* __XML_SAX_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/tree.h�������������������������������������������������������������������������������0000644�����������������00000112032�14763166030�0010521 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: interfaces for tree manipulation * Description: this module describes the structures found in an tree resulting * from an XML or HTML parsing, as well as the API provided for * various processing on that tree * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_TREE_H__ #define __XML_TREE_H__ #include <stdio.h> #include <limits.h> #include <libxml/xmlversion.h> #include <libxml/xmlstring.h> #ifdef __cplusplus extern "C" { #endif /* * Some of the basic types pointer to structures: */ /* xmlIO.h */ typedef struct _xmlParserInputBuffer xmlParserInputBuffer; typedef xmlParserInputBuffer *xmlParserInputBufferPtr; typedef struct _xmlOutputBuffer xmlOutputBuffer; typedef xmlOutputBuffer *xmlOutputBufferPtr; /* parser.h */ typedef struct _xmlParserInput xmlParserInput; typedef xmlParserInput *xmlParserInputPtr; typedef struct _xmlParserCtxt xmlParserCtxt; typedef xmlParserCtxt *xmlParserCtxtPtr; typedef struct _xmlSAXLocator xmlSAXLocator; typedef xmlSAXLocator *xmlSAXLocatorPtr; typedef struct _xmlSAXHandler xmlSAXHandler; typedef xmlSAXHandler *xmlSAXHandlerPtr; /* entities.h */ typedef struct _xmlEntity xmlEntity; typedef xmlEntity *xmlEntityPtr; /** * BASE_BUFFER_SIZE: * * default buffer size 4000. */ #define BASE_BUFFER_SIZE 4096 /** * LIBXML_NAMESPACE_DICT: * * Defines experimental behaviour: * 1) xmlNs gets an additional field @context (a xmlDoc) * 2) when creating a tree, xmlNs->href is stored in the dict of xmlDoc. */ /* #define LIBXML_NAMESPACE_DICT */ /** * xmlBufferAllocationScheme: * * A buffer allocation scheme can be defined to either match exactly the * need or double it's allocated size each time it is found too small. */ typedef enum { XML_BUFFER_ALLOC_DOUBLEIT, /* double each time one need to grow */ XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */ XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */ XML_BUFFER_ALLOC_IO, /* special allocation scheme used for I/O */ XML_BUFFER_ALLOC_HYBRID, /* exact up to a threshold, and doubleit thereafter */ XML_BUFFER_ALLOC_BOUNDED /* limit the upper size of the buffer */ } xmlBufferAllocationScheme; /** * xmlBuffer: * * A buffer structure, this old construct is limited to 2GB and * is being deprecated, use API with xmlBuf instead */ typedef struct _xmlBuffer xmlBuffer; typedef xmlBuffer *xmlBufferPtr; struct _xmlBuffer { xmlChar *content; /* The buffer content UTF8 */ unsigned int use; /* The buffer size used */ unsigned int size; /* The buffer size */ xmlBufferAllocationScheme alloc; /* The realloc method */ xmlChar *contentIO; /* in IO mode we may have a different base */ }; /** * xmlBuf: * * A buffer structure, new one, the actual structure internals are not public */ typedef struct _xmlBuf xmlBuf; /** * xmlBufPtr: * * A pointer to a buffer structure, the actual structure internals are not * public */ typedef xmlBuf *xmlBufPtr; /* * A few public routines for xmlBuf. As those are expected to be used * mostly internally the bulk of the routines are internal in buf.h */ XMLPUBFUN xmlChar* XMLCALL xmlBufContent (const xmlBufPtr buf); XMLPUBFUN xmlChar* XMLCALL xmlBufEnd (const xmlBufPtr buf); XMLPUBFUN size_t XMLCALL xmlBufUse (const xmlBufPtr buf); XMLPUBFUN size_t XMLCALL xmlBufShrink (xmlBufPtr buf, size_t len); /* * LIBXML2_NEW_BUFFER: * * Macro used to express that the API use the new buffers for * xmlParserInputBuffer and xmlOutputBuffer. The change was * introduced in 2.9.0. */ #define LIBXML2_NEW_BUFFER /** * XML_XML_NAMESPACE: * * This is the namespace for the special xml: prefix predefined in the * XML Namespace specification. */ #define XML_XML_NAMESPACE \ (const xmlChar *) "http://www.w3.org/XML/1998/namespace" /** * XML_XML_ID: * * This is the name for the special xml:id attribute */ #define XML_XML_ID (const xmlChar *) "xml:id" /* * The different element types carried by an XML tree. * * NOTE: This is synchronized with DOM Level1 values * See http://www.w3.org/TR/REC-DOM-Level-1/ * * Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should * be deprecated to use an XML_DTD_NODE. */ typedef enum { XML_ELEMENT_NODE= 1, XML_ATTRIBUTE_NODE= 2, XML_TEXT_NODE= 3, XML_CDATA_SECTION_NODE= 4, XML_ENTITY_REF_NODE= 5, XML_ENTITY_NODE= 6, XML_PI_NODE= 7, XML_COMMENT_NODE= 8, XML_DOCUMENT_NODE= 9, XML_DOCUMENT_TYPE_NODE= 10, XML_DOCUMENT_FRAG_NODE= 11, XML_NOTATION_NODE= 12, XML_HTML_DOCUMENT_NODE= 13, XML_DTD_NODE= 14, XML_ELEMENT_DECL= 15, XML_ATTRIBUTE_DECL= 16, XML_ENTITY_DECL= 17, XML_NAMESPACE_DECL= 18, XML_XINCLUDE_START= 19, XML_XINCLUDE_END= 20 #ifdef LIBXML_DOCB_ENABLED ,XML_DOCB_DOCUMENT_NODE= 21 #endif } xmlElementType; /** * xmlNotation: * * A DTD Notation definition. */ typedef struct _xmlNotation xmlNotation; typedef xmlNotation *xmlNotationPtr; struct _xmlNotation { const xmlChar *name; /* Notation name */ const xmlChar *PublicID; /* Public identifier, if any */ const xmlChar *SystemID; /* System identifier, if any */ }; /** * xmlAttributeType: * * A DTD Attribute type definition. */ typedef enum { XML_ATTRIBUTE_CDATA = 1, XML_ATTRIBUTE_ID, XML_ATTRIBUTE_IDREF , XML_ATTRIBUTE_IDREFS, XML_ATTRIBUTE_ENTITY, XML_ATTRIBUTE_ENTITIES, XML_ATTRIBUTE_NMTOKEN, XML_ATTRIBUTE_NMTOKENS, XML_ATTRIBUTE_ENUMERATION, XML_ATTRIBUTE_NOTATION } xmlAttributeType; /** * xmlAttributeDefault: * * A DTD Attribute default definition. */ typedef enum { XML_ATTRIBUTE_NONE = 1, XML_ATTRIBUTE_REQUIRED, XML_ATTRIBUTE_IMPLIED, XML_ATTRIBUTE_FIXED } xmlAttributeDefault; /** * xmlEnumeration: * * List structure used when there is an enumeration in DTDs. */ typedef struct _xmlEnumeration xmlEnumeration; typedef xmlEnumeration *xmlEnumerationPtr; struct _xmlEnumeration { struct _xmlEnumeration *next; /* next one */ const xmlChar *name; /* Enumeration name */ }; /** * xmlAttribute: * * An Attribute declaration in a DTD. */ typedef struct _xmlAttribute xmlAttribute; typedef xmlAttribute *xmlAttributePtr; struct _xmlAttribute { void *_private; /* application data */ xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */ const xmlChar *name; /* Attribute name */ struct _xmlNode *children; /* NULL */ struct _xmlNode *last; /* NULL */ struct _xmlDtd *parent; /* -> DTD */ struct _xmlNode *next; /* next sibling link */ struct _xmlNode *prev; /* previous sibling link */ struct _xmlDoc *doc; /* the containing document */ struct _xmlAttribute *nexth; /* next in hash table */ xmlAttributeType atype; /* The attribute type */ xmlAttributeDefault def; /* the default */ const xmlChar *defaultValue; /* or the default value */ xmlEnumerationPtr tree; /* or the enumeration tree if any */ const xmlChar *prefix; /* the namespace prefix if any */ const xmlChar *elem; /* Element holding the attribute */ }; /** * xmlElementContentType: * * Possible definitions of element content types. */ typedef enum { XML_ELEMENT_CONTENT_PCDATA = 1, XML_ELEMENT_CONTENT_ELEMENT, XML_ELEMENT_CONTENT_SEQ, XML_ELEMENT_CONTENT_OR } xmlElementContentType; /** * xmlElementContentOccur: * * Possible definitions of element content occurrences. */ typedef enum { XML_ELEMENT_CONTENT_ONCE = 1, XML_ELEMENT_CONTENT_OPT, XML_ELEMENT_CONTENT_MULT, XML_ELEMENT_CONTENT_PLUS } xmlElementContentOccur; /** * xmlElementContent: * * An XML Element content as stored after parsing an element definition * in a DTD. */ typedef struct _xmlElementContent xmlElementContent; typedef xmlElementContent *xmlElementContentPtr; struct _xmlElementContent { xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */ xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */ const xmlChar *name; /* Element name */ struct _xmlElementContent *c1; /* first child */ struct _xmlElementContent *c2; /* second child */ struct _xmlElementContent *parent; /* parent */ const xmlChar *prefix; /* Namespace prefix */ }; /** * xmlElementTypeVal: * * The different possibilities for an element content type. */ typedef enum { XML_ELEMENT_TYPE_UNDEFINED = 0, XML_ELEMENT_TYPE_EMPTY = 1, XML_ELEMENT_TYPE_ANY, XML_ELEMENT_TYPE_MIXED, XML_ELEMENT_TYPE_ELEMENT } xmlElementTypeVal; #ifdef __cplusplus } #endif #include <libxml/xmlregexp.h> #ifdef __cplusplus extern "C" { #endif /** * xmlElement: * * An XML Element declaration from a DTD. */ typedef struct _xmlElement xmlElement; typedef xmlElement *xmlElementPtr; struct _xmlElement { void *_private; /* application data */ xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */ const xmlChar *name; /* Element name */ struct _xmlNode *children; /* NULL */ struct _xmlNode *last; /* NULL */ struct _xmlDtd *parent; /* -> DTD */ struct _xmlNode *next; /* next sibling link */ struct _xmlNode *prev; /* previous sibling link */ struct _xmlDoc *doc; /* the containing document */ xmlElementTypeVal etype; /* The type */ xmlElementContentPtr content; /* the allowed element content */ xmlAttributePtr attributes; /* List of the declared attributes */ const xmlChar *prefix; /* the namespace prefix if any */ #ifdef LIBXML_REGEXP_ENABLED xmlRegexpPtr contModel; /* the validating regexp */ #else void *contModel; #endif }; /** * XML_LOCAL_NAMESPACE: * * A namespace declaration node. */ #define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL typedef xmlElementType xmlNsType; /** * xmlNs: * * An XML namespace. * Note that prefix == NULL is valid, it defines the default namespace * within the subtree (until overridden). * * xmlNsType is unified with xmlElementType. */ typedef struct _xmlNs xmlNs; typedef xmlNs *xmlNsPtr; struct _xmlNs { struct _xmlNs *next; /* next Ns link for this node */ xmlNsType type; /* global or local */ const xmlChar *href; /* URL for the namespace */ const xmlChar *prefix; /* prefix for the namespace */ void *_private; /* application data */ struct _xmlDoc *context; /* normally an xmlDoc */ }; /** * xmlDtd: * * An XML DTD, as defined by <!DOCTYPE ... There is actually one for * the internal subset and for the external subset. */ typedef struct _xmlDtd xmlDtd; typedef xmlDtd *xmlDtdPtr; struct _xmlDtd { void *_private; /* application data */ xmlElementType type; /* XML_DTD_NODE, must be second ! */ const xmlChar *name; /* Name of the DTD */ struct _xmlNode *children; /* the value of the property link */ struct _xmlNode *last; /* last child link */ struct _xmlDoc *parent; /* child->parent link */ struct _xmlNode *next; /* next sibling link */ struct _xmlNode *prev; /* previous sibling link */ struct _xmlDoc *doc; /* the containing document */ /* End of common part */ void *notations; /* Hash table for notations if any */ void *elements; /* Hash table for elements if any */ void *attributes; /* Hash table for attributes if any */ void *entities; /* Hash table for entities if any */ const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */ const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */ void *pentities; /* Hash table for param entities if any */ }; /** * xmlAttr: * * An attribute on an XML node. */ typedef struct _xmlAttr xmlAttr; typedef xmlAttr *xmlAttrPtr; struct _xmlAttr { void *_private; /* application data */ xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */ const xmlChar *name; /* the name of the property */ struct _xmlNode *children; /* the value of the property */ struct _xmlNode *last; /* NULL */ struct _xmlNode *parent; /* child->parent link */ struct _xmlAttr *next; /* next sibling link */ struct _xmlAttr *prev; /* previous sibling link */ struct _xmlDoc *doc; /* the containing document */ xmlNs *ns; /* pointer to the associated namespace */ xmlAttributeType atype; /* the attribute type if validating */ void *psvi; /* for type/PSVI informations */ }; /** * xmlID: * * An XML ID instance. */ typedef struct _xmlID xmlID; typedef xmlID *xmlIDPtr; struct _xmlID { struct _xmlID *next; /* next ID */ const xmlChar *value; /* The ID name */ xmlAttrPtr attr; /* The attribute holding it */ const xmlChar *name; /* The attribute if attr is not available */ int lineno; /* The line number if attr is not available */ struct _xmlDoc *doc; /* The document holding the ID */ }; /** * xmlRef: * * An XML IDREF instance. */ typedef struct _xmlRef xmlRef; typedef xmlRef *xmlRefPtr; struct _xmlRef { struct _xmlRef *next; /* next Ref */ const xmlChar *value; /* The Ref name */ xmlAttrPtr attr; /* The attribute holding it */ const xmlChar *name; /* The attribute if attr is not available */ int lineno; /* The line number if attr is not available */ }; /** * xmlNode: * * A node in an XML tree. */ typedef struct _xmlNode xmlNode; typedef xmlNode *xmlNodePtr; struct _xmlNode { void *_private; /* application data */ xmlElementType type; /* type number, must be second ! */ const xmlChar *name; /* the name of the node, or the entity */ struct _xmlNode *children; /* parent->childs link */ struct _xmlNode *last; /* last child link */ struct _xmlNode *parent; /* child->parent link */ struct _xmlNode *next; /* next sibling link */ struct _xmlNode *prev; /* previous sibling link */ struct _xmlDoc *doc; /* the containing document */ /* End of common part */ xmlNs *ns; /* pointer to the associated namespace */ xmlChar *content; /* the content */ struct _xmlAttr *properties;/* properties list */ xmlNs *nsDef; /* namespace definitions on this node */ void *psvi; /* for type/PSVI informations */ unsigned short line; /* line number */ unsigned short extra; /* extra data for XPath/XSLT */ }; /** * XML_GET_CONTENT: * * Macro to extract the content pointer of a node. */ #define XML_GET_CONTENT(n) \ ((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content) /** * XML_GET_LINE: * * Macro to extract the line number of an element node. */ #define XML_GET_LINE(n) \ (xmlGetLineNo(n)) /** * xmlDocProperty * * Set of properties of the document as found by the parser * Some of them are linked to similary named xmlParserOption */ typedef enum { XML_DOC_WELLFORMED = 1<<0, /* document is XML well formed */ XML_DOC_NSVALID = 1<<1, /* document is Namespace valid */ XML_DOC_OLD10 = 1<<2, /* parsed with old XML-1.0 parser */ XML_DOC_DTDVALID = 1<<3, /* DTD validation was successful */ XML_DOC_XINCLUDE = 1<<4, /* XInclude substitution was done */ XML_DOC_USERBUILT = 1<<5, /* Document was built using the API and not by parsing an instance */ XML_DOC_INTERNAL = 1<<6, /* built for internal processing */ XML_DOC_HTML = 1<<7 /* parsed or built HTML document */ } xmlDocProperties; /** * xmlDoc: * * An XML document. */ typedef struct _xmlDoc xmlDoc; typedef xmlDoc *xmlDocPtr; struct _xmlDoc { void *_private; /* application data */ xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */ char *name; /* name/filename/URI of the document */ struct _xmlNode *children; /* the document tree */ struct _xmlNode *last; /* last child link */ struct _xmlNode *parent; /* child->parent link */ struct _xmlNode *next; /* next sibling link */ struct _xmlNode *prev; /* previous sibling link */ struct _xmlDoc *doc; /* autoreference to itself */ /* End of common part */ int compression;/* level of zlib compression */ int standalone; /* standalone document (no external refs) 1 if standalone="yes" 0 if standalone="no" -1 if there is no XML declaration -2 if there is an XML declaration, but no standalone attribute was specified */ struct _xmlDtd *intSubset; /* the document internal subset */ struct _xmlDtd *extSubset; /* the document external subset */ struct _xmlNs *oldNs; /* Global namespace, the old way */ const xmlChar *version; /* the XML version string */ const xmlChar *encoding; /* external initial encoding, if any */ void *ids; /* Hash table for ID attributes if any */ void *refs; /* Hash table for IDREFs attributes if any */ const xmlChar *URL; /* The URI for that document */ int charset; /* encoding of the in-memory content actually an xmlCharEncoding */ struct _xmlDict *dict; /* dict used to allocate names or NULL */ void *psvi; /* for type/PSVI informations */ int parseFlags; /* set of xmlParserOption used to parse the document */ int properties; /* set of xmlDocProperties for this document set at the end of parsing */ }; typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt; typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr; /** * xmlDOMWrapAcquireNsFunction: * @ctxt: a DOM wrapper context * @node: the context node (element or attribute) * @nsName: the requested namespace name * @nsPrefix: the requested namespace prefix * * A function called to acquire namespaces (xmlNs) from the wrapper. * * Returns an xmlNsPtr or NULL in case of an error. */ typedef xmlNsPtr (*xmlDOMWrapAcquireNsFunction) (xmlDOMWrapCtxtPtr ctxt, xmlNodePtr node, const xmlChar *nsName, const xmlChar *nsPrefix); /** * xmlDOMWrapCtxt: * * Context for DOM wrapper-operations. */ struct _xmlDOMWrapCtxt { void * _private; /* * The type of this context, just in case we need specialized * contexts in the future. */ int type; /* * Internal namespace map used for various operations. */ void * namespaceMap; /* * Use this one to acquire an xmlNsPtr intended for node->ns. * (Note that this is not intended for elem->nsDef). */ xmlDOMWrapAcquireNsFunction getNsForNodeFunc; }; /** * xmlChildrenNode: * * Macro for compatibility naming layer with libxml1. Maps * to "children." */ #ifndef xmlChildrenNode #define xmlChildrenNode children #endif /** * xmlRootNode: * * Macro for compatibility naming layer with libxml1. Maps * to "children". */ #ifndef xmlRootNode #define xmlRootNode children #endif /* * Variables. */ /* * Some helper functions */ #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) XMLPUBFUN int XMLCALL xmlValidateNCName (const xmlChar *value, int space); #endif #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) XMLPUBFUN int XMLCALL xmlValidateQName (const xmlChar *value, int space); XMLPUBFUN int XMLCALL xmlValidateName (const xmlChar *value, int space); XMLPUBFUN int XMLCALL xmlValidateNMToken (const xmlChar *value, int space); #endif XMLPUBFUN xmlChar * XMLCALL xmlBuildQName (const xmlChar *ncname, const xmlChar *prefix, xmlChar *memory, int len); XMLPUBFUN xmlChar * XMLCALL xmlSplitQName2 (const xmlChar *name, xmlChar **prefix); XMLPUBFUN const xmlChar * XMLCALL xmlSplitQName3 (const xmlChar *name, int *len); /* * Handling Buffers, the old ones see @xmlBuf for the new ones. */ XMLPUBFUN void XMLCALL xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme); XMLPUBFUN xmlBufferAllocationScheme XMLCALL xmlGetBufferAllocationScheme(void); XMLPUBFUN xmlBufferPtr XMLCALL xmlBufferCreate (void); XMLPUBFUN xmlBufferPtr XMLCALL xmlBufferCreateSize (size_t size); XMLPUBFUN xmlBufferPtr XMLCALL xmlBufferCreateStatic (void *mem, size_t size); XMLPUBFUN int XMLCALL xmlBufferResize (xmlBufferPtr buf, unsigned int size); XMLPUBFUN void XMLCALL xmlBufferFree (xmlBufferPtr buf); XMLPUBFUN int XMLCALL xmlBufferDump (FILE *file, xmlBufferPtr buf); XMLPUBFUN int XMLCALL xmlBufferAdd (xmlBufferPtr buf, const xmlChar *str, int len); XMLPUBFUN int XMLCALL xmlBufferAddHead (xmlBufferPtr buf, const xmlChar *str, int len); XMLPUBFUN int XMLCALL xmlBufferCat (xmlBufferPtr buf, const xmlChar *str); XMLPUBFUN int XMLCALL xmlBufferCCat (xmlBufferPtr buf, const char *str); XMLPUBFUN int XMLCALL xmlBufferShrink (xmlBufferPtr buf, unsigned int len); XMLPUBFUN int XMLCALL xmlBufferGrow (xmlBufferPtr buf, unsigned int len); XMLPUBFUN void XMLCALL xmlBufferEmpty (xmlBufferPtr buf); XMLPUBFUN const xmlChar* XMLCALL xmlBufferContent (const xmlBufferPtr buf); XMLPUBFUN xmlChar* XMLCALL xmlBufferDetach (xmlBufferPtr buf); XMLPUBFUN void XMLCALL xmlBufferSetAllocationScheme(xmlBufferPtr buf, xmlBufferAllocationScheme scheme); XMLPUBFUN int XMLCALL xmlBufferLength (const xmlBufferPtr buf); /* * Creating/freeing new structures. */ XMLPUBFUN xmlDtdPtr XMLCALL xmlCreateIntSubset (xmlDocPtr doc, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); XMLPUBFUN xmlDtdPtr XMLCALL xmlNewDtd (xmlDocPtr doc, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); XMLPUBFUN xmlDtdPtr XMLCALL xmlGetIntSubset (xmlDocPtr doc); XMLPUBFUN void XMLCALL xmlFreeDtd (xmlDtdPtr cur); #ifdef LIBXML_LEGACY_ENABLED XMLPUBFUN xmlNsPtr XMLCALL xmlNewGlobalNs (xmlDocPtr doc, const xmlChar *href, const xmlChar *prefix); #endif /* LIBXML_LEGACY_ENABLED */ XMLPUBFUN xmlNsPtr XMLCALL xmlNewNs (xmlNodePtr node, const xmlChar *href, const xmlChar *prefix); XMLPUBFUN void XMLCALL xmlFreeNs (xmlNsPtr cur); XMLPUBFUN void XMLCALL xmlFreeNsList (xmlNsPtr cur); XMLPUBFUN xmlDocPtr XMLCALL xmlNewDoc (const xmlChar *version); XMLPUBFUN void XMLCALL xmlFreeDoc (xmlDocPtr cur); XMLPUBFUN xmlAttrPtr XMLCALL xmlNewDocProp (xmlDocPtr doc, const xmlChar *name, const xmlChar *value); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ defined(LIBXML_SCHEMAS_ENABLED) XMLPUBFUN xmlAttrPtr XMLCALL xmlNewProp (xmlNodePtr node, const xmlChar *name, const xmlChar *value); #endif XMLPUBFUN xmlAttrPtr XMLCALL xmlNewNsProp (xmlNodePtr node, xmlNsPtr ns, const xmlChar *name, const xmlChar *value); XMLPUBFUN xmlAttrPtr XMLCALL xmlNewNsPropEatName (xmlNodePtr node, xmlNsPtr ns, xmlChar *name, const xmlChar *value); XMLPUBFUN void XMLCALL xmlFreePropList (xmlAttrPtr cur); XMLPUBFUN void XMLCALL xmlFreeProp (xmlAttrPtr cur); XMLPUBFUN xmlAttrPtr XMLCALL xmlCopyProp (xmlNodePtr target, xmlAttrPtr cur); XMLPUBFUN xmlAttrPtr XMLCALL xmlCopyPropList (xmlNodePtr target, xmlAttrPtr cur); #ifdef LIBXML_TREE_ENABLED XMLPUBFUN xmlDtdPtr XMLCALL xmlCopyDtd (xmlDtdPtr dtd); #endif /* LIBXML_TREE_ENABLED */ #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) XMLPUBFUN xmlDocPtr XMLCALL xmlCopyDoc (xmlDocPtr doc, int recursive); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ /* * Creating new nodes. */ XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocNode (xmlDocPtr doc, xmlNsPtr ns, const xmlChar *name, const xmlChar *content); XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocNodeEatName (xmlDocPtr doc, xmlNsPtr ns, xmlChar *name, const xmlChar *content); XMLPUBFUN xmlNodePtr XMLCALL xmlNewNode (xmlNsPtr ns, const xmlChar *name); XMLPUBFUN xmlNodePtr XMLCALL xmlNewNodeEatName (xmlNsPtr ns, xmlChar *name); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) XMLPUBFUN xmlNodePtr XMLCALL xmlNewChild (xmlNodePtr parent, xmlNsPtr ns, const xmlChar *name, const xmlChar *content); #endif XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocText (xmlDocPtr doc, const xmlChar *content); XMLPUBFUN xmlNodePtr XMLCALL xmlNewText (const xmlChar *content); XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocPI (xmlDocPtr doc, const xmlChar *name, const xmlChar *content); XMLPUBFUN xmlNodePtr XMLCALL xmlNewPI (const xmlChar *name, const xmlChar *content); XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocTextLen (xmlDocPtr doc, const xmlChar *content, int len); XMLPUBFUN xmlNodePtr XMLCALL xmlNewTextLen (const xmlChar *content, int len); XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocComment (xmlDocPtr doc, const xmlChar *content); XMLPUBFUN xmlNodePtr XMLCALL xmlNewComment (const xmlChar *content); XMLPUBFUN xmlNodePtr XMLCALL xmlNewCDataBlock (xmlDocPtr doc, const xmlChar *content, int len); XMLPUBFUN xmlNodePtr XMLCALL xmlNewCharRef (xmlDocPtr doc, const xmlChar *name); XMLPUBFUN xmlNodePtr XMLCALL xmlNewReference (xmlDocPtr doc, const xmlChar *name); XMLPUBFUN xmlNodePtr XMLCALL xmlCopyNode (const xmlNodePtr node, int recursive); XMLPUBFUN xmlNodePtr XMLCALL xmlDocCopyNode (const xmlNodePtr node, xmlDocPtr doc, int recursive); XMLPUBFUN xmlNodePtr XMLCALL xmlDocCopyNodeList (xmlDocPtr doc, const xmlNodePtr node); XMLPUBFUN xmlNodePtr XMLCALL xmlCopyNodeList (const xmlNodePtr node); #ifdef LIBXML_TREE_ENABLED XMLPUBFUN xmlNodePtr XMLCALL xmlNewTextChild (xmlNodePtr parent, xmlNsPtr ns, const xmlChar *name, const xmlChar *content); XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocRawNode (xmlDocPtr doc, xmlNsPtr ns, const xmlChar *name, const xmlChar *content); XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocFragment (xmlDocPtr doc); #endif /* LIBXML_TREE_ENABLED */ /* * Navigating. */ XMLPUBFUN long XMLCALL xmlGetLineNo (xmlNodePtr node); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) XMLPUBFUN xmlChar * XMLCALL xmlGetNodePath (xmlNodePtr node); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */ XMLPUBFUN xmlNodePtr XMLCALL xmlDocGetRootElement (xmlDocPtr doc); XMLPUBFUN xmlNodePtr XMLCALL xmlGetLastChild (xmlNodePtr parent); XMLPUBFUN int XMLCALL xmlNodeIsText (xmlNodePtr node); XMLPUBFUN int XMLCALL xmlIsBlankNode (xmlNodePtr node); /* * Changing the structure. */ #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) XMLPUBFUN xmlNodePtr XMLCALL xmlDocSetRootElement (xmlDocPtr doc, xmlNodePtr root); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ #ifdef LIBXML_TREE_ENABLED XMLPUBFUN void XMLCALL xmlNodeSetName (xmlNodePtr cur, const xmlChar *name); #endif /* LIBXML_TREE_ENABLED */ XMLPUBFUN xmlNodePtr XMLCALL xmlAddChild (xmlNodePtr parent, xmlNodePtr cur); XMLPUBFUN xmlNodePtr XMLCALL xmlAddChildList (xmlNodePtr parent, xmlNodePtr cur); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) XMLPUBFUN xmlNodePtr XMLCALL xmlReplaceNode (xmlNodePtr old, xmlNodePtr cur); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ defined(LIBXML_SCHEMAS_ENABLED) XMLPUBFUN xmlNodePtr XMLCALL xmlAddPrevSibling (xmlNodePtr cur, xmlNodePtr elem); #endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */ XMLPUBFUN xmlNodePtr XMLCALL xmlAddSibling (xmlNodePtr cur, xmlNodePtr elem); XMLPUBFUN xmlNodePtr XMLCALL xmlAddNextSibling (xmlNodePtr cur, xmlNodePtr elem); XMLPUBFUN void XMLCALL xmlUnlinkNode (xmlNodePtr cur); XMLPUBFUN xmlNodePtr XMLCALL xmlTextMerge (xmlNodePtr first, xmlNodePtr second); XMLPUBFUN int XMLCALL xmlTextConcat (xmlNodePtr node, const xmlChar *content, int len); XMLPUBFUN void XMLCALL xmlFreeNodeList (xmlNodePtr cur); XMLPUBFUN void XMLCALL xmlFreeNode (xmlNodePtr cur); XMLPUBFUN void XMLCALL xmlSetTreeDoc (xmlNodePtr tree, xmlDocPtr doc); XMLPUBFUN void XMLCALL xmlSetListDoc (xmlNodePtr list, xmlDocPtr doc); /* * Namespaces. */ XMLPUBFUN xmlNsPtr XMLCALL xmlSearchNs (xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace); XMLPUBFUN xmlNsPtr XMLCALL xmlSearchNsByHref (xmlDocPtr doc, xmlNodePtr node, const xmlChar *href); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) XMLPUBFUN xmlNsPtr * XMLCALL xmlGetNsList (xmlDocPtr doc, xmlNodePtr node); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */ XMLPUBFUN void XMLCALL xmlSetNs (xmlNodePtr node, xmlNsPtr ns); XMLPUBFUN xmlNsPtr XMLCALL xmlCopyNamespace (xmlNsPtr cur); XMLPUBFUN xmlNsPtr XMLCALL xmlCopyNamespaceList (xmlNsPtr cur); /* * Changing the content. */ #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) XMLPUBFUN xmlAttrPtr XMLCALL xmlSetProp (xmlNodePtr node, const xmlChar *name, const xmlChar *value); XMLPUBFUN xmlAttrPtr XMLCALL xmlSetNsProp (xmlNodePtr node, xmlNsPtr ns, const xmlChar *name, const xmlChar *value); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */ XMLPUBFUN xmlChar * XMLCALL xmlGetNoNsProp (xmlNodePtr node, const xmlChar *name); XMLPUBFUN xmlChar * XMLCALL xmlGetProp (xmlNodePtr node, const xmlChar *name); XMLPUBFUN xmlAttrPtr XMLCALL xmlHasProp (xmlNodePtr node, const xmlChar *name); XMLPUBFUN xmlAttrPtr XMLCALL xmlHasNsProp (xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace); XMLPUBFUN xmlChar * XMLCALL xmlGetNsProp (xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace); XMLPUBFUN xmlNodePtr XMLCALL xmlStringGetNodeList (xmlDocPtr doc, const xmlChar *value); XMLPUBFUN xmlNodePtr XMLCALL xmlStringLenGetNodeList (xmlDocPtr doc, const xmlChar *value, int len); XMLPUBFUN xmlChar * XMLCALL xmlNodeListGetString (xmlDocPtr doc, xmlNodePtr list, int inLine); #ifdef LIBXML_TREE_ENABLED XMLPUBFUN xmlChar * XMLCALL xmlNodeListGetRawString (xmlDocPtr doc, xmlNodePtr list, int inLine); #endif /* LIBXML_TREE_ENABLED */ XMLPUBFUN void XMLCALL xmlNodeSetContent (xmlNodePtr cur, const xmlChar *content); #ifdef LIBXML_TREE_ENABLED XMLPUBFUN void XMLCALL xmlNodeSetContentLen (xmlNodePtr cur, const xmlChar *content, int len); #endif /* LIBXML_TREE_ENABLED */ XMLPUBFUN void XMLCALL xmlNodeAddContent (xmlNodePtr cur, const xmlChar *content); XMLPUBFUN void XMLCALL xmlNodeAddContentLen (xmlNodePtr cur, const xmlChar *content, int len); XMLPUBFUN xmlChar * XMLCALL xmlNodeGetContent (xmlNodePtr cur); XMLPUBFUN int XMLCALL xmlNodeBufGetContent (xmlBufferPtr buffer, xmlNodePtr cur); XMLPUBFUN int XMLCALL xmlBufGetNodeContent (xmlBufPtr buf, xmlNodePtr cur); XMLPUBFUN xmlChar * XMLCALL xmlNodeGetLang (xmlNodePtr cur); XMLPUBFUN int XMLCALL xmlNodeGetSpacePreserve (xmlNodePtr cur); #ifdef LIBXML_TREE_ENABLED XMLPUBFUN void XMLCALL xmlNodeSetLang (xmlNodePtr cur, const xmlChar *lang); XMLPUBFUN void XMLCALL xmlNodeSetSpacePreserve (xmlNodePtr cur, int val); #endif /* LIBXML_TREE_ENABLED */ XMLPUBFUN xmlChar * XMLCALL xmlNodeGetBase (xmlDocPtr doc, xmlNodePtr cur); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) XMLPUBFUN void XMLCALL xmlNodeSetBase (xmlNodePtr cur, const xmlChar *uri); #endif /* * Removing content. */ XMLPUBFUN int XMLCALL xmlRemoveProp (xmlAttrPtr cur); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) XMLPUBFUN int XMLCALL xmlUnsetNsProp (xmlNodePtr node, xmlNsPtr ns, const xmlChar *name); XMLPUBFUN int XMLCALL xmlUnsetProp (xmlNodePtr node, const xmlChar *name); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ /* * Internal, don't use. */ XMLPUBFUN void XMLCALL xmlBufferWriteCHAR (xmlBufferPtr buf, const xmlChar *string); XMLPUBFUN void XMLCALL xmlBufferWriteChar (xmlBufferPtr buf, const char *string); XMLPUBFUN void XMLCALL xmlBufferWriteQuotedString(xmlBufferPtr buf, const xmlChar *string); #ifdef LIBXML_OUTPUT_ENABLED XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr attr, const xmlChar *string); #endif /* LIBXML_OUTPUT_ENABLED */ #ifdef LIBXML_TREE_ENABLED /* * Namespace handling. */ XMLPUBFUN int XMLCALL xmlReconciliateNs (xmlDocPtr doc, xmlNodePtr tree); #endif #ifdef LIBXML_OUTPUT_ENABLED /* * Saving. */ XMLPUBFUN void XMLCALL xmlDocDumpFormatMemory (xmlDocPtr cur, xmlChar **mem, int *size, int format); XMLPUBFUN void XMLCALL xmlDocDumpMemory (xmlDocPtr cur, xmlChar **mem, int *size); XMLPUBFUN void XMLCALL xmlDocDumpMemoryEnc (xmlDocPtr out_doc, xmlChar **doc_txt_ptr, int * doc_txt_len, const char *txt_encoding); XMLPUBFUN void XMLCALL xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, xmlChar **doc_txt_ptr, int * doc_txt_len, const char *txt_encoding, int format); XMLPUBFUN int XMLCALL xmlDocFormatDump (FILE *f, xmlDocPtr cur, int format); XMLPUBFUN int XMLCALL xmlDocDump (FILE *f, xmlDocPtr cur); XMLPUBFUN void XMLCALL xmlElemDump (FILE *f, xmlDocPtr doc, xmlNodePtr cur); XMLPUBFUN int XMLCALL xmlSaveFile (const char *filename, xmlDocPtr cur); XMLPUBFUN int XMLCALL xmlSaveFormatFile (const char *filename, xmlDocPtr cur, int format); XMLPUBFUN size_t XMLCALL xmlBufNodeDump (xmlBufPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, int format); XMLPUBFUN int XMLCALL xmlNodeDump (xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, int format); XMLPUBFUN int XMLCALL xmlSaveFileTo (xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding); XMLPUBFUN int XMLCALL xmlSaveFormatFileTo (xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding, int format); XMLPUBFUN void XMLCALL xmlNodeDumpOutput (xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, int format, const char *encoding); XMLPUBFUN int XMLCALL xmlSaveFormatFileEnc (const char *filename, xmlDocPtr cur, const char *encoding, int format); XMLPUBFUN int XMLCALL xmlSaveFileEnc (const char *filename, xmlDocPtr cur, const char *encoding); #endif /* LIBXML_OUTPUT_ENABLED */ /* * XHTML */ XMLPUBFUN int XMLCALL xmlIsXHTML (const xmlChar *systemID, const xmlChar *publicID); /* * Compression. */ XMLPUBFUN int XMLCALL xmlGetDocCompressMode (xmlDocPtr doc); XMLPUBFUN void XMLCALL xmlSetDocCompressMode (xmlDocPtr doc, int mode); XMLPUBFUN int XMLCALL xmlGetCompressMode (void); XMLPUBFUN void XMLCALL xmlSetCompressMode (int mode); /* * DOM-wrapper helper functions. */ XMLPUBFUN xmlDOMWrapCtxtPtr XMLCALL xmlDOMWrapNewCtxt (void); XMLPUBFUN void XMLCALL xmlDOMWrapFreeCtxt (xmlDOMWrapCtxtPtr ctxt); XMLPUBFUN int XMLCALL xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt, xmlNodePtr elem, int options); XMLPUBFUN int XMLCALL xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt, xmlDocPtr sourceDoc, xmlNodePtr node, xmlDocPtr destDoc, xmlNodePtr destParent, int options); XMLPUBFUN int XMLCALL xmlDOMWrapRemoveNode (xmlDOMWrapCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr node, int options); XMLPUBFUN int XMLCALL xmlDOMWrapCloneNode (xmlDOMWrapCtxtPtr ctxt, xmlDocPtr sourceDoc, xmlNodePtr node, xmlNodePtr *clonedNode, xmlDocPtr destDoc, xmlNodePtr destParent, int deep, int options); #ifdef LIBXML_TREE_ENABLED /* * 5 interfaces from DOM ElementTraversal, but different in entities * traversal. */ XMLPUBFUN unsigned long XMLCALL xmlChildElementCount (xmlNodePtr parent); XMLPUBFUN xmlNodePtr XMLCALL xmlNextElementSibling (xmlNodePtr node); XMLPUBFUN xmlNodePtr XMLCALL xmlFirstElementChild (xmlNodePtr parent); XMLPUBFUN xmlNodePtr XMLCALL xmlLastElementChild (xmlNodePtr parent); XMLPUBFUN xmlNodePtr XMLCALL xmlPreviousElementSibling (xmlNodePtr node); #endif #ifdef __cplusplus } #endif #ifndef __XML_PARSER_H__ #include <libxml/xmlmemory.h> #endif #endif /* __XML_TREE_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/c14n.h�������������������������������������������������������������������������������0000644�����������������00000006045�14763166030�0010335 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: Provide Canonical XML and Exclusive XML Canonicalization * Description: the c14n modules provides a * * "Canonical XML" implementation * http://www.w3.org/TR/xml-c14n * * and an * * "Exclusive XML Canonicalization" implementation * http://www.w3.org/TR/xml-exc-c14n * Copy: See Copyright for the status of this software. * * Author: Aleksey Sanin <aleksey@aleksey.com> */ #ifndef __XML_C14N_H__ #define __XML_C14N_H__ #ifdef LIBXML_C14N_ENABLED #ifdef LIBXML_OUTPUT_ENABLED #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include <libxml/xmlversion.h> #include <libxml/tree.h> #include <libxml/xpath.h> /* * XML Canonicazation * http://www.w3.org/TR/xml-c14n * * Exclusive XML Canonicazation * http://www.w3.org/TR/xml-exc-c14n * * Canonical form of an XML document could be created if and only if * a) default attributes (if any) are added to all nodes * b) all character and parsed entity references are resolved * In order to achive this in libxml2 the document MUST be loaded with * following global setings: * * xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; * xmlSubstituteEntitiesDefault(1); * * or corresponding parser context setting: * xmlParserCtxtPtr ctxt; * * ... * ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; * ctxt->replaceEntities = 1; * ... */ /* * xmlC14NMode: * * Predefined values for C14N modes * */ typedef enum { XML_C14N_1_0 = 0, /* Origianal C14N 1.0 spec */ XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */ XML_C14N_1_1 = 2 /* C14N 1.1 spec */ } xmlC14NMode; XMLPUBFUN int XMLCALL xmlC14NDocSaveTo (xmlDocPtr doc, xmlNodeSetPtr nodes, int mode, /* a xmlC14NMode */ xmlChar **inclusive_ns_prefixes, int with_comments, xmlOutputBufferPtr buf); XMLPUBFUN int XMLCALL xmlC14NDocDumpMemory (xmlDocPtr doc, xmlNodeSetPtr nodes, int mode, /* a xmlC14NMode */ xmlChar **inclusive_ns_prefixes, int with_comments, xmlChar **doc_txt_ptr); XMLPUBFUN int XMLCALL xmlC14NDocSave (xmlDocPtr doc, xmlNodeSetPtr nodes, int mode, /* a xmlC14NMode */ xmlChar **inclusive_ns_prefixes, int with_comments, const char* filename, int compression); /** * This is the core C14N function */ /** * xmlC14NIsVisibleCallback: * @user_data: user data * @node: the curent node * @parent: the parent node * * Signature for a C14N callback on visible nodes * * Returns 1 if the node should be included */ typedef int (*xmlC14NIsVisibleCallback) (void* user_data, xmlNodePtr node, xmlNodePtr parent); XMLPUBFUN int XMLCALL xmlC14NExecute (xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback, void* user_data, int mode, /* a xmlC14NMode */ xmlChar **inclusive_ns_prefixes, int with_comments, xmlOutputBufferPtr buf); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* LIBXML_OUTPUT_ENABLED */ #endif /* LIBXML_C14N_ENABLED */ #endif /* __XML_C14N_H__ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/entities.h���������������������������������������������������������������������������0000644�����������������00000011137�14763166030�0011412 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: interface for the XML entities handling * Description: this module provides some of the entity API needed * for the parser and applications. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_ENTITIES_H__ #define __XML_ENTITIES_H__ #include <libxml/xmlversion.h> #include <libxml/tree.h> #ifdef __cplusplus extern "C" { #endif /* * The different valid entity types. */ typedef enum { XML_INTERNAL_GENERAL_ENTITY = 1, XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2, XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3, XML_INTERNAL_PARAMETER_ENTITY = 4, XML_EXTERNAL_PARAMETER_ENTITY = 5, XML_INTERNAL_PREDEFINED_ENTITY = 6 } xmlEntityType; /* * An unit of storage for an entity, contains the string, the value * and the linkind data needed for the linking in the hash table. */ struct _xmlEntity { void *_private; /* application data */ xmlElementType type; /* XML_ENTITY_DECL, must be second ! */ const xmlChar *name; /* Entity name */ struct _xmlNode *children; /* First child link */ struct _xmlNode *last; /* Last child link */ struct _xmlDtd *parent; /* -> DTD */ struct _xmlNode *next; /* next sibling link */ struct _xmlNode *prev; /* previous sibling link */ struct _xmlDoc *doc; /* the containing document */ xmlChar *orig; /* content without ref substitution */ xmlChar *content; /* content or ndata if unparsed */ int length; /* the content length */ xmlEntityType etype; /* The entity type */ const xmlChar *ExternalID; /* External identifier for PUBLIC */ const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */ struct _xmlEntity *nexte; /* unused */ const xmlChar *URI; /* the full URI as computed */ int owner; /* does the entity own the childrens */ int checked; /* was the entity content checked */ /* this is also used to count entites * references done from that entity * and if it contains '<' */ }; /* * All entities are stored in an hash table. * There is 2 separate hash tables for global and parameter entities. */ typedef struct _xmlHashTable xmlEntitiesTable; typedef xmlEntitiesTable *xmlEntitiesTablePtr; /* * External functions: */ #ifdef LIBXML_LEGACY_ENABLED XMLPUBFUN void XMLCALL xmlInitializePredefinedEntities (void); #endif /* LIBXML_LEGACY_ENABLED */ XMLPUBFUN xmlEntityPtr XMLCALL xmlNewEntity (xmlDocPtr doc, const xmlChar *name, int type, const xmlChar *ExternalID, const xmlChar *SystemID, const xmlChar *content); XMLPUBFUN xmlEntityPtr XMLCALL xmlAddDocEntity (xmlDocPtr doc, const xmlChar *name, int type, const xmlChar *ExternalID, const xmlChar *SystemID, const xmlChar *content); XMLPUBFUN xmlEntityPtr XMLCALL xmlAddDtdEntity (xmlDocPtr doc, const xmlChar *name, int type, const xmlChar *ExternalID, const xmlChar *SystemID, const xmlChar *content); XMLPUBFUN xmlEntityPtr XMLCALL xmlGetPredefinedEntity (const xmlChar *name); XMLPUBFUN xmlEntityPtr XMLCALL xmlGetDocEntity (xmlDocPtr doc, const xmlChar *name); XMLPUBFUN xmlEntityPtr XMLCALL xmlGetDtdEntity (xmlDocPtr doc, const xmlChar *name); XMLPUBFUN xmlEntityPtr XMLCALL xmlGetParameterEntity (xmlDocPtr doc, const xmlChar *name); #ifdef LIBXML_LEGACY_ENABLED XMLPUBFUN const xmlChar * XMLCALL xmlEncodeEntities (xmlDocPtr doc, const xmlChar *input); #endif /* LIBXML_LEGACY_ENABLED */ XMLPUBFUN xmlChar * XMLCALL xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input); XMLPUBFUN xmlChar * XMLCALL xmlEncodeSpecialChars (xmlDocPtr doc, const xmlChar *input); XMLPUBFUN xmlEntitiesTablePtr XMLCALL xmlCreateEntitiesTable (void); #ifdef LIBXML_TREE_ENABLED XMLPUBFUN xmlEntitiesTablePtr XMLCALL xmlCopyEntitiesTable (xmlEntitiesTablePtr table); #endif /* LIBXML_TREE_ENABLED */ XMLPUBFUN void XMLCALL xmlFreeEntitiesTable (xmlEntitiesTablePtr table); #ifdef LIBXML_OUTPUT_ENABLED XMLPUBFUN void XMLCALL xmlDumpEntitiesTable (xmlBufferPtr buf, xmlEntitiesTablePtr table); XMLPUBFUN void XMLCALL xmlDumpEntityDecl (xmlBufferPtr buf, xmlEntityPtr ent); #endif /* LIBXML_OUTPUT_ENABLED */ #ifdef LIBXML_LEGACY_ENABLED XMLPUBFUN void XMLCALL xmlCleanupPredefinedEntities(void); #endif /* LIBXML_LEGACY_ENABLED */ #ifdef __cplusplus } #endif # endif /* __XML_ENTITIES_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/hash.h�������������������������������������������������������������������������������0000644�����������������00000014534�14763166030�0010515 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: Chained hash tables * Description: This module implements the hash table support used in * various places in the library. * * Copy: See Copyright for the status of this software. * * Author: Bjorn Reese <bjorn.reese@systematic.dk> */ #ifndef __XML_HASH_H__ #define __XML_HASH_H__ #ifdef __cplusplus extern "C" { #endif /* * The hash table. */ typedef struct _xmlHashTable xmlHashTable; typedef xmlHashTable *xmlHashTablePtr; #ifdef __cplusplus } #endif #include <libxml/xmlversion.h> #include <libxml/parser.h> #include <libxml/dict.h> #ifdef __cplusplus extern "C" { #endif /* * Recent version of gcc produce a warning when a function pointer is assigned * to an object pointer, or vice versa. The following macro is a dirty hack * to allow suppression of the warning. If your architecture has function * pointers which are a different size than a void pointer, there may be some * serious trouble within the library. */ /** * XML_CAST_FPTR: * @fptr: pointer to a function * * Macro to do a casting from an object pointer to a * function pointer without encountering a warning from * gcc * * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr)) * This macro violated ISO C aliasing rules (gcc4 on s390 broke) * so it is disabled now */ #define XML_CAST_FPTR(fptr) fptr /* * function types: */ /** * xmlHashDeallocator: * @payload: the data in the hash * @name: the name associated * * Callback to free data from a hash. */ typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name); /** * xmlHashCopier: * @payload: the data in the hash * @name: the name associated * * Callback to copy data from a hash. * * Returns a copy of the data or NULL in case of error. */ typedef void *(*xmlHashCopier)(void *payload, xmlChar *name); /** * xmlHashScanner: * @payload: the data in the hash * @data: extra scannner data * @name: the name associated * * Callback when scanning data in a hash with the simple scanner. */ typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name); /** * xmlHashScannerFull: * @payload: the data in the hash * @data: extra scannner data * @name: the name associated * @name2: the second name associated * @name3: the third name associated * * Callback when scanning data in a hash with the full scanner. */ typedef void (*xmlHashScannerFull)(void *payload, void *data, const xmlChar *name, const xmlChar *name2, const xmlChar *name3); /* * Constructor and destructor. */ XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreate (int size); XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreateDict(int size, xmlDictPtr dict); XMLPUBFUN void XMLCALL xmlHashFree (xmlHashTablePtr table, xmlHashDeallocator f); /* * Add a new entry to the hash table. */ XMLPUBFUN int XMLCALL xmlHashAddEntry (xmlHashTablePtr table, const xmlChar *name, void *userdata); XMLPUBFUN int XMLCALL xmlHashUpdateEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata, xmlHashDeallocator f); XMLPUBFUN int XMLCALL xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata); XMLPUBFUN int XMLCALL xmlHashUpdateEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata, xmlHashDeallocator f); XMLPUBFUN int XMLCALL xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, void *userdata); XMLPUBFUN int XMLCALL xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, void *userdata, xmlHashDeallocator f); /* * Remove an entry from the hash table. */ XMLPUBFUN int XMLCALL xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, xmlHashDeallocator f); XMLPUBFUN int XMLCALL xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, xmlHashDeallocator f); XMLPUBFUN int XMLCALL xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashDeallocator f); /* * Retrieve the userdata. */ XMLPUBFUN void * XMLCALL xmlHashLookup (xmlHashTablePtr table, const xmlChar *name); XMLPUBFUN void * XMLCALL xmlHashLookup2 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2); XMLPUBFUN void * XMLCALL xmlHashLookup3 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3); XMLPUBFUN void * XMLCALL xmlHashQLookup (xmlHashTablePtr table, const xmlChar *name, const xmlChar *prefix); XMLPUBFUN void * XMLCALL xmlHashQLookup2 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *prefix, const xmlChar *name2, const xmlChar *prefix2); XMLPUBFUN void * XMLCALL xmlHashQLookup3 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *prefix, const xmlChar *name2, const xmlChar *prefix2, const xmlChar *name3, const xmlChar *prefix3); /* * Helpers. */ XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCopy (xmlHashTablePtr table, xmlHashCopier f); XMLPUBFUN int XMLCALL xmlHashSize (xmlHashTablePtr table); XMLPUBFUN void XMLCALL xmlHashScan (xmlHashTablePtr table, xmlHashScanner f, void *data); XMLPUBFUN void XMLCALL xmlHashScan3 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashScanner f, void *data); XMLPUBFUN void XMLCALL xmlHashScanFull (xmlHashTablePtr table, xmlHashScannerFull f, void *data); XMLPUBFUN void XMLCALL xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashScannerFull f, void *data); #ifdef __cplusplus } #endif #endif /* ! __XML_HASH_H__ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/list.h�������������������������������������������������������������������������������0000644�����������������00000006446�14763166030�0010550 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: lists interfaces * Description: this module implement the list support used in * various place in the library. * * Copy: See Copyright for the status of this software. * * Author: Gary Pennington <Gary.Pennington@uk.sun.com> */ #ifndef __XML_LINK_INCLUDE__ #define __XML_LINK_INCLUDE__ #include <libxml/xmlversion.h> #ifdef __cplusplus extern "C" { #endif typedef struct _xmlLink xmlLink; typedef xmlLink *xmlLinkPtr; typedef struct _xmlList xmlList; typedef xmlList *xmlListPtr; /** * xmlListDeallocator: * @lk: the data to deallocate * * Callback function used to free data from a list. */ typedef void (*xmlListDeallocator) (xmlLinkPtr lk); /** * xmlListDataCompare: * @data0: the first data * @data1: the second data * * Callback function used to compare 2 data. * * Returns 0 is equality, -1 or 1 otherwise depending on the ordering. */ typedef int (*xmlListDataCompare) (const void *data0, const void *data1); /** * xmlListWalker: * @data: the data found in the list * @user: extra user provided data to the walker * * Callback function used when walking a list with xmlListWalk(). * * Returns 0 to stop walking the list, 1 otherwise. */ typedef int (*xmlListWalker) (const void *data, const void *user); /* Creation/Deletion */ XMLPUBFUN xmlListPtr XMLCALL xmlListCreate (xmlListDeallocator deallocator, xmlListDataCompare compare); XMLPUBFUN void XMLCALL xmlListDelete (xmlListPtr l); /* Basic Operators */ XMLPUBFUN void * XMLCALL xmlListSearch (xmlListPtr l, void *data); XMLPUBFUN void * XMLCALL xmlListReverseSearch (xmlListPtr l, void *data); XMLPUBFUN int XMLCALL xmlListInsert (xmlListPtr l, void *data) ; XMLPUBFUN int XMLCALL xmlListAppend (xmlListPtr l, void *data) ; XMLPUBFUN int XMLCALL xmlListRemoveFirst (xmlListPtr l, void *data); XMLPUBFUN int XMLCALL xmlListRemoveLast (xmlListPtr l, void *data); XMLPUBFUN int XMLCALL xmlListRemoveAll (xmlListPtr l, void *data); XMLPUBFUN void XMLCALL xmlListClear (xmlListPtr l); XMLPUBFUN int XMLCALL xmlListEmpty (xmlListPtr l); XMLPUBFUN xmlLinkPtr XMLCALL xmlListFront (xmlListPtr l); XMLPUBFUN xmlLinkPtr XMLCALL xmlListEnd (xmlListPtr l); XMLPUBFUN int XMLCALL xmlListSize (xmlListPtr l); XMLPUBFUN void XMLCALL xmlListPopFront (xmlListPtr l); XMLPUBFUN void XMLCALL xmlListPopBack (xmlListPtr l); XMLPUBFUN int XMLCALL xmlListPushFront (xmlListPtr l, void *data); XMLPUBFUN int XMLCALL xmlListPushBack (xmlListPtr l, void *data); /* Advanced Operators */ XMLPUBFUN void XMLCALL xmlListReverse (xmlListPtr l); XMLPUBFUN void XMLCALL xmlListSort (xmlListPtr l); XMLPUBFUN void XMLCALL xmlListWalk (xmlListPtr l, xmlListWalker walker, const void *user); XMLPUBFUN void XMLCALL xmlListReverseWalk (xmlListPtr l, xmlListWalker walker, const void *user); XMLPUBFUN void XMLCALL xmlListMerge (xmlListPtr l1, xmlListPtr l2); XMLPUBFUN xmlListPtr XMLCALL xmlListDup (const xmlListPtr old); XMLPUBFUN int XMLCALL xmlListCopy (xmlListPtr cur, const xmlListPtr old); /* Link operators */ XMLPUBFUN void * XMLCALL xmlLinkGetData (xmlLinkPtr lk); /* xmlListUnique() */ /* xmlListSwap */ #ifdef __cplusplus } #endif #endif /* __XML_LINK_INCLUDE__ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/chvalid.h����������������������������������������������������������������������������0000644�����������������00000012047�14763166030�0011201 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: Unicode character range checking * Description: this module exports interfaces for the character * range validation APIs * * This file is automatically generated from the cvs source * definition files using the genChRanges.py Python script * * Generation date: Mon Mar 27 11:09:48 2006 * Sources: chvalid.def * Author: William Brack <wbrack@mmm.com.hk> */ #ifndef __XML_CHVALID_H__ #define __XML_CHVALID_H__ #include <libxml/xmlversion.h> #include <libxml/xmlstring.h> #ifdef __cplusplus extern "C" { #endif /* * Define our typedefs and structures * */ typedef struct _xmlChSRange xmlChSRange; typedef xmlChSRange *xmlChSRangePtr; struct _xmlChSRange { unsigned short low; unsigned short high; }; typedef struct _xmlChLRange xmlChLRange; typedef xmlChLRange *xmlChLRangePtr; struct _xmlChLRange { unsigned int low; unsigned int high; }; typedef struct _xmlChRangeGroup xmlChRangeGroup; typedef xmlChRangeGroup *xmlChRangeGroupPtr; struct _xmlChRangeGroup { int nbShortRange; int nbLongRange; const xmlChSRange *shortRange; /* points to an array of ranges */ const xmlChLRange *longRange; }; /** * Range checking routine */ XMLPUBFUN int XMLCALL xmlCharInRange(unsigned int val, const xmlChRangeGroup *group); /** * xmlIsBaseChar_ch: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ ((0x61 <= (c)) && ((c) <= 0x7a)) || \ ((0xc0 <= (c)) && ((c) <= 0xd6)) || \ ((0xd8 <= (c)) && ((c) <= 0xf6)) || \ (0xf8 <= (c))) /** * xmlIsBaseCharQ: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsBaseCharQ(c) (((c) < 0x100) ? \ xmlIsBaseChar_ch((c)) : \ xmlCharInRange((c), &xmlIsBaseCharGroup)) XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup; /** * xmlIsBlank_ch: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsBlank_ch(c) (((c) == 0x20) || \ ((0x9 <= (c)) && ((c) <= 0xa)) || \ ((c) == 0xd)) /** * xmlIsBlankQ: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsBlankQ(c) (((c) < 0x100) ? \ xmlIsBlank_ch((c)) : 0) /** * xmlIsChar_ch: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \ ((c) == 0xd) || \ (0x20 <= (c))) /** * xmlIsCharQ: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsCharQ(c) (((c) < 0x100) ? \ xmlIsChar_ch((c)) :\ (((0x100 <= (c)) && ((c) <= 0xd7ff)) || \ ((0xe000 <= (c)) && ((c) <= 0xfffd)) || \ ((0x10000 <= (c)) && ((c) <= 0x10ffff)))) XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup; /** * xmlIsCombiningQ: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsCombiningQ(c) (((c) < 0x100) ? \ 0 : \ xmlCharInRange((c), &xmlIsCombiningGroup)) XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup; /** * xmlIsDigit_ch: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39))) /** * xmlIsDigitQ: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsDigitQ(c) (((c) < 0x100) ? \ xmlIsDigit_ch((c)) : \ xmlCharInRange((c), &xmlIsDigitGroup)) XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup; /** * xmlIsExtender_ch: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsExtender_ch(c) (((c) == 0xb7)) /** * xmlIsExtenderQ: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsExtenderQ(c) (((c) < 0x100) ? \ xmlIsExtender_ch((c)) : \ xmlCharInRange((c), &xmlIsExtenderGroup)) XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup; /** * xmlIsIdeographicQ: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsIdeographicQ(c) (((c) < 0x100) ? \ 0 :\ (((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \ ((c) == 0x3007) || \ ((0x3021 <= (c)) && ((c) <= 0x3029)))) XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup; XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256]; /** * xmlIsPubidChar_ch: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)]) /** * xmlIsPubidCharQ: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsPubidCharQ(c) (((c) < 0x100) ? \ xmlIsPubidChar_ch((c)) : 0) XMLPUBFUN int XMLCALL xmlIsBaseChar(unsigned int ch); XMLPUBFUN int XMLCALL xmlIsBlank(unsigned int ch); XMLPUBFUN int XMLCALL xmlIsChar(unsigned int ch); XMLPUBFUN int XMLCALL xmlIsCombining(unsigned int ch); XMLPUBFUN int XMLCALL xmlIsDigit(unsigned int ch); XMLPUBFUN int XMLCALL xmlIsExtender(unsigned int ch); XMLPUBFUN int XMLCALL xmlIsIdeographic(unsigned int ch); XMLPUBFUN int XMLCALL xmlIsPubidChar(unsigned int ch); #ifdef __cplusplus } #endif #endif /* __XML_CHVALID_H__ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/xmlerror.h���������������������������������������������������������������������������0000644�����������������00000107733�14763166030�0011450 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: error handling * Description: the API used to report errors * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #include <libxml/parser.h> #ifndef __XML_ERROR_H__ #define __XML_ERROR_H__ #ifdef __cplusplus extern "C" { #endif /** * xmlErrorLevel: * * Indicates the level of an error */ typedef enum { XML_ERR_NONE = 0, XML_ERR_WARNING = 1, /* A simple warning */ XML_ERR_ERROR = 2, /* A recoverable error */ XML_ERR_FATAL = 3 /* A fatal error */ } xmlErrorLevel; /** * xmlErrorDomain: * * Indicates where an error may have come from */ typedef enum { XML_FROM_NONE = 0, XML_FROM_PARSER, /* The XML parser */ XML_FROM_TREE, /* The tree module */ XML_FROM_NAMESPACE, /* The XML Namespace module */ XML_FROM_DTD, /* The XML DTD validation with parser context*/ XML_FROM_HTML, /* The HTML parser */ XML_FROM_MEMORY, /* The memory allocator */ XML_FROM_OUTPUT, /* The serialization code */ XML_FROM_IO, /* The Input/Output stack */ XML_FROM_FTP, /* The FTP module */ XML_FROM_HTTP, /* The HTTP module */ XML_FROM_XINCLUDE, /* The XInclude processing */ XML_FROM_XPATH, /* The XPath module */ XML_FROM_XPOINTER, /* The XPointer module */ XML_FROM_REGEXP, /* The regular expressions module */ XML_FROM_DATATYPE, /* The W3C XML Schemas Datatype module */ XML_FROM_SCHEMASP, /* The W3C XML Schemas parser module */ XML_FROM_SCHEMASV, /* The W3C XML Schemas validation module */ XML_FROM_RELAXNGP, /* The Relax-NG parser module */ XML_FROM_RELAXNGV, /* The Relax-NG validator module */ XML_FROM_CATALOG, /* The Catalog module */ XML_FROM_C14N, /* The Canonicalization module */ XML_FROM_XSLT, /* The XSLT engine from libxslt */ XML_FROM_VALID, /* The XML DTD validation with valid context */ XML_FROM_CHECK, /* The error checking module */ XML_FROM_WRITER, /* The xmlwriter module */ XML_FROM_MODULE, /* The dynamically loaded module module*/ XML_FROM_I18N, /* The module handling character conversion */ XML_FROM_SCHEMATRONV,/* The Schematron validator module */ XML_FROM_BUFFER, /* The buffers module */ XML_FROM_URI /* The URI module */ } xmlErrorDomain; /** * xmlError: * * An XML Error instance. */ typedef struct _xmlError xmlError; typedef xmlError *xmlErrorPtr; struct _xmlError { int domain; /* What part of the library raised this error */ int code; /* The error code, e.g. an xmlParserError */ char *message;/* human-readable informative error message */ xmlErrorLevel level;/* how consequent is the error */ char *file; /* the filename */ int line; /* the line number if available */ char *str1; /* extra string information */ char *str2; /* extra string information */ char *str3; /* extra string information */ int int1; /* extra number information */ int int2; /* column number of the error or 0 if N/A (todo: rename this field when we would break ABI) */ void *ctxt; /* the parser context if available */ void *node; /* the node in the tree */ }; /** * xmlParserError: * * This is an error that the XML (or HTML) parser can generate */ typedef enum { XML_ERR_OK = 0, XML_ERR_INTERNAL_ERROR, /* 1 */ XML_ERR_NO_MEMORY, /* 2 */ XML_ERR_DOCUMENT_START, /* 3 */ XML_ERR_DOCUMENT_EMPTY, /* 4 */ XML_ERR_DOCUMENT_END, /* 5 */ XML_ERR_INVALID_HEX_CHARREF, /* 6 */ XML_ERR_INVALID_DEC_CHARREF, /* 7 */ XML_ERR_INVALID_CHARREF, /* 8 */ XML_ERR_INVALID_CHAR, /* 9 */ XML_ERR_CHARREF_AT_EOF, /* 10 */ XML_ERR_CHARREF_IN_PROLOG, /* 11 */ XML_ERR_CHARREF_IN_EPILOG, /* 12 */ XML_ERR_CHARREF_IN_DTD, /* 13 */ XML_ERR_ENTITYREF_AT_EOF, /* 14 */ XML_ERR_ENTITYREF_IN_PROLOG, /* 15 */ XML_ERR_ENTITYREF_IN_EPILOG, /* 16 */ XML_ERR_ENTITYREF_IN_DTD, /* 17 */ XML_ERR_PEREF_AT_EOF, /* 18 */ XML_ERR_PEREF_IN_PROLOG, /* 19 */ XML_ERR_PEREF_IN_EPILOG, /* 20 */ XML_ERR_PEREF_IN_INT_SUBSET, /* 21 */ XML_ERR_ENTITYREF_NO_NAME, /* 22 */ XML_ERR_ENTITYREF_SEMICOL_MISSING, /* 23 */ XML_ERR_PEREF_NO_NAME, /* 24 */ XML_ERR_PEREF_SEMICOL_MISSING, /* 25 */ XML_ERR_UNDECLARED_ENTITY, /* 26 */ XML_WAR_UNDECLARED_ENTITY, /* 27 */ XML_ERR_UNPARSED_ENTITY, /* 28 */ XML_ERR_ENTITY_IS_EXTERNAL, /* 29 */ XML_ERR_ENTITY_IS_PARAMETER, /* 30 */ XML_ERR_UNKNOWN_ENCODING, /* 31 */ XML_ERR_UNSUPPORTED_ENCODING, /* 32 */ XML_ERR_STRING_NOT_STARTED, /* 33 */ XML_ERR_STRING_NOT_CLOSED, /* 34 */ XML_ERR_NS_DECL_ERROR, /* 35 */ XML_ERR_ENTITY_NOT_STARTED, /* 36 */ XML_ERR_ENTITY_NOT_FINISHED, /* 37 */ XML_ERR_LT_IN_ATTRIBUTE, /* 38 */ XML_ERR_ATTRIBUTE_NOT_STARTED, /* 39 */ XML_ERR_ATTRIBUTE_NOT_FINISHED, /* 40 */ XML_ERR_ATTRIBUTE_WITHOUT_VALUE, /* 41 */ XML_ERR_ATTRIBUTE_REDEFINED, /* 42 */ XML_ERR_LITERAL_NOT_STARTED, /* 43 */ XML_ERR_LITERAL_NOT_FINISHED, /* 44 */ XML_ERR_COMMENT_NOT_FINISHED, /* 45 */ XML_ERR_PI_NOT_STARTED, /* 46 */ XML_ERR_PI_NOT_FINISHED, /* 47 */ XML_ERR_NOTATION_NOT_STARTED, /* 48 */ XML_ERR_NOTATION_NOT_FINISHED, /* 49 */ XML_ERR_ATTLIST_NOT_STARTED, /* 50 */ XML_ERR_ATTLIST_NOT_FINISHED, /* 51 */ XML_ERR_MIXED_NOT_STARTED, /* 52 */ XML_ERR_MIXED_NOT_FINISHED, /* 53 */ XML_ERR_ELEMCONTENT_NOT_STARTED, /* 54 */ XML_ERR_ELEMCONTENT_NOT_FINISHED, /* 55 */ XML_ERR_XMLDECL_NOT_STARTED, /* 56 */ XML_ERR_XMLDECL_NOT_FINISHED, /* 57 */ XML_ERR_CONDSEC_NOT_STARTED, /* 58 */ XML_ERR_CONDSEC_NOT_FINISHED, /* 59 */ XML_ERR_EXT_SUBSET_NOT_FINISHED, /* 60 */ XML_ERR_DOCTYPE_NOT_FINISHED, /* 61 */ XML_ERR_MISPLACED_CDATA_END, /* 62 */ XML_ERR_CDATA_NOT_FINISHED, /* 63 */ XML_ERR_RESERVED_XML_NAME, /* 64 */ XML_ERR_SPACE_REQUIRED, /* 65 */ XML_ERR_SEPARATOR_REQUIRED, /* 66 */ XML_ERR_NMTOKEN_REQUIRED, /* 67 */ XML_ERR_NAME_REQUIRED, /* 68 */ XML_ERR_PCDATA_REQUIRED, /* 69 */ XML_ERR_URI_REQUIRED, /* 70 */ XML_ERR_PUBID_REQUIRED, /* 71 */ XML_ERR_LT_REQUIRED, /* 72 */ XML_ERR_GT_REQUIRED, /* 73 */ XML_ERR_LTSLASH_REQUIRED, /* 74 */ XML_ERR_EQUAL_REQUIRED, /* 75 */ XML_ERR_TAG_NAME_MISMATCH, /* 76 */ XML_ERR_TAG_NOT_FINISHED, /* 77 */ XML_ERR_STANDALONE_VALUE, /* 78 */ XML_ERR_ENCODING_NAME, /* 79 */ XML_ERR_HYPHEN_IN_COMMENT, /* 80 */ XML_ERR_INVALID_ENCODING, /* 81 */ XML_ERR_EXT_ENTITY_STANDALONE, /* 82 */ XML_ERR_CONDSEC_INVALID, /* 83 */ XML_ERR_VALUE_REQUIRED, /* 84 */ XML_ERR_NOT_WELL_BALANCED, /* 85 */ XML_ERR_EXTRA_CONTENT, /* 86 */ XML_ERR_ENTITY_CHAR_ERROR, /* 87 */ XML_ERR_ENTITY_PE_INTERNAL, /* 88 */ XML_ERR_ENTITY_LOOP, /* 89 */ XML_ERR_ENTITY_BOUNDARY, /* 90 */ XML_ERR_INVALID_URI, /* 91 */ XML_ERR_URI_FRAGMENT, /* 92 */ XML_WAR_CATALOG_PI, /* 93 */ XML_ERR_NO_DTD, /* 94 */ XML_ERR_CONDSEC_INVALID_KEYWORD, /* 95 */ XML_ERR_VERSION_MISSING, /* 96 */ XML_WAR_UNKNOWN_VERSION, /* 97 */ XML_WAR_LANG_VALUE, /* 98 */ XML_WAR_NS_URI, /* 99 */ XML_WAR_NS_URI_RELATIVE, /* 100 */ XML_ERR_MISSING_ENCODING, /* 101 */ XML_WAR_SPACE_VALUE, /* 102 */ XML_ERR_NOT_STANDALONE, /* 103 */ XML_ERR_ENTITY_PROCESSING, /* 104 */ XML_ERR_NOTATION_PROCESSING, /* 105 */ XML_WAR_NS_COLUMN, /* 106 */ XML_WAR_ENTITY_REDEFINED, /* 107 */ XML_ERR_UNKNOWN_VERSION, /* 108 */ XML_ERR_VERSION_MISMATCH, /* 109 */ XML_ERR_NAME_TOO_LONG, /* 110 */ XML_ERR_USER_STOP, /* 111 */ XML_NS_ERR_XML_NAMESPACE = 200, XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */ XML_NS_ERR_QNAME, /* 202 */ XML_NS_ERR_ATTRIBUTE_REDEFINED, /* 203 */ XML_NS_ERR_EMPTY, /* 204 */ XML_NS_ERR_COLON, /* 205 */ XML_DTD_ATTRIBUTE_DEFAULT = 500, XML_DTD_ATTRIBUTE_REDEFINED, /* 501 */ XML_DTD_ATTRIBUTE_VALUE, /* 502 */ XML_DTD_CONTENT_ERROR, /* 503 */ XML_DTD_CONTENT_MODEL, /* 504 */ XML_DTD_CONTENT_NOT_DETERMINIST, /* 505 */ XML_DTD_DIFFERENT_PREFIX, /* 506 */ XML_DTD_ELEM_DEFAULT_NAMESPACE, /* 507 */ XML_DTD_ELEM_NAMESPACE, /* 508 */ XML_DTD_ELEM_REDEFINED, /* 509 */ XML_DTD_EMPTY_NOTATION, /* 510 */ XML_DTD_ENTITY_TYPE, /* 511 */ XML_DTD_ID_FIXED, /* 512 */ XML_DTD_ID_REDEFINED, /* 513 */ XML_DTD_ID_SUBSET, /* 514 */ XML_DTD_INVALID_CHILD, /* 515 */ XML_DTD_INVALID_DEFAULT, /* 516 */ XML_DTD_LOAD_ERROR, /* 517 */ XML_DTD_MISSING_ATTRIBUTE, /* 518 */ XML_DTD_MIXED_CORRUPT, /* 519 */ XML_DTD_MULTIPLE_ID, /* 520 */ XML_DTD_NO_DOC, /* 521 */ XML_DTD_NO_DTD, /* 522 */ XML_DTD_NO_ELEM_NAME, /* 523 */ XML_DTD_NO_PREFIX, /* 524 */ XML_DTD_NO_ROOT, /* 525 */ XML_DTD_NOTATION_REDEFINED, /* 526 */ XML_DTD_NOTATION_VALUE, /* 527 */ XML_DTD_NOT_EMPTY, /* 528 */ XML_DTD_NOT_PCDATA, /* 529 */ XML_DTD_NOT_STANDALONE, /* 530 */ XML_DTD_ROOT_NAME, /* 531 */ XML_DTD_STANDALONE_WHITE_SPACE, /* 532 */ XML_DTD_UNKNOWN_ATTRIBUTE, /* 533 */ XML_DTD_UNKNOWN_ELEM, /* 534 */ XML_DTD_UNKNOWN_ENTITY, /* 535 */ XML_DTD_UNKNOWN_ID, /* 536 */ XML_DTD_UNKNOWN_NOTATION, /* 537 */ XML_DTD_STANDALONE_DEFAULTED, /* 538 */ XML_DTD_XMLID_VALUE, /* 539 */ XML_DTD_XMLID_TYPE, /* 540 */ XML_DTD_DUP_TOKEN, /* 541 */ XML_HTML_STRUCURE_ERROR = 800, XML_HTML_UNKNOWN_TAG, /* 801 */ XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000, XML_RNGP_ATTR_CONFLICT, /* 1001 */ XML_RNGP_ATTRIBUTE_CHILDREN, /* 1002 */ XML_RNGP_ATTRIBUTE_CONTENT, /* 1003 */ XML_RNGP_ATTRIBUTE_EMPTY, /* 1004 */ XML_RNGP_ATTRIBUTE_NOOP, /* 1005 */ XML_RNGP_CHOICE_CONTENT, /* 1006 */ XML_RNGP_CHOICE_EMPTY, /* 1007 */ XML_RNGP_CREATE_FAILURE, /* 1008 */ XML_RNGP_DATA_CONTENT, /* 1009 */ XML_RNGP_DEF_CHOICE_AND_INTERLEAVE, /* 1010 */ XML_RNGP_DEFINE_CREATE_FAILED, /* 1011 */ XML_RNGP_DEFINE_EMPTY, /* 1012 */ XML_RNGP_DEFINE_MISSING, /* 1013 */ XML_RNGP_DEFINE_NAME_MISSING, /* 1014 */ XML_RNGP_ELEM_CONTENT_EMPTY, /* 1015 */ XML_RNGP_ELEM_CONTENT_ERROR, /* 1016 */ XML_RNGP_ELEMENT_EMPTY, /* 1017 */ XML_RNGP_ELEMENT_CONTENT, /* 1018 */ XML_RNGP_ELEMENT_NAME, /* 1019 */ XML_RNGP_ELEMENT_NO_CONTENT, /* 1020 */ XML_RNGP_ELEM_TEXT_CONFLICT, /* 1021 */ XML_RNGP_EMPTY, /* 1022 */ XML_RNGP_EMPTY_CONSTRUCT, /* 1023 */ XML_RNGP_EMPTY_CONTENT, /* 1024 */ XML_RNGP_EMPTY_NOT_EMPTY, /* 1025 */ XML_RNGP_ERROR_TYPE_LIB, /* 1026 */ XML_RNGP_EXCEPT_EMPTY, /* 1027 */ XML_RNGP_EXCEPT_MISSING, /* 1028 */ XML_RNGP_EXCEPT_MULTIPLE, /* 1029 */ XML_RNGP_EXCEPT_NO_CONTENT, /* 1030 */ XML_RNGP_EXTERNALREF_EMTPY, /* 1031 */ XML_RNGP_EXTERNAL_REF_FAILURE, /* 1032 */ XML_RNGP_EXTERNALREF_RECURSE, /* 1033 */ XML_RNGP_FORBIDDEN_ATTRIBUTE, /* 1034 */ XML_RNGP_FOREIGN_ELEMENT, /* 1035 */ XML_RNGP_GRAMMAR_CONTENT, /* 1036 */ XML_RNGP_GRAMMAR_EMPTY, /* 1037 */ XML_RNGP_GRAMMAR_MISSING, /* 1038 */ XML_RNGP_GRAMMAR_NO_START, /* 1039 */ XML_RNGP_GROUP_ATTR_CONFLICT, /* 1040 */ XML_RNGP_HREF_ERROR, /* 1041 */ XML_RNGP_INCLUDE_EMPTY, /* 1042 */ XML_RNGP_INCLUDE_FAILURE, /* 1043 */ XML_RNGP_INCLUDE_RECURSE, /* 1044 */ XML_RNGP_INTERLEAVE_ADD, /* 1045 */ XML_RNGP_INTERLEAVE_CREATE_FAILED, /* 1046 */ XML_RNGP_INTERLEAVE_EMPTY, /* 1047 */ XML_RNGP_INTERLEAVE_NO_CONTENT, /* 1048 */ XML_RNGP_INVALID_DEFINE_NAME, /* 1049 */ XML_RNGP_INVALID_URI, /* 1050 */ XML_RNGP_INVALID_VALUE, /* 1051 */ XML_RNGP_MISSING_HREF, /* 1052 */ XML_RNGP_NAME_MISSING, /* 1053 */ XML_RNGP_NEED_COMBINE, /* 1054 */ XML_RNGP_NOTALLOWED_NOT_EMPTY, /* 1055 */ XML_RNGP_NSNAME_ATTR_ANCESTOR, /* 1056 */ XML_RNGP_NSNAME_NO_NS, /* 1057 */ XML_RNGP_PARAM_FORBIDDEN, /* 1058 */ XML_RNGP_PARAM_NAME_MISSING, /* 1059 */ XML_RNGP_PARENTREF_CREATE_FAILED, /* 1060 */ XML_RNGP_PARENTREF_NAME_INVALID, /* 1061 */ XML_RNGP_PARENTREF_NO_NAME, /* 1062 */ XML_RNGP_PARENTREF_NO_PARENT, /* 1063 */ XML_RNGP_PARENTREF_NOT_EMPTY, /* 1064 */ XML_RNGP_PARSE_ERROR, /* 1065 */ XML_RNGP_PAT_ANYNAME_EXCEPT_ANYNAME, /* 1066 */ XML_RNGP_PAT_ATTR_ATTR, /* 1067 */ XML_RNGP_PAT_ATTR_ELEM, /* 1068 */ XML_RNGP_PAT_DATA_EXCEPT_ATTR, /* 1069 */ XML_RNGP_PAT_DATA_EXCEPT_ELEM, /* 1070 */ XML_RNGP_PAT_DATA_EXCEPT_EMPTY, /* 1071 */ XML_RNGP_PAT_DATA_EXCEPT_GROUP, /* 1072 */ XML_RNGP_PAT_DATA_EXCEPT_INTERLEAVE, /* 1073 */ XML_RNGP_PAT_DATA_EXCEPT_LIST, /* 1074 */ XML_RNGP_PAT_DATA_EXCEPT_ONEMORE, /* 1075 */ XML_RNGP_PAT_DATA_EXCEPT_REF, /* 1076 */ XML_RNGP_PAT_DATA_EXCEPT_TEXT, /* 1077 */ XML_RNGP_PAT_LIST_ATTR, /* 1078 */ XML_RNGP_PAT_LIST_ELEM, /* 1079 */ XML_RNGP_PAT_LIST_INTERLEAVE, /* 1080 */ XML_RNGP_PAT_LIST_LIST, /* 1081 */ XML_RNGP_PAT_LIST_REF, /* 1082 */ XML_RNGP_PAT_LIST_TEXT, /* 1083 */ XML_RNGP_PAT_NSNAME_EXCEPT_ANYNAME, /* 1084 */ XML_RNGP_PAT_NSNAME_EXCEPT_NSNAME, /* 1085 */ XML_RNGP_PAT_ONEMORE_GROUP_ATTR, /* 1086 */ XML_RNGP_PAT_ONEMORE_INTERLEAVE_ATTR, /* 1087 */ XML_RNGP_PAT_START_ATTR, /* 1088 */ XML_RNGP_PAT_START_DATA, /* 1089 */ XML_RNGP_PAT_START_EMPTY, /* 1090 */ XML_RNGP_PAT_START_GROUP, /* 1091 */ XML_RNGP_PAT_START_INTERLEAVE, /* 1092 */ XML_RNGP_PAT_START_LIST, /* 1093 */ XML_RNGP_PAT_START_ONEMORE, /* 1094 */ XML_RNGP_PAT_START_TEXT, /* 1095 */ XML_RNGP_PAT_START_VALUE, /* 1096 */ XML_RNGP_PREFIX_UNDEFINED, /* 1097 */ XML_RNGP_REF_CREATE_FAILED, /* 1098 */ XML_RNGP_REF_CYCLE, /* 1099 */ XML_RNGP_REF_NAME_INVALID, /* 1100 */ XML_RNGP_REF_NO_DEF, /* 1101 */ XML_RNGP_REF_NO_NAME, /* 1102 */ XML_RNGP_REF_NOT_EMPTY, /* 1103 */ XML_RNGP_START_CHOICE_AND_INTERLEAVE, /* 1104 */ XML_RNGP_START_CONTENT, /* 1105 */ XML_RNGP_START_EMPTY, /* 1106 */ XML_RNGP_START_MISSING, /* 1107 */ XML_RNGP_TEXT_EXPECTED, /* 1108 */ XML_RNGP_TEXT_HAS_CHILD, /* 1109 */ XML_RNGP_TYPE_MISSING, /* 1110 */ XML_RNGP_TYPE_NOT_FOUND, /* 1111 */ XML_RNGP_TYPE_VALUE, /* 1112 */ XML_RNGP_UNKNOWN_ATTRIBUTE, /* 1113 */ XML_RNGP_UNKNOWN_COMBINE, /* 1114 */ XML_RNGP_UNKNOWN_CONSTRUCT, /* 1115 */ XML_RNGP_UNKNOWN_TYPE_LIB, /* 1116 */ XML_RNGP_URI_FRAGMENT, /* 1117 */ XML_RNGP_URI_NOT_ABSOLUTE, /* 1118 */ XML_RNGP_VALUE_EMPTY, /* 1119 */ XML_RNGP_VALUE_NO_CONTENT, /* 1120 */ XML_RNGP_XMLNS_NAME, /* 1121 */ XML_RNGP_XML_NS, /* 1122 */ XML_XPATH_EXPRESSION_OK = 1200, XML_XPATH_NUMBER_ERROR, /* 1201 */ XML_XPATH_UNFINISHED_LITERAL_ERROR, /* 1202 */ XML_XPATH_START_LITERAL_ERROR, /* 1203 */ XML_XPATH_VARIABLE_REF_ERROR, /* 1204 */ XML_XPATH_UNDEF_VARIABLE_ERROR, /* 1205 */ XML_XPATH_INVALID_PREDICATE_ERROR, /* 1206 */ XML_XPATH_EXPR_ERROR, /* 1207 */ XML_XPATH_UNCLOSED_ERROR, /* 1208 */ XML_XPATH_UNKNOWN_FUNC_ERROR, /* 1209 */ XML_XPATH_INVALID_OPERAND, /* 1210 */ XML_XPATH_INVALID_TYPE, /* 1211 */ XML_XPATH_INVALID_ARITY, /* 1212 */ XML_XPATH_INVALID_CTXT_SIZE, /* 1213 */ XML_XPATH_INVALID_CTXT_POSITION, /* 1214 */ XML_XPATH_MEMORY_ERROR, /* 1215 */ XML_XPTR_SYNTAX_ERROR, /* 1216 */ XML_XPTR_RESOURCE_ERROR, /* 1217 */ XML_XPTR_SUB_RESOURCE_ERROR, /* 1218 */ XML_XPATH_UNDEF_PREFIX_ERROR, /* 1219 */ XML_XPATH_ENCODING_ERROR, /* 1220 */ XML_XPATH_INVALID_CHAR_ERROR, /* 1221 */ XML_TREE_INVALID_HEX = 1300, XML_TREE_INVALID_DEC, /* 1301 */ XML_TREE_UNTERMINATED_ENTITY, /* 1302 */ XML_TREE_NOT_UTF8, /* 1303 */ XML_SAVE_NOT_UTF8 = 1400, XML_SAVE_CHAR_INVALID, /* 1401 */ XML_SAVE_NO_DOCTYPE, /* 1402 */ XML_SAVE_UNKNOWN_ENCODING, /* 1403 */ XML_REGEXP_COMPILE_ERROR = 1450, XML_IO_UNKNOWN = 1500, XML_IO_EACCES, /* 1501 */ XML_IO_EAGAIN, /* 1502 */ XML_IO_EBADF, /* 1503 */ XML_IO_EBADMSG, /* 1504 */ XML_IO_EBUSY, /* 1505 */ XML_IO_ECANCELED, /* 1506 */ XML_IO_ECHILD, /* 1507 */ XML_IO_EDEADLK, /* 1508 */ XML_IO_EDOM, /* 1509 */ XML_IO_EEXIST, /* 1510 */ XML_IO_EFAULT, /* 1511 */ XML_IO_EFBIG, /* 1512 */ XML_IO_EINPROGRESS, /* 1513 */ XML_IO_EINTR, /* 1514 */ XML_IO_EINVAL, /* 1515 */ XML_IO_EIO, /* 1516 */ XML_IO_EISDIR, /* 1517 */ XML_IO_EMFILE, /* 1518 */ XML_IO_EMLINK, /* 1519 */ XML_IO_EMSGSIZE, /* 1520 */ XML_IO_ENAMETOOLONG, /* 1521 */ XML_IO_ENFILE, /* 1522 */ XML_IO_ENODEV, /* 1523 */ XML_IO_ENOENT, /* 1524 */ XML_IO_ENOEXEC, /* 1525 */ XML_IO_ENOLCK, /* 1526 */ XML_IO_ENOMEM, /* 1527 */ XML_IO_ENOSPC, /* 1528 */ XML_IO_ENOSYS, /* 1529 */ XML_IO_ENOTDIR, /* 1530 */ XML_IO_ENOTEMPTY, /* 1531 */ XML_IO_ENOTSUP, /* 1532 */ XML_IO_ENOTTY, /* 1533 */ XML_IO_ENXIO, /* 1534 */ XML_IO_EPERM, /* 1535 */ XML_IO_EPIPE, /* 1536 */ XML_IO_ERANGE, /* 1537 */ XML_IO_EROFS, /* 1538 */ XML_IO_ESPIPE, /* 1539 */ XML_IO_ESRCH, /* 1540 */ XML_IO_ETIMEDOUT, /* 1541 */ XML_IO_EXDEV, /* 1542 */ XML_IO_NETWORK_ATTEMPT, /* 1543 */ XML_IO_ENCODER, /* 1544 */ XML_IO_FLUSH, /* 1545 */ XML_IO_WRITE, /* 1546 */ XML_IO_NO_INPUT, /* 1547 */ XML_IO_BUFFER_FULL, /* 1548 */ XML_IO_LOAD_ERROR, /* 1549 */ XML_IO_ENOTSOCK, /* 1550 */ XML_IO_EISCONN, /* 1551 */ XML_IO_ECONNREFUSED, /* 1552 */ XML_IO_ENETUNREACH, /* 1553 */ XML_IO_EADDRINUSE, /* 1554 */ XML_IO_EALREADY, /* 1555 */ XML_IO_EAFNOSUPPORT, /* 1556 */ XML_XINCLUDE_RECURSION=1600, XML_XINCLUDE_PARSE_VALUE, /* 1601 */ XML_XINCLUDE_ENTITY_DEF_MISMATCH, /* 1602 */ XML_XINCLUDE_NO_HREF, /* 1603 */ XML_XINCLUDE_NO_FALLBACK, /* 1604 */ XML_XINCLUDE_HREF_URI, /* 1605 */ XML_XINCLUDE_TEXT_FRAGMENT, /* 1606 */ XML_XINCLUDE_TEXT_DOCUMENT, /* 1607 */ XML_XINCLUDE_INVALID_CHAR, /* 1608 */ XML_XINCLUDE_BUILD_FAILED, /* 1609 */ XML_XINCLUDE_UNKNOWN_ENCODING, /* 1610 */ XML_XINCLUDE_MULTIPLE_ROOT, /* 1611 */ XML_XINCLUDE_XPTR_FAILED, /* 1612 */ XML_XINCLUDE_XPTR_RESULT, /* 1613 */ XML_XINCLUDE_INCLUDE_IN_INCLUDE, /* 1614 */ XML_XINCLUDE_FALLBACKS_IN_INCLUDE, /* 1615 */ XML_XINCLUDE_FALLBACK_NOT_IN_INCLUDE, /* 1616 */ XML_XINCLUDE_DEPRECATED_NS, /* 1617 */ XML_XINCLUDE_FRAGMENT_ID, /* 1618 */ XML_CATALOG_MISSING_ATTR = 1650, XML_CATALOG_ENTRY_BROKEN, /* 1651 */ XML_CATALOG_PREFER_VALUE, /* 1652 */ XML_CATALOG_NOT_CATALOG, /* 1653 */ XML_CATALOG_RECURSION, /* 1654 */ XML_SCHEMAP_PREFIX_UNDEFINED = 1700, XML_SCHEMAP_ATTRFORMDEFAULT_VALUE, /* 1701 */ XML_SCHEMAP_ATTRGRP_NONAME_NOREF, /* 1702 */ XML_SCHEMAP_ATTR_NONAME_NOREF, /* 1703 */ XML_SCHEMAP_COMPLEXTYPE_NONAME_NOREF, /* 1704 */ XML_SCHEMAP_ELEMFORMDEFAULT_VALUE, /* 1705 */ XML_SCHEMAP_ELEM_NONAME_NOREF, /* 1706 */ XML_SCHEMAP_EXTENSION_NO_BASE, /* 1707 */ XML_SCHEMAP_FACET_NO_VALUE, /* 1708 */ XML_SCHEMAP_FAILED_BUILD_IMPORT, /* 1709 */ XML_SCHEMAP_GROUP_NONAME_NOREF, /* 1710 */ XML_SCHEMAP_IMPORT_NAMESPACE_NOT_URI, /* 1711 */ XML_SCHEMAP_IMPORT_REDEFINE_NSNAME, /* 1712 */ XML_SCHEMAP_IMPORT_SCHEMA_NOT_URI, /* 1713 */ XML_SCHEMAP_INVALID_BOOLEAN, /* 1714 */ XML_SCHEMAP_INVALID_ENUM, /* 1715 */ XML_SCHEMAP_INVALID_FACET, /* 1716 */ XML_SCHEMAP_INVALID_FACET_VALUE, /* 1717 */ XML_SCHEMAP_INVALID_MAXOCCURS, /* 1718 */ XML_SCHEMAP_INVALID_MINOCCURS, /* 1719 */ XML_SCHEMAP_INVALID_REF_AND_SUBTYPE, /* 1720 */ XML_SCHEMAP_INVALID_WHITE_SPACE, /* 1721 */ XML_SCHEMAP_NOATTR_NOREF, /* 1722 */ XML_SCHEMAP_NOTATION_NO_NAME, /* 1723 */ XML_SCHEMAP_NOTYPE_NOREF, /* 1724 */ XML_SCHEMAP_REF_AND_SUBTYPE, /* 1725 */ XML_SCHEMAP_RESTRICTION_NONAME_NOREF, /* 1726 */ XML_SCHEMAP_SIMPLETYPE_NONAME, /* 1727 */ XML_SCHEMAP_TYPE_AND_SUBTYPE, /* 1728 */ XML_SCHEMAP_UNKNOWN_ALL_CHILD, /* 1729 */ XML_SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD, /* 1730 */ XML_SCHEMAP_UNKNOWN_ATTR_CHILD, /* 1731 */ XML_SCHEMAP_UNKNOWN_ATTRGRP_CHILD, /* 1732 */ XML_SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP, /* 1733 */ XML_SCHEMAP_UNKNOWN_BASE_TYPE, /* 1734 */ XML_SCHEMAP_UNKNOWN_CHOICE_CHILD, /* 1735 */ XML_SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD, /* 1736 */ XML_SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD, /* 1737 */ XML_SCHEMAP_UNKNOWN_ELEM_CHILD, /* 1738 */ XML_SCHEMAP_UNKNOWN_EXTENSION_CHILD, /* 1739 */ XML_SCHEMAP_UNKNOWN_FACET_CHILD, /* 1740 */ XML_SCHEMAP_UNKNOWN_FACET_TYPE, /* 1741 */ XML_SCHEMAP_UNKNOWN_GROUP_CHILD, /* 1742 */ XML_SCHEMAP_UNKNOWN_IMPORT_CHILD, /* 1743 */ XML_SCHEMAP_UNKNOWN_LIST_CHILD, /* 1744 */ XML_SCHEMAP_UNKNOWN_NOTATION_CHILD, /* 1745 */ XML_SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD, /* 1746 */ XML_SCHEMAP_UNKNOWN_REF, /* 1747 */ XML_SCHEMAP_UNKNOWN_RESTRICTION_CHILD, /* 1748 */ XML_SCHEMAP_UNKNOWN_SCHEMAS_CHILD, /* 1749 */ XML_SCHEMAP_UNKNOWN_SEQUENCE_CHILD, /* 1750 */ XML_SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD, /* 1751 */ XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD, /* 1752 */ XML_SCHEMAP_UNKNOWN_TYPE, /* 1753 */ XML_SCHEMAP_UNKNOWN_UNION_CHILD, /* 1754 */ XML_SCHEMAP_ELEM_DEFAULT_FIXED, /* 1755 */ XML_SCHEMAP_REGEXP_INVALID, /* 1756 */ XML_SCHEMAP_FAILED_LOAD, /* 1757 */ XML_SCHEMAP_NOTHING_TO_PARSE, /* 1758 */ XML_SCHEMAP_NOROOT, /* 1759 */ XML_SCHEMAP_REDEFINED_GROUP, /* 1760 */ XML_SCHEMAP_REDEFINED_TYPE, /* 1761 */ XML_SCHEMAP_REDEFINED_ELEMENT, /* 1762 */ XML_SCHEMAP_REDEFINED_ATTRGROUP, /* 1763 */ XML_SCHEMAP_REDEFINED_ATTR, /* 1764 */ XML_SCHEMAP_REDEFINED_NOTATION, /* 1765 */ XML_SCHEMAP_FAILED_PARSE, /* 1766 */ XML_SCHEMAP_UNKNOWN_PREFIX, /* 1767 */ XML_SCHEMAP_DEF_AND_PREFIX, /* 1768 */ XML_SCHEMAP_UNKNOWN_INCLUDE_CHILD, /* 1769 */ XML_SCHEMAP_INCLUDE_SCHEMA_NOT_URI, /* 1770 */ XML_SCHEMAP_INCLUDE_SCHEMA_NO_URI, /* 1771 */ XML_SCHEMAP_NOT_SCHEMA, /* 1772 */ XML_SCHEMAP_UNKNOWN_MEMBER_TYPE, /* 1773 */ XML_SCHEMAP_INVALID_ATTR_USE, /* 1774 */ XML_SCHEMAP_RECURSIVE, /* 1775 */ XML_SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE, /* 1776 */ XML_SCHEMAP_INVALID_ATTR_COMBINATION, /* 1777 */ XML_SCHEMAP_INVALID_ATTR_INLINE_COMBINATION, /* 1778 */ XML_SCHEMAP_MISSING_SIMPLETYPE_CHILD, /* 1779 */ XML_SCHEMAP_INVALID_ATTR_NAME, /* 1780 */ XML_SCHEMAP_REF_AND_CONTENT, /* 1781 */ XML_SCHEMAP_CT_PROPS_CORRECT_1, /* 1782 */ XML_SCHEMAP_CT_PROPS_CORRECT_2, /* 1783 */ XML_SCHEMAP_CT_PROPS_CORRECT_3, /* 1784 */ XML_SCHEMAP_CT_PROPS_CORRECT_4, /* 1785 */ XML_SCHEMAP_CT_PROPS_CORRECT_5, /* 1786 */ XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, /* 1787 */ XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1, /* 1788 */ XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2, /* 1789 */ XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2, /* 1790 */ XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3, /* 1791 */ XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER, /* 1792 */ XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE, /* 1793 */ XML_SCHEMAP_UNION_NOT_EXPRESSIBLE, /* 1794 */ XML_SCHEMAP_SRC_IMPORT_3_1, /* 1795 */ XML_SCHEMAP_SRC_IMPORT_3_2, /* 1796 */ XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_1, /* 1797 */ XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2, /* 1798 */ XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_3, /* 1799 */ XML_SCHEMAP_COS_CT_EXTENDS_1_3, /* 1800 */ XML_SCHEMAV_NOROOT = 1801, XML_SCHEMAV_UNDECLAREDELEM, /* 1802 */ XML_SCHEMAV_NOTTOPLEVEL, /* 1803 */ XML_SCHEMAV_MISSING, /* 1804 */ XML_SCHEMAV_WRONGELEM, /* 1805 */ XML_SCHEMAV_NOTYPE, /* 1806 */ XML_SCHEMAV_NOROLLBACK, /* 1807 */ XML_SCHEMAV_ISABSTRACT, /* 1808 */ XML_SCHEMAV_NOTEMPTY, /* 1809 */ XML_SCHEMAV_ELEMCONT, /* 1810 */ XML_SCHEMAV_HAVEDEFAULT, /* 1811 */ XML_SCHEMAV_NOTNILLABLE, /* 1812 */ XML_SCHEMAV_EXTRACONTENT, /* 1813 */ XML_SCHEMAV_INVALIDATTR, /* 1814 */ XML_SCHEMAV_INVALIDELEM, /* 1815 */ XML_SCHEMAV_NOTDETERMINIST, /* 1816 */ XML_SCHEMAV_CONSTRUCT, /* 1817 */ XML_SCHEMAV_INTERNAL, /* 1818 */ XML_SCHEMAV_NOTSIMPLE, /* 1819 */ XML_SCHEMAV_ATTRUNKNOWN, /* 1820 */ XML_SCHEMAV_ATTRINVALID, /* 1821 */ XML_SCHEMAV_VALUE, /* 1822 */ XML_SCHEMAV_FACET, /* 1823 */ XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1, /* 1824 */ XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2, /* 1825 */ XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3, /* 1826 */ XML_SCHEMAV_CVC_TYPE_3_1_1, /* 1827 */ XML_SCHEMAV_CVC_TYPE_3_1_2, /* 1828 */ XML_SCHEMAV_CVC_FACET_VALID, /* 1829 */ XML_SCHEMAV_CVC_LENGTH_VALID, /* 1830 */ XML_SCHEMAV_CVC_MINLENGTH_VALID, /* 1831 */ XML_SCHEMAV_CVC_MAXLENGTH_VALID, /* 1832 */ XML_SCHEMAV_CVC_MININCLUSIVE_VALID, /* 1833 */ XML_SCHEMAV_CVC_MAXINCLUSIVE_VALID, /* 1834 */ XML_SCHEMAV_CVC_MINEXCLUSIVE_VALID, /* 1835 */ XML_SCHEMAV_CVC_MAXEXCLUSIVE_VALID, /* 1836 */ XML_SCHEMAV_CVC_TOTALDIGITS_VALID, /* 1837 */ XML_SCHEMAV_CVC_FRACTIONDIGITS_VALID, /* 1838 */ XML_SCHEMAV_CVC_PATTERN_VALID, /* 1839 */ XML_SCHEMAV_CVC_ENUMERATION_VALID, /* 1840 */ XML_SCHEMAV_CVC_COMPLEX_TYPE_2_1, /* 1841 */ XML_SCHEMAV_CVC_COMPLEX_TYPE_2_2, /* 1842 */ XML_SCHEMAV_CVC_COMPLEX_TYPE_2_3, /* 1843 */ XML_SCHEMAV_CVC_COMPLEX_TYPE_2_4, /* 1844 */ XML_SCHEMAV_CVC_ELT_1, /* 1845 */ XML_SCHEMAV_CVC_ELT_2, /* 1846 */ XML_SCHEMAV_CVC_ELT_3_1, /* 1847 */ XML_SCHEMAV_CVC_ELT_3_2_1, /* 1848 */ XML_SCHEMAV_CVC_ELT_3_2_2, /* 1849 */ XML_SCHEMAV_CVC_ELT_4_1, /* 1850 */ XML_SCHEMAV_CVC_ELT_4_2, /* 1851 */ XML_SCHEMAV_CVC_ELT_4_3, /* 1852 */ XML_SCHEMAV_CVC_ELT_5_1_1, /* 1853 */ XML_SCHEMAV_CVC_ELT_5_1_2, /* 1854 */ XML_SCHEMAV_CVC_ELT_5_2_1, /* 1855 */ XML_SCHEMAV_CVC_ELT_5_2_2_1, /* 1856 */ XML_SCHEMAV_CVC_ELT_5_2_2_2_1, /* 1857 */ XML_SCHEMAV_CVC_ELT_5_2_2_2_2, /* 1858 */ XML_SCHEMAV_CVC_ELT_6, /* 1859 */ XML_SCHEMAV_CVC_ELT_7, /* 1860 */ XML_SCHEMAV_CVC_ATTRIBUTE_1, /* 1861 */ XML_SCHEMAV_CVC_ATTRIBUTE_2, /* 1862 */ XML_SCHEMAV_CVC_ATTRIBUTE_3, /* 1863 */ XML_SCHEMAV_CVC_ATTRIBUTE_4, /* 1864 */ XML_SCHEMAV_CVC_COMPLEX_TYPE_3_1, /* 1865 */ XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_1, /* 1866 */ XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_2, /* 1867 */ XML_SCHEMAV_CVC_COMPLEX_TYPE_4, /* 1868 */ XML_SCHEMAV_CVC_COMPLEX_TYPE_5_1, /* 1869 */ XML_SCHEMAV_CVC_COMPLEX_TYPE_5_2, /* 1870 */ XML_SCHEMAV_ELEMENT_CONTENT, /* 1871 */ XML_SCHEMAV_DOCUMENT_ELEMENT_MISSING, /* 1872 */ XML_SCHEMAV_CVC_COMPLEX_TYPE_1, /* 1873 */ XML_SCHEMAV_CVC_AU, /* 1874 */ XML_SCHEMAV_CVC_TYPE_1, /* 1875 */ XML_SCHEMAV_CVC_TYPE_2, /* 1876 */ XML_SCHEMAV_CVC_IDC, /* 1877 */ XML_SCHEMAV_CVC_WILDCARD, /* 1878 */ XML_SCHEMAV_MISC, /* 1879 */ XML_XPTR_UNKNOWN_SCHEME = 1900, XML_XPTR_CHILDSEQ_START, /* 1901 */ XML_XPTR_EVAL_FAILED, /* 1902 */ XML_XPTR_EXTRA_OBJECTS, /* 1903 */ XML_C14N_CREATE_CTXT = 1950, XML_C14N_REQUIRES_UTF8, /* 1951 */ XML_C14N_CREATE_STACK, /* 1952 */ XML_C14N_INVALID_NODE, /* 1953 */ XML_C14N_UNKNOW_NODE, /* 1954 */ XML_C14N_RELATIVE_NAMESPACE, /* 1955 */ XML_FTP_PASV_ANSWER = 2000, XML_FTP_EPSV_ANSWER, /* 2001 */ XML_FTP_ACCNT, /* 2002 */ XML_FTP_URL_SYNTAX, /* 2003 */ XML_HTTP_URL_SYNTAX = 2020, XML_HTTP_USE_IP, /* 2021 */ XML_HTTP_UNKNOWN_HOST, /* 2022 */ XML_SCHEMAP_SRC_SIMPLE_TYPE_1 = 3000, XML_SCHEMAP_SRC_SIMPLE_TYPE_2, /* 3001 */ XML_SCHEMAP_SRC_SIMPLE_TYPE_3, /* 3002 */ XML_SCHEMAP_SRC_SIMPLE_TYPE_4, /* 3003 */ XML_SCHEMAP_SRC_RESOLVE, /* 3004 */ XML_SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE, /* 3005 */ XML_SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE, /* 3006 */ XML_SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES, /* 3007 */ XML_SCHEMAP_ST_PROPS_CORRECT_1, /* 3008 */ XML_SCHEMAP_ST_PROPS_CORRECT_2, /* 3009 */ XML_SCHEMAP_ST_PROPS_CORRECT_3, /* 3010 */ XML_SCHEMAP_COS_ST_RESTRICTS_1_1, /* 3011 */ XML_SCHEMAP_COS_ST_RESTRICTS_1_2, /* 3012 */ XML_SCHEMAP_COS_ST_RESTRICTS_1_3_1, /* 3013 */ XML_SCHEMAP_COS_ST_RESTRICTS_1_3_2, /* 3014 */ XML_SCHEMAP_COS_ST_RESTRICTS_2_1, /* 3015 */ XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_1, /* 3016 */ XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2, /* 3017 */ XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_1, /* 3018 */ XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2, /* 3019 */ XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_3, /* 3020 */ XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_4, /* 3021 */ XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_5, /* 3022 */ XML_SCHEMAP_COS_ST_RESTRICTS_3_1, /* 3023 */ XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1, /* 3024 */ XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1_2, /* 3025 */ XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_2, /* 3026 */ XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_1, /* 3027 */ XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3, /* 3028 */ XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_4, /* 3029 */ XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_5, /* 3030 */ XML_SCHEMAP_COS_ST_DERIVED_OK_2_1, /* 3031 */ XML_SCHEMAP_COS_ST_DERIVED_OK_2_2, /* 3032 */ XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, /* 3033 */ XML_SCHEMAP_S4S_ELEM_MISSING, /* 3034 */ XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, /* 3035 */ XML_SCHEMAP_S4S_ATTR_MISSING, /* 3036 */ XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, /* 3037 */ XML_SCHEMAP_SRC_ELEMENT_1, /* 3038 */ XML_SCHEMAP_SRC_ELEMENT_2_1, /* 3039 */ XML_SCHEMAP_SRC_ELEMENT_2_2, /* 3040 */ XML_SCHEMAP_SRC_ELEMENT_3, /* 3041 */ XML_SCHEMAP_P_PROPS_CORRECT_1, /* 3042 */ XML_SCHEMAP_P_PROPS_CORRECT_2_1, /* 3043 */ XML_SCHEMAP_P_PROPS_CORRECT_2_2, /* 3044 */ XML_SCHEMAP_E_PROPS_CORRECT_2, /* 3045 */ XML_SCHEMAP_E_PROPS_CORRECT_3, /* 3046 */ XML_SCHEMAP_E_PROPS_CORRECT_4, /* 3047 */ XML_SCHEMAP_E_PROPS_CORRECT_5, /* 3048 */ XML_SCHEMAP_E_PROPS_CORRECT_6, /* 3049 */ XML_SCHEMAP_SRC_INCLUDE, /* 3050 */ XML_SCHEMAP_SRC_ATTRIBUTE_1, /* 3051 */ XML_SCHEMAP_SRC_ATTRIBUTE_2, /* 3052 */ XML_SCHEMAP_SRC_ATTRIBUTE_3_1, /* 3053 */ XML_SCHEMAP_SRC_ATTRIBUTE_3_2, /* 3054 */ XML_SCHEMAP_SRC_ATTRIBUTE_4, /* 3055 */ XML_SCHEMAP_NO_XMLNS, /* 3056 */ XML_SCHEMAP_NO_XSI, /* 3057 */ XML_SCHEMAP_COS_VALID_DEFAULT_1, /* 3058 */ XML_SCHEMAP_COS_VALID_DEFAULT_2_1, /* 3059 */ XML_SCHEMAP_COS_VALID_DEFAULT_2_2_1, /* 3060 */ XML_SCHEMAP_COS_VALID_DEFAULT_2_2_2, /* 3061 */ XML_SCHEMAP_CVC_SIMPLE_TYPE, /* 3062 */ XML_SCHEMAP_COS_CT_EXTENDS_1_1, /* 3063 */ XML_SCHEMAP_SRC_IMPORT_1_1, /* 3064 */ XML_SCHEMAP_SRC_IMPORT_1_2, /* 3065 */ XML_SCHEMAP_SRC_IMPORT_2, /* 3066 */ XML_SCHEMAP_SRC_IMPORT_2_1, /* 3067 */ XML_SCHEMAP_SRC_IMPORT_2_2, /* 3068 */ XML_SCHEMAP_INTERNAL, /* 3069 non-W3C */ XML_SCHEMAP_NOT_DETERMINISTIC, /* 3070 non-W3C */ XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_1, /* 3071 */ XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_2, /* 3072 */ XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_3, /* 3073 */ XML_SCHEMAP_MG_PROPS_CORRECT_1, /* 3074 */ XML_SCHEMAP_MG_PROPS_CORRECT_2, /* 3075 */ XML_SCHEMAP_SRC_CT_1, /* 3076 */ XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3, /* 3077 */ XML_SCHEMAP_AU_PROPS_CORRECT_2, /* 3078 */ XML_SCHEMAP_A_PROPS_CORRECT_2, /* 3079 */ XML_SCHEMAP_C_PROPS_CORRECT, /* 3080 */ XML_SCHEMAP_SRC_REDEFINE, /* 3081 */ XML_SCHEMAP_SRC_IMPORT, /* 3082 */ XML_SCHEMAP_WARN_SKIP_SCHEMA, /* 3083 */ XML_SCHEMAP_WARN_UNLOCATED_SCHEMA, /* 3084 */ XML_SCHEMAP_WARN_ATTR_REDECL_PROH, /* 3085 */ XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, /* 3085 */ XML_SCHEMAP_AG_PROPS_CORRECT, /* 3086 */ XML_SCHEMAP_COS_CT_EXTENDS_1_2, /* 3087 */ XML_SCHEMAP_AU_PROPS_CORRECT, /* 3088 */ XML_SCHEMAP_A_PROPS_CORRECT_3, /* 3089 */ XML_SCHEMAP_COS_ALL_LIMITED, /* 3090 */ XML_SCHEMATRONV_ASSERT = 4000, /* 4000 */ XML_SCHEMATRONV_REPORT, XML_MODULE_OPEN = 4900, /* 4900 */ XML_MODULE_CLOSE, /* 4901 */ XML_CHECK_FOUND_ELEMENT = 5000, XML_CHECK_FOUND_ATTRIBUTE, /* 5001 */ XML_CHECK_FOUND_TEXT, /* 5002 */ XML_CHECK_FOUND_CDATA, /* 5003 */ XML_CHECK_FOUND_ENTITYREF, /* 5004 */ XML_CHECK_FOUND_ENTITY, /* 5005 */ XML_CHECK_FOUND_PI, /* 5006 */ XML_CHECK_FOUND_COMMENT, /* 5007 */ XML_CHECK_FOUND_DOCTYPE, /* 5008 */ XML_CHECK_FOUND_FRAGMENT, /* 5009 */ XML_CHECK_FOUND_NOTATION, /* 5010 */ XML_CHECK_UNKNOWN_NODE, /* 5011 */ XML_CHECK_ENTITY_TYPE, /* 5012 */ XML_CHECK_NO_PARENT, /* 5013 */ XML_CHECK_NO_DOC, /* 5014 */ XML_CHECK_NO_NAME, /* 5015 */ XML_CHECK_NO_ELEM, /* 5016 */ XML_CHECK_WRONG_DOC, /* 5017 */ XML_CHECK_NO_PREV, /* 5018 */ XML_CHECK_WRONG_PREV, /* 5019 */ XML_CHECK_NO_NEXT, /* 5020 */ XML_CHECK_WRONG_NEXT, /* 5021 */ XML_CHECK_NOT_DTD, /* 5022 */ XML_CHECK_NOT_ATTR, /* 5023 */ XML_CHECK_NOT_ATTR_DECL, /* 5024 */ XML_CHECK_NOT_ELEM_DECL, /* 5025 */ XML_CHECK_NOT_ENTITY_DECL, /* 5026 */ XML_CHECK_NOT_NS_DECL, /* 5027 */ XML_CHECK_NO_HREF, /* 5028 */ XML_CHECK_WRONG_PARENT,/* 5029 */ XML_CHECK_NS_SCOPE, /* 5030 */ XML_CHECK_NS_ANCESTOR, /* 5031 */ XML_CHECK_NOT_UTF8, /* 5032 */ XML_CHECK_NO_DICT, /* 5033 */ XML_CHECK_NOT_NCNAME, /* 5034 */ XML_CHECK_OUTSIDE_DICT, /* 5035 */ XML_CHECK_WRONG_NAME, /* 5036 */ XML_CHECK_NAME_NOT_NULL, /* 5037 */ XML_I18N_NO_NAME = 6000, XML_I18N_NO_HANDLER, /* 6001 */ XML_I18N_EXCESS_HANDLER, /* 6002 */ XML_I18N_CONV_FAILED, /* 6003 */ XML_I18N_NO_OUTPUT, /* 6004 */ XML_BUF_OVERFLOW = 7000 } xmlParserErrors; /** * xmlGenericErrorFunc: * @ctx: a parsing context * @msg: the message * @...: the extra arguments of the varags to format the message * * Signature of the function to use when there is an error and * no parsing or validity context available . */ typedef void (XMLCDECL *xmlGenericErrorFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); /** * xmlStructuredErrorFunc: * @userData: user provided data for the error callback * @error: the error being raised. * * Signature of the function to use when there is an error and * the module handles the new error reporting mechanism. */ typedef void (XMLCALL *xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error); /* * Use the following function to reset the two global variables * xmlGenericError and xmlGenericErrorContext. */ XMLPUBFUN void XMLCALL xmlSetGenericErrorFunc (void *ctx, xmlGenericErrorFunc handler); XMLPUBFUN void XMLCALL initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler); XMLPUBFUN void XMLCALL xmlSetStructuredErrorFunc (void *ctx, xmlStructuredErrorFunc handler); /* * Default message routines used by SAX and Valid context for error * and warning reporting. */ XMLPUBFUN void XMLCDECL xmlParserError (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); XMLPUBFUN void XMLCDECL xmlParserWarning (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); XMLPUBFUN void XMLCDECL xmlParserValidityError (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); XMLPUBFUN void XMLCDECL xmlParserValidityWarning (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); XMLPUBFUN void XMLCALL xmlParserPrintFileInfo (xmlParserInputPtr input); XMLPUBFUN void XMLCALL xmlParserPrintFileContext (xmlParserInputPtr input); /* * Extended error information routines */ XMLPUBFUN xmlErrorPtr XMLCALL xmlGetLastError (void); XMLPUBFUN void XMLCALL xmlResetLastError (void); XMLPUBFUN xmlErrorPtr XMLCALL xmlCtxtGetLastError (void *ctx); XMLPUBFUN void XMLCALL xmlCtxtResetLastError (void *ctx); XMLPUBFUN void XMLCALL xmlResetError (xmlErrorPtr err); XMLPUBFUN int XMLCALL xmlCopyError (xmlErrorPtr from, xmlErrorPtr to); #ifdef IN_LIBXML /* * Internal callback reporting routine */ XMLPUBFUN void XMLCALL __xmlRaiseError (xmlStructuredErrorFunc schannel, xmlGenericErrorFunc channel, void *data, void *ctx, void *node, int domain, int code, xmlErrorLevel level, const char *file, int line, const char *str1, const char *str2, const char *str3, int int1, int col, const char *msg, ...) LIBXML_ATTR_FORMAT(16,17); XMLPUBFUN void XMLCALL __xmlSimpleError (int domain, int code, xmlNodePtr node, const char *msg, const char *extra) LIBXML_ATTR_FORMAT(4,0); #endif #ifdef __cplusplus } #endif #endif /* __XML_ERROR_H__ */ �������������������������������������libxml2/libxml/HTMLparser.h�������������������������������������������������������������������������0000644�����������������00000022266�14763166030�0011554 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: interface for an HTML 4.0 non-verifying parser * Description: this module implements an HTML 4.0 non-verifying parser * with API compatible with the XML parser ones. It should * be able to parse "real world" HTML, even if severely * broken from a specification point of view. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __HTML_PARSER_H__ #define __HTML_PARSER_H__ #include <libxml/xmlversion.h> #include <libxml/parser.h> #ifdef LIBXML_HTML_ENABLED #ifdef __cplusplus extern "C" { #endif /* * Most of the back-end structures from XML and HTML are shared. */ typedef xmlParserCtxt htmlParserCtxt; typedef xmlParserCtxtPtr htmlParserCtxtPtr; typedef xmlParserNodeInfo htmlParserNodeInfo; typedef xmlSAXHandler htmlSAXHandler; typedef xmlSAXHandlerPtr htmlSAXHandlerPtr; typedef xmlParserInput htmlParserInput; typedef xmlParserInputPtr htmlParserInputPtr; typedef xmlDocPtr htmlDocPtr; typedef xmlNodePtr htmlNodePtr; /* * Internal description of an HTML element, representing HTML 4.01 * and XHTML 1.0 (which share the same structure). */ typedef struct _htmlElemDesc htmlElemDesc; typedef htmlElemDesc *htmlElemDescPtr; struct _htmlElemDesc { const char *name; /* The tag name */ char startTag; /* Whether the start tag can be implied */ char endTag; /* Whether the end tag can be implied */ char saveEndTag; /* Whether the end tag should be saved */ char empty; /* Is this an empty element ? */ char depr; /* Is this a deprecated element ? */ char dtd; /* 1: only in Loose DTD, 2: only Frameset one */ char isinline; /* is this a block 0 or inline 1 element */ const char *desc; /* the description */ /* NRK Jan.2003 * New fields encapsulating HTML structure * * Bugs: * This is a very limited representation. It fails to tell us when * an element *requires* subelements (we only have whether they're * allowed or not), and it doesn't tell us where CDATA and PCDATA * are allowed. Some element relationships are not fully represented: * these are flagged with the word MODIFIER */ const char** subelts; /* allowed sub-elements of this element */ const char* defaultsubelt; /* subelement for suggested auto-repair if necessary or NULL */ const char** attrs_opt; /* Optional Attributes */ const char** attrs_depr; /* Additional deprecated attributes */ const char** attrs_req; /* Required attributes */ }; /* * Internal description of an HTML entity. */ typedef struct _htmlEntityDesc htmlEntityDesc; typedef htmlEntityDesc *htmlEntityDescPtr; struct _htmlEntityDesc { unsigned int value; /* the UNICODE value for the character */ const char *name; /* The entity name */ const char *desc; /* the description */ }; /* * There is only few public functions. */ XMLPUBFUN const htmlElemDesc * XMLCALL htmlTagLookup (const xmlChar *tag); XMLPUBFUN const htmlEntityDesc * XMLCALL htmlEntityLookup(const xmlChar *name); XMLPUBFUN const htmlEntityDesc * XMLCALL htmlEntityValueLookup(unsigned int value); XMLPUBFUN int XMLCALL htmlIsAutoClosed(htmlDocPtr doc, htmlNodePtr elem); XMLPUBFUN int XMLCALL htmlAutoCloseTag(htmlDocPtr doc, const xmlChar *name, htmlNodePtr elem); XMLPUBFUN const htmlEntityDesc * XMLCALL htmlParseEntityRef(htmlParserCtxtPtr ctxt, const xmlChar **str); XMLPUBFUN int XMLCALL htmlParseCharRef(htmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL htmlParseElement(htmlParserCtxtPtr ctxt); XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlNewParserCtxt(void); XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateMemoryParserCtxt(const char *buffer, int size); XMLPUBFUN int XMLCALL htmlParseDocument(htmlParserCtxtPtr ctxt); XMLPUBFUN htmlDocPtr XMLCALL htmlSAXParseDoc (xmlChar *cur, const char *encoding, htmlSAXHandlerPtr sax, void *userData); XMLPUBFUN htmlDocPtr XMLCALL htmlParseDoc (xmlChar *cur, const char *encoding); XMLPUBFUN htmlDocPtr XMLCALL htmlSAXParseFile(const char *filename, const char *encoding, htmlSAXHandlerPtr sax, void *userData); XMLPUBFUN htmlDocPtr XMLCALL htmlParseFile (const char *filename, const char *encoding); XMLPUBFUN int XMLCALL UTF8ToHtml (unsigned char *out, int *outlen, const unsigned char *in, int *inlen); XMLPUBFUN int XMLCALL htmlEncodeEntities(unsigned char *out, int *outlen, const unsigned char *in, int *inlen, int quoteChar); XMLPUBFUN int XMLCALL htmlIsScriptAttribute(const xmlChar *name); XMLPUBFUN int XMLCALL htmlHandleOmittedElem(int val); #ifdef LIBXML_PUSH_ENABLED /** * Interfaces for the Push mode. */ XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data, const char *chunk, int size, const char *filename, xmlCharEncoding enc); XMLPUBFUN int XMLCALL htmlParseChunk (htmlParserCtxtPtr ctxt, const char *chunk, int size, int terminate); #endif /* LIBXML_PUSH_ENABLED */ XMLPUBFUN void XMLCALL htmlFreeParserCtxt (htmlParserCtxtPtr ctxt); /* * New set of simpler/more flexible APIs */ /** * xmlParserOption: * * This is the set of XML parser options that can be passed down * to the xmlReadDoc() and similar calls. */ typedef enum { HTML_PARSE_RECOVER = 1<<0, /* Relaxed parsing */ HTML_PARSE_NODEFDTD = 1<<2, /* do not default a doctype if not found */ HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */ HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */ HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ HTML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ HTML_PARSE_NONET = 1<<11,/* Forbid network access */ HTML_PARSE_NOIMPLIED= 1<<13,/* Do not add implied html/body... elements */ HTML_PARSE_COMPACT = 1<<16,/* compact small text nodes */ HTML_PARSE_IGNORE_ENC=1<<21 /* ignore internal document encoding hint */ } htmlParserOption; XMLPUBFUN void XMLCALL htmlCtxtReset (htmlParserCtxtPtr ctxt); XMLPUBFUN int XMLCALL htmlCtxtUseOptions (htmlParserCtxtPtr ctxt, int options); XMLPUBFUN htmlDocPtr XMLCALL htmlReadDoc (const xmlChar *cur, const char *URL, const char *encoding, int options); XMLPUBFUN htmlDocPtr XMLCALL htmlReadFile (const char *URL, const char *encoding, int options); XMLPUBFUN htmlDocPtr XMLCALL htmlReadMemory (const char *buffer, int size, const char *URL, const char *encoding, int options); XMLPUBFUN htmlDocPtr XMLCALL htmlReadFd (int fd, const char *URL, const char *encoding, int options); XMLPUBFUN htmlDocPtr XMLCALL htmlReadIO (xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options); XMLPUBFUN htmlDocPtr XMLCALL htmlCtxtReadDoc (xmlParserCtxtPtr ctxt, const xmlChar *cur, const char *URL, const char *encoding, int options); XMLPUBFUN htmlDocPtr XMLCALL htmlCtxtReadFile (xmlParserCtxtPtr ctxt, const char *filename, const char *encoding, int options); XMLPUBFUN htmlDocPtr XMLCALL htmlCtxtReadMemory (xmlParserCtxtPtr ctxt, const char *buffer, int size, const char *URL, const char *encoding, int options); XMLPUBFUN htmlDocPtr XMLCALL htmlCtxtReadFd (xmlParserCtxtPtr ctxt, int fd, const char *URL, const char *encoding, int options); XMLPUBFUN htmlDocPtr XMLCALL htmlCtxtReadIO (xmlParserCtxtPtr ctxt, xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options); /* NRK/Jan2003: further knowledge of HTML structure */ typedef enum { HTML_NA = 0 , /* something we don't check at all */ HTML_INVALID = 0x1 , HTML_DEPRECATED = 0x2 , HTML_VALID = 0x4 , HTML_REQUIRED = 0xc /* VALID bit set so ( & HTML_VALID ) is TRUE */ } htmlStatus ; /* Using htmlElemDesc rather than name here, to emphasise the fact that otherwise there's a lookup overhead */ XMLPUBFUN htmlStatus XMLCALL htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ; XMLPUBFUN int XMLCALL htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ; XMLPUBFUN htmlStatus XMLCALL htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ; XMLPUBFUN htmlStatus XMLCALL htmlNodeStatus(const htmlNodePtr, int) ; /** * htmlDefaultSubelement: * @elt: HTML element * * Returns the default subelement for this element */ #define htmlDefaultSubelement(elt) elt->defaultsubelt /** * htmlElementAllowedHereDesc: * @parent: HTML parent element * @elt: HTML element * * Checks whether an HTML element description may be a * direct child of the specified element. * * Returns 1 if allowed; 0 otherwise. */ #define htmlElementAllowedHereDesc(parent,elt) \ htmlElementAllowedHere((parent), (elt)->name) /** * htmlRequiredAttrs: * @elt: HTML element * * Returns the attributes required for the specified element. */ #define htmlRequiredAttrs(elt) (elt)->attrs_req #ifdef __cplusplus } #endif #endif /* LIBXML_HTML_ENABLED */ #endif /* __HTML_PARSER_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/DOCBparser.h�������������������������������������������������������������������������0000644�����������������00000006125�14763166030�0011513 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: old DocBook SGML parser * Description: interface for a DocBook SGML non-verifying parser * This code is DEPRECATED, and should not be used anymore. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __DOCB_PARSER_H__ #define __DOCB_PARSER_H__ #include <libxml/xmlversion.h> #ifdef LIBXML_DOCB_ENABLED #include <libxml/parser.h> #include <libxml/parserInternals.h> #ifndef IN_LIBXML #ifdef __GNUC__ #warning "The DOCBparser module has been deprecated in libxml2-2.6.0" #endif #endif #ifdef __cplusplus extern "C" { #endif /* * Most of the back-end structures from XML and SGML are shared. */ typedef xmlParserCtxt docbParserCtxt; typedef xmlParserCtxtPtr docbParserCtxtPtr; typedef xmlSAXHandler docbSAXHandler; typedef xmlSAXHandlerPtr docbSAXHandlerPtr; typedef xmlParserInput docbParserInput; typedef xmlParserInputPtr docbParserInputPtr; typedef xmlDocPtr docbDocPtr; /* * There is only few public functions. */ XMLPUBFUN int XMLCALL docbEncodeEntities(unsigned char *out, int *outlen, const unsigned char *in, int *inlen, int quoteChar); XMLPUBFUN docbDocPtr XMLCALL docbSAXParseDoc (xmlChar *cur, const char *encoding, docbSAXHandlerPtr sax, void *userData); XMLPUBFUN docbDocPtr XMLCALL docbParseDoc (xmlChar *cur, const char *encoding); XMLPUBFUN docbDocPtr XMLCALL docbSAXParseFile (const char *filename, const char *encoding, docbSAXHandlerPtr sax, void *userData); XMLPUBFUN docbDocPtr XMLCALL docbParseFile (const char *filename, const char *encoding); /** * Interfaces for the Push mode. */ XMLPUBFUN void XMLCALL docbFreeParserCtxt (docbParserCtxtPtr ctxt); XMLPUBFUN docbParserCtxtPtr XMLCALL docbCreatePushParserCtxt(docbSAXHandlerPtr sax, void *user_data, const char *chunk, int size, const char *filename, xmlCharEncoding enc); XMLPUBFUN int XMLCALL docbParseChunk (docbParserCtxtPtr ctxt, const char *chunk, int size, int terminate); XMLPUBFUN docbParserCtxtPtr XMLCALL docbCreateFileParserCtxt(const char *filename, const char *encoding); XMLPUBFUN int XMLCALL docbParseDocument (docbParserCtxtPtr ctxt); #ifdef __cplusplus } #endif #endif /* LIBXML_DOCB_ENABLED */ #endif /* __DOCB_PARSER_H__ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/encoding.h���������������������������������������������������������������������������0000644�����������������00000020155�14763166030�0011354 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: interface for the encoding conversion functions * Description: interface for the encoding conversion functions needed for * XML basic encoding and iconv() support. * * Related specs are * rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies * [ISO-10646] UTF-8 and UTF-16 in Annexes * [ISO-8859-1] ISO Latin-1 characters codes. * [UNICODE] The Unicode Consortium, "The Unicode Standard -- * Worldwide Character Encoding -- Version 1.0", Addison- * Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is * described in Unicode Technical Report #4. * [US-ASCII] Coded Character Set--7-bit American Standard Code for * Information Interchange, ANSI X3.4-1986. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_CHAR_ENCODING_H__ #define __XML_CHAR_ENCODING_H__ #include <libxml/xmlversion.h> #ifdef LIBXML_ICONV_ENABLED #include <iconv.h> #endif #ifdef LIBXML_ICU_ENABLED #include <unicode/ucnv.h> #endif #ifdef __cplusplus extern "C" { #endif /* * xmlCharEncoding: * * Predefined values for some standard encodings. * Libxml does not do beforehand translation on UTF8 and ISOLatinX. * It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default. * * Anything else would have to be translated to UTF8 before being * given to the parser itself. The BOM for UTF16 and the encoding * declaration are looked at and a converter is looked for at that * point. If not found the parser stops here as asked by the XML REC. A * converter can be registered by the user using xmlRegisterCharEncodingHandler * but the current form doesn't allow stateful transcoding (a serious * problem agreed !). If iconv has been found it will be used * automatically and allow stateful transcoding, the simplest is then * to be sure to enable iconv and to provide iconv libs for the encoding * support needed. * * Note that the generic "UTF-16" is not a predefined value. Instead, only * the specific UTF-16LE and UTF-16BE are present. */ typedef enum { XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */ XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */ XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */ XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */ XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */ XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */ XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */ XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */ XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */ XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */ XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */ XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */ XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */ XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */ XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */ XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */ XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */ XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */ XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */ XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */ XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */ XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */ XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */ XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */ } xmlCharEncoding; /** * xmlCharEncodingInputFunc: * @out: a pointer to an array of bytes to store the UTF-8 result * @outlen: the length of @out * @in: a pointer to an array of chars in the original encoding * @inlen: the length of @in * * Take a block of chars in the original encoding and try to convert * it to an UTF-8 block of chars out. * * Returns the number of bytes written, -1 if lack of space, or -2 * if the transcoding failed. * The value of @inlen after return is the number of octets consumed * if the return value is positive, else unpredictiable. * The value of @outlen after return is the number of octets consumed. */ typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen, const unsigned char *in, int *inlen); /** * xmlCharEncodingOutputFunc: * @out: a pointer to an array of bytes to store the result * @outlen: the length of @out * @in: a pointer to an array of UTF-8 chars * @inlen: the length of @in * * Take a block of UTF-8 chars in and try to convert it to another * encoding. * Note: a first call designed to produce heading info is called with * in = NULL. If stateful this should also initialize the encoder state. * * Returns the number of bytes written, -1 if lack of space, or -2 * if the transcoding failed. * The value of @inlen after return is the number of octets consumed * if the return value is positive, else unpredictiable. * The value of @outlen after return is the number of octets produced. */ typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen, const unsigned char *in, int *inlen); /* * Block defining the handlers for non UTF-8 encodings. * If iconv is supported, there are two extra fields. */ #ifdef LIBXML_ICU_ENABLED struct _uconv_t { UConverter *uconv; /* for conversion between an encoding and UTF-16 */ UConverter *utf8; /* for conversion between UTF-8 and UTF-16 */ }; typedef struct _uconv_t uconv_t; #endif typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler; typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr; struct _xmlCharEncodingHandler { char *name; xmlCharEncodingInputFunc input; xmlCharEncodingOutputFunc output; #ifdef LIBXML_ICONV_ENABLED iconv_t iconv_in; iconv_t iconv_out; #endif /* LIBXML_ICONV_ENABLED */ #ifdef LIBXML_ICU_ENABLED uconv_t *uconv_in; uconv_t *uconv_out; #endif /* LIBXML_ICU_ENABLED */ }; #ifdef __cplusplus } #endif #include <libxml/tree.h> #ifdef __cplusplus extern "C" { #endif /* * Interfaces for encoding handlers. */ XMLPUBFUN void XMLCALL xmlInitCharEncodingHandlers (void); XMLPUBFUN void XMLCALL xmlCleanupCharEncodingHandlers (void); XMLPUBFUN void XMLCALL xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler); XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlGetCharEncodingHandler (xmlCharEncoding enc); XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlFindCharEncodingHandler (const char *name); XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlNewCharEncodingHandler (const char *name, xmlCharEncodingInputFunc input, xmlCharEncodingOutputFunc output); /* * Interfaces for encoding names and aliases. */ XMLPUBFUN int XMLCALL xmlAddEncodingAlias (const char *name, const char *alias); XMLPUBFUN int XMLCALL xmlDelEncodingAlias (const char *alias); XMLPUBFUN const char * XMLCALL xmlGetEncodingAlias (const char *alias); XMLPUBFUN void XMLCALL xmlCleanupEncodingAliases (void); XMLPUBFUN xmlCharEncoding XMLCALL xmlParseCharEncoding (const char *name); XMLPUBFUN const char * XMLCALL xmlGetCharEncodingName (xmlCharEncoding enc); /* * Interfaces directly used by the parsers. */ XMLPUBFUN xmlCharEncoding XMLCALL xmlDetectCharEncoding (const unsigned char *in, int len); XMLPUBFUN int XMLCALL xmlCharEncOutFunc (xmlCharEncodingHandler *handler, xmlBufferPtr out, xmlBufferPtr in); XMLPUBFUN int XMLCALL xmlCharEncInFunc (xmlCharEncodingHandler *handler, xmlBufferPtr out, xmlBufferPtr in); XMLPUBFUN int XMLCALL xmlCharEncFirstLine (xmlCharEncodingHandler *handler, xmlBufferPtr out, xmlBufferPtr in); XMLPUBFUN int XMLCALL xmlCharEncCloseFunc (xmlCharEncodingHandler *handler); /* * Export a few useful functions */ #ifdef LIBXML_OUTPUT_ENABLED XMLPUBFUN int XMLCALL UTF8Toisolat1 (unsigned char *out, int *outlen, const unsigned char *in, int *inlen); #endif /* LIBXML_OUTPUT_ENABLED */ XMLPUBFUN int XMLCALL isolat1ToUTF8 (unsigned char *out, int *outlen, const unsigned char *in, int *inlen); #ifdef __cplusplus } #endif #endif /* __XML_CHAR_ENCODING_H__ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/dict.h�������������������������������������������������������������������������������0000644�����������������00000003462�14763166030�0010513 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: string dictionnary * Description: dictionary of reusable strings, just used to avoid allocation * and freeing operations. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_DICT_H__ #define __XML_DICT_H__ #include <limits.h> #include <libxml/xmlversion.h> #include <libxml/tree.h> #ifdef __cplusplus extern "C" { #endif /* * The dictionnary. */ typedef struct _xmlDict xmlDict; typedef xmlDict *xmlDictPtr; /* * Initializer */ XMLPUBFUN int XMLCALL xmlInitializeDict(void); /* * Constructor and destructor. */ XMLPUBFUN xmlDictPtr XMLCALL xmlDictCreate (void); XMLPUBFUN size_t XMLCALL xmlDictSetLimit (xmlDictPtr dict, size_t limit); XMLPUBFUN size_t XMLCALL xmlDictGetUsage (xmlDictPtr dict); XMLPUBFUN xmlDictPtr XMLCALL xmlDictCreateSub(xmlDictPtr sub); XMLPUBFUN int XMLCALL xmlDictReference(xmlDictPtr dict); XMLPUBFUN void XMLCALL xmlDictFree (xmlDictPtr dict); /* * Lookup of entry in the dictionnary. */ XMLPUBFUN const xmlChar * XMLCALL xmlDictLookup (xmlDictPtr dict, const xmlChar *name, int len); XMLPUBFUN const xmlChar * XMLCALL xmlDictExists (xmlDictPtr dict, const xmlChar *name, int len); XMLPUBFUN const xmlChar * XMLCALL xmlDictQLookup (xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name); XMLPUBFUN int XMLCALL xmlDictOwns (xmlDictPtr dict, const xmlChar *str); XMLPUBFUN int XMLCALL xmlDictSize (xmlDictPtr dict); /* * Cleanup function */ XMLPUBFUN void XMLCALL xmlDictCleanup (void); #ifdef __cplusplus } #endif #endif /* ! __XML_DICT_H__ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/xpointer.h���������������������������������������������������������������������������0000644�����������������00000006437�14763166030�0011445 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: API to handle XML Pointers * Description: API to handle XML Pointers * Base implementation was made accordingly to * W3C Candidate Recommendation 7 June 2000 * http://www.w3.org/TR/2000/CR-xptr-20000607 * * Added support for the element() scheme described in: * W3C Proposed Recommendation 13 November 2002 * http://www.w3.org/TR/2002/PR-xptr-element-20021113/ * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XPTR_H__ #define __XML_XPTR_H__ #include <libxml/xmlversion.h> #ifdef LIBXML_XPTR_ENABLED #include <libxml/tree.h> #include <libxml/xpath.h> #ifdef __cplusplus extern "C" { #endif /* * A Location Set */ typedef struct _xmlLocationSet xmlLocationSet; typedef xmlLocationSet *xmlLocationSetPtr; struct _xmlLocationSet { int locNr; /* number of locations in the set */ int locMax; /* size of the array as allocated */ xmlXPathObjectPtr *locTab;/* array of locations */ }; /* * Handling of location sets. */ XMLPUBFUN xmlLocationSetPtr XMLCALL xmlXPtrLocationSetCreate (xmlXPathObjectPtr val); XMLPUBFUN void XMLCALL xmlXPtrFreeLocationSet (xmlLocationSetPtr obj); XMLPUBFUN xmlLocationSetPtr XMLCALL xmlXPtrLocationSetMerge (xmlLocationSetPtr val1, xmlLocationSetPtr val2); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRange (xmlNodePtr start, int startindex, xmlNodePtr end, int endindex); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangePoints (xmlXPathObjectPtr start, xmlXPathObjectPtr end); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangeNodePoint (xmlNodePtr start, xmlXPathObjectPtr end); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangePointNode (xmlXPathObjectPtr start, xmlNodePtr end); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangeNodes (xmlNodePtr start, xmlNodePtr end); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewLocationSetNodes (xmlNodePtr start, xmlNodePtr end); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangeNodeObject (xmlNodePtr start, xmlXPathObjectPtr end); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewCollapsedRange (xmlNodePtr start); XMLPUBFUN void XMLCALL xmlXPtrLocationSetAdd (xmlLocationSetPtr cur, xmlXPathObjectPtr val); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrWrapLocationSet (xmlLocationSetPtr val); XMLPUBFUN void XMLCALL xmlXPtrLocationSetDel (xmlLocationSetPtr cur, xmlXPathObjectPtr val); XMLPUBFUN void XMLCALL xmlXPtrLocationSetRemove (xmlLocationSetPtr cur, int val); /* * Functions. */ XMLPUBFUN xmlXPathContextPtr XMLCALL xmlXPtrNewContext (xmlDocPtr doc, xmlNodePtr here, xmlNodePtr origin); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrEval (const xmlChar *str, xmlXPathContextPtr ctx); XMLPUBFUN void XMLCALL xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt, int nargs); XMLPUBFUN xmlNodePtr XMLCALL xmlXPtrBuildNodeList (xmlXPathObjectPtr obj); XMLPUBFUN void XMLCALL xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt); #ifdef __cplusplus } #endif #endif /* LIBXML_XPTR_ENABLED */ #endif /* __XML_XPTR_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/xmlmemory.h��������������������������������������������������������������������������0000644�����������������00000013471�14763166030�0011622 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: interface for the memory allocator * Description: provides interfaces for the memory allocator, * including debugging capabilities. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __DEBUG_MEMORY_ALLOC__ #define __DEBUG_MEMORY_ALLOC__ #include <stdio.h> #include <libxml/xmlversion.h> /** * DEBUG_MEMORY: * * DEBUG_MEMORY replaces the allocator with a collect and debug * shell to the libc allocator. * DEBUG_MEMORY should only be activated when debugging * libxml i.e. if libxml has been configured with --with-debug-mem too. */ /* #define DEBUG_MEMORY_FREED */ /* #define DEBUG_MEMORY_LOCATION */ #ifdef DEBUG #ifndef DEBUG_MEMORY #define DEBUG_MEMORY #endif #endif /** * DEBUG_MEMORY_LOCATION: * * DEBUG_MEMORY_LOCATION should be activated only when debugging * libxml i.e. if libxml has been configured with --with-debug-mem too. */ #ifdef DEBUG_MEMORY_LOCATION #endif #ifdef __cplusplus extern "C" { #endif /* * The XML memory wrapper support 4 basic overloadable functions. */ /** * xmlFreeFunc: * @mem: an already allocated block of memory * * Signature for a free() implementation. */ typedef void (XMLCALL *xmlFreeFunc)(void *mem); /** * xmlMallocFunc: * @size: the size requested in bytes * * Signature for a malloc() implementation. * * Returns a pointer to the newly allocated block or NULL in case of error. */ typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size); /** * xmlReallocFunc: * @mem: an already allocated block of memory * @size: the new size requested in bytes * * Signature for a realloc() implementation. * * Returns a pointer to the newly reallocated block or NULL in case of error. */ typedef void *(XMLCALL *xmlReallocFunc)(void *mem, size_t size); /** * xmlStrdupFunc: * @str: a zero terminated string * * Signature for an strdup() implementation. * * Returns the copy of the string or NULL in case of error. */ typedef char *(XMLCALL *xmlStrdupFunc)(const char *str); /* * The 4 interfaces used for all memory handling within libxml. LIBXML_DLL_IMPORT xmlFreeFunc xmlFree; LIBXML_DLL_IMPORT xmlMallocFunc xmlMalloc; LIBXML_DLL_IMPORT xmlMallocFunc xmlMallocAtomic; LIBXML_DLL_IMPORT xmlReallocFunc xmlRealloc; LIBXML_DLL_IMPORT xmlStrdupFunc xmlMemStrdup; */ /* * The way to overload the existing functions. * The xmlGc function have an extra entry for atomic block * allocations useful for garbage collected memory allocators */ XMLPUBFUN int XMLCALL xmlMemSetup (xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc); XMLPUBFUN int XMLCALL xmlMemGet (xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc, xmlReallocFunc *reallocFunc, xmlStrdupFunc *strdupFunc); XMLPUBFUN int XMLCALL xmlGcMemSetup (xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, xmlMallocFunc mallocAtomicFunc, xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc); XMLPUBFUN int XMLCALL xmlGcMemGet (xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc, xmlMallocFunc *mallocAtomicFunc, xmlReallocFunc *reallocFunc, xmlStrdupFunc *strdupFunc); /* * Initialization of the memory layer. */ XMLPUBFUN int XMLCALL xmlInitMemory (void); /* * Cleanup of the memory layer. */ XMLPUBFUN void XMLCALL xmlCleanupMemory (void); /* * These are specific to the XML debug memory wrapper. */ XMLPUBFUN int XMLCALL xmlMemUsed (void); XMLPUBFUN int XMLCALL xmlMemBlocks (void); XMLPUBFUN void XMLCALL xmlMemDisplay (FILE *fp); XMLPUBFUN void XMLCALL xmlMemDisplayLast(FILE *fp, long nbBytes); XMLPUBFUN void XMLCALL xmlMemShow (FILE *fp, int nr); XMLPUBFUN void XMLCALL xmlMemoryDump (void); XMLPUBFUN void * XMLCALL xmlMemMalloc (size_t size) LIBXML_ATTR_ALLOC_SIZE(1); XMLPUBFUN void * XMLCALL xmlMemRealloc (void *ptr,size_t size); XMLPUBFUN void XMLCALL xmlMemFree (void *ptr); XMLPUBFUN char * XMLCALL xmlMemoryStrdup (const char *str); XMLPUBFUN void * XMLCALL xmlMallocLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1); XMLPUBFUN void * XMLCALL xmlReallocLoc (void *ptr, size_t size, const char *file, int line); XMLPUBFUN void * XMLCALL xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1); XMLPUBFUN char * XMLCALL xmlMemStrdupLoc (const char *str, const char *file, int line); #ifdef DEBUG_MEMORY_LOCATION /** * xmlMalloc: * @size: number of bytes to allocate * * Wrapper for the malloc() function used in the XML library. * * Returns the pointer to the allocated area or NULL in case of error. */ #define xmlMalloc(size) xmlMallocLoc((size), __FILE__, __LINE__) /** * xmlMallocAtomic: * @size: number of bytes to allocate * * Wrapper for the malloc() function used in the XML library for allocation * of block not containing pointers to other areas. * * Returns the pointer to the allocated area or NULL in case of error. */ #define xmlMallocAtomic(size) xmlMallocAtomicLoc((size), __FILE__, __LINE__) /** * xmlRealloc: * @ptr: pointer to the existing allocated area * @size: number of bytes to allocate * * Wrapper for the realloc() function used in the XML library. * * Returns the pointer to the allocated area or NULL in case of error. */ #define xmlRealloc(ptr, size) xmlReallocLoc((ptr), (size), __FILE__, __LINE__) /** * xmlMemStrdup: * @str: pointer to the existing string * * Wrapper for the strdup() function, xmlStrdup() is usually preferred. * * Returns the pointer to the allocated area or NULL in case of error. */ #define xmlMemStrdup(str) xmlMemStrdupLoc((str), __FILE__, __LINE__) #endif /* DEBUG_MEMORY_LOCATION */ #ifdef __cplusplus } #endif /* __cplusplus */ #ifndef __XML_GLOBALS_H #ifndef __XML_THREADS_H__ #include <libxml/threads.h> #include <libxml/globals.h> #endif #endif #endif /* __DEBUG_MEMORY_ALLOC__ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/xmlexports.h�������������������������������������������������������������������������0000644�����������������00000007520�14763166030�0012014 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: macros for marking symbols as exportable/importable. * Description: macros for marking symbols as exportable/importable. * * Copy: See Copyright for the status of this software. * * Author: Igor Zlatovic <igor@zlatkovic.com> */ #ifndef __XML_EXPORTS_H__ #define __XML_EXPORTS_H__ /** * XMLPUBFUN, XMLPUBVAR, XMLCALL * * Macros which declare an exportable function, an exportable variable and * the calling convention used for functions. * * Please use an extra block for every platform/compiler combination when * modifying this, rather than overlong #ifdef lines. This helps * readability as well as the fact that different compilers on the same * platform might need different definitions. */ /** * XMLPUBFUN: * * Macros which declare an exportable function */ #define XMLPUBFUN /** * XMLPUBVAR: * * Macros which declare an exportable variable */ #define XMLPUBVAR extern /** * XMLCALL: * * Macros which declare the called convention for exported functions */ #define XMLCALL /** * XMLCDECL: * * Macro which declares the calling convention for exported functions that * use '...'. */ #define XMLCDECL /** DOC_DISABLE */ /* Windows platform with MS compiler */ #if defined(_WIN32) && defined(_MSC_VER) #undef XMLPUBFUN #undef XMLPUBVAR #undef XMLCALL #undef XMLCDECL #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) #define XMLPUBFUN __declspec(dllexport) #define XMLPUBVAR __declspec(dllexport) #else #define XMLPUBFUN #if !defined(LIBXML_STATIC) #define XMLPUBVAR __declspec(dllimport) extern #else #define XMLPUBVAR extern #endif #endif #if defined(LIBXML_FASTCALL) #define XMLCALL __fastcall #else #define XMLCALL __cdecl #endif #define XMLCDECL __cdecl #if !defined _REENTRANT #define _REENTRANT #endif #endif /* Windows platform with Borland compiler */ #if defined(_WIN32) && defined(__BORLANDC__) #undef XMLPUBFUN #undef XMLPUBVAR #undef XMLCALL #undef XMLCDECL #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) #define XMLPUBFUN __declspec(dllexport) #define XMLPUBVAR __declspec(dllexport) extern #else #define XMLPUBFUN #if !defined(LIBXML_STATIC) #define XMLPUBVAR __declspec(dllimport) extern #else #define XMLPUBVAR extern #endif #endif #define XMLCALL __cdecl #define XMLCDECL __cdecl #if !defined _REENTRANT #define _REENTRANT #endif #endif /* Windows platform with GNU compiler (Mingw) */ #if defined(_WIN32) && defined(__MINGW32__) #undef XMLPUBFUN #undef XMLPUBVAR #undef XMLCALL #undef XMLCDECL /* * if defined(IN_LIBXML) this raises problems on mingw with msys * _imp__xmlFree listed as missing. Try to workaround the problem * by also making that declaration when compiling client code. */ #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) #define XMLPUBFUN __declspec(dllexport) #define XMLPUBVAR __declspec(dllexport) extern #else #define XMLPUBFUN #if !defined(LIBXML_STATIC) #define XMLPUBVAR __declspec(dllimport) extern #else #define XMLPUBVAR extern #endif #endif #define XMLCALL __cdecl #define XMLCDECL __cdecl #if !defined _REENTRANT #define _REENTRANT #endif #endif /* Cygwin platform, GNU compiler */ #if defined(_WIN32) && defined(__CYGWIN__) #undef XMLPUBFUN #undef XMLPUBVAR #undef XMLCALL #undef XMLCDECL #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) #define XMLPUBFUN __declspec(dllexport) #define XMLPUBVAR __declspec(dllexport) #else #define XMLPUBFUN #if !defined(LIBXML_STATIC) #define XMLPUBVAR __declspec(dllimport) extern #else #define XMLPUBVAR #endif #endif #define XMLCALL __cdecl #define XMLCDECL __cdecl #endif /* Compatibility */ #if !defined(LIBXML_DLL_IMPORT) #define LIBXML_DLL_IMPORT XMLPUBVAR #endif #endif /* __XML_EXPORTS_H__ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/xinclude.h���������������������������������������������������������������������������0000644�����������������00000005627�14763166030�0011410 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: implementation of XInclude * Description: API to handle XInclude processing, * implements the * World Wide Web Consortium Last Call Working Draft 10 November 2003 * http://www.w3.org/TR/2003/WD-xinclude-20031110 * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XINCLUDE_H__ #define __XML_XINCLUDE_H__ #include <libxml/xmlversion.h> #include <libxml/tree.h> #ifdef LIBXML_XINCLUDE_ENABLED #ifdef __cplusplus extern "C" { #endif /** * XINCLUDE_NS: * * Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude */ #define XINCLUDE_NS (const xmlChar *) "http://www.w3.org/2003/XInclude" /** * XINCLUDE_OLD_NS: * * Macro defining the draft Xinclude namespace: http://www.w3.org/2001/XInclude */ #define XINCLUDE_OLD_NS (const xmlChar *) "http://www.w3.org/2001/XInclude" /** * XINCLUDE_NODE: * * Macro defining "include" */ #define XINCLUDE_NODE (const xmlChar *) "include" /** * XINCLUDE_FALLBACK: * * Macro defining "fallback" */ #define XINCLUDE_FALLBACK (const xmlChar *) "fallback" /** * XINCLUDE_HREF: * * Macro defining "href" */ #define XINCLUDE_HREF (const xmlChar *) "href" /** * XINCLUDE_PARSE: * * Macro defining "parse" */ #define XINCLUDE_PARSE (const xmlChar *) "parse" /** * XINCLUDE_PARSE_XML: * * Macro defining "xml" */ #define XINCLUDE_PARSE_XML (const xmlChar *) "xml" /** * XINCLUDE_PARSE_TEXT: * * Macro defining "text" */ #define XINCLUDE_PARSE_TEXT (const xmlChar *) "text" /** * XINCLUDE_PARSE_ENCODING: * * Macro defining "encoding" */ #define XINCLUDE_PARSE_ENCODING (const xmlChar *) "encoding" /** * XINCLUDE_PARSE_XPOINTER: * * Macro defining "xpointer" */ #define XINCLUDE_PARSE_XPOINTER (const xmlChar *) "xpointer" typedef struct _xmlXIncludeCtxt xmlXIncludeCtxt; typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr; /* * standalone processing */ XMLPUBFUN int XMLCALL xmlXIncludeProcess (xmlDocPtr doc); XMLPUBFUN int XMLCALL xmlXIncludeProcessFlags (xmlDocPtr doc, int flags); XMLPUBFUN int XMLCALL xmlXIncludeProcessFlagsData(xmlDocPtr doc, int flags, void *data); XMLPUBFUN int XMLCALL xmlXIncludeProcessTreeFlagsData(xmlNodePtr tree, int flags, void *data); XMLPUBFUN int XMLCALL xmlXIncludeProcessTree (xmlNodePtr tree); XMLPUBFUN int XMLCALL xmlXIncludeProcessTreeFlags(xmlNodePtr tree, int flags); /* * contextual processing */ XMLPUBFUN xmlXIncludeCtxtPtr XMLCALL xmlXIncludeNewContext (xmlDocPtr doc); XMLPUBFUN int XMLCALL xmlXIncludeSetFlags (xmlXIncludeCtxtPtr ctxt, int flags); XMLPUBFUN void XMLCALL xmlXIncludeFreeContext (xmlXIncludeCtxtPtr ctxt); XMLPUBFUN int XMLCALL xmlXIncludeProcessNode (xmlXIncludeCtxtPtr ctxt, xmlNodePtr tree); #ifdef __cplusplus } #endif #endif /* LIBXML_XINCLUDE_ENABLED */ #endif /* __XML_XINCLUDE_H__ */ ���������������������������������������������������������������������������������������������������������libxml2/libxml/xmlsave.h����������������������������������������������������������������������������0000644�����������������00000004441�14763166030�0011245 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: the XML document serializer * Description: API to save document or subtree of document * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XMLSAVE_H__ #define __XML_XMLSAVE_H__ #include <libxml/xmlversion.h> #include <libxml/tree.h> #include <libxml/encoding.h> #include <libxml/xmlIO.h> #ifdef LIBXML_OUTPUT_ENABLED #ifdef __cplusplus extern "C" { #endif /** * xmlSaveOption: * * This is the set of XML save options that can be passed down * to the xmlSaveToFd() and similar calls. */ typedef enum { XML_SAVE_FORMAT = 1<<0, /* format save output */ XML_SAVE_NO_DECL = 1<<1, /* drop the xml declaration */ XML_SAVE_NO_EMPTY = 1<<2, /* no empty tags */ XML_SAVE_NO_XHTML = 1<<3, /* disable XHTML1 specific rules */ XML_SAVE_XHTML = 1<<4, /* force XHTML1 specific rules */ XML_SAVE_AS_XML = 1<<5, /* force XML serialization on HTML doc */ XML_SAVE_AS_HTML = 1<<6, /* force HTML serialization on XML doc */ XML_SAVE_WSNONSIG = 1<<7 /* format with non-significant whitespace */ } xmlSaveOption; typedef struct _xmlSaveCtxt xmlSaveCtxt; typedef xmlSaveCtxt *xmlSaveCtxtPtr; XMLPUBFUN xmlSaveCtxtPtr XMLCALL xmlSaveToFd (int fd, const char *encoding, int options); XMLPUBFUN xmlSaveCtxtPtr XMLCALL xmlSaveToFilename (const char *filename, const char *encoding, int options); XMLPUBFUN xmlSaveCtxtPtr XMLCALL xmlSaveToBuffer (xmlBufferPtr buffer, const char *encoding, int options); XMLPUBFUN xmlSaveCtxtPtr XMLCALL xmlSaveToIO (xmlOutputWriteCallback iowrite, xmlOutputCloseCallback ioclose, void *ioctx, const char *encoding, int options); XMLPUBFUN long XMLCALL xmlSaveDoc (xmlSaveCtxtPtr ctxt, xmlDocPtr doc); XMLPUBFUN long XMLCALL xmlSaveTree (xmlSaveCtxtPtr ctxt, xmlNodePtr node); XMLPUBFUN int XMLCALL xmlSaveFlush (xmlSaveCtxtPtr ctxt); XMLPUBFUN int XMLCALL xmlSaveClose (xmlSaveCtxtPtr ctxt); XMLPUBFUN int XMLCALL xmlSaveSetEscape (xmlSaveCtxtPtr ctxt, xmlCharEncodingOutputFunc escape); XMLPUBFUN int XMLCALL xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt, xmlCharEncodingOutputFunc escape); #ifdef __cplusplus } #endif #endif /* LIBXML_OUTPUT_ENABLED */ #endif /* __XML_XMLSAVE_H__ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/SAX2.h�������������������������������������������������������������������������������0000644�����������������00000011416�14763166030�0010303 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: SAX2 parser interface used to build the DOM tree * Description: those are the default SAX2 interfaces used by * the library when building DOM tree. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_SAX2_H__ #define __XML_SAX2_H__ #include <stdio.h> #include <stdlib.h> #include <libxml/xmlversion.h> #include <libxml/parser.h> #include <libxml/xlink.h> #ifdef __cplusplus extern "C" { #endif XMLPUBFUN const xmlChar * XMLCALL xmlSAX2GetPublicId (void *ctx); XMLPUBFUN const xmlChar * XMLCALL xmlSAX2GetSystemId (void *ctx); XMLPUBFUN void XMLCALL xmlSAX2SetDocumentLocator (void *ctx, xmlSAXLocatorPtr loc); XMLPUBFUN int XMLCALL xmlSAX2GetLineNumber (void *ctx); XMLPUBFUN int XMLCALL xmlSAX2GetColumnNumber (void *ctx); XMLPUBFUN int XMLCALL xmlSAX2IsStandalone (void *ctx); XMLPUBFUN int XMLCALL xmlSAX2HasInternalSubset (void *ctx); XMLPUBFUN int XMLCALL xmlSAX2HasExternalSubset (void *ctx); XMLPUBFUN void XMLCALL xmlSAX2InternalSubset (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); XMLPUBFUN void XMLCALL xmlSAX2ExternalSubset (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); XMLPUBFUN xmlEntityPtr XMLCALL xmlSAX2GetEntity (void *ctx, const xmlChar *name); XMLPUBFUN xmlEntityPtr XMLCALL xmlSAX2GetParameterEntity (void *ctx, const xmlChar *name); XMLPUBFUN xmlParserInputPtr XMLCALL xmlSAX2ResolveEntity (void *ctx, const xmlChar *publicId, const xmlChar *systemId); XMLPUBFUN void XMLCALL xmlSAX2EntityDecl (void *ctx, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content); XMLPUBFUN void XMLCALL xmlSAX2AttributeDecl (void *ctx, const xmlChar *elem, const xmlChar *fullname, int type, int def, const xmlChar *defaultValue, xmlEnumerationPtr tree); XMLPUBFUN void XMLCALL xmlSAX2ElementDecl (void *ctx, const xmlChar *name, int type, xmlElementContentPtr content); XMLPUBFUN void XMLCALL xmlSAX2NotationDecl (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId); XMLPUBFUN void XMLCALL xmlSAX2UnparsedEntityDecl (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName); XMLPUBFUN void XMLCALL xmlSAX2StartDocument (void *ctx); XMLPUBFUN void XMLCALL xmlSAX2EndDocument (void *ctx); #if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) XMLPUBFUN void XMLCALL xmlSAX2StartElement (void *ctx, const xmlChar *fullname, const xmlChar **atts); XMLPUBFUN void XMLCALL xmlSAX2EndElement (void *ctx, const xmlChar *name); #endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED */ XMLPUBFUN void XMLCALL xmlSAX2StartElementNs (void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, const xmlChar **attributes); XMLPUBFUN void XMLCALL xmlSAX2EndElementNs (void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI); XMLPUBFUN void XMLCALL xmlSAX2Reference (void *ctx, const xmlChar *name); XMLPUBFUN void XMLCALL xmlSAX2Characters (void *ctx, const xmlChar *ch, int len); XMLPUBFUN void XMLCALL xmlSAX2IgnorableWhitespace (void *ctx, const xmlChar *ch, int len); XMLPUBFUN void XMLCALL xmlSAX2ProcessingInstruction (void *ctx, const xmlChar *target, const xmlChar *data); XMLPUBFUN void XMLCALL xmlSAX2Comment (void *ctx, const xmlChar *value); XMLPUBFUN void XMLCALL xmlSAX2CDataBlock (void *ctx, const xmlChar *value, int len); #ifdef LIBXML_SAX1_ENABLED XMLPUBFUN int XMLCALL xmlSAXDefaultVersion (int version); #endif /* LIBXML_SAX1_ENABLED */ XMLPUBFUN int XMLCALL xmlSAXVersion (xmlSAXHandler *hdlr, int version); XMLPUBFUN void XMLCALL xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr, int warning); #ifdef LIBXML_HTML_ENABLED XMLPUBFUN void XMLCALL xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr); XMLPUBFUN void XMLCALL htmlDefaultSAXHandlerInit (void); #endif #ifdef LIBXML_DOCB_ENABLED XMLPUBFUN void XMLCALL xmlSAX2InitDocbDefaultSAXHandler(xmlSAXHandler *hdlr); XMLPUBFUN void XMLCALL docbDefaultSAXHandlerInit (void); #endif XMLPUBFUN void XMLCALL xmlDefaultSAXHandlerInit (void); #ifdef __cplusplus } #endif #endif /* __XML_SAX2_H__ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/xmlschemas.h�������������������������������������������������������������������������0000644�����������������00000015635�14763166030�0011741 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: incomplete XML Schemas structure implementation * Description: interface to the XML Schemas handling and schema validity * checking, it is incomplete right now. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_SCHEMA_H__ #define __XML_SCHEMA_H__ #include <libxml/xmlversion.h> #ifdef LIBXML_SCHEMAS_ENABLED #include <libxml/tree.h> #ifdef __cplusplus extern "C" { #endif /** * This error codes are obsolete; not used any more. */ typedef enum { XML_SCHEMAS_ERR_OK = 0, XML_SCHEMAS_ERR_NOROOT = 1, XML_SCHEMAS_ERR_UNDECLAREDELEM, XML_SCHEMAS_ERR_NOTTOPLEVEL, XML_SCHEMAS_ERR_MISSING, XML_SCHEMAS_ERR_WRONGELEM, XML_SCHEMAS_ERR_NOTYPE, XML_SCHEMAS_ERR_NOROLLBACK, XML_SCHEMAS_ERR_ISABSTRACT, XML_SCHEMAS_ERR_NOTEMPTY, XML_SCHEMAS_ERR_ELEMCONT, XML_SCHEMAS_ERR_HAVEDEFAULT, XML_SCHEMAS_ERR_NOTNILLABLE, XML_SCHEMAS_ERR_EXTRACONTENT, XML_SCHEMAS_ERR_INVALIDATTR, XML_SCHEMAS_ERR_INVALIDELEM, XML_SCHEMAS_ERR_NOTDETERMINIST, XML_SCHEMAS_ERR_CONSTRUCT, XML_SCHEMAS_ERR_INTERNAL, XML_SCHEMAS_ERR_NOTSIMPLE, XML_SCHEMAS_ERR_ATTRUNKNOWN, XML_SCHEMAS_ERR_ATTRINVALID, XML_SCHEMAS_ERR_VALUE, XML_SCHEMAS_ERR_FACET, XML_SCHEMAS_ERR_, XML_SCHEMAS_ERR_XXX } xmlSchemaValidError; /* * ATTENTION: Change xmlSchemaSetValidOptions's check * for invalid values, if adding to the validation * options below. */ /** * xmlSchemaValidOption: * * This is the set of XML Schema validation options. */ typedef enum { XML_SCHEMA_VAL_VC_I_CREATE = 1<<0 /* Default/fixed: create an attribute node * or an element's text node on the instance. */ } xmlSchemaValidOption; /* XML_SCHEMA_VAL_XSI_ASSEMBLE = 1<<1, * assemble schemata using * xsi:schemaLocation and * xsi:noNamespaceSchemaLocation */ /** * The schemas related types are kept internal */ typedef struct _xmlSchema xmlSchema; typedef xmlSchema *xmlSchemaPtr; /** * xmlSchemaValidityErrorFunc: * @ctx: the validation context * @msg: the message * @...: extra arguments * * Signature of an error callback from an XSD validation */ typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); /** * xmlSchemaValidityWarningFunc: * @ctx: the validation context * @msg: the message * @...: extra arguments * * Signature of a warning callback from an XSD validation */ typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); /** * A schemas validation context */ typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt; typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr; typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt; typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr; /** * xmlSchemaValidityLocatorFunc: * @ctx: user provided context * @file: returned file information * @line: returned line information * * A schemas validation locator, a callback called by the validator. * This is used when file or node informations are not available * to find out what file and line number are affected * * Returns: 0 in case of success and -1 in case of error */ typedef int (XMLCDECL *xmlSchemaValidityLocatorFunc) (void *ctx, const char **file, unsigned long *line); /* * Interfaces for parsing. */ XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL xmlSchemaNewParserCtxt (const char *URL); XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL xmlSchemaNewMemParserCtxt (const char *buffer, int size); XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL xmlSchemaNewDocParserCtxt (xmlDocPtr doc); XMLPUBFUN void XMLCALL xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt, xmlSchemaValidityErrorFunc err, xmlSchemaValidityWarningFunc warn, void *ctx); XMLPUBFUN void XMLCALL xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt, xmlStructuredErrorFunc serror, void *ctx); XMLPUBFUN int XMLCALL xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt, xmlSchemaValidityErrorFunc * err, xmlSchemaValidityWarningFunc * warn, void **ctx); XMLPUBFUN int XMLCALL xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt); XMLPUBFUN xmlSchemaPtr XMLCALL xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlSchemaFree (xmlSchemaPtr schema); #ifdef LIBXML_OUTPUT_ENABLED XMLPUBFUN void XMLCALL xmlSchemaDump (FILE *output, xmlSchemaPtr schema); #endif /* LIBXML_OUTPUT_ENABLED */ /* * Interfaces for validating */ XMLPUBFUN void XMLCALL xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt, xmlSchemaValidityErrorFunc err, xmlSchemaValidityWarningFunc warn, void *ctx); XMLPUBFUN void XMLCALL xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt, xmlStructuredErrorFunc serror, void *ctx); XMLPUBFUN int XMLCALL xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt, xmlSchemaValidityErrorFunc *err, xmlSchemaValidityWarningFunc *warn, void **ctx); XMLPUBFUN int XMLCALL xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt, int options); XMLPUBFUN void XMLCALL xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt, const char *filename); XMLPUBFUN int XMLCALL xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt); XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL xmlSchemaNewValidCtxt (xmlSchemaPtr schema); XMLPUBFUN void XMLCALL xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt); XMLPUBFUN int XMLCALL xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt, xmlDocPtr instance); XMLPUBFUN int XMLCALL xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt, xmlNodePtr elem); XMLPUBFUN int XMLCALL xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt, xmlParserInputBufferPtr input, xmlCharEncoding enc, xmlSAXHandlerPtr sax, void *user_data); XMLPUBFUN int XMLCALL xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt, const char * filename, int options); XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt); /* * Interface to insert Schemas SAX validation in a SAX stream */ typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct; typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr; XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt, xmlSAXHandlerPtr *sax, void **user_data); XMLPUBFUN int XMLCALL xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug); XMLPUBFUN void XMLCALL xmlSchemaValidateSetLocator (xmlSchemaValidCtxtPtr vctxt, xmlSchemaValidityLocatorFunc f, void *ctxt); #ifdef __cplusplus } #endif #endif /* LIBXML_SCHEMAS_ENABLED */ #endif /* __XML_SCHEMA_H__ */ ���������������������������������������������������������������������������������������������������libxml2/libxml/xlink.h������������������������������������������������������������������������������0000644�����������������00000011660�14763166030�0010714 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: unfinished XLink detection module * Description: unfinished XLink detection module * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XLINK_H__ #define __XML_XLINK_H__ #include <libxml/xmlversion.h> #include <libxml/tree.h> #ifdef LIBXML_XPTR_ENABLED #ifdef __cplusplus extern "C" { #endif /** * Various defines for the various Link properties. * * NOTE: the link detection layer will try to resolve QName expansion * of namespaces. If "foo" is the prefix for "http://foo.com/" * then the link detection layer will expand role="foo:myrole" * to "http://foo.com/:myrole". * NOTE: the link detection layer will expand URI-Refences found on * href attributes by using the base mechanism if found. */ typedef xmlChar *xlinkHRef; typedef xmlChar *xlinkRole; typedef xmlChar *xlinkTitle; typedef enum { XLINK_TYPE_NONE = 0, XLINK_TYPE_SIMPLE, XLINK_TYPE_EXTENDED, XLINK_TYPE_EXTENDED_SET } xlinkType; typedef enum { XLINK_SHOW_NONE = 0, XLINK_SHOW_NEW, XLINK_SHOW_EMBED, XLINK_SHOW_REPLACE } xlinkShow; typedef enum { XLINK_ACTUATE_NONE = 0, XLINK_ACTUATE_AUTO, XLINK_ACTUATE_ONREQUEST } xlinkActuate; /** * xlinkNodeDetectFunc: * @ctx: user data pointer * @node: the node to check * * This is the prototype for the link detection routine. * It calls the default link detection callbacks upon link detection. */ typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node); /* * The link detection module interact with the upper layers using * a set of callback registered at parsing time. */ /** * xlinkSimpleLinkFunk: * @ctx: user data pointer * @node: the node carrying the link * @href: the target of the link * @role: the role string * @title: the link title * * This is the prototype for a simple link detection callback. */ typedef void (*xlinkSimpleLinkFunk) (void *ctx, xmlNodePtr node, const xlinkHRef href, const xlinkRole role, const xlinkTitle title); /** * xlinkExtendedLinkFunk: * @ctx: user data pointer * @node: the node carrying the link * @nbLocators: the number of locators detected on the link * @hrefs: pointer to the array of locator hrefs * @roles: pointer to the array of locator roles * @nbArcs: the number of arcs detected on the link * @from: pointer to the array of source roles found on the arcs * @to: pointer to the array of target roles found on the arcs * @show: array of values for the show attributes found on the arcs * @actuate: array of values for the actuate attributes found on the arcs * @nbTitles: the number of titles detected on the link * @title: array of titles detected on the link * @langs: array of xml:lang values for the titles * * This is the prototype for a extended link detection callback. */ typedef void (*xlinkExtendedLinkFunk)(void *ctx, xmlNodePtr node, int nbLocators, const xlinkHRef *hrefs, const xlinkRole *roles, int nbArcs, const xlinkRole *from, const xlinkRole *to, xlinkShow *show, xlinkActuate *actuate, int nbTitles, const xlinkTitle *titles, const xmlChar **langs); /** * xlinkExtendedLinkSetFunk: * @ctx: user data pointer * @node: the node carrying the link * @nbLocators: the number of locators detected on the link * @hrefs: pointer to the array of locator hrefs * @roles: pointer to the array of locator roles * @nbTitles: the number of titles detected on the link * @title: array of titles detected on the link * @langs: array of xml:lang values for the titles * * This is the prototype for a extended link set detection callback. */ typedef void (*xlinkExtendedLinkSetFunk) (void *ctx, xmlNodePtr node, int nbLocators, const xlinkHRef *hrefs, const xlinkRole *roles, int nbTitles, const xlinkTitle *titles, const xmlChar **langs); /** * This is the structure containing a set of Links detection callbacks. * * There is no default xlink callbacks, if one want to get link * recognition activated, those call backs must be provided before parsing. */ typedef struct _xlinkHandler xlinkHandler; typedef xlinkHandler *xlinkHandlerPtr; struct _xlinkHandler { xlinkSimpleLinkFunk simple; xlinkExtendedLinkFunk extended; xlinkExtendedLinkSetFunk set; }; /* * The default detection routine, can be overridden, they call the default * detection callbacks. */ XMLPUBFUN xlinkNodeDetectFunc XMLCALL xlinkGetDefaultDetect (void); XMLPUBFUN void XMLCALL xlinkSetDefaultDetect (xlinkNodeDetectFunc func); /* * Routines to set/get the default handlers. */ XMLPUBFUN xlinkHandlerPtr XMLCALL xlinkGetDefaultHandler (void); XMLPUBFUN void XMLCALL xlinkSetDefaultHandler (xlinkHandlerPtr handler); /* * Link detection module itself. */ XMLPUBFUN xlinkType XMLCALL xlinkIsLink (xmlDocPtr doc, xmlNodePtr node); #ifdef __cplusplus } #endif #endif /* LIBXML_XPTR_ENABLED */ #endif /* __XML_XLINK_H__ */ ��������������������������������������������������������������������������������libxml2/libxml/xmlschemastypes.h��������������������������������������������������������������������0000644�����������������00000011351�14763166030�0013015 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: implementation of XML Schema Datatypes * Description: module providing the XML Schema Datatypes implementation * both definition and validity checking * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_SCHEMA_TYPES_H__ #define __XML_SCHEMA_TYPES_H__ #include <libxml/xmlversion.h> #ifdef LIBXML_SCHEMAS_ENABLED #include <libxml/schemasInternals.h> #include <libxml/xmlschemas.h> #ifdef __cplusplus extern "C" { #endif typedef enum { XML_SCHEMA_WHITESPACE_UNKNOWN = 0, XML_SCHEMA_WHITESPACE_PRESERVE = 1, XML_SCHEMA_WHITESPACE_REPLACE = 2, XML_SCHEMA_WHITESPACE_COLLAPSE = 3 } xmlSchemaWhitespaceValueType; XMLPUBFUN void XMLCALL xmlSchemaInitTypes (void); XMLPUBFUN void XMLCALL xmlSchemaCleanupTypes (void); XMLPUBFUN xmlSchemaTypePtr XMLCALL xmlSchemaGetPredefinedType (const xmlChar *name, const xmlChar *ns); XMLPUBFUN int XMLCALL xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type, const xmlChar *value, xmlSchemaValPtr *val); XMLPUBFUN int XMLCALL xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type, const xmlChar *value, xmlSchemaValPtr *val, xmlNodePtr node); XMLPUBFUN int XMLCALL xmlSchemaValidateFacet (xmlSchemaTypePtr base, xmlSchemaFacetPtr facet, const xmlChar *value, xmlSchemaValPtr val); XMLPUBFUN int XMLCALL xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet, xmlSchemaWhitespaceValueType fws, xmlSchemaValType valType, const xmlChar *value, xmlSchemaValPtr val, xmlSchemaWhitespaceValueType ws); XMLPUBFUN void XMLCALL xmlSchemaFreeValue (xmlSchemaValPtr val); XMLPUBFUN xmlSchemaFacetPtr XMLCALL xmlSchemaNewFacet (void); XMLPUBFUN int XMLCALL xmlSchemaCheckFacet (xmlSchemaFacetPtr facet, xmlSchemaTypePtr typeDecl, xmlSchemaParserCtxtPtr ctxt, const xmlChar *name); XMLPUBFUN void XMLCALL xmlSchemaFreeFacet (xmlSchemaFacetPtr facet); XMLPUBFUN int XMLCALL xmlSchemaCompareValues (xmlSchemaValPtr x, xmlSchemaValPtr y); XMLPUBFUN xmlSchemaTypePtr XMLCALL xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type); XMLPUBFUN int XMLCALL xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet, const xmlChar *value, unsigned long actualLen, unsigned long *expectedLen); XMLPUBFUN xmlSchemaTypePtr XMLCALL xmlSchemaGetBuiltInType (xmlSchemaValType type); XMLPUBFUN int XMLCALL xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type, int facetType); XMLPUBFUN xmlChar * XMLCALL xmlSchemaCollapseString (const xmlChar *value); XMLPUBFUN xmlChar * XMLCALL xmlSchemaWhiteSpaceReplace (const xmlChar *value); XMLPUBFUN unsigned long XMLCALL xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet); XMLPUBFUN int XMLCALL xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type, xmlSchemaFacetPtr facet, const xmlChar *value, xmlSchemaValPtr val, unsigned long *length); XMLPUBFUN int XMLCALL xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet, xmlSchemaValType valType, const xmlChar *value, xmlSchemaValPtr val, unsigned long *length, xmlSchemaWhitespaceValueType ws); XMLPUBFUN int XMLCALL xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type, const xmlChar *value, xmlSchemaValPtr *val, xmlNodePtr node); XMLPUBFUN int XMLCALL xmlSchemaGetCanonValue (xmlSchemaValPtr val, const xmlChar **retValue); XMLPUBFUN int XMLCALL xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val, const xmlChar **retValue, xmlSchemaWhitespaceValueType ws); XMLPUBFUN int XMLCALL xmlSchemaValueAppend (xmlSchemaValPtr prev, xmlSchemaValPtr cur); XMLPUBFUN xmlSchemaValPtr XMLCALL xmlSchemaValueGetNext (xmlSchemaValPtr cur); XMLPUBFUN const xmlChar * XMLCALL xmlSchemaValueGetAsString (xmlSchemaValPtr val); XMLPUBFUN int XMLCALL xmlSchemaValueGetAsBoolean (xmlSchemaValPtr val); XMLPUBFUN xmlSchemaValPtr XMLCALL xmlSchemaNewStringValue (xmlSchemaValType type, const xmlChar *value); XMLPUBFUN xmlSchemaValPtr XMLCALL xmlSchemaNewNOTATIONValue (const xmlChar *name, const xmlChar *ns); XMLPUBFUN xmlSchemaValPtr XMLCALL xmlSchemaNewQNameValue (const xmlChar *namespaceName, const xmlChar *localName); XMLPUBFUN int XMLCALL xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x, xmlSchemaWhitespaceValueType xws, xmlSchemaValPtr y, xmlSchemaWhitespaceValueType yws); XMLPUBFUN xmlSchemaValPtr XMLCALL xmlSchemaCopyValue (xmlSchemaValPtr val); XMLPUBFUN xmlSchemaValType XMLCALL xmlSchemaGetValType (xmlSchemaValPtr val); #ifdef __cplusplus } #endif #endif /* LIBXML_SCHEMAS_ENABLED */ #endif /* __XML_SCHEMA_TYPES_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/xmlregexp.h��������������������������������������������������������������������������0000644�����������������00000012522�14763166030�0011600 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: regular expressions handling * Description: basic API for libxml regular expressions handling used * for XML Schemas and validation. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_REGEXP_H__ #define __XML_REGEXP_H__ #include <libxml/xmlversion.h> #ifdef LIBXML_REGEXP_ENABLED #ifdef __cplusplus extern "C" { #endif /** * xmlRegexpPtr: * * A libxml regular expression, they can actually be far more complex * thank the POSIX regex expressions. */ typedef struct _xmlRegexp xmlRegexp; typedef xmlRegexp *xmlRegexpPtr; /** * xmlRegExecCtxtPtr: * * A libxml progressive regular expression evaluation context */ typedef struct _xmlRegExecCtxt xmlRegExecCtxt; typedef xmlRegExecCtxt *xmlRegExecCtxtPtr; #ifdef __cplusplus } #endif #include <libxml/tree.h> #include <libxml/dict.h> #ifdef __cplusplus extern "C" { #endif /* * The POSIX like API */ XMLPUBFUN xmlRegexpPtr XMLCALL xmlRegexpCompile (const xmlChar *regexp); XMLPUBFUN void XMLCALL xmlRegFreeRegexp(xmlRegexpPtr regexp); XMLPUBFUN int XMLCALL xmlRegexpExec (xmlRegexpPtr comp, const xmlChar *value); XMLPUBFUN void XMLCALL xmlRegexpPrint (FILE *output, xmlRegexpPtr regexp); XMLPUBFUN int XMLCALL xmlRegexpIsDeterminist(xmlRegexpPtr comp); /** * xmlRegExecCallbacks: * @exec: the regular expression context * @token: the current token string * @transdata: transition data * @inputdata: input data * * Callback function when doing a transition in the automata */ typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec, const xmlChar *token, void *transdata, void *inputdata); /* * The progressive API */ XMLPUBFUN xmlRegExecCtxtPtr XMLCALL xmlRegNewExecCtxt (xmlRegexpPtr comp, xmlRegExecCallbacks callback, void *data); XMLPUBFUN void XMLCALL xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec); XMLPUBFUN int XMLCALL xmlRegExecPushString(xmlRegExecCtxtPtr exec, const xmlChar *value, void *data); XMLPUBFUN int XMLCALL xmlRegExecPushString2(xmlRegExecCtxtPtr exec, const xmlChar *value, const xmlChar *value2, void *data); XMLPUBFUN int XMLCALL xmlRegExecNextValues(xmlRegExecCtxtPtr exec, int *nbval, int *nbneg, xmlChar **values, int *terminal); XMLPUBFUN int XMLCALL xmlRegExecErrInfo (xmlRegExecCtxtPtr exec, const xmlChar **string, int *nbval, int *nbneg, xmlChar **values, int *terminal); #ifdef LIBXML_EXPR_ENABLED /* * Formal regular expression handling * Its goal is to do some formal work on content models */ /* expressions are used within a context */ typedef struct _xmlExpCtxt xmlExpCtxt; typedef xmlExpCtxt *xmlExpCtxtPtr; XMLPUBFUN void XMLCALL xmlExpFreeCtxt (xmlExpCtxtPtr ctxt); XMLPUBFUN xmlExpCtxtPtr XMLCALL xmlExpNewCtxt (int maxNodes, xmlDictPtr dict); XMLPUBFUN int XMLCALL xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt); XMLPUBFUN int XMLCALL xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt); /* Expressions are trees but the tree is opaque */ typedef struct _xmlExpNode xmlExpNode; typedef xmlExpNode *xmlExpNodePtr; typedef enum { XML_EXP_EMPTY = 0, XML_EXP_FORBID = 1, XML_EXP_ATOM = 2, XML_EXP_SEQ = 3, XML_EXP_OR = 4, XML_EXP_COUNT = 5 } xmlExpNodeType; /* * 2 core expressions shared by all for the empty language set * and for the set with just the empty token */ XMLPUBVAR xmlExpNodePtr forbiddenExp; XMLPUBVAR xmlExpNodePtr emptyExp; /* * Expressions are reference counted internally */ XMLPUBFUN void XMLCALL xmlExpFree (xmlExpCtxtPtr ctxt, xmlExpNodePtr expr); XMLPUBFUN void XMLCALL xmlExpRef (xmlExpNodePtr expr); /* * constructors can be either manual or from a string */ XMLPUBFUN xmlExpNodePtr XMLCALL xmlExpParse (xmlExpCtxtPtr ctxt, const char *expr); XMLPUBFUN xmlExpNodePtr XMLCALL xmlExpNewAtom (xmlExpCtxtPtr ctxt, const xmlChar *name, int len); XMLPUBFUN xmlExpNodePtr XMLCALL xmlExpNewOr (xmlExpCtxtPtr ctxt, xmlExpNodePtr left, xmlExpNodePtr right); XMLPUBFUN xmlExpNodePtr XMLCALL xmlExpNewSeq (xmlExpCtxtPtr ctxt, xmlExpNodePtr left, xmlExpNodePtr right); XMLPUBFUN xmlExpNodePtr XMLCALL xmlExpNewRange (xmlExpCtxtPtr ctxt, xmlExpNodePtr subset, int min, int max); /* * The really interesting APIs */ XMLPUBFUN int XMLCALL xmlExpIsNillable(xmlExpNodePtr expr); XMLPUBFUN int XMLCALL xmlExpMaxToken (xmlExpNodePtr expr); XMLPUBFUN int XMLCALL xmlExpGetLanguage(xmlExpCtxtPtr ctxt, xmlExpNodePtr expr, const xmlChar**langList, int len); XMLPUBFUN int XMLCALL xmlExpGetStart (xmlExpCtxtPtr ctxt, xmlExpNodePtr expr, const xmlChar**tokList, int len); XMLPUBFUN xmlExpNodePtr XMLCALL xmlExpStringDerive(xmlExpCtxtPtr ctxt, xmlExpNodePtr expr, const xmlChar *str, int len); XMLPUBFUN xmlExpNodePtr XMLCALL xmlExpExpDerive (xmlExpCtxtPtr ctxt, xmlExpNodePtr expr, xmlExpNodePtr sub); XMLPUBFUN int XMLCALL xmlExpSubsume (xmlExpCtxtPtr ctxt, xmlExpNodePtr expr, xmlExpNodePtr sub); XMLPUBFUN void XMLCALL xmlExpDump (xmlBufferPtr buf, xmlExpNodePtr expr); #endif /* LIBXML_EXPR_ENABLED */ #ifdef __cplusplus } #endif #endif /* LIBXML_REGEXP_ENABLED */ #endif /*__XML_REGEXP_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/parserInternals.h��������������������������������������������������������������������0000644�����������������00000042012�14763166030�0012736 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: internals routines and limits exported by the parser. * Description: this module exports a number of internal parsing routines * they are not really all intended for applications but * can prove useful doing low level processing. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_PARSER_INTERNALS_H__ #define __XML_PARSER_INTERNALS_H__ #include <libxml/xmlversion.h> #include <libxml/parser.h> #include <libxml/HTMLparser.h> #include <libxml/chvalid.h> #ifdef __cplusplus extern "C" { #endif /** * xmlParserMaxDepth: * * arbitrary depth limit for the XML documents that we allow to * process. This is not a limitation of the parser but a safety * boundary feature, use XML_PARSE_HUGE option to override it. */ XMLPUBVAR unsigned int xmlParserMaxDepth; /** * XML_MAX_TEXT_LENGTH: * * Maximum size allowed for a single text node when building a tree. * This is not a limitation of the parser but a safety boundary feature, * use XML_PARSE_HUGE option to override it. * Introduced in 2.9.0 */ #define XML_MAX_TEXT_LENGTH 10000000 /** * XML_MAX_NAME_LENGTH: * * Maximum size allowed for a markup identitier * This is not a limitation of the parser but a safety boundary feature, * use XML_PARSE_HUGE option to override it. * Note that with the use of parsing dictionaries overriding the limit * may result in more runtime memory usage in face of "unfriendly' content * Introduced in 2.9.0 */ #define XML_MAX_NAME_LENGTH 50000 /** * XML_MAX_DICTIONARY_LIMIT: * * Maximum size allowed by the parser for a dictionary by default * This is not a limitation of the parser but a safety boundary feature, * use XML_PARSE_HUGE option to override it. * Introduced in 2.9.0 */ #define XML_MAX_DICTIONARY_LIMIT 10000000 /** * XML_MAX_LOOKUP_LIMIT: * * Maximum size allowed by the parser for ahead lookup * This is an upper boundary enforced by the parser to avoid bad * behaviour on "unfriendly' content * Introduced in 2.9.0 */ #define XML_MAX_LOOKUP_LIMIT 10000000 /** * XML_MAX_NAMELEN: * * Identifiers can be longer, but this will be more costly * at runtime. */ #define XML_MAX_NAMELEN 100 /** * INPUT_CHUNK: * * The parser tries to always have that amount of input ready. * One of the point is providing context when reporting errors. */ #define INPUT_CHUNK 250 /************************************************************************ * * * UNICODE version of the macros. * * * ************************************************************************/ /** * IS_BYTE_CHAR: * @c: an byte value (int) * * Macro to check the following production in the XML spec: * * [2] Char ::= #x9 | #xA | #xD | [#x20...] * any byte character in the accepted range */ #define IS_BYTE_CHAR(c) xmlIsChar_ch(c) /** * IS_CHAR: * @c: an UNICODE value (int) * * Macro to check the following production in the XML spec: * * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] * | [#x10000-#x10FFFF] * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */ #define IS_CHAR(c) xmlIsCharQ(c) /** * IS_CHAR_CH: * @c: an xmlChar (usually an unsigned char) * * Behaves like IS_CHAR on single-byte value */ #define IS_CHAR_CH(c) xmlIsChar_ch(c) /** * IS_BLANK: * @c: an UNICODE value (int) * * Macro to check the following production in the XML spec: * * [3] S ::= (#x20 | #x9 | #xD | #xA)+ */ #define IS_BLANK(c) xmlIsBlankQ(c) /** * IS_BLANK_CH: * @c: an xmlChar value (normally unsigned char) * * Behaviour same as IS_BLANK */ #define IS_BLANK_CH(c) xmlIsBlank_ch(c) /** * IS_BASECHAR: * @c: an UNICODE value (int) * * Macro to check the following production in the XML spec: * * [85] BaseChar ::= ... long list see REC ... */ #define IS_BASECHAR(c) xmlIsBaseCharQ(c) /** * IS_DIGIT: * @c: an UNICODE value (int) * * Macro to check the following production in the XML spec: * * [88] Digit ::= ... long list see REC ... */ #define IS_DIGIT(c) xmlIsDigitQ(c) /** * IS_DIGIT_CH: * @c: an xmlChar value (usually an unsigned char) * * Behaves like IS_DIGIT but with a single byte argument */ #define IS_DIGIT_CH(c) xmlIsDigit_ch(c) /** * IS_COMBINING: * @c: an UNICODE value (int) * * Macro to check the following production in the XML spec: * * [87] CombiningChar ::= ... long list see REC ... */ #define IS_COMBINING(c) xmlIsCombiningQ(c) /** * IS_COMBINING_CH: * @c: an xmlChar (usually an unsigned char) * * Always false (all combining chars > 0xff) */ #define IS_COMBINING_CH(c) 0 /** * IS_EXTENDER: * @c: an UNICODE value (int) * * Macro to check the following production in the XML spec: * * * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] | * [#x309D-#x309E] | [#x30FC-#x30FE] */ #define IS_EXTENDER(c) xmlIsExtenderQ(c) /** * IS_EXTENDER_CH: * @c: an xmlChar value (usually an unsigned char) * * Behaves like IS_EXTENDER but with a single-byte argument */ #define IS_EXTENDER_CH(c) xmlIsExtender_ch(c) /** * IS_IDEOGRAPHIC: * @c: an UNICODE value (int) * * Macro to check the following production in the XML spec: * * * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029] */ #define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c) /** * IS_LETTER: * @c: an UNICODE value (int) * * Macro to check the following production in the XML spec: * * * [84] Letter ::= BaseChar | Ideographic */ #define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c)) /** * IS_LETTER_CH: * @c: an xmlChar value (normally unsigned char) * * Macro behaves like IS_LETTER, but only check base chars * */ #define IS_LETTER_CH(c) xmlIsBaseChar_ch(c) /** * IS_ASCII_LETTER: * @c: an xmlChar value * * Macro to check [a-zA-Z] * */ #define IS_ASCII_LETTER(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ ((0x61 <= (c)) && ((c) <= 0x7a))) /** * IS_ASCII_DIGIT: * @c: an xmlChar value * * Macro to check [0-9] * */ #define IS_ASCII_DIGIT(c) ((0x30 <= (c)) && ((c) <= 0x39)) /** * IS_PUBIDCHAR: * @c: an UNICODE value (int) * * Macro to check the following production in the XML spec: * * * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] */ #define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c) /** * IS_PUBIDCHAR_CH: * @c: an xmlChar value (normally unsigned char) * * Same as IS_PUBIDCHAR but for single-byte value */ #define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c) /** * SKIP_EOL: * @p: and UTF8 string pointer * * Skips the end of line chars. */ #define SKIP_EOL(p) \ if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \ if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; } /** * MOVETO_ENDTAG: * @p: and UTF8 string pointer * * Skips to the next '>' char. */ #define MOVETO_ENDTAG(p) \ while ((*p) && (*(p) != '>')) (p)++ /** * MOVETO_STARTTAG: * @p: and UTF8 string pointer * * Skips to the next '<' char. */ #define MOVETO_STARTTAG(p) \ while ((*p) && (*(p) != '<')) (p)++ /** * Global variables used for predefined strings. */ XMLPUBVAR const xmlChar xmlStringText[]; XMLPUBVAR const xmlChar xmlStringTextNoenc[]; XMLPUBVAR const xmlChar xmlStringComment[]; /* * Function to finish the work of the macros where needed. */ XMLPUBFUN int XMLCALL xmlIsLetter (int c); /** * Parser context. */ XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlCreateFileParserCtxt (const char *filename); XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlCreateURLParserCtxt (const char *filename, int options); XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlCreateMemoryParserCtxt(const char *buffer, int size); XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlCreateEntityParserCtxt(const xmlChar *URL, const xmlChar *ID, const xmlChar *base); XMLPUBFUN int XMLCALL xmlSwitchEncoding (xmlParserCtxtPtr ctxt, xmlCharEncoding enc); XMLPUBFUN int XMLCALL xmlSwitchToEncoding (xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler); XMLPUBFUN int XMLCALL xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt, xmlParserInputPtr input, xmlCharEncodingHandlerPtr handler); #ifdef IN_LIBXML /* internal error reporting */ XMLPUBFUN void XMLCALL __xmlErrEncoding (xmlParserCtxtPtr ctxt, xmlParserErrors xmlerr, const char *msg, const xmlChar * str1, const xmlChar * str2) LIBXML_ATTR_FORMAT(3,0); #endif /** * Input Streams. */ XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewStringInputStream (xmlParserCtxtPtr ctxt, const xmlChar *buffer); XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewEntityInputStream (xmlParserCtxtPtr ctxt, xmlEntityPtr entity); XMLPUBFUN int XMLCALL xmlPushInput (xmlParserCtxtPtr ctxt, xmlParserInputPtr input); XMLPUBFUN xmlChar XMLCALL xmlPopInput (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlFreeInputStream (xmlParserInputPtr input); XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewInputFromFile (xmlParserCtxtPtr ctxt, const char *filename); XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewInputStream (xmlParserCtxtPtr ctxt); /** * Namespaces. */ XMLPUBFUN xmlChar * XMLCALL xmlSplitQName (xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix); /** * Generic production rules. */ XMLPUBFUN const xmlChar * XMLCALL xmlParseName (xmlParserCtxtPtr ctxt); XMLPUBFUN xmlChar * XMLCALL xmlParseNmtoken (xmlParserCtxtPtr ctxt); XMLPUBFUN xmlChar * XMLCALL xmlParseEntityValue (xmlParserCtxtPtr ctxt, xmlChar **orig); XMLPUBFUN xmlChar * XMLCALL xmlParseAttValue (xmlParserCtxtPtr ctxt); XMLPUBFUN xmlChar * XMLCALL xmlParseSystemLiteral (xmlParserCtxtPtr ctxt); XMLPUBFUN xmlChar * XMLCALL xmlParsePubidLiteral (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParseCharData (xmlParserCtxtPtr ctxt, int cdata); XMLPUBFUN xmlChar * XMLCALL xmlParseExternalID (xmlParserCtxtPtr ctxt, xmlChar **publicID, int strict); XMLPUBFUN void XMLCALL xmlParseComment (xmlParserCtxtPtr ctxt); XMLPUBFUN const xmlChar * XMLCALL xmlParsePITarget (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParsePI (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParseNotationDecl (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParseEntityDecl (xmlParserCtxtPtr ctxt); XMLPUBFUN int XMLCALL xmlParseDefaultDecl (xmlParserCtxtPtr ctxt, xmlChar **value); XMLPUBFUN xmlEnumerationPtr XMLCALL xmlParseNotationType (xmlParserCtxtPtr ctxt); XMLPUBFUN xmlEnumerationPtr XMLCALL xmlParseEnumerationType (xmlParserCtxtPtr ctxt); XMLPUBFUN int XMLCALL xmlParseEnumeratedType (xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree); XMLPUBFUN int XMLCALL xmlParseAttributeType (xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree); XMLPUBFUN void XMLCALL xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt); XMLPUBFUN xmlElementContentPtr XMLCALL xmlParseElementMixedContentDecl (xmlParserCtxtPtr ctxt, int inputchk); XMLPUBFUN xmlElementContentPtr XMLCALL xmlParseElementChildrenContentDecl (xmlParserCtxtPtr ctxt, int inputchk); XMLPUBFUN int XMLCALL xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlElementContentPtr *result); XMLPUBFUN int XMLCALL xmlParseElementDecl (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParseMarkupDecl (xmlParserCtxtPtr ctxt); XMLPUBFUN int XMLCALL xmlParseCharRef (xmlParserCtxtPtr ctxt); XMLPUBFUN xmlEntityPtr XMLCALL xmlParseEntityRef (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParseReference (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParsePEReference (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt); #ifdef LIBXML_SAX1_ENABLED XMLPUBFUN const xmlChar * XMLCALL xmlParseAttribute (xmlParserCtxtPtr ctxt, xmlChar **value); XMLPUBFUN const xmlChar * XMLCALL xmlParseStartTag (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParseEndTag (xmlParserCtxtPtr ctxt); #endif /* LIBXML_SAX1_ENABLED */ XMLPUBFUN void XMLCALL xmlParseCDSect (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParseContent (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParseElement (xmlParserCtxtPtr ctxt); XMLPUBFUN xmlChar * XMLCALL xmlParseVersionNum (xmlParserCtxtPtr ctxt); XMLPUBFUN xmlChar * XMLCALL xmlParseVersionInfo (xmlParserCtxtPtr ctxt); XMLPUBFUN xmlChar * XMLCALL xmlParseEncName (xmlParserCtxtPtr ctxt); XMLPUBFUN const xmlChar * XMLCALL xmlParseEncodingDecl (xmlParserCtxtPtr ctxt); XMLPUBFUN int XMLCALL xmlParseSDDecl (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParseXMLDecl (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParseTextDecl (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParseMisc (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParseExternalSubset (xmlParserCtxtPtr ctxt, const xmlChar *ExternalID, const xmlChar *SystemID); /** * XML_SUBSTITUTE_NONE: * * If no entities need to be substituted. */ #define XML_SUBSTITUTE_NONE 0 /** * XML_SUBSTITUTE_REF: * * Whether general entities need to be substituted. */ #define XML_SUBSTITUTE_REF 1 /** * XML_SUBSTITUTE_PEREF: * * Whether parameter entities need to be substituted. */ #define XML_SUBSTITUTE_PEREF 2 /** * XML_SUBSTITUTE_BOTH: * * Both general and parameter entities need to be substituted. */ #define XML_SUBSTITUTE_BOTH 3 XMLPUBFUN xmlChar * XMLCALL xmlStringDecodeEntities (xmlParserCtxtPtr ctxt, const xmlChar *str, int what, xmlChar end, xmlChar end2, xmlChar end3); XMLPUBFUN xmlChar * XMLCALL xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt, const xmlChar *str, int len, int what, xmlChar end, xmlChar end2, xmlChar end3); /* * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP. */ XMLPUBFUN int XMLCALL nodePush (xmlParserCtxtPtr ctxt, xmlNodePtr value); XMLPUBFUN xmlNodePtr XMLCALL nodePop (xmlParserCtxtPtr ctxt); XMLPUBFUN int XMLCALL inputPush (xmlParserCtxtPtr ctxt, xmlParserInputPtr value); XMLPUBFUN xmlParserInputPtr XMLCALL inputPop (xmlParserCtxtPtr ctxt); XMLPUBFUN const xmlChar * XMLCALL namePop (xmlParserCtxtPtr ctxt); XMLPUBFUN int XMLCALL namePush (xmlParserCtxtPtr ctxt, const xmlChar *value); /* * other commodities shared between parser.c and parserInternals. */ XMLPUBFUN int XMLCALL xmlSkipBlankChars (xmlParserCtxtPtr ctxt); XMLPUBFUN int XMLCALL xmlStringCurrentChar (xmlParserCtxtPtr ctxt, const xmlChar *cur, int *len); XMLPUBFUN void XMLCALL xmlParserHandlePEReference(xmlParserCtxtPtr ctxt); XMLPUBFUN int XMLCALL xmlCheckLanguageID (const xmlChar *lang); /* * Really core function shared with HTML parser. */ XMLPUBFUN int XMLCALL xmlCurrentChar (xmlParserCtxtPtr ctxt, int *len); XMLPUBFUN int XMLCALL xmlCopyCharMultiByte (xmlChar *out, int val); XMLPUBFUN int XMLCALL xmlCopyChar (int len, xmlChar *out, int val); XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPtr in); #ifdef LIBXML_HTML_ENABLED /* * Actually comes from the HTML parser but launched from the init stuff. */ XMLPUBFUN void XMLCALL htmlInitAutoClose (void); XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char *filename, const char *encoding); #endif /* * Specific function to keep track of entities references * and used by the XSLT debugger. */ #ifdef LIBXML_LEGACY_ENABLED /** * xmlEntityReferenceFunc: * @ent: the entity * @firstNode: the fist node in the chunk * @lastNode: the last nod in the chunk * * Callback function used when one needs to be able to track back the * provenance of a chunk of nodes inherited from an entity replacement. */ typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent, xmlNodePtr firstNode, xmlNodePtr lastNode); XMLPUBFUN void XMLCALL xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func); XMLPUBFUN xmlChar * XMLCALL xmlParseQuotedString (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParseNamespace (xmlParserCtxtPtr ctxt); XMLPUBFUN xmlChar * XMLCALL xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt); XMLPUBFUN xmlChar * XMLCALL xmlScanName (xmlParserCtxtPtr ctxt); XMLPUBFUN xmlChar * XMLCALL xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParserHandleReference(xmlParserCtxtPtr ctxt); XMLPUBFUN xmlChar * XMLCALL xmlNamespaceParseQName (xmlParserCtxtPtr ctxt, xmlChar **prefix); /** * Entities */ XMLPUBFUN xmlChar * XMLCALL xmlDecodeEntities (xmlParserCtxtPtr ctxt, int len, int what, xmlChar end, xmlChar end2, xmlChar end3); XMLPUBFUN void XMLCALL xmlHandleEntity (xmlParserCtxtPtr ctxt, xmlEntityPtr entity); #endif /* LIBXML_LEGACY_ENABLED */ #ifdef IN_LIBXML /* * internal only */ XMLPUBFUN void XMLCALL xmlErrMemory (xmlParserCtxtPtr ctxt, const char *extra); #endif #ifdef __cplusplus } #endif #endif /* __XML_PARSER_INTERNALS_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/threads.h����������������������������������������������������������������������������0000644�����������������00000003474�14763166030�0011225 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * Summary: interfaces for thread handling * Description: set of generic threading related routines * should work with pthreads, Windows native or TLS threads * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_THREADS_H__ #define __XML_THREADS_H__ #include <libxml/xmlversion.h> #ifdef __cplusplus extern "C" { #endif /* * xmlMutex are a simple mutual exception locks. */ typedef struct _xmlMutex xmlMutex; typedef xmlMutex *xmlMutexPtr; /* * xmlRMutex are reentrant mutual exception locks. */ typedef struct _xmlRMutex xmlRMutex; typedef xmlRMutex *xmlRMutexPtr; #ifdef __cplusplus } #endif #include <libxml/globals.h> #ifdef __cplusplus extern "C" { #endif XMLPUBFUN xmlMutexPtr XMLCALL xmlNewMutex (void); XMLPUBFUN void XMLCALL xmlMutexLock (xmlMutexPtr tok); XMLPUBFUN void XMLCALL xmlMutexUnlock (xmlMutexPtr tok); XMLPUBFUN void XMLCALL xmlFreeMutex (xmlMutexPtr tok); XMLPUBFUN xmlRMutexPtr XMLCALL xmlNewRMutex (void); XMLPUBFUN void XMLCALL xmlRMutexLock (xmlRMutexPtr tok); XMLPUBFUN void XMLCALL xmlRMutexUnlock (xmlRMutexPtr tok); XMLPUBFUN void XMLCALL xmlFreeRMutex (xmlRMutexPtr tok); /* * Library wide APIs. */ XMLPUBFUN void XMLCALL xmlInitThreads (void); XMLPUBFUN void XMLCALL xmlLockLibrary (void); XMLPUBFUN void XMLCALL xmlUnlockLibrary(void); XMLPUBFUN int XMLCALL xmlGetThreadId (void); XMLPUBFUN int XMLCALL xmlIsMainThread (void); XMLPUBFUN void XMLCALL xmlCleanupThreads(void); XMLPUBFUN xmlGlobalStatePtr XMLCALL xmlGetGlobalState(void); #if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && defined(LIBXML_STATIC_FOR_DLL) int XMLCALL xmlDllMain(void *hinstDLL, unsigned long fdwReason, void *lpvReserved); #endif #ifdef __cplusplus } #endif #endif /* __XML_THREADS_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/valid.h������������������������������������������������������������������������������0000644�����������������00000032466�14763166030�0010675 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: The DTD validation * Description: API for the DTD handling and the validity checking * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_VALID_H__ #define __XML_VALID_H__ #include <libxml/xmlversion.h> #include <libxml/xmlerror.h> #include <libxml/tree.h> #include <libxml/list.h> #include <libxml/xmlautomata.h> #include <libxml/xmlregexp.h> #ifdef __cplusplus extern "C" { #endif /* * Validation state added for non-determinist content model. */ typedef struct _xmlValidState xmlValidState; typedef xmlValidState *xmlValidStatePtr; /** * xmlValidityErrorFunc: * @ctx: usually an xmlValidCtxtPtr to a validity error context, * but comes from ctxt->userData (which normally contains such * a pointer); ctxt->userData can be changed by the user. * @msg: the string to format *printf like vararg * @...: remaining arguments to the format * * Callback called when a validity error is found. This is a message * oriented function similar to an *printf function. */ typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); /** * xmlValidityWarningFunc: * @ctx: usually an xmlValidCtxtPtr to a validity error context, * but comes from ctxt->userData (which normally contains such * a pointer); ctxt->userData can be changed by the user. * @msg: the string to format *printf like vararg * @...: remaining arguments to the format * * Callback called when a validity warning is found. This is a message * oriented function similar to an *printf function. */ typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); #ifdef IN_LIBXML /** * XML_CTXT_FINISH_DTD_0: * * Special value for finishDtd field when embedded in an xmlParserCtxt */ #define XML_CTXT_FINISH_DTD_0 0xabcd1234 /** * XML_CTXT_FINISH_DTD_1: * * Special value for finishDtd field when embedded in an xmlParserCtxt */ #define XML_CTXT_FINISH_DTD_1 0xabcd1235 #endif /* * xmlValidCtxt: * An xmlValidCtxt is used for error reporting when validating. */ typedef struct _xmlValidCtxt xmlValidCtxt; typedef xmlValidCtxt *xmlValidCtxtPtr; struct _xmlValidCtxt { void *userData; /* user specific data block */ xmlValidityErrorFunc error; /* the callback in case of errors */ xmlValidityWarningFunc warning; /* the callback in case of warning */ /* Node analysis stack used when validating within entities */ xmlNodePtr node; /* Current parsed Node */ int nodeNr; /* Depth of the parsing stack */ int nodeMax; /* Max depth of the parsing stack */ xmlNodePtr *nodeTab; /* array of nodes */ unsigned int finishDtd; /* finished validating the Dtd ? */ xmlDocPtr doc; /* the document */ int valid; /* temporary validity check result */ /* state state used for non-determinist content validation */ xmlValidState *vstate; /* current state */ int vstateNr; /* Depth of the validation stack */ int vstateMax; /* Max depth of the validation stack */ xmlValidState *vstateTab; /* array of validation states */ #ifdef LIBXML_REGEXP_ENABLED xmlAutomataPtr am; /* the automata */ xmlAutomataStatePtr state; /* used to build the automata */ #else void *am; void *state; #endif }; /* * ALL notation declarations are stored in a table. * There is one table per DTD. */ typedef struct _xmlHashTable xmlNotationTable; typedef xmlNotationTable *xmlNotationTablePtr; /* * ALL element declarations are stored in a table. * There is one table per DTD. */ typedef struct _xmlHashTable xmlElementTable; typedef xmlElementTable *xmlElementTablePtr; /* * ALL attribute declarations are stored in a table. * There is one table per DTD. */ typedef struct _xmlHashTable xmlAttributeTable; typedef xmlAttributeTable *xmlAttributeTablePtr; /* * ALL IDs attributes are stored in a table. * There is one table per document. */ typedef struct _xmlHashTable xmlIDTable; typedef xmlIDTable *xmlIDTablePtr; /* * ALL Refs attributes are stored in a table. * There is one table per document. */ typedef struct _xmlHashTable xmlRefTable; typedef xmlRefTable *xmlRefTablePtr; /* Notation */ XMLPUBFUN xmlNotationPtr XMLCALL xmlAddNotationDecl (xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name, const xmlChar *PublicID, const xmlChar *SystemID); #ifdef LIBXML_TREE_ENABLED XMLPUBFUN xmlNotationTablePtr XMLCALL xmlCopyNotationTable (xmlNotationTablePtr table); #endif /* LIBXML_TREE_ENABLED */ XMLPUBFUN void XMLCALL xmlFreeNotationTable (xmlNotationTablePtr table); #ifdef LIBXML_OUTPUT_ENABLED XMLPUBFUN void XMLCALL xmlDumpNotationDecl (xmlBufferPtr buf, xmlNotationPtr nota); XMLPUBFUN void XMLCALL xmlDumpNotationTable (xmlBufferPtr buf, xmlNotationTablePtr table); #endif /* LIBXML_OUTPUT_ENABLED */ /* Element Content */ /* the non Doc version are being deprecated */ XMLPUBFUN xmlElementContentPtr XMLCALL xmlNewElementContent (const xmlChar *name, xmlElementContentType type); XMLPUBFUN xmlElementContentPtr XMLCALL xmlCopyElementContent (xmlElementContentPtr content); XMLPUBFUN void XMLCALL xmlFreeElementContent (xmlElementContentPtr cur); /* the new versions with doc argument */ XMLPUBFUN xmlElementContentPtr XMLCALL xmlNewDocElementContent (xmlDocPtr doc, const xmlChar *name, xmlElementContentType type); XMLPUBFUN xmlElementContentPtr XMLCALL xmlCopyDocElementContent(xmlDocPtr doc, xmlElementContentPtr content); XMLPUBFUN void XMLCALL xmlFreeDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur); XMLPUBFUN void XMLCALL xmlSnprintfElementContent(char *buf, int size, xmlElementContentPtr content, int englob); #ifdef LIBXML_OUTPUT_ENABLED /* DEPRECATED */ XMLPUBFUN void XMLCALL xmlSprintfElementContent(char *buf, xmlElementContentPtr content, int englob); #endif /* LIBXML_OUTPUT_ENABLED */ /* DEPRECATED */ /* Element */ XMLPUBFUN xmlElementPtr XMLCALL xmlAddElementDecl (xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name, xmlElementTypeVal type, xmlElementContentPtr content); #ifdef LIBXML_TREE_ENABLED XMLPUBFUN xmlElementTablePtr XMLCALL xmlCopyElementTable (xmlElementTablePtr table); #endif /* LIBXML_TREE_ENABLED */ XMLPUBFUN void XMLCALL xmlFreeElementTable (xmlElementTablePtr table); #ifdef LIBXML_OUTPUT_ENABLED XMLPUBFUN void XMLCALL xmlDumpElementTable (xmlBufferPtr buf, xmlElementTablePtr table); XMLPUBFUN void XMLCALL xmlDumpElementDecl (xmlBufferPtr buf, xmlElementPtr elem); #endif /* LIBXML_OUTPUT_ENABLED */ /* Enumeration */ XMLPUBFUN xmlEnumerationPtr XMLCALL xmlCreateEnumeration (const xmlChar *name); XMLPUBFUN void XMLCALL xmlFreeEnumeration (xmlEnumerationPtr cur); #ifdef LIBXML_TREE_ENABLED XMLPUBFUN xmlEnumerationPtr XMLCALL xmlCopyEnumeration (xmlEnumerationPtr cur); #endif /* LIBXML_TREE_ENABLED */ /* Attribute */ XMLPUBFUN xmlAttributePtr XMLCALL xmlAddAttributeDecl (xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name, const xmlChar *ns, xmlAttributeType type, xmlAttributeDefault def, const xmlChar *defaultValue, xmlEnumerationPtr tree); #ifdef LIBXML_TREE_ENABLED XMLPUBFUN xmlAttributeTablePtr XMLCALL xmlCopyAttributeTable (xmlAttributeTablePtr table); #endif /* LIBXML_TREE_ENABLED */ XMLPUBFUN void XMLCALL xmlFreeAttributeTable (xmlAttributeTablePtr table); #ifdef LIBXML_OUTPUT_ENABLED XMLPUBFUN void XMLCALL xmlDumpAttributeTable (xmlBufferPtr buf, xmlAttributeTablePtr table); XMLPUBFUN void XMLCALL xmlDumpAttributeDecl (xmlBufferPtr buf, xmlAttributePtr attr); #endif /* LIBXML_OUTPUT_ENABLED */ /* IDs */ XMLPUBFUN xmlIDPtr XMLCALL xmlAddID (xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, xmlAttrPtr attr); XMLPUBFUN void XMLCALL xmlFreeIDTable (xmlIDTablePtr table); XMLPUBFUN xmlAttrPtr XMLCALL xmlGetID (xmlDocPtr doc, const xmlChar *ID); XMLPUBFUN int XMLCALL xmlIsID (xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr); XMLPUBFUN int XMLCALL xmlRemoveID (xmlDocPtr doc, xmlAttrPtr attr); /* IDREFs */ XMLPUBFUN xmlRefPtr XMLCALL xmlAddRef (xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, xmlAttrPtr attr); XMLPUBFUN void XMLCALL xmlFreeRefTable (xmlRefTablePtr table); XMLPUBFUN int XMLCALL xmlIsRef (xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr); XMLPUBFUN int XMLCALL xmlRemoveRef (xmlDocPtr doc, xmlAttrPtr attr); XMLPUBFUN xmlListPtr XMLCALL xmlGetRefs (xmlDocPtr doc, const xmlChar *ID); /** * The public function calls related to validity checking. */ #ifdef LIBXML_VALID_ENABLED /* Allocate/Release Validation Contexts */ XMLPUBFUN xmlValidCtxtPtr XMLCALL xmlNewValidCtxt(void); XMLPUBFUN void XMLCALL xmlFreeValidCtxt(xmlValidCtxtPtr); XMLPUBFUN int XMLCALL xmlValidateRoot (xmlValidCtxtPtr ctxt, xmlDocPtr doc); XMLPUBFUN int XMLCALL xmlValidateElementDecl (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlElementPtr elem); XMLPUBFUN xmlChar * XMLCALL xmlValidNormalizeAttributeValue(xmlDocPtr doc, xmlNodePtr elem, const xmlChar *name, const xmlChar *value); XMLPUBFUN xmlChar * XMLCALL xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem, const xmlChar *name, const xmlChar *value); XMLPUBFUN int XMLCALL xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlAttributePtr attr); XMLPUBFUN int XMLCALL xmlValidateAttributeValue(xmlAttributeType type, const xmlChar *value); XMLPUBFUN int XMLCALL xmlValidateNotationDecl (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNotationPtr nota); XMLPUBFUN int XMLCALL xmlValidateDtd (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlDtdPtr dtd); XMLPUBFUN int XMLCALL xmlValidateDtdFinal (xmlValidCtxtPtr ctxt, xmlDocPtr doc); XMLPUBFUN int XMLCALL xmlValidateDocument (xmlValidCtxtPtr ctxt, xmlDocPtr doc); XMLPUBFUN int XMLCALL xmlValidateElement (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem); XMLPUBFUN int XMLCALL xmlValidateOneElement (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem); XMLPUBFUN int XMLCALL xmlValidateOneAttribute (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr, const xmlChar *value); XMLPUBFUN int XMLCALL xmlValidateOneNamespace (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value); XMLPUBFUN int XMLCALL xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc); #endif /* LIBXML_VALID_ENABLED */ #if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) XMLPUBFUN int XMLCALL xmlValidateNotationUse (xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *notationName); #endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */ XMLPUBFUN int XMLCALL xmlIsMixedElement (xmlDocPtr doc, const xmlChar *name); XMLPUBFUN xmlAttributePtr XMLCALL xmlGetDtdAttrDesc (xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name); XMLPUBFUN xmlAttributePtr XMLCALL xmlGetDtdQAttrDesc (xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name, const xmlChar *prefix); XMLPUBFUN xmlNotationPtr XMLCALL xmlGetDtdNotationDesc (xmlDtdPtr dtd, const xmlChar *name); XMLPUBFUN xmlElementPtr XMLCALL xmlGetDtdQElementDesc (xmlDtdPtr dtd, const xmlChar *name, const xmlChar *prefix); XMLPUBFUN xmlElementPtr XMLCALL xmlGetDtdElementDesc (xmlDtdPtr dtd, const xmlChar *name); #ifdef LIBXML_VALID_ENABLED XMLPUBFUN int XMLCALL xmlValidGetPotentialChildren(xmlElementContent *ctree, const xmlChar **names, int *len, int max); XMLPUBFUN int XMLCALL xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **names, int max); XMLPUBFUN int XMLCALL xmlValidateNameValue (const xmlChar *value); XMLPUBFUN int XMLCALL xmlValidateNamesValue (const xmlChar *value); XMLPUBFUN int XMLCALL xmlValidateNmtokenValue (const xmlChar *value); XMLPUBFUN int XMLCALL xmlValidateNmtokensValue(const xmlChar *value); #ifdef LIBXML_REGEXP_ENABLED /* * Validation based on the regexp support */ XMLPUBFUN int XMLCALL xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, xmlElementPtr elem); XMLPUBFUN int XMLCALL xmlValidatePushElement (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem, const xmlChar *qname); XMLPUBFUN int XMLCALL xmlValidatePushCData (xmlValidCtxtPtr ctxt, const xmlChar *data, int len); XMLPUBFUN int XMLCALL xmlValidatePopElement (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem, const xmlChar *qname); #endif /* LIBXML_REGEXP_ENABLED */ #endif /* LIBXML_VALID_ENABLED */ #ifdef __cplusplus } #endif #endif /* __XML_VALID_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libxml2/libxml/xmlwriter.h��������������������������������������������������������������������������0000644�����������������00000051421�14763166030�0011623 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Summary: text writing API for XML * Description: text writing API for XML * * Copy: See Copyright for the status of this software. * * Author: Alfred Mickautsch <alfred@mickautsch.de> */ #ifndef __XML_XMLWRITER_H__ #define __XML_XMLWRITER_H__ #include <libxml/xmlversion.h> #ifdef LIBXML_WRITER_ENABLED #include <stdarg.h> #include <libxml/xmlIO.h> #include <libxml/list.h> #include <libxml/xmlstring.h> #ifdef __cplusplus extern "C" { #endif typedef struct _xmlTextWriter xmlTextWriter; typedef xmlTextWriter *xmlTextWriterPtr; /* * Constructors & Destructor */ XMLPUBFUN xmlTextWriterPtr XMLCALL xmlNewTextWriter(xmlOutputBufferPtr out); XMLPUBFUN xmlTextWriterPtr XMLCALL xmlNewTextWriterFilename(const char *uri, int compression); XMLPUBFUN xmlTextWriterPtr XMLCALL xmlNewTextWriterMemory(xmlBufferPtr buf, int compression); XMLPUBFUN xmlTextWriterPtr XMLCALL xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, int compression); XMLPUBFUN xmlTextWriterPtr XMLCALL xmlNewTextWriterDoc(xmlDocPtr * doc, int compression); XMLPUBFUN xmlTextWriterPtr XMLCALL xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node, int compression); XMLPUBFUN void XMLCALL xmlFreeTextWriter(xmlTextWriterPtr writer); /* * Functions */ /* * Document */ XMLPUBFUN int XMLCALL xmlTextWriterStartDocument(xmlTextWriterPtr writer, const char *version, const char *encoding, const char *standalone); XMLPUBFUN int XMLCALL xmlTextWriterEndDocument(xmlTextWriterPtr writer); /* * Comments */ XMLPUBFUN int XMLCALL xmlTextWriterStartComment(xmlTextWriterPtr writer); XMLPUBFUN int XMLCALL xmlTextWriterEndComment(xmlTextWriterPtr writer); XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer, const char *format, ...) LIBXML_ATTR_FORMAT(2,3); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(2,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteComment(xmlTextWriterPtr writer, const xmlChar * content); /* * Elements */ XMLPUBFUN int XMLCALL xmlTextWriterStartElement(xmlTextWriterPtr writer, const xmlChar * name); XMLPUBFUN int XMLCALL xmlTextWriterStartElementNS(xmlTextWriterPtr writer, const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI); XMLPUBFUN int XMLCALL xmlTextWriterEndElement(xmlTextWriterPtr writer); XMLPUBFUN int XMLCALL xmlTextWriterFullEndElement(xmlTextWriterPtr writer); /* * Elements conveniency functions */ XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer, const xmlChar * name, const char *format, ...) LIBXML_ATTR_FORMAT(3,4); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer, const xmlChar * name, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(3,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteElement(xmlTextWriterPtr writer, const xmlChar * name, const xmlChar * content); XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer, const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI, const char *format, ...) LIBXML_ATTR_FORMAT(5,6); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer, const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(5,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteElementNS(xmlTextWriterPtr writer, const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI, const xmlChar * content); /* * Text */ XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer, const char *format, ...) LIBXML_ATTR_FORMAT(2,3); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(2,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteRawLen(xmlTextWriterPtr writer, const xmlChar * content, int len); XMLPUBFUN int XMLCALL xmlTextWriterWriteRaw(xmlTextWriterPtr writer, const xmlChar * content); XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatString(xmlTextWriterPtr writer, const char *format, ...) LIBXML_ATTR_FORMAT(2,3); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatString(xmlTextWriterPtr writer, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(2,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteString(xmlTextWriterPtr writer, const xmlChar * content); XMLPUBFUN int XMLCALL xmlTextWriterWriteBase64(xmlTextWriterPtr writer, const char *data, int start, int len); XMLPUBFUN int XMLCALL xmlTextWriterWriteBinHex(xmlTextWriterPtr writer, const char *data, int start, int len); /* * Attributes */ XMLPUBFUN int XMLCALL xmlTextWriterStartAttribute(xmlTextWriterPtr writer, const xmlChar * name); XMLPUBFUN int XMLCALL xmlTextWriterStartAttributeNS(xmlTextWriterPtr writer, const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI); XMLPUBFUN int XMLCALL xmlTextWriterEndAttribute(xmlTextWriterPtr writer); /* * Attributes conveniency functions */ XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer, const xmlChar * name, const char *format, ...) LIBXML_ATTR_FORMAT(3,4); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer, const xmlChar * name, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(3,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteAttribute(xmlTextWriterPtr writer, const xmlChar * name, const xmlChar * content); XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer, const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI, const char *format, ...) LIBXML_ATTR_FORMAT(5,6); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer, const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(5,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteAttributeNS(xmlTextWriterPtr writer, const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI, const xmlChar * content); /* * PI's */ XMLPUBFUN int XMLCALL xmlTextWriterStartPI(xmlTextWriterPtr writer, const xmlChar * target); XMLPUBFUN int XMLCALL xmlTextWriterEndPI(xmlTextWriterPtr writer); /* * PI conveniency functions */ XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer, const xmlChar * target, const char *format, ...) LIBXML_ATTR_FORMAT(3,4); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer, const xmlChar * target, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(3,0); XMLPUBFUN int XMLCALL xmlTextWriterWritePI(xmlTextWriterPtr writer, const xmlChar * target, const xmlChar * content); /** * xmlTextWriterWriteProcessingInstruction: * * This macro maps to xmlTextWriterWritePI */ #define xmlTextWriterWriteProcessingInstruction xmlTextWriterWritePI /* * CDATA */ XMLPUBFUN int XMLCALL xmlTextWriterStartCDATA(xmlTextWriterPtr writer); XMLPUBFUN int XMLCALL xmlTextWriterEndCDATA(xmlTextWriterPtr writer); /* * CDATA conveniency functions */ XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer, const char *format, ...) LIBXML_ATTR_FORMAT(2,3); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(2,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteCDATA(xmlTextWriterPtr writer, const xmlChar * content); /* * DTD */ XMLPUBFUN int XMLCALL xmlTextWriterStartDTD(xmlTextWriterPtr writer, const xmlChar * name, const xmlChar * pubid, const xmlChar * sysid); XMLPUBFUN int XMLCALL xmlTextWriterEndDTD(xmlTextWriterPtr writer); /* * DTD conveniency functions */ XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer, const xmlChar * name, const xmlChar * pubid, const xmlChar * sysid, const char *format, ...) LIBXML_ATTR_FORMAT(5,6); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer, const xmlChar * name, const xmlChar * pubid, const xmlChar * sysid, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(5,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteDTD(xmlTextWriterPtr writer, const xmlChar * name, const xmlChar * pubid, const xmlChar * sysid, const xmlChar * subset); /** * xmlTextWriterWriteDocType: * * this macro maps to xmlTextWriterWriteDTD */ #define xmlTextWriterWriteDocType xmlTextWriterWriteDTD /* * DTD element definition */ XMLPUBFUN int XMLCALL xmlTextWriterStartDTDElement(xmlTextWriterPtr writer, const xmlChar * name); XMLPUBFUN int XMLCALL xmlTextWriterEndDTDElement(xmlTextWriterPtr writer); /* * DTD element definition conveniency functions */ XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer, const xmlChar * name, const char *format, ...) LIBXML_ATTR_FORMAT(3,4); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer, const xmlChar * name, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(3,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDElement(xmlTextWriterPtr writer, const xmlChar * name, const xmlChar * content); /* * DTD attribute list definition */ XMLPUBFUN int XMLCALL xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer, const xmlChar * name); XMLPUBFUN int XMLCALL xmlTextWriterEndDTDAttlist(xmlTextWriterPtr writer); /* * DTD attribute list definition conveniency functions */ XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer, const xmlChar * name, const char *format, ...) LIBXML_ATTR_FORMAT(3,4); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer, const xmlChar * name, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(3,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr writer, const xmlChar * name, const xmlChar * content); /* * DTD entity definition */ XMLPUBFUN int XMLCALL xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer, int pe, const xmlChar * name); XMLPUBFUN int XMLCALL xmlTextWriterEndDTDEntity(xmlTextWriterPtr writer); /* * DTD entity definition conveniency functions */ XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer, int pe, const xmlChar * name, const char *format, ...) LIBXML_ATTR_FORMAT(4,5); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer, int pe, const xmlChar * name, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(4,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer, int pe, const xmlChar * name, const xmlChar * content); XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer, int pe, const xmlChar * name, const xmlChar * pubid, const xmlChar * sysid, const xmlChar * ndataid); XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr writer, const xmlChar * pubid, const xmlChar * sysid, const xmlChar * ndataid); XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDEntity(xmlTextWriterPtr writer, int pe, const xmlChar * name, const xmlChar * pubid, const xmlChar * sysid, const xmlChar * ndataid, const xmlChar * content); /* * DTD notation definition */ XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer, const xmlChar * name, const xmlChar * pubid, const xmlChar * sysid); /* * Indentation */ XMLPUBFUN int XMLCALL xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent); XMLPUBFUN int XMLCALL xmlTextWriterSetIndentString(xmlTextWriterPtr writer, const xmlChar * str); XMLPUBFUN int XMLCALL xmlTextWriterSetQuoteChar(xmlTextWriterPtr writer, xmlChar quotechar); /* * misc */ XMLPUBFUN int XMLCALL xmlTextWriterFlush(xmlTextWriterPtr writer); #ifdef __cplusplus } #endif #endif /* LIBXML_WRITER_ENABLED */ #endif /* __XML_XMLWRITER_H__ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������nfs/nfs.h�������������������������������������������������������������������������������������������0000644�����������������00000000027�14763166030�0006276 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <linux/nfs.h> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������strings.h�������������������������������������������������������������������������������������������0000644�����������������00000011057�14763166030�0006420 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991,1992,1996,1997,1999,2000,2001,2009,2010,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _STRINGS_H #define _STRINGS_H 1 /* We don't need and should not read this file if <string.h> was already read. The one exception being that if __USE_BSD isn't defined, then these aren't defined in string.h, so we need to define them here. */ #if !defined _STRING_H || !defined __USE_BSD # include <features.h> # define __need_size_t # include <stddef.h> /* Tell the caller that we provide correct C++ prototypes. */ # if defined __cplusplus && __GNUC_PREREQ (4, 4) # define __CORRECT_ISO_CPP_STRINGS_H_PROTO # endif __BEGIN_DECLS # if defined __USE_MISC || !defined __USE_XOPEN2K8 /* Compare N bytes of S1 and S2 (same as memcmp). */ extern int bcmp (const void *__s1, const void *__s2, size_t __n) __THROW __attribute_pure__; /* Copy N bytes of SRC to DEST (like memmove, but args reversed). */ extern void bcopy (const void *__src, void *__dest, size_t __n) __THROW; /* Set N bytes of S to 0. */ extern void bzero (void *__s, size_t __n) __THROW; /* Find the first occurrence of C in S (same as strchr). */ # ifdef __CORRECT_ISO_CPP_STRINGS_H_PROTO extern "C++" { extern char *index (char *__s, int __c) __THROW __asm ("index") __attribute_pure__ __nonnull ((1)); extern const char *index (const char *__s, int __c) __THROW __asm ("index") __attribute_pure__ __nonnull ((1)); # if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRING_H_PROTO __extern_always_inline char * index (char *__s, int __c) __THROW { return __builtin_index (__s, __c); } __extern_always_inline const char * index (const char *__s, int __c) __THROW { return __builtin_index (__s, __c); } # endif } # else extern char *index (const char *__s, int __c) __THROW __attribute_pure__ __nonnull ((1)); # endif /* Find the last occurrence of C in S (same as strrchr). */ # ifdef __CORRECT_ISO_CPP_STRINGS_H_PROTO extern "C++" { extern char *rindex (char *__s, int __c) __THROW __asm ("rindex") __attribute_pure__ __nonnull ((1)); extern const char *rindex (const char *__s, int __c) __THROW __asm ("rindex") __attribute_pure__ __nonnull ((1)); # if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRING_H_PROTO __extern_always_inline char * rindex (char *__s, int __c) __THROW { return __builtin_rindex (__s, __c); } __extern_always_inline const char * rindex (const char *__s, int __c) __THROW { return __builtin_rindex (__s, __c); } # endif } # else extern char *rindex (const char *__s, int __c) __THROW __attribute_pure__ __nonnull ((1)); # endif # endif #if defined __USE_MISC || !defined __USE_XOPEN2K8 || defined __USE_XOPEN2K8XSI /* Return the position of the first bit set in I, or 0 if none are set. The least-significant bit is position 1, the most-significant 32. */ extern int ffs (int __i) __THROW __attribute__ ((const)); #endif /* Compare S1 and S2, ignoring case. */ extern int strcasecmp (const char *__s1, const char *__s2) __THROW __attribute_pure__; /* Compare no more than N chars of S1 and S2, ignoring case. */ extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) __THROW __attribute_pure__; #ifdef __USE_XOPEN2K8 /* The following functions are equivalent to the both above but they take the locale they use for the collation as an extra argument. This is not standardsized but something like will come. */ # include <xlocale.h> /* Again versions of a few functions which use the given locale instead of the global one. */ extern int strcasecmp_l (const char *__s1, const char *__s2, __locale_t __loc) __THROW __attribute_pure__ __nonnull ((1, 2, 3)); extern int strncasecmp_l (const char *__s1, const char *__s2, size_t __n, __locale_t __loc) __THROW __attribute_pure__ __nonnull ((1, 2, 4)); #endif __END_DECLS #endif /* string.h */ #endif /* strings.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gcrypt.h��������������������������������������������������������������������������������������������0000644�����������������00000231014�14763166030�0006234 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* gcrypt.h - GNU Cryptographic Library Interface -*- c -*- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Copyright (C) 2012, 2013 g10 Code GmbH This file is part of Libgcrypt. Libgcrypt is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. Libgcrypt 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. File: src/gcrypt.h. Generated from gcrypt.h.in by configure. */ #ifndef _GCRYPT_H #define _GCRYPT_H #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <gpg-error.h> #include <sys/types.h> #if defined _WIN32 || defined __WIN32__ # include <winsock2.h> # include <ws2tcpip.h> # include <time.h> # ifndef __GNUC__ typedef long ssize_t; typedef int pid_t; # endif /*!__GNUC__*/ #else # include <sys/socket.h> # include <sys/time.h> # include <sys/select.h> #endif /*!_WIN32*/ typedef socklen_t gcry_socklen_t; /* This is required for error code compatibility. */ #define _GCRY_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GCRYPT #ifdef __cplusplus extern "C" { #if 0 /* (Keep Emacsens' auto-indent happy.) */ } #endif #endif /* The version of this header should match the one of the library. It should not be used by a program because gcry_check_version() should return the same version. The purpose of this macro is to let autoconf (using the AM_PATH_GCRYPT macro) check that this header matches the installed library. */ #define GCRYPT_VERSION "1.5.3" /* The version number of this header. It may be used to handle minor API incompatibilities. */ #define GCRYPT_VERSION_NUMBER 0x010503 /* Internal: We can't use the convenience macros for the multi precision integer functions when building this library. */ #ifdef _GCRYPT_IN_LIBGCRYPT #ifndef GCRYPT_NO_MPI_MACROS #define GCRYPT_NO_MPI_MACROS 1 #endif #endif /* We want to use gcc attributes when possible. Warning: Don't use these macros in your programs: As indicated by the leading underscore they are subject to change without notice. */ #ifdef __GNUC__ #define _GCRY_GCC_VERSION (__GNUC__ * 10000 \ + __GNUC_MINOR__ * 100 \ + __GNUC_PATCHLEVEL__) #if _GCRY_GCC_VERSION >= 30100 #define _GCRY_GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__)) #endif #if _GCRY_GCC_VERSION >= 29600 #define _GCRY_GCC_ATTR_PURE __attribute__ ((__pure__)) #endif #if _GCRY_GCC_VERSION >= 30200 #define _GCRY_GCC_ATTR_MALLOC __attribute__ ((__malloc__)) #endif #endif /*__GNUC__*/ #ifndef _GCRY_GCC_ATTR_DEPRECATED #define _GCRY_GCC_ATTR_DEPRECATED #endif #ifndef _GCRY_GCC_ATTR_PURE #define _GCRY_GCC_ATTR_PURE #endif #ifndef _GCRY_GCC_ATTR_MALLOC #define _GCRY_GCC_ATTR_MALLOC #endif /* Make up an attribute to mark functions and types as deprecated but allow internal use by Libgcrypt. */ #ifdef _GCRYPT_IN_LIBGCRYPT #define _GCRY_ATTR_INTERNAL #else #define _GCRY_ATTR_INTERNAL _GCRY_GCC_ATTR_DEPRECATED #endif /* Wrappers for the libgpg-error library. */ typedef gpg_error_t gcry_error_t; typedef gpg_err_code_t gcry_err_code_t; typedef gpg_err_source_t gcry_err_source_t; static GPG_ERR_INLINE gcry_error_t gcry_err_make (gcry_err_source_t source, gcry_err_code_t code) { return gpg_err_make (source, code); } /* The user can define GPG_ERR_SOURCE_DEFAULT before including this file to specify a default source for gpg_error. */ #ifndef GCRY_ERR_SOURCE_DEFAULT #define GCRY_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_USER_1 #endif static GPG_ERR_INLINE gcry_error_t gcry_error (gcry_err_code_t code) { return gcry_err_make (GCRY_ERR_SOURCE_DEFAULT, code); } static GPG_ERR_INLINE gcry_err_code_t gcry_err_code (gcry_error_t err) { return gpg_err_code (err); } static GPG_ERR_INLINE gcry_err_source_t gcry_err_source (gcry_error_t err) { return gpg_err_source (err); } /* Return a pointer to a string containing a description of the error code in the error value ERR. */ const char *gcry_strerror (gcry_error_t err); /* Return a pointer to a string containing a description of the error source in the error value ERR. */ const char *gcry_strsource (gcry_error_t err); /* Retrieve the error code for the system error ERR. This returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report this). */ gcry_err_code_t gcry_err_code_from_errno (int err); /* Retrieve the system error for the error code CODE. This returns 0 if CODE is not a system error code. */ int gcry_err_code_to_errno (gcry_err_code_t code); /* Return an error value with the error source SOURCE and the system error ERR. */ gcry_error_t gcry_err_make_from_errno (gcry_err_source_t source, int err); /* Return an error value with the system error ERR. */ gcry_err_code_t gcry_error_from_errno (int err); /* This enum is deprecated; it is only declared for the sake of complete API compatibility. */ enum gcry_thread_option { _GCRY_THREAD_OPTION_DUMMY } _GCRY_GCC_ATTR_DEPRECATED; /* Constants defining the thread model to use. Used with the OPTION field of the struct gcry_thread_cbs. */ #define GCRY_THREAD_OPTION_DEFAULT 0 #define GCRY_THREAD_OPTION_USER 1 #define GCRY_THREAD_OPTION_PTH 2 #define GCRY_THREAD_OPTION_PTHREAD 3 /* The version number encoded in the OPTION field of the struct gcry_thread_cbs. */ #define GCRY_THREAD_OPTION_VERSION 0 /* Wrapper for struct ath_ops. */ struct gcry_thread_cbs { /* The OPTION field encodes the thread model and the version number of this structure. Bits 7 - 0 are used for the thread model Bits 15 - 8 are used for the version number. */ unsigned int option; int (*init) (void); int (*mutex_init) (void **priv); int (*mutex_destroy) (void **priv); int (*mutex_lock) (void **priv); int (*mutex_unlock) (void **priv); ssize_t (*read) (int fd, void *buf, size_t nbytes); ssize_t (*write) (int fd, const void *buf, size_t nbytes); #ifdef _WIN32 ssize_t (*select) (int nfd, void *rset, void *wset, void *eset, struct timeval *timeout); ssize_t (*waitpid) (pid_t pid, int *status, int options); int (*accept) (int s, void *addr, int *length_ptr); int (*connect) (int s, void *addr, gcry_socklen_t length); int (*sendmsg) (int s, const void *msg, int flags); int (*recvmsg) (int s, void *msg, int flags); #else ssize_t (*select) (int nfd, fd_set *rset, fd_set *wset, fd_set *eset, struct timeval *timeout); ssize_t (*waitpid) (pid_t pid, int *status, int options); int (*accept) (int s, struct sockaddr *addr, gcry_socklen_t *length_ptr); int (*connect) (int s, struct sockaddr *addr, gcry_socklen_t length); int (*sendmsg) (int s, const struct msghdr *msg, int flags); int (*recvmsg) (int s, struct msghdr *msg, int flags); #endif }; #ifdef _WIN32 # define _GCRY_THREAD_OPTION_PTH_IMPL_NET \ static ssize_t gcry_pth_select (int nfd, void *rset, void *wset, \ void *eset, struct timeval *timeout) \ { return pth_select (nfd, rset, wset, eset, timeout); } \ static ssize_t gcry_pth_waitpid (pid_t pid, int *status, int options) \ { return pth_waitpid (pid, status, options); } \ static int gcry_pth_accept (int s, void *addr, \ gcry_socklen_t *length_ptr) \ { return pth_accept (s, addr, length_ptr); } \ static int gcry_pth_connect (int s, void *addr, \ gcry_socklen_t length) \ { return pth_connect (s, addr, length); } #else /*!_WIN32*/ # define _GCRY_THREAD_OPTION_PTH_IMPL_NET \ static ssize_t gcry_pth_select (int nfd, fd_set *rset, fd_set *wset, \ fd_set *eset, struct timeval *timeout) \ { return pth_select (nfd, rset, wset, eset, timeout); } \ static ssize_t gcry_pth_waitpid (pid_t pid, int *status, int options) \ { return pth_waitpid (pid, status, options); } \ static int gcry_pth_accept (int s, struct sockaddr *addr, \ gcry_socklen_t *length_ptr) \ { return pth_accept (s, addr, length_ptr); } \ static int gcry_pth_connect (int s, struct sockaddr *addr, \ gcry_socklen_t length) \ { return pth_connect (s, addr, length); } #endif /*!_WIN32*/ #define GCRY_THREAD_OPTION_PTH_IMPL \ static int gcry_pth_init (void) \ { return (pth_init () == FALSE) ? errno : 0; } \ static int gcry_pth_mutex_init (void **priv) \ { \ int err = 0; \ pth_mutex_t *lock = malloc (sizeof (pth_mutex_t)); \ \ if (!lock) \ err = ENOMEM; \ if (!err) \ { \ err = pth_mutex_init (lock); \ if (err == FALSE) \ err = errno; \ else \ err = 0; \ if (err) \ free (lock); \ else \ *priv = lock; \ } \ return err; \ } \ static int gcry_pth_mutex_destroy (void **lock) \ { /* GNU Pth has no destructor function. */ free (*lock); return 0; } \ static int gcry_pth_mutex_lock (void **lock) \ { return ((pth_mutex_acquire (*lock, 0, NULL)) == FALSE) \ ? errno : 0; } \ static int gcry_pth_mutex_unlock (void **lock) \ { return ((pth_mutex_release (*lock)) == FALSE) \ ? errno : 0; } \ static ssize_t gcry_pth_read (int fd, void *buf, size_t nbytes) \ { return pth_read (fd, buf, nbytes); } \ static ssize_t gcry_pth_write (int fd, const void *buf, size_t nbytes) \ { return pth_write (fd, buf, nbytes); } \ _GCRY_THREAD_OPTION_PTH_IMPL_NET \ \ /* Note: GNU Pth is missing pth_sendmsg and pth_recvmsg. */ \ static struct gcry_thread_cbs gcry_threads_pth = { \ (GCRY_THREAD_OPTION_PTH | (GCRY_THREAD_OPTION_VERSION << 8)), \ gcry_pth_init, gcry_pth_mutex_init, gcry_pth_mutex_destroy, \ gcry_pth_mutex_lock, gcry_pth_mutex_unlock, gcry_pth_read, gcry_pth_write, \ gcry_pth_select, gcry_pth_waitpid, gcry_pth_accept, gcry_pth_connect, \ NULL, NULL } #define GCRY_THREAD_OPTION_PTHREAD_IMPL \ static int gcry_pthread_mutex_init (void **priv) \ { \ int err = 0; \ pthread_mutex_t *lock = (pthread_mutex_t*)malloc (sizeof (pthread_mutex_t));\ \ if (!lock) \ err = ENOMEM; \ if (!err) \ { \ err = pthread_mutex_init (lock, NULL); \ if (err) \ free (lock); \ else \ *priv = lock; \ } \ return err; \ } \ static int gcry_pthread_mutex_destroy (void **lock) \ { int err = pthread_mutex_destroy ((pthread_mutex_t*)*lock); \ free (*lock); return err; } \ static int gcry_pthread_mutex_lock (void **lock) \ { return pthread_mutex_lock ((pthread_mutex_t*)*lock); } \ static int gcry_pthread_mutex_unlock (void **lock) \ { return pthread_mutex_unlock ((pthread_mutex_t*)*lock); } \ \ static struct gcry_thread_cbs gcry_threads_pthread = { \ (GCRY_THREAD_OPTION_PTHREAD | (GCRY_THREAD_OPTION_VERSION << 8)), \ NULL, gcry_pthread_mutex_init, gcry_pthread_mutex_destroy, \ gcry_pthread_mutex_lock, gcry_pthread_mutex_unlock, \ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } /* The data object used to hold a multi precision integer. */ struct gcry_mpi; typedef struct gcry_mpi *gcry_mpi_t; #ifndef GCRYPT_NO_DEPRECATED typedef struct gcry_mpi *GCRY_MPI _GCRY_GCC_ATTR_DEPRECATED; typedef struct gcry_mpi *GcryMPI _GCRY_GCC_ATTR_DEPRECATED; #endif /* Check that the library fulfills the version requirement. */ const char *gcry_check_version (const char *req_version); /* Codes for function dispatchers. */ /* Codes used with the gcry_control function. */ enum gcry_ctl_cmds { GCRYCTL_SET_KEY = 1, GCRYCTL_SET_IV = 2, GCRYCTL_CFB_SYNC = 3, GCRYCTL_RESET = 4, /* e.g. for MDs */ GCRYCTL_FINALIZE = 5, GCRYCTL_GET_KEYLEN = 6, GCRYCTL_GET_BLKLEN = 7, GCRYCTL_TEST_ALGO = 8, GCRYCTL_IS_SECURE = 9, GCRYCTL_GET_ASNOID = 10, GCRYCTL_ENABLE_ALGO = 11, GCRYCTL_DISABLE_ALGO = 12, GCRYCTL_DUMP_RANDOM_STATS = 13, GCRYCTL_DUMP_SECMEM_STATS = 14, GCRYCTL_GET_ALGO_NPKEY = 15, GCRYCTL_GET_ALGO_NSKEY = 16, GCRYCTL_GET_ALGO_NSIGN = 17, GCRYCTL_GET_ALGO_NENCR = 18, GCRYCTL_SET_VERBOSITY = 19, GCRYCTL_SET_DEBUG_FLAGS = 20, GCRYCTL_CLEAR_DEBUG_FLAGS = 21, GCRYCTL_USE_SECURE_RNDPOOL= 22, GCRYCTL_DUMP_MEMORY_STATS = 23, GCRYCTL_INIT_SECMEM = 24, GCRYCTL_TERM_SECMEM = 25, GCRYCTL_DISABLE_SECMEM_WARN = 27, GCRYCTL_SUSPEND_SECMEM_WARN = 28, GCRYCTL_RESUME_SECMEM_WARN = 29, GCRYCTL_DROP_PRIVS = 30, GCRYCTL_ENABLE_M_GUARD = 31, GCRYCTL_START_DUMP = 32, GCRYCTL_STOP_DUMP = 33, GCRYCTL_GET_ALGO_USAGE = 34, GCRYCTL_IS_ALGO_ENABLED = 35, GCRYCTL_DISABLE_INTERNAL_LOCKING = 36, GCRYCTL_DISABLE_SECMEM = 37, GCRYCTL_INITIALIZATION_FINISHED = 38, GCRYCTL_INITIALIZATION_FINISHED_P = 39, GCRYCTL_ANY_INITIALIZATION_P = 40, GCRYCTL_SET_CBC_CTS = 41, GCRYCTL_SET_CBC_MAC = 42, GCRYCTL_SET_CTR = 43, GCRYCTL_ENABLE_QUICK_RANDOM = 44, GCRYCTL_SET_RANDOM_SEED_FILE = 45, GCRYCTL_UPDATE_RANDOM_SEED_FILE = 46, GCRYCTL_SET_THREAD_CBS = 47, GCRYCTL_FAST_POLL = 48, GCRYCTL_SET_RANDOM_DAEMON_SOCKET = 49, GCRYCTL_USE_RANDOM_DAEMON = 50, GCRYCTL_FAKED_RANDOM_P = 51, GCRYCTL_SET_RNDEGD_SOCKET = 52, GCRYCTL_PRINT_CONFIG = 53, GCRYCTL_OPERATIONAL_P = 54, GCRYCTL_FIPS_MODE_P = 55, GCRYCTL_FORCE_FIPS_MODE = 56, GCRYCTL_SELFTEST = 57, /* Note: 58 .. 62 are used internally. */ GCRYCTL_DISABLE_HWF = 63, GCRYCTL_SET_ENFORCED_FIPS_FLAG = 64, GCRYCTL_DRBG_REINIT = 74 /* Note: 75 is used internally */ }; /* Perform various operations defined by CMD. */ gcry_error_t gcry_control (enum gcry_ctl_cmds CMD, ...); /* S-expression management. */ /* The object to represent an S-expression as used with the public key functions. */ struct gcry_sexp; typedef struct gcry_sexp *gcry_sexp_t; #ifndef GCRYPT_NO_DEPRECATED typedef struct gcry_sexp *GCRY_SEXP _GCRY_GCC_ATTR_DEPRECATED; typedef struct gcry_sexp *GcrySexp _GCRY_GCC_ATTR_DEPRECATED; #endif /* The possible values for the S-expression format. */ enum gcry_sexp_format { GCRYSEXP_FMT_DEFAULT = 0, GCRYSEXP_FMT_CANON = 1, GCRYSEXP_FMT_BASE64 = 2, GCRYSEXP_FMT_ADVANCED = 3 }; /* Create an new S-expression object from BUFFER of size LENGTH and return it in RETSEXP. With AUTODETECT set to 0 the data in BUFFER is expected to be in canonized format. */ gcry_error_t gcry_sexp_new (gcry_sexp_t *retsexp, const void *buffer, size_t length, int autodetect); /* Same as gcry_sexp_new but allows to pass a FREEFNC which has the effect to transfer ownership of BUFFER to the created object. */ gcry_error_t gcry_sexp_create (gcry_sexp_t *retsexp, void *buffer, size_t length, int autodetect, void (*freefnc) (void *)); /* Scan BUFFER and return a new S-expression object in RETSEXP. This function expects a printf like string in BUFFER. */ gcry_error_t gcry_sexp_sscan (gcry_sexp_t *retsexp, size_t *erroff, const char *buffer, size_t length); /* Same as gcry_sexp_sscan but expects a string in FORMAT and can thus only be used for certain encodings. */ gcry_error_t gcry_sexp_build (gcry_sexp_t *retsexp, size_t *erroff, const char *format, ...); /* Like gcry_sexp_build, but uses an array instead of variable function arguments. */ gcry_error_t gcry_sexp_build_array (gcry_sexp_t *retsexp, size_t *erroff, const char *format, void **arg_list); /* Release the S-expression object SEXP */ void gcry_sexp_release (gcry_sexp_t sexp); /* Calculate the length of an canonized S-expresion in BUFFER and check for a valid encoding. */ size_t gcry_sexp_canon_len (const unsigned char *buffer, size_t length, size_t *erroff, gcry_error_t *errcode); /* Copies the S-expression object SEXP into BUFFER using the format specified in MODE. */ size_t gcry_sexp_sprint (gcry_sexp_t sexp, int mode, void *buffer, size_t maxlength); /* Dumps the S-expression object A in a format suitable for debugging to Libgcrypt's logging stream. */ void gcry_sexp_dump (const gcry_sexp_t a); gcry_sexp_t gcry_sexp_cons (const gcry_sexp_t a, const gcry_sexp_t b); gcry_sexp_t gcry_sexp_alist (const gcry_sexp_t *array); gcry_sexp_t gcry_sexp_vlist (const gcry_sexp_t a, ...); gcry_sexp_t gcry_sexp_append (const gcry_sexp_t a, const gcry_sexp_t n); gcry_sexp_t gcry_sexp_prepend (const gcry_sexp_t a, const gcry_sexp_t n); /* Scan the S-expression for a sublist with a type (the car of the list) matching the string TOKEN. If TOKLEN is not 0, the token is assumed to be raw memory of this length. The function returns a newly allocated S-expression consisting of the found sublist or `NULL' when not found. */ gcry_sexp_t gcry_sexp_find_token (gcry_sexp_t list, const char *tok, size_t toklen); /* Return the length of the LIST. For a valid S-expression this should be at least 1. */ int gcry_sexp_length (const gcry_sexp_t list); /* Create and return a new S-expression from the element with index NUMBER in LIST. Note that the first element has the index 0. If there is no such element, `NULL' is returned. */ gcry_sexp_t gcry_sexp_nth (const gcry_sexp_t list, int number); /* Create and return a new S-expression from the first element in LIST; this called the "type" and should always exist and be a string. `NULL' is returned in case of a problem. */ gcry_sexp_t gcry_sexp_car (const gcry_sexp_t list); /* Create and return a new list form all elements except for the first one. Note, that this function may return an invalid S-expression because it is not guaranteed, that the type exists and is a string. However, for parsing a complex S-expression it might be useful for intermediate lists. Returns `NULL' on error. */ gcry_sexp_t gcry_sexp_cdr (const gcry_sexp_t list); gcry_sexp_t gcry_sexp_cadr (const gcry_sexp_t list); /* This function is used to get data from a LIST. A pointer to the actual data with index NUMBER is returned and the length of this data will be stored to DATALEN. If there is no data at the given index or the index represents another list, `NULL' is returned. *Note:* The returned pointer is valid as long as LIST is not modified or released. */ const char *gcry_sexp_nth_data (const gcry_sexp_t list, int number, size_t *datalen); /* This function is used to get and convert data from a LIST. The data is assumed to be a Nul terminated string. The caller must release the returned value using `gcry_free'. If there is no data at the given index, the index represents a list or the value can't be converted to a string, `NULL' is returned. */ char *gcry_sexp_nth_string (gcry_sexp_t list, int number); /* This function is used to get and convert data from a LIST. This data is assumed to be an MPI stored in the format described by MPIFMT and returned as a standard Libgcrypt MPI. The caller must release this returned value using `gcry_mpi_release'. If there is no data at the given index, the index represents a list or the value can't be converted to an MPI, `NULL' is returned. */ gcry_mpi_t gcry_sexp_nth_mpi (gcry_sexp_t list, int number, int mpifmt); /******************************************* * * * Multi Precision Integer Functions * * * *******************************************/ /* Different formats of external big integer representation. */ enum gcry_mpi_format { GCRYMPI_FMT_NONE= 0, GCRYMPI_FMT_STD = 1, /* Twos complement stored without length. */ GCRYMPI_FMT_PGP = 2, /* As used by OpenPGP (unsigned only). */ GCRYMPI_FMT_SSH = 3, /* As used by SSH (like STD but with length). */ GCRYMPI_FMT_HEX = 4, /* Hex format. */ GCRYMPI_FMT_USG = 5 /* Like STD but unsigned. */ }; /* Flags used for creating big integers. */ enum gcry_mpi_flag { GCRYMPI_FLAG_SECURE = 1, /* Allocate the number in "secure" memory. */ GCRYMPI_FLAG_OPAQUE = 2 /* The number is not a real one but just a way to store some bytes. This is useful for encrypted big integers. */ }; /* Allocate a new big integer object, initialize it with 0 and initially allocate memory for a number of at least NBITS. */ gcry_mpi_t gcry_mpi_new (unsigned int nbits); /* Same as gcry_mpi_new() but allocate in "secure" memory. */ gcry_mpi_t gcry_mpi_snew (unsigned int nbits); /* Release the number A and free all associated resources. */ void gcry_mpi_release (gcry_mpi_t a); /* Create a new number with the same value as A. */ gcry_mpi_t gcry_mpi_copy (const gcry_mpi_t a); /* Store the big integer value U in W. */ gcry_mpi_t gcry_mpi_set (gcry_mpi_t w, const gcry_mpi_t u); /* Store the unsigned integer value U in W. */ gcry_mpi_t gcry_mpi_set_ui (gcry_mpi_t w, unsigned long u); /* Swap the values of A and B. */ void gcry_mpi_swap (gcry_mpi_t a, gcry_mpi_t b); /* Compare the big integer number U and V returning 0 for equality, a positive value for U > V and a negative for U < V. */ int gcry_mpi_cmp (const gcry_mpi_t u, const gcry_mpi_t v); /* Compare the big integer number U with the unsigned integer V returning 0 for equality, a positive value for U > V and a negative for U < V. */ int gcry_mpi_cmp_ui (const gcry_mpi_t u, unsigned long v); /* Convert the external representation of an integer stored in BUFFER with a length of BUFLEN into a newly create MPI returned in RET_MPI. If NSCANNED is not NULL, it will receive the number of bytes actually scanned after a successful operation. */ gcry_error_t gcry_mpi_scan (gcry_mpi_t *ret_mpi, enum gcry_mpi_format format, const void *buffer, size_t buflen, size_t *nscanned); /* Convert the big integer A into the external representation described by FORMAT and store it in the provided BUFFER which has been allocated by the user with a size of BUFLEN bytes. NWRITTEN receives the actual length of the external representation unless it has been passed as NULL. */ gcry_error_t gcry_mpi_print (enum gcry_mpi_format format, unsigned char *buffer, size_t buflen, size_t *nwritten, const gcry_mpi_t a); /* Convert the big integer A int the external representation described by FORMAT and store it in a newly allocated buffer which address will be put into BUFFER. NWRITTEN receives the actual lengths of the external representation. */ gcry_error_t gcry_mpi_aprint (enum gcry_mpi_format format, unsigned char **buffer, size_t *nwritten, const gcry_mpi_t a); /* Dump the value of A in a format suitable for debugging to Libgcrypt's logging stream. Note that one leading space but no trailing space or linefeed will be printed. It is okay to pass NULL for A. */ void gcry_mpi_dump (const gcry_mpi_t a); /* W = U + V. */ void gcry_mpi_add (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v); /* W = U + V. V is an unsigned integer. */ void gcry_mpi_add_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v); /* W = U + V mod M. */ void gcry_mpi_addm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m); /* W = U - V. */ void gcry_mpi_sub (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v); /* W = U - V. V is an unsigned integer. */ void gcry_mpi_sub_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v ); /* W = U - V mod M */ void gcry_mpi_subm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m); /* W = U * V. */ void gcry_mpi_mul (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v); /* W = U * V. V is an unsigned integer. */ void gcry_mpi_mul_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v ); /* W = U * V mod M. */ void gcry_mpi_mulm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m); /* W = U * (2 ^ CNT). */ void gcry_mpi_mul_2exp (gcry_mpi_t w, gcry_mpi_t u, unsigned long cnt); /* Q = DIVIDEND / DIVISOR, R = DIVIDEND % DIVISOR, Q or R may be passed as NULL. ROUND should be negative or 0. */ void gcry_mpi_div (gcry_mpi_t q, gcry_mpi_t r, gcry_mpi_t dividend, gcry_mpi_t divisor, int round); /* R = DIVIDEND % DIVISOR */ void gcry_mpi_mod (gcry_mpi_t r, gcry_mpi_t dividend, gcry_mpi_t divisor); /* W = B ^ E mod M. */ void gcry_mpi_powm (gcry_mpi_t w, const gcry_mpi_t b, const gcry_mpi_t e, const gcry_mpi_t m); /* Set G to the greatest common divisor of A and B. Return true if the G is 1. */ int gcry_mpi_gcd (gcry_mpi_t g, gcry_mpi_t a, gcry_mpi_t b); /* Set X to the multiplicative inverse of A mod M. Return true if the value exists. */ int gcry_mpi_invm (gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t m); /* Return the number of bits required to represent A. */ unsigned int gcry_mpi_get_nbits (gcry_mpi_t a); /* Return true when bit number N (counting from 0) is set in A. */ int gcry_mpi_test_bit (gcry_mpi_t a, unsigned int n); /* Set bit number N in A. */ void gcry_mpi_set_bit (gcry_mpi_t a, unsigned int n); /* Clear bit number N in A. */ void gcry_mpi_clear_bit (gcry_mpi_t a, unsigned int n); /* Set bit number N in A and clear all bits greater than N. */ void gcry_mpi_set_highbit (gcry_mpi_t a, unsigned int n); /* Clear bit number N in A and all bits greater than N. */ void gcry_mpi_clear_highbit (gcry_mpi_t a, unsigned int n); /* Shift the value of A by N bits to the right and store the result in X. */ void gcry_mpi_rshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n); /* Shift the value of A by N bits to the left and store the result in X. */ void gcry_mpi_lshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n); /* Store NBITS of the value P points to in A and mark A as an opaque value. WARNING: Never use an opaque MPI for anything thing else then gcry_mpi_release, gcry_mpi_get_opaque. */ gcry_mpi_t gcry_mpi_set_opaque (gcry_mpi_t a, void *p, unsigned int nbits); /* Return a pointer to an opaque value stored in A and return its size in NBITS. Note that the returned pointer is still owned by A and that the function should never be used for an non-opaque MPI. */ void *gcry_mpi_get_opaque (gcry_mpi_t a, unsigned int *nbits); /* Set the FLAG for the big integer A. Currently only the flag GCRYMPI_FLAG_SECURE is allowed to convert A into an big intger stored in "secure" memory. */ void gcry_mpi_set_flag (gcry_mpi_t a, enum gcry_mpi_flag flag); /* Clear FLAG for the big integer A. Note that this function is currently useless as no flags are allowed. */ void gcry_mpi_clear_flag (gcry_mpi_t a, enum gcry_mpi_flag flag); /* Return true when the FLAG is set for A. */ int gcry_mpi_get_flag (gcry_mpi_t a, enum gcry_mpi_flag flag); /* Unless the GCRYPT_NO_MPI_MACROS is used, provide a couple of convenience macros for the big integer functions. */ #ifndef GCRYPT_NO_MPI_MACROS #define mpi_new(n) gcry_mpi_new( (n) ) #define mpi_secure_new( n ) gcry_mpi_snew( (n) ) #define mpi_release(a) \ do \ { \ gcry_mpi_release ((a)); \ (a) = NULL; \ } \ while (0) #define mpi_copy( a ) gcry_mpi_copy( (a) ) #define mpi_set( w, u) gcry_mpi_set( (w), (u) ) #define mpi_set_ui( w, u) gcry_mpi_set_ui( (w), (u) ) #define mpi_cmp( u, v ) gcry_mpi_cmp( (u), (v) ) #define mpi_cmp_ui( u, v ) gcry_mpi_cmp_ui( (u), (v) ) #define mpi_add_ui(w,u,v) gcry_mpi_add_ui((w),(u),(v)) #define mpi_add(w,u,v) gcry_mpi_add ((w),(u),(v)) #define mpi_addm(w,u,v,m) gcry_mpi_addm ((w),(u),(v),(m)) #define mpi_sub_ui(w,u,v) gcry_mpi_sub_ui ((w),(u),(v)) #define mpi_sub(w,u,v) gcry_mpi_sub ((w),(u),(v)) #define mpi_subm(w,u,v,m) gcry_mpi_subm ((w),(u),(v),(m)) #define mpi_mul_ui(w,u,v) gcry_mpi_mul_ui ((w),(u),(v)) #define mpi_mul_2exp(w,u,v) gcry_mpi_mul_2exp ((w),(u),(v)) #define mpi_mul(w,u,v) gcry_mpi_mul ((w),(u),(v)) #define mpi_mulm(w,u,v,m) gcry_mpi_mulm ((w),(u),(v),(m)) #define mpi_powm(w,b,e,m) gcry_mpi_powm ( (w), (b), (e), (m) ) #define mpi_tdiv(q,r,a,m) gcry_mpi_div ( (q), (r), (a), (m), 0) #define mpi_fdiv(q,r,a,m) gcry_mpi_div ( (q), (r), (a), (m), -1) #define mpi_mod(r,a,m) gcry_mpi_mod ((r), (a), (m)) #define mpi_gcd(g,a,b) gcry_mpi_gcd ( (g), (a), (b) ) #define mpi_invm(g,a,b) gcry_mpi_invm ( (g), (a), (b) ) #define mpi_get_nbits(a) gcry_mpi_get_nbits ((a)) #define mpi_test_bit(a,b) gcry_mpi_test_bit ((a),(b)) #define mpi_set_bit(a,b) gcry_mpi_set_bit ((a),(b)) #define mpi_set_highbit(a,b) gcry_mpi_set_highbit ((a),(b)) #define mpi_clear_bit(a,b) gcry_mpi_clear_bit ((a),(b)) #define mpi_clear_highbit(a,b) gcry_mpi_clear_highbit ((a),(b)) #define mpi_rshift(a,b,c) gcry_mpi_rshift ((a),(b),(c)) #define mpi_lshift(a,b,c) gcry_mpi_lshift ((a),(b),(c)) #define mpi_set_opaque(a,b,c) gcry_mpi_set_opaque( (a), (b), (c) ) #define mpi_get_opaque(a,b) gcry_mpi_get_opaque( (a), (b) ) #endif /* GCRYPT_NO_MPI_MACROS */ /************************************ * * * Symmetric Cipher Functions * * * ************************************/ /* The data object used to hold a handle to an encryption object. */ struct gcry_cipher_handle; typedef struct gcry_cipher_handle *gcry_cipher_hd_t; #ifndef GCRYPT_NO_DEPRECATED typedef struct gcry_cipher_handle *GCRY_CIPHER_HD _GCRY_GCC_ATTR_DEPRECATED; typedef struct gcry_cipher_handle *GcryCipherHd _GCRY_GCC_ATTR_DEPRECATED; #endif /* All symmetric encryption algorithms are identified by their IDs. More IDs may be registered at runtime. */ enum gcry_cipher_algos { GCRY_CIPHER_NONE = 0, GCRY_CIPHER_IDEA = 1, GCRY_CIPHER_3DES = 2, GCRY_CIPHER_CAST5 = 3, GCRY_CIPHER_BLOWFISH = 4, GCRY_CIPHER_SAFER_SK128 = 5, GCRY_CIPHER_DES_SK = 6, GCRY_CIPHER_AES = 7, GCRY_CIPHER_AES192 = 8, GCRY_CIPHER_AES256 = 9, GCRY_CIPHER_TWOFISH = 10, /* Other cipher numbers are above 300 for OpenPGP reasons. */ GCRY_CIPHER_ARCFOUR = 301, /* Fully compatible with RSA's RC4 (tm). */ GCRY_CIPHER_DES = 302, /* Yes, this is single key 56 bit DES. */ GCRY_CIPHER_TWOFISH128 = 303, GCRY_CIPHER_SERPENT128 = 304, GCRY_CIPHER_SERPENT192 = 305, GCRY_CIPHER_SERPENT256 = 306, GCRY_CIPHER_RFC2268_40 = 307, /* Ron's Cipher 2 (40 bit). */ GCRY_CIPHER_RFC2268_128 = 308, /* Ron's Cipher 2 (128 bit). */ GCRY_CIPHER_SEED = 309, /* 128 bit cipher described in RFC4269. */ GCRY_CIPHER_CAMELLIA128 = 310, GCRY_CIPHER_CAMELLIA192 = 311, GCRY_CIPHER_CAMELLIA256 = 312 }; /* The Rijndael algorithm is basically AES, so provide some macros. */ #define GCRY_CIPHER_AES128 GCRY_CIPHER_AES #define GCRY_CIPHER_RIJNDAEL GCRY_CIPHER_AES #define GCRY_CIPHER_RIJNDAEL128 GCRY_CIPHER_AES128 #define GCRY_CIPHER_RIJNDAEL192 GCRY_CIPHER_AES192 #define GCRY_CIPHER_RIJNDAEL256 GCRY_CIPHER_AES256 /* The supported encryption modes. Note that not all of them are supported for each algorithm. */ enum gcry_cipher_modes { GCRY_CIPHER_MODE_NONE = 0, /* Not yet specified. */ GCRY_CIPHER_MODE_ECB = 1, /* Electronic codebook. */ GCRY_CIPHER_MODE_CFB = 2, /* Cipher feedback. */ GCRY_CIPHER_MODE_CBC = 3, /* Cipher block chaining. */ GCRY_CIPHER_MODE_STREAM = 4, /* Used with stream ciphers. */ GCRY_CIPHER_MODE_OFB = 5, /* Outer feedback. */ GCRY_CIPHER_MODE_CTR = 6, /* Counter. */ GCRY_CIPHER_MODE_AESWRAP= 7 /* AES-WRAP algorithm. */ }; /* Flags used with the open function. */ enum gcry_cipher_flags { GCRY_CIPHER_SECURE = 1, /* Allocate in secure memory. */ GCRY_CIPHER_ENABLE_SYNC = 2, /* Enable CFB sync mode. */ GCRY_CIPHER_CBC_CTS = 4, /* Enable CBC cipher text stealing (CTS). */ GCRY_CIPHER_CBC_MAC = 8 /* Enable CBC message auth. code (MAC). */ }; /* Create a handle for algorithm ALGO to be used in MODE. FLAGS may be given as an bitwise OR of the gcry_cipher_flags values. */ gcry_error_t gcry_cipher_open (gcry_cipher_hd_t *handle, int algo, int mode, unsigned int flags); /* Close the cioher handle H and release all resource. */ void gcry_cipher_close (gcry_cipher_hd_t h); /* Perform various operations on the cipher object H. */ gcry_error_t gcry_cipher_ctl (gcry_cipher_hd_t h, int cmd, void *buffer, size_t buflen); /* Retrieve various information about the cipher object H. */ gcry_error_t gcry_cipher_info (gcry_cipher_hd_t h, int what, void *buffer, size_t *nbytes); /* Retrieve various information about the cipher algorithm ALGO. */ gcry_error_t gcry_cipher_algo_info (int algo, int what, void *buffer, size_t *nbytes); /* Map the cipher algorithm whose ID is contained in ALGORITHM to a string representation of the algorithm name. For unknown algorithm IDs this function returns "?". */ const char *gcry_cipher_algo_name (int algorithm) _GCRY_GCC_ATTR_PURE; /* Map the algorithm name NAME to an cipher algorithm ID. Return 0 if the algorithm name is not known. */ int gcry_cipher_map_name (const char *name) _GCRY_GCC_ATTR_PURE; /* Given an ASN.1 object identifier in standard IETF dotted decimal format in STRING, return the encryption mode associated with that OID or 0 if not known or applicable. */ int gcry_cipher_mode_from_oid (const char *string) _GCRY_GCC_ATTR_PURE; /* Encrypt the plaintext of size INLEN in IN using the cipher handle H into the buffer OUT which has an allocated length of OUTSIZE. For most algorithms it is possible to pass NULL for in and 0 for INLEN and do a in-place decryption of the data provided in OUT. */ gcry_error_t gcry_cipher_encrypt (gcry_cipher_hd_t h, void *out, size_t outsize, const void *in, size_t inlen); /* The counterpart to gcry_cipher_encrypt. */ gcry_error_t gcry_cipher_decrypt (gcry_cipher_hd_t h, void *out, size_t outsize, const void *in, size_t inlen); /* Set KEY of length KEYLEN bytes for the cipher handle HD. */ gcry_error_t gcry_cipher_setkey (gcry_cipher_hd_t hd, const void *key, size_t keylen); /* Set initialization vector IV of length IVLEN for the cipher handle HD. */ gcry_error_t gcry_cipher_setiv (gcry_cipher_hd_t hd, const void *iv, size_t ivlen); /* Reset the handle to the state after open. */ #define gcry_cipher_reset(h) gcry_cipher_ctl ((h), GCRYCTL_RESET, NULL, 0) /* Perform the OpenPGP sync operation if this is enabled for the cipher handle H. */ #define gcry_cipher_sync(h) gcry_cipher_ctl( (h), GCRYCTL_CFB_SYNC, NULL, 0) /* Enable or disable CTS in future calls to gcry_encrypt(). CBC mode only. */ #define gcry_cipher_cts(h,on) gcry_cipher_ctl( (h), GCRYCTL_SET_CBC_CTS, \ NULL, on ) /* Set counter for CTR mode. (CTR,CTRLEN) must denote a buffer of block size length, or (NULL,0) to set the CTR to the all-zero block. */ gpg_error_t gcry_cipher_setctr (gcry_cipher_hd_t hd, const void *ctr, size_t ctrlen); /* Retrieve the key length in bytes used with algorithm A. */ size_t gcry_cipher_get_algo_keylen (int algo); /* Retrieve the block length in bytes used with algorithm A. */ size_t gcry_cipher_get_algo_blklen (int algo); /* Return 0 if the algorithm A is available for use. */ #define gcry_cipher_test_algo(a) \ gcry_cipher_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL ) /* Get a list consisting of the IDs of the loaded cipher modules. If LIST is zero, write the number of loaded cipher modules to LIST_LENGTH and return. If LIST is non-zero, the first *LIST_LENGTH algorithm IDs are stored in LIST, which must be of according size. In case there are less cipher modules than *LIST_LENGTH, *LIST_LENGTH is updated to the correct number. */ gcry_error_t gcry_cipher_list (int *list, int *list_length); /************************************ * * * Asymmetric Cipher Functions * * * ************************************/ /* The algorithms and their IDs we support. */ enum gcry_pk_algos { GCRY_PK_RSA = 1, GCRY_PK_RSA_E = 2, /* (deprecated) */ GCRY_PK_RSA_S = 3, /* (deprecated) */ GCRY_PK_ELG_E = 16, GCRY_PK_DSA = 17, GCRY_PK_ELG = 20, GCRY_PK_ECDSA = 301, GCRY_PK_ECDH = 302 }; /* Flags describing usage capabilities of a PK algorithm. */ #define GCRY_PK_USAGE_SIGN 1 /* Good for signatures. */ #define GCRY_PK_USAGE_ENCR 2 /* Good for encryption. */ #define GCRY_PK_USAGE_CERT 4 /* Good to certify other keys. */ #define GCRY_PK_USAGE_AUTH 8 /* Good for authentication. */ #define GCRY_PK_USAGE_UNKN 128 /* Unknown usage flag. */ /* Encrypt the DATA using the public key PKEY and store the result as a newly created S-expression at RESULT. */ gcry_error_t gcry_pk_encrypt (gcry_sexp_t *result, gcry_sexp_t data, gcry_sexp_t pkey); /* Decrypt the DATA using the private key SKEY and store the result as a newly created S-expression at RESULT. */ gcry_error_t gcry_pk_decrypt (gcry_sexp_t *result, gcry_sexp_t data, gcry_sexp_t skey); /* Sign the DATA using the private key SKEY and store the result as a newly created S-expression at RESULT. */ gcry_error_t gcry_pk_sign (gcry_sexp_t *result, gcry_sexp_t data, gcry_sexp_t skey); /* Check the signature SIGVAL on DATA using the public key PKEY. */ gcry_error_t gcry_pk_verify (gcry_sexp_t sigval, gcry_sexp_t data, gcry_sexp_t pkey); /* Check that private KEY is sane. */ gcry_error_t gcry_pk_testkey (gcry_sexp_t key); /* Generate a new key pair according to the parameters given in S_PARMS. The new key pair is returned in as an S-expression in R_KEY. */ gcry_error_t gcry_pk_genkey (gcry_sexp_t *r_key, gcry_sexp_t s_parms); /* Catch all function for miscellaneous operations. */ gcry_error_t gcry_pk_ctl (int cmd, void *buffer, size_t buflen); /* Retrieve information about the public key algorithm ALGO. */ gcry_error_t gcry_pk_algo_info (int algo, int what, void *buffer, size_t *nbytes); /* Map the public key algorithm whose ID is contained in ALGORITHM to a string representation of the algorithm name. For unknown algorithm IDs this functions returns "?". */ const char *gcry_pk_algo_name (int algorithm) _GCRY_GCC_ATTR_PURE; /* Map the algorithm NAME to a public key algorithm Id. Return 0 if the algorithm name is not known. */ int gcry_pk_map_name (const char* name) _GCRY_GCC_ATTR_PURE; /* Return what is commonly referred as the key length for the given public or private KEY. */ unsigned int gcry_pk_get_nbits (gcry_sexp_t key) _GCRY_GCC_ATTR_PURE; /* Please note that keygrip is still experimental and should not be used without contacting the author. */ unsigned char *gcry_pk_get_keygrip (gcry_sexp_t key, unsigned char *array); /* Return the name of the curve matching KEY. */ const char *gcry_pk_get_curve (gcry_sexp_t key, int iterator, unsigned int *r_nbits); /* Return an S-expression with the parameters of the named ECC curve NAME. ALGO must be set to an ECC algorithm. */ gcry_sexp_t gcry_pk_get_param (int algo, const char *name); /* Return 0 if the public key algorithm A is available for use. */ #define gcry_pk_test_algo(a) \ gcry_pk_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL ) /* Get a list consisting of the IDs of the loaded pubkey modules. If LIST is zero, write the number of loaded pubkey modules to LIST_LENGTH and return. If LIST is non-zero, the first *LIST_LENGTH algorithm IDs are stored in LIST, which must be of according size. In case there are less pubkey modules than *LIST_LENGTH, *LIST_LENGTH is updated to the correct number. */ gcry_error_t gcry_pk_list (int *list, int *list_length); /************************************ * * * Cryptograhic Hash Functions * * * ************************************/ /* Algorithm IDs for the hash functions we know about. Not all of them are implemnted. */ enum gcry_md_algos { GCRY_MD_NONE = 0, GCRY_MD_MD5 = 1, GCRY_MD_SHA1 = 2, GCRY_MD_RMD160 = 3, GCRY_MD_MD2 = 5, GCRY_MD_TIGER = 6, /* TIGER/192 as used by gpg <= 1.3.2. */ GCRY_MD_HAVAL = 7, /* HAVAL, 5 pass, 160 bit. */ GCRY_MD_SHA256 = 8, GCRY_MD_SHA384 = 9, GCRY_MD_SHA512 = 10, GCRY_MD_SHA224 = 11, GCRY_MD_MD4 = 301, GCRY_MD_CRC32 = 302, GCRY_MD_CRC32_RFC1510 = 303, GCRY_MD_CRC24_RFC2440 = 304, GCRY_MD_WHIRLPOOL = 305, GCRY_MD_TIGER1 = 306, /* TIGER fixed. */ GCRY_MD_TIGER2 = 307 /* TIGER2 variant. */ }; /* Flags used with the open function. */ enum gcry_md_flags { GCRY_MD_FLAG_SECURE = 1, /* Allocate all buffers in "secure" memory. */ GCRY_MD_FLAG_HMAC = 2 /* Make an HMAC out of this algorithm. */ }; /* (Forward declaration.) */ struct gcry_md_context; /* This object is used to hold a handle to a message digest object. This structure is private - only to be used by the public gcry_md_* macros. */ typedef struct gcry_md_handle { /* Actual context. */ struct gcry_md_context *ctx; /* Buffer management. */ int bufpos; int bufsize; unsigned char buf[1]; } *gcry_md_hd_t; /* Compatibility types, do not use them. */ #ifndef GCRYPT_NO_DEPRECATED typedef struct gcry_md_handle *GCRY_MD_HD _GCRY_GCC_ATTR_DEPRECATED; typedef struct gcry_md_handle *GcryMDHd _GCRY_GCC_ATTR_DEPRECATED; #endif /* Create a message digest object for algorithm ALGO. FLAGS may be given as an bitwise OR of the gcry_md_flags values. ALGO may be given as 0 if the algorithms to be used are later set using gcry_md_enable. */ gcry_error_t gcry_md_open (gcry_md_hd_t *h, int algo, unsigned int flags); /* Release the message digest object HD. */ void gcry_md_close (gcry_md_hd_t hd); /* Add the message digest algorithm ALGO to the digest object HD. */ gcry_error_t gcry_md_enable (gcry_md_hd_t hd, int algo); /* Create a new digest object as an exact copy of the object HD. */ gcry_error_t gcry_md_copy (gcry_md_hd_t *bhd, gcry_md_hd_t ahd); /* Reset the digest object HD to its initial state. */ void gcry_md_reset (gcry_md_hd_t hd); /* Perform various operations on the digest object HD. */ gcry_error_t gcry_md_ctl (gcry_md_hd_t hd, int cmd, void *buffer, size_t buflen); /* Pass LENGTH bytes of data in BUFFER to the digest object HD so that it can update the digest values. This is the actual hash function. */ void gcry_md_write (gcry_md_hd_t hd, const void *buffer, size_t length); /* Read out the final digest from HD return the digest value for algorithm ALGO. */ unsigned char *gcry_md_read (gcry_md_hd_t hd, int algo); /* Convenience function to calculate the hash from the data in BUFFER of size LENGTH using the algorithm ALGO avoiding the creating of a hash object. The hash is returned in the caller provided buffer DIGEST which must be large enough to hold the digest of the given algorithm. */ void gcry_md_hash_buffer (int algo, void *digest, const void *buffer, size_t length); /* Retrieve the algorithm used with HD. This does not work reliable if more than one algorithm is enabled in HD. */ int gcry_md_get_algo (gcry_md_hd_t hd); /* Retrieve the length in bytes of the digest yielded by algorithm ALGO. */ unsigned int gcry_md_get_algo_dlen (int algo); /* Return true if the the algorithm ALGO is enabled in the digest object A. */ int gcry_md_is_enabled (gcry_md_hd_t a, int algo); /* Return true if the digest object A is allocated in "secure" memory. */ int gcry_md_is_secure (gcry_md_hd_t a); /* Retrieve various information about the object H. */ gcry_error_t gcry_md_info (gcry_md_hd_t h, int what, void *buffer, size_t *nbytes); /* Retrieve various information about the algorithm ALGO. */ gcry_error_t gcry_md_algo_info (int algo, int what, void *buffer, size_t *nbytes); /* Map the digest algorithm id ALGO to a string representation of the algorithm name. For unknown algorithms this function returns "?". */ const char *gcry_md_algo_name (int algo) _GCRY_GCC_ATTR_PURE; /* Map the algorithm NAME to a digest algorithm Id. Return 0 if the algorithm name is not known. */ int gcry_md_map_name (const char* name) _GCRY_GCC_ATTR_PURE; /* For use with the HMAC feature, the set MAC key to the KEY of KEYLEN bytes. */ gcry_error_t gcry_md_setkey (gcry_md_hd_t hd, const void *key, size_t keylen); /* Start or stop debugging for digest handle HD; i.e. create a file named dbgmd-<n>.<suffix> while hashing. If SUFFIX is NULL, debugging stops and the file will be closed. */ void gcry_md_debug (gcry_md_hd_t hd, const char *suffix); /* Update the hash(s) of H with the character C. This is a buffered version of the gcry_md_write function. */ #define gcry_md_putc(h,c) \ do { \ gcry_md_hd_t h__ = (h); \ if( (h__)->bufpos == (h__)->bufsize ) \ gcry_md_write( (h__), NULL, 0 ); \ (h__)->buf[(h__)->bufpos++] = (c) & 0xff; \ } while(0) /* Finalize the digest calculation. This is not really needed because gcry_md_read() does this implicitly. */ #define gcry_md_final(a) \ gcry_md_ctl ((a), GCRYCTL_FINALIZE, NULL, 0) /* Return 0 if the algorithm A is available for use. */ #define gcry_md_test_algo(a) \ gcry_md_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL ) /* Return an DER encoded ASN.1 OID for the algorithm A in buffer B. N must point to size_t variable with the available size of buffer B. After return it will receive the actual size of the returned OID. */ #define gcry_md_get_asnoid(a,b,n) \ gcry_md_algo_info((a), GCRYCTL_GET_ASNOID, (b), (n)) /* Enable debugging for digest object A; i.e. create files named dbgmd-<n>.<string> while hashing. B is a string used as the suffix for the filename. This macro is deprecated, use gcry_md_debug. */ #ifndef GCRYPT_NO_DEPRECATED #define gcry_md_start_debug(a,b) \ gcry_md_ctl( (a), GCRYCTL_START_DUMP, (b), 0 ) /* Disable the debugging of A. This macro is deprecated, use gcry_md_debug. */ #define gcry_md_stop_debug(a,b) \ gcry_md_ctl( (a), GCRYCTL_STOP_DUMP, (b), 0 ) #endif /* Get a list consisting of the IDs of the loaded message digest modules. If LIST is zero, write the number of loaded message digest modules to LIST_LENGTH and return. If LIST is non-zero, the first *LIST_LENGTH algorithm IDs are stored in LIST, which must be of according size. In case there are less message digest modules than *LIST_LENGTH, *LIST_LENGTH is updated to the correct number. */ gcry_error_t gcry_md_list (int *list, int *list_length); #if !defined(GCRYPT_NO_DEPRECATED) || defined(_GCRYPT_IN_LIBGCRYPT) /* Alternative interface for asymmetric cryptography. This interface is deprecated. */ /* The algorithm IDs. */ typedef enum gcry_ac_id { GCRY_AC_RSA = 1, GCRY_AC_DSA = 17, GCRY_AC_ELG = 20, GCRY_AC_ELG_E = 16 } gcry_ac_id_t _GCRY_ATTR_INTERNAL; /* Key types. */ typedef enum gcry_ac_key_type { GCRY_AC_KEY_SECRET, GCRY_AC_KEY_PUBLIC } gcry_ac_key_type_t _GCRY_ATTR_INTERNAL; /* Encoding methods. */ typedef enum gcry_ac_em { GCRY_AC_EME_PKCS_V1_5, GCRY_AC_EMSA_PKCS_V1_5 } gcry_ac_em_t _GCRY_ATTR_INTERNAL; /* Encryption and Signature schemes. */ typedef enum gcry_ac_scheme { GCRY_AC_ES_PKCS_V1_5, GCRY_AC_SSA_PKCS_V1_5 } gcry_ac_scheme_t _GCRY_ATTR_INTERNAL; /* AC data. */ #define GCRY_AC_FLAG_DEALLOC (1 << 0) #define GCRY_AC_FLAG_COPY (1 << 1) #define GCRY_AC_FLAG_NO_BLINDING (1 << 2) /* This type represents a `data set'. */ typedef struct gcry_ac_data *gcry_ac_data_t _GCRY_ATTR_INTERNAL; /* This type represents a single `key', either a secret one or a public one. */ typedef struct gcry_ac_key *gcry_ac_key_t _GCRY_ATTR_INTERNAL; /* This type represents a `key pair' containing a secret and a public key. */ typedef struct gcry_ac_key_pair *gcry_ac_key_pair_t _GCRY_ATTR_INTERNAL; /* This type represents a `handle' that is needed by functions performing cryptographic operations. */ typedef struct gcry_ac_handle *gcry_ac_handle_t _GCRY_ATTR_INTERNAL; typedef gpg_error_t (*gcry_ac_data_read_cb_t) (void *opaque, unsigned char *buffer, size_t *buffer_n) /* */ _GCRY_ATTR_INTERNAL; typedef gpg_error_t (*gcry_ac_data_write_cb_t) (void *opaque, unsigned char *buffer, size_t buffer_n) /* */ _GCRY_ATTR_INTERNAL; typedef enum { GCRY_AC_IO_READABLE, GCRY_AC_IO_WRITABLE } gcry_ac_io_mode_t _GCRY_ATTR_INTERNAL; typedef enum { GCRY_AC_IO_STRING, GCRY_AC_IO_CALLBACK } gcry_ac_io_type_t _GCRY_ATTR_INTERNAL; typedef struct gcry_ac_io { /* This is an INTERNAL structure, do NOT use manually. */ gcry_ac_io_mode_t mode _GCRY_ATTR_INTERNAL; gcry_ac_io_type_t type _GCRY_ATTR_INTERNAL; union { union { struct { gcry_ac_data_read_cb_t cb; void *opaque; } callback; struct { unsigned char *data; size_t data_n; } string; void *opaque; } readable; union { struct { gcry_ac_data_write_cb_t cb; void *opaque; } callback; struct { unsigned char **data; size_t *data_n; } string; void *opaque; } writable; } io _GCRY_ATTR_INTERNAL; } gcry_ac_io_t _GCRY_ATTR_INTERNAL; /* The caller of gcry_ac_key_pair_generate can provide one of these structures in order to influence the key generation process in an algorithm-specific way. */ typedef struct gcry_ac_key_spec_rsa { gcry_mpi_t e; /* E to use. */ } gcry_ac_key_spec_rsa_t _GCRY_ATTR_INTERNAL; /* Structure used for passing data to the implementation of the `EME-PKCS-V1_5' encoding method. */ typedef struct gcry_ac_eme_pkcs_v1_5 { size_t key_size; } gcry_ac_eme_pkcs_v1_5_t _GCRY_ATTR_INTERNAL; typedef enum gcry_md_algos gcry_md_algo_t _GCRY_ATTR_INTERNAL; /* Structure used for passing data to the implementation of the `EMSA-PKCS-V1_5' encoding method. */ typedef struct gcry_ac_emsa_pkcs_v1_5 { gcry_md_algo_t md; size_t em_n; } gcry_ac_emsa_pkcs_v1_5_t _GCRY_ATTR_INTERNAL; /* Structure used for passing data to the implementation of the `SSA-PKCS-V1_5' signature scheme. */ typedef struct gcry_ac_ssa_pkcs_v1_5 { gcry_md_algo_t md; } gcry_ac_ssa_pkcs_v1_5_t _GCRY_ATTR_INTERNAL; #endif /* !GCRYPT_NO_DEPRECATED || !_GCRYPT_IN_LIBGCRYPT */ #ifndef GCRYPT_NO_DEPRECATED /* Returns a new, empty data set in DATA. */ gcry_error_t gcry_ac_data_new (gcry_ac_data_t *data) /* */ _GCRY_ATTR_INTERNAL; /* Destroy the data set DATA. */ void gcry_ac_data_destroy (gcry_ac_data_t data) /* */ _GCRY_ATTR_INTERNAL; /* Create a copy of the data set DATA and store it in DATA_CP. */ gcry_error_t gcry_ac_data_copy (gcry_ac_data_t *data_cp, gcry_ac_data_t data) /* */ _GCRY_ATTR_INTERNAL; /* Return the number of named MPI values inside of the data set DATA. */ unsigned int gcry_ac_data_length (gcry_ac_data_t data) /* */ _GCRY_ATTR_INTERNAL; /* Destroy any values contained in the data set DATA. */ void gcry_ac_data_clear (gcry_ac_data_t data) /* */ _GCRY_ATTR_INTERNAL; /* Add the value MPI to DATA with the label NAME. If FLAGS contains GCRY_AC_FLAG_DATA_COPY, the data set will contain copies of NAME and MPI. If FLAGS contains GCRY_AC_FLAG_DATA_DEALLOC or GCRY_AC_FLAG_DATA_COPY, the values contained in the data set will be deallocated when they are to be removed from the data set. */ gcry_error_t gcry_ac_data_set (gcry_ac_data_t data, unsigned int flags, const char *name, gcry_mpi_t mpi) /* */ _GCRY_ATTR_INTERNAL; /* Store the value labelled with NAME found in DATA in MPI. If FLAGS contains GCRY_AC_FLAG_COPY, store a copy of the MPI value contained in the data set. MPI may be NULL. */ gcry_error_t gcry_ac_data_get_name (gcry_ac_data_t data, unsigned int flags, const char *name, gcry_mpi_t *mpi) /* */ _GCRY_ATTR_INTERNAL; /* Stores in NAME and MPI the named MPI value contained in the data set DATA with the index IDX. If FLAGS contains GCRY_AC_FLAG_COPY, store copies of the values contained in the data set. NAME or MPI may be NULL. */ gcry_error_t gcry_ac_data_get_index (gcry_ac_data_t data, unsigned int flags, unsigned int idx, const char **name, gcry_mpi_t *mpi) /* */ _GCRY_ATTR_INTERNAL; /* Convert the data set DATA into a new S-Expression, which is to be stored in SEXP, according to the identifiers contained in IDENTIFIERS. */ gcry_error_t gcry_ac_data_to_sexp (gcry_ac_data_t data, gcry_sexp_t *sexp, const char **identifiers) /* */ _GCRY_ATTR_INTERNAL; /* Create a new data set, which is to be stored in DATA_SET, from the S-Expression SEXP, according to the identifiers contained in IDENTIFIERS. */ gcry_error_t gcry_ac_data_from_sexp (gcry_ac_data_t *data, gcry_sexp_t sexp, const char **identifiers) /* */ _GCRY_ATTR_INTERNAL; /* Initialize AC_IO according to MODE, TYPE and the variable list of arguments. The list of variable arguments to specify depends on the given TYPE. */ void gcry_ac_io_init (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode, gcry_ac_io_type_t type, ...) /* */ _GCRY_ATTR_INTERNAL; /* Initialize AC_IO according to MODE, TYPE and the variable list of arguments AP. The list of variable arguments to specify depends on the given TYPE. */ void gcry_ac_io_init_va (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode, gcry_ac_io_type_t type, va_list ap) /* */ _GCRY_ATTR_INTERNAL; /* Create a new ac handle. */ gcry_error_t gcry_ac_open (gcry_ac_handle_t *handle, gcry_ac_id_t algorithm, unsigned int flags) /* */ _GCRY_ATTR_INTERNAL; /* Destroy an ac handle. */ void gcry_ac_close (gcry_ac_handle_t handle) /* */ _GCRY_ATTR_INTERNAL; /* Initialize a key from a given data set. */ gcry_error_t gcry_ac_key_init (gcry_ac_key_t *key, gcry_ac_handle_t handle, gcry_ac_key_type_t type, gcry_ac_data_t data) /* */ _GCRY_ATTR_INTERNAL; /* Generates a new key pair via the handle HANDLE of NBITS bits and stores it in KEY_PAIR. In case non-standard settings are wanted, a pointer to a structure of type gcry_ac_key_spec_<algorithm>_t, matching the selected algorithm, can be given as KEY_SPEC. MISC_DATA is not used yet. */ gcry_error_t gcry_ac_key_pair_generate (gcry_ac_handle_t handle, unsigned int nbits, void *spec, gcry_ac_key_pair_t *key_pair, gcry_mpi_t **misc_data) /* */ _GCRY_ATTR_INTERNAL; /* Returns the key of type WHICH out of the key pair KEY_PAIR. */ gcry_ac_key_t gcry_ac_key_pair_extract (gcry_ac_key_pair_t key_pair, gcry_ac_key_type_t which) /* */ _GCRY_ATTR_INTERNAL; /* Returns the data set contained in the key KEY. */ gcry_ac_data_t gcry_ac_key_data_get (gcry_ac_key_t key) /* */ _GCRY_ATTR_INTERNAL; /* Verifies that the key KEY is sane via HANDLE. */ gcry_error_t gcry_ac_key_test (gcry_ac_handle_t handle, gcry_ac_key_t key) /* */ _GCRY_ATTR_INTERNAL; /* Stores the number of bits of the key KEY in NBITS via HANDLE. */ gcry_error_t gcry_ac_key_get_nbits (gcry_ac_handle_t handle, gcry_ac_key_t key, unsigned int *nbits) /* */ _GCRY_ATTR_INTERNAL; /* Writes the 20 byte long key grip of the key KEY to KEY_GRIP via HANDLE. */ gcry_error_t gcry_ac_key_get_grip (gcry_ac_handle_t handle, gcry_ac_key_t key, unsigned char *key_grip) /* */ _GCRY_ATTR_INTERNAL; /* Destroy a key. */ void gcry_ac_key_destroy (gcry_ac_key_t key) /* */ _GCRY_ATTR_INTERNAL; /* Destroy a key pair. */ void gcry_ac_key_pair_destroy (gcry_ac_key_pair_t key_pair) /* */ _GCRY_ATTR_INTERNAL; /* Encodes a message according to the encoding method METHOD. OPTIONS must be a pointer to a method-specific structure (gcry_ac_em*_t). */ gcry_error_t gcry_ac_data_encode (gcry_ac_em_t method, unsigned int flags, void *options, gcry_ac_io_t *io_read, gcry_ac_io_t *io_write) /* */ _GCRY_ATTR_INTERNAL; /* Decodes a message according to the encoding method METHOD. OPTIONS must be a pointer to a method-specific structure (gcry_ac_em*_t). */ gcry_error_t gcry_ac_data_decode (gcry_ac_em_t method, unsigned int flags, void *options, gcry_ac_io_t *io_read, gcry_ac_io_t *io_write) /* */ _GCRY_ATTR_INTERNAL; /* Encrypt the plain text MPI value DATA_PLAIN with the key KEY under the control of the flags FLAGS and store the resulting data set into DATA_ENCRYPTED. */ gcry_error_t gcry_ac_data_encrypt (gcry_ac_handle_t handle, unsigned int flags, gcry_ac_key_t key, gcry_mpi_t data_plain, gcry_ac_data_t *data_encrypted) /* */ _GCRY_ATTR_INTERNAL; /* Decrypt the decrypted data contained in the data set DATA_ENCRYPTED with the key KEY under the control of the flags FLAGS and store the resulting plain text MPI value in DATA_PLAIN. */ gcry_error_t gcry_ac_data_decrypt (gcry_ac_handle_t handle, unsigned int flags, gcry_ac_key_t key, gcry_mpi_t *data_plain, gcry_ac_data_t data_encrypted) /* */ _GCRY_ATTR_INTERNAL; /* Sign the data contained in DATA with the key KEY and store the resulting signature in the data set DATA_SIGNATURE. */ gcry_error_t gcry_ac_data_sign (gcry_ac_handle_t handle, gcry_ac_key_t key, gcry_mpi_t data, gcry_ac_data_t *data_signature) /* */ _GCRY_ATTR_INTERNAL; /* Verify that the signature contained in the data set DATA_SIGNATURE is indeed the result of signing the data contained in DATA with the secret key belonging to the public key KEY. */ gcry_error_t gcry_ac_data_verify (gcry_ac_handle_t handle, gcry_ac_key_t key, gcry_mpi_t data, gcry_ac_data_t data_signature) /* */ _GCRY_ATTR_INTERNAL; /* Encrypts the plain text readable from IO_MESSAGE through HANDLE with the public key KEY according to SCHEME, FLAGS and OPTS. If OPTS is not NULL, it has to be a pointer to a structure specific to the chosen scheme (gcry_ac_es_*_t). The encrypted message is written to IO_CIPHER. */ gcry_error_t gcry_ac_data_encrypt_scheme (gcry_ac_handle_t handle, gcry_ac_scheme_t scheme, unsigned int flags, void *opts, gcry_ac_key_t key, gcry_ac_io_t *io_message, gcry_ac_io_t *io_cipher) /* */ _GCRY_ATTR_INTERNAL; /* Decrypts the cipher text readable from IO_CIPHER through HANDLE with the secret key KEY according to SCHEME, @var{flags} and OPTS. If OPTS is not NULL, it has to be a pointer to a structure specific to the chosen scheme (gcry_ac_es_*_t). The decrypted message is written to IO_MESSAGE. */ gcry_error_t gcry_ac_data_decrypt_scheme (gcry_ac_handle_t handle, gcry_ac_scheme_t scheme, unsigned int flags, void *opts, gcry_ac_key_t key, gcry_ac_io_t *io_cipher, gcry_ac_io_t *io_message) /* */ _GCRY_ATTR_INTERNAL; /* Signs the message readable from IO_MESSAGE through HANDLE with the secret key KEY according to SCHEME, FLAGS and OPTS. If OPTS is not NULL, it has to be a pointer to a structure specific to the chosen scheme (gcry_ac_ssa_*_t). The signature is written to IO_SIGNATURE. */ gcry_error_t gcry_ac_data_sign_scheme (gcry_ac_handle_t handle, gcry_ac_scheme_t scheme, unsigned int flags, void *opts, gcry_ac_key_t key, gcry_ac_io_t *io_message, gcry_ac_io_t *io_signature) /* */ _GCRY_ATTR_INTERNAL; /* Verifies through HANDLE that the signature readable from IO_SIGNATURE is indeed the result of signing the message readable from IO_MESSAGE with the secret key belonging to the public key KEY according to SCHEME and OPTS. If OPTS is not NULL, it has to be an anonymous structure (gcry_ac_ssa_*_t) specific to the chosen scheme. */ gcry_error_t gcry_ac_data_verify_scheme (gcry_ac_handle_t handle, gcry_ac_scheme_t scheme, unsigned int flags, void *opts, gcry_ac_key_t key, gcry_ac_io_t *io_message, gcry_ac_io_t *io_signature) /* */ _GCRY_ATTR_INTERNAL; /* Store the textual representation of the algorithm whose id is given in ALGORITHM in NAME. This function is deprecated; use gcry_pk_algo_name. */ gcry_error_t gcry_ac_id_to_name (gcry_ac_id_t algorithm, const char **name) /* */ _GCRY_GCC_ATTR_DEPRECATED; /* Store the numeric ID of the algorithm whose textual representation is contained in NAME in ALGORITHM. This function is deprecated; use gcry_pk_map_name. */ gcry_error_t gcry_ac_name_to_id (const char *name, gcry_ac_id_t *algorithm) /* */ _GCRY_GCC_ATTR_DEPRECATED; #endif /*GCRYPT_NO_DEPRECATED*/ /****************************** * * * Key Derivation Functions * * * ******************************/ /* Algorithm IDs for the KDFs. */ enum gcry_kdf_algos { GCRY_KDF_NONE = 0, GCRY_KDF_SIMPLE_S2K = 16, GCRY_KDF_SALTED_S2K = 17, GCRY_KDF_ITERSALTED_S2K = 19, GCRY_KDF_PBKDF1 = 33, GCRY_KDF_PBKDF2 = 34 }; /* Derive a key from a passphrase. */ gpg_error_t gcry_kdf_derive (const void *passphrase, size_t passphraselen, int algo, int subalgo, const void *salt, size_t saltlen, unsigned long iterations, size_t keysize, void *keybuffer); /************************************ * * * Random Generating Functions * * * ************************************/ /* The possible values for the random quality. The rule of thumb is to use STRONG for session keys and VERY_STRONG for key material. WEAK is usually an alias for STRONG and should not be used anymore (except with gcry_mpi_randomize); use gcry_create_nonce instead. */ typedef enum gcry_random_level { GCRY_WEAK_RANDOM = 0, GCRY_STRONG_RANDOM = 1, GCRY_VERY_STRONG_RANDOM = 2 } gcry_random_level_t; /* Fill BUFFER with LENGTH bytes of random, using random numbers of quality LEVEL. */ void gcry_randomize (void *buffer, size_t length, enum gcry_random_level level); /* Add the external random from BUFFER with LENGTH bytes into the pool. QUALITY should either be -1 for unknown or in the range of 0 to 100 */ gcry_error_t gcry_random_add_bytes (const void *buffer, size_t length, int quality); /* If random numbers are used in an application, this macro should be called from time to time so that new stuff gets added to the internal pool of the RNG. */ #define gcry_fast_random_poll() gcry_control (GCRYCTL_FAST_POLL, NULL) /* Return NBYTES of allocated random using a random numbers of quality LEVEL. */ void *gcry_random_bytes (size_t nbytes, enum gcry_random_level level) _GCRY_GCC_ATTR_MALLOC; /* Return NBYTES of allocated random using a random numbers of quality LEVEL. The random numbers are created returned in "secure" memory. */ void *gcry_random_bytes_secure (size_t nbytes, enum gcry_random_level level) _GCRY_GCC_ATTR_MALLOC; /* Set the big integer W to a random value of NBITS using a random generator with quality LEVEL. Note that by using a level of GCRY_WEAK_RANDOM gcry_create_nonce is used internally. */ void gcry_mpi_randomize (gcry_mpi_t w, unsigned int nbits, enum gcry_random_level level); /* Create an unpredicable nonce of LENGTH bytes in BUFFER. */ void gcry_create_nonce (void *buffer, size_t length); /*******************************/ /* */ /* Prime Number Functions */ /* */ /*******************************/ /* Mode values passed to a gcry_prime_check_func_t. */ #define GCRY_PRIME_CHECK_AT_FINISH 0 #define GCRY_PRIME_CHECK_AT_GOT_PRIME 1 #define GCRY_PRIME_CHECK_AT_MAYBE_PRIME 2 /* The function should return 1 if the operation shall continue, 0 to reject the prime candidate. */ typedef int (*gcry_prime_check_func_t) (void *arg, int mode, gcry_mpi_t candidate); /* Flags for gcry_prime_generate(): */ /* Allocate prime numbers and factors in secure memory. */ #define GCRY_PRIME_FLAG_SECRET (1 << 0) /* Make sure that at least one prime factor is of size `FACTOR_BITS'. */ #define GCRY_PRIME_FLAG_SPECIAL_FACTOR (1 << 1) /* Generate a new prime number of PRIME_BITS bits and store it in PRIME. If FACTOR_BITS is non-zero, one of the prime factors of (prime - 1) / 2 must be FACTOR_BITS bits long. If FACTORS is non-zero, allocate a new, NULL-terminated array holding the prime factors and store it in FACTORS. FLAGS might be used to influence the prime number generation process. */ gcry_error_t gcry_prime_generate (gcry_mpi_t *prime, unsigned int prime_bits, unsigned int factor_bits, gcry_mpi_t **factors, gcry_prime_check_func_t cb_func, void *cb_arg, gcry_random_level_t random_level, unsigned int flags); /* Find a generator for PRIME where the factorization of (prime-1) is in the NULL terminated array FACTORS. Return the generator as a newly allocated MPI in R_G. If START_G is not NULL, use this as teh start for the search. */ gcry_error_t gcry_prime_group_generator (gcry_mpi_t *r_g, gcry_mpi_t prime, gcry_mpi_t *factors, gcry_mpi_t start_g); /* Convenience function to release the FACTORS array. */ void gcry_prime_release_factors (gcry_mpi_t *factors); /* Check wether the number X is prime. */ gcry_error_t gcry_prime_check (gcry_mpi_t x, unsigned int flags); /************************************ * * * Miscellaneous Stuff * * * ************************************/ /* Log levels used by the internal logging facility. */ enum gcry_log_levels { GCRY_LOG_CONT = 0, /* (Continue the last log line.) */ GCRY_LOG_INFO = 10, GCRY_LOG_WARN = 20, GCRY_LOG_ERROR = 30, GCRY_LOG_FATAL = 40, GCRY_LOG_BUG = 50, GCRY_LOG_DEBUG = 100 }; /* Type for progress handlers. */ typedef void (*gcry_handler_progress_t) (void *, const char *, int, int, int); /* Type for memory allocation handlers. */ typedef void *(*gcry_handler_alloc_t) (size_t n); /* Type for secure memory check handlers. */ typedef int (*gcry_handler_secure_check_t) (const void *); /* Type for memory reallocation handlers. */ typedef void *(*gcry_handler_realloc_t) (void *p, size_t n); /* Type for memory free handlers. */ typedef void (*gcry_handler_free_t) (void *); /* Type for out-of-memory handlers. */ typedef int (*gcry_handler_no_mem_t) (void *, size_t, unsigned int); /* Type for fatal error handlers. */ typedef void (*gcry_handler_error_t) (void *, int, const char *); /* Type for logging handlers. */ typedef void (*gcry_handler_log_t) (void *, int, const char *, va_list); /* Certain operations can provide progress information. This function is used to register a handler for retrieving these information. */ void gcry_set_progress_handler (gcry_handler_progress_t cb, void *cb_data); /* Register a custom memory allocation functions. */ void gcry_set_allocation_handler ( gcry_handler_alloc_t func_alloc, gcry_handler_alloc_t func_alloc_secure, gcry_handler_secure_check_t func_secure_check, gcry_handler_realloc_t func_realloc, gcry_handler_free_t func_free); /* Register a function used instead of the internal out of memory handler. */ void gcry_set_outofcore_handler (gcry_handler_no_mem_t h, void *opaque); /* Register a function used instead of the internal fatal error handler. */ void gcry_set_fatalerror_handler (gcry_handler_error_t fnc, void *opaque); /* Register a function used instead of the internal logging facility. */ void gcry_set_log_handler (gcry_handler_log_t f, void *opaque); /* Reserved for future use. */ void gcry_set_gettext_handler (const char *(*f)(const char*)); /* Libgcrypt uses its own memory allocation. It is important to use gcry_free () to release memory allocated by libgcrypt. */ void *gcry_malloc (size_t n) _GCRY_GCC_ATTR_MALLOC; void *gcry_calloc (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC; void *gcry_malloc_secure (size_t n) _GCRY_GCC_ATTR_MALLOC; void *gcry_calloc_secure (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC; void *gcry_realloc (void *a, size_t n); char *gcry_strdup (const char *string) _GCRY_GCC_ATTR_MALLOC; void *gcry_xmalloc (size_t n) _GCRY_GCC_ATTR_MALLOC; void *gcry_xcalloc (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC; void *gcry_xmalloc_secure (size_t n) _GCRY_GCC_ATTR_MALLOC; void *gcry_xcalloc_secure (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC; void *gcry_xrealloc (void *a, size_t n); char *gcry_xstrdup (const char * a) _GCRY_GCC_ATTR_MALLOC; void gcry_free (void *a); /* Return true if A is allocated in "secure" memory. */ int gcry_is_secure (const void *a) _GCRY_GCC_ATTR_PURE; /* Return true if Libgcrypt is in FIPS mode. */ #define gcry_fips_mode_active() !!gcry_control (GCRYCTL_FIPS_MODE_P, 0) /* DRBG input data structure for DRBG generate with additional information * string */ struct gcry_drbg_gen { unsigned char *outbuf; /* output buffer for random numbers */ unsigned int outlen; /* size of output buffer */ struct gcry_drbg_string *addtl; /* input buffer for * additional information string */ }; /* * Concatenation Helper and string operation helper * * SP800-90A requires the concatenation of different data. To avoid copying * buffers around or allocate additional memory, the following data structure * is used to point to the original memory with its size. In addition, it * is used to build a linked list. The linked list defines the concatenation * of individual buffers. The order of memory block referenced in that * linked list determines the order of concatenation. */ /* DRBG string definition */ struct gcry_drbg_string { const unsigned char *buf; size_t len; struct gcry_drbg_string *next; }; #define gcry_drbg_string_fill(s, b, l) \ do { \ (s)->buf = (b); \ (s)->len = (l); \ (s)->next = NULL; \ } while (0) /* this is a wrapper function for users of libgcrypt */ #define gcry_randomize_drbg(ob, ol, lvl, add) \ do { \ struct gcry_drbg_gen genbuf; \ genbuf.outbuf = (unsigned char *)(ob); \ genbuf.outlen = (ol); \ genbuf.addtl = (add); \ gcry_randomize(&genbuf, 0, (lvl)); \ } while (0) /* * DRBG flags bitmasks * * 31 (B) 28 19 (A) 0 * +-+-+-+--------+---+-----------+-----+ * |~|~|u|~~~~~~~~| 3 | 2 | 1 | * +-+-+-+--------+- -+-----------+-----+ * ctl flg| |drbg use selection flags * */ /* internal state control flags (B) */ #define GCRY_DRBG_PREDICTION_RESIST ((u_int32_t)1<<28) /* CTR type modifiers (A.1)*/ #define GCRY_DRBG_CTRAES ((u_int32_t)1<<0) #define GCRY_DRBG_CTRSERPENT ((u_int32_t)1<<1) #define GCRY_DRBG_CTRTWOFISH ((u_int32_t)1<<2) #define GCRY_DRBG_CTR_MASK (GCRY_DRBG_CTRAES | GCRY_DRBG_CTRSERPENT | GCRY_DRBG_CTRTWOFISH) /* HASH type modifiers (A.2)*/ #define GCRY_DRBG_HASHSHA1 ((u_int32_t)1<<4) #define GCRY_DRBG_HASHSHA224 ((u_int32_t)1<<5) #define GCRY_DRBG_HASHSHA256 ((u_int32_t)1<<6) #define GCRY_DRBG_HASHSHA384 ((u_int32_t)1<<7) #define GCRY_DRBG_HASHSHA512 ((u_int32_t)1<<8) #define GCRY_DRBG_HASH_MASK (GCRY_DRBG_HASHSHA1 | GCRY_DRBG_HASHSHA224 | \ GCRY_DRBG_HASHSHA256 | GCRY_DRBG_HASHSHA384 | \ GCRY_DRBG_HASHSHA512) /* type modifiers (A.3)*/ #define GCRY_DRBG_HMAC ((u_int32_t)1<<12) #define GCRY_DRBG_SYM128 ((u_int32_t)1<<13) #define GCRY_DRBG_SYM192 ((u_int32_t)1<<14) #define GCRY_DRBG_SYM256 ((u_int32_t)1<<15) #define GCRY_DRBG_TYPE_MASK (GCRY_DRBG_HMAC | GCRY_DRBG_SYM128 | GCRY_DRBG_SYM192 | \ GCRY_DRBG_SYM256) #define GCRY_DRBG_CIPHER_MASK (GCRY_DRBG_CTR_MASK | GCRY_DRBG_HASH_MASK | GCRY_DRBG_TYPE_MASK) #define GCRY_DRBG_PR_CTRAES128 (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_CTRAES | GCRY_DRBG_SYM128) #define GCRY_DRBG_PR_CTRAES192 (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_CTRAES | GCRY_DRBG_SYM192) #define GCRY_DRBG_PR_CTRAES256 (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_CTRAES | GCRY_DRBG_SYM256) #define GCRY_DRBG_NOPR_CTRAES128 (GCRY_DRBG_CTRAES | GCRY_DRBG_SYM128) #define GCRY_DRBG_NOPR_CTRAES192 (GCRY_DRBG_CTRAES | GCRY_DRBG_SYM192) #define GCRY_DRBG_NOPR_CTRAES256 (GCRY_DRBG_CTRAES | GCRY_DRBG_SYM256) #define GCRY_DRBG_PR_HASHSHA1 (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA1) #define GCRY_DRBG_PR_HASHSHA256 (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA256) #define GCRY_DRBG_PR_HASHSHA384 (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA384) #define GCRY_DRBG_PR_HASHSHA512 (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA512) #define GCRY_DRBG_NOPR_HASHSHA1 (GCRY_DRBG_HASHSHA1) #define GCRY_DRBG_NOPR_HASHSHA256 (GCRY_DRBG_HASHSHA256) #define GCRY_DRBG_NOPR_HASHSHA384 (GCRY_DRBG_HASHSHA384) #define GCRY_DRBG_NOPR_HASHSHA512 (GCRY_DRBG_HASHSHA512) #define GCRY_DRBG_PR_HMACSHA1 (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA1 | GCRY_DRBG_HMAC) #define GCRY_DRBG_PR_HMACSHA256 (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA256 | GCRY_DRBG_HMAC) #define GCRY_DRBG_PR_HMACSHA384 (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA384 | GCRY_DRBG_HMAC) #define GCRY_DRBG_PR_HMACSHA512 (GCRY_DRBG_PREDICTION_RESIST | GCRY_DRBG_HASHSHA512 | GCRY_DRBG_HMAC) #define GCRY_DRBG_NOPR_HMACSHA1 (GCRY_DRBG_HASHSHA1 | GCRY_DRBG_HMAC) #define GCRY_DRBG_NOPR_HMACSHA256 (GCRY_DRBG_HASHSHA256 | GCRY_DRBG_HMAC) #define GCRY_DRBG_NOPR_HMACSHA384 (GCRY_DRBG_HASHSHA384 | GCRY_DRBG_HMAC) #define DRBG_NOPR_HMACSHA512 (GCRY_DRBG_HASHSHA512 | GCRY_DRBG_HMAC) /* Include support for Libgcrypt modules. */ #include <gcrypt-module.h> #if 0 /* (Keep Emacsens' auto-indent happy.) */ { #endif #ifdef __cplusplus } #endif #endif /* _GCRYPT_H */ /* Local Variables: buffer-read-only: t End: */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������idna.h����������������������������������������������������������������������������������������������0000644�����������������00000006754�14763166030�0005652 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* idna.h --- Prototypes for Internationalized Domain Name library. Copyright (C) 2002-2013 Simon Josefsson This file is part of GNU Libidn. GNU Libidn is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * 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. or both in parallel, as here. GNU Libidn 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 copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef IDNA_H # define IDNA_H # ifndef IDNAPI # if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY # define IDNAPI __attribute__((__visibility__("default"))) # elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC # define IDNAPI __declspec(dllexport) # elif defined _MSC_VER && ! defined LIBIDN_STATIC # define IDNAPI __declspec(dllimport) # else # define IDNAPI # endif # endif # include <stddef.h> /* size_t */ # include <idn-int.h> /* uint32_t */ # ifdef __cplusplus extern "C" { # endif /* Error codes. */ typedef enum { IDNA_SUCCESS = 0, IDNA_STRINGPREP_ERROR = 1, IDNA_PUNYCODE_ERROR = 2, IDNA_CONTAINS_NON_LDH = 3, /* Workaround typo in earlier versions. */ IDNA_CONTAINS_LDH = IDNA_CONTAINS_NON_LDH, IDNA_CONTAINS_MINUS = 4, IDNA_INVALID_LENGTH = 5, IDNA_NO_ACE_PREFIX = 6, IDNA_ROUNDTRIP_VERIFY_ERROR = 7, IDNA_CONTAINS_ACE_PREFIX = 8, IDNA_ICONV_ERROR = 9, /* Internal errors. */ IDNA_MALLOC_ERROR = 201, IDNA_DLOPEN_ERROR = 202 } Idna_rc; /* IDNA flags */ typedef enum { IDNA_ALLOW_UNASSIGNED = 0x0001, IDNA_USE_STD3_ASCII_RULES = 0x0002 } Idna_flags; # ifndef IDNA_ACE_PREFIX # define IDNA_ACE_PREFIX "xn--" # endif extern IDNAPI const char *idna_strerror (Idna_rc rc); /* Core functions */ extern IDNAPI int idna_to_ascii_4i (const uint32_t * in, size_t inlen, char *out, int flags); extern IDNAPI int idna_to_unicode_44i (const uint32_t * in, size_t inlen, uint32_t * out, size_t * outlen, int flags); /* Wrappers that handle several labels */ extern IDNAPI int idna_to_ascii_4z (const uint32_t * input, char **output, int flags); extern IDNAPI int idna_to_ascii_8z (const char *input, char **output, int flags); extern IDNAPI int idna_to_ascii_lz (const char *input, char **output, int flags); extern IDNAPI int idna_to_unicode_4z4z (const uint32_t * input, uint32_t ** output, int flags); extern IDNAPI int idna_to_unicode_8z4z (const char *input, uint32_t ** output, int flags); extern IDNAPI int idna_to_unicode_8z8z (const char *input, char **output, int flags); extern IDNAPI int idna_to_unicode_8zlz (const char *input, char **output, int flags); extern IDNAPI int idna_to_unicode_lzlz (const char *input, char **output, int flags); # ifdef __cplusplus } # endif #endif /* IDNA_H */ ��������������������punycode.h������������������������������������������������������������������������������������������0000644�����������������00000022554�14763166030�0006561 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* punycode.h --- Declarations for punycode functions. Copyright (C) 2002-2013 Simon Josefsson This file is part of GNU Libidn. GNU Libidn is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * 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. or both in parallel, as here. GNU Libidn 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 copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* * This file contains content derived from RFC 3492bis written by Adam * M. Costello. * * Disclaimer and license: Regarding this entire document or any * portion of it (including the pseudocode and C code), the author * makes no guarantees and is not responsible for any damage resulting * from its use. The author grants irrevocable permission to anyone * to use, modify, and distribute it in any way that does not diminish * the rights of anyone else to use, modify, and distribute it, * provided that redistributed derivative works do not contain * misleading author or version information. Derivative works need * not be licensed under similar terms. * * Copyright (C) The Internet Society (2003). All Rights Reserved. * * This document and translations of it may be copied and furnished to * others, and derivative works that comment on or otherwise explain it * or assist in its implementation may be prepared, copied, published * and distributed, in whole or in part, without restriction of any * kind, provided that the above copyright notice and this paragraph are * included on all such copies and derivative works. However, this * document itself may not be modified in any way, such as by removing * the copyright notice or references to the Internet Society or other * Internet organizations, except as needed for the purpose of * developing Internet standards in which case the procedures for * copyrights defined in the Internet Standards process must be * followed, or as required to translate it into languages other than * English. * * The limited permissions granted above are perpetual and will not be * revoked by the Internet Society or its successors or assigns. * * This document and the information contained herein is provided on an * "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING * TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. */ #ifndef PUNYCODE_H # define PUNYCODE_H # ifndef IDNAPI # if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY # define IDNAPI __attribute__((__visibility__("default"))) # elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC # define IDNAPI __declspec(dllexport) # elif defined _MSC_VER && ! defined LIBIDN_STATIC # define IDNAPI __declspec(dllimport) # else # define IDNAPI # endif # endif #ifdef __cplusplus extern "C" { #endif #include <stddef.h> /* size_t */ #include <idn-int.h> /* uint32_t */ enum punycode_status { punycode_success = 0, punycode_bad_input = 1, /* Input is invalid. */ punycode_big_output = 2, /* Output would exceed the space provided. */ punycode_overflow = 3 /* Wider integers needed to process input. */ }; typedef enum { PUNYCODE_SUCCESS = punycode_success, PUNYCODE_BAD_INPUT = punycode_bad_input, PUNYCODE_BIG_OUTPUT = punycode_big_output, PUNYCODE_OVERFLOW = punycode_overflow } Punycode_status; extern IDNAPI const char *punycode_strerror (Punycode_status rc); /* punycode_uint needs to be unsigned and needs to be */ /* at least 26 bits wide. */ typedef uint32_t punycode_uint; extern IDNAPI int punycode_encode (size_t input_length, const punycode_uint input[], const unsigned char case_flags[], size_t * output_length, char output[]); /* punycode_encode() converts a sequence of code points (presumed to be Unicode code points) to Punycode. Input arguments (to be supplied by the caller): input_length The number of code points in the input array and the number of flags in the case_flags array. input An array of code points. They are presumed to be Unicode code points, but that is not strictly REQUIRED. The array contains code points, not code units. UTF-16 uses code units D800 through DFFF to refer to code points 10000..10FFFF. The code points D800..DFFF do not occur in any valid Unicode string. The code points that can occur in Unicode strings (0..D7FF and E000..10FFFF) are also called Unicode scalar values. case_flags A null pointer or an array of boolean values parallel to the input array. Nonzero (true, flagged) suggests that the corresponding Unicode character be forced to uppercase after being decoded (if possible), and zero (false, unflagged) suggests that it be forced to lowercase (if possible). ASCII code points (0..7F) are encoded literally, except that ASCII letters are forced to uppercase or lowercase according to the corresponding case flags. If case_flags is a null pointer then ASCII letters are left as they are, and other code points are treated as unflagged. Output arguments (to be filled in by the function): output An array of ASCII code points. It is *not* null-terminated; it will contain zeros if and only if the input contains zeros. (Of course the caller can leave room for a terminator and add one if needed.) Input/output arguments (to be supplied by the caller and overwritten by the function): output_length The caller passes in the maximum number of ASCII code points that it can receive. On successful return it will contain the number of ASCII code points actually output. Return value: Can be any of the punycode_status values defined above except punycode_bad_input. If not punycode_success, then output_size and output might contain garbage. */ extern IDNAPI int punycode_decode (size_t input_length, const char input[], size_t * output_length, punycode_uint output[], unsigned char case_flags[]); /* punycode_decode() converts Punycode to a sequence of code points (presumed to be Unicode code points). Input arguments (to be supplied by the caller): input_length The number of ASCII code points in the input array. input An array of ASCII code points (0..7F). Output arguments (to be filled in by the function): output An array of code points like the input argument of punycode_encode() (see above). case_flags A null pointer (if the flags are not needed by the caller) or an array of boolean values parallel to the output array. Nonzero (true, flagged) suggests that the corresponding Unicode character be forced to uppercase by the caller (if possible), and zero (false, unflagged) suggests that it be forced to lowercase (if possible). ASCII code points (0..7F) are output already in the proper case, but their flags will be set appropriately so that applying the flags would be harmless. Input/output arguments (to be supplied by the caller and overwritten by the function): output_length The caller passes in the maximum number of code points that it can receive into the output array (which is also the maximum number of flags that it can receive into the case_flags array, if case_flags is not a null pointer). On successful return it will contain the number of code points actually output (which is also the number of flags actually output, if case_flags is not a null pointer). The decoder will never need to output more code points than the number of ASCII code points in the input, because of the way the encoding is defined. The number of code points output cannot exceed the maximum possible value of a punycode_uint, even if the supplied output_length is greater than that. Return value: Can be any of the punycode_status values defined above. If not punycode_success, then output_length, output, and case_flags might contain garbage. */ #ifdef __cplusplus } #endif #endif /* PUNYCODE_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/ioctl.h���������������������������������������������������������������������������������0000644�����������������00000006626�14763166030�0010241 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_IOCTL_H #define _ASM_GENERIC_IOCTL_H /* ioctl command encoding: 32 bits total, command in lower 16 bits, * size of the parameter structure in the lower 14 bits of the * upper 16 bits. * Encoding the size of the parameter structure in the ioctl request * is useful for catching programs compiled with old versions * and to avoid overwriting user space outside the user buffer area. * The highest 2 bits are reserved for indicating the ``access mode''. * NOTE: This limits the max parameter size to 16kB -1 ! */ /* * The following is for compatibility across the various Linux * platforms. The generic ioctl numbering scheme doesn't really enforce * a type field. De facto, however, the top 8 bits of the lower 16 * bits are indeed used as a type field, so we might just as well make * this explicit here. Please be sure to use the decoding macros * below from now on. */ #define _IOC_NRBITS 8 #define _IOC_TYPEBITS 8 /* * Let any architecture override either of the following before * including this file. */ #ifndef _IOC_SIZEBITS # define _IOC_SIZEBITS 14 #endif #ifndef _IOC_DIRBITS # define _IOC_DIRBITS 2 #endif #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) #define _IOC_NRSHIFT 0 #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) /* * Direction bits, which any architecture can choose to override * before including this file. * * NOTE: _IOC_WRITE means userland is writing and kernel is * reading. _IOC_READ means userland is reading and kernel is writing. */ #ifndef _IOC_NONE # define _IOC_NONE 0U #endif #ifndef _IOC_WRITE # define _IOC_WRITE 1U #endif #ifndef _IOC_READ # define _IOC_READ 2U #endif #define _IOC(dir,type,nr,size) \ (((dir) << _IOC_DIRSHIFT) | \ ((type) << _IOC_TYPESHIFT) | \ ((nr) << _IOC_NRSHIFT) | \ ((size) << _IOC_SIZESHIFT)) #define _IOC_TYPECHECK(t) (sizeof(t)) /* * Used to create numbers. * * NOTE: _IOW means userland is writing and kernel is reading. _IOR * means userland is reading and kernel is writing. */ #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) #define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) #define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) #define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) /* used to decode ioctl numbers.. */ #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) /* ...and for the drivers/sound files... */ #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) #endif /* _ASM_GENERIC_IOCTL_H */ ����������������������������������������������������������������������������������������������������������asm-generic/ipcbuf.h��������������������������������������������������������������������������������0000644�����������������00000001753�14763166030�0010373 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_IPCBUF_H #define __ASM_GENERIC_IPCBUF_H /* * The generic ipc64_perm structure: * Note extra padding because this structure is passed back and forth * between kernel and user space. * * ipc64_perm was originally meant to be architecture specific, but * everyone just ended up making identical copies without specific * optimizations, so we may just as well all use the same one. * * Pad space is left for: * - 32-bit mode_t on architectures that only had 16 bit * - 32-bit seq * - 2 miscellaneous 32-bit values */ struct ipc64_perm { __kernel_key_t key; __kernel_uid32_t uid; __kernel_gid32_t gid; __kernel_uid32_t cuid; __kernel_gid32_t cgid; __kernel_mode_t mode; /* pad if mode_t is u16: */ unsigned char __pad1[4 - sizeof(__kernel_mode_t)]; unsigned short seq; unsigned short __pad2; __kernel_ulong_t __unused1; __kernel_ulong_t __unused2; }; #endif /* __ASM_GENERIC_IPCBUF_H */ ���������������������asm-generic/types.h���������������������������������������������������������������������������������0000644�����������������00000000351�14763166030�0010260 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_TYPES_H #define _ASM_GENERIC_TYPES_H /* * int-ll64 is used everywhere now. */ #include <asm-generic/int-ll64.h> #endif /* _ASM_GENERIC_TYPES_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/fcntl.h���������������������������������������������������������������������������������0000644�����������������00000012457�14763166030�0010234 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_FCNTL_H #define _ASM_GENERIC_FCNTL_H #include <linux/types.h> /* * FMODE_EXEC is 0x20 * FMODE_NONOTIFY is 0x4000000 * These cannot be used by userspace O_* until internal and external open * flags are split. * -Eric Paris */ /* * When introducing new O_* bits, please check its uniqueness in fcntl_init(). */ #define O_ACCMODE 00000003 #define O_RDONLY 00000000 #define O_WRONLY 00000001 #define O_RDWR 00000002 #ifndef O_CREAT #define O_CREAT 00000100 /* not fcntl */ #endif #ifndef O_EXCL #define O_EXCL 00000200 /* not fcntl */ #endif #ifndef O_NOCTTY #define O_NOCTTY 00000400 /* not fcntl */ #endif #ifndef O_TRUNC #define O_TRUNC 00001000 /* not fcntl */ #endif #ifndef O_APPEND #define O_APPEND 00002000 #endif #ifndef O_NONBLOCK #define O_NONBLOCK 00004000 #endif #ifndef O_DSYNC #define O_DSYNC 00010000 /* used to be O_SYNC, see below */ #endif #ifndef FASYNC #define FASYNC 00020000 /* fcntl, for BSD compatibility */ #endif #ifndef O_DIRECT #define O_DIRECT 00040000 /* direct disk access hint */ #endif #ifndef O_LARGEFILE #define O_LARGEFILE 00100000 #endif #ifndef O_DIRECTORY #define O_DIRECTORY 00200000 /* must be a directory */ #endif #ifndef O_NOFOLLOW #define O_NOFOLLOW 00400000 /* don't follow links */ #endif #ifndef O_NOATIME #define O_NOATIME 01000000 #endif #ifndef O_CLOEXEC #define O_CLOEXEC 02000000 /* set close_on_exec */ #endif /* * Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using * the O_SYNC flag. We continue to use the existing numerical value * for O_DSYNC semantics now, but using the correct symbolic name for it. * This new value is used to request true Posix O_SYNC semantics. It is * defined in this strange way to make sure applications compiled against * new headers get at least O_DSYNC semantics on older kernels. * * This has the nice side-effect that we can simply test for O_DSYNC * wherever we do not care if O_DSYNC or O_SYNC is used. * * Note: __O_SYNC must never be used directly. */ #ifndef O_SYNC #define __O_SYNC 04000000 #define O_SYNC (__O_SYNC|O_DSYNC) #endif #ifndef O_PATH #define O_PATH 010000000 #endif #ifndef __O_TMPFILE #define __O_TMPFILE 020000000 #endif /* a horrid kludge trying to make sure that this will fail on old kernels */ #define O_TMPFILE (__O_TMPFILE | O_DIRECTORY) #define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT) #ifndef O_NDELAY #define O_NDELAY O_NONBLOCK #endif #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ #define F_SETFD 2 /* set/clear close_on_exec */ #define F_GETFL 3 /* get file->f_flags */ #define F_SETFL 4 /* set file->f_flags */ #ifndef F_GETLK #define F_GETLK 5 #define F_SETLK 6 #define F_SETLKW 7 #endif #ifndef F_SETOWN #define F_SETOWN 8 /* for sockets. */ #define F_GETOWN 9 /* for sockets. */ #endif #ifndef F_SETSIG #define F_SETSIG 10 /* for sockets. */ #define F_GETSIG 11 /* for sockets. */ #endif #ifndef CONFIG_64BIT #ifndef F_GETLK64 #define F_GETLK64 12 /* using 'struct flock64' */ #define F_SETLK64 13 #define F_SETLKW64 14 #endif #endif #ifndef F_SETOWN_EX #define F_SETOWN_EX 15 #define F_GETOWN_EX 16 #endif #ifndef F_GETOWNER_UIDS #define F_GETOWNER_UIDS 17 #endif /* * Open File Description Locks * * Usually record locks held by a process are released on *any* close and are * not inherited across a fork(). * * These cmd values will set locks that conflict with process-associated * record locks, but are "owned" by the open file description, not the * process. This means that they are inherited across fork() like BSD (flock) * locks, and they are only released automatically when the last reference to * the the open file against which they were acquired is put. */ #define F_OFD_GETLK 36 #define F_OFD_SETLK 37 #define F_OFD_SETLKW 38 #define F_OWNER_TID 0 #define F_OWNER_PID 1 #define F_OWNER_PGRP 2 struct f_owner_ex { int type; __kernel_pid_t pid; }; /* for F_[GET|SET]FL */ #define FD_CLOEXEC 1 /* actually anything with low bit set goes */ /* for posix fcntl() and lockf() */ #ifndef F_RDLCK #define F_RDLCK 0 #define F_WRLCK 1 #define F_UNLCK 2 #endif /* for old implementation of bsd flock () */ #ifndef F_EXLCK #define F_EXLCK 4 /* or 3 */ #define F_SHLCK 8 /* or 4 */ #endif /* operations for bsd flock(), also used by the kernel implementation */ #define LOCK_SH 1 /* shared lock */ #define LOCK_EX 2 /* exclusive lock */ #define LOCK_NB 4 /* or'd with one of the above to prevent blocking */ #define LOCK_UN 8 /* remove lock */ #define LOCK_MAND 32 /* This is a mandatory flock ... */ #define LOCK_READ 64 /* which allows concurrent read operations */ #define LOCK_WRITE 128 /* which allows concurrent write operations */ #define LOCK_RW 192 /* which allows concurrent read & write ops */ #define F_LINUX_SPECIFIC_BASE 1024 #ifndef HAVE_ARCH_STRUCT_FLOCK #ifndef __ARCH_FLOCK_PAD #define __ARCH_FLOCK_PAD #endif struct flock { short l_type; short l_whence; __kernel_off_t l_start; __kernel_off_t l_len; __kernel_pid_t l_pid; __ARCH_FLOCK_PAD }; #endif #ifndef HAVE_ARCH_STRUCT_FLOCK64 #ifndef __ARCH_FLOCK64_PAD #define __ARCH_FLOCK64_PAD #endif struct flock64 { short l_type; short l_whence; __kernel_loff_t l_start; __kernel_loff_t l_len; __kernel_pid_t l_pid; __ARCH_FLOCK64_PAD }; #endif #endif /* _ASM_GENERIC_FCNTL_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/signal-defs.h���������������������������������������������������������������������������0000644�����������������00000001440�14763166030�0011310 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_SIGNAL_DEFS_H #define __ASM_GENERIC_SIGNAL_DEFS_H #ifndef SIG_BLOCK #define SIG_BLOCK 0 /* for blocking signals */ #endif #ifndef SIG_UNBLOCK #define SIG_UNBLOCK 1 /* for unblocking signals */ #endif #ifndef SIG_SETMASK #define SIG_SETMASK 2 /* for setting the signal mask */ #endif #ifndef __ASSEMBLY__ typedef void __signalfn_t(int); typedef __signalfn_t *__sighandler_t; typedef void __restorefn_t(void); typedef __restorefn_t *__sigrestore_t; #define SIG_DFL ((__sighandler_t)0) /* default signal handling */ #define SIG_IGN ((__sighandler_t)1) /* ignore signal */ #define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ #endif #endif /* __ASM_GENERIC_SIGNAL_DEFS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/signal.h��������������������������������������������������������������������������������0000644�����������������00000005225�14763166030�0010376 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_SIGNAL_H #define __ASM_GENERIC_SIGNAL_H #include <linux/types.h> #define _NSIG 64 #define _NSIG_BPW __BITS_PER_LONG #define _NSIG_WORDS (_NSIG / _NSIG_BPW) #define SIGHUP 1 #define SIGINT 2 #define SIGQUIT 3 #define SIGILL 4 #define SIGTRAP 5 #define SIGABRT 6 #define SIGIOT 6 #define SIGBUS 7 #define SIGFPE 8 #define SIGKILL 9 #define SIGUSR1 10 #define SIGSEGV 11 #define SIGUSR2 12 #define SIGPIPE 13 #define SIGALRM 14 #define SIGTERM 15 #define SIGSTKFLT 16 #define SIGCHLD 17 #define SIGCONT 18 #define SIGSTOP 19 #define SIGTSTP 20 #define SIGTTIN 21 #define SIGTTOU 22 #define SIGURG 23 #define SIGXCPU 24 #define SIGXFSZ 25 #define SIGVTALRM 26 #define SIGPROF 27 #define SIGWINCH 28 #define SIGIO 29 #define SIGPOLL SIGIO /* #define SIGLOST 29 */ #define SIGPWR 30 #define SIGSYS 31 #define SIGUNUSED 31 /* These should not be considered constants from userland. */ #define SIGRTMIN 32 #ifndef SIGRTMAX #define SIGRTMAX _NSIG #endif /* * SA_FLAGS values: * * SA_ONSTACK indicates that a registered stack_t will be used. * SA_RESTART flag to get restarting signals (which were the default long ago) * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. * SA_RESETHAND clears the handler when the signal is delivered. * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. * SA_NODEFER prevents the current signal from being masked in the handler. * * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single * Unix names RESETHAND and NODEFER respectively. */ #define SA_NOCLDSTOP 0x00000001 #define SA_NOCLDWAIT 0x00000002 #define SA_SIGINFO 0x00000004 #define SA_ONSTACK 0x08000000 #define SA_RESTART 0x10000000 #define SA_NODEFER 0x40000000 #define SA_RESETHAND 0x80000000 #define SA_NOMASK SA_NODEFER #define SA_ONESHOT SA_RESETHAND /* * New architectures should not define the obsolete * SA_RESTORER 0x04000000 */ #if !defined MINSIGSTKSZ || !defined SIGSTKSZ #define MINSIGSTKSZ 2048 #define SIGSTKSZ 8192 #endif #ifndef __ASSEMBLY__ typedef struct { unsigned long sig[_NSIG_WORDS]; } sigset_t; /* not actually used, but required for linux/syscalls.h */ typedef unsigned long old_sigset_t; #include <asm-generic/signal-defs.h> #ifdef SA_RESTORER #define __ARCH_HAS_SA_RESTORER #endif struct sigaction { __sighandler_t sa_handler; unsigned long sa_flags; #ifdef SA_RESTORER __sigrestore_t sa_restorer; #endif sigset_t sa_mask; /* mask last for extensibility */ }; typedef struct sigaltstack { void *ss_sp; int ss_flags; size_t ss_size; } stack_t; #endif /* __ASSEMBLY__ */ #endif /* __ASM_GENERIC_SIGNAL_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/siginfo.h�������������������������������������������������������������������������������0000644�����������������00000023415�14763166030�0010560 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_SIGINFO_H #define _ASM_GENERIC_SIGINFO_H #include <linux/types.h> typedef union sigval { int sival_int; void *sival_ptr; } sigval_t; /* * This is the size (including padding) of the part of the * struct siginfo that is before the union. */ #ifndef __ARCH_SI_PREAMBLE_SIZE #define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int)) #endif #define SI_MAX_SIZE 128 #ifndef SI_PAD_SIZE #define SI_PAD_SIZE ((SI_MAX_SIZE - __ARCH_SI_PREAMBLE_SIZE) / sizeof(int)) #endif /* * The default "si_band" type is "long", as specified by POSIX. * However, some architectures want to override this to "int" * for historical compatibility reasons, so we allow that. */ #ifndef __ARCH_SI_BAND_T #define __ARCH_SI_BAND_T long #endif #ifndef __ARCH_SI_CLOCK_T #define __ARCH_SI_CLOCK_T __kernel_clock_t #endif #ifndef __ARCH_SI_ATTRIBUTES #define __ARCH_SI_ATTRIBUTES #endif typedef struct siginfo { int si_signo; #ifndef __ARCH_HAS_SWAPPED_SIGINFO int si_errno; int si_code; #else int si_code; int si_errno; #endif union { int _pad[SI_PAD_SIZE]; /* kill() */ struct { __kernel_pid_t _pid; /* sender's pid */ __kernel_uid32_t _uid; /* sender's uid */ } _kill; /* POSIX.1b timers */ struct { __kernel_timer_t _tid; /* timer id */ int _overrun; /* overrun count */ sigval_t _sigval; /* same as below */ int _sys_private; /* not to be passed to user */ } _timer; /* POSIX.1b signals */ struct { __kernel_pid_t _pid; /* sender's pid */ __kernel_uid32_t _uid; /* sender's uid */ sigval_t _sigval; } _rt; /* SIGCHLD */ struct { __kernel_pid_t _pid; /* which child */ __kernel_uid32_t _uid; /* sender's uid */ int _status; /* exit code */ __ARCH_SI_CLOCK_T _utime; __ARCH_SI_CLOCK_T _stime; } _sigchld; /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGTRAP, SIGEMT */ struct { void *_addr; /* faulting insn/memory ref. */ #ifdef __ARCH_SI_TRAPNO int _trapno; /* TRAP # which caused the signal */ #endif #ifdef __ia64__ int _imm; /* immediate value for "break" */ unsigned int _flags; /* see ia64 si_flags */ unsigned long _isr; /* isr */ #endif #define __ADDR_BND_PKEY_PAD (__alignof__(void *) < sizeof(short) ? \ sizeof(short) : __alignof__(void *)) union { /* * used when si_code=BUS_MCEERR_AR or * used when si_code=BUS_MCEERR_AO */ short _addr_lsb; /* LSB of the reported address */ /* used when si_code=SEGV_BNDERR */ struct { char _dummy_bnd[__ADDR_BND_PKEY_PAD]; void *_lower; void *_upper; } _addr_bnd; /* used when si_code=SEGV_PKUERR */ struct { char _dummy_pkey[__ADDR_BND_PKEY_PAD]; __u32 _pkey; } _addr_pkey; }; } _sigfault; /* SIGPOLL */ struct { __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */ int _fd; } _sigpoll; /* SIGSYS */ struct { void *_call_addr; /* calling user insn */ int _syscall; /* triggering system call number */ unsigned int _arch; /* AUDIT_ARCH_* of syscall */ } _sigsys; } _sifields; } __ARCH_SI_ATTRIBUTES siginfo_t; /* * How these fields are to be accessed. */ #define si_pid _sifields._kill._pid #define si_uid _sifields._kill._uid #define si_tid _sifields._timer._tid #define si_overrun _sifields._timer._overrun #define si_sys_private _sifields._timer._sys_private #define si_status _sifields._sigchld._status #define si_utime _sifields._sigchld._utime #define si_stime _sifields._sigchld._stime #define si_value _sifields._rt._sigval #define si_int _sifields._rt._sigval.sival_int #define si_ptr _sifields._rt._sigval.sival_ptr #define si_addr _sifields._sigfault._addr #ifdef __ARCH_SI_TRAPNO #define si_trapno _sifields._sigfault._trapno #endif #define si_addr_lsb _sifields._sigfault._addr_lsb #define si_lower _sifields._sigfault._addr_bnd._lower #define si_upper _sifields._sigfault._addr_bnd._upper #define si_pkey _sifields._sigfault._addr_pkey._pkey #define si_band _sifields._sigpoll._band #define si_fd _sifields._sigpoll._fd #define si_call_addr _sifields._sigsys._call_addr #define si_syscall _sifields._sigsys._syscall #define si_arch _sifields._sigsys._arch /* * si_code values * Digital reserves positive values for kernel-generated signals. */ #define SI_USER 0 /* sent by kill, sigsend, raise */ #define SI_KERNEL 0x80 /* sent by the kernel from somewhere */ #define SI_QUEUE -1 /* sent by sigqueue */ #define SI_TIMER -2 /* sent by timer expiration */ #define SI_MESGQ -3 /* sent by real time mesq state change */ #define SI_ASYNCIO -4 /* sent by AIO completion */ #define SI_SIGIO -5 /* sent by queued SIGIO */ #define SI_TKILL -6 /* sent by tkill system call */ #define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */ #define SI_ASYNCNL -60 /* sent by glibc async name lookup completion */ #define SI_FROMUSER(siptr) ((siptr)->si_code <= 0) #define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0) /* * SIGILL si_codes */ #define ILL_ILLOPC 1 /* illegal opcode */ #define ILL_ILLOPN 2 /* illegal operand */ #define ILL_ILLADR 3 /* illegal addressing mode */ #define ILL_ILLTRP 4 /* illegal trap */ #define ILL_PRVOPC 5 /* privileged opcode */ #define ILL_PRVREG 6 /* privileged register */ #define ILL_COPROC 7 /* coprocessor error */ #define ILL_BADSTK 8 /* internal stack error */ #define ILL_BADIADDR 9 /* unimplemented instruction address */ #define __ILL_BREAK 10 /* illegal break */ #define __ILL_BNDMOD 11 /* bundle-update (modification) in progress */ #define NSIGILL 11 /* * SIGFPE si_codes */ #define FPE_INTDIV 1 /* integer divide by zero */ #define FPE_INTOVF 2 /* integer overflow */ #define FPE_FLTDIV 3 /* floating point divide by zero */ #define FPE_FLTOVF 4 /* floating point overflow */ #define FPE_FLTUND 5 /* floating point underflow */ #define FPE_FLTRES 6 /* floating point inexact result */ #define FPE_FLTINV 7 /* floating point invalid operation */ #define FPE_FLTSUB 8 /* subscript out of range */ #define __FPE_DECOVF 9 /* decimal overflow */ #define __FPE_DECDIV 10 /* decimal division by zero */ #define __FPE_DECERR 11 /* packed decimal error */ #define __FPE_INVASC 12 /* invalid ASCII digit */ #define __FPE_INVDEC 13 /* invalid decimal digit */ #define FPE_FLTUNK 14 /* undiagnosed floating-point exception */ #define FPE_CONDTRAP 15 /* trap on condition */ #define NSIGFPE 15 /* * SIGSEGV si_codes */ #define SEGV_MAPERR 1 /* address not mapped to object */ #define SEGV_ACCERR 2 /* invalid permissions for mapped object */ #define SEGV_BNDERR 3 /* failed address bound checks */ #ifdef __ia64__ # define __SEGV_PSTKOVF 4 /* paragraph stack overflow */ #else # define SEGV_PKUERR 4 /* failed protection key checks */ #endif #define SEGV_ACCADI 5 /* ADI not enabled for mapped object */ #define SEGV_ADIDERR 6 /* Disrupting MCD error */ #define SEGV_ADIPERR 7 /* Precise MCD exception */ #define NSIGSEGV 7 /* * SIGBUS si_codes */ #define BUS_ADRALN 1 /* invalid address alignment */ #define BUS_ADRERR 2 /* non-existent physical address */ #define BUS_OBJERR 3 /* object specific hardware error */ /* hardware memory error consumed on a machine check: action required */ #define BUS_MCEERR_AR 4 /* hardware memory error detected in process but not consumed: action optional*/ #define BUS_MCEERR_AO 5 #define NSIGBUS 5 /* * SIGTRAP si_codes */ #define TRAP_BRKPT 1 /* process breakpoint */ #define TRAP_TRACE 2 /* process trace trap */ #define TRAP_BRANCH 3 /* process taken branch trap */ #define TRAP_HWBKPT 4 /* hardware breakpoint/watchpoint */ #define TRAP_UNK 5 /* undiagnosed trap */ #define NSIGTRAP 5 /* * There is an additional set of SIGTRAP si_codes used by ptrace * that are of the form: ((PTRACE_EVENT_XXX << 8) | SIGTRAP) */ /* * SIGCHLD si_codes */ #define CLD_EXITED 1 /* child has exited */ #define CLD_KILLED 2 /* child was killed */ #define CLD_DUMPED 3 /* child terminated abnormally */ #define CLD_TRAPPED 4 /* traced child has trapped */ #define CLD_STOPPED 5 /* child has stopped */ #define CLD_CONTINUED 6 /* stopped child has continued */ #define NSIGCHLD 6 /* * SIGPOLL (or any other signal without signal specific si_codes) si_codes */ #define POLL_IN 1 /* data input available */ #define POLL_OUT 2 /* output buffers available */ #define POLL_MSG 3 /* input message available */ #define POLL_ERR 4 /* i/o error */ #define POLL_PRI 5 /* high priority input available */ #define POLL_HUP 6 /* device disconnected */ #define NSIGPOLL 6 /* * SIGSYS si_codes */ #define SYS_SECCOMP 1 /* seccomp triggered */ #define NSIGSYS 1 /* * sigevent definitions * * It seems likely that SIGEV_THREAD will have to be handled from * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the * thread manager then catches and does the appropriate nonsense. * However, everything is written out here so as to not get lost. */ #define SIGEV_SIGNAL 0 /* notify via signal */ #define SIGEV_NONE 1 /* other notification: meaningless */ #define SIGEV_THREAD 2 /* deliver via thread creation */ #define SIGEV_THREAD_ID 4 /* deliver to thread */ /* * This works because the alignment is ok on all current architectures * but we leave open this being overridden in the future */ #ifndef __ARCH_SIGEV_PREAMBLE_SIZE #define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_t)) #endif #define SIGEV_MAX_SIZE 64 #define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \ / sizeof(int)) typedef struct sigevent { sigval_t sigev_value; int sigev_signo; int sigev_notify; union { int _pad[SIGEV_PAD_SIZE]; int _tid; struct { void (*_function)(sigval_t); void *_attribute; /* really pthread_attr_t */ } _sigev_thread; } _sigev_un; } sigevent_t; #define sigev_notify_function _sigev_un._sigev_thread._function #define sigev_notify_attributes _sigev_un._sigev_thread._attribute #define sigev_notify_thread_id _sigev_un._tid #endif /* _ASM_GENERIC_SIGINFO_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/hugetlb_encode.h������������������������������������������������������������������������0000644�����������������00000003314�14763166030�0012065 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef _ASM_GENERIC_HUGETLB_ENCODE_H_ #define _ASM_GENERIC_HUGETLB_ENCODE_H_ /* * Several system calls take a flag to request "hugetlb" huge pages. * Without further specification, these system calls will use the * system's default huge page size. If a system supports multiple * huge page sizes, the desired huge page size can be specified in * bits [26:31] of the flag arguments. The value in these 6 bits * will encode the log2 of the huge page size. * * The following definitions are associated with this huge page size * encoding in flag arguments. System call specific header files * that use this encoding should include this file. They can then * provide definitions based on these with their own specific prefix. * for example: * #define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT */ #define HUGETLB_FLAG_ENCODE_SHIFT 26 #define HUGETLB_FLAG_ENCODE_MASK 0x3f #define HUGETLB_FLAG_ENCODE_64KB (16 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_512KB (19 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_1MB (20 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_2MB (21 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_8MB (23 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_16MB (24 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_32MB (25 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_256MB (28 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_512MB (29 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_1GB (30 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_2GB (31 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_16GB (34 << HUGETLB_FLAG_ENCODE_SHIFT) #endif /* _ASM_GENERIC_HUGETLB_ENCODE_H_ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/shmbuf.h��������������������������������������������������������������������������������0000644�����������������00000003455�14763166030�0010410 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_SHMBUF_H #define __ASM_GENERIC_SHMBUF_H #include <asm/bitsperlong.h> /* * The shmid64_ds structure for x86 architecture. * Note extra padding because this structure is passed back and forth * between kernel and user space. * * shmid64_ds was originally meant to be architecture specific, but * everyone just ended up making identical copies without specific * optimizations, so we may just as well all use the same one. * * 64 bit architectures typically define a 64 bit __kernel_time_t, * so they do not need the first two padding words. * On big-endian systems, the padding is in the wrong place. * * * Pad space is left for: * - 2 miscellaneous 32-bit values */ struct shmid64_ds { struct ipc64_perm shm_perm; /* operation perms */ size_t shm_segsz; /* size of segment (bytes) */ #if __BITS_PER_LONG == 64 __kernel_time_t shm_atime; /* last attach time */ __kernel_time_t shm_dtime; /* last detach time */ __kernel_time_t shm_ctime; /* last change time */ #else unsigned long shm_atime; /* last attach time */ unsigned long shm_atime_high; unsigned long shm_dtime; /* last detach time */ unsigned long shm_dtime_high; unsigned long shm_ctime; /* last change time */ unsigned long shm_ctime_high; #endif __kernel_pid_t shm_cpid; /* pid of creator */ __kernel_pid_t shm_lpid; /* pid of last operator */ unsigned long shm_nattch; /* no. of current attaches */ unsigned long __unused4; unsigned long __unused5; }; struct shminfo64 { unsigned long shmmax; unsigned long shmmin; unsigned long shmmni; unsigned long shmseg; unsigned long shmall; unsigned long __unused1; unsigned long __unused2; unsigned long __unused3; unsigned long __unused4; }; #endif /* __ASM_GENERIC_SHMBUF_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/bitsperlong.h���������������������������������������������������������������������������0000644�����������������00000001064�14763166030�0011446 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_BITS_PER_LONG #define __ASM_GENERIC_BITS_PER_LONG /* * There seems to be no way of detecting this automatically from user * space, so 64 bit architectures should override this in their * bitsperlong.h. In particular, an architecture that supports * both 32 and 64 bit user space must not rely on CONFIG_64BIT * to decide it, but rather check a compiler provided macro. */ #ifndef __BITS_PER_LONG #define __BITS_PER_LONG 32 #endif #endif /* __ASM_GENERIC_BITS_PER_LONG */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/sembuf.h��������������������������������������������������������������������������������0000644�����������������00000003016�14763166030�0010376 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_SEMBUF_H #define __ASM_GENERIC_SEMBUF_H #include <asm/bitsperlong.h> /* * The semid64_ds structure for x86 architecture. * Note extra padding because this structure is passed back and forth * between kernel and user space. * * semid64_ds was originally meant to be architecture specific, but * everyone just ended up making identical copies without specific * optimizations, so we may just as well all use the same one. * * 64 bit architectures use a 64-bit __kernel_time_t here, while * 32 bit architectures have a pair of unsigned long values. * so they do not need the first two padding words. * * On big-endian systems, the padding is in the wrong place for * historic reasons, so user space has to reconstruct a time_t * value using * * user_semid_ds.sem_otime = kernel_semid64_ds.sem_otime + * ((long long)kernel_semid64_ds.sem_otime_high << 32) * * Pad space is left for 2 miscellaneous 32-bit values */ struct semid64_ds { struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ #if __BITS_PER_LONG == 64 __kernel_time_t sem_otime; /* last semop time */ __kernel_time_t sem_ctime; /* last change time */ #else unsigned long sem_otime; /* last semop time */ unsigned long sem_otime_high; unsigned long sem_ctime; /* last change time */ unsigned long sem_ctime_high; #endif unsigned long sem_nsems; /* no. of semaphores in array */ unsigned long __unused3; unsigned long __unused4; }; #endif /* __ASM_GENERIC_SEMBUF_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/mman-common.h���������������������������������������������������������������������������0000644�����������������00000006150�14763166030�0011335 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_MMAN_COMMON_H #define __ASM_GENERIC_MMAN_COMMON_H /* Author: Michael S. Tsirkin <mst@mellanox.co.il>, Mellanox Technologies Ltd. Based on: asm-xxx/mman.h */ #define PROT_READ 0x1 /* page can be read */ #define PROT_WRITE 0x2 /* page can be written */ #define PROT_EXEC 0x4 /* page can be executed */ #define PROT_SEM 0x8 /* page may be used for atomic ops */ #define PROT_NONE 0x0 /* page can not be accessed */ #define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ #define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ #define MAP_SHARED 0x01 /* Share changes */ #define MAP_PRIVATE 0x02 /* Changes are private */ #define MAP_SHARED_VALIDATE 0x03 /* share + validate extension flags */ #define MAP_TYPE 0x0f /* Mask for type of mapping */ #define MAP_FIXED 0x10 /* Interpret addr exactly */ #define MAP_ANONYMOUS 0x20 /* don't use a file */ #ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED # define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be uninitialized */ #else # define MAP_UNINITIALIZED 0x0 /* Don't support this flag */ #endif /* 0x0100 - 0x80000 flags are defined in asm-generic/mman.h */ #define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED which doesn't unmap underlying mapping */ /* * Flags for mlock */ #define MLOCK_ONFAULT 0x01 /* Lock pages in range after they are faulted in, do not prefault */ #define MS_ASYNC 1 /* sync memory asynchronously */ #define MS_INVALIDATE 2 /* invalidate the caches */ #define MS_SYNC 4 /* synchronous memory sync */ #define MADV_NORMAL 0 /* no further special treatment */ #define MADV_RANDOM 1 /* expect random page references */ #define MADV_SEQUENTIAL 2 /* expect sequential page references */ #define MADV_WILLNEED 3 /* will need these pages */ #define MADV_DONTNEED 4 /* don't need these pages */ /* common parameters: try to keep these consistent across architectures */ #define MADV_FREE 8 /* free pages only if memory pressure */ #define MADV_REMOVE 9 /* remove these pages & resources */ #define MADV_DONTFORK 10 /* don't inherit across fork */ #define MADV_DOFORK 11 /* do inherit across fork */ #define MADV_HWPOISON 100 /* poison a page for testing */ #define MADV_SOFT_OFFLINE 101 /* soft offline page for testing */ #define MADV_MERGEABLE 12 /* KSM may merge identical pages */ #define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */ #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ #define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, overrides the coredump filter bits */ #define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag */ #define MADV_WIPEONFORK 18 /* Zero memory on fork, child only */ #define MADV_KEEPONFORK 19 /* Undo MADV_WIPEONFORK */ /* compatibility flags */ #define MAP_FILE 0 #define PKEY_DISABLE_ACCESS 0x1 #define PKEY_DISABLE_WRITE 0x2 #define PKEY_ACCESS_MASK (PKEY_DISABLE_ACCESS |\ PKEY_DISABLE_WRITE) #endif /* __ASM_GENERIC_MMAN_COMMON_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/termbits.h������������������������������������������������������������������������������0000644�����������������00000011154�14763166030�0010750 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_TERMBITS_H #define __ASM_GENERIC_TERMBITS_H #include <linux/posix_types.h> typedef unsigned char cc_t; typedef unsigned int speed_t; typedef unsigned int tcflag_t; #define NCCS 19 struct termios { tcflag_t c_iflag; /* input mode flags */ tcflag_t c_oflag; /* output mode flags */ tcflag_t c_cflag; /* control mode flags */ tcflag_t c_lflag; /* local mode flags */ cc_t c_line; /* line discipline */ cc_t c_cc[NCCS]; /* control characters */ }; struct termios2 { tcflag_t c_iflag; /* input mode flags */ tcflag_t c_oflag; /* output mode flags */ tcflag_t c_cflag; /* control mode flags */ tcflag_t c_lflag; /* local mode flags */ cc_t c_line; /* line discipline */ cc_t c_cc[NCCS]; /* control characters */ speed_t c_ispeed; /* input speed */ speed_t c_ospeed; /* output speed */ }; struct ktermios { tcflag_t c_iflag; /* input mode flags */ tcflag_t c_oflag; /* output mode flags */ tcflag_t c_cflag; /* control mode flags */ tcflag_t c_lflag; /* local mode flags */ cc_t c_line; /* line discipline */ cc_t c_cc[NCCS]; /* control characters */ speed_t c_ispeed; /* input speed */ speed_t c_ospeed; /* output speed */ }; /* c_cc characters */ #define VINTR 0 #define VQUIT 1 #define VERASE 2 #define VKILL 3 #define VEOF 4 #define VTIME 5 #define VMIN 6 #define VSWTC 7 #define VSTART 8 #define VSTOP 9 #define VSUSP 10 #define VEOL 11 #define VREPRINT 12 #define VDISCARD 13 #define VWERASE 14 #define VLNEXT 15 #define VEOL2 16 /* c_iflag bits */ #define IGNBRK 0000001 #define BRKINT 0000002 #define IGNPAR 0000004 #define PARMRK 0000010 #define INPCK 0000020 #define ISTRIP 0000040 #define INLCR 0000100 #define IGNCR 0000200 #define ICRNL 0000400 #define IUCLC 0001000 #define IXON 0002000 #define IXANY 0004000 #define IXOFF 0010000 #define IMAXBEL 0020000 #define IUTF8 0040000 /* c_oflag bits */ #define OPOST 0000001 #define OLCUC 0000002 #define ONLCR 0000004 #define OCRNL 0000010 #define ONOCR 0000020 #define ONLRET 0000040 #define OFILL 0000100 #define OFDEL 0000200 #define NLDLY 0000400 #define NL0 0000000 #define NL1 0000400 #define CRDLY 0003000 #define CR0 0000000 #define CR1 0001000 #define CR2 0002000 #define CR3 0003000 #define TABDLY 0014000 #define TAB0 0000000 #define TAB1 0004000 #define TAB2 0010000 #define TAB3 0014000 #define XTABS 0014000 #define BSDLY 0020000 #define BS0 0000000 #define BS1 0020000 #define VTDLY 0040000 #define VT0 0000000 #define VT1 0040000 #define FFDLY 0100000 #define FF0 0000000 #define FF1 0100000 /* c_cflag bit meaning */ #define CBAUD 0010017 #define B0 0000000 /* hang up */ #define B50 0000001 #define B75 0000002 #define B110 0000003 #define B134 0000004 #define B150 0000005 #define B200 0000006 #define B300 0000007 #define B600 0000010 #define B1200 0000011 #define B1800 0000012 #define B2400 0000013 #define B4800 0000014 #define B9600 0000015 #define B19200 0000016 #define B38400 0000017 #define EXTA B19200 #define EXTB B38400 #define CSIZE 0000060 #define CS5 0000000 #define CS6 0000020 #define CS7 0000040 #define CS8 0000060 #define CSTOPB 0000100 #define CREAD 0000200 #define PARENB 0000400 #define PARODD 0001000 #define HUPCL 0002000 #define CLOCAL 0004000 #define CBAUDEX 0010000 #define BOTHER 0010000 #define B57600 0010001 #define B115200 0010002 #define B230400 0010003 #define B460800 0010004 #define B500000 0010005 #define B576000 0010006 #define B921600 0010007 #define B1000000 0010010 #define B1152000 0010011 #define B1500000 0010012 #define B2000000 0010013 #define B2500000 0010014 #define B3000000 0010015 #define B3500000 0010016 #define B4000000 0010017 #define CIBAUD 002003600000 /* input baud rate */ #define CMSPAR 010000000000 /* mark or space (stick) parity */ #define CRTSCTS 020000000000 /* flow control */ #define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */ /* c_lflag bits */ #define ISIG 0000001 #define ICANON 0000002 #define XCASE 0000004 #define ECHO 0000010 #define ECHOE 0000020 #define ECHOK 0000040 #define ECHONL 0000100 #define NOFLSH 0000200 #define TOSTOP 0000400 #define ECHOCTL 0001000 #define ECHOPRT 0002000 #define ECHOKE 0004000 #define FLUSHO 0010000 #define PENDIN 0040000 #define IEXTEN 0100000 #define EXTPROC 0200000 /* tcflow() and TCXONC use these */ #define TCOOFF 0 #define TCOON 1 #define TCIOFF 2 #define TCION 3 /* tcflush() and TCFLSH use these */ #define TCIFLUSH 0 #define TCOFLUSH 1 #define TCIOFLUSH 2 /* tcsetattr uses these */ #define TCSANOW 0 #define TCSADRAIN 1 #define TCSAFLUSH 2 #endif /* __ASM_GENERIC_TERMBITS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/swab.h����������������������������������������������������������������������������������0000644�����������������00000000766�14763166030�0010062 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_SWAB_H #define _ASM_GENERIC_SWAB_H #include <asm/bitsperlong.h> /* * 32 bit architectures typically (but not always) want to * set __SWAB_64_THRU_32__. In user space, this is only * valid if the compiler supports 64 bit data types. */ #if __BITS_PER_LONG == 32 #if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) #define __SWAB_64_THRU_32__ #endif #endif #endif /* _ASM_GENERIC_SWAB_H */ ����������asm-generic/setup.h���������������������������������������������������������������������������������0000644�����������������00000000276�14763166030�0010262 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_SETUP_H #define __ASM_GENERIC_SETUP_H #define COMMAND_LINE_SIZE 512 #endif /* __ASM_GENERIC_SETUP_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/ioctls.h��������������������������������������������������������������������������������0000644�����������������00000007432�14763166030�0010420 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_IOCTLS_H #define __ASM_GENERIC_IOCTLS_H #include <linux/ioctl.h> /* * These are the most common definitions for tty ioctl numbers. * Most of them do not use the recommended _IOC(), but there is * probably some source code out there hardcoding the number, * so we might as well use them for all new platforms. * * The architectures that use different values here typically * try to be compatible with some Unix variants for the same * architecture. */ /* 0x54 is just a magic number to make these relatively unique ('T') */ #define TCGETS 0x5401 #define TCSETS 0x5402 #define TCSETSW 0x5403 #define TCSETSF 0x5404 #define TCGETA 0x5405 #define TCSETA 0x5406 #define TCSETAW 0x5407 #define TCSETAF 0x5408 #define TCSBRK 0x5409 #define TCXONC 0x540A #define TCFLSH 0x540B #define TIOCEXCL 0x540C #define TIOCNXCL 0x540D #define TIOCSCTTY 0x540E #define TIOCGPGRP 0x540F #define TIOCSPGRP 0x5410 #define TIOCOUTQ 0x5411 #define TIOCSTI 0x5412 #define TIOCGWINSZ 0x5413 #define TIOCSWINSZ 0x5414 #define TIOCMGET 0x5415 #define TIOCMBIS 0x5416 #define TIOCMBIC 0x5417 #define TIOCMSET 0x5418 #define TIOCGSOFTCAR 0x5419 #define TIOCSSOFTCAR 0x541A #define FIONREAD 0x541B #define TIOCINQ FIONREAD #define TIOCLINUX 0x541C #define TIOCCONS 0x541D #define TIOCGSERIAL 0x541E #define TIOCSSERIAL 0x541F #define TIOCPKT 0x5420 #define FIONBIO 0x5421 #define TIOCNOTTY 0x5422 #define TIOCSETD 0x5423 #define TIOCGETD 0x5424 #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ #define TIOCGSID 0x5429 /* Return the session ID of FD */ #define TCGETS2 _IOR('T', 0x2A, struct termios2) #define TCSETS2 _IOW('T', 0x2B, struct termios2) #define TCSETSW2 _IOW('T', 0x2C, struct termios2) #define TCSETSF2 _IOW('T', 0x2D, struct termios2) #define TIOCGRS485 0x542E #ifndef TIOCSRS485 #define TIOCSRS485 0x542F #endif #define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ #define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */ #define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */ #define TCGETX 0x5432 /* SYS5 TCGETX compatibility */ #define TCSETX 0x5433 #define TCSETXF 0x5434 #define TCSETXW 0x5435 #define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */ #define TIOCVHANGUP 0x5437 #define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */ #define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */ #define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */ #define TIOCGPTPEER _IO('T', 0x41) /* Safely open the slave */ #define FIONCLEX 0x5450 #define FIOCLEX 0x5451 #define FIOASYNC 0x5452 #define TIOCSERCONFIG 0x5453 #define TIOCSERGWILD 0x5454 #define TIOCSERSWILD 0x5455 #define TIOCGLCKTRMIOS 0x5456 #define TIOCSLCKTRMIOS 0x5457 #define TIOCSERGSTRUCT 0x5458 /* For debugging only */ #define TIOCSERGETLSR 0x5459 /* Get line status register */ #define TIOCSERGETMULTI 0x545A /* Get multiport config */ #define TIOCSERSETMULTI 0x545B /* Set multiport config */ #define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ #define TIOCGICOUNT 0x545D /* read serial port __inline__ interrupt counts */ /* * Some arches already define FIOQSIZE due to a historical * conflict with a Hayes modem-specific ioctl value. */ #ifndef FIOQSIZE # define FIOQSIZE 0x5460 #endif /* Used for packet mode */ #define TIOCPKT_DATA 0 #define TIOCPKT_FLUSHREAD 1 #define TIOCPKT_FLUSHWRITE 2 #define TIOCPKT_STOP 4 #define TIOCPKT_START 8 #define TIOCPKT_NOSTOP 16 #define TIOCPKT_DOSTOP 32 #define TIOCPKT_IOCTL 64 #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ #endif /* __ASM_GENERIC_IOCTLS_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/int-ll64.h������������������������������������������������������������������������������0000644�����������������00000001540�14763166030�0010466 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * asm-generic/int-ll64.h * * Integer declarations for architectures which use "long long" * for 64-bit types. */ #ifndef _ASM_GENERIC_INT_LL64_H #define _ASM_GENERIC_INT_LL64_H #include <asm/bitsperlong.h> #ifndef __ASSEMBLY__ /* * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the * header files exported to user space */ typedef __signed__ char __s8; typedef unsigned char __u8; typedef __signed__ short __s16; typedef unsigned short __u16; typedef __signed__ int __s32; typedef unsigned int __u32; #ifdef __GNUC__ __extension__ typedef __signed__ long long __s64; __extension__ typedef unsigned long long __u64; #else typedef __signed__ long long __s64; typedef unsigned long long __u64; #endif #endif /* __ASSEMBLY__ */ #endif /* _ASM_GENERIC_INT_LL64_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/mman.h����������������������������������������������������������������������������������0000644�����������������00000002070�14763166030�0010044 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_MMAN_H #define __ASM_GENERIC_MMAN_H #include <asm-generic/mman-common.h> #define MAP_GROWSDOWN 0x0100 /* stack-like segment */ #define MAP_DENYWRITE 0x0800 /* ETXTBSY */ #define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ #define MAP_LOCKED 0x2000 /* pages are locked */ #define MAP_NORESERVE 0x4000 /* don't check for reservations */ #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ #define MAP_NONBLOCK 0x10000 /* do not block on IO */ #define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ #define MAP_HUGETLB 0x40000 /* create a huge page mapping */ #define MAP_SYNC 0x80000 /* perform synchronous page faults for the mapping */ /* Bits [26:31] are reserved, see mman-common.h for MAP_HUGETLB usage */ #define MCL_CURRENT 1 /* lock all current mappings */ #define MCL_FUTURE 2 /* lock all future mappings */ #define MCL_ONFAULT 4 /* lock all pages that are faulted in */ #endif /* __ASM_GENERIC_MMAN_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/poll.h����������������������������������������������������������������������������������0000644�����������������00000001517�14763166030�0010067 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_POLL_H #define __ASM_GENERIC_POLL_H /* These are specified by iBCS2 */ #define POLLIN 0x0001 #define POLLPRI 0x0002 #define POLLOUT 0x0004 #define POLLERR 0x0008 #define POLLHUP 0x0010 #define POLLNVAL 0x0020 /* The rest seem to be more-or-less nonstandard. Check them! */ #define POLLRDNORM 0x0040 #define POLLRDBAND 0x0080 #ifndef POLLWRNORM #define POLLWRNORM 0x0100 #endif #ifndef POLLWRBAND #define POLLWRBAND 0x0200 #endif #ifndef POLLMSG #define POLLMSG 0x0400 #endif #ifndef POLLREMOVE #define POLLREMOVE 0x1000 #endif #ifndef POLLRDHUP #define POLLRDHUP 0x2000 #endif #define POLLFREE (__poll_t)0x4000 #define POLL_BUSY_LOOP (__poll_t)0x8000 struct pollfd { int fd; short events; short revents; }; #endif /* __ASM_GENERIC_POLL_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/msgbuf.h��������������������������������������������������������������������������������0000644�����������������00000003122�14763166030�0010376 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_MSGBUF_H #define __ASM_GENERIC_MSGBUF_H #include <asm/bitsperlong.h> /* * generic msqid64_ds structure. * * Note extra padding because this structure is passed back and forth * between kernel and user space. * * msqid64_ds was originally meant to be architecture specific, but * everyone just ended up making identical copies without specific * optimizations, so we may just as well all use the same one. * * 64 bit architectures typically define a 64 bit __kernel_time_t, * so they do not need the first three padding words. * On big-endian systems, the padding is in the wrong place. * * Pad space is left for: * - 2 miscellaneous 32-bit values */ struct msqid64_ds { struct ipc64_perm msg_perm; #if __BITS_PER_LONG == 64 __kernel_time_t msg_stime; /* last msgsnd time */ __kernel_time_t msg_rtime; /* last msgrcv time */ __kernel_time_t msg_ctime; /* last change time */ #else unsigned long msg_stime; /* last msgsnd time */ unsigned long msg_stime_high; unsigned long msg_rtime; /* last msgrcv time */ unsigned long msg_rtime_high; unsigned long msg_ctime; /* last change time */ unsigned long msg_ctime_high; #endif unsigned long msg_cbytes; /* current number of bytes on queue */ unsigned long msg_qnum; /* number of messages in queue */ unsigned long msg_qbytes; /* max number of bytes on queue */ __kernel_pid_t msg_lspid; /* pid of last msgsnd */ __kernel_pid_t msg_lrpid; /* last receive pid */ unsigned long __unused4; unsigned long __unused5; }; #endif /* __ASM_GENERIC_MSGBUF_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/shmparam.h������������������������������������������������������������������������������0000644�����������������00000000347�14763166030�0010731 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_SHMPARAM_H #define __ASM_GENERIC_SHMPARAM_H #define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ #endif /* _ASM_GENERIC_SHMPARAM_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/posix_types.h���������������������������������������������������������������������������0000644�����������������00000004433�14763166030�0011507 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_POSIX_TYPES_H #define __ASM_GENERIC_POSIX_TYPES_H #include <asm/bitsperlong.h> /* * This file is generally used by user-level software, so you need to * be a little careful about namespace pollution etc. * * First the types that are often defined in different ways across * architectures, so that you can override them. */ #ifndef __kernel_long_t typedef long __kernel_long_t; typedef unsigned long __kernel_ulong_t; #endif #ifndef __kernel_ino_t typedef __kernel_ulong_t __kernel_ino_t; #endif #ifndef __kernel_mode_t typedef unsigned int __kernel_mode_t; #endif #ifndef __kernel_pid_t typedef int __kernel_pid_t; #endif #ifndef __kernel_ipc_pid_t typedef int __kernel_ipc_pid_t; #endif #ifndef __kernel_uid_t typedef unsigned int __kernel_uid_t; typedef unsigned int __kernel_gid_t; #endif #ifndef __kernel_suseconds_t typedef __kernel_long_t __kernel_suseconds_t; #endif #ifndef __kernel_daddr_t typedef int __kernel_daddr_t; #endif #ifndef __kernel_uid32_t typedef unsigned int __kernel_uid32_t; typedef unsigned int __kernel_gid32_t; #endif #ifndef __kernel_old_uid_t typedef __kernel_uid_t __kernel_old_uid_t; typedef __kernel_gid_t __kernel_old_gid_t; #endif #ifndef __kernel_old_dev_t typedef unsigned int __kernel_old_dev_t; #endif /* * Most 32 bit architectures use "unsigned int" size_t, * and all 64 bit architectures use "unsigned long" size_t. */ #ifndef __kernel_size_t #if __BITS_PER_LONG != 64 typedef unsigned int __kernel_size_t; typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; #else typedef __kernel_ulong_t __kernel_size_t; typedef __kernel_long_t __kernel_ssize_t; typedef __kernel_long_t __kernel_ptrdiff_t; #endif #endif #ifndef __kernel_fsid_t typedef struct { int val[2]; } __kernel_fsid_t; #endif /* * anything below here should be completely generic */ typedef __kernel_long_t __kernel_off_t; typedef long long __kernel_loff_t; typedef __kernel_long_t __kernel_time_t; typedef long long __kernel_time64_t; typedef __kernel_long_t __kernel_clock_t; typedef int __kernel_timer_t; typedef int __kernel_clockid_t; typedef char * __kernel_caddr_t; typedef unsigned short __kernel_uid16_t; typedef unsigned short __kernel_gid16_t; #endif /* __ASM_GENERIC_POSIX_TYPES_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/stat.h����������������������������������������������������������������������������������0000644�����������������00000005111�14763166030�0010066 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_STAT_H #define __ASM_GENERIC_STAT_H /* * Everybody gets this wrong and has to stick with it for all * eternity. Hopefully, this version gets used by new architectures * so they don't fall into the same traps. * * stat64 is copied from powerpc64, with explicit padding added. * stat is the same structure layout on 64-bit, without the 'long long' * types. * * By convention, 64 bit architectures use the stat interface, while * 32 bit architectures use the stat64 interface. Note that we don't * provide an __old_kernel_stat here, which new architecture should * not have to start with. */ #include <asm/bitsperlong.h> #define STAT_HAVE_NSEC 1 struct stat { unsigned long st_dev; /* Device. */ unsigned long st_ino; /* File serial number. */ unsigned int st_mode; /* File mode. */ unsigned int st_nlink; /* Link count. */ unsigned int st_uid; /* User ID of the file's owner. */ unsigned int st_gid; /* Group ID of the file's group. */ unsigned long st_rdev; /* Device number, if device. */ unsigned long __pad1; long st_size; /* Size of file, in bytes. */ int st_blksize; /* Optimal block size for I/O. */ int __pad2; long st_blocks; /* Number 512-byte blocks allocated. */ long st_atime; /* Time of last access. */ unsigned long st_atime_nsec; long st_mtime; /* Time of last modification. */ unsigned long st_mtime_nsec; long st_ctime; /* Time of last status change. */ unsigned long st_ctime_nsec; unsigned int __unused4; unsigned int __unused5; }; /* This matches struct stat64 in glibc2.1. Only used for 32 bit. */ #if __BITS_PER_LONG != 64 || defined(__ARCH_WANT_STAT64) struct stat64 { unsigned long long st_dev; /* Device. */ unsigned long long st_ino; /* File serial number. */ unsigned int st_mode; /* File mode. */ unsigned int st_nlink; /* Link count. */ unsigned int st_uid; /* User ID of the file's owner. */ unsigned int st_gid; /* Group ID of the file's group. */ unsigned long long st_rdev; /* Device number, if device. */ unsigned long long __pad1; long long st_size; /* Size of file, in bytes. */ int st_blksize; /* Optimal block size for I/O. */ int __pad2; long long st_blocks; /* Number 512-byte blocks allocated. */ int st_atime; /* Time of last access. */ unsigned int st_atime_nsec; int st_mtime; /* Time of last modification. */ unsigned int st_mtime_nsec; int st_ctime; /* Time of last status change. */ unsigned int st_ctime_nsec; unsigned int __unused4; unsigned int __unused5; }; #endif #endif /* __ASM_GENERIC_STAT_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/int-l64.h�������������������������������������������������������������������������������0000644�����������������00000001316�14763166030�0010313 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * asm-generic/int-l64.h * * Integer declarations for architectures which use "long" * for 64-bit types. */ #ifndef _ASM_GENERIC_INT_L64_H #define _ASM_GENERIC_INT_L64_H #include <asm/bitsperlong.h> #ifndef __ASSEMBLY__ /* * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the * header files exported to user space */ typedef __signed__ char __s8; typedef unsigned char __u8; typedef __signed__ short __s16; typedef unsigned short __u16; typedef __signed__ int __s32; typedef unsigned int __u32; typedef __signed__ long __s64; typedef unsigned long __u64; #endif /* __ASSEMBLY__ */ #endif /* _ASM_GENERIC_INT_L64_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/auxvec.h��������������������������������������������������������������������������������0000644�����������������00000000332�14763166030�0010406 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef __ASM_GENERIC_AUXVEC_H #define __ASM_GENERIC_AUXVEC_H /* * Not all architectures need their own auxvec.h, the most * common definitions are already in linux/auxvec.h. */ #endif /* __ASM_GENERIC_AUXVEC_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/termios.h�������������������������������������������������������������������������������0000644�����������������00000002541�14763166030�0010601 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_TERMIOS_H #define _ASM_GENERIC_TERMIOS_H /* * Most architectures have straight copies of the x86 code, with * varying levels of bug fixes on top. Usually it's a good idea * to use this generic version instead, but be careful to avoid * ABI changes. * New architectures should not provide their own version. */ #include <asm/termbits.h> #include <asm/ioctls.h> struct winsize { unsigned short ws_row; unsigned short ws_col; unsigned short ws_xpixel; unsigned short ws_ypixel; }; #define NCC 8 struct termio { unsigned short c_iflag; /* input mode flags */ unsigned short c_oflag; /* output mode flags */ unsigned short c_cflag; /* control mode flags */ unsigned short c_lflag; /* local mode flags */ unsigned char c_line; /* line discipline */ unsigned char c_cc[NCC]; /* control characters */ }; /* modem lines */ #define TIOCM_LE 0x001 #define TIOCM_DTR 0x002 #define TIOCM_RTS 0x004 #define TIOCM_ST 0x008 #define TIOCM_SR 0x010 #define TIOCM_CTS 0x020 #define TIOCM_CAR 0x040 #define TIOCM_RNG 0x080 #define TIOCM_DSR 0x100 #define TIOCM_CD TIOCM_CAR #define TIOCM_RI TIOCM_RNG #define TIOCM_OUT1 0x2000 #define TIOCM_OUT2 0x4000 #define TIOCM_LOOP 0x8000 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ #endif /* _ASM_GENERIC_TERMIOS_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/unistd.h��������������������������������������������������������������������������������0000644�����������������00000062126�14763166030�0010432 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #include <asm/bitsperlong.h> /* * This file contains the system call numbers, based on the * layout of the x86-64 architecture, which embeds the * pointer to the syscall in the table. * * As a basic principle, no duplication of functionality * should be added, e.g. we don't use lseek when llseek * is present. New architectures should use this file * and implement the less feature-full calls in user space. */ #ifndef __SYSCALL #define __SYSCALL(x, y) #endif #if __BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT) #define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32) #else #define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64) #endif #ifdef __SYSCALL_COMPAT #define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _comp) #define __SC_COMP_3264(_nr, _32, _64, _comp) __SYSCALL(_nr, _comp) #else #define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _sys) #define __SC_COMP_3264(_nr, _32, _64, _comp) __SC_3264(_nr, _32, _64) #endif #define __NR_io_setup 0 __SC_COMP(__NR_io_setup, sys_io_setup, compat_sys_io_setup) #define __NR_io_destroy 1 __SYSCALL(__NR_io_destroy, sys_io_destroy) #define __NR_io_submit 2 __SC_COMP(__NR_io_submit, sys_io_submit, compat_sys_io_submit) #define __NR_io_cancel 3 __SYSCALL(__NR_io_cancel, sys_io_cancel) #define __NR_io_getevents 4 __SC_COMP(__NR_io_getevents, sys_io_getevents, compat_sys_io_getevents) /* fs/xattr.c */ #define __NR_setxattr 5 __SYSCALL(__NR_setxattr, sys_setxattr) #define __NR_lsetxattr 6 __SYSCALL(__NR_lsetxattr, sys_lsetxattr) #define __NR_fsetxattr 7 __SYSCALL(__NR_fsetxattr, sys_fsetxattr) #define __NR_getxattr 8 __SYSCALL(__NR_getxattr, sys_getxattr) #define __NR_lgetxattr 9 __SYSCALL(__NR_lgetxattr, sys_lgetxattr) #define __NR_fgetxattr 10 __SYSCALL(__NR_fgetxattr, sys_fgetxattr) #define __NR_listxattr 11 __SYSCALL(__NR_listxattr, sys_listxattr) #define __NR_llistxattr 12 __SYSCALL(__NR_llistxattr, sys_llistxattr) #define __NR_flistxattr 13 __SYSCALL(__NR_flistxattr, sys_flistxattr) #define __NR_removexattr 14 __SYSCALL(__NR_removexattr, sys_removexattr) #define __NR_lremovexattr 15 __SYSCALL(__NR_lremovexattr, sys_lremovexattr) #define __NR_fremovexattr 16 __SYSCALL(__NR_fremovexattr, sys_fremovexattr) /* fs/dcache.c */ #define __NR_getcwd 17 __SYSCALL(__NR_getcwd, sys_getcwd) /* fs/cookies.c */ #define __NR_lookup_dcookie 18 __SC_COMP(__NR_lookup_dcookie, sys_lookup_dcookie, compat_sys_lookup_dcookie) /* fs/eventfd.c */ #define __NR_eventfd2 19 __SYSCALL(__NR_eventfd2, sys_eventfd2) /* fs/eventpoll.c */ #define __NR_epoll_create1 20 __SYSCALL(__NR_epoll_create1, sys_epoll_create1) #define __NR_epoll_ctl 21 __SYSCALL(__NR_epoll_ctl, sys_epoll_ctl) #define __NR_epoll_pwait 22 __SC_COMP(__NR_epoll_pwait, sys_epoll_pwait, compat_sys_epoll_pwait) /* fs/fcntl.c */ #define __NR_dup 23 __SYSCALL(__NR_dup, sys_dup) #define __NR_dup3 24 __SYSCALL(__NR_dup3, sys_dup3) #define __NR3264_fcntl 25 __SC_COMP_3264(__NR3264_fcntl, sys_fcntl64, sys_fcntl, compat_sys_fcntl64) /* fs/inotify_user.c */ #define __NR_inotify_init1 26 __SYSCALL(__NR_inotify_init1, sys_inotify_init1) #define __NR_inotify_add_watch 27 __SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch) #define __NR_inotify_rm_watch 28 __SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch) /* fs/ioctl.c */ #define __NR_ioctl 29 __SC_COMP(__NR_ioctl, sys_ioctl, compat_sys_ioctl) /* fs/ioprio.c */ #define __NR_ioprio_set 30 __SYSCALL(__NR_ioprio_set, sys_ioprio_set) #define __NR_ioprio_get 31 __SYSCALL(__NR_ioprio_get, sys_ioprio_get) /* fs/locks.c */ #define __NR_flock 32 __SYSCALL(__NR_flock, sys_flock) /* fs/namei.c */ #define __NR_mknodat 33 __SYSCALL(__NR_mknodat, sys_mknodat) #define __NR_mkdirat 34 __SYSCALL(__NR_mkdirat, sys_mkdirat) #define __NR_unlinkat 35 __SYSCALL(__NR_unlinkat, sys_unlinkat) #define __NR_symlinkat 36 __SYSCALL(__NR_symlinkat, sys_symlinkat) #define __NR_linkat 37 __SYSCALL(__NR_linkat, sys_linkat) #ifdef __ARCH_WANT_RENAMEAT /* renameat is superseded with flags by renameat2 */ #define __NR_renameat 38 __SYSCALL(__NR_renameat, sys_renameat) #endif /* __ARCH_WANT_RENAMEAT */ /* fs/namespace.c */ #define __NR_umount2 39 __SYSCALL(__NR_umount2, sys_umount) #define __NR_mount 40 __SC_COMP(__NR_mount, sys_mount, compat_sys_mount) #define __NR_pivot_root 41 __SYSCALL(__NR_pivot_root, sys_pivot_root) /* fs/nfsctl.c */ #define __NR_nfsservctl 42 __SYSCALL(__NR_nfsservctl, sys_ni_syscall) /* fs/open.c */ #define __NR3264_statfs 43 __SC_COMP_3264(__NR3264_statfs, sys_statfs64, sys_statfs, \ compat_sys_statfs64) #define __NR3264_fstatfs 44 __SC_COMP_3264(__NR3264_fstatfs, sys_fstatfs64, sys_fstatfs, \ compat_sys_fstatfs64) #define __NR3264_truncate 45 __SC_COMP_3264(__NR3264_truncate, sys_truncate64, sys_truncate, \ compat_sys_truncate64) #define __NR3264_ftruncate 46 __SC_COMP_3264(__NR3264_ftruncate, sys_ftruncate64, sys_ftruncate, \ compat_sys_ftruncate64) #define __NR_fallocate 47 __SC_COMP(__NR_fallocate, sys_fallocate, compat_sys_fallocate) #define __NR_faccessat 48 __SYSCALL(__NR_faccessat, sys_faccessat) #define __NR_chdir 49 __SYSCALL(__NR_chdir, sys_chdir) #define __NR_fchdir 50 __SYSCALL(__NR_fchdir, sys_fchdir) #define __NR_chroot 51 __SYSCALL(__NR_chroot, sys_chroot) #define __NR_fchmod 52 __SYSCALL(__NR_fchmod, sys_fchmod) #define __NR_fchmodat 53 __SYSCALL(__NR_fchmodat, sys_fchmodat) #define __NR_fchownat 54 __SYSCALL(__NR_fchownat, sys_fchownat) #define __NR_fchown 55 __SYSCALL(__NR_fchown, sys_fchown) #define __NR_openat 56 __SC_COMP(__NR_openat, sys_openat, compat_sys_openat) #define __NR_close 57 __SYSCALL(__NR_close, sys_close) #define __NR_vhangup 58 __SYSCALL(__NR_vhangup, sys_vhangup) /* fs/pipe.c */ #define __NR_pipe2 59 __SYSCALL(__NR_pipe2, sys_pipe2) /* fs/quota.c */ #define __NR_quotactl 60 __SYSCALL(__NR_quotactl, sys_quotactl) /* fs/readdir.c */ #define __NR_getdents64 61 __SYSCALL(__NR_getdents64, sys_getdents64) /* fs/read_write.c */ #define __NR3264_lseek 62 __SC_3264(__NR3264_lseek, sys_llseek, sys_lseek) #define __NR_read 63 __SYSCALL(__NR_read, sys_read) #define __NR_write 64 __SYSCALL(__NR_write, sys_write) #define __NR_readv 65 __SC_COMP(__NR_readv, sys_readv, compat_sys_readv) #define __NR_writev 66 __SC_COMP(__NR_writev, sys_writev, compat_sys_writev) #define __NR_pread64 67 __SC_COMP(__NR_pread64, sys_pread64, compat_sys_pread64) #define __NR_pwrite64 68 __SC_COMP(__NR_pwrite64, sys_pwrite64, compat_sys_pwrite64) #define __NR_preadv 69 __SC_COMP(__NR_preadv, sys_preadv, compat_sys_preadv) #define __NR_pwritev 70 __SC_COMP(__NR_pwritev, sys_pwritev, compat_sys_pwritev) /* fs/sendfile.c */ #define __NR3264_sendfile 71 __SYSCALL(__NR3264_sendfile, sys_sendfile64) /* fs/select.c */ #define __NR_pselect6 72 __SC_COMP(__NR_pselect6, sys_pselect6, compat_sys_pselect6) #define __NR_ppoll 73 __SC_COMP(__NR_ppoll, sys_ppoll, compat_sys_ppoll) /* fs/signalfd.c */ #define __NR_signalfd4 74 __SC_COMP(__NR_signalfd4, sys_signalfd4, compat_sys_signalfd4) /* fs/splice.c */ #define __NR_vmsplice 75 __SC_COMP(__NR_vmsplice, sys_vmsplice, compat_sys_vmsplice) #define __NR_splice 76 __SYSCALL(__NR_splice, sys_splice) #define __NR_tee 77 __SYSCALL(__NR_tee, sys_tee) /* fs/stat.c */ #define __NR_readlinkat 78 __SYSCALL(__NR_readlinkat, sys_readlinkat) #define __NR3264_fstatat 79 __SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat) #define __NR3264_fstat 80 __SC_3264(__NR3264_fstat, sys_fstat64, sys_newfstat) /* fs/sync.c */ #define __NR_sync 81 __SYSCALL(__NR_sync, sys_sync) #define __NR_fsync 82 __SYSCALL(__NR_fsync, sys_fsync) #define __NR_fdatasync 83 __SYSCALL(__NR_fdatasync, sys_fdatasync) #ifdef __ARCH_WANT_SYNC_FILE_RANGE2 #define __NR_sync_file_range2 84 __SC_COMP(__NR_sync_file_range2, sys_sync_file_range2, \ compat_sys_sync_file_range2) #else #define __NR_sync_file_range 84 __SC_COMP(__NR_sync_file_range, sys_sync_file_range, \ compat_sys_sync_file_range) #endif /* fs/timerfd.c */ #define __NR_timerfd_create 85 __SYSCALL(__NR_timerfd_create, sys_timerfd_create) #define __NR_timerfd_settime 86 __SC_COMP(__NR_timerfd_settime, sys_timerfd_settime, \ compat_sys_timerfd_settime) #define __NR_timerfd_gettime 87 __SC_COMP(__NR_timerfd_gettime, sys_timerfd_gettime, \ compat_sys_timerfd_gettime) /* fs/utimes.c */ #define __NR_utimensat 88 __SC_COMP(__NR_utimensat, sys_utimensat, compat_sys_utimensat) /* kernel/acct.c */ #define __NR_acct 89 __SYSCALL(__NR_acct, sys_acct) /* kernel/capability.c */ #define __NR_capget 90 __SYSCALL(__NR_capget, sys_capget) #define __NR_capset 91 __SYSCALL(__NR_capset, sys_capset) /* kernel/exec_domain.c */ #define __NR_personality 92 __SYSCALL(__NR_personality, sys_personality) /* kernel/exit.c */ #define __NR_exit 93 __SYSCALL(__NR_exit, sys_exit) #define __NR_exit_group 94 __SYSCALL(__NR_exit_group, sys_exit_group) #define __NR_waitid 95 __SC_COMP(__NR_waitid, sys_waitid, compat_sys_waitid) /* kernel/fork.c */ #define __NR_set_tid_address 96 __SYSCALL(__NR_set_tid_address, sys_set_tid_address) #define __NR_unshare 97 __SYSCALL(__NR_unshare, sys_unshare) /* kernel/futex.c */ #define __NR_futex 98 __SC_COMP(__NR_futex, sys_futex, compat_sys_futex) #define __NR_set_robust_list 99 __SC_COMP(__NR_set_robust_list, sys_set_robust_list, \ compat_sys_set_robust_list) #define __NR_get_robust_list 100 __SC_COMP(__NR_get_robust_list, sys_get_robust_list, \ compat_sys_get_robust_list) /* kernel/hrtimer.c */ #define __NR_nanosleep 101 __SC_COMP(__NR_nanosleep, sys_nanosleep, compat_sys_nanosleep) /* kernel/itimer.c */ #define __NR_getitimer 102 __SC_COMP(__NR_getitimer, sys_getitimer, compat_sys_getitimer) #define __NR_setitimer 103 __SC_COMP(__NR_setitimer, sys_setitimer, compat_sys_setitimer) /* kernel/kexec.c */ #define __NR_kexec_load 104 __SC_COMP(__NR_kexec_load, sys_kexec_load, compat_sys_kexec_load) /* kernel/module.c */ #define __NR_init_module 105 __SYSCALL(__NR_init_module, sys_init_module) #define __NR_delete_module 106 __SYSCALL(__NR_delete_module, sys_delete_module) /* kernel/posix-timers.c */ #define __NR_timer_create 107 __SC_COMP(__NR_timer_create, sys_timer_create, compat_sys_timer_create) #define __NR_timer_gettime 108 __SC_COMP(__NR_timer_gettime, sys_timer_gettime, compat_sys_timer_gettime) #define __NR_timer_getoverrun 109 __SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun) #define __NR_timer_settime 110 __SC_COMP(__NR_timer_settime, sys_timer_settime, compat_sys_timer_settime) #define __NR_timer_delete 111 __SYSCALL(__NR_timer_delete, sys_timer_delete) #define __NR_clock_settime 112 __SC_COMP(__NR_clock_settime, sys_clock_settime, compat_sys_clock_settime) #define __NR_clock_gettime 113 __SC_COMP(__NR_clock_gettime, sys_clock_gettime, compat_sys_clock_gettime) #define __NR_clock_getres 114 __SC_COMP(__NR_clock_getres, sys_clock_getres, compat_sys_clock_getres) #define __NR_clock_nanosleep 115 __SC_COMP(__NR_clock_nanosleep, sys_clock_nanosleep, \ compat_sys_clock_nanosleep) /* kernel/printk.c */ #define __NR_syslog 116 __SYSCALL(__NR_syslog, sys_syslog) /* kernel/ptrace.c */ #define __NR_ptrace 117 __SYSCALL(__NR_ptrace, sys_ptrace) /* kernel/sched/core.c */ #define __NR_sched_setparam 118 __SYSCALL(__NR_sched_setparam, sys_sched_setparam) #define __NR_sched_setscheduler 119 __SYSCALL(__NR_sched_setscheduler, sys_sched_setscheduler) #define __NR_sched_getscheduler 120 __SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler) #define __NR_sched_getparam 121 __SYSCALL(__NR_sched_getparam, sys_sched_getparam) #define __NR_sched_setaffinity 122 __SC_COMP(__NR_sched_setaffinity, sys_sched_setaffinity, \ compat_sys_sched_setaffinity) #define __NR_sched_getaffinity 123 __SC_COMP(__NR_sched_getaffinity, sys_sched_getaffinity, \ compat_sys_sched_getaffinity) #define __NR_sched_yield 124 __SYSCALL(__NR_sched_yield, sys_sched_yield) #define __NR_sched_get_priority_max 125 __SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max) #define __NR_sched_get_priority_min 126 __SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min) #define __NR_sched_rr_get_interval 127 __SC_COMP(__NR_sched_rr_get_interval, sys_sched_rr_get_interval, \ compat_sys_sched_rr_get_interval) /* kernel/signal.c */ #define __NR_restart_syscall 128 __SYSCALL(__NR_restart_syscall, sys_restart_syscall) #define __NR_kill 129 __SYSCALL(__NR_kill, sys_kill) #define __NR_tkill 130 __SYSCALL(__NR_tkill, sys_tkill) #define __NR_tgkill 131 __SYSCALL(__NR_tgkill, sys_tgkill) #define __NR_sigaltstack 132 __SC_COMP(__NR_sigaltstack, sys_sigaltstack, compat_sys_sigaltstack) #define __NR_rt_sigsuspend 133 __SC_COMP(__NR_rt_sigsuspend, sys_rt_sigsuspend, compat_sys_rt_sigsuspend) #define __NR_rt_sigaction 134 __SC_COMP(__NR_rt_sigaction, sys_rt_sigaction, compat_sys_rt_sigaction) #define __NR_rt_sigprocmask 135 __SC_COMP(__NR_rt_sigprocmask, sys_rt_sigprocmask, compat_sys_rt_sigprocmask) #define __NR_rt_sigpending 136 __SC_COMP(__NR_rt_sigpending, sys_rt_sigpending, compat_sys_rt_sigpending) #define __NR_rt_sigtimedwait 137 __SC_COMP(__NR_rt_sigtimedwait, sys_rt_sigtimedwait, \ compat_sys_rt_sigtimedwait) #define __NR_rt_sigqueueinfo 138 __SC_COMP(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo, \ compat_sys_rt_sigqueueinfo) #define __NR_rt_sigreturn 139 __SC_COMP(__NR_rt_sigreturn, sys_rt_sigreturn, compat_sys_rt_sigreturn) /* kernel/sys.c */ #define __NR_setpriority 140 __SYSCALL(__NR_setpriority, sys_setpriority) #define __NR_getpriority 141 __SYSCALL(__NR_getpriority, sys_getpriority) #define __NR_reboot 142 __SYSCALL(__NR_reboot, sys_reboot) #define __NR_setregid 143 __SYSCALL(__NR_setregid, sys_setregid) #define __NR_setgid 144 __SYSCALL(__NR_setgid, sys_setgid) #define __NR_setreuid 145 __SYSCALL(__NR_setreuid, sys_setreuid) #define __NR_setuid 146 __SYSCALL(__NR_setuid, sys_setuid) #define __NR_setresuid 147 __SYSCALL(__NR_setresuid, sys_setresuid) #define __NR_getresuid 148 __SYSCALL(__NR_getresuid, sys_getresuid) #define __NR_setresgid 149 __SYSCALL(__NR_setresgid, sys_setresgid) #define __NR_getresgid 150 __SYSCALL(__NR_getresgid, sys_getresgid) #define __NR_setfsuid 151 __SYSCALL(__NR_setfsuid, sys_setfsuid) #define __NR_setfsgid 152 __SYSCALL(__NR_setfsgid, sys_setfsgid) #define __NR_times 153 __SC_COMP(__NR_times, sys_times, compat_sys_times) #define __NR_setpgid 154 __SYSCALL(__NR_setpgid, sys_setpgid) #define __NR_getpgid 155 __SYSCALL(__NR_getpgid, sys_getpgid) #define __NR_getsid 156 __SYSCALL(__NR_getsid, sys_getsid) #define __NR_setsid 157 __SYSCALL(__NR_setsid, sys_setsid) #define __NR_getgroups 158 __SYSCALL(__NR_getgroups, sys_getgroups) #define __NR_setgroups 159 __SYSCALL(__NR_setgroups, sys_setgroups) #define __NR_uname 160 __SYSCALL(__NR_uname, sys_newuname) #define __NR_sethostname 161 __SYSCALL(__NR_sethostname, sys_sethostname) #define __NR_setdomainname 162 __SYSCALL(__NR_setdomainname, sys_setdomainname) #define __NR_getrlimit 163 __SC_COMP(__NR_getrlimit, sys_getrlimit, compat_sys_getrlimit) #define __NR_setrlimit 164 __SC_COMP(__NR_setrlimit, sys_setrlimit, compat_sys_setrlimit) #define __NR_getrusage 165 __SC_COMP(__NR_getrusage, sys_getrusage, compat_sys_getrusage) #define __NR_umask 166 __SYSCALL(__NR_umask, sys_umask) #define __NR_prctl 167 __SYSCALL(__NR_prctl, sys_prctl) #define __NR_getcpu 168 __SYSCALL(__NR_getcpu, sys_getcpu) /* kernel/time.c */ #define __NR_gettimeofday 169 __SC_COMP(__NR_gettimeofday, sys_gettimeofday, compat_sys_gettimeofday) #define __NR_settimeofday 170 __SC_COMP(__NR_settimeofday, sys_settimeofday, compat_sys_settimeofday) #define __NR_adjtimex 171 __SC_COMP(__NR_adjtimex, sys_adjtimex, compat_sys_adjtimex) /* kernel/timer.c */ #define __NR_getpid 172 __SYSCALL(__NR_getpid, sys_getpid) #define __NR_getppid 173 __SYSCALL(__NR_getppid, sys_getppid) #define __NR_getuid 174 __SYSCALL(__NR_getuid, sys_getuid) #define __NR_geteuid 175 __SYSCALL(__NR_geteuid, sys_geteuid) #define __NR_getgid 176 __SYSCALL(__NR_getgid, sys_getgid) #define __NR_getegid 177 __SYSCALL(__NR_getegid, sys_getegid) #define __NR_gettid 178 __SYSCALL(__NR_gettid, sys_gettid) #define __NR_sysinfo 179 __SC_COMP(__NR_sysinfo, sys_sysinfo, compat_sys_sysinfo) /* ipc/mqueue.c */ #define __NR_mq_open 180 __SC_COMP(__NR_mq_open, sys_mq_open, compat_sys_mq_open) #define __NR_mq_unlink 181 __SYSCALL(__NR_mq_unlink, sys_mq_unlink) #define __NR_mq_timedsend 182 __SC_COMP(__NR_mq_timedsend, sys_mq_timedsend, compat_sys_mq_timedsend) #define __NR_mq_timedreceive 183 __SC_COMP(__NR_mq_timedreceive, sys_mq_timedreceive, \ compat_sys_mq_timedreceive) #define __NR_mq_notify 184 __SC_COMP(__NR_mq_notify, sys_mq_notify, compat_sys_mq_notify) #define __NR_mq_getsetattr 185 __SC_COMP(__NR_mq_getsetattr, sys_mq_getsetattr, compat_sys_mq_getsetattr) /* ipc/msg.c */ #define __NR_msgget 186 __SYSCALL(__NR_msgget, sys_msgget) #define __NR_msgctl 187 __SC_COMP(__NR_msgctl, sys_msgctl, compat_sys_msgctl) #define __NR_msgrcv 188 __SC_COMP(__NR_msgrcv, sys_msgrcv, compat_sys_msgrcv) #define __NR_msgsnd 189 __SC_COMP(__NR_msgsnd, sys_msgsnd, compat_sys_msgsnd) /* ipc/sem.c */ #define __NR_semget 190 __SYSCALL(__NR_semget, sys_semget) #define __NR_semctl 191 __SC_COMP(__NR_semctl, sys_semctl, compat_sys_semctl) #define __NR_semtimedop 192 __SC_COMP(__NR_semtimedop, sys_semtimedop, compat_sys_semtimedop) #define __NR_semop 193 __SYSCALL(__NR_semop, sys_semop) /* ipc/shm.c */ #define __NR_shmget 194 __SYSCALL(__NR_shmget, sys_shmget) #define __NR_shmctl 195 __SC_COMP(__NR_shmctl, sys_shmctl, compat_sys_shmctl) #define __NR_shmat 196 __SC_COMP(__NR_shmat, sys_shmat, compat_sys_shmat) #define __NR_shmdt 197 __SYSCALL(__NR_shmdt, sys_shmdt) /* net/socket.c */ #define __NR_socket 198 __SYSCALL(__NR_socket, sys_socket) #define __NR_socketpair 199 __SYSCALL(__NR_socketpair, sys_socketpair) #define __NR_bind 200 __SYSCALL(__NR_bind, sys_bind) #define __NR_listen 201 __SYSCALL(__NR_listen, sys_listen) #define __NR_accept 202 __SYSCALL(__NR_accept, sys_accept) #define __NR_connect 203 __SYSCALL(__NR_connect, sys_connect) #define __NR_getsockname 204 __SYSCALL(__NR_getsockname, sys_getsockname) #define __NR_getpeername 205 __SYSCALL(__NR_getpeername, sys_getpeername) #define __NR_sendto 206 __SYSCALL(__NR_sendto, sys_sendto) #define __NR_recvfrom 207 __SC_COMP(__NR_recvfrom, sys_recvfrom, compat_sys_recvfrom) #define __NR_setsockopt 208 __SC_COMP(__NR_setsockopt, sys_setsockopt, compat_sys_setsockopt) #define __NR_getsockopt 209 __SC_COMP(__NR_getsockopt, sys_getsockopt, compat_sys_getsockopt) #define __NR_shutdown 210 __SYSCALL(__NR_shutdown, sys_shutdown) #define __NR_sendmsg 211 __SC_COMP(__NR_sendmsg, sys_sendmsg, compat_sys_sendmsg) #define __NR_recvmsg 212 __SC_COMP(__NR_recvmsg, sys_recvmsg, compat_sys_recvmsg) /* mm/filemap.c */ #define __NR_readahead 213 __SC_COMP(__NR_readahead, sys_readahead, compat_sys_readahead) /* mm/nommu.c, also with MMU */ #define __NR_brk 214 __SYSCALL(__NR_brk, sys_brk) #define __NR_munmap 215 __SYSCALL(__NR_munmap, sys_munmap) #define __NR_mremap 216 __SYSCALL(__NR_mremap, sys_mremap) /* security/keys/keyctl.c */ #define __NR_add_key 217 __SYSCALL(__NR_add_key, sys_add_key) #define __NR_request_key 218 __SYSCALL(__NR_request_key, sys_request_key) #define __NR_keyctl 219 __SC_COMP(__NR_keyctl, sys_keyctl, compat_sys_keyctl) /* arch/example/kernel/sys_example.c */ #define __NR_clone 220 __SYSCALL(__NR_clone, sys_clone) #define __NR_execve 221 __SC_COMP(__NR_execve, sys_execve, compat_sys_execve) #define __NR3264_mmap 222 __SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap) /* mm/fadvise.c */ #define __NR3264_fadvise64 223 __SC_COMP(__NR3264_fadvise64, sys_fadvise64_64, compat_sys_fadvise64_64) /* mm/, CONFIG_MMU only */ #ifndef __ARCH_NOMMU #define __NR_swapon 224 __SYSCALL(__NR_swapon, sys_swapon) #define __NR_swapoff 225 __SYSCALL(__NR_swapoff, sys_swapoff) #define __NR_mprotect 226 __SYSCALL(__NR_mprotect, sys_mprotect) #define __NR_msync 227 __SYSCALL(__NR_msync, sys_msync) #define __NR_mlock 228 __SYSCALL(__NR_mlock, sys_mlock) #define __NR_munlock 229 __SYSCALL(__NR_munlock, sys_munlock) #define __NR_mlockall 230 __SYSCALL(__NR_mlockall, sys_mlockall) #define __NR_munlockall 231 __SYSCALL(__NR_munlockall, sys_munlockall) #define __NR_mincore 232 __SYSCALL(__NR_mincore, sys_mincore) #define __NR_madvise 233 __SYSCALL(__NR_madvise, sys_madvise) #define __NR_remap_file_pages 234 __SYSCALL(__NR_remap_file_pages, sys_remap_file_pages) #define __NR_mbind 235 __SC_COMP(__NR_mbind, sys_mbind, compat_sys_mbind) #define __NR_get_mempolicy 236 __SC_COMP(__NR_get_mempolicy, sys_get_mempolicy, compat_sys_get_mempolicy) #define __NR_set_mempolicy 237 __SC_COMP(__NR_set_mempolicy, sys_set_mempolicy, compat_sys_set_mempolicy) #define __NR_migrate_pages 238 __SC_COMP(__NR_migrate_pages, sys_migrate_pages, compat_sys_migrate_pages) #define __NR_move_pages 239 __SC_COMP(__NR_move_pages, sys_move_pages, compat_sys_move_pages) #endif #define __NR_rt_tgsigqueueinfo 240 __SC_COMP(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo, \ compat_sys_rt_tgsigqueueinfo) #define __NR_perf_event_open 241 __SYSCALL(__NR_perf_event_open, sys_perf_event_open) #define __NR_accept4 242 __SYSCALL(__NR_accept4, sys_accept4) #define __NR_recvmmsg 243 __SC_COMP(__NR_recvmmsg, sys_recvmmsg, compat_sys_recvmmsg) /* * Architectures may provide up to 16 syscalls of their own * starting with this value. */ #define __NR_arch_specific_syscall 244 #define __NR_wait4 260 __SC_COMP(__NR_wait4, sys_wait4, compat_sys_wait4) #define __NR_prlimit64 261 __SYSCALL(__NR_prlimit64, sys_prlimit64) #define __NR_fanotify_init 262 __SYSCALL(__NR_fanotify_init, sys_fanotify_init) #define __NR_fanotify_mark 263 __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) #define __NR_name_to_handle_at 264 __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at) #define __NR_open_by_handle_at 265 __SC_COMP(__NR_open_by_handle_at, sys_open_by_handle_at, \ compat_sys_open_by_handle_at) #define __NR_clock_adjtime 266 __SC_COMP(__NR_clock_adjtime, sys_clock_adjtime, compat_sys_clock_adjtime) #define __NR_syncfs 267 __SYSCALL(__NR_syncfs, sys_syncfs) #define __NR_setns 268 __SYSCALL(__NR_setns, sys_setns) #define __NR_sendmmsg 269 __SC_COMP(__NR_sendmmsg, sys_sendmmsg, compat_sys_sendmmsg) #define __NR_process_vm_readv 270 __SC_COMP(__NR_process_vm_readv, sys_process_vm_readv, \ compat_sys_process_vm_readv) #define __NR_process_vm_writev 271 __SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \ compat_sys_process_vm_writev) #define __NR_kcmp 272 __SYSCALL(__NR_kcmp, sys_kcmp) #define __NR_finit_module 273 __SYSCALL(__NR_finit_module, sys_finit_module) #define __NR_sched_setattr 274 __SYSCALL(__NR_sched_setattr, sys_sched_setattr) #define __NR_sched_getattr 275 __SYSCALL(__NR_sched_getattr, sys_sched_getattr) #define __NR_renameat2 276 __SYSCALL(__NR_renameat2, sys_renameat2) #define __NR_seccomp 277 __SYSCALL(__NR_seccomp, sys_seccomp) #define __NR_getrandom 278 __SYSCALL(__NR_getrandom, sys_getrandom) #define __NR_memfd_create 279 __SYSCALL(__NR_memfd_create, sys_memfd_create) #define __NR_bpf 280 __SYSCALL(__NR_bpf, sys_bpf) #define __NR_execveat 281 __SC_COMP(__NR_execveat, sys_execveat, compat_sys_execveat) #define __NR_userfaultfd 282 __SYSCALL(__NR_userfaultfd, sys_userfaultfd) #define __NR_membarrier 283 __SYSCALL(__NR_membarrier, sys_membarrier) #define __NR_mlock2 284 __SYSCALL(__NR_mlock2, sys_mlock2) #define __NR_copy_file_range 285 __SYSCALL(__NR_copy_file_range, sys_copy_file_range) #define __NR_preadv2 286 __SC_COMP(__NR_preadv2, sys_preadv2, compat_sys_preadv2) #define __NR_pwritev2 287 __SC_COMP(__NR_pwritev2, sys_pwritev2, compat_sys_pwritev2) #define __NR_pkey_mprotect 288 __SYSCALL(__NR_pkey_mprotect, sys_pkey_mprotect) #define __NR_pkey_alloc 289 __SYSCALL(__NR_pkey_alloc, sys_pkey_alloc) #define __NR_pkey_free 290 __SYSCALL(__NR_pkey_free, sys_pkey_free) #define __NR_statx 291 __SYSCALL(__NR_statx, sys_statx) #define __NR_io_pgetevents 292 __SC_COMP(__NR_io_pgetevents, sys_io_pgetevents, compat_sys_io_pgetevents) #define __NR_rseq 293 __SYSCALL(__NR_rseq, sys_rseq) #undef __NR_syscalls #define __NR_syscalls 294 /* * 32 bit systems traditionally used different * syscalls for off_t and loff_t arguments, while * 64 bit systems only need the off_t version. * For new 32 bit platforms, there is no need to * implement the old 32 bit off_t syscalls, so * they take different names. * Here we map the numbers so that both versions * use the same syscall table layout. */ #if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT) #define __NR_fcntl __NR3264_fcntl #define __NR_statfs __NR3264_statfs #define __NR_fstatfs __NR3264_fstatfs #define __NR_truncate __NR3264_truncate #define __NR_ftruncate __NR3264_ftruncate #define __NR_lseek __NR3264_lseek #define __NR_sendfile __NR3264_sendfile #define __NR_newfstatat __NR3264_fstatat #define __NR_fstat __NR3264_fstat #define __NR_mmap __NR3264_mmap #define __NR_fadvise64 __NR3264_fadvise64 #ifdef __NR3264_stat #define __NR_stat __NR3264_stat #define __NR_lstat __NR3264_lstat #endif #else #define __NR_fcntl64 __NR3264_fcntl #define __NR_statfs64 __NR3264_statfs #define __NR_fstatfs64 __NR3264_fstatfs #define __NR_truncate64 __NR3264_truncate #define __NR_ftruncate64 __NR3264_ftruncate #define __NR_llseek __NR3264_lseek #define __NR_sendfile64 __NR3264_sendfile #define __NR_fstatat64 __NR3264_fstatat #define __NR_fstat64 __NR3264_fstat #define __NR_mmap2 __NR3264_mmap #define __NR_fadvise64_64 __NR3264_fadvise64 #ifdef __NR3264_stat #define __NR_stat64 __NR3264_stat #define __NR_lstat64 __NR3264_lstat #endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/param.h���������������������������������������������������������������������������������0000644�����������������00000000541�14763166030�0010215 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_PARAM_H #define __ASM_GENERIC_PARAM_H #ifndef HZ #define HZ 100 #endif #ifndef EXEC_PAGESIZE #define EXEC_PAGESIZE 4096 #endif #ifndef NOGROUP #define NOGROUP (-1) #endif #define MAXHOSTNAMELEN 64 /* max length of hostname */ #endif /* __ASM_GENERIC_PARAM_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/bpf_perf_event.h������������������������������������������������������������������������0000644�����������������00000000356�14763166030�0012105 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef __ASM_GENERIC_BPF_PERF_EVENT_H__ #define __ASM_GENERIC_BPF_PERF_EVENT_H__ #include <linux/ptrace.h> /* Export kernel pt_regs structure */ typedef struct pt_regs bpf_user_pt_regs_t; #endif /* __ASM_GENERIC_BPF_PERF_EVENT_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/sockios.h�������������������������������������������������������������������������������0000644�����������������00000000667�14763166030�0010600 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_SOCKIOS_H #define __ASM_GENERIC_SOCKIOS_H /* Socket-level I/O control calls. */ #define FIOSETOWN 0x8901 #define SIOCSPGRP 0x8902 #define FIOGETOWN 0x8903 #define SIOCGPGRP 0x8904 #define SIOCATMARK 0x8905 #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ #endif /* __ASM_GENERIC_SOCKIOS_H */ �������������������������������������������������������������������������asm-generic/resource.h������������������������������������������������������������������������������0000644�����������������00000003520�14763166030�0010744 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_RESOURCE_H #define _ASM_GENERIC_RESOURCE_H /* * Resource limit IDs * * ( Compatibility detail: there are architectures that have * a different rlimit ID order in the 5-9 range and want * to keep that order for binary compatibility. The reasons * are historic and all new rlimits are identical across all * arches. If an arch has such special order for some rlimits * then it defines them prior including asm-generic/resource.h. ) */ #define RLIMIT_CPU 0 /* CPU time in sec */ #define RLIMIT_FSIZE 1 /* Maximum filesize */ #define RLIMIT_DATA 2 /* max data size */ #define RLIMIT_STACK 3 /* max stack size */ #define RLIMIT_CORE 4 /* max core file size */ #ifndef RLIMIT_RSS # define RLIMIT_RSS 5 /* max resident set size */ #endif #ifndef RLIMIT_NPROC # define RLIMIT_NPROC 6 /* max number of processes */ #endif #ifndef RLIMIT_NOFILE # define RLIMIT_NOFILE 7 /* max number of open files */ #endif #ifndef RLIMIT_MEMLOCK # define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */ #endif #ifndef RLIMIT_AS # define RLIMIT_AS 9 /* address space limit */ #endif #define RLIMIT_LOCKS 10 /* maximum file locks held */ #define RLIMIT_SIGPENDING 11 /* max number of pending signals */ #define RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */ #define RLIMIT_NICE 13 /* max nice prio allowed to raise to 0-39 for nice level 19 .. -20 */ #define RLIMIT_RTPRIO 14 /* maximum realtime priority */ #define RLIMIT_RTTIME 15 /* timeout for RT tasks in us */ #define RLIM_NLIMITS 16 /* * SuS says limits have to be unsigned. * Which makes a ton more sense anyway. * * Some architectures override this (for compatibility reasons): */ #ifndef RLIM_INFINITY # define RLIM_INFINITY (~0UL) #endif #endif /* _ASM_GENERIC_RESOURCE_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/statfs.h��������������������������������������������������������������������������������0000644�����������������00000003457�14763166030�0010432 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _GENERIC_STATFS_H #define _GENERIC_STATFS_H #include <linux/types.h> /* * Most 64-bit platforms use 'long', while most 32-bit platforms use '__u32'. * Yes, they differ in signedness as well as size. * Special cases can override it for themselves -- except for S390x, which * is just a little too special for us. And MIPS, which I'm not touching * with a 10' pole. */ #ifndef __statfs_word #if __BITS_PER_LONG == 64 #define __statfs_word __kernel_long_t #else #define __statfs_word __u32 #endif #endif struct statfs { __statfs_word f_type; __statfs_word f_bsize; __statfs_word f_blocks; __statfs_word f_bfree; __statfs_word f_bavail; __statfs_word f_files; __statfs_word f_ffree; __kernel_fsid_t f_fsid; __statfs_word f_namelen; __statfs_word f_frsize; __statfs_word f_flags; __statfs_word f_spare[4]; }; /* * ARM needs to avoid the 32-bit padding at the end, for consistency * between EABI and OABI */ #ifndef ARCH_PACK_STATFS64 #define ARCH_PACK_STATFS64 #endif struct statfs64 { __statfs_word f_type; __statfs_word f_bsize; __u64 f_blocks; __u64 f_bfree; __u64 f_bavail; __u64 f_files; __u64 f_ffree; __kernel_fsid_t f_fsid; __statfs_word f_namelen; __statfs_word f_frsize; __statfs_word f_flags; __statfs_word f_spare[4]; } ARCH_PACK_STATFS64; /* * IA64 and x86_64 need to avoid the 32-bit padding at the end, * to be compatible with the i386 ABI */ #ifndef ARCH_PACK_COMPAT_STATFS64 #define ARCH_PACK_COMPAT_STATFS64 #endif struct compat_statfs64 { __u32 f_type; __u32 f_bsize; __u64 f_blocks; __u64 f_bfree; __u64 f_bavail; __u64 f_files; __u64 f_ffree; __kernel_fsid_t f_fsid; __u32 f_namelen; __u32 f_frsize; __u32 f_flags; __u32 f_spare[4]; } ARCH_PACK_COMPAT_STATFS64; #endif /* _GENERIC_STATFS_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/ucontext.h������������������������������������������������������������������������������0000644�����������������00000000545�14763166030�0010772 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_UCONTEXT_H #define __ASM_GENERIC_UCONTEXT_H struct ucontext { unsigned long uc_flags; struct ucontext *uc_link; stack_t uc_stack; struct sigcontext uc_mcontext; sigset_t uc_sigmask; /* mask last for extensibility */ }; #endif /* __ASM_GENERIC_UCONTEXT_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/socket.h��������������������������������������������������������������������������������0000644�����������������00000004451�14763166030�0010411 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_SOCKET_H #define __ASM_GENERIC_SOCKET_H #include <asm/sockios.h> /* For setsockopt(2) */ #define SOL_SOCKET 1 #define SO_DEBUG 1 #define SO_REUSEADDR 2 #define SO_TYPE 3 #define SO_ERROR 4 #define SO_DONTROUTE 5 #define SO_BROADCAST 6 #define SO_SNDBUF 7 #define SO_RCVBUF 8 #define SO_SNDBUFFORCE 32 #define SO_RCVBUFFORCE 33 #define SO_KEEPALIVE 9 #define SO_OOBINLINE 10 #define SO_NO_CHECK 11 #define SO_PRIORITY 12 #define SO_LINGER 13 #define SO_BSDCOMPAT 14 #define SO_REUSEPORT 15 #ifndef SO_PASSCRED /* powerpc only differs in these */ #define SO_PASSCRED 16 #define SO_PEERCRED 17 #define SO_RCVLOWAT 18 #define SO_SNDLOWAT 19 #define SO_RCVTIMEO 20 #define SO_SNDTIMEO 21 #endif /* Security levels - as per NRL IPv6 - don't actually do anything */ #define SO_SECURITY_AUTHENTICATION 22 #define SO_SECURITY_ENCRYPTION_TRANSPORT 23 #define SO_SECURITY_ENCRYPTION_NETWORK 24 #define SO_BINDTODEVICE 25 /* Socket filtering */ #define SO_ATTACH_FILTER 26 #define SO_DETACH_FILTER 27 #define SO_GET_FILTER SO_ATTACH_FILTER #define SO_PEERNAME 28 #define SO_TIMESTAMP 29 #define SCM_TIMESTAMP SO_TIMESTAMP #define SO_ACCEPTCONN 30 #define SO_PEERSEC 31 #define SO_PASSSEC 34 #define SO_TIMESTAMPNS 35 #define SCM_TIMESTAMPNS SO_TIMESTAMPNS #define SO_MARK 36 #define SO_TIMESTAMPING 37 #define SCM_TIMESTAMPING SO_TIMESTAMPING #define SO_PROTOCOL 38 #define SO_DOMAIN 39 #define SO_RXQ_OVFL 40 #define SO_WIFI_STATUS 41 #define SCM_WIFI_STATUS SO_WIFI_STATUS #define SO_PEEK_OFF 42 /* Instruct lower device to use last 4-bytes of skb data as FCS */ #define SO_NOFCS 43 #define SO_LOCK_FILTER 44 #define SO_SELECT_ERR_QUEUE 45 #define SO_BUSY_POLL 46 #define SO_MAX_PACING_RATE 47 #define SO_BPF_EXTENSIONS 48 #define SO_INCOMING_CPU 49 #define SO_ATTACH_BPF 50 #define SO_DETACH_BPF SO_DETACH_FILTER #define SO_ATTACH_REUSEPORT_CBPF 51 #define SO_ATTACH_REUSEPORT_EBPF 52 #define SO_CNX_ADVICE 53 #define SCM_TIMESTAMPING_OPT_STATS 54 #define SO_MEMINFO 55 #define SO_INCOMING_NAPI_ID 56 #define SO_COOKIE 57 #define SCM_TIMESTAMPING_PKTINFO 58 #define SO_PEERGROUPS 59 #define SO_ZEROCOPY 60 #define SO_TXTIME 61 #define SCM_TXTIME SO_TXTIME #endif /* __ASM_GENERIC_SOCKET_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/kvm_para.h������������������������������������������������������������������������������0000644�����������������00000000140�14763166030�0010710 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * There isn't anything here, but the file must not be empty or patch * will delete it. */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/errno.h���������������������������������������������������������������������������������0000644�����������������00000013020�14763166030�0010236 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_ERRNO_H #define _ASM_GENERIC_ERRNO_H #include <asm-generic/errno-base.h> #define EDEADLK 35 /* Resource deadlock would occur */ #define ENAMETOOLONG 36 /* File name too long */ #define ENOLCK 37 /* No record locks available */ /* * This error code is special: arch syscall entry code will return * -ENOSYS if users try to call a syscall that doesn't exist. To keep * failures of syscalls that really do exist distinguishable from * failures due to attempts to use a nonexistent syscall, syscall * implementations should refrain from returning -ENOSYS. */ #define ENOSYS 38 /* Invalid system call number */ #define ENOTEMPTY 39 /* Directory not empty */ #define ELOOP 40 /* Too many symbolic links encountered */ #define EWOULDBLOCK EAGAIN /* Operation would block */ #define ENOMSG 42 /* No message of desired type */ #define EIDRM 43 /* Identifier removed */ #define ECHRNG 44 /* Channel number out of range */ #define EL2NSYNC 45 /* Level 2 not synchronized */ #define EL3HLT 46 /* Level 3 halted */ #define EL3RST 47 /* Level 3 reset */ #define ELNRNG 48 /* Link number out of range */ #define EUNATCH 49 /* Protocol driver not attached */ #define ENOCSI 50 /* No CSI structure available */ #define EL2HLT 51 /* Level 2 halted */ #define EBADE 52 /* Invalid exchange */ #define EBADR 53 /* Invalid request descriptor */ #define EXFULL 54 /* Exchange full */ #define ENOANO 55 /* No anode */ #define EBADRQC 56 /* Invalid request code */ #define EBADSLT 57 /* Invalid slot */ #define EDEADLOCK EDEADLK #define EBFONT 59 /* Bad font file format */ #define ENOSTR 60 /* Device not a stream */ #define ENODATA 61 /* No data available */ #define ETIME 62 /* Timer expired */ #define ENOSR 63 /* Out of streams resources */ #define ENONET 64 /* Machine is not on the network */ #define ENOPKG 65 /* Package not installed */ #define EREMOTE 66 /* Object is remote */ #define ENOLINK 67 /* Link has been severed */ #define EADV 68 /* Advertise error */ #define ESRMNT 69 /* Srmount error */ #define ECOMM 70 /* Communication error on send */ #define EPROTO 71 /* Protocol error */ #define EMULTIHOP 72 /* Multihop attempted */ #define EDOTDOT 73 /* RFS specific error */ #define EBADMSG 74 /* Not a data message */ #define EOVERFLOW 75 /* Value too large for defined data type */ #define ENOTUNIQ 76 /* Name not unique on network */ #define EBADFD 77 /* File descriptor in bad state */ #define EREMCHG 78 /* Remote address changed */ #define ELIBACC 79 /* Can not access a needed shared library */ #define ELIBBAD 80 /* Accessing a corrupted shared library */ #define ELIBSCN 81 /* .lib section in a.out corrupted */ #define ELIBMAX 82 /* Attempting to link in too many shared libraries */ #define ELIBEXEC 83 /* Cannot exec a shared library directly */ #define EILSEQ 84 /* Illegal byte sequence */ #define ERESTART 85 /* Interrupted system call should be restarted */ #define ESTRPIPE 86 /* Streams pipe error */ #define EUSERS 87 /* Too many users */ #define ENOTSOCK 88 /* Socket operation on non-socket */ #define EDESTADDRREQ 89 /* Destination address required */ #define EMSGSIZE 90 /* Message too long */ #define EPROTOTYPE 91 /* Protocol wrong type for socket */ #define ENOPROTOOPT 92 /* Protocol not available */ #define EPROTONOSUPPORT 93 /* Protocol not supported */ #define ESOCKTNOSUPPORT 94 /* Socket type not supported */ #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ #define EPFNOSUPPORT 96 /* Protocol family not supported */ #define EAFNOSUPPORT 97 /* Address family not supported by protocol */ #define EADDRINUSE 98 /* Address already in use */ #define EADDRNOTAVAIL 99 /* Cannot assign requested address */ #define ENETDOWN 100 /* Network is down */ #define ENETUNREACH 101 /* Network is unreachable */ #define ENETRESET 102 /* Network dropped connection because of reset */ #define ECONNABORTED 103 /* Software caused connection abort */ #define ECONNRESET 104 /* Connection reset by peer */ #define ENOBUFS 105 /* No buffer space available */ #define EISCONN 106 /* Transport endpoint is already connected */ #define ENOTCONN 107 /* Transport endpoint is not connected */ #define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ #define ETOOMANYREFS 109 /* Too many references: cannot splice */ #define ETIMEDOUT 110 /* Connection timed out */ #define ECONNREFUSED 111 /* Connection refused */ #define EHOSTDOWN 112 /* Host is down */ #define EHOSTUNREACH 113 /* No route to host */ #define EALREADY 114 /* Operation already in progress */ #define EINPROGRESS 115 /* Operation now in progress */ #define ESTALE 116 /* Stale file handle */ #define EUCLEAN 117 /* Structure needs cleaning */ #define ENOTNAM 118 /* Not a XENIX named type file */ #define ENAVAIL 119 /* No XENIX semaphores available */ #define EISNAM 120 /* Is a named type file */ #define EREMOTEIO 121 /* Remote I/O error */ #define EDQUOT 122 /* Quota exceeded */ #define ENOMEDIUM 123 /* No medium found */ #define EMEDIUMTYPE 124 /* Wrong medium type */ #define ECANCELED 125 /* Operation Canceled */ #define ENOKEY 126 /* Required key not available */ #define EKEYEXPIRED 127 /* Key has expired */ #define EKEYREVOKED 128 /* Key has been revoked */ #define EKEYREJECTED 129 /* Key was rejected by service */ /* for robust mutexes */ #define EOWNERDEAD 130 /* Owner died */ #define ENOTRECOVERABLE 131 /* State not recoverable */ #define ERFKILL 132 /* Operation not possible due to RF-kill */ #define EHWPOISON 133 /* Memory page has hardware error */ #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������asm-generic/errno-base.h����������������������������������������������������������������������������0000644�����������������00000003114�14763166030�0011151 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_ERRNO_BASE_H #define _ASM_GENERIC_ERRNO_BASE_H #define EPERM 1 /* Operation not permitted */ #define ENOENT 2 /* No such file or directory */ #define ESRCH 3 /* No such process */ #define EINTR 4 /* Interrupted system call */ #define EIO 5 /* I/O error */ #define ENXIO 6 /* No such device or address */ #define E2BIG 7 /* Argument list too long */ #define ENOEXEC 8 /* Exec format error */ #define EBADF 9 /* Bad file number */ #define ECHILD 10 /* No child processes */ #define EAGAIN 11 /* Try again */ #define ENOMEM 12 /* Out of memory */ #define EACCES 13 /* Permission denied */ #define EFAULT 14 /* Bad address */ #define ENOTBLK 15 /* Block device required */ #define EBUSY 16 /* Device or resource busy */ #define EEXIST 17 /* File exists */ #define EXDEV 18 /* Cross-device link */ #define ENODEV 19 /* No such device */ #define ENOTDIR 20 /* Not a directory */ #define EISDIR 21 /* Is a directory */ #define EINVAL 22 /* Invalid argument */ #define ENFILE 23 /* File table overflow */ #define EMFILE 24 /* Too many open files */ #define ENOTTY 25 /* Not a typewriter */ #define ETXTBSY 26 /* Text file busy */ #define EFBIG 27 /* File too large */ #define ENOSPC 28 /* No space left on device */ #define ESPIPE 29 /* Illegal seek */ #define EROFS 30 /* Read-only file system */ #define EMLINK 31 /* Too many links */ #define EPIPE 32 /* Broken pipe */ #define EDOM 33 /* Math argument out of domain of func */ #define ERANGE 34 /* Math result not representable */ #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������lastlog.h�������������������������������������������������������������������������������������������0000644�����������������00000000176�14763166030�0006374 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* This header file is used in 4.3BSD to define `struct lastlog', which we define in <bits/utmp.h>. */ #include <utmp.h> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������pgtypes_timestamp.h���������������������������������������������������������������������������������0000644�����������������00000001762�14763166030�0010507 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* src/interfaces/ecpg/include/pgtypes_timestamp.h */ #ifndef PGTYPES_TIMESTAMP #define PGTYPES_TIMESTAMP /* pgtypes_interval.h includes ecpg_config.h */ #include <pgtypes_interval.h> #ifdef HAVE_INT64_TIMESTAMP typedef int64 timestamp; typedef int64 TimestampTz; #else typedef double timestamp; typedef double TimestampTz; #endif #ifdef __cplusplus extern "C" { #endif extern timestamp PGTYPEStimestamp_from_asc(char *, char **); extern char *PGTYPEStimestamp_to_asc(timestamp); extern int PGTYPEStimestamp_sub(timestamp *, timestamp *, interval *); extern int PGTYPEStimestamp_fmt_asc(timestamp *, char *, int, const char *); extern void PGTYPEStimestamp_current(timestamp *); extern int PGTYPEStimestamp_defmt_asc(char *, const char *, timestamp *); extern int PGTYPEStimestamp_add_interval(timestamp * tin, interval * span, timestamp * tout); extern int PGTYPEStimestamp_sub_interval(timestamp * tin, interval * span, timestamp * tout); #ifdef __cplusplus } #endif #endif /* PGTYPES_TIMESTAMP */ ��������������search.h��������������������������������������������������������������������������������������������0000644�����������������00000012163�14763166030�0006173 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Declarations for System V style searching functions. Copyright (C) 1995-1999, 2000, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SEARCH_H #define _SEARCH_H 1 #include <features.h> #define __need_size_t #include <stddef.h> __BEGIN_DECLS #if defined __USE_SVID || defined __USE_XOPEN_EXTENDED /* Prototype structure for a linked-list data structure. This is the type used by the `insque' and `remque' functions. */ # ifdef __USE_GNU struct qelem { struct qelem *q_forw; struct qelem *q_back; char q_data[1]; }; # endif /* Insert ELEM into a doubly-linked list, after PREV. */ extern void insque (void *__elem, void *__prev) __THROW; /* Unlink ELEM from the doubly-linked list that it is in. */ extern void remque (void *__elem) __THROW; #endif /* For use with hsearch(3). */ #ifndef __COMPAR_FN_T # define __COMPAR_FN_T typedef int (*__compar_fn_t) (const void *, const void *); # ifdef __USE_GNU typedef __compar_fn_t comparison_fn_t; # endif #endif /* Action which shall be performed in the call the hsearch. */ typedef enum { FIND, ENTER } ACTION; typedef struct entry { char *key; void *data; } ENTRY; /* Opaque type for internal use. */ struct _ENTRY; /* Family of hash table handling functions. The functions also have reentrant counterparts ending with _r. The non-reentrant functions all work on a signle internal hashing table. */ /* Search for entry matching ITEM.key in internal hash table. If ACTION is `FIND' return found entry or signal error by returning NULL. If ACTION is `ENTER' replace existing data (if any) with ITEM.data. */ extern ENTRY *hsearch (ENTRY __item, ACTION __action) __THROW; /* Create a new hashing table which will at most contain NEL elements. */ extern int hcreate (size_t __nel) __THROW; /* Destroy current internal hashing table. */ extern void hdestroy (void) __THROW; #ifdef __USE_GNU /* Data type for reentrant functions. */ struct hsearch_data { struct _ENTRY *table; unsigned int size; unsigned int filled; }; /* Reentrant versions which can handle multiple hashing tables at the same time. */ extern int hsearch_r (ENTRY __item, ACTION __action, ENTRY **__retval, struct hsearch_data *__htab) __THROW; extern int hcreate_r (size_t __nel, struct hsearch_data *__htab) __THROW; extern void hdestroy_r (struct hsearch_data *__htab) __THROW; #endif /* The tsearch routines are very interesting. They make many assumptions about the compiler. It assumes that the first field in node must be the "key" field, which points to the datum. Everything depends on that. */ /* For tsearch */ typedef enum { preorder, postorder, endorder, leaf } VISIT; /* Search for an entry matching the given KEY in the tree pointed to by *ROOTP and insert a new element if not found. */ extern void *tsearch (const void *__key, void **__rootp, __compar_fn_t __compar); /* Search for an entry matching the given KEY in the tree pointed to by *ROOTP. If no matching entry is available return NULL. */ extern void *tfind (const void *__key, void *const *__rootp, __compar_fn_t __compar); /* Remove the element matching KEY from the tree pointed to by *ROOTP. */ extern void *tdelete (const void *__restrict __key, void **__restrict __rootp, __compar_fn_t __compar); #ifndef __ACTION_FN_T # define __ACTION_FN_T typedef void (*__action_fn_t) (const void *__nodep, VISIT __value, int __level); #endif /* Walk through the whole tree and call the ACTION callback for every node or leaf. */ extern void twalk (const void *__root, __action_fn_t __action); #ifdef __USE_GNU /* Callback type for function to free a tree node. If the keys are atomic data this function should do nothing. */ typedef void (*__free_fn_t) (void *__nodep); /* Destroy the whole tree, call FREEFCT for each node or leaf. */ extern void tdestroy (void *__root, __free_fn_t __freefct); #endif /* Perform linear search for KEY by comparing by COMPAR in an array [BASE,BASE+NMEMB*SIZE). */ extern void *lfind (const void *__key, const void *__base, size_t *__nmemb, size_t __size, __compar_fn_t __compar); /* Perform linear search for KEY by comparing by COMPAR function in array [BASE,BASE+NMEMB*SIZE) and insert entry if not found. */ extern void *lsearch (const void *__key, void *__base, size_t *__nmemb, size_t __size, __compar_fn_t __compar); __END_DECLS #endif /* search.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������errno.h���������������������������������������������������������������������������������������������0000644�����������������00000004521�14763166030�0006052 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991,92,93,94,95,96,97,2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 Standard: 7.5 Errors <errno.h> */ #ifndef _ERRNO_H /* The includer defined __need_Emath if he wants only the definitions of EDOM and ERANGE, and not everything else. */ #ifndef __need_Emath # define _ERRNO_H 1 # include <features.h> #endif __BEGIN_DECLS /* Get the error number constants from the system-specific file. This file will test __need_Emath and _ERRNO_H. */ #include <bits/errno.h> #undef __need_Emath #ifdef _ERRNO_H /* Declare the `errno' variable, unless it's defined as a macro by bits/errno.h. This is the case in GNU, where it is a per-thread variable. This redeclaration using the macro still works, but it will be a function declaration without a prototype and may trigger a -Wstrict-prototypes warning. */ #ifndef errno extern int errno; #endif #ifdef __USE_GNU /* The full and simple forms of the name with which the program was invoked. These variables are set up automatically at startup based on the value of ARGV[0] (this works only if you use GNU ld). */ extern char *program_invocation_name, *program_invocation_short_name; #endif /* __USE_GNU */ #endif /* _ERRNO_H */ __END_DECLS #endif /* _ERRNO_H */ /* The Hurd <bits/errno.h> defines `error_t' as an enumerated type so that printing `error_t' values in the debugger shows the names. We might need this definition sometimes even if this file was included before. */ #if defined __USE_GNU || defined __need_error_t # ifndef __error_t_defined typedef int error_t; # define __error_t_defined 1 # endif # undef __need_error_t #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tld.h�����������������������������������������������������������������������������������������������0000644�����������������00000011044�14763166030�0005506 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* tld.h --- Declarations for TLD restriction checking. Copyright (C) 2004-2013 Simon Josefsson. Copyright (C) 2003-2013 Free Software Foundation, Inc. Author: Thomas Jacob, Internet24.de This file is part of GNU Libidn. GNU Libidn is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * 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. or both in parallel, as here. GNU Libidn 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 copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TLD_H # define TLD_H # ifndef IDNAPI # if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY # define IDNAPI __attribute__((__visibility__("default"))) # elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC # define IDNAPI __declspec(dllexport) # elif defined _MSC_VER && ! defined LIBIDN_STATIC # define IDNAPI __declspec(dllimport) # else # define IDNAPI # endif # endif # ifdef __cplusplus extern "C" { # endif /* Get size_t. */ # include <stdlib.h> /* Get uint32_t. */ # include <idn-int.h> /* Interval of valid code points in the TLD. */ struct Tld_table_element { uint32_t start; /* Start of range. */ uint32_t end; /* End of range, end == start if single. */ }; typedef struct Tld_table_element Tld_table_element; /* List valid code points in a TLD. */ struct Tld_table { const char *name; /* TLD name, e.g., "no". */ const char *version; /* Version string from TLD file. */ size_t nvalid; /* Number of entries in data. */ const Tld_table_element *valid; /* Sorted array of valid code points. */ }; typedef struct Tld_table Tld_table; /* Error codes. */ typedef enum { TLD_SUCCESS = 0, TLD_INVALID = 1, /* Invalid character found. */ TLD_NODATA = 2, /* Char, domain or inlen = 0. */ TLD_MALLOC_ERROR = 3, TLD_ICONV_ERROR = 4, TLD_NO_TLD = 5, /* Workaround typo in earlier versions. */ TLD_NOTLD = TLD_NO_TLD } Tld_rc; extern IDNAPI const char *tld_strerror (Tld_rc rc); /* Extract TLD, as ASCII string, of UCS4 domain name into "out". */ extern IDNAPI int tld_get_4 (const uint32_t * in, size_t inlen, char **out); extern IDNAPI int tld_get_4z (const uint32_t * in, char **out); extern IDNAPI int tld_get_z (const char *in, char **out); /* Return structure corresponding to the named TLD from specified * list of TLD tables, or return NULL if no matching TLD can be * found. */ extern IDNAPI const Tld_table *tld_get_table (const char *tld, const Tld_table ** tables); /* Return structure corresponding to the named TLD, first looking * thru overrides then thru built-in list, or return NULL if no * matching TLD can be found. */ extern IDNAPI const Tld_table * tld_default_table (const char *tld, const Tld_table ** overrides); /* Check NAMEPREPPED domain name for valid characters as defined by * the relevant registering body (plus [a-z0-9.-]). If error is * TLD_INVALID, set errpos to position of offending character. */ extern IDNAPI int tld_check_4t (const uint32_t * in, size_t inlen, size_t * errpos, const Tld_table * tld); extern IDNAPI int tld_check_4tz (const uint32_t * in, size_t * errpos, const Tld_table * tld); /* Utility interfaces that uses tld_get_4* to find TLD of string, then tld_default_table (with overrides) to find proper TLD table for the string, and then hands over to tld_check_4t*. */ extern IDNAPI int tld_check_4 (const uint32_t * in, size_t inlen, size_t * errpos, const Tld_table ** overrides); extern IDNAPI int tld_check_4z (const uint32_t * in, size_t * errpos, const Tld_table ** overrides); extern IDNAPI int tld_check_8z (const char *in, size_t * errpos, const Tld_table ** overrides); extern IDNAPI int tld_check_lz (const char *in, size_t * errpos, const Tld_table ** overrides); # ifdef __cplusplus } # endif #endif /* TLD_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������langinfo.h������������������������������������������������������������������������������������������0000644�����������������00000037104�14763166030�0006525 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Access to locale-dependent parameters. Copyright (C) 1995-2002,2003,2004,2005,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _LANGINFO_H #define _LANGINFO_H 1 /* Get the type definition. */ #include <nl_types.h> #include <bits/locale.h> /* Define the __LC_* category names. */ __BEGIN_DECLS /* Construct an `nl_item' value for `nl_langinfo' from a locale category (LC_*) and an item index within the category. Some code may depend on the item values within a category increasing monotonically with the indices. */ #define _NL_ITEM(category, index) (((category) << 16) | (index)) /* Extract the category and item index from a constructed `nl_item' value. */ #define _NL_ITEM_CATEGORY(item) ((int) (item) >> 16) #define _NL_ITEM_INDEX(item) ((int) (item) & 0xffff) /* Enumeration of locale items that can be queried with `nl_langinfo'. */ enum { /* LC_TIME category: date and time formatting. */ /* Abbreviated days of the week. */ ABDAY_1 = _NL_ITEM (__LC_TIME, 0), /* Sun */ #define ABDAY_1 ABDAY_1 ABDAY_2, #define ABDAY_2 ABDAY_2 ABDAY_3, #define ABDAY_3 ABDAY_3 ABDAY_4, #define ABDAY_4 ABDAY_4 ABDAY_5, #define ABDAY_5 ABDAY_5 ABDAY_6, #define ABDAY_6 ABDAY_6 ABDAY_7, #define ABDAY_7 ABDAY_7 /* Long-named days of the week. */ DAY_1, /* Sunday */ #define DAY_1 DAY_1 DAY_2, /* Monday */ #define DAY_2 DAY_2 DAY_3, /* Tuesday */ #define DAY_3 DAY_3 DAY_4, /* Wednesday */ #define DAY_4 DAY_4 DAY_5, /* Thursday */ #define DAY_5 DAY_5 DAY_6, /* Friday */ #define DAY_6 DAY_6 DAY_7, /* Saturday */ #define DAY_7 DAY_7 /* Abbreviated month names. */ ABMON_1, /* Jan */ #define ABMON_1 ABMON_1 ABMON_2, #define ABMON_2 ABMON_2 ABMON_3, #define ABMON_3 ABMON_3 ABMON_4, #define ABMON_4 ABMON_4 ABMON_5, #define ABMON_5 ABMON_5 ABMON_6, #define ABMON_6 ABMON_6 ABMON_7, #define ABMON_7 ABMON_7 ABMON_8, #define ABMON_8 ABMON_8 ABMON_9, #define ABMON_9 ABMON_9 ABMON_10, #define ABMON_10 ABMON_10 ABMON_11, #define ABMON_11 ABMON_11 ABMON_12, #define ABMON_12 ABMON_12 /* Long month names. */ MON_1, /* January */ #define MON_1 MON_1 MON_2, #define MON_2 MON_2 MON_3, #define MON_3 MON_3 MON_4, #define MON_4 MON_4 MON_5, #define MON_5 MON_5 MON_6, #define MON_6 MON_6 MON_7, #define MON_7 MON_7 MON_8, #define MON_8 MON_8 MON_9, #define MON_9 MON_9 MON_10, #define MON_10 MON_10 MON_11, #define MON_11 MON_11 MON_12, #define MON_12 MON_12 AM_STR, /* Ante meridiem string. */ #define AM_STR AM_STR PM_STR, /* Post meridiem string. */ #define PM_STR PM_STR D_T_FMT, /* Date and time format for strftime. */ #define D_T_FMT D_T_FMT D_FMT, /* Date format for strftime. */ #define D_FMT D_FMT T_FMT, /* Time format for strftime. */ #define T_FMT T_FMT T_FMT_AMPM, /* 12-hour time format for strftime. */ #define T_FMT_AMPM T_FMT_AMPM ERA, /* Alternate era. */ #define ERA ERA __ERA_YEAR, /* Year in alternate era format. */ #ifdef __USE_GNU # define ERA_YEAR __ERA_YEAR #endif ERA_D_FMT, /* Date in alternate era format. */ #define ERA_D_FMT ERA_D_FMT ALT_DIGITS, /* Alternate symbols for digits. */ #define ALT_DIGITS ALT_DIGITS ERA_D_T_FMT, /* Date and time in alternate era format. */ #define ERA_D_T_FMT ERA_D_T_FMT ERA_T_FMT, /* Time in alternate era format. */ #define ERA_T_FMT ERA_T_FMT _NL_TIME_ERA_NUM_ENTRIES, /* Number entries in the era arrays. */ _NL_TIME_ERA_ENTRIES, /* Structure with era entries in usable form.*/ _NL_WABDAY_1, /* Sun */ _NL_WABDAY_2, _NL_WABDAY_3, _NL_WABDAY_4, _NL_WABDAY_5, _NL_WABDAY_6, _NL_WABDAY_7, /* Long-named days of the week. */ _NL_WDAY_1, /* Sunday */ _NL_WDAY_2, /* Monday */ _NL_WDAY_3, /* Tuesday */ _NL_WDAY_4, /* Wednesday */ _NL_WDAY_5, /* Thursday */ _NL_WDAY_6, /* Friday */ _NL_WDAY_7, /* Saturday */ /* Abbreviated month names. */ _NL_WABMON_1, /* Jan */ _NL_WABMON_2, _NL_WABMON_3, _NL_WABMON_4, _NL_WABMON_5, _NL_WABMON_6, _NL_WABMON_7, _NL_WABMON_8, _NL_WABMON_9, _NL_WABMON_10, _NL_WABMON_11, _NL_WABMON_12, /* Long month names. */ _NL_WMON_1, /* January */ _NL_WMON_2, _NL_WMON_3, _NL_WMON_4, _NL_WMON_5, _NL_WMON_6, _NL_WMON_7, _NL_WMON_8, _NL_WMON_9, _NL_WMON_10, _NL_WMON_11, _NL_WMON_12, _NL_WAM_STR, /* Ante meridiem string. */ _NL_WPM_STR, /* Post meridiem string. */ _NL_WD_T_FMT, /* Date and time format for strftime. */ _NL_WD_FMT, /* Date format for strftime. */ _NL_WT_FMT, /* Time format for strftime. */ _NL_WT_FMT_AMPM, /* 12-hour time format for strftime. */ _NL_WERA_YEAR, /* Year in alternate era format. */ _NL_WERA_D_FMT, /* Date in alternate era format. */ _NL_WALT_DIGITS, /* Alternate symbols for digits. */ _NL_WERA_D_T_FMT, /* Date and time in alternate era format. */ _NL_WERA_T_FMT, /* Time in alternate era format. */ _NL_TIME_WEEK_NDAYS, _NL_TIME_WEEK_1STDAY, _NL_TIME_WEEK_1STWEEK, _NL_TIME_FIRST_WEEKDAY, _NL_TIME_FIRST_WORKDAY, _NL_TIME_CAL_DIRECTION, _NL_TIME_TIMEZONE, _DATE_FMT, /* strftime format for date. */ #define _DATE_FMT _DATE_FMT _NL_W_DATE_FMT, _NL_TIME_CODESET, _NL_NUM_LC_TIME, /* Number of indices in LC_TIME category. */ /* LC_COLLATE category: text sorting. This information is accessed by the strcoll and strxfrm functions. These `nl_langinfo' names are used only internally. */ _NL_COLLATE_NRULES = _NL_ITEM (__LC_COLLATE, 0), _NL_COLLATE_RULESETS, _NL_COLLATE_TABLEMB, _NL_COLLATE_WEIGHTMB, _NL_COLLATE_EXTRAMB, _NL_COLLATE_INDIRECTMB, _NL_COLLATE_GAP1, _NL_COLLATE_GAP2, _NL_COLLATE_GAP3, _NL_COLLATE_TABLEWC, _NL_COLLATE_WEIGHTWC, _NL_COLLATE_EXTRAWC, _NL_COLLATE_INDIRECTWC, _NL_COLLATE_SYMB_HASH_SIZEMB, _NL_COLLATE_SYMB_TABLEMB, _NL_COLLATE_SYMB_EXTRAMB, _NL_COLLATE_COLLSEQMB, _NL_COLLATE_COLLSEQWC, _NL_COLLATE_CODESET, _NL_NUM_LC_COLLATE, /* LC_CTYPE category: character classification. This information is accessed by the functions in <ctype.h>. These `nl_langinfo' names are used only internally. */ _NL_CTYPE_CLASS = _NL_ITEM (__LC_CTYPE, 0), _NL_CTYPE_TOUPPER, _NL_CTYPE_GAP1, _NL_CTYPE_TOLOWER, _NL_CTYPE_GAP2, _NL_CTYPE_CLASS32, _NL_CTYPE_GAP3, _NL_CTYPE_GAP4, _NL_CTYPE_GAP5, _NL_CTYPE_GAP6, _NL_CTYPE_CLASS_NAMES, _NL_CTYPE_MAP_NAMES, _NL_CTYPE_WIDTH, _NL_CTYPE_MB_CUR_MAX, _NL_CTYPE_CODESET_NAME, CODESET = _NL_CTYPE_CODESET_NAME, #define CODESET CODESET _NL_CTYPE_TOUPPER32, _NL_CTYPE_TOLOWER32, _NL_CTYPE_CLASS_OFFSET, _NL_CTYPE_MAP_OFFSET, _NL_CTYPE_INDIGITS_MB_LEN, _NL_CTYPE_INDIGITS0_MB, _NL_CTYPE_INDIGITS1_MB, _NL_CTYPE_INDIGITS2_MB, _NL_CTYPE_INDIGITS3_MB, _NL_CTYPE_INDIGITS4_MB, _NL_CTYPE_INDIGITS5_MB, _NL_CTYPE_INDIGITS6_MB, _NL_CTYPE_INDIGITS7_MB, _NL_CTYPE_INDIGITS8_MB, _NL_CTYPE_INDIGITS9_MB, _NL_CTYPE_INDIGITS_WC_LEN, _NL_CTYPE_INDIGITS0_WC, _NL_CTYPE_INDIGITS1_WC, _NL_CTYPE_INDIGITS2_WC, _NL_CTYPE_INDIGITS3_WC, _NL_CTYPE_INDIGITS4_WC, _NL_CTYPE_INDIGITS5_WC, _NL_CTYPE_INDIGITS6_WC, _NL_CTYPE_INDIGITS7_WC, _NL_CTYPE_INDIGITS8_WC, _NL_CTYPE_INDIGITS9_WC, _NL_CTYPE_OUTDIGIT0_MB, _NL_CTYPE_OUTDIGIT1_MB, _NL_CTYPE_OUTDIGIT2_MB, _NL_CTYPE_OUTDIGIT3_MB, _NL_CTYPE_OUTDIGIT4_MB, _NL_CTYPE_OUTDIGIT5_MB, _NL_CTYPE_OUTDIGIT6_MB, _NL_CTYPE_OUTDIGIT7_MB, _NL_CTYPE_OUTDIGIT8_MB, _NL_CTYPE_OUTDIGIT9_MB, _NL_CTYPE_OUTDIGIT0_WC, _NL_CTYPE_OUTDIGIT1_WC, _NL_CTYPE_OUTDIGIT2_WC, _NL_CTYPE_OUTDIGIT3_WC, _NL_CTYPE_OUTDIGIT4_WC, _NL_CTYPE_OUTDIGIT5_WC, _NL_CTYPE_OUTDIGIT6_WC, _NL_CTYPE_OUTDIGIT7_WC, _NL_CTYPE_OUTDIGIT8_WC, _NL_CTYPE_OUTDIGIT9_WC, _NL_CTYPE_TRANSLIT_TAB_SIZE, _NL_CTYPE_TRANSLIT_FROM_IDX, _NL_CTYPE_TRANSLIT_FROM_TBL, _NL_CTYPE_TRANSLIT_TO_IDX, _NL_CTYPE_TRANSLIT_TO_TBL, _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN, _NL_CTYPE_TRANSLIT_DEFAULT_MISSING, _NL_CTYPE_TRANSLIT_IGNORE_LEN, _NL_CTYPE_TRANSLIT_IGNORE, _NL_CTYPE_MAP_TO_NONASCII, _NL_CTYPE_NONASCII_CASE, _NL_CTYPE_EXTRA_MAP_1, _NL_CTYPE_EXTRA_MAP_2, _NL_CTYPE_EXTRA_MAP_3, _NL_CTYPE_EXTRA_MAP_4, _NL_CTYPE_EXTRA_MAP_5, _NL_CTYPE_EXTRA_MAP_6, _NL_CTYPE_EXTRA_MAP_7, _NL_CTYPE_EXTRA_MAP_8, _NL_CTYPE_EXTRA_MAP_9, _NL_CTYPE_EXTRA_MAP_10, _NL_CTYPE_EXTRA_MAP_11, _NL_CTYPE_EXTRA_MAP_12, _NL_CTYPE_EXTRA_MAP_13, _NL_CTYPE_EXTRA_MAP_14, _NL_NUM_LC_CTYPE, /* LC_MONETARY category: formatting of monetary quantities. These items each correspond to a member of `struct lconv', defined in <locale.h>. */ __INT_CURR_SYMBOL = _NL_ITEM (__LC_MONETARY, 0), #ifdef __USE_GNU # define INT_CURR_SYMBOL __INT_CURR_SYMBOL #endif __CURRENCY_SYMBOL, #ifdef __USE_GNU # define CURRENCY_SYMBOL __CURRENCY_SYMBOL #endif __MON_DECIMAL_POINT, #ifdef __USE_GNU # define MON_DECIMAL_POINT __MON_DECIMAL_POINT #endif __MON_THOUSANDS_SEP, #ifdef __USE_GNU # define MON_THOUSANDS_SEP __MON_THOUSANDS_SEP #endif __MON_GROUPING, #ifdef __USE_GNU # define MON_GROUPING __MON_GROUPING #endif __POSITIVE_SIGN, #ifdef __USE_GNU # define POSITIVE_SIGN __POSITIVE_SIGN #endif __NEGATIVE_SIGN, #ifdef __USE_GNU # define NEGATIVE_SIGN __NEGATIVE_SIGN #endif __INT_FRAC_DIGITS, #ifdef __USE_GNU # define INT_FRAC_DIGITS __INT_FRAC_DIGITS #endif __FRAC_DIGITS, #ifdef __USE_GNU # define FRAC_DIGITS __FRAC_DIGITS #endif __P_CS_PRECEDES, #ifdef __USE_GNU # define P_CS_PRECEDES __P_CS_PRECEDES #endif __P_SEP_BY_SPACE, #ifdef __USE_GNU # define P_SEP_BY_SPACE __P_SEP_BY_SPACE #endif __N_CS_PRECEDES, #ifdef __USE_GNU # define N_CS_PRECEDES __N_CS_PRECEDES #endif __N_SEP_BY_SPACE, #ifdef __USE_GNU # define N_SEP_BY_SPACE __N_SEP_BY_SPACE #endif __P_SIGN_POSN, #ifdef __USE_GNU # define P_SIGN_POSN __P_SIGN_POSN #endif __N_SIGN_POSN, #ifdef __USE_GNU # define N_SIGN_POSN __N_SIGN_POSN #endif _NL_MONETARY_CRNCYSTR, #define CRNCYSTR _NL_MONETARY_CRNCYSTR __INT_P_CS_PRECEDES, #ifdef __USE_GNU # define INT_P_CS_PRECEDES __INT_P_CS_PRECEDES #endif __INT_P_SEP_BY_SPACE, #ifdef __USE_GNU # define INT_P_SEP_BY_SPACE __INT_P_SEP_BY_SPACE #endif __INT_N_CS_PRECEDES, #ifdef __USE_GNU # define INT_N_CS_PRECEDES __INT_N_CS_PRECEDES #endif __INT_N_SEP_BY_SPACE, #ifdef __USE_GNU # define INT_N_SEP_BY_SPACE __INT_N_SEP_BY_SPACE #endif __INT_P_SIGN_POSN, #ifdef __USE_GNU # define INT_P_SIGN_POSN __INT_P_SIGN_POSN #endif __INT_N_SIGN_POSN, #ifdef __USE_GNU # define INT_N_SIGN_POSN __INT_N_SIGN_POSN #endif _NL_MONETARY_DUO_INT_CURR_SYMBOL, _NL_MONETARY_DUO_CURRENCY_SYMBOL, _NL_MONETARY_DUO_INT_FRAC_DIGITS, _NL_MONETARY_DUO_FRAC_DIGITS, _NL_MONETARY_DUO_P_CS_PRECEDES, _NL_MONETARY_DUO_P_SEP_BY_SPACE, _NL_MONETARY_DUO_N_CS_PRECEDES, _NL_MONETARY_DUO_N_SEP_BY_SPACE, _NL_MONETARY_DUO_INT_P_CS_PRECEDES, _NL_MONETARY_DUO_INT_P_SEP_BY_SPACE, _NL_MONETARY_DUO_INT_N_CS_PRECEDES, _NL_MONETARY_DUO_INT_N_SEP_BY_SPACE, _NL_MONETARY_DUO_P_SIGN_POSN, _NL_MONETARY_DUO_N_SIGN_POSN, _NL_MONETARY_DUO_INT_P_SIGN_POSN, _NL_MONETARY_DUO_INT_N_SIGN_POSN, _NL_MONETARY_UNO_VALID_FROM, _NL_MONETARY_UNO_VALID_TO, _NL_MONETARY_DUO_VALID_FROM, _NL_MONETARY_DUO_VALID_TO, _NL_MONETARY_CONVERSION_RATE, _NL_MONETARY_DECIMAL_POINT_WC, _NL_MONETARY_THOUSANDS_SEP_WC, _NL_MONETARY_CODESET, _NL_NUM_LC_MONETARY, /* LC_NUMERIC category: formatting of numbers. These also correspond to members of `struct lconv'; see <locale.h>. */ __DECIMAL_POINT = _NL_ITEM (__LC_NUMERIC, 0), #ifdef __USE_GNU # define DECIMAL_POINT __DECIMAL_POINT #endif RADIXCHAR = __DECIMAL_POINT, #define RADIXCHAR RADIXCHAR __THOUSANDS_SEP, #ifdef __USE_GNU # define THOUSANDS_SEP __THOUSANDS_SEP #endif THOUSEP = __THOUSANDS_SEP, #define THOUSEP THOUSEP __GROUPING, #ifdef __USE_GNU # define GROUPING __GROUPING #endif _NL_NUMERIC_DECIMAL_POINT_WC, _NL_NUMERIC_THOUSANDS_SEP_WC, _NL_NUMERIC_CODESET, _NL_NUM_LC_NUMERIC, __YESEXPR = _NL_ITEM (__LC_MESSAGES, 0), /* Regex matching ``yes'' input. */ #define YESEXPR __YESEXPR __NOEXPR, /* Regex matching ``no'' input. */ #define NOEXPR __NOEXPR __YESSTR, /* Output string for ``yes''. */ #if defined __USE_GNU || (defined __USE_XOPEN && !defined __USE_XOPEN2K) # define YESSTR __YESSTR #endif __NOSTR, /* Output string for ``no''. */ #if defined __USE_GNU || (defined __USE_XOPEN && !defined __USE_XOPEN2K) # define NOSTR __NOSTR #endif _NL_MESSAGES_CODESET, _NL_NUM_LC_MESSAGES, _NL_PAPER_HEIGHT = _NL_ITEM (__LC_PAPER, 0), _NL_PAPER_WIDTH, _NL_PAPER_CODESET, _NL_NUM_LC_PAPER, _NL_NAME_NAME_FMT = _NL_ITEM (__LC_NAME, 0), _NL_NAME_NAME_GEN, _NL_NAME_NAME_MR, _NL_NAME_NAME_MRS, _NL_NAME_NAME_MISS, _NL_NAME_NAME_MS, _NL_NAME_CODESET, _NL_NUM_LC_NAME, _NL_ADDRESS_POSTAL_FMT = _NL_ITEM (__LC_ADDRESS, 0), _NL_ADDRESS_COUNTRY_NAME, _NL_ADDRESS_COUNTRY_POST, _NL_ADDRESS_COUNTRY_AB2, _NL_ADDRESS_COUNTRY_AB3, _NL_ADDRESS_COUNTRY_CAR, _NL_ADDRESS_COUNTRY_NUM, _NL_ADDRESS_COUNTRY_ISBN, _NL_ADDRESS_LANG_NAME, _NL_ADDRESS_LANG_AB, _NL_ADDRESS_LANG_TERM, _NL_ADDRESS_LANG_LIB, _NL_ADDRESS_CODESET, _NL_NUM_LC_ADDRESS, _NL_TELEPHONE_TEL_INT_FMT = _NL_ITEM (__LC_TELEPHONE, 0), _NL_TELEPHONE_TEL_DOM_FMT, _NL_TELEPHONE_INT_SELECT, _NL_TELEPHONE_INT_PREFIX, _NL_TELEPHONE_CODESET, _NL_NUM_LC_TELEPHONE, _NL_MEASUREMENT_MEASUREMENT = _NL_ITEM (__LC_MEASUREMENT, 0), _NL_MEASUREMENT_CODESET, _NL_NUM_LC_MEASUREMENT, _NL_IDENTIFICATION_TITLE = _NL_ITEM (__LC_IDENTIFICATION, 0), _NL_IDENTIFICATION_SOURCE, _NL_IDENTIFICATION_ADDRESS, _NL_IDENTIFICATION_CONTACT, _NL_IDENTIFICATION_EMAIL, _NL_IDENTIFICATION_TEL, _NL_IDENTIFICATION_FAX, _NL_IDENTIFICATION_LANGUAGE, _NL_IDENTIFICATION_TERRITORY, _NL_IDENTIFICATION_AUDIENCE, _NL_IDENTIFICATION_APPLICATION, _NL_IDENTIFICATION_ABBREVIATION, _NL_IDENTIFICATION_REVISION, _NL_IDENTIFICATION_DATE, _NL_IDENTIFICATION_CATEGORY, _NL_IDENTIFICATION_CODESET, _NL_NUM_LC_IDENTIFICATION, /* This marks the highest value used. */ _NL_NUM }; /* This macro produces an item you can pass to `nl_langinfo' or `nl_langinfo_l' to get the name of the locale in use for CATEGORY. */ #define _NL_LOCALE_NAME(category) _NL_ITEM ((category), \ _NL_ITEM_INDEX (-1)) #ifdef __USE_GNU # define NL_LOCALE_NAME(category) _NL_LOCALE_NAME (category) #endif /* Return the current locale's value for ITEM. If ITEM is invalid, an empty string is returned. The string returned will not change until `setlocale' is called; it is usually in read-only memory and cannot be modified. */ extern char *nl_langinfo (nl_item __item) __THROW; #ifdef __USE_XOPEN2K /* This interface is for the extended locale model. See <locale.h> for more information. */ /* Get locale datatype definition. */ # include <xlocale.h> /* Just like nl_langinfo but get the information from the locale object L. */ extern char *nl_langinfo_l (nl_item __item, __locale_t __l); #endif __END_DECLS #endif /* langinfo.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/setjmp.h���������������������������������������������������������������������������������������0000644�����������������00000002407�14763166030�0007171 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2001,2002,2003,2005,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* Define the machine-dependent type `jmp_buf'. x86-64 version. */ #ifndef _BITS_SETJMP_H #define _BITS_SETJMP_H 1 #if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif #include <bits/wordsize.h> #ifndef _ASM # if __WORDSIZE == 64 typedef long int __jmp_buf[8]; # elif defined __x86_64__ typedef long long int __jmp_buf[8]; # else typedef int __jmp_buf[6]; # endif #endif #endif /* bits/setjmp.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/fcntl-linux.h����������������������������������������������������������������������������������0000644�����������������00000031070�14763166030�0010130 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* O_*, F_*, FD_* bit values for Linux. Copyright (C) 2001-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _FCNTL_H # error "Never use <bits/fcntl-linux.h> directly; include <fcntl.h> instead." #endif /* This file contains shared definitions between Linux architectures and is included by <bits/fcntl.h> to declare them. The various #ifndef cases allow the architecture specific file to define those values with different values. A minimal <bits/fcntl.h> contains just: struct flock {...} #ifdef __USE_LARGEFILE64 struct flock64 {...} #endif #include <bits/fcntl-linux.h> */ #ifdef __USE_GNU # include <bits/uio.h> #endif /* open/fcntl. */ #define O_ACCMODE 0003 #define O_RDONLY 00 #define O_WRONLY 01 #define O_RDWR 02 #ifndef O_CREAT # define O_CREAT 0100 /* Not fcntl. */ #endif #ifndef O_EXCL # define O_EXCL 0200 /* Not fcntl. */ #endif #ifndef O_NOCTTY # define O_NOCTTY 0400 /* Not fcntl. */ #endif #ifndef O_TRUNC # define O_TRUNC 01000 /* Not fcntl. */ #endif #ifndef O_APPEND # define O_APPEND 02000 #endif #ifndef O_NONBLOCK # define O_NONBLOCK 04000 #endif #ifndef O_NDELAY # define O_NDELAY O_NONBLOCK #endif #ifndef O_SYNC # define O_SYNC 04010000 #endif #define O_FSYNC O_SYNC #ifndef O_ASYNC # define O_ASYNC 020000 #endif #ifndef __O_LARGEFILE # define __O_LARGEFILE 0100000 #endif #ifndef __O_DIRECTORY # define __O_DIRECTORY 0200000 #endif #ifndef __O_NOFOLLOW # define __O_NOFOLLOW 0400000 #endif #ifndef __O_CLOEXEC # define __O_CLOEXEC 02000000 #endif #ifndef __O_DIRECT # define __O_DIRECT 040000 #endif #ifndef __O_NOATIME # define __O_NOATIME 01000000 #endif #ifndef __O_PATH # define __O_PATH 010000000 #endif #ifndef __O_DSYNC # define __O_DSYNC 010000 #endif #ifndef __O_TMPFILE # define __O_TMPFILE (020000000 | __O_DIRECTORY) #endif #ifndef F_GETLK # ifndef __USE_FILE_OFFSET64 # define F_GETLK 5 /* Get record locking info. */ # define F_SETLK 6 /* Set record locking info (non-blocking). */ # define F_SETLKW 7 /* Set record locking info (blocking). */ # else # define F_GETLK F_GETLK64 /* Get record locking info. */ # define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/ # define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */ # endif #endif #ifndef F_GETLK64 # define F_GETLK64 12 /* Get record locking info. */ # define F_SETLK64 13 /* Set record locking info (non-blocking). */ # define F_SETLKW64 14 /* Set record locking info (blocking). */ #endif #ifdef __USE_FILE_OFFSET64 /* open file description locks. Usually record locks held by a process are released on *any* close and are not inherited across a fork. These cmd values will set locks that conflict with process-associated record locks, but are "owned" by the opened file description, not the process. This means that they are inherited across fork or clone with CLONE_FILES like BSD (flock) locks, and they are only released automatically when the last reference to the the file description against which they were acquired is put. */ #ifdef __USE_GNU # define F_OFD_GETLK 36 # define F_OFD_SETLK 37 # define F_OFD_SETLKW 38 #endif #endif #ifdef __USE_LARGEFILE64 # define O_LARGEFILE __O_LARGEFILE #endif #ifdef __USE_XOPEN2K8 # define O_DIRECTORY __O_DIRECTORY /* Must be a directory. */ # define O_NOFOLLOW __O_NOFOLLOW /* Do not follow links. */ # define O_CLOEXEC __O_CLOEXEC /* Set close_on_exec. */ #endif #ifdef __USE_GNU # define O_DIRECT __O_DIRECT /* Direct disk access. */ # define O_NOATIME __O_NOATIME /* Do not set atime. */ # define O_PATH __O_PATH /* Resolve pathname but do not open file. */ # define O_TMPFILE __O_TMPFILE /* Atomically create nameless file. */ #endif /* For now, Linux has no separate synchronicitiy options for read operations. We define O_RSYNC therefore as the same as O_SYNC since this is a superset. */ #if defined __USE_POSIX199309 || defined __USE_UNIX98 # define O_DSYNC __O_DSYNC /* Synchronize data. */ # if defined __O_RSYNC # define O_RSYNC __O_RSYNC /* Synchronize read operations. */ # else # define O_RSYNC O_SYNC /* Synchronize read operations. */ # endif #endif /* Values for the second argument to `fcntl'. */ #define F_DUPFD 0 /* Duplicate file descriptor. */ #define F_GETFD 1 /* Get file descriptor flags. */ #define F_SETFD 2 /* Set file descriptor flags. */ #define F_GETFL 3 /* Get file status flags. */ #define F_SETFL 4 /* Set file status flags. */ #ifndef __F_SETOWN # define __F_SETOWN 8 # define __F_GETOWN 9 #endif #if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8 # define F_SETOWN __F_SETOWN /* Get owner (process receiving SIGIO). */ # define F_GETOWN __F_GETOWN /* Set owner (process receiving SIGIO). */ #endif #ifndef __F_SETSIG # define __F_SETSIG 10 /* Set number of signal to be sent. */ # define __F_GETSIG 11 /* Get number of signal to be sent. */ #endif #ifndef __F_SETOWN_EX # define __F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */ # define __F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */ #endif #ifdef __USE_GNU # define F_SETSIG __F_SETSIG /* Set number of signal to be sent. */ # define F_GETSIG __F_GETSIG /* Get number of signal to be sent. */ # define F_SETOWN_EX __F_SETOWN_EX /* Get owner (thread receiving SIGIO). */ # define F_GETOWN_EX __F_GETOWN_EX /* Set owner (thread receiving SIGIO). */ #endif #ifdef __USE_GNU # define F_SETLEASE 1024 /* Set a lease. */ # define F_GETLEASE 1025 /* Enquire what lease is active. */ # define F_NOTIFY 1026 /* Request notifications on a directory. */ # define F_SETPIPE_SZ 1031 /* Set pipe page size array. */ # define F_GETPIPE_SZ 1032 /* Set pipe page size array. */ #endif #ifdef __USE_XOPEN2K8 # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with close-on-exit set. */ #endif /* For F_[GET|SET]FD. */ #define FD_CLOEXEC 1 /* Actually anything with low bit set goes */ #ifndef F_RDLCK /* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ # define F_RDLCK 0 /* Read lock. */ # define F_WRLCK 1 /* Write lock. */ # define F_UNLCK 2 /* Remove lock. */ #endif /* For old implementation of BSD flock. */ #ifndef F_EXLCK # define F_EXLCK 4 /* or 3 */ # define F_SHLCK 8 /* or 4 */ #endif #ifdef __USE_BSD /* Operations for BSD flock, also used by the kernel implementation. */ # define LOCK_SH 1 /* Shared lock. */ # define LOCK_EX 2 /* Exclusive lock. */ # define LOCK_NB 4 /* Or'd with one of the above to prevent blocking. */ # define LOCK_UN 8 /* Remove lock. */ #endif #ifdef __USE_GNU # define LOCK_MAND 32 /* This is a mandatory flock: */ # define LOCK_READ 64 /* ... which allows concurrent read operations. */ # define LOCK_WRITE 128 /* ... which allows concurrent write operations. */ # define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */ #endif #ifdef __USE_GNU /* Types of directory notifications that may be requested with F_NOTIFY. */ # define DN_ACCESS 0x00000001 /* File accessed. */ # define DN_MODIFY 0x00000002 /* File modified. */ # define DN_CREATE 0x00000004 /* File created. */ # define DN_DELETE 0x00000008 /* File removed. */ # define DN_RENAME 0x00000010 /* File renamed. */ # define DN_ATTRIB 0x00000020 /* File changed attributes. */ # define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */ #endif #ifdef __USE_GNU /* Owner types. */ enum __pid_type { F_OWNER_TID = 0, /* Kernel thread. */ F_OWNER_PID, /* Process. */ F_OWNER_PGRP, /* Process group. */ F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */ }; /* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */ struct f_owner_ex { enum __pid_type type; /* Owner type of ID. */ __pid_t pid; /* ID of owner. */ }; #endif /* Define some more compatibility macros to be backward compatible with BSD systems which did not managed to hide these kernel macros. */ #ifdef __USE_BSD # define FAPPEND O_APPEND # define FFSYNC O_FSYNC # define FASYNC O_ASYNC # define FNONBLOCK O_NONBLOCK # define FNDELAY O_NDELAY #endif /* Use BSD. */ #ifndef __POSIX_FADV_DONTNEED # define __POSIX_FADV_DONTNEED 4 # define __POSIX_FADV_NOREUSE 5 #endif /* Advise to `posix_fadvise'. */ #ifdef __USE_XOPEN2K # define POSIX_FADV_NORMAL 0 /* No further special treatment. */ # define POSIX_FADV_RANDOM 1 /* Expect random page references. */ # define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ # define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ # define POSIX_FADV_DONTNEED __POSIX_FADV_DONTNEED /* Don't need these pages. */ # define POSIX_FADV_NOREUSE __POSIX_FADV_NOREUSE /* Data will be accessed once. */ #endif #ifdef __USE_GNU /* Flags for SYNC_FILE_RANGE. */ # define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages in the range before performing the write. */ # define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those dirty pages in the range which are not presently under writeback. */ # define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in the range after performing the write. */ /* Flags for SPLICE and VMSPLICE. */ # define SPLICE_F_MOVE 1 /* Move pages instead of copying. */ # define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing (but we may still block on the fd we splice from/to). */ # define SPLICE_F_MORE 4 /* Expect more data. */ # define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */ /* Flags for fallocate. */ # include <linux/falloc.h> /* File handle structure. */ struct file_handle { unsigned int handle_bytes; int handle_type; /* File identifier. */ unsigned char f_handle[0]; }; /* Maximum handle size (for now). */ # define MAX_HANDLE_SZ 128 #endif __BEGIN_DECLS #ifdef __USE_GNU /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; /* Selective file content synch'ing. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count, unsigned int __flags); /* Splice address range into a pipe. This function is a possible cancellation point and therefore not marked with __THROW. */ extern ssize_t vmsplice (int __fdout, const struct iovec *__iov, size_t __count, unsigned int __flags); /* Splice two files together. This function is a possible cancellation point and therefore not marked with __THROW. */ extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout, __off64_t *__offout, size_t __len, unsigned int __flags); /* In-kernel implementation of tee for pipe buffers. This function is a possible cancellation point and therefore not marked with __THROW. */ extern ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); /* Reserve storage for the data of the file associated with FD. This function is a possible cancellation point and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len); # else # ifdef __REDIRECT extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset, __off64_t __len), fallocate64); # else # define fallocate fallocate64 # endif # endif # ifdef __USE_LARGEFILE64 extern int fallocate64 (int __fd, int __mode, __off64_t __offset, __off64_t __len); # endif /* Map file name to file handle. */ extern int name_to_handle_at (int __dfd, const char *__name, struct file_handle *__handle, int *__mnt_id, int __flags) __THROW; /* Open file using the file handle. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle, int __flags); #endif /* use GNU */ __END_DECLS ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/huge_vall.h������������������������������������������������������������������������������������0000644�����������������00000003110�14763166030�0007625 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* `HUGE_VALL' constant for ix86 (where it is infinity). Used by <stdlib.h> and <math.h> functions for overflow. Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never use <bits/huge_vall.h> directly; include <math.h> instead." #endif #if __GNUC_PREREQ(3,3) # define HUGE_VALL (__builtin_huge_vall()) #elif __GNUC_PREREQ(2,96) # define HUGE_VALL (__extension__ 0x1.0p32767L) #else # define __HUGE_VALL_bytes { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0x7f, 0, 0 } # define __huge_vall_t union { unsigned char __c[12]; long double __ld; } # ifdef __GNUC__ # define HUGE_VALL (__extension__ \ ((__huge_vall_t) { __c: __HUGE_VALL_bytes }).__ld) # else /* Not GCC. */ static __huge_vall_t __huge_vall = { __HUGE_VALL_bytes }; # define HUGE_VALL (__huge_vall.__ld) # endif /* GCC. */ #endif /* GCC 2.95 */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/wchar2.h���������������������������������������������������������������������������������������0000644�����������������00000050054�14763166030�0007056 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Checking macros for wchar functions. Copyright (C) 2005, 2006, 2007, 2010, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _WCHAR_H # error "Never include <bits/wchar2.h> directly; use <wchar.h> instead." #endif extern wchar_t *__wmemcpy_chk (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n, size_t __ns1) __THROW; extern wchar_t *__REDIRECT_NTH (__wmemcpy_alias, (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n), wmemcpy); extern wchar_t *__REDIRECT_NTH (__wmemcpy_chk_warn, (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n, size_t __ns1), __wmemcpy_chk) __warnattr ("wmemcpy called with length bigger than size of destination " "buffer"); __fortify_function wchar_t * __NTH (wmemcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n)) { if (__bos0 (__s1) != (size_t) -1) { if (!__builtin_constant_p (__n)) return __wmemcpy_chk (__s1, __s2, __n, __bos0 (__s1) / sizeof (wchar_t)); if (__n > __bos0 (__s1) / sizeof (wchar_t)) return __wmemcpy_chk_warn (__s1, __s2, __n, __bos0 (__s1) / sizeof (wchar_t)); } return __wmemcpy_alias (__s1, __s2, __n); } extern wchar_t *__wmemmove_chk (wchar_t *__s1, const wchar_t *__s2, size_t __n, size_t __ns1) __THROW; extern wchar_t *__REDIRECT_NTH (__wmemmove_alias, (wchar_t *__s1, const wchar_t *__s2, size_t __n), wmemmove); extern wchar_t *__REDIRECT_NTH (__wmemmove_chk_warn, (wchar_t *__s1, const wchar_t *__s2, size_t __n, size_t __ns1), __wmemmove_chk) __warnattr ("wmemmove called with length bigger than size of destination " "buffer"); __fortify_function wchar_t * __NTH (wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n)) { if (__bos0 (__s1) != (size_t) -1) { if (!__builtin_constant_p (__n)) return __wmemmove_chk (__s1, __s2, __n, __bos0 (__s1) / sizeof (wchar_t)); if (__n > __bos0 (__s1) / sizeof (wchar_t)) return __wmemmove_chk_warn (__s1, __s2, __n, __bos0 (__s1) / sizeof (wchar_t)); } return __wmemmove_alias (__s1, __s2, __n); } #ifdef __USE_GNU extern wchar_t *__wmempcpy_chk (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n, size_t __ns1) __THROW; extern wchar_t *__REDIRECT_NTH (__wmempcpy_alias, (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n), wmempcpy); extern wchar_t *__REDIRECT_NTH (__wmempcpy_chk_warn, (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n, size_t __ns1), __wmempcpy_chk) __warnattr ("wmempcpy called with length bigger than size of destination " "buffer"); __fortify_function wchar_t * __NTH (wmempcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n)) { if (__bos0 (__s1) != (size_t) -1) { if (!__builtin_constant_p (__n)) return __wmempcpy_chk (__s1, __s2, __n, __bos0 (__s1) / sizeof (wchar_t)); if (__n > __bos0 (__s1) / sizeof (wchar_t)) return __wmempcpy_chk_warn (__s1, __s2, __n, __bos0 (__s1) / sizeof (wchar_t)); } return __wmempcpy_alias (__s1, __s2, __n); } #endif extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n, size_t __ns) __THROW; extern wchar_t *__REDIRECT_NTH (__wmemset_alias, (wchar_t *__s, wchar_t __c, size_t __n), wmemset); extern wchar_t *__REDIRECT_NTH (__wmemset_chk_warn, (wchar_t *__s, wchar_t __c, size_t __n, size_t __ns), __wmemset_chk) __warnattr ("wmemset called with length bigger than size of destination " "buffer"); __fortify_function wchar_t * __NTH (wmemset (wchar_t *__s, wchar_t __c, size_t __n)) { if (__bos0 (__s) != (size_t) -1) { if (!__builtin_constant_p (__n)) return __wmemset_chk (__s, __c, __n, __bos0 (__s) / sizeof (wchar_t)); if (__n > __bos0 (__s) / sizeof (wchar_t)) return __wmemset_chk_warn (__s, __c, __n, __bos0 (__s) / sizeof (wchar_t)); } return __wmemset_alias (__s, __c, __n); } extern wchar_t *__wcscpy_chk (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n) __THROW; extern wchar_t *__REDIRECT_NTH (__wcscpy_alias, (wchar_t *__restrict __dest, const wchar_t *__restrict __src), wcscpy); __fortify_function wchar_t * __NTH (wcscpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src)) { if (__bos (__dest) != (size_t) -1) return __wcscpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); return __wcscpy_alias (__dest, __src); } extern wchar_t *__wcpcpy_chk (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __destlen) __THROW; extern wchar_t *__REDIRECT_NTH (__wcpcpy_alias, (wchar_t *__restrict __dest, const wchar_t *__restrict __src), wcpcpy); __fortify_function wchar_t * __NTH (wcpcpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src)) { if (__bos (__dest) != (size_t) -1) return __wcpcpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); return __wcpcpy_alias (__dest, __src); } extern wchar_t *__wcsncpy_chk (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n, size_t __destlen) __THROW; extern wchar_t *__REDIRECT_NTH (__wcsncpy_alias, (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n), wcsncpy); extern wchar_t *__REDIRECT_NTH (__wcsncpy_chk_warn, (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n, size_t __destlen), __wcsncpy_chk) __warnattr ("wcsncpy called with length bigger than size of destination " "buffer"); __fortify_function wchar_t * __NTH (wcsncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n)) { if (__bos (__dest) != (size_t) -1) { if (!__builtin_constant_p (__n)) return __wcsncpy_chk (__dest, __src, __n, __bos (__dest) / sizeof (wchar_t)); if (__n > __bos (__dest) / sizeof (wchar_t)) return __wcsncpy_chk_warn (__dest, __src, __n, __bos (__dest) / sizeof (wchar_t)); } return __wcsncpy_alias (__dest, __src, __n); } extern wchar_t *__wcpncpy_chk (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n, size_t __destlen) __THROW; extern wchar_t *__REDIRECT_NTH (__wcpncpy_alias, (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n), wcpncpy); extern wchar_t *__REDIRECT_NTH (__wcpncpy_chk_warn, (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n, size_t __destlen), __wcpncpy_chk) __warnattr ("wcpncpy called with length bigger than size of destination " "buffer"); __fortify_function wchar_t * __NTH (wcpncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n)) { if (__bos (__dest) != (size_t) -1) { if (!__builtin_constant_p (__n)) return __wcpncpy_chk (__dest, __src, __n, __bos (__dest) / sizeof (wchar_t)); if (__n > __bos (__dest) / sizeof (wchar_t)) return __wcpncpy_chk_warn (__dest, __src, __n, __bos (__dest) / sizeof (wchar_t)); } return __wcpncpy_alias (__dest, __src, __n); } extern wchar_t *__wcscat_chk (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __destlen) __THROW; extern wchar_t *__REDIRECT_NTH (__wcscat_alias, (wchar_t *__restrict __dest, const wchar_t *__restrict __src), wcscat); __fortify_function wchar_t * __NTH (wcscat (wchar_t *__restrict __dest, const wchar_t *__restrict __src)) { if (__bos (__dest) != (size_t) -1) return __wcscat_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); return __wcscat_alias (__dest, __src); } extern wchar_t *__wcsncat_chk (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n, size_t __destlen) __THROW; extern wchar_t *__REDIRECT_NTH (__wcsncat_alias, (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n), wcsncat); __fortify_function wchar_t * __NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n)) { if (__bos (__dest) != (size_t) -1) return __wcsncat_chk (__dest, __src, __n, __bos (__dest) / sizeof (wchar_t)); return __wcsncat_alias (__dest, __src, __n); } extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n, int __flag, size_t __s_len, const wchar_t *__restrict __format, ...) __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */; extern int __REDIRECT_NTH_LDBL (__swprintf_alias, (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __fmt, ...), swprintf); #ifdef __va_arg_pack __fortify_function int __NTH (swprintf (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __fmt, ...)) { if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1) return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, __bos (__s) / sizeof (wchar_t), __fmt, __va_arg_pack ()); return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ()); } #elif !defined __cplusplus /* XXX We might want to have support in gcc for swprintf. */ # define swprintf(s, n, ...) \ (__bos (s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1 \ ? __swprintf_chk (s, n, __USE_FORTIFY_LEVEL - 1, \ __bos (s) / sizeof (wchar_t), __VA_ARGS__) \ : swprintf (s, n, __VA_ARGS__)) #endif extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n, int __flag, size_t __s_len, const wchar_t *__restrict __format, __gnuc_va_list __arg) __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */; extern int __REDIRECT_NTH_LDBL (__vswprintf_alias, (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __fmt, __gnuc_va_list __ap), vswprintf); __fortify_function int __NTH (vswprintf (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __fmt, __gnuc_va_list __ap)) { if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1) return __vswprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, __bos (__s) / sizeof (wchar_t), __fmt, __ap); return __vswprintf_alias (__s, __n, __fmt, __ap); } #if __USE_FORTIFY_LEVEL > 1 extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag, const wchar_t *__restrict __format, ...); extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format, ...); extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag, const wchar_t *__restrict __format, __gnuc_va_list __ap); extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format, __gnuc_va_list __ap); # ifdef __va_arg_pack __fortify_function int wprintf (const wchar_t *__restrict __fmt, ...) { return __wprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); } __fortify_function int fwprintf (__FILE *__restrict __stream, const wchar_t *__restrict __fmt, ...) { return __fwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); } # elif !defined __cplusplus # define wprintf(...) \ __wprintf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__) # define fwprintf(stream, ...) \ __fwprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) # endif __fortify_function int vwprintf (const wchar_t *__restrict __fmt, __gnuc_va_list __ap) { return __vwprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __ap); } __fortify_function int vfwprintf (__FILE *__restrict __stream, const wchar_t *__restrict __fmt, __gnuc_va_list __ap) { return __vfwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } #endif extern wchar_t *__fgetws_chk (wchar_t *__restrict __s, size_t __size, int __n, __FILE *__restrict __stream) __wur; extern wchar_t *__REDIRECT (__fgetws_alias, (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream), fgetws) __wur; extern wchar_t *__REDIRECT (__fgetws_chk_warn, (wchar_t *__restrict __s, size_t __size, int __n, __FILE *__restrict __stream), __fgetws_chk) __wur __warnattr ("fgetws called with bigger size than length " "of destination buffer"); __fortify_function __wur wchar_t * fgetws (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream) { if (__bos (__s) != (size_t) -1) { if (!__builtin_constant_p (__n) || __n <= 0) return __fgetws_chk (__s, __bos (__s) / sizeof (wchar_t), __n, __stream); if ((size_t) __n > __bos (__s) / sizeof (wchar_t)) return __fgetws_chk_warn (__s, __bos (__s) / sizeof (wchar_t), __n, __stream); } return __fgetws_alias (__s, __n, __stream); } #ifdef __USE_GNU extern wchar_t *__fgetws_unlocked_chk (wchar_t *__restrict __s, size_t __size, int __n, __FILE *__restrict __stream) __wur; extern wchar_t *__REDIRECT (__fgetws_unlocked_alias, (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream), fgetws_unlocked) __wur; extern wchar_t *__REDIRECT (__fgetws_unlocked_chk_warn, (wchar_t *__restrict __s, size_t __size, int __n, __FILE *__restrict __stream), __fgetws_unlocked_chk) __wur __warnattr ("fgetws_unlocked called with bigger size than length " "of destination buffer"); __fortify_function __wur wchar_t * fgetws_unlocked (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream) { if (__bos (__s) != (size_t) -1) { if (!__builtin_constant_p (__n) || __n <= 0) return __fgetws_unlocked_chk (__s, __bos (__s) / sizeof (wchar_t), __n, __stream); if ((size_t) __n > __bos (__s) / sizeof (wchar_t)) return __fgetws_unlocked_chk_warn (__s, __bos (__s) / sizeof (wchar_t), __n, __stream); } return __fgetws_unlocked_alias (__s, __n, __stream); } #endif extern size_t __wcrtomb_chk (char *__restrict __s, wchar_t __wchar, mbstate_t *__restrict __p, size_t __buflen) __THROW __wur; extern size_t __REDIRECT_NTH (__wcrtomb_alias, (char *__restrict __s, wchar_t __wchar, mbstate_t *__restrict __ps), wcrtomb) __wur; __fortify_function __wur size_t __NTH (wcrtomb (char *__restrict __s, wchar_t __wchar, mbstate_t *__restrict __ps)) { /* We would have to include <limits.h> to get a definition of MB_LEN_MAX. But this would only disturb the namespace. So we define our own version here. */ #define __WCHAR_MB_LEN_MAX 16 #if defined MB_LEN_MAX && MB_LEN_MAX != __WCHAR_MB_LEN_MAX # error "Assumed value of MB_LEN_MAX wrong" #endif if (__bos (__s) != (size_t) -1 && __WCHAR_MB_LEN_MAX > __bos (__s)) return __wcrtomb_chk (__s, __wchar, __ps, __bos (__s)); return __wcrtomb_alias (__s, __wchar, __ps); } extern size_t __mbsrtowcs_chk (wchar_t *__restrict __dst, const char **__restrict __src, size_t __len, mbstate_t *__restrict __ps, size_t __dstlen) __THROW; extern size_t __REDIRECT_NTH (__mbsrtowcs_alias, (wchar_t *__restrict __dst, const char **__restrict __src, size_t __len, mbstate_t *__restrict __ps), mbsrtowcs); extern size_t __REDIRECT_NTH (__mbsrtowcs_chk_warn, (wchar_t *__restrict __dst, const char **__restrict __src, size_t __len, mbstate_t *__restrict __ps, size_t __dstlen), __mbsrtowcs_chk) __warnattr ("mbsrtowcs called with dst buffer smaller than len " "* sizeof (wchar_t)"); __fortify_function size_t __NTH (mbsrtowcs (wchar_t *__restrict __dst, const char **__restrict __src, size_t __len, mbstate_t *__restrict __ps)) { if (__bos (__dst) != (size_t) -1) { if (!__builtin_constant_p (__len)) return __mbsrtowcs_chk (__dst, __src, __len, __ps, __bos (__dst) / sizeof (wchar_t)); if (__len > __bos (__dst) / sizeof (wchar_t)) return __mbsrtowcs_chk_warn (__dst, __src, __len, __ps, __bos (__dst) / sizeof (wchar_t)); } return __mbsrtowcs_alias (__dst, __src, __len, __ps); } extern size_t __wcsrtombs_chk (char *__restrict __dst, const wchar_t **__restrict __src, size_t __len, mbstate_t *__restrict __ps, size_t __dstlen) __THROW; extern size_t __REDIRECT_NTH (__wcsrtombs_alias, (char *__restrict __dst, const wchar_t **__restrict __src, size_t __len, mbstate_t *__restrict __ps), wcsrtombs); extern size_t __REDIRECT_NTH (__wcsrtombs_chk_warn, (char *__restrict __dst, const wchar_t **__restrict __src, size_t __len, mbstate_t *__restrict __ps, size_t __dstlen), __wcsrtombs_chk) __warnattr ("wcsrtombs called with dst buffer smaller than len"); __fortify_function size_t __NTH (wcsrtombs (char *__restrict __dst, const wchar_t **__restrict __src, size_t __len, mbstate_t *__restrict __ps)) { if (__bos (__dst) != (size_t) -1) { if (!__builtin_constant_p (__len)) return __wcsrtombs_chk (__dst, __src, __len, __ps, __bos (__dst)); if (__len > __bos (__dst)) return __wcsrtombs_chk_warn (__dst, __src, __len, __ps, __bos (__dst)); } return __wcsrtombs_alias (__dst, __src, __len, __ps); } #ifdef __USE_GNU extern size_t __mbsnrtowcs_chk (wchar_t *__restrict __dst, const char **__restrict __src, size_t __nmc, size_t __len, mbstate_t *__restrict __ps, size_t __dstlen) __THROW; extern size_t __REDIRECT_NTH (__mbsnrtowcs_alias, (wchar_t *__restrict __dst, const char **__restrict __src, size_t __nmc, size_t __len, mbstate_t *__restrict __ps), mbsnrtowcs); extern size_t __REDIRECT_NTH (__mbsnrtowcs_chk_warn, (wchar_t *__restrict __dst, const char **__restrict __src, size_t __nmc, size_t __len, mbstate_t *__restrict __ps, size_t __dstlen), __mbsnrtowcs_chk) __warnattr ("mbsnrtowcs called with dst buffer smaller than len " "* sizeof (wchar_t)"); __fortify_function size_t __NTH (mbsnrtowcs (wchar_t *__restrict __dst, const char **__restrict __src, size_t __nmc, size_t __len, mbstate_t *__restrict __ps)) { if (__bos (__dst) != (size_t) -1) { if (!__builtin_constant_p (__len)) return __mbsnrtowcs_chk (__dst, __src, __nmc, __len, __ps, __bos (__dst) / sizeof (wchar_t)); if (__len > __bos (__dst) / sizeof (wchar_t)) return __mbsnrtowcs_chk_warn (__dst, __src, __nmc, __len, __ps, __bos (__dst) / sizeof (wchar_t)); } return __mbsnrtowcs_alias (__dst, __src, __nmc, __len, __ps); } extern size_t __wcsnrtombs_chk (char *__restrict __dst, const wchar_t **__restrict __src, size_t __nwc, size_t __len, mbstate_t *__restrict __ps, size_t __dstlen) __THROW; extern size_t __REDIRECT_NTH (__wcsnrtombs_alias, (char *__restrict __dst, const wchar_t **__restrict __src, size_t __nwc, size_t __len, mbstate_t *__restrict __ps), wcsnrtombs); extern size_t __REDIRECT_NTH (__wcsnrtombs_chk_warn, (char *__restrict __dst, const wchar_t **__restrict __src, size_t __nwc, size_t __len, mbstate_t *__restrict __ps, size_t __dstlen), __wcsnrtombs_chk) __warnattr ("wcsnrtombs called with dst buffer smaller than len"); __fortify_function size_t __NTH (wcsnrtombs (char *__restrict __dst, const wchar_t **__restrict __src, size_t __nwc, size_t __len, mbstate_t *__restrict __ps)) { if (__bos (__dst) != (size_t) -1) { if (!__builtin_constant_p (__len)) return __wcsnrtombs_chk (__dst, __src, __nwc, __len, __ps, __bos (__dst)); if (__len > __bos (__dst)) return __wcsnrtombs_chk_warn (__dst, __src, __nwc, __len, __ps, __bos (__dst)); } return __wcsnrtombs_alias (__dst, __src, __nwc, __len, __ps); } #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/ioctl-types.h����������������������������������������������������������������������������������0000644�����������������00000004644�14763166030�0010150 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Structure types for pre-termios terminal ioctls. Linux version. Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_IOCTL_H # error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead." #endif /* Get definition of constants for use with `ioctl'. */ #include <asm/ioctls.h> struct winsize { unsigned short int ws_row; unsigned short int ws_col; unsigned short int ws_xpixel; unsigned short int ws_ypixel; }; #define NCC 8 struct termio { unsigned short int c_iflag; /* input mode flags */ unsigned short int c_oflag; /* output mode flags */ unsigned short int c_cflag; /* control mode flags */ unsigned short int c_lflag; /* local mode flags */ unsigned char c_line; /* line discipline */ unsigned char c_cc[NCC]; /* control characters */ }; /* modem lines */ #define TIOCM_LE 0x001 #define TIOCM_DTR 0x002 #define TIOCM_RTS 0x004 #define TIOCM_ST 0x008 #define TIOCM_SR 0x010 #define TIOCM_CTS 0x020 #define TIOCM_CAR 0x040 #define TIOCM_RNG 0x080 #define TIOCM_DSR 0x100 #define TIOCM_CD TIOCM_CAR #define TIOCM_RI TIOCM_RNG /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ /* line disciplines */ #define N_TTY 0 #define N_SLIP 1 #define N_MOUSE 2 #define N_PPP 3 #define N_STRIP 4 #define N_AX25 5 #define N_X25 6 /* X.25 async */ #define N_6PACK 7 #define N_MASC 8 /* Mobitex module */ #define N_R3964 9 /* Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Profibus */ #define N_IRDA 11 /* Linux IR */ #define N_SMSBLOCK 12 /* SMS block mode */ #define N_HDLC 13 /* synchronous HDLC */ #define N_SYNC_PPP 14 /* synchronous PPP */ #define N_HCI 15 /* Bluetooth HCI UART */ ��������������������������������������������������������������������������������������������bits/libio-ldbl.h�����������������������������������������������������������������������������������0000644�����������������00000001766�14763166030�0007707 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -mlong-double-64 compatibility mode for libio functions. Copyright (C) 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _IO_STDIO_H # error "Never include <bits/libio-ldbl.h> directly; use <libio.h> instead." #endif __LDBL_REDIR_DECL (_IO_vfscanf) __LDBL_REDIR_DECL (_IO_vfprintf) ����������bits/sigcontext.h�����������������������������������������������������������������������������������0000644�����������������00000010116�14763166030�0010052 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2002-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_SIGCONTEXT_H #define _BITS_SIGCONTEXT_H 1 #if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H # error "Never use <bits/sigcontext.h> directly; include <signal.h> instead." #endif #define FP_XSTATE_MAGIC1 0x46505853U #define FP_XSTATE_MAGIC2 0x46505845U #define FP_XSTATE_MAGIC2_SIZE sizeof(FP_XSTATE_MAGIC2) struct _fpx_sw_bytes { __uint32_t magic1; __uint32_t extended_size; __uint64_t xstate_bv; __uint32_t xstate_size; __uint32_t padding[7]; }; struct _fpreg { unsigned short significand[4]; unsigned short exponent; }; struct _fpxreg { unsigned short significand[4]; unsigned short exponent; unsigned short padding[3]; }; struct _xmmreg { __uint32_t element[4]; }; #ifndef __x86_64__ struct _fpstate { /* Regular FPU environment. */ __uint32_t cw; __uint32_t sw; __uint32_t tag; __uint32_t ipoff; __uint32_t cssel; __uint32_t dataoff; __uint32_t datasel; struct _fpreg _st[8]; unsigned short status; unsigned short magic; /* FXSR FPU environment. */ __uint32_t _fxsr_env[6]; __uint32_t mxcsr; __uint32_t reserved; struct _fpxreg _fxsr_st[8]; struct _xmmreg _xmm[8]; __uint32_t padding[56]; }; #ifndef sigcontext_struct /* Kernel headers before 2.1.1 define a struct sigcontext_struct, but we need sigcontext. Some packages have come to rely on sigcontext_struct being defined on 32-bit x86, so define this for their benefit. */ # define sigcontext_struct sigcontext #endif #define X86_FXSR_MAGIC 0x0000 struct sigcontext { unsigned short gs, __gsh; unsigned short fs, __fsh; unsigned short es, __esh; unsigned short ds, __dsh; unsigned long edi; unsigned long esi; unsigned long ebp; unsigned long esp; unsigned long ebx; unsigned long edx; unsigned long ecx; unsigned long eax; unsigned long trapno; unsigned long err; unsigned long eip; unsigned short cs, __csh; unsigned long eflags; unsigned long esp_at_signal; unsigned short ss, __ssh; struct _fpstate * fpstate; unsigned long oldmask; unsigned long cr2; }; #else /* __x86_64__ */ struct _fpstate { /* FPU environment matching the 64-bit FXSAVE layout. */ __uint16_t cwd; __uint16_t swd; __uint16_t ftw; __uint16_t fop; __uint64_t rip; __uint64_t rdp; __uint32_t mxcsr; __uint32_t mxcr_mask; struct _fpxreg _st[8]; struct _xmmreg _xmm[16]; __uint32_t padding[24]; }; struct sigcontext { __uint64_t r8; __uint64_t r9; __uint64_t r10; __uint64_t r11; __uint64_t r12; __uint64_t r13; __uint64_t r14; __uint64_t r15; __uint64_t rdi; __uint64_t rsi; __uint64_t rbp; __uint64_t rbx; __uint64_t rdx; __uint64_t rax; __uint64_t rcx; __uint64_t rsp; __uint64_t rip; __uint64_t eflags; unsigned short cs; unsigned short gs; unsigned short fs; unsigned short __pad0; __uint64_t err; __uint64_t trapno; __uint64_t oldmask; __uint64_t cr2; __extension__ union { struct _fpstate * fpstate; __uint64_t __fpstate_word; }; __uint64_t __reserved1 [8]; }; #endif /* __x86_64__ */ struct _xsave_hdr { __uint64_t xstate_bv; __uint64_t reserved1[2]; __uint64_t reserved2[5]; }; struct _ymmh_state { __uint32_t ymmh_space[64]; }; struct _xstate { struct _fpstate fpstate; struct _xsave_hdr xstate_hdr; struct _ymmh_state ymmh; }; #endif /* _BITS_SIGCONTEXT_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/local_lim.h������������������������������������������������������������������������������������0000644�����������������00000006204�14763166030�0007621 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Minimum guaranteed maximum values for system limits. Linux version. Copyright (C) 1993-1998,2000,2002-2004,2008 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; see the file COPYING.LIB. If not, see <http://www.gnu.org/licenses/>. */ /* The kernel header pollutes the namespace with the NR_OPEN symbol and defines LINK_MAX although filesystems have different maxima. A similar thing is true for OPEN_MAX: the limit can be changed at runtime and therefore the macro must not be defined. Remove this after including the header if necessary. */ #ifndef NR_OPEN # define __undef_NR_OPEN #endif #ifndef LINK_MAX # define __undef_LINK_MAX #endif #ifndef OPEN_MAX # define __undef_OPEN_MAX #endif #ifndef ARG_MAX # define __undef_ARG_MAX #endif /* The kernel sources contain a file with all the needed information. */ #include <linux/limits.h> /* Have to remove NR_OPEN? */ #ifdef __undef_NR_OPEN # undef NR_OPEN # undef __undef_NR_OPEN #endif /* Have to remove LINK_MAX? */ #ifdef __undef_LINK_MAX # undef LINK_MAX # undef __undef_LINK_MAX #endif /* Have to remove OPEN_MAX? */ #ifdef __undef_OPEN_MAX # undef OPEN_MAX # undef __undef_OPEN_MAX #endif /* Have to remove ARG_MAX? */ #ifdef __undef_ARG_MAX # undef ARG_MAX # undef __undef_ARG_MAX #endif /* The number of data keys per process. */ #define _POSIX_THREAD_KEYS_MAX 128 /* This is the value this implementation supports. */ #define PTHREAD_KEYS_MAX 1024 /* Controlling the iterations of destructors for thread-specific data. */ #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 /* Number of iterations this implementation does. */ #define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS /* The number of threads per process. */ #define _POSIX_THREAD_THREADS_MAX 64 /* We have no predefined limit on the number of threads. */ #undef PTHREAD_THREADS_MAX /* Maximum amount by which a process can descrease its asynchronous I/O priority level. */ #define AIO_PRIO_DELTA_MAX 20 /* Minimum size for a thread. We are free to choose a reasonable value. */ #define PTHREAD_STACK_MIN 16384 /* Maximum number of timer expiration overruns. */ #define DELAYTIMER_MAX 2147483647 /* Maximum tty name length. */ #define TTY_NAME_MAX 32 /* Maximum login name length. This is arbitrary. */ #define LOGIN_NAME_MAX 256 /* Maximum host name length. */ #define HOST_NAME_MAX 64 /* Maximum message queue priority level. */ #define MQ_PRIO_MAX 32768 /* Maximum value the semaphore can have. */ #define SEM_VALUE_MAX (2147483647) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/dlfcn.h����������������������������������������������������������������������������������������0000644�����������������00000004736�14763166030�0006764 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* System dependent definitions for run-time dynamic loading. Copyright (C) 1996-2001, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _DLFCN_H # error "Never use <bits/dlfcn.h> directly; include <dlfcn.h> instead." #endif /* The MODE argument to `dlopen' contains one of the following: */ #define RTLD_LAZY 0x00001 /* Lazy function call binding. */ #define RTLD_NOW 0x00002 /* Immediate function call binding. */ #define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */ #define RTLD_NOLOAD 0x00004 /* Do not load the object. */ #define RTLD_DEEPBIND 0x00008 /* Use deep binding. */ /* If the following bit is set in the MODE argument to `dlopen', the symbols of the loaded object and its dependencies are made visible as if the object were linked directly into the program. */ #define RTLD_GLOBAL 0x00100 /* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL. The implementation does this by default and so we can define the value to zero. */ #define RTLD_LOCAL 0 /* Do not delete object when closed. */ #define RTLD_NODELETE 0x01000 #ifdef __USE_GNU /* To support profiling of shared objects it is a good idea to call the function found using `dlsym' using the following macro since these calls do not use the PLT. But this would mean the dynamic loader has no chance to find out when the function is called. The macro applies the necessary magic so that profiling is possible. Rewrite foo = (*fctp) (arg1, arg2); into foo = DL_CALL_FCT (fctp, (arg1, arg2)); */ # define DL_CALL_FCT(fctp, args) \ (_dl_mcount_wrapper_check ((void *) (fctp)), (*(fctp)) args) __BEGIN_DECLS /* This function calls the profiling functions. */ extern void _dl_mcount_wrapper_check (void *__selfpc) __THROW; __END_DECLS #endif ����������������������������������bits/nan.h������������������������������������������������������������������������������������������0000644�����������������00000003046�14763166030�0006443 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* `NAN' constant for IEEE 754 machines. Copyright (C) 1992,1996,1997,1999,2004,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never use <bits/nan.h> directly; include <math.h> instead." #endif /* IEEE Not A Number. */ #if __GNUC_PREREQ(3,3) # define NAN (__builtin_nanf ("")) #elif defined __GNUC__ # define NAN \ (__extension__ \ ((union { unsigned __l __attribute__ ((__mode__ (__SI__))); float __d; }) \ { __l: 0x7fc00000UL }).__d) #else # include <endian.h> # if __BYTE_ORDER == __BIG_ENDIAN # define __nan_bytes { 0x7f, 0xc0, 0, 0 } # endif # if __BYTE_ORDER == __LITTLE_ENDIAN # define __nan_bytes { 0, 0, 0xc0, 0x7f } # endif static union { unsigned char __c[4]; float __d; } __nan_union __attribute_used__ = { __nan_bytes }; # define NAN (__nan_union.__d) #endif /* GCC. */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/sigaction.h������������������������������������������������������������������������������������0000644�����������������00000005444�14763166030�0007653 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* The proper definitions for Linux's sigaction. Copyright (C) 1993-1999, 2000, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SIGNAL_H # error "Never include <bits/sigaction.h> directly; use <signal.h> instead." #endif /* Structure describing the action to be taken when a signal arrives. */ struct sigaction { /* Signal handler. */ #ifdef __USE_POSIX199309 union { /* Used if SA_SIGINFO is not set. */ __sighandler_t sa_handler; /* Used if SA_SIGINFO is set. */ void (*sa_sigaction) (int, siginfo_t *, void *); } __sigaction_handler; # define sa_handler __sigaction_handler.sa_handler # define sa_sigaction __sigaction_handler.sa_sigaction #else __sighandler_t sa_handler; #endif /* Additional set of signals to be blocked. */ __sigset_t sa_mask; /* Special flags. */ int sa_flags; /* Restore handler. */ void (*sa_restorer) (void); }; /* Bits in `sa_flags'. */ #define SA_NOCLDSTOP 1 /* Don't send SIGCHLD when children stop. */ #define SA_NOCLDWAIT 2 /* Don't create zombie on child death. */ #define SA_SIGINFO 4 /* Invoke signal-catching function with three arguments instead of one. */ #if defined __USE_UNIX98 || defined __USE_MISC # define SA_ONSTACK 0x08000000 /* Use signal stack by using `sa_restorer'. */ #endif #if defined __USE_UNIX98 || defined __USE_MISC || defined __USE_XOPEN2K8 # define SA_RESTART 0x10000000 /* Restart syscall on signal return. */ # define SA_NODEFER 0x40000000 /* Don't automatically block the signal when its handler is being executed. */ # define SA_RESETHAND 0x80000000 /* Reset to SIG_DFL on entry to handler. */ #endif #ifdef __USE_MISC # define SA_INTERRUPT 0x20000000 /* Historical no-op. */ /* Some aliases for the SA_ constants. */ # define SA_NOMASK SA_NODEFER # define SA_ONESHOT SA_RESETHAND # define SA_STACK SA_ONSTACK #endif /* Values for the HOW argument to `sigprocmask'. */ #define SIG_BLOCK 0 /* Block signals. */ #define SIG_UNBLOCK 1 /* Unblock signals. */ #define SIG_SETMASK 2 /* Set the set of blocked signals. */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/msq.h������������������������������������������������������������������������������������������0000644�����������������00000004741�14763166030�0006472 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1995-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_MSG_H # error "Never use <bits/msq.h> directly; include <sys/msg.h> instead." #endif #include <bits/types.h> /* Define options for message queue functions. */ #define MSG_NOERROR 010000 /* no error if message is too big */ #ifdef __USE_GNU # define MSG_EXCEPT 020000 /* recv any msg except of specified type */ #endif /* Types used in the structure definition. */ typedef __syscall_ulong_t msgqnum_t; typedef __syscall_ulong_t msglen_t; /* Structure of record for one message inside the kernel. The type `struct msg' is opaque. */ struct msqid_ds { struct ipc_perm msg_perm; /* structure describing operation permission */ __time_t msg_stime; /* time of last msgsnd command */ #ifndef __x86_64__ unsigned long int __unused1; #endif __time_t msg_rtime; /* time of last msgrcv command */ #ifndef __x86_64__ unsigned long int __unused2; #endif __time_t msg_ctime; /* time of last change */ #ifndef __x86_64__ unsigned long int __unused3; #endif __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */ msgqnum_t msg_qnum; /* number of messages currently on queue */ msglen_t msg_qbytes; /* max number of bytes allowed on queue */ __pid_t msg_lspid; /* pid of last msgsnd() */ __pid_t msg_lrpid; /* pid of last msgrcv() */ __syscall_ulong_t __unused4; __syscall_ulong_t __unused5; }; #ifdef __USE_MISC # define msg_cbytes __msg_cbytes /* ipcs ctl commands */ # define MSG_STAT 11 # define MSG_INFO 12 # define MSG_STAT_ANY 13 /* buffer for msgctl calls IPC_INFO, MSG_INFO */ struct msginfo { int msgpool; int msgmap; int msgmax; int msgmnb; int msgmni; int msgssz; int msgtql; unsigned short int msgseg; }; #endif /* __USE_MISC */ �������������������������������bits/types.h����������������������������������������������������������������������������������������0000644�����������������00000017061�14763166030�0007035 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* bits/types.h -- definitions of __*_t types underlying *_t types. Copyright (C) 2002-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * Never include this file directly; use <sys/types.h> instead. */ #ifndef _BITS_TYPES_H #define _BITS_TYPES_H 1 #include <features.h> #include <bits/wordsize.h> /* Convenience types. */ typedef unsigned char __u_char; typedef unsigned short int __u_short; typedef unsigned int __u_int; typedef unsigned long int __u_long; /* Fixed-size types, underlying types depend on word size and compiler. */ typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef signed short int __int16_t; typedef unsigned short int __uint16_t; typedef signed int __int32_t; typedef unsigned int __uint32_t; #if __WORDSIZE == 64 typedef signed long int __int64_t; typedef unsigned long int __uint64_t; #elif defined __GLIBC_HAVE_LONG_LONG __extension__ typedef signed long long int __int64_t; __extension__ typedef unsigned long long int __uint64_t; #endif /* quad_t is also 64 bits. */ #if __WORDSIZE == 64 typedef long int __quad_t; typedef unsigned long int __u_quad_t; #elif defined __GLIBC_HAVE_LONG_LONG __extension__ typedef long long int __quad_t; __extension__ typedef unsigned long long int __u_quad_t; #else typedef struct { long __val[2]; } __quad_t; typedef struct { __u_long __val[2]; } __u_quad_t; #endif /* The machine-dependent file <bits/typesizes.h> defines __*_T_TYPE macros for each of the OS types we define below. The definitions of those macros must use the following macros for underlying types. We define __S<SIZE>_TYPE and __U<SIZE>_TYPE for the signed and unsigned variants of each of the following integer types on this machine. 16 -- "natural" 16-bit type (always short) 32 -- "natural" 32-bit type (always int) 64 -- "natural" 64-bit type (long or long long) LONG32 -- 32-bit type, traditionally long QUAD -- 64-bit type, always long long WORD -- natural type of __WORDSIZE bits (int or long) LONGWORD -- type of __WORDSIZE bits, traditionally long We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the conventional uses of `long' or `long long' type modifiers match the types we define, even when a less-adorned type would be the same size. This matters for (somewhat) portably writing printf/scanf formats for these types, where using the appropriate l or ll format modifiers can make the typedefs and the formats match up across all GNU platforms. If we used `long' when it's 64 bits where `long long' is expected, then the compiler would warn about the formats not matching the argument types, and the programmer changing them to shut up the compiler would break the program's portability. Here we assume what is presently the case in all the GCC configurations we support: long long is always 64 bits, long is always word/address size, and int is always 32 bits. */ #define __S16_TYPE short int #define __U16_TYPE unsigned short int #define __S32_TYPE int #define __U32_TYPE unsigned int #define __SLONGWORD_TYPE long int #define __ULONGWORD_TYPE unsigned long int #if __WORDSIZE == 32 # define __SQUAD_TYPE __quad_t # define __UQUAD_TYPE __u_quad_t # define __SWORD_TYPE int # define __UWORD_TYPE unsigned int # define __SLONG32_TYPE long int # define __ULONG32_TYPE unsigned long int # define __S64_TYPE __quad_t # define __U64_TYPE __u_quad_t /* We want __extension__ before typedef's that use nonstandard base types such as `long long' in C89 mode. */ # define __STD_TYPE __extension__ typedef #elif __WORDSIZE == 64 # define __SQUAD_TYPE long int # define __UQUAD_TYPE unsigned long int # define __SWORD_TYPE long int # define __UWORD_TYPE unsigned long int # define __SLONG32_TYPE int # define __ULONG32_TYPE unsigned int # define __S64_TYPE long int # define __U64_TYPE unsigned long int /* No need to mark the typedef with __extension__. */ # define __STD_TYPE typedef #else # error #endif #include <bits/typesizes.h> /* Defines __*_T_TYPE macros. */ __STD_TYPE __DEV_T_TYPE __dev_t; /* Type of device numbers. */ __STD_TYPE __UID_T_TYPE __uid_t; /* Type of user identifications. */ __STD_TYPE __GID_T_TYPE __gid_t; /* Type of group identifications. */ __STD_TYPE __INO_T_TYPE __ino_t; /* Type of file serial numbers. */ __STD_TYPE __INO64_T_TYPE __ino64_t; /* Type of file serial numbers (LFS).*/ __STD_TYPE __MODE_T_TYPE __mode_t; /* Type of file attribute bitmasks. */ __STD_TYPE __NLINK_T_TYPE __nlink_t; /* Type of file link counts. */ __STD_TYPE __OFF_T_TYPE __off_t; /* Type of file sizes and offsets. */ __STD_TYPE __OFF64_T_TYPE __off64_t; /* Type of file sizes and offsets (LFS). */ __STD_TYPE __PID_T_TYPE __pid_t; /* Type of process identifications. */ __STD_TYPE __FSID_T_TYPE __fsid_t; /* Type of file system IDs. */ __STD_TYPE __CLOCK_T_TYPE __clock_t; /* Type of CPU usage counts. */ __STD_TYPE __RLIM_T_TYPE __rlim_t; /* Type for resource measurement. */ __STD_TYPE __RLIM64_T_TYPE __rlim64_t; /* Type for resource measurement (LFS). */ __STD_TYPE __ID_T_TYPE __id_t; /* General type for IDs. */ __STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */ __STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */ __STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */ __STD_TYPE __DADDR_T_TYPE __daddr_t; /* The type of a disk address. */ __STD_TYPE __KEY_T_TYPE __key_t; /* Type of an IPC key. */ /* Clock ID used in clock and timer functions. */ __STD_TYPE __CLOCKID_T_TYPE __clockid_t; /* Timer ID returned by `timer_create'. */ __STD_TYPE __TIMER_T_TYPE __timer_t; /* Type to represent block size. */ __STD_TYPE __BLKSIZE_T_TYPE __blksize_t; /* Types from the Large File Support interface. */ /* Type to count number of disk blocks. */ __STD_TYPE __BLKCNT_T_TYPE __blkcnt_t; __STD_TYPE __BLKCNT64_T_TYPE __blkcnt64_t; /* Type to count file system blocks. */ __STD_TYPE __FSBLKCNT_T_TYPE __fsblkcnt_t; __STD_TYPE __FSBLKCNT64_T_TYPE __fsblkcnt64_t; /* Type to count file system nodes. */ __STD_TYPE __FSFILCNT_T_TYPE __fsfilcnt_t; __STD_TYPE __FSFILCNT64_T_TYPE __fsfilcnt64_t; /* Type of miscellaneous file system fields. */ __STD_TYPE __FSWORD_T_TYPE __fsword_t; __STD_TYPE __SSIZE_T_TYPE __ssize_t; /* Type of a byte count, or error. */ /* Signed long type used in system calls. */ __STD_TYPE __SYSCALL_SLONG_TYPE __syscall_slong_t; /* Unsigned long type used in system calls. */ __STD_TYPE __SYSCALL_ULONG_TYPE __syscall_ulong_t; /* These few don't really vary by system, they always correspond to one of the other defined types. */ typedef __off64_t __loff_t; /* Type of file sizes and offsets (LFS). */ typedef __quad_t *__qaddr_t; typedef char *__caddr_t; /* Duplicates info from stdint.h but this is used in unistd.h. */ __STD_TYPE __SWORD_TYPE __intptr_t; /* Duplicate info from sys/socket.h. */ __STD_TYPE __U32_TYPE __socklen_t; #undef __STD_TYPE #endif /* bits/types.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/mathinline.h�����������������������������������������������������������������������������������0000644�����������������00000075561�14763166030�0010032 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Inline math functions for i387 and SSE. Copyright (C) 1995-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never use <bits/mathinline.h> directly; include <math.h> instead." #endif #ifndef __extern_always_inline # define __MATH_INLINE __inline #else # define __MATH_INLINE __extern_always_inline #endif #if defined __USE_ISOC99 && defined __GNUC__ && __GNUC__ >= 2 /* GCC 2.97 and up have builtins that actually can be used. */ # if !__GNUC_PREREQ (2,97) /* ISO C99 defines some macros to perform unordered comparisons. The ix87 FPU supports this with special opcodes and we should use them. These must not be inline functions since we have to be able to handle all floating-point types. */ # undef isgreater # undef isgreaterequal # undef isless # undef islessequal # undef islessgreater # undef isunordered # ifdef __i686__ /* For the PentiumPro and more recent processors we can provide better code. */ # define isgreater(x, y) \ ({ register char __result; \ __asm__ ("fucomip %%st(1), %%st; seta %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st"); \ __result; }) # define isgreaterequal(x, y) \ ({ register char __result; \ __asm__ ("fucomip %%st(1), %%st; setae %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st"); \ __result; }) # define isless(x, y) \ ({ register char __result; \ __asm__ ("fucomip %%st(1), %%st; seta %%al" \ : "=a" (__result) : "u" (x), "t" (y) : "cc", "st"); \ __result; }) # define islessequal(x, y) \ ({ register char __result; \ __asm__ ("fucomip %%st(1), %%st; setae %%al" \ : "=a" (__result) : "u" (x), "t" (y) : "cc", "st"); \ __result; }) # define islessgreater(x, y) \ ({ register char __result; \ __asm__ ("fucomip %%st(1), %%st; setne %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st"); \ __result; }) # define isunordered(x, y) \ ({ register char __result; \ __asm__ ("fucomip %%st(1), %%st; setp %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st"); \ __result; }) # else /* This is the dumb, portable code for i386 and above. */ # define isgreater(x, y) \ ({ register char __result; \ __asm__ ("fucompp; fnstsw; testb $0x45, %%ah; setz %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \ __result; }) # define isgreaterequal(x, y) \ ({ register char __result; \ __asm__ ("fucompp; fnstsw; testb $0x05, %%ah; setz %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \ __result; }) # define isless(x, y) \ ({ register char __result; \ __asm__ ("fucompp; fnstsw; testb $0x45, %%ah; setz %%al" \ : "=a" (__result) : "u" (x), "t" (y) : "cc", "st", "st(1)"); \ __result; }) # define islessequal(x, y) \ ({ register char __result; \ __asm__ ("fucompp; fnstsw; testb $0x05, %%ah; setz %%al" \ : "=a" (__result) : "u" (x), "t" (y) : "cc", "st", "st(1)"); \ __result; }) # define islessgreater(x, y) \ ({ register char __result; \ __asm__ ("fucompp; fnstsw; testb $0x44, %%ah; setz %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \ __result; }) # define isunordered(x, y) \ ({ register char __result; \ __asm__ ("fucompp; fnstsw; sahf; setp %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \ __result; }) # endif /* __i686__ */ # endif /* GCC 2.97 */ /* The gcc, version 2.7 or below, has problems with all this inlining code. So disable it for this version of the compiler. */ # if __GNUC_PREREQ (2, 8) __BEGIN_NAMESPACE_C99 /* Test for negative number. Used in the signbit() macro. */ __MATH_INLINE int __NTH (__signbitf (float __x)) { # ifdef __SSE2_MATH__ int __m; __asm ("pmovmskb %1, %0" : "=r" (__m) : "x" (__x)); return (__m & 0x8) != 0; # else __extension__ union { float __f; int __i; } __u = { __f: __x }; return __u.__i < 0; # endif } __MATH_INLINE int __NTH (__signbit (double __x)) { # ifdef __SSE2_MATH__ int __m; __asm ("pmovmskb %1, %0" : "=r" (__m) : "x" (__x)); return (__m & 0x80) != 0; # else __extension__ union { double __d; int __i[2]; } __u = { __d: __x }; return __u.__i[1] < 0; # endif } __MATH_INLINE int __NTH (__signbitl (long double __x)) { __extension__ union { long double __l; int __i[3]; } __u = { __l: __x }; return (__u.__i[2] & 0x8000) != 0; } __END_NAMESPACE_C99 # endif #endif /* The gcc, version 2.7 or below, has problems with all this inlining code. So disable it for this version of the compiler. */ #if __GNUC_PREREQ (2, 8) # if !__GNUC_PREREQ (3, 4) && !defined __NO_MATH_INLINES \ && defined __OPTIMIZE__ /* GCC 3.4 introduced builtins for all functions below, so there's no need to define any of these inline functions. */ # ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Round to nearest integer. */ # ifdef __SSE_MATH__ __MATH_INLINE long int __NTH (lrintf (float __x)) { long int __res; /* Mark as volatile since the result is dependent on the state of the SSE control register (the rounding mode). Otherwise GCC might remove these assembler instructions since it does not know about the rounding mode change and cannot currently be told. */ __asm __volatile__ ("cvtss2si %1, %0" : "=r" (__res) : "xm" (__x)); return __res; } # endif # ifdef __SSE2_MATH__ __MATH_INLINE long int __NTH (lrint (double __x)) { long int __res; /* Mark as volatile since the result is dependent on the state of the SSE control register (the rounding mode). Otherwise GCC might remove these assembler instructions since it does not know about the rounding mode change and cannot currently be told. */ __asm __volatile__ ("cvtsd2si %1, %0" : "=r" (__res) : "xm" (__x)); return __res; } # endif # ifdef __x86_64__ __MATH_INLINE long long int __NTH (llrintf (float __x)) { long long int __res; /* Mark as volatile since the result is dependent on the state of the SSE control register (the rounding mode). Otherwise GCC might remove these assembler instructions since it does not know about the rounding mode change and cannot currently be told. */ __asm __volatile__ ("cvtss2si %1, %0" : "=r" (__res) : "xm" (__x)); return __res; } __MATH_INLINE long long int __NTH (llrint (double __x)) { long long int __res; /* Mark as volatile since the result is dependent on the state of the SSE control register (the rounding mode). Otherwise GCC might remove these assembler instructions since it does not know about the rounding mode change and cannot currently be told. */ __asm __volatile__ ("cvtsd2si %1, %0" : "=r" (__res) : "xm" (__x)); return __res; } # endif # if defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0 \ && defined __SSE2_MATH__ /* Determine maximum of two values. */ __MATH_INLINE float __NTH (fmaxf (float __x, float __y)) { # ifdef __AVX__ float __res; __asm ("vmaxss %2, %1, %0" : "=x" (__res) : "x" (x), "xm" (__y)); return __res; # else __asm ("maxss %1, %0" : "+x" (__x) : "xm" (__y)); return __x; # endif } __MATH_INLINE double __NTH (fmax (double __x, double __y)) { # ifdef __AVX__ float __res; __asm ("vmaxsd %2, %1, %0" : "=x" (__res) : "x" (x), "xm" (__y)); return __res; # else __asm ("maxsd %1, %0" : "+x" (__x) : "xm" (__y)); return __x; # endif } /* Determine minimum of two values. */ __MATH_INLINE float __NTH (fminf (float __x, float __y)) { # ifdef __AVX__ float __res; __asm ("vminss %2, %1, %0" : "=x" (__res) : "x" (x), "xm" (__y)); return __res; # else __asm ("minss %1, %0" : "+x" (__x) : "xm" (__y)); return __x; # endif } __MATH_INLINE double __NTH (fmin (double __x, double __y)) { # ifdef __AVX__ float __res; __asm ("vminsd %2, %1, %0" : "=x" (__res) : "x" (x), "xm" (__y)); return __res; # else __asm ("minsd %1, %0" : "+x" (__x) : "xm" (__y)); return __x; # endif } # endif __END_NAMESPACE_C99 # endif # if defined __SSE4_1__ && defined __SSE2_MATH__ # if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Round to nearest integer. */ __MATH_INLINE double __NTH (rint (double __x)) { double __res; /* Mark as volatile since the result is dependent on the state of the SSE control register (the rounding mode). Otherwise GCC might remove these assembler instructions since it does not know about the rounding mode change and cannot currently be told. */ __asm __volatile__ ("roundsd $4, %1, %0" : "=x" (__res) : "xm" (__x)); return __res; } __MATH_INLINE float __NTH (rintf (float __x)) { float __res; /* Mark as volatile since the result is dependent on the state of the SSE control register (the rounding mode). Otherwise GCC might remove these assembler instructions since it does not know about the rounding mode change and cannot currently be told. */ __asm __volatile__ ("roundss $4, %1, %0" : "=x" (__res) : "xm" (__x)); return __res; } # ifdef __USE_ISOC99 /* Round to nearest integer without raising inexact exception. */ __MATH_INLINE double __NTH (nearbyint (double __x)) { double __res; /* Mark as volatile since the result is dependent on the state of the SSE control register (the rounding mode). Otherwise GCC might remove these assembler instructions since it does not know about the rounding mode change and cannot currently be told. */ __asm __volatile__ ("roundsd $0xc, %1, %0" : "=x" (__res) : "xm" (__x)); return __res; } __MATH_INLINE float __NTH (nearbyintf (float __x)) { float __res; /* Mark as volatile since the result is dependent on the state of the SSE control register (the rounding mode). Otherwise GCC might remove these assembler instructions since it does not know about the rounding mode change and cannot currently be told. */ __asm __volatile__ ("roundss $0xc, %1, %0" : "=x" (__res) : "xm" (__x)); return __res; } # endif __END_NAMESPACE_C99 # endif __BEGIN_NAMESPACE_STD /* Smallest integral value not less than X. */ __MATH_INLINE double __NTH (ceil (double __x)) { double __res; __asm ("roundsd $2, %1, %0" : "=x" (__res) : "xm" (__x)); return __res; } __END_NAMESPACE_STD __BEGIN_NAMESPACE_C99 __MATH_INLINE float __NTH (ceilf (float __x)) { float __res; __asm ("roundss $2, %1, %0" : "=x" (__res) : "xm" (__x)); return __res; } __END_NAMESPACE_C99 __BEGIN_NAMESPACE_STD /* Largest integer not greater than X. */ __MATH_INLINE double __NTH (floor (double __x)) { double __res; __asm ("roundsd $1, %1, %0" : "=x" (__res) : "xm" (__x)); return __res; } __END_NAMESPACE_STD __BEGIN_NAMESPACE_C99 __MATH_INLINE float __NTH (floorf (float __x)) { float __res; __asm ("roundss $1, %1, %0" : "=x" (__res) : "xm" (__x)); return __res; } __END_NAMESPACE_C99 # endif # endif #endif #ifndef __x86_64__ # if ((!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \ && defined __OPTIMIZE__) /* The inline functions do not set errno or raise necessarily the correct exceptions. */ # undef math_errhandling /* A macro to define float, double, and long double versions of various math functions for the ix87 FPU. FUNC is the function name (which will be suffixed with f and l for the float and long double version, respectively). OP is the name of the FPU operation. We define two sets of macros. The set with the additional NP doesn't add a prototype declaration. */ # if defined __USE_MISC || defined __USE_ISOC99 # define __inline_mathop(func, op) \ __inline_mathop_ (double, func, op) \ __inline_mathop_ (float, __CONCAT(func,f), op) \ __inline_mathop_ (long double, __CONCAT(func,l), op) # define __inline_mathopNP(func, op) \ __inline_mathopNP_ (double, func, op) \ __inline_mathopNP_ (float, __CONCAT(func,f), op) \ __inline_mathopNP_ (long double, __CONCAT(func,l), op) # else # define __inline_mathop(func, op) \ __inline_mathop_ (double, func, op) # define __inline_mathopNP(func, op) \ __inline_mathopNP_ (double, func, op) # endif # define __inline_mathop_(float_type, func, op) \ __inline_mathop_decl_ (float_type, func, op, "0" (__x)) # define __inline_mathopNP_(float_type, func, op) \ __inline_mathop_declNP_ (float_type, func, op, "0" (__x)) # if defined __USE_MISC || defined __USE_ISOC99 # define __inline_mathop_decl(func, op, params...) \ __inline_mathop_decl_ (double, func, op, params) \ __inline_mathop_decl_ (float, __CONCAT(func,f), op, params) \ __inline_mathop_decl_ (long double, __CONCAT(func,l), op, params) # define __inline_mathop_declNP(func, op, params...) \ __inline_mathop_declNP_ (double, func, op, params) \ __inline_mathop_declNP_ (float, __CONCAT(func,f), op, params) \ __inline_mathop_declNP_ (long double, __CONCAT(func,l), op, params) # else # define __inline_mathop_decl(func, op, params...) \ __inline_mathop_decl_ (double, func, op, params) # define __inline_mathop_declNP(func, op, params...) \ __inline_mathop_declNP_ (double, func, op, params) # endif # define __inline_mathop_decl_(float_type, func, op, params...) \ __MATH_INLINE float_type func (float_type) __THROW; \ __inline_mathop_declNP_ (float_type, func, op, params) # define __inline_mathop_declNP_(float_type, func, op, params...) \ __MATH_INLINE float_type __NTH (func (float_type __x)) \ { \ register float_type __result; \ __asm __volatile__ (op : "=t" (__result) : params); \ return __result; \ } # if defined __USE_MISC || defined __USE_ISOC99 # define __inline_mathcode(func, arg, code) \ __inline_mathcode_ (double, func, arg, code) \ __inline_mathcode_ (float, __CONCAT(func,f), arg, code) \ __inline_mathcode_ (long double, __CONCAT(func,l), arg, code) # define __inline_mathcodeNP(func, arg, code) \ __inline_mathcodeNP_ (double, func, arg, code) \ __inline_mathcodeNP_ (float, __CONCAT(func,f), arg, code) \ __inline_mathcodeNP_ (long double, __CONCAT(func,l), arg, code) # define __inline_mathcode2(func, arg1, arg2, code) \ __inline_mathcode2_ (double, func, arg1, arg2, code) \ __inline_mathcode2_ (float, __CONCAT(func,f), arg1, arg2, code) \ __inline_mathcode2_ (long double, __CONCAT(func,l), arg1, arg2, code) # define __inline_mathcodeNP2(func, arg1, arg2, code) \ __inline_mathcodeNP2_ (double, func, arg1, arg2, code) \ __inline_mathcodeNP2_ (float, __CONCAT(func,f), arg1, arg2, code) \ __inline_mathcodeNP2_ (long double, __CONCAT(func,l), arg1, arg2, code) # define __inline_mathcode3(func, arg1, arg2, arg3, code) \ __inline_mathcode3_ (double, func, arg1, arg2, arg3, code) \ __inline_mathcode3_ (float, __CONCAT(func,f), arg1, arg2, arg3, code) \ __inline_mathcode3_ (long double, __CONCAT(func,l), arg1, arg2, arg3, code) # define __inline_mathcodeNP3(func, arg1, arg2, arg3, code) \ __inline_mathcodeNP3_ (double, func, arg1, arg2, arg3, code) \ __inline_mathcodeNP3_ (float, __CONCAT(func,f), arg1, arg2, arg3, code) \ __inline_mathcodeNP3_ (long double, __CONCAT(func,l), arg1, arg2, arg3, code) # else # define __inline_mathcode(func, arg, code) \ __inline_mathcode_ (double, func, (arg), code) # define __inline_mathcodeNP(func, arg, code) \ __inline_mathcodeNP_ (double, func, (arg), code) # define __inline_mathcode2(func, arg1, arg2, code) \ __inline_mathcode2_ (double, func, arg1, arg2, code) # define __inline_mathcodeNP2(func, arg1, arg2, code) \ __inline_mathcodeNP2_ (double, func, arg1, arg2, code) # define __inline_mathcode3(func, arg1, arg2, arg3, code) \ __inline_mathcode3_ (double, func, arg1, arg2, arg3, code) # define __inline_mathcodeNP3(func, arg1, arg2, arg3, code) \ __inline_mathcodeNP3_ (double, func, arg1, arg2, arg3, code) # endif # define __inline_mathcode_(float_type, func, arg, code) \ __MATH_INLINE float_type func (float_type) __THROW; \ __inline_mathcodeNP_(float_type, func, arg, code) # define __inline_mathcodeNP_(float_type, func, arg, code) \ __MATH_INLINE float_type __NTH (func (float_type arg)) \ { \ code; \ } # define __inline_mathcode2_(float_type, func, arg1, arg2, code) \ __MATH_INLINE float_type func (float_type, float_type) __THROW; \ __inline_mathcodeNP2_ (float_type, func, arg1, arg2, code) # define __inline_mathcodeNP2_(float_type, func, arg1, arg2, code) \ __MATH_INLINE float_type __NTH (func (float_type arg1, float_type arg2)) \ { \ code; \ } # define __inline_mathcode3_(float_type, func, arg1, arg2, arg3, code) \ __MATH_INLINE float_type func (float_type, float_type, float_type) __THROW; \ __inline_mathcodeNP3_(float_type, func, arg1, arg2, arg3, code) # define __inline_mathcodeNP3_(float_type, func, arg1, arg2, arg3, code) \ __MATH_INLINE float_type __NTH (func (float_type arg1, float_type arg2, \ float_type arg3)) \ { \ code; \ } # endif # if !defined __NO_MATH_INLINES && defined __OPTIMIZE__ /* Miscellaneous functions */ /* __FAST_MATH__ is defined by gcc -ffast-math. */ # ifdef __FAST_MATH__ # ifdef __USE_GNU # define __sincos_code \ register long double __cosr; \ register long double __sinr; \ register unsigned int __swtmp; \ __asm __volatile__ \ ("fsincos\n\t" \ "fnstsw %w2\n\t" \ "testl $0x400, %2\n\t" \ "jz 1f\n\t" \ "fldpi\n\t" \ "fadd %%st(0)\n\t" \ "fxch %%st(1)\n\t" \ "2: fprem1\n\t" \ "fnstsw %w2\n\t" \ "testl $0x400, %2\n\t" \ "jnz 2b\n\t" \ "fstp %%st(1)\n\t" \ "fsincos\n\t" \ "1:" \ : "=t" (__cosr), "=u" (__sinr), "=a" (__swtmp) : "0" (__x)); \ *__sinx = __sinr; \ *__cosx = __cosr __MATH_INLINE void __NTH (__sincos (double __x, double *__sinx, double *__cosx)) { __sincos_code; } __MATH_INLINE void __NTH (__sincosf (float __x, float *__sinx, float *__cosx)) { __sincos_code; } __MATH_INLINE void __NTH (__sincosl (long double __x, long double *__sinx, long double *__cosx)) { __sincos_code; } # endif /* Optimized inline implementation, sometimes with reduced precision and/or argument range. */ # if __GNUC_PREREQ (3, 5) # define __expm1_code \ register long double __temp; \ __temp = __builtin_expm1l (__x); \ return __temp ? __temp : __x # else # define __expm1_code \ register long double __value; \ register long double __exponent; \ register long double __temp; \ __asm __volatile__ \ ("fldl2e # e^x - 1 = 2^(x * log2(e)) - 1\n\t" \ "fmul %%st(1) # x * log2(e)\n\t" \ "fst %%st(1)\n\t" \ "frndint # int(x * log2(e))\n\t" \ "fxch\n\t" \ "fsub %%st(1) # fract(x * log2(e))\n\t" \ "f2xm1 # 2^(fract(x * log2(e))) - 1\n\t" \ "fscale # 2^(x * log2(e)) - 2^(int(x * log2(e)))\n\t" \ : "=t" (__value), "=u" (__exponent) : "0" (__x)); \ __asm __volatile__ \ ("fscale # 2^int(x * log2(e))\n\t" \ : "=t" (__temp) : "0" (1.0), "u" (__exponent)); \ __temp -= 1.0; \ __temp += __value; \ return __temp ? __temp : __x # endif __inline_mathcodeNP_ (long double, __expm1l, __x, __expm1_code) # if __GNUC_PREREQ (3, 4) __inline_mathcodeNP_ (long double, __expl, __x, return __builtin_expl (__x)) # else # define __exp_code \ register long double __value; \ register long double __exponent; \ __asm __volatile__ \ ("fldl2e # e^x = 2^(x * log2(e))\n\t" \ "fmul %%st(1) # x * log2(e)\n\t" \ "fst %%st(1)\n\t" \ "frndint # int(x * log2(e))\n\t" \ "fxch\n\t" \ "fsub %%st(1) # fract(x * log2(e))\n\t" \ "f2xm1 # 2^(fract(x * log2(e))) - 1\n\t" \ : "=t" (__value), "=u" (__exponent) : "0" (__x)); \ __value += 1.0; \ __asm __volatile__ \ ("fscale" \ : "=t" (__value) : "0" (__value), "u" (__exponent)); \ return __value __inline_mathcodeNP (exp, __x, __exp_code) __inline_mathcodeNP_ (long double, __expl, __x, __exp_code) # endif # if !__GNUC_PREREQ (3, 5) __inline_mathcodeNP (tan, __x, \ register long double __value; \ register long double __value2 __attribute__ ((__unused__)); \ __asm __volatile__ \ ("fptan" \ : "=t" (__value2), "=u" (__value) : "0" (__x)); \ return __value) # endif # endif /* __FAST_MATH__ */ # if __GNUC_PREREQ (3, 4) __inline_mathcodeNP2_ (long double, __atan2l, __y, __x, return __builtin_atan2l (__y, __x)) # else # define __atan2_code \ register long double __value; \ __asm __volatile__ \ ("fpatan" \ : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); \ return __value # ifdef __FAST_MATH__ __inline_mathcodeNP2 (atan2, __y, __x, __atan2_code) # endif __inline_mathcodeNP2_ (long double, __atan2l, __y, __x, __atan2_code) # endif # if defined __FAST_MATH__ && !__GNUC_PREREQ (3, 5) __inline_mathcodeNP2 (fmod, __x, __y, \ register long double __value; \ __asm __volatile__ \ ("1: fprem\n\t" \ "fnstsw %%ax\n\t" \ "sahf\n\t" \ "jp 1b" \ : "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc"); \ return __value) # endif # ifdef __FAST_MATH__ # if !__GNUC_PREREQ (3,3) __inline_mathopNP (sqrt, "fsqrt") __inline_mathopNP_ (long double, __sqrtl, "fsqrt") # define __libc_sqrtl(n) __sqrtl (n) # else # define __libc_sqrtl(n) __builtin_sqrtl (n) # endif # endif # if __GNUC_PREREQ (2, 8) __inline_mathcodeNP_ (double, fabs, __x, return __builtin_fabs (__x)) # if defined __USE_MISC || defined __USE_ISOC99 __inline_mathcodeNP_ (float, fabsf, __x, return __builtin_fabsf (__x)) __inline_mathcodeNP_ (long double, fabsl, __x, return __builtin_fabsl (__x)) # endif __inline_mathcodeNP_ (long double, __fabsl, __x, return __builtin_fabsl (__x)) # else __inline_mathop (fabs, "fabs") __inline_mathop_ (long double, __fabsl, "fabs") # endif # ifdef __FAST_MATH__ # if !__GNUC_PREREQ (3, 4) /* The argument range of this inline version is reduced. */ __inline_mathopNP (sin, "fsin") /* The argument range of this inline version is reduced. */ __inline_mathopNP (cos, "fcos") __inline_mathop_declNP (log, "fldln2; fxch; fyl2x", "0" (__x) : "st(1)") # endif # if !__GNUC_PREREQ (3, 5) __inline_mathop_declNP (log10, "fldlg2; fxch; fyl2x", "0" (__x) : "st(1)") __inline_mathcodeNP (asin, __x, return __atan2l (__x, __libc_sqrtl (1.0 - __x * __x))) __inline_mathcodeNP (acos, __x, return __atan2l (__libc_sqrtl (1.0 - __x * __x), __x)) # endif # if !__GNUC_PREREQ (3, 4) __inline_mathop_declNP (atan, "fld1; fpatan", "0" (__x) : "st(1)") # endif # endif /* __FAST_MATH__ */ __inline_mathcode_ (long double, __sgn1l, __x, \ __extension__ union { long double __xld; unsigned int __xi[3]; } __n = \ { __xld: __x }; \ __n.__xi[2] = (__n.__xi[2] & 0x8000) | 0x3fff; \ __n.__xi[1] = 0x80000000; \ __n.__xi[0] = 0; \ return __n.__xld) # ifdef __FAST_MATH__ /* The argument range of the inline version of sinhl is slightly reduced. */ __inline_mathcodeNP (sinh, __x, \ register long double __exm1 = __expm1l (__fabsl (__x)); \ return 0.5 * (__exm1 / (__exm1 + 1.0) + __exm1) * __sgn1l (__x)) __inline_mathcodeNP (cosh, __x, \ register long double __ex = __expl (__x); \ return 0.5 * (__ex + 1.0 / __ex)) __inline_mathcodeNP (tanh, __x, \ register long double __exm1 = __expm1l (-__fabsl (__x + __x)); \ return __exm1 / (__exm1 + 2.0) * __sgn1l (-__x)) # endif __inline_mathcodeNP (floor, __x, \ register long double __value; \ register int __ignore; \ unsigned short int __cw; \ unsigned short int __cwtmp; \ __asm __volatile ("fnstcw %3\n\t" \ "movzwl %3, %1\n\t" \ "andl $0xf3ff, %1\n\t" \ "orl $0x0400, %1\n\t" /* rounding down */ \ "movw %w1, %2\n\t" \ "fldcw %2\n\t" \ "frndint\n\t" \ "fldcw %3" \ : "=t" (__value), "=&q" (__ignore), "=m" (__cwtmp), \ "=m" (__cw) \ : "0" (__x)); \ return __value) __inline_mathcodeNP (ceil, __x, \ register long double __value; \ register int __ignore; \ unsigned short int __cw; \ unsigned short int __cwtmp; \ __asm __volatile ("fnstcw %3\n\t" \ "movzwl %3, %1\n\t" \ "andl $0xf3ff, %1\n\t" \ "orl $0x0800, %1\n\t" /* rounding up */ \ "movw %w1, %2\n\t" \ "fldcw %2\n\t" \ "frndint\n\t" \ "fldcw %3" \ : "=t" (__value), "=&q" (__ignore), "=m" (__cwtmp), \ "=m" (__cw) \ : "0" (__x)); \ return __value) # ifdef __FAST_MATH__ # define __ldexp_code \ register long double __value; \ __asm __volatile__ \ ("fscale" \ : "=t" (__value) : "0" (__x), "u" ((long double) __y)); \ return __value __MATH_INLINE double __NTH (ldexp (double __x, int __y)) { __ldexp_code; } # endif /* Optimized versions for some non-standardized functions. */ # if defined __USE_ISOC99 || defined __USE_MISC # ifdef __FAST_MATH__ __inline_mathcodeNP (expm1, __x, __expm1_code) /* We cannot rely on M_SQRT being defined. So we do it for ourself here. */ # define __M_SQRT2 1.41421356237309504880L /* sqrt(2) */ # if !__GNUC_PREREQ (3, 5) __inline_mathcodeNP (log1p, __x, \ register long double __value; \ if (__fabsl (__x) >= 1.0 - 0.5 * __M_SQRT2) \ __value = logl (1.0 + __x); \ else \ __asm __volatile__ \ ("fldln2\n\t" \ "fxch\n\t" \ "fyl2xp1" \ : "=t" (__value) : "0" (__x) : "st(1)"); \ return __value) # endif /* The argument range of the inline version of asinhl is slightly reduced. */ __inline_mathcodeNP (asinh, __x, \ register long double __y = __fabsl (__x); \ return (log1pl (__y * __y / (__libc_sqrtl (__y * __y + 1.0) + 1.0) + __y) \ * __sgn1l (__x))) __inline_mathcodeNP (acosh, __x, \ return logl (__x + __libc_sqrtl (__x - 1.0) * __libc_sqrtl (__x + 1.0))) __inline_mathcodeNP (atanh, __x, \ register long double __y = __fabsl (__x); \ return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x)) /* The argument range of the inline version of hypotl is slightly reduced. */ __inline_mathcodeNP2 (hypot, __x, __y, return __libc_sqrtl (__x * __x + __y * __y)) # if !__GNUC_PREREQ (3, 5) __inline_mathcodeNP(logb, __x, \ register long double __value; \ register long double __junk; \ __asm __volatile__ \ ("fxtract\n\t" \ : "=t" (__junk), "=u" (__value) : "0" (__x)); \ return __value) # endif # endif # endif # ifdef __USE_ISOC99 # ifdef __FAST_MATH__ # if !__GNUC_PREREQ (3, 5) __inline_mathop_declNP (log2, "fld1; fxch; fyl2x", "0" (__x) : "st(1)") # endif __MATH_INLINE float __NTH (ldexpf (float __x, int __y)) { __ldexp_code; } __MATH_INLINE long double __NTH (ldexpl (long double __x, int __y)) { __ldexp_code; } __inline_mathopNP (rint, "frndint") # endif /* __FAST_MATH__ */ # define __lrint_code \ long int __lrintres; \ __asm__ __volatile__ \ ("fistpl %0" \ : "=m" (__lrintres) : "t" (__x) : "st"); \ return __lrintres __MATH_INLINE long int __NTH (lrintf (float __x)) { __lrint_code; } __MATH_INLINE long int __NTH (lrint (double __x)) { __lrint_code; } __MATH_INLINE long int __NTH (lrintl (long double __x)) { __lrint_code; } # undef __lrint_code # define __llrint_code \ long long int __llrintres; \ __asm__ __volatile__ \ ("fistpll %0" \ : "=m" (__llrintres) : "t" (__x) : "st"); \ return __llrintres __MATH_INLINE long long int __NTH (llrintf (float __x)) { __llrint_code; } __MATH_INLINE long long int __NTH (llrint (double __x)) { __llrint_code; } __MATH_INLINE long long int __NTH (llrintl (long double __x)) { __llrint_code; } # undef __llrint_code # endif # ifdef __USE_MISC # if defined __FAST_MATH__ && !__GNUC_PREREQ (3, 5) __inline_mathcodeNP2 (drem, __x, __y, \ register double __value; \ register int __clobbered; \ __asm __volatile__ \ ("1: fprem1\n\t" \ "fstsw %%ax\n\t" \ "sahf\n\t" \ "jp 1b" \ : "=t" (__value), "=&a" (__clobbered) : "0" (__x), "u" (__y) : "cc"); \ return __value) # endif /* This function is used in the `isfinite' macro. */ __MATH_INLINE int __NTH (__finite (double __x)) { return (__extension__ (((((union { double __d; int __i[2]; }) {__d: __x}).__i[1] | 0x800fffffu) + 1) >> 31)); } # endif /* __USE_MISC */ /* Undefine some of the large macros which are not used anymore. */ # undef __atan2_code # ifdef __FAST_MATH__ # undef __expm1_code # undef __exp_code # undef __sincos_code # endif /* __FAST_MATH__ */ # endif /* __NO_MATH_INLINES */ /* This code is used internally in the GNU libc. */ # ifdef __LIBC_INTERNAL_MATH_INLINES __inline_mathop (__ieee754_sqrt, "fsqrt") __inline_mathcode2 (__ieee754_atan2, __y, __x, register long double __value; __asm __volatile__ ("fpatan\n\t" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value;) # endif #endif /* !__x86_64__ */ �����������������������������������������������������������������������������������������������������������������������������������������������bits/fcntl.h����������������������������������������������������������������������������������������0000644�����������������00000004305�14763166030�0006774 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* O_*, F_*, FD_* bit values for Linux/x86. Copyright (C) 2001-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _FCNTL_H # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." #endif #ifdef __x86_64__ # define __O_LARGEFILE 0 #endif #ifdef __x86_64__ /* Not necessary, we always have 64-bit offsets. */ # define F_GETLK64 5 /* Get record locking info. */ # define F_SETLK64 6 /* Set record locking info (non-blocking). */ # define F_SETLKW64 7 /* Set record locking info (blocking). */ #endif struct flock { short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ #ifndef __USE_FILE_OFFSET64 __off_t l_start; /* Offset where the lock begins. */ __off_t l_len; /* Size of the locked area; zero means until EOF. */ #else __off64_t l_start; /* Offset where the lock begins. */ __off64_t l_len; /* Size of the locked area; zero means until EOF. */ #endif __pid_t l_pid; /* Process holding the lock. */ }; #ifdef __USE_LARGEFILE64 struct flock64 { short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ __off64_t l_start; /* Offset where the lock begins. */ __off64_t l_len; /* Size of the locked area; zero means until EOF. */ __pid_t l_pid; /* Process holding the lock. */ }; #endif /* Include generic Linux declarations. */ #include <bits/fcntl-linux.h> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/utmp.h�����������������������������������������������������������������������������������������0000644�����������������00000007577�14763166030�0006671 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* The `struct utmp' type, describing entries in the utmp file. GNU version. Copyright (C) 1993-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _UTMP_H # error "Never include <bits/utmp.h> directly; use <utmp.h> instead." #endif #include <paths.h> #include <sys/time.h> #include <sys/types.h> #include <bits/wordsize.h> #define UT_LINESIZE 32 #define UT_NAMESIZE 32 #define UT_HOSTSIZE 256 /* The structure describing an entry in the database of previous logins. */ struct lastlog { #ifdef __WORDSIZE_TIME64_COMPAT32 int32_t ll_time; #else __time_t ll_time; #endif char ll_line[UT_LINESIZE]; char ll_host[UT_HOSTSIZE]; }; /* The structure describing the status of a terminated process. This type is used in `struct utmp' below. */ struct exit_status { short int e_termination; /* Process termination status. */ short int e_exit; /* Process exit status. */ }; /* The structure describing an entry in the user accounting database. */ struct utmp { short int ut_type; /* Type of login. */ pid_t ut_pid; /* Process ID of login process. */ char ut_line[UT_LINESIZE]; /* Devicename. */ char ut_id[4]; /* Inittab ID. */ char ut_user[UT_NAMESIZE]; /* Username. */ char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */ struct exit_status ut_exit; /* Exit status of a process marked as DEAD_PROCESS. */ /* The ut_session and ut_tv fields must be the same size when compiled 32- and 64-bit. This allows data files and shared memory to be shared between 32- and 64-bit applications. */ #ifdef __WORDSIZE_TIME64_COMPAT32 int32_t ut_session; /* Session ID, used for windowing. */ struct { int32_t tv_sec; /* Seconds. */ int32_t tv_usec; /* Microseconds. */ } ut_tv; /* Time entry was made. */ #else long int ut_session; /* Session ID, used for windowing. */ struct timeval ut_tv; /* Time entry was made. */ #endif int32_t ut_addr_v6[4]; /* Internet address of remote host. */ char __unused[20]; /* Reserved for future use. */ }; /* Backwards compatibility hacks. */ #define ut_name ut_user #ifndef _NO_UT_TIME /* We have a problem here: `ut_time' is also used otherwise. Define _NO_UT_TIME if the compiler complains. */ # define ut_time ut_tv.tv_sec #endif #define ut_xtime ut_tv.tv_sec #define ut_addr ut_addr_v6[0] /* Values for the `ut_type' field of a `struct utmp'. */ #define EMPTY 0 /* No valid user accounting information. */ #define RUN_LVL 1 /* The system's runlevel. */ #define BOOT_TIME 2 /* Time of system boot. */ #define NEW_TIME 3 /* Time after system clock changed. */ #define OLD_TIME 4 /* Time when system clock changed. */ #define INIT_PROCESS 5 /* Process spawned by the init process. */ #define LOGIN_PROCESS 6 /* Session leader of a logged in user. */ #define USER_PROCESS 7 /* Normal process. */ #define DEAD_PROCESS 8 /* Terminated process. */ #define ACCOUNTING 9 /* Old Linux name for the EMPTY type. */ #define UT_UNKNOWN EMPTY /* Tell the user that we have a modern system with UT_HOST, UT_PID, UT_TYPE, UT_ID and UT_TV fields. */ #define _HAVE_UT_TYPE 1 #define _HAVE_UT_PID 1 #define _HAVE_UT_ID 1 #define _HAVE_UT_TV 1 #define _HAVE_UT_HOST 1 ���������������������������������������������������������������������������������������������������������������������������������bits/stdio2.h���������������������������������������������������������������������������������������0000644�����������������00000030562�14763166030�0007076 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Checking macros for stdio functions. Copyright (C) 2004, 2005, 2007, 2008, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _STDIO_H # error "Never include <bits/stdio2.h> directly; use <stdio.h> instead." #endif extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen, const char *__restrict __format, ...) __THROW; extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen, const char *__restrict __format, _G_va_list __ap) __THROW; #ifdef __va_arg_pack __fortify_function int __NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...)) { return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, __bos (__s), __fmt, __va_arg_pack ()); } #elif !defined __cplusplus # define sprintf(str, ...) \ __builtin___sprintf_chk (str, __USE_FORTIFY_LEVEL - 1, __bos (str), \ __VA_ARGS__) #endif __fortify_function int __NTH (vsprintf (char *__restrict __s, const char *__restrict __fmt, _G_va_list __ap)) { return __builtin___vsprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, __bos (__s), __fmt, __ap); } #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98 extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag, size_t __slen, const char *__restrict __format, ...) __THROW; extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag, size_t __slen, const char *__restrict __format, _G_va_list __ap) __THROW; # ifdef __va_arg_pack __fortify_function int __NTH (snprintf (char *__restrict __s, size_t __n, const char *__restrict __fmt, ...)) { return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, __bos (__s), __fmt, __va_arg_pack ()); } # elif !defined __cplusplus # define snprintf(str, len, ...) \ __builtin___snprintf_chk (str, len, __USE_FORTIFY_LEVEL - 1, __bos (str), \ __VA_ARGS__) # endif __fortify_function int __NTH (vsnprintf (char *__restrict __s, size_t __n, const char *__restrict __fmt, _G_va_list __ap)) { return __builtin___vsnprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, __bos (__s), __fmt, __ap); } #endif #if __USE_FORTIFY_LEVEL > 1 extern int __fprintf_chk (FILE *__restrict __stream, int __flag, const char *__restrict __format, ...); extern int __printf_chk (int __flag, const char *__restrict __format, ...); extern int __vfprintf_chk (FILE *__restrict __stream, int __flag, const char *__restrict __format, _G_va_list __ap); extern int __vprintf_chk (int __flag, const char *__restrict __format, _G_va_list __ap); # ifdef __va_arg_pack __fortify_function int fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) { return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); } __fortify_function int printf (const char *__restrict __fmt, ...) { return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); } # elif !defined __cplusplus # define printf(...) \ __printf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__) # define fprintf(stream, ...) \ __fprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) # endif __fortify_function int vprintf (const char *__restrict __fmt, _G_va_list __ap) { #ifdef __USE_EXTERN_INLINES return __vfprintf_chk (stdout, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); #else return __vprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __ap); #endif } __fortify_function int vfprintf (FILE *__restrict __stream, const char *__restrict __fmt, _G_va_list __ap) { return __vfprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } # ifdef __USE_XOPEN2K8 extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); extern int __vdprintf_chk (int __fd, int __flag, const char *__restrict __fmt, _G_va_list __arg) __attribute__ ((__format__ (__printf__, 3, 0))); # ifdef __va_arg_pack __fortify_function int dprintf (int __fd, const char *__restrict __fmt, ...) { return __dprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); } # elif !defined __cplusplus # define dprintf(fd, ...) \ __dprintf_chk (fd, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) # endif __fortify_function int vdprintf (int __fd, const char *__restrict __fmt, _G_va_list __ap) { return __vdprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } # endif # ifdef __USE_GNU extern int __asprintf_chk (char **__restrict __ptr, int __flag, const char *__restrict __fmt, ...) __THROW __attribute__ ((__format__ (__printf__, 3, 4))) __wur; extern int __vasprintf_chk (char **__restrict __ptr, int __flag, const char *__restrict __fmt, _G_va_list __arg) __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur; extern int __obstack_printf_chk (struct obstack *__restrict __obstack, int __flag, const char *__restrict __format, ...) __THROW __attribute__ ((__format__ (__printf__, 3, 4))); extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack, int __flag, const char *__restrict __format, _G_va_list __args) __THROW __attribute__ ((__format__ (__printf__, 3, 0))); # ifdef __va_arg_pack __fortify_function int __NTH (asprintf (char **__restrict __ptr, const char *__restrict __fmt, ...)) { return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); } __fortify_function int __NTH (__asprintf (char **__restrict __ptr, const char *__restrict __fmt, ...)) { return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); } __fortify_function int __NTH (obstack_printf (struct obstack *__restrict __obstack, const char *__restrict __fmt, ...)) { return __obstack_printf_chk (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); } # elif !defined __cplusplus # define asprintf(ptr, ...) \ __asprintf_chk (ptr, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) # define __asprintf(ptr, ...) \ __asprintf_chk (ptr, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) # define obstack_printf(obstack, ...) \ __obstack_printf_chk (obstack, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) # endif __fortify_function int __NTH (vasprintf (char **__restrict __ptr, const char *__restrict __fmt, _G_va_list __ap)) { return __vasprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } __fortify_function int __NTH (obstack_vprintf (struct obstack *__restrict __obstack, const char *__restrict __fmt, _G_va_list __ap)) { return __obstack_vprintf_chk (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } # endif #endif #if !defined __USE_ISOC11 \ || (defined __cplusplus && __cplusplus <= 201103L && !defined __USE_GNU) extern char *__gets_chk (char *__str, size_t) __wur; extern char *__REDIRECT (__gets_warn, (char *__str), gets) __wur __warnattr ("please use fgets or getline instead, gets can't " "specify buffer size"); __fortify_function __wur char * gets (char *__str) { if (__bos (__str) != (size_t) -1) return __gets_chk (__str, __bos (__str)); return __gets_warn (__str); } #endif extern char *__fgets_chk (char *__restrict __s, size_t __size, int __n, FILE *__restrict __stream) __wur; extern char *__REDIRECT (__fgets_alias, (char *__restrict __s, int __n, FILE *__restrict __stream), fgets) __wur; extern char *__REDIRECT (__fgets_chk_warn, (char *__restrict __s, size_t __size, int __n, FILE *__restrict __stream), __fgets_chk) __wur __warnattr ("fgets called with bigger size than length " "of destination buffer"); __fortify_function __wur char * fgets (char *__restrict __s, int __n, FILE *__restrict __stream) { if (__bos (__s) != (size_t) -1) { if (!__builtin_constant_p (__n) || __n <= 0) return __fgets_chk (__s, __bos (__s), __n, __stream); if ((size_t) __n > __bos (__s)) return __fgets_chk_warn (__s, __bos (__s), __n, __stream); } return __fgets_alias (__s, __n, __stream); } extern size_t __fread_chk (void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream) __wur; extern size_t __REDIRECT (__fread_alias, (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream), fread) __wur; extern size_t __REDIRECT (__fread_chk_warn, (void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream), __fread_chk) __wur __warnattr ("fread called with bigger size * nmemb than length " "of destination buffer"); __fortify_function __wur size_t fread (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) { if (__bos0 (__ptr) != (size_t) -1) { if (!__builtin_constant_p (__size) || !__builtin_constant_p (__n) || (__size | __n) >= (((size_t) 1) << (8 * sizeof (size_t) / 2))) return __fread_chk (__ptr, __bos0 (__ptr), __size, __n, __stream); if (__size * __n > __bos0 (__ptr)) return __fread_chk_warn (__ptr, __bos0 (__ptr), __size, __n, __stream); } return __fread_alias (__ptr, __size, __n, __stream); } #ifdef __USE_GNU extern char *__fgets_unlocked_chk (char *__restrict __s, size_t __size, int __n, FILE *__restrict __stream) __wur; extern char *__REDIRECT (__fgets_unlocked_alias, (char *__restrict __s, int __n, FILE *__restrict __stream), fgets_unlocked) __wur; extern char *__REDIRECT (__fgets_unlocked_chk_warn, (char *__restrict __s, size_t __size, int __n, FILE *__restrict __stream), __fgets_unlocked_chk) __wur __warnattr ("fgets_unlocked called with bigger size than length " "of destination buffer"); __fortify_function __wur char * fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream) { if (__bos (__s) != (size_t) -1) { if (!__builtin_constant_p (__n) || __n <= 0) return __fgets_unlocked_chk (__s, __bos (__s), __n, __stream); if ((size_t) __n > __bos (__s)) return __fgets_unlocked_chk_warn (__s, __bos (__s), __n, __stream); } return __fgets_unlocked_alias (__s, __n, __stream); } #endif #ifdef __USE_MISC # undef fread_unlocked extern size_t __fread_unlocked_chk (void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream) __wur; extern size_t __REDIRECT (__fread_unlocked_alias, (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream), fread_unlocked) __wur; extern size_t __REDIRECT (__fread_unlocked_chk_warn, (void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream), __fread_unlocked_chk) __wur __warnattr ("fread_unlocked called with bigger size * nmemb than " "length of destination buffer"); __fortify_function __wur size_t fread_unlocked (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) { if (__bos0 (__ptr) != (size_t) -1) { if (!__builtin_constant_p (__size) || !__builtin_constant_p (__n) || (__size | __n) >= (((size_t) 1) << (8 * sizeof (size_t) / 2))) return __fread_unlocked_chk (__ptr, __bos0 (__ptr), __size, __n, __stream); if (__size * __n > __bos0 (__ptr)) return __fread_unlocked_chk_warn (__ptr, __bos0 (__ptr), __size, __n, __stream); } # ifdef __USE_EXTERN_INLINES if (__builtin_constant_p (__size) && __builtin_constant_p (__n) && (__size | __n) < (((size_t) 1) << (8 * sizeof (size_t) / 2)) && __size * __n <= 8) { size_t __cnt = __size * __n; char *__cptr = (char *) __ptr; if (__cnt == 0) return 0; for (; __cnt > 0; --__cnt) { int __c = _IO_getc_unlocked (__stream); if (__c == EOF) break; *__cptr++ = __c; } return (__cptr - (char *) __ptr) / __size; } # endif return __fread_unlocked_alias (__ptr, __size, __n, __stream); } #endif ����������������������������������������������������������������������������������������������������������������������������������������������bits/time.h�����������������������������������������������������������������������������������������0000644�����������������00000006542�14763166030�0006631 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* System-dependent timing definitions. Linux version. Copyright (C) 1996,1997,1999-2003,2010,2011,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * Never include this file directly; use <time.h> instead. */ #if defined __need_timeval || defined __USE_GNU # ifndef _STRUCT_TIMEVAL # define _STRUCT_TIMEVAL 1 # include <bits/types.h> /* A time value that is accurate to the nearest microsecond but also has a range of years. */ struct timeval { __time_t tv_sec; /* Seconds. */ __suseconds_t tv_usec; /* Microseconds. */ }; # endif /* struct timeval */ #endif #ifndef __need_timeval # ifndef _BITS_TIME_H # define _BITS_TIME_H 1 /* ISO/IEC 9899:1990 7.12.1: <time.h> The macro `CLOCKS_PER_SEC' is the number per second of the value returned by the `clock' function. */ /* CAE XSH, Issue 4, Version 2: <time.h> The value of CLOCKS_PER_SEC is required to be 1 million on all XSI-conformant systems. */ # define CLOCKS_PER_SEC 1000000l # if (!defined __STRICT_ANSI__ || defined __USE_POSIX) \ && !defined __USE_XOPEN2K /* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK presents the real value for clock ticks per second for the system. */ # include <bits/types.h> extern long int __sysconf (int); # define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */ # endif # ifdef __USE_POSIX199309 /* Identifier for system-wide realtime clock. */ # define CLOCK_REALTIME 0 /* Monotonic system-wide clock. */ # define CLOCK_MONOTONIC 1 /* High-resolution timer from the CPU. */ # define CLOCK_PROCESS_CPUTIME_ID 2 /* Thread-specific CPU-time clock. */ # define CLOCK_THREAD_CPUTIME_ID 3 /* Monotonic system-wide clock, not adjusted for frequency scaling. */ # define CLOCK_MONOTONIC_RAW 4 /* Identifier for system-wide realtime clock, updated only on ticks. */ # define CLOCK_REALTIME_COARSE 5 /* Monotonic system-wide clock, updated only on ticks. */ # define CLOCK_MONOTONIC_COARSE 6 /* Monotonic system-wide clock that includes time spent in suspension. */ # define CLOCK_BOOTTIME 7 /* Like CLOCK_REALTIME but also wakes suspended system. */ # define CLOCK_REALTIME_ALARM 8 /* Like CLOCK_BOOTTIME but also wakes suspended system. */ # define CLOCK_BOOTTIME_ALARM 9 /* Like CLOCK_REALTIME but in International Atomic Time. */ # define CLOCK_TAI 11 /* Flag to indicate time is absolute. */ # define TIMER_ABSTIME 1 # endif # ifdef __USE_GNU # include <bits/timex.h> __BEGIN_DECLS /* Tune a POSIX clock. */ extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __THROW; __END_DECLS # endif /* use GNU */ # endif /* bits/time.h */ #endif #undef __need_timeval ��������������������������������������������������������������������������������������������������������������������������������������������������������������bits/syslog-path.h����������������������������������������������������������������������������������0000644�����������������00000002037�14763166030�0010140 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* <bits/syslog-path.h> -- _PATH_LOG definition Copyright (C) 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SYSLOG_H # error "Never include this file directly. Use <sys/syslog.h> instead" #endif #ifndef _BITS_SYSLOG_PATH_H #define _BITS_SYSLOG_PATH_H 1 #define _PATH_LOG "/dev/log" #endif /* bits/syslog-path.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/sysctl.h���������������������������������������������������������������������������������������0000644�����������������00000001575�14763166030�0007215 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #if defined __x86_64__ && defined __ILP32__ # error "sysctl system call is unsupported in x32 kernel" #endif �����������������������������������������������������������������������������������������������������������������������������������bits/mqueue.h���������������������������������������������������������������������������������������0000644�����������������00000002335�14763166030�0007170 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2004-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MQUEUE_H # error "Never use <bits/mqueue.h> directly; include <mqueue.h> instead." #endif #include <bits/types.h> typedef int mqd_t; struct mq_attr { __syscall_slong_t mq_flags; /* Message queue flags. */ __syscall_slong_t mq_maxmsg; /* Maximum number of messages. */ __syscall_slong_t mq_msgsize; /* Maximum message size. */ __syscall_slong_t mq_curmsgs; /* Number of messages currently queued. */ __syscall_slong_t __pad[4]; }; ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/stdio.h����������������������������������������������������������������������������������������0000644�����������������00000012716�14763166030�0007015 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Optimizing macros and inline functions for stdio functions. Copyright (C) 1998,2000,2001,2004,2007,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _STDIO_H # error "Never include <bits/stdio.h> directly; use <stdio.h> instead." #endif #ifndef __extern_inline # define __STDIO_INLINE inline #else # define __STDIO_INLINE __extern_inline #endif #ifdef __USE_EXTERN_INLINES /* For -D_FORTIFY_SOURCE{,=2} bits/stdio2.h will define a different inline. */ # if !(__USE_FORTIFY_LEVEL > 0 && defined __fortify_function) /* Write formatted output to stdout from argument list ARG. */ __STDIO_INLINE int vprintf (const char *__restrict __fmt, _G_va_list __arg) { return vfprintf (stdout, __fmt, __arg); } # endif /* Read a character from stdin. */ __STDIO_INLINE int getchar (void) { return _IO_getc (stdin); } # ifdef __USE_MISC /* Faster version when locking is not necessary. */ __STDIO_INLINE int fgetc_unlocked (FILE *__fp) { return _IO_getc_unlocked (__fp); } # endif /* misc */ # if defined __USE_POSIX || defined __USE_MISC /* This is defined in POSIX.1:1996. */ __STDIO_INLINE int getc_unlocked (FILE *__fp) { return _IO_getc_unlocked (__fp); } /* This is defined in POSIX.1:1996. */ __STDIO_INLINE int getchar_unlocked (void) { return _IO_getc_unlocked (stdin); } # endif /* POSIX || misc */ /* Write a character to stdout. */ __STDIO_INLINE int putchar (int __c) { return _IO_putc (__c, stdout); } # ifdef __USE_MISC /* Faster version when locking is not necessary. */ __STDIO_INLINE int fputc_unlocked (int __c, FILE *__stream) { return _IO_putc_unlocked (__c, __stream); } # endif /* misc */ # if defined __USE_POSIX || defined __USE_MISC /* This is defined in POSIX.1:1996. */ __STDIO_INLINE int putc_unlocked (int __c, FILE *__stream) { return _IO_putc_unlocked (__c, __stream); } /* This is defined in POSIX.1:1996. */ __STDIO_INLINE int putchar_unlocked (int __c) { return _IO_putc_unlocked (__c, stdout); } # endif /* POSIX || misc */ # ifdef __USE_GNU /* Like `getdelim', but reads up to a newline. */ __STDIO_INLINE _IO_ssize_t getline (char **__lineptr, size_t *__n, FILE *__stream) { return __getdelim (__lineptr, __n, '\n', __stream); } # endif /* GNU */ # ifdef __USE_MISC /* Faster versions when locking is not required. */ __STDIO_INLINE int __NTH (feof_unlocked (FILE *__stream)) { return _IO_feof_unlocked (__stream); } /* Faster versions when locking is not required. */ __STDIO_INLINE int __NTH (ferror_unlocked (FILE *__stream)) { return _IO_ferror_unlocked (__stream); } # endif /* misc */ #endif /* Use extern inlines. */ #if defined __USE_MISC && defined __GNUC__ && defined __OPTIMIZE__ \ && !defined __cplusplus /* Perform some simple optimizations. */ # define fread_unlocked(ptr, size, n, stream) \ (__extension__ ((__builtin_constant_p (size) && __builtin_constant_p (n) \ && (size_t) (size) * (size_t) (n) <= 8 \ && (size_t) (size) != 0) \ ? ({ char *__ptr = (char *) (ptr); \ FILE *__stream = (stream); \ size_t __cnt; \ for (__cnt = (size_t) (size) * (size_t) (n); \ __cnt > 0; --__cnt) \ { \ int __c = _IO_getc_unlocked (__stream); \ if (__c == EOF) \ break; \ *__ptr++ = __c; \ } \ ((size_t) (size) * (size_t) (n) - __cnt) \ / (size_t) (size); }) \ : (((__builtin_constant_p (size) && (size_t) (size) == 0) \ || (__builtin_constant_p (n) && (size_t) (n) == 0)) \ /* Evaluate all parameters once. */ \ ? ((void) (ptr), (void) (stream), (void) (size), \ (void) (n), (size_t) 0) \ : fread_unlocked (ptr, size, n, stream)))) # define fwrite_unlocked(ptr, size, n, stream) \ (__extension__ ((__builtin_constant_p (size) && __builtin_constant_p (n) \ && (size_t) (size) * (size_t) (n) <= 8 \ && (size_t) (size) != 0) \ ? ({ const char *__ptr = (const char *) (ptr); \ FILE *__stream = (stream); \ size_t __cnt; \ for (__cnt = (size_t) (size) * (size_t) (n); \ __cnt > 0; --__cnt) \ if (_IO_putc_unlocked (*__ptr++, __stream) == EOF) \ break; \ ((size_t) (size) * (size_t) (n) - __cnt) \ / (size_t) (size); }) \ : (((__builtin_constant_p (size) && (size_t) (size) == 0) \ || (__builtin_constant_p (n) && (size_t) (n) == 0)) \ /* Evaluate all parameters once. */ \ ? ((void) (ptr), (void) (stream), (void) (size), \ (void) (n), (size_t) 0) \ : fwrite_unlocked (ptr, size, n, stream)))) #endif /* Define helper macro. */ #undef __STDIO_INLINE ��������������������������������������������������bits/siginfo.h��������������������������������������������������������������������������������������0000644�����������������00000023501�14763166030�0007323 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* siginfo_t, sigevent and constants. Linux x86-64 version. Copyright (C) 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #if !defined _SIGNAL_H && !defined __need_siginfo_t \ && !defined __need_sigevent_t # error "Never include this file directly. Use <signal.h> instead" #endif #include <bits/wordsize.h> #if (!defined __have_sigval_t \ && (defined _SIGNAL_H || defined __need_siginfo_t \ || defined __need_sigevent_t)) # define __have_sigval_t 1 /* Type for data associated with a signal. */ typedef union sigval { int sival_int; void *sival_ptr; } sigval_t; #endif #if (!defined __have_siginfo_t \ && (defined _SIGNAL_H || defined __need_siginfo_t)) # define __have_siginfo_t 1 # define __SI_MAX_SIZE 128 # if __WORDSIZE == 64 # define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4) # else # define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3) # endif # if defined __x86_64__ && __WORDSIZE == 32 /* si_utime and si_stime must be 4 byte aligned for x32 to match the kernel. We align siginfo_t to 8 bytes so that si_utime and si_stime are actually aligned to 8 bytes since their offsets are multiple of 8 bytes. */ typedef __clock_t __attribute__ ((__aligned__ (4))) __sigchld_clock_t; # define __SI_ALIGNMENT __attribute__ ((__aligned__ (8))) # else typedef __clock_t __sigchld_clock_t; # define __SI_ALIGNMENT # endif typedef struct { int si_signo; /* Signal number. */ int si_errno; /* If non-zero, an errno value associated with this signal, as defined in <errno.h>. */ int si_code; /* Signal code. */ union { int _pad[__SI_PAD_SIZE]; /* kill(). */ struct { __pid_t si_pid; /* Sending process ID. */ __uid_t si_uid; /* Real user ID of sending process. */ } _kill; /* POSIX.1b timers. */ struct { int si_tid; /* Timer ID. */ int si_overrun; /* Overrun count. */ sigval_t si_sigval; /* Signal value. */ } _timer; /* POSIX.1b signals. */ struct { __pid_t si_pid; /* Sending process ID. */ __uid_t si_uid; /* Real user ID of sending process. */ sigval_t si_sigval; /* Signal value. */ } _rt; /* SIGCHLD. */ struct { __pid_t si_pid; /* Which child. */ __uid_t si_uid; /* Real user ID of sending process. */ int si_status; /* Exit value or signal. */ __sigchld_clock_t si_utime; __sigchld_clock_t si_stime; } _sigchld; /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ struct { void *si_addr; /* Faulting insn/memory ref. */ } _sigfault; /* SIGPOLL. */ struct { long int si_band; /* Band event for SIGPOLL. */ int si_fd; } _sigpoll; /* SIGSYS. */ struct { void *_call_addr; /* Calling user insn. */ int _syscall; /* Triggering system call number. */ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ } _sigsys; } _sifields; } siginfo_t __SI_ALIGNMENT; /* X/Open requires some more fields with fixed names. */ # define si_pid _sifields._kill.si_pid # define si_uid _sifields._kill.si_uid # define si_timerid _sifields._timer.si_tid # define si_overrun _sifields._timer.si_overrun # define si_status _sifields._sigchld.si_status # define si_utime _sifields._sigchld.si_utime # define si_stime _sifields._sigchld.si_stime # define si_value _sifields._rt.si_sigval # define si_int _sifields._rt.si_sigval.sival_int # define si_ptr _sifields._rt.si_sigval.sival_ptr # define si_addr _sifields._sigfault.si_addr # define si_band _sifields._sigpoll.si_band # define si_fd _sifields._sigpoll.si_fd # define si_call_addr _sifields._sigsys._call_addr # define si_syscall _sifields._sigsys._syscall # define si_arch _sifields._sigsys._arch /* Values for `si_code'. Positive values are reserved for kernel-generated signals. */ enum { SI_ASYNCNL = -60, /* Sent by asynch name lookup completion. */ # define SI_ASYNCNL SI_ASYNCNL SI_TKILL = -6, /* Sent by tkill. */ # define SI_TKILL SI_TKILL SI_SIGIO, /* Sent by queued SIGIO. */ # define SI_SIGIO SI_SIGIO SI_ASYNCIO, /* Sent by AIO completion. */ # define SI_ASYNCIO SI_ASYNCIO SI_MESGQ, /* Sent by real time mesq state change. */ # define SI_MESGQ SI_MESGQ SI_TIMER, /* Sent by timer expiration. */ # define SI_TIMER SI_TIMER SI_QUEUE, /* Sent by sigqueue. */ # define SI_QUEUE SI_QUEUE SI_USER, /* Sent by kill, sigsend. */ # define SI_USER SI_USER SI_KERNEL = 0x80 /* Send by kernel. */ #define SI_KERNEL SI_KERNEL }; /* `si_code' values for SIGILL signal. */ enum { ILL_ILLOPC = 1, /* Illegal opcode. */ # define ILL_ILLOPC ILL_ILLOPC ILL_ILLOPN, /* Illegal operand. */ # define ILL_ILLOPN ILL_ILLOPN ILL_ILLADR, /* Illegal addressing mode. */ # define ILL_ILLADR ILL_ILLADR ILL_ILLTRP, /* Illegal trap. */ # define ILL_ILLTRP ILL_ILLTRP ILL_PRVOPC, /* Privileged opcode. */ # define ILL_PRVOPC ILL_PRVOPC ILL_PRVREG, /* Privileged register. */ # define ILL_PRVREG ILL_PRVREG ILL_COPROC, /* Coprocessor error. */ # define ILL_COPROC ILL_COPROC ILL_BADSTK /* Internal stack error. */ # define ILL_BADSTK ILL_BADSTK }; /* `si_code' values for SIGFPE signal. */ enum { FPE_INTDIV = 1, /* Integer divide by zero. */ # define FPE_INTDIV FPE_INTDIV FPE_INTOVF, /* Integer overflow. */ # define FPE_INTOVF FPE_INTOVF FPE_FLTDIV, /* Floating point divide by zero. */ # define FPE_FLTDIV FPE_FLTDIV FPE_FLTOVF, /* Floating point overflow. */ # define FPE_FLTOVF FPE_FLTOVF FPE_FLTUND, /* Floating point underflow. */ # define FPE_FLTUND FPE_FLTUND FPE_FLTRES, /* Floating point inexact result. */ # define FPE_FLTRES FPE_FLTRES FPE_FLTINV, /* Floating point invalid operation. */ # define FPE_FLTINV FPE_FLTINV FPE_FLTSUB /* Subscript out of range. */ # define FPE_FLTSUB FPE_FLTSUB }; /* `si_code' values for SIGSEGV signal. */ enum { SEGV_MAPERR = 1, /* Address not mapped to object. */ # define SEGV_MAPERR SEGV_MAPERR SEGV_ACCERR /* Invalid permissions for mapped object. */ # define SEGV_ACCERR SEGV_ACCERR }; /* `si_code' values for SIGBUS signal. */ enum { BUS_ADRALN = 1, /* Invalid address alignment. */ # define BUS_ADRALN BUS_ADRALN BUS_ADRERR, /* Non-existant physical address. */ # define BUS_ADRERR BUS_ADRERR BUS_OBJERR /* Object specific hardware error. */ # define BUS_OBJERR BUS_OBJERR }; /* `si_code' values for SIGTRAP signal. */ enum { TRAP_BRKPT = 1, /* Process breakpoint. */ # define TRAP_BRKPT TRAP_BRKPT TRAP_TRACE /* Process trace trap. */ # define TRAP_TRACE TRAP_TRACE }; /* `si_code' values for SIGCHLD signal. */ enum { CLD_EXITED = 1, /* Child has exited. */ # define CLD_EXITED CLD_EXITED CLD_KILLED, /* Child was killed. */ # define CLD_KILLED CLD_KILLED CLD_DUMPED, /* Child terminated abnormally. */ # define CLD_DUMPED CLD_DUMPED CLD_TRAPPED, /* Traced child has trapped. */ # define CLD_TRAPPED CLD_TRAPPED CLD_STOPPED, /* Child has stopped. */ # define CLD_STOPPED CLD_STOPPED CLD_CONTINUED /* Stopped child has continued. */ # define CLD_CONTINUED CLD_CONTINUED }; /* `si_code' values for SIGPOLL signal. */ enum { POLL_IN = 1, /* Data input available. */ # define POLL_IN POLL_IN POLL_OUT, /* Output buffers available. */ # define POLL_OUT POLL_OUT POLL_MSG, /* Input message available. */ # define POLL_MSG POLL_MSG POLL_ERR, /* I/O error. */ # define POLL_ERR POLL_ERR POLL_PRI, /* High priority input available. */ # define POLL_PRI POLL_PRI POLL_HUP /* Device disconnected. */ # define POLL_HUP POLL_HUP }; # undef __need_siginfo_t #endif /* !have siginfo_t && (have _SIGNAL_H || need siginfo_t). */ #if (defined _SIGNAL_H || defined __need_sigevent_t) \ && !defined __have_sigevent_t # define __have_sigevent_t 1 /* Structure to transport application-defined values with signals. */ # define __SIGEV_MAX_SIZE 64 # if __WORDSIZE == 64 # define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4) # else # define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3) # endif /* Forward declaration. */ # ifndef __have_pthread_attr_t typedef union pthread_attr_t pthread_attr_t; # define __have_pthread_attr_t 1 # endif typedef struct sigevent { sigval_t sigev_value; int sigev_signo; int sigev_notify; union { int _pad[__SIGEV_PAD_SIZE]; /* When SIGEV_SIGNAL and SIGEV_THREAD_ID set, LWP ID of the thread to receive the signal. */ __pid_t _tid; struct { void (*_function) (sigval_t); /* Function to start. */ pthread_attr_t *_attribute; /* Thread attributes. */ } _sigev_thread; } _sigev_un; } sigevent_t; /* POSIX names to access some of the members. */ # define sigev_notify_function _sigev_un._sigev_thread._function # define sigev_notify_attributes _sigev_un._sigev_thread._attribute /* `sigev_notify' values. */ enum { SIGEV_SIGNAL = 0, /* Notify via signal. */ # define SIGEV_SIGNAL SIGEV_SIGNAL SIGEV_NONE, /* Other notification: meaningless. */ # define SIGEV_NONE SIGEV_NONE SIGEV_THREAD, /* Deliver via thread creation. */ # define SIGEV_THREAD SIGEV_THREAD SIGEV_THREAD_ID = 4 /* Send signal to specific thread. */ #define SIGEV_THREAD_ID SIGEV_THREAD_ID }; #endif /* have _SIGNAL_H. */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/inotify.h��������������������������������������������������������������������������������������0000644�����������������00000002067�14763166030�0007352 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2005-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_INOTIFY_H # error "Never use <bits/inotify.h> directly; include <sys/inotify.h> instead." #endif /* Flags for the parameter of inotify_init1. */ enum { IN_CLOEXEC = 02000000, #define IN_CLOEXEC IN_CLOEXEC IN_NONBLOCK = 00004000 #define IN_NONBLOCK IN_NONBLOCK }; �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/signum.h���������������������������������������������������������������������������������������0000644�����������������00000006531�14763166030�0007173 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Signal number definitions. Linux version. Copyright (C) 1995,1996,1997,1998,1999,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifdef _SIGNAL_H /* Fake signal functions. */ #define SIG_ERR ((__sighandler_t) -1) /* Error return. */ #define SIG_DFL ((__sighandler_t) 0) /* Default action. */ #define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ #ifdef __USE_UNIX98 # define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */ #endif /* Signals. */ #define SIGHUP 1 /* Hangup (POSIX). */ #define SIGINT 2 /* Interrupt (ANSI). */ #define SIGQUIT 3 /* Quit (POSIX). */ #define SIGILL 4 /* Illegal instruction (ANSI). */ #define SIGTRAP 5 /* Trace trap (POSIX). */ #define SIGABRT 6 /* Abort (ANSI). */ #define SIGIOT 6 /* IOT trap (4.2 BSD). */ #define SIGBUS 7 /* BUS error (4.2 BSD). */ #define SIGFPE 8 /* Floating-point exception (ANSI). */ #define SIGKILL 9 /* Kill, unblockable (POSIX). */ #define SIGUSR1 10 /* User-defined signal 1 (POSIX). */ #define SIGSEGV 11 /* Segmentation violation (ANSI). */ #define SIGUSR2 12 /* User-defined signal 2 (POSIX). */ #define SIGPIPE 13 /* Broken pipe (POSIX). */ #define SIGALRM 14 /* Alarm clock (POSIX). */ #define SIGTERM 15 /* Termination (ANSI). */ #define SIGSTKFLT 16 /* Stack fault. */ #define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */ #define SIGCHLD 17 /* Child status has changed (POSIX). */ #define SIGCONT 18 /* Continue (POSIX). */ #define SIGSTOP 19 /* Stop, unblockable (POSIX). */ #define SIGTSTP 20 /* Keyboard stop (POSIX). */ #define SIGTTIN 21 /* Background read from tty (POSIX). */ #define SIGTTOU 22 /* Background write to tty (POSIX). */ #define SIGURG 23 /* Urgent condition on socket (4.2 BSD). */ #define SIGXCPU 24 /* CPU limit exceeded (4.2 BSD). */ #define SIGXFSZ 25 /* File size limit exceeded (4.2 BSD). */ #define SIGVTALRM 26 /* Virtual alarm clock (4.2 BSD). */ #define SIGPROF 27 /* Profiling alarm clock (4.2 BSD). */ #define SIGWINCH 28 /* Window size change (4.3 BSD, Sun). */ #define SIGPOLL SIGIO /* Pollable event occurred (System V). */ #define SIGIO 29 /* I/O now possible (4.2 BSD). */ #define SIGPWR 30 /* Power failure restart (System V). */ #define SIGSYS 31 /* Bad system call. */ #define SIGUNUSED 31 #define _NSIG 65 /* Biggest signal number + 1 (including real-time signals). */ #define SIGRTMIN (__libc_current_sigrtmin ()) #define SIGRTMAX (__libc_current_sigrtmax ()) /* These are the hard limits of the kernel. These values should not be used directly at user level. */ #define __SIGRTMIN 32 #define __SIGRTMAX (_NSIG - 1) #endif /* <signal.h> included. */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/sched.h����������������������������������������������������������������������������������������0000644�����������������00000016567�14763166030�0006771 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Definitions of constants and data structure for POSIX 1003.1b-1993 scheduling interface. Copyright (C) 1996-1999,2001-2003,2005,2006,2007,2008,2009,2011,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __need_schedparam #ifndef _SCHED_H # error "Never include <bits/sched.h> directly; use <sched.h> instead." #endif /* Scheduling algorithms. */ #define SCHED_OTHER 0 #define SCHED_FIFO 1 #define SCHED_RR 2 #ifdef __USE_GNU # define SCHED_BATCH 3 # define SCHED_IDLE 5 # define SCHED_RESET_ON_FORK 0x40000000 #endif #ifdef __USE_GNU /* Cloning flags. */ # define CSIGNAL 0x000000ff /* Signal mask to be sent at exit. */ # define CLONE_VM 0x00000100 /* Set if VM shared between processes. */ # define CLONE_FS 0x00000200 /* Set if fs info shared between processes. */ # define CLONE_FILES 0x00000400 /* Set if open files shared between processes. */ # define CLONE_SIGHAND 0x00000800 /* Set if signal handlers shared. */ # define CLONE_PTRACE 0x00002000 /* Set if tracing continues on the child. */ # define CLONE_VFORK 0x00004000 /* Set if the parent wants the child to wake it up on mm_release. */ # define CLONE_PARENT 0x00008000 /* Set if we want to have the same parent as the cloner. */ # define CLONE_THREAD 0x00010000 /* Set to add to same thread group. */ # define CLONE_NEWNS 0x00020000 /* Set to create new namespace. */ # define CLONE_SYSVSEM 0x00040000 /* Set to shared SVID SEM_UNDO semantics. */ # define CLONE_SETTLS 0x00080000 /* Set TLS info. */ # define CLONE_PARENT_SETTID 0x00100000 /* Store TID in userlevel buffer before MM copy. */ # define CLONE_CHILD_CLEARTID 0x00200000 /* Register exit futex and memory location to clear. */ # define CLONE_DETACHED 0x00400000 /* Create clone detached. */ # define CLONE_UNTRACED 0x00800000 /* Set if the tracing process can't force CLONE_PTRACE on this clone. */ # define CLONE_CHILD_SETTID 0x01000000 /* Store TID in userlevel buffer in the child. */ # define CLONE_NEWUTS 0x04000000 /* New utsname group. */ # define CLONE_NEWIPC 0x08000000 /* New ipcs. */ # define CLONE_NEWUSER 0x10000000 /* New user namespace. */ # define CLONE_NEWPID 0x20000000 /* New pid namespace. */ # define CLONE_NEWNET 0x40000000 /* New network namespace. */ # define CLONE_IO 0x80000000 /* Clone I/O context. */ #endif /* The official definition. */ struct sched_param { int __sched_priority; }; __BEGIN_DECLS #ifdef __USE_GNU /* Clone current process. */ extern int clone (int (*__fn) (void *__arg), void *__child_stack, int __flags, void *__arg, ...) __THROW; /* Unshare the specified resources. */ extern int unshare (int __flags) __THROW; /* Get index of currently used CPU. */ extern int sched_getcpu (void) __THROW; /* Switch process to namespace of type NSTYPE indicated by FD. */ extern int setns (int __fd, int __nstype) __THROW; #endif __END_DECLS #endif /* need schedparam */ #if !defined __defined_schedparam \ && (defined __need_schedparam || defined _SCHED_H) # define __defined_schedparam 1 /* Data structure to describe a process' schedulability. */ struct __sched_param { int __sched_priority; }; # undef __need_schedparam #endif #if defined _SCHED_H && !defined __cpu_set_t_defined # define __cpu_set_t_defined /* Size definition for CPU sets. */ # define __CPU_SETSIZE 1024 # define __NCPUBITS (8 * sizeof (__cpu_mask)) /* Type for array elements in 'cpu_set_t'. */ typedef unsigned long int __cpu_mask; /* Basic access functions. */ # define __CPUELT(cpu) ((cpu) / __NCPUBITS) # define __CPUMASK(cpu) ((__cpu_mask) 1 << ((cpu) % __NCPUBITS)) /* Data structure to describe CPU mask. */ typedef struct { __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS]; } cpu_set_t; /* Access functions for CPU masks. */ # if __GNUC_PREREQ (2, 91) # define __CPU_ZERO_S(setsize, cpusetp) \ do __builtin_memset (cpusetp, '\0', setsize); while (0) # else # define __CPU_ZERO_S(setsize, cpusetp) \ do { \ size_t __i; \ size_t __imax = (setsize) / sizeof (__cpu_mask); \ __cpu_mask *__bits = (cpusetp)->__bits; \ for (__i = 0; __i < __imax; ++__i) \ __bits[__i] = 0; \ } while (0) # endif # define __CPU_SET_S(cpu, setsize, cpusetp) \ (__extension__ \ ({ size_t __cpu = (cpu); \ __cpu < 8 * (setsize) \ ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ |= __CPUMASK (__cpu)) \ : 0; })) # define __CPU_CLR_S(cpu, setsize, cpusetp) \ (__extension__ \ ({ size_t __cpu = (cpu); \ __cpu < 8 * (setsize) \ ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ &= ~__CPUMASK (__cpu)) \ : 0; })) # define __CPU_ISSET_S(cpu, setsize, cpusetp) \ (__extension__ \ ({ size_t __cpu = (cpu); \ __cpu < 8 * (setsize) \ ? ((((const __cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ & __CPUMASK (__cpu))) != 0 \ : 0; })) # define __CPU_COUNT_S(setsize, cpusetp) \ __sched_cpucount (setsize, cpusetp) # if __GNUC_PREREQ (2, 91) # define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ (__builtin_memcmp (cpusetp1, cpusetp2, setsize) == 0) # else # define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ (__extension__ \ ({ const __cpu_mask *__arr1 = (cpusetp1)->__bits; \ const __cpu_mask *__arr2 = (cpusetp2)->__bits; \ size_t __imax = (setsize) / sizeof (__cpu_mask); \ size_t __i; \ for (__i = 0; __i < __imax; ++__i) \ if (__arr1[__i] != __arr2[__i]) \ break; \ __i == __imax; })) # endif # define __CPU_OP_S(setsize, destset, srcset1, srcset2, op) \ (__extension__ \ ({ cpu_set_t *__dest = (destset); \ const __cpu_mask *__arr1 = (srcset1)->__bits; \ const __cpu_mask *__arr2 = (srcset2)->__bits; \ size_t __imax = (setsize) / sizeof (__cpu_mask); \ size_t __i; \ for (__i = 0; __i < __imax; ++__i) \ ((__cpu_mask *) __dest->__bits)[__i] = __arr1[__i] op __arr2[__i]; \ __dest; })) # define __CPU_ALLOC_SIZE(count) \ ((((count) + __NCPUBITS - 1) / __NCPUBITS) * sizeof (__cpu_mask)) # define __CPU_ALLOC(count) __sched_cpualloc (count) # define __CPU_FREE(cpuset) __sched_cpufree (cpuset) __BEGIN_DECLS extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp) __THROW; extern cpu_set_t *__sched_cpualloc (size_t __count) __THROW __wur; extern void __sched_cpufree (cpu_set_t *__set) __THROW; __END_DECLS #endif �����������������������������������������������������������������������������������������������������������������������������������������bits/sigstack.h�������������������������������������������������������������������������������������0000644�����������������00000002770�14763166030�0007502 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* sigstack, sigaltstack definitions. Copyright (C) 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SIGNAL_H # error "Never include this file directly. Use <signal.h> instead" #endif /* Structure describing a signal stack (obsolete). */ struct sigstack { void *ss_sp; /* Signal stack pointer. */ int ss_onstack; /* Nonzero if executing on this stack. */ }; /* Possible values for `ss_flags.'. */ enum { SS_ONSTACK = 1, #define SS_ONSTACK SS_ONSTACK SS_DISABLE #define SS_DISABLE SS_DISABLE }; /* Minimum stack size for a signal handler. */ #define MINSIGSTKSZ 2048 /* System default stack size. */ #define SIGSTKSZ 8192 /* Alternate, preferred interface. */ typedef struct sigaltstack { void *ss_sp; int ss_flags; size_t ss_size; } stack_t; ��������bits/stdlib.h���������������������������������������������������������������������������������������0000644�����������������00000013041�14763166030�0007144 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Checking macros for stdlib functions. Copyright (C) 2005, 2007, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _STDLIB_H # error "Never include <bits/stdlib.h> directly; use <stdlib.h> instead." #endif extern char *__realpath_chk (const char *__restrict __name, char *__restrict __resolved, size_t __resolvedlen) __THROW __wur; extern char *__REDIRECT_NTH (__realpath_alias, (const char *__restrict __name, char *__restrict __resolved), realpath) __wur; extern char *__REDIRECT_NTH (__realpath_chk_warn, (const char *__restrict __name, char *__restrict __resolved, size_t __resolvedlen), __realpath_chk) __wur __warnattr ("second argument of realpath must be either NULL or at " "least PATH_MAX bytes long buffer"); __fortify_function __wur char * __NTH (realpath (const char *__restrict __name, char *__restrict __resolved)) { if (__bos (__resolved) != (size_t) -1) { #if defined _LIBC_LIMITS_H_ && defined PATH_MAX if (__bos (__resolved) < PATH_MAX) return __realpath_chk_warn (__name, __resolved, __bos (__resolved)); #endif return __realpath_chk (__name, __resolved, __bos (__resolved)); } return __realpath_alias (__name, __resolved); } extern int __ptsname_r_chk (int __fd, char *__buf, size_t __buflen, size_t __nreal) __THROW __nonnull ((2)); extern int __REDIRECT_NTH (__ptsname_r_alias, (int __fd, char *__buf, size_t __buflen), ptsname_r) __nonnull ((2)); extern int __REDIRECT_NTH (__ptsname_r_chk_warn, (int __fd, char *__buf, size_t __buflen, size_t __nreal), __ptsname_r_chk) __nonnull ((2)) __warnattr ("ptsname_r called with buflen bigger than " "size of buf"); __fortify_function int __NTH (ptsname_r (int __fd, char *__buf, size_t __buflen)) { if (__bos (__buf) != (size_t) -1) { if (!__builtin_constant_p (__buflen)) return __ptsname_r_chk (__fd, __buf, __buflen, __bos (__buf)); if (__buflen > __bos (__buf)) return __ptsname_r_chk_warn (__fd, __buf, __buflen, __bos (__buf)); } return __ptsname_r_alias (__fd, __buf, __buflen); } extern int __wctomb_chk (char *__s, wchar_t __wchar, size_t __buflen) __THROW __wur; extern int __REDIRECT_NTH (__wctomb_alias, (char *__s, wchar_t __wchar), wctomb) __wur; __fortify_function __wur int __NTH (wctomb (char *__s, wchar_t __wchar)) { /* We would have to include <limits.h> to get a definition of MB_LEN_MAX. But this would only disturb the namespace. So we define our own version here. */ #define __STDLIB_MB_LEN_MAX 16 #if defined MB_LEN_MAX && MB_LEN_MAX != __STDLIB_MB_LEN_MAX # error "Assumed value of MB_LEN_MAX wrong" #endif if (__bos (__s) != (size_t) -1 && __STDLIB_MB_LEN_MAX > __bos (__s)) return __wctomb_chk (__s, __wchar, __bos (__s)); return __wctomb_alias (__s, __wchar); } extern size_t __mbstowcs_chk (wchar_t *__restrict __dst, const char *__restrict __src, size_t __len, size_t __dstlen) __THROW; extern size_t __REDIRECT_NTH (__mbstowcs_alias, (wchar_t *__restrict __dst, const char *__restrict __src, size_t __len), mbstowcs); extern size_t __REDIRECT_NTH (__mbstowcs_chk_warn, (wchar_t *__restrict __dst, const char *__restrict __src, size_t __len, size_t __dstlen), __mbstowcs_chk) __warnattr ("mbstowcs called with dst buffer smaller than len " "* sizeof (wchar_t)"); __fortify_function size_t __NTH (mbstowcs (wchar_t *__restrict __dst, const char *__restrict __src, size_t __len)) { if (__bos (__dst) != (size_t) -1) { if (!__builtin_constant_p (__len)) return __mbstowcs_chk (__dst, __src, __len, __bos (__dst) / sizeof (wchar_t)); if (__len > __bos (__dst) / sizeof (wchar_t)) return __mbstowcs_chk_warn (__dst, __src, __len, __bos (__dst) / sizeof (wchar_t)); } return __mbstowcs_alias (__dst, __src, __len); } extern size_t __wcstombs_chk (char *__restrict __dst, const wchar_t *__restrict __src, size_t __len, size_t __dstlen) __THROW; extern size_t __REDIRECT_NTH (__wcstombs_alias, (char *__restrict __dst, const wchar_t *__restrict __src, size_t __len), wcstombs); extern size_t __REDIRECT_NTH (__wcstombs_chk_warn, (char *__restrict __dst, const wchar_t *__restrict __src, size_t __len, size_t __dstlen), __wcstombs_chk) __warnattr ("wcstombs called with dst buffer smaller than len"); __fortify_function size_t __NTH (wcstombs (char *__restrict __dst, const wchar_t *__restrict __src, size_t __len)) { if (__bos (__dst) != (size_t) -1) { if (!__builtin_constant_p (__len)) return __wcstombs_chk (__dst, __src, __len, __bos (__dst)); if (__len > __bos (__dst)) return __wcstombs_chk_warn (__dst, __src, __len, __bos (__dst)); } return __wcstombs_alias (__dst, __src, __len); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/a.out.h����������������������������������������������������������������������������������������0000644�����������������00000000414�14763166030�0006711 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef __A_OUT_GNU_H__ # error "Never use <bits/a.out.h> directly; include <a.out.h> instead." #endif #ifdef __x86_64__ /* Signal to users of this header that this architecture really doesn't support a.out binary format. */ #define __NO_A_OUT_SUPPORT 1 #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/environments.h���������������������������������������������������������������������������������0000644�����������������00000007000�14763166030�0010410 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1999, 2001, 2004, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _UNISTD_H # error "Never include this file directly. Use <unistd.h> instead" #endif #include <bits/wordsize.h> /* This header should define the following symbols under the described situations. A value `1' means that the model is always supported, `-1' means it is never supported. Undefined means it cannot be statically decided. _POSIX_V7_ILP32_OFF32 32bit int, long, pointers, and off_t type _POSIX_V7_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type _POSIX_V7_LP64_OFF32 64bit long and pointers and 32bit off_t type _POSIX_V7_LPBIG_OFFBIG 64bit long and pointers and large off_t type The macros _POSIX_V6_ILP32_OFF32, _POSIX_V6_ILP32_OFFBIG, _POSIX_V6_LP64_OFF32, _POSIX_V6_LPBIG_OFFBIG, _XBS5_ILP32_OFF32, _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and _XBS5_LPBIG_OFFBIG were used in previous versions of the Unix standard and are available only for compatibility. */ #if __WORDSIZE == 64 /* Environments with 32-bit wide pointers are optionally provided. Therefore following macros aren't defined: # undef _POSIX_V7_ILP32_OFF32 # undef _POSIX_V7_ILP32_OFFBIG # undef _POSIX_V6_ILP32_OFF32 # undef _POSIX_V6_ILP32_OFFBIG # undef _XBS5_ILP32_OFF32 # undef _XBS5_ILP32_OFFBIG and users need to check at runtime. */ /* We also have no use (for now) for an environment with bigger pointers and offsets. */ # define _POSIX_V7_LPBIG_OFFBIG -1 # define _POSIX_V6_LPBIG_OFFBIG -1 # define _XBS5_LPBIG_OFFBIG -1 /* By default we have 64-bit wide `long int', pointers and `off_t'. */ # define _POSIX_V7_LP64_OFF64 1 # define _POSIX_V6_LP64_OFF64 1 # define _XBS5_LP64_OFF64 1 #else /* __WORDSIZE == 32 */ /* By default we have 32-bit wide `int', `long int', pointers and `off_t' and all platforms support LFS. */ # define _POSIX_V7_ILP32_OFF32 1 # define _POSIX_V7_ILP32_OFFBIG 1 # define _POSIX_V6_ILP32_OFF32 1 # define _POSIX_V6_ILP32_OFFBIG 1 # define _XBS5_ILP32_OFF32 1 # define _XBS5_ILP32_OFFBIG 1 /* We optionally provide an environment with the above size but an 64-bit side `off_t'. Therefore we don't define _POSIX_V7_ILP32_OFFBIG. */ /* Environments with 64-bit wide pointers can be provided, so these macros aren't defined: # undef _POSIX_V7_LP64_OFF64 # undef _POSIX_V7_LPBIG_OFFBIG # undef _POSIX_V6_LP64_OFF64 # undef _POSIX_V6_LPBIG_OFFBIG # undef _XBS5_LP64_OFF64 # undef _XBS5_LPBIG_OFFBIG and sysconf tests for it at runtime. */ #endif /* __WORDSIZE == 32 */ #define __ILP32_OFF32_CFLAGS "-m32" #define __ILP32_OFFBIG_CFLAGS "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" #define __ILP32_OFF32_LDFLAGS "-m32" #define __ILP32_OFFBIG_LDFLAGS "-m32" #define __LP64_OFF64_CFLAGS "-m64" #define __LP64_OFF64_LDFLAGS "-m64" bits/timerfd.h��������������������������������������������������������������������������������������0000644�����������������00000002116�14763166030�0007316 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2008-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_TIMERFD_H # error "Never use <bits/timerfd.h> directly; include <sys/timerfd.h> instead." #endif /* Bits to be set in the FLAGS parameter of `timerfd_create'. */ enum { TFD_CLOEXEC = 02000000, #define TFD_CLOEXEC TFD_CLOEXEC TFD_NONBLOCK = 00004000 #define TFD_NONBLOCK TFD_NONBLOCK }; ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/string2.h��������������������������������������������������������������������������������������0000644�����������������00000134124�14763166030�0007261 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Machine-independant string function optimizations. Copyright (C) 1997-2004, 2007, 2008, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _STRING_H # error "Never use <bits/string2.h> directly; include <string.h> instead." #endif #ifndef __NO_STRING_INLINES /* Unlike the definitions in the header <bits/string.h> the definitions contained here are not optimized down to assembler level. Those optimizations are not always a good idea since this means the code size increases a lot. Instead the definitions here optimize some functions in a way which do not dramatically increase the code size and which do not use assembler. The main trick is to use GCC's `__builtin_constant_p' function. Every function XXX which has a defined version in <bits/string.h> must be accompanied by a symbol _HAVE_STRING_ARCH_XXX to make sure we don't get redefinitions. We must use here macros instead of inline functions since the trick won't work with the latter. */ #ifndef __STRING_INLINE # ifdef __cplusplus # define __STRING_INLINE inline # else # define __STRING_INLINE __extern_inline # endif #endif #if _STRING_ARCH_unaligned /* If we can do unaligned memory accesses we must know the endianess. */ # include <endian.h> # include <bits/types.h> # if __BYTE_ORDER == __LITTLE_ENDIAN # define __STRING2_SMALL_GET16(src, idx) \ (((const unsigned char *) (const char *) (src))[idx + 1] << 8 \ | ((const unsigned char *) (const char *) (src))[idx]) # define __STRING2_SMALL_GET32(src, idx) \ (((((const unsigned char *) (const char *) (src))[idx + 3] << 8 \ | ((const unsigned char *) (const char *) (src))[idx + 2]) << 8 \ | ((const unsigned char *) (const char *) (src))[idx + 1]) << 8 \ | ((const unsigned char *) (const char *) (src))[idx]) # else # define __STRING2_SMALL_GET16(src, idx) \ (((const unsigned char *) (const char *) (src))[idx] << 8 \ | ((const unsigned char *) (const char *) (src))[idx + 1]) # define __STRING2_SMALL_GET32(src, idx) \ (((((const unsigned char *) (const char *) (src))[idx] << 8 \ | ((const unsigned char *) (const char *) (src))[idx + 1]) << 8 \ | ((const unsigned char *) (const char *) (src))[idx + 2]) << 8 \ | ((const unsigned char *) (const char *) (src))[idx + 3]) # endif #else /* These are a few types we need for the optimizations if we cannot use unaligned memory accesses. */ # define __STRING2_COPY_TYPE(N) \ typedef struct { unsigned char __arr[N]; } \ __attribute__ ((__packed__)) __STRING2_COPY_ARR##N __STRING2_COPY_TYPE (2); __STRING2_COPY_TYPE (3); __STRING2_COPY_TYPE (4); __STRING2_COPY_TYPE (5); __STRING2_COPY_TYPE (6); __STRING2_COPY_TYPE (7); __STRING2_COPY_TYPE (8); # undef __STRING2_COPY_TYPE #endif /* Dereferencing a pointer arg to run sizeof on it fails for the void pointer case, so we use this instead. Note that __x is evaluated twice. */ #define __string2_1bptr_p(__x) \ ((size_t)(const void *)((__x) + 1) - (size_t)(const void *)(__x) == 1) /* Set N bytes of S to C. */ #if !defined _HAVE_STRING_ARCH_memset # if !__GNUC_PREREQ (3, 0) # if _STRING_ARCH_unaligned # define memset(s, c, n) \ (__extension__ (__builtin_constant_p (n) && (n) <= 16 \ ? ((n) == 1 \ ? __memset_1 (s, c) \ : __memset_gc (s, c, n)) \ : (__builtin_constant_p (c) && (c) == '\0' \ ? ({ void *__s = (s); __bzero (__s, n); __s; }) \ : memset (s, c, n)))) # define __memset_1(s, c) ({ void *__s = (s); \ *((__uint8_t *) __s) = (__uint8_t) c; __s; }) # define __memset_gc(s, c, n) \ ({ void *__s = (s); \ union { \ unsigned int __ui; \ unsigned short int __usi; \ unsigned char __uc; \ } *__u = __s; \ __uint8_t __c = (__uint8_t) (c); \ \ /* This `switch' statement will be removed at compile-time. */ \ switch ((unsigned int) (n)) \ { \ case 15: \ __u->__ui = __c * 0x01010101; \ __u = __extension__ ((void *) __u + 4); \ case 11: \ __u->__ui = __c * 0x01010101; \ __u = __extension__ ((void *) __u + 4); \ case 7: \ __u->__ui = __c * 0x01010101; \ __u = __extension__ ((void *) __u + 4); \ case 3: \ __u->__usi = (unsigned short int) __c * 0x0101; \ __u = __extension__ ((void *) __u + 2); \ __u->__uc = (unsigned char) __c; \ break; \ \ case 14: \ __u->__ui = __c * 0x01010101; \ __u = __extension__ ((void *) __u + 4); \ case 10: \ __u->__ui = __c * 0x01010101; \ __u = __extension__ ((void *) __u + 4); \ case 6: \ __u->__ui = __c * 0x01010101; \ __u = __extension__ ((void *) __u + 4); \ case 2: \ __u->__usi = (unsigned short int) __c * 0x0101; \ break; \ \ case 13: \ __u->__ui = __c * 0x01010101; \ __u = __extension__ ((void *) __u + 4); \ case 9: \ __u->__ui = __c * 0x01010101; \ __u = __extension__ ((void *) __u + 4); \ case 5: \ __u->__ui = __c * 0x01010101; \ __u = __extension__ ((void *) __u + 4); \ case 1: \ __u->__uc = (unsigned char) __c; \ break; \ \ case 16: \ __u->__ui = __c * 0x01010101; \ __u = __extension__ ((void *) __u + 4); \ case 12: \ __u->__ui = __c * 0x01010101; \ __u = __extension__ ((void *) __u + 4); \ case 8: \ __u->__ui = __c * 0x01010101; \ __u = __extension__ ((void *) __u + 4); \ case 4: \ __u->__ui = __c * 0x01010101; \ case 0: \ break; \ } \ \ __s; }) # else # define memset(s, c, n) \ (__extension__ (__builtin_constant_p (c) && (c) == '\0' \ ? ({ void *__s = (s); __bzero (__s, n); __s; }) \ : memset (s, c, n))) # endif # endif /* GCC < 3.0 optimizes memset(s, 0, n) but not bzero(s, n). The optimization is broken before EGCS 1.1. GCC 3.0+ has __builtin_bzero as well, but at least till GCC 3.4 if it decides to call the library function, it calls memset and not bzero. */ # if __GNUC_PREREQ (2, 91) # define __bzero(s, n) __builtin_memset (s, '\0', n) # endif #endif /* Copy N bytes from SRC to DEST, returning pointer to byte following the last copied. */ #ifdef __USE_GNU # if !defined _HAVE_STRING_ARCH_mempcpy || defined _FORCE_INLINES # ifndef _HAVE_STRING_ARCH_mempcpy # if __GNUC_PREREQ (3, 4) # define __mempcpy(dest, src, n) __builtin_mempcpy (dest, src, n) # elif __GNUC_PREREQ (3, 0) # define __mempcpy(dest, src, n) \ (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) \ && __string2_1bptr_p (src) && n <= 8 \ ? __builtin_memcpy (dest, src, n) + (n) \ : __mempcpy (dest, src, n))) # else # define __mempcpy(dest, src, n) \ (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) \ && __string2_1bptr_p (src) && n <= 8 \ ? __mempcpy_small (dest, __mempcpy_args (src), n) \ : __mempcpy (dest, src, n))) # endif /* In glibc we use this function frequently but for namespace reasons we have to use the name `__mempcpy'. */ # define mempcpy(dest, src, n) __mempcpy (dest, src, n) # endif # if !__GNUC_PREREQ (3, 0) || defined _FORCE_INLINES # if _STRING_ARCH_unaligned # ifndef _FORCE_INLINES # define __mempcpy_args(src) \ ((const char *) (src))[0], ((const char *) (src))[2], \ ((const char *) (src))[4], ((const char *) (src))[6], \ __extension__ __STRING2_SMALL_GET16 (src, 0), \ __extension__ __STRING2_SMALL_GET16 (src, 4), \ __extension__ __STRING2_SMALL_GET32 (src, 0), \ __extension__ __STRING2_SMALL_GET32 (src, 4) # endif __STRING_INLINE void *__mempcpy_small (void *, char, char, char, char, __uint16_t, __uint16_t, __uint32_t, __uint32_t, size_t); __STRING_INLINE void * __mempcpy_small (void *__dest1, char __src0_1, char __src2_1, char __src4_1, char __src6_1, __uint16_t __src0_2, __uint16_t __src4_2, __uint32_t __src0_4, __uint32_t __src4_4, size_t __srclen) { union { __uint32_t __ui; __uint16_t __usi; unsigned char __uc; unsigned char __c; } *__u = __dest1; switch ((unsigned int) __srclen) { case 1: __u->__c = __src0_1; __u = __extension__ ((void *) __u + 1); break; case 2: __u->__usi = __src0_2; __u = __extension__ ((void *) __u + 2); break; case 3: __u->__usi = __src0_2; __u = __extension__ ((void *) __u + 2); __u->__c = __src2_1; __u = __extension__ ((void *) __u + 1); break; case 4: __u->__ui = __src0_4; __u = __extension__ ((void *) __u + 4); break; case 5: __u->__ui = __src0_4; __u = __extension__ ((void *) __u + 4); __u->__c = __src4_1; __u = __extension__ ((void *) __u + 1); break; case 6: __u->__ui = __src0_4; __u = __extension__ ((void *) __u + 4); __u->__usi = __src4_2; __u = __extension__ ((void *) __u + 2); break; case 7: __u->__ui = __src0_4; __u = __extension__ ((void *) __u + 4); __u->__usi = __src4_2; __u = __extension__ ((void *) __u + 2); __u->__c = __src6_1; __u = __extension__ ((void *) __u + 1); break; case 8: __u->__ui = __src0_4; __u = __extension__ ((void *) __u + 4); __u->__ui = __src4_4; __u = __extension__ ((void *) __u + 4); break; } return (void *) __u; } # else # ifndef _FORCE_INLINES # define __mempcpy_args(src) \ ((const char *) (src))[0], \ __extension__ ((__STRING2_COPY_ARR2) \ { { ((const char *) (src))[0], ((const char *) (src))[1] } }), \ __extension__ ((__STRING2_COPY_ARR3) \ { { ((const char *) (src))[0], ((const char *) (src))[1], \ ((const char *) (src))[2] } }), \ __extension__ ((__STRING2_COPY_ARR4) \ { { ((const char *) (src))[0], ((const char *) (src))[1], \ ((const char *) (src))[2], ((const char *) (src))[3] } }), \ __extension__ ((__STRING2_COPY_ARR5) \ { { ((const char *) (src))[0], ((const char *) (src))[1], \ ((const char *) (src))[2], ((const char *) (src))[3], \ ((const char *) (src))[4] } }), \ __extension__ ((__STRING2_COPY_ARR6) \ { { ((const char *) (src))[0], ((const char *) (src))[1], \ ((const char *) (src))[2], ((const char *) (src))[3], \ ((const char *) (src))[4], ((const char *) (src))[5] } }), \ __extension__ ((__STRING2_COPY_ARR7) \ { { ((const char *) (src))[0], ((const char *) (src))[1], \ ((const char *) (src))[2], ((const char *) (src))[3], \ ((const char *) (src))[4], ((const char *) (src))[5], \ ((const char *) (src))[6] } }), \ __extension__ ((__STRING2_COPY_ARR8) \ { { ((const char *) (src))[0], ((const char *) (src))[1], \ ((const char *) (src))[2], ((const char *) (src))[3], \ ((const char *) (src))[4], ((const char *) (src))[5], \ ((const char *) (src))[6], ((const char *) (src))[7] } }) # endif __STRING_INLINE void *__mempcpy_small (void *, char, __STRING2_COPY_ARR2, __STRING2_COPY_ARR3, __STRING2_COPY_ARR4, __STRING2_COPY_ARR5, __STRING2_COPY_ARR6, __STRING2_COPY_ARR7, __STRING2_COPY_ARR8, size_t); __STRING_INLINE void * __mempcpy_small (void *__dest, char __src1, __STRING2_COPY_ARR2 __src2, __STRING2_COPY_ARR3 __src3, __STRING2_COPY_ARR4 __src4, __STRING2_COPY_ARR5 __src5, __STRING2_COPY_ARR6 __src6, __STRING2_COPY_ARR7 __src7, __STRING2_COPY_ARR8 __src8, size_t __srclen) { union { char __c; __STRING2_COPY_ARR2 __sca2; __STRING2_COPY_ARR3 __sca3; __STRING2_COPY_ARR4 __sca4; __STRING2_COPY_ARR5 __sca5; __STRING2_COPY_ARR6 __sca6; __STRING2_COPY_ARR7 __sca7; __STRING2_COPY_ARR8 __sca8; } *__u = __dest; switch ((unsigned int) __srclen) { case 1: __u->__c = __src1; break; case 2: __extension__ __u->__sca2 = __src2; break; case 3: __extension__ __u->__sca3 = __src3; break; case 4: __extension__ __u->__sca4 = __src4; break; case 5: __extension__ __u->__sca5 = __src5; break; case 6: __extension__ __u->__sca6 = __src6; break; case 7: __extension__ __u->__sca7 = __src7; break; case 8: __extension__ __u->__sca8 = __src8; break; } return __extension__ ((void *) __u + __srclen); } # endif # endif # endif #endif /* Return pointer to C in S. */ #ifndef _HAVE_STRING_ARCH_strchr extern void *__rawmemchr (const void *__s, int __c); # if __GNUC_PREREQ (3, 2) # define strchr(s, c) \ (__extension__ (__builtin_constant_p (c) && !__builtin_constant_p (s) \ && (c) == '\0' \ ? (char *) __rawmemchr (s, c) \ : __builtin_strchr (s, c))) # else # define strchr(s, c) \ (__extension__ (__builtin_constant_p (c) && (c) == '\0' \ ? (char *) __rawmemchr (s, c) \ : strchr (s, c))) # endif #endif /* Copy SRC to DEST. */ #if (!defined _HAVE_STRING_ARCH_strcpy && !__GNUC_PREREQ (3, 0)) \ || defined _FORCE_INLINES # if !defined _HAVE_STRING_ARCH_strcpy && !__GNUC_PREREQ (3, 0) # define strcpy(dest, src) \ (__extension__ (__builtin_constant_p (src) \ ? (__string2_1bptr_p (src) && strlen (src) + 1 <= 8 \ ? __strcpy_small (dest, __strcpy_args (src), \ strlen (src) + 1) \ : (char *) memcpy (dest, src, strlen (src) + 1)) \ : strcpy (dest, src))) # endif # if _STRING_ARCH_unaligned # ifndef _FORCE_INLINES # define __strcpy_args(src) \ __extension__ __STRING2_SMALL_GET16 (src, 0), \ __extension__ __STRING2_SMALL_GET16 (src, 4), \ __extension__ __STRING2_SMALL_GET32 (src, 0), \ __extension__ __STRING2_SMALL_GET32 (src, 4) # endif __STRING_INLINE char *__strcpy_small (char *, __uint16_t, __uint16_t, __uint32_t, __uint32_t, size_t); __STRING_INLINE char * __strcpy_small (char *__dest, __uint16_t __src0_2, __uint16_t __src4_2, __uint32_t __src0_4, __uint32_t __src4_4, size_t __srclen) { union { __uint32_t __ui; __uint16_t __usi; unsigned char __uc; } *__u = (void *) __dest; switch ((unsigned int) __srclen) { case 1: __u->__uc = '\0'; break; case 2: __u->__usi = __src0_2; break; case 3: __u->__usi = __src0_2; __u = __extension__ ((void *) __u + 2); __u->__uc = '\0'; break; case 4: __u->__ui = __src0_4; break; case 5: __u->__ui = __src0_4; __u = __extension__ ((void *) __u + 4); __u->__uc = '\0'; break; case 6: __u->__ui = __src0_4; __u = __extension__ ((void *) __u + 4); __u->__usi = __src4_2; break; case 7: __u->__ui = __src0_4; __u = __extension__ ((void *) __u + 4); __u->__usi = __src4_2; __u = __extension__ ((void *) __u + 2); __u->__uc = '\0'; break; case 8: __u->__ui = __src0_4; __u = __extension__ ((void *) __u + 4); __u->__ui = __src4_4; break; } return __dest; } # else # ifndef _FORCE_INLINES # define __strcpy_args(src) \ __extension__ ((__STRING2_COPY_ARR2) \ { { ((const char *) (src))[0], '\0' } }), \ __extension__ ((__STRING2_COPY_ARR3) \ { { ((const char *) (src))[0], ((const char *) (src))[1], \ '\0' } }), \ __extension__ ((__STRING2_COPY_ARR4) \ { { ((const char *) (src))[0], ((const char *) (src))[1], \ ((const char *) (src))[2], '\0' } }), \ __extension__ ((__STRING2_COPY_ARR5) \ { { ((const char *) (src))[0], ((const char *) (src))[1], \ ((const char *) (src))[2], ((const char *) (src))[3], \ '\0' } }), \ __extension__ ((__STRING2_COPY_ARR6) \ { { ((const char *) (src))[0], ((const char *) (src))[1], \ ((const char *) (src))[2], ((const char *) (src))[3], \ ((const char *) (src))[4], '\0' } }), \ __extension__ ((__STRING2_COPY_ARR7) \ { { ((const char *) (src))[0], ((const char *) (src))[1], \ ((const char *) (src))[2], ((const char *) (src))[3], \ ((const char *) (src))[4], ((const char *) (src))[5], \ '\0' } }), \ __extension__ ((__STRING2_COPY_ARR8) \ { { ((const char *) (src))[0], ((const char *) (src))[1], \ ((const char *) (src))[2], ((const char *) (src))[3], \ ((const char *) (src))[4], ((const char *) (src))[5], \ ((const char *) (src))[6], '\0' } }) # endif __STRING_INLINE char *__strcpy_small (char *, __STRING2_COPY_ARR2, __STRING2_COPY_ARR3, __STRING2_COPY_ARR4, __STRING2_COPY_ARR5, __STRING2_COPY_ARR6, __STRING2_COPY_ARR7, __STRING2_COPY_ARR8, size_t); __STRING_INLINE char * __strcpy_small (char *__dest, __STRING2_COPY_ARR2 __src2, __STRING2_COPY_ARR3 __src3, __STRING2_COPY_ARR4 __src4, __STRING2_COPY_ARR5 __src5, __STRING2_COPY_ARR6 __src6, __STRING2_COPY_ARR7 __src7, __STRING2_COPY_ARR8 __src8, size_t __srclen) { union { char __c; __STRING2_COPY_ARR2 __sca2; __STRING2_COPY_ARR3 __sca3; __STRING2_COPY_ARR4 __sca4; __STRING2_COPY_ARR5 __sca5; __STRING2_COPY_ARR6 __sca6; __STRING2_COPY_ARR7 __sca7; __STRING2_COPY_ARR8 __sca8; } *__u = (void *) __dest; switch ((unsigned int) __srclen) { case 1: __u->__c = '\0'; break; case 2: __extension__ __u->__sca2 = __src2; break; case 3: __extension__ __u->__sca3 = __src3; break; case 4: __extension__ __u->__sca4 = __src4; break; case 5: __extension__ __u->__sca5 = __src5; break; case 6: __extension__ __u->__sca6 = __src6; break; case 7: __extension__ __u->__sca7 = __src7; break; case 8: __extension__ __u->__sca8 = __src8; break; } return __dest; } # endif #endif /* Copy SRC to DEST, returning pointer to final NUL byte. */ #ifdef __USE_GNU # if !defined _HAVE_STRING_ARCH_stpcpy || defined _FORCE_INLINES # ifndef _HAVE_STRING_ARCH_stpcpy # if __GNUC_PREREQ (3, 4) # define __stpcpy(dest, src) __builtin_stpcpy (dest, src) # elif __GNUC_PREREQ (3, 0) # define __stpcpy(dest, src) \ (__extension__ (__builtin_constant_p (src) \ ? (__string2_1bptr_p (src) && strlen (src) + 1 <= 8 \ ? __builtin_strcpy (dest, src) + strlen (src) \ : ((char *) (__mempcpy) (dest, src, strlen (src) + 1) \ - 1)) \ : __stpcpy (dest, src))) # else # define __stpcpy(dest, src) \ (__extension__ (__builtin_constant_p (src) \ ? (__string2_1bptr_p (src) && strlen (src) + 1 <= 8 \ ? __stpcpy_small (dest, __stpcpy_args (src), \ strlen (src) + 1) \ : ((char *) (__mempcpy) (dest, src, strlen (src) + 1) \ - 1)) \ : __stpcpy (dest, src))) # endif /* In glibc we use this function frequently but for namespace reasons we have to use the name `__stpcpy'. */ # define stpcpy(dest, src) __stpcpy (dest, src) # endif # if !__GNUC_PREREQ (3, 0) || defined _FORCE_INLINES # if _STRING_ARCH_unaligned # ifndef _FORCE_INLINES # define __stpcpy_args(src) \ __extension__ __STRING2_SMALL_GET16 (src, 0), \ __extension__ __STRING2_SMALL_GET16 (src, 4), \ __extension__ __STRING2_SMALL_GET32 (src, 0), \ __extension__ __STRING2_SMALL_GET32 (src, 4) # endif __STRING_INLINE char *__stpcpy_small (char *, __uint16_t, __uint16_t, __uint32_t, __uint32_t, size_t); __STRING_INLINE char * __stpcpy_small (char *__dest, __uint16_t __src0_2, __uint16_t __src4_2, __uint32_t __src0_4, __uint32_t __src4_4, size_t __srclen) { union { unsigned int __ui; unsigned short int __usi; unsigned char __uc; char __c; } *__u = (void *) __dest; switch ((unsigned int) __srclen) { case 1: __u->__uc = '\0'; break; case 2: __u->__usi = __src0_2; __u = __extension__ ((void *) __u + 1); break; case 3: __u->__usi = __src0_2; __u = __extension__ ((void *) __u + 2); __u->__uc = '\0'; break; case 4: __u->__ui = __src0_4; __u = __extension__ ((void *) __u + 3); break; case 5: __u->__ui = __src0_4; __u = __extension__ ((void *) __u + 4); __u->__uc = '\0'; break; case 6: __u->__ui = __src0_4; __u = __extension__ ((void *) __u + 4); __u->__usi = __src4_2; __u = __extension__ ((void *) __u + 1); break; case 7: __u->__ui = __src0_4; __u = __extension__ ((void *) __u + 4); __u->__usi = __src4_2; __u = __extension__ ((void *) __u + 2); __u->__uc = '\0'; break; case 8: __u->__ui = __src0_4; __u = __extension__ ((void *) __u + 4); __u->__ui = __src4_4; __u = __extension__ ((void *) __u + 3); break; } return &__u->__c; } # else # ifndef _FORCE_INLINES # define __stpcpy_args(src) \ __extension__ ((__STRING2_COPY_ARR2) \ { { ((const char *) (src))[0], '\0' } }), \ __extension__ ((__STRING2_COPY_ARR3) \ { { ((const char *) (src))[0], ((const char *) (src))[1], \ '\0' } }), \ __extension__ ((__STRING2_COPY_ARR4) \ { { ((const char *) (src))[0], ((const char *) (src))[1], \ ((const char *) (src))[2], '\0' } }), \ __extension__ ((__STRING2_COPY_ARR5) \ { { ((const char *) (src))[0], ((const char *) (src))[1], \ ((const char *) (src))[2], ((const char *) (src))[3], \ '\0' } }), \ __extension__ ((__STRING2_COPY_ARR6) \ { { ((const char *) (src))[0], ((const char *) (src))[1], \ ((const char *) (src))[2], ((const char *) (src))[3], \ ((const char *) (src))[4], '\0' } }), \ __extension__ ((__STRING2_COPY_ARR7) \ { { ((const char *) (src))[0], ((const char *) (src))[1], \ ((const char *) (src))[2], ((const char *) (src))[3], \ ((const char *) (src))[4], ((const char *) (src))[5], \ '\0' } }), \ __extension__ ((__STRING2_COPY_ARR8) \ { { ((const char *) (src))[0], ((const char *) (src))[1], \ ((const char *) (src))[2], ((const char *) (src))[3], \ ((const char *) (src))[4], ((const char *) (src))[5], \ ((const char *) (src))[6], '\0' } }) # endif __STRING_INLINE char *__stpcpy_small (char *, __STRING2_COPY_ARR2, __STRING2_COPY_ARR3, __STRING2_COPY_ARR4, __STRING2_COPY_ARR5, __STRING2_COPY_ARR6, __STRING2_COPY_ARR7, __STRING2_COPY_ARR8, size_t); __STRING_INLINE char * __stpcpy_small (char *__dest, __STRING2_COPY_ARR2 __src2, __STRING2_COPY_ARR3 __src3, __STRING2_COPY_ARR4 __src4, __STRING2_COPY_ARR5 __src5, __STRING2_COPY_ARR6 __src6, __STRING2_COPY_ARR7 __src7, __STRING2_COPY_ARR8 __src8, size_t __srclen) { union { char __c; __STRING2_COPY_ARR2 __sca2; __STRING2_COPY_ARR3 __sca3; __STRING2_COPY_ARR4 __sca4; __STRING2_COPY_ARR5 __sca5; __STRING2_COPY_ARR6 __sca6; __STRING2_COPY_ARR7 __sca7; __STRING2_COPY_ARR8 __sca8; } *__u = (void *) __dest; switch ((unsigned int) __srclen) { case 1: __u->__c = '\0'; break; case 2: __extension__ __u->__sca2 = __src2; break; case 3: __extension__ __u->__sca3 = __src3; break; case 4: __extension__ __u->__sca4 = __src4; break; case 5: __extension__ __u->__sca5 = __src5; break; case 6: __extension__ __u->__sca6 = __src6; break; case 7: __extension__ __u->__sca7 = __src7; break; case 8: __extension__ __u->__sca8 = __src8; break; } return __dest + __srclen - 1; } # endif # endif # endif #endif /* Copy no more than N characters of SRC to DEST. */ #ifndef _HAVE_STRING_ARCH_strncpy # if __GNUC_PREREQ (3, 2) # define strncpy(dest, src, n) __builtin_strncpy (dest, src, n) # else # define strncpy(dest, src, n) \ (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) \ ? (strlen (src) + 1 >= ((size_t) (n)) \ ? (char *) memcpy (dest, src, n) \ : strncpy (dest, src, n)) \ : strncpy (dest, src, n))) # endif #endif /* Append no more than N characters from SRC onto DEST. */ #ifndef _HAVE_STRING_ARCH_strncat # ifdef _USE_STRING_ARCH_strchr # define strncat(dest, src, n) \ (__extension__ ({ char *__dest = (dest); \ __builtin_constant_p (src) && __builtin_constant_p (n) \ ? (strlen (src) < ((size_t) (n)) \ ? strcat (__dest, src) \ : (*((char *) __mempcpy (strchr (__dest, '\0'), \ src, n)) = '\0', __dest)) \ : strncat (dest, src, n); })) # elif __GNUC_PREREQ (3, 2) # define strncat(dest, src, n) __builtin_strncat (dest, src, n) # else # define strncat(dest, src, n) \ (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) \ ? (strlen (src) < ((size_t) (n)) \ ? strcat (dest, src) \ : strncat (dest, src, n)) \ : strncat (dest, src, n))) # endif #endif /* Compare characters of S1 and S2. */ #ifndef _HAVE_STRING_ARCH_strcmp # if __GNUC_PREREQ (3, 2) # define strcmp(s1, s2) \ __extension__ \ ({ size_t __s1_len, __s2_len; \ (__builtin_constant_p (s1) && __builtin_constant_p (s2) \ && (__s1_len = strlen (s1), __s2_len = strlen (s2), \ (!__string2_1bptr_p (s1) || __s1_len >= 4) \ && (!__string2_1bptr_p (s2) || __s2_len >= 4)) \ ? __builtin_strcmp (s1, s2) \ : (__builtin_constant_p (s1) && __string2_1bptr_p (s1) \ && (__s1_len = strlen (s1), __s1_len < 4) \ ? (__builtin_constant_p (s2) && __string2_1bptr_p (s2) \ ? __builtin_strcmp (s1, s2) \ : __strcmp_cg (s1, s2, __s1_len)) \ : (__builtin_constant_p (s2) && __string2_1bptr_p (s2) \ && (__s2_len = strlen (s2), __s2_len < 4) \ ? (__builtin_constant_p (s1) && __string2_1bptr_p (s1) \ ? __builtin_strcmp (s1, s2) \ : __strcmp_gc (s1, s2, __s2_len)) \ : __builtin_strcmp (s1, s2)))); }) # else # define strcmp(s1, s2) \ __extension__ \ ({ size_t __s1_len, __s2_len; \ (__builtin_constant_p (s1) && __builtin_constant_p (s2) \ && (__s1_len = strlen (s1), __s2_len = strlen (s2), \ (!__string2_1bptr_p (s1) || __s1_len >= 4) \ && (!__string2_1bptr_p (s2) || __s2_len >= 4)) \ ? memcmp ((const char *) (s1), (const char *) (s2), \ (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) \ : (__builtin_constant_p (s1) && __string2_1bptr_p (s1) \ && (__s1_len = strlen (s1), __s1_len < 4) \ ? (__builtin_constant_p (s2) && __string2_1bptr_p (s2) \ ? __strcmp_cc (s1, s2, __s1_len) \ : __strcmp_cg (s1, s2, __s1_len)) \ : (__builtin_constant_p (s2) && __string2_1bptr_p (s2) \ && (__s2_len = strlen (s2), __s2_len < 4) \ ? (__builtin_constant_p (s1) && __string2_1bptr_p (s1) \ ? __strcmp_cc (s1, s2, __s2_len) \ : __strcmp_gc (s1, s2, __s2_len)) \ : strcmp (s1, s2)))); }) # endif # define __strcmp_cc(s1, s2, l) \ (__extension__ ({ int __result = \ (((const unsigned char *) (const char *) (s1))[0] \ - ((const unsigned char *) (const char *)(s2))[0]); \ if (l > 0 && __result == 0) \ { \ __result = (((const unsigned char *) \ (const char *) (s1))[1] \ - ((const unsigned char *) \ (const char *) (s2))[1]); \ if (l > 1 && __result == 0) \ { \ __result = \ (((const unsigned char *) \ (const char *) (s1))[2] \ - ((const unsigned char *) \ (const char *) (s2))[2]); \ if (l > 2 && __result == 0) \ __result = \ (((const unsigned char *) \ (const char *) (s1))[3] \ - ((const unsigned char *) \ (const char *) (s2))[3]); \ } \ } \ __result; })) # define __strcmp_cg(s1, s2, l1) \ (__extension__ ({ const unsigned char *__s2 = \ (const unsigned char *) (const char *) (s2); \ int __result = \ (((const unsigned char *) (const char *) (s1))[0] \ - __s2[0]); \ if (l1 > 0 && __result == 0) \ { \ __result = (((const unsigned char *) \ (const char *) (s1))[1] - __s2[1]); \ if (l1 > 1 && __result == 0) \ { \ __result = (((const unsigned char *) \ (const char *) (s1))[2] - __s2[2]); \ if (l1 > 2 && __result == 0) \ __result = (((const unsigned char *) \ (const char *) (s1))[3] \ - __s2[3]); \ } \ } \ __result; })) # define __strcmp_gc(s1, s2, l2) \ (__extension__ ({ const unsigned char *__s1 = \ (const unsigned char *) (const char *) (s1); \ register int __result = \ __s1[0] - ((const unsigned char *) \ (const char *) (s2))[0]; \ if (l2 > 0 && __result == 0) \ { \ __result = (__s1[1] \ - ((const unsigned char *) \ (const char *) (s2))[1]); \ if (l2 > 1 && __result == 0) \ { \ __result = \ (__s1[2] - ((const unsigned char *) \ (const char *) (s2))[2]); \ if (l2 > 2 && __result == 0) \ __result = \ (__s1[3] \ - ((const unsigned char *) \ (const char *) (s2))[3]); \ } \ } \ __result; })) #endif /* Compare N characters of S1 and S2. */ #ifndef _HAVE_STRING_ARCH_strncmp # define strncmp(s1, s2, n) \ (__extension__ (__builtin_constant_p (n) \ && ((__builtin_constant_p (s1) \ && strlen (s1) < ((size_t) (n))) \ || (__builtin_constant_p (s2) \ && strlen (s2) < ((size_t) (n)))) \ ? strcmp (s1, s2) : strncmp (s1, s2, n))) #endif /* Return the length of the initial segment of S which consists entirely of characters not in REJECT. */ #if !defined _HAVE_STRING_ARCH_strcspn || defined _FORCE_INLINES # ifndef _HAVE_STRING_ARCH_strcspn # if __GNUC_PREREQ (3, 2) # define strcspn(s, reject) \ __extension__ \ ({ char __r0, __r1, __r2; \ (__builtin_constant_p (reject) && __string2_1bptr_p (reject) \ ? ((__builtin_constant_p (s) && __string2_1bptr_p (s)) \ ? __builtin_strcspn (s, reject) \ : ((__r0 = ((const char *) (reject))[0], __r0 == '\0') \ ? strlen (s) \ : ((__r1 = ((const char *) (reject))[1], __r1 == '\0') \ ? __strcspn_c1 (s, __r0) \ : ((__r2 = ((const char *) (reject))[2], __r2 == '\0') \ ? __strcspn_c2 (s, __r0, __r1) \ : (((const char *) (reject))[3] == '\0' \ ? __strcspn_c3 (s, __r0, __r1, __r2) \ : __builtin_strcspn (s, reject)))))) \ : __builtin_strcspn (s, reject)); }) # else # define strcspn(s, reject) \ __extension__ \ ({ char __r0, __r1, __r2; \ (__builtin_constant_p (reject) && __string2_1bptr_p (reject) \ ? ((__r0 = ((const char *) (reject))[0], __r0 == '\0') \ ? strlen (s) \ : ((__r1 = ((const char *) (reject))[1], __r1 == '\0') \ ? __strcspn_c1 (s, __r0) \ : ((__r2 = ((const char *) (reject))[2], __r2 == '\0') \ ? __strcspn_c2 (s, __r0, __r1) \ : (((const char *) (reject))[3] == '\0' \ ? __strcspn_c3 (s, __r0, __r1, __r2) \ : strcspn (s, reject))))) \ : strcspn (s, reject)); }) # endif # endif __STRING_INLINE size_t __strcspn_c1 (const char *__s, int __reject); __STRING_INLINE size_t __strcspn_c1 (const char *__s, int __reject) { size_t __result = 0; while (__s[__result] != '\0' && __s[__result] != __reject) ++__result; return __result; } __STRING_INLINE size_t __strcspn_c2 (const char *__s, int __reject1, int __reject2); __STRING_INLINE size_t __strcspn_c2 (const char *__s, int __reject1, int __reject2) { size_t __result = 0; while (__s[__result] != '\0' && __s[__result] != __reject1 && __s[__result] != __reject2) ++__result; return __result; } __STRING_INLINE size_t __strcspn_c3 (const char *__s, int __reject1, int __reject2, int __reject3); __STRING_INLINE size_t __strcspn_c3 (const char *__s, int __reject1, int __reject2, int __reject3) { size_t __result = 0; while (__s[__result] != '\0' && __s[__result] != __reject1 && __s[__result] != __reject2 && __s[__result] != __reject3) ++__result; return __result; } #endif /* Return the length of the initial segment of S which consists entirely of characters in ACCEPT. */ #if !defined _HAVE_STRING_ARCH_strspn || defined _FORCE_INLINES # ifndef _HAVE_STRING_ARCH_strspn # if __GNUC_PREREQ (3, 2) # define strspn(s, accept) \ __extension__ \ ({ char __a0, __a1, __a2; \ (__builtin_constant_p (accept) && __string2_1bptr_p (accept) \ ? ((__builtin_constant_p (s) && __string2_1bptr_p (s)) \ ? __builtin_strspn (s, accept) \ : ((__a0 = ((const char *) (accept))[0], __a0 == '\0') \ ? ((void) (s), (size_t) 0) \ : ((__a1 = ((const char *) (accept))[1], __a1 == '\0') \ ? __strspn_c1 (s, __a0) \ : ((__a2 = ((const char *) (accept))[2], __a2 == '\0') \ ? __strspn_c2 (s, __a0, __a1) \ : (((const char *) (accept))[3] == '\0' \ ? __strspn_c3 (s, __a0, __a1, __a2) \ : __builtin_strspn (s, accept)))))) \ : __builtin_strspn (s, accept)); }) # else # define strspn(s, accept) \ __extension__ \ ({ char __a0, __a1, __a2; \ (__builtin_constant_p (accept) && __string2_1bptr_p (accept) \ ? ((__a0 = ((const char *) (accept))[0], __a0 == '\0') \ ? ((void) (s), (size_t) 0) \ : ((__a1 = ((const char *) (accept))[1], __a1 == '\0') \ ? __strspn_c1 (s, __a0) \ : ((__a2 = ((const char *) (accept))[2], __a2 == '\0') \ ? __strspn_c2 (s, __a0, __a1) \ : (((const char *) (accept))[3] == '\0' \ ? __strspn_c3 (s, __a0, __a1, __a2) \ : strspn (s, accept))))) \ : strspn (s, accept)); }) # endif # endif __STRING_INLINE size_t __strspn_c1 (const char *__s, int __accept); __STRING_INLINE size_t __strspn_c1 (const char *__s, int __accept) { size_t __result = 0; /* Please note that __accept never can be '\0'. */ while (__s[__result] == __accept) ++__result; return __result; } __STRING_INLINE size_t __strspn_c2 (const char *__s, int __accept1, int __accept2); __STRING_INLINE size_t __strspn_c2 (const char *__s, int __accept1, int __accept2) { size_t __result = 0; /* Please note that __accept1 and __accept2 never can be '\0'. */ while (__s[__result] == __accept1 || __s[__result] == __accept2) ++__result; return __result; } __STRING_INLINE size_t __strspn_c3 (const char *__s, int __accept1, int __accept2, int __accept3); __STRING_INLINE size_t __strspn_c3 (const char *__s, int __accept1, int __accept2, int __accept3) { size_t __result = 0; /* Please note that __accept1 to __accept3 never can be '\0'. */ while (__s[__result] == __accept1 || __s[__result] == __accept2 || __s[__result] == __accept3) ++__result; return __result; } #endif /* Find the first occurrence in S of any character in ACCEPT. */ #if !defined _HAVE_STRING_ARCH_strpbrk || defined _FORCE_INLINES # ifndef _HAVE_STRING_ARCH_strpbrk # if __GNUC_PREREQ (3, 2) # define strpbrk(s, accept) \ __extension__ \ ({ char __a0, __a1, __a2; \ (__builtin_constant_p (accept) && __string2_1bptr_p (accept) \ ? ((__builtin_constant_p (s) && __string2_1bptr_p (s)) \ ? __builtin_strpbrk (s, accept) \ : ((__a0 = ((const char *) (accept))[0], __a0 == '\0') \ ? ((void) (s), (char *) NULL) \ : ((__a1 = ((const char *) (accept))[1], __a1 == '\0') \ ? __builtin_strchr (s, __a0) \ : ((__a2 = ((const char *) (accept))[2], __a2 == '\0') \ ? __strpbrk_c2 (s, __a0, __a1) \ : (((const char *) (accept))[3] == '\0' \ ? __strpbrk_c3 (s, __a0, __a1, __a2) \ : __builtin_strpbrk (s, accept)))))) \ : __builtin_strpbrk (s, accept)); }) # else # define strpbrk(s, accept) \ __extension__ \ ({ char __a0, __a1, __a2; \ (__builtin_constant_p (accept) && __string2_1bptr_p (accept) \ ? ((__a0 = ((const char *) (accept))[0], __a0 == '\0') \ ? ((void) (s), (char *) NULL) \ : ((__a1 = ((const char *) (accept))[1], __a1 == '\0') \ ? strchr (s, __a0) \ : ((__a2 = ((const char *) (accept))[2], __a2 == '\0') \ ? __strpbrk_c2 (s, __a0, __a1) \ : (((const char *) (accept))[3] == '\0' \ ? __strpbrk_c3 (s, __a0, __a1, __a2) \ : strpbrk (s, accept))))) \ : strpbrk (s, accept)); }) # endif # endif __STRING_INLINE char *__strpbrk_c2 (const char *__s, int __accept1, int __accept2); __STRING_INLINE char * __strpbrk_c2 (const char *__s, int __accept1, int __accept2) { /* Please note that __accept1 and __accept2 never can be '\0'. */ while (*__s != '\0' && *__s != __accept1 && *__s != __accept2) ++__s; return *__s == '\0' ? NULL : (char *) (size_t) __s; } __STRING_INLINE char *__strpbrk_c3 (const char *__s, int __accept1, int __accept2, int __accept3); __STRING_INLINE char * __strpbrk_c3 (const char *__s, int __accept1, int __accept2, int __accept3) { /* Please note that __accept1 to __accept3 never can be '\0'. */ while (*__s != '\0' && *__s != __accept1 && *__s != __accept2 && *__s != __accept3) ++__s; return *__s == '\0' ? NULL : (char *) (size_t) __s; } #endif /* Find the first occurrence of NEEDLE in HAYSTACK. Newer gcc versions do this itself. */ #if !defined _HAVE_STRING_ARCH_strstr && !__GNUC_PREREQ (2, 97) # define strstr(haystack, needle) \ (__extension__ (__builtin_constant_p (needle) && __string2_1bptr_p (needle) \ ? (((const char *) (needle))[0] == '\0' \ ? (char *) (size_t) (haystack) \ : (((const char *) (needle))[1] == '\0' \ ? strchr (haystack, \ ((const char *) (needle))[0]) \ : strstr (haystack, needle))) \ : strstr (haystack, needle))) #endif #if !defined _HAVE_STRING_ARCH_strtok_r || defined _FORCE_INLINES # ifndef _HAVE_STRING_ARCH_strtok_r # define __strtok_r(s, sep, nextp) \ (__extension__ (__builtin_constant_p (sep) && __string2_1bptr_p (sep) \ && ((const char *) (sep))[0] != '\0' \ && ((const char *) (sep))[1] == '\0' \ ? __strtok_r_1c (s, ((const char *) (sep))[0], nextp) \ : __strtok_r (s, sep, nextp))) # endif __STRING_INLINE char *__strtok_r_1c (char *__s, char __sep, char **__nextp); __STRING_INLINE char * __strtok_r_1c (char *__s, char __sep, char **__nextp) { char *__result; if (__s == NULL) __s = *__nextp; while (*__s == __sep) ++__s; __result = NULL; if (*__s != '\0') { __result = __s++; while (*__s != '\0') if (*__s++ == __sep) { __s[-1] = '\0'; break; } } *__nextp = __s; return __result; } # if defined __USE_POSIX || defined __USE_MISC # define strtok_r(s, sep, nextp) __strtok_r (s, sep, nextp) # endif #endif #if !defined _HAVE_STRING_ARCH_strsep || defined _FORCE_INLINES # ifndef _HAVE_STRING_ARCH_strsep extern char *__strsep_g (char **__stringp, const char *__delim); # define __strsep(s, reject) \ __extension__ \ ({ char __r0, __r1, __r2; \ (__builtin_constant_p (reject) && __string2_1bptr_p (reject) \ && (__r0 = ((const char *) (reject))[0], \ ((const char *) (reject))[0] != '\0') \ ? ((__r1 = ((const char *) (reject))[1], \ ((const char *) (reject))[1] == '\0') \ ? __strsep_1c (s, __r0) \ : ((__r2 = ((const char *) (reject))[2], __r2 == '\0') \ ? __strsep_2c (s, __r0, __r1) \ : (((const char *) (reject))[3] == '\0' \ ? __strsep_3c (s, __r0, __r1, __r2) \ : __strsep_g (s, reject)))) \ : __strsep_g (s, reject)); }) # endif __STRING_INLINE char *__strsep_1c (char **__s, char __reject); __STRING_INLINE char * __strsep_1c (char **__s, char __reject) { char *__retval = *__s; if (__retval != NULL && (*__s = strchr (__retval, __reject)) != NULL) *(*__s)++ = '\0'; return __retval; } __STRING_INLINE char *__strsep_2c (char **__s, char __reject1, char __reject2); __STRING_INLINE char * __strsep_2c (char **__s, char __reject1, char __reject2) { char *__retval = *__s; if (__retval != NULL) { char *__cp = __retval; while (1) { if (*__cp == '\0') { __cp = NULL; break; } if (*__cp == __reject1 || *__cp == __reject2) { *__cp++ = '\0'; break; } ++__cp; } *__s = __cp; } return __retval; } __STRING_INLINE char *__strsep_3c (char **__s, char __reject1, char __reject2, char __reject3); __STRING_INLINE char * __strsep_3c (char **__s, char __reject1, char __reject2, char __reject3) { char *__retval = *__s; if (__retval != NULL) { char *__cp = __retval; while (1) { if (*__cp == '\0') { __cp = NULL; break; } if (*__cp == __reject1 || *__cp == __reject2 || *__cp == __reject3) { *__cp++ = '\0'; break; } ++__cp; } *__s = __cp; } return __retval; } # ifdef __USE_BSD # define strsep(s, reject) __strsep (s, reject) # endif #endif /* We need the memory allocation functions for inline strdup(). Referring to stdlib.h (even minimally) is not allowed in any of the tight standards compliant modes. */ #ifdef __USE_MISC # if !defined _HAVE_STRING_ARCH_strdup || !defined _HAVE_STRING_ARCH_strndup # define __need_malloc_and_calloc # include <stdlib.h> # endif # ifndef _HAVE_STRING_ARCH_strdup extern char *__strdup (const char *__string) __THROW __attribute_malloc__; # define __strdup(s) \ (__extension__ (__builtin_constant_p (s) && __string2_1bptr_p (s) \ ? (((const char *) (s))[0] == '\0' \ ? (char *) calloc ((size_t) 1, (size_t) 1) \ : ({ size_t __len = strlen (s) + 1; \ char *__retval = (char *) malloc (__len); \ if (__retval != NULL) \ __retval = (char *) memcpy (__retval, s, __len); \ __retval; })) \ : __strdup (s))) # if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED # define strdup(s) __strdup (s) # endif # endif # ifndef _HAVE_STRING_ARCH_strndup extern char *__strndup (const char *__string, size_t __n) __THROW __attribute_malloc__; # define __strndup(s, n) \ (__extension__ (__builtin_constant_p (s) && __string2_1bptr_p (s) \ ? (((const char *) (s))[0] == '\0' \ ? (char *) calloc ((size_t) 1, (size_t) 1) \ : ({ size_t __len = strlen (s) + 1; \ size_t __n = (n); \ char *__retval; \ if (__n < __len) \ __len = __n + 1; \ __retval = (char *) malloc (__len); \ if (__retval != NULL) \ { \ __retval[__len - 1] = '\0'; \ __retval = (char *) memcpy (__retval, s, \ __len - 1); \ } \ __retval; })) \ : __strndup (s, n))) # ifdef __USE_GNU # define strndup(s, n) __strndup (s, n) # endif # endif #endif /* Use misc. or use GNU. */ #ifndef _FORCE_INLINES # undef __STRING_INLINE #endif #endif /* No string inlines. */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/sigthread.h������������������������������������������������������������������������������������0000644�����������������00000003213�14763166030�0007635 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Signal handling function for threaded programs. Copyright (C) 1998-2000, 2002, 2009, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; see the file COPYING.LIB. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_SIGTHREAD_H #define _BITS_SIGTHREAD_H 1 #if !defined _SIGNAL_H && !defined _PTHREAD_H # error "Never include this file directly. Use <pthread.h> instead" #endif /* Functions for handling signals. */ /* Modify the signal mask for the calling thread. The arguments have the same meaning as for sigprocmask(2). */ extern int pthread_sigmask (int __how, const __sigset_t *__restrict __newmask, __sigset_t *__restrict __oldmask)__THROW; /* Send signal SIGNO to the given thread. */ extern int pthread_kill (pthread_t __threadid, int __signo) __THROW; #ifdef __USE_GNU /* Queue signal and data to a thread. */ extern int pthread_sigqueue (pthread_t __threadid, int __signo, const union sigval __value) __THROW; #endif #endif /* bits/sigthread.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/signalfd.h�������������������������������������������������������������������������������������0000644�����������������00000002052�14763166030�0007452 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2007-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SIGNALFD_H # error "Never use <bits/signalfd.h> directly; include <sys/signalfd.h> instead." #endif /* Flags for signalfd. */ enum { SFD_CLOEXEC = 02000000, #define SFD_CLOEXEC SFD_CLOEXEC SFD_NONBLOCK = 00004000 #define SFD_NONBLOCK SFD_NONBLOCK }; ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/select2.h��������������������������������������������������������������������������������������0000644�����������������00000002636�14763166030�0007234 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Checking macros for select functions. Copyright (C) 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SELECT_H # error "Never include <bits/select2.h> directly; use <sys/select.h> instead." #endif /* Helper functions to issue warnings and errors when needed. */ extern long int __fdelt_chk (long int __d); extern long int __fdelt_warn (long int __d) __warnattr ("bit outside of fd_set selected"); #undef __FD_ELT #define __FD_ELT(d) \ __extension__ \ ({ long int __d = (d); \ (__builtin_constant_p (__d) \ ? (0 <= __d && __d < __FD_SETSIZE \ ? (__d / __NFDBITS) \ : __fdelt_warn (__d)) \ : __fdelt_chk (__d)); }) ��������������������������������������������������������������������������������������������������bits/uio.h������������������������������������������������������������������������������������������0000644�����������������00000004660�14763166030�0006466 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996, 1997, 2006, 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #if !defined _SYS_UIO_H && !defined _FCNTL_H # error "Never include <bits/uio.h> directly; use <sys/uio.h> instead." #endif #ifndef _BITS_UIO_H #define _BITS_UIO_H 1 #include <sys/types.h> /* We should normally use the Linux kernel header file to define this type and macros but this calls for trouble because of the header includes other kernel headers. */ /* Size of object which can be written atomically. This macro has different values in different kernel versions. The latest versions of the kernel use 1024 and this is good choice. Since the C library implementation of readv/writev is able to emulate the functionality even if the currently running kernel does not support this large value the readv/writev call will not fail because of this. */ #define UIO_MAXIOV 1024 /* Structure for scatter/gather I/O. */ struct iovec { void *iov_base; /* Pointer to data. */ size_t iov_len; /* Length of data. */ }; #endif #ifdef __USE_GNU # if defined _SYS_UIO_H && !defined _BITS_UIO_H_FOR_SYS_UIO_H # define _BITS_UIO_H_FOR_SYS_UIO_H 1 __BEGIN_DECLS /* Read from another process' address space. */ extern ssize_t process_vm_readv (pid_t __pid, const struct iovec *__lvec, unsigned long int __liovcnt, const struct iovec *__rvec, unsigned long int __riovcnt, unsigned long int __flags) __THROW; /* Write to another process' address space. */ extern ssize_t process_vm_writev (pid_t __pid, const struct iovec *__lvec, unsigned long int __liovcnt, const struct iovec *__rvec, unsigned long int __riovcnt, unsigned long int __flags) __THROW; __END_DECLS # endif #endif ��������������������������������������������������������������������������������bits/sigset.h���������������������������������������������������������������������������������������0000644�����������������00000010753�14763166030�0007170 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* __sig_atomic_t, __sigset_t, and related definitions. Linux version. Copyright (C) 1991, 1992, 1994, 1996, 1997, 2007, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SIGSET_H_types # define _SIGSET_H_types 1 typedef int __sig_atomic_t; /* A `sigset_t' has a bit for each signal. */ # define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int))) typedef struct { unsigned long int __val[_SIGSET_NWORDS]; } __sigset_t; #endif /* We only want to define these functions if <signal.h> was actually included; otherwise we were included just to define the types. Since we are namespace-clean, it wouldn't hurt to define extra macros. But trouble can be caused by functions being defined (e.g., any global register vars declared later will cause compilation errors). */ #if !defined _SIGSET_H_fns && defined _SIGNAL_H # define _SIGSET_H_fns 1 # ifndef _EXTERN_INLINE # define _EXTERN_INLINE __extern_inline # endif /* Return a mask that includes the bit for SIG only. */ # define __sigmask(sig) \ (((unsigned long int) 1) << (((sig) - 1) % (8 * sizeof (unsigned long int)))) /* Return the word index for SIG. */ # define __sigword(sig) (((sig) - 1) / (8 * sizeof (unsigned long int))) # if defined __GNUC__ && __GNUC__ >= 2 # define __sigemptyset(set) \ (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ sigset_t *__set = (set); \ while (--__cnt >= 0) __set->__val[__cnt] = 0; \ 0; })) # define __sigfillset(set) \ (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ sigset_t *__set = (set); \ while (--__cnt >= 0) __set->__val[__cnt] = ~0UL; \ 0; })) # ifdef __USE_GNU /* The POSIX does not specify for handling the whole signal set in one command. This is often wanted and so we define three more functions here. */ # define __sigisemptyset(set) \ (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ const sigset_t *__set = (set); \ int __ret = __set->__val[--__cnt]; \ while (!__ret && --__cnt >= 0) \ __ret = __set->__val[__cnt]; \ __ret == 0; })) # define __sigandset(dest, left, right) \ (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ sigset_t *__dest = (dest); \ const sigset_t *__left = (left); \ const sigset_t *__right = (right); \ while (--__cnt >= 0) \ __dest->__val[__cnt] = (__left->__val[__cnt] \ & __right->__val[__cnt]); \ 0; })) # define __sigorset(dest, left, right) \ (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ sigset_t *__dest = (dest); \ const sigset_t *__left = (left); \ const sigset_t *__right = (right); \ while (--__cnt >= 0) \ __dest->__val[__cnt] = (__left->__val[__cnt] \ | __right->__val[__cnt]); \ 0; })) # endif # endif /* These functions needn't check for a bogus signal number -- error checking is done in the non __ versions. */ extern int __sigismember (const __sigset_t *, int); extern int __sigaddset (__sigset_t *, int); extern int __sigdelset (__sigset_t *, int); # ifdef __USE_EXTERN_INLINES # define __SIGSETFN(NAME, BODY, CONST) \ _EXTERN_INLINE int \ NAME (CONST __sigset_t *__set, int __sig) \ { \ unsigned long int __mask = __sigmask (__sig); \ unsigned long int __word = __sigword (__sig); \ return BODY; \ } __SIGSETFN (__sigismember, (__set->__val[__word] & __mask) ? 1 : 0, const) __SIGSETFN (__sigaddset, ((__set->__val[__word] |= __mask), 0), ) __SIGSETFN (__sigdelset, ((__set->__val[__word] &= ~__mask), 0), ) # undef __SIGSETFN # endif #endif /* ! _SIGSET_H_fns. */ ���������������������bits/socket_type.h����������������������������������������������������������������������������������0000644�����������������00000004247�14763166030�0010224 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Define enum __socket_type for generic Linux. Copyright (C) 1991-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SOCKET_H # error "Never include <bits/socket_type.h> directly; use <sys/socket.h> instead." #endif /* Types of sockets. */ enum __socket_type { SOCK_STREAM = 1, /* Sequenced, reliable, connection-based byte streams. */ #define SOCK_STREAM SOCK_STREAM SOCK_DGRAM = 2, /* Connectionless, unreliable datagrams of fixed maximum length. */ #define SOCK_DGRAM SOCK_DGRAM SOCK_RAW = 3, /* Raw protocol interface. */ #define SOCK_RAW SOCK_RAW SOCK_RDM = 4, /* Reliably-delivered messages. */ #define SOCK_RDM SOCK_RDM SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based, datagrams of fixed maximum length. */ #define SOCK_SEQPACKET SOCK_SEQPACKET SOCK_DCCP = 6, /* Datagram Congestion Control Protocol. */ #define SOCK_DCCP SOCK_DCCP SOCK_PACKET = 10, /* Linux specific way of getting packets at the dev level. For writing rarp and other similar things on the user level. */ #define SOCK_PACKET SOCK_PACKET /* Flags to be ORed into the type parameter of socket and socketpair and used for the flags parameter of paccept. */ SOCK_CLOEXEC = 02000000, /* Atomically set close-on-exec flag for the new descriptor(s). */ #define SOCK_CLOEXEC SOCK_CLOEXEC SOCK_NONBLOCK = 00004000 /* Atomically mark descriptor(s) as non-blocking. */ #define SOCK_NONBLOCK SOCK_NONBLOCK }; ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/socket2.h��������������������������������������������������������������������������������������0000644�����������������00000005721�14763166030�0007243 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Checking macros for socket functions. Copyright (C) 2005-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SOCKET_H # error "Never include <bits/socket2.h> directly; use <sys/socket.h> instead." #endif extern ssize_t __recv_chk (int __fd, void *__buf, size_t __n, size_t __buflen, int __flags); extern ssize_t __REDIRECT (__recv_alias, (int __fd, void *__buf, size_t __n, int __flags), recv); extern ssize_t __REDIRECT (__recv_chk_warn, (int __fd, void *__buf, size_t __n, size_t __buflen, int __flags), __recv_chk) __warnattr ("recv called with bigger length than size of destination " "buffer"); __fortify_function ssize_t recv (int __fd, void *__buf, size_t __n, int __flags) { if (__bos0 (__buf) != (size_t) -1) { if (!__builtin_constant_p (__n)) return __recv_chk (__fd, __buf, __n, __bos0 (__buf), __flags); if (__n > __bos0 (__buf)) return __recv_chk_warn (__fd, __buf, __n, __bos0 (__buf), __flags); } return __recv_alias (__fd, __buf, __n, __flags); } extern ssize_t __recvfrom_chk (int __fd, void *__restrict __buf, size_t __n, size_t __buflen, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len); extern ssize_t __REDIRECT (__recvfrom_alias, (int __fd, void *__restrict __buf, size_t __n, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len), recvfrom); extern ssize_t __REDIRECT (__recvfrom_chk_warn, (int __fd, void *__restrict __buf, size_t __n, size_t __buflen, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len), __recvfrom_chk) __warnattr ("recvfrom called with bigger length than size of " "destination buffer"); __fortify_function ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len) { if (__bos0 (__buf) != (size_t) -1) { if (!__builtin_constant_p (__n)) return __recvfrom_chk (__fd, __buf, __n, __bos0 (__buf), __flags, __addr, __addr_len); if (__n > __bos0 (__buf)) return __recvfrom_chk_warn (__fd, __buf, __n, __bos0 (__buf), __flags, __addr, __addr_len); } return __recvfrom_alias (__fd, __buf, __n, __flags, __addr, __addr_len); } �����������������������������������������������bits/dirent.h���������������������������������������������������������������������������������������0000644�����������������00000003300�14763166030�0007145 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _DIRENT_H # error "Never use <bits/dirent.h> directly; include <dirent.h> instead." #endif struct dirent { #ifndef __USE_FILE_OFFSET64 __ino_t d_ino; __off_t d_off; #else __ino64_t d_ino; __off64_t d_off; #endif unsigned short int d_reclen; unsigned char d_type; char d_name[256]; /* We must not include limits.h! */ }; #ifdef __USE_LARGEFILE64 struct dirent64 { __ino64_t d_ino; __off64_t d_off; unsigned short int d_reclen; unsigned char d_type; char d_name[256]; /* We must not include limits.h! */ }; #endif #define d_fileno d_ino /* Backwards compatibility. */ #undef _DIRENT_HAVE_D_NAMLEN #define _DIRENT_HAVE_D_RECLEN #define _DIRENT_HAVE_D_OFF #define _DIRENT_HAVE_D_TYPE #if defined __OFF_T_MATCHES_OFF64_T && defined __INO_T_MATCHES_INO64_T /* Inform libc code that these two types are effectively identical. */ # define _DIRENT_MATCHES_DIRENT64 1 #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/sockaddr.h�������������������������������������������������������������������������������������0000644�����������������00000002775�14763166030�0007471 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Definition of struct sockaddr_* common members and sizes, generic version. Copyright (C) 1995,1996,1997,1998,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * Never include this file directly; use <sys/socket.h> instead. */ #ifndef _BITS_SOCKADDR_H #define _BITS_SOCKADDR_H 1 /* POSIX.1g specifies this type name for the `sa_family' member. */ typedef unsigned short int sa_family_t; /* This macro is used to declare the initial common members of the data types used for socket addresses, `struct sockaddr', `struct sockaddr_in', `struct sockaddr_un', etc. */ #define __SOCKADDR_COMMON(sa_prefix) \ sa_family_t sa_prefix##family #define __SOCKADDR_COMMON_SIZE (sizeof (unsigned short int)) /* Size of struct sockaddr_storage. */ #define _SS_SIZE 128 #endif /* bits/sockaddr.h */ ���bits/string3.h��������������������������������������������������������������������������������������0000644�����������������00000010612�14763166030�0007255 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2004, 2005, 2007, 2009, 2010, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _STRING_H # error "Never use <bits/string3.h> directly; include <string.h> instead." #endif __warndecl (__warn_memset_zero_len, "memset used with constant zero length parameter; this could be due to transposed parameters"); #ifndef __cplusplus /* XXX This is temporarily. We should not redefine any of the symbols and instead integrate the error checking into the original definitions. */ # undef memcpy # undef memmove # undef memset # undef strcat # undef strcpy # undef strncat # undef strncpy # ifdef __USE_GNU # undef mempcpy # undef stpcpy # endif # ifdef __USE_BSD # undef bcopy # undef bzero # endif #endif __fortify_function void * __NTH (memcpy (void *__restrict __dest, const void *__restrict __src, size_t __len)) { return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); } __fortify_function void * __NTH (memmove (void *__dest, const void *__src, size_t __len)) { return __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest)); } #ifdef __USE_GNU __fortify_function void * __NTH (mempcpy (void *__restrict __dest, const void *__restrict __src, size_t __len)) { return __builtin___mempcpy_chk (__dest, __src, __len, __bos0 (__dest)); } #endif /* The first two tests here help to catch a somewhat common problem where the second and third parameter are transposed. This is especially problematic if the intended fill value is zero. In this case no work is done at all. We detect these problems by referring non-existing functions. */ __fortify_function void * __NTH (memset (void *__dest, int __ch, size_t __len)) { if (__builtin_constant_p (__len) && __len == 0 && (!__builtin_constant_p (__ch) || __ch != 0)) { __warn_memset_zero_len (); return __dest; } return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest)); } #ifdef __USE_BSD __fortify_function void __NTH (bcopy (const void *__src, void *__dest, size_t __len)) { (void) __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest)); } __fortify_function void __NTH (bzero (void *__dest, size_t __len)) { (void) __builtin___memset_chk (__dest, '\0', __len, __bos0 (__dest)); } #endif __fortify_function char * __NTH (strcpy (char *__restrict __dest, const char *__restrict __src)) { return __builtin___strcpy_chk (__dest, __src, __bos (__dest)); } #ifdef __USE_GNU __fortify_function char * __NTH (stpcpy (char *__restrict __dest, const char *__restrict __src)) { return __builtin___stpcpy_chk (__dest, __src, __bos (__dest)); } #endif __fortify_function char * __NTH (strncpy (char *__restrict __dest, const char *__restrict __src, size_t __len)) { return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); } // XXX We have no corresponding builtin yet. extern char *__stpncpy_chk (char *__dest, const char *__src, size_t __n, size_t __destlen) __THROW; extern char *__REDIRECT_NTH (__stpncpy_alias, (char *__dest, const char *__src, size_t __n), stpncpy); __fortify_function char * __NTH (stpncpy (char *__dest, const char *__src, size_t __n)) { if (__bos (__dest) != (size_t) -1 && (!__builtin_constant_p (__n) || __n <= __bos (__dest))) return __stpncpy_chk (__dest, __src, __n, __bos (__dest)); return __stpncpy_alias (__dest, __src, __n); } __fortify_function char * __NTH (strcat (char *__restrict __dest, const char *__restrict __src)) { return __builtin___strcat_chk (__dest, __src, __bos (__dest)); } __fortify_function char * __NTH (strncat (char *__restrict __dest, const char *__restrict __src, size_t __len)) { return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest)); } ����������������������������������������������������������������������������������������������������������������������bits/hwcap.h����������������������������������������������������������������������������������������0000644�����������������00000001706�14763166030�0006772 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Defines for bits in AT_HWCAP. Copyright (C) 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_AUXV_H # error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead." #endif /* No bits defined for this architecture. */ ����������������������������������������������������������bits/ioctls.h���������������������������������������������������������������������������������������0000644�����������������00000010612�14763166030�0007161 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996, 1997, 1998, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_IOCTL_H # error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead." #endif /* Use the definitions from the kernel header files. */ #include <asm/ioctls.h> /* Routing table calls. */ #define SIOCADDRT 0x890B /* add routing table entry */ #define SIOCDELRT 0x890C /* delete routing table entry */ #define SIOCRTMSG 0x890D /* call to routing system */ /* Socket configuration controls. */ #define SIOCGIFNAME 0x8910 /* get iface name */ #define SIOCSIFLINK 0x8911 /* set iface channel */ #define SIOCGIFCONF 0x8912 /* get iface list */ #define SIOCGIFFLAGS 0x8913 /* get flags */ #define SIOCSIFFLAGS 0x8914 /* set flags */ #define SIOCGIFADDR 0x8915 /* get PA address */ #define SIOCSIFADDR 0x8916 /* set PA address */ #define SIOCGIFDSTADDR 0x8917 /* get remote PA address */ #define SIOCSIFDSTADDR 0x8918 /* set remote PA address */ #define SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ #define SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ #define SIOCGIFNETMASK 0x891b /* get network PA mask */ #define SIOCSIFNETMASK 0x891c /* set network PA mask */ #define SIOCGIFMETRIC 0x891d /* get metric */ #define SIOCSIFMETRIC 0x891e /* set metric */ #define SIOCGIFMEM 0x891f /* get memory address (BSD) */ #define SIOCSIFMEM 0x8920 /* set memory address (BSD) */ #define SIOCGIFMTU 0x8921 /* get MTU size */ #define SIOCSIFMTU 0x8922 /* set MTU size */ #define SIOCSIFNAME 0x8923 /* set interface name */ #define SIOCSIFHWADDR 0x8924 /* set hardware address */ #define SIOCGIFENCAP 0x8925 /* get/set encapsulations */ #define SIOCSIFENCAP 0x8926 #define SIOCGIFHWADDR 0x8927 /* Get hardware address */ #define SIOCGIFSLAVE 0x8929 /* Driver slaving support */ #define SIOCSIFSLAVE 0x8930 #define SIOCADDMULTI 0x8931 /* Multicast address lists */ #define SIOCDELMULTI 0x8932 #define SIOCGIFINDEX 0x8933 /* name -> if_index mapping */ #define SIOGIFINDEX SIOCGIFINDEX /* misprint compatibility :-) */ #define SIOCSIFPFLAGS 0x8934 /* set/get extended flags set */ #define SIOCGIFPFLAGS 0x8935 #define SIOCDIFADDR 0x8936 /* delete PA address */ #define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */ #define SIOCGIFCOUNT 0x8938 /* get number of devices */ #define SIOCGIFBR 0x8940 /* Bridging support */ #define SIOCSIFBR 0x8941 /* Set bridging options */ #define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ #define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ /* ARP cache control calls. */ /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ #define SIOCDARP 0x8953 /* delete ARP table entry */ #define SIOCGARP 0x8954 /* get ARP table entry */ #define SIOCSARP 0x8955 /* set ARP table entry */ /* RARP cache control calls. */ #define SIOCDRARP 0x8960 /* delete RARP table entry */ #define SIOCGRARP 0x8961 /* get RARP table entry */ #define SIOCSRARP 0x8962 /* set RARP table entry */ /* Driver configuration calls */ #define SIOCGIFMAP 0x8970 /* Get device parameters */ #define SIOCSIFMAP 0x8971 /* Set device parameters */ /* DLCI configuration calls */ #define SIOCADDDLCI 0x8980 /* Create new DLCI device */ #define SIOCDELDLCI 0x8981 /* Delete DLCI device */ /* Device private ioctl calls. */ /* These 16 ioctls are available to devices via the do_ioctl() device vector. Each device should include this file and redefine these names as their own. Because these are device dependent it is a good idea _NOT_ to issue them to random objects and hope. */ #define SIOCDEVPRIVATE 0x89F0 /* to 89FF */ /* * These 16 ioctl calls are protocol private */ #define SIOCPROTOPRIVATE 0x89E0 /* to 89EF */ ����������������������������������������������������������������������������������������������������������������������bits/stab.def���������������������������������������������������������������������������������������0000644�����������������00000021512�14763166030�0007125 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Table of DBX symbol codes for the GNU system. Copyright (C) 1988, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* This contains contribution from Cygnus Support. */ /* Global variable. Only the name is significant. To find the address, look in the corresponding external symbol. */ __define_stab (N_GSYM, 0x20, "GSYM") /* Function name for BSD Fortran. Only the name is significant. To find the address, look in the corresponding external symbol. */ __define_stab (N_FNAME, 0x22, "FNAME") /* Function name or text-segment variable for C. Value is its address. Desc is supposedly starting line number, but GCC doesn't set it and DBX seems not to miss it. */ __define_stab (N_FUN, 0x24, "FUN") /* Data-segment variable with internal linkage. Value is its address. "Static Sym". */ __define_stab (N_STSYM, 0x26, "STSYM") /* BSS-segment variable with internal linkage. Value is its address. */ __define_stab (N_LCSYM, 0x28, "LCSYM") /* Name of main routine. Only the name is significant. This is not used in C. */ __define_stab (N_MAIN, 0x2a, "MAIN") /* Global symbol in Pascal. Supposedly the value is its line number; I'm skeptical. */ __define_stab (N_PC, 0x30, "PC") /* Number of symbols: 0, files,,funcs,lines according to Ultrix V4.0. */ __define_stab (N_NSYMS, 0x32, "NSYMS") /* "No DST map for sym: name, ,0,type,ignored" according to Ultrix V4.0. */ __define_stab (N_NOMAP, 0x34, "NOMAP") /* New stab from Solaris. I don't know what it means, but it don't seem to contain useful information. */ __define_stab (N_OBJ, 0x38, "OBJ") /* New stab from Solaris. I don't know what it means, but it don't seem to contain useful information. Possibly related to the optimization flags used in this module. */ __define_stab (N_OPT, 0x3c, "OPT") /* Register variable. Value is number of register. */ __define_stab (N_RSYM, 0x40, "RSYM") /* Modula-2 compilation unit. Can someone say what info it contains? */ __define_stab (N_M2C, 0x42, "M2C") /* Line number in text segment. Desc is the line number; value is corresponding address. */ __define_stab (N_SLINE, 0x44, "SLINE") /* Similar, for data segment. */ __define_stab (N_DSLINE, 0x46, "DSLINE") /* Similar, for bss segment. */ __define_stab (N_BSLINE, 0x48, "BSLINE") /* Sun's source-code browser stabs. ?? Don't know what the fields are. Supposedly the field is "path to associated .cb file". THIS VALUE OVERLAPS WITH N_BSLINE! */ __define_stab (N_BROWS, 0x48, "BROWS") /* GNU Modula-2 definition module dependency. Value is the modification time of the definition file. Other is non-zero if it is imported with the GNU M2 keyword %INITIALIZE. Perhaps N_M2C can be used if there are enough empty fields? */ __define_stab(N_DEFD, 0x4a, "DEFD") /* THE FOLLOWING TWO STAB VALUES CONFLICT. Happily, one is for Modula-2 and one is for C++. Still,... */ /* GNU C++ exception variable. Name is variable name. */ __define_stab (N_EHDECL, 0x50, "EHDECL") /* Modula2 info "for imc": name,,0,0,0 according to Ultrix V4.0. */ __define_stab (N_MOD2, 0x50, "MOD2") /* GNU C++ `catch' clause. Value is its address. Desc is nonzero if this entry is immediately followed by a CAUGHT stab saying what exception was caught. Multiple CAUGHT stabs means that multiple exceptions can be caught here. If Desc is 0, it means all exceptions are caught here. */ __define_stab (N_CATCH, 0x54, "CATCH") /* Structure or union element. Value is offset in the structure. */ __define_stab (N_SSYM, 0x60, "SSYM") /* Name of main source file. Value is starting text address of the compilation. */ __define_stab (N_SO, 0x64, "SO") /* Automatic variable in the stack. Value is offset from frame pointer. Also used for type descriptions. */ __define_stab (N_LSYM, 0x80, "LSYM") /* Beginning of an include file. Only Sun uses this. In an object file, only the name is significant. The Sun linker puts data into some of the other fields. */ __define_stab (N_BINCL, 0x82, "BINCL") /* Name of sub-source file (#include file). Value is starting text address of the compilation. */ __define_stab (N_SOL, 0x84, "SOL") /* Parameter variable. Value is offset from argument pointer. (On most machines the argument pointer is the same as the frame pointer. */ __define_stab (N_PSYM, 0xa0, "PSYM") /* End of an include file. No name. This and N_BINCL act as brackets around the file's output. In an object file, there is no significant data in this entry. The Sun linker puts data into some of the fields. */ __define_stab (N_EINCL, 0xa2, "EINCL") /* Alternate entry point. Value is its address. */ __define_stab (N_ENTRY, 0xa4, "ENTRY") /* Beginning of lexical block. The desc is the nesting level in lexical blocks. The value is the address of the start of the text for the block. The variables declared inside the block *precede* the N_LBRAC symbol. */ __define_stab (N_LBRAC, 0xc0, "LBRAC") /* Place holder for deleted include file. Replaces a N_BINCL and everything up to the corresponding N_EINCL. The Sun linker generates these when it finds multiple identical copies of the symbols from an include file. This appears only in output from the Sun linker. */ __define_stab (N_EXCL, 0xc2, "EXCL") /* Modula-2 scope information. Can someone say what info it contains? */ __define_stab (N_SCOPE, 0xc4, "SCOPE") /* End of a lexical block. Desc matches the N_LBRAC's desc. The value is the address of the end of the text for the block. */ __define_stab (N_RBRAC, 0xe0, "RBRAC") /* Begin named common block. Only the name is significant. */ __define_stab (N_BCOMM, 0xe2, "BCOMM") /* End named common block. Only the name is significant (and it should match the N_BCOMM). */ __define_stab (N_ECOMM, 0xe4, "ECOMM") /* End common (local name): value is address. I'm not sure how this is used. */ __define_stab (N_ECOML, 0xe8, "ECOML") /* These STAB's are used on Gould systems for Non-Base register symbols or something like that. FIXME. I have assigned the values at random since I don't have a Gould here. Fixups from Gould folk welcome... */ __define_stab (N_NBTEXT, 0xF0, "NBTEXT") __define_stab (N_NBDATA, 0xF2, "NBDATA") __define_stab (N_NBBSS, 0xF4, "NBBSS") __define_stab (N_NBSTS, 0xF6, "NBSTS") __define_stab (N_NBLCS, 0xF8, "NBLCS") /* Second symbol entry containing a length-value for the preceding entry. The value is the length. */ __define_stab (N_LENG, 0xfe, "LENG") /* The above information, in matrix format. STAB MATRIX _________________________________________________ | 00 - 1F are not dbx stab symbols | | In most cases, the low bit is the EXTernal bit| | 00 UNDEF | 02 ABS | 04 TEXT | 06 DATA | | 01 |EXT | 03 |EXT | 05 |EXT | 07 |EXT | | 08 BSS | 0A INDR | 0C FN_SEQ | 0E | | 09 |EXT | 0B | 0D | 0F | | 10 | 12 COMM | 14 SETA | 16 SETT | | 11 | 13 | 15 | 17 | | 18 SETD | 1A SETB | 1C SETV | 1E WARNING| | 19 | 1B | 1D | 1F FN | |_______________________________________________| | Debug entries with bit 01 set are unused. | | 20 GSYM | 22 FNAME | 24 FUN | 26 STSYM | | 28 LCSYM | 2A MAIN | 2C | 2E | | 30 PC | 32 NSYMS | 34 NOMAP | 36 | | 38 OBJ | 3A | 3C OPT | 3E | | 40 RSYM | 42 M2C | 44 SLINE | 46 DSLINE | | 48 BSLINE*| 4A DEFD | 4C | 4E | | 50 EHDECL*| 52 | 54 CATCH | 56 | | 58 | 5A | 5C | 5E | | 60 SSYM | 62 | 64 SO | 66 | | 68 | 6A | 6C | 6E | | 70 | 72 | 74 | 76 | | 78 | 7A | 7C | 7E | | 80 LSYM | 82 BINCL | 84 SOL | 86 | | 88 | 8A | 8C | 8E | | 90 | 92 | 94 | 96 | | 98 | 9A | 9C | 9E | | A0 PSYM | A2 EINCL | A4 ENTRY | A6 | | A8 | AA | AC | AE | | B0 | B2 | B4 | B6 | | B8 | BA | BC | BE | | C0 LBRAC | C2 EXCL | C4 SCOPE | C6 | | C8 | CA | CC | CE | | D0 | D2 | D4 | D6 | | D8 | DA | DC | DE | | E0 RBRAC | E2 BCOMM | E4 ECOMM | E6 | | E8 ECOML | EA | EC | EE | | F0 | F2 | F4 | F6 | | F8 | FA | FC | FE LENG | +-----------------------------------------------+ * 50 EHDECL is also MOD2. * 48 BSLINE is also BROWS. */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/pthreadtypes.h���������������������������������������������������������������������������������0000644�����������������00000014520�14763166030�0010402 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2002-2007, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_PTHREADTYPES_H #define _BITS_PTHREADTYPES_H 1 #include <bits/wordsize.h> #ifdef __x86_64__ # if __WORDSIZE == 64 # define __SIZEOF_PTHREAD_ATTR_T 56 # define __SIZEOF_PTHREAD_MUTEX_T 40 # define __SIZEOF_PTHREAD_MUTEXATTR_T 4 # define __SIZEOF_PTHREAD_COND_T 48 # define __SIZEOF_PTHREAD_CONDATTR_T 4 # define __SIZEOF_PTHREAD_RWLOCK_T 56 # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 # define __SIZEOF_PTHREAD_BARRIER_T 32 # define __SIZEOF_PTHREAD_BARRIERATTR_T 4 # else # define __SIZEOF_PTHREAD_ATTR_T 32 # define __SIZEOF_PTHREAD_MUTEX_T 32 # define __SIZEOF_PTHREAD_MUTEXATTR_T 4 # define __SIZEOF_PTHREAD_COND_T 48 # define __SIZEOF_PTHREAD_CONDATTR_T 4 # define __SIZEOF_PTHREAD_RWLOCK_T 44 # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 # define __SIZEOF_PTHREAD_BARRIER_T 20 # define __SIZEOF_PTHREAD_BARRIERATTR_T 4 # endif #else # define __SIZEOF_PTHREAD_ATTR_T 36 # define __SIZEOF_PTHREAD_MUTEX_T 24 # define __SIZEOF_PTHREAD_MUTEXATTR_T 4 # define __SIZEOF_PTHREAD_COND_T 48 # define __SIZEOF_PTHREAD_CONDATTR_T 4 # define __SIZEOF_PTHREAD_RWLOCK_T 32 # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 # define __SIZEOF_PTHREAD_BARRIER_T 20 # define __SIZEOF_PTHREAD_BARRIERATTR_T 4 #endif /* Thread identifiers. The structure of the attribute type is not exposed on purpose. */ typedef unsigned long int pthread_t; union pthread_attr_t { char __size[__SIZEOF_PTHREAD_ATTR_T]; long int __align; }; #ifndef __have_pthread_attr_t typedef union pthread_attr_t pthread_attr_t; # define __have_pthread_attr_t 1 #endif #ifdef __x86_64__ typedef struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; } __pthread_list_t; #else typedef struct __pthread_internal_slist { struct __pthread_internal_slist *__next; } __pthread_slist_t; #endif /* Data structures for mutex handling. The structure of the attribute type is not exposed on purpose. */ typedef union { struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; #ifdef __x86_64__ unsigned int __nusers; #endif /* KIND must stay at this position in the structure to maintain binary compatibility. */ int __kind; #ifdef __x86_64__ short __spins; short __elision; __pthread_list_t __list; # define __PTHREAD_MUTEX_HAVE_PREV 1 /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER. */ # define __PTHREAD_SPINS 0, 0 #else unsigned int __nusers; __extension__ union { struct { short __espins; short __elision; # define __spins __elision_data.__espins # define __elision __elision_data.__elision # define __PTHREAD_SPINS { 0, 0 } } __elision_data; __pthread_slist_t __list; }; #endif } __data; char __size[__SIZEOF_PTHREAD_MUTEX_T]; long int __align; } pthread_mutex_t; typedef union { char __size[__SIZEOF_PTHREAD_MUTEXATTR_T]; int __align; } pthread_mutexattr_t; /* Data structure for conditional variable handling. The structure of the attribute type is not exposed on purpose. */ typedef union { struct { int __lock; unsigned int __futex; __extension__ unsigned long long int __total_seq; __extension__ unsigned long long int __wakeup_seq; __extension__ unsigned long long int __woken_seq; void *__mutex; unsigned int __nwaiters; unsigned int __broadcast_seq; } __data; char __size[__SIZEOF_PTHREAD_COND_T]; __extension__ long long int __align; } pthread_cond_t; typedef union { char __size[__SIZEOF_PTHREAD_CONDATTR_T]; int __align; } pthread_condattr_t; /* Keys for thread-specific data */ typedef unsigned int pthread_key_t; /* Once-only execution */ typedef int pthread_once_t; #if defined __USE_UNIX98 || defined __USE_XOPEN2K /* Data structure for read-write lock variable handling. The structure of the attribute type is not exposed on purpose. */ typedef union { # ifdef __x86_64__ struct { int __lock; unsigned int __nr_readers; unsigned int __readers_wakeup; unsigned int __writer_wakeup; unsigned int __nr_readers_queued; unsigned int __nr_writers_queued; int __writer; int __shared; unsigned long int __pad1; unsigned long int __pad2; /* FLAGS must stay at this position in the structure to maintain binary compatibility. */ unsigned int __flags; # define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1 } __data; # else struct { int __lock; unsigned int __nr_readers; unsigned int __readers_wakeup; unsigned int __writer_wakeup; unsigned int __nr_readers_queued; unsigned int __nr_writers_queued; /* FLAGS must stay at this position in the structure to maintain binary compatibility. */ unsigned char __flags; unsigned char __shared; unsigned char __pad1; unsigned char __pad2; int __writer; } __data; # endif char __size[__SIZEOF_PTHREAD_RWLOCK_T]; long int __align; } pthread_rwlock_t; typedef union { char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T]; long int __align; } pthread_rwlockattr_t; #endif #ifdef __USE_XOPEN2K /* POSIX spinlock data type. */ typedef volatile int pthread_spinlock_t; /* POSIX barriers data type. The structure of the type is deliberately not exposed. */ typedef union { char __size[__SIZEOF_PTHREAD_BARRIER_T]; long int __align; } pthread_barrier_t; typedef union { char __size[__SIZEOF_PTHREAD_BARRIERATTR_T]; int __align; } pthread_barrierattr_t; #endif #ifndef __x86_64__ /* Extra attributes for the cleanup functions. */ # define __cleanup_fct_attribute __attribute__ ((__regparm__ (1))) #endif #endif /* bits/pthreadtypes.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/byteswap.h�������������������������������������������������������������������������������������0000644�����������������00000013071�14763166030�0007524 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Macros to swap the order of bytes in integer values. Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #if !defined _BYTESWAP_H && !defined _NETINET_IN_H && !defined _ENDIAN_H # error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead." #endif #ifndef _BITS_BYTESWAP_H #define _BITS_BYTESWAP_H 1 #include <features.h> #include <bits/types.h> #include <bits/wordsize.h> /* Swap bytes in 16 bit value. */ #define __bswap_constant_16(x) \ ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))) /* Get __bswap_16. */ #include <bits/byteswap-16.h> /* Swap bytes in 32 bit value. */ #define __bswap_constant_32(x) \ ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) #ifdef __GNUC__ # if __GNUC_PREREQ (4, 3) static __inline unsigned int __bswap_32 (unsigned int __bsx) { return __builtin_bswap32 (__bsx); } # elif __GNUC__ >= 2 # if __WORDSIZE == 64 || (defined __i486__ || defined __pentium__ \ || defined __pentiumpro__ || defined __pentium4__ \ || defined __k8__ || defined __athlon__ \ || defined __k6__ || defined __nocona__ \ || defined __core2__ || defined __geode__ \ || defined __amdfam10__) /* To swap the bytes in a word the i486 processors and up provide the `bswap' opcode. On i386 we have to use three instructions. */ # define __bswap_32(x) \ (__extension__ \ ({ unsigned int __v, __x = (x); \ if (__builtin_constant_p (__x)) \ __v = __bswap_constant_32 (__x); \ else \ __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); \ __v; })) # else # define __bswap_32(x) \ (__extension__ \ ({ unsigned int __v, __x = (x); \ if (__builtin_constant_p (__x)) \ __v = __bswap_constant_32 (__x); \ else \ __asm__ ("rorw $8, %w0;" \ "rorl $16, %0;" \ "rorw $8, %w0" \ : "=r" (__v) \ : "0" (__x) \ : "cc"); \ __v; })) # endif # else # define __bswap_32(x) \ (__extension__ \ ({ unsigned int __x = (x); __bswap_constant_32 (__x); })) # endif #else static __inline unsigned int __bswap_32 (unsigned int __bsx) { return __bswap_constant_32 (__bsx); } #endif #if __GNUC_PREREQ (2, 0) /* Swap bytes in 64 bit value. */ # define __bswap_constant_64(x) \ (__extension__ ((((x) & 0xff00000000000000ull) >> 56) \ | (((x) & 0x00ff000000000000ull) >> 40) \ | (((x) & 0x0000ff0000000000ull) >> 24) \ | (((x) & 0x000000ff00000000ull) >> 8) \ | (((x) & 0x00000000ff000000ull) << 8) \ | (((x) & 0x0000000000ff0000ull) << 24) \ | (((x) & 0x000000000000ff00ull) << 40) \ | (((x) & 0x00000000000000ffull) << 56))) # if __GNUC_PREREQ (4, 3) static __inline __uint64_t __bswap_64 (__uint64_t __bsx) { return __builtin_bswap64 (__bsx); } # elif __WORDSIZE == 64 # define __bswap_64(x) \ (__extension__ \ ({ __uint64_t __v, __x = (x); \ if (__builtin_constant_p (__x)) \ __v = __bswap_constant_64 (__x); \ else \ __asm__ ("bswap %q0" : "=r" (__v) : "0" (__x)); \ __v; })) # else # define __bswap_64(x) \ (__extension__ \ ({ union { __extension__ __uint64_t __ll; \ unsigned int __l[2]; } __w, __r; \ if (__builtin_constant_p (x)) \ __r.__ll = __bswap_constant_64 (x); \ else \ { \ __w.__ll = (x); \ __r.__l[0] = __bswap_32 (__w.__l[1]); \ __r.__l[1] = __bswap_32 (__w.__l[0]); \ } \ __r.__ll; })) # endif #elif __GLIBC_HAVE_LONG_LONG # define __bswap_constant_64(x) \ ((((x) & 0xff00000000000000ull) >> 56) \ | (((x) & 0x00ff000000000000ull) >> 40) \ | (((x) & 0x0000ff0000000000ull) >> 24) \ | (((x) & 0x000000ff00000000ull) >> 8) \ | (((x) & 0x00000000ff000000ull) << 8) \ | (((x) & 0x0000000000ff0000ull) << 24) \ | (((x) & 0x000000000000ff00ull) << 40) \ | (((x) & 0x00000000000000ffull) << 56)) static __inline __uint64_t __bswap_64 (__uint64_t __bsx) { return __bswap_constant_64 (__bsx); } #endif #endif /* _BITS_BYTESWAP_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/stdio-ldbl.h�����������������������������������������������������������������������������������0000644�����������������00000006155�14763166030�0007730 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -mlong-double-64 compatibility mode for stdio functions. Copyright (C) 2006-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _STDIO_H # error "Never include <bits/stdio-ldbl.h> directly; use <stdio.h> instead." #endif __BEGIN_NAMESPACE_STD __LDBL_REDIR_DECL (fprintf) __LDBL_REDIR_DECL (printf) __LDBL_REDIR_DECL (sprintf) __LDBL_REDIR_DECL (vfprintf) __LDBL_REDIR_DECL (vprintf) __LDBL_REDIR_DECL (vsprintf) #if defined __USE_ISOC99 && !defined __USE_GNU \ && !defined __REDIRECT \ && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) __LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf) __LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf) __LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf) #else __LDBL_REDIR_DECL (fscanf) __LDBL_REDIR_DECL (scanf) __LDBL_REDIR_DECL (sscanf) #endif __END_NAMESPACE_STD #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98 __BEGIN_NAMESPACE_C99 __LDBL_REDIR_DECL (snprintf) __LDBL_REDIR_DECL (vsnprintf) __END_NAMESPACE_C99 #endif #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 # if !defined __USE_GNU && !defined __REDIRECT \ && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) __LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf) __LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf) __LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf) # else __LDBL_REDIR_DECL (vfscanf) __LDBL_REDIR_DECL (vsscanf) __LDBL_REDIR_DECL (vscanf) # endif __END_NAMESPACE_C99 #endif #ifdef __USE_XOPEN2K8 __LDBL_REDIR_DECL (vdprintf) __LDBL_REDIR_DECL (dprintf) #endif #ifdef __USE_GNU __LDBL_REDIR_DECL (vasprintf) __LDBL_REDIR_DECL (__asprintf) __LDBL_REDIR_DECL (asprintf) __LDBL_REDIR_DECL (obstack_printf) __LDBL_REDIR_DECL (obstack_vprintf) #endif #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function __LDBL_REDIR_DECL (__sprintf_chk) __LDBL_REDIR_DECL (__vsprintf_chk) # if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98 __LDBL_REDIR_DECL (__snprintf_chk) __LDBL_REDIR_DECL (__vsnprintf_chk) # endif # if __USE_FORTIFY_LEVEL > 1 __LDBL_REDIR_DECL (__fprintf_chk) __LDBL_REDIR_DECL (__printf_chk) __LDBL_REDIR_DECL (__vfprintf_chk) __LDBL_REDIR_DECL (__vprintf_chk) # ifdef __USE_XOPEN2K8 __LDBL_REDIR_DECL (__dprintf_chk) __LDBL_REDIR_DECL (__vdprintf_chk) # endif # ifdef __USE_GNU __LDBL_REDIR_DECL (__asprintf_chk) __LDBL_REDIR_DECL (__vasprintf_chk) __LDBL_REDIR_DECL (__obstack_printf_chk) __LDBL_REDIR_DECL (__obstack_vprintf_chk) # endif # endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/mman.h�����������������������������������������������������������������������������������������0000644�����������������00000011435�14763166030�0006620 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Definitions for POSIX memory map interface. Linux/x86_64 version. Copyright (C) 2001-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_MMAN_H # error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." #endif /* The following definitions basically come from the kernel headers. But the kernel header is not namespace clean. */ /* Protections are chosen from these bits, OR'd together. The implementation does not necessarily support PROT_EXEC or PROT_WRITE without PROT_READ. The only guarantees are that no writing will be allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ #define PROT_READ 0x1 /* Page can be read. */ #define PROT_WRITE 0x2 /* Page can be written. */ #define PROT_EXEC 0x4 /* Page can be executed. */ #define PROT_NONE 0x0 /* Page can not be accessed. */ #define PROT_GROWSDOWN 0x01000000 /* Extend change to start of growsdown vma (mprotect only). */ #define PROT_GROWSUP 0x02000000 /* Extend change to start of growsup vma (mprotect only). */ /* Sharing types (must choose one and only one of these). */ #define MAP_SHARED 0x01 /* Share changes. */ #define MAP_PRIVATE 0x02 /* Changes are private. */ #ifdef __USE_MISC # define MAP_TYPE 0x0f /* Mask for type of mapping. */ #endif /* Other flags. */ #define MAP_FIXED 0x10 /* Interpret addr exactly. */ #ifdef __USE_MISC # define MAP_FILE 0 # define MAP_ANONYMOUS 0x20 /* Don't use a file. */ # define MAP_ANON MAP_ANONYMOUS # define MAP_32BIT 0x40 /* Only give out 32-bit addresses. */ #endif /* These are Linux-specific. */ #ifdef __USE_MISC # define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */ # define MAP_DENYWRITE 0x00800 /* ETXTBSY */ # define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */ # define MAP_LOCKED 0x02000 /* Lock the mapping. */ # define MAP_NORESERVE 0x04000 /* Don't check for reservations. */ # define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ # define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ # define MAP_STACK 0x20000 /* Allocation is for a stack. */ # define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ #endif /* Flags to `msync'. */ #define MS_ASYNC 1 /* Sync memory asynchronously. */ #define MS_SYNC 4 /* Synchronous memory sync. */ #define MS_INVALIDATE 2 /* Invalidate the caches. */ /* Flags for `mlockall'. */ #define MCL_CURRENT 1 /* Lock all currently mapped pages. */ #define MCL_FUTURE 2 /* Lock all additions to address space. */ /* Flags for `mremap'. */ #ifdef __USE_GNU # define MREMAP_MAYMOVE 1 # define MREMAP_FIXED 2 #endif /* Advice to `madvise'. */ #ifdef __USE_BSD # define MADV_NORMAL 0 /* No further special treatment. */ # define MADV_RANDOM 1 /* Expect random page references. */ # define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ # define MADV_WILLNEED 3 /* Will need these pages. */ # define MADV_DONTNEED 4 /* Don't need these pages. */ # define MADV_REMOVE 9 /* Remove these pages and resources. */ # define MADV_DONTFORK 10 /* Do not inherit across fork. */ # define MADV_DOFORK 11 /* Do inherit across fork. */ # define MADV_MERGEABLE 12 /* KSM may merge identical pages. */ # define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */ # define MADV_HUGEPAGE 14 /* Worth backing with hugepages. */ # define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages. */ # define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, overrides the coredump filter bits. */ # define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag. */ # define MADV_HWPOISON 100 /* Poison a page for testing. */ #endif /* The POSIX people had to invent similar names for the same things. */ #ifdef __USE_XOPEN2K # define POSIX_MADV_NORMAL 0 /* No further special treatment. */ # define POSIX_MADV_RANDOM 1 /* Expect random page references. */ # define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ # define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ # define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/utsname.h��������������������������������������������������������������������������������������0000644�����������������00000002303�14763166030�0007336 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_UTSNAME_H # error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead." #endif /* Length of the entries in `struct utsname' is 65. */ #define _UTSNAME_LENGTH 65 /* Linux provides as additional information in the `struct utsname' the name of the current domain. Define _UTSNAME_DOMAIN_LENGTH to a value != 0 to activate this entry. */ #define _UTSNAME_DOMAIN_LENGTH _UTSNAME_LENGTH �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/typesizes.h������������������������������������������������������������������������������������0000644�����������������00000006231�14763166030�0007725 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* bits/typesizes.h -- underlying types for *_t. Linux/x86-64 version. Copyright (C) 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_TYPES_H # error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead." #endif #ifndef _BITS_TYPESIZES_H #define _BITS_TYPESIZES_H 1 /* See <bits/types.h> for the meaning of these macros. This file exists so that <bits/types.h> need not vary across different GNU platforms. */ /* X32 kernel interface is 64-bit. */ #if defined __x86_64__ && defined __ILP32__ # define __SYSCALL_SLONG_TYPE __SQUAD_TYPE # define __SYSCALL_ULONG_TYPE __UQUAD_TYPE #else # define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE # define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE #endif #define __DEV_T_TYPE __UQUAD_TYPE #define __UID_T_TYPE __U32_TYPE #define __GID_T_TYPE __U32_TYPE #define __INO_T_TYPE __SYSCALL_ULONG_TYPE #define __INO64_T_TYPE __UQUAD_TYPE #define __MODE_T_TYPE __U32_TYPE #ifdef __x86_64__ # define __NLINK_T_TYPE __SYSCALL_ULONG_TYPE # define __FSWORD_T_TYPE __SYSCALL_SLONG_TYPE #else # define __NLINK_T_TYPE __UWORD_TYPE # define __FSWORD_T_TYPE __SWORD_TYPE #endif #define __OFF_T_TYPE __SYSCALL_SLONG_TYPE #define __OFF64_T_TYPE __SQUAD_TYPE #define __PID_T_TYPE __S32_TYPE #define __RLIM_T_TYPE __SYSCALL_ULONG_TYPE #define __RLIM64_T_TYPE __UQUAD_TYPE #define __BLKCNT_T_TYPE __SYSCALL_SLONG_TYPE #define __BLKCNT64_T_TYPE __SQUAD_TYPE #define __FSBLKCNT_T_TYPE __SYSCALL_ULONG_TYPE #define __FSBLKCNT64_T_TYPE __UQUAD_TYPE #define __FSFILCNT_T_TYPE __SYSCALL_ULONG_TYPE #define __FSFILCNT64_T_TYPE __UQUAD_TYPE #define __ID_T_TYPE __U32_TYPE #define __CLOCK_T_TYPE __SYSCALL_SLONG_TYPE #define __TIME_T_TYPE __SYSCALL_SLONG_TYPE #define __USECONDS_T_TYPE __U32_TYPE #define __SUSECONDS_T_TYPE __SYSCALL_SLONG_TYPE #define __DADDR_T_TYPE __S32_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE #define __TIMER_T_TYPE void * #define __BLKSIZE_T_TYPE __SYSCALL_SLONG_TYPE #define __FSID_T_TYPE struct { int __val[2]; } #define __SSIZE_T_TYPE __SWORD_TYPE #ifdef __x86_64__ /* Tell the libc code that off_t and off64_t are actually the same type for all ABI purposes, even if possibly expressed as different base types for C type-checking purposes. */ # define __OFF_T_MATCHES_OFF64_T 1 /* Same for ino_t and ino64_t. */ # define __INO_T_MATCHES_INO64_T 1 #endif /* Number of descriptors that can fit in an `fd_set'. */ #define __FD_SETSIZE 1024 #endif /* bits/typesizes.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/epoll.h����������������������������������������������������������������������������������������0000644�����������������00000002163�14763166030�0007001 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2002-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_EPOLL_H # error "Never use <bits/epoll.h> directly; include <sys/epoll.h> instead." #endif /* Flags to be passed to epoll_create1. */ enum { EPOLL_CLOEXEC = 02000000, #define EPOLL_CLOEXEC EPOLL_CLOEXEC EPOLL_NONBLOCK = 00004000 #define EPOLL_NONBLOCK EPOLL_NONBLOCK }; #define __EPOLL_PACKED __attribute__ ((__packed__)) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/poll2.h����������������������������������������������������������������������������������������0000644�����������������00000005563�14763166030�0006725 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Checking macros for poll functions. Copyright (C) 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_POLL_H # error "Never include <bits/poll2.h> directly; use <sys/poll.h> instead." #endif __BEGIN_DECLS extern int __REDIRECT (__poll_alias, (struct pollfd *__fds, nfds_t __nfds, int __timeout), poll); extern int __poll_chk (struct pollfd *__fds, nfds_t __nfds, int __timeout, __SIZE_TYPE__ __fdslen); extern int __REDIRECT (__poll_chk_warn, (struct pollfd *__fds, nfds_t __nfds, int __timeout, __SIZE_TYPE__ __fdslen), __poll_chk) __warnattr ("poll called with fds buffer too small file nfds entries"); __fortify_function int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout) { if (__bos (__fds) != (__SIZE_TYPE__) -1) { if (! __builtin_constant_p (__nfds)) return __poll_chk (__fds, __nfds, __timeout, __bos (__fds)); else if (__bos (__fds) / sizeof (*__fds) < __nfds) return __poll_chk_warn (__fds, __nfds, __timeout, __bos (__fds)); } return __poll_alias (__fds, __nfds, __timeout); } #ifdef __USE_GNU extern int __REDIRECT (__ppoll_alias, (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, const __sigset_t *__ss), ppoll); extern int __ppoll_chk (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, const __sigset_t *__ss, __SIZE_TYPE__ __fdslen); extern int __REDIRECT (__ppoll_chk_warn, (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, const __sigset_t *__ss, __SIZE_TYPE__ __fdslen), __ppoll_chk) __warnattr ("ppoll called with fds buffer too small file nfds entries"); __fortify_function int ppoll (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, const __sigset_t *__ss) { if (__bos (__fds) != (__SIZE_TYPE__) -1) { if (! __builtin_constant_p (__nfds)) return __ppoll_chk (__fds, __nfds, __timeout, __ss, __bos (__fds)); else if (__bos (__fds) / sizeof (*__fds) < __nfds) return __ppoll_chk_warn (__fds, __nfds, __timeout, __ss, __bos (__fds)); } return __ppoll_alias (__fds, __nfds, __timeout, __ss); } #endif __END_DECLS ���������������������������������������������������������������������������������������������������������������������������������������������bits/huge_val.h�������������������������������������������������������������������������������������0000644�����������������00000003522�14763166030�0007460 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* `HUGE_VAL' constant for IEEE 754 machines (where it is infinity). Used by <stdlib.h> and <math.h> functions for overflow. Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never use <bits/huge_val.h> directly; include <math.h> instead." #endif /* IEEE positive infinity (-HUGE_VAL is negative infinity). */ #if __GNUC_PREREQ(3,3) # define HUGE_VAL (__builtin_huge_val()) #elif __GNUC_PREREQ(2,96) # define HUGE_VAL (__extension__ 0x1.0p2047) #elif defined __GNUC__ # define HUGE_VAL \ (__extension__ \ ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \ { __l: 0x7ff0000000000000ULL }).__d) #else /* not GCC */ # include <endian.h> typedef union { unsigned char __c[8]; double __d; } __huge_val_t; # if __BYTE_ORDER == __BIG_ENDIAN # define __HUGE_VAL_bytes { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } # endif # if __BYTE_ORDER == __LITTLE_ENDIAN # define __HUGE_VAL_bytes { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } # endif static __huge_val_t __huge_val = { __HUGE_VAL_bytes }; # define HUGE_VAL (__huge_val.__d) #endif /* GCC. */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/waitflags.h������������������������������������������������������������������������������������0000644�����������������00000003160�14763166030�0007645 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Definitions of flag bits for `waitpid' et al. Copyright (C) 1992,1996,1997,2000,2004,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #if !defined _SYS_WAIT_H && !defined _STDLIB_H # error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead." #endif /* Bits in the third argument to `waitpid'. */ #define WNOHANG 1 /* Don't block waiting. */ #define WUNTRACED 2 /* Report status of stopped children. */ /* Bits in the fourth argument to `waitid'. */ #define WSTOPPED 2 /* Report stopped child (same as WUNTRACED). */ #define WEXITED 4 /* Report dead child. */ #define WCONTINUED 8 /* Report continued child. */ #define WNOWAIT 0x01000000 /* Don't reap, just poll status. */ #define __WNOTHREAD 0x20000000 /* Don't wait on children of other threads in this group */ #define __WALL 0x40000000 /* Wait for any child. */ #define __WCLONE 0x80000000 /* Wait for cloned process. */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/utmpx.h����������������������������������������������������������������������������������������0000644�����������������00000006604�14763166030�0007047 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Structures and definitions for the user accounting database. GNU version. Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _UTMPX_H # error "Never include <bits/utmpx.h> directly; use <utmpx.h> instead." #endif #include <bits/types.h> #include <sys/time.h> #include <bits/wordsize.h> #ifdef __USE_GNU # include <paths.h> # define _PATH_UTMPX _PATH_UTMP # define _PATH_WTMPX _PATH_WTMP #endif #define __UT_LINESIZE 32 #define __UT_NAMESIZE 32 #define __UT_HOSTSIZE 256 /* The structure describing the status of a terminated process. This type is used in `struct utmpx' below. */ struct __exit_status { #ifdef __USE_GNU short int e_termination; /* Process termination status. */ short int e_exit; /* Process exit status. */ #else short int __e_termination; /* Process termination status. */ short int __e_exit; /* Process exit status. */ #endif }; /* The structure describing an entry in the user accounting database. */ struct utmpx { short int ut_type; /* Type of login. */ __pid_t ut_pid; /* Process ID of login process. */ char ut_line[__UT_LINESIZE]; /* Devicename. */ char ut_id[4]; /* Inittab ID. */ char ut_user[__UT_NAMESIZE]; /* Username. */ char ut_host[__UT_HOSTSIZE]; /* Hostname for remote login. */ struct __exit_status ut_exit; /* Exit status of a process marked as DEAD_PROCESS. */ /* The fields ut_session and ut_tv must be the same size when compiled 32- and 64-bit. This allows files and shared memory to be shared between 32- and 64-bit applications. */ #ifdef __WORDSIZE_TIME64_COMPAT32 __int32_t ut_session; /* Session ID, used for windowing. */ struct { __int32_t tv_sec; /* Seconds. */ __int32_t tv_usec; /* Microseconds. */ } ut_tv; /* Time entry was made. */ #else long int ut_session; /* Session ID, used for windowing. */ struct timeval ut_tv; /* Time entry was made. */ #endif __int32_t ut_addr_v6[4]; /* Internet address of remote host. */ char __unused[20]; /* Reserved for future use. */ }; /* Values for the `ut_type' field of a `struct utmpx'. */ #define EMPTY 0 /* No valid user accounting information. */ #ifdef __USE_GNU # define RUN_LVL 1 /* The system's runlevel. */ #endif #define BOOT_TIME 2 /* Time of system boot. */ #define NEW_TIME 3 /* Time after system clock changed. */ #define OLD_TIME 4 /* Time when system clock changed. */ #define INIT_PROCESS 5 /* Process spawned by the init process. */ #define LOGIN_PROCESS 6 /* Session leader of a logged in user. */ #define USER_PROCESS 7 /* Normal process. */ #define DEAD_PROCESS 8 /* Terminated process. */ #ifdef __USE_GNU # define ACCOUNTING 9 /* System accounting. */ #endif ����������������������������������������������������������������������������������������������������������������������������bits/syslog-ldbl.h����������������������������������������������������������������������������������0000644�����������������00000002263�14763166030�0010122 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -mlong-double-64 compatibility mode for syslog functions. Copyright (C) 2006-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SYSLOG_H # error "Never include <bits/syslog-ldbl.h> directly; use <sys/syslog.h> instead." #endif __LDBL_REDIR_DECL (syslog) #ifdef __USE_BSD __LDBL_REDIR_DECL (vsyslog) #endif #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function __LDBL_REDIR_DECL (__syslog_chk) # ifdef __USE_BSD __LDBL_REDIR_DECL (__vsyslog_chk) # endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/wchar.h����������������������������������������������������������������������������������������0000644�����������������00000002155�14763166030�0006773 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* wchar_t type related definitions. i386/x86-64 version. Copyright (C) 2000-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_WCHAR_H #define _BITS_WCHAR_H 1 #include <bits/wordsize.h> #if __WORDSIZE == 64 # define __WCHAR_MIN (-2147483647 - 1) # define __WCHAR_MAX (2147483647) #else # define __WCHAR_MIN (-2147483647l - 1l) # define __WCHAR_MAX (2147483647l) #endif #endif /* bits/wchar.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/math-finite.h����������������������������������������������������������������������������������0000644�����������������00000034366�14763166030�0010105 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Entry points to finite-math-only compiler runs. Copyright (C) 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never use <bits/math-finite.h> directly; include <math.h> instead." #endif /* acos. */ extern double __REDIRECT_NTH (acos, (double), __acos_finite); extern float __REDIRECT_NTH (acosf, (float), __acosf_finite); #ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (acosl, (long double), __acos_finite); # else extern long double __REDIRECT_NTH (acosl, (long double), __acosl_finite); # endif #endif #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 /* acosh. */ extern double __REDIRECT_NTH (acosh, (double), __acosh_finite); extern float __REDIRECT_NTH (acoshf, (float), __acoshf_finite); # ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (acoshl, (long double), __acosh_finite); # else extern long double __REDIRECT_NTH (acoshl, (long double), __acoshl_finite); # endif # endif #endif /* asin. */ extern double __REDIRECT_NTH (asin, (double), __asin_finite); extern float __REDIRECT_NTH (asinf, (float), __asinf_finite); #ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (asinl, (long double), __asin_finite); # else extern long double __REDIRECT_NTH (asinl, (long double), __asinl_finite); # endif #endif /* atan2. */ extern double __REDIRECT_NTH (atan2, (double, double), __atan2_finite); extern float __REDIRECT_NTH (atan2f, (float, float), __atan2f_finite); #ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (atan2l, (long double, long double), __atan2_finite); # else extern long double __REDIRECT_NTH (atan2l, (long double, long double), __atan2l_finite); # endif #endif #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 /* atanh. */ extern double __REDIRECT_NTH (atanh, (double), __atanh_finite); extern float __REDIRECT_NTH (atanhf, (float), __atanhf_finite); # ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (atanhl, (long double), __atanh_finite); # else extern long double __REDIRECT_NTH (atanhl, (long double), __atanhl_finite); # endif # endif #endif /* cosh. */ extern double __REDIRECT_NTH (cosh, (double), __cosh_finite); extern float __REDIRECT_NTH (coshf, (float), __coshf_finite); #ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (coshl, (long double), __cosh_finite); # else extern long double __REDIRECT_NTH (coshl, (long double), __coshl_finite); # endif #endif /* exp. */ extern double __REDIRECT_NTH (exp, (double), __exp_finite); extern float __REDIRECT_NTH (expf, (float), __expf_finite); #ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (expl, (long double), __exp_finite); # else extern long double __REDIRECT_NTH (expl, (long double), __expl_finite); # endif #endif #ifdef __USE_GNU /* exp10. */ extern double __REDIRECT_NTH (exp10, (double), __exp10_finite); extern float __REDIRECT_NTH (exp10f, (float), __exp10f_finite); # ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (exp10l, (long double), __exp10_finite); # else extern long double __REDIRECT_NTH (exp10l, (long double), __exp10l_finite); # endif # endif /* pow10. */ extern double __REDIRECT_NTH (pow10, (double), __exp10_finite); extern float __REDIRECT_NTH (pow10f, (float), __exp10f_finite); # ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (pow10l, (long double), __exp10_finite); # else extern long double __REDIRECT_NTH (pow10l, (long double), __exp10l_finite); # endif # endif #endif #ifdef __USE_ISOC99 /* exp2. */ extern double __REDIRECT_NTH (exp2, (double), __exp2_finite); extern float __REDIRECT_NTH (exp2f, (float), __exp2f_finite); # ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (exp2l, (long double), __exp2_finite); # else extern long double __REDIRECT_NTH (exp2l, (long double), __exp2l_finite); # endif # endif #endif /* fmod. */ extern double __REDIRECT_NTH (fmod, (double, double), __fmod_finite); extern float __REDIRECT_NTH (fmodf, (float, float), __fmodf_finite); #ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (fmodl, (long double, long double), __fmod_finite); # else extern long double __REDIRECT_NTH (fmodl, (long double, long double), __fmodl_finite); # endif #endif #ifdef __USE_ISOC99 /* hypot. */ extern double __REDIRECT_NTH (hypot, (double, double), __hypot_finite); extern float __REDIRECT_NTH (hypotf, (float, float), __hypotf_finite); # ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (hypotl, (long double, long double), __hypot_finite); # else extern long double __REDIRECT_NTH (hypotl, (long double, long double), __hypotl_finite); # endif # endif #endif #if defined __USE_MISC || defined __USE_XOPEN /* j0. */ extern double __REDIRECT_NTH (j0, (double), __j0_finite); extern float __REDIRECT_NTH (j0f, (float), __j0f_finite); # ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (j0l, (long double), __j0_finite); # else extern long double __REDIRECT_NTH (j0l, (long double), __j0l_finite); # endif # endif /* y0. */ extern double __REDIRECT_NTH (y0, (double), __y0_finite); extern float __REDIRECT_NTH (y0f, (float), __y0f_finite); # ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (y0l, (long double), __y0_finite); # else extern long double __REDIRECT_NTH (y0l, (long double), __y0l_finite); # endif # endif /* j1. */ extern double __REDIRECT_NTH (j1, (double), __j1_finite); extern float __REDIRECT_NTH (j1f, (float), __j1f_finite); # ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (j1l, (long double), __j1_finite); # else extern long double __REDIRECT_NTH (j1l, (long double), __j1l_finite); # endif # endif /* y1. */ extern double __REDIRECT_NTH (y1, (double), __y1_finite); extern float __REDIRECT_NTH (y1f, (float), __y1f_finite); # ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (y1l, (long double), __y1_finite); # else extern long double __REDIRECT_NTH (y1l, (long double), __y1l_finite); # endif # endif /* jn. */ extern double __REDIRECT_NTH (jn, (int, double), __jn_finite); extern float __REDIRECT_NTH (jnf, (int, float), __jnf_finite); # ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (jnl, (int, long double), __jn_finite); # else extern long double __REDIRECT_NTH (jnl, (int, long double), __jnl_finite); # endif # endif /* yn. */ extern double __REDIRECT_NTH (yn, (int, double), __yn_finite); extern float __REDIRECT_NTH (ynf, (int, float), __ynf_finite); # ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (ynl, (int, long double), __yn_finite); # else extern long double __REDIRECT_NTH (ynl, (int, long double), __ynl_finite); # endif # endif #endif #ifdef __USE_MISC /* lgamma_r. */ extern double __REDIRECT_NTH (lgamma_r, (double, int *), __lgamma_r_finite); extern float __REDIRECT_NTH (lgammaf_r, (float, int *), __lgammaf_r_finite); # ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (lgammal_r, (long double, int *), __lgamma_r_finite); # else extern long double __REDIRECT_NTH (lgammal_r, (long double, int *), __lgammal_r_finite); # endif # endif #endif #if ((defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99) \ && defined __extern_always_inline) /* lgamma. */ __extern_always_inline double __NTH (lgamma (double __d)) { # ifdef __USE_ISOC99 int __local_signgam = 0; return lgamma_r (__d, &__local_signgam); # else return lgamma_r (__d, &signgam); # endif } __extern_always_inline float __NTH (lgammaf (float __d)) { # ifdef __USE_ISOC99 int __local_signgam = 0; return lgammaf_r (__d, &__local_signgam); # else return lgammaf_r (__d, &signgam); # endif } # ifdef __MATH_DECLARE_LDOUBLE __extern_always_inline long double __NTH (lgammal (long double __d)) { # ifdef __USE_ISOC99 int __local_signgam = 0; return lgammal_r (__d, &__local_signgam); # else return lgammal_r (__d, &signgam); # endif } # endif #endif #if ((defined __USE_MISC || defined __USE_XOPEN) \ && defined __extern_always_inline) /* gamma. */ __extern_always_inline double __NTH (gamma (double __d)) { # ifdef __USE_ISOC99 int __local_signgam = 0; return lgamma_r (__d, &__local_signgam); # else return lgamma_r (__d, &signgam); # endif } __extern_always_inline float __NTH (gammaf (float __d)) { # ifdef __USE_ISOC99 int __local_signgam = 0; return lgammaf_r (__d, &__local_signgam); # else return lgammaf_r (__d, &signgam); # endif } # ifdef __MATH_DECLARE_LDOUBLE __extern_always_inline long double __NTH (gammal (long double __d)) { # ifdef __USE_ISOC99 int __local_signgam = 0; return lgammal_r (__d, &__local_signgam); # else return lgammal_r (__d, &signgam); # endif } # endif #endif /* log. */ extern double __REDIRECT_NTH (log, (double), __log_finite); extern float __REDIRECT_NTH (logf, (float), __logf_finite); #ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (logl, (long double), __log_finite); # else extern long double __REDIRECT_NTH (logl, (long double), __logl_finite); # endif #endif /* log10. */ extern double __REDIRECT_NTH (log10, (double), __log10_finite); extern float __REDIRECT_NTH (log10f, (float), __log10f_finite); #ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (log10l, (long double), __log10_finite); # else extern long double __REDIRECT_NTH (log10l, (long double), __log10l_finite); # endif #endif #ifdef __USE_ISOC99 /* log2. */ extern double __REDIRECT_NTH (log2, (double), __log2_finite); extern float __REDIRECT_NTH (log2f, (float), __log2f_finite); # ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (log2l, (long double), __log2_finite); # else extern long double __REDIRECT_NTH (log2l, (long double), __log2l_finite); # endif # endif #endif /* ldexp. */ extern double __REDIRECT_NTH (ldexp, (double, int), scalbn); extern float __REDIRECT_NTH (ldexpf, (float, int), scalbnf); #ifdef __MATH_DECLARE_LDOUBLE extern long double __REDIRECT_NTH (ldexpl, (long double, int), scalbnl); #endif /* pow. */ extern double __REDIRECT_NTH (pow, (double, double), __pow_finite); extern float __REDIRECT_NTH (powf, (float, float), __powf_finite); #ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (powl, (long double, long double), __pow_finite); # else extern long double __REDIRECT_NTH (powl, (long double, long double), __powl_finite); # endif #endif /* remainder. */ extern double __REDIRECT_NTH (remainder, (double, double), __remainder_finite); extern float __REDIRECT_NTH (remainderf, (float, float), __remainderf_finite); #ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (remainderl, (long double, long double), __remainder_finite); # else extern long double __REDIRECT_NTH (remainderl, (long double, long double), __remainderl_finite); # endif #endif #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED /* scalb. */ extern double __REDIRECT_NTH (scalb, (double, double), __scalb_finite); extern float __REDIRECT_NTH (scalbf, (float, float), __scalbf_finite); # ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (scalbl, (long double, long double), __scalb_finite); # else extern long double __REDIRECT_NTH (scalbl, (long double, long double), __scalbl_finite); # endif # endif #endif /* sinh. */ extern double __REDIRECT_NTH (sinh, (double), __sinh_finite); extern float __REDIRECT_NTH (sinhf, (float), __sinhf_finite); #ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (sinhl, (long double), __sinh_finite); # else extern long double __REDIRECT_NTH (sinhl, (long double), __sinhl_finite); # endif #endif /* sqrt. */ extern double __REDIRECT_NTH (sqrt, (double), __sqrt_finite); extern float __REDIRECT_NTH (sqrtf, (float), __sqrtf_finite); #ifdef __MATH_DECLARE_LDOUBLE # ifdef __NO_LONG_DOUBLE_MATH extern long double __REDIRECT_NTH (sqrtl, (long double), __sqrt_finite); # else extern long double __REDIRECT_NTH (sqrtl, (long double), __sqrtl_finite); # endif #endif #if defined __USE_ISOC99 && defined __extern_always_inline /* tgamma. */ extern double __gamma_r_finite (double, int *); __extern_always_inline double __NTH (tgamma (double __d)) { int __local_signgam = 0; double __res = __gamma_r_finite (__d, &__local_signgam); return __local_signgam < 0 ? -__res : __res; } extern float __gammaf_r_finite (float, int *); __extern_always_inline float __NTH (tgammaf (float __d)) { int __local_signgam = 0; float __res = __gammaf_r_finite (__d, &__local_signgam); return __local_signgam < 0 ? -__res : __res; } # ifdef __MATH_DECLARE_LDOUBLE extern long double __gammal_r_finite (long double, int *); __extern_always_inline long double __NTH (tgammal (long double __d)) { int __local_signgam = 0; # ifdef __NO_LONG_DOUBLE_MATH long double __res = __gamma_r_finite (__d, &__local_signgam); # else long double __res = __gammal_r_finite (__d, &__local_signgam); # endif return __local_signgam < 0 ? -__res : __res; } # endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/sem.h������������������������������������������������������������������������������������������0000644�����������������00000005033�14763166030�0006451 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2002-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SEM_H # error "Never include <bits/sem.h> directly; use <sys/sem.h> instead." #endif #include <sys/types.h> /* Flags for `semop'. */ #define SEM_UNDO 0x1000 /* undo the operation on exit */ /* Commands for `semctl'. */ #define GETPID 11 /* get sempid */ #define GETVAL 12 /* get semval */ #define GETALL 13 /* get all semval's */ #define GETNCNT 14 /* get semncnt */ #define GETZCNT 15 /* get semzcnt */ #define SETVAL 16 /* set semval */ #define SETALL 17 /* set all semval's */ /* Data structure describing a set of semaphores. */ struct semid_ds { struct ipc_perm sem_perm; /* operation permission struct */ __time_t sem_otime; /* last semop() time */ __syscall_ulong_t __unused1; __time_t sem_ctime; /* last time changed by semctl() */ __syscall_ulong_t __unused2; __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __unused3; __syscall_ulong_t __unused4; }; /* The user should define a union like the following to use it for arguments for `semctl'. union semun { int val; <= value for SETVAL struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET unsigned short int *array; <= array for GETALL & SETALL struct seminfo *__buf; <= buffer for IPC_INFO }; Previous versions of this file used to define this union but this is incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether one must define the union or not. */ #define _SEM_SEMUN_UNDEFINED 1 #ifdef __USE_MISC /* ipcs ctl cmds */ # define SEM_STAT 18 # define SEM_INFO 19 # define SEM_STAT_ANY 20 struct seminfo { int semmap; int semmni; int semmns; int semmnu; int semmsl; int semopm; int semume; int semusz; int semvmx; int semaem; }; #endif /* __USE_MISC */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/string.h���������������������������������������������������������������������������������������0000644�����������������00000160753�14763166030�0007206 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Optimized, inlined string functions. i486/x86-64 version. Copyright (C) 2001-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _STRING_H # error "Never use <bits/string.h> directly; include <string.h> instead." #endif /* The ix86 processors can access unaligned multi-byte variables. */ #define _STRING_ARCH_unaligned 1 /* Enable inline functions only for i486 or better when compiling for ia32. */ #if !defined __x86_64__ && (defined __i486__ || defined __pentium__ \ || defined __pentiumpro__ || defined __pentium4__ \ || defined __nocona__ || defined __atom__ \ || defined __core2__ || defined __corei7__ \ || defined __k6__ || defined __geode__ \ || defined __k8__ || defined __athlon__ \ || defined __amdfam10__) /* We only provide optimizations if the user selects them and if GNU CC is used. */ # if !defined __NO_STRING_INLINES && defined __USE_STRING_INLINES \ && defined __GNUC__ && __GNUC__ >= 2 # ifndef __STRING_INLINE # ifndef __extern_inline # define __STRING_INLINE inline # else # define __STRING_INLINE __extern_inline # endif # endif /* The macros are used in some of the optimized implementations below. */ # define __STRING_SMALL_GET16(src, idx) \ ((((const unsigned char *) (src))[idx + 1] << 8) \ | ((const unsigned char *) (src))[idx]) # define __STRING_SMALL_GET32(src, idx) \ (((((const unsigned char *) (src))[idx + 3] << 8 \ | ((const unsigned char *) (src))[idx + 2]) << 8 \ | ((const unsigned char *) (src))[idx + 1]) << 8 \ | ((const unsigned char *) (src))[idx]) /* Copy N bytes of SRC to DEST. */ # define _HAVE_STRING_ARCH_memcpy 1 # define memcpy(dest, src, n) \ (__extension__ (__builtin_constant_p (n) \ ? __memcpy_c ((dest), (src), (n)) \ : __memcpy_g ((dest), (src), (n)))) # define __memcpy_c(dest, src, n) \ ((n) == 0 \ ? (dest) \ : (((n) % 4 == 0) \ ? __memcpy_by4 (dest, src, n) \ : (((n) % 2 == 0) \ ? __memcpy_by2 (dest, src, n) \ : __memcpy_g (dest, src, n)))) __STRING_INLINE void *__memcpy_by4 (void *__dest, const void *__src, size_t __n); __STRING_INLINE void * __memcpy_by4 (void *__dest, const void *__src, size_t __n) { register unsigned long int __d0, __d1; register void *__tmp = __dest; __asm__ __volatile__ ("1:\n\t" "movl (%2),%0\n\t" "leal 4(%2),%2\n\t" "movl %0,(%1)\n\t" "leal 4(%1),%1\n\t" "decl %3\n\t" "jnz 1b" : "=&r" (__d0), "=&r" (__tmp), "=&r" (__src), "=&r" (__d1) : "1" (__tmp), "2" (__src), "3" (__n / 4) : "memory", "cc"); return __dest; } __STRING_INLINE void *__memcpy_by2 (void *__dest, const void *__src, size_t __n); __STRING_INLINE void * __memcpy_by2 (void *__dest, const void *__src, size_t __n) { register unsigned long int __d0, __d1; register void *__tmp = __dest; __asm__ __volatile__ ("shrl $1,%3\n\t" "jz 2f\n" /* only a word */ "1:\n\t" "movl (%2),%0\n\t" "leal 4(%2),%2\n\t" "movl %0,(%1)\n\t" "leal 4(%1),%1\n\t" "decl %3\n\t" "jnz 1b\n" "2:\n\t" "movw (%2),%w0\n\t" "movw %w0,(%1)" : "=&q" (__d0), "=&r" (__tmp), "=&r" (__src), "=&r" (__d1) : "1" (__tmp), "2" (__src), "3" (__n / 2) : "memory", "cc"); return __dest; } __STRING_INLINE void *__memcpy_g (void *__dest, const void *__src, size_t __n); __STRING_INLINE void * __memcpy_g (void *__dest, const void *__src, size_t __n) { register unsigned long int __d0, __d1, __d2; register void *__tmp = __dest; __asm__ __volatile__ ("cld\n\t" "shrl $1,%%ecx\n\t" "jnc 1f\n\t" "movsb\n" "1:\n\t" "shrl $1,%%ecx\n\t" "jnc 2f\n\t" "movsw\n" "2:\n\t" "rep; movsl" : "=&c" (__d0), "=&D" (__d1), "=&S" (__d2), "=m" ( *(struct { __extension__ char __x[__n]; } *)__dest) : "0" (__n), "1" (__tmp), "2" (__src), "m" ( *(struct { __extension__ char __x[__n]; } *)__src) : "cc"); return __dest; } # define _HAVE_STRING_ARCH_memmove 1 # ifndef _FORCE_INLINES /* Copy N bytes of SRC to DEST, guaranteeing correct behavior for overlapping strings. */ # define memmove(dest, src, n) __memmove_g (dest, src, n) __STRING_INLINE void *__memmove_g (void *, const void *, size_t) __asm__ ("memmove"); __STRING_INLINE void * __memmove_g (void *__dest, const void *__src, size_t __n) { register unsigned long int __d0, __d1, __d2; register void *__tmp = __dest; if (__dest < __src) __asm__ __volatile__ ("cld\n\t" "rep; movsb" : "=&c" (__d0), "=&S" (__d1), "=&D" (__d2), "=m" ( *(struct { __extension__ char __x[__n]; } *)__dest) : "0" (__n), "1" (__src), "2" (__tmp), "m" ( *(struct { __extension__ char __x[__n]; } *)__src)); else __asm__ __volatile__ ("std\n\t" "rep; movsb\n\t" "cld" : "=&c" (__d0), "=&S" (__d1), "=&D" (__d2), "=m" ( *(struct { __extension__ char __x[__n]; } *)__dest) : "0" (__n), "1" (__n - 1 + (const char *) __src), "2" (__n - 1 + (char *) __tmp), "m" ( *(struct { __extension__ char __x[__n]; } *)__src)); return __dest; } # endif /* Compare N bytes of S1 and S2. */ # define _HAVE_STRING_ARCH_memcmp 1 # ifndef _FORCE_INLINES # ifndef __PIC__ /* gcc has problems to spill registers when using PIC. */ __STRING_INLINE int memcmp (const void *__s1, const void *__s2, size_t __n) { register unsigned long int __d0, __d1, __d2; register int __res; __asm__ __volatile__ ("cld\n\t" "testl %3,%3\n\t" "repe; cmpsb\n\t" "je 1f\n\t" "sbbl %0,%0\n\t" "orl $1,%0\n" "1:" : "=&a" (__res), "=&S" (__d0), "=&D" (__d1), "=&c" (__d2) : "0" (0), "1" (__s1), "2" (__s2), "3" (__n), "m" ( *(struct { __extension__ char __x[__n]; } *)__s1), "m" ( *(struct { __extension__ char __x[__n]; } *)__s2) : "cc"); return __res; } # endif # endif /* Set N bytes of S to C. */ # define _HAVE_STRING_ARCH_memset 1 # define _USE_STRING_ARCH_memset 1 # define memset(s, c, n) \ (__extension__ (__builtin_constant_p (n) && (n) <= 16 \ ? ((n) == 1 \ ? __memset_c1 ((s), (c)) \ : __memset_gc ((s), (c), (n))) \ : (__builtin_constant_p (c) \ ? (__builtin_constant_p (n) \ ? __memset_ccn ((s), (c), (n)) \ : memset ((s), (c), (n))) \ : (__builtin_constant_p (n) \ ? __memset_gcn ((s), (c), (n)) \ : memset ((s), (c), (n)))))) # define __memset_c1(s, c) ({ void *__s = (s); \ *((unsigned char *) __s) = (unsigned char) (c); \ __s; }) # define __memset_gc(s, c, n) \ ({ void *__s = (s); \ union { \ unsigned int __ui; \ unsigned short int __usi; \ unsigned char __uc; \ } *__u = __s; \ unsigned int __c = ((unsigned int) ((unsigned char) (c))) * 0x01010101; \ \ /* We apply a trick here. `gcc' would implement the following \ assignments using immediate operands. But this uses to much \ memory (7, instead of 4 bytes). So we force the value in a \ registers. */ \ if ((n) == 3 || (n) >= 5) \ __asm__ __volatile__ ("" : "=r" (__c) : "0" (__c)); \ \ /* This `switch' statement will be removed at compile-time. */ \ switch (n) \ { \ case 15: \ __u->__ui = __c; \ __u = __extension__ ((void *) __u + 4); \ case 11: \ __u->__ui = __c; \ __u = __extension__ ((void *) __u + 4); \ case 7: \ __u->__ui = __c; \ __u = __extension__ ((void *) __u + 4); \ case 3: \ __u->__usi = (unsigned short int) __c; \ __u = __extension__ ((void *) __u + 2); \ __u->__uc = (unsigned char) __c; \ break; \ \ case 14: \ __u->__ui = __c; \ __u = __extension__ ((void *) __u + 4); \ case 10: \ __u->__ui = __c; \ __u = __extension__ ((void *) __u + 4); \ case 6: \ __u->__ui = __c; \ __u = __extension__ ((void *) __u + 4); \ case 2: \ __u->__usi = (unsigned short int) __c; \ break; \ \ case 13: \ __u->__ui = __c; \ __u = __extension__ ((void *) __u + 4); \ case 9: \ __u->__ui = __c; \ __u = __extension__ ((void *) __u + 4); \ case 5: \ __u->__ui = __c; \ __u = __extension__ ((void *) __u + 4); \ case 1: \ __u->__uc = (unsigned char) __c; \ break; \ \ case 16: \ __u->__ui = __c; \ __u = __extension__ ((void *) __u + 4); \ case 12: \ __u->__ui = __c; \ __u = __extension__ ((void *) __u + 4); \ case 8: \ __u->__ui = __c; \ __u = __extension__ ((void *) __u + 4); \ case 4: \ __u->__ui = __c; \ case 0: \ break; \ } \ \ __s; }) # define __memset_ccn(s, c, n) \ (((n) % 4 == 0) \ ? __memset_ccn_by4 (s, ((unsigned int) ((unsigned char) (c))) * 0x01010101,\ n) \ : (((n) % 2 == 0) \ ? __memset_ccn_by2 (s, \ ((unsigned int) ((unsigned char) (c))) * 0x01010101,\ n) \ : memset (s, c, n))) __STRING_INLINE void *__memset_ccn_by4 (void *__s, unsigned int __c, size_t __n); __STRING_INLINE void * __memset_ccn_by4 (void *__s, unsigned int __c, size_t __n) { register void *__tmp = __s; register unsigned long int __d0; # ifdef __i686__ __asm__ __volatile__ ("cld\n\t" "rep; stosl" : "=&a" (__c), "=&D" (__tmp), "=&c" (__d0), "=m" ( *(struct { __extension__ char __x[__n]; } *)__s) : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 4) : "cc"); # else __asm__ __volatile__ ("1:\n\t" "movl %0,(%1)\n\t" "addl $4,%1\n\t" "decl %2\n\t" "jnz 1b\n" : "=&r" (__c), "=&r" (__tmp), "=&r" (__d0), "=m" ( *(struct { __extension__ char __x[__n]; } *)__s) : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 4) : "cc"); # endif return __s; } __STRING_INLINE void *__memset_ccn_by2 (void *__s, unsigned int __c, size_t __n); __STRING_INLINE void * __memset_ccn_by2 (void *__s, unsigned int __c, size_t __n) { register unsigned long int __d0, __d1; register void *__tmp = __s; # ifdef __i686__ __asm__ __volatile__ ("cld\n\t" "rep; stosl\n" "stosw" : "=&a" (__d0), "=&D" (__tmp), "=&c" (__d1), "=m" ( *(struct { __extension__ char __x[__n]; } *)__s) : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 4) : "cc"); # else __asm__ __volatile__ ("1:\tmovl %0,(%1)\n\t" "leal 4(%1),%1\n\t" "decl %2\n\t" "jnz 1b\n" "movw %w0,(%1)" : "=&q" (__d0), "=&r" (__tmp), "=&r" (__d1), "=m" ( *(struct { __extension__ char __x[__n]; } *)__s) : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 4) : "cc"); #endif return __s; } # define __memset_gcn(s, c, n) \ (((n) % 4 == 0) \ ? __memset_gcn_by4 (s, c, n) \ : (((n) % 2 == 0) \ ? __memset_gcn_by2 (s, c, n) \ : memset (s, c, n))) __STRING_INLINE void *__memset_gcn_by4 (void *__s, int __c, size_t __n); __STRING_INLINE void * __memset_gcn_by4 (void *__s, int __c, size_t __n) { register void *__tmp = __s; register unsigned long int __d0; __asm__ __volatile__ ("movb %b0,%h0\n" "pushw %w0\n\t" "shll $16,%0\n\t" "popw %w0\n" "1:\n\t" "movl %0,(%1)\n\t" "addl $4,%1\n\t" "decl %2\n\t" "jnz 1b\n" : "=&q" (__c), "=&r" (__tmp), "=&r" (__d0), "=m" ( *(struct { __extension__ char __x[__n]; } *)__s) : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 4) : "cc"); return __s; } __STRING_INLINE void *__memset_gcn_by2 (void *__s, int __c, size_t __n); __STRING_INLINE void * __memset_gcn_by2 (void *__s, int __c, size_t __n) { register unsigned long int __d0, __d1; register void *__tmp = __s; __asm__ __volatile__ ("movb %b0,%h0\n\t" "pushw %w0\n\t" "shll $16,%0\n\t" "popw %w0\n" "1:\n\t" "movl %0,(%1)\n\t" "leal 4(%1),%1\n\t" "decl %2\n\t" "jnz 1b\n" "movw %w0,(%1)" : "=&q" (__d0), "=&r" (__tmp), "=&r" (__d1), "=m" ( *(struct { __extension__ char __x[__n]; } *)__s) : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 4) : "cc"); return __s; } /* Search N bytes of S for C. */ # define _HAVE_STRING_ARCH_memchr 1 # ifndef _FORCE_INLINES __STRING_INLINE void * memchr (const void *__s, int __c, size_t __n) { register unsigned long int __d0; # ifdef __i686__ register unsigned long int __d1; # endif register unsigned char *__res; if (__n == 0) return NULL; # ifdef __i686__ __asm__ __volatile__ ("cld\n\t" "repne; scasb\n\t" "cmovne %2,%0" : "=D" (__res), "=&c" (__d0), "=&r" (__d1) : "a" (__c), "0" (__s), "1" (__n), "2" (1), "m" ( *(struct { __extension__ char __x[__n]; } *)__s) : "cc"); # else __asm__ __volatile__ ("cld\n\t" "repne; scasb\n\t" "je 1f\n\t" "movl $1,%0\n" "1:" : "=D" (__res), "=&c" (__d0) : "a" (__c), "0" (__s), "1" (__n), "m" ( *(struct { __extension__ char __x[__n]; } *)__s) : "cc"); # endif return __res - 1; } # endif # define _HAVE_STRING_ARCH_memrchr 1 # ifndef _FORCE_INLINES __STRING_INLINE void *__memrchr (const void *__s, int __c, size_t __n); __STRING_INLINE void * __memrchr (const void *__s, int __c, size_t __n) { register unsigned long int __d0; # ifdef __i686__ register unsigned long int __d1; # endif register void *__res; if (__n == 0) return NULL; # ifdef __i686__ __asm__ __volatile__ ("std\n\t" "repne; scasb\n\t" "cmovne %2,%0\n\t" "cld\n\t" "incl %0" : "=D" (__res), "=&c" (__d0), "=&r" (__d1) : "a" (__c), "0" (__s + __n - 1), "1" (__n), "2" (-1), "m" ( *(struct { __extension__ char __x[__n]; } *)__s) : "cc"); # else __asm__ __volatile__ ("std\n\t" "repne; scasb\n\t" "je 1f\n\t" "orl $-1,%0\n" "1:\tcld\n\t" "incl %0" : "=D" (__res), "=&c" (__d0) : "a" (__c), "0" (__s + __n - 1), "1" (__n), "m" ( *(struct { __extension__ char __x[__n]; } *)__s) : "cc"); # endif return __res; } # ifdef __USE_GNU # define memrchr(s, c, n) __memrchr ((s), (c), (n)) # endif # endif /* Return pointer to C in S. */ # define _HAVE_STRING_ARCH_rawmemchr 1 __STRING_INLINE void *__rawmemchr (const void *__s, int __c); # ifndef _FORCE_INLINES __STRING_INLINE void * __rawmemchr (const void *__s, int __c) { register unsigned long int __d0; register unsigned char *__res; __asm__ __volatile__ ("cld\n\t" "repne; scasb\n\t" : "=D" (__res), "=&c" (__d0) : "a" (__c), "0" (__s), "1" (0xffffffff), "m" ( *(struct { char __x[0xfffffff]; } *)__s) : "cc"); return __res - 1; } # ifdef __USE_GNU __STRING_INLINE void * rawmemchr (const void *__s, int __c) { return __rawmemchr (__s, __c); } # endif /* use GNU */ # endif /* Return the length of S. */ # define _HAVE_STRING_ARCH_strlen 1 # define strlen(str) \ (__extension__ (__builtin_constant_p (str) \ ? __builtin_strlen (str) \ : __strlen_g (str))) __STRING_INLINE size_t __strlen_g (const char *__str); __STRING_INLINE size_t __strlen_g (const char *__str) { register char __dummy; register const char *__tmp = __str; __asm__ __volatile__ ("1:\n\t" "movb (%0),%b1\n\t" "leal 1(%0),%0\n\t" "testb %b1,%b1\n\t" "jne 1b" : "=r" (__tmp), "=&q" (__dummy) : "0" (__str), "m" ( *(struct { char __x[0xfffffff]; } *)__str) : "cc" ); return __tmp - __str - 1; } /* Copy SRC to DEST. */ # define _HAVE_STRING_ARCH_strcpy 1 # define strcpy(dest, src) \ (__extension__ (__builtin_constant_p (src) \ ? (sizeof ((src)[0]) == 1 && strlen (src) + 1 <= 8 \ ? __strcpy_a_small ((dest), (src), strlen (src) + 1) \ : (char *) memcpy ((char *) (dest), \ (const char *) (src), \ strlen (src) + 1)) \ : __strcpy_g ((dest), (src)))) # define __strcpy_a_small(dest, src, srclen) \ (__extension__ ({ char *__dest = (dest); \ union { \ unsigned int __ui; \ unsigned short int __usi; \ unsigned char __uc; \ char __c; \ } *__u = (void *) __dest; \ switch (srclen) \ { \ case 1: \ __u->__uc = '\0'; \ break; \ case 2: \ __u->__usi = __STRING_SMALL_GET16 (src, 0); \ break; \ case 3: \ __u->__usi = __STRING_SMALL_GET16 (src, 0); \ __u = __extension__ ((void *) __u + 2); \ __u->__uc = '\0'; \ break; \ case 4: \ __u->__ui = __STRING_SMALL_GET32 (src, 0); \ break; \ case 5: \ __u->__ui = __STRING_SMALL_GET32 (src, 0); \ __u = __extension__ ((void *) __u + 4); \ __u->__uc = '\0'; \ break; \ case 6: \ __u->__ui = __STRING_SMALL_GET32 (src, 0); \ __u = __extension__ ((void *) __u + 4); \ __u->__usi = __STRING_SMALL_GET16 (src, 4); \ break; \ case 7: \ __u->__ui = __STRING_SMALL_GET32 (src, 0); \ __u = __extension__ ((void *) __u + 4); \ __u->__usi = __STRING_SMALL_GET16 (src, 4); \ __u = __extension__ ((void *) __u + 2); \ __u->__uc = '\0'; \ break; \ case 8: \ __u->__ui = __STRING_SMALL_GET32 (src, 0); \ __u = __extension__ ((void *) __u + 4); \ __u->__ui = __STRING_SMALL_GET32 (src, 4); \ break; \ } \ (char *) __dest; })) __STRING_INLINE char *__strcpy_g (char *__dest, const char *__src); __STRING_INLINE char * __strcpy_g (char *__dest, const char *__src) { register char *__tmp = __dest; register char __dummy; __asm__ __volatile__ ( "1:\n\t" "movb (%0),%b2\n\t" "leal 1(%0),%0\n\t" "movb %b2,(%1)\n\t" "leal 1(%1),%1\n\t" "testb %b2,%b2\n\t" "jne 1b" : "=&r" (__src), "=&r" (__tmp), "=&q" (__dummy), "=m" ( *(struct { char __x[0xfffffff]; } *)__dest) : "0" (__src), "1" (__tmp), "m" ( *(struct { char __x[0xfffffff]; } *)__src) : "cc"); return __dest; } # ifdef __USE_GNU # define _HAVE_STRING_ARCH_stpcpy 1 /* Copy SRC to DEST. */ # define __stpcpy(dest, src) \ (__extension__ (__builtin_constant_p (src) \ ? (strlen (src) + 1 <= 8 \ ? __stpcpy_a_small ((dest), (src), strlen (src) + 1) \ : __stpcpy_c ((dest), (src), strlen (src) + 1)) \ : __stpcpy_g ((dest), (src)))) # define __stpcpy_c(dest, src, srclen) \ ((srclen) % 4 == 0 \ ? __mempcpy_by4 (dest, src, srclen) - 1 \ : ((srclen) % 2 == 0 \ ? __mempcpy_by2 (dest, src, srclen) - 1 \ : __mempcpy_byn (dest, src, srclen) - 1)) /* In glibc itself we use this symbol for namespace reasons. */ # define stpcpy(dest, src) __stpcpy ((dest), (src)) # define __stpcpy_a_small(dest, src, srclen) \ (__extension__ ({ union { \ unsigned int __ui; \ unsigned short int __usi; \ unsigned char __uc; \ char __c; \ } *__u = (void *) (dest); \ switch (srclen) \ { \ case 1: \ __u->__uc = '\0'; \ break; \ case 2: \ __u->__usi = __STRING_SMALL_GET16 (src, 0); \ __u = __extension__ ((void *) __u + 1); \ break; \ case 3: \ __u->__usi = __STRING_SMALL_GET16 (src, 0); \ __u = __extension__ ((void *) __u + 2); \ __u->__uc = '\0'; \ break; \ case 4: \ __u->__ui = __STRING_SMALL_GET32 (src, 0); \ __u = __extension__ ((void *) __u + 3); \ break; \ case 5: \ __u->__ui = __STRING_SMALL_GET32 (src, 0); \ __u = __extension__ ((void *) __u + 4); \ __u->__uc = '\0'; \ break; \ case 6: \ __u->__ui = __STRING_SMALL_GET32 (src, 0); \ __u = __extension__ ((void *) __u + 4); \ __u->__usi = __STRING_SMALL_GET16 (src, 4); \ __u = __extension__ ((void *) __u + 1); \ break; \ case 7: \ __u->__ui = __STRING_SMALL_GET32 (src, 0); \ __u = __extension__ ((void *) __u + 4); \ __u->__usi = __STRING_SMALL_GET16 (src, 4); \ __u = __extension__ ((void *) __u + 2); \ __u->__uc = '\0'; \ break; \ case 8: \ __u->__ui = __STRING_SMALL_GET32 (src, 0); \ __u = __extension__ ((void *) __u + 4); \ __u->__ui = __STRING_SMALL_GET32 (src, 4); \ __u = __extension__ ((void *) __u + 3); \ break; \ } \ (char *) __u; })) __STRING_INLINE char *__mempcpy_by4 (char *__dest, const char *__src, size_t __srclen); __STRING_INLINE char * __mempcpy_by4 (char *__dest, const char *__src, size_t __srclen) { register char *__tmp = __dest; register unsigned long int __d0, __d1; __asm__ __volatile__ ("1:\n\t" "movl (%2),%0\n\t" "leal 4(%2),%2\n\t" "movl %0,(%1)\n\t" "leal 4(%1),%1\n\t" "decl %3\n\t" "jnz 1b" : "=&r" (__d0), "=r" (__tmp), "=&r" (__src), "=&r" (__d1) : "1" (__tmp), "2" (__src), "3" (__srclen / 4) : "memory", "cc"); return __tmp; } __STRING_INLINE char *__mempcpy_by2 (char *__dest, const char *__src, size_t __srclen); __STRING_INLINE char * __mempcpy_by2 (char *__dest, const char *__src, size_t __srclen) { register char *__tmp = __dest; register unsigned long int __d0, __d1; __asm__ __volatile__ ("shrl $1,%3\n\t" "jz 2f\n" /* only a word */ "1:\n\t" "movl (%2),%0\n\t" "leal 4(%2),%2\n\t" "movl %0,(%1)\n\t" "leal 4(%1),%1\n\t" "decl %3\n\t" "jnz 1b\n" "2:\n\t" "movw (%2),%w0\n\t" "movw %w0,(%1)" : "=&q" (__d0), "=r" (__tmp), "=&r" (__src), "=&r" (__d1), "=m" ( *(struct { __extension__ char __x[__srclen]; } *)__dest) : "1" (__tmp), "2" (__src), "3" (__srclen / 2), "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src) : "cc"); return __tmp + 2; } __STRING_INLINE char *__mempcpy_byn (char *__dest, const char *__src, size_t __srclen); __STRING_INLINE char * __mempcpy_byn (char *__dest, const char *__src, size_t __srclen) { register unsigned long __d0, __d1; register char *__tmp = __dest; __asm__ __volatile__ ("cld\n\t" "shrl $1,%%ecx\n\t" "jnc 1f\n\t" "movsb\n" "1:\n\t" "shrl $1,%%ecx\n\t" "jnc 2f\n\t" "movsw\n" "2:\n\t" "rep; movsl" : "=D" (__tmp), "=&c" (__d0), "=&S" (__d1), "=m" ( *(struct { __extension__ char __x[__srclen]; } *)__dest) : "0" (__tmp), "1" (__srclen), "2" (__src), "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src) : "cc"); return __tmp; } __STRING_INLINE char *__stpcpy_g (char *__dest, const char *__src); __STRING_INLINE char * __stpcpy_g (char *__dest, const char *__src) { register char *__tmp = __dest; register char __dummy; __asm__ __volatile__ ( "1:\n\t" "movb (%0),%b2\n\t" "leal 1(%0),%0\n\t" "movb %b2,(%1)\n\t" "leal 1(%1),%1\n\t" "testb %b2,%b2\n\t" "jne 1b" : "=&r" (__src), "=r" (__tmp), "=&q" (__dummy), "=m" ( *(struct { char __x[0xfffffff]; } *)__dest) : "0" (__src), "1" (__tmp), "m" ( *(struct { char __x[0xfffffff]; } *)__src) : "cc"); return __tmp - 1; } # endif /* Copy no more than N characters of SRC to DEST. */ # define _HAVE_STRING_ARCH_strncpy 1 # define strncpy(dest, src, n) \ (__extension__ (__builtin_constant_p (src) \ ? ((strlen (src) + 1 >= ((size_t) (n)) \ ? (char *) memcpy ((char *) (dest), \ (const char *) (src), n) \ : __strncpy_cg ((dest), (src), strlen (src) + 1, n))) \ : __strncpy_gg ((dest), (src), n))) # define __strncpy_cg(dest, src, srclen, n) \ (((srclen) % 4 == 0) \ ? __strncpy_by4 (dest, src, srclen, n) \ : (((srclen) % 2 == 0) \ ? __strncpy_by2 (dest, src, srclen, n) \ : __strncpy_byn (dest, src, srclen, n))) __STRING_INLINE char *__strncpy_by4 (char *__dest, const char __src[], size_t __srclen, size_t __n); __STRING_INLINE char * __strncpy_by4 (char *__dest, const char __src[], size_t __srclen, size_t __n) { register char *__tmp = __dest; register int __dummy1, __dummy2; __asm__ __volatile__ ("1:\n\t" "movl (%2),%0\n\t" "leal 4(%2),%2\n\t" "movl %0,(%1)\n\t" "leal 4(%1),%1\n\t" "decl %3\n\t" "jnz 1b" : "=&r" (__dummy1), "=r" (__tmp), "=&r" (__src), "=&r" (__dummy2), "=m" ( *(struct { __extension__ char __x[__srclen]; } *)__dest) : "1" (__tmp), "2" (__src), "3" (__srclen / 4), "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src) : "cc"); (void) memset (__tmp, '\0', __n - __srclen); return __dest; } __STRING_INLINE char *__strncpy_by2 (char *__dest, const char __src[], size_t __srclen, size_t __n); __STRING_INLINE char * __strncpy_by2 (char *__dest, const char __src[], size_t __srclen, size_t __n) { register char *__tmp = __dest; register int __dummy1, __dummy2; __asm__ __volatile__ ("shrl $1,%3\n\t" "jz 2f\n" /* only a word */ "1:\n\t" "movl (%2),%0\n\t" "leal 4(%2),%2\n\t" "movl %0,(%1)\n\t" "leal 4(%1),%1\n\t" "decl %3\n\t" "jnz 1b\n" "2:\n\t" "movw (%2),%w0\n\t" "movw %w0,(%1)\n\t" : "=&q" (__dummy1), "=r" (__tmp), "=&r" (__src), "=&r" (__dummy2), "=m" ( *(struct { __extension__ char __x[__srclen]; } *)__dest) : "1" (__tmp), "2" (__src), "3" (__srclen / 2), "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src) : "cc"); (void) memset (__tmp + 2, '\0', __n - __srclen); return __dest; } __STRING_INLINE char *__strncpy_byn (char *__dest, const char __src[], size_t __srclen, size_t __n); __STRING_INLINE char * __strncpy_byn (char *__dest, const char __src[], size_t __srclen, size_t __n) { register unsigned long int __d0, __d1; register char *__tmp = __dest; __asm__ __volatile__ ("cld\n\t" "shrl $1,%1\n\t" "jnc 1f\n\t" "movsb\n" "1:\n\t" "shrl $1,%1\n\t" "jnc 2f\n\t" "movsw\n" "2:\n\t" "rep; movsl" : "=D" (__tmp), "=&c" (__d0), "=&S" (__d1), "=m" ( *(struct { __extension__ char __x[__srclen]; } *)__dest) : "1" (__srclen), "0" (__tmp),"2" (__src), "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src) : "cc"); (void) memset (__tmp, '\0', __n - __srclen); return __dest; } __STRING_INLINE char *__strncpy_gg (char *__dest, const char *__src, size_t __n); __STRING_INLINE char * __strncpy_gg (char *__dest, const char *__src, size_t __n) { register char *__tmp = __dest; register char __dummy; if (__n > 0) __asm__ __volatile__ ("1:\n\t" "movb (%0),%2\n\t" "incl %0\n\t" "movb %2,(%1)\n\t" "incl %1\n\t" "decl %3\n\t" "je 3f\n\t" "testb %2,%2\n\t" "jne 1b\n\t" "2:\n\t" "movb %2,(%1)\n\t" "incl %1\n\t" "decl %3\n\t" "jne 2b\n\t" "3:" : "=&r" (__src), "=&r" (__tmp), "=&q" (__dummy), "=&r" (__n) : "0" (__src), "1" (__tmp), "3" (__n) : "memory", "cc"); return __dest; } /* Append SRC onto DEST. */ # define _HAVE_STRING_ARCH_strcat 1 # define strcat(dest, src) \ (__extension__ (__builtin_constant_p (src) \ ? __strcat_c ((dest), (src), strlen (src) + 1) \ : __strcat_g ((dest), (src)))) __STRING_INLINE char *__strcat_c (char *__dest, const char __src[], size_t __srclen); __STRING_INLINE char * __strcat_c (char *__dest, const char __src[], size_t __srclen) { # ifdef __i686__ register unsigned long int __d0; register char *__tmp; __asm__ __volatile__ ("repne; scasb" : "=D" (__tmp), "=&c" (__d0), "=m" ( *(struct { char __x[0xfffffff]; } *)__dest) : "0" (__dest), "1" (0xffffffff), "a" (0), "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src) : "cc"); --__tmp; # else register char *__tmp = __dest - 1; __asm__ __volatile__ ("1:\n\t" "incl %0\n\t" "cmpb $0,(%0)\n\t" "jne 1b\n" : "=r" (__tmp), "=m" ( *(struct { char __x[0xfffffff]; } *)__dest) : "0" (__tmp), "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src) : "cc"); # endif (void) memcpy (__tmp, __src, __srclen); return __dest; } __STRING_INLINE char *__strcat_g (char *__dest, const char *__src); __STRING_INLINE char * __strcat_g (char *__dest, const char *__src) { register char *__tmp = __dest - 1; register char __dummy; __asm__ __volatile__ ("1:\n\t" "incl %1\n\t" "cmpb $0,(%1)\n\t" "jne 1b\n" "2:\n\t" "movb (%2),%b0\n\t" "incl %2\n\t" "movb %b0,(%1)\n\t" "incl %1\n\t" "testb %b0,%b0\n\t" "jne 2b\n" : "=&q" (__dummy), "=&r" (__tmp), "=&r" (__src), "=m" ( *(struct { char __x[0xfffffff]; } *)__dest) : "1" (__tmp), "2" (__src), "m" ( *(struct { char __x[0xfffffff]; } *)__src) : "memory", "cc"); return __dest; } /* Append no more than N characters from SRC onto DEST. */ # define _HAVE_STRING_ARCH_strncat 1 # define strncat(dest, src, n) \ (__extension__ ({ char *__dest = (dest); \ __builtin_constant_p (src) && __builtin_constant_p (n) \ ? (strlen (src) < ((size_t) (n)) \ ? strcat (__dest, (src)) \ : (*(char *)__mempcpy (strchr (__dest, '\0'), \ (const char *) (src), \ (n)) = 0, __dest)) \ : __strncat_g (__dest, (src), (n)); })) __STRING_INLINE char *__strncat_g (char *__dest, const char __src[], size_t __n); __STRING_INLINE char * __strncat_g (char *__dest, const char __src[], size_t __n) { register char *__tmp = __dest; register char __dummy; # ifdef __i686__ __asm__ __volatile__ ("repne; scasb\n" "movl %4, %3\n\t" "decl %1\n\t" "1:\n\t" "subl $1,%3\n\t" "jc 2f\n\t" "movb (%2),%b0\n\t" "movsb\n\t" "testb %b0,%b0\n\t" "jne 1b\n\t" "decl %1\n" "2:\n\t" "movb $0,(%1)" : "=&a" (__dummy), "=&D" (__tmp), "=&S" (__src), "=&c" (__n) : "g" (__n), "0" (0), "1" (__tmp), "2" (__src), "3" (0xffffffff) : "memory", "cc"); # else --__tmp; __asm__ __volatile__ ("1:\n\t" "cmpb $0,1(%1)\n\t" "leal 1(%1),%1\n\t" "jne 1b\n" "2:\n\t" "subl $1,%3\n\t" "jc 3f\n\t" "movb (%2),%b0\n\t" "leal 1(%2),%2\n\t" "movb %b0,(%1)\n\t" "leal 1(%1),%1\n\t" "testb %b0,%b0\n\t" "jne 2b\n\t" "decl %1\n" "3:\n\t" "movb $0,(%1)" : "=&q" (__dummy), "=&r" (__tmp), "=&r" (__src), "=&r" (__n) : "1" (__tmp), "2" (__src), "3" (__n) : "memory", "cc"); #endif return __dest; } /* Compare S1 and S2. */ # define _HAVE_STRING_ARCH_strcmp 1 # define strcmp(s1, s2) \ (__extension__ (__builtin_constant_p (s1) && __builtin_constant_p (s2) \ && (sizeof ((s1)[0]) != 1 || strlen (s1) >= 4) \ && (sizeof ((s2)[0]) != 1 || strlen (s2) >= 4) \ ? memcmp ((const char *) (s1), (const char *) (s2), \ (strlen (s1) < strlen (s2) \ ? strlen (s1) : strlen (s2)) + 1) \ : (__builtin_constant_p (s1) && sizeof ((s1)[0]) == 1 \ && sizeof ((s2)[0]) == 1 && strlen (s1) < 4 \ ? (__builtin_constant_p (s2) && sizeof ((s2)[0]) == 1 \ ? __strcmp_cc ((const unsigned char *) (s1), \ (const unsigned char *) (s2), \ strlen (s1)) \ : __strcmp_cg ((const unsigned char *) (s1), \ (const unsigned char *) (s2), \ strlen (s1))) \ : (__builtin_constant_p (s2) && sizeof ((s1)[0]) == 1 \ && sizeof ((s2)[0]) == 1 && strlen (s2) < 4 \ ? (__builtin_constant_p (s1) \ ? __strcmp_cc ((const unsigned char *) (s1), \ (const unsigned char *) (s2), \ strlen (s2)) \ : __strcmp_gc ((const unsigned char *) (s1), \ (const unsigned char *) (s2), \ strlen (s2))) \ : __strcmp_gg ((s1), (s2)))))) # define __strcmp_cc(s1, s2, l) \ (__extension__ ({ register int __result = (s1)[0] - (s2)[0]; \ if (l > 0 && __result == 0) \ { \ __result = (s1)[1] - (s2)[1]; \ if (l > 1 && __result == 0) \ { \ __result = (s1)[2] - (s2)[2]; \ if (l > 2 && __result == 0) \ __result = (s1)[3] - (s2)[3]; \ } \ } \ __result; })) # define __strcmp_cg(s1, s2, l1) \ (__extension__ ({ const unsigned char *__s2 = (s2); \ register int __result = (s1)[0] - __s2[0]; \ if (l1 > 0 && __result == 0) \ { \ __result = (s1)[1] - __s2[1]; \ if (l1 > 1 && __result == 0) \ { \ __result = (s1)[2] - __s2[2]; \ if (l1 > 2 && __result == 0) \ __result = (s1)[3] - __s2[3]; \ } \ } \ __result; })) # define __strcmp_gc(s1, s2, l2) \ (__extension__ ({ const unsigned char *__s1 = (s1); \ register int __result = __s1[0] - (s2)[0]; \ if (l2 > 0 && __result == 0) \ { \ __result = __s1[1] - (s2)[1]; \ if (l2 > 1 && __result == 0) \ { \ __result = __s1[2] - (s2)[2]; \ if (l2 > 2 && __result == 0) \ __result = __s1[3] - (s2)[3]; \ } \ } \ __result; })) __STRING_INLINE int __strcmp_gg (const char *__s1, const char *__s2); __STRING_INLINE int __strcmp_gg (const char *__s1, const char *__s2) { register int __res; __asm__ __volatile__ ("1:\n\t" "movb (%1),%b0\n\t" "leal 1(%1),%1\n\t" "cmpb %b0,(%2)\n\t" "jne 2f\n\t" "leal 1(%2),%2\n\t" "testb %b0,%b0\n\t" "jne 1b\n\t" "xorl %0,%0\n\t" "jmp 3f\n" "2:\n\t" "movl $1,%0\n\t" "jb 3f\n\t" "negl %0\n" "3:" : "=q" (__res), "=&r" (__s1), "=&r" (__s2) : "1" (__s1), "2" (__s2), "m" ( *(struct { char __x[0xfffffff]; } *)__s1), "m" ( *(struct { char __x[0xfffffff]; } *)__s2) : "cc"); return __res; } /* Compare N characters of S1 and S2. */ # define _HAVE_STRING_ARCH_strncmp 1 # define strncmp(s1, s2, n) \ (__extension__ (__builtin_constant_p (s1) && strlen (s1) < ((size_t) (n)) \ ? strcmp ((s1), (s2)) \ : (__builtin_constant_p (s2) && strlen (s2) < ((size_t) (n))\ ? strcmp ((s1), (s2)) \ : __strncmp_g ((s1), (s2), (n))))) __STRING_INLINE int __strncmp_g (const char *__s1, const char *__s2, size_t __n); __STRING_INLINE int __strncmp_g (const char *__s1, const char *__s2, size_t __n) { register int __res; __asm__ __volatile__ ("1:\n\t" "subl $1,%3\n\t" "jc 2f\n\t" "movb (%1),%b0\n\t" "incl %1\n\t" "cmpb %b0,(%2)\n\t" "jne 3f\n\t" "incl %2\n\t" "testb %b0,%b0\n\t" "jne 1b\n" "2:\n\t" "xorl %0,%0\n\t" "jmp 4f\n" "3:\n\t" "movl $1,%0\n\t" "jb 4f\n\t" "negl %0\n" "4:" : "=q" (__res), "=&r" (__s1), "=&r" (__s2), "=&r" (__n) : "1" (__s1), "2" (__s2), "3" (__n), "m" ( *(struct { __extension__ char __x[__n]; } *)__s1), "m" ( *(struct { __extension__ char __x[__n]; } *)__s2) : "cc"); return __res; } /* Find the first occurrence of C in S. */ # define _HAVE_STRING_ARCH_strchr 1 # define _USE_STRING_ARCH_strchr 1 # define strchr(s, c) \ (__extension__ (__builtin_constant_p (c) \ ? ((c) == '\0' \ ? (char *) __rawmemchr ((s), (c)) \ : __strchr_c ((s), ((c) & 0xff) << 8)) \ : __strchr_g ((s), (c)))) __STRING_INLINE char *__strchr_c (const char *__s, int __c); __STRING_INLINE char * __strchr_c (const char *__s, int __c) { register unsigned long int __d0; register char *__res; __asm__ __volatile__ ("1:\n\t" "movb (%0),%%al\n\t" "cmpb %%ah,%%al\n\t" "je 2f\n\t" "leal 1(%0),%0\n\t" "testb %%al,%%al\n\t" "jne 1b\n\t" "xorl %0,%0\n" "2:" : "=r" (__res), "=&a" (__d0) : "0" (__s), "1" (__c), "m" ( *(struct { char __x[0xfffffff]; } *)__s) : "cc"); return __res; } __STRING_INLINE char *__strchr_g (const char *__s, int __c); __STRING_INLINE char * __strchr_g (const char *__s, int __c) { register unsigned long int __d0; register char *__res; __asm__ __volatile__ ("movb %%al,%%ah\n" "1:\n\t" "movb (%0),%%al\n\t" "cmpb %%ah,%%al\n\t" "je 2f\n\t" "leal 1(%0),%0\n\t" "testb %%al,%%al\n\t" "jne 1b\n\t" "xorl %0,%0\n" "2:" : "=r" (__res), "=&a" (__d0) : "0" (__s), "1" (__c), "m" ( *(struct { char __x[0xfffffff]; } *)__s) : "cc"); return __res; } /* Find the first occurrence of C in S or the final NUL byte. */ # define _HAVE_STRING_ARCH_strchrnul 1 # define __strchrnul(s, c) \ (__extension__ (__builtin_constant_p (c) \ ? ((c) == '\0' \ ? (char *) __rawmemchr ((s), c) \ : __strchrnul_c ((s), ((c) & 0xff) << 8)) \ : __strchrnul_g ((s), c))) __STRING_INLINE char *__strchrnul_c (const char *__s, int __c); __STRING_INLINE char * __strchrnul_c (const char *__s, int __c) { register unsigned long int __d0; register char *__res; __asm__ __volatile__ ("1:\n\t" "movb (%0),%%al\n\t" "cmpb %%ah,%%al\n\t" "je 2f\n\t" "leal 1(%0),%0\n\t" "testb %%al,%%al\n\t" "jne 1b\n\t" "decl %0\n" "2:" : "=r" (__res), "=&a" (__d0) : "0" (__s), "1" (__c), "m" ( *(struct { char __x[0xfffffff]; } *)__s) : "cc"); return __res; } __STRING_INLINE char *__strchrnul_g (const char *__s, int __c); __STRING_INLINE char * __strchrnul_g (const char *__s, int __c) { register unsigned long int __d0; register char *__res; __asm__ __volatile__ ("movb %%al,%%ah\n" "1:\n\t" "movb (%0),%%al\n\t" "cmpb %%ah,%%al\n\t" "je 2f\n\t" "leal 1(%0),%0\n\t" "testb %%al,%%al\n\t" "jne 1b\n\t" "decl %0\n" "2:" : "=r" (__res), "=&a" (__d0) : "0" (__s), "1" (__c), "m" ( *(struct { char __x[0xfffffff]; } *)__s) : "cc"); return __res; } # ifdef __USE_GNU # define strchrnul(s, c) __strchrnul ((s), (c)) # endif # if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Find the first occurrence of C in S. This is the BSD name. */ # define _HAVE_STRING_ARCH_index 1 # define index(s, c) \ (__extension__ (__builtin_constant_p (c) \ ? __strchr_c ((s), ((c) & 0xff) << 8) \ : __strchr_g ((s), (c)))) # endif /* Find the last occurrence of C in S. */ # define _HAVE_STRING_ARCH_strrchr 1 # define strrchr(s, c) \ (__extension__ (__builtin_constant_p (c) \ ? __strrchr_c ((s), ((c) & 0xff) << 8) \ : __strrchr_g ((s), (c)))) # ifdef __i686__ __STRING_INLINE char *__strrchr_c (const char *__s, int __c); __STRING_INLINE char * __strrchr_c (const char *__s, int __c) { register unsigned long int __d0, __d1; register char *__res; __asm__ __volatile__ ("cld\n" "1:\n\t" "lodsb\n\t" "cmpb %h2,%b2\n\t" "cmove %1,%0\n\t" "testb %b2,%b2\n\t" "jne 1b" : "=d" (__res), "=&S" (__d0), "=&a" (__d1) : "0" (1), "1" (__s), "2" (__c), "m" ( *(struct { char __x[0xfffffff]; } *)__s) : "cc"); return __res - 1; } __STRING_INLINE char *__strrchr_g (const char *__s, int __c); __STRING_INLINE char * __strrchr_g (const char *__s, int __c) { register unsigned long int __d0, __d1; register char *__res; __asm__ __volatile__ ("movb %b2,%h2\n" "cld\n\t" "1:\n\t" "lodsb\n\t" "cmpb %h2,%b2\n\t" "cmove %1,%0\n\t" "testb %b2,%b2\n\t" "jne 1b" : "=d" (__res), "=&S" (__d0), "=&a" (__d1) : "0" (1), "1" (__s), "2" (__c), "m" ( *(struct { char __x[0xfffffff]; } *)__s) : "cc"); return __res - 1; } # else __STRING_INLINE char *__strrchr_c (const char *__s, int __c); __STRING_INLINE char * __strrchr_c (const char *__s, int __c) { register unsigned long int __d0, __d1; register char *__res; __asm__ __volatile__ ("cld\n" "1:\n\t" "lodsb\n\t" "cmpb %%ah,%%al\n\t" "jne 2f\n\t" "leal -1(%%esi),%0\n" "2:\n\t" "testb %%al,%%al\n\t" "jne 1b" : "=d" (__res), "=&S" (__d0), "=&a" (__d1) : "0" (0), "1" (__s), "2" (__c), "m" ( *(struct { char __x[0xfffffff]; } *)__s) : "cc"); return __res; } __STRING_INLINE char *__strrchr_g (const char *__s, int __c); __STRING_INLINE char * __strrchr_g (const char *__s, int __c) { register unsigned long int __d0, __d1; register char *__res; __asm__ __volatile__ ("movb %%al,%%ah\n" "cld\n\t" "1:\n\t" "lodsb\n\t" "cmpb %%ah,%%al\n\t" "jne 2f\n\t" "leal -1(%%esi),%0\n" "2:\n\t" "testb %%al,%%al\n\t" "jne 1b" : "=r" (__res), "=&S" (__d0), "=&a" (__d1) : "0" (0), "1" (__s), "2" (__c), "m" ( *(struct { char __x[0xfffffff]; } *)__s) : "cc"); return __res; } # endif # if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Find the last occurrence of C in S. This is the BSD name. */ # define _HAVE_STRING_ARCH_rindex 1 # define rindex(s, c) \ (__extension__ (__builtin_constant_p (c) \ ? __strrchr_c ((s), ((c) & 0xff) << 8) \ : __strrchr_g ((s), (c)))) # endif /* Return the length of the initial segment of S which consists entirely of characters not in REJECT. */ # define _HAVE_STRING_ARCH_strcspn 1 # define strcspn(s, reject) \ (__extension__ (__builtin_constant_p (reject) && sizeof ((reject)[0]) == 1 \ ? ((reject)[0] == '\0' \ ? strlen (s) \ : ((reject)[1] == '\0' \ ? __strcspn_c1 ((s), (((reject)[0] << 8) & 0xff00)) \ : __strcspn_cg ((s), (reject), strlen (reject)))) \ : __strcspn_g ((s), (reject)))) __STRING_INLINE size_t __strcspn_c1 (const char *__s, int __reject); # ifndef _FORCE_INLINES __STRING_INLINE size_t __strcspn_c1 (const char *__s, int __reject) { register unsigned long int __d0; register char *__res; __asm__ __volatile__ ("1:\n\t" "movb (%0),%%al\n\t" "leal 1(%0),%0\n\t" "cmpb %%ah,%%al\n\t" "je 2f\n\t" "testb %%al,%%al\n\t" "jne 1b\n" "2:" : "=r" (__res), "=&a" (__d0) : "0" (__s), "1" (__reject), "m" ( *(struct { char __x[0xfffffff]; } *)__s) : "cc"); return (__res - 1) - __s; } # endif __STRING_INLINE size_t __strcspn_cg (const char *__s, const char __reject[], size_t __reject_len); __STRING_INLINE size_t __strcspn_cg (const char *__s, const char __reject[], size_t __reject_len) { register unsigned long int __d0, __d1, __d2; register const char *__res; __asm__ __volatile__ ("cld\n" "1:\n\t" "lodsb\n\t" "testb %%al,%%al\n\t" "je 2f\n\t" "movl %5,%%edi\n\t" "movl %6,%%ecx\n\t" "repne; scasb\n\t" "jne 1b\n" "2:" : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2) : "0" (__s), "d" (__reject), "g" (__reject_len) : "memory", "cc"); return (__res - 1) - __s; } __STRING_INLINE size_t __strcspn_g (const char *__s, const char *__reject); # ifdef __PIC__ __STRING_INLINE size_t __strcspn_g (const char *__s, const char *__reject) { register unsigned long int __d0, __d1, __d2; register const char *__res; __asm__ __volatile__ ("pushl %%ebx\n\t" "movl %4,%%edi\n\t" "cld\n\t" "repne; scasb\n\t" "notl %%ecx\n\t" "leal -1(%%ecx),%%ebx\n" "1:\n\t" "lodsb\n\t" "testb %%al,%%al\n\t" "je 2f\n\t" "movl %4,%%edi\n\t" "movl %%ebx,%%ecx\n\t" "repne; scasb\n\t" "jne 1b\n" "2:\n\t" "popl %%ebx" : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2) : "r" (__reject), "0" (__s), "1" (0), "2" (0xffffffff) : "memory", "cc"); return (__res - 1) - __s; } # else __STRING_INLINE size_t __strcspn_g (const char *__s, const char *__reject) { register unsigned long int __d0, __d1, __d2, __d3; register const char *__res; __asm__ __volatile__ ("cld\n\t" "repne; scasb\n\t" "notl %%ecx\n\t" "leal -1(%%ecx),%%edx\n" "1:\n\t" "lodsb\n\t" "testb %%al,%%al\n\t" "je 2f\n\t" "movl %%ebx,%%edi\n\t" "movl %%edx,%%ecx\n\t" "repne; scasb\n\t" "jne 1b\n" "2:" : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2), "=&d" (__d3) : "0" (__s), "1" (0), "2" (0xffffffff), "3" (__reject), "b" (__reject) /* Clobber memory, otherwise GCC cannot handle this. */ : "memory", "cc"); return (__res - 1) - __s; } # endif /* Return the length of the initial segment of S which consists entirely of characters in ACCEPT. */ # define _HAVE_STRING_ARCH_strspn 1 # define strspn(s, accept) \ (__extension__ (__builtin_constant_p (accept) && sizeof ((accept)[0]) == 1 \ ? ((accept)[0] == '\0' \ ? ((void) (s), 0) \ : ((accept)[1] == '\0' \ ? __strspn_c1 ((s), (((accept)[0] << 8 ) & 0xff00)) \ : __strspn_cg ((s), (accept), strlen (accept)))) \ : __strspn_g ((s), (accept)))) # ifndef _FORCE_INLINES __STRING_INLINE size_t __strspn_c1 (const char *__s, int __accept); __STRING_INLINE size_t __strspn_c1 (const char *__s, int __accept) { register unsigned long int __d0; register char *__res; /* Please note that __accept never can be '\0'. */ __asm__ __volatile__ ("1:\n\t" "movb (%0),%b1\n\t" "leal 1(%0),%0\n\t" "cmpb %h1,%b1\n\t" "je 1b" : "=r" (__res), "=&q" (__d0) : "0" (__s), "1" (__accept), "m" ( *(struct { char __x[0xfffffff]; } *)__s) : "cc"); return (__res - 1) - __s; } # endif __STRING_INLINE size_t __strspn_cg (const char *__s, const char __accept[], size_t __accept_len); __STRING_INLINE size_t __strspn_cg (const char *__s, const char __accept[], size_t __accept_len) { register unsigned long int __d0, __d1, __d2; register const char *__res; __asm__ __volatile__ ("cld\n" "1:\n\t" "lodsb\n\t" "testb %%al,%%al\n\t" "je 2f\n\t" "movl %5,%%edi\n\t" "movl %6,%%ecx\n\t" "repne; scasb\n\t" "je 1b\n" "2:" : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2) : "0" (__s), "g" (__accept), "g" (__accept_len), /* Since we do not know how large the memory we access it, use a really large amount. */ "m" ( *(struct { char __x[0xfffffff]; } *)__s), "m" ( *(struct { __extension__ char __x[__accept_len]; } *)__accept) : "cc"); return (__res - 1) - __s; } __STRING_INLINE size_t __strspn_g (const char *__s, const char *__accept); # ifdef __PIC__ __STRING_INLINE size_t __strspn_g (const char *__s, const char *__accept) { register unsigned long int __d0, __d1, __d2; register const char *__res; __asm__ __volatile__ ("pushl %%ebx\n\t" "cld\n\t" "repne; scasb\n\t" "notl %%ecx\n\t" "leal -1(%%ecx),%%ebx\n" "1:\n\t" "lodsb\n\t" "testb %%al,%%al\n\t" "je 2f\n\t" "movl %%edx,%%edi\n\t" "movl %%ebx,%%ecx\n\t" "repne; scasb\n\t" "je 1b\n" "2:\n\t" "popl %%ebx" : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2) : "d" (__accept), "0" (__s), "1" (0), "2" (0xffffffff), "3" (__accept) : "memory", "cc"); return (__res - 1) - __s; } # else __STRING_INLINE size_t __strspn_g (const char *__s, const char *__accept) { register unsigned long int __d0, __d1, __d2, __d3; register const char *__res; __asm__ __volatile__ ("cld\n\t" "repne; scasb\n\t" "notl %%ecx\n\t" "leal -1(%%ecx),%%edx\n" "1:\n\t" "lodsb\n\t" "testb %%al,%%al\n\t" "je 2f\n\t" "movl %%ebx,%%edi\n\t" "movl %%edx,%%ecx\n\t" "repne; scasb\n\t" "je 1b\n" "2:" : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2), "=&d" (__d3) : "0" (__s), "1" (0), "2" (0xffffffff), "3" (__accept), "b" (__accept) : "memory", "cc"); return (__res - 1) - __s; } # endif /* Find the first occurrence in S of any character in ACCEPT. */ # define _HAVE_STRING_ARCH_strpbrk 1 # define strpbrk(s, accept) \ (__extension__ (__builtin_constant_p (accept) && sizeof ((accept)[0]) == 1 \ ? ((accept)[0] == '\0' \ ? ((void) (s), (char *) 0) \ : ((accept)[1] == '\0' \ ? strchr ((s), (accept)[0]) \ : __strpbrk_cg ((s), (accept), strlen (accept)))) \ : __strpbrk_g ((s), (accept)))) __STRING_INLINE char *__strpbrk_cg (const char *__s, const char __accept[], size_t __accept_len); __STRING_INLINE char * __strpbrk_cg (const char *__s, const char __accept[], size_t __accept_len) { register unsigned long int __d0, __d1, __d2; register char *__res; __asm__ __volatile__ ("cld\n" "1:\n\t" "lodsb\n\t" "testb %%al,%%al\n\t" "je 2f\n\t" "movl %5,%%edi\n\t" "movl %6,%%ecx\n\t" "repne; scasb\n\t" "jne 1b\n\t" "decl %0\n\t" "jmp 3f\n" "2:\n\t" "xorl %0,%0\n" "3:" : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2) : "0" (__s), "d" (__accept), "g" (__accept_len) : "memory", "cc"); return __res; } __STRING_INLINE char *__strpbrk_g (const char *__s, const char *__accept); # ifdef __PIC__ __STRING_INLINE char * __strpbrk_g (const char *__s, const char *__accept) { register unsigned long int __d0, __d1, __d2; register char *__res; __asm__ __volatile__ ("pushl %%ebx\n\t" "movl %%edx,%%edi\n\t" "cld\n\t" "repne; scasb\n\t" "notl %%ecx\n\t" "leal -1(%%ecx),%%ebx\n" "1:\n\t" "lodsb\n\t" "testb %%al,%%al\n\t" "je 2f\n\t" "movl %%edx,%%edi\n\t" "movl %%ebx,%%ecx\n\t" "repne; scasb\n\t" "jne 1b\n\t" "decl %0\n\t" "jmp 3f\n" "2:\n\t" "xorl %0,%0\n" "3:\n\t" "popl %%ebx" : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2) : "d" (__accept), "0" (__s), "1" (0), "2" (0xffffffff) : "memory", "cc"); return __res; } # else __STRING_INLINE char * __strpbrk_g (const char *__s, const char *__accept) { register unsigned long int __d0, __d1, __d2, __d3; register char *__res; __asm__ __volatile__ ("movl %%ebx,%%edi\n\t" "cld\n\t" "repne; scasb\n\t" "notl %%ecx\n\t" "leal -1(%%ecx),%%edx\n" "1:\n\t" "lodsb\n\t" "testb %%al,%%al\n\t" "je 2f\n\t" "movl %%ebx,%%edi\n\t" "movl %%edx,%%ecx\n\t" "repne; scasb\n\t" "jne 1b\n\t" "decl %0\n\t" "jmp 3f\n" "2:\n\t" "xorl %0,%0\n" "3:" : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&d" (__d2), "=&D" (__d3) : "0" (__s), "1" (0), "2" (0xffffffff), "b" (__accept) : "memory", "cc"); return __res; } # endif /* Find the first occurrence of NEEDLE in HAYSTACK. */ # define _HAVE_STRING_ARCH_strstr 1 # define strstr(haystack, needle) \ (__extension__ (__builtin_constant_p (needle) && sizeof ((needle)[0]) == 1 \ ? ((needle)[0] == '\0' \ ? (haystack) \ : ((needle)[1] == '\0' \ ? strchr ((haystack), (needle)[0]) \ : __strstr_cg ((haystack), (needle), \ strlen (needle)))) \ : __strstr_g ((haystack), (needle)))) /* Please note that this function need not handle NEEDLEs with a length shorter than two. */ __STRING_INLINE char *__strstr_cg (const char *__haystack, const char __needle[], size_t __needle_len); __STRING_INLINE char * __strstr_cg (const char *__haystack, const char __needle[], size_t __needle_len) { register unsigned long int __d0, __d1, __d2; register char *__res; __asm__ __volatile__ ("cld\n" \ "1:\n\t" "movl %6,%%edi\n\t" "movl %5,%%eax\n\t" "movl %4,%%ecx\n\t" "repe; cmpsb\n\t" "je 2f\n\t" "cmpb $0,-1(%%esi)\n\t" "leal 1(%%eax),%5\n\t" "jne 1b\n\t" "xorl %%eax,%%eax\n" "2:" : "=&a" (__res), "=&S" (__d0), "=&D" (__d1), "=&c" (__d2) : "g" (__needle_len), "1" (__haystack), "d" (__needle) : "memory", "cc"); return __res; } __STRING_INLINE char *__strstr_g (const char *__haystack, const char *__needle); # ifdef __PIC__ __STRING_INLINE char * __strstr_g (const char *__haystack, const char *__needle) { register unsigned long int __d0, __d1, __d2; register char *__res; __asm__ __volatile__ ("cld\n\t" "repne; scasb\n\t" "notl %%ecx\n\t" "pushl %%ebx\n\t" "decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */ "movl %%ecx,%%ebx\n" "1:\n\t" "movl %%edx,%%edi\n\t" "movl %%esi,%%eax\n\t" "movl %%ebx,%%ecx\n\t" "repe; cmpsb\n\t" "je 2f\n\t" /* also works for empty string, see above */ "cmpb $0,-1(%%esi)\n\t" "leal 1(%%eax),%%esi\n\t" "jne 1b\n\t" "xorl %%eax,%%eax\n" "2:\n\t" "popl %%ebx" : "=&a" (__res), "=&c" (__d0), "=&S" (__d1), "=&D" (__d2) : "0" (0), "1" (0xffffffff), "2" (__haystack), "3" (__needle), "d" (__needle) : "memory", "cc"); return __res; } # else __STRING_INLINE char * __strstr_g (const char *__haystack, const char *__needle) { register unsigned long int __d0, __d1, __d2, __d3; register char *__res; __asm__ __volatile__ ("cld\n\t" "repne; scasb\n\t" "notl %%ecx\n\t" "decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */ "movl %%ecx,%%edx\n" "1:\n\t" "movl %%ebx,%%edi\n\t" "movl %%esi,%%eax\n\t" "movl %%edx,%%ecx\n\t" "repe; cmpsb\n\t" "je 2f\n\t" /* also works for empty string, see above */ "cmpb $0,-1(%%esi)\n\t" "leal 1(%%eax),%%esi\n\t" "jne 1b\n\t" "xorl %%eax,%%eax\n" "2:" : "=&a" (__res), "=&c" (__d0), "=&S" (__d1), "=&D" (__d2), "=&d" (__d3) : "0" (0), "1" (0xffffffff), "2" (__haystack), "3" (__needle), "b" (__needle) : "memory", "cc"); return __res; } # endif /* Bit find functions. We define only the i686 version since for the other processors gcc generates good code. */ # if defined __USE_BSD || defined __USE_XOPEN_EXTENDED # ifdef __i686__ # define _HAVE_STRING_ARCH_ffs 1 # define ffs(word) (__builtin_constant_p (word) \ ? __builtin_ffs (word) \ : ({ int __cnt, __tmp; \ __asm__ __volatile__ \ ("bsfl %2,%0\n\t" \ "cmovel %1,%0" \ : "=&r" (__cnt), "=r" (__tmp) \ : "rm" (word), "1" (-1)); \ __cnt + 1; })) # ifndef ffsl # define ffsl(word) ffs(word) # endif # endif /* i686 */ # endif /* BSD || X/Open */ # ifndef _FORCE_INLINES # undef __STRING_INLINE # endif # endif /* use string inlines && GNU CC */ #endif ���������������������bits/poll.h�����������������������������������������������������������������������������������������0000644�����������������00000004050�14763166030�0006631 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997, 2001, 2006, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_POLL_H # error "Never use <bits/poll.h> directly; include <sys/poll.h> instead." #endif /* Event types that can be polled for. These bits may be set in `events' to indicate the interesting event types; they will appear in `revents' to indicate the status of the file descriptor. */ #define POLLIN 0x001 /* There is data to read. */ #define POLLPRI 0x002 /* There is urgent data to read. */ #define POLLOUT 0x004 /* Writing now will not block. */ #if defined __USE_XOPEN || defined __USE_XOPEN2K8 /* These values are defined in XPG4.2. */ # define POLLRDNORM 0x040 /* Normal data may be read. */ # define POLLRDBAND 0x080 /* Priority data may be read. */ # define POLLWRNORM 0x100 /* Writing now will not block. */ # define POLLWRBAND 0x200 /* Priority data may be written. */ #endif #ifdef __USE_GNU /* These are extensions for Linux. */ # define POLLMSG 0x400 # define POLLREMOVE 0x1000 # define POLLRDHUP 0x2000 #endif /* Event types always implicitly polled for. These bits need not be set in `events', but they will appear in `revents' to indicate the status of the file descriptor. */ #define POLLERR 0x008 /* Error condition. */ #define POLLHUP 0x010 /* Hung up. */ #define POLLNVAL 0x020 /* Invalid polling request. */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/posix_opt.h������������������������������������������������������������������������������������0000644�����������������00000013230�14763166030�0007707 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Define POSIX options for Linux. Copyright (C) 1996-2004, 2006, 2008, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; see the file COPYING.LIB. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_POSIX_OPT_H #define _BITS_POSIX_OPT_H 1 /* Job control is supported. */ #define _POSIX_JOB_CONTROL 1 /* Processes have a saved set-user-ID and a saved set-group-ID. */ #define _POSIX_SAVED_IDS 1 /* Priority scheduling is supported. */ #define _POSIX_PRIORITY_SCHEDULING 200809L /* Synchronizing file data is supported. */ #define _POSIX_SYNCHRONIZED_IO 200809L /* The fsync function is present. */ #define _POSIX_FSYNC 200809L /* Mapping of files to memory is supported. */ #define _POSIX_MAPPED_FILES 200809L /* Locking of all memory is supported. */ #define _POSIX_MEMLOCK 200809L /* Locking of ranges of memory is supported. */ #define _POSIX_MEMLOCK_RANGE 200809L /* Setting of memory protections is supported. */ #define _POSIX_MEMORY_PROTECTION 200809L /* Some filesystems allow all users to change file ownership. */ #define _POSIX_CHOWN_RESTRICTED 0 /* `c_cc' member of 'struct termios' structure can be disabled by using the value _POSIX_VDISABLE. */ #define _POSIX_VDISABLE '\0' /* Filenames are not silently truncated. */ #define _POSIX_NO_TRUNC 1 /* X/Open realtime support is available. */ #define _XOPEN_REALTIME 1 /* X/Open thread realtime support is available. */ #define _XOPEN_REALTIME_THREADS 1 /* XPG4.2 shared memory is supported. */ #define _XOPEN_SHM 1 /* Tell we have POSIX threads. */ #define _POSIX_THREADS 200809L /* We have the reentrant functions described in POSIX. */ #define _POSIX_REENTRANT_FUNCTIONS 1 #define _POSIX_THREAD_SAFE_FUNCTIONS 200809L /* We provide priority scheduling for threads. */ #define _POSIX_THREAD_PRIORITY_SCHEDULING 200809L /* We support user-defined stack sizes. */ #define _POSIX_THREAD_ATTR_STACKSIZE 200809L /* We support user-defined stacks. */ #define _POSIX_THREAD_ATTR_STACKADDR 200809L /* We support priority inheritence. */ #define _POSIX_THREAD_PRIO_INHERIT 200809L /* We support priority protection, though only for non-robust mutexes. */ #define _POSIX_THREAD_PRIO_PROTECT 200809L #ifdef __USE_XOPEN2K8 /* We support priority inheritence for robust mutexes. */ # define _POSIX_THREAD_ROBUST_PRIO_INHERIT 200809L /* We do not support priority protection for robust mutexes. */ # define _POSIX_THREAD_ROBUST_PRIO_PROTECT -1 #endif /* We support POSIX.1b semaphores. */ #define _POSIX_SEMAPHORES 200809L /* Real-time signals are supported. */ #define _POSIX_REALTIME_SIGNALS 200809L /* We support asynchronous I/O. */ #define _POSIX_ASYNCHRONOUS_IO 200809L #define _POSIX_ASYNC_IO 1 /* Alternative name for Unix98. */ #define _LFS_ASYNCHRONOUS_IO 1 /* Support for prioritization is also available. */ #define _POSIX_PRIORITIZED_IO 200809L /* The LFS support in asynchronous I/O is also available. */ #define _LFS64_ASYNCHRONOUS_IO 1 /* The rest of the LFS is also available. */ #define _LFS_LARGEFILE 1 #define _LFS64_LARGEFILE 1 #define _LFS64_STDIO 1 /* POSIX shared memory objects are implemented. */ #define _POSIX_SHARED_MEMORY_OBJECTS 200809L /* CPU-time clocks support needs to be checked at runtime. */ #define _POSIX_CPUTIME 0 /* Clock support in threads must be also checked at runtime. */ #define _POSIX_THREAD_CPUTIME 0 /* GNU libc provides regular expression handling. */ #define _POSIX_REGEXP 1 /* Reader/Writer locks are available. */ #define _POSIX_READER_WRITER_LOCKS 200809L /* We have a POSIX shell. */ #define _POSIX_SHELL 1 /* We support the Timeouts option. */ #define _POSIX_TIMEOUTS 200809L /* We support spinlocks. */ #define _POSIX_SPIN_LOCKS 200809L /* The `spawn' function family is supported. */ #define _POSIX_SPAWN 200809L /* We have POSIX timers. */ #define _POSIX_TIMERS 200809L /* The barrier functions are available. */ #define _POSIX_BARRIERS 200809L /* POSIX message queues are available. */ #define _POSIX_MESSAGE_PASSING 200809L /* Thread process-shared synchronization is supported. */ #define _POSIX_THREAD_PROCESS_SHARED 200809L /* The monotonic clock might be available. */ #define _POSIX_MONOTONIC_CLOCK 0 /* The clock selection interfaces are available. */ #define _POSIX_CLOCK_SELECTION 200809L /* Advisory information interfaces are available. */ #define _POSIX_ADVISORY_INFO 200809L /* IPv6 support is available. */ #define _POSIX_IPV6 200809L /* Raw socket support is available. */ #define _POSIX_RAW_SOCKETS 200809L /* We have at least one terminal. */ #define _POSIX2_CHAR_TERM 200809L /* Neither process nor thread sporadic server interfaces is available. */ #define _POSIX_SPORADIC_SERVER -1 #define _POSIX_THREAD_SPORADIC_SERVER -1 /* trace.h is not available. */ #define _POSIX_TRACE -1 #define _POSIX_TRACE_EVENT_FILTER -1 #define _POSIX_TRACE_INHERIT -1 #define _POSIX_TRACE_LOG -1 /* Typed memory objects are not available. */ #define _POSIX_TYPED_MEMORY_OBJECTS -1 /* Streams are not available. */ #define _XOPEN_STREAMS -1 #endif /* bits/posix_opt.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/fenvinline.h�����������������������������������������������������������������������������������0000644�����������������00000000276�14763166030�0010026 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* This file provides inline versions of floating-pint environment handling functions. If there were any. */ #ifndef __NO_MATH_INLINES /* Here is where the code would go. */ #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/mqueue2.h��������������������������������������������������������������������������������������0000644�����������������00000004155�14763166030�0007254 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Checking macros for mq functions. Copyright (C) 2007, 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _FCNTL_H # error "Never include <bits/mqueue2.h> directly; use <mqueue.h> instead." #endif /* Check that calls to mq_open with O_CREAT set have an appropriate third and fourth parameter. */ extern mqd_t mq_open (const char *__name, int __oflag, ...) __THROW __nonnull ((1)); extern mqd_t __mq_open_2 (const char *__name, int __oflag) __THROW __nonnull ((1)); extern mqd_t __REDIRECT_NTH (__mq_open_alias, (const char *__name, int __oflag, ...), mq_open) __nonnull ((1)); __errordecl (__mq_open_wrong_number_of_args, "mq_open can be called either with 2 or 4 arguments"); __errordecl (__mq_open_missing_mode_and_attr, "mq_open with O_CREAT in second argument needs 4 arguments"); __fortify_function mqd_t __NTH (mq_open (const char *__name, int __oflag, ...)) { if (__va_arg_pack_len () != 0 && __va_arg_pack_len () != 2) __mq_open_wrong_number_of_args (); if (__builtin_constant_p (__oflag)) { if ((__oflag & O_CREAT) != 0 && __va_arg_pack_len () == 0) { __mq_open_missing_mode_and_attr (); return __mq_open_2 (__name, __oflag); } return __mq_open_alias (__name, __oflag, __va_arg_pack ()); } if (__va_arg_pack_len () == 0) return __mq_open_2 (__name, __oflag); return __mq_open_alias (__name, __oflag, __va_arg_pack ()); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/statvfs.h��������������������������������������������������������������������������������������0000644�����������������00000006536�14763166030�0007370 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_STATVFS_H # error "Never include <bits/statvfs.h> directly; use <sys/statvfs.h> instead." #endif #include <bits/types.h> /* For __fsblkcnt_t and __fsfilcnt_t. */ #if (__WORDSIZE == 32 \ && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32)) #define _STATVFSBUF_F_UNUSED #endif struct statvfs { unsigned long int f_bsize; unsigned long int f_frsize; #ifndef __USE_FILE_OFFSET64 __fsblkcnt_t f_blocks; __fsblkcnt_t f_bfree; __fsblkcnt_t f_bavail; __fsfilcnt_t f_files; __fsfilcnt_t f_ffree; __fsfilcnt_t f_favail; #else __fsblkcnt64_t f_blocks; __fsblkcnt64_t f_bfree; __fsblkcnt64_t f_bavail; __fsfilcnt64_t f_files; __fsfilcnt64_t f_ffree; __fsfilcnt64_t f_favail; #endif unsigned long int f_fsid; #ifdef _STATVFSBUF_F_UNUSED int __f_unused; #endif unsigned long int f_flag; unsigned long int f_namemax; int __f_spare[6]; }; #ifdef __USE_LARGEFILE64 struct statvfs64 { unsigned long int f_bsize; unsigned long int f_frsize; __fsblkcnt64_t f_blocks; __fsblkcnt64_t f_bfree; __fsblkcnt64_t f_bavail; __fsfilcnt64_t f_files; __fsfilcnt64_t f_ffree; __fsfilcnt64_t f_favail; unsigned long int f_fsid; #ifdef _STATVFSBUF_F_UNUSED int __f_unused; #endif unsigned long int f_flag; unsigned long int f_namemax; int __f_spare[6]; }; #endif /* Definitions for the flag in `f_flag'. These definitions should be kept in sync with the definitions in <sys/mount.h>. */ enum { ST_RDONLY = 1, /* Mount read-only. */ #define ST_RDONLY ST_RDONLY ST_NOSUID = 2 /* Ignore suid and sgid bits. */ #define ST_NOSUID ST_NOSUID #ifdef __USE_GNU , ST_NODEV = 4, /* Disallow access to device special files. */ # define ST_NODEV ST_NODEV ST_NOEXEC = 8, /* Disallow program execution. */ # define ST_NOEXEC ST_NOEXEC ST_SYNCHRONOUS = 16, /* Writes are synced at once. */ # define ST_SYNCHRONOUS ST_SYNCHRONOUS ST_MANDLOCK = 64, /* Allow mandatory locks on an FS. */ # define ST_MANDLOCK ST_MANDLOCK ST_WRITE = 128, /* Write on file/directory/symlink. */ # define ST_WRITE ST_WRITE ST_APPEND = 256, /* Append-only file. */ # define ST_APPEND ST_APPEND ST_IMMUTABLE = 512, /* Immutable file. */ # define ST_IMMUTABLE ST_IMMUTABLE ST_NOATIME = 1024, /* Do not update access times. */ # define ST_NOATIME ST_NOATIME ST_NODIRATIME = 2048, /* Do not update directory access times. */ # define ST_NODIRATIME ST_NODIRATIME ST_RELATIME = 4096 /* Update atime relative to mtime/ctime. */ # define ST_RELATIME ST_RELATIME #endif /* Use GNU. */ }; ������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/inf.h������������������������������������������������������������������������������������������0000644�����������������00000002040�14763166030�0006434 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* `INFINITY' constant for IEEE 754 machines. Copyright (C) 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never use <bits/inf.h> directly; include <math.h> instead." #endif /* IEEE positive infinity. */ #if __GNUC_PREREQ(3,3) # define INFINITY (__builtin_inff()) #else # define INFINITY HUGE_VALF #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/shm.h������������������������������������������������������������������������������������������0000644�����������������00000006677�14763166030�0006473 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1995-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SHM_H # error "Never include <bits/shm.h> directly; use <sys/shm.h> instead." #endif #include <bits/types.h> /* Permission flag for shmget. */ #define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */ #define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */ /* Flags for `shmat'. */ #define SHM_RDONLY 010000 /* attach read-only else read-write */ #define SHM_RND 020000 /* round attach address to SHMLBA */ #define SHM_REMAP 040000 /* take-over region on attach */ #define SHM_EXEC 0100000 /* execution access */ /* Commands for `shmctl'. */ #define SHM_LOCK 11 /* lock segment (root only) */ #define SHM_UNLOCK 12 /* unlock segment (root only) */ __BEGIN_DECLS /* Segment low boundary address multiple. */ #define SHMLBA (__getpagesize ()) extern int __getpagesize (void) __THROW __attribute__ ((__const__)); /* Type to count number of attaches. */ typedef __syscall_ulong_t shmatt_t; /* Data structure describing a shared memory segment. */ struct shmid_ds { struct ipc_perm shm_perm; /* operation permission struct */ size_t shm_segsz; /* size of segment in bytes */ __time_t shm_atime; /* time of last shmat() */ #ifndef __x86_64__ unsigned long int __unused1; #endif __time_t shm_dtime; /* time of last shmdt() */ #ifndef __x86_64__ unsigned long int __unused2; #endif __time_t shm_ctime; /* time of last change by shmctl() */ #ifndef __x86_64__ unsigned long int __unused3; #endif __pid_t shm_cpid; /* pid of creator */ __pid_t shm_lpid; /* pid of last shmop */ shmatt_t shm_nattch; /* number of current attaches */ __syscall_ulong_t __unused4; __syscall_ulong_t __unused5; }; #ifdef __USE_MISC /* ipcs ctl commands */ # define SHM_STAT 13 # define SHM_INFO 14 # define SHM_STAT_ANY 15 /* shm_mode upper byte flags */ # define SHM_DEST 01000 /* segment will be destroyed on last detach */ # define SHM_LOCKED 02000 /* segment will not be swapped */ # define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */ # define SHM_NORESERVE 010000 /* don't check for reservations */ struct shminfo { __syscall_ulong_t shmmax; __syscall_ulong_t shmmin; __syscall_ulong_t shmmni; __syscall_ulong_t shmseg; __syscall_ulong_t shmall; __syscall_ulong_t __unused1; __syscall_ulong_t __unused2; __syscall_ulong_t __unused3; __syscall_ulong_t __unused4; }; struct shm_info { int used_ids; __syscall_ulong_t shm_tot; /* total allocated shm */ __syscall_ulong_t shm_rss; /* total resident shm */ __syscall_ulong_t shm_swp; /* total swapped shm */ __syscall_ulong_t swap_attempts; __syscall_ulong_t swap_successes; }; #endif /* __USE_MISC */ __END_DECLS �����������������������������������������������������������������bits/confname.h�������������������������������������������������������������������������������������0000644�����������������00000056307�14763166030�0007465 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* `sysconf', `pathconf', and `confstr' NAME values. Generic version. Copyright (C) 1993,1995-1998,2000,2001,2003,2004,2007,2009,2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _UNISTD_H # error "Never use <bits/confname.h> directly; include <unistd.h> instead." #endif /* Values for the NAME argument to `pathconf' and `fpathconf'. */ enum { _PC_LINK_MAX, #define _PC_LINK_MAX _PC_LINK_MAX _PC_MAX_CANON, #define _PC_MAX_CANON _PC_MAX_CANON _PC_MAX_INPUT, #define _PC_MAX_INPUT _PC_MAX_INPUT _PC_NAME_MAX, #define _PC_NAME_MAX _PC_NAME_MAX _PC_PATH_MAX, #define _PC_PATH_MAX _PC_PATH_MAX _PC_PIPE_BUF, #define _PC_PIPE_BUF _PC_PIPE_BUF _PC_CHOWN_RESTRICTED, #define _PC_CHOWN_RESTRICTED _PC_CHOWN_RESTRICTED _PC_NO_TRUNC, #define _PC_NO_TRUNC _PC_NO_TRUNC _PC_VDISABLE, #define _PC_VDISABLE _PC_VDISABLE _PC_SYNC_IO, #define _PC_SYNC_IO _PC_SYNC_IO _PC_ASYNC_IO, #define _PC_ASYNC_IO _PC_ASYNC_IO _PC_PRIO_IO, #define _PC_PRIO_IO _PC_PRIO_IO _PC_SOCK_MAXBUF, #define _PC_SOCK_MAXBUF _PC_SOCK_MAXBUF _PC_FILESIZEBITS, #define _PC_FILESIZEBITS _PC_FILESIZEBITS _PC_REC_INCR_XFER_SIZE, #define _PC_REC_INCR_XFER_SIZE _PC_REC_INCR_XFER_SIZE _PC_REC_MAX_XFER_SIZE, #define _PC_REC_MAX_XFER_SIZE _PC_REC_MAX_XFER_SIZE _PC_REC_MIN_XFER_SIZE, #define _PC_REC_MIN_XFER_SIZE _PC_REC_MIN_XFER_SIZE _PC_REC_XFER_ALIGN, #define _PC_REC_XFER_ALIGN _PC_REC_XFER_ALIGN _PC_ALLOC_SIZE_MIN, #define _PC_ALLOC_SIZE_MIN _PC_ALLOC_SIZE_MIN _PC_SYMLINK_MAX, #define _PC_SYMLINK_MAX _PC_SYMLINK_MAX _PC_2_SYMLINKS #define _PC_2_SYMLINKS _PC_2_SYMLINKS }; /* Values for the argument to `sysconf'. */ enum { _SC_ARG_MAX, #define _SC_ARG_MAX _SC_ARG_MAX _SC_CHILD_MAX, #define _SC_CHILD_MAX _SC_CHILD_MAX _SC_CLK_TCK, #define _SC_CLK_TCK _SC_CLK_TCK _SC_NGROUPS_MAX, #define _SC_NGROUPS_MAX _SC_NGROUPS_MAX _SC_OPEN_MAX, #define _SC_OPEN_MAX _SC_OPEN_MAX _SC_STREAM_MAX, #define _SC_STREAM_MAX _SC_STREAM_MAX _SC_TZNAME_MAX, #define _SC_TZNAME_MAX _SC_TZNAME_MAX _SC_JOB_CONTROL, #define _SC_JOB_CONTROL _SC_JOB_CONTROL _SC_SAVED_IDS, #define _SC_SAVED_IDS _SC_SAVED_IDS _SC_REALTIME_SIGNALS, #define _SC_REALTIME_SIGNALS _SC_REALTIME_SIGNALS _SC_PRIORITY_SCHEDULING, #define _SC_PRIORITY_SCHEDULING _SC_PRIORITY_SCHEDULING _SC_TIMERS, #define _SC_TIMERS _SC_TIMERS _SC_ASYNCHRONOUS_IO, #define _SC_ASYNCHRONOUS_IO _SC_ASYNCHRONOUS_IO _SC_PRIORITIZED_IO, #define _SC_PRIORITIZED_IO _SC_PRIORITIZED_IO _SC_SYNCHRONIZED_IO, #define _SC_SYNCHRONIZED_IO _SC_SYNCHRONIZED_IO _SC_FSYNC, #define _SC_FSYNC _SC_FSYNC _SC_MAPPED_FILES, #define _SC_MAPPED_FILES _SC_MAPPED_FILES _SC_MEMLOCK, #define _SC_MEMLOCK _SC_MEMLOCK _SC_MEMLOCK_RANGE, #define _SC_MEMLOCK_RANGE _SC_MEMLOCK_RANGE _SC_MEMORY_PROTECTION, #define _SC_MEMORY_PROTECTION _SC_MEMORY_PROTECTION _SC_MESSAGE_PASSING, #define _SC_MESSAGE_PASSING _SC_MESSAGE_PASSING _SC_SEMAPHORES, #define _SC_SEMAPHORES _SC_SEMAPHORES _SC_SHARED_MEMORY_OBJECTS, #define _SC_SHARED_MEMORY_OBJECTS _SC_SHARED_MEMORY_OBJECTS _SC_AIO_LISTIO_MAX, #define _SC_AIO_LISTIO_MAX _SC_AIO_LISTIO_MAX _SC_AIO_MAX, #define _SC_AIO_MAX _SC_AIO_MAX _SC_AIO_PRIO_DELTA_MAX, #define _SC_AIO_PRIO_DELTA_MAX _SC_AIO_PRIO_DELTA_MAX _SC_DELAYTIMER_MAX, #define _SC_DELAYTIMER_MAX _SC_DELAYTIMER_MAX _SC_MQ_OPEN_MAX, #define _SC_MQ_OPEN_MAX _SC_MQ_OPEN_MAX _SC_MQ_PRIO_MAX, #define _SC_MQ_PRIO_MAX _SC_MQ_PRIO_MAX _SC_VERSION, #define _SC_VERSION _SC_VERSION _SC_PAGESIZE, #define _SC_PAGESIZE _SC_PAGESIZE #define _SC_PAGE_SIZE _SC_PAGESIZE _SC_RTSIG_MAX, #define _SC_RTSIG_MAX _SC_RTSIG_MAX _SC_SEM_NSEMS_MAX, #define _SC_SEM_NSEMS_MAX _SC_SEM_NSEMS_MAX _SC_SEM_VALUE_MAX, #define _SC_SEM_VALUE_MAX _SC_SEM_VALUE_MAX _SC_SIGQUEUE_MAX, #define _SC_SIGQUEUE_MAX _SC_SIGQUEUE_MAX _SC_TIMER_MAX, #define _SC_TIMER_MAX _SC_TIMER_MAX /* Values for the argument to `sysconf' corresponding to _POSIX2_* symbols. */ _SC_BC_BASE_MAX, #define _SC_BC_BASE_MAX _SC_BC_BASE_MAX _SC_BC_DIM_MAX, #define _SC_BC_DIM_MAX _SC_BC_DIM_MAX _SC_BC_SCALE_MAX, #define _SC_BC_SCALE_MAX _SC_BC_SCALE_MAX _SC_BC_STRING_MAX, #define _SC_BC_STRING_MAX _SC_BC_STRING_MAX _SC_COLL_WEIGHTS_MAX, #define _SC_COLL_WEIGHTS_MAX _SC_COLL_WEIGHTS_MAX _SC_EQUIV_CLASS_MAX, #define _SC_EQUIV_CLASS_MAX _SC_EQUIV_CLASS_MAX _SC_EXPR_NEST_MAX, #define _SC_EXPR_NEST_MAX _SC_EXPR_NEST_MAX _SC_LINE_MAX, #define _SC_LINE_MAX _SC_LINE_MAX _SC_RE_DUP_MAX, #define _SC_RE_DUP_MAX _SC_RE_DUP_MAX _SC_CHARCLASS_NAME_MAX, #define _SC_CHARCLASS_NAME_MAX _SC_CHARCLASS_NAME_MAX _SC_2_VERSION, #define _SC_2_VERSION _SC_2_VERSION _SC_2_C_BIND, #define _SC_2_C_BIND _SC_2_C_BIND _SC_2_C_DEV, #define _SC_2_C_DEV _SC_2_C_DEV _SC_2_FORT_DEV, #define _SC_2_FORT_DEV _SC_2_FORT_DEV _SC_2_FORT_RUN, #define _SC_2_FORT_RUN _SC_2_FORT_RUN _SC_2_SW_DEV, #define _SC_2_SW_DEV _SC_2_SW_DEV _SC_2_LOCALEDEF, #define _SC_2_LOCALEDEF _SC_2_LOCALEDEF _SC_PII, #define _SC_PII _SC_PII _SC_PII_XTI, #define _SC_PII_XTI _SC_PII_XTI _SC_PII_SOCKET, #define _SC_PII_SOCKET _SC_PII_SOCKET _SC_PII_INTERNET, #define _SC_PII_INTERNET _SC_PII_INTERNET _SC_PII_OSI, #define _SC_PII_OSI _SC_PII_OSI _SC_POLL, #define _SC_POLL _SC_POLL _SC_SELECT, #define _SC_SELECT _SC_SELECT _SC_UIO_MAXIOV, #define _SC_UIO_MAXIOV _SC_UIO_MAXIOV _SC_IOV_MAX = _SC_UIO_MAXIOV, #define _SC_IOV_MAX _SC_IOV_MAX _SC_PII_INTERNET_STREAM, #define _SC_PII_INTERNET_STREAM _SC_PII_INTERNET_STREAM _SC_PII_INTERNET_DGRAM, #define _SC_PII_INTERNET_DGRAM _SC_PII_INTERNET_DGRAM _SC_PII_OSI_COTS, #define _SC_PII_OSI_COTS _SC_PII_OSI_COTS _SC_PII_OSI_CLTS, #define _SC_PII_OSI_CLTS _SC_PII_OSI_CLTS _SC_PII_OSI_M, #define _SC_PII_OSI_M _SC_PII_OSI_M _SC_T_IOV_MAX, #define _SC_T_IOV_MAX _SC_T_IOV_MAX /* Values according to POSIX 1003.1c (POSIX threads). */ _SC_THREADS, #define _SC_THREADS _SC_THREADS _SC_THREAD_SAFE_FUNCTIONS, #define _SC_THREAD_SAFE_FUNCTIONS _SC_THREAD_SAFE_FUNCTIONS _SC_GETGR_R_SIZE_MAX, #define _SC_GETGR_R_SIZE_MAX _SC_GETGR_R_SIZE_MAX _SC_GETPW_R_SIZE_MAX, #define _SC_GETPW_R_SIZE_MAX _SC_GETPW_R_SIZE_MAX _SC_LOGIN_NAME_MAX, #define _SC_LOGIN_NAME_MAX _SC_LOGIN_NAME_MAX _SC_TTY_NAME_MAX, #define _SC_TTY_NAME_MAX _SC_TTY_NAME_MAX _SC_THREAD_DESTRUCTOR_ITERATIONS, #define _SC_THREAD_DESTRUCTOR_ITERATIONS _SC_THREAD_DESTRUCTOR_ITERATIONS _SC_THREAD_KEYS_MAX, #define _SC_THREAD_KEYS_MAX _SC_THREAD_KEYS_MAX _SC_THREAD_STACK_MIN, #define _SC_THREAD_STACK_MIN _SC_THREAD_STACK_MIN _SC_THREAD_THREADS_MAX, #define _SC_THREAD_THREADS_MAX _SC_THREAD_THREADS_MAX _SC_THREAD_ATTR_STACKADDR, #define _SC_THREAD_ATTR_STACKADDR _SC_THREAD_ATTR_STACKADDR _SC_THREAD_ATTR_STACKSIZE, #define _SC_THREAD_ATTR_STACKSIZE _SC_THREAD_ATTR_STACKSIZE _SC_THREAD_PRIORITY_SCHEDULING, #define _SC_THREAD_PRIORITY_SCHEDULING _SC_THREAD_PRIORITY_SCHEDULING _SC_THREAD_PRIO_INHERIT, #define _SC_THREAD_PRIO_INHERIT _SC_THREAD_PRIO_INHERIT _SC_THREAD_PRIO_PROTECT, #define _SC_THREAD_PRIO_PROTECT _SC_THREAD_PRIO_PROTECT _SC_THREAD_PROCESS_SHARED, #define _SC_THREAD_PROCESS_SHARED _SC_THREAD_PROCESS_SHARED _SC_NPROCESSORS_CONF, #define _SC_NPROCESSORS_CONF _SC_NPROCESSORS_CONF _SC_NPROCESSORS_ONLN, #define _SC_NPROCESSORS_ONLN _SC_NPROCESSORS_ONLN _SC_PHYS_PAGES, #define _SC_PHYS_PAGES _SC_PHYS_PAGES _SC_AVPHYS_PAGES, #define _SC_AVPHYS_PAGES _SC_AVPHYS_PAGES _SC_ATEXIT_MAX, #define _SC_ATEXIT_MAX _SC_ATEXIT_MAX _SC_PASS_MAX, #define _SC_PASS_MAX _SC_PASS_MAX _SC_XOPEN_VERSION, #define _SC_XOPEN_VERSION _SC_XOPEN_VERSION _SC_XOPEN_XCU_VERSION, #define _SC_XOPEN_XCU_VERSION _SC_XOPEN_XCU_VERSION _SC_XOPEN_UNIX, #define _SC_XOPEN_UNIX _SC_XOPEN_UNIX _SC_XOPEN_CRYPT, #define _SC_XOPEN_CRYPT _SC_XOPEN_CRYPT _SC_XOPEN_ENH_I18N, #define _SC_XOPEN_ENH_I18N _SC_XOPEN_ENH_I18N _SC_XOPEN_SHM, #define _SC_XOPEN_SHM _SC_XOPEN_SHM _SC_2_CHAR_TERM, #define _SC_2_CHAR_TERM _SC_2_CHAR_TERM _SC_2_C_VERSION, #define _SC_2_C_VERSION _SC_2_C_VERSION _SC_2_UPE, #define _SC_2_UPE _SC_2_UPE _SC_XOPEN_XPG2, #define _SC_XOPEN_XPG2 _SC_XOPEN_XPG2 _SC_XOPEN_XPG3, #define _SC_XOPEN_XPG3 _SC_XOPEN_XPG3 _SC_XOPEN_XPG4, #define _SC_XOPEN_XPG4 _SC_XOPEN_XPG4 _SC_CHAR_BIT, #define _SC_CHAR_BIT _SC_CHAR_BIT _SC_CHAR_MAX, #define _SC_CHAR_MAX _SC_CHAR_MAX _SC_CHAR_MIN, #define _SC_CHAR_MIN _SC_CHAR_MIN _SC_INT_MAX, #define _SC_INT_MAX _SC_INT_MAX _SC_INT_MIN, #define _SC_INT_MIN _SC_INT_MIN _SC_LONG_BIT, #define _SC_LONG_BIT _SC_LONG_BIT _SC_WORD_BIT, #define _SC_WORD_BIT _SC_WORD_BIT _SC_MB_LEN_MAX, #define _SC_MB_LEN_MAX _SC_MB_LEN_MAX _SC_NZERO, #define _SC_NZERO _SC_NZERO _SC_SSIZE_MAX, #define _SC_SSIZE_MAX _SC_SSIZE_MAX _SC_SCHAR_MAX, #define _SC_SCHAR_MAX _SC_SCHAR_MAX _SC_SCHAR_MIN, #define _SC_SCHAR_MIN _SC_SCHAR_MIN _SC_SHRT_MAX, #define _SC_SHRT_MAX _SC_SHRT_MAX _SC_SHRT_MIN, #define _SC_SHRT_MIN _SC_SHRT_MIN _SC_UCHAR_MAX, #define _SC_UCHAR_MAX _SC_UCHAR_MAX _SC_UINT_MAX, #define _SC_UINT_MAX _SC_UINT_MAX _SC_ULONG_MAX, #define _SC_ULONG_MAX _SC_ULONG_MAX _SC_USHRT_MAX, #define _SC_USHRT_MAX _SC_USHRT_MAX _SC_NL_ARGMAX, #define _SC_NL_ARGMAX _SC_NL_ARGMAX _SC_NL_LANGMAX, #define _SC_NL_LANGMAX _SC_NL_LANGMAX _SC_NL_MSGMAX, #define _SC_NL_MSGMAX _SC_NL_MSGMAX _SC_NL_NMAX, #define _SC_NL_NMAX _SC_NL_NMAX _SC_NL_SETMAX, #define _SC_NL_SETMAX _SC_NL_SETMAX _SC_NL_TEXTMAX, #define _SC_NL_TEXTMAX _SC_NL_TEXTMAX _SC_XBS5_ILP32_OFF32, #define _SC_XBS5_ILP32_OFF32 _SC_XBS5_ILP32_OFF32 _SC_XBS5_ILP32_OFFBIG, #define _SC_XBS5_ILP32_OFFBIG _SC_XBS5_ILP32_OFFBIG _SC_XBS5_LP64_OFF64, #define _SC_XBS5_LP64_OFF64 _SC_XBS5_LP64_OFF64 _SC_XBS5_LPBIG_OFFBIG, #define _SC_XBS5_LPBIG_OFFBIG _SC_XBS5_LPBIG_OFFBIG _SC_XOPEN_LEGACY, #define _SC_XOPEN_LEGACY _SC_XOPEN_LEGACY _SC_XOPEN_REALTIME, #define _SC_XOPEN_REALTIME _SC_XOPEN_REALTIME _SC_XOPEN_REALTIME_THREADS, #define _SC_XOPEN_REALTIME_THREADS _SC_XOPEN_REALTIME_THREADS _SC_ADVISORY_INFO, #define _SC_ADVISORY_INFO _SC_ADVISORY_INFO _SC_BARRIERS, #define _SC_BARRIERS _SC_BARRIERS _SC_BASE, #define _SC_BASE _SC_BASE _SC_C_LANG_SUPPORT, #define _SC_C_LANG_SUPPORT _SC_C_LANG_SUPPORT _SC_C_LANG_SUPPORT_R, #define _SC_C_LANG_SUPPORT_R _SC_C_LANG_SUPPORT_R _SC_CLOCK_SELECTION, #define _SC_CLOCK_SELECTION _SC_CLOCK_SELECTION _SC_CPUTIME, #define _SC_CPUTIME _SC_CPUTIME _SC_THREAD_CPUTIME, #define _SC_THREAD_CPUTIME _SC_THREAD_CPUTIME _SC_DEVICE_IO, #define _SC_DEVICE_IO _SC_DEVICE_IO _SC_DEVICE_SPECIFIC, #define _SC_DEVICE_SPECIFIC _SC_DEVICE_SPECIFIC _SC_DEVICE_SPECIFIC_R, #define _SC_DEVICE_SPECIFIC_R _SC_DEVICE_SPECIFIC_R _SC_FD_MGMT, #define _SC_FD_MGMT _SC_FD_MGMT _SC_FIFO, #define _SC_FIFO _SC_FIFO _SC_PIPE, #define _SC_PIPE _SC_PIPE _SC_FILE_ATTRIBUTES, #define _SC_FILE_ATTRIBUTES _SC_FILE_ATTRIBUTES _SC_FILE_LOCKING, #define _SC_FILE_LOCKING _SC_FILE_LOCKING _SC_FILE_SYSTEM, #define _SC_FILE_SYSTEM _SC_FILE_SYSTEM _SC_MONOTONIC_CLOCK, #define _SC_MONOTONIC_CLOCK _SC_MONOTONIC_CLOCK _SC_MULTI_PROCESS, #define _SC_MULTI_PROCESS _SC_MULTI_PROCESS _SC_SINGLE_PROCESS, #define _SC_SINGLE_PROCESS _SC_SINGLE_PROCESS _SC_NETWORKING, #define _SC_NETWORKING _SC_NETWORKING _SC_READER_WRITER_LOCKS, #define _SC_READER_WRITER_LOCKS _SC_READER_WRITER_LOCKS _SC_SPIN_LOCKS, #define _SC_SPIN_LOCKS _SC_SPIN_LOCKS _SC_REGEXP, #define _SC_REGEXP _SC_REGEXP _SC_REGEX_VERSION, #define _SC_REGEX_VERSION _SC_REGEX_VERSION _SC_SHELL, #define _SC_SHELL _SC_SHELL _SC_SIGNALS, #define _SC_SIGNALS _SC_SIGNALS _SC_SPAWN, #define _SC_SPAWN _SC_SPAWN _SC_SPORADIC_SERVER, #define _SC_SPORADIC_SERVER _SC_SPORADIC_SERVER _SC_THREAD_SPORADIC_SERVER, #define _SC_THREAD_SPORADIC_SERVER _SC_THREAD_SPORADIC_SERVER _SC_SYSTEM_DATABASE, #define _SC_SYSTEM_DATABASE _SC_SYSTEM_DATABASE _SC_SYSTEM_DATABASE_R, #define _SC_SYSTEM_DATABASE_R _SC_SYSTEM_DATABASE_R _SC_TIMEOUTS, #define _SC_TIMEOUTS _SC_TIMEOUTS _SC_TYPED_MEMORY_OBJECTS, #define _SC_TYPED_MEMORY_OBJECTS _SC_TYPED_MEMORY_OBJECTS _SC_USER_GROUPS, #define _SC_USER_GROUPS _SC_USER_GROUPS _SC_USER_GROUPS_R, #define _SC_USER_GROUPS_R _SC_USER_GROUPS_R _SC_2_PBS, #define _SC_2_PBS _SC_2_PBS _SC_2_PBS_ACCOUNTING, #define _SC_2_PBS_ACCOUNTING _SC_2_PBS_ACCOUNTING _SC_2_PBS_LOCATE, #define _SC_2_PBS_LOCATE _SC_2_PBS_LOCATE _SC_2_PBS_MESSAGE, #define _SC_2_PBS_MESSAGE _SC_2_PBS_MESSAGE _SC_2_PBS_TRACK, #define _SC_2_PBS_TRACK _SC_2_PBS_TRACK _SC_SYMLOOP_MAX, #define _SC_SYMLOOP_MAX _SC_SYMLOOP_MAX _SC_STREAMS, #define _SC_STREAMS _SC_STREAMS _SC_2_PBS_CHECKPOINT, #define _SC_2_PBS_CHECKPOINT _SC_2_PBS_CHECKPOINT _SC_V6_ILP32_OFF32, #define _SC_V6_ILP32_OFF32 _SC_V6_ILP32_OFF32 _SC_V6_ILP32_OFFBIG, #define _SC_V6_ILP32_OFFBIG _SC_V6_ILP32_OFFBIG _SC_V6_LP64_OFF64, #define _SC_V6_LP64_OFF64 _SC_V6_LP64_OFF64 _SC_V6_LPBIG_OFFBIG, #define _SC_V6_LPBIG_OFFBIG _SC_V6_LPBIG_OFFBIG _SC_HOST_NAME_MAX, #define _SC_HOST_NAME_MAX _SC_HOST_NAME_MAX _SC_TRACE, #define _SC_TRACE _SC_TRACE _SC_TRACE_EVENT_FILTER, #define _SC_TRACE_EVENT_FILTER _SC_TRACE_EVENT_FILTER _SC_TRACE_INHERIT, #define _SC_TRACE_INHERIT _SC_TRACE_INHERIT _SC_TRACE_LOG, #define _SC_TRACE_LOG _SC_TRACE_LOG _SC_LEVEL1_ICACHE_SIZE, #define _SC_LEVEL1_ICACHE_SIZE _SC_LEVEL1_ICACHE_SIZE _SC_LEVEL1_ICACHE_ASSOC, #define _SC_LEVEL1_ICACHE_ASSOC _SC_LEVEL1_ICACHE_ASSOC _SC_LEVEL1_ICACHE_LINESIZE, #define _SC_LEVEL1_ICACHE_LINESIZE _SC_LEVEL1_ICACHE_LINESIZE _SC_LEVEL1_DCACHE_SIZE, #define _SC_LEVEL1_DCACHE_SIZE _SC_LEVEL1_DCACHE_SIZE _SC_LEVEL1_DCACHE_ASSOC, #define _SC_LEVEL1_DCACHE_ASSOC _SC_LEVEL1_DCACHE_ASSOC _SC_LEVEL1_DCACHE_LINESIZE, #define _SC_LEVEL1_DCACHE_LINESIZE _SC_LEVEL1_DCACHE_LINESIZE _SC_LEVEL2_CACHE_SIZE, #define _SC_LEVEL2_CACHE_SIZE _SC_LEVEL2_CACHE_SIZE _SC_LEVEL2_CACHE_ASSOC, #define _SC_LEVEL2_CACHE_ASSOC _SC_LEVEL2_CACHE_ASSOC _SC_LEVEL2_CACHE_LINESIZE, #define _SC_LEVEL2_CACHE_LINESIZE _SC_LEVEL2_CACHE_LINESIZE _SC_LEVEL3_CACHE_SIZE, #define _SC_LEVEL3_CACHE_SIZE _SC_LEVEL3_CACHE_SIZE _SC_LEVEL3_CACHE_ASSOC, #define _SC_LEVEL3_CACHE_ASSOC _SC_LEVEL3_CACHE_ASSOC _SC_LEVEL3_CACHE_LINESIZE, #define _SC_LEVEL3_CACHE_LINESIZE _SC_LEVEL3_CACHE_LINESIZE _SC_LEVEL4_CACHE_SIZE, #define _SC_LEVEL4_CACHE_SIZE _SC_LEVEL4_CACHE_SIZE _SC_LEVEL4_CACHE_ASSOC, #define _SC_LEVEL4_CACHE_ASSOC _SC_LEVEL4_CACHE_ASSOC _SC_LEVEL4_CACHE_LINESIZE, #define _SC_LEVEL4_CACHE_LINESIZE _SC_LEVEL4_CACHE_LINESIZE /* Leave room here, maybe we need a few more cache levels some day. */ _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, #define _SC_IPV6 _SC_IPV6 _SC_RAW_SOCKETS, #define _SC_RAW_SOCKETS _SC_RAW_SOCKETS _SC_V7_ILP32_OFF32, #define _SC_V7_ILP32_OFF32 _SC_V7_ILP32_OFF32 _SC_V7_ILP32_OFFBIG, #define _SC_V7_ILP32_OFFBIG _SC_V7_ILP32_OFFBIG _SC_V7_LP64_OFF64, #define _SC_V7_LP64_OFF64 _SC_V7_LP64_OFF64 _SC_V7_LPBIG_OFFBIG, #define _SC_V7_LPBIG_OFFBIG _SC_V7_LPBIG_OFFBIG _SC_SS_REPL_MAX, #define _SC_SS_REPL_MAX _SC_SS_REPL_MAX _SC_TRACE_EVENT_NAME_MAX, #define _SC_TRACE_EVENT_NAME_MAX _SC_TRACE_EVENT_NAME_MAX _SC_TRACE_NAME_MAX, #define _SC_TRACE_NAME_MAX _SC_TRACE_NAME_MAX _SC_TRACE_SYS_MAX, #define _SC_TRACE_SYS_MAX _SC_TRACE_SYS_MAX _SC_TRACE_USER_EVENT_MAX, #define _SC_TRACE_USER_EVENT_MAX _SC_TRACE_USER_EVENT_MAX _SC_XOPEN_STREAMS, #define _SC_XOPEN_STREAMS _SC_XOPEN_STREAMS _SC_THREAD_ROBUST_PRIO_INHERIT, #define _SC_THREAD_ROBUST_PRIO_INHERIT _SC_THREAD_ROBUST_PRIO_INHERIT _SC_THREAD_ROBUST_PRIO_PROTECT #define _SC_THREAD_ROBUST_PRIO_PROTECT _SC_THREAD_ROBUST_PRIO_PROTECT }; /* Values for the NAME argument to `confstr'. */ enum { _CS_PATH, /* The default search path. */ #define _CS_PATH _CS_PATH _CS_V6_WIDTH_RESTRICTED_ENVS, #define _CS_V6_WIDTH_RESTRICTED_ENVS _CS_V6_WIDTH_RESTRICTED_ENVS #define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS _CS_V6_WIDTH_RESTRICTED_ENVS _CS_GNU_LIBC_VERSION, #define _CS_GNU_LIBC_VERSION _CS_GNU_LIBC_VERSION _CS_GNU_LIBPTHREAD_VERSION, #define _CS_GNU_LIBPTHREAD_VERSION _CS_GNU_LIBPTHREAD_VERSION _CS_V5_WIDTH_RESTRICTED_ENVS, #define _CS_V5_WIDTH_RESTRICTED_ENVS _CS_V5_WIDTH_RESTRICTED_ENVS #define _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS _CS_V5_WIDTH_RESTRICTED_ENVS _CS_V7_WIDTH_RESTRICTED_ENVS, #define _CS_V7_WIDTH_RESTRICTED_ENVS _CS_V7_WIDTH_RESTRICTED_ENVS #define _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS _CS_V7_WIDTH_RESTRICTED_ENVS _CS_LFS_CFLAGS = 1000, #define _CS_LFS_CFLAGS _CS_LFS_CFLAGS _CS_LFS_LDFLAGS, #define _CS_LFS_LDFLAGS _CS_LFS_LDFLAGS _CS_LFS_LIBS, #define _CS_LFS_LIBS _CS_LFS_LIBS _CS_LFS_LINTFLAGS, #define _CS_LFS_LINTFLAGS _CS_LFS_LINTFLAGS _CS_LFS64_CFLAGS, #define _CS_LFS64_CFLAGS _CS_LFS64_CFLAGS _CS_LFS64_LDFLAGS, #define _CS_LFS64_LDFLAGS _CS_LFS64_LDFLAGS _CS_LFS64_LIBS, #define _CS_LFS64_LIBS _CS_LFS64_LIBS _CS_LFS64_LINTFLAGS, #define _CS_LFS64_LINTFLAGS _CS_LFS64_LINTFLAGS _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, #define _CS_XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS, #define _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LIBS, #define _CS_XBS5_ILP32_OFF32_LIBS _CS_XBS5_ILP32_OFF32_LIBS _CS_XBS5_ILP32_OFF32_LINTFLAGS, #define _CS_XBS5_ILP32_OFF32_LINTFLAGS _CS_XBS5_ILP32_OFF32_LINTFLAGS _CS_XBS5_ILP32_OFFBIG_CFLAGS, #define _CS_XBS5_ILP32_OFFBIG_CFLAGS _CS_XBS5_ILP32_OFFBIG_CFLAGS _CS_XBS5_ILP32_OFFBIG_LDFLAGS, #define _CS_XBS5_ILP32_OFFBIG_LDFLAGS _CS_XBS5_ILP32_OFFBIG_LDFLAGS _CS_XBS5_ILP32_OFFBIG_LIBS, #define _CS_XBS5_ILP32_OFFBIG_LIBS _CS_XBS5_ILP32_OFFBIG_LIBS _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, #define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS _CS_XBS5_ILP32_OFFBIG_LINTFLAGS _CS_XBS5_LP64_OFF64_CFLAGS, #define _CS_XBS5_LP64_OFF64_CFLAGS _CS_XBS5_LP64_OFF64_CFLAGS _CS_XBS5_LP64_OFF64_LDFLAGS, #define _CS_XBS5_LP64_OFF64_LDFLAGS _CS_XBS5_LP64_OFF64_LDFLAGS _CS_XBS5_LP64_OFF64_LIBS, #define _CS_XBS5_LP64_OFF64_LIBS _CS_XBS5_LP64_OFF64_LIBS _CS_XBS5_LP64_OFF64_LINTFLAGS, #define _CS_XBS5_LP64_OFF64_LINTFLAGS _CS_XBS5_LP64_OFF64_LINTFLAGS _CS_XBS5_LPBIG_OFFBIG_CFLAGS, #define _CS_XBS5_LPBIG_OFFBIG_CFLAGS _CS_XBS5_LPBIG_OFFBIG_CFLAGS _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, #define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS _CS_XBS5_LPBIG_OFFBIG_LDFLAGS _CS_XBS5_LPBIG_OFFBIG_LIBS, #define _CS_XBS5_LPBIG_OFFBIG_LIBS _CS_XBS5_LPBIG_OFFBIG_LIBS _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, #define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V6_ILP32_OFF32_CFLAGS, #define _CS_POSIX_V6_ILP32_OFF32_CFLAGS _CS_POSIX_V6_ILP32_OFF32_CFLAGS _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, #define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS _CS_POSIX_V6_ILP32_OFF32_LDFLAGS _CS_POSIX_V6_ILP32_OFF32_LIBS, #define _CS_POSIX_V6_ILP32_OFF32_LIBS _CS_POSIX_V6_ILP32_OFF32_LIBS _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, #define _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, #define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, #define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LIBS, #define _CS_POSIX_V6_ILP32_OFFBIG_LIBS _CS_POSIX_V6_ILP32_OFFBIG_LIBS _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, #define _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS _CS_POSIX_V6_LP64_OFF64_CFLAGS, #define _CS_POSIX_V6_LP64_OFF64_CFLAGS _CS_POSIX_V6_LP64_OFF64_CFLAGS _CS_POSIX_V6_LP64_OFF64_LDFLAGS, #define _CS_POSIX_V6_LP64_OFF64_LDFLAGS _CS_POSIX_V6_LP64_OFF64_LDFLAGS _CS_POSIX_V6_LP64_OFF64_LIBS, #define _CS_POSIX_V6_LP64_OFF64_LIBS _CS_POSIX_V6_LP64_OFF64_LIBS _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, #define _CS_POSIX_V6_LP64_OFF64_LINTFLAGS _CS_POSIX_V6_LP64_OFF64_LINTFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, #define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, #define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, #define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS _CS_POSIX_V6_LPBIG_OFFBIG_LIBS _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, #define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V7_ILP32_OFF32_CFLAGS, #define _CS_POSIX_V7_ILP32_OFF32_CFLAGS _CS_POSIX_V7_ILP32_OFF32_CFLAGS _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, #define _CS_POSIX_V7_ILP32_OFF32_LDFLAGS _CS_POSIX_V7_ILP32_OFF32_LDFLAGS _CS_POSIX_V7_ILP32_OFF32_LIBS, #define _CS_POSIX_V7_ILP32_OFF32_LIBS _CS_POSIX_V7_ILP32_OFF32_LIBS _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, #define _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, #define _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, #define _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V7_ILP32_OFFBIG_LIBS, #define _CS_POSIX_V7_ILP32_OFFBIG_LIBS _CS_POSIX_V7_ILP32_OFFBIG_LIBS _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, #define _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS _CS_POSIX_V7_LP64_OFF64_CFLAGS, #define _CS_POSIX_V7_LP64_OFF64_CFLAGS _CS_POSIX_V7_LP64_OFF64_CFLAGS _CS_POSIX_V7_LP64_OFF64_LDFLAGS, #define _CS_POSIX_V7_LP64_OFF64_LDFLAGS _CS_POSIX_V7_LP64_OFF64_LDFLAGS _CS_POSIX_V7_LP64_OFF64_LIBS, #define _CS_POSIX_V7_LP64_OFF64_LIBS _CS_POSIX_V7_LP64_OFF64_LIBS _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, #define _CS_POSIX_V7_LP64_OFF64_LINTFLAGS _CS_POSIX_V7_LP64_OFF64_LINTFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, #define _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, #define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, #define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS _CS_POSIX_V7_LPBIG_OFFBIG_LIBS _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, #define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS _CS_V6_ENV, #define _CS_V6_ENV _CS_V6_ENV _CS_V7_ENV #define _CS_V7_ENV _CS_V7_ENV }; �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/ustat.h����������������������������������������������������������������������������������������0000644�����������������00000002102�14763166030�0007017 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_USTAT_H # error "Never include <bits/ustat.h> directly; use <sys/ustat.h> instead." #endif #include <sys/types.h> struct ustat { __daddr_t f_tfree; /* Number of free blocks. */ __ino_t f_tinode; /* Number of free inodes. */ char f_fname[6]; char f_fpack[6]; }; ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/posix2_lim.h�����������������������������������������������������������������������������������0000644�����������������00000005505�14763166030�0007756 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991, 1996, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * Never include this file directly; include <limits.h> instead. */ #ifndef _BITS_POSIX2_LIM_H #define _BITS_POSIX2_LIM_H 1 /* The maximum `ibase' and `obase' values allowed by the `bc' utility. */ #define _POSIX2_BC_BASE_MAX 99 /* The maximum number of elements allowed in an array by the `bc' utility. */ #define _POSIX2_BC_DIM_MAX 2048 /* The maximum `scale' value allowed by the `bc' utility. */ #define _POSIX2_BC_SCALE_MAX 99 /* The maximum length of a string constant accepted by the `bc' utility. */ #define _POSIX2_BC_STRING_MAX 1000 /* The maximum number of weights that can be assigned to an entry of the LC_COLLATE `order' keyword in the locale definition file. */ #define _POSIX2_COLL_WEIGHTS_MAX 2 /* The maximum number of expressions that can be nested within parentheses by the `expr' utility. */ #define _POSIX2_EXPR_NEST_MAX 32 /* The maximum length, in bytes, of an input line. */ #define _POSIX2_LINE_MAX 2048 /* The maximum number of repeated occurrences of a regular expression permitted when using the interval notation `\{M,N\}'. */ #define _POSIX2_RE_DUP_MAX 255 /* The maximum number of bytes in a character class name. We have no fixed limit, 2048 is a high number. */ #define _POSIX2_CHARCLASS_NAME_MAX 14 /* These values are implementation-specific, and may vary within the implementation. Their precise values can be obtained from sysconf. */ #ifndef BC_BASE_MAX #define BC_BASE_MAX _POSIX2_BC_BASE_MAX #endif #ifndef BC_DIM_MAX #define BC_DIM_MAX _POSIX2_BC_DIM_MAX #endif #ifndef BC_SCALE_MAX #define BC_SCALE_MAX _POSIX2_BC_SCALE_MAX #endif #ifndef BC_STRING_MAX #define BC_STRING_MAX _POSIX2_BC_STRING_MAX #endif #ifndef COLL_WEIGHTS_MAX #define COLL_WEIGHTS_MAX 255 #endif #ifndef EXPR_NEST_MAX #define EXPR_NEST_MAX _POSIX2_EXPR_NEST_MAX #endif #ifndef LINE_MAX #define LINE_MAX _POSIX2_LINE_MAX #endif #ifndef CHARCLASS_NAME_MAX #define CHARCLASS_NAME_MAX 2048 #endif /* This value is defined like this in regex.h. */ #define RE_DUP_MAX (0x7fff) #endif /* bits/posix2_lim.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/stat.h�����������������������������������������������������������������������������������������0000644�����������������00000016731�14763166030�0006647 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1999-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #if !defined _SYS_STAT_H && !defined _FCNTL_H # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." #endif #ifndef _BITS_STAT_H #define _BITS_STAT_H 1 /* Versions of the `struct stat' data structure. */ #ifndef __x86_64__ # define _STAT_VER_LINUX_OLD 1 # define _STAT_VER_KERNEL 1 # define _STAT_VER_SVR4 2 # define _STAT_VER_LINUX 3 /* i386 versions of the `xmknod' interface. */ # define _MKNOD_VER_LINUX 1 # define _MKNOD_VER_SVR4 2 # define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ #else # define _STAT_VER_KERNEL 0 # define _STAT_VER_LINUX 1 /* x86-64 versions of the `xmknod' interface. */ # define _MKNOD_VER_LINUX 0 #endif #define _STAT_VER _STAT_VER_LINUX struct stat { __dev_t st_dev; /* Device. */ #ifndef __x86_64__ unsigned short int __pad1; #endif #if defined __x86_64__ || !defined __USE_FILE_OFFSET64 __ino_t st_ino; /* File serial number. */ #else __ino_t __st_ino; /* 32bit file serial number. */ #endif #ifndef __x86_64__ __mode_t st_mode; /* File mode. */ __nlink_t st_nlink; /* Link count. */ #else __nlink_t st_nlink; /* Link count. */ __mode_t st_mode; /* File mode. */ #endif __uid_t st_uid; /* User ID of the file's owner. */ __gid_t st_gid; /* Group ID of the file's group.*/ #ifdef __x86_64__ int __pad0; #endif __dev_t st_rdev; /* Device number, if device. */ #ifndef __x86_64__ unsigned short int __pad2; #endif #if defined __x86_64__ || !defined __USE_FILE_OFFSET64 __off_t st_size; /* Size of file, in bytes. */ #else __off64_t st_size; /* Size of file, in bytes. */ #endif __blksize_t st_blksize; /* Optimal block size for I/O. */ #if defined __x86_64__ || !defined __USE_FILE_OFFSET64 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ #else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ #endif #if defined __USE_MISC || defined __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the Unix namespace rules do not allow the identifier 'timespec' to appear in the <sys/stat.h> header. Therefore we have to handle the use of this header in strictly standard-compliant sources special. */ struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ # define st_atime st_atim.tv_sec /* Backward compatibility. */ # define st_mtime st_mtim.tv_sec # define st_ctime st_ctim.tv_sec #else __time_t st_atime; /* Time of last access. */ __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */ #endif #ifdef __x86_64__ __syscall_slong_t __unused[3]; #else # ifndef __USE_FILE_OFFSET64 unsigned long int __unused4; unsigned long int __unused5; # else __ino64_t st_ino; /* File serial number. */ # endif #endif }; #ifdef __USE_LARGEFILE64 /* Note stat64 has the same shape as stat for x86-64. */ struct stat64 { __dev_t st_dev; /* Device. */ # ifdef __x86_64__ __ino64_t st_ino; /* File serial number. */ __nlink_t st_nlink; /* Link count. */ __mode_t st_mode; /* File mode. */ # else unsigned int __pad1; __ino_t __st_ino; /* 32bit file serial number. */ __mode_t st_mode; /* File mode. */ __nlink_t st_nlink; /* Link count. */ # endif __uid_t st_uid; /* User ID of the file's owner. */ __gid_t st_gid; /* Group ID of the file's group.*/ # ifdef __x86_64__ int __pad0; __dev_t st_rdev; /* Device number, if device. */ __off_t st_size; /* Size of file, in bytes. */ # else __dev_t st_rdev; /* Device number, if device. */ unsigned int __pad2; __off64_t st_size; /* Size of file, in bytes. */ # endif __blksize_t st_blksize; /* Optimal block size for I/O. */ __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ # if defined __USE_MISC || defined __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the Unix namespace rules do not allow the identifier 'timespec' to appear in the <sys/stat.h> header. Therefore we have to handle the use of this header in strictly standard-compliant sources special. */ struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ # else __time_t st_atime; /* Time of last access. */ __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */ # endif # ifdef __x86_64__ __syscall_slong_t __unused[3]; # else __ino64_t st_ino; /* File serial number. */ # endif }; #endif /* Tell code we have these members. */ #define _STATBUF_ST_BLKSIZE #define _STATBUF_ST_RDEV /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC /* Encoding of the file mode. */ #define __S_IFMT 0170000 /* These bits determine file type. */ /* File types. */ #define __S_IFDIR 0040000 /* Directory. */ #define __S_IFCHR 0020000 /* Character device. */ #define __S_IFBLK 0060000 /* Block device. */ #define __S_IFREG 0100000 /* Regular file. */ #define __S_IFIFO 0010000 /* FIFO. */ #define __S_IFLNK 0120000 /* Symbolic link. */ #define __S_IFSOCK 0140000 /* Socket. */ /* POSIX.1b objects. Note that these macros always evaluate to zero. But they do it by enforcing the correct use of the macros. */ #define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) #define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) #define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) /* Protection bits. */ #define __S_ISUID 04000 /* Set user ID on execution. */ #define __S_ISGID 02000 /* Set group ID on execution. */ #define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ #define __S_IREAD 0400 /* Read by owner. */ #define __S_IWRITE 0200 /* Write by owner. */ #define __S_IEXEC 0100 /* Execute by owner. */ #ifdef __USE_ATFILE # define UTIME_NOW ((1l << 30) - 1l) # define UTIME_OMIT ((1l << 30) - 2l) #endif #endif /* bits/stat.h */ ���������������������������������������bits/locale.h���������������������������������������������������������������������������������������0000644�����������������00000002527�14763166030�0007131 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Definition of locale category symbol values. Copyright (C) 2001-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #if !defined _LOCALE_H && !defined _LANGINFO_H # error "Never use <bits/locale.h> directly; include <locale.h> instead." #endif #ifndef _BITS_LOCALE_H #define _BITS_LOCALE_H 1 #define __LC_CTYPE 0 #define __LC_NUMERIC 1 #define __LC_TIME 2 #define __LC_COLLATE 3 #define __LC_MONETARY 4 #define __LC_MESSAGES 5 #define __LC_ALL 6 #define __LC_PAPER 7 #define __LC_NAME 8 #define __LC_ADDRESS 9 #define __LC_TELEPHONE 10 #define __LC_MEASUREMENT 11 #define __LC_IDENTIFICATION 12 #endif /* bits/locale.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/syslog.h���������������������������������������������������������������������������������������0000644�����������������00000003240�14763166030�0007203 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Checking macros for syslog functions. Copyright (C) 2005, 2007, 2010, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SYSLOG_H # error "Never include <bits/syslog.h> directly; use <sys/syslog.h> instead." #endif extern void __syslog_chk (int __pri, int __flag, const char *__fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); #ifdef __va_arg_pack __fortify_function void syslog (int __pri, const char *__fmt, ...) { __syslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); } #elif !defined __cplusplus # define syslog(pri, ...) \ __syslog_chk (pri, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) #endif #ifdef __USE_BSD extern void __vsyslog_chk (int __pri, int __flag, const char *__fmt, __gnuc_va_list __ap) __attribute__ ((__format__ (__printf__, 3, 0))); __fortify_function void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap) { __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/mathcalls.h������������������������������������������������������������������������������������0000644�����������������00000026466�14763166030�0007652 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Prototype declarations for math functions; helper file for <math.h>. Copyright (C) 1996-2003, 2006, 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* NOTE: Because of the special way this file is used by <math.h>, this file must NOT be protected from multiple inclusion as header files usually are. This file provides prototype declarations for the math functions. Most functions are declared using the macro: __MATHCALL (NAME,[_r], (ARGS...)); This means there is a function `NAME' returning `double' and a function `NAMEf' returning `float'. Each place `_Mdouble_' appears in the prototype, that is actually `double' in the prototype for `NAME' and `float' in the prototype for `NAMEf'. Reentrant variant functions are called `NAME_r' and `NAMEf_r'. Functions returning other types like `int' are declared using the macro: __MATHDECL (TYPE, NAME,[_r], (ARGS...)); This is just like __MATHCALL but for a function returning `TYPE' instead of `_Mdouble_'. In all of these cases, there is still both a `NAME' and a `NAMEf' that takes `float' arguments. Note that there must be no whitespace before the argument passed for NAME, to make token pasting work with -traditional. */ #ifndef _MATH_H # error "Never include <bits/mathcalls.h> directly; include <math.h> instead." #endif /* Trigonometric functions. */ _Mdouble_BEGIN_NAMESPACE /* Arc cosine of X. */ __MATHCALL (acos,, (_Mdouble_ __x)); /* Arc sine of X. */ __MATHCALL (asin,, (_Mdouble_ __x)); /* Arc tangent of X. */ __MATHCALL (atan,, (_Mdouble_ __x)); /* Arc tangent of Y/X. */ __MATHCALL (atan2,, (_Mdouble_ __y, _Mdouble_ __x)); /* Cosine of X. */ __MATHCALL (cos,, (_Mdouble_ __x)); /* Sine of X. */ __MATHCALL (sin,, (_Mdouble_ __x)); /* Tangent of X. */ __MATHCALL (tan,, (_Mdouble_ __x)); /* Hyperbolic functions. */ /* Hyperbolic cosine of X. */ __MATHCALL (cosh,, (_Mdouble_ __x)); /* Hyperbolic sine of X. */ __MATHCALL (sinh,, (_Mdouble_ __x)); /* Hyperbolic tangent of X. */ __MATHCALL (tanh,, (_Mdouble_ __x)); _Mdouble_END_NAMESPACE #ifdef __USE_GNU /* Cosine and sine of X. */ __MATHDECL (void,sincos,, (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx)); #endif #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Hyperbolic arc cosine of X. */ __MATHCALL (acosh,, (_Mdouble_ __x)); /* Hyperbolic arc sine of X. */ __MATHCALL (asinh,, (_Mdouble_ __x)); /* Hyperbolic arc tangent of X. */ __MATHCALL (atanh,, (_Mdouble_ __x)); __END_NAMESPACE_C99 #endif /* Exponential and logarithmic functions. */ _Mdouble_BEGIN_NAMESPACE /* Exponential function of X. */ __MATHCALL (exp,, (_Mdouble_ __x)); /* Break VALUE into a normalized fraction and an integral power of 2. */ __MATHCALL (frexp,, (_Mdouble_ __x, int *__exponent)); /* X times (two to the EXP power). */ __MATHCALL (ldexp,, (_Mdouble_ __x, int __exponent)); /* Natural logarithm of X. */ __MATHCALL (log,, (_Mdouble_ __x)); /* Base-ten logarithm of X. */ __MATHCALL (log10,, (_Mdouble_ __x)); /* Break VALUE into integral and fractional parts. */ __MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)) __attribute__ ((__nonnull__ (2))); _Mdouble_END_NAMESPACE #ifdef __USE_GNU /* A function missing in all standards: compute exponent to base ten. */ __MATHCALL (exp10,, (_Mdouble_ __x)); /* Another name occasionally used. */ __MATHCALL (pow10,, (_Mdouble_ __x)); #endif #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Return exp(X) - 1. */ __MATHCALL (expm1,, (_Mdouble_ __x)); /* Return log(1 + X). */ __MATHCALL (log1p,, (_Mdouble_ __x)); /* Return the base 2 signed integral exponent of X. */ __MATHCALL (logb,, (_Mdouble_ __x)); __END_NAMESPACE_C99 #endif #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Compute base-2 exponential of X. */ __MATHCALL (exp2,, (_Mdouble_ __x)); /* Compute base-2 logarithm of X. */ __MATHCALL (log2,, (_Mdouble_ __x)); __END_NAMESPACE_C99 #endif /* Power functions. */ _Mdouble_BEGIN_NAMESPACE /* Return X to the Y power. */ __MATHCALL (pow,, (_Mdouble_ __x, _Mdouble_ __y)); /* Return the square root of X. */ __MATHCALL (sqrt,, (_Mdouble_ __x)); _Mdouble_END_NAMESPACE #if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Return `sqrt(X*X + Y*Y)'. */ __MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y)); __END_NAMESPACE_C99 #endif #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Return the cube root of X. */ __MATHCALL (cbrt,, (_Mdouble_ __x)); __END_NAMESPACE_C99 #endif /* Nearest integer, absolute value, and remainder functions. */ _Mdouble_BEGIN_NAMESPACE /* Smallest integral value not less than X. */ __MATHCALLX (ceil,, (_Mdouble_ __x), (__const__)); /* Absolute value of X. */ __MATHCALLX (fabs,, (_Mdouble_ __x), (__const__)); /* Largest integer not greater than X. */ __MATHCALLX (floor,, (_Mdouble_ __x), (__const__)); /* Floating-point modulo remainder of X/Y. */ __MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y)); /* Return 0 if VALUE is finite or NaN, +1 if it is +Infinity, -1 if it is -Infinity. */ __MATHDECL_1 (int,__isinf,, (_Mdouble_ __value)) __attribute__ ((__const__)); /* Return nonzero if VALUE is finite and not NaN. */ __MATHDECL_1 (int,__finite,, (_Mdouble_ __value)) __attribute__ ((__const__)); _Mdouble_END_NAMESPACE #ifdef __USE_MISC /* Return 0 if VALUE is finite or NaN, +1 if it is +Infinity, -1 if it is -Infinity. */ __MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__)); /* Return nonzero if VALUE is finite and not NaN. */ __MATHDECL_1 (int,finite,, (_Mdouble_ __value)) __attribute__ ((__const__)); /* Return the remainder of X/Y. */ __MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y)); /* Return the fractional part of X after dividing out `ilogb (X)'. */ __MATHCALL (significand,, (_Mdouble_ __x)); #endif /* Use misc. */ #if defined __USE_MISC || defined __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Return X with its signed changed to Y's. */ __MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); __END_NAMESPACE_C99 #endif #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Return representation of NaN for double type. */ __MATHCALLX (nan,, (const char *__tagb), (__const__)); __END_NAMESPACE_C99 #endif /* Return nonzero if VALUE is not a number. */ __MATHDECL_1 (int,__isnan,, (_Mdouble_ __value)) __attribute__ ((__const__)); #if defined __USE_MISC || defined __USE_XOPEN /* Return nonzero if VALUE is not a number. */ __MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__)); /* Bessel functions. */ __MATHCALL (j0,, (_Mdouble_)); __MATHCALL (j1,, (_Mdouble_)); __MATHCALL (jn,, (int, _Mdouble_)); __MATHCALL (y0,, (_Mdouble_)); __MATHCALL (y1,, (_Mdouble_)); __MATHCALL (yn,, (int, _Mdouble_)); #endif #if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Error and gamma functions. */ __MATHCALL (erf,, (_Mdouble_)); __MATHCALL (erfc,, (_Mdouble_)); __MATHCALL (lgamma,, (_Mdouble_)); __END_NAMESPACE_C99 #endif #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* True gamma function. */ __MATHCALL (tgamma,, (_Mdouble_)); __END_NAMESPACE_C99 #endif #if defined __USE_MISC || defined __USE_XOPEN /* Obsolete alias for `lgamma'. */ __MATHCALL (gamma,, (_Mdouble_)); #endif #ifdef __USE_MISC /* Reentrant version of lgamma. This function uses the global variable `signgam'. The reentrant version instead takes a pointer and stores the value through it. */ __MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp)); #endif #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 __BEGIN_NAMESPACE_C99 /* Return the integer nearest X in the direction of the prevailing rounding mode. */ __MATHCALL (rint,, (_Mdouble_ __x)); /* Return X + epsilon if X < Y, X - epsilon if X > Y. */ __MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); # if defined __USE_ISOC99 && !defined __LDBL_COMPAT __MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__)); # endif /* Return the remainder of integer divison X / Y with infinite precision. */ __MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y)); # if defined __USE_MISC || defined __USE_ISOC99 /* Return X times (2 to the Nth power). */ __MATHCALL (scalbn,, (_Mdouble_ __x, int __n)); # endif /* Return the binary exponent of X, which must be nonzero. */ __MATHDECL (int,ilogb,, (_Mdouble_ __x)); #endif #ifdef __USE_ISOC99 /* Return X times (2 to the Nth power). */ __MATHCALL (scalbln,, (_Mdouble_ __x, long int __n)); /* Round X to integral value in floating-point format using current rounding direction, but do not raise inexact exception. */ __MATHCALL (nearbyint,, (_Mdouble_ __x)); /* Round X to nearest integral value, rounding halfway cases away from zero. */ __MATHCALLX (round,, (_Mdouble_ __x), (__const__)); /* Round X to the integral value in floating-point format nearest but not larger in magnitude. */ __MATHCALLX (trunc,, (_Mdouble_ __x), (__const__)); /* Compute remainder of X and Y and put in *QUO a value with sign of x/y and magnitude congruent `mod 2^n' to the magnitude of the integral quotient x/y, with n >= 3. */ __MATHCALL (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo)); /* Conversion functions. */ /* Round X to nearest integral value according to current rounding direction. */ __MATHDECL (long int,lrint,, (_Mdouble_ __x)); __MATHDECL (long long int,llrint,, (_Mdouble_ __x)); /* Round X to nearest integral value, rounding halfway cases away from zero. */ __MATHDECL (long int,lround,, (_Mdouble_ __x)); __MATHDECL (long long int,llround,, (_Mdouble_ __x)); /* Return positive difference between X and Y. */ __MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y)); /* Return maximum numeric value from X and Y. */ __MATHCALLX (fmax,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); /* Return minimum numeric value from X and Y. */ __MATHCALLX (fmin,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); /* Classify given number. */ __MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value)) __attribute__ ((__const__)); /* Test for negative number. */ __MATHDECL_1 (int, __signbit,, (_Mdouble_ __value)) __attribute__ ((__const__)); /* Multiply-add function computed as a ternary operation. */ __MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z)); #endif /* Use ISO C99. */ #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 __END_NAMESPACE_C99 #endif #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED /* Return X times (2 to the Nth power). */ __MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n)); #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/xopen_lim.h������������������������������������������������������������������������������������0000644�����������������00000007272�14763166030�0007666 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * Never include this file directly; use <limits.h> instead. */ /* Additional definitions from X/Open Portability Guide, Issue 4, Version 2 System Interfaces and Headers, 4.16 <limits.h> Please note only the values which are not greater than the minimum stated in the standard document are listed. The `sysconf' functions should be used to obtain the actual value. */ #ifndef _XOPEN_LIM_H #define _XOPEN_LIM_H 1 #define __need_IOV_MAX #include <bits/stdio_lim.h> /* We do not provide fixed values for ARG_MAX Maximum length of argument to the `exec' function including environment data. ATEXIT_MAX Maximum number of functions that may be registered with `atexit'. CHILD_MAX Maximum number of simultaneous processes per real user ID. OPEN_MAX Maximum number of files that one process can have open at anyone time. PAGESIZE PAGE_SIZE Size of bytes of a page. PASS_MAX Maximum number of significant bytes in a password. We only provide a fixed limit for IOV_MAX Maximum number of `iovec' structures that one process has available for use with `readv' or writev'. if this is indeed fixed by the underlying system. */ /* Maximum number of `iovec' structures that one process has available for use with `readv' or writev'. */ #define _XOPEN_IOV_MAX _POSIX_UIO_MAXIOV /* Maximum value of `digit' in calls to the `printf' and `scanf' functions. We have no limit, so return a reasonable value. */ #define NL_ARGMAX _POSIX_ARG_MAX /* Maximum number of bytes in a `LANG' name. We have no limit. */ #define NL_LANGMAX _POSIX2_LINE_MAX /* Maximum message number. We have no limit. */ #define NL_MSGMAX INT_MAX /* Maximum number of bytes in N-to-1 collation mapping. We have no limit. */ #define NL_NMAX INT_MAX /* Maximum set number. We have no limit. */ #define NL_SETMAX INT_MAX /* Maximum number of bytes in a message. We have no limit. */ #define NL_TEXTMAX INT_MAX /* Default process priority. */ #define NZERO 20 /* Number of bits in a word of type `int'. */ #ifdef INT_MAX # if INT_MAX == 32767 # define WORD_BIT 16 # else # if INT_MAX == 2147483647 # define WORD_BIT 32 # else /* Safe assumption. */ # define WORD_BIT 64 # endif # endif #elif defined __INT_MAX__ # if __INT_MAX__ == 32767 # define WORD_BIT 16 # else # if __INT_MAX__ == 2147483647 # define WORD_BIT 32 # else /* Safe assumption. */ # define WORD_BIT 64 # endif # endif #else # define WORD_BIT 32 #endif /* Number of bits in a word of type `long int'. */ #ifdef LONG_MAX # if LONG_MAX == 2147483647 # define LONG_BIT 32 # else /* Safe assumption. */ # define LONG_BIT 64 # endif #elif defined __LONG_MAX__ # if __LONG_MAX__ == 2147483647 # define LONG_BIT 32 # else /* Safe assumption. */ # define LONG_BIT 64 # endif #else # include <bits/wordsize.h> # if __WORDSIZE == 64 # define LONG_BIT 64 # else # define LONG_BIT 32 # endif #endif #endif /* bits/xopen_lim.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/eventfd.h��������������������������������������������������������������������������������������0000644�����������������00000002150�14763166030�0007315 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2007-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_EVENTFD_H # error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead." #endif /* Flags for eventfd. */ enum { EFD_SEMAPHORE = 00000001, #define EFD_SEMAPHORE EFD_SEMAPHORE EFD_CLOEXEC = 02000000, #define EFD_CLOEXEC EFD_CLOEXEC EFD_NONBLOCK = 00004000 #define EFD_NONBLOCK EFD_NONBLOCK }; ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/wordsize.h�������������������������������������������������������������������������������������0000644�����������������00000000507�14763166030�0007534 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Determine the wordsize from the preprocessor defines. */ #if defined __x86_64__ && !defined __ILP32__ # define __WORDSIZE 64 #else # define __WORDSIZE 32 #endif #ifdef __x86_64__ # define __WORDSIZE_TIME64_COMPAT32 1 /* Both x86-64 and x32 use the 64-bit system call interface. */ # define __SYSCALL_WORDSIZE 64 #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/elfclass.h�������������������������������������������������������������������������������������0000644�����������������00000000652�14763166030�0007463 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* This file specifies the native word size of the machine, which indicates the ELF file class used for executables and shared objects on this machine. */ #ifndef _LINK_H # error "Never use <bits/elfclass.h> directly; include <link.h> instead." #endif #include <bits/wordsize.h> #define __ELF_NATIVE_CLASS __WORDSIZE /* The entries in the .hash table always have a size of 32 bits. */ typedef uint32_t Elf_Symndx; ��������������������������������������������������������������������������������������bits/stdlib-float.h���������������������������������������������������������������������������������0000644�����������������00000002177�14763166030�0010257 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Floating-point inline functions for stdlib.h. Copyright (C) 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _STDLIB_H # error "Never use <bits/stdlib-float.h> directly; include <stdlib.h> instead." #endif #ifdef __USE_EXTERN_INLINES __BEGIN_NAMESPACE_STD __extern_inline double __NTH (atof (const char *__nptr)) { return strtod (__nptr, (char **) NULL); } __END_NAMESPACE_STD #endif /* Optimizing and Inlining. */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/fcntl2.h���������������������������������������������������������������������������������������0000644�����������������00000012707�14763166030�0007063 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Checking macros for fcntl functions. Copyright (C) 2007, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _FCNTL_H # error "Never include <bits/fcntl2.h> directly; use <fcntl.h> instead." #endif /* Check that calls to open and openat with O_CREAT or O_TMPFILE set have an appropriate third/fourth parameter. */ #ifndef __USE_FILE_OFFSET64 extern int __open_2 (const char *__path, int __oflag) __nonnull ((1)); extern int __REDIRECT (__open_alias, (const char *__path, int __oflag, ...), open) __nonnull ((1)); #else extern int __REDIRECT (__open_2, (const char *__path, int __oflag), __open64_2) __nonnull ((1)); extern int __REDIRECT (__open_alias, (const char *__path, int __oflag, ...), open64) __nonnull ((1)); #endif __errordecl (__open_too_many_args, "open can be called either with 2 or 3 arguments, not more"); __errordecl (__open_missing_mode, "open with O_CREAT or O_TMPFILE in second argument needs 3 arguments"); __fortify_function int open (const char *__path, int __oflag, ...) { if (__va_arg_pack_len () > 1) __open_too_many_args (); if (__builtin_constant_p (__oflag)) { if (__OPEN_NEEDS_MODE (__oflag) && __va_arg_pack_len () < 1) { __open_missing_mode (); return __open_2 (__path, __oflag); } return __open_alias (__path, __oflag, __va_arg_pack ()); } if (__va_arg_pack_len () < 1) return __open_2 (__path, __oflag); return __open_alias (__path, __oflag, __va_arg_pack ()); } #ifdef __USE_LARGEFILE64 extern int __open64_2 (const char *__path, int __oflag) __nonnull ((1)); extern int __REDIRECT (__open64_alias, (const char *__path, int __oflag, ...), open64) __nonnull ((1)); __errordecl (__open64_too_many_args, "open64 can be called either with 2 or 3 arguments, not more"); __errordecl (__open64_missing_mode, "open64 with O_CREAT or O_TMPFILE in second argument needs 3 arguments"); __fortify_function int open64 (const char *__path, int __oflag, ...) { if (__va_arg_pack_len () > 1) __open64_too_many_args (); if (__builtin_constant_p (__oflag)) { if (__OPEN_NEEDS_MODE (__oflag) && __va_arg_pack_len () < 1) { __open64_missing_mode (); return __open64_2 (__path, __oflag); } return __open64_alias (__path, __oflag, __va_arg_pack ()); } if (__va_arg_pack_len () < 1) return __open64_2 (__path, __oflag); return __open64_alias (__path, __oflag, __va_arg_pack ()); } #endif #ifdef __USE_ATFILE # ifndef __USE_FILE_OFFSET64 extern int __openat_2 (int __fd, const char *__path, int __oflag) __nonnull ((2)); extern int __REDIRECT (__openat_alias, (int __fd, const char *__path, int __oflag, ...), openat) __nonnull ((2)); # else extern int __REDIRECT (__openat_2, (int __fd, const char *__path, int __oflag), __openat64_2) __nonnull ((2)); extern int __REDIRECT (__openat_alias, (int __fd, const char *__path, int __oflag, ...), openat64) __nonnull ((2)); # endif __errordecl (__openat_too_many_args, "openat can be called either with 3 or 4 arguments, not more"); __errordecl (__openat_missing_mode, "openat with O_CREAT or O_TMPFILE in third argument needs 4 arguments"); __fortify_function int openat (int __fd, const char *__path, int __oflag, ...) { if (__va_arg_pack_len () > 1) __openat_too_many_args (); if (__builtin_constant_p (__oflag)) { if (__OPEN_NEEDS_MODE (__oflag) && __va_arg_pack_len () < 1) { __openat_missing_mode (); return __openat_2 (__fd, __path, __oflag); } return __openat_alias (__fd, __path, __oflag, __va_arg_pack ()); } if (__va_arg_pack_len () < 1) return __openat_2 (__fd, __path, __oflag); return __openat_alias (__fd, __path, __oflag, __va_arg_pack ()); } # ifdef __USE_LARGEFILE64 extern int __openat64_2 (int __fd, const char *__path, int __oflag) __nonnull ((2)); extern int __REDIRECT (__openat64_alias, (int __fd, const char *__path, int __oflag, ...), openat64) __nonnull ((2)); __errordecl (__openat64_too_many_args, "openat64 can be called either with 3 or 4 arguments, not more"); __errordecl (__openat64_missing_mode, "openat64 with O_CREAT or O_TMPFILE in third argument needs 4 arguments"); __fortify_function int openat64 (int __fd, const char *__path, int __oflag, ...) { if (__va_arg_pack_len () > 1) __openat64_too_many_args (); if (__builtin_constant_p (__oflag)) { if (__OPEN_NEEDS_MODE (__oflag) && __va_arg_pack_len () < 1) { __openat64_missing_mode (); return __openat64_2 (__fd, __path, __oflag); } return __openat64_alias (__fd, __path, __oflag, __va_arg_pack ()); } if (__va_arg_pack_len () < 1) return __openat64_2 (__fd, __path, __oflag); return __openat64_alias (__fd, __path, __oflag, __va_arg_pack ()); } # endif #endif ���������������������������������������������������������bits/libc-lock.h������������������������������������������������������������������������������������0000644�����������������00000031054�14763166030�0007526 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* libc-internal interface for mutex locks. LinuxThreads version. Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _BITS_LIBC_LOCK_H #define _BITS_LIBC_LOCK_H 1 #include <pthread.h> /* Mutex type. */ #ifdef _IO_MTSAFE_IO typedef pthread_mutex_t __libc_lock_t; typedef struct { pthread_mutex_t mutex; } __libc_lock_recursive_t; # ifdef __USE_UNIX98 typedef pthread_rwlock_t __libc_rwlock_t; # else typedef struct __libc_rwlock_opaque__ __libc_rwlock_t; # endif typedef __libc_lock_recursive_t __rtld_lock_recursive_t; #else typedef struct __libc_lock_opaque__ __libc_lock_t; typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t; typedef struct __libc_rwlock_opaque__ __libc_rwlock_t; #endif /* Type for key to thread-specific data. */ typedef pthread_key_t __libc_key_t; /* Define a lock variable NAME with storage class CLASS. The lock must be initialized with __libc_lock_init before it can be used (or define it with __libc_lock_define_initialized, below). Use `extern' for CLASS to declare a lock defined in another module. In public structure definitions you must use a pointer to the lock structure (i.e., NAME begins with a `*'), because its storage size will not be known outside of libc. */ #define __libc_lock_define(CLASS,NAME) \ CLASS __libc_lock_t NAME; #define __libc_rwlock_define(CLASS,NAME) \ CLASS __libc_rwlock_t NAME; #define __libc_lock_define_recursive(CLASS,NAME) \ CLASS __libc_lock_recursive_t NAME; #define __rtld_lock_define_recursive(CLASS,NAME) \ CLASS __rtld_lock_recursive_t NAME; /* Define an initialized lock variable NAME with storage class CLASS. For the C library we take a deeper look at the initializer. For this implementation all fields are initialized to zero. Therefore we don't initialize the variable which allows putting it into the BSS section. (Except on PA-RISC and other odd architectures, where initialized locks must be set to one due to the lack of normal atomic operations.) */ #if __LT_SPINLOCK_INIT == 0 # define __libc_lock_define_initialized(CLASS,NAME) \ CLASS __libc_lock_t NAME; #else # define __libc_lock_define_initialized(CLASS,NAME) \ CLASS __libc_lock_t NAME = PTHREAD_MUTEX_INITIALIZER; #endif #define __libc_rwlock_define_initialized(CLASS,NAME) \ CLASS __libc_rwlock_t NAME = PTHREAD_RWLOCK_INITIALIZER; /* Define an initialized recursive lock variable NAME with storage class CLASS. */ #define __libc_lock_define_initialized_recursive(CLASS,NAME) \ CLASS __libc_lock_recursive_t NAME = _LIBC_LOCK_RECURSIVE_INITIALIZER; #define _LIBC_LOCK_RECURSIVE_INITIALIZER \ {PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP} #define __rtld_lock_define_initialized_recursive(CLASS,NAME) \ CLASS __rtld_lock_recursive_t NAME = _RTLD_LOCK_RECURSIVE_INITIALIZER; #define _RTLD_LOCK_RECURSIVE_INITIALIZER \ {PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP} #if defined __PIC__ # define __libc_maybe_call(FUNC, ARGS, ELSE) \ (__extension__ ({ __typeof (FUNC) *_fn = (FUNC); \ _fn != NULL ? (*_fn) ARGS : ELSE; })) #else # define __libc_maybe_call(FUNC, ARGS, ELSE) \ (FUNC != NULL ? FUNC ARGS : ELSE) #endif #define __libc_maybe_call2(FUNC, ARGS, ELSE) __libc_maybe_call (__##FUNC, ARGS, ELSE) /* Initialize the named lock variable, leaving it in a consistent, unlocked state. */ #define __libc_lock_init(NAME) \ (__libc_maybe_call2 (pthread_mutex_init, (&(NAME), NULL), 0)) #define __libc_rwlock_init(NAME) \ (__libc_maybe_call (__pthread_rwlock_init, (&(NAME), NULL), 0)); /* Same as last but this time we initialize a recursive mutex. */ #define __libc_lock_init_recursive(NAME) \ do { \ if (__pthread_mutex_init != NULL) \ { \ pthread_mutexattr_t __attr; \ __pthread_mutexattr_init (&__attr); \ __pthread_mutexattr_settype (&__attr, PTHREAD_MUTEX_RECURSIVE_NP); \ __pthread_mutex_init (&(NAME).mutex, &__attr); \ __pthread_mutexattr_destroy (&__attr); \ } \ } while (0); #define __rtld_lock_init_recursive(NAME) \ __libc_lock_init_recursive (NAME) /* Finalize the named lock variable, which must be locked. It cannot be used again until __libc_lock_init is called again on it. This must be called on a lock variable before the containing storage is reused. */ #define __libc_lock_fini(NAME) \ (__libc_maybe_call2 (pthread_mutex_destroy, (&(NAME)), 0)); #define __libc_rwlock_fini(NAME) \ (__libc_maybe_call (__pthread_rwlock_destroy, (&(NAME)), 0)); /* Finalize recursive named lock. */ #define __libc_lock_fini_recursive(NAME) __libc_lock_fini ((NAME).mutex) #define __rtld_lock_fini_recursive(NAME) __libc_lock_fini_recursive (NAME) /* Lock the named lock variable. */ #define __libc_lock_lock(NAME) \ (__libc_maybe_call2 (pthread_mutex_lock, (&(NAME)), 0)); #define __libc_rwlock_rdlock(NAME) \ (__libc_maybe_call (__pthread_rwlock_rdlock, (&(NAME)), 0)); #define __libc_rwlock_wrlock(NAME) \ (__libc_maybe_call (__pthread_rwlock_wrlock, (&(NAME)), 0)); /* Lock the recursive named lock variable. */ #define __libc_lock_lock_recursive(NAME) __libc_lock_lock ((NAME).mutex) /* Try to lock the named lock variable. */ #define __libc_lock_trylock(NAME) \ (__libc_maybe_call2 (pthread_mutex_trylock, (&(NAME)), 0)) #define __libc_rwlock_tryrdlock(NAME) \ (__libc_maybe_call (__pthread_rwlock_tryrdlock, (&(NAME)), 0)) #define __libc_rwlock_trywrlock(NAME) \ (__libc_maybe_call (__pthread_rwlock_trywrlock, (&(NAME)), 0)) /* Try to lock the recursive named lock variable. */ #define __libc_lock_trylock_recursive(NAME) __libc_lock_trylock ((NAME).mutex) #define __rtld_lock_trylock_recursive(NAME) \ __libc_lock_trylock_recursive (NAME) /* Unlock the named lock variable. */ #define __libc_lock_unlock(NAME) \ (__libc_maybe_call2 (pthread_mutex_unlock, (&(NAME)), 0)); #define __libc_rwlock_unlock(NAME) \ (__libc_maybe_call (__pthread_rwlock_unlock, (&(NAME)), 0)); /* Unlock the recursive named lock variable. */ #define __libc_lock_unlock_recursive(NAME) __libc_lock_unlock ((NAME).mutex) #define __rtld_lock_lock_recursive(NAME) __libc_lock_lock_recursive (NAME) #define __rtld_lock_unlock_recursive(NAME) __libc_lock_unlock_recursive (NAME) /* Define once control variable. */ #if PTHREAD_ONCE_INIT == 0 /* Special case for static variables where we can avoid the initialization if it is zero. */ # define __libc_once_define(CLASS, NAME) \ CLASS pthread_once_t NAME #else # define __libc_once_define(CLASS, NAME) \ CLASS pthread_once_t NAME = PTHREAD_ONCE_INIT #endif /* Call handler iff the first call. */ #define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \ do { \ if (__pthread_once != NULL) \ __pthread_once (&(ONCE_CONTROL), (INIT_FUNCTION)); \ else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) { \ INIT_FUNCTION (); \ (ONCE_CONTROL) = 2; \ } \ } while (0) /* Start critical region with cleanup. */ #define __libc_cleanup_region_start(DOIT, FCT, ARG) \ { struct _pthread_cleanup_buffer _buffer; \ int _avail = (DOIT) && _pthread_cleanup_push_defer != NULL; \ if (_avail) { \ _pthread_cleanup_push_defer (&_buffer, (FCT), (ARG)); \ } /* End critical region with cleanup. */ #define __libc_cleanup_region_end(DOIT) \ if (_avail) { \ _pthread_cleanup_pop_restore (&_buffer, (DOIT)); \ } \ } /* Sometimes we have to exit the block in the middle. */ #define __libc_cleanup_end(DOIT) \ if (_avail) { \ _pthread_cleanup_pop_restore (&_buffer, (DOIT)); \ } #define __libc_cleanup_push(fct, arg) \ { struct _pthread_cleanup_buffer _buffer; \ __libc_maybe_call (_pthread_cleanup_push, (&_buffer, (fct), (arg)), 0) #define __libc_cleanup_pop(execute) \ __libc_maybe_call (_pthread_cleanup_pop, (&_buffer, execute), 0); \ } /* Create thread-specific key. */ #define __libc_key_create(KEY, DESTRUCTOR) \ (__libc_maybe_call (__pthread_key_create, (KEY, DESTRUCTOR), 1)) /* Get thread-specific data. */ #define __libc_getspecific(KEY) \ (__libc_maybe_call (__pthread_getspecific, (KEY), NULL)) /* Set thread-specific data. */ #define __libc_setspecific(KEY, VALUE) \ (__libc_maybe_call (__pthread_setspecific, (KEY, VALUE), 0)) /* Register handlers to execute before and after `fork'. */ #define __libc_atfork(PREPARE, PARENT, CHILD) \ (__libc_maybe_call (__pthread_atfork, (PREPARE, PARENT, CHILD), 0)) __BEGIN_DECLS extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *__buffer, void (*__routine) (void *), void *__arg) __THROW; extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *__buffer, int __execute) __THROW; /* Functions that are used by this file and are internal to the GNU C library. */ extern int __pthread_mutex_init (pthread_mutex_t *__mutex, __const pthread_mutexattr_t *__mutex_attr); extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex); extern int __pthread_mutex_trylock (pthread_mutex_t *__mutex); extern int __pthread_mutex_lock (pthread_mutex_t *__mutex); extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex); extern int __pthread_mutexattr_init (pthread_mutexattr_t *__attr); extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *__attr); extern int __pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind); #ifdef __USE_UNIX98 extern int __pthread_rwlock_init (pthread_rwlock_t *__rwlock, __const pthread_rwlockattr_t *__attr); extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock); extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock); extern int __pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock); extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock); extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock); extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock); #endif extern int __pthread_key_create (pthread_key_t *__key, void (*__destr_function) (void *)); extern int __pthread_setspecific (pthread_key_t __key, __const void *__pointer); extern void *__pthread_getspecific (pthread_key_t __key); extern int __pthread_once (pthread_once_t *__once_control, void (*__init_routine) (void)); extern int __pthread_atfork (void (*__prepare) (void), void (*__parent) (void), void (*__child) (void)); __END_DECLS /* Make the pthread functions weak so that we can elide them from single-threaded processes. */ #ifndef __NO_WEAK_PTHREAD_ALIASES # pragma weak __pthread_mutex_init # pragma weak __pthread_mutex_destroy # pragma weak __pthread_mutex_lock # pragma weak __pthread_mutex_trylock # pragma weak __pthread_mutex_unlock # pragma weak __pthread_mutexattr_init # pragma weak __pthread_mutexattr_destroy # pragma weak __pthread_mutexattr_settype # pragma weak __pthread_rwlock_destroy # pragma weak __pthread_rwlock_rdlock # pragma weak __pthread_rwlock_tryrdlock # pragma weak __pthread_rwlock_wrlock # pragma weak __pthread_rwlock_trywrlock # pragma weak __pthread_rwlock_unlock # pragma weak __pthread_key_create # pragma weak __pthread_setspecific # pragma weak __pthread_getspecific # pragma weak __pthread_once # pragma weak __pthread_initialize # pragma weak __pthread_atfork # pragma weak _pthread_cleanup_push_defer # pragma weak _pthread_cleanup_pop_restore # pragma weak _pthread_cleanup_push # pragma weak _pthread_cleanup_pop #endif /* We need portable names for some functions. E.g., when they are used as argument to __libc_cleanup_region_start. */ #define __libc_mutex_unlock __pthread_mutex_unlock #endif /* bits/libc-lock.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/fenv.h�����������������������������������������������������������������������������������������0000644�����������������00000007700�14763166030�0006626 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _FENV_H # error "Never use <bits/fenv.h> directly; include <fenv.h> instead." #endif /* Define bits representing the exception. We use the bit positions of the appropriate bits in the FPU control word. */ enum { FE_INVALID = #define FE_INVALID 0x01 FE_INVALID, __FE_DENORM = 0x02, FE_DIVBYZERO = #define FE_DIVBYZERO 0x04 FE_DIVBYZERO, FE_OVERFLOW = #define FE_OVERFLOW 0x08 FE_OVERFLOW, FE_UNDERFLOW = #define FE_UNDERFLOW 0x10 FE_UNDERFLOW, FE_INEXACT = #define FE_INEXACT 0x20 FE_INEXACT }; #define FE_ALL_EXCEPT \ (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID) /* The ix87 FPU supports all of the four defined rounding modes. We use again the bit positions in the FPU control word as the values for the appropriate macros. */ enum { FE_TONEAREST = #define FE_TONEAREST 0 FE_TONEAREST, FE_DOWNWARD = #define FE_DOWNWARD 0x400 FE_DOWNWARD, FE_UPWARD = #define FE_UPWARD 0x800 FE_UPWARD, FE_TOWARDZERO = #define FE_TOWARDZERO 0xc00 FE_TOWARDZERO }; /* Type representing exception flags. */ typedef unsigned short int fexcept_t; /* Type representing floating-point environment. This structure corresponds to the layout of the block written by the `fstenv' instruction and has additional fields for the contents of the MXCSR register as written by the `stmxcsr' instruction. */ typedef struct { unsigned short int __control_word; unsigned short int __unused1; unsigned short int __status_word; unsigned short int __unused2; unsigned short int __tags; unsigned short int __unused3; unsigned int __eip; unsigned short int __cs_selector; unsigned int __opcode:11; unsigned int __unused4:5; unsigned int __data_offset; unsigned short int __data_selector; unsigned short int __unused5; #ifdef __x86_64__ unsigned int __mxcsr; #endif } fenv_t; /* If the default argument is used we use this value. */ #define FE_DFL_ENV ((const fenv_t *) -1) #ifdef __USE_GNU /* Floating-point environment where none of the exception is masked. */ # define FE_NOMASK_ENV ((const fenv_t *) -2) #endif #ifdef __USE_EXTERN_INLINES __BEGIN_DECLS /* Optimized versions. */ extern int __REDIRECT_NTH (__feraiseexcept_renamed, (int), feraiseexcept); __extern_inline int __NTH (feraiseexcept (int __excepts)) { if (__builtin_constant_p (__excepts) && (__excepts & ~(FE_INVALID | FE_DIVBYZERO)) == 0) { if ((FE_INVALID & __excepts) != 0) { /* One example of a invalid operation is 0.0 / 0.0. */ float __f = 0.0; # ifdef __SSE_MATH__ __asm__ __volatile__ ("divss %0, %0 " : : "x" (__f)); # else __asm__ __volatile__ ("fdiv %%st, %%st(0); fwait" : "=t" (__f) : "0" (__f)); # endif (void) &__f; } if ((FE_DIVBYZERO & __excepts) != 0) { float __f = 1.0; float __g = 0.0; # ifdef __SSE_MATH__ __asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g)); # else __asm__ __volatile__ ("fdivp %%st, %%st(1); fwait" : "=t" (__f) : "0" (__f), "u" (__g) : "st(1)"); # endif (void) &__f; } return 0; } return __feraiseexcept_renamed (__excepts); } __END_DECLS #endif ����������������������������������������������������������������bits/syscall.h��������������������������������������������������������������������������������������0000644�����������������00000126034�14763166030�0007344 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Generated at libc build time from syscall list. */ /* The system call list corresponds to kernel 5.4. */ #ifndef _SYSCALL_H # error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead." #endif #ifdef __NR_FAST_atomic_update # define SYS_FAST_atomic_update __NR_FAST_atomic_update #endif #ifdef __NR_FAST_cmpxchg # define SYS_FAST_cmpxchg __NR_FAST_cmpxchg #endif #ifdef __NR_FAST_cmpxchg64 # define SYS_FAST_cmpxchg64 __NR_FAST_cmpxchg64 #endif #ifdef __NR__llseek # define SYS__llseek __NR__llseek #endif #ifdef __NR__newselect # define SYS__newselect __NR__newselect #endif #ifdef __NR__sysctl # define SYS__sysctl __NR__sysctl #endif #ifdef __NR_accept # define SYS_accept __NR_accept #endif #ifdef __NR_accept4 # define SYS_accept4 __NR_accept4 #endif #ifdef __NR_access # define SYS_access __NR_access #endif #ifdef __NR_acct # define SYS_acct __NR_acct #endif #ifdef __NR_acl_get # define SYS_acl_get __NR_acl_get #endif #ifdef __NR_acl_set # define SYS_acl_set __NR_acl_set #endif #ifdef __NR_add_key # define SYS_add_key __NR_add_key #endif #ifdef __NR_adjtimex # define SYS_adjtimex __NR_adjtimex #endif #ifdef __NR_afs_syscall # define SYS_afs_syscall __NR_afs_syscall #endif #ifdef __NR_alarm # define SYS_alarm __NR_alarm #endif #ifdef __NR_alloc_hugepages # define SYS_alloc_hugepages __NR_alloc_hugepages #endif #ifdef __NR_arch_prctl # define SYS_arch_prctl __NR_arch_prctl #endif #ifdef __NR_arm_fadvise64_64 # define SYS_arm_fadvise64_64 __NR_arm_fadvise64_64 #endif #ifdef __NR_arm_sync_file_range # define SYS_arm_sync_file_range __NR_arm_sync_file_range #endif #ifdef __NR_atomic_barrier # define SYS_atomic_barrier __NR_atomic_barrier #endif #ifdef __NR_atomic_cmpxchg_32 # define SYS_atomic_cmpxchg_32 __NR_atomic_cmpxchg_32 #endif #ifdef __NR_attrctl # define SYS_attrctl __NR_attrctl #endif #ifdef __NR_bdflush # define SYS_bdflush __NR_bdflush #endif #ifdef __NR_bind # define SYS_bind __NR_bind #endif #ifdef __NR_bpf # define SYS_bpf __NR_bpf #endif #ifdef __NR_break # define SYS_break __NR_break #endif #ifdef __NR_breakpoint # define SYS_breakpoint __NR_breakpoint #endif #ifdef __NR_brk # define SYS_brk __NR_brk #endif #ifdef __NR_cachectl # define SYS_cachectl __NR_cachectl #endif #ifdef __NR_cacheflush # define SYS_cacheflush __NR_cacheflush #endif #ifdef __NR_capget # define SYS_capget __NR_capget #endif #ifdef __NR_capset # define SYS_capset __NR_capset #endif #ifdef __NR_chdir # define SYS_chdir __NR_chdir #endif #ifdef __NR_chmod # define SYS_chmod __NR_chmod #endif #ifdef __NR_chown # define SYS_chown __NR_chown #endif #ifdef __NR_chown32 # define SYS_chown32 __NR_chown32 #endif #ifdef __NR_chroot # define SYS_chroot __NR_chroot #endif #ifdef __NR_clock_adjtime # define SYS_clock_adjtime __NR_clock_adjtime #endif #ifdef __NR_clock_adjtime64 # define SYS_clock_adjtime64 __NR_clock_adjtime64 #endif #ifdef __NR_clock_getres # define SYS_clock_getres __NR_clock_getres #endif #ifdef __NR_clock_getres_time64 # define SYS_clock_getres_time64 __NR_clock_getres_time64 #endif #ifdef __NR_clock_gettime # define SYS_clock_gettime __NR_clock_gettime #endif #ifdef __NR_clock_gettime64 # define SYS_clock_gettime64 __NR_clock_gettime64 #endif #ifdef __NR_clock_nanosleep # define SYS_clock_nanosleep __NR_clock_nanosleep #endif #ifdef __NR_clock_nanosleep_time64 # define SYS_clock_nanosleep_time64 __NR_clock_nanosleep_time64 #endif #ifdef __NR_clock_settime # define SYS_clock_settime __NR_clock_settime #endif #ifdef __NR_clock_settime64 # define SYS_clock_settime64 __NR_clock_settime64 #endif #ifdef __NR_clone # define SYS_clone __NR_clone #endif #ifdef __NR_clone2 # define SYS_clone2 __NR_clone2 #endif #ifdef __NR_clone3 # define SYS_clone3 __NR_clone3 #endif #ifdef __NR_close # define SYS_close __NR_close #endif #ifdef __NR_cmpxchg_badaddr # define SYS_cmpxchg_badaddr __NR_cmpxchg_badaddr #endif #ifdef __NR_connect # define SYS_connect __NR_connect #endif #ifdef __NR_copy_file_range # define SYS_copy_file_range __NR_copy_file_range #endif #ifdef __NR_creat # define SYS_creat __NR_creat #endif #ifdef __NR_create_module # define SYS_create_module __NR_create_module #endif #ifdef __NR_delete_module # define SYS_delete_module __NR_delete_module #endif #ifdef __NR_dipc # define SYS_dipc __NR_dipc #endif #ifdef __NR_dup # define SYS_dup __NR_dup #endif #ifdef __NR_dup2 # define SYS_dup2 __NR_dup2 #endif #ifdef __NR_dup3 # define SYS_dup3 __NR_dup3 #endif #ifdef __NR_epoll_create # define SYS_epoll_create __NR_epoll_create #endif #ifdef __NR_epoll_create1 # define SYS_epoll_create1 __NR_epoll_create1 #endif #ifdef __NR_epoll_ctl # define SYS_epoll_ctl __NR_epoll_ctl #endif #ifdef __NR_epoll_ctl_old # define SYS_epoll_ctl_old __NR_epoll_ctl_old #endif #ifdef __NR_epoll_pwait # define SYS_epoll_pwait __NR_epoll_pwait #endif #ifdef __NR_epoll_wait # define SYS_epoll_wait __NR_epoll_wait #endif #ifdef __NR_epoll_wait_old # define SYS_epoll_wait_old __NR_epoll_wait_old #endif #ifdef __NR_eventfd # define SYS_eventfd __NR_eventfd #endif #ifdef __NR_eventfd2 # define SYS_eventfd2 __NR_eventfd2 #endif #ifdef __NR_exec_with_loader # define SYS_exec_with_loader __NR_exec_with_loader #endif #ifdef __NR_execv # define SYS_execv __NR_execv #endif #ifdef __NR_execve # define SYS_execve __NR_execve #endif #ifdef __NR_execveat # define SYS_execveat __NR_execveat #endif #ifdef __NR_exit # define SYS_exit __NR_exit #endif #ifdef __NR_exit_group # define SYS_exit_group __NR_exit_group #endif #ifdef __NR_faccessat # define SYS_faccessat __NR_faccessat #endif #ifdef __NR_fadvise64 # define SYS_fadvise64 __NR_fadvise64 #endif #ifdef __NR_fadvise64_64 # define SYS_fadvise64_64 __NR_fadvise64_64 #endif #ifdef __NR_fallocate # define SYS_fallocate __NR_fallocate #endif #ifdef __NR_fanotify_init # define SYS_fanotify_init __NR_fanotify_init #endif #ifdef __NR_fanotify_mark # define SYS_fanotify_mark __NR_fanotify_mark #endif #ifdef __NR_fchdir # define SYS_fchdir __NR_fchdir #endif #ifdef __NR_fchmod # define SYS_fchmod __NR_fchmod #endif #ifdef __NR_fchmodat # define SYS_fchmodat __NR_fchmodat #endif #ifdef __NR_fchown # define SYS_fchown __NR_fchown #endif #ifdef __NR_fchown32 # define SYS_fchown32 __NR_fchown32 #endif #ifdef __NR_fchownat # define SYS_fchownat __NR_fchownat #endif #ifdef __NR_fcntl # define SYS_fcntl __NR_fcntl #endif #ifdef __NR_fcntl64 # define SYS_fcntl64 __NR_fcntl64 #endif #ifdef __NR_fdatasync # define SYS_fdatasync __NR_fdatasync #endif #ifdef __NR_fgetxattr # define SYS_fgetxattr __NR_fgetxattr #endif #ifdef __NR_finit_module # define SYS_finit_module __NR_finit_module #endif #ifdef __NR_flistxattr # define SYS_flistxattr __NR_flistxattr #endif #ifdef __NR_flock # define SYS_flock __NR_flock #endif #ifdef __NR_fork # define SYS_fork __NR_fork #endif #ifdef __NR_fp_udfiex_crtl # define SYS_fp_udfiex_crtl __NR_fp_udfiex_crtl #endif #ifdef __NR_free_hugepages # define SYS_free_hugepages __NR_free_hugepages #endif #ifdef __NR_fremovexattr # define SYS_fremovexattr __NR_fremovexattr #endif #ifdef __NR_fsconfig # define SYS_fsconfig __NR_fsconfig #endif #ifdef __NR_fsetxattr # define SYS_fsetxattr __NR_fsetxattr #endif #ifdef __NR_fsmount # define SYS_fsmount __NR_fsmount #endif #ifdef __NR_fsopen # define SYS_fsopen __NR_fsopen #endif #ifdef __NR_fspick # define SYS_fspick __NR_fspick #endif #ifdef __NR_fstat # define SYS_fstat __NR_fstat #endif #ifdef __NR_fstat64 # define SYS_fstat64 __NR_fstat64 #endif #ifdef __NR_fstatat64 # define SYS_fstatat64 __NR_fstatat64 #endif #ifdef __NR_fstatfs # define SYS_fstatfs __NR_fstatfs #endif #ifdef __NR_fstatfs64 # define SYS_fstatfs64 __NR_fstatfs64 #endif #ifdef __NR_fsync # define SYS_fsync __NR_fsync #endif #ifdef __NR_ftime # define SYS_ftime __NR_ftime #endif #ifdef __NR_ftruncate # define SYS_ftruncate __NR_ftruncate #endif #ifdef __NR_ftruncate64 # define SYS_ftruncate64 __NR_ftruncate64 #endif #ifdef __NR_futex # define SYS_futex __NR_futex #endif #ifdef __NR_futex_time64 # define SYS_futex_time64 __NR_futex_time64 #endif #ifdef __NR_futimesat # define SYS_futimesat __NR_futimesat #endif #ifdef __NR_get_kernel_syms # define SYS_get_kernel_syms __NR_get_kernel_syms #endif #ifdef __NR_get_mempolicy # define SYS_get_mempolicy __NR_get_mempolicy #endif #ifdef __NR_get_robust_list # define SYS_get_robust_list __NR_get_robust_list #endif #ifdef __NR_get_thread_area # define SYS_get_thread_area __NR_get_thread_area #endif #ifdef __NR_get_tls # define SYS_get_tls __NR_get_tls #endif #ifdef __NR_getcpu # define SYS_getcpu __NR_getcpu #endif #ifdef __NR_getcwd # define SYS_getcwd __NR_getcwd #endif #ifdef __NR_getdents # define SYS_getdents __NR_getdents #endif #ifdef __NR_getdents64 # define SYS_getdents64 __NR_getdents64 #endif #ifdef __NR_getdomainname # define SYS_getdomainname __NR_getdomainname #endif #ifdef __NR_getdtablesize # define SYS_getdtablesize __NR_getdtablesize #endif #ifdef __NR_getegid # define SYS_getegid __NR_getegid #endif #ifdef __NR_getegid32 # define SYS_getegid32 __NR_getegid32 #endif #ifdef __NR_geteuid # define SYS_geteuid __NR_geteuid #endif #ifdef __NR_geteuid32 # define SYS_geteuid32 __NR_geteuid32 #endif #ifdef __NR_getgid # define SYS_getgid __NR_getgid #endif #ifdef __NR_getgid32 # define SYS_getgid32 __NR_getgid32 #endif #ifdef __NR_getgroups # define SYS_getgroups __NR_getgroups #endif #ifdef __NR_getgroups32 # define SYS_getgroups32 __NR_getgroups32 #endif #ifdef __NR_gethostname # define SYS_gethostname __NR_gethostname #endif #ifdef __NR_getitimer # define SYS_getitimer __NR_getitimer #endif #ifdef __NR_getpagesize # define SYS_getpagesize __NR_getpagesize #endif #ifdef __NR_getpeername # define SYS_getpeername __NR_getpeername #endif #ifdef __NR_getpgid # define SYS_getpgid __NR_getpgid #endif #ifdef __NR_getpgrp # define SYS_getpgrp __NR_getpgrp #endif #ifdef __NR_getpid # define SYS_getpid __NR_getpid #endif #ifdef __NR_getpmsg # define SYS_getpmsg __NR_getpmsg #endif #ifdef __NR_getppid # define SYS_getppid __NR_getppid #endif #ifdef __NR_getpriority # define SYS_getpriority __NR_getpriority #endif #ifdef __NR_getrandom # define SYS_getrandom __NR_getrandom #endif #ifdef __NR_getresgid # define SYS_getresgid __NR_getresgid #endif #ifdef __NR_getresgid32 # define SYS_getresgid32 __NR_getresgid32 #endif #ifdef __NR_getresuid # define SYS_getresuid __NR_getresuid #endif #ifdef __NR_getresuid32 # define SYS_getresuid32 __NR_getresuid32 #endif #ifdef __NR_getrlimit # define SYS_getrlimit __NR_getrlimit #endif #ifdef __NR_getrusage # define SYS_getrusage __NR_getrusage #endif #ifdef __NR_getsid # define SYS_getsid __NR_getsid #endif #ifdef __NR_getsockname # define SYS_getsockname __NR_getsockname #endif #ifdef __NR_getsockopt # define SYS_getsockopt __NR_getsockopt #endif #ifdef __NR_gettid # define SYS_gettid __NR_gettid #endif #ifdef __NR_gettimeofday # define SYS_gettimeofday __NR_gettimeofday #endif #ifdef __NR_getuid # define SYS_getuid __NR_getuid #endif #ifdef __NR_getuid32 # define SYS_getuid32 __NR_getuid32 #endif #ifdef __NR_getunwind # define SYS_getunwind __NR_getunwind #endif #ifdef __NR_getxattr # define SYS_getxattr __NR_getxattr #endif #ifdef __NR_getxgid # define SYS_getxgid __NR_getxgid #endif #ifdef __NR_getxpid # define SYS_getxpid __NR_getxpid #endif #ifdef __NR_getxuid # define SYS_getxuid __NR_getxuid #endif #ifdef __NR_gtty # define SYS_gtty __NR_gtty #endif #ifdef __NR_idle # define SYS_idle __NR_idle #endif #ifdef __NR_init_module # define SYS_init_module __NR_init_module #endif #ifdef __NR_inotify_add_watch # define SYS_inotify_add_watch __NR_inotify_add_watch #endif #ifdef __NR_inotify_init # define SYS_inotify_init __NR_inotify_init #endif #ifdef __NR_inotify_init1 # define SYS_inotify_init1 __NR_inotify_init1 #endif #ifdef __NR_inotify_rm_watch # define SYS_inotify_rm_watch __NR_inotify_rm_watch #endif #ifdef __NR_io_cancel # define SYS_io_cancel __NR_io_cancel #endif #ifdef __NR_io_destroy # define SYS_io_destroy __NR_io_destroy #endif #ifdef __NR_io_getevents # define SYS_io_getevents __NR_io_getevents #endif #ifdef __NR_io_pgetevents # define SYS_io_pgetevents __NR_io_pgetevents #endif #ifdef __NR_io_pgetevents_time64 # define SYS_io_pgetevents_time64 __NR_io_pgetevents_time64 #endif #ifdef __NR_io_setup # define SYS_io_setup __NR_io_setup #endif #ifdef __NR_io_submit # define SYS_io_submit __NR_io_submit #endif #ifdef __NR_io_uring_enter # define SYS_io_uring_enter __NR_io_uring_enter #endif #ifdef __NR_io_uring_register # define SYS_io_uring_register __NR_io_uring_register #endif #ifdef __NR_io_uring_setup # define SYS_io_uring_setup __NR_io_uring_setup #endif #ifdef __NR_ioctl # define SYS_ioctl __NR_ioctl #endif #ifdef __NR_ioperm # define SYS_ioperm __NR_ioperm #endif #ifdef __NR_iopl # define SYS_iopl __NR_iopl #endif #ifdef __NR_ioprio_get # define SYS_ioprio_get __NR_ioprio_get #endif #ifdef __NR_ioprio_set # define SYS_ioprio_set __NR_ioprio_set #endif #ifdef __NR_ipc # define SYS_ipc __NR_ipc #endif #ifdef __NR_kcmp # define SYS_kcmp __NR_kcmp #endif #ifdef __NR_kern_features # define SYS_kern_features __NR_kern_features #endif #ifdef __NR_kexec_file_load # define SYS_kexec_file_load __NR_kexec_file_load #endif #ifdef __NR_kexec_load # define SYS_kexec_load __NR_kexec_load #endif #ifdef __NR_keyctl # define SYS_keyctl __NR_keyctl #endif #ifdef __NR_kill # define SYS_kill __NR_kill #endif #ifdef __NR_lchown # define SYS_lchown __NR_lchown #endif #ifdef __NR_lchown32 # define SYS_lchown32 __NR_lchown32 #endif #ifdef __NR_lgetxattr # define SYS_lgetxattr __NR_lgetxattr #endif #ifdef __NR_link # define SYS_link __NR_link #endif #ifdef __NR_linkat # define SYS_linkat __NR_linkat #endif #ifdef __NR_listen # define SYS_listen __NR_listen #endif #ifdef __NR_listxattr # define SYS_listxattr __NR_listxattr #endif #ifdef __NR_llistxattr # define SYS_llistxattr __NR_llistxattr #endif #ifdef __NR_llseek # define SYS_llseek __NR_llseek #endif #ifdef __NR_lock # define SYS_lock __NR_lock #endif #ifdef __NR_lookup_dcookie # define SYS_lookup_dcookie __NR_lookup_dcookie #endif #ifdef __NR_lremovexattr # define SYS_lremovexattr __NR_lremovexattr #endif #ifdef __NR_lseek # define SYS_lseek __NR_lseek #endif #ifdef __NR_lsetxattr # define SYS_lsetxattr __NR_lsetxattr #endif #ifdef __NR_lstat # define SYS_lstat __NR_lstat #endif #ifdef __NR_lstat64 # define SYS_lstat64 __NR_lstat64 #endif #ifdef __NR_madvise # define SYS_madvise __NR_madvise #endif #ifdef __NR_mbind # define SYS_mbind __NR_mbind #endif #ifdef __NR_membarrier # define SYS_membarrier __NR_membarrier #endif #ifdef __NR_memfd_create # define SYS_memfd_create __NR_memfd_create #endif #ifdef __NR_memory_ordering # define SYS_memory_ordering __NR_memory_ordering #endif #ifdef __NR_migrate_pages # define SYS_migrate_pages __NR_migrate_pages #endif #ifdef __NR_mincore # define SYS_mincore __NR_mincore #endif #ifdef __NR_mkdir # define SYS_mkdir __NR_mkdir #endif #ifdef __NR_mkdirat # define SYS_mkdirat __NR_mkdirat #endif #ifdef __NR_mknod # define SYS_mknod __NR_mknod #endif #ifdef __NR_mknodat # define SYS_mknodat __NR_mknodat #endif #ifdef __NR_mlock # define SYS_mlock __NR_mlock #endif #ifdef __NR_mlock2 # define SYS_mlock2 __NR_mlock2 #endif #ifdef __NR_mlockall # define SYS_mlockall __NR_mlockall #endif #ifdef __NR_mmap # define SYS_mmap __NR_mmap #endif #ifdef __NR_mmap2 # define SYS_mmap2 __NR_mmap2 #endif #ifdef __NR_modify_ldt # define SYS_modify_ldt __NR_modify_ldt #endif #ifdef __NR_mount # define SYS_mount __NR_mount #endif #ifdef __NR_move_mount # define SYS_move_mount __NR_move_mount #endif #ifdef __NR_move_pages # define SYS_move_pages __NR_move_pages #endif #ifdef __NR_mprotect # define SYS_mprotect __NR_mprotect #endif #ifdef __NR_mpx # define SYS_mpx __NR_mpx #endif #ifdef __NR_mq_getsetattr # define SYS_mq_getsetattr __NR_mq_getsetattr #endif #ifdef __NR_mq_notify # define SYS_mq_notify __NR_mq_notify #endif #ifdef __NR_mq_open # define SYS_mq_open __NR_mq_open #endif #ifdef __NR_mq_timedreceive # define SYS_mq_timedreceive __NR_mq_timedreceive #endif #ifdef __NR_mq_timedreceive_time64 # define SYS_mq_timedreceive_time64 __NR_mq_timedreceive_time64 #endif #ifdef __NR_mq_timedsend # define SYS_mq_timedsend __NR_mq_timedsend #endif #ifdef __NR_mq_timedsend_time64 # define SYS_mq_timedsend_time64 __NR_mq_timedsend_time64 #endif #ifdef __NR_mq_unlink # define SYS_mq_unlink __NR_mq_unlink #endif #ifdef __NR_mremap # define SYS_mremap __NR_mremap #endif #ifdef __NR_msgctl # define SYS_msgctl __NR_msgctl #endif #ifdef __NR_msgget # define SYS_msgget __NR_msgget #endif #ifdef __NR_msgrcv # define SYS_msgrcv __NR_msgrcv #endif #ifdef __NR_msgsnd # define SYS_msgsnd __NR_msgsnd #endif #ifdef __NR_msync # define SYS_msync __NR_msync #endif #ifdef __NR_multiplexer # define SYS_multiplexer __NR_multiplexer #endif #ifdef __NR_munlock # define SYS_munlock __NR_munlock #endif #ifdef __NR_munlockall # define SYS_munlockall __NR_munlockall #endif #ifdef __NR_munmap # define SYS_munmap __NR_munmap #endif #ifdef __NR_name_to_handle_at # define SYS_name_to_handle_at __NR_name_to_handle_at #endif #ifdef __NR_nanosleep # define SYS_nanosleep __NR_nanosleep #endif #ifdef __NR_newfstatat # define SYS_newfstatat __NR_newfstatat #endif #ifdef __NR_nfsservctl # define SYS_nfsservctl __NR_nfsservctl #endif #ifdef __NR_ni_syscall # define SYS_ni_syscall __NR_ni_syscall #endif #ifdef __NR_nice # define SYS_nice __NR_nice #endif #ifdef __NR_old_adjtimex # define SYS_old_adjtimex __NR_old_adjtimex #endif #ifdef __NR_old_getpagesize # define SYS_old_getpagesize __NR_old_getpagesize #endif #ifdef __NR_oldfstat # define SYS_oldfstat __NR_oldfstat #endif #ifdef __NR_oldlstat # define SYS_oldlstat __NR_oldlstat #endif #ifdef __NR_oldolduname # define SYS_oldolduname __NR_oldolduname #endif #ifdef __NR_oldstat # define SYS_oldstat __NR_oldstat #endif #ifdef __NR_oldumount # define SYS_oldumount __NR_oldumount #endif #ifdef __NR_olduname # define SYS_olduname __NR_olduname #endif #ifdef __NR_open # define SYS_open __NR_open #endif #ifdef __NR_open_by_handle_at # define SYS_open_by_handle_at __NR_open_by_handle_at #endif #ifdef __NR_open_tree # define SYS_open_tree __NR_open_tree #endif #ifdef __NR_openat # define SYS_openat __NR_openat #endif #ifdef __NR_osf_adjtime # define SYS_osf_adjtime __NR_osf_adjtime #endif #ifdef __NR_osf_afs_syscall # define SYS_osf_afs_syscall __NR_osf_afs_syscall #endif #ifdef __NR_osf_alt_plock # define SYS_osf_alt_plock __NR_osf_alt_plock #endif #ifdef __NR_osf_alt_setsid # define SYS_osf_alt_setsid __NR_osf_alt_setsid #endif #ifdef __NR_osf_alt_sigpending # define SYS_osf_alt_sigpending __NR_osf_alt_sigpending #endif #ifdef __NR_osf_asynch_daemon # define SYS_osf_asynch_daemon __NR_osf_asynch_daemon #endif #ifdef __NR_osf_audcntl # define SYS_osf_audcntl __NR_osf_audcntl #endif #ifdef __NR_osf_audgen # define SYS_osf_audgen __NR_osf_audgen #endif #ifdef __NR_osf_chflags # define SYS_osf_chflags __NR_osf_chflags #endif #ifdef __NR_osf_execve # define SYS_osf_execve __NR_osf_execve #endif #ifdef __NR_osf_exportfs # define SYS_osf_exportfs __NR_osf_exportfs #endif #ifdef __NR_osf_fchflags # define SYS_osf_fchflags __NR_osf_fchflags #endif #ifdef __NR_osf_fdatasync # define SYS_osf_fdatasync __NR_osf_fdatasync #endif #ifdef __NR_osf_fpathconf # define SYS_osf_fpathconf __NR_osf_fpathconf #endif #ifdef __NR_osf_fstat # define SYS_osf_fstat __NR_osf_fstat #endif #ifdef __NR_osf_fstatfs # define SYS_osf_fstatfs __NR_osf_fstatfs #endif #ifdef __NR_osf_fstatfs64 # define SYS_osf_fstatfs64 __NR_osf_fstatfs64 #endif #ifdef __NR_osf_fuser # define SYS_osf_fuser __NR_osf_fuser #endif #ifdef __NR_osf_getaddressconf # define SYS_osf_getaddressconf __NR_osf_getaddressconf #endif #ifdef __NR_osf_getdirentries # define SYS_osf_getdirentries __NR_osf_getdirentries #endif #ifdef __NR_osf_getdomainname # define SYS_osf_getdomainname __NR_osf_getdomainname #endif #ifdef __NR_osf_getfh # define SYS_osf_getfh __NR_osf_getfh #endif #ifdef __NR_osf_getfsstat # define SYS_osf_getfsstat __NR_osf_getfsstat #endif #ifdef __NR_osf_gethostid # define SYS_osf_gethostid __NR_osf_gethostid #endif #ifdef __NR_osf_getitimer # define SYS_osf_getitimer __NR_osf_getitimer #endif #ifdef __NR_osf_getlogin # define SYS_osf_getlogin __NR_osf_getlogin #endif #ifdef __NR_osf_getmnt # define SYS_osf_getmnt __NR_osf_getmnt #endif #ifdef __NR_osf_getrusage # define SYS_osf_getrusage __NR_osf_getrusage #endif #ifdef __NR_osf_getsysinfo # define SYS_osf_getsysinfo __NR_osf_getsysinfo #endif #ifdef __NR_osf_gettimeofday # define SYS_osf_gettimeofday __NR_osf_gettimeofday #endif #ifdef __NR_osf_kloadcall # define SYS_osf_kloadcall __NR_osf_kloadcall #endif #ifdef __NR_osf_kmodcall # define SYS_osf_kmodcall __NR_osf_kmodcall #endif #ifdef __NR_osf_lstat # define SYS_osf_lstat __NR_osf_lstat #endif #ifdef __NR_osf_memcntl # define SYS_osf_memcntl __NR_osf_memcntl #endif #ifdef __NR_osf_mincore # define SYS_osf_mincore __NR_osf_mincore #endif #ifdef __NR_osf_mount # define SYS_osf_mount __NR_osf_mount #endif #ifdef __NR_osf_mremap # define SYS_osf_mremap __NR_osf_mremap #endif #ifdef __NR_osf_msfs_syscall # define SYS_osf_msfs_syscall __NR_osf_msfs_syscall #endif #ifdef __NR_osf_msleep # define SYS_osf_msleep __NR_osf_msleep #endif #ifdef __NR_osf_mvalid # define SYS_osf_mvalid __NR_osf_mvalid #endif #ifdef __NR_osf_mwakeup # define SYS_osf_mwakeup __NR_osf_mwakeup #endif #ifdef __NR_osf_naccept # define SYS_osf_naccept __NR_osf_naccept #endif #ifdef __NR_osf_nfssvc # define SYS_osf_nfssvc __NR_osf_nfssvc #endif #ifdef __NR_osf_ngetpeername # define SYS_osf_ngetpeername __NR_osf_ngetpeername #endif #ifdef __NR_osf_ngetsockname # define SYS_osf_ngetsockname __NR_osf_ngetsockname #endif #ifdef __NR_osf_nrecvfrom # define SYS_osf_nrecvfrom __NR_osf_nrecvfrom #endif #ifdef __NR_osf_nrecvmsg # define SYS_osf_nrecvmsg __NR_osf_nrecvmsg #endif #ifdef __NR_osf_nsendmsg # define SYS_osf_nsendmsg __NR_osf_nsendmsg #endif #ifdef __NR_osf_ntp_adjtime # define SYS_osf_ntp_adjtime __NR_osf_ntp_adjtime #endif #ifdef __NR_osf_ntp_gettime # define SYS_osf_ntp_gettime __NR_osf_ntp_gettime #endif #ifdef __NR_osf_old_creat # define SYS_osf_old_creat __NR_osf_old_creat #endif #ifdef __NR_osf_old_fstat # define SYS_osf_old_fstat __NR_osf_old_fstat #endif #ifdef __NR_osf_old_getpgrp # define SYS_osf_old_getpgrp __NR_osf_old_getpgrp #endif #ifdef __NR_osf_old_killpg # define SYS_osf_old_killpg __NR_osf_old_killpg #endif #ifdef __NR_osf_old_lstat # define SYS_osf_old_lstat __NR_osf_old_lstat #endif #ifdef __NR_osf_old_open # define SYS_osf_old_open __NR_osf_old_open #endif #ifdef __NR_osf_old_sigaction # define SYS_osf_old_sigaction __NR_osf_old_sigaction #endif #ifdef __NR_osf_old_sigblock # define SYS_osf_old_sigblock __NR_osf_old_sigblock #endif #ifdef __NR_osf_old_sigreturn # define SYS_osf_old_sigreturn __NR_osf_old_sigreturn #endif #ifdef __NR_osf_old_sigsetmask # define SYS_osf_old_sigsetmask __NR_osf_old_sigsetmask #endif #ifdef __NR_osf_old_sigvec # define SYS_osf_old_sigvec __NR_osf_old_sigvec #endif #ifdef __NR_osf_old_stat # define SYS_osf_old_stat __NR_osf_old_stat #endif #ifdef __NR_osf_old_vadvise # define SYS_osf_old_vadvise __NR_osf_old_vadvise #endif #ifdef __NR_osf_old_vtrace # define SYS_osf_old_vtrace __NR_osf_old_vtrace #endif #ifdef __NR_osf_old_wait # define SYS_osf_old_wait __NR_osf_old_wait #endif #ifdef __NR_osf_oldquota # define SYS_osf_oldquota __NR_osf_oldquota #endif #ifdef __NR_osf_pathconf # define SYS_osf_pathconf __NR_osf_pathconf #endif #ifdef __NR_osf_pid_block # define SYS_osf_pid_block __NR_osf_pid_block #endif #ifdef __NR_osf_pid_unblock # define SYS_osf_pid_unblock __NR_osf_pid_unblock #endif #ifdef __NR_osf_plock # define SYS_osf_plock __NR_osf_plock #endif #ifdef __NR_osf_priocntlset # define SYS_osf_priocntlset __NR_osf_priocntlset #endif #ifdef __NR_osf_profil # define SYS_osf_profil __NR_osf_profil #endif #ifdef __NR_osf_proplist_syscall # define SYS_osf_proplist_syscall __NR_osf_proplist_syscall #endif #ifdef __NR_osf_reboot # define SYS_osf_reboot __NR_osf_reboot #endif #ifdef __NR_osf_revoke # define SYS_osf_revoke __NR_osf_revoke #endif #ifdef __NR_osf_sbrk # define SYS_osf_sbrk __NR_osf_sbrk #endif #ifdef __NR_osf_security # define SYS_osf_security __NR_osf_security #endif #ifdef __NR_osf_select # define SYS_osf_select __NR_osf_select #endif #ifdef __NR_osf_set_program_attributes # define SYS_osf_set_program_attributes __NR_osf_set_program_attributes #endif #ifdef __NR_osf_set_speculative # define SYS_osf_set_speculative __NR_osf_set_speculative #endif #ifdef __NR_osf_sethostid # define SYS_osf_sethostid __NR_osf_sethostid #endif #ifdef __NR_osf_setitimer # define SYS_osf_setitimer __NR_osf_setitimer #endif #ifdef __NR_osf_setlogin # define SYS_osf_setlogin __NR_osf_setlogin #endif #ifdef __NR_osf_setsysinfo # define SYS_osf_setsysinfo __NR_osf_setsysinfo #endif #ifdef __NR_osf_settimeofday # define SYS_osf_settimeofday __NR_osf_settimeofday #endif #ifdef __NR_osf_shmat # define SYS_osf_shmat __NR_osf_shmat #endif #ifdef __NR_osf_signal # define SYS_osf_signal __NR_osf_signal #endif #ifdef __NR_osf_sigprocmask # define SYS_osf_sigprocmask __NR_osf_sigprocmask #endif #ifdef __NR_osf_sigsendset # define SYS_osf_sigsendset __NR_osf_sigsendset #endif #ifdef __NR_osf_sigstack # define SYS_osf_sigstack __NR_osf_sigstack #endif #ifdef __NR_osf_sigwaitprim # define SYS_osf_sigwaitprim __NR_osf_sigwaitprim #endif #ifdef __NR_osf_sstk # define SYS_osf_sstk __NR_osf_sstk #endif #ifdef __NR_osf_stat # define SYS_osf_stat __NR_osf_stat #endif #ifdef __NR_osf_statfs # define SYS_osf_statfs __NR_osf_statfs #endif #ifdef __NR_osf_statfs64 # define SYS_osf_statfs64 __NR_osf_statfs64 #endif #ifdef __NR_osf_subsys_info # define SYS_osf_subsys_info __NR_osf_subsys_info #endif #ifdef __NR_osf_swapctl # define SYS_osf_swapctl __NR_osf_swapctl #endif #ifdef __NR_osf_swapon # define SYS_osf_swapon __NR_osf_swapon #endif #ifdef __NR_osf_syscall # define SYS_osf_syscall __NR_osf_syscall #endif #ifdef __NR_osf_sysinfo # define SYS_osf_sysinfo __NR_osf_sysinfo #endif #ifdef __NR_osf_table # define SYS_osf_table __NR_osf_table #endif #ifdef __NR_osf_uadmin # define SYS_osf_uadmin __NR_osf_uadmin #endif #ifdef __NR_osf_usleep_thread # define SYS_osf_usleep_thread __NR_osf_usleep_thread #endif #ifdef __NR_osf_uswitch # define SYS_osf_uswitch __NR_osf_uswitch #endif #ifdef __NR_osf_utc_adjtime # define SYS_osf_utc_adjtime __NR_osf_utc_adjtime #endif #ifdef __NR_osf_utc_gettime # define SYS_osf_utc_gettime __NR_osf_utc_gettime #endif #ifdef __NR_osf_utimes # define SYS_osf_utimes __NR_osf_utimes #endif #ifdef __NR_osf_utsname # define SYS_osf_utsname __NR_osf_utsname #endif #ifdef __NR_osf_wait4 # define SYS_osf_wait4 __NR_osf_wait4 #endif #ifdef __NR_osf_waitid # define SYS_osf_waitid __NR_osf_waitid #endif #ifdef __NR_pause # define SYS_pause __NR_pause #endif #ifdef __NR_pciconfig_iobase # define SYS_pciconfig_iobase __NR_pciconfig_iobase #endif #ifdef __NR_pciconfig_read # define SYS_pciconfig_read __NR_pciconfig_read #endif #ifdef __NR_pciconfig_write # define SYS_pciconfig_write __NR_pciconfig_write #endif #ifdef __NR_perf_event_open # define SYS_perf_event_open __NR_perf_event_open #endif #ifdef __NR_perfctr # define SYS_perfctr __NR_perfctr #endif #ifdef __NR_perfmonctl # define SYS_perfmonctl __NR_perfmonctl #endif #ifdef __NR_personality # define SYS_personality __NR_personality #endif #ifdef __NR_pidfd_open # define SYS_pidfd_open __NR_pidfd_open #endif #ifdef __NR_pidfd_send_signal # define SYS_pidfd_send_signal __NR_pidfd_send_signal #endif #ifdef __NR_pipe # define SYS_pipe __NR_pipe #endif #ifdef __NR_pipe2 # define SYS_pipe2 __NR_pipe2 #endif #ifdef __NR_pivot_root # define SYS_pivot_root __NR_pivot_root #endif #ifdef __NR_pkey_alloc # define SYS_pkey_alloc __NR_pkey_alloc #endif #ifdef __NR_pkey_free # define SYS_pkey_free __NR_pkey_free #endif #ifdef __NR_pkey_mprotect # define SYS_pkey_mprotect __NR_pkey_mprotect #endif #ifdef __NR_poll # define SYS_poll __NR_poll #endif #ifdef __NR_ppoll # define SYS_ppoll __NR_ppoll #endif #ifdef __NR_ppoll_time64 # define SYS_ppoll_time64 __NR_ppoll_time64 #endif #ifdef __NR_prctl # define SYS_prctl __NR_prctl #endif #ifdef __NR_pread64 # define SYS_pread64 __NR_pread64 #endif #ifdef __NR_preadv # define SYS_preadv __NR_preadv #endif #ifdef __NR_preadv2 # define SYS_preadv2 __NR_preadv2 #endif #ifdef __NR_prlimit64 # define SYS_prlimit64 __NR_prlimit64 #endif #ifdef __NR_process_vm_readv # define SYS_process_vm_readv __NR_process_vm_readv #endif #ifdef __NR_process_vm_writev # define SYS_process_vm_writev __NR_process_vm_writev #endif #ifdef __NR_prof # define SYS_prof __NR_prof #endif #ifdef __NR_profil # define SYS_profil __NR_profil #endif #ifdef __NR_pselect6 # define SYS_pselect6 __NR_pselect6 #endif #ifdef __NR_pselect6_time64 # define SYS_pselect6_time64 __NR_pselect6_time64 #endif #ifdef __NR_ptrace # define SYS_ptrace __NR_ptrace #endif #ifdef __NR_putpmsg # define SYS_putpmsg __NR_putpmsg #endif #ifdef __NR_pwrite64 # define SYS_pwrite64 __NR_pwrite64 #endif #ifdef __NR_pwritev # define SYS_pwritev __NR_pwritev #endif #ifdef __NR_pwritev2 # define SYS_pwritev2 __NR_pwritev2 #endif #ifdef __NR_query_module # define SYS_query_module __NR_query_module #endif #ifdef __NR_quotactl # define SYS_quotactl __NR_quotactl #endif #ifdef __NR_read # define SYS_read __NR_read #endif #ifdef __NR_readahead # define SYS_readahead __NR_readahead #endif #ifdef __NR_readdir # define SYS_readdir __NR_readdir #endif #ifdef __NR_readlink # define SYS_readlink __NR_readlink #endif #ifdef __NR_readlinkat # define SYS_readlinkat __NR_readlinkat #endif #ifdef __NR_readv # define SYS_readv __NR_readv #endif #ifdef __NR_reboot # define SYS_reboot __NR_reboot #endif #ifdef __NR_recv # define SYS_recv __NR_recv #endif #ifdef __NR_recvfrom # define SYS_recvfrom __NR_recvfrom #endif #ifdef __NR_recvmmsg # define SYS_recvmmsg __NR_recvmmsg #endif #ifdef __NR_recvmmsg_time64 # define SYS_recvmmsg_time64 __NR_recvmmsg_time64 #endif #ifdef __NR_recvmsg # define SYS_recvmsg __NR_recvmsg #endif #ifdef __NR_remap_file_pages # define SYS_remap_file_pages __NR_remap_file_pages #endif #ifdef __NR_removexattr # define SYS_removexattr __NR_removexattr #endif #ifdef __NR_rename # define SYS_rename __NR_rename #endif #ifdef __NR_renameat # define SYS_renameat __NR_renameat #endif #ifdef __NR_renameat2 # define SYS_renameat2 __NR_renameat2 #endif #ifdef __NR_request_key # define SYS_request_key __NR_request_key #endif #ifdef __NR_restart_syscall # define SYS_restart_syscall __NR_restart_syscall #endif #ifdef __NR_riscv_flush_icache # define SYS_riscv_flush_icache __NR_riscv_flush_icache #endif #ifdef __NR_rmdir # define SYS_rmdir __NR_rmdir #endif #ifdef __NR_rseq # define SYS_rseq __NR_rseq #endif #ifdef __NR_rt_sigaction # define SYS_rt_sigaction __NR_rt_sigaction #endif #ifdef __NR_rt_sigpending # define SYS_rt_sigpending __NR_rt_sigpending #endif #ifdef __NR_rt_sigprocmask # define SYS_rt_sigprocmask __NR_rt_sigprocmask #endif #ifdef __NR_rt_sigqueueinfo # define SYS_rt_sigqueueinfo __NR_rt_sigqueueinfo #endif #ifdef __NR_rt_sigreturn # define SYS_rt_sigreturn __NR_rt_sigreturn #endif #ifdef __NR_rt_sigsuspend # define SYS_rt_sigsuspend __NR_rt_sigsuspend #endif #ifdef __NR_rt_sigtimedwait # define SYS_rt_sigtimedwait __NR_rt_sigtimedwait #endif #ifdef __NR_rt_sigtimedwait_time64 # define SYS_rt_sigtimedwait_time64 __NR_rt_sigtimedwait_time64 #endif #ifdef __NR_rt_tgsigqueueinfo # define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo #endif #ifdef __NR_rtas # define SYS_rtas __NR_rtas #endif #ifdef __NR_s390_guarded_storage # define SYS_s390_guarded_storage __NR_s390_guarded_storage #endif #ifdef __NR_s390_pci_mmio_read # define SYS_s390_pci_mmio_read __NR_s390_pci_mmio_read #endif #ifdef __NR_s390_pci_mmio_write # define SYS_s390_pci_mmio_write __NR_s390_pci_mmio_write #endif #ifdef __NR_s390_runtime_instr # define SYS_s390_runtime_instr __NR_s390_runtime_instr #endif #ifdef __NR_s390_sthyi # define SYS_s390_sthyi __NR_s390_sthyi #endif #ifdef __NR_sched_get_affinity # define SYS_sched_get_affinity __NR_sched_get_affinity #endif #ifdef __NR_sched_get_priority_max # define SYS_sched_get_priority_max __NR_sched_get_priority_max #endif #ifdef __NR_sched_get_priority_min # define SYS_sched_get_priority_min __NR_sched_get_priority_min #endif #ifdef __NR_sched_getaffinity # define SYS_sched_getaffinity __NR_sched_getaffinity #endif #ifdef __NR_sched_getattr # define SYS_sched_getattr __NR_sched_getattr #endif #ifdef __NR_sched_getparam # define SYS_sched_getparam __NR_sched_getparam #endif #ifdef __NR_sched_getscheduler # define SYS_sched_getscheduler __NR_sched_getscheduler #endif #ifdef __NR_sched_rr_get_interval # define SYS_sched_rr_get_interval __NR_sched_rr_get_interval #endif #ifdef __NR_sched_rr_get_interval_time64 # define SYS_sched_rr_get_interval_time64 __NR_sched_rr_get_interval_time64 #endif #ifdef __NR_sched_set_affinity # define SYS_sched_set_affinity __NR_sched_set_affinity #endif #ifdef __NR_sched_setaffinity # define SYS_sched_setaffinity __NR_sched_setaffinity #endif #ifdef __NR_sched_setattr # define SYS_sched_setattr __NR_sched_setattr #endif #ifdef __NR_sched_setparam # define SYS_sched_setparam __NR_sched_setparam #endif #ifdef __NR_sched_setscheduler # define SYS_sched_setscheduler __NR_sched_setscheduler #endif #ifdef __NR_sched_yield # define SYS_sched_yield __NR_sched_yield #endif #ifdef __NR_seccomp # define SYS_seccomp __NR_seccomp #endif #ifdef __NR_security # define SYS_security __NR_security #endif #ifdef __NR_select # define SYS_select __NR_select #endif #ifdef __NR_semctl # define SYS_semctl __NR_semctl #endif #ifdef __NR_semget # define SYS_semget __NR_semget #endif #ifdef __NR_semop # define SYS_semop __NR_semop #endif #ifdef __NR_semtimedop # define SYS_semtimedop __NR_semtimedop #endif #ifdef __NR_semtimedop_time64 # define SYS_semtimedop_time64 __NR_semtimedop_time64 #endif #ifdef __NR_send # define SYS_send __NR_send #endif #ifdef __NR_sendfile # define SYS_sendfile __NR_sendfile #endif #ifdef __NR_sendfile64 # define SYS_sendfile64 __NR_sendfile64 #endif #ifdef __NR_sendmmsg # define SYS_sendmmsg __NR_sendmmsg #endif #ifdef __NR_sendmsg # define SYS_sendmsg __NR_sendmsg #endif #ifdef __NR_sendto # define SYS_sendto __NR_sendto #endif #ifdef __NR_set_mempolicy # define SYS_set_mempolicy __NR_set_mempolicy #endif #ifdef __NR_set_robust_list # define SYS_set_robust_list __NR_set_robust_list #endif #ifdef __NR_set_thread_area # define SYS_set_thread_area __NR_set_thread_area #endif #ifdef __NR_set_tid_address # define SYS_set_tid_address __NR_set_tid_address #endif #ifdef __NR_set_tls # define SYS_set_tls __NR_set_tls #endif #ifdef __NR_setdomainname # define SYS_setdomainname __NR_setdomainname #endif #ifdef __NR_setfsgid # define SYS_setfsgid __NR_setfsgid #endif #ifdef __NR_setfsgid32 # define SYS_setfsgid32 __NR_setfsgid32 #endif #ifdef __NR_setfsuid # define SYS_setfsuid __NR_setfsuid #endif #ifdef __NR_setfsuid32 # define SYS_setfsuid32 __NR_setfsuid32 #endif #ifdef __NR_setgid # define SYS_setgid __NR_setgid #endif #ifdef __NR_setgid32 # define SYS_setgid32 __NR_setgid32 #endif #ifdef __NR_setgroups # define SYS_setgroups __NR_setgroups #endif #ifdef __NR_setgroups32 # define SYS_setgroups32 __NR_setgroups32 #endif #ifdef __NR_sethae # define SYS_sethae __NR_sethae #endif #ifdef __NR_sethostname # define SYS_sethostname __NR_sethostname #endif #ifdef __NR_setitimer # define SYS_setitimer __NR_setitimer #endif #ifdef __NR_setns # define SYS_setns __NR_setns #endif #ifdef __NR_setpgid # define SYS_setpgid __NR_setpgid #endif #ifdef __NR_setpgrp # define SYS_setpgrp __NR_setpgrp #endif #ifdef __NR_setpriority # define SYS_setpriority __NR_setpriority #endif #ifdef __NR_setregid # define SYS_setregid __NR_setregid #endif #ifdef __NR_setregid32 # define SYS_setregid32 __NR_setregid32 #endif #ifdef __NR_setresgid # define SYS_setresgid __NR_setresgid #endif #ifdef __NR_setresgid32 # define SYS_setresgid32 __NR_setresgid32 #endif #ifdef __NR_setresuid # define SYS_setresuid __NR_setresuid #endif #ifdef __NR_setresuid32 # define SYS_setresuid32 __NR_setresuid32 #endif #ifdef __NR_setreuid # define SYS_setreuid __NR_setreuid #endif #ifdef __NR_setreuid32 # define SYS_setreuid32 __NR_setreuid32 #endif #ifdef __NR_setrlimit # define SYS_setrlimit __NR_setrlimit #endif #ifdef __NR_setsid # define SYS_setsid __NR_setsid #endif #ifdef __NR_setsockopt # define SYS_setsockopt __NR_setsockopt #endif #ifdef __NR_settimeofday # define SYS_settimeofday __NR_settimeofday #endif #ifdef __NR_setuid # define SYS_setuid __NR_setuid #endif #ifdef __NR_setuid32 # define SYS_setuid32 __NR_setuid32 #endif #ifdef __NR_setxattr # define SYS_setxattr __NR_setxattr #endif #ifdef __NR_sgetmask # define SYS_sgetmask __NR_sgetmask #endif #ifdef __NR_shmat # define SYS_shmat __NR_shmat #endif #ifdef __NR_shmctl # define SYS_shmctl __NR_shmctl #endif #ifdef __NR_shmdt # define SYS_shmdt __NR_shmdt #endif #ifdef __NR_shmget # define SYS_shmget __NR_shmget #endif #ifdef __NR_shutdown # define SYS_shutdown __NR_shutdown #endif #ifdef __NR_sigaction # define SYS_sigaction __NR_sigaction #endif #ifdef __NR_sigaltstack # define SYS_sigaltstack __NR_sigaltstack #endif #ifdef __NR_signal # define SYS_signal __NR_signal #endif #ifdef __NR_signalfd # define SYS_signalfd __NR_signalfd #endif #ifdef __NR_signalfd4 # define SYS_signalfd4 __NR_signalfd4 #endif #ifdef __NR_sigpending # define SYS_sigpending __NR_sigpending #endif #ifdef __NR_sigprocmask # define SYS_sigprocmask __NR_sigprocmask #endif #ifdef __NR_sigreturn # define SYS_sigreturn __NR_sigreturn #endif #ifdef __NR_sigsuspend # define SYS_sigsuspend __NR_sigsuspend #endif #ifdef __NR_socket # define SYS_socket __NR_socket #endif #ifdef __NR_socketcall # define SYS_socketcall __NR_socketcall #endif #ifdef __NR_socketpair # define SYS_socketpair __NR_socketpair #endif #ifdef __NR_splice # define SYS_splice __NR_splice #endif #ifdef __NR_spu_create # define SYS_spu_create __NR_spu_create #endif #ifdef __NR_spu_run # define SYS_spu_run __NR_spu_run #endif #ifdef __NR_ssetmask # define SYS_ssetmask __NR_ssetmask #endif #ifdef __NR_stat # define SYS_stat __NR_stat #endif #ifdef __NR_stat64 # define SYS_stat64 __NR_stat64 #endif #ifdef __NR_statfs # define SYS_statfs __NR_statfs #endif #ifdef __NR_statfs64 # define SYS_statfs64 __NR_statfs64 #endif #ifdef __NR_statx # define SYS_statx __NR_statx #endif #ifdef __NR_stime # define SYS_stime __NR_stime #endif #ifdef __NR_stty # define SYS_stty __NR_stty #endif #ifdef __NR_subpage_prot # define SYS_subpage_prot __NR_subpage_prot #endif #ifdef __NR_swapcontext # define SYS_swapcontext __NR_swapcontext #endif #ifdef __NR_swapoff # define SYS_swapoff __NR_swapoff #endif #ifdef __NR_swapon # define SYS_swapon __NR_swapon #endif #ifdef __NR_switch_endian # define SYS_switch_endian __NR_switch_endian #endif #ifdef __NR_symlink # define SYS_symlink __NR_symlink #endif #ifdef __NR_symlinkat # define SYS_symlinkat __NR_symlinkat #endif #ifdef __NR_sync # define SYS_sync __NR_sync #endif #ifdef __NR_sync_file_range # define SYS_sync_file_range __NR_sync_file_range #endif #ifdef __NR_sync_file_range2 # define SYS_sync_file_range2 __NR_sync_file_range2 #endif #ifdef __NR_syncfs # define SYS_syncfs __NR_syncfs #endif #ifdef __NR_sys_debug_setcontext # define SYS_sys_debug_setcontext __NR_sys_debug_setcontext #endif #ifdef __NR_sys_epoll_create # define SYS_sys_epoll_create __NR_sys_epoll_create #endif #ifdef __NR_sys_epoll_ctl # define SYS_sys_epoll_ctl __NR_sys_epoll_ctl #endif #ifdef __NR_sys_epoll_wait # define SYS_sys_epoll_wait __NR_sys_epoll_wait #endif #ifdef __NR_syscall # define SYS_syscall __NR_syscall #endif #ifdef __NR_sysfs # define SYS_sysfs __NR_sysfs #endif #ifdef __NR_sysinfo # define SYS_sysinfo __NR_sysinfo #endif #ifdef __NR_syslog # define SYS_syslog __NR_syslog #endif #ifdef __NR_sysmips # define SYS_sysmips __NR_sysmips #endif #ifdef __NR_tee # define SYS_tee __NR_tee #endif #ifdef __NR_tgkill # define SYS_tgkill __NR_tgkill #endif #ifdef __NR_time # define SYS_time __NR_time #endif #ifdef __NR_timer_create # define SYS_timer_create __NR_timer_create #endif #ifdef __NR_timer_delete # define SYS_timer_delete __NR_timer_delete #endif #ifdef __NR_timer_getoverrun # define SYS_timer_getoverrun __NR_timer_getoverrun #endif #ifdef __NR_timer_gettime # define SYS_timer_gettime __NR_timer_gettime #endif #ifdef __NR_timer_gettime64 # define SYS_timer_gettime64 __NR_timer_gettime64 #endif #ifdef __NR_timer_settime # define SYS_timer_settime __NR_timer_settime #endif #ifdef __NR_timer_settime64 # define SYS_timer_settime64 __NR_timer_settime64 #endif #ifdef __NR_timerfd # define SYS_timerfd __NR_timerfd #endif #ifdef __NR_timerfd_create # define SYS_timerfd_create __NR_timerfd_create #endif #ifdef __NR_timerfd_gettime # define SYS_timerfd_gettime __NR_timerfd_gettime #endif #ifdef __NR_timerfd_gettime64 # define SYS_timerfd_gettime64 __NR_timerfd_gettime64 #endif #ifdef __NR_timerfd_settime # define SYS_timerfd_settime __NR_timerfd_settime #endif #ifdef __NR_timerfd_settime64 # define SYS_timerfd_settime64 __NR_timerfd_settime64 #endif #ifdef __NR_times # define SYS_times __NR_times #endif #ifdef __NR_tkill # define SYS_tkill __NR_tkill #endif #ifdef __NR_truncate # define SYS_truncate __NR_truncate #endif #ifdef __NR_truncate64 # define SYS_truncate64 __NR_truncate64 #endif #ifdef __NR_tuxcall # define SYS_tuxcall __NR_tuxcall #endif #ifdef __NR_udftrap # define SYS_udftrap __NR_udftrap #endif #ifdef __NR_ugetrlimit # define SYS_ugetrlimit __NR_ugetrlimit #endif #ifdef __NR_ulimit # define SYS_ulimit __NR_ulimit #endif #ifdef __NR_umask # define SYS_umask __NR_umask #endif #ifdef __NR_umount # define SYS_umount __NR_umount #endif #ifdef __NR_umount2 # define SYS_umount2 __NR_umount2 #endif #ifdef __NR_uname # define SYS_uname __NR_uname #endif #ifdef __NR_unlink # define SYS_unlink __NR_unlink #endif #ifdef __NR_unlinkat # define SYS_unlinkat __NR_unlinkat #endif #ifdef __NR_unshare # define SYS_unshare __NR_unshare #endif #ifdef __NR_uselib # define SYS_uselib __NR_uselib #endif #ifdef __NR_userfaultfd # define SYS_userfaultfd __NR_userfaultfd #endif #ifdef __NR_usr26 # define SYS_usr26 __NR_usr26 #endif #ifdef __NR_usr32 # define SYS_usr32 __NR_usr32 #endif #ifdef __NR_ustat # define SYS_ustat __NR_ustat #endif #ifdef __NR_utime # define SYS_utime __NR_utime #endif #ifdef __NR_utimensat # define SYS_utimensat __NR_utimensat #endif #ifdef __NR_utimensat_time64 # define SYS_utimensat_time64 __NR_utimensat_time64 #endif #ifdef __NR_utimes # define SYS_utimes __NR_utimes #endif #ifdef __NR_utrap_install # define SYS_utrap_install __NR_utrap_install #endif #ifdef __NR_vfork # define SYS_vfork __NR_vfork #endif #ifdef __NR_vhangup # define SYS_vhangup __NR_vhangup #endif #ifdef __NR_vm86 # define SYS_vm86 __NR_vm86 #endif #ifdef __NR_vm86old # define SYS_vm86old __NR_vm86old #endif #ifdef __NR_vmsplice # define SYS_vmsplice __NR_vmsplice #endif #ifdef __NR_vserver # define SYS_vserver __NR_vserver #endif #ifdef __NR_wait4 # define SYS_wait4 __NR_wait4 #endif #ifdef __NR_waitid # define SYS_waitid __NR_waitid #endif #ifdef __NR_waitpid # define SYS_waitpid __NR_waitpid #endif #ifdef __NR_write # define SYS_write __NR_write #endif #ifdef __NR_writev # define SYS_writev __NR_writev #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/select.h���������������������������������������������������������������������������������������0000644�����������������00000004115�14763166030�0007144 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997-1999,2001,2008,2009,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SELECT_H # error "Never use <bits/select.h> directly; include <sys/select.h> instead." #endif #include <bits/wordsize.h> #if defined __GNUC__ && __GNUC__ >= 2 # if __WORDSIZE == 64 # define __FD_ZERO_STOS "stosq" # else # define __FD_ZERO_STOS "stosl" # endif # define __FD_ZERO(fdsp) \ do { \ int __d0, __d1; \ __asm__ __volatile__ ("cld; rep; " __FD_ZERO_STOS \ : "=c" (__d0), "=D" (__d1) \ : "a" (0), "0" (sizeof (fd_set) \ / sizeof (__fd_mask)), \ "1" (&__FDS_BITS (fdsp)[0]) \ : "memory"); \ } while (0) #else /* ! GNU CC */ /* We don't use `memset' because this would require a prototype and the array isn't too big. */ # define __FD_ZERO(set) \ do { \ unsigned int __i; \ fd_set *__arr = (set); \ for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \ __FDS_BITS (__arr)[__i] = 0; \ } while (0) #endif /* GNU CC */ #define __FD_SET(d, set) \ ((void) (__FDS_BITS (set)[__FD_ELT (d)] |= __FD_MASK (d))) #define __FD_CLR(d, set) \ ((void) (__FDS_BITS (set)[__FD_ELT (d)] &= ~__FD_MASK (d))) #define __FD_ISSET(d, set) \ ((__FDS_BITS (set)[__FD_ELT (d)] & __FD_MASK (d)) != 0) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/timex.h����������������������������������������������������������������������������������������0000644�����������������00000010565�14763166030�0007021 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1995-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_TIMEX_H #define _BITS_TIMEX_H 1 #include <bits/types.h> /* These definitions from linux/timex.h as of 2.6.30. */ struct timex { unsigned int modes; /* mode selector */ __syscall_slong_t offset; /* time offset (usec) */ __syscall_slong_t freq; /* frequency offset (scaled ppm) */ __syscall_slong_t maxerror; /* maximum error (usec) */ __syscall_slong_t esterror; /* estimated error (usec) */ int status; /* clock command/status */ __syscall_slong_t constant; /* pll time constant */ __syscall_slong_t precision; /* clock precision (usec) (ro) */ __syscall_slong_t tolerance; /* clock frequency tolerance (ppm) (ro) */ struct timeval time; /* (read only) */ __syscall_slong_t tick; /* (modified) usecs between clock ticks */ __syscall_slong_t ppsfreq; /* pps frequency (scaled ppm) (ro) */ __syscall_slong_t jitter; /* pps jitter (us) (ro) */ int shift; /* interval duration (s) (shift) (ro) */ __syscall_slong_t stabil; /* pps stability (scaled ppm) (ro) */ __syscall_slong_t jitcnt; /* jitter limit exceeded (ro) */ __syscall_slong_t calcnt; /* calibration intervals (ro) */ __syscall_slong_t errcnt; /* calibration errors (ro) */ __syscall_slong_t stbcnt; /* stability limit exceeded (ro) */ int tai; /* TAI offset (ro) */ /* ??? */ int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; }; /* Mode codes (timex.mode) */ #define ADJ_OFFSET 0x0001 /* time offset */ #define ADJ_FREQUENCY 0x0002 /* frequency offset */ #define ADJ_MAXERROR 0x0004 /* maximum time error */ #define ADJ_ESTERROR 0x0008 /* estimated time error */ #define ADJ_STATUS 0x0010 /* clock status */ #define ADJ_TIMECONST 0x0020 /* pll time constant */ #define ADJ_TAI 0x0080 /* set TAI offset */ #define ADJ_MICRO 0x1000 /* select microsecond resolution */ #define ADJ_NANO 0x2000 /* select nanosecond resolution */ #define ADJ_TICK 0x4000 /* tick value */ #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ #define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ /* xntp 3.4 compatibility names */ #define MOD_OFFSET ADJ_OFFSET #define MOD_FREQUENCY ADJ_FREQUENCY #define MOD_MAXERROR ADJ_MAXERROR #define MOD_ESTERROR ADJ_ESTERROR #define MOD_STATUS ADJ_STATUS #define MOD_TIMECONST ADJ_TIMECONST #define MOD_CLKB ADJ_TICK #define MOD_CLKA ADJ_OFFSET_SINGLESHOT /* 0x8000 in original */ #define MOD_TAI ADJ_TAI #define MOD_MICRO ADJ_MICRO #define MOD_NANO ADJ_NANO /* Status codes (timex.status) */ #define STA_PLL 0x0001 /* enable PLL updates (rw) */ #define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */ #define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */ #define STA_FLL 0x0008 /* select frequency-lock mode (rw) */ #define STA_INS 0x0010 /* insert leap (rw) */ #define STA_DEL 0x0020 /* delete leap (rw) */ #define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */ #define STA_FREQHOLD 0x0080 /* hold frequency (rw) */ #define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */ #define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */ #define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */ #define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ #define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ #define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */ #define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */ #define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */ /* Read-only bits */ #define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK) #endif /* bits/timex.h */ �������������������������������������������������������������������������������������������������������������������������������������������bits/waitstatus.h�����������������������������������������������������������������������������������0000644�����������������00000006764�14763166030�0010111 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Definitions of status bits for `wait' et al. Copyright (C) 1992,1994,1996,1997,2000,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #if !defined _SYS_WAIT_H && !defined _STDLIB_H # error "Never include <bits/waitstatus.h> directly; use <sys/wait.h> instead." #endif /* Everything extant so far uses these same bits. */ /* If WIFEXITED(STATUS), the low-order 8 bits of the status. */ #define __WEXITSTATUS(status) (((status) & 0xff00) >> 8) /* If WIFSIGNALED(STATUS), the terminating signal. */ #define __WTERMSIG(status) ((status) & 0x7f) /* If WIFSTOPPED(STATUS), the signal that stopped the child. */ #define __WSTOPSIG(status) __WEXITSTATUS(status) /* Nonzero if STATUS indicates normal termination. */ #define __WIFEXITED(status) (__WTERMSIG(status) == 0) /* Nonzero if STATUS indicates termination by a signal. */ #define __WIFSIGNALED(status) \ (((signed char) (((status) & 0x7f) + 1) >> 1) > 0) /* Nonzero if STATUS indicates the child is stopped. */ #define __WIFSTOPPED(status) (((status) & 0xff) == 0x7f) /* Nonzero if STATUS indicates the child continued after a stop. We only define this if <bits/waitflags.h> provides the WCONTINUED flag bit. */ #ifdef WCONTINUED # define __WIFCONTINUED(status) ((status) == __W_CONTINUED) #endif /* Nonzero if STATUS indicates the child dumped core. */ #define __WCOREDUMP(status) ((status) & __WCOREFLAG) /* Macros for constructing status values. */ #define __W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) #define __W_STOPCODE(sig) ((sig) << 8 | 0x7f) #define __W_CONTINUED 0xffff #define __WCOREFLAG 0x80 #ifdef __USE_BSD # include <endian.h> union wait { int w_status; struct { # if __BYTE_ORDER == __LITTLE_ENDIAN unsigned int __w_termsig:7; /* Terminating signal. */ unsigned int __w_coredump:1; /* Set if dumped core. */ unsigned int __w_retcode:8; /* Return code if exited normally. */ unsigned int:16; # endif /* Little endian. */ # if __BYTE_ORDER == __BIG_ENDIAN unsigned int:16; unsigned int __w_retcode:8; unsigned int __w_coredump:1; unsigned int __w_termsig:7; # endif /* Big endian. */ } __wait_terminated; struct { # if __BYTE_ORDER == __LITTLE_ENDIAN unsigned int __w_stopval:8; /* W_STOPPED if stopped. */ unsigned int __w_stopsig:8; /* Stopping signal. */ unsigned int:16; # endif /* Little endian. */ # if __BYTE_ORDER == __BIG_ENDIAN unsigned int:16; unsigned int __w_stopsig:8; /* Stopping signal. */ unsigned int __w_stopval:8; /* W_STOPPED if stopped. */ # endif /* Big endian. */ } __wait_stopped; }; # define w_termsig __wait_terminated.__w_termsig # define w_coredump __wait_terminated.__w_coredump # define w_retcode __wait_terminated.__w_retcode # define w_stopsig __wait_stopped.__w_stopsig # define w_stopval __wait_stopped.__w_stopval #endif /* Use BSD. */ ������������bits/error.h����������������������������������������������������������������������������������������0000644�����������������00000005174�14763166030�0007024 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Specializations for error functions. Copyright (C) 2007, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ERROR_H # error "Never include <bits/error.h> directly; use <error.h> instead." #endif extern void __REDIRECT (__error_alias, (int __status, int __errnum, const char *__format, ...), error) __attribute__ ((__format__ (__printf__, 3, 4))); extern void __REDIRECT (__error_noreturn, (int __status, int __errnum, const char *__format, ...), error) __attribute__ ((__noreturn__, __format__ (__printf__, 3, 4))); /* If we know the function will never return make sure the compiler realizes that, too. */ __extern_always_inline void error (int __status, int __errnum, const char *__format, ...) { if (__builtin_constant_p (__status) && __status != 0) __error_noreturn (__status, __errnum, __format, __va_arg_pack ()); else __error_alias (__status, __errnum, __format, __va_arg_pack ()); } extern void __REDIRECT (__error_at_line_alias, (int __status, int __errnum, const char *__fname, unsigned int __line, const char *__format, ...), error_at_line) __attribute__ ((__format__ (__printf__, 5, 6))); extern void __REDIRECT (__error_at_line_noreturn, (int __status, int __errnum, const char *__fname, unsigned int __line, const char *__format, ...), error_at_line) __attribute__ ((__noreturn__, __format__ (__printf__, 5, 6))); /* If we know the function will never return make sure the compiler realizes that, too. */ __extern_always_inline void error_at_line (int __status, int __errnum, const char *__fname, unsigned int __line, const char *__format, ...) { if (__builtin_constant_p (__status) && __status != 0) __error_at_line_noreturn (__status, __errnum, __fname, __line, __format, __va_arg_pack ()); else __error_at_line_alias (__status, __errnum, __fname, __line, __format, __va_arg_pack ()); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/byteswap-16.h����������������������������������������������������������������������������������0000644�����������������00000003276�14763166030�0007756 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Macros to swap the order of bytes in 16-bit integer values. Copyright (C) 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_BYTESWAP_H # error "Never use <bits/byteswap-16.h> directly; include <byteswap.h> instead." #endif #ifdef __GNUC__ # if __GNUC__ >= 2 # define __bswap_16(x) \ (__extension__ \ ({ unsigned short int __v, __x = (unsigned short int) (x); \ if (__builtin_constant_p (__x)) \ __v = __bswap_constant_16 (__x); \ else \ __asm__ ("rorw $8, %w0" \ : "=r" (__v) \ : "0" (__x) \ : "cc"); \ __v; })) # else /* This is better than nothing. */ # define __bswap_16(x) \ (__extension__ \ ({ unsigned short int __x = (unsigned short int) (x); \ __bswap_constant_16 (__x); })) # endif #else static __inline unsigned short int __bswap_16 (unsigned short int __bsx) { return __bswap_constant_16 (__bsx); } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/termios.h��������������������������������������������������������������������������������������0000644�����������������00000012350�14763166030�0007347 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* termios type and macro definitions. Linux version. Copyright (C) 1993-1999, 2003, 2005, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _TERMIOS_H # error "Never include <bits/termios.h> directly; use <termios.h> instead." #endif typedef unsigned char cc_t; typedef unsigned int speed_t; typedef unsigned int tcflag_t; #define NCCS 32 struct termios { tcflag_t c_iflag; /* input mode flags */ tcflag_t c_oflag; /* output mode flags */ tcflag_t c_cflag; /* control mode flags */ tcflag_t c_lflag; /* local mode flags */ cc_t c_line; /* line discipline */ cc_t c_cc[NCCS]; /* control characters */ speed_t c_ispeed; /* input speed */ speed_t c_ospeed; /* output speed */ #define _HAVE_STRUCT_TERMIOS_C_ISPEED 1 #define _HAVE_STRUCT_TERMIOS_C_OSPEED 1 }; /* c_cc characters */ #define VINTR 0 #define VQUIT 1 #define VERASE 2 #define VKILL 3 #define VEOF 4 #define VTIME 5 #define VMIN 6 #define VSWTC 7 #define VSTART 8 #define VSTOP 9 #define VSUSP 10 #define VEOL 11 #define VREPRINT 12 #define VDISCARD 13 #define VWERASE 14 #define VLNEXT 15 #define VEOL2 16 /* c_iflag bits */ #define IGNBRK 0000001 #define BRKINT 0000002 #define IGNPAR 0000004 #define PARMRK 0000010 #define INPCK 0000020 #define ISTRIP 0000040 #define INLCR 0000100 #define IGNCR 0000200 #define ICRNL 0000400 #define IUCLC 0001000 #define IXON 0002000 #define IXANY 0004000 #define IXOFF 0010000 #define IMAXBEL 0020000 #define IUTF8 0040000 /* c_oflag bits */ #define OPOST 0000001 #define OLCUC 0000002 #define ONLCR 0000004 #define OCRNL 0000010 #define ONOCR 0000020 #define ONLRET 0000040 #define OFILL 0000100 #define OFDEL 0000200 #if defined __USE_MISC || defined __USE_XOPEN # define NLDLY 0000400 # define NL0 0000000 # define NL1 0000400 # define CRDLY 0003000 # define CR0 0000000 # define CR1 0001000 # define CR2 0002000 # define CR3 0003000 # define TABDLY 0014000 # define TAB0 0000000 # define TAB1 0004000 # define TAB2 0010000 # define TAB3 0014000 # define BSDLY 0020000 # define BS0 0000000 # define BS1 0020000 # define FFDLY 0100000 # define FF0 0000000 # define FF1 0100000 #endif #define VTDLY 0040000 #define VT0 0000000 #define VT1 0040000 #ifdef __USE_MISC # define XTABS 0014000 #endif /* c_cflag bit meaning */ #ifdef __USE_MISC # define CBAUD 0010017 #endif #define B0 0000000 /* hang up */ #define B50 0000001 #define B75 0000002 #define B110 0000003 #define B134 0000004 #define B150 0000005 #define B200 0000006 #define B300 0000007 #define B600 0000010 #define B1200 0000011 #define B1800 0000012 #define B2400 0000013 #define B4800 0000014 #define B9600 0000015 #define B19200 0000016 #define B38400 0000017 #ifdef __USE_MISC # define EXTA B19200 # define EXTB B38400 #endif #define CSIZE 0000060 #define CS5 0000000 #define CS6 0000020 #define CS7 0000040 #define CS8 0000060 #define CSTOPB 0000100 #define CREAD 0000200 #define PARENB 0000400 #define PARODD 0001000 #define HUPCL 0002000 #define CLOCAL 0004000 #ifdef __USE_MISC # define CBAUDEX 0010000 #endif #define B57600 0010001 #define B115200 0010002 #define B230400 0010003 #define B460800 0010004 #define B500000 0010005 #define B576000 0010006 #define B921600 0010007 #define B1000000 0010010 #define B1152000 0010011 #define B1500000 0010012 #define B2000000 0010013 #define B2500000 0010014 #define B3000000 0010015 #define B3500000 0010016 #define B4000000 0010017 #define __MAX_BAUD B4000000 #ifdef __USE_MISC # define CIBAUD 002003600000 /* input baud rate (not used) */ # define CMSPAR 010000000000 /* mark or space (stick) parity */ # define CRTSCTS 020000000000 /* flow control */ #endif /* c_lflag bits */ #define ISIG 0000001 #define ICANON 0000002 #if defined __USE_MISC || defined __USE_XOPEN # define XCASE 0000004 #endif #define ECHO 0000010 #define ECHOE 0000020 #define ECHOK 0000040 #define ECHONL 0000100 #define NOFLSH 0000200 #define TOSTOP 0000400 #ifdef __USE_MISC # define ECHOCTL 0001000 # define ECHOPRT 0002000 # define ECHOKE 0004000 # define FLUSHO 0010000 # define PENDIN 0040000 #endif #define IEXTEN 0100000 #ifdef __USE_BSD # define EXTPROC 0200000 #endif /* tcflow() and TCXONC use these */ #define TCOOFF 0 #define TCOON 1 #define TCIOFF 2 #define TCION 3 /* tcflush() and TCFLSH use these */ #define TCIFLUSH 0 #define TCOFLUSH 1 #define TCIOFLUSH 2 /* tcsetattr uses these */ #define TCSANOW 0 #define TCSADRAIN 1 #define TCSAFLUSH 2 #define _IOT_termios /* Hurd ioctl type field. */ \ _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/unistd.h���������������������������������������������������������������������������������������0000644�����������������00000032110�14763166030�0007167 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Checking macros for unistd functions. Copyright (C) 2005, 2006, 2007, 2008, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _UNISTD_H # error "Never include <bits/unistd.h> directly; use <unistd.h> instead." #endif extern ssize_t __read_chk (int __fd, void *__buf, size_t __nbytes, size_t __buflen) __wur; extern ssize_t __REDIRECT (__read_alias, (int __fd, void *__buf, size_t __nbytes), read) __wur; extern ssize_t __REDIRECT (__read_chk_warn, (int __fd, void *__buf, size_t __nbytes, size_t __buflen), __read_chk) __wur __warnattr ("read called with bigger length than size of " "the destination buffer"); __fortify_function __wur ssize_t read (int __fd, void *__buf, size_t __nbytes) { if (__bos0 (__buf) != (size_t) -1) { if (!__builtin_constant_p (__nbytes)) return __read_chk (__fd, __buf, __nbytes, __bos0 (__buf)); if (__nbytes > __bos0 (__buf)) return __read_chk_warn (__fd, __buf, __nbytes, __bos0 (__buf)); } return __read_alias (__fd, __buf, __nbytes); } #ifdef __USE_UNIX98 extern ssize_t __pread_chk (int __fd, void *__buf, size_t __nbytes, __off_t __offset, size_t __bufsize) __wur; extern ssize_t __pread64_chk (int __fd, void *__buf, size_t __nbytes, __off64_t __offset, size_t __bufsize) __wur; extern ssize_t __REDIRECT (__pread_alias, (int __fd, void *__buf, size_t __nbytes, __off_t __offset), pread) __wur; extern ssize_t __REDIRECT (__pread64_alias, (int __fd, void *__buf, size_t __nbytes, __off64_t __offset), pread64) __wur; extern ssize_t __REDIRECT (__pread_chk_warn, (int __fd, void *__buf, size_t __nbytes, __off_t __offset, size_t __bufsize), __pread_chk) __wur __warnattr ("pread called with bigger length than size of " "the destination buffer"); extern ssize_t __REDIRECT (__pread64_chk_warn, (int __fd, void *__buf, size_t __nbytes, __off64_t __offset, size_t __bufsize), __pread64_chk) __wur __warnattr ("pread64 called with bigger length than size of " "the destination buffer"); # ifndef __USE_FILE_OFFSET64 __fortify_function __wur ssize_t pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset) { if (__bos0 (__buf) != (size_t) -1) { if (!__builtin_constant_p (__nbytes)) return __pread_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf)); if ( __nbytes > __bos0 (__buf)) return __pread_chk_warn (__fd, __buf, __nbytes, __offset, __bos0 (__buf)); } return __pread_alias (__fd, __buf, __nbytes, __offset); } # else __fortify_function __wur ssize_t pread (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) { if (__bos0 (__buf) != (size_t) -1) { if (!__builtin_constant_p (__nbytes)) return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf)); if ( __nbytes > __bos0 (__buf)) return __pread64_chk_warn (__fd, __buf, __nbytes, __offset, __bos0 (__buf)); } return __pread64_alias (__fd, __buf, __nbytes, __offset); } # endif # ifdef __USE_LARGEFILE64 __fortify_function __wur ssize_t pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) { if (__bos0 (__buf) != (size_t) -1) { if (!__builtin_constant_p (__nbytes)) return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf)); if ( __nbytes > __bos0 (__buf)) return __pread64_chk_warn (__fd, __buf, __nbytes, __offset, __bos0 (__buf)); } return __pread64_alias (__fd, __buf, __nbytes, __offset); } # endif #endif #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K extern ssize_t __readlink_chk (const char *__restrict __path, char *__restrict __buf, size_t __len, size_t __buflen) __THROW __nonnull ((1, 2)) __wur; extern ssize_t __REDIRECT_NTH (__readlink_alias, (const char *__restrict __path, char *__restrict __buf, size_t __len), readlink) __nonnull ((1, 2)) __wur; extern ssize_t __REDIRECT_NTH (__readlink_chk_warn, (const char *__restrict __path, char *__restrict __buf, size_t __len, size_t __buflen), __readlink_chk) __nonnull ((1, 2)) __wur __warnattr ("readlink called with bigger length " "than size of destination buffer"); __fortify_function __nonnull ((1, 2)) __wur ssize_t __NTH (readlink (const char *__restrict __path, char *__restrict __buf, size_t __len)) { if (__bos (__buf) != (size_t) -1) { if (!__builtin_constant_p (__len)) return __readlink_chk (__path, __buf, __len, __bos (__buf)); if ( __len > __bos (__buf)) return __readlink_chk_warn (__path, __buf, __len, __bos (__buf)); } return __readlink_alias (__path, __buf, __len); } #endif #ifdef __USE_ATFILE extern ssize_t __readlinkat_chk (int __fd, const char *__restrict __path, char *__restrict __buf, size_t __len, size_t __buflen) __THROW __nonnull ((2, 3)) __wur; extern ssize_t __REDIRECT_NTH (__readlinkat_alias, (int __fd, const char *__restrict __path, char *__restrict __buf, size_t __len), readlinkat) __nonnull ((2, 3)) __wur; extern ssize_t __REDIRECT_NTH (__readlinkat_chk_warn, (int __fd, const char *__restrict __path, char *__restrict __buf, size_t __len, size_t __buflen), __readlinkat_chk) __nonnull ((2, 3)) __wur __warnattr ("readlinkat called with bigger " "length than size of destination " "buffer"); __fortify_function __nonnull ((2, 3)) __wur ssize_t __NTH (readlinkat (int __fd, const char *__restrict __path, char *__restrict __buf, size_t __len)) { if (__bos (__buf) != (size_t) -1) { if (!__builtin_constant_p (__len)) return __readlinkat_chk (__fd, __path, __buf, __len, __bos (__buf)); if (__len > __bos (__buf)) return __readlinkat_chk_warn (__fd, __path, __buf, __len, __bos (__buf)); } return __readlinkat_alias (__fd, __path, __buf, __len); } #endif extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen) __THROW __wur; extern char *__REDIRECT_NTH (__getcwd_alias, (char *__buf, size_t __size), getcwd) __wur; extern char *__REDIRECT_NTH (__getcwd_chk_warn, (char *__buf, size_t __size, size_t __buflen), __getcwd_chk) __wur __warnattr ("getcwd caller with bigger length than size of " "destination buffer"); __fortify_function __wur char * __NTH (getcwd (char *__buf, size_t __size)) { if (__bos (__buf) != (size_t) -1) { if (!__builtin_constant_p (__size)) return __getcwd_chk (__buf, __size, __bos (__buf)); if (__size > __bos (__buf)) return __getcwd_chk_warn (__buf, __size, __bos (__buf)); } return __getcwd_alias (__buf, __size); } #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED extern char *__getwd_chk (char *__buf, size_t buflen) __THROW __nonnull ((1)) __wur; extern char *__REDIRECT_NTH (__getwd_warn, (char *__buf), getwd) __nonnull ((1)) __wur __warnattr ("please use getcwd instead, as getwd " "doesn't specify buffer size"); __fortify_function __nonnull ((1)) __attribute_deprecated__ __wur char * __NTH (getwd (char *__buf)) { if (__bos (__buf) != (size_t) -1) return __getwd_chk (__buf, __bos (__buf)); return __getwd_warn (__buf); } #endif extern size_t __confstr_chk (int __name, char *__buf, size_t __len, size_t __buflen) __THROW; extern size_t __REDIRECT_NTH (__confstr_alias, (int __name, char *__buf, size_t __len), confstr); extern size_t __REDIRECT_NTH (__confstr_chk_warn, (int __name, char *__buf, size_t __len, size_t __buflen), __confstr_chk) __warnattr ("confstr called with bigger length than size of destination " "buffer"); __fortify_function size_t __NTH (confstr (int __name, char *__buf, size_t __len)) { if (__bos (__buf) != (size_t) -1) { if (!__builtin_constant_p (__len)) return __confstr_chk (__name, __buf, __len, __bos (__buf)); if (__bos (__buf) < __len) return __confstr_chk_warn (__name, __buf, __len, __bos (__buf)); } return __confstr_alias (__name, __buf, __len); } extern int __getgroups_chk (int __size, __gid_t __list[], size_t __listlen) __THROW __wur; extern int __REDIRECT_NTH (__getgroups_alias, (int __size, __gid_t __list[]), getgroups) __wur; extern int __REDIRECT_NTH (__getgroups_chk_warn, (int __size, __gid_t __list[], size_t __listlen), __getgroups_chk) __wur __warnattr ("getgroups called with bigger group count than what " "can fit into destination buffer"); __fortify_function int __NTH (getgroups (int __size, __gid_t __list[])) { if (__bos (__list) != (size_t) -1) { if (!__builtin_constant_p (__size) || __size < 0) return __getgroups_chk (__size, __list, __bos (__list)); if (__size * sizeof (__gid_t) > __bos (__list)) return __getgroups_chk_warn (__size, __list, __bos (__list)); } return __getgroups_alias (__size, __list); } extern int __ttyname_r_chk (int __fd, char *__buf, size_t __buflen, size_t __nreal) __THROW __nonnull ((2)); extern int __REDIRECT_NTH (__ttyname_r_alias, (int __fd, char *__buf, size_t __buflen), ttyname_r) __nonnull ((2)); extern int __REDIRECT_NTH (__ttyname_r_chk_warn, (int __fd, char *__buf, size_t __buflen, size_t __nreal), __ttyname_r_chk) __nonnull ((2)) __warnattr ("ttyname_r called with bigger buflen than " "size of destination buffer"); __fortify_function int __NTH (ttyname_r (int __fd, char *__buf, size_t __buflen)) { if (__bos (__buf) != (size_t) -1) { if (!__builtin_constant_p (__buflen)) return __ttyname_r_chk (__fd, __buf, __buflen, __bos (__buf)); if (__buflen > __bos (__buf)) return __ttyname_r_chk_warn (__fd, __buf, __buflen, __bos (__buf)); } return __ttyname_r_alias (__fd, __buf, __buflen); } #if defined __USE_REENTRANT || defined __USE_POSIX199506 extern int __getlogin_r_chk (char *__buf, size_t __buflen, size_t __nreal) __nonnull ((1)); extern int __REDIRECT (__getlogin_r_alias, (char *__buf, size_t __buflen), getlogin_r) __nonnull ((1)); extern int __REDIRECT (__getlogin_r_chk_warn, (char *__buf, size_t __buflen, size_t __nreal), __getlogin_r_chk) __nonnull ((1)) __warnattr ("getlogin_r called with bigger buflen than " "size of destination buffer"); __fortify_function int getlogin_r (char *__buf, size_t __buflen) { if (__bos (__buf) != (size_t) -1) { if (!__builtin_constant_p (__buflen)) return __getlogin_r_chk (__buf, __buflen, __bos (__buf)); if (__buflen > __bos (__buf)) return __getlogin_r_chk_warn (__buf, __buflen, __bos (__buf)); } return __getlogin_r_alias (__buf, __buflen); } #endif #if defined __USE_BSD || defined __USE_UNIX98 extern int __gethostname_chk (char *__buf, size_t __buflen, size_t __nreal) __THROW __nonnull ((1)); extern int __REDIRECT_NTH (__gethostname_alias, (char *__buf, size_t __buflen), gethostname) __nonnull ((1)); extern int __REDIRECT_NTH (__gethostname_chk_warn, (char *__buf, size_t __buflen, size_t __nreal), __gethostname_chk) __nonnull ((1)) __warnattr ("gethostname called with bigger buflen than " "size of destination buffer"); __fortify_function int __NTH (gethostname (char *__buf, size_t __buflen)) { if (__bos (__buf) != (size_t) -1) { if (!__builtin_constant_p (__buflen)) return __gethostname_chk (__buf, __buflen, __bos (__buf)); if (__buflen > __bos (__buf)) return __gethostname_chk_warn (__buf, __buflen, __bos (__buf)); } return __gethostname_alias (__buf, __buflen); } #endif #if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98) extern int __getdomainname_chk (char *__buf, size_t __buflen, size_t __nreal) __THROW __nonnull ((1)) __wur; extern int __REDIRECT_NTH (__getdomainname_alias, (char *__buf, size_t __buflen), getdomainname) __nonnull ((1)) __wur; extern int __REDIRECT_NTH (__getdomainname_chk_warn, (char *__buf, size_t __buflen, size_t __nreal), __getdomainname_chk) __nonnull ((1)) __wur __warnattr ("getdomainname called with bigger " "buflen than size of destination " "buffer"); __fortify_function int __NTH (getdomainname (char *__buf, size_t __buflen)) { if (__bos (__buf) != (size_t) -1) { if (!__builtin_constant_p (__buflen)) return __getdomainname_chk (__buf, __buflen, __bos (__buf)); if (__buflen > __bos (__buf)) return __getdomainname_chk_warn (__buf, __buflen, __bos (__buf)); } return __getdomainname_alias (__buf, __buflen); } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/param.h����������������������������������������������������������������������������������������0000644�����������������00000002630�14763166030�0006765 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Old-style Unix parameters and limits. Linux version. Copyright (C) 1995-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_PARAM_H # error "Never use <bits/param.h> directly; include <sys/param.h> instead." #endif #ifndef ARG_MAX # define __undef_ARG_MAX #endif #include <linux/limits.h> #include <linux/param.h> /* The kernel headers define ARG_MAX. The value is wrong, though. */ #ifdef __undef_ARG_MAX # undef ARG_MAX # undef __undef_ARG_MAX #endif #define MAXSYMLINKS 20 /* The following are not really correct but it is a value we used for a long time and which seems to be usable. People should not use NOFILE and NCARGS anyway. */ #define NOFILE 256 #define NCARGS 131072 ��������������������������������������������������������������������������������������������������������bits/huge_valf.h������������������������������������������������������������������������������������0000644�����������������00000003452�14763166030�0007630 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* `HUGE_VALF' constant for IEEE 754 machines (where it is infinity). Used by <stdlib.h> and <math.h> functions for overflow. Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never use <bits/huge_valf.h> directly; include <math.h> instead." #endif /* IEEE positive infinity (-HUGE_VAL is negative infinity). */ #if __GNUC_PREREQ(3,3) # define HUGE_VALF (__builtin_huge_valf()) #elif __GNUC_PREREQ(2,96) # define HUGE_VALF (__extension__ 0x1.0p255f) #elif defined __GNUC__ # define HUGE_VALF \ (__extension__ \ ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \ { __l: 0x7f800000UL }).__d) #else /* not GCC */ typedef union { unsigned char __c[4]; float __f; } __huge_valf_t; # if __BYTE_ORDER == __BIG_ENDIAN # define __HUGE_VALF_bytes { 0x7f, 0x80, 0, 0 } # endif # if __BYTE_ORDER == __LITTLE_ENDIAN # define __HUGE_VALF_bytes { 0, 0, 0x80, 0x7f } # endif static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes }; # define HUGE_VALF (__huge_valf.__f) #endif /* GCC. */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/wchar-ldbl.h�����������������������������������������������������������������������������������0000644�����������������00000004713�14763166030�0007710 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -mlong-double-64 compatibility mode for <wchar.h> functions. Copyright (C) 2006-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _WCHAR_H # error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead." #endif #if defined __USE_ISOC95 || defined __USE_UNIX98 __BEGIN_NAMESPACE_C99 __LDBL_REDIR_DECL (fwprintf); __LDBL_REDIR_DECL (wprintf); __LDBL_REDIR_DECL (swprintf); __LDBL_REDIR_DECL (vfwprintf); __LDBL_REDIR_DECL (vwprintf); __LDBL_REDIR_DECL (vswprintf); # if defined __USE_ISOC99 && !defined __USE_GNU \ && !defined __REDIRECT \ && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) __LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf) __LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf) __LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf) # else __LDBL_REDIR_DECL (fwscanf); __LDBL_REDIR_DECL (wscanf); __LDBL_REDIR_DECL (swscanf); # endif __END_NAMESPACE_C99 #endif #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 __LDBL_REDIR1_DECL (wcstold, wcstod); # if !defined __USE_GNU && !defined __REDIRECT \ && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) __LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf) __LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf) __LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf) # else __LDBL_REDIR_DECL (vfwscanf); __LDBL_REDIR_DECL (vwscanf); __LDBL_REDIR_DECL (vswscanf); # endif __END_NAMESPACE_C99 #endif #ifdef __USE_GNU __LDBL_REDIR1_DECL (wcstold_l, wcstod_l); #endif #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function __LDBL_REDIR_DECL (__swprintf_chk) __LDBL_REDIR_DECL (__vswprintf_chk) # if __USE_FORTIFY_LEVEL > 1 __LDBL_REDIR_DECL (__fwprintf_chk) __LDBL_REDIR_DECL (__wprintf_chk) __LDBL_REDIR_DECL (__vfwprintf_chk) __LDBL_REDIR_DECL (__vwprintf_chk) # endif #endif �����������������������������������������������������bits/stdio_lim.h������������������������������������������������������������������������������������0000644�����������������00000002535�14763166030�0007654 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1994, 1997, 1998, 1999, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #if !defined _STDIO_H && !defined __need_FOPEN_MAX && !defined __need_IOV_MAX # error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead." #endif #ifdef _STDIO_H # define L_tmpnam 20 # define TMP_MAX 238328 # define FILENAME_MAX 4096 # ifdef __USE_POSIX # define L_ctermid 9 # if !defined __USE_XOPEN2K || defined __USE_GNU # define L_cuserid 9 # endif # endif #endif #if defined __need_FOPEN_MAX || defined _STDIO_H # undef FOPEN_MAX # define FOPEN_MAX 16 #endif #if defined __need_IOV_MAX && !defined IOV_MAX # define IOV_MAX 1024 #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/resource.h�������������������������������������������������������������������������������������0000644�����������������00000022333�14763166030�0007516 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Bit values & structures for resource limits. Linux version. Copyright (C) 1994-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_RESOURCE_H # error "Never use <bits/resource.h> directly; include <sys/resource.h> instead." #endif #include <bits/types.h> /* Transmute defines to enumerations. The macro re-definitions are necessary because some programs want to test for operating system features with #ifdef RUSAGE_SELF. In ISO C the reflexive definition is a no-op. */ /* Kinds of resource limit. */ enum __rlimit_resource { /* Per-process CPU limit, in seconds. */ RLIMIT_CPU = 0, #define RLIMIT_CPU RLIMIT_CPU /* Largest file that can be created, in bytes. */ RLIMIT_FSIZE = 1, #define RLIMIT_FSIZE RLIMIT_FSIZE /* Maximum size of data segment, in bytes. */ RLIMIT_DATA = 2, #define RLIMIT_DATA RLIMIT_DATA /* Maximum size of stack segment, in bytes. */ RLIMIT_STACK = 3, #define RLIMIT_STACK RLIMIT_STACK /* Largest core file that can be created, in bytes. */ RLIMIT_CORE = 4, #define RLIMIT_CORE RLIMIT_CORE /* Largest resident set size, in bytes. This affects swapping; processes that are exceeding their resident set size will be more likely to have physical memory taken from them. */ __RLIMIT_RSS = 5, #define RLIMIT_RSS __RLIMIT_RSS /* Number of open files. */ RLIMIT_NOFILE = 7, __RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ #define RLIMIT_NOFILE RLIMIT_NOFILE #define RLIMIT_OFILE __RLIMIT_OFILE /* Address space limit. */ RLIMIT_AS = 9, #define RLIMIT_AS RLIMIT_AS /* Number of processes. */ __RLIMIT_NPROC = 6, #define RLIMIT_NPROC __RLIMIT_NPROC /* Locked-in-memory address space. */ __RLIMIT_MEMLOCK = 8, #define RLIMIT_MEMLOCK __RLIMIT_MEMLOCK /* Maximum number of file locks. */ __RLIMIT_LOCKS = 10, #define RLIMIT_LOCKS __RLIMIT_LOCKS /* Maximum number of pending signals. */ __RLIMIT_SIGPENDING = 11, #define RLIMIT_SIGPENDING __RLIMIT_SIGPENDING /* Maximum bytes in POSIX message queues. */ __RLIMIT_MSGQUEUE = 12, #define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE /* Maximum nice priority allowed to raise to. Nice levels 19 .. -20 correspond to 0 .. 39 values of this resource limit. */ __RLIMIT_NICE = 13, #define RLIMIT_NICE __RLIMIT_NICE /* Maximum realtime priority allowed for non-priviledged processes. */ __RLIMIT_RTPRIO = 14, #define RLIMIT_RTPRIO __RLIMIT_RTPRIO /* Maximum CPU time in µs that a process scheduled under a real-time scheduling policy may consume without making a blocking system call before being forcibly descheduled. */ __RLIMIT_RTTIME = 15, #define RLIMIT_RTTIME __RLIMIT_RTTIME __RLIMIT_NLIMITS = 16, __RLIM_NLIMITS = __RLIMIT_NLIMITS #define RLIMIT_NLIMITS __RLIMIT_NLIMITS #define RLIM_NLIMITS __RLIM_NLIMITS }; /* Value to indicate that there is no limit. */ #ifndef __USE_FILE_OFFSET64 # define RLIM_INFINITY ((__rlim_t) -1) #else # define RLIM_INFINITY 0xffffffffffffffffuLL #endif #ifdef __USE_LARGEFILE64 # define RLIM64_INFINITY 0xffffffffffffffffuLL #endif /* We can represent all limits. */ #define RLIM_SAVED_MAX RLIM_INFINITY #define RLIM_SAVED_CUR RLIM_INFINITY /* Type for resource quantity measurement. */ #ifndef __USE_FILE_OFFSET64 typedef __rlim_t rlim_t; #else typedef __rlim64_t rlim_t; #endif #ifdef __USE_LARGEFILE64 typedef __rlim64_t rlim64_t; #endif struct rlimit { /* The current (soft) limit. */ rlim_t rlim_cur; /* The hard limit. */ rlim_t rlim_max; }; #ifdef __USE_LARGEFILE64 struct rlimit64 { /* The current (soft) limit. */ rlim64_t rlim_cur; /* The hard limit. */ rlim64_t rlim_max; }; #endif /* Whose usage statistics do you want? */ enum __rusage_who { /* The calling process. */ RUSAGE_SELF = 0, #define RUSAGE_SELF RUSAGE_SELF /* All of its terminated child processes. */ RUSAGE_CHILDREN = -1 #define RUSAGE_CHILDREN RUSAGE_CHILDREN #ifdef __USE_GNU , /* The calling thread. */ RUSAGE_THREAD = 1 # define RUSAGE_THREAD RUSAGE_THREAD /* Name for the same functionality on Solaris. */ # define RUSAGE_LWP RUSAGE_THREAD #endif }; #define __need_timeval #include <bits/time.h> /* For `struct timeval'. */ /* Structure which says how much of each resource has been used. */ /* The purpose of all the unions is to have the kernel-compatible layout while keeping the API type as 'long int', and among machines where __syscall_slong_t is not 'long int', this only does the right thing for little-endian ones, like x32. */ struct rusage { /* Total amount of user time used. */ struct timeval ru_utime; /* Total amount of system time used. */ struct timeval ru_stime; /* Maximum resident set size (in kilobytes). */ __extension__ union { long int ru_maxrss; __syscall_slong_t __ru_maxrss_word; }; /* Amount of sharing of text segment memory with other processes (kilobyte-seconds). */ /* Maximum resident set size (in kilobytes). */ __extension__ union { long int ru_ixrss; __syscall_slong_t __ru_ixrss_word; }; /* Amount of data segment memory used (kilobyte-seconds). */ __extension__ union { long int ru_idrss; __syscall_slong_t __ru_idrss_word; }; /* Amount of stack memory used (kilobyte-seconds). */ __extension__ union { long int ru_isrss; __syscall_slong_t __ru_isrss_word; }; /* Number of soft page faults (i.e. those serviced by reclaiming a page from the list of pages awaiting reallocation. */ __extension__ union { long int ru_minflt; __syscall_slong_t __ru_minflt_word; }; /* Number of hard page faults (i.e. those that required I/O). */ __extension__ union { long int ru_majflt; __syscall_slong_t __ru_majflt_word; }; /* Number of times a process was swapped out of physical memory. */ __extension__ union { long int ru_nswap; __syscall_slong_t __ru_nswap_word; }; /* Number of input operations via the file system. Note: This and `ru_oublock' do not include operations with the cache. */ __extension__ union { long int ru_inblock; __syscall_slong_t __ru_inblock_word; }; /* Number of output operations via the file system. */ __extension__ union { long int ru_oublock; __syscall_slong_t __ru_oublock_word; }; /* Number of IPC messages sent. */ __extension__ union { long int ru_msgsnd; __syscall_slong_t __ru_msgsnd_word; }; /* Number of IPC messages received. */ __extension__ union { long int ru_msgrcv; __syscall_slong_t __ru_msgrcv_word; }; /* Number of signals delivered. */ __extension__ union { long int ru_nsignals; __syscall_slong_t __ru_nsignals_word; }; /* Number of voluntary context switches, i.e. because the process gave up the process before it had to (usually to wait for some resource to be available). */ __extension__ union { long int ru_nvcsw; __syscall_slong_t __ru_nvcsw_word; }; /* Number of involuntary context switches, i.e. a higher priority process became runnable or the current process used up its time slice. */ __extension__ union { long int ru_nivcsw; __syscall_slong_t __ru_nivcsw_word; }; }; /* Priority limits. */ #define PRIO_MIN -20 /* Minimum priority a process can have. */ #define PRIO_MAX 20 /* Maximum priority a process can have. */ /* The type of the WHICH argument to `getpriority' and `setpriority', indicating what flavor of entity the WHO argument specifies. */ enum __priority_which { PRIO_PROCESS = 0, /* WHO is a process ID. */ #define PRIO_PROCESS PRIO_PROCESS PRIO_PGRP = 1, /* WHO is a process group ID. */ #define PRIO_PGRP PRIO_PGRP PRIO_USER = 2 /* WHO is a user ID. */ #define PRIO_USER PRIO_USER }; __BEGIN_DECLS #ifdef __USE_GNU /* Modify and return resource limits of a process atomically. */ # ifndef __USE_FILE_OFFSET64 extern int prlimit (__pid_t __pid, enum __rlimit_resource __resource, const struct rlimit *__new_limit, struct rlimit *__old_limit) __THROW; # else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (prlimit, (__pid_t __pid, enum __rlimit_resource __resource, const struct rlimit *__new_limit, struct rlimit *__old_limit), prlimit64); # else # define prlimit prlimit64 # endif # endif # ifdef __USE_LARGEFILE64 extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource, const struct rlimit64 *__new_limit, struct rlimit64 *__old_limit) __THROW; # endif #endif __END_DECLS �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/netdb.h����������������������������������������������������������������������������������������0000644�����������������00000002402�14763166030�0006756 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _NETDB_H # error "Never include <bits/netdb.h> directly; use <netdb.h> instead." #endif /* Description of data base entry for a single network. NOTE: here a poor assumption is made. The network number is expected to fit into an unsigned long int variable. */ struct netent { char *n_name; /* Official name of network. */ char **n_aliases; /* Alias list. */ int n_addrtype; /* Net address type. */ uint32_t n_net; /* Network number. */ }; ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/stdlib-ldbl.h����������������������������������������������������������������������������������0000644�����������������00000002563�14763166030�0010066 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -mlong-double-64 compatibility mode for <stdlib.h> functions. Copyright (C) 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _STDLIB_H # error "Never include <bits/stdlib-ldbl.h> directly; use <stdlib.h> instead." #endif #ifdef __USE_ISOC99 __BEGIN_NAMESPACE_C99 __LDBL_REDIR1_DECL (strtold, strtod) __END_NAMESPACE_C99 #endif #ifdef __USE_GNU __LDBL_REDIR1_DECL (strtold_l, strtod_l) #endif #if defined __USE_SVID || defined __USE_XOPEN_EXTENDED # ifdef __USE_MISC __LDBL_REDIR1_DECL (qecvt, ecvt) __LDBL_REDIR1_DECL (qfcvt, fcvt) __LDBL_REDIR1_DECL (qgcvt, gcvt) __LDBL_REDIR1_DECL (qecvt_r, ecvt_r) __LDBL_REDIR1_DECL (qfcvt_r, fcvt_r) # endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������bits/statfs.h���������������������������������������������������������������������������������������0000644�����������������00000003620�14763166030�0007171 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997,1998,2000,2002,2003,2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_STATFS_H # error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead." #endif #include <bits/types.h> struct statfs { __fsword_t f_type; __fsword_t f_bsize; #ifndef __USE_FILE_OFFSET64 __fsblkcnt_t f_blocks; __fsblkcnt_t f_bfree; __fsblkcnt_t f_bavail; __fsfilcnt_t f_files; __fsfilcnt_t f_ffree; #else __fsblkcnt64_t f_blocks; __fsblkcnt64_t f_bfree; __fsblkcnt64_t f_bavail; __fsfilcnt64_t f_files; __fsfilcnt64_t f_ffree; #endif __fsid_t f_fsid; __fsword_t f_namelen; __fsword_t f_frsize; __fsword_t f_flags; __fsword_t f_spare[4]; }; #ifdef __USE_LARGEFILE64 struct statfs64 { __fsword_t f_type; __fsword_t f_bsize; __fsblkcnt64_t f_blocks; __fsblkcnt64_t f_bfree; __fsblkcnt64_t f_bavail; __fsfilcnt64_t f_files; __fsfilcnt64_t f_ffree; __fsid_t f_fsid; __fsword_t f_namelen; __fsword_t f_frsize; __fsword_t f_flags; __fsword_t f_spare[4]; }; #endif /* Tell code we have these members. */ #define _STATFS_F_NAMELEN #define _STATFS_F_FRSIZE #define _STATFS_F_FLAGS ����������������������������������������������������������������������������������������������������������������bits/socket.h���������������������������������������������������������������������������������������0000644�����������������00000031151�14763166030�0007155 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* System-specific socket constants and types. Linux version. Copyright (C) 1991, 1992, 1994-2001, 2004, 2006-2010, 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __BITS_SOCKET_H #define __BITS_SOCKET_H #ifndef _SYS_SOCKET_H # error "Never include <bits/socket.h> directly; use <sys/socket.h> instead." #endif #define __need_size_t #include <stddef.h> #include <sys/types.h> /* Type for length arguments in socket calls. */ #ifndef __socklen_t_defined typedef __socklen_t socklen_t; # define __socklen_t_defined #endif /* Get the architecture-dependent definition of enum __socket_type. */ #include <bits/socket_type.h> /* Protocol families. */ #define PF_UNSPEC 0 /* Unspecified. */ #define PF_LOCAL 1 /* Local to host (pipes and file-domain). */ #define PF_UNIX PF_LOCAL /* POSIX name for PF_LOCAL. */ #define PF_FILE PF_LOCAL /* Another non-standard name for PF_LOCAL. */ #define PF_INET 2 /* IP protocol family. */ #define PF_AX25 3 /* Amateur Radio AX.25. */ #define PF_IPX 4 /* Novell Internet Protocol. */ #define PF_APPLETALK 5 /* Appletalk DDP. */ #define PF_NETROM 6 /* Amateur radio NetROM. */ #define PF_BRIDGE 7 /* Multiprotocol bridge. */ #define PF_ATMPVC 8 /* ATM PVCs. */ #define PF_X25 9 /* Reserved for X.25 project. */ #define PF_INET6 10 /* IP version 6. */ #define PF_ROSE 11 /* Amateur Radio X.25 PLP. */ #define PF_DECnet 12 /* Reserved for DECnet project. */ #define PF_NETBEUI 13 /* Reserved for 802.2LLC project. */ #define PF_SECURITY 14 /* Security callback pseudo AF. */ #define PF_KEY 15 /* PF_KEY key management API. */ #define PF_NETLINK 16 #define PF_ROUTE PF_NETLINK /* Alias to emulate 4.4BSD. */ #define PF_PACKET 17 /* Packet family. */ #define PF_ASH 18 /* Ash. */ #define PF_ECONET 19 /* Acorn Econet. */ #define PF_ATMSVC 20 /* ATM SVCs. */ #define PF_RDS 21 /* RDS sockets. */ #define PF_SNA 22 /* Linux SNA Project */ #define PF_IRDA 23 /* IRDA sockets. */ #define PF_PPPOX 24 /* PPPoX sockets. */ #define PF_WANPIPE 25 /* Wanpipe API sockets. */ #define PF_LLC 26 /* Linux LLC. */ #define PF_IB 27 /* Native InfiniBand address. */ #define PF_MPLS 28 /* MPLS. */ #define PF_CAN 29 /* Controller Area Network. */ #define PF_TIPC 30 /* TIPC sockets. */ #define PF_BLUETOOTH 31 /* Bluetooth sockets. */ #define PF_IUCV 32 /* IUCV sockets. */ #define PF_RXRPC 33 /* RxRPC sockets. */ #define PF_ISDN 34 /* mISDN sockets. */ #define PF_PHONET 35 /* Phonet sockets. */ #define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */ #define PF_CAIF 37 /* CAIF sockets. */ #define PF_ALG 38 /* Algorithm sockets. */ #define PF_NFC 39 /* NFC sockets. */ #define PF_VSOCK 40 /* vSockets. */ #define PF_MAX 41 /* For now.. */ /* Address families. */ #define AF_UNSPEC PF_UNSPEC #define AF_LOCAL PF_LOCAL #define AF_UNIX PF_UNIX #define AF_FILE PF_FILE #define AF_INET PF_INET #define AF_AX25 PF_AX25 #define AF_IPX PF_IPX #define AF_APPLETALK PF_APPLETALK #define AF_NETROM PF_NETROM #define AF_BRIDGE PF_BRIDGE #define AF_ATMPVC PF_ATMPVC #define AF_X25 PF_X25 #define AF_INET6 PF_INET6 #define AF_ROSE PF_ROSE #define AF_DECnet PF_DECnet #define AF_NETBEUI PF_NETBEUI #define AF_SECURITY PF_SECURITY #define AF_KEY PF_KEY #define AF_NETLINK PF_NETLINK #define AF_ROUTE PF_ROUTE #define AF_PACKET PF_PACKET #define AF_ASH PF_ASH #define AF_ECONET PF_ECONET #define AF_ATMSVC PF_ATMSVC #define AF_RDS PF_RDS #define AF_SNA PF_SNA #define AF_IRDA PF_IRDA #define AF_PPPOX PF_PPPOX #define AF_WANPIPE PF_WANPIPE #define AF_LLC PF_LLC #define AF_IB PF_IB #define AF_MPLS PF_MPLS #define AF_CAN PF_CAN #define AF_TIPC PF_TIPC #define AF_BLUETOOTH PF_BLUETOOTH #define AF_IUCV PF_IUCV #define AF_RXRPC PF_RXRPC #define AF_ISDN PF_ISDN #define AF_PHONET PF_PHONET #define AF_IEEE802154 PF_IEEE802154 #define AF_CAIF PF_CAIF #define AF_ALG PF_ALG #define AF_NFC PF_NFC #define AF_VSOCK PF_VSOCK #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. XXX These definitions also should go into the appropriate headers as far as they are available. */ #define SOL_RAW 255 #define SOL_DECNET 261 #define SOL_X25 262 #define SOL_PACKET 263 #define SOL_ATM 264 /* ATM layer (cell level). */ #define SOL_AAL 265 /* ATM Adaption Layer (packet level). */ #define SOL_IRDA 266 /* Maximum queue length specifiable by listen. */ #define SOMAXCONN 128 /* Get the definition of the macro to define the common sockaddr members. */ #include <bits/sockaddr.h> /* Structure describing a generic socket address. */ struct sockaddr { __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ char sa_data[14]; /* Address data. */ }; /* Structure large enough to hold any socket address (with the historical exception of AF_UNIX). */ #define __ss_aligntype unsigned long int #define _SS_PADSIZE \ (_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)) struct sockaddr_storage { __SOCKADDR_COMMON (ss_); /* Address family, etc. */ char __ss_padding[_SS_PADSIZE]; __ss_aligntype __ss_align; /* Force desired alignment. */ }; /* Bits in the FLAGS argument to `send', `recv', et al. */ enum { MSG_OOB = 0x01, /* Process out-of-band data. */ #define MSG_OOB MSG_OOB MSG_PEEK = 0x02, /* Peek at incoming messages. */ #define MSG_PEEK MSG_PEEK MSG_DONTROUTE = 0x04, /* Don't use local routing. */ #define MSG_DONTROUTE MSG_DONTROUTE #ifdef __USE_GNU /* DECnet uses a different name. */ MSG_TRYHARD = MSG_DONTROUTE, # define MSG_TRYHARD MSG_DONTROUTE #endif MSG_CTRUNC = 0x08, /* Control data lost before delivery. */ #define MSG_CTRUNC MSG_CTRUNC MSG_PROXY = 0x10, /* Supply or ask second address. */ #define MSG_PROXY MSG_PROXY MSG_TRUNC = 0x20, #define MSG_TRUNC MSG_TRUNC MSG_DONTWAIT = 0x40, /* Nonblocking IO. */ #define MSG_DONTWAIT MSG_DONTWAIT MSG_EOR = 0x80, /* End of record. */ #define MSG_EOR MSG_EOR MSG_WAITALL = 0x100, /* Wait for a full request. */ #define MSG_WAITALL MSG_WAITALL MSG_FIN = 0x200, #define MSG_FIN MSG_FIN MSG_SYN = 0x400, #define MSG_SYN MSG_SYN MSG_CONFIRM = 0x800, /* Confirm path validity. */ #define MSG_CONFIRM MSG_CONFIRM MSG_RST = 0x1000, #define MSG_RST MSG_RST MSG_ERRQUEUE = 0x2000, /* Fetch message from error queue. */ #define MSG_ERRQUEUE MSG_ERRQUEUE MSG_NOSIGNAL = 0x4000, /* Do not generate SIGPIPE. */ #define MSG_NOSIGNAL MSG_NOSIGNAL MSG_MORE = 0x8000, /* Sender will send more. */ #define MSG_MORE MSG_MORE MSG_WAITFORONE = 0x10000, /* Wait for at least one packet to return.*/ #define MSG_WAITFORONE MSG_WAITFORONE MSG_FASTOPEN = 0x20000000, /* Send data in TCP SYN. */ #define MSG_FASTOPEN MSG_FASTOPEN MSG_CMSG_CLOEXEC = 0x40000000 /* Set close_on_exit for file descriptor received through SCM_RIGHTS. */ #define MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC }; /* Structure describing messages sent by `sendmsg' and received by `recvmsg'. */ struct msghdr { void *msg_name; /* Address to send to/receive from. */ socklen_t msg_namelen; /* Length of address data. */ struct iovec *msg_iov; /* Vector of data to send/receive into. */ size_t msg_iovlen; /* Number of elements in the vector. */ void *msg_control; /* Ancillary data (eg BSD filedesc passing). */ size_t msg_controllen; /* Ancillary data buffer length. !! The type should be socklen_t but the definition of the kernel is incompatible with this. */ int msg_flags; /* Flags on received message. */ }; /* Structure used for storage of ancillary data object information. */ struct cmsghdr { size_t cmsg_len; /* Length of data in cmsg_data plus length of cmsghdr structure. !! The type should be socklen_t but the definition of the kernel is incompatible with this. */ int cmsg_level; /* Originating protocol. */ int cmsg_type; /* Protocol specific type. */ #if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */ #endif }; /* Ancillary data object manipulation macros. */ #if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L # define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data) #else # define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1)) #endif #define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg) #define CMSG_FIRSTHDR(mhdr) \ ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \ ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0) #define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \ & (size_t) ~(sizeof (size_t) - 1)) #define CMSG_SPACE(len) (CMSG_ALIGN (len) \ + CMSG_ALIGN (sizeof (struct cmsghdr))) #define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len)) extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW; #ifdef __USE_EXTERN_INLINES # ifndef _EXTERN_INLINE # define _EXTERN_INLINE __extern_inline # endif _EXTERN_INLINE struct cmsghdr * __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) { if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr)) /* The kernel header does this so there may be a reason. */ return (struct cmsghdr *) 0; __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)); if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen) || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len) > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen))) /* No more entries. */ return (struct cmsghdr *) 0; return __cmsg; } #endif /* Use `extern inline'. */ /* Socket level message types. This must match the definitions in <linux/socket.h>. */ enum { SCM_RIGHTS = 0x01 /* Transfer file descriptors. */ #define SCM_RIGHTS SCM_RIGHTS #ifdef __USE_GNU , SCM_CREDENTIALS = 0x02 /* Credentials passing. */ # define SCM_CREDENTIALS SCM_CREDENTIALS #endif }; #ifdef __USE_GNU /* User visible structure for SCM_CREDENTIALS message */ struct ucred { pid_t pid; /* PID of sending process. */ uid_t uid; /* UID of sending process. */ gid_t gid; /* GID of sending process. */ }; #endif /* Ugly workaround for unclean kernel headers. */ #if !defined __USE_MISC && !defined __USE_GNU # ifndef FIOGETOWN # define __SYS_SOCKET_H_undef_FIOGETOWN # endif # ifndef FIOSETOWN # define __SYS_SOCKET_H_undef_FIOSETOWN # endif # ifndef SIOCATMARK # define __SYS_SOCKET_H_undef_SIOCATMARK # endif # ifndef SIOCGPGRP # define __SYS_SOCKET_H_undef_SIOCGPGRP # endif # ifndef SIOCGSTAMP # define __SYS_SOCKET_H_undef_SIOCGSTAMP # endif # ifndef SIOCGSTAMPNS # define __SYS_SOCKET_H_undef_SIOCGSTAMPNS # endif # ifndef SIOCSPGRP # define __SYS_SOCKET_H_undef_SIOCSPGRP # endif #endif /* Get socket manipulation related informations from kernel headers. */ #include <asm/socket.h> #if !defined __USE_MISC && !defined __USE_GNU # ifdef __SYS_SOCKET_H_undef_FIOGETOWN # undef __SYS_SOCKET_H_undef_FIOGETOWN # undef FIOGETOWN # endif # ifdef __SYS_SOCKET_H_undef_FIOSETOWN # undef __SYS_SOCKET_H_undef_FIOSETOWN # undef FIOSETOWN # endif # ifdef __SYS_SOCKET_H_undef_SIOCATMARK # undef __SYS_SOCKET_H_undef_SIOCATMARK # undef SIOCATMARK # endif # ifdef __SYS_SOCKET_H_undef_SIOCGPGRP # undef __SYS_SOCKET_H_undef_SIOCGPGRP # undef SIOCGPGRP # endif # ifdef __SYS_SOCKET_H_undef_SIOCGSTAMP # undef __SYS_SOCKET_H_undef_SIOCGSTAMP # undef SIOCGSTAMP # endif # ifdef __SYS_SOCKET_H_undef_SIOCGSTAMPNS # undef __SYS_SOCKET_H_undef_SIOCGSTAMPNS # undef SIOCGSTAMPNS # endif # ifdef __SYS_SOCKET_H_undef_SIOCSPGRP # undef __SYS_SOCKET_H_undef_SIOCSPGRP # undef SIOCSPGRP # endif #endif /* Structure used to manipulate the SO_LINGER option. */ struct linger { int l_onoff; /* Nonzero to linger on close. */ int l_linger; /* Time to linger. */ }; #endif /* bits/socket.h */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/posix1_lim.h�����������������������������������������������������������������������������������0000644�����������������00000011472�14763166030�0007755 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 2.9.2 Minimum Values Added to <limits.h> * * Never include this file directly; use <limits.h> instead. */ #ifndef _BITS_POSIX1_LIM_H #define _BITS_POSIX1_LIM_H 1 /* These are the standard-mandated minimum values. */ /* Minimum number of operations in one list I/O call. */ #define _POSIX_AIO_LISTIO_MAX 2 /* Minimal number of outstanding asynchronous I/O operations. */ #define _POSIX_AIO_MAX 1 /* Maximum length of arguments to `execve', including environment. */ #define _POSIX_ARG_MAX 4096 /* Maximum simultaneous processes per real user ID. */ #ifdef __USE_XOPEN2K # define _POSIX_CHILD_MAX 25 #else # define _POSIX_CHILD_MAX 6 #endif /* Minimal number of timer expiration overruns. */ #define _POSIX_DELAYTIMER_MAX 32 /* Maximum length of a host name (not including the terminating null) as returned from the GETHOSTNAME function. */ #define _POSIX_HOST_NAME_MAX 255 /* Maximum link count of a file. */ #define _POSIX_LINK_MAX 8 /* Maximum length of login name. */ #define _POSIX_LOGIN_NAME_MAX 9 /* Number of bytes in a terminal canonical input queue. */ #define _POSIX_MAX_CANON 255 /* Number of bytes for which space will be available in a terminal input queue. */ #define _POSIX_MAX_INPUT 255 /* Maximum number of message queues open for a process. */ #define _POSIX_MQ_OPEN_MAX 8 /* Maximum number of supported message priorities. */ #define _POSIX_MQ_PRIO_MAX 32 /* Number of bytes in a filename. */ #define _POSIX_NAME_MAX 14 /* Number of simultaneous supplementary group IDs per process. */ #ifdef __USE_XOPEN2K # define _POSIX_NGROUPS_MAX 8 #else # define _POSIX_NGROUPS_MAX 0 #endif /* Number of files one process can have open at once. */ #ifdef __USE_XOPEN2K # define _POSIX_OPEN_MAX 20 #else # define _POSIX_OPEN_MAX 16 #endif #if !defined __USE_XOPEN2K || defined __USE_GNU /* Number of descriptors that a process may examine with `pselect' or `select'. */ # define _POSIX_FD_SETSIZE _POSIX_OPEN_MAX #endif /* Number of bytes in a pathname. */ #define _POSIX_PATH_MAX 256 /* Number of bytes than can be written atomically to a pipe. */ #define _POSIX_PIPE_BUF 512 /* The number of repeated occurrences of a BRE permitted by the REGEXEC and REGCOMP functions when using the interval notation. */ #define _POSIX_RE_DUP_MAX 255 /* Minimal number of realtime signals reserved for the application. */ #define _POSIX_RTSIG_MAX 8 /* Number of semaphores a process can have. */ #define _POSIX_SEM_NSEMS_MAX 256 /* Maximal value of a semaphore. */ #define _POSIX_SEM_VALUE_MAX 32767 /* Number of pending realtime signals. */ #define _POSIX_SIGQUEUE_MAX 32 /* Largest value of a `ssize_t'. */ #define _POSIX_SSIZE_MAX 32767 /* Number of streams a process can have open at once. */ #define _POSIX_STREAM_MAX 8 /* The number of bytes in a symbolic link. */ #define _POSIX_SYMLINK_MAX 255 /* The number of symbolic links that can be traversed in the resolution of a pathname in the absence of a loop. */ #define _POSIX_SYMLOOP_MAX 8 /* Number of timer for a process. */ #define _POSIX_TIMER_MAX 32 /* Maximum number of characters in a tty name. */ #define _POSIX_TTY_NAME_MAX 9 /* Maximum length of a timezone name (element of `tzname'). */ #ifdef __USE_XOPEN2K # define _POSIX_TZNAME_MAX 6 #else # define _POSIX_TZNAME_MAX 3 #endif #if !defined __USE_XOPEN2K || defined __USE_GNU /* Maximum number of connections that can be queued on a socket. */ # define _POSIX_QLIMIT 1 /* Maximum number of bytes that can be buffered on a socket for send or receive. */ # define _POSIX_HIWAT _POSIX_PIPE_BUF /* Maximum number of elements in an `iovec' array. */ # define _POSIX_UIO_MAXIOV 16 #endif /* Maximum clock resolution in nanoseconds. */ #define _POSIX_CLOCKRES_MIN 20000000 /* Get the implementation-specific values for the above. */ #include <bits/local_lim.h> #ifndef SSIZE_MAX # define SSIZE_MAX LONG_MAX #endif /* This value is a guaranteed minimum maximum. The current maximum can be got from `sysconf'. */ #ifndef NGROUPS_MAX # define NGROUPS_MAX 8 #endif #endif /* bits/posix1_lim.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/link.h�����������������������������������������������������������������������������������������0000644�����������������00000010312�14763166030�0006616 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2004, 2005, 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _LINK_H # error "Never include <bits/link.h> directly; use <link.h> instead." #endif #ifndef __x86_64__ /* Registers for entry into PLT on IA-32. */ typedef struct La_i86_regs { uint32_t lr_edx; uint32_t lr_ecx; uint32_t lr_eax; uint32_t lr_ebp; uint32_t lr_esp; } La_i86_regs; /* Return values for calls from PLT on IA-32. */ typedef struct La_i86_retval { uint32_t lrv_eax; uint32_t lrv_edx; long double lrv_st0; long double lrv_st1; uint64_t lrv_bnd0; uint64_t lrv_bnd1; } La_i86_retval; __BEGIN_DECLS extern Elf32_Addr la_i86_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx, uintptr_t *__refcook, uintptr_t *__defcook, La_i86_regs *__regs, unsigned int *__flags, const char *__symname, long int *__framesizep); extern unsigned int la_i86_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx, uintptr_t *__refcook, uintptr_t *__defcook, const La_i86_regs *__inregs, La_i86_retval *__outregs, const char *symname); __END_DECLS #else /* Registers for entry into PLT on x86-64. */ # if __GNUC_PREREQ (4,0) typedef float La_x86_64_xmm __attribute__ ((__vector_size__ (16))); typedef float La_x86_64_ymm __attribute__ ((__vector_size__ (32), __aligned__ (16))); typedef double La_x86_64_zmm __attribute__ ((__vector_size__ (64), __aligned__ (16))); # else typedef float La_x86_64_xmm __attribute__ ((__mode__ (__V4SF__))); # endif typedef union { # if __GNUC_PREREQ (4,0) La_x86_64_ymm ymm[2]; La_x86_64_zmm zmm[1]; # endif La_x86_64_xmm xmm[4]; } La_x86_64_vector __attribute__ ((__aligned__ (16))); typedef struct La_x86_64_regs { uint64_t lr_rdx; uint64_t lr_r8; uint64_t lr_r9; uint64_t lr_rcx; uint64_t lr_rsi; uint64_t lr_rdi; uint64_t lr_rbp; uint64_t lr_rsp; La_x86_64_xmm lr_xmm[8]; La_x86_64_vector lr_vector[8]; #ifndef __ILP32__ __int128_t lr_bnd[4]; #endif } La_x86_64_regs; /* Return values for calls from PLT on x86-64. */ typedef struct La_x86_64_retval { uint64_t lrv_rax; uint64_t lrv_rdx; La_x86_64_xmm lrv_xmm0; La_x86_64_xmm lrv_xmm1; long double lrv_st0; long double lrv_st1; La_x86_64_vector lrv_vector0; La_x86_64_vector lrv_vector1; #ifndef __ILP32__ __int128_t lrv_bnd0; __int128_t lrv_bnd1; #endif } La_x86_64_retval; #define La_x32_regs La_x86_64_regs #define La_x32_retval La_x86_64_retval __BEGIN_DECLS extern Elf64_Addr la_x86_64_gnu_pltenter (Elf64_Sym *__sym, unsigned int __ndx, uintptr_t *__refcook, uintptr_t *__defcook, La_x86_64_regs *__regs, unsigned int *__flags, const char *__symname, long int *__framesizep); extern unsigned int la_x86_64_gnu_pltexit (Elf64_Sym *__sym, unsigned int __ndx, uintptr_t *__refcook, uintptr_t *__defcook, const La_x86_64_regs *__inregs, La_x86_64_retval *__outregs, const char *__symname); extern Elf32_Addr la_x32_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx, uintptr_t *__refcook, uintptr_t *__defcook, La_x32_regs *__regs, unsigned int *__flags, const char *__symname, long int *__framesizep); extern unsigned int la_x32_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx, uintptr_t *__refcook, uintptr_t *__defcook, const La_x32_regs *__inregs, La_x32_retval *__outregs, const char *__symname); __END_DECLS #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/in.h�������������������������������������������������������������������������������������������0000644�����������������00000022007�14763166030�0006273 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* Linux version. */ #ifndef _NETINET_IN_H # error "Never use <bits/in.h> directly; include <netinet/in.h> instead." #endif /* If the application has already included linux/in6.h from a linux-based kernel then we will not define the IPv6 IPPROTO_* defines, in6_addr (nor the defines), sockaddr_in6, or ipv6_mreq. Same for in6_ptkinfo or ip6_mtuinfo in linux/ipv6.h. The ABI used by the linux-kernel and glibc match exactly. Neither the linux kernel nor glibc should break this ABI without coordination. In upstream kernel 56c176c9 the _UAPI prefix was stripped so we need to check for _LINUX_IN6_H and _IPV6_H now, and keep checking the old versions for maximum backwards compatibility. */ #if defined _UAPI_LINUX_IN6_H \ || defined _UAPI_IPV6_H \ || defined _LINUX_IN6_H \ || defined _IPV6_H /* This is not quite the same API since the kernel always defines s6_addr16 and s6_addr32. This is not a violation of POSIX since POSIX says "at least the following member" and that holds true. */ # define __USE_KERNEL_IPV6_DEFS 1 #else # define __USE_KERNEL_IPV6_DEFS 0 #endif /* Options for use with `getsockopt' and `setsockopt' at the IP level. The first word in the comment at the right is the data type used; "bool" means a boolean value stored in an `int'. */ #define IP_OPTIONS 4 /* ip_opts; IP per-packet options. */ #define IP_HDRINCL 3 /* int; Header is included with data. */ #define IP_TOS 1 /* int; IP type of service and precedence. */ #define IP_TTL 2 /* int; IP time to live. */ #define IP_RECVOPTS 6 /* bool; Receive all IP options w/datagram. */ /* For BSD compatibility. */ #define IP_RECVRETOPTS IP_RETOPTS /* bool; Receive IP options for response. */ #define IP_RETOPTS 7 /* ip_opts; Set/get IP per-packet options. */ #define IP_MULTICAST_IF 32 /* in_addr; set/get IP multicast i/f */ #define IP_MULTICAST_TTL 33 /* u_char; set/get IP multicast ttl */ #define IP_MULTICAST_LOOP 34 /* i_char; set/get IP multicast loopback */ #define IP_ADD_MEMBERSHIP 35 /* ip_mreq; add an IP group membership */ #define IP_DROP_MEMBERSHIP 36 /* ip_mreq; drop an IP group membership */ #define IP_UNBLOCK_SOURCE 37 /* ip_mreq_source: unblock data from source */ #define IP_BLOCK_SOURCE 38 /* ip_mreq_source: block data from source */ #define IP_ADD_SOURCE_MEMBERSHIP 39 /* ip_mreq_source: join source group */ #define IP_DROP_SOURCE_MEMBERSHIP 40 /* ip_mreq_source: leave source group */ #define IP_MSFILTER 41 #if defined __USE_MISC || defined __USE_GNU # define MCAST_JOIN_GROUP 42 /* group_req: join any-source group */ # define MCAST_BLOCK_SOURCE 43 /* group_source_req: block from given group */ # define MCAST_UNBLOCK_SOURCE 44 /* group_source_req: unblock from given group*/ # define MCAST_LEAVE_GROUP 45 /* group_req: leave any-source group */ # define MCAST_JOIN_SOURCE_GROUP 46 /* group_source_req: join source-spec gr */ # define MCAST_LEAVE_SOURCE_GROUP 47 /* group_source_req: leave source-spec gr*/ # define MCAST_MSFILTER 48 # define IP_MULTICAST_ALL 49 # define IP_UNICAST_IF 50 # define MCAST_EXCLUDE 0 # define MCAST_INCLUDE 1 #endif #define IP_ROUTER_ALERT 5 /* bool */ #define IP_PKTINFO 8 /* bool */ #define IP_PKTOPTIONS 9 #define IP_PMTUDISC 10 /* obsolete name? */ #define IP_MTU_DISCOVER 10 /* int; see below */ #define IP_RECVERR 11 /* bool */ #define IP_RECVTTL 12 /* bool */ #define IP_RECVTOS 13 /* bool */ #define IP_MTU 14 /* int */ #define IP_FREEBIND 15 #define IP_IPSEC_POLICY 16 #define IP_XFRM_POLICY 17 #define IP_PASSSEC 18 #define IP_TRANSPARENT 19 #define IP_MULTICAST_ALL 49 /* bool */ /* TProxy original addresses */ #define IP_ORIGDSTADDR 20 #define IP_RECVORIGDSTADDR IP_ORIGDSTADDR #define IP_MINTTL 21 #define IP_NODEFRAG 22 #define IP_CHECKSUM 23 #define IP_BIND_ADDRESS_NO_PORT 24 /* IP_MTU_DISCOVER arguments. */ #define IP_PMTUDISC_DONT 0 /* Never send DF frames. */ #define IP_PMTUDISC_WANT 1 /* Use per route hints. */ #define IP_PMTUDISC_DO 2 /* Always DF. */ #define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu. */ /* Always use interface mtu (ignores dst pmtu) but don't set DF flag. Also incoming ICMP frag_needed notifications will be ignored on this socket to prevent accepting spoofed ones. */ #define IP_PMTUDISC_INTERFACE 4 /* Like IP_PMTUDISC_INTERFACE but allow packets to be fragmented. */ #define IP_PMTUDISC_OMIT 5 #define IP_MULTICAST_IF 32 #define IP_MULTICAST_TTL 33 #define IP_MULTICAST_LOOP 34 #define IP_ADD_MEMBERSHIP 35 #define IP_DROP_MEMBERSHIP 36 #define IP_UNBLOCK_SOURCE 37 #define IP_BLOCK_SOURCE 38 #define IP_ADD_SOURCE_MEMBERSHIP 39 #define IP_DROP_SOURCE_MEMBERSHIP 40 #define IP_MSFILTER 41 #define MCAST_JOIN_GROUP 42 #define MCAST_BLOCK_SOURCE 43 #define MCAST_UNBLOCK_SOURCE 44 #define MCAST_LEAVE_GROUP 45 #define MCAST_JOIN_SOURCE_GROUP 46 #define MCAST_LEAVE_SOURCE_GROUP 47 #define MCAST_MSFILTER 48 #define IP_MULTICAST_ALL 49 #define IP_UNICAST_IF 50 /* To select the IP level. */ #define SOL_IP 0 #define IP_DEFAULT_MULTICAST_TTL 1 #define IP_DEFAULT_MULTICAST_LOOP 1 #define IP_MAX_MEMBERSHIPS 20 #if defined __USE_MISC || defined __USE_GNU /* Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS. The `ip_dst' field is used for the first-hop gateway when using a source route (this gets put into the header proper). */ struct ip_opts { struct in_addr ip_dst; /* First hop; zero without source route. */ char ip_opts[40]; /* Actually variable in size. */ }; /* Like `struct ip_mreq' but including interface specification by index. */ struct ip_mreqn { struct in_addr imr_multiaddr; /* IP multicast address of group */ struct in_addr imr_address; /* local IP address of interface */ int imr_ifindex; /* Interface index */ }; /* Structure used for IP_PKTINFO. */ struct in_pktinfo { int ipi_ifindex; /* Interface index */ struct in_addr ipi_spec_dst; /* Routing destination address */ struct in_addr ipi_addr; /* Header destination address */ }; #endif /* Options for use with `getsockopt' and `setsockopt' at the IPv6 level. The first word in the comment at the right is the data type used; "bool" means a boolean value stored in an `int'. */ #define IPV6_ADDRFORM 1 #define IPV6_2292PKTINFO 2 #define IPV6_2292HOPOPTS 3 #define IPV6_2292DSTOPTS 4 #define IPV6_2292RTHDR 5 #define IPV6_2292PKTOPTIONS 6 #define IPV6_CHECKSUM 7 #define IPV6_2292HOPLIMIT 8 #define SCM_SRCRT IPV6_RXSRCRT #define IPV6_NEXTHOP 9 #define IPV6_AUTHHDR 10 #define IPV6_UNICAST_HOPS 16 #define IPV6_MULTICAST_IF 17 #define IPV6_MULTICAST_HOPS 18 #define IPV6_MULTICAST_LOOP 19 #define IPV6_JOIN_GROUP 20 #define IPV6_LEAVE_GROUP 21 #define IPV6_ROUTER_ALERT 22 #define IPV6_MTU_DISCOVER 23 #define IPV6_MTU 24 #define IPV6_RECVERR 25 #define IPV6_V6ONLY 26 #define IPV6_JOIN_ANYCAST 27 #define IPV6_LEAVE_ANYCAST 28 #define IPV6_IPSEC_POLICY 34 #define IPV6_XFRM_POLICY 35 #define IPV6_RECVPKTINFO 49 #define IPV6_PKTINFO 50 #define IPV6_RECVHOPLIMIT 51 #define IPV6_HOPLIMIT 52 #define IPV6_RECVHOPOPTS 53 #define IPV6_HOPOPTS 54 #define IPV6_RTHDRDSTOPTS 55 #define IPV6_RECVRTHDR 56 #define IPV6_RTHDR 57 #define IPV6_RECVDSTOPTS 58 #define IPV6_DSTOPTS 59 #define IPV6_RECVTCLASS 66 #define IPV6_TCLASS 67 /* Obsolete synonyms for the above. */ #if !__USE_KERNEL_IPV6_DEFS # define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP # define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP #endif #define IPV6_RXHOPOPTS IPV6_HOPOPTS #define IPV6_RXDSTOPTS IPV6_DSTOPTS /* IPV6_MTU_DISCOVER values. */ #define IPV6_PMTUDISC_DONT 0 /* Never send DF frames. */ #define IPV6_PMTUDISC_WANT 1 /* Use per route hints. */ #define IPV6_PMTUDISC_DO 2 /* Always DF. */ #define IPV6_PMTUDISC_PROBE 3 /* Ignore dst pmtu. */ #define IPV6_PMTUDISC_INTERFACE 4 /* See IP_PMTUDISC_INTERFACE. */ #define IPV6_PMTUDISC_OMIT 5 /* See IP_PMTUDISC_OMIT. */ /* Socket level values for IPv6. */ #define SOL_IPV6 41 #define SOL_ICMPV6 58 /* Routing header options for IPv6. */ #define IPV6_RTHDR_LOOSE 0 /* Hop doesn't need to be neighbour. */ #define IPV6_RTHDR_STRICT 1 /* Hop must be a neighbour. */ #define IPV6_RTHDR_TYPE_0 0 /* IPv6 Routing header type 0. */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/sys_errlist.h����������������������������������������������������������������������������������0000644�����������������00000002277�14763166030�0010256 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Declare sys_errlist and sys_nerr, or don't. Compatibility (do) version. Copyright (C) 2002, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _STDIO_H # error "Never include <bits/sys_errlist.h> directly; use <stdio.h> instead." #endif /* sys_errlist and sys_nerr are deprecated. Use strerror instead. */ #ifdef __USE_BSD extern int sys_nerr; extern const char *const sys_errlist[]; #endif #ifdef __USE_GNU extern int _sys_nerr; extern const char *const _sys_errlist[]; #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/mathdef.h��������������������������������������������������������������������������������������0000644�����������������00000004215�14763166030�0007276 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2001-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #if !defined _MATH_H && !defined _COMPLEX_H # error "Never use <bits/mathdef.h> directly; include <math.h> instead" #endif #if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF # define _MATH_H_MATHDEF 1 # if defined __x86_64__ || (defined __FLT_EVAL_METHOD__ && __FLT_EVAL_METHOD__ == 0) /* The x86-64 architecture computes values with the precission of the used type. Similarly for -m32 -mfpmath=sse. */ typedef float float_t; /* `float' expressions are evaluated as `float'. */ typedef double double_t; /* `double' expressions are evaluated as `double'. */ # else /* The ix87 FPUs evaluate all values in the 80 bit floating-point format which is also available for the user as `long double'. Therefore we define: */ typedef long double float_t; /* `float' expressions are evaluated as `long double'. */ typedef long double double_t; /* `double' expressions are evaluated as `long double'. */ # endif /* The values returned by `ilogb' for 0 and NaN respectively. */ # define FP_ILOGB0 (-2147483647 - 1) # define FP_ILOGBNAN (-2147483647 - 1) /* The GCC 4.6 compiler will define __FP_FAST_FMA{,F,L} if the fma{,f,l} builtins are supported. */ # ifdef __FP_FAST_FMA # define FP_FAST_FMA 1 # endif # ifdef __FP_FAST_FMAF # define FP_FAST_FMAF 1 # endif # ifdef __FP_FAST_FMAL # define FP_FAST_FMAL 1 # endif #endif /* ISO C99 */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/ipctypes.h�������������������������������������������������������������������������������������0000644�����������������00000002222�14763166030�0007522 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. Copyright (C) 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_IPC_H # error "Never use <bits/ipctypes.h> directly; include <sys/ipc.h> instead." #endif #ifndef _BITS_IPCTYPES_H #define _BITS_IPCTYPES_H 1 /* Used in `struct shmid_ds'. */ # ifdef __x86_64__ typedef int __ipc_pid_t; # else typedef unsigned short int __ipc_pid_t; # endif #endif /* bits/ipctypes.h */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/setjmp2.h��������������������������������������������������������������������������������������0000644�����������������00000003251�14763166030�0007251 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Checking macros for setjmp functions. Copyright (C) 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SETJMP_H # error "Never include <bits/setjmp2.h> directly; use <setjmp.h> instead." #endif /* Variant of the longjmp functions which perform some sanity checking. */ #ifdef __REDIRECT_NTH extern void __REDIRECT_NTHNL (longjmp, (struct __jmp_buf_tag __env[1], int __val), __longjmp_chk) __attribute__ ((__noreturn__)); extern void __REDIRECT_NTHNL (_longjmp, (struct __jmp_buf_tag __env[1], int __val), __longjmp_chk) __attribute__ ((__noreturn__)); extern void __REDIRECT_NTHNL (siglongjmp, (struct __jmp_buf_tag __env[1], int __val), __longjmp_chk) __attribute__ ((__noreturn__)); #else extern void __longjmp_chk (struct __jmp_buf_tag __env[1], int __val), __THROWNL __attribute__ ((__noreturn__)); # define longjmp __longjmp_chk # define _longjmp __longjmp_chk # define siglongjmp __longjmp_chk #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/cmathcalls.h�����������������������������������������������������������������������������������0000644�����������������00000011316�14763166030�0010001 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Prototype declarations for complex math functions; helper file for <complex.h>. Copyright (C) 1997, 1998, 2001, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* NOTE: Because of the special way this file is used by <complex.h>, this file must NOT be protected from multiple inclusion as header files usually are. This file provides prototype declarations for the math functions. Most functions are declared using the macro: __MATHCALL (NAME, (ARGS...)); This means there is a function `NAME' returning `double' and a function `NAMEf' returning `float'. Each place `_Mdouble_' appears in the prototype, that is actually `double' in the prototype for `NAME' and `float' in the prototype for `NAMEf'. Reentrant variant functions are called `NAME_r' and `NAMEf_r'. Functions returning other types like `int' are declared using the macro: __MATHDECL (TYPE, NAME, (ARGS...)); This is just like __MATHCALL but for a function returning `TYPE' instead of `_Mdouble_'. In all of these cases, there is still both a `NAME' and a `NAMEf' that takes `float' arguments. */ #ifndef _COMPLEX_H #error "Never use <bits/cmathcalls.h> directly; include <complex.h> instead." #endif #define _Mdouble_complex_ _Mdouble_ _Complex /* Trigonometric functions. */ /* Arc cosine of Z. */ __MATHCALL (cacos, (_Mdouble_complex_ __z)); /* Arc sine of Z. */ __MATHCALL (casin, (_Mdouble_complex_ __z)); /* Arc tangent of Z. */ __MATHCALL (catan, (_Mdouble_complex_ __z)); /* Cosine of Z. */ __MATHCALL (ccos, (_Mdouble_complex_ __z)); /* Sine of Z. */ __MATHCALL (csin, (_Mdouble_complex_ __z)); /* Tangent of Z. */ __MATHCALL (ctan, (_Mdouble_complex_ __z)); /* Hyperbolic functions. */ /* Hyperbolic arc cosine of Z. */ __MATHCALL (cacosh, (_Mdouble_complex_ __z)); /* Hyperbolic arc sine of Z. */ __MATHCALL (casinh, (_Mdouble_complex_ __z)); /* Hyperbolic arc tangent of Z. */ __MATHCALL (catanh, (_Mdouble_complex_ __z)); /* Hyperbolic cosine of Z. */ __MATHCALL (ccosh, (_Mdouble_complex_ __z)); /* Hyperbolic sine of Z. */ __MATHCALL (csinh, (_Mdouble_complex_ __z)); /* Hyperbolic tangent of Z. */ __MATHCALL (ctanh, (_Mdouble_complex_ __z)); /* Exponential and logarithmic functions. */ /* Exponential function of Z. */ __MATHCALL (cexp, (_Mdouble_complex_ __z)); /* Natural logarithm of Z. */ __MATHCALL (clog, (_Mdouble_complex_ __z)); #ifdef __USE_GNU /* The base 10 logarithm is not defined by the standard but to implement the standard C++ library it is handy. */ __MATHCALL (clog10, (_Mdouble_complex_ __z)); #endif /* Power functions. */ /* Return X to the Y power. */ __MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y)); /* Return the square root of Z. */ __MATHCALL (csqrt, (_Mdouble_complex_ __z)); /* Absolute value, conjugates, and projection. */ /* Absolute value of Z. */ __MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z)); /* Argument value of Z. */ __MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z)); /* Complex conjugate of Z. */ __MATHCALL (conj, (_Mdouble_complex_ __z)); /* Projection of Z onto the Riemann sphere. */ __MATHCALL (cproj, (_Mdouble_complex_ __z)); /* Decomposing complex values. */ /* Imaginary part of Z. */ __MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z)); /* Real part of Z. */ __MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z)); /* Now some optimized versions. GCC has handy notations for these functions. Recent GCC handles these as builtin functions so does not need inlines. */ #if defined __GNUC__ && !__GNUC_PREREQ (2, 97) && defined __OPTIMIZE__ \ && defined __extern_inline /* Imaginary part of Z. */ __extern_inline _Mdouble_ __MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) __THROW { return __imag__ __z; } /* Real part of Z. */ __extern_inline _Mdouble_ __MATH_PRECNAME(creal) (_Mdouble_complex_ __z) __THROW { return __real__ __z; } /* Complex conjugate of Z. */ __extern_inline _Mdouble_complex_ __MATH_PRECNAME(conj) (_Mdouble_complex_ __z) __THROW { return __extension__ ~__z; } #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/errno.h����������������������������������������������������������������������������������������0000644�����������������00000004163�14763166030�0007015 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Error constants. Linux specific version. Copyright (C) 1996-1999, 2005, 2009, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifdef _ERRNO_H # undef EDOM # undef EILSEQ # undef ERANGE # include <linux/errno.h> /* Linux has no ENOTSUP error code. */ # define ENOTSUP EOPNOTSUPP /* Older Linux versions also had no ECANCELED error code. */ # ifndef ECANCELED # define ECANCELED 125 # endif /* Support for error codes to support robust mutexes was added later, too. */ # ifndef EOWNERDEAD # define EOWNERDEAD 130 # define ENOTRECOVERABLE 131 # endif # ifndef ERFKILL # define ERFKILL 132 # endif # ifndef EHWPOISON # define EHWPOISON 133 # endif # ifndef __ASSEMBLER__ /* Function to get address of global `errno' variable. */ extern int *__errno_location (void) __THROW __attribute__ ((__const__)); # if !defined _LIBC || defined _LIBC_REENTRANT /* When using threads, errno is a per-thread value. */ # define errno (*__errno_location ()) # endif # endif /* !__ASSEMBLER__ */ #endif /* _ERRNO_H */ #if !defined _ERRNO_H && defined __need_Emath /* This is ugly but the kernel header is not clean enough. We must define only the values EDOM, EILSEQ and ERANGE in case __need_Emath is defined. */ # define EDOM 33 /* Math argument out of domain of function. */ # define EILSEQ 84 /* Illegal byte sequence. */ # define ERANGE 34 /* Math result not representable. */ #endif /* !_ERRNO_H && __need_Emath */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/ipc.h������������������������������������������������������������������������������������������0000644�����������������00000004006�14763166030�0006437 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1995-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_IPC_H # error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead." #endif #include <bits/types.h> /* Mode bits for `msgget', `semget', and `shmget'. */ #define IPC_CREAT 01000 /* Create key if key does not exist. */ #define IPC_EXCL 02000 /* Fail if key exists. */ #define IPC_NOWAIT 04000 /* Return error on wait. */ /* Control commands for `msgctl', `semctl', and `shmctl'. */ #define IPC_RMID 0 /* Remove identifier. */ #define IPC_SET 1 /* Set `ipc_perm' options. */ #define IPC_STAT 2 /* Get `ipc_perm' options. */ #ifdef __USE_GNU # define IPC_INFO 3 /* See ipcs. */ #endif /* Special key values. */ #define IPC_PRIVATE ((__key_t) 0) /* Private key. */ /* Data structure used to pass permission information to IPC operations. */ struct ipc_perm { __key_t __key; /* Key. */ __uid_t uid; /* Owner's user ID. */ __gid_t gid; /* Owner's group ID. */ __uid_t cuid; /* Creator's user ID. */ __gid_t cgid; /* Creator's group ID. */ unsigned short int mode; /* Read/write permission. */ unsigned short int __pad1; unsigned short int __seq; /* Sequence number. */ unsigned short int __pad2; __syscall_ulong_t __unused1; __syscall_ulong_t __unused2; }; ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/printf-ldbl.h����������������������������������������������������������������������������������0000644�����������������00000001732�14763166030�0010104 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -mlong-double-64 compatibility mode for <printf.h> functions. Copyright (C) 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _PRINTF_H # error "Never include <bits/printf-ldbl.h> directly; use <printf.h> instead." #endif __LDBL_REDIR_DECL (printf_size) ��������������������������������������bits/stdio-lock.h�����������������������������������������������������������������������������������0000644�����������������00000004213�14763166030�0007734 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Thread package specific definitions of stream lock type. Generic version. Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_STDIO_LOCK_H #define _BITS_STDIO_LOCK_H 1 #include <bits/libc-lock.h> __libc_lock_define_recursive (typedef, _IO_lock_t) /* We need recursive (counting) mutexes. */ #ifdef _LIBC_LOCK_RECURSIVE_INITIALIZER # define _IO_lock_initializer _LIBC_LOCK_RECURSIVE_INITIALIZER #elif _IO_MTSAFE_IO #error libio needs recursive mutexes for _IO_MTSAFE_IO #endif #define _IO_lock_init(_name) __libc_lock_init_recursive (_name) #define _IO_lock_fini(_name) __libc_lock_fini_recursive (_name) #define _IO_lock_lock(_name) __libc_lock_lock_recursive (_name) #define _IO_lock_trylock(_name) __libc_lock_trylock_recursive (_name) #define _IO_lock_unlock(_name) __libc_lock_unlock_recursive (_name) #define _IO_cleanup_region_start(_fct, _fp) \ __libc_cleanup_region_start (((_fp)->_flags & _IO_USER_LOCK) == 0, _fct, _fp) #define _IO_cleanup_region_start_noarg(_fct) \ __libc_cleanup_region_start (1, _fct, NULL) #define _IO_cleanup_region_end(_doit) \ __libc_cleanup_region_end (_doit) #if defined _LIBC && IS_IN (libc) # define _IO_acquire_lock(_fp) \ _IO_cleanup_region_start ((void (*) (void *)) _IO_funlockfile, (_fp)); \ _IO_flockfile (_fp) # define _IO_release_lock(_fp) \ _IO_funlockfile (_fp); \ _IO_cleanup_region_end (0) #endif #endif /* bits/stdio-lock.h */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/endian.h���������������������������������������������������������������������������������������0000644�����������������00000000260�14763166030�0007120 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* i386/x86_64 are little-endian. */ #ifndef _ENDIAN_H # error "Never use <bits/endian.h> directly; include <endian.h> instead." #endif #define __BYTE_ORDER __LITTLE_ENDIAN ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/semaphore.h������������������������������������������������������������������������������������0000644�����������������00000002326�14763166030�0007652 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SEMAPHORE_H # error "Never use <bits/semaphore.h> directly; include <semaphore.h> instead." #endif #include <bits/wordsize.h> #if __WORDSIZE == 64 # define __SIZEOF_SEM_T 32 #else # define __SIZEOF_SEM_T 16 #endif /* Value returned if `sem_open' failed. */ #define SEM_FAILED ((sem_t *) 0) typedef union { char __size[__SIZEOF_SEM_T]; long int __align; } sem_t; ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/monetary-ldbl.h��������������������������������������������������������������������������������0000644�����������������00000002021�14763166030�0010430 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -mlong-double-64 compatibility mode for monetary functions. Copyright (C) 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MONETARY_H # error "Never include <bits/monetary-ldbl.h> directly; use <monetary.h> instead." #endif __LDBL_REDIR_DECL (strfmon) #ifdef __USE_GNU __LDBL_REDIR_DECL (strfmon_l) #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������bits/initspin.h�������������������������������������������������������������������������������������0000644�����������������00000000031�14763166030�0007513 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* No thread support. */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������crypt.h���������������������������������������������������������������������������������������������0000644�����������������00000004336�14763166030�0006072 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * UFC-crypt: ultra fast crypt(3) implementation * * Copyright (C) 1991-1993,1996-1998,2000,2004,2012 * Free Software Foundation, Inc. * * The GNU C Library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * The GNU C Library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with the GNU C Library; if not, see * <http://www.gnu.org/licenses/>. * * @(#)crypt.h 1.5 12/20/96 * */ #ifndef _CRYPT_H #define _CRYPT_H 1 #include <features.h> __BEGIN_DECLS /* Encrypt at most 8 characters from KEY using salt to perturb DES. */ extern char *crypt (const char *__key, const char *__salt) __THROW __nonnull ((1, 2)); /* Setup DES tables according KEY. */ extern void setkey (const char *__key) __THROW __nonnull ((1)); /* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt block in place. */ extern void encrypt (char *__block, int __edflag) __THROW __nonnull ((1)); #ifdef __USE_GNU /* Reentrant versions of the functions above. The additional argument points to a structure where the results are placed in. */ struct crypt_data { char keysched[16 * 8]; char sb0[32768]; char sb1[32768]; char sb2[32768]; char sb3[32768]; /* end-of-aligment-critical-data */ char crypt_3_buf[14]; char current_salt[2]; long int current_saltbits; int direction, initialized; }; extern char *crypt_r (const char *__key, const char *__salt, struct crypt_data * __restrict __data) __THROW __nonnull ((1, 2, 3)); extern void setkey_r (const char *__key, struct crypt_data * __restrict __data) __THROW __nonnull ((1, 2)); extern void encrypt_r (char *__block, int __edflag, struct crypt_data * __restrict __data) __THROW __nonnull ((1, 3)); #endif __END_DECLS #endif /* crypt.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libltdl/lt_error.h����������������������������������������������������������������������������������0000644�����������������00000007072�14763166030�0010207 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* lt_error.h -- error propogation interface Copyright (C) 1999, 2000, 2001, 2004, 2007 Free Software Foundation, Inc. Written by Thomas Tanner, 1999 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Only include this header file once. */ #if !defined(LT_ERROR_H) #define LT_ERROR_H 1 #include <libltdl/lt_system.h> LT_BEGIN_C_DECLS /* Defining error strings alongside their symbolic names in a macro in this way allows us to expand the macro in different contexts with confidence that the enumeration of symbolic names will map correctly onto the table of error strings. \0 is appended to the strings to expilicitely initialize the string terminator. */ #define lt_dlerror_table \ LT_ERROR(UNKNOWN, "unknown error\0") \ LT_ERROR(DLOPEN_NOT_SUPPORTED, "dlopen support not available\0") \ LT_ERROR(INVALID_LOADER, "invalid loader\0") \ LT_ERROR(INIT_LOADER, "loader initialization failed\0") \ LT_ERROR(REMOVE_LOADER, "loader removal failed\0") \ LT_ERROR(FILE_NOT_FOUND, "file not found\0") \ LT_ERROR(DEPLIB_NOT_FOUND, "dependency library not found\0") \ LT_ERROR(NO_SYMBOLS, "no symbols defined\0") \ LT_ERROR(CANNOT_OPEN, "can't open the module\0") \ LT_ERROR(CANNOT_CLOSE, "can't close the module\0") \ LT_ERROR(SYMBOL_NOT_FOUND, "symbol not found\0") \ LT_ERROR(NO_MEMORY, "not enough memory\0") \ LT_ERROR(INVALID_HANDLE, "invalid module handle\0") \ LT_ERROR(BUFFER_OVERFLOW, "internal buffer overflow\0") \ LT_ERROR(INVALID_ERRORCODE, "invalid errorcode\0") \ LT_ERROR(SHUTDOWN, "library already shutdown\0") \ LT_ERROR(CLOSE_RESIDENT_MODULE, "can't close resident module\0") \ LT_ERROR(INVALID_MUTEX_ARGS, "internal error (code withdrawn)\0")\ LT_ERROR(INVALID_POSITION, "invalid search path insert position\0")\ LT_ERROR(CONFLICTING_FLAGS, "symbol visibility can be global or local\0") /* Enumerate the symbolic error names. */ enum { #define LT_ERROR(name, diagnostic) LT_CONC(LT_ERROR_, name), lt_dlerror_table #undef LT_ERROR LT_ERROR_MAX }; /* Should be max of the error string lengths above (plus one for C++) */ #define LT_ERROR_LEN_MAX (41) /* These functions are only useful from inside custom module loaders. */ LT_SCOPE int lt_dladderror (const char *diagnostic); LT_SCOPE int lt_dlseterror (int errorcode); LT_END_C_DECLS #endif /*!defined(LT_ERROR_H)*/ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libltdl/lt_system.h���������������������������������������������������������������������������������0000644�����������������00000012373�14763166030�0010402 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* lt_system.h -- system portability abstraction layer Copyright (C) 2004, 2007, 2010 Free Software Foundation, Inc. Written by Gary V. Vaughan, 2004 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if !defined(LT_SYSTEM_H) #define LT_SYSTEM_H 1 #include <stddef.h> #include <stdlib.h> #include <sys/types.h> /* Some systems do not define EXIT_*, even with STDC_HEADERS. */ #if !defined(EXIT_SUCCESS) # define EXIT_SUCCESS 0 #endif #if !defined(EXIT_FAILURE) # define EXIT_FAILURE 1 #endif /* Just pick a big number... */ #define LT_FILENAME_MAX 2048 /* Saves on those hard to debug '\0' typos.... */ #define LT_EOS_CHAR '\0' /* LTDL_BEGIN_C_DECLS should be used at the beginning of your declarations, so that C++ compilers don't mangle their names. Use LTDL_END_C_DECLS at the end of C declarations. */ #if defined(__cplusplus) # define LT_BEGIN_C_DECLS extern "C" { # define LT_END_C_DECLS } #else # define LT_BEGIN_C_DECLS /* empty */ # define LT_END_C_DECLS /* empty */ #endif /* LT_STMT_START/END are used to create macros which expand to a a single compound statement in a portable way. */ #if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus) # define LT_STMT_START (void)( # define LT_STMT_END ) #else # if (defined (sun) || defined (__sun__)) # define LT_STMT_START if (1) # define LT_STMT_END else (void)0 # else # define LT_STMT_START do # define LT_STMT_END while (0) # endif #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif /* Canonicalise Windows and Cygwin recognition macros. To match the values set by recent Cygwin compilers, make sure that if __CYGWIN__ is defined (after canonicalisation), __WINDOWS__ is NOT! */ #if defined(__CYGWIN32__) && !defined(__CYGWIN__) # define __CYGWIN__ __CYGWIN32__ #endif #if defined(__CYGWIN__) # if defined(__WINDOWS__) # undef __WINDOWS__ # endif #elif defined(_WIN32) # define __WINDOWS__ _WIN32 #elif defined(WIN32) # define __WINDOWS__ WIN32 #endif #if defined(__CYGWIN__) && defined(__WINDOWS__) # undef __WINDOWS__ #endif /* DLL building support on win32 hosts; mostly to workaround their ridiculous implementation of data symbol exporting. */ #if !defined(LT_SCOPE) # if defined(__WINDOWS__) || defined(__CYGWIN__) # if defined(DLL_EXPORT) /* defined by libtool (if required) */ # define LT_SCOPE extern __declspec(dllexport) # endif # if defined(LIBLTDL_DLL_IMPORT) /* define if linking with this dll */ /* note: cygwin/mingw compilers can rely instead on auto-import */ # define LT_SCOPE extern __declspec(dllimport) # endif # endif # if !defined(LT_SCOPE) /* static linking or !__WINDOWS__ */ # define LT_SCOPE extern # endif #endif #if defined(__WINDOWS__) /* LT_DIRSEP_CHAR is accepted *in addition* to '/' as a directory separator when it is set. */ # define LT_DIRSEP_CHAR '\\' # define LT_PATHSEP_CHAR ';' #else # define LT_PATHSEP_CHAR ':' #endif #if defined(_MSC_VER) /* Visual Studio */ # define R_OK 4 #endif /* fopen() mode flags for reading a text file */ #undef LT_READTEXT_MODE #if defined(__WINDOWS__) || defined(__CYGWIN__) # define LT_READTEXT_MODE "rt" #else # define LT_READTEXT_MODE "r" #endif /* The extra indirection to the LT__STR and LT__CONC macros is required so that if the arguments to LT_STR() (or LT_CONC()) are themselves macros, they will be expanded before being quoted. */ #ifndef LT_STR # define LT__STR(arg) #arg # define LT_STR(arg) LT__STR(arg) #endif #ifndef LT_CONC # define LT__CONC(a, b) a##b # define LT_CONC(a, b) LT__CONC(a, b) #endif #ifndef LT_CONC3 # define LT__CONC3(a, b, c) a##b##c # define LT_CONC3(a, b, c) LT__CONC3(a, b, c) #endif #endif /*!defined(LT_SYSTEM_H)*/ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libltdl/lt_dlloader.h�������������������������������������������������������������������������������0000644�����������������00000006200�14763166030�0010634 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* lt_dlloader.h -- dynamic library loader interface Copyright (C) 2004, 2007, 2008 Free Software Foundation, Inc. Written by Gary V. Vaughan, 2004 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if !defined(LT_DLLOADER_H) #define LT_DLLOADER_H 1 #include <libltdl/lt_system.h> LT_BEGIN_C_DECLS typedef void * lt_dlloader; typedef void * lt_module; typedef void * lt_user_data; typedef struct lt__advise * lt_dladvise; /* Function pointer types for module loader vtable entries: */ typedef lt_module lt_module_open (lt_user_data data, const char *filename, lt_dladvise advise); typedef int lt_module_close (lt_user_data data, lt_module module); typedef void * lt_find_sym (lt_user_data data, lt_module module, const char *symbolname); typedef int lt_dlloader_init (lt_user_data data); typedef int lt_dlloader_exit (lt_user_data data); /* Default priority is LT_DLLOADER_PREPEND if none is explicitly given. */ typedef enum { LT_DLLOADER_PREPEND = 0, LT_DLLOADER_APPEND } lt_dlloader_priority; /* This structure defines a module loader, as populated by the get_vtable entry point of each loader. */ typedef struct { const char * name; const char * sym_prefix; lt_module_open * module_open; lt_module_close * module_close; lt_find_sym * find_sym; lt_dlloader_init * dlloader_init; lt_dlloader_exit * dlloader_exit; lt_user_data dlloader_data; lt_dlloader_priority priority; } lt_dlvtable; LT_SCOPE int lt_dlloader_add (const lt_dlvtable *vtable); LT_SCOPE lt_dlloader lt_dlloader_next (const lt_dlloader loader); LT_SCOPE lt_dlvtable * lt_dlloader_remove (const char *name); LT_SCOPE const lt_dlvtable *lt_dlloader_find (const char *name); LT_SCOPE const lt_dlvtable *lt_dlloader_get (lt_dlloader loader); /* Type of a function to get a loader's vtable: */ typedef const lt_dlvtable *lt_get_vtable (lt_user_data data); #ifdef LT_DEBUG_LOADERS LT_SCOPE void lt_dlloader_dump (void); #endif LT_END_C_DECLS #endif /*!defined(LT_DLLOADER_H)*/ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������krb5/ccselect_plugin.h������������������������������������������������������������������������������0000644�����������������00000010165�14763166030�0010734 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 by the Massachusetts Institute of Technology. * All rights reserved. * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of M.I.T. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a * fashion that it might be confused with the original M.I.T. software. * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. */ /* * Declarations for credential cache selection module implementors. * * The ccselect pluggable interface currently has only one supported major * version, which is 1. Major version 1 has a current minor version number of * 1. * * Credential cache selection modules should define a function named * ccselect_<modulename>_initvt, matching the signature: * * krb5_error_code * ccselect_modname_initvt(krb5_context context, int maj_ver, int min_ver, * krb5_plugin_vtable vtable); * * The initvt function should: * * - Check that the supplied maj_ver number is supported by the module, or * return KRB5_PLUGIN_VER_NOTSUPP if it is not. * * - Cast the vtable pointer as appropriate for maj_ver: * maj_ver == 1: Cast to krb5_ccselect_vtable * * - Initialize the methods of the vtable, stopping as appropriate for the * supplied min_ver. Optional methods may be left uninitialized. * * Memory for the vtable is allocated by the caller, not by the module. */ #ifndef KRB5_CCSELECT_PLUGIN_H #define KRB5_CCSELECT_PLUGIN_H #include <krb5/krb5.h> #include <krb5/plugin.h> /* An abstract type for credential cache selection module data. */ typedef struct krb5_ccselect_moddata_st *krb5_ccselect_moddata; #define KRB5_CCSELECT_PRIORITY_AUTHORITATIVE 2 #define KRB5_CCSELECT_PRIORITY_HEURISTIC 1 /*** Method type declarations ***/ /* * Mandatory: Initialize module data and set *priority_out to one of the * KRB5_CCSELECT_PRIORITY constants above. Authoritative modules will be * consulted before heuristic ones. */ typedef krb5_error_code (*krb5_ccselect_init_fn)(krb5_context context, krb5_ccselect_moddata *data_out, int *priority_out); /* * Mandatory: Select a cache based on a server principal. Return 0 on success, * with *cache_out set to the selected cache and *princ_out set to its default * principal. Return KRB5_PLUGIN_NO_HANDLE to defer to other modules. Return * KRB5_CC_NOTFOUND with *princ_out set if the client principal can be * authoritatively determined but no cache exists for it. Return other errors * as appropriate. */ typedef krb5_error_code (*krb5_ccselect_choose_fn)(krb5_context context, krb5_ccselect_moddata data, krb5_principal server, krb5_ccache *cache_out, krb5_principal *princ_out); /* Optional: Release resources used by module data. */ typedef void (*krb5_ccselect_fini_fn)(krb5_context context, krb5_ccselect_moddata data); /*** vtable declarations **/ /* Credential cache selection plugin vtable for major version 1. */ typedef struct krb5_ccselect_vtable_st { const char *name; /* Mandatory: name of module. */ krb5_ccselect_init_fn init; krb5_ccselect_choose_fn choose; krb5_ccselect_fini_fn fini; /* Minor version 1 ends here. */ } *krb5_ccselect_vtable; #endif /* KRB5_CCSELECT_PLUGIN_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������krb5/kdcpreauth_plugin.h����������������������������������������������������������������������������0000644�����������������00000040560�14763166030�0011303 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (c) 2006 Red Hat, Inc. * Portions copyright (c) 2006, 2011 Massachusetts Institute of Technology * All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name of Red Hat, Inc., nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Declarations for kdcpreauth plugin module implementors. * * The kdcpreauth interface has a single supported major version, which is 1. * Major version 1 has a current minor version of 3. kdcpreauth modules should * define a function named kdcpreauth_<modulename>_initvt, matching the * signature: * * krb5_error_code * kdcpreauth_modname_initvt(krb5_context context, int maj_ver, int min_ver, * krb5_plugin_vtable vtable); * * The initvt function should: * * - Check that the supplied maj_ver number is supported by the module, or * return KRB5_PLUGIN_VER_NOTSUPP if it is not. * * - Cast the vtable pointer as appropriate for the interface and maj_ver: * kdcpreauth, maj_ver == 1: Cast to krb5_kdcpreauth_vtable * * - Initialize the methods of the vtable, stopping as appropriate for the * supplied min_ver. Optional methods may be left uninitialized. * * Memory for the vtable is allocated by the caller, not by the module. */ #ifndef KRB5_KDCPREAUTH_PLUGIN_H #define KRB5_KDCPREAUTH_PLUGIN_H #include <krb5/krb5.h> #include <krb5/plugin.h> /* kdcpreauth mechanism property flags */ /* * Causes the KDC to include this mechanism in a list of supported preauth * types if the user's DB entry flags the user as requiring hardware-based * preauthentication. */ #define PA_HARDWARE 0x00000004 /* * Causes the KDC to include this mechanism in a list of supported preauth * types if the user's DB entry flags the user as requiring preauthentication, * and to fail preauthentication if we can't verify the client data. The * flipside of PA_SUFFICIENT. */ #define PA_REQUIRED 0x00000008 /* * Causes the KDC to include this mechanism in a list of supported preauth * types if the user's DB entry flags the user as requiring preauthentication, * and to mark preauthentication as successful if we can verify the client * data. The flipside of PA_REQUIRED. */ #define PA_SUFFICIENT 0x00000010 /* * Marks this preauthentication mechanism as one which changes the key which is * used for encrypting the response to the client. Modules which have this * flag have their server_return_fn called before modules which do not, and are * passed over if a previously-called module has modified the encrypting key. */ #define PA_REPLACES_KEY 0x00000020 /* * Not really a padata type, so don't include it in any list of preauth types * which gets sent over the wire. */ #define PA_PSEUDO 0x00000080 /* * Indicates that e_data in non-FAST errors should be encoded as typed data * instead of padata. */ #define PA_TYPED_E_DATA 0x00000100 /* Abstract type for a KDC callback data handle. */ typedef struct krb5_kdcpreauth_rock_st *krb5_kdcpreauth_rock; /* Abstract type for module data and per-request module data. */ typedef struct krb5_kdcpreauth_moddata_st *krb5_kdcpreauth_moddata; typedef struct krb5_kdcpreauth_modreq_st *krb5_kdcpreauth_modreq; /* The verto context structure type (typedef is in verto.h; we want to avoid a * header dependency for the moment). */ struct verto_ctx; /* Before using a callback after version 1, modules must check the vers * field of the callback structure. */ typedef struct krb5_kdcpreauth_callbacks_st { int vers; krb5_deltat (*max_time_skew)(krb5_context context, krb5_kdcpreauth_rock rock); /* * Get an array of krb5_keyblock structures containing the client keys * matching the request enctypes, terminated by an entry with key type = 0. * Returns ENOENT if no keys are available for the request enctypes. Free * the resulting object with the free_keys callback. */ krb5_error_code (*client_keys)(krb5_context context, krb5_kdcpreauth_rock rock, krb5_keyblock **keys_out); /* Free the result of client_keys. */ void (*free_keys)(krb5_context context, krb5_kdcpreauth_rock rock, krb5_keyblock *keys); /* * Get the encoded request body, which is sometimes needed for checksums. * For a FAST request this is the encoded inner request body. The returned * pointer is an alias and should not be freed. */ krb5_data *(*request_body)(krb5_context context, krb5_kdcpreauth_rock rock); /* Get a pointer to the FAST armor key, or NULL if the request did not use * FAST. The returned pointer is an alias and should not be freed. */ krb5_keyblock *(*fast_armor)(krb5_context context, krb5_kdcpreauth_rock rock); /* Retrieve a string attribute from the client DB entry, or NULL if no such * attribute is set. Free the result with the free_string callback. */ krb5_error_code (*get_string)(krb5_context context, krb5_kdcpreauth_rock rock, const char *key, char **value_out); /* Free the result of get_string. */ void (*free_string)(krb5_context context, krb5_kdcpreauth_rock rock, char *string); /* Get a pointer to the client DB entry (returned as a void pointer to * avoid a dependency on a libkdb5 type). */ void *(*client_entry)(krb5_context context, krb5_kdcpreauth_rock rock); /* Get a pointer to the verto context which should be used by an * asynchronous edata or verify method. */ struct verto_ctx *(*event_context)(krb5_context context, krb5_kdcpreauth_rock rock); /* End of version 1 kdcpreauth callbacks. */ /* Return true if the client DB entry contains any keys matching the * request enctypes. */ krb5_boolean (*have_client_keys)(krb5_context context, krb5_kdcpreauth_rock rock); /* End of version 2 kdcpreauth callbacks. */ /* * Get the decrypted client long-term key chosen according to the request * enctype list, or NULL if no matching key was found. The returned * pointer is an alias and should not be freed. If invoked from * return_padata, the result will be the same as the encrypting_key * parameter if it is not NULL, and will therefore reflect the modified * reply key if a return_padata handler has replaced the reply key. */ const krb5_keyblock *(*client_keyblock)(krb5_context context, krb5_kdcpreauth_rock rock); /* Assert an authentication indicator in the AS-REP authdata. Duplicate * indicators will be ignored. */ krb5_error_code (*add_auth_indicator)(krb5_context context, krb5_kdcpreauth_rock rock, const char *indicator); /* * Read a data value for pa_type from the request cookie, placing it in * *out. The value placed there is an alias and must not be freed. * Returns true if a value for pa_type was retrieved, false if not. */ krb5_boolean (*get_cookie)(krb5_context context, krb5_kdcpreauth_rock rock, krb5_preauthtype pa_type, krb5_data *out); /* * Set a data value for pa_type to be sent in a secure cookie in the next * error response. If pa_type is already present, the value is ignored. * If the preauth mechanism has different preauth types for requests and * responses, use the request type. Secure cookies are encrypted in a key * known only to the KDCs, but can be replayed within a short time window * for requests using the same client principal. */ krb5_error_code (*set_cookie)(krb5_context context, krb5_kdcpreauth_rock rock, krb5_preauthtype pa_type, const krb5_data *data); /* End of version 3 kdcpreauth callbacks. */ /* * Return true if princ matches the principal named in the request or the * client principal (possibly canonicalized). If princ does not match, * attempt a database lookup of princ with aliases allowed and compare the * result to the client principal, returning true if it matches. * Otherwise, return false. */ krb5_boolean (*match_client)(krb5_context context, krb5_kdcpreauth_rock rock, krb5_principal princ); /* * Get an alias to the client DB entry principal (possibly canonicalized). */ krb5_principal (*client_name)(krb5_context context, krb5_kdcpreauth_rock rock); /* End of version 4 kdcpreauth callbacks. */ } *krb5_kdcpreauth_callbacks; /* Optional: preauth plugin initialization function. */ typedef krb5_error_code (*krb5_kdcpreauth_init_fn)(krb5_context context, krb5_kdcpreauth_moddata *moddata_out, const char **realmnames); /* Optional: preauth plugin cleanup function. */ typedef void (*krb5_kdcpreauth_fini_fn)(krb5_context context, krb5_kdcpreauth_moddata moddata); /* * Optional: return the flags which the KDC should use for this module. This * is a callback instead of a static value because the module may or may not * wish to count itself as a hardware preauthentication module (in other words, * the flags may be affected by the configuration, for example if a site * administrator can force a particular preauthentication type to be supported * using only hardware). This function is called for each entry entry in the * server_pa_type_list. */ typedef int (*krb5_kdcpreauth_flags_fn)(krb5_context context, krb5_preauthtype pa_type); /* * Responder for krb5_kdcpreauth_edata_fn. If invoked with a non-zero code, pa * will be ignored and the padata type will not be included in the hint list. * If invoked with a zero code and a null pa value, the padata type will be * included in the list with an empty value. If invoked with a zero code and a * non-null pa value, pa will be included in the hint list and will later be * freed by the KDC. */ typedef void (*krb5_kdcpreauth_edata_respond_fn)(void *arg, krb5_error_code code, krb5_pa_data *pa); /* * Optional: provide pa_data to send to the client as part of the "you need to * use preauthentication" error. The implementation must invoke the respond * when complete, whether successful or not, either before returning or * asynchronously using the verto context returned by cb->event_context(). * * This function is not allowed to create a modreq object because we have no * guarantee that the client will ever make a follow-up request, or that it * will hit this KDC if it does. */ typedef void (*krb5_kdcpreauth_edata_fn)(krb5_context context, krb5_kdc_req *request, krb5_kdcpreauth_callbacks cb, krb5_kdcpreauth_rock rock, krb5_kdcpreauth_moddata moddata, krb5_preauthtype pa_type, krb5_kdcpreauth_edata_respond_fn respond, void *arg); /* * Responder for krb5_kdcpreauth_verify_fn. Invoke with the arg parameter * supplied to verify, the error code (0 for success), an optional module * request state object to be consumed by return_fn or free_modreq_fn, optional * e_data to be passed to the caller if code is nonzero, and optional * authorization data to be included in the ticket. In non-FAST replies, * e_data will be encoded as typed-data if the module sets the PA_TYPED_E_DATA * flag, and as pa-data otherwise. e_data and authz_data will be freed by the * KDC. */ typedef void (*krb5_kdcpreauth_verify_respond_fn)(void *arg, krb5_error_code code, krb5_kdcpreauth_modreq modreq, krb5_pa_data **e_data, krb5_authdata **authz_data); /* * Optional: verify preauthentication data sent by the client, setting the * TKT_FLG_PRE_AUTH or TKT_FLG_HW_AUTH flag in the enc_tkt_reply's "flags" * field as appropriate. The implementation must invoke the respond function * when complete, whether successful or not, either before returning or * asynchronously using the verto context returned by cb->event_context(). */ typedef void (*krb5_kdcpreauth_verify_fn)(krb5_context context, krb5_data *req_pkt, krb5_kdc_req *request, krb5_enc_tkt_part *enc_tkt_reply, krb5_pa_data *data, krb5_kdcpreauth_callbacks cb, krb5_kdcpreauth_rock rock, krb5_kdcpreauth_moddata moddata, krb5_kdcpreauth_verify_respond_fn respond, void *arg); /* * Optional: generate preauthentication response data to send to the client as * part of the AS-REP. If it needs to override the key which is used to * encrypt the response, it can do so. */ typedef krb5_error_code (*krb5_kdcpreauth_return_fn)(krb5_context context, krb5_pa_data *padata, krb5_data *req_pkt, krb5_kdc_req *request, krb5_kdc_rep *reply, krb5_keyblock *encrypting_key, krb5_pa_data **send_pa_out, krb5_kdcpreauth_callbacks cb, krb5_kdcpreauth_rock rock, krb5_kdcpreauth_moddata moddata, krb5_kdcpreauth_modreq modreq); /* Optional: free a per-request context. */ typedef void (*krb5_kdcpreauth_free_modreq_fn)(krb5_context, krb5_kdcpreauth_moddata moddata, krb5_kdcpreauth_modreq modreq); /* Optional: invoked after init_fn to provide the module with a pointer to the * verto main loop. */ typedef krb5_error_code (*krb5_kdcpreauth_loop_fn)(krb5_context context, krb5_kdcpreauth_moddata moddata, struct verto_ctx *ctx); typedef struct krb5_kdcpreauth_vtable_st { /* Mandatory: name of module. */ char *name; /* Mandatory: pointer to zero-terminated list of pa_types which this module * can provide services for. */ krb5_preauthtype *pa_type_list; krb5_kdcpreauth_init_fn init; krb5_kdcpreauth_fini_fn fini; krb5_kdcpreauth_flags_fn flags; krb5_kdcpreauth_edata_fn edata; krb5_kdcpreauth_verify_fn verify; krb5_kdcpreauth_return_fn return_padata; krb5_kdcpreauth_free_modreq_fn free_modreq; /* Minor 1 ends here. */ krb5_kdcpreauth_loop_fn loop; /* Minor 2 ends here. */ } *krb5_kdcpreauth_vtable; #endif /* KRB5_KDCPREAUTH_PLUGIN_H */ ������������������������������������������������������������������������������������������������������������������������������������������������krb5/krb5.h�����������������������������������������������������������������������������������������0000644�����������������00001233557�14763166030�0006451 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* This file is generated, please don't edit it directly. */ #ifndef KRB5_KRB5_H_INCLUDED #define KRB5_KRB5_H_INCLUDED /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* General definitions for Kerberos version 5. */ /* * Copyright 1989, 1990, 1995, 2001, 2003, 2007, 2011 by the Massachusetts * Institute of Technology. All Rights Reserved. * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of M.I.T. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a * fashion that it might be confused with the original M.I.T. software. * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. */ /* * Copyright (C) 1998 by the FundsXpress, INC. * * All rights reserved. * * Export of this software from the United States of America may require * a specific license from the United States Government. It is the * responsibility of any person or organization contemplating export to * obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of FundsXpress. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. FundsXpress makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ #ifndef KRB5_GENERAL__ #define KRB5_GENERAL__ /** @defgroup KRB5_H krb5 library API * @{ */ /* By default, do not expose deprecated interfaces. */ #ifndef KRB5_DEPRECATED #define KRB5_DEPRECATED 0 #endif #if defined(__MACH__) && defined(__APPLE__) # include <TargetConditionals.h> # if TARGET_RT_MAC_CFM # error "Use KfM 4.0 SDK headers for CFM compilation." # endif #endif #if defined(_MSDOS) || defined(_WIN32) #include <win-mac.h> #endif #ifndef KRB5_CONFIG__ #ifndef KRB5_CALLCONV #define KRB5_CALLCONV #define KRB5_CALLCONV_C #endif /* !KRB5_CALLCONV */ #endif /* !KRB5_CONFIG__ */ #ifndef KRB5_CALLCONV_WRONG #define KRB5_CALLCONV_WRONG #endif #ifndef THREEPARAMOPEN #define THREEPARAMOPEN(x,y,z) open(x,y,z) #endif #if KRB5_PRIVATE #ifndef WRITABLEFOPEN #define WRITABLEFOPEN(x,y) fopen(x,y) #endif #endif #define KRB5_OLD_CRYPTO #include <stdlib.h> #include <limits.h> /* for *_MAX */ #include <stdarg.h> #include <stdint.h> #ifndef KRB5INT_BEGIN_DECLS #if defined(__cplusplus) #define KRB5INT_BEGIN_DECLS extern "C" { #define KRB5INT_END_DECLS } #else #define KRB5INT_BEGIN_DECLS #define KRB5INT_END_DECLS #endif #endif KRB5INT_BEGIN_DECLS #if TARGET_OS_MAC # pragma pack(push,2) #endif #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 30203 # define KRB5_ATTR_DEPRECATED __attribute__((deprecated)) #elif defined _WIN32 # define KRB5_ATTR_DEPRECATED __declspec(deprecated) #else # define KRB5_ATTR_DEPRECATED #endif /* from profile.h */ struct _profile_t; /* typedef struct _profile_t *profile_t; */ /* * begin wordsize.h */ /* * Word-size related definition. */ typedef uint8_t krb5_octet; typedef int16_t krb5_int16; typedef uint16_t krb5_ui_2; typedef int32_t krb5_int32; typedef uint32_t krb5_ui_4; #define VALID_INT_BITS INT_MAX #define VALID_UINT_BITS UINT_MAX #define KRB5_INT32_MAX 2147483647 /* this strange form is necessary since - is a unary operator, not a sign indicator */ #define KRB5_INT32_MIN (-KRB5_INT32_MAX-1) #define KRB5_INT16_MAX 65535 /* this strange form is necessary since - is a unary operator, not a sign indicator */ #define KRB5_INT16_MIN (-KRB5_INT16_MAX-1) /* * end wordsize.h */ /* * begin "base-defs.h" */ /* * Basic definitions for Kerberos V5 library */ #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE 1 #endif typedef unsigned int krb5_boolean; typedef unsigned int krb5_msgtype; typedef unsigned int krb5_kvno; typedef krb5_int32 krb5_addrtype; typedef krb5_int32 krb5_enctype; typedef krb5_int32 krb5_cksumtype; typedef krb5_int32 krb5_authdatatype; typedef krb5_int32 krb5_keyusage; typedef krb5_int32 krb5_cryptotype; typedef krb5_int32 krb5_preauthtype; /* This may change, later on */ typedef krb5_int32 krb5_flags; /** * Represents a timestamp in seconds since the POSIX epoch. This legacy type * is used frequently in the ABI, but cannot represent timestamps after 2038 as * a positive number. Code which uses this type should cast values of it to * uint32_t so that negative values are treated as timestamps between 2038 and * 2106 on platforms with 64-bit time_t. */ typedef krb5_int32 krb5_timestamp; typedef krb5_int32 krb5_deltat; /** * Used to convey an operation status. The value 0 indicates success; any * other values are com_err codes. Use krb5_get_error_message() to obtain a * string describing the error. */ typedef krb5_int32 krb5_error_code; typedef krb5_error_code krb5_magic; typedef struct _krb5_data { krb5_magic magic; unsigned int length; char *data; } krb5_data; /* Originally introduced for PKINIT; now unused. Do not use this. */ typedef struct _krb5_octet_data { krb5_magic magic; unsigned int length; krb5_octet *data; } krb5_octet_data; /* Originally used to recognize AFS and default salts. No longer used. */ #define SALT_TYPE_AFS_LENGTH UINT_MAX #define SALT_TYPE_NO_LENGTH UINT_MAX typedef void * krb5_pointer; typedef void const * krb5_const_pointer; typedef struct krb5_principal_data { krb5_magic magic; krb5_data realm; krb5_data *data; /**< An array of strings */ krb5_int32 length; krb5_int32 type; } krb5_principal_data; typedef krb5_principal_data * krb5_principal; /* * Per V5 spec on definition of principal types */ #define KRB5_NT_UNKNOWN 0 /**< Name type not known */ #define KRB5_NT_PRINCIPAL 1 /**< Just the name of the principal as in DCE, or for users */ #define KRB5_NT_SRV_INST 2 /**< Service and other unique instance (krbtgt) */ #define KRB5_NT_SRV_HST 3 /**< Service with host name as instance (telnet, rcommands) */ #define KRB5_NT_SRV_XHST 4 /**< Service with host as remaining components */ #define KRB5_NT_UID 5 /**< Unique ID */ #define KRB5_NT_X500_PRINCIPAL 6 /**< PKINIT */ #define KRB5_NT_SMTP_NAME 7 /**< Name in form of SMTP email name */ #define KRB5_NT_ENTERPRISE_PRINCIPAL 10 /**< Windows 2000 UPN */ #define KRB5_NT_WELLKNOWN 11 /**< Well-known (special) principal */ #define KRB5_WELLKNOWN_NAMESTR "WELLKNOWN" /**< First component of NT_WELLKNOWN principals */ #define KRB5_NT_MS_PRINCIPAL -128 /**< Windows 2000 UPN and SID */ #define KRB5_NT_MS_PRINCIPAL_AND_ID -129 /**< NT 4 style name */ #define KRB5_NT_ENT_PRINCIPAL_AND_ID -130 /**< NT 4 style name and SID */ /** Constant version of krb5_principal_data */ typedef const krb5_principal_data *krb5_const_principal; #define krb5_princ_realm(context, princ) (&(princ)->realm) #define krb5_princ_set_realm(context, princ,value) ((princ)->realm = *(value)) #define krb5_princ_set_realm_length(context, princ,value) (princ)->realm.length = (value) #define krb5_princ_set_realm_data(context, princ,value) (princ)->realm.data = (value) #define krb5_princ_size(context, princ) (princ)->length #define krb5_princ_type(context, princ) (princ)->type #define krb5_princ_name(context, princ) (princ)->data #define krb5_princ_component(context, princ,i) \ (((i) < krb5_princ_size(context, princ)) \ ? (princ)->data + (i) \ : NULL) /** Constant for realm referrals. */ #define KRB5_REFERRAL_REALM "" /* * Referral-specific functions. */ /** * Check for a match with KRB5_REFERRAL_REALM. * * @param [in] r Realm to check * * @return @c TRUE if @a r is zero-length, @c FALSE otherwise */ krb5_boolean KRB5_CALLCONV krb5_is_referral_realm(const krb5_data *r); /** * Return an anonymous realm data. * * This function returns constant storage that must not be freed. * * @sa #KRB5_ANONYMOUS_REALMSTR */ const krb5_data *KRB5_CALLCONV krb5_anonymous_realm(void); /** * Build an anonymous principal. * * This function returns constant storage that must not be freed. * * @sa #KRB5_ANONYMOUS_PRINCSTR */ krb5_const_principal KRB5_CALLCONV krb5_anonymous_principal(void); #define KRB5_ANONYMOUS_REALMSTR "WELLKNOWN:ANONYMOUS" /**< Anonymous realm */ #define KRB5_ANONYMOUS_PRINCSTR "ANONYMOUS" /**< Anonymous principal name */ /* * end "base-defs.h" */ /* * begin "hostaddr.h" */ /** Structure for address */ typedef struct _krb5_address { krb5_magic magic; krb5_addrtype addrtype; unsigned int length; krb5_octet *contents; } krb5_address; /* per Kerberos v5 protocol spec */ #define ADDRTYPE_INET 0x0002 #define ADDRTYPE_CHAOS 0x0005 #define ADDRTYPE_XNS 0x0006 #define ADDRTYPE_ISO 0x0007 #define ADDRTYPE_DDP 0x0010 #define ADDRTYPE_NETBIOS 0x0014 #define ADDRTYPE_INET6 0x0018 /* not yet in the spec... */ #define ADDRTYPE_ADDRPORT 0x0100 #define ADDRTYPE_IPPORT 0x0101 /* macros to determine if a type is a local type */ #define ADDRTYPE_IS_LOCAL(addrtype) (addrtype & 0x8000) /* * end "hostaddr.h" */ struct _krb5_context; typedef struct _krb5_context * krb5_context; struct _krb5_auth_context; typedef struct _krb5_auth_context * krb5_auth_context; struct _krb5_cryptosystem_entry; /* * begin "encryption.h" */ /** Exposed contents of a key. */ typedef struct _krb5_keyblock { krb5_magic magic; krb5_enctype enctype; unsigned int length; krb5_octet *contents; } krb5_keyblock; struct krb5_key_st; /** * Opaque identifier for a key. * * Use with the krb5_k APIs for better performance for repeated operations with * the same key and usage. Key identifiers must not be used simultaneously * within multiple threads, as they may contain mutable internal state and are * not mutex-protected. */ typedef struct krb5_key_st *krb5_key; #ifdef KRB5_OLD_CRYPTO typedef struct _krb5_encrypt_block { krb5_magic magic; krb5_enctype crypto_entry; /* to call krb5_encrypt_size, you need this. it was a pointer, but it doesn't have to be. gross. */ krb5_keyblock *key; } krb5_encrypt_block; #endif typedef struct _krb5_checksum { krb5_magic magic; krb5_cksumtype checksum_type; /* checksum type */ unsigned int length; krb5_octet *contents; } krb5_checksum; typedef struct _krb5_enc_data { krb5_magic magic; krb5_enctype enctype; krb5_kvno kvno; krb5_data ciphertext; } krb5_enc_data; /** * Structure to describe a region of text to be encrypted or decrypted. * * The @a flags member describes the type of the iov. * The @a data member points to the memory that will be manipulated. * All iov APIs take a pointer to the first element of an array of krb5_crypto_iov's * along with the size of that array. Buffer contents are manipulated in-place; * data is overwritten. Callers must allocate the right number of krb5_crypto_iov * structures before calling into an iov API. */ typedef struct _krb5_crypto_iov { krb5_cryptotype flags; /**< @ref KRB5_CRYPTO_TYPE type of the iov */ krb5_data data; } krb5_crypto_iov; /* per Kerberos v5 protocol spec */ #define ENCTYPE_NULL 0x0000 #define ENCTYPE_DES_CBC_CRC 0x0001 /**< DES cbc mode with CRC-32 */ #define ENCTYPE_DES_CBC_MD4 0x0002 /**< DES cbc mode with RSA-MD4 */ #define ENCTYPE_DES_CBC_MD5 0x0003 /**< DES cbc mode with RSA-MD5 */ #define ENCTYPE_DES_CBC_RAW 0x0004 /**< @deprecated DES cbc mode raw */ #define ENCTYPE_DES3_CBC_SHA 0x0005 /**< @deprecated DES-3 cbc with SHA1 */ #define ENCTYPE_DES3_CBC_RAW 0x0006 /**< @deprecated DES-3 cbc mode raw */ #define ENCTYPE_DES_HMAC_SHA1 0x0008 /**< @deprecated */ /* PKINIT */ #define ENCTYPE_DSA_SHA1_CMS 0x0009 /**< DSA with SHA1, CMS signature */ #define ENCTYPE_MD5_RSA_CMS 0x000a /**< MD5 with RSA, CMS signature */ #define ENCTYPE_SHA1_RSA_CMS 0x000b /**< SHA1 with RSA, CMS signature */ #define ENCTYPE_RC2_CBC_ENV 0x000c /**< RC2 cbc mode, CMS enveloped data */ #define ENCTYPE_RSA_ENV 0x000d /**< RSA encryption, CMS enveloped data */ #define ENCTYPE_RSA_ES_OAEP_ENV 0x000e /**< RSA w/OEAP encryption, CMS enveloped data */ #define ENCTYPE_DES3_CBC_ENV 0x000f /**< DES-3 cbc mode, CMS enveloped data */ #define ENCTYPE_DES3_CBC_SHA1 0x0010 #define ENCTYPE_AES128_CTS_HMAC_SHA1_96 0x0011 /**< RFC 3962 */ #define ENCTYPE_AES256_CTS_HMAC_SHA1_96 0x0012 /**< RFC 3962 */ #define ENCTYPE_AES128_CTS_HMAC_SHA256_128 0x0013 /**< RFC 8009 */ #define ENCTYPE_AES256_CTS_HMAC_SHA384_192 0x0014 /**< RFC 8009 */ #define ENCTYPE_ARCFOUR_HMAC 0x0017 /**< RFC 4757 */ #define ENCTYPE_ARCFOUR_HMAC_EXP 0x0018 /**< RFC 4757 */ #define ENCTYPE_CAMELLIA128_CTS_CMAC 0x0019 /**< RFC 6803 */ #define ENCTYPE_CAMELLIA256_CTS_CMAC 0x001a /**< RFC 6803 */ #define ENCTYPE_UNKNOWN 0x01ff #define CKSUMTYPE_CRC32 0x0001 #define CKSUMTYPE_RSA_MD4 0x0002 #define CKSUMTYPE_RSA_MD4_DES 0x0003 #define CKSUMTYPE_DESCBC 0x0004 /* des-mac-k */ /* rsa-md4-des-k */ #define CKSUMTYPE_RSA_MD5 0x0007 #define CKSUMTYPE_RSA_MD5_DES 0x0008 #define CKSUMTYPE_NIST_SHA 0x0009 #define CKSUMTYPE_HMAC_SHA1_DES3 0x000c #define CKSUMTYPE_HMAC_SHA1_96_AES128 0x000f /**< RFC 3962. Used with ENCTYPE_AES128_CTS_HMAC_SHA1_96 */ #define CKSUMTYPE_HMAC_SHA1_96_AES256 0x0010 /**< RFC 3962. Used with ENCTYPE_AES256_CTS_HMAC_SHA1_96 */ #define CKSUMTYPE_HMAC_SHA256_128_AES128 0x0013 /**< RFC 8009 */ #define CKSUMTYPE_HMAC_SHA384_192_AES256 0x0014 /**< RFC 8009 */ #define CKSUMTYPE_CMAC_CAMELLIA128 0x0011 /**< RFC 6803 */ #define CKSUMTYPE_CMAC_CAMELLIA256 0x0012 /**< RFC 6803 */ #define CKSUMTYPE_MD5_HMAC_ARCFOUR -137 /* Microsoft netlogon */ #define CKSUMTYPE_HMAC_MD5_ARCFOUR -138 /**< RFC 4757 */ /* * The following are entropy source designations. Whenever * krb5_C_random_add_entropy is called, one of these source ids is passed in. * This allows the library to better estimate bits of entropy in the sample and * to keep track of what sources of entropy have contributed enough entropy. * Sources marked internal MUST NOT be used by applications outside the * Kerberos library */ enum { KRB5_C_RANDSOURCE_OLDAPI = 0, /*calls to krb5_C_RANDOM_SEED (INTERNAL)*/ KRB5_C_RANDSOURCE_OSRAND = 1, /* /dev/random or equivalent (internal)*/ KRB5_C_RANDSOURCE_TRUSTEDPARTY = 2, /* From KDC or other trusted party*/ /* * This source should be used carefully; data in this category * should be from a third party trusted to give random bits * For example keys issued by the KDC in the application server. */ KRB5_C_RANDSOURCE_TIMING = 3, /* Timing of operations*/ KRB5_C_RANDSOURCE_EXTERNAL_PROTOCOL = 4, /*Protocol data possibly from attacker*/ KRB5_C_RANDSOURCE_MAX = 5 /*Do not use; maximum source ID*/ }; #ifndef krb5_roundup /* round x up to nearest multiple of y */ #define krb5_roundup(x, y) ((((x) + (y) - 1)/(y))*(y)) #endif /* roundup */ /* macro function definitions to help clean up code */ #if 1 #define krb5_x(ptr,args) ((ptr)?((*(ptr)) args):(abort(),1)) #define krb5_xc(ptr,args) ((ptr)?((*(ptr)) args):(abort(),(char*)0)) #else #define krb5_x(ptr,args) ((*(ptr)) args) #define krb5_xc(ptr,args) ((*(ptr)) args) #endif /** * Encrypt data using a key (operates on keyblock). * * @param [in] context Library context * @param [in] key Encryption key * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in,out] cipher_state Cipher state; specify NULL if not needed * @param [in] input Data to be encrypted * @param [out] output Encrypted data * * This function encrypts the data block @a input and stores the output into @a * output. The actual encryption key will be derived from @a key and @a usage * if key derivation is specified for the encryption type. If non-null, @a * cipher_state specifies the beginning state for the encryption operation, and * is updated with the state to be passed as input to the next operation. * * @note The caller must initialize @a output and allocate at least enough * space for the result (using krb5_c_encrypt_length() to determine the amount * of space needed). @a output->length will be set to the actual length of the * ciphertext. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_encrypt(krb5_context context, const krb5_keyblock *key, krb5_keyusage usage, const krb5_data *cipher_state, const krb5_data *input, krb5_enc_data *output); /** * Decrypt data using a key (operates on keyblock). * * @param [in] context Library context * @param [in] key Encryption key * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in,out] cipher_state Cipher state; specify NULL if not needed * @param [in] input Encrypted data * @param [out] output Decrypted data * * This function decrypts the data block @a input and stores the output into @a * output. The actual decryption key will be derived from @a key and @a usage * if key derivation is specified for the encryption type. If non-null, @a * cipher_state specifies the beginning state for the decryption operation, and * is updated with the state to be passed as input to the next operation. * * @note The caller must initialize @a output and allocate at least enough * space for the result. The usual practice is to allocate an output buffer as * long as the ciphertext, and let krb5_c_decrypt() trim @a output->length. * For some enctypes, the resulting @a output->length may include padding * bytes. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_decrypt(krb5_context context, const krb5_keyblock *key, krb5_keyusage usage, const krb5_data *cipher_state, const krb5_enc_data *input, krb5_data *output); /** * Compute encrypted data length. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [in] inputlen Length of the data to be encrypted * @param [out] length Length of the encrypted data * * This function computes the length of the ciphertext produced by encrypting * @a inputlen bytes including padding, confounder, and checksum. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_encrypt_length(krb5_context context, krb5_enctype enctype, size_t inputlen, size_t *length); /** * Return cipher block size. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [out] blocksize Block size for @a enctype * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_block_size(krb5_context context, krb5_enctype enctype, size_t *blocksize); /** * Return length of the specified key in bytes. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [out] keybytes Number of bytes required to make a key * @param [out] keylength Length of final key * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_keylengths(krb5_context context, krb5_enctype enctype, size_t *keybytes, size_t *keylength); /** * Initialize a new cipher state. * * @param [in] context Library context * @param [in] key Key * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [out] new_state New cipher state * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_init_state(krb5_context context, const krb5_keyblock *key, krb5_keyusage usage, krb5_data *new_state); /** * Free a cipher state previously allocated by krb5_c_init_state(). * * @param [in] context Library context * @param [in] key Key * @param [in] state Cipher state to be freed * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_free_state(krb5_context context, const krb5_keyblock *key, krb5_data *state); /** * Generate enctype-specific pseudo-random bytes. * * @param [in] context Library context * @param [in] keyblock Key * @param [in] input Input data * @param [out] output Output data * * This function selects a pseudo-random function based on @a keyblock and * computes its value over @a input, placing the result into @a output. * The caller must preinitialize @a output and allocate space for the * result, using krb5_c_prf_length() to determine the required length. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_prf(krb5_context context, const krb5_keyblock *keyblock, krb5_data *input, krb5_data *output); /** * Get the output length of pseudo-random functions for an encryption type. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [out] len Length of PRF output * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_prf_length(krb5_context context, krb5_enctype enctype, size_t *len); /** * Generate pseudo-random bytes using RFC 6113 PRF+. * * @param [in] context Library context * @param [in] k KDC contribution key * @param [in] input Input data * @param [out] output Pseudo-random output buffer * * This function fills @a output with PRF+(k, input) as defined in RFC 6113 * section 5.1. The caller must preinitialize @a output and allocate the * desired amount of space. The length of the pseudo-random output will match * the length of @a output. * * @note RFC 4402 defines a different PRF+ operation. This function does not * implement that operation. * * @return 0 on success, @c E2BIG if output->length is too large for PRF+ to * generate, @c ENOMEM on allocation failure, or an error code from * krb5_c_prf() */ krb5_error_code KRB5_CALLCONV krb5_c_prfplus(krb5_context context, const krb5_keyblock *k, const krb5_data *input, krb5_data *output); /** * Derive a key using some input data (via RFC 6113 PRF+). * * @param [in] context Library context * @param [in] k KDC contribution key * @param [in] input Input string * @param [in] enctype Output key enctype (or @c ENCTYPE_NULL) * @param [out] out Derived keyblock * * This function uses PRF+ as defined in RFC 6113 to derive a key from another * key and an input string. If @a enctype is @c ENCTYPE_NULL, the output key * will have the same enctype as the input key. */ krb5_error_code KRB5_CALLCONV krb5_c_derive_prfplus(krb5_context context, const krb5_keyblock *k, const krb5_data *input, krb5_enctype enctype, krb5_keyblock **out); /** * Compute the KRB-FX-CF2 combination of two keys and pepper strings. * * @param [in] context Library context * @param [in] k1 KDC contribution key * @param [in] pepper1 String "PKINIT" * @param [in] k2 Reply key * @param [in] pepper2 String "KeyExchange" * @param [out] out Output key * * This function computes the KRB-FX-CF2 function over its inputs and places * the results in a newly allocated keyblock. This function is simple in that * it assumes that @a pepper1 and @a pepper2 are C strings with no internal * nulls and that the enctype of the result will be the same as that of @a k1. * @a k1 and @a k2 may be of different enctypes. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_fx_cf2_simple(krb5_context context, const krb5_keyblock *k1, const char *pepper1, const krb5_keyblock *k2, const char *pepper2, krb5_keyblock **out); /** * Generate an enctype-specific random encryption key. * * @param [in] context Library context * @param [in] enctype Encryption type of the generated key * @param [out] k5_random_key An allocated and initialized keyblock * * Use krb5_free_keyblock_contents() to free @a k5_random_key when * no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_make_random_key(krb5_context context, krb5_enctype enctype, krb5_keyblock *k5_random_key); /** * Generate an enctype-specific key from random data. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [in] random_data Random input data * @param [out] k5_random_key Resulting key * * This function takes random input data @a random_data and produces a valid * key @a k5_random_key for a given @a enctype. * * @note It is assumed that @a k5_random_key has already been initialized and * @a k5_random_key->contents has been allocated with the correct length. * * @sa krb5_c_keylengths() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_random_to_key(krb5_context context, krb5_enctype enctype, krb5_data *random_data, krb5_keyblock *k5_random_key); /** * Add entropy to the pseudo-random number generator. * * @param [in] context Library context * @param [in] randsource Entropy source (see KRB5_RANDSOURCE types) * @param [in] data Data * * Contribute entropy to the PRNG used by krb5 crypto operations. This may or * may not affect the output of the next crypto operation requiring random * data. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_random_add_entropy(krb5_context context, unsigned int randsource, const krb5_data *data); /** * Generate pseudo-random bytes. * * @param [in] context Library context * @param [out] data Random data * * Fills in @a data with bytes from the PRNG used by krb5 crypto operations. * The caller must preinitialize @a data and allocate the desired amount of * space. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_random_make_octets(krb5_context context, krb5_data *data); /** * Collect entropy from the OS if possible. * * @param [in] context Library context * @param [in] strong Strongest available source of entropy * @param [out] success 1 if OS provides entropy, 0 otherwise * * If @a strong is non-zero, this function attempts to use the strongest * available source of entropy. Setting this flag may cause the function to * block on some operating systems. Good uses include seeding the PRNG for * kadmind and realm setup. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_random_os_entropy(krb5_context context, int strong, int *success); /** @deprecated Replaced by krb5_c_* API family. */ krb5_error_code KRB5_CALLCONV krb5_c_random_seed(krb5_context context, krb5_data *data); /** * Convert a string (such a password) to a key. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [in] string String to be converted * @param [in] salt Salt value * @param [out] key Generated key * * This function converts @a string to a @a key of encryption type @a enctype, * using the specified @a salt. The newly created @a key must be released by * calling krb5_free_keyblock_contents() when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_string_to_key(krb5_context context, krb5_enctype enctype, const krb5_data *string, const krb5_data *salt, krb5_keyblock *key); /** * Convert a string (such as a password) to a key with additional parameters. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [in] string String to be converted * @param [in] salt Salt value * @param [in] params Parameters * @param [out] key Generated key * * This function is similar to krb5_c_string_to_key(), but also takes * parameters which may affect the algorithm in an enctype-dependent way. The * newly created @a key must be released by calling * krb5_free_keyblock_contents() when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_string_to_key_with_params(krb5_context context, krb5_enctype enctype, const krb5_data *string, const krb5_data *salt, const krb5_data *params, krb5_keyblock *key); /** * Compare two encryption types. * * @param [in] context Library context * @param [in] e1 First encryption type * @param [in] e2 Second encryption type * @param [out] similar @c TRUE if types are similar, @c FALSE if not * * This function determines whether two encryption types use the same kind of * keys. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_enctype_compare(krb5_context context, krb5_enctype e1, krb5_enctype e2, krb5_boolean *similar); /** * Compute a checksum (operates on keyblock). * * @param [in] context Library context * @param [in] cksumtype Checksum type (0 for mandatory type) * @param [in] key Encryption key for a keyed checksum * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in] input Input data * @param [out] cksum Generated checksum * * This function computes a checksum of type @a cksumtype over @a input, using * @a key if the checksum type is a keyed checksum. If @a cksumtype is 0 and * @a key is non-null, the checksum type will be the mandatory-to-implement * checksum type for the key's encryption type. The actual checksum key will * be derived from @a key and @a usage if key derivation is specified for the * checksum type. The newly created @a cksum must be released by calling * krb5_free_checksum_contents() when it is no longer needed. * * @note This function is similar to krb5_k_make_checksum(), but operates * on keyblock @a key. * * @sa krb5_c_verify_checksum() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_make_checksum(krb5_context context, krb5_cksumtype cksumtype, const krb5_keyblock *key, krb5_keyusage usage, const krb5_data *input, krb5_checksum *cksum); /** * Verify a checksum (operates on keyblock). * * @param [in] context Library context * @param [in] key Encryption key for a keyed checksum * @param [in] usage @a key usage * @param [in] data Data to be used to compute a new checksum * using @a key to compare @a cksum against * @param [in] cksum Checksum to be verified * @param [out] valid Non-zero for success, zero for failure * * This function verifies that @a cksum is a valid checksum for @a data. If * the checksum type of @a cksum is a keyed checksum, @a key is used to verify * the checksum. If the checksum type in @a cksum is 0 and @a key is not NULL, * the mandatory checksum type for @a key will be used. The actual checksum * key will be derived from @a key and @a usage if key derivation is specified * for the checksum type. * * @note This function is similar to krb5_k_verify_checksum(), but operates * on keyblock @a key. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_verify_checksum(krb5_context context, const krb5_keyblock *key, krb5_keyusage usage, const krb5_data *data, const krb5_checksum *cksum, krb5_boolean *valid); /** * Return the length of checksums for a checksum type. * * @param [in] context Library context * @param [in] cksumtype Checksum type * @param [out] length Checksum length * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_checksum_length(krb5_context context, krb5_cksumtype cksumtype, size_t *length); /** * Return a list of keyed checksum types usable with an encryption type. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [out] count Count of allowable checksum types * @param [out] cksumtypes Array of allowable checksum types * * Use krb5_free_cksumtypes() to free @a cksumtypes when it is no longer * needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_keyed_checksum_types(krb5_context context, krb5_enctype enctype, unsigned int *count, krb5_cksumtype **cksumtypes); /** @defgroup KRB5_KEYUSAGE KRB5_KEYUSAGE * @{ */ #define KRB5_KEYUSAGE_AS_REQ_PA_ENC_TS 1 #define KRB5_KEYUSAGE_KDC_REP_TICKET 2 #define KRB5_KEYUSAGE_AS_REP_ENCPART 3 #define KRB5_KEYUSAGE_TGS_REQ_AD_SESSKEY 4 #define KRB5_KEYUSAGE_TGS_REQ_AD_SUBKEY 5 #define KRB5_KEYUSAGE_TGS_REQ_AUTH_CKSUM 6 #define KRB5_KEYUSAGE_TGS_REQ_AUTH 7 #define KRB5_KEYUSAGE_TGS_REP_ENCPART_SESSKEY 8 #define KRB5_KEYUSAGE_TGS_REP_ENCPART_SUBKEY 9 #define KRB5_KEYUSAGE_AP_REQ_AUTH_CKSUM 10 #define KRB5_KEYUSAGE_AP_REQ_AUTH 11 #define KRB5_KEYUSAGE_AP_REP_ENCPART 12 #define KRB5_KEYUSAGE_KRB_PRIV_ENCPART 13 #define KRB5_KEYUSAGE_KRB_CRED_ENCPART 14 #define KRB5_KEYUSAGE_KRB_SAFE_CKSUM 15 #define KRB5_KEYUSAGE_APP_DATA_ENCRYPT 16 #define KRB5_KEYUSAGE_APP_DATA_CKSUM 17 #define KRB5_KEYUSAGE_KRB_ERROR_CKSUM 18 #define KRB5_KEYUSAGE_AD_KDCISSUED_CKSUM 19 #define KRB5_KEYUSAGE_AD_MTE 20 #define KRB5_KEYUSAGE_AD_ITE 21 /* XXX need to register these */ #define KRB5_KEYUSAGE_GSS_TOK_MIC 22 #define KRB5_KEYUSAGE_GSS_TOK_WRAP_INTEG 23 #define KRB5_KEYUSAGE_GSS_TOK_WRAP_PRIV 24 /* Defined in Integrating SAM Mechanisms with Kerberos draft */ #define KRB5_KEYUSAGE_PA_SAM_CHALLENGE_CKSUM 25 /** Note conflict with @ref KRB5_KEYUSAGE_PA_S4U_X509_USER_REQUEST */ #define KRB5_KEYUSAGE_PA_SAM_CHALLENGE_TRACKID 26 /** Note conflict with @ref KRB5_KEYUSAGE_PA_S4U_X509_USER_REPLY */ #define KRB5_KEYUSAGE_PA_SAM_RESPONSE 27 /* Defined in [MS-SFU] */ /** Note conflict with @ref KRB5_KEYUSAGE_PA_SAM_CHALLENGE_TRACKID */ #define KRB5_KEYUSAGE_PA_S4U_X509_USER_REQUEST 26 /** Note conflict with @ref KRB5_KEYUSAGE_PA_SAM_RESPONSE */ #define KRB5_KEYUSAGE_PA_S4U_X509_USER_REPLY 27 /* unused */ #define KRB5_KEYUSAGE_PA_REFERRAL 26 #define KRB5_KEYUSAGE_AD_SIGNEDPATH -21 #define KRB5_KEYUSAGE_IAKERB_FINISHED 42 #define KRB5_KEYUSAGE_PA_PKINIT_KX 44 #define KRB5_KEYUSAGE_PA_OTP_REQUEST 45 /**< See RFC 6560 section 4.2 */ /* define in draft-ietf-krb-wg-preauth-framework*/ #define KRB5_KEYUSAGE_FAST_REQ_CHKSUM 50 #define KRB5_KEYUSAGE_FAST_ENC 51 #define KRB5_KEYUSAGE_FAST_REP 52 #define KRB5_KEYUSAGE_FAST_FINISHED 53 #define KRB5_KEYUSAGE_ENC_CHALLENGE_CLIENT 54 #define KRB5_KEYUSAGE_ENC_CHALLENGE_KDC 55 #define KRB5_KEYUSAGE_AS_REQ 56 #define KRB5_KEYUSAGE_CAMMAC 64 #define KRB5_KEYUSAGE_PA_FX_COOKIE 513 /**< Used for encrypted FAST cookies */ /** @} */ /* end of KRB5_KEYUSAGE group */ /** * Verify that a specified encryption type is a valid Kerberos encryption type. * * @param [in] ktype Encryption type * * @return @c TRUE if @a ktype is valid, @c FALSE if not */ krb5_boolean KRB5_CALLCONV krb5_c_valid_enctype(krb5_enctype ktype); /** * Verify that specified checksum type is a valid Kerberos checksum type. * * @param [in] ctype Checksum type * * @return @c TRUE if @a ctype is valid, @c FALSE if not */ krb5_boolean KRB5_CALLCONV krb5_c_valid_cksumtype(krb5_cksumtype ctype); /** * Test whether a checksum type is collision-proof. * * @param [in] ctype Checksum type * * @return @c TRUE if @a ctype is collision-proof, @c FALSE if it is not * collision-proof or not a valid checksum type. */ krb5_boolean KRB5_CALLCONV krb5_c_is_coll_proof_cksum(krb5_cksumtype ctype); /** * Test whether a checksum type is keyed. * * @param [in] ctype Checksum type * * @return @c TRUE if @a ctype is a keyed checksum type, @c FALSE otherwise. */ krb5_boolean KRB5_CALLCONV krb5_c_is_keyed_cksum(krb5_cksumtype ctype); /* AEAD APIs */ /** @defgroup KRB5_CRYPTO_TYPE KRB5_CRYPTO_TYPE * @{ */ #define KRB5_CRYPTO_TYPE_EMPTY 0 /**< [in] ignored */ #define KRB5_CRYPTO_TYPE_HEADER 1 /**< [out] header */ #define KRB5_CRYPTO_TYPE_DATA 2 /**< [in, out] plaintext */ #define KRB5_CRYPTO_TYPE_SIGN_ONLY 3 /**< [in] associated data */ #define KRB5_CRYPTO_TYPE_PADDING 4 /**< [out] padding */ #define KRB5_CRYPTO_TYPE_TRAILER 5 /**< [out] checksum for encrypt */ #define KRB5_CRYPTO_TYPE_CHECKSUM 6 /**< [out] checksum for MIC */ #define KRB5_CRYPTO_TYPE_STREAM 7 /**< [in] entire message without decomposing the structure into header, data and trailer buffers */ /** @} */ /* end of KRB5_CRYPTO_TYPE group */ /** * Fill in a checksum element in IOV array (operates on keyblock) * * @param [in] context Library context * @param [in] cksumtype Checksum type (0 for mandatory type) * @param [in] key Encryption key for a keyed checksum * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in,out] data IOV array * @param [in] num_data Size of @a data * * Create a checksum in the #KRB5_CRYPTO_TYPE_CHECKSUM element over * #KRB5_CRYPTO_TYPE_DATA and #KRB5_CRYPTO_TYPE_SIGN_ONLY chunks in @a data. * Only the #KRB5_CRYPTO_TYPE_CHECKSUM region is modified. * * @note This function is similar to krb5_k_make_checksum_iov(), but operates * on keyblock @a key. * * @sa krb5_c_verify_checksum_iov() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_make_checksum_iov(krb5_context context, krb5_cksumtype cksumtype, const krb5_keyblock *key, krb5_keyusage usage, krb5_crypto_iov *data, size_t num_data); /** * Validate a checksum element in IOV array (operates on keyblock). * * @param [in] context Library context * @param [in] cksumtype Checksum type (0 for mandatory type) * @param [in] key Encryption key for a keyed checksum * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in] data IOV array * @param [in] num_data Size of @a data * @param [out] valid Non-zero for success, zero for failure * * Confirm that the checksum in the #KRB5_CRYPTO_TYPE_CHECKSUM element is a * valid checksum of the #KRB5_CRYPTO_TYPE_DATA and #KRB5_CRYPTO_TYPE_SIGN_ONLY * regions in the iov. * * @note This function is similar to krb5_k_verify_checksum_iov(), but operates * on keyblock @a key. * * @sa krb5_c_make_checksum_iov() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_verify_checksum_iov(krb5_context context, krb5_cksumtype cksumtype, const krb5_keyblock *key, krb5_keyusage usage, const krb5_crypto_iov *data, size_t num_data, krb5_boolean *valid); /** * Encrypt data in place supporting AEAD (operates on keyblock). * * @param [in] context Library context * @param [in] keyblock Encryption key * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in] cipher_state Cipher state; specify NULL if not needed * @param [in,out] data IOV array. Modified in-place. * @param [in] num_data Size of @a data * * This function encrypts the data block @a data and stores the output in-place. * The actual encryption key will be derived from @a keyblock and @a usage * if key derivation is specified for the encryption type. If non-null, @a * cipher_state specifies the beginning state for the encryption operation, and * is updated with the state to be passed as input to the next operation. * The caller must allocate the right number of krb5_crypto_iov * structures before calling into this API. * * @note On return from a krb5_c_encrypt_iov() call, the @a data->length in the * iov structure are adjusted to reflect actual lengths of the ciphertext used. * For example, if the padding length is too large, the length will be reduced. * Lengths are never increased. * * @note This function is similar to krb5_k_encrypt_iov(), but operates * on keyblock @a keyblock. * * @sa krb5_c_decrypt_iov() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_encrypt_iov(krb5_context context, const krb5_keyblock *keyblock, krb5_keyusage usage, const krb5_data *cipher_state, krb5_crypto_iov *data, size_t num_data); /** * Decrypt data in place supporting AEAD (operates on keyblock). * * @param [in] context Library context * @param [in] keyblock Encryption key * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in] cipher_state Cipher state; specify NULL if not needed * @param [in,out] data IOV array. Modified in-place. * @param [in] num_data Size of @a data * * This function decrypts the data block @a data and stores the output in-place. * The actual decryption key will be derived from @a keyblock and @a usage * if key derivation is specified for the encryption type. If non-null, @a * cipher_state specifies the beginning state for the decryption operation, and * is updated with the state to be passed as input to the next operation. * The caller must allocate the right number of krb5_crypto_iov * structures before calling into this API. * * @note On return from a krb5_c_decrypt_iov() call, the @a data->length in the * iov structure are adjusted to reflect actual lengths of the ciphertext used. * For example, if the padding length is too large, the length will be reduced. * Lengths are never increased. * * @note This function is similar to krb5_k_decrypt_iov(), but operates * on keyblock @a keyblock. * * @sa krb5_c_decrypt_iov() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_decrypt_iov(krb5_context context, const krb5_keyblock *keyblock, krb5_keyusage usage, const krb5_data *cipher_state, krb5_crypto_iov *data, size_t num_data); /** * Return a length of a message field specific to the encryption type. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [in] type Type field (See @ref KRB5_CRYPTO_TYPE types) * @param [out] size Length of the @a type specific to @a enctype * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_crypto_length(krb5_context context, krb5_enctype enctype, krb5_cryptotype type, unsigned int *size); /** * Fill in lengths for header, trailer and padding in a IOV array. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [in,out] data IOV array * @param [in] num_data Size of @a data * * Padding is set to the actual padding required based on the provided * @a data buffers. Typically this API is used after setting up the data * buffers and #KRB5_CRYPTO_TYPE_SIGN_ONLY buffers, but before actually * allocating header, trailer and padding. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_crypto_length_iov(krb5_context context, krb5_enctype enctype, krb5_crypto_iov *data, size_t num_data); /** * Return a number of padding octets. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [in] data_length Length of the plaintext to pad * @param [out] size Number of padding octets * * This function returns the number of the padding octets required to pad * @a data_length octets of plaintext. * * @retval 0 Success; otherwise - KRB5_BAD_ENCTYPE */ krb5_error_code KRB5_CALLCONV krb5_c_padding_length(krb5_context context, krb5_enctype enctype, size_t data_length, unsigned int *size); /** * Create a krb5_key from the enctype and key data in a keyblock. * * @param [in] context Library context * @param [in] key_data Keyblock * @param [out] out Opaque key * * The reference count on a key @a out is set to 1. * Use krb5_k_free_key() to free @a out when it is no longer needed. * * @retval 0 Success; otherwise - KRB5_BAD_ENCTYPE */ krb5_error_code KRB5_CALLCONV krb5_k_create_key(krb5_context context, const krb5_keyblock *key_data, krb5_key *out); /** Increment the reference count on a key. */ void KRB5_CALLCONV krb5_k_reference_key(krb5_context context, krb5_key key); /** Decrement the reference count on a key and free it if it hits zero. */ void KRB5_CALLCONV krb5_k_free_key(krb5_context context, krb5_key key); /** Retrieve a copy of the keyblock from a krb5_key structure. */ krb5_error_code KRB5_CALLCONV krb5_k_key_keyblock(krb5_context context, krb5_key key, krb5_keyblock **key_data); /** Retrieve the enctype of a krb5_key structure. */ krb5_enctype KRB5_CALLCONV krb5_k_key_enctype(krb5_context context, krb5_key key); /** * Encrypt data using a key (operates on opaque key). * * @param [in] context Library context * @param [in] key Encryption key * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in,out] cipher_state Cipher state; specify NULL if not needed * @param [in] input Data to be encrypted * @param [out] output Encrypted data * * This function encrypts the data block @a input and stores the output into @a * output. The actual encryption key will be derived from @a key and @a usage * if key derivation is specified for the encryption type. If non-null, @a * cipher_state specifies the beginning state for the encryption operation, and * is updated with the state to be passed as input to the next operation. * * @note The caller must initialize @a output and allocate at least enough * space for the result (using krb5_c_encrypt_length() to determine the amount * of space needed). @a output->length will be set to the actual length of the * ciphertext. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_k_encrypt(krb5_context context, krb5_key key, krb5_keyusage usage, const krb5_data *cipher_state, const krb5_data *input, krb5_enc_data *output); /** * Encrypt data in place supporting AEAD (operates on opaque key). * * @param [in] context Library context * @param [in] key Encryption key * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in] cipher_state Cipher state; specify NULL if not needed * @param [in,out] data IOV array. Modified in-place. * @param [in] num_data Size of @a data * * This function encrypts the data block @a data and stores the output in-place. * The actual encryption key will be derived from @a key and @a usage * if key derivation is specified for the encryption type. If non-null, @a * cipher_state specifies the beginning state for the encryption operation, and * is updated with the state to be passed as input to the next operation. * The caller must allocate the right number of krb5_crypto_iov * structures before calling into this API. * * @note On return from a krb5_c_encrypt_iov() call, the @a data->length in the * iov structure are adjusted to reflect actual lengths of the ciphertext used. * For example, if the padding length is too large, the length will be reduced. * Lengths are never increased. * * @note This function is similar to krb5_c_encrypt_iov(), but operates * on opaque key @a key. * * @sa krb5_k_decrypt_iov() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_k_encrypt_iov(krb5_context context, krb5_key key, krb5_keyusage usage, const krb5_data *cipher_state, krb5_crypto_iov *data, size_t num_data); /** * Decrypt data using a key (operates on opaque key). * * @param [in] context Library context * @param [in] key Encryption key * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in,out] cipher_state Cipher state; specify NULL if not needed * @param [in] input Encrypted data * @param [out] output Decrypted data * * This function decrypts the data block @a input and stores the output into @a * output. The actual decryption key will be derived from @a key and @a usage * if key derivation is specified for the encryption type. If non-null, @a * cipher_state specifies the beginning state for the decryption operation, and * is updated with the state to be passed as input to the next operation. * * @note The caller must initialize @a output and allocate at least enough * space for the result. The usual practice is to allocate an output buffer as * long as the ciphertext, and let krb5_c_decrypt() trim @a output->length. * For some enctypes, the resulting @a output->length may include padding * bytes. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_k_decrypt(krb5_context context, krb5_key key, krb5_keyusage usage, const krb5_data *cipher_state, const krb5_enc_data *input, krb5_data *output); /** * Decrypt data in place supporting AEAD (operates on opaque key). * * @param [in] context Library context * @param [in] key Encryption key * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in] cipher_state Cipher state; specify NULL if not needed * @param [in,out] data IOV array. Modified in-place. * @param [in] num_data Size of @a data * * This function decrypts the data block @a data and stores the output in-place. * The actual decryption key will be derived from @a key and @a usage * if key derivation is specified for the encryption type. If non-null, @a * cipher_state specifies the beginning state for the decryption operation, and * is updated with the state to be passed as input to the next operation. * The caller must allocate the right number of krb5_crypto_iov * structures before calling into this API. * * @note On return from a krb5_c_decrypt_iov() call, the @a data->length in the * iov structure are adjusted to reflect actual lengths of the ciphertext used. * For example, if the padding length is too large, the length will be reduced. * Lengths are never increased. * * @note This function is similar to krb5_c_decrypt_iov(), but operates * on opaque key @a key. * * @sa krb5_k_encrypt_iov() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_k_decrypt_iov(krb5_context context, krb5_key key, krb5_keyusage usage, const krb5_data *cipher_state, krb5_crypto_iov *data, size_t num_data); /** * Compute a checksum (operates on opaque key). * * @param [in] context Library context * @param [in] cksumtype Checksum type (0 for mandatory type) * @param [in] key Encryption key for a keyed checksum * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in] input Input data * @param [out] cksum Generated checksum * * This function computes a checksum of type @a cksumtype over @a input, using * @a key if the checksum type is a keyed checksum. If @a cksumtype is 0 and * @a key is non-null, the checksum type will be the mandatory-to-implement * checksum type for the key's encryption type. The actual checksum key will * be derived from @a key and @a usage if key derivation is specified for the * checksum type. The newly created @a cksum must be released by calling * krb5_free_checksum_contents() when it is no longer needed. * * @note This function is similar to krb5_c_make_checksum(), but operates * on opaque @a key. * * @sa krb5_c_verify_checksum() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_k_make_checksum(krb5_context context, krb5_cksumtype cksumtype, krb5_key key, krb5_keyusage usage, const krb5_data *input, krb5_checksum *cksum); /** * Fill in a checksum element in IOV array (operates on opaque key) * * @param [in] context Library context * @param [in] cksumtype Checksum type (0 for mandatory type) * @param [in] key Encryption key for a keyed checksum * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in,out] data IOV array * @param [in] num_data Size of @a data * * Create a checksum in the #KRB5_CRYPTO_TYPE_CHECKSUM element over * #KRB5_CRYPTO_TYPE_DATA and #KRB5_CRYPTO_TYPE_SIGN_ONLY chunks in @a data. * Only the #KRB5_CRYPTO_TYPE_CHECKSUM region is modified. * * @note This function is similar to krb5_c_make_checksum_iov(), but operates * on opaque @a key. * * @sa krb5_k_verify_checksum_iov() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_k_make_checksum_iov(krb5_context context, krb5_cksumtype cksumtype, krb5_key key, krb5_keyusage usage, krb5_crypto_iov *data, size_t num_data); /** * Verify a checksum (operates on opaque key). * * @param [in] context Library context * @param [in] key Encryption key for a keyed checksum * @param [in] usage @a key usage * @param [in] data Data to be used to compute a new checksum * using @a key to compare @a cksum against * @param [in] cksum Checksum to be verified * @param [out] valid Non-zero for success, zero for failure * * This function verifies that @a cksum is a valid checksum for @a data. If * the checksum type of @a cksum is a keyed checksum, @a key is used to verify * the checksum. If the checksum type in @a cksum is 0 and @a key is not NULL, * the mandatory checksum type for @a key will be used. The actual checksum * key will be derived from @a key and @a usage if key derivation is specified * for the checksum type. * * @note This function is similar to krb5_c_verify_checksum(), but operates * on opaque @a key. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_k_verify_checksum(krb5_context context, krb5_key key, krb5_keyusage usage, const krb5_data *data, const krb5_checksum *cksum, krb5_boolean *valid); /** * Validate a checksum element in IOV array (operates on opaque key). * * @param [in] context Library context * @param [in] cksumtype Checksum type (0 for mandatory type) * @param [in] key Encryption key for a keyed checksum * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in] data IOV array * @param [in] num_data Size of @a data * @param [out] valid Non-zero for success, zero for failure * * Confirm that the checksum in the #KRB5_CRYPTO_TYPE_CHECKSUM element is a * valid checksum of the #KRB5_CRYPTO_TYPE_DATA and #KRB5_CRYPTO_TYPE_SIGN_ONLY * regions in the iov. * * @note This function is similar to krb5_c_verify_checksum_iov(), but operates * on opaque @a key. * * @sa krb5_k_make_checksum_iov() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_k_verify_checksum_iov(krb5_context context, krb5_cksumtype cksumtype, krb5_key key, krb5_keyusage usage, const krb5_crypto_iov *data, size_t num_data, krb5_boolean *valid); /** * Generate enctype-specific pseudo-random bytes (operates on opaque key). * * @param [in] context Library context * @param [in] key Key * @param [in] input Input data * @param [out] output Output data * * This function selects a pseudo-random function based on @a key and * computes its value over @a input, placing the result into @a output. * The caller must preinitialize @a output and allocate space for the * result. * * @note This function is similar to krb5_c_prf(), but operates * on opaque @a key. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_k_prf(krb5_context context, krb5_key key, krb5_data *input, krb5_data *output); #ifdef KRB5_OLD_CRYPTO /* * old cryptosystem routine prototypes. These are now layered * on top of the functions above. */ /** @deprecated Replaced by krb5_c_* API family.*/ krb5_error_code KRB5_CALLCONV krb5_encrypt(krb5_context context, krb5_const_pointer inptr, krb5_pointer outptr, size_t size, krb5_encrypt_block *eblock, krb5_pointer ivec); /** @deprecated Replaced by krb5_c_* API family. */ krb5_error_code KRB5_CALLCONV krb5_decrypt(krb5_context context, krb5_const_pointer inptr, krb5_pointer outptr, size_t size, krb5_encrypt_block *eblock, krb5_pointer ivec); /** @deprecated Replaced by krb5_c_* API family. */ krb5_error_code KRB5_CALLCONV krb5_process_key(krb5_context context, krb5_encrypt_block *eblock, const krb5_keyblock * key); /** @deprecated Replaced by krb5_c_* API family. */ krb5_error_code KRB5_CALLCONV krb5_finish_key(krb5_context context, krb5_encrypt_block * eblock); /** @deprecated See krb5_c_string_to_key() */ krb5_error_code KRB5_CALLCONV krb5_string_to_key(krb5_context context, const krb5_encrypt_block *eblock, krb5_keyblock * keyblock, const krb5_data *data, const krb5_data *salt); /** @deprecated Replaced by krb5_c_* API family. */ krb5_error_code KRB5_CALLCONV krb5_init_random_key(krb5_context context, const krb5_encrypt_block *eblock, const krb5_keyblock *keyblock, krb5_pointer *ptr); /** @deprecated Replaced by krb5_c_* API family. */ krb5_error_code KRB5_CALLCONV krb5_finish_random_key(krb5_context context, const krb5_encrypt_block *eblock, krb5_pointer *ptr); /** @deprecated Replaced by krb5_c_* API family. */ krb5_error_code KRB5_CALLCONV krb5_random_key(krb5_context context, const krb5_encrypt_block *eblock, krb5_pointer ptr, krb5_keyblock **keyblock); /** @deprecated Replaced by krb5_c_* API family. */ krb5_enctype KRB5_CALLCONV krb5_eblock_enctype(krb5_context context, const krb5_encrypt_block *eblock); /** @deprecated Replaced by krb5_c_* API family. */ krb5_error_code KRB5_CALLCONV krb5_use_enctype(krb5_context context, krb5_encrypt_block *eblock, krb5_enctype enctype); /** @deprecated Replaced by krb5_c_* API family. */ size_t KRB5_CALLCONV krb5_encrypt_size(size_t length, krb5_enctype crypto); /** @deprecated See krb5_c_checksum_length() */ size_t KRB5_CALLCONV krb5_checksum_size(krb5_context context, krb5_cksumtype ctype); /** @deprecated See krb5_c_make_checksum() */ krb5_error_code KRB5_CALLCONV krb5_calculate_checksum(krb5_context context, krb5_cksumtype ctype, krb5_const_pointer in, size_t in_length, krb5_const_pointer seed, size_t seed_length, krb5_checksum * outcksum); /** @deprecated See krb5_c_verify_checksum() */ krb5_error_code KRB5_CALLCONV krb5_verify_checksum(krb5_context context, krb5_cksumtype ctype, const krb5_checksum * cksum, krb5_const_pointer in, size_t in_length, krb5_const_pointer seed, size_t seed_length); #endif /* KRB5_OLD_CRYPTO */ /* * end "encryption.h" */ /* * begin "fieldbits.h" */ /* kdc_options for kdc_request */ /* options is 32 bits; each host is responsible to put the 4 bytes representing these bits into net order before transmission */ /* #define KDC_OPT_RESERVED 0x80000000 */ #define KDC_OPT_FORWARDABLE 0x40000000 #define KDC_OPT_FORWARDED 0x20000000 #define KDC_OPT_PROXIABLE 0x10000000 #define KDC_OPT_PROXY 0x08000000 #define KDC_OPT_ALLOW_POSTDATE 0x04000000 #define KDC_OPT_POSTDATED 0x02000000 /* #define KDC_OPT_UNUSED 0x01000000 */ #define KDC_OPT_RENEWABLE 0x00800000 /* #define KDC_OPT_UNUSED 0x00400000 */ /* #define KDC_OPT_RESERVED 0x00200000 */ /* #define KDC_OPT_RESERVED 0x00100000 */ /* #define KDC_OPT_RESERVED 0x00080000 */ /* #define KDC_OPT_RESERVED 0x00040000 */ #define KDC_OPT_CNAME_IN_ADDL_TKT 0x00020000 #define KDC_OPT_CANONICALIZE 0x00010000 #define KDC_OPT_REQUEST_ANONYMOUS 0x00008000 /* #define KDC_OPT_RESERVED 0x00004000 */ /* #define KDC_OPT_RESERVED 0x00002000 */ /* #define KDC_OPT_RESERVED 0x00001000 */ /* #define KDC_OPT_RESERVED 0x00000800 */ /* #define KDC_OPT_RESERVED 0x00000400 */ /* #define KDC_OPT_RESERVED 0x00000200 */ /* #define KDC_OPT_RESERVED 0x00000100 */ /* #define KDC_OPT_RESERVED 0x00000080 */ /* #define KDC_OPT_RESERVED 0x00000040 */ #define KDC_OPT_DISABLE_TRANSITED_CHECK 0x00000020 #define KDC_OPT_RENEWABLE_OK 0x00000010 #define KDC_OPT_ENC_TKT_IN_SKEY 0x00000008 /* #define KDC_OPT_UNUSED 0x00000004 */ #define KDC_OPT_RENEW 0x00000002 #define KDC_OPT_VALIDATE 0x00000001 /* * Mask of ticket flags in the TGT which should be converted into KDC * options when using the TGT to get derivitive tickets. * * New mask = KDC_OPT_FORWARDABLE | KDC_OPT_PROXIABLE | * KDC_OPT_ALLOW_POSTDATE | KDC_OPT_RENEWABLE */ #define KDC_TKT_COMMON_MASK 0x54800000 /* definitions for ap_options fields */ /** @defgroup AP_OPTS AP_OPTS * * ap_options are 32 bits; each host is responsible to put the 4 bytes * representing these bits into net order before transmission * @{ */ #define AP_OPTS_RESERVED 0x80000000 #define AP_OPTS_USE_SESSION_KEY 0x40000000 /**< Use session key */ #define AP_OPTS_MUTUAL_REQUIRED 0x20000000 /**< Perform a mutual authentication exchange */ #define AP_OPTS_ETYPE_NEGOTIATION 0x00000002 #define AP_OPTS_USE_SUBKEY 0x00000001 /**< Generate a subsession key from the current session key obtained from the credentials */ /* #define AP_OPTS_RESERVED 0x10000000 */ /* #define AP_OPTS_RESERVED 0x08000000 */ /* #define AP_OPTS_RESERVED 0x04000000 */ /* #define AP_OPTS_RESERVED 0x02000000 */ /* #define AP_OPTS_RESERVED 0x01000000 */ /* #define AP_OPTS_RESERVED 0x00800000 */ /* #define AP_OPTS_RESERVED 0x00400000 */ /* #define AP_OPTS_RESERVED 0x00200000 */ /* #define AP_OPTS_RESERVED 0x00100000 */ /* #define AP_OPTS_RESERVED 0x00080000 */ /* #define AP_OPTS_RESERVED 0x00040000 */ /* #define AP_OPTS_RESERVED 0x00020000 */ /* #define AP_OPTS_RESERVED 0x00010000 */ /* #define AP_OPTS_RESERVED 0x00008000 */ /* #define AP_OPTS_RESERVED 0x00004000 */ /* #define AP_OPTS_RESERVED 0x00002000 */ /* #define AP_OPTS_RESERVED 0x00001000 */ /* #define AP_OPTS_RESERVED 0x00000800 */ /* #define AP_OPTS_RESERVED 0x00000400 */ /* #define AP_OPTS_RESERVED 0x00000200 */ /* #define AP_OPTS_RESERVED 0x00000100 */ /* #define AP_OPTS_RESERVED 0x00000080 */ /* #define AP_OPTS_RESERVED 0x00000040 */ /* #define AP_OPTS_RESERVED 0x00000020 */ /* #define AP_OPTS_RESERVED 0x00000010 */ /* #define AP_OPTS_RESERVED 0x00000008 */ /* #define AP_OPTS_RESERVED 0x00000004 */ #define AP_OPTS_WIRE_MASK 0xfffffff0 /** @} */ /* end of AP_OPTS group */ /* definitions for ad_type fields. */ #define AD_TYPE_RESERVED 0x8000 #define AD_TYPE_EXTERNAL 0x4000 #define AD_TYPE_REGISTERED 0x2000 #define AD_TYPE_FIELD_TYPE_MASK 0x1fff /* Ticket flags */ /* flags are 32 bits; each host is responsible to put the 4 bytes representing these bits into net order before transmission */ /* #define TKT_FLG_RESERVED 0x80000000 */ #define TKT_FLG_FORWARDABLE 0x40000000 #define TKT_FLG_FORWARDED 0x20000000 #define TKT_FLG_PROXIABLE 0x10000000 #define TKT_FLG_PROXY 0x08000000 #define TKT_FLG_MAY_POSTDATE 0x04000000 #define TKT_FLG_POSTDATED 0x02000000 #define TKT_FLG_INVALID 0x01000000 #define TKT_FLG_RENEWABLE 0x00800000 #define TKT_FLG_INITIAL 0x00400000 #define TKT_FLG_PRE_AUTH 0x00200000 #define TKT_FLG_HW_AUTH 0x00100000 #define TKT_FLG_TRANSIT_POLICY_CHECKED 0x00080000 #define TKT_FLG_OK_AS_DELEGATE 0x00040000 #define TKT_FLG_ENC_PA_REP 0x00010000 #define TKT_FLG_ANONYMOUS 0x00008000 /* #define TKT_FLG_RESERVED 0x00004000 */ /* #define TKT_FLG_RESERVED 0x00002000 */ /* #define TKT_FLG_RESERVED 0x00001000 */ /* #define TKT_FLG_RESERVED 0x00000800 */ /* #define TKT_FLG_RESERVED 0x00000400 */ /* #define TKT_FLG_RESERVED 0x00000200 */ /* #define TKT_FLG_RESERVED 0x00000100 */ /* #define TKT_FLG_RESERVED 0x00000080 */ /* #define TKT_FLG_RESERVED 0x00000040 */ /* #define TKT_FLG_RESERVED 0x00000020 */ /* #define TKT_FLG_RESERVED 0x00000010 */ /* #define TKT_FLG_RESERVED 0x00000008 */ /* #define TKT_FLG_RESERVED 0x00000004 */ /* #define TKT_FLG_RESERVED 0x00000002 */ /* #define TKT_FLG_RESERVED 0x00000001 */ /* definitions for lr_type fields. */ #define LR_TYPE_THIS_SERVER_ONLY 0x8000 #define LR_TYPE_INTERPRETATION_MASK 0x7fff /* definitions for msec direction bit for KRB_SAFE, KRB_PRIV */ #define MSEC_DIRBIT 0x8000 #define MSEC_VAL_MASK 0x7fff /* * end "fieldbits.h" */ /* * begin "proto.h" */ /** Protocol version number */ #define KRB5_PVNO 5 /* Message types */ #define KRB5_AS_REQ ((krb5_msgtype)10) /**< Initial authentication request */ #define KRB5_AS_REP ((krb5_msgtype)11) /**< Response to AS request */ #define KRB5_TGS_REQ ((krb5_msgtype)12) /**< Ticket granting server request */ #define KRB5_TGS_REP ((krb5_msgtype)13) /**< Response to TGS request */ #define KRB5_AP_REQ ((krb5_msgtype)14) /**< Auth req to application server */ #define KRB5_AP_REP ((krb5_msgtype)15) /**< Response to mutual AP request */ #define KRB5_SAFE ((krb5_msgtype)20) /**< Safe application message */ #define KRB5_PRIV ((krb5_msgtype)21) /**< Private application message */ #define KRB5_CRED ((krb5_msgtype)22) /**< Cred forwarding message */ #define KRB5_ERROR ((krb5_msgtype)30) /**< Error response */ /* LastReq types */ #define KRB5_LRQ_NONE 0 #define KRB5_LRQ_ALL_LAST_TGT 1 #define KRB5_LRQ_ONE_LAST_TGT (-1) #define KRB5_LRQ_ALL_LAST_INITIAL 2 #define KRB5_LRQ_ONE_LAST_INITIAL (-2) #define KRB5_LRQ_ALL_LAST_TGT_ISSUED 3 #define KRB5_LRQ_ONE_LAST_TGT_ISSUED (-3) #define KRB5_LRQ_ALL_LAST_RENEWAL 4 #define KRB5_LRQ_ONE_LAST_RENEWAL (-4) #define KRB5_LRQ_ALL_LAST_REQ 5 #define KRB5_LRQ_ONE_LAST_REQ (-5) #define KRB5_LRQ_ALL_PW_EXPTIME 6 #define KRB5_LRQ_ONE_PW_EXPTIME (-6) #define KRB5_LRQ_ALL_ACCT_EXPTIME 7 #define KRB5_LRQ_ONE_ACCT_EXPTIME (-7) /* PADATA types */ #define KRB5_PADATA_NONE 0 #define KRB5_PADATA_AP_REQ 1 #define KRB5_PADATA_TGS_REQ KRB5_PADATA_AP_REQ #define KRB5_PADATA_ENC_TIMESTAMP 2 /**< RFC 4120 */ #define KRB5_PADATA_PW_SALT 3 /**< RFC 4120 */ #if 0 /* Not used */ #define KRB5_PADATA_ENC_ENCKEY 4 /* Key encrypted within itself */ #endif #define KRB5_PADATA_ENC_UNIX_TIME 5 /**< timestamp encrypted in key. RFC 4120 */ #define KRB5_PADATA_ENC_SANDIA_SECURID 6 /**< SecurId passcode. RFC 4120 */ #define KRB5_PADATA_SESAME 7 /**< Sesame project. RFC 4120 */ #define KRB5_PADATA_OSF_DCE 8 /**< OSF DCE. RFC 4120 */ #define KRB5_CYBERSAFE_SECUREID 9 /**< Cybersafe. RFC 4120 */ #define KRB5_PADATA_AFS3_SALT 10 /**< Cygnus. RFC 4120, 3961 */ #define KRB5_PADATA_ETYPE_INFO 11 /**< Etype info for preauth. RFC 4120 */ #define KRB5_PADATA_SAM_CHALLENGE 12 /**< SAM/OTP */ #define KRB5_PADATA_SAM_RESPONSE 13 /**< SAM/OTP */ #define KRB5_PADATA_PK_AS_REQ_OLD 14 /**< PKINIT */ #define KRB5_PADATA_PK_AS_REP_OLD 15 /**< PKINIT */ #define KRB5_PADATA_PK_AS_REQ 16 /**< PKINIT. RFC 4556 */ #define KRB5_PADATA_PK_AS_REP 17 /**< PKINIT. RFC 4556 */ #define KRB5_PADATA_ETYPE_INFO2 19 /**< RFC 4120 */ #define KRB5_PADATA_USE_SPECIFIED_KVNO 20 /**< RFC 4120 */ #define KRB5_PADATA_SVR_REFERRAL_INFO 20 /**< Windows 2000 referrals. RFC 6820 */ #define KRB5_PADATA_SAM_REDIRECT 21 /**< SAM/OTP. RFC 4120 */ #define KRB5_PADATA_GET_FROM_TYPED_DATA 22 /**< Embedded in typed data. RFC 4120 */ #define KRB5_PADATA_REFERRAL 25 /**< draft referral system */ #define KRB5_PADATA_SAM_CHALLENGE_2 30 /**< draft challenge system, updated */ #define KRB5_PADATA_SAM_RESPONSE_2 31 /**< draft challenge system, updated */ /* MS-KILE */ #define KRB5_PADATA_PAC_REQUEST 128 /**< include Windows PAC */ #define KRB5_PADATA_FOR_USER 129 /**< username protocol transition request */ #define KRB5_PADATA_S4U_X509_USER 130 /**< certificate protocol transition request */ #define KRB5_PADATA_AS_CHECKSUM 132 /**< AS checksum */ #define KRB5_PADATA_FX_COOKIE 133 /**< RFC 6113 */ #define KRB5_PADATA_FX_FAST 136 /**< RFC 6113 */ #define KRB5_PADATA_FX_ERROR 137 /**< RFC 6113 */ #define KRB5_PADATA_ENCRYPTED_CHALLENGE 138 /**< RFC 6113 */ #define KRB5_PADATA_OTP_CHALLENGE 141 /**< RFC 6560 section 4.1 */ #define KRB5_PADATA_OTP_REQUEST 142 /**< RFC 6560 section 4.2 */ #define KRB5_PADATA_OTP_PIN_CHANGE 144 /**< RFC 6560 section 4.3 */ #define KRB5_PADATA_PKINIT_KX 147 /**< RFC 6112 */ #define KRB5_ENCPADATA_REQ_ENC_PA_REP 149 /**< RFC 6806 */ #define KRB5_SAM_USE_SAD_AS_KEY 0x80000000 #define KRB5_SAM_SEND_ENCRYPTED_SAD 0x40000000 #define KRB5_SAM_MUST_PK_ENCRYPT_SAD 0x20000000 /**< currently must be zero */ /** Transited encoding types */ #define KRB5_DOMAIN_X500_COMPRESS 1 /** alternate authentication types */ #define KRB5_ALTAUTH_ATT_CHALLENGE_RESPONSE 64 /* authorization data types. See RFC 4120 section 5.2.6 */ /** @defgroup KRB5_AUTHDATA KRB5_AUTHDATA * @{ */ #define KRB5_AUTHDATA_IF_RELEVANT 1 #define KRB5_AUTHDATA_KDC_ISSUED 4 #define KRB5_AUTHDATA_AND_OR 5 #define KRB5_AUTHDATA_MANDATORY_FOR_KDC 8 #define KRB5_AUTHDATA_INITIAL_VERIFIED_CAS 9 #define KRB5_AUTHDATA_OSF_DCE 64 #define KRB5_AUTHDATA_SESAME 65 #define KRB5_AUTHDATA_CAMMAC 96 #define KRB5_AUTHDATA_WIN2K_PAC 128 #define KRB5_AUTHDATA_ETYPE_NEGOTIATION 129 /**< RFC 4537 */ #define KRB5_AUTHDATA_SIGNTICKET 512 /**< formerly 142 in krb5 1.8 */ #define KRB5_AUTHDATA_FX_ARMOR 71 #define KRB5_AUTHDATA_AUTH_INDICATOR 97 /** @} */ /* end of KRB5_AUTHDATA group */ /* password change constants */ #define KRB5_KPASSWD_SUCCESS 0 /**< Success */ #define KRB5_KPASSWD_MALFORMED 1 /**< Malformed request */ #define KRB5_KPASSWD_HARDERROR 2 /**< Server error */ #define KRB5_KPASSWD_AUTHERROR 3 /**< Authentication error */ #define KRB5_KPASSWD_SOFTERROR 4 /**< Password change rejected */ /* These are Microsoft's extensions in RFC 3244, and it looks like they'll become standardized, possibly with other additions. */ #define KRB5_KPASSWD_ACCESSDENIED 5 /**< Not authorized */ #define KRB5_KPASSWD_BAD_VERSION 6 /**< Unknown RPC version */ /** The presented credentials were not obtained using a password directly */ #define KRB5_KPASSWD_INITIAL_FLAG_NEEDED 7 /* * end "proto.h" */ /* Time set */ /** Ticket start time, end time, and renewal duration. */ typedef struct _krb5_ticket_times { krb5_timestamp authtime; /**< Time at which KDC issued the initial ticket that corresponds to this ticket */ /* XXX ? should ktime in KDC_REP == authtime in ticket? otherwise client can't get this */ krb5_timestamp starttime; /**< optional in ticket, if not present, use @a authtime */ krb5_timestamp endtime; /**< Ticket expiration time */ krb5_timestamp renew_till; /**< Latest time at which renewal of ticket can be valid */ } krb5_ticket_times; /** Structure for auth data */ typedef struct _krb5_authdata { krb5_magic magic; krb5_authdatatype ad_type; /**< ADTYPE */ unsigned int length; /**< Length of data */ krb5_octet *contents; /**< Data */ } krb5_authdata; /** Structure for transited encoding */ typedef struct _krb5_transited { krb5_magic magic; krb5_octet tr_type; /**< Transited encoding type */ krb5_data tr_contents; /**< Contents */ } krb5_transited; /** Encrypted part of ticket. */ typedef struct _krb5_enc_tkt_part { krb5_magic magic; /* to-be-encrypted portion */ krb5_flags flags; /**< flags */ krb5_keyblock *session; /**< session key: includes enctype */ krb5_principal client; /**< client name/realm */ krb5_transited transited; /**< list of transited realms */ krb5_ticket_times times; /**< auth, start, end, renew_till */ krb5_address **caddrs; /**< array of ptrs to addresses */ krb5_authdata **authorization_data; /**< auth data */ } krb5_enc_tkt_part; /** * Ticket structure. * * The C representation of the ticket message, with a pointer to the * C representation of the encrypted part. */ typedef struct _krb5_ticket { krb5_magic magic; /* cleartext portion */ krb5_principal server; /**< server name/realm */ krb5_enc_data enc_part; /**< encryption type, kvno, encrypted encoding */ krb5_enc_tkt_part *enc_part2; /**< ptr to decrypted version, if available */ } krb5_ticket; /* the unencrypted version */ /** * Ticket authenticator. * * The C representation of an unencrypted authenticator. */ typedef struct _krb5_authenticator { krb5_magic magic; krb5_principal client; /**< client name/realm */ krb5_checksum *checksum; /**< checksum, includes type, optional */ krb5_int32 cusec; /**< client usec portion */ krb5_timestamp ctime; /**< client sec portion */ krb5_keyblock *subkey; /**< true session key, optional */ krb5_ui_4 seq_number; /**< sequence #, optional */ krb5_authdata **authorization_data; /**< authoriazation data */ } krb5_authenticator; /** Ticket authentication data. */ typedef struct _krb5_tkt_authent { krb5_magic magic; krb5_ticket *ticket; krb5_authenticator *authenticator; krb5_flags ap_options; } krb5_tkt_authent; /** Credentials structure including ticket, session key, and lifetime info. */ typedef struct _krb5_creds { krb5_magic magic; krb5_principal client; /**< client's principal identifier */ krb5_principal server; /**< server's principal identifier */ krb5_keyblock keyblock; /**< session encryption key info */ krb5_ticket_times times; /**< lifetime info */ krb5_boolean is_skey; /**< true if ticket is encrypted in another ticket's skey */ krb5_flags ticket_flags; /**< flags in ticket */ krb5_address **addresses; /**< addrs in ticket */ krb5_data ticket; /**< ticket string itself */ krb5_data second_ticket; /**< second ticket, if related to ticket (via DUPLICATE-SKEY or ENC-TKT-IN-SKEY) */ krb5_authdata **authdata; /**< authorization data */ } krb5_creds; /** Last request entry */ typedef struct _krb5_last_req_entry { krb5_magic magic; krb5_int32 lr_type; /**< LR type */ krb5_timestamp value; /**< Timestamp */ } krb5_last_req_entry; /** Pre-authentication data */ typedef struct _krb5_pa_data { krb5_magic magic; krb5_preauthtype pa_type; /**< Preauthentication data type */ unsigned int length; /**< Length of data */ krb5_octet *contents; /**< Data */ } krb5_pa_data; /* Don't use this; use krb5_pa_data instead. */ typedef struct _krb5_typed_data { krb5_magic magic; krb5_int32 type; unsigned int length; krb5_octet *data; } krb5_typed_data; /** C representation of KDC-REQ protocol message, including KDC-REQ-BODY */ typedef struct _krb5_kdc_req { krb5_magic magic; krb5_msgtype msg_type; /**< KRB5_AS_REQ or KRB5_TGS_REQ */ krb5_pa_data **padata; /**< Preauthentication data */ /* real body */ krb5_flags kdc_options; /**< Requested options */ krb5_principal client; /**< Client principal and realm */ krb5_principal server; /**< Server principal and realm */ krb5_timestamp from; /**< Requested start time */ krb5_timestamp till; /**< Requested end time */ krb5_timestamp rtime; /**< Requested renewable end time */ krb5_int32 nonce; /**< Nonce to match request and response */ int nktypes; /**< Number of enctypes */ krb5_enctype *ktype; /**< Requested enctypes */ krb5_address **addresses; /**< Requested addresses (optional) */ krb5_enc_data authorization_data; /**< Encrypted authz data (optional) */ krb5_authdata **unenc_authdata; /**< Unencrypted authz data */ krb5_ticket **second_ticket; /**< Second ticket array (optional) */ } krb5_kdc_req; /** * C representation of @c EncKDCRepPart protocol message. * * This is the cleartext message that is encrypted and inserted in @c KDC-REP. */ typedef struct _krb5_enc_kdc_rep_part { krb5_magic magic; /* encrypted part: */ krb5_msgtype msg_type; /**< krb5 message type */ krb5_keyblock *session; /**< Session key */ krb5_last_req_entry **last_req; /**< Array of pointers to entries */ krb5_int32 nonce; /**< Nonce from request */ krb5_timestamp key_exp; /**< Expiration date */ krb5_flags flags; /**< Ticket flags */ krb5_ticket_times times; /**< Lifetime info */ krb5_principal server; /**< Server's principal identifier */ krb5_address **caddrs; /**< Array of ptrs to addrs, optional */ krb5_pa_data **enc_padata; /**< Encrypted preauthentication data */ } krb5_enc_kdc_rep_part; /** Representation of the @c KDC-REP protocol message. */ typedef struct _krb5_kdc_rep { krb5_magic magic; /* cleartext part: */ krb5_msgtype msg_type; /**< KRB5_AS_REP or KRB5_KDC_REP */ krb5_pa_data **padata; /**< Preauthentication data from KDC */ krb5_principal client; /**< Client principal and realm */ krb5_ticket *ticket; /**< Ticket */ krb5_enc_data enc_part; /**< Encrypted part of reply */ krb5_enc_kdc_rep_part *enc_part2; /**< Unencrypted version, if available */ } krb5_kdc_rep; /** Error message structure */ typedef struct _krb5_error { krb5_magic magic; /* some of these may be meaningless in certain contexts */ krb5_timestamp ctime; /**< Client sec portion; optional */ krb5_int32 cusec; /**< Client usec portion; optional */ krb5_int32 susec; /**< Server usec portion */ krb5_timestamp stime; /**< Server sec portion */ krb5_ui_4 error; /**< Error code (protocol error #'s) */ krb5_principal client; /**< Client principal and realm */ krb5_principal server; /**< Server principal and realm */ krb5_data text; /**< Descriptive text */ krb5_data e_data; /**< Additional error-describing data */ } krb5_error; /** Authentication header. */ typedef struct _krb5_ap_req { krb5_magic magic; krb5_flags ap_options; /**< Requested options */ krb5_ticket *ticket; /**< Ticket */ krb5_enc_data authenticator; /**< Encrypted authenticator */ } krb5_ap_req; /** * C representaton of AP-REP message. * * The server's response to a client's request for mutual authentication. */ typedef struct _krb5_ap_rep { krb5_magic magic; krb5_enc_data enc_part; /**< Ciphertext of ApRepEncPart */ } krb5_ap_rep; /** Cleartext that is encrypted and put into @c _krb5_ap_rep. */ typedef struct _krb5_ap_rep_enc_part { krb5_magic magic; krb5_timestamp ctime; /**< Client time, seconds portion */ krb5_int32 cusec; /**< Client time, microseconds portion */ krb5_keyblock *subkey; /**< Subkey (optional) */ krb5_ui_4 seq_number; /**< Sequence number */ } krb5_ap_rep_enc_part; /* Unused */ typedef struct _krb5_response { krb5_magic magic; krb5_octet message_type; krb5_data response; krb5_int32 expected_nonce; krb5_timestamp request_time; } krb5_response; /** Credentials information inserted into @c EncKrbCredPart. */ typedef struct _krb5_cred_info { krb5_magic magic; krb5_keyblock *session; /**< Session key used to encrypt ticket */ krb5_principal client; /**< Client principal and realm */ krb5_principal server; /**< Server principal and realm */ krb5_flags flags; /**< Ticket flags */ krb5_ticket_times times; /**< Auth, start, end, renew_till */ krb5_address **caddrs; /**< Array of pointers to addrs (optional) */ } krb5_cred_info; /** Cleartext credentials information. */ typedef struct _krb5_cred_enc_part { krb5_magic magic; krb5_int32 nonce; /**< Nonce (optional) */ krb5_timestamp timestamp; /**< Generation time, seconds portion */ krb5_int32 usec; /**< Generation time, microseconds portion */ krb5_address *s_address; /**< Sender address (optional) */ krb5_address *r_address; /**< Recipient address (optional) */ krb5_cred_info **ticket_info; } krb5_cred_enc_part; /** Credentials data structure.*/ typedef struct _krb5_cred { krb5_magic magic; krb5_ticket **tickets; /**< Tickets */ krb5_enc_data enc_part; /**< Encrypted part */ krb5_cred_enc_part *enc_part2; /**< Unencrypted version, if available */ } krb5_cred; /* Unused, but here for API compatibility. */ typedef struct _passwd_phrase_element { krb5_magic magic; krb5_data *passwd; krb5_data *phrase; } passwd_phrase_element; /* Unused, but here for API compatibility. */ typedef struct _krb5_pwd_data { krb5_magic magic; int sequence_count; passwd_phrase_element **element; } krb5_pwd_data; /* Unused, but here for API compatibility. */ typedef struct _krb5_pa_svr_referral_data { /** Referred name, only realm is required */ krb5_principal principal; } krb5_pa_svr_referral_data; /* Unused, but here for API compatibility. */ typedef struct _krb5_pa_server_referral_data { krb5_data *referred_realm; krb5_principal true_principal_name; krb5_principal requested_principal_name; krb5_timestamp referral_valid_until; krb5_checksum rep_cksum; } krb5_pa_server_referral_data; typedef struct _krb5_pa_pac_req { /** TRUE if a PAC should be included in TGS-REP */ krb5_boolean include_pac; } krb5_pa_pac_req; /* * begin "safepriv.h" */ /** @defgroup KRB5_AUTH_CONTEXT KRB5_AUTH_CONTEXT * @{ */ /** Prevent replays with timestamps and replay cache. */ #define KRB5_AUTH_CONTEXT_DO_TIME 0x00000001 /** Save timestamps for application. */ #define KRB5_AUTH_CONTEXT_RET_TIME 0x00000002 /** Prevent replays with sequence numbers. */ #define KRB5_AUTH_CONTEXT_DO_SEQUENCE 0x00000004 /** Save sequence numbers for application. */ #define KRB5_AUTH_CONTEXT_RET_SEQUENCE 0x00000008 #define KRB5_AUTH_CONTEXT_PERMIT_ALL 0x00000010 #define KRB5_AUTH_CONTEXT_USE_SUBKEY 0x00000020 /** @} */ /* end of KRB5_AUTH_CONTEXT group */ /** * Replay data. * * Sequence number and timestamp information output by krb5_rd_priv() and * krb5_rd_safe(). */ typedef struct krb5_replay_data { krb5_timestamp timestamp; /**< Timestamp, seconds portion */ krb5_int32 usec; /**< Timestamp, microseconds portion */ krb5_ui_4 seq; /**< Sequence number */ } krb5_replay_data; /* Flags for krb5_auth_con_genaddrs(). */ /** Generate the local network address. */ #define KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR 0x00000001 /** Generate the remote network address. */ #define KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR 0x00000002 /** Generate the local network address and the local port. */ #define KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR 0x00000004 /** Generate the remote network address and the remote port. */ #define KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR 0x00000008 /** Type of function used as a callback to generate checksum data for mk_req */ typedef krb5_error_code (KRB5_CALLCONV * krb5_mk_req_checksum_func)(krb5_context, krb5_auth_context, void *, krb5_data **); /* * end "safepriv.h" */ /* * begin "ccache.h" */ /** Cursor for sequential lookup */ typedef krb5_pointer krb5_cc_cursor; struct _krb5_ccache; typedef struct _krb5_ccache *krb5_ccache; struct _krb5_cc_ops; typedef struct _krb5_cc_ops krb5_cc_ops; struct _krb5_cccol_cursor; /** Cursor for iterating over all ccaches */ typedef struct _krb5_cccol_cursor *krb5_cccol_cursor; /* Flags for krb5_cc_retrieve_cred. */ /** The requested lifetime must be at least as great as the time specified. */ #define KRB5_TC_MATCH_TIMES 0x00000001 /** The is_skey field must match exactly. */ #define KRB5_TC_MATCH_IS_SKEY 0x00000002 /** All the flags set in the match credentials must be set. */ #define KRB5_TC_MATCH_FLAGS 0x00000004 /** All the time fields must match exactly. */ #define KRB5_TC_MATCH_TIMES_EXACT 0x00000008 /** All the flags must match exactly. */ #define KRB5_TC_MATCH_FLAGS_EXACT 0x00000010 /** The authorization data must match. */ #define KRB5_TC_MATCH_AUTHDATA 0x00000020 /** Only the name portion of the principal name must match. */ #define KRB5_TC_MATCH_SRV_NAMEONLY 0x00000040 /** The second ticket must match. */ #define KRB5_TC_MATCH_2ND_TKT 0x00000080 /** The encryption key type must match. */ #define KRB5_TC_MATCH_KTYPE 0x00000100 /** The supported key types must match. */ #define KRB5_TC_SUPPORTED_KTYPES 0x00000200 /* Flags for krb5_cc_set_flags and similar. */ /** Open and close the file for each cache operation. */ #define KRB5_TC_OPENCLOSE 0x00000001 /**< @deprecated has no effect */ #define KRB5_TC_NOTICKET 0x00000002 /** * Retrieve the name, but not type of a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * * @warning Returns the name of the credential cache. The result is an alias * into @a cache and should not be freed or modified by the caller. This name * does not include the cache type, so should not be used as input to * krb5_cc_resolve(). * * @return * On success - the name of the credential cache. */ const char * KRB5_CALLCONV krb5_cc_get_name(krb5_context context, krb5_ccache cache); /** * Retrieve the full name of a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [out] fullname_out Full name of cache * * Use krb5_free_string() to free @a fullname_out when it is no longer needed. * * @version New in 1.10 */ krb5_error_code KRB5_CALLCONV krb5_cc_get_full_name(krb5_context context, krb5_ccache cache, char **fullname_out); #if KRB5_DEPRECATED krb5_error_code KRB5_CALLCONV krb5_cc_gen_new(krb5_context context, krb5_ccache *cache); #endif /* KRB5_DEPRECATED */ /** * Initialize a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [in] principal Default principal name * * Destroy any existing contents of @a cache and initialize it for the default * principal @a principal. * * @retval * 0 Success * @return * System errors; Permission errors; Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_initialize(krb5_context context, krb5_ccache cache, krb5_principal principal); /** * Destroy a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * * This function destroys any existing contents of @a cache and closes the * handle to it. * * @retval * 0 Success * @return * Permission errors */ krb5_error_code KRB5_CALLCONV krb5_cc_destroy(krb5_context context, krb5_ccache cache); /** * Close a credential cache handle. * * @param [in] context Library context * @param [in] cache Credential cache handle * * This function closes a credential cache handle @a cache without affecting * the contents of the cache. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_close(krb5_context context, krb5_ccache cache); /** * Store credentials in a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [in] creds Credentials to be stored in cache * * This function stores @a creds into @a cache. If @a creds->server and the * server in the decoded ticket @a creds->ticket differ, the credentials will * be stored under both server principal names. * * @retval * 0 Success * @return Permission errors; storage failure errors; Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_store_cred(krb5_context context, krb5_ccache cache, krb5_creds *creds); /** * Retrieve a specified credentials from a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [in] flags Flags bit mask * @param [in] mcreds Credentials to match * @param [out] creds Credentials matching the requested value * * This function searches a credential cache for credentials matching @a mcreds * and returns it if found. * * Valid values for @a flags are: * * @li #KRB5_TC_MATCH_TIMES The requested lifetime must be at least as * great as in @a mcreds . * @li #KRB5_TC_MATCH_IS_SKEY The @a is_skey field much match exactly. * @li #KRB5_TC_MATCH_FLAGS Flags set in @a mcreds must be set. * @li #KRB5_TC_MATCH_TIMES_EXACT The requested lifetime must match exactly. * @li #KRB5_TC_MATCH_FLAGS_EXACT Flags must match exactly. * @li #KRB5_TC_MATCH_AUTHDATA The authorization data must match. * @li #KRB5_TC_MATCH_SRV_NAMEONLY Only the name portion of the principal * name must match, not the realm. * @li #KRB5_TC_MATCH_2ND_TKT The second tickets must match. * @li #KRB5_TC_MATCH_KTYPE The encryption key types must match. * @li #KRB5_TC_SUPPORTED_KTYPES Check all matching entries that have any * supported encryption type and return the * one with the encryption type listed earliest. * * Use krb5_free_cred_contents() to free @a creds when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_retrieve_cred(krb5_context context, krb5_ccache cache, krb5_flags flags, krb5_creds *mcreds, krb5_creds *creds); /** * Get the default principal of a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [out] principal Primary principal * * Returns the default client principal of a credential cache as set by * krb5_cc_initialize(). * * Use krb5_free_principal() to free @a principal when it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_get_principal(krb5_context context, krb5_ccache cache, krb5_principal *principal); /** * Prepare to sequentially read every credential in a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [out] cursor Cursor * * krb5_cc_end_seq_get() must be called to complete the retrieve operation. * * @note If @a cache is modified between the time of the call to this function * and the time of the final krb5_cc_end_seq_get(), the results are undefined. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_start_seq_get(krb5_context context, krb5_ccache cache, krb5_cc_cursor *cursor); /** * Retrieve the next entry from the credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [in] cursor Cursor * @param [out] creds Next credential cache entry * * This function fills in @a creds with the next entry in @a cache and advances * @a cursor. * * Use krb5_free_cred_contents() to free @a creds when it is no longer needed. * * @sa krb5_cc_start_seq_get(), krb5_end_seq_get() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_next_cred(krb5_context context, krb5_ccache cache, krb5_cc_cursor *cursor, krb5_creds *creds); /** * Finish a series of sequential processing credential cache entries. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [in] cursor Cursor * * This function finishes processing credential cache entries and invalidates * @a cursor. * * @sa krb5_cc_start_seq_get(), krb5_cc_next_cred() * * @retval 0 (always) */ krb5_error_code KRB5_CALLCONV krb5_cc_end_seq_get(krb5_context context, krb5_ccache cache, krb5_cc_cursor *cursor); /** * Remove credentials from a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [in] flags Bitwise-ORed search flags * @param [in] creds Credentials to be matched * * @warning This function is not implemented for some cache types. * * This function accepts the same flag values as krb5_cc_retrieve_cred(). * * @retval KRB5_CC_NOSUPP Not implemented for this cache type * @return No matches found; Data cannot be deleted; Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_remove_cred(krb5_context context, krb5_ccache cache, krb5_flags flags, krb5_creds *creds); /** * Set options flags on a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [in] flags Flag bit mask * * This function resets @a cache flags to @a flags. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_set_flags(krb5_context context, krb5_ccache cache, krb5_flags flags); /** * Retrieve flags from a credential cache structure. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [out] flags Flag bit mask * * @warning For memory credential cache always returns a flag mask of 0. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_get_flags(krb5_context context, krb5_ccache cache, krb5_flags *flags); /** * Retrieve the type of a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * * @return The type of a credential cache as an alias that must not be modified * or freed by the caller. */ const char * KRB5_CALLCONV krb5_cc_get_type(krb5_context context, krb5_ccache cache); /** * Move a credential cache. * * @param [in] context Library context * @param [in] src The credential cache to move the content from * @param [in] dst The credential cache to move the content to * * This function reinitializes @a dst and populates it with the credentials and * default principal of @a src; then, if successful, destroys @a src. * * @retval * 0 Success; @a src is closed. * @return * Kerberos error codes; @a src is still allocated. */ krb5_error_code KRB5_CALLCONV krb5_cc_move(krb5_context context, krb5_ccache src, krb5_ccache dst); /** * Return a timestamp of the last modification to a credential cache. * * @param [in] context Library context * @param [in] ccache Credential cache handle * @param [out] change_time The last change time of @a ccache * * If an error occurs, @a change_time is set to 0. */ krb5_error_code KRB5_CALLCONV krb5_cc_last_change_time(krb5_context context, krb5_ccache ccache, krb5_timestamp *change_time); /** * Lock a credential cache. * * @param [in] context Library context * @param [in] ccache Credential cache handle * * Use krb5_cc_unlock() to unlock the lock. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_lock(krb5_context context, krb5_ccache ccache); /** * Unlock a credential cache. * * @param [in] context Library context * @param [in] ccache Credential cache handle * * This function unlocks the @a ccache locked by krb5_cc_lock(). * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_unlock(krb5_context context, krb5_ccache ccache); /** * Prepare to iterate over the collection of known credential caches. * * @param [in] context Library context * @param [out] cursor Cursor * * Get a new cache iteration @a cursor that will iterate over all known * credential caches independent of type. * * Use krb5_cccol_cursor_free() to release @a cursor when it is no longer * needed. * * @sa krb5_cccol_cursor_next() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cccol_cursor_new(krb5_context context, krb5_cccol_cursor *cursor); /** * Get the next credential cache in the collection. * * @param [in] context Library context * @param [in] cursor Cursor * @param [out] ccache Credential cache handle * * @note When all caches are iterated over and the end of the list is reached, * @a ccache is set to NULL. * * Use krb5_cc_close() to close @a ccache when it is no longer needed. * * @sa krb5_cccol_cursor_new(), krb5_cccol_cursor_free() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cccol_cursor_next(krb5_context context, krb5_cccol_cursor cursor, krb5_ccache *ccache); /** * Free a credential cache collection cursor. * * @param [in] context Library context * @param [in] cursor Cursor * * @sa krb5_cccol_cursor_new(), krb5_cccol_cursor_next() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cccol_cursor_free(krb5_context context, krb5_cccol_cursor *cursor); /** * Check if the credential cache collection contains any credentials. * * @param [in] context Library context * * @version New in 1.11 * * @retval 0 Credentials are available in the collection * @retval KRB5_CC_NOTFOUND The collection contains no credentials */ krb5_error_code KRB5_CALLCONV krb5_cccol_have_content(krb5_context context); /** * Return a timestamp of the last modification of any known credential cache. * * @param [in] context Library context * @param [out] change_time Last modification timestamp * * This function returns the most recent modification time of any known * credential cache, ignoring any caches which cannot supply a last * modification time. * * If there are no known credential caches, @a change_time is set to 0. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cccol_last_change_time(krb5_context context, krb5_timestamp *change_time); /** * Acquire a global lock for credential caches. * * @param [in] context Library context * * This function locks the global credential cache collection, ensuring * that no ccaches are added to or removed from it until the collection * lock is released. * * Use krb5_cccol_unlock() to unlock the lock. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cccol_lock(krb5_context context); /** * Release a global lock for credential caches. * * @param [in] context Library context * * This function unlocks the lock from krb5_cccol_lock(). * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cccol_unlock(krb5_context context); /** * Create a new credential cache of the specified type with a unique name. * * @param [in] context Library context * @param [in] type Credential cache type name * @param [in] hint Unused * @param [out] id Credential cache handle * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_new_unique(krb5_context context, const char *type, const char *hint, krb5_ccache *id); /* * end "ccache.h" */ /* * begin "rcache.h" */ struct krb5_rc_st; typedef struct krb5_rc_st *krb5_rcache; /* * end "rcache.h" */ /* * begin "keytab.h" */ /* XXX */ #define MAX_KEYTAB_NAME_LEN 1100 /**< Long enough for MAXPATHLEN + some extra */ typedef krb5_pointer krb5_kt_cursor; /** A key table entry. */ typedef struct krb5_keytab_entry_st { krb5_magic magic; krb5_principal principal; /**< Principal of this key */ krb5_timestamp timestamp; /**< Time entry written to keytable */ krb5_kvno vno; /**< Key version number */ krb5_keyblock key; /**< The secret key */ } krb5_keytab_entry; struct _krb5_kt; typedef struct _krb5_kt *krb5_keytab; /** * Return the type of a key table. * * @param [in] context Library context * @param [in] keytab Key table handle * * @return The type of a key table as an alias that must not be modified or * freed by the caller. */ const char * KRB5_CALLCONV krb5_kt_get_type(krb5_context context, krb5_keytab keytab); /** * Get a key table name. * * @param [in] context Library context * @param [in] keytab Key table handle * @param [out] name Key table name * @param [in] namelen Maximum length to fill in name * * Fill @a name with the name of @a keytab including the type and delimiter. * * @sa MAX_KEYTAB_NAME_LEN * * @retval * 0 Success * @retval * KRB5_KT_NAME_TOOLONG Key table name does not fit in @a namelen bytes * * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_get_name(krb5_context context, krb5_keytab keytab, char *name, unsigned int namelen); /** * Close a key table handle. * * @param [in] context Library context * @param [in] keytab Key table handle * * @retval 0 */ krb5_error_code KRB5_CALLCONV krb5_kt_close(krb5_context context, krb5_keytab keytab); /** * Get an entry from a key table. * * @param [in] context Library context * @param [in] keytab Key table handle * @param [in] principal Principal name * @param [in] vno Key version number (0 for highest available) * @param [in] enctype Encryption type (0 zero for any enctype) * @param [out] entry Returned entry from key table * * Retrieve an entry from a key table which matches the @a keytab, @a * principal, @a vno, and @a enctype. If @a vno is zero, retrieve the * highest-numbered kvno matching the other fields. If @a enctype is 0, match * any enctype. * * Use krb5_free_keytab_entry_contents() to free @a entry when it is no longer * needed. * * @note If @a vno is zero, the function retrieves the highest-numbered-kvno * entry that matches the specified principal. * * @retval * 0 Success * @retval * Kerberos error codes on failure */ krb5_error_code KRB5_CALLCONV krb5_kt_get_entry(krb5_context context, krb5_keytab keytab, krb5_const_principal principal, krb5_kvno vno, krb5_enctype enctype, krb5_keytab_entry *entry); /** * Start a sequential retrieval of key table entries. * * @param [in] context Library context * @param [in] keytab Key table handle * @param [out] cursor Cursor * * Prepare to read sequentially every key in the specified key table. Use * krb5_kt_end_seq_get() to release the cursor when it is no longer needed. * * @sa krb5_kt_next_entry(), krb5_kt_end_seq_get() * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_start_seq_get(krb5_context context, krb5_keytab keytab, krb5_kt_cursor *cursor); /** * Retrieve the next entry from the key table. * * @param [in] context Library context * @param [in] keytab Key table handle * @param [out] entry Returned key table entry * @param [in] cursor Key table cursor * * Return the next sequential entry in @a keytab and advance @a cursor. * Callers must release the returned entry with krb5_kt_free_entry(). * * @sa krb5_kt_start_seq_get(), krb5_kt_end_seq_get() * * @retval * 0 Success * @retval * KRB5_KT_END - if the last entry was reached * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_next_entry(krb5_context context, krb5_keytab keytab, krb5_keytab_entry *entry, krb5_kt_cursor *cursor); /** * Release a keytab cursor. * * @param [in] context Library context * @param [in] keytab Key table handle * @param [out] cursor Cursor * * This function should be called to release the cursor created by * krb5_kt_start_seq_get(). * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_end_seq_get(krb5_context context, krb5_keytab keytab, krb5_kt_cursor *cursor); /** * Check if a keytab exists and contains entries. * * @param [in] context Library context * @param [in] keytab Key table handle * * @version New in 1.11 * * @retval 0 Keytab exists and contains entries * @retval KRB5_KT_NOTFOUND Keytab does not contain entries */ krb5_error_code KRB5_CALLCONV krb5_kt_have_content(krb5_context context, krb5_keytab keytab); /* * end "keytab.h" */ /* * begin "func-proto.h" */ #define KRB5_INIT_CONTEXT_SECURE 0x1 /**< Use secure context configuration */ #define KRB5_INIT_CONTEXT_KDC 0x2 /**< Use KDC configuration if available */ /** * Create a krb5 library context. * * @param [out] context Library context * * The @a context must be released by calling krb5_free_context() when * it is no longer needed. * * @warning Any program or module that needs the Kerberos code to not trust the * environment must use krb5_init_secure_context(), or clean out the * environment. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_context(krb5_context *context); /** * Create a krb5 library context using only configuration files. * * @param [out] context Library context * * Create a context structure, using only system configuration files. All * information passed through the environment variables is ignored. * * The @a context must be released by calling krb5_free_context() when * it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_secure_context(krb5_context *context); /** * Create a krb5 library context using a specified profile. * * @param [in] profile Profile object (NULL to create default profile) * @param [in] flags Context initialization flags * @param [out] context Library context * * Create a context structure, optionally using a specified profile and * initialization flags. If @a profile is NULL, the default profile will be * created from config files. If @a profile is non-null, a copy of it will be * made for the new context; the caller should still clean up its copy. Valid * flag values are: * * @li #KRB5_INIT_CONTEXT_SECURE Ignore environment variables * @li #KRB5_INIT_CONTEXT_KDC Use KDC configuration if creating profile */ krb5_error_code KRB5_CALLCONV krb5_init_context_profile(struct _profile_t *profile, krb5_flags flags, krb5_context *context); /** * Free a krb5 library context. * * @param [in] context Library context * * This function frees a @a context that was created by krb5_init_context() * or krb5_init_secure_context(). */ void KRB5_CALLCONV krb5_free_context(krb5_context context); /** * Copy a krb5_context structure. * * @param [in] ctx Library context * @param [out] nctx_out New context structure * * The newly created context must be released by calling krb5_free_context() * when it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_context(krb5_context ctx, krb5_context *nctx_out); /** * Set default TGS encryption types in a krb5_context structure. * * @param [in] context Library context * @param [in] etypes Encryption type(s) to set * * This function sets the default enctype list for TGS requests * made using @a context to @a etypes. * * @note This overrides the default list (from config file or built-in). * * @retval * 0 Success * @retval * KRB5_PROG_ETYPE_NOSUPP Program lacks support for encryption type * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_set_default_tgs_enctypes(krb5_context context, const krb5_enctype *etypes); /** * Return a list of encryption types permitted for session keys. * * @param [in] context Library context * @param [out] ktypes Zero-terminated list of encryption types * * This function returns the list of encryption types permitted for session * keys within @a context, as determined by configuration or by a previous call * to krb5_set_default_tgs_enctypes(). * * Use krb5_free_enctypes() to free @a ktypes when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_permitted_enctypes(krb5_context context, krb5_enctype **ktypes); /** * Test whether the Kerberos library was built with multithread support. * * @retval * TRUE if the library is threadsafe; FALSE otherwise */ krb5_boolean KRB5_CALLCONV krb5_is_thread_safe(void); /* libkrb.spec */ /** * Decrypt a ticket using the specified key table. * * @param [in] context Library context * @param [in] kt Key table * @param [in] ticket Ticket to be decrypted * * This function takes a @a ticket as input and decrypts it using * key data from @a kt. The result is placed into @a ticket->enc_part2. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_server_decrypt_ticket_keytab(krb5_context context, const krb5_keytab kt, krb5_ticket *ticket); /** * Free an array of credential structures. * * @param [in] context Library context * @param [in] tgts Null-terminated array of credentials to free * * @note The last entry in the array @a tgts must be a NULL pointer. */ void KRB5_CALLCONV krb5_free_tgt_creds(krb5_context context, krb5_creds **tgts); /** @defgroup KRB5_GC KRB5_GC * @{ */ #define KRB5_GC_USER_USER 1 /**< Want user-user ticket */ #define KRB5_GC_CACHED 2 /**< Want cached ticket only */ #define KRB5_GC_CANONICALIZE 4 /**< Set canonicalize KDC option */ #define KRB5_GC_NO_STORE 8 /**< Do not store in credential cache */ #define KRB5_GC_FORWARDABLE 16 /**< Acquire forwardable tickets */ #define KRB5_GC_NO_TRANSIT_CHECK 32 /**< Disable transited check */ #define KRB5_GC_CONSTRAINED_DELEGATION 64 /**< Constrained delegation */ /** @} */ /* end of KRB5_GC group */ /** * Get an additional ticket. * * @param [in] context Library context * @param [in] options Options * @param [in] ccache Credential cache handle * @param [in] in_creds Input credentials * @param [out] out_creds Output updated credentials * * Use @a ccache or a TGS exchange to get a service ticket matching @a * in_creds. * * Valid values for @a options are: * @li #KRB5_GC_CACHED Search only credential cache for the ticket * @li #KRB5_GC_USER_USER Return a user to user authentication ticket * * @a in_creds must be non-null. @a in_creds->client and @a in_creds->server * must be filled in to specify the client and the server respectively. If any * authorization data needs to be requested for the service ticket (such as * restrictions on how the ticket can be used), specify it in @a * in_creds->authdata; otherwise set @a in_creds->authdata to NULL. The * session key type is specified in @a in_creds->keyblock.enctype, if it is * nonzero. * * The expiration date is specified in @a in_creds->times.endtime. * The KDC may return tickets with an earlier expiration date. * If @a in_creds->times.endtime is set to 0, the latest possible * expiration date will be requested. * * Any returned ticket and intermediate ticket-granting tickets are stored * in @a ccache. * * Use krb5_free_creds() to free @a out_creds when it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_credentials(krb5_context context, krb5_flags options, krb5_ccache ccache, krb5_creds *in_creds, krb5_creds **out_creds); /** @deprecated Replaced by krb5_get_validated_creds. */ krb5_error_code KRB5_CALLCONV krb5_get_credentials_validate(krb5_context context, krb5_flags options, krb5_ccache ccache, krb5_creds *in_creds, krb5_creds **out_creds); /** @deprecated Replaced by krb5_get_renewed_creds. */ krb5_error_code KRB5_CALLCONV krb5_get_credentials_renew(krb5_context context, krb5_flags options, krb5_ccache ccache, krb5_creds *in_creds, krb5_creds **out_creds); /** * Create a @c KRB_AP_REQ message. * * @param [in] context Library context * @param [in,out] auth_context Pre-existing or newly created auth context * @param [in] ap_req_options @ref AP_OPTS options * @param [in] service Service name, or NULL to use @c "host" * @param [in] hostname Host name, or NULL to use local hostname * @param [in] in_data Application data to be checksummed in the * authenticator, or NULL * @param [in] ccache Credential cache used to obtain credentials * for the desired service. * @param [out] outbuf @c AP-REQ message * * This function is similar to krb5_mk_req_extended() except that it uses a * given @a hostname, @a service, and @a ccache to construct a service * principal name and obtain credentials. * * Use krb5_free_data_contents() to free @a outbuf when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_mk_req(krb5_context context, krb5_auth_context *auth_context, krb5_flags ap_req_options, char *service, char *hostname, krb5_data *in_data, krb5_ccache ccache, krb5_data *outbuf); /** * Create a @c KRB_AP_REQ message using supplied credentials. * * @param [in] context Library context * @param [in,out] auth_context Pre-existing or newly created auth context * @param [in] ap_req_options @ref AP_OPTS options * @param [in] in_data Application data to be checksummed in the * authenticator, or NULL * @param [in] in_creds Credentials for the service with valid ticket * and key * @param [out] outbuf @c AP-REQ message * * Valid @a ap_req_options are: * @li #AP_OPTS_USE_SESSION_KEY - Use the session key when creating the * request used for user to user * authentication. * @li #AP_OPTS_MUTUAL_REQUIRED - Request a mutual authentication packet from * the reciever. * @li #AP_OPTS_USE_SUBKEY - Generate a subsession key from the current * session key obtained from the credentials. * * This function creates a KRB_AP_REQ message using supplied credentials @a * in_creds. @a auth_context may point to an existing auth context or to NULL, * in which case a new one will be created. If @a in_data is non-null, a * checksum of it will be included in the authenticator contained in the * KRB_AP_REQ message. Use krb5_free_data_contents() to free @a outbuf when it * is no longer needed. * * On successful return, the authenticator is stored in @a auth_context with * the @a client and @a checksum fields nulled out. (This is to prevent * pointer-sharing problems; the caller should not need these fields anyway, * since the caller supplied them.) * * @sa krb5_mk_req() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_mk_req_extended(krb5_context context, krb5_auth_context *auth_context, krb5_flags ap_req_options, krb5_data *in_data, krb5_creds *in_creds, krb5_data *outbuf); /** * Format and encrypt a @c KRB_AP_REP message. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] outbuf @c AP-REP message * * This function fills in @a outbuf with an AP-REP message using information * from @a auth_context. * * If the flags in @a auth_context indicate that a sequence number should be * used (either #KRB5_AUTH_CONTEXT_DO_SEQUENCE or * #KRB5_AUTH_CONTEXT_RET_SEQUENCE) and the local sequence number in @a * auth_context is 0, a new number will be generated with * krb5_generate_seq_number(). * * Use krb5_free_data_contents() to free @a outbuf when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_mk_rep(krb5_context context, krb5_auth_context auth_context, krb5_data *outbuf); /** * Format and encrypt a @c KRB_AP_REP message for DCE RPC. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] outbuf @c AP-REP message * * Use krb5_free_data_contents() to free @a outbuf when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_mk_rep_dce(krb5_context context, krb5_auth_context auth_context, krb5_data *outbuf); /** * Parse and decrypt a @c KRB_AP_REP message. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] inbuf AP-REP message * @param [out] repl Decrypted reply message * * This function parses, decrypts and verifies a message from @a inbuf and * fills in @a repl with a pointer to allocated memory containing the fields * from the encrypted response. * * Use krb5_free_ap_rep_enc_part() to free @a repl when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_rd_rep(krb5_context context, krb5_auth_context auth_context, const krb5_data *inbuf, krb5_ap_rep_enc_part **repl); /** * Parse and decrypt a @c KRB_AP_REP message for DCE RPC. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] inbuf AP-REP message * @param [out] nonce Sequence number from the decrypted reply * * This function parses, decrypts and verifies a message from @a inbuf and * fills in @a nonce with a decrypted reply sequence number. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_rd_rep_dce(krb5_context context, krb5_auth_context auth_context, const krb5_data *inbuf, krb5_ui_4 *nonce); /** * Format and encode a @c KRB_ERROR message. * * @param [in] context Library context * @param [in] dec_err Error structure to be encoded * @param [out] enc_err Encoded error structure * * This function creates a @c KRB_ERROR message in @a enc_err. Use * krb5_free_data_contents() to free @a enc_err when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_mk_error(krb5_context context, const krb5_error *dec_err, krb5_data *enc_err); /** * Decode a @c KRB-ERROR message. * * @param [in] context Library context * @param [in] enc_errbuf Encoded error message * @param [out] dec_error Decoded error message * * This function processes @c KRB-ERROR message @a enc_errbuf and returns * an allocated structure @a dec_error containing the error message. * Use krb5_free_error() to free @a dec_error when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_rd_error(krb5_context context, const krb5_data *enc_errbuf, krb5_error **dec_error); /** * Process @c KRB-SAFE message. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] inbuf @c KRB-SAFE message to be parsed * @param [out] outbuf Data parsed from @c KRB-SAFE message * @param [out] outdata Replay data. Specify NULL if not needed * * This function parses a @c KRB-SAFE message, verifies its integrity, and * stores its data into @a outbuf. * * @note The @a outdata argument is required if #KRB5_AUTH_CONTEXT_RET_TIME or * #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set in the @a auth_context. * * @note @a auth_context must have a remote address set. This address will be * used to verify the sender address in the KRB-SAFE message. If @a * auth_context has a local address set, it will be used to verify the * receiver address in the KRB-SAFE message if the message contains one. * Both addresses must use type @c ADDRTYPE_ADDRPORT. * * If the #KRB5_AUTH_CONTEXT_DO_SEQUENCE flag is set in @a auth_context, the * sequence number of the KRB-SAFE message is checked against the remote * sequence number field of @a auth_context. Otherwise, the sequence number is * not used. * * If the #KRB5_AUTH_CONTEXT_DO_TIME flag is set in @a auth_context, * then two additional checks are performed: * @li The timestamp in the message must be within the permitted clock skew * (which is usually five minutes). * @li The message must not be a replayed message field in @a auth_context. * * Use krb5_free_data_contents() to free @a outbuf when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_rd_safe(krb5_context context, krb5_auth_context auth_context, const krb5_data *inbuf, krb5_data *outbuf, krb5_replay_data *outdata); /** * Process a @c KRB-PRIV message. * * @param [in] context Library context * @param [in] auth_context Authentication structure * @param [in] inbuf @c KRB-PRIV message to be parsed * @param [out] outbuf Data parsed from @c KRB-PRIV message * @param [out] outdata Replay data. Specify NULL if not needed * * This function parses a @c KRB-PRIV message, verifies its integrity, and * stores its unencrypted data into @a outbuf. * * @note If the #KRB5_AUTH_CONTEXT_RET_TIME or * #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set in @a auth_context, @a * outdata is required. * * @note @a auth_context must have a remote address set. This address will be * used to verify the sender address in the KRB-PRIV message. If @a * auth_context has a local address set, it will be used to verify the * receiver address in the KRB-PRIV message if the message contains one. * Both addresses must use type @c ADDRTYPE_ADDRPORT. * * If the #KRB5_AUTH_CONTEXT_DO_SEQUENCE flag is set in @a auth_context, the * sequence number of the KRB-SAFE message is checked against the remote * sequence number field of @a auth_context. Otherwise, the sequence number is * not used. * * If the #KRB5_AUTH_CONTEXT_DO_TIME flag is set in @a auth_context, * then two additional checks are performed: * @li The timestamp in the message must be within the permitted clock skew * (which is usually five minutes). * @li The message must not be a replayed message field in @a auth_context. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_rd_priv(krb5_context context, krb5_auth_context auth_context, const krb5_data *inbuf, krb5_data *outbuf, krb5_replay_data *outdata); /** * Convert a string principal name to a krb5_principal structure. * * @param [in] context Library context * @param [in] name String representation of a principal name * @param [out] principal_out New principal * * Convert a string representation of a principal name to a krb5_principal * structure. * * A string representation of a Kerberos name consists of one or more principal * name components, separated by slashes, optionally followed by the \@ * character and a realm name. If the realm name is not specified, the local * realm is used. * * To use the slash and \@ symbols as part of a component (quoted) instead of * using them as a component separator or as a realm prefix), put a backslash * (\) character in front of the symbol. Similarly, newline, tab, backspace, * and NULL characters can be included in a component by using @c n, @c t, @c b * or @c 0, respectively. * * @note The realm in a Kerberos @a name cannot contain slash, colon, * or NULL characters. * * Use krb5_free_principal() to free @a principal_out when it is no longer * needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_parse_name(krb5_context context, const char *name, krb5_principal *principal_out); #define KRB5_PRINCIPAL_PARSE_NO_REALM 0x1 /**< Error if realm is present */ #define KRB5_PRINCIPAL_PARSE_REQUIRE_REALM 0x2 /**< Error if realm is not present */ #define KRB5_PRINCIPAL_PARSE_ENTERPRISE 0x4 /**< Create single-component enterprise principle */ #define KRB5_PRINCIPAL_PARSE_IGNORE_REALM 0x8 /**< Ignore realm if present */ /** * Convert a string principal name to a krb5_principal with flags. * * @param [in] context Library context * @param [in] name String representation of a principal name * @param [in] flags Flag * @param [out] principal_out New principal * * Similar to krb5_parse_name(), this function converts a single-string * representation of a principal name to a krb5_principal structure. * * The following flags are valid: * @li #KRB5_PRINCIPAL_PARSE_NO_REALM - no realm must be present in @a name * @li #KRB5_PRINCIPAL_PARSE_REQUIRE_REALM - realm must be present in @a name * @li #KRB5_PRINCIPAL_PARSE_ENTERPRISE - create single-component enterprise * principal * @li #KRB5_PRINCIPAL_PARSE_IGNORE_REALM - ignore realm if present in @a name * * If @c KRB5_PRINCIPAL_PARSE_NO_REALM or @c KRB5_PRINCIPAL_PARSE_IGNORE_REALM * is specified in @a flags, the realm of the new principal will be empty. * Otherwise, the default realm for @a context will be used if @a name does not * specify a realm. * * Use krb5_free_principal() to free @a principal_out when it is no longer * needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_parse_name_flags(krb5_context context, const char *name, int flags, krb5_principal *principal_out); /** * Convert a krb5_principal structure to a string representation. * * @param [in] context Library context * @param [in] principal Principal * @param [out] name String representation of principal name * * The resulting string representation uses the format and quoting conventions * described for krb5_parse_name(). * * Use krb5_free_unparsed_name() to free @a name when it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_unparse_name(krb5_context context, krb5_const_principal principal, register char **name); /** * Convert krb5_principal structure to string and length. * * @param [in] context Library context * @param [in] principal Principal * @param [in,out] name String representation of principal name * @param [in,out] size Size of unparsed name * * This function is similar to krb5_unparse_name(), but allows the use of an * existing buffer for the result. If size is not NULL, then @a name must * point to either NULL or an existing buffer of at least the size pointed to * by @a size. The buffer will be allocated or resized if necessary, with the * new pointer stored into @a name. Whether or not the buffer is resized, the * necessary space for the result, including null terminator, will be stored * into @a size. * * If size is NULL, this function behaves exactly as krb5_unparse_name(). * * @retval * 0 Success * @return * Kerberos error codes. On failure @a name is set to NULL */ krb5_error_code KRB5_CALLCONV krb5_unparse_name_ext(krb5_context context, krb5_const_principal principal, char **name, unsigned int *size); #define KRB5_PRINCIPAL_UNPARSE_SHORT 0x1 /**< Omit realm if it is the local realm */ #define KRB5_PRINCIPAL_UNPARSE_NO_REALM 0x2 /**< Omit realm always */ #define KRB5_PRINCIPAL_UNPARSE_DISPLAY 0x4 /**< Don't escape special characters */ /** * Convert krb5_principal structure to a string with flags. * * @param [in] context Library context * @param [in] principal Principal * @param [in] flags Flags * @param [out] name String representation of principal name * * Similar to krb5_unparse_name(), this function converts a krb5_principal * structure to a string representation. * * The following flags are valid: * @li #KRB5_PRINCIPAL_UNPARSE_SHORT - omit realm if it is the local realm * @li #KRB5_PRINCIPAL_UNPARSE_NO_REALM - omit realm * @li #KRB5_PRINCIPAL_UNPARSE_DISPLAY - do not quote special characters * * Use krb5_free_unparsed_name() to free @a name when it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes. On failure @a name is set to NULL */ krb5_error_code KRB5_CALLCONV krb5_unparse_name_flags(krb5_context context, krb5_const_principal principal, int flags, char **name); /** * Convert krb5_principal structure to string format with flags. * * @param [in] context Library context * @param [in] principal Principal * @param [in] flags Flags * @param [out] name Single string format of principal name * @param [out] size Size of unparsed name buffer * * @sa krb5_unparse_name() krb5_unparse_name_flags() krb5_unparse_name_ext() * * @retval * 0 Success * @return * Kerberos error codes. On failure @a name is set to NULL */ krb5_error_code KRB5_CALLCONV krb5_unparse_name_flags_ext(krb5_context context, krb5_const_principal principal, int flags, char **name, unsigned int *size); /** * Set the realm field of a principal * * @param [in] context Library context * @param [in] principal Principal name * @param [in] realm Realm name * * Set the realm name part of @a principal to @a realm, overwriting the * previous realm. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_set_principal_realm(krb5_context context, krb5_principal principal, const char *realm); /** * Search a list of addresses for a specified address. * * @param [in] context Library context * @param [in] addr Address to search for * @param [in] addrlist Address list to be searched (or NULL) * * @note If @a addrlist contains only a NetBIOS addresses, it will be treated * as a null list. * * @return * TRUE if @a addr is listed in @a addrlist, or @c addrlist is NULL; FALSE * otherwise */ krb5_boolean KRB5_CALLCONV_WRONG krb5_address_search(krb5_context context, const krb5_address *addr, krb5_address *const *addrlist); /** * Compare two Kerberos addresses. * * @param [in] context Library context * @param [in] addr1 First address to be compared * @param [in] addr2 Second address to be compared * * @return * TRUE if the addresses are the same, FALSE otherwise */ krb5_boolean KRB5_CALLCONV krb5_address_compare(krb5_context context, const krb5_address *addr1, const krb5_address *addr2); /** * Return an ordering of the specified addresses. * * @param [in] context Library context * @param [in] addr1 First address * @param [in] addr2 Second address * * @retval * 0 The two addresses are the same * @retval * \< 0 First address is less than second * @retval * \> 0 First address is greater than second */ int KRB5_CALLCONV krb5_address_order(krb5_context context, const krb5_address *addr1, const krb5_address *addr2); /** * Compare the realms of two principals. * * @param [in] context Library context * @param [in] princ1 First principal * @param [in] princ2 Second principal * * @retval * TRUE if the realm names are the same; FALSE otherwise */ krb5_boolean KRB5_CALLCONV krb5_realm_compare(krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2); /** * Compare two principals. * * @param [in] context Library context * @param [in] princ1 First principal * @param [in] princ2 Second principal * * @retval * TRUE if the principals are the same; FALSE otherwise */ krb5_boolean KRB5_CALLCONV krb5_principal_compare(krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2); /** * Compare two principals ignoring realm components. * * @param [in] context Library context * @param [in] princ1 First principal * @param [in] princ2 Second principal * * Similar to krb5_principal_compare(), but do not compare the realm * components of the principals. * * @retval * TRUE if the principals are the same; FALSE otherwise */ krb5_boolean KRB5_CALLCONV krb5_principal_compare_any_realm(krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2); #define KRB5_PRINCIPAL_COMPARE_IGNORE_REALM 1 /**< ignore realm component */ #define KRB5_PRINCIPAL_COMPARE_ENTERPRISE 2 /**< UPNs as real principals */ #define KRB5_PRINCIPAL_COMPARE_CASEFOLD 4 /**< case-insensitive */ #define KRB5_PRINCIPAL_COMPARE_UTF8 8 /**< treat principals as UTF-8 */ /** * Compare two principals with additional flags. * * @param [in] context Library context * @param [in] princ1 First principal * @param [in] princ2 Second principal * @param [in] flags Flags * * Valid flags are: * @li #KRB5_PRINCIPAL_COMPARE_IGNORE_REALM - ignore realm component * @li #KRB5_PRINCIPAL_COMPARE_ENTERPRISE - UPNs as real principals * @li #KRB5_PRINCIPAL_COMPARE_CASEFOLD case-insensitive * @li #KRB5_PRINCIPAL_COMPARE_UTF8 - treat principals as UTF-8 * * @sa krb5_principal_compare() * * @retval * TRUE if the principal names are the same; FALSE otherwise */ krb5_boolean KRB5_CALLCONV krb5_principal_compare_flags(krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2, int flags); /** * Initialize an empty @c krb5_keyblock. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [in] length Length of keyblock (or 0) * @param [out] out New keyblock structure * * Initialize a new keyblock and allocate storage for the contents of the key. * It is legal to pass in a length of 0, in which case contents are left * unallocated. Use krb5_free_keyblock() to free @a out when it is no longer * needed. * * @note If @a length is set to 0, contents are left unallocated. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_keyblock(krb5_context context, krb5_enctype enctype, size_t length, krb5_keyblock **out); /** * Copy a keyblock. * * @param [in] context Library context * @param [in] from Keyblock to be copied * @param [out] to Copy of keyblock @a from * * This function creates a new keyblock with the same contents as @a from. Use * krb5_free_keyblock() to free @a to when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_keyblock(krb5_context context, const krb5_keyblock *from, krb5_keyblock **to); /** * Copy the contents of a keyblock. * * @param [in] context Library context * @param [in] from Key to be copied * @param [out] to Output key * * This function copies the contents of @a from to @a to. Use * krb5_free_keyblock_contents() to free @a to when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_keyblock_contents(krb5_context context, const krb5_keyblock *from, krb5_keyblock *to); /** * Copy a krb5_creds structure. * * @param [in] context Library context * @param [in] incred Credentials structure to be copied * @param [out] outcred Copy of @a incred * * This function creates a new credential with the contents of @a incred. Use * krb5_free_creds() to free @a outcred when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_creds(krb5_context context, const krb5_creds *incred, krb5_creds **outcred); /** * Copy a krb5_data object. * * @param [in] context Library context * @param [in] indata Data object to be copied * @param [out] outdata Copy of @a indata * * This function creates a new krb5_data object with the contents of @a indata. * Use krb5_free_data() to free @a outdata when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_data(krb5_context context, const krb5_data *indata, krb5_data **outdata); /** * Copy a principal. * * @param [in] context Library context * @param [in] inprinc Principal to be copied * @param [out] outprinc Copy of @a inprinc * * This function creates a new principal structure with the contents of @a * inprinc. Use krb5_free_principal() to free @a outprinc when it is no longer * needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_principal(krb5_context context, krb5_const_principal inprinc, krb5_principal *outprinc); /** * Copy an array of addresses. * * @param [in] context Library context * @param [in] inaddr Array of addresses to be copied * @param [out] outaddr Copy of array of addresses * * This function creates a new address array containing a copy of @a inaddr. * Use krb5_free_addresses() to free @a outaddr when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_addresses(krb5_context context, krb5_address *const *inaddr, krb5_address ***outaddr); /** * Copy a krb5_ticket structure. * * @param [in] context Library context * @param [in] from Ticket to be copied * @param [out] pto Copy of ticket * * This function creates a new krb5_ticket structure containing the contents of * @a from. Use krb5_free_ticket() to free @a pto when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_ticket(krb5_context context, const krb5_ticket *from, krb5_ticket **pto); /** * Copy an authorization data list. * * @param [in] context Library context * @param [in] in_authdat List of @a krb5_authdata structures * @param [out] out New array of @a krb5_authdata structures * * This function creates a new authorization data list containing a copy of @a * in_authdat, which must be null-terminated. Use krb5_free_authdata() to free * @a out when it is no longer needed. * * @note The last array entry in @a in_authdat must be a NULL pointer. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_authdata(krb5_context context, krb5_authdata *const *in_authdat, krb5_authdata ***out); /** * Find authorization data elements. * * @param [in] context Library context * @param [in] ticket_authdata Authorization data list from ticket * @param [in] ap_req_authdata Authorization data list from AP request * @param [in] ad_type Authorization data type to find * @param [out] results List of matching entries * * This function searches @a ticket_authdata and @a ap_req_authdata for * elements of type @a ad_type. Either input list may be NULL, in which case * it will not be searched; otherwise, the input lists must be terminated by * NULL entries. This function will search inside AD-IF-RELEVANT containers if * found in either list. Use krb5_free_authdata() to free @a results when it * is no longer needed. * * @version New in 1.10 */ krb5_error_code KRB5_CALLCONV krb5_find_authdata(krb5_context context, krb5_authdata *const *ticket_authdata, krb5_authdata *const *ap_req_authdata, krb5_authdatatype ad_type, krb5_authdata ***results); /** * Merge two authorization data lists into a new list. * * @param [in] context Library context * @param [in] inauthdat1 First list of @a krb5_authdata structures * @param [in] inauthdat2 Second list of @a krb5_authdata structures * @param [out] outauthdat Merged list of @a krb5_authdata structures * * Merge two authdata arrays, such as the array from a ticket * and authenticator. * Use krb5_free_authdata() to free @a outauthdat when it is no longer needed. * * @note The last array entry in @a inauthdat1 and @a inauthdat2 * must be a NULL pointer. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_merge_authdata(krb5_context context, krb5_authdata *const *inauthdat1, krb5_authdata * const *inauthdat2, krb5_authdata ***outauthdat); /** * Copy a krb5_authenticator structure. * * @param [in] context Library context * @param [in] authfrom krb5_authenticator structure to be copied * @param [out] authto Copy of krb5_authenticator structure * * This function creates a new krb5_authenticator structure with the content of * @a authfrom. Use krb5_free_authenticator() to free @a authto when it is no * longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_authenticator(krb5_context context, const krb5_authenticator *authfrom, krb5_authenticator **authto); /** * Copy a krb5_checksum structure. * * @param [in] context Library context * @param [in] ckfrom Checksum to be copied * @param [out] ckto Copy of krb5_checksum structure * * This function creates a new krb5_checksum structure with the contents of @a * ckfrom. Use krb5_free_checksum() to free @a ckto when it is no longer * needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_checksum(krb5_context context, const krb5_checksum *ckfrom, krb5_checksum **ckto); /** * Generate a replay cache object for server use and open it. * * @param [in] context Library context * @param [in] piece Unique identifier for replay cache * @param [out] rcptr Handle to an open rcache * * This function generates a replay cache name based on @a piece and opens a * handle to it. Typically @a piece is the first component of the service * principal name. Use krb5_rc_close() to close @a rcptr when it is no longer * needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_server_rcache(krb5_context context, const krb5_data *piece, krb5_rcache *rcptr); /** * Build a principal name using length-counted strings. * * @param [in] context Library context * @param [out] princ Principal name * @param [in] rlen Realm name length * @param [in] realm Realm name * @param [in] ... List of unsigned int/char * components, followed by 0 * * This function creates a principal from a length-counted string and a * variable-length list of length-counted components. The list of components * ends with the first 0 length argument (so it is not possible to specify an * empty component with this function). Call krb5_free_principal() to free * allocated memory for principal when it is no longer needed. * * @code * Example of how to build principal WELLKNOWN/ANONYMOUS@R * krb5_build_principal_ext(context, &principal, strlen("R"), "R", * (unsigned int)strlen(KRB5_WELLKNOWN_NAMESTR), * KRB5_WELLKNOWN_NAMESTR, * (unsigned int)strlen(KRB5_ANONYMOUS_PRINCSTR), * KRB5_ANONYMOUS_PRINCSTR, 0); * @endcode * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV_C krb5_build_principal_ext(krb5_context context, krb5_principal * princ, unsigned int rlen, const char * realm, ...); /** * Build a principal name using null-terminated strings. * * @param [in] context Library context * @param [out] princ Principal name * @param [in] rlen Realm name length * @param [in] realm Realm name * @param [in] ... List of char * components, ending with NULL * * Call krb5_free_principal() to free @a princ when it is no longer needed. * * @note krb5_build_principal() and krb5_build_principal_alloc_va() perform the * same task. krb5_build_principal() takes variadic arguments. * krb5_build_principal_alloc_va() takes a pre-computed @a varargs pointer. * * @code * Example of how to build principal H/S@R * krb5_build_principal(context, &principal, * strlen("R"), "R", "H", "S", (char*)NULL); * @endcode * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV_C krb5_build_principal(krb5_context context, krb5_principal * princ, unsigned int rlen, const char * realm, ...) #if __GNUC__ >= 4 __attribute__ ((sentinel)) #endif ; #if KRB5_DEPRECATED /** @deprecated Replaced by krb5_build_principal_alloc_va(). */ KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV krb5_build_principal_va(krb5_context context, krb5_principal princ, unsigned int rlen, const char *realm, va_list ap); #endif /** * Build a principal name, using a precomputed variable argument list * * @param [in] context Library context * @param [out] princ Principal structure * @param [in] rlen Realm name length * @param [in] realm Realm name * @param [in] ap List of char * components, ending with NULL * * Similar to krb5_build_principal(), this function builds a principal name, * but its name components are specified as a va_list. * * Use krb5_free_principal() to deallocate @a princ when it is no longer * needed. * * @code * Function usage example: * va_list ap; * va_start(ap, realm); * krb5_build_principal_alloc_va(context, princ, rlen, realm, ap); * va_end(ap); * @endcode * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_build_principal_alloc_va(krb5_context context, krb5_principal *princ, unsigned int rlen, const char *realm, va_list ap); /** * Convert a Kerberos V4 principal to a Kerberos V5 principal. * * @param [in] context Library context * @param [in] name V4 name * @param [in] instance V4 instance * @param [in] realm Realm * @param [out] princ V5 principal * * This function builds a @a princ from V4 specification based on given input * @a name.instance\@realm. * * Use krb5_free_principal() to free @a princ when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_425_conv_principal(krb5_context context, const char *name, const char *instance, const char *realm, krb5_principal *princ); /** * Convert a Kerberos V5 principal to a Kerberos V4 principal. * * @param [in] context Library context * @param [in] princ V5 Principal * @param [out] name V4 principal's name to be filled in * @param [out] inst V4 principal's instance name to be filled in * @param [out] realm Principal's realm name to be filled in * * This function separates a V5 principal @a princ into @a name, @a instance, * and @a realm. * * @retval * 0 Success * @retval * KRB5_INVALID_PRINCIPAL Invalid principal name * @retval * KRB5_CONFIG_CANTOPEN Can't open or find Kerberos configuration file * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_524_conv_principal(krb5_context context, krb5_const_principal princ, char *name, char *inst, char *realm); /** *@deprecated */ struct credentials; /** * Convert a Kerberos V5 credentials to a Kerberos V4 credentials * * @note Not implemented * * @retval KRB524_KRB4_DISABLED (always) */ int KRB5_CALLCONV krb5_524_convert_creds(krb5_context context, krb5_creds *v5creds, struct credentials *v4creds); #if KRB5_DEPRECATED #define krb524_convert_creds_kdc krb5_524_convert_creds #define krb524_init_ets(x) (0) #endif /* libkt.spec */ /** * Get a handle for a key table. * * @param [in] context Library context * @param [in] name Name of the key table * @param [out] ktid Key table handle * * Resolve the key table name @a name and set @a ktid to a handle identifying * the key table. Use krb5_kt_close() to free @a ktid when it is no longer * needed. * * @a name must be of the form @c type:residual, where @a type must be a type * known to the library and @a residual portion should be specific to the * particular keytab type. If no @a type is given, the default is @c FILE. * * If @a name is of type @c FILE, the keytab file is not opened by this call. * * @code * Example: krb5_kt_resolve(context, "FILE:/tmp/filename", &ktid); * @endcode * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_resolve(krb5_context context, const char *name, krb5_keytab *ktid); /** * Duplicate keytab handle. * * @param [in] context Library context * @param [in] in Key table handle to be duplicated * @param [out] out Key table handle * * Create a new handle referring to the same key table as @a in. The new * handle and @a in can be closed independently. * * @version New in 1.12 */ krb5_error_code KRB5_CALLCONV krb5_kt_dup(krb5_context context, krb5_keytab in, krb5_keytab *out); /** * Get the default key table name. * * @param [in] context Library context * @param [out] name Default key table name * @param [in] name_size Space available in @a name * * Fill @a name with the name of the default key table for @a context. * * @sa MAX_KEYTAB_NAME_LEN * * @retval * 0 Success * @retval * KRB5_CONFIG_NOTENUFSPACE Buffer is too short * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_default_name(krb5_context context, char *name, int name_size); /** * Resolve the default key table. * * @param [in] context Library context * @param [out] id Key table handle * * Set @a id to a handle to the default key table. The key table is not * opened. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_default(krb5_context context, krb5_keytab *id); /** * Resolve the default client key table. * * @param [in] context Library context * @param [out] keytab_out Key table handle * * Fill @a keytab_out with a handle to the default client key table. * * @version New in 1.11 * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_client_default(krb5_context context, krb5_keytab *keytab_out); /** * Free the contents of a key table entry. * * @param [in] context Library context * @param [in] entry Key table entry whose contents are to be freed * * @note The pointer is not freed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_free_keytab_entry_contents(krb5_context context, krb5_keytab_entry *entry); /** @deprecated Use krb5_free_keytab_entry_contents instead. */ krb5_error_code KRB5_CALLCONV krb5_kt_free_entry(krb5_context context, krb5_keytab_entry *entry); /* remove and add are functions, so that they can return NOWRITE if not a writable keytab */ /** * Remove an entry from a key table. * * @param [in] context Library context * @param [in] id Key table handle * @param [in] entry Entry to remove from key table * * @retval * 0 Success * @retval * KRB5_KT_NOWRITE Key table is not writable * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_remove_entry(krb5_context context, krb5_keytab id, krb5_keytab_entry *entry); /** * Add a new entry to a key table. * * @param [in] context Library context * @param [in] id Key table handle * @param [in] entry Entry to be added * * @retval * 0 Success * @retval * ENOMEM Insufficient memory * @retval * KRB5_KT_NOWRITE Key table is not writeable * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_add_entry(krb5_context context, krb5_keytab id, krb5_keytab_entry *entry); /** * Convert a principal name into the default salt for that principal. * * @param [in] context Library context * @param [in] pr Principal name * @param [out] ret Default salt for @a pr to be filled in * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV_WRONG krb5_principal2salt(krb5_context context, register krb5_const_principal pr, krb5_data *ret); /* librc.spec--see rcache.h */ /* libcc.spec */ /** * Resolve a credential cache name. * * @param [in] context Library context * @param [in] name Credential cache name to be resolved * @param [out] cache Credential cache handle * * Fills in @a cache with a @a cache handle that corresponds to the name in @a * name. @a name should be of the form @c type:residual, and @a type must be a * type known to the library. If the @a name does not contain a colon, * interpret it as a file name. * * @code * Example: krb5_cc_resolve(context, "MEMORY:C_", &cache); * @endcode * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_resolve(krb5_context context, const char *name, krb5_ccache *cache); /** * Duplicate ccache handle. * * @param [in] context Library context * @param [in] in Credential cache handle to be duplicated * @param [out] out Credential cache handle * * Create a new handle referring to the same cache as @a in. * The new handle and @a in can be closed independently. */ krb5_error_code KRB5_CALLCONV krb5_cc_dup(krb5_context context, krb5_ccache in, krb5_ccache *out); /** * Return the name of the default credential cache. * * @param [in] context Library context * * Return a pointer to the default credential cache name for @a context, as * determined by a prior call to krb5_cc_set_default_name(), by the KRB5CCNAME * environment variable, by the default_ccache_name profile variable, or by the * operating system or build-time default value. The returned value must not * be modified or freed by the caller. The returned value becomes invalid when * @a context is destroyed krb5_free_context() or if a subsequent call to * krb5_cc_set_default_name() is made on @a context. * * The default credential cache name is cached in @a context between calls to * this function, so if the value of KRB5CCNAME changes in the process * environment after the first call to this function on, that change will not * be reflected in later calls with the same context. The caller can invoke * krb5_cc_set_default_name() with a NULL value of @a name to clear the cached * value and force the default name to be recomputed. * * @return * Name of default credential cache for the current user. */ const char *KRB5_CALLCONV krb5_cc_default_name(krb5_context context); /** * Set the default credential cache name. * * @param [in] context Library context * @param [in] name Default credential cache name or NULL * * Set the default credential cache name to @a name for future operations using * @a context. If @a name is NULL, clear any previous application-set default * name and forget any cached value of the default name for @a context. * * Calls to this function invalidate the result of any previous calls to * krb5_cc_default_name() using @a context. * * @retval * 0 Success * @retval * KV5M_CONTEXT Bad magic number for @c _krb5_context structure * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_set_default_name(krb5_context context, const char *name); /** * Resolve the default credential cache name. * * @param [in] context Library context * @param [out] ccache Pointer to credential cache name * * Create a handle to the default credential cache as given by * krb5_cc_default_name(). * * @retval * 0 Success * @retval * KV5M_CONTEXT Bad magic number for @c _krb5_context structure * @retval * KRB5_FCC_INTERNAL The name of the default credential cache cannot be * obtained * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_default(krb5_context context, krb5_ccache *ccache); /** * Copy a credential cache. * * @param [in] context Library context * @param [in] incc Credential cache to be copied * @param [out] outcc Copy of credential cache to be filled in * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_copy_creds(krb5_context context, krb5_ccache incc, krb5_ccache outcc); /** * Get a configuration value from a credential cache. * * @param [in] context Library context * @param [in] id Credential cache handle * @param [in] principal Configuration for this principal; * if NULL, global for the whole cache * @param [in] key Name of config variable * @param [out] data Data to be fetched * * Use krb5_free_data_contents() to free @a data when it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_get_config(krb5_context context, krb5_ccache id, krb5_const_principal principal, const char *key, krb5_data *data); /** * Store a configuration value in a credential cache. * * @param [in] context Library context * @param [in] id Credential cache handle * @param [in] principal Configuration for a specific principal; * if NULL, global for the whole cache * @param [in] key Name of config variable * @param [in] data Data to store, or NULL to remove * * @note Existing configuration under the same key is over-written. * * @warning Before version 1.10 @a data was assumed to be always non-null. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_set_config(krb5_context context, krb5_ccache id, krb5_const_principal principal, const char *key, krb5_data *data); /** * Test whether a principal is a configuration principal. * * @param [in] context Library context * @param [in] principal Principal to check * * @return * @c TRUE if the principal is a configuration principal (generated part of * krb5_cc_set_config()); @c FALSE otherwise. */ krb5_boolean KRB5_CALLCONV krb5_is_config_principal(krb5_context context, krb5_const_principal principal); /** * Make a credential cache the primary cache for its collection. * * @param [in] context Library context * @param [in] cache Credential cache handle * * If the type of @a cache supports it, set @a cache to be the primary * credential cache for the collection it belongs to. * * @retval * 0 Success, or the type of @a cache doesn't support switching * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_switch(krb5_context context, krb5_ccache cache); /** * Determine whether a credential cache type supports switching. * * @param [in] context Library context * @param [in] type Credential cache type * * @version New in 1.10 * * @retval TRUE if @a type supports switching * @retval FALSE if it does not or is not a valid credential cache type. */ krb5_boolean KRB5_CALLCONV krb5_cc_support_switch(krb5_context context, const char *type); /** * Find a credential cache with a specified client principal. * * @param [in] context Library context * @param [in] client Client principal * @param [out] cache_out Credential cache handle * * Find a cache within the collection whose default principal is @a client. * Use @a krb5_cc_close to close @a ccache when it is no longer needed. * * @retval 0 Success * @retval KRB5_CC_NOTFOUND * * @sa krb5_cccol_cursor_new * * @version New in 1.10 */ krb5_error_code KRB5_CALLCONV krb5_cc_cache_match(krb5_context context, krb5_principal client, krb5_ccache *cache_out); /** * Select a credential cache to use with a server principal. * * @param [in] context Library context * @param [in] server Server principal * @param [out] cache_out Credential cache handle * @param [out] princ_out Client principal * * Select a cache within the collection containing credentials most appropriate * for use with @a server, according to configured rules and heuristics. * * Use krb5_cc_close() to release @a cache_out when it is no longer needed. * Use krb5_free_principal() to release @a princ_out when it is no longer * needed. Note that @a princ_out is set in some error conditions. * * @return * If an appropriate cache is found, 0 is returned, @a cache_out is set to the * selected cache, and @a princ_out is set to the default principal of that * cache. * * If the appropriate client principal can be authoritatively determined but * the cache collection contains no credentials for that principal, then * KRB5_CC_NOTFOUND is returned, @a cache_out is set to NULL, and @a princ_out * is set to the appropriate client principal. * * If no configured mechanism can determine the appropriate cache or principal, * KRB5_CC_NOTFOUND is returned and @a cache_out and @a princ_out are set to * NULL. * * Any other error code indicates a fatal error in the processing of a cache * selection mechanism. * * @version New in 1.10 */ krb5_error_code KRB5_CALLCONV krb5_cc_select(krb5_context context, krb5_principal server, krb5_ccache *cache_out, krb5_principal *princ_out); /* krb5_free.c */ /** * Free the storage assigned to a principal. * * @param [in] context Library context * @param [in] val Principal to be freed */ void KRB5_CALLCONV krb5_free_principal(krb5_context context, krb5_principal val); /** * Free a krb5_authenticator structure. * * @param [in] context Library context * @param [in] val Authenticator structure to be freed * * This function frees the contents of @a val and the structure itself. */ void KRB5_CALLCONV krb5_free_authenticator(krb5_context context, krb5_authenticator *val); /** * Free the data stored in array of addresses. * * @param [in] context Library context * @param [in] val Array of addresses to be freed * * This function frees the contents of @a val and the array itself. * * @note The last entry in the array must be a NULL pointer. */ void KRB5_CALLCONV krb5_free_addresses(krb5_context context, krb5_address **val); /** * Free the storage assigned to array of authentication data. * * @param [in] context Library context * @param [in] val Array of authentication data to be freed * * This function frees the contents of @a val and the array itself. * * @note The last entry in the array must be a NULL pointer. */ void KRB5_CALLCONV krb5_free_authdata(krb5_context context, krb5_authdata **val); /** * Free a ticket. * * @param [in] context Library context * @param [in] val Ticket to be freed * * This function frees the contents of @a val and the structure itself. */ void KRB5_CALLCONV krb5_free_ticket(krb5_context context, krb5_ticket *val); /** * Free an error allocated by krb5_read_error() or krb5_sendauth(). * * @param [in] context Library context * @param [in] val Error data structure to be freed * * This function frees the contents of @a val and the structure itself. */ void KRB5_CALLCONV krb5_free_error(krb5_context context, register krb5_error *val); /** * Free a krb5_creds structure. * * @param [in] context Library context * @param [in] val Credential structure to be freed. * * This function frees the contents of @a val and the structure itself. */ void KRB5_CALLCONV krb5_free_creds(krb5_context context, krb5_creds *val); /** * Free the contents of a krb5_creds structure. * * @param [in] context Library context * @param [in] val Credential structure to free contents of * * This function frees the contents of @a val, but not the structure itself. */ void KRB5_CALLCONV krb5_free_cred_contents(krb5_context context, krb5_creds *val); /** * Free a krb5_checksum structure. * * @param [in] context Library context * @param [in] val Checksum structure to be freed * * This function frees the contents of @a val and the structure itself. */ void KRB5_CALLCONV krb5_free_checksum(krb5_context context, register krb5_checksum *val); /** * Free the contents of a krb5_checksum structure. * * @param [in] context Library context * @param [in] val Checksum structure to free contents of * * This function frees the contents of @a val, but not the structure itself. */ void KRB5_CALLCONV krb5_free_checksum_contents(krb5_context context, register krb5_checksum *val); /** * Free a krb5_keyblock structure. * * @param [in] context Library context * @param [in] val Keyblock to be freed * * This function frees the contents of @a val and the structure itself. */ void KRB5_CALLCONV krb5_free_keyblock(krb5_context context, register krb5_keyblock *val); /** * Free the contents of a krb5_keyblock structure. * * @param [in] context Library context * @param [in] key Keyblock to be freed * * This function frees the contents of @a key, but not the structure itself. */ void KRB5_CALLCONV krb5_free_keyblock_contents(krb5_context context, register krb5_keyblock *key); /** * Free a krb5_ap_rep_enc_part structure. * * @param [in] context Library context * @param [in] val AP-REP enc part to be freed * * This function frees the contents of @a val and the structure itself. */ void KRB5_CALLCONV krb5_free_ap_rep_enc_part(krb5_context context, krb5_ap_rep_enc_part *val); /** * Free a krb5_data structure. * * @param [in] context Library context * @param [in] val Data structure to be freed * * This function frees the contents of @a val and the structure itself. */ void KRB5_CALLCONV krb5_free_data(krb5_context context, krb5_data *val); /* Free a krb5_octet_data structure (should be unused). */ void KRB5_CALLCONV krb5_free_octet_data(krb5_context context, krb5_octet_data *val); /** * Free the contents of a krb5_data structure and zero the data field. * * @param [in] context Library context * @param [in] val Data structure to free contents of * * This function frees the contents of @a val, but not the structure itself. */ void KRB5_CALLCONV krb5_free_data_contents(krb5_context context, krb5_data *val); /** * Free a string representation of a principal. * * @param [in] context Library context * @param [in] val Name string to be freed */ void KRB5_CALLCONV krb5_free_unparsed_name(krb5_context context, char *val); /** * Free a string allocated by a krb5 function. * * @param [in] context Library context * @param [in] val String to be freed * * @version New in 1.10 */ void KRB5_CALLCONV krb5_free_string(krb5_context context, char *val); /** * Free an array of encryption types. * * @param [in] context Library context * @param [in] val Array of enctypes to be freed * * @version New in 1.12 */ void KRB5_CALLCONV krb5_free_enctypes(krb5_context context, krb5_enctype *val); /** * Free an array of checksum types. * * @param [in] context Library context * @param [in] val Array of checksum types to be freed */ void KRB5_CALLCONV krb5_free_cksumtypes(krb5_context context, krb5_cksumtype *val); /* From krb5/os, but needed by the outside world */ /** * Retrieve the system time of day, in sec and ms, since the epoch. * * @param [in] context Library context * @param [out] seconds System timeofday, seconds portion * @param [out] microseconds System timeofday, microseconds portion * * This function retrieves the system time of day with the context * specific time offset adjustment. * * @sa krb5_crypto_us_timeofday() * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_us_timeofday(krb5_context context, krb5_timestamp *seconds, krb5_int32 *microseconds); /** * Retrieve the current time with context specific time offset adjustment. * * @param [in] context Library context * @param [out] timeret Timestamp to fill in * * This function retrieves the system time of day with the context specific * time offset adjustment. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_timeofday(krb5_context context, register krb5_timestamp *timeret); /** * Check if a timestamp is within the allowed clock skew of the current time. * * @param [in] context Library context * @param [in] date Timestamp to check * * This function checks if @a date is close enough to the current time * according to the configured allowable clock skew. * * @version New in 1.10 * * @retval 0 Success * @retval KRB5KRB_AP_ERR_SKEW @a date is not within allowable clock skew */ krb5_error_code KRB5_CALLCONV krb5_check_clockskew(krb5_context context, krb5_timestamp date); /** * Return all interface addresses for this host. * * @param [in] context Library context * @param [out] addr Array of krb5_address pointers, ending with * NULL * * Use krb5_free_addresses() to free @a addr when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_os_localaddr(krb5_context context, krb5_address ***addr); /** * Retrieve the default realm. * * @param [in] context Library context * @param [out] lrealm Default realm name * * Retrieves the default realm to be used if no user-specified realm is * available. * * Use krb5_free_default_realm() to free @a lrealm when it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_default_realm(krb5_context context, char **lrealm); /** * Override the default realm for the specified context. * * @param [in] context Library context * @param [in] lrealm Realm name for the default realm * * If @a lrealm is NULL, clear the default realm setting. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_set_default_realm(krb5_context context, const char *lrealm); /** * Free a default realm string returned by krb5_get_default_realm(). * * @param [in] context Library context * @param [in] lrealm Realm to be freed */ void KRB5_CALLCONV krb5_free_default_realm(krb5_context context, char *lrealm); /** * Canonicalize a hostname, possibly using name service. * * @param [in] context Library context * @param [in] host Input hostname * @param [out] canonhost_out Canonicalized hostname * * This function canonicalizes orig_hostname, possibly using name service * lookups if configuration permits. Use krb5_free_string() to free @a * canonhost_out when it is no longer needed. * * @version New in 1.15 */ krb5_error_code KRB5_CALLCONV krb5_expand_hostname(krb5_context context, const char *host, char **canonhost_out); /** * Generate a full principal name from a service name. * * @param [in] context Library context * @param [in] hostname Host name, or NULL to use local host * @param [in] sname Service name, or NULL to use @c "host" * @param [in] type Principal type * @param [out] ret_princ Generated principal * * This function converts a @a hostname and @a sname into @a krb5_principal * structure @a ret_princ. The returned principal will be of the form @a * sname\/hostname\@REALM where REALM is determined by krb5_get_host_realm(). * In some cases this may be the referral (empty) realm. * * The @a type can be one of the following: * * @li #KRB5_NT_SRV_HST canonicalizes the host name before looking up the * realm and generating the principal. * * @li #KRB5_NT_UNKNOWN accepts the hostname as given, and does not * canonicalize it. * * Use krb5_free_principal to free @a ret_princ when it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_sname_to_principal(krb5_context context, const char *hostname, const char *sname, krb5_int32 type, krb5_principal *ret_princ); /** * Test whether a principal matches a matching principal. * * @param [in] context Library context * @param [in] matching Matching principal * @param [in] princ Principal to test * * @note A matching principal is a host-based principal with an empty realm * and/or second data component (hostname). Profile configuration may cause * the hostname to be ignored even if it is present. A principal matches a * matching principal if the former has the same non-empty (and non-ignored) * components of the latter. * * If @a matching is NULL, return TRUE. If @a matching is not a matching * principal, return the value of krb5_principal_compare(context, matching, * princ). * * @return * TRUE if @a princ matches @a matching, FALSE otherwise. */ krb5_boolean KRB5_CALLCONV krb5_sname_match(krb5_context context, krb5_const_principal matching, krb5_const_principal princ); /** * Change a password for an existing Kerberos account. * * @param [in] context Library context * @param [in] creds Credentials for kadmin/changepw service * @param [in] newpw New password * @param [out] result_code Numeric error code from server * @param [out] result_code_string String equivalent to @a result_code * @param [out] result_string Change password response from the KDC * * Change the password for the existing principal identified by @a creds. * * The possible values of the output @a result_code are: * * @li #KRB5_KPASSWD_SUCCESS (0) - success * @li #KRB5_KPASSWD_MALFORMED (1) - Malformed request error * @li #KRB5_KPASSWD_HARDERROR (2) - Server error * @li #KRB5_KPASSWD_AUTHERROR (3) - Authentication error * @li #KRB5_KPASSWD_SOFTERROR (4) - Password change rejected * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_change_password(krb5_context context, krb5_creds *creds, const char *newpw, int *result_code, krb5_data *result_code_string, krb5_data *result_string); /** * Set a password for a principal using specified credentials. * * @param [in] context Library context * @param [in] creds Credentials for kadmin/changepw service * @param [in] newpw New password * @param [in] change_password_for Change the password for this principal * @param [out] result_code Numeric error code from server * @param [out] result_code_string String equivalent to @a result_code * @param [out] result_string Data returned from the remote system * * This function uses the credentials @a creds to set the password @a newpw for * the principal @a change_password_for. It implements the set password * operation of RFC 3244, for interoperability with Microsoft Windows * implementations. * * @note If @a change_password_for is NULL, the change is performed on the * current principal. If @a change_password_for is non-null, the change is * performed on the principal name passed in @a change_password_for. * * The error code and strings are returned in @a result_code, * @a result_code_string and @a result_string. * * @sa krb5_set_password_using_ccache() * * @retval * 0 Success and result_code is set to #KRB5_KPASSWD_SUCCESS. * @return * Kerberos error codes. */ krb5_error_code KRB5_CALLCONV krb5_set_password(krb5_context context, krb5_creds *creds, const char *newpw, krb5_principal change_password_for, int *result_code, krb5_data *result_code_string, krb5_data *result_string); /** * Set a password for a principal using cached credentials. * * @param [in] context Library context * @param [in] ccache Credential cache * @param [in] newpw New password * @param [in] change_password_for Change the password for this principal * @param [out] result_code Numeric error code from server * @param [out] result_code_string String equivalent to @a result_code * @param [out] result_string Data returned from the remote system * * This function uses the cached credentials from @a ccache to set the password * @a newpw for the principal @a change_password_for. It implements RFC 3244 * set password operation (interoperable with MS Windows implementations) using * the credential cache. * * The error code and strings are returned in @a result_code, * @a result_code_string and @a result_string. * * @note If @a change_password_for is set to NULL, the change is performed on * the default principal in @a ccache. If @a change_password_for is non null, * the change is performed on the specified principal. * * @sa krb5_set_password() * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_set_password_using_ccache(krb5_context context, krb5_ccache ccache, const char *newpw, krb5_principal change_password_for, int *result_code, krb5_data *result_code_string, krb5_data *result_string); /** * Get a result message for changing or setting a password. * * @param [in] context Library context * @param [in] server_string Data returned from the remote system * @param [out] message_out A message displayable to the user * * This function processes the @a server_string returned in the @a * result_string parameter of krb5_change_password(), krb5_set_password(), and * related functions, and returns a displayable string. If @a server_string * contains Active Directory structured policy information, it will be * converted into human-readable text. * * Use krb5_free_string() to free @a message_out when it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes * * @version New in 1.11 */ krb5_error_code KRB5_CALLCONV krb5_chpw_message(krb5_context context, const krb5_data *server_string, char **message_out); /** * Retrieve configuration profile from the context. * * @param [in] context Library context * @param [out] profile Pointer to data read from a configuration file * * This function creates a new @a profile object that reflects profile * in the supplied @a context. * * The @a profile object may be freed with profile_release() function. * See profile.h and profile API for more details. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_profile(krb5_context context, struct _profile_t ** profile); #if KRB5_DEPRECATED /** @deprecated Replaced by krb5_get_init_creds_password().*/ KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV krb5_get_in_tkt_with_password(krb5_context context, krb5_flags options, krb5_address *const *addrs, krb5_enctype *ktypes, krb5_preauthtype *pre_auth_types, const char *password, krb5_ccache ccache, krb5_creds *creds, krb5_kdc_rep **ret_as_reply); /** @deprecated Replaced by krb5_get_init_creds(). */ KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV krb5_get_in_tkt_with_skey(krb5_context context, krb5_flags options, krb5_address *const *addrs, krb5_enctype *ktypes, krb5_preauthtype *pre_auth_types, const krb5_keyblock *key, krb5_ccache ccache, krb5_creds *creds, krb5_kdc_rep **ret_as_reply); /** @deprecated Replaced by krb5_get_init_creds_keytab(). */ KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV krb5_get_in_tkt_with_keytab(krb5_context context, krb5_flags options, krb5_address *const *addrs, krb5_enctype *ktypes, krb5_preauthtype *pre_auth_types, krb5_keytab arg_keytab, krb5_ccache ccache, krb5_creds *creds, krb5_kdc_rep **ret_as_reply); #endif /* KRB5_DEPRECATED */ /** * Parse and decrypt a @c KRB_AP_REQ message. * * @param [in] context Library context * @param [in,out] auth_context Pre-existing or newly created auth context * @param [in] inbuf AP-REQ message to be parsed * @param [in] server Matching principal for server, or NULL to * allow any principal in keytab * @param [in] keytab Key table, or NULL to use the default * @param [out] ap_req_options If non-null, the AP-REQ flags on output * @param [out] ticket If non-null, ticket from the AP-REQ message * * This function parses, decrypts and verifies a AP-REQ message from @a inbuf * and stores the authenticator in @a auth_context. * * If a keyblock was specified in @a auth_context using * krb5_auth_con_setuseruserkey(), that key is used to decrypt the ticket in * AP-REQ message and @a keytab is ignored. In this case, @a server should be * specified as a complete principal name to allow for proper transited-path * checking and replay cache selection. * * Otherwise, the decryption key is obtained from @a keytab, or from the * default keytab if it is NULL. In this case, @a server may be a complete * principal name, a matching principal (see krb5_sname_match()), or NULL to * match any principal name. The keys tried against the encrypted part of the * ticket are determined as follows: * * - If @a server is a complete principal name, then its entry in @a keytab is * tried. * - Otherwise, if @a keytab is iterable, then all entries in @a keytab which * match @a server are tried. * - Otherwise, the server principal in the ticket must match @a server, and * its entry in @a keytab is tried. * * The client specified in the decrypted authenticator must match the client * specified in the decrypted ticket. * * If the @a remote_addr field of @a auth_context is set, the request must come * from that address. * * If a replay cache handle is provided in the @a auth_context, the * authenticator and ticket are verified against it. If no conflict is found, * the new authenticator is then stored in the replay cache of @a auth_context. * * Various other checks are performed on the decoded data, including * cross-realm policy, clockskew, and ticket validation times. * * On success the authenticator, subkey, and remote sequence number of the * request are stored in @a auth_context. If the #AP_OPTS_MUTUAL_REQUIRED * bit is set, the local sequence number is XORed with the remote sequence * number in the request. * * Use krb5_free_ticket() to free @a ticket when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_rd_req(krb5_context context, krb5_auth_context *auth_context, const krb5_data *inbuf, krb5_const_principal server, krb5_keytab keytab, krb5_flags *ap_req_options, krb5_ticket **ticket); /** * Retrieve a service key from a key table. * * @param [in] context Library context * @param [in] keyprocarg Name of a key table (NULL to use default name) * @param [in] principal Service principal * @param [in] vno Key version number (0 for highest available) * @param [in] enctype Encryption type (0 for any type) * @param [out] key Service key from key table * * Open and search the specified key table for the entry identified by @a * principal, @a enctype, and @a vno. If no key is found, return an error code. * * The default key table is used, unless @a keyprocarg is non-null. * @a keyprocarg designates a specific key table. * * Use krb5_free_keyblock() to free @a key when it is no longer needed. * * @retval * 0 Success * @return Kerberos error code if not found or @a keyprocarg is invalid. */ krb5_error_code KRB5_CALLCONV krb5_kt_read_service_key(krb5_context context, krb5_pointer keyprocarg, krb5_principal principal, krb5_kvno vno, krb5_enctype enctype, krb5_keyblock **key); /** * Format a @c KRB-SAFE message. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] userdata User data in the message * @param [out] outbuf Formatted @c KRB-SAFE buffer * @param [out] outdata Replay data. Specify NULL if not needed * * This function creates an integrity protected @c KRB-SAFE message * using data supplied by the application. * * Fields in @a auth_context specify the checksum type, the keyblock that * can be used to seed the checksum, full addresses (host and port) for * the sender and receiver, and @ref KRB5_AUTH_CONTEXT flags. * * The local address in @a auth_context must be set, and is used to form the * sender address used in the KRB-SAFE message. The remote address is * optional; if specified, it will be used to form the receiver address used in * the message. * * If #KRB5_AUTH_CONTEXT_DO_TIME flag is set in the @a auth_context, an entry * describing the message is entered in the replay cache @a * auth_context->rcache which enables the caller to detect if this message is * reflected by an attacker. If #KRB5_AUTH_CONTEXT_DO_TIME is not set, the * replay cache is not used. * * If either #KRB5_AUTH_CONTEXT_DO_SEQUENCE or * #KRB5_AUTH_CONTEXT_RET_SEQUENCE is set, the @a auth_context local sequence * number will be placed in @a outdata as its sequence number. * * @note The @a outdata argument is required if #KRB5_AUTH_CONTEXT_RET_TIME or * #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set in the @a auth_context. * * Use krb5_free_data_contents() to free @a outbuf when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_mk_safe(krb5_context context, krb5_auth_context auth_context, const krb5_data *userdata, krb5_data *outbuf, krb5_replay_data *outdata); /** * Format a @c KRB-PRIV message. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] userdata User data for @c KRB-PRIV message * @param [out] outbuf Formatted @c KRB-PRIV message * @param [out] outdata Replay cache handle (NULL if not needed) * * This function is similar to krb5_mk_safe(), but the message is encrypted and * integrity-protected, not just integrity-protected. * * The local address in @a auth_context must be set, and is used to form the * sender address used in the KRB-SAFE message. The remote address is * optional; if specified, it will be used to form the receiver address used in * the message. * * @note If the #KRB5_AUTH_CONTEXT_RET_TIME or * #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set in @a auth_context, the @a * outdata is required. * * @note The flags from @a auth_context specify whether sequence numbers or * timestamps will be used to identify the message. Valid values are: * * @li #KRB5_AUTH_CONTEXT_DO_TIME - Use timestamps in @a outdata * @li #KRB5_AUTH_CONTEXT_RET_TIME - Copy timestamp to @a outdata. * @li #KRB5_AUTH_CONTEXT_DO_SEQUENCE - Use local sequence numbers from * @a auth_context in replay cache. * @li #KRB5_AUTH_CONTEXT_RET_SEQUENCE - Use local sequence numbers from * @a auth_context as a sequence number * in the encrypted message @a outbuf. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_mk_priv(krb5_context context, krb5_auth_context auth_context, const krb5_data *userdata, krb5_data *outbuf, krb5_replay_data *outdata); /** * Client function for @c sendauth protocol. * * @param [in] context Library context * @param [in,out] auth_context Pre-existing or newly created auth context * @param [in] fd File descriptor that describes network socket * @param [in] appl_version Application protocol version to be matched * with the receiver's application version * @param [in] client Client principal * @param [in] server Server principal * @param [in] ap_req_options @ref AP_OPTS options * @param [in] in_data Data to be sent to the server * @param [in] in_creds Input credentials, or NULL to use @a ccache * @param [in] ccache Credential cache * @param [out] error If non-null, contains KRB_ERROR message * returned from server * @param [out] rep_result If non-null and @a ap_req_options is * #AP_OPTS_MUTUAL_REQUIRED, contains the result * of mutual authentication exchange * @param [out] out_creds If non-null, the retrieved credentials * * This function performs the client side of a sendauth/recvauth exchange by * sending and receiving messages over @a fd. * * Credentials may be specified in three ways: * * @li If @a in_creds is NULL, credentials are obtained with * krb5_get_credentials() using the principals @a client and @a server. @a * server must be non-null; @a client may NULL to use the default principal of * @a ccache. * * @li If @a in_creds is non-null, but does not contain a ticket, credentials * for the exchange are obtained with krb5_get_credentials() using @a in_creds. * In this case, the values of @a client and @a server are unused. * * @li If @a in_creds is a complete credentials structure, it used directly. * In this case, the values of @a client, @a server, and @a ccache are unused. * * If the server is using a different application protocol than that specified * in @a appl_version, an error will be returned. * * Use krb5_free_creds() to free @a out_creds, krb5_free_ap_rep_enc_part() to * free @a rep_result, and krb5_free_error() to free @a error when they are no * longer needed. * * @sa krb5_recvauth() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_sendauth(krb5_context context, krb5_auth_context *auth_context, krb5_pointer fd, char *appl_version, krb5_principal client, krb5_principal server, krb5_flags ap_req_options, krb5_data *in_data, krb5_creds *in_creds, krb5_ccache ccache, krb5_error **error, krb5_ap_rep_enc_part **rep_result, krb5_creds **out_creds); /** * Server function for @a sendauth protocol. * * @param [in] context Library context * @param [in,out] auth_context Pre-existing or newly created auth context * @param [in] fd File descriptor * @param [in] appl_version Application protocol version to be matched * against the client's application version * @param [in] server Server principal (NULL for any in @a keytab) * @param [in] flags Additional specifications * @param [in] keytab Key table containing service keys * @param [out] ticket Ticket (NULL if not needed) * * This function performs the server side of a sendauth/recvauth exchange by * sending and receiving messages over @a fd. * * Use krb5_free_ticket() to free @a ticket when it is no longer needed. * * @sa krb5_sendauth() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_recvauth(krb5_context context, krb5_auth_context *auth_context, krb5_pointer fd, char *appl_version, krb5_principal server, krb5_int32 flags, krb5_keytab keytab, krb5_ticket **ticket); /** * Server function for @a sendauth protocol with version parameter. * * @param [in] context Library context * @param [in,out] auth_context Pre-existing or newly created auth context * @param [in] fd File descriptor * @param [in] server Server principal (NULL for any in @a keytab) * @param [in] flags Additional specifications * @param [in] keytab Decryption key * @param [out] ticket Ticket (NULL if not needed) * @param [out] version sendauth protocol version (NULL if not needed) * * This function is similar to krb5_recvauth() with the additional output * information place into @a version. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_recvauth_version(krb5_context context, krb5_auth_context *auth_context, krb5_pointer fd, krb5_principal server, krb5_int32 flags, krb5_keytab keytab, krb5_ticket **ticket, krb5_data *version); /** * Format a @c KRB-CRED message for an array of credentials. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] ppcreds Null-terminated array of credentials * @param [out] ppdata Encoded credentials * @param [out] outdata Replay cache information (NULL if not needed) * * This function takes an array of credentials @a ppcreds and formats * a @c KRB-CRED message @a ppdata to pass to krb5_rd_cred(). * * @note If the #KRB5_AUTH_CONTEXT_RET_TIME or #KRB5_AUTH_CONTEXT_RET_SEQUENCE * flag is set in @a auth_context, @a outdata is required. * * The message will be encrypted using the send subkey of @a auth_context if it * is present, or the session key otherwise. * * @retval * 0 Success * @retval * ENOMEM Insufficient memory * @retval * KRB5_RC_REQUIRED Message replay detection requires @a rcache parameter * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_mk_ncred(krb5_context context, krb5_auth_context auth_context, krb5_creds **ppcreds, krb5_data **ppdata, krb5_replay_data *outdata); /** * Format a @c KRB-CRED message for a single set of credentials. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] pcreds Pointer to credentials * @param [out] ppdata Encoded credentials * @param [out] outdata Replay cache data (NULL if not needed) * * This is a convenience function that calls krb5_mk_ncred() with a single set * of credentials. * * @retval * 0 Success * @retval * ENOMEM Insufficient memory * @retval * KRB5_RC_REQUIRED Message replay detection requires @a rcache parameter * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_mk_1cred(krb5_context context, krb5_auth_context auth_context, krb5_creds *pcreds, krb5_data **ppdata, krb5_replay_data *outdata); /** * Read and validate a @c KRB-CRED message. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] pcreddata @c KRB-CRED message * @param [out] pppcreds Null-terminated array of forwarded credentials * @param [out] outdata Replay data (NULL if not needed) * * @note The @a outdata argument is required if #KRB5_AUTH_CONTEXT_RET_TIME or * #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set in the @a auth_context.` * * @a pcreddata will be decrypted using the receiving subkey if it is present * in @a auth_context, or the session key if the receiving subkey is not * present or fails to decrypt the message. * * Use krb5_free_tgt_creds() to free @a pppcreds when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_rd_cred(krb5_context context, krb5_auth_context auth_context, krb5_data *pcreddata, krb5_creds ***pppcreds, krb5_replay_data *outdata); /** * Get a forwarded TGT and format a @c KRB-CRED message. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] rhost Remote host * @param [in] client Client principal of TGT * @param [in] server Principal of server to receive TGT * @param [in] cc Credential cache handle (NULL to use default) * @param [in] forwardable Whether TGT should be forwardable * @param [out] outbuf KRB-CRED message * * Get a TGT for use at the remote host @a rhost and format it into a KRB-CRED * message. If @a rhost is NULL and @a server is of type #KRB5_NT_SRV_HST, * the second component of @a server will be used. * * @retval * 0 Success * @retval * ENOMEM Insufficient memory * @retval * KRB5_PRINC_NOMATCH Requested principal and ticket do not match * @retval * KRB5_NO_TKT_SUPPLIED Request did not supply a ticket * @retval * KRB5_CC_BADNAME Credential cache name or principal name malformed * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_fwd_tgt_creds(krb5_context context, krb5_auth_context auth_context, char *rhost, krb5_principal client, krb5_principal server, krb5_ccache cc, int forwardable, krb5_data *outbuf); /** * Create and initialize an authentication context. * * @param [in] context Library context * @param [out] auth_context Authentication context * * This function creates an authentication context to hold configuration and * state relevant to krb5 functions for authenticating principals and * protecting messages once authentication has occurred. * * By default, flags for the context are set to enable the use of the replay * cache (#KRB5_AUTH_CONTEXT_DO_TIME), but not sequence numbers. Use * krb5_auth_con_setflags() to change the flags. * * The allocated @a auth_context must be freed with krb5_auth_con_free() when * it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_init(krb5_context context, krb5_auth_context *auth_context); /** * Free a krb5_auth_context structure. * * @param [in] context Library context * @param [in] auth_context Authentication context to be freed * * This function frees an auth context allocated by krb5_auth_con_init(). * * @retval 0 (always) */ krb5_error_code KRB5_CALLCONV krb5_auth_con_free(krb5_context context, krb5_auth_context auth_context); /** * Set a flags field in a krb5_auth_context structure. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] flags Flags bit mask * * Valid values for @a flags are: * @li #KRB5_AUTH_CONTEXT_DO_TIME Use timestamps * @li #KRB5_AUTH_CONTEXT_RET_TIME Save timestamps * @li #KRB5_AUTH_CONTEXT_DO_SEQUENCE Use sequence numbers * @li #KRB5_AUTH_CONTEXT_RET_SEQUENCE Save sequence numbers * * @retval 0 (always) */ krb5_error_code KRB5_CALLCONV krb5_auth_con_setflags(krb5_context context, krb5_auth_context auth_context, krb5_int32 flags); /** * Retrieve flags from a krb5_auth_context structure. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] flags Flags bit mask * * Valid values for @a flags are: * @li #KRB5_AUTH_CONTEXT_DO_TIME Use timestamps * @li #KRB5_AUTH_CONTEXT_RET_TIME Save timestamps * @li #KRB5_AUTH_CONTEXT_DO_SEQUENCE Use sequence numbers * @li #KRB5_AUTH_CONTEXT_RET_SEQUENCE Save sequence numbers * * @retval 0 (always) */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getflags(krb5_context context, krb5_auth_context auth_context, krb5_int32 *flags); /** * Set a checksum callback in an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] func Checksum callback * @param [in] data Callback argument * * Set a callback to obtain checksum data in krb5_mk_req(). The callback will * be invoked after the subkey and local sequence number are stored in @a * auth_context. * * @retval 0 (always) */ krb5_error_code KRB5_CALLCONV krb5_auth_con_set_checksum_func( krb5_context context, krb5_auth_context auth_context, krb5_mk_req_checksum_func func, void *data); /** * Get the checksum callback from an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] func Checksum callback * @param [out] data Callback argument * * @retval 0 (always) */ krb5_error_code KRB5_CALLCONV krb5_auth_con_get_checksum_func( krb5_context context, krb5_auth_context auth_context, krb5_mk_req_checksum_func *func, void **data); /** * Set the local and remote addresses in an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] local_addr Local address * @param [in] remote_addr Remote address * * This function releases the storage assigned to the contents of the local and * remote addresses of @a auth_context and then sets them to @a local_addr and * @a remote_addr respectively. * * @sa krb5_auth_con_genaddrs() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV_WRONG krb5_auth_con_setaddrs(krb5_context context, krb5_auth_context auth_context, krb5_address *local_addr, krb5_address *remote_addr); /** * Retrieve address fields from an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] local_addr Local address (NULL if not needed) * @param [out] remote_addr Remote address (NULL if not needed) * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getaddrs(krb5_context context, krb5_auth_context auth_context, krb5_address **local_addr, krb5_address **remote_addr); /** * Set local and remote port fields in an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] local_port Local port * @param [in] remote_port Remote port * * This function releases the storage assigned to the contents of the local and * remote ports of @a auth_context and then sets them to @a local_port and @a * remote_port respectively. * * @sa krb5_auth_con_genaddrs() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_setports(krb5_context context, krb5_auth_context auth_context, krb5_address *local_port, krb5_address *remote_port); /** * Set the session key in an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] keyblock User key * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_setuseruserkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock *keyblock); /** * Retrieve the session key from an auth context as a keyblock. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] keyblock Session key * * This function creates a keyblock containing the session key from @a * auth_context. Use krb5_free_keyblock() to free @a keyblock when it is no * longer needed * * @retval 0 Success. Otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock **keyblock); /** * Retrieve the session key from an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] key Session key * * This function sets @a key to the session key from @a auth_context. Use * krb5_k_free_key() to release @a key when it is no longer needed. * * @retval 0 (always) */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getkey_k(krb5_context context, krb5_auth_context auth_context, krb5_key *key); /** * Retrieve the send subkey from an auth context as a keyblock. * * @param [in] ctx Library context * @param [in] ac Authentication context * @param [out] keyblock Send subkey * * This function creates a keyblock containing the send subkey from @a * auth_context. Use krb5_free_keyblock() to free @a keyblock when it is no * longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getsendsubkey(krb5_context ctx, krb5_auth_context ac, krb5_keyblock **keyblock); /** * Retrieve the send subkey from an auth context. * * @param [in] ctx Library context * @param [in] ac Authentication context * @param [out] key Send subkey * * This function sets @a key to the send subkey from @a auth_context. Use * krb5_k_free_key() to release @a key when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getsendsubkey_k(krb5_context ctx, krb5_auth_context ac, krb5_key *key); /** * Retrieve the receiving subkey from an auth context as a keyblock. * * @param [in] ctx Library context * @param [in] ac Authentication context * @param [out] keyblock Receiving subkey * * This function creates a keyblock containing the receiving subkey from @a * auth_context. Use krb5_free_keyblock() to free @a keyblock when it is no * longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getrecvsubkey(krb5_context ctx, krb5_auth_context ac, krb5_keyblock **keyblock); /** * Retrieve the receiving subkey from an auth context as a keyblock. * * @param [in] ctx Library context * @param [in] ac Authentication context * @param [out] key Receiving subkey * * This function sets @a key to the receiving subkey from @a auth_context. Use * krb5_k_free_key() to release @a key when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getrecvsubkey_k(krb5_context ctx, krb5_auth_context ac, krb5_key *key); /** * Set the send subkey in an auth context with a keyblock. * * @param [in] ctx Library context * @param [in] ac Authentication context * @param [in] keyblock Send subkey * * This function sets the send subkey in @a ac to a copy of @a keyblock. * * @retval 0 Success. Otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_setsendsubkey(krb5_context ctx, krb5_auth_context ac, krb5_keyblock *keyblock); /** * Set the send subkey in an auth context. * * @param [in] ctx Library context * @param [in] ac Authentication context * @param [out] key Send subkey * * This function sets the send subkey in @a ac to @a key, incrementing its * reference count. * * @version New in 1.9 * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_setsendsubkey_k(krb5_context ctx, krb5_auth_context ac, krb5_key key); /** * Set the receiving subkey in an auth context with a keyblock. * * @param [in] ctx Library context * @param [in] ac Authentication context * @param [in] keyblock Receiving subkey * * This function sets the receiving subkey in @a ac to a copy of @a keyblock. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_setrecvsubkey(krb5_context ctx, krb5_auth_context ac, krb5_keyblock *keyblock); /** * Set the receiving subkey in an auth context. * * @param [in] ctx Library context * @param [in] ac Authentication context * @param [in] key Receiving subkey * * This function sets the receiving subkey in @a ac to @a key, incrementing its * reference count. * * @version New in 1.9 * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_setrecvsubkey_k(krb5_context ctx, krb5_auth_context ac, krb5_key key); #if KRB5_DEPRECATED /** @deprecated Replaced by krb5_auth_con_getsendsubkey(). */ KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV krb5_auth_con_getlocalsubkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock **keyblock); /** @deprecated Replaced by krb5_auth_con_getrecvsubkey(). */ KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV krb5_auth_con_getremotesubkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock **keyblock); #endif /** * Retrieve the local sequence number from an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] seqnumber Local sequence number * * Retrieve the local sequence number from @a auth_context and return it in @a * seqnumber. The #KRB5_AUTH_CONTEXT_DO_SEQUENCE flag must be set in @a * auth_context for this function to be useful. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getlocalseqnumber(krb5_context context, krb5_auth_context auth_context, krb5_int32 *seqnumber); /** * Retrieve the remote sequence number from an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] seqnumber Remote sequence number * * Retrieve the remote sequence number from @a auth_context and return it in @a * seqnumber. The #KRB5_AUTH_CONTEXT_DO_SEQUENCE flag must be set in @a * auth_context for this function to be useful. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getremoteseqnumber(krb5_context context, krb5_auth_context auth_context, krb5_int32 *seqnumber); #if KRB5_DEPRECATED /** @deprecated Not replaced. * * RFC 4120 doesn't have anything like the initvector concept; * only really old protocols may need this API. */ KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV krb5_auth_con_initivector(krb5_context context, krb5_auth_context auth_context); #endif /** * Set the replay cache in an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] rcache Replay cache haddle * * This function sets the replay cache in @a auth_context to @a rcache. @a * rcache will be closed when @a auth_context is freed, so the caller should * relinguish that responsibility. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_setrcache(krb5_context context, krb5_auth_context auth_context, krb5_rcache rcache); /** * Retrieve the replay cache from an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] rcache Replay cache handle * * This function fetches the replay cache from @a auth_context. The caller * should not close @a rcache. * * @retval 0 (always) */ krb5_error_code KRB5_CALLCONV_WRONG krb5_auth_con_getrcache(krb5_context context, krb5_auth_context auth_context, krb5_rcache *rcache); /** * Retrieve the authenticator from an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] authenticator Authenticator * * Use krb5_free_authenticator() to free @a authenticator when it is no longer * needed. * * @retval 0 Success. Otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getauthenticator(krb5_context context, krb5_auth_context auth_context, krb5_authenticator **authenticator); /** * Set checksum type in an an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] cksumtype Checksum type * * This function sets the checksum type in @a auth_context to be used by * krb5_mk_req() for the authenticator checksum. * * @retval 0 Success. Otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_set_req_cksumtype(krb5_context context, krb5_auth_context auth_context, krb5_cksumtype cksumtype); #define KRB5_REALM_BRANCH_CHAR '.' /* * end "func-proto.h" */ /* * begin stuff from libos.h */ /** * @brief Read a password from keyboard input. * * @param [in] context Library context * @param [in] prompt First user prompt when reading password * @param [in] prompt2 Second user prompt (NULL to prompt only once) * @param [out] return_pwd Returned password * @param [in,out] size_return On input, maximum size of password; on output, * size of password read * * This function reads a password from keyboard input and stores it in @a * return_pwd. @a size_return should be set by the caller to the amount of * storage space available in @a return_pwd; on successful return, it will be * set to the length of the password read. * * @a prompt is printed to the terminal, followed by ": ", and then a password * is read from the keyboard. * * If @a prompt2 is NULL, the password is read only once. Otherwise, @a * prompt2 is printed to the terminal and a second password is read. If the * two passwords entered are not identical, KRB5_LIBOS_BADPWDMATCH is returned. * * Echoing is turned off when the password is read. * * @retval * 0 Success * @return * Error in reading or verifying the password * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_read_password(krb5_context context, const char *prompt, const char *prompt2, char *return_pwd, unsigned int *size_return); /** * Convert a principal name to a local name. * * @param [in] context Library context * @param [in] aname Principal name * @param [in] lnsize_in Space available in @a lname * @param [out] lname Local name buffer to be filled in * * If @a aname does not correspond to any local account, KRB5_LNAME_NOTRANS is * returned. If @a lnsize_in is too small for the local name, * KRB5_CONFIG_NOTENUFSPACE is returned. * * Local names, rather than principal names, can be used by programs that * translate to an environment-specific name (for example, a user account * name). * * @retval * 0 Success * @retval * System errors * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_aname_to_localname(krb5_context context, krb5_const_principal aname, int lnsize_in, char *lname); /** * Get the Kerberos realm names for a host. * * @param [in] context Library context * @param [in] host Host name (or NULL) * @param [out] realmsp Null-terminated list of realm names * * Fill in @a realmsp with a pointer to a null-terminated list of realm names. * If there are no known realms for the host, a list containing the referral * (empty) realm is returned. * * If @a host is NULL, the local host's realms are determined. * * Use krb5_free_host_realm() to release @a realmsp when it is no longer * needed. * * @retval * 0 Success * @retval * ENOMEM Insufficient memory * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_host_realm(krb5_context context, const char *host, char ***realmsp); /** * * @param [in] context Library context * @param [in] hdata Host name (or NULL) * @param [out] realmsp Null-terminated list of realm names * * Fill in @a realmsp with a pointer to a null-terminated list of realm names * obtained through heuristics or insecure resolution methods which have lower * priority than KDC referrals. * * If @a host is NULL, the local host's realms are determined. * * Use krb5_free_host_realm() to release @a realmsp when it is no longer * needed. */ krb5_error_code KRB5_CALLCONV krb5_get_fallback_host_realm(krb5_context context, krb5_data *hdata, char ***realmsp); /** * Free the memory allocated by krb5_get_host_realm(). * * @param [in] context Library context * @param [in] realmlist List of realm names to be released * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_free_host_realm(krb5_context context, char *const *realmlist); /** * Determine if a principal is authorized to log in as a local user. * * @param [in] context Library context * @param [in] principal Principal name * @param [in] luser Local username * * Determine whether @a principal is authorized to log in as a local user @a * luser. * * @retval * TRUE Principal is authorized to log in as user; FALSE otherwise. */ krb5_boolean KRB5_CALLCONV krb5_kuserok(krb5_context context, krb5_principal principal, const char *luser); /** * Generate auth context addresses from a connected socket. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] infd Connected socket descriptor * @param [in] flags Flags * * This function sets the local and/or remote addresses in @a auth_context * based on the local and remote endpoints of the socket @a infd. The * following flags determine the operations performed: * * @li #KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR Generate local address. * @li #KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR Generate remote address. * @li #KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR Generate local address and port. * @li #KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR Generate remote address and port. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_genaddrs(krb5_context context, krb5_auth_context auth_context, int infd, int flags); /** * Set time offset field in a krb5_context structure. * * @param [in] context Library context * @param [in] seconds Real time, seconds portion * @param [in] microseconds Real time, microseconds portion * * This function sets the time offset in @a context to the difference between * the system time and the real time as determined by @a seconds and @a * microseconds. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_set_real_time(krb5_context context, krb5_timestamp seconds, krb5_int32 microseconds); /** * Return the time offsets from the os context. * * @param [in] context Library context * @param [out] seconds Time offset, seconds portion * @param [out] microseconds Time offset, microseconds portion * * This function returns the time offsets in @a context. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_time_offsets(krb5_context context, krb5_timestamp *seconds, krb5_int32 *microseconds); /* str_conv.c */ /** * Convert a string to an encryption type. * * @param [in] string String to convert to an encryption type * @param [out] enctypep Encryption type * * @retval 0 Success; otherwise - EINVAL */ krb5_error_code KRB5_CALLCONV krb5_string_to_enctype(char *string, krb5_enctype *enctypep); /** * Convert a string to a salt type. * * @param [in] string String to convert to an encryption type * @param [out] salttypep Salt type to be filled in * * @retval 0 Success; otherwise - EINVAL */ krb5_error_code KRB5_CALLCONV krb5_string_to_salttype(char *string, krb5_int32 *salttypep); /** * Convert a string to a checksum type. * * @param [in] string String to be converted * @param [out] cksumtypep Checksum type to be filled in * * @retval 0 Success; otherwise - EINVAL */ krb5_error_code KRB5_CALLCONV krb5_string_to_cksumtype(char *string, krb5_cksumtype *cksumtypep); /** * Convert a string to a timestamp. * * @param [in] string String to be converted * @param [out] timestampp Pointer to timestamp * * @retval 0 Success; otherwise - EINVAL */ krb5_error_code KRB5_CALLCONV krb5_string_to_timestamp(char *string, krb5_timestamp *timestampp); /** * Convert a string to a delta time value. * * @param [in] string String to be converted * @param [out] deltatp Delta time to be filled in * * @retval 0 Success; otherwise - KRB5_DELTAT_BADFORMAT */ krb5_error_code KRB5_CALLCONV krb5_string_to_deltat(char *string, krb5_deltat *deltatp); /** * Convert an encryption type to a string. * * @param [in] enctype Encryption type * @param [out] buffer Buffer to hold encryption type string * @param [in] buflen Storage available in @a buffer * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_enctype_to_string(krb5_enctype enctype, char *buffer, size_t buflen); /** * Convert an encryption type to a name or alias. * * @param [in] enctype Encryption type * @param [in] shortest Flag * @param [out] buffer Buffer to hold encryption type string * @param [in] buflen Storage available in @a buffer * * If @a shortest is FALSE, this function returns the enctype's canonical name * (like "aes128-cts-hmac-sha1-96"). If @a shortest is TRUE, it return the * enctype's shortest alias (like "aes128-cts"). * * @version New in 1.9 * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_enctype_to_name(krb5_enctype enctype, krb5_boolean shortest, char *buffer, size_t buflen); /** * Convert a salt type to a string. * * @param [in] salttype Salttype to convert * @param [out] buffer Buffer to receive the converted string * @param [in] buflen Storage available in @a buffer * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_salttype_to_string(krb5_int32 salttype, char *buffer, size_t buflen); /** * Convert a checksum type to a string. * * @param [in] cksumtype Checksum type * @param [out] buffer Buffer to hold converted checksum type * @param [in] buflen Storage available in @a buffer * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cksumtype_to_string(krb5_cksumtype cksumtype, char *buffer, size_t buflen); /** * Convert a timestamp to a string. * * @param [in] timestamp Timestamp to convert * @param [out] buffer Buffer to hold converted timestamp * @param [in] buflen Storage available in @a buffer * * The string is returned in the locale's appropriate date and time * representation. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_timestamp_to_string(krb5_timestamp timestamp, char *buffer, size_t buflen); /** * Convert a timestamp to a string, with optional output padding * * @param [in] timestamp Timestamp to convert * @param [out] buffer Buffer to hold the converted timestamp * @param [in] buflen Length of buffer * @param [in] pad Optional value to pad @a buffer if converted * timestamp does not fill it * * If @a pad is not NULL, @a buffer is padded out to @a buflen - 1 characters * with the value of *@a pad. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_timestamp_to_sfstring(krb5_timestamp timestamp, char *buffer, size_t buflen, char *pad); /** * Convert a relative time value to a string. * * @param [in] deltat Relative time value to convert * @param [out] buffer Buffer to hold time string * @param [in] buflen Storage available in @a buffer * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_deltat_to_string(krb5_deltat deltat, char *buffer, size_t buflen); /* The name of the Kerberos ticket granting service... and its size */ #define KRB5_TGS_NAME "krbtgt" #define KRB5_TGS_NAME_SIZE 6 /* flags for recvauth */ #define KRB5_RECVAUTH_SKIP_VERSION 0x0001 #define KRB5_RECVAUTH_BADAUTHVERS 0x0002 /* initial ticket api functions */ /** Text for prompt used in prompter callback function. */ typedef struct _krb5_prompt { char *prompt; /**< The prompt to show to the user */ int hidden; /**< Boolean; informative prompt or hidden (e.g. PIN) */ krb5_data *reply; /**< Must be allocated before call to prompt routine */ } krb5_prompt; /** Pointer to a prompter callback function. */ typedef krb5_error_code (KRB5_CALLCONV *krb5_prompter_fct)(krb5_context context, void *data, const char *name, const char *banner, int num_prompts, krb5_prompt prompts[]); /** * Prompt user for password. * * @param [in] context Library context * @param data Unused (callback argument) * @param [in] name Name to output during prompt * @param [in] banner Banner to output during prompt * @param [in] num_prompts Number of prompts in @a prompts * @param [in] prompts Array of prompts and replies * * This function is intended to be used as a prompter callback for * krb5_get_init_creds_password() or krb5_init_creds_init(). * * Writes @a name and @a banner to stdout, each followed by a newline, then * writes each prompt field in the @a prompts array, followed by ": ", and sets * the reply field of the entry to a line of input read from stdin. If the * hidden flag is set for a prompt, then terminal echoing is turned off when * input is read. * * @retval * 0 Success * @return * Kerberos error codes * */ krb5_error_code KRB5_CALLCONV krb5_prompter_posix(krb5_context context, void *data, const char *name, const char *banner, int num_prompts, krb5_prompt prompts[]); /** * Long-term password responder question * * This question is asked when the long-term password is needed. It has no * challenge and the response is simply the password string. * * @version New in 1.11 */ #define KRB5_RESPONDER_QUESTION_PASSWORD "password" /** * OTP responder question * * The OTP responder question is asked when the KDC indicates that an OTP * value is required in order to complete the authentication. The JSON format * of the challenge is: * * @n { * @n "service": <string (optional)>, * @n "tokenInfo": [ * @n { * @n "flags": <number>, * @n "vendor": <string (optional)>, * @n "challenge": <string (optional)>, * @n "length": <number (optional)>, * @n "format": <number (optional)>, * @n "tokenID": <string (optional)>, * @n "algID": <string (optional)>, * @n }, * @n ... * @n ] * @n } * * The answer to the question MUST be JSON formatted: * * @n { * @n "tokeninfo": <number>, * @n "value": <string (optional)>, * @n "pin": <string (optional)>, * @n } * * For more detail, please see RFC 6560. * * @version New in 1.11 */ #define KRB5_RESPONDER_QUESTION_OTP "otp" /** * These format constants identify the format of the token value. */ #define KRB5_RESPONDER_OTP_FORMAT_DECIMAL 0 #define KRB5_RESPONDER_OTP_FORMAT_HEXADECIMAL 1 #define KRB5_RESPONDER_OTP_FORMAT_ALPHANUMERIC 2 /** * This flag indicates that the token value MUST be collected. */ #define KRB5_RESPONDER_OTP_FLAGS_COLLECT_TOKEN 0x0001 /** * This flag indicates that the PIN value MUST be collected. */ #define KRB5_RESPONDER_OTP_FLAGS_COLLECT_PIN 0x0002 /** * This flag indicates that the token is now in re-synchronization mode with * the server. The user is expected to reply with the next code displayed on * the token. */ #define KRB5_RESPONDER_OTP_FLAGS_NEXTOTP 0x0004 /** * This flag indicates that the PIN MUST be returned as a separate item. This * flag only takes effect if KRB5_RESPONDER_OTP_FLAGS_COLLECT_PIN is set. If * this flag is not set, the responder may either concatenate PIN + token value * and store it as "value" in the answer or it may return them separately. If * they are returned separately, they will be concatenated internally. */ #define KRB5_RESPONDER_OTP_FLAGS_SEPARATE_PIN 0x0008 /** * PKINIT responder question * * The PKINIT responder question is asked when the client needs a password * that's being used to protect key information, and is formatted as a JSON * object. A specific identity's flags value, if not zero, is the bitwise-OR * of one or more of the KRB5_RESPONDER_PKINIT_FLAGS_TOKEN_* flags defined * below, and possibly other flags to be added later. Any resemblance to * similarly-named CKF_* values in the PKCS#11 API should not be depended on. * * @n { * @n identity <string> : flags <number>, * @n ... * @n } * * The answer to the question MUST be JSON formatted: * * @n { * @n identity <string> : password <string>, * @n ... * @n } * * @version New in 1.12 */ #define KRB5_RESPONDER_QUESTION_PKINIT "pkinit" /** * This flag indicates that an incorrect PIN was supplied at least once since * the last time the correct PIN was supplied. */ #define KRB5_RESPONDER_PKINIT_FLAGS_TOKEN_USER_PIN_COUNT_LOW (1 << 0) /** * This flag indicates that supplying an incorrect PIN will cause the token to * lock itself. */ #define KRB5_RESPONDER_PKINIT_FLAGS_TOKEN_USER_PIN_FINAL_TRY (1 << 1) /** * This flag indicates that the user PIN is locked, and you can't log in to the * token with it. */ #define KRB5_RESPONDER_PKINIT_FLAGS_TOKEN_USER_PIN_LOCKED (1 << 2) /** * A container for a set of preauthentication questions and answers * * A responder context is supplied by the krb5 authentication system to a @ref * krb5_responder_fn callback. It contains a list of questions and can receive * answers. Questions contained in a responder context can be listed using * krb5_responder_list_questions(), retrieved using * krb5_responder_get_challenge(), or answered using * krb5_responder_set_answer(). The form of a question's challenge and * answer depend on the question name. * * @version New in 1.11 */ typedef struct krb5_responder_context_st *krb5_responder_context; /** * List the question names contained in the responder context. * * @param [in] ctx Library context * @param [in] rctx Responder context * * Return a pointer to a null-terminated list of question names which are * present in @a rctx. The pointer is an alias, valid only as long as the * lifetime of @a rctx, and should not be modified or freed by the caller. A * question's challenge can be retrieved using krb5_responder_get_challenge() * and answered using krb5_responder_set_answer(). * * @version New in 1.11 */ const char * const * KRB5_CALLCONV krb5_responder_list_questions(krb5_context ctx, krb5_responder_context rctx); /** * Retrieve the challenge data for a given question in the responder context. * * @param [in] ctx Library context * @param [in] rctx Responder context * @param [in] question Question name * * Return a pointer to a C string containing the challenge for @a question * within @a rctx, or NULL if the question is not present in @a rctx. The * structure of the question depends on the question name, but will always be * printable UTF-8 text. The returned pointer is an alias, valid only as long * as the lifetime of @a rctx, and should not be modified or freed by the * caller. * * @version New in 1.11 */ const char * KRB5_CALLCONV krb5_responder_get_challenge(krb5_context ctx, krb5_responder_context rctx, const char *question); /** * Answer a named question in the responder context. * * @param [in] ctx Library context * @param [in] rctx Responder context * @param [in] question Question name * @param [in] answer The string to set (MUST be printable UTF-8) * * This function supplies an answer to @a question within @a rctx. The * appropriate form of the answer depends on the question name. * * @retval EINVAL @a question is not present within @a rctx * * @version New in 1.11 */ krb5_error_code KRB5_CALLCONV krb5_responder_set_answer(krb5_context ctx, krb5_responder_context rctx, const char *question, const char *answer); /** * Responder function for an initial credential exchange. * * @param [in] ctx Library context * @param [in] data Callback data * @param [in] rctx Responder context * * A responder function is like a prompter function, but is used for handling * questions and answers as potentially complex data types. Client * preauthentication modules will insert a set of named "questions" into * the responder context. Each question may optionally contain a challenge. * This challenge is printable UTF-8, but may be an encoded value. The * precise encoding and contents of the challenge are specific to the question * asked. When the responder is called, it should answer all the questions it * understands. Like the challenge, the answer MUST be printable UTF-8, but * may contain structured/encoded data formatted to the expected answer format * of the question. * * If a required question is unanswered, the prompter may be called. */ typedef krb5_error_code (KRB5_CALLCONV *krb5_responder_fn)(krb5_context ctx, void *data, krb5_responder_context rctx); typedef struct _krb5_responder_otp_tokeninfo { krb5_flags flags; krb5_int32 format; /* -1 when not specified. */ krb5_int32 length; /* -1 when not specified. */ char *vendor; char *challenge; char *token_id; char *alg_id; } krb5_responder_otp_tokeninfo; typedef struct _krb5_responder_otp_challenge { char *service; krb5_responder_otp_tokeninfo **tokeninfo; } krb5_responder_otp_challenge; /** * Decode the KRB5_RESPONDER_QUESTION_OTP to a C struct. * * A convenience function which parses the KRB5_RESPONDER_QUESTION_OTP * question challenge data, making it available in native C. The main feature * of this function is the ability to interact with OTP tokens without parsing * the JSON. * * The returned value must be passed to krb5_responder_otp_challenge_free() to * be freed. * * @param [in] ctx Library context * @param [in] rctx Responder context * @param [out] chl Challenge structure * * @version New in 1.11 */ krb5_error_code KRB5_CALLCONV krb5_responder_otp_get_challenge(krb5_context ctx, krb5_responder_context rctx, krb5_responder_otp_challenge **chl); /** * Answer the KRB5_RESPONDER_QUESTION_OTP question. * * @param [in] ctx Library context * @param [in] rctx Responder context * @param [in] ti The index of the tokeninfo selected * @param [in] value The value to set, or NULL for none * @param [in] pin The pin to set, or NULL for none * * @version New in 1.11 */ krb5_error_code KRB5_CALLCONV krb5_responder_otp_set_answer(krb5_context ctx, krb5_responder_context rctx, size_t ti, const char *value, const char *pin); /** * Free the value returned by krb5_responder_otp_get_challenge(). * * @param [in] ctx Library context * @param [in] rctx Responder context * @param [in] chl The challenge to free * * @version New in 1.11 */ void KRB5_CALLCONV krb5_responder_otp_challenge_free(krb5_context ctx, krb5_responder_context rctx, krb5_responder_otp_challenge *chl); typedef struct _krb5_responder_pkinit_identity { char *identity; krb5_int32 token_flags; /* 0 when not specified or not applicable. */ } krb5_responder_pkinit_identity; typedef struct _krb5_responder_pkinit_challenge { krb5_responder_pkinit_identity **identities; } krb5_responder_pkinit_challenge; /** * Decode the KRB5_RESPONDER_QUESTION_PKINIT to a C struct. * * A convenience function which parses the KRB5_RESPONDER_QUESTION_PKINIT * question challenge data, making it available in native C. The main feature * of this function is the ability to read the challenge without parsing * the JSON. * * The returned value must be passed to krb5_responder_pkinit_challenge_free() * to be freed. * * @param [in] ctx Library context * @param [in] rctx Responder context * @param [out] chl_out Challenge structure * * @version New in 1.12 */ krb5_error_code KRB5_CALLCONV krb5_responder_pkinit_get_challenge(krb5_context ctx, krb5_responder_context rctx, krb5_responder_pkinit_challenge **chl_out); /** * Answer the KRB5_RESPONDER_QUESTION_PKINIT question for one identity. * * @param [in] ctx Library context * @param [in] rctx Responder context * @param [in] identity The identity for which a PIN is being supplied * @param [in] pin The provided PIN, or NULL for none * * @version New in 1.12 */ krb5_error_code KRB5_CALLCONV krb5_responder_pkinit_set_answer(krb5_context ctx, krb5_responder_context rctx, const char *identity, const char *pin); /** * Free the value returned by krb5_responder_pkinit_get_challenge(). * * @param [in] ctx Library context * @param [in] rctx Responder context * @param [in] chl The challenge to free * * @version New in 1.12 */ void KRB5_CALLCONV krb5_responder_pkinit_challenge_free(krb5_context ctx, krb5_responder_context rctx, krb5_responder_pkinit_challenge *chl); /** Store options for @c _krb5_get_init_creds */ typedef struct _krb5_get_init_creds_opt { krb5_flags flags; krb5_deltat tkt_life; krb5_deltat renew_life; int forwardable; int proxiable; krb5_enctype *etype_list; int etype_list_length; krb5_address **address_list; krb5_preauthtype *preauth_list; int preauth_list_length; krb5_data *salt; } krb5_get_init_creds_opt; #define KRB5_GET_INIT_CREDS_OPT_TKT_LIFE 0x0001 #define KRB5_GET_INIT_CREDS_OPT_RENEW_LIFE 0x0002 #define KRB5_GET_INIT_CREDS_OPT_FORWARDABLE 0x0004 #define KRB5_GET_INIT_CREDS_OPT_PROXIABLE 0x0008 #define KRB5_GET_INIT_CREDS_OPT_ETYPE_LIST 0x0010 #define KRB5_GET_INIT_CREDS_OPT_ADDRESS_LIST 0x0020 #define KRB5_GET_INIT_CREDS_OPT_PREAUTH_LIST 0x0040 #define KRB5_GET_INIT_CREDS_OPT_SALT 0x0080 #define KRB5_GET_INIT_CREDS_OPT_CHG_PWD_PRMPT 0x0100 #define KRB5_GET_INIT_CREDS_OPT_CANONICALIZE 0x0200 #define KRB5_GET_INIT_CREDS_OPT_ANONYMOUS 0x0400 /** * Allocate a new initial credential options structure. * * @param [in] context Library context * @param [out] opt New options structure * * This function is the preferred way to create an options structure for * getting initial credentials, and is required to make use of certain options. * Use krb5_get_init_creds_opt_free() to free @a opt when it is no longer * needed. * * @retval 0 - Success; Kerberos errors otherwise. */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_alloc(krb5_context context, krb5_get_init_creds_opt **opt); /** * Free initial credential options. * * @param [in] context Library context * @param [in] opt Options structure to free * * @sa krb5_get_init_creds_opt_alloc() */ void KRB5_CALLCONV krb5_get_init_creds_opt_free(krb5_context context, krb5_get_init_creds_opt *opt); /** @deprecated Use krb5_get_init_creds_opt_alloc() instead. */ void KRB5_CALLCONV krb5_get_init_creds_opt_init(krb5_get_init_creds_opt *opt); /** * Set the ticket lifetime in initial credential options. * * @param [in] opt Options structure * @param [in] tkt_life Ticket lifetime */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_tkt_life(krb5_get_init_creds_opt *opt, krb5_deltat tkt_life); /** * Set the ticket renewal lifetime in initial credential options. * * @param [in] opt Pointer to @a options field * @param [in] renew_life Ticket renewal lifetime */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_renew_life(krb5_get_init_creds_opt *opt, krb5_deltat renew_life); /** * Set or unset the forwardable flag in initial credential options. * * @param [in] opt Options structure * @param [in] forwardable Whether credentials should be forwardable */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_forwardable(krb5_get_init_creds_opt *opt, int forwardable); /** * Set or unset the proxiable flag in initial credential options. * * @param [in] opt Options structure * @param [in] proxiable Whether credentials should be proxiable */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_proxiable(krb5_get_init_creds_opt *opt, int proxiable); /** * Set or unset the canonicalize flag in initial credential options. * * @param [in] opt Options structure * @param [in] canonicalize Whether to canonicalize client principal */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_canonicalize(krb5_get_init_creds_opt *opt, int canonicalize); /** * Set or unset the anonymous flag in initial credential options. * * @param [in] opt Options structure * @param [in] anonymous Whether to make an anonymous request * * This function may be used to request anonymous credentials from the KDC by * setting @a anonymous to non-zero. Note that anonymous credentials are only * a request; clients must verify that credentials are anonymous if that is a * requirement. */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_anonymous(krb5_get_init_creds_opt *opt, int anonymous); /** * Set allowable encryption types in initial credential options. * * @param [in] opt Options structure * @param [in] etype_list Array of encryption types * @param [in] etype_list_length Length of @a etype_list */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_etype_list(krb5_get_init_creds_opt *opt, krb5_enctype *etype_list, int etype_list_length); /** * Set address restrictions in initial credential options. * * @param [in] opt Options structure * @param [in] addresses Null-terminated array of addresses */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_address_list(krb5_get_init_creds_opt *opt, krb5_address **addresses); /** * Set preauthentication types in initial credential options. * * @param [in] opt Options structure * @param [in] preauth_list Array of preauthentication types * @param [in] preauth_list_length Length of @a preauth_list * * This function can be used to perform optimistic preauthentication when * getting initial credentials, in combination with * krb5_get_init_creds_opt_set_salt() and krb5_get_init_creds_opt_set_pa(). */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_preauth_list(krb5_get_init_creds_opt *opt, krb5_preauthtype *preauth_list, int preauth_list_length); /** * Set salt for optimistic preauthentication in initial credential options. * * @param [in] opt Options structure * @param [in] salt Salt data * * When getting initial credentials with a password, a salt string it used to * convert the password to a key. Normally this salt is obtained from the * first KDC reply, but when performing optimistic preauthentication, the * client may need to supply the salt string with this function. */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_salt(krb5_get_init_creds_opt *opt, krb5_data *salt); /** * Set or unset change-password-prompt flag in initial credential options. * * @param [in] opt Options structure * @param [in] prompt Whether to prompt to change password * * This flag is on by default. It controls whether * krb5_get_init_creds_password() will react to an expired-password error by * prompting for a new password and attempting to change the old one. */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_change_password_prompt(krb5_get_init_creds_opt *opt, int prompt); /** Generic preauth option attribute/value pairs */ typedef struct _krb5_gic_opt_pa_data { char *attr; char *value; } krb5_gic_opt_pa_data; /** * Supply options for preauthentication in initial credential options. * * @param [in] context Library context * @param [in] opt Options structure * @param [in] attr Preauthentication option name * @param [in] value Preauthentication option value * * This function allows the caller to supply options for preauthentication. * The values of @a attr and @a value are supplied to each preauthentication * module available within @a context. */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_pa(krb5_context context, krb5_get_init_creds_opt *opt, const char *attr, const char *value); /** * Set location of FAST armor ccache in initial credential options. * * @param [in] context Library context * @param [in] opt Options * @param [in] fast_ccache_name Credential cache name * * Sets the location of a credential cache containing an armor ticket to * protect an initial credential exchange using the FAST protocol extension. * * In version 1.7, setting an armor ccache requires that FAST be used for the * exchange. In version 1.8 or later, setting the armor ccache causes FAST to * be used if the KDC supports it; krb5_get_init_creds_opt_set_fast_flags() * must be used to require that FAST be used. */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_fast_ccache_name(krb5_context context, krb5_get_init_creds_opt *opt, const char *fast_ccache_name); /** * Set FAST armor cache in initial credential options. * * @param [in] context Library context * @param [in] opt Options * @param [in] ccache Credential cache handle * * This function is similar to krb5_get_init_creds_opt_set_fast_ccache_name(), * but uses a credential cache handle instead of a name. * * @version New in 1.9 */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_fast_ccache(krb5_context context, krb5_get_init_creds_opt *opt, krb5_ccache ccache); /** * Set an input credential cache in initial credential options. * * @param [in] context Library context * @param [in] opt Options * @param [in] ccache Credential cache handle * * If an input credential cache is set, then the krb5_get_init_creds family of * APIs will read settings from it. Setting an input ccache is desirable when * the application wishes to perform authentication in the same way (using the * same preauthentication mechanisms, and making the same non-security- * sensitive choices) as the previous authentication attempt, which stored * information in the passed-in ccache. * * @version New in 1.11 */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_in_ccache(krb5_context context, krb5_get_init_creds_opt *opt, krb5_ccache ccache); /** * Set an output credential cache in initial credential options. * * @param [in] context Library context * @param [in] opt Options * @param [in] ccache Credential cache handle * * If an output credential cache is set, then the krb5_get_init_creds family of * APIs will write credentials to it. Setting an output ccache is desirable * both because it simplifies calling code and because it permits the * krb5_get_init_creds APIs to write out configuration information about the * realm to the ccache. */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_out_ccache(krb5_context context, krb5_get_init_creds_opt *opt, krb5_ccache ccache); /** * @brief Ask the KDC to include or not include a PAC in the ticket * * @param [in] context Library context * @param [in] opt Options structure * @param [in] req_pac Whether to request a PAC or not * * If this option is set, the AS request will include a PAC-REQUEST pa-data * item explicitly asking the KDC to either include or not include a privilege * attribute certificate in the ticket authorization data. By default, no * request is made; typically the KDC will default to including a PAC if it * supports them. * * @version New in 1.15 */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_pac_request(krb5_context context, krb5_get_init_creds_opt *opt, krb5_boolean req_pac); /** * Set FAST flags in initial credential options. * * @param [in] context Library context * @param [in] opt Options * @param [in] flags FAST flags * * The following flag values are valid: * @li #KRB5_FAST_REQUIRED - Require FAST to be used * * @retval * 0 - Success; Kerberos errors otherwise. */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_fast_flags(krb5_context context, krb5_get_init_creds_opt *opt, krb5_flags flags); /** * Retrieve FAST flags from initial credential options. * * @param [in] context Library context * @param [in] opt Options * @param [out] out_flags FAST flags * * @retval * 0 - Success; Kerberos errors otherwise. */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_get_fast_flags(krb5_context context, krb5_get_init_creds_opt *opt, krb5_flags *out_flags); /* Fast flags*/ #define KRB5_FAST_REQUIRED 0x0001 /**< Require KDC to support FAST*/ typedef void (KRB5_CALLCONV *krb5_expire_callback_func)(krb5_context context, void *data, krb5_timestamp password_expiration, krb5_timestamp account_expiration, krb5_boolean is_last_req); /** * Set an expiration callback in initial credential options. * * @param [in] context Library context * @param [in] opt Options structure * @param [in] cb Callback function * @param [in] data Callback argument * * Set a callback to receive password and account expiration times. * * @a cb will be invoked if and only if credentials are successfully acquired. * The callback will receive the @a context from the calling function and the * @a data argument supplied with this API. The remaining arguments should be * interpreted as follows: * * If @a is_last_req is true, then the KDC reply contained last-req entries * which unambiguously indicated the password expiration, account expiration, * or both. (If either value was not present, the corresponding argument will * be 0.) Furthermore, a non-zero @a password_expiration should be taken as a * suggestion from the KDC that a warning be displayed. * * If @a is_last_req is false, then @a account_expiration will be 0 and @a * password_expiration will contain the expiration time of either the password * or account, or 0 if no expiration time was indicated in the KDC reply. The * callback should independently decide whether to display a password * expiration warning. * * Note that @a cb may be invoked even if credentials are being acquired for * the kadmin/changepw service in order to change the password. It is the * caller's responsibility to avoid displaying a password expiry warning in * this case. * * @warning Setting an expire callback with this API will cause * krb5_get_init_creds_password() not to send password expiry warnings to the * prompter, as it ordinarily may. * * @version New in 1.9 */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_expire_callback(krb5_context context, krb5_get_init_creds_opt *opt, krb5_expire_callback_func cb, void *data); /** * Set the responder function in initial credential options. * * @param [in] context Library context * @param [in] opt Options structure * @param [in] responder Responder function * @param [in] data Responder data argument * * @version New in 1.11 */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_responder(krb5_context context, krb5_get_init_creds_opt *opt, krb5_responder_fn responder, void *data); /** * Get initial credentials using a password. * * @param [in] context Library context * @param [out] creds New credentials * @param [in] client Client principal * @param [in] password Password (or NULL) * @param [in] prompter Prompter function * @param [in] data Prompter callback data * @param [in] start_time Time when ticket becomes valid (0 for now) * @param [in] in_tkt_service Service name of initial credentials (or NULL) * @param [in] k5_gic_options Initial credential options * * This function requests KDC for an initial credentials for @a client using @a * password. If @a password is NULL, a password will be prompted for using @a * prompter if necessary. If @a in_tkt_service is specified, it is parsed as a * principal name (with the realm ignored) and used as the service principal * for the request; otherwise the ticket-granting service is used. * * @sa krb5_verify_init_creds() * * @retval * 0 Success * @retval * EINVAL Invalid argument * @retval * KRB5_KDC_UNREACH Cannot contact any KDC for requested realm * @retval * KRB5_PREAUTH_FAILED Generic Pre-athentication failure * @retval * KRB5_LIBOS_PWDINTR Password read interrupted * @retval * KRB5_REALM_CANT_RESOLVE Cannot resolve network address for KDC in requested realm * @retval * KRB5KDC_ERR_KEY_EXP Password has expired * @retval * KRB5_LIBOS_BADPWDMATCH Password mismatch * @retval * KRB5_CHPW_PWDNULL New password cannot be zero length * @retval * KRB5_CHPW_FAIL Password change failed * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_password(krb5_context context, krb5_creds *creds, krb5_principal client, const char *password, krb5_prompter_fct prompter, void *data, krb5_deltat start_time, const char *in_tkt_service, krb5_get_init_creds_opt *k5_gic_options); struct _krb5_init_creds_context; typedef struct _krb5_init_creds_context *krb5_init_creds_context; #define KRB5_INIT_CREDS_STEP_FLAG_CONTINUE 0x1 /**< More responses needed */ /** * Free an initial credentials context. * * @param [in] context Library context * @param [in] ctx Initial credentials context * * @a context must be the same as the one passed to krb5_init_creds_init() for * this initial credentials context. */ void KRB5_CALLCONV krb5_init_creds_free(krb5_context context, krb5_init_creds_context ctx); /** * Acquire credentials using an initial credentials context. * * @param [in] context Library context * @param [in] ctx Initial credentials context * * This function synchronously obtains credentials using a context created by * krb5_init_creds_init(). On successful return, the credentials can be * retrieved with krb5_init_creds_get_creds(). * * @a context must be the same as the one passed to krb5_init_creds_init() for * this initial credentials context. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_creds_get(krb5_context context, krb5_init_creds_context ctx); /** * Retrieve acquired credentials from an initial credentials context. * * @param [in] context Library context * @param [in] ctx Initial credentials context * @param [out] creds Acquired credentials * * This function copies the acquired initial credentials from @a ctx into @a * creds, after the successful completion of krb5_init_creds_get() or * krb5_init_creds_step(). Use krb5_free_cred_contents() to free @a creds when * it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_creds_get_creds(krb5_context context, krb5_init_creds_context ctx, krb5_creds *creds); /** * Get the last error from KDC from an initial credentials context. * * @param [in] context Library context * @param [in] ctx Initial credentials context * @param [out] error Error from KDC, or NULL if none was received * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_creds_get_error(krb5_context context, krb5_init_creds_context ctx, krb5_error **error); /** * Create a context for acquiring initial credentials. * * @param [in] context Library context * @param [in] client Client principal to get initial creds for * @param [in] prompter Prompter callback * @param [in] data Prompter callback argument * @param [in] start_time Time when credentials become valid (0 for now) * @param [in] options Options structure (NULL for default) * @param [out] ctx New initial credentials context * * This function creates a new context for acquiring initial credentials. Use * krb5_init_creds_free() to free @a ctx when it is no longer needed. * * Any subsequent calls to krb5_init_creds_step(), krb5_init_creds_get(), or * krb5_init_creds_free() for this initial credentials context must use the * same @a context argument as the one passed to this function. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_creds_init(krb5_context context, krb5_principal client, krb5_prompter_fct prompter, void *data, krb5_deltat start_time, krb5_get_init_creds_opt *options, krb5_init_creds_context *ctx); /** * Specify a keytab to use for acquiring initial credentials. * * @param [in] context Library context * @param [in] ctx Initial credentials context * @param [in] keytab Key table handle * * This function supplies a keytab containing the client key for an initial * credentials request. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_creds_set_keytab(krb5_context context, krb5_init_creds_context ctx, krb5_keytab keytab); /** * Get the next KDC request for acquiring initial credentials. * * @param [in] context Library context * @param [in] ctx Initial credentials context * @param [in] in KDC response (empty on the first call) * @param [out] out Next KDC request * @param [out] realm Realm for next KDC request * @param [out] flags Output flags * * This function constructs the next KDC request in an initial credential * exchange, allowing the caller to control the transport of KDC requests and * replies. On the first call, @a in should be set to an empty buffer; on * subsequent calls, it should be set to the KDC's reply to the previous * request. * * If more requests are needed, @a flags will be set to * #KRB5_INIT_CREDS_STEP_FLAG_CONTINUE and the next request will be placed in * @a out. If no more requests are needed, @a flags will not contain * #KRB5_INIT_CREDS_STEP_FLAG_CONTINUE and @a out will be empty. * * If this function returns @c KRB5KRB_ERR_RESPONSE_TOO_BIG, the caller should * transmit the next request using TCP rather than UDP. If this function * returns any other error, the initial credential exchange has failed. * * @a context must be the same as the one passed to krb5_init_creds_init() for * this initial credentials context. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_creds_step(krb5_context context, krb5_init_creds_context ctx, krb5_data *in, krb5_data *out, krb5_data *realm, unsigned int *flags); /** * Set a password for acquiring initial credentials. * * @param [in] context Library context * @param [in] ctx Initial credentials context * @param [in] password Password * * This function supplies a password to be used to construct the client key for * an initial credentials request. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_creds_set_password(krb5_context context, krb5_init_creds_context ctx, const char *password); /** * Specify a service principal for acquiring initial credentials. * * @param [in] context Library context * @param [in] ctx Initial credentials context * @param [in] service Service principal string * * This function supplies a service principal string to acquire initial * credentials for instead of the default krbtgt service. @a service is parsed * as a principal name; any realm part is ignored. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_creds_set_service(krb5_context context, krb5_init_creds_context ctx, const char *service); /** * Retrieve ticket times from an initial credentials context. * * @param [in] context Library context * @param [in] ctx Initial credentials context * @param [out] times Ticket times for acquired credentials * * The initial credentials context must have completed obtaining credentials * via either krb5_init_creds_get() or krb5_init_creds_step(). * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_creds_get_times(krb5_context context, krb5_init_creds_context ctx, krb5_ticket_times *times); struct _krb5_tkt_creds_context; typedef struct _krb5_tkt_creds_context *krb5_tkt_creds_context; /** * Create a context to get credentials from a KDC's Ticket Granting Service. * * @param[in] context Library context * @param[in] ccache Credential cache handle * @param[in] creds Input credentials * @param[in] options @ref KRB5_GC options for this request. * @param[out] ctx New TGS request context * * This function prepares to obtain credentials matching @a creds, either by * retrieving them from @a ccache or by making requests to ticket-granting * services beginning with a ticket-granting ticket for the client principal's * realm. * * The resulting TGS acquisition context can be used asynchronously with * krb5_tkt_creds_step() or synchronously with krb5_tkt_creds_get(). See also * krb5_get_credentials() for synchronous use. * * Use krb5_tkt_creds_free() to free @a ctx when it is no longer needed. * * @version New in 1.9 * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_tkt_creds_init(krb5_context context, krb5_ccache ccache, krb5_creds *creds, krb5_flags options, krb5_tkt_creds_context *ctx); /** * Synchronously obtain credentials using a TGS request context. * * @param[in] context Library context * @param[in] ctx TGS request context * * This function synchronously obtains credentials using a context created by * krb5_tkt_creds_init(). On successful return, the credentials can be * retrieved with krb5_tkt_creds_get_creds(). * * @version New in 1.9 * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_tkt_creds_get(krb5_context context, krb5_tkt_creds_context ctx); /** * Retrieve acquired credentials from a TGS request context. * * @param[in] context Library context * @param[in] ctx TGS request context * @param[out] creds Acquired credentials * * This function copies the acquired initial credentials from @a ctx into @a * creds, after the successful completion of krb5_tkt_creds_get() or * krb5_tkt_creds_step(). Use krb5_free_cred_contents() to free @a creds when * it is no longer needed. * * @version New in 1.9 * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_tkt_creds_get_creds(krb5_context context, krb5_tkt_creds_context ctx, krb5_creds *creds); /** * Free a TGS request context. * * @param[in] context Library context * @param[in] ctx TGS request context * * @version New in 1.9 */ void KRB5_CALLCONV krb5_tkt_creds_free(krb5_context context, krb5_tkt_creds_context ctx); #define KRB5_TKT_CREDS_STEP_FLAG_CONTINUE 0x1 /**< More responses needed */ /** * Get the next KDC request in a TGS exchange. * * @param[in] context Library context * @param[in] ctx TGS request context * @param[in] in KDC response (empty on the first call) * @param[out] out Next KDC request * @param[out] realm Realm for next KDC request * @param[out] flags Output flags * * This function constructs the next KDC request for a TGS exchange, allowing * the caller to control the transport of KDC requests and replies. On the * first call, @a in should be set to an empty buffer; on subsequent calls, it * should be set to the KDC's reply to the previous request. * * If more requests are needed, @a flags will be set to * #KRB5_TKT_CREDS_STEP_FLAG_CONTINUE and the next request will be placed in @a * out. If no more requests are needed, @a flags will not contain * #KRB5_TKT_CREDS_STEP_FLAG_CONTINUE and @a out will be empty. * * If this function returns @c KRB5KRB_ERR_RESPONSE_TOO_BIG, the caller should * transmit the next request using TCP rather than UDP. If this function * returns any other error, the TGS exchange has failed. * * @version New in 1.9 * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_tkt_creds_step(krb5_context context, krb5_tkt_creds_context ctx, krb5_data *in, krb5_data *out, krb5_data *realm, unsigned int *flags); /** * Retrieve ticket times from a TGS request context. * * @param[in] context Library context * @param[in] ctx TGS request context * @param[out] times Ticket times for acquired credentials * * The TGS request context must have completed obtaining credentials via either * krb5_tkt_creds_get() or krb5_tkt_creds_step(). * * @version New in 1.9 * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_tkt_creds_get_times(krb5_context context, krb5_tkt_creds_context ctx, krb5_ticket_times *times); /** * Get initial credentials using a key table. * * @param [in] context Library context * @param [out] creds New credentials * @param [in] client Client principal * @param [in] arg_keytab Key table handle * @param [in] start_time Time when ticket becomes valid (0 for now) * @param [in] in_tkt_service Service name of initial credentials (or NULL) * @param [in] k5_gic_options Initial credential options * * This function requests KDC for an initial credentials for @a client using a * client key stored in @a arg_keytab. If @a in_tkt_service is specified, it * is parsed as a principal name (with the realm ignored) and used as the * service principal for the request; otherwise the ticket-granting service is * used. * * @sa krb5_verify_init_creds() * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_keytab(krb5_context context, krb5_creds *creds, krb5_principal client, krb5_keytab arg_keytab, krb5_deltat start_time, const char *in_tkt_service, krb5_get_init_creds_opt *k5_gic_options); typedef struct _krb5_verify_init_creds_opt { krb5_flags flags; int ap_req_nofail; /**< boolean */ } krb5_verify_init_creds_opt; #define KRB5_VERIFY_INIT_CREDS_OPT_AP_REQ_NOFAIL 0x0001 /** * Initialize a credential verification options structure. * * @param [in] k5_vic_options Verification options structure */ void KRB5_CALLCONV krb5_verify_init_creds_opt_init(krb5_verify_init_creds_opt *k5_vic_options); /** * Set whether credential verification is required. * * @param [in] k5_vic_options Verification options structure * @param [in] ap_req_nofail Whether to require successful verification * * This function determines how krb5_verify_init_creds() behaves if no keytab * information is available. If @a ap_req_nofail is @c FALSE, verification * will be skipped in this case and krb5_verify_init_creds() will return * successfully. If @a ap_req_nofail is @c TRUE, krb5_verify_init_creds() will * not return successfully unless verification can be performed. * * If this function is not used, the behavior of krb5_verify_init_creds() is * determined through configuration. */ void KRB5_CALLCONV krb5_verify_init_creds_opt_set_ap_req_nofail(krb5_verify_init_creds_opt * k5_vic_options, int ap_req_nofail); /** * Verify initial credentials against a keytab. * * @param [in] context Library context * @param [in] creds Initial credentials to be verified * @param [in] server Server principal (or NULL) * @param [in] keytab Key table (NULL to use default keytab) * @param [in] ccache Credential cache for fetched creds (or NULL) * @param [in] options Verification options (NULL for default options) * * This function attempts to verify that @a creds were obtained from a KDC with * knowledge of a key in @a keytab, or the default keytab if @a keytab is NULL. * If @a server is provided, the highest-kvno key entry for that principal name * is used to verify the credentials; otherwise, all unique "host" service * principals in the keytab are tried. * * If the specified keytab does not exist, or is empty, or cannot be read, or * does not contain an entry for @a server, then credential verification may be * skipped unless configuration demands that it succeed. The caller can * control this behavior by providing a verification options structure; see * krb5_verify_init_creds_opt_init() and * krb5_verify_init_creds_opt_set_ap_req_nofail(). * * If @a ccache is NULL, any additional credentials fetched during the * verification process will be destroyed. If @a ccache points to NULL, a * memory ccache will be created for the additional credentials and returned in * @a ccache. If @a ccache points to a valid credential cache handle, the * additional credentials will be stored in that cache. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_verify_init_creds(krb5_context context, krb5_creds *creds, krb5_principal server, krb5_keytab keytab, krb5_ccache *ccache, krb5_verify_init_creds_opt *options); /** * Get validated credentials from the KDC. * * @param [in] context Library context * @param [out] creds Validated credentials * @param [in] client Client principal name * @param [in] ccache Credential cache * @param [in] in_tkt_service Server principal string (or NULL) * * This function gets a validated credential using a postdated credential from * @a ccache. If @a in_tkt_service is specified, it is parsed (with the realm * part ignored) and used as the server principal of the credential; * otherwise, the ticket-granting service is used. * * If successful, the validated credential is placed in @a creds. * * @sa krb5_get_renewed_creds() * * @retval * 0 Success * @retval * KRB5_NO_2ND_TKT Request missing second ticket * @retval * KRB5_NO_TKT_SUPPLIED Request did not supply a ticket * @retval * KRB5_PRINC_NOMATCH Requested principal and ticket do not match * @retval * KRB5_KDCREP_MODIFIED KDC reply did not match expectations * @retval * KRB5_KDCREP_SKEW Clock skew too great in KDC reply * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_validated_creds(krb5_context context, krb5_creds *creds, krb5_principal client, krb5_ccache ccache, const char *in_tkt_service); /** * Get renewed credential from KDC using an existing credential. * * @param [in] context Library context * @param [out] creds Renewed credentials * @param [in] client Client principal name * @param [in] ccache Credential cache * @param [in] in_tkt_service Server principal string (or NULL) * * This function gets a renewed credential using an existing one from @a * ccache. If @a in_tkt_service is specified, it is parsed (with the realm * part ignored) and used as the server principal of the credential; otherwise, * the ticket-granting service is used. * * If successful, the renewed credential is placed in @a creds. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_renewed_creds(krb5_context context, krb5_creds *creds, krb5_principal client, krb5_ccache ccache, const char *in_tkt_service); /** * Decode an ASN.1-formatted ticket. * * @param [in] code ASN.1-formatted ticket * @param [out] rep Decoded ticket information * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_decode_ticket(const krb5_data *code, krb5_ticket **rep); /** * Retrieve a string value from the appdefaults section of krb5.conf. * * @param [in] context Library context * @param [in] appname Application name * @param [in] realm Realm name * @param [in] option Option to be checked * @param [in] default_value Default value to return if no match is found * @param [out] ret_value String value of @a option * * This function gets the application defaults for @a option based on the given * @a appname and/or @a realm. * * @sa krb5_appdefault_boolean() */ void KRB5_CALLCONV krb5_appdefault_string(krb5_context context, const char *appname, const krb5_data *realm, const char *option, const char *default_value, char ** ret_value); /** * Retrieve a boolean value from the appdefaults section of krb5.conf. * * @param [in] context Library context * @param [in] appname Application name * @param [in] realm Realm name * @param [in] option Option to be checked * @param [in] default_value Default value to return if no match is found * @param [out] ret_value Boolean value of @a option * * This function gets the application defaults for @a option based on the given * @a appname and/or @a realm. * * @sa krb5_appdefault_string() */ void KRB5_CALLCONV krb5_appdefault_boolean(krb5_context context, const char *appname, const krb5_data *realm, const char *option, int default_value, int *ret_value); /* * Prompter enhancements */ /** Prompt for password */ #define KRB5_PROMPT_TYPE_PASSWORD 0x1 /** Prompt for new password (during password change) */ #define KRB5_PROMPT_TYPE_NEW_PASSWORD 0x2 /** Prompt for new password again */ #define KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN 0x3 /** Prompt for preauthentication data (such as an OTP value) */ #define KRB5_PROMPT_TYPE_PREAUTH 0x4 typedef krb5_int32 krb5_prompt_type; /** * Get prompt types array from a context. * * @param [in] context Library context * * @return * Pointer to an array of prompt types corresponding to the prompter's @a * prompts arguments. Each type has one of the following values: * @li #KRB5_PROMPT_TYPE_PASSWORD * @li #KRB5_PROMPT_TYPE_NEW_PASSWORD * @li #KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN * @li #KRB5_PROMPT_TYPE_PREAUTH */ krb5_prompt_type* KRB5_CALLCONV krb5_get_prompt_types(krb5_context context); /* Error reporting */ /** * Set an extended error message for an error code. * * @param [in] ctx Library context * @param [in] code Error code * @param [in] fmt Error string for the error code * @param [in] ... printf(3) style parameters */ void KRB5_CALLCONV_C krb5_set_error_message(krb5_context ctx, krb5_error_code code, const char *fmt, ...) #if !defined(__cplusplus) && (__GNUC__ > 2) __attribute__((__format__(__printf__, 3, 4))) #endif ; /** * Set an extended error message for an error code using a va_list. * * @param [in] ctx Library context * @param [in] code Error code * @param [in] fmt Error string for the error code * @param [in] args List of vprintf(3) style arguments */ void KRB5_CALLCONV krb5_vset_error_message(krb5_context ctx, krb5_error_code code, const char *fmt, va_list args) #if !defined(__cplusplus) && (__GNUC__ > 2) __attribute__((__format__(__printf__, 3, 0))) #endif ; /** * Add a prefix to the message for an error code. * * @param [in] ctx Library context * @param [in] code Error code * @param [in] fmt Format string for error message prefix * @param [in] ... printf(3) style parameters * * Format a message and prepend it to the current message for @a code. The * prefix will be separated from the old message with a colon and space. */ void KRB5_CALLCONV_C krb5_prepend_error_message(krb5_context ctx, krb5_error_code code, const char *fmt, ...) #if !defined(__cplusplus) && (__GNUC__ > 2) __attribute__((__format__(__printf__, 3, 4))) #endif ; /** * Add a prefix to the message for an error code using a va_list. * * @param [in] ctx Library context * @param [in] code Error code * @param [in] fmt Format string for error message prefix * @param [in] args List of vprintf(3) style arguments * * This function is similar to krb5_prepend_error_message(), but uses a * va_list instead of variadic arguments. */ void KRB5_CALLCONV krb5_vprepend_error_message(krb5_context ctx, krb5_error_code code, const char *fmt, va_list args) #if !defined(__cplusplus) && (__GNUC__ > 2) __attribute__((__format__(__printf__, 3, 0))) #endif ; /** * Add a prefix to a different error code's message. * * @param [in] ctx Library context * @param [in] old_code Previous error code * @param [in] code Error code * @param [in] fmt Format string for error message prefix * @param [in] ... printf(3) style parameters * * Format a message and prepend it to the message for @a old_code. The prefix * will be separated from the old message with a colon and space. Set the * resulting message as the extended error message for @a code. */ void KRB5_CALLCONV_C krb5_wrap_error_message(krb5_context ctx, krb5_error_code old_code, krb5_error_code code, const char *fmt, ...) #if !defined(__cplusplus) && (__GNUC__ > 2) __attribute__((__format__(__printf__, 4, 5))) #endif ; /** * Add a prefix to a different error code's message using a va_list. * * @param [in] ctx Library context * @param [in] old_code Previous error code * @param [in] code Error code * @param [in] fmt Format string for error message prefix * @param [in] args List of vprintf(3) style arguments * * This function is similar to krb5_wrap_error_message(), but uses a * va_list instead of variadic arguments. */ void KRB5_CALLCONV krb5_vwrap_error_message(krb5_context ctx, krb5_error_code old_code, krb5_error_code code, const char *fmt, va_list args) #if !defined(__cplusplus) && (__GNUC__ > 2) __attribute__((__format__(__printf__, 4, 0))) #endif ; /** * Copy the most recent extended error message from one context to another. * * @param [in] dest_ctx Library context to copy message to * @param [in] src_ctx Library context with current message */ void KRB5_CALLCONV krb5_copy_error_message(krb5_context dest_ctx, krb5_context src_ctx); /** * Get the (possibly extended) error message for a code. * * @param [in] ctx Library context * @param [in] code Error code * * The behavior of krb5_get_error_message() is only defined the first time it * is called after a failed call to a krb5 function using the same context, and * only when the error code passed in is the same as that returned by the krb5 * function. * * This function never returns NULL, so its result may be used unconditionally * as a C string. * * The string returned by this function must be freed using * krb5_free_error_message() * * @note Future versions may return the same string for the second * and following calls. */ const char * KRB5_CALLCONV krb5_get_error_message(krb5_context ctx, krb5_error_code code); /** * Free an error message generated by krb5_get_error_message(). * * @param [in] ctx Library context * @param [in] msg Pointer to error message */ void KRB5_CALLCONV krb5_free_error_message(krb5_context ctx, const char *msg); /** * Clear the extended error message in a context. * * @param [in] ctx Library context * * This function unsets the extended error message in a context, to ensure that * it is not mistakenly applied to another occurrence of the same error code. */ void KRB5_CALLCONV krb5_clear_error_message(krb5_context ctx); /** * Unwrap authorization data. * * @param [in] context Library context * @param [in] type @ref KRB5_AUTHDATA type of @a container * @param [in] container Authorization data to be decoded * @param [out] authdata List of decoded authorization data * * @sa krb5_encode_authdata_container() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_decode_authdata_container(krb5_context context, krb5_authdatatype type, const krb5_authdata *container, krb5_authdata ***authdata); /** * Wrap authorization data in a container. * * @param [in] context Library context * @param [in] type @ref KRB5_AUTHDATA type of @a container * @param [in] authdata List of authorization data to be encoded * @param [out] container List of encoded authorization data * * The result is returned in @a container as a single-element list. * * @sa krb5_decode_authdata_container() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_encode_authdata_container(krb5_context context, krb5_authdatatype type, krb5_authdata * const*authdata, krb5_authdata ***container); /* * AD-KDCIssued */ /** * Encode and sign AD-KDCIssued authorization data. * * @param [in] context Library context * @param [in] key Session key * @param [in] issuer The name of the issuing principal * @param [in] authdata List of authorization data to be signed * @param [out] ad_kdcissued List containing AD-KDCIssued authdata * * This function wraps a list of authorization data entries @a authdata in an * AD-KDCIssued container (see RFC 4120 section 5.2.6.2) signed with @a key. * The result is returned in @a ad_kdcissued as a single-element list. */ krb5_error_code KRB5_CALLCONV krb5_make_authdata_kdc_issued(krb5_context context, const krb5_keyblock *key, krb5_const_principal issuer, krb5_authdata *const *authdata, krb5_authdata ***ad_kdcissued); /** * Unwrap and verify AD-KDCIssued authorization data. * * @param [in] context Library context * @param [in] key Session key * @param [in] ad_kdcissued AD-KDCIssued authorization data to be unwrapped * @param [out] issuer Name of issuing principal (or NULL) * @param [out] authdata Unwrapped list of authorization data * * This function unwraps an AD-KDCIssued authdatum (see RFC 4120 section * 5.2.6.2) and verifies its signature against @a key. The issuer field of the * authdatum element is returned in @a issuer, and the unwrapped list of * authdata is returned in @a authdata. */ krb5_error_code KRB5_CALLCONV krb5_verify_authdata_kdc_issued(krb5_context context, const krb5_keyblock *key, const krb5_authdata *ad_kdcissued, krb5_principal *issuer, krb5_authdata ***authdata); /* * Windows PAC */ /* Microsoft defined types of data */ #define KRB5_PAC_LOGON_INFO 1 /**< Logon information */ #define KRB5_PAC_CREDENTIALS_INFO 2 /**< Credentials information */ #define KRB5_PAC_SERVER_CHECKSUM 6 /**< Server checksum */ #define KRB5_PAC_PRIVSVR_CHECKSUM 7 /**< KDC checksum */ #define KRB5_PAC_CLIENT_INFO 10 /**< Client name and ticket info */ #define KRB5_PAC_DELEGATION_INFO 11 /**< Constrained delegation info */ #define KRB5_PAC_UPN_DNS_INFO 12 /**< User principal name and DNS info */ struct krb5_pac_data; /** PAC data structure to convey authorization information */ typedef struct krb5_pac_data *krb5_pac; /** * Add a buffer to a PAC handle. * * @param [in] context Library context * @param [in] pac PAC handle * @param [in] type Buffer type * @param [in] data contents * * This function adds a buffer of type @a type and contents @a data to @a pac * if there isn't already a buffer of this type present. * * The valid values of @a type is one of the following: * @li #KRB5_PAC_LOGON_INFO - Logon information * @li #KRB5_PAC_CREDENTIALS_INFO - Credentials information * @li #KRB5_PAC_SERVER_CHECKSUM - Server checksum * @li #KRB5_PAC_PRIVSVR_CHECKSUM - KDC checksum * @li #KRB5_PAC_CLIENT_INFO - Client name and ticket information * @li #KRB5_PAC_DELEGATION_INFO - Constrained delegation information * @li #KRB5_PAC_UPN_DNS_INFO - User principal name and DNS information * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_pac_add_buffer(krb5_context context, krb5_pac pac, krb5_ui_4 type, const krb5_data *data); /** * Free a PAC handle. * * @param [in] context Library context * @param [in] pac PAC to be freed * * This function frees the contents of @a pac and the structure itself. */ void KRB5_CALLCONV krb5_pac_free(krb5_context context, krb5_pac pac); /** * Retrieve a buffer value from a PAC. * * @param [in] context Library context * @param [in] pac PAC handle * @param [in] type Type of buffer to retrieve * @param [out] data Buffer value * * Use krb5_free_data_contents() to free @a data when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_pac_get_buffer(krb5_context context, krb5_pac pac, krb5_ui_4 type, krb5_data *data); /** * Return an array of buffer types in a PAC handle. * * @param [in] context Library context * @param [in] pac PAC handle * @param [out] len Number of entries in @a types * @param [out] types Array of buffer types * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_pac_get_types(krb5_context context, krb5_pac pac, size_t *len, krb5_ui_4 **types); /** * Create an empty Privilege Attribute Certificate (PAC) handle. * * @param [in] context Library context * @param [out] pac New PAC handle * * Use krb5_pac_free() to free @a pac when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_pac_init(krb5_context context, krb5_pac *pac); /** * Unparse an encoded PAC into a new handle. * * @param [in] context Library context * @param [in] ptr PAC buffer * @param [in] len Length of @a ptr * @param [out] pac PAC handle * * Use krb5_pac_free() to free @a pac when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_pac_parse(krb5_context context, const void *ptr, size_t len, krb5_pac *pac); /** * Verify a PAC. * * @param [in] context Library context * @param [in] pac PAC handle * @param [in] authtime Expected timestamp * @param [in] principal Expected principal name (or NULL) * @param [in] server Key to validate server checksum (or NULL) * @param [in] privsvr Key to validate KDC checksum (or NULL) * * This function validates @a pac against the supplied @a server, @a privsvr, * @a principal and @a authtime. If @a principal is NULL, the principal and * authtime are not verified. If @a server or @a privsvr is NULL, the * corresponding checksum is not verified. * * If successful, @a pac is marked as verified. * * @note A checksum mismatch can occur if the PAC was copied from a cross-realm * TGT by an ignorant KDC; also Apple Mac OS X Server Open Directory (as of * 10.6) generates PACs with no server checksum at all. One should consider * not failing the whole authentication because of this reason, but, instead, * treating the ticket as if it did not contain a PAC or marking the PAC * information as non-verified. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_pac_verify(krb5_context context, const krb5_pac pac, krb5_timestamp authtime, krb5_const_principal principal, const krb5_keyblock *server, const krb5_keyblock *privsvr); /** * Sign a PAC. * * @param [in] context Library context * @param [in] pac PAC handle * @param [in] authtime Expected timestamp * @param [in] principal Expected principal name (or NULL) * @param [in] server_key Key for server checksum * @param [in] privsvr_key Key for KDC checksum * @param [out] data Signed PAC encoding * * This function signs @a pac using the keys @a server_key and @a privsvr_key * and returns the signed encoding in @a data. @a pac is modified to include * the server and KDC checksum buffers. Use krb5_free_data_contents() to free * @a data when it is no longer needed. * * @version New in 1.10 */ krb5_error_code KRB5_CALLCONV krb5_pac_sign(krb5_context context, krb5_pac pac, krb5_timestamp authtime, krb5_const_principal principal, const krb5_keyblock *server_key, const krb5_keyblock *privsvr_key, krb5_data *data); /** * Allow the appplication to override the profile's allow_weak_crypto setting. * * @param [in] context Library context * @param [in] enable Boolean flag * * This function allows an application to override the allow_weak_crypto * setting. It is primarily for use by aklog. * * @retval 0 (always) */ krb5_error_code KRB5_CALLCONV krb5_allow_weak_crypto(krb5_context context, krb5_boolean enable); /** * A wrapper for passing information to a @c krb5_trace_callback. * * Currently, it only contains the formatted message as determined * the the format string and arguments of the tracing macro, but it * may be extended to contain more fields in the future. */ typedef struct _krb5_trace_info { const char *message; } krb5_trace_info; typedef void (KRB5_CALLCONV *krb5_trace_callback)(krb5_context context, const krb5_trace_info *info, void *cb_data); /** * Specify a callback function for trace events. * * @param [in] context Library context * @param [in] fn Callback function * @param [in] cb_data Callback data * * Specify a callback for trace events occurring in krb5 operations performed * within @a context. @a fn will be invoked with @a context as the first * argument, @a cb_data as the last argument, and a pointer to a * krb5_trace_info as the second argument. If the trace callback is reset via * this function or @a context is destroyed, @a fn will be invoked with a NULL * second argument so it can clean up @a cb_data. Supply a NULL value for @a * fn to disable trace callbacks within @a context. * * @note This function overrides the information passed through the * @a KRB5_TRACE environment variable. * * @version New in 1.9 * * @return Returns KRB5_TRACE_NOSUPP if tracing is not supported in the library * (unless @a fn is NULL). */ krb5_error_code KRB5_CALLCONV krb5_set_trace_callback(krb5_context context, krb5_trace_callback fn, void *cb_data); /** * Specify a file name for directing trace events. * * @param [in] context Library context * @param [in] filename File name * * Open @a filename for appending (creating it, if necessary) and set up a * callback to write trace events to it. * * @note This function overrides the information passed through the * @a KRB5_TRACE environment variable. * * @version New in 1.9 * * @retval KRB5_TRACE_NOSUPP Tracing is not supported in the library. */ krb5_error_code KRB5_CALLCONV krb5_set_trace_filename(krb5_context context, const char *filename); /** * Hook function for inspecting or modifying messages sent to KDCs. * * @param [in] context Library context * @param [in] data Callback data * @param [in] realm The realm the message will be sent to * @param [in] message The original message to be sent to the KDC * @param [out] new_message_out Optional replacement message to be sent * @param [out] reply_out Optional synthetic reply * * If the hook function returns an error code, the KDC communication will be * aborted and the error code will be returned to the library operation which * initiated the communication. * * If the hook function sets @a reply_out, @a message will not be sent to the * KDC, and the given reply will used instead. * * If the hook function sets @a new_message_out, the given message will be sent * to the KDC in place of @a message. * * If the hook function returns successfully without setting either output, * @a message will be sent to the KDC normally. * * The hook function should use krb5_copy_data() to construct the value for * @a new_message_out or @a reply_out, to ensure that it can be freed correctly * by the library. * * @version New in 1.15 * * @retval 0 Success * @return A Kerberos error code */ typedef krb5_error_code (KRB5_CALLCONV *krb5_pre_send_fn)(krb5_context context, void *data, const krb5_data *realm, const krb5_data *message, krb5_data **new_message_out, krb5_data **new_reply_out); /** * Hook function for inspecting or overriding KDC replies. * * @param [in] context Library context * @param [in] data Callback data * @param [in] code Status of KDC communication * @param [in] realm The realm the reply was received from * @param [in] message The message sent to the realm's KDC * @param [in] reply The reply received from the KDC * @param [out] new_reply_out Optional replacement reply * * If @a code is zero, @a reply contains the reply received from the KDC. The * hook function may return an error code to simulate an error, may synthesize * a different reply by setting @a new_reply_out, or may simply return * successfully to do nothing. * * If @a code is non-zero, KDC communication failed and @a reply should be * ignored. The hook function may return @a code or a different error code, or * may synthesize a reply by setting @a new_reply_out and return successfully. * * The hook function should use krb5_copy_data() to construct the value for * @a new_reply_out, to ensure that it can be freed correctly by the library. * * @version New in 1.15 * * @retval 0 Success * @return A Kerberos error code */ typedef krb5_error_code (KRB5_CALLCONV *krb5_post_recv_fn)(krb5_context context, void *data, krb5_error_code code, const krb5_data *realm, const krb5_data *message, const krb5_data *reply, krb5_data **new_reply_out); /** * Set a KDC pre-send hook function. * * @param [in] context Library context * @param [in] send_hook Hook function (or NULL to disable the hook) * @param [in] data Callback data to be passed to @a send_hook * * @a send_hook will be called before messages are sent to KDCs by library * functions such as krb5_get_credentials(). The hook function may inspect, * override, or synthesize its own reply to the message. * * @version New in 1.15 */ void KRB5_CALLCONV krb5_set_kdc_send_hook(krb5_context context, krb5_pre_send_fn send_hook, void *data); /** * Set a KDC post-receive hook function. * * @param [in] context The library context. * @param [in] recv_hook Hook function (or NULL to disable the hook) * @param [in] data Callback data to be passed to @a recv_hook * * @a recv_hook will be called after a reply is received from a KDC during a * call to a library function such as krb5_get_credentials(). The hook * function may inspect or override the reply. This hook will not be executed * if the pre-send hook returns a synthetic reply. * * @version New in 1.15 */ void KRB5_CALLCONV krb5_set_kdc_recv_hook(krb5_context context, krb5_post_recv_fn recv_hook, void *data); #if TARGET_OS_MAC # pragma pack(pop) #endif KRB5INT_END_DECLS /* Don't use this! We're going to phase it out. It's just here to keep applications from breaking right away. */ #define krb5_const const #undef KRB5_ATTR_DEPRECATED /** @} */ /* end of KRB5_H group */ #endif /* KRB5_GENERAL__ */ /* * et-h-krb5_err.h: * This file is automatically generated; please do not edit it. */ #include <et/com_err.h> #define KRB5KDC_ERR_NONE (-1765328384L) #define KRB5KDC_ERR_NAME_EXP (-1765328383L) #define KRB5KDC_ERR_SERVICE_EXP (-1765328382L) #define KRB5KDC_ERR_BAD_PVNO (-1765328381L) #define KRB5KDC_ERR_C_OLD_MAST_KVNO (-1765328380L) #define KRB5KDC_ERR_S_OLD_MAST_KVNO (-1765328379L) #define KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN (-1765328378L) #define KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN (-1765328377L) #define KRB5KDC_ERR_PRINCIPAL_NOT_UNIQUE (-1765328376L) #define KRB5KDC_ERR_NULL_KEY (-1765328375L) #define KRB5KDC_ERR_CANNOT_POSTDATE (-1765328374L) #define KRB5KDC_ERR_NEVER_VALID (-1765328373L) #define KRB5KDC_ERR_POLICY (-1765328372L) #define KRB5KDC_ERR_BADOPTION (-1765328371L) #define KRB5KDC_ERR_ETYPE_NOSUPP (-1765328370L) #define KRB5KDC_ERR_SUMTYPE_NOSUPP (-1765328369L) #define KRB5KDC_ERR_PADATA_TYPE_NOSUPP (-1765328368L) #define KRB5KDC_ERR_TRTYPE_NOSUPP (-1765328367L) #define KRB5KDC_ERR_CLIENT_REVOKED (-1765328366L) #define KRB5KDC_ERR_SERVICE_REVOKED (-1765328365L) #define KRB5KDC_ERR_TGT_REVOKED (-1765328364L) #define KRB5KDC_ERR_CLIENT_NOTYET (-1765328363L) #define KRB5KDC_ERR_SERVICE_NOTYET (-1765328362L) #define KRB5KDC_ERR_KEY_EXP (-1765328361L) #define KRB5KDC_ERR_PREAUTH_FAILED (-1765328360L) #define KRB5KDC_ERR_PREAUTH_REQUIRED (-1765328359L) #define KRB5KDC_ERR_SERVER_NOMATCH (-1765328358L) #define KRB5KDC_ERR_MUST_USE_USER2USER (-1765328357L) #define KRB5KDC_ERR_PATH_NOT_ACCEPTED (-1765328356L) #define KRB5KDC_ERR_SVC_UNAVAILABLE (-1765328355L) #define KRB5PLACEHOLD_30 (-1765328354L) #define KRB5KRB_AP_ERR_BAD_INTEGRITY (-1765328353L) #define KRB5KRB_AP_ERR_TKT_EXPIRED (-1765328352L) #define KRB5KRB_AP_ERR_TKT_NYV (-1765328351L) #define KRB5KRB_AP_ERR_REPEAT (-1765328350L) #define KRB5KRB_AP_ERR_NOT_US (-1765328349L) #define KRB5KRB_AP_ERR_BADMATCH (-1765328348L) #define KRB5KRB_AP_ERR_SKEW (-1765328347L) #define KRB5KRB_AP_ERR_BADADDR (-1765328346L) #define KRB5KRB_AP_ERR_BADVERSION (-1765328345L) #define KRB5KRB_AP_ERR_MSG_TYPE (-1765328344L) #define KRB5KRB_AP_ERR_MODIFIED (-1765328343L) #define KRB5KRB_AP_ERR_BADORDER (-1765328342L) #define KRB5KRB_AP_ERR_ILL_CR_TKT (-1765328341L) #define KRB5KRB_AP_ERR_BADKEYVER (-1765328340L) #define KRB5KRB_AP_ERR_NOKEY (-1765328339L) #define KRB5KRB_AP_ERR_MUT_FAIL (-1765328338L) #define KRB5KRB_AP_ERR_BADDIRECTION (-1765328337L) #define KRB5KRB_AP_ERR_METHOD (-1765328336L) #define KRB5KRB_AP_ERR_BADSEQ (-1765328335L) #define KRB5KRB_AP_ERR_INAPP_CKSUM (-1765328334L) #define KRB5KRB_AP_PATH_NOT_ACCEPTED (-1765328333L) #define KRB5KRB_ERR_RESPONSE_TOO_BIG (-1765328332L) #define KRB5PLACEHOLD_53 (-1765328331L) #define KRB5PLACEHOLD_54 (-1765328330L) #define KRB5PLACEHOLD_55 (-1765328329L) #define KRB5PLACEHOLD_56 (-1765328328L) #define KRB5PLACEHOLD_57 (-1765328327L) #define KRB5PLACEHOLD_58 (-1765328326L) #define KRB5PLACEHOLD_59 (-1765328325L) #define KRB5KRB_ERR_GENERIC (-1765328324L) #define KRB5KRB_ERR_FIELD_TOOLONG (-1765328323L) #define KRB5KDC_ERR_CLIENT_NOT_TRUSTED (-1765328322L) #define KRB5KDC_ERR_KDC_NOT_TRUSTED (-1765328321L) #define KRB5KDC_ERR_INVALID_SIG (-1765328320L) #define KRB5KDC_ERR_DH_KEY_PARAMETERS_NOT_ACCEPTED (-1765328319L) #define KRB5KDC_ERR_CERTIFICATE_MISMATCH (-1765328318L) #define KRB5KRB_AP_ERR_NO_TGT (-1765328317L) #define KRB5KDC_ERR_WRONG_REALM (-1765328316L) #define KRB5KRB_AP_ERR_USER_TO_USER_REQUIRED (-1765328315L) #define KRB5KDC_ERR_CANT_VERIFY_CERTIFICATE (-1765328314L) #define KRB5KDC_ERR_INVALID_CERTIFICATE (-1765328313L) #define KRB5KDC_ERR_REVOKED_CERTIFICATE (-1765328312L) #define KRB5KDC_ERR_REVOCATION_STATUS_UNKNOWN (-1765328311L) #define KRB5KDC_ERR_REVOCATION_STATUS_UNAVAILABLE (-1765328310L) #define KRB5KDC_ERR_CLIENT_NAME_MISMATCH (-1765328309L) #define KRB5KDC_ERR_KDC_NAME_MISMATCH (-1765328308L) #define KRB5KDC_ERR_INCONSISTENT_KEY_PURPOSE (-1765328307L) #define KRB5KDC_ERR_DIGEST_IN_CERT_NOT_ACCEPTED (-1765328306L) #define KRB5KDC_ERR_PA_CHECKSUM_MUST_BE_INCLUDED (-1765328305L) #define KRB5KDC_ERR_DIGEST_IN_SIGNED_DATA_NOT_ACCEPTED (-1765328304L) #define KRB5KDC_ERR_PUBLIC_KEY_ENCRYPTION_NOT_SUPPORTED (-1765328303L) #define KRB5PLACEHOLD_82 (-1765328302L) #define KRB5PLACEHOLD_83 (-1765328301L) #define KRB5PLACEHOLD_84 (-1765328300L) #define KRB5KRB_AP_ERR_IAKERB_KDC_NOT_FOUND (-1765328299L) #define KRB5KRB_AP_ERR_IAKERB_KDC_NO_RESPONSE (-1765328298L) #define KRB5PLACEHOLD_87 (-1765328297L) #define KRB5PLACEHOLD_88 (-1765328296L) #define KRB5PLACEHOLD_89 (-1765328295L) #define KRB5KDC_ERR_PREAUTH_EXPIRED (-1765328294L) #define KRB5KDC_ERR_MORE_PREAUTH_DATA_REQUIRED (-1765328293L) #define KRB5PLACEHOLD_92 (-1765328292L) #define KRB5KDC_ERR_UNKNOWN_CRITICAL_FAST_OPTION (-1765328291L) #define KRB5PLACEHOLD_94 (-1765328290L) #define KRB5PLACEHOLD_95 (-1765328289L) #define KRB5PLACEHOLD_96 (-1765328288L) #define KRB5PLACEHOLD_97 (-1765328287L) #define KRB5PLACEHOLD_98 (-1765328286L) #define KRB5PLACEHOLD_99 (-1765328285L) #define KRB5KDC_ERR_NO_ACCEPTABLE_KDF (-1765328284L) #define KRB5PLACEHOLD_101 (-1765328283L) #define KRB5PLACEHOLD_102 (-1765328282L) #define KRB5PLACEHOLD_103 (-1765328281L) #define KRB5PLACEHOLD_104 (-1765328280L) #define KRB5PLACEHOLD_105 (-1765328279L) #define KRB5PLACEHOLD_106 (-1765328278L) #define KRB5PLACEHOLD_107 (-1765328277L) #define KRB5PLACEHOLD_108 (-1765328276L) #define KRB5PLACEHOLD_109 (-1765328275L) #define KRB5PLACEHOLD_110 (-1765328274L) #define KRB5PLACEHOLD_111 (-1765328273L) #define KRB5PLACEHOLD_112 (-1765328272L) #define KRB5PLACEHOLD_113 (-1765328271L) #define KRB5PLACEHOLD_114 (-1765328270L) #define KRB5PLACEHOLD_115 (-1765328269L) #define KRB5PLACEHOLD_116 (-1765328268L) #define KRB5PLACEHOLD_117 (-1765328267L) #define KRB5PLACEHOLD_118 (-1765328266L) #define KRB5PLACEHOLD_119 (-1765328265L) #define KRB5PLACEHOLD_120 (-1765328264L) #define KRB5PLACEHOLD_121 (-1765328263L) #define KRB5PLACEHOLD_122 (-1765328262L) #define KRB5PLACEHOLD_123 (-1765328261L) #define KRB5PLACEHOLD_124 (-1765328260L) #define KRB5PLACEHOLD_125 (-1765328259L) #define KRB5PLACEHOLD_126 (-1765328258L) #define KRB5PLACEHOLD_127 (-1765328257L) #define KRB5_ERR_RCSID (-1765328256L) #define KRB5_LIBOS_BADLOCKFLAG (-1765328255L) #define KRB5_LIBOS_CANTREADPWD (-1765328254L) #define KRB5_LIBOS_BADPWDMATCH (-1765328253L) #define KRB5_LIBOS_PWDINTR (-1765328252L) #define KRB5_PARSE_ILLCHAR (-1765328251L) #define KRB5_PARSE_MALFORMED (-1765328250L) #define KRB5_CONFIG_CANTOPEN (-1765328249L) #define KRB5_CONFIG_BADFORMAT (-1765328248L) #define KRB5_CONFIG_NOTENUFSPACE (-1765328247L) #define KRB5_BADMSGTYPE (-1765328246L) #define KRB5_CC_BADNAME (-1765328245L) #define KRB5_CC_UNKNOWN_TYPE (-1765328244L) #define KRB5_CC_NOTFOUND (-1765328243L) #define KRB5_CC_END (-1765328242L) #define KRB5_NO_TKT_SUPPLIED (-1765328241L) #define KRB5KRB_AP_WRONG_PRINC (-1765328240L) #define KRB5KRB_AP_ERR_TKT_INVALID (-1765328239L) #define KRB5_PRINC_NOMATCH (-1765328238L) #define KRB5_KDCREP_MODIFIED (-1765328237L) #define KRB5_KDCREP_SKEW (-1765328236L) #define KRB5_IN_TKT_REALM_MISMATCH (-1765328235L) #define KRB5_PROG_ETYPE_NOSUPP (-1765328234L) #define KRB5_PROG_KEYTYPE_NOSUPP (-1765328233L) #define KRB5_WRONG_ETYPE (-1765328232L) #define KRB5_PROG_SUMTYPE_NOSUPP (-1765328231L) #define KRB5_REALM_UNKNOWN (-1765328230L) #define KRB5_SERVICE_UNKNOWN (-1765328229L) #define KRB5_KDC_UNREACH (-1765328228L) #define KRB5_NO_LOCALNAME (-1765328227L) #define KRB5_MUTUAL_FAILED (-1765328226L) #define KRB5_RC_TYPE_EXISTS (-1765328225L) #define KRB5_RC_MALLOC (-1765328224L) #define KRB5_RC_TYPE_NOTFOUND (-1765328223L) #define KRB5_RC_UNKNOWN (-1765328222L) #define KRB5_RC_REPLAY (-1765328221L) #define KRB5_RC_IO (-1765328220L) #define KRB5_RC_NOIO (-1765328219L) #define KRB5_RC_PARSE (-1765328218L) #define KRB5_RC_IO_EOF (-1765328217L) #define KRB5_RC_IO_MALLOC (-1765328216L) #define KRB5_RC_IO_PERM (-1765328215L) #define KRB5_RC_IO_IO (-1765328214L) #define KRB5_RC_IO_UNKNOWN (-1765328213L) #define KRB5_RC_IO_SPACE (-1765328212L) #define KRB5_TRANS_CANTOPEN (-1765328211L) #define KRB5_TRANS_BADFORMAT (-1765328210L) #define KRB5_LNAME_CANTOPEN (-1765328209L) #define KRB5_LNAME_NOTRANS (-1765328208L) #define KRB5_LNAME_BADFORMAT (-1765328207L) #define KRB5_CRYPTO_INTERNAL (-1765328206L) #define KRB5_KT_BADNAME (-1765328205L) #define KRB5_KT_UNKNOWN_TYPE (-1765328204L) #define KRB5_KT_NOTFOUND (-1765328203L) #define KRB5_KT_END (-1765328202L) #define KRB5_KT_NOWRITE (-1765328201L) #define KRB5_KT_IOERR (-1765328200L) #define KRB5_NO_TKT_IN_RLM (-1765328199L) #define KRB5DES_BAD_KEYPAR (-1765328198L) #define KRB5DES_WEAK_KEY (-1765328197L) #define KRB5_BAD_ENCTYPE (-1765328196L) #define KRB5_BAD_KEYSIZE (-1765328195L) #define KRB5_BAD_MSIZE (-1765328194L) #define KRB5_CC_TYPE_EXISTS (-1765328193L) #define KRB5_KT_TYPE_EXISTS (-1765328192L) #define KRB5_CC_IO (-1765328191L) #define KRB5_FCC_PERM (-1765328190L) #define KRB5_FCC_NOFILE (-1765328189L) #define KRB5_FCC_INTERNAL (-1765328188L) #define KRB5_CC_WRITE (-1765328187L) #define KRB5_CC_NOMEM (-1765328186L) #define KRB5_CC_FORMAT (-1765328185L) #define KRB5_CC_NOT_KTYPE (-1765328184L) #define KRB5_INVALID_FLAGS (-1765328183L) #define KRB5_NO_2ND_TKT (-1765328182L) #define KRB5_NOCREDS_SUPPLIED (-1765328181L) #define KRB5_SENDAUTH_BADAUTHVERS (-1765328180L) #define KRB5_SENDAUTH_BADAPPLVERS (-1765328179L) #define KRB5_SENDAUTH_BADRESPONSE (-1765328178L) #define KRB5_SENDAUTH_REJECTED (-1765328177L) #define KRB5_PREAUTH_BAD_TYPE (-1765328176L) #define KRB5_PREAUTH_NO_KEY (-1765328175L) #define KRB5_PREAUTH_FAILED (-1765328174L) #define KRB5_RCACHE_BADVNO (-1765328173L) #define KRB5_CCACHE_BADVNO (-1765328172L) #define KRB5_KEYTAB_BADVNO (-1765328171L) #define KRB5_PROG_ATYPE_NOSUPP (-1765328170L) #define KRB5_RC_REQUIRED (-1765328169L) #define KRB5_ERR_BAD_HOSTNAME (-1765328168L) #define KRB5_ERR_HOST_REALM_UNKNOWN (-1765328167L) #define KRB5_SNAME_UNSUPP_NAMETYPE (-1765328166L) #define KRB5KRB_AP_ERR_V4_REPLY (-1765328165L) #define KRB5_REALM_CANT_RESOLVE (-1765328164L) #define KRB5_TKT_NOT_FORWARDABLE (-1765328163L) #define KRB5_FWD_BAD_PRINCIPAL (-1765328162L) #define KRB5_GET_IN_TKT_LOOP (-1765328161L) #define KRB5_CONFIG_NODEFREALM (-1765328160L) #define KRB5_SAM_UNSUPPORTED (-1765328159L) #define KRB5_SAM_INVALID_ETYPE (-1765328158L) #define KRB5_SAM_NO_CHECKSUM (-1765328157L) #define KRB5_SAM_BAD_CHECKSUM (-1765328156L) #define KRB5_KT_NAME_TOOLONG (-1765328155L) #define KRB5_KT_KVNONOTFOUND (-1765328154L) #define KRB5_APPL_EXPIRED (-1765328153L) #define KRB5_LIB_EXPIRED (-1765328152L) #define KRB5_CHPW_PWDNULL (-1765328151L) #define KRB5_CHPW_FAIL (-1765328150L) #define KRB5_KT_FORMAT (-1765328149L) #define KRB5_NOPERM_ETYPE (-1765328148L) #define KRB5_CONFIG_ETYPE_NOSUPP (-1765328147L) #define KRB5_OBSOLETE_FN (-1765328146L) #define KRB5_EAI_FAIL (-1765328145L) #define KRB5_EAI_NODATA (-1765328144L) #define KRB5_EAI_NONAME (-1765328143L) #define KRB5_EAI_SERVICE (-1765328142L) #define KRB5_ERR_NUMERIC_REALM (-1765328141L) #define KRB5_ERR_BAD_S2K_PARAMS (-1765328140L) #define KRB5_ERR_NO_SERVICE (-1765328139L) #define KRB5_CC_READONLY (-1765328138L) #define KRB5_CC_NOSUPP (-1765328137L) #define KRB5_DELTAT_BADFORMAT (-1765328136L) #define KRB5_PLUGIN_NO_HANDLE (-1765328135L) #define KRB5_PLUGIN_OP_NOTSUPP (-1765328134L) #define KRB5_ERR_INVALID_UTF8 (-1765328133L) #define KRB5_ERR_FAST_REQUIRED (-1765328132L) #define KRB5_LOCAL_ADDR_REQUIRED (-1765328131L) #define KRB5_REMOTE_ADDR_REQUIRED (-1765328130L) #define KRB5_TRACE_NOSUPP (-1765328129L) extern const struct error_table et_krb5_error_table; extern void initialize_krb5_error_table(void); /* For compatibility with Heimdal */ extern void initialize_krb5_error_table_r(struct et_list **list); #define ERROR_TABLE_BASE_krb5 (-1765328384L) /* for compatibility with older versions... */ #define init_krb5_err_tbl initialize_krb5_error_table #define krb5_err_base ERROR_TABLE_BASE_krb5 /* * et-h-k5e1_err.h: * This file is automatically generated; please do not edit it. */ #include <et/com_err.h> #define KRB5_PLUGIN_VER_NOTSUPP (-1750600192L) #define KRB5_PLUGIN_BAD_MODULE_SPEC (-1750600191L) #define KRB5_PLUGIN_NAME_NOTFOUND (-1750600190L) #define KRB5KDC_ERR_DISCARD (-1750600189L) #define KRB5_DCC_CANNOT_CREATE (-1750600188L) #define KRB5_KCC_INVALID_ANCHOR (-1750600187L) #define KRB5_KCC_UNKNOWN_VERSION (-1750600186L) #define KRB5_KCC_INVALID_UID (-1750600185L) #define KRB5_KCM_MALFORMED_REPLY (-1750600184L) #define KRB5_KCM_RPC_ERROR (-1750600183L) #define KRB5_KCM_REPLY_TOO_BIG (-1750600182L) #define KRB5_KCM_NO_SERVER (-1750600181L) extern const struct error_table et_k5e1_error_table; extern void initialize_k5e1_error_table(void); /* For compatibility with Heimdal */ extern void initialize_k5e1_error_table_r(struct et_list **list); #define ERROR_TABLE_BASE_k5e1 (-1750600192L) /* for compatibility with older versions... */ #define init_k5e1_err_tbl initialize_k5e1_error_table #define k5e1_err_base ERROR_TABLE_BASE_k5e1 /* * et-h-kdb5_err.h: * This file is automatically generated; please do not edit it. */ #include <et/com_err.h> #define KRB5_KDB_RCSID (-1780008448L) #define KRB5_KDB_INUSE (-1780008447L) #define KRB5_KDB_UK_SERROR (-1780008446L) #define KRB5_KDB_UK_RERROR (-1780008445L) #define KRB5_KDB_UNAUTH (-1780008444L) #define KRB5_KDB_NOENTRY (-1780008443L) #define KRB5_KDB_ILL_WILDCARD (-1780008442L) #define KRB5_KDB_DB_INUSE (-1780008441L) #define KRB5_KDB_DB_CHANGED (-1780008440L) #define KRB5_KDB_TRUNCATED_RECORD (-1780008439L) #define KRB5_KDB_RECURSIVELOCK (-1780008438L) #define KRB5_KDB_NOTLOCKED (-1780008437L) #define KRB5_KDB_BADLOCKMODE (-1780008436L) #define KRB5_KDB_DBNOTINITED (-1780008435L) #define KRB5_KDB_DBINITED (-1780008434L) #define KRB5_KDB_ILLDIRECTION (-1780008433L) #define KRB5_KDB_NOMASTERKEY (-1780008432L) #define KRB5_KDB_BADMASTERKEY (-1780008431L) #define KRB5_KDB_INVALIDKEYSIZE (-1780008430L) #define KRB5_KDB_CANTREAD_STORED (-1780008429L) #define KRB5_KDB_BADSTORED_MKEY (-1780008428L) #define KRB5_KDB_NOACTMASTERKEY (-1780008427L) #define KRB5_KDB_KVNONOMATCH (-1780008426L) #define KRB5_KDB_STORED_MKEY_NOTCURRENT (-1780008425L) #define KRB5_KDB_CANTLOCK_DB (-1780008424L) #define KRB5_KDB_DB_CORRUPT (-1780008423L) #define KRB5_KDB_BAD_VERSION (-1780008422L) #define KRB5_KDB_BAD_SALTTYPE (-1780008421L) #define KRB5_KDB_BAD_ENCTYPE (-1780008420L) #define KRB5_KDB_BAD_CREATEFLAGS (-1780008419L) #define KRB5_KDB_NO_PERMITTED_KEY (-1780008418L) #define KRB5_KDB_NO_MATCHING_KEY (-1780008417L) #define KRB5_KDB_DBTYPE_NOTFOUND (-1780008416L) #define KRB5_KDB_DBTYPE_NOSUP (-1780008415L) #define KRB5_KDB_DBTYPE_INIT (-1780008414L) #define KRB5_KDB_SERVER_INTERNAL_ERR (-1780008413L) #define KRB5_KDB_ACCESS_ERROR (-1780008412L) #define KRB5_KDB_INTERNAL_ERROR (-1780008411L) #define KRB5_KDB_CONSTRAINT_VIOLATION (-1780008410L) #define KRB5_LOG_CONV (-1780008409L) #define KRB5_LOG_UNSTABLE (-1780008408L) #define KRB5_LOG_CORRUPT (-1780008407L) #define KRB5_LOG_ERROR (-1780008406L) #define KRB5_KDB_DBTYPE_MISMATCH (-1780008405L) #define KRB5_KDB_POLICY_REF (-1780008404L) #define KRB5_KDB_STRINGS_TOOLONG (-1780008403L) extern const struct error_table et_kdb5_error_table; extern void initialize_kdb5_error_table(void); /* For compatibility with Heimdal */ extern void initialize_kdb5_error_table_r(struct et_list **list); #define ERROR_TABLE_BASE_kdb5 (-1780008448L) /* for compatibility with older versions... */ #define init_kdb5_err_tbl initialize_kdb5_error_table #define kdb5_err_base ERROR_TABLE_BASE_kdb5 /* * et-h-kv5m_err.h: * This file is automatically generated; please do not edit it. */ #include <et/com_err.h> #define KV5M_NONE (-1760647424L) #define KV5M_PRINCIPAL (-1760647423L) #define KV5M_DATA (-1760647422L) #define KV5M_KEYBLOCK (-1760647421L) #define KV5M_CHECKSUM (-1760647420L) #define KV5M_ENCRYPT_BLOCK (-1760647419L) #define KV5M_ENC_DATA (-1760647418L) #define KV5M_CRYPTOSYSTEM_ENTRY (-1760647417L) #define KV5M_CS_TABLE_ENTRY (-1760647416L) #define KV5M_CHECKSUM_ENTRY (-1760647415L) #define KV5M_AUTHDATA (-1760647414L) #define KV5M_TRANSITED (-1760647413L) #define KV5M_ENC_TKT_PART (-1760647412L) #define KV5M_TICKET (-1760647411L) #define KV5M_AUTHENTICATOR (-1760647410L) #define KV5M_TKT_AUTHENT (-1760647409L) #define KV5M_CREDS (-1760647408L) #define KV5M_LAST_REQ_ENTRY (-1760647407L) #define KV5M_PA_DATA (-1760647406L) #define KV5M_KDC_REQ (-1760647405L) #define KV5M_ENC_KDC_REP_PART (-1760647404L) #define KV5M_KDC_REP (-1760647403L) #define KV5M_ERROR (-1760647402L) #define KV5M_AP_REQ (-1760647401L) #define KV5M_AP_REP (-1760647400L) #define KV5M_AP_REP_ENC_PART (-1760647399L) #define KV5M_RESPONSE (-1760647398L) #define KV5M_SAFE (-1760647397L) #define KV5M_PRIV (-1760647396L) #define KV5M_PRIV_ENC_PART (-1760647395L) #define KV5M_CRED (-1760647394L) #define KV5M_CRED_INFO (-1760647393L) #define KV5M_CRED_ENC_PART (-1760647392L) #define KV5M_PWD_DATA (-1760647391L) #define KV5M_ADDRESS (-1760647390L) #define KV5M_KEYTAB_ENTRY (-1760647389L) #define KV5M_CONTEXT (-1760647388L) #define KV5M_OS_CONTEXT (-1760647387L) #define KV5M_ALT_METHOD (-1760647386L) #define KV5M_ETYPE_INFO_ENTRY (-1760647385L) #define KV5M_DB_CONTEXT (-1760647384L) #define KV5M_AUTH_CONTEXT (-1760647383L) #define KV5M_KEYTAB (-1760647382L) #define KV5M_RCACHE (-1760647381L) #define KV5M_CCACHE (-1760647380L) #define KV5M_PREAUTH_OPS (-1760647379L) #define KV5M_SAM_CHALLENGE (-1760647378L) #define KV5M_SAM_CHALLENGE_2 (-1760647377L) #define KV5M_SAM_KEY (-1760647376L) #define KV5M_ENC_SAM_RESPONSE_ENC (-1760647375L) #define KV5M_ENC_SAM_RESPONSE_ENC_2 (-1760647374L) #define KV5M_SAM_RESPONSE (-1760647373L) #define KV5M_SAM_RESPONSE_2 (-1760647372L) #define KV5M_PREDICTED_SAM_RESPONSE (-1760647371L) #define KV5M_PASSWD_PHRASE_ELEMENT (-1760647370L) #define KV5M_GSS_OID (-1760647369L) #define KV5M_GSS_QUEUE (-1760647368L) #define KV5M_FAST_ARMORED_REQ (-1760647367L) #define KV5M_FAST_REQ (-1760647366L) #define KV5M_FAST_RESPONSE (-1760647365L) #define KV5M_AUTHDATA_CONTEXT (-1760647364L) extern const struct error_table et_kv5m_error_table; extern void initialize_kv5m_error_table(void); /* For compatibility with Heimdal */ extern void initialize_kv5m_error_table_r(struct et_list **list); #define ERROR_TABLE_BASE_kv5m (-1760647424L) /* for compatibility with older versions... */ #define init_kv5m_err_tbl initialize_kv5m_error_table #define kv5m_err_base ERROR_TABLE_BASE_kv5m /* * et-h-krb524_err.h: * This file is automatically generated; please do not edit it. */ #include <et/com_err.h> #define KRB524_BADKEY (-1750206208L) #define KRB524_BADADDR (-1750206207L) #define KRB524_BADPRINC (-1750206206L) #define KRB524_BADREALM (-1750206205L) #define KRB524_V4ERR (-1750206204L) #define KRB524_ENCFULL (-1750206203L) #define KRB524_DECEMPTY (-1750206202L) #define KRB524_NOTRESP (-1750206201L) #define KRB524_KRB4_DISABLED (-1750206200L) extern const struct error_table et_k524_error_table; extern void initialize_k524_error_table(void); /* For compatibility with Heimdal */ extern void initialize_k524_error_table_r(struct et_list **list); #define ERROR_TABLE_BASE_k524 (-1750206208L) /* for compatibility with older versions... */ #define init_k524_err_tbl initialize_k524_error_table #define k524_err_base ERROR_TABLE_BASE_k524 /* * et-h-asn1_err.h: * This file is automatically generated; please do not edit it. */ #include <et/com_err.h> #define ASN1_BAD_TIMEFORMAT (1859794432L) #define ASN1_MISSING_FIELD (1859794433L) #define ASN1_MISPLACED_FIELD (1859794434L) #define ASN1_TYPE_MISMATCH (1859794435L) #define ASN1_OVERFLOW (1859794436L) #define ASN1_OVERRUN (1859794437L) #define ASN1_BAD_ID (1859794438L) #define ASN1_BAD_LENGTH (1859794439L) #define ASN1_BAD_FORMAT (1859794440L) #define ASN1_PARSE_ERROR (1859794441L) #define ASN1_BAD_GMTIME (1859794442L) #define ASN1_MISMATCH_INDEF (1859794443L) #define ASN1_MISSING_EOC (1859794444L) #define ASN1_OMITTED (1859794445L) extern const struct error_table et_asn1_error_table; extern void initialize_asn1_error_table(void); /* For compatibility with Heimdal */ extern void initialize_asn1_error_table_r(struct et_list **list); #define ERROR_TABLE_BASE_asn1 (1859794432L) /* for compatibility with older versions... */ #define init_asn1_err_tbl initialize_asn1_error_table #define asn1_err_base ERROR_TABLE_BASE_asn1 #endif /* KRB5_KRB5_H_INCLUDED */ �������������������������������������������������������������������������������������������������������������������������������������������������krb5/kadm5_hook_plugin.h����������������������������������������������������������������������������0000644�����������������00000014021�14763166030�0011163 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2010 by the Massachusetts Institute of Technology. * All rights reserved. * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of M.I.T. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a * fashion that it might be confused with the original M.I.T. software. * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. */ #ifndef H_KRB5_KADM5_HOOK_PLUGIN #define H_KRB5_KADM5_HOOK_PLUGIN /** * @file krb5/krb5_kadm5_hook_plugin.h * Provide a plugin interface for kadm5 operations. This interface * permits a plugin to intercept principal modification, creation and * change password operations. Operations run at two stages: a * precommit stage that runs before the operation is committed to the * database and a postcommit operation that runs after the database * is updated; see #kadm5_hook_stage for details on semantics. * * This interface is based on a proposed extension to Heimdal by Russ * Allbery; it is likely that Heimdal will adopt an approach based on * stacked kdb modules rather than this interface. For MIT, writing a * plugin to this interface is significantly easier than stacking kdb * modules. Also, the kadm5 interface is significantly more stable * than the kdb interface, so this approach is more desirable than * stacked kdb modules. * * This interface depends on kadm5/admin.h. As such, the interface * does not provide strong guarantees of ABI stability. * * The kadm5_hook interface currently has only one supported major version, * which is 1. Major version 1 has a current minor version number of 2. * * kadm5_hook plugins should: * kadm5_hook_<modulename>_initvt, matching the signature: * * krb5_error_code * kadm5_hook_modname_initvt(krb5_context context, int maj_ver, int min_ver, * krb5_plugin_vtable vtable); * * The initvt function should: * * - Check that the supplied maj_ver number is supported by the module, or * return KRB5_PLUGIN_VER_NOTSUPP if it is not. * * - Cast the vtable pointer as appropriate for maj_ver: * maj_ver == 1: Cast to kadm5_hook_vftable_1 * * - Initialize the methods of the vtable, stopping as appropriate for the * supplied min_ver. Optional methods may be left uninitialized. * * Memory for the vtable is allocated by the caller, not by the module. */ #include <krb5/krb5.h> #include <krb5/plugin.h> #include <kadm5/admin.h> /** * Whether the operation is being run before or after the database * update. */ enum kadm5_hook_stage { /** In this stage, any plugin failure prevents following plugins from * running and aborts the operation.*/ KADM5_HOOK_STAGE_PRECOMMIT, /** In this stage, plugin failures are logged but otherwise ignored.*/ KADM5_HOOK_STAGE_POSTCOMMIT }; /** Opaque module data pointer. */ typedef struct kadm5_hook_modinfo_st kadm5_hook_modinfo; /** * Interface for the v1 virtual table for the kadm5_hook plugin. * All entry points are optional. The name field must be provided. */ typedef struct kadm5_hook_vtable_1_st { /** A text string identifying the plugin for logging messages. */ const char *name; /** Initialize a plugin module. * @param modinfo returns newly allocated module info for future * calls. Cleaned up by the fini() function. */ kadm5_ret_t (*init)(krb5_context, kadm5_hook_modinfo **modinfo); /** Clean up a module and free @a modinfo. */ void (*fini)(krb5_context, kadm5_hook_modinfo *modinfo); /** Indicates that the password is being changed. * @param stage is an integer from #kadm5_hook_stage enumeration * @param keepold is true if existing keys are being kept. * @param newpass is NULL if the key sare being randomized. */ kadm5_ret_t (*chpass)(krb5_context, kadm5_hook_modinfo *modinfo, int stage, krb5_principal, krb5_boolean keepold, int n_ks_tuple, krb5_key_salt_tuple *ks_tuple, const char *newpass); /** Indicate a principal is created. */ kadm5_ret_t (*create)(krb5_context, kadm5_hook_modinfo *, int stage, kadm5_principal_ent_t, long mask, int n_ks_tuple, krb5_key_salt_tuple *ks_tuple, const char *password); /** Modify a principal. */ kadm5_ret_t (*modify)(krb5_context, kadm5_hook_modinfo *, int stage, kadm5_principal_ent_t, long mask); /** Indicate a principal is deleted. */ kadm5_ret_t (*remove)(krb5_context, kadm5_hook_modinfo *modinfo, int stage, krb5_principal); /* End of minor version 1. */ /** Indicate a principal is renamed. */ kadm5_ret_t (*rename)(krb5_context, kadm5_hook_modinfo *modinfo, int stage, krb5_principal, krb5_principal); /* End of minor version 2. */ } kadm5_hook_vftable_1; #endif /*H_KRB5_KADM5_HOOK_PLUGIN*/ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������krb5/kdcpolicy_plugin.h�����������������������������������������������������������������������������0000644�����������������00000012310�14763166030�0011122 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* include/krb5/kdcpolicy_plugin.h - KDC policy plugin interface */ /* * Copyright (C) 2017 by Red Hat, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Declarations for kdcpolicy plugin module implementors. * * The kdcpolicy pluggable interface currently has only one supported major * version, which is 1. Major version 1 has a current minor version number of * 1. * * kdcpolicy plugin modules should define a function named * kdcpolicy_<modulename>_initvt, matching the signature: * * krb5_error_code * kdcpolicy_modname_initvt(krb5_context context, int maj_ver, int min_ver, * krb5_plugin_vtable vtable); * * The initvt function should: * * - Check that the supplied maj_ver number is supported by the module, or * return KRB5_PLUGIN_VER_NOTSUPP if it is not. * * - Cast the vtable pointer as appropriate for maj_ver: * maj_ver == 1: Cast to krb5_kdcpolicy_vtable * * - Initialize the methods of the vtable, stopping as appropriate for the * supplied min_ver. Optional methods may be left uninitialized. * * Memory for the vtable is allocated by the caller, not by the module. */ #ifndef KRB5_POLICY_PLUGIN_H #define KRB5_POLICY_PLUGIN_H #include <krb5/krb5.h> /* Abstract module datatype. */ typedef struct krb5_kdcpolicy_moddata_st *krb5_kdcpolicy_moddata; /* A module can optionally include kdb.h to inspect principal entries when * authorizing requests. */ struct _krb5_db_entry_new; /* * Optional: Initialize module data. Return 0 on success, * KRB5_PLUGIN_NO_HANDLE if the module is inoperable (due to configuration, for * example), and any other error code to abort KDC startup. Optionally set * *data_out to a module data object to be passed to future calls. */ typedef krb5_error_code (*krb5_kdcpolicy_init_fn)(krb5_context context, krb5_kdcpolicy_moddata *data_out); /* Optional: Clean up module data. */ typedef krb5_error_code (*krb5_kdcpolicy_fini_fn)(krb5_context context, krb5_kdcpolicy_moddata moddata); /* * Optional: return an error code and set status to an appropriate string * literal to deny an AS request; otherwise return 0. lifetime_out, if set, * restricts the ticket lifetime. renew_lifetime_out, if set, restricts the * ticket renewable lifetime. */ typedef krb5_error_code (*krb5_kdcpolicy_check_as_fn)(krb5_context context, krb5_kdcpolicy_moddata moddata, const krb5_kdc_req *request, const struct _krb5_db_entry_new *client, const struct _krb5_db_entry_new *server, const char *const *auth_indicators, const char **status, krb5_deltat *lifetime_out, krb5_deltat *renew_lifetime_out); /* * Optional: return an error code and set status to an appropriate string * literal to deny a TGS request; otherwise return 0. lifetime_out, if set, * restricts the ticket lifetime. renew_lifetime_out, if set, restricts the * ticket renewable lifetime. */ typedef krb5_error_code (*krb5_kdcpolicy_check_tgs_fn)(krb5_context context, krb5_kdcpolicy_moddata moddata, const krb5_kdc_req *request, const struct _krb5_db_entry_new *server, const krb5_ticket *ticket, const char *const *auth_indicators, const char **status, krb5_deltat *lifetime_out, krb5_deltat *renew_lifetime_out); typedef struct krb5_kdcpolicy_vtable_st { const char *name; krb5_kdcpolicy_init_fn init; krb5_kdcpolicy_fini_fn fini; krb5_kdcpolicy_check_as_fn check_as; krb5_kdcpolicy_check_tgs_fn check_tgs; } *krb5_kdcpolicy_vtable; #endif /* KRB5_POLICY_PLUGIN_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������krb5/clpreauth_plugin.h�����������������������������������������������������������������������������0000644�����������������00000035103�14763166030�0011135 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (c) 2006 Red Hat, Inc. * Portions copyright (c) 2006, 2011 Massachusetts Institute of Technology * All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name of Red Hat, Inc., nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Declarations for clpreauth plugin module implementors. * * The clpreauth interface has a single supported major version, which is * 1. Major version 1 has a current minor version of 2. clpreauth modules * should define a function named clpreauth_<modulename>_initvt, matching * the signature: * * krb5_error_code * clpreauth_modname_initvt(krb5_context context, int maj_ver, * int min_ver, krb5_plugin_vtable vtable); * The initvt function should: * * - Check that the supplied maj_ver number is supported by the module, or * return KRB5_PLUGIN_VER_NOTSUPP if it is not. * * - Cast the vtable pointer as appropriate for the interface and maj_ver: * maj_ver == 1: Cast to krb5_clpreauth_vtable * * - Initialize the methods of the vtable, stopping as appropriate for the * supplied min_ver. Optional methods may be left uninitialized. * * Memory for the vtable is allocated by the caller, not by the module. */ #ifndef KRB5_CLPREAUTH_PLUGIN_H #define KRB5_CLPREAUTH_PLUGIN_H #include <krb5/krb5.h> #include <krb5/plugin.h> /* clpreauth mechanism property flags */ /* Provides a real answer which we can send back to the KDC. The client * assumes that one real answer will be enough. */ #define PA_REAL 0x00000001 /* Doesn't provide a real answer, but must be given a chance to run before any * REAL mechanism callbacks. */ #define PA_INFO 0x00000002 /* Abstract type for a client request information handle. */ typedef struct krb5_clpreauth_rock_st *krb5_clpreauth_rock; /* Abstract types for module data and per-request module data. */ typedef struct krb5_clpreauth_moddata_st *krb5_clpreauth_moddata; typedef struct krb5_clpreauth_modreq_st *krb5_clpreauth_modreq; /* Before using a callback after version 1, modules must check the vers * field of the callback structure. */ typedef struct krb5_clpreauth_callbacks_st { int vers; /* * Get the enctype expected to be used to encrypt the encrypted portion of * the AS_REP packet. When handling a PREAUTH_REQUIRED error, this * typically comes from etype-info2. When handling an AS reply, it is * initialized from the AS reply itself. */ krb5_enctype (*get_etype)(krb5_context context, krb5_clpreauth_rock rock); /* Get a pointer to the FAST armor key, or NULL if the client is not using * FAST. The returned pointer is an alias and should not be freed. */ krb5_keyblock *(*fast_armor)(krb5_context context, krb5_clpreauth_rock rock); /* * Get a pointer to the client-supplied reply key, possibly invoking the * prompter to ask for a password if this has not already been done. The * returned pointer is an alias and should not be freed. */ krb5_error_code (*get_as_key)(krb5_context context, krb5_clpreauth_rock rock, krb5_keyblock **keyblock); /* Replace the reply key to be used to decrypt the AS response. */ krb5_error_code (*set_as_key)(krb5_context context, krb5_clpreauth_rock rock, const krb5_keyblock *keyblock); /* End of version 1 clpreauth callbacks. */ /* * Get the current time for use in a preauth response. If * allow_unauth_time is true and the library has been configured to allow * it, the current time will be offset using unauthenticated timestamp * information received from the KDC in the preauth-required error, if one * has been received. Otherwise, the timestamp in a preauth-required error * will only be used if it is protected by a FAST channel. Only set * allow_unauth_time if using an unauthenticated time offset would not * create a security issue. */ krb5_error_code (*get_preauth_time)(krb5_context context, krb5_clpreauth_rock rock, krb5_boolean allow_unauth_time, krb5_timestamp *time_out, krb5_int32 *usec_out); /* Set a question to be answered by the responder and optionally provide * a challenge. */ krb5_error_code (*ask_responder_question)(krb5_context context, krb5_clpreauth_rock rock, const char *question, const char *challenge); /* Get an answer from the responder, or NULL if the question was * unanswered. */ const char *(*get_responder_answer)(krb5_context context, krb5_clpreauth_rock rock, const char *question); /* Indicate interest in the AS key through the responder interface. */ void (*need_as_key)(krb5_context context, krb5_clpreauth_rock rock); /* * Get a configuration/state item from an input ccache, which may allow it * to retrace the steps it took last time. The returned data string is an * alias and should not be freed. */ const char *(*get_cc_config)(krb5_context context, krb5_clpreauth_rock rock, const char *key); /* * Set a configuration/state item which will be recorded to an output * ccache, if the calling application supplied one. Both key and data * should be valid UTF-8 text. */ krb5_error_code (*set_cc_config)(krb5_context context, krb5_clpreauth_rock rock, const char *key, const char *data); /* End of version 2 clpreauth callbacks (added in 1.11). */ } *krb5_clpreauth_callbacks; /* * Optional: per-plugin initialization/cleanup. The init function is called by * libkrb5 when the plugin is loaded, and the fini function is called before * the plugin is unloaded. These may be called multiple times in case the * plugin is used in multiple contexts. The returned context lives the * lifetime of the krb5_context. */ typedef krb5_error_code (*krb5_clpreauth_init_fn)(krb5_context context, krb5_clpreauth_moddata *moddata_out); typedef void (*krb5_clpreauth_fini_fn)(krb5_context context, krb5_clpreauth_moddata moddata); /* * Optional (mandatory before MIT krb5 1.12): pa_type will be a member of the * vtable's pa_type_list. Return PA_REAL if pa_type is a real * preauthentication type or PA_INFO if it is an informational type. If this * function is not defined in 1.12 or later, all pa_type values advertised by * the module will be assumed to be real. */ typedef int (*krb5_clpreauth_get_flags_fn)(krb5_context context, krb5_preauthtype pa_type); /* * Optional: per-request initialization/cleanup. The request_init function is * called when beginning to process a get_init_creds request and the * request_fini function is called when processing of the request is complete. * This is optional. It may be called multiple times in the lifetime of a * krb5_context. */ typedef void (*krb5_clpreauth_request_init_fn)(krb5_context context, krb5_clpreauth_moddata moddata, krb5_clpreauth_modreq *modreq_out); typedef void (*krb5_clpreauth_request_fini_fn)(krb5_context context, krb5_clpreauth_moddata moddata, krb5_clpreauth_modreq modreq); /* * Optional: process server-supplied data in pa_data and set responder * questions. * * encoded_previous_request may be NULL if there has been no previous request * in the AS exchange. */ typedef krb5_error_code (*krb5_clpreauth_prep_questions_fn)(krb5_context context, krb5_clpreauth_moddata moddata, krb5_clpreauth_modreq modreq, krb5_get_init_creds_opt *opt, krb5_clpreauth_callbacks cb, krb5_clpreauth_rock rock, krb5_kdc_req *request, krb5_data *encoded_request_body, krb5_data *encoded_previous_request, krb5_pa_data *pa_data); /* * Mandatory: process server-supplied data in pa_data and return created data * in pa_data_out. Also called after the AS-REP is received if the AS-REP * includes preauthentication data of the associated type. * * as_key contains the client-supplied key if known, or an empty keyblock if * not. If it is empty, the module may use gak_fct to fill it in. * * encoded_previous_request may be NULL if there has been no previous request * in the AS exchange. */ typedef krb5_error_code (*krb5_clpreauth_process_fn)(krb5_context context, krb5_clpreauth_moddata moddata, krb5_clpreauth_modreq modreq, krb5_get_init_creds_opt *opt, krb5_clpreauth_callbacks cb, krb5_clpreauth_rock rock, krb5_kdc_req *request, krb5_data *encoded_request_body, krb5_data *encoded_previous_request, krb5_pa_data *pa_data, krb5_prompter_fct prompter, void *prompter_data, krb5_pa_data ***pa_data_out); /* * Optional: Attempt to use error and error_padata to try to recover from the * given error. To work with both FAST and non-FAST errors, an implementation * should generally consult error_padata rather than decoding error->e_data. * For non-FAST errors, it contains the e_data decoded as either pa-data or * typed-data. * * If this function is provided, and it returns 0 and stores data in * pa_data_out, then the client library will retransmit the request. */ typedef krb5_error_code (*krb5_clpreauth_tryagain_fn)(krb5_context context, krb5_clpreauth_moddata moddata, krb5_clpreauth_modreq modreq, krb5_get_init_creds_opt *opt, krb5_clpreauth_callbacks cb, krb5_clpreauth_rock rock, krb5_kdc_req *request, krb5_data *encoded_request_body, krb5_data *encoded_previous_request, krb5_preauthtype pa_type, krb5_error *error, krb5_pa_data **error_padata, krb5_prompter_fct prompter, void *prompter_data, krb5_pa_data ***pa_data_out); /* * Optional: receive krb5_get_init_creds_opt information. The attr and value * information supplied should be copied into moddata by the module if it * wishes to reference it after returning from this call. */ typedef krb5_error_code (*krb5_clpreauth_supply_gic_opts_fn)(krb5_context context, krb5_clpreauth_moddata moddata, krb5_get_init_creds_opt *opt, const char *attr, const char *value); typedef struct krb5_clpreauth_vtable_st { /* Mandatory: name of module. */ char *name; /* Mandatory: pointer to zero-terminated list of pa_types which this module * can provide services for. */ krb5_preauthtype *pa_type_list; /* Optional: pointer to zero-terminated list of enc_types which this module * claims to add support for. */ krb5_enctype *enctype_list; krb5_clpreauth_init_fn init; krb5_clpreauth_fini_fn fini; krb5_clpreauth_get_flags_fn flags; krb5_clpreauth_request_init_fn request_init; krb5_clpreauth_request_fini_fn request_fini; krb5_clpreauth_process_fn process; krb5_clpreauth_tryagain_fn tryagain; krb5_clpreauth_supply_gic_opts_fn gic_opts; /* Minor version 1 ends here. */ krb5_clpreauth_prep_questions_fn prep_questions; /* Minor version 2 ends here. */ } *krb5_clpreauth_vtable; /* * This function allows a clpreauth plugin to obtain preauth options. The * preauth_data returned from this function should be freed by calling * krb5_get_init_creds_opt_free_pa(). */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_get_pa(krb5_context context, krb5_get_init_creds_opt *opt, int *num_preauth_data, krb5_gic_opt_pa_data **preauth_data); /* * This function frees the preauth_data that was returned by * krb5_get_init_creds_opt_get_pa(). */ void KRB5_CALLCONV krb5_get_init_creds_opt_free_pa(krb5_context context, int num_preauth_data, krb5_gic_opt_pa_data *preauth_data); #endif /* KRB5_CLPREAUTH_PLUGIN_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������krb5/pwqual_plugin.h��������������������������������������������������������������������������������0000644�����������������00000010512�14763166030�0010454 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2010 by the Massachusetts Institute of Technology. * All rights reserved. * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of M.I.T. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a * fashion that it might be confused with the original M.I.T. software. * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. */ /* * Declarations for password quality plugin module implementors. * * The password quality pluggable interface currently has only one supported * major version, which is 1. Major version 1 has a current minor version * number of 1. * * Password quality plugin modules should define a function named * pwqual_<modulename>_initvt, matching the signature: * * krb5_error_code * pwqual_modname_initvt(krb5_context context, int maj_ver, int min_ver, * krb5_plugin_vtable vtable); * * The initvt function should: * * - Check that the supplied maj_ver number is supported by the module, or * return KRB5_PLUGIN_VER_NOTSUPP if it is not. * * - Cast the vtable pointer as appropriate for maj_ver: * maj_ver == 1: Cast to krb5_pwqual_vtable * * - Initialize the methods of the vtable, stopping as appropriate for the * supplied min_ver. Optional methods may be left uninitialized. * * Memory for the vtable is allocated by the caller, not by the module. */ #ifndef KRB5_PWQUAL_PLUGIN_H #define KRB5_PWQUAL_PLUGIN_H #include <krb5/krb5.h> #include <krb5/plugin.h> #include <kadm5/admin.h> /* An abstract type for password quality module data. */ typedef struct krb5_pwqual_moddata_st *krb5_pwqual_moddata; /*** Method type declarations ***/ /* Optional: Initialize module data. dictfile is the realm's configured * dictionary filename. */ typedef krb5_error_code (*krb5_pwqual_open_fn)(krb5_context context, const char *dict_file, krb5_pwqual_moddata *data); /* * Mandatory: Check a password for the principal princ, which has an associated * password policy named policy_name (or no associated policy if policy_name is * NULL). The parameter languages, if not NULL, contains a null-terminated * list of client-specified language tags as defined in RFC 5646. The method * should return one of the following errors if the password fails quality * standards: * * - KADM5_PASS_Q_TOOSHORT: password should be longer * - KADM5_PASS_Q_CLASS: password must have more character classes * - KADM5_PASS_Q_DICT: password contains dictionary words * - KADM5_PASS_Q_GENERIC: unspecified quality failure * * The module should also set an extended error message with * krb5_set_error_message(). The message may be localized according to one of * the language tags in languages. */ typedef krb5_error_code (*krb5_pwqual_check_fn)(krb5_context context, krb5_pwqual_moddata data, const char *password, const char *policy_name, krb5_principal princ, const char **languages); /* Optional: Release resources used by module data. */ typedef void (*krb5_pwqual_close_fn)(krb5_context context, krb5_pwqual_moddata data); /*** vtable declarations **/ /* Password quality plugin vtable for major version 1. */ typedef struct krb5_pwqual_vtable_st { const char *name; /* Mandatory: name of module. */ krb5_pwqual_open_fn open; krb5_pwqual_check_fn check; krb5_pwqual_close_fn close; /* Minor version 1 ends here. */ } *krb5_pwqual_vtable; #endif /* KRB5_PWQUAL_PLUGIN_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������krb5/preauth_plugin.h�������������������������������������������������������������������������������0000644�����������������00000003356�14763166030�0010623 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 by the Massachusetts Institute of Technology. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ /* This header includes the clpreauth and kdcpreauth interface declarations, * for backward compatibility and convenience. */ #ifndef KRB5_PREAUTH_PLUGIN_H #define KRB5_PREAUTH_PLUGIN_H #include <krb5/clpreauth_plugin.h> #include <krb5/kdcpreauth_plugin.h> #endif /* KRB5_PREAUTH_PLUGIN_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������krb5/certauth_plugin.h������������������������������������������������������������������������������0000644�����������������00000007724�14763166030�0010775 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* include/krb5/certauth_plugin.h - certauth plugin header. */ /* * Copyright (C) 2017 by Red Hat, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Certificate authorization plugin interface. The PKINIT server module uses * this interface to check client certificate attributes after the certificate * signature has been verified. */ #ifndef KRB5_CERTAUTH_PLUGIN_H #define KRB5_CERTAUTH_PLUGIN_H #include <krb5/krb5.h> #include <krb5/plugin.h> /* Abstract module data type. */ typedef struct krb5_certauth_moddata_st *krb5_certauth_moddata; typedef struct _krb5_db_entry_new krb5_db_entry; /* * Optional: Initialize module data. */ typedef krb5_error_code (*krb5_certauth_init_fn)(krb5_context context, krb5_certauth_moddata *moddata_out); /* * Optional: Clean up the module data. */ typedef void (*krb5_certauth_fini_fn)(krb5_context context, krb5_certauth_moddata moddata); /* * Mandatory: * Return 0 if the DER-encoded cert is authorized for PKINIT authentication by * princ; otherwise return one of the following error codes: * - KRB5KDC_ERR_CLIENT_NAME_MISMATCH - incorrect SAN value * - KRB5KDC_ERR_INCONSISTENT_KEY_PURPOSE - incorrect EKU * - KRB5KDC_ERR_CERTIFICATE_MISMATCH - other extension error * - KRB5_PLUGIN_NO_HANDLE - the module has no opinion about cert * * - opts is used by built-in modules to receive internal data, and must be * ignored by other modules. * - db_entry receives the client principal database entry, and can be ignored * by modules that do not link with libkdb5. * - *authinds_out optionally returns a null-terminated list of authentication * indicator strings upon KRB5_PLUGIN_NO_HANDLE or accepted authorization. */ typedef krb5_error_code (*krb5_certauth_authorize_fn)(krb5_context context, krb5_certauth_moddata moddata, const uint8_t *cert, size_t cert_len, krb5_const_principal princ, const void *opts, const krb5_db_entry *db_entry, char ***authinds_out); /* * Free indicators allocated by a module. Mandatory if authorize returns * authentication indicators. */ typedef void (*krb5_certauth_free_indicator_fn)(krb5_context context, krb5_certauth_moddata moddata, char **authinds); typedef struct krb5_certauth_vtable_st { char *name; krb5_certauth_init_fn init; krb5_certauth_fini_fn fini; krb5_certauth_authorize_fn authorize; krb5_certauth_free_indicator_fn free_ind; } *krb5_certauth_vtable; #endif /* KRB5_CERTAUTH_PLUGIN_H */ ��������������������������������������������krb5/hostrealm_plugin.h�����������������������������������������������������������������������������0000644�����������������00000012524�14763166030�0011146 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2013 by the Massachusetts Institute of Technology. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Declarations for hostrealm plugin module implementors. * * The hostrealm pluggable interface currently has only one supported major * version, which is 1. Major version 1 has a current minor version number of * 1. * * Hostrealm plugin modules should define a function named * hostrealm_<modulename>_initvt, matching the signature: * * krb5_error_code * hostrealm_modname_initvt(krb5_context context, int maj_ver, int min_ver, * krb5_plugin_vtable vtable); * * The initvt function should: * * - Check that the supplied maj_ver number is supported by the module, or * return KRB5_PLUGIN_VER_NOTSUPP if it is not. * * - Cast the vtable pointer as appropriate for maj_ver: * maj_ver == 1: Cast to krb5_hostrealm_vtable * * - Initialize the methods of the vtable, stopping as appropriate for the * supplied min_ver. Optional methods may be left uninitialized. * * Memory for the vtable is allocated by the caller, not by the module. */ #ifndef KRB5_HOSTREALM_PLUGIN_H #define KRB5_HOSTREALM_PLUGIN_H #include <krb5/krb5.h> #include <krb5/plugin.h> /* An abstract type for hostrealm module data. */ typedef struct krb5_hostrealm_moddata_st *krb5_hostrealm_moddata; /*** Method type declarations ***/ /* Optional: Initialize module data. */ typedef krb5_error_code (*krb5_hostrealm_init_fn)(krb5_context context, krb5_hostrealm_moddata *data); /* * Optional: Determine the possible realms of a hostname, using only secure, * authoritative mechanisms (ones which should be used prior to trying * referrals when getting a service ticket). Return success with a * null-terminated list of realms in *realms_out, KRB5_PLUGIN_NO_HANDLE to * defer to later modules, or another error to terminate processing. */ typedef krb5_error_code (*krb5_hostrealm_host_realm_fn)(krb5_context context, krb5_hostrealm_moddata data, const char *host, char ***realms_out); /* * Optional: Determine the possible realms of a hostname, using heuristic or * less secure mechanisms (ones which should be used after trying referrals * when getting a service ticket). Return success with a null-terminated list * of realms in *realms_out, KRB5_PLUGIN_NO_HANDLE to defer to later modules, * or another error to terminate processing. */ typedef krb5_error_code (*krb5_hostrealm_fallback_realm_fn)(krb5_context context, krb5_hostrealm_moddata data, const char *host, char ***realms_out); /* * Optional: Determine the possible default realms of the local host. Return * success with a null-terminated list of realms in *realms_out, * KRB5_PLUGIN_NO_HANDLE to defer to later modules, or another error to * terminate processing. */ typedef krb5_error_code (*krb5_hostrealm_default_realm_fn)(krb5_context context, krb5_hostrealm_moddata data, char ***realms_out); /* * Mandatory (if any of the query methods are implemented): Release the memory * returned by one of the interface methods. */ typedef void (*krb5_hostrealm_free_list_fn)(krb5_context context, krb5_hostrealm_moddata data, char **list); /* Optional: Release resources used by module data. */ typedef void (*krb5_hostrealm_fini_fn)(krb5_context context, krb5_hostrealm_moddata data); /* hostrealm vtable for major version 1. */ typedef struct krb5_hostrealm_vtable_st { const char *name; /* Mandatory: name of module. */ krb5_hostrealm_init_fn init; krb5_hostrealm_fini_fn fini; krb5_hostrealm_host_realm_fn host_realm; krb5_hostrealm_fallback_realm_fn fallback_realm; krb5_hostrealm_default_realm_fn default_realm; krb5_hostrealm_free_list_fn free_list; /* Minor version 1 ends here. */ } *krb5_hostrealm_vtable; #endif /* KRB5_HOSTREALM_PLUGIN_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������krb5/locate_plugin.h��������������������������������������������������������������������������������0000644�����������������00000005100�14763166030�0010407 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 2006 Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of M.I.T. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a * fashion that it might be confused with the original M.I.T. software. * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. */ /* * * Service location plugin definitions for Kerberos 5. */ #ifndef KRB5_LOCATE_PLUGIN_H_INCLUDED #define KRB5_LOCATE_PLUGIN_H_INCLUDED #include <krb5/krb5.h> enum locate_service_type { locate_service_kdc = 1, locate_service_master_kdc, locate_service_kadmin, locate_service_krb524, locate_service_kpasswd }; typedef struct krb5plugin_service_locate_ftable { int minor_version; /* currently 0 */ /* Per-context setup and teardown. Returned void* blob is private to the plugin. */ krb5_error_code (*init)(krb5_context, void **); void (*fini)(void *); /* Callback function returns non-zero if the plugin function should quit and return; this may be because of an error, or may indicate we've already contacted the service, whatever. The lookup function should only return an error if it detects a problem, not if the callback function tells it to quit. */ krb5_error_code (*lookup)(void *, enum locate_service_type svc, const char *realm, int socktype, int family, int (*cbfunc)(void *,int,struct sockaddr *), void *cbdata); } krb5plugin_service_locate_ftable; /* extern krb5plugin_service_locate_ftable service_locator; */ #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������krb5/plugin.h���������������������������������������������������������������������������������������0000644�����������������00000004052�14763166030�0007065 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2010 by the Massachusetts Institute of Technology. * All rights reserved. * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of M.I.T. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a * fashion that it might be confused with the original M.I.T. software. * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. */ /* Generic declarations for dynamic modules implementing krb5 plugin * modules. */ #ifndef KRB5_PLUGIN_H #define KRB5_PLUGIN_H /* krb5_plugin_vtable is an abstract type. Module initvt functions will cast * it to the appropriate interface-specific vtable type. */ typedef struct krb5_plugin_vtable_st *krb5_plugin_vtable; /* * krb5_plugin_initvt_fn is the type of all module initvt functions. Based on * the maj_ver argument, the initvt function should cast vtable to the * appropriate type and then fill it in. If a vtable has been expanded, * min_ver indicates which version of the vtable is being filled in. */ typedef krb5_error_code (*krb5_plugin_initvt_fn)(krb5_context context, int maj_ver, int min_ver, krb5_plugin_vtable vtable); #endif /* KRB5_PLUGIN_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������krb5/localauth_plugin.h�����������������������������������������������������������������������������0000644�����������������00000013371�14763166030�0011125 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2013 by the Massachusetts Institute of Technology. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Declarations for localauth plugin module implementors. * * The localauth pluggable interface currently has only one supported major * version, which is 1. Major version 1 has a current minor version number of * 1. * * Localauth plugin modules should define a function named * localauth_<modulename>_initvt, matching the signature: * * krb5_error_code * localauth_modname_initvt(krb5_context context, int maj_ver, int min_ver, * krb5_plugin_vtable vtable); * * The initvt function should: * * - Check that the supplied maj_ver number is supported by the module, or * return KRB5_PLUGIN_VER_NOTSUPP if it is not. * * - Cast the vtable pointer as appropriate for maj_ver: * maj_ver == 1: Cast to krb5_localauth_vtable * * - Initialize the methods of the vtable, stopping as appropriate for the * supplied min_ver. Optional methods may be left uninitialized. * * Memory for the vtable is allocated by the caller, not by the module. */ #ifndef KRB5_LOCALAUTH_PLUGIN_H #define KRB5_LOCALAUTH_PLUGIN_H #include <krb5/krb5.h> #include <krb5/plugin.h> /* An abstract type for localauth module data. */ typedef struct krb5_localauth_moddata_st *krb5_localauth_moddata; /*** Method type declarations ***/ /* Optional: Initialize module data. */ typedef krb5_error_code (*krb5_localauth_init_fn)(krb5_context context, krb5_localauth_moddata *data); /* Optional: Release resources used by module data. */ typedef void (*krb5_localauth_fini_fn)(krb5_context context, krb5_localauth_moddata data); /* * Optional: Determine whether aname is authorized to log in as the local * account lname. Return 0 if aname is authorized, EPERM if aname is * authoritatively not authorized, KRB5_PLUGIN_NO_HANDLE if the module cannot * determine whether aname is authorized, and any other error code for a * serious failure to process the request. aname will be considered authorized * if at least one module returns 0 and all other modules return * KRB5_PLUGIN_NO_HANDLE. */ typedef krb5_error_code (*krb5_localauth_userok_fn)(krb5_context context, krb5_localauth_moddata data, krb5_const_principal aname, const char *lname); /* * Optional (mandatory if an2ln_types is set): Determine the local account name * corresponding to aname. Return 0 and set *lname_out if a mapping can be * determined; the contents of *lname_out will later be released with a call to * the module's free_string method. Return KRB5_LNAME_NOTRANS if no mapping * can be determined. Return any other error code for a serious failure to * process the request; this will halt the krb5_aname_to_localname operation. * * If the module's an2ln_types field is set, this method will only be invoked * when a profile "auth_to_local" value references one of the module's types. * type and residual will be set to the type and residual of the auth_to_local * value. * * If the module's an2ln_types field is not set but the an2ln method is * implemented, this method will be invoked independently of the profile's * auth_to_local settings, with type and residual set to NULL. If multiple * modules are registered with an2ln methods but no an2ln_types field, the * order of invocation is not defined, but all such modules will be consulted * before the built-in mechanisms are tried. */ typedef krb5_error_code (*krb5_localauth_an2ln_fn)(krb5_context context, krb5_localauth_moddata data, const char *type, const char *residual, krb5_const_principal aname, char **lname_out); /* * Optional (mandatory if an2ln is implemented): Release the memory returned by * an invocation of an2ln. */ typedef void (*krb5_localauth_free_string_fn)(krb5_context context, krb5_localauth_moddata data, char *str); /* localauth vtable for major version 1. */ typedef struct krb5_localauth_vtable_st { const char *name; /* Mandatory: name of module. */ const char **an2ln_types; /* Optional: uppercase auth_to_local types */ krb5_localauth_init_fn init; krb5_localauth_fini_fn fini; krb5_localauth_userok_fn userok; krb5_localauth_an2ln_fn an2ln; krb5_localauth_free_string_fn free_string; /* Minor version 1 ends here. */ } *krb5_localauth_vtable; #endif /* KRB5_LOCALAUTH_PLUGIN_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������argz.h����������������������������������������������������������������������������������������������0000644�����������������00000015734�14763166030�0005700 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Routines for dealing with '\0' separated arg vectors. Copyright (C) 1995-2000,2004,2007,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ARGZ_H #define _ARGZ_H 1 #include <features.h> #define __need_error_t #include <errno.h> #include <string.h> /* Need size_t, and strchr is called below. */ #ifndef __error_t_defined typedef int error_t; #endif __BEGIN_DECLS /* Make a '\0' separated arg vector from a unix argv vector, returning it in ARGZ, and the total length in LEN. If a memory allocation error occurs, ENOMEM is returned, otherwise 0. The result can be destroyed using free. */ extern error_t __argz_create (char *const __argv[], char **__restrict __argz, size_t *__restrict __len) __THROW; extern error_t argz_create (char *const __argv[], char **__restrict __argz, size_t *__restrict __len) __THROW; /* Make a '\0' separated arg vector from a SEP separated list in STRING, returning it in ARGZ, and the total length in LEN. If a memory allocation error occurs, ENOMEM is returned, otherwise 0. The result can be destroyed using free. */ extern error_t __argz_create_sep (const char *__restrict __string, int __sep, char **__restrict __argz, size_t *__restrict __len) __THROW; extern error_t argz_create_sep (const char *__restrict __string, int __sep, char **__restrict __argz, size_t *__restrict __len) __THROW; /* Returns the number of strings in ARGZ. */ extern size_t __argz_count (const char *__argz, size_t __len) __THROW __attribute_pure__; extern size_t argz_count (const char *__argz, size_t __len) __THROW __attribute_pure__; /* Puts pointers to each string in ARGZ into ARGV, which must be large enough to hold them all. */ extern void __argz_extract (const char *__restrict __argz, size_t __len, char **__restrict __argv) __THROW; extern void argz_extract (const char *__restrict __argz, size_t __len, char **__restrict __argv) __THROW; /* Make '\0' separated arg vector ARGZ printable by converting all the '\0's except the last into the character SEP. */ extern void __argz_stringify (char *__argz, size_t __len, int __sep) __THROW; extern void argz_stringify (char *__argz, size_t __len, int __sep) __THROW; /* Append BUF, of length BUF_LEN to the argz vector in ARGZ & ARGZ_LEN. */ extern error_t __argz_append (char **__restrict __argz, size_t *__restrict __argz_len, const char *__restrict __buf, size_t __buf_len) __THROW; extern error_t argz_append (char **__restrict __argz, size_t *__restrict __argz_len, const char *__restrict __buf, size_t __buf_len) __THROW; /* Append STR to the argz vector in ARGZ & ARGZ_LEN. */ extern error_t __argz_add (char **__restrict __argz, size_t *__restrict __argz_len, const char *__restrict __str) __THROW; extern error_t argz_add (char **__restrict __argz, size_t *__restrict __argz_len, const char *__restrict __str) __THROW; /* Append SEP separated list in STRING to the argz vector in ARGZ & ARGZ_LEN. */ extern error_t __argz_add_sep (char **__restrict __argz, size_t *__restrict __argz_len, const char *__restrict __string, int __delim) __THROW; extern error_t argz_add_sep (char **__restrict __argz, size_t *__restrict __argz_len, const char *__restrict __string, int __delim) __THROW; /* Delete ENTRY from ARGZ & ARGZ_LEN, if it appears there. */ extern void __argz_delete (char **__restrict __argz, size_t *__restrict __argz_len, char *__restrict __entry) __THROW; extern void argz_delete (char **__restrict __argz, size_t *__restrict __argz_len, char *__restrict __entry) __THROW; /* Insert ENTRY into ARGZ & ARGZ_LEN before BEFORE, which should be an existing entry in ARGZ; if BEFORE is NULL, ENTRY is appended to the end. Since ARGZ's first entry is the same as ARGZ, argz_insert (ARGZ, ARGZ_LEN, ARGZ, ENTRY) will insert ENTRY at the beginning of ARGZ. If BEFORE is not in ARGZ, EINVAL is returned, else if memory can't be allocated for the new ARGZ, ENOMEM is returned, else 0. */ extern error_t __argz_insert (char **__restrict __argz, size_t *__restrict __argz_len, char *__restrict __before, const char *__restrict __entry) __THROW; extern error_t argz_insert (char **__restrict __argz, size_t *__restrict __argz_len, char *__restrict __before, const char *__restrict __entry) __THROW; /* Replace any occurrences of the string STR in ARGZ with WITH, reallocating ARGZ as necessary. If REPLACE_COUNT is non-zero, *REPLACE_COUNT will be incremented by number of replacements performed. */ extern error_t __argz_replace (char **__restrict __argz, size_t *__restrict __argz_len, const char *__restrict __str, const char *__restrict __with, unsigned int *__restrict __replace_count); extern error_t argz_replace (char **__restrict __argz, size_t *__restrict __argz_len, const char *__restrict __str, const char *__restrict __with, unsigned int *__restrict __replace_count); /* Returns the next entry in ARGZ & ARGZ_LEN after ENTRY, or NULL if there are no more. If entry is NULL, then the first entry is returned. This behavior allows two convenient iteration styles: char *entry = 0; while ((entry = argz_next (argz, argz_len, entry))) ...; or char *entry; for (entry = argz; entry; entry = argz_next (argz, argz_len, entry)) ...; */ extern char *__argz_next (const char *__restrict __argz, size_t __argz_len, const char *__restrict __entry) __THROW; extern char *argz_next (const char *__restrict __argz, size_t __argz_len, const char *__restrict __entry) __THROW; #ifdef __USE_EXTERN_INLINES __extern_inline char * __NTH (__argz_next (const char *__argz, size_t __argz_len, const char *__entry)) { if (__entry) { if (__entry < __argz + __argz_len) __entry = strchr (__entry, '\0') + 1; return __entry >= __argz + __argz_len ? (char *) NULL : (char *) __entry; } else return __argz_len > 0 ? (char *) __argz : 0; } __extern_inline char * __NTH (argz_next (const char *__argz, size_t __argz_len, const char *__entry)) { return __argz_next (__argz, __argz_len, __entry); } #endif /* Use extern inlines. */ __END_DECLS #endif /* argz.h */ ������������������������������������gssapi.h��������������������������������������������������������������������������������������������0000644�����������������00000000265�14763166030�0006214 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Wrapper so that #include <gssapi.h> will work without special include * paths. */ #include <gssapi/gssapi.h> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������endian.h��������������������������������������������������������������������������������������������0000644�����������������00000005715�14763166030�0006171 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1992-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ENDIAN_H #define _ENDIAN_H 1 #include <features.h> /* Definitions for byte order, according to significance of bytes, from low addresses to high addresses. The value is what you get by putting '4' in the most significant byte, '3' in the second most significant byte, '2' in the second least significant byte, and '1' in the least significant byte, and then writing down one digit for each byte, starting with the byte at the lowest address at the left, and proceeding to the byte with the highest address at the right. */ #define __LITTLE_ENDIAN 1234 #define __BIG_ENDIAN 4321 #define __PDP_ENDIAN 3412 /* This file defines `__BYTE_ORDER' for the particular machine. */ #include <bits/endian.h> /* Some machines may need to use a different endianness for floating point values. */ #ifndef __FLOAT_WORD_ORDER # define __FLOAT_WORD_ORDER __BYTE_ORDER #endif #ifdef __USE_BSD # define LITTLE_ENDIAN __LITTLE_ENDIAN # define BIG_ENDIAN __BIG_ENDIAN # define PDP_ENDIAN __PDP_ENDIAN # define BYTE_ORDER __BYTE_ORDER #endif #if __BYTE_ORDER == __LITTLE_ENDIAN # define __LONG_LONG_PAIR(HI, LO) LO, HI #elif __BYTE_ORDER == __BIG_ENDIAN # define __LONG_LONG_PAIR(HI, LO) HI, LO #endif #if defined __USE_BSD && !defined __ASSEMBLER__ /* Conversion interfaces. */ # include <bits/byteswap.h> # if __BYTE_ORDER == __LITTLE_ENDIAN # define htobe16(x) __bswap_16 (x) # define htole16(x) (x) # define be16toh(x) __bswap_16 (x) # define le16toh(x) (x) # define htobe32(x) __bswap_32 (x) # define htole32(x) (x) # define be32toh(x) __bswap_32 (x) # define le32toh(x) (x) # if __GLIBC_HAVE_LONG_LONG # define htobe64(x) __bswap_64 (x) # define htole64(x) (x) # define be64toh(x) __bswap_64 (x) # define le64toh(x) (x) # endif # else # define htobe16(x) (x) # define htole16(x) __bswap_16 (x) # define be16toh(x) (x) # define le16toh(x) __bswap_16 (x) # define htobe32(x) (x) # define htole32(x) __bswap_32 (x) # define be32toh(x) (x) # define le32toh(x) __bswap_32 (x) # if __GLIBC_HAVE_LONG_LONG # define htobe64(x) (x) # define htole64(x) __bswap_64 (x) # define be64toh(x) (x) # define le64toh(x) __bswap_64 (x) # endif # endif #endif #endif /* endian.h */ ���������������������������������������������������gif_lib.h�������������������������������������������������������������������������������������������0000644�����������������00000034212�14763166030�0006320 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/****************************************************************************** * In order to make life a little bit easier when using the GIF file format, * this library was written, and which does all the dirty work... * * Written by Gershon Elber, Jun. 1989 * Hacks by Eric S. Raymond, Sep. 1992 ****************************************************************************** * History: * 14 Jun 89 - Version 1.0 by Gershon Elber. * 3 Sep 90 - Version 1.1 by Gershon Elber (Support for Gif89, Unique names) * 15 Sep 90 - Version 2.0 by Eric S. Raymond (Changes to suoport GIF slurp) * 26 Jun 96 - Version 3.0 by Eric S. Raymond (Full GIF89 support) * 17 Dec 98 - Version 4.0 by Toshio Kuratomi (Fix extension writing code) *****************************************************************************/ #ifndef _GIF_LIB_H_ #define _GIF_LIB_H_ 1 #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #define GIF_LIB_VERSION " Version 4.1, " #define GIF_ERROR 0 #define GIF_OK 1 #ifndef TRUE #define TRUE 1 #endif /* TRUE */ #ifndef FALSE #define FALSE 0 #endif /* FALSE */ #ifndef NULL #define NULL 0 #endif /* NULL */ #define GIF_STAMP "GIFVER" /* First chars in file - GIF stamp. */ #define GIF_STAMP_LEN sizeof(GIF_STAMP) - 1 #define GIF_VERSION_POS 3 /* Version first character in stamp. */ #define GIF87_STAMP "GIF87a" /* First chars in file - GIF stamp. */ #define GIF89_STAMP "GIF89a" /* First chars in file - GIF stamp. */ #define GIF_FILE_BUFFER_SIZE 16384 /* Files uses bigger buffers than usual. */ typedef int GifBooleanType; typedef unsigned char GifPixelType; typedef unsigned char *GifRowType; typedef unsigned char GifByteType; #ifdef _GBA_OPTMEM typedef unsigned short GifPrefixType; typedef short GifWord; #else typedef unsigned int GifPrefixType; typedef int GifWord; #endif #define GIF_MESSAGE(Msg) fprintf(stderr, "\n%s: %s\n", PROGRAM_NAME, Msg) #define GIF_EXIT(Msg) { GIF_MESSAGE(Msg); exit(-3); } #ifdef SYSV #define VoidPtr char * #else #define VoidPtr void * #endif /* SYSV */ typedef struct GifColorType { GifByteType Red, Green, Blue; } GifColorType; typedef struct ColorMapObject { int ColorCount; int BitsPerPixel; GifColorType *Colors; /* on malloc(3) heap */ } ColorMapObject; typedef struct GifImageDesc { GifWord Left, Top, Width, Height, /* Current image dimensions. */ Interlace; /* Sequential/Interlaced lines. */ ColorMapObject *ColorMap; /* The local color map */ } GifImageDesc; typedef struct GifFileType { GifWord SWidth, SHeight, /* Screen dimensions. */ SColorResolution, /* How many colors can we generate? */ SBackGroundColor; /* I hope you understand this one... */ ColorMapObject *SColorMap; /* NULL if not exists. */ int ImageCount; /* Number of current image */ GifImageDesc Image; /* Block describing current image */ struct SavedImage *SavedImages; /* Use this to accumulate file state */ VoidPtr UserData; /* hook to attach user data (TVT) */ VoidPtr Private; /* Don't mess with this! */ } GifFileType; typedef enum { UNDEFINED_RECORD_TYPE, SCREEN_DESC_RECORD_TYPE, IMAGE_DESC_RECORD_TYPE, /* Begin with ',' */ EXTENSION_RECORD_TYPE, /* Begin with '!' */ TERMINATE_RECORD_TYPE /* Begin with ';' */ } GifRecordType; /* DumpScreen2Gif routine constants identify type of window/screen to dump. * Note all values below 1000 are reserved for the IBMPC different display * devices (it has many!) and are compatible with the numbering TC2.0 * (Turbo C 2.0 compiler for IBM PC) gives to these devices. */ typedef enum { GIF_DUMP_SGI_WINDOW = 1000, GIF_DUMP_X_WINDOW = 1001 } GifScreenDumpType; /* func type to read gif data from arbitrary sources (TVT) */ typedef int (*InputFunc) (GifFileType *, GifByteType *, int); /* func type to write gif data ro arbitrary targets. * Returns count of bytes written. (MRB) */ typedef int (*OutputFunc) (GifFileType *, const GifByteType *, int); /****************************************************************************** * GIF89 extension function codes ******************************************************************************/ #define COMMENT_EXT_FUNC_CODE 0xfe /* comment */ #define GRAPHICS_EXT_FUNC_CODE 0xf9 /* graphics control */ #define PLAINTEXT_EXT_FUNC_CODE 0x01 /* plaintext */ #define APPLICATION_EXT_FUNC_CODE 0xff /* application block */ /****************************************************************************** * O.K., here are the routines one can access in order to encode GIF file: * (GIF_LIB file EGIF_LIB.C). ******************************************************************************/ GifFileType *EGifOpenFileName(const char *GifFileName, int GifTestExistance); GifFileType *EGifOpenFileHandle(int GifFileHandle); GifFileType *EGifOpen(void *userPtr, OutputFunc writeFunc); int EGifSpew(GifFileType * GifFile); void EGifSetGifVersion(const char *Version); int EGifPutScreenDesc(GifFileType * GifFile, int GifWidth, int GifHeight, int GifColorRes, int GifBackGround, const ColorMapObject * GifColorMap); int EGifPutImageDesc(GifFileType * GifFile, int GifLeft, int GifTop, int Width, int GifHeight, int GifInterlace, const ColorMapObject * GifColorMap); int EGifPutLine(GifFileType * GifFile, GifPixelType * GifLine, int GifLineLen); int EGifPutPixel(GifFileType * GifFile, GifPixelType GifPixel); int EGifPutComment(GifFileType * GifFile, const char *GifComment); int EGifPutExtensionFirst(GifFileType * GifFile, int GifExtCode, int GifExtLen, const VoidPtr GifExtension); int EGifPutExtensionNext(GifFileType * GifFile, int GifExtCode, int GifExtLen, const VoidPtr GifExtension); int EGifPutExtensionLast(GifFileType * GifFile, int GifExtCode, int GifExtLen, const VoidPtr GifExtension); int EGifPutExtension(GifFileType * GifFile, int GifExtCode, int GifExtLen, const VoidPtr GifExtension); int EGifPutCode(GifFileType * GifFile, int GifCodeSize, const GifByteType * GifCodeBlock); int EGifPutCodeNext(GifFileType * GifFile, const GifByteType * GifCodeBlock); int EGifCloseFile(GifFileType * GifFile); #define E_GIF_ERR_OPEN_FAILED 1 /* And EGif possible errors. */ #define E_GIF_ERR_WRITE_FAILED 2 #define E_GIF_ERR_HAS_SCRN_DSCR 3 #define E_GIF_ERR_HAS_IMAG_DSCR 4 #define E_GIF_ERR_NO_COLOR_MAP 5 #define E_GIF_ERR_DATA_TOO_BIG 6 #define E_GIF_ERR_NOT_ENOUGH_MEM 7 #define E_GIF_ERR_DISK_IS_FULL 8 #define E_GIF_ERR_CLOSE_FAILED 9 #define E_GIF_ERR_NOT_WRITEABLE 10 /****************************************************************************** * O.K., here are the routines one can access in order to decode GIF file: * (GIF_LIB file DGIF_LIB.C). *****************************************************************************/ #ifndef _GBA_NO_FILEIO GifFileType *DGifOpenFileName(const char *GifFileName); GifFileType *DGifOpenFileHandle(int GifFileHandle); int DGifSlurp(GifFileType * GifFile); #endif /* _GBA_NO_FILEIO */ GifFileType *DGifOpen(void *userPtr, InputFunc readFunc); /* new one * (TVT) */ int DGifGetScreenDesc(GifFileType * GifFile); int DGifGetRecordType(GifFileType * GifFile, GifRecordType * GifType); int DGifGetImageDesc(GifFileType * GifFile); int DGifGetLine(GifFileType * GifFile, GifPixelType * GifLine, int GifLineLen); int DGifGetPixel(GifFileType * GifFile, GifPixelType GifPixel); int DGifGetComment(GifFileType * GifFile, char *GifComment); int DGifGetExtension(GifFileType * GifFile, int *GifExtCode, GifByteType ** GifExtension); int DGifGetExtensionNext(GifFileType * GifFile, GifByteType ** GifExtension); int DGifGetCode(GifFileType * GifFile, int *GifCodeSize, GifByteType ** GifCodeBlock); int DGifGetCodeNext(GifFileType * GifFile, GifByteType ** GifCodeBlock); int DGifGetLZCodes(GifFileType * GifFile, int *GifCode); int DGifCloseFile(GifFileType * GifFile); #define D_GIF_ERR_OPEN_FAILED 101 /* And DGif possible errors. */ #define D_GIF_ERR_READ_FAILED 102 #define D_GIF_ERR_NOT_GIF_FILE 103 #define D_GIF_ERR_NO_SCRN_DSCR 104 #define D_GIF_ERR_NO_IMAG_DSCR 105 #define D_GIF_ERR_NO_COLOR_MAP 106 #define D_GIF_ERR_WRONG_RECORD 107 #define D_GIF_ERR_DATA_TOO_BIG 108 #define D_GIF_ERR_NOT_ENOUGH_MEM 109 #define D_GIF_ERR_CLOSE_FAILED 110 #define D_GIF_ERR_NOT_READABLE 111 #define D_GIF_ERR_IMAGE_DEFECT 112 #define D_GIF_ERR_EOF_TOO_SOON 113 /****************************************************************************** * O.K., here are the routines from GIF_LIB file QUANTIZE.C. ******************************************************************************/ int QuantizeBuffer(unsigned int Width, unsigned int Height, int *ColorMapSize, GifByteType * RedInput, GifByteType * GreenInput, GifByteType * BlueInput, GifByteType * OutputBuffer, GifColorType * OutputColorMap); /****************************************************************************** * O.K., here are the routines from GIF_LIB file QPRINTF.C. ******************************************************************************/ extern int GifQuietPrint; #ifdef HAVE_STDARG_H extern void GifQprintf(char *Format, ...); #elif defined (HAVE_VARARGS_H) extern void GifQprintf(); #endif /* HAVE_STDARG_H */ /****************************************************************************** * O.K., here are the routines from GIF_LIB file GIF_ERR.C. ******************************************************************************/ #ifndef _GBA_NO_FILEIO extern void PrintGifError(void); #endif /* _GBA_NO_FILEIO */ extern int GifLastError(void); /****************************************************************************** * O.K., here are the routines from GIF_LIB file DEV2GIF.C. ******************************************************************************/ extern int DumpScreen2Gif(const char *FileName, int ReqGraphDriver, long ReqGraphMode1, long ReqGraphMode2, long ReqGraphMode3); /***************************************************************************** * * Everything below this point is new after version 1.2, supporting `slurp * mode' for doing I/O in two big belts with all the image-bashing in core. * *****************************************************************************/ /****************************************************************************** * Color Map handling from ALLOCGIF.C *****************************************************************************/ extern ColorMapObject *MakeMapObject(int ColorCount, const GifColorType * ColorMap); extern void FreeMapObject(ColorMapObject * Object); extern ColorMapObject *UnionColorMap(const ColorMapObject * ColorIn1, const ColorMapObject * ColorIn2, GifPixelType ColorTransIn2[]); extern int BitSize(int n); /****************************************************************************** * Support for the in-core structures allocation (slurp mode). *****************************************************************************/ /* This is the in-core version of an extension record */ typedef struct { int ByteCount; char *Bytes; /* on malloc(3) heap */ int Function; /* Holds the type of the Extension block. */ } ExtensionBlock; /* This holds an image header, its unpacked raster bits, and extensions */ typedef struct SavedImage { GifImageDesc ImageDesc; unsigned char *RasterBits; /* on malloc(3) heap */ int Function; /* DEPRECATED: Use ExtensionBlocks[x].Function instead */ int ExtensionBlockCount; ExtensionBlock *ExtensionBlocks; /* on malloc(3) heap */ } SavedImage; extern void ApplyTranslation(SavedImage * Image, GifPixelType Translation[]); extern void MakeExtension(SavedImage * New, int Function); extern int AddExtensionBlock(SavedImage * New, int Len, unsigned char ExtData[]); extern void FreeExtension(SavedImage * Image); extern SavedImage *MakeSavedImage(GifFileType * GifFile, const SavedImage * CopyFrom); extern void FreeSavedImages(GifFileType * GifFile); /****************************************************************************** * The library's internal utility font *****************************************************************************/ #define GIF_FONT_WIDTH 8 #define GIF_FONT_HEIGHT 8 extern unsigned char AsciiTable[][GIF_FONT_WIDTH]; #ifdef _WIN32 extern void DrawGifText(SavedImage * Image, #else extern void DrawText(SavedImage * Image, #endif const int x, const int y, const char *legend, const int color); extern void DrawBox(SavedImage * Image, const int x, const int y, const int w, const int d, const int color); void DrawRectangle(SavedImage * Image, const int x, const int y, const int w, const int d, const int color); extern void DrawBoxedText(SavedImage * Image, const int x, const int y, const char *legend, const int border, const int bg, const int fg); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _GIF_LIB_H */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������memory.h��������������������������������������������������������������������������������������������0000644�����������������00000001702�14763166030�0006233 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * SVID */ #ifndef _MEMORY_H #define _MEMORY_H 1 #include <features.h> #ifndef _STRING_H # include <string.h> #endif /* string.h */ #endif /* memory.h */ ��������������������������������������������������������������openssl/buffer.h������������������������������������������������������������������������������������0000644�����������������00000011642�14763166030�0007663 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/buffer/buffer.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_BUFFER_H # define HEADER_BUFFER_H # include <openssl/ossl_typ.h> #ifdef __cplusplus extern "C" { #endif # include <stddef.h> # if !defined(NO_SYS_TYPES_H) # include <sys/types.h> # endif /* Already declared in ossl_typ.h */ /* typedef struct buf_mem_st BUF_MEM; */ struct buf_mem_st { size_t length; /* current number of bytes */ char *data; size_t max; /* size of buffer */ }; BUF_MEM *BUF_MEM_new(void); void BUF_MEM_free(BUF_MEM *a); int BUF_MEM_grow(BUF_MEM *str, size_t len); int BUF_MEM_grow_clean(BUF_MEM *str, size_t len); size_t BUF_strnlen(const char *str, size_t maxlen); char *BUF_strdup(const char *str); /* * Like strndup, but in addition, explicitly guarantees to never read past the * first |siz| bytes of |str|. */ char *BUF_strndup(const char *str, size_t siz); void *BUF_memdup(const void *data, size_t siz); void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); /* safe string functions */ size_t BUF_strlcpy(char *dst, const char *src, size_t siz); size_t BUF_strlcat(char *dst, const char *src, size_t siz); /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_BUF_strings(void); /* Error codes for the BUF functions. */ /* Function codes. */ # define BUF_F_BUF_MEMDUP 103 # define BUF_F_BUF_MEM_GROW 100 # define BUF_F_BUF_MEM_GROW_CLEAN 105 # define BUF_F_BUF_MEM_NEW 101 # define BUF_F_BUF_STRDUP 102 # define BUF_F_BUF_STRNDUP 104 /* Reason codes. */ #ifdef __cplusplus } #endif #endif ����������������������������������������������������������������������������������������������openssl/comp.h��������������������������������������������������������������������������������������0000644�����������������00000004507�14763166030�0007352 0����������������������������������������������������������������������������������������������������ustar�00������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� #ifndef HEADER_COMP_H # define HEADER_COMP_H # include <openssl/crypto.h> # ifdef OPENSSL_NO_COMP # error COMP is disabled. # endif #ifdef __cplusplus extern "C" { #endif typedef struct comp_ctx_st COMP_CTX; struct comp_method_st { int type; /* NID for compression library */ const char *name; /* A text string to identify the library */ int (*init) (COMP_CTX *ctx); void (*finish) (COMP_CTX *ctx); int (*compress) (COMP_CTX *ctx, unsigned char *out, unsigned int olen, unsigned char *in, unsigned int ilen); int (*expand) (COMP_CTX *ctx, unsigned char *out, unsigned int olen, unsigned char *in, unsigned int ilen); /* * The following two do NOTHING, but are kept for backward compatibility */ long (*ctrl) (void); long (*callback_ctrl) (void); }; struct comp_ctx_st { COMP_METHOD *meth; unsigned long compress_in; unsigned long compress_out; unsigned long expand_in; unsigned long expand_out; CRYPTO_EX_DATA ex_data; }; COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); void COMP_CTX_free(COMP_CTX *ctx); int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, unsigned char *in, int ilen); int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, unsigned char *in, int ilen); COMP_METHOD *COMP_rle(void); COMP_METHOD *COMP_zlib(void); void COMP_zlib_cleanup(void); # ifdef HEADER_BIO_H # ifdef ZLIB BIO_METHOD *BIO_f_zlib(void); # endif # endif /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_COMP_strings(void); /* Error codes for the COMP functions. */ /* Function codes. */ # define COMP_F_BIO_ZLIB_FLUSH 99 # define COMP_F_BIO_ZLIB_NEW 100 # define COMP_F_BIO_ZLIB_READ 101 # define COMP_F_BIO_ZLIB_WRITE 102 /* Reason codes. */ # define COMP_R_ZLIB_DEFLATE_ERROR 99 # define COMP_R_ZLIB_INFLATE_ERROR 100 # define COMP_R_ZLIB_NOT_SUPPORTED 101 #ifdef __cplusplus } #endif #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/ts.h����������������������������������������������������������������������������������������0000644�����������������00000103400�14763166030�0007032 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/ts/ts.h */ /* * Written by Zoltan Glozik (zglozik@opentsa.org) for the OpenSSL project * 2002, 2003, 2004. */ /* ==================================================================== * Copyright (c) 2006 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * licensing@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_TS_H # define HEADER_TS_H # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # ifndef OPENSSL_NO_BUFFER # include <openssl/buffer.h> # endif # ifndef OPENSSL_NO_EVP # include <openssl/evp.h> # endif # ifndef OPENSSL_NO_BIO # include <openssl/bio.h> # endif # include <openssl/stack.h> # include <openssl/asn1.h> # include <openssl/safestack.h> # ifndef OPENSSL_NO_RSA # include <openssl/rsa.h> # endif # ifndef OPENSSL_NO_DSA # include <openssl/dsa.h> # endif # ifndef OPENSSL_NO_DH # include <openssl/dh.h> # endif #ifdef __cplusplus extern "C" { #endif # ifdef WIN32 /* Under Win32 this is defined in wincrypt.h */ # undef X509_NAME # endif # include <openssl/x509.h> # include <openssl/x509v3.h> /*- MessageImprint ::= SEQUENCE { hashAlgorithm AlgorithmIdentifier, hashedMessage OCTET STRING } */ typedef struct TS_msg_imprint_st { X509_ALGOR *hash_algo; ASN1_OCTET_STRING *hashed_msg; } TS_MSG_IMPRINT; /*- TimeStampReq ::= SEQUENCE { version INTEGER { v1(1) }, messageImprint MessageImprint, --a hash algorithm OID and the hash value of the data to be --time-stamped reqPolicy TSAPolicyId OPTIONAL, nonce INTEGER OPTIONAL, certReq BOOLEAN DEFAULT FALSE, extensions [0] IMPLICIT Extensions OPTIONAL } */ typedef struct TS_req_st { ASN1_INTEGER *version; TS_MSG_IMPRINT *msg_imprint; ASN1_OBJECT *policy_id; /* OPTIONAL */ ASN1_INTEGER *nonce; /* OPTIONAL */ ASN1_BOOLEAN cert_req; /* DEFAULT FALSE */ STACK_OF(X509_EXTENSION) *extensions; /* [0] OPTIONAL */ } TS_REQ; /*- Accuracy ::= SEQUENCE { seconds INTEGER OPTIONAL, millis [0] INTEGER (1..999) OPTIONAL, micros [1] INTEGER (1..999) OPTIONAL } */ typedef struct TS_accuracy_st { ASN1_INTEGER *seconds; ASN1_INTEGER *millis; ASN1_INTEGER *micros; } TS_ACCURACY; /*- TSTInfo ::= SEQUENCE { version INTEGER { v1(1) }, policy TSAPolicyId, messageImprint MessageImprint, -- MUST have the same value as the similar field in -- TimeStampReq serialNumber INTEGER, -- Time-Stamping users MUST be ready to accommodate integers -- up to 160 bits. genTime GeneralizedTime, accuracy Accuracy OPTIONAL, ordering BOOLEAN DEFAULT FALSE, nonce INTEGER OPTIONAL, -- MUST be present if the similar field was present -- in TimeStampReq. In that case it MUST have the same value. tsa [0] GeneralName OPTIONAL, extensions [1] IMPLICIT Extensions OPTIONAL } */ typedef struct TS_tst_info_st { ASN1_INTEGER *version; ASN1_OBJECT *policy_id; TS_MSG_IMPRINT *msg_imprint; ASN1_INTEGER *serial; ASN1_GENERALIZEDTIME *time; TS_ACCURACY *accuracy; ASN1_BOOLEAN ordering; ASN1_INTEGER *nonce; GENERAL_NAME *tsa; STACK_OF(X509_EXTENSION) *extensions; } TS_TST_INFO; /*- PKIStatusInfo ::= SEQUENCE { status PKIStatus, statusString PKIFreeText OPTIONAL, failInfo PKIFailureInfo OPTIONAL } From RFC 1510 - section 3.1.1: PKIFreeText ::= SEQUENCE SIZE (1..MAX) OF UTF8String -- text encoded as UTF-8 String (note: each UTF8String SHOULD -- include an RFC 1766 language tag to indicate the language -- of the contained text) */ /* Possible values for status. See ts_resp_print.c && ts_resp_verify.c. */ # define TS_STATUS_GRANTED 0 # define TS_STATUS_GRANTED_WITH_MODS 1 # define TS_STATUS_REJECTION 2 # define TS_STATUS_WAITING 3 # define TS_STATUS_REVOCATION_WARNING 4 # define TS_STATUS_REVOCATION_NOTIFICATION 5 /* * Possible values for failure_info. See ts_resp_print.c && ts_resp_verify.c */ # define TS_INFO_BAD_ALG 0 # define TS_INFO_BAD_REQUEST 2 # define TS_INFO_BAD_DATA_FORMAT 5 # define TS_INFO_TIME_NOT_AVAILABLE 14 # define TS_INFO_UNACCEPTED_POLICY 15 # define TS_INFO_UNACCEPTED_EXTENSION 16 # define TS_INFO_ADD_INFO_NOT_AVAILABLE 17 # define TS_INFO_SYSTEM_FAILURE 25 typedef struct TS_status_info_st { ASN1_INTEGER *status; STACK_OF(ASN1_UTF8STRING) *text; ASN1_BIT_STRING *failure_info; } TS_STATUS_INFO; DECLARE_STACK_OF(ASN1_UTF8STRING) DECLARE_ASN1_SET_OF(ASN1_UTF8STRING) /*- TimeStampResp ::= SEQUENCE { status PKIStatusInfo, timeStampToken TimeStampToken OPTIONAL } */ typedef struct TS_resp_st { TS_STATUS_INFO *status_info; PKCS7 *token; TS_TST_INFO *tst_info; } TS_RESP; /* The structure below would belong to the ESS component. */ /*- IssuerSerial ::= SEQUENCE { issuer GeneralNames, serialNumber CertificateSerialNumber } */ typedef struct ESS_issuer_serial { STACK_OF(GENERAL_NAME) *issuer; ASN1_INTEGER *serial; } ESS_ISSUER_SERIAL; /*- ESSCertID ::= SEQUENCE { certHash Hash, issuerSerial IssuerSerial OPTIONAL } */ typedef struct ESS_cert_id { ASN1_OCTET_STRING *hash; /* Always SHA-1 digest. */ ESS_ISSUER_SERIAL *issuer_serial; } ESS_CERT_ID; DECLARE_STACK_OF(ESS_CERT_ID) DECLARE_ASN1_SET_OF(ESS_CERT_ID) /*- SigningCertificate ::= SEQUENCE { certs SEQUENCE OF ESSCertID, policies SEQUENCE OF PolicyInformation OPTIONAL } */ typedef struct ESS_signing_cert { STACK_OF(ESS_CERT_ID) *cert_ids; STACK_OF(POLICYINFO) *policy_info; } ESS_SIGNING_CERT; TS_REQ *TS_REQ_new(void); void TS_REQ_free(TS_REQ *a); int i2d_TS_REQ(const TS_REQ *a, unsigned char **pp); TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length); TS_REQ *TS_REQ_dup(TS_REQ *a); TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a); int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a); TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a); int i2d_TS_REQ_bio(BIO *fp, TS_REQ *a); TS_MSG_IMPRINT *TS_MSG_IMPRINT_new(void); void TS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a); int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp); TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a, const unsigned char **pp, long length); TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a); TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a); int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a); TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT **a); int i2d_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT *a); TS_RESP *TS_RESP_new(void); void TS_RESP_free(TS_RESP *a); int i2d_TS_RESP(const TS_RESP *a, unsigned char **pp); TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length); TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token); TS_RESP *TS_RESP_dup(TS_RESP *a); TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a); int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a); TS_RESP *d2i_TS_RESP_bio(BIO *fp, TS_RESP **a); int i2d_TS_RESP_bio(BIO *fp, TS_RESP *a); TS_STATUS_INFO *TS_STATUS_INFO_new(void); void TS_STATUS_INFO_free(TS_STATUS_INFO *a); int i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp); TS_STATUS_INFO *d2i_TS_STATUS_INFO(TS_STATUS_INFO **a, const unsigned char **pp, long length); TS_STATUS_INFO *TS_STATUS_INFO_dup(TS_STATUS_INFO *a); TS_TST_INFO *TS_TST_INFO_new(void); void TS_TST_INFO_free(TS_TST_INFO *a); int i2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **pp); TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp, long length); TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a); TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a); int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a); TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO **a); int i2d_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO *a); TS_ACCURACY *TS_ACCURACY_new(void); void TS_ACCURACY_free(TS_ACCURACY *a); int i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp); TS_ACCURACY *d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp, long length); TS_ACCURACY *TS_ACCURACY_dup(TS_ACCURACY *a); ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void); void ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a); int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a, unsigned char **pp); ESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a, const unsigned char **pp, long length); ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a); ESS_CERT_ID *ESS_CERT_ID_new(void); void ESS_CERT_ID_free(ESS_CERT_ID *a); int i2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **pp); ESS_CERT_ID *d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **pp, long length); ESS_CERT_ID *ESS_CERT_ID_dup(ESS_CERT_ID *a); ESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void); void ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a); int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a, unsigned char **pp); ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a, const unsigned char **pp, long length); ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a); void ERR_load_TS_strings(void); int TS_REQ_set_version(TS_REQ *a, long version); long TS_REQ_get_version(const TS_REQ *a); int TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint); TS_MSG_IMPRINT *TS_REQ_get_msg_imprint(TS_REQ *a); int TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg); X509_ALGOR *TS_MSG_IMPRINT_get_algo(TS_MSG_IMPRINT *a); int TS_MSG_IMPRINT_set_msg(TS_MSG_IMPRINT *a, unsigned char *d, int len); ASN1_OCTET_STRING *TS_MSG_IMPRINT_get_msg(TS_MSG_IMPRINT *a); int TS_REQ_set_policy_id(TS_REQ *a, ASN1_OBJECT *policy); ASN1_OBJECT *TS_REQ_get_policy_id(TS_REQ *a); int TS_REQ_set_nonce(TS_REQ *a, const ASN1_INTEGER *nonce); const ASN1_INTEGER *TS_REQ_get_nonce(const TS_REQ *a); int TS_REQ_set_cert_req(TS_REQ *a, int cert_req); int TS_REQ_get_cert_req(const TS_REQ *a); STACK_OF(X509_EXTENSION) *TS_REQ_get_exts(TS_REQ *a); void TS_REQ_ext_free(TS_REQ *a); int TS_REQ_get_ext_count(TS_REQ *a); int TS_REQ_get_ext_by_NID(TS_REQ *a, int nid, int lastpos); int TS_REQ_get_ext_by_OBJ(TS_REQ *a, ASN1_OBJECT *obj, int lastpos); int TS_REQ_get_ext_by_critical(TS_REQ *a, int crit, int lastpos); X509_EXTENSION *TS_REQ_get_ext(TS_REQ *a, int loc); X509_EXTENSION *TS_REQ_delete_ext(TS_REQ *a, int loc); int TS_REQ_add_ext(TS_REQ *a, X509_EXTENSION *ex, int loc); void *TS_REQ_get_ext_d2i(TS_REQ *a, int nid, int *crit, int *idx); /* Function declarations for TS_REQ defined in ts/ts_req_print.c */ int TS_REQ_print_bio(BIO *bio, TS_REQ *a); /* Function declarations for TS_RESP defined in ts/ts_resp_utils.c */ int TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *info); TS_STATUS_INFO *TS_RESP_get_status_info(TS_RESP *a); /* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */ void TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info); PKCS7 *TS_RESP_get_token(TS_RESP *a); TS_TST_INFO *TS_RESP_get_tst_info(TS_RESP *a); int TS_TST_INFO_set_version(TS_TST_INFO *a, long version); long TS_TST_INFO_get_version(const TS_TST_INFO *a); int TS_TST_INFO_set_policy_id(TS_TST_INFO *a, ASN1_OBJECT *policy_id); ASN1_OBJECT *TS_TST_INFO_get_policy_id(TS_TST_INFO *a); int TS_TST_INFO_set_msg_imprint(TS_TST_INFO *a, TS_MSG_IMPRINT *msg_imprint); TS_MSG_IMPRINT *TS_TST_INFO_get_msg_imprint(TS_TST_INFO *a); int TS_TST_INFO_set_serial(TS_TST_INFO *a, const ASN1_INTEGER *serial); const ASN1_INTEGER *TS_TST_INFO_get_serial(const TS_TST_INFO *a); int TS_TST_INFO_set_time(TS_TST_INFO *a, const ASN1_GENERALIZEDTIME *gtime); const ASN1_GENERALIZEDTIME *TS_TST_INFO_get_time(const TS_TST_INFO *a); int TS_TST_INFO_set_accuracy(TS_TST_INFO *a, TS_ACCURACY *accuracy); TS_ACCURACY *TS_TST_INFO_get_accuracy(TS_TST_INFO *a); int TS_ACCURACY_set_seconds(TS_ACCURACY *a, const ASN1_INTEGER *seconds); const ASN1_INTEGER *TS_ACCURACY_get_seconds(const TS_ACCURACY *a); int TS_ACCURACY_set_millis(TS_ACCURACY *a, const ASN1_INTEGER *millis); const ASN1_INTEGER *TS_ACCURACY_get_millis(const TS_ACCURACY *a); int TS_ACCURACY_set_micros(TS_ACCURACY *a, const ASN1_INTEGER *micros); const ASN1_INTEGER *TS_ACCURACY_get_micros(const TS_ACCURACY *a); int TS_TST_INFO_set_ordering(TS_TST_INFO *a, int ordering); int TS_TST_INFO_get_ordering(const TS_TST_INFO *a); int TS_TST_INFO_set_nonce(TS_TST_INFO *a, const ASN1_INTEGER *nonce); const ASN1_INTEGER *TS_TST_INFO_get_nonce(const TS_TST_INFO *a); int TS_TST_INFO_set_tsa(TS_TST_INFO *a, GENERAL_NAME *tsa); GENERAL_NAME *TS_TST_INFO_get_tsa(TS_TST_INFO *a); STACK_OF(X509_EXTENSION) *TS_TST_INFO_get_exts(TS_TST_INFO *a); void TS_TST_INFO_ext_free(TS_TST_INFO *a); int TS_TST_INFO_get_ext_count(TS_TST_INFO *a); int TS_TST_INFO_get_ext_by_NID(TS_TST_INFO *a, int nid, int lastpos); int TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO *a, ASN1_OBJECT *obj, int lastpos); int TS_TST_INFO_get_ext_by_critical(TS_TST_INFO *a, int crit, int lastpos); X509_EXTENSION *TS_TST_INFO_get_ext(TS_TST_INFO *a, int loc); X509_EXTENSION *TS_TST_INFO_delete_ext(TS_TST_INFO *a, int loc); int TS_TST_INFO_add_ext(TS_TST_INFO *a, X509_EXTENSION *ex, int loc); void *TS_TST_INFO_get_ext_d2i(TS_TST_INFO *a, int nid, int *crit, int *idx); /* * Declarations related to response generation, defined in ts/ts_resp_sign.c. */ /* Optional flags for response generation. */ /* Don't include the TSA name in response. */ # define TS_TSA_NAME 0x01 /* Set ordering to true in response. */ # define TS_ORDERING 0x02 /* * Include the signer certificate and the other specified certificates in * the ESS signing certificate attribute beside the PKCS7 signed data. * Only the signer certificates is included by default. */ # define TS_ESS_CERT_ID_CHAIN 0x04 /* Forward declaration. */ struct TS_resp_ctx; /* This must return a unique number less than 160 bits long. */ typedef ASN1_INTEGER *(*TS_serial_cb) (struct TS_resp_ctx *, void *); /* * This must return the seconds and microseconds since Jan 1, 1970 in the sec * and usec variables allocated by the caller. Return non-zero for success * and zero for failure. */ typedef int (*TS_time_cb) (struct TS_resp_ctx *, void *, long *sec, long *usec); /* * This must process the given extension. It can modify the TS_TST_INFO * object of the context. Return values: !0 (processed), 0 (error, it must * set the status info/failure info of the response). */ typedef int (*TS_extension_cb) (struct TS_resp_ctx *, X509_EXTENSION *, void *); typedef struct TS_resp_ctx { X509 *signer_cert; EVP_PKEY *signer_key; STACK_OF(X509) *certs; /* Certs to include in signed data. */ STACK_OF(ASN1_OBJECT) *policies; /* Acceptable policies. */ ASN1_OBJECT *default_policy; /* It may appear in policies, too. */ STACK_OF(EVP_MD) *mds; /* Acceptable message digests. */ ASN1_INTEGER *seconds; /* accuracy, 0 means not specified. */ ASN1_INTEGER *millis; /* accuracy, 0 means not specified. */ ASN1_INTEGER *micros; /* accuracy, 0 means not specified. */ unsigned clock_precision_digits; /* fraction of seconds in time stamp * token. */ unsigned flags; /* Optional info, see values above. */ /* Callback functions. */ TS_serial_cb serial_cb; void *serial_cb_data; /* User data for serial_cb. */ TS_time_cb time_cb; void *time_cb_data; /* User data for time_cb. */ TS_extension_cb extension_cb; void *extension_cb_data; /* User data for extension_cb. */ /* These members are used only while creating the response. */ TS_REQ *request; TS_RESP *response; TS_TST_INFO *tst_info; } TS_RESP_CTX; DECLARE_STACK_OF(EVP_MD) DECLARE_ASN1_SET_OF(EVP_MD) /* Creates a response context that can be used for generating responses. */ TS_RESP_CTX *TS_RESP_CTX_new(void); void TS_RESP_CTX_free(TS_RESP_CTX *ctx); /* This parameter must be set. */ int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer); /* This parameter must be set. */ int TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key); /* This parameter must be set. */ int TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *def_policy); /* No additional certs are included in the response by default. */ int TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs); /* * Adds a new acceptable policy, only the default policy is accepted by * default. */ int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *policy); /* * Adds a new acceptable message digest. Note that no message digests are * accepted by default. The md argument is shared with the caller. */ int TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md); /* Accuracy is not included by default. */ int TS_RESP_CTX_set_accuracy(TS_RESP_CTX *ctx, int secs, int millis, int micros); /* * Clock precision digits, i.e. the number of decimal digits: '0' means sec, * '3' msec, '6' usec, and so on. Default is 0. */ int TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx, unsigned clock_precision_digits); /* At most we accept usec precision. */ # define TS_MAX_CLOCK_PRECISION_DIGITS 6 /* Maximum status message length */ # define TS_MAX_STATUS_LENGTH (1024 * 1024) /* No flags are set by default. */ void TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags); /* Default callback always returns a constant. */ void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data); /* Default callback uses the gettimeofday() and gmtime() system calls. */ void TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data); /* * Default callback rejects all extensions. The extension callback is called * when the TS_TST_INFO object is already set up and not signed yet. */ /* FIXME: extension handling is not tested yet. */ void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx, TS_extension_cb cb, void *data); /* The following methods can be used in the callbacks. */ int TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx, int status, const char *text); /* Sets the status info only if it is still TS_STATUS_GRANTED. */ int TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx, int status, const char *text); int TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure); /* The get methods below can be used in the extension callback. */ TS_REQ *TS_RESP_CTX_get_request(TS_RESP_CTX *ctx); TS_TST_INFO *TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx); /* * Creates the signed TS_TST_INFO and puts it in TS_RESP. * In case of errors it sets the status info properly. * Returns NULL only in case of memory allocation/fatal error. */ TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio); /* * Declarations related to response verification, * they are defined in ts/ts_resp_verify.c. */ int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs, X509_STORE *store, X509 **signer_out); /* Context structure for the generic verify method. */ /* Verify the signer's certificate and the signature of the response. */ # define TS_VFY_SIGNATURE (1u << 0) /* Verify the version number of the response. */ # define TS_VFY_VERSION (1u << 1) /* Verify if the policy supplied by the user matches the policy of the TSA. */ # define TS_VFY_POLICY (1u << 2) /* * Verify the message imprint provided by the user. This flag should not be * specified with TS_VFY_DATA. */ # define TS_VFY_IMPRINT (1u << 3) /* * Verify the message imprint computed by the verify method from the user * provided data and the MD algorithm of the response. This flag should not * be specified with TS_VFY_IMPRINT. */ # define TS_VFY_DATA (1u << 4) /* Verify the nonce value. */ # define TS_VFY_NONCE (1u << 5) /* Verify if the TSA name field matches the signer certificate. */ # define TS_VFY_SIGNER (1u << 6) /* Verify if the TSA name field equals to the user provided name. */ # define TS_VFY_TSA_NAME (1u << 7) /* You can use the following convenience constants. */ # define TS_VFY_ALL_IMPRINT (TS_VFY_SIGNATURE \ | TS_VFY_VERSION \ | TS_VFY_POLICY \ | TS_VFY_IMPRINT \ | TS_VFY_NONCE \ | TS_VFY_SIGNER \ | TS_VFY_TSA_NAME) # define TS_VFY_ALL_DATA (TS_VFY_SIGNATURE \ | TS_VFY_VERSION \ | TS_VFY_POLICY \ | TS_VFY_DATA \ | TS_VFY_NONCE \ | TS_VFY_SIGNER \ | TS_VFY_TSA_NAME) typedef struct TS_verify_ctx { /* Set this to the union of TS_VFY_... flags you want to carry out. */ unsigned flags; /* Must be set only with TS_VFY_SIGNATURE. certs is optional. */ X509_STORE *store; STACK_OF(X509) *certs; /* Must be set only with TS_VFY_POLICY. */ ASN1_OBJECT *policy; /* * Must be set only with TS_VFY_IMPRINT. If md_alg is NULL, the * algorithm from the response is used. */ X509_ALGOR *md_alg; unsigned char *imprint; unsigned imprint_len; /* Must be set only with TS_VFY_DATA. */ BIO *data; /* Must be set only with TS_VFY_TSA_NAME. */ ASN1_INTEGER *nonce; /* Must be set only with TS_VFY_TSA_NAME. */ GENERAL_NAME *tsa_name; } TS_VERIFY_CTX; int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response); int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token); /* * Declarations related to response verification context, * they are defined in ts/ts_verify_ctx.c. */ /* Set all fields to zero. */ TS_VERIFY_CTX *TS_VERIFY_CTX_new(void); void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx); void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx); void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx); /*- * If ctx is NULL, it allocates and returns a new object, otherwise * it returns ctx. It initialises all the members as follows: * flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE) * certs = NULL * store = NULL * policy = policy from the request or NULL if absent (in this case * TS_VFY_POLICY is cleared from flags as well) * md_alg = MD algorithm from request * imprint, imprint_len = imprint from request * data = NULL * nonce, nonce_len = nonce from the request or NULL if absent (in this case * TS_VFY_NONCE is cleared from flags as well) * tsa_name = NULL * Important: after calling this method TS_VFY_SIGNATURE should be added! */ TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx); /* Function declarations for TS_RESP defined in ts/ts_resp_print.c */ int TS_RESP_print_bio(BIO *bio, TS_RESP *a); int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a); int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a); /* Common utility functions defined in ts/ts_lib.c */ int TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num); int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj); int TS_ext_print_bio(BIO *bio, const STACK_OF(X509_EXTENSION) *extensions); int TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg); int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg); /* * Function declarations for handling configuration options, defined in * ts/ts_conf.c */ X509 *TS_CONF_load_cert(const char *file); STACK_OF(X509) *TS_CONF_load_certs(const char *file); EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass); const char *TS_CONF_get_tsa_section(CONF *conf, const char *section); int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb, TS_RESP_CTX *ctx); int TS_CONF_set_crypto_device(CONF *conf, const char *section, const char *device); int TS_CONF_set_default_engine(const char *name); int TS_CONF_set_signer_cert(CONF *conf, const char *section, const char *cert, TS_RESP_CTX *ctx); int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs, TS_RESP_CTX *ctx); int TS_CONF_set_signer_key(CONF *conf, const char *section, const char *key, const char *pass, TS_RESP_CTX *ctx); int TS_CONF_set_def_policy(CONF *conf, const char *section, const char *policy, TS_RESP_CTX *ctx); int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx); int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx); int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx); int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section, TS_RESP_CTX *ctx); int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx); int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx); int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section, TS_RESP_CTX *ctx); /* -------------------------------------------------- */ /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_TS_strings(void); /* Error codes for the TS functions. */ /* Function codes. */ # define TS_F_D2I_TS_RESP 147 # define TS_F_DEF_SERIAL_CB 110 # define TS_F_DEF_TIME_CB 111 # define TS_F_ESS_ADD_SIGNING_CERT 112 # define TS_F_ESS_CERT_ID_NEW_INIT 113 # define TS_F_ESS_SIGNING_CERT_NEW_INIT 114 # define TS_F_INT_TS_RESP_VERIFY_TOKEN 149 # define TS_F_PKCS7_TO_TS_TST_INFO 148 # define TS_F_TS_ACCURACY_SET_MICROS 115 # define TS_F_TS_ACCURACY_SET_MILLIS 116 # define TS_F_TS_ACCURACY_SET_SECONDS 117 # define TS_F_TS_CHECK_IMPRINTS 100 # define TS_F_TS_CHECK_NONCES 101 # define TS_F_TS_CHECK_POLICY 102 # define TS_F_TS_CHECK_SIGNING_CERTS 103 # define TS_F_TS_CHECK_STATUS_INFO 104 # define TS_F_TS_COMPUTE_IMPRINT 145 # define TS_F_TS_CONF_SET_DEFAULT_ENGINE 146 # define TS_F_TS_GET_STATUS_TEXT 105 # define TS_F_TS_MSG_IMPRINT_SET_ALGO 118 # define TS_F_TS_REQ_SET_MSG_IMPRINT 119 # define TS_F_TS_REQ_SET_NONCE 120 # define TS_F_TS_REQ_SET_POLICY_ID 121 # define TS_F_TS_RESP_CREATE_RESPONSE 122 # define TS_F_TS_RESP_CREATE_TST_INFO 123 # define TS_F_TS_RESP_CTX_ADD_FAILURE_INFO 124 # define TS_F_TS_RESP_CTX_ADD_MD 125 # define TS_F_TS_RESP_CTX_ADD_POLICY 126 # define TS_F_TS_RESP_CTX_NEW 127 # define TS_F_TS_RESP_CTX_SET_ACCURACY 128 # define TS_F_TS_RESP_CTX_SET_CERTS 129 # define TS_F_TS_RESP_CTX_SET_DEF_POLICY 130 # define TS_F_TS_RESP_CTX_SET_SIGNER_CERT 131 # define TS_F_TS_RESP_CTX_SET_STATUS_INFO 132 # define TS_F_TS_RESP_GET_POLICY 133 # define TS_F_TS_RESP_SET_GENTIME_WITH_PRECISION 134 # define TS_F_TS_RESP_SET_STATUS_INFO 135 # define TS_F_TS_RESP_SET_TST_INFO 150 # define TS_F_TS_RESP_SIGN 136 # define TS_F_TS_RESP_VERIFY_SIGNATURE 106 # define TS_F_TS_RESP_VERIFY_TOKEN 107 # define TS_F_TS_TST_INFO_SET_ACCURACY 137 # define TS_F_TS_TST_INFO_SET_MSG_IMPRINT 138 # define TS_F_TS_TST_INFO_SET_NONCE 139 # define TS_F_TS_TST_INFO_SET_POLICY_ID 140 # define TS_F_TS_TST_INFO_SET_SERIAL 141 # define TS_F_TS_TST_INFO_SET_TIME 142 # define TS_F_TS_TST_INFO_SET_TSA 143 # define TS_F_TS_VERIFY 108 # define TS_F_TS_VERIFY_CERT 109 # define TS_F_TS_VERIFY_CTX_NEW 144 /* Reason codes. */ # define TS_R_BAD_PKCS7_TYPE 132 # define TS_R_BAD_TYPE 133 # define TS_R_CERTIFICATE_VERIFY_ERROR 100 # define TS_R_COULD_NOT_SET_ENGINE 127 # define TS_R_COULD_NOT_SET_TIME 115 # define TS_R_D2I_TS_RESP_INT_FAILED 128 # define TS_R_DETACHED_CONTENT 134 # define TS_R_ESS_ADD_SIGNING_CERT_ERROR 116 # define TS_R_ESS_SIGNING_CERTIFICATE_ERROR 101 # define TS_R_INVALID_NULL_POINTER 102 # define TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE 117 # define TS_R_MESSAGE_IMPRINT_MISMATCH 103 # define TS_R_NONCE_MISMATCH 104 # define TS_R_NONCE_NOT_RETURNED 105 # define TS_R_NO_CONTENT 106 # define TS_R_NO_TIME_STAMP_TOKEN 107 # define TS_R_PKCS7_ADD_SIGNATURE_ERROR 118 # define TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR 119 # define TS_R_PKCS7_TO_TS_TST_INFO_FAILED 129 # define TS_R_POLICY_MISMATCH 108 # define TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 120 # define TS_R_RESPONSE_SETUP_ERROR 121 # define TS_R_SIGNATURE_FAILURE 109 # define TS_R_THERE_MUST_BE_ONE_SIGNER 110 # define TS_R_TIME_SYSCALL_ERROR 122 # define TS_R_TOKEN_NOT_PRESENT 130 # define TS_R_TOKEN_PRESENT 131 # define TS_R_TSA_NAME_MISMATCH 111 # define TS_R_TSA_UNTRUSTED 112 # define TS_R_TST_INFO_SETUP_ERROR 123 # define TS_R_TS_DATASIGN 124 # define TS_R_UNACCEPTABLE_POLICY 125 # define TS_R_UNSUPPORTED_MD_ALGORITHM 126 # define TS_R_UNSUPPORTED_VERSION 113 # define TS_R_WRONG_CONTENT_TYPE 114 #ifdef __cplusplus } #endif #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/fips_rand.h���������������������������������������������������������������������������������0000644�����������������00000016237�14763166030�0010364 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ==================================================================== * Copyright (c) 2003 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef HEADER_FIPS_RAND_H # define HEADER_FIPS_RAND_H # include <openssl/aes.h> # include <openssl/evp.h> # include <openssl/hmac.h> # include <openssl/rand.h> # ifdef OPENSSL_FIPS # ifdef __cplusplus extern "C" { # endif int FIPS_x931_set_key(const unsigned char *key, int keylen); int FIPS_x931_seed(const void *buf, int num); int FIPS_x931_bytes(unsigned char *out, int outlen); int FIPS_x931_test_mode(void); void FIPS_x931_reset(void); int FIPS_x931_set_dt(unsigned char *dt); int FIPS_x931_status(void); const RAND_METHOD *FIPS_x931_method(void); typedef struct drbg_ctx_st DRBG_CTX; /* DRBG external flags */ /* Flag for CTR mode only: use derivation function ctr_df */ # define DRBG_FLAG_CTR_USE_DF 0x1 /* PRNG is in test state */ # define DRBG_FLAG_TEST 0x2 DRBG_CTX *FIPS_drbg_new(int type, unsigned int flags); int FIPS_drbg_init(DRBG_CTX *dctx, int type, unsigned int flags); int FIPS_drbg_instantiate(DRBG_CTX *dctx, const unsigned char *pers, size_t perslen); int FIPS_drbg_reseed(DRBG_CTX *dctx, const unsigned char *adin, size_t adinlen); void FIPS_drbg_set_reseed(DRBG_CTX *dctx); int FIPS_drbg_generate(DRBG_CTX *dctx, unsigned char *out, size_t outlen, int prediction_resistance, const unsigned char *adin, size_t adinlen); int FIPS_drbg_uninstantiate(DRBG_CTX *dctx); void FIPS_drbg_free(DRBG_CTX *dctx); int FIPS_drbg_set_callbacks(DRBG_CTX *dctx, size_t (*get_entropy) (DRBG_CTX *ctx, unsigned char **pout, int entropy, size_t min_len, size_t max_len), void (*cleanup_entropy) (DRBG_CTX *ctx, unsigned char *out, size_t olen), size_t entropy_blocklen, size_t (*get_nonce) (DRBG_CTX *ctx, unsigned char **pout, int entropy, size_t min_len, size_t max_len), void (*cleanup_nonce) (DRBG_CTX *ctx, unsigned char *out, size_t olen)); int FIPS_drbg_set_rand_callbacks(DRBG_CTX *dctx, size_t (*get_adin) (DRBG_CTX *ctx, unsigned char **pout), void (*cleanup_adin) (DRBG_CTX *ctx, unsigned char *out, size_t olen), int (*rand_seed_cb) (DRBG_CTX *ctx, const void *buf, int num), int (*rand_add_cb) (DRBG_CTX *ctx, const void *buf, int num, double entropy)); void *FIPS_drbg_get_app_data(DRBG_CTX *ctx); void FIPS_drbg_set_app_data(DRBG_CTX *ctx, void *app_data); size_t FIPS_drbg_get_blocklength(DRBG_CTX *dctx); int FIPS_drbg_get_strength(DRBG_CTX *dctx); void FIPS_drbg_set_check_interval(DRBG_CTX *dctx, int interval); void FIPS_drbg_set_reseed_interval(DRBG_CTX *dctx, int interval); int FIPS_drbg_health_check(DRBG_CTX *dctx); DRBG_CTX *FIPS_get_default_drbg(void); const RAND_METHOD *FIPS_drbg_method(void); int FIPS_rand_set_method(const RAND_METHOD *meth); const RAND_METHOD *FIPS_rand_get_method(void); void FIPS_rand_set_bits(int nbits); int FIPS_rand_strength(void); /* 1.0.0 compat functions */ int FIPS_rand_set_key(const unsigned char *key, FIPS_RAND_SIZE_T keylen); int FIPS_rand_seed(const void *buf, FIPS_RAND_SIZE_T num); int FIPS_rand_bytes(unsigned char *out, FIPS_RAND_SIZE_T outlen); int FIPS_rand_test_mode(void); void FIPS_rand_reset(void); int FIPS_rand_set_dt(unsigned char *dt); int FIPS_rand_status(void); const RAND_METHOD *FIPS_rand_method(void); # ifdef __cplusplus } # endif # endif #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/md4.h���������������������������������������������������������������������������������������0000644�����������������00000011262�14763166030�0007074 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/md4/md4.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_MD4_H # define HEADER_MD4_H # include <openssl/e_os2.h> # include <stddef.h> #ifdef __cplusplus extern "C" { #endif # ifdef OPENSSL_NO_MD4 # error MD4 is disabled. # endif /*- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * ! MD4_LONG has to be at least 32 bits wide. If it's wider, then ! * ! MD4_LONG_LOG2 has to be defined along. ! * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ # if defined(__LP32__) # define MD4_LONG unsigned long # elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) # define MD4_LONG unsigned long # define MD4_LONG_LOG2 3 /* * _CRAY note. I could declare short, but I have no idea what impact * does it have on performance on none-T3E machines. I could declare * int, but at least on C90 sizeof(int) can be chosen at compile time. * So I've chosen long... * <appro@fy.chalmers.se> */ # else # define MD4_LONG unsigned int # endif # define MD4_CBLOCK 64 # define MD4_LBLOCK (MD4_CBLOCK/4) # define MD4_DIGEST_LENGTH 16 typedef struct MD4state_st { MD4_LONG A, B, C, D; MD4_LONG Nl, Nh; MD4_LONG data[MD4_LBLOCK]; unsigned int num; } MD4_CTX; # ifdef OPENSSL_FIPS int private_MD4_Init(MD4_CTX *c); # endif int MD4_Init(MD4_CTX *c); int MD4_Update(MD4_CTX *c, const void *data, size_t len); int MD4_Final(unsigned char *md, MD4_CTX *c); unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md); void MD4_Transform(MD4_CTX *c, const unsigned char *b); #ifdef __cplusplus } #endif #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/txt_db.h������������������������������������������������������������������������������������0000644�����������������00000011027�14763166030�0007673 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/txt_db/txt_db.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_TXT_DB_H # define HEADER_TXT_DB_H # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_BIO # include <openssl/bio.h> # endif # include <openssl/stack.h> # include <openssl/lhash.h> # define DB_ERROR_OK 0 # define DB_ERROR_MALLOC 1 # define DB_ERROR_INDEX_CLASH 2 # define DB_ERROR_INDEX_OUT_OF_RANGE 3 # define DB_ERROR_NO_INDEX 4 # define DB_ERROR_INSERT_INDEX_CLASH 5 #ifdef __cplusplus extern "C" { #endif typedef OPENSSL_STRING *OPENSSL_PSTRING; DECLARE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) typedef struct txt_db_st { int num_fields; STACK_OF(OPENSSL_PSTRING) *data; LHASH_OF(OPENSSL_STRING) **index; int (**qual) (OPENSSL_STRING *); long error; long arg1; long arg2; OPENSSL_STRING *arg_row; } TXT_DB; # ifndef OPENSSL_NO_BIO TXT_DB *TXT_DB_read(BIO *in, int num); long TXT_DB_write(BIO *out, TXT_DB *db); # else TXT_DB *TXT_DB_read(char *in, int num); long TXT_DB_write(char *out, TXT_DB *db); # endif int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *), LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp); void TXT_DB_free(TXT_DB *db); OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, OPENSSL_STRING *value); int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value); #ifdef __cplusplus } #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/cmac.h��������������������������������������������������������������������������������������0000644�����������������00000006271�14763166030�0007317 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/cmac/cmac.h */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ /* ==================================================================== * Copyright (c) 2010 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * licensing@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== */ #ifndef HEADER_CMAC_H # define HEADER_CMAC_H #ifdef __cplusplus extern "C" { #endif # include <openssl/evp.h> /* Opaque */ typedef struct CMAC_CTX_st CMAC_CTX; CMAC_CTX *CMAC_CTX_new(void); void CMAC_CTX_cleanup(CMAC_CTX *ctx); void CMAC_CTX_free(CMAC_CTX *ctx); EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, const EVP_CIPHER *cipher, ENGINE *impl); int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); int CMAC_resume(CMAC_CTX *ctx); #ifdef __cplusplus } #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/obj_mac.h�����������������������������������������������������������������������������������0000644�����������������00000527051�14763166030�0010012 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/objects/obj_mac.h */ /* * THIS FILE IS GENERATED FROM objects.txt by objects.pl via the following * command: perl objects.pl objects.txt obj_mac.num obj_mac.h */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #define SN_undef "UNDEF" #define LN_undef "undefined" #define NID_undef 0 #define OBJ_undef 0L #define SN_itu_t "ITU-T" #define LN_itu_t "itu-t" #define NID_itu_t 645 #define OBJ_itu_t 0L #define NID_ccitt 404 #define OBJ_ccitt OBJ_itu_t #define SN_iso "ISO" #define LN_iso "iso" #define NID_iso 181 #define OBJ_iso 1L #define SN_joint_iso_itu_t "JOINT-ISO-ITU-T" #define LN_joint_iso_itu_t "joint-iso-itu-t" #define NID_joint_iso_itu_t 646 #define OBJ_joint_iso_itu_t 2L #define NID_joint_iso_ccitt 393 #define OBJ_joint_iso_ccitt OBJ_joint_iso_itu_t #define SN_member_body "member-body" #define LN_member_body "ISO Member Body" #define NID_member_body 182 #define OBJ_member_body OBJ_iso,2L #define SN_identified_organization "identified-organization" #define NID_identified_organization 676 #define OBJ_identified_organization OBJ_iso,3L #define SN_hmac_md5 "HMAC-MD5" #define LN_hmac_md5 "hmac-md5" #define NID_hmac_md5 780 #define OBJ_hmac_md5 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,1L #define SN_hmac_sha1 "HMAC-SHA1" #define LN_hmac_sha1 "hmac-sha1" #define NID_hmac_sha1 781 #define OBJ_hmac_sha1 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,2L #define SN_certicom_arc "certicom-arc" #define NID_certicom_arc 677 #define OBJ_certicom_arc OBJ_identified_organization,132L #define SN_international_organizations "international-organizations" #define LN_international_organizations "International Organizations" #define NID_international_organizations 647 #define OBJ_international_organizations OBJ_joint_iso_itu_t,23L #define SN_wap "wap" #define NID_wap 678 #define OBJ_wap OBJ_international_organizations,43L #define SN_wap_wsg "wap-wsg" #define NID_wap_wsg 679 #define OBJ_wap_wsg OBJ_wap,1L #define SN_selected_attribute_types "selected-attribute-types" #define LN_selected_attribute_types "Selected Attribute Types" #define NID_selected_attribute_types 394 #define OBJ_selected_attribute_types OBJ_joint_iso_itu_t,5L,1L,5L #define SN_clearance "clearance" #define NID_clearance 395 #define OBJ_clearance OBJ_selected_attribute_types,55L #define SN_ISO_US "ISO-US" #define LN_ISO_US "ISO US Member Body" #define NID_ISO_US 183 #define OBJ_ISO_US OBJ_member_body,840L #define SN_X9_57 "X9-57" #define LN_X9_57 "X9.57" #define NID_X9_57 184 #define OBJ_X9_57 OBJ_ISO_US,10040L #define SN_X9cm "X9cm" #define LN_X9cm "X9.57 CM ?" #define NID_X9cm 185 #define OBJ_X9cm OBJ_X9_57,4L #define SN_dsa "DSA" #define LN_dsa "dsaEncryption" #define NID_dsa 116 #define OBJ_dsa OBJ_X9cm,1L #define SN_dsaWithSHA1 "DSA-SHA1" #define LN_dsaWithSHA1 "dsaWithSHA1" #define NID_dsaWithSHA1 113 #define OBJ_dsaWithSHA1 OBJ_X9cm,3L #define SN_ansi_X9_62 "ansi-X9-62" #define LN_ansi_X9_62 "ANSI X9.62" #define NID_ansi_X9_62 405 #define OBJ_ansi_X9_62 OBJ_ISO_US,10045L #define OBJ_X9_62_id_fieldType OBJ_ansi_X9_62,1L #define SN_X9_62_prime_field "prime-field" #define NID_X9_62_prime_field 406 #define OBJ_X9_62_prime_field OBJ_X9_62_id_fieldType,1L #define SN_X9_62_characteristic_two_field "characteristic-two-field" #define NID_X9_62_characteristic_two_field 407 #define OBJ_X9_62_characteristic_two_field OBJ_X9_62_id_fieldType,2L #define SN_X9_62_id_characteristic_two_basis "id-characteristic-two-basis" #define NID_X9_62_id_characteristic_two_basis 680 #define OBJ_X9_62_id_characteristic_two_basis OBJ_X9_62_characteristic_two_field,3L #define SN_X9_62_onBasis "onBasis" #define NID_X9_62_onBasis 681 #define OBJ_X9_62_onBasis OBJ_X9_62_id_characteristic_two_basis,1L #define SN_X9_62_tpBasis "tpBasis" #define NID_X9_62_tpBasis 682 #define OBJ_X9_62_tpBasis OBJ_X9_62_id_characteristic_two_basis,2L #define SN_X9_62_ppBasis "ppBasis" #define NID_X9_62_ppBasis 683 #define OBJ_X9_62_ppBasis OBJ_X9_62_id_characteristic_two_basis,3L #define OBJ_X9_62_id_publicKeyType OBJ_ansi_X9_62,2L #define SN_X9_62_id_ecPublicKey "id-ecPublicKey" #define NID_X9_62_id_ecPublicKey 408 #define OBJ_X9_62_id_ecPublicKey OBJ_X9_62_id_publicKeyType,1L #define OBJ_X9_62_ellipticCurve OBJ_ansi_X9_62,3L #define OBJ_X9_62_c_TwoCurve OBJ_X9_62_ellipticCurve,0L #define SN_X9_62_c2pnb163v1 "c2pnb163v1" #define NID_X9_62_c2pnb163v1 684 #define OBJ_X9_62_c2pnb163v1 OBJ_X9_62_c_TwoCurve,1L #define SN_X9_62_c2pnb163v2 "c2pnb163v2" #define NID_X9_62_c2pnb163v2 685 #define OBJ_X9_62_c2pnb163v2 OBJ_X9_62_c_TwoCurve,2L #define SN_X9_62_c2pnb163v3 "c2pnb163v3" #define NID_X9_62_c2pnb163v3 686 #define OBJ_X9_62_c2pnb163v3 OBJ_X9_62_c_TwoCurve,3L #define SN_X9_62_c2pnb176v1 "c2pnb176v1" #define NID_X9_62_c2pnb176v1 687 #define OBJ_X9_62_c2pnb176v1 OBJ_X9_62_c_TwoCurve,4L #define SN_X9_62_c2tnb191v1 "c2tnb191v1" #define NID_X9_62_c2tnb191v1 688 #define OBJ_X9_62_c2tnb191v1 OBJ_X9_62_c_TwoCurve,5L #define SN_X9_62_c2tnb191v2 "c2tnb191v2" #define NID_X9_62_c2tnb191v2 689 #define OBJ_X9_62_c2tnb191v2 OBJ_X9_62_c_TwoCurve,6L #define SN_X9_62_c2tnb191v3 "c2tnb191v3" #define NID_X9_62_c2tnb191v3 690 #define OBJ_X9_62_c2tnb191v3 OBJ_X9_62_c_TwoCurve,7L #define SN_X9_62_c2onb191v4 "c2onb191v4" #define NID_X9_62_c2onb191v4 691 #define OBJ_X9_62_c2onb191v4 OBJ_X9_62_c_TwoCurve,8L #define SN_X9_62_c2onb191v5 "c2onb191v5" #define NID_X9_62_c2onb191v5 692 #define OBJ_X9_62_c2onb191v5 OBJ_X9_62_c_TwoCurve,9L #define SN_X9_62_c2pnb208w1 "c2pnb208w1" #define NID_X9_62_c2pnb208w1 693 #define OBJ_X9_62_c2pnb208w1 OBJ_X9_62_c_TwoCurve,10L #define SN_X9_62_c2tnb239v1 "c2tnb239v1" #define NID_X9_62_c2tnb239v1 694 #define OBJ_X9_62_c2tnb239v1 OBJ_X9_62_c_TwoCurve,11L #define SN_X9_62_c2tnb239v2 "c2tnb239v2" #define NID_X9_62_c2tnb239v2 695 #define OBJ_X9_62_c2tnb239v2 OBJ_X9_62_c_TwoCurve,12L #define SN_X9_62_c2tnb239v3 "c2tnb239v3" #define NID_X9_62_c2tnb239v3 696 #define OBJ_X9_62_c2tnb239v3 OBJ_X9_62_c_TwoCurve,13L #define SN_X9_62_c2onb239v4 "c2onb239v4" #define NID_X9_62_c2onb239v4 697 #define OBJ_X9_62_c2onb239v4 OBJ_X9_62_c_TwoCurve,14L #define SN_X9_62_c2onb239v5 "c2onb239v5" #define NID_X9_62_c2onb239v5 698 #define OBJ_X9_62_c2onb239v5 OBJ_X9_62_c_TwoCurve,15L #define SN_X9_62_c2pnb272w1 "c2pnb272w1" #define NID_X9_62_c2pnb272w1 699 #define OBJ_X9_62_c2pnb272w1 OBJ_X9_62_c_TwoCurve,16L #define SN_X9_62_c2pnb304w1 "c2pnb304w1" #define NID_X9_62_c2pnb304w1 700 #define OBJ_X9_62_c2pnb304w1 OBJ_X9_62_c_TwoCurve,17L #define SN_X9_62_c2tnb359v1 "c2tnb359v1" #define NID_X9_62_c2tnb359v1 701 #define OBJ_X9_62_c2tnb359v1 OBJ_X9_62_c_TwoCurve,18L #define SN_X9_62_c2pnb368w1 "c2pnb368w1" #define NID_X9_62_c2pnb368w1 702 #define OBJ_X9_62_c2pnb368w1 OBJ_X9_62_c_TwoCurve,19L #define SN_X9_62_c2tnb431r1 "c2tnb431r1" #define NID_X9_62_c2tnb431r1 703 #define OBJ_X9_62_c2tnb431r1 OBJ_X9_62_c_TwoCurve,20L #define OBJ_X9_62_primeCurve OBJ_X9_62_ellipticCurve,1L #define SN_X9_62_prime192v1 "prime192v1" #define NID_X9_62_prime192v1 409 #define OBJ_X9_62_prime192v1 OBJ_X9_62_primeCurve,1L #define SN_X9_62_prime192v2 "prime192v2" #define NID_X9_62_prime192v2 410 #define OBJ_X9_62_prime192v2 OBJ_X9_62_primeCurve,2L #define SN_X9_62_prime192v3 "prime192v3" #define NID_X9_62_prime192v3 411 #define OBJ_X9_62_prime192v3 OBJ_X9_62_primeCurve,3L #define SN_X9_62_prime239v1 "prime239v1" #define NID_X9_62_prime239v1 412 #define OBJ_X9_62_prime239v1 OBJ_X9_62_primeCurve,4L #define SN_X9_62_prime239v2 "prime239v2" #define NID_X9_62_prime239v2 413 #define OBJ_X9_62_prime239v2 OBJ_X9_62_primeCurve,5L #define SN_X9_62_prime239v3 "prime239v3" #define NID_X9_62_prime239v3 414 #define OBJ_X9_62_prime239v3 OBJ_X9_62_primeCurve,6L #define SN_X9_62_prime256v1 "prime256v1" #define NID_X9_62_prime256v1 415 #define OBJ_X9_62_prime256v1 OBJ_X9_62_primeCurve,7L #define OBJ_X9_62_id_ecSigType OBJ_ansi_X9_62,4L #define SN_ecdsa_with_SHA1 "ecdsa-with-SHA1" #define NID_ecdsa_with_SHA1 416 #define OBJ_ecdsa_with_SHA1 OBJ_X9_62_id_ecSigType,1L #define SN_ecdsa_with_Recommended "ecdsa-with-Recommended" #define NID_ecdsa_with_Recommended 791 #define OBJ_ecdsa_with_Recommended OBJ_X9_62_id_ecSigType,2L #define SN_ecdsa_with_Specified "ecdsa-with-Specified" #define NID_ecdsa_with_Specified 792 #define OBJ_ecdsa_with_Specified OBJ_X9_62_id_ecSigType,3L #define SN_ecdsa_with_SHA224 "ecdsa-with-SHA224" #define NID_ecdsa_with_SHA224 793 #define OBJ_ecdsa_with_SHA224 OBJ_ecdsa_with_Specified,1L #define SN_ecdsa_with_SHA256 "ecdsa-with-SHA256" #define NID_ecdsa_with_SHA256 794 #define OBJ_ecdsa_with_SHA256 OBJ_ecdsa_with_Specified,2L #define SN_ecdsa_with_SHA384 "ecdsa-with-SHA384" #define NID_ecdsa_with_SHA384 795 #define OBJ_ecdsa_with_SHA384 OBJ_ecdsa_with_Specified,3L #define SN_ecdsa_with_SHA512 "ecdsa-with-SHA512" #define NID_ecdsa_with_SHA512 796 #define OBJ_ecdsa_with_SHA512 OBJ_ecdsa_with_Specified,4L #define OBJ_secg_ellipticCurve OBJ_certicom_arc,0L #define SN_secp112r1 "secp112r1" #define NID_secp112r1 704 #define OBJ_secp112r1 OBJ_secg_ellipticCurve,6L #define SN_secp112r2 "secp112r2" #define NID_secp112r2 705 #define OBJ_secp112r2 OBJ_secg_ellipticCurve,7L #define SN_secp128r1 "secp128r1" #define NID_secp128r1 706 #define OBJ_secp128r1 OBJ_secg_ellipticCurve,28L #define SN_secp128r2 "secp128r2" #define NID_secp128r2 707 #define OBJ_secp128r2 OBJ_secg_ellipticCurve,29L #define SN_secp160k1 "secp160k1" #define NID_secp160k1 708 #define OBJ_secp160k1 OBJ_secg_ellipticCurve,9L #define SN_secp160r1 "secp160r1" #define NID_secp160r1 709 #define OBJ_secp160r1 OBJ_secg_ellipticCurve,8L #define SN_secp160r2 "secp160r2" #define NID_secp160r2 710 #define OBJ_secp160r2 OBJ_secg_ellipticCurve,30L #define SN_secp192k1 "secp192k1" #define NID_secp192k1 711 #define OBJ_secp192k1 OBJ_secg_ellipticCurve,31L #define SN_secp224k1 "secp224k1" #define NID_secp224k1 712 #define OBJ_secp224k1 OBJ_secg_ellipticCurve,32L #define SN_secp224r1 "secp224r1" #define NID_secp224r1 713 #define OBJ_secp224r1 OBJ_secg_ellipticCurve,33L #define SN_secp256k1 "secp256k1" #define NID_secp256k1 714 #define OBJ_secp256k1 OBJ_secg_ellipticCurve,10L #define SN_secp384r1 "secp384r1" #define NID_secp384r1 715 #define OBJ_secp384r1 OBJ_secg_ellipticCurve,34L #define SN_secp521r1 "secp521r1" #define NID_secp521r1 716 #define OBJ_secp521r1 OBJ_secg_ellipticCurve,35L #define SN_sect113r1 "sect113r1" #define NID_sect113r1 717 #define OBJ_sect113r1 OBJ_secg_ellipticCurve,4L #define SN_sect113r2 "sect113r2" #define NID_sect113r2 718 #define OBJ_sect113r2 OBJ_secg_ellipticCurve,5L #define SN_sect131r1 "sect131r1" #define NID_sect131r1 719 #define OBJ_sect131r1 OBJ_secg_ellipticCurve,22L #define SN_sect131r2 "sect131r2" #define NID_sect131r2 720 #define OBJ_sect131r2 OBJ_secg_ellipticCurve,23L #define SN_sect163k1 "sect163k1" #define NID_sect163k1 721 #define OBJ_sect163k1 OBJ_secg_ellipticCurve,1L #define SN_sect163r1 "sect163r1" #define NID_sect163r1 722 #define OBJ_sect163r1 OBJ_secg_ellipticCurve,2L #define SN_sect163r2 "sect163r2" #define NID_sect163r2 723 #define OBJ_sect163r2 OBJ_secg_ellipticCurve,15L #define SN_sect193r1 "sect193r1" #define NID_sect193r1 724 #define OBJ_sect193r1 OBJ_secg_ellipticCurve,24L #define SN_sect193r2 "sect193r2" #define NID_sect193r2 725 #define OBJ_sect193r2 OBJ_secg_ellipticCurve,25L #define SN_sect233k1 "sect233k1" #define NID_sect233k1 726 #define OBJ_sect233k1 OBJ_secg_ellipticCurve,26L #define SN_sect233r1 "sect233r1" #define NID_sect233r1 727 #define OBJ_sect233r1 OBJ_secg_ellipticCurve,27L #define SN_sect239k1 "sect239k1" #define NID_sect239k1 728 #define OBJ_sect239k1 OBJ_secg_ellipticCurve,3L #define SN_sect283k1 "sect283k1" #define NID_sect283k1 729 #define OBJ_sect283k1 OBJ_secg_ellipticCurve,16L #define SN_sect283r1 "sect283r1" #define NID_sect283r1 730 #define OBJ_sect283r1 OBJ_secg_ellipticCurve,17L #define SN_sect409k1 "sect409k1" #define NID_sect409k1 731 #define OBJ_sect409k1 OBJ_secg_ellipticCurve,36L #define SN_sect409r1 "sect409r1" #define NID_sect409r1 732 #define OBJ_sect409r1 OBJ_secg_ellipticCurve,37L #define SN_sect571k1 "sect571k1" #define NID_sect571k1 733 #define OBJ_sect571k1 OBJ_secg_ellipticCurve,38L #define SN_sect571r1 "sect571r1" #define NID_sect571r1 734 #define OBJ_sect571r1 OBJ_secg_ellipticCurve,39L #define OBJ_wap_wsg_idm_ecid OBJ_wap_wsg,4L #define SN_wap_wsg_idm_ecid_wtls1 "wap-wsg-idm-ecid-wtls1" #define NID_wap_wsg_idm_ecid_wtls1 735 #define OBJ_wap_wsg_idm_ecid_wtls1 OBJ_wap_wsg_idm_ecid,1L #define SN_wap_wsg_idm_ecid_wtls3 "wap-wsg-idm-ecid-wtls3" #define NID_wap_wsg_idm_ecid_wtls3 736 #define OBJ_wap_wsg_idm_ecid_wtls3 OBJ_wap_wsg_idm_ecid,3L #define SN_wap_wsg_idm_ecid_wtls4 "wap-wsg-idm-ecid-wtls4" #define NID_wap_wsg_idm_ecid_wtls4 737 #define OBJ_wap_wsg_idm_ecid_wtls4 OBJ_wap_wsg_idm_ecid,4L #define SN_wap_wsg_idm_ecid_wtls5 "wap-wsg-idm-ecid-wtls5" #define NID_wap_wsg_idm_ecid_wtls5 738 #define OBJ_wap_wsg_idm_ecid_wtls5 OBJ_wap_wsg_idm_ecid,5L #define SN_wap_wsg_idm_ecid_wtls6 "wap-wsg-idm-ecid-wtls6" #define NID_wap_wsg_idm_ecid_wtls6 739 #define OBJ_wap_wsg_idm_ecid_wtls6 OBJ_wap_wsg_idm_ecid,6L #define SN_wap_wsg_idm_ecid_wtls7 "wap-wsg-idm-ecid-wtls7" #define NID_wap_wsg_idm_ecid_wtls7 740 #define OBJ_wap_wsg_idm_ecid_wtls7 OBJ_wap_wsg_idm_ecid,7L #define SN_wap_wsg_idm_ecid_wtls8 "wap-wsg-idm-ecid-wtls8" #define NID_wap_wsg_idm_ecid_wtls8 741 #define OBJ_wap_wsg_idm_ecid_wtls8 OBJ_wap_wsg_idm_ecid,8L #define SN_wap_wsg_idm_ecid_wtls9 "wap-wsg-idm-ecid-wtls9" #define NID_wap_wsg_idm_ecid_wtls9 742 #define OBJ_wap_wsg_idm_ecid_wtls9 OBJ_wap_wsg_idm_ecid,9L #define SN_wap_wsg_idm_ecid_wtls10 "wap-wsg-idm-ecid-wtls10" #define NID_wap_wsg_idm_ecid_wtls10 743 #define OBJ_wap_wsg_idm_ecid_wtls10 OBJ_wap_wsg_idm_ecid,10L #define SN_wap_wsg_idm_ecid_wtls11 "wap-wsg-idm-ecid-wtls11" #define NID_wap_wsg_idm_ecid_wtls11 744 #define OBJ_wap_wsg_idm_ecid_wtls11 OBJ_wap_wsg_idm_ecid,11L #define SN_wap_wsg_idm_ecid_wtls12 "wap-wsg-idm-ecid-wtls12" #define NID_wap_wsg_idm_ecid_wtls12 745 #define OBJ_wap_wsg_idm_ecid_wtls12 OBJ_wap_wsg_idm_ecid,12L #define SN_cast5_cbc "CAST5-CBC" #define LN_cast5_cbc "cast5-cbc" #define NID_cast5_cbc 108 #define OBJ_cast5_cbc OBJ_ISO_US,113533L,7L,66L,10L #define SN_cast5_ecb "CAST5-ECB" #define LN_cast5_ecb "cast5-ecb" #define NID_cast5_ecb 109 #define SN_cast5_cfb64 "CAST5-CFB" #define LN_cast5_cfb64 "cast5-cfb" #define NID_cast5_cfb64 110 #define SN_cast5_ofb64 "CAST5-OFB" #define LN_cast5_ofb64 "cast5-ofb" #define NID_cast5_ofb64 111 #define LN_pbeWithMD5AndCast5_CBC "pbeWithMD5AndCast5CBC" #define NID_pbeWithMD5AndCast5_CBC 112 #define OBJ_pbeWithMD5AndCast5_CBC OBJ_ISO_US,113533L,7L,66L,12L #define SN_id_PasswordBasedMAC "id-PasswordBasedMAC" #define LN_id_PasswordBasedMAC "password based MAC" #define NID_id_PasswordBasedMAC 782 #define OBJ_id_PasswordBasedMAC OBJ_ISO_US,113533L,7L,66L,13L #define SN_id_DHBasedMac "id-DHBasedMac" #define LN_id_DHBasedMac "Diffie-Hellman based MAC" #define NID_id_DHBasedMac 783 #define OBJ_id_DHBasedMac OBJ_ISO_US,113533L,7L,66L,30L #define SN_rsadsi "rsadsi" #define LN_rsadsi "RSA Data Security, Inc." #define NID_rsadsi 1 #define OBJ_rsadsi OBJ_ISO_US,113549L #define SN_pkcs "pkcs" #define LN_pkcs "RSA Data Security, Inc. PKCS" #define NID_pkcs 2 #define OBJ_pkcs OBJ_rsadsi,1L #define SN_pkcs1 "pkcs1" #define NID_pkcs1 186 #define OBJ_pkcs1 OBJ_pkcs,1L #define LN_rsaEncryption "rsaEncryption" #define NID_rsaEncryption 6 #define OBJ_rsaEncryption OBJ_pkcs1,1L #define SN_md2WithRSAEncryption "RSA-MD2" #define LN_md2WithRSAEncryption "md2WithRSAEncryption" #define NID_md2WithRSAEncryption 7 #define OBJ_md2WithRSAEncryption OBJ_pkcs1,2L #define SN_md4WithRSAEncryption "RSA-MD4" #define LN_md4WithRSAEncryption "md4WithRSAEncryption" #define NID_md4WithRSAEncryption 396 #define OBJ_md4WithRSAEncryption OBJ_pkcs1,3L #define SN_md5WithRSAEncryption "RSA-MD5" #define LN_md5WithRSAEncryption "md5WithRSAEncryption" #define NID_md5WithRSAEncryption 8 #define OBJ_md5WithRSAEncryption OBJ_pkcs1,4L #define SN_sha1WithRSAEncryption "RSA-SHA1" #define LN_sha1WithRSAEncryption "sha1WithRSAEncryption" #define NID_sha1WithRSAEncryption 65 #define OBJ_sha1WithRSAEncryption OBJ_pkcs1,5L #define SN_rsaesOaep "RSAES-OAEP" #define LN_rsaesOaep "rsaesOaep" #define NID_rsaesOaep 919 #define OBJ_rsaesOaep OBJ_pkcs1,7L #define SN_mgf1 "MGF1" #define LN_mgf1 "mgf1" #define NID_mgf1 911 #define OBJ_mgf1 OBJ_pkcs1,8L #define SN_pSpecified "PSPECIFIED" #define LN_pSpecified "pSpecified" #define NID_pSpecified 935 #define OBJ_pSpecified OBJ_pkcs1,9L #define SN_rsassaPss "RSASSA-PSS" #define LN_rsassaPss "rsassaPss" #define NID_rsassaPss 912 #define OBJ_rsassaPss OBJ_pkcs1,10L #define SN_sha256WithRSAEncryption "RSA-SHA256" #define LN_sha256WithRSAEncryption "sha256WithRSAEncryption" #define NID_sha256WithRSAEncryption 668 #define OBJ_sha256WithRSAEncryption OBJ_pkcs1,11L #define SN_sha384WithRSAEncryption "RSA-SHA384" #define LN_sha384WithRSAEncryption "sha384WithRSAEncryption" #define NID_sha384WithRSAEncryption 669 #define OBJ_sha384WithRSAEncryption OBJ_pkcs1,12L #define SN_sha512WithRSAEncryption "RSA-SHA512" #define LN_sha512WithRSAEncryption "sha512WithRSAEncryption" #define NID_sha512WithRSAEncryption 670 #define OBJ_sha512WithRSAEncryption OBJ_pkcs1,13L #define SN_sha224WithRSAEncryption "RSA-SHA224" #define LN_sha224WithRSAEncryption "sha224WithRSAEncryption" #define NID_sha224WithRSAEncryption 671 #define OBJ_sha224WithRSAEncryption OBJ_pkcs1,14L #define SN_pkcs3 "pkcs3" #define NID_pkcs3 27 #define OBJ_pkcs3 OBJ_pkcs,3L #define LN_dhKeyAgreement "dhKeyAgreement" #define NID_dhKeyAgreement 28 #define OBJ_dhKeyAgreement OBJ_pkcs3,1L #define SN_pkcs5 "pkcs5" #define NID_pkcs5 187 #define OBJ_pkcs5 OBJ_pkcs,5L #define SN_pbeWithMD2AndDES_CBC "PBE-MD2-DES" #define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" #define NID_pbeWithMD2AndDES_CBC 9 #define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs5,1L #define SN_pbeWithMD5AndDES_CBC "PBE-MD5-DES" #define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" #define NID_pbeWithMD5AndDES_CBC 10 #define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs5,3L #define SN_pbeWithMD2AndRC2_CBC "PBE-MD2-RC2-64" #define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" #define NID_pbeWithMD2AndRC2_CBC 168 #define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs5,4L #define SN_pbeWithMD5AndRC2_CBC "PBE-MD5-RC2-64" #define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" #define NID_pbeWithMD5AndRC2_CBC 169 #define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs5,6L #define SN_pbeWithSHA1AndDES_CBC "PBE-SHA1-DES" #define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" #define NID_pbeWithSHA1AndDES_CBC 170 #define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs5,10L #define SN_pbeWithSHA1AndRC2_CBC "PBE-SHA1-RC2-64" #define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" #define NID_pbeWithSHA1AndRC2_CBC 68 #define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs5,11L #define LN_id_pbkdf2 "PBKDF2" #define NID_id_pbkdf2 69 #define OBJ_id_pbkdf2 OBJ_pkcs5,12L #define LN_pbes2 "PBES2" #define NID_pbes2 161 #define OBJ_pbes2 OBJ_pkcs5,13L #define LN_pbmac1 "PBMAC1" #define NID_pbmac1 162 #define OBJ_pbmac1 OBJ_pkcs5,14L #define SN_pkcs7 "pkcs7" #define NID_pkcs7 20 #define OBJ_pkcs7 OBJ_pkcs,7L #define LN_pkcs7_data "pkcs7-data" #define NID_pkcs7_data 21 #define OBJ_pkcs7_data OBJ_pkcs7,1L #define LN_pkcs7_signed "pkcs7-signedData" #define NID_pkcs7_signed 22 #define OBJ_pkcs7_signed OBJ_pkcs7,2L #define LN_pkcs7_enveloped "pkcs7-envelopedData" #define NID_pkcs7_enveloped 23 #define OBJ_pkcs7_enveloped OBJ_pkcs7,3L #define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData" #define NID_pkcs7_signedAndEnveloped 24 #define OBJ_pkcs7_signedAndEnveloped OBJ_pkcs7,4L #define LN_pkcs7_digest "pkcs7-digestData" #define NID_pkcs7_digest 25 #define OBJ_pkcs7_digest OBJ_pkcs7,5L #define LN_pkcs7_encrypted "pkcs7-encryptedData" #define NID_pkcs7_encrypted 26 #define OBJ_pkcs7_encrypted OBJ_pkcs7,6L #define SN_pkcs9 "pkcs9" #define NID_pkcs9 47 #define OBJ_pkcs9 OBJ_pkcs,9L #define LN_pkcs9_emailAddress "emailAddress" #define NID_pkcs9_emailAddress 48 #define OBJ_pkcs9_emailAddress OBJ_pkcs9,1L #define LN_pkcs9_unstructuredName "unstructuredName" #define NID_pkcs9_unstructuredName 49 #define OBJ_pkcs9_unstructuredName OBJ_pkcs9,2L #define LN_pkcs9_contentType "contentType" #define NID_pkcs9_contentType 50 #define OBJ_pkcs9_contentType OBJ_pkcs9,3L #define LN_pkcs9_messageDigest "messageDigest" #define NID_pkcs9_messageDigest 51 #define OBJ_pkcs9_messageDigest OBJ_pkcs9,4L #define LN_pkcs9_signingTime "signingTime" #define NID_pkcs9_signingTime 52 #define OBJ_pkcs9_signingTime OBJ_pkcs9,5L #define LN_pkcs9_countersignature "countersignature" #define NID_pkcs9_countersignature 53 #define OBJ_pkcs9_countersignature OBJ_pkcs9,6L #define LN_pkcs9_challengePassword "challengePassword" #define NID_pkcs9_challengePassword 54 #define OBJ_pkcs9_challengePassword OBJ_pkcs9,7L #define LN_pkcs9_unstructuredAddress "unstructuredAddress" #define NID_pkcs9_unstructuredAddress 55 #define OBJ_pkcs9_unstructuredAddress OBJ_pkcs9,8L #define LN_pkcs9_extCertAttributes "extendedCertificateAttributes" #define NID_pkcs9_extCertAttributes 56 #define OBJ_pkcs9_extCertAttributes OBJ_pkcs9,9L #define SN_ext_req "extReq" #define LN_ext_req "Extension Request" #define NID_ext_req 172 #define OBJ_ext_req OBJ_pkcs9,14L #define SN_SMIMECapabilities "SMIME-CAPS" #define LN_SMIMECapabilities "S/MIME Capabilities" #define NID_SMIMECapabilities 167 #define OBJ_SMIMECapabilities OBJ_pkcs9,15L #define SN_SMIME "SMIME" #define LN_SMIME "S/MIME" #define NID_SMIME 188 #define OBJ_SMIME OBJ_pkcs9,16L #define SN_id_smime_mod "id-smime-mod" #define NID_id_smime_mod 189 #define OBJ_id_smime_mod OBJ_SMIME,0L #define SN_id_smime_ct "id-smime-ct" #define NID_id_smime_ct 190 #define OBJ_id_smime_ct OBJ_SMIME,1L #define SN_id_smime_aa "id-smime-aa" #define NID_id_smime_aa 191 #define OBJ_id_smime_aa OBJ_SMIME,2L #define SN_id_smime_alg "id-smime-alg" #define NID_id_smime_alg 192 #define OBJ_id_smime_alg OBJ_SMIME,3L #define SN_id_smime_cd "id-smime-cd" #define NID_id_smime_cd 193 #define OBJ_id_smime_cd OBJ_SMIME,4L #define SN_id_smime_spq "id-smime-spq" #define NID_id_smime_spq 194 #define OBJ_id_smime_spq OBJ_SMIME,5L #define SN_id_smime_cti "id-smime-cti" #define NID_id_smime_cti 195 #define OBJ_id_smime_cti OBJ_SMIME,6L #define SN_id_smime_mod_cms "id-smime-mod-cms" #define NID_id_smime_mod_cms 196 #define OBJ_id_smime_mod_cms OBJ_id_smime_mod,1L #define SN_id_smime_mod_ess "id-smime-mod-ess" #define NID_id_smime_mod_ess 197 #define OBJ_id_smime_mod_ess OBJ_id_smime_mod,2L #define SN_id_smime_mod_oid "id-smime-mod-oid" #define NID_id_smime_mod_oid 198 #define OBJ_id_smime_mod_oid OBJ_id_smime_mod,3L #define SN_id_smime_mod_msg_v3 "id-smime-mod-msg-v3" #define NID_id_smime_mod_msg_v3 199 #define OBJ_id_smime_mod_msg_v3 OBJ_id_smime_mod,4L #define SN_id_smime_mod_ets_eSignature_88 "id-smime-mod-ets-eSignature-88" #define NID_id_smime_mod_ets_eSignature_88 200 #define OBJ_id_smime_mod_ets_eSignature_88 OBJ_id_smime_mod,5L #define SN_id_smime_mod_ets_eSignature_97 "id-smime-mod-ets-eSignature-97" #define NID_id_smime_mod_ets_eSignature_97 201 #define OBJ_id_smime_mod_ets_eSignature_97 OBJ_id_smime_mod,6L #define SN_id_smime_mod_ets_eSigPolicy_88 "id-smime-mod-ets-eSigPolicy-88" #define NID_id_smime_mod_ets_eSigPolicy_88 202 #define OBJ_id_smime_mod_ets_eSigPolicy_88 OBJ_id_smime_mod,7L #define SN_id_smime_mod_ets_eSigPolicy_97 "id-smime-mod-ets-eSigPolicy-97" #define NID_id_smime_mod_ets_eSigPolicy_97 203 #define OBJ_id_smime_mod_ets_eSigPolicy_97 OBJ_id_smime_mod,8L #define SN_id_smime_ct_receipt "id-smime-ct-receipt" #define NID_id_smime_ct_receipt 204 #define OBJ_id_smime_ct_receipt OBJ_id_smime_ct,1L #define SN_id_smime_ct_authData "id-smime-ct-authData" #define NID_id_smime_ct_authData 205 #define OBJ_id_smime_ct_authData OBJ_id_smime_ct,2L #define SN_id_smime_ct_publishCert "id-smime-ct-publishCert" #define NID_id_smime_ct_publishCert 206 #define OBJ_id_smime_ct_publishCert OBJ_id_smime_ct,3L #define SN_id_smime_ct_TSTInfo "id-smime-ct-TSTInfo" #define NID_id_smime_ct_TSTInfo 207 #define OBJ_id_smime_ct_TSTInfo OBJ_id_smime_ct,4L #define SN_id_smime_ct_TDTInfo "id-smime-ct-TDTInfo" #define NID_id_smime_ct_TDTInfo 208 #define OBJ_id_smime_ct_TDTInfo OBJ_id_smime_ct,5L #define SN_id_smime_ct_contentInfo "id-smime-ct-contentInfo" #define NID_id_smime_ct_contentInfo 209 #define OBJ_id_smime_ct_contentInfo OBJ_id_smime_ct,6L #define SN_id_smime_ct_DVCSRequestData "id-smime-ct-DVCSRequestData" #define NID_id_smime_ct_DVCSRequestData 210 #define OBJ_id_smime_ct_DVCSRequestData OBJ_id_smime_ct,7L #define SN_id_smime_ct_DVCSResponseData "id-smime-ct-DVCSResponseData" #define NID_id_smime_ct_DVCSResponseData 211 #define OBJ_id_smime_ct_DVCSResponseData OBJ_id_smime_ct,8L #define SN_id_smime_ct_compressedData "id-smime-ct-compressedData" #define NID_id_smime_ct_compressedData 786 #define OBJ_id_smime_ct_compressedData OBJ_id_smime_ct,9L #define SN_id_ct_asciiTextWithCRLF "id-ct-asciiTextWithCRLF" #define NID_id_ct_asciiTextWithCRLF 787 #define OBJ_id_ct_asciiTextWithCRLF OBJ_id_smime_ct,27L #define SN_id_smime_aa_receiptRequest "id-smime-aa-receiptRequest" #define NID_id_smime_aa_receiptRequest 212 #define OBJ_id_smime_aa_receiptRequest OBJ_id_smime_aa,1L #define SN_id_smime_aa_securityLabel "id-smime-aa-securityLabel" #define NID_id_smime_aa_securityLabel 213 #define OBJ_id_smime_aa_securityLabel OBJ_id_smime_aa,2L #define SN_id_smime_aa_mlExpandHistory "id-smime-aa-mlExpandHistory" #define NID_id_smime_aa_mlExpandHistory 214 #define OBJ_id_smime_aa_mlExpandHistory OBJ_id_smime_aa,3L #define SN_id_smime_aa_contentHint "id-smime-aa-contentHint" #define NID_id_smime_aa_contentHint 215 #define OBJ_id_smime_aa_contentHint OBJ_id_smime_aa,4L #define SN_id_smime_aa_msgSigDigest "id-smime-aa-msgSigDigest" #define NID_id_smime_aa_msgSigDigest 216 #define OBJ_id_smime_aa_msgSigDigest OBJ_id_smime_aa,5L #define SN_id_smime_aa_encapContentType "id-smime-aa-encapContentType" #define NID_id_smime_aa_encapContentType 217 #define OBJ_id_smime_aa_encapContentType OBJ_id_smime_aa,6L #define SN_id_smime_aa_contentIdentifier "id-smime-aa-contentIdentifier" #define NID_id_smime_aa_contentIdentifier 218 #define OBJ_id_smime_aa_contentIdentifier OBJ_id_smime_aa,7L #define SN_id_smime_aa_macValue "id-smime-aa-macValue" #define NID_id_smime_aa_macValue 219 #define OBJ_id_smime_aa_macValue OBJ_id_smime_aa,8L #define SN_id_smime_aa_equivalentLabels "id-smime-aa-equivalentLabels" #define NID_id_smime_aa_equivalentLabels 220 #define OBJ_id_smime_aa_equivalentLabels OBJ_id_smime_aa,9L #define SN_id_smime_aa_contentReference "id-smime-aa-contentReference" #define NID_id_smime_aa_contentReference 221 #define OBJ_id_smime_aa_contentReference OBJ_id_smime_aa,10L #define SN_id_smime_aa_encrypKeyPref "id-smime-aa-encrypKeyPref" #define NID_id_smime_aa_encrypKeyPref 222 #define OBJ_id_smime_aa_encrypKeyPref OBJ_id_smime_aa,11L #define SN_id_smime_aa_signingCertificate "id-smime-aa-signingCertificate" #define NID_id_smime_aa_signingCertificate 223 #define OBJ_id_smime_aa_signingCertificate OBJ_id_smime_aa,12L #define SN_id_smime_aa_smimeEncryptCerts "id-smime-aa-smimeEncryptCerts" #define NID_id_smime_aa_smimeEncryptCerts 224 #define OBJ_id_smime_aa_smimeEncryptCerts OBJ_id_smime_aa,13L #define SN_id_smime_aa_timeStampToken "id-smime-aa-timeStampToken" #define NID_id_smime_aa_timeStampToken 225 #define OBJ_id_smime_aa_timeStampToken OBJ_id_smime_aa,14L #define SN_id_smime_aa_ets_sigPolicyId "id-smime-aa-ets-sigPolicyId" #define NID_id_smime_aa_ets_sigPolicyId 226 #define OBJ_id_smime_aa_ets_sigPolicyId OBJ_id_smime_aa,15L #define SN_id_smime_aa_ets_commitmentType "id-smime-aa-ets-commitmentType" #define NID_id_smime_aa_ets_commitmentType 227 #define OBJ_id_smime_aa_ets_commitmentType OBJ_id_smime_aa,16L #define SN_id_smime_aa_ets_signerLocation "id-smime-aa-ets-signerLocation" #define NID_id_smime_aa_ets_signerLocation 228 #define OBJ_id_smime_aa_ets_signerLocation OBJ_id_smime_aa,17L #define SN_id_smime_aa_ets_signerAttr "id-smime-aa-ets-signerAttr" #define NID_id_smime_aa_ets_signerAttr 229 #define OBJ_id_smime_aa_ets_signerAttr OBJ_id_smime_aa,18L #define SN_id_smime_aa_ets_otherSigCert "id-smime-aa-ets-otherSigCert" #define NID_id_smime_aa_ets_otherSigCert 230 #define OBJ_id_smime_aa_ets_otherSigCert OBJ_id_smime_aa,19L #define SN_id_smime_aa_ets_contentTimestamp "id-smime-aa-ets-contentTimestamp" #define NID_id_smime_aa_ets_contentTimestamp 231 #define OBJ_id_smime_aa_ets_contentTimestamp OBJ_id_smime_aa,20L #define SN_id_smime_aa_ets_CertificateRefs "id-smime-aa-ets-CertificateRefs" #define NID_id_smime_aa_ets_CertificateRefs 232 #define OBJ_id_smime_aa_ets_CertificateRefs OBJ_id_smime_aa,21L #define SN_id_smime_aa_ets_RevocationRefs "id-smime-aa-ets-RevocationRefs" #define NID_id_smime_aa_ets_RevocationRefs 233 #define OBJ_id_smime_aa_ets_RevocationRefs OBJ_id_smime_aa,22L #define SN_id_smime_aa_ets_certValues "id-smime-aa-ets-certValues" #define NID_id_smime_aa_ets_certValues 234 #define OBJ_id_smime_aa_ets_certValues OBJ_id_smime_aa,23L #define SN_id_smime_aa_ets_revocationValues "id-smime-aa-ets-revocationValues" #define NID_id_smime_aa_ets_revocationValues 235 #define OBJ_id_smime_aa_ets_revocationValues OBJ_id_smime_aa,24L #define SN_id_smime_aa_ets_escTimeStamp "id-smime-aa-ets-escTimeStamp" #define NID_id_smime_aa_ets_escTimeStamp 236 #define OBJ_id_smime_aa_ets_escTimeStamp OBJ_id_smime_aa,25L #define SN_id_smime_aa_ets_certCRLTimestamp "id-smime-aa-ets-certCRLTimestamp" #define NID_id_smime_aa_ets_certCRLTimestamp 237 #define OBJ_id_smime_aa_ets_certCRLTimestamp OBJ_id_smime_aa,26L #define SN_id_smime_aa_ets_archiveTimeStamp "id-smime-aa-ets-archiveTimeStamp" #define NID_id_smime_aa_ets_archiveTimeStamp 238 #define OBJ_id_smime_aa_ets_archiveTimeStamp OBJ_id_smime_aa,27L #define SN_id_smime_aa_signatureType "id-smime-aa-signatureType" #define NID_id_smime_aa_signatureType 239 #define OBJ_id_smime_aa_signatureType OBJ_id_smime_aa,28L #define SN_id_smime_aa_dvcs_dvc "id-smime-aa-dvcs-dvc" #define NID_id_smime_aa_dvcs_dvc 240 #define OBJ_id_smime_aa_dvcs_dvc OBJ_id_smime_aa,29L #define SN_id_smime_alg_ESDHwith3DES "id-smime-alg-ESDHwith3DES" #define NID_id_smime_alg_ESDHwith3DES 241 #define OBJ_id_smime_alg_ESDHwith3DES OBJ_id_smime_alg,1L #define SN_id_smime_alg_ESDHwithRC2 "id-smime-alg-ESDHwithRC2" #define NID_id_smime_alg_ESDHwithRC2 242 #define OBJ_id_smime_alg_ESDHwithRC2 OBJ_id_smime_alg,2L #define SN_id_smime_alg_3DESwrap "id-smime-alg-3DESwrap" #define NID_id_smime_alg_3DESwrap 243 #define OBJ_id_smime_alg_3DESwrap OBJ_id_smime_alg,3L #define SN_id_smime_alg_RC2wrap "id-smime-alg-RC2wrap" #define NID_id_smime_alg_RC2wrap 244 #define OBJ_id_smime_alg_RC2wrap OBJ_id_smime_alg,4L #define SN_id_smime_alg_ESDH "id-smime-alg-ESDH" #define NID_id_smime_alg_ESDH 245 #define OBJ_id_smime_alg_ESDH OBJ_id_smime_alg,5L #define SN_id_smime_alg_CMS3DESwrap "id-smime-alg-CMS3DESwrap" #define NID_id_smime_alg_CMS3DESwrap 246 #define OBJ_id_smime_alg_CMS3DESwrap OBJ_id_smime_alg,6L #define SN_id_smime_alg_CMSRC2wrap "id-smime-alg-CMSRC2wrap" #define NID_id_smime_alg_CMSRC2wrap 247 #define OBJ_id_smime_alg_CMSRC2wrap OBJ_id_smime_alg,7L #define SN_id_alg_PWRI_KEK "id-alg-PWRI-KEK" #define NID_id_alg_PWRI_KEK 893 #define OBJ_id_alg_PWRI_KEK OBJ_id_smime_alg,9L #define SN_id_smime_cd_ldap "id-smime-cd-ldap" #define NID_id_smime_cd_ldap 248 #define OBJ_id_smime_cd_ldap OBJ_id_smime_cd,1L #define SN_id_smime_spq_ets_sqt_uri "id-smime-spq-ets-sqt-uri" #define NID_id_smime_spq_ets_sqt_uri 249 #define OBJ_id_smime_spq_ets_sqt_uri OBJ_id_smime_spq,1L #define SN_id_smime_spq_ets_sqt_unotice "id-smime-spq-ets-sqt-unotice" #define NID_id_smime_spq_ets_sqt_unotice 250 #define OBJ_id_smime_spq_ets_sqt_unotice OBJ_id_smime_spq,2L #define SN_id_smime_cti_ets_proofOfOrigin "id-smime-cti-ets-proofOfOrigin" #define NID_id_smime_cti_ets_proofOfOrigin 251 #define OBJ_id_smime_cti_ets_proofOfOrigin OBJ_id_smime_cti,1L #define SN_id_smime_cti_ets_proofOfReceipt "id-smime-cti-ets-proofOfReceipt" #define NID_id_smime_cti_ets_proofOfReceipt 252 #define OBJ_id_smime_cti_ets_proofOfReceipt OBJ_id_smime_cti,2L #define SN_id_smime_cti_ets_proofOfDelivery "id-smime-cti-ets-proofOfDelivery" #define NID_id_smime_cti_ets_proofOfDelivery 253 #define OBJ_id_smime_cti_ets_proofOfDelivery OBJ_id_smime_cti,3L #define SN_id_smime_cti_ets_proofOfSender "id-smime-cti-ets-proofOfSender" #define NID_id_smime_cti_ets_proofOfSender 254 #define OBJ_id_smime_cti_ets_proofOfSender OBJ_id_smime_cti,4L #define SN_id_smime_cti_ets_proofOfApproval "id-smime-cti-ets-proofOfApproval" #define NID_id_smime_cti_ets_proofOfApproval 255 #define OBJ_id_smime_cti_ets_proofOfApproval OBJ_id_smime_cti,5L #define SN_id_smime_cti_ets_proofOfCreation "id-smime-cti-ets-proofOfCreation" #define NID_id_smime_cti_ets_proofOfCreation 256 #define OBJ_id_smime_cti_ets_proofOfCreation OBJ_id_smime_cti,6L #define LN_friendlyName "friendlyName" #define NID_friendlyName 156 #define OBJ_friendlyName OBJ_pkcs9,20L #define LN_localKeyID "localKeyID" #define NID_localKeyID 157 #define OBJ_localKeyID OBJ_pkcs9,21L #define SN_ms_csp_name "CSPName" #define LN_ms_csp_name "Microsoft CSP Name" #define NID_ms_csp_name 417 #define OBJ_ms_csp_name 1L,3L,6L,1L,4L,1L,311L,17L,1L #define SN_LocalKeySet "LocalKeySet" #define LN_LocalKeySet "Microsoft Local Key set" #define NID_LocalKeySet 856 #define OBJ_LocalKeySet 1L,3L,6L,1L,4L,1L,311L,17L,2L #define OBJ_certTypes OBJ_pkcs9,22L #define LN_x509Certificate "x509Certificate" #define NID_x509Certificate 158 #define OBJ_x509Certificate OBJ_certTypes,1L #define LN_sdsiCertificate "sdsiCertificate" #define NID_sdsiCertificate 159 #define OBJ_sdsiCertificate OBJ_certTypes,2L #define OBJ_crlTypes OBJ_pkcs9,23L #define LN_x509Crl "x509Crl" #define NID_x509Crl 160 #define OBJ_x509Crl OBJ_crlTypes,1L #define OBJ_pkcs12 OBJ_pkcs,12L #define OBJ_pkcs12_pbeids OBJ_pkcs12,1L #define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128" #define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" #define NID_pbe_WithSHA1And128BitRC4 144 #define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids,1L #define SN_pbe_WithSHA1And40BitRC4 "PBE-SHA1-RC4-40" #define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" #define NID_pbe_WithSHA1And40BitRC4 145 #define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids,2L #define SN_pbe_WithSHA1And3_Key_TripleDES_CBC "PBE-SHA1-3DES" #define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" #define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 #define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids,3L #define SN_pbe_WithSHA1And2_Key_TripleDES_CBC "PBE-SHA1-2DES" #define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" #define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 #define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids,4L #define SN_pbe_WithSHA1And128BitRC2_CBC "PBE-SHA1-RC2-128" #define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" #define NID_pbe_WithSHA1And128BitRC2_CBC 148 #define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids,5L #define SN_pbe_WithSHA1And40BitRC2_CBC "PBE-SHA1-RC2-40" #define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" #define NID_pbe_WithSHA1And40BitRC2_CBC 149 #define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids,6L #define OBJ_pkcs12_Version1 OBJ_pkcs12,10L #define OBJ_pkcs12_BagIds OBJ_pkcs12_Version1,1L #define LN_keyBag "keyBag" #define NID_keyBag 150 #define OBJ_keyBag OBJ_pkcs12_BagIds,1L #define LN_pkcs8ShroudedKeyBag "pkcs8ShroudedKeyBag" #define NID_pkcs8ShroudedKeyBag 151 #define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds,2L #define LN_certBag "certBag" #define NID_certBag 152 #define OBJ_certBag OBJ_pkcs12_BagIds,3L #define LN_crlBag "crlBag" #define NID_crlBag 153 #define OBJ_crlBag OBJ_pkcs12_BagIds,4L #define LN_secretBag "secretBag" #define NID_secretBag 154 #define OBJ_secretBag OBJ_pkcs12_BagIds,5L #define LN_safeContentsBag "safeContentsBag" #define NID_safeContentsBag 155 #define OBJ_safeContentsBag OBJ_pkcs12_BagIds,6L #define SN_md2 "MD2" #define LN_md2 "md2" #define NID_md2 3 #define OBJ_md2 OBJ_rsadsi,2L,2L #define SN_md4 "MD4" #define LN_md4 "md4" #define NID_md4 257 #define OBJ_md4 OBJ_rsadsi,2L,4L #define SN_md5 "MD5" #define LN_md5 "md5" #define NID_md5 4 #define OBJ_md5 OBJ_rsadsi,2L,5L #define SN_md5_sha1 "MD5-SHA1" #define LN_md5_sha1 "md5-sha1" #define NID_md5_sha1 114 #define LN_hmacWithMD5 "hmacWithMD5" #define NID_hmacWithMD5 797 #define OBJ_hmacWithMD5 OBJ_rsadsi,2L,6L #define LN_hmacWithSHA1 "hmacWithSHA1" #define NID_hmacWithSHA1 163 #define OBJ_hmacWithSHA1 OBJ_rsadsi,2L,7L #define LN_hmacWithSHA224 "hmacWithSHA224" #define NID_hmacWithSHA224 798 #define OBJ_hmacWithSHA224 OBJ_rsadsi,2L,8L #define LN_hmacWithSHA256 "hmacWithSHA256" #define NID_hmacWithSHA256 799 #define OBJ_hmacWithSHA256 OBJ_rsadsi,2L,9L #define LN_hmacWithSHA384 "hmacWithSHA384" #define NID_hmacWithSHA384 800 #define OBJ_hmacWithSHA384 OBJ_rsadsi,2L,10L #define LN_hmacWithSHA512 "hmacWithSHA512" #define NID_hmacWithSHA512 801 #define OBJ_hmacWithSHA512 OBJ_rsadsi,2L,11L #define SN_rc2_cbc "RC2-CBC" #define LN_rc2_cbc "rc2-cbc" #define NID_rc2_cbc 37 #define OBJ_rc2_cbc OBJ_rsadsi,3L,2L #define SN_rc2_ecb "RC2-ECB" #define LN_rc2_ecb "rc2-ecb" #define NID_rc2_ecb 38 #define SN_rc2_cfb64 "RC2-CFB" #define LN_rc2_cfb64 "rc2-cfb" #define NID_rc2_cfb64 39 #define SN_rc2_ofb64 "RC2-OFB" #define LN_rc2_ofb64 "rc2-ofb" #define NID_rc2_ofb64 40 #define SN_rc2_40_cbc "RC2-40-CBC" #define LN_rc2_40_cbc "rc2-40-cbc" #define NID_rc2_40_cbc 98 #define SN_rc2_64_cbc "RC2-64-CBC" #define LN_rc2_64_cbc "rc2-64-cbc" #define NID_rc2_64_cbc 166 #define SN_rc4 "RC4" #define LN_rc4 "rc4" #define NID_rc4 5 #define OBJ_rc4 OBJ_rsadsi,3L,4L #define SN_rc4_40 "RC4-40" #define LN_rc4_40 "rc4-40" #define NID_rc4_40 97 #define SN_des_ede3_cbc "DES-EDE3-CBC" #define LN_des_ede3_cbc "des-ede3-cbc" #define NID_des_ede3_cbc 44 #define OBJ_des_ede3_cbc OBJ_rsadsi,3L,7L #define SN_rc5_cbc "RC5-CBC" #define LN_rc5_cbc "rc5-cbc" #define NID_rc5_cbc 120 #define OBJ_rc5_cbc OBJ_rsadsi,3L,8L #define SN_rc5_ecb "RC5-ECB" #define LN_rc5_ecb "rc5-ecb" #define NID_rc5_ecb 121 #define SN_rc5_cfb64 "RC5-CFB" #define LN_rc5_cfb64 "rc5-cfb" #define NID_rc5_cfb64 122 #define SN_rc5_ofb64 "RC5-OFB" #define LN_rc5_ofb64 "rc5-ofb" #define NID_rc5_ofb64 123 #define SN_ms_ext_req "msExtReq" #define LN_ms_ext_req "Microsoft Extension Request" #define NID_ms_ext_req 171 #define OBJ_ms_ext_req 1L,3L,6L,1L,4L,1L,311L,2L,1L,14L #define SN_ms_code_ind "msCodeInd" #define LN_ms_code_ind "Microsoft Individual Code Signing" #define NID_ms_code_ind 134 #define OBJ_ms_code_ind 1L,3L,6L,1L,4L,1L,311L,2L,1L,21L #define SN_ms_code_com "msCodeCom" #define LN_ms_code_com "Microsoft Commercial Code Signing" #define NID_ms_code_com 135 #define OBJ_ms_code_com 1L,3L,6L,1L,4L,1L,311L,2L,1L,22L #define SN_ms_ctl_sign "msCTLSign" #define LN_ms_ctl_sign "Microsoft Trust List Signing" #define NID_ms_ctl_sign 136 #define OBJ_ms_ctl_sign 1L,3L,6L,1L,4L,1L,311L,10L,3L,1L #define SN_ms_sgc "msSGC" #define LN_ms_sgc "Microsoft Server Gated Crypto" #define NID_ms_sgc 137 #define OBJ_ms_sgc 1L,3L,6L,1L,4L,1L,311L,10L,3L,3L #define SN_ms_efs "msEFS" #define LN_ms_efs "Microsoft Encrypted File System" #define NID_ms_efs 138 #define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L #define SN_ms_smartcard_login "msSmartcardLogin" #define LN_ms_smartcard_login "Microsoft Smartcardlogin" #define NID_ms_smartcard_login 648 #define OBJ_ms_smartcard_login 1L,3L,6L,1L,4L,1L,311L,20L,2L,2L #define SN_ms_upn "msUPN" #define LN_ms_upn "Microsoft Universal Principal Name" #define NID_ms_upn 649 #define OBJ_ms_upn 1L,3L,6L,1L,4L,1L,311L,20L,2L,3L #define SN_idea_cbc "IDEA-CBC" #define LN_idea_cbc "idea-cbc" #define NID_idea_cbc 34 #define OBJ_idea_cbc 1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L #define SN_idea_ecb "IDEA-ECB" #define LN_idea_ecb "idea-ecb" #define NID_idea_ecb 36 #define SN_idea_cfb64 "IDEA-CFB" #define LN_idea_cfb64 "idea-cfb" #define NID_idea_cfb64 35 #define SN_idea_ofb64 "IDEA-OFB" #define LN_idea_ofb64 "idea-ofb" #define NID_idea_ofb64 46 #define SN_bf_cbc "BF-CBC" #define LN_bf_cbc "bf-cbc" #define NID_bf_cbc 91 #define OBJ_bf_cbc 1L,3L,6L,1L,4L,1L,3029L,1L,2L #define SN_bf_ecb "BF-ECB" #define LN_bf_ecb "bf-ecb" #define NID_bf_ecb 92 #define SN_bf_cfb64 "BF-CFB" #define LN_bf_cfb64 "bf-cfb" #define NID_bf_cfb64 93 #define SN_bf_ofb64 "BF-OFB" #define LN_bf_ofb64 "bf-ofb" #define NID_bf_ofb64 94 #define SN_id_pkix "PKIX" #define NID_id_pkix 127 #define OBJ_id_pkix 1L,3L,6L,1L,5L,5L,7L #define SN_id_pkix_mod "id-pkix-mod" #define NID_id_pkix_mod 258 #define OBJ_id_pkix_mod OBJ_id_pkix,0L #define SN_id_pe "id-pe" #define NID_id_pe 175 #define OBJ_id_pe OBJ_id_pkix,1L #define SN_id_qt "id-qt" #define NID_id_qt 259 #define OBJ_id_qt OBJ_id_pkix,2L #define SN_id_kp "id-kp" #define NID_id_kp 128 #define OBJ_id_kp OBJ_id_pkix,3L #define SN_id_it "id-it" #define NID_id_it 260 #define OBJ_id_it OBJ_id_pkix,4L #define SN_id_pkip "id-pkip" #define NID_id_pkip 261 #define OBJ_id_pkip OBJ_id_pkix,5L #define SN_id_alg "id-alg" #define NID_id_alg 262 #define OBJ_id_alg OBJ_id_pkix,6L #define SN_id_cmc "id-cmc" #define NID_id_cmc 263 #define OBJ_id_cmc OBJ_id_pkix,7L #define SN_id_on "id-on" #define NID_id_on 264 #define OBJ_id_on OBJ_id_pkix,8L #define SN_id_pda "id-pda" #define NID_id_pda 265 #define OBJ_id_pda OBJ_id_pkix,9L #define SN_id_aca "id-aca" #define NID_id_aca 266 #define OBJ_id_aca OBJ_id_pkix,10L #define SN_id_qcs "id-qcs" #define NID_id_qcs 267 #define OBJ_id_qcs OBJ_id_pkix,11L #define SN_id_cct "id-cct" #define NID_id_cct 268 #define OBJ_id_cct OBJ_id_pkix,12L #define SN_id_ppl "id-ppl" #define NID_id_ppl 662 #define OBJ_id_ppl OBJ_id_pkix,21L #define SN_id_ad "id-ad" #define NID_id_ad 176 #define OBJ_id_ad OBJ_id_pkix,48L #define SN_id_pkix1_explicit_88 "id-pkix1-explicit-88" #define NID_id_pkix1_explicit_88 269 #define OBJ_id_pkix1_explicit_88 OBJ_id_pkix_mod,1L #define SN_id_pkix1_implicit_88 "id-pkix1-implicit-88" #define NID_id_pkix1_implicit_88 270 #define OBJ_id_pkix1_implicit_88 OBJ_id_pkix_mod,2L #define SN_id_pkix1_explicit_93 "id-pkix1-explicit-93" #define NID_id_pkix1_explicit_93 271 #define OBJ_id_pkix1_explicit_93 OBJ_id_pkix_mod,3L #define SN_id_pkix1_implicit_93 "id-pkix1-implicit-93" #define NID_id_pkix1_implicit_93 272 #define OBJ_id_pkix1_implicit_93 OBJ_id_pkix_mod,4L #define SN_id_mod_crmf "id-mod-crmf" #define NID_id_mod_crmf 273 #define OBJ_id_mod_crmf OBJ_id_pkix_mod,5L #define SN_id_mod_cmc "id-mod-cmc" #define NID_id_mod_cmc 274 #define OBJ_id_mod_cmc OBJ_id_pkix_mod,6L #define SN_id_mod_kea_profile_88 "id-mod-kea-profile-88" #define NID_id_mod_kea_profile_88 275 #define OBJ_id_mod_kea_profile_88 OBJ_id_pkix_mod,7L #define SN_id_mod_kea_profile_93 "id-mod-kea-profile-93" #define NID_id_mod_kea_profile_93 276 #define OBJ_id_mod_kea_profile_93 OBJ_id_pkix_mod,8L #define SN_id_mod_cmp "id-mod-cmp" #define NID_id_mod_cmp 277 #define OBJ_id_mod_cmp OBJ_id_pkix_mod,9L #define SN_id_mod_qualified_cert_88 "id-mod-qualified-cert-88" #define NID_id_mod_qualified_cert_88 278 #define OBJ_id_mod_qualified_cert_88 OBJ_id_pkix_mod,10L #define SN_id_mod_qualified_cert_93 "id-mod-qualified-cert-93" #define NID_id_mod_qualified_cert_93 279 #define OBJ_id_mod_qualified_cert_93 OBJ_id_pkix_mod,11L #define SN_id_mod_attribute_cert "id-mod-attribute-cert" #define NID_id_mod_attribute_cert 280 #define OBJ_id_mod_attribute_cert OBJ_id_pkix_mod,12L #define SN_id_mod_timestamp_protocol "id-mod-timestamp-protocol" #define NID_id_mod_timestamp_protocol 281 #define OBJ_id_mod_timestamp_protocol OBJ_id_pkix_mod,13L #define SN_id_mod_ocsp "id-mod-ocsp" #define NID_id_mod_ocsp 282 #define OBJ_id_mod_ocsp OBJ_id_pkix_mod,14L #define SN_id_mod_dvcs "id-mod-dvcs" #define NID_id_mod_dvcs 283 #define OBJ_id_mod_dvcs OBJ_id_pkix_mod,15L #define SN_id_mod_cmp2000 "id-mod-cmp2000" #define NID_id_mod_cmp2000 284 #define OBJ_id_mod_cmp2000 OBJ_id_pkix_mod,16L #define SN_info_access "authorityInfoAccess" #define LN_info_access "Authority Information Access" #define NID_info_access 177 #define OBJ_info_access OBJ_id_pe,1L #define SN_biometricInfo "biometricInfo" #define LN_biometricInfo "Biometric Info" #define NID_biometricInfo 285 #define OBJ_biometricInfo OBJ_id_pe,2L #define SN_qcStatements "qcStatements" #define NID_qcStatements 286 #define OBJ_qcStatements OBJ_id_pe,3L #define SN_ac_auditEntity "ac-auditEntity" #define NID_ac_auditEntity 287 #define OBJ_ac_auditEntity OBJ_id_pe,4L #define SN_ac_targeting "ac-targeting" #define NID_ac_targeting 288 #define OBJ_ac_targeting OBJ_id_pe,5L #define SN_aaControls "aaControls" #define NID_aaControls 289 #define OBJ_aaControls OBJ_id_pe,6L #define SN_sbgp_ipAddrBlock "sbgp-ipAddrBlock" #define NID_sbgp_ipAddrBlock 290 #define OBJ_sbgp_ipAddrBlock OBJ_id_pe,7L #define SN_sbgp_autonomousSysNum "sbgp-autonomousSysNum" #define NID_sbgp_autonomousSysNum 291 #define OBJ_sbgp_autonomousSysNum OBJ_id_pe,8L #define SN_sbgp_routerIdentifier "sbgp-routerIdentifier" #define NID_sbgp_routerIdentifier 292 #define OBJ_sbgp_routerIdentifier OBJ_id_pe,9L #define SN_ac_proxying "ac-proxying" #define NID_ac_proxying 397 #define OBJ_ac_proxying OBJ_id_pe,10L #define SN_sinfo_access "subjectInfoAccess" #define LN_sinfo_access "Subject Information Access" #define NID_sinfo_access 398 #define OBJ_sinfo_access OBJ_id_pe,11L #define SN_proxyCertInfo "proxyCertInfo" #define LN_proxyCertInfo "Proxy Certificate Information" #define NID_proxyCertInfo 663 #define OBJ_proxyCertInfo OBJ_id_pe,14L #define SN_id_qt_cps "id-qt-cps" #define LN_id_qt_cps "Policy Qualifier CPS" #define NID_id_qt_cps 164 #define OBJ_id_qt_cps OBJ_id_qt,1L #define SN_id_qt_unotice "id-qt-unotice" #define LN_id_qt_unotice "Policy Qualifier User Notice" #define NID_id_qt_unotice 165 #define OBJ_id_qt_unotice OBJ_id_qt,2L #define SN_textNotice "textNotice" #define NID_textNotice 293 #define OBJ_textNotice OBJ_id_qt,3L #define SN_server_auth "serverAuth" #define LN_server_auth "TLS Web Server Authentication" #define NID_server_auth 129 #define OBJ_server_auth OBJ_id_kp,1L #define SN_client_auth "clientAuth" #define LN_client_auth "TLS Web Client Authentication" #define NID_client_auth 130 #define OBJ_client_auth OBJ_id_kp,2L #define SN_code_sign "codeSigning" #define LN_code_sign "Code Signing" #define NID_code_sign 131 #define OBJ_code_sign OBJ_id_kp,3L #define SN_email_protect "emailProtection" #define LN_email_protect "E-mail Protection" #define NID_email_protect 132 #define OBJ_email_protect OBJ_id_kp,4L #define SN_ipsecEndSystem "ipsecEndSystem" #define LN_ipsecEndSystem "IPSec End System" #define NID_ipsecEndSystem 294 #define OBJ_ipsecEndSystem OBJ_id_kp,5L #define SN_ipsecTunnel "ipsecTunnel" #define LN_ipsecTunnel "IPSec Tunnel" #define NID_ipsecTunnel 295 #define OBJ_ipsecTunnel OBJ_id_kp,6L #define SN_ipsecUser "ipsecUser" #define LN_ipsecUser "IPSec User" #define NID_ipsecUser 296 #define OBJ_ipsecUser OBJ_id_kp,7L #define SN_time_stamp "timeStamping" #define LN_time_stamp "Time Stamping" #define NID_time_stamp 133 #define OBJ_time_stamp OBJ_id_kp,8L #define SN_OCSP_sign "OCSPSigning" #define LN_OCSP_sign "OCSP Signing" #define NID_OCSP_sign 180 #define OBJ_OCSP_sign OBJ_id_kp,9L #define SN_dvcs "DVCS" #define LN_dvcs "dvcs" #define NID_dvcs 297 #define OBJ_dvcs OBJ_id_kp,10L #define SN_id_it_caProtEncCert "id-it-caProtEncCert" #define NID_id_it_caProtEncCert 298 #define OBJ_id_it_caProtEncCert OBJ_id_it,1L #define SN_id_it_signKeyPairTypes "id-it-signKeyPairTypes" #define NID_id_it_signKeyPairTypes 299 #define OBJ_id_it_signKeyPairTypes OBJ_id_it,2L #define SN_id_it_encKeyPairTypes "id-it-encKeyPairTypes" #define NID_id_it_encKeyPairTypes 300 #define OBJ_id_it_encKeyPairTypes OBJ_id_it,3L #define SN_id_it_preferredSymmAlg "id-it-preferredSymmAlg" #define NID_id_it_preferredSymmAlg 301 #define OBJ_id_it_preferredSymmAlg OBJ_id_it,4L #define SN_id_it_caKeyUpdateInfo "id-it-caKeyUpdateInfo" #define NID_id_it_caKeyUpdateInfo 302 #define OBJ_id_it_caKeyUpdateInfo OBJ_id_it,5L #define SN_id_it_currentCRL "id-it-currentCRL" #define NID_id_it_currentCRL 303 #define OBJ_id_it_currentCRL OBJ_id_it,6L #define SN_id_it_unsupportedOIDs "id-it-unsupportedOIDs" #define NID_id_it_unsupportedOIDs 304 #define OBJ_id_it_unsupportedOIDs OBJ_id_it,7L #define SN_id_it_subscriptionRequest "id-it-subscriptionRequest" #define NID_id_it_subscriptionRequest 305 #define OBJ_id_it_subscriptionRequest OBJ_id_it,8L #define SN_id_it_subscriptionResponse "id-it-subscriptionResponse" #define NID_id_it_subscriptionResponse 306 #define OBJ_id_it_subscriptionResponse OBJ_id_it,9L #define SN_id_it_keyPairParamReq "id-it-keyPairParamReq" #define NID_id_it_keyPairParamReq 307 #define OBJ_id_it_keyPairParamReq OBJ_id_it,10L #define SN_id_it_keyPairParamRep "id-it-keyPairParamRep" #define NID_id_it_keyPairParamRep 308 #define OBJ_id_it_keyPairParamRep OBJ_id_it,11L #define SN_id_it_revPassphrase "id-it-revPassphrase" #define NID_id_it_revPassphrase 309 #define OBJ_id_it_revPassphrase OBJ_id_it,12L #define SN_id_it_implicitConfirm "id-it-implicitConfirm" #define NID_id_it_implicitConfirm 310 #define OBJ_id_it_implicitConfirm OBJ_id_it,13L #define SN_id_it_confirmWaitTime "id-it-confirmWaitTime" #define NID_id_it_confirmWaitTime 311 #define OBJ_id_it_confirmWaitTime OBJ_id_it,14L #define SN_id_it_origPKIMessage "id-it-origPKIMessage" #define NID_id_it_origPKIMessage 312 #define OBJ_id_it_origPKIMessage OBJ_id_it,15L #define SN_id_it_suppLangTags "id-it-suppLangTags" #define NID_id_it_suppLangTags 784 #define OBJ_id_it_suppLangTags OBJ_id_it,16L #define SN_id_regCtrl "id-regCtrl" #define NID_id_regCtrl 313 #define OBJ_id_regCtrl OBJ_id_pkip,1L #define SN_id_regInfo "id-regInfo" #define NID_id_regInfo 314 #define OBJ_id_regInfo OBJ_id_pkip,2L #define SN_id_regCtrl_regToken "id-regCtrl-regToken" #define NID_id_regCtrl_regToken 315 #define OBJ_id_regCtrl_regToken OBJ_id_regCtrl,1L #define SN_id_regCtrl_authenticator "id-regCtrl-authenticator" #define NID_id_regCtrl_authenticator 316 #define OBJ_id_regCtrl_authenticator OBJ_id_regCtrl,2L #define SN_id_regCtrl_pkiPublicationInfo "id-regCtrl-pkiPublicationInfo" #define NID_id_regCtrl_pkiPublicationInfo 317 #define OBJ_id_regCtrl_pkiPublicationInfo OBJ_id_regCtrl,3L #define SN_id_regCtrl_pkiArchiveOptions "id-regCtrl-pkiArchiveOptions" #define NID_id_regCtrl_pkiArchiveOptions 318 #define OBJ_id_regCtrl_pkiArchiveOptions OBJ_id_regCtrl,4L #define SN_id_regCtrl_oldCertID "id-regCtrl-oldCertID" #define NID_id_regCtrl_oldCertID 319 #define OBJ_id_regCtrl_oldCertID OBJ_id_regCtrl,5L #define SN_id_regCtrl_protocolEncrKey "id-regCtrl-protocolEncrKey" #define NID_id_regCtrl_protocolEncrKey 320 #define OBJ_id_regCtrl_protocolEncrKey OBJ_id_regCtrl,6L #define SN_id_regInfo_utf8Pairs "id-regInfo-utf8Pairs" #define NID_id_regInfo_utf8Pairs 321 #define OBJ_id_regInfo_utf8Pairs OBJ_id_regInfo,1L #define SN_id_regInfo_certReq "id-regInfo-certReq" #define NID_id_regInfo_certReq 322 #define OBJ_id_regInfo_certReq OBJ_id_regInfo,2L #define SN_id_alg_des40 "id-alg-des40" #define NID_id_alg_des40 323 #define OBJ_id_alg_des40 OBJ_id_alg,1L #define SN_id_alg_noSignature "id-alg-noSignature" #define NID_id_alg_noSignature 324 #define OBJ_id_alg_noSignature OBJ_id_alg,2L #define SN_id_alg_dh_sig_hmac_sha1 "id-alg-dh-sig-hmac-sha1" #define NID_id_alg_dh_sig_hmac_sha1 325 #define OBJ_id_alg_dh_sig_hmac_sha1 OBJ_id_alg,3L #define SN_id_alg_dh_pop "id-alg-dh-pop" #define NID_id_alg_dh_pop 326 #define OBJ_id_alg_dh_pop OBJ_id_alg,4L #define SN_id_cmc_statusInfo "id-cmc-statusInfo" #define NID_id_cmc_statusInfo 327 #define OBJ_id_cmc_statusInfo OBJ_id_cmc,1L #define SN_id_cmc_identification "id-cmc-identification" #define NID_id_cmc_identification 328 #define OBJ_id_cmc_identification OBJ_id_cmc,2L #define SN_id_cmc_identityProof "id-cmc-identityProof" #define NID_id_cmc_identityProof 329 #define OBJ_id_cmc_identityProof OBJ_id_cmc,3L #define SN_id_cmc_dataReturn "id-cmc-dataReturn" #define NID_id_cmc_dataReturn 330 #define OBJ_id_cmc_dataReturn OBJ_id_cmc,4L #define SN_id_cmc_transactionId "id-cmc-transactionId" #define NID_id_cmc_transactionId 331 #define OBJ_id_cmc_transactionId OBJ_id_cmc,5L #define SN_id_cmc_senderNonce "id-cmc-senderNonce" #define NID_id_cmc_senderNonce 332 #define OBJ_id_cmc_senderNonce OBJ_id_cmc,6L #define SN_id_cmc_recipientNonce "id-cmc-recipientNonce" #define NID_id_cmc_recipientNonce 333 #define OBJ_id_cmc_recipientNonce OBJ_id_cmc,7L #define SN_id_cmc_addExtensions "id-cmc-addExtensions" #define NID_id_cmc_addExtensions 334 #define OBJ_id_cmc_addExtensions OBJ_id_cmc,8L #define SN_id_cmc_encryptedPOP "id-cmc-encryptedPOP" #define NID_id_cmc_encryptedPOP 335 #define OBJ_id_cmc_encryptedPOP OBJ_id_cmc,9L #define SN_id_cmc_decryptedPOP "id-cmc-decryptedPOP" #define NID_id_cmc_decryptedPOP 336 #define OBJ_id_cmc_decryptedPOP OBJ_id_cmc,10L #define SN_id_cmc_lraPOPWitness "id-cmc-lraPOPWitness" #define NID_id_cmc_lraPOPWitness 337 #define OBJ_id_cmc_lraPOPWitness OBJ_id_cmc,11L #define SN_id_cmc_getCert "id-cmc-getCert" #define NID_id_cmc_getCert 338 #define OBJ_id_cmc_getCert OBJ_id_cmc,15L #define SN_id_cmc_getCRL "id-cmc-getCRL" #define NID_id_cmc_getCRL 339 #define OBJ_id_cmc_getCRL OBJ_id_cmc,16L #define SN_id_cmc_revokeRequest "id-cmc-revokeRequest" #define NID_id_cmc_revokeRequest 340 #define OBJ_id_cmc_revokeRequest OBJ_id_cmc,17L #define SN_id_cmc_regInfo "id-cmc-regInfo" #define NID_id_cmc_regInfo 341 #define OBJ_id_cmc_regInfo OBJ_id_cmc,18L #define SN_id_cmc_responseInfo "id-cmc-responseInfo" #define NID_id_cmc_responseInfo 342 #define OBJ_id_cmc_responseInfo OBJ_id_cmc,19L #define SN_id_cmc_queryPending "id-cmc-queryPending" #define NID_id_cmc_queryPending 343 #define OBJ_id_cmc_queryPending OBJ_id_cmc,21L #define SN_id_cmc_popLinkRandom "id-cmc-popLinkRandom" #define NID_id_cmc_popLinkRandom 344 #define OBJ_id_cmc_popLinkRandom OBJ_id_cmc,22L #define SN_id_cmc_popLinkWitness "id-cmc-popLinkWitness" #define NID_id_cmc_popLinkWitness 345 #define OBJ_id_cmc_popLinkWitness OBJ_id_cmc,23L #define SN_id_cmc_confirmCertAcceptance "id-cmc-confirmCertAcceptance" #define NID_id_cmc_confirmCertAcceptance 346 #define OBJ_id_cmc_confirmCertAcceptance OBJ_id_cmc,24L #define SN_id_on_personalData "id-on-personalData" #define NID_id_on_personalData 347 #define OBJ_id_on_personalData OBJ_id_on,1L #define SN_id_on_permanentIdentifier "id-on-permanentIdentifier" #define LN_id_on_permanentIdentifier "Permanent Identifier" #define NID_id_on_permanentIdentifier 858 #define OBJ_id_on_permanentIdentifier OBJ_id_on,3L #define SN_id_pda_dateOfBirth "id-pda-dateOfBirth" #define NID_id_pda_dateOfBirth 348 #define OBJ_id_pda_dateOfBirth OBJ_id_pda,1L #define SN_id_pda_placeOfBirth "id-pda-placeOfBirth" #define NID_id_pda_placeOfBirth 349 #define OBJ_id_pda_placeOfBirth OBJ_id_pda,2L #define SN_id_pda_gender "id-pda-gender" #define NID_id_pda_gender 351 #define OBJ_id_pda_gender OBJ_id_pda,3L #define SN_id_pda_countryOfCitizenship "id-pda-countryOfCitizenship" #define NID_id_pda_countryOfCitizenship 352 #define OBJ_id_pda_countryOfCitizenship OBJ_id_pda,4L #define SN_id_pda_countryOfResidence "id-pda-countryOfResidence" #define NID_id_pda_countryOfResidence 353 #define OBJ_id_pda_countryOfResidence OBJ_id_pda,5L #define SN_id_aca_authenticationInfo "id-aca-authenticationInfo" #define NID_id_aca_authenticationInfo 354 #define OBJ_id_aca_authenticationInfo OBJ_id_aca,1L #define SN_id_aca_accessIdentity "id-aca-accessIdentity" #define NID_id_aca_accessIdentity 355 #define OBJ_id_aca_accessIdentity OBJ_id_aca,2L #define SN_id_aca_chargingIdentity "id-aca-chargingIdentity" #define NID_id_aca_chargingIdentity 356 #define OBJ_id_aca_chargingIdentity OBJ_id_aca,3L #define SN_id_aca_group "id-aca-group" #define NID_id_aca_group 357 #define OBJ_id_aca_group OBJ_id_aca,4L #define SN_id_aca_role "id-aca-role" #define NID_id_aca_role 358 #define OBJ_id_aca_role OBJ_id_aca,5L #define SN_id_aca_encAttrs "id-aca-encAttrs" #define NID_id_aca_encAttrs 399 #define OBJ_id_aca_encAttrs OBJ_id_aca,6L #define SN_id_qcs_pkixQCSyntax_v1 "id-qcs-pkixQCSyntax-v1" #define NID_id_qcs_pkixQCSyntax_v1 359 #define OBJ_id_qcs_pkixQCSyntax_v1 OBJ_id_qcs,1L #define SN_id_cct_crs "id-cct-crs" #define NID_id_cct_crs 360 #define OBJ_id_cct_crs OBJ_id_cct,1L #define SN_id_cct_PKIData "id-cct-PKIData" #define NID_id_cct_PKIData 361 #define OBJ_id_cct_PKIData OBJ_id_cct,2L #define SN_id_cct_PKIResponse "id-cct-PKIResponse" #define NID_id_cct_PKIResponse 362 #define OBJ_id_cct_PKIResponse OBJ_id_cct,3L #define SN_id_ppl_anyLanguage "id-ppl-anyLanguage" #define LN_id_ppl_anyLanguage "Any language" #define NID_id_ppl_anyLanguage 664 #define OBJ_id_ppl_anyLanguage OBJ_id_ppl,0L #define SN_id_ppl_inheritAll "id-ppl-inheritAll" #define LN_id_ppl_inheritAll "Inherit all" #define NID_id_ppl_inheritAll 665 #define OBJ_id_ppl_inheritAll OBJ_id_ppl,1L #define SN_Independent "id-ppl-independent" #define LN_Independent "Independent" #define NID_Independent 667 #define OBJ_Independent OBJ_id_ppl,2L #define SN_ad_OCSP "OCSP" #define LN_ad_OCSP "OCSP" #define NID_ad_OCSP 178 #define OBJ_ad_OCSP OBJ_id_ad,1L #define SN_ad_ca_issuers "caIssuers" #define LN_ad_ca_issuers "CA Issuers" #define NID_ad_ca_issuers 179 #define OBJ_ad_ca_issuers OBJ_id_ad,2L #define SN_ad_timeStamping "ad_timestamping" #define LN_ad_timeStamping "AD Time Stamping" #define NID_ad_timeStamping 363 #define OBJ_ad_timeStamping OBJ_id_ad,3L #define SN_ad_dvcs "AD_DVCS" #define LN_ad_dvcs "ad dvcs" #define NID_ad_dvcs 364 #define OBJ_ad_dvcs OBJ_id_ad,4L #define SN_caRepository "caRepository" #define LN_caRepository "CA Repository" #define NID_caRepository 785 #define OBJ_caRepository OBJ_id_ad,5L #define OBJ_id_pkix_OCSP OBJ_ad_OCSP #define SN_id_pkix_OCSP_basic "basicOCSPResponse" #define LN_id_pkix_OCSP_basic "Basic OCSP Response" #define NID_id_pkix_OCSP_basic 365 #define OBJ_id_pkix_OCSP_basic OBJ_id_pkix_OCSP,1L #define SN_id_pkix_OCSP_Nonce "Nonce" #define LN_id_pkix_OCSP_Nonce "OCSP Nonce" #define NID_id_pkix_OCSP_Nonce 366 #define OBJ_id_pkix_OCSP_Nonce OBJ_id_pkix_OCSP,2L #define SN_id_pkix_OCSP_CrlID "CrlID" #define LN_id_pkix_OCSP_CrlID "OCSP CRL ID" #define NID_id_pkix_OCSP_CrlID 367 #define OBJ_id_pkix_OCSP_CrlID OBJ_id_pkix_OCSP,3L #define SN_id_pkix_OCSP_acceptableResponses "acceptableResponses" #define LN_id_pkix_OCSP_acceptableResponses "Acceptable OCSP Responses" #define NID_id_pkix_OCSP_acceptableResponses 368 #define OBJ_id_pkix_OCSP_acceptableResponses OBJ_id_pkix_OCSP,4L #define SN_id_pkix_OCSP_noCheck "noCheck" #define LN_id_pkix_OCSP_noCheck "OCSP No Check" #define NID_id_pkix_OCSP_noCheck 369 #define OBJ_id_pkix_OCSP_noCheck OBJ_id_pkix_OCSP,5L #define SN_id_pkix_OCSP_archiveCutoff "archiveCutoff" #define LN_id_pkix_OCSP_archiveCutoff "OCSP Archive Cutoff" #define NID_id_pkix_OCSP_archiveCutoff 370 #define OBJ_id_pkix_OCSP_archiveCutoff OBJ_id_pkix_OCSP,6L #define SN_id_pkix_OCSP_serviceLocator "serviceLocator" #define LN_id_pkix_OCSP_serviceLocator "OCSP Service Locator" #define NID_id_pkix_OCSP_serviceLocator 371 #define OBJ_id_pkix_OCSP_serviceLocator OBJ_id_pkix_OCSP,7L #define SN_id_pkix_OCSP_extendedStatus "extendedStatus" #define LN_id_pkix_OCSP_extendedStatus "Extended OCSP Status" #define NID_id_pkix_OCSP_extendedStatus 372 #define OBJ_id_pkix_OCSP_extendedStatus OBJ_id_pkix_OCSP,8L #define SN_id_pkix_OCSP_valid "valid" #define NID_id_pkix_OCSP_valid 373 #define OBJ_id_pkix_OCSP_valid OBJ_id_pkix_OCSP,9L #define SN_id_pkix_OCSP_path "path" #define NID_id_pkix_OCSP_path 374 #define OBJ_id_pkix_OCSP_path OBJ_id_pkix_OCSP,10L #define SN_id_pkix_OCSP_trustRoot "trustRoot" #define LN_id_pkix_OCSP_trustRoot "Trust Root" #define NID_id_pkix_OCSP_trustRoot 375 #define OBJ_id_pkix_OCSP_trustRoot OBJ_id_pkix_OCSP,11L #define SN_algorithm "algorithm" #define LN_algorithm "algorithm" #define NID_algorithm 376 #define OBJ_algorithm 1L,3L,14L,3L,2L #define SN_md5WithRSA "RSA-NP-MD5" #define LN_md5WithRSA "md5WithRSA" #define NID_md5WithRSA 104 #define OBJ_md5WithRSA OBJ_algorithm,3L #define SN_des_ecb "DES-ECB" #define LN_des_ecb "des-ecb" #define NID_des_ecb 29 #define OBJ_des_ecb OBJ_algorithm,6L #define SN_des_cbc "DES-CBC" #define LN_des_cbc "des-cbc" #define NID_des_cbc 31 #define OBJ_des_cbc OBJ_algorithm,7L #define SN_des_ofb64 "DES-OFB" #define LN_des_ofb64 "des-ofb" #define NID_des_ofb64 45 #define OBJ_des_ofb64 OBJ_algorithm,8L #define SN_des_cfb64 "DES-CFB" #define LN_des_cfb64 "des-cfb" #define NID_des_cfb64 30 #define OBJ_des_cfb64 OBJ_algorithm,9L #define SN_rsaSignature "rsaSignature" #define NID_rsaSignature 377 #define OBJ_rsaSignature OBJ_algorithm,11L #define SN_dsa_2 "DSA-old" #define LN_dsa_2 "dsaEncryption-old" #define NID_dsa_2 67 #define OBJ_dsa_2 OBJ_algorithm,12L #define SN_dsaWithSHA "DSA-SHA" #define LN_dsaWithSHA "dsaWithSHA" #define NID_dsaWithSHA 66 #define OBJ_dsaWithSHA OBJ_algorithm,13L #define SN_shaWithRSAEncryption "RSA-SHA" #define LN_shaWithRSAEncryption "shaWithRSAEncryption" #define NID_shaWithRSAEncryption 42 #define OBJ_shaWithRSAEncryption OBJ_algorithm,15L #define SN_des_ede_ecb "DES-EDE" #define LN_des_ede_ecb "des-ede" #define NID_des_ede_ecb 32 #define OBJ_des_ede_ecb OBJ_algorithm,17L #define SN_des_ede3_ecb "DES-EDE3" #define LN_des_ede3_ecb "des-ede3" #define NID_des_ede3_ecb 33 #define SN_des_ede_cbc "DES-EDE-CBC" #define LN_des_ede_cbc "des-ede-cbc" #define NID_des_ede_cbc 43 #define SN_des_ede_cfb64 "DES-EDE-CFB" #define LN_des_ede_cfb64 "des-ede-cfb" #define NID_des_ede_cfb64 60 #define SN_des_ede3_cfb64 "DES-EDE3-CFB" #define LN_des_ede3_cfb64 "des-ede3-cfb" #define NID_des_ede3_cfb64 61 #define SN_des_ede_ofb64 "DES-EDE-OFB" #define LN_des_ede_ofb64 "des-ede-ofb" #define NID_des_ede_ofb64 62 #define SN_des_ede3_ofb64 "DES-EDE3-OFB" #define LN_des_ede3_ofb64 "des-ede3-ofb" #define NID_des_ede3_ofb64 63 #define SN_desx_cbc "DESX-CBC" #define LN_desx_cbc "desx-cbc" #define NID_desx_cbc 80 #define SN_sha "SHA" #define LN_sha "sha" #define NID_sha 41 #define OBJ_sha OBJ_algorithm,18L #define SN_sha1 "SHA1" #define LN_sha1 "sha1" #define NID_sha1 64 #define OBJ_sha1 OBJ_algorithm,26L #define SN_dsaWithSHA1_2 "DSA-SHA1-old" #define LN_dsaWithSHA1_2 "dsaWithSHA1-old" #define NID_dsaWithSHA1_2 70 #define OBJ_dsaWithSHA1_2 OBJ_algorithm,27L #define SN_sha1WithRSA "RSA-SHA1-2" #define LN_sha1WithRSA "sha1WithRSA" #define NID_sha1WithRSA 115 #define OBJ_sha1WithRSA OBJ_algorithm,29L #define SN_ripemd160 "RIPEMD160" #define LN_ripemd160 "ripemd160" #define NID_ripemd160 117 #define OBJ_ripemd160 1L,3L,36L,3L,2L,1L #define SN_ripemd160WithRSA "RSA-RIPEMD160" #define LN_ripemd160WithRSA "ripemd160WithRSA" #define NID_ripemd160WithRSA 119 #define OBJ_ripemd160WithRSA 1L,3L,36L,3L,3L,1L,2L #define SN_sxnet "SXNetID" #define LN_sxnet "Strong Extranet ID" #define NID_sxnet 143 #define OBJ_sxnet 1L,3L,101L,1L,4L,1L #define SN_X500 "X500" #define LN_X500 "directory services (X.500)" #define NID_X500 11 #define OBJ_X500 2L,5L #define SN_X509 "X509" #define NID_X509 12 #define OBJ_X509 OBJ_X500,4L #define SN_commonName "CN" #define LN_commonName "commonName" #define NID_commonName 13 #define OBJ_commonName OBJ_X509,3L #define SN_surname "SN" #define LN_surname "surname" #define NID_surname 100 #define OBJ_surname OBJ_X509,4L #define LN_serialNumber "serialNumber" #define NID_serialNumber 105 #define OBJ_serialNumber OBJ_X509,5L #define SN_countryName "C" #define LN_countryName "countryName" #define NID_countryName 14 #define OBJ_countryName OBJ_X509,6L #define SN_localityName "L" #define LN_localityName "localityName" #define NID_localityName 15 #define OBJ_localityName OBJ_X509,7L #define SN_stateOrProvinceName "ST" #define LN_stateOrProvinceName "stateOrProvinceName" #define NID_stateOrProvinceName 16 #define OBJ_stateOrProvinceName OBJ_X509,8L #define SN_streetAddress "street" #define LN_streetAddress "streetAddress" #define NID_streetAddress 660 #define OBJ_streetAddress OBJ_X509,9L #define SN_organizationName "O" #define LN_organizationName "organizationName" #define NID_organizationName 17 #define OBJ_organizationName OBJ_X509,10L #define SN_organizationalUnitName "OU" #define LN_organizationalUnitName "organizationalUnitName" #define NID_organizationalUnitName 18 #define OBJ_organizationalUnitName OBJ_X509,11L #define SN_title "title" #define LN_title "title" #define NID_title 106 #define OBJ_title OBJ_X509,12L #define LN_description "description" #define NID_description 107 #define OBJ_description OBJ_X509,13L #define LN_searchGuide "searchGuide" #define NID_searchGuide 859 #define OBJ_searchGuide OBJ_X509,14L #define LN_businessCategory "businessCategory" #define NID_businessCategory 860 #define OBJ_businessCategory OBJ_X509,15L #define LN_postalAddress "postalAddress" #define NID_postalAddress 861 #define OBJ_postalAddress OBJ_X509,16L #define LN_postalCode "postalCode" #define NID_postalCode 661 #define OBJ_postalCode OBJ_X509,17L #define LN_postOfficeBox "postOfficeBox" #define NID_postOfficeBox 862 #define OBJ_postOfficeBox OBJ_X509,18L #define LN_physicalDeliveryOfficeName "physicalDeliveryOfficeName" #define NID_physicalDeliveryOfficeName 863 #define OBJ_physicalDeliveryOfficeName OBJ_X509,19L #define LN_telephoneNumber "telephoneNumber" #define NID_telephoneNumber 864 #define OBJ_telephoneNumber OBJ_X509,20L #define LN_telexNumber "telexNumber" #define NID_telexNumber 865 #define OBJ_telexNumber OBJ_X509,21L #define LN_teletexTerminalIdentifier "teletexTerminalIdentifier" #define NID_teletexTerminalIdentifier 866 #define OBJ_teletexTerminalIdentifier OBJ_X509,22L #define LN_facsimileTelephoneNumber "facsimileTelephoneNumber" #define NID_facsimileTelephoneNumber 867 #define OBJ_facsimileTelephoneNumber OBJ_X509,23L #define LN_x121Address "x121Address" #define NID_x121Address 868 #define OBJ_x121Address OBJ_X509,24L #define LN_internationaliSDNNumber "internationaliSDNNumber" #define NID_internationaliSDNNumber 869 #define OBJ_internationaliSDNNumber OBJ_X509,25L #define LN_registeredAddress "registeredAddress" #define NID_registeredAddress 870 #define OBJ_registeredAddress OBJ_X509,26L #define LN_destinationIndicator "destinationIndicator" #define NID_destinationIndicator 871 #define OBJ_destinationIndicator OBJ_X509,27L #define LN_preferredDeliveryMethod "preferredDeliveryMethod" #define NID_preferredDeliveryMethod 872 #define OBJ_preferredDeliveryMethod OBJ_X509,28L #define LN_presentationAddress "presentationAddress" #define NID_presentationAddress 873 #define OBJ_presentationAddress OBJ_X509,29L #define LN_supportedApplicationContext "supportedApplicationContext" #define NID_supportedApplicationContext 874 #define OBJ_supportedApplicationContext OBJ_X509,30L #define SN_member "member" #define NID_member 875 #define OBJ_member OBJ_X509,31L #define SN_owner "owner" #define NID_owner 876 #define OBJ_owner OBJ_X509,32L #define LN_roleOccupant "roleOccupant" #define NID_roleOccupant 877 #define OBJ_roleOccupant OBJ_X509,33L #define SN_seeAlso "seeAlso" #define NID_seeAlso 878 #define OBJ_seeAlso OBJ_X509,34L #define LN_userPassword "userPassword" #define NID_userPassword 879 #define OBJ_userPassword OBJ_X509,35L #define LN_userCertificate "userCertificate" #define NID_userCertificate 880 #define OBJ_userCertificate OBJ_X509,36L #define LN_cACertificate "cACertificate" #define NID_cACertificate 881 #define OBJ_cACertificate OBJ_X509,37L #define LN_authorityRevocationList "authorityRevocationList" #define NID_authorityRevocationList 882 #define OBJ_authorityRevocationList OBJ_X509,38L #define LN_certificateRevocationList "certificateRevocationList" #define NID_certificateRevocationList 883 #define OBJ_certificateRevocationList OBJ_X509,39L #define LN_crossCertificatePair "crossCertificatePair" #define NID_crossCertificatePair 884 #define OBJ_crossCertificatePair OBJ_X509,40L #define SN_name "name" #define LN_name "name" #define NID_name 173 #define OBJ_name OBJ_X509,41L #define SN_givenName "GN" #define LN_givenName "givenName" #define NID_givenName 99 #define OBJ_givenName OBJ_X509,42L #define SN_initials "initials" #define LN_initials "initials" #define NID_initials 101 #define OBJ_initials OBJ_X509,43L #define LN_generationQualifier "generationQualifier" #define NID_generationQualifier 509 #define OBJ_generationQualifier OBJ_X509,44L #define LN_x500UniqueIdentifier "x500UniqueIdentifier" #define NID_x500UniqueIdentifier 503 #define OBJ_x500UniqueIdentifier OBJ_X509,45L #define SN_dnQualifier "dnQualifier" #define LN_dnQualifier "dnQualifier" #define NID_dnQualifier 174 #define OBJ_dnQualifier OBJ_X509,46L #define LN_enhancedSearchGuide "enhancedSearchGuide" #define NID_enhancedSearchGuide 885 #define OBJ_enhancedSearchGuide OBJ_X509,47L #define LN_protocolInformation "protocolInformation" #define NID_protocolInformation 886 #define OBJ_protocolInformation OBJ_X509,48L #define LN_distinguishedName "distinguishedName" #define NID_distinguishedName 887 #define OBJ_distinguishedName OBJ_X509,49L #define LN_uniqueMember "uniqueMember" #define NID_uniqueMember 888 #define OBJ_uniqueMember OBJ_X509,50L #define LN_houseIdentifier "houseIdentifier" #define NID_houseIdentifier 889 #define OBJ_houseIdentifier OBJ_X509,51L #define LN_supportedAlgorithms "supportedAlgorithms" #define NID_supportedAlgorithms 890 #define OBJ_supportedAlgorithms OBJ_X509,52L #define LN_deltaRevocationList "deltaRevocationList" #define NID_deltaRevocationList 891 #define OBJ_deltaRevocationList OBJ_X509,53L #define SN_dmdName "dmdName" #define NID_dmdName 892 #define OBJ_dmdName OBJ_X509,54L #define LN_pseudonym "pseudonym" #define NID_pseudonym 510 #define OBJ_pseudonym OBJ_X509,65L #define SN_role "role" #define LN_role "role" #define NID_role 400 #define OBJ_role OBJ_X509,72L #define SN_X500algorithms "X500algorithms" #define LN_X500algorithms "directory services - algorithms" #define NID_X500algorithms 378 #define OBJ_X500algorithms OBJ_X500,8L #define SN_rsa "RSA" #define LN_rsa "rsa" #define NID_rsa 19 #define OBJ_rsa OBJ_X500algorithms,1L,1L #define SN_mdc2WithRSA "RSA-MDC2" #define LN_mdc2WithRSA "mdc2WithRSA" #define NID_mdc2WithRSA 96 #define OBJ_mdc2WithRSA OBJ_X500algorithms,3L,100L #define SN_mdc2 "MDC2" #define LN_mdc2 "mdc2" #define NID_mdc2 95 #define OBJ_mdc2 OBJ_X500algorithms,3L,101L #define SN_id_ce "id-ce" #define NID_id_ce 81 #define OBJ_id_ce OBJ_X500,29L #define SN_subject_directory_attributes "subjectDirectoryAttributes" #define LN_subject_directory_attributes "X509v3 Subject Directory Attributes" #define NID_subject_directory_attributes 769 #define OBJ_subject_directory_attributes OBJ_id_ce,9L #define SN_subject_key_identifier "subjectKeyIdentifier" #define LN_subject_key_identifier "X509v3 Subject Key Identifier" #define NID_subject_key_identifier 82 #define OBJ_subject_key_identifier OBJ_id_ce,14L #define SN_key_usage "keyUsage" #define LN_key_usage "X509v3 Key Usage" #define NID_key_usage 83 #define OBJ_key_usage OBJ_id_ce,15L #define SN_private_key_usage_period "privateKeyUsagePeriod" #define LN_private_key_usage_period "X509v3 Private Key Usage Period" #define NID_private_key_usage_period 84 #define OBJ_private_key_usage_period OBJ_id_ce,16L #define SN_subject_alt_name "subjectAltName" #define LN_subject_alt_name "X509v3 Subject Alternative Name" #define NID_subject_alt_name 85 #define OBJ_subject_alt_name OBJ_id_ce,17L #define SN_issuer_alt_name "issuerAltName" #define LN_issuer_alt_name "X509v3 Issuer Alternative Name" #define NID_issuer_alt_name 86 #define OBJ_issuer_alt_name OBJ_id_ce,18L #define SN_basic_constraints "basicConstraints" #define LN_basic_constraints "X509v3 Basic Constraints" #define NID_basic_constraints 87 #define OBJ_basic_constraints OBJ_id_ce,19L #define SN_crl_number "crlNumber" #define LN_crl_number "X509v3 CRL Number" #define NID_crl_number 88 #define OBJ_crl_number OBJ_id_ce,20L #define SN_crl_reason "CRLReason" #define LN_crl_reason "X509v3 CRL Reason Code" #define NID_crl_reason 141 #define OBJ_crl_reason OBJ_id_ce,21L #define SN_invalidity_date "invalidityDate" #define LN_invalidity_date "Invalidity Date" #define NID_invalidity_date 142 #define OBJ_invalidity_date OBJ_id_ce,24L #define SN_delta_crl "deltaCRL" #define LN_delta_crl "X509v3 Delta CRL Indicator" #define NID_delta_crl 140 #define OBJ_delta_crl OBJ_id_ce,27L #define SN_issuing_distribution_point "issuingDistributionPoint" #define LN_issuing_distribution_point "X509v3 Issuing Distrubution Point" #define NID_issuing_distribution_point 770 #define OBJ_issuing_distribution_point OBJ_id_ce,28L #define SN_certificate_issuer "certificateIssuer" #define LN_certificate_issuer "X509v3 Certificate Issuer" #define NID_certificate_issuer 771 #define OBJ_certificate_issuer OBJ_id_ce,29L #define SN_name_constraints "nameConstraints" #define LN_name_constraints "X509v3 Name Constraints" #define NID_name_constraints 666 #define OBJ_name_constraints OBJ_id_ce,30L #define SN_crl_distribution_points "crlDistributionPoints" #define LN_crl_distribution_points "X509v3 CRL Distribution Points" #define NID_crl_distribution_points 103 #define OBJ_crl_distribution_points OBJ_id_ce,31L #define SN_certificate_policies "certificatePolicies" #define LN_certificate_policies "X509v3 Certificate Policies" #define NID_certificate_policies 89 #define OBJ_certificate_policies OBJ_id_ce,32L #define SN_any_policy "anyPolicy" #define LN_any_policy "X509v3 Any Policy" #define NID_any_policy 746 #define OBJ_any_policy OBJ_certificate_policies,0L #define SN_policy_mappings "policyMappings" #define LN_policy_mappings "X509v3 Policy Mappings" #define NID_policy_mappings 747 #define OBJ_policy_mappings OBJ_id_ce,33L #define SN_authority_key_identifier "authorityKeyIdentifier" #define LN_authority_key_identifier "X509v3 Authority Key Identifier" #define NID_authority_key_identifier 90 #define OBJ_authority_key_identifier OBJ_id_ce,35L #define SN_policy_constraints "policyConstraints" #define LN_policy_constraints "X509v3 Policy Constraints" #define NID_policy_constraints 401 #define OBJ_policy_constraints OBJ_id_ce,36L #define SN_ext_key_usage "extendedKeyUsage" #define LN_ext_key_usage "X509v3 Extended Key Usage" #define NID_ext_key_usage 126 #define OBJ_ext_key_usage OBJ_id_ce,37L #define SN_freshest_crl "freshestCRL" #define LN_freshest_crl "X509v3 Freshest CRL" #define NID_freshest_crl 857 #define OBJ_freshest_crl OBJ_id_ce,46L #define SN_inhibit_any_policy "inhibitAnyPolicy" #define LN_inhibit_any_policy "X509v3 Inhibit Any Policy" #define NID_inhibit_any_policy 748 #define OBJ_inhibit_any_policy OBJ_id_ce,54L #define SN_target_information "targetInformation" #define LN_target_information "X509v3 AC Targeting" #define NID_target_information 402 #define OBJ_target_information OBJ_id_ce,55L #define SN_no_rev_avail "noRevAvail" #define LN_no_rev_avail "X509v3 No Revocation Available" #define NID_no_rev_avail 403 #define OBJ_no_rev_avail OBJ_id_ce,56L #define SN_anyExtendedKeyUsage "anyExtendedKeyUsage" #define LN_anyExtendedKeyUsage "Any Extended Key Usage" #define NID_anyExtendedKeyUsage 910 #define OBJ_anyExtendedKeyUsage OBJ_ext_key_usage,0L #define SN_netscape "Netscape" #define LN_netscape "Netscape Communications Corp." #define NID_netscape 57 #define OBJ_netscape 2L,16L,840L,1L,113730L #define SN_netscape_cert_extension "nsCertExt" #define LN_netscape_cert_extension "Netscape Certificate Extension" #define NID_netscape_cert_extension 58 #define OBJ_netscape_cert_extension OBJ_netscape,1L #define SN_netscape_data_type "nsDataType" #define LN_netscape_data_type "Netscape Data Type" #define NID_netscape_data_type 59 #define OBJ_netscape_data_type OBJ_netscape,2L #define SN_netscape_cert_type "nsCertType" #define LN_netscape_cert_type "Netscape Cert Type" #define NID_netscape_cert_type 71 #define OBJ_netscape_cert_type OBJ_netscape_cert_extension,1L #define SN_netscape_base_url "nsBaseUrl" #define LN_netscape_base_url "Netscape Base Url" #define NID_netscape_base_url 72 #define OBJ_netscape_base_url OBJ_netscape_cert_extension,2L #define SN_netscape_revocation_url "nsRevocationUrl" #define LN_netscape_revocation_url "Netscape Revocation Url" #define NID_netscape_revocation_url 73 #define OBJ_netscape_revocation_url OBJ_netscape_cert_extension,3L #define SN_netscape_ca_revocation_url "nsCaRevocationUrl" #define LN_netscape_ca_revocation_url "Netscape CA Revocation Url" #define NID_netscape_ca_revocation_url 74 #define OBJ_netscape_ca_revocation_url OBJ_netscape_cert_extension,4L #define SN_netscape_renewal_url "nsRenewalUrl" #define LN_netscape_renewal_url "Netscape Renewal Url" #define NID_netscape_renewal_url 75 #define OBJ_netscape_renewal_url OBJ_netscape_cert_extension,7L #define SN_netscape_ca_policy_url "nsCaPolicyUrl" #define LN_netscape_ca_policy_url "Netscape CA Policy Url" #define NID_netscape_ca_policy_url 76 #define OBJ_netscape_ca_policy_url OBJ_netscape_cert_extension,8L #define SN_netscape_ssl_server_name "nsSslServerName" #define LN_netscape_ssl_server_name "Netscape SSL Server Name" #define NID_netscape_ssl_server_name 77 #define OBJ_netscape_ssl_server_name OBJ_netscape_cert_extension,12L #define SN_netscape_comment "nsComment" #define LN_netscape_comment "Netscape Comment" #define NID_netscape_comment 78 #define OBJ_netscape_comment OBJ_netscape_cert_extension,13L #define SN_netscape_cert_sequence "nsCertSequence" #define LN_netscape_cert_sequence "Netscape Certificate Sequence" #define NID_netscape_cert_sequence 79 #define OBJ_netscape_cert_sequence OBJ_netscape_data_type,5L #define SN_ns_sgc "nsSGC" #define LN_ns_sgc "Netscape Server Gated Crypto" #define NID_ns_sgc 139 #define OBJ_ns_sgc OBJ_netscape,4L,1L #define SN_org "ORG" #define LN_org "org" #define NID_org 379 #define OBJ_org OBJ_iso,3L #define SN_dod "DOD" #define LN_dod "dod" #define NID_dod 380 #define OBJ_dod OBJ_org,6L #define SN_iana "IANA" #define LN_iana "iana" #define NID_iana 381 #define OBJ_iana OBJ_dod,1L #define OBJ_internet OBJ_iana #define SN_Directory "directory" #define LN_Directory "Directory" #define NID_Directory 382 #define OBJ_Directory OBJ_internet,1L #define SN_Management "mgmt" #define LN_Management "Management" #define NID_Management 383 #define OBJ_Management OBJ_internet,2L #define SN_Experimental "experimental" #define LN_Experimental "Experimental" #define NID_Experimental 384 #define OBJ_Experimental OBJ_internet,3L #define SN_Private "private" #define LN_Private "Private" #define NID_Private 385 #define OBJ_Private OBJ_internet,4L #define SN_Security "security" #define LN_Security "Security" #define NID_Security 386 #define OBJ_Security OBJ_internet,5L #define SN_SNMPv2 "snmpv2" #define LN_SNMPv2 "SNMPv2" #define NID_SNMPv2 387 #define OBJ_SNMPv2 OBJ_internet,6L #define LN_Mail "Mail" #define NID_Mail 388 #define OBJ_Mail OBJ_internet,7L #define SN_Enterprises "enterprises" #define LN_Enterprises "Enterprises" #define NID_Enterprises 389 #define OBJ_Enterprises OBJ_Private,1L #define SN_dcObject "dcobject" #define LN_dcObject "dcObject" #define NID_dcObject 390 #define OBJ_dcObject OBJ_Enterprises,1466L,344L #define SN_mime_mhs "mime-mhs" #define LN_mime_mhs "MIME MHS" #define NID_mime_mhs 504 #define OBJ_mime_mhs OBJ_Mail,1L #define SN_mime_mhs_headings "mime-mhs-headings" #define LN_mime_mhs_headings "mime-mhs-headings" #define NID_mime_mhs_headings 505 #define OBJ_mime_mhs_headings OBJ_mime_mhs,1L #define SN_mime_mhs_bodies "mime-mhs-bodies" #define LN_mime_mhs_bodies "mime-mhs-bodies" #define NID_mime_mhs_bodies 506 #define OBJ_mime_mhs_bodies OBJ_mime_mhs,2L #define SN_id_hex_partial_message "id-hex-partial-message" #define LN_id_hex_partial_message "id-hex-partial-message" #define NID_id_hex_partial_message 507 #define OBJ_id_hex_partial_message OBJ_mime_mhs_headings,1L #define SN_id_hex_multipart_message "id-hex-multipart-message" #define LN_id_hex_multipart_message "id-hex-multipart-message" #define NID_id_hex_multipart_message 508 #define OBJ_id_hex_multipart_message OBJ_mime_mhs_headings,2L #define SN_rle_compression "RLE" #define LN_rle_compression "run length compression" #define NID_rle_compression 124 #define OBJ_rle_compression 1L,1L,1L,1L,666L,1L #define SN_zlib_compression "ZLIB" #define LN_zlib_compression "zlib compression" #define NID_zlib_compression 125 #define OBJ_zlib_compression OBJ_id_smime_alg,8L #define OBJ_csor 2L,16L,840L,1L,101L,3L #define OBJ_nistAlgorithms OBJ_csor,4L #define OBJ_aes OBJ_nistAlgorithms,1L #define SN_aes_128_ecb "AES-128-ECB" #define LN_aes_128_ecb "aes-128-ecb" #define NID_aes_128_ecb 418 #define OBJ_aes_128_ecb OBJ_aes,1L #define SN_aes_128_cbc "AES-128-CBC" #define LN_aes_128_cbc "aes-128-cbc" #define NID_aes_128_cbc 419 #define OBJ_aes_128_cbc OBJ_aes,2L #define SN_aes_128_ofb128 "AES-128-OFB" #define LN_aes_128_ofb128 "aes-128-ofb" #define NID_aes_128_ofb128 420 #define OBJ_aes_128_ofb128 OBJ_aes,3L #define SN_aes_128_cfb128 "AES-128-CFB" #define LN_aes_128_cfb128 "aes-128-cfb" #define NID_aes_128_cfb128 421 #define OBJ_aes_128_cfb128 OBJ_aes,4L #define SN_id_aes128_wrap "id-aes128-wrap" #define NID_id_aes128_wrap 788 #define OBJ_id_aes128_wrap OBJ_aes,5L #define SN_aes_128_gcm "id-aes128-GCM" #define LN_aes_128_gcm "aes-128-gcm" #define NID_aes_128_gcm 895 #define OBJ_aes_128_gcm OBJ_aes,6L #define SN_aes_128_ccm "id-aes128-CCM" #define LN_aes_128_ccm "aes-128-ccm" #define NID_aes_128_ccm 896 #define OBJ_aes_128_ccm OBJ_aes,7L #define SN_id_aes128_wrap_pad "id-aes128-wrap-pad" #define NID_id_aes128_wrap_pad 897 #define OBJ_id_aes128_wrap_pad OBJ_aes,8L #define SN_aes_192_ecb "AES-192-ECB" #define LN_aes_192_ecb "aes-192-ecb" #define NID_aes_192_ecb 422 #define OBJ_aes_192_ecb OBJ_aes,21L #define SN_aes_192_cbc "AES-192-CBC" #define LN_aes_192_cbc "aes-192-cbc" #define NID_aes_192_cbc 423 #define OBJ_aes_192_cbc OBJ_aes,22L #define SN_aes_192_ofb128 "AES-192-OFB" #define LN_aes_192_ofb128 "aes-192-ofb" #define NID_aes_192_ofb128 424 #define OBJ_aes_192_ofb128 OBJ_aes,23L #define SN_aes_192_cfb128 "AES-192-CFB" #define LN_aes_192_cfb128 "aes-192-cfb" #define NID_aes_192_cfb128 425 #define OBJ_aes_192_cfb128 OBJ_aes,24L #define SN_id_aes192_wrap "id-aes192-wrap" #define NID_id_aes192_wrap 789 #define OBJ_id_aes192_wrap OBJ_aes,25L #define SN_aes_192_gcm "id-aes192-GCM" #define LN_aes_192_gcm "aes-192-gcm" #define NID_aes_192_gcm 898 #define OBJ_aes_192_gcm OBJ_aes,26L #define SN_aes_192_ccm "id-aes192-CCM" #define LN_aes_192_ccm "aes-192-ccm" #define NID_aes_192_ccm 899 #define OBJ_aes_192_ccm OBJ_aes,27L #define SN_id_aes192_wrap_pad "id-aes192-wrap-pad" #define NID_id_aes192_wrap_pad 900 #define OBJ_id_aes192_wrap_pad OBJ_aes,28L #define SN_aes_256_ecb "AES-256-ECB" #define LN_aes_256_ecb "aes-256-ecb" #define NID_aes_256_ecb 426 #define OBJ_aes_256_ecb OBJ_aes,41L #define SN_aes_256_cbc "AES-256-CBC" #define LN_aes_256_cbc "aes-256-cbc" #define NID_aes_256_cbc 427 #define OBJ_aes_256_cbc OBJ_aes,42L #define SN_aes_256_ofb128 "AES-256-OFB" #define LN_aes_256_ofb128 "aes-256-ofb" #define NID_aes_256_ofb128 428 #define OBJ_aes_256_ofb128 OBJ_aes,43L #define SN_aes_256_cfb128 "AES-256-CFB" #define LN_aes_256_cfb128 "aes-256-cfb" #define NID_aes_256_cfb128 429 #define OBJ_aes_256_cfb128 OBJ_aes,44L #define SN_id_aes256_wrap "id-aes256-wrap" #define NID_id_aes256_wrap 790 #define OBJ_id_aes256_wrap OBJ_aes,45L #define SN_aes_256_gcm "id-aes256-GCM" #define LN_aes_256_gcm "aes-256-gcm" #define NID_aes_256_gcm 901 #define OBJ_aes_256_gcm OBJ_aes,46L #define SN_aes_256_ccm "id-aes256-CCM" #define LN_aes_256_ccm "aes-256-ccm" #define NID_aes_256_ccm 902 #define OBJ_aes_256_ccm OBJ_aes,47L #define SN_id_aes256_wrap_pad "id-aes256-wrap-pad" #define NID_id_aes256_wrap_pad 903 #define OBJ_id_aes256_wrap_pad OBJ_aes,48L #define SN_aes_128_cfb1 "AES-128-CFB1" #define LN_aes_128_cfb1 "aes-128-cfb1" #define NID_aes_128_cfb1 650 #define SN_aes_192_cfb1 "AES-192-CFB1" #define LN_aes_192_cfb1 "aes-192-cfb1" #define NID_aes_192_cfb1 651 #define SN_aes_256_cfb1 "AES-256-CFB1" #define LN_aes_256_cfb1 "aes-256-cfb1" #define NID_aes_256_cfb1 652 #define SN_aes_128_cfb8 "AES-128-CFB8" #define LN_aes_128_cfb8 "aes-128-cfb8" #define NID_aes_128_cfb8 653 #define SN_aes_192_cfb8 "AES-192-CFB8" #define LN_aes_192_cfb8 "aes-192-cfb8" #define NID_aes_192_cfb8 654 #define SN_aes_256_cfb8 "AES-256-CFB8" #define LN_aes_256_cfb8 "aes-256-cfb8" #define NID_aes_256_cfb8 655 #define SN_aes_128_ctr "AES-128-CTR" #define LN_aes_128_ctr "aes-128-ctr" #define NID_aes_128_ctr 904 #define SN_aes_192_ctr "AES-192-CTR" #define LN_aes_192_ctr "aes-192-ctr" #define NID_aes_192_ctr 905 #define SN_aes_256_ctr "AES-256-CTR" #define LN_aes_256_ctr "aes-256-ctr" #define NID_aes_256_ctr 906 #define SN_aes_128_xts "AES-128-XTS" #define LN_aes_128_xts "aes-128-xts" #define NID_aes_128_xts 913 #define SN_aes_256_xts "AES-256-XTS" #define LN_aes_256_xts "aes-256-xts" #define NID_aes_256_xts 914 #define SN_des_cfb1 "DES-CFB1" #define LN_des_cfb1 "des-cfb1" #define NID_des_cfb1 656 #define SN_des_cfb8 "DES-CFB8" #define LN_des_cfb8 "des-cfb8" #define NID_des_cfb8 657 #define SN_des_ede3_cfb1 "DES-EDE3-CFB1" #define LN_des_ede3_cfb1 "des-ede3-cfb1" #define NID_des_ede3_cfb1 658 #define SN_des_ede3_cfb8 "DES-EDE3-CFB8" #define LN_des_ede3_cfb8 "des-ede3-cfb8" #define NID_des_ede3_cfb8 659 #define OBJ_nist_hashalgs OBJ_nistAlgorithms,2L #define SN_sha256 "SHA256" #define LN_sha256 "sha256" #define NID_sha256 672 #define OBJ_sha256 OBJ_nist_hashalgs,1L #define SN_sha384 "SHA384" #define LN_sha384 "sha384" #define NID_sha384 673 #define OBJ_sha384 OBJ_nist_hashalgs,2L #define SN_sha512 "SHA512" #define LN_sha512 "sha512" #define NID_sha512 674 #define OBJ_sha512 OBJ_nist_hashalgs,3L #define SN_sha224 "SHA224" #define LN_sha224 "sha224" #define NID_sha224 675 #define OBJ_sha224 OBJ_nist_hashalgs,4L #define OBJ_dsa_with_sha2 OBJ_nistAlgorithms,3L #define SN_dsa_with_SHA224 "dsa_with_SHA224" #define NID_dsa_with_SHA224 802 #define OBJ_dsa_with_SHA224 OBJ_dsa_with_sha2,1L #define SN_dsa_with_SHA256 "dsa_with_SHA256" #define NID_dsa_with_SHA256 803 #define OBJ_dsa_with_SHA256 OBJ_dsa_with_sha2,2L #define SN_hold_instruction_code "holdInstructionCode" #define LN_hold_instruction_code "Hold Instruction Code" #define NID_hold_instruction_code 430 #define OBJ_hold_instruction_code OBJ_id_ce,23L #define OBJ_holdInstruction OBJ_X9_57,2L #define SN_hold_instruction_none "holdInstructionNone" #define LN_hold_instruction_none "Hold Instruction None" #define NID_hold_instruction_none 431 #define OBJ_hold_instruction_none OBJ_holdInstruction,1L #define SN_hold_instruction_call_issuer "holdInstructionCallIssuer" #define LN_hold_instruction_call_issuer "Hold Instruction Call Issuer" #define NID_hold_instruction_call_issuer 432 #define OBJ_hold_instruction_call_issuer OBJ_holdInstruction,2L #define SN_hold_instruction_reject "holdInstructionReject" #define LN_hold_instruction_reject "Hold Instruction Reject" #define NID_hold_instruction_reject 433 #define OBJ_hold_instruction_reject OBJ_holdInstruction,3L #define SN_data "data" #define NID_data 434 #define OBJ_data OBJ_itu_t,9L #define SN_pss "pss" #define NID_pss 435 #define OBJ_pss OBJ_data,2342L #define SN_ucl "ucl" #define NID_ucl 436 #define OBJ_ucl OBJ_pss,19200300L #define SN_pilot "pilot" #define NID_pilot 437 #define OBJ_pilot OBJ_ucl,100L #define LN_pilotAttributeType "pilotAttributeType" #define NID_pilotAttributeType 438 #define OBJ_pilotAttributeType OBJ_pilot,1L #define LN_pilotAttributeSyntax "pilotAttributeSyntax" #define NID_pilotAttributeSyntax 439 #define OBJ_pilotAttributeSyntax OBJ_pilot,3L #define LN_pilotObjectClass "pilotObjectClass" #define NID_pilotObjectClass 440 #define OBJ_pilotObjectClass OBJ_pilot,4L #define LN_pilotGroups "pilotGroups" #define NID_pilotGroups 441 #define OBJ_pilotGroups OBJ_pilot,10L #define LN_iA5StringSyntax "iA5StringSyntax" #define NID_iA5StringSyntax 442 #define OBJ_iA5StringSyntax OBJ_pilotAttributeSyntax,4L #define LN_caseIgnoreIA5StringSyntax "caseIgnoreIA5StringSyntax" #define NID_caseIgnoreIA5StringSyntax 443 #define OBJ_caseIgnoreIA5StringSyntax OBJ_pilotAttributeSyntax,5L #define LN_pilotObject "pilotObject" #define NID_pilotObject 444 #define OBJ_pilotObject OBJ_pilotObjectClass,3L #define LN_pilotPerson "pilotPerson" #define NID_pilotPerson 445 #define OBJ_pilotPerson OBJ_pilotObjectClass,4L #define SN_account "account" #define NID_account 446 #define OBJ_account OBJ_pilotObjectClass,5L #define SN_document "document" #define NID_document 447 #define OBJ_document OBJ_pilotObjectClass,6L #define SN_room "room" #define NID_room 448 #define OBJ_room OBJ_pilotObjectClass,7L #define LN_documentSeries "documentSeries" #define NID_documentSeries 449 #define OBJ_documentSeries OBJ_pilotObjectClass,9L #define SN_Domain "domain" #define LN_Domain "Domain" #define NID_Domain 392 #define OBJ_Domain OBJ_pilotObjectClass,13L #define LN_rFC822localPart "rFC822localPart" #define NID_rFC822localPart 450 #define OBJ_rFC822localPart OBJ_pilotObjectClass,14L #define LN_dNSDomain "dNSDomain" #define NID_dNSDomain 451 #define OBJ_dNSDomain OBJ_pilotObjectClass,15L #define LN_domainRelatedObject "domainRelatedObject" #define NID_domainRelatedObject 452 #define OBJ_domainRelatedObject OBJ_pilotObjectClass,17L #define LN_friendlyCountry "friendlyCountry" #define NID_friendlyCountry 453 #define OBJ_friendlyCountry OBJ_pilotObjectClass,18L #define LN_simpleSecurityObject "simpleSecurityObject" #define NID_simpleSecurityObject 454 #define OBJ_simpleSecurityObject OBJ_pilotObjectClass,19L #define LN_pilotOrganization "pilotOrganization" #define NID_pilotOrganization 455 #define OBJ_pilotOrganization OBJ_pilotObjectClass,20L #define LN_pilotDSA "pilotDSA" #define NID_pilotDSA 456 #define OBJ_pilotDSA OBJ_pilotObjectClass,21L #define LN_qualityLabelledData "qualityLabelledData" #define NID_qualityLabelledData 457 #define OBJ_qualityLabelledData OBJ_pilotObjectClass,22L #define SN_userId "UID" #define LN_userId "userId" #define NID_userId 458 #define OBJ_userId OBJ_pilotAttributeType,1L #define LN_textEncodedORAddress "textEncodedORAddress" #define NID_textEncodedORAddress 459 #define OBJ_textEncodedORAddress OBJ_pilotAttributeType,2L #define SN_rfc822Mailbox "mail" #define LN_rfc822Mailbox "rfc822Mailbox" #define NID_rfc822Mailbox 460 #define OBJ_rfc822Mailbox OBJ_pilotAttributeType,3L #define SN_info "info" #define NID_info 461 #define OBJ_info OBJ_pilotAttributeType,4L #define LN_favouriteDrink "favouriteDrink" #define NID_favouriteDrink 462 #define OBJ_favouriteDrink OBJ_pilotAttributeType,5L #define LN_roomNumber "roomNumber" #define NID_roomNumber 463 #define OBJ_roomNumber OBJ_pilotAttributeType,6L #define SN_photo "photo" #define NID_photo 464 #define OBJ_photo OBJ_pilotAttributeType,7L #define LN_userClass "userClass" #define NID_userClass 465 #define OBJ_userClass OBJ_pilotAttributeType,8L #define SN_host "host" #define NID_host 466 #define OBJ_host OBJ_pilotAttributeType,9L #define SN_manager "manager" #define NID_manager 467 #define OBJ_manager OBJ_pilotAttributeType,10L #define LN_documentIdentifier "documentIdentifier" #define NID_documentIdentifier 468 #define OBJ_documentIdentifier OBJ_pilotAttributeType,11L #define LN_documentTitle "documentTitle" #define NID_documentTitle 469 #define OBJ_documentTitle OBJ_pilotAttributeType,12L #define LN_documentVersion "documentVersion" #define NID_documentVersion 470 #define OBJ_documentVersion OBJ_pilotAttributeType,13L #define LN_documentAuthor "documentAuthor" #define NID_documentAuthor 471 #define OBJ_documentAuthor OBJ_pilotAttributeType,14L #define LN_documentLocation "documentLocation" #define NID_documentLocation 472 #define OBJ_documentLocation OBJ_pilotAttributeType,15L #define LN_homeTelephoneNumber "homeTelephoneNumber" #define NID_homeTelephoneNumber 473 #define OBJ_homeTelephoneNumber OBJ_pilotAttributeType,20L #define SN_secretary "secretary" #define NID_secretary 474 #define OBJ_secretary OBJ_pilotAttributeType,21L #define LN_otherMailbox "otherMailbox" #define NID_otherMailbox 475 #define OBJ_otherMailbox OBJ_pilotAttributeType,22L #define LN_lastModifiedTime "lastModifiedTime" #define NID_lastModifiedTime 476 #define OBJ_lastModifiedTime OBJ_pilotAttributeType,23L #define LN_lastModifiedBy "lastModifiedBy" #define NID_lastModifiedBy 477 #define OBJ_lastModifiedBy OBJ_pilotAttributeType,24L #define SN_domainComponent "DC" #define LN_domainComponent "domainComponent" #define NID_domainComponent 391 #define OBJ_domainComponent OBJ_pilotAttributeType,25L #define LN_aRecord "aRecord" #define NID_aRecord 478 #define OBJ_aRecord OBJ_pilotAttributeType,26L #define LN_pilotAttributeType27 "pilotAttributeType27" #define NID_pilotAttributeType27 479 #define OBJ_pilotAttributeType27 OBJ_pilotAttributeType,27L #define LN_mXRecord "mXRecord" #define NID_mXRecord 480 #define OBJ_mXRecord OBJ_pilotAttributeType,28L #define LN_nSRecord "nSRecord" #define NID_nSRecord 481 #define OBJ_nSRecord OBJ_pilotAttributeType,29L #define LN_sOARecord "sOARecord" #define NID_sOARecord 482 #define OBJ_sOARecord OBJ_pilotAttributeType,30L #define LN_cNAMERecord "cNAMERecord" #define NID_cNAMERecord 483 #define OBJ_cNAMERecord OBJ_pilotAttributeType,31L #define LN_associatedDomain "associatedDomain" #define NID_associatedDomain 484 #define OBJ_associatedDomain OBJ_pilotAttributeType,37L #define LN_associatedName "associatedName" #define NID_associatedName 485 #define OBJ_associatedName OBJ_pilotAttributeType,38L #define LN_homePostalAddress "homePostalAddress" #define NID_homePostalAddress 486 #define OBJ_homePostalAddress OBJ_pilotAttributeType,39L #define LN_personalTitle "personalTitle" #define NID_personalTitle 487 #define OBJ_personalTitle OBJ_pilotAttributeType,40L #define LN_mobileTelephoneNumber "mobileTelephoneNumber" #define NID_mobileTelephoneNumber 488 #define OBJ_mobileTelephoneNumber OBJ_pilotAttributeType,41L #define LN_pagerTelephoneNumber "pagerTelephoneNumber" #define NID_pagerTelephoneNumber 489 #define OBJ_pagerTelephoneNumber OBJ_pilotAttributeType,42L #define LN_friendlyCountryName "friendlyCountryName" #define NID_friendlyCountryName 490 #define OBJ_friendlyCountryName OBJ_pilotAttributeType,43L #define LN_organizationalStatus "organizationalStatus" #define NID_organizationalStatus 491 #define OBJ_organizationalStatus OBJ_pilotAttributeType,45L #define LN_janetMailbox "janetMailbox" #define NID_janetMailbox 492 #define OBJ_janetMailbox OBJ_pilotAttributeType,46L #define LN_mailPreferenceOption "mailPreferenceOption" #define NID_mailPreferenceOption 493 #define OBJ_mailPreferenceOption OBJ_pilotAttributeType,47L #define LN_buildingName "buildingName" #define NID_buildingName 494 #define OBJ_buildingName OBJ_pilotAttributeType,48L #define LN_dSAQuality "dSAQuality" #define NID_dSAQuality 495 #define OBJ_dSAQuality OBJ_pilotAttributeType,49L #define LN_singleLevelQuality "singleLevelQuality" #define NID_singleLevelQuality 496 #define OBJ_singleLevelQuality OBJ_pilotAttributeType,50L #define LN_subtreeMinimumQuality "subtreeMinimumQuality" #define NID_subtreeMinimumQuality 497 #define OBJ_subtreeMinimumQuality OBJ_pilotAttributeType,51L #define LN_subtreeMaximumQuality "subtreeMaximumQuality" #define NID_subtreeMaximumQuality 498 #define OBJ_subtreeMaximumQuality OBJ_pilotAttributeType,52L #define LN_personalSignature "personalSignature" #define NID_personalSignature 499 #define OBJ_personalSignature OBJ_pilotAttributeType,53L #define LN_dITRedirect "dITRedirect" #define NID_dITRedirect 500 #define OBJ_dITRedirect OBJ_pilotAttributeType,54L #define SN_audio "audio" #define NID_audio 501 #define OBJ_audio OBJ_pilotAttributeType,55L #define LN_documentPublisher "documentPublisher" #define NID_documentPublisher 502 #define OBJ_documentPublisher OBJ_pilotAttributeType,56L #define SN_id_set "id-set" #define LN_id_set "Secure Electronic Transactions" #define NID_id_set 512 #define OBJ_id_set OBJ_international_organizations,42L #define SN_set_ctype "set-ctype" #define LN_set_ctype "content types" #define NID_set_ctype 513 #define OBJ_set_ctype OBJ_id_set,0L #define SN_set_msgExt "set-msgExt" #define LN_set_msgExt "message extensions" #define NID_set_msgExt 514 #define OBJ_set_msgExt OBJ_id_set,1L #define SN_set_attr "set-attr" #define NID_set_attr 515 #define OBJ_set_attr OBJ_id_set,3L #define SN_set_policy "set-policy" #define NID_set_policy 516 #define OBJ_set_policy OBJ_id_set,5L #define SN_set_certExt "set-certExt" #define LN_set_certExt "certificate extensions" #define NID_set_certExt 517 #define OBJ_set_certExt OBJ_id_set,7L #define SN_set_brand "set-brand" #define NID_set_brand 518 #define OBJ_set_brand OBJ_id_set,8L #define SN_setct_PANData "setct-PANData" #define NID_setct_PANData 519 #define OBJ_setct_PANData OBJ_set_ctype,0L #define SN_setct_PANToken "setct-PANToken" #define NID_setct_PANToken 520 #define OBJ_setct_PANToken OBJ_set_ctype,1L #define SN_setct_PANOnly "setct-PANOnly" #define NID_setct_PANOnly 521 #define OBJ_setct_PANOnly OBJ_set_ctype,2L #define SN_setct_OIData "setct-OIData" #define NID_setct_OIData 522 #define OBJ_setct_OIData OBJ_set_ctype,3L #define SN_setct_PI "setct-PI" #define NID_setct_PI 523 #define OBJ_setct_PI OBJ_set_ctype,4L #define SN_setct_PIData "setct-PIData" #define NID_setct_PIData 524 #define OBJ_setct_PIData OBJ_set_ctype,5L #define SN_setct_PIDataUnsigned "setct-PIDataUnsigned" #define NID_setct_PIDataUnsigned 525 #define OBJ_setct_PIDataUnsigned OBJ_set_ctype,6L #define SN_setct_HODInput "setct-HODInput" #define NID_setct_HODInput 526 #define OBJ_setct_HODInput OBJ_set_ctype,7L #define SN_setct_AuthResBaggage "setct-AuthResBaggage" #define NID_setct_AuthResBaggage 527 #define OBJ_setct_AuthResBaggage OBJ_set_ctype,8L #define SN_setct_AuthRevReqBaggage "setct-AuthRevReqBaggage" #define NID_setct_AuthRevReqBaggage 528 #define OBJ_setct_AuthRevReqBaggage OBJ_set_ctype,9L #define SN_setct_AuthRevResBaggage "setct-AuthRevResBaggage" #define NID_setct_AuthRevResBaggage 529 #define OBJ_setct_AuthRevResBaggage OBJ_set_ctype,10L #define SN_setct_CapTokenSeq "setct-CapTokenSeq" #define NID_setct_CapTokenSeq 530 #define OBJ_setct_CapTokenSeq OBJ_set_ctype,11L #define SN_setct_PInitResData "setct-PInitResData" #define NID_setct_PInitResData 531 #define OBJ_setct_PInitResData OBJ_set_ctype,12L #define SN_setct_PI_TBS "setct-PI-TBS" #define NID_setct_PI_TBS 532 #define OBJ_setct_PI_TBS OBJ_set_ctype,13L #define SN_setct_PResData "setct-PResData" #define NID_setct_PResData 533 #define OBJ_setct_PResData OBJ_set_ctype,14L #define SN_setct_AuthReqTBS "setct-AuthReqTBS" #define NID_setct_AuthReqTBS 534 #define OBJ_setct_AuthReqTBS OBJ_set_ctype,16L #define SN_setct_AuthResTBS "setct-AuthResTBS" #define NID_setct_AuthResTBS 535 #define OBJ_setct_AuthResTBS OBJ_set_ctype,17L #define SN_setct_AuthResTBSX "setct-AuthResTBSX" #define NID_setct_AuthResTBSX 536 #define OBJ_setct_AuthResTBSX OBJ_set_ctype,18L #define SN_setct_AuthTokenTBS "setct-AuthTokenTBS" #define NID_setct_AuthTokenTBS 537 #define OBJ_setct_AuthTokenTBS OBJ_set_ctype,19L #define SN_setct_CapTokenData "setct-CapTokenData" #define NID_setct_CapTokenData 538 #define OBJ_setct_CapTokenData OBJ_set_ctype,20L #define SN_setct_CapTokenTBS "setct-CapTokenTBS" #define NID_setct_CapTokenTBS 539 #define OBJ_setct_CapTokenTBS OBJ_set_ctype,21L #define SN_setct_AcqCardCodeMsg "setct-AcqCardCodeMsg" #define NID_setct_AcqCardCodeMsg 540 #define OBJ_setct_AcqCardCodeMsg OBJ_set_ctype,22L #define SN_setct_AuthRevReqTBS "setct-AuthRevReqTBS" #define NID_setct_AuthRevReqTBS 541 #define OBJ_setct_AuthRevReqTBS OBJ_set_ctype,23L #define SN_setct_AuthRevResData "setct-AuthRevResData" #define NID_setct_AuthRevResData 542 #define OBJ_setct_AuthRevResData OBJ_set_ctype,24L #define SN_setct_AuthRevResTBS "setct-AuthRevResTBS" #define NID_setct_AuthRevResTBS 543 #define OBJ_setct_AuthRevResTBS OBJ_set_ctype,25L #define SN_setct_CapReqTBS "setct-CapReqTBS" #define NID_setct_CapReqTBS 544 #define OBJ_setct_CapReqTBS OBJ_set_ctype,26L #define SN_setct_CapReqTBSX "setct-CapReqTBSX" #define NID_setct_CapReqTBSX 545 #define OBJ_setct_CapReqTBSX OBJ_set_ctype,27L #define SN_setct_CapResData "setct-CapResData" #define NID_setct_CapResData 546 #define OBJ_setct_CapResData OBJ_set_ctype,28L #define SN_setct_CapRevReqTBS "setct-CapRevReqTBS" #define NID_setct_CapRevReqTBS 547 #define OBJ_setct_CapRevReqTBS OBJ_set_ctype,29L #define SN_setct_CapRevReqTBSX "setct-CapRevReqTBSX" #define NID_setct_CapRevReqTBSX 548 #define OBJ_setct_CapRevReqTBSX OBJ_set_ctype,30L #define SN_setct_CapRevResData "setct-CapRevResData" #define NID_setct_CapRevResData 549 #define OBJ_setct_CapRevResData OBJ_set_ctype,31L #define SN_setct_CredReqTBS "setct-CredReqTBS" #define NID_setct_CredReqTBS 550 #define OBJ_setct_CredReqTBS OBJ_set_ctype,32L #define SN_setct_CredReqTBSX "setct-CredReqTBSX" #define NID_setct_CredReqTBSX 551 #define OBJ_setct_CredReqTBSX OBJ_set_ctype,33L #define SN_setct_CredResData "setct-CredResData" #define NID_setct_CredResData 552 #define OBJ_setct_CredResData OBJ_set_ctype,34L #define SN_setct_CredRevReqTBS "setct-CredRevReqTBS" #define NID_setct_CredRevReqTBS 553 #define OBJ_setct_CredRevReqTBS OBJ_set_ctype,35L #define SN_setct_CredRevReqTBSX "setct-CredRevReqTBSX" #define NID_setct_CredRevReqTBSX 554 #define OBJ_setct_CredRevReqTBSX OBJ_set_ctype,36L #define SN_setct_CredRevResData "setct-CredRevResData" #define NID_setct_CredRevResData 555 #define OBJ_setct_CredRevResData OBJ_set_ctype,37L #define SN_setct_PCertReqData "setct-PCertReqData" #define NID_setct_PCertReqData 556 #define OBJ_setct_PCertReqData OBJ_set_ctype,38L #define SN_setct_PCertResTBS "setct-PCertResTBS" #define NID_setct_PCertResTBS 557 #define OBJ_setct_PCertResTBS OBJ_set_ctype,39L #define SN_setct_BatchAdminReqData "setct-BatchAdminReqData" #define NID_setct_BatchAdminReqData 558 #define OBJ_setct_BatchAdminReqData OBJ_set_ctype,40L #define SN_setct_BatchAdminResData "setct-BatchAdminResData" #define NID_setct_BatchAdminResData 559 #define OBJ_setct_BatchAdminResData OBJ_set_ctype,41L #define SN_setct_CardCInitResTBS "setct-CardCInitResTBS" #define NID_setct_CardCInitResTBS 560 #define OBJ_setct_CardCInitResTBS OBJ_set_ctype,42L #define SN_setct_MeAqCInitResTBS "setct-MeAqCInitResTBS" #define NID_setct_MeAqCInitResTBS 561 #define OBJ_setct_MeAqCInitResTBS OBJ_set_ctype,43L #define SN_setct_RegFormResTBS "setct-RegFormResTBS" #define NID_setct_RegFormResTBS 562 #define OBJ_setct_RegFormResTBS OBJ_set_ctype,44L #define SN_setct_CertReqData "setct-CertReqData" #define NID_setct_CertReqData 563 #define OBJ_setct_CertReqData OBJ_set_ctype,45L #define SN_setct_CertReqTBS "setct-CertReqTBS" #define NID_setct_CertReqTBS 564 #define OBJ_setct_CertReqTBS OBJ_set_ctype,46L #define SN_setct_CertResData "setct-CertResData" #define NID_setct_CertResData 565 #define OBJ_setct_CertResData OBJ_set_ctype,47L #define SN_setct_CertInqReqTBS "setct-CertInqReqTBS" #define NID_setct_CertInqReqTBS 566 #define OBJ_setct_CertInqReqTBS OBJ_set_ctype,48L #define SN_setct_ErrorTBS "setct-ErrorTBS" #define NID_setct_ErrorTBS 567 #define OBJ_setct_ErrorTBS OBJ_set_ctype,49L #define SN_setct_PIDualSignedTBE "setct-PIDualSignedTBE" #define NID_setct_PIDualSignedTBE 568 #define OBJ_setct_PIDualSignedTBE OBJ_set_ctype,50L #define SN_setct_PIUnsignedTBE "setct-PIUnsignedTBE" #define NID_setct_PIUnsignedTBE 569 #define OBJ_setct_PIUnsignedTBE OBJ_set_ctype,51L #define SN_setct_AuthReqTBE "setct-AuthReqTBE" #define NID_setct_AuthReqTBE 570 #define OBJ_setct_AuthReqTBE OBJ_set_ctype,52L #define SN_setct_AuthResTBE "setct-AuthResTBE" #define NID_setct_AuthResTBE 571 #define OBJ_setct_AuthResTBE OBJ_set_ctype,53L #define SN_setct_AuthResTBEX "setct-AuthResTBEX" #define NID_setct_AuthResTBEX 572 #define OBJ_setct_AuthResTBEX OBJ_set_ctype,54L #define SN_setct_AuthTokenTBE "setct-AuthTokenTBE" #define NID_setct_AuthTokenTBE 573 #define OBJ_setct_AuthTokenTBE OBJ_set_ctype,55L #define SN_setct_CapTokenTBE "setct-CapTokenTBE" #define NID_setct_CapTokenTBE 574 #define OBJ_setct_CapTokenTBE OBJ_set_ctype,56L #define SN_setct_CapTokenTBEX "setct-CapTokenTBEX" #define NID_setct_CapTokenTBEX 575 #define OBJ_setct_CapTokenTBEX OBJ_set_ctype,57L #define SN_setct_AcqCardCodeMsgTBE "setct-AcqCardCodeMsgTBE" #define NID_setct_AcqCardCodeMsgTBE 576 #define OBJ_setct_AcqCardCodeMsgTBE OBJ_set_ctype,58L #define SN_setct_AuthRevReqTBE "setct-AuthRevReqTBE" #define NID_setct_AuthRevReqTBE 577 #define OBJ_setct_AuthRevReqTBE OBJ_set_ctype,59L #define SN_setct_AuthRevResTBE "setct-AuthRevResTBE" #define NID_setct_AuthRevResTBE 578 #define OBJ_setct_AuthRevResTBE OBJ_set_ctype,60L #define SN_setct_AuthRevResTBEB "setct-AuthRevResTBEB" #define NID_setct_AuthRevResTBEB 579 #define OBJ_setct_AuthRevResTBEB OBJ_set_ctype,61L #define SN_setct_CapReqTBE "setct-CapReqTBE" #define NID_setct_CapReqTBE 580 #define OBJ_setct_CapReqTBE OBJ_set_ctype,62L #define SN_setct_CapReqTBEX "setct-CapReqTBEX" #define NID_setct_CapReqTBEX 581 #define OBJ_setct_CapReqTBEX OBJ_set_ctype,63L #define SN_setct_CapResTBE "setct-CapResTBE" #define NID_setct_CapResTBE 582 #define OBJ_setct_CapResTBE OBJ_set_ctype,64L #define SN_setct_CapRevReqTBE "setct-CapRevReqTBE" #define NID_setct_CapRevReqTBE 583 #define OBJ_setct_CapRevReqTBE OBJ_set_ctype,65L #define SN_setct_CapRevReqTBEX "setct-CapRevReqTBEX" #define NID_setct_CapRevReqTBEX 584 #define OBJ_setct_CapRevReqTBEX OBJ_set_ctype,66L #define SN_setct_CapRevResTBE "setct-CapRevResTBE" #define NID_setct_CapRevResTBE 585 #define OBJ_setct_CapRevResTBE OBJ_set_ctype,67L #define SN_setct_CredReqTBE "setct-CredReqTBE" #define NID_setct_CredReqTBE 586 #define OBJ_setct_CredReqTBE OBJ_set_ctype,68L #define SN_setct_CredReqTBEX "setct-CredReqTBEX" #define NID_setct_CredReqTBEX 587 #define OBJ_setct_CredReqTBEX OBJ_set_ctype,69L #define SN_setct_CredResTBE "setct-CredResTBE" #define NID_setct_CredResTBE 588 #define OBJ_setct_CredResTBE OBJ_set_ctype,70L #define SN_setct_CredRevReqTBE "setct-CredRevReqTBE" #define NID_setct_CredRevReqTBE 589 #define OBJ_setct_CredRevReqTBE OBJ_set_ctype,71L #define SN_setct_CredRevReqTBEX "setct-CredRevReqTBEX" #define NID_setct_CredRevReqTBEX 590 #define OBJ_setct_CredRevReqTBEX OBJ_set_ctype,72L #define SN_setct_CredRevResTBE "setct-CredRevResTBE" #define NID_setct_CredRevResTBE 591 #define OBJ_setct_CredRevResTBE OBJ_set_ctype,73L #define SN_setct_BatchAdminReqTBE "setct-BatchAdminReqTBE" #define NID_setct_BatchAdminReqTBE 592 #define OBJ_setct_BatchAdminReqTBE OBJ_set_ctype,74L #define SN_setct_BatchAdminResTBE "setct-BatchAdminResTBE" #define NID_setct_BatchAdminResTBE 593 #define OBJ_setct_BatchAdminResTBE OBJ_set_ctype,75L #define SN_setct_RegFormReqTBE "setct-RegFormReqTBE" #define NID_setct_RegFormReqTBE 594 #define OBJ_setct_RegFormReqTBE OBJ_set_ctype,76L #define SN_setct_CertReqTBE "setct-CertReqTBE" #define NID_setct_CertReqTBE 595 #define OBJ_setct_CertReqTBE OBJ_set_ctype,77L #define SN_setct_CertReqTBEX "setct-CertReqTBEX" #define NID_setct_CertReqTBEX 596 #define OBJ_setct_CertReqTBEX OBJ_set_ctype,78L #define SN_setct_CertResTBE "setct-CertResTBE" #define NID_setct_CertResTBE 597 #define OBJ_setct_CertResTBE OBJ_set_ctype,79L #define SN_setct_CRLNotificationTBS "setct-CRLNotificationTBS" #define NID_setct_CRLNotificationTBS 598 #define OBJ_setct_CRLNotificationTBS OBJ_set_ctype,80L #define SN_setct_CRLNotificationResTBS "setct-CRLNotificationResTBS" #define NID_setct_CRLNotificationResTBS 599 #define OBJ_setct_CRLNotificationResTBS OBJ_set_ctype,81L #define SN_setct_BCIDistributionTBS "setct-BCIDistributionTBS" #define NID_setct_BCIDistributionTBS 600 #define OBJ_setct_BCIDistributionTBS OBJ_set_ctype,82L #define SN_setext_genCrypt "setext-genCrypt" #define LN_setext_genCrypt "generic cryptogram" #define NID_setext_genCrypt 601 #define OBJ_setext_genCrypt OBJ_set_msgExt,1L #define SN_setext_miAuth "setext-miAuth" #define LN_setext_miAuth "merchant initiated auth" #define NID_setext_miAuth 602 #define OBJ_setext_miAuth OBJ_set_msgExt,3L #define SN_setext_pinSecure "setext-pinSecure" #define NID_setext_pinSecure 603 #define OBJ_setext_pinSecure OBJ_set_msgExt,4L #define SN_setext_pinAny "setext-pinAny" #define NID_setext_pinAny 604 #define OBJ_setext_pinAny OBJ_set_msgExt,5L #define SN_setext_track2 "setext-track2" #define NID_setext_track2 605 #define OBJ_setext_track2 OBJ_set_msgExt,7L #define SN_setext_cv "setext-cv" #define LN_setext_cv "additional verification" #define NID_setext_cv 606 #define OBJ_setext_cv OBJ_set_msgExt,8L #define SN_set_policy_root "set-policy-root" #define NID_set_policy_root 607 #define OBJ_set_policy_root OBJ_set_policy,0L #define SN_setCext_hashedRoot "setCext-hashedRoot" #define NID_setCext_hashedRoot 608 #define OBJ_setCext_hashedRoot OBJ_set_certExt,0L #define SN_setCext_certType "setCext-certType" #define NID_setCext_certType 609 #define OBJ_setCext_certType OBJ_set_certExt,1L #define SN_setCext_merchData "setCext-merchData" #define NID_setCext_merchData 610 #define OBJ_setCext_merchData OBJ_set_certExt,2L #define SN_setCext_cCertRequired "setCext-cCertRequired" #define NID_setCext_cCertRequired 611 #define OBJ_setCext_cCertRequired OBJ_set_certExt,3L #define SN_setCext_tunneling "setCext-tunneling" #define NID_setCext_tunneling 612 #define OBJ_setCext_tunneling OBJ_set_certExt,4L #define SN_setCext_setExt "setCext-setExt" #define NID_setCext_setExt 613 #define OBJ_setCext_setExt OBJ_set_certExt,5L #define SN_setCext_setQualf "setCext-setQualf" #define NID_setCext_setQualf 614 #define OBJ_setCext_setQualf OBJ_set_certExt,6L #define SN_setCext_PGWYcapabilities "setCext-PGWYcapabilities" #define NID_setCext_PGWYcapabilities 615 #define OBJ_setCext_PGWYcapabilities OBJ_set_certExt,7L #define SN_setCext_TokenIdentifier "setCext-TokenIdentifier" #define NID_setCext_TokenIdentifier 616 #define OBJ_setCext_TokenIdentifier OBJ_set_certExt,8L #define SN_setCext_Track2Data "setCext-Track2Data" #define NID_setCext_Track2Data 617 #define OBJ_setCext_Track2Data OBJ_set_certExt,9L #define SN_setCext_TokenType "setCext-TokenType" #define NID_setCext_TokenType 618 #define OBJ_setCext_TokenType OBJ_set_certExt,10L #define SN_setCext_IssuerCapabilities "setCext-IssuerCapabilities" #define NID_setCext_IssuerCapabilities 619 #define OBJ_setCext_IssuerCapabilities OBJ_set_certExt,11L #define SN_setAttr_Cert "setAttr-Cert" #define NID_setAttr_Cert 620 #define OBJ_setAttr_Cert OBJ_set_attr,0L #define SN_setAttr_PGWYcap "setAttr-PGWYcap" #define LN_setAttr_PGWYcap "payment gateway capabilities" #define NID_setAttr_PGWYcap 621 #define OBJ_setAttr_PGWYcap OBJ_set_attr,1L #define SN_setAttr_TokenType "setAttr-TokenType" #define NID_setAttr_TokenType 622 #define OBJ_setAttr_TokenType OBJ_set_attr,2L #define SN_setAttr_IssCap "setAttr-IssCap" #define LN_setAttr_IssCap "issuer capabilities" #define NID_setAttr_IssCap 623 #define OBJ_setAttr_IssCap OBJ_set_attr,3L #define SN_set_rootKeyThumb "set-rootKeyThumb" #define NID_set_rootKeyThumb 624 #define OBJ_set_rootKeyThumb OBJ_setAttr_Cert,0L #define SN_set_addPolicy "set-addPolicy" #define NID_set_addPolicy 625 #define OBJ_set_addPolicy OBJ_setAttr_Cert,1L #define SN_setAttr_Token_EMV "setAttr-Token-EMV" #define NID_setAttr_Token_EMV 626 #define OBJ_setAttr_Token_EMV OBJ_setAttr_TokenType,1L #define SN_setAttr_Token_B0Prime "setAttr-Token-B0Prime" #define NID_setAttr_Token_B0Prime 627 #define OBJ_setAttr_Token_B0Prime OBJ_setAttr_TokenType,2L #define SN_setAttr_IssCap_CVM "setAttr-IssCap-CVM" #define NID_setAttr_IssCap_CVM 628 #define OBJ_setAttr_IssCap_CVM OBJ_setAttr_IssCap,3L #define SN_setAttr_IssCap_T2 "setAttr-IssCap-T2" #define NID_setAttr_IssCap_T2 629 #define OBJ_setAttr_IssCap_T2 OBJ_setAttr_IssCap,4L #define SN_setAttr_IssCap_Sig "setAttr-IssCap-Sig" #define NID_setAttr_IssCap_Sig 630 #define OBJ_setAttr_IssCap_Sig OBJ_setAttr_IssCap,5L #define SN_setAttr_GenCryptgrm "setAttr-GenCryptgrm" #define LN_setAttr_GenCryptgrm "generate cryptogram" #define NID_setAttr_GenCryptgrm 631 #define OBJ_setAttr_GenCryptgrm OBJ_setAttr_IssCap_CVM,1L #define SN_setAttr_T2Enc "setAttr-T2Enc" #define LN_setAttr_T2Enc "encrypted track 2" #define NID_setAttr_T2Enc 632 #define OBJ_setAttr_T2Enc OBJ_setAttr_IssCap_T2,1L #define SN_setAttr_T2cleartxt "setAttr-T2cleartxt" #define LN_setAttr_T2cleartxt "cleartext track 2" #define NID_setAttr_T2cleartxt 633 #define OBJ_setAttr_T2cleartxt OBJ_setAttr_IssCap_T2,2L #define SN_setAttr_TokICCsig "setAttr-TokICCsig" #define LN_setAttr_TokICCsig "ICC or token signature" #define NID_setAttr_TokICCsig 634 #define OBJ_setAttr_TokICCsig OBJ_setAttr_IssCap_Sig,1L #define SN_setAttr_SecDevSig "setAttr-SecDevSig" #define LN_setAttr_SecDevSig "secure device signature" #define NID_setAttr_SecDevSig 635 #define OBJ_setAttr_SecDevSig OBJ_setAttr_IssCap_Sig,2L #define SN_set_brand_IATA_ATA "set-brand-IATA-ATA" #define NID_set_brand_IATA_ATA 636 #define OBJ_set_brand_IATA_ATA OBJ_set_brand,1L #define SN_set_brand_Diners "set-brand-Diners" #define NID_set_brand_Diners 637 #define OBJ_set_brand_Diners OBJ_set_brand,30L #define SN_set_brand_AmericanExpress "set-brand-AmericanExpress" #define NID_set_brand_AmericanExpress 638 #define OBJ_set_brand_AmericanExpress OBJ_set_brand,34L #define SN_set_brand_JCB "set-brand-JCB" #define NID_set_brand_JCB 639 #define OBJ_set_brand_JCB OBJ_set_brand,35L #define SN_set_brand_Visa "set-brand-Visa" #define NID_set_brand_Visa 640 #define OBJ_set_brand_Visa OBJ_set_brand,4L #define SN_set_brand_MasterCard "set-brand-MasterCard" #define NID_set_brand_MasterCard 641 #define OBJ_set_brand_MasterCard OBJ_set_brand,5L #define SN_set_brand_Novus "set-brand-Novus" #define NID_set_brand_Novus 642 #define OBJ_set_brand_Novus OBJ_set_brand,6011L #define SN_des_cdmf "DES-CDMF" #define LN_des_cdmf "des-cdmf" #define NID_des_cdmf 643 #define OBJ_des_cdmf OBJ_rsadsi,3L,10L #define SN_rsaOAEPEncryptionSET "rsaOAEPEncryptionSET" #define NID_rsaOAEPEncryptionSET 644 #define OBJ_rsaOAEPEncryptionSET OBJ_rsadsi,1L,1L,6L #define SN_ipsec3 "Oakley-EC2N-3" #define LN_ipsec3 "ipsec3" #define NID_ipsec3 749 #define SN_ipsec4 "Oakley-EC2N-4" #define LN_ipsec4 "ipsec4" #define NID_ipsec4 750 #define SN_whirlpool "whirlpool" #define NID_whirlpool 804 #define OBJ_whirlpool OBJ_iso,0L,10118L,3L,0L,55L #define SN_cryptopro "cryptopro" #define NID_cryptopro 805 #define OBJ_cryptopro OBJ_member_body,643L,2L,2L #define SN_cryptocom "cryptocom" #define NID_cryptocom 806 #define OBJ_cryptocom OBJ_member_body,643L,2L,9L #define SN_id_GostR3411_94_with_GostR3410_2001 "id-GostR3411-94-with-GostR3410-2001" #define LN_id_GostR3411_94_with_GostR3410_2001 "GOST R 34.11-94 with GOST R 34.10-2001" #define NID_id_GostR3411_94_with_GostR3410_2001 807 #define OBJ_id_GostR3411_94_with_GostR3410_2001 OBJ_cryptopro,3L #define SN_id_GostR3411_94_with_GostR3410_94 "id-GostR3411-94-with-GostR3410-94" #define LN_id_GostR3411_94_with_GostR3410_94 "GOST R 34.11-94 with GOST R 34.10-94" #define NID_id_GostR3411_94_with_GostR3410_94 808 #define OBJ_id_GostR3411_94_with_GostR3410_94 OBJ_cryptopro,4L #define SN_id_GostR3411_94 "md_gost94" #define LN_id_GostR3411_94 "GOST R 34.11-94" #define NID_id_GostR3411_94 809 #define OBJ_id_GostR3411_94 OBJ_cryptopro,9L #define SN_id_HMACGostR3411_94 "id-HMACGostR3411-94" #define LN_id_HMACGostR3411_94 "HMAC GOST 34.11-94" #define NID_id_HMACGostR3411_94 810 #define OBJ_id_HMACGostR3411_94 OBJ_cryptopro,10L #define SN_id_GostR3410_2001 "gost2001" #define LN_id_GostR3410_2001 "GOST R 34.10-2001" #define NID_id_GostR3410_2001 811 #define OBJ_id_GostR3410_2001 OBJ_cryptopro,19L #define SN_id_GostR3410_94 "gost94" #define LN_id_GostR3410_94 "GOST R 34.10-94" #define NID_id_GostR3410_94 812 #define OBJ_id_GostR3410_94 OBJ_cryptopro,20L #define SN_id_Gost28147_89 "gost89" #define LN_id_Gost28147_89 "GOST 28147-89" #define NID_id_Gost28147_89 813 #define OBJ_id_Gost28147_89 OBJ_cryptopro,21L #define SN_gost89_cnt "gost89-cnt" #define NID_gost89_cnt 814 #define SN_id_Gost28147_89_MAC "gost-mac" #define LN_id_Gost28147_89_MAC "GOST 28147-89 MAC" #define NID_id_Gost28147_89_MAC 815 #define OBJ_id_Gost28147_89_MAC OBJ_cryptopro,22L #define SN_id_GostR3411_94_prf "prf-gostr3411-94" #define LN_id_GostR3411_94_prf "GOST R 34.11-94 PRF" #define NID_id_GostR3411_94_prf 816 #define OBJ_id_GostR3411_94_prf OBJ_cryptopro,23L #define SN_id_GostR3410_2001DH "id-GostR3410-2001DH" #define LN_id_GostR3410_2001DH "GOST R 34.10-2001 DH" #define NID_id_GostR3410_2001DH 817 #define OBJ_id_GostR3410_2001DH OBJ_cryptopro,98L #define SN_id_GostR3410_94DH "id-GostR3410-94DH" #define LN_id_GostR3410_94DH "GOST R 34.10-94 DH" #define NID_id_GostR3410_94DH 818 #define OBJ_id_GostR3410_94DH OBJ_cryptopro,99L #define SN_id_Gost28147_89_CryptoPro_KeyMeshing "id-Gost28147-89-CryptoPro-KeyMeshing" #define NID_id_Gost28147_89_CryptoPro_KeyMeshing 819 #define OBJ_id_Gost28147_89_CryptoPro_KeyMeshing OBJ_cryptopro,14L,1L #define SN_id_Gost28147_89_None_KeyMeshing "id-Gost28147-89-None-KeyMeshing" #define NID_id_Gost28147_89_None_KeyMeshing 820 #define OBJ_id_Gost28147_89_None_KeyMeshing OBJ_cryptopro,14L,0L #define SN_id_GostR3411_94_TestParamSet "id-GostR3411-94-TestParamSet" #define NID_id_GostR3411_94_TestParamSet 821 #define OBJ_id_GostR3411_94_TestParamSet OBJ_cryptopro,30L,0L #define SN_id_GostR3411_94_CryptoProParamSet "id-GostR3411-94-CryptoProParamSet" #define NID_id_GostR3411_94_CryptoProParamSet 822 #define OBJ_id_GostR3411_94_CryptoProParamSet OBJ_cryptopro,30L,1L #define SN_id_Gost28147_89_TestParamSet "id-Gost28147-89-TestParamSet" #define NID_id_Gost28147_89_TestParamSet 823 #define OBJ_id_Gost28147_89_TestParamSet OBJ_cryptopro,31L,0L #define SN_id_Gost28147_89_CryptoPro_A_ParamSet "id-Gost28147-89-CryptoPro-A-ParamSet" #define NID_id_Gost28147_89_CryptoPro_A_ParamSet 824 #define OBJ_id_Gost28147_89_CryptoPro_A_ParamSet OBJ_cryptopro,31L,1L #define SN_id_Gost28147_89_CryptoPro_B_ParamSet "id-Gost28147-89-CryptoPro-B-ParamSet" #define NID_id_Gost28147_89_CryptoPro_B_ParamSet 825 #define OBJ_id_Gost28147_89_CryptoPro_B_ParamSet OBJ_cryptopro,31L,2L #define SN_id_Gost28147_89_CryptoPro_C_ParamSet "id-Gost28147-89-CryptoPro-C-ParamSet" #define NID_id_Gost28147_89_CryptoPro_C_ParamSet 826 #define OBJ_id_Gost28147_89_CryptoPro_C_ParamSet OBJ_cryptopro,31L,3L #define SN_id_Gost28147_89_CryptoPro_D_ParamSet "id-Gost28147-89-CryptoPro-D-ParamSet" #define NID_id_Gost28147_89_CryptoPro_D_ParamSet 827 #define OBJ_id_Gost28147_89_CryptoPro_D_ParamSet OBJ_cryptopro,31L,4L #define SN_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet" #define NID_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet 828 #define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet OBJ_cryptopro,31L,5L #define SN_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet" #define NID_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet 829 #define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet OBJ_cryptopro,31L,6L #define SN_id_Gost28147_89_CryptoPro_RIC_1_ParamSet "id-Gost28147-89-CryptoPro-RIC-1-ParamSet" #define NID_id_Gost28147_89_CryptoPro_RIC_1_ParamSet 830 #define OBJ_id_Gost28147_89_CryptoPro_RIC_1_ParamSet OBJ_cryptopro,31L,7L #define SN_id_GostR3410_94_TestParamSet "id-GostR3410-94-TestParamSet" #define NID_id_GostR3410_94_TestParamSet 831 #define OBJ_id_GostR3410_94_TestParamSet OBJ_cryptopro,32L,0L #define SN_id_GostR3410_94_CryptoPro_A_ParamSet "id-GostR3410-94-CryptoPro-A-ParamSet" #define NID_id_GostR3410_94_CryptoPro_A_ParamSet 832 #define OBJ_id_GostR3410_94_CryptoPro_A_ParamSet OBJ_cryptopro,32L,2L #define SN_id_GostR3410_94_CryptoPro_B_ParamSet "id-GostR3410-94-CryptoPro-B-ParamSet" #define NID_id_GostR3410_94_CryptoPro_B_ParamSet 833 #define OBJ_id_GostR3410_94_CryptoPro_B_ParamSet OBJ_cryptopro,32L,3L #define SN_id_GostR3410_94_CryptoPro_C_ParamSet "id-GostR3410-94-CryptoPro-C-ParamSet" #define NID_id_GostR3410_94_CryptoPro_C_ParamSet 834 #define OBJ_id_GostR3410_94_CryptoPro_C_ParamSet OBJ_cryptopro,32L,4L #define SN_id_GostR3410_94_CryptoPro_D_ParamSet "id-GostR3410-94-CryptoPro-D-ParamSet" #define NID_id_GostR3410_94_CryptoPro_D_ParamSet 835 #define OBJ_id_GostR3410_94_CryptoPro_D_ParamSet OBJ_cryptopro,32L,5L #define SN_id_GostR3410_94_CryptoPro_XchA_ParamSet "id-GostR3410-94-CryptoPro-XchA-ParamSet" #define NID_id_GostR3410_94_CryptoPro_XchA_ParamSet 836 #define OBJ_id_GostR3410_94_CryptoPro_XchA_ParamSet OBJ_cryptopro,33L,1L #define SN_id_GostR3410_94_CryptoPro_XchB_ParamSet "id-GostR3410-94-CryptoPro-XchB-ParamSet" #define NID_id_GostR3410_94_CryptoPro_XchB_ParamSet 837 #define OBJ_id_GostR3410_94_CryptoPro_XchB_ParamSet OBJ_cryptopro,33L,2L #define SN_id_GostR3410_94_CryptoPro_XchC_ParamSet "id-GostR3410-94-CryptoPro-XchC-ParamSet" #define NID_id_GostR3410_94_CryptoPro_XchC_ParamSet 838 #define OBJ_id_GostR3410_94_CryptoPro_XchC_ParamSet OBJ_cryptopro,33L,3L #define SN_id_GostR3410_2001_TestParamSet "id-GostR3410-2001-TestParamSet" #define NID_id_GostR3410_2001_TestParamSet 839 #define OBJ_id_GostR3410_2001_TestParamSet OBJ_cryptopro,35L,0L #define SN_id_GostR3410_2001_CryptoPro_A_ParamSet "id-GostR3410-2001-CryptoPro-A-ParamSet" #define NID_id_GostR3410_2001_CryptoPro_A_ParamSet 840 #define OBJ_id_GostR3410_2001_CryptoPro_A_ParamSet OBJ_cryptopro,35L,1L #define SN_id_GostR3410_2001_CryptoPro_B_ParamSet "id-GostR3410-2001-CryptoPro-B-ParamSet" #define NID_id_GostR3410_2001_CryptoPro_B_ParamSet 841 #define OBJ_id_GostR3410_2001_CryptoPro_B_ParamSet OBJ_cryptopro,35L,2L #define SN_id_GostR3410_2001_CryptoPro_C_ParamSet "id-GostR3410-2001-CryptoPro-C-ParamSet" #define NID_id_GostR3410_2001_CryptoPro_C_ParamSet 842 #define OBJ_id_GostR3410_2001_CryptoPro_C_ParamSet OBJ_cryptopro,35L,3L #define SN_id_GostR3410_2001_CryptoPro_XchA_ParamSet "id-GostR3410-2001-CryptoPro-XchA-ParamSet" #define NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet 843 #define OBJ_id_GostR3410_2001_CryptoPro_XchA_ParamSet OBJ_cryptopro,36L,0L #define SN_id_GostR3410_2001_CryptoPro_XchB_ParamSet "id-GostR3410-2001-CryptoPro-XchB-ParamSet" #define NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet 844 #define OBJ_id_GostR3410_2001_CryptoPro_XchB_ParamSet OBJ_cryptopro,36L,1L #define SN_id_GostR3410_94_a "id-GostR3410-94-a" #define NID_id_GostR3410_94_a 845 #define OBJ_id_GostR3410_94_a OBJ_id_GostR3410_94,1L #define SN_id_GostR3410_94_aBis "id-GostR3410-94-aBis" #define NID_id_GostR3410_94_aBis 846 #define OBJ_id_GostR3410_94_aBis OBJ_id_GostR3410_94,2L #define SN_id_GostR3410_94_b "id-GostR3410-94-b" #define NID_id_GostR3410_94_b 847 #define OBJ_id_GostR3410_94_b OBJ_id_GostR3410_94,3L #define SN_id_GostR3410_94_bBis "id-GostR3410-94-bBis" #define NID_id_GostR3410_94_bBis 848 #define OBJ_id_GostR3410_94_bBis OBJ_id_GostR3410_94,4L #define SN_id_Gost28147_89_cc "id-Gost28147-89-cc" #define LN_id_Gost28147_89_cc "GOST 28147-89 Cryptocom ParamSet" #define NID_id_Gost28147_89_cc 849 #define OBJ_id_Gost28147_89_cc OBJ_cryptocom,1L,6L,1L #define SN_id_GostR3410_94_cc "gost94cc" #define LN_id_GostR3410_94_cc "GOST 34.10-94 Cryptocom" #define NID_id_GostR3410_94_cc 850 #define OBJ_id_GostR3410_94_cc OBJ_cryptocom,1L,5L,3L #define SN_id_GostR3410_2001_cc "gost2001cc" #define LN_id_GostR3410_2001_cc "GOST 34.10-2001 Cryptocom" #define NID_id_GostR3410_2001_cc 851 #define OBJ_id_GostR3410_2001_cc OBJ_cryptocom,1L,5L,4L #define SN_id_GostR3411_94_with_GostR3410_94_cc "id-GostR3411-94-with-GostR3410-94-cc" #define LN_id_GostR3411_94_with_GostR3410_94_cc "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom" #define NID_id_GostR3411_94_with_GostR3410_94_cc 852 #define OBJ_id_GostR3411_94_with_GostR3410_94_cc OBJ_cryptocom,1L,3L,3L #define SN_id_GostR3411_94_with_GostR3410_2001_cc "id-GostR3411-94-with-GostR3410-2001-cc" #define LN_id_GostR3411_94_with_GostR3410_2001_cc "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom" #define NID_id_GostR3411_94_with_GostR3410_2001_cc 853 #define OBJ_id_GostR3411_94_with_GostR3410_2001_cc OBJ_cryptocom,1L,3L,4L #define SN_id_GostR3410_2001_ParamSet_cc "id-GostR3410-2001-ParamSet-cc" #define LN_id_GostR3410_2001_ParamSet_cc "GOST R 3410-2001 Parameter Set Cryptocom" #define NID_id_GostR3410_2001_ParamSet_cc 854 #define OBJ_id_GostR3410_2001_ParamSet_cc OBJ_cryptocom,1L,8L,1L #define SN_camellia_128_cbc "CAMELLIA-128-CBC" #define LN_camellia_128_cbc "camellia-128-cbc" #define NID_camellia_128_cbc 751 #define OBJ_camellia_128_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,2L #define SN_camellia_192_cbc "CAMELLIA-192-CBC" #define LN_camellia_192_cbc "camellia-192-cbc" #define NID_camellia_192_cbc 752 #define OBJ_camellia_192_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,3L #define SN_camellia_256_cbc "CAMELLIA-256-CBC" #define LN_camellia_256_cbc "camellia-256-cbc" #define NID_camellia_256_cbc 753 #define OBJ_camellia_256_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,4L #define SN_id_camellia128_wrap "id-camellia128-wrap" #define NID_id_camellia128_wrap 907 #define OBJ_id_camellia128_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,2L #define SN_id_camellia192_wrap "id-camellia192-wrap" #define NID_id_camellia192_wrap 908 #define OBJ_id_camellia192_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,3L #define SN_id_camellia256_wrap "id-camellia256-wrap" #define NID_id_camellia256_wrap 909 #define OBJ_id_camellia256_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,4L #define OBJ_ntt_ds 0L,3L,4401L,5L #define OBJ_camellia OBJ_ntt_ds,3L,1L,9L #define SN_camellia_128_ecb "CAMELLIA-128-ECB" #define LN_camellia_128_ecb "camellia-128-ecb" #define NID_camellia_128_ecb 754 #define OBJ_camellia_128_ecb OBJ_camellia,1L #define SN_camellia_128_ofb128 "CAMELLIA-128-OFB" #define LN_camellia_128_ofb128 "camellia-128-ofb" #define NID_camellia_128_ofb128 766 #define OBJ_camellia_128_ofb128 OBJ_camellia,3L #define SN_camellia_128_cfb128 "CAMELLIA-128-CFB" #define LN_camellia_128_cfb128 "camellia-128-cfb" #define NID_camellia_128_cfb128 757 #define OBJ_camellia_128_cfb128 OBJ_camellia,4L #define SN_camellia_192_ecb "CAMELLIA-192-ECB" #define LN_camellia_192_ecb "camellia-192-ecb" #define NID_camellia_192_ecb 755 #define OBJ_camellia_192_ecb OBJ_camellia,21L #define SN_camellia_192_ofb128 "CAMELLIA-192-OFB" #define LN_camellia_192_ofb128 "camellia-192-ofb" #define NID_camellia_192_ofb128 767 #define OBJ_camellia_192_ofb128 OBJ_camellia,23L #define SN_camellia_192_cfb128 "CAMELLIA-192-CFB" #define LN_camellia_192_cfb128 "camellia-192-cfb" #define NID_camellia_192_cfb128 758 #define OBJ_camellia_192_cfb128 OBJ_camellia,24L #define SN_camellia_256_ecb "CAMELLIA-256-ECB" #define LN_camellia_256_ecb "camellia-256-ecb" #define NID_camellia_256_ecb 756 #define OBJ_camellia_256_ecb OBJ_camellia,41L #define SN_camellia_256_ofb128 "CAMELLIA-256-OFB" #define LN_camellia_256_ofb128 "camellia-256-ofb" #define NID_camellia_256_ofb128 768 #define OBJ_camellia_256_ofb128 OBJ_camellia,43L #define SN_camellia_256_cfb128 "CAMELLIA-256-CFB" #define LN_camellia_256_cfb128 "camellia-256-cfb" #define NID_camellia_256_cfb128 759 #define OBJ_camellia_256_cfb128 OBJ_camellia,44L #define SN_camellia_128_cfb1 "CAMELLIA-128-CFB1" #define LN_camellia_128_cfb1 "camellia-128-cfb1" #define NID_camellia_128_cfb1 760 #define SN_camellia_192_cfb1 "CAMELLIA-192-CFB1" #define LN_camellia_192_cfb1 "camellia-192-cfb1" #define NID_camellia_192_cfb1 761 #define SN_camellia_256_cfb1 "CAMELLIA-256-CFB1" #define LN_camellia_256_cfb1 "camellia-256-cfb1" #define NID_camellia_256_cfb1 762 #define SN_camellia_128_cfb8 "CAMELLIA-128-CFB8" #define LN_camellia_128_cfb8 "camellia-128-cfb8" #define NID_camellia_128_cfb8 763 #define SN_camellia_192_cfb8 "CAMELLIA-192-CFB8" #define LN_camellia_192_cfb8 "camellia-192-cfb8" #define NID_camellia_192_cfb8 764 #define SN_camellia_256_cfb8 "CAMELLIA-256-CFB8" #define LN_camellia_256_cfb8 "camellia-256-cfb8" #define NID_camellia_256_cfb8 765 #define SN_kisa "KISA" #define LN_kisa "kisa" #define NID_kisa 773 #define OBJ_kisa OBJ_member_body,410L,200004L #define SN_seed_ecb "SEED-ECB" #define LN_seed_ecb "seed-ecb" #define NID_seed_ecb 776 #define OBJ_seed_ecb OBJ_kisa,1L,3L #define SN_seed_cbc "SEED-CBC" #define LN_seed_cbc "seed-cbc" #define NID_seed_cbc 777 #define OBJ_seed_cbc OBJ_kisa,1L,4L #define SN_seed_cfb128 "SEED-CFB" #define LN_seed_cfb128 "seed-cfb" #define NID_seed_cfb128 779 #define OBJ_seed_cfb128 OBJ_kisa,1L,5L #define SN_seed_ofb128 "SEED-OFB" #define LN_seed_ofb128 "seed-ofb" #define NID_seed_ofb128 778 #define OBJ_seed_ofb128 OBJ_kisa,1L,6L #define SN_hmac "HMAC" #define LN_hmac "hmac" #define NID_hmac 855 #define SN_cmac "CMAC" #define LN_cmac "cmac" #define NID_cmac 894 #define SN_rc4_hmac_md5 "RC4-HMAC-MD5" #define LN_rc4_hmac_md5 "rc4-hmac-md5" #define NID_rc4_hmac_md5 915 #define SN_aes_128_cbc_hmac_sha1 "AES-128-CBC-HMAC-SHA1" #define LN_aes_128_cbc_hmac_sha1 "aes-128-cbc-hmac-sha1" #define NID_aes_128_cbc_hmac_sha1 916 #define SN_aes_192_cbc_hmac_sha1 "AES-192-CBC-HMAC-SHA1" #define LN_aes_192_cbc_hmac_sha1 "aes-192-cbc-hmac-sha1" #define NID_aes_192_cbc_hmac_sha1 917 #define SN_aes_256_cbc_hmac_sha1 "AES-256-CBC-HMAC-SHA1" #define LN_aes_256_cbc_hmac_sha1 "aes-256-cbc-hmac-sha1" #define NID_aes_256_cbc_hmac_sha1 918 #define SN_aes_128_cbc_hmac_sha256 "AES-128-CBC-HMAC-SHA256" #define LN_aes_128_cbc_hmac_sha256 "aes-128-cbc-hmac-sha256" #define NID_aes_128_cbc_hmac_sha256 948 #define SN_aes_192_cbc_hmac_sha256 "AES-192-CBC-HMAC-SHA256" #define LN_aes_192_cbc_hmac_sha256 "aes-192-cbc-hmac-sha256" #define NID_aes_192_cbc_hmac_sha256 949 #define SN_aes_256_cbc_hmac_sha256 "AES-256-CBC-HMAC-SHA256" #define LN_aes_256_cbc_hmac_sha256 "aes-256-cbc-hmac-sha256" #define NID_aes_256_cbc_hmac_sha256 950 #define SN_dhpublicnumber "dhpublicnumber" #define LN_dhpublicnumber "X9.42 DH" #define NID_dhpublicnumber 920 #define OBJ_dhpublicnumber OBJ_ISO_US,10046L,2L,1L #define SN_brainpoolP160r1 "brainpoolP160r1" #define NID_brainpoolP160r1 921 #define OBJ_brainpoolP160r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,1L #define SN_brainpoolP160t1 "brainpoolP160t1" #define NID_brainpoolP160t1 922 #define OBJ_brainpoolP160t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,2L #define SN_brainpoolP192r1 "brainpoolP192r1" #define NID_brainpoolP192r1 923 #define OBJ_brainpoolP192r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,3L #define SN_brainpoolP192t1 "brainpoolP192t1" #define NID_brainpoolP192t1 924 #define OBJ_brainpoolP192t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,4L #define SN_brainpoolP224r1 "brainpoolP224r1" #define NID_brainpoolP224r1 925 #define OBJ_brainpoolP224r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,5L #define SN_brainpoolP224t1 "brainpoolP224t1" #define NID_brainpoolP224t1 926 #define OBJ_brainpoolP224t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,6L #define SN_brainpoolP256r1 "brainpoolP256r1" #define NID_brainpoolP256r1 927 #define OBJ_brainpoolP256r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,7L #define SN_brainpoolP256t1 "brainpoolP256t1" #define NID_brainpoolP256t1 928 #define OBJ_brainpoolP256t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,8L #define SN_brainpoolP320r1 "brainpoolP320r1" #define NID_brainpoolP320r1 929 #define OBJ_brainpoolP320r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,9L #define SN_brainpoolP320t1 "brainpoolP320t1" #define NID_brainpoolP320t1 930 #define OBJ_brainpoolP320t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,10L #define SN_brainpoolP384r1 "brainpoolP384r1" #define NID_brainpoolP384r1 931 #define OBJ_brainpoolP384r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,11L #define SN_brainpoolP384t1 "brainpoolP384t1" #define NID_brainpoolP384t1 932 #define OBJ_brainpoolP384t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,12L #define SN_brainpoolP512r1 "brainpoolP512r1" #define NID_brainpoolP512r1 933 #define OBJ_brainpoolP512r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,13L #define SN_brainpoolP512t1 "brainpoolP512t1" #define NID_brainpoolP512t1 934 #define OBJ_brainpoolP512t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,14L #define OBJ_x9_63_scheme 1L,3L,133L,16L,840L,63L,0L #define OBJ_secg_scheme OBJ_certicom_arc,1L #define SN_dhSinglePass_stdDH_sha1kdf_scheme "dhSinglePass-stdDH-sha1kdf-scheme" #define NID_dhSinglePass_stdDH_sha1kdf_scheme 936 #define OBJ_dhSinglePass_stdDH_sha1kdf_scheme OBJ_x9_63_scheme,2L #define SN_dhSinglePass_stdDH_sha224kdf_scheme "dhSinglePass-stdDH-sha224kdf-scheme" #define NID_dhSinglePass_stdDH_sha224kdf_scheme 937 #define OBJ_dhSinglePass_stdDH_sha224kdf_scheme OBJ_secg_scheme,11L,0L #define SN_dhSinglePass_stdDH_sha256kdf_scheme "dhSinglePass-stdDH-sha256kdf-scheme" #define NID_dhSinglePass_stdDH_sha256kdf_scheme 938 #define OBJ_dhSinglePass_stdDH_sha256kdf_scheme OBJ_secg_scheme,11L,1L #define SN_dhSinglePass_stdDH_sha384kdf_scheme "dhSinglePass-stdDH-sha384kdf-scheme" #define NID_dhSinglePass_stdDH_sha384kdf_scheme 939 #define OBJ_dhSinglePass_stdDH_sha384kdf_scheme OBJ_secg_scheme,11L,2L #define SN_dhSinglePass_stdDH_sha512kdf_scheme "dhSinglePass-stdDH-sha512kdf-scheme" #define NID_dhSinglePass_stdDH_sha512kdf_scheme 940 #define OBJ_dhSinglePass_stdDH_sha512kdf_scheme OBJ_secg_scheme,11L,3L #define SN_dhSinglePass_cofactorDH_sha1kdf_scheme "dhSinglePass-cofactorDH-sha1kdf-scheme" #define NID_dhSinglePass_cofactorDH_sha1kdf_scheme 941 #define OBJ_dhSinglePass_cofactorDH_sha1kdf_scheme OBJ_x9_63_scheme,3L #define SN_dhSinglePass_cofactorDH_sha224kdf_scheme "dhSinglePass-cofactorDH-sha224kdf-scheme" #define NID_dhSinglePass_cofactorDH_sha224kdf_scheme 942 #define OBJ_dhSinglePass_cofactorDH_sha224kdf_scheme OBJ_secg_scheme,14L,0L #define SN_dhSinglePass_cofactorDH_sha256kdf_scheme "dhSinglePass-cofactorDH-sha256kdf-scheme" #define NID_dhSinglePass_cofactorDH_sha256kdf_scheme 943 #define OBJ_dhSinglePass_cofactorDH_sha256kdf_scheme OBJ_secg_scheme,14L,1L #define SN_dhSinglePass_cofactorDH_sha384kdf_scheme "dhSinglePass-cofactorDH-sha384kdf-scheme" #define NID_dhSinglePass_cofactorDH_sha384kdf_scheme 944 #define OBJ_dhSinglePass_cofactorDH_sha384kdf_scheme OBJ_secg_scheme,14L,2L #define SN_dhSinglePass_cofactorDH_sha512kdf_scheme "dhSinglePass-cofactorDH-sha512kdf-scheme" #define NID_dhSinglePass_cofactorDH_sha512kdf_scheme 945 #define OBJ_dhSinglePass_cofactorDH_sha512kdf_scheme OBJ_secg_scheme,14L,3L #define SN_dh_std_kdf "dh-std-kdf" #define NID_dh_std_kdf 946 #define SN_dh_cofactor_kdf "dh-cofactor-kdf" #define NID_dh_cofactor_kdf 947 #define SN_ct_precert_scts "ct_precert_scts" #define LN_ct_precert_scts "CT Precertificate SCTs" #define NID_ct_precert_scts 951 #define OBJ_ct_precert_scts 1L,3L,6L,1L,4L,1L,11129L,2L,4L,2L #define SN_ct_precert_poison "ct_precert_poison" #define LN_ct_precert_poison "CT Precertificate Poison" #define NID_ct_precert_poison 952 #define OBJ_ct_precert_poison 1L,3L,6L,1L,4L,1L,11129L,2L,4L,3L #define SN_ct_precert_signer "ct_precert_signer" #define LN_ct_precert_signer "CT Precertificate Signer" #define NID_ct_precert_signer 953 #define OBJ_ct_precert_signer 1L,3L,6L,1L,4L,1L,11129L,2L,4L,4L #define SN_ct_cert_scts "ct_cert_scts" #define LN_ct_cert_scts "CT Certificate SCTs" #define NID_ct_cert_scts 954 #define OBJ_ct_cert_scts 1L,3L,6L,1L,4L,1L,11129L,2L,4L,5L #define SN_jurisdictionLocalityName "jurisdictionL" #define LN_jurisdictionLocalityName "jurisdictionLocalityName" #define NID_jurisdictionLocalityName 955 #define OBJ_jurisdictionLocalityName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,1L #define SN_jurisdictionStateOrProvinceName "jurisdictionST" #define LN_jurisdictionStateOrProvinceName "jurisdictionStateOrProvinceName" #define NID_jurisdictionStateOrProvinceName 956 #define OBJ_jurisdictionStateOrProvinceName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,2L #define SN_jurisdictionCountryName "jurisdictionC" #define LN_jurisdictionCountryName "jurisdictionCountryName" #define NID_jurisdictionCountryName 957 #define OBJ_jurisdictionCountryName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,3L ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/whrlpool.h����������������������������������������������������������������������������������0000644�����������������00000002073�14763166030�0010256 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef HEADER_WHRLPOOL_H # define HEADER_WHRLPOOL_H # include <openssl/e_os2.h> # include <stddef.h> #ifdef __cplusplus extern "C" { #endif # define WHIRLPOOL_DIGEST_LENGTH (512/8) # define WHIRLPOOL_BBLOCK 512 # define WHIRLPOOL_COUNTER (256/8) typedef struct { union { unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; /* double q is here to ensure 64-bit alignment */ double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)]; } H; unsigned char data[WHIRLPOOL_BBLOCK / 8]; unsigned int bitoff; size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)]; } WHIRLPOOL_CTX; # ifndef OPENSSL_NO_WHIRLPOOL # ifdef OPENSSL_FIPS int private_WHIRLPOOL_Init(WHIRLPOOL_CTX *c); # endif int WHIRLPOOL_Init(WHIRLPOOL_CTX *c); int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, const void *inp, size_t bytes); void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *inp, size_t bits); int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c); unsigned char *WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md); # endif #ifdef __cplusplus } #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/ssl3.h��������������������������������������������������������������������������������������0000644�����������������00000101001�14763166030�0007263 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ssl/ssl3.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * ECC cipher suite support in OpenSSL originally developed by * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. */ #ifndef HEADER_SSL3_H # define HEADER_SSL3_H # ifndef OPENSSL_NO_COMP # include <openssl/comp.h> # endif # include <openssl/buffer.h> # include <openssl/evp.h> # include <openssl/ssl.h> #ifdef __cplusplus extern "C" { #endif /* * Signalling cipher suite value from RFC 5746 * (TLS_EMPTY_RENEGOTIATION_INFO_SCSV) */ # define SSL3_CK_SCSV 0x030000FF /* * Signalling cipher suite value from draft-ietf-tls-downgrade-scsv-00 * (TLS_FALLBACK_SCSV) */ # define SSL3_CK_FALLBACK_SCSV 0x03005600 # define SSL3_CK_RSA_NULL_MD5 0x03000001 # define SSL3_CK_RSA_NULL_SHA 0x03000002 # define SSL3_CK_RSA_RC4_40_MD5 0x03000003 # define SSL3_CK_RSA_RC4_128_MD5 0x03000004 # define SSL3_CK_RSA_RC4_128_SHA 0x03000005 # define SSL3_CK_RSA_RC2_40_MD5 0x03000006 # define SSL3_CK_RSA_IDEA_128_SHA 0x03000007 # define SSL3_CK_RSA_DES_40_CBC_SHA 0x03000008 # define SSL3_CK_RSA_DES_64_CBC_SHA 0x03000009 # define SSL3_CK_RSA_DES_192_CBC3_SHA 0x0300000A # define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B # define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C # define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D # define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E # define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F # define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010 # define SSL3_CK_EDH_DSS_DES_40_CBC_SHA 0x03000011 # define SSL3_CK_DHE_DSS_DES_40_CBC_SHA SSL3_CK_EDH_DSS_DES_40_CBC_SHA # define SSL3_CK_EDH_DSS_DES_64_CBC_SHA 0x03000012 # define SSL3_CK_DHE_DSS_DES_64_CBC_SHA SSL3_CK_EDH_DSS_DES_64_CBC_SHA # define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA 0x03000013 # define SSL3_CK_DHE_DSS_DES_192_CBC3_SHA SSL3_CK_EDH_DSS_DES_192_CBC3_SHA # define SSL3_CK_EDH_RSA_DES_40_CBC_SHA 0x03000014 # define SSL3_CK_DHE_RSA_DES_40_CBC_SHA SSL3_CK_EDH_RSA_DES_40_CBC_SHA # define SSL3_CK_EDH_RSA_DES_64_CBC_SHA 0x03000015 # define SSL3_CK_DHE_RSA_DES_64_CBC_SHA SSL3_CK_EDH_RSA_DES_64_CBC_SHA # define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA 0x03000016 # define SSL3_CK_DHE_RSA_DES_192_CBC3_SHA SSL3_CK_EDH_RSA_DES_192_CBC3_SHA # define SSL3_CK_ADH_RC4_40_MD5 0x03000017 # define SSL3_CK_ADH_RC4_128_MD5 0x03000018 # define SSL3_CK_ADH_DES_40_CBC_SHA 0x03000019 # define SSL3_CK_ADH_DES_64_CBC_SHA 0x0300001A # define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B # if 0 # define SSL3_CK_FZA_DMS_NULL_SHA 0x0300001C # define SSL3_CK_FZA_DMS_FZA_SHA 0x0300001D # if 0 /* Because it clashes with KRB5, is never * used any more, and is safe to remove * according to David Hopwood * <david.hopwood@zetnet.co.uk> of the * ietf-tls list */ # define SSL3_CK_FZA_DMS_RC4_SHA 0x0300001E # endif # endif /* * VRS Additional Kerberos5 entries */ # define SSL3_CK_KRB5_DES_64_CBC_SHA 0x0300001E # define SSL3_CK_KRB5_DES_192_CBC3_SHA 0x0300001F # define SSL3_CK_KRB5_RC4_128_SHA 0x03000020 # define SSL3_CK_KRB5_IDEA_128_CBC_SHA 0x03000021 # define SSL3_CK_KRB5_DES_64_CBC_MD5 0x03000022 # define SSL3_CK_KRB5_DES_192_CBC3_MD5 0x03000023 # define SSL3_CK_KRB5_RC4_128_MD5 0x03000024 # define SSL3_CK_KRB5_IDEA_128_CBC_MD5 0x03000025 # define SSL3_CK_KRB5_DES_40_CBC_SHA 0x03000026 # define SSL3_CK_KRB5_RC2_40_CBC_SHA 0x03000027 # define SSL3_CK_KRB5_RC4_40_SHA 0x03000028 # define SSL3_CK_KRB5_DES_40_CBC_MD5 0x03000029 # define SSL3_CK_KRB5_RC2_40_CBC_MD5 0x0300002A # define SSL3_CK_KRB5_RC4_40_MD5 0x0300002B # define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5" # define SSL3_TXT_RSA_NULL_SHA "NULL-SHA" # define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5" # define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5" # define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA" # define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5" # define SSL3_TXT_RSA_IDEA_128_SHA "IDEA-CBC-SHA" # define SSL3_TXT_RSA_DES_40_CBC_SHA "EXP-DES-CBC-SHA" # define SSL3_TXT_RSA_DES_64_CBC_SHA "DES-CBC-SHA" # define SSL3_TXT_RSA_DES_192_CBC3_SHA "DES-CBC3-SHA" # define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA" # define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA" # define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA" # define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA" # define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA" # define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA" # define SSL3_TXT_DHE_DSS_DES_40_CBC_SHA "EXP-DHE-DSS-DES-CBC-SHA" # define SSL3_TXT_DHE_DSS_DES_64_CBC_SHA "DHE-DSS-DES-CBC-SHA" # define SSL3_TXT_DHE_DSS_DES_192_CBC3_SHA "DHE-DSS-DES-CBC3-SHA" # define SSL3_TXT_DHE_RSA_DES_40_CBC_SHA "EXP-DHE-RSA-DES-CBC-SHA" # define SSL3_TXT_DHE_RSA_DES_64_CBC_SHA "DHE-RSA-DES-CBC-SHA" # define SSL3_TXT_DHE_RSA_DES_192_CBC3_SHA "DHE-RSA-DES-CBC3-SHA" /* * This next block of six "EDH" labels is for backward compatibility with * older versions of OpenSSL. New code should use the six "DHE" labels above * instead: */ # define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA" # define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA" # define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA "EDH-DSS-DES-CBC3-SHA" # define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA "EXP-EDH-RSA-DES-CBC-SHA" # define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA "EDH-RSA-DES-CBC-SHA" # define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA "EDH-RSA-DES-CBC3-SHA" # define SSL3_TXT_ADH_RC4_40_MD5 "EXP-ADH-RC4-MD5" # define SSL3_TXT_ADH_RC4_128_MD5 "ADH-RC4-MD5" # define SSL3_TXT_ADH_DES_40_CBC_SHA "EXP-ADH-DES-CBC-SHA" # define SSL3_TXT_ADH_DES_64_CBC_SHA "ADH-DES-CBC-SHA" # define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA" # if 0 # define SSL3_TXT_FZA_DMS_NULL_SHA "FZA-NULL-SHA" # define SSL3_TXT_FZA_DMS_FZA_SHA "FZA-FZA-CBC-SHA" # define SSL3_TXT_FZA_DMS_RC4_SHA "FZA-RC4-SHA" # endif # define SSL3_TXT_KRB5_DES_64_CBC_SHA "KRB5-DES-CBC-SHA" # define SSL3_TXT_KRB5_DES_192_CBC3_SHA "KRB5-DES-CBC3-SHA" # define SSL3_TXT_KRB5_RC4_128_SHA "KRB5-RC4-SHA" # define SSL3_TXT_KRB5_IDEA_128_CBC_SHA "KRB5-IDEA-CBC-SHA" # define SSL3_TXT_KRB5_DES_64_CBC_MD5 "KRB5-DES-CBC-MD5" # define SSL3_TXT_KRB5_DES_192_CBC3_MD5 "KRB5-DES-CBC3-MD5" # define SSL3_TXT_KRB5_RC4_128_MD5 "KRB5-RC4-MD5" # define SSL3_TXT_KRB5_IDEA_128_CBC_MD5 "KRB5-IDEA-CBC-MD5" # define SSL3_TXT_KRB5_DES_40_CBC_SHA "EXP-KRB5-DES-CBC-SHA" # define SSL3_TXT_KRB5_RC2_40_CBC_SHA "EXP-KRB5-RC2-CBC-SHA" # define SSL3_TXT_KRB5_RC4_40_SHA "EXP-KRB5-RC4-SHA" # define SSL3_TXT_KRB5_DES_40_CBC_MD5 "EXP-KRB5-DES-CBC-MD5" # define SSL3_TXT_KRB5_RC2_40_CBC_MD5 "EXP-KRB5-RC2-CBC-MD5" # define SSL3_TXT_KRB5_RC4_40_MD5 "EXP-KRB5-RC4-MD5" # define SSL3_SSL_SESSION_ID_LENGTH 32 # define SSL3_MAX_SSL_SESSION_ID_LENGTH 32 # define SSL3_MASTER_SECRET_SIZE 48 # define SSL3_RANDOM_SIZE 32 # define SSL3_SESSION_ID_SIZE 32 # define SSL3_RT_HEADER_LENGTH 5 # define SSL3_HM_HEADER_LENGTH 4 # ifndef SSL3_ALIGN_PAYLOAD /* * Some will argue that this increases memory footprint, but it's not * actually true. Point is that malloc has to return at least 64-bit aligned * pointers, meaning that allocating 5 bytes wastes 3 bytes in either case. * Suggested pre-gaping simply moves these wasted bytes from the end of * allocated region to its front, but makes data payload aligned, which * improves performance:-) */ # define SSL3_ALIGN_PAYLOAD 8 # else # if (SSL3_ALIGN_PAYLOAD&(SSL3_ALIGN_PAYLOAD-1))!=0 # error "insane SSL3_ALIGN_PAYLOAD" # undef SSL3_ALIGN_PAYLOAD # endif # endif /* * This is the maximum MAC (digest) size used by the SSL library. Currently * maximum of 20 is used by SHA1, but we reserve for future extension for * 512-bit hashes. */ # define SSL3_RT_MAX_MD_SIZE 64 /* * Maximum block size used in all ciphersuites. Currently 16 for AES. */ # define SSL_RT_MAX_CIPHER_BLOCK_SIZE 16 # define SSL3_RT_MAX_EXTRA (16384) /* Maximum plaintext length: defined by SSL/TLS standards */ # define SSL3_RT_MAX_PLAIN_LENGTH 16384 /* Maximum compression overhead: defined by SSL/TLS standards */ # define SSL3_RT_MAX_COMPRESSED_OVERHEAD 1024 /* * The standards give a maximum encryption overhead of 1024 bytes. In * practice the value is lower than this. The overhead is the maximum number * of padding bytes (256) plus the mac size. */ # define SSL3_RT_MAX_ENCRYPTED_OVERHEAD (256 + SSL3_RT_MAX_MD_SIZE) /* * OpenSSL currently only uses a padding length of at most one block so the * send overhead is smaller. */ # define SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD \ (SSL_RT_MAX_CIPHER_BLOCK_SIZE + SSL3_RT_MAX_MD_SIZE) /* If compression isn't used don't include the compression overhead */ # ifdef OPENSSL_NO_COMP # define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH # else # define SSL3_RT_MAX_COMPRESSED_LENGTH \ (SSL3_RT_MAX_PLAIN_LENGTH+SSL3_RT_MAX_COMPRESSED_OVERHEAD) # endif # define SSL3_RT_MAX_ENCRYPTED_LENGTH \ (SSL3_RT_MAX_ENCRYPTED_OVERHEAD+SSL3_RT_MAX_COMPRESSED_LENGTH) # define SSL3_RT_MAX_PACKET_SIZE \ (SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH) # define SSL3_MD_CLIENT_FINISHED_CONST "\x43\x4C\x4E\x54" # define SSL3_MD_SERVER_FINISHED_CONST "\x53\x52\x56\x52" # define SSL3_VERSION 0x0300 # define SSL3_VERSION_MAJOR 0x03 # define SSL3_VERSION_MINOR 0x00 # define SSL3_RT_CHANGE_CIPHER_SPEC 20 # define SSL3_RT_ALERT 21 # define SSL3_RT_HANDSHAKE 22 # define SSL3_RT_APPLICATION_DATA 23 # define TLS1_RT_HEARTBEAT 24 /* Pseudo content types to indicate additional parameters */ # define TLS1_RT_CRYPTO 0x1000 # define TLS1_RT_CRYPTO_PREMASTER (TLS1_RT_CRYPTO | 0x1) # define TLS1_RT_CRYPTO_CLIENT_RANDOM (TLS1_RT_CRYPTO | 0x2) # define TLS1_RT_CRYPTO_SERVER_RANDOM (TLS1_RT_CRYPTO | 0x3) # define TLS1_RT_CRYPTO_MASTER (TLS1_RT_CRYPTO | 0x4) # define TLS1_RT_CRYPTO_READ 0x0000 # define TLS1_RT_CRYPTO_WRITE 0x0100 # define TLS1_RT_CRYPTO_MAC (TLS1_RT_CRYPTO | 0x5) # define TLS1_RT_CRYPTO_KEY (TLS1_RT_CRYPTO | 0x6) # define TLS1_RT_CRYPTO_IV (TLS1_RT_CRYPTO | 0x7) # define TLS1_RT_CRYPTO_FIXED_IV (TLS1_RT_CRYPTO | 0x8) /* Pseudo content type for SSL/TLS header info */ # define SSL3_RT_HEADER 0x100 # define SSL3_AL_WARNING 1 # define SSL3_AL_FATAL 2 # define SSL3_AD_CLOSE_NOTIFY 0 # define SSL3_AD_UNEXPECTED_MESSAGE 10/* fatal */ # define SSL3_AD_BAD_RECORD_MAC 20/* fatal */ # define SSL3_AD_DECOMPRESSION_FAILURE 30/* fatal */ # define SSL3_AD_HANDSHAKE_FAILURE 40/* fatal */ # define SSL3_AD_NO_CERTIFICATE 41 # define SSL3_AD_BAD_CERTIFICATE 42 # define SSL3_AD_UNSUPPORTED_CERTIFICATE 43 # define SSL3_AD_CERTIFICATE_REVOKED 44 # define SSL3_AD_CERTIFICATE_EXPIRED 45 # define SSL3_AD_CERTIFICATE_UNKNOWN 46 # define SSL3_AD_ILLEGAL_PARAMETER 47/* fatal */ # define TLS1_HB_REQUEST 1 # define TLS1_HB_RESPONSE 2 # ifndef OPENSSL_NO_SSL_INTERN typedef struct ssl3_record_st { /* type of record */ /* * r */ int type; /* How many bytes available */ /* * rw */ unsigned int length; /* read/write offset into 'buf' */ /* * r */ unsigned int off; /* pointer to the record data */ /* * rw */ unsigned char *data; /* where the decode bytes are */ /* * rw */ unsigned char *input; /* only used with decompression - malloc()ed */ /* * r */ unsigned char *comp; /* epoch number, needed by DTLS1 */ /* * r */ unsigned long epoch; /* sequence number, needed by DTLS1 */ /* * r */ unsigned char seq_num[8]; } SSL3_RECORD; typedef struct ssl3_buffer_st { /* at least SSL3_RT_MAX_PACKET_SIZE bytes, see ssl3_setup_buffers() */ unsigned char *buf; /* buffer size */ size_t len; /* where to 'copy from' */ int offset; /* how many bytes left */ int left; } SSL3_BUFFER; # endif # define SSL3_CT_RSA_SIGN 1 # define SSL3_CT_DSS_SIGN 2 # define SSL3_CT_RSA_FIXED_DH 3 # define SSL3_CT_DSS_FIXED_DH 4 # define SSL3_CT_RSA_EPHEMERAL_DH 5 # define SSL3_CT_DSS_EPHEMERAL_DH 6 # define SSL3_CT_FORTEZZA_DMS 20 /* * SSL3_CT_NUMBER is used to size arrays and it must be large enough to * contain all of the cert types defined either for SSLv3 and TLSv1. */ # define SSL3_CT_NUMBER 9 # define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS 0x0001 # define SSL3_FLAGS_DELAY_CLIENT_FINISHED 0x0002 # define SSL3_FLAGS_POP_BUFFER 0x0004 # define TLS1_FLAGS_TLS_PADDING_BUG 0x0008 # define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010 # define TLS1_FLAGS_KEEP_HANDSHAKE 0x0020 /* * Set when the handshake is ready to process peer's ChangeCipherSpec message. * Cleared after the message has been processed. */ # define SSL3_FLAGS_CCS_OK 0x0080 /* SSL3_FLAGS_SGC_RESTART_DONE is no longer used */ # define SSL3_FLAGS_SGC_RESTART_DONE 0x0040 # ifndef OPENSSL_NO_SSL_INTERN typedef struct ssl3_state_st { long flags; int delay_buf_pop_ret; unsigned char read_sequence[8]; int read_mac_secret_size; unsigned char read_mac_secret[EVP_MAX_MD_SIZE]; unsigned char write_sequence[8]; int write_mac_secret_size; unsigned char write_mac_secret[EVP_MAX_MD_SIZE]; unsigned char server_random[SSL3_RANDOM_SIZE]; unsigned char client_random[SSL3_RANDOM_SIZE]; /* flags for countermeasure against known-IV weakness */ int need_empty_fragments; int empty_fragment_done; /* The value of 'extra' when the buffers were initialized */ int init_extra; SSL3_BUFFER rbuf; /* read IO goes into here */ SSL3_BUFFER wbuf; /* write IO goes into here */ SSL3_RECORD rrec; /* each decoded record goes in here */ SSL3_RECORD wrec; /* goes out from here */ /* * storage for Alert/Handshake protocol data received but not yet * processed by ssl3_read_bytes: */ unsigned char alert_fragment[2]; unsigned int alert_fragment_len; unsigned char handshake_fragment[4]; unsigned int handshake_fragment_len; /* partial write - check the numbers match */ unsigned int wnum; /* number of bytes sent so far */ int wpend_tot; /* number bytes written */ int wpend_type; int wpend_ret; /* number of bytes submitted */ const unsigned char *wpend_buf; /* used during startup, digest all incoming/outgoing packets */ BIO *handshake_buffer; /* * When set of handshake digests is determined, buffer is hashed and * freed and MD_CTX-es for all required digests are stored in this array */ EVP_MD_CTX **handshake_dgst; /* * Set whenever an expected ChangeCipherSpec message is processed. * Unset when the peer's Finished message is received. * Unexpected ChangeCipherSpec messages trigger a fatal alert. */ int change_cipher_spec; int warn_alert; int fatal_alert; /* * we allow one fatal and one warning alert to be outstanding, send close * alert via the warning alert */ int alert_dispatch; unsigned char send_alert[2]; /* * This flag is set when we should renegotiate ASAP, basically when there * is no more data in the read or write buffers */ int renegotiate; int total_renegotiations; int num_renegotiations; int in_read_app_data; /* * Opaque PRF input as used for the current handshake. These fields are * used only if TLSEXT_TYPE_opaque_prf_input is defined (otherwise, they * are merely present to improve binary compatibility) */ void *client_opaque_prf_input; size_t client_opaque_prf_input_len; void *server_opaque_prf_input; size_t server_opaque_prf_input_len; struct { /* actually only needs to be 16+20 */ unsigned char cert_verify_md[EVP_MAX_MD_SIZE * 2]; /* actually only need to be 16+20 for SSLv3 and 12 for TLS */ unsigned char finish_md[EVP_MAX_MD_SIZE * 2]; int finish_md_len; unsigned char peer_finish_md[EVP_MAX_MD_SIZE * 2]; int peer_finish_md_len; unsigned long message_size; int message_type; /* used to hold the new cipher we are going to use */ const SSL_CIPHER *new_cipher; # ifndef OPENSSL_NO_DH DH *dh; # endif # ifndef OPENSSL_NO_ECDH EC_KEY *ecdh; /* holds short lived ECDH key */ # endif /* used when SSL_ST_FLUSH_DATA is entered */ int next_state; int reuse_message; /* used for certificate requests */ int cert_req; int ctype_num; char ctype[SSL3_CT_NUMBER]; STACK_OF(X509_NAME) *ca_names; int use_rsa_tmp; int key_block_length; unsigned char *key_block; const EVP_CIPHER *new_sym_enc; const EVP_MD *new_hash; int new_mac_pkey_type; int new_mac_secret_size; # ifndef OPENSSL_NO_COMP const SSL_COMP *new_compression; # else char *new_compression; # endif int cert_request; } tmp; /* Connection binding to prevent renegotiation attacks */ unsigned char previous_client_finished[EVP_MAX_MD_SIZE]; unsigned char previous_client_finished_len; unsigned char previous_server_finished[EVP_MAX_MD_SIZE]; unsigned char previous_server_finished_len; int send_connection_binding; /* TODOEKR */ # ifndef OPENSSL_NO_NEXTPROTONEG /* * Set if we saw the Next Protocol Negotiation extension from our peer. */ int next_proto_neg_seen; # endif # ifndef OPENSSL_NO_TLSEXT # ifndef OPENSSL_NO_EC /* * This is set to true if we believe that this is a version of Safari * running on OS X 10.6 or newer. We wish to know this because Safari on * 10.8 .. 10.8.3 has broken ECDHE-ECDSA support. */ char is_probably_safari; # endif /* !OPENSSL_NO_EC */ /* * ALPN information (we are in the process of transitioning from NPN to * ALPN.) */ /* * In a server these point to the selected ALPN protocol after the * ClientHello has been processed. In a client these contain the protocol * that the server selected once the ServerHello has been processed. */ unsigned char *alpn_selected; unsigned alpn_selected_len; # endif /* OPENSSL_NO_TLSEXT */ } SSL3_STATE; # endif /* SSLv3 */ /* * client */ /* extra state */ # define SSL3_ST_CW_FLUSH (0x100|SSL_ST_CONNECT) # ifndef OPENSSL_NO_SCTP # define DTLS1_SCTP_ST_CW_WRITE_SOCK (0x310|SSL_ST_CONNECT) # define DTLS1_SCTP_ST_CR_READ_SOCK (0x320|SSL_ST_CONNECT) # endif /* write to server */ # define SSL3_ST_CW_CLNT_HELLO_A (0x110|SSL_ST_CONNECT) # define SSL3_ST_CW_CLNT_HELLO_B (0x111|SSL_ST_CONNECT) /* read from server */ # define SSL3_ST_CR_SRVR_HELLO_A (0x120|SSL_ST_CONNECT) # define SSL3_ST_CR_SRVR_HELLO_B (0x121|SSL_ST_CONNECT) # define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A (0x126|SSL_ST_CONNECT) # define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B (0x127|SSL_ST_CONNECT) # define SSL3_ST_CR_CERT_A (0x130|SSL_ST_CONNECT) # define SSL3_ST_CR_CERT_B (0x131|SSL_ST_CONNECT) # define SSL3_ST_CR_KEY_EXCH_A (0x140|SSL_ST_CONNECT) # define SSL3_ST_CR_KEY_EXCH_B (0x141|SSL_ST_CONNECT) # define SSL3_ST_CR_CERT_REQ_A (0x150|SSL_ST_CONNECT) # define SSL3_ST_CR_CERT_REQ_B (0x151|SSL_ST_CONNECT) # define SSL3_ST_CR_SRVR_DONE_A (0x160|SSL_ST_CONNECT) # define SSL3_ST_CR_SRVR_DONE_B (0x161|SSL_ST_CONNECT) /* write to server */ # define SSL3_ST_CW_CERT_A (0x170|SSL_ST_CONNECT) # define SSL3_ST_CW_CERT_B (0x171|SSL_ST_CONNECT) # define SSL3_ST_CW_CERT_C (0x172|SSL_ST_CONNECT) # define SSL3_ST_CW_CERT_D (0x173|SSL_ST_CONNECT) # define SSL3_ST_CW_KEY_EXCH_A (0x180|SSL_ST_CONNECT) # define SSL3_ST_CW_KEY_EXCH_B (0x181|SSL_ST_CONNECT) # define SSL3_ST_CW_CERT_VRFY_A (0x190|SSL_ST_CONNECT) # define SSL3_ST_CW_CERT_VRFY_B (0x191|SSL_ST_CONNECT) # define SSL3_ST_CW_CHANGE_A (0x1A0|SSL_ST_CONNECT) # define SSL3_ST_CW_CHANGE_B (0x1A1|SSL_ST_CONNECT) # ifndef OPENSSL_NO_NEXTPROTONEG # define SSL3_ST_CW_NEXT_PROTO_A (0x200|SSL_ST_CONNECT) # define SSL3_ST_CW_NEXT_PROTO_B (0x201|SSL_ST_CONNECT) # endif # define SSL3_ST_CW_FINISHED_A (0x1B0|SSL_ST_CONNECT) # define SSL3_ST_CW_FINISHED_B (0x1B1|SSL_ST_CONNECT) /* read from server */ # define SSL3_ST_CR_CHANGE_A (0x1C0|SSL_ST_CONNECT) # define SSL3_ST_CR_CHANGE_B (0x1C1|SSL_ST_CONNECT) # define SSL3_ST_CR_FINISHED_A (0x1D0|SSL_ST_CONNECT) # define SSL3_ST_CR_FINISHED_B (0x1D1|SSL_ST_CONNECT) # define SSL3_ST_CR_SESSION_TICKET_A (0x1E0|SSL_ST_CONNECT) # define SSL3_ST_CR_SESSION_TICKET_B (0x1E1|SSL_ST_CONNECT) # define SSL3_ST_CR_CERT_STATUS_A (0x1F0|SSL_ST_CONNECT) # define SSL3_ST_CR_CERT_STATUS_B (0x1F1|SSL_ST_CONNECT) /* server */ /* extra state */ # define SSL3_ST_SW_FLUSH (0x100|SSL_ST_ACCEPT) # ifndef OPENSSL_NO_SCTP # define DTLS1_SCTP_ST_SW_WRITE_SOCK (0x310|SSL_ST_ACCEPT) # define DTLS1_SCTP_ST_SR_READ_SOCK (0x320|SSL_ST_ACCEPT) # endif /* read from client */ /* Do not change the number values, they do matter */ # define SSL3_ST_SR_CLNT_HELLO_A (0x110|SSL_ST_ACCEPT) # define SSL3_ST_SR_CLNT_HELLO_B (0x111|SSL_ST_ACCEPT) # define SSL3_ST_SR_CLNT_HELLO_C (0x112|SSL_ST_ACCEPT) # define SSL3_ST_SR_CLNT_HELLO_D (0x115|SSL_ST_ACCEPT) /* write to client */ # define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A (0x113|SSL_ST_ACCEPT) # define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B (0x114|SSL_ST_ACCEPT) # define SSL3_ST_SW_HELLO_REQ_A (0x120|SSL_ST_ACCEPT) # define SSL3_ST_SW_HELLO_REQ_B (0x121|SSL_ST_ACCEPT) # define SSL3_ST_SW_HELLO_REQ_C (0x122|SSL_ST_ACCEPT) # define SSL3_ST_SW_SRVR_HELLO_A (0x130|SSL_ST_ACCEPT) # define SSL3_ST_SW_SRVR_HELLO_B (0x131|SSL_ST_ACCEPT) # define SSL3_ST_SW_CERT_A (0x140|SSL_ST_ACCEPT) # define SSL3_ST_SW_CERT_B (0x141|SSL_ST_ACCEPT) # define SSL3_ST_SW_KEY_EXCH_A (0x150|SSL_ST_ACCEPT) # define SSL3_ST_SW_KEY_EXCH_B (0x151|SSL_ST_ACCEPT) # define SSL3_ST_SW_CERT_REQ_A (0x160|SSL_ST_ACCEPT) # define SSL3_ST_SW_CERT_REQ_B (0x161|SSL_ST_ACCEPT) # define SSL3_ST_SW_SRVR_DONE_A (0x170|SSL_ST_ACCEPT) # define SSL3_ST_SW_SRVR_DONE_B (0x171|SSL_ST_ACCEPT) /* read from client */ # define SSL3_ST_SR_CERT_A (0x180|SSL_ST_ACCEPT) # define SSL3_ST_SR_CERT_B (0x181|SSL_ST_ACCEPT) # define SSL3_ST_SR_KEY_EXCH_A (0x190|SSL_ST_ACCEPT) # define SSL3_ST_SR_KEY_EXCH_B (0x191|SSL_ST_ACCEPT) # define SSL3_ST_SR_CERT_VRFY_A (0x1A0|SSL_ST_ACCEPT) # define SSL3_ST_SR_CERT_VRFY_B (0x1A1|SSL_ST_ACCEPT) # define SSL3_ST_SR_CHANGE_A (0x1B0|SSL_ST_ACCEPT) # define SSL3_ST_SR_CHANGE_B (0x1B1|SSL_ST_ACCEPT) # ifndef OPENSSL_NO_NEXTPROTONEG # define SSL3_ST_SR_NEXT_PROTO_A (0x210|SSL_ST_ACCEPT) # define SSL3_ST_SR_NEXT_PROTO_B (0x211|SSL_ST_ACCEPT) # endif # define SSL3_ST_SR_FINISHED_A (0x1C0|SSL_ST_ACCEPT) # define SSL3_ST_SR_FINISHED_B (0x1C1|SSL_ST_ACCEPT) /* write to client */ # define SSL3_ST_SW_CHANGE_A (0x1D0|SSL_ST_ACCEPT) # define SSL3_ST_SW_CHANGE_B (0x1D1|SSL_ST_ACCEPT) # define SSL3_ST_SW_FINISHED_A (0x1E0|SSL_ST_ACCEPT) # define SSL3_ST_SW_FINISHED_B (0x1E1|SSL_ST_ACCEPT) # define SSL3_ST_SW_SESSION_TICKET_A (0x1F0|SSL_ST_ACCEPT) # define SSL3_ST_SW_SESSION_TICKET_B (0x1F1|SSL_ST_ACCEPT) # define SSL3_ST_SW_CERT_STATUS_A (0x200|SSL_ST_ACCEPT) # define SSL3_ST_SW_CERT_STATUS_B (0x201|SSL_ST_ACCEPT) # define SSL3_MT_HELLO_REQUEST 0 # define SSL3_MT_CLIENT_HELLO 1 # define SSL3_MT_SERVER_HELLO 2 # define SSL3_MT_NEWSESSION_TICKET 4 # define SSL3_MT_CERTIFICATE 11 # define SSL3_MT_SERVER_KEY_EXCHANGE 12 # define SSL3_MT_CERTIFICATE_REQUEST 13 # define SSL3_MT_SERVER_DONE 14 # define SSL3_MT_CERTIFICATE_VERIFY 15 # define SSL3_MT_CLIENT_KEY_EXCHANGE 16 # define SSL3_MT_FINISHED 20 # define SSL3_MT_CERTIFICATE_STATUS 22 # ifndef OPENSSL_NO_NEXTPROTONEG # define SSL3_MT_NEXT_PROTO 67 # endif # define DTLS1_MT_HELLO_VERIFY_REQUEST 3 # define SSL3_MT_CCS 1 /* These are used when changing over to a new cipher */ # define SSL3_CC_READ 0x01 # define SSL3_CC_WRITE 0x02 # define SSL3_CC_CLIENT 0x10 # define SSL3_CC_SERVER 0x20 # define SSL3_CHANGE_CIPHER_CLIENT_WRITE (SSL3_CC_CLIENT|SSL3_CC_WRITE) # define SSL3_CHANGE_CIPHER_SERVER_READ (SSL3_CC_SERVER|SSL3_CC_READ) # define SSL3_CHANGE_CIPHER_CLIENT_READ (SSL3_CC_CLIENT|SSL3_CC_READ) # define SSL3_CHANGE_CIPHER_SERVER_WRITE (SSL3_CC_SERVER|SSL3_CC_WRITE) #ifdef __cplusplus } #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/err.h���������������������������������������������������������������������������������������0000644�����������������00000040656�14763166030�0007211 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/err/err.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_ERR_H # define HEADER_ERR_H # include <openssl/e_os2.h> # ifndef OPENSSL_NO_FP_API # include <stdio.h> # include <stdlib.h> # endif # include <openssl/ossl_typ.h> # ifndef OPENSSL_NO_BIO # include <openssl/bio.h> # endif # ifndef OPENSSL_NO_LHASH # include <openssl/lhash.h> # endif #ifdef __cplusplus extern "C" { #endif # ifndef OPENSSL_NO_ERR # define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e) # else # define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,NULL,0) # endif # include <errno.h> # define ERR_TXT_MALLOCED 0x01 # define ERR_TXT_STRING 0x02 # define ERR_FLAG_MARK 0x01 # define ERR_FLAG_CLEAR 0x02 # define ERR_NUM_ERRORS 16 typedef struct err_state_st { CRYPTO_THREADID tid; int err_flags[ERR_NUM_ERRORS]; unsigned long err_buffer[ERR_NUM_ERRORS]; char *err_data[ERR_NUM_ERRORS]; int err_data_flags[ERR_NUM_ERRORS]; const char *err_file[ERR_NUM_ERRORS]; int err_line[ERR_NUM_ERRORS]; int top, bottom; } ERR_STATE; /* library */ # define ERR_LIB_NONE 1 # define ERR_LIB_SYS 2 # define ERR_LIB_BN 3 # define ERR_LIB_RSA 4 # define ERR_LIB_DH 5 # define ERR_LIB_EVP 6 # define ERR_LIB_BUF 7 # define ERR_LIB_OBJ 8 # define ERR_LIB_PEM 9 # define ERR_LIB_DSA 10 # define ERR_LIB_X509 11 /* #define ERR_LIB_METH 12 */ # define ERR_LIB_ASN1 13 # define ERR_LIB_CONF 14 # define ERR_LIB_CRYPTO 15 # define ERR_LIB_EC 16 # define ERR_LIB_SSL 20 /* #define ERR_LIB_SSL23 21 */ /* #define ERR_LIB_SSL2 22 */ /* #define ERR_LIB_SSL3 23 */ /* #define ERR_LIB_RSAREF 30 */ /* #define ERR_LIB_PROXY 31 */ # define ERR_LIB_BIO 32 # define ERR_LIB_PKCS7 33 # define ERR_LIB_X509V3 34 # define ERR_LIB_PKCS12 35 # define ERR_LIB_RAND 36 # define ERR_LIB_DSO 37 # define ERR_LIB_ENGINE 38 # define ERR_LIB_OCSP 39 # define ERR_LIB_UI 40 # define ERR_LIB_COMP 41 # define ERR_LIB_ECDSA 42 # define ERR_LIB_ECDH 43 # define ERR_LIB_STORE 44 # define ERR_LIB_FIPS 45 # define ERR_LIB_CMS 46 # define ERR_LIB_TS 47 # define ERR_LIB_HMAC 48 # define ERR_LIB_JPAKE 49 # define ERR_LIB_USER 128 # define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),__FILE__,__LINE__) # define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),__FILE__,__LINE__) # define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),__FILE__,__LINE__) # define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),__FILE__,__LINE__) # define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),__FILE__,__LINE__) # define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),__FILE__,__LINE__) # define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),__FILE__,__LINE__) # define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),__FILE__,__LINE__) # define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),__FILE__,__LINE__) # define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),__FILE__,__LINE__) # define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),__FILE__,__LINE__) # define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),__FILE__,__LINE__) # define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),__FILE__,__LINE__) # define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),__FILE__,__LINE__) # define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__) # define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),__FILE__,__LINE__) # define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),__FILE__,__LINE__) # define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),__FILE__,__LINE__) # define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),__FILE__,__LINE__) # define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),__FILE__,__LINE__) # define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),__FILE__,__LINE__) # define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),__FILE__,__LINE__) # define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__) # define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__) # define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__) # define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),__FILE__,__LINE__) # define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),__FILE__,__LINE__) # define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE__) # define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),__FILE__,__LINE__) # define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),__FILE__,__LINE__) # define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),__FILE__,__LINE__) # define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),__FILE__,__LINE__) # define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),__FILE__,__LINE__) /* * Borland C seems too stupid to be able to shift and do longs in the * pre-processor :-( */ # define ERR_PACK(l,f,r) (((((unsigned long)l)&0xffL)*0x1000000)| \ ((((unsigned long)f)&0xfffL)*0x1000)| \ ((((unsigned long)r)&0xfffL))) # define ERR_GET_LIB(l) (int)((((unsigned long)l)>>24L)&0xffL) # define ERR_GET_FUNC(l) (int)((((unsigned long)l)>>12L)&0xfffL) # define ERR_GET_REASON(l) (int)((l)&0xfffL) # define ERR_FATAL_ERROR(l) (int)((l)&ERR_R_FATAL) /* OS functions */ # define SYS_F_FOPEN 1 # define SYS_F_CONNECT 2 # define SYS_F_GETSERVBYNAME 3 # define SYS_F_SOCKET 4 # define SYS_F_IOCTLSOCKET 5 # define SYS_F_BIND 6 # define SYS_F_LISTEN 7 # define SYS_F_ACCEPT 8 # define SYS_F_WSASTARTUP 9/* Winsock stuff */ # define SYS_F_OPENDIR 10 # define SYS_F_FREAD 11 /* reasons */ # define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */ # define ERR_R_BN_LIB ERR_LIB_BN/* 3 */ # define ERR_R_RSA_LIB ERR_LIB_RSA/* 4 */ # define ERR_R_DH_LIB ERR_LIB_DH/* 5 */ # define ERR_R_EVP_LIB ERR_LIB_EVP/* 6 */ # define ERR_R_BUF_LIB ERR_LIB_BUF/* 7 */ # define ERR_R_OBJ_LIB ERR_LIB_OBJ/* 8 */ # define ERR_R_PEM_LIB ERR_LIB_PEM/* 9 */ # define ERR_R_DSA_LIB ERR_LIB_DSA/* 10 */ # define ERR_R_X509_LIB ERR_LIB_X509/* 11 */ # define ERR_R_ASN1_LIB ERR_LIB_ASN1/* 13 */ # define ERR_R_CONF_LIB ERR_LIB_CONF/* 14 */ # define ERR_R_CRYPTO_LIB ERR_LIB_CRYPTO/* 15 */ # define ERR_R_EC_LIB ERR_LIB_EC/* 16 */ # define ERR_R_SSL_LIB ERR_LIB_SSL/* 20 */ # define ERR_R_BIO_LIB ERR_LIB_BIO/* 32 */ # define ERR_R_PKCS7_LIB ERR_LIB_PKCS7/* 33 */ # define ERR_R_X509V3_LIB ERR_LIB_X509V3/* 34 */ # define ERR_R_PKCS12_LIB ERR_LIB_PKCS12/* 35 */ # define ERR_R_RAND_LIB ERR_LIB_RAND/* 36 */ # define ERR_R_DSO_LIB ERR_LIB_DSO/* 37 */ # define ERR_R_ENGINE_LIB ERR_LIB_ENGINE/* 38 */ # define ERR_R_OCSP_LIB ERR_LIB_OCSP/* 39 */ # define ERR_R_UI_LIB ERR_LIB_UI/* 40 */ # define ERR_R_COMP_LIB ERR_LIB_COMP/* 41 */ # define ERR_R_ECDSA_LIB ERR_LIB_ECDSA/* 42 */ # define ERR_R_ECDH_LIB ERR_LIB_ECDH/* 43 */ # define ERR_R_STORE_LIB ERR_LIB_STORE/* 44 */ # define ERR_R_TS_LIB ERR_LIB_TS/* 45 */ # define ERR_R_NESTED_ASN1_ERROR 58 # define ERR_R_BAD_ASN1_OBJECT_HEADER 59 # define ERR_R_BAD_GET_ASN1_OBJECT_CALL 60 # define ERR_R_EXPECTING_AN_ASN1_SEQUENCE 61 # define ERR_R_ASN1_LENGTH_MISMATCH 62 # define ERR_R_MISSING_ASN1_EOS 63 /* fatal error */ # define ERR_R_FATAL 64 # define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL) # define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL) # define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL) # define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL) # define ERR_R_DISABLED (5|ERR_R_FATAL) /* * 99 is the maximum possible ERR_R_... code, higher values are reserved for * the individual libraries */ typedef struct ERR_string_data_st { unsigned long error; const char *string; } ERR_STRING_DATA; void ERR_put_error(int lib, int func, int reason, const char *file, int line); void ERR_set_error_data(char *data, int flags); unsigned long ERR_get_error(void); unsigned long ERR_get_error_line(const char **file, int *line); unsigned long ERR_get_error_line_data(const char **file, int *line, const char **data, int *flags); unsigned long ERR_peek_error(void); unsigned long ERR_peek_error_line(const char **file, int *line); unsigned long ERR_peek_error_line_data(const char **file, int *line, const char **data, int *flags); unsigned long ERR_peek_last_error(void); unsigned long ERR_peek_last_error_line(const char **file, int *line); unsigned long ERR_peek_last_error_line_data(const char **file, int *line, const char **data, int *flags); void ERR_clear_error(void); char *ERR_error_string(unsigned long e, char *buf); void ERR_error_string_n(unsigned long e, char *buf, size_t len); const char *ERR_lib_error_string(unsigned long e); const char *ERR_func_error_string(unsigned long e); const char *ERR_reason_error_string(unsigned long e); void ERR_print_errors_cb(int (*cb) (const char *str, size_t len, void *u), void *u); # ifndef OPENSSL_NO_FP_API void ERR_print_errors_fp(FILE *fp); # endif # ifndef OPENSSL_NO_BIO void ERR_print_errors(BIO *bp); # endif void ERR_add_error_data(int num, ...); void ERR_add_error_vdata(int num, va_list args); void ERR_load_strings(int lib, ERR_STRING_DATA str[]); void ERR_unload_strings(int lib, ERR_STRING_DATA str[]); void ERR_load_ERR_strings(void); void ERR_load_crypto_strings(void); void ERR_free_strings(void); void ERR_remove_thread_state(const CRYPTO_THREADID *tid); # ifndef OPENSSL_NO_DEPRECATED void ERR_remove_state(unsigned long pid); /* if zero we look it up */ # endif ERR_STATE *ERR_get_state(void); # ifndef OPENSSL_NO_LHASH LHASH_OF(ERR_STRING_DATA) *ERR_get_string_table(void); LHASH_OF(ERR_STATE) *ERR_get_err_state_table(void); void ERR_release_err_state_table(LHASH_OF(ERR_STATE) **hash); # endif int ERR_get_next_error_library(void); int ERR_set_mark(void); int ERR_pop_to_mark(void); /* Already defined in ossl_typ.h */ /* typedef struct st_ERR_FNS ERR_FNS; */ /* * An application can use this function and provide the return value to * loaded modules that should use the application's ERR state/functionality */ const ERR_FNS *ERR_get_implementation(void); /* * A loaded module should call this function prior to any ERR operations * using the application's "ERR_FNS". */ int ERR_set_implementation(const ERR_FNS *fns); #ifdef __cplusplus } #endif #endif ����������������������������������������������������������������������������������openssl/dso.h���������������������������������������������������������������������������������������0000644�����������������00000047362�14763166030�0007207 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* dso.h */ /* * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project * 2000. */ /* ==================================================================== * Copyright (c) 2000 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * licensing@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_DSO_H # define HEADER_DSO_H # include <openssl/crypto.h> #ifdef __cplusplus extern "C" { #endif /* These values are used as commands to DSO_ctrl() */ # define DSO_CTRL_GET_FLAGS 1 # define DSO_CTRL_SET_FLAGS 2 # define DSO_CTRL_OR_FLAGS 3 /* * By default, DSO_load() will translate the provided filename into a form * typical for the platform (more specifically the DSO_METHOD) using the * dso_name_converter function of the method. Eg. win32 will transform "blah" * into "blah.dll", and dlfcn will transform it into "libblah.so". The * behaviour can be overriden by setting the name_converter callback in the * DSO object (using DSO_set_name_converter()). This callback could even * utilise the DSO_METHOD's converter too if it only wants to override * behaviour for one or two possible DSO methods. However, the following flag * can be set in a DSO to prevent *any* native name-translation at all - eg. * if the caller has prompted the user for a path to a driver library so the * filename should be interpreted as-is. */ # define DSO_FLAG_NO_NAME_TRANSLATION 0x01 /* * An extra flag to give if only the extension should be added as * translation. This is obviously only of importance on Unix and other * operating systems where the translation also may prefix the name with * something, like 'lib', and ignored everywhere else. This flag is also * ignored if DSO_FLAG_NO_NAME_TRANSLATION is used at the same time. */ # define DSO_FLAG_NAME_TRANSLATION_EXT_ONLY 0x02 /* * The following flag controls the translation of symbol names to upper case. * This is currently only being implemented for OpenVMS. */ # define DSO_FLAG_UPCASE_SYMBOL 0x10 /* * This flag loads the library with public symbols. Meaning: The exported * symbols of this library are public to all libraries loaded after this * library. At the moment only implemented in unix. */ # define DSO_FLAG_GLOBAL_SYMBOLS 0x20 typedef void (*DSO_FUNC_TYPE) (void); typedef struct dso_st DSO; /* * The function prototype used for method functions (or caller-provided * callbacks) that transform filenames. They are passed a DSO structure * pointer (or NULL if they are to be used independantly of a DSO object) and * a filename to transform. They should either return NULL (if there is an * error condition) or a newly allocated string containing the transformed * form that the caller will need to free with OPENSSL_free() when done. */ typedef char *(*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *); /* * The function prototype used for method functions (or caller-provided * callbacks) that merge two file specifications. They are passed a DSO * structure pointer (or NULL if they are to be used independantly of a DSO * object) and two file specifications to merge. They should either return * NULL (if there is an error condition) or a newly allocated string * containing the result of merging that the caller will need to free with * OPENSSL_free() when done. Here, merging means that bits and pieces are * taken from each of the file specifications and added together in whatever * fashion that is sensible for the DSO method in question. The only rule * that really applies is that if the two specification contain pieces of the * same type, the copy from the first string takes priority. One could see * it as the first specification is the one given by the user and the second * being a bunch of defaults to add on if they're missing in the first. */ typedef char *(*DSO_MERGER_FUNC)(DSO *, const char *, const char *); typedef struct dso_meth_st { const char *name; /* * Loads a shared library, NB: new DSO_METHODs must ensure that a * successful load populates the loaded_filename field, and likewise a * successful unload OPENSSL_frees and NULLs it out. */ int (*dso_load) (DSO *dso); /* Unloads a shared library */ int (*dso_unload) (DSO *dso); /* Binds a variable */ void *(*dso_bind_var) (DSO *dso, const char *symname); /* * Binds a function - assumes a return type of DSO_FUNC_TYPE. This should * be cast to the real function prototype by the caller. Platforms that * don't have compatible representations for different prototypes (this * is possible within ANSI C) are highly unlikely to have shared * libraries at all, let alone a DSO_METHOD implemented for them. */ DSO_FUNC_TYPE (*dso_bind_func) (DSO *dso, const char *symname); /* I don't think this would actually be used in any circumstances. */ # if 0 /* Unbinds a variable */ int (*dso_unbind_var) (DSO *dso, char *symname, void *symptr); /* Unbinds a function */ int (*dso_unbind_func) (DSO *dso, char *symname, DSO_FUNC_TYPE symptr); # endif /* * The generic (yuck) "ctrl()" function. NB: Negative return values * (rather than zero) indicate errors. */ long (*dso_ctrl) (DSO *dso, int cmd, long larg, void *parg); /* * The default DSO_METHOD-specific function for converting filenames to a * canonical native form. */ DSO_NAME_CONVERTER_FUNC dso_name_converter; /* * The default DSO_METHOD-specific function for converting filenames to a * canonical native form. */ DSO_MERGER_FUNC dso_merger; /* [De]Initialisation handlers. */ int (*init) (DSO *dso); int (*finish) (DSO *dso); /* Return pathname of the module containing location */ int (*pathbyaddr) (void *addr, char *path, int sz); /* Perform global symbol lookup, i.e. among *all* modules */ void *(*globallookup) (const char *symname); } DSO_METHOD; /**********************************************************************/ /* The low-level handle type used to refer to a loaded shared library */ struct dso_st { DSO_METHOD *meth; /* * Standard dlopen uses a (void *). Win32 uses a HANDLE. VMS doesn't use * anything but will need to cache the filename for use in the dso_bind * handler. All in all, let each method control its own destiny. * "Handles" and such go in a STACK. */ STACK_OF(void) *meth_data; int references; int flags; /* * For use by applications etc ... use this for your bits'n'pieces, don't * touch meth_data! */ CRYPTO_EX_DATA ex_data; /* * If this callback function pointer is set to non-NULL, then it will be * used in DSO_load() in place of meth->dso_name_converter. NB: This * should normally set using DSO_set_name_converter(). */ DSO_NAME_CONVERTER_FUNC name_converter; /* * If this callback function pointer is set to non-NULL, then it will be * used in DSO_load() in place of meth->dso_merger. NB: This should * normally set using DSO_set_merger(). */ DSO_MERGER_FUNC merger; /* * This is populated with (a copy of) the platform-independant filename * used for this DSO. */ char *filename; /* * This is populated with (a copy of) the translated filename by which * the DSO was actually loaded. It is NULL iff the DSO is not currently * loaded. NB: This is here because the filename translation process may * involve a callback being invoked more than once not only to convert to * a platform-specific form, but also to try different filenames in the * process of trying to perform a load. As such, this variable can be * used to indicate (a) whether this DSO structure corresponds to a * loaded library or not, and (b) the filename with which it was actually * loaded. */ char *loaded_filename; }; DSO *DSO_new(void); DSO *DSO_new_method(DSO_METHOD *method); int DSO_free(DSO *dso); int DSO_flags(DSO *dso); int DSO_up_ref(DSO *dso); long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg); /* * This function sets the DSO's name_converter callback. If it is non-NULL, * then it will be used instead of the associated DSO_METHOD's function. If * oldcb is non-NULL then it is set to the function pointer value being * replaced. Return value is non-zero for success. */ int DSO_set_name_converter(DSO *dso, DSO_NAME_CONVERTER_FUNC cb, DSO_NAME_CONVERTER_FUNC *oldcb); /* * These functions can be used to get/set the platform-independant filename * used for a DSO. NB: set will fail if the DSO is already loaded. */ const char *DSO_get_filename(DSO *dso); int DSO_set_filename(DSO *dso, const char *filename); /* * This function will invoke the DSO's name_converter callback to translate a * filename, or if the callback isn't set it will instead use the DSO_METHOD's * converter. If "filename" is NULL, the "filename" in the DSO itself will be * used. If the DSO_FLAG_NO_NAME_TRANSLATION flag is set, then the filename is * simply duplicated. NB: This function is usually called from within a * DSO_METHOD during the processing of a DSO_load() call, and is exposed so * that caller-created DSO_METHODs can do the same thing. A non-NULL return * value will need to be OPENSSL_free()'d. */ char *DSO_convert_filename(DSO *dso, const char *filename); /* * This function will invoke the DSO's merger callback to merge two file * specifications, or if the callback isn't set it will instead use the * DSO_METHOD's merger. A non-NULL return value will need to be * OPENSSL_free()'d. */ char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2); /* * If the DSO is currently loaded, this returns the filename that it was * loaded under, otherwise it returns NULL. So it is also useful as a test as * to whether the DSO is currently loaded. NB: This will not necessarily * return the same value as DSO_convert_filename(dso, dso->filename), because * the DSO_METHOD's load function may have tried a variety of filenames (with * and/or without the aid of the converters) before settling on the one it * actually loaded. */ const char *DSO_get_loaded_filename(DSO *dso); void DSO_set_default_method(DSO_METHOD *meth); DSO_METHOD *DSO_get_default_method(void); DSO_METHOD *DSO_get_method(DSO *dso); DSO_METHOD *DSO_set_method(DSO *dso, DSO_METHOD *meth); /* * The all-singing all-dancing load function, you normally pass NULL for the * first and third parameters. Use DSO_up and DSO_free for subsequent * reference count handling. Any flags passed in will be set in the * constructed DSO after its init() function but before the load operation. * If 'dso' is non-NULL, 'flags' is ignored. */ DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags); /* This function binds to a variable inside a shared library. */ void *DSO_bind_var(DSO *dso, const char *symname); /* This function binds to a function inside a shared library. */ DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname); /* * This method is the default, but will beg, borrow, or steal whatever method * should be the default on any particular platform (including * DSO_METH_null() if necessary). */ DSO_METHOD *DSO_METHOD_openssl(void); /* * This method is defined for all platforms - if a platform has no DSO * support then this will be the only method! */ DSO_METHOD *DSO_METHOD_null(void); /* * If DSO_DLFCN is defined, the standard dlfcn.h-style functions (dlopen, * dlclose, dlsym, etc) will be used and incorporated into this method. If * not, this method will return NULL. */ DSO_METHOD *DSO_METHOD_dlfcn(void); /* * If DSO_DL is defined, the standard dl.h-style functions (shl_load, * shl_unload, shl_findsym, etc) will be used and incorporated into this * method. If not, this method will return NULL. */ DSO_METHOD *DSO_METHOD_dl(void); /* If WIN32 is defined, use DLLs. If not, return NULL. */ DSO_METHOD *DSO_METHOD_win32(void); /* If VMS is defined, use shared images. If not, return NULL. */ DSO_METHOD *DSO_METHOD_vms(void); /* * This function writes null-terminated pathname of DSO module containing * 'addr' into 'sz' large caller-provided 'path' and returns the number of * characters [including trailing zero] written to it. If 'sz' is 0 or * negative, 'path' is ignored and required amount of charachers [including * trailing zero] to accomodate pathname is returned. If 'addr' is NULL, then * pathname of cryptolib itself is returned. Negative or zero return value * denotes error. */ int DSO_pathbyaddr(void *addr, char *path, int sz); /* * This function should be used with caution! It looks up symbols in *all* * loaded modules and if module gets unloaded by somebody else attempt to * dereference the pointer is doomed to have fatal consequences. Primary * usage for this function is to probe *core* system functionality, e.g. * check if getnameinfo(3) is available at run-time without bothering about * OS-specific details such as libc.so.versioning or where does it actually * reside: in libc itself or libsocket. */ void *DSO_global_lookup(const char *name); /* If BeOS is defined, use shared images. If not, return NULL. */ DSO_METHOD *DSO_METHOD_beos(void); /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_DSO_strings(void); /* Error codes for the DSO functions. */ /* Function codes. */ # define DSO_F_BEOS_BIND_FUNC 144 # define DSO_F_BEOS_BIND_VAR 145 # define DSO_F_BEOS_LOAD 146 # define DSO_F_BEOS_NAME_CONVERTER 147 # define DSO_F_BEOS_UNLOAD 148 # define DSO_F_DLFCN_BIND_FUNC 100 # define DSO_F_DLFCN_BIND_VAR 101 # define DSO_F_DLFCN_LOAD 102 # define DSO_F_DLFCN_MERGER 130 # define DSO_F_DLFCN_NAME_CONVERTER 123 # define DSO_F_DLFCN_UNLOAD 103 # define DSO_F_DL_BIND_FUNC 104 # define DSO_F_DL_BIND_VAR 105 # define DSO_F_DL_LOAD 106 # define DSO_F_DL_MERGER 131 # define DSO_F_DL_NAME_CONVERTER 124 # define DSO_F_DL_UNLOAD 107 # define DSO_F_DSO_BIND_FUNC 108 # define DSO_F_DSO_BIND_VAR 109 # define DSO_F_DSO_CONVERT_FILENAME 126 # define DSO_F_DSO_CTRL 110 # define DSO_F_DSO_FREE 111 # define DSO_F_DSO_GET_FILENAME 127 # define DSO_F_DSO_GET_LOADED_FILENAME 128 # define DSO_F_DSO_GLOBAL_LOOKUP 139 # define DSO_F_DSO_LOAD 112 # define DSO_F_DSO_MERGE 132 # define DSO_F_DSO_NEW_METHOD 113 # define DSO_F_DSO_PATHBYADDR 140 # define DSO_F_DSO_SET_FILENAME 129 # define DSO_F_DSO_SET_NAME_CONVERTER 122 # define DSO_F_DSO_UP_REF 114 # define DSO_F_GLOBAL_LOOKUP_FUNC 138 # define DSO_F_PATHBYADDR 137 # define DSO_F_VMS_BIND_SYM 115 # define DSO_F_VMS_LOAD 116 # define DSO_F_VMS_MERGER 133 # define DSO_F_VMS_UNLOAD 117 # define DSO_F_WIN32_BIND_FUNC 118 # define DSO_F_WIN32_BIND_VAR 119 # define DSO_F_WIN32_GLOBALLOOKUP 142 # define DSO_F_WIN32_GLOBALLOOKUP_FUNC 143 # define DSO_F_WIN32_JOINER 135 # define DSO_F_WIN32_LOAD 120 # define DSO_F_WIN32_MERGER 134 # define DSO_F_WIN32_NAME_CONVERTER 125 # define DSO_F_WIN32_PATHBYADDR 141 # define DSO_F_WIN32_SPLITTER 136 # define DSO_F_WIN32_UNLOAD 121 /* Reason codes. */ # define DSO_R_CTRL_FAILED 100 # define DSO_R_DSO_ALREADY_LOADED 110 # define DSO_R_EMPTY_FILE_STRUCTURE 113 # define DSO_R_FAILURE 114 # define DSO_R_FILENAME_TOO_BIG 101 # define DSO_R_FINISH_FAILED 102 # define DSO_R_INCORRECT_FILE_SYNTAX 115 # define DSO_R_LOAD_FAILED 103 # define DSO_R_NAME_TRANSLATION_FAILED 109 # define DSO_R_NO_FILENAME 111 # define DSO_R_NO_FILE_SPECIFICATION 116 # define DSO_R_NULL_HANDLE 104 # define DSO_R_SET_FILENAME_FAILED 112 # define DSO_R_STACK_ERROR 105 # define DSO_R_SYM_FAILURE 106 # define DSO_R_UNLOAD_FAILED 107 # define DSO_R_UNSUPPORTED 108 #ifdef __cplusplus } #endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/pkcs12.h������������������������������������������������������������������������������������0000644�����������������00000035003�14763166030�0007512 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* pkcs12.h */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project * 1999. */ /* ==================================================================== * Copyright (c) 1999 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * licensing@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_PKCS12_H # define HEADER_PKCS12_H # include <openssl/bio.h> # include <openssl/x509.h> #ifdef __cplusplus extern "C" { #endif # define PKCS12_KEY_ID 1 # define PKCS12_IV_ID 2 # define PKCS12_MAC_ID 3 /* Default iteration count */ # ifndef PKCS12_DEFAULT_ITER # define PKCS12_DEFAULT_ITER PKCS5_DEFAULT_ITER # endif # define PKCS12_MAC_KEY_LENGTH 20 # define PKCS12_SALT_LEN 8 /* Uncomment out next line for unicode password and names, otherwise ASCII */ /* * #define PBE_UNICODE */ # ifdef PBE_UNICODE # define PKCS12_key_gen PKCS12_key_gen_uni # define PKCS12_add_friendlyname PKCS12_add_friendlyname_uni # else # define PKCS12_key_gen PKCS12_key_gen_asc # define PKCS12_add_friendlyname PKCS12_add_friendlyname_asc # endif /* MS key usage constants */ # define KEY_EX 0x10 # define KEY_SIG 0x80 typedef struct { X509_SIG *dinfo; ASN1_OCTET_STRING *salt; ASN1_INTEGER *iter; /* defaults to 1 */ } PKCS12_MAC_DATA; typedef struct { ASN1_INTEGER *version; PKCS12_MAC_DATA *mac; PKCS7 *authsafes; } PKCS12; typedef struct { ASN1_OBJECT *type; union { struct pkcs12_bag_st *bag; /* secret, crl and certbag */ struct pkcs8_priv_key_info_st *keybag; /* keybag */ X509_SIG *shkeybag; /* shrouded key bag */ STACK_OF(PKCS12_SAFEBAG) *safes; ASN1_TYPE *other; } value; STACK_OF(X509_ATTRIBUTE) *attrib; } PKCS12_SAFEBAG; DECLARE_STACK_OF(PKCS12_SAFEBAG) DECLARE_ASN1_SET_OF(PKCS12_SAFEBAG) DECLARE_PKCS12_STACK_OF(PKCS12_SAFEBAG) typedef struct pkcs12_bag_st { ASN1_OBJECT *type; union { ASN1_OCTET_STRING *x509cert; ASN1_OCTET_STRING *x509crl; ASN1_OCTET_STRING *octet; ASN1_IA5STRING *sdsicert; ASN1_TYPE *other; /* Secret or other bag */ } value; } PKCS12_BAGS; # define PKCS12_ERROR 0 # define PKCS12_OK 1 /* Compatibility macros */ # define M_PKCS12_x5092certbag PKCS12_x5092certbag # define M_PKCS12_x509crl2certbag PKCS12_x509crl2certbag # define M_PKCS12_certbag2x509 PKCS12_certbag2x509 # define M_PKCS12_certbag2x509crl PKCS12_certbag2x509crl # define M_PKCS12_unpack_p7data PKCS12_unpack_p7data # define M_PKCS12_pack_authsafes PKCS12_pack_authsafes # define M_PKCS12_unpack_authsafes PKCS12_unpack_authsafes # define M_PKCS12_unpack_p7encdata PKCS12_unpack_p7encdata # define M_PKCS12_decrypt_skey PKCS12_decrypt_skey # define M_PKCS8_decrypt PKCS8_decrypt # define M_PKCS12_bag_type(bg) OBJ_obj2nid((bg)->type) # define M_PKCS12_cert_bag_type(bg) OBJ_obj2nid((bg)->value.bag->type) # define M_PKCS12_crl_bag_type M_PKCS12_cert_bag_type # define PKCS12_get_attr(bag, attr_nid) \ PKCS12_get_attr_gen(bag->attrib, attr_nid) # define PKCS8_get_attr(p8, attr_nid) \ PKCS12_get_attr_gen(p8->attributes, attr_nid) # define PKCS12_mac_present(p12) ((p12)->mac ? 1 : 0) PKCS12_SAFEBAG *PKCS12_x5092certbag(X509 *x509); PKCS12_SAFEBAG *PKCS12_x509crl2certbag(X509_CRL *crl); X509 *PKCS12_certbag2x509(PKCS12_SAFEBAG *bag); X509_CRL *PKCS12_certbag2x509crl(PKCS12_SAFEBAG *bag); PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, int nid1, int nid2); PKCS12_SAFEBAG *PKCS12_MAKE_KEYBAG(PKCS8_PRIV_KEY_INFO *p8); PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(X509_SIG *p8, const char *pass, int passlen); PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(PKCS12_SAFEBAG *bag, const char *pass, int passlen); X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, const char *pass, int passlen, unsigned char *salt, int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8); PKCS12_SAFEBAG *PKCS12_MAKE_SHKEYBAG(int pbe_nid, const char *pass, int passlen, unsigned char *salt, int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8); PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk); STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7); PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen, unsigned char *salt, int saltlen, int iter, STACK_OF(PKCS12_SAFEBAG) *bags); STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass, int passlen); int PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes); STACK_OF(PKCS7) *PKCS12_unpack_authsafes(PKCS12 *p12); int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, int namelen); int PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name, int namelen); int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name, int namelen); int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag, const unsigned char *name, int namelen); int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage); ASN1_TYPE *PKCS12_get_attr_gen(STACK_OF(X509_ATTRIBUTE) *attrs, int attr_nid); char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag); unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, int passlen, unsigned char *in, int inlen, unsigned char **data, int *datalen, int en_de); void *PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it, const char *pass, int passlen, ASN1_OCTET_STRING *oct, int zbuf); ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, const ASN1_ITEM *it, const char *pass, int passlen, void *obj, int zbuf); PKCS12 *PKCS12_init(int mode); int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, int saltlen, int id, int iter, int n, unsigned char *out, const EVP_MD *md_type); int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, int saltlen, int id, int iter, int n, unsigned char *out, const EVP_MD *md_type); int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md_type, int en_de); int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, unsigned char *mac, unsigned int *maclen); int PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen); int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen, unsigned char *salt, int saltlen, int iter, const EVP_MD *md_type); int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, int saltlen, const EVP_MD *md_type); unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen); char *OPENSSL_uni2asc(unsigned char *uni, int unilen); DECLARE_ASN1_FUNCTIONS(PKCS12) DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA) DECLARE_ASN1_FUNCTIONS(PKCS12_SAFEBAG) DECLARE_ASN1_FUNCTIONS(PKCS12_BAGS) DECLARE_ASN1_ITEM(PKCS12_SAFEBAGS) DECLARE_ASN1_ITEM(PKCS12_AUTHSAFES) void PKCS12_PBE_add(void); int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca); PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert, int iter, int mac_iter, int keytype); PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert); PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags, EVP_PKEY *key, int key_usage, int iter, int key_nid, char *pass); int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags, int safe_nid, int iter, char *pass); PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid); int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12); int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12); PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12); PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12); int PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass); /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_PKCS12_strings(void); /* Error codes for the PKCS12 functions. */ /* Function codes. */ # define PKCS12_F_PARSE_BAG 129 # define PKCS12_F_PARSE_BAGS 103 # define PKCS12_F_PKCS12_ADD_FRIENDLYNAME 100 # define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC 127 # define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI 102 # define PKCS12_F_PKCS12_ADD_LOCALKEYID 104 # define PKCS12_F_PKCS12_CREATE 105 # define PKCS12_F_PKCS12_GEN_MAC 107 # define PKCS12_F_PKCS12_INIT 109 # define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I 106 # define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT 108 # define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG 117 # define PKCS12_F_PKCS12_KEY_GEN_ASC 110 # define PKCS12_F_PKCS12_KEY_GEN_UNI 111 # define PKCS12_F_PKCS12_MAKE_KEYBAG 112 # define PKCS12_F_PKCS12_MAKE_SHKEYBAG 113 # define PKCS12_F_PKCS12_NEWPASS 128 # define PKCS12_F_PKCS12_PACK_P7DATA 114 # define PKCS12_F_PKCS12_PACK_P7ENCDATA 115 # define PKCS12_F_PKCS12_PARSE 118 # define PKCS12_F_PKCS12_PBE_CRYPT 119 # define PKCS12_F_PKCS12_PBE_KEYIVGEN 120 # define PKCS12_F_PKCS12_SETUP_MAC 122 # define PKCS12_F_PKCS12_SET_MAC 123 # define PKCS12_F_PKCS12_UNPACK_AUTHSAFES 130 # define PKCS12_F_PKCS12_UNPACK_P7DATA 131 # define PKCS12_F_PKCS12_VERIFY_MAC 126 # define PKCS12_F_PKCS8_ADD_KEYUSAGE 124 # define PKCS12_F_PKCS8_ENCRYPT 125 /* Reason codes. */ # define PKCS12_R_CANT_PACK_STRUCTURE 100 # define PKCS12_R_CONTENT_TYPE_NOT_DATA 121 # define PKCS12_R_DECODE_ERROR 101 # define PKCS12_R_ENCODE_ERROR 102 # define PKCS12_R_ENCRYPT_ERROR 103 # define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE 120 # define PKCS12_R_INVALID_NULL_ARGUMENT 104 # define PKCS12_R_INVALID_NULL_PKCS12_POINTER 105 # define PKCS12_R_IV_GEN_ERROR 106 # define PKCS12_R_KEY_GEN_ERROR 107 # define PKCS12_R_MAC_ABSENT 108 # define PKCS12_R_MAC_GENERATION_ERROR 109 # define PKCS12_R_MAC_SETUP_ERROR 110 # define PKCS12_R_MAC_STRING_SET_ERROR 111 # define PKCS12_R_MAC_VERIFY_ERROR 112 # define PKCS12_R_MAC_VERIFY_FAILURE 113 # define PKCS12_R_PARSE_ERROR 114 # define PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR 115 # define PKCS12_R_PKCS12_CIPHERFINAL_ERROR 116 # define PKCS12_R_PKCS12_PBE_CRYPT_ERROR 117 # define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM 118 # define PKCS12_R_UNSUPPORTED_PKCS12_MODE 119 #ifdef __cplusplus } #endif #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/dsa.h���������������������������������������������������������������������������������������0000644�����������������00000035213�14763166030�0007161 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/dsa/dsa.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* * The DSS routines are based on patches supplied by * Steven Schoch <schoch@sheba.arc.nasa.gov>. He basically did the * work and I have just tweaked them a little to fit into my * stylistic vision for SSLeay :-) */ #ifndef HEADER_DSA_H # define HEADER_DSA_H # include <openssl/e_os2.h> # ifdef OPENSSL_NO_DSA # error DSA is disabled. # endif # ifndef OPENSSL_NO_BIO # include <openssl/bio.h> # endif # include <openssl/crypto.h> # include <openssl/ossl_typ.h> # ifndef OPENSSL_NO_DEPRECATED # include <openssl/bn.h> # ifndef OPENSSL_NO_DH # include <openssl/dh.h> # endif # endif # ifndef OPENSSL_DSA_MAX_MODULUS_BITS # define OPENSSL_DSA_MAX_MODULUS_BITS 10000 # endif # define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024 # define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS_GEN (getenv("OPENSSL_ENFORCE_MODULUS_BITS")?2048:1024) # define DSA_FLAG_CACHE_MONT_P 0x01 /* * new with 0.9.7h; the built-in DSA implementation now uses constant time * modular exponentiation for secret exponents by default. This flag causes * the faster variable sliding window method to be used for all exponents. */ # define DSA_FLAG_NO_EXP_CONSTTIME 0x02 /* * If this flag is set the DSA method is FIPS compliant and can be used in * FIPS mode. This is set in the validated module method. If an application * sets this flag in its own methods it is its reposibility to ensure the * result is compliant. */ # define DSA_FLAG_FIPS_METHOD 0x0400 /* * If this flag is set the operations normally disabled in FIPS mode are * permitted it is then the applications responsibility to ensure that the * usage is compliant. */ # define DSA_FLAG_NON_FIPS_ALLOW 0x0400 #ifdef __cplusplus extern "C" { #endif /* Already defined in ossl_typ.h */ /* typedef struct dsa_st DSA; */ /* typedef struct dsa_method DSA_METHOD; */ typedef struct DSA_SIG_st { BIGNUM *r; BIGNUM *s; } DSA_SIG; struct dsa_method { const char *name; DSA_SIG *(*dsa_do_sign) (const unsigned char *dgst, int dlen, DSA *dsa); int (*dsa_sign_setup) (DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp); int (*dsa_do_verify) (const unsigned char *dgst, int dgst_len, DSA_SIG *sig, DSA *dsa); int (*dsa_mod_exp) (DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont); /* Can be null */ int (*bn_mod_exp) (DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); int (*init) (DSA *dsa); int (*finish) (DSA *dsa); int flags; char *app_data; /* If this is non-NULL, it is used to generate DSA parameters */ int (*dsa_paramgen) (DSA *dsa, int bits, const unsigned char *seed, int seed_len, int *counter_ret, unsigned long *h_ret, BN_GENCB *cb); /* If this is non-NULL, it is used to generate DSA keys */ int (*dsa_keygen) (DSA *dsa); }; struct dsa_st { /* * This first variable is used to pick up errors where a DSA is passed * instead of of a EVP_PKEY */ int pad; long version; int write_params; BIGNUM *p; BIGNUM *q; /* == 20 */ BIGNUM *g; BIGNUM *pub_key; /* y public key */ BIGNUM *priv_key; /* x private key */ BIGNUM *kinv; /* Signing pre-calc */ BIGNUM *r; /* Signing pre-calc */ int flags; /* Normally used to cache montgomery values */ BN_MONT_CTX *method_mont_p; int references; CRYPTO_EX_DATA ex_data; const DSA_METHOD *meth; /* functional reference if 'meth' is ENGINE-provided */ ENGINE *engine; }; # define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x)) # define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \ (unsigned char *)(x)) # define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x) # define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x) DSA *DSAparams_dup(DSA *x); DSA_SIG *DSA_SIG_new(void); void DSA_SIG_free(DSA_SIG *a); int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); DSA_SIG *d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length); DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, DSA *dsa); const DSA_METHOD *DSA_OpenSSL(void); void DSA_set_default_method(const DSA_METHOD *); const DSA_METHOD *DSA_get_default_method(void); int DSA_set_method(DSA *dsa, const DSA_METHOD *); DSA *DSA_new(void); DSA *DSA_new_method(ENGINE *engine); void DSA_free(DSA *r); /* "up" the DSA object's reference count */ int DSA_up_ref(DSA *r); int DSA_size(const DSA *); /* next 4 return -1 on error */ int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp); int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig, unsigned int *siglen, DSA *dsa); int DSA_verify(int type, const unsigned char *dgst, int dgst_len, const unsigned char *sigbuf, int siglen, DSA *dsa); int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int DSA_set_ex_data(DSA *d, int idx, void *arg); void *DSA_get_ex_data(DSA *d, int idx); DSA *d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length); DSA *d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length); DSA *d2i_DSAparams(DSA **a, const unsigned char **pp, long length); /* Deprecated version */ # ifndef OPENSSL_NO_DEPRECATED DSA *DSA_generate_parameters(int bits, unsigned char *seed, int seed_len, int *counter_ret, unsigned long *h_ret, void (*callback) (int, int, void *), void *cb_arg); # endif /* !defined(OPENSSL_NO_DEPRECATED) */ /* New version */ int DSA_generate_parameters_ex(DSA *dsa, int bits, const unsigned char *seed, int seed_len, int *counter_ret, unsigned long *h_ret, BN_GENCB *cb); int DSA_generate_key(DSA *a); int i2d_DSAPublicKey(const DSA *a, unsigned char **pp); int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); int i2d_DSAparams(const DSA *a, unsigned char **pp); # ifndef OPENSSL_NO_BIO int DSAparams_print(BIO *bp, const DSA *x); int DSA_print(BIO *bp, const DSA *x, int off); # endif # ifndef OPENSSL_NO_FP_API int DSAparams_print_fp(FILE *fp, const DSA *x); int DSA_print_fp(FILE *bp, const DSA *x, int off); # endif # define DSS_prime_checks 64 /* * Primality test according to FIPS PUB 186-4, Appendix 2.1: 64 rounds of * Rabin-Miller */ # define DSA_is_prime(n, callback, cb_arg) \ BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg) # ifndef OPENSSL_NO_DH /* * Convert DSA structure (key or just parameters) into DH structure (be * careful to avoid small subgroup attacks when using this!) */ DH *DSA_dup_DH(const DSA *r); # endif # ifdef OPENSSL_FIPS int FIPS_dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, const EVP_MD *evpmd, const unsigned char *seed_in, size_t seed_len, int *counter_ret, unsigned long *h_ret, BN_GENCB *cb); int FIPS_dsa_generate_pq(BN_CTX *ctx, size_t bits, size_t qbits, const EVP_MD *evpmd, unsigned char *seed, int seed_len, BIGNUM **p_ret, BIGNUM **q_ret, int *counter_ret, BN_GENCB *cb); int FIPS_dsa_generate_g(BN_CTX *ctx, BIGNUM *p, BIGNUM *q, BIGNUM **g_ret, unsigned long *h_ret, BN_GENCB *cb); # endif # define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ EVP_PKEY_CTRL_DSA_PARAMGEN_BITS, nbits, NULL) # define EVP_PKEY_CTRL_DSA_PARAMGEN_BITS (EVP_PKEY_ALG_CTRL + 1) # define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS (EVP_PKEY_ALG_CTRL + 2) # define EVP_PKEY_CTRL_DSA_PARAMGEN_MD (EVP_PKEY_ALG_CTRL + 3) /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_DSA_strings(void); /* Error codes for the DSA functions. */ /* Function codes. */ # define DSA_F_D2I_DSA_SIG 110 # define DSA_F_DO_DSA_PRINT 104 # define DSA_F_DSAPARAMS_PRINT 100 # define DSA_F_DSAPARAMS_PRINT_FP 101 # define DSA_F_DSA_BUILTIN_KEYGEN 124 # define DSA_F_DSA_BUILTIN_PARAMGEN 123 # define DSA_F_DSA_BUILTIN_PARAMGEN2 226 # define DSA_F_DSA_DO_SIGN 112 # define DSA_F_DSA_DO_VERIFY 113 # define DSA_F_DSA_GENERATE_KEY 126 # define DSA_F_DSA_GENERATE_PARAMETERS_EX 127 # define DSA_F_DSA_GENERATE_PARAMETERS /* unused */ 125 # define DSA_F_DSA_NEW_METHOD 103 # define DSA_F_DSA_PARAM_DECODE 119 # define DSA_F_DSA_PRINT_FP 105 # define DSA_F_DSA_PRIV_DECODE 115 # define DSA_F_DSA_PRIV_ENCODE 116 # define DSA_F_DSA_PUB_DECODE 117 # define DSA_F_DSA_PUB_ENCODE 118 # define DSA_F_DSA_SIGN 106 # define DSA_F_DSA_SIGN_SETUP 107 # define DSA_F_DSA_SIG_NEW 109 # define DSA_F_DSA_SIG_PRINT 125 # define DSA_F_DSA_VERIFY 108 # define DSA_F_I2D_DSA_SIG 111 # define DSA_F_OLD_DSA_PRIV_DECODE 122 # define DSA_F_PKEY_DSA_CTRL 120 # define DSA_F_PKEY_DSA_KEYGEN 121 # define DSA_F_SIG_CB 114 /* Reason codes. */ # define DSA_R_BAD_Q_VALUE 102 # define DSA_R_BN_DECODE_ERROR 108 # define DSA_R_BN_ERROR 109 # define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100 # define DSA_R_DECODE_ERROR 104 # define DSA_R_INVALID_DIGEST_TYPE 106 # define DSA_R_INVALID_PARAMETERS 212 # define DSA_R_KEY_SIZE_INVALID 201 # define DSA_R_KEY_SIZE_TOO_SMALL 110 # define DSA_R_MISSING_PARAMETERS 101 # define DSA_R_MODULUS_TOO_LARGE 103 # define DSA_R_NEED_NEW_SETUP_VALUES 112 # define DSA_R_NON_FIPS_DSA_METHOD 111 # define DSA_R_NON_FIPS_METHOD 111 # define DSA_R_NO_PARAMETERS_SET 107 # define DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE /* unused */ 112 # define DSA_R_PARAMETER_ENCODING_ERROR 105 # define DSA_R_Q_NOT_PRIME 113 #ifdef __cplusplus } #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/ecdsa.h�������������������������������������������������������������������������������������0000644�����������������00000033326�14763166030�0007474 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/ecdsa/ecdsa.h */ /** * \file crypto/ecdsa/ecdsa.h Include file for the OpenSSL ECDSA functions * \author Written by Nils Larsch for the OpenSSL project */ /* ==================================================================== * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * licensing@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_ECDSA_H # define HEADER_ECDSA_H # include <openssl/opensslconf.h> # ifdef OPENSSL_NO_ECDSA # error ECDSA is disabled. # endif # include <openssl/ec.h> # include <openssl/ossl_typ.h> # ifndef OPENSSL_NO_DEPRECATED # include <openssl/bn.h> # endif #ifdef __cplusplus extern "C" { #endif typedef struct ECDSA_SIG_st { BIGNUM *r; BIGNUM *s; } ECDSA_SIG; /** Allocates and initialize a ECDSA_SIG structure * \return pointer to a ECDSA_SIG structure or NULL if an error occurred */ ECDSA_SIG *ECDSA_SIG_new(void); /** frees a ECDSA_SIG structure * \param sig pointer to the ECDSA_SIG structure */ void ECDSA_SIG_free(ECDSA_SIG *sig); /** DER encode content of ECDSA_SIG object (note: this function modifies *pp * (*pp += length of the DER encoded signature)). * \param sig pointer to the ECDSA_SIG object * \param pp pointer to a unsigned char pointer for the output or NULL * \return the length of the DER encoded ECDSA_SIG object or 0 */ int i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp); /** Decodes a DER encoded ECDSA signature (note: this function changes *pp * (*pp += len)). * \param sig pointer to ECDSA_SIG pointer (may be NULL) * \param pp memory buffer with the DER encoded signature * \param len length of the buffer * \return pointer to the decoded ECDSA_SIG structure (or NULL) */ ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long len); /** Computes the ECDSA signature of the given hash value using * the supplied private key and returns the created signature. * \param dgst pointer to the hash value * \param dgst_len length of the hash value * \param eckey EC_KEY object containing a private EC key * \return pointer to a ECDSA_SIG structure or NULL if an error occurred */ ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst, int dgst_len, EC_KEY *eckey); /** Computes ECDSA signature of a given hash value using the supplied * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). * \param dgst pointer to the hash value to sign * \param dgstlen length of the hash value * \param kinv BIGNUM with a pre-computed inverse k (optional) * \param rp BIGNUM with a pre-computed rp value (optioanl), * see ECDSA_sign_setup * \param eckey EC_KEY object containing a private EC key * \return pointer to a ECDSA_SIG structure or NULL if an error occurred */ ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen, const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey); /** Verifies that the supplied signature is a valid ECDSA * signature of the supplied hash value using the supplied public key. * \param dgst pointer to the hash value * \param dgst_len length of the hash value * \param sig ECDSA_SIG structure * \param eckey EC_KEY object containing a public EC key * \return 1 if the signature is valid, 0 if the signature is invalid * and -1 on error */ int ECDSA_do_verify(const unsigned char *dgst, int dgst_len, const ECDSA_SIG *sig, EC_KEY *eckey); const ECDSA_METHOD *ECDSA_OpenSSL(void); /** Sets the default ECDSA method * \param meth new default ECDSA_METHOD */ void ECDSA_set_default_method(const ECDSA_METHOD *meth); /** Returns the default ECDSA method * \return pointer to ECDSA_METHOD structure containing the default method */ const ECDSA_METHOD *ECDSA_get_default_method(void); /** Sets method to be used for the ECDSA operations * \param eckey EC_KEY object * \param meth new method * \return 1 on success and 0 otherwise */ int ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth); /** Returns the maximum length of the DER encoded signature * \param eckey EC_KEY object * \return numbers of bytes required for the DER encoded signature */ int ECDSA_size(const EC_KEY *eckey); /** Precompute parts of the signing operation * \param eckey EC_KEY object containing a private EC key * \param ctx BN_CTX object (optional) * \param kinv BIGNUM pointer for the inverse of k * \param rp BIGNUM pointer for x coordinate of k * generator * \return 1 on success and 0 otherwise */ int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, BIGNUM **rp); /** Computes ECDSA signature of a given hash value using the supplied * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). * \param type this parameter is ignored * \param dgst pointer to the hash value to sign * \param dgstlen length of the hash value * \param sig memory for the DER encoded created signature * \param siglen pointer to the length of the returned signature * \param eckey EC_KEY object containing a private EC key * \return 1 on success and 0 otherwise */ int ECDSA_sign(int type, const unsigned char *dgst, int dgstlen, unsigned char *sig, unsigned int *siglen, EC_KEY *eckey); /** Computes ECDSA signature of a given hash value using the supplied * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). * \param type this parameter is ignored * \param dgst pointer to the hash value to sign * \param dgstlen length of the hash value * \param sig buffer to hold the DER encoded signature * \param siglen pointer to the length of the returned signature * \param kinv BIGNUM with a pre-computed inverse k (optional) * \param rp BIGNUM with a pre-computed rp value (optioanl), * see ECDSA_sign_setup * \param eckey EC_KEY object containing a private EC key * \return 1 on success and 0 otherwise */ int ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen, unsigned char *sig, unsigned int *siglen, const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey); /** Verifies that the given signature is valid ECDSA signature * of the supplied hash value using the specified public key. * \param type this parameter is ignored * \param dgst pointer to the hash value * \param dgstlen length of the hash value * \param sig pointer to the DER encoded signature * \param siglen length of the DER encoded signature * \param eckey EC_KEY object containing a public EC key * \return 1 if the signature is valid, 0 if the signature is invalid * and -1 on error */ int ECDSA_verify(int type, const unsigned char *dgst, int dgstlen, const unsigned char *sig, int siglen, EC_KEY *eckey); /* the standard ex_data functions */ int ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int ECDSA_set_ex_data(EC_KEY *d, int idx, void *arg); void *ECDSA_get_ex_data(EC_KEY *d, int idx); /** Allocates and initialize a ECDSA_METHOD structure * \param ecdsa_method pointer to ECDSA_METHOD to copy. (May be NULL) * \return pointer to a ECDSA_METHOD structure or NULL if an error occurred */ ECDSA_METHOD *ECDSA_METHOD_new(const ECDSA_METHOD *ecdsa_method); /** frees a ECDSA_METHOD structure * \param ecdsa_method pointer to the ECDSA_METHOD structure */ void ECDSA_METHOD_free(ECDSA_METHOD *ecdsa_method); /** Sets application specific data in the ECDSA_METHOD * \param ecdsa_method pointer to existing ECDSA_METHOD * \param app application specific data to set */ void ECDSA_METHOD_set_app_data(ECDSA_METHOD *ecdsa_method, void *app); /** Returns application specific data from a ECDSA_METHOD structure * \param ecdsa_method pointer to ECDSA_METHOD structure * \return pointer to application specific data. */ void *ECDSA_METHOD_get_app_data(ECDSA_METHOD *ecdsa_method); /** Set the ECDSA_do_sign function in the ECDSA_METHOD * \param ecdsa_method pointer to existing ECDSA_METHOD * \param ecdsa_do_sign a funtion of type ECDSA_do_sign */ void ECDSA_METHOD_set_sign(ECDSA_METHOD *ecdsa_method, ECDSA_SIG *(*ecdsa_do_sign) (const unsigned char *dgst, int dgst_len, const BIGNUM *inv, const BIGNUM *rp, EC_KEY *eckey)); /** Set the ECDSA_sign_setup function in the ECDSA_METHOD * \param ecdsa_method pointer to existing ECDSA_METHOD * \param ecdsa_sign_setup a funtion of type ECDSA_sign_setup */ void ECDSA_METHOD_set_sign_setup(ECDSA_METHOD *ecdsa_method, int (*ecdsa_sign_setup) (EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, BIGNUM **r)); /** Set the ECDSA_do_verify function in the ECDSA_METHOD * \param ecdsa_method pointer to existing ECDSA_METHOD * \param ecdsa_do_verify a funtion of type ECDSA_do_verify */ void ECDSA_METHOD_set_verify(ECDSA_METHOD *ecdsa_method, int (*ecdsa_do_verify) (const unsigned char *dgst, int dgst_len, const ECDSA_SIG *sig, EC_KEY *eckey)); void ECDSA_METHOD_set_flags(ECDSA_METHOD *ecdsa_method, int flags); /** Set the flags field in the ECDSA_METHOD * \param ecdsa_method pointer to existing ECDSA_METHOD * \param flags flags value to set */ void ECDSA_METHOD_set_name(ECDSA_METHOD *ecdsa_method, char *name); /** Set the name field in the ECDSA_METHOD * \param ecdsa_method pointer to existing ECDSA_METHOD * \param name name to set */ /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_ECDSA_strings(void); /* Error codes for the ECDSA functions. */ /* Function codes. */ # define ECDSA_F_ECDSA_CHECK 104 # define ECDSA_F_ECDSA_DATA_NEW_METHOD 100 # define ECDSA_F_ECDSA_DO_SIGN 101 # define ECDSA_F_ECDSA_DO_VERIFY 102 # define ECDSA_F_ECDSA_METHOD_NEW 105 # define ECDSA_F_ECDSA_SIGN_SETUP 103 /* Reason codes. */ # define ECDSA_R_BAD_SIGNATURE 100 # define ECDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 101 # define ECDSA_R_ERR_EC_LIB 102 # define ECDSA_R_MISSING_PARAMETERS 103 # define ECDSA_R_NEED_NEW_SETUP_VALUES 106 # define ECDSA_R_NON_FIPS_METHOD 107 # define ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED 104 # define ECDSA_R_SIGNATURE_MALLOC_FAILED 105 #ifdef __cplusplus } #endif #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/opensslconf-x86_64.h������������������������������������������������������������������������0000644�����������������00000017144�14763166030�0011702 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Prepended at openssl package build-time. Don't include this file directly, * use <openssl/opensslconf.h> instead. */ #ifndef openssl_opensslconf_multilib_redirection_h #error "Don't include this file directly, use <openssl/opensslconf.h> instead!" #endif /* opensslconf.h */ /* WARNING: Generated automatically from opensslconf.h.in by Configure. */ #ifdef __cplusplus extern "C" { #endif /* OpenSSL was configured with the following options: */ #ifndef OPENSSL_DOING_MAKEDEPEND #ifndef OPENSSL_NO_EC2M # define OPENSSL_NO_EC2M #endif #ifndef OPENSSL_NO_GMP # define OPENSSL_NO_GMP #endif #ifndef OPENSSL_NO_GOST # define OPENSSL_NO_GOST #endif #ifndef OPENSSL_NO_JPAKE # define OPENSSL_NO_JPAKE #endif #ifndef OPENSSL_NO_LIBUNBOUND # define OPENSSL_NO_LIBUNBOUND #endif #ifndef OPENSSL_NO_MDC2 # define OPENSSL_NO_MDC2 #endif #ifndef OPENSSL_NO_RSAX # define OPENSSL_NO_RSAX #endif #ifndef OPENSSL_NO_SRP # define OPENSSL_NO_SRP #endif #ifndef OPENSSL_NO_SSL_TRACE # define OPENSSL_NO_SSL_TRACE #endif #ifndef OPENSSL_NO_SSL2 # define OPENSSL_NO_SSL2 #endif #ifndef OPENSSL_NO_STORE # define OPENSSL_NO_STORE #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif #ifndef OPENSSL_NO_WEAK_SSL_CIPHERS # define OPENSSL_NO_WEAK_SSL_CIPHERS #endif #endif /* OPENSSL_DOING_MAKEDEPEND */ #ifndef OPENSSL_THREADS # define OPENSSL_THREADS #endif #ifndef OPENSSL_NO_STATIC_ENGINE # define OPENSSL_NO_STATIC_ENGINE #endif #ifndef OPENSSL_FIPS # define OPENSSL_FIPS #endif /* The OPENSSL_NO_* macros are also defined as NO_* if the application asks for it. This is a transient feature that is provided for those who haven't had the time to do the appropriate changes in their applications. */ #ifdef OPENSSL_ALGORITHM_DEFINES # if defined(OPENSSL_NO_EC2M) && !defined(NO_EC2M) # define NO_EC2M # endif # if defined(OPENSSL_NO_GMP) && !defined(NO_GMP) # define NO_GMP # endif # if defined(OPENSSL_NO_GOST) && !defined(NO_GOST) # define NO_GOST # endif # if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE) # define NO_JPAKE # endif # if defined(OPENSSL_NO_LIBUNBOUND) && !defined(NO_LIBUNBOUND) # define NO_LIBUNBOUND # endif # if defined(OPENSSL_NO_MDC2) && !defined(NO_MDC2) # define NO_MDC2 # endif # if defined(OPENSSL_NO_RSAX) && !defined(NO_RSAX) # define NO_RSAX # endif # if defined(OPENSSL_NO_SRP) && !defined(NO_SRP) # define NO_SRP # endif # if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE) # define NO_SSL_TRACE # endif # if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2) # define NO_SSL2 # endif # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) # define NO_STORE # endif # if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST) # define NO_UNIT_TEST # endif # if defined(OPENSSL_NO_WEAK_SSL_CIPHERS) && !defined(NO_WEAK_SSL_CIPHERS) # define NO_WEAK_SSL_CIPHERS # endif #endif #define OPENSSL_CPUID_OBJ /* crypto/opensslconf.h.in */ #ifdef OPENSSL_DOING_MAKEDEPEND /* Include any symbols here that have to be explicitly set to enable a feature * that should be visible to makedepend. * * [Our "make depend" doesn't actually look at this, we use actual build settings * instead; we want to make it easy to remove subdirectories with disabled algorithms.] */ #ifndef OPENSSL_FIPS #define OPENSSL_FIPS #endif #endif /* Generate 80386 code? */ #undef I386_ONLY #if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) #define ENGINESDIR "/usr/lib64/openssl/engines" #define OPENSSLDIR "/etc/pki/tls" #endif #endif #undef OPENSSL_UNISTD #define OPENSSL_UNISTD <unistd.h> #undef OPENSSL_EXPORT_VAR_AS_FUNCTION #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) #define IDEA_INT unsigned int #endif #if defined(HEADER_MD2_H) && !defined(MD2_INT) #define MD2_INT unsigned int #endif #if defined(HEADER_RC2_H) && !defined(RC2_INT) /* I need to put in a mod for the alpha - eay */ #define RC2_INT unsigned int #endif #if defined(HEADER_RC4_H) #if !defined(RC4_INT) /* using int types make the structure larger but make the code faster * on most boxes I have tested - up to %20 faster. */ /* * I don't know what does "most" mean, but declaring "int" is a must on: * - Intel P6 because partial register stalls are very expensive; * - elder Alpha because it lacks byte load/store instructions; */ #define RC4_INT unsigned int #endif #if !defined(RC4_CHUNK) /* * This enables code handling data aligned at natural CPU word * boundary. See crypto/rc4/rc4_enc.c for further details. */ #define RC4_CHUNK unsigned long #endif #endif #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a * %20 speed up (longs are 8 bytes, int's are 4). */ #ifndef DES_LONG #define DES_LONG unsigned int #endif #endif #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) #define CONFIG_HEADER_BN_H #undef BN_LLONG /* Should we define BN_DIV2W here? */ /* Only one for the following should be defined */ #define SIXTY_FOUR_BIT_LONG #undef SIXTY_FOUR_BIT #undef THIRTY_TWO_BIT #endif #if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) #define CONFIG_HEADER_RC4_LOCL_H /* if this is defined data[i] is used instead of *data, this is a %20 * speedup on x86 */ #undef RC4_INDEX #endif #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) #define CONFIG_HEADER_BF_LOCL_H #undef BF_PTR #endif /* HEADER_BF_LOCL_H */ #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) #define CONFIG_HEADER_DES_LOCL_H #ifndef DES_DEFAULT_OPTIONS /* the following is tweaked from a config script, that is why it is a * protected undef/define */ #ifndef DES_PTR #undef DES_PTR #endif /* This helps C compiler generate the correct code for multiple functional * units. It reduces register dependancies at the expense of 2 more * registers */ #ifndef DES_RISC1 #undef DES_RISC1 #endif #ifndef DES_RISC2 #undef DES_RISC2 #endif #if defined(DES_RISC1) && defined(DES_RISC2) #error YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! #endif /* Unroll the inner loop, this sometimes helps, sometimes hinders. * Very mucy CPU dependant */ #ifndef DES_UNROLL #define DES_UNROLL #endif /* These default values were supplied by * Peter Gutman <pgut001@cs.auckland.ac.nz> * They are only used if nothing else has been defined */ #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) /* Special defines which change the way the code is built depending on the CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find even newer MIPS CPU's, but at the moment one size fits all for optimization options. Older Sparc's work better with only UNROLL, but there's no way to tell at compile time what it is you're running on */ #if defined( __sun ) || defined ( sun ) /* Newer Sparc's */ # define DES_PTR # define DES_RISC1 # define DES_UNROLL #elif defined( __ultrix ) /* Older MIPS */ # define DES_PTR # define DES_RISC2 # define DES_UNROLL #elif defined( __osf1__ ) /* Alpha */ # define DES_PTR # define DES_RISC2 #elif defined ( _AIX ) /* RS6000 */ /* Unknown */ #elif defined( __hpux ) /* HP-PA */ /* Unknown */ #elif defined( __aux ) /* 68K */ /* Unknown */ #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ # define DES_UNROLL #elif defined( __sgi ) /* Newer MIPS */ # define DES_PTR # define DES_RISC2 # define DES_UNROLL #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ # define DES_PTR # define DES_RISC1 # define DES_UNROLL #endif /* Systems-specific speed defines */ #endif #endif /* DES_DEFAULT_OPTIONS */ #endif /* HEADER_DES_LOCL_H */ #ifdef __cplusplus } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/ssl.h���������������������������������������������������������������������������������������0000644�����������������00000436526�14763166030�0007227 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ssl/ssl.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * ECC cipher suite support in OpenSSL originally developed by * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. */ /* ==================================================================== * Copyright 2005 Nokia. All rights reserved. * * The portions of the attached software ("Contribution") is developed by * Nokia Corporation and is licensed pursuant to the OpenSSL open source * license. * * The Contribution, originally written by Mika Kousa and Pasi Eronen of * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites * support (see RFC 4279) to OpenSSL. * * No patent licenses or other rights except those expressly stated in * the OpenSSL open source license shall be deemed granted or received * expressly, by implication, estoppel, or otherwise. * * No assurances are provided by Nokia that the Contribution does not * infringe the patent or other intellectual property rights of any third * party or that the license provides you with all the necessary rights * to make use of the Contribution. * * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR * OTHERWISE. */ #ifndef HEADER_SSL_H # define HEADER_SSL_H # include <openssl/e_os2.h> # ifndef OPENSSL_NO_COMP # include <openssl/comp.h> # endif # ifndef OPENSSL_NO_BIO # include <openssl/bio.h> # endif # ifndef OPENSSL_NO_DEPRECATED # ifndef OPENSSL_NO_X509 # include <openssl/x509.h> # endif # include <openssl/crypto.h> # include <openssl/lhash.h> # include <openssl/buffer.h> # endif # include <openssl/pem.h> # include <openssl/hmac.h> # include <openssl/kssl.h> # include <openssl/safestack.h> # include <openssl/symhacks.h> #ifdef __cplusplus extern "C" { #endif /* SSLeay version number for ASN.1 encoding of the session information */ /*- * Version 0 - initial version * Version 1 - added the optional peer certificate */ # define SSL_SESSION_ASN1_VERSION 0x0001 /* text strings for the ciphers */ # define SSL_TXT_NULL_WITH_MD5 SSL2_TXT_NULL_WITH_MD5 # define SSL_TXT_RC4_128_WITH_MD5 SSL2_TXT_RC4_128_WITH_MD5 # define SSL_TXT_RC4_128_EXPORT40_WITH_MD5 SSL2_TXT_RC4_128_EXPORT40_WITH_MD5 # define SSL_TXT_RC2_128_CBC_WITH_MD5 SSL2_TXT_RC2_128_CBC_WITH_MD5 # define SSL_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 # define SSL_TXT_IDEA_128_CBC_WITH_MD5 SSL2_TXT_IDEA_128_CBC_WITH_MD5 # define SSL_TXT_DES_64_CBC_WITH_MD5 SSL2_TXT_DES_64_CBC_WITH_MD5 # define SSL_TXT_DES_64_CBC_WITH_SHA SSL2_TXT_DES_64_CBC_WITH_SHA # define SSL_TXT_DES_192_EDE3_CBC_WITH_MD5 SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5 # define SSL_TXT_DES_192_EDE3_CBC_WITH_SHA SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA /* * VRS Additional Kerberos5 entries */ # define SSL_TXT_KRB5_DES_64_CBC_SHA SSL3_TXT_KRB5_DES_64_CBC_SHA # define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA # define SSL_TXT_KRB5_RC4_128_SHA SSL3_TXT_KRB5_RC4_128_SHA # define SSL_TXT_KRB5_IDEA_128_CBC_SHA SSL3_TXT_KRB5_IDEA_128_CBC_SHA # define SSL_TXT_KRB5_DES_64_CBC_MD5 SSL3_TXT_KRB5_DES_64_CBC_MD5 # define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5 # define SSL_TXT_KRB5_RC4_128_MD5 SSL3_TXT_KRB5_RC4_128_MD5 # define SSL_TXT_KRB5_IDEA_128_CBC_MD5 SSL3_TXT_KRB5_IDEA_128_CBC_MD5 # define SSL_TXT_KRB5_DES_40_CBC_SHA SSL3_TXT_KRB5_DES_40_CBC_SHA # define SSL_TXT_KRB5_RC2_40_CBC_SHA SSL3_TXT_KRB5_RC2_40_CBC_SHA # define SSL_TXT_KRB5_RC4_40_SHA SSL3_TXT_KRB5_RC4_40_SHA # define SSL_TXT_KRB5_DES_40_CBC_MD5 SSL3_TXT_KRB5_DES_40_CBC_MD5 # define SSL_TXT_KRB5_RC2_40_CBC_MD5 SSL3_TXT_KRB5_RC2_40_CBC_MD5 # define SSL_TXT_KRB5_RC4_40_MD5 SSL3_TXT_KRB5_RC4_40_MD5 # define SSL_TXT_KRB5_DES_40_CBC_SHA SSL3_TXT_KRB5_DES_40_CBC_SHA # define SSL_TXT_KRB5_DES_40_CBC_MD5 SSL3_TXT_KRB5_DES_40_CBC_MD5 # define SSL_TXT_KRB5_DES_64_CBC_SHA SSL3_TXT_KRB5_DES_64_CBC_SHA # define SSL_TXT_KRB5_DES_64_CBC_MD5 SSL3_TXT_KRB5_DES_64_CBC_MD5 # define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA # define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5 # define SSL_MAX_KRB5_PRINCIPAL_LENGTH 256 # define SSL_MAX_SSL_SESSION_ID_LENGTH 32 # define SSL_MAX_SID_CTX_LENGTH 32 # define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES (512/8) # define SSL_MAX_KEY_ARG_LENGTH 8 # define SSL_MAX_MASTER_KEY_LENGTH 48 /* These are used to specify which ciphers to use and not to use */ # define SSL_TXT_EXP40 "EXPORT40" # define SSL_TXT_EXP56 "EXPORT56" # define SSL_TXT_LOW "LOW" # define SSL_TXT_MEDIUM "MEDIUM" # define SSL_TXT_HIGH "HIGH" # define SSL_TXT_FIPS "FIPS" # define SSL_TXT_kFZA "kFZA"/* unused! */ # define SSL_TXT_aFZA "aFZA"/* unused! */ # define SSL_TXT_eFZA "eFZA"/* unused! */ # define SSL_TXT_FZA "FZA"/* unused! */ # define SSL_TXT_aNULL "aNULL" # define SSL_TXT_eNULL "eNULL" # define SSL_TXT_NULL "NULL" # define SSL_TXT_kRSA "kRSA" # define SSL_TXT_kDHr "kDHr" # define SSL_TXT_kDHd "kDHd" # define SSL_TXT_kDH "kDH" # define SSL_TXT_kEDH "kEDH" # define SSL_TXT_kDHE "kDHE"/* alias for kEDH */ # define SSL_TXT_kKRB5 "kKRB5" # define SSL_TXT_kECDHr "kECDHr" # define SSL_TXT_kECDHe "kECDHe" # define SSL_TXT_kECDH "kECDH" # define SSL_TXT_kEECDH "kEECDH" # define SSL_TXT_kECDHE "kECDHE"/* alias for kEECDH */ # define SSL_TXT_kPSK "kPSK" # define SSL_TXT_kGOST "kGOST" # define SSL_TXT_kSRP "kSRP" # define SSL_TXT_aRSA "aRSA" # define SSL_TXT_aDSS "aDSS" # define SSL_TXT_aDH "aDH" # define SSL_TXT_aECDH "aECDH" # define SSL_TXT_aKRB5 "aKRB5" # define SSL_TXT_aECDSA "aECDSA" # define SSL_TXT_aPSK "aPSK" # define SSL_TXT_aGOST94 "aGOST94" # define SSL_TXT_aGOST01 "aGOST01" # define SSL_TXT_aGOST "aGOST" # define SSL_TXT_aSRP "aSRP" # define SSL_TXT_DSS "DSS" # define SSL_TXT_DH "DH" # define SSL_TXT_EDH "EDH"/* same as "kEDH:-ADH" */ # define SSL_TXT_DHE "DHE"/* alias for EDH */ # define SSL_TXT_ADH "ADH" # define SSL_TXT_RSA "RSA" # define SSL_TXT_ECDH "ECDH" # define SSL_TXT_EECDH "EECDH"/* same as "kEECDH:-AECDH" */ # define SSL_TXT_ECDHE "ECDHE"/* alias for ECDHE" */ # define SSL_TXT_AECDH "AECDH" # define SSL_TXT_ECDSA "ECDSA" # define SSL_TXT_KRB5 "KRB5" # define SSL_TXT_PSK "PSK" # define SSL_TXT_SRP "SRP" # define SSL_TXT_DES "DES" # define SSL_TXT_3DES "3DES" # define SSL_TXT_RC4 "RC4" # define SSL_TXT_RC2 "RC2" # define SSL_TXT_IDEA "IDEA" # define SSL_TXT_SEED "SEED" # define SSL_TXT_AES128 "AES128" # define SSL_TXT_AES256 "AES256" # define SSL_TXT_AES "AES" # define SSL_TXT_AES_GCM "AESGCM" # define SSL_TXT_CAMELLIA128 "CAMELLIA128" # define SSL_TXT_CAMELLIA256 "CAMELLIA256" # define SSL_TXT_CAMELLIA "CAMELLIA" # define SSL_TXT_MD5 "MD5" # define SSL_TXT_SHA1 "SHA1" # define SSL_TXT_SHA "SHA"/* same as "SHA1" */ # define SSL_TXT_GOST94 "GOST94" # define SSL_TXT_GOST89MAC "GOST89MAC" # define SSL_TXT_SHA256 "SHA256" # define SSL_TXT_SHA384 "SHA384" # define SSL_TXT_SSLV2 "SSLv2" # define SSL_TXT_SSLV3 "SSLv3" # define SSL_TXT_TLSV1 "TLSv1" # define SSL_TXT_TLSV1_1 "TLSv1.1" # define SSL_TXT_TLSV1_2 "TLSv1.2" # define SSL_TXT_EXP "EXP" # define SSL_TXT_EXPORT "EXPORT" # define SSL_TXT_ALL "ALL" /*- * COMPLEMENTOF* definitions. These identifiers are used to (de-select) * ciphers normally not being used. * Example: "RC4" will activate all ciphers using RC4 including ciphers * without authentication, which would normally disabled by DEFAULT (due * the "!ADH" being part of default). Therefore "RC4:!COMPLEMENTOFDEFAULT" * will make sure that it is also disabled in the specific selection. * COMPLEMENTOF* identifiers are portable between version, as adjustments * to the default cipher setup will also be included here. * * COMPLEMENTOFDEFAULT does not experience the same special treatment that * DEFAULT gets, as only selection is being done and no sorting as needed * for DEFAULT. */ # define SSL_TXT_CMPALL "COMPLEMENTOFALL" # define SSL_TXT_CMPDEF "COMPLEMENTOFDEFAULT" /* * The following cipher list is used by default. It also is substituted when * an application-defined cipher list string starts with 'DEFAULT'. */ # define SSL_DEFAULT_CIPHER_LIST "ALL:!EXPORT:!LOW:!aNULL:!eNULL:!SSLv2" /* * As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always * starts with a reasonable order, and all we have to do for DEFAULT is * throwing out anonymous and unencrypted ciphersuites! (The latter are not * actually enabled by ALL, but "ALL:RSA" would enable some of them.) */ /* Used in SSL_set_shutdown()/SSL_get_shutdown(); */ # define SSL_SENT_SHUTDOWN 1 # define SSL_RECEIVED_SHUTDOWN 2 #ifdef __cplusplus } #endif #ifdef __cplusplus extern "C" { #endif # if (defined(OPENSSL_NO_RSA) || defined(OPENSSL_NO_MD5)) && !defined(OPENSSL_NO_SSL2) # define OPENSSL_NO_SSL2 # endif # define SSL_FILETYPE_ASN1 X509_FILETYPE_ASN1 # define SSL_FILETYPE_PEM X509_FILETYPE_PEM /* * This is needed to stop compilers complaining about the 'struct ssl_st *' * function parameters used to prototype callbacks in SSL_CTX. */ typedef struct ssl_st *ssl_crock_st; typedef struct tls_session_ticket_ext_st TLS_SESSION_TICKET_EXT; typedef struct ssl_method_st SSL_METHOD; typedef struct ssl_cipher_st SSL_CIPHER; typedef struct ssl_session_st SSL_SESSION; typedef struct tls_sigalgs_st TLS_SIGALGS; typedef struct ssl_conf_ctx_st SSL_CONF_CTX; DECLARE_STACK_OF(SSL_CIPHER) /* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/ typedef struct srtp_protection_profile_st { const char *name; unsigned long id; } SRTP_PROTECTION_PROFILE; DECLARE_STACK_OF(SRTP_PROTECTION_PROFILE) typedef int (*tls_session_ticket_ext_cb_fn) (SSL *s, const unsigned char *data, int len, void *arg); typedef int (*tls_session_secret_cb_fn) (SSL *s, void *secret, int *secret_len, STACK_OF(SSL_CIPHER) *peer_ciphers, SSL_CIPHER **cipher, void *arg); # ifndef OPENSSL_NO_TLSEXT /* Typedefs for handling custom extensions */ typedef int (*custom_ext_add_cb) (SSL *s, unsigned int ext_type, const unsigned char **out, size_t *outlen, int *al, void *add_arg); typedef void (*custom_ext_free_cb) (SSL *s, unsigned int ext_type, const unsigned char *out, void *add_arg); typedef int (*custom_ext_parse_cb) (SSL *s, unsigned int ext_type, const unsigned char *in, size_t inlen, int *al, void *parse_arg); # endif # ifndef OPENSSL_NO_SSL_INTERN /* used to hold info on the particular ciphers used */ struct ssl_cipher_st { int valid; const char *name; /* text name */ unsigned long id; /* id, 4 bytes, first is version */ /* * changed in 0.9.9: these four used to be portions of a single value * 'algorithms' */ unsigned long algorithm_mkey; /* key exchange algorithm */ unsigned long algorithm_auth; /* server authentication */ unsigned long algorithm_enc; /* symmetric encryption */ unsigned long algorithm_mac; /* symmetric authentication */ unsigned long algorithm_ssl; /* (major) protocol version */ unsigned long algo_strength; /* strength and export flags */ unsigned long algorithm2; /* Extra flags */ int strength_bits; /* Number of bits really used */ int alg_bits; /* Number of bits for algorithm */ }; /* Used to hold functions for SSLv2 or SSLv3/TLSv1 functions */ struct ssl_method_st { int version; int (*ssl_new) (SSL *s); void (*ssl_clear) (SSL *s); void (*ssl_free) (SSL *s); int (*ssl_accept) (SSL *s); int (*ssl_connect) (SSL *s); int (*ssl_read) (SSL *s, void *buf, int len); int (*ssl_peek) (SSL *s, void *buf, int len); int (*ssl_write) (SSL *s, const void *buf, int len); int (*ssl_shutdown) (SSL *s); int (*ssl_renegotiate) (SSL *s); int (*ssl_renegotiate_check) (SSL *s); long (*ssl_get_message) (SSL *s, int st1, int stn, int mt, long max, int *ok); int (*ssl_read_bytes) (SSL *s, int type, unsigned char *buf, int len, int peek); int (*ssl_write_bytes) (SSL *s, int type, const void *buf_, int len); int (*ssl_dispatch_alert) (SSL *s); long (*ssl_ctrl) (SSL *s, int cmd, long larg, void *parg); long (*ssl_ctx_ctrl) (SSL_CTX *ctx, int cmd, long larg, void *parg); const SSL_CIPHER *(*get_cipher_by_char) (const unsigned char *ptr); int (*put_cipher_by_char) (const SSL_CIPHER *cipher, unsigned char *ptr); int (*ssl_pending) (const SSL *s); int (*num_ciphers) (void); const SSL_CIPHER *(*get_cipher) (unsigned ncipher); const struct ssl_method_st *(*get_ssl_method) (int version); long (*get_timeout) (void); struct ssl3_enc_method *ssl3_enc; /* Extra SSLv3/TLS stuff */ int (*ssl_version) (void); long (*ssl_callback_ctrl) (SSL *s, int cb_id, void (*fp) (void)); long (*ssl_ctx_callback_ctrl) (SSL_CTX *s, int cb_id, void (*fp) (void)); }; /*- * Lets make this into an ASN.1 type structure as follows * SSL_SESSION_ID ::= SEQUENCE { * version INTEGER, -- structure version number * SSLversion INTEGER, -- SSL version number * Cipher OCTET STRING, -- the 3 byte cipher ID * Session_ID OCTET STRING, -- the Session ID * Master_key OCTET STRING, -- the master key * KRB5_principal OCTET STRING -- optional Kerberos principal * Key_Arg [ 0 ] IMPLICIT OCTET STRING, -- the optional Key argument * Time [ 1 ] EXPLICIT INTEGER, -- optional Start Time * Timeout [ 2 ] EXPLICIT INTEGER, -- optional Timeout ins seconds * Peer [ 3 ] EXPLICIT X509, -- optional Peer Certificate * Session_ID_context [ 4 ] EXPLICIT OCTET STRING, -- the Session ID context * Verify_result [ 5 ] EXPLICIT INTEGER, -- X509_V_... code for `Peer' * HostName [ 6 ] EXPLICIT OCTET STRING, -- optional HostName from servername TLS extension * PSK_identity_hint [ 7 ] EXPLICIT OCTET STRING, -- optional PSK identity hint * PSK_identity [ 8 ] EXPLICIT OCTET STRING, -- optional PSK identity * Ticket_lifetime_hint [9] EXPLICIT INTEGER, -- server's lifetime hint for session ticket * Ticket [10] EXPLICIT OCTET STRING, -- session ticket (clients only) * Compression_meth [11] EXPLICIT OCTET STRING, -- optional compression method * SRP_username [ 12 ] EXPLICIT OCTET STRING -- optional SRP username * } * Look in ssl/ssl_asn1.c for more details * I'm using EXPLICIT tags so I can read the damn things using asn1parse :-). */ struct ssl_session_st { int ssl_version; /* what ssl version session info is being * kept in here? */ /* only really used in SSLv2 */ unsigned int key_arg_length; unsigned char key_arg[SSL_MAX_KEY_ARG_LENGTH]; int master_key_length; unsigned char master_key[SSL_MAX_MASTER_KEY_LENGTH]; /* session_id - valid? */ unsigned int session_id_length; unsigned char session_id[SSL_MAX_SSL_SESSION_ID_LENGTH]; /* * this is used to determine whether the session is being reused in the * appropriate context. It is up to the application to set this, via * SSL_new */ unsigned int sid_ctx_length; unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH]; # ifndef OPENSSL_NO_KRB5 unsigned int krb5_client_princ_len; unsigned char krb5_client_princ[SSL_MAX_KRB5_PRINCIPAL_LENGTH]; # endif /* OPENSSL_NO_KRB5 */ # ifndef OPENSSL_NO_PSK char *psk_identity_hint; char *psk_identity; # endif /* * Used to indicate that session resumption is not allowed. Applications * can also set this bit for a new session via not_resumable_session_cb * to disable session caching and tickets. */ int not_resumable; /* The cert is the certificate used to establish this connection */ struct sess_cert_st /* SESS_CERT */ *sess_cert; /* * This is the cert for the other end. On clients, it will be the same as * sess_cert->peer_key->x509 (the latter is not enough as sess_cert is * not retained in the external representation of sessions, see * ssl_asn1.c). */ X509 *peer; /* * when app_verify_callback accepts a session where the peer's * certificate is not ok, we must remember the error for session reuse: */ long verify_result; /* only for servers */ int references; long timeout; long time; unsigned int compress_meth; /* Need to lookup the method */ const SSL_CIPHER *cipher; unsigned long cipher_id; /* when ASN.1 loaded, this needs to be used * to load the 'cipher' structure */ STACK_OF(SSL_CIPHER) *ciphers; /* shared ciphers? */ CRYPTO_EX_DATA ex_data; /* application specific data */ /* * These are used to make removal of session-ids more efficient and to * implement a maximum cache size. */ struct ssl_session_st *prev, *next; # ifndef OPENSSL_NO_TLSEXT char *tlsext_hostname; # ifndef OPENSSL_NO_EC size_t tlsext_ecpointformatlist_length; unsigned char *tlsext_ecpointformatlist; /* peer's list */ size_t tlsext_ellipticcurvelist_length; unsigned char *tlsext_ellipticcurvelist; /* peer's list */ # endif /* OPENSSL_NO_EC */ /* RFC4507 info */ unsigned char *tlsext_tick; /* Session ticket */ size_t tlsext_ticklen; /* Session ticket length */ long tlsext_tick_lifetime_hint; /* Session lifetime hint in seconds */ # endif }; # endif # define SSL_OP_MICROSOFT_SESS_ID_BUG 0x00000001L # define SSL_OP_NETSCAPE_CHALLENGE_BUG 0x00000002L /* Allow initial connection to servers that don't support RI */ # define SSL_OP_LEGACY_SERVER_CONNECT 0x00000004L # define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x00000008L # define SSL_OP_TLSEXT_PADDING 0x00000010L # define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x00000020L # define SSL_OP_SAFARI_ECDHE_ECDSA_BUG 0x00000040L # define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x00000080L # define SSL_OP_TLS_D5_BUG 0x00000100L # define SSL_OP_TLS_BLOCK_PADDING_BUG 0x00000200L /* Hasn't done anything since OpenSSL 0.9.7h, retained for compatibility */ # define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x0 /* Refers to ancient SSLREF and SSLv2, retained for compatibility */ # define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x0 /* * Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added in * OpenSSL 0.9.6d. Usually (depending on the application protocol) the * workaround is not needed. Unfortunately some broken SSL/TLS * implementations cannot handle it at all, which is why we include it in * SSL_OP_ALL. */ /* added in 0.9.6e */ # define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS 0x00000800L /* * SSL_OP_ALL: various bug workarounds that should be rather harmless. This * used to be 0x000FFFFFL before 0.9.7. */ # define SSL_OP_ALL 0x80000BFFL /* DTLS options */ # define SSL_OP_NO_QUERY_MTU 0x00001000L /* Turn on Cookie Exchange (on relevant for servers) */ # define SSL_OP_COOKIE_EXCHANGE 0x00002000L /* Don't use RFC4507 ticket extension */ # define SSL_OP_NO_TICKET 0x00004000L /* Use Cisco's "speshul" version of DTLS_BAD_VER (as client) */ # define SSL_OP_CISCO_ANYCONNECT 0x00008000L /* As server, disallow session resumption on renegotiation */ # define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0x00010000L /* Don't use compression even if supported */ # define SSL_OP_NO_COMPRESSION 0x00020000L /* Permit unsafe legacy renegotiation */ # define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x00040000L /* If set, always create a new key when using tmp_ecdh parameters */ # define SSL_OP_SINGLE_ECDH_USE 0x00080000L /* Does nothing: retained for compatibility */ # define SSL_OP_SINGLE_DH_USE 0x00100000L /* Does nothing: retained for compatibiity */ # define SSL_OP_EPHEMERAL_RSA 0x0 /* * Set on servers to choose the cipher according to the server's preferences */ # define SSL_OP_CIPHER_SERVER_PREFERENCE 0x00400000L /* * If set, a server will allow a client to issue a SSLv3.0 version number as * latest version supported in the premaster secret, even when TLSv1.0 * (version 3.1) was announced in the client hello. Normally this is * forbidden to prevent version rollback attacks. */ # define SSL_OP_TLS_ROLLBACK_BUG 0x00800000L # define SSL_OP_NO_SSLv2 0x01000000L # define SSL_OP_NO_SSLv3 0x02000000L # define SSL_OP_NO_TLSv1 0x04000000L # define SSL_OP_NO_TLSv1_2 0x08000000L # define SSL_OP_NO_TLSv1_1 0x10000000L # define SSL_OP_NO_DTLSv1 0x04000000L # define SSL_OP_NO_DTLSv1_2 0x08000000L # define SSL_OP_NO_SSL_MASK (SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|\ SSL_OP_NO_TLSv1|SSL_OP_NO_TLSv1_1|SSL_OP_NO_TLSv1_2) /* * These next two were never actually used for anything since SSLeay zap so * we have some more flags. */ /* * The next flag deliberately changes the ciphertest, this is a check for the * PKCS#1 attack */ # define SSL_OP_PKCS1_CHECK_1 0x0 # define SSL_OP_PKCS1_CHECK_2 0x0 # define SSL_OP_NETSCAPE_CA_DN_BUG 0x20000000L # define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x40000000L /* * Make server add server-hello extension from early version of cryptopro * draft, when GOST ciphersuite is negotiated. Required for interoperability * with CryptoPro CSP 3.x */ # define SSL_OP_CRYPTOPRO_TLSEXT_BUG 0x80000000L /* * Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success * when just a single record has been written): */ # define SSL_MODE_ENABLE_PARTIAL_WRITE 0x00000001L /* * Make it possible to retry SSL_write() with changed buffer location (buffer * contents must stay the same!); this is not the default to avoid the * misconception that non-blocking SSL_write() behaves like non-blocking * write(): */ # define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002L /* * Never bother the application with retries if the transport is blocking: */ # define SSL_MODE_AUTO_RETRY 0x00000004L /* Don't attempt to automatically build certificate chain */ # define SSL_MODE_NO_AUTO_CHAIN 0x00000008L /* * Save RAM by releasing read and write buffers when they're empty. (SSL3 and * TLS only.) "Released" buffers are put onto a free-list in the context or * just freed (depending on the context's setting for freelist_max_len). */ # define SSL_MODE_RELEASE_BUFFERS 0x00000010L /* * Send the current time in the Random fields of the ClientHello and * ServerHello records for compatibility with hypothetical implementations * that require it. */ # define SSL_MODE_SEND_CLIENTHELLO_TIME 0x00000020L # define SSL_MODE_SEND_SERVERHELLO_TIME 0x00000040L /* * Send TLS_FALLBACK_SCSV in the ClientHello. To be set only by applications * that reconnect with a downgraded protocol version; see * draft-ietf-tls-downgrade-scsv-00 for details. DO NOT ENABLE THIS if your * application attempts a normal handshake. Only use this in explicit * fallback retries, following the guidance in * draft-ietf-tls-downgrade-scsv-00. */ # define SSL_MODE_SEND_FALLBACK_SCSV 0x00000080L /* Cert related flags */ /* * Many implementations ignore some aspects of the TLS standards such as * enforcing certifcate chain algorithms. When this is set we enforce them. */ # define SSL_CERT_FLAG_TLS_STRICT 0x00000001L /* Suite B modes, takes same values as certificate verify flags */ # define SSL_CERT_FLAG_SUITEB_128_LOS_ONLY 0x10000 /* Suite B 192 bit only mode */ # define SSL_CERT_FLAG_SUITEB_192_LOS 0x20000 /* Suite B 128 bit mode allowing 192 bit algorithms */ # define SSL_CERT_FLAG_SUITEB_128_LOS 0x30000 /* Perform all sorts of protocol violations for testing purposes */ # define SSL_CERT_FLAG_BROKEN_PROTOCOL 0x10000000 /* Flags for building certificate chains */ /* Treat any existing certificates as untrusted CAs */ # define SSL_BUILD_CHAIN_FLAG_UNTRUSTED 0x1 /* Don't include root CA in chain */ # define SSL_BUILD_CHAIN_FLAG_NO_ROOT 0x2 /* Just check certificates already there */ # define SSL_BUILD_CHAIN_FLAG_CHECK 0x4 /* Ignore verification errors */ # define SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR 0x8 /* Clear verification errors from queue */ # define SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR 0x10 /* Flags returned by SSL_check_chain */ /* Certificate can be used with this session */ # define CERT_PKEY_VALID 0x1 /* Certificate can also be used for signing */ # define CERT_PKEY_SIGN 0x2 /* EE certificate signing algorithm OK */ # define CERT_PKEY_EE_SIGNATURE 0x10 /* CA signature algorithms OK */ # define CERT_PKEY_CA_SIGNATURE 0x20 /* EE certificate parameters OK */ # define CERT_PKEY_EE_PARAM 0x40 /* CA certificate parameters OK */ # define CERT_PKEY_CA_PARAM 0x80 /* Signing explicitly allowed as opposed to SHA1 fallback */ # define CERT_PKEY_EXPLICIT_SIGN 0x100 /* Client CA issuer names match (always set for server cert) */ # define CERT_PKEY_ISSUER_NAME 0x200 /* Cert type matches client types (always set for server cert) */ # define CERT_PKEY_CERT_TYPE 0x400 /* Cert chain suitable to Suite B */ # define CERT_PKEY_SUITEB 0x800 # define SSL_CONF_FLAG_CMDLINE 0x1 # define SSL_CONF_FLAG_FILE 0x2 # define SSL_CONF_FLAG_CLIENT 0x4 # define SSL_CONF_FLAG_SERVER 0x8 # define SSL_CONF_FLAG_SHOW_ERRORS 0x10 # define SSL_CONF_FLAG_CERTIFICATE 0x20 /* Configuration value types */ # define SSL_CONF_TYPE_UNKNOWN 0x0 # define SSL_CONF_TYPE_STRING 0x1 # define SSL_CONF_TYPE_FILE 0x2 # define SSL_CONF_TYPE_DIR 0x3 /* * Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, they * cannot be used to clear bits. */ # define SSL_CTX_set_options(ctx,op) \ SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,(op),NULL) # define SSL_CTX_clear_options(ctx,op) \ SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_OPTIONS,(op),NULL) # define SSL_CTX_get_options(ctx) \ SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,0,NULL) # define SSL_set_options(ssl,op) \ SSL_ctrl((ssl),SSL_CTRL_OPTIONS,(op),NULL) # define SSL_clear_options(ssl,op) \ SSL_ctrl((ssl),SSL_CTRL_CLEAR_OPTIONS,(op),NULL) # define SSL_get_options(ssl) \ SSL_ctrl((ssl),SSL_CTRL_OPTIONS,0,NULL) # define SSL_CTX_set_mode(ctx,op) \ SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL) # define SSL_CTX_clear_mode(ctx,op) \ SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_MODE,(op),NULL) # define SSL_CTX_get_mode(ctx) \ SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL) # define SSL_clear_mode(ssl,op) \ SSL_ctrl((ssl),SSL_CTRL_CLEAR_MODE,(op),NULL) # define SSL_set_mode(ssl,op) \ SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL) # define SSL_get_mode(ssl) \ SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL) # define SSL_set_mtu(ssl, mtu) \ SSL_ctrl((ssl),SSL_CTRL_SET_MTU,(mtu),NULL) # define DTLS_set_link_mtu(ssl, mtu) \ SSL_ctrl((ssl),DTLS_CTRL_SET_LINK_MTU,(mtu),NULL) # define DTLS_get_link_min_mtu(ssl) \ SSL_ctrl((ssl),DTLS_CTRL_GET_LINK_MIN_MTU,0,NULL) # define SSL_get_secure_renegotiation_support(ssl) \ SSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL) # ifndef OPENSSL_NO_HEARTBEATS # define SSL_heartbeat(ssl) \ SSL_ctrl((ssl),SSL_CTRL_TLS_EXT_SEND_HEARTBEAT,0,NULL) # endif # define SSL_CTX_set_cert_flags(ctx,op) \ SSL_CTX_ctrl((ctx),SSL_CTRL_CERT_FLAGS,(op),NULL) # define SSL_set_cert_flags(s,op) \ SSL_ctrl((s),SSL_CTRL_CERT_FLAGS,(op),NULL) # define SSL_CTX_clear_cert_flags(ctx,op) \ SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL) # define SSL_clear_cert_flags(s,op) \ SSL_ctrl((s),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL) void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb) (int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); void SSL_set_msg_callback(SSL *ssl, void (*cb) (int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); # define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) # define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) # if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32) # define SSL_MAX_CERT_LIST_DEFAULT 1024*30 /* 30k max cert list :-) */ # else # define SSL_MAX_CERT_LIST_DEFAULT 1024*100 /* 100k max cert list :-) */ # endif # define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024*20) /* * This callback type is used inside SSL_CTX, SSL, and in the functions that * set them. It is used to override the generation of SSL/TLS session IDs in * a server. Return value should be zero on an error, non-zero to proceed. * Also, callbacks should themselves check if the id they generate is unique * otherwise the SSL handshake will fail with an error - callbacks can do * this using the 'ssl' value they're passed by; * SSL_has_matching_session_id(ssl, id, *id_len) The length value passed in * is set at the maximum size the session ID can be. In SSLv2 this is 16 * bytes, whereas SSLv3/TLSv1 it is 32 bytes. The callback can alter this * length to be less if desired, but under SSLv2 session IDs are supposed to * be fixed at 16 bytes so the id will be padded after the callback returns * in this case. It is also an error for the callback to set the size to * zero. */ typedef int (*GEN_SESSION_CB) (const SSL *ssl, unsigned char *id, unsigned int *id_len); typedef struct ssl_comp_st SSL_COMP; # ifndef OPENSSL_NO_SSL_INTERN struct ssl_comp_st { int id; const char *name; # ifndef OPENSSL_NO_COMP COMP_METHOD *method; # else char *method; # endif }; DECLARE_STACK_OF(SSL_COMP) DECLARE_LHASH_OF(SSL_SESSION); struct ssl_ctx_st { const SSL_METHOD *method; STACK_OF(SSL_CIPHER) *cipher_list; /* same as above but sorted for lookup */ STACK_OF(SSL_CIPHER) *cipher_list_by_id; struct x509_store_st /* X509_STORE */ *cert_store; LHASH_OF(SSL_SESSION) *sessions; /* * Most session-ids that will be cached, default is * SSL_SESSION_CACHE_MAX_SIZE_DEFAULT. 0 is unlimited. */ unsigned long session_cache_size; struct ssl_session_st *session_cache_head; struct ssl_session_st *session_cache_tail; /* * This can have one of 2 values, ored together, SSL_SESS_CACHE_CLIENT, * SSL_SESS_CACHE_SERVER, Default is SSL_SESSION_CACHE_SERVER, which * means only SSL_accept which cache SSL_SESSIONS. */ int session_cache_mode; /* * If timeout is not 0, it is the default timeout value set when * SSL_new() is called. This has been put in to make life easier to set * things up */ long session_timeout; /* * If this callback is not null, it will be called each time a session id * is added to the cache. If this function returns 1, it means that the * callback will do a SSL_SESSION_free() when it has finished using it. * Otherwise, on 0, it means the callback has finished with it. If * remove_session_cb is not null, it will be called when a session-id is * removed from the cache. After the call, OpenSSL will * SSL_SESSION_free() it. */ int (*new_session_cb) (struct ssl_st *ssl, SSL_SESSION *sess); void (*remove_session_cb) (struct ssl_ctx_st *ctx, SSL_SESSION *sess); SSL_SESSION *(*get_session_cb) (struct ssl_st *ssl, unsigned char *data, int len, int *copy); struct { int sess_connect; /* SSL new conn - started */ int sess_connect_renegotiate; /* SSL reneg - requested */ int sess_connect_good; /* SSL new conne/reneg - finished */ int sess_accept; /* SSL new accept - started */ int sess_accept_renegotiate; /* SSL reneg - requested */ int sess_accept_good; /* SSL accept/reneg - finished */ int sess_miss; /* session lookup misses */ int sess_timeout; /* reuse attempt on timeouted session */ int sess_cache_full; /* session removed due to full cache */ int sess_hit; /* session reuse actually done */ int sess_cb_hit; /* session-id that was not in the cache was * passed back via the callback. This * indicates that the application is * supplying session-id's from other * processes - spooky :-) */ } stats; int references; /* if defined, these override the X509_verify_cert() calls */ int (*app_verify_callback) (X509_STORE_CTX *, void *); void *app_verify_arg; /* * before OpenSSL 0.9.7, 'app_verify_arg' was ignored * ('app_verify_callback' was called with just one argument) */ /* Default password callback. */ pem_password_cb *default_passwd_callback; /* Default password callback user data. */ void *default_passwd_callback_userdata; /* get client cert callback */ int (*client_cert_cb) (SSL *ssl, X509 **x509, EVP_PKEY **pkey); /* cookie generate callback */ int (*app_gen_cookie_cb) (SSL *ssl, unsigned char *cookie, unsigned int *cookie_len); /* verify cookie callback */ int (*app_verify_cookie_cb) (SSL *ssl, unsigned char *cookie, unsigned int cookie_len); CRYPTO_EX_DATA ex_data; const EVP_MD *rsa_md5; /* For SSLv2 - name is 'ssl2-md5' */ const EVP_MD *md5; /* For SSLv3/TLSv1 'ssl3-md5' */ const EVP_MD *sha1; /* For SSLv3/TLSv1 'ssl3->sha1' */ STACK_OF(X509) *extra_certs; STACK_OF(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */ /* Default values used when no per-SSL value is defined follow */ /* used if SSL's info_callback is NULL */ void (*info_callback) (const SSL *ssl, int type, int val); /* what we put in client cert requests */ STACK_OF(X509_NAME) *client_CA; /* * Default values to use in SSL structures follow (these are copied by * SSL_new) */ unsigned long options; unsigned long mode; long max_cert_list; struct cert_st /* CERT */ *cert; int read_ahead; /* callback that allows applications to peek at protocol messages */ void (*msg_callback) (int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg); void *msg_callback_arg; int verify_mode; unsigned int sid_ctx_length; unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH]; /* called 'verify_callback' in the SSL */ int (*default_verify_callback) (int ok, X509_STORE_CTX *ctx); /* Default generate session ID callback. */ GEN_SESSION_CB generate_session_id; X509_VERIFY_PARAM *param; # if 0 int purpose; /* Purpose setting */ int trust; /* Trust setting */ # endif int quiet_shutdown; /* * Maximum amount of data to send in one fragment. actual record size can * be more than this due to padding and MAC overheads. */ unsigned int max_send_fragment; # ifndef OPENSSL_NO_ENGINE /* * Engine to pass requests for client certs to */ ENGINE *client_cert_engine; # endif # ifndef OPENSSL_NO_TLSEXT /* TLS extensions servername callback */ int (*tlsext_servername_callback) (SSL *, int *, void *); void *tlsext_servername_arg; /* RFC 4507 session ticket keys */ unsigned char tlsext_tick_key_name[16]; unsigned char tlsext_tick_hmac_key[16]; unsigned char tlsext_tick_aes_key[16]; /* Callback to support customisation of ticket key setting */ int (*tlsext_ticket_key_cb) (SSL *ssl, unsigned char *name, unsigned char *iv, EVP_CIPHER_CTX *ectx, HMAC_CTX *hctx, int enc); /* certificate status request info */ /* Callback for status request */ int (*tlsext_status_cb) (SSL *ssl, void *arg); void *tlsext_status_arg; /* draft-rescorla-tls-opaque-prf-input-00.txt information */ int (*tlsext_opaque_prf_input_callback) (SSL *, void *peerinput, size_t len, void *arg); void *tlsext_opaque_prf_input_callback_arg; # endif # ifndef OPENSSL_NO_PSK char *psk_identity_hint; unsigned int (*psk_client_callback) (SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len); unsigned int (*psk_server_callback) (SSL *ssl, const char *identity, unsigned char *psk, unsigned int max_psk_len); # endif # ifndef OPENSSL_NO_BUF_FREELISTS # define SSL_MAX_BUF_FREELIST_LEN_DEFAULT 32 unsigned int freelist_max_len; struct ssl3_buf_freelist_st *wbuf_freelist; struct ssl3_buf_freelist_st *rbuf_freelist; # endif # ifndef OPENSSL_NO_TLSEXT # ifndef OPENSSL_NO_NEXTPROTONEG /* Next protocol negotiation information */ /* (for experimental NPN extension). */ /* * For a server, this contains a callback function by which the set of * advertised protocols can be provided. */ int (*next_protos_advertised_cb) (SSL *s, const unsigned char **buf, unsigned int *len, void *arg); void *next_protos_advertised_cb_arg; /* * For a client, this contains a callback function that selects the next * protocol from the list provided by the server. */ int (*next_proto_select_cb) (SSL *s, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg); void *next_proto_select_cb_arg; # endif /* SRTP profiles we are willing to do from RFC 5764 */ STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles; /* * ALPN information (we are in the process of transitioning from NPN to * ALPN.) */ /*- * For a server, this contains a callback function that allows the * server to select the protocol for the connection. * out: on successful return, this must point to the raw protocol * name (without the length prefix). * outlen: on successful return, this contains the length of |*out|. * in: points to the client's list of supported protocols in * wire-format. * inlen: the length of |in|. */ int (*alpn_select_cb) (SSL *s, const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg); void *alpn_select_cb_arg; /* * For a client, this contains the list of supported protocols in wire * format. */ unsigned char *alpn_client_proto_list; unsigned alpn_client_proto_list_len; # ifndef OPENSSL_NO_EC /* EC extension values inherited by SSL structure */ size_t tlsext_ecpointformatlist_length; unsigned char *tlsext_ecpointformatlist; size_t tlsext_ellipticcurvelist_length; unsigned char *tlsext_ellipticcurvelist; # endif /* OPENSSL_NO_EC */ # endif }; # endif # define SSL_SESS_CACHE_OFF 0x0000 # define SSL_SESS_CACHE_CLIENT 0x0001 # define SSL_SESS_CACHE_SERVER 0x0002 # define SSL_SESS_CACHE_BOTH (SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER) # define SSL_SESS_CACHE_NO_AUTO_CLEAR 0x0080 /* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */ # define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP 0x0100 # define SSL_SESS_CACHE_NO_INTERNAL_STORE 0x0200 # define SSL_SESS_CACHE_NO_INTERNAL \ (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE) LHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx); # define SSL_CTX_sess_number(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL) # define SSL_CTX_sess_connect(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,NULL) # define SSL_CTX_sess_connect_good(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,NULL) # define SSL_CTX_sess_connect_renegotiate(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,NULL) # define SSL_CTX_sess_accept(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,NULL) # define SSL_CTX_sess_accept_renegotiate(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,NULL) # define SSL_CTX_sess_accept_good(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,NULL) # define SSL_CTX_sess_hits(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,NULL) # define SSL_CTX_sess_cb_hits(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,NULL) # define SSL_CTX_sess_misses(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,NULL) # define SSL_CTX_sess_timeouts(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL) # define SSL_CTX_sess_cache_full(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL) void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, int (*new_session_cb) (struct ssl_st *ssl, SSL_SESSION *sess)); int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx)) (struct ssl_st *ssl, SSL_SESSION *sess); void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, void (*remove_session_cb) (struct ssl_ctx_st *ctx, SSL_SESSION *sess)); void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx)) (struct ssl_ctx_st *ctx, SSL_SESSION *sess); void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, SSL_SESSION *(*get_session_cb) (struct ssl_st *ssl, unsigned char *data, int len, int *copy)); SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx)) (struct ssl_st *ssl, unsigned char *Data, int len, int *copy); void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*cb) (const SSL *ssl, int type, int val)); void (*SSL_CTX_get_info_callback(SSL_CTX *ctx)) (const SSL *ssl, int type, int val); void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, int (*client_cert_cb) (SSL *ssl, X509 **x509, EVP_PKEY **pkey)); int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx)) (SSL *ssl, X509 **x509, EVP_PKEY **pkey); # ifndef OPENSSL_NO_ENGINE int SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e); # endif void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, int (*app_gen_cookie_cb) (SSL *ssl, unsigned char *cookie, unsigned int *cookie_len)); void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, int (*app_verify_cookie_cb) (SSL *ssl, unsigned char *cookie, unsigned int cookie_len)); # ifndef OPENSSL_NO_NEXTPROTONEG void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s, int (*cb) (SSL *ssl, const unsigned char **out, unsigned int *outlen, void *arg), void *arg); void SSL_CTX_set_next_proto_select_cb(SSL_CTX *s, int (*cb) (SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg), void *arg); void SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data, unsigned *len); # endif # ifndef OPENSSL_NO_TLSEXT int SSL_select_next_proto(unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, const unsigned char *client, unsigned int client_len); # endif # define OPENSSL_NPN_UNSUPPORTED 0 # define OPENSSL_NPN_NEGOTIATED 1 # define OPENSSL_NPN_NO_OVERLAP 2 int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos, unsigned protos_len); int SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos, unsigned protos_len); void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx, int (*cb) (SSL *ssl, const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg), void *arg); void SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, unsigned *len); # ifndef OPENSSL_NO_PSK /* * the maximum length of the buffer given to callbacks containing the * resulting identity/psk */ # define PSK_MAX_IDENTITY_LEN 128 # define PSK_MAX_PSK_LEN 256 void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, unsigned int (*psk_client_callback) (SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)); void SSL_set_psk_client_callback(SSL *ssl, unsigned int (*psk_client_callback) (SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)); void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, unsigned int (*psk_server_callback) (SSL *ssl, const char *identity, unsigned char *psk, unsigned int max_psk_len)); void SSL_set_psk_server_callback(SSL *ssl, unsigned int (*psk_server_callback) (SSL *ssl, const char *identity, unsigned char *psk, unsigned int max_psk_len)); int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint); int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint); const char *SSL_get_psk_identity_hint(const SSL *s); const char *SSL_get_psk_identity(const SSL *s); # endif # ifndef OPENSSL_NO_TLSEXT /* Register callbacks to handle custom TLS Extensions for client or server. */ int SSL_CTX_add_client_custom_ext(SSL_CTX *ctx, unsigned int ext_type, custom_ext_add_cb add_cb, custom_ext_free_cb free_cb, void *add_arg, custom_ext_parse_cb parse_cb, void *parse_arg); int SSL_CTX_add_server_custom_ext(SSL_CTX *ctx, unsigned int ext_type, custom_ext_add_cb add_cb, custom_ext_free_cb free_cb, void *add_arg, custom_ext_parse_cb parse_cb, void *parse_arg); int SSL_extension_supported(unsigned int ext_type); # endif # define SSL_NOTHING 1 # define SSL_WRITING 2 # define SSL_READING 3 # define SSL_X509_LOOKUP 4 /* These will only be used when doing non-blocking IO */ # define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING) # define SSL_want_read(s) (SSL_want(s) == SSL_READING) # define SSL_want_write(s) (SSL_want(s) == SSL_WRITING) # define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP) # define SSL_MAC_FLAG_READ_MAC_STREAM 1 # define SSL_MAC_FLAG_WRITE_MAC_STREAM 2 # ifndef OPENSSL_NO_SSL_INTERN struct ssl_st { /* * protocol version (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION, * DTLS1_VERSION) */ int version; /* SSL_ST_CONNECT or SSL_ST_ACCEPT */ int type; /* SSLv3 */ const SSL_METHOD *method; /* * There are 2 BIO's even though they are normally both the same. This * is so data can be read and written to different handlers */ # ifndef OPENSSL_NO_BIO /* used by SSL_read */ BIO *rbio; /* used by SSL_write */ BIO *wbio; /* used during session-id reuse to concatenate messages */ BIO *bbio; # else /* used by SSL_read */ char *rbio; /* used by SSL_write */ char *wbio; char *bbio; # endif /* * This holds a variable that indicates what we were doing when a 0 or -1 * is returned. This is needed for non-blocking IO so we know what * request needs re-doing when in SSL_accept or SSL_connect */ int rwstate; /* true when we are actually in SSL_accept() or SSL_connect() */ int in_handshake; int (*handshake_func) (SSL *); /* * Imagine that here's a boolean member "init" that is switched as soon * as SSL_set_{accept/connect}_state is called for the first time, so * that "state" and "handshake_func" are properly initialized. But as * handshake_func is == 0 until then, we use this test instead of an * "init" member. */ /* are we the server side? - mostly used by SSL_clear */ int server; /* * Generate a new session or reuse an old one. * NB: For servers, the 'new' session may actually be a previously * cached session or even the previous session unless * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set */ int new_session; /* don't send shutdown packets */ int quiet_shutdown; /* we have shut things down, 0x01 sent, 0x02 for received */ int shutdown; /* where we are */ int state; /* where we are when reading */ int rstate; BUF_MEM *init_buf; /* buffer used during init */ void *init_msg; /* pointer to handshake message body, set by * ssl3_get_message() */ int init_num; /* amount read/written */ int init_off; /* amount read/written */ /* used internally to point at a raw packet */ unsigned char *packet; unsigned int packet_length; struct ssl2_state_st *s2; /* SSLv2 variables */ struct ssl3_state_st *s3; /* SSLv3 variables */ struct dtls1_state_st *d1; /* DTLSv1 variables */ int read_ahead; /* Read as many input bytes as possible (for * non-blocking reads) */ /* callback that allows applications to peek at protocol messages */ void (*msg_callback) (int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg); void *msg_callback_arg; int hit; /* reusing a previous session */ X509_VERIFY_PARAM *param; # if 0 int purpose; /* Purpose setting */ int trust; /* Trust setting */ # endif /* crypto */ STACK_OF(SSL_CIPHER) *cipher_list; STACK_OF(SSL_CIPHER) *cipher_list_by_id; /* * These are the ones being used, the ones in SSL_SESSION are the ones to * be 'copied' into these ones */ int mac_flags; EVP_CIPHER_CTX *enc_read_ctx; /* cryptographic state */ EVP_MD_CTX *read_hash; /* used for mac generation */ # ifndef OPENSSL_NO_COMP COMP_CTX *expand; /* uncompress */ # else char *expand; # endif EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */ EVP_MD_CTX *write_hash; /* used for mac generation */ # ifndef OPENSSL_NO_COMP COMP_CTX *compress; /* compression */ # else char *compress; # endif /* session info */ /* client cert? */ /* This is used to hold the server certificate used */ struct cert_st /* CERT */ *cert; /* * the session_id_context is used to ensure sessions are only reused in * the appropriate context */ unsigned int sid_ctx_length; unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH]; /* This can also be in the session once a session is established */ SSL_SESSION *session; /* Default generate session ID callback. */ GEN_SESSION_CB generate_session_id; /* Used in SSL2 and SSL3 */ /* * 0 don't care about verify failure. * 1 fail if verify fails */ int verify_mode; /* fail if callback returns 0 */ int (*verify_callback) (int ok, X509_STORE_CTX *ctx); /* optional informational callback */ void (*info_callback) (const SSL *ssl, int type, int val); /* error bytes to be written */ int error; /* actual code */ int error_code; # ifndef OPENSSL_NO_KRB5 /* Kerberos 5 context */ KSSL_CTX *kssl_ctx; # endif /* OPENSSL_NO_KRB5 */ # ifndef OPENSSL_NO_PSK unsigned int (*psk_client_callback) (SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len); unsigned int (*psk_server_callback) (SSL *ssl, const char *identity, unsigned char *psk, unsigned int max_psk_len); # endif SSL_CTX *ctx; /* * set this flag to 1 and a sleep(1) is put into all SSL_read() and * SSL_write() calls, good for nbio debuging :-) */ int debug; /* extra application data */ long verify_result; CRYPTO_EX_DATA ex_data; /* for server side, keep the list of CA_dn we can use */ STACK_OF(X509_NAME) *client_CA; int references; /* protocol behaviour */ unsigned long options; /* API behaviour */ unsigned long mode; long max_cert_list; int first_packet; /* what was passed, used for SSLv3/TLS rollback check */ int client_version; unsigned int max_send_fragment; # ifndef OPENSSL_NO_TLSEXT /* TLS extension debug callback */ void (*tlsext_debug_cb) (SSL *s, int client_server, int type, unsigned char *data, int len, void *arg); void *tlsext_debug_arg; char *tlsext_hostname; /*- * no further mod of servername * 0 : call the servername extension callback. * 1 : prepare 2, allow last ack just after in server callback. * 2 : don't call servername callback, no ack in server hello */ int servername_done; /* certificate status request info */ /* Status type or -1 if no status type */ int tlsext_status_type; /* Expect OCSP CertificateStatus message */ int tlsext_status_expected; /* OCSP status request only */ STACK_OF(OCSP_RESPID) *tlsext_ocsp_ids; X509_EXTENSIONS *tlsext_ocsp_exts; /* OCSP response received or to be sent */ unsigned char *tlsext_ocsp_resp; int tlsext_ocsp_resplen; /* RFC4507 session ticket expected to be received or sent */ int tlsext_ticket_expected; # ifndef OPENSSL_NO_EC size_t tlsext_ecpointformatlist_length; /* our list */ unsigned char *tlsext_ecpointformatlist; size_t tlsext_ellipticcurvelist_length; /* our list */ unsigned char *tlsext_ellipticcurvelist; # endif /* OPENSSL_NO_EC */ /* * draft-rescorla-tls-opaque-prf-input-00.txt information to be used for * handshakes */ void *tlsext_opaque_prf_input; size_t tlsext_opaque_prf_input_len; /* TLS Session Ticket extension override */ TLS_SESSION_TICKET_EXT *tlsext_session_ticket; /* TLS Session Ticket extension callback */ tls_session_ticket_ext_cb_fn tls_session_ticket_ext_cb; void *tls_session_ticket_ext_cb_arg; /* TLS pre-shared secret session resumption */ tls_session_secret_cb_fn tls_session_secret_cb; void *tls_session_secret_cb_arg; SSL_CTX *initial_ctx; /* initial ctx, used to store sessions */ # ifndef OPENSSL_NO_NEXTPROTONEG /* * Next protocol negotiation. For the client, this is the protocol that * we sent in NextProtocol and is set when handling ServerHello * extensions. For a server, this is the client's selected_protocol from * NextProtocol and is set when handling the NextProtocol message, before * the Finished message. */ unsigned char *next_proto_negotiated; unsigned char next_proto_negotiated_len; # endif # define session_ctx initial_ctx /* What we'll do */ STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles; /* What's been chosen */ SRTP_PROTECTION_PROFILE *srtp_profile; /*- * Is use of the Heartbeat extension negotiated? * 0: disabled * 1: enabled * 2: enabled, but not allowed to send Requests */ unsigned int tlsext_heartbeat; /* Indicates if a HeartbeatRequest is in flight */ unsigned int tlsext_hb_pending; /* HeartbeatRequest sequence number */ unsigned int tlsext_hb_seq; # else # define session_ctx ctx # endif /* OPENSSL_NO_TLSEXT */ /*- * 1 if we are renegotiating. * 2 if we are a server and are inside a handshake * (i.e. not just sending a HelloRequest) */ int renegotiate; # ifndef OPENSSL_NO_TLSEXT /* * For a client, this contains the list of supported protocols in wire * format. */ unsigned char *alpn_client_proto_list; unsigned alpn_client_proto_list_len; # endif /* OPENSSL_NO_TLSEXT */ }; # endif #ifdef __cplusplus } #endif # include <openssl/ssl2.h> # include <openssl/ssl3.h> # include <openssl/tls1.h> /* This is mostly sslv3 with a few tweaks */ # include <openssl/dtls1.h> /* Datagram TLS */ # include <openssl/ssl23.h> # include <openssl/srtp.h> /* Support for the use_srtp extension */ #ifdef __cplusplus extern "C" { #endif /* compatibility */ # define SSL_set_app_data(s,arg) (SSL_set_ex_data(s,0,(char *)arg)) # define SSL_get_app_data(s) (SSL_get_ex_data(s,0)) # define SSL_SESSION_set_app_data(s,a) (SSL_SESSION_set_ex_data(s,0,(char *)a)) # define SSL_SESSION_get_app_data(s) (SSL_SESSION_get_ex_data(s,0)) # define SSL_CTX_get_app_data(ctx) (SSL_CTX_get_ex_data(ctx,0)) # define SSL_CTX_set_app_data(ctx,arg) (SSL_CTX_set_ex_data(ctx,0,(char *)arg)) /* * The following are the possible values for ssl->state are are used to * indicate where we are up to in the SSL connection establishment. The * macros that follow are about the only things you should need to use and * even then, only when using non-blocking IO. It can also be useful to work * out where you were when the connection failed */ # define SSL_ST_CONNECT 0x1000 # define SSL_ST_ACCEPT 0x2000 # define SSL_ST_MASK 0x0FFF # define SSL_ST_INIT (SSL_ST_CONNECT|SSL_ST_ACCEPT) # define SSL_ST_BEFORE 0x4000 # define SSL_ST_OK 0x03 # define SSL_ST_RENEGOTIATE (0x04|SSL_ST_INIT) # define SSL_ST_ERR (0x05|SSL_ST_INIT) # define SSL_CB_LOOP 0x01 # define SSL_CB_EXIT 0x02 # define SSL_CB_READ 0x04 # define SSL_CB_WRITE 0x08 # define SSL_CB_ALERT 0x4000/* used in callback */ # define SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ) # define SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE) # define SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP) # define SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT) # define SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP) # define SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT) # define SSL_CB_HANDSHAKE_START 0x10 # define SSL_CB_HANDSHAKE_DONE 0x20 /* Is the SSL_connection established? */ # define SSL_get_state(a) SSL_state(a) # define SSL_is_init_finished(a) (SSL_state(a) == SSL_ST_OK) # define SSL_in_init(a) (SSL_state(a)&SSL_ST_INIT) # define SSL_in_before(a) (SSL_state(a)&SSL_ST_BEFORE) # define SSL_in_connect_init(a) (SSL_state(a)&SSL_ST_CONNECT) # define SSL_in_accept_init(a) (SSL_state(a)&SSL_ST_ACCEPT) /* * The following 2 states are kept in ssl->rstate when reads fail, you should * not need these */ # define SSL_ST_READ_HEADER 0xF0 # define SSL_ST_READ_BODY 0xF1 # define SSL_ST_READ_DONE 0xF2 /*- * Obtain latest Finished message * -- that we sent (SSL_get_finished) * -- that we expected from peer (SSL_get_peer_finished). * Returns length (0 == no Finished so far), copies up to 'count' bytes. */ size_t SSL_get_finished(const SSL *s, void *buf, size_t count); size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count); /* * use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 2 options are * 'ored' with SSL_VERIFY_PEER if they are desired */ # define SSL_VERIFY_NONE 0x00 # define SSL_VERIFY_PEER 0x01 # define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02 # define SSL_VERIFY_CLIENT_ONCE 0x04 # define OpenSSL_add_ssl_algorithms() SSL_library_init() # define SSLeay_add_ssl_algorithms() SSL_library_init() /* this is for backward compatibility */ # if 0 /* NEW_SSLEAY */ # define SSL_CTX_set_default_verify(a,b,c) SSL_CTX_set_verify(a,b,c) # define SSL_set_pref_cipher(c,n) SSL_set_cipher_list(c,n) # define SSL_add_session(a,b) SSL_CTX_add_session((a),(b)) # define SSL_remove_session(a,b) SSL_CTX_remove_session((a),(b)) # define SSL_flush_sessions(a,b) SSL_CTX_flush_sessions((a),(b)) # endif /* More backward compatibility */ # define SSL_get_cipher(s) \ SSL_CIPHER_get_name(SSL_get_current_cipher(s)) # define SSL_get_cipher_bits(s,np) \ SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np) # define SSL_get_cipher_version(s) \ SSL_CIPHER_get_version(SSL_get_current_cipher(s)) # define SSL_get_cipher_name(s) \ SSL_CIPHER_get_name(SSL_get_current_cipher(s)) # define SSL_get_time(a) SSL_SESSION_get_time(a) # define SSL_set_time(a,b) SSL_SESSION_set_time((a),(b)) # define SSL_get_timeout(a) SSL_SESSION_get_timeout(a) # define SSL_set_timeout(a,b) SSL_SESSION_set_timeout((a),(b)) # define d2i_SSL_SESSION_bio(bp,s_id) ASN1_d2i_bio_of(SSL_SESSION,SSL_SESSION_new,d2i_SSL_SESSION,bp,s_id) # define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio_of(SSL_SESSION,i2d_SSL_SESSION,bp,s_id) DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION) # define SSL_AD_REASON_OFFSET 1000/* offset to get SSL_R_... value * from SSL_AD_... */ /* These alert types are for SSLv3 and TLSv1 */ # define SSL_AD_CLOSE_NOTIFY SSL3_AD_CLOSE_NOTIFY /* fatal */ # define SSL_AD_UNEXPECTED_MESSAGE SSL3_AD_UNEXPECTED_MESSAGE /* fatal */ # define SSL_AD_BAD_RECORD_MAC SSL3_AD_BAD_RECORD_MAC # define SSL_AD_DECRYPTION_FAILED TLS1_AD_DECRYPTION_FAILED # define SSL_AD_RECORD_OVERFLOW TLS1_AD_RECORD_OVERFLOW /* fatal */ # define SSL_AD_DECOMPRESSION_FAILURE SSL3_AD_DECOMPRESSION_FAILURE /* fatal */ # define SSL_AD_HANDSHAKE_FAILURE SSL3_AD_HANDSHAKE_FAILURE /* Not for TLS */ # define SSL_AD_NO_CERTIFICATE SSL3_AD_NO_CERTIFICATE # define SSL_AD_BAD_CERTIFICATE SSL3_AD_BAD_CERTIFICATE # define SSL_AD_UNSUPPORTED_CERTIFICATE SSL3_AD_UNSUPPORTED_CERTIFICATE # define SSL_AD_CERTIFICATE_REVOKED SSL3_AD_CERTIFICATE_REVOKED # define SSL_AD_CERTIFICATE_EXPIRED SSL3_AD_CERTIFICATE_EXPIRED # define SSL_AD_CERTIFICATE_UNKNOWN SSL3_AD_CERTIFICATE_UNKNOWN /* fatal */ # define SSL_AD_ILLEGAL_PARAMETER SSL3_AD_ILLEGAL_PARAMETER /* fatal */ # define SSL_AD_UNKNOWN_CA TLS1_AD_UNKNOWN_CA /* fatal */ # define SSL_AD_ACCESS_DENIED TLS1_AD_ACCESS_DENIED /* fatal */ # define SSL_AD_DECODE_ERROR TLS1_AD_DECODE_ERROR # define SSL_AD_DECRYPT_ERROR TLS1_AD_DECRYPT_ERROR /* fatal */ # define SSL_AD_EXPORT_RESTRICTION TLS1_AD_EXPORT_RESTRICTION /* fatal */ # define SSL_AD_PROTOCOL_VERSION TLS1_AD_PROTOCOL_VERSION /* fatal */ # define SSL_AD_INSUFFICIENT_SECURITY TLS1_AD_INSUFFICIENT_SECURITY /* fatal */ # define SSL_AD_INTERNAL_ERROR TLS1_AD_INTERNAL_ERROR # define SSL_AD_USER_CANCELLED TLS1_AD_USER_CANCELLED # define SSL_AD_NO_RENEGOTIATION TLS1_AD_NO_RENEGOTIATION # define SSL_AD_UNSUPPORTED_EXTENSION TLS1_AD_UNSUPPORTED_EXTENSION # define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE # define SSL_AD_UNRECOGNIZED_NAME TLS1_AD_UNRECOGNIZED_NAME # define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE # define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE /* fatal */ # define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY /* fatal */ # define SSL_AD_INAPPROPRIATE_FALLBACK TLS1_AD_INAPPROPRIATE_FALLBACK # define SSL_ERROR_NONE 0 # define SSL_ERROR_SSL 1 # define SSL_ERROR_WANT_READ 2 # define SSL_ERROR_WANT_WRITE 3 # define SSL_ERROR_WANT_X509_LOOKUP 4 # define SSL_ERROR_SYSCALL 5/* look at error stack/return * value/errno */ # define SSL_ERROR_ZERO_RETURN 6 # define SSL_ERROR_WANT_CONNECT 7 # define SSL_ERROR_WANT_ACCEPT 8 # define SSL_CTRL_NEED_TMP_RSA 1 # define SSL_CTRL_SET_TMP_RSA 2 # define SSL_CTRL_SET_TMP_DH 3 # define SSL_CTRL_SET_TMP_ECDH 4 # define SSL_CTRL_SET_TMP_RSA_CB 5 # define SSL_CTRL_SET_TMP_DH_CB 6 # define SSL_CTRL_SET_TMP_ECDH_CB 7 # define SSL_CTRL_GET_SESSION_REUSED 8 # define SSL_CTRL_GET_CLIENT_CERT_REQUEST 9 # define SSL_CTRL_GET_NUM_RENEGOTIATIONS 10 # define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS 11 # define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS 12 # define SSL_CTRL_GET_FLAGS 13 # define SSL_CTRL_EXTRA_CHAIN_CERT 14 # define SSL_CTRL_SET_MSG_CALLBACK 15 # define SSL_CTRL_SET_MSG_CALLBACK_ARG 16 /* only applies to datagram connections */ # define SSL_CTRL_SET_MTU 17 /* Stats */ # define SSL_CTRL_SESS_NUMBER 20 # define SSL_CTRL_SESS_CONNECT 21 # define SSL_CTRL_SESS_CONNECT_GOOD 22 # define SSL_CTRL_SESS_CONNECT_RENEGOTIATE 23 # define SSL_CTRL_SESS_ACCEPT 24 # define SSL_CTRL_SESS_ACCEPT_GOOD 25 # define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE 26 # define SSL_CTRL_SESS_HIT 27 # define SSL_CTRL_SESS_CB_HIT 28 # define SSL_CTRL_SESS_MISSES 29 # define SSL_CTRL_SESS_TIMEOUTS 30 # define SSL_CTRL_SESS_CACHE_FULL 31 # define SSL_CTRL_OPTIONS 32 # define SSL_CTRL_MODE 33 # define SSL_CTRL_GET_READ_AHEAD 40 # define SSL_CTRL_SET_READ_AHEAD 41 # define SSL_CTRL_SET_SESS_CACHE_SIZE 42 # define SSL_CTRL_GET_SESS_CACHE_SIZE 43 # define SSL_CTRL_SET_SESS_CACHE_MODE 44 # define SSL_CTRL_GET_SESS_CACHE_MODE 45 # define SSL_CTRL_GET_MAX_CERT_LIST 50 # define SSL_CTRL_SET_MAX_CERT_LIST 51 # define SSL_CTRL_SET_MAX_SEND_FRAGMENT 52 /* see tls1.h for macros based on these */ # ifndef OPENSSL_NO_TLSEXT # define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB 53 # define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG 54 # define SSL_CTRL_SET_TLSEXT_HOSTNAME 55 # define SSL_CTRL_SET_TLSEXT_DEBUG_CB 56 # define SSL_CTRL_SET_TLSEXT_DEBUG_ARG 57 # define SSL_CTRL_GET_TLSEXT_TICKET_KEYS 58 # define SSL_CTRL_SET_TLSEXT_TICKET_KEYS 59 # define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT 60 # define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB 61 # define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG 62 # define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB 63 # define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG 64 # define SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE 65 # define SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS 66 # define SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS 67 # define SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS 68 # define SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS 69 # define SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP 70 # define SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP 71 # define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB 72 # define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB 75 # define SSL_CTRL_SET_SRP_VERIFY_PARAM_CB 76 # define SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB 77 # define SSL_CTRL_SET_SRP_ARG 78 # define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME 79 # define SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH 80 # define SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD 81 # ifndef OPENSSL_NO_HEARTBEATS # define SSL_CTRL_TLS_EXT_SEND_HEARTBEAT 85 # define SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING 86 # define SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS 87 # endif # endif /* OPENSSL_NO_TLSEXT */ # define DTLS_CTRL_GET_TIMEOUT 73 # define DTLS_CTRL_HANDLE_TIMEOUT 74 # define DTLS_CTRL_LISTEN 75 # define SSL_CTRL_GET_RI_SUPPORT 76 # define SSL_CTRL_CLEAR_OPTIONS 77 # define SSL_CTRL_CLEAR_MODE 78 # define SSL_CTRL_GET_EXTRA_CHAIN_CERTS 82 # define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS 83 # define SSL_CTRL_CHAIN 88 # define SSL_CTRL_CHAIN_CERT 89 # define SSL_CTRL_GET_CURVES 90 # define SSL_CTRL_SET_CURVES 91 # define SSL_CTRL_SET_CURVES_LIST 92 # define SSL_CTRL_GET_SHARED_CURVE 93 # define SSL_CTRL_SET_ECDH_AUTO 94 # define SSL_CTRL_SET_SIGALGS 97 # define SSL_CTRL_SET_SIGALGS_LIST 98 # define SSL_CTRL_CERT_FLAGS 99 # define SSL_CTRL_CLEAR_CERT_FLAGS 100 # define SSL_CTRL_SET_CLIENT_SIGALGS 101 # define SSL_CTRL_SET_CLIENT_SIGALGS_LIST 102 # define SSL_CTRL_GET_CLIENT_CERT_TYPES 103 # define SSL_CTRL_SET_CLIENT_CERT_TYPES 104 # define SSL_CTRL_BUILD_CERT_CHAIN 105 # define SSL_CTRL_SET_VERIFY_CERT_STORE 106 # define SSL_CTRL_SET_CHAIN_CERT_STORE 107 # define SSL_CTRL_GET_PEER_SIGNATURE_NID 108 # define SSL_CTRL_GET_SERVER_TMP_KEY 109 # define SSL_CTRL_GET_RAW_CIPHERLIST 110 # define SSL_CTRL_GET_EC_POINT_FORMATS 111 # define SSL_CTRL_GET_CHAIN_CERTS 115 # define SSL_CTRL_SELECT_CURRENT_CERT 116 # define SSL_CTRL_SET_CURRENT_CERT 117 # define SSL_CTRL_CHECK_PROTO_VERSION 119 # define DTLS_CTRL_SET_LINK_MTU 120 # define DTLS_CTRL_GET_LINK_MIN_MTU 121 # define SSL_CERT_SET_FIRST 1 # define SSL_CERT_SET_NEXT 2 # define SSL_CERT_SET_SERVER 3 # define DTLSv1_get_timeout(ssl, arg) \ SSL_ctrl(ssl,DTLS_CTRL_GET_TIMEOUT,0, (void *)arg) # define DTLSv1_handle_timeout(ssl) \ SSL_ctrl(ssl,DTLS_CTRL_HANDLE_TIMEOUT,0, NULL) # define DTLSv1_listen(ssl, peer) \ SSL_ctrl(ssl,DTLS_CTRL_LISTEN,0, (void *)peer) # define SSL_session_reused(ssl) \ SSL_ctrl((ssl),SSL_CTRL_GET_SESSION_REUSED,0,NULL) # define SSL_num_renegotiations(ssl) \ SSL_ctrl((ssl),SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,NULL) # define SSL_clear_num_renegotiations(ssl) \ SSL_ctrl((ssl),SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,NULL) # define SSL_total_renegotiations(ssl) \ SSL_ctrl((ssl),SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,NULL) # define SSL_CTX_need_tmp_RSA(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_NEED_TMP_RSA,0,NULL) # define SSL_CTX_set_tmp_rsa(ctx,rsa) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa) # define SSL_CTX_set_tmp_dh(ctx,dh) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)dh) # define SSL_CTX_set_tmp_ecdh(ctx,ecdh) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh) # define SSL_need_tmp_RSA(ssl) \ SSL_ctrl(ssl,SSL_CTRL_NEED_TMP_RSA,0,NULL) # define SSL_set_tmp_rsa(ssl,rsa) \ SSL_ctrl(ssl,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa) # define SSL_set_tmp_dh(ssl,dh) \ SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)dh) # define SSL_set_tmp_ecdh(ssl,ecdh) \ SSL_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh) # define SSL_CTX_add_extra_chain_cert(ctx,x509) \ SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)x509) # define SSL_CTX_get_extra_chain_certs(ctx,px509) \ SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,0,px509) # define SSL_CTX_get_extra_chain_certs_only(ctx,px509) \ SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,1,px509) # define SSL_CTX_clear_extra_chain_certs(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS,0,NULL) # define SSL_CTX_set0_chain(ctx,sk) \ SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,0,(char *)sk) # define SSL_CTX_set1_chain(ctx,sk) \ SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,1,(char *)sk) # define SSL_CTX_add0_chain_cert(ctx,x509) \ SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,0,(char *)x509) # define SSL_CTX_add1_chain_cert(ctx,x509) \ SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,1,(char *)x509) # define SSL_CTX_get0_chain_certs(ctx,px509) \ SSL_CTX_ctrl(ctx,SSL_CTRL_GET_CHAIN_CERTS,0,px509) # define SSL_CTX_clear_chain_certs(ctx) \ SSL_CTX_set0_chain(ctx,NULL) # define SSL_CTX_build_cert_chain(ctx, flags) \ SSL_CTX_ctrl(ctx,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) # define SSL_CTX_select_current_cert(ctx,x509) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)x509) # define SSL_CTX_set_current_cert(ctx, op) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CURRENT_CERT, op, NULL) # define SSL_CTX_set0_verify_cert_store(ctx,st) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)st) # define SSL_CTX_set1_verify_cert_store(ctx,st) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)st) # define SSL_CTX_set0_chain_cert_store(ctx,st) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)st) # define SSL_CTX_set1_chain_cert_store(ctx,st) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)st) # define SSL_set0_chain(ctx,sk) \ SSL_ctrl(ctx,SSL_CTRL_CHAIN,0,(char *)sk) # define SSL_set1_chain(ctx,sk) \ SSL_ctrl(ctx,SSL_CTRL_CHAIN,1,(char *)sk) # define SSL_add0_chain_cert(ctx,x509) \ SSL_ctrl(ctx,SSL_CTRL_CHAIN_CERT,0,(char *)x509) # define SSL_add1_chain_cert(ctx,x509) \ SSL_ctrl(ctx,SSL_CTRL_CHAIN_CERT,1,(char *)x509) # define SSL_get0_chain_certs(ctx,px509) \ SSL_ctrl(ctx,SSL_CTRL_GET_CHAIN_CERTS,0,px509) # define SSL_clear_chain_certs(ctx) \ SSL_set0_chain(ctx,NULL) # define SSL_build_cert_chain(s, flags) \ SSL_ctrl(s,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) # define SSL_select_current_cert(ctx,x509) \ SSL_ctrl(ctx,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)x509) # define SSL_set_current_cert(ctx,op) \ SSL_ctrl(ctx,SSL_CTRL_SET_CURRENT_CERT, op, NULL) # define SSL_set0_verify_cert_store(s,st) \ SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)st) # define SSL_set1_verify_cert_store(s,st) \ SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)st) # define SSL_set0_chain_cert_store(s,st) \ SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)st) # define SSL_set1_chain_cert_store(s,st) \ SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)st) # define SSL_get1_curves(ctx, s) \ SSL_ctrl(ctx,SSL_CTRL_GET_CURVES,0,(char *)s) # define SSL_CTX_set1_curves(ctx, clist, clistlen) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CURVES,clistlen,(char *)clist) # define SSL_CTX_set1_curves_list(ctx, s) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CURVES_LIST,0,(char *)s) # define SSL_set1_curves(ctx, clist, clistlen) \ SSL_ctrl(ctx,SSL_CTRL_SET_CURVES,clistlen,(char *)clist) # define SSL_set1_curves_list(ctx, s) \ SSL_ctrl(ctx,SSL_CTRL_SET_CURVES_LIST,0,(char *)s) # define SSL_get_shared_curve(s, n) \ SSL_ctrl(s,SSL_CTRL_GET_SHARED_CURVE,n,NULL) # define SSL_CTX_set_ecdh_auto(ctx, onoff) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_ECDH_AUTO,onoff,NULL) # define SSL_set_ecdh_auto(s, onoff) \ SSL_ctrl(s,SSL_CTRL_SET_ECDH_AUTO,onoff,NULL) # define SSL_CTX_set1_sigalgs(ctx, slist, slistlen) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS,slistlen,(int *)slist) # define SSL_CTX_set1_sigalgs_list(ctx, s) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)s) # define SSL_set1_sigalgs(ctx, slist, slistlen) \ SSL_ctrl(ctx,SSL_CTRL_SET_SIGALGS,slistlen,(int *)slist) # define SSL_set1_sigalgs_list(ctx, s) \ SSL_ctrl(ctx,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)s) # define SSL_CTX_set1_client_sigalgs(ctx, slist, slistlen) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS,slistlen,(int *)slist) # define SSL_CTX_set1_client_sigalgs_list(ctx, s) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)s) # define SSL_set1_client_sigalgs(ctx, slist, slistlen) \ SSL_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS,clistlen,(int *)slist) # define SSL_set1_client_sigalgs_list(ctx, s) \ SSL_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)s) # define SSL_get0_certificate_types(s, clist) \ SSL_ctrl(s, SSL_CTRL_GET_CLIENT_CERT_TYPES, 0, (char *)clist) # define SSL_CTX_set1_client_certificate_types(ctx, clist, clistlen) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen,(char *)clist) # define SSL_set1_client_certificate_types(s, clist, clistlen) \ SSL_ctrl(s,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen,(char *)clist) # define SSL_get_peer_signature_nid(s, pn) \ SSL_ctrl(s,SSL_CTRL_GET_PEER_SIGNATURE_NID,0,pn) # define SSL_get_server_tmp_key(s, pk) \ SSL_ctrl(s,SSL_CTRL_GET_SERVER_TMP_KEY,0,pk) # define SSL_get0_raw_cipherlist(s, plst) \ SSL_ctrl(s,SSL_CTRL_GET_RAW_CIPHERLIST,0,(char *)plst) # define SSL_get0_ec_point_formats(s, plst) \ SSL_ctrl(s,SSL_CTRL_GET_EC_POINT_FORMATS,0,(char *)plst) # ifndef OPENSSL_NO_BIO BIO_METHOD *BIO_f_ssl(void); BIO *BIO_new_ssl(SSL_CTX *ctx, int client); BIO *BIO_new_ssl_connect(SSL_CTX *ctx); BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); int BIO_ssl_copy_session_id(BIO *to, BIO *from); void BIO_ssl_shutdown(BIO *ssl_bio); # endif int SSL_CTX_set_cipher_list(SSL_CTX *, const char *str); SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth); void SSL_CTX_free(SSL_CTX *); long SSL_CTX_set_timeout(SSL_CTX *ctx, long t); long SSL_CTX_get_timeout(const SSL_CTX *ctx); X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); void SSL_CTX_set_cert_store(SSL_CTX *, X509_STORE *); int SSL_want(const SSL *s); int SSL_clear(SSL *s); void SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm); const SSL_CIPHER *SSL_get_current_cipher(const SSL *s); int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits); char *SSL_CIPHER_get_version(const SSL_CIPHER *c); const char *SSL_CIPHER_get_name(const SSL_CIPHER *c); unsigned long SSL_CIPHER_get_id(const SSL_CIPHER *c); int SSL_get_fd(const SSL *s); int SSL_get_rfd(const SSL *s); int SSL_get_wfd(const SSL *s); const char *SSL_get_cipher_list(const SSL *s, int n); char *SSL_get_shared_ciphers(const SSL *s, char *buf, int len); int SSL_get_read_ahead(const SSL *s); int SSL_pending(const SSL *s); # ifndef OPENSSL_NO_SOCK int SSL_set_fd(SSL *s, int fd); int SSL_set_rfd(SSL *s, int fd); int SSL_set_wfd(SSL *s, int fd); # endif # ifndef OPENSSL_NO_BIO void SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio); BIO *SSL_get_rbio(const SSL *s); BIO *SSL_get_wbio(const SSL *s); # endif int SSL_set_cipher_list(SSL *s, const char *str); void SSL_set_read_ahead(SSL *s, int yes); int SSL_get_verify_mode(const SSL *s); int SSL_get_verify_depth(const SSL *s); int (*SSL_get_verify_callback(const SSL *s)) (int, X509_STORE_CTX *); void SSL_set_verify(SSL *s, int mode, int (*callback) (int ok, X509_STORE_CTX *ctx)); void SSL_set_verify_depth(SSL *s, int depth); void SSL_set_cert_cb(SSL *s, int (*cb) (SSL *ssl, void *arg), void *arg); # ifndef OPENSSL_NO_RSA int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa); # endif int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len); int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey); int SSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const unsigned char *d, long len); int SSL_use_certificate(SSL *ssl, X509 *x); int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len); # ifndef OPENSSL_NO_TLSEXT /* Set serverinfo data for the current active cert. */ int SSL_CTX_use_serverinfo(SSL_CTX *ctx, const unsigned char *serverinfo, size_t serverinfo_length); # ifndef OPENSSL_NO_STDIO int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file); # endif /* NO_STDIO */ # endif # ifndef OPENSSL_NO_STDIO int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type); int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type); int SSL_use_certificate_file(SSL *ssl, const char *file, int type); int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type); int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type); int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type); /* PEM type */ int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file); int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, const char *file); # ifndef OPENSSL_SYS_VMS /* XXXXX: Better scheme needed! [was: #ifndef MAC_OS_pre_X] */ # ifndef OPENSSL_SYS_MACINTOSH_CLASSIC int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, const char *dir); # endif # endif # endif void SSL_load_error_strings(void); const char *SSL_state_string(const SSL *s); const char *SSL_rstate_string(const SSL *s); const char *SSL_state_string_long(const SSL *s); const char *SSL_rstate_string_long(const SSL *s); long SSL_SESSION_get_time(const SSL_SESSION *s); long SSL_SESSION_set_time(SSL_SESSION *s, long t); long SSL_SESSION_get_timeout(const SSL_SESSION *s); long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); void SSL_copy_session_id(SSL *to, const SSL *from); X509 *SSL_SESSION_get0_peer(SSL_SESSION *s); int SSL_SESSION_set1_id_context(SSL_SESSION *s, const unsigned char *sid_ctx, unsigned int sid_ctx_len); SSL_SESSION *SSL_SESSION_new(void); const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, unsigned int *len); unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s); # ifndef OPENSSL_NO_FP_API int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *ses); # endif # ifndef OPENSSL_NO_BIO int SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses); # endif void SSL_SESSION_free(SSL_SESSION *ses); int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp); int SSL_set_session(SSL *to, SSL_SESSION *session); int SSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c); int SSL_CTX_remove_session(SSL_CTX *, SSL_SESSION *c); int SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB); int SSL_set_generate_session_id(SSL *, GEN_SESSION_CB); int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id, unsigned int id_len); SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, long length); # ifdef HEADER_X509_H X509 *SSL_get_peer_certificate(const SSL *s); # endif STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s); int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx)) (int, X509_STORE_CTX *); void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, int (*callback) (int, X509_STORE_CTX *)); void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth); void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int (*cb) (X509_STORE_CTX *, void *), void *arg); void SSL_CTX_set_cert_cb(SSL_CTX *c, int (*cb) (SSL *ssl, void *arg), void *arg); # ifndef OPENSSL_NO_RSA int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); # endif int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len); int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey); int SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx, const unsigned char *d, long len); int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x); int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d); void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb); void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u); int SSL_CTX_check_private_key(const SSL_CTX *ctx); int SSL_check_private_key(const SSL *ctx); int SSL_CTX_set_session_id_context(SSL_CTX *ctx, const unsigned char *sid_ctx, unsigned int sid_ctx_len); SSL *SSL_new(SSL_CTX *ctx); int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx, unsigned int sid_ctx_len); int SSL_CTX_set_purpose(SSL_CTX *s, int purpose); int SSL_set_purpose(SSL *s, int purpose); int SSL_CTX_set_trust(SSL_CTX *s, int trust); int SSL_set_trust(SSL *s, int trust); int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm); int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm); X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx); X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl); void SSL_certs_clear(SSL *s); void SSL_free(SSL *ssl); int SSL_accept(SSL *ssl); int SSL_connect(SSL *ssl); int SSL_read(SSL *ssl, void *buf, int num); int SSL_peek(SSL *ssl, void *buf, int num); int SSL_write(SSL *ssl, const void *buf, int num); long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg); long SSL_callback_ctrl(SSL *, int, void (*)(void)); long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg); long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void)); int SSL_get_error(const SSL *s, int ret_code); const char *SSL_get_version(const SSL *s); /* This sets the 'default' SSL version that SSL_new() will create */ int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth); # ifndef OPENSSL_NO_SSL2_METHOD const SSL_METHOD *SSLv2_method(void); /* SSLv2 */ const SSL_METHOD *SSLv2_server_method(void); /* SSLv2 */ const SSL_METHOD *SSLv2_client_method(void); /* SSLv2 */ # endif # ifndef OPENSSL_NO_SSL3_METHOD const SSL_METHOD *SSLv3_method(void); /* SSLv3 */ const SSL_METHOD *SSLv3_server_method(void); /* SSLv3 */ const SSL_METHOD *SSLv3_client_method(void); /* SSLv3 */ # endif const SSL_METHOD *SSLv23_method(void); /* Negotiate highest available SSL/TLS * version */ const SSL_METHOD *SSLv23_server_method(void); /* Negotiate highest available * SSL/TLS version */ const SSL_METHOD *SSLv23_client_method(void); /* Negotiate highest available * SSL/TLS version */ const SSL_METHOD *TLSv1_method(void); /* TLSv1.0 */ const SSL_METHOD *TLSv1_server_method(void); /* TLSv1.0 */ const SSL_METHOD *TLSv1_client_method(void); /* TLSv1.0 */ const SSL_METHOD *TLSv1_1_method(void); /* TLSv1.1 */ const SSL_METHOD *TLSv1_1_server_method(void); /* TLSv1.1 */ const SSL_METHOD *TLSv1_1_client_method(void); /* TLSv1.1 */ const SSL_METHOD *TLSv1_2_method(void); /* TLSv1.2 */ const SSL_METHOD *TLSv1_2_server_method(void); /* TLSv1.2 */ const SSL_METHOD *TLSv1_2_client_method(void); /* TLSv1.2 */ const SSL_METHOD *DTLSv1_method(void); /* DTLSv1.0 */ const SSL_METHOD *DTLSv1_server_method(void); /* DTLSv1.0 */ const SSL_METHOD *DTLSv1_client_method(void); /* DTLSv1.0 */ const SSL_METHOD *DTLSv1_2_method(void); /* DTLSv1.2 */ const SSL_METHOD *DTLSv1_2_server_method(void); /* DTLSv1.2 */ const SSL_METHOD *DTLSv1_2_client_method(void); /* DTLSv1.2 */ const SSL_METHOD *DTLS_method(void); /* DTLS 1.0 and 1.2 */ const SSL_METHOD *DTLS_server_method(void); /* DTLS 1.0 and 1.2 */ const SSL_METHOD *DTLS_client_method(void); /* DTLS 1.0 and 1.2 */ STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s); int SSL_do_handshake(SSL *s); int SSL_renegotiate(SSL *s); int SSL_renegotiate_abbreviated(SSL *s); int SSL_renegotiate_pending(SSL *s); int SSL_shutdown(SSL *s); const SSL_METHOD *SSL_CTX_get_ssl_method(SSL_CTX *ctx); const SSL_METHOD *SSL_get_ssl_method(SSL *s); int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method); const char *SSL_alert_type_string_long(int value); const char *SSL_alert_type_string(int value); const char *SSL_alert_desc_string_long(int value); const char *SSL_alert_desc_string(int value); void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s); int SSL_add_client_CA(SSL *ssl, X509 *x); int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x); void SSL_set_connect_state(SSL *s); void SSL_set_accept_state(SSL *s); long SSL_get_default_timeout(const SSL *s); int SSL_library_init(void); char *SSL_CIPHER_description(const SSL_CIPHER *, char *buf, int size); STACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *sk); SSL *SSL_dup(SSL *ssl); X509 *SSL_get_certificate(const SSL *ssl); /* * EVP_PKEY */ struct evp_pkey_st *SSL_get_privatekey(const SSL *ssl); X509 *SSL_CTX_get0_certificate(const SSL_CTX *ctx); EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx); void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode); int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx); void SSL_set_quiet_shutdown(SSL *ssl, int mode); int SSL_get_quiet_shutdown(const SSL *ssl); void SSL_set_shutdown(SSL *ssl, int mode); int SSL_get_shutdown(const SSL *ssl); int SSL_version(const SSL *ssl); int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx); int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, const char *CApath); # define SSL_get0_session SSL_get_session/* just peek at pointer */ SSL_SESSION *SSL_get_session(const SSL *ssl); SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */ SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx); void SSL_set_info_callback(SSL *ssl, void (*cb) (const SSL *ssl, int type, int val)); void (*SSL_get_info_callback(const SSL *ssl)) (const SSL *ssl, int type, int val); int SSL_state(const SSL *ssl); void SSL_set_state(SSL *ssl, int state); void SSL_set_verify_result(SSL *ssl, long v); long SSL_get_verify_result(const SSL *ssl); int SSL_set_ex_data(SSL *ssl, int idx, void *data); void *SSL_get_ex_data(const SSL *ssl, int idx); int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int SSL_SESSION_set_ex_data(SSL_SESSION *ss, int idx, void *data); void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss, int idx); int SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int SSL_CTX_set_ex_data(SSL_CTX *ssl, int idx, void *data); void *SSL_CTX_get_ex_data(const SSL_CTX *ssl, int idx); int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int SSL_get_ex_data_X509_STORE_CTX_idx(void); # define SSL_CTX_sess_set_cache_size(ctx,t) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_SIZE,t,NULL) # define SSL_CTX_sess_get_cache_size(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_SIZE,0,NULL) # define SSL_CTX_set_session_cache_mode(ctx,m) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL) # define SSL_CTX_get_session_cache_mode(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL) # define SSL_CTX_get_default_read_ahead(ctx) SSL_CTX_get_read_ahead(ctx) # define SSL_CTX_set_default_read_ahead(ctx,m) SSL_CTX_set_read_ahead(ctx,m) # define SSL_CTX_get_read_ahead(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL) # define SSL_CTX_set_read_ahead(ctx,m) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL) # define SSL_CTX_get_max_cert_list(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) # define SSL_CTX_set_max_cert_list(ctx,m) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) # define SSL_get_max_cert_list(ssl) \ SSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) # define SSL_set_max_cert_list(ssl,m) \ SSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) # define SSL_CTX_set_max_send_fragment(ctx,m) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) # define SSL_set_max_send_fragment(ssl,m) \ SSL_ctrl(ssl,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) /* NB: the keylength is only applicable when is_export is true */ # ifndef OPENSSL_NO_RSA void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx, RSA *(*cb) (SSL *ssl, int is_export, int keylength)); void SSL_set_tmp_rsa_callback(SSL *ssl, RSA *(*cb) (SSL *ssl, int is_export, int keylength)); # endif # ifndef OPENSSL_NO_DH void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, DH *(*dh) (SSL *ssl, int is_export, int keylength)); void SSL_set_tmp_dh_callback(SSL *ssl, DH *(*dh) (SSL *ssl, int is_export, int keylength)); # endif # ifndef OPENSSL_NO_ECDH void SSL_CTX_set_tmp_ecdh_callback(SSL_CTX *ctx, EC_KEY *(*ecdh) (SSL *ssl, int is_export, int keylength)); void SSL_set_tmp_ecdh_callback(SSL *ssl, EC_KEY *(*ecdh) (SSL *ssl, int is_export, int keylength)); # endif const COMP_METHOD *SSL_get_current_compression(SSL *s); const COMP_METHOD *SSL_get_current_expansion(SSL *s); const char *SSL_COMP_get_name(const COMP_METHOD *comp); STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void); STACK_OF(SSL_COMP) *SSL_COMP_set0_compression_methods(STACK_OF(SSL_COMP) *meths); void SSL_COMP_free_compression_methods(void); int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm); const SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr); /* TLS extensions functions */ int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len); int SSL_set_session_ticket_ext_cb(SSL *s, tls_session_ticket_ext_cb_fn cb, void *arg); /* Pre-shared secret session resumption functions */ int SSL_set_session_secret_cb(SSL *s, tls_session_secret_cb_fn tls_session_secret_cb, void *arg); void SSL_set_debug(SSL *s, int debug); int SSL_cache_hit(SSL *s); int SSL_is_server(SSL *s); SSL_CONF_CTX *SSL_CONF_CTX_new(void); int SSL_CONF_CTX_finish(SSL_CONF_CTX *cctx); void SSL_CONF_CTX_free(SSL_CONF_CTX *cctx); unsigned int SSL_CONF_CTX_set_flags(SSL_CONF_CTX *cctx, unsigned int flags); unsigned int SSL_CONF_CTX_clear_flags(SSL_CONF_CTX *cctx, unsigned int flags); int SSL_CONF_CTX_set1_prefix(SSL_CONF_CTX *cctx, const char *pre); void SSL_CONF_CTX_set_ssl(SSL_CONF_CTX *cctx, SSL *ssl); void SSL_CONF_CTX_set_ssl_ctx(SSL_CONF_CTX *cctx, SSL_CTX *ctx); int SSL_CONF_cmd(SSL_CONF_CTX *cctx, const char *cmd, const char *value); int SSL_CONF_cmd_argv(SSL_CONF_CTX *cctx, int *pargc, char ***pargv); int SSL_CONF_cmd_value_type(SSL_CONF_CTX *cctx, const char *cmd); # ifndef OPENSSL_NO_SSL_TRACE void SSL_trace(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg); const char *SSL_CIPHER_standard_name(const SSL_CIPHER *c); # endif # ifndef OPENSSL_NO_UNIT_TEST const struct openssl_ssl_test_functions *SSL_test_functions(void); # endif /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_SSL_strings(void); /* Error codes for the SSL functions. */ /* Function codes. */ # define SSL_F_CHECK_SUITEB_CIPHER_LIST 331 # define SSL_F_CLIENT_CERTIFICATE 100 # define SSL_F_CLIENT_FINISHED 167 # define SSL_F_CLIENT_HELLO 101 # define SSL_F_CLIENT_MASTER_KEY 102 # define SSL_F_D2I_SSL_SESSION 103 # define SSL_F_DO_DTLS1_WRITE 245 # define SSL_F_DO_SSL3_WRITE 104 # define SSL_F_DTLS1_ACCEPT 246 # define SSL_F_DTLS1_ADD_CERT_TO_BUF 295 # define SSL_F_DTLS1_BUFFER_RECORD 247 # define SSL_F_DTLS1_CHECK_TIMEOUT_NUM 316 # define SSL_F_DTLS1_CLIENT_HELLO 248 # define SSL_F_DTLS1_CONNECT 249 # define SSL_F_DTLS1_ENC 250 # define SSL_F_DTLS1_GET_HELLO_VERIFY 251 # define SSL_F_DTLS1_GET_MESSAGE 252 # define SSL_F_DTLS1_GET_MESSAGE_FRAGMENT 253 # define SSL_F_DTLS1_GET_RECORD 254 # define SSL_F_DTLS1_HANDLE_TIMEOUT 297 # define SSL_F_DTLS1_HEARTBEAT 305 # define SSL_F_DTLS1_OUTPUT_CERT_CHAIN 255 # define SSL_F_DTLS1_PREPROCESS_FRAGMENT 288 # define SSL_F_DTLS1_PROCESS_BUFFERED_RECORDS 424 # define SSL_F_DTLS1_PROCESS_OUT_OF_SEQ_MESSAGE 256 # define SSL_F_DTLS1_PROCESS_RECORD 257 # define SSL_F_DTLS1_READ_BYTES 258 # define SSL_F_DTLS1_READ_FAILED 259 # define SSL_F_DTLS1_SEND_CERTIFICATE_REQUEST 260 # define SSL_F_DTLS1_SEND_CLIENT_CERTIFICATE 261 # define SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE 262 # define SSL_F_DTLS1_SEND_CLIENT_VERIFY 263 # define SSL_F_DTLS1_SEND_HELLO_VERIFY_REQUEST 264 # define SSL_F_DTLS1_SEND_SERVER_CERTIFICATE 265 # define SSL_F_DTLS1_SEND_SERVER_HELLO 266 # define SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE 267 # define SSL_F_DTLS1_WRITE_APP_DATA_BYTES 268 # define SSL_F_GET_CLIENT_FINISHED 105 # define SSL_F_GET_CLIENT_HELLO 106 # define SSL_F_GET_CLIENT_MASTER_KEY 107 # define SSL_F_GET_SERVER_FINISHED 108 # define SSL_F_GET_SERVER_HELLO 109 # define SSL_F_GET_SERVER_STATIC_DH_KEY 340 # define SSL_F_GET_SERVER_VERIFY 110 # define SSL_F_I2D_SSL_SESSION 111 # define SSL_F_READ_N 112 # define SSL_F_REQUEST_CERTIFICATE 113 # define SSL_F_SERVER_FINISH 239 # define SSL_F_SERVER_HELLO 114 # define SSL_F_SERVER_VERIFY 240 # define SSL_F_SSL23_ACCEPT 115 # define SSL_F_SSL23_CLIENT_HELLO 116 # define SSL_F_SSL23_CONNECT 117 # define SSL_F_SSL23_GET_CLIENT_HELLO 118 # define SSL_F_SSL23_GET_SERVER_HELLO 119 # define SSL_F_SSL23_PEEK 237 # define SSL_F_SSL23_READ 120 # define SSL_F_SSL23_WRITE 121 # define SSL_F_SSL2_ACCEPT 122 # define SSL_F_SSL2_CONNECT 123 # define SSL_F_SSL2_ENC_INIT 124 # define SSL_F_SSL2_GENERATE_KEY_MATERIAL 241 # define SSL_F_SSL2_PEEK 234 # define SSL_F_SSL2_READ 125 # define SSL_F_SSL2_READ_INTERNAL 236 # define SSL_F_SSL2_SET_CERTIFICATE 126 # define SSL_F_SSL2_WRITE 127 # define SSL_F_SSL3_ACCEPT 128 # define SSL_F_SSL3_ADD_CERT_TO_BUF 296 # define SSL_F_SSL3_CALLBACK_CTRL 233 # define SSL_F_SSL3_CHANGE_CIPHER_STATE 129 # define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM 130 # define SSL_F_SSL3_CHECK_CLIENT_HELLO 304 # define SSL_F_SSL3_CHECK_FINISHED 339 # define SSL_F_SSL3_CLIENT_HELLO 131 # define SSL_F_SSL3_CONNECT 132 # define SSL_F_SSL3_CTRL 213 # define SSL_F_SSL3_CTX_CTRL 133 # define SSL_F_SSL3_DIGEST_CACHED_RECORDS 293 # define SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC 292 # define SSL_F_SSL3_ENC 134 # define SSL_F_SSL3_GENERATE_KEY_BLOCK 238 # define SSL_F_SSL3_GENERATE_MASTER_SECRET 388 # define SSL_F_SSL3_GET_CERTIFICATE_REQUEST 135 # define SSL_F_SSL3_GET_CERT_STATUS 289 # define SSL_F_SSL3_GET_CERT_VERIFY 136 # define SSL_F_SSL3_GET_CLIENT_CERTIFICATE 137 # define SSL_F_SSL3_GET_CLIENT_HELLO 138 # define SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE 139 # define SSL_F_SSL3_GET_FINISHED 140 # define SSL_F_SSL3_GET_KEY_EXCHANGE 141 # define SSL_F_SSL3_GET_MESSAGE 142 # define SSL_F_SSL3_GET_NEW_SESSION_TICKET 283 # define SSL_F_SSL3_GET_NEXT_PROTO 306 # define SSL_F_SSL3_GET_RECORD 143 # define SSL_F_SSL3_GET_SERVER_CERTIFICATE 144 # define SSL_F_SSL3_GET_SERVER_DONE 145 # define SSL_F_SSL3_GET_SERVER_HELLO 146 # define SSL_F_SSL3_HANDSHAKE_MAC 285 # define SSL_F_SSL3_NEW_SESSION_TICKET 287 # define SSL_F_SSL3_OUTPUT_CERT_CHAIN 147 # define SSL_F_SSL3_PEEK 235 # define SSL_F_SSL3_READ_BYTES 148 # define SSL_F_SSL3_READ_N 149 # define SSL_F_SSL3_SEND_CERTIFICATE_REQUEST 150 # define SSL_F_SSL3_SEND_CLIENT_CERTIFICATE 151 # define SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE 152 # define SSL_F_SSL3_SEND_CLIENT_VERIFY 153 # define SSL_F_SSL3_SEND_SERVER_CERTIFICATE 154 # define SSL_F_SSL3_SEND_SERVER_HELLO 242 # define SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE 155 # define SSL_F_SSL3_SETUP_KEY_BLOCK 157 # define SSL_F_SSL3_SETUP_READ_BUFFER 156 # define SSL_F_SSL3_SETUP_WRITE_BUFFER 291 # define SSL_F_SSL3_WRITE_BYTES 158 # define SSL_F_SSL3_WRITE_PENDING 159 # define SSL_F_SSL_ADD_CERT_CHAIN 318 # define SSL_F_SSL_ADD_CERT_TO_BUF 319 # define SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT 298 # define SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT 277 # define SSL_F_SSL_ADD_CLIENTHELLO_USE_SRTP_EXT 307 # define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK 215 # define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK 216 # define SSL_F_SSL_ADD_SERVERHELLO_RENEGOTIATE_EXT 299 # define SSL_F_SSL_ADD_SERVERHELLO_TLSEXT 278 # define SSL_F_SSL_ADD_SERVERHELLO_USE_SRTP_EXT 308 # define SSL_F_SSL_BAD_METHOD 160 # define SSL_F_SSL_BUILD_CERT_CHAIN 332 # define SSL_F_SSL_BYTES_TO_CIPHER_LIST 161 # define SSL_F_SSL_CERT_DUP 221 # define SSL_F_SSL_CERT_INST 222 # define SSL_F_SSL_CERT_INSTANTIATE 214 # define SSL_F_SSL_CERT_NEW 162 # define SSL_F_SSL_CHECK_PRIVATE_KEY 163 # define SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT 280 # define SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG 279 # define SSL_F_SSL_CIPHER_PROCESS_RULESTR 230 # define SSL_F_SSL_CIPHER_STRENGTH_SORT 231 # define SSL_F_SSL_CLEAR 164 # define SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD 165 # define SSL_F_SSL_CONF_CMD 334 # define SSL_F_SSL_CREATE_CIPHER_LIST 166 # define SSL_F_SSL_CTRL 232 # define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY 168 # define SSL_F_SSL_CTX_MAKE_PROFILES 309 # define SSL_F_SSL_CTX_NEW 169 # define SSL_F_SSL_CTX_SET_CIPHER_LIST 269 # define SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE 290 # define SSL_F_SSL_CTX_SET_PURPOSE 226 # define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT 219 # define SSL_F_SSL_CTX_SET_SSL_VERSION 170 # define SSL_F_SSL_CTX_SET_TRUST 229 # define SSL_F_SSL_CTX_USE_CERTIFICATE 171 # define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1 172 # define SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE 220 # define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE 173 # define SSL_F_SSL_CTX_USE_PRIVATEKEY 174 # define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1 175 # define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE 176 # define SSL_F_SSL_CTX_USE_PSK_IDENTITY_HINT 272 # define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY 177 # define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1 178 # define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE 179 # define SSL_F_SSL_CTX_USE_SERVERINFO 336 # define SSL_F_SSL_CTX_USE_SERVERINFO_FILE 337 # define SSL_F_SSL_DO_HANDSHAKE 180 # define SSL_F_SSL_GET_NEW_SESSION 181 # define SSL_F_SSL_GET_PREV_SESSION 217 # define SSL_F_SSL_GET_SERVER_CERT_INDEX 322 # define SSL_F_SSL_GET_SERVER_SEND_CERT 182 # define SSL_F_SSL_GET_SERVER_SEND_PKEY 317 # define SSL_F_SSL_GET_SIGN_PKEY 183 # define SSL_F_SSL_INIT_WBIO_BUFFER 184 # define SSL_F_SSL_LOAD_CLIENT_CA_FILE 185 # define SSL_F_SSL_NEW 186 # define SSL_F_SSL_PARSE_CLIENTHELLO_RENEGOTIATE_EXT 300 # define SSL_F_SSL_PARSE_CLIENTHELLO_TLSEXT 302 # define SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT 310 # define SSL_F_SSL_PARSE_SERVERHELLO_RENEGOTIATE_EXT 301 # define SSL_F_SSL_PARSE_SERVERHELLO_TLSEXT 303 # define SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT 311 # define SSL_F_SSL_PEEK 270 # define SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT 281 # define SSL_F_SSL_PREPARE_SERVERHELLO_TLSEXT 282 # define SSL_F_SSL_READ 223 # define SSL_F_SSL_RSA_PRIVATE_DECRYPT 187 # define SSL_F_SSL_RSA_PUBLIC_ENCRYPT 188 # define SSL_F_SSL_SCAN_CLIENTHELLO_TLSEXT 320 # define SSL_F_SSL_SCAN_SERVERHELLO_TLSEXT 321 # define SSL_F_SSL_SESSION_DUP 348 # define SSL_F_SSL_SESSION_NEW 189 # define SSL_F_SSL_SESSION_PRINT_FP 190 # define SSL_F_SSL_SESSION_SET1_ID_CONTEXT 312 # define SSL_F_SSL_SESS_CERT_NEW 225 # define SSL_F_SSL_SET_CERT 191 # define SSL_F_SSL_SET_CIPHER_LIST 271 # define SSL_F_SSL_SET_FD 192 # define SSL_F_SSL_SET_PKEY 193 # define SSL_F_SSL_SET_PURPOSE 227 # define SSL_F_SSL_SET_RFD 194 # define SSL_F_SSL_SET_SESSION 195 # define SSL_F_SSL_SET_SESSION_ID_CONTEXT 218 # define SSL_F_SSL_SET_SESSION_TICKET_EXT 294 # define SSL_F_SSL_SET_TRUST 228 # define SSL_F_SSL_SET_WFD 196 # define SSL_F_SSL_SHUTDOWN 224 # define SSL_F_SSL_SRP_CTX_INIT 313 # define SSL_F_SSL_UNDEFINED_CONST_FUNCTION 243 # define SSL_F_SSL_UNDEFINED_FUNCTION 197 # define SSL_F_SSL_UNDEFINED_VOID_FUNCTION 244 # define SSL_F_SSL_USE_CERTIFICATE 198 # define SSL_F_SSL_USE_CERTIFICATE_ASN1 199 # define SSL_F_SSL_USE_CERTIFICATE_FILE 200 # define SSL_F_SSL_USE_PRIVATEKEY 201 # define SSL_F_SSL_USE_PRIVATEKEY_ASN1 202 # define SSL_F_SSL_USE_PRIVATEKEY_FILE 203 # define SSL_F_SSL_USE_PSK_IDENTITY_HINT 273 # define SSL_F_SSL_USE_RSAPRIVATEKEY 204 # define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1 205 # define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE 206 # define SSL_F_SSL_VERIFY_CERT_CHAIN 207 # define SSL_F_SSL_WRITE 208 # define SSL_F_TLS12_CHECK_PEER_SIGALG 333 # define SSL_F_TLS1_CERT_VERIFY_MAC 286 # define SSL_F_TLS1_CHANGE_CIPHER_STATE 209 # define SSL_F_TLS1_CHECK_SERVERHELLO_TLSEXT 274 # define SSL_F_TLS1_ENC 210 # define SSL_F_TLS1_EXPORT_KEYING_MATERIAL 314 # define SSL_F_TLS1_GET_CURVELIST 338 # define SSL_F_TLS1_HEARTBEAT 315 # define SSL_F_TLS1_PREPARE_CLIENTHELLO_TLSEXT 275 # define SSL_F_TLS1_PREPARE_SERVERHELLO_TLSEXT 276 # define SSL_F_TLS1_PRF 284 # define SSL_F_TLS1_SETUP_KEY_BLOCK 211 # define SSL_F_TLS1_SET_SERVER_SIGALGS 335 # define SSL_F_WRITE_PENDING 212 /* Reason codes. */ # define SSL_R_APP_DATA_IN_HANDSHAKE 100 # define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 272 # define SSL_R_BAD_ALERT_RECORD 101 # define SSL_R_BAD_AUTHENTICATION_TYPE 102 # define SSL_R_BAD_CHANGE_CIPHER_SPEC 103 # define SSL_R_BAD_CHECKSUM 104 # define SSL_R_BAD_DATA 390 # define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK 106 # define SSL_R_BAD_DECOMPRESSION 107 # define SSL_R_BAD_DH_G_LENGTH 108 # define SSL_R_BAD_DH_G_VALUE 375 # define SSL_R_BAD_DH_PUB_KEY_LENGTH 109 # define SSL_R_BAD_DH_PUB_KEY_VALUE 393 # define SSL_R_BAD_DH_P_LENGTH 110 # define SSL_R_BAD_DH_P_VALUE 395 # define SSL_R_BAD_DIGEST_LENGTH 111 # define SSL_R_BAD_DSA_SIGNATURE 112 # define SSL_R_BAD_ECC_CERT 304 # define SSL_R_BAD_ECDSA_SIGNATURE 305 # define SSL_R_BAD_ECPOINT 306 # define SSL_R_BAD_HANDSHAKE_LENGTH 332 # define SSL_R_BAD_HELLO_REQUEST 105 # define SSL_R_BAD_LENGTH 271 # define SSL_R_BAD_MAC_DECODE 113 # define SSL_R_BAD_MAC_LENGTH 333 # define SSL_R_BAD_MESSAGE_TYPE 114 # define SSL_R_BAD_PACKET_LENGTH 115 # define SSL_R_BAD_PROTOCOL_VERSION_NUMBER 116 # define SSL_R_BAD_PSK_IDENTITY_HINT_LENGTH 316 # define SSL_R_BAD_RESPONSE_ARGUMENT 117 # define SSL_R_BAD_RSA_DECRYPT 118 # define SSL_R_BAD_RSA_ENCRYPT 119 # define SSL_R_BAD_RSA_E_LENGTH 120 # define SSL_R_BAD_RSA_MODULUS_LENGTH 121 # define SSL_R_BAD_RSA_SIGNATURE 122 # define SSL_R_BAD_SIGNATURE 123 # define SSL_R_BAD_SRP_A_LENGTH 347 # define SSL_R_BAD_SRP_B_LENGTH 348 # define SSL_R_BAD_SRP_G_LENGTH 349 # define SSL_R_BAD_SRP_N_LENGTH 350 # define SSL_R_BAD_SRP_PARAMETERS 371 # define SSL_R_BAD_SRP_S_LENGTH 351 # define SSL_R_BAD_SRTP_MKI_VALUE 352 # define SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST 353 # define SSL_R_BAD_SSL_FILETYPE 124 # define SSL_R_BAD_SSL_SESSION_ID_LENGTH 125 # define SSL_R_BAD_STATE 126 # define SSL_R_BAD_VALUE 384 # define SSL_R_BAD_WRITE_RETRY 127 # define SSL_R_BIO_NOT_SET 128 # define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG 129 # define SSL_R_BN_LIB 130 # define SSL_R_CA_DN_LENGTH_MISMATCH 131 # define SSL_R_CA_DN_TOO_LONG 132 # define SSL_R_CCS_RECEIVED_EARLY 133 # define SSL_R_CERTIFICATE_VERIFY_FAILED 134 # define SSL_R_CERT_CB_ERROR 377 # define SSL_R_CERT_LENGTH_MISMATCH 135 # define SSL_R_CHALLENGE_IS_DIFFERENT 136 # define SSL_R_CIPHER_CODE_WRONG_LENGTH 137 # define SSL_R_CIPHER_OR_HASH_UNAVAILABLE 138 # define SSL_R_CIPHER_TABLE_SRC_ERROR 139 # define SSL_R_CLIENTHELLO_TLSEXT 226 # define SSL_R_COMPRESSED_LENGTH_TOO_LONG 140 # define SSL_R_COMPRESSION_DISABLED 343 # define SSL_R_COMPRESSION_FAILURE 141 # define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE 307 # define SSL_R_COMPRESSION_LIBRARY_ERROR 142 # define SSL_R_CONNECTION_ID_IS_DIFFERENT 143 # define SSL_R_CONNECTION_TYPE_NOT_SET 144 # define SSL_R_COOKIE_MISMATCH 308 # define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED 145 # define SSL_R_DATA_LENGTH_TOO_LONG 146 # define SSL_R_DECRYPTION_FAILED 147 # define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC 281 # define SSL_R_DH_KEY_TOO_SMALL 372 # define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 148 # define SSL_R_DIGEST_CHECK_FAILED 149 # define SSL_R_DTLS_MESSAGE_TOO_BIG 334 # define SSL_R_DUPLICATE_COMPRESSION_ID 309 # define SSL_R_ECC_CERT_NOT_FOR_KEY_AGREEMENT 317 # define SSL_R_ECC_CERT_NOT_FOR_SIGNING 318 # define SSL_R_ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE 322 # define SSL_R_ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE 323 # define SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE 374 # define SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER 310 # define SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST 354 # define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 150 # define SSL_R_ERROR_GENERATING_TMP_RSA_KEY 282 # define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST 151 # define SSL_R_EXCESSIVE_MESSAGE_SIZE 152 # define SSL_R_EXTRA_DATA_IN_MESSAGE 153 # define SSL_R_GOT_A_FIN_BEFORE_A_CCS 154 # define SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS 355 # define SSL_R_GOT_NEXT_PROTO_WITHOUT_EXTENSION 356 # define SSL_R_HTTPS_PROXY_REQUEST 155 # define SSL_R_HTTP_REQUEST 156 # define SSL_R_ILLEGAL_PADDING 283 # define SSL_R_ILLEGAL_SUITEB_DIGEST 380 # define SSL_R_INAPPROPRIATE_FALLBACK 373 # define SSL_R_INCONSISTENT_COMPRESSION 340 # define SSL_R_INVALID_CHALLENGE_LENGTH 158 # define SSL_R_INVALID_COMMAND 280 # define SSL_R_INVALID_COMPRESSION_ALGORITHM 341 # define SSL_R_INVALID_NULL_CMD_NAME 385 # define SSL_R_INVALID_PURPOSE 278 # define SSL_R_INVALID_SERVERINFO_DATA 388 # define SSL_R_INVALID_SRP_USERNAME 357 # define SSL_R_INVALID_STATUS_RESPONSE 328 # define SSL_R_INVALID_TICKET_KEYS_LENGTH 325 # define SSL_R_INVALID_TRUST 279 # define SSL_R_KEY_ARG_TOO_LONG 284 # define SSL_R_KRB5 285 # define SSL_R_KRB5_C_CC_PRINC 286 # define SSL_R_KRB5_C_GET_CRED 287 # define SSL_R_KRB5_C_INIT 288 # define SSL_R_KRB5_C_MK_REQ 289 # define SSL_R_KRB5_S_BAD_TICKET 290 # define SSL_R_KRB5_S_INIT 291 # define SSL_R_KRB5_S_RD_REQ 292 # define SSL_R_KRB5_S_TKT_EXPIRED 293 # define SSL_R_KRB5_S_TKT_NYV 294 # define SSL_R_KRB5_S_TKT_SKEW 295 # define SSL_R_LENGTH_MISMATCH 159 # define SSL_R_LENGTH_TOO_SHORT 160 # define SSL_R_LIBRARY_BUG 274 # define SSL_R_LIBRARY_HAS_NO_CIPHERS 161 # define SSL_R_MESSAGE_TOO_LONG 296 # define SSL_R_MISSING_DH_DSA_CERT 162 # define SSL_R_MISSING_DH_KEY 163 # define SSL_R_MISSING_DH_RSA_CERT 164 # define SSL_R_MISSING_DSA_SIGNING_CERT 165 # define SSL_R_MISSING_ECDH_CERT 382 # define SSL_R_MISSING_ECDSA_SIGNING_CERT 381 # define SSL_R_MISSING_EXPORT_TMP_DH_KEY 166 # define SSL_R_MISSING_EXPORT_TMP_RSA_KEY 167 # define SSL_R_MISSING_RSA_CERTIFICATE 168 # define SSL_R_MISSING_RSA_ENCRYPTING_CERT 169 # define SSL_R_MISSING_RSA_SIGNING_CERT 170 # define SSL_R_MISSING_SRP_PARAM 358 # define SSL_R_MISSING_TMP_DH_KEY 171 # define SSL_R_MISSING_TMP_ECDH_KEY 311 # define SSL_R_MISSING_TMP_RSA_KEY 172 # define SSL_R_MISSING_TMP_RSA_PKEY 173 # define SSL_R_MISSING_VERIFY_MESSAGE 174 # define SSL_R_MULTIPLE_SGC_RESTARTS 346 # define SSL_R_NON_SSLV2_INITIAL_PACKET 175 # define SSL_R_NO_CERTIFICATES_RETURNED 176 # define SSL_R_NO_CERTIFICATE_ASSIGNED 177 # define SSL_R_NO_CERTIFICATE_RETURNED 178 # define SSL_R_NO_CERTIFICATE_SET 179 # define SSL_R_NO_CERTIFICATE_SPECIFIED 180 # define SSL_R_NO_CIPHERS_AVAILABLE 181 # define SSL_R_NO_CIPHERS_PASSED 182 # define SSL_R_NO_CIPHERS_SPECIFIED 183 # define SSL_R_NO_CIPHER_LIST 184 # define SSL_R_NO_CIPHER_MATCH 185 # define SSL_R_NO_CLIENT_CERT_METHOD 331 # define SSL_R_NO_CLIENT_CERT_RECEIVED 186 # define SSL_R_NO_COMPRESSION_SPECIFIED 187 # define SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER 330 # define SSL_R_NO_METHOD_SPECIFIED 188 # define SSL_R_NO_PEM_EXTENSIONS 389 # define SSL_R_NO_PRIVATEKEY 189 # define SSL_R_NO_PRIVATE_KEY_ASSIGNED 190 # define SSL_R_NO_PROTOCOLS_AVAILABLE 191 # define SSL_R_NO_PUBLICKEY 192 # define SSL_R_NO_RENEGOTIATION 339 # define SSL_R_NO_REQUIRED_DIGEST 324 # define SSL_R_NO_SHARED_CIPHER 193 # define SSL_R_NO_SHARED_SIGATURE_ALGORITHMS 376 # define SSL_R_NO_SRTP_PROFILES 359 # define SSL_R_NO_VERIFY_CALLBACK 194 # define SSL_R_NULL_SSL_CTX 195 # define SSL_R_NULL_SSL_METHOD_PASSED 196 # define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197 # define SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED 344 # define SSL_R_ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE 387 # define SSL_R_ONLY_TLS_1_2_ALLOWED_IN_SUITEB_MODE 379 # define SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE 297 # define SSL_R_OPAQUE_PRF_INPUT_TOO_LONG 327 # define SSL_R_PACKET_LENGTH_TOO_LONG 198 # define SSL_R_PARSE_TLSEXT 227 # define SSL_R_PATH_TOO_LONG 270 # define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 199 # define SSL_R_PEER_ERROR 200 # define SSL_R_PEER_ERROR_CERTIFICATE 201 # define SSL_R_PEER_ERROR_NO_CERTIFICATE 202 # define SSL_R_PEER_ERROR_NO_CIPHER 203 # define SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE 204 # define SSL_R_PEM_NAME_BAD_PREFIX 391 # define SSL_R_PEM_NAME_TOO_SHORT 392 # define SSL_R_PRE_MAC_LENGTH_TOO_LONG 205 # define SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS 206 # define SSL_R_PROTOCOL_IS_SHUTDOWN 207 # define SSL_R_PSK_IDENTITY_NOT_FOUND 223 # define SSL_R_PSK_NO_CLIENT_CB 224 # define SSL_R_PSK_NO_SERVER_CB 225 # define SSL_R_PUBLIC_KEY_ENCRYPT_ERROR 208 # define SSL_R_PUBLIC_KEY_IS_NOT_RSA 209 # define SSL_R_PUBLIC_KEY_NOT_RSA 210 # define SSL_R_READ_BIO_NOT_SET 211 # define SSL_R_READ_TIMEOUT_EXPIRED 312 # define SSL_R_READ_WRONG_PACKET_TYPE 212 # define SSL_R_RECORD_LENGTH_MISMATCH 213 # define SSL_R_RECORD_TOO_LARGE 214 # define SSL_R_RECORD_TOO_SMALL 298 # define SSL_R_RENEGOTIATE_EXT_TOO_LONG 335 # define SSL_R_RENEGOTIATION_ENCODING_ERR 336 # define SSL_R_RENEGOTIATION_MISMATCH 337 # define SSL_R_REQUIRED_CIPHER_MISSING 215 # define SSL_R_REQUIRED_COMPRESSSION_ALGORITHM_MISSING 342 # define SSL_R_REUSE_CERT_LENGTH_NOT_ZERO 216 # define SSL_R_REUSE_CERT_TYPE_NOT_ZERO 217 # define SSL_R_REUSE_CIPHER_LIST_NOT_ZERO 218 # define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING 345 # define SSL_R_SERVERHELLO_TLSEXT 275 # define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 277 # define SSL_R_SHORT_READ 219 # define SSL_R_SHUTDOWN_WHILE_IN_INIT 407 # define SSL_R_SIGNATURE_ALGORITHMS_ERROR 360 # define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220 # define SSL_R_SRP_A_CALC 361 # define SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES 362 # define SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG 363 # define SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE 364 # define SSL_R_SSL23_DOING_SESSION_ID_REUSE 221 # define SSL_R_SSL2_CONNECTION_ID_TOO_LONG 299 # define SSL_R_SSL3_EXT_INVALID_ECPOINTFORMAT 321 # define SSL_R_SSL3_EXT_INVALID_SERVERNAME 319 # define SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE 320 # define SSL_R_SSL3_SESSION_ID_TOO_LONG 300 # define SSL_R_SSL3_SESSION_ID_TOO_SHORT 222 # define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 # define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 # define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045 # define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044 # define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046 # define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030 # define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040 # define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047 # define SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041 # define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010 # define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043 # define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 228 # define SSL_R_SSL_HANDSHAKE_FAILURE 229 # define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS 230 # define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED 301 # define SSL_R_SSL_SESSION_ID_CONFLICT 302 # define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 273 # define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 303 # define SSL_R_SSL_SESSION_ID_IS_DIFFERENT 231 # define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049 # define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050 # define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021 # define SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051 # define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060 # define SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK 1086 # define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 # define SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 # define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 # define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070 # define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022 # define SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048 # define SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 # define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114 # define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113 # define SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE 1111 # define SSL_R_TLSV1_UNRECOGNIZED_NAME 1112 # define SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110 # define SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER 232 # define SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT 365 # define SSL_R_TLS_HEARTBEAT_PENDING 366 # define SSL_R_TLS_ILLEGAL_EXPORTER_LABEL 367 # define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 157 # define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 233 # define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG 234 # define SSL_R_TOO_MANY_WARN_ALERTS 409 # define SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER 235 # define SSL_R_UNABLE_TO_DECODE_DH_CERTS 236 # define SSL_R_UNABLE_TO_DECODE_ECDH_CERTS 313 # define SSL_R_UNABLE_TO_EXTRACT_PUBLIC_KEY 237 # define SSL_R_UNABLE_TO_FIND_DH_PARAMETERS 238 # define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS 314 # define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS 239 # define SSL_R_UNABLE_TO_FIND_SSL_METHOD 240 # define SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES 241 # define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES 242 # define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES 243 # define SSL_R_UNEXPECTED_MESSAGE 244 # define SSL_R_UNEXPECTED_RECORD 245 # define SSL_R_UNINITIALIZED 276 # define SSL_R_UNKNOWN_ALERT_TYPE 246 # define SSL_R_UNKNOWN_CERTIFICATE_TYPE 247 # define SSL_R_UNKNOWN_CIPHER_RETURNED 248 # define SSL_R_UNKNOWN_CIPHER_TYPE 249 # define SSL_R_UNKNOWN_CMD_NAME 386 # define SSL_R_UNKNOWN_DIGEST 368 # define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE 250 # define SSL_R_UNKNOWN_PKEY_TYPE 251 # define SSL_R_UNKNOWN_PROTOCOL 252 # define SSL_R_UNKNOWN_REMOTE_ERROR_TYPE 253 # define SSL_R_UNKNOWN_SSL_VERSION 254 # define SSL_R_UNKNOWN_STATE 255 # define SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED 338 # define SSL_R_UNSUPPORTED_CIPHER 256 # define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM 257 # define SSL_R_UNSUPPORTED_DIGEST_TYPE 326 # define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE 315 # define SSL_R_UNSUPPORTED_PROTOCOL 258 # define SSL_R_UNSUPPORTED_SSL_VERSION 259 # define SSL_R_UNSUPPORTED_STATUS_TYPE 329 # define SSL_R_USE_SRTP_NOT_NEGOTIATED 369 # define SSL_R_WRITE_BIO_NOT_SET 260 # define SSL_R_WRONG_CERTIFICATE_TYPE 383 # define SSL_R_WRONG_CIPHER_RETURNED 261 # define SSL_R_WRONG_CURVE 378 # define SSL_R_WRONG_MESSAGE_TYPE 262 # define SSL_R_WRONG_NUMBER_OF_KEY_BITS 263 # define SSL_R_WRONG_SIGNATURE_LENGTH 264 # define SSL_R_WRONG_SIGNATURE_SIZE 265 # define SSL_R_WRONG_SIGNATURE_TYPE 370 # define SSL_R_WRONG_SSL_VERSION 266 # define SSL_R_WRONG_VERSION_NUMBER 267 # define SSL_R_X509_LIB 268 # define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS 269 #ifdef __cplusplus } #endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/stack.h�������������������������������������������������������������������������������������0000644�����������������00000010664�14763166030�0007522 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/stack/stack.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_STACK_H # define HEADER_STACK_H #ifdef __cplusplus extern "C" { #endif typedef struct stack_st { int num; char **data; int sorted; int num_alloc; int (*comp) (const void *, const void *); } _STACK; /* Use STACK_OF(...) instead */ # define M_sk_num(sk) ((sk) ? (sk)->num:-1) # define M_sk_value(sk,n) ((sk) ? (sk)->data[n] : NULL) int sk_num(const _STACK *); void *sk_value(const _STACK *, int); void *sk_set(_STACK *, int, void *); _STACK *sk_new(int (*cmp) (const void *, const void *)); _STACK *sk_new_null(void); void sk_free(_STACK *); void sk_pop_free(_STACK *st, void (*func) (void *)); _STACK *sk_deep_copy(_STACK *, void *(*)(void *), void (*)(void *)); int sk_insert(_STACK *sk, void *data, int where); void *sk_delete(_STACK *st, int loc); void *sk_delete_ptr(_STACK *st, void *p); int sk_find(_STACK *st, void *data); int sk_find_ex(_STACK *st, void *data); int sk_push(_STACK *st, void *data); int sk_unshift(_STACK *st, void *data); void *sk_shift(_STACK *st); void *sk_pop(_STACK *st); void sk_zero(_STACK *st); int (*sk_set_cmp_func(_STACK *sk, int (*c) (const void *, const void *))) (const void *, const void *); _STACK *sk_dup(_STACK *st); void sk_sort(_STACK *st); int sk_is_sorted(const _STACK *st); #ifdef __cplusplus } #endif #endif ����������������������������������������������������������������������������openssl/opensslconf.h�������������������������������������������������������������������������������0000644�����������������00000003055�14763166030�0010742 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* This file is here to prevent a file conflict on multiarch systems. A * conflict will frequently occur because arch-specific build-time * configuration options are stored (and used, so they can't just be stripped * out) in opensslconf.h. The original opensslconf.h has been renamed. * DO NOT INCLUDE THE NEW FILE DIRECTLY -- ALWAYS INCLUDE THIS ONE INSTEAD. */ #ifdef openssl_opensslconf_multilib_redirection_h #error "Do not define openssl_opensslconf_multilib_redirection_h!" #endif #define openssl_opensslconf_multilib_redirection_h #if defined(__i386__) #include "opensslconf-i386.h" #elif defined(__ia64__) #include "opensslconf-ia64.h" #elif defined(__mips64) && defined(__MIPSEL__) #include "opensslconf-mips64el.h" #elif defined(__mips64) #include "opensslconf-mips64.h" #elif defined(__mips) && defined(__MIPSEL__) #include "opensslconf-mipsel.h" #elif defined(__mips) #include "opensslconf-mips.h" #elif defined(__powerpc64__) #include <endian.h> #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ #include "opensslconf-ppc64.h" #else #include "opensslconf-ppc64le.h" #endif #elif defined(__powerpc__) #include "opensslconf-ppc.h" #elif defined(__s390x__) #include "opensslconf-s390x.h" #elif defined(__s390__) #include "opensslconf-s390.h" #elif defined(__sparc__) && defined(__arch64__) #include "opensslconf-sparc64.h" #elif defined(__sparc__) #include "opensslconf-sparc.h" #elif defined(__x86_64__) #include "opensslconf-x86_64.h" #else #error "This openssl-devel package does not work your architecture?" #endif #undef openssl_opensslconf_multilib_redirection_h �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/ocsp.h��������������������������������������������������������������������������������������0000644�����������������00000065013�14763166030�0007357 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ocsp.h */ /* * Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL * project. */ /* * History: This file was transfered to Richard Levitte from CertCo by Kathy * Weinhold in mid-spring 2000 to be included in OpenSSL or released as a * patch kit. */ /* ==================================================================== * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_OCSP_H # define HEADER_OCSP_H # include <openssl/ossl_typ.h> # include <openssl/x509.h> # include <openssl/x509v3.h> # include <openssl/safestack.h> #ifdef __cplusplus extern "C" { #endif /* Various flags and values */ # define OCSP_DEFAULT_NONCE_LENGTH 16 # define OCSP_NOCERTS 0x1 # define OCSP_NOINTERN 0x2 # define OCSP_NOSIGS 0x4 # define OCSP_NOCHAIN 0x8 # define OCSP_NOVERIFY 0x10 # define OCSP_NOEXPLICIT 0x20 # define OCSP_NOCASIGN 0x40 # define OCSP_NODELEGATED 0x80 # define OCSP_NOCHECKS 0x100 # define OCSP_TRUSTOTHER 0x200 # define OCSP_RESPID_KEY 0x400 # define OCSP_NOTIME 0x800 /*- CertID ::= SEQUENCE { * hashAlgorithm AlgorithmIdentifier, * issuerNameHash OCTET STRING, -- Hash of Issuer's DN * issuerKeyHash OCTET STRING, -- Hash of Issuers public key (excluding the tag & length fields) * serialNumber CertificateSerialNumber } */ typedef struct ocsp_cert_id_st { X509_ALGOR *hashAlgorithm; ASN1_OCTET_STRING *issuerNameHash; ASN1_OCTET_STRING *issuerKeyHash; ASN1_INTEGER *serialNumber; } OCSP_CERTID; DECLARE_STACK_OF(OCSP_CERTID) /*- Request ::= SEQUENCE { * reqCert CertID, * singleRequestExtensions [0] EXPLICIT Extensions OPTIONAL } */ typedef struct ocsp_one_request_st { OCSP_CERTID *reqCert; STACK_OF(X509_EXTENSION) *singleRequestExtensions; } OCSP_ONEREQ; DECLARE_STACK_OF(OCSP_ONEREQ) DECLARE_ASN1_SET_OF(OCSP_ONEREQ) /*- TBSRequest ::= SEQUENCE { * version [0] EXPLICIT Version DEFAULT v1, * requestorName [1] EXPLICIT GeneralName OPTIONAL, * requestList SEQUENCE OF Request, * requestExtensions [2] EXPLICIT Extensions OPTIONAL } */ typedef struct ocsp_req_info_st { ASN1_INTEGER *version; GENERAL_NAME *requestorName; STACK_OF(OCSP_ONEREQ) *requestList; STACK_OF(X509_EXTENSION) *requestExtensions; } OCSP_REQINFO; /*- Signature ::= SEQUENCE { * signatureAlgorithm AlgorithmIdentifier, * signature BIT STRING, * certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL } */ typedef struct ocsp_signature_st { X509_ALGOR *signatureAlgorithm; ASN1_BIT_STRING *signature; STACK_OF(X509) *certs; } OCSP_SIGNATURE; /*- OCSPRequest ::= SEQUENCE { * tbsRequest TBSRequest, * optionalSignature [0] EXPLICIT Signature OPTIONAL } */ typedef struct ocsp_request_st { OCSP_REQINFO *tbsRequest; OCSP_SIGNATURE *optionalSignature; /* OPTIONAL */ } OCSP_REQUEST; /*- OCSPResponseStatus ::= ENUMERATED { * successful (0), --Response has valid confirmations * malformedRequest (1), --Illegal confirmation request * internalError (2), --Internal error in issuer * tryLater (3), --Try again later * --(4) is not used * sigRequired (5), --Must sign the request * unauthorized (6) --Request unauthorized * } */ # define OCSP_RESPONSE_STATUS_SUCCESSFUL 0 # define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST 1 # define OCSP_RESPONSE_STATUS_INTERNALERROR 2 # define OCSP_RESPONSE_STATUS_TRYLATER 3 # define OCSP_RESPONSE_STATUS_SIGREQUIRED 5 # define OCSP_RESPONSE_STATUS_UNAUTHORIZED 6 /*- ResponseBytes ::= SEQUENCE { * responseType OBJECT IDENTIFIER, * response OCTET STRING } */ typedef struct ocsp_resp_bytes_st { ASN1_OBJECT *responseType; ASN1_OCTET_STRING *response; } OCSP_RESPBYTES; /*- OCSPResponse ::= SEQUENCE { * responseStatus OCSPResponseStatus, * responseBytes [0] EXPLICIT ResponseBytes OPTIONAL } */ struct ocsp_response_st { ASN1_ENUMERATED *responseStatus; OCSP_RESPBYTES *responseBytes; }; /*- ResponderID ::= CHOICE { * byName [1] Name, * byKey [2] KeyHash } */ # define V_OCSP_RESPID_NAME 0 # define V_OCSP_RESPID_KEY 1 struct ocsp_responder_id_st { int type; union { X509_NAME *byName; ASN1_OCTET_STRING *byKey; } value; }; DECLARE_STACK_OF(OCSP_RESPID) DECLARE_ASN1_FUNCTIONS(OCSP_RESPID) /*- KeyHash ::= OCTET STRING --SHA-1 hash of responder's public key * --(excluding the tag and length fields) */ /*- RevokedInfo ::= SEQUENCE { * revocationTime GeneralizedTime, * revocationReason [0] EXPLICIT CRLReason OPTIONAL } */ typedef struct ocsp_revoked_info_st { ASN1_GENERALIZEDTIME *revocationTime; ASN1_ENUMERATED *revocationReason; } OCSP_REVOKEDINFO; /*- CertStatus ::= CHOICE { * good [0] IMPLICIT NULL, * revoked [1] IMPLICIT RevokedInfo, * unknown [2] IMPLICIT UnknownInfo } */ # define V_OCSP_CERTSTATUS_GOOD 0 # define V_OCSP_CERTSTATUS_REVOKED 1 # define V_OCSP_CERTSTATUS_UNKNOWN 2 typedef struct ocsp_cert_status_st { int type; union { ASN1_NULL *good; OCSP_REVOKEDINFO *revoked; ASN1_NULL *unknown; } value; } OCSP_CERTSTATUS; /*- SingleResponse ::= SEQUENCE { * certID CertID, * certStatus CertStatus, * thisUpdate GeneralizedTime, * nextUpdate [0] EXPLICIT GeneralizedTime OPTIONAL, * singleExtensions [1] EXPLICIT Extensions OPTIONAL } */ typedef struct ocsp_single_response_st { OCSP_CERTID *certId; OCSP_CERTSTATUS *certStatus; ASN1_GENERALIZEDTIME *thisUpdate; ASN1_GENERALIZEDTIME *nextUpdate; STACK_OF(X509_EXTENSION) *singleExtensions; } OCSP_SINGLERESP; DECLARE_STACK_OF(OCSP_SINGLERESP) DECLARE_ASN1_SET_OF(OCSP_SINGLERESP) /*- ResponseData ::= SEQUENCE { * version [0] EXPLICIT Version DEFAULT v1, * responderID ResponderID, * producedAt GeneralizedTime, * responses SEQUENCE OF SingleResponse, * responseExtensions [1] EXPLICIT Extensions OPTIONAL } */ typedef struct ocsp_response_data_st { ASN1_INTEGER *version; OCSP_RESPID *responderId; ASN1_GENERALIZEDTIME *producedAt; STACK_OF(OCSP_SINGLERESP) *responses; STACK_OF(X509_EXTENSION) *responseExtensions; } OCSP_RESPDATA; /*- BasicOCSPResponse ::= SEQUENCE { * tbsResponseData ResponseData, * signatureAlgorithm AlgorithmIdentifier, * signature BIT STRING, * certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL } */ /* * Note 1: The value for "signature" is specified in the OCSP rfc2560 as * follows: "The value for the signature SHALL be computed on the hash of * the DER encoding ResponseData." This means that you must hash the * DER-encoded tbsResponseData, and then run it through a crypto-signing * function, which will (at least w/RSA) do a hash-'n'-private-encrypt * operation. This seems a bit odd, but that's the spec. Also note that * the data structures do not leave anywhere to independently specify the * algorithm used for the initial hash. So, we look at the * signature-specification algorithm, and try to do something intelligent. * -- Kathy Weinhold, CertCo */ /* * Note 2: It seems that the mentioned passage from RFC 2560 (section * 4.2.1) is open for interpretation. I've done tests against another * responder, and found that it doesn't do the double hashing that the RFC * seems to say one should. Therefore, all relevant functions take a flag * saying which variant should be used. -- Richard Levitte, OpenSSL team * and CeloCom */ typedef struct ocsp_basic_response_st { OCSP_RESPDATA *tbsResponseData; X509_ALGOR *signatureAlgorithm; ASN1_BIT_STRING *signature; STACK_OF(X509) *certs; } OCSP_BASICRESP; /*- * CRLReason ::= ENUMERATED { * unspecified (0), * keyCompromise (1), * cACompromise (2), * affiliationChanged (3), * superseded (4), * cessationOfOperation (5), * certificateHold (6), * removeFromCRL (8) } */ # define OCSP_REVOKED_STATUS_NOSTATUS -1 # define OCSP_REVOKED_STATUS_UNSPECIFIED 0 # define OCSP_REVOKED_STATUS_KEYCOMPROMISE 1 # define OCSP_REVOKED_STATUS_CACOMPROMISE 2 # define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED 3 # define OCSP_REVOKED_STATUS_SUPERSEDED 4 # define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION 5 # define OCSP_REVOKED_STATUS_CERTIFICATEHOLD 6 # define OCSP_REVOKED_STATUS_REMOVEFROMCRL 8 /*- * CrlID ::= SEQUENCE { * crlUrl [0] EXPLICIT IA5String OPTIONAL, * crlNum [1] EXPLICIT INTEGER OPTIONAL, * crlTime [2] EXPLICIT GeneralizedTime OPTIONAL } */ typedef struct ocsp_crl_id_st { ASN1_IA5STRING *crlUrl; ASN1_INTEGER *crlNum; ASN1_GENERALIZEDTIME *crlTime; } OCSP_CRLID; /*- * ServiceLocator ::= SEQUENCE { * issuer Name, * locator AuthorityInfoAccessSyntax OPTIONAL } */ typedef struct ocsp_service_locator_st { X509_NAME *issuer; STACK_OF(ACCESS_DESCRIPTION) *locator; } OCSP_SERVICELOC; # define PEM_STRING_OCSP_REQUEST "OCSP REQUEST" # define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE" # define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p) # define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p) # define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \ (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,bp,(char **)x,cb,NULL) # define PEM_read_bio_OCSP_RESPONSE(bp,x,cb)(OCSP_RESPONSE *)PEM_ASN1_read_bio(\ (char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,bp,(char **)x,cb,NULL) # define PEM_write_bio_OCSP_REQUEST(bp,o) \ PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\ bp,(char *)o, NULL,NULL,0,NULL,NULL) # define PEM_write_bio_OCSP_RESPONSE(bp,o) \ PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\ bp,(char *)o, NULL,NULL,0,NULL,NULL) # define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o) # define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o) # define OCSP_REQUEST_sign(o,pkey,md) \ ASN1_item_sign(ASN1_ITEM_rptr(OCSP_REQINFO),\ o->optionalSignature->signatureAlgorithm,NULL,\ o->optionalSignature->signature,o->tbsRequest,pkey,md) # define OCSP_BASICRESP_sign(o,pkey,md,d) \ ASN1_item_sign(ASN1_ITEM_rptr(OCSP_RESPDATA),o->signatureAlgorithm,NULL,\ o->signature,o->tbsResponseData,pkey,md) # define OCSP_REQUEST_verify(a,r) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_REQINFO),\ a->optionalSignature->signatureAlgorithm,\ a->optionalSignature->signature,a->tbsRequest,r) # define OCSP_BASICRESP_verify(a,r,d) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_RESPDATA),\ a->signatureAlgorithm,a->signature,a->tbsResponseData,r) # define ASN1_BIT_STRING_digest(data,type,md,len) \ ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len) # define OCSP_CERTSTATUS_dup(cs)\ (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\ (char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs)) OCSP_CERTID *OCSP_CERTID_dup(OCSP_CERTID *id); OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, const char *path, OCSP_REQUEST *req); OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path, OCSP_REQUEST *req, int maxline); int OCSP_REQ_CTX_nbio(OCSP_REQ_CTX *rctx); int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx); OCSP_REQ_CTX *OCSP_REQ_CTX_new(BIO *io, int maxline); void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx); void OCSP_set_max_response_length(OCSP_REQ_CTX *rctx, unsigned long len); int OCSP_REQ_CTX_i2d(OCSP_REQ_CTX *rctx, const ASN1_ITEM *it, ASN1_VALUE *val); int OCSP_REQ_CTX_nbio_d2i(OCSP_REQ_CTX *rctx, ASN1_VALUE **pval, const ASN1_ITEM *it); BIO *OCSP_REQ_CTX_get0_mem_bio(OCSP_REQ_CTX *rctx); int OCSP_REQ_CTX_i2d(OCSP_REQ_CTX *rctx, const ASN1_ITEM *it, ASN1_VALUE *val); int OCSP_REQ_CTX_http(OCSP_REQ_CTX *rctx, const char *op, const char *path); int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req); int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx, const char *name, const char *value); OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer); OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst, X509_NAME *issuerName, ASN1_BIT_STRING *issuerKey, ASN1_INTEGER *serialNumber); OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid); int OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len); int OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len); int OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs); int OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req); int OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm); int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert); int OCSP_request_sign(OCSP_REQUEST *req, X509 *signer, EVP_PKEY *key, const EVP_MD *dgst, STACK_OF(X509) *certs, unsigned long flags); int OCSP_response_status(OCSP_RESPONSE *resp); OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp); int OCSP_resp_count(OCSP_BASICRESP *bs); OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx); int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last); int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason, ASN1_GENERALIZEDTIME **revtime, ASN1_GENERALIZEDTIME **thisupd, ASN1_GENERALIZEDTIME **nextupd); int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status, int *reason, ASN1_GENERALIZEDTIME **revtime, ASN1_GENERALIZEDTIME **thisupd, ASN1_GENERALIZEDTIME **nextupd); int OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, ASN1_GENERALIZEDTIME *nextupd, long sec, long maxsec); int OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs, X509_STORE *store, unsigned long flags); int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath, int *pssl); int OCSP_id_issuer_cmp(OCSP_CERTID *a, OCSP_CERTID *b); int OCSP_id_cmp(OCSP_CERTID *a, OCSP_CERTID *b); int OCSP_request_onereq_count(OCSP_REQUEST *req); OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i); OCSP_CERTID *OCSP_onereq_get0_id(OCSP_ONEREQ *one); int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, ASN1_OCTET_STRING **pikeyHash, ASN1_INTEGER **pserial, OCSP_CERTID *cid); int OCSP_request_is_signed(OCSP_REQUEST *req); OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs); OCSP_SINGLERESP *OCSP_basic_add1_status(OCSP_BASICRESP *rsp, OCSP_CERTID *cid, int status, int reason, ASN1_TIME *revtime, ASN1_TIME *thisupd, ASN1_TIME *nextupd); int OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert); int OCSP_basic_sign(OCSP_BASICRESP *brsp, X509 *signer, EVP_PKEY *key, const EVP_MD *dgst, STACK_OF(X509) *certs, unsigned long flags); X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim); X509_EXTENSION *OCSP_accept_responses_new(char **oids); X509_EXTENSION *OCSP_archive_cutoff_new(char *tim); X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME *issuer, char **urls); int OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x); int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos); int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, ASN1_OBJECT *obj, int lastpos); int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos); X509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc); X509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc); void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, int *idx); int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit, unsigned long flags); int OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc); int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x); int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos); int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, ASN1_OBJECT *obj, int lastpos); int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos); X509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc); X509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc); void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx); int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit, unsigned long flags); int OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc); int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x); int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos); int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, ASN1_OBJECT *obj, int lastpos); int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit, int lastpos); X509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc); X509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc); void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, int *idx); int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, int crit, unsigned long flags); int OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc); int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x); int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos); int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, ASN1_OBJECT *obj, int lastpos); int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit, int lastpos); X509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc); X509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc); void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit, int *idx); int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, int crit, unsigned long flags); int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc); DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP) DECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS) DECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO) DECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP) DECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA) DECLARE_ASN1_FUNCTIONS(OCSP_RESPID) DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE) DECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES) DECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ) DECLARE_ASN1_FUNCTIONS(OCSP_CERTID) DECLARE_ASN1_FUNCTIONS(OCSP_REQUEST) DECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE) DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO) DECLARE_ASN1_FUNCTIONS(OCSP_CRLID) DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC) const char *OCSP_response_status_str(long s); const char *OCSP_cert_status_str(long s); const char *OCSP_crl_reason_str(long s); int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST *a, unsigned long flags); int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE *o, unsigned long flags); int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, X509_STORE *st, unsigned long flags); /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_OCSP_strings(void); /* Error codes for the OCSP functions. */ /* Function codes. */ # define OCSP_F_ASN1_STRING_ENCODE 100 # define OCSP_F_D2I_OCSP_NONCE 102 # define OCSP_F_OCSP_BASIC_ADD1_STATUS 103 # define OCSP_F_OCSP_BASIC_SIGN 104 # define OCSP_F_OCSP_BASIC_VERIFY 105 # define OCSP_F_OCSP_CERT_ID_NEW 101 # define OCSP_F_OCSP_CHECK_DELEGATED 106 # define OCSP_F_OCSP_CHECK_IDS 107 # define OCSP_F_OCSP_CHECK_ISSUER 108 # define OCSP_F_OCSP_CHECK_VALIDITY 115 # define OCSP_F_OCSP_MATCH_ISSUERID 109 # define OCSP_F_OCSP_PARSE_URL 114 # define OCSP_F_OCSP_REQUEST_SIGN 110 # define OCSP_F_OCSP_REQUEST_VERIFY 116 # define OCSP_F_OCSP_RESPONSE_GET1_BASIC 111 # define OCSP_F_OCSP_SENDREQ_BIO 112 # define OCSP_F_OCSP_SENDREQ_NBIO 117 # define OCSP_F_PARSE_HTTP_LINE1 118 # define OCSP_F_REQUEST_VERIFY 113 /* Reason codes. */ # define OCSP_R_BAD_DATA 100 # define OCSP_R_CERTIFICATE_VERIFY_ERROR 101 # define OCSP_R_DIGEST_ERR 102 # define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD 122 # define OCSP_R_ERROR_IN_THISUPDATE_FIELD 123 # define OCSP_R_ERROR_PARSING_URL 121 # define OCSP_R_MISSING_OCSPSIGNING_USAGE 103 # define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE 124 # define OCSP_R_NOT_BASIC_RESPONSE 104 # define OCSP_R_NO_CERTIFICATES_IN_CHAIN 105 # define OCSP_R_NO_CONTENT 106 # define OCSP_R_NO_PUBLIC_KEY 107 # define OCSP_R_NO_RESPONSE_DATA 108 # define OCSP_R_NO_REVOKED_TIME 109 # define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 110 # define OCSP_R_REQUEST_NOT_SIGNED 128 # define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA 111 # define OCSP_R_ROOT_CA_NOT_TRUSTED 112 # define OCSP_R_SERVER_READ_ERROR 113 # define OCSP_R_SERVER_RESPONSE_ERROR 114 # define OCSP_R_SERVER_RESPONSE_PARSE_ERROR 115 # define OCSP_R_SERVER_WRITE_ERROR 116 # define OCSP_R_SIGNATURE_FAILURE 117 # define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND 118 # define OCSP_R_STATUS_EXPIRED 125 # define OCSP_R_STATUS_NOT_YET_VALID 126 # define OCSP_R_STATUS_TOO_OLD 127 # define OCSP_R_UNKNOWN_MESSAGE_DIGEST 119 # define OCSP_R_UNKNOWN_NID 120 # define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE 129 #ifdef __cplusplus } #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/md2.h���������������������������������������������������������������������������������������0000644�����������������00000007622�14763166030�0007077 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/md/md2.h */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_MD2_H # define HEADER_MD2_H # include <openssl/opensslconf.h>/* OPENSSL_NO_MD2, MD2_INT */ # ifdef OPENSSL_NO_MD2 # error MD2 is disabled. # endif # include <stddef.h> # define MD2_DIGEST_LENGTH 16 # define MD2_BLOCK 16 #ifdef __cplusplus extern "C" { #endif typedef struct MD2state_st { unsigned int num; unsigned char data[MD2_BLOCK]; MD2_INT cksm[MD2_BLOCK]; MD2_INT state[MD2_BLOCK]; } MD2_CTX; const char *MD2_options(void); # ifdef OPENSSL_FIPS int private_MD2_Init(MD2_CTX *c); # endif int MD2_Init(MD2_CTX *c); int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len); int MD2_Final(unsigned char *md, MD2_CTX *c); unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md); #ifdef __cplusplus } #endif #endif ��������������������������������������������������������������������������������������������������������������openssl/crypto.h������������������������������������������������������������������������������������0000644�����������������00000066714�14763166030�0007744 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/crypto.h */ /* ==================================================================== * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * ECDH support in OpenSSL originally developed by * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. */ #ifndef HEADER_CRYPTO_H # define HEADER_CRYPTO_H # include <stdlib.h> # include <openssl/e_os2.h> # ifndef OPENSSL_NO_FP_API # include <stdio.h> # endif # include <openssl/stack.h> # include <openssl/safestack.h> # include <openssl/opensslv.h> # include <openssl/ossl_typ.h> # ifdef CHARSET_EBCDIC # include <openssl/ebcdic.h> # endif /* * Resolve problems on some operating systems with symbol names that clash * one way or another */ # include <openssl/symhacks.h> #ifdef __cplusplus extern "C" { #endif /* Backward compatibility to SSLeay */ /* * This is more to be used to check the correct DLL is being used in the MS * world. */ # define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER # define SSLEAY_VERSION 0 /* #define SSLEAY_OPTIONS 1 no longer supported */ # define SSLEAY_CFLAGS 2 # define SSLEAY_BUILT_ON 3 # define SSLEAY_PLATFORM 4 # define SSLEAY_DIR 5 /* Already declared in ossl_typ.h */ # if 0 typedef struct crypto_ex_data_st CRYPTO_EX_DATA; /* Called when a new object is created */ typedef int CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad, int idx, long argl, void *argp); /* Called when an object is free()ed */ typedef void CRYPTO_EX_free (void *parent, void *ptr, CRYPTO_EX_DATA *ad, int idx, long argl, void *argp); /* Called when we need to dup an object */ typedef int CRYPTO_EX_dup (CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, int idx, long argl, void *argp); # endif /* A generic structure to pass assorted data in a expandable way */ typedef struct openssl_item_st { int code; void *value; /* Not used for flag attributes */ size_t value_size; /* Max size of value for output, length for * input */ size_t *value_length; /* Returned length of value for output */ } OPENSSL_ITEM; /* * When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock * names in cryptlib.c */ # define CRYPTO_LOCK_ERR 1 # define CRYPTO_LOCK_EX_DATA 2 # define CRYPTO_LOCK_X509 3 # define CRYPTO_LOCK_X509_INFO 4 # define CRYPTO_LOCK_X509_PKEY 5 # define CRYPTO_LOCK_X509_CRL 6 # define CRYPTO_LOCK_X509_REQ 7 # define CRYPTO_LOCK_DSA 8 # define CRYPTO_LOCK_RSA 9 # define CRYPTO_LOCK_EVP_PKEY 10 # define CRYPTO_LOCK_X509_STORE 11 # define CRYPTO_LOCK_SSL_CTX 12 # define CRYPTO_LOCK_SSL_CERT 13 # define CRYPTO_LOCK_SSL_SESSION 14 # define CRYPTO_LOCK_SSL_SESS_CERT 15 # define CRYPTO_LOCK_SSL 16 # define CRYPTO_LOCK_SSL_METHOD 17 # define CRYPTO_LOCK_RAND 18 # define CRYPTO_LOCK_RAND2 19 # define CRYPTO_LOCK_MALLOC 20 # define CRYPTO_LOCK_BIO 21 # define CRYPTO_LOCK_GETHOSTBYNAME 22 # define CRYPTO_LOCK_GETSERVBYNAME 23 # define CRYPTO_LOCK_READDIR 24 # define CRYPTO_LOCK_RSA_BLINDING 25 # define CRYPTO_LOCK_DH 26 # define CRYPTO_LOCK_MALLOC2 27 # define CRYPTO_LOCK_DSO 28 # define CRYPTO_LOCK_DYNLOCK 29 # define CRYPTO_LOCK_ENGINE 30 # define CRYPTO_LOCK_UI 31 # define CRYPTO_LOCK_ECDSA 32 # define CRYPTO_LOCK_EC 33 # define CRYPTO_LOCK_ECDH 34 # define CRYPTO_LOCK_BN 35 # define CRYPTO_LOCK_EC_PRE_COMP 36 # define CRYPTO_LOCK_STORE 37 # define CRYPTO_LOCK_COMP 38 # define CRYPTO_LOCK_FIPS 39 # define CRYPTO_LOCK_FIPS2 40 # define CRYPTO_NUM_LOCKS 41 # define CRYPTO_LOCK 1 # define CRYPTO_UNLOCK 2 # define CRYPTO_READ 4 # define CRYPTO_WRITE 8 # ifndef OPENSSL_NO_LOCKING # ifndef CRYPTO_w_lock # define CRYPTO_w_lock(type) \ CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) # define CRYPTO_w_unlock(type) \ CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) # define CRYPTO_r_lock(type) \ CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__) # define CRYPTO_r_unlock(type) \ CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__) # define CRYPTO_add(addr,amount,type) \ CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__) # endif # else # define CRYPTO_w_lock(a) # define CRYPTO_w_unlock(a) # define CRYPTO_r_lock(a) # define CRYPTO_r_unlock(a) # define CRYPTO_add(a,b,c) ((*(a))+=(b)) # endif /* * Some applications as well as some parts of OpenSSL need to allocate and * deallocate locks in a dynamic fashion. The following typedef makes this * possible in a type-safe manner. */ /* struct CRYPTO_dynlock_value has to be defined by the application. */ typedef struct { int references; struct CRYPTO_dynlock_value *data; } CRYPTO_dynlock; /* * The following can be used to detect memory leaks in the SSLeay library. It * used, it turns on malloc checking */ # define CRYPTO_MEM_CHECK_OFF 0x0/* an enume */ # define CRYPTO_MEM_CHECK_ON 0x1/* a bit */ # define CRYPTO_MEM_CHECK_ENABLE 0x2/* a bit */ # define CRYPTO_MEM_CHECK_DISABLE 0x3/* an enume */ /* * The following are bit values to turn on or off options connected to the * malloc checking functionality */ /* Adds time to the memory checking information */ # define V_CRYPTO_MDEBUG_TIME 0x1/* a bit */ /* Adds thread number to the memory checking information */ # define V_CRYPTO_MDEBUG_THREAD 0x2/* a bit */ # define V_CRYPTO_MDEBUG_ALL (V_CRYPTO_MDEBUG_TIME | V_CRYPTO_MDEBUG_THREAD) /* predec of the BIO type */ typedef struct bio_st BIO_dummy; struct crypto_ex_data_st { STACK_OF(void) *sk; /* gcc is screwing up this data structure :-( */ int dummy; }; DECLARE_STACK_OF(void) /* * This stuff is basically class callback functions The current classes are * SSL_CTX, SSL, SSL_SESSION, and a few more */ typedef struct crypto_ex_data_func_st { long argl; /* Arbitary long */ void *argp; /* Arbitary void * */ CRYPTO_EX_new *new_func; CRYPTO_EX_free *free_func; CRYPTO_EX_dup *dup_func; } CRYPTO_EX_DATA_FUNCS; DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS) /* * Per class, we have a STACK of CRYPTO_EX_DATA_FUNCS for each CRYPTO_EX_DATA * entry. */ # define CRYPTO_EX_INDEX_BIO 0 # define CRYPTO_EX_INDEX_SSL 1 # define CRYPTO_EX_INDEX_SSL_CTX 2 # define CRYPTO_EX_INDEX_SSL_SESSION 3 # define CRYPTO_EX_INDEX_X509_STORE 4 # define CRYPTO_EX_INDEX_X509_STORE_CTX 5 # define CRYPTO_EX_INDEX_RSA 6 # define CRYPTO_EX_INDEX_DSA 7 # define CRYPTO_EX_INDEX_DH 8 # define CRYPTO_EX_INDEX_ENGINE 9 # define CRYPTO_EX_INDEX_X509 10 # define CRYPTO_EX_INDEX_UI 11 # define CRYPTO_EX_INDEX_ECDSA 12 # define CRYPTO_EX_INDEX_ECDH 13 # define CRYPTO_EX_INDEX_COMP 14 # define CRYPTO_EX_INDEX_STORE 15 /* * Dynamically assigned indexes start from this value (don't use directly, * use via CRYPTO_ex_data_new_class). */ # define CRYPTO_EX_INDEX_USER 100 /* * This is the default callbacks, but we can have others as well: this is * needed in Win32 where the application malloc and the library malloc may * not be the same. */ # define CRYPTO_malloc_init() CRYPTO_set_mem_functions(\ malloc, realloc, free) # if defined CRYPTO_MDEBUG_ALL || defined CRYPTO_MDEBUG_TIME || defined CRYPTO_MDEBUG_THREAD # ifndef CRYPTO_MDEBUG /* avoid duplicate #define */ # define CRYPTO_MDEBUG # endif # endif /* * Set standard debugging functions (not done by default unless CRYPTO_MDEBUG * is defined) */ # define CRYPTO_malloc_debug_init() do {\ CRYPTO_set_mem_debug_functions(\ CRYPTO_dbg_malloc,\ CRYPTO_dbg_realloc,\ CRYPTO_dbg_free,\ CRYPTO_dbg_set_options,\ CRYPTO_dbg_get_options);\ } while(0) int CRYPTO_mem_ctrl(int mode); int CRYPTO_is_mem_check_on(void); /* for applications */ # define MemCheck_start() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON) # define MemCheck_stop() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF) /* for library-internal use */ # define MemCheck_on() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE) # define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE) # define is_MemCheck_on() CRYPTO_is_mem_check_on() # define OPENSSL_malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__) # define OPENSSL_strdup(str) CRYPTO_strdup((str),__FILE__,__LINE__) # define OPENSSL_strndup(str, n) \ CRYPTO_strndup((str), n, __FILE__, __LINE__) # define OPENSSL_realloc(addr,num) \ CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__) # define OPENSSL_realloc_clean(addr,old_num,num) \ CRYPTO_realloc_clean(addr,old_num,num,__FILE__,__LINE__) # define OPENSSL_remalloc(addr,num) \ CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__) # define OPENSSL_freeFunc CRYPTO_free # define OPENSSL_free(addr) CRYPTO_free(addr) # define OPENSSL_malloc_locked(num) \ CRYPTO_malloc_locked((int)num,__FILE__,__LINE__) # define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr) size_t OPENSSL_strnlen(const char *str, size_t maxlen); const char *SSLeay_version(int type); unsigned long SSLeay(void); int OPENSSL_issetugid(void); /* An opaque type representing an implementation of "ex_data" support */ typedef struct st_CRYPTO_EX_DATA_IMPL CRYPTO_EX_DATA_IMPL; /* Return an opaque pointer to the current "ex_data" implementation */ const CRYPTO_EX_DATA_IMPL *CRYPTO_get_ex_data_implementation(void); /* Sets the "ex_data" implementation to be used (if it's not too late) */ int CRYPTO_set_ex_data_implementation(const CRYPTO_EX_DATA_IMPL *i); /* Get a new "ex_data" class, and return the corresponding "class_index" */ int CRYPTO_ex_data_new_class(void); /* Within a given class, get/register a new index */ int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); /* * Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a * given class (invokes whatever per-class callbacks are applicable) */ int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from); void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); /* * Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular * index (relative to the class type involved) */ int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val); void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx); /* * This function cleans up all "ex_data" state. It mustn't be called under * potential race-conditions. */ void CRYPTO_cleanup_all_ex_data(void); int CRYPTO_get_new_lockid(char *name); int CRYPTO_num_locks(void); /* return CRYPTO_NUM_LOCKS (shared libs!) */ void CRYPTO_lock(int mode, int type, const char *file, int line); void CRYPTO_set_locking_callback(void (*func) (int mode, int type, const char *file, int line)); void (*CRYPTO_get_locking_callback(void)) (int mode, int type, const char *file, int line); void CRYPTO_set_add_lock_callback(int (*func) (int *num, int mount, int type, const char *file, int line)); int (*CRYPTO_get_add_lock_callback(void)) (int *num, int mount, int type, const char *file, int line); /* Don't use this structure directly. */ typedef struct crypto_threadid_st { void *ptr; unsigned long val; } CRYPTO_THREADID; /* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */ void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, unsigned long val); void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr); int CRYPTO_THREADID_set_callback(void (*threadid_func) (CRYPTO_THREADID *)); void (*CRYPTO_THREADID_get_callback(void)) (CRYPTO_THREADID *); void CRYPTO_THREADID_current(CRYPTO_THREADID *id); int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a, const CRYPTO_THREADID *b); void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest, const CRYPTO_THREADID *src); unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id); # ifndef OPENSSL_NO_DEPRECATED void CRYPTO_set_id_callback(unsigned long (*func) (void)); unsigned long (*CRYPTO_get_id_callback(void)) (void); unsigned long CRYPTO_thread_id(void); # endif const char *CRYPTO_get_lock_name(int type); int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, int line); int CRYPTO_get_new_dynlockid(void); void CRYPTO_destroy_dynlockid(int i); struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i); void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*dyn_create_function) (const char *file, int line)); void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function) (int mode, struct CRYPTO_dynlock_value *l, const char *file, int line)); void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function) (struct CRYPTO_dynlock_value *l, const char *file, int line)); struct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void)) (const char *file, int line); void (*CRYPTO_get_dynlock_lock_callback(void)) (int mode, struct CRYPTO_dynlock_value *l, const char *file, int line); void (*CRYPTO_get_dynlock_destroy_callback(void)) (struct CRYPTO_dynlock_value *l, const char *file, int line); /* * CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions -- call * the latter last if you need different functions */ int CRYPTO_set_mem_functions(void *(*m) (size_t), void *(*r) (void *, size_t), void (*f) (void *)); int CRYPTO_set_locked_mem_functions(void *(*m) (size_t), void (*free_func) (void *)); int CRYPTO_set_mem_ex_functions(void *(*m) (size_t, const char *, int), void *(*r) (void *, size_t, const char *, int), void (*f) (void *)); int CRYPTO_set_locked_mem_ex_functions(void *(*m) (size_t, const char *, int), void (*free_func) (void *)); int CRYPTO_set_mem_debug_functions(void (*m) (void *, int, const char *, int, int), void (*r) (void *, void *, int, const char *, int, int), void (*f) (void *, int), void (*so) (long), long (*go) (void)); void CRYPTO_get_mem_functions(void *(**m) (size_t), void *(**r) (void *, size_t), void (**f) (void *)); void CRYPTO_get_locked_mem_functions(void *(**m) (size_t), void (**f) (void *)); void CRYPTO_get_mem_ex_functions(void *(**m) (size_t, const char *, int), void *(**r) (void *, size_t, const char *, int), void (**f) (void *)); void CRYPTO_get_locked_mem_ex_functions(void *(**m) (size_t, const char *, int), void (**f) (void *)); void CRYPTO_get_mem_debug_functions(void (**m) (void *, int, const char *, int, int), void (**r) (void *, void *, int, const char *, int, int), void (**f) (void *, int), void (**so) (long), long (**go) (void)); void *CRYPTO_malloc_locked(int num, const char *file, int line); void CRYPTO_free_locked(void *ptr); void *CRYPTO_malloc(int num, const char *file, int line); char *CRYPTO_strdup(const char *str, const char *file, int line); char *CRYPTO_strndup(const char *str, size_t s, const char *file, int line); void CRYPTO_free(void *ptr); void *CRYPTO_realloc(void *addr, int num, const char *file, int line); void *CRYPTO_realloc_clean(void *addr, int old_num, int num, const char *file, int line); void *CRYPTO_remalloc(void *addr, int num, const char *file, int line); void OPENSSL_cleanse(void *ptr, size_t len); void CRYPTO_set_mem_debug_options(long bits); long CRYPTO_get_mem_debug_options(void); # define CRYPTO_push_info(info) \ CRYPTO_push_info_(info, __FILE__, __LINE__); int CRYPTO_push_info_(const char *info, const char *file, int line); int CRYPTO_pop_info(void); int CRYPTO_remove_all_info(void); /* * Default debugging functions (enabled by CRYPTO_malloc_debug_init() macro; * used as default in CRYPTO_MDEBUG compilations): */ /*- * The last argument has the following significance: * * 0: called before the actual memory allocation has taken place * 1: called after the actual memory allocation has taken place */ void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line, int before_p); void CRYPTO_dbg_realloc(void *addr1, void *addr2, int num, const char *file, int line, int before_p); void CRYPTO_dbg_free(void *addr, int before_p); /*- * Tell the debugging code about options. By default, the following values * apply: * * 0: Clear all options. * V_CRYPTO_MDEBUG_TIME (1): Set the "Show Time" option. * V_CRYPTO_MDEBUG_THREAD (2): Set the "Show Thread Number" option. * V_CRYPTO_MDEBUG_ALL (3): 1 + 2 */ void CRYPTO_dbg_set_options(long bits); long CRYPTO_dbg_get_options(void); # ifndef OPENSSL_NO_FP_API void CRYPTO_mem_leaks_fp(FILE *); # endif void CRYPTO_mem_leaks(struct bio_st *bio); /* unsigned long order, char *file, int line, int num_bytes, char *addr */ typedef void *CRYPTO_MEM_LEAK_CB (unsigned long, const char *, int, int, void *); void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb); /* die if we have to */ void OpenSSLDie(const char *file, int line, const char *assertion); # define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1)) unsigned long *OPENSSL_ia32cap_loc(void); # define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc())) int OPENSSL_isservice(void); int FIPS_mode(void); int FIPS_mode_set(int r); void OPENSSL_init(void); # define fips_md_init(alg) fips_md_init_ctx(alg, alg) # define nonfips_md_init(alg) nonfips_md_init_ctx(alg, alg) # define fips_md_init_ctx(alg, cx) \ int alg##_Init(cx##_CTX *c) # ifdef OPENSSL_FIPS # define nonfips_md_init_ctx(alg, cx) \ int alg##_Init(cx##_CTX *c) \ { \ if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \ "Digest " #alg " forbidden in FIPS mode!"); \ return private_##alg##_Init(c); \ } \ int private_##alg##_Init(cx##_CTX *c) # define fips_cipher_abort(alg) \ if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \ "Cipher " #alg " forbidden in FIPS mode!") /* die if FIPS selftest failed */ void FIPS_selftest_check(void); # else # define nonfips_md_init_ctx(alg, cx) fips_md_init_ctx(alg, cx) # define fips_cipher_abort(alg) while(0) # endif /* * CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. * It takes an amount of time dependent on |len|, but independent of the * contents of |a| and |b|. Unlike memcmp, it cannot be used to put elements * into a defined order as the return value when a != b is undefined, other * than to be non-zero. */ int CRYPTO_memcmp(const volatile void *a, const volatile void *b, size_t len); /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_CRYPTO_strings(void); # define OPENSSL_HAVE_INIT 1 void OPENSSL_init_library(void); /* Error codes for the CRYPTO functions. */ /* Function codes. */ # define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100 # define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID 103 # define CRYPTO_F_CRYPTO_GET_NEW_LOCKID 101 # define CRYPTO_F_CRYPTO_SET_EX_DATA 102 # define CRYPTO_F_DEF_ADD_INDEX 104 # define CRYPTO_F_DEF_GET_CLASS 105 # define CRYPTO_F_FIPS_MODE_SET 109 # define CRYPTO_F_INT_DUP_EX_DATA 106 # define CRYPTO_F_INT_FREE_EX_DATA 107 # define CRYPTO_F_INT_NEW_EX_DATA 108 /* Reason codes. */ # define CRYPTO_R_FIPS_MODE_NOT_SUPPORTED 101 # define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK 100 #ifdef __cplusplus } #endif #endif ����������������������������������������������������openssl/tls1.h��������������������������������������������������������������������������������������0000644�����������������00000114747�14763166030�0007307 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ssl/tls1.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * * Portions of the attached software ("Contribution") are developed by * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. * * The Contribution is licensed pursuant to the OpenSSL open source * license provided above. * * ECC cipher suite support in OpenSSL originally written by * Vipul Gupta and Sumit Gupta of Sun Microsystems Laboratories. * */ /* ==================================================================== * Copyright 2005 Nokia. All rights reserved. * * The portions of the attached software ("Contribution") is developed by * Nokia Corporation and is licensed pursuant to the OpenSSL open source * license. * * The Contribution, originally written by Mika Kousa and Pasi Eronen of * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites * support (see RFC 4279) to OpenSSL. * * No patent licenses or other rights except those expressly stated in * the OpenSSL open source license shall be deemed granted or received * expressly, by implication, estoppel, or otherwise. * * No assurances are provided by Nokia that the Contribution does not * infringe the patent or other intellectual property rights of any third * party or that the license provides you with all the necessary rights * to make use of the Contribution. * * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR * OTHERWISE. */ #ifndef HEADER_TLS1_H # define HEADER_TLS1_H # include <openssl/buffer.h> #ifdef __cplusplus extern "C" { #endif # define TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES 0 # define TLS1_VERSION 0x0301 # define TLS1_1_VERSION 0x0302 # define TLS1_2_VERSION 0x0303 # define TLS_MAX_VERSION TLS1_2_VERSION # define TLS1_VERSION_MAJOR 0x03 # define TLS1_VERSION_MINOR 0x01 # define TLS1_1_VERSION_MAJOR 0x03 # define TLS1_1_VERSION_MINOR 0x02 # define TLS1_2_VERSION_MAJOR 0x03 # define TLS1_2_VERSION_MINOR 0x03 # define TLS1_get_version(s) \ ((s->version >> 8) == TLS1_VERSION_MAJOR ? s->version : 0) # define TLS1_get_client_version(s) \ ((s->client_version >> 8) == TLS1_VERSION_MAJOR ? s->client_version : 0) # define TLS1_AD_DECRYPTION_FAILED 21 # define TLS1_AD_RECORD_OVERFLOW 22 # define TLS1_AD_UNKNOWN_CA 48/* fatal */ # define TLS1_AD_ACCESS_DENIED 49/* fatal */ # define TLS1_AD_DECODE_ERROR 50/* fatal */ # define TLS1_AD_DECRYPT_ERROR 51 # define TLS1_AD_EXPORT_RESTRICTION 60/* fatal */ # define TLS1_AD_PROTOCOL_VERSION 70/* fatal */ # define TLS1_AD_INSUFFICIENT_SECURITY 71/* fatal */ # define TLS1_AD_INTERNAL_ERROR 80/* fatal */ # define TLS1_AD_INAPPROPRIATE_FALLBACK 86/* fatal */ # define TLS1_AD_USER_CANCELLED 90 # define TLS1_AD_NO_RENEGOTIATION 100 /* codes 110-114 are from RFC3546 */ # define TLS1_AD_UNSUPPORTED_EXTENSION 110 # define TLS1_AD_CERTIFICATE_UNOBTAINABLE 111 # define TLS1_AD_UNRECOGNIZED_NAME 112 # define TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE 113 # define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114 # define TLS1_AD_UNKNOWN_PSK_IDENTITY 115/* fatal */ /* ExtensionType values from RFC3546 / RFC4366 / RFC6066 */ # define TLSEXT_TYPE_server_name 0 # define TLSEXT_TYPE_max_fragment_length 1 # define TLSEXT_TYPE_client_certificate_url 2 # define TLSEXT_TYPE_trusted_ca_keys 3 # define TLSEXT_TYPE_truncated_hmac 4 # define TLSEXT_TYPE_status_request 5 /* ExtensionType values from RFC4681 */ # define TLSEXT_TYPE_user_mapping 6 /* ExtensionType values from RFC5878 */ # define TLSEXT_TYPE_client_authz 7 # define TLSEXT_TYPE_server_authz 8 /* ExtensionType values from RFC6091 */ # define TLSEXT_TYPE_cert_type 9 /* ExtensionType values from RFC4492 */ # define TLSEXT_TYPE_elliptic_curves 10 # define TLSEXT_TYPE_ec_point_formats 11 /* ExtensionType value from RFC5054 */ # define TLSEXT_TYPE_srp 12 /* ExtensionType values from RFC5246 */ # define TLSEXT_TYPE_signature_algorithms 13 /* ExtensionType value from RFC5764 */ # define TLSEXT_TYPE_use_srtp 14 /* ExtensionType value from RFC5620 */ # define TLSEXT_TYPE_heartbeat 15 /* ExtensionType value from RFC7301 */ # define TLSEXT_TYPE_application_layer_protocol_negotiation 16 /* * ExtensionType value for TLS padding extension. * http://tools.ietf.org/html/draft-agl-tls-padding */ # define TLSEXT_TYPE_padding 21 /* ExtensionType value from RFC4507 */ # define TLSEXT_TYPE_session_ticket 35 /* ExtensionType value from draft-rescorla-tls-opaque-prf-input-00.txt */ # if 0 /* * will have to be provided externally for now , * i.e. build with -DTLSEXT_TYPE_opaque_prf_input=38183 * using whatever extension number you'd like to try */ # define TLSEXT_TYPE_opaque_prf_input ?? # endif /* Temporary extension type */ # define TLSEXT_TYPE_renegotiate 0xff01 # ifndef OPENSSL_NO_NEXTPROTONEG /* This is not an IANA defined extension number */ # define TLSEXT_TYPE_next_proto_neg 13172 # endif /* NameType value from RFC3546 */ # define TLSEXT_NAMETYPE_host_name 0 /* status request value from RFC3546 */ # define TLSEXT_STATUSTYPE_ocsp 1 /* ECPointFormat values from RFC4492 */ # define TLSEXT_ECPOINTFORMAT_first 0 # define TLSEXT_ECPOINTFORMAT_uncompressed 0 # define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime 1 # define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2 2 # define TLSEXT_ECPOINTFORMAT_last 2 /* Signature and hash algorithms from RFC5246 */ # define TLSEXT_signature_anonymous 0 # define TLSEXT_signature_rsa 1 # define TLSEXT_signature_dsa 2 # define TLSEXT_signature_ecdsa 3 /* Total number of different signature algorithms */ # define TLSEXT_signature_num 4 # define TLSEXT_hash_none 0 # define TLSEXT_hash_md5 1 # define TLSEXT_hash_sha1 2 # define TLSEXT_hash_sha224 3 # define TLSEXT_hash_sha256 4 # define TLSEXT_hash_sha384 5 # define TLSEXT_hash_sha512 6 /* Total number of different digest algorithms */ # define TLSEXT_hash_num 7 /* Flag set for unrecognised algorithms */ # define TLSEXT_nid_unknown 0x1000000 /* ECC curves */ # define TLSEXT_curve_P_256 23 # define TLSEXT_curve_P_384 24 # ifndef OPENSSL_NO_TLSEXT # define TLSEXT_MAXLEN_host_name 255 const char *SSL_get_servername(const SSL *s, const int type); int SSL_get_servername_type(const SSL *s); /* * SSL_export_keying_material exports a value derived from the master secret, * as specified in RFC 5705. It writes |olen| bytes to |out| given a label and * optional context. (Since a zero length context is allowed, the |use_context| * flag controls whether a context is included.) It returns 1 on success and * zero otherwise. */ int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen, const char *label, size_t llen, const unsigned char *p, size_t plen, int use_context); int SSL_get_sigalgs(SSL *s, int idx, int *psign, int *phash, int *psignandhash, unsigned char *rsig, unsigned char *rhash); int SSL_get_shared_sigalgs(SSL *s, int idx, int *psign, int *phash, int *psignandhash, unsigned char *rsig, unsigned char *rhash); int SSL_check_chain(SSL *s, X509 *x, EVP_PKEY *pk, STACK_OF(X509) *chain); # define SSL_set_tlsext_host_name(s,name) \ SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,(char *)name) # define SSL_set_tlsext_debug_callback(ssl, cb) \ SSL_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_CB,(void (*)(void))cb) # define SSL_set_tlsext_debug_arg(ssl, arg) \ SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_ARG,0, (void *)arg) # define SSL_set_tlsext_status_type(ssl, type) \ SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,type, NULL) # define SSL_get_tlsext_status_exts(ssl, arg) \ SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS,0, (void *)arg) # define SSL_set_tlsext_status_exts(ssl, arg) \ SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS,0, (void *)arg) # define SSL_get_tlsext_status_ids(ssl, arg) \ SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS,0, (void *)arg) # define SSL_set_tlsext_status_ids(ssl, arg) \ SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS,0, (void *)arg) # define SSL_get_tlsext_status_ocsp_resp(ssl, arg) \ SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP,0, (void *)arg) # define SSL_set_tlsext_status_ocsp_resp(ssl, arg, arglen) \ SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP,arglen, (void *)arg) # define SSL_CTX_set_tlsext_servername_callback(ctx, cb) \ SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_CB,(void (*)(void))cb) # define SSL_TLSEXT_ERR_OK 0 # define SSL_TLSEXT_ERR_ALERT_WARNING 1 # define SSL_TLSEXT_ERR_ALERT_FATAL 2 # define SSL_TLSEXT_ERR_NOACK 3 # define SSL_CTX_set_tlsext_servername_arg(ctx, arg) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG,0, (void *)arg) # define SSL_CTX_get_tlsext_ticket_keys(ctx, keys, keylen) \ SSL_CTX_ctrl((ctx),SSL_CTRL_GET_TLSEXT_TICKET_KEYS,(keylen),(keys)) # define SSL_CTX_set_tlsext_ticket_keys(ctx, keys, keylen) \ SSL_CTX_ctrl((ctx),SSL_CTRL_SET_TLSEXT_TICKET_KEYS,(keylen),(keys)) # define SSL_CTX_set_tlsext_status_cb(ssl, cb) \ SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB,(void (*)(void))cb) # define SSL_CTX_set_tlsext_status_arg(ssl, arg) \ SSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG,0, (void *)arg) # define SSL_set_tlsext_opaque_prf_input(s, src, len) \ SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT, len, src) # define SSL_CTX_set_tlsext_opaque_prf_input_callback(ctx, cb) \ SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB, (void (*)(void))cb) # define SSL_CTX_set_tlsext_opaque_prf_input_callback_arg(ctx, arg) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG, 0, arg) # define SSL_CTX_set_tlsext_ticket_key_cb(ssl, cb) \ SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,(void (*)(void))cb) # ifndef OPENSSL_NO_HEARTBEATS # define SSL_TLSEXT_HB_ENABLED 0x01 # define SSL_TLSEXT_HB_DONT_SEND_REQUESTS 0x02 # define SSL_TLSEXT_HB_DONT_RECV_REQUESTS 0x04 # define SSL_get_tlsext_heartbeat_pending(ssl) \ SSL_ctrl((ssl),SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING,0,NULL) # define SSL_set_tlsext_heartbeat_no_requests(ssl, arg) \ SSL_ctrl((ssl),SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS,arg,NULL) # endif # endif /* PSK ciphersuites from 4279 */ # define TLS1_CK_PSK_WITH_RC4_128_SHA 0x0300008A # define TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008B # define TLS1_CK_PSK_WITH_AES_128_CBC_SHA 0x0300008C # define TLS1_CK_PSK_WITH_AES_256_CBC_SHA 0x0300008D /* * Additional TLS ciphersuites from expired Internet Draft * draft-ietf-tls-56-bit-ciphersuites-01.txt (available if * TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES is defined, see s3_lib.c). We * actually treat them like SSL 3.0 ciphers, which we probably shouldn't. * Note that the first two are actually not in the IDs. */ # define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_MD5 0x03000060/* not in * ID */ # define TLS1_CK_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5 0x03000061/* not in * ID */ # define TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA 0x03000062 # define TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA 0x03000063 # define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_SHA 0x03000064 # define TLS1_CK_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA 0x03000065 # define TLS1_CK_DHE_DSS_WITH_RC4_128_SHA 0x03000066 /* AES ciphersuites from RFC3268 */ # define TLS1_CK_RSA_WITH_AES_128_SHA 0x0300002F # define TLS1_CK_DH_DSS_WITH_AES_128_SHA 0x03000030 # define TLS1_CK_DH_RSA_WITH_AES_128_SHA 0x03000031 # define TLS1_CK_DHE_DSS_WITH_AES_128_SHA 0x03000032 # define TLS1_CK_DHE_RSA_WITH_AES_128_SHA 0x03000033 # define TLS1_CK_ADH_WITH_AES_128_SHA 0x03000034 # define TLS1_CK_RSA_WITH_AES_256_SHA 0x03000035 # define TLS1_CK_DH_DSS_WITH_AES_256_SHA 0x03000036 # define TLS1_CK_DH_RSA_WITH_AES_256_SHA 0x03000037 # define TLS1_CK_DHE_DSS_WITH_AES_256_SHA 0x03000038 # define TLS1_CK_DHE_RSA_WITH_AES_256_SHA 0x03000039 # define TLS1_CK_ADH_WITH_AES_256_SHA 0x0300003A /* TLS v1.2 ciphersuites */ # define TLS1_CK_RSA_WITH_NULL_SHA256 0x0300003B # define TLS1_CK_RSA_WITH_AES_128_SHA256 0x0300003C # define TLS1_CK_RSA_WITH_AES_256_SHA256 0x0300003D # define TLS1_CK_DH_DSS_WITH_AES_128_SHA256 0x0300003E # define TLS1_CK_DH_RSA_WITH_AES_128_SHA256 0x0300003F # define TLS1_CK_DHE_DSS_WITH_AES_128_SHA256 0x03000040 /* Camellia ciphersuites from RFC4132 */ # define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000041 # define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000042 # define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000043 # define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000044 # define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000045 # define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA 0x03000046 /* TLS v1.2 ciphersuites */ # define TLS1_CK_DHE_RSA_WITH_AES_128_SHA256 0x03000067 # define TLS1_CK_DH_DSS_WITH_AES_256_SHA256 0x03000068 # define TLS1_CK_DH_RSA_WITH_AES_256_SHA256 0x03000069 # define TLS1_CK_DHE_DSS_WITH_AES_256_SHA256 0x0300006A # define TLS1_CK_DHE_RSA_WITH_AES_256_SHA256 0x0300006B # define TLS1_CK_ADH_WITH_AES_128_SHA256 0x0300006C # define TLS1_CK_ADH_WITH_AES_256_SHA256 0x0300006D /* Camellia ciphersuites from RFC4132 */ # define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000084 # define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000085 # define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000086 # define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000087 # define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000088 # define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA 0x03000089 /* SEED ciphersuites from RFC4162 */ # define TLS1_CK_RSA_WITH_SEED_SHA 0x03000096 # define TLS1_CK_DH_DSS_WITH_SEED_SHA 0x03000097 # define TLS1_CK_DH_RSA_WITH_SEED_SHA 0x03000098 # define TLS1_CK_DHE_DSS_WITH_SEED_SHA 0x03000099 # define TLS1_CK_DHE_RSA_WITH_SEED_SHA 0x0300009A # define TLS1_CK_ADH_WITH_SEED_SHA 0x0300009B /* TLS v1.2 GCM ciphersuites from RFC5288 */ # define TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 0x0300009C # define TLS1_CK_RSA_WITH_AES_256_GCM_SHA384 0x0300009D # define TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256 0x0300009E # define TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384 0x0300009F # define TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256 0x030000A0 # define TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384 0x030000A1 # define TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256 0x030000A2 # define TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384 0x030000A3 # define TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256 0x030000A4 # define TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384 0x030000A5 # define TLS1_CK_ADH_WITH_AES_128_GCM_SHA256 0x030000A6 # define TLS1_CK_ADH_WITH_AES_256_GCM_SHA384 0x030000A7 /* * ECC ciphersuites from draft-ietf-tls-ecc-12.txt with changes soon to be in * draft 13 */ # define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA 0x0300C001 # define TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA 0x0300C002 # define TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C003 # define TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0x0300C004 # define TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0x0300C005 # define TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA 0x0300C006 # define TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA 0x0300C007 # define TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C008 # define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0x0300C009 # define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0x0300C00A # define TLS1_CK_ECDH_RSA_WITH_NULL_SHA 0x0300C00B # define TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA 0x0300C00C # define TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA 0x0300C00D # define TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA 0x0300C00E # define TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA 0x0300C00F # define TLS1_CK_ECDHE_RSA_WITH_NULL_SHA 0x0300C010 # define TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA 0x0300C011 # define TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA 0x0300C012 # define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA 0x0300C013 # define TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA 0x0300C014 # define TLS1_CK_ECDH_anon_WITH_NULL_SHA 0x0300C015 # define TLS1_CK_ECDH_anon_WITH_RC4_128_SHA 0x0300C016 # define TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA 0x0300C017 # define TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA 0x0300C018 # define TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA 0x0300C019 /* SRP ciphersuites from RFC 5054 */ # define TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA 0x0300C01A # define TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA 0x0300C01B # define TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA 0x0300C01C # define TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA 0x0300C01D # define TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA 0x0300C01E # define TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA 0x0300C01F # define TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA 0x0300C020 # define TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA 0x0300C021 # define TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA 0x0300C022 /* ECDH HMAC based ciphersuites from RFC5289 */ # define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256 0x0300C023 # define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384 0x0300C024 # define TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256 0x0300C025 # define TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384 0x0300C026 # define TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256 0x0300C027 # define TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384 0x0300C028 # define TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256 0x0300C029 # define TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384 0x0300C02A /* ECDH GCM based ciphersuites from RFC5289 */ # define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02B # define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02C # define TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02D # define TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02E # define TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0x0300C02F # define TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0x0300C030 # define TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256 0x0300C031 # define TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384 0x0300C032 /* * XXX * Backward compatibility alert: + * Older versions of OpenSSL gave * some DHE ciphers names with "EDH" + * instead of "DHE". Going forward, we * should be using DHE + * everywhere, though we may indefinitely maintain * aliases for users + * or configurations that used "EDH" + */ # define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_MD5 "EXP1024-RC4-MD5" # define TLS1_TXT_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5 "EXP1024-RC2-CBC-MD5" # define TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA "EXP1024-DES-CBC-SHA" # define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA "EXP1024-DHE-DSS-DES-CBC-SHA" # define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_SHA "EXP1024-RC4-SHA" # define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA "EXP1024-DHE-DSS-RC4-SHA" # define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA "DHE-DSS-RC4-SHA" /* AES ciphersuites from RFC3268 */ # define TLS1_TXT_RSA_WITH_AES_128_SHA "AES128-SHA" # define TLS1_TXT_DH_DSS_WITH_AES_128_SHA "DH-DSS-AES128-SHA" # define TLS1_TXT_DH_RSA_WITH_AES_128_SHA "DH-RSA-AES128-SHA" # define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA "DHE-DSS-AES128-SHA" # define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA "DHE-RSA-AES128-SHA" # define TLS1_TXT_ADH_WITH_AES_128_SHA "ADH-AES128-SHA" # define TLS1_TXT_RSA_WITH_AES_256_SHA "AES256-SHA" # define TLS1_TXT_DH_DSS_WITH_AES_256_SHA "DH-DSS-AES256-SHA" # define TLS1_TXT_DH_RSA_WITH_AES_256_SHA "DH-RSA-AES256-SHA" # define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA "DHE-DSS-AES256-SHA" # define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA "DHE-RSA-AES256-SHA" # define TLS1_TXT_ADH_WITH_AES_256_SHA "ADH-AES256-SHA" /* ECC ciphersuites from RFC4492 */ # define TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA "ECDH-ECDSA-NULL-SHA" # define TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA "ECDH-ECDSA-RC4-SHA" # define TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA "ECDH-ECDSA-DES-CBC3-SHA" # define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA "ECDH-ECDSA-AES128-SHA" # define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA "ECDH-ECDSA-AES256-SHA" # define TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA "ECDHE-ECDSA-NULL-SHA" # define TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA "ECDHE-ECDSA-RC4-SHA" # define TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "ECDHE-ECDSA-DES-CBC3-SHA" # define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "ECDHE-ECDSA-AES128-SHA" # define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "ECDHE-ECDSA-AES256-SHA" # define TLS1_TXT_ECDH_RSA_WITH_NULL_SHA "ECDH-RSA-NULL-SHA" # define TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA "ECDH-RSA-RC4-SHA" # define TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA "ECDH-RSA-DES-CBC3-SHA" # define TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA "ECDH-RSA-AES128-SHA" # define TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA "ECDH-RSA-AES256-SHA" # define TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA "ECDHE-RSA-NULL-SHA" # define TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA "ECDHE-RSA-RC4-SHA" # define TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA "ECDHE-RSA-DES-CBC3-SHA" # define TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA "ECDHE-RSA-AES128-SHA" # define TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA "ECDHE-RSA-AES256-SHA" # define TLS1_TXT_ECDH_anon_WITH_NULL_SHA "AECDH-NULL-SHA" # define TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA "AECDH-RC4-SHA" # define TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA "AECDH-DES-CBC3-SHA" # define TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA "AECDH-AES128-SHA" # define TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA "AECDH-AES256-SHA" /* PSK ciphersuites from RFC 4279 */ # define TLS1_TXT_PSK_WITH_RC4_128_SHA "PSK-RC4-SHA" # define TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA "PSK-3DES-EDE-CBC-SHA" # define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA "PSK-AES128-CBC-SHA" # define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA "PSK-AES256-CBC-SHA" /* SRP ciphersuite from RFC 5054 */ # define TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA "SRP-3DES-EDE-CBC-SHA" # define TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "SRP-RSA-3DES-EDE-CBC-SHA" # define TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "SRP-DSS-3DES-EDE-CBC-SHA" # define TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA "SRP-AES-128-CBC-SHA" # define TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "SRP-RSA-AES-128-CBC-SHA" # define TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "SRP-DSS-AES-128-CBC-SHA" # define TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA "SRP-AES-256-CBC-SHA" # define TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "SRP-RSA-AES-256-CBC-SHA" # define TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "SRP-DSS-AES-256-CBC-SHA" /* Camellia ciphersuites from RFC4132 */ # define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA "CAMELLIA128-SHA" # define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA "DH-DSS-CAMELLIA128-SHA" # define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA "DH-RSA-CAMELLIA128-SHA" # define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "DHE-DSS-CAMELLIA128-SHA" # define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "DHE-RSA-CAMELLIA128-SHA" # define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA "ADH-CAMELLIA128-SHA" # define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA "CAMELLIA256-SHA" # define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA "DH-DSS-CAMELLIA256-SHA" # define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA "DH-RSA-CAMELLIA256-SHA" # define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "DHE-DSS-CAMELLIA256-SHA" # define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "DHE-RSA-CAMELLIA256-SHA" # define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA "ADH-CAMELLIA256-SHA" /* SEED ciphersuites from RFC4162 */ # define TLS1_TXT_RSA_WITH_SEED_SHA "SEED-SHA" # define TLS1_TXT_DH_DSS_WITH_SEED_SHA "DH-DSS-SEED-SHA" # define TLS1_TXT_DH_RSA_WITH_SEED_SHA "DH-RSA-SEED-SHA" # define TLS1_TXT_DHE_DSS_WITH_SEED_SHA "DHE-DSS-SEED-SHA" # define TLS1_TXT_DHE_RSA_WITH_SEED_SHA "DHE-RSA-SEED-SHA" # define TLS1_TXT_ADH_WITH_SEED_SHA "ADH-SEED-SHA" /* TLS v1.2 ciphersuites */ # define TLS1_TXT_RSA_WITH_NULL_SHA256 "NULL-SHA256" # define TLS1_TXT_RSA_WITH_AES_128_SHA256 "AES128-SHA256" # define TLS1_TXT_RSA_WITH_AES_256_SHA256 "AES256-SHA256" # define TLS1_TXT_DH_DSS_WITH_AES_128_SHA256 "DH-DSS-AES128-SHA256" # define TLS1_TXT_DH_RSA_WITH_AES_128_SHA256 "DH-RSA-AES128-SHA256" # define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256 "DHE-DSS-AES128-SHA256" # define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256 "DHE-RSA-AES128-SHA256" # define TLS1_TXT_DH_DSS_WITH_AES_256_SHA256 "DH-DSS-AES256-SHA256" # define TLS1_TXT_DH_RSA_WITH_AES_256_SHA256 "DH-RSA-AES256-SHA256" # define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256 "DHE-DSS-AES256-SHA256" # define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256 "DHE-RSA-AES256-SHA256" # define TLS1_TXT_ADH_WITH_AES_128_SHA256 "ADH-AES128-SHA256" # define TLS1_TXT_ADH_WITH_AES_256_SHA256 "ADH-AES256-SHA256" /* TLS v1.2 GCM ciphersuites from RFC5288 */ # define TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256 "AES128-GCM-SHA256" # define TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384 "AES256-GCM-SHA384" # define TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256 "DHE-RSA-AES128-GCM-SHA256" # define TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384 "DHE-RSA-AES256-GCM-SHA384" # define TLS1_TXT_DH_RSA_WITH_AES_128_GCM_SHA256 "DH-RSA-AES128-GCM-SHA256" # define TLS1_TXT_DH_RSA_WITH_AES_256_GCM_SHA384 "DH-RSA-AES256-GCM-SHA384" # define TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256 "DHE-DSS-AES128-GCM-SHA256" # define TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384 "DHE-DSS-AES256-GCM-SHA384" # define TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256 "DH-DSS-AES128-GCM-SHA256" # define TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384 "DH-DSS-AES256-GCM-SHA384" # define TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256 "ADH-AES128-GCM-SHA256" # define TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384 "ADH-AES256-GCM-SHA384" /* ECDH HMAC based ciphersuites from RFC5289 */ # define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256 "ECDHE-ECDSA-AES128-SHA256" # define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384 "ECDHE-ECDSA-AES256-SHA384" # define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_SHA256 "ECDH-ECDSA-AES128-SHA256" # define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_SHA384 "ECDH-ECDSA-AES256-SHA384" # define TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256 "ECDHE-RSA-AES128-SHA256" # define TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384 "ECDHE-RSA-AES256-SHA384" # define TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256 "ECDH-RSA-AES128-SHA256" # define TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384 "ECDH-RSA-AES256-SHA384" /* ECDH GCM based ciphersuites from RFC5289 */ # define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 "ECDHE-ECDSA-AES128-GCM-SHA256" # define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 "ECDHE-ECDSA-AES256-GCM-SHA384" # define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 "ECDH-ECDSA-AES128-GCM-SHA256" # define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 "ECDH-ECDSA-AES256-GCM-SHA384" # define TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "ECDHE-RSA-AES128-GCM-SHA256" # define TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "ECDHE-RSA-AES256-GCM-SHA384" # define TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256 "ECDH-RSA-AES128-GCM-SHA256" # define TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384 "ECDH-RSA-AES256-GCM-SHA384" # define TLS_CT_RSA_SIGN 1 # define TLS_CT_DSS_SIGN 2 # define TLS_CT_RSA_FIXED_DH 3 # define TLS_CT_DSS_FIXED_DH 4 # define TLS_CT_ECDSA_SIGN 64 # define TLS_CT_RSA_FIXED_ECDH 65 # define TLS_CT_ECDSA_FIXED_ECDH 66 # define TLS_CT_GOST94_SIGN 21 # define TLS_CT_GOST01_SIGN 22 /* * when correcting this number, correct also SSL3_CT_NUMBER in ssl3.h (see * comment there) */ # define TLS_CT_NUMBER 9 # define TLS1_FINISH_MAC_LENGTH 12 # define TLS_MD_MAX_CONST_SIZE 20 # define TLS_MD_CLIENT_FINISH_CONST "client finished" # define TLS_MD_CLIENT_FINISH_CONST_SIZE 15 # define TLS_MD_SERVER_FINISH_CONST "server finished" # define TLS_MD_SERVER_FINISH_CONST_SIZE 15 # define TLS_MD_SERVER_WRITE_KEY_CONST "server write key" # define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE 16 # define TLS_MD_KEY_EXPANSION_CONST "key expansion" # define TLS_MD_KEY_EXPANSION_CONST_SIZE 13 # define TLS_MD_CLIENT_WRITE_KEY_CONST "client write key" # define TLS_MD_CLIENT_WRITE_KEY_CONST_SIZE 16 # define TLS_MD_SERVER_WRITE_KEY_CONST "server write key" # define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE 16 # define TLS_MD_IV_BLOCK_CONST "IV block" # define TLS_MD_IV_BLOCK_CONST_SIZE 8 # define TLS_MD_MASTER_SECRET_CONST "master secret" # define TLS_MD_MASTER_SECRET_CONST_SIZE 13 # ifdef CHARSET_EBCDIC # undef TLS_MD_CLIENT_FINISH_CONST /* * client finished */ # define TLS_MD_CLIENT_FINISH_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x66\x69\x6e\x69\x73\x68\x65\x64" # undef TLS_MD_SERVER_FINISH_CONST /* * server finished */ # define TLS_MD_SERVER_FINISH_CONST "\x73\x65\x72\x76\x65\x72\x20\x66\x69\x6e\x69\x73\x68\x65\x64" # undef TLS_MD_SERVER_WRITE_KEY_CONST /* * server write key */ # define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" # undef TLS_MD_KEY_EXPANSION_CONST /* * key expansion */ # define TLS_MD_KEY_EXPANSION_CONST "\x6b\x65\x79\x20\x65\x78\x70\x61\x6e\x73\x69\x6f\x6e" # undef TLS_MD_CLIENT_WRITE_KEY_CONST /* * client write key */ # define TLS_MD_CLIENT_WRITE_KEY_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" # undef TLS_MD_SERVER_WRITE_KEY_CONST /* * server write key */ # define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" # undef TLS_MD_IV_BLOCK_CONST /* * IV block */ # define TLS_MD_IV_BLOCK_CONST "\x49\x56\x20\x62\x6c\x6f\x63\x6b" # undef TLS_MD_MASTER_SECRET_CONST /* * master secret */ # define TLS_MD_MASTER_SECRET_CONST "\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" # endif /* TLS Session Ticket extension struct */ struct tls_session_ticket_ext_st { unsigned short length; void *data; }; #ifdef __cplusplus } #endif #endif �������������������������openssl/asn1t.h�������������������������������������������������������������������������������������0000644�����������������00000103253�14763166030�0007440 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* asn1t.h */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project * 2000. */ /* ==================================================================== * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * licensing@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_ASN1T_H # define HEADER_ASN1T_H # include <stddef.h> # include <openssl/e_os2.h> # include <openssl/asn1.h> # ifdef OPENSSL_BUILD_SHLIBCRYPTO # undef OPENSSL_EXTERN # define OPENSSL_EXTERN OPENSSL_EXPORT # endif /* ASN1 template defines, structures and functions */ #ifdef __cplusplus extern "C" { #endif # ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION /* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ # define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr)) /* Macros for start and end of ASN1_ITEM definition */ # define ASN1_ITEM_start(itname) \ OPENSSL_GLOBAL const ASN1_ITEM itname##_it = { # define ASN1_ITEM_end(itname) \ }; # else /* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ # define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr())) /* Macros for start and end of ASN1_ITEM definition */ # define ASN1_ITEM_start(itname) \ const ASN1_ITEM * itname##_it(void) \ { \ static const ASN1_ITEM local_it = { # define ASN1_ITEM_end(itname) \ }; \ return &local_it; \ } # endif /* Macros to aid ASN1 template writing */ # define ASN1_ITEM_TEMPLATE(tname) \ static const ASN1_TEMPLATE tname##_item_tt # define ASN1_ITEM_TEMPLATE_END(tname) \ ;\ ASN1_ITEM_start(tname) \ ASN1_ITYPE_PRIMITIVE,\ -1,\ &tname##_item_tt,\ 0,\ NULL,\ 0,\ #tname \ ASN1_ITEM_end(tname) /* This is a ASN1 type which just embeds a template */ /*- * This pair helps declare a SEQUENCE. We can do: * * ASN1_SEQUENCE(stname) = { * ... SEQUENCE components ... * } ASN1_SEQUENCE_END(stname) * * This will produce an ASN1_ITEM called stname_it * for a structure called stname. * * If you want the same structure but a different * name then use: * * ASN1_SEQUENCE(itname) = { * ... SEQUENCE components ... * } ASN1_SEQUENCE_END_name(stname, itname) * * This will create an item called itname_it using * a structure called stname. */ # define ASN1_SEQUENCE(tname) \ static const ASN1_TEMPLATE tname##_seq_tt[] # define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname) # define ASN1_SEQUENCE_END_name(stname, tname) \ ;\ ASN1_ITEM_start(tname) \ ASN1_ITYPE_SEQUENCE,\ V_ASN1_SEQUENCE,\ tname##_seq_tt,\ sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ NULL,\ sizeof(stname),\ #stname \ ASN1_ITEM_end(tname) # define ASN1_NDEF_SEQUENCE(tname) \ ASN1_SEQUENCE(tname) # define ASN1_NDEF_SEQUENCE_cb(tname, cb) \ ASN1_SEQUENCE_cb(tname, cb) # define ASN1_SEQUENCE_cb(tname, cb) \ static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ ASN1_SEQUENCE(tname) # define ASN1_BROKEN_SEQUENCE(tname) \ static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \ ASN1_SEQUENCE(tname) # define ASN1_SEQUENCE_ref(tname, cb, lck) \ static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \ ASN1_SEQUENCE(tname) # define ASN1_SEQUENCE_enc(tname, enc, cb) \ static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \ ASN1_SEQUENCE(tname) # define ASN1_NDEF_SEQUENCE_END(tname) \ ;\ ASN1_ITEM_start(tname) \ ASN1_ITYPE_NDEF_SEQUENCE,\ V_ASN1_SEQUENCE,\ tname##_seq_tt,\ sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ NULL,\ sizeof(tname),\ #tname \ ASN1_ITEM_end(tname) # define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname) # define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) # define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) # define ASN1_SEQUENCE_END_ref(stname, tname) \ ;\ ASN1_ITEM_start(tname) \ ASN1_ITYPE_SEQUENCE,\ V_ASN1_SEQUENCE,\ tname##_seq_tt,\ sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ &tname##_aux,\ sizeof(stname),\ #stname \ ASN1_ITEM_end(tname) # define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \ ;\ ASN1_ITEM_start(tname) \ ASN1_ITYPE_NDEF_SEQUENCE,\ V_ASN1_SEQUENCE,\ tname##_seq_tt,\ sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ &tname##_aux,\ sizeof(stname),\ #stname \ ASN1_ITEM_end(tname) /*- * This pair helps declare a CHOICE type. We can do: * * ASN1_CHOICE(chname) = { * ... CHOICE options ... * ASN1_CHOICE_END(chname) * * This will produce an ASN1_ITEM called chname_it * for a structure called chname. The structure * definition must look like this: * typedef struct { * int type; * union { * ASN1_SOMETHING *opt1; * ASN1_SOMEOTHER *opt2; * } value; * } chname; * * the name of the selector must be 'type'. * to use an alternative selector name use the * ASN1_CHOICE_END_selector() version. */ # define ASN1_CHOICE(tname) \ static const ASN1_TEMPLATE tname##_ch_tt[] # define ASN1_CHOICE_cb(tname, cb) \ static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ ASN1_CHOICE(tname) # define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname) # define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type) # define ASN1_CHOICE_END_selector(stname, tname, selname) \ ;\ ASN1_ITEM_start(tname) \ ASN1_ITYPE_CHOICE,\ offsetof(stname,selname) ,\ tname##_ch_tt,\ sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ NULL,\ sizeof(stname),\ #stname \ ASN1_ITEM_end(tname) # define ASN1_CHOICE_END_cb(stname, tname, selname) \ ;\ ASN1_ITEM_start(tname) \ ASN1_ITYPE_CHOICE,\ offsetof(stname,selname) ,\ tname##_ch_tt,\ sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ &tname##_aux,\ sizeof(stname),\ #stname \ ASN1_ITEM_end(tname) /* This helps with the template wrapper form of ASN1_ITEM */ # define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \ (flags), (tag), 0,\ #name, ASN1_ITEM_ref(type) } /* These help with SEQUENCE or CHOICE components */ /* used to declare other types */ # define ASN1_EX_TYPE(flags, tag, stname, field, type) { \ (flags), (tag), offsetof(stname, field),\ #field, ASN1_ITEM_ref(type) } /* used when the structure is combined with the parent */ # define ASN1_EX_COMBINE(flags, tag, type) { \ (flags)|ASN1_TFLG_COMBINE, (tag), 0, NULL, ASN1_ITEM_ref(type) } /* implicit and explicit helper macros */ # define ASN1_IMP_EX(stname, field, type, tag, ex) \ ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | ex, tag, stname, field, type) # define ASN1_EXP_EX(stname, field, type, tag, ex) \ ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | ex, tag, stname, field, type) /* Any defined by macros: the field used is in the table itself */ # ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION # define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } # define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } # else # define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb } # define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb } # endif /* Plain simple type */ # define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type) /* OPTIONAL simple type */ # define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type) /* IMPLICIT tagged simple type */ # define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0) /* IMPLICIT tagged OPTIONAL simple type */ # define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) /* Same as above but EXPLICIT */ # define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0) # define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) /* SEQUENCE OF type */ # define ASN1_SEQUENCE_OF(stname, field, type) \ ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type) /* OPTIONAL SEQUENCE OF */ # define ASN1_SEQUENCE_OF_OPT(stname, field, type) \ ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) /* Same as above but for SET OF */ # define ASN1_SET_OF(stname, field, type) \ ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type) # define ASN1_SET_OF_OPT(stname, field, type) \ ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) /* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */ # define ASN1_IMP_SET_OF(stname, field, type, tag) \ ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) # define ASN1_EXP_SET_OF(stname, field, type, tag) \ ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) # define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \ ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) # define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \ ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) # define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \ ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) # define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \ ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) # define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \ ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) # define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \ ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) /* EXPLICIT using indefinite length constructed form */ # define ASN1_NDEF_EXP(stname, field, type, tag) \ ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF) /* EXPLICIT OPTIONAL using indefinite length constructed form */ # define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \ ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF) /* Macros for the ASN1_ADB structure */ # define ASN1_ADB(name) \ static const ASN1_ADB_TABLE name##_adbtbl[] # ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION # define ASN1_ADB_END(name, flags, field, app_table, def, none) \ ;\ static const ASN1_ADB name##_adb = {\ flags,\ offsetof(name, field),\ app_table,\ name##_adbtbl,\ sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ def,\ none\ } # else # define ASN1_ADB_END(name, flags, field, app_table, def, none) \ ;\ static const ASN1_ITEM *name##_adb(void) \ { \ static const ASN1_ADB internal_adb = \ {\ flags,\ offsetof(name, field),\ app_table,\ name##_adbtbl,\ sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ def,\ none\ }; \ return (const ASN1_ITEM *) &internal_adb; \ } \ void dummy_function(void) # endif # define ADB_ENTRY(val, template) {val, template} # define ASN1_ADB_TEMPLATE(name) \ static const ASN1_TEMPLATE name##_tt /* * This is the ASN1 template structure that defines a wrapper round the * actual type. It determines the actual position of the field in the value * structure, various flags such as OPTIONAL and the field name. */ struct ASN1_TEMPLATE_st { unsigned long flags; /* Various flags */ long tag; /* tag, not used if no tagging */ unsigned long offset; /* Offset of this field in structure */ # ifndef NO_ASN1_FIELD_NAMES const char *field_name; /* Field name */ # endif ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */ }; /* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */ # define ASN1_TEMPLATE_item(t) (t->item_ptr) # define ASN1_TEMPLATE_adb(t) (t->item_ptr) typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE; typedef struct ASN1_ADB_st ASN1_ADB; struct ASN1_ADB_st { unsigned long flags; /* Various flags */ unsigned long offset; /* Offset of selector field */ STACK_OF(ASN1_ADB_TABLE) **app_items; /* Application defined items */ const ASN1_ADB_TABLE *tbl; /* Table of possible types */ long tblcount; /* Number of entries in tbl */ const ASN1_TEMPLATE *default_tt; /* Type to use if no match */ const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */ }; struct ASN1_ADB_TABLE_st { long value; /* NID for an object or value for an int */ const ASN1_TEMPLATE tt; /* item for this value */ }; /* template flags */ /* Field is optional */ # define ASN1_TFLG_OPTIONAL (0x1) /* Field is a SET OF */ # define ASN1_TFLG_SET_OF (0x1 << 1) /* Field is a SEQUENCE OF */ # define ASN1_TFLG_SEQUENCE_OF (0x2 << 1) /* * Special case: this refers to a SET OF that will be sorted into DER order * when encoded *and* the corresponding STACK will be modified to match the * new order. */ # define ASN1_TFLG_SET_ORDER (0x3 << 1) /* Mask for SET OF or SEQUENCE OF */ # define ASN1_TFLG_SK_MASK (0x3 << 1) /* * These flags mean the tag should be taken from the tag field. If EXPLICIT * then the underlying type is used for the inner tag. */ /* IMPLICIT tagging */ # define ASN1_TFLG_IMPTAG (0x1 << 3) /* EXPLICIT tagging, inner tag from underlying type */ # define ASN1_TFLG_EXPTAG (0x2 << 3) # define ASN1_TFLG_TAG_MASK (0x3 << 3) /* context specific IMPLICIT */ # define ASN1_TFLG_IMPLICIT ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT /* context specific EXPLICIT */ # define ASN1_TFLG_EXPLICIT ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT /* * If tagging is in force these determine the type of tag to use. Otherwise * the tag is determined by the underlying type. These values reflect the * actual octet format. */ /* Universal tag */ # define ASN1_TFLG_UNIVERSAL (0x0<<6) /* Application tag */ # define ASN1_TFLG_APPLICATION (0x1<<6) /* Context specific tag */ # define ASN1_TFLG_CONTEXT (0x2<<6) /* Private tag */ # define ASN1_TFLG_PRIVATE (0x3<<6) # define ASN1_TFLG_TAG_CLASS (0x3<<6) /* * These are for ANY DEFINED BY type. In this case the 'item' field points to * an ASN1_ADB structure which contains a table of values to decode the * relevant type */ # define ASN1_TFLG_ADB_MASK (0x3<<8) # define ASN1_TFLG_ADB_OID (0x1<<8) # define ASN1_TFLG_ADB_INT (0x1<<9) /* * This flag means a parent structure is passed instead of the field: this is * useful is a SEQUENCE is being combined with a CHOICE for example. Since * this means the structure and item name will differ we need to use the * ASN1_CHOICE_END_name() macro for example. */ # define ASN1_TFLG_COMBINE (0x1<<10) /* * This flag when present in a SEQUENCE OF, SET OF or EXPLICIT causes * indefinite length constructed encoding to be used if required. */ # define ASN1_TFLG_NDEF (0x1<<11) /* This is the actual ASN1 item itself */ struct ASN1_ITEM_st { char itype; /* The item type, primitive, SEQUENCE, CHOICE * or extern */ long utype; /* underlying type */ const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains * the contents */ long tcount; /* Number of templates if SEQUENCE or CHOICE */ const void *funcs; /* functions that handle this type */ long size; /* Structure size (usually) */ # ifndef NO_ASN1_FIELD_NAMES const char *sname; /* Structure name */ # endif }; /*- * These are values for the itype field and * determine how the type is interpreted. * * For PRIMITIVE types the underlying type * determines the behaviour if items is NULL. * * Otherwise templates must contain a single * template and the type is treated in the * same way as the type specified in the template. * * For SEQUENCE types the templates field points * to the members, the size field is the * structure size. * * For CHOICE types the templates field points * to each possible member (typically a union) * and the 'size' field is the offset of the * selector. * * The 'funcs' field is used for application * specific functions. * * For COMPAT types the funcs field gives a * set of functions that handle this type, this * supports the old d2i, i2d convention. * * The EXTERN type uses a new style d2i/i2d. * The new style should be used where possible * because it avoids things like the d2i IMPLICIT * hack. * * MSTRING is a multiple string type, it is used * for a CHOICE of character strings where the * actual strings all occupy an ASN1_STRING * structure. In this case the 'utype' field * has a special meaning, it is used as a mask * of acceptable types using the B_ASN1 constants. * * NDEF_SEQUENCE is the same as SEQUENCE except * that it will use indefinite length constructed * encoding if requested. * */ # define ASN1_ITYPE_PRIMITIVE 0x0 # define ASN1_ITYPE_SEQUENCE 0x1 # define ASN1_ITYPE_CHOICE 0x2 # define ASN1_ITYPE_COMPAT 0x3 # define ASN1_ITYPE_EXTERN 0x4 # define ASN1_ITYPE_MSTRING 0x5 # define ASN1_ITYPE_NDEF_SEQUENCE 0x6 /* * Cache for ASN1 tag and length, so we don't keep re-reading it for things * like CHOICE */ struct ASN1_TLC_st { char valid; /* Values below are valid */ int ret; /* return value */ long plen; /* length */ int ptag; /* class value */ int pclass; /* class value */ int hdrlen; /* header length */ }; /* Typedefs for ASN1 function pointers */ typedef ASN1_VALUE *ASN1_new_func(void); typedef void ASN1_free_func(ASN1_VALUE *a); typedef ASN1_VALUE *ASN1_d2i_func(ASN1_VALUE **a, const unsigned char **in, long length); typedef int ASN1_i2d_func(ASN1_VALUE *a, unsigned char **in); typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it, int tag, int aclass, char opt, ASN1_TLC *ctx); typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass); typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval, int indent, const char *fname, const ASN1_PCTX *pctx); typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, int indent, const ASN1_PCTX *pctx); typedef struct ASN1_COMPAT_FUNCS_st { ASN1_new_func *asn1_new; ASN1_free_func *asn1_free; ASN1_d2i_func *asn1_d2i; ASN1_i2d_func *asn1_i2d; } ASN1_COMPAT_FUNCS; typedef struct ASN1_EXTERN_FUNCS_st { void *app_data; ASN1_ex_new_func *asn1_ex_new; ASN1_ex_free_func *asn1_ex_free; ASN1_ex_free_func *asn1_ex_clear; ASN1_ex_d2i *asn1_ex_d2i; ASN1_ex_i2d *asn1_ex_i2d; ASN1_ex_print_func *asn1_ex_print; } ASN1_EXTERN_FUNCS; typedef struct ASN1_PRIMITIVE_FUNCS_st { void *app_data; unsigned long flags; ASN1_ex_new_func *prim_new; ASN1_ex_free_func *prim_free; ASN1_ex_free_func *prim_clear; ASN1_primitive_c2i *prim_c2i; ASN1_primitive_i2c *prim_i2c; ASN1_primitive_print *prim_print; } ASN1_PRIMITIVE_FUNCS; /* * This is the ASN1_AUX structure: it handles various miscellaneous * requirements. For example the use of reference counts and an informational * callback. The "informational callback" is called at various points during * the ASN1 encoding and decoding. It can be used to provide minor * customisation of the structures used. This is most useful where the * supplied routines *almost* do the right thing but need some extra help at * a few points. If the callback returns zero then it is assumed a fatal * error has occurred and the main operation should be abandoned. If major * changes in the default behaviour are required then an external type is * more appropriate. */ typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it, void *exarg); typedef struct ASN1_AUX_st { void *app_data; int flags; int ref_offset; /* Offset of reference value */ int ref_lock; /* Lock type to use */ ASN1_aux_cb *asn1_cb; int enc_offset; /* Offset of ASN1_ENCODING structure */ } ASN1_AUX; /* For print related callbacks exarg points to this structure */ typedef struct ASN1_PRINT_ARG_st { BIO *out; int indent; const ASN1_PCTX *pctx; } ASN1_PRINT_ARG; /* For streaming related callbacks exarg points to this structure */ typedef struct ASN1_STREAM_ARG_st { /* BIO to stream through */ BIO *out; /* BIO with filters appended */ BIO *ndef_bio; /* Streaming I/O boundary */ unsigned char **boundary; } ASN1_STREAM_ARG; /* Flags in ASN1_AUX */ /* Use a reference count */ # define ASN1_AFLG_REFCOUNT 1 /* Save the encoding of structure (useful for signatures) */ # define ASN1_AFLG_ENCODING 2 /* The Sequence length is invalid */ # define ASN1_AFLG_BROKEN 4 /* operation values for asn1_cb */ # define ASN1_OP_NEW_PRE 0 # define ASN1_OP_NEW_POST 1 # define ASN1_OP_FREE_PRE 2 # define ASN1_OP_FREE_POST 3 # define ASN1_OP_D2I_PRE 4 # define ASN1_OP_D2I_POST 5 # define ASN1_OP_I2D_PRE 6 # define ASN1_OP_I2D_POST 7 # define ASN1_OP_PRINT_PRE 8 # define ASN1_OP_PRINT_POST 9 # define ASN1_OP_STREAM_PRE 10 # define ASN1_OP_STREAM_POST 11 # define ASN1_OP_DETACHED_PRE 12 # define ASN1_OP_DETACHED_POST 13 /* Macro to implement a primitive type */ # define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) # define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \ ASN1_ITEM_start(itname) \ ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \ ASN1_ITEM_end(itname) /* Macro to implement a multi string type */ # define IMPLEMENT_ASN1_MSTRING(itname, mask) \ ASN1_ITEM_start(itname) \ ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \ ASN1_ITEM_end(itname) /* Macro to implement an ASN1_ITEM in terms of old style funcs */ # define IMPLEMENT_COMPAT_ASN1(sname) IMPLEMENT_COMPAT_ASN1_type(sname, V_ASN1_SEQUENCE) # define IMPLEMENT_COMPAT_ASN1_type(sname, tag) \ static const ASN1_COMPAT_FUNCS sname##_ff = { \ (ASN1_new_func *)sname##_new, \ (ASN1_free_func *)sname##_free, \ (ASN1_d2i_func *)d2i_##sname, \ (ASN1_i2d_func *)i2d_##sname, \ }; \ ASN1_ITEM_start(sname) \ ASN1_ITYPE_COMPAT, \ tag, \ NULL, \ 0, \ &sname##_ff, \ 0, \ #sname \ ASN1_ITEM_end(sname) # define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \ ASN1_ITEM_start(sname) \ ASN1_ITYPE_EXTERN, \ tag, \ NULL, \ 0, \ &fptrs, \ 0, \ #sname \ ASN1_ITEM_end(sname) /* Macro to implement standard functions in terms of ASN1_ITEM structures */ # define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname) # define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname) # define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) # define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \ IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname) # define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) # define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \ pre stname *fname##_new(void) \ { \ return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ } \ pre void fname##_free(stname *a) \ { \ ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ } # define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ stname *fname##_new(void) \ { \ return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ } \ void fname##_free(stname *a) \ { \ ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ } # define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \ IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) # define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ { \ return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ } \ int i2d_##fname(stname *a, unsigned char **out) \ { \ return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ } # define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \ int i2d_##stname##_NDEF(stname *a, unsigned char **out) \ { \ return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\ } /* * This includes evil casts to remove const: they will go away when full ASN1 * constification is done. */ # define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ { \ return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ } \ int i2d_##fname(const stname *a, unsigned char **out) \ { \ return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ } # define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \ stname * stname##_dup(stname *x) \ { \ return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ } # define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \ IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname) # define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \ int fname##_print_ctx(BIO *out, stname *x, int indent, \ const ASN1_PCTX *pctx) \ { \ return ASN1_item_print(out, (ASN1_VALUE *)x, indent, \ ASN1_ITEM_rptr(itname), pctx); \ } # define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) # define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \ IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) /* external definitions for primitive types */ DECLARE_ASN1_ITEM(ASN1_BOOLEAN) DECLARE_ASN1_ITEM(ASN1_TBOOLEAN) DECLARE_ASN1_ITEM(ASN1_FBOOLEAN) DECLARE_ASN1_ITEM(ASN1_SEQUENCE) DECLARE_ASN1_ITEM(CBIGNUM) DECLARE_ASN1_ITEM(BIGNUM) DECLARE_ASN1_ITEM(LONG) DECLARE_ASN1_ITEM(ZLONG) DECLARE_STACK_OF(ASN1_VALUE) /* Functions used internally by the ASN1 code */ int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it); int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it); void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); int ASN1_template_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_TEMPLATE *tt); int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it, int tag, int aclass, char opt, ASN1_TLC *ctx); int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass); int ASN1_template_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_TEMPLATE *tt); void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it); int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); int asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it); int asn1_set_choice_selector(ASN1_VALUE **pval, int value, const ASN1_ITEM *it); ASN1_VALUE **asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); const ASN1_TEMPLATE *asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt, int nullerr); int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it); void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it); void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it); int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval, const ASN1_ITEM *it); int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen, const ASN1_ITEM *it); #ifdef __cplusplus } #endif #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/fips.h��������������������������������������������������������������������������������������0000644�����������������00000032477�14763166030�0007364 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ==================================================================== * Copyright (c) 2003 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */ #include <openssl/opensslconf.h> #include <openssl/crypto.h> #include <stdarg.h> #ifndef OPENSSL_FIPS # error FIPS is disabled. #endif #ifdef OPENSSL_FIPS # ifdef __cplusplus extern "C" { # endif struct dsa_st; struct rsa_st; struct evp_pkey_st; struct env_md_st; struct env_md_ctx_st; struct evp_cipher_st; struct evp_cipher_ctx_st; struct dh_method; struct CMAC_CTX_st; struct hmac_ctx_st; int FIPS_module_mode_set(int onoff, const char *auth); int FIPS_module_mode(void); int FIPS_module_installed(void); const void *FIPS_rand_check(void); int FIPS_selftest(void); int FIPS_selftest_failed(void); void FIPS_corrupt_sha1(void); int FIPS_selftest_sha1(void); int FIPS_selftest_sha2(void); void FIPS_corrupt_aes(void); int FIPS_selftest_aes_ccm(void); int FIPS_selftest_aes_gcm(void); int FIPS_selftest_aes_xts(void); int FIPS_selftest_aes(void); void FIPS_corrupt_des(void); int FIPS_selftest_des(void); void FIPS_corrupt_rsa(void); void FIPS_corrupt_rsa_keygen(void); int FIPS_selftest_rsa(void); void FIPS_corrupt_dsa(void); void FIPS_corrupt_dsa_keygen(void); int FIPS_selftest_dsa(void); int FIPS_selftest_ecdsa(void); int FIPS_selftest_ecdh(void); int FIPS_selftest_dh(void); void FIPS_corrupt_rng(void); void FIPS_rng_stick(void); void FIPS_x931_stick(int onoff); void FIPS_drbg_stick(int onoff); int FIPS_selftest_rng(void); int FIPS_selftest_x931(void); int FIPS_selftest_hmac(void); int FIPS_selftest_drbg(void); int FIPS_selftest_drbg_all(void); int FIPS_selftest_cmac(void); void FIPS_get_timevec(unsigned char *buf, unsigned long *pctr); # define FIPS_ERROR_IGNORED(alg) OpenSSLDie(__FILE__, __LINE__, \ alg " previous FIPS forbidden algorithm error ignored"); int fips_pkey_signature_test(struct evp_pkey_st *pkey, const unsigned char *tbs, int tbslen, const unsigned char *kat, unsigned int katlen, const struct env_md_st *digest, unsigned int md_flags, const char *fail_str); int fips_cipher_test(struct evp_cipher_ctx_st *ctx, const struct evp_cipher_st *cipher, const unsigned char *key, const unsigned char *iv, const unsigned char *plaintext, const unsigned char *ciphertext, int len); void fips_set_selftest_fail(void); const struct env_md_st *FIPS_get_digestbynid(int nid); const struct evp_cipher_st *FIPS_get_cipherbynid(int nid); /* BEGIN ERROR CODES */ /* The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_FIPS_strings(void); /* Error codes for the FIPS functions. */ /* Function codes. */ # define FIPS_F_DH_BUILTIN_GENPARAMS 100 # define FIPS_F_DH_INIT 148 # define FIPS_F_DRBG_RESEED 162 # define FIPS_F_DSA_BUILTIN_PARAMGEN 101 # define FIPS_F_DSA_BUILTIN_PARAMGEN2 107 # define FIPS_F_DSA_DO_SIGN 102 # define FIPS_F_DSA_DO_VERIFY 103 # define FIPS_F_ECDH_COMPUTE_KEY 163 # define FIPS_F_ECDSA_DO_SIGN 164 # define FIPS_F_ECDSA_DO_VERIFY 165 # define FIPS_F_EC_KEY_GENERATE_KEY 166 # define FIPS_F_EVP_CIPHERINIT_EX 124 # define FIPS_F_EVP_DIGESTINIT_EX 125 # define FIPS_F_FIPS_CHECK_DSA 104 # define FIPS_F_FIPS_CHECK_DSA_PRNG 151 # define FIPS_F_FIPS_CHECK_EC 142 # define FIPS_F_FIPS_CHECK_EC_PRNG 152 # define FIPS_F_FIPS_CHECK_INCORE_FINGERPRINT 105 # define FIPS_F_FIPS_CHECK_RSA 106 # define FIPS_F_FIPS_CHECK_RSA_PRNG 150 # define FIPS_F_FIPS_CIPHER 160 # define FIPS_F_FIPS_CIPHERINIT 143 # define FIPS_F_FIPS_CIPHER_CTX_CTRL 161 # define FIPS_F_FIPS_DIGESTFINAL 158 # define FIPS_F_FIPS_DIGESTINIT 128 # define FIPS_F_FIPS_DIGESTUPDATE 159 # define FIPS_F_FIPS_DRBG_BYTES 131 # define FIPS_F_FIPS_DRBG_CHECK 146 # define FIPS_F_FIPS_DRBG_CPRNG_TEST 132 # define FIPS_F_FIPS_DRBG_ERROR_CHECK 136 # define FIPS_F_FIPS_DRBG_GENERATE 134 # define FIPS_F_FIPS_DRBG_INIT 135 # define FIPS_F_FIPS_DRBG_INSTANTIATE 138 # define FIPS_F_FIPS_DRBG_NEW 139 # define FIPS_F_FIPS_DRBG_RESEED 140 # define FIPS_F_FIPS_DRBG_SINGLE_KAT 141 # define FIPS_F_FIPS_DSA_CHECK /* unused */ 107 # define FIPS_F_FIPS_DSA_SIGN_DIGEST 154 # define FIPS_F_FIPS_DSA_VERIFY_DIGEST 155 # define FIPS_F_FIPS_GET_ENTROPY 147 # define FIPS_F_FIPS_MODE_SET /* unused */ 108 # define FIPS_F_FIPS_MODULE_MODE_SET 108 # define FIPS_F_FIPS_PKEY_SIGNATURE_TEST 109 # define FIPS_F_FIPS_RAND_ADD 137 # define FIPS_F_FIPS_RAND_BYTES 122 # define FIPS_F_FIPS_RAND_PSEUDO_BYTES 167 # define FIPS_F_FIPS_RAND_SEED 168 # define FIPS_F_FIPS_RAND_SET_METHOD 126 # define FIPS_F_FIPS_RAND_STATUS 127 # define FIPS_F_FIPS_RSA_SIGN_DIGEST 156 # define FIPS_F_FIPS_RSA_VERIFY_DIGEST 157 # define FIPS_F_FIPS_SELFTEST_AES 110 # define FIPS_F_FIPS_SELFTEST_AES_CCM 145 # define FIPS_F_FIPS_SELFTEST_AES_GCM 129 # define FIPS_F_FIPS_SELFTEST_AES_XTS 144 # define FIPS_F_FIPS_SELFTEST_CMAC 130 # define FIPS_F_FIPS_SELFTEST_DES 111 # define FIPS_F_FIPS_SELFTEST_DSA 112 # define FIPS_F_FIPS_SELFTEST_ECDSA 133 # define FIPS_F_FIPS_SELFTEST_HMAC 113 # define FIPS_F_FIPS_SELFTEST_RNG /* unused */ 114 # define FIPS_F_FIPS_SELFTEST_SHA1 115 # define FIPS_F_FIPS_SELFTEST_X931 114 # define FIPS_F_FIPS_SET_PRNG_KEY 153 # define FIPS_F_HASH_FINAL 123 # define FIPS_F_RSA_BUILTIN_KEYGEN 116 # define FIPS_F_RSA_EAY_INIT 149 # define FIPS_F_RSA_EAY_PRIVATE_DECRYPT 117 # define FIPS_F_RSA_EAY_PRIVATE_ENCRYPT 118 # define FIPS_F_RSA_EAY_PUBLIC_DECRYPT 119 # define FIPS_F_RSA_EAY_PUBLIC_ENCRYPT 120 # define FIPS_F_RSA_X931_GENERATE_KEY_EX 121 # define FIPS_F_SSLEAY_RAND_BYTES /* unused */ 122 /* Reason codes. */ # define FIPS_R_ADDITIONAL_INPUT_ERROR_UNDETECTED 150 # define FIPS_R_ADDITIONAL_INPUT_TOO_LONG 125 # define FIPS_R_ALREADY_INSTANTIATED 134 # define FIPS_R_AUTHENTICATION_FAILURE 151 # define FIPS_R_CANNOT_READ_EXE /* unused */ 103 # define FIPS_R_CANNOT_READ_EXE_DIGEST /* unused */ 104 # define FIPS_R_CONTRADICTING_EVIDENCE 114 # define FIPS_R_DRBG_NOT_INITIALISED 152 # define FIPS_R_DRBG_STUCK 103 # define FIPS_R_ENTROPY_ERROR_UNDETECTED 104 # define FIPS_R_ENTROPY_NOT_REQUESTED_FOR_RESEED 105 # define FIPS_R_ENTROPY_SOURCE_STUCK 142 # define FIPS_R_ERROR_INITIALISING_DRBG 115 # define FIPS_R_ERROR_INSTANTIATING_DRBG 127 # define FIPS_R_ERROR_RETRIEVING_ADDITIONAL_INPUT 124 # define FIPS_R_ERROR_RETRIEVING_ENTROPY 122 # define FIPS_R_ERROR_RETRIEVING_NONCE 140 # define FIPS_R_EXE_DIGEST_DOES_NOT_MATCH /* unused */ 105 # define FIPS_R_FINGERPRINT_DOES_NOT_MATCH 110 # define FIPS_R_FINGERPRINT_DOES_NOT_MATCH_NONPIC_RELOCATED 111 # define FIPS_R_FINGERPRINT_DOES_NOT_MATCH_SEGMENT_ALIASING 112 # define FIPS_R_FIPS_MODE_ALREADY_SET 102 # define FIPS_R_FIPS_SELFTEST_FAILED 106 # define FIPS_R_FUNCTION_ERROR 116 # define FIPS_R_GENERATE_ERROR 137 # define FIPS_R_GENERATE_ERROR_UNDETECTED 118 # define FIPS_R_INSTANTIATE_ERROR 119 # define FIPS_R_INSUFFICIENT_SECURITY_STRENGTH 120 # define FIPS_R_INTERNAL_ERROR 121 # define FIPS_R_INVALID_KEY_LENGTH 109 # define FIPS_R_INVALID_PARAMETERS 144 # define FIPS_R_IN_ERROR_STATE 123 # define FIPS_R_KEY_TOO_SHORT 108 # define FIPS_R_NONCE_ERROR_UNDETECTED 149 # define FIPS_R_NON_FIPS_METHOD 100 # define FIPS_R_NOPR_TEST1_FAILURE 145 # define FIPS_R_NOPR_TEST2_FAILURE 146 # define FIPS_R_NOT_INSTANTIATED 126 # define FIPS_R_PAIRWISE_TEST_FAILED 107 # define FIPS_R_PERSONALISATION_ERROR_UNDETECTED 128 # define FIPS_R_PERSONALISATION_STRING_TOO_LONG 129 # define FIPS_R_PRNG_STRENGTH_TOO_LOW 143 # define FIPS_R_PR_TEST1_FAILURE 147 # define FIPS_R_PR_TEST2_FAILURE 148 # define FIPS_R_REQUEST_LENGTH_ERROR_UNDETECTED 130 # define FIPS_R_REQUEST_TOO_LARGE_FOR_DRBG 131 # define FIPS_R_RESEED_COUNTER_ERROR 132 # define FIPS_R_RESEED_ERROR 133 # define FIPS_R_RSA_DECRYPT_ERROR /* unused */ 115 # define FIPS_R_RSA_ENCRYPT_ERROR /* unused */ 116 # define FIPS_R_SELFTEST_FAILED 101 # define FIPS_R_SELFTEST_FAILURE 135 # define FIPS_R_STRENGTH_ERROR_UNDETECTED 136 # define FIPS_R_TEST_FAILURE 117 # define FIPS_R_UNINSTANTIATE_ERROR 141 # define FIPS_R_UNINSTANTIATE_ZEROISE_ERROR 138 # define FIPS_R_UNSUPPORTED_DRBG_TYPE 139 # define FIPS_R_UNSUPPORTED_PLATFORM 113 # ifdef __cplusplus } # endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/evp.h���������������������������������������������������������������������������������������0000644�����������������00000205415�14763166030�0007207 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/evp/evp.h */ /* Copyright (C) 1995-2021 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_ENVELOPE_H # define HEADER_ENVELOPE_H # ifdef OPENSSL_ALGORITHM_DEFINES # include <openssl/opensslconf.h> # else # define OPENSSL_ALGORITHM_DEFINES # include <openssl/opensslconf.h> # undef OPENSSL_ALGORITHM_DEFINES # endif # include <openssl/ossl_typ.h> # include <openssl/symhacks.h> # ifndef OPENSSL_NO_BIO # include <openssl/bio.h> # endif /*- #define EVP_RC2_KEY_SIZE 16 #define EVP_RC4_KEY_SIZE 16 #define EVP_BLOWFISH_KEY_SIZE 16 #define EVP_CAST5_KEY_SIZE 16 #define EVP_RC5_32_12_16_KEY_SIZE 16 */ # define EVP_MAX_MD_SIZE 64/* longest known is SHA512 */ # define EVP_MAX_KEY_LENGTH 64 # define EVP_MAX_IV_LENGTH 16 # define EVP_MAX_BLOCK_LENGTH 32 # define PKCS5_SALT_LEN 8 /* Default PKCS#5 iteration count */ # define PKCS5_DEFAULT_ITER 2048 # include <openssl/objects.h> # define EVP_PK_RSA 0x0001 # define EVP_PK_DSA 0x0002 # define EVP_PK_DH 0x0004 # define EVP_PK_EC 0x0008 # define EVP_PKT_SIGN 0x0010 # define EVP_PKT_ENC 0x0020 # define EVP_PKT_EXCH 0x0040 # define EVP_PKS_RSA 0x0100 # define EVP_PKS_DSA 0x0200 # define EVP_PKS_EC 0x0400 # define EVP_PKEY_NONE NID_undef # define EVP_PKEY_RSA NID_rsaEncryption # define EVP_PKEY_RSA2 NID_rsa # define EVP_PKEY_DSA NID_dsa # define EVP_PKEY_DSA1 NID_dsa_2 # define EVP_PKEY_DSA2 NID_dsaWithSHA # define EVP_PKEY_DSA3 NID_dsaWithSHA1 # define EVP_PKEY_DSA4 NID_dsaWithSHA1_2 # define EVP_PKEY_DH NID_dhKeyAgreement # define EVP_PKEY_DHX NID_dhpublicnumber # define EVP_PKEY_EC NID_X9_62_id_ecPublicKey # define EVP_PKEY_HMAC NID_hmac # define EVP_PKEY_CMAC NID_cmac #ifdef __cplusplus extern "C" { #endif # ifdef OPENSSL_FIPS # include <openssl/fips.h> # endif /* * Type needs to be a bit field Sub-type needs to be for variations on the * method, as in, can it do arbitrary encryption.... */ struct evp_pkey_st { int type; int save_type; int references; const EVP_PKEY_ASN1_METHOD *ameth; ENGINE *engine; union { char *ptr; # ifndef OPENSSL_NO_RSA struct rsa_st *rsa; /* RSA */ # endif # ifndef OPENSSL_NO_DSA struct dsa_st *dsa; /* DSA */ # endif # ifndef OPENSSL_NO_DH struct dh_st *dh; /* DH */ # endif # ifndef OPENSSL_NO_EC struct ec_key_st *ec; /* ECC */ # endif } pkey; int save_parameters; STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */ } /* EVP_PKEY */ ; # define EVP_PKEY_MO_SIGN 0x0001 # define EVP_PKEY_MO_VERIFY 0x0002 # define EVP_PKEY_MO_ENCRYPT 0x0004 # define EVP_PKEY_MO_DECRYPT 0x0008 # ifndef EVP_MD struct env_md_st { int type; int pkey_type; int md_size; unsigned long flags; int (*init) (EVP_MD_CTX *ctx); int (*update) (EVP_MD_CTX *ctx, const void *data, size_t count); int (*final) (EVP_MD_CTX *ctx, unsigned char *md); int (*copy) (EVP_MD_CTX *to, const EVP_MD_CTX *from); int (*cleanup) (EVP_MD_CTX *ctx); /* FIXME: prototype these some day */ int (*sign) (int type, const unsigned char *m, unsigned int m_length, unsigned char *sigret, unsigned int *siglen, void *key); int (*verify) (int type, const unsigned char *m, unsigned int m_length, const unsigned char *sigbuf, unsigned int siglen, void *key); int required_pkey_type[5]; /* EVP_PKEY_xxx */ int block_size; int ctx_size; /* how big does the ctx->md_data need to be */ /* control function */ int (*md_ctrl) (EVP_MD_CTX *ctx, int cmd, int p1, void *p2); } /* EVP_MD */ ; typedef int evp_sign_method(int type, const unsigned char *m, unsigned int m_length, unsigned char *sigret, unsigned int *siglen, void *key); typedef int evp_verify_method(int type, const unsigned char *m, unsigned int m_length, const unsigned char *sigbuf, unsigned int siglen, void *key); /* digest can only handle a single block */ # define EVP_MD_FLAG_ONESHOT 0x0001 /* * digest is a "clone" digest used * which is a copy of an existing * one for a specific public key type. * EVP_dss1() etc */ # define EVP_MD_FLAG_PKEY_DIGEST 0x0002 /* Digest uses EVP_PKEY_METHOD for signing instead of MD specific signing */ # define EVP_MD_FLAG_PKEY_METHOD_SIGNATURE 0x0004 /* DigestAlgorithmIdentifier flags... */ # define EVP_MD_FLAG_DIGALGID_MASK 0x0018 /* NULL or absent parameter accepted. Use NULL */ # define EVP_MD_FLAG_DIGALGID_NULL 0x0000 /* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent */ # define EVP_MD_FLAG_DIGALGID_ABSENT 0x0008 /* Custom handling via ctrl */ # define EVP_MD_FLAG_DIGALGID_CUSTOM 0x0018 /* Note if suitable for use in FIPS mode */ # define EVP_MD_FLAG_FIPS 0x0400 /* Digest ctrls */ # define EVP_MD_CTRL_DIGALGID 0x1 # define EVP_MD_CTRL_MICALG 0x2 /* Minimum Algorithm specific ctrl value */ # define EVP_MD_CTRL_ALG_CTRL 0x1000 # define EVP_PKEY_NULL_method NULL,NULL,{0,0,0,0} # ifndef OPENSSL_NO_DSA # define EVP_PKEY_DSA_method (evp_sign_method *)DSA_sign, \ (evp_verify_method *)DSA_verify, \ {EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3, \ EVP_PKEY_DSA4,0} # else # define EVP_PKEY_DSA_method EVP_PKEY_NULL_method # endif # ifndef OPENSSL_NO_ECDSA # define EVP_PKEY_ECDSA_method (evp_sign_method *)ECDSA_sign, \ (evp_verify_method *)ECDSA_verify, \ {EVP_PKEY_EC,0,0,0} # else # define EVP_PKEY_ECDSA_method EVP_PKEY_NULL_method # endif # ifndef OPENSSL_NO_RSA # define EVP_PKEY_RSA_method (evp_sign_method *)RSA_sign, \ (evp_verify_method *)RSA_verify, \ {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0} # define EVP_PKEY_RSA_ASN1_OCTET_STRING_method \ (evp_sign_method *)RSA_sign_ASN1_OCTET_STRING, \ (evp_verify_method *)RSA_verify_ASN1_OCTET_STRING, \ {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0} # else # define EVP_PKEY_RSA_method EVP_PKEY_NULL_method # define EVP_PKEY_RSA_ASN1_OCTET_STRING_method EVP_PKEY_NULL_method # endif # endif /* !EVP_MD */ struct env_md_ctx_st { const EVP_MD *digest; ENGINE *engine; /* functional reference if 'digest' is * ENGINE-provided */ unsigned long flags; void *md_data; /* Public key context for sign/verify */ EVP_PKEY_CTX *pctx; /* Update function: usually copied from EVP_MD */ int (*update) (EVP_MD_CTX *ctx, const void *data, size_t count); } /* EVP_MD_CTX */ ; /* values for EVP_MD_CTX flags */ # define EVP_MD_CTX_FLAG_ONESHOT 0x0001/* digest update will be * called once only */ # define EVP_MD_CTX_FLAG_CLEANED 0x0002/* context has already been * cleaned */ # define EVP_MD_CTX_FLAG_REUSE 0x0004/* Don't free up ctx->md_data * in EVP_MD_CTX_cleanup */ # define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0x0008/* Allow use of non FIPS * digest in FIPS mode */ /* * The following PAD options are also currently ignored in 1.0.0, digest * parameters are handled through EVP_DigestSign*() and EVP_DigestVerify*() * instead. */ # define EVP_MD_CTX_FLAG_PAD_MASK 0xF0/* RSA mode to use */ # define EVP_MD_CTX_FLAG_PAD_PKCS1 0x00/* PKCS#1 v1.5 mode */ # define EVP_MD_CTX_FLAG_PAD_X931 0x10/* X9.31 mode */ # define EVP_MD_CTX_FLAG_PAD_PSS 0x20/* PSS mode */ # define M_EVP_MD_CTX_FLAG_PSS_SALT(ctx) \ ((ctx->flags>>16) &0xFFFF) /* seed length */ # define EVP_MD_CTX_FLAG_PSS_MDLEN 0xFFFF/* salt len same as digest */ # define EVP_MD_CTX_FLAG_PSS_MREC 0xFFFE/* salt max or auto recovered */ # define EVP_MD_CTX_FLAG_NO_INIT 0x0100/* Don't initialize md_data */ struct evp_cipher_st { int nid; int block_size; /* Default value for variable length ciphers */ int key_len; int iv_len; /* Various flags */ unsigned long flags; /* init key */ int (*init) (EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc); /* encrypt/decrypt data */ int (*do_cipher) (EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl); /* cleanup ctx */ int (*cleanup) (EVP_CIPHER_CTX *); /* how big ctx->cipher_data needs to be */ int ctx_size; /* Populate a ASN1_TYPE with parameters */ int (*set_asn1_parameters) (EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */ int (*get_asn1_parameters) (EVP_CIPHER_CTX *, ASN1_TYPE *); /* Miscellaneous operations */ int (*ctrl) (EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Application data */ void *app_data; } /* EVP_CIPHER */ ; /* Values for cipher flags */ /* Modes for ciphers */ # define EVP_CIPH_STREAM_CIPHER 0x0 # define EVP_CIPH_ECB_MODE 0x1 # define EVP_CIPH_CBC_MODE 0x2 # define EVP_CIPH_CFB_MODE 0x3 # define EVP_CIPH_OFB_MODE 0x4 # define EVP_CIPH_CTR_MODE 0x5 # define EVP_CIPH_GCM_MODE 0x6 # define EVP_CIPH_CCM_MODE 0x7 # define EVP_CIPH_XTS_MODE 0x10001 # define EVP_CIPH_WRAP_MODE 0x10002 # define EVP_CIPH_MODE 0xF0007 /* Set if variable length cipher */ # define EVP_CIPH_VARIABLE_LENGTH 0x8 /* Set if the iv handling should be done by the cipher itself */ # define EVP_CIPH_CUSTOM_IV 0x10 /* Set if the cipher's init() function should be called if key is NULL */ # define EVP_CIPH_ALWAYS_CALL_INIT 0x20 /* Call ctrl() to init cipher parameters */ # define EVP_CIPH_CTRL_INIT 0x40 /* Don't use standard key length function */ # define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 /* Don't use standard block padding */ # define EVP_CIPH_NO_PADDING 0x100 /* cipher handles random key generation */ # define EVP_CIPH_RAND_KEY 0x200 /* cipher has its own additional copying logic */ # define EVP_CIPH_CUSTOM_COPY 0x4000 /* Allow use default ASN1 get/set iv */ # define EVP_CIPH_FLAG_DEFAULT_ASN1 0x1000 /* Buffer length in bits not bytes: CFB1 mode only */ # define EVP_CIPH_FLAG_LENGTH_BITS 0x2000 /* Note if suitable for use in FIPS mode */ # define EVP_CIPH_FLAG_FIPS 0x400 /* Allow non FIPS cipher in FIPS mode */ # define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0x800 /* * Cipher handles any and all padding logic as well as finalisation. */ # define EVP_CIPH_FLAG_CUSTOM_CIPHER 0x100000 # define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000 # define EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0x400000 /* * Cipher context flag to indicate we can handle wrap mode: if allowed in * older applications it could overflow buffers. */ # define EVP_CIPHER_CTX_FLAG_WRAP_ALLOW 0x1 /* ctrl() values */ # define EVP_CTRL_INIT 0x0 # define EVP_CTRL_SET_KEY_LENGTH 0x1 # define EVP_CTRL_GET_RC2_KEY_BITS 0x2 # define EVP_CTRL_SET_RC2_KEY_BITS 0x3 # define EVP_CTRL_GET_RC5_ROUNDS 0x4 # define EVP_CTRL_SET_RC5_ROUNDS 0x5 # define EVP_CTRL_RAND_KEY 0x6 # define EVP_CTRL_PBE_PRF_NID 0x7 # define EVP_CTRL_COPY 0x8 # define EVP_CTRL_GCM_SET_IVLEN 0x9 # define EVP_CTRL_GCM_GET_TAG 0x10 # define EVP_CTRL_GCM_SET_TAG 0x11 # define EVP_CTRL_GCM_SET_IV_FIXED 0x12 # define EVP_CTRL_GCM_IV_GEN 0x13 # define EVP_CTRL_CCM_SET_IVLEN EVP_CTRL_GCM_SET_IVLEN # define EVP_CTRL_CCM_GET_TAG EVP_CTRL_GCM_GET_TAG # define EVP_CTRL_CCM_SET_TAG EVP_CTRL_GCM_SET_TAG # define EVP_CTRL_CCM_SET_L 0x14 # define EVP_CTRL_CCM_SET_MSGLEN 0x15 /* * AEAD cipher deduces payload length and returns number of bytes required to * store MAC and eventual padding. Subsequent call to EVP_Cipher even * appends/verifies MAC. */ # define EVP_CTRL_AEAD_TLS1_AAD 0x16 /* Used by composite AEAD ciphers, no-op in GCM, CCM... */ # define EVP_CTRL_AEAD_SET_MAC_KEY 0x17 /* Set the GCM invocation field, decrypt only */ # define EVP_CTRL_GCM_SET_IV_INV 0x18 # define EVP_CTRL_TLS1_1_MULTIBLOCK_AAD 0x19 # define EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT 0x1a # define EVP_CTRL_TLS1_1_MULTIBLOCK_DECRYPT 0x1b # define EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE 0x1c /* RFC 5246 defines additional data to be 13 bytes in length */ # define EVP_AEAD_TLS1_AAD_LEN 13 typedef struct { unsigned char *out; const unsigned char *inp; size_t len; unsigned int interleave; } EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM; /* GCM TLS constants */ /* Length of fixed part of IV derived from PRF */ # define EVP_GCM_TLS_FIXED_IV_LEN 4 /* Length of explicit part of IV part of TLS records */ # define EVP_GCM_TLS_EXPLICIT_IV_LEN 8 /* Length of tag for TLS */ # define EVP_GCM_TLS_TAG_LEN 16 typedef struct evp_cipher_info_st { const EVP_CIPHER *cipher; unsigned char iv[EVP_MAX_IV_LENGTH]; } EVP_CIPHER_INFO; struct evp_cipher_ctx_st { const EVP_CIPHER *cipher; ENGINE *engine; /* functional reference if 'cipher' is * ENGINE-provided */ int encrypt; /* encrypt or decrypt */ int buf_len; /* number we have left */ unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */ unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */ unsigned char buf[EVP_MAX_BLOCK_LENGTH]; /* saved partial block */ int num; /* used by cfb/ofb/ctr mode */ void *app_data; /* application stuff */ int key_len; /* May change for variable length cipher */ unsigned long flags; /* Various flags */ void *cipher_data; /* per EVP data */ int final_used; int block_mask; unsigned char final[EVP_MAX_BLOCK_LENGTH]; /* possible final block */ } /* EVP_CIPHER_CTX */ ; typedef struct evp_Encode_Ctx_st { /* number saved in a partial encode/decode */ int num; /* * The length is either the output line length (in input bytes) or the * shortest input line length that is ok. Once decoding begins, the * length is adjusted up each time a longer line is decoded */ int length; /* data to encode */ unsigned char enc_data[80]; /* number read on current line */ int line_num; int expect_nl; } EVP_ENCODE_CTX; /* Password based encryption function */ typedef int (EVP_PBE_KEYGEN) (EVP_CIPHER_CTX *ctx, const char *pass, int passlen, ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, int en_de); # ifndef OPENSSL_NO_RSA # define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ (char *)(rsa)) # endif # ifndef OPENSSL_NO_DSA # define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ (char *)(dsa)) # endif # ifndef OPENSSL_NO_DH # define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\ (char *)(dh)) # endif # ifndef OPENSSL_NO_EC # define EVP_PKEY_assign_EC_KEY(pkey,eckey) EVP_PKEY_assign((pkey),EVP_PKEY_EC,\ (char *)(eckey)) # endif /* Add some extra combinations */ # define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) # define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) # define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) # define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) int EVP_MD_type(const EVP_MD *md); # define EVP_MD_nid(e) EVP_MD_type(e) # define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) int EVP_MD_pkey_type(const EVP_MD *md); int EVP_MD_size(const EVP_MD *md); int EVP_MD_block_size(const EVP_MD *md); unsigned long EVP_MD_flags(const EVP_MD *md); const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx); # define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e)) # define EVP_MD_CTX_block_size(e) EVP_MD_block_size(EVP_MD_CTX_md(e)) # define EVP_MD_CTX_type(e) EVP_MD_type(EVP_MD_CTX_md(e)) int EVP_CIPHER_nid(const EVP_CIPHER *cipher); # define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e)) int EVP_CIPHER_block_size(const EVP_CIPHER *cipher); int EVP_CIPHER_key_length(const EVP_CIPHER *cipher); int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher); unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher); # define EVP_CIPHER_mode(e) (EVP_CIPHER_flags(e) & EVP_CIPH_MODE) const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx); int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx); int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx); int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx); int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx); int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in); void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx); void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data); # define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx); # define EVP_CIPHER_CTX_mode(e) (EVP_CIPHER_CTX_flags(e) & EVP_CIPH_MODE) # define EVP_ENCODE_LENGTH(l) (((l+2)/3*4)+(l/48+1)*2+80) # define EVP_DECODE_LENGTH(l) ((l+3)/4*3+80) # define EVP_SignInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) # define EVP_SignInit(a,b) EVP_DigestInit(a,b) # define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) # define EVP_VerifyInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) # define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) # define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) # define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) # define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) # define EVP_DigestSignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) # define EVP_DigestVerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) # ifdef CONST_STRICT void BIO_set_md(BIO *, const EVP_MD *md); # else # define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)md) # endif # define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp) # define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(char *)mdcp) # define BIO_set_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_SET_MD_CTX,0,(char *)mdcp) # define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) # define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp) int EVP_Cipher(EVP_CIPHER_CTX *c, unsigned char *out, const unsigned char *in, unsigned int inl); # define EVP_add_cipher_alias(n,alias) \ OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) # define EVP_add_digest_alias(n,alias) \ OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n)) # define EVP_delete_cipher_alias(alias) \ OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS); # define EVP_delete_digest_alias(alias) \ OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); void EVP_MD_CTX_init(EVP_MD_CTX *ctx); int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx); EVP_MD_CTX *EVP_MD_CTX_create(void); void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in); void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags); void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags); int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags); int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt); int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s); int EVP_Digest(const void *data, size_t count, unsigned char *md, unsigned int *size, const EVP_MD *type, ENGINE *impl); int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in); int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s); int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify); int EVP_read_pw_string_min(char *buf, int minlen, int maxlen, const char *prompt, int verify); void EVP_set_pw_prompt(const char *prompt); char *EVP_get_pw_prompt(void); int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, const unsigned char *salt, const unsigned char *data, int datal, int count, unsigned char *key, unsigned char *iv); void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags); void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags); int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags); int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, const unsigned char *key, const unsigned char *iv); int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, const unsigned char *key, const unsigned char *iv); int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl); int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, const unsigned char *key, const unsigned char *iv); int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, const unsigned char *key, const unsigned char *iv); int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl); int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, const unsigned char *key, const unsigned char *iv, int enc); int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, const unsigned char *key, const unsigned char *iv, int enc); int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl); int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s, EVP_PKEY *pkey); int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, unsigned int siglen, EVP_PKEY *pkey); int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *siglen); int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, size_t siglen); int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, const unsigned char *ek, int ekl, const unsigned char *iv, EVP_PKEY *priv); int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char **ek, int *ekl, unsigned char *iv, EVP_PKEY **pubk, int npubk); int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl); void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl); int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void); void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *a); int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key); # ifndef OPENSSL_NO_BIO BIO_METHOD *BIO_f_md(void); BIO_METHOD *BIO_f_base64(void); BIO_METHOD *BIO_f_cipher(void); BIO_METHOD *BIO_f_reliable(void); void BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k, const unsigned char *i, int enc); # endif const EVP_MD *EVP_md_null(void); # ifndef OPENSSL_NO_MD2 const EVP_MD *EVP_md2(void); # endif # ifndef OPENSSL_NO_MD4 const EVP_MD *EVP_md4(void); # endif # ifndef OPENSSL_NO_MD5 const EVP_MD *EVP_md5(void); # endif # ifndef OPENSSL_NO_SHA const EVP_MD *EVP_sha(void); const EVP_MD *EVP_sha1(void); const EVP_MD *EVP_dss(void); const EVP_MD *EVP_dss1(void); const EVP_MD *EVP_ecdsa(void); # endif # ifndef OPENSSL_NO_SHA256 const EVP_MD *EVP_sha224(void); const EVP_MD *EVP_sha256(void); # endif # ifndef OPENSSL_NO_SHA512 const EVP_MD *EVP_sha384(void); const EVP_MD *EVP_sha512(void); # endif # ifndef OPENSSL_NO_MDC2 const EVP_MD *EVP_mdc2(void); # endif # ifndef OPENSSL_NO_RIPEMD const EVP_MD *EVP_ripemd160(void); # endif # ifndef OPENSSL_NO_WHIRLPOOL const EVP_MD *EVP_whirlpool(void); # endif const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ # ifndef OPENSSL_NO_DES const EVP_CIPHER *EVP_des_ecb(void); const EVP_CIPHER *EVP_des_ede(void); const EVP_CIPHER *EVP_des_ede3(void); const EVP_CIPHER *EVP_des_ede_ecb(void); const EVP_CIPHER *EVP_des_ede3_ecb(void); const EVP_CIPHER *EVP_des_cfb64(void); # define EVP_des_cfb EVP_des_cfb64 const EVP_CIPHER *EVP_des_cfb1(void); const EVP_CIPHER *EVP_des_cfb8(void); const EVP_CIPHER *EVP_des_ede_cfb64(void); # define EVP_des_ede_cfb EVP_des_ede_cfb64 # if 0 const EVP_CIPHER *EVP_des_ede_cfb1(void); const EVP_CIPHER *EVP_des_ede_cfb8(void); # endif const EVP_CIPHER *EVP_des_ede3_cfb64(void); # define EVP_des_ede3_cfb EVP_des_ede3_cfb64 const EVP_CIPHER *EVP_des_ede3_cfb1(void); const EVP_CIPHER *EVP_des_ede3_cfb8(void); const EVP_CIPHER *EVP_des_ofb(void); const EVP_CIPHER *EVP_des_ede_ofb(void); const EVP_CIPHER *EVP_des_ede3_ofb(void); const EVP_CIPHER *EVP_des_cbc(void); const EVP_CIPHER *EVP_des_ede_cbc(void); const EVP_CIPHER *EVP_des_ede3_cbc(void); const EVP_CIPHER *EVP_desx_cbc(void); const EVP_CIPHER *EVP_des_ede3_wrap(void); /* * This should now be supported through the dev_crypto ENGINE. But also, why * are rc4 and md5 declarations made here inside a "NO_DES" precompiler * branch? */ # if 0 # ifdef OPENSSL_OPENBSD_DEV_CRYPTO const EVP_CIPHER *EVP_dev_crypto_des_ede3_cbc(void); const EVP_CIPHER *EVP_dev_crypto_rc4(void); const EVP_MD *EVP_dev_crypto_md5(void); # endif # endif # endif # ifndef OPENSSL_NO_RC4 const EVP_CIPHER *EVP_rc4(void); const EVP_CIPHER *EVP_rc4_40(void); # ifndef OPENSSL_NO_MD5 const EVP_CIPHER *EVP_rc4_hmac_md5(void); # endif # endif # ifndef OPENSSL_NO_IDEA const EVP_CIPHER *EVP_idea_ecb(void); const EVP_CIPHER *EVP_idea_cfb64(void); # define EVP_idea_cfb EVP_idea_cfb64 const EVP_CIPHER *EVP_idea_ofb(void); const EVP_CIPHER *EVP_idea_cbc(void); # endif # ifndef OPENSSL_NO_RC2 const EVP_CIPHER *EVP_rc2_ecb(void); const EVP_CIPHER *EVP_rc2_cbc(void); const EVP_CIPHER *EVP_rc2_40_cbc(void); const EVP_CIPHER *EVP_rc2_64_cbc(void); const EVP_CIPHER *EVP_rc2_cfb64(void); # define EVP_rc2_cfb EVP_rc2_cfb64 const EVP_CIPHER *EVP_rc2_ofb(void); # endif # ifndef OPENSSL_NO_BF const EVP_CIPHER *EVP_bf_ecb(void); const EVP_CIPHER *EVP_bf_cbc(void); const EVP_CIPHER *EVP_bf_cfb64(void); # define EVP_bf_cfb EVP_bf_cfb64 const EVP_CIPHER *EVP_bf_ofb(void); # endif # ifndef OPENSSL_NO_CAST const EVP_CIPHER *EVP_cast5_ecb(void); const EVP_CIPHER *EVP_cast5_cbc(void); const EVP_CIPHER *EVP_cast5_cfb64(void); # define EVP_cast5_cfb EVP_cast5_cfb64 const EVP_CIPHER *EVP_cast5_ofb(void); # endif # ifndef OPENSSL_NO_RC5 const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void); # define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64 const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); # endif # ifndef OPENSSL_NO_AES const EVP_CIPHER *EVP_aes_128_ecb(void); const EVP_CIPHER *EVP_aes_128_cbc(void); const EVP_CIPHER *EVP_aes_128_cfb1(void); const EVP_CIPHER *EVP_aes_128_cfb8(void); const EVP_CIPHER *EVP_aes_128_cfb128(void); # define EVP_aes_128_cfb EVP_aes_128_cfb128 const EVP_CIPHER *EVP_aes_128_ofb(void); const EVP_CIPHER *EVP_aes_128_ctr(void); const EVP_CIPHER *EVP_aes_128_ccm(void); const EVP_CIPHER *EVP_aes_128_gcm(void); const EVP_CIPHER *EVP_aes_128_xts(void); const EVP_CIPHER *EVP_aes_128_wrap(void); const EVP_CIPHER *EVP_aes_128_wrap_pad(void); const EVP_CIPHER *EVP_aes_192_ecb(void); const EVP_CIPHER *EVP_aes_192_cbc(void); const EVP_CIPHER *EVP_aes_192_cfb1(void); const EVP_CIPHER *EVP_aes_192_cfb8(void); const EVP_CIPHER *EVP_aes_192_cfb128(void); # define EVP_aes_192_cfb EVP_aes_192_cfb128 const EVP_CIPHER *EVP_aes_192_ofb(void); const EVP_CIPHER *EVP_aes_192_ctr(void); const EVP_CIPHER *EVP_aes_192_ccm(void); const EVP_CIPHER *EVP_aes_192_gcm(void); const EVP_CIPHER *EVP_aes_192_wrap(void); const EVP_CIPHER *EVP_aes_192_wrap_pad(void); const EVP_CIPHER *EVP_aes_256_ecb(void); const EVP_CIPHER *EVP_aes_256_cbc(void); const EVP_CIPHER *EVP_aes_256_cfb1(void); const EVP_CIPHER *EVP_aes_256_cfb8(void); const EVP_CIPHER *EVP_aes_256_cfb128(void); # define EVP_aes_256_cfb EVP_aes_256_cfb128 const EVP_CIPHER *EVP_aes_256_ofb(void); const EVP_CIPHER *EVP_aes_256_ctr(void); const EVP_CIPHER *EVP_aes_256_ccm(void); const EVP_CIPHER *EVP_aes_256_gcm(void); const EVP_CIPHER *EVP_aes_256_xts(void); const EVP_CIPHER *EVP_aes_256_wrap(void); const EVP_CIPHER *EVP_aes_256_wrap_pad(void); # if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1) const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void); const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void); # endif # ifndef OPENSSL_NO_SHA256 const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha256(void); const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha256(void); # endif # endif # ifndef OPENSSL_NO_CAMELLIA const EVP_CIPHER *EVP_camellia_128_ecb(void); const EVP_CIPHER *EVP_camellia_128_cbc(void); const EVP_CIPHER *EVP_camellia_128_cfb1(void); const EVP_CIPHER *EVP_camellia_128_cfb8(void); const EVP_CIPHER *EVP_camellia_128_cfb128(void); # define EVP_camellia_128_cfb EVP_camellia_128_cfb128 const EVP_CIPHER *EVP_camellia_128_ofb(void); const EVP_CIPHER *EVP_camellia_192_ecb(void); const EVP_CIPHER *EVP_camellia_192_cbc(void); const EVP_CIPHER *EVP_camellia_192_cfb1(void); const EVP_CIPHER *EVP_camellia_192_cfb8(void); const EVP_CIPHER *EVP_camellia_192_cfb128(void); # define EVP_camellia_192_cfb EVP_camellia_192_cfb128 const EVP_CIPHER *EVP_camellia_192_ofb(void); const EVP_CIPHER *EVP_camellia_256_ecb(void); const EVP_CIPHER *EVP_camellia_256_cbc(void); const EVP_CIPHER *EVP_camellia_256_cfb1(void); const EVP_CIPHER *EVP_camellia_256_cfb8(void); const EVP_CIPHER *EVP_camellia_256_cfb128(void); # define EVP_camellia_256_cfb EVP_camellia_256_cfb128 const EVP_CIPHER *EVP_camellia_256_ofb(void); # endif # ifndef OPENSSL_NO_SEED const EVP_CIPHER *EVP_seed_ecb(void); const EVP_CIPHER *EVP_seed_cbc(void); const EVP_CIPHER *EVP_seed_cfb128(void); # define EVP_seed_cfb EVP_seed_cfb128 const EVP_CIPHER *EVP_seed_ofb(void); # endif void OPENSSL_add_all_algorithms_noconf(void); void OPENSSL_add_all_algorithms_conf(void); # ifdef OPENSSL_LOAD_CONF # define OpenSSL_add_all_algorithms() \ OPENSSL_add_all_algorithms_conf() # else # define OpenSSL_add_all_algorithms() \ OPENSSL_add_all_algorithms_noconf() # endif void OpenSSL_add_all_ciphers(void); void OpenSSL_add_all_digests(void); # define SSLeay_add_all_algorithms() OpenSSL_add_all_algorithms() # define SSLeay_add_all_ciphers() OpenSSL_add_all_ciphers() # define SSLeay_add_all_digests() OpenSSL_add_all_digests() int EVP_add_cipher(const EVP_CIPHER *cipher); int EVP_add_digest(const EVP_MD *digest); const EVP_CIPHER *EVP_get_cipherbyname(const char *name); const EVP_MD *EVP_get_digestbyname(const char *name); void EVP_cleanup(void); void EVP_CIPHER_do_all(void (*fn) (const EVP_CIPHER *ciph, const char *from, const char *to, void *x), void *arg); void EVP_CIPHER_do_all_sorted(void (*fn) (const EVP_CIPHER *ciph, const char *from, const char *to, void *x), void *arg); void EVP_MD_do_all(void (*fn) (const EVP_MD *ciph, const char *from, const char *to, void *x), void *arg); void EVP_MD_do_all_sorted(void (*fn) (const EVP_MD *ciph, const char *from, const char *to, void *x), void *arg); int EVP_PKEY_decrypt_old(unsigned char *dec_key, const unsigned char *enc_key, int enc_key_len, EVP_PKEY *private_key); int EVP_PKEY_encrypt_old(unsigned char *enc_key, const unsigned char *key, int key_len, EVP_PKEY *pub_key); int EVP_PKEY_type(int type); int EVP_PKEY_id(const EVP_PKEY *pkey); int EVP_PKEY_base_id(const EVP_PKEY *pkey); int EVP_PKEY_bits(EVP_PKEY *pkey); int EVP_PKEY_size(EVP_PKEY *pkey); int EVP_PKEY_set_type(EVP_PKEY *pkey, int type); int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len); int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key); void *EVP_PKEY_get0(EVP_PKEY *pkey); # ifndef OPENSSL_NO_RSA struct rsa_st; int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key); struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); # endif # ifndef OPENSSL_NO_DSA struct dsa_st; int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key); struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); # endif # ifndef OPENSSL_NO_DH struct dh_st; int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key); struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); # endif # ifndef OPENSSL_NO_EC struct ec_key_st; int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key); struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); # endif EVP_PKEY *EVP_PKEY_new(void); void EVP_PKEY_free(EVP_PKEY *pkey); EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, long length); int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp); EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, long length); EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, long length); int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp); int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode); int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, int indent, ASN1_PCTX *pctx); int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, int indent, ASN1_PCTX *pctx); int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, int indent, ASN1_PCTX *pctx); int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); int EVP_CIPHER_type(const EVP_CIPHER *ctx); /* calls methods */ int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); /* These are used by EVP_CIPHER methods */ int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); /* PKCS5 password based encryption */ int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, int en_de); int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, const unsigned char *salt, int saltlen, int iter, int keylen, unsigned char *out); int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, const unsigned char *salt, int saltlen, int iter, const EVP_MD *digest, int keylen, unsigned char *out); int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, int en_de); void PKCS5_PBE_add(void); int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); /* PBE type */ /* Can appear as the outermost AlgorithmIdentifier */ # define EVP_PBE_TYPE_OUTER 0x0 /* Is an PRF type OID */ # define EVP_PBE_TYPE_PRF 0x1 int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, int md_nid, EVP_PBE_KEYGEN *keygen); int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, EVP_PBE_KEYGEN *keygen); int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid, EVP_PBE_KEYGEN **pkeygen); void EVP_PBE_cleanup(void); # define ASN1_PKEY_ALIAS 0x1 # define ASN1_PKEY_DYNAMIC 0x2 # define ASN1_PKEY_SIGPARAM_NULL 0x4 # define ASN1_PKEY_CTRL_PKCS7_SIGN 0x1 # define ASN1_PKEY_CTRL_PKCS7_ENCRYPT 0x2 # define ASN1_PKEY_CTRL_DEFAULT_MD_NID 0x3 # define ASN1_PKEY_CTRL_CMS_SIGN 0x5 # define ASN1_PKEY_CTRL_CMS_ENVELOPE 0x7 # define ASN1_PKEY_CTRL_CMS_RI_TYPE 0x8 int EVP_PKEY_asn1_get_count(void); const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx); const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type); const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, const char *str, int len); int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth); int EVP_PKEY_asn1_add_alias(int to, int from); int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, int *ppkey_flags, const char **pinfo, const char **ppem_str, const EVP_PKEY_ASN1_METHOD *ameth); const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(EVP_PKEY *pkey); EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags, const char *pem_str, const char *info); void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, const EVP_PKEY_ASN1_METHOD *src); void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth); void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, int (*pub_decode) (EVP_PKEY *pk, X509_PUBKEY *pub), int (*pub_encode) (X509_PUBKEY *pub, const EVP_PKEY *pk), int (*pub_cmp) (const EVP_PKEY *a, const EVP_PKEY *b), int (*pub_print) (BIO *out, const EVP_PKEY *pkey, int indent, ASN1_PCTX *pctx), int (*pkey_size) (const EVP_PKEY *pk), int (*pkey_bits) (const EVP_PKEY *pk)); void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, int (*priv_decode) (EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf), int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk), int (*priv_print) (BIO *out, const EVP_PKEY *pkey, int indent, ASN1_PCTX *pctx)); void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, int (*param_decode) (EVP_PKEY *pkey, const unsigned char **pder, int derlen), int (*param_encode) (const EVP_PKEY *pkey, unsigned char **pder), int (*param_missing) (const EVP_PKEY *pk), int (*param_copy) (EVP_PKEY *to, const EVP_PKEY *from), int (*param_cmp) (const EVP_PKEY *a, const EVP_PKEY *b), int (*param_print) (BIO *out, const EVP_PKEY *pkey, int indent, ASN1_PCTX *pctx)); void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, void (*pkey_free) (EVP_PKEY *pkey)); void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, int (*pkey_ctrl) (EVP_PKEY *pkey, int op, long arg1, void *arg2)); void EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth, int (*item_verify) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, X509_ALGOR *a, ASN1_BIT_STRING *sig, EVP_PKEY *pkey), int (*item_sign) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, X509_ALGOR *alg1, X509_ALGOR *alg2, ASN1_BIT_STRING *sig)); # define EVP_PKEY_OP_UNDEFINED 0 # define EVP_PKEY_OP_PARAMGEN (1<<1) # define EVP_PKEY_OP_KEYGEN (1<<2) # define EVP_PKEY_OP_SIGN (1<<3) # define EVP_PKEY_OP_VERIFY (1<<4) # define EVP_PKEY_OP_VERIFYRECOVER (1<<5) # define EVP_PKEY_OP_SIGNCTX (1<<6) # define EVP_PKEY_OP_VERIFYCTX (1<<7) # define EVP_PKEY_OP_ENCRYPT (1<<8) # define EVP_PKEY_OP_DECRYPT (1<<9) # define EVP_PKEY_OP_DERIVE (1<<10) # define EVP_PKEY_OP_TYPE_SIG \ (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \ | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX) # define EVP_PKEY_OP_TYPE_CRYPT \ (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT) # define EVP_PKEY_OP_TYPE_NOGEN \ (EVP_PKEY_OP_SIG | EVP_PKEY_OP_CRYPT | EVP_PKEY_OP_DERIVE) # define EVP_PKEY_OP_TYPE_GEN \ (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN) # define EVP_PKEY_CTX_set_signature_md(ctx, md) \ EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \ EVP_PKEY_CTRL_MD, 0, (void *)md) # define EVP_PKEY_CTX_get_signature_md(ctx, pmd) \ EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \ EVP_PKEY_CTRL_GET_MD, 0, (void *)pmd) # define EVP_PKEY_CTRL_MD 1 # define EVP_PKEY_CTRL_PEER_KEY 2 # define EVP_PKEY_CTRL_PKCS7_ENCRYPT 3 # define EVP_PKEY_CTRL_PKCS7_DECRYPT 4 # define EVP_PKEY_CTRL_PKCS7_SIGN 5 # define EVP_PKEY_CTRL_SET_MAC_KEY 6 # define EVP_PKEY_CTRL_DIGESTINIT 7 /* Used by GOST key encryption in TLS */ # define EVP_PKEY_CTRL_SET_IV 8 # define EVP_PKEY_CTRL_CMS_ENCRYPT 9 # define EVP_PKEY_CTRL_CMS_DECRYPT 10 # define EVP_PKEY_CTRL_CMS_SIGN 11 # define EVP_PKEY_CTRL_CIPHER 12 # define EVP_PKEY_CTRL_GET_MD 13 # define EVP_PKEY_ALG_CTRL 0x1000 # define EVP_PKEY_FLAG_AUTOARGLEN 2 /* * Method handles all operations: don't assume any digest related defaults. */ # define EVP_PKEY_FLAG_SIGCTX_CUSTOM 4 const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type); EVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags); void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags, const EVP_PKEY_METHOD *meth); void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src); void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth); int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth); EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e); EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e); EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx); void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, int cmd, int p1, void *p2); int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value); int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx); void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen); EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, const unsigned char *key, int keylen); void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data); void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx); EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx); EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx); void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data); void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx); int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, const unsigned char *tbs, size_t tbslen); int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, const unsigned char *sig, size_t siglen, const unsigned char *tbs, size_t tbslen); int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx); int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx, unsigned char *rout, size_t *routlen, const unsigned char *sig, size_t siglen); int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, const unsigned char *in, size_t inlen); int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, const unsigned char *in, size_t inlen); int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); typedef int EVP_PKEY_gen_cb (EVP_PKEY_CTX *ctx); int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx); int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx); int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb); EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx); int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx); void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth, int (*init) (EVP_PKEY_CTX *ctx)); void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth, int (*copy) (EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)); void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth, void (*cleanup) (EVP_PKEY_CTX *ctx)); void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth, int (*paramgen_init) (EVP_PKEY_CTX *ctx), int (*paramgen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)); void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth, int (*keygen_init) (EVP_PKEY_CTX *ctx), int (*keygen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)); void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth, int (*sign_init) (EVP_PKEY_CTX *ctx), int (*sign) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, const unsigned char *tbs, size_t tbslen)); void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth, int (*verify_init) (EVP_PKEY_CTX *ctx), int (*verify) (EVP_PKEY_CTX *ctx, const unsigned char *sig, size_t siglen, const unsigned char *tbs, size_t tbslen)); void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth, int (*verify_recover_init) (EVP_PKEY_CTX *ctx), int (*verify_recover) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, const unsigned char *tbs, size_t tbslen)); void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth, int (*signctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx), int (*signctx) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, EVP_MD_CTX *mctx)); void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth, int (*verifyctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx), int (*verifyctx) (EVP_PKEY_CTX *ctx, const unsigned char *sig, int siglen, EVP_MD_CTX *mctx)); void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth, int (*encrypt_init) (EVP_PKEY_CTX *ctx), int (*encryptfn) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, const unsigned char *in, size_t inlen)); void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth, int (*decrypt_init) (EVP_PKEY_CTX *ctx), int (*decrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, const unsigned char *in, size_t inlen)); void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth, int (*derive_init) (EVP_PKEY_CTX *ctx), int (*derive) (EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen)); void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, void *p2), int (*ctrl_str) (EVP_PKEY_CTX *ctx, const char *type, const char *value)); void EVP_add_alg_module(void); /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_EVP_strings(void); /* Error codes for the EVP functions. */ /* Function codes. */ # define EVP_F_AESNI_INIT_KEY 165 # define EVP_F_AESNI_XTS_CIPHER 176 # define EVP_F_AES_INIT_KEY 133 # define EVP_F_AES_T4_INIT_KEY 178 # define EVP_F_AES_XTS 172 # define EVP_F_AES_XTS_CIPHER 175 # define EVP_F_ALG_MODULE_INIT 177 # define EVP_F_CAMELLIA_INIT_KEY 159 # define EVP_F_CMAC_INIT 173 # define EVP_F_CMLL_T4_INIT_KEY 179 # define EVP_F_D2I_PKEY 100 # define EVP_F_DO_SIGVER_INIT 161 # define EVP_F_DSAPKEY2PKCS8 134 # define EVP_F_DSA_PKEY2PKCS8 135 # define EVP_F_ECDSA_PKEY2PKCS8 129 # define EVP_F_ECKEY_PKEY2PKCS8 132 # define EVP_F_EVP_CIPHERINIT_EX 123 # define EVP_F_EVP_CIPHER_CTX_COPY 163 # define EVP_F_EVP_CIPHER_CTX_CTRL 124 # define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122 # define EVP_F_EVP_DECRYPTFINAL_EX 101 # define EVP_F_EVP_DIGESTINIT_EX 128 # define EVP_F_EVP_DECRYPTUPDATE 180 # define EVP_F_EVP_ENCRYPTUPDATE 181 # define EVP_F_EVP_ENCRYPTFINAL_EX 127 # define EVP_F_EVP_MD_CTX_COPY_EX 110 # define EVP_F_EVP_MD_SIZE 162 # define EVP_F_EVP_OPENINIT 102 # define EVP_F_EVP_PBE_ALG_ADD 115 # define EVP_F_EVP_PBE_ALG_ADD_TYPE 160 # define EVP_F_EVP_PBE_CIPHERINIT 116 # define EVP_F_EVP_PKCS82PKEY 111 # define EVP_F_EVP_PKCS82PKEY_BROKEN 136 # define EVP_F_EVP_PKEY2PKCS8_BROKEN 113 # define EVP_F_EVP_PKEY_COPY_PARAMETERS 103 # define EVP_F_EVP_PKEY_CTX_CTRL 137 # define EVP_F_EVP_PKEY_CTX_CTRL_STR 150 # define EVP_F_EVP_PKEY_CTX_DUP 156 # define EVP_F_EVP_PKEY_DECRYPT 104 # define EVP_F_EVP_PKEY_DECRYPT_INIT 138 # define EVP_F_EVP_PKEY_DECRYPT_OLD 151 # define EVP_F_EVP_PKEY_DERIVE 153 # define EVP_F_EVP_PKEY_DERIVE_INIT 154 # define EVP_F_EVP_PKEY_DERIVE_SET_PEER 155 # define EVP_F_EVP_PKEY_ENCRYPT 105 # define EVP_F_EVP_PKEY_ENCRYPT_INIT 139 # define EVP_F_EVP_PKEY_ENCRYPT_OLD 152 # define EVP_F_EVP_PKEY_GET1_DH 119 # define EVP_F_EVP_PKEY_GET1_DSA 120 # define EVP_F_EVP_PKEY_GET1_ECDSA 130 # define EVP_F_EVP_PKEY_GET1_EC_KEY 131 # define EVP_F_EVP_PKEY_GET1_RSA 121 # define EVP_F_EVP_PKEY_KEYGEN 146 # define EVP_F_EVP_PKEY_KEYGEN_INIT 147 # define EVP_F_EVP_PKEY_NEW 106 # define EVP_F_EVP_PKEY_PARAMGEN 148 # define EVP_F_EVP_PKEY_PARAMGEN_INIT 149 # define EVP_F_EVP_PKEY_SIGN 140 # define EVP_F_EVP_PKEY_SIGN_INIT 141 # define EVP_F_EVP_PKEY_VERIFY 142 # define EVP_F_EVP_PKEY_VERIFY_INIT 143 # define EVP_F_EVP_PKEY_VERIFY_RECOVER 144 # define EVP_F_EVP_PKEY_VERIFY_RECOVER_INIT 145 # define EVP_F_EVP_RIJNDAEL 126 # define EVP_F_EVP_SIGNFINAL 107 # define EVP_F_EVP_VERIFYFINAL 108 # define EVP_F_FIPS_CIPHERINIT 166 # define EVP_F_FIPS_CIPHER_CTX_COPY 170 # define EVP_F_FIPS_CIPHER_CTX_CTRL 167 # define EVP_F_FIPS_CIPHER_CTX_SET_KEY_LENGTH 171 # define EVP_F_FIPS_DIGESTINIT 168 # define EVP_F_FIPS_MD_CTX_COPY 169 # define EVP_F_HMAC_INIT_EX 174 # define EVP_F_INT_CTX_NEW 157 # define EVP_F_PKCS5_PBE_KEYIVGEN 117 # define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118 # define EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN 164 # define EVP_F_PKCS8_SET_BROKEN 112 # define EVP_F_PKEY_SET_TYPE 158 # define EVP_F_RC2_MAGIC_TO_METH 109 # define EVP_F_RC5_CTRL 125 /* Reason codes. */ # define EVP_R_AES_IV_SETUP_FAILED 162 # define EVP_R_AES_KEY_SETUP_FAILED 143 # define EVP_R_ASN1_LIB 140 # define EVP_R_BAD_BLOCK_LENGTH 136 # define EVP_R_BAD_DECRYPT 100 # define EVP_R_BAD_KEY_LENGTH 137 # define EVP_R_BN_DECODE_ERROR 112 # define EVP_R_BN_PUBKEY_ERROR 113 # define EVP_R_BUFFER_TOO_SMALL 155 # define EVP_R_CAMELLIA_KEY_SETUP_FAILED 157 # define EVP_R_CIPHER_PARAMETER_ERROR 122 # define EVP_R_COMMAND_NOT_SUPPORTED 147 # define EVP_R_CTRL_NOT_IMPLEMENTED 132 # define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133 # define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138 # define EVP_R_DECODE_ERROR 114 # define EVP_R_DIFFERENT_KEY_TYPES 101 # define EVP_R_DIFFERENT_PARAMETERS 153 # define EVP_R_DISABLED_FOR_FIPS 163 # define EVP_R_ENCODE_ERROR 115 # define EVP_R_ERROR_LOADING_SECTION 165 # define EVP_R_ERROR_SETTING_FIPS_MODE 166 # define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 # define EVP_R_EXPECTING_AN_RSA_KEY 127 # define EVP_R_EXPECTING_A_DH_KEY 128 # define EVP_R_EXPECTING_A_DSA_KEY 129 # define EVP_R_EXPECTING_A_ECDSA_KEY 141 # define EVP_R_EXPECTING_A_EC_KEY 142 # define EVP_R_FIPS_MODE_NOT_SUPPORTED 167 # define EVP_R_INITIALIZATION_ERROR 134 # define EVP_R_INPUT_NOT_INITIALIZED 111 # define EVP_R_INVALID_DIGEST 152 # define EVP_R_INVALID_FIPS_MODE 168 # define EVP_R_INVALID_KEY 171 # define EVP_R_INVALID_KEY_LENGTH 130 # define EVP_R_INVALID_OPERATION 148 # define EVP_R_IV_TOO_LARGE 102 # define EVP_R_KEYGEN_FAILURE 120 # define EVP_R_MESSAGE_DIGEST_IS_NULL 159 # define EVP_R_METHOD_NOT_SUPPORTED 144 # define EVP_R_MISSING_PARAMETERS 103 # define EVP_R_NO_CIPHER_SET 131 # define EVP_R_NO_DEFAULT_DIGEST 158 # define EVP_R_NO_DIGEST_SET 139 # define EVP_R_NO_DSA_PARAMETERS 116 # define EVP_R_NO_KEY_SET 154 # define EVP_R_NO_OPERATION_SET 149 # define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104 # define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105 # define EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 150 # define EVP_R_OPERATON_NOT_INITIALIZED 151 # define EVP_R_OUTPUT_WOULD_OVERFLOW 184 # define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE 117 # define EVP_R_PRIVATE_KEY_DECODE_ERROR 145 # define EVP_R_PRIVATE_KEY_ENCODE_ERROR 146 # define EVP_R_PUBLIC_KEY_NOT_RSA 106 # define EVP_R_TOO_LARGE 164 # define EVP_R_UNKNOWN_CIPHER 160 # define EVP_R_UNKNOWN_DIGEST 161 # define EVP_R_UNKNOWN_OPTION 169 # define EVP_R_UNKNOWN_PBE_ALGORITHM 121 # define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS 135 # define EVP_R_UNSUPPORTED_ALGORITHM 156 # define EVP_R_UNSUPPORTED_CIPHER 107 # define EVP_R_UNSUPPORTED_KEYLENGTH 123 # define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124 # define EVP_R_UNSUPPORTED_KEY_SIZE 108 # define EVP_R_UNSUPPORTED_PRF 125 # define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM 118 # define EVP_R_UNSUPPORTED_SALT_TYPE 126 # define EVP_R_WRAP_MODE_NOT_ALLOWED 170 # define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109 # define EVP_R_WRONG_PUBLIC_KEY_TYPE 110 # ifdef __cplusplus } # endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/bio.h���������������������������������������������������������������������������������������0000644�����������������00000113526�14763166030�0007167 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/bio/bio.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_BIO_H # define HEADER_BIO_H # include <openssl/e_os2.h> # ifndef OPENSSL_NO_FP_API # include <stdio.h> # endif # include <stdarg.h> # include <openssl/crypto.h> # ifndef OPENSSL_NO_SCTP # ifndef OPENSSL_SYS_VMS # include <stdint.h> # else # include <inttypes.h> # endif # endif #ifdef __cplusplus extern "C" { #endif /* These are the 'types' of BIOs */ # define BIO_TYPE_NONE 0 # define BIO_TYPE_MEM (1|0x0400) # define BIO_TYPE_FILE (2|0x0400) # define BIO_TYPE_FD (4|0x0400|0x0100) # define BIO_TYPE_SOCKET (5|0x0400|0x0100) # define BIO_TYPE_NULL (6|0x0400) # define BIO_TYPE_SSL (7|0x0200) # define BIO_TYPE_MD (8|0x0200)/* passive filter */ # define BIO_TYPE_BUFFER (9|0x0200)/* filter */ # define BIO_TYPE_CIPHER (10|0x0200)/* filter */ # define BIO_TYPE_BASE64 (11|0x0200)/* filter */ # define BIO_TYPE_CONNECT (12|0x0400|0x0100)/* socket - connect */ # define BIO_TYPE_ACCEPT (13|0x0400|0x0100)/* socket for accept */ # define BIO_TYPE_PROXY_CLIENT (14|0x0200)/* client proxy BIO */ # define BIO_TYPE_PROXY_SERVER (15|0x0200)/* server proxy BIO */ # define BIO_TYPE_NBIO_TEST (16|0x0200)/* server proxy BIO */ # define BIO_TYPE_NULL_FILTER (17|0x0200) # define BIO_TYPE_BER (18|0x0200)/* BER -> bin filter */ # define BIO_TYPE_BIO (19|0x0400)/* (half a) BIO pair */ # define BIO_TYPE_LINEBUFFER (20|0x0200)/* filter */ # define BIO_TYPE_DGRAM (21|0x0400|0x0100) # ifndef OPENSSL_NO_SCTP # define BIO_TYPE_DGRAM_SCTP (24|0x0400|0x0100) # endif # define BIO_TYPE_ASN1 (22|0x0200)/* filter */ # define BIO_TYPE_COMP (23|0x0200)/* filter */ # define BIO_TYPE_DESCRIPTOR 0x0100/* socket, fd, connect or accept */ # define BIO_TYPE_FILTER 0x0200 # define BIO_TYPE_SOURCE_SINK 0x0400 /* * BIO_FILENAME_READ|BIO_CLOSE to open or close on free. * BIO_set_fp(in,stdin,BIO_NOCLOSE); */ # define BIO_NOCLOSE 0x00 # define BIO_CLOSE 0x01 /* * These are used in the following macros and are passed to BIO_ctrl() */ # define BIO_CTRL_RESET 1/* opt - rewind/zero etc */ # define BIO_CTRL_EOF 2/* opt - are we at the eof */ # define BIO_CTRL_INFO 3/* opt - extra tit-bits */ # define BIO_CTRL_SET 4/* man - set the 'IO' type */ # define BIO_CTRL_GET 5/* man - get the 'IO' type */ # define BIO_CTRL_PUSH 6/* opt - internal, used to signify change */ # define BIO_CTRL_POP 7/* opt - internal, used to signify change */ # define BIO_CTRL_GET_CLOSE 8/* man - set the 'close' on free */ # define BIO_CTRL_SET_CLOSE 9/* man - set the 'close' on free */ # define BIO_CTRL_PENDING 10/* opt - is their more data buffered */ # define BIO_CTRL_FLUSH 11/* opt - 'flush' buffered output */ # define BIO_CTRL_DUP 12/* man - extra stuff for 'duped' BIO */ # define BIO_CTRL_WPENDING 13/* opt - number of bytes still to write */ /* callback is int cb(BIO *bio,state,ret); */ # define BIO_CTRL_SET_CALLBACK 14/* opt - set callback function */ # define BIO_CTRL_GET_CALLBACK 15/* opt - set callback function */ # define BIO_CTRL_SET_FILENAME 30/* BIO_s_file special */ /* dgram BIO stuff */ # define BIO_CTRL_DGRAM_CONNECT 31/* BIO dgram special */ # define BIO_CTRL_DGRAM_SET_CONNECTED 32/* allow for an externally connected * socket to be passed in */ # define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33/* setsockopt, essentially */ # define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34/* getsockopt, essentially */ # define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35/* setsockopt, essentially */ # define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36/* getsockopt, essentially */ # define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37/* flag whether the last */ # define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38/* I/O operation tiemd out */ /* #ifdef IP_MTU_DISCOVER */ # define BIO_CTRL_DGRAM_MTU_DISCOVER 39/* set DF bit on egress packets */ /* #endif */ # define BIO_CTRL_DGRAM_QUERY_MTU 40/* as kernel for current MTU */ # define BIO_CTRL_DGRAM_GET_FALLBACK_MTU 47 # define BIO_CTRL_DGRAM_GET_MTU 41/* get cached value for MTU */ # define BIO_CTRL_DGRAM_SET_MTU 42/* set cached value for MTU. * want to use this if asking * the kernel fails */ # define BIO_CTRL_DGRAM_MTU_EXCEEDED 43/* check whether the MTU was * exceed in the previous write * operation */ # define BIO_CTRL_DGRAM_GET_PEER 46 # define BIO_CTRL_DGRAM_SET_PEER 44/* Destination for the data */ # define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT 45/* Next DTLS handshake timeout * to adjust socket timeouts */ # define BIO_CTRL_DGRAM_SET_DONT_FRAG 48 # define BIO_CTRL_DGRAM_GET_MTU_OVERHEAD 49 # ifndef OPENSSL_NO_SCTP /* SCTP stuff */ # define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE 50 # define BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY 51 # define BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY 52 # define BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD 53 # define BIO_CTRL_DGRAM_SCTP_GET_SNDINFO 60 # define BIO_CTRL_DGRAM_SCTP_SET_SNDINFO 61 # define BIO_CTRL_DGRAM_SCTP_GET_RCVINFO 62 # define BIO_CTRL_DGRAM_SCTP_SET_RCVINFO 63 # define BIO_CTRL_DGRAM_SCTP_GET_PRINFO 64 # define BIO_CTRL_DGRAM_SCTP_SET_PRINFO 65 # define BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN 70 # endif /* modifiers */ # define BIO_FP_READ 0x02 # define BIO_FP_WRITE 0x04 # define BIO_FP_APPEND 0x08 # define BIO_FP_TEXT 0x10 # define BIO_FLAGS_READ 0x01 # define BIO_FLAGS_WRITE 0x02 # define BIO_FLAGS_IO_SPECIAL 0x04 # define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) # define BIO_FLAGS_SHOULD_RETRY 0x08 # ifndef BIO_FLAGS_UPLINK /* * "UPLINK" flag denotes file descriptors provided by application. It * defaults to 0, as most platforms don't require UPLINK interface. */ # define BIO_FLAGS_UPLINK 0 # endif /* Used in BIO_gethostbyname() */ # define BIO_GHBN_CTRL_HITS 1 # define BIO_GHBN_CTRL_MISSES 2 # define BIO_GHBN_CTRL_CACHE_SIZE 3 # define BIO_GHBN_CTRL_GET_ENTRY 4 # define BIO_GHBN_CTRL_FLUSH 5 /* Mostly used in the SSL BIO */ /*- * Not used anymore * #define BIO_FLAGS_PROTOCOL_DELAYED_READ 0x10 * #define BIO_FLAGS_PROTOCOL_DELAYED_WRITE 0x20 * #define BIO_FLAGS_PROTOCOL_STARTUP 0x40 */ # define BIO_FLAGS_BASE64_NO_NL 0x100 /* * This is used with memory BIOs: it means we shouldn't free up or change the * data in any way. */ # define BIO_FLAGS_MEM_RDONLY 0x200 typedef struct bio_st BIO; void BIO_set_flags(BIO *b, int flags); int BIO_test_flags(const BIO *b, int flags); void BIO_clear_flags(BIO *b, int flags); # define BIO_get_flags(b) BIO_test_flags(b, ~(0x0)) # define BIO_set_retry_special(b) \ BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY)) # define BIO_set_retry_read(b) \ BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)) # define BIO_set_retry_write(b) \ BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY)) /* These are normally used internally in BIOs */ # define BIO_clear_retry_flags(b) \ BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) # define BIO_get_retry_flags(b) \ BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) /* These should be used by the application to tell why we should retry */ # define BIO_should_read(a) BIO_test_flags(a, BIO_FLAGS_READ) # define BIO_should_write(a) BIO_test_flags(a, BIO_FLAGS_WRITE) # define BIO_should_io_special(a) BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL) # define BIO_retry_type(a) BIO_test_flags(a, BIO_FLAGS_RWS) # define BIO_should_retry(a) BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY) /* * The next three are used in conjunction with the BIO_should_io_special() * condition. After this returns true, BIO *BIO_get_retry_BIO(BIO *bio, int * *reason); will walk the BIO stack and return the 'reason' for the special * and the offending BIO. Given a BIO, BIO_get_retry_reason(bio) will return * the code. */ /* * Returned from the SSL bio when the certificate retrieval code had an error */ # define BIO_RR_SSL_X509_LOOKUP 0x01 /* Returned from the connect BIO when a connect would have blocked */ # define BIO_RR_CONNECT 0x02 /* Returned from the accept BIO when an accept would have blocked */ # define BIO_RR_ACCEPT 0x03 /* These are passed by the BIO callback */ # define BIO_CB_FREE 0x01 # define BIO_CB_READ 0x02 # define BIO_CB_WRITE 0x03 # define BIO_CB_PUTS 0x04 # define BIO_CB_GETS 0x05 # define BIO_CB_CTRL 0x06 /* * The callback is called before and after the underling operation, The * BIO_CB_RETURN flag indicates if it is after the call */ # define BIO_CB_RETURN 0x80 # define BIO_CB_return(a) ((a)|BIO_CB_RETURN) # define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) # define BIO_cb_post(a) ((a)&BIO_CB_RETURN) long (*BIO_get_callback(const BIO *b)) (struct bio_st *, int, const char *, int, long, long); void BIO_set_callback(BIO *b, long (*callback) (struct bio_st *, int, const char *, int, long, long)); char *BIO_get_callback_arg(const BIO *b); void BIO_set_callback_arg(BIO *b, char *arg); const char *BIO_method_name(const BIO *b); int BIO_method_type(const BIO *b); typedef void bio_info_cb (struct bio_st *, int, const char *, int, long, long); typedef struct bio_method_st { int type; const char *name; int (*bwrite) (BIO *, const char *, int); int (*bread) (BIO *, char *, int); int (*bputs) (BIO *, const char *); int (*bgets) (BIO *, char *, int); long (*ctrl) (BIO *, int, long, void *); int (*create) (BIO *); int (*destroy) (BIO *); long (*callback_ctrl) (BIO *, int, bio_info_cb *); } BIO_METHOD; struct bio_st { BIO_METHOD *method; /* bio, mode, argp, argi, argl, ret */ long (*callback) (struct bio_st *, int, const char *, int, long, long); char *cb_arg; /* first argument for the callback */ int init; int shutdown; int flags; /* extra storage */ int retry_reason; int num; void *ptr; struct bio_st *next_bio; /* used by filter BIOs */ struct bio_st *prev_bio; /* used by filter BIOs */ int references; unsigned long num_read; unsigned long num_write; CRYPTO_EX_DATA ex_data; }; DECLARE_STACK_OF(BIO) typedef struct bio_f_buffer_ctx_struct { /*- * Buffers are setup like this: * * <---------------------- size -----------------------> * +---------------------------------------------------+ * | consumed | remaining | free space | * +---------------------------------------------------+ * <-- off --><------- len -------> */ /*- BIO *bio; *//* * this is now in the BIO struct */ int ibuf_size; /* how big is the input buffer */ int obuf_size; /* how big is the output buffer */ char *ibuf; /* the char array */ int ibuf_len; /* how many bytes are in it */ int ibuf_off; /* write/read offset */ char *obuf; /* the char array */ int obuf_len; /* how many bytes are in it */ int obuf_off; /* write/read offset */ } BIO_F_BUFFER_CTX; /* Prefix and suffix callback in ASN1 BIO */ typedef int asn1_ps_func (BIO *b, unsigned char **pbuf, int *plen, void *parg); # ifndef OPENSSL_NO_SCTP /* SCTP parameter structs */ struct bio_dgram_sctp_sndinfo { uint16_t snd_sid; uint16_t snd_flags; uint32_t snd_ppid; uint32_t snd_context; }; struct bio_dgram_sctp_rcvinfo { uint16_t rcv_sid; uint16_t rcv_ssn; uint16_t rcv_flags; uint32_t rcv_ppid; uint32_t rcv_tsn; uint32_t rcv_cumtsn; uint32_t rcv_context; }; struct bio_dgram_sctp_prinfo { uint16_t pr_policy; uint32_t pr_value; }; # endif /* connect BIO stuff */ # define BIO_CONN_S_BEFORE 1 # define BIO_CONN_S_GET_IP 2 # define BIO_CONN_S_GET_PORT 3 # define BIO_CONN_S_CREATE_SOCKET 4 # define BIO_CONN_S_CONNECT 5 # define BIO_CONN_S_OK 6 # define BIO_CONN_S_BLOCKED_CONNECT 7 # define BIO_CONN_S_NBIO 8 /* * #define BIO_CONN_get_param_hostname BIO_ctrl */ # define BIO_C_SET_CONNECT 100 # define BIO_C_DO_STATE_MACHINE 101 # define BIO_C_SET_NBIO 102 # define BIO_C_SET_PROXY_PARAM 103 # define BIO_C_SET_FD 104 # define BIO_C_GET_FD 105 # define BIO_C_SET_FILE_PTR 106 # define BIO_C_GET_FILE_PTR 107 # define BIO_C_SET_FILENAME 108 # define BIO_C_SET_SSL 109 # define BIO_C_GET_SSL 110 # define BIO_C_SET_MD 111 # define BIO_C_GET_MD 112 # define BIO_C_GET_CIPHER_STATUS 113 # define BIO_C_SET_BUF_MEM 114 # define BIO_C_GET_BUF_MEM_PTR 115 # define BIO_C_GET_BUFF_NUM_LINES 116 # define BIO_C_SET_BUFF_SIZE 117 # define BIO_C_SET_ACCEPT 118 # define BIO_C_SSL_MODE 119 # define BIO_C_GET_MD_CTX 120 # define BIO_C_GET_PROXY_PARAM 121 # define BIO_C_SET_BUFF_READ_DATA 122/* data to read first */ # define BIO_C_GET_CONNECT 123 # define BIO_C_GET_ACCEPT 124 # define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125 # define BIO_C_GET_SSL_NUM_RENEGOTIATES 126 # define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127 # define BIO_C_FILE_SEEK 128 # define BIO_C_GET_CIPHER_CTX 129 # define BIO_C_SET_BUF_MEM_EOF_RETURN 130/* return end of input * value */ # define BIO_C_SET_BIND_MODE 131 # define BIO_C_GET_BIND_MODE 132 # define BIO_C_FILE_TELL 133 # define BIO_C_GET_SOCKS 134 # define BIO_C_SET_SOCKS 135 # define BIO_C_SET_WRITE_BUF_SIZE 136/* for BIO_s_bio */ # define BIO_C_GET_WRITE_BUF_SIZE 137 # define BIO_C_MAKE_BIO_PAIR 138 # define BIO_C_DESTROY_BIO_PAIR 139 # define BIO_C_GET_WRITE_GUARANTEE 140 # define BIO_C_GET_READ_REQUEST 141 # define BIO_C_SHUTDOWN_WR 142 # define BIO_C_NREAD0 143 # define BIO_C_NREAD 144 # define BIO_C_NWRITE0 145 # define BIO_C_NWRITE 146 # define BIO_C_RESET_READ_REQUEST 147 # define BIO_C_SET_MD_CTX 148 # define BIO_C_SET_PREFIX 149 # define BIO_C_GET_PREFIX 150 # define BIO_C_SET_SUFFIX 151 # define BIO_C_GET_SUFFIX 152 # define BIO_C_SET_EX_ARG 153 # define BIO_C_GET_EX_ARG 154 # define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) # define BIO_get_app_data(s) BIO_get_ex_data(s,0) /* BIO_s_connect() and BIO_s_socks4a_connect() */ # define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(char *)name) # define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1,(char *)port) # define BIO_set_conn_ip(b,ip) BIO_ctrl(b,BIO_C_SET_CONNECT,2,(char *)ip) # define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port) # define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) # define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1) # define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2) # define BIO_get_conn_int_port(b) BIO_ctrl(b,BIO_C_GET_CONNECT,3,NULL) # define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) /* BIO_s_accept() */ # define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name) # define BIO_get_accept_port(b) BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0) /* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ # define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?(void *)"a":NULL) # define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio) # define BIO_BIND_NORMAL 0 # define BIO_BIND_REUSEADDR_IF_UNUSED 1 # define BIO_BIND_REUSEADDR 2 # define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) # define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) /* BIO_s_accept() and BIO_s_connect() */ # define BIO_do_connect(b) BIO_do_handshake(b) # define BIO_do_accept(b) BIO_do_handshake(b) # define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) /* BIO_s_proxy_client() */ # define BIO_set_url(b,url) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,0,(char *)(url)) # define BIO_set_proxies(b,p) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,1,(char *)(p)) /* BIO_set_nbio(b,n) */ # define BIO_set_filter_bio(b,s) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,2,(char *)(s)) /* BIO *BIO_get_filter_bio(BIO *bio); */ # define BIO_set_proxy_cb(b,cb) BIO_callback_ctrl(b,BIO_C_SET_PROXY_PARAM,3,(void *(*cb)())) # define BIO_set_proxy_header(b,sk) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,4,(char *)sk) # define BIO_set_no_connect_return(b,bool) BIO_int_ctrl(b,BIO_C_SET_PROXY_PARAM,5,bool) # define BIO_get_proxy_header(b,skp) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,0,(char *)skp) # define BIO_get_proxies(b,pxy_p) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,1,(char *)(pxy_p)) # define BIO_get_url(b,url) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url)) # define BIO_get_no_connect_return(b) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,NULL) /* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and BIO_s_connect() */ # define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) # define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c) /* BIO_s_file() */ # define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp) # define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp) /* BIO_s_fd() and BIO_s_file() */ # define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL) # define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL) /* * name is cast to lose const, but might be better to route through a * function so we can do it safely */ # ifdef CONST_STRICT /* * If you are wondering why this isn't defined, its because CONST_STRICT is * purely a compile-time kludge to allow const to be checked. */ int BIO_read_filename(BIO *b, const char *name); # else # define BIO_read_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ BIO_CLOSE|BIO_FP_READ,(char *)name) # endif # define BIO_write_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ BIO_CLOSE|BIO_FP_WRITE,name) # define BIO_append_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ BIO_CLOSE|BIO_FP_APPEND,name) # define BIO_rw_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name) /* * WARNING WARNING, this ups the reference count on the read bio of the SSL * structure. This is because the ssl read BIO is now pointed to by the * next_bio field in the bio. So when you free the BIO, make sure you are * doing a BIO_free_all() to catch the underlying BIO. */ # define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl) # define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp) # define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) # define BIO_set_ssl_renegotiate_bytes(b,num) \ BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL) # define BIO_get_num_renegotiates(b) \ BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL) # define BIO_set_ssl_renegotiate_timeout(b,seconds) \ BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL) /* defined in evp.h */ /* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)md) */ # define BIO_get_mem_data(b,pp) BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)pp) # define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)bm) # define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0,(char *)pp) # define BIO_set_mem_eof_return(b,v) \ BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL) /* For the BIO_f_buffer() type */ # define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL) # define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL) # define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0) # define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1) # define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf) /* Don't use the next one unless you know what you are doing :-) */ # define BIO_dup_state(b,ret) BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret)) # define BIO_reset(b) (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL) # define BIO_eof(b) (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL) # define BIO_set_close(b,c) (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL) # define BIO_get_close(b) (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL) # define BIO_pending(b) (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL) # define BIO_wpending(b) (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL) /* ...pending macros have inappropriate return type */ size_t BIO_ctrl_pending(BIO *b); size_t BIO_ctrl_wpending(BIO *b); # define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL) # define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \ cbp) # define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb) /* For the BIO_f_buffer() type */ # define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL) /* For BIO_s_bio() */ # define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL) # define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL) # define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) # define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) # define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL) /* macros with inappropriate type -- but ...pending macros use int too: */ # define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL) # define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL) size_t BIO_ctrl_get_write_guarantee(BIO *b); size_t BIO_ctrl_get_read_request(BIO *b); int BIO_ctrl_reset_read_request(BIO *b); /* ctrl macros for dgram */ # define BIO_ctrl_dgram_connect(b,peer) \ (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)peer) # define BIO_ctrl_set_connected(b, state, peer) \ (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, state, (char *)peer) # define BIO_dgram_recv_timedout(b) \ (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL) # define BIO_dgram_send_timedout(b) \ (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL) # define BIO_dgram_get_peer(b,peer) \ (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)peer) # define BIO_dgram_set_peer(b,peer) \ (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)peer) # define BIO_dgram_get_mtu_overhead(b) \ (unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_MTU_OVERHEAD, 0, NULL) /* These two aren't currently implemented */ /* int BIO_get_ex_num(BIO *bio); */ /* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */ int BIO_set_ex_data(BIO *bio, int idx, void *data); void *BIO_get_ex_data(BIO *bio, int idx); int BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); unsigned long BIO_number_read(BIO *bio); unsigned long BIO_number_written(BIO *bio); /* For BIO_f_asn1() */ int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, asn1_ps_func *prefix_free); int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix, asn1_ps_func **pprefix_free); int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, asn1_ps_func *suffix_free); int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, asn1_ps_func **psuffix_free); # ifndef OPENSSL_NO_FP_API BIO_METHOD *BIO_s_file(void); BIO *BIO_new_file(const char *filename, const char *mode); BIO *BIO_new_fp(FILE *stream, int close_flag); # define BIO_s_file_internal BIO_s_file # endif BIO *BIO_new(BIO_METHOD *type); int BIO_set(BIO *a, BIO_METHOD *type); int BIO_free(BIO *a); void BIO_vfree(BIO *a); int BIO_read(BIO *b, void *data, int len); int BIO_gets(BIO *bp, char *buf, int size); int BIO_write(BIO *b, const void *data, int len); int BIO_puts(BIO *bp, const char *buf); int BIO_indent(BIO *b, int indent, int max); long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg); long BIO_callback_ctrl(BIO *b, int cmd, void (*fp) (struct bio_st *, int, const char *, int, long, long)); char *BIO_ptr_ctrl(BIO *bp, int cmd, long larg); long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg); BIO *BIO_push(BIO *b, BIO *append); BIO *BIO_pop(BIO *b); void BIO_free_all(BIO *a); BIO *BIO_find_type(BIO *b, int bio_type); BIO *BIO_next(BIO *b); BIO *BIO_get_retry_BIO(BIO *bio, int *reason); int BIO_get_retry_reason(BIO *bio); BIO *BIO_dup_chain(BIO *in); int BIO_nread0(BIO *bio, char **buf); int BIO_nread(BIO *bio, char **buf, int num); int BIO_nwrite0(BIO *bio, char **buf); int BIO_nwrite(BIO *bio, char **buf, int num); long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, long argl, long ret); BIO_METHOD *BIO_s_mem(void); BIO *BIO_new_mem_buf(const void *buf, int len); BIO_METHOD *BIO_s_socket(void); BIO_METHOD *BIO_s_connect(void); BIO_METHOD *BIO_s_accept(void); BIO_METHOD *BIO_s_fd(void); # ifndef OPENSSL_SYS_OS2 BIO_METHOD *BIO_s_log(void); # endif BIO_METHOD *BIO_s_bio(void); BIO_METHOD *BIO_s_null(void); BIO_METHOD *BIO_f_null(void); BIO_METHOD *BIO_f_buffer(void); # ifdef OPENSSL_SYS_VMS BIO_METHOD *BIO_f_linebuffer(void); # endif BIO_METHOD *BIO_f_nbio_test(void); # ifndef OPENSSL_NO_DGRAM BIO_METHOD *BIO_s_datagram(void); # ifndef OPENSSL_NO_SCTP BIO_METHOD *BIO_s_datagram_sctp(void); # endif # endif /* BIO_METHOD *BIO_f_ber(void); */ int BIO_sock_should_retry(int i); int BIO_sock_non_fatal_error(int error); int BIO_dgram_non_fatal_error(int error); int BIO_fd_should_retry(int i); int BIO_fd_non_fatal_error(int error); int BIO_dump_cb(int (*cb) (const void *data, size_t len, void *u), void *u, const char *s, int len); int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u), void *u, const char *s, int len, int indent); int BIO_dump(BIO *b, const char *bytes, int len); int BIO_dump_indent(BIO *b, const char *bytes, int len, int indent); # ifndef OPENSSL_NO_FP_API int BIO_dump_fp(FILE *fp, const char *s, int len); int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent); # endif int BIO_hex_string(BIO *out, int indent, int width, unsigned char *data, int datalen); struct hostent *BIO_gethostbyname(const char *name); /*- * We might want a thread-safe interface too: * struct hostent *BIO_gethostbyname_r(const char *name, * struct hostent *result, void *buffer, size_t buflen); * or something similar (caller allocates a struct hostent, * pointed to by "result", and additional buffer space for the various * substructures; if the buffer does not suffice, NULL is returned * and an appropriate error code is set). */ int BIO_sock_error(int sock); int BIO_socket_ioctl(int fd, long type, void *arg); int BIO_socket_nbio(int fd, int mode); int BIO_get_port(const char *str, unsigned short *port_ptr); int BIO_get_host_ip(const char *str, unsigned char *ip); int BIO_get_accept_socket(char *host_port, int mode); int BIO_accept(int sock, char **ip_port); int BIO_sock_init(void); void BIO_sock_cleanup(void); int BIO_set_tcp_ndelay(int sock, int turn_on); BIO *BIO_new_socket(int sock, int close_flag); BIO *BIO_new_dgram(int fd, int close_flag); # ifndef OPENSSL_NO_SCTP BIO *BIO_new_dgram_sctp(int fd, int close_flag); int BIO_dgram_is_sctp(BIO *bio); int BIO_dgram_sctp_notification_cb(BIO *b, void (*handle_notifications) (BIO *bio, void *context, void *buf), void *context); int BIO_dgram_sctp_wait_for_dry(BIO *b); int BIO_dgram_sctp_msg_waiting(BIO *b); # endif BIO *BIO_new_fd(int fd, int close_flag); BIO *BIO_new_connect(const char *host_port); BIO *BIO_new_accept(const char *host_port); int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, BIO **bio2, size_t writebuf2); /* * If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints. * Otherwise returns 0 and sets *bio1 and *bio2 to NULL. Size 0 uses default * value. */ void BIO_copy_next_retry(BIO *b); /* * long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); */ # ifdef __GNUC__ # define __bio_h__attr__ __attribute__ # else # define __bio_h__attr__(x) # endif int BIO_printf(BIO *bio, const char *format, ...) __bio_h__attr__((__format__(__printf__, 2, 3))); int BIO_vprintf(BIO *bio, const char *format, va_list args) __bio_h__attr__((__format__(__printf__, 2, 0))); int BIO_snprintf(char *buf, size_t n, const char *format, ...) __bio_h__attr__((__format__(__printf__, 3, 4))); int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) __bio_h__attr__((__format__(__printf__, 3, 0))); # undef __bio_h__attr__ /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_BIO_strings(void); /* Error codes for the BIO functions. */ /* Function codes. */ # define BIO_F_ACPT_STATE 100 # define BIO_F_BIO_ACCEPT 101 # define BIO_F_BIO_BER_GET_HEADER 102 # define BIO_F_BIO_CALLBACK_CTRL 131 # define BIO_F_BIO_CTRL 103 # define BIO_F_BIO_GETHOSTBYNAME 120 # define BIO_F_BIO_GETS 104 # define BIO_F_BIO_GET_ACCEPT_SOCKET 105 # define BIO_F_BIO_GET_HOST_IP 106 # define BIO_F_BIO_GET_PORT 107 # define BIO_F_BIO_MAKE_PAIR 121 # define BIO_F_BIO_NEW 108 # define BIO_F_BIO_NEW_FILE 109 # define BIO_F_BIO_NEW_MEM_BUF 126 # define BIO_F_BIO_NREAD 123 # define BIO_F_BIO_NREAD0 124 # define BIO_F_BIO_NWRITE 125 # define BIO_F_BIO_NWRITE0 122 # define BIO_F_BIO_PUTS 110 # define BIO_F_BIO_READ 111 # define BIO_F_BIO_SOCK_INIT 112 # define BIO_F_BIO_WRITE 113 # define BIO_F_BUFFER_CTRL 114 # define BIO_F_CONN_CTRL 127 # define BIO_F_CONN_STATE 115 # define BIO_F_DGRAM_SCTP_READ 132 # define BIO_F_DGRAM_SCTP_WRITE 133 # define BIO_F_FILE_CTRL 116 # define BIO_F_FILE_READ 130 # define BIO_F_LINEBUFFER_CTRL 129 # define BIO_F_MEM_READ 128 # define BIO_F_MEM_WRITE 117 # define BIO_F_SSL_NEW 118 # define BIO_F_WSASTARTUP 119 /* Reason codes. */ # define BIO_R_ACCEPT_ERROR 100 # define BIO_R_BAD_FOPEN_MODE 101 # define BIO_R_BAD_HOSTNAME_LOOKUP 102 # define BIO_R_BROKEN_PIPE 124 # define BIO_R_CONNECT_ERROR 103 # define BIO_R_EOF_ON_MEMORY_BIO 127 # define BIO_R_ERROR_SETTING_NBIO 104 # define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105 # define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106 # define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107 # define BIO_R_INVALID_ARGUMENT 125 # define BIO_R_INVALID_IP_ADDRESS 108 # define BIO_R_IN_USE 123 # define BIO_R_KEEPALIVE 109 # define BIO_R_NBIO_CONNECT_ERROR 110 # define BIO_R_NO_ACCEPT_PORT_SPECIFIED 111 # define BIO_R_NO_HOSTNAME_SPECIFIED 112 # define BIO_R_NO_PORT_DEFINED 113 # define BIO_R_NO_PORT_SPECIFIED 114 # define BIO_R_NO_SUCH_FILE 128 # define BIO_R_NULL_PARAMETER 115 # define BIO_R_TAG_MISMATCH 116 # define BIO_R_UNABLE_TO_BIND_SOCKET 117 # define BIO_R_UNABLE_TO_CREATE_SOCKET 118 # define BIO_R_UNABLE_TO_LISTEN_SOCKET 119 # define BIO_R_UNINITIALIZED 120 # define BIO_R_UNSUPPORTED_METHOD 121 # define BIO_R_WRITE_TO_READ_ONLY_BIO 126 # define BIO_R_WSASTARTUP 122 #ifdef __cplusplus } #endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/rc4.h���������������������������������������������������������������������������������������0000644�����������������00000007337�14763166030�0007110 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/rc4/rc4.h */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_RC4_H # define HEADER_RC4_H # include <openssl/opensslconf.h>/* OPENSSL_NO_RC4, RC4_INT */ # ifdef OPENSSL_NO_RC4 # error RC4 is disabled. # endif # include <stddef.h> #ifdef __cplusplus extern "C" { #endif typedef struct rc4_key_st { RC4_INT x, y; RC4_INT data[256]; } RC4_KEY; const char *RC4_options(void); void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, unsigned char *outdata); #ifdef __cplusplus } #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/x509v3.h������������������������������������������������������������������������������������0000644�����������������00000116707�14763166030�0007400 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* x509v3.h */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project * 1999. */ /* ==================================================================== * Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * licensing@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_X509V3_H # define HEADER_X509V3_H # include <openssl/bio.h> # include <openssl/x509.h> # include <openssl/conf.h> #ifdef __cplusplus extern "C" { #endif # ifdef OPENSSL_SYS_WIN32 /* Under Win32 these are defined in wincrypt.h */ # undef X509_NAME # undef X509_CERT_PAIR # undef X509_EXTENSIONS # endif /* Forward reference */ struct v3_ext_method; struct v3_ext_ctx; /* Useful typedefs */ typedef void *(*X509V3_EXT_NEW)(void); typedef void (*X509V3_EXT_FREE) (void *); typedef void *(*X509V3_EXT_D2I)(void *, const unsigned char **, long); typedef int (*X509V3_EXT_I2D) (void *, unsigned char **); typedef STACK_OF(CONF_VALUE) * (*X509V3_EXT_I2V) (const struct v3_ext_method *method, void *ext, STACK_OF(CONF_VALUE) *extlist); typedef void *(*X509V3_EXT_V2I)(const struct v3_ext_method *method, struct v3_ext_ctx *ctx, STACK_OF(CONF_VALUE) *values); typedef char *(*X509V3_EXT_I2S)(const struct v3_ext_method *method, void *ext); typedef void *(*X509V3_EXT_S2I)(const struct v3_ext_method *method, struct v3_ext_ctx *ctx, const char *str); typedef int (*X509V3_EXT_I2R) (const struct v3_ext_method *method, void *ext, BIO *out, int indent); typedef void *(*X509V3_EXT_R2I)(const struct v3_ext_method *method, struct v3_ext_ctx *ctx, const char *str); /* V3 extension structure */ struct v3_ext_method { int ext_nid; int ext_flags; /* If this is set the following four fields are ignored */ ASN1_ITEM_EXP *it; /* Old style ASN1 calls */ X509V3_EXT_NEW ext_new; X509V3_EXT_FREE ext_free; X509V3_EXT_D2I d2i; X509V3_EXT_I2D i2d; /* The following pair is used for string extensions */ X509V3_EXT_I2S i2s; X509V3_EXT_S2I s2i; /* The following pair is used for multi-valued extensions */ X509V3_EXT_I2V i2v; X509V3_EXT_V2I v2i; /* The following are used for raw extensions */ X509V3_EXT_I2R i2r; X509V3_EXT_R2I r2i; void *usr_data; /* Any extension specific data */ }; typedef struct X509V3_CONF_METHOD_st { char *(*get_string) (void *db, char *section, char *value); STACK_OF(CONF_VALUE) *(*get_section) (void *db, char *section); void (*free_string) (void *db, char *string); void (*free_section) (void *db, STACK_OF(CONF_VALUE) *section); } X509V3_CONF_METHOD; /* Context specific info */ struct v3_ext_ctx { # define CTX_TEST 0x1 int flags; X509 *issuer_cert; X509 *subject_cert; X509_REQ *subject_req; X509_CRL *crl; X509V3_CONF_METHOD *db_meth; void *db; /* Maybe more here */ }; typedef struct v3_ext_method X509V3_EXT_METHOD; DECLARE_STACK_OF(X509V3_EXT_METHOD) /* ext_flags values */ # define X509V3_EXT_DYNAMIC 0x1 # define X509V3_EXT_CTX_DEP 0x2 # define X509V3_EXT_MULTILINE 0x4 typedef BIT_STRING_BITNAME ENUMERATED_NAMES; typedef struct BASIC_CONSTRAINTS_st { int ca; ASN1_INTEGER *pathlen; } BASIC_CONSTRAINTS; typedef struct PKEY_USAGE_PERIOD_st { ASN1_GENERALIZEDTIME *notBefore; ASN1_GENERALIZEDTIME *notAfter; } PKEY_USAGE_PERIOD; typedef struct otherName_st { ASN1_OBJECT *type_id; ASN1_TYPE *value; } OTHERNAME; typedef struct EDIPartyName_st { ASN1_STRING *nameAssigner; ASN1_STRING *partyName; } EDIPARTYNAME; typedef struct GENERAL_NAME_st { # define GEN_OTHERNAME 0 # define GEN_EMAIL 1 # define GEN_DNS 2 # define GEN_X400 3 # define GEN_DIRNAME 4 # define GEN_EDIPARTY 5 # define GEN_URI 6 # define GEN_IPADD 7 # define GEN_RID 8 int type; union { char *ptr; OTHERNAME *otherName; /* otherName */ ASN1_IA5STRING *rfc822Name; ASN1_IA5STRING *dNSName; ASN1_STRING *x400Address; X509_NAME *directoryName; EDIPARTYNAME *ediPartyName; ASN1_IA5STRING *uniformResourceIdentifier; ASN1_OCTET_STRING *iPAddress; ASN1_OBJECT *registeredID; /* Old names */ ASN1_OCTET_STRING *ip; /* iPAddress */ X509_NAME *dirn; /* dirn */ ASN1_IA5STRING *ia5; /* rfc822Name, dNSName, * uniformResourceIdentifier */ ASN1_OBJECT *rid; /* registeredID */ ASN1_TYPE *other; /* x400Address */ } d; } GENERAL_NAME; typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES; typedef struct ACCESS_DESCRIPTION_st { ASN1_OBJECT *method; GENERAL_NAME *location; } ACCESS_DESCRIPTION; typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS; typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE; DECLARE_STACK_OF(GENERAL_NAME) DECLARE_ASN1_SET_OF(GENERAL_NAME) DECLARE_STACK_OF(ACCESS_DESCRIPTION) DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) typedef struct DIST_POINT_NAME_st { int type; union { GENERAL_NAMES *fullname; STACK_OF(X509_NAME_ENTRY) *relativename; } name; /* If relativename then this contains the full distribution point name */ X509_NAME *dpname; } DIST_POINT_NAME; /* All existing reasons */ # define CRLDP_ALL_REASONS 0x807f # define CRL_REASON_NONE -1 # define CRL_REASON_UNSPECIFIED 0 # define CRL_REASON_KEY_COMPROMISE 1 # define CRL_REASON_CA_COMPROMISE 2 # define CRL_REASON_AFFILIATION_CHANGED 3 # define CRL_REASON_SUPERSEDED 4 # define CRL_REASON_CESSATION_OF_OPERATION 5 # define CRL_REASON_CERTIFICATE_HOLD 6 # define CRL_REASON_REMOVE_FROM_CRL 8 # define CRL_REASON_PRIVILEGE_WITHDRAWN 9 # define CRL_REASON_AA_COMPROMISE 10 struct DIST_POINT_st { DIST_POINT_NAME *distpoint; ASN1_BIT_STRING *reasons; GENERAL_NAMES *CRLissuer; int dp_reasons; }; typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS; DECLARE_STACK_OF(DIST_POINT) DECLARE_ASN1_SET_OF(DIST_POINT) struct AUTHORITY_KEYID_st { ASN1_OCTET_STRING *keyid; GENERAL_NAMES *issuer; ASN1_INTEGER *serial; }; /* Strong extranet structures */ typedef struct SXNET_ID_st { ASN1_INTEGER *zone; ASN1_OCTET_STRING *user; } SXNETID; DECLARE_STACK_OF(SXNETID) DECLARE_ASN1_SET_OF(SXNETID) typedef struct SXNET_st { ASN1_INTEGER *version; STACK_OF(SXNETID) *ids; } SXNET; typedef struct NOTICEREF_st { ASN1_STRING *organization; STACK_OF(ASN1_INTEGER) *noticenos; } NOTICEREF; typedef struct USERNOTICE_st { NOTICEREF *noticeref; ASN1_STRING *exptext; } USERNOTICE; typedef struct POLICYQUALINFO_st { ASN1_OBJECT *pqualid; union { ASN1_IA5STRING *cpsuri; USERNOTICE *usernotice; ASN1_TYPE *other; } d; } POLICYQUALINFO; DECLARE_STACK_OF(POLICYQUALINFO) DECLARE_ASN1_SET_OF(POLICYQUALINFO) typedef struct POLICYINFO_st { ASN1_OBJECT *policyid; STACK_OF(POLICYQUALINFO) *qualifiers; } POLICYINFO; typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES; DECLARE_STACK_OF(POLICYINFO) DECLARE_ASN1_SET_OF(POLICYINFO) typedef struct POLICY_MAPPING_st { ASN1_OBJECT *issuerDomainPolicy; ASN1_OBJECT *subjectDomainPolicy; } POLICY_MAPPING; DECLARE_STACK_OF(POLICY_MAPPING) typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS; typedef struct GENERAL_SUBTREE_st { GENERAL_NAME *base; ASN1_INTEGER *minimum; ASN1_INTEGER *maximum; } GENERAL_SUBTREE; DECLARE_STACK_OF(GENERAL_SUBTREE) struct NAME_CONSTRAINTS_st { STACK_OF(GENERAL_SUBTREE) *permittedSubtrees; STACK_OF(GENERAL_SUBTREE) *excludedSubtrees; }; typedef struct POLICY_CONSTRAINTS_st { ASN1_INTEGER *requireExplicitPolicy; ASN1_INTEGER *inhibitPolicyMapping; } POLICY_CONSTRAINTS; /* Proxy certificate structures, see RFC 3820 */ typedef struct PROXY_POLICY_st { ASN1_OBJECT *policyLanguage; ASN1_OCTET_STRING *policy; } PROXY_POLICY; typedef struct PROXY_CERT_INFO_EXTENSION_st { ASN1_INTEGER *pcPathLengthConstraint; PROXY_POLICY *proxyPolicy; } PROXY_CERT_INFO_EXTENSION; DECLARE_ASN1_FUNCTIONS(PROXY_POLICY) DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) struct ISSUING_DIST_POINT_st { DIST_POINT_NAME *distpoint; int onlyuser; int onlyCA; ASN1_BIT_STRING *onlysomereasons; int indirectCRL; int onlyattr; }; /* Values in idp_flags field */ /* IDP present */ # define IDP_PRESENT 0x1 /* IDP values inconsistent */ # define IDP_INVALID 0x2 /* onlyuser true */ # define IDP_ONLYUSER 0x4 /* onlyCA true */ # define IDP_ONLYCA 0x8 /* onlyattr true */ # define IDP_ONLYATTR 0x10 /* indirectCRL true */ # define IDP_INDIRECT 0x20 /* onlysomereasons present */ # define IDP_REASONS 0x40 # define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->section, \ ",name:", val->name, ",value:", val->value); # define X509V3_set_ctx_test(ctx) \ X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST) # define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL; # define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \ 0,0,0,0, \ 0,0, \ (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \ (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \ NULL, NULL, \ table} # define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \ 0,0,0,0, \ (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \ (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \ 0,0,0,0, \ NULL} # define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} /* X509_PURPOSE stuff */ # define EXFLAG_BCONS 0x1 # define EXFLAG_KUSAGE 0x2 # define EXFLAG_XKUSAGE 0x4 # define EXFLAG_NSCERT 0x8 # define EXFLAG_CA 0x10 /* Really self issued not necessarily self signed */ # define EXFLAG_SI 0x20 # define EXFLAG_V1 0x40 # define EXFLAG_INVALID 0x80 # define EXFLAG_SET 0x100 # define EXFLAG_CRITICAL 0x200 # define EXFLAG_PROXY 0x400 # define EXFLAG_INVALID_POLICY 0x800 # define EXFLAG_FRESHEST 0x1000 /* Self signed */ # define EXFLAG_SS 0x2000 # define KU_DIGITAL_SIGNATURE 0x0080 # define KU_NON_REPUDIATION 0x0040 # define KU_KEY_ENCIPHERMENT 0x0020 # define KU_DATA_ENCIPHERMENT 0x0010 # define KU_KEY_AGREEMENT 0x0008 # define KU_KEY_CERT_SIGN 0x0004 # define KU_CRL_SIGN 0x0002 # define KU_ENCIPHER_ONLY 0x0001 # define KU_DECIPHER_ONLY 0x8000 # define NS_SSL_CLIENT 0x80 # define NS_SSL_SERVER 0x40 # define NS_SMIME 0x20 # define NS_OBJSIGN 0x10 # define NS_SSL_CA 0x04 # define NS_SMIME_CA 0x02 # define NS_OBJSIGN_CA 0x01 # define NS_ANY_CA (NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA) # define XKU_SSL_SERVER 0x1 # define XKU_SSL_CLIENT 0x2 # define XKU_SMIME 0x4 # define XKU_CODE_SIGN 0x8 # define XKU_SGC 0x10 # define XKU_OCSP_SIGN 0x20 # define XKU_TIMESTAMP 0x40 # define XKU_DVCS 0x80 # define XKU_ANYEKU 0x100 # define X509_PURPOSE_DYNAMIC 0x1 # define X509_PURPOSE_DYNAMIC_NAME 0x2 typedef struct x509_purpose_st { int purpose; int trust; /* Default trust ID */ int flags; int (*check_purpose) (const struct x509_purpose_st *, const X509 *, int); char *name; char *sname; void *usr_data; } X509_PURPOSE; # define X509_PURPOSE_SSL_CLIENT 1 # define X509_PURPOSE_SSL_SERVER 2 # define X509_PURPOSE_NS_SSL_SERVER 3 # define X509_PURPOSE_SMIME_SIGN 4 # define X509_PURPOSE_SMIME_ENCRYPT 5 # define X509_PURPOSE_CRL_SIGN 6 # define X509_PURPOSE_ANY 7 # define X509_PURPOSE_OCSP_HELPER 8 # define X509_PURPOSE_TIMESTAMP_SIGN 9 # define X509_PURPOSE_MIN 1 # define X509_PURPOSE_MAX 9 /* Flags for X509V3_EXT_print() */ # define X509V3_EXT_UNKNOWN_MASK (0xfL << 16) /* Return error for unknown extensions */ # define X509V3_EXT_DEFAULT 0 /* Print error for unknown extensions */ # define X509V3_EXT_ERROR_UNKNOWN (1L << 16) /* ASN1 parse unknown extensions */ # define X509V3_EXT_PARSE_UNKNOWN (2L << 16) /* BIO_dump unknown extensions */ # define X509V3_EXT_DUMP_UNKNOWN (3L << 16) /* Flags for X509V3_add1_i2d */ # define X509V3_ADD_OP_MASK 0xfL # define X509V3_ADD_DEFAULT 0L # define X509V3_ADD_APPEND 1L # define X509V3_ADD_REPLACE 2L # define X509V3_ADD_REPLACE_EXISTING 3L # define X509V3_ADD_KEEP_EXISTING 4L # define X509V3_ADD_DELETE 5L # define X509V3_ADD_SILENT 0x10 DECLARE_STACK_OF(X509_PURPOSE) DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) DECLARE_ASN1_FUNCTIONS(SXNET) DECLARE_ASN1_FUNCTIONS(SXNETID) int SXNET_add_id_asc(SXNET **psx, char *zone, char *user, int userlen); int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, char *user, int userlen); int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, char *user, int userlen); ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, char *zone); ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone); ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone); DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID) DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD) DECLARE_ASN1_FUNCTIONS(GENERAL_NAME) GENERAL_NAME *GENERAL_NAME_dup(GENERAL_NAME *a); int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b); ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, ASN1_BIT_STRING *bits, STACK_OF(CONF_VALUE) *extlist); STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, GENERAL_NAME *gen, STACK_OF(CONF_VALUE) *ret); int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen); DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES) STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method, GENERAL_NAMES *gen, STACK_OF(CONF_VALUE) *extlist); GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); DECLARE_ASN1_FUNCTIONS(OTHERNAME) DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME) int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b); void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value); void *GENERAL_NAME_get0_value(GENERAL_NAME *a, int *ptype); int GENERAL_NAME_set0_othername(GENERAL_NAME *gen, ASN1_OBJECT *oid, ASN1_TYPE *value); int GENERAL_NAME_get0_otherName(GENERAL_NAME *gen, ASN1_OBJECT **poid, ASN1_TYPE **pvalue); char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *ia5); ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *str); DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE) int i2a_ACCESS_DESCRIPTION(BIO *bp, ACCESS_DESCRIPTION *a); DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES) DECLARE_ASN1_FUNCTIONS(POLICYINFO) DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO) DECLARE_ASN1_FUNCTIONS(USERNOTICE) DECLARE_ASN1_FUNCTIONS(NOTICEREF) DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS) DECLARE_ASN1_FUNCTIONS(DIST_POINT) DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME) DECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT) int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, X509_NAME *iname); int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc); DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION) DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS) DECLARE_ASN1_ITEM(POLICY_MAPPING) DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING) DECLARE_ASN1_ITEM(POLICY_MAPPINGS) DECLARE_ASN1_ITEM(GENERAL_SUBTREE) DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE) DECLARE_ASN1_ITEM(NAME_CONSTRAINTS) DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS) DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS) GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out, const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, int gen_type, char *value, int is_nc); # ifdef HEADER_CONF_H GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, CONF_VALUE *cnf); GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, CONF_VALUE *cnf, int is_nc); void X509V3_conf_free(CONF_VALUE *val); X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, char *value); X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, char *name, char *value); int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, char *section, STACK_OF(X509_EXTENSION) **sk); int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509 *cert); int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_REQ *req); int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_CRL *crl); X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, int ext_nid, char *value); X509_EXTENSION *X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, char *name, char *value); int X509V3_EXT_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, char *section, X509 *cert); int X509V3_EXT_REQ_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, char *section, X509_REQ *req); int X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, char *section, X509_CRL *crl); int X509V3_add_value_bool_nf(char *name, int asn1_bool, STACK_OF(CONF_VALUE) **extlist); int X509V3_get_value_bool(CONF_VALUE *value, int *asn1_bool); int X509V3_get_value_int(CONF_VALUE *value, ASN1_INTEGER **aint); void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf); void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash); # endif char *X509V3_get_string(X509V3_CTX *ctx, char *name, char *section); STACK_OF(CONF_VALUE) *X509V3_get_section(X509V3_CTX *ctx, char *section); void X509V3_string_free(X509V3_CTX *ctx, char *str); void X509V3_section_free(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section); void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject, X509_REQ *req, X509_CRL *crl, int flags); int X509V3_add_value(const char *name, const char *value, STACK_OF(CONF_VALUE) **extlist); int X509V3_add_value_uchar(const char *name, const unsigned char *value, STACK_OF(CONF_VALUE) **extlist); int X509V3_add_value_bool(const char *name, int asn1_bool, STACK_OF(CONF_VALUE) **extlist); int X509V3_add_value_int(const char *name, ASN1_INTEGER *aint, STACK_OF(CONF_VALUE) **extlist); char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, ASN1_INTEGER *aint); ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, char *value); char *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint); char *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint); int X509V3_EXT_add(X509V3_EXT_METHOD *ext); int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist); int X509V3_EXT_add_alias(int nid_to, int nid_from); void X509V3_EXT_cleanup(void); const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext); const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid); int X509V3_add_standard_extensions(void); STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line); void *X509V3_EXT_d2i(X509_EXTENSION *ext); void *X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit, int *idx); int X509V3_EXT_free(int nid, void *ext_data); X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, int crit, unsigned long flags); char *hex_to_string(const unsigned char *buffer, long len); unsigned char *string_to_hex(const char *str, long *len); int name_cmp(const char *name, const char *cmp); void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, int ml); int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int indent); int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent); int X509V3_extensions_print(BIO *out, char *title, STACK_OF(X509_EXTENSION) *exts, unsigned long flag, int indent); int X509_check_ca(X509 *x); int X509_check_purpose(X509 *x, int id, int ca); int X509_supported_extension(X509_EXTENSION *ex); int X509_PURPOSE_set(int *p, int purpose); int X509_check_issued(X509 *issuer, X509 *subject); int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid); int X509_PURPOSE_get_count(void); X509_PURPOSE *X509_PURPOSE_get0(int idx); int X509_PURPOSE_get_by_sname(char *sname); int X509_PURPOSE_get_by_id(int id); int X509_PURPOSE_add(int id, int trust, int flags, int (*ck) (const X509_PURPOSE *, const X509 *, int), char *name, char *sname, void *arg); char *X509_PURPOSE_get0_name(X509_PURPOSE *xp); char *X509_PURPOSE_get0_sname(X509_PURPOSE *xp); int X509_PURPOSE_get_trust(X509_PURPOSE *xp); void X509_PURPOSE_cleanup(void); int X509_PURPOSE_get_id(X509_PURPOSE *); STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x); STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x); void X509_email_free(STACK_OF(OPENSSL_STRING) *sk); STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x); /* Flags for X509_check_* functions */ /* * Always check subject name for host match even if subject alt names present */ # define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT 0x1 /* Disable wildcard matching for dnsName fields and common name. */ # define X509_CHECK_FLAG_NO_WILDCARDS 0x2 /* Wildcards must not match a partial label. */ # define X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS 0x4 /* Allow (non-partial) wildcards to match multiple labels. */ # define X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS 0x8 /* Constraint verifier subdomain patterns to match a single labels. */ # define X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS 0x10 /* * Match reference identifiers starting with "." to any sub-domain. * This is a non-public flag, turned on implicitly when the subject * reference identity is a DNS name. */ # define _X509_CHECK_FLAG_DOT_SUBDOMAINS 0x8000 int X509_check_host(X509 *x, const char *chk, size_t chklen, unsigned int flags, char **peername); int X509_check_email(X509 *x, const char *chk, size_t chklen, unsigned int flags); int X509_check_ip(X509 *x, const unsigned char *chk, size_t chklen, unsigned int flags); int X509_check_ip_asc(X509 *x, const char *ipasc, unsigned int flags); ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc); ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc); int a2i_ipadd(unsigned char *ipout, const char *ipasc); int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE) *dn_sk, unsigned long chtype); void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent); DECLARE_STACK_OF(X509_POLICY_NODE) # ifndef OPENSSL_NO_RFC3779 typedef struct ASRange_st { ASN1_INTEGER *min, *max; } ASRange; # define ASIdOrRange_id 0 # define ASIdOrRange_range 1 typedef struct ASIdOrRange_st { int type; union { ASN1_INTEGER *id; ASRange *range; } u; } ASIdOrRange; typedef STACK_OF(ASIdOrRange) ASIdOrRanges; DECLARE_STACK_OF(ASIdOrRange) # define ASIdentifierChoice_inherit 0 # define ASIdentifierChoice_asIdsOrRanges 1 typedef struct ASIdentifierChoice_st { int type; union { ASN1_NULL *inherit; ASIdOrRanges *asIdsOrRanges; } u; } ASIdentifierChoice; typedef struct ASIdentifiers_st { ASIdentifierChoice *asnum, *rdi; } ASIdentifiers; DECLARE_ASN1_FUNCTIONS(ASRange) DECLARE_ASN1_FUNCTIONS(ASIdOrRange) DECLARE_ASN1_FUNCTIONS(ASIdentifierChoice) DECLARE_ASN1_FUNCTIONS(ASIdentifiers) typedef struct IPAddressRange_st { ASN1_BIT_STRING *min, *max; } IPAddressRange; # define IPAddressOrRange_addressPrefix 0 # define IPAddressOrRange_addressRange 1 typedef struct IPAddressOrRange_st { int type; union { ASN1_BIT_STRING *addressPrefix; IPAddressRange *addressRange; } u; } IPAddressOrRange; typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges; DECLARE_STACK_OF(IPAddressOrRange) # define IPAddressChoice_inherit 0 # define IPAddressChoice_addressesOrRanges 1 typedef struct IPAddressChoice_st { int type; union { ASN1_NULL *inherit; IPAddressOrRanges *addressesOrRanges; } u; } IPAddressChoice; typedef struct IPAddressFamily_st { ASN1_OCTET_STRING *addressFamily; IPAddressChoice *ipAddressChoice; } IPAddressFamily; typedef STACK_OF(IPAddressFamily) IPAddrBlocks; DECLARE_STACK_OF(IPAddressFamily) DECLARE_ASN1_FUNCTIONS(IPAddressRange) DECLARE_ASN1_FUNCTIONS(IPAddressOrRange) DECLARE_ASN1_FUNCTIONS(IPAddressChoice) DECLARE_ASN1_FUNCTIONS(IPAddressFamily) /* * API tag for elements of the ASIdentifer SEQUENCE. */ # define V3_ASID_ASNUM 0 # define V3_ASID_RDI 1 /* * AFI values, assigned by IANA. It'd be nice to make the AFI * handling code totally generic, but there are too many little things * that would need to be defined for other address families for it to * be worth the trouble. */ # define IANA_AFI_IPV4 1 # define IANA_AFI_IPV6 2 /* * Utilities to construct and extract values from RFC3779 extensions, * since some of the encodings (particularly for IP address prefixes * and ranges) are a bit tedious to work with directly. */ int v3_asid_add_inherit(ASIdentifiers *asid, int which); int v3_asid_add_id_or_range(ASIdentifiers *asid, int which, ASN1_INTEGER *min, ASN1_INTEGER *max); int v3_addr_add_inherit(IPAddrBlocks *addr, const unsigned afi, const unsigned *safi); int v3_addr_add_prefix(IPAddrBlocks *addr, const unsigned afi, const unsigned *safi, unsigned char *a, const int prefixlen); int v3_addr_add_range(IPAddrBlocks *addr, const unsigned afi, const unsigned *safi, unsigned char *min, unsigned char *max); unsigned v3_addr_get_afi(const IPAddressFamily *f); int v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi, unsigned char *min, unsigned char *max, const int length); /* * Canonical forms. */ int v3_asid_is_canonical(ASIdentifiers *asid); int v3_addr_is_canonical(IPAddrBlocks *addr); int v3_asid_canonize(ASIdentifiers *asid); int v3_addr_canonize(IPAddrBlocks *addr); /* * Tests for inheritance and containment. */ int v3_asid_inherits(ASIdentifiers *asid); int v3_addr_inherits(IPAddrBlocks *addr); int v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b); int v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b); /* * Check whether RFC 3779 extensions nest properly in chains. */ int v3_asid_validate_path(X509_STORE_CTX *); int v3_addr_validate_path(X509_STORE_CTX *); int v3_asid_validate_resource_set(STACK_OF(X509) *chain, ASIdentifiers *ext, int allow_inheritance); int v3_addr_validate_resource_set(STACK_OF(X509) *chain, IPAddrBlocks *ext, int allow_inheritance); # endif /* OPENSSL_NO_RFC3779 */ /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_X509V3_strings(void); /* Error codes for the X509V3 functions. */ /* Function codes. */ # define X509V3_F_A2I_GENERAL_NAME 164 # define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE 161 # define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL 162 # define X509V3_F_COPY_EMAIL 122 # define X509V3_F_COPY_ISSUER 123 # define X509V3_F_DO_DIRNAME 144 # define X509V3_F_DO_EXT_CONF 124 # define X509V3_F_DO_EXT_I2D 135 # define X509V3_F_DO_EXT_NCONF 151 # define X509V3_F_DO_I2V_NAME_CONSTRAINTS 148 # define X509V3_F_GNAMES_FROM_SECTNAME 156 # define X509V3_F_HEX_TO_STRING 111 # define X509V3_F_I2S_ASN1_ENUMERATED 121 # define X509V3_F_I2S_ASN1_IA5STRING 149 # define X509V3_F_I2S_ASN1_INTEGER 120 # define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 138 # define X509V3_F_NOTICE_SECTION 132 # define X509V3_F_NREF_NOS 133 # define X509V3_F_POLICY_SECTION 131 # define X509V3_F_PROCESS_PCI_VALUE 150 # define X509V3_F_R2I_CERTPOL 130 # define X509V3_F_R2I_PCI 155 # define X509V3_F_S2I_ASN1_IA5STRING 100 # define X509V3_F_S2I_ASN1_INTEGER 108 # define X509V3_F_S2I_ASN1_OCTET_STRING 112 # define X509V3_F_S2I_ASN1_SKEY_ID 114 # define X509V3_F_S2I_SKEY_ID 115 # define X509V3_F_SET_DIST_POINT_NAME 158 # define X509V3_F_STRING_TO_HEX 113 # define X509V3_F_SXNET_ADD_ID_ASC 125 # define X509V3_F_SXNET_ADD_ID_INTEGER 126 # define X509V3_F_SXNET_ADD_ID_ULONG 127 # define X509V3_F_SXNET_GET_ID_ASC 128 # define X509V3_F_SXNET_GET_ID_ULONG 129 # define X509V3_F_V2I_ASIDENTIFIERS 163 # define X509V3_F_V2I_ASN1_BIT_STRING 101 # define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139 # define X509V3_F_V2I_AUTHORITY_KEYID 119 # define X509V3_F_V2I_BASIC_CONSTRAINTS 102 # define X509V3_F_V2I_CRLD 134 # define X509V3_F_V2I_EXTENDED_KEY_USAGE 103 # define X509V3_F_V2I_GENERAL_NAMES 118 # define X509V3_F_V2I_GENERAL_NAME_EX 117 # define X509V3_F_V2I_IDP 157 # define X509V3_F_V2I_IPADDRBLOCKS 159 # define X509V3_F_V2I_ISSUER_ALT 153 # define X509V3_F_V2I_NAME_CONSTRAINTS 147 # define X509V3_F_V2I_POLICY_CONSTRAINTS 146 # define X509V3_F_V2I_POLICY_MAPPINGS 145 # define X509V3_F_V2I_SUBJECT_ALT 154 # define X509V3_F_V3_ADDR_VALIDATE_PATH_INTERNAL 160 # define X509V3_F_V3_GENERIC_EXTENSION 116 # define X509V3_F_X509V3_ADD1_I2D 140 # define X509V3_F_X509V3_ADD_VALUE 105 # define X509V3_F_X509V3_EXT_ADD 104 # define X509V3_F_X509V3_EXT_ADD_ALIAS 106 # define X509V3_F_X509V3_EXT_CONF 107 # define X509V3_F_X509V3_EXT_FREE 165 # define X509V3_F_X509V3_EXT_I2D 136 # define X509V3_F_X509V3_EXT_NCONF 152 # define X509V3_F_X509V3_GET_SECTION 142 # define X509V3_F_X509V3_GET_STRING 143 # define X509V3_F_X509V3_GET_VALUE_BOOL 110 # define X509V3_F_X509V3_PARSE_LIST 109 # define X509V3_F_X509_PURPOSE_ADD 137 # define X509V3_F_X509_PURPOSE_SET 141 /* Reason codes. */ # define X509V3_R_BAD_IP_ADDRESS 118 # define X509V3_R_BAD_OBJECT 119 # define X509V3_R_BN_DEC2BN_ERROR 100 # define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 101 # define X509V3_R_CANNOT_FIND_FREE_FUNCTION 168 # define X509V3_R_DIRNAME_ERROR 149 # define X509V3_R_DISTPOINT_ALREADY_SET 160 # define X509V3_R_DUPLICATE_ZONE_ID 133 # define X509V3_R_ERROR_CONVERTING_ZONE 131 # define X509V3_R_ERROR_CREATING_EXTENSION 144 # define X509V3_R_ERROR_IN_EXTENSION 128 # define X509V3_R_EXPECTED_A_SECTION_NAME 137 # define X509V3_R_EXTENSION_EXISTS 145 # define X509V3_R_EXTENSION_NAME_ERROR 115 # define X509V3_R_EXTENSION_NOT_FOUND 102 # define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 103 # define X509V3_R_EXTENSION_VALUE_ERROR 116 # define X509V3_R_ILLEGAL_EMPTY_EXTENSION 151 # define X509V3_R_ILLEGAL_HEX_DIGIT 113 # define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 152 # define X509V3_R_INVALID_ASNUMBER 162 # define X509V3_R_INVALID_ASRANGE 163 # define X509V3_R_INVALID_BOOLEAN_STRING 104 # define X509V3_R_INVALID_EXTENSION_STRING 105 # define X509V3_R_INVALID_INHERITANCE 165 # define X509V3_R_INVALID_IPADDRESS 166 # define X509V3_R_INVALID_MULTIPLE_RDNS 161 # define X509V3_R_INVALID_NAME 106 # define X509V3_R_INVALID_NULL_ARGUMENT 107 # define X509V3_R_INVALID_NULL_NAME 108 # define X509V3_R_INVALID_NULL_VALUE 109 # define X509V3_R_INVALID_NUMBER 140 # define X509V3_R_INVALID_NUMBERS 141 # define X509V3_R_INVALID_OBJECT_IDENTIFIER 110 # define X509V3_R_INVALID_OPTION 138 # define X509V3_R_INVALID_POLICY_IDENTIFIER 134 # define X509V3_R_INVALID_PROXY_POLICY_SETTING 153 # define X509V3_R_INVALID_PURPOSE 146 # define X509V3_R_INVALID_SAFI 164 # define X509V3_R_INVALID_SECTION 135 # define X509V3_R_INVALID_SYNTAX 143 # define X509V3_R_ISSUER_DECODE_ERROR 126 # define X509V3_R_MISSING_VALUE 124 # define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS 142 # define X509V3_R_NO_CONFIG_DATABASE 136 # define X509V3_R_NO_ISSUER_CERTIFICATE 121 # define X509V3_R_NO_ISSUER_DETAILS 127 # define X509V3_R_NO_POLICY_IDENTIFIER 139 # define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED 154 # define X509V3_R_NO_PUBLIC_KEY 114 # define X509V3_R_NO_SUBJECT_DETAILS 125 # define X509V3_R_ODD_NUMBER_OF_DIGITS 112 # define X509V3_R_OPERATION_NOT_DEFINED 148 # define X509V3_R_OTHERNAME_ERROR 147 # define X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED 155 # define X509V3_R_POLICY_PATH_LENGTH 156 # define X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED 157 # define X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED 158 # define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159 # define X509V3_R_SECTION_NOT_FOUND 150 # define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 122 # define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 123 # define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 111 # define X509V3_R_UNKNOWN_EXTENSION 129 # define X509V3_R_UNKNOWN_EXTENSION_NAME 130 # define X509V3_R_UNKNOWN_OPTION 120 # define X509V3_R_UNSUPPORTED_OPTION 117 # define X509V3_R_UNSUPPORTED_TYPE 167 # define X509V3_R_USER_TOO_LONG 132 #ifdef __cplusplus } #endif #endif ���������������������������������������������������������openssl/des.h���������������������������������������������������������������������������������������0000644�����������������00000026762�14763166030�0007176 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/des/des.h */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_NEW_DES_H # define HEADER_NEW_DES_H # include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG * (via openssl/opensslconf.h */ # ifdef OPENSSL_NO_DES # error DES is disabled. # endif # ifdef OPENSSL_BUILD_SHLIBCRYPTO # undef OPENSSL_EXTERN # define OPENSSL_EXTERN OPENSSL_EXPORT # endif #ifdef __cplusplus extern "C" { #endif typedef unsigned char DES_cblock[8]; typedef /* const */ unsigned char const_DES_cblock[8]; /* * With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * and * const_DES_cblock * are incompatible pointer types. */ typedef struct DES_ks { union { DES_cblock cblock; /* * make sure things are correct size on machines with 8 byte longs */ DES_LONG deslong[2]; } ks[16]; } DES_key_schedule; # ifndef OPENSSL_DISABLE_OLD_DES_SUPPORT # ifndef OPENSSL_ENABLE_OLD_DES_SUPPORT # define OPENSSL_ENABLE_OLD_DES_SUPPORT # endif # endif # ifdef OPENSSL_ENABLE_OLD_DES_SUPPORT # include <openssl/des_old.h> # endif # define DES_KEY_SZ (sizeof(DES_cblock)) # define DES_SCHEDULE_SZ (sizeof(DES_key_schedule)) # define DES_ENCRYPT 1 # define DES_DECRYPT 0 # define DES_CBC_MODE 0 # define DES_PCBC_MODE 1 # define DES_ecb2_encrypt(i,o,k1,k2,e) \ DES_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) # define DES_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ DES_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) # define DES_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ DES_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) # define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) OPENSSL_DECLARE_GLOBAL(int, DES_check_key); /* defaults to false */ # define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key) OPENSSL_DECLARE_GLOBAL(int, DES_rw_mode); /* defaults to DES_PCBC_MODE */ # define DES_rw_mode OPENSSL_GLOBAL_REF(DES_rw_mode) const char *DES_options(void); void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, int enc); DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output, long length, DES_key_schedule *schedule, const_DES_cblock *ivec); /* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */ void DES_cbc_encrypt(const unsigned char *input, unsigned char *output, long length, DES_key_schedule *schedule, DES_cblock *ivec, int enc); void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output, long length, DES_key_schedule *schedule, DES_cblock *ivec, int enc); void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output, long length, DES_key_schedule *schedule, DES_cblock *ivec, const_DES_cblock *inw, const_DES_cblock *outw, int enc); void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, long length, DES_key_schedule *schedule, DES_cblock *ivec, int enc); void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, DES_key_schedule *ks, int enc); /* * This is the DES encryption function that gets called by just about every * other DES routine in the library. You should not use this function except * to implement 'modes' of DES. I say this because the functions that call * this routine do the conversion from 'char *' to long, and this needs to be * done to make sure 'non-aligned' memory access do not occur. The * characters are loaded 'little endian'. Data is a pointer to 2 unsigned * long's and ks is the DES_key_schedule to use. enc, is non zero specifies * encryption, zero if decryption. */ void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc); /* * This functions is the same as DES_encrypt1() except that the DES initial * permutation (IP) and final permutation (FP) have been left out. As for * DES_encrypt1(), you should not use this function. It is used by the * routines in the library that implement triple DES. IP() DES_encrypt2() * DES_encrypt2() DES_encrypt2() FP() is the same as DES_encrypt1() * DES_encrypt1() DES_encrypt1() except faster :-). */ void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc); void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3); void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3); void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, long length, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, DES_cblock *ivec, int enc); void DES_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out, long length, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, DES_cblock *ivec1, DES_cblock *ivec2, int enc); void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, DES_cblock *ivec, int *num, int enc); void DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, long length, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, DES_cblock *ivec, int enc); void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, DES_cblock *ivec, int *num); # if 0 void DES_xwhite_in2out(const_DES_cblock *DES_key, const_DES_cblock *in_white, DES_cblock *out_white); # endif int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, DES_cblock *iv); int DES_enc_write(int fd, const void *buf, int len, DES_key_schedule *sched, DES_cblock *iv); char *DES_fcrypt(const char *buf, const char *salt, char *ret); char *DES_crypt(const char *buf, const char *salt); void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits, long length, DES_key_schedule *schedule, DES_cblock *ivec); void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output, long length, DES_key_schedule *schedule, DES_cblock *ivec, int enc); DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], long length, int out_count, DES_cblock *seed); int DES_random_key(DES_cblock *ret); void DES_set_odd_parity(DES_cblock *key); int DES_check_key_parity(const_DES_cblock *key); int DES_is_weak_key(const_DES_cblock *key); /* * DES_set_key (= set_key = DES_key_sched = key_sched) calls * DES_set_key_checked if global variable DES_check_key is set, * DES_set_key_unchecked otherwise. */ int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule); int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule); int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule); void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule); void DES_string_to_key(const char *str, DES_cblock *key); void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2); void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, DES_key_schedule *schedule, DES_cblock *ivec, int *num, int enc); void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, DES_key_schedule *schedule, DES_cblock *ivec, int *num); int DES_read_password(DES_cblock *key, const char *prompt, int verify); int DES_read_2passwords(DES_cblock *key1, DES_cblock *key2, const char *prompt, int verify); # define DES_fixup_key_parity DES_set_odd_parity #ifdef __cplusplus } #endif #endif ��������������openssl/pqueue.h������������������������������������������������������������������������������������0000644�����������������00000007131�14763166030�0007714 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/pqueue/pqueue.h */ /* * DTLS implementation written by Nagendra Modadugu * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. */ /* ==================================================================== * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_PQUEUE_H # define HEADER_PQUEUE_H # include <stdio.h> # include <stdlib.h> # include <string.h> #ifdef __cplusplus extern "C" { #endif typedef struct _pqueue *pqueue; typedef struct _pitem { unsigned char priority[8]; /* 64-bit value in big-endian encoding */ void *data; struct _pitem *next; } pitem; typedef struct _pitem *piterator; pitem *pitem_new(unsigned char *prio64be, void *data); void pitem_free(pitem *item); pqueue pqueue_new(void); void pqueue_free(pqueue pq); pitem *pqueue_insert(pqueue pq, pitem *item); pitem *pqueue_peek(pqueue pq); pitem *pqueue_pop(pqueue pq); pitem *pqueue_find(pqueue pq, unsigned char *prio64be); pitem *pqueue_iterator(pqueue pq); pitem *pqueue_next(piterator *iter); void pqueue_print(pqueue pq); int pqueue_size(pqueue pq); #ifdef __cplusplus } #endif #endif /* ! HEADER_PQUEUE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/asn1_mac.h����������������������������������������������������������������������������������0000644�����������������00000057563�14763166030�0010110 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/asn1/asn1_mac.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_ASN1_MAC_H # define HEADER_ASN1_MAC_H # include <openssl/asn1.h> #ifdef __cplusplus extern "C" { #endif # ifndef ASN1_MAC_ERR_LIB # define ASN1_MAC_ERR_LIB ERR_LIB_ASN1 # endif # define ASN1_MAC_H_err(f,r,line) \ ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line)) # define M_ASN1_D2I_vars(a,type,func) \ ASN1_const_CTX c; \ type ret=NULL; \ \ c.pp=(const unsigned char **)pp; \ c.q= *(const unsigned char **)pp; \ c.error=ERR_R_NESTED_ASN1_ERROR; \ if ((a == NULL) || ((*a) == NULL)) \ { if ((ret=(type)func()) == NULL) \ { c.line=__LINE__; goto err; } } \ else ret=(*a); # define M_ASN1_D2I_Init() \ c.p= *(const unsigned char **)pp; \ c.max=(length == 0)?0:(c.p+length); # define M_ASN1_D2I_Finish_2(a) \ if (!asn1_const_Finish(&c)) \ { c.line=__LINE__; goto err; } \ *(const unsigned char **)pp=c.p; \ if (a != NULL) (*a)=ret; \ return(ret); # define M_ASN1_D2I_Finish(a,func,e) \ M_ASN1_D2I_Finish_2(a); \ err:\ ASN1_MAC_H_err((e),c.error,c.line); \ asn1_add_error(*(const unsigned char **)pp,(int)(c.q- *pp)); \ if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \ return(NULL) # define M_ASN1_D2I_start_sequence() \ if (!asn1_GetSequence(&c,&length)) \ { c.line=__LINE__; goto err; } /* Begin reading ASN1 without a surrounding sequence */ # define M_ASN1_D2I_begin() \ c.slen = length; /* End reading ASN1 with no check on length */ # define M_ASN1_D2I_Finish_nolen(a, func, e) \ *pp=c.p; \ if (a != NULL) (*a)=ret; \ return(ret); \ err:\ ASN1_MAC_H_err((e),c.error,c.line); \ asn1_add_error(*pp,(int)(c.q- *pp)); \ if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \ return(NULL) # define M_ASN1_D2I_end_sequence() \ (((c.inf&1) == 0)?(c.slen <= 0): \ (c.eos=ASN1_const_check_infinite_end(&c.p,c.slen))) /* Don't use this with d2i_ASN1_BOOLEAN() */ # define M_ASN1_D2I_get(b, func) \ c.q=c.p; \ if (func(&(b),&c.p,c.slen) == NULL) \ {c.line=__LINE__; goto err; } \ c.slen-=(c.p-c.q); /* Don't use this with d2i_ASN1_BOOLEAN() */ # define M_ASN1_D2I_get_x(type,b,func) \ c.q=c.p; \ if (((D2I_OF(type))func)(&(b),&c.p,c.slen) == NULL) \ {c.line=__LINE__; goto err; } \ c.slen-=(c.p-c.q); /* use this instead () */ # define M_ASN1_D2I_get_int(b,func) \ c.q=c.p; \ if (func(&(b),&c.p,c.slen) < 0) \ {c.line=__LINE__; goto err; } \ c.slen-=(c.p-c.q); # define M_ASN1_D2I_get_opt(b,func,type) \ if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \ == (V_ASN1_UNIVERSAL|(type)))) \ { \ M_ASN1_D2I_get(b,func); \ } # define M_ASN1_D2I_get_int_opt(b,func,type) \ if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \ == (V_ASN1_UNIVERSAL|(type)))) \ { \ M_ASN1_D2I_get_int(b,func); \ } # define M_ASN1_D2I_get_imp(b,func, type) \ M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \ c.q=c.p; \ if (func(&(b),&c.p,c.slen) == NULL) \ {c.line=__LINE__; M_ASN1_next_prev = _tmp; goto err; } \ c.slen-=(c.p-c.q);\ M_ASN1_next_prev=_tmp; # define M_ASN1_D2I_get_IMP_opt(b,func,tag,type) \ if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) == \ (V_ASN1_CONTEXT_SPECIFIC|(tag)))) \ { \ unsigned char _tmp = M_ASN1_next; \ M_ASN1_D2I_get_imp(b,func, type);\ } # define M_ASN1_D2I_get_set(r,func,free_func) \ M_ASN1_D2I_get_imp_set(r,func,free_func, \ V_ASN1_SET,V_ASN1_UNIVERSAL); # define M_ASN1_D2I_get_set_type(type,r,func,free_func) \ M_ASN1_D2I_get_imp_set_type(type,r,func,free_func, \ V_ASN1_SET,V_ASN1_UNIVERSAL); # define M_ASN1_D2I_get_set_opt(r,func,free_func) \ if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \ V_ASN1_CONSTRUCTED|V_ASN1_SET)))\ { M_ASN1_D2I_get_set(r,func,free_func); } # define M_ASN1_D2I_get_set_opt_type(type,r,func,free_func) \ if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \ V_ASN1_CONSTRUCTED|V_ASN1_SET)))\ { M_ASN1_D2I_get_set_type(type,r,func,free_func); } # define M_ASN1_I2D_len_SET_opt(a,f) \ if ((a != NULL) && (sk_num(a) != 0)) \ M_ASN1_I2D_len_SET(a,f); # define M_ASN1_I2D_put_SET_opt(a,f) \ if ((a != NULL) && (sk_num(a) != 0)) \ M_ASN1_I2D_put_SET(a,f); # define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \ if ((a != NULL) && (sk_num(a) != 0)) \ M_ASN1_I2D_put_SEQUENCE(a,f); # define M_ASN1_I2D_put_SEQUENCE_opt_type(type,a,f) \ if ((a != NULL) && (sk_##type##_num(a) != 0)) \ M_ASN1_I2D_put_SEQUENCE_type(type,a,f); # define M_ASN1_D2I_get_IMP_set_opt(b,func,free_func,tag) \ if ((c.slen != 0) && \ (M_ASN1_next == \ (V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\ { \ M_ASN1_D2I_get_imp_set(b,func,free_func,\ tag,V_ASN1_CONTEXT_SPECIFIC); \ } # define M_ASN1_D2I_get_IMP_set_opt_type(type,b,func,free_func,tag) \ if ((c.slen != 0) && \ (M_ASN1_next == \ (V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\ { \ M_ASN1_D2I_get_imp_set_type(type,b,func,free_func,\ tag,V_ASN1_CONTEXT_SPECIFIC); \ } # define M_ASN1_D2I_get_seq(r,func,free_func) \ M_ASN1_D2I_get_imp_set(r,func,free_func,\ V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); # define M_ASN1_D2I_get_seq_type(type,r,func,free_func) \ M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\ V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL) # define M_ASN1_D2I_get_seq_opt(r,func,free_func) \ if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \ V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\ { M_ASN1_D2I_get_seq(r,func,free_func); } # define M_ASN1_D2I_get_seq_opt_type(type,r,func,free_func) \ if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \ V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\ { M_ASN1_D2I_get_seq_type(type,r,func,free_func); } # define M_ASN1_D2I_get_IMP_set(r,func,free_func,x) \ M_ASN1_D2I_get_imp_set(r,func,free_func,\ x,V_ASN1_CONTEXT_SPECIFIC); # define M_ASN1_D2I_get_IMP_set_type(type,r,func,free_func,x) \ M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\ x,V_ASN1_CONTEXT_SPECIFIC); # define M_ASN1_D2I_get_imp_set(r,func,free_func,a,b) \ c.q=c.p; \ if (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,\ (void (*)())free_func,a,b) == NULL) \ { c.line=__LINE__; goto err; } \ c.slen-=(c.p-c.q); # define M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,a,b) \ c.q=c.p; \ if (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,\ free_func,a,b) == NULL) \ { c.line=__LINE__; goto err; } \ c.slen-=(c.p-c.q); # define M_ASN1_D2I_get_set_strings(r,func,a,b) \ c.q=c.p; \ if (d2i_ASN1_STRING_SET(&(r),&c.p,c.slen,a,b) == NULL) \ { c.line=__LINE__; goto err; } \ c.slen-=(c.p-c.q); # define M_ASN1_D2I_get_EXP_opt(r,func,tag) \ if ((c.slen != 0L) && (M_ASN1_next == \ (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \ { \ int Tinf,Ttag,Tclass; \ long Tlen; \ \ c.q=c.p; \ Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ if (Tinf & 0x80) \ { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \ c.line=__LINE__; goto err; } \ if (Tinf == (V_ASN1_CONSTRUCTED+1)) \ Tlen = c.slen - (c.p - c.q) - 2; \ if (func(&(r),&c.p,Tlen) == NULL) \ { c.line=__LINE__; goto err; } \ if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \ Tlen = c.slen - (c.p - c.q); \ if(!ASN1_const_check_infinite_end(&c.p, Tlen)) \ { c.error=ERR_R_MISSING_ASN1_EOS; \ c.line=__LINE__; goto err; } \ }\ c.slen-=(c.p-c.q); \ } # define M_ASN1_D2I_get_EXP_set_opt(r,func,free_func,tag,b) \ if ((c.slen != 0) && (M_ASN1_next == \ (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \ { \ int Tinf,Ttag,Tclass; \ long Tlen; \ \ c.q=c.p; \ Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ if (Tinf & 0x80) \ { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \ c.line=__LINE__; goto err; } \ if (Tinf == (V_ASN1_CONSTRUCTED+1)) \ Tlen = c.slen - (c.p - c.q) - 2; \ if (d2i_ASN1_SET(&(r),&c.p,Tlen,(char *(*)())func, \ (void (*)())free_func, \ b,V_ASN1_UNIVERSAL) == NULL) \ { c.line=__LINE__; goto err; } \ if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \ Tlen = c.slen - (c.p - c.q); \ if(!ASN1_check_infinite_end(&c.p, Tlen)) \ { c.error=ERR_R_MISSING_ASN1_EOS; \ c.line=__LINE__; goto err; } \ }\ c.slen-=(c.p-c.q); \ } # define M_ASN1_D2I_get_EXP_set_opt_type(type,r,func,free_func,tag,b) \ if ((c.slen != 0) && (M_ASN1_next == \ (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \ { \ int Tinf,Ttag,Tclass; \ long Tlen; \ \ c.q=c.p; \ Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ if (Tinf & 0x80) \ { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \ c.line=__LINE__; goto err; } \ if (Tinf == (V_ASN1_CONSTRUCTED+1)) \ Tlen = c.slen - (c.p - c.q) - 2; \ if (d2i_ASN1_SET_OF_##type(&(r),&c.p,Tlen,func, \ free_func,b,V_ASN1_UNIVERSAL) == NULL) \ { c.line=__LINE__; goto err; } \ if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \ Tlen = c.slen - (c.p - c.q); \ if(!ASN1_check_infinite_end(&c.p, Tlen)) \ { c.error=ERR_R_MISSING_ASN1_EOS; \ c.line=__LINE__; goto err; } \ }\ c.slen-=(c.p-c.q); \ } /* New macros */ # define M_ASN1_New_Malloc(ret,type) \ if ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \ { c.line=__LINE__; goto err2; } # define M_ASN1_New(arg,func) \ if (((arg)=func()) == NULL) return(NULL) # define M_ASN1_New_Error(a) \ /*- err: ASN1_MAC_H_err((a),ERR_R_NESTED_ASN1_ERROR,c.line); \ return(NULL);*/ \ err2: ASN1_MAC_H_err((a),ERR_R_MALLOC_FAILURE,c.line); \ return(NULL) /* * BIG UGLY WARNING! This is so damn ugly I wanna puke. Unfortunately, some * macros that use ASN1_const_CTX still insist on writing in the input * stream. ARGH! ARGH! ARGH! Let's get rid of this macro package. Please? -- * Richard Levitte */ # define M_ASN1_next (*((unsigned char *)(c.p))) # define M_ASN1_next_prev (*((unsigned char *)(c.q))) /*************************************************/ # define M_ASN1_I2D_vars(a) int r=0,ret=0; \ unsigned char *p; \ if (a == NULL) return(0) /* Length Macros */ # define M_ASN1_I2D_len(a,f) ret+=f(a,NULL) # define M_ASN1_I2D_len_IMP_opt(a,f) if (a != NULL) M_ASN1_I2D_len(a,f) # define M_ASN1_I2D_len_SET(a,f) \ ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET); # define M_ASN1_I2D_len_SET_type(type,a,f) \ ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SET, \ V_ASN1_UNIVERSAL,IS_SET); # define M_ASN1_I2D_len_SEQUENCE(a,f) \ ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \ IS_SEQUENCE); # define M_ASN1_I2D_len_SEQUENCE_type(type,a,f) \ ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SEQUENCE, \ V_ASN1_UNIVERSAL,IS_SEQUENCE) # define M_ASN1_I2D_len_SEQUENCE_opt(a,f) \ if ((a != NULL) && (sk_num(a) != 0)) \ M_ASN1_I2D_len_SEQUENCE(a,f); # define M_ASN1_I2D_len_SEQUENCE_opt_type(type,a,f) \ if ((a != NULL) && (sk_##type##_num(a) != 0)) \ M_ASN1_I2D_len_SEQUENCE_type(type,a,f); # define M_ASN1_I2D_len_IMP_SET(a,f,x) \ ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET); # define M_ASN1_I2D_len_IMP_SET_type(type,a,f,x) \ ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \ V_ASN1_CONTEXT_SPECIFIC,IS_SET); # define M_ASN1_I2D_len_IMP_SET_opt(a,f,x) \ if ((a != NULL) && (sk_num(a) != 0)) \ ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \ IS_SET); # define M_ASN1_I2D_len_IMP_SET_opt_type(type,a,f,x) \ if ((a != NULL) && (sk_##type##_num(a) != 0)) \ ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \ V_ASN1_CONTEXT_SPECIFIC,IS_SET); # define M_ASN1_I2D_len_IMP_SEQUENCE(a,f,x) \ ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \ IS_SEQUENCE); # define M_ASN1_I2D_len_IMP_SEQUENCE_opt(a,f,x) \ if ((a != NULL) && (sk_num(a) != 0)) \ ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \ IS_SEQUENCE); # define M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(type,a,f,x) \ if ((a != NULL) && (sk_##type##_num(a) != 0)) \ ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \ V_ASN1_CONTEXT_SPECIFIC, \ IS_SEQUENCE); # define M_ASN1_I2D_len_EXP_opt(a,f,mtag,v) \ if (a != NULL)\ { \ v=f(a,NULL); \ ret+=ASN1_object_size(1,v,mtag); \ } # define M_ASN1_I2D_len_EXP_SET_opt(a,f,mtag,tag,v) \ if ((a != NULL) && (sk_num(a) != 0))\ { \ v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL,IS_SET); \ ret+=ASN1_object_size(1,v,mtag); \ } # define M_ASN1_I2D_len_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \ if ((a != NULL) && (sk_num(a) != 0))\ { \ v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL, \ IS_SEQUENCE); \ ret+=ASN1_object_size(1,v,mtag); \ } # define M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \ if ((a != NULL) && (sk_##type##_num(a) != 0))\ { \ v=i2d_ASN1_SET_OF_##type(a,NULL,f,tag, \ V_ASN1_UNIVERSAL, \ IS_SEQUENCE); \ ret+=ASN1_object_size(1,v,mtag); \ } /* Put Macros */ # define M_ASN1_I2D_put(a,f) f(a,&p) # define M_ASN1_I2D_put_IMP_opt(a,f,t) \ if (a != NULL) \ { \ unsigned char *q=p; \ f(a,&p); \ *q=(V_ASN1_CONTEXT_SPECIFIC|t|(*q&V_ASN1_CONSTRUCTED));\ } # define M_ASN1_I2D_put_SET(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SET,\ V_ASN1_UNIVERSAL,IS_SET) # define M_ASN1_I2D_put_SET_type(type,a,f) \ i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET) # define M_ASN1_I2D_put_IMP_SET(a,f,x) i2d_ASN1_SET(a,&p,f,x,\ V_ASN1_CONTEXT_SPECIFIC,IS_SET) # define M_ASN1_I2D_put_IMP_SET_type(type,a,f,x) \ i2d_ASN1_SET_OF_##type(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET) # define M_ASN1_I2D_put_IMP_SEQUENCE(a,f,x) i2d_ASN1_SET(a,&p,f,x,\ V_ASN1_CONTEXT_SPECIFIC,IS_SEQUENCE) # define M_ASN1_I2D_put_SEQUENCE(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SEQUENCE,\ V_ASN1_UNIVERSAL,IS_SEQUENCE) # define M_ASN1_I2D_put_SEQUENCE_type(type,a,f) \ i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \ IS_SEQUENCE) # define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \ if ((a != NULL) && (sk_num(a) != 0)) \ M_ASN1_I2D_put_SEQUENCE(a,f); # define M_ASN1_I2D_put_IMP_SET_opt(a,f,x) \ if ((a != NULL) && (sk_num(a) != 0)) \ { i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \ IS_SET); } # define M_ASN1_I2D_put_IMP_SET_opt_type(type,a,f,x) \ if ((a != NULL) && (sk_##type##_num(a) != 0)) \ { i2d_ASN1_SET_OF_##type(a,&p,f,x, \ V_ASN1_CONTEXT_SPECIFIC, \ IS_SET); } # define M_ASN1_I2D_put_IMP_SEQUENCE_opt(a,f,x) \ if ((a != NULL) && (sk_num(a) != 0)) \ { i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \ IS_SEQUENCE); } # define M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(type,a,f,x) \ if ((a != NULL) && (sk_##type##_num(a) != 0)) \ { i2d_ASN1_SET_OF_##type(a,&p,f,x, \ V_ASN1_CONTEXT_SPECIFIC, \ IS_SEQUENCE); } # define M_ASN1_I2D_put_EXP_opt(a,f,tag,v) \ if (a != NULL) \ { \ ASN1_put_object(&p,1,v,tag,V_ASN1_CONTEXT_SPECIFIC); \ f(a,&p); \ } # define M_ASN1_I2D_put_EXP_SET_opt(a,f,mtag,tag,v) \ if ((a != NULL) && (sk_num(a) != 0)) \ { \ ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \ i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SET); \ } # define M_ASN1_I2D_put_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \ if ((a != NULL) && (sk_num(a) != 0)) \ { \ ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \ i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SEQUENCE); \ } # define M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \ if ((a != NULL) && (sk_##type##_num(a) != 0)) \ { \ ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \ i2d_ASN1_SET_OF_##type(a,&p,f,tag,V_ASN1_UNIVERSAL, \ IS_SEQUENCE); \ } # define M_ASN1_I2D_seq_total() \ r=ASN1_object_size(1,ret,V_ASN1_SEQUENCE); \ if (pp == NULL) return(r); \ p= *pp; \ ASN1_put_object(&p,1,ret,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL) # define M_ASN1_I2D_INF_seq_start(tag,ctx) \ *(p++)=(V_ASN1_CONSTRUCTED|(tag)|(ctx)); \ *(p++)=0x80 # define M_ASN1_I2D_INF_seq_end() *(p++)=0x00; *(p++)=0x00 # define M_ASN1_I2D_finish() *pp=p; \ return(r); int asn1_GetSequence(ASN1_const_CTX *c, long *length); void asn1_add_error(const unsigned char *address, int offset); #ifdef __cplusplus } #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������openssl/des_old.h�����������������������������������������������������������������������������������0000644�����������������00000051756�14763166030�0010035 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/des/des_old.h */ /*- * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING * * The function names in here are deprecated and are only present to * provide an interface compatible with openssl 0.9.6 and older as * well as libdes. OpenSSL now provides functions where "des_" has * been replaced with "DES_" in the names, to make it possible to * make incompatible changes that are needed for C type security and * other stuff. * * This include files has two compatibility modes: * * - If OPENSSL_DES_LIBDES_COMPATIBILITY is defined, you get an API * that is compatible with libdes and SSLeay. * - If OPENSSL_DES_LIBDES_COMPATIBILITY isn't defined, you get an * API that is compatible with OpenSSL 0.9.5x to 0.9.6x. * * Note that these modes break earlier snapshots of OpenSSL, where * libdes compatibility was the only available mode or (later on) the * prefered compatibility mode. However, after much consideration * (and more or less violent discussions with external parties), it * was concluded that OpenSSL should be compatible with earlier versions * of itself before anything else. Also, in all honesty, libdes is * an old beast that shouldn't really be used any more. * * Please consider starting to use the DES_ functions rather than the * des_ ones. The des_ functions will disappear completely before * OpenSSL 1.0! * * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2001. */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_DES_H # define HEADER_DES_H # include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */ # ifdef OPENSSL_NO_DES # error DES is disabled. # endif # ifndef HEADER_NEW_DES_H # error You must include des.h, not des_old.h directly. # endif # ifdef _KERBEROS_DES_H # error <openssl/des_old.h> replaces <kerberos/des.h>. # endif # include <openssl/symhacks.h> # ifdef OPENSSL_BUILD_SHLIBCRYPTO # undef OPENSSL_EXTERN # define OPENSSL_EXTERN OPENSSL_EXPORT # endif #ifdef __cplusplus extern "C" { #endif # ifdef _ # undef _ # endif typedef unsigned char _ossl_old_des_cblock[8]; typedef struct _ossl_old_des_ks_struct { union { _ossl_old_des_cblock _; /* * make sure things are correct size on machines with 8 byte longs */ DES_LONG pad[2]; } ks; } _ossl_old_des_key_schedule[16]; # ifndef OPENSSL_DES_LIBDES_COMPATIBILITY # define des_cblock DES_cblock # define const_des_cblock const_DES_cblock # define des_key_schedule DES_key_schedule # define des_ecb3_encrypt(i,o,k1,k2,k3,e)\ DES_ecb3_encrypt((i),(o),&(k1),&(k2),&(k3),(e)) # define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\ DES_ede3_cbc_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(e)) # define des_ede3_cbcm_encrypt(i,o,l,k1,k2,k3,iv1,iv2,e)\ DES_ede3_cbcm_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv1),(iv2),(e)) # define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\ DES_ede3_cfb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n),(e)) # define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\ DES_ede3_ofb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n)) # define des_options()\ DES_options() # define des_cbc_cksum(i,o,l,k,iv)\ DES_cbc_cksum((i),(o),(l),&(k),(iv)) # define des_cbc_encrypt(i,o,l,k,iv,e)\ DES_cbc_encrypt((i),(o),(l),&(k),(iv),(e)) # define des_ncbc_encrypt(i,o,l,k,iv,e)\ DES_ncbc_encrypt((i),(o),(l),&(k),(iv),(e)) # define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\ DES_xcbc_encrypt((i),(o),(l),&(k),(iv),(inw),(outw),(e)) # define des_cfb_encrypt(i,o,n,l,k,iv,e)\ DES_cfb_encrypt((i),(o),(n),(l),&(k),(iv),(e)) # define des_ecb_encrypt(i,o,k,e)\ DES_ecb_encrypt((i),(o),&(k),(e)) # define des_encrypt1(d,k,e)\ DES_encrypt1((d),&(k),(e)) # define des_encrypt2(d,k,e)\ DES_encrypt2((d),&(k),(e)) # define des_encrypt3(d,k1,k2,k3)\ DES_encrypt3((d),&(k1),&(k2),&(k3)) # define des_decrypt3(d,k1,k2,k3)\ DES_decrypt3((d),&(k1),&(k2),&(k3)) # define des_xwhite_in2out(k,i,o)\ DES_xwhite_in2out((k),(i),(o)) # define des_enc_read(f,b,l,k,iv)\ DES_enc_read((f),(b),(l),&(k),(iv)) # define des_enc_write(f,b,l,k,iv)\ DES_enc_write((f),(b),(l),&(k),(iv)) # define des_fcrypt(b,s,r)\ DES_fcrypt((b),(s),(r)) # if 0 # define des_crypt(b,s)\ DES_crypt((b),(s)) # if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__) # define crypt(b,s)\ DES_crypt((b),(s)) # endif # endif # define des_ofb_encrypt(i,o,n,l,k,iv)\ DES_ofb_encrypt((i),(o),(n),(l),&(k),(iv)) # define des_pcbc_encrypt(i,o,l,k,iv,e)\ DES_pcbc_encrypt((i),(o),(l),&(k),(iv),(e)) # define des_quad_cksum(i,o,l,c,s)\ DES_quad_cksum((i),(o),(l),(c),(s)) # define des_random_seed(k)\ _ossl_096_des_random_seed((k)) # define des_random_key(r)\ DES_random_key((r)) # define des_read_password(k,p,v) \ DES_read_password((k),(p),(v)) # define des_read_2passwords(k1,k2,p,v) \ DES_read_2passwords((k1),(k2),(p),(v)) # define des_set_odd_parity(k)\ DES_set_odd_parity((k)) # define des_check_key_parity(k)\ DES_check_key_parity((k)) # define des_is_weak_key(k)\ DES_is_weak_key((k)) # define des_set_key(k,ks)\ DES_set_key((k),&(ks)) # define des_key_sched(k,ks)\ DES_key_sched((k),&(ks)) # define des_set_key_checked(k,ks)\ DES_set_key_checked((k),&(ks)) # define des_set_key_unchecked(k,ks)\ DES_set_key_unchecked((k),&(ks)) # define des_string_to_key(s,k)\ DES_string_to_key((s),(k)) # define des_string_to_2keys(s,k1,k2)\ DES_string_to_2keys((s),(k1),(k2)) # define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\ DES_cfb64_encrypt((i),(o),(l),&(ks),(iv),(n),(e)) # define des_ofb64_encrypt(i,o,l,ks,iv,n)\ DES_ofb64_encrypt((i),(o),(l),&(ks),(iv),(n)) # define des_ecb2_encrypt(i,o,k1,k2,e) \ des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) # define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) # define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) # define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) # define des_check_key DES_check_key # define des_rw_mode DES_rw_mode # else /* libdes compatibility */ /* * Map all symbol names to _ossl_old_des_* form, so we avoid all clashes with * libdes */ # define des_cblock _ossl_old_des_cblock # define des_key_schedule _ossl_old_des_key_schedule # define des_ecb3_encrypt(i,o,k1,k2,k3,e)\ _ossl_old_des_ecb3_encrypt((i),(o),(k1),(k2),(k3),(e)) # define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\ _ossl_old_des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(e)) # define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\ _ossl_old_des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n),(e)) # define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\ _ossl_old_des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n)) # define des_options()\ _ossl_old_des_options() # define des_cbc_cksum(i,o,l,k,iv)\ _ossl_old_des_cbc_cksum((i),(o),(l),(k),(iv)) # define des_cbc_encrypt(i,o,l,k,iv,e)\ _ossl_old_des_cbc_encrypt((i),(o),(l),(k),(iv),(e)) # define des_ncbc_encrypt(i,o,l,k,iv,e)\ _ossl_old_des_ncbc_encrypt((i),(o),(l),(k),(iv),(e)) # define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\ _ossl_old_des_xcbc_encrypt((i),(o),(l),(k),(iv),(inw),(outw),(e)) # define des_cfb_encrypt(i,o,n,l,k,iv,e)\ _ossl_old_des_cfb_encrypt((i),(o),(n),(l),(k),(iv),(e)) # define des_ecb_encrypt(i,o,k,e)\ _ossl_old_des_ecb_encrypt((i),(o),(k),(e)) # define des_encrypt(d,k,e)\ _ossl_old_des_encrypt((d),(k),(e)) # define des_encrypt2(d,k,e)\ _ossl_old_des_encrypt2((d),(k),(e)) # define des_encrypt3(d,k1,k2,k3)\ _ossl_old_des_encrypt3((d),(k1),(k2),(k3)) # define des_decrypt3(d,k1,k2,k3)\ _ossl_old_des_decrypt3((d),(k1),(k2),(k3)) # define des_xwhite_in2out(k,i,o)\ _ossl_old_des_xwhite_in2out((k),(i),(o)) # define des_enc_read(f,b,l,k,iv)\ _ossl_old_des_enc_read((f),(b),(l),(k),(iv)) # define des_enc_write(f,b,l,k,iv)\ _ossl_old_des_enc_write((f),(b),(l),(k),(iv)) # define des_fcrypt(b,s,r)\ _ossl_old_des_fcrypt((b),(s),(r)) # define des_crypt(b,s)\ _ossl_old_des_crypt((b),(s)) # if 0 # define crypt(b,s)\ _ossl_old_crypt((b),(s)) # endif # define des_ofb_encrypt(i,o,n,l,k,iv)\ _ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv)) # define des_pcbc_encrypt(i,o,l,k,iv,e)\ _ossl_old_des_pcbc_encrypt((i),(o),(l),(k),(iv),(e)) # define des_quad_cksum(i,o,l,c,s)\ _ossl_old_des_quad_cksum((i),(o),(l),(c),(s)) # define des_random_seed(k)\ _ossl_old_des_random_seed((k)) # define des_random_key(r)\ _ossl_old_des_random_key((r)) # define des_read_password(k,p,v) \ _ossl_old_des_read_password((k),(p),(v)) # define des_read_2passwords(k1,k2,p,v) \ _ossl_old_des_read_2passwords((k1),(k2),(p),(v)) # define des_set_odd_parity(k)\ _ossl_old_des_set_odd_parity((k)) # define des_is_weak_key(k)\ _ossl_old_des_is_weak_key((k)) # define des_set_key(k,ks)\ _ossl_old_des_set_key((k),(ks)) # define des_key_sched(k,ks)\ _ossl_old_des_key_sched((k),(ks)) # define des_string_to_key(s,k)\ _ossl_old_des_string_to_key((s),(k)) # define des_string_to_2keys(s,k1,k2)\ _ossl_old_des_string_to_2keys((s),(k1),(k2)) # define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\ _ossl_old_des_cfb64_encrypt((i),(o),(l),(ks),(iv),(n),(e)) # define des_ofb64_encrypt(i,o,l,ks,iv,n)\ _ossl_old_des_ofb64_encrypt((i),(o),(l),(ks),(iv),(n)) # define des_ecb2_encrypt(i,o,k1,k2,e) \ des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) # define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) # define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) # define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) # define des_check_key DES_check_key # define des_rw_mode DES_rw_mode # endif const char *_ossl_old_des_options(void); void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3, int enc); DES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, long length, _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec); void _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, long length, _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int enc); void _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, long length, _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int enc); void _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, long length, _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, _ossl_old_des_cblock *inw, _ossl_old_des_cblock *outw, int enc); void _ossl_old_des_cfb_encrypt(unsigned char *in, unsigned char *out, int numbits, long length, _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int enc); void _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, _ossl_old_des_key_schedule ks, int enc); void _ossl_old_des_encrypt(DES_LONG *data, _ossl_old_des_key_schedule ks, int enc); void _ossl_old_des_encrypt2(DES_LONG *data, _ossl_old_des_key_schedule ks, int enc); void _ossl_old_des_encrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3); void _ossl_old_des_decrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3); void _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int enc); void _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num, int enc); void _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num); # if 0 void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), _ossl_old_des_cblock (*in_white), _ossl_old_des_cblock (*out_white)); # endif int _ossl_old_des_enc_read(int fd, char *buf, int len, _ossl_old_des_key_schedule sched, _ossl_old_des_cblock *iv); int _ossl_old_des_enc_write(int fd, char *buf, int len, _ossl_old_des_key_schedule sched, _ossl_old_des_cblock *iv); char *_ossl_old_des_fcrypt(const char *buf, const char *salt, char *ret); char *_ossl_old_des_crypt(const char *buf, const char *salt); # if !defined(PERL5) && !defined(NeXT) char *_ossl_old_crypt(const char *buf, const char *salt); # endif void _ossl_old_des_ofb_encrypt(unsigned char *in, unsigned char *out, int numbits, long length, _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec); void _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, long length, _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int enc); DES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, long length, int out_count, _ossl_old_des_cblock *seed); void _ossl_old_des_random_seed(_ossl_old_des_cblock key); void _ossl_old_des_random_key(_ossl_old_des_cblock ret); int _ossl_old_des_read_password(_ossl_old_des_cblock *key, const char *prompt, int verify); int _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1, _ossl_old_des_cblock *key2, const char *prompt, int verify); void _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key); int _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key); int _ossl_old_des_set_key(_ossl_old_des_cblock *key, _ossl_old_des_key_schedule schedule); int _ossl_old_des_key_sched(_ossl_old_des_cblock *key, _ossl_old_des_key_schedule schedule); void _ossl_old_des_string_to_key(char *str, _ossl_old_des_cblock *key); void _ossl_old_des_string_to_2keys(char *str, _ossl_old_des_cblock *key1, _ossl_old_des_cblock *key2); void _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num, int enc); void _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num); void _ossl_096_des_random_seed(des_cblock *key); /* * The following definitions provide compatibility with the MIT Kerberos * library. The _ossl_old_des_key_schedule structure is not binary * compatible. */ # define _KERBEROS_DES_H # define KRBDES_ENCRYPT DES_ENCRYPT # define KRBDES_DECRYPT DES_DECRYPT # ifdef KERBEROS # define ENCRYPT DES_ENCRYPT # define DECRYPT DES_DECRYPT # endif # ifndef NCOMPAT # define C_Block des_cblock # define Key_schedule des_key_schedule # define KEY_SZ DES_KEY_SZ # define string_to_key des_string_to_key # define read_pw_string des_read_pw_string # define random_key des_random_key # define pcbc_encrypt des_pcbc_encrypt # define set_key des_set_key # define key_sched des_key_sched # define ecb_encrypt des_ecb_encrypt # define cbc_encrypt des_cbc_encrypt # define ncbc_encrypt des_ncbc_encrypt # define xcbc_encrypt des_xcbc_encrypt # define cbc_cksum des_cbc_cksum # define quad_cksum des_quad_cksum # define check_parity des_check_key_parity # endif # define des_fixup_key_parity DES_fixup_key_parity #ifdef __cplusplus } #endif /* for DES_read_pw_string et al */ # include <openssl/ui_compat.h> #endif ������������������openssl/rc2.h���������������������������������������������������������������������������������������0000644�����������������00000010702�14763166030�0007074 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/rc2/rc2.h */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_RC2_H # define HEADER_RC2_H # include <openssl/opensslconf.h>/* OPENSSL_NO_RC2, RC2_INT */ # ifdef OPENSSL_NO_RC2 # error RC2 is disabled. # endif # define RC2_ENCRYPT 1 # define RC2_DECRYPT 0 # define RC2_BLOCK 8 # define RC2_KEY_LENGTH 16 #ifdef __cplusplus extern "C" { #endif typedef struct rc2_key_st { RC2_INT data[64]; } RC2_KEY; # ifdef OPENSSL_FIPS void private_RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits); # endif void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits); void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, RC2_KEY *key, int enc); void RC2_encrypt(unsigned long *data, RC2_KEY *key); void RC2_decrypt(unsigned long *data, RC2_KEY *key); void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, RC2_KEY *ks, unsigned char *iv, int enc); void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, RC2_KEY *schedule, unsigned char *ivec, int *num, int enc); void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, RC2_KEY *schedule, unsigned char *ivec, int *num); #ifdef __cplusplus } #endif #endif ��������������������������������������������������������������openssl/sha.h���������������������������������������������������������������������������������������0000644�����������������00000016630�14763166030�0007167 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/sha/sha.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_SHA_H # define HEADER_SHA_H # include <openssl/e_os2.h> # include <stddef.h> #ifdef __cplusplus extern "C" { #endif # if defined(OPENSSL_NO_SHA) || (defined(OPENSSL_NO_SHA0) && defined(OPENSSL_NO_SHA1)) # error SHA is disabled. # endif # if defined(OPENSSL_FIPS) # define FIPS_SHA_SIZE_T size_t # endif /*- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * ! SHA_LONG has to be at least 32 bits wide. If it's wider, then ! * ! SHA_LONG_LOG2 has to be defined along. ! * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ # if defined(__LP32__) # define SHA_LONG unsigned long # elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) # define SHA_LONG unsigned long # define SHA_LONG_LOG2 3 # else # define SHA_LONG unsigned int # endif # define SHA_LBLOCK 16 # define SHA_CBLOCK (SHA_LBLOCK*4)/* SHA treats input data as a * contiguous array of 32 bit wide * big-endian values. */ # define SHA_LAST_BLOCK (SHA_CBLOCK-8) # define SHA_DIGEST_LENGTH 20 typedef struct SHAstate_st { SHA_LONG h0, h1, h2, h3, h4; SHA_LONG Nl, Nh; SHA_LONG data[SHA_LBLOCK]; unsigned int num; } SHA_CTX; # ifndef OPENSSL_NO_SHA0 int SHA_Init(SHA_CTX *c); int SHA_Update(SHA_CTX *c, const void *data, size_t len); int SHA_Final(unsigned char *md, SHA_CTX *c); unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md); void SHA_Transform(SHA_CTX *c, const unsigned char *data); # endif # ifndef OPENSSL_NO_SHA1 int SHA1_Init(SHA_CTX *c); int SHA1_Update(SHA_CTX *c, const void *data, size_t len); int SHA1_Final(unsigned char *md, SHA_CTX *c); unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md); void SHA1_Transform(SHA_CTX *c, const unsigned char *data); # endif # define SHA256_CBLOCK (SHA_LBLOCK*4)/* SHA-256 treats input data as a * contiguous array of 32 bit wide * big-endian values. */ # define SHA224_DIGEST_LENGTH 28 # define SHA256_DIGEST_LENGTH 32 typedef struct SHA256state_st { SHA_LONG h[8]; SHA_LONG Nl, Nh; SHA_LONG data[SHA_LBLOCK]; unsigned int num, md_len; } SHA256_CTX; # ifndef OPENSSL_NO_SHA256 int SHA224_Init(SHA256_CTX *c); int SHA224_Update(SHA256_CTX *c, const void *data, size_t len); int SHA224_Final(unsigned char *md, SHA256_CTX *c); unsigned char *SHA224(const unsigned char *d, size_t n, unsigned char *md); int SHA256_Init(SHA256_CTX *c); int SHA256_Update(SHA256_CTX *c, const void *data, size_t len); int SHA256_Final(unsigned char *md, SHA256_CTX *c); unsigned char *SHA256(const unsigned char *d, size_t n, unsigned char *md); void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); # endif # define SHA384_DIGEST_LENGTH 48 # define SHA512_DIGEST_LENGTH 64 # ifndef OPENSSL_NO_SHA512 /* * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 * being exactly 64-bit wide. See Implementation Notes in sha512.c * for further details. */ /* * SHA-512 treats input data as a * contiguous array of 64 bit * wide big-endian values. */ # define SHA512_CBLOCK (SHA_LBLOCK*8) # if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) # define SHA_LONG64 unsigned __int64 # define U64(C) C##UI64 # elif defined(__arch64__) # define SHA_LONG64 unsigned long # define U64(C) C##UL # else # define SHA_LONG64 unsigned long long # define U64(C) C##ULL # endif typedef struct SHA512state_st { SHA_LONG64 h[8]; SHA_LONG64 Nl, Nh; union { SHA_LONG64 d[SHA_LBLOCK]; unsigned char p[SHA512_CBLOCK]; } u; unsigned int num, md_len; } SHA512_CTX; # endif # ifndef OPENSSL_NO_SHA512 int SHA384_Init(SHA512_CTX *c); int SHA384_Update(SHA512_CTX *c, const void *data, size_t len); int SHA384_Final(unsigned char *md, SHA512_CTX *c); unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md); int SHA512_Init(SHA512_CTX *c); int SHA512_Update(SHA512_CTX *c, const void *data, size_t len); int SHA512_Final(unsigned char *md, SHA512_CTX *c); unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md); void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); # endif #ifdef __cplusplus } #endif #endif ��������������������������������������������������������������������������������������������������������openssl/camellia.h����������������������������������������������������������������������������������0000644�����������������00000012675�14763166030�0010170 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/camellia/camellia.h */ /* ==================================================================== * Copyright (c) 2006 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * */ #ifndef HEADER_CAMELLIA_H # define HEADER_CAMELLIA_H # include <openssl/opensslconf.h> # ifdef OPENSSL_NO_CAMELLIA # error CAMELLIA is disabled. # endif # include <stddef.h> # define CAMELLIA_ENCRYPT 1 # define CAMELLIA_DECRYPT 0 /* * Because array size can't be a const in C, the following two are macros. * Both sizes are in bytes. */ #ifdef __cplusplus extern "C" { #endif /* This should be a hidden type, but EVP requires that the size be known */ # define CAMELLIA_BLOCK_SIZE 16 # define CAMELLIA_TABLE_BYTE_LEN 272 # define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4) typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match * with WORD */ struct camellia_key_st { union { double d; /* ensures 64-bit align */ KEY_TABLE_TYPE rd_key; } u; int grand_rounds; }; typedef struct camellia_key_st CAMELLIA_KEY; # ifdef OPENSSL_FIPS int private_Camellia_set_key(const unsigned char *userKey, const int bits, CAMELLIA_KEY *key); # endif int Camellia_set_key(const unsigned char *userKey, const int bits, CAMELLIA_KEY *key); void Camellia_encrypt(const unsigned char *in, unsigned char *out, const CAMELLIA_KEY *key); void Camellia_decrypt(const unsigned char *in, unsigned char *out, const CAMELLIA_KEY *key); void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out, const CAMELLIA_KEY *key, const int enc); void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, const int enc); void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, int *num, const int enc); void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, int *num, const int enc); void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, int *num, const int enc); void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, int *num); void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char ivec[CAMELLIA_BLOCK_SIZE], unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE], unsigned int *num); #ifdef __cplusplus } #endif #endif /* !HEADER_Camellia_H */ �������������������������������������������������������������������openssl/cms.h���������������������������������������������������������������������������������������0000644�����������������00000067741�14763166030�0007207 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/cms/cms.h */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ /* ==================================================================== * Copyright (c) 2008 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * licensing@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== */ #ifndef HEADER_CMS_H # define HEADER_CMS_H # include <openssl/x509.h> # ifdef OPENSSL_NO_CMS # error CMS is disabled. # endif #ifdef __cplusplus extern "C" { #endif typedef struct CMS_ContentInfo_st CMS_ContentInfo; typedef struct CMS_SignerInfo_st CMS_SignerInfo; typedef struct CMS_CertificateChoices CMS_CertificateChoices; typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice; typedef struct CMS_RecipientInfo_st CMS_RecipientInfo; typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest; typedef struct CMS_Receipt_st CMS_Receipt; typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey; typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute; DECLARE_STACK_OF(CMS_SignerInfo) DECLARE_STACK_OF(GENERAL_NAMES) DECLARE_STACK_OF(CMS_RecipientEncryptedKey) DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo) DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest) DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo) # define CMS_SIGNERINFO_ISSUER_SERIAL 0 # define CMS_SIGNERINFO_KEYIDENTIFIER 1 # define CMS_RECIPINFO_NONE -1 # define CMS_RECIPINFO_TRANS 0 # define CMS_RECIPINFO_AGREE 1 # define CMS_RECIPINFO_KEK 2 # define CMS_RECIPINFO_PASS 3 # define CMS_RECIPINFO_OTHER 4 /* S/MIME related flags */ # define CMS_TEXT 0x1 # define CMS_NOCERTS 0x2 # define CMS_NO_CONTENT_VERIFY 0x4 # define CMS_NO_ATTR_VERIFY 0x8 # define CMS_NOSIGS \ (CMS_NO_CONTENT_VERIFY|CMS_NO_ATTR_VERIFY) # define CMS_NOINTERN 0x10 # define CMS_NO_SIGNER_CERT_VERIFY 0x20 # define CMS_NOVERIFY 0x20 # define CMS_DETACHED 0x40 # define CMS_BINARY 0x80 # define CMS_NOATTR 0x100 # define CMS_NOSMIMECAP 0x200 # define CMS_NOOLDMIMETYPE 0x400 # define CMS_CRLFEOL 0x800 # define CMS_STREAM 0x1000 # define CMS_NOCRL 0x2000 # define CMS_PARTIAL 0x4000 # define CMS_REUSE_DIGEST 0x8000 # define CMS_USE_KEYID 0x10000 # define CMS_DEBUG_DECRYPT 0x20000 # define CMS_KEY_PARAM 0x40000 const ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms); BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont); int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio); ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms); int CMS_is_detached(CMS_ContentInfo *cms); int CMS_set_detached(CMS_ContentInfo *cms, int detached); # ifdef HEADER_PEM_H DECLARE_PEM_rw_const(CMS, CMS_ContentInfo) # endif int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms); CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms); int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms); BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms); int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags); int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags); CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont); int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags); int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int flags); CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, BIO *data, unsigned int flags); CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, unsigned int flags); int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags); CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags); int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out, unsigned int flags); CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md, unsigned int flags); int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms, const unsigned char *key, size_t keylen, BIO *dcont, BIO *out, unsigned int flags); CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher, const unsigned char *key, size_t keylen, unsigned int flags); int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph, const unsigned char *key, size_t keylen); int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags); int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms, STACK_OF(X509) *certs, X509_STORE *store, unsigned int flags); STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms); CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, unsigned int flags); int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert, BIO *dcont, BIO *out, unsigned int flags); int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert); int CMS_decrypt_set1_key(CMS_ContentInfo *cms, unsigned char *key, size_t keylen, unsigned char *id, size_t idlen); int CMS_decrypt_set1_password(CMS_ContentInfo *cms, unsigned char *pass, ossl_ssize_t passlen); STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms); int CMS_RecipientInfo_type(CMS_RecipientInfo *ri); EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri); CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher); CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms, X509 *recip, unsigned int flags); int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey); int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert); int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri, EVP_PKEY **pk, X509 **recip, X509_ALGOR **palg); int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri, ASN1_OCTET_STRING **keyid, X509_NAME **issuer, ASN1_INTEGER **sno); CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid, unsigned char *key, size_t keylen, unsigned char *id, size_t idlen, ASN1_GENERALIZEDTIME *date, ASN1_OBJECT *otherTypeId, ASN1_TYPE *otherType); int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, X509_ALGOR **palg, ASN1_OCTET_STRING **pid, ASN1_GENERALIZEDTIME **pdate, ASN1_OBJECT **potherid, ASN1_TYPE **pothertype); int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, unsigned char *key, size_t keylen); int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri, const unsigned char *id, size_t idlen); int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri, unsigned char *pass, ossl_ssize_t passlen); CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms, int iter, int wrap_nid, int pbe_nid, unsigned char *pass, ossl_ssize_t passlen, const EVP_CIPHER *kekciph); int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out, unsigned int flags); CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags); int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid); const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms); CMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms); int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert); int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert); STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms); CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms); int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl); int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl); STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms); int CMS_SignedData_init(CMS_ContentInfo *cms); CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms, X509 *signer, EVP_PKEY *pk, const EVP_MD *md, unsigned int flags); EVP_PKEY_CTX *CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si); EVP_MD_CTX *CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo *si); STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms); void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer); int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, ASN1_OCTET_STRING **keyid, X509_NAME **issuer, ASN1_INTEGER **sno); int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert); int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs, unsigned int flags); void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk, X509 **signer, X509_ALGOR **pdig, X509_ALGOR **psig); ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si); int CMS_SignerInfo_sign(CMS_SignerInfo *si); int CMS_SignerInfo_verify(CMS_SignerInfo *si); int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain); int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs); int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs, int algnid, int keysize); int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap); int CMS_signed_get_attr_count(const CMS_SignerInfo *si); int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid, int lastpos); int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, ASN1_OBJECT *obj, int lastpos); X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc); X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc); int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr); int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *obj, int type, const void *bytes, int len); int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si, int nid, int type, const void *bytes, int len); int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si, const char *attrname, int type, const void *bytes, int len); void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid, int lastpos, int type); int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si); int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid, int lastpos); int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, ASN1_OBJECT *obj, int lastpos); X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc); X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc); int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr); int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *obj, int type, const void *bytes, int len); int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si, int nid, int type, const void *bytes, int len); int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si, const char *attrname, int type, const void *bytes, int len); void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid, int lastpos, int type); # ifdef HEADER_X509V3_H int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr); CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idlen, int allorfirst, STACK_OF(GENERAL_NAMES) *receiptList, STACK_OF(GENERAL_NAMES) *receiptsTo); int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr); void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr, ASN1_STRING **pcid, int *pallorfirst, STACK_OF(GENERAL_NAMES) **plist, STACK_OF(GENERAL_NAMES) **prto); # endif int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri, X509_ALGOR **palg, ASN1_OCTET_STRING **pukm); STACK_OF(CMS_RecipientEncryptedKey) *CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo *ri); int CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri, X509_ALGOR **pubalg, ASN1_BIT_STRING **pubkey, ASN1_OCTET_STRING **keyid, X509_NAME **issuer, ASN1_INTEGER **sno); int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert); int CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek, ASN1_OCTET_STRING **keyid, ASN1_GENERALIZEDTIME **tm, CMS_OtherKeyAttribute **other, X509_NAME **issuer, ASN1_INTEGER **sno); int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek, X509 *cert); int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk); EVP_CIPHER_CTX *CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri); int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, CMS_RecipientEncryptedKey *rek); int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg, ASN1_OCTET_STRING *ukm, int keylen); /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_CMS_strings(void); /* Error codes for the CMS functions. */ /* Function codes. */ # define CMS_F_CHECK_CONTENT 99 # define CMS_F_CMS_ADD0_CERT 164 # define CMS_F_CMS_ADD0_RECIPIENT_KEY 100 # define CMS_F_CMS_ADD0_RECIPIENT_PASSWORD 165 # define CMS_F_CMS_ADD1_RECEIPTREQUEST 158 # define CMS_F_CMS_ADD1_RECIPIENT_CERT 101 # define CMS_F_CMS_ADD1_SIGNER 102 # define CMS_F_CMS_ADD1_SIGNINGTIME 103 # define CMS_F_CMS_COMPRESS 104 # define CMS_F_CMS_COMPRESSEDDATA_CREATE 105 # define CMS_F_CMS_COMPRESSEDDATA_INIT_BIO 106 # define CMS_F_CMS_COPY_CONTENT 107 # define CMS_F_CMS_COPY_MESSAGEDIGEST 108 # define CMS_F_CMS_DATA 109 # define CMS_F_CMS_DATAFINAL 110 # define CMS_F_CMS_DATAINIT 111 # define CMS_F_CMS_DECRYPT 112 # define CMS_F_CMS_DECRYPT_SET1_KEY 113 # define CMS_F_CMS_DECRYPT_SET1_PASSWORD 166 # define CMS_F_CMS_DECRYPT_SET1_PKEY 114 # define CMS_F_CMS_DIGESTALGORITHM_FIND_CTX 115 # define CMS_F_CMS_DIGESTALGORITHM_INIT_BIO 116 # define CMS_F_CMS_DIGESTEDDATA_DO_FINAL 117 # define CMS_F_CMS_DIGEST_VERIFY 118 # define CMS_F_CMS_ENCODE_RECEIPT 161 # define CMS_F_CMS_ENCRYPT 119 # define CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO 120 # define CMS_F_CMS_ENCRYPTEDDATA_DECRYPT 121 # define CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT 122 # define CMS_F_CMS_ENCRYPTEDDATA_SET1_KEY 123 # define CMS_F_CMS_ENVELOPEDDATA_CREATE 124 # define CMS_F_CMS_ENVELOPEDDATA_INIT_BIO 125 # define CMS_F_CMS_ENVELOPED_DATA_INIT 126 # define CMS_F_CMS_ENV_ASN1_CTRL 171 # define CMS_F_CMS_FINAL 127 # define CMS_F_CMS_GET0_CERTIFICATE_CHOICES 128 # define CMS_F_CMS_GET0_CONTENT 129 # define CMS_F_CMS_GET0_ECONTENT_TYPE 130 # define CMS_F_CMS_GET0_ENVELOPED 131 # define CMS_F_CMS_GET0_REVOCATION_CHOICES 132 # define CMS_F_CMS_GET0_SIGNED 133 # define CMS_F_CMS_MSGSIGDIGEST_ADD1 162 # define CMS_F_CMS_RECEIPTREQUEST_CREATE0 159 # define CMS_F_CMS_RECEIPT_VERIFY 160 # define CMS_F_CMS_RECIPIENTINFO_DECRYPT 134 # define CMS_F_CMS_RECIPIENTINFO_ENCRYPT 169 # define CMS_F_CMS_RECIPIENTINFO_KARI_ENCRYPT 178 # define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ALG 175 # define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ORIG_ID 173 # define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_REKS 172 # define CMS_F_CMS_RECIPIENTINFO_KARI_ORIG_ID_CMP 174 # define CMS_F_CMS_RECIPIENTINFO_KEKRI_DECRYPT 135 # define CMS_F_CMS_RECIPIENTINFO_KEKRI_ENCRYPT 136 # define CMS_F_CMS_RECIPIENTINFO_KEKRI_GET0_ID 137 # define CMS_F_CMS_RECIPIENTINFO_KEKRI_ID_CMP 138 # define CMS_F_CMS_RECIPIENTINFO_KTRI_CERT_CMP 139 # define CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT 140 # define CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT 141 # define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS 142 # define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID 143 # define CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT 167 # define CMS_F_CMS_RECIPIENTINFO_SET0_KEY 144 # define CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD 168 # define CMS_F_CMS_RECIPIENTINFO_SET0_PKEY 145 # define CMS_F_CMS_SD_ASN1_CTRL 170 # define CMS_F_CMS_SET1_IAS 176 # define CMS_F_CMS_SET1_KEYID 177 # define CMS_F_CMS_SET1_SIGNERIDENTIFIER 146 # define CMS_F_CMS_SET_DETACHED 147 # define CMS_F_CMS_SIGN 148 # define CMS_F_CMS_SIGNED_DATA_INIT 149 # define CMS_F_CMS_SIGNERINFO_CONTENT_SIGN 150 # define CMS_F_CMS_SIGNERINFO_SIGN 151 # define CMS_F_CMS_SIGNERINFO_VERIFY 152 # define CMS_F_CMS_SIGNERINFO_VERIFY_CERT 153 # define CMS_F_CMS_SIGNERINFO_VERIFY_CONTENT 154 # define CMS_F_CMS_SIGN_RECEIPT 163 # define CMS_F_CMS_STREAM 155 # define CMS_F_CMS_UNCOMPRESS 156 # define CMS_F_CMS_VERIFY 157 /* Reason codes. */ # define CMS_R_ADD_SIGNER_ERROR 99 # define CMS_R_CERTIFICATE_ALREADY_PRESENT 175 # define CMS_R_CERTIFICATE_HAS_NO_KEYID 160 # define CMS_R_CERTIFICATE_VERIFY_ERROR 100 # define CMS_R_CIPHER_INITIALISATION_ERROR 101 # define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR 102 # define CMS_R_CMS_DATAFINAL_ERROR 103 # define CMS_R_CMS_LIB 104 # define CMS_R_CONTENTIDENTIFIER_MISMATCH 170 # define CMS_R_CONTENT_NOT_FOUND 105 # define CMS_R_CONTENT_TYPE_MISMATCH 171 # define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA 106 # define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA 107 # define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA 108 # define CMS_R_CONTENT_VERIFY_ERROR 109 # define CMS_R_CTRL_ERROR 110 # define CMS_R_CTRL_FAILURE 111 # define CMS_R_DECRYPT_ERROR 112 # define CMS_R_DIGEST_ERROR 161 # define CMS_R_ERROR_GETTING_PUBLIC_KEY 113 # define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE 114 # define CMS_R_ERROR_SETTING_KEY 115 # define CMS_R_ERROR_SETTING_RECIPIENTINFO 116 # define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH 117 # define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER 176 # define CMS_R_INVALID_KEY_LENGTH 118 # define CMS_R_MD_BIO_INIT_ERROR 119 # define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH 120 # define CMS_R_MESSAGEDIGEST_WRONG_LENGTH 121 # define CMS_R_MSGSIGDIGEST_ERROR 172 # define CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE 162 # define CMS_R_MSGSIGDIGEST_WRONG_LENGTH 163 # define CMS_R_NEED_ONE_SIGNER 164 # define CMS_R_NOT_A_SIGNED_RECEIPT 165 # define CMS_R_NOT_ENCRYPTED_DATA 122 # define CMS_R_NOT_KEK 123 # define CMS_R_NOT_KEY_AGREEMENT 181 # define CMS_R_NOT_KEY_TRANSPORT 124 # define CMS_R_NOT_PWRI 177 # define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 125 # define CMS_R_NO_CIPHER 126 # define CMS_R_NO_CONTENT 127 # define CMS_R_NO_CONTENT_TYPE 173 # define CMS_R_NO_DEFAULT_DIGEST 128 # define CMS_R_NO_DIGEST_SET 129 # define CMS_R_NO_KEY 130 # define CMS_R_NO_KEY_OR_CERT 174 # define CMS_R_NO_MATCHING_DIGEST 131 # define CMS_R_NO_MATCHING_RECIPIENT 132 # define CMS_R_NO_MATCHING_SIGNATURE 166 # define CMS_R_NO_MSGSIGDIGEST 167 # define CMS_R_NO_PASSWORD 178 # define CMS_R_NO_PRIVATE_KEY 133 # define CMS_R_NO_PUBLIC_KEY 134 # define CMS_R_NO_RECEIPT_REQUEST 168 # define CMS_R_NO_SIGNERS 135 # define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 136 # define CMS_R_RECEIPT_DECODE_ERROR 169 # define CMS_R_RECIPIENT_ERROR 137 # define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND 138 # define CMS_R_SIGNFINAL_ERROR 139 # define CMS_R_SMIME_TEXT_ERROR 140 # define CMS_R_STORE_INIT_ERROR 141 # define CMS_R_TYPE_NOT_COMPRESSED_DATA 142 # define CMS_R_TYPE_NOT_DATA 143 # define CMS_R_TYPE_NOT_DIGESTED_DATA 144 # define CMS_R_TYPE_NOT_ENCRYPTED_DATA 145 # define CMS_R_TYPE_NOT_ENVELOPED_DATA 146 # define CMS_R_UNABLE_TO_FINALIZE_CONTEXT 147 # define CMS_R_UNKNOWN_CIPHER 148 # define CMS_R_UNKNOWN_DIGEST_ALGORIHM 149 # define CMS_R_UNKNOWN_ID 150 # define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM 151 # define CMS_R_UNSUPPORTED_CONTENT_TYPE 152 # define CMS_R_UNSUPPORTED_KEK_ALGORITHM 153 # define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM 179 # define CMS_R_UNSUPPORTED_RECIPIENT_TYPE 154 # define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE 155 # define CMS_R_UNSUPPORTED_TYPE 156 # define CMS_R_UNWRAP_ERROR 157 # define CMS_R_UNWRAP_FAILURE 180 # define CMS_R_VERIFICATION_FAILURE 158 # define CMS_R_WRAP_ERROR 159 #ifdef __cplusplus } #endif #endif �������������������������������openssl/srtp.h��������������������������������������������������������������������������������������0000644�����������������00000014756�14763166030�0007413 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ssl/srtp.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ /* * DTLS code by Eric Rescorla <ekr@rtfm.com> * * Copyright (C) 2006, Network Resonance, Inc. Copyright (C) 2011, RTFM, Inc. */ #ifndef HEADER_D1_SRTP_H # define HEADER_D1_SRTP_H # include <openssl/ssl.h> #ifdef __cplusplus extern "C" { #endif # define SRTP_AES128_CM_SHA1_80 0x0001 # define SRTP_AES128_CM_SHA1_32 0x0002 # define SRTP_AES128_F8_SHA1_80 0x0003 # define SRTP_AES128_F8_SHA1_32 0x0004 # define SRTP_NULL_SHA1_80 0x0005 # define SRTP_NULL_SHA1_32 0x0006 # ifndef OPENSSL_NO_SRTP int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles); int SSL_set_tlsext_use_srtp(SSL *ctx, const char *profiles); STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl); SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s); # endif #ifdef __cplusplus } #endif #endif ������������������openssl/dtls1.h�������������������������������������������������������������������������������������0000644�����������������00000021526�14763166030�0007443 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ssl/dtls1.h */ /* * DTLS implementation written by Nagendra Modadugu * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. */ /* ==================================================================== * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_DTLS1_H # define HEADER_DTLS1_H # include <openssl/buffer.h> # include <openssl/pqueue.h> # ifdef OPENSSL_SYS_VMS # include <resource.h> # include <sys/timeb.h> # endif # ifdef OPENSSL_SYS_WIN32 /* Needed for struct timeval */ # include <winsock.h> # elif defined(OPENSSL_SYS_NETWARE) && !defined(_WINSOCK2API_) # include <sys/timeval.h> # else # if defined(OPENSSL_SYS_VXWORKS) # include <sys/times.h> # else # include <sys/time.h> # endif # endif #ifdef __cplusplus extern "C" { #endif # define DTLS1_VERSION 0xFEFF # define DTLS1_2_VERSION 0xFEFD # define DTLS_MAX_VERSION DTLS1_2_VERSION # define DTLS1_VERSION_MAJOR 0xFE # define DTLS1_BAD_VER 0x0100 /* Special value for method supporting multiple versions */ # define DTLS_ANY_VERSION 0x1FFFF # if 0 /* this alert description is not specified anywhere... */ # define DTLS1_AD_MISSING_HANDSHAKE_MESSAGE 110 # endif /* lengths of messages */ # define DTLS1_COOKIE_LENGTH 256 # define DTLS1_RT_HEADER_LENGTH 13 # define DTLS1_HM_HEADER_LENGTH 12 # define DTLS1_HM_BAD_FRAGMENT -2 # define DTLS1_HM_FRAGMENT_RETRY -3 # define DTLS1_CCS_HEADER_LENGTH 1 # ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE # define DTLS1_AL_HEADER_LENGTH 7 # else # define DTLS1_AL_HEADER_LENGTH 2 # endif # ifndef OPENSSL_NO_SSL_INTERN # ifndef OPENSSL_NO_SCTP # define DTLS1_SCTP_AUTH_LABEL "EXPORTER_DTLS_OVER_SCTP" # endif /* Max MTU overhead we know about so far is 40 for IPv6 + 8 for UDP */ # define DTLS1_MAX_MTU_OVERHEAD 48 typedef struct dtls1_bitmap_st { unsigned long map; /* track 32 packets on 32-bit systems and 64 * - on 64-bit systems */ unsigned char max_seq_num[8]; /* max record number seen so far, 64-bit * value in big-endian encoding */ } DTLS1_BITMAP; struct dtls1_retransmit_state { EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */ EVP_MD_CTX *write_hash; /* used for mac generation */ # ifndef OPENSSL_NO_COMP COMP_CTX *compress; /* compression */ # else char *compress; # endif SSL_SESSION *session; unsigned short epoch; }; struct hm_header_st { unsigned char type; unsigned long msg_len; unsigned short seq; unsigned long frag_off; unsigned long frag_len; unsigned int is_ccs; struct dtls1_retransmit_state saved_retransmit_state; }; struct ccs_header_st { unsigned char type; unsigned short seq; }; struct dtls1_timeout_st { /* Number of read timeouts so far */ unsigned int read_timeouts; /* Number of write timeouts so far */ unsigned int write_timeouts; /* Number of alerts received so far */ unsigned int num_alerts; }; typedef struct record_pqueue_st { unsigned short epoch; pqueue q; } record_pqueue; typedef struct hm_fragment_st { struct hm_header_st msg_header; unsigned char *fragment; unsigned char *reassembly; } hm_fragment; typedef struct dtls1_state_st { unsigned int send_cookie; unsigned char cookie[DTLS1_COOKIE_LENGTH]; unsigned char rcvd_cookie[DTLS1_COOKIE_LENGTH]; unsigned int cookie_len; /* * The current data and handshake epoch. This is initially * undefined, and starts at zero once the initial handshake is * completed */ unsigned short r_epoch; unsigned short w_epoch; /* records being received in the current epoch */ DTLS1_BITMAP bitmap; /* renegotiation starts a new set of sequence numbers */ DTLS1_BITMAP next_bitmap; /* handshake message numbers */ unsigned short handshake_write_seq; unsigned short next_handshake_write_seq; unsigned short handshake_read_seq; /* save last sequence number for retransmissions */ unsigned char last_write_sequence[8]; /* Received handshake records (processed and unprocessed) */ record_pqueue unprocessed_rcds; record_pqueue processed_rcds; /* Buffered handshake messages */ pqueue buffered_messages; /* Buffered (sent) handshake records */ pqueue sent_messages; /* * Buffered application records. Only for records between CCS and * Finished to prevent either protocol violation or unnecessary message * loss. */ record_pqueue buffered_app_data; unsigned int mtu; /* max DTLS packet size */ struct hm_header_st w_msg_hdr; struct hm_header_st r_msg_hdr; struct dtls1_timeout_st timeout; /* * Indicates when the last handshake msg or heartbeat sent will timeout */ struct timeval next_timeout; /* Timeout duration */ unsigned short timeout_duration; /* * storage for Alert/Handshake protocol data received but not yet * processed by ssl3_read_bytes: */ unsigned char alert_fragment[DTLS1_AL_HEADER_LENGTH]; unsigned int alert_fragment_len; unsigned char handshake_fragment[DTLS1_HM_HEADER_LENGTH]; unsigned int handshake_fragment_len; unsigned int retransmitting; /* * Set when the handshake is ready to process peer's ChangeCipherSpec message. * Cleared after the message has been processed. */ unsigned int change_cipher_spec_ok; /* Is set when listening for new connections with dtls1_listen() */ unsigned int listen; unsigned int link_mtu; /* max on-the-wire DTLS packet size */ # ifndef OPENSSL_NO_SCTP /* used when SSL_ST_XX_FLUSH is entered */ int next_state; int shutdown_received; # endif } DTLS1_STATE; typedef struct dtls1_record_data_st { unsigned char *packet; unsigned int packet_length; SSL3_BUFFER rbuf; SSL3_RECORD rrec; # ifndef OPENSSL_NO_SCTP struct bio_dgram_sctp_rcvinfo recordinfo; # endif } DTLS1_RECORD_DATA; # endif /* Timeout multipliers (timeout slice is defined in apps/timeouts.h */ # define DTLS1_TMO_READ_COUNT 2 # define DTLS1_TMO_WRITE_COUNT 2 # define DTLS1_TMO_ALERT_COUNT 12 #ifdef __cplusplus } #endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/bn.h����������������������������������������������������������������������������������������0000644�����������������00000114365�14763166030�0007017 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/bn/bn.h */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * * Portions of the attached software ("Contribution") are developed by * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. * * The Contribution is licensed pursuant to the Eric Young open source * license provided above. * * The binary polynomial arithmetic software is originally written by * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories. * */ #ifndef HEADER_BN_H # define HEADER_BN_H # include <limits.h> # include <openssl/e_os2.h> # ifndef OPENSSL_NO_FP_API # include <stdio.h> /* FILE */ # endif # include <openssl/ossl_typ.h> # include <openssl/crypto.h> #ifdef __cplusplus extern "C" { #endif /* * These preprocessor symbols control various aspects of the bignum headers * and library code. They're not defined by any "normal" configuration, as * they are intended for development and testing purposes. NB: defining all * three can be useful for debugging application code as well as openssl * itself. BN_DEBUG - turn on various debugging alterations to the bignum * code BN_DEBUG_RAND - uses random poisoning of unused words to trip up * mismanagement of bignum internals. You must also define BN_DEBUG. */ /* #define BN_DEBUG */ /* #define BN_DEBUG_RAND */ # ifndef OPENSSL_SMALL_FOOTPRINT # define BN_MUL_COMBA # define BN_SQR_COMBA # define BN_RECURSION # endif /* * This next option uses the C libraries (2 word)/(1 word) function. If it is * not defined, I use my C version (which is slower). The reason for this * flag is that when the particular C compiler library routine is used, and * the library is linked with a different compiler, the library is missing. * This mostly happens when the library is built with gcc and then linked * using normal cc. This would be a common occurrence because gcc normally * produces code that is 2 times faster than system compilers for the big * number stuff. For machines with only one compiler (or shared libraries), * this should be on. Again this in only really a problem on machines using * "long long's", are 32bit, and are not using my assembler code. */ # if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || \ defined(OPENSSL_SYS_WIN32) || defined(linux) # ifndef BN_DIV2W # define BN_DIV2W # endif # endif /* * assuming long is 64bit - this is the DEC Alpha unsigned long long is only * 64 bits :-(, don't define BN_LLONG for the DEC Alpha */ # ifdef SIXTY_FOUR_BIT_LONG # define BN_ULLONG unsigned long long # define BN_ULONG unsigned long # define BN_LONG long # define BN_BITS 128 # define BN_BYTES 8 # define BN_BITS2 64 # define BN_BITS4 32 # define BN_MASK (0xffffffffffffffffffffffffffffffffLL) # define BN_MASK2 (0xffffffffffffffffL) # define BN_MASK2l (0xffffffffL) # define BN_MASK2h (0xffffffff00000000L) # define BN_MASK2h1 (0xffffffff80000000L) # define BN_TBIT (0x8000000000000000L) # define BN_DEC_CONV (10000000000000000000UL) # define BN_DEC_FMT1 "%lu" # define BN_DEC_FMT2 "%019lu" # define BN_DEC_NUM 19 # define BN_HEX_FMT1 "%lX" # define BN_HEX_FMT2 "%016lX" # endif /* * This is where the long long data type is 64 bits, but long is 32. For * machines where there are 64bit registers, this is the mode to use. IRIX, * on R4000 and above should use this mode, along with the relevant assembler * code :-). Do NOT define BN_LLONG. */ # ifdef SIXTY_FOUR_BIT # undef BN_LLONG # undef BN_ULLONG # define BN_ULONG unsigned long long # define BN_LONG long long # define BN_BITS 128 # define BN_BYTES 8 # define BN_BITS2 64 # define BN_BITS4 32 # define BN_MASK2 (0xffffffffffffffffLL) # define BN_MASK2l (0xffffffffL) # define BN_MASK2h (0xffffffff00000000LL) # define BN_MASK2h1 (0xffffffff80000000LL) # define BN_TBIT (0x8000000000000000LL) # define BN_DEC_CONV (10000000000000000000ULL) # define BN_DEC_FMT1 "%llu" # define BN_DEC_FMT2 "%019llu" # define BN_DEC_NUM 19 # define BN_HEX_FMT1 "%llX" # define BN_HEX_FMT2 "%016llX" # endif # ifdef THIRTY_TWO_BIT # ifdef BN_LLONG # if defined(_WIN32) && !defined(__GNUC__) # define BN_ULLONG unsigned __int64 # define BN_MASK (0xffffffffffffffffI64) # else # define BN_ULLONG unsigned long long # define BN_MASK (0xffffffffffffffffLL) # endif # endif # define BN_ULONG unsigned int # define BN_LONG int # define BN_BITS 64 # define BN_BYTES 4 # define BN_BITS2 32 # define BN_BITS4 16 # define BN_MASK2 (0xffffffffL) # define BN_MASK2l (0xffff) # define BN_MASK2h1 (0xffff8000L) # define BN_MASK2h (0xffff0000L) # define BN_TBIT (0x80000000L) # define BN_DEC_CONV (1000000000L) # define BN_DEC_FMT1 "%u" # define BN_DEC_FMT2 "%09u" # define BN_DEC_NUM 9 # define BN_HEX_FMT1 "%X" # define BN_HEX_FMT2 "%08X" # endif # define BN_DEFAULT_BITS 1280 # define BN_FLG_MALLOCED 0x01 # define BN_FLG_STATIC_DATA 0x02 /* * avoid leaking exponent information through timing, * BN_mod_exp_mont() will call BN_mod_exp_mont_consttime, * BN_div() will call BN_div_no_branch, * BN_mod_inverse() will call BN_mod_inverse_no_branch. */ # define BN_FLG_CONSTTIME 0x04 # ifdef OPENSSL_NO_DEPRECATED /* deprecated name for the flag */ # define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME /* * avoid leaking exponent information through timings * (BN_mod_exp_mont() will call BN_mod_exp_mont_consttime) */ # endif # ifndef OPENSSL_NO_DEPRECATED # define BN_FLG_FREE 0x8000 /* used for debuging */ # endif # define BN_set_flags(b,n) ((b)->flags|=(n)) # define BN_get_flags(b,n) ((b)->flags&(n)) /* * get a clone of a BIGNUM with changed flags, for *temporary* use only (the * two BIGNUMs cannot not be used in parallel!) */ # define BN_with_flags(dest,b,n) ((dest)->d=(b)->d, \ (dest)->top=(b)->top, \ (dest)->dmax=(b)->dmax, \ (dest)->neg=(b)->neg, \ (dest)->flags=(((dest)->flags & BN_FLG_MALLOCED) \ | ((b)->flags & ~BN_FLG_MALLOCED) \ | BN_FLG_STATIC_DATA \ | (n))) /* Already declared in ossl_typ.h */ # if 0 typedef struct bignum_st BIGNUM; /* Used for temp variables (declaration hidden in bn_lcl.h) */ typedef struct bignum_ctx BN_CTX; typedef struct bn_blinding_st BN_BLINDING; typedef struct bn_mont_ctx_st BN_MONT_CTX; typedef struct bn_recp_ctx_st BN_RECP_CTX; typedef struct bn_gencb_st BN_GENCB; # endif struct bignum_st { BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit * chunks. */ int top; /* Index of last used d +1. */ /* The next are internal book keeping for bn_expand. */ int dmax; /* Size of the d array. */ int neg; /* one if the number is negative */ int flags; }; /* Used for montgomery multiplication */ struct bn_mont_ctx_st { int ri; /* number of bits in R */ BIGNUM RR; /* used to convert to montgomery form */ BIGNUM N; /* The modulus */ BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1 (Ni is only * stored for bignum algorithm) */ BN_ULONG n0[2]; /* least significant word(s) of Ni; (type * changed with 0.9.9, was "BN_ULONG n0;" * before) */ int flags; }; /* * Used for reciprocal division/mod functions It cannot be shared between * threads */ struct bn_recp_ctx_st { BIGNUM N; /* the divisor */ BIGNUM Nr; /* the reciprocal */ int num_bits; int shift; int flags; }; /* Used for slow "generation" functions. */ struct bn_gencb_st { unsigned int ver; /* To handle binary (in)compatibility */ void *arg; /* callback-specific data */ union { /* if(ver==1) - handles old style callbacks */ void (*cb_1) (int, int, void *); /* if(ver==2) - new callback style */ int (*cb_2) (int, int, BN_GENCB *); } cb; }; /* Wrapper function to make using BN_GENCB easier, */ int BN_GENCB_call(BN_GENCB *cb, int a, int b); /* Macro to populate a BN_GENCB structure with an "old"-style callback */ # define BN_GENCB_set_old(gencb, callback, cb_arg) { \ BN_GENCB *tmp_gencb = (gencb); \ tmp_gencb->ver = 1; \ tmp_gencb->arg = (cb_arg); \ tmp_gencb->cb.cb_1 = (callback); } /* Macro to populate a BN_GENCB structure with a "new"-style callback */ # define BN_GENCB_set(gencb, callback, cb_arg) { \ BN_GENCB *tmp_gencb = (gencb); \ tmp_gencb->ver = 2; \ tmp_gencb->arg = (cb_arg); \ tmp_gencb->cb.cb_2 = (callback); } # define BN_prime_checks 0 /* default: select number of iterations based * on the size of the number */ /* * number of Miller-Rabin iterations for an error rate of less than 2^-80 for * random 'b'-bit input, b >= 100 (taken from table 4.4 in the Handbook of * Applied Cryptography [Menezes, van Oorschot, Vanstone; CRC Press 1996]; * original paper: Damgaard, Landrock, Pomerance: Average case error * estimates for the strong probable prime test. -- Math. Comp. 61 (1993) * 177-194) */ # define BN_prime_checks_for_size(b) ((b) >= 1300 ? 2 : \ (b) >= 850 ? 3 : \ (b) >= 650 ? 4 : \ (b) >= 550 ? 5 : \ (b) >= 450 ? 6 : \ (b) >= 400 ? 7 : \ (b) >= 350 ? 8 : \ (b) >= 300 ? 9 : \ (b) >= 250 ? 12 : \ (b) >= 200 ? 15 : \ (b) >= 150 ? 18 : \ /* b >= 100 */ 27) # define BN_num_bytes(a) ((BN_num_bits(a)+7)/8) /* Note that BN_abs_is_word didn't work reliably for w == 0 until 0.9.8 */ # define BN_abs_is_word(a,w) ((((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) || \ (((w) == 0) && ((a)->top == 0))) # define BN_is_zero(a) ((a)->top == 0) # define BN_is_one(a) (BN_abs_is_word((a),1) && !(a)->neg) # define BN_is_word(a,w) (BN_abs_is_word((a),(w)) && (!(w) || !(a)->neg)) # define BN_is_odd(a) (((a)->top > 0) && ((a)->d[0] & 1)) # define BN_one(a) (BN_set_word((a),1)) # define BN_zero_ex(a) \ do { \ BIGNUM *_tmp_bn = (a); \ _tmp_bn->top = 0; \ _tmp_bn->neg = 0; \ } while(0) # ifdef OPENSSL_NO_DEPRECATED # define BN_zero(a) BN_zero_ex(a) # else # define BN_zero(a) (BN_set_word((a),0)) # endif const BIGNUM *BN_value_one(void); char *BN_options(void); BN_CTX *BN_CTX_new(void); # ifndef OPENSSL_NO_DEPRECATED void BN_CTX_init(BN_CTX *c); # endif void BN_CTX_free(BN_CTX *c); void BN_CTX_start(BN_CTX *ctx); BIGNUM *BN_CTX_get(BN_CTX *ctx); void BN_CTX_end(BN_CTX *ctx); int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); int BN_rand_range(BIGNUM *rnd, const BIGNUM *range); int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range); int BN_num_bits(const BIGNUM *a); int BN_num_bits_word(BN_ULONG); BIGNUM *BN_new(void); void BN_init(BIGNUM *); void BN_clear_free(BIGNUM *a); BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b); void BN_swap(BIGNUM *a, BIGNUM *b); BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret); int BN_bn2bin(const BIGNUM *a, unsigned char *to); BIGNUM *BN_mpi2bn(const unsigned char *s, int len, BIGNUM *ret); int BN_bn2mpi(const BIGNUM *a, unsigned char *to); int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx); /** BN_set_negative sets sign of a BIGNUM * \param b pointer to the BIGNUM object * \param n 0 if the BIGNUM b should be positive and a value != 0 otherwise */ void BN_set_negative(BIGNUM *b, int n); /** BN_is_negative returns 1 if the BIGNUM is negative * \param a pointer to the BIGNUM object * \return 1 if a < 0 and 0 otherwise */ # define BN_is_negative(a) ((a)->neg != 0) int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx); # define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx)) int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx); int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx); int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m); int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx); int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m); int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx); int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m); int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, BN_CTX *ctx); int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m); BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); int BN_mul_word(BIGNUM *a, BN_ULONG w); int BN_add_word(BIGNUM *a, BN_ULONG w); int BN_sub_word(BIGNUM *a, BN_ULONG w); int BN_set_word(BIGNUM *a, BN_ULONG w); BN_ULONG BN_get_word(const BIGNUM *a); int BN_cmp(const BIGNUM *a, const BIGNUM *b); void BN_free(BIGNUM *a); int BN_is_bit_set(const BIGNUM *a, int n); int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); int BN_lshift1(BIGNUM *r, const BIGNUM *a); int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx); int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont); int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1, const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx); int BN_mask_bits(BIGNUM *a, int n); # ifndef OPENSSL_NO_FP_API int BN_print_fp(FILE *fp, const BIGNUM *a); # endif # ifdef HEADER_BIO_H int BN_print(BIO *fp, const BIGNUM *a); # else int BN_print(void *fp, const BIGNUM *a); # endif int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx); int BN_rshift(BIGNUM *r, const BIGNUM *a, int n); int BN_rshift1(BIGNUM *r, const BIGNUM *a); void BN_clear(BIGNUM *a); BIGNUM *BN_dup(const BIGNUM *a); int BN_ucmp(const BIGNUM *a, const BIGNUM *b); int BN_set_bit(BIGNUM *a, int n); int BN_clear_bit(BIGNUM *a, int n); char *BN_bn2hex(const BIGNUM *a); char *BN_bn2dec(const BIGNUM *a); int BN_hex2bn(BIGNUM **a, const char *str); int BN_dec2bn(BIGNUM **a, const char *str); int BN_asc2bn(BIGNUM **a, const char *str); int BN_gcd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); /* returns * -2 for * error */ BIGNUM *BN_mod_inverse(BIGNUM *ret, const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); BIGNUM *BN_mod_sqrt(BIGNUM *ret, const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords); /* Deprecated versions */ # ifndef OPENSSL_NO_DEPRECATED BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe, const BIGNUM *add, const BIGNUM *rem, void (*callback) (int, int, void *), void *cb_arg); int BN_is_prime(const BIGNUM *p, int nchecks, void (*callback) (int, int, void *), BN_CTX *ctx, void *cb_arg); int BN_is_prime_fasttest(const BIGNUM *p, int nchecks, void (*callback) (int, int, void *), BN_CTX *ctx, void *cb_arg, int do_trial_division); # endif /* !defined(OPENSSL_NO_DEPRECATED) */ /* Newer versions */ int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add, const BIGNUM *rem, BN_GENCB *cb); int BN_is_prime_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, BN_GENCB *cb); int BN_is_prime_fasttest_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, int do_trial_division, BN_GENCB *cb); int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx); int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, const BIGNUM *Xp, const BIGNUM *Xp1, const BIGNUM *Xp2, const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb); int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, BIGNUM *Xp1, BIGNUM *Xp2, const BIGNUM *Xp, const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb); BN_MONT_CTX *BN_MONT_CTX_new(void); void BN_MONT_CTX_init(BN_MONT_CTX *ctx); int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_MONT_CTX *mont, BN_CTX *ctx); # define BN_to_montgomery(r,a,mont,ctx) BN_mod_mul_montgomery(\ (r),(a),&((mont)->RR),(mont),(ctx)) int BN_from_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, BN_CTX *ctx); void BN_MONT_CTX_free(BN_MONT_CTX *mont); int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx); BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from); BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, const BIGNUM *mod, BN_CTX *ctx); /* BN_BLINDING flags */ # define BN_BLINDING_NO_UPDATE 0x00000001 # define BN_BLINDING_NO_RECREATE 0x00000002 BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod); void BN_BLINDING_free(BN_BLINDING *b); int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx); int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *); int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *); # ifndef OPENSSL_NO_DEPRECATED unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *); void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long); # endif CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *); unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, int (*bn_mod_exp) (BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), BN_MONT_CTX *m_ctx); # ifndef OPENSSL_NO_DEPRECATED void BN_set_params(int mul, int high, int low, int mont); int BN_get_params(int which); /* 0, mul, 1 high, 2 low, 3 mont */ # endif void BN_RECP_CTX_init(BN_RECP_CTX *recp); BN_RECP_CTX *BN_RECP_CTX_new(void); void BN_RECP_CTX_free(BN_RECP_CTX *recp); int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *rdiv, BN_CTX *ctx); int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y, BN_RECP_CTX *recp, BN_CTX *ctx); int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx); int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, BN_RECP_CTX *recp, BN_CTX *ctx); /* * faster mod functions for the 'NIST primes' 0 <= a < p^2 */ int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); const BIGNUM *BN_get0_nist_prime_192(void); const BIGNUM *BN_get0_nist_prime_224(void); const BIGNUM *BN_get0_nist_prime_256(void); const BIGNUM *BN_get0_nist_prime_384(void); const BIGNUM *BN_get0_nist_prime_521(void); /* library internal functions */ # define bn_expand(a,bits) \ ( \ bits > (INT_MAX - BN_BITS2 + 1) ? \ NULL \ : \ (((bits+BN_BITS2-1)/BN_BITS2) <= (a)->dmax) ? \ (a) \ : \ bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2) \ ) # define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words))) BIGNUM *bn_expand2(BIGNUM *a, int words); # ifndef OPENSSL_NO_DEPRECATED BIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */ # endif /*- * Bignum consistency macros * There is one "API" macro, bn_fix_top(), for stripping leading zeroes from * bignum data after direct manipulations on the data. There is also an * "internal" macro, bn_check_top(), for verifying that there are no leading * zeroes. Unfortunately, some auditing is required due to the fact that * bn_fix_top() has become an overabused duct-tape because bignum data is * occasionally passed around in an inconsistent state. So the following * changes have been made to sort this out; * - bn_fix_top()s implementation has been moved to bn_correct_top() * - if BN_DEBUG isn't defined, bn_fix_top() maps to bn_correct_top(), and * bn_check_top() is as before. * - if BN_DEBUG *is* defined; * - bn_check_top() tries to pollute unused words even if the bignum 'top' is * consistent. (ed: only if BN_DEBUG_RAND is defined) * - bn_fix_top() maps to bn_check_top() rather than "fixing" anything. * The idea is to have debug builds flag up inconsistent bignums when they * occur. If that occurs in a bn_fix_top(), we examine the code in question; if * the use of bn_fix_top() was appropriate (ie. it follows directly after code * that manipulates the bignum) it is converted to bn_correct_top(), and if it * was not appropriate, we convert it permanently to bn_check_top() and track * down the cause of the bug. Eventually, no internal code should be using the * bn_fix_top() macro. External applications and libraries should try this with * their own code too, both in terms of building against the openssl headers * with BN_DEBUG defined *and* linking with a version of OpenSSL built with it * defined. This not only improves external code, it provides more test * coverage for openssl's own code. */ # ifdef BN_DEBUG /* We only need assert() when debugging */ # include <assert.h> /* * The new BN_FLG_FIXED_TOP flag marks vectors that were not treated with * bn_correct_top, in other words such vectors are permitted to have zeros * in most significant limbs. Such vectors are used internally to achieve * execution time invariance for critical operations with private keys. * It's BN_DEBUG-only flag, because user application is not supposed to * observe it anyway. Moreover, optimizing compiler would actually remove * all operations manipulating the bit in question in non-BN_DEBUG build. */ # define BN_FLG_FIXED_TOP 0x10000 # ifdef BN_DEBUG_RAND /* To avoid "make update" cvs wars due to BN_DEBUG, use some tricks */ # ifndef RAND_pseudo_bytes int RAND_pseudo_bytes(unsigned char *buf, int num); # define BN_DEBUG_TRIX # endif # define bn_pollute(a) \ do { \ const BIGNUM *_bnum1 = (a); \ if(_bnum1->top < _bnum1->dmax) { \ unsigned char _tmp_char; \ /* We cast away const without the compiler knowing, any \ * *genuinely* constant variables that aren't mutable \ * wouldn't be constructed with top!=dmax. */ \ BN_ULONG *_not_const; \ memcpy(&_not_const, &_bnum1->d, sizeof(BN_ULONG*)); \ /* Debug only - safe to ignore error return */ \ RAND_pseudo_bytes(&_tmp_char, 1); \ memset((unsigned char *)(_not_const + _bnum1->top), _tmp_char, \ (_bnum1->dmax - _bnum1->top) * sizeof(BN_ULONG)); \ } \ } while(0) # ifdef BN_DEBUG_TRIX # undef RAND_pseudo_bytes # endif # else # define bn_pollute(a) # endif # define bn_check_top(a) \ do { \ const BIGNUM *_bnum2 = (a); \ if (_bnum2 != NULL) { \ int _top = _bnum2->top; \ assert((_top == 0) || \ (_bnum2->flags & BN_FLG_FIXED_TOP) || \ (_bnum2->d[_top - 1] != 0)); \ bn_pollute(_bnum2); \ } \ } while(0) # define bn_fix_top(a) bn_check_top(a) # define bn_check_size(bn, bits) bn_wcheck_size(bn, ((bits+BN_BITS2-1))/BN_BITS2) # define bn_wcheck_size(bn, words) \ do { \ const BIGNUM *_bnum2 = (bn); \ assert((words) <= (_bnum2)->dmax && (words) >= (_bnum2)->top); \ /* avoid unused variable warning with NDEBUG */ \ (void)(_bnum2); \ } while(0) # else /* !BN_DEBUG */ # define BN_FLG_FIXED_TOP 0 # define bn_pollute(a) # define bn_check_top(a) # define bn_fix_top(a) bn_correct_top(a) # define bn_check_size(bn, bits) # define bn_wcheck_size(bn, words) # endif # define bn_correct_top(a) \ { \ BN_ULONG *ftl; \ int tmp_top = (a)->top; \ if (tmp_top > 0) \ { \ for (ftl= &((a)->d[tmp_top-1]); tmp_top > 0; tmp_top--) \ if (*(ftl--)) break; \ (a)->top = tmp_top; \ } \ if ((a)->top == 0) \ (a)->neg = 0; \ bn_pollute(a); \ } BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w); BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w); void bn_sqr_words(BN_ULONG *rp, const BN_ULONG *ap, int num); BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d); BN_ULONG bn_add_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, int num); BN_ULONG bn_sub_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, int num); /* Primes from RFC 2409 */ BIGNUM *get_rfc2409_prime_768(BIGNUM *bn); BIGNUM *get_rfc2409_prime_1024(BIGNUM *bn); /* Primes from RFC 3526 */ BIGNUM *get_rfc3526_prime_1536(BIGNUM *bn); BIGNUM *get_rfc3526_prime_2048(BIGNUM *bn); BIGNUM *get_rfc3526_prime_3072(BIGNUM *bn); BIGNUM *get_rfc3526_prime_4096(BIGNUM *bn); BIGNUM *get_rfc3526_prime_6144(BIGNUM *bn); BIGNUM *get_rfc3526_prime_8192(BIGNUM *bn); int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom); /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_BN_strings(void); /* Error codes for the BN functions. */ /* Function codes. */ # define BN_F_BNRAND 127 # define BN_F_BN_BLINDING_CONVERT_EX 100 # define BN_F_BN_BLINDING_CREATE_PARAM 128 # define BN_F_BN_BLINDING_INVERT_EX 101 # define BN_F_BN_BLINDING_NEW 102 # define BN_F_BN_BLINDING_UPDATE 103 # define BN_F_BN_BN2DEC 104 # define BN_F_BN_BN2HEX 105 # define BN_F_BN_CTX_GET 116 # define BN_F_BN_CTX_NEW 106 # define BN_F_BN_CTX_START 129 # define BN_F_BN_DIV 107 # define BN_F_BN_DIV_NO_BRANCH 138 # define BN_F_BN_DIV_RECP 130 # define BN_F_BN_EXP 123 # define BN_F_BN_EXPAND2 108 # define BN_F_BN_EXPAND_INTERNAL 120 # define BN_F_BN_GF2M_MOD 131 # define BN_F_BN_GF2M_MOD_EXP 132 # define BN_F_BN_GF2M_MOD_MUL 133 # define BN_F_BN_GF2M_MOD_SOLVE_QUAD 134 # define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR 135 # define BN_F_BN_GF2M_MOD_SQR 136 # define BN_F_BN_GF2M_MOD_SQRT 137 # define BN_F_BN_LSHIFT 145 # define BN_F_BN_MOD_EXP2_MONT 118 # define BN_F_BN_MOD_EXP_MONT 109 # define BN_F_BN_MOD_EXP_MONT_CONSTTIME 124 # define BN_F_BN_MOD_EXP_MONT_WORD 117 # define BN_F_BN_MOD_EXP_RECP 125 # define BN_F_BN_MOD_EXP_SIMPLE 126 # define BN_F_BN_MOD_INVERSE 110 # define BN_F_BN_MOD_INVERSE_NO_BRANCH 139 # define BN_F_BN_MOD_LSHIFT_QUICK 119 # define BN_F_BN_MOD_MUL_RECIPROCAL 111 # define BN_F_BN_MOD_SQRT 121 # define BN_F_BN_MPI2BN 112 # define BN_F_BN_NEW 113 # define BN_F_BN_RAND 114 # define BN_F_BN_RAND_RANGE 122 # define BN_F_BN_RSHIFT 146 # define BN_F_BN_USUB 115 /* Reason codes. */ # define BN_R_ARG2_LT_ARG3 100 # define BN_R_BAD_RECIPROCAL 101 # define BN_R_BIGNUM_TOO_LONG 114 # define BN_R_BITS_TOO_SMALL 118 # define BN_R_CALLED_WITH_EVEN_MODULUS 102 # define BN_R_DIV_BY_ZERO 103 # define BN_R_ENCODING_ERROR 104 # define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105 # define BN_R_INPUT_NOT_REDUCED 110 # define BN_R_INVALID_LENGTH 106 # define BN_R_INVALID_RANGE 115 # define BN_R_INVALID_SHIFT 119 # define BN_R_NOT_A_SQUARE 111 # define BN_R_NOT_INITIALIZED 107 # define BN_R_NO_INVERSE 108 # define BN_R_NO_SOLUTION 116 # define BN_R_P_IS_NOT_PRIME 112 # define BN_R_TOO_MANY_ITERATIONS 113 # define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109 #ifdef __cplusplus } #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/lhash.h�������������������������������������������������������������������������������������0000644�����������������00000022515�14763166030�0007512 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/lhash/lhash.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* * Header for dynamic hash table routines Author - Eric Young */ #ifndef HEADER_LHASH_H # define HEADER_LHASH_H # include <openssl/e_os2.h> # ifndef OPENSSL_NO_FP_API # include <stdio.h> # endif # ifndef OPENSSL_NO_BIO # include <openssl/bio.h> # endif #ifdef __cplusplus extern "C" { #endif typedef struct lhash_node_st { void *data; struct lhash_node_st *next; # ifndef OPENSSL_NO_HASH_COMP unsigned long hash; # endif } LHASH_NODE; typedef int (*LHASH_COMP_FN_TYPE) (const void *, const void *); typedef unsigned long (*LHASH_HASH_FN_TYPE) (const void *); typedef void (*LHASH_DOALL_FN_TYPE) (void *); typedef void (*LHASH_DOALL_ARG_FN_TYPE) (void *, void *); /* * Macros for declaring and implementing type-safe wrappers for LHASH * callbacks. This way, callbacks can be provided to LHASH structures without * function pointer casting and the macro-defined callbacks provide * per-variable casting before deferring to the underlying type-specific * callbacks. NB: It is possible to place a "static" in front of both the * DECLARE and IMPLEMENT macros if the functions are strictly internal. */ /* First: "hash" functions */ # define DECLARE_LHASH_HASH_FN(name, o_type) \ unsigned long name##_LHASH_HASH(const void *); # define IMPLEMENT_LHASH_HASH_FN(name, o_type) \ unsigned long name##_LHASH_HASH(const void *arg) { \ const o_type *a = arg; \ return name##_hash(a); } # define LHASH_HASH_FN(name) name##_LHASH_HASH /* Second: "compare" functions */ # define DECLARE_LHASH_COMP_FN(name, o_type) \ int name##_LHASH_COMP(const void *, const void *); # define IMPLEMENT_LHASH_COMP_FN(name, o_type) \ int name##_LHASH_COMP(const void *arg1, const void *arg2) { \ const o_type *a = arg1; \ const o_type *b = arg2; \ return name##_cmp(a,b); } # define LHASH_COMP_FN(name) name##_LHASH_COMP /* Third: "doall" functions */ # define DECLARE_LHASH_DOALL_FN(name, o_type) \ void name##_LHASH_DOALL(void *); # define IMPLEMENT_LHASH_DOALL_FN(name, o_type) \ void name##_LHASH_DOALL(void *arg) { \ o_type *a = arg; \ name##_doall(a); } # define LHASH_DOALL_FN(name) name##_LHASH_DOALL /* Fourth: "doall_arg" functions */ # define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ void name##_LHASH_DOALL_ARG(void *, void *); # define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ void name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \ o_type *a = arg1; \ a_type *b = arg2; \ name##_doall_arg(a, b); } # define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG typedef struct lhash_st { LHASH_NODE **b; LHASH_COMP_FN_TYPE comp; LHASH_HASH_FN_TYPE hash; unsigned int num_nodes; unsigned int num_alloc_nodes; unsigned int p; unsigned int pmax; unsigned long up_load; /* load times 256 */ unsigned long down_load; /* load times 256 */ unsigned long num_items; unsigned long num_expands; unsigned long num_expand_reallocs; unsigned long num_contracts; unsigned long num_contract_reallocs; unsigned long num_hash_calls; unsigned long num_comp_calls; unsigned long num_insert; unsigned long num_replace; unsigned long num_delete; unsigned long num_no_delete; unsigned long num_retrieve; unsigned long num_retrieve_miss; unsigned long num_hash_comps; int error; } _LHASH; /* Do not use _LHASH directly, use LHASH_OF * and friends */ # define LH_LOAD_MULT 256 /* * Indicates a malloc() error in the last call, this is only bad in * lh_insert(). */ # define lh_error(lh) ((lh)->error) _LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c); void lh_free(_LHASH *lh); void *lh_insert(_LHASH *lh, void *data); void *lh_delete(_LHASH *lh, const void *data); void *lh_retrieve(_LHASH *lh, const void *data); void lh_doall(_LHASH *lh, LHASH_DOALL_FN_TYPE func); void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg); unsigned long lh_strhash(const char *c); unsigned long lh_num_items(const _LHASH *lh); # ifndef OPENSSL_NO_FP_API void lh_stats(const _LHASH *lh, FILE *out); void lh_node_stats(const _LHASH *lh, FILE *out); void lh_node_usage_stats(const _LHASH *lh, FILE *out); # endif # ifndef OPENSSL_NO_BIO void lh_stats_bio(const _LHASH *lh, BIO *out); void lh_node_stats_bio(const _LHASH *lh, BIO *out); void lh_node_usage_stats_bio(const _LHASH *lh, BIO *out); # endif /* Type checking... */ # define LHASH_OF(type) struct lhash_st_##type # define DECLARE_LHASH_OF(type) LHASH_OF(type) { int dummy; } # define CHECKED_LHASH_OF(type,lh) \ ((_LHASH *)CHECKED_PTR_OF(LHASH_OF(type),lh)) /* Define wrapper functions. */ # define LHM_lh_new(type, name) \ ((LHASH_OF(type) *)lh_new(LHASH_HASH_FN(name), LHASH_COMP_FN(name))) # define LHM_lh_error(type, lh) \ lh_error(CHECKED_LHASH_OF(type,lh)) # define LHM_lh_insert(type, lh, inst) \ ((type *)lh_insert(CHECKED_LHASH_OF(type, lh), \ CHECKED_PTR_OF(type, inst))) # define LHM_lh_retrieve(type, lh, inst) \ ((type *)lh_retrieve(CHECKED_LHASH_OF(type, lh), \ CHECKED_PTR_OF(type, inst))) # define LHM_lh_delete(type, lh, inst) \ ((type *)lh_delete(CHECKED_LHASH_OF(type, lh), \ CHECKED_PTR_OF(type, inst))) # define LHM_lh_doall(type, lh,fn) lh_doall(CHECKED_LHASH_OF(type, lh), fn) # define LHM_lh_doall_arg(type, lh, fn, arg_type, arg) \ lh_doall_arg(CHECKED_LHASH_OF(type, lh), fn, CHECKED_PTR_OF(arg_type, arg)) # define LHM_lh_num_items(type, lh) lh_num_items(CHECKED_LHASH_OF(type, lh)) # define LHM_lh_down_load(type, lh) (CHECKED_LHASH_OF(type, lh)->down_load) # define LHM_lh_node_stats_bio(type, lh, out) \ lh_node_stats_bio(CHECKED_LHASH_OF(type, lh), out) # define LHM_lh_node_usage_stats_bio(type, lh, out) \ lh_node_usage_stats_bio(CHECKED_LHASH_OF(type, lh), out) # define LHM_lh_stats_bio(type, lh, out) \ lh_stats_bio(CHECKED_LHASH_OF(type, lh), out) # define LHM_lh_free(type, lh) lh_free(CHECKED_LHASH_OF(type, lh)) DECLARE_LHASH_OF(OPENSSL_STRING); DECLARE_LHASH_OF(OPENSSL_CSTRING); #ifdef __cplusplus } #endif #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/pkcs7.h�������������������������������������������������������������������������������������0000644�����������������00000050452�14763166030�0007443 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/pkcs7/pkcs7.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_PKCS7_H # define HEADER_PKCS7_H # include <openssl/asn1.h> # include <openssl/bio.h> # include <openssl/e_os2.h> # include <openssl/symhacks.h> # include <openssl/ossl_typ.h> #ifdef __cplusplus extern "C" { #endif # ifdef OPENSSL_SYS_WIN32 /* Under Win32 thes are defined in wincrypt.h */ # undef PKCS7_ISSUER_AND_SERIAL # undef PKCS7_SIGNER_INFO # endif /*- Encryption_ID DES-CBC Digest_ID MD5 Digest_Encryption_ID rsaEncryption Key_Encryption_ID rsaEncryption */ typedef struct pkcs7_issuer_and_serial_st { X509_NAME *issuer; ASN1_INTEGER *serial; } PKCS7_ISSUER_AND_SERIAL; typedef struct pkcs7_signer_info_st { ASN1_INTEGER *version; /* version 1 */ PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; X509_ALGOR *digest_alg; STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */ X509_ALGOR *digest_enc_alg; ASN1_OCTET_STRING *enc_digest; STACK_OF(X509_ATTRIBUTE) *unauth_attr; /* [ 1 ] */ /* The private key to sign with */ EVP_PKEY *pkey; } PKCS7_SIGNER_INFO; DECLARE_STACK_OF(PKCS7_SIGNER_INFO) DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) typedef struct pkcs7_recip_info_st { ASN1_INTEGER *version; /* version 0 */ PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; X509_ALGOR *key_enc_algor; ASN1_OCTET_STRING *enc_key; X509 *cert; /* get the pub-key from this */ } PKCS7_RECIP_INFO; DECLARE_STACK_OF(PKCS7_RECIP_INFO) DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO) typedef struct pkcs7_signed_st { ASN1_INTEGER *version; /* version 1 */ STACK_OF(X509_ALGOR) *md_algs; /* md used */ STACK_OF(X509) *cert; /* [ 0 ] */ STACK_OF(X509_CRL) *crl; /* [ 1 ] */ STACK_OF(PKCS7_SIGNER_INFO) *signer_info; struct pkcs7_st *contents; } PKCS7_SIGNED; /* * The above structure is very very similar to PKCS7_SIGN_ENVELOPE. How about * merging the two */ typedef struct pkcs7_enc_content_st { ASN1_OBJECT *content_type; X509_ALGOR *algorithm; ASN1_OCTET_STRING *enc_data; /* [ 0 ] */ const EVP_CIPHER *cipher; } PKCS7_ENC_CONTENT; typedef struct pkcs7_enveloped_st { ASN1_INTEGER *version; /* version 0 */ STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; PKCS7_ENC_CONTENT *enc_data; } PKCS7_ENVELOPE; typedef struct pkcs7_signedandenveloped_st { ASN1_INTEGER *version; /* version 1 */ STACK_OF(X509_ALGOR) *md_algs; /* md used */ STACK_OF(X509) *cert; /* [ 0 ] */ STACK_OF(X509_CRL) *crl; /* [ 1 ] */ STACK_OF(PKCS7_SIGNER_INFO) *signer_info; PKCS7_ENC_CONTENT *enc_data; STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; } PKCS7_SIGN_ENVELOPE; typedef struct pkcs7_digest_st { ASN1_INTEGER *version; /* version 0 */ X509_ALGOR *md; /* md used */ struct pkcs7_st *contents; ASN1_OCTET_STRING *digest; } PKCS7_DIGEST; typedef struct pkcs7_encrypted_st { ASN1_INTEGER *version; /* version 0 */ PKCS7_ENC_CONTENT *enc_data; } PKCS7_ENCRYPT; typedef struct pkcs7_st { /* * The following is non NULL if it contains ASN1 encoding of this * structure */ unsigned char *asn1; long length; # define PKCS7_S_HEADER 0 # define PKCS7_S_BODY 1 # define PKCS7_S_TAIL 2 int state; /* used during processing */ int detached; ASN1_OBJECT *type; /* content as defined by the type */ /* * all encryption/message digests are applied to the 'contents', leaving * out the 'type' field. */ union { char *ptr; /* NID_pkcs7_data */ ASN1_OCTET_STRING *data; /* NID_pkcs7_signed */ PKCS7_SIGNED *sign; /* NID_pkcs7_enveloped */ PKCS7_ENVELOPE *enveloped; /* NID_pkcs7_signedAndEnveloped */ PKCS7_SIGN_ENVELOPE *signed_and_enveloped; /* NID_pkcs7_digest */ PKCS7_DIGEST *digest; /* NID_pkcs7_encrypted */ PKCS7_ENCRYPT *encrypted; /* Anything else */ ASN1_TYPE *other; } d; } PKCS7; DECLARE_STACK_OF(PKCS7) DECLARE_ASN1_SET_OF(PKCS7) DECLARE_PKCS12_STACK_OF(PKCS7) # define PKCS7_OP_SET_DETACHED_SIGNATURE 1 # define PKCS7_OP_GET_DETACHED_SIGNATURE 2 # define PKCS7_get_signed_attributes(si) ((si)->auth_attr) # define PKCS7_get_attributes(si) ((si)->unauth_attr) # define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed) # define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted) # define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped) # define PKCS7_type_is_signedAndEnveloped(a) \ (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped) # define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_data) # define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_digest) # define PKCS7_set_detached(p,v) \ PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL) # define PKCS7_get_detached(p) \ PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL) # define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7)) /* S/MIME related flags */ # define PKCS7_TEXT 0x1 # define PKCS7_NOCERTS 0x2 # define PKCS7_NOSIGS 0x4 # define PKCS7_NOCHAIN 0x8 # define PKCS7_NOINTERN 0x10 # define PKCS7_NOVERIFY 0x20 # define PKCS7_DETACHED 0x40 # define PKCS7_BINARY 0x80 # define PKCS7_NOATTR 0x100 # define PKCS7_NOSMIMECAP 0x200 # define PKCS7_NOOLDMIMETYPE 0x400 # define PKCS7_CRLFEOL 0x800 # define PKCS7_STREAM 0x1000 # define PKCS7_NOCRL 0x2000 # define PKCS7_PARTIAL 0x4000 # define PKCS7_REUSE_DIGEST 0x8000 /* Flags: for compatibility with older code */ # define SMIME_TEXT PKCS7_TEXT # define SMIME_NOCERTS PKCS7_NOCERTS # define SMIME_NOSIGS PKCS7_NOSIGS # define SMIME_NOCHAIN PKCS7_NOCHAIN # define SMIME_NOINTERN PKCS7_NOINTERN # define SMIME_NOVERIFY PKCS7_NOVERIFY # define SMIME_DETACHED PKCS7_DETACHED # define SMIME_BINARY PKCS7_BINARY # define SMIME_NOATTR PKCS7_NOATTR DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL) int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data, const EVP_MD *type, unsigned char *md, unsigned int *len); # ifndef OPENSSL_NO_FP_API PKCS7 *d2i_PKCS7_fp(FILE *fp, PKCS7 **p7); int i2d_PKCS7_fp(FILE *fp, PKCS7 *p7); # endif PKCS7 *PKCS7_dup(PKCS7 *p7); PKCS7 *d2i_PKCS7_bio(BIO *bp, PKCS7 **p7); int i2d_PKCS7_bio(BIO *bp, PKCS7 *p7); int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO) DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO) DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNED) DECLARE_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT) DECLARE_ASN1_FUNCTIONS(PKCS7_ENVELOPE) DECLARE_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE) DECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST) DECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT) DECLARE_ASN1_FUNCTIONS(PKCS7) DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN) DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY) DECLARE_ASN1_NDEF_FUNCTION(PKCS7) DECLARE_ASN1_PRINT_FUNCTION(PKCS7) long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg); int PKCS7_set_type(PKCS7 *p7, int type); int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other); int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data); int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, const EVP_MD *dgst); int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si); int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i); int PKCS7_add_certificate(PKCS7 *p7, X509 *x509); int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509); int PKCS7_content_new(PKCS7 *p7, int nid); int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si); int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, X509 *x509); BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio); int PKCS7_dataFinal(PKCS7 *p7, BIO *bio); BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert); PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, EVP_PKEY *pkey, const EVP_MD *dgst); X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si); int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md); STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7); PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509); void PKCS7_SIGNER_INFO_get0_algs(PKCS7_SIGNER_INFO *si, EVP_PKEY **pk, X509_ALGOR **pdig, X509_ALGOR **psig); void PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO *ri, X509_ALGOR **penc); int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri); int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509); int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher); int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7); PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx); ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk); int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int type, void *data); int PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, void *value); ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid); ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid); int PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si, STACK_OF(X509_ATTRIBUTE) *sk); int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si, STACK_OF(X509_ATTRIBUTE) *sk); PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, BIO *data, int flags); PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, X509 *signcert, EVP_PKEY *pkey, const EVP_MD *md, int flags); int PKCS7_final(PKCS7 *p7, BIO *data, int flags); int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, BIO *indata, BIO *out, int flags); STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags); PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, int flags); int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags); int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, STACK_OF(X509_ALGOR) *cap); STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si); int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg); int PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid); int PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t); int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, const unsigned char *md, int mdlen); int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags); PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont); BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7); /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_PKCS7_strings(void); /* Error codes for the PKCS7 functions. */ /* Function codes. */ # define PKCS7_F_B64_READ_PKCS7 120 # define PKCS7_F_B64_WRITE_PKCS7 121 # define PKCS7_F_DO_PKCS7_SIGNED_ATTRIB 136 # define PKCS7_F_I2D_PKCS7_BIO_STREAM 140 # define PKCS7_F_PKCS7_ADD0_ATTRIB_SIGNING_TIME 135 # define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP 118 # define PKCS7_F_PKCS7_ADD_CERTIFICATE 100 # define PKCS7_F_PKCS7_ADD_CRL 101 # define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102 # define PKCS7_F_PKCS7_ADD_SIGNATURE 131 # define PKCS7_F_PKCS7_ADD_SIGNER 103 # define PKCS7_F_PKCS7_BIO_ADD_DIGEST 125 # define PKCS7_F_PKCS7_COPY_EXISTING_DIGEST 138 # define PKCS7_F_PKCS7_CTRL 104 # define PKCS7_F_PKCS7_DATADECODE 112 # define PKCS7_F_PKCS7_DATAFINAL 128 # define PKCS7_F_PKCS7_DATAINIT 105 # define PKCS7_F_PKCS7_DATASIGN 106 # define PKCS7_F_PKCS7_DATAVERIFY 107 # define PKCS7_F_PKCS7_DECRYPT 114 # define PKCS7_F_PKCS7_DECRYPT_RINFO 133 # define PKCS7_F_PKCS7_ENCODE_RINFO 132 # define PKCS7_F_PKCS7_ENCRYPT 115 # define PKCS7_F_PKCS7_FINAL 134 # define PKCS7_F_PKCS7_FIND_DIGEST 127 # define PKCS7_F_PKCS7_GET0_SIGNERS 124 # define PKCS7_F_PKCS7_RECIP_INFO_SET 130 # define PKCS7_F_PKCS7_SET_CIPHER 108 # define PKCS7_F_PKCS7_SET_CONTENT 109 # define PKCS7_F_PKCS7_SET_DIGEST 126 # define PKCS7_F_PKCS7_SET_TYPE 110 # define PKCS7_F_PKCS7_SIGN 116 # define PKCS7_F_PKCS7_SIGNATUREVERIFY 113 # define PKCS7_F_PKCS7_SIGNER_INFO_SET 129 # define PKCS7_F_PKCS7_SIGNER_INFO_SIGN 139 # define PKCS7_F_PKCS7_SIGN_ADD_SIGNER 137 # define PKCS7_F_PKCS7_SIMPLE_SMIMECAP 119 # define PKCS7_F_PKCS7_VERIFY 117 # define PKCS7_F_SMIME_READ_PKCS7 122 # define PKCS7_F_SMIME_TEXT 123 /* Reason codes. */ # define PKCS7_R_CERTIFICATE_VERIFY_ERROR 117 # define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144 # define PKCS7_R_CIPHER_NOT_INITIALIZED 116 # define PKCS7_R_CONTENT_AND_DATA_PRESENT 118 # define PKCS7_R_CTRL_ERROR 152 # define PKCS7_R_DECODE_ERROR 130 # define PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH 100 # define PKCS7_R_DECRYPT_ERROR 119 # define PKCS7_R_DIGEST_FAILURE 101 # define PKCS7_R_ENCRYPTION_CTRL_FAILURE 149 # define PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 150 # define PKCS7_R_ERROR_ADDING_RECIPIENT 120 # define PKCS7_R_ERROR_SETTING_CIPHER 121 # define PKCS7_R_INVALID_MIME_TYPE 131 # define PKCS7_R_INVALID_NULL_POINTER 143 # define PKCS7_R_INVALID_SIGNED_DATA_TYPE 155 # define PKCS7_R_MIME_NO_CONTENT_TYPE 132 # define PKCS7_R_MIME_PARSE_ERROR 133 # define PKCS7_R_MIME_SIG_PARSE_ERROR 134 # define PKCS7_R_MISSING_CERIPEND_INFO 103 # define PKCS7_R_NO_CONTENT 122 # define PKCS7_R_NO_CONTENT_TYPE 135 # define PKCS7_R_NO_DEFAULT_DIGEST 151 # define PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND 154 # define PKCS7_R_NO_MULTIPART_BODY_FAILURE 136 # define PKCS7_R_NO_MULTIPART_BOUNDARY 137 # define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115 # define PKCS7_R_NO_RECIPIENT_MATCHES_KEY 146 # define PKCS7_R_NO_SIGNATURES_ON_DATA 123 # define PKCS7_R_NO_SIGNERS 142 # define PKCS7_R_NO_SIG_CONTENT_TYPE 138 # define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104 # define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124 # define PKCS7_R_PKCS7_ADD_SIGNER_ERROR 153 # define PKCS7_R_PKCS7_DATAFINAL 126 # define PKCS7_R_PKCS7_DATAFINAL_ERROR 125 # define PKCS7_R_PKCS7_DATASIGN 145 # define PKCS7_R_PKCS7_PARSE_ERROR 139 # define PKCS7_R_PKCS7_SIG_PARSE_ERROR 140 # define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127 # define PKCS7_R_SIGNATURE_FAILURE 105 # define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128 # define PKCS7_R_SIGNING_CTRL_FAILURE 147 # define PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 148 # define PKCS7_R_SIG_INVALID_MIME_TYPE 141 # define PKCS7_R_SMIME_TEXT_ERROR 129 # define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106 # define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 107 # define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 108 # define PKCS7_R_UNKNOWN_DIGEST_TYPE 109 # define PKCS7_R_UNKNOWN_OPERATION 110 # define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 111 # define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 112 # define PKCS7_R_WRONG_CONTENT_TYPE 113 # define PKCS7_R_WRONG_PKCS7_TYPE 114 #ifdef __cplusplus } #endif #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/opensslv.h����������������������������������������������������������������������������������0000644�����������������00000007546�14763166030�0010273 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef HEADER_OPENSSLV_H # define HEADER_OPENSSLV_H #ifdef __cplusplus extern "C" { #endif /*- * Numeric release version identifier: * MNNFFPPS: major minor fix patch status * The status nibble has one of the values 0 for development, 1 to e for betas * 1 to 14, and f for release. The patch level is exactly that. * For example: * 0.9.3-dev 0x00903000 * 0.9.3-beta1 0x00903001 * 0.9.3-beta2-dev 0x00903002 * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) * 0.9.3 0x0090300f * 0.9.3a 0x0090301f * 0.9.4 0x0090400f * 1.2.3z 0x102031af * * For continuity reasons (because 0.9.5 is already out, and is coded * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level * part is slightly different, by setting the highest bit. This means * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start * with 0x0090600S... * * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for * major minor fix final patch/beta) */ # define OPENSSL_VERSION_NUMBER 0x100020bfL # ifdef OPENSSL_FIPS # define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2k-fips 26 Jan 2017" # else # define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2k 26 Jan 2017" # endif # define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT /*- * The macros below are to be used for shared library (.so, .dll, ...) * versioning. That kind of versioning works a bit differently between * operating systems. The most usual scheme is to set a major and a minor * number, and have the runtime loader check that the major number is equal * to what it was at application link time, while the minor number has to * be greater or equal to what it was at application link time. With this * scheme, the version number is usually part of the file name, like this: * * libcrypto.so.0.9 * * Some unixen also make a softlink with the major verson number only: * * libcrypto.so.0 * * On Tru64 and IRIX 6.x it works a little bit differently. There, the * shared library version is stored in the file, and is actually a series * of versions, separated by colons. The rightmost version present in the * library when linking an application is stored in the application to be * matched at run time. When the application is run, a check is done to * see if the library version stored in the application matches any of the * versions in the version string of the library itself. * This version string can be constructed in any way, depending on what * kind of matching is desired. However, to implement the same scheme as * the one used in the other unixen, all compatible versions, from lowest * to highest, should be part of the string. Consecutive builds would * give the following versions strings: * * 3.0 * 3.0:3.1 * 3.0:3.1:3.2 * 4.0 * 4.0:4.1 * * Notice how version 4 is completely incompatible with version, and * therefore give the breach you can see. * * There may be other schemes as well that I haven't yet discovered. * * So, here's the way it works here: first of all, the library version * number doesn't need at all to match the overall OpenSSL version. * However, it's nice and more understandable if it actually does. * The current library version is stored in the macro SHLIB_VERSION_NUMBER, * which is just a piece of text in the format "M.m.e" (Major, minor, edit). * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, * we need to keep a history of version numbers, which is done in the * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and * should only keep the versions that are binary compatible with the current. */ # define SHLIB_VERSION_HISTORY "" # define SHLIB_VERSION_NUMBER "1.0.2k" #ifdef __cplusplus } #endif #endif /* HEADER_OPENSSLV_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������openssl/md5.h���������������������������������������������������������������������������������������0000644�����������������00000011261�14763166030�0007074 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/md5/md5.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_MD5_H # define HEADER_MD5_H # include <openssl/e_os2.h> # include <stddef.h> #ifdef __cplusplus extern "C" { #endif # ifdef OPENSSL_NO_MD5 # error MD5 is disabled. # endif /* * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * ! MD5_LONG has to be at least 32 bits wide. If it's wider, then ! * ! MD5_LONG_LOG2 has to be defined along. ! * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ # if defined(__LP32__) # define MD5_LONG unsigned long # elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) # define MD5_LONG unsigned long # define MD5_LONG_LOG2 3 /* * _CRAY note. I could declare short, but I have no idea what impact * does it have on performance on none-T3E machines. I could declare * int, but at least on C90 sizeof(int) can be chosen at compile time. * So I've chosen long... * <appro@fy.chalmers.se> */ # else # define MD5_LONG unsigned int # endif # define MD5_CBLOCK 64 # define MD5_LBLOCK (MD5_CBLOCK/4) # define MD5_DIGEST_LENGTH 16 typedef struct MD5state_st { MD5_LONG A, B, C, D; MD5_LONG Nl, Nh; MD5_LONG data[MD5_LBLOCK]; unsigned int num; } MD5_CTX; # ifdef OPENSSL_FIPS int private_MD5_Init(MD5_CTX *c); # endif int MD5_Init(MD5_CTX *c); int MD5_Update(MD5_CTX *c, const void *data, size_t len); int MD5_Final(unsigned char *md, MD5_CTX *c); unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); void MD5_Transform(MD5_CTX *c, const unsigned char *b); #ifdef __cplusplus } #endif #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/krb5_asn.h����������������������������������������������������������������������������������0000644�����������������00000017745�14763166030�0010130 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* krb5_asn.h */ /* * Written by Vern Staats <staatsvr@asc.hpc.mil> for the OpenSSL project, ** * using ocsp/{*.h,*asn*.c} as a starting point */ /* ==================================================================== * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_KRB5_ASN_H # define HEADER_KRB5_ASN_H /* * #include <krb5.h> */ # include <openssl/safestack.h> #ifdef __cplusplus extern "C" { #endif /* * ASN.1 from Kerberos RFC 1510 */ /*- EncryptedData ::= SEQUENCE { * etype[0] INTEGER, -- EncryptionType * kvno[1] INTEGER OPTIONAL, * cipher[2] OCTET STRING -- ciphertext * } */ typedef struct krb5_encdata_st { ASN1_INTEGER *etype; ASN1_INTEGER *kvno; ASN1_OCTET_STRING *cipher; } KRB5_ENCDATA; DECLARE_STACK_OF(KRB5_ENCDATA) /*- PrincipalName ::= SEQUENCE { * name-type[0] INTEGER, * name-string[1] SEQUENCE OF GeneralString * } */ typedef struct krb5_princname_st { ASN1_INTEGER *nametype; STACK_OF(ASN1_GENERALSTRING) *namestring; } KRB5_PRINCNAME; DECLARE_STACK_OF(KRB5_PRINCNAME) /*- Ticket ::= [APPLICATION 1] SEQUENCE { * tkt-vno[0] INTEGER, * realm[1] Realm, * sname[2] PrincipalName, * enc-part[3] EncryptedData * } */ typedef struct krb5_tktbody_st { ASN1_INTEGER *tktvno; ASN1_GENERALSTRING *realm; KRB5_PRINCNAME *sname; KRB5_ENCDATA *encdata; } KRB5_TKTBODY; typedef STACK_OF(KRB5_TKTBODY) KRB5_TICKET; DECLARE_STACK_OF(KRB5_TKTBODY) /*- AP-REQ ::= [APPLICATION 14] SEQUENCE { * pvno[0] INTEGER, * msg-type[1] INTEGER, * ap-options[2] APOptions, * ticket[3] Ticket, * authenticator[4] EncryptedData * } * * APOptions ::= BIT STRING { * reserved(0), use-session-key(1), mutual-required(2) } */ typedef struct krb5_ap_req_st { ASN1_INTEGER *pvno; ASN1_INTEGER *msgtype; ASN1_BIT_STRING *apoptions; KRB5_TICKET *ticket; KRB5_ENCDATA *authenticator; } KRB5_APREQBODY; typedef STACK_OF(KRB5_APREQBODY) KRB5_APREQ; DECLARE_STACK_OF(KRB5_APREQBODY) /* Authenticator Stuff */ /*- Checksum ::= SEQUENCE { * cksumtype[0] INTEGER, * checksum[1] OCTET STRING * } */ typedef struct krb5_checksum_st { ASN1_INTEGER *ctype; ASN1_OCTET_STRING *checksum; } KRB5_CHECKSUM; DECLARE_STACK_OF(KRB5_CHECKSUM) /*- EncryptionKey ::= SEQUENCE { * keytype[0] INTEGER, * keyvalue[1] OCTET STRING * } */ typedef struct krb5_encryptionkey_st { ASN1_INTEGER *ktype; ASN1_OCTET_STRING *keyvalue; } KRB5_ENCKEY; DECLARE_STACK_OF(KRB5_ENCKEY) /*- AuthorizationData ::= SEQUENCE OF SEQUENCE { * ad-type[0] INTEGER, * ad-data[1] OCTET STRING * } */ typedef struct krb5_authorization_st { ASN1_INTEGER *adtype; ASN1_OCTET_STRING *addata; } KRB5_AUTHDATA; DECLARE_STACK_OF(KRB5_AUTHDATA) /*- -- Unencrypted authenticator * Authenticator ::= [APPLICATION 2] SEQUENCE { * authenticator-vno[0] INTEGER, * crealm[1] Realm, * cname[2] PrincipalName, * cksum[3] Checksum OPTIONAL, * cusec[4] INTEGER, * ctime[5] KerberosTime, * subkey[6] EncryptionKey OPTIONAL, * seq-number[7] INTEGER OPTIONAL, * authorization-data[8] AuthorizationData OPTIONAL * } */ typedef struct krb5_authenticator_st { ASN1_INTEGER *avno; ASN1_GENERALSTRING *crealm; KRB5_PRINCNAME *cname; KRB5_CHECKSUM *cksum; ASN1_INTEGER *cusec; ASN1_GENERALIZEDTIME *ctime; KRB5_ENCKEY *subkey; ASN1_INTEGER *seqnum; KRB5_AUTHDATA *authorization; } KRB5_AUTHENTBODY; typedef STACK_OF(KRB5_AUTHENTBODY) KRB5_AUTHENT; DECLARE_STACK_OF(KRB5_AUTHENTBODY) /*- DECLARE_ASN1_FUNCTIONS(type) = DECLARE_ASN1_FUNCTIONS_name(type, type) = * type *name##_new(void); * void name##_free(type *a); * DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) = * DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) = * type *d2i_##name(type **a, const unsigned char **in, long len); * int i2d_##name(type *a, unsigned char **out); * DECLARE_ASN1_ITEM(itname) = OPENSSL_EXTERN const ASN1_ITEM itname##_it */ DECLARE_ASN1_FUNCTIONS(KRB5_ENCDATA) DECLARE_ASN1_FUNCTIONS(KRB5_PRINCNAME) DECLARE_ASN1_FUNCTIONS(KRB5_TKTBODY) DECLARE_ASN1_FUNCTIONS(KRB5_APREQBODY) DECLARE_ASN1_FUNCTIONS(KRB5_TICKET) DECLARE_ASN1_FUNCTIONS(KRB5_APREQ) DECLARE_ASN1_FUNCTIONS(KRB5_CHECKSUM) DECLARE_ASN1_FUNCTIONS(KRB5_ENCKEY) DECLARE_ASN1_FUNCTIONS(KRB5_AUTHDATA) DECLARE_ASN1_FUNCTIONS(KRB5_AUTHENTBODY) DECLARE_ASN1_FUNCTIONS(KRB5_AUTHENT) /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ #ifdef __cplusplus } #endif #endif ���������������������������openssl/ecdh.h��������������������������������������������������������������������������������������0000644�����������������00000012107�14763166030�0007312 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/ecdh/ecdh.h */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * * The Elliptic Curve Public-Key Crypto Library (ECC Code) included * herein is developed by SUN MICROSYSTEMS, INC., and is contributed * to the OpenSSL project. * * The ECC Code is licensed pursuant to the OpenSSL open source * license provided below. * * The ECDH software is originally written by Douglas Stebila of * Sun Microsystems Laboratories. * */ /* ==================================================================== * Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * licensing@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_ECDH_H # define HEADER_ECDH_H # include <openssl/opensslconf.h> # ifdef OPENSSL_NO_ECDH # error ECDH is disabled. # endif # include <openssl/ec.h> # include <openssl/ossl_typ.h> # ifndef OPENSSL_NO_DEPRECATED # include <openssl/bn.h> # endif #ifdef __cplusplus extern "C" { #endif # define EC_FLAG_COFACTOR_ECDH 0x1000 const ECDH_METHOD *ECDH_OpenSSL(void); void ECDH_set_default_method(const ECDH_METHOD *); const ECDH_METHOD *ECDH_get_default_method(void); int ECDH_set_method(EC_KEY *, const ECDH_METHOD *); int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh, void *(*KDF) (const void *in, size_t inlen, void *out, size_t *outlen)); int ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int ECDH_set_ex_data(EC_KEY *d, int idx, void *arg); void *ECDH_get_ex_data(EC_KEY *d, int idx); int ECDH_KDF_X9_62(unsigned char *out, size_t outlen, const unsigned char *Z, size_t Zlen, const unsigned char *sinfo, size_t sinfolen, const EVP_MD *md); /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_ECDH_strings(void); /* Error codes for the ECDH functions. */ /* Function codes. */ # define ECDH_F_ECDH_CHECK 102 # define ECDH_F_ECDH_COMPUTE_KEY 100 # define ECDH_F_ECDH_DATA_NEW_METHOD 101 /* Reason codes. */ # define ECDH_R_KDF_FAILED 102 # define ECDH_R_NON_FIPS_METHOD 103 # define ECDH_R_NO_PRIVATE_VALUE 100 # define ECDH_R_POINT_ARITHMETIC_FAILURE 101 #ifdef __cplusplus } #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/rand.h��������������������������������������������������������������������������������������0000644�����������������00000015350�14763166030�0007336 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/rand/rand.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_RAND_H # define HEADER_RAND_H # include <stdlib.h> # include <openssl/ossl_typ.h> # include <openssl/e_os2.h> # if defined(OPENSSL_SYS_WINDOWS) # include <windows.h> # endif #ifdef __cplusplus extern "C" { #endif # if defined(OPENSSL_FIPS) # define FIPS_RAND_SIZE_T size_t # endif /* Already defined in ossl_typ.h */ /* typedef struct rand_meth_st RAND_METHOD; */ struct rand_meth_st { void (*seed) (const void *buf, int num); int (*bytes) (unsigned char *buf, int num); void (*cleanup) (void); void (*add) (const void *buf, int num, double entropy); int (*pseudorand) (unsigned char *buf, int num); int (*status) (void); }; # ifdef BN_DEBUG extern int rand_predictable; # endif int RAND_set_rand_method(const RAND_METHOD *meth); const RAND_METHOD *RAND_get_rand_method(void); # ifndef OPENSSL_NO_ENGINE int RAND_set_rand_engine(ENGINE *engine); # endif RAND_METHOD *RAND_SSLeay(void); void RAND_cleanup(void); int RAND_bytes(unsigned char *buf, int num); int RAND_pseudo_bytes(unsigned char *buf, int num); void RAND_seed(const void *buf, int num); void RAND_add(const void *buf, int num, double entropy); int RAND_load_file(const char *file, long max_bytes); int RAND_write_file(const char *file); const char *RAND_file_name(char *file, size_t num); int RAND_status(void); int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes); int RAND_egd(const char *path); int RAND_egd_bytes(const char *path, int bytes); int RAND_poll(void); # if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) void RAND_screen(void); int RAND_event(UINT, WPARAM, LPARAM); # endif # ifdef OPENSSL_FIPS void RAND_set_fips_drbg_type(int type, int flags); int RAND_init_fips(void); # endif /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_RAND_strings(void); /* Error codes for the RAND functions. */ /* Function codes. */ # define RAND_F_ENG_RAND_GET_RAND_METHOD 108 # define RAND_F_FIPS_RAND 103 # define RAND_F_FIPS_RAND_BYTES 102 # define RAND_F_FIPS_RAND_SET_DT 106 # define RAND_F_FIPS_X931_SET_DT 106 # define RAND_F_FIPS_SET_DT 104 # define RAND_F_FIPS_SET_PRNG_SEED 107 # define RAND_F_FIPS_SET_TEST_MODE 105 # define RAND_F_RAND_GET_RAND_METHOD 101 # define RAND_F_RAND_INIT_FIPS 109 # define RAND_F_SSLEAY_RAND_BYTES 100 /* Reason codes. */ # define RAND_R_DUAL_EC_DRBG_DISABLED 114 # define RAND_R_ERROR_INITIALISING_DRBG 112 # define RAND_R_ERROR_INSTANTIATING_DRBG 113 # define RAND_R_NON_FIPS_METHOD 105 # define RAND_R_NOT_IN_TEST_MODE 106 # define RAND_R_NO_FIPS_RANDOM_METHOD_SET 111 # define RAND_R_NO_KEY_SET 107 # define RAND_R_PRNG_ASKING_FOR_TOO_MUCH 101 # define RAND_R_PRNG_ERROR 108 # define RAND_R_PRNG_KEYED 109 # define RAND_R_PRNG_NOT_REKEYED 102 # define RAND_R_PRNG_NOT_RESEEDED 103 # define RAND_R_PRNG_NOT_SEEDED 100 # define RAND_R_PRNG_SEED_MUST_NOT_MATCH_KEY 110 # define RAND_R_PRNG_STUCK 104 #ifdef __cplusplus } #endif #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/asn1.h��������������������������������������������������������������������������������������0000644�����������������00000173540�14763166030�0007262 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/asn1/asn1.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_ASN1_H # define HEADER_ASN1_H # include <time.h> # include <openssl/e_os2.h> # ifndef OPENSSL_NO_BIO # include <openssl/bio.h> # endif # include <openssl/stack.h> # include <openssl/safestack.h> # include <openssl/symhacks.h> # include <openssl/ossl_typ.h> # ifndef OPENSSL_NO_DEPRECATED # include <openssl/bn.h> # endif # ifdef OPENSSL_BUILD_SHLIBCRYPTO # undef OPENSSL_EXTERN # define OPENSSL_EXTERN OPENSSL_EXPORT # endif #ifdef __cplusplus extern "C" { #endif # define V_ASN1_UNIVERSAL 0x00 # define V_ASN1_APPLICATION 0x40 # define V_ASN1_CONTEXT_SPECIFIC 0x80 # define V_ASN1_PRIVATE 0xc0 # define V_ASN1_CONSTRUCTED 0x20 # define V_ASN1_PRIMITIVE_TAG 0x1f # define V_ASN1_PRIMATIVE_TAG 0x1f # define V_ASN1_APP_CHOOSE -2/* let the recipient choose */ # define V_ASN1_OTHER -3/* used in ASN1_TYPE */ # define V_ASN1_ANY -4/* used in ASN1 template code */ # define V_ASN1_NEG 0x100/* negative flag */ # define V_ASN1_UNDEF -1 # define V_ASN1_EOC 0 # define V_ASN1_BOOLEAN 1 /**/ # define V_ASN1_INTEGER 2 # define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG) # define V_ASN1_BIT_STRING 3 # define V_ASN1_OCTET_STRING 4 # define V_ASN1_NULL 5 # define V_ASN1_OBJECT 6 # define V_ASN1_OBJECT_DESCRIPTOR 7 # define V_ASN1_EXTERNAL 8 # define V_ASN1_REAL 9 # define V_ASN1_ENUMERATED 10 # define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG) # define V_ASN1_UTF8STRING 12 # define V_ASN1_SEQUENCE 16 # define V_ASN1_SET 17 # define V_ASN1_NUMERICSTRING 18 /**/ # define V_ASN1_PRINTABLESTRING 19 # define V_ASN1_T61STRING 20 # define V_ASN1_TELETEXSTRING 20/* alias */ # define V_ASN1_VIDEOTEXSTRING 21 /**/ # define V_ASN1_IA5STRING 22 # define V_ASN1_UTCTIME 23 # define V_ASN1_GENERALIZEDTIME 24 /**/ # define V_ASN1_GRAPHICSTRING 25 /**/ # define V_ASN1_ISO64STRING 26 /**/ # define V_ASN1_VISIBLESTRING 26/* alias */ # define V_ASN1_GENERALSTRING 27 /**/ # define V_ASN1_UNIVERSALSTRING 28 /**/ # define V_ASN1_BMPSTRING 30 /* For use with d2i_ASN1_type_bytes() */ # define B_ASN1_NUMERICSTRING 0x0001 # define B_ASN1_PRINTABLESTRING 0x0002 # define B_ASN1_T61STRING 0x0004 # define B_ASN1_TELETEXSTRING 0x0004 # define B_ASN1_VIDEOTEXSTRING 0x0008 # define B_ASN1_IA5STRING 0x0010 # define B_ASN1_GRAPHICSTRING 0x0020 # define B_ASN1_ISO64STRING 0x0040 # define B_ASN1_VISIBLESTRING 0x0040 # define B_ASN1_GENERALSTRING 0x0080 # define B_ASN1_UNIVERSALSTRING 0x0100 # define B_ASN1_OCTET_STRING 0x0200 # define B_ASN1_BIT_STRING 0x0400 # define B_ASN1_BMPSTRING 0x0800 # define B_ASN1_UNKNOWN 0x1000 # define B_ASN1_UTF8STRING 0x2000 # define B_ASN1_UTCTIME 0x4000 # define B_ASN1_GENERALIZEDTIME 0x8000 # define B_ASN1_SEQUENCE 0x10000 /* For use with ASN1_mbstring_copy() */ # define MBSTRING_FLAG 0x1000 # define MBSTRING_UTF8 (MBSTRING_FLAG) # define MBSTRING_ASC (MBSTRING_FLAG|1) # define MBSTRING_BMP (MBSTRING_FLAG|2) # define MBSTRING_UNIV (MBSTRING_FLAG|4) # define SMIME_OLDMIME 0x400 # define SMIME_CRLFEOL 0x800 # define SMIME_STREAM 0x1000 struct X509_algor_st; DECLARE_STACK_OF(X509_ALGOR) # define DECLARE_ASN1_SET_OF(type)/* filled in by mkstack.pl */ # define IMPLEMENT_ASN1_SET_OF(type)/* nothing, no longer needed */ /* * We MUST make sure that, except for constness, asn1_ctx_st and * asn1_const_ctx are exactly the same. Fortunately, as soon as the old ASN1 * parsing macros are gone, we can throw this away as well... */ typedef struct asn1_ctx_st { unsigned char *p; /* work char pointer */ int eos; /* end of sequence read for indefinite * encoding */ int error; /* error code to use when returning an error */ int inf; /* constructed if 0x20, indefinite is 0x21 */ int tag; /* tag from last 'get object' */ int xclass; /* class from last 'get object' */ long slen; /* length of last 'get object' */ unsigned char *max; /* largest value of p allowed */ unsigned char *q; /* temporary variable */ unsigned char **pp; /* variable */ int line; /* used in error processing */ } ASN1_CTX; typedef struct asn1_const_ctx_st { const unsigned char *p; /* work char pointer */ int eos; /* end of sequence read for indefinite * encoding */ int error; /* error code to use when returning an error */ int inf; /* constructed if 0x20, indefinite is 0x21 */ int tag; /* tag from last 'get object' */ int xclass; /* class from last 'get object' */ long slen; /* length of last 'get object' */ const unsigned char *max; /* largest value of p allowed */ const unsigned char *q; /* temporary variable */ const unsigned char **pp; /* variable */ int line; /* used in error processing */ } ASN1_const_CTX; /* * These are used internally in the ASN1_OBJECT to keep track of whether the * names and data need to be free()ed */ # define ASN1_OBJECT_FLAG_DYNAMIC 0x01/* internal use */ # define ASN1_OBJECT_FLAG_CRITICAL 0x02/* critical x509v3 object id */ # define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04/* internal use */ # define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08/* internal use */ struct asn1_object_st { const char *sn, *ln; int nid; int length; const unsigned char *data; /* data remains const after init */ int flags; /* Should we free this one */ }; # define ASN1_STRING_FLAG_BITS_LEFT 0x08/* Set if 0x07 has bits left value */ /* * This indicates that the ASN1_STRING is not a real value but just a place * holder for the location where indefinite length constructed data should be * inserted in the memory buffer */ # define ASN1_STRING_FLAG_NDEF 0x010 /* * This flag is used by the CMS code to indicate that a string is not * complete and is a place holder for content when it had all been accessed. * The flag will be reset when content has been written to it. */ # define ASN1_STRING_FLAG_CONT 0x020 /* * This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING * type. */ # define ASN1_STRING_FLAG_MSTRING 0x040 /* This is the base type that holds just about everything :-) */ struct asn1_string_st { int length; int type; unsigned char *data; /* * The value of the following field depends on the type being held. It * is mostly being used for BIT_STRING so if the input data has a * non-zero 'unused bits' value, it will be handled correctly */ long flags; }; /* * ASN1_ENCODING structure: this is used to save the received encoding of an * ASN1 type. This is useful to get round problems with invalid encodings * which can break signatures. */ typedef struct ASN1_ENCODING_st { unsigned char *enc; /* DER encoding */ long len; /* Length of encoding */ int modified; /* set to 1 if 'enc' is invalid */ } ASN1_ENCODING; /* Used with ASN1 LONG type: if a long is set to this it is omitted */ # define ASN1_LONG_UNDEF 0x7fffffffL # define STABLE_FLAGS_MALLOC 0x01 # define STABLE_NO_MASK 0x02 # define DIRSTRING_TYPE \ (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING) # define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING) typedef struct asn1_string_table_st { int nid; long minsize; long maxsize; unsigned long mask; unsigned long flags; } ASN1_STRING_TABLE; DECLARE_STACK_OF(ASN1_STRING_TABLE) /* size limits: this stuff is taken straight from RFC2459 */ # define ub_name 32768 # define ub_common_name 64 # define ub_locality_name 128 # define ub_state_name 128 # define ub_organization_name 64 # define ub_organization_unit_name 64 # define ub_title 64 # define ub_email_address 128 /* * Declarations for template structures: for full definitions see asn1t.h */ typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE; typedef struct ASN1_TLC_st ASN1_TLC; /* This is just an opaque pointer */ typedef struct ASN1_VALUE_st ASN1_VALUE; /* Declare ASN1 functions: the implement macro in in asn1t.h */ # define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) # define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \ DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type) # define DECLARE_ASN1_FUNCTIONS_name(type, name) \ DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) # define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) # define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ type *d2i_##name(type **a, const unsigned char **in, long len); \ int i2d_##name(type *a, unsigned char **out); \ DECLARE_ASN1_ITEM(itname) # define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ type *d2i_##name(type **a, const unsigned char **in, long len); \ int i2d_##name(const type *a, unsigned char **out); \ DECLARE_ASN1_ITEM(name) # define DECLARE_ASN1_NDEF_FUNCTION(name) \ int i2d_##name##_NDEF(name *a, unsigned char **out); # define DECLARE_ASN1_FUNCTIONS_const(name) \ DECLARE_ASN1_ALLOC_FUNCTIONS(name) \ DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name) # define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ type *name##_new(void); \ void name##_free(type *a); # define DECLARE_ASN1_PRINT_FUNCTION(stname) \ DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname) # define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \ int fname##_print_ctx(BIO *out, stname *x, int indent, \ const ASN1_PCTX *pctx); # define D2I_OF(type) type *(*)(type **,const unsigned char **,long) # define I2D_OF(type) int (*)(type *,unsigned char **) # define I2D_OF_const(type) int (*)(const type *,unsigned char **) # define CHECKED_D2I_OF(type, d2i) \ ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0))) # define CHECKED_I2D_OF(type, i2d) \ ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0))) # define CHECKED_NEW_OF(type, xnew) \ ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0))) # define CHECKED_PTR_OF(type, p) \ ((void*) (1 ? p : (type*)0)) # define CHECKED_PPTR_OF(type, p) \ ((void**) (1 ? p : (type**)0)) # define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long) # define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **) # define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type) TYPEDEF_D2I2D_OF(void); /*- * The following macros and typedefs allow an ASN1_ITEM * to be embedded in a structure and referenced. Since * the ASN1_ITEM pointers need to be globally accessible * (possibly from shared libraries) they may exist in * different forms. On platforms that support it the * ASN1_ITEM structure itself will be globally exported. * Other platforms will export a function that returns * an ASN1_ITEM pointer. * * To handle both cases transparently the macros below * should be used instead of hard coding an ASN1_ITEM * pointer in a structure. * * The structure will look like this: * * typedef struct SOMETHING_st { * ... * ASN1_ITEM_EXP *iptr; * ... * } SOMETHING; * * It would be initialised as e.g.: * * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...}; * * and the actual pointer extracted with: * * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr); * * Finally an ASN1_ITEM pointer can be extracted from an * appropriate reference with: ASN1_ITEM_rptr(X509). This * would be used when a function takes an ASN1_ITEM * argument. * */ # ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION /* ASN1_ITEM pointer exported type */ typedef const ASN1_ITEM ASN1_ITEM_EXP; /* Macro to obtain ASN1_ITEM pointer from exported type */ # define ASN1_ITEM_ptr(iptr) (iptr) /* Macro to include ASN1_ITEM pointer from base type */ # define ASN1_ITEM_ref(iptr) (&(iptr##_it)) # define ASN1_ITEM_rptr(ref) (&(ref##_it)) # define DECLARE_ASN1_ITEM(name) \ OPENSSL_EXTERN const ASN1_ITEM name##_it; # else /* * Platforms that can't easily handle shared global variables are declared as * functions returning ASN1_ITEM pointers. */ /* ASN1_ITEM pointer exported type */ typedef const ASN1_ITEM *ASN1_ITEM_EXP (void); /* Macro to obtain ASN1_ITEM pointer from exported type */ # define ASN1_ITEM_ptr(iptr) (iptr()) /* Macro to include ASN1_ITEM pointer from base type */ # define ASN1_ITEM_ref(iptr) (iptr##_it) # define ASN1_ITEM_rptr(ref) (ref##_it()) # define DECLARE_ASN1_ITEM(name) \ const ASN1_ITEM * name##_it(void); # endif /* Parameters used by ASN1_STRING_print_ex() */ /* * These determine which characters to escape: RFC2253 special characters, * control characters and MSB set characters */ # define ASN1_STRFLGS_ESC_2253 1 # define ASN1_STRFLGS_ESC_CTRL 2 # define ASN1_STRFLGS_ESC_MSB 4 /* * This flag determines how we do escaping: normally RC2253 backslash only, * set this to use backslash and quote. */ # define ASN1_STRFLGS_ESC_QUOTE 8 /* These three flags are internal use only. */ /* Character is a valid PrintableString character */ # define CHARTYPE_PRINTABLESTRING 0x10 /* Character needs escaping if it is the first character */ # define CHARTYPE_FIRST_ESC_2253 0x20 /* Character needs escaping if it is the last character */ # define CHARTYPE_LAST_ESC_2253 0x40 /* * NB the internal flags are safely reused below by flags handled at the top * level. */ /* * If this is set we convert all character strings to UTF8 first */ # define ASN1_STRFLGS_UTF8_CONVERT 0x10 /* * If this is set we don't attempt to interpret content: just assume all * strings are 1 byte per character. This will produce some pretty odd * looking output! */ # define ASN1_STRFLGS_IGNORE_TYPE 0x20 /* If this is set we include the string type in the output */ # define ASN1_STRFLGS_SHOW_TYPE 0x40 /* * This determines which strings to display and which to 'dump' (hex dump of * content octets or DER encoding). We can only dump non character strings or * everything. If we don't dump 'unknown' they are interpreted as character * strings with 1 octet per character and are subject to the usual escaping * options. */ # define ASN1_STRFLGS_DUMP_ALL 0x80 # define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 /* * These determine what 'dumping' does, we can dump the content octets or the * DER encoding: both use the RFC2253 #XXXXX notation. */ # define ASN1_STRFLGS_DUMP_DER 0x200 /* * All the string flags consistent with RFC2253, escaping control characters * isn't essential in RFC2253 but it is advisable anyway. */ # define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \ ASN1_STRFLGS_ESC_CTRL | \ ASN1_STRFLGS_ESC_MSB | \ ASN1_STRFLGS_UTF8_CONVERT | \ ASN1_STRFLGS_DUMP_UNKNOWN | \ ASN1_STRFLGS_DUMP_DER) DECLARE_STACK_OF(ASN1_INTEGER) DECLARE_ASN1_SET_OF(ASN1_INTEGER) DECLARE_STACK_OF(ASN1_GENERALSTRING) typedef struct asn1_type_st { int type; union { char *ptr; ASN1_BOOLEAN boolean; ASN1_STRING *asn1_string; ASN1_OBJECT *object; ASN1_INTEGER *integer; ASN1_ENUMERATED *enumerated; ASN1_BIT_STRING *bit_string; ASN1_OCTET_STRING *octet_string; ASN1_PRINTABLESTRING *printablestring; ASN1_T61STRING *t61string; ASN1_IA5STRING *ia5string; ASN1_GENERALSTRING *generalstring; ASN1_BMPSTRING *bmpstring; ASN1_UNIVERSALSTRING *universalstring; ASN1_UTCTIME *utctime; ASN1_GENERALIZEDTIME *generalizedtime; ASN1_VISIBLESTRING *visiblestring; ASN1_UTF8STRING *utf8string; /* * set and sequence are left complete and still contain the set or * sequence bytes */ ASN1_STRING *set; ASN1_STRING *sequence; ASN1_VALUE *asn1_value; } value; } ASN1_TYPE; DECLARE_STACK_OF(ASN1_TYPE) DECLARE_ASN1_SET_OF(ASN1_TYPE) typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY; DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY) DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY) typedef struct NETSCAPE_X509_st { ASN1_OCTET_STRING *header; X509 *cert; } NETSCAPE_X509; /* This is used to contain a list of bit names */ typedef struct BIT_STRING_BITNAME_st { int bitnum; const char *lname; const char *sname; } BIT_STRING_BITNAME; # define M_ASN1_STRING_length(x) ((x)->length) # define M_ASN1_STRING_length_set(x, n) ((x)->length = (n)) # define M_ASN1_STRING_type(x) ((x)->type) # define M_ASN1_STRING_data(x) ((x)->data) /* Macros for string operations */ # define M_ASN1_BIT_STRING_new() (ASN1_BIT_STRING *)\ ASN1_STRING_type_new(V_ASN1_BIT_STRING) # define M_ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) # define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\ ASN1_STRING_dup((const ASN1_STRING *)a) # define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\ (const ASN1_STRING *)a,(const ASN1_STRING *)b) # define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) # define M_ASN1_INTEGER_new() (ASN1_INTEGER *)\ ASN1_STRING_type_new(V_ASN1_INTEGER) # define M_ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING *)a) # define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)\ ASN1_STRING_dup((const ASN1_STRING *)a) # define M_ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\ (const ASN1_STRING *)a,(const ASN1_STRING *)b) # define M_ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\ ASN1_STRING_type_new(V_ASN1_ENUMERATED) # define M_ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING *)a) # define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)\ ASN1_STRING_dup((const ASN1_STRING *)a) # define M_ASN1_ENUMERATED_cmp(a,b) ASN1_STRING_cmp(\ (const ASN1_STRING *)a,(const ASN1_STRING *)b) # define M_ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\ ASN1_STRING_type_new(V_ASN1_OCTET_STRING) # define M_ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) # define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\ ASN1_STRING_dup((const ASN1_STRING *)a) # define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\ (const ASN1_STRING *)a,(const ASN1_STRING *)b) # define M_ASN1_OCTET_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) # define M_ASN1_OCTET_STRING_print(a,b) ASN1_STRING_print(a,(ASN1_STRING *)b) # define M_i2d_ASN1_OCTET_STRING(a,pp) \ i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\ V_ASN1_UNIVERSAL) # define B_ASN1_TIME \ B_ASN1_UTCTIME | \ B_ASN1_GENERALIZEDTIME # define B_ASN1_PRINTABLE \ B_ASN1_NUMERICSTRING| \ B_ASN1_PRINTABLESTRING| \ B_ASN1_T61STRING| \ B_ASN1_IA5STRING| \ B_ASN1_BIT_STRING| \ B_ASN1_UNIVERSALSTRING|\ B_ASN1_BMPSTRING|\ B_ASN1_UTF8STRING|\ B_ASN1_SEQUENCE|\ B_ASN1_UNKNOWN # define B_ASN1_DIRECTORYSTRING \ B_ASN1_PRINTABLESTRING| \ B_ASN1_TELETEXSTRING|\ B_ASN1_BMPSTRING|\ B_ASN1_UNIVERSALSTRING|\ B_ASN1_UTF8STRING # define B_ASN1_DISPLAYTEXT \ B_ASN1_IA5STRING| \ B_ASN1_VISIBLESTRING| \ B_ASN1_BMPSTRING|\ B_ASN1_UTF8STRING # define M_ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING) # define M_ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING *)a) # define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ pp,a->type,V_ASN1_UNIVERSAL) # define M_d2i_ASN1_PRINTABLE(a,pp,l) \ d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ B_ASN1_PRINTABLE) # define M_DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) # define M_DIRECTORYSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) # define M_i2d_DIRECTORYSTRING(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ pp,a->type,V_ASN1_UNIVERSAL) # define M_d2i_DIRECTORYSTRING(a,pp,l) \ d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ B_ASN1_DIRECTORYSTRING) # define M_DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING) # define M_DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a) # define M_i2d_DISPLAYTEXT(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ pp,a->type,V_ASN1_UNIVERSAL) # define M_d2i_DISPLAYTEXT(a,pp,l) \ d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ B_ASN1_DISPLAYTEXT) # define M_ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING *)\ ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) # define M_ASN1_PRINTABLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) # define M_i2d_ASN1_PRINTABLESTRING(a,pp) \ i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_PRINTABLESTRING,\ V_ASN1_UNIVERSAL) # define M_d2i_ASN1_PRINTABLESTRING(a,pp,l) \ (ASN1_PRINTABLESTRING *)d2i_ASN1_type_bytes\ ((ASN1_STRING **)a,pp,l,B_ASN1_PRINTABLESTRING) # define M_ASN1_T61STRING_new() (ASN1_T61STRING *)\ ASN1_STRING_type_new(V_ASN1_T61STRING) # define M_ASN1_T61STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) # define M_i2d_ASN1_T61STRING(a,pp) \ i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_T61STRING,\ V_ASN1_UNIVERSAL) # define M_d2i_ASN1_T61STRING(a,pp,l) \ (ASN1_T61STRING *)d2i_ASN1_type_bytes\ ((ASN1_STRING **)a,pp,l,B_ASN1_T61STRING) # define M_ASN1_IA5STRING_new() (ASN1_IA5STRING *)\ ASN1_STRING_type_new(V_ASN1_IA5STRING) # define M_ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) # define M_ASN1_IA5STRING_dup(a) \ (ASN1_IA5STRING *)ASN1_STRING_dup((const ASN1_STRING *)a) # define M_i2d_ASN1_IA5STRING(a,pp) \ i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\ V_ASN1_UNIVERSAL) # define M_d2i_ASN1_IA5STRING(a,pp,l) \ (ASN1_IA5STRING *)d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l,\ B_ASN1_IA5STRING) # define M_ASN1_UTCTIME_new() (ASN1_UTCTIME *)\ ASN1_STRING_type_new(V_ASN1_UTCTIME) # define M_ASN1_UTCTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) # define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)\ ASN1_STRING_dup((const ASN1_STRING *)a) # define M_ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\ ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME) # define M_ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) # define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\ (const ASN1_STRING *)a) # define M_ASN1_TIME_new() (ASN1_TIME *)\ ASN1_STRING_type_new(V_ASN1_UTCTIME) # define M_ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) # define M_ASN1_TIME_dup(a) (ASN1_TIME *)\ ASN1_STRING_dup((const ASN1_STRING *)a) # define M_ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\ ASN1_STRING_type_new(V_ASN1_GENERALSTRING) # define M_ASN1_GENERALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) # define M_i2d_ASN1_GENERALSTRING(a,pp) \ i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_GENERALSTRING,\ V_ASN1_UNIVERSAL) # define M_d2i_ASN1_GENERALSTRING(a,pp,l) \ (ASN1_GENERALSTRING *)d2i_ASN1_type_bytes\ ((ASN1_STRING **)a,pp,l,B_ASN1_GENERALSTRING) # define M_ASN1_UNIVERSALSTRING_new() (ASN1_UNIVERSALSTRING *)\ ASN1_STRING_type_new(V_ASN1_UNIVERSALSTRING) # define M_ASN1_UNIVERSALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) # define M_i2d_ASN1_UNIVERSALSTRING(a,pp) \ i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UNIVERSALSTRING,\ V_ASN1_UNIVERSAL) # define M_d2i_ASN1_UNIVERSALSTRING(a,pp,l) \ (ASN1_UNIVERSALSTRING *)d2i_ASN1_type_bytes\ ((ASN1_STRING **)a,pp,l,B_ASN1_UNIVERSALSTRING) # define M_ASN1_BMPSTRING_new() (ASN1_BMPSTRING *)\ ASN1_STRING_type_new(V_ASN1_BMPSTRING) # define M_ASN1_BMPSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) # define M_i2d_ASN1_BMPSTRING(a,pp) \ i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_BMPSTRING,\ V_ASN1_UNIVERSAL) # define M_d2i_ASN1_BMPSTRING(a,pp,l) \ (ASN1_BMPSTRING *)d2i_ASN1_type_bytes\ ((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING) # define M_ASN1_VISIBLESTRING_new() (ASN1_VISIBLESTRING *)\ ASN1_STRING_type_new(V_ASN1_VISIBLESTRING) # define M_ASN1_VISIBLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) # define M_i2d_ASN1_VISIBLESTRING(a,pp) \ i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_VISIBLESTRING,\ V_ASN1_UNIVERSAL) # define M_d2i_ASN1_VISIBLESTRING(a,pp,l) \ (ASN1_VISIBLESTRING *)d2i_ASN1_type_bytes\ ((ASN1_STRING **)a,pp,l,B_ASN1_VISIBLESTRING) # define M_ASN1_UTF8STRING_new() (ASN1_UTF8STRING *)\ ASN1_STRING_type_new(V_ASN1_UTF8STRING) # define M_ASN1_UTF8STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) # define M_i2d_ASN1_UTF8STRING(a,pp) \ i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UTF8STRING,\ V_ASN1_UNIVERSAL) # define M_d2i_ASN1_UTF8STRING(a,pp,l) \ (ASN1_UTF8STRING *)d2i_ASN1_type_bytes\ ((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING) /* for the is_set parameter to i2d_ASN1_SET */ # define IS_SEQUENCE 0 # define IS_SET 1 DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) int ASN1_TYPE_get(ASN1_TYPE *a); void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value); int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b); ASN1_OBJECT *ASN1_OBJECT_new(void); void ASN1_OBJECT_free(ASN1_OBJECT *a); int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp); ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, long length); ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, long length); DECLARE_ASN1_ITEM(ASN1_OBJECT) DECLARE_STACK_OF(ASN1_OBJECT) DECLARE_ASN1_SET_OF(ASN1_OBJECT) ASN1_STRING *ASN1_STRING_new(void); void ASN1_STRING_free(ASN1_STRING *a); void ASN1_STRING_clear_free(ASN1_STRING *a); int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str); ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *a); ASN1_STRING *ASN1_STRING_type_new(int type); int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b); /* * Since this is used to store all sorts of things, via macros, for now, * make its data void * */ int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); int ASN1_STRING_length(const ASN1_STRING *x); void ASN1_STRING_length_set(ASN1_STRING *x, int n); int ASN1_STRING_type(ASN1_STRING *x); unsigned char *ASN1_STRING_data(ASN1_STRING *x); DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp); ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, const unsigned char **pp, long length); int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length); int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n); int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a, unsigned char *flags, int flags_len); # ifndef OPENSSL_NO_BIO int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, BIT_STRING_BITNAME *tbl, int indent); # endif int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl); int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value, BIT_STRING_BITNAME *tbl); int i2d_ASN1_BOOLEAN(int a, unsigned char **pp); int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, long length); DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp); ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, long length); ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, long length); ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x); int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y); DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) int ASN1_UTCTIME_check(const ASN1_UTCTIME *a); ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t); ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, int offset_day, long offset_sec); int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); # if 0 time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s); # endif int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a); ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, time_t t); ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, time_t t, int offset_day, long offset_sec); int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); int ASN1_TIME_diff(int *pday, int *psec, const ASN1_TIME *from, const ASN1_TIME *to); DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a); int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STRING *b); int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len); DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) DECLARE_ASN1_FUNCTIONS(ASN1_NULL) DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) int UTF8_getc(const unsigned char *str, int len, unsigned long *val); int UTF8_putc(unsigned char *str, int len, unsigned long value); DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE) DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING) DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT) DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING) DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING) DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING) DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING) DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME) DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME) DECLARE_ASN1_FUNCTIONS(ASN1_TIME) DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t); ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, int offset_day, long offset_sec); int ASN1_TIME_check(ASN1_TIME *t); ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out); int ASN1_TIME_set_string(ASN1_TIME *s, const char *str); int i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp, i2d_of_void *i2d, int ex_tag, int ex_class, int is_set); STACK_OF(OPENSSL_BLOCK) *d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a, const unsigned char **pp, long length, d2i_of_void *d2i, void (*free_func) (OPENSSL_BLOCK), int ex_tag, int ex_class); # ifndef OPENSSL_NO_BIO int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size); int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a); int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size); int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a); int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size); int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type); # endif int i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *a); int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num); ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len, const char *sn, const char *ln); int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); long ASN1_INTEGER_get(const ASN1_INTEGER *a); ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai); BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn); int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a); ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai); BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai, BIGNUM *bn); /* General */ /* given a string, return the correct type, max is the maximum length */ int ASN1_PRINTABLE_type(const unsigned char *s, int max); int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass); ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, long length, int Ptag, int Pclass); unsigned long ASN1_tag2bit(int tag); /* type is one or more of the B_ASN1_ values. */ ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp, long length, int type); /* PARSING */ int asn1_Finish(ASN1_CTX *c); int asn1_const_Finish(ASN1_const_CTX *c); /* SPECIALS */ int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, int *pclass, long omax); int ASN1_check_infinite_end(unsigned char **p, long len); int ASN1_const_check_infinite_end(const unsigned char **p, long len); void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag, int xclass); int ASN1_put_eoc(unsigned char **pp); int ASN1_object_size(int constructed, int length, int tag); /* Used to implement other functions */ void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x); # define ASN1_dup_of(type,i2d,d2i,x) \ ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \ CHECKED_D2I_OF(type, d2i), \ CHECKED_PTR_OF(type, x))) # define ASN1_dup_of_const(type,i2d,d2i,x) \ ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \ CHECKED_D2I_OF(type, d2i), \ CHECKED_PTR_OF(const type, x))) void *ASN1_item_dup(const ASN1_ITEM *it, void *x); /* ASN1 alloc/free macros for when a type is only used internally */ # define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type)) # define M_ASN1_free_of(x, type) \ ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type)) # ifndef OPENSSL_NO_FP_API void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x); # define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \ ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \ CHECKED_D2I_OF(type, d2i), \ in, \ CHECKED_PPTR_OF(type, x))) void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x); # define ASN1_i2d_fp_of(type,i2d,out,x) \ (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \ out, \ CHECKED_PTR_OF(type, x))) # define ASN1_i2d_fp_of_const(type,i2d,out,x) \ (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \ out, \ CHECKED_PTR_OF(const type, x))) int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x); int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags); # endif int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in); # ifndef OPENSSL_NO_BIO void *ASN1_d2i_bio(void *(*xnew) (void), d2i_of_void *d2i, BIO *in, void **x); # define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \ ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \ CHECKED_D2I_OF(type, d2i), \ in, \ CHECKED_PPTR_OF(type, x))) void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x); int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x); # define ASN1_i2d_bio_of(type,i2d,out,x) \ (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \ out, \ CHECKED_PTR_OF(type, x))) # define ASN1_i2d_bio_of_const(type,i2d,out,x) \ (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \ out, \ CHECKED_PTR_OF(const type, x))) int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x); int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a); int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a); int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a); int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v); int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags); int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num, unsigned char *buf, int off); int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent); int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent, int dump); # endif const char *ASN1_tag2str(int tag); /* Used to load and write netscape format cert */ DECLARE_ASN1_FUNCTIONS(NETSCAPE_X509) int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len); int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data, int max_len); int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data, int len); int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data, int max_len); STACK_OF(OPENSSL_BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len, d2i_of_void *d2i, void (*free_func) (OPENSSL_BLOCK)); unsigned char *ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *i2d, unsigned char **buf, int *len); void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i); void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it); ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d, ASN1_OCTET_STRING **oct); # define ASN1_pack_string_of(type,obj,i2d,oct) \ (ASN1_pack_string(CHECKED_PTR_OF(type, obj), \ CHECKED_I2D_OF(type, i2d), \ oct)) ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct); void ASN1_STRING_set_default_mask(unsigned long mask); int ASN1_STRING_set_default_mask_asc(const char *p); unsigned long ASN1_STRING_get_default_mask(void); int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, int inform, unsigned long mask); int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, int inform, unsigned long mask, long minsize, long maxsize); ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, const unsigned char *in, int inlen, int inform, int nid); ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); void ASN1_STRING_TABLE_cleanup(void); /* ASN1 template functions */ /* Old API compatible functions */ ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it); int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); void ASN1_add_oid_module(void); ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf); ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf); /* ASN1 Print flags */ /* Indicate missing OPTIONAL fields */ # define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001 /* Mark start and end of SEQUENCE */ # define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002 /* Mark start and end of SEQUENCE/SET OF */ # define ASN1_PCTX_FLAGS_SHOW_SSOF 0x004 /* Show the ASN1 type of primitives */ # define ASN1_PCTX_FLAGS_SHOW_TYPE 0x008 /* Don't show ASN1 type of ANY */ # define ASN1_PCTX_FLAGS_NO_ANY_TYPE 0x010 /* Don't show ASN1 type of MSTRINGs */ # define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE 0x020 /* Don't show field names in SEQUENCE */ # define ASN1_PCTX_FLAGS_NO_FIELD_NAME 0x040 /* Show structure names of each SEQUENCE field */ # define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME 0x080 /* Don't show structure name even at top level */ # define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100 int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent, const ASN1_ITEM *it, const ASN1_PCTX *pctx); ASN1_PCTX *ASN1_PCTX_new(void); void ASN1_PCTX_free(ASN1_PCTX *p); unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p); void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags); unsigned long ASN1_PCTX_get_nm_flags(ASN1_PCTX *p); void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags); unsigned long ASN1_PCTX_get_cert_flags(ASN1_PCTX *p); void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags); unsigned long ASN1_PCTX_get_oid_flags(ASN1_PCTX *p); void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags); unsigned long ASN1_PCTX_get_str_flags(ASN1_PCTX *p); void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags); BIO_METHOD *BIO_f_asn1(void); BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it); int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, const ASN1_ITEM *it); int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, const char *hdr, const ASN1_ITEM *it); int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, int ctype_nid, int econt_nid, STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it); ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it); int SMIME_crlf_copy(BIO *in, BIO *out, int flags); int SMIME_text(BIO *in, BIO *out); /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_ASN1_strings(void); /* Error codes for the ASN1 functions. */ /* Function codes. */ # define ASN1_F_A2D_ASN1_OBJECT 100 # define ASN1_F_A2I_ASN1_ENUMERATED 101 # define ASN1_F_A2I_ASN1_INTEGER 102 # define ASN1_F_A2I_ASN1_STRING 103 # define ASN1_F_APPEND_EXP 176 # define ASN1_F_ASN1_BIT_STRING_SET_BIT 183 # define ASN1_F_ASN1_CB 177 # define ASN1_F_ASN1_CHECK_TLEN 104 # define ASN1_F_ASN1_COLLATE_PRIMITIVE 105 # define ASN1_F_ASN1_COLLECT 106 # define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108 # define ASN1_F_ASN1_D2I_FP 109 # define ASN1_F_ASN1_D2I_READ_BIO 107 # define ASN1_F_ASN1_DIGEST 184 # define ASN1_F_ASN1_DO_ADB 110 # define ASN1_F_ASN1_DUP 111 # define ASN1_F_ASN1_ENUMERATED_SET 112 # define ASN1_F_ASN1_ENUMERATED_TO_BN 113 # define ASN1_F_ASN1_EX_C2I 204 # define ASN1_F_ASN1_FIND_END 190 # define ASN1_F_ASN1_GENERALIZEDTIME_ADJ 216 # define ASN1_F_ASN1_GENERALIZEDTIME_SET 185 # define ASN1_F_ASN1_GENERATE_V3 178 # define ASN1_F_ASN1_GET_OBJECT 114 # define ASN1_F_ASN1_HEADER_NEW 115 # define ASN1_F_ASN1_I2D_BIO 116 # define ASN1_F_ASN1_I2D_FP 117 # define ASN1_F_ASN1_INTEGER_SET 118 # define ASN1_F_ASN1_INTEGER_TO_BN 119 # define ASN1_F_ASN1_ITEM_D2I_FP 206 # define ASN1_F_ASN1_ITEM_DUP 191 # define ASN1_F_ASN1_ITEM_EX_COMBINE_NEW 121 # define ASN1_F_ASN1_ITEM_EX_D2I 120 # define ASN1_F_ASN1_ITEM_EX_I2D 231 # define ASN1_F_ASN1_ITEM_I2D_BIO 192 # define ASN1_F_ASN1_ITEM_I2D_FP 193 # define ASN1_F_ASN1_ITEM_PACK 198 # define ASN1_F_ASN1_ITEM_SIGN 195 # define ASN1_F_ASN1_ITEM_SIGN_CTX 220 # define ASN1_F_ASN1_ITEM_UNPACK 199 # define ASN1_F_ASN1_ITEM_VERIFY 197 # define ASN1_F_ASN1_MBSTRING_NCOPY 122 # define ASN1_F_ASN1_OBJECT_NEW 123 # define ASN1_F_ASN1_OUTPUT_DATA 214 # define ASN1_F_ASN1_PACK_STRING 124 # define ASN1_F_ASN1_PCTX_NEW 205 # define ASN1_F_ASN1_PKCS5_PBE_SET 125 # define ASN1_F_ASN1_SEQ_PACK 126 # define ASN1_F_ASN1_SEQ_UNPACK 127 # define ASN1_F_ASN1_SIGN 128 # define ASN1_F_ASN1_STR2TYPE 179 # define ASN1_F_ASN1_STRING_SET 186 # define ASN1_F_ASN1_STRING_TABLE_ADD 129 # define ASN1_F_ASN1_STRING_TYPE_NEW 130 # define ASN1_F_ASN1_TEMPLATE_EX_D2I 132 # define ASN1_F_ASN1_TEMPLATE_NEW 133 # define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131 # define ASN1_F_ASN1_TIME_ADJ 217 # define ASN1_F_ASN1_TIME_SET 175 # define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134 # define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135 # define ASN1_F_ASN1_UNPACK_STRING 136 # define ASN1_F_ASN1_UTCTIME_ADJ 218 # define ASN1_F_ASN1_UTCTIME_SET 187 # define ASN1_F_ASN1_VERIFY 137 # define ASN1_F_B64_READ_ASN1 209 # define ASN1_F_B64_WRITE_ASN1 210 # define ASN1_F_BIO_NEW_NDEF 208 # define ASN1_F_BITSTR_CB 180 # define ASN1_F_BN_TO_ASN1_ENUMERATED 138 # define ASN1_F_BN_TO_ASN1_INTEGER 139 # define ASN1_F_C2I_ASN1_BIT_STRING 189 # define ASN1_F_C2I_ASN1_INTEGER 194 # define ASN1_F_C2I_ASN1_OBJECT 196 # define ASN1_F_COLLECT_DATA 140 # define ASN1_F_D2I_ASN1_BIT_STRING 141 # define ASN1_F_D2I_ASN1_BOOLEAN 142 # define ASN1_F_D2I_ASN1_BYTES 143 # define ASN1_F_D2I_ASN1_GENERALIZEDTIME 144 # define ASN1_F_D2I_ASN1_HEADER 145 # define ASN1_F_D2I_ASN1_INTEGER 146 # define ASN1_F_D2I_ASN1_OBJECT 147 # define ASN1_F_D2I_ASN1_SET 148 # define ASN1_F_D2I_ASN1_TYPE_BYTES 149 # define ASN1_F_D2I_ASN1_UINTEGER 150 # define ASN1_F_D2I_ASN1_UTCTIME 151 # define ASN1_F_D2I_AUTOPRIVATEKEY 207 # define ASN1_F_D2I_NETSCAPE_RSA 152 # define ASN1_F_D2I_NETSCAPE_RSA_2 153 # define ASN1_F_D2I_PRIVATEKEY 154 # define ASN1_F_D2I_PUBLICKEY 155 # define ASN1_F_D2I_RSA_NET 200 # define ASN1_F_D2I_RSA_NET_2 201 # define ASN1_F_D2I_X509 156 # define ASN1_F_D2I_X509_CINF 157 # define ASN1_F_D2I_X509_PKEY 159 # define ASN1_F_I2D_ASN1_BIO_STREAM 211 # define ASN1_F_I2D_ASN1_SET 188 # define ASN1_F_I2D_ASN1_TIME 160 # define ASN1_F_I2D_DSA_PUBKEY 161 # define ASN1_F_I2D_EC_PUBKEY 181 # define ASN1_F_I2D_PRIVATEKEY 163 # define ASN1_F_I2D_PUBLICKEY 164 # define ASN1_F_I2D_RSA_NET 162 # define ASN1_F_I2D_RSA_PUBKEY 165 # define ASN1_F_LONG_C2I 166 # define ASN1_F_OID_MODULE_INIT 174 # define ASN1_F_PARSE_TAGGING 182 # define ASN1_F_PKCS5_PBE2_SET_IV 167 # define ASN1_F_PKCS5_PBE_SET 202 # define ASN1_F_PKCS5_PBE_SET0_ALGOR 215 # define ASN1_F_PKCS5_PBKDF2_SET 219 # define ASN1_F_SMIME_READ_ASN1 212 # define ASN1_F_SMIME_TEXT 213 # define ASN1_F_X509_CINF_NEW 168 # define ASN1_F_X509_CRL_ADD0_REVOKED 169 # define ASN1_F_X509_INFO_NEW 170 # define ASN1_F_X509_NAME_ENCODE 203 # define ASN1_F_X509_NAME_EX_D2I 158 # define ASN1_F_X509_NAME_EX_NEW 171 # define ASN1_F_X509_NEW 172 # define ASN1_F_X509_PKEY_NEW 173 /* Reason codes. */ # define ASN1_R_ADDING_OBJECT 171 # define ASN1_R_ASN1_PARSE_ERROR 203 # define ASN1_R_ASN1_SIG_PARSE_ERROR 204 # define ASN1_R_AUX_ERROR 100 # define ASN1_R_BAD_CLASS 101 # define ASN1_R_BAD_OBJECT_HEADER 102 # define ASN1_R_BAD_TEMPLATE 230 # define ASN1_R_BAD_PASSWORD_READ 103 # define ASN1_R_BAD_TAG 104 # define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 214 # define ASN1_R_BN_LIB 105 # define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106 # define ASN1_R_BUFFER_TOO_SMALL 107 # define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108 # define ASN1_R_CONTEXT_NOT_INITIALISED 217 # define ASN1_R_DATA_IS_WRONG 109 # define ASN1_R_DECODE_ERROR 110 # define ASN1_R_DECODING_ERROR 111 # define ASN1_R_DEPTH_EXCEEDED 174 # define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 198 # define ASN1_R_ENCODE_ERROR 112 # define ASN1_R_ERROR_GETTING_TIME 173 # define ASN1_R_ERROR_LOADING_SECTION 172 # define ASN1_R_ERROR_PARSING_SET_ELEMENT 113 # define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114 # define ASN1_R_EXPECTING_AN_INTEGER 115 # define ASN1_R_EXPECTING_AN_OBJECT 116 # define ASN1_R_EXPECTING_A_BOOLEAN 117 # define ASN1_R_EXPECTING_A_TIME 118 # define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119 # define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120 # define ASN1_R_FIELD_MISSING 121 # define ASN1_R_FIRST_NUM_TOO_LARGE 122 # define ASN1_R_HEADER_TOO_LONG 123 # define ASN1_R_ILLEGAL_BITSTRING_FORMAT 175 # define ASN1_R_ILLEGAL_BOOLEAN 176 # define ASN1_R_ILLEGAL_CHARACTERS 124 # define ASN1_R_ILLEGAL_FORMAT 177 # define ASN1_R_ILLEGAL_HEX 178 # define ASN1_R_ILLEGAL_IMPLICIT_TAG 179 # define ASN1_R_ILLEGAL_INTEGER 180 # define ASN1_R_ILLEGAL_NESTED_TAGGING 181 # define ASN1_R_ILLEGAL_NULL 125 # define ASN1_R_ILLEGAL_NULL_VALUE 182 # define ASN1_R_ILLEGAL_OBJECT 183 # define ASN1_R_ILLEGAL_OPTIONAL_ANY 126 # define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170 # define ASN1_R_ILLEGAL_TAGGED_ANY 127 # define ASN1_R_ILLEGAL_TIME_VALUE 184 # define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185 # define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128 # define ASN1_R_INVALID_BIT_STRING_BITS_LEFT 220 # define ASN1_R_INVALID_BMPSTRING_LENGTH 129 # define ASN1_R_INVALID_DIGIT 130 # define ASN1_R_INVALID_MIME_TYPE 205 # define ASN1_R_INVALID_MODIFIER 186 # define ASN1_R_INVALID_NUMBER 187 # define ASN1_R_INVALID_OBJECT_ENCODING 216 # define ASN1_R_INVALID_SEPARATOR 131 # define ASN1_R_INVALID_TIME_FORMAT 132 # define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133 # define ASN1_R_INVALID_UTF8STRING 134 # define ASN1_R_IV_TOO_LARGE 135 # define ASN1_R_LENGTH_ERROR 136 # define ASN1_R_LIST_ERROR 188 # define ASN1_R_MIME_NO_CONTENT_TYPE 206 # define ASN1_R_MIME_PARSE_ERROR 207 # define ASN1_R_MIME_SIG_PARSE_ERROR 208 # define ASN1_R_MISSING_EOC 137 # define ASN1_R_MISSING_SECOND_NUMBER 138 # define ASN1_R_MISSING_VALUE 189 # define ASN1_R_MSTRING_NOT_UNIVERSAL 139 # define ASN1_R_MSTRING_WRONG_TAG 140 # define ASN1_R_NESTED_ASN1_STRING 197 # define ASN1_R_NESTED_TOO_DEEP 219 # define ASN1_R_NON_HEX_CHARACTERS 141 # define ASN1_R_NOT_ASCII_FORMAT 190 # define ASN1_R_NOT_ENOUGH_DATA 142 # define ASN1_R_NO_CONTENT_TYPE 209 # define ASN1_R_NO_DEFAULT_DIGEST 201 # define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 # define ASN1_R_NO_MULTIPART_BODY_FAILURE 210 # define ASN1_R_NO_MULTIPART_BOUNDARY 211 # define ASN1_R_NO_SIG_CONTENT_TYPE 212 # define ASN1_R_NULL_IS_WRONG_LENGTH 144 # define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191 # define ASN1_R_ODD_NUMBER_OF_CHARS 145 # define ASN1_R_PRIVATE_KEY_HEADER_MISSING 146 # define ASN1_R_SECOND_NUMBER_TOO_LARGE 147 # define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148 # define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149 # define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192 # define ASN1_R_SHORT_LINE 150 # define ASN1_R_SIG_INVALID_MIME_TYPE 213 # define ASN1_R_STREAMING_NOT_SUPPORTED 202 # define ASN1_R_STRING_TOO_LONG 151 # define ASN1_R_STRING_TOO_SHORT 152 # define ASN1_R_TAG_VALUE_TOO_HIGH 153 # define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154 # define ASN1_R_TIME_NOT_ASCII_FORMAT 193 # define ASN1_R_TOO_LONG 155 # define ASN1_R_TYPE_NOT_CONSTRUCTED 156 # define ASN1_R_TYPE_NOT_PRIMITIVE 218 # define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 157 # define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 158 # define ASN1_R_UNEXPECTED_EOC 159 # define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 215 # define ASN1_R_UNKNOWN_FORMAT 160 # define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161 # define ASN1_R_UNKNOWN_OBJECT_TYPE 162 # define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163 # define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 199 # define ASN1_R_UNKNOWN_TAG 194 # define ASN1_R_UNKOWN_FORMAT 195 # define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164 # define ASN1_R_UNSUPPORTED_CIPHER 165 # define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 166 # define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167 # define ASN1_R_UNSUPPORTED_TYPE 196 # define ASN1_R_WRONG_PUBLIC_KEY_TYPE 200 # define ASN1_R_WRONG_TAG 168 # define ASN1_R_WRONG_TYPE 169 #ifdef __cplusplus } #endif #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/ui_compat.h���������������������������������������������������������������������������������0000644�����������������00000006646�14763166030�0010402 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/ui/ui.h */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2001. */ /* ==================================================================== * Copyright (c) 2001 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_UI_COMPAT_H # define HEADER_UI_COMPAT_H # include <openssl/opensslconf.h> # include <openssl/ui.h> #ifdef __cplusplus extern "C" { #endif /* * The following functions were previously part of the DES section, and are * provided here for backward compatibility reasons. */ # define des_read_pw_string(b,l,p,v) \ _ossl_old_des_read_pw_string((b),(l),(p),(v)) # define des_read_pw(b,bf,s,p,v) \ _ossl_old_des_read_pw((b),(bf),(s),(p),(v)) int _ossl_old_des_read_pw_string(char *buf, int length, const char *prompt, int verify); int _ossl_old_des_read_pw(char *buf, char *buff, int size, const char *prompt, int verify); #ifdef __cplusplus } #endif #endif ������������������������������������������������������������������������������������������openssl/aes.h���������������������������������������������������������������������������������������0000644�����������������00000014002�14763166030�0007153 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/aes/aes.h */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * */ #ifndef HEADER_AES_H # define HEADER_AES_H # include <openssl/opensslconf.h> # ifdef OPENSSL_NO_AES # error AES is disabled. # endif # include <stddef.h> # define AES_ENCRYPT 1 # define AES_DECRYPT 0 /* * Because array size can't be a const in C, the following two are macros. * Both sizes are in bytes. */ # define AES_MAXNR 14 # define AES_BLOCK_SIZE 16 #ifdef __cplusplus extern "C" { #endif /* This should be a hidden type, but EVP requires that the size be known */ struct aes_key_st { # ifdef AES_LONG unsigned long rd_key[4 * (AES_MAXNR + 1)]; # else unsigned int rd_key[4 * (AES_MAXNR + 1)]; # endif int rounds; }; typedef struct aes_key_st AES_KEY; const char *AES_options(void); int AES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key); int AES_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key); int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key); int private_AES_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key); void AES_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key); void AES_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key); void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key, const int enc); void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t length, const AES_KEY *key, unsigned char *ivec, const int enc); void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, const AES_KEY *key, unsigned char *ivec, int *num, const int enc); void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, size_t length, const AES_KEY *key, unsigned char *ivec, int *num, const int enc); void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, size_t length, const AES_KEY *key, unsigned char *ivec, int *num, const int enc); void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, const AES_KEY *key, unsigned char *ivec, int *num); void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out, size_t length, const AES_KEY *key, unsigned char ivec[AES_BLOCK_SIZE], unsigned char ecount_buf[AES_BLOCK_SIZE], unsigned int *num); /* NB: the IV is _two_ blocks long */ void AES_ige_encrypt(const unsigned char *in, unsigned char *out, size_t length, const AES_KEY *key, unsigned char *ivec, const int enc); /* NB: the IV is _four_ blocks long */ void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out, size_t length, const AES_KEY *key, const AES_KEY *key2, const unsigned char *ivec, const int enc); int AES_wrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out, const unsigned char *in, unsigned int inlen); int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out, const unsigned char *in, unsigned int inlen); #ifdef __cplusplus } #endif #endif /* !HEADER_AES_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/ripemd.h������������������������������������������������������������������������������������0000644�����������������00000010423�14763166030�0007666 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/ripemd/ripemd.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_RIPEMD_H # define HEADER_RIPEMD_H # include <openssl/e_os2.h> # include <stddef.h> #ifdef __cplusplus extern "C" { #endif # ifdef OPENSSL_NO_RIPEMD # error RIPEMD is disabled. # endif # if defined(__LP32__) # define RIPEMD160_LONG unsigned long # elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) # define RIPEMD160_LONG unsigned long # define RIPEMD160_LONG_LOG2 3 # else # define RIPEMD160_LONG unsigned int # endif # define RIPEMD160_CBLOCK 64 # define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4) # define RIPEMD160_DIGEST_LENGTH 20 typedef struct RIPEMD160state_st { RIPEMD160_LONG A, B, C, D, E; RIPEMD160_LONG Nl, Nh; RIPEMD160_LONG data[RIPEMD160_LBLOCK]; unsigned int num; } RIPEMD160_CTX; # ifdef OPENSSL_FIPS int private_RIPEMD160_Init(RIPEMD160_CTX *c); # endif int RIPEMD160_Init(RIPEMD160_CTX *c); int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); unsigned char *RIPEMD160(const unsigned char *d, size_t n, unsigned char *md); void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b); #ifdef __cplusplus } #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/seed.h��������������������������������������������������������������������������������������0000644�����������������00000013630�14763166030�0007331 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Neither the name of author nor the names of its contributors may * be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ /* ==================================================================== * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_SEED_H # define HEADER_SEED_H # include <openssl/opensslconf.h> # include <openssl/e_os2.h> # include <openssl/crypto.h> # ifdef OPENSSL_NO_SEED # error SEED is disabled. # endif /* look whether we need 'long' to get 32 bits */ # ifdef AES_LONG # ifndef SEED_LONG # define SEED_LONG 1 # endif # endif # if !defined(NO_SYS_TYPES_H) # include <sys/types.h> # endif # define SEED_BLOCK_SIZE 16 # define SEED_KEY_LENGTH 16 #ifdef __cplusplus extern "C" { #endif typedef struct seed_key_st { # ifdef SEED_LONG unsigned long data[32]; # else unsigned int data[32]; # endif } SEED_KEY_SCHEDULE; # ifdef OPENSSL_FIPS void private_SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE *ks); # endif void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE *ks); void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks); void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks); void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out, const SEED_KEY_SCHEDULE *ks, int enc); void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int enc); void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int *num, int enc); void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int *num); #ifdef __cplusplus } #endif #endif /* HEADER_SEED_H */ ��������������������������������������������������������������������������������������������������������openssl/rsa.h���������������������������������������������������������������������������������������0000644�����������������00000073275�14763166030�0007211 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/rsa/rsa.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_RSA_H # define HEADER_RSA_H # include <openssl/asn1.h> # ifndef OPENSSL_NO_BIO # include <openssl/bio.h> # endif # include <openssl/crypto.h> # include <openssl/ossl_typ.h> # ifndef OPENSSL_NO_DEPRECATED # include <openssl/bn.h> # endif # ifdef OPENSSL_NO_RSA # error RSA is disabled. # endif #ifdef __cplusplus extern "C" { #endif /* Declared already in ossl_typ.h */ /* typedef struct rsa_st RSA; */ /* typedef struct rsa_meth_st RSA_METHOD; */ struct rsa_meth_st { const char *name; int (*rsa_pub_enc) (int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); int (*rsa_pub_dec) (int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); int (*rsa_priv_enc) (int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); int (*rsa_priv_dec) (int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); /* Can be null */ int (*rsa_mod_exp) (BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx); /* Can be null */ int (*bn_mod_exp) (BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); /* called at new */ int (*init) (RSA *rsa); /* called at free */ int (*finish) (RSA *rsa); /* RSA_METHOD_FLAG_* things */ int flags; /* may be needed! */ char *app_data; /* * New sign and verify functions: some libraries don't allow arbitrary * data to be signed/verified: this allows them to be used. Note: for * this to work the RSA_public_decrypt() and RSA_private_encrypt() should * *NOT* be used RSA_sign(), RSA_verify() should be used instead. Note: * for backwards compatibility this functionality is only enabled if the * RSA_FLAG_SIGN_VER option is set in 'flags'. */ int (*rsa_sign) (int type, const unsigned char *m, unsigned int m_length, unsigned char *sigret, unsigned int *siglen, const RSA *rsa); int (*rsa_verify) (int dtype, const unsigned char *m, unsigned int m_length, const unsigned char *sigbuf, unsigned int siglen, const RSA *rsa); /* * If this callback is NULL, the builtin software RSA key-gen will be * used. This is for behavioural compatibility whilst the code gets * rewired, but one day it would be nice to assume there are no such * things as "builtin software" implementations. */ int (*rsa_keygen) (RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); }; struct rsa_st { /* * The first parameter is used to pickup errors where this is passed * instead of aEVP_PKEY, it is set to 0 */ int pad; long version; const RSA_METHOD *meth; /* functional reference if 'meth' is ENGINE-provided */ ENGINE *engine; BIGNUM *n; BIGNUM *e; BIGNUM *d; BIGNUM *p; BIGNUM *q; BIGNUM *dmp1; BIGNUM *dmq1; BIGNUM *iqmp; /* be careful using this if the RSA structure is shared */ CRYPTO_EX_DATA ex_data; int references; int flags; /* Used to cache montgomery values */ BN_MONT_CTX *_method_mod_n; BN_MONT_CTX *_method_mod_p; BN_MONT_CTX *_method_mod_q; /* * all BIGNUM values are actually in the following data, if it is not * NULL */ char *bignum_data; BN_BLINDING *blinding; BN_BLINDING *mt_blinding; }; # ifndef OPENSSL_RSA_MAX_MODULUS_BITS # define OPENSSL_RSA_MAX_MODULUS_BITS 16384 # endif # define OPENSSL_RSA_FIPS_MIN_MODULUS_BITS 1024 # ifndef OPENSSL_RSA_SMALL_MODULUS_BITS # define OPENSSL_RSA_SMALL_MODULUS_BITS 3072 # endif # ifndef OPENSSL_RSA_MAX_PUBEXP_BITS /* exponent limit enforced for "large" modulus only */ # define OPENSSL_RSA_MAX_PUBEXP_BITS 64 # endif # define RSA_3 0x3L # define RSA_F4 0x10001L # define RSA_METHOD_FLAG_NO_CHECK 0x0001/* don't check pub/private * match */ # define RSA_FLAG_CACHE_PUBLIC 0x0002 # define RSA_FLAG_CACHE_PRIVATE 0x0004 # define RSA_FLAG_BLINDING 0x0008 # define RSA_FLAG_THREAD_SAFE 0x0010 /* * This flag means the private key operations will be handled by rsa_mod_exp * and that they do not depend on the private key components being present: * for example a key stored in external hardware. Without this flag * bn_mod_exp gets called when private key components are absent. */ # define RSA_FLAG_EXT_PKEY 0x0020 /* * This flag in the RSA_METHOD enables the new rsa_sign, rsa_verify * functions. */ # define RSA_FLAG_SIGN_VER 0x0040 /* * new with 0.9.6j and 0.9.7b; the built-in * RSA implementation now uses blinding by * default (ignoring RSA_FLAG_BLINDING), * but other engines might not need it */ # define RSA_FLAG_NO_BLINDING 0x0080 /* * new with 0.9.8f; the built-in RSA * implementation now uses constant time * operations by default in private key operations, * e.g., constant time modular exponentiation, * modular inverse without leaking branches, * division without leaking branches. This * flag disables these constant time * operations and results in faster RSA * private key operations. */ # define RSA_FLAG_NO_CONSTTIME 0x0100 # ifdef OPENSSL_USE_DEPRECATED /* deprecated name for the flag*/ /* * new with 0.9.7h; the built-in RSA * implementation now uses constant time * modular exponentiation for secret exponents * by default. This flag causes the * faster variable sliding window method to * be used for all exponents. */ # define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME # endif # define EVP_PKEY_CTX_set_rsa_padding(ctx, pad) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, -1, EVP_PKEY_CTRL_RSA_PADDING, \ pad, NULL) # define EVP_PKEY_CTX_get_rsa_padding(ctx, ppad) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, -1, \ EVP_PKEY_CTRL_GET_RSA_PADDING, 0, ppad) # define EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, len) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, \ (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \ EVP_PKEY_CTRL_RSA_PSS_SALTLEN, \ len, NULL) # define EVP_PKEY_CTX_get_rsa_pss_saltlen(ctx, plen) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, \ (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \ EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN, \ 0, plen) # define EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, bits) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_KEYGEN, \ EVP_PKEY_CTRL_RSA_KEYGEN_BITS, bits, NULL) # define EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, pubexp) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_KEYGEN, \ EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP, 0, pubexp) # define EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, md) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, \ EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \ EVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)md) # define EVP_PKEY_CTX_set_rsa_oaep_md(ctx, md) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ EVP_PKEY_CTRL_RSA_OAEP_MD, 0, (void *)md) # define EVP_PKEY_CTX_get_rsa_mgf1_md(ctx, pmd) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, \ EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \ EVP_PKEY_CTRL_GET_RSA_MGF1_MD, 0, (void *)pmd) # define EVP_PKEY_CTX_get_rsa_oaep_md(ctx, pmd) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ EVP_PKEY_CTRL_GET_RSA_OAEP_MD, 0, (void *)pmd) # define EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, l, llen) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ EVP_PKEY_CTRL_RSA_OAEP_LABEL, llen, (void *)l) # define EVP_PKEY_CTX_get0_rsa_oaep_label(ctx, l) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL, 0, (void *)l) # define EVP_PKEY_CTRL_RSA_PADDING (EVP_PKEY_ALG_CTRL + 1) # define EVP_PKEY_CTRL_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 2) # define EVP_PKEY_CTRL_RSA_KEYGEN_BITS (EVP_PKEY_ALG_CTRL + 3) # define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP (EVP_PKEY_ALG_CTRL + 4) # define EVP_PKEY_CTRL_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 5) # define EVP_PKEY_CTRL_GET_RSA_PADDING (EVP_PKEY_ALG_CTRL + 6) # define EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 7) # define EVP_PKEY_CTRL_GET_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 8) # define EVP_PKEY_CTRL_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 9) # define EVP_PKEY_CTRL_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 10) # define EVP_PKEY_CTRL_GET_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 11) # define EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 12) # define RSA_PKCS1_PADDING 1 # define RSA_SSLV23_PADDING 2 # define RSA_NO_PADDING 3 # define RSA_PKCS1_OAEP_PADDING 4 # define RSA_X931_PADDING 5 /* EVP_PKEY_ only */ # define RSA_PKCS1_PSS_PADDING 6 # define RSA_PKCS1_PADDING_SIZE 11 # define RSA_set_app_data(s,arg) RSA_set_ex_data(s,0,arg) # define RSA_get_app_data(s) RSA_get_ex_data(s,0) RSA *RSA_new(void); RSA *RSA_new_method(ENGINE *engine); int RSA_size(const RSA *rsa); /* Deprecated version */ # ifndef OPENSSL_NO_DEPRECATED RSA *RSA_generate_key(int bits, unsigned long e, void (*callback) (int, int, void *), void *cb_arg); # endif /* !defined(OPENSSL_NO_DEPRECATED) */ /* New version */ int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, BIGNUM *q2, const BIGNUM *Xp1, const BIGNUM *Xp2, const BIGNUM *Xp, const BIGNUM *Xq1, const BIGNUM *Xq2, const BIGNUM *Xq, const BIGNUM *e, BN_GENCB *cb); int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, BN_GENCB *cb); int RSA_check_key(const RSA *); /* next 4 return -1 on error */ int RSA_public_encrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); int RSA_private_encrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); int RSA_public_decrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); int RSA_private_decrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); void RSA_free(RSA *r); /* "up" the RSA object's reference count */ int RSA_up_ref(RSA *r); int RSA_flags(const RSA *r); void RSA_set_default_method(const RSA_METHOD *meth); const RSA_METHOD *RSA_get_default_method(void); const RSA_METHOD *RSA_get_method(const RSA *rsa); int RSA_set_method(RSA *rsa, const RSA_METHOD *meth); /* This function needs the memory locking malloc callbacks to be installed */ int RSA_memory_lock(RSA *r); /* these are the actual SSLeay RSA functions */ const RSA_METHOD *RSA_PKCS1_SSLeay(void); const RSA_METHOD *RSA_null_method(void); DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey) DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey) typedef struct rsa_pss_params_st { X509_ALGOR *hashAlgorithm; X509_ALGOR *maskGenAlgorithm; ASN1_INTEGER *saltLength; ASN1_INTEGER *trailerField; } RSA_PSS_PARAMS; DECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS) typedef struct rsa_oaep_params_st { X509_ALGOR *hashFunc; X509_ALGOR *maskGenFunc; X509_ALGOR *pSourceFunc; } RSA_OAEP_PARAMS; DECLARE_ASN1_FUNCTIONS(RSA_OAEP_PARAMS) # ifndef OPENSSL_NO_FP_API int RSA_print_fp(FILE *fp, const RSA *r, int offset); # endif # ifndef OPENSSL_NO_BIO int RSA_print(BIO *bp, const RSA *r, int offset); # endif # ifndef OPENSSL_NO_RC4 int i2d_RSA_NET(const RSA *a, unsigned char **pp, int (*cb) (char *buf, int len, const char *prompt, int verify), int sgckey); RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length, int (*cb) (char *buf, int len, const char *prompt, int verify), int sgckey); int i2d_Netscape_RSA(const RSA *a, unsigned char **pp, int (*cb) (char *buf, int len, const char *prompt, int verify)); RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length, int (*cb) (char *buf, int len, const char *prompt, int verify)); # endif /* * The following 2 functions sign and verify a X509_SIG ASN1 object inside * PKCS#1 padded RSA encryption */ int RSA_sign(int type, const unsigned char *m, unsigned int m_length, unsigned char *sigret, unsigned int *siglen, RSA *rsa); int RSA_verify(int type, const unsigned char *m, unsigned int m_length, const unsigned char *sigbuf, unsigned int siglen, RSA *rsa); /* * The following 2 function sign and verify a ASN1_OCTET_STRING object inside * PKCS#1 padded RSA encryption */ int RSA_sign_ASN1_OCTET_STRING(int type, const unsigned char *m, unsigned int m_length, unsigned char *sigret, unsigned int *siglen, RSA *rsa); int RSA_verify_ASN1_OCTET_STRING(int type, const unsigned char *m, unsigned int m_length, unsigned char *sigbuf, unsigned int siglen, RSA *rsa); int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); void RSA_blinding_off(RSA *rsa); BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx); int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, const unsigned char *f, int fl); int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, const unsigned char *f, int fl, int rsa_len); int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, const unsigned char *f, int fl); int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, const unsigned char *f, int fl, int rsa_len); int PKCS1_MGF1(unsigned char *mask, long len, const unsigned char *seed, long seedlen, const EVP_MD *dgst); int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, const unsigned char *f, int fl, const unsigned char *p, int pl); int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, const unsigned char *f, int fl, int rsa_len, const unsigned char *p, int pl); int RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, const unsigned char *from, int flen, const unsigned char *param, int plen, const EVP_MD *md, const EVP_MD *mgf1md); int RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, const unsigned char *from, int flen, int num, const unsigned char *param, int plen, const EVP_MD *md, const EVP_MD *mgf1md); int RSA_padding_add_SSLv23(unsigned char *to, int tlen, const unsigned char *f, int fl); int RSA_padding_check_SSLv23(unsigned char *to, int tlen, const unsigned char *f, int fl, int rsa_len); int RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *f, int fl); int RSA_padding_check_none(unsigned char *to, int tlen, const unsigned char *f, int fl, int rsa_len); int RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *f, int fl); int RSA_padding_check_X931(unsigned char *to, int tlen, const unsigned char *f, int fl, int rsa_len); int RSA_X931_hash_id(int nid); int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash, const EVP_MD *Hash, const unsigned char *EM, int sLen); int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM, const unsigned char *mHash, const EVP_MD *Hash, int sLen); int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, const EVP_MD *Hash, const EVP_MD *mgf1Hash, const unsigned char *EM, int sLen); int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, const unsigned char *mHash, const EVP_MD *Hash, const EVP_MD *mgf1Hash, int sLen); int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int RSA_set_ex_data(RSA *r, int idx, void *arg); void *RSA_get_ex_data(const RSA *r, int idx); RSA *RSAPublicKey_dup(RSA *rsa); RSA *RSAPrivateKey_dup(RSA *rsa); /* * If this flag is set the RSA method is FIPS compliant and can be used in * FIPS mode. This is set in the validated module method. If an application * sets this flag in its own methods it is its responsibility to ensure the * result is compliant. */ # define RSA_FLAG_FIPS_METHOD 0x0400 /* * If this flag is set the operations normally disabled in FIPS mode are * permitted it is then the applications responsibility to ensure that the * usage is compliant. */ # define RSA_FLAG_NON_FIPS_ALLOW 0x0400 /* * Application has decided PRNG is good enough to generate a key: don't * check. */ # define RSA_FLAG_CHECKED 0x0800 /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_RSA_strings(void); /* Error codes for the RSA functions. */ /* Function codes. */ # define RSA_F_CHECK_PADDING_MD 140 # define RSA_F_DO_RSA_PRINT 146 # define RSA_F_INT_RSA_VERIFY 145 # define RSA_F_MEMORY_LOCK 100 # define RSA_F_OLD_RSA_PRIV_DECODE 147 # define RSA_F_PKEY_RSA_CTRL 143 # define RSA_F_PKEY_RSA_CTRL_STR 144 # define RSA_F_PKEY_RSA_SIGN 142 # define RSA_F_PKEY_RSA_VERIFY 154 # define RSA_F_PKEY_RSA_VERIFYRECOVER 141 # define RSA_F_RSA_ALGOR_TO_MD 157 # define RSA_F_RSA_BUILTIN_KEYGEN 129 # define RSA_F_RSA_CHECK_KEY 123 # define RSA_F_RSA_CMS_DECRYPT 258 # define RSA_F_RSA_EAY_PRIVATE_DECRYPT 101 # define RSA_F_RSA_EAY_PRIVATE_ENCRYPT 102 # define RSA_F_RSA_EAY_PUBLIC_DECRYPT 103 # define RSA_F_RSA_EAY_PUBLIC_ENCRYPT 104 # define RSA_F_RSA_GENERATE_KEY 105 # define RSA_F_RSA_GENERATE_KEY_EX 155 # define RSA_F_RSA_ITEM_VERIFY 156 # define RSA_F_RSA_MEMORY_LOCK 130 # define RSA_F_RSA_MGF1_TO_MD 159 # define RSA_F_RSA_NEW_METHOD 106 # define RSA_F_RSA_NULL 124 # define RSA_F_RSA_NULL_MOD_EXP 131 # define RSA_F_RSA_NULL_PRIVATE_DECRYPT 132 # define RSA_F_RSA_NULL_PRIVATE_ENCRYPT 133 # define RSA_F_RSA_NULL_PUBLIC_DECRYPT 134 # define RSA_F_RSA_NULL_PUBLIC_ENCRYPT 135 # define RSA_F_RSA_PADDING_ADD_NONE 107 # define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP 121 # define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP_MGF1 160 # define RSA_F_RSA_PADDING_ADD_PKCS1_PSS 125 # define RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1 158 # define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108 # define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109 # define RSA_F_RSA_PADDING_ADD_SSLV23 110 # define RSA_F_RSA_PADDING_ADD_X931 127 # define RSA_F_RSA_PADDING_CHECK_NONE 111 # define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122 # define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP_MGF1 161 # define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112 # define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113 # define RSA_F_RSA_PADDING_CHECK_SSLV23 114 # define RSA_F_RSA_PADDING_CHECK_X931 128 # define RSA_F_RSA_PRINT 115 # define RSA_F_RSA_PRINT_FP 116 # define RSA_F_RSA_PRIVATE_DECRYPT 157 # define RSA_F_RSA_PRIVATE_ENCRYPT 148 # define RSA_F_RSA_PRIV_DECODE 137 # define RSA_F_RSA_PRIV_ENCODE 138 # define RSA_F_RSA_PSS_TO_CTX 162 # define RSA_F_RSA_PUBLIC_DECRYPT 149 # define RSA_F_RSA_PUBLIC_ENCRYPT 153 # define RSA_F_RSA_PUB_DECODE 139 # define RSA_F_RSA_SETUP_BLINDING 136 # define RSA_F_RSA_SET_DEFAULT_METHOD 150 # define RSA_F_RSA_SET_METHOD 151 # define RSA_F_RSA_SIGN 117 # define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118 # define RSA_F_RSA_VERIFY 119 # define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 120 # define RSA_F_RSA_VERIFY_PKCS1_PSS 126 # define RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1 152 /* Reason codes. */ # define RSA_R_ALGORITHM_MISMATCH 100 # define RSA_R_BAD_E_VALUE 101 # define RSA_R_BAD_FIXED_HEADER_DECRYPT 102 # define RSA_R_BAD_PAD_BYTE_COUNT 103 # define RSA_R_BAD_SIGNATURE 104 # define RSA_R_BLOCK_TYPE_IS_NOT_01 106 # define RSA_R_BLOCK_TYPE_IS_NOT_02 107 # define RSA_R_DATA_GREATER_THAN_MOD_LEN 108 # define RSA_R_DATA_TOO_LARGE 109 # define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 110 # define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 132 # define RSA_R_DATA_TOO_SMALL 111 # define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 122 # define RSA_R_DIGEST_DOES_NOT_MATCH 166 # define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 112 # define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124 # define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125 # define RSA_R_D_E_NOT_CONGRUENT_TO_1 123 # define RSA_R_FIRST_OCTET_INVALID 133 # define RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE 144 # define RSA_R_INVALID_DIGEST 160 # define RSA_R_INVALID_DIGEST_LENGTH 143 # define RSA_R_INVALID_HEADER 137 # define RSA_R_INVALID_KEYBITS 145 # define RSA_R_INVALID_LABEL 161 # define RSA_R_INVALID_MESSAGE_LENGTH 131 # define RSA_R_INVALID_MGF1_MD 156 # define RSA_R_INVALID_OAEP_PARAMETERS 162 # define RSA_R_INVALID_PADDING 138 # define RSA_R_INVALID_PADDING_MODE 141 # define RSA_R_INVALID_PSS_PARAMETERS 157 # define RSA_R_INVALID_PSS_SALTLEN 146 # define RSA_R_INVALID_SALT_LENGTH 158 # define RSA_R_INVALID_TRAILER 139 # define RSA_R_INVALID_X931_DIGEST 142 # define RSA_R_IQMP_NOT_INVERSE_OF_Q 126 # define RSA_R_KEY_SIZE_TOO_SMALL 120 # define RSA_R_LAST_OCTET_INVALID 134 # define RSA_R_MODULUS_TOO_LARGE 105 # define RSA_R_NON_FIPS_RSA_METHOD 149 # define RSA_R_NON_FIPS_METHOD 149 # define RSA_R_NO_PUBLIC_EXPONENT 140 # define RSA_R_NULL_BEFORE_BLOCK_MISSING 113 # define RSA_R_N_DOES_NOT_EQUAL_P_Q 127 # define RSA_R_OAEP_DECODING_ERROR 121 # define RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE 150 # define RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 148 # define RSA_R_PADDING_CHECK_FAILED 114 # define RSA_R_PKCS_DECODING_ERROR 159 # define RSA_R_P_NOT_PRIME 128 # define RSA_R_Q_NOT_PRIME 129 # define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED 130 # define RSA_R_SLEN_CHECK_FAILED 136 # define RSA_R_SLEN_RECOVERY_FAILED 135 # define RSA_R_SSLV3_ROLLBACK_ATTACK 115 # define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116 # define RSA_R_UNKNOWN_ALGORITHM_TYPE 117 # define RSA_R_UNKNOWN_DIGEST 163 # define RSA_R_UNKNOWN_MASK_DIGEST 151 # define RSA_R_UNKNOWN_PADDING_TYPE 118 # define RSA_R_UNKNOWN_PSS_DIGEST 152 # define RSA_R_UNSUPPORTED_ENCRYPTION_TYPE 164 # define RSA_R_UNSUPPORTED_LABEL_SOURCE 165 # define RSA_R_UNSUPPORTED_MASK_ALGORITHM 153 # define RSA_R_UNSUPPORTED_MASK_PARAMETER 154 # define RSA_R_UNSUPPORTED_SIGNATURE_TYPE 155 # define RSA_R_VALUE_MISSING 147 # define RSA_R_WRONG_SIGNATURE_LENGTH 119 #ifdef __cplusplus } #endif #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/objects.h�����������������������������������������������������������������������������������0000644�����������������00000134714�14763166030�0010051 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/objects/objects.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_OBJECTS_H # define HEADER_OBJECTS_H # define USE_OBJ_MAC # ifdef USE_OBJ_MAC # include <openssl/obj_mac.h> # else # define SN_undef "UNDEF" # define LN_undef "undefined" # define NID_undef 0 # define OBJ_undef 0L # define SN_Algorithm "Algorithm" # define LN_algorithm "algorithm" # define NID_algorithm 38 # define OBJ_algorithm 1L,3L,14L,3L,2L # define LN_rsadsi "rsadsi" # define NID_rsadsi 1 # define OBJ_rsadsi 1L,2L,840L,113549L # define LN_pkcs "pkcs" # define NID_pkcs 2 # define OBJ_pkcs OBJ_rsadsi,1L # define SN_md2 "MD2" # define LN_md2 "md2" # define NID_md2 3 # define OBJ_md2 OBJ_rsadsi,2L,2L # define SN_md5 "MD5" # define LN_md5 "md5" # define NID_md5 4 # define OBJ_md5 OBJ_rsadsi,2L,5L # define SN_rc4 "RC4" # define LN_rc4 "rc4" # define NID_rc4 5 # define OBJ_rc4 OBJ_rsadsi,3L,4L # define LN_rsaEncryption "rsaEncryption" # define NID_rsaEncryption 6 # define OBJ_rsaEncryption OBJ_pkcs,1L,1L # define SN_md2WithRSAEncryption "RSA-MD2" # define LN_md2WithRSAEncryption "md2WithRSAEncryption" # define NID_md2WithRSAEncryption 7 # define OBJ_md2WithRSAEncryption OBJ_pkcs,1L,2L # define SN_md5WithRSAEncryption "RSA-MD5" # define LN_md5WithRSAEncryption "md5WithRSAEncryption" # define NID_md5WithRSAEncryption 8 # define OBJ_md5WithRSAEncryption OBJ_pkcs,1L,4L # define SN_pbeWithMD2AndDES_CBC "PBE-MD2-DES" # define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" # define NID_pbeWithMD2AndDES_CBC 9 # define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs,5L,1L # define SN_pbeWithMD5AndDES_CBC "PBE-MD5-DES" # define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" # define NID_pbeWithMD5AndDES_CBC 10 # define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs,5L,3L # define LN_X500 "X500" # define NID_X500 11 # define OBJ_X500 2L,5L # define LN_X509 "X509" # define NID_X509 12 # define OBJ_X509 OBJ_X500,4L # define SN_commonName "CN" # define LN_commonName "commonName" # define NID_commonName 13 # define OBJ_commonName OBJ_X509,3L # define SN_countryName "C" # define LN_countryName "countryName" # define NID_countryName 14 # define OBJ_countryName OBJ_X509,6L # define SN_localityName "L" # define LN_localityName "localityName" # define NID_localityName 15 # define OBJ_localityName OBJ_X509,7L /* Postal Address? PA */ /* should be "ST" (rfc1327) but MS uses 'S' */ # define SN_stateOrProvinceName "ST" # define LN_stateOrProvinceName "stateOrProvinceName" # define NID_stateOrProvinceName 16 # define OBJ_stateOrProvinceName OBJ_X509,8L # define SN_organizationName "O" # define LN_organizationName "organizationName" # define NID_organizationName 17 # define OBJ_organizationName OBJ_X509,10L # define SN_organizationalUnitName "OU" # define LN_organizationalUnitName "organizationalUnitName" # define NID_organizationalUnitName 18 # define OBJ_organizationalUnitName OBJ_X509,11L # define SN_rsa "RSA" # define LN_rsa "rsa" # define NID_rsa 19 # define OBJ_rsa OBJ_X500,8L,1L,1L # define LN_pkcs7 "pkcs7" # define NID_pkcs7 20 # define OBJ_pkcs7 OBJ_pkcs,7L # define LN_pkcs7_data "pkcs7-data" # define NID_pkcs7_data 21 # define OBJ_pkcs7_data OBJ_pkcs7,1L # define LN_pkcs7_signed "pkcs7-signedData" # define NID_pkcs7_signed 22 # define OBJ_pkcs7_signed OBJ_pkcs7,2L # define LN_pkcs7_enveloped "pkcs7-envelopedData" # define NID_pkcs7_enveloped 23 # define OBJ_pkcs7_enveloped OBJ_pkcs7,3L # define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData" # define NID_pkcs7_signedAndEnveloped 24 # define OBJ_pkcs7_signedAndEnveloped OBJ_pkcs7,4L # define LN_pkcs7_digest "pkcs7-digestData" # define NID_pkcs7_digest 25 # define OBJ_pkcs7_digest OBJ_pkcs7,5L # define LN_pkcs7_encrypted "pkcs7-encryptedData" # define NID_pkcs7_encrypted 26 # define OBJ_pkcs7_encrypted OBJ_pkcs7,6L # define LN_pkcs3 "pkcs3" # define NID_pkcs3 27 # define OBJ_pkcs3 OBJ_pkcs,3L # define LN_dhKeyAgreement "dhKeyAgreement" # define NID_dhKeyAgreement 28 # define OBJ_dhKeyAgreement OBJ_pkcs3,1L # define SN_des_ecb "DES-ECB" # define LN_des_ecb "des-ecb" # define NID_des_ecb 29 # define OBJ_des_ecb OBJ_algorithm,6L # define SN_des_cfb64 "DES-CFB" # define LN_des_cfb64 "des-cfb" # define NID_des_cfb64 30 /* IV + num */ # define OBJ_des_cfb64 OBJ_algorithm,9L # define SN_des_cbc "DES-CBC" # define LN_des_cbc "des-cbc" # define NID_des_cbc 31 /* IV */ # define OBJ_des_cbc OBJ_algorithm,7L # define SN_des_ede "DES-EDE" # define LN_des_ede "des-ede" # define NID_des_ede 32 /* ?? */ # define OBJ_des_ede OBJ_algorithm,17L # define SN_des_ede3 "DES-EDE3" # define LN_des_ede3 "des-ede3" # define NID_des_ede3 33 # define SN_idea_cbc "IDEA-CBC" # define LN_idea_cbc "idea-cbc" # define NID_idea_cbc 34 # define OBJ_idea_cbc 1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L # define SN_idea_cfb64 "IDEA-CFB" # define LN_idea_cfb64 "idea-cfb" # define NID_idea_cfb64 35 # define SN_idea_ecb "IDEA-ECB" # define LN_idea_ecb "idea-ecb" # define NID_idea_ecb 36 # define SN_rc2_cbc "RC2-CBC" # define LN_rc2_cbc "rc2-cbc" # define NID_rc2_cbc 37 # define OBJ_rc2_cbc OBJ_rsadsi,3L,2L # define SN_rc2_ecb "RC2-ECB" # define LN_rc2_ecb "rc2-ecb" # define NID_rc2_ecb 38 # define SN_rc2_cfb64 "RC2-CFB" # define LN_rc2_cfb64 "rc2-cfb" # define NID_rc2_cfb64 39 # define SN_rc2_ofb64 "RC2-OFB" # define LN_rc2_ofb64 "rc2-ofb" # define NID_rc2_ofb64 40 # define SN_sha "SHA" # define LN_sha "sha" # define NID_sha 41 # define OBJ_sha OBJ_algorithm,18L # define SN_shaWithRSAEncryption "RSA-SHA" # define LN_shaWithRSAEncryption "shaWithRSAEncryption" # define NID_shaWithRSAEncryption 42 # define OBJ_shaWithRSAEncryption OBJ_algorithm,15L # define SN_des_ede_cbc "DES-EDE-CBC" # define LN_des_ede_cbc "des-ede-cbc" # define NID_des_ede_cbc 43 # define SN_des_ede3_cbc "DES-EDE3-CBC" # define LN_des_ede3_cbc "des-ede3-cbc" # define NID_des_ede3_cbc 44 # define OBJ_des_ede3_cbc OBJ_rsadsi,3L,7L # define SN_des_ofb64 "DES-OFB" # define LN_des_ofb64 "des-ofb" # define NID_des_ofb64 45 # define OBJ_des_ofb64 OBJ_algorithm,8L # define SN_idea_ofb64 "IDEA-OFB" # define LN_idea_ofb64 "idea-ofb" # define NID_idea_ofb64 46 # define LN_pkcs9 "pkcs9" # define NID_pkcs9 47 # define OBJ_pkcs9 OBJ_pkcs,9L # define SN_pkcs9_emailAddress "Email" # define LN_pkcs9_emailAddress "emailAddress" # define NID_pkcs9_emailAddress 48 # define OBJ_pkcs9_emailAddress OBJ_pkcs9,1L # define LN_pkcs9_unstructuredName "unstructuredName" # define NID_pkcs9_unstructuredName 49 # define OBJ_pkcs9_unstructuredName OBJ_pkcs9,2L # define LN_pkcs9_contentType "contentType" # define NID_pkcs9_contentType 50 # define OBJ_pkcs9_contentType OBJ_pkcs9,3L # define LN_pkcs9_messageDigest "messageDigest" # define NID_pkcs9_messageDigest 51 # define OBJ_pkcs9_messageDigest OBJ_pkcs9,4L # define LN_pkcs9_signingTime "signingTime" # define NID_pkcs9_signingTime 52 # define OBJ_pkcs9_signingTime OBJ_pkcs9,5L # define LN_pkcs9_countersignature "countersignature" # define NID_pkcs9_countersignature 53 # define OBJ_pkcs9_countersignature OBJ_pkcs9,6L # define LN_pkcs9_challengePassword "challengePassword" # define NID_pkcs9_challengePassword 54 # define OBJ_pkcs9_challengePassword OBJ_pkcs9,7L # define LN_pkcs9_unstructuredAddress "unstructuredAddress" # define NID_pkcs9_unstructuredAddress 55 # define OBJ_pkcs9_unstructuredAddress OBJ_pkcs9,8L # define LN_pkcs9_extCertAttributes "extendedCertificateAttributes" # define NID_pkcs9_extCertAttributes 56 # define OBJ_pkcs9_extCertAttributes OBJ_pkcs9,9L # define SN_netscape "Netscape" # define LN_netscape "Netscape Communications Corp." # define NID_netscape 57 # define OBJ_netscape 2L,16L,840L,1L,113730L # define SN_netscape_cert_extension "nsCertExt" # define LN_netscape_cert_extension "Netscape Certificate Extension" # define NID_netscape_cert_extension 58 # define OBJ_netscape_cert_extension OBJ_netscape,1L # define SN_netscape_data_type "nsDataType" # define LN_netscape_data_type "Netscape Data Type" # define NID_netscape_data_type 59 # define OBJ_netscape_data_type OBJ_netscape,2L # define SN_des_ede_cfb64 "DES-EDE-CFB" # define LN_des_ede_cfb64 "des-ede-cfb" # define NID_des_ede_cfb64 60 # define SN_des_ede3_cfb64 "DES-EDE3-CFB" # define LN_des_ede3_cfb64 "des-ede3-cfb" # define NID_des_ede3_cfb64 61 # define SN_des_ede_ofb64 "DES-EDE-OFB" # define LN_des_ede_ofb64 "des-ede-ofb" # define NID_des_ede_ofb64 62 # define SN_des_ede3_ofb64 "DES-EDE3-OFB" # define LN_des_ede3_ofb64 "des-ede3-ofb" # define NID_des_ede3_ofb64 63 /* I'm not sure about the object ID */ # define SN_sha1 "SHA1" # define LN_sha1 "sha1" # define NID_sha1 64 # define OBJ_sha1 OBJ_algorithm,26L /* 28 Jun 1996 - eay */ /* #define OBJ_sha1 1L,3L,14L,2L,26L,05L <- wrong */ # define SN_sha1WithRSAEncryption "RSA-SHA1" # define LN_sha1WithRSAEncryption "sha1WithRSAEncryption" # define NID_sha1WithRSAEncryption 65 # define OBJ_sha1WithRSAEncryption OBJ_pkcs,1L,5L # define SN_dsaWithSHA "DSA-SHA" # define LN_dsaWithSHA "dsaWithSHA" # define NID_dsaWithSHA 66 # define OBJ_dsaWithSHA OBJ_algorithm,13L # define SN_dsa_2 "DSA-old" # define LN_dsa_2 "dsaEncryption-old" # define NID_dsa_2 67 # define OBJ_dsa_2 OBJ_algorithm,12L /* proposed by microsoft to RSA */ # define SN_pbeWithSHA1AndRC2_CBC "PBE-SHA1-RC2-64" # define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" # define NID_pbeWithSHA1AndRC2_CBC 68 # define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs,5L,11L /* * proposed by microsoft to RSA as pbeWithSHA1AndRC4: it is now defined * explicitly in PKCS#5 v2.0 as id-PBKDF2 which is something completely * different. */ # define LN_id_pbkdf2 "PBKDF2" # define NID_id_pbkdf2 69 # define OBJ_id_pbkdf2 OBJ_pkcs,5L,12L # define SN_dsaWithSHA1_2 "DSA-SHA1-old" # define LN_dsaWithSHA1_2 "dsaWithSHA1-old" # define NID_dsaWithSHA1_2 70 /* Got this one from 'sdn706r20.pdf' which is actually an NSA document :-) */ # define OBJ_dsaWithSHA1_2 OBJ_algorithm,27L # define SN_netscape_cert_type "nsCertType" # define LN_netscape_cert_type "Netscape Cert Type" # define NID_netscape_cert_type 71 # define OBJ_netscape_cert_type OBJ_netscape_cert_extension,1L # define SN_netscape_base_url "nsBaseUrl" # define LN_netscape_base_url "Netscape Base Url" # define NID_netscape_base_url 72 # define OBJ_netscape_base_url OBJ_netscape_cert_extension,2L # define SN_netscape_revocation_url "nsRevocationUrl" # define LN_netscape_revocation_url "Netscape Revocation Url" # define NID_netscape_revocation_url 73 # define OBJ_netscape_revocation_url OBJ_netscape_cert_extension,3L # define SN_netscape_ca_revocation_url "nsCaRevocationUrl" # define LN_netscape_ca_revocation_url "Netscape CA Revocation Url" # define NID_netscape_ca_revocation_url 74 # define OBJ_netscape_ca_revocation_url OBJ_netscape_cert_extension,4L # define SN_netscape_renewal_url "nsRenewalUrl" # define LN_netscape_renewal_url "Netscape Renewal Url" # define NID_netscape_renewal_url 75 # define OBJ_netscape_renewal_url OBJ_netscape_cert_extension,7L # define SN_netscape_ca_policy_url "nsCaPolicyUrl" # define LN_netscape_ca_policy_url "Netscape CA Policy Url" # define NID_netscape_ca_policy_url 76 # define OBJ_netscape_ca_policy_url OBJ_netscape_cert_extension,8L # define SN_netscape_ssl_server_name "nsSslServerName" # define LN_netscape_ssl_server_name "Netscape SSL Server Name" # define NID_netscape_ssl_server_name 77 # define OBJ_netscape_ssl_server_name OBJ_netscape_cert_extension,12L # define SN_netscape_comment "nsComment" # define LN_netscape_comment "Netscape Comment" # define NID_netscape_comment 78 # define OBJ_netscape_comment OBJ_netscape_cert_extension,13L # define SN_netscape_cert_sequence "nsCertSequence" # define LN_netscape_cert_sequence "Netscape Certificate Sequence" # define NID_netscape_cert_sequence 79 # define OBJ_netscape_cert_sequence OBJ_netscape_data_type,5L # define SN_desx_cbc "DESX-CBC" # define LN_desx_cbc "desx-cbc" # define NID_desx_cbc 80 # define SN_id_ce "id-ce" # define NID_id_ce 81 # define OBJ_id_ce 2L,5L,29L # define SN_subject_key_identifier "subjectKeyIdentifier" # define LN_subject_key_identifier "X509v3 Subject Key Identifier" # define NID_subject_key_identifier 82 # define OBJ_subject_key_identifier OBJ_id_ce,14L # define SN_key_usage "keyUsage" # define LN_key_usage "X509v3 Key Usage" # define NID_key_usage 83 # define OBJ_key_usage OBJ_id_ce,15L # define SN_private_key_usage_period "privateKeyUsagePeriod" # define LN_private_key_usage_period "X509v3 Private Key Usage Period" # define NID_private_key_usage_period 84 # define OBJ_private_key_usage_period OBJ_id_ce,16L # define SN_subject_alt_name "subjectAltName" # define LN_subject_alt_name "X509v3 Subject Alternative Name" # define NID_subject_alt_name 85 # define OBJ_subject_alt_name OBJ_id_ce,17L # define SN_issuer_alt_name "issuerAltName" # define LN_issuer_alt_name "X509v3 Issuer Alternative Name" # define NID_issuer_alt_name 86 # define OBJ_issuer_alt_name OBJ_id_ce,18L # define SN_basic_constraints "basicConstraints" # define LN_basic_constraints "X509v3 Basic Constraints" # define NID_basic_constraints 87 # define OBJ_basic_constraints OBJ_id_ce,19L # define SN_crl_number "crlNumber" # define LN_crl_number "X509v3 CRL Number" # define NID_crl_number 88 # define OBJ_crl_number OBJ_id_ce,20L # define SN_certificate_policies "certificatePolicies" # define LN_certificate_policies "X509v3 Certificate Policies" # define NID_certificate_policies 89 # define OBJ_certificate_policies OBJ_id_ce,32L # define SN_authority_key_identifier "authorityKeyIdentifier" # define LN_authority_key_identifier "X509v3 Authority Key Identifier" # define NID_authority_key_identifier 90 # define OBJ_authority_key_identifier OBJ_id_ce,35L # define SN_bf_cbc "BF-CBC" # define LN_bf_cbc "bf-cbc" # define NID_bf_cbc 91 # define OBJ_bf_cbc 1L,3L,6L,1L,4L,1L,3029L,1L,2L # define SN_bf_ecb "BF-ECB" # define LN_bf_ecb "bf-ecb" # define NID_bf_ecb 92 # define SN_bf_cfb64 "BF-CFB" # define LN_bf_cfb64 "bf-cfb" # define NID_bf_cfb64 93 # define SN_bf_ofb64 "BF-OFB" # define LN_bf_ofb64 "bf-ofb" # define NID_bf_ofb64 94 # define SN_mdc2 "MDC2" # define LN_mdc2 "mdc2" # define NID_mdc2 95 # define OBJ_mdc2 2L,5L,8L,3L,101L /* An alternative? 1L,3L,14L,3L,2L,19L */ # define SN_mdc2WithRSA "RSA-MDC2" # define LN_mdc2WithRSA "mdc2withRSA" # define NID_mdc2WithRSA 96 # define OBJ_mdc2WithRSA 2L,5L,8L,3L,100L # define SN_rc4_40 "RC4-40" # define LN_rc4_40 "rc4-40" # define NID_rc4_40 97 # define SN_rc2_40_cbc "RC2-40-CBC" # define LN_rc2_40_cbc "rc2-40-cbc" # define NID_rc2_40_cbc 98 # define SN_givenName "G" # define LN_givenName "givenName" # define NID_givenName 99 # define OBJ_givenName OBJ_X509,42L # define SN_surname "S" # define LN_surname "surname" # define NID_surname 100 # define OBJ_surname OBJ_X509,4L # define SN_initials "I" # define LN_initials "initials" # define NID_initials 101 # define OBJ_initials OBJ_X509,43L # define SN_uniqueIdentifier "UID" # define LN_uniqueIdentifier "uniqueIdentifier" # define NID_uniqueIdentifier 102 # define OBJ_uniqueIdentifier OBJ_X509,45L # define SN_crl_distribution_points "crlDistributionPoints" # define LN_crl_distribution_points "X509v3 CRL Distribution Points" # define NID_crl_distribution_points 103 # define OBJ_crl_distribution_points OBJ_id_ce,31L # define SN_md5WithRSA "RSA-NP-MD5" # define LN_md5WithRSA "md5WithRSA" # define NID_md5WithRSA 104 # define OBJ_md5WithRSA OBJ_algorithm,3L # define SN_serialNumber "SN" # define LN_serialNumber "serialNumber" # define NID_serialNumber 105 # define OBJ_serialNumber OBJ_X509,5L # define SN_title "T" # define LN_title "title" # define NID_title 106 # define OBJ_title OBJ_X509,12L # define SN_description "D" # define LN_description "description" # define NID_description 107 # define OBJ_description OBJ_X509,13L /* CAST5 is CAST-128, I'm just sticking with the documentation */ # define SN_cast5_cbc "CAST5-CBC" # define LN_cast5_cbc "cast5-cbc" # define NID_cast5_cbc 108 # define OBJ_cast5_cbc 1L,2L,840L,113533L,7L,66L,10L # define SN_cast5_ecb "CAST5-ECB" # define LN_cast5_ecb "cast5-ecb" # define NID_cast5_ecb 109 # define SN_cast5_cfb64 "CAST5-CFB" # define LN_cast5_cfb64 "cast5-cfb" # define NID_cast5_cfb64 110 # define SN_cast5_ofb64 "CAST5-OFB" # define LN_cast5_ofb64 "cast5-ofb" # define NID_cast5_ofb64 111 # define LN_pbeWithMD5AndCast5_CBC "pbeWithMD5AndCast5CBC" # define NID_pbeWithMD5AndCast5_CBC 112 # define OBJ_pbeWithMD5AndCast5_CBC 1L,2L,840L,113533L,7L,66L,12L /*- * This is one sun will soon be using :-( * id-dsa-with-sha1 ID ::= { * iso(1) member-body(2) us(840) x9-57 (10040) x9cm(4) 3 } */ # define SN_dsaWithSHA1 "DSA-SHA1" # define LN_dsaWithSHA1 "dsaWithSHA1" # define NID_dsaWithSHA1 113 # define OBJ_dsaWithSHA1 1L,2L,840L,10040L,4L,3L # define NID_md5_sha1 114 # define SN_md5_sha1 "MD5-SHA1" # define LN_md5_sha1 "md5-sha1" # define SN_sha1WithRSA "RSA-SHA1-2" # define LN_sha1WithRSA "sha1WithRSA" # define NID_sha1WithRSA 115 # define OBJ_sha1WithRSA OBJ_algorithm,29L # define SN_dsa "DSA" # define LN_dsa "dsaEncryption" # define NID_dsa 116 # define OBJ_dsa 1L,2L,840L,10040L,4L,1L # define SN_ripemd160 "RIPEMD160" # define LN_ripemd160 "ripemd160" # define NID_ripemd160 117 # define OBJ_ripemd160 1L,3L,36L,3L,2L,1L /* * The name should actually be rsaSignatureWithripemd160, but I'm going to * continue using the convention I'm using with the other ciphers */ # define SN_ripemd160WithRSA "RSA-RIPEMD160" # define LN_ripemd160WithRSA "ripemd160WithRSA" # define NID_ripemd160WithRSA 119 # define OBJ_ripemd160WithRSA 1L,3L,36L,3L,3L,1L,2L /*- * Taken from rfc2040 * RC5_CBC_Parameters ::= SEQUENCE { * version INTEGER (v1_0(16)), * rounds INTEGER (8..127), * blockSizeInBits INTEGER (64, 128), * iv OCTET STRING OPTIONAL * } */ # define SN_rc5_cbc "RC5-CBC" # define LN_rc5_cbc "rc5-cbc" # define NID_rc5_cbc 120 # define OBJ_rc5_cbc OBJ_rsadsi,3L,8L # define SN_rc5_ecb "RC5-ECB" # define LN_rc5_ecb "rc5-ecb" # define NID_rc5_ecb 121 # define SN_rc5_cfb64 "RC5-CFB" # define LN_rc5_cfb64 "rc5-cfb" # define NID_rc5_cfb64 122 # define SN_rc5_ofb64 "RC5-OFB" # define LN_rc5_ofb64 "rc5-ofb" # define NID_rc5_ofb64 123 # define SN_rle_compression "RLE" # define LN_rle_compression "run length compression" # define NID_rle_compression 124 # define OBJ_rle_compression 1L,1L,1L,1L,666L,1L # define SN_zlib_compression "ZLIB" # define LN_zlib_compression "zlib compression" # define NID_zlib_compression 125 # define OBJ_zlib_compression 1L,1L,1L,1L,666L,2L # define SN_ext_key_usage "extendedKeyUsage" # define LN_ext_key_usage "X509v3 Extended Key Usage" # define NID_ext_key_usage 126 # define OBJ_ext_key_usage OBJ_id_ce,37 # define SN_id_pkix "PKIX" # define NID_id_pkix 127 # define OBJ_id_pkix 1L,3L,6L,1L,5L,5L,7L # define SN_id_kp "id-kp" # define NID_id_kp 128 # define OBJ_id_kp OBJ_id_pkix,3L /* PKIX extended key usage OIDs */ # define SN_server_auth "serverAuth" # define LN_server_auth "TLS Web Server Authentication" # define NID_server_auth 129 # define OBJ_server_auth OBJ_id_kp,1L # define SN_client_auth "clientAuth" # define LN_client_auth "TLS Web Client Authentication" # define NID_client_auth 130 # define OBJ_client_auth OBJ_id_kp,2L # define SN_code_sign "codeSigning" # define LN_code_sign "Code Signing" # define NID_code_sign 131 # define OBJ_code_sign OBJ_id_kp,3L # define SN_email_protect "emailProtection" # define LN_email_protect "E-mail Protection" # define NID_email_protect 132 # define OBJ_email_protect OBJ_id_kp,4L # define SN_time_stamp "timeStamping" # define LN_time_stamp "Time Stamping" # define NID_time_stamp 133 # define OBJ_time_stamp OBJ_id_kp,8L /* Additional extended key usage OIDs: Microsoft */ # define SN_ms_code_ind "msCodeInd" # define LN_ms_code_ind "Microsoft Individual Code Signing" # define NID_ms_code_ind 134 # define OBJ_ms_code_ind 1L,3L,6L,1L,4L,1L,311L,2L,1L,21L # define SN_ms_code_com "msCodeCom" # define LN_ms_code_com "Microsoft Commercial Code Signing" # define NID_ms_code_com 135 # define OBJ_ms_code_com 1L,3L,6L,1L,4L,1L,311L,2L,1L,22L # define SN_ms_ctl_sign "msCTLSign" # define LN_ms_ctl_sign "Microsoft Trust List Signing" # define NID_ms_ctl_sign 136 # define OBJ_ms_ctl_sign 1L,3L,6L,1L,4L,1L,311L,10L,3L,1L # define SN_ms_sgc "msSGC" # define LN_ms_sgc "Microsoft Server Gated Crypto" # define NID_ms_sgc 137 # define OBJ_ms_sgc 1L,3L,6L,1L,4L,1L,311L,10L,3L,3L # define SN_ms_efs "msEFS" # define LN_ms_efs "Microsoft Encrypted File System" # define NID_ms_efs 138 # define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L /* Additional usage: Netscape */ # define SN_ns_sgc "nsSGC" # define LN_ns_sgc "Netscape Server Gated Crypto" # define NID_ns_sgc 139 # define OBJ_ns_sgc OBJ_netscape,4L,1L # define SN_delta_crl "deltaCRL" # define LN_delta_crl "X509v3 Delta CRL Indicator" # define NID_delta_crl 140 # define OBJ_delta_crl OBJ_id_ce,27L # define SN_crl_reason "CRLReason" # define LN_crl_reason "CRL Reason Code" # define NID_crl_reason 141 # define OBJ_crl_reason OBJ_id_ce,21L # define SN_invalidity_date "invalidityDate" # define LN_invalidity_date "Invalidity Date" # define NID_invalidity_date 142 # define OBJ_invalidity_date OBJ_id_ce,24L # define SN_sxnet "SXNetID" # define LN_sxnet "Strong Extranet ID" # define NID_sxnet 143 # define OBJ_sxnet 1L,3L,101L,1L,4L,1L /* PKCS12 and related OBJECT IDENTIFIERS */ # define OBJ_pkcs12 OBJ_pkcs,12L # define OBJ_pkcs12_pbeids OBJ_pkcs12, 1 # define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128" # define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" # define NID_pbe_WithSHA1And128BitRC4 144 # define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids, 1L # define SN_pbe_WithSHA1And40BitRC4 "PBE-SHA1-RC4-40" # define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" # define NID_pbe_WithSHA1And40BitRC4 145 # define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids, 2L # define SN_pbe_WithSHA1And3_Key_TripleDES_CBC "PBE-SHA1-3DES" # define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" # define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 # define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids, 3L # define SN_pbe_WithSHA1And2_Key_TripleDES_CBC "PBE-SHA1-2DES" # define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" # define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 # define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids, 4L # define SN_pbe_WithSHA1And128BitRC2_CBC "PBE-SHA1-RC2-128" # define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" # define NID_pbe_WithSHA1And128BitRC2_CBC 148 # define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids, 5L # define SN_pbe_WithSHA1And40BitRC2_CBC "PBE-SHA1-RC2-40" # define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" # define NID_pbe_WithSHA1And40BitRC2_CBC 149 # define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids, 6L # define OBJ_pkcs12_Version1 OBJ_pkcs12, 10L # define OBJ_pkcs12_BagIds OBJ_pkcs12_Version1, 1L # define LN_keyBag "keyBag" # define NID_keyBag 150 # define OBJ_keyBag OBJ_pkcs12_BagIds, 1L # define LN_pkcs8ShroudedKeyBag "pkcs8ShroudedKeyBag" # define NID_pkcs8ShroudedKeyBag 151 # define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds, 2L # define LN_certBag "certBag" # define NID_certBag 152 # define OBJ_certBag OBJ_pkcs12_BagIds, 3L # define LN_crlBag "crlBag" # define NID_crlBag 153 # define OBJ_crlBag OBJ_pkcs12_BagIds, 4L # define LN_secretBag "secretBag" # define NID_secretBag 154 # define OBJ_secretBag OBJ_pkcs12_BagIds, 5L # define LN_safeContentsBag "safeContentsBag" # define NID_safeContentsBag 155 # define OBJ_safeContentsBag OBJ_pkcs12_BagIds, 6L # define LN_friendlyName "friendlyName" # define NID_friendlyName 156 # define OBJ_friendlyName OBJ_pkcs9, 20L # define LN_localKeyID "localKeyID" # define NID_localKeyID 157 # define OBJ_localKeyID OBJ_pkcs9, 21L # define OBJ_certTypes OBJ_pkcs9, 22L # define LN_x509Certificate "x509Certificate" # define NID_x509Certificate 158 # define OBJ_x509Certificate OBJ_certTypes, 1L # define LN_sdsiCertificate "sdsiCertificate" # define NID_sdsiCertificate 159 # define OBJ_sdsiCertificate OBJ_certTypes, 2L # define OBJ_crlTypes OBJ_pkcs9, 23L # define LN_x509Crl "x509Crl" # define NID_x509Crl 160 # define OBJ_x509Crl OBJ_crlTypes, 1L /* PKCS#5 v2 OIDs */ # define LN_pbes2 "PBES2" # define NID_pbes2 161 # define OBJ_pbes2 OBJ_pkcs,5L,13L # define LN_pbmac1 "PBMAC1" # define NID_pbmac1 162 # define OBJ_pbmac1 OBJ_pkcs,5L,14L # define LN_hmacWithSHA1 "hmacWithSHA1" # define NID_hmacWithSHA1 163 # define OBJ_hmacWithSHA1 OBJ_rsadsi,2L,7L /* Policy Qualifier Ids */ # define LN_id_qt_cps "Policy Qualifier CPS" # define SN_id_qt_cps "id-qt-cps" # define NID_id_qt_cps 164 # define OBJ_id_qt_cps OBJ_id_pkix,2L,1L # define LN_id_qt_unotice "Policy Qualifier User Notice" # define SN_id_qt_unotice "id-qt-unotice" # define NID_id_qt_unotice 165 # define OBJ_id_qt_unotice OBJ_id_pkix,2L,2L # define SN_rc2_64_cbc "RC2-64-CBC" # define LN_rc2_64_cbc "rc2-64-cbc" # define NID_rc2_64_cbc 166 # define SN_SMIMECapabilities "SMIME-CAPS" # define LN_SMIMECapabilities "S/MIME Capabilities" # define NID_SMIMECapabilities 167 # define OBJ_SMIMECapabilities OBJ_pkcs9,15L # define SN_pbeWithMD2AndRC2_CBC "PBE-MD2-RC2-64" # define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" # define NID_pbeWithMD2AndRC2_CBC 168 # define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs,5L,4L # define SN_pbeWithMD5AndRC2_CBC "PBE-MD5-RC2-64" # define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" # define NID_pbeWithMD5AndRC2_CBC 169 # define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs,5L,6L # define SN_pbeWithSHA1AndDES_CBC "PBE-SHA1-DES" # define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" # define NID_pbeWithSHA1AndDES_CBC 170 # define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs,5L,10L /* Extension request OIDs */ # define LN_ms_ext_req "Microsoft Extension Request" # define SN_ms_ext_req "msExtReq" # define NID_ms_ext_req 171 # define OBJ_ms_ext_req 1L,3L,6L,1L,4L,1L,311L,2L,1L,14L # define LN_ext_req "Extension Request" # define SN_ext_req "extReq" # define NID_ext_req 172 # define OBJ_ext_req OBJ_pkcs9,14L # define SN_name "name" # define LN_name "name" # define NID_name 173 # define OBJ_name OBJ_X509,41L # define SN_dnQualifier "dnQualifier" # define LN_dnQualifier "dnQualifier" # define NID_dnQualifier 174 # define OBJ_dnQualifier OBJ_X509,46L # define SN_id_pe "id-pe" # define NID_id_pe 175 # define OBJ_id_pe OBJ_id_pkix,1L # define SN_id_ad "id-ad" # define NID_id_ad 176 # define OBJ_id_ad OBJ_id_pkix,48L # define SN_info_access "authorityInfoAccess" # define LN_info_access "Authority Information Access" # define NID_info_access 177 # define OBJ_info_access OBJ_id_pe,1L # define SN_ad_OCSP "OCSP" # define LN_ad_OCSP "OCSP" # define NID_ad_OCSP 178 # define OBJ_ad_OCSP OBJ_id_ad,1L # define SN_ad_ca_issuers "caIssuers" # define LN_ad_ca_issuers "CA Issuers" # define NID_ad_ca_issuers 179 # define OBJ_ad_ca_issuers OBJ_id_ad,2L # define SN_OCSP_sign "OCSPSigning" # define LN_OCSP_sign "OCSP Signing" # define NID_OCSP_sign 180 # define OBJ_OCSP_sign OBJ_id_kp,9L # endif /* USE_OBJ_MAC */ # include <openssl/bio.h> # include <openssl/asn1.h> # define OBJ_NAME_TYPE_UNDEF 0x00 # define OBJ_NAME_TYPE_MD_METH 0x01 # define OBJ_NAME_TYPE_CIPHER_METH 0x02 # define OBJ_NAME_TYPE_PKEY_METH 0x03 # define OBJ_NAME_TYPE_COMP_METH 0x04 # define OBJ_NAME_TYPE_NUM 0x05 # define OBJ_NAME_ALIAS 0x8000 # define OBJ_BSEARCH_VALUE_ON_NOMATCH 0x01 # define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH 0x02 #ifdef __cplusplus extern "C" { #endif typedef struct obj_name_st { int type; int alias; const char *name; const char *data; } OBJ_NAME; # define OBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c) int OBJ_NAME_init(void); int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *), int (*cmp_func) (const char *, const char *), void (*free_func) (const char *, int, const char *)); const char *OBJ_NAME_get(const char *name, int type); int OBJ_NAME_add(const char *name, int type, const char *data); int OBJ_NAME_remove(const char *name, int type); void OBJ_NAME_cleanup(int type); /* -1 for everything */ void OBJ_NAME_do_all(int type, void (*fn) (const OBJ_NAME *, void *arg), void *arg); void OBJ_NAME_do_all_sorted(int type, void (*fn) (const OBJ_NAME *, void *arg), void *arg); ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o); ASN1_OBJECT *OBJ_nid2obj(int n); const char *OBJ_nid2ln(int n); const char *OBJ_nid2sn(int n); int OBJ_obj2nid(const ASN1_OBJECT *o); ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name); int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name); int OBJ_txt2nid(const char *s); int OBJ_ln2nid(const char *s); int OBJ_sn2nid(const char *s); int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b); const void *OBJ_bsearch_(const void *key, const void *base, int num, int size, int (*cmp) (const void *, const void *)); const void *OBJ_bsearch_ex_(const void *key, const void *base, int num, int size, int (*cmp) (const void *, const void *), int flags); # define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm) \ static int nm##_cmp_BSEARCH_CMP_FN(const void *, const void *); \ static int nm##_cmp(type1 const *, type2 const *); \ scope type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) # define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp) \ _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp) # define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) /*- * Unsolved problem: if a type is actually a pointer type, like * nid_triple is, then its impossible to get a const where you need * it. Consider: * * typedef int nid_triple[3]; * const void *a_; * const nid_triple const *a = a_; * * The assignement discards a const because what you really want is: * * const int const * const *a = a_; * * But if you do that, you lose the fact that a is an array of 3 ints, * which breaks comparison functions. * * Thus we end up having to cast, sadly, or unpack the * declarations. Or, as I finally did in this case, delcare nid_triple * to be a struct, which it should have been in the first place. * * Ben, August 2008. * * Also, strictly speaking not all types need be const, but handling * the non-constness means a lot of complication, and in practice * comparison routines do always not touch their arguments. */ # define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, nm) \ static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ { \ type1 const *a = a_; \ type2 const *b = b_; \ return nm##_cmp(a,b); \ } \ static type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ { \ return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ nm##_cmp_BSEARCH_CMP_FN); \ } \ extern void dummy_prototype(void) # define IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ { \ type1 const *a = a_; \ type2 const *b = b_; \ return nm##_cmp(a,b); \ } \ type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ { \ return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ nm##_cmp_BSEARCH_CMP_FN); \ } \ extern void dummy_prototype(void) # define OBJ_bsearch(type1,key,type2,base,num,cmp) \ ((type2 *)OBJ_bsearch_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ num,sizeof(type2), \ ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ (void)CHECKED_PTR_OF(type2,cmp##_type_2), \ cmp##_BSEARCH_CMP_FN))) # define OBJ_bsearch_ex(type1,key,type2,base,num,cmp,flags) \ ((type2 *)OBJ_bsearch_ex_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ num,sizeof(type2), \ ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ (void)type_2=CHECKED_PTR_OF(type2,cmp##_type_2), \ cmp##_BSEARCH_CMP_FN)),flags) int OBJ_new_nid(int num); int OBJ_add_object(const ASN1_OBJECT *obj); int OBJ_create(const char *oid, const char *sn, const char *ln); void OBJ_cleanup(void); int OBJ_create_objects(BIO *in); int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid); int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid); int OBJ_add_sigid(int signid, int dig_id, int pkey_id); void OBJ_sigid_free(void); extern int obj_cleanup_defer; void check_defer(int nid); /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_OBJ_strings(void); /* Error codes for the OBJ functions. */ /* Function codes. */ # define OBJ_F_OBJ_ADD_OBJECT 105 # define OBJ_F_OBJ_CREATE 100 # define OBJ_F_OBJ_DUP 101 # define OBJ_F_OBJ_NAME_NEW_INDEX 106 # define OBJ_F_OBJ_NID2LN 102 # define OBJ_F_OBJ_NID2OBJ 103 # define OBJ_F_OBJ_NID2SN 104 /* Reason codes. */ # define OBJ_R_MALLOC_FAILURE 100 # define OBJ_R_UNKNOWN_NID 101 #ifdef __cplusplus } #endif #endif ����������������������������������������������������openssl/symhacks.h����������������������������������������������������������������������������������0000644�����������������00000066056�14763166030�0010245 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ==================================================================== * Copyright (c) 1999 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_SYMHACKS_H # define HEADER_SYMHACKS_H # include <openssl/e_os2.h> /* * Hacks to solve the problem with linkers incapable of handling very long * symbol names. In the case of VMS, the limit is 31 characters on VMS for * VAX. */ /* * Note that this affects util/libeay.num and util/ssleay.num... you may * change those manually, but that's not recommended, as those files are * controlled centrally and updated on Unix, and the central definition may * disagree with yours, which in turn may come with shareable library * incompatibilities. */ # ifdef OPENSSL_SYS_VMS /* Hack a long name in crypto/ex_data.c */ # undef CRYPTO_get_ex_data_implementation # define CRYPTO_get_ex_data_implementation CRYPTO_get_ex_data_impl # undef CRYPTO_set_ex_data_implementation # define CRYPTO_set_ex_data_implementation CRYPTO_set_ex_data_impl /* Hack a long name in crypto/asn1/a_mbstr.c */ # undef ASN1_STRING_set_default_mask_asc # define ASN1_STRING_set_default_mask_asc ASN1_STRING_set_def_mask_asc # if 0 /* No longer needed, since safestack macro * magic does the job */ /* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) */ # undef i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO # define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO i2d_ASN1_SET_OF_PKCS7_SIGINF # undef d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO # define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO d2i_ASN1_SET_OF_PKCS7_SIGINF # endif # if 0 /* No longer needed, since safestack macro * magic does the job */ /* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO) */ # undef i2d_ASN1_SET_OF_PKCS7_RECIP_INFO # define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO i2d_ASN1_SET_OF_PKCS7_RECINF # undef d2i_ASN1_SET_OF_PKCS7_RECIP_INFO # define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO d2i_ASN1_SET_OF_PKCS7_RECINF # endif # if 0 /* No longer needed, since safestack macro * magic does the job */ /* Hack the names created with DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) */ # undef i2d_ASN1_SET_OF_ACCESS_DESCRIPTION # define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION i2d_ASN1_SET_OF_ACC_DESC # undef d2i_ASN1_SET_OF_ACCESS_DESCRIPTION # define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION d2i_ASN1_SET_OF_ACC_DESC # endif /* Hack the names created with DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE) */ # undef PEM_read_NETSCAPE_CERT_SEQUENCE # define PEM_read_NETSCAPE_CERT_SEQUENCE PEM_read_NS_CERT_SEQ # undef PEM_write_NETSCAPE_CERT_SEQUENCE # define PEM_write_NETSCAPE_CERT_SEQUENCE PEM_write_NS_CERT_SEQ # undef PEM_read_bio_NETSCAPE_CERT_SEQUENCE # define PEM_read_bio_NETSCAPE_CERT_SEQUENCE PEM_read_bio_NS_CERT_SEQ # undef PEM_write_bio_NETSCAPE_CERT_SEQUENCE # define PEM_write_bio_NETSCAPE_CERT_SEQUENCE PEM_write_bio_NS_CERT_SEQ # undef PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE # define PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE PEM_write_cb_bio_NS_CERT_SEQ /* Hack the names created with DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO) */ # undef PEM_read_PKCS8_PRIV_KEY_INFO # define PEM_read_PKCS8_PRIV_KEY_INFO PEM_read_P8_PRIV_KEY_INFO # undef PEM_write_PKCS8_PRIV_KEY_INFO # define PEM_write_PKCS8_PRIV_KEY_INFO PEM_write_P8_PRIV_KEY_INFO # undef PEM_read_bio_PKCS8_PRIV_KEY_INFO # define PEM_read_bio_PKCS8_PRIV_KEY_INFO PEM_read_bio_P8_PRIV_KEY_INFO # undef PEM_write_bio_PKCS8_PRIV_KEY_INFO # define PEM_write_bio_PKCS8_PRIV_KEY_INFO PEM_write_bio_P8_PRIV_KEY_INFO # undef PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO # define PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO PEM_wrt_cb_bio_P8_PRIV_KEY_INFO /* Hack other PEM names */ # undef PEM_write_bio_PKCS8PrivateKey_nid # define PEM_write_bio_PKCS8PrivateKey_nid PEM_write_bio_PKCS8PrivKey_nid /* Hack some long X509 names */ # undef X509_REVOKED_get_ext_by_critical # define X509_REVOKED_get_ext_by_critical X509_REVOKED_get_ext_by_critic # undef X509_policy_tree_get0_user_policies # define X509_policy_tree_get0_user_policies X509_pcy_tree_get0_usr_policies # undef X509_policy_node_get0_qualifiers # define X509_policy_node_get0_qualifiers X509_pcy_node_get0_qualifiers # undef X509_STORE_CTX_get_explicit_policy # define X509_STORE_CTX_get_explicit_policy X509_STORE_CTX_get_expl_policy # undef X509_STORE_CTX_get0_current_issuer # define X509_STORE_CTX_get0_current_issuer X509_STORE_CTX_get0_cur_issuer /* Hack some long CRYPTO names */ # undef CRYPTO_set_dynlock_destroy_callback # define CRYPTO_set_dynlock_destroy_callback CRYPTO_set_dynlock_destroy_cb # undef CRYPTO_set_dynlock_create_callback # define CRYPTO_set_dynlock_create_callback CRYPTO_set_dynlock_create_cb # undef CRYPTO_set_dynlock_lock_callback # define CRYPTO_set_dynlock_lock_callback CRYPTO_set_dynlock_lock_cb # undef CRYPTO_get_dynlock_lock_callback # define CRYPTO_get_dynlock_lock_callback CRYPTO_get_dynlock_lock_cb # undef CRYPTO_get_dynlock_destroy_callback # define CRYPTO_get_dynlock_destroy_callback CRYPTO_get_dynlock_destroy_cb # undef CRYPTO_get_dynlock_create_callback # define CRYPTO_get_dynlock_create_callback CRYPTO_get_dynlock_create_cb # undef CRYPTO_set_locked_mem_ex_functions # define CRYPTO_set_locked_mem_ex_functions CRYPTO_set_locked_mem_ex_funcs # undef CRYPTO_get_locked_mem_ex_functions # define CRYPTO_get_locked_mem_ex_functions CRYPTO_get_locked_mem_ex_funcs /* Hack some long SSL/TLS names */ # undef SSL_CTX_set_default_verify_paths # define SSL_CTX_set_default_verify_paths SSL_CTX_set_def_verify_paths # undef SSL_get_ex_data_X509_STORE_CTX_idx # define SSL_get_ex_data_X509_STORE_CTX_idx SSL_get_ex_d_X509_STORE_CTX_idx # undef SSL_add_file_cert_subjects_to_stack # define SSL_add_file_cert_subjects_to_stack SSL_add_file_cert_subjs_to_stk # undef SSL_add_dir_cert_subjects_to_stack # define SSL_add_dir_cert_subjects_to_stack SSL_add_dir_cert_subjs_to_stk # undef SSL_CTX_use_certificate_chain_file # define SSL_CTX_use_certificate_chain_file SSL_CTX_use_cert_chain_file # undef SSL_CTX_set_cert_verify_callback # define SSL_CTX_set_cert_verify_callback SSL_CTX_set_cert_verify_cb # undef SSL_CTX_set_default_passwd_cb_userdata # define SSL_CTX_set_default_passwd_cb_userdata SSL_CTX_set_def_passwd_cb_ud # undef SSL_COMP_get_compression_methods # define SSL_COMP_get_compression_methods SSL_COMP_get_compress_methods # undef SSL_COMP_set0_compression_methods # define SSL_COMP_set0_compression_methods SSL_COMP_set0_compress_methods # undef SSL_COMP_free_compression_methods # define SSL_COMP_free_compression_methods SSL_COMP_free_compress_methods # undef ssl_add_clienthello_renegotiate_ext # define ssl_add_clienthello_renegotiate_ext ssl_add_clienthello_reneg_ext # undef ssl_add_serverhello_renegotiate_ext # define ssl_add_serverhello_renegotiate_ext ssl_add_serverhello_reneg_ext # undef ssl_parse_clienthello_renegotiate_ext # define ssl_parse_clienthello_renegotiate_ext ssl_parse_clienthello_reneg_ext # undef ssl_parse_serverhello_renegotiate_ext # define ssl_parse_serverhello_renegotiate_ext ssl_parse_serverhello_reneg_ext # undef SSL_srp_server_param_with_username # define SSL_srp_server_param_with_username SSL_srp_server_param_with_un # undef SSL_CTX_set_srp_client_pwd_callback # define SSL_CTX_set_srp_client_pwd_callback SSL_CTX_set_srp_client_pwd_cb # undef SSL_CTX_set_srp_verify_param_callback # define SSL_CTX_set_srp_verify_param_callback SSL_CTX_set_srp_vfy_param_cb # undef SSL_CTX_set_srp_username_callback # define SSL_CTX_set_srp_username_callback SSL_CTX_set_srp_un_cb # undef ssl_add_clienthello_use_srtp_ext # define ssl_add_clienthello_use_srtp_ext ssl_add_clihello_use_srtp_ext # undef ssl_add_serverhello_use_srtp_ext # define ssl_add_serverhello_use_srtp_ext ssl_add_serhello_use_srtp_ext # undef ssl_parse_clienthello_use_srtp_ext # define ssl_parse_clienthello_use_srtp_ext ssl_parse_clihello_use_srtp_ext # undef ssl_parse_serverhello_use_srtp_ext # define ssl_parse_serverhello_use_srtp_ext ssl_parse_serhello_use_srtp_ext # undef SSL_CTX_set_next_protos_advertised_cb # define SSL_CTX_set_next_protos_advertised_cb SSL_CTX_set_next_protos_adv_cb # undef SSL_CTX_set_next_proto_select_cb # define SSL_CTX_set_next_proto_select_cb SSL_CTX_set_next_proto_sel_cb # undef tls1_send_server_supplemental_data # define tls1_send_server_supplemental_data tls1_send_server_suppl_data # undef tls1_send_client_supplemental_data # define tls1_send_client_supplemental_data tls1_send_client_suppl_data # undef tls1_get_server_supplemental_data # define tls1_get_server_supplemental_data tls1_get_server_suppl_data # undef tls1_get_client_supplemental_data # define tls1_get_client_supplemental_data tls1_get_client_suppl_data # undef ssl3_cbc_record_digest_supported # define ssl3_cbc_record_digest_supported ssl3_cbc_record_digest_support # undef ssl_check_clienthello_tlsext_late # define ssl_check_clienthello_tlsext_late ssl_check_clihello_tlsext_late # undef ssl_check_clienthello_tlsext_early # define ssl_check_clienthello_tlsext_early ssl_check_clihello_tlsext_early /* Hack some RSA long names */ # undef RSA_padding_check_PKCS1_OAEP_mgf1 # define RSA_padding_check_PKCS1_OAEP_mgf1 RSA_pad_check_PKCS1_OAEP_mgf1 /* Hack some ENGINE long names */ # undef ENGINE_get_default_BN_mod_exp_crt # define ENGINE_get_default_BN_mod_exp_crt ENGINE_get_def_BN_mod_exp_crt # undef ENGINE_set_default_BN_mod_exp_crt # define ENGINE_set_default_BN_mod_exp_crt ENGINE_set_def_BN_mod_exp_crt # undef ENGINE_set_load_privkey_function # define ENGINE_set_load_privkey_function ENGINE_set_load_privkey_fn # undef ENGINE_get_load_privkey_function # define ENGINE_get_load_privkey_function ENGINE_get_load_privkey_fn # undef ENGINE_unregister_pkey_asn1_meths # define ENGINE_unregister_pkey_asn1_meths ENGINE_unreg_pkey_asn1_meths # undef ENGINE_register_all_pkey_asn1_meths # define ENGINE_register_all_pkey_asn1_meths ENGINE_reg_all_pkey_asn1_meths # undef ENGINE_set_default_pkey_asn1_meths # define ENGINE_set_default_pkey_asn1_meths ENGINE_set_def_pkey_asn1_meths # undef ENGINE_get_pkey_asn1_meth_engine # define ENGINE_get_pkey_asn1_meth_engine ENGINE_get_pkey_asn1_meth_eng # undef ENGINE_set_load_ssl_client_cert_function # define ENGINE_set_load_ssl_client_cert_function \ ENGINE_set_ld_ssl_clnt_cert_fn # undef ENGINE_get_ssl_client_cert_function # define ENGINE_get_ssl_client_cert_function ENGINE_get_ssl_client_cert_fn /* Hack some long OCSP names */ # undef OCSP_REQUEST_get_ext_by_critical # define OCSP_REQUEST_get_ext_by_critical OCSP_REQUEST_get_ext_by_crit # undef OCSP_BASICRESP_get_ext_by_critical # define OCSP_BASICRESP_get_ext_by_critical OCSP_BASICRESP_get_ext_by_crit # undef OCSP_SINGLERESP_get_ext_by_critical # define OCSP_SINGLERESP_get_ext_by_critical OCSP_SINGLERESP_get_ext_by_crit /* Hack some long DES names */ # undef _ossl_old_des_ede3_cfb64_encrypt # define _ossl_old_des_ede3_cfb64_encrypt _ossl_odes_ede3_cfb64_encrypt # undef _ossl_old_des_ede3_ofb64_encrypt # define _ossl_old_des_ede3_ofb64_encrypt _ossl_odes_ede3_ofb64_encrypt /* Hack some long EVP names */ # undef OPENSSL_add_all_algorithms_noconf # define OPENSSL_add_all_algorithms_noconf OPENSSL_add_all_algo_noconf # undef OPENSSL_add_all_algorithms_conf # define OPENSSL_add_all_algorithms_conf OPENSSL_add_all_algo_conf # undef EVP_PKEY_meth_set_verify_recover # define EVP_PKEY_meth_set_verify_recover EVP_PKEY_meth_set_vrfy_recover /* Hack some long EC names */ # undef EC_GROUP_set_point_conversion_form # define EC_GROUP_set_point_conversion_form EC_GROUP_set_point_conv_form # undef EC_GROUP_get_point_conversion_form # define EC_GROUP_get_point_conversion_form EC_GROUP_get_point_conv_form # undef EC_GROUP_clear_free_all_extra_data # define EC_GROUP_clear_free_all_extra_data EC_GROUP_clr_free_all_xtra_data # undef EC_KEY_set_public_key_affine_coordinates # define EC_KEY_set_public_key_affine_coordinates \ EC_KEY_set_pub_key_aff_coords # undef EC_POINT_set_Jprojective_coordinates_GFp # define EC_POINT_set_Jprojective_coordinates_GFp \ EC_POINT_set_Jproj_coords_GFp # undef EC_POINT_get_Jprojective_coordinates_GFp # define EC_POINT_get_Jprojective_coordinates_GFp \ EC_POINT_get_Jproj_coords_GFp # undef EC_POINT_set_affine_coordinates_GFp # define EC_POINT_set_affine_coordinates_GFp EC_POINT_set_affine_coords_GFp # undef EC_POINT_get_affine_coordinates_GFp # define EC_POINT_get_affine_coordinates_GFp EC_POINT_get_affine_coords_GFp # undef EC_POINT_set_compressed_coordinates_GFp # define EC_POINT_set_compressed_coordinates_GFp EC_POINT_set_compr_coords_GFp # undef EC_POINT_set_affine_coordinates_GF2m # define EC_POINT_set_affine_coordinates_GF2m EC_POINT_set_affine_coords_GF2m # undef EC_POINT_get_affine_coordinates_GF2m # define EC_POINT_get_affine_coordinates_GF2m EC_POINT_get_affine_coords_GF2m # undef EC_POINT_set_compressed_coordinates_GF2m # define EC_POINT_set_compressed_coordinates_GF2m \ EC_POINT_set_compr_coords_GF2m # undef ec_GF2m_simple_group_clear_finish # define ec_GF2m_simple_group_clear_finish ec_GF2m_simple_grp_clr_finish # undef ec_GF2m_simple_group_check_discriminant # define ec_GF2m_simple_group_check_discriminant ec_GF2m_simple_grp_chk_discrim # undef ec_GF2m_simple_point_clear_finish # define ec_GF2m_simple_point_clear_finish ec_GF2m_simple_pt_clr_finish # undef ec_GF2m_simple_point_set_to_infinity # define ec_GF2m_simple_point_set_to_infinity ec_GF2m_simple_pt_set_to_inf # undef ec_GF2m_simple_points_make_affine # define ec_GF2m_simple_points_make_affine ec_GF2m_simple_pts_make_affine # undef ec_GF2m_simple_point_set_affine_coordinates # define ec_GF2m_simple_point_set_affine_coordinates \ ec_GF2m_smp_pt_set_af_coords # undef ec_GF2m_simple_point_get_affine_coordinates # define ec_GF2m_simple_point_get_affine_coordinates \ ec_GF2m_smp_pt_get_af_coords # undef ec_GF2m_simple_set_compressed_coordinates # define ec_GF2m_simple_set_compressed_coordinates \ ec_GF2m_smp_set_compr_coords # undef ec_GFp_simple_group_set_curve_GFp # define ec_GFp_simple_group_set_curve_GFp ec_GFp_simple_grp_set_curve_GFp # undef ec_GFp_simple_group_get_curve_GFp # define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp # undef ec_GFp_simple_group_clear_finish # define ec_GFp_simple_group_clear_finish ec_GFp_simple_grp_clear_finish # undef ec_GFp_simple_group_set_generator # define ec_GFp_simple_group_set_generator ec_GFp_simple_grp_set_generator # undef ec_GFp_simple_group_get0_generator # define ec_GFp_simple_group_get0_generator ec_GFp_simple_grp_gt0_generator # undef ec_GFp_simple_group_get_cofactor # define ec_GFp_simple_group_get_cofactor ec_GFp_simple_grp_get_cofactor # undef ec_GFp_simple_point_clear_finish # define ec_GFp_simple_point_clear_finish ec_GFp_simple_pt_clear_finish # undef ec_GFp_simple_point_set_to_infinity # define ec_GFp_simple_point_set_to_infinity ec_GFp_simple_pt_set_to_inf # undef ec_GFp_simple_points_make_affine # define ec_GFp_simple_points_make_affine ec_GFp_simple_pts_make_affine # undef ec_GFp_simple_set_Jprojective_coordinates_GFp # define ec_GFp_simple_set_Jprojective_coordinates_GFp \ ec_GFp_smp_set_Jproj_coords_GFp # undef ec_GFp_simple_get_Jprojective_coordinates_GFp # define ec_GFp_simple_get_Jprojective_coordinates_GFp \ ec_GFp_smp_get_Jproj_coords_GFp # undef ec_GFp_simple_point_set_affine_coordinates_GFp # define ec_GFp_simple_point_set_affine_coordinates_GFp \ ec_GFp_smp_pt_set_af_coords_GFp # undef ec_GFp_simple_point_get_affine_coordinates_GFp # define ec_GFp_simple_point_get_affine_coordinates_GFp \ ec_GFp_smp_pt_get_af_coords_GFp # undef ec_GFp_simple_set_compressed_coordinates_GFp # define ec_GFp_simple_set_compressed_coordinates_GFp \ ec_GFp_smp_set_compr_coords_GFp # undef ec_GFp_simple_point_set_affine_coordinates # define ec_GFp_simple_point_set_affine_coordinates \ ec_GFp_smp_pt_set_af_coords # undef ec_GFp_simple_point_get_affine_coordinates # define ec_GFp_simple_point_get_affine_coordinates \ ec_GFp_smp_pt_get_af_coords # undef ec_GFp_simple_set_compressed_coordinates # define ec_GFp_simple_set_compressed_coordinates \ ec_GFp_smp_set_compr_coords # undef ec_GFp_simple_group_check_discriminant # define ec_GFp_simple_group_check_discriminant ec_GFp_simple_grp_chk_discrim /* Hack som long STORE names */ # undef STORE_method_set_initialise_function # define STORE_method_set_initialise_function STORE_meth_set_initialise_fn # undef STORE_method_set_cleanup_function # define STORE_method_set_cleanup_function STORE_meth_set_cleanup_fn # undef STORE_method_set_generate_function # define STORE_method_set_generate_function STORE_meth_set_generate_fn # undef STORE_method_set_modify_function # define STORE_method_set_modify_function STORE_meth_set_modify_fn # undef STORE_method_set_revoke_function # define STORE_method_set_revoke_function STORE_meth_set_revoke_fn # undef STORE_method_set_delete_function # define STORE_method_set_delete_function STORE_meth_set_delete_fn # undef STORE_method_set_list_start_function # define STORE_method_set_list_start_function STORE_meth_set_list_start_fn # undef STORE_method_set_list_next_function # define STORE_method_set_list_next_function STORE_meth_set_list_next_fn # undef STORE_method_set_list_end_function # define STORE_method_set_list_end_function STORE_meth_set_list_end_fn # undef STORE_method_set_update_store_function # define STORE_method_set_update_store_function STORE_meth_set_update_store_fn # undef STORE_method_set_lock_store_function # define STORE_method_set_lock_store_function STORE_meth_set_lock_store_fn # undef STORE_method_set_unlock_store_function # define STORE_method_set_unlock_store_function STORE_meth_set_unlock_store_fn # undef STORE_method_get_initialise_function # define STORE_method_get_initialise_function STORE_meth_get_initialise_fn # undef STORE_method_get_cleanup_function # define STORE_method_get_cleanup_function STORE_meth_get_cleanup_fn # undef STORE_method_get_generate_function # define STORE_method_get_generate_function STORE_meth_get_generate_fn # undef STORE_method_get_modify_function # define STORE_method_get_modify_function STORE_meth_get_modify_fn # undef STORE_method_get_revoke_function # define STORE_method_get_revoke_function STORE_meth_get_revoke_fn # undef STORE_method_get_delete_function # define STORE_method_get_delete_function STORE_meth_get_delete_fn # undef STORE_method_get_list_start_function # define STORE_method_get_list_start_function STORE_meth_get_list_start_fn # undef STORE_method_get_list_next_function # define STORE_method_get_list_next_function STORE_meth_get_list_next_fn # undef STORE_method_get_list_end_function # define STORE_method_get_list_end_function STORE_meth_get_list_end_fn # undef STORE_method_get_update_store_function # define STORE_method_get_update_store_function STORE_meth_get_update_store_fn # undef STORE_method_get_lock_store_function # define STORE_method_get_lock_store_function STORE_meth_get_lock_store_fn # undef STORE_method_get_unlock_store_function # define STORE_method_get_unlock_store_function STORE_meth_get_unlock_store_fn /* Hack some long TS names */ # undef TS_RESP_CTX_set_status_info_cond # define TS_RESP_CTX_set_status_info_cond TS_RESP_CTX_set_stat_info_cond # undef TS_RESP_CTX_set_clock_precision_digits # define TS_RESP_CTX_set_clock_precision_digits TS_RESP_CTX_set_clk_prec_digits # undef TS_CONF_set_clock_precision_digits # define TS_CONF_set_clock_precision_digits TS_CONF_set_clk_prec_digits /* Hack some long CMS names */ # undef CMS_RecipientInfo_ktri_get0_algs # define CMS_RecipientInfo_ktri_get0_algs CMS_RecipInfo_ktri_get0_algs # undef CMS_RecipientInfo_ktri_get0_signer_id # define CMS_RecipientInfo_ktri_get0_signer_id CMS_RecipInfo_ktri_get0_sigr_id # undef CMS_OtherRevocationInfoFormat_it # define CMS_OtherRevocationInfoFormat_it CMS_OtherRevocInfoFormat_it # undef CMS_KeyAgreeRecipientIdentifier_it # define CMS_KeyAgreeRecipientIdentifier_it CMS_KeyAgreeRecipIdentifier_it # undef CMS_OriginatorIdentifierOrKey_it # define CMS_OriginatorIdentifierOrKey_it CMS_OriginatorIdOrKey_it # undef cms_SignerIdentifier_get0_signer_id # define cms_SignerIdentifier_get0_signer_id cms_SignerId_get0_signer_id # undef CMS_RecipientInfo_kari_get0_orig_id # define CMS_RecipientInfo_kari_get0_orig_id CMS_RecipInfo_kari_get0_orig_id # undef CMS_RecipientInfo_kari_get0_reks # define CMS_RecipientInfo_kari_get0_reks CMS_RecipInfo_kari_get0_reks # undef CMS_RecipientEncryptedKey_cert_cmp # define CMS_RecipientEncryptedKey_cert_cmp CMS_RecipEncryptedKey_cert_cmp # undef CMS_RecipientInfo_kari_set0_pkey # define CMS_RecipientInfo_kari_set0_pkey CMS_RecipInfo_kari_set0_pkey # undef CMS_RecipientEncryptedKey_get0_id # define CMS_RecipientEncryptedKey_get0_id CMS_RecipEncryptedKey_get0_id # undef CMS_RecipientInfo_kari_orig_id_cmp # define CMS_RecipientInfo_kari_orig_id_cmp CMS_RecipInfo_kari_orig_id_cmp /* Hack some long DTLS1 names */ # undef dtls1_retransmit_buffered_messages # define dtls1_retransmit_buffered_messages dtls1_retransmit_buffered_msgs /* Hack some long SRP names */ # undef SRP_generate_server_master_secret # define SRP_generate_server_master_secret SRP_gen_server_master_secret # undef SRP_generate_client_master_secret # define SRP_generate_client_master_secret SRP_gen_client_master_secret /* Hack some long UI names */ # undef UI_method_get_prompt_constructor # define UI_method_get_prompt_constructor UI_method_get_prompt_constructr # undef UI_method_set_prompt_constructor # define UI_method_set_prompt_constructor UI_method_set_prompt_constructr # endif /* defined OPENSSL_SYS_VMS */ /* Case insensitive linking causes problems.... */ # if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) # undef ERR_load_CRYPTO_strings # define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings # undef OCSP_crlID_new # define OCSP_crlID_new OCSP_crlID2_new # undef d2i_ECPARAMETERS # define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS # undef i2d_ECPARAMETERS # define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS # undef d2i_ECPKPARAMETERS # define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS # undef i2d_ECPKPARAMETERS # define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS /* * These functions do not seem to exist! However, I'm paranoid... Original * command in x509v3.h: These functions are being redefined in another * directory, and clash when the linker is case-insensitive, so let's hide * them a little, by giving them an extra 'o' at the beginning of the name... */ # undef X509v3_cleanup_extensions # define X509v3_cleanup_extensions oX509v3_cleanup_extensions # undef X509v3_add_extension # define X509v3_add_extension oX509v3_add_extension # undef X509v3_add_netscape_extensions # define X509v3_add_netscape_extensions oX509v3_add_netscape_extensions # undef X509v3_add_standard_extensions # define X509v3_add_standard_extensions oX509v3_add_standard_extensions /* This one clashes with CMS_data_create */ # undef cms_Data_create # define cms_Data_create priv_cms_Data_create # endif #endif /* ! defined HEADER_VMS_IDHACKS_H */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/hmac.h��������������������������������������������������������������������������������������0000644�����������������00000010667�14763166030�0007330 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/hmac/hmac.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_HMAC_H # define HEADER_HMAC_H # include <openssl/opensslconf.h> # ifdef OPENSSL_NO_HMAC # error HMAC is disabled. # endif # include <openssl/evp.h> # define HMAC_MAX_MD_CBLOCK 128/* largest known is SHA512 */ #ifdef __cplusplus extern "C" { #endif typedef struct hmac_ctx_st { const EVP_MD *md; EVP_MD_CTX md_ctx; EVP_MD_CTX i_ctx; EVP_MD_CTX o_ctx; unsigned int key_length; unsigned char key[HMAC_MAX_MD_CBLOCK]; } HMAC_CTX; # define HMAC_size(e) (EVP_MD_size((e)->md)) void HMAC_CTX_init(HMAC_CTX *ctx); void HMAC_CTX_cleanup(HMAC_CTX *ctx); /* deprecated */ # define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */ int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md); int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md, ENGINE *impl); int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len); int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, const unsigned char *d, size_t n, unsigned char *md, unsigned int *md_len); int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); #ifdef __cplusplus } #endif #endif �������������������������������������������������������������������������openssl/blowfish.h����������������������������������������������������������������������������������0000644�����������������00000012347�14763166030�0010232 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/bf/blowfish.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_BLOWFISH_H # define HEADER_BLOWFISH_H # include <openssl/e_os2.h> #ifdef __cplusplus extern "C" { #endif # ifdef OPENSSL_NO_BF # error BF is disabled. # endif # define BF_ENCRYPT 1 # define BF_DECRYPT 0 /*- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * ! BF_LONG has to be at least 32 bits wide. If it's wider, then ! * ! BF_LONG_LOG2 has to be defined along. ! * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ # if defined(__LP32__) # define BF_LONG unsigned long # elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) # define BF_LONG unsigned long # define BF_LONG_LOG2 3 /* * _CRAY note. I could declare short, but I have no idea what impact * does it have on performance on none-T3E machines. I could declare * int, but at least on C90 sizeof(int) can be chosen at compile time. * So I've chosen long... * <appro@fy.chalmers.se> */ # else # define BF_LONG unsigned int # endif # define BF_ROUNDS 16 # define BF_BLOCK 8 typedef struct bf_key_st { BF_LONG P[BF_ROUNDS + 2]; BF_LONG S[4 * 256]; } BF_KEY; # ifdef OPENSSL_FIPS void private_BF_set_key(BF_KEY *key, int len, const unsigned char *data); # endif void BF_set_key(BF_KEY *key, int len, const unsigned char *data); void BF_encrypt(BF_LONG *data, const BF_KEY *key); void BF_decrypt(BF_LONG *data, const BF_KEY *key); void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, const BF_KEY *key, int enc); void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, const BF_KEY *schedule, unsigned char *ivec, int enc); void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, const BF_KEY *schedule, unsigned char *ivec, int *num, int enc); void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, const BF_KEY *schedule, unsigned char *ivec, int *num); const char *BF_options(void); #ifdef __cplusplus } #endif #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/idea.h��������������������������������������������������������������������������������������0000644�����������������00000011107�14763166030�0007310 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/idea/idea.h */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_IDEA_H # define HEADER_IDEA_H # include <openssl/opensslconf.h>/* IDEA_INT, OPENSSL_NO_IDEA */ # ifdef OPENSSL_NO_IDEA # error IDEA is disabled. # endif # define IDEA_ENCRYPT 1 # define IDEA_DECRYPT 0 # define IDEA_BLOCK 8 # define IDEA_KEY_LENGTH 16 #ifdef __cplusplus extern "C" { #endif typedef struct idea_key_st { IDEA_INT data[9][6]; } IDEA_KEY_SCHEDULE; const char *idea_options(void); void idea_ecb_encrypt(const unsigned char *in, unsigned char *out, IDEA_KEY_SCHEDULE *ks); # ifdef OPENSSL_FIPS void private_idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); # endif void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); void idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk); void idea_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int enc); void idea_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int *num, int enc); void idea_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int *num); void idea_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks); #ifdef __cplusplus } #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/x509.h��������������������������������������������������������������������������������������0000644�����������������00000150103�14763166030�0007113 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/x509/x509.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * ECDH support in OpenSSL originally developed by * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. */ #ifndef HEADER_X509_H # define HEADER_X509_H # include <openssl/e_os2.h> # include <openssl/symhacks.h> # ifndef OPENSSL_NO_BUFFER # include <openssl/buffer.h> # endif # ifndef OPENSSL_NO_EVP # include <openssl/evp.h> # endif # ifndef OPENSSL_NO_BIO # include <openssl/bio.h> # endif # include <openssl/stack.h> # include <openssl/asn1.h> # include <openssl/safestack.h> # ifndef OPENSSL_NO_EC # include <openssl/ec.h> # endif # ifndef OPENSSL_NO_ECDSA # include <openssl/ecdsa.h> # endif # ifndef OPENSSL_NO_ECDH # include <openssl/ecdh.h> # endif # ifndef OPENSSL_NO_DEPRECATED # ifndef OPENSSL_NO_RSA # include <openssl/rsa.h> # endif # ifndef OPENSSL_NO_DSA # include <openssl/dsa.h> # endif # ifndef OPENSSL_NO_DH # include <openssl/dh.h> # endif # endif # ifndef OPENSSL_NO_SHA # include <openssl/sha.h> # endif # include <openssl/ossl_typ.h> #ifdef __cplusplus extern "C" { #endif # ifdef OPENSSL_SYS_WIN32 /* Under Win32 these are defined in wincrypt.h */ # undef X509_NAME # undef X509_CERT_PAIR # undef X509_EXTENSIONS # endif # define X509_FILETYPE_PEM 1 # define X509_FILETYPE_ASN1 2 # define X509_FILETYPE_DEFAULT 3 # define X509v3_KU_DIGITAL_SIGNATURE 0x0080 # define X509v3_KU_NON_REPUDIATION 0x0040 # define X509v3_KU_KEY_ENCIPHERMENT 0x0020 # define X509v3_KU_DATA_ENCIPHERMENT 0x0010 # define X509v3_KU_KEY_AGREEMENT 0x0008 # define X509v3_KU_KEY_CERT_SIGN 0x0004 # define X509v3_KU_CRL_SIGN 0x0002 # define X509v3_KU_ENCIPHER_ONLY 0x0001 # define X509v3_KU_DECIPHER_ONLY 0x8000 # define X509v3_KU_UNDEF 0xffff typedef struct X509_objects_st { int nid; int (*a2i) (void); int (*i2a) (void); } X509_OBJECTS; struct X509_algor_st { ASN1_OBJECT *algorithm; ASN1_TYPE *parameter; } /* X509_ALGOR */ ; DECLARE_ASN1_SET_OF(X509_ALGOR) typedef STACK_OF(X509_ALGOR) X509_ALGORS; typedef struct X509_val_st { ASN1_TIME *notBefore; ASN1_TIME *notAfter; } X509_VAL; struct X509_pubkey_st { X509_ALGOR *algor; ASN1_BIT_STRING *public_key; EVP_PKEY *pkey; }; typedef struct X509_sig_st { X509_ALGOR *algor; ASN1_OCTET_STRING *digest; } X509_SIG; typedef struct X509_name_entry_st { ASN1_OBJECT *object; ASN1_STRING *value; int set; int size; /* temp variable */ } X509_NAME_ENTRY; DECLARE_STACK_OF(X509_NAME_ENTRY) DECLARE_ASN1_SET_OF(X509_NAME_ENTRY) /* we always keep X509_NAMEs in 2 forms. */ struct X509_name_st { STACK_OF(X509_NAME_ENTRY) *entries; int modified; /* true if 'bytes' needs to be built */ # ifndef OPENSSL_NO_BUFFER BUF_MEM *bytes; # else char *bytes; # endif /* unsigned long hash; Keep the hash around for lookups */ unsigned char *canon_enc; int canon_enclen; } /* X509_NAME */ ; DECLARE_STACK_OF(X509_NAME) # define X509_EX_V_NETSCAPE_HACK 0x8000 # define X509_EX_V_INIT 0x0001 typedef struct X509_extension_st { ASN1_OBJECT *object; ASN1_BOOLEAN critical; ASN1_OCTET_STRING *value; } X509_EXTENSION; typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS; DECLARE_STACK_OF(X509_EXTENSION) DECLARE_ASN1_SET_OF(X509_EXTENSION) /* a sequence of these are used */ typedef struct x509_attributes_st { ASN1_OBJECT *object; int single; /* 0 for a set, 1 for a single item (which is * wrong) */ union { char *ptr; /* * 0 */ STACK_OF(ASN1_TYPE) *set; /* * 1 */ ASN1_TYPE *single; } value; } X509_ATTRIBUTE; DECLARE_STACK_OF(X509_ATTRIBUTE) DECLARE_ASN1_SET_OF(X509_ATTRIBUTE) typedef struct X509_req_info_st { ASN1_ENCODING enc; ASN1_INTEGER *version; X509_NAME *subject; X509_PUBKEY *pubkey; /* d=2 hl=2 l= 0 cons: cont: 00 */ STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */ } X509_REQ_INFO; typedef struct X509_req_st { X509_REQ_INFO *req_info; X509_ALGOR *sig_alg; ASN1_BIT_STRING *signature; int references; } X509_REQ; typedef struct x509_cinf_st { ASN1_INTEGER *version; /* [ 0 ] default of v1 */ ASN1_INTEGER *serialNumber; X509_ALGOR *signature; X509_NAME *issuer; X509_VAL *validity; X509_NAME *subject; X509_PUBKEY *key; ASN1_BIT_STRING *issuerUID; /* [ 1 ] optional in v2 */ ASN1_BIT_STRING *subjectUID; /* [ 2 ] optional in v2 */ STACK_OF(X509_EXTENSION) *extensions; /* [ 3 ] optional in v3 */ ASN1_ENCODING enc; } X509_CINF; /* * This stuff is certificate "auxiliary info" it contains details which are * useful in certificate stores and databases. When used this is tagged onto * the end of the certificate itself */ typedef struct x509_cert_aux_st { STACK_OF(ASN1_OBJECT) *trust; /* trusted uses */ STACK_OF(ASN1_OBJECT) *reject; /* rejected uses */ ASN1_UTF8STRING *alias; /* "friendly name" */ ASN1_OCTET_STRING *keyid; /* key id of private key */ STACK_OF(X509_ALGOR) *other; /* other unspecified info */ } X509_CERT_AUX; struct x509_st { X509_CINF *cert_info; X509_ALGOR *sig_alg; ASN1_BIT_STRING *signature; int valid; int references; char *name; CRYPTO_EX_DATA ex_data; /* These contain copies of various extension values */ long ex_pathlen; long ex_pcpathlen; unsigned long ex_flags; unsigned long ex_kusage; unsigned long ex_xkusage; unsigned long ex_nscert; ASN1_OCTET_STRING *skid; AUTHORITY_KEYID *akid; X509_POLICY_CACHE *policy_cache; STACK_OF(DIST_POINT) *crldp; STACK_OF(GENERAL_NAME) *altname; NAME_CONSTRAINTS *nc; # ifndef OPENSSL_NO_RFC3779 STACK_OF(IPAddressFamily) *rfc3779_addr; struct ASIdentifiers_st *rfc3779_asid; # endif # ifndef OPENSSL_NO_SHA unsigned char sha1_hash[SHA_DIGEST_LENGTH]; # endif X509_CERT_AUX *aux; } /* X509 */ ; DECLARE_STACK_OF(X509) DECLARE_ASN1_SET_OF(X509) /* This is used for a table of trust checking functions */ typedef struct x509_trust_st { int trust; int flags; int (*check_trust) (struct x509_trust_st *, X509 *, int); char *name; int arg1; void *arg2; } X509_TRUST; DECLARE_STACK_OF(X509_TRUST) typedef struct x509_cert_pair_st { X509 *forward; X509 *reverse; } X509_CERT_PAIR; /* standard trust ids */ # define X509_TRUST_DEFAULT -1/* Only valid in purpose settings */ # define X509_TRUST_COMPAT 1 # define X509_TRUST_SSL_CLIENT 2 # define X509_TRUST_SSL_SERVER 3 # define X509_TRUST_EMAIL 4 # define X509_TRUST_OBJECT_SIGN 5 # define X509_TRUST_OCSP_SIGN 6 # define X509_TRUST_OCSP_REQUEST 7 # define X509_TRUST_TSA 8 /* Keep these up to date! */ # define X509_TRUST_MIN 1 # define X509_TRUST_MAX 8 /* trust_flags values */ # define X509_TRUST_DYNAMIC 1 # define X509_TRUST_DYNAMIC_NAME 2 /* check_trust return codes */ # define X509_TRUST_TRUSTED 1 # define X509_TRUST_REJECTED 2 # define X509_TRUST_UNTRUSTED 3 /* Flags for X509_print_ex() */ # define X509_FLAG_COMPAT 0 # define X509_FLAG_NO_HEADER 1L # define X509_FLAG_NO_VERSION (1L << 1) # define X509_FLAG_NO_SERIAL (1L << 2) # define X509_FLAG_NO_SIGNAME (1L << 3) # define X509_FLAG_NO_ISSUER (1L << 4) # define X509_FLAG_NO_VALIDITY (1L << 5) # define X509_FLAG_NO_SUBJECT (1L << 6) # define X509_FLAG_NO_PUBKEY (1L << 7) # define X509_FLAG_NO_EXTENSIONS (1L << 8) # define X509_FLAG_NO_SIGDUMP (1L << 9) # define X509_FLAG_NO_AUX (1L << 10) # define X509_FLAG_NO_ATTRIBUTES (1L << 11) # define X509_FLAG_NO_IDS (1L << 12) /* Flags specific to X509_NAME_print_ex() */ /* The field separator information */ # define XN_FLAG_SEP_MASK (0xf << 16) # define XN_FLAG_COMPAT 0/* Traditional SSLeay: use old * X509_NAME_print */ # define XN_FLAG_SEP_COMMA_PLUS (1 << 16)/* RFC2253 ,+ */ # define XN_FLAG_SEP_CPLUS_SPC (2 << 16)/* ,+ spaced: more readable */ # define XN_FLAG_SEP_SPLUS_SPC (3 << 16)/* ;+ spaced */ # define XN_FLAG_SEP_MULTILINE (4 << 16)/* One line per field */ # define XN_FLAG_DN_REV (1 << 20)/* Reverse DN order */ /* How the field name is shown */ # define XN_FLAG_FN_MASK (0x3 << 21) # define XN_FLAG_FN_SN 0/* Object short name */ # define XN_FLAG_FN_LN (1 << 21)/* Object long name */ # define XN_FLAG_FN_OID (2 << 21)/* Always use OIDs */ # define XN_FLAG_FN_NONE (3 << 21)/* No field names */ # define XN_FLAG_SPC_EQ (1 << 23)/* Put spaces round '=' */ /* * This determines if we dump fields we don't recognise: RFC2253 requires * this. */ # define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24) # define XN_FLAG_FN_ALIGN (1 << 25)/* Align field names to 20 * characters */ /* Complete set of RFC2253 flags */ # define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \ XN_FLAG_SEP_COMMA_PLUS | \ XN_FLAG_DN_REV | \ XN_FLAG_FN_SN | \ XN_FLAG_DUMP_UNKNOWN_FIELDS) /* readable oneline form */ # define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \ ASN1_STRFLGS_ESC_QUOTE | \ XN_FLAG_SEP_CPLUS_SPC | \ XN_FLAG_SPC_EQ | \ XN_FLAG_FN_SN) /* readable multiline form */ # define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \ ASN1_STRFLGS_ESC_MSB | \ XN_FLAG_SEP_MULTILINE | \ XN_FLAG_SPC_EQ | \ XN_FLAG_FN_LN | \ XN_FLAG_FN_ALIGN) struct x509_revoked_st { ASN1_INTEGER *serialNumber; ASN1_TIME *revocationDate; STACK_OF(X509_EXTENSION) /* optional */ *extensions; /* Set up if indirect CRL */ STACK_OF(GENERAL_NAME) *issuer; /* Revocation reason */ int reason; int sequence; /* load sequence */ }; DECLARE_STACK_OF(X509_REVOKED) DECLARE_ASN1_SET_OF(X509_REVOKED) typedef struct X509_crl_info_st { ASN1_INTEGER *version; X509_ALGOR *sig_alg; X509_NAME *issuer; ASN1_TIME *lastUpdate; ASN1_TIME *nextUpdate; STACK_OF(X509_REVOKED) *revoked; STACK_OF(X509_EXTENSION) /* [0] */ *extensions; ASN1_ENCODING enc; } X509_CRL_INFO; struct X509_crl_st { /* actual signature */ X509_CRL_INFO *crl; X509_ALGOR *sig_alg; ASN1_BIT_STRING *signature; int references; int flags; /* Copies of various extensions */ AUTHORITY_KEYID *akid; ISSUING_DIST_POINT *idp; /* Convenient breakdown of IDP */ int idp_flags; int idp_reasons; /* CRL and base CRL numbers for delta processing */ ASN1_INTEGER *crl_number; ASN1_INTEGER *base_crl_number; # ifndef OPENSSL_NO_SHA unsigned char sha1_hash[SHA_DIGEST_LENGTH]; # endif STACK_OF(GENERAL_NAMES) *issuers; const X509_CRL_METHOD *meth; void *meth_data; } /* X509_CRL */ ; DECLARE_STACK_OF(X509_CRL) DECLARE_ASN1_SET_OF(X509_CRL) typedef struct private_key_st { int version; /* The PKCS#8 data types */ X509_ALGOR *enc_algor; ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */ /* When decrypted, the following will not be NULL */ EVP_PKEY *dec_pkey; /* used to encrypt and decrypt */ int key_length; char *key_data; int key_free; /* true if we should auto free key_data */ /* expanded version of 'enc_algor' */ EVP_CIPHER_INFO cipher; int references; } X509_PKEY; # ifndef OPENSSL_NO_EVP typedef struct X509_info_st { X509 *x509; X509_CRL *crl; X509_PKEY *x_pkey; EVP_CIPHER_INFO enc_cipher; int enc_len; char *enc_data; int references; } X509_INFO; DECLARE_STACK_OF(X509_INFO) # endif /* * The next 2 structures and their 8 routines were sent to me by Pat Richard * <patr@x509.com> and are used to manipulate Netscapes spki structures - * useful if you are writing a CA web page */ typedef struct Netscape_spkac_st { X509_PUBKEY *pubkey; ASN1_IA5STRING *challenge; /* challenge sent in atlas >= PR2 */ } NETSCAPE_SPKAC; typedef struct Netscape_spki_st { NETSCAPE_SPKAC *spkac; /* signed public key and challenge */ X509_ALGOR *sig_algor; ASN1_BIT_STRING *signature; } NETSCAPE_SPKI; /* Netscape certificate sequence structure */ typedef struct Netscape_certificate_sequence { ASN1_OBJECT *type; STACK_OF(X509) *certs; } NETSCAPE_CERT_SEQUENCE; /*- Unused (and iv length is wrong) typedef struct CBCParameter_st { unsigned char iv[8]; } CBC_PARAM; */ /* Password based encryption structure */ typedef struct PBEPARAM_st { ASN1_OCTET_STRING *salt; ASN1_INTEGER *iter; } PBEPARAM; /* Password based encryption V2 structures */ typedef struct PBE2PARAM_st { X509_ALGOR *keyfunc; X509_ALGOR *encryption; } PBE2PARAM; typedef struct PBKDF2PARAM_st { /* Usually OCTET STRING but could be anything */ ASN1_TYPE *salt; ASN1_INTEGER *iter; ASN1_INTEGER *keylength; X509_ALGOR *prf; } PBKDF2PARAM; /* PKCS#8 private key info structure */ struct pkcs8_priv_key_info_st { /* Flag for various broken formats */ int broken; # define PKCS8_OK 0 # define PKCS8_NO_OCTET 1 # define PKCS8_EMBEDDED_PARAM 2 # define PKCS8_NS_DB 3 # define PKCS8_NEG_PRIVKEY 4 ASN1_INTEGER *version; X509_ALGOR *pkeyalg; /* Should be OCTET STRING but some are broken */ ASN1_TYPE *pkey; STACK_OF(X509_ATTRIBUTE) *attributes; }; #ifdef __cplusplus } #endif # include <openssl/x509_vfy.h> # include <openssl/pkcs7.h> #ifdef __cplusplus extern "C" { #endif # define X509_EXT_PACK_UNKNOWN 1 # define X509_EXT_PACK_STRING 2 # define X509_get_version(x) ASN1_INTEGER_get((x)->cert_info->version) /* #define X509_get_serialNumber(x) ((x)->cert_info->serialNumber) */ # define X509_get_notBefore(x) ((x)->cert_info->validity->notBefore) # define X509_get_notAfter(x) ((x)->cert_info->validity->notAfter) # define X509_extract_key(x) X509_get_pubkey(x)/*****/ # define X509_REQ_get_version(x) ASN1_INTEGER_get((x)->req_info->version) # define X509_REQ_get_subject_name(x) ((x)->req_info->subject) # define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a) # define X509_name_cmp(a,b) X509_NAME_cmp((a),(b)) # define X509_get_signature_type(x) EVP_PKEY_type(OBJ_obj2nid((x)->sig_alg->algorithm)) # define X509_CRL_get_version(x) ASN1_INTEGER_get((x)->crl->version) # define X509_CRL_get_lastUpdate(x) ((x)->crl->lastUpdate) # define X509_CRL_get_nextUpdate(x) ((x)->crl->nextUpdate) # define X509_CRL_get_issuer(x) ((x)->crl->issuer) # define X509_CRL_get_REVOKED(x) ((x)->crl->revoked) void X509_CRL_set_default_method(const X509_CRL_METHOD *meth); X509_CRL_METHOD *X509_CRL_METHOD_new(int (*crl_init) (X509_CRL *crl), int (*crl_free) (X509_CRL *crl), int (*crl_lookup) (X509_CRL *crl, X509_REVOKED **ret, ASN1_INTEGER *ser, X509_NAME *issuer), int (*crl_verify) (X509_CRL *crl, EVP_PKEY *pk)); void X509_CRL_METHOD_free(X509_CRL_METHOD *m); void X509_CRL_set_meth_data(X509_CRL *crl, void *dat); void *X509_CRL_get_meth_data(X509_CRL *crl); /* * This one is only used so that a binary form can output, as in * i2d_X509_NAME(X509_get_X509_PUBKEY(x),&buf) */ # define X509_get_X509_PUBKEY(x) ((x)->cert_info->key) const char *X509_verify_cert_error_string(long n); # ifndef OPENSSL_NO_EVP int X509_verify(X509 *a, EVP_PKEY *r); int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r); int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r); int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r); NETSCAPE_SPKI *NETSCAPE_SPKI_b64_decode(const char *str, int len); char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x); EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x); int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey); int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki); int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent); int X509_signature_print(BIO *bp, X509_ALGOR *alg, ASN1_STRING *sig); int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx); int X509_http_nbio(OCSP_REQ_CTX *rctx, X509 **pcert); int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md); int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx); int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx); int X509_CRL_http_nbio(OCSP_REQ_CTX *rctx, X509_CRL **pcrl); int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); int X509_pubkey_digest(const X509 *data, const EVP_MD *type, unsigned char *md, unsigned int *len); int X509_digest(const X509 *data, const EVP_MD *type, unsigned char *md, unsigned int *len); int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type, unsigned char *md, unsigned int *len); int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type, unsigned char *md, unsigned int *len); int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type, unsigned char *md, unsigned int *len); # endif # ifndef OPENSSL_NO_FP_API X509 *d2i_X509_fp(FILE *fp, X509 **x509); int i2d_X509_fp(FILE *fp, X509 *x509); X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **crl); int i2d_X509_CRL_fp(FILE *fp, X509_CRL *crl); X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **req); int i2d_X509_REQ_fp(FILE *fp, X509_REQ *req); # ifndef OPENSSL_NO_RSA RSA *d2i_RSAPrivateKey_fp(FILE *fp, RSA **rsa); int i2d_RSAPrivateKey_fp(FILE *fp, RSA *rsa); RSA *d2i_RSAPublicKey_fp(FILE *fp, RSA **rsa); int i2d_RSAPublicKey_fp(FILE *fp, RSA *rsa); RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa); int i2d_RSA_PUBKEY_fp(FILE *fp, RSA *rsa); # endif # ifndef OPENSSL_NO_DSA DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa); DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa); int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa); # endif # ifndef OPENSSL_NO_EC EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey); int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey); EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey); int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey); # endif X509_SIG *d2i_PKCS8_fp(FILE *fp, X509_SIG **p8); int i2d_PKCS8_fp(FILE *fp, X509_SIG *p8); PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, PKCS8_PRIV_KEY_INFO **p8inf); int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, PKCS8_PRIV_KEY_INFO *p8inf); int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key); int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey); EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a); int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey); EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a); # endif # ifndef OPENSSL_NO_BIO X509 *d2i_X509_bio(BIO *bp, X509 **x509); int i2d_X509_bio(BIO *bp, X509 *x509); X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **crl); int i2d_X509_CRL_bio(BIO *bp, X509_CRL *crl); X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **req); int i2d_X509_REQ_bio(BIO *bp, X509_REQ *req); # ifndef OPENSSL_NO_RSA RSA *d2i_RSAPrivateKey_bio(BIO *bp, RSA **rsa); int i2d_RSAPrivateKey_bio(BIO *bp, RSA *rsa); RSA *d2i_RSAPublicKey_bio(BIO *bp, RSA **rsa); int i2d_RSAPublicKey_bio(BIO *bp, RSA *rsa); RSA *d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa); int i2d_RSA_PUBKEY_bio(BIO *bp, RSA *rsa); # endif # ifndef OPENSSL_NO_DSA DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa); int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa); DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa); int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa); # endif # ifndef OPENSSL_NO_EC EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey); int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey); EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey); int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey); # endif X509_SIG *d2i_PKCS8_bio(BIO *bp, X509_SIG **p8); int i2d_PKCS8_bio(BIO *bp, X509_SIG *p8); PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, PKCS8_PRIV_KEY_INFO **p8inf); int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, PKCS8_PRIV_KEY_INFO *p8inf); int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key); int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey); EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a); # endif X509 *X509_dup(X509 *x509); X509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa); X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex); X509_CRL *X509_CRL_dup(X509_CRL *crl); X509_REVOKED *X509_REVOKED_dup(X509_REVOKED *rev); X509_REQ *X509_REQ_dup(X509_REQ *req); X509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn); int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval); void X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, void **ppval, X509_ALGOR *algor); void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md); int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b); X509_NAME *X509_NAME_dup(X509_NAME *xn); X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne); int X509_cmp_time(const ASN1_TIME *s, time_t *t); int X509_cmp_current_time(const ASN1_TIME *s); ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *t); ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s, int offset_day, long offset_sec, time_t *t); ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj); const char *X509_get_default_cert_area(void); const char *X509_get_default_cert_dir(void); const char *X509_get_default_cert_file(void); const char *X509_get_default_cert_dir_env(void); const char *X509_get_default_cert_file_env(void); const char *X509_get_default_private_dir(void); X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey); DECLARE_ASN1_FUNCTIONS(X509_ALGOR) DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS) DECLARE_ASN1_FUNCTIONS(X509_VAL) DECLARE_ASN1_FUNCTIONS(X509_PUBKEY) int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey); EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key); int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain); int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp); EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length); # ifndef OPENSSL_NO_RSA int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp); RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, long length); # endif # ifndef OPENSSL_NO_DSA int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp); DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, long length); # endif # ifndef OPENSSL_NO_EC int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp); EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length); # endif DECLARE_ASN1_FUNCTIONS(X509_SIG) DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO) DECLARE_ASN1_FUNCTIONS(X509_REQ) DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE) X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value); DECLARE_ASN1_FUNCTIONS(X509_EXTENSION) DECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS) DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY) DECLARE_ASN1_FUNCTIONS(X509_NAME) int X509_NAME_set(X509_NAME **xn, X509_NAME *name); DECLARE_ASN1_FUNCTIONS(X509_CINF) DECLARE_ASN1_FUNCTIONS(X509) DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX) DECLARE_ASN1_FUNCTIONS(X509_CERT_PAIR) int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int X509_set_ex_data(X509 *r, int idx, void *arg); void *X509_get_ex_data(X509 *r, int idx); int i2d_X509_AUX(X509 *a, unsigned char **pp); X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length); int i2d_re_X509_tbs(X509 *x, unsigned char **pp); void X509_get0_signature(ASN1_BIT_STRING **psig, X509_ALGOR **palg, const X509 *x); int X509_get_signature_nid(const X509 *x); int X509_alias_set1(X509 *x, unsigned char *name, int len); int X509_keyid_set1(X509 *x, unsigned char *id, int len); unsigned char *X509_alias_get0(X509 *x, int *len); unsigned char *X509_keyid_get0(X509 *x, int *len); int (*X509_TRUST_set_default(int (*trust) (int, X509 *, int))) (int, X509 *, int); int X509_TRUST_set(int *t, int trust); int X509_add1_trust_object(X509 *x, ASN1_OBJECT *obj); int X509_add1_reject_object(X509 *x, ASN1_OBJECT *obj); void X509_trust_clear(X509 *x); void X509_reject_clear(X509 *x); DECLARE_ASN1_FUNCTIONS(X509_REVOKED) DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO) DECLARE_ASN1_FUNCTIONS(X509_CRL) int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev); int X509_CRL_get0_by_serial(X509_CRL *crl, X509_REVOKED **ret, ASN1_INTEGER *serial); int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x); X509_PKEY *X509_PKEY_new(void); void X509_PKEY_free(X509_PKEY *a); int i2d_X509_PKEY(X509_PKEY *a, unsigned char **pp); X509_PKEY *d2i_X509_PKEY(X509_PKEY **a, const unsigned char **pp, long length); DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI) DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC) DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE) # ifndef OPENSSL_NO_EVP X509_INFO *X509_INFO_new(void); void X509_INFO_free(X509_INFO *a); char *X509_NAME_oneline(X509_NAME *a, char *buf, int size); int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1, ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey); int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data, unsigned char *md, unsigned int *len); int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, X509_ALGOR *algor2, ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey, const EVP_MD *type); int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *data, unsigned char *md, unsigned int *len); int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1, ASN1_BIT_STRING *signature, void *data, EVP_PKEY *pkey); int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, ASN1_BIT_STRING *signature, void *data, EVP_PKEY *pkey, const EVP_MD *type); int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, ASN1_BIT_STRING *signature, void *asn, EVP_MD_CTX *ctx); # endif int X509_set_version(X509 *x, long version); int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial); ASN1_INTEGER *X509_get_serialNumber(X509 *x); int X509_set_issuer_name(X509 *x, X509_NAME *name); X509_NAME *X509_get_issuer_name(X509 *a); int X509_set_subject_name(X509 *x, X509_NAME *name); X509_NAME *X509_get_subject_name(X509 *a); int X509_set_notBefore(X509 *x, const ASN1_TIME *tm); int X509_set_notAfter(X509 *x, const ASN1_TIME *tm); int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); EVP_PKEY *X509_get_pubkey(X509 *x); ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x); int X509_certificate_type(X509 *x, EVP_PKEY *pubkey /* optional */ ); int X509_REQ_set_version(X509_REQ *x, long version); int X509_REQ_set_subject_name(X509_REQ *req, X509_NAME *name); int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey); EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req); int X509_REQ_extension_nid(int nid); int *X509_REQ_get_extension_nids(void); void X509_REQ_set_extension_nids(int *nids); STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req); int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, int nid); int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts); int X509_REQ_get_attr_count(const X509_REQ *req); int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int lastpos); int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, ASN1_OBJECT *obj, int lastpos); X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc); X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc); int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr); int X509_REQ_add1_attr_by_OBJ(X509_REQ *req, const ASN1_OBJECT *obj, int type, const unsigned char *bytes, int len); int X509_REQ_add1_attr_by_NID(X509_REQ *req, int nid, int type, const unsigned char *bytes, int len); int X509_REQ_add1_attr_by_txt(X509_REQ *req, const char *attrname, int type, const unsigned char *bytes, int len); int X509_CRL_set_version(X509_CRL *x, long version); int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name); int X509_CRL_set_lastUpdate(X509_CRL *x, const ASN1_TIME *tm); int X509_CRL_set_nextUpdate(X509_CRL *x, const ASN1_TIME *tm); int X509_CRL_sort(X509_CRL *crl); int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial); int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm); X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer, EVP_PKEY *skey, const EVP_MD *md, unsigned int flags); int X509_REQ_check_private_key(X509_REQ *x509, EVP_PKEY *pkey); int X509_check_private_key(X509 *x509, EVP_PKEY *pkey); int X509_chain_check_suiteb(int *perror_depth, X509 *x, STACK_OF(X509) *chain, unsigned long flags); int X509_CRL_check_suiteb(X509_CRL *crl, EVP_PKEY *pk, unsigned long flags); STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain); int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b); unsigned long X509_issuer_and_serial_hash(X509 *a); int X509_issuer_name_cmp(const X509 *a, const X509 *b); unsigned long X509_issuer_name_hash(X509 *a); int X509_subject_name_cmp(const X509 *a, const X509 *b); unsigned long X509_subject_name_hash(X509 *x); # ifndef OPENSSL_NO_MD5 unsigned long X509_issuer_name_hash_old(X509 *a); unsigned long X509_subject_name_hash_old(X509 *x); # endif int X509_cmp(const X509 *a, const X509 *b); int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b); unsigned long X509_NAME_hash(X509_NAME *x); unsigned long X509_NAME_hash_old(X509_NAME *x); int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b); int X509_CRL_match(const X509_CRL *a, const X509_CRL *b); # ifndef OPENSSL_NO_FP_API int X509_print_ex_fp(FILE *bp, X509 *x, unsigned long nmflag, unsigned long cflag); int X509_print_fp(FILE *bp, X509 *x); int X509_CRL_print_fp(FILE *bp, X509_CRL *x); int X509_REQ_print_fp(FILE *bp, X509_REQ *req); int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags); # endif # ifndef OPENSSL_NO_BIO int X509_NAME_print(BIO *bp, X509_NAME *name, int obase); int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags); int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflag, unsigned long cflag); int X509_print(BIO *bp, X509 *x); int X509_ocspid_print(BIO *bp, X509 *x); int X509_CERT_AUX_print(BIO *bp, X509_CERT_AUX *x, int indent); int X509_CRL_print(BIO *bp, X509_CRL *x); int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, unsigned long cflag); int X509_REQ_print(BIO *bp, X509_REQ *req); # endif int X509_NAME_entry_count(X509_NAME *name); int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf, int len); int X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, char *buf, int len); /* * NOTE: you should be passsing -1, not 0 as lastpos. The functions that use * lastpos, search after that position on. */ int X509_NAME_get_index_by_NID(X509_NAME *name, int nid, int lastpos); int X509_NAME_get_index_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int lastpos); X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc); X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); int X509_NAME_add_entry(X509_NAME *name, X509_NAME_ENTRY *ne, int loc, int set); int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type, unsigned char *bytes, int len, int loc, int set); int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, unsigned char *bytes, int len, int loc, int set); X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, const char *field, int type, const unsigned char *bytes, int len); X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, int type, unsigned char *bytes, int len); int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, const unsigned char *bytes, int len, int loc, int set); X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, ASN1_OBJECT *obj, int type, const unsigned char *bytes, int len); int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, ASN1_OBJECT *obj); int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, const unsigned char *bytes, int len); ASN1_OBJECT *X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne); ASN1_STRING *X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne); int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x); int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, int nid, int lastpos); int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x, ASN1_OBJECT *obj, int lastpos); int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x, int crit, int lastpos); X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc); X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc); STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x, X509_EXTENSION *ex, int loc); int X509_get_ext_count(X509 *x); int X509_get_ext_by_NID(X509 *x, int nid, int lastpos); int X509_get_ext_by_OBJ(X509 *x, ASN1_OBJECT *obj, int lastpos); int X509_get_ext_by_critical(X509 *x, int crit, int lastpos); X509_EXTENSION *X509_get_ext(X509 *x, int loc); X509_EXTENSION *X509_delete_ext(X509 *x, int loc); int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc); void *X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx); int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit, unsigned long flags); int X509_CRL_get_ext_count(X509_CRL *x); int X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos); int X509_CRL_get_ext_by_OBJ(X509_CRL *x, ASN1_OBJECT *obj, int lastpos); int X509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int lastpos); X509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc); X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc); int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc); void *X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx); int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit, unsigned long flags); int X509_REVOKED_get_ext_count(X509_REVOKED *x); int X509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int lastpos); int X509_REVOKED_get_ext_by_OBJ(X509_REVOKED *x, ASN1_OBJECT *obj, int lastpos); int X509_REVOKED_get_ext_by_critical(X509_REVOKED *x, int crit, int lastpos); X509_EXTENSION *X509_REVOKED_get_ext(X509_REVOKED *x, int loc); X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc); int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc); void *X509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, int *idx); int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit, unsigned long flags); X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, int nid, int crit, ASN1_OCTET_STRING *data); X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex, ASN1_OBJECT *obj, int crit, ASN1_OCTET_STRING *data); int X509_EXTENSION_set_object(X509_EXTENSION *ex, ASN1_OBJECT *obj); int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit); int X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data); ASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex); ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne); int X509_EXTENSION_get_critical(X509_EXTENSION *ex); int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x); int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, int lastpos); int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk, ASN1_OBJECT *obj, int lastpos); X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc); X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc); STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, X509_ATTRIBUTE *attr); STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) **x, const ASN1_OBJECT *obj, int type, const unsigned char *bytes, int len); STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) **x, int nid, int type, const unsigned char *bytes, int len); STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) **x, const char *attrname, int type, const unsigned char *bytes, int len); void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x, ASN1_OBJECT *obj, int lastpos, int type); X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid, int atrtype, const void *data, int len); X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr, const ASN1_OBJECT *obj, int atrtype, const void *data, int len); X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, const char *atrname, int type, const unsigned char *bytes, int len); int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj); int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data, int len); void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, int atrtype, void *data); int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr); ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr); ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx); int EVP_PKEY_get_attr_count(const EVP_PKEY *key); int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos); int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, ASN1_OBJECT *obj, int lastpos); X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc); X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc); int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr); int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, const ASN1_OBJECT *obj, int type, const unsigned char *bytes, int len); int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key, int nid, int type, const unsigned char *bytes, int len); int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, const char *attrname, int type, const unsigned char *bytes, int len); int X509_verify_cert(X509_STORE_CTX *ctx); /* lookup a cert from a X509 STACK */ X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, X509_NAME *name, ASN1_INTEGER *serial); X509 *X509_find_by_subject(STACK_OF(X509) *sk, X509_NAME *name); DECLARE_ASN1_FUNCTIONS(PBEPARAM) DECLARE_ASN1_FUNCTIONS(PBE2PARAM) DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM) int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, const unsigned char *salt, int saltlen); X509_ALGOR *PKCS5_pbe_set(int alg, int iter, const unsigned char *salt, int saltlen); X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, unsigned char *salt, int saltlen); X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter, unsigned char *salt, int saltlen, unsigned char *aiv, int prf_nid); X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, int prf_nid, int keylen); /* PKCS#8 utilities */ DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) EVP_PKEY *EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8); PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey); PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken); PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken); int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, int version, int ptype, void *pval, unsigned char *penc, int penclen); int PKCS8_pkey_get0(ASN1_OBJECT **ppkalg, const unsigned char **pk, int *ppklen, X509_ALGOR **pa, PKCS8_PRIV_KEY_INFO *p8); int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, int ptype, void *pval, unsigned char *penc, int penclen); int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, const unsigned char **pk, int *ppklen, X509_ALGOR **pa, X509_PUBKEY *pub); int X509_check_trust(X509 *x, int id, int flags); int X509_TRUST_get_count(void); X509_TRUST *X509_TRUST_get0(int idx); int X509_TRUST_get_by_id(int id); int X509_TRUST_add(int id, int flags, int (*ck) (X509_TRUST *, X509 *, int), char *name, int arg1, void *arg2); void X509_TRUST_cleanup(void); int X509_TRUST_get_flags(X509_TRUST *xp); char *X509_TRUST_get0_name(X509_TRUST *xp); int X509_TRUST_get_trust(X509_TRUST *xp); /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_X509_strings(void); /* Error codes for the X509 functions. */ /* Function codes. */ # define X509_F_ADD_CERT_DIR 100 # define X509_F_BY_FILE_CTRL 101 # define X509_F_CHECK_NAME_CONSTRAINTS 106 # define X509_F_CHECK_POLICY 145 # define X509_F_DIR_CTRL 102 # define X509_F_GET_CERT_BY_SUBJECT 103 # define X509_F_NETSCAPE_SPKI_B64_DECODE 129 # define X509_F_NETSCAPE_SPKI_B64_ENCODE 130 # define X509_F_X509AT_ADD1_ATTR 135 # define X509_F_X509V3_ADD_EXT 104 # define X509_F_X509_ATTRIBUTE_CREATE_BY_NID 136 # define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ 137 # define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT 140 # define X509_F_X509_ATTRIBUTE_GET0_DATA 139 # define X509_F_X509_ATTRIBUTE_SET1_DATA 138 # define X509_F_X509_CHECK_PRIVATE_KEY 128 # define X509_F_X509_CRL_DIFF 105 # define X509_F_X509_CRL_PRINT_FP 147 # define X509_F_X509_EXTENSION_CREATE_BY_NID 108 # define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 # define X509_F_X509_GET_PUBKEY_PARAMETERS 110 # define X509_F_X509_LOAD_CERT_CRL_FILE 132 # define X509_F_X509_LOAD_CERT_FILE 111 # define X509_F_X509_LOAD_CRL_FILE 112 # define X509_F_X509_NAME_ADD_ENTRY 113 # define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114 # define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT 131 # define X509_F_X509_NAME_ENTRY_SET_OBJECT 115 # define X509_F_X509_NAME_ONELINE 116 # define X509_F_X509_NAME_PRINT 117 # define X509_F_X509_PRINT_EX_FP 118 # define X509_F_X509_PUBKEY_GET 119 # define X509_F_X509_PUBKEY_SET 120 # define X509_F_X509_REQ_CHECK_PRIVATE_KEY 144 # define X509_F_X509_REQ_PRINT_EX 121 # define X509_F_X509_REQ_PRINT_FP 122 # define X509_F_X509_REQ_TO_X509 123 # define X509_F_X509_STORE_ADD_CERT 124 # define X509_F_X509_STORE_ADD_CRL 125 # define X509_F_X509_STORE_CTX_GET1_ISSUER 146 # define X509_F_X509_STORE_CTX_INIT 143 # define X509_F_X509_STORE_CTX_NEW 142 # define X509_F_X509_STORE_CTX_PURPOSE_INHERIT 134 # define X509_F_X509_TO_X509_REQ 126 # define X509_F_X509_TRUST_ADD 133 # define X509_F_X509_TRUST_SET 141 # define X509_F_X509_VERIFY_CERT 127 /* Reason codes. */ # define X509_R_AKID_MISMATCH 110 # define X509_R_BAD_X509_FILETYPE 100 # define X509_R_BASE64_DECODE_ERROR 118 # define X509_R_CANT_CHECK_DH_KEY 114 # define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 # define X509_R_CRL_ALREADY_DELTA 127 # define X509_R_CRL_VERIFY_FAILURE 131 # define X509_R_ERR_ASN1_LIB 102 # define X509_R_IDP_MISMATCH 128 # define X509_R_INVALID_DIRECTORY 113 # define X509_R_INVALID_FIELD_NAME 119 # define X509_R_INVALID_TRUST 123 # define X509_R_ISSUER_MISMATCH 129 # define X509_R_KEY_TYPE_MISMATCH 115 # define X509_R_KEY_VALUES_MISMATCH 116 # define X509_R_LOADING_CERT_DIR 103 # define X509_R_LOADING_DEFAULTS 104 # define X509_R_METHOD_NOT_SUPPORTED 124 # define X509_R_NAME_TOO_LONG 134 # define X509_R_NEWER_CRL_NOT_NEWER 132 # define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 # define X509_R_NO_CRL_NUMBER 130 # define X509_R_PUBLIC_KEY_DECODE_ERROR 125 # define X509_R_PUBLIC_KEY_ENCODE_ERROR 126 # define X509_R_SHOULD_RETRY 106 # define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 # define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 # define X509_R_UNKNOWN_KEY_TYPE 117 # define X509_R_UNKNOWN_NID 109 # define X509_R_UNKNOWN_PURPOSE_ID 121 # define X509_R_UNKNOWN_TRUST_ID 120 # define X509_R_UNSUPPORTED_ALGORITHM 111 # define X509_R_WRONG_LOOKUP_TYPE 112 # define X509_R_WRONG_TYPE 122 # ifdef __cplusplus } # endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/safestack.h���������������������������������������������������������������������������������0000644�����������������00000614227�14763166030�0010366 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ==================================================================== * Copyright (c) 1999 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_SAFESTACK_H # define HEADER_SAFESTACK_H # include <openssl/stack.h> #ifdef __cplusplus extern "C" { #endif # ifndef CHECKED_PTR_OF # define CHECKED_PTR_OF(type, p) \ ((void*) (1 ? p : (type*)0)) # endif /* * In C++ we get problems because an explicit cast is needed from (void *) we * use CHECKED_STACK_OF to ensure the correct type is passed in the macros * below. */ # define CHECKED_STACK_OF(type, p) \ ((_STACK*) (1 ? p : (STACK_OF(type)*)0)) # define CHECKED_SK_COPY_FUNC(type, p) \ ((void *(*)(void *)) ((1 ? p : (type *(*)(const type *))0))) # define CHECKED_SK_FREE_FUNC(type, p) \ ((void (*)(void *)) ((1 ? p : (void (*)(type *))0))) # define CHECKED_SK_CMP_FUNC(type, p) \ ((int (*)(const void *, const void *)) \ ((1 ? p : (int (*)(const type * const *, const type * const *))0))) # define STACK_OF(type) struct stack_st_##type # define PREDECLARE_STACK_OF(type) STACK_OF(type); # define DECLARE_STACK_OF(type) \ STACK_OF(type) \ { \ _STACK stack; \ }; # define DECLARE_SPECIAL_STACK_OF(type, type2) \ STACK_OF(type) \ { \ _STACK stack; \ }; /* nada (obsolete in new safestack approach)*/ # define IMPLEMENT_STACK_OF(type) /*- * Strings are special: normally an lhash entry will point to a single * (somewhat) mutable object. In the case of strings: * * a) Instead of a single char, there is an array of chars, NUL-terminated. * b) The string may have be immutable. * * So, they need their own declarations. Especially important for * type-checking tools, such as Deputy. * * In practice, however, it appears to be hard to have a const * string. For now, I'm settling for dealing with the fact it is a * string at all. */ typedef char *OPENSSL_STRING; typedef const char *OPENSSL_CSTRING; /* * Confusingly, LHASH_OF(STRING) deals with char ** throughout, but * STACK_OF(STRING) is really more like STACK_OF(char), only, as mentioned * above, instead of a single char each entry is a NUL-terminated array of * chars. So, we have to implement STRING specially for STACK_OF. This is * dealt with in the autogenerated macros below. */ DECLARE_SPECIAL_STACK_OF(OPENSSL_STRING, char) /* * Similarly, we sometimes use a block of characters, NOT nul-terminated. * These should also be distinguished from "normal" stacks. */ typedef void *OPENSSL_BLOCK; DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void) /* * SKM_sk_... stack macros are internal to safestack.h: never use them * directly, use sk_<type>_... instead */ # define SKM_sk_new(type, cmp) \ ((STACK_OF(type) *)sk_new(CHECKED_SK_CMP_FUNC(type, cmp))) # define SKM_sk_new_null(type) \ ((STACK_OF(type) *)sk_new_null()) # define SKM_sk_free(type, st) \ sk_free(CHECKED_STACK_OF(type, st)) # define SKM_sk_num(type, st) \ sk_num(CHECKED_STACK_OF(type, st)) # define SKM_sk_value(type, st,i) \ ((type *)sk_value(CHECKED_STACK_OF(type, st), i)) # define SKM_sk_set(type, st,i,val) \ sk_set(CHECKED_STACK_OF(type, st), i, CHECKED_PTR_OF(type, val)) # define SKM_sk_zero(type, st) \ sk_zero(CHECKED_STACK_OF(type, st)) # define SKM_sk_push(type, st, val) \ sk_push(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val)) # define SKM_sk_unshift(type, st, val) \ sk_unshift(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val)) # define SKM_sk_find(type, st, val) \ sk_find(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val)) # define SKM_sk_find_ex(type, st, val) \ sk_find_ex(CHECKED_STACK_OF(type, st), \ CHECKED_PTR_OF(type, val)) # define SKM_sk_delete(type, st, i) \ (type *)sk_delete(CHECKED_STACK_OF(type, st), i) # define SKM_sk_delete_ptr(type, st, ptr) \ (type *)sk_delete_ptr(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, ptr)) # define SKM_sk_insert(type, st,val, i) \ sk_insert(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val), i) # define SKM_sk_set_cmp_func(type, st, cmp) \ ((int (*)(const type * const *,const type * const *)) \ sk_set_cmp_func(CHECKED_STACK_OF(type, st), CHECKED_SK_CMP_FUNC(type, cmp))) # define SKM_sk_dup(type, st) \ (STACK_OF(type) *)sk_dup(CHECKED_STACK_OF(type, st)) # define SKM_sk_pop_free(type, st, free_func) \ sk_pop_free(CHECKED_STACK_OF(type, st), CHECKED_SK_FREE_FUNC(type, free_func)) # define SKM_sk_deep_copy(type, st, copy_func, free_func) \ (STACK_OF(type) *)sk_deep_copy(CHECKED_STACK_OF(type, st), CHECKED_SK_COPY_FUNC(type, copy_func), CHECKED_SK_FREE_FUNC(type, free_func)) # define SKM_sk_shift(type, st) \ (type *)sk_shift(CHECKED_STACK_OF(type, st)) # define SKM_sk_pop(type, st) \ (type *)sk_pop(CHECKED_STACK_OF(type, st)) # define SKM_sk_sort(type, st) \ sk_sort(CHECKED_STACK_OF(type, st)) # define SKM_sk_is_sorted(type, st) \ sk_is_sorted(CHECKED_STACK_OF(type, st)) # define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ (STACK_OF(type) *)d2i_ASN1_SET( \ (STACK_OF(OPENSSL_BLOCK) **)CHECKED_PTR_OF(STACK_OF(type)*, st), \ pp, length, \ CHECKED_D2I_OF(type, d2i_func), \ CHECKED_SK_FREE_FUNC(type, free_func), \ ex_tag, ex_class) # define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \ i2d_ASN1_SET((STACK_OF(OPENSSL_BLOCK) *)CHECKED_STACK_OF(type, st), pp, \ CHECKED_I2D_OF(type, i2d_func), \ ex_tag, ex_class, is_set) # define SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \ ASN1_seq_pack(CHECKED_PTR_OF(STACK_OF(type), st), \ CHECKED_I2D_OF(type, i2d_func), buf, len) # define SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \ (STACK_OF(type) *)ASN1_seq_unpack(buf, len, CHECKED_D2I_OF(type, d2i_func), CHECKED_SK_FREE_FUNC(type, free_func)) # define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \ (STACK_OF(type) *)PKCS12_decrypt_d2i(algor, \ CHECKED_D2I_OF(type, d2i_func), \ CHECKED_SK_FREE_FUNC(type, free_func), \ pass, passlen, oct, seq) /* * This block of defines is updated by util/mkstack.pl, please do not touch! */ # define sk_ACCESS_DESCRIPTION_new(cmp) SKM_sk_new(ACCESS_DESCRIPTION, (cmp)) # define sk_ACCESS_DESCRIPTION_new_null() SKM_sk_new_null(ACCESS_DESCRIPTION) # define sk_ACCESS_DESCRIPTION_free(st) SKM_sk_free(ACCESS_DESCRIPTION, (st)) # define sk_ACCESS_DESCRIPTION_num(st) SKM_sk_num(ACCESS_DESCRIPTION, (st)) # define sk_ACCESS_DESCRIPTION_value(st, i) SKM_sk_value(ACCESS_DESCRIPTION, (st), (i)) # define sk_ACCESS_DESCRIPTION_set(st, i, val) SKM_sk_set(ACCESS_DESCRIPTION, (st), (i), (val)) # define sk_ACCESS_DESCRIPTION_zero(st) SKM_sk_zero(ACCESS_DESCRIPTION, (st)) # define sk_ACCESS_DESCRIPTION_push(st, val) SKM_sk_push(ACCESS_DESCRIPTION, (st), (val)) # define sk_ACCESS_DESCRIPTION_unshift(st, val) SKM_sk_unshift(ACCESS_DESCRIPTION, (st), (val)) # define sk_ACCESS_DESCRIPTION_find(st, val) SKM_sk_find(ACCESS_DESCRIPTION, (st), (val)) # define sk_ACCESS_DESCRIPTION_find_ex(st, val) SKM_sk_find_ex(ACCESS_DESCRIPTION, (st), (val)) # define sk_ACCESS_DESCRIPTION_delete(st, i) SKM_sk_delete(ACCESS_DESCRIPTION, (st), (i)) # define sk_ACCESS_DESCRIPTION_delete_ptr(st, ptr) SKM_sk_delete_ptr(ACCESS_DESCRIPTION, (st), (ptr)) # define sk_ACCESS_DESCRIPTION_insert(st, val, i) SKM_sk_insert(ACCESS_DESCRIPTION, (st), (val), (i)) # define sk_ACCESS_DESCRIPTION_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ACCESS_DESCRIPTION, (st), (cmp)) # define sk_ACCESS_DESCRIPTION_dup(st) SKM_sk_dup(ACCESS_DESCRIPTION, st) # define sk_ACCESS_DESCRIPTION_pop_free(st, free_func) SKM_sk_pop_free(ACCESS_DESCRIPTION, (st), (free_func)) # define sk_ACCESS_DESCRIPTION_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(ACCESS_DESCRIPTION, (st), (copy_func), (free_func)) # define sk_ACCESS_DESCRIPTION_shift(st) SKM_sk_shift(ACCESS_DESCRIPTION, (st)) # define sk_ACCESS_DESCRIPTION_pop(st) SKM_sk_pop(ACCESS_DESCRIPTION, (st)) # define sk_ACCESS_DESCRIPTION_sort(st) SKM_sk_sort(ACCESS_DESCRIPTION, (st)) # define sk_ACCESS_DESCRIPTION_is_sorted(st) SKM_sk_is_sorted(ACCESS_DESCRIPTION, (st)) # define sk_ASIdOrRange_new(cmp) SKM_sk_new(ASIdOrRange, (cmp)) # define sk_ASIdOrRange_new_null() SKM_sk_new_null(ASIdOrRange) # define sk_ASIdOrRange_free(st) SKM_sk_free(ASIdOrRange, (st)) # define sk_ASIdOrRange_num(st) SKM_sk_num(ASIdOrRange, (st)) # define sk_ASIdOrRange_value(st, i) SKM_sk_value(ASIdOrRange, (st), (i)) # define sk_ASIdOrRange_set(st, i, val) SKM_sk_set(ASIdOrRange, (st), (i), (val)) # define sk_ASIdOrRange_zero(st) SKM_sk_zero(ASIdOrRange, (st)) # define sk_ASIdOrRange_push(st, val) SKM_sk_push(ASIdOrRange, (st), (val)) # define sk_ASIdOrRange_unshift(st, val) SKM_sk_unshift(ASIdOrRange, (st), (val)) # define sk_ASIdOrRange_find(st, val) SKM_sk_find(ASIdOrRange, (st), (val)) # define sk_ASIdOrRange_find_ex(st, val) SKM_sk_find_ex(ASIdOrRange, (st), (val)) # define sk_ASIdOrRange_delete(st, i) SKM_sk_delete(ASIdOrRange, (st), (i)) # define sk_ASIdOrRange_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASIdOrRange, (st), (ptr)) # define sk_ASIdOrRange_insert(st, val, i) SKM_sk_insert(ASIdOrRange, (st), (val), (i)) # define sk_ASIdOrRange_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASIdOrRange, (st), (cmp)) # define sk_ASIdOrRange_dup(st) SKM_sk_dup(ASIdOrRange, st) # define sk_ASIdOrRange_pop_free(st, free_func) SKM_sk_pop_free(ASIdOrRange, (st), (free_func)) # define sk_ASIdOrRange_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(ASIdOrRange, (st), (copy_func), (free_func)) # define sk_ASIdOrRange_shift(st) SKM_sk_shift(ASIdOrRange, (st)) # define sk_ASIdOrRange_pop(st) SKM_sk_pop(ASIdOrRange, (st)) # define sk_ASIdOrRange_sort(st) SKM_sk_sort(ASIdOrRange, (st)) # define sk_ASIdOrRange_is_sorted(st) SKM_sk_is_sorted(ASIdOrRange, (st)) # define sk_ASN1_GENERALSTRING_new(cmp) SKM_sk_new(ASN1_GENERALSTRING, (cmp)) # define sk_ASN1_GENERALSTRING_new_null() SKM_sk_new_null(ASN1_GENERALSTRING) # define sk_ASN1_GENERALSTRING_free(st) SKM_sk_free(ASN1_GENERALSTRING, (st)) # define sk_ASN1_GENERALSTRING_num(st) SKM_sk_num(ASN1_GENERALSTRING, (st)) # define sk_ASN1_GENERALSTRING_value(st, i) SKM_sk_value(ASN1_GENERALSTRING, (st), (i)) # define sk_ASN1_GENERALSTRING_set(st, i, val) SKM_sk_set(ASN1_GENERALSTRING, (st), (i), (val)) # define sk_ASN1_GENERALSTRING_zero(st) SKM_sk_zero(ASN1_GENERALSTRING, (st)) # define sk_ASN1_GENERALSTRING_push(st, val) SKM_sk_push(ASN1_GENERALSTRING, (st), (val)) # define sk_ASN1_GENERALSTRING_unshift(st, val) SKM_sk_unshift(ASN1_GENERALSTRING, (st), (val)) # define sk_ASN1_GENERALSTRING_find(st, val) SKM_sk_find(ASN1_GENERALSTRING, (st), (val)) # define sk_ASN1_GENERALSTRING_find_ex(st, val) SKM_sk_find_ex(ASN1_GENERALSTRING, (st), (val)) # define sk_ASN1_GENERALSTRING_delete(st, i) SKM_sk_delete(ASN1_GENERALSTRING, (st), (i)) # define sk_ASN1_GENERALSTRING_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_GENERALSTRING, (st), (ptr)) # define sk_ASN1_GENERALSTRING_insert(st, val, i) SKM_sk_insert(ASN1_GENERALSTRING, (st), (val), (i)) # define sk_ASN1_GENERALSTRING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_GENERALSTRING, (st), (cmp)) # define sk_ASN1_GENERALSTRING_dup(st) SKM_sk_dup(ASN1_GENERALSTRING, st) # define sk_ASN1_GENERALSTRING_pop_free(st, free_func) SKM_sk_pop_free(ASN1_GENERALSTRING, (st), (free_func)) # define sk_ASN1_GENERALSTRING_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(ASN1_GENERALSTRING, (st), (copy_func), (free_func)) # define sk_ASN1_GENERALSTRING_shift(st) SKM_sk_shift(ASN1_GENERALSTRING, (st)) # define sk_ASN1_GENERALSTRING_pop(st) SKM_sk_pop(ASN1_GENERALSTRING, (st)) # define sk_ASN1_GENERALSTRING_sort(st) SKM_sk_sort(ASN1_GENERALSTRING, (st)) # define sk_ASN1_GENERALSTRING_is_sorted(st) SKM_sk_is_sorted(ASN1_GENERALSTRING, (st)) # define sk_ASN1_INTEGER_new(cmp) SKM_sk_new(ASN1_INTEGER, (cmp)) # define sk_ASN1_INTEGER_new_null() SKM_sk_new_null(ASN1_INTEGER) # define sk_ASN1_INTEGER_free(st) SKM_sk_free(ASN1_INTEGER, (st)) # define sk_ASN1_INTEGER_num(st) SKM_sk_num(ASN1_INTEGER, (st)) # define sk_ASN1_INTEGER_value(st, i) SKM_sk_value(ASN1_INTEGER, (st), (i)) # define sk_ASN1_INTEGER_set(st, i, val) SKM_sk_set(ASN1_INTEGER, (st), (i), (val)) # define sk_ASN1_INTEGER_zero(st) SKM_sk_zero(ASN1_INTEGER, (st)) # define sk_ASN1_INTEGER_push(st, val) SKM_sk_push(ASN1_INTEGER, (st), (val)) # define sk_ASN1_INTEGER_unshift(st, val) SKM_sk_unshift(ASN1_INTEGER, (st), (val)) # define sk_ASN1_INTEGER_find(st, val) SKM_sk_find(ASN1_INTEGER, (st), (val)) # define sk_ASN1_INTEGER_find_ex(st, val) SKM_sk_find_ex(ASN1_INTEGER, (st), (val)) # define sk_ASN1_INTEGER_delete(st, i) SKM_sk_delete(ASN1_INTEGER, (st), (i)) # define sk_ASN1_INTEGER_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_INTEGER, (st), (ptr)) # define sk_ASN1_INTEGER_insert(st, val, i) SKM_sk_insert(ASN1_INTEGER, (st), (val), (i)) # define sk_ASN1_INTEGER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_INTEGER, (st), (cmp)) # define sk_ASN1_INTEGER_dup(st) SKM_sk_dup(ASN1_INTEGER, st) # define sk_ASN1_INTEGER_pop_free(st, free_func) SKM_sk_pop_free(ASN1_INTEGER, (st), (free_func)) # define sk_ASN1_INTEGER_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(ASN1_INTEGER, (st), (copy_func), (free_func)) # define sk_ASN1_INTEGER_shift(st) SKM_sk_shift(ASN1_INTEGER, (st)) # define sk_ASN1_INTEGER_pop(st) SKM_sk_pop(ASN1_INTEGER, (st)) # define sk_ASN1_INTEGER_sort(st) SKM_sk_sort(ASN1_INTEGER, (st)) # define sk_ASN1_INTEGER_is_sorted(st) SKM_sk_is_sorted(ASN1_INTEGER, (st)) # define sk_ASN1_OBJECT_new(cmp) SKM_sk_new(ASN1_OBJECT, (cmp)) # define sk_ASN1_OBJECT_new_null() SKM_sk_new_null(ASN1_OBJECT) # define sk_ASN1_OBJECT_free(st) SKM_sk_free(ASN1_OBJECT, (st)) # define sk_ASN1_OBJECT_num(st) SKM_sk_num(ASN1_OBJECT, (st)) # define sk_ASN1_OBJECT_value(st, i) SKM_sk_value(ASN1_OBJECT, (st), (i)) # define sk_ASN1_OBJECT_set(st, i, val) SKM_sk_set(ASN1_OBJECT, (st), (i), (val)) # define sk_ASN1_OBJECT_zero(st) SKM_sk_zero(ASN1_OBJECT, (st)) # define sk_ASN1_OBJECT_push(st, val) SKM_sk_push(ASN1_OBJECT, (st), (val)) # define sk_ASN1_OBJECT_unshift(st, val) SKM_sk_unshift(ASN1_OBJECT, (st), (val)) # define sk_ASN1_OBJECT_find(st, val) SKM_sk_find(ASN1_OBJECT, (st), (val)) # define sk_ASN1_OBJECT_find_ex(st, val) SKM_sk_find_ex(ASN1_OBJECT, (st), (val)) # define sk_ASN1_OBJECT_delete(st, i) SKM_sk_delete(ASN1_OBJECT, (st), (i)) # define sk_ASN1_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_OBJECT, (st), (ptr)) # define sk_ASN1_OBJECT_insert(st, val, i) SKM_sk_insert(ASN1_OBJECT, (st), (val), (i)) # define sk_ASN1_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_OBJECT, (st), (cmp)) # define sk_ASN1_OBJECT_dup(st) SKM_sk_dup(ASN1_OBJECT, st) # define sk_ASN1_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(ASN1_OBJECT, (st), (free_func)) # define sk_ASN1_OBJECT_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(ASN1_OBJECT, (st), (copy_func), (free_func)) # define sk_ASN1_OBJECT_shift(st) SKM_sk_shift(ASN1_OBJECT, (st)) # define sk_ASN1_OBJECT_pop(st) SKM_sk_pop(ASN1_OBJECT, (st)) # define sk_ASN1_OBJECT_sort(st) SKM_sk_sort(ASN1_OBJECT, (st)) # define sk_ASN1_OBJECT_is_sorted(st) SKM_sk_is_sorted(ASN1_OBJECT, (st)) # define sk_ASN1_STRING_TABLE_new(cmp) SKM_sk_new(ASN1_STRING_TABLE, (cmp)) # define sk_ASN1_STRING_TABLE_new_null() SKM_sk_new_null(ASN1_STRING_TABLE) # define sk_ASN1_STRING_TABLE_free(st) SKM_sk_free(ASN1_STRING_TABLE, (st)) # define sk_ASN1_STRING_TABLE_num(st) SKM_sk_num(ASN1_STRING_TABLE, (st)) # define sk_ASN1_STRING_TABLE_value(st, i) SKM_sk_value(ASN1_STRING_TABLE, (st), (i)) # define sk_ASN1_STRING_TABLE_set(st, i, val) SKM_sk_set(ASN1_STRING_TABLE, (st), (i), (val)) # define sk_ASN1_STRING_TABLE_zero(st) SKM_sk_zero(ASN1_STRING_TABLE, (st)) # define sk_ASN1_STRING_TABLE_push(st, val) SKM_sk_push(ASN1_STRING_TABLE, (st), (val)) # define sk_ASN1_STRING_TABLE_unshift(st, val) SKM_sk_unshift(ASN1_STRING_TABLE, (st), (val)) # define sk_ASN1_STRING_TABLE_find(st, val) SKM_sk_find(ASN1_STRING_TABLE, (st), (val)) # define sk_ASN1_STRING_TABLE_find_ex(st, val) SKM_sk_find_ex(ASN1_STRING_TABLE, (st), (val)) # define sk_ASN1_STRING_TABLE_delete(st, i) SKM_sk_delete(ASN1_STRING_TABLE, (st), (i)) # define sk_ASN1_STRING_TABLE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_STRING_TABLE, (st), (ptr)) # define sk_ASN1_STRING_TABLE_insert(st, val, i) SKM_sk_insert(ASN1_STRING_TABLE, (st), (val), (i)) # define sk_ASN1_STRING_TABLE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_STRING_TABLE, (st), (cmp)) # define sk_ASN1_STRING_TABLE_dup(st) SKM_sk_dup(ASN1_STRING_TABLE, st) # define sk_ASN1_STRING_TABLE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_STRING_TABLE, (st), (free_func)) # define sk_ASN1_STRING_TABLE_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(ASN1_STRING_TABLE, (st), (copy_func), (free_func)) # define sk_ASN1_STRING_TABLE_shift(st) SKM_sk_shift(ASN1_STRING_TABLE, (st)) # define sk_ASN1_STRING_TABLE_pop(st) SKM_sk_pop(ASN1_STRING_TABLE, (st)) # define sk_ASN1_STRING_TABLE_sort(st) SKM_sk_sort(ASN1_STRING_TABLE, (st)) # define sk_ASN1_STRING_TABLE_is_sorted(st) SKM_sk_is_sorted(ASN1_STRING_TABLE, (st)) # define sk_ASN1_TYPE_new(cmp) SKM_sk_new(ASN1_TYPE, (cmp)) # define sk_ASN1_TYPE_new_null() SKM_sk_new_null(ASN1_TYPE) # define sk_ASN1_TYPE_free(st) SKM_sk_free(ASN1_TYPE, (st)) # define sk_ASN1_TYPE_num(st) SKM_sk_num(ASN1_TYPE, (st)) # define sk_ASN1_TYPE_value(st, i) SKM_sk_value(ASN1_TYPE, (st), (i)) # define sk_ASN1_TYPE_set(st, i, val) SKM_sk_set(ASN1_TYPE, (st), (i), (val)) # define sk_ASN1_TYPE_zero(st) SKM_sk_zero(ASN1_TYPE, (st)) # define sk_ASN1_TYPE_push(st, val) SKM_sk_push(ASN1_TYPE, (st), (val)) # define sk_ASN1_TYPE_unshift(st, val) SKM_sk_unshift(ASN1_TYPE, (st), (val)) # define sk_ASN1_TYPE_find(st, val) SKM_sk_find(ASN1_TYPE, (st), (val)) # define sk_ASN1_TYPE_find_ex(st, val) SKM_sk_find_ex(ASN1_TYPE, (st), (val)) # define sk_ASN1_TYPE_delete(st, i) SKM_sk_delete(ASN1_TYPE, (st), (i)) # define sk_ASN1_TYPE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_TYPE, (st), (ptr)) # define sk_ASN1_TYPE_insert(st, val, i) SKM_sk_insert(ASN1_TYPE, (st), (val), (i)) # define sk_ASN1_TYPE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_TYPE, (st), (cmp)) # define sk_ASN1_TYPE_dup(st) SKM_sk_dup(ASN1_TYPE, st) # define sk_ASN1_TYPE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_TYPE, (st), (free_func)) # define sk_ASN1_TYPE_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(ASN1_TYPE, (st), (copy_func), (free_func)) # define sk_ASN1_TYPE_shift(st) SKM_sk_shift(ASN1_TYPE, (st)) # define sk_ASN1_TYPE_pop(st) SKM_sk_pop(ASN1_TYPE, (st)) # define sk_ASN1_TYPE_sort(st) SKM_sk_sort(ASN1_TYPE, (st)) # define sk_ASN1_TYPE_is_sorted(st) SKM_sk_is_sorted(ASN1_TYPE, (st)) # define sk_ASN1_UTF8STRING_new(cmp) SKM_sk_new(ASN1_UTF8STRING, (cmp)) # define sk_ASN1_UTF8STRING_new_null() SKM_sk_new_null(ASN1_UTF8STRING) # define sk_ASN1_UTF8STRING_free(st) SKM_sk_free(ASN1_UTF8STRING, (st)) # define sk_ASN1_UTF8STRING_num(st) SKM_sk_num(ASN1_UTF8STRING, (st)) # define sk_ASN1_UTF8STRING_value(st, i) SKM_sk_value(ASN1_UTF8STRING, (st), (i)) # define sk_ASN1_UTF8STRING_set(st, i, val) SKM_sk_set(ASN1_UTF8STRING, (st), (i), (val)) # define sk_ASN1_UTF8STRING_zero(st) SKM_sk_zero(ASN1_UTF8STRING, (st)) # define sk_ASN1_UTF8STRING_push(st, val) SKM_sk_push(ASN1_UTF8STRING, (st), (val)) # define sk_ASN1_UTF8STRING_unshift(st, val) SKM_sk_unshift(ASN1_UTF8STRING, (st), (val)) # define sk_ASN1_UTF8STRING_find(st, val) SKM_sk_find(ASN1_UTF8STRING, (st), (val)) # define sk_ASN1_UTF8STRING_find_ex(st, val) SKM_sk_find_ex(ASN1_UTF8STRING, (st), (val)) # define sk_ASN1_UTF8STRING_delete(st, i) SKM_sk_delete(ASN1_UTF8STRING, (st), (i)) # define sk_ASN1_UTF8STRING_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_UTF8STRING, (st), (ptr)) # define sk_ASN1_UTF8STRING_insert(st, val, i) SKM_sk_insert(ASN1_UTF8STRING, (st), (val), (i)) # define sk_ASN1_UTF8STRING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_UTF8STRING, (st), (cmp)) # define sk_ASN1_UTF8STRING_dup(st) SKM_sk_dup(ASN1_UTF8STRING, st) # define sk_ASN1_UTF8STRING_pop_free(st, free_func) SKM_sk_pop_free(ASN1_UTF8STRING, (st), (free_func)) # define sk_ASN1_UTF8STRING_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(ASN1_UTF8STRING, (st), (copy_func), (free_func)) # define sk_ASN1_UTF8STRING_shift(st) SKM_sk_shift(ASN1_UTF8STRING, (st)) # define sk_ASN1_UTF8STRING_pop(st) SKM_sk_pop(ASN1_UTF8STRING, (st)) # define sk_ASN1_UTF8STRING_sort(st) SKM_sk_sort(ASN1_UTF8STRING, (st)) # define sk_ASN1_UTF8STRING_is_sorted(st) SKM_sk_is_sorted(ASN1_UTF8STRING, (st)) # define sk_ASN1_VALUE_new(cmp) SKM_sk_new(ASN1_VALUE, (cmp)) # define sk_ASN1_VALUE_new_null() SKM_sk_new_null(ASN1_VALUE) # define sk_ASN1_VALUE_free(st) SKM_sk_free(ASN1_VALUE, (st)) # define sk_ASN1_VALUE_num(st) SKM_sk_num(ASN1_VALUE, (st)) # define sk_ASN1_VALUE_value(st, i) SKM_sk_value(ASN1_VALUE, (st), (i)) # define sk_ASN1_VALUE_set(st, i, val) SKM_sk_set(ASN1_VALUE, (st), (i), (val)) # define sk_ASN1_VALUE_zero(st) SKM_sk_zero(ASN1_VALUE, (st)) # define sk_ASN1_VALUE_push(st, val) SKM_sk_push(ASN1_VALUE, (st), (val)) # define sk_ASN1_VALUE_unshift(st, val) SKM_sk_unshift(ASN1_VALUE, (st), (val)) # define sk_ASN1_VALUE_find(st, val) SKM_sk_find(ASN1_VALUE, (st), (val)) # define sk_ASN1_VALUE_find_ex(st, val) SKM_sk_find_ex(ASN1_VALUE, (st), (val)) # define sk_ASN1_VALUE_delete(st, i) SKM_sk_delete(ASN1_VALUE, (st), (i)) # define sk_ASN1_VALUE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_VALUE, (st), (ptr)) # define sk_ASN1_VALUE_insert(st, val, i) SKM_sk_insert(ASN1_VALUE, (st), (val), (i)) # define sk_ASN1_VALUE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_VALUE, (st), (cmp)) # define sk_ASN1_VALUE_dup(st) SKM_sk_dup(ASN1_VALUE, st) # define sk_ASN1_VALUE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_VALUE, (st), (free_func)) # define sk_ASN1_VALUE_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(ASN1_VALUE, (st), (copy_func), (free_func)) # define sk_ASN1_VALUE_shift(st) SKM_sk_shift(ASN1_VALUE, (st)) # define sk_ASN1_VALUE_pop(st) SKM_sk_pop(ASN1_VALUE, (st)) # define sk_ASN1_VALUE_sort(st) SKM_sk_sort(ASN1_VALUE, (st)) # define sk_ASN1_VALUE_is_sorted(st) SKM_sk_is_sorted(ASN1_VALUE, (st)) # define sk_BIO_new(cmp) SKM_sk_new(BIO, (cmp)) # define sk_BIO_new_null() SKM_sk_new_null(BIO) # define sk_BIO_free(st) SKM_sk_free(BIO, (st)) # define sk_BIO_num(st) SKM_sk_num(BIO, (st)) # define sk_BIO_value(st, i) SKM_sk_value(BIO, (st), (i)) # define sk_BIO_set(st, i, val) SKM_sk_set(BIO, (st), (i), (val)) # define sk_BIO_zero(st) SKM_sk_zero(BIO, (st)) # define sk_BIO_push(st, val) SKM_sk_push(BIO, (st), (val)) # define sk_BIO_unshift(st, val) SKM_sk_unshift(BIO, (st), (val)) # define sk_BIO_find(st, val) SKM_sk_find(BIO, (st), (val)) # define sk_BIO_find_ex(st, val) SKM_sk_find_ex(BIO, (st), (val)) # define sk_BIO_delete(st, i) SKM_sk_delete(BIO, (st), (i)) # define sk_BIO_delete_ptr(st, ptr) SKM_sk_delete_ptr(BIO, (st), (ptr)) # define sk_BIO_insert(st, val, i) SKM_sk_insert(BIO, (st), (val), (i)) # define sk_BIO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(BIO, (st), (cmp)) # define sk_BIO_dup(st) SKM_sk_dup(BIO, st) # define sk_BIO_pop_free(st, free_func) SKM_sk_pop_free(BIO, (st), (free_func)) # define sk_BIO_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(BIO, (st), (copy_func), (free_func)) # define sk_BIO_shift(st) SKM_sk_shift(BIO, (st)) # define sk_BIO_pop(st) SKM_sk_pop(BIO, (st)) # define sk_BIO_sort(st) SKM_sk_sort(BIO, (st)) # define sk_BIO_is_sorted(st) SKM_sk_is_sorted(BIO, (st)) # define sk_BY_DIR_ENTRY_new(cmp) SKM_sk_new(BY_DIR_ENTRY, (cmp)) # define sk_BY_DIR_ENTRY_new_null() SKM_sk_new_null(BY_DIR_ENTRY) # define sk_BY_DIR_ENTRY_free(st) SKM_sk_free(BY_DIR_ENTRY, (st)) # define sk_BY_DIR_ENTRY_num(st) SKM_sk_num(BY_DIR_ENTRY, (st)) # define sk_BY_DIR_ENTRY_value(st, i) SKM_sk_value(BY_DIR_ENTRY, (st), (i)) # define sk_BY_DIR_ENTRY_set(st, i, val) SKM_sk_set(BY_DIR_ENTRY, (st), (i), (val)) # define sk_BY_DIR_ENTRY_zero(st) SKM_sk_zero(BY_DIR_ENTRY, (st)) # define sk_BY_DIR_ENTRY_push(st, val) SKM_sk_push(BY_DIR_ENTRY, (st), (val)) # define sk_BY_DIR_ENTRY_unshift(st, val) SKM_sk_unshift(BY_DIR_ENTRY, (st), (val)) # define sk_BY_DIR_ENTRY_find(st, val) SKM_sk_find(BY_DIR_ENTRY, (st), (val)) # define sk_BY_DIR_ENTRY_find_ex(st, val) SKM_sk_find_ex(BY_DIR_ENTRY, (st), (val)) # define sk_BY_DIR_ENTRY_delete(st, i) SKM_sk_delete(BY_DIR_ENTRY, (st), (i)) # define sk_BY_DIR_ENTRY_delete_ptr(st, ptr) SKM_sk_delete_ptr(BY_DIR_ENTRY, (st), (ptr)) # define sk_BY_DIR_ENTRY_insert(st, val, i) SKM_sk_insert(BY_DIR_ENTRY, (st), (val), (i)) # define sk_BY_DIR_ENTRY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(BY_DIR_ENTRY, (st), (cmp)) # define sk_BY_DIR_ENTRY_dup(st) SKM_sk_dup(BY_DIR_ENTRY, st) # define sk_BY_DIR_ENTRY_pop_free(st, free_func) SKM_sk_pop_free(BY_DIR_ENTRY, (st), (free_func)) # define sk_BY_DIR_ENTRY_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(BY_DIR_ENTRY, (st), (copy_func), (free_func)) # define sk_BY_DIR_ENTRY_shift(st) SKM_sk_shift(BY_DIR_ENTRY, (st)) # define sk_BY_DIR_ENTRY_pop(st) SKM_sk_pop(BY_DIR_ENTRY, (st)) # define sk_BY_DIR_ENTRY_sort(st) SKM_sk_sort(BY_DIR_ENTRY, (st)) # define sk_BY_DIR_ENTRY_is_sorted(st) SKM_sk_is_sorted(BY_DIR_ENTRY, (st)) # define sk_BY_DIR_HASH_new(cmp) SKM_sk_new(BY_DIR_HASH, (cmp)) # define sk_BY_DIR_HASH_new_null() SKM_sk_new_null(BY_DIR_HASH) # define sk_BY_DIR_HASH_free(st) SKM_sk_free(BY_DIR_HASH, (st)) # define sk_BY_DIR_HASH_num(st) SKM_sk_num(BY_DIR_HASH, (st)) # define sk_BY_DIR_HASH_value(st, i) SKM_sk_value(BY_DIR_HASH, (st), (i)) # define sk_BY_DIR_HASH_set(st, i, val) SKM_sk_set(BY_DIR_HASH, (st), (i), (val)) # define sk_BY_DIR_HASH_zero(st) SKM_sk_zero(BY_DIR_HASH, (st)) # define sk_BY_DIR_HASH_push(st, val) SKM_sk_push(BY_DIR_HASH, (st), (val)) # define sk_BY_DIR_HASH_unshift(st, val) SKM_sk_unshift(BY_DIR_HASH, (st), (val)) # define sk_BY_DIR_HASH_find(st, val) SKM_sk_find(BY_DIR_HASH, (st), (val)) # define sk_BY_DIR_HASH_find_ex(st, val) SKM_sk_find_ex(BY_DIR_HASH, (st), (val)) # define sk_BY_DIR_HASH_delete(st, i) SKM_sk_delete(BY_DIR_HASH, (st), (i)) # define sk_BY_DIR_HASH_delete_ptr(st, ptr) SKM_sk_delete_ptr(BY_DIR_HASH, (st), (ptr)) # define sk_BY_DIR_HASH_insert(st, val, i) SKM_sk_insert(BY_DIR_HASH, (st), (val), (i)) # define sk_BY_DIR_HASH_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(BY_DIR_HASH, (st), (cmp)) # define sk_BY_DIR_HASH_dup(st) SKM_sk_dup(BY_DIR_HASH, st) # define sk_BY_DIR_HASH_pop_free(st, free_func) SKM_sk_pop_free(BY_DIR_HASH, (st), (free_func)) # define sk_BY_DIR_HASH_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(BY_DIR_HASH, (st), (copy_func), (free_func)) # define sk_BY_DIR_HASH_shift(st) SKM_sk_shift(BY_DIR_HASH, (st)) # define sk_BY_DIR_HASH_pop(st) SKM_sk_pop(BY_DIR_HASH, (st)) # define sk_BY_DIR_HASH_sort(st) SKM_sk_sort(BY_DIR_HASH, (st)) # define sk_BY_DIR_HASH_is_sorted(st) SKM_sk_is_sorted(BY_DIR_HASH, (st)) # define sk_CMS_CertificateChoices_new(cmp) SKM_sk_new(CMS_CertificateChoices, (cmp)) # define sk_CMS_CertificateChoices_new_null() SKM_sk_new_null(CMS_CertificateChoices) # define sk_CMS_CertificateChoices_free(st) SKM_sk_free(CMS_CertificateChoices, (st)) # define sk_CMS_CertificateChoices_num(st) SKM_sk_num(CMS_CertificateChoices, (st)) # define sk_CMS_CertificateChoices_value(st, i) SKM_sk_value(CMS_CertificateChoices, (st), (i)) # define sk_CMS_CertificateChoices_set(st, i, val) SKM_sk_set(CMS_CertificateChoices, (st), (i), (val)) # define sk_CMS_CertificateChoices_zero(st) SKM_sk_zero(CMS_CertificateChoices, (st)) # define sk_CMS_CertificateChoices_push(st, val) SKM_sk_push(CMS_CertificateChoices, (st), (val)) # define sk_CMS_CertificateChoices_unshift(st, val) SKM_sk_unshift(CMS_CertificateChoices, (st), (val)) # define sk_CMS_CertificateChoices_find(st, val) SKM_sk_find(CMS_CertificateChoices, (st), (val)) # define sk_CMS_CertificateChoices_find_ex(st, val) SKM_sk_find_ex(CMS_CertificateChoices, (st), (val)) # define sk_CMS_CertificateChoices_delete(st, i) SKM_sk_delete(CMS_CertificateChoices, (st), (i)) # define sk_CMS_CertificateChoices_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_CertificateChoices, (st), (ptr)) # define sk_CMS_CertificateChoices_insert(st, val, i) SKM_sk_insert(CMS_CertificateChoices, (st), (val), (i)) # define sk_CMS_CertificateChoices_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_CertificateChoices, (st), (cmp)) # define sk_CMS_CertificateChoices_dup(st) SKM_sk_dup(CMS_CertificateChoices, st) # define sk_CMS_CertificateChoices_pop_free(st, free_func) SKM_sk_pop_free(CMS_CertificateChoices, (st), (free_func)) # define sk_CMS_CertificateChoices_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(CMS_CertificateChoices, (st), (copy_func), (free_func)) # define sk_CMS_CertificateChoices_shift(st) SKM_sk_shift(CMS_CertificateChoices, (st)) # define sk_CMS_CertificateChoices_pop(st) SKM_sk_pop(CMS_CertificateChoices, (st)) # define sk_CMS_CertificateChoices_sort(st) SKM_sk_sort(CMS_CertificateChoices, (st)) # define sk_CMS_CertificateChoices_is_sorted(st) SKM_sk_is_sorted(CMS_CertificateChoices, (st)) # define sk_CMS_RecipientEncryptedKey_new(cmp) SKM_sk_new(CMS_RecipientEncryptedKey, (cmp)) # define sk_CMS_RecipientEncryptedKey_new_null() SKM_sk_new_null(CMS_RecipientEncryptedKey) # define sk_CMS_RecipientEncryptedKey_free(st) SKM_sk_free(CMS_RecipientEncryptedKey, (st)) # define sk_CMS_RecipientEncryptedKey_num(st) SKM_sk_num(CMS_RecipientEncryptedKey, (st)) # define sk_CMS_RecipientEncryptedKey_value(st, i) SKM_sk_value(CMS_RecipientEncryptedKey, (st), (i)) # define sk_CMS_RecipientEncryptedKey_set(st, i, val) SKM_sk_set(CMS_RecipientEncryptedKey, (st), (i), (val)) # define sk_CMS_RecipientEncryptedKey_zero(st) SKM_sk_zero(CMS_RecipientEncryptedKey, (st)) # define sk_CMS_RecipientEncryptedKey_push(st, val) SKM_sk_push(CMS_RecipientEncryptedKey, (st), (val)) # define sk_CMS_RecipientEncryptedKey_unshift(st, val) SKM_sk_unshift(CMS_RecipientEncryptedKey, (st), (val)) # define sk_CMS_RecipientEncryptedKey_find(st, val) SKM_sk_find(CMS_RecipientEncryptedKey, (st), (val)) # define sk_CMS_RecipientEncryptedKey_find_ex(st, val) SKM_sk_find_ex(CMS_RecipientEncryptedKey, (st), (val)) # define sk_CMS_RecipientEncryptedKey_delete(st, i) SKM_sk_delete(CMS_RecipientEncryptedKey, (st), (i)) # define sk_CMS_RecipientEncryptedKey_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_RecipientEncryptedKey, (st), (ptr)) # define sk_CMS_RecipientEncryptedKey_insert(st, val, i) SKM_sk_insert(CMS_RecipientEncryptedKey, (st), (val), (i)) # define sk_CMS_RecipientEncryptedKey_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_RecipientEncryptedKey, (st), (cmp)) # define sk_CMS_RecipientEncryptedKey_dup(st) SKM_sk_dup(CMS_RecipientEncryptedKey, st) # define sk_CMS_RecipientEncryptedKey_pop_free(st, free_func) SKM_sk_pop_free(CMS_RecipientEncryptedKey, (st), (free_func)) # define sk_CMS_RecipientEncryptedKey_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(CMS_RecipientEncryptedKey, (st), (copy_func), (free_func)) # define sk_CMS_RecipientEncryptedKey_shift(st) SKM_sk_shift(CMS_RecipientEncryptedKey, (st)) # define sk_CMS_RecipientEncryptedKey_pop(st) SKM_sk_pop(CMS_RecipientEncryptedKey, (st)) # define sk_CMS_RecipientEncryptedKey_sort(st) SKM_sk_sort(CMS_RecipientEncryptedKey, (st)) # define sk_CMS_RecipientEncryptedKey_is_sorted(st) SKM_sk_is_sorted(CMS_RecipientEncryptedKey, (st)) # define sk_CMS_RecipientInfo_new(cmp) SKM_sk_new(CMS_RecipientInfo, (cmp)) # define sk_CMS_RecipientInfo_new_null() SKM_sk_new_null(CMS_RecipientInfo) # define sk_CMS_RecipientInfo_free(st) SKM_sk_free(CMS_RecipientInfo, (st)) # define sk_CMS_RecipientInfo_num(st) SKM_sk_num(CMS_RecipientInfo, (st)) # define sk_CMS_RecipientInfo_value(st, i) SKM_sk_value(CMS_RecipientInfo, (st), (i)) # define sk_CMS_RecipientInfo_set(st, i, val) SKM_sk_set(CMS_RecipientInfo, (st), (i), (val)) # define sk_CMS_RecipientInfo_zero(st) SKM_sk_zero(CMS_RecipientInfo, (st)) # define sk_CMS_RecipientInfo_push(st, val) SKM_sk_push(CMS_RecipientInfo, (st), (val)) # define sk_CMS_RecipientInfo_unshift(st, val) SKM_sk_unshift(CMS_RecipientInfo, (st), (val)) # define sk_CMS_RecipientInfo_find(st, val) SKM_sk_find(CMS_RecipientInfo, (st), (val)) # define sk_CMS_RecipientInfo_find_ex(st, val) SKM_sk_find_ex(CMS_RecipientInfo, (st), (val)) # define sk_CMS_RecipientInfo_delete(st, i) SKM_sk_delete(CMS_RecipientInfo, (st), (i)) # define sk_CMS_RecipientInfo_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_RecipientInfo, (st), (ptr)) # define sk_CMS_RecipientInfo_insert(st, val, i) SKM_sk_insert(CMS_RecipientInfo, (st), (val), (i)) # define sk_CMS_RecipientInfo_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_RecipientInfo, (st), (cmp)) # define sk_CMS_RecipientInfo_dup(st) SKM_sk_dup(CMS_RecipientInfo, st) # define sk_CMS_RecipientInfo_pop_free(st, free_func) SKM_sk_pop_free(CMS_RecipientInfo, (st), (free_func)) # define sk_CMS_RecipientInfo_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(CMS_RecipientInfo, (st), (copy_func), (free_func)) # define sk_CMS_RecipientInfo_shift(st) SKM_sk_shift(CMS_RecipientInfo, (st)) # define sk_CMS_RecipientInfo_pop(st) SKM_sk_pop(CMS_RecipientInfo, (st)) # define sk_CMS_RecipientInfo_sort(st) SKM_sk_sort(CMS_RecipientInfo, (st)) # define sk_CMS_RecipientInfo_is_sorted(st) SKM_sk_is_sorted(CMS_RecipientInfo, (st)) # define sk_CMS_RevocationInfoChoice_new(cmp) SKM_sk_new(CMS_RevocationInfoChoice, (cmp)) # define sk_CMS_RevocationInfoChoice_new_null() SKM_sk_new_null(CMS_RevocationInfoChoice) # define sk_CMS_RevocationInfoChoice_free(st) SKM_sk_free(CMS_RevocationInfoChoice, (st)) # define sk_CMS_RevocationInfoChoice_num(st) SKM_sk_num(CMS_RevocationInfoChoice, (st)) # define sk_CMS_RevocationInfoChoice_value(st, i) SKM_sk_value(CMS_RevocationInfoChoice, (st), (i)) # define sk_CMS_RevocationInfoChoice_set(st, i, val) SKM_sk_set(CMS_RevocationInfoChoice, (st), (i), (val)) # define sk_CMS_RevocationInfoChoice_zero(st) SKM_sk_zero(CMS_RevocationInfoChoice, (st)) # define sk_CMS_RevocationInfoChoice_push(st, val) SKM_sk_push(CMS_RevocationInfoChoice, (st), (val)) # define sk_CMS_RevocationInfoChoice_unshift(st, val) SKM_sk_unshift(CMS_RevocationInfoChoice, (st), (val)) # define sk_CMS_RevocationInfoChoice_find(st, val) SKM_sk_find(CMS_RevocationInfoChoice, (st), (val)) # define sk_CMS_RevocationInfoChoice_find_ex(st, val) SKM_sk_find_ex(CMS_RevocationInfoChoice, (st), (val)) # define sk_CMS_RevocationInfoChoice_delete(st, i) SKM_sk_delete(CMS_RevocationInfoChoice, (st), (i)) # define sk_CMS_RevocationInfoChoice_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_RevocationInfoChoice, (st), (ptr)) # define sk_CMS_RevocationInfoChoice_insert(st, val, i) SKM_sk_insert(CMS_RevocationInfoChoice, (st), (val), (i)) # define sk_CMS_RevocationInfoChoice_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_RevocationInfoChoice, (st), (cmp)) # define sk_CMS_RevocationInfoChoice_dup(st) SKM_sk_dup(CMS_RevocationInfoChoice, st) # define sk_CMS_RevocationInfoChoice_pop_free(st, free_func) SKM_sk_pop_free(CMS_RevocationInfoChoice, (st), (free_func)) # define sk_CMS_RevocationInfoChoice_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(CMS_RevocationInfoChoice, (st), (copy_func), (free_func)) # define sk_CMS_RevocationInfoChoice_shift(st) SKM_sk_shift(CMS_RevocationInfoChoice, (st)) # define sk_CMS_RevocationInfoChoice_pop(st) SKM_sk_pop(CMS_RevocationInfoChoice, (st)) # define sk_CMS_RevocationInfoChoice_sort(st) SKM_sk_sort(CMS_RevocationInfoChoice, (st)) # define sk_CMS_RevocationInfoChoice_is_sorted(st) SKM_sk_is_sorted(CMS_RevocationInfoChoice, (st)) # define sk_CMS_SignerInfo_new(cmp) SKM_sk_new(CMS_SignerInfo, (cmp)) # define sk_CMS_SignerInfo_new_null() SKM_sk_new_null(CMS_SignerInfo) # define sk_CMS_SignerInfo_free(st) SKM_sk_free(CMS_SignerInfo, (st)) # define sk_CMS_SignerInfo_num(st) SKM_sk_num(CMS_SignerInfo, (st)) # define sk_CMS_SignerInfo_value(st, i) SKM_sk_value(CMS_SignerInfo, (st), (i)) # define sk_CMS_SignerInfo_set(st, i, val) SKM_sk_set(CMS_SignerInfo, (st), (i), (val)) # define sk_CMS_SignerInfo_zero(st) SKM_sk_zero(CMS_SignerInfo, (st)) # define sk_CMS_SignerInfo_push(st, val) SKM_sk_push(CMS_SignerInfo, (st), (val)) # define sk_CMS_SignerInfo_unshift(st, val) SKM_sk_unshift(CMS_SignerInfo, (st), (val)) # define sk_CMS_SignerInfo_find(st, val) SKM_sk_find(CMS_SignerInfo, (st), (val)) # define sk_CMS_SignerInfo_find_ex(st, val) SKM_sk_find_ex(CMS_SignerInfo, (st), (val)) # define sk_CMS_SignerInfo_delete(st, i) SKM_sk_delete(CMS_SignerInfo, (st), (i)) # define sk_CMS_SignerInfo_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_SignerInfo, (st), (ptr)) # define sk_CMS_SignerInfo_insert(st, val, i) SKM_sk_insert(CMS_SignerInfo, (st), (val), (i)) # define sk_CMS_SignerInfo_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_SignerInfo, (st), (cmp)) # define sk_CMS_SignerInfo_dup(st) SKM_sk_dup(CMS_SignerInfo, st) # define sk_CMS_SignerInfo_pop_free(st, free_func) SKM_sk_pop_free(CMS_SignerInfo, (st), (free_func)) # define sk_CMS_SignerInfo_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(CMS_SignerInfo, (st), (copy_func), (free_func)) # define sk_CMS_SignerInfo_shift(st) SKM_sk_shift(CMS_SignerInfo, (st)) # define sk_CMS_SignerInfo_pop(st) SKM_sk_pop(CMS_SignerInfo, (st)) # define sk_CMS_SignerInfo_sort(st) SKM_sk_sort(CMS_SignerInfo, (st)) # define sk_CMS_SignerInfo_is_sorted(st) SKM_sk_is_sorted(CMS_SignerInfo, (st)) # define sk_CONF_IMODULE_new(cmp) SKM_sk_new(CONF_IMODULE, (cmp)) # define sk_CONF_IMODULE_new_null() SKM_sk_new_null(CONF_IMODULE) # define sk_CONF_IMODULE_free(st) SKM_sk_free(CONF_IMODULE, (st)) # define sk_CONF_IMODULE_num(st) SKM_sk_num(CONF_IMODULE, (st)) # define sk_CONF_IMODULE_value(st, i) SKM_sk_value(CONF_IMODULE, (st), (i)) # define sk_CONF_IMODULE_set(st, i, val) SKM_sk_set(CONF_IMODULE, (st), (i), (val)) # define sk_CONF_IMODULE_zero(st) SKM_sk_zero(CONF_IMODULE, (st)) # define sk_CONF_IMODULE_push(st, val) SKM_sk_push(CONF_IMODULE, (st), (val)) # define sk_CONF_IMODULE_unshift(st, val) SKM_sk_unshift(CONF_IMODULE, (st), (val)) # define sk_CONF_IMODULE_find(st, val) SKM_sk_find(CONF_IMODULE, (st), (val)) # define sk_CONF_IMODULE_find_ex(st, val) SKM_sk_find_ex(CONF_IMODULE, (st), (val)) # define sk_CONF_IMODULE_delete(st, i) SKM_sk_delete(CONF_IMODULE, (st), (i)) # define sk_CONF_IMODULE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_IMODULE, (st), (ptr)) # define sk_CONF_IMODULE_insert(st, val, i) SKM_sk_insert(CONF_IMODULE, (st), (val), (i)) # define sk_CONF_IMODULE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CONF_IMODULE, (st), (cmp)) # define sk_CONF_IMODULE_dup(st) SKM_sk_dup(CONF_IMODULE, st) # define sk_CONF_IMODULE_pop_free(st, free_func) SKM_sk_pop_free(CONF_IMODULE, (st), (free_func)) # define sk_CONF_IMODULE_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(CONF_IMODULE, (st), (copy_func), (free_func)) # define sk_CONF_IMODULE_shift(st) SKM_sk_shift(CONF_IMODULE, (st)) # define sk_CONF_IMODULE_pop(st) SKM_sk_pop(CONF_IMODULE, (st)) # define sk_CONF_IMODULE_sort(st) SKM_sk_sort(CONF_IMODULE, (st)) # define sk_CONF_IMODULE_is_sorted(st) SKM_sk_is_sorted(CONF_IMODULE, (st)) # define sk_CONF_MODULE_new(cmp) SKM_sk_new(CONF_MODULE, (cmp)) # define sk_CONF_MODULE_new_null() SKM_sk_new_null(CONF_MODULE) # define sk_CONF_MODULE_free(st) SKM_sk_free(CONF_MODULE, (st)) # define sk_CONF_MODULE_num(st) SKM_sk_num(CONF_MODULE, (st)) # define sk_CONF_MODULE_value(st, i) SKM_sk_value(CONF_MODULE, (st), (i)) # define sk_CONF_MODULE_set(st, i, val) SKM_sk_set(CONF_MODULE, (st), (i), (val)) # define sk_CONF_MODULE_zero(st) SKM_sk_zero(CONF_MODULE, (st)) # define sk_CONF_MODULE_push(st, val) SKM_sk_push(CONF_MODULE, (st), (val)) # define sk_CONF_MODULE_unshift(st, val) SKM_sk_unshift(CONF_MODULE, (st), (val)) # define sk_CONF_MODULE_find(st, val) SKM_sk_find(CONF_MODULE, (st), (val)) # define sk_CONF_MODULE_find_ex(st, val) SKM_sk_find_ex(CONF_MODULE, (st), (val)) # define sk_CONF_MODULE_delete(st, i) SKM_sk_delete(CONF_MODULE, (st), (i)) # define sk_CONF_MODULE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_MODULE, (st), (ptr)) # define sk_CONF_MODULE_insert(st, val, i) SKM_sk_insert(CONF_MODULE, (st), (val), (i)) # define sk_CONF_MODULE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CONF_MODULE, (st), (cmp)) # define sk_CONF_MODULE_dup(st) SKM_sk_dup(CONF_MODULE, st) # define sk_CONF_MODULE_pop_free(st, free_func) SKM_sk_pop_free(CONF_MODULE, (st), (free_func)) # define sk_CONF_MODULE_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(CONF_MODULE, (st), (copy_func), (free_func)) # define sk_CONF_MODULE_shift(st) SKM_sk_shift(CONF_MODULE, (st)) # define sk_CONF_MODULE_pop(st) SKM_sk_pop(CONF_MODULE, (st)) # define sk_CONF_MODULE_sort(st) SKM_sk_sort(CONF_MODULE, (st)) # define sk_CONF_MODULE_is_sorted(st) SKM_sk_is_sorted(CONF_MODULE, (st)) # define sk_CONF_VALUE_new(cmp) SKM_sk_new(CONF_VALUE, (cmp)) # define sk_CONF_VALUE_new_null() SKM_sk_new_null(CONF_VALUE) # define sk_CONF_VALUE_free(st) SKM_sk_free(CONF_VALUE, (st)) # define sk_CONF_VALUE_num(st) SKM_sk_num(CONF_VALUE, (st)) # define sk_CONF_VALUE_value(st, i) SKM_sk_value(CONF_VALUE, (st), (i)) # define sk_CONF_VALUE_set(st, i, val) SKM_sk_set(CONF_VALUE, (st), (i), (val)) # define sk_CONF_VALUE_zero(st) SKM_sk_zero(CONF_VALUE, (st)) # define sk_CONF_VALUE_push(st, val) SKM_sk_push(CONF_VALUE, (st), (val)) # define sk_CONF_VALUE_unshift(st, val) SKM_sk_unshift(CONF_VALUE, (st), (val)) # define sk_CONF_VALUE_find(st, val) SKM_sk_find(CONF_VALUE, (st), (val)) # define sk_CONF_VALUE_find_ex(st, val) SKM_sk_find_ex(CONF_VALUE, (st), (val)) # define sk_CONF_VALUE_delete(st, i) SKM_sk_delete(CONF_VALUE, (st), (i)) # define sk_CONF_VALUE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_VALUE, (st), (ptr)) # define sk_CONF_VALUE_insert(st, val, i) SKM_sk_insert(CONF_VALUE, (st), (val), (i)) # define sk_CONF_VALUE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CONF_VALUE, (st), (cmp)) # define sk_CONF_VALUE_dup(st) SKM_sk_dup(CONF_VALUE, st) # define sk_CONF_VALUE_pop_free(st, free_func) SKM_sk_pop_free(CONF_VALUE, (st), (free_func)) # define sk_CONF_VALUE_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(CONF_VALUE, (st), (copy_func), (free_func)) # define sk_CONF_VALUE_shift(st) SKM_sk_shift(CONF_VALUE, (st)) # define sk_CONF_VALUE_pop(st) SKM_sk_pop(CONF_VALUE, (st)) # define sk_CONF_VALUE_sort(st) SKM_sk_sort(CONF_VALUE, (st)) # define sk_CONF_VALUE_is_sorted(st) SKM_sk_is_sorted(CONF_VALUE, (st)) # define sk_CRYPTO_EX_DATA_FUNCS_new(cmp) SKM_sk_new(CRYPTO_EX_DATA_FUNCS, (cmp)) # define sk_CRYPTO_EX_DATA_FUNCS_new_null() SKM_sk_new_null(CRYPTO_EX_DATA_FUNCS) # define sk_CRYPTO_EX_DATA_FUNCS_free(st) SKM_sk_free(CRYPTO_EX_DATA_FUNCS, (st)) # define sk_CRYPTO_EX_DATA_FUNCS_num(st) SKM_sk_num(CRYPTO_EX_DATA_FUNCS, (st)) # define sk_CRYPTO_EX_DATA_FUNCS_value(st, i) SKM_sk_value(CRYPTO_EX_DATA_FUNCS, (st), (i)) # define sk_CRYPTO_EX_DATA_FUNCS_set(st, i, val) SKM_sk_set(CRYPTO_EX_DATA_FUNCS, (st), (i), (val)) # define sk_CRYPTO_EX_DATA_FUNCS_zero(st) SKM_sk_zero(CRYPTO_EX_DATA_FUNCS, (st)) # define sk_CRYPTO_EX_DATA_FUNCS_push(st, val) SKM_sk_push(CRYPTO_EX_DATA_FUNCS, (st), (val)) # define sk_CRYPTO_EX_DATA_FUNCS_unshift(st, val) SKM_sk_unshift(CRYPTO_EX_DATA_FUNCS, (st), (val)) # define sk_CRYPTO_EX_DATA_FUNCS_find(st, val) SKM_sk_find(CRYPTO_EX_DATA_FUNCS, (st), (val)) # define sk_CRYPTO_EX_DATA_FUNCS_find_ex(st, val) SKM_sk_find_ex(CRYPTO_EX_DATA_FUNCS, (st), (val)) # define sk_CRYPTO_EX_DATA_FUNCS_delete(st, i) SKM_sk_delete(CRYPTO_EX_DATA_FUNCS, (st), (i)) # define sk_CRYPTO_EX_DATA_FUNCS_delete_ptr(st, ptr) SKM_sk_delete_ptr(CRYPTO_EX_DATA_FUNCS, (st), (ptr)) # define sk_CRYPTO_EX_DATA_FUNCS_insert(st, val, i) SKM_sk_insert(CRYPTO_EX_DATA_FUNCS, (st), (val), (i)) # define sk_CRYPTO_EX_DATA_FUNCS_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CRYPTO_EX_DATA_FUNCS, (st), (cmp)) # define sk_CRYPTO_EX_DATA_FUNCS_dup(st) SKM_sk_dup(CRYPTO_EX_DATA_FUNCS, st) # define sk_CRYPTO_EX_DATA_FUNCS_pop_free(st, free_func) SKM_sk_pop_free(CRYPTO_EX_DATA_FUNCS, (st), (free_func)) # define sk_CRYPTO_EX_DATA_FUNCS_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(CRYPTO_EX_DATA_FUNCS, (st), (copy_func), (free_func)) # define sk_CRYPTO_EX_DATA_FUNCS_shift(st) SKM_sk_shift(CRYPTO_EX_DATA_FUNCS, (st)) # define sk_CRYPTO_EX_DATA_FUNCS_pop(st) SKM_sk_pop(CRYPTO_EX_DATA_FUNCS, (st)) # define sk_CRYPTO_EX_DATA_FUNCS_sort(st) SKM_sk_sort(CRYPTO_EX_DATA_FUNCS, (st)) # define sk_CRYPTO_EX_DATA_FUNCS_is_sorted(st) SKM_sk_is_sorted(CRYPTO_EX_DATA_FUNCS, (st)) # define sk_CRYPTO_dynlock_new(cmp) SKM_sk_new(CRYPTO_dynlock, (cmp)) # define sk_CRYPTO_dynlock_new_null() SKM_sk_new_null(CRYPTO_dynlock) # define sk_CRYPTO_dynlock_free(st) SKM_sk_free(CRYPTO_dynlock, (st)) # define sk_CRYPTO_dynlock_num(st) SKM_sk_num(CRYPTO_dynlock, (st)) # define sk_CRYPTO_dynlock_value(st, i) SKM_sk_value(CRYPTO_dynlock, (st), (i)) # define sk_CRYPTO_dynlock_set(st, i, val) SKM_sk_set(CRYPTO_dynlock, (st), (i), (val)) # define sk_CRYPTO_dynlock_zero(st) SKM_sk_zero(CRYPTO_dynlock, (st)) # define sk_CRYPTO_dynlock_push(st, val) SKM_sk_push(CRYPTO_dynlock, (st), (val)) # define sk_CRYPTO_dynlock_unshift(st, val) SKM_sk_unshift(CRYPTO_dynlock, (st), (val)) # define sk_CRYPTO_dynlock_find(st, val) SKM_sk_find(CRYPTO_dynlock, (st), (val)) # define sk_CRYPTO_dynlock_find_ex(st, val) SKM_sk_find_ex(CRYPTO_dynlock, (st), (val)) # define sk_CRYPTO_dynlock_delete(st, i) SKM_sk_delete(CRYPTO_dynlock, (st), (i)) # define sk_CRYPTO_dynlock_delete_ptr(st, ptr) SKM_sk_delete_ptr(CRYPTO_dynlock, (st), (ptr)) # define sk_CRYPTO_dynlock_insert(st, val, i) SKM_sk_insert(CRYPTO_dynlock, (st), (val), (i)) # define sk_CRYPTO_dynlock_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CRYPTO_dynlock, (st), (cmp)) # define sk_CRYPTO_dynlock_dup(st) SKM_sk_dup(CRYPTO_dynlock, st) # define sk_CRYPTO_dynlock_pop_free(st, free_func) SKM_sk_pop_free(CRYPTO_dynlock, (st), (free_func)) # define sk_CRYPTO_dynlock_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(CRYPTO_dynlock, (st), (copy_func), (free_func)) # define sk_CRYPTO_dynlock_shift(st) SKM_sk_shift(CRYPTO_dynlock, (st)) # define sk_CRYPTO_dynlock_pop(st) SKM_sk_pop(CRYPTO_dynlock, (st)) # define sk_CRYPTO_dynlock_sort(st) SKM_sk_sort(CRYPTO_dynlock, (st)) # define sk_CRYPTO_dynlock_is_sorted(st) SKM_sk_is_sorted(CRYPTO_dynlock, (st)) # define sk_DIST_POINT_new(cmp) SKM_sk_new(DIST_POINT, (cmp)) # define sk_DIST_POINT_new_null() SKM_sk_new_null(DIST_POINT) # define sk_DIST_POINT_free(st) SKM_sk_free(DIST_POINT, (st)) # define sk_DIST_POINT_num(st) SKM_sk_num(DIST_POINT, (st)) # define sk_DIST_POINT_value(st, i) SKM_sk_value(DIST_POINT, (st), (i)) # define sk_DIST_POINT_set(st, i, val) SKM_sk_set(DIST_POINT, (st), (i), (val)) # define sk_DIST_POINT_zero(st) SKM_sk_zero(DIST_POINT, (st)) # define sk_DIST_POINT_push(st, val) SKM_sk_push(DIST_POINT, (st), (val)) # define sk_DIST_POINT_unshift(st, val) SKM_sk_unshift(DIST_POINT, (st), (val)) # define sk_DIST_POINT_find(st, val) SKM_sk_find(DIST_POINT, (st), (val)) # define sk_DIST_POINT_find_ex(st, val) SKM_sk_find_ex(DIST_POINT, (st), (val)) # define sk_DIST_POINT_delete(st, i) SKM_sk_delete(DIST_POINT, (st), (i)) # define sk_DIST_POINT_delete_ptr(st, ptr) SKM_sk_delete_ptr(DIST_POINT, (st), (ptr)) # define sk_DIST_POINT_insert(st, val, i) SKM_sk_insert(DIST_POINT, (st), (val), (i)) # define sk_DIST_POINT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(DIST_POINT, (st), (cmp)) # define sk_DIST_POINT_dup(st) SKM_sk_dup(DIST_POINT, st) # define sk_DIST_POINT_pop_free(st, free_func) SKM_sk_pop_free(DIST_POINT, (st), (free_func)) # define sk_DIST_POINT_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(DIST_POINT, (st), (copy_func), (free_func)) # define sk_DIST_POINT_shift(st) SKM_sk_shift(DIST_POINT, (st)) # define sk_DIST_POINT_pop(st) SKM_sk_pop(DIST_POINT, (st)) # define sk_DIST_POINT_sort(st) SKM_sk_sort(DIST_POINT, (st)) # define sk_DIST_POINT_is_sorted(st) SKM_sk_is_sorted(DIST_POINT, (st)) # define sk_ENGINE_new(cmp) SKM_sk_new(ENGINE, (cmp)) # define sk_ENGINE_new_null() SKM_sk_new_null(ENGINE) # define sk_ENGINE_free(st) SKM_sk_free(ENGINE, (st)) # define sk_ENGINE_num(st) SKM_sk_num(ENGINE, (st)) # define sk_ENGINE_value(st, i) SKM_sk_value(ENGINE, (st), (i)) # define sk_ENGINE_set(st, i, val) SKM_sk_set(ENGINE, (st), (i), (val)) # define sk_ENGINE_zero(st) SKM_sk_zero(ENGINE, (st)) # define sk_ENGINE_push(st, val) SKM_sk_push(ENGINE, (st), (val)) # define sk_ENGINE_unshift(st, val) SKM_sk_unshift(ENGINE, (st), (val)) # define sk_ENGINE_find(st, val) SKM_sk_find(ENGINE, (st), (val)) # define sk_ENGINE_find_ex(st, val) SKM_sk_find_ex(ENGINE, (st), (val)) # define sk_ENGINE_delete(st, i) SKM_sk_delete(ENGINE, (st), (i)) # define sk_ENGINE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ENGINE, (st), (ptr)) # define sk_ENGINE_insert(st, val, i) SKM_sk_insert(ENGINE, (st), (val), (i)) # define sk_ENGINE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ENGINE, (st), (cmp)) # define sk_ENGINE_dup(st) SKM_sk_dup(ENGINE, st) # define sk_ENGINE_pop_free(st, free_func) SKM_sk_pop_free(ENGINE, (st), (free_func)) # define sk_ENGINE_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(ENGINE, (st), (copy_func), (free_func)) # define sk_ENGINE_shift(st) SKM_sk_shift(ENGINE, (st)) # define sk_ENGINE_pop(st) SKM_sk_pop(ENGINE, (st)) # define sk_ENGINE_sort(st) SKM_sk_sort(ENGINE, (st)) # define sk_ENGINE_is_sorted(st) SKM_sk_is_sorted(ENGINE, (st)) # define sk_ENGINE_CLEANUP_ITEM_new(cmp) SKM_sk_new(ENGINE_CLEANUP_ITEM, (cmp)) # define sk_ENGINE_CLEANUP_ITEM_new_null() SKM_sk_new_null(ENGINE_CLEANUP_ITEM) # define sk_ENGINE_CLEANUP_ITEM_free(st) SKM_sk_free(ENGINE_CLEANUP_ITEM, (st)) # define sk_ENGINE_CLEANUP_ITEM_num(st) SKM_sk_num(ENGINE_CLEANUP_ITEM, (st)) # define sk_ENGINE_CLEANUP_ITEM_value(st, i) SKM_sk_value(ENGINE_CLEANUP_ITEM, (st), (i)) # define sk_ENGINE_CLEANUP_ITEM_set(st, i, val) SKM_sk_set(ENGINE_CLEANUP_ITEM, (st), (i), (val)) # define sk_ENGINE_CLEANUP_ITEM_zero(st) SKM_sk_zero(ENGINE_CLEANUP_ITEM, (st)) # define sk_ENGINE_CLEANUP_ITEM_push(st, val) SKM_sk_push(ENGINE_CLEANUP_ITEM, (st), (val)) # define sk_ENGINE_CLEANUP_ITEM_unshift(st, val) SKM_sk_unshift(ENGINE_CLEANUP_ITEM, (st), (val)) # define sk_ENGINE_CLEANUP_ITEM_find(st, val) SKM_sk_find(ENGINE_CLEANUP_ITEM, (st), (val)) # define sk_ENGINE_CLEANUP_ITEM_find_ex(st, val) SKM_sk_find_ex(ENGINE_CLEANUP_ITEM, (st), (val)) # define sk_ENGINE_CLEANUP_ITEM_delete(st, i) SKM_sk_delete(ENGINE_CLEANUP_ITEM, (st), (i)) # define sk_ENGINE_CLEANUP_ITEM_delete_ptr(st, ptr) SKM_sk_delete_ptr(ENGINE_CLEANUP_ITEM, (st), (ptr)) # define sk_ENGINE_CLEANUP_ITEM_insert(st, val, i) SKM_sk_insert(ENGINE_CLEANUP_ITEM, (st), (val), (i)) # define sk_ENGINE_CLEANUP_ITEM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ENGINE_CLEANUP_ITEM, (st), (cmp)) # define sk_ENGINE_CLEANUP_ITEM_dup(st) SKM_sk_dup(ENGINE_CLEANUP_ITEM, st) # define sk_ENGINE_CLEANUP_ITEM_pop_free(st, free_func) SKM_sk_pop_free(ENGINE_CLEANUP_ITEM, (st), (free_func)) # define sk_ENGINE_CLEANUP_ITEM_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(ENGINE_CLEANUP_ITEM, (st), (copy_func), (free_func)) # define sk_ENGINE_CLEANUP_ITEM_shift(st) SKM_sk_shift(ENGINE_CLEANUP_ITEM, (st)) # define sk_ENGINE_CLEANUP_ITEM_pop(st) SKM_sk_pop(ENGINE_CLEANUP_ITEM, (st)) # define sk_ENGINE_CLEANUP_ITEM_sort(st) SKM_sk_sort(ENGINE_CLEANUP_ITEM, (st)) # define sk_ENGINE_CLEANUP_ITEM_is_sorted(st) SKM_sk_is_sorted(ENGINE_CLEANUP_ITEM, (st)) # define sk_ESS_CERT_ID_new(cmp) SKM_sk_new(ESS_CERT_ID, (cmp)) # define sk_ESS_CERT_ID_new_null() SKM_sk_new_null(ESS_CERT_ID) # define sk_ESS_CERT_ID_free(st) SKM_sk_free(ESS_CERT_ID, (st)) # define sk_ESS_CERT_ID_num(st) SKM_sk_num(ESS_CERT_ID, (st)) # define sk_ESS_CERT_ID_value(st, i) SKM_sk_value(ESS_CERT_ID, (st), (i)) # define sk_ESS_CERT_ID_set(st, i, val) SKM_sk_set(ESS_CERT_ID, (st), (i), (val)) # define sk_ESS_CERT_ID_zero(st) SKM_sk_zero(ESS_CERT_ID, (st)) # define sk_ESS_CERT_ID_push(st, val) SKM_sk_push(ESS_CERT_ID, (st), (val)) # define sk_ESS_CERT_ID_unshift(st, val) SKM_sk_unshift(ESS_CERT_ID, (st), (val)) # define sk_ESS_CERT_ID_find(st, val) SKM_sk_find(ESS_CERT_ID, (st), (val)) # define sk_ESS_CERT_ID_find_ex(st, val) SKM_sk_find_ex(ESS_CERT_ID, (st), (val)) # define sk_ESS_CERT_ID_delete(st, i) SKM_sk_delete(ESS_CERT_ID, (st), (i)) # define sk_ESS_CERT_ID_delete_ptr(st, ptr) SKM_sk_delete_ptr(ESS_CERT_ID, (st), (ptr)) # define sk_ESS_CERT_ID_insert(st, val, i) SKM_sk_insert(ESS_CERT_ID, (st), (val), (i)) # define sk_ESS_CERT_ID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ESS_CERT_ID, (st), (cmp)) # define sk_ESS_CERT_ID_dup(st) SKM_sk_dup(ESS_CERT_ID, st) # define sk_ESS_CERT_ID_pop_free(st, free_func) SKM_sk_pop_free(ESS_CERT_ID, (st), (free_func)) # define sk_ESS_CERT_ID_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(ESS_CERT_ID, (st), (copy_func), (free_func)) # define sk_ESS_CERT_ID_shift(st) SKM_sk_shift(ESS_CERT_ID, (st)) # define sk_ESS_CERT_ID_pop(st) SKM_sk_pop(ESS_CERT_ID, (st)) # define sk_ESS_CERT_ID_sort(st) SKM_sk_sort(ESS_CERT_ID, (st)) # define sk_ESS_CERT_ID_is_sorted(st) SKM_sk_is_sorted(ESS_CERT_ID, (st)) # define sk_EVP_MD_new(cmp) SKM_sk_new(EVP_MD, (cmp)) # define sk_EVP_MD_new_null() SKM_sk_new_null(EVP_MD) # define sk_EVP_MD_free(st) SKM_sk_free(EVP_MD, (st)) # define sk_EVP_MD_num(st) SKM_sk_num(EVP_MD, (st)) # define sk_EVP_MD_value(st, i) SKM_sk_value(EVP_MD, (st), (i)) # define sk_EVP_MD_set(st, i, val) SKM_sk_set(EVP_MD, (st), (i), (val)) # define sk_EVP_MD_zero(st) SKM_sk_zero(EVP_MD, (st)) # define sk_EVP_MD_push(st, val) SKM_sk_push(EVP_MD, (st), (val)) # define sk_EVP_MD_unshift(st, val) SKM_sk_unshift(EVP_MD, (st), (val)) # define sk_EVP_MD_find(st, val) SKM_sk_find(EVP_MD, (st), (val)) # define sk_EVP_MD_find_ex(st, val) SKM_sk_find_ex(EVP_MD, (st), (val)) # define sk_EVP_MD_delete(st, i) SKM_sk_delete(EVP_MD, (st), (i)) # define sk_EVP_MD_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_MD, (st), (ptr)) # define sk_EVP_MD_insert(st, val, i) SKM_sk_insert(EVP_MD, (st), (val), (i)) # define sk_EVP_MD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_MD, (st), (cmp)) # define sk_EVP_MD_dup(st) SKM_sk_dup(EVP_MD, st) # define sk_EVP_MD_pop_free(st, free_func) SKM_sk_pop_free(EVP_MD, (st), (free_func)) # define sk_EVP_MD_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(EVP_MD, (st), (copy_func), (free_func)) # define sk_EVP_MD_shift(st) SKM_sk_shift(EVP_MD, (st)) # define sk_EVP_MD_pop(st) SKM_sk_pop(EVP_MD, (st)) # define sk_EVP_MD_sort(st) SKM_sk_sort(EVP_MD, (st)) # define sk_EVP_MD_is_sorted(st) SKM_sk_is_sorted(EVP_MD, (st)) # define sk_EVP_PBE_CTL_new(cmp) SKM_sk_new(EVP_PBE_CTL, (cmp)) # define sk_EVP_PBE_CTL_new_null() SKM_sk_new_null(EVP_PBE_CTL) # define sk_EVP_PBE_CTL_free(st) SKM_sk_free(EVP_PBE_CTL, (st)) # define sk_EVP_PBE_CTL_num(st) SKM_sk_num(EVP_PBE_CTL, (st)) # define sk_EVP_PBE_CTL_value(st, i) SKM_sk_value(EVP_PBE_CTL, (st), (i)) # define sk_EVP_PBE_CTL_set(st, i, val) SKM_sk_set(EVP_PBE_CTL, (st), (i), (val)) # define sk_EVP_PBE_CTL_zero(st) SKM_sk_zero(EVP_PBE_CTL, (st)) # define sk_EVP_PBE_CTL_push(st, val) SKM_sk_push(EVP_PBE_CTL, (st), (val)) # define sk_EVP_PBE_CTL_unshift(st, val) SKM_sk_unshift(EVP_PBE_CTL, (st), (val)) # define sk_EVP_PBE_CTL_find(st, val) SKM_sk_find(EVP_PBE_CTL, (st), (val)) # define sk_EVP_PBE_CTL_find_ex(st, val) SKM_sk_find_ex(EVP_PBE_CTL, (st), (val)) # define sk_EVP_PBE_CTL_delete(st, i) SKM_sk_delete(EVP_PBE_CTL, (st), (i)) # define sk_EVP_PBE_CTL_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_PBE_CTL, (st), (ptr)) # define sk_EVP_PBE_CTL_insert(st, val, i) SKM_sk_insert(EVP_PBE_CTL, (st), (val), (i)) # define sk_EVP_PBE_CTL_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_PBE_CTL, (st), (cmp)) # define sk_EVP_PBE_CTL_dup(st) SKM_sk_dup(EVP_PBE_CTL, st) # define sk_EVP_PBE_CTL_pop_free(st, free_func) SKM_sk_pop_free(EVP_PBE_CTL, (st), (free_func)) # define sk_EVP_PBE_CTL_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(EVP_PBE_CTL, (st), (copy_func), (free_func)) # define sk_EVP_PBE_CTL_shift(st) SKM_sk_shift(EVP_PBE_CTL, (st)) # define sk_EVP_PBE_CTL_pop(st) SKM_sk_pop(EVP_PBE_CTL, (st)) # define sk_EVP_PBE_CTL_sort(st) SKM_sk_sort(EVP_PBE_CTL, (st)) # define sk_EVP_PBE_CTL_is_sorted(st) SKM_sk_is_sorted(EVP_PBE_CTL, (st)) # define sk_EVP_PKEY_ASN1_METHOD_new(cmp) SKM_sk_new(EVP_PKEY_ASN1_METHOD, (cmp)) # define sk_EVP_PKEY_ASN1_METHOD_new_null() SKM_sk_new_null(EVP_PKEY_ASN1_METHOD) # define sk_EVP_PKEY_ASN1_METHOD_free(st) SKM_sk_free(EVP_PKEY_ASN1_METHOD, (st)) # define sk_EVP_PKEY_ASN1_METHOD_num(st) SKM_sk_num(EVP_PKEY_ASN1_METHOD, (st)) # define sk_EVP_PKEY_ASN1_METHOD_value(st, i) SKM_sk_value(EVP_PKEY_ASN1_METHOD, (st), (i)) # define sk_EVP_PKEY_ASN1_METHOD_set(st, i, val) SKM_sk_set(EVP_PKEY_ASN1_METHOD, (st), (i), (val)) # define sk_EVP_PKEY_ASN1_METHOD_zero(st) SKM_sk_zero(EVP_PKEY_ASN1_METHOD, (st)) # define sk_EVP_PKEY_ASN1_METHOD_push(st, val) SKM_sk_push(EVP_PKEY_ASN1_METHOD, (st), (val)) # define sk_EVP_PKEY_ASN1_METHOD_unshift(st, val) SKM_sk_unshift(EVP_PKEY_ASN1_METHOD, (st), (val)) # define sk_EVP_PKEY_ASN1_METHOD_find(st, val) SKM_sk_find(EVP_PKEY_ASN1_METHOD, (st), (val)) # define sk_EVP_PKEY_ASN1_METHOD_find_ex(st, val) SKM_sk_find_ex(EVP_PKEY_ASN1_METHOD, (st), (val)) # define sk_EVP_PKEY_ASN1_METHOD_delete(st, i) SKM_sk_delete(EVP_PKEY_ASN1_METHOD, (st), (i)) # define sk_EVP_PKEY_ASN1_METHOD_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_PKEY_ASN1_METHOD, (st), (ptr)) # define sk_EVP_PKEY_ASN1_METHOD_insert(st, val, i) SKM_sk_insert(EVP_PKEY_ASN1_METHOD, (st), (val), (i)) # define sk_EVP_PKEY_ASN1_METHOD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_PKEY_ASN1_METHOD, (st), (cmp)) # define sk_EVP_PKEY_ASN1_METHOD_dup(st) SKM_sk_dup(EVP_PKEY_ASN1_METHOD, st) # define sk_EVP_PKEY_ASN1_METHOD_pop_free(st, free_func) SKM_sk_pop_free(EVP_PKEY_ASN1_METHOD, (st), (free_func)) # define sk_EVP_PKEY_ASN1_METHOD_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(EVP_PKEY_ASN1_METHOD, (st), (copy_func), (free_func)) # define sk_EVP_PKEY_ASN1_METHOD_shift(st) SKM_sk_shift(EVP_PKEY_ASN1_METHOD, (st)) # define sk_EVP_PKEY_ASN1_METHOD_pop(st) SKM_sk_pop(EVP_PKEY_ASN1_METHOD, (st)) # define sk_EVP_PKEY_ASN1_METHOD_sort(st) SKM_sk_sort(EVP_PKEY_ASN1_METHOD, (st)) # define sk_EVP_PKEY_ASN1_METHOD_is_sorted(st) SKM_sk_is_sorted(EVP_PKEY_ASN1_METHOD, (st)) # define sk_EVP_PKEY_METHOD_new(cmp) SKM_sk_new(EVP_PKEY_METHOD, (cmp)) # define sk_EVP_PKEY_METHOD_new_null() SKM_sk_new_null(EVP_PKEY_METHOD) # define sk_EVP_PKEY_METHOD_free(st) SKM_sk_free(EVP_PKEY_METHOD, (st)) # define sk_EVP_PKEY_METHOD_num(st) SKM_sk_num(EVP_PKEY_METHOD, (st)) # define sk_EVP_PKEY_METHOD_value(st, i) SKM_sk_value(EVP_PKEY_METHOD, (st), (i)) # define sk_EVP_PKEY_METHOD_set(st, i, val) SKM_sk_set(EVP_PKEY_METHOD, (st), (i), (val)) # define sk_EVP_PKEY_METHOD_zero(st) SKM_sk_zero(EVP_PKEY_METHOD, (st)) # define sk_EVP_PKEY_METHOD_push(st, val) SKM_sk_push(EVP_PKEY_METHOD, (st), (val)) # define sk_EVP_PKEY_METHOD_unshift(st, val) SKM_sk_unshift(EVP_PKEY_METHOD, (st), (val)) # define sk_EVP_PKEY_METHOD_find(st, val) SKM_sk_find(EVP_PKEY_METHOD, (st), (val)) # define sk_EVP_PKEY_METHOD_find_ex(st, val) SKM_sk_find_ex(EVP_PKEY_METHOD, (st), (val)) # define sk_EVP_PKEY_METHOD_delete(st, i) SKM_sk_delete(EVP_PKEY_METHOD, (st), (i)) # define sk_EVP_PKEY_METHOD_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_PKEY_METHOD, (st), (ptr)) # define sk_EVP_PKEY_METHOD_insert(st, val, i) SKM_sk_insert(EVP_PKEY_METHOD, (st), (val), (i)) # define sk_EVP_PKEY_METHOD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_PKEY_METHOD, (st), (cmp)) # define sk_EVP_PKEY_METHOD_dup(st) SKM_sk_dup(EVP_PKEY_METHOD, st) # define sk_EVP_PKEY_METHOD_pop_free(st, free_func) SKM_sk_pop_free(EVP_PKEY_METHOD, (st), (free_func)) # define sk_EVP_PKEY_METHOD_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(EVP_PKEY_METHOD, (st), (copy_func), (free_func)) # define sk_EVP_PKEY_METHOD_shift(st) SKM_sk_shift(EVP_PKEY_METHOD, (st)) # define sk_EVP_PKEY_METHOD_pop(st) SKM_sk_pop(EVP_PKEY_METHOD, (st)) # define sk_EVP_PKEY_METHOD_sort(st) SKM_sk_sort(EVP_PKEY_METHOD, (st)) # define sk_EVP_PKEY_METHOD_is_sorted(st) SKM_sk_is_sorted(EVP_PKEY_METHOD, (st)) # define sk_GENERAL_NAME_new(cmp) SKM_sk_new(GENERAL_NAME, (cmp)) # define sk_GENERAL_NAME_new_null() SKM_sk_new_null(GENERAL_NAME) # define sk_GENERAL_NAME_free(st) SKM_sk_free(GENERAL_NAME, (st)) # define sk_GENERAL_NAME_num(st) SKM_sk_num(GENERAL_NAME, (st)) # define sk_GENERAL_NAME_value(st, i) SKM_sk_value(GENERAL_NAME, (st), (i)) # define sk_GENERAL_NAME_set(st, i, val) SKM_sk_set(GENERAL_NAME, (st), (i), (val)) # define sk_GENERAL_NAME_zero(st) SKM_sk_zero(GENERAL_NAME, (st)) # define sk_GENERAL_NAME_push(st, val) SKM_sk_push(GENERAL_NAME, (st), (val)) # define sk_GENERAL_NAME_unshift(st, val) SKM_sk_unshift(GENERAL_NAME, (st), (val)) # define sk_GENERAL_NAME_find(st, val) SKM_sk_find(GENERAL_NAME, (st), (val)) # define sk_GENERAL_NAME_find_ex(st, val) SKM_sk_find_ex(GENERAL_NAME, (st), (val)) # define sk_GENERAL_NAME_delete(st, i) SKM_sk_delete(GENERAL_NAME, (st), (i)) # define sk_GENERAL_NAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_NAME, (st), (ptr)) # define sk_GENERAL_NAME_insert(st, val, i) SKM_sk_insert(GENERAL_NAME, (st), (val), (i)) # define sk_GENERAL_NAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(GENERAL_NAME, (st), (cmp)) # define sk_GENERAL_NAME_dup(st) SKM_sk_dup(GENERAL_NAME, st) # define sk_GENERAL_NAME_pop_free(st, free_func) SKM_sk_pop_free(GENERAL_NAME, (st), (free_func)) # define sk_GENERAL_NAME_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(GENERAL_NAME, (st), (copy_func), (free_func)) # define sk_GENERAL_NAME_shift(st) SKM_sk_shift(GENERAL_NAME, (st)) # define sk_GENERAL_NAME_pop(st) SKM_sk_pop(GENERAL_NAME, (st)) # define sk_GENERAL_NAME_sort(st) SKM_sk_sort(GENERAL_NAME, (st)) # define sk_GENERAL_NAME_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAME, (st)) # define sk_GENERAL_NAMES_new(cmp) SKM_sk_new(GENERAL_NAMES, (cmp)) # define sk_GENERAL_NAMES_new_null() SKM_sk_new_null(GENERAL_NAMES) # define sk_GENERAL_NAMES_free(st) SKM_sk_free(GENERAL_NAMES, (st)) # define sk_GENERAL_NAMES_num(st) SKM_sk_num(GENERAL_NAMES, (st)) # define sk_GENERAL_NAMES_value(st, i) SKM_sk_value(GENERAL_NAMES, (st), (i)) # define sk_GENERAL_NAMES_set(st, i, val) SKM_sk_set(GENERAL_NAMES, (st), (i), (val)) # define sk_GENERAL_NAMES_zero(st) SKM_sk_zero(GENERAL_NAMES, (st)) # define sk_GENERAL_NAMES_push(st, val) SKM_sk_push(GENERAL_NAMES, (st), (val)) # define sk_GENERAL_NAMES_unshift(st, val) SKM_sk_unshift(GENERAL_NAMES, (st), (val)) # define sk_GENERAL_NAMES_find(st, val) SKM_sk_find(GENERAL_NAMES, (st), (val)) # define sk_GENERAL_NAMES_find_ex(st, val) SKM_sk_find_ex(GENERAL_NAMES, (st), (val)) # define sk_GENERAL_NAMES_delete(st, i) SKM_sk_delete(GENERAL_NAMES, (st), (i)) # define sk_GENERAL_NAMES_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_NAMES, (st), (ptr)) # define sk_GENERAL_NAMES_insert(st, val, i) SKM_sk_insert(GENERAL_NAMES, (st), (val), (i)) # define sk_GENERAL_NAMES_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(GENERAL_NAMES, (st), (cmp)) # define sk_GENERAL_NAMES_dup(st) SKM_sk_dup(GENERAL_NAMES, st) # define sk_GENERAL_NAMES_pop_free(st, free_func) SKM_sk_pop_free(GENERAL_NAMES, (st), (free_func)) # define sk_GENERAL_NAMES_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(GENERAL_NAMES, (st), (copy_func), (free_func)) # define sk_GENERAL_NAMES_shift(st) SKM_sk_shift(GENERAL_NAMES, (st)) # define sk_GENERAL_NAMES_pop(st) SKM_sk_pop(GENERAL_NAMES, (st)) # define sk_GENERAL_NAMES_sort(st) SKM_sk_sort(GENERAL_NAMES, (st)) # define sk_GENERAL_NAMES_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAMES, (st)) # define sk_GENERAL_SUBTREE_new(cmp) SKM_sk_new(GENERAL_SUBTREE, (cmp)) # define sk_GENERAL_SUBTREE_new_null() SKM_sk_new_null(GENERAL_SUBTREE) # define sk_GENERAL_SUBTREE_free(st) SKM_sk_free(GENERAL_SUBTREE, (st)) # define sk_GENERAL_SUBTREE_num(st) SKM_sk_num(GENERAL_SUBTREE, (st)) # define sk_GENERAL_SUBTREE_value(st, i) SKM_sk_value(GENERAL_SUBTREE, (st), (i)) # define sk_GENERAL_SUBTREE_set(st, i, val) SKM_sk_set(GENERAL_SUBTREE, (st), (i), (val)) # define sk_GENERAL_SUBTREE_zero(st) SKM_sk_zero(GENERAL_SUBTREE, (st)) # define sk_GENERAL_SUBTREE_push(st, val) SKM_sk_push(GENERAL_SUBTREE, (st), (val)) # define sk_GENERAL_SUBTREE_unshift(st, val) SKM_sk_unshift(GENERAL_SUBTREE, (st), (val)) # define sk_GENERAL_SUBTREE_find(st, val) SKM_sk_find(GENERAL_SUBTREE, (st), (val)) # define sk_GENERAL_SUBTREE_find_ex(st, val) SKM_sk_find_ex(GENERAL_SUBTREE, (st), (val)) # define sk_GENERAL_SUBTREE_delete(st, i) SKM_sk_delete(GENERAL_SUBTREE, (st), (i)) # define sk_GENERAL_SUBTREE_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_SUBTREE, (st), (ptr)) # define sk_GENERAL_SUBTREE_insert(st, val, i) SKM_sk_insert(GENERAL_SUBTREE, (st), (val), (i)) # define sk_GENERAL_SUBTREE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(GENERAL_SUBTREE, (st), (cmp)) # define sk_GENERAL_SUBTREE_dup(st) SKM_sk_dup(GENERAL_SUBTREE, st) # define sk_GENERAL_SUBTREE_pop_free(st, free_func) SKM_sk_pop_free(GENERAL_SUBTREE, (st), (free_func)) # define sk_GENERAL_SUBTREE_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(GENERAL_SUBTREE, (st), (copy_func), (free_func)) # define sk_GENERAL_SUBTREE_shift(st) SKM_sk_shift(GENERAL_SUBTREE, (st)) # define sk_GENERAL_SUBTREE_pop(st) SKM_sk_pop(GENERAL_SUBTREE, (st)) # define sk_GENERAL_SUBTREE_sort(st) SKM_sk_sort(GENERAL_SUBTREE, (st)) # define sk_GENERAL_SUBTREE_is_sorted(st) SKM_sk_is_sorted(GENERAL_SUBTREE, (st)) # define sk_IPAddressFamily_new(cmp) SKM_sk_new(IPAddressFamily, (cmp)) # define sk_IPAddressFamily_new_null() SKM_sk_new_null(IPAddressFamily) # define sk_IPAddressFamily_free(st) SKM_sk_free(IPAddressFamily, (st)) # define sk_IPAddressFamily_num(st) SKM_sk_num(IPAddressFamily, (st)) # define sk_IPAddressFamily_value(st, i) SKM_sk_value(IPAddressFamily, (st), (i)) # define sk_IPAddressFamily_set(st, i, val) SKM_sk_set(IPAddressFamily, (st), (i), (val)) # define sk_IPAddressFamily_zero(st) SKM_sk_zero(IPAddressFamily, (st)) # define sk_IPAddressFamily_push(st, val) SKM_sk_push(IPAddressFamily, (st), (val)) # define sk_IPAddressFamily_unshift(st, val) SKM_sk_unshift(IPAddressFamily, (st), (val)) # define sk_IPAddressFamily_find(st, val) SKM_sk_find(IPAddressFamily, (st), (val)) # define sk_IPAddressFamily_find_ex(st, val) SKM_sk_find_ex(IPAddressFamily, (st), (val)) # define sk_IPAddressFamily_delete(st, i) SKM_sk_delete(IPAddressFamily, (st), (i)) # define sk_IPAddressFamily_delete_ptr(st, ptr) SKM_sk_delete_ptr(IPAddressFamily, (st), (ptr)) # define sk_IPAddressFamily_insert(st, val, i) SKM_sk_insert(IPAddressFamily, (st), (val), (i)) # define sk_IPAddressFamily_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(IPAddressFamily, (st), (cmp)) # define sk_IPAddressFamily_dup(st) SKM_sk_dup(IPAddressFamily, st) # define sk_IPAddressFamily_pop_free(st, free_func) SKM_sk_pop_free(IPAddressFamily, (st), (free_func)) # define sk_IPAddressFamily_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(IPAddressFamily, (st), (copy_func), (free_func)) # define sk_IPAddressFamily_shift(st) SKM_sk_shift(IPAddressFamily, (st)) # define sk_IPAddressFamily_pop(st) SKM_sk_pop(IPAddressFamily, (st)) # define sk_IPAddressFamily_sort(st) SKM_sk_sort(IPAddressFamily, (st)) # define sk_IPAddressFamily_is_sorted(st) SKM_sk_is_sorted(IPAddressFamily, (st)) # define sk_IPAddressOrRange_new(cmp) SKM_sk_new(IPAddressOrRange, (cmp)) # define sk_IPAddressOrRange_new_null() SKM_sk_new_null(IPAddressOrRange) # define sk_IPAddressOrRange_free(st) SKM_sk_free(IPAddressOrRange, (st)) # define sk_IPAddressOrRange_num(st) SKM_sk_num(IPAddressOrRange, (st)) # define sk_IPAddressOrRange_value(st, i) SKM_sk_value(IPAddressOrRange, (st), (i)) # define sk_IPAddressOrRange_set(st, i, val) SKM_sk_set(IPAddressOrRange, (st), (i), (val)) # define sk_IPAddressOrRange_zero(st) SKM_sk_zero(IPAddressOrRange, (st)) # define sk_IPAddressOrRange_push(st, val) SKM_sk_push(IPAddressOrRange, (st), (val)) # define sk_IPAddressOrRange_unshift(st, val) SKM_sk_unshift(IPAddressOrRange, (st), (val)) # define sk_IPAddressOrRange_find(st, val) SKM_sk_find(IPAddressOrRange, (st), (val)) # define sk_IPAddressOrRange_find_ex(st, val) SKM_sk_find_ex(IPAddressOrRange, (st), (val)) # define sk_IPAddressOrRange_delete(st, i) SKM_sk_delete(IPAddressOrRange, (st), (i)) # define sk_IPAddressOrRange_delete_ptr(st, ptr) SKM_sk_delete_ptr(IPAddressOrRange, (st), (ptr)) # define sk_IPAddressOrRange_insert(st, val, i) SKM_sk_insert(IPAddressOrRange, (st), (val), (i)) # define sk_IPAddressOrRange_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(IPAddressOrRange, (st), (cmp)) # define sk_IPAddressOrRange_dup(st) SKM_sk_dup(IPAddressOrRange, st) # define sk_IPAddressOrRange_pop_free(st, free_func) SKM_sk_pop_free(IPAddressOrRange, (st), (free_func)) # define sk_IPAddressOrRange_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(IPAddressOrRange, (st), (copy_func), (free_func)) # define sk_IPAddressOrRange_shift(st) SKM_sk_shift(IPAddressOrRange, (st)) # define sk_IPAddressOrRange_pop(st) SKM_sk_pop(IPAddressOrRange, (st)) # define sk_IPAddressOrRange_sort(st) SKM_sk_sort(IPAddressOrRange, (st)) # define sk_IPAddressOrRange_is_sorted(st) SKM_sk_is_sorted(IPAddressOrRange, (st)) # define sk_KRB5_APREQBODY_new(cmp) SKM_sk_new(KRB5_APREQBODY, (cmp)) # define sk_KRB5_APREQBODY_new_null() SKM_sk_new_null(KRB5_APREQBODY) # define sk_KRB5_APREQBODY_free(st) SKM_sk_free(KRB5_APREQBODY, (st)) # define sk_KRB5_APREQBODY_num(st) SKM_sk_num(KRB5_APREQBODY, (st)) # define sk_KRB5_APREQBODY_value(st, i) SKM_sk_value(KRB5_APREQBODY, (st), (i)) # define sk_KRB5_APREQBODY_set(st, i, val) SKM_sk_set(KRB5_APREQBODY, (st), (i), (val)) # define sk_KRB5_APREQBODY_zero(st) SKM_sk_zero(KRB5_APREQBODY, (st)) # define sk_KRB5_APREQBODY_push(st, val) SKM_sk_push(KRB5_APREQBODY, (st), (val)) # define sk_KRB5_APREQBODY_unshift(st, val) SKM_sk_unshift(KRB5_APREQBODY, (st), (val)) # define sk_KRB5_APREQBODY_find(st, val) SKM_sk_find(KRB5_APREQBODY, (st), (val)) # define sk_KRB5_APREQBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_APREQBODY, (st), (val)) # define sk_KRB5_APREQBODY_delete(st, i) SKM_sk_delete(KRB5_APREQBODY, (st), (i)) # define sk_KRB5_APREQBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_APREQBODY, (st), (ptr)) # define sk_KRB5_APREQBODY_insert(st, val, i) SKM_sk_insert(KRB5_APREQBODY, (st), (val), (i)) # define sk_KRB5_APREQBODY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_APREQBODY, (st), (cmp)) # define sk_KRB5_APREQBODY_dup(st) SKM_sk_dup(KRB5_APREQBODY, st) # define sk_KRB5_APREQBODY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_APREQBODY, (st), (free_func)) # define sk_KRB5_APREQBODY_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(KRB5_APREQBODY, (st), (copy_func), (free_func)) # define sk_KRB5_APREQBODY_shift(st) SKM_sk_shift(KRB5_APREQBODY, (st)) # define sk_KRB5_APREQBODY_pop(st) SKM_sk_pop(KRB5_APREQBODY, (st)) # define sk_KRB5_APREQBODY_sort(st) SKM_sk_sort(KRB5_APREQBODY, (st)) # define sk_KRB5_APREQBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_APREQBODY, (st)) # define sk_KRB5_AUTHDATA_new(cmp) SKM_sk_new(KRB5_AUTHDATA, (cmp)) # define sk_KRB5_AUTHDATA_new_null() SKM_sk_new_null(KRB5_AUTHDATA) # define sk_KRB5_AUTHDATA_free(st) SKM_sk_free(KRB5_AUTHDATA, (st)) # define sk_KRB5_AUTHDATA_num(st) SKM_sk_num(KRB5_AUTHDATA, (st)) # define sk_KRB5_AUTHDATA_value(st, i) SKM_sk_value(KRB5_AUTHDATA, (st), (i)) # define sk_KRB5_AUTHDATA_set(st, i, val) SKM_sk_set(KRB5_AUTHDATA, (st), (i), (val)) # define sk_KRB5_AUTHDATA_zero(st) SKM_sk_zero(KRB5_AUTHDATA, (st)) # define sk_KRB5_AUTHDATA_push(st, val) SKM_sk_push(KRB5_AUTHDATA, (st), (val)) # define sk_KRB5_AUTHDATA_unshift(st, val) SKM_sk_unshift(KRB5_AUTHDATA, (st), (val)) # define sk_KRB5_AUTHDATA_find(st, val) SKM_sk_find(KRB5_AUTHDATA, (st), (val)) # define sk_KRB5_AUTHDATA_find_ex(st, val) SKM_sk_find_ex(KRB5_AUTHDATA, (st), (val)) # define sk_KRB5_AUTHDATA_delete(st, i) SKM_sk_delete(KRB5_AUTHDATA, (st), (i)) # define sk_KRB5_AUTHDATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_AUTHDATA, (st), (ptr)) # define sk_KRB5_AUTHDATA_insert(st, val, i) SKM_sk_insert(KRB5_AUTHDATA, (st), (val), (i)) # define sk_KRB5_AUTHDATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_AUTHDATA, (st), (cmp)) # define sk_KRB5_AUTHDATA_dup(st) SKM_sk_dup(KRB5_AUTHDATA, st) # define sk_KRB5_AUTHDATA_pop_free(st, free_func) SKM_sk_pop_free(KRB5_AUTHDATA, (st), (free_func)) # define sk_KRB5_AUTHDATA_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(KRB5_AUTHDATA, (st), (copy_func), (free_func)) # define sk_KRB5_AUTHDATA_shift(st) SKM_sk_shift(KRB5_AUTHDATA, (st)) # define sk_KRB5_AUTHDATA_pop(st) SKM_sk_pop(KRB5_AUTHDATA, (st)) # define sk_KRB5_AUTHDATA_sort(st) SKM_sk_sort(KRB5_AUTHDATA, (st)) # define sk_KRB5_AUTHDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHDATA, (st)) # define sk_KRB5_AUTHENTBODY_new(cmp) SKM_sk_new(KRB5_AUTHENTBODY, (cmp)) # define sk_KRB5_AUTHENTBODY_new_null() SKM_sk_new_null(KRB5_AUTHENTBODY) # define sk_KRB5_AUTHENTBODY_free(st) SKM_sk_free(KRB5_AUTHENTBODY, (st)) # define sk_KRB5_AUTHENTBODY_num(st) SKM_sk_num(KRB5_AUTHENTBODY, (st)) # define sk_KRB5_AUTHENTBODY_value(st, i) SKM_sk_value(KRB5_AUTHENTBODY, (st), (i)) # define sk_KRB5_AUTHENTBODY_set(st, i, val) SKM_sk_set(KRB5_AUTHENTBODY, (st), (i), (val)) # define sk_KRB5_AUTHENTBODY_zero(st) SKM_sk_zero(KRB5_AUTHENTBODY, (st)) # define sk_KRB5_AUTHENTBODY_push(st, val) SKM_sk_push(KRB5_AUTHENTBODY, (st), (val)) # define sk_KRB5_AUTHENTBODY_unshift(st, val) SKM_sk_unshift(KRB5_AUTHENTBODY, (st), (val)) # define sk_KRB5_AUTHENTBODY_find(st, val) SKM_sk_find(KRB5_AUTHENTBODY, (st), (val)) # define sk_KRB5_AUTHENTBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_AUTHENTBODY, (st), (val)) # define sk_KRB5_AUTHENTBODY_delete(st, i) SKM_sk_delete(KRB5_AUTHENTBODY, (st), (i)) # define sk_KRB5_AUTHENTBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_AUTHENTBODY, (st), (ptr)) # define sk_KRB5_AUTHENTBODY_insert(st, val, i) SKM_sk_insert(KRB5_AUTHENTBODY, (st), (val), (i)) # define sk_KRB5_AUTHENTBODY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_AUTHENTBODY, (st), (cmp)) # define sk_KRB5_AUTHENTBODY_dup(st) SKM_sk_dup(KRB5_AUTHENTBODY, st) # define sk_KRB5_AUTHENTBODY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_AUTHENTBODY, (st), (free_func)) # define sk_KRB5_AUTHENTBODY_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(KRB5_AUTHENTBODY, (st), (copy_func), (free_func)) # define sk_KRB5_AUTHENTBODY_shift(st) SKM_sk_shift(KRB5_AUTHENTBODY, (st)) # define sk_KRB5_AUTHENTBODY_pop(st) SKM_sk_pop(KRB5_AUTHENTBODY, (st)) # define sk_KRB5_AUTHENTBODY_sort(st) SKM_sk_sort(KRB5_AUTHENTBODY, (st)) # define sk_KRB5_AUTHENTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHENTBODY, (st)) # define sk_KRB5_CHECKSUM_new(cmp) SKM_sk_new(KRB5_CHECKSUM, (cmp)) # define sk_KRB5_CHECKSUM_new_null() SKM_sk_new_null(KRB5_CHECKSUM) # define sk_KRB5_CHECKSUM_free(st) SKM_sk_free(KRB5_CHECKSUM, (st)) # define sk_KRB5_CHECKSUM_num(st) SKM_sk_num(KRB5_CHECKSUM, (st)) # define sk_KRB5_CHECKSUM_value(st, i) SKM_sk_value(KRB5_CHECKSUM, (st), (i)) # define sk_KRB5_CHECKSUM_set(st, i, val) SKM_sk_set(KRB5_CHECKSUM, (st), (i), (val)) # define sk_KRB5_CHECKSUM_zero(st) SKM_sk_zero(KRB5_CHECKSUM, (st)) # define sk_KRB5_CHECKSUM_push(st, val) SKM_sk_push(KRB5_CHECKSUM, (st), (val)) # define sk_KRB5_CHECKSUM_unshift(st, val) SKM_sk_unshift(KRB5_CHECKSUM, (st), (val)) # define sk_KRB5_CHECKSUM_find(st, val) SKM_sk_find(KRB5_CHECKSUM, (st), (val)) # define sk_KRB5_CHECKSUM_find_ex(st, val) SKM_sk_find_ex(KRB5_CHECKSUM, (st), (val)) # define sk_KRB5_CHECKSUM_delete(st, i) SKM_sk_delete(KRB5_CHECKSUM, (st), (i)) # define sk_KRB5_CHECKSUM_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_CHECKSUM, (st), (ptr)) # define sk_KRB5_CHECKSUM_insert(st, val, i) SKM_sk_insert(KRB5_CHECKSUM, (st), (val), (i)) # define sk_KRB5_CHECKSUM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_CHECKSUM, (st), (cmp)) # define sk_KRB5_CHECKSUM_dup(st) SKM_sk_dup(KRB5_CHECKSUM, st) # define sk_KRB5_CHECKSUM_pop_free(st, free_func) SKM_sk_pop_free(KRB5_CHECKSUM, (st), (free_func)) # define sk_KRB5_CHECKSUM_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(KRB5_CHECKSUM, (st), (copy_func), (free_func)) # define sk_KRB5_CHECKSUM_shift(st) SKM_sk_shift(KRB5_CHECKSUM, (st)) # define sk_KRB5_CHECKSUM_pop(st) SKM_sk_pop(KRB5_CHECKSUM, (st)) # define sk_KRB5_CHECKSUM_sort(st) SKM_sk_sort(KRB5_CHECKSUM, (st)) # define sk_KRB5_CHECKSUM_is_sorted(st) SKM_sk_is_sorted(KRB5_CHECKSUM, (st)) # define sk_KRB5_ENCDATA_new(cmp) SKM_sk_new(KRB5_ENCDATA, (cmp)) # define sk_KRB5_ENCDATA_new_null() SKM_sk_new_null(KRB5_ENCDATA) # define sk_KRB5_ENCDATA_free(st) SKM_sk_free(KRB5_ENCDATA, (st)) # define sk_KRB5_ENCDATA_num(st) SKM_sk_num(KRB5_ENCDATA, (st)) # define sk_KRB5_ENCDATA_value(st, i) SKM_sk_value(KRB5_ENCDATA, (st), (i)) # define sk_KRB5_ENCDATA_set(st, i, val) SKM_sk_set(KRB5_ENCDATA, (st), (i), (val)) # define sk_KRB5_ENCDATA_zero(st) SKM_sk_zero(KRB5_ENCDATA, (st)) # define sk_KRB5_ENCDATA_push(st, val) SKM_sk_push(KRB5_ENCDATA, (st), (val)) # define sk_KRB5_ENCDATA_unshift(st, val) SKM_sk_unshift(KRB5_ENCDATA, (st), (val)) # define sk_KRB5_ENCDATA_find(st, val) SKM_sk_find(KRB5_ENCDATA, (st), (val)) # define sk_KRB5_ENCDATA_find_ex(st, val) SKM_sk_find_ex(KRB5_ENCDATA, (st), (val)) # define sk_KRB5_ENCDATA_delete(st, i) SKM_sk_delete(KRB5_ENCDATA, (st), (i)) # define sk_KRB5_ENCDATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_ENCDATA, (st), (ptr)) # define sk_KRB5_ENCDATA_insert(st, val, i) SKM_sk_insert(KRB5_ENCDATA, (st), (val), (i)) # define sk_KRB5_ENCDATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_ENCDATA, (st), (cmp)) # define sk_KRB5_ENCDATA_dup(st) SKM_sk_dup(KRB5_ENCDATA, st) # define sk_KRB5_ENCDATA_pop_free(st, free_func) SKM_sk_pop_free(KRB5_ENCDATA, (st), (free_func)) # define sk_KRB5_ENCDATA_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(KRB5_ENCDATA, (st), (copy_func), (free_func)) # define sk_KRB5_ENCDATA_shift(st) SKM_sk_shift(KRB5_ENCDATA, (st)) # define sk_KRB5_ENCDATA_pop(st) SKM_sk_pop(KRB5_ENCDATA, (st)) # define sk_KRB5_ENCDATA_sort(st) SKM_sk_sort(KRB5_ENCDATA, (st)) # define sk_KRB5_ENCDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCDATA, (st)) # define sk_KRB5_ENCKEY_new(cmp) SKM_sk_new(KRB5_ENCKEY, (cmp)) # define sk_KRB5_ENCKEY_new_null() SKM_sk_new_null(KRB5_ENCKEY) # define sk_KRB5_ENCKEY_free(st) SKM_sk_free(KRB5_ENCKEY, (st)) # define sk_KRB5_ENCKEY_num(st) SKM_sk_num(KRB5_ENCKEY, (st)) # define sk_KRB5_ENCKEY_value(st, i) SKM_sk_value(KRB5_ENCKEY, (st), (i)) # define sk_KRB5_ENCKEY_set(st, i, val) SKM_sk_set(KRB5_ENCKEY, (st), (i), (val)) # define sk_KRB5_ENCKEY_zero(st) SKM_sk_zero(KRB5_ENCKEY, (st)) # define sk_KRB5_ENCKEY_push(st, val) SKM_sk_push(KRB5_ENCKEY, (st), (val)) # define sk_KRB5_ENCKEY_unshift(st, val) SKM_sk_unshift(KRB5_ENCKEY, (st), (val)) # define sk_KRB5_ENCKEY_find(st, val) SKM_sk_find(KRB5_ENCKEY, (st), (val)) # define sk_KRB5_ENCKEY_find_ex(st, val) SKM_sk_find_ex(KRB5_ENCKEY, (st), (val)) # define sk_KRB5_ENCKEY_delete(st, i) SKM_sk_delete(KRB5_ENCKEY, (st), (i)) # define sk_KRB5_ENCKEY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_ENCKEY, (st), (ptr)) # define sk_KRB5_ENCKEY_insert(st, val, i) SKM_sk_insert(KRB5_ENCKEY, (st), (val), (i)) # define sk_KRB5_ENCKEY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_ENCKEY, (st), (cmp)) # define sk_KRB5_ENCKEY_dup(st) SKM_sk_dup(KRB5_ENCKEY, st) # define sk_KRB5_ENCKEY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_ENCKEY, (st), (free_func)) # define sk_KRB5_ENCKEY_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(KRB5_ENCKEY, (st), (copy_func), (free_func)) # define sk_KRB5_ENCKEY_shift(st) SKM_sk_shift(KRB5_ENCKEY, (st)) # define sk_KRB5_ENCKEY_pop(st) SKM_sk_pop(KRB5_ENCKEY, (st)) # define sk_KRB5_ENCKEY_sort(st) SKM_sk_sort(KRB5_ENCKEY, (st)) # define sk_KRB5_ENCKEY_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCKEY, (st)) # define sk_KRB5_PRINCNAME_new(cmp) SKM_sk_new(KRB5_PRINCNAME, (cmp)) # define sk_KRB5_PRINCNAME_new_null() SKM_sk_new_null(KRB5_PRINCNAME) # define sk_KRB5_PRINCNAME_free(st) SKM_sk_free(KRB5_PRINCNAME, (st)) # define sk_KRB5_PRINCNAME_num(st) SKM_sk_num(KRB5_PRINCNAME, (st)) # define sk_KRB5_PRINCNAME_value(st, i) SKM_sk_value(KRB5_PRINCNAME, (st), (i)) # define sk_KRB5_PRINCNAME_set(st, i, val) SKM_sk_set(KRB5_PRINCNAME, (st), (i), (val)) # define sk_KRB5_PRINCNAME_zero(st) SKM_sk_zero(KRB5_PRINCNAME, (st)) # define sk_KRB5_PRINCNAME_push(st, val) SKM_sk_push(KRB5_PRINCNAME, (st), (val)) # define sk_KRB5_PRINCNAME_unshift(st, val) SKM_sk_unshift(KRB5_PRINCNAME, (st), (val)) # define sk_KRB5_PRINCNAME_find(st, val) SKM_sk_find(KRB5_PRINCNAME, (st), (val)) # define sk_KRB5_PRINCNAME_find_ex(st, val) SKM_sk_find_ex(KRB5_PRINCNAME, (st), (val)) # define sk_KRB5_PRINCNAME_delete(st, i) SKM_sk_delete(KRB5_PRINCNAME, (st), (i)) # define sk_KRB5_PRINCNAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_PRINCNAME, (st), (ptr)) # define sk_KRB5_PRINCNAME_insert(st, val, i) SKM_sk_insert(KRB5_PRINCNAME, (st), (val), (i)) # define sk_KRB5_PRINCNAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_PRINCNAME, (st), (cmp)) # define sk_KRB5_PRINCNAME_dup(st) SKM_sk_dup(KRB5_PRINCNAME, st) # define sk_KRB5_PRINCNAME_pop_free(st, free_func) SKM_sk_pop_free(KRB5_PRINCNAME, (st), (free_func)) # define sk_KRB5_PRINCNAME_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(KRB5_PRINCNAME, (st), (copy_func), (free_func)) # define sk_KRB5_PRINCNAME_shift(st) SKM_sk_shift(KRB5_PRINCNAME, (st)) # define sk_KRB5_PRINCNAME_pop(st) SKM_sk_pop(KRB5_PRINCNAME, (st)) # define sk_KRB5_PRINCNAME_sort(st) SKM_sk_sort(KRB5_PRINCNAME, (st)) # define sk_KRB5_PRINCNAME_is_sorted(st) SKM_sk_is_sorted(KRB5_PRINCNAME, (st)) # define sk_KRB5_TKTBODY_new(cmp) SKM_sk_new(KRB5_TKTBODY, (cmp)) # define sk_KRB5_TKTBODY_new_null() SKM_sk_new_null(KRB5_TKTBODY) # define sk_KRB5_TKTBODY_free(st) SKM_sk_free(KRB5_TKTBODY, (st)) # define sk_KRB5_TKTBODY_num(st) SKM_sk_num(KRB5_TKTBODY, (st)) # define sk_KRB5_TKTBODY_value(st, i) SKM_sk_value(KRB5_TKTBODY, (st), (i)) # define sk_KRB5_TKTBODY_set(st, i, val) SKM_sk_set(KRB5_TKTBODY, (st), (i), (val)) # define sk_KRB5_TKTBODY_zero(st) SKM_sk_zero(KRB5_TKTBODY, (st)) # define sk_KRB5_TKTBODY_push(st, val) SKM_sk_push(KRB5_TKTBODY, (st), (val)) # define sk_KRB5_TKTBODY_unshift(st, val) SKM_sk_unshift(KRB5_TKTBODY, (st), (val)) # define sk_KRB5_TKTBODY_find(st, val) SKM_sk_find(KRB5_TKTBODY, (st), (val)) # define sk_KRB5_TKTBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_TKTBODY, (st), (val)) # define sk_KRB5_TKTBODY_delete(st, i) SKM_sk_delete(KRB5_TKTBODY, (st), (i)) # define sk_KRB5_TKTBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_TKTBODY, (st), (ptr)) # define sk_KRB5_TKTBODY_insert(st, val, i) SKM_sk_insert(KRB5_TKTBODY, (st), (val), (i)) # define sk_KRB5_TKTBODY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_TKTBODY, (st), (cmp)) # define sk_KRB5_TKTBODY_dup(st) SKM_sk_dup(KRB5_TKTBODY, st) # define sk_KRB5_TKTBODY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_TKTBODY, (st), (free_func)) # define sk_KRB5_TKTBODY_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(KRB5_TKTBODY, (st), (copy_func), (free_func)) # define sk_KRB5_TKTBODY_shift(st) SKM_sk_shift(KRB5_TKTBODY, (st)) # define sk_KRB5_TKTBODY_pop(st) SKM_sk_pop(KRB5_TKTBODY, (st)) # define sk_KRB5_TKTBODY_sort(st) SKM_sk_sort(KRB5_TKTBODY, (st)) # define sk_KRB5_TKTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_TKTBODY, (st)) # define sk_MEM_OBJECT_DATA_new(cmp) SKM_sk_new(MEM_OBJECT_DATA, (cmp)) # define sk_MEM_OBJECT_DATA_new_null() SKM_sk_new_null(MEM_OBJECT_DATA) # define sk_MEM_OBJECT_DATA_free(st) SKM_sk_free(MEM_OBJECT_DATA, (st)) # define sk_MEM_OBJECT_DATA_num(st) SKM_sk_num(MEM_OBJECT_DATA, (st)) # define sk_MEM_OBJECT_DATA_value(st, i) SKM_sk_value(MEM_OBJECT_DATA, (st), (i)) # define sk_MEM_OBJECT_DATA_set(st, i, val) SKM_sk_set(MEM_OBJECT_DATA, (st), (i), (val)) # define sk_MEM_OBJECT_DATA_zero(st) SKM_sk_zero(MEM_OBJECT_DATA, (st)) # define sk_MEM_OBJECT_DATA_push(st, val) SKM_sk_push(MEM_OBJECT_DATA, (st), (val)) # define sk_MEM_OBJECT_DATA_unshift(st, val) SKM_sk_unshift(MEM_OBJECT_DATA, (st), (val)) # define sk_MEM_OBJECT_DATA_find(st, val) SKM_sk_find(MEM_OBJECT_DATA, (st), (val)) # define sk_MEM_OBJECT_DATA_find_ex(st, val) SKM_sk_find_ex(MEM_OBJECT_DATA, (st), (val)) # define sk_MEM_OBJECT_DATA_delete(st, i) SKM_sk_delete(MEM_OBJECT_DATA, (st), (i)) # define sk_MEM_OBJECT_DATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(MEM_OBJECT_DATA, (st), (ptr)) # define sk_MEM_OBJECT_DATA_insert(st, val, i) SKM_sk_insert(MEM_OBJECT_DATA, (st), (val), (i)) # define sk_MEM_OBJECT_DATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MEM_OBJECT_DATA, (st), (cmp)) # define sk_MEM_OBJECT_DATA_dup(st) SKM_sk_dup(MEM_OBJECT_DATA, st) # define sk_MEM_OBJECT_DATA_pop_free(st, free_func) SKM_sk_pop_free(MEM_OBJECT_DATA, (st), (free_func)) # define sk_MEM_OBJECT_DATA_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(MEM_OBJECT_DATA, (st), (copy_func), (free_func)) # define sk_MEM_OBJECT_DATA_shift(st) SKM_sk_shift(MEM_OBJECT_DATA, (st)) # define sk_MEM_OBJECT_DATA_pop(st) SKM_sk_pop(MEM_OBJECT_DATA, (st)) # define sk_MEM_OBJECT_DATA_sort(st) SKM_sk_sort(MEM_OBJECT_DATA, (st)) # define sk_MEM_OBJECT_DATA_is_sorted(st) SKM_sk_is_sorted(MEM_OBJECT_DATA, (st)) # define sk_MIME_HEADER_new(cmp) SKM_sk_new(MIME_HEADER, (cmp)) # define sk_MIME_HEADER_new_null() SKM_sk_new_null(MIME_HEADER) # define sk_MIME_HEADER_free(st) SKM_sk_free(MIME_HEADER, (st)) # define sk_MIME_HEADER_num(st) SKM_sk_num(MIME_HEADER, (st)) # define sk_MIME_HEADER_value(st, i) SKM_sk_value(MIME_HEADER, (st), (i)) # define sk_MIME_HEADER_set(st, i, val) SKM_sk_set(MIME_HEADER, (st), (i), (val)) # define sk_MIME_HEADER_zero(st) SKM_sk_zero(MIME_HEADER, (st)) # define sk_MIME_HEADER_push(st, val) SKM_sk_push(MIME_HEADER, (st), (val)) # define sk_MIME_HEADER_unshift(st, val) SKM_sk_unshift(MIME_HEADER, (st), (val)) # define sk_MIME_HEADER_find(st, val) SKM_sk_find(MIME_HEADER, (st), (val)) # define sk_MIME_HEADER_find_ex(st, val) SKM_sk_find_ex(MIME_HEADER, (st), (val)) # define sk_MIME_HEADER_delete(st, i) SKM_sk_delete(MIME_HEADER, (st), (i)) # define sk_MIME_HEADER_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_HEADER, (st), (ptr)) # define sk_MIME_HEADER_insert(st, val, i) SKM_sk_insert(MIME_HEADER, (st), (val), (i)) # define sk_MIME_HEADER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MIME_HEADER, (st), (cmp)) # define sk_MIME_HEADER_dup(st) SKM_sk_dup(MIME_HEADER, st) # define sk_MIME_HEADER_pop_free(st, free_func) SKM_sk_pop_free(MIME_HEADER, (st), (free_func)) # define sk_MIME_HEADER_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(MIME_HEADER, (st), (copy_func), (free_func)) # define sk_MIME_HEADER_shift(st) SKM_sk_shift(MIME_HEADER, (st)) # define sk_MIME_HEADER_pop(st) SKM_sk_pop(MIME_HEADER, (st)) # define sk_MIME_HEADER_sort(st) SKM_sk_sort(MIME_HEADER, (st)) # define sk_MIME_HEADER_is_sorted(st) SKM_sk_is_sorted(MIME_HEADER, (st)) # define sk_MIME_PARAM_new(cmp) SKM_sk_new(MIME_PARAM, (cmp)) # define sk_MIME_PARAM_new_null() SKM_sk_new_null(MIME_PARAM) # define sk_MIME_PARAM_free(st) SKM_sk_free(MIME_PARAM, (st)) # define sk_MIME_PARAM_num(st) SKM_sk_num(MIME_PARAM, (st)) # define sk_MIME_PARAM_value(st, i) SKM_sk_value(MIME_PARAM, (st), (i)) # define sk_MIME_PARAM_set(st, i, val) SKM_sk_set(MIME_PARAM, (st), (i), (val)) # define sk_MIME_PARAM_zero(st) SKM_sk_zero(MIME_PARAM, (st)) # define sk_MIME_PARAM_push(st, val) SKM_sk_push(MIME_PARAM, (st), (val)) # define sk_MIME_PARAM_unshift(st, val) SKM_sk_unshift(MIME_PARAM, (st), (val)) # define sk_MIME_PARAM_find(st, val) SKM_sk_find(MIME_PARAM, (st), (val)) # define sk_MIME_PARAM_find_ex(st, val) SKM_sk_find_ex(MIME_PARAM, (st), (val)) # define sk_MIME_PARAM_delete(st, i) SKM_sk_delete(MIME_PARAM, (st), (i)) # define sk_MIME_PARAM_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_PARAM, (st), (ptr)) # define sk_MIME_PARAM_insert(st, val, i) SKM_sk_insert(MIME_PARAM, (st), (val), (i)) # define sk_MIME_PARAM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MIME_PARAM, (st), (cmp)) # define sk_MIME_PARAM_dup(st) SKM_sk_dup(MIME_PARAM, st) # define sk_MIME_PARAM_pop_free(st, free_func) SKM_sk_pop_free(MIME_PARAM, (st), (free_func)) # define sk_MIME_PARAM_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(MIME_PARAM, (st), (copy_func), (free_func)) # define sk_MIME_PARAM_shift(st) SKM_sk_shift(MIME_PARAM, (st)) # define sk_MIME_PARAM_pop(st) SKM_sk_pop(MIME_PARAM, (st)) # define sk_MIME_PARAM_sort(st) SKM_sk_sort(MIME_PARAM, (st)) # define sk_MIME_PARAM_is_sorted(st) SKM_sk_is_sorted(MIME_PARAM, (st)) # define sk_NAME_FUNCS_new(cmp) SKM_sk_new(NAME_FUNCS, (cmp)) # define sk_NAME_FUNCS_new_null() SKM_sk_new_null(NAME_FUNCS) # define sk_NAME_FUNCS_free(st) SKM_sk_free(NAME_FUNCS, (st)) # define sk_NAME_FUNCS_num(st) SKM_sk_num(NAME_FUNCS, (st)) # define sk_NAME_FUNCS_value(st, i) SKM_sk_value(NAME_FUNCS, (st), (i)) # define sk_NAME_FUNCS_set(st, i, val) SKM_sk_set(NAME_FUNCS, (st), (i), (val)) # define sk_NAME_FUNCS_zero(st) SKM_sk_zero(NAME_FUNCS, (st)) # define sk_NAME_FUNCS_push(st, val) SKM_sk_push(NAME_FUNCS, (st), (val)) # define sk_NAME_FUNCS_unshift(st, val) SKM_sk_unshift(NAME_FUNCS, (st), (val)) # define sk_NAME_FUNCS_find(st, val) SKM_sk_find(NAME_FUNCS, (st), (val)) # define sk_NAME_FUNCS_find_ex(st, val) SKM_sk_find_ex(NAME_FUNCS, (st), (val)) # define sk_NAME_FUNCS_delete(st, i) SKM_sk_delete(NAME_FUNCS, (st), (i)) # define sk_NAME_FUNCS_delete_ptr(st, ptr) SKM_sk_delete_ptr(NAME_FUNCS, (st), (ptr)) # define sk_NAME_FUNCS_insert(st, val, i) SKM_sk_insert(NAME_FUNCS, (st), (val), (i)) # define sk_NAME_FUNCS_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(NAME_FUNCS, (st), (cmp)) # define sk_NAME_FUNCS_dup(st) SKM_sk_dup(NAME_FUNCS, st) # define sk_NAME_FUNCS_pop_free(st, free_func) SKM_sk_pop_free(NAME_FUNCS, (st), (free_func)) # define sk_NAME_FUNCS_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(NAME_FUNCS, (st), (copy_func), (free_func)) # define sk_NAME_FUNCS_shift(st) SKM_sk_shift(NAME_FUNCS, (st)) # define sk_NAME_FUNCS_pop(st) SKM_sk_pop(NAME_FUNCS, (st)) # define sk_NAME_FUNCS_sort(st) SKM_sk_sort(NAME_FUNCS, (st)) # define sk_NAME_FUNCS_is_sorted(st) SKM_sk_is_sorted(NAME_FUNCS, (st)) # define sk_OCSP_CERTID_new(cmp) SKM_sk_new(OCSP_CERTID, (cmp)) # define sk_OCSP_CERTID_new_null() SKM_sk_new_null(OCSP_CERTID) # define sk_OCSP_CERTID_free(st) SKM_sk_free(OCSP_CERTID, (st)) # define sk_OCSP_CERTID_num(st) SKM_sk_num(OCSP_CERTID, (st)) # define sk_OCSP_CERTID_value(st, i) SKM_sk_value(OCSP_CERTID, (st), (i)) # define sk_OCSP_CERTID_set(st, i, val) SKM_sk_set(OCSP_CERTID, (st), (i), (val)) # define sk_OCSP_CERTID_zero(st) SKM_sk_zero(OCSP_CERTID, (st)) # define sk_OCSP_CERTID_push(st, val) SKM_sk_push(OCSP_CERTID, (st), (val)) # define sk_OCSP_CERTID_unshift(st, val) SKM_sk_unshift(OCSP_CERTID, (st), (val)) # define sk_OCSP_CERTID_find(st, val) SKM_sk_find(OCSP_CERTID, (st), (val)) # define sk_OCSP_CERTID_find_ex(st, val) SKM_sk_find_ex(OCSP_CERTID, (st), (val)) # define sk_OCSP_CERTID_delete(st, i) SKM_sk_delete(OCSP_CERTID, (st), (i)) # define sk_OCSP_CERTID_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_CERTID, (st), (ptr)) # define sk_OCSP_CERTID_insert(st, val, i) SKM_sk_insert(OCSP_CERTID, (st), (val), (i)) # define sk_OCSP_CERTID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_CERTID, (st), (cmp)) # define sk_OCSP_CERTID_dup(st) SKM_sk_dup(OCSP_CERTID, st) # define sk_OCSP_CERTID_pop_free(st, free_func) SKM_sk_pop_free(OCSP_CERTID, (st), (free_func)) # define sk_OCSP_CERTID_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(OCSP_CERTID, (st), (copy_func), (free_func)) # define sk_OCSP_CERTID_shift(st) SKM_sk_shift(OCSP_CERTID, (st)) # define sk_OCSP_CERTID_pop(st) SKM_sk_pop(OCSP_CERTID, (st)) # define sk_OCSP_CERTID_sort(st) SKM_sk_sort(OCSP_CERTID, (st)) # define sk_OCSP_CERTID_is_sorted(st) SKM_sk_is_sorted(OCSP_CERTID, (st)) # define sk_OCSP_ONEREQ_new(cmp) SKM_sk_new(OCSP_ONEREQ, (cmp)) # define sk_OCSP_ONEREQ_new_null() SKM_sk_new_null(OCSP_ONEREQ) # define sk_OCSP_ONEREQ_free(st) SKM_sk_free(OCSP_ONEREQ, (st)) # define sk_OCSP_ONEREQ_num(st) SKM_sk_num(OCSP_ONEREQ, (st)) # define sk_OCSP_ONEREQ_value(st, i) SKM_sk_value(OCSP_ONEREQ, (st), (i)) # define sk_OCSP_ONEREQ_set(st, i, val) SKM_sk_set(OCSP_ONEREQ, (st), (i), (val)) # define sk_OCSP_ONEREQ_zero(st) SKM_sk_zero(OCSP_ONEREQ, (st)) # define sk_OCSP_ONEREQ_push(st, val) SKM_sk_push(OCSP_ONEREQ, (st), (val)) # define sk_OCSP_ONEREQ_unshift(st, val) SKM_sk_unshift(OCSP_ONEREQ, (st), (val)) # define sk_OCSP_ONEREQ_find(st, val) SKM_sk_find(OCSP_ONEREQ, (st), (val)) # define sk_OCSP_ONEREQ_find_ex(st, val) SKM_sk_find_ex(OCSP_ONEREQ, (st), (val)) # define sk_OCSP_ONEREQ_delete(st, i) SKM_sk_delete(OCSP_ONEREQ, (st), (i)) # define sk_OCSP_ONEREQ_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_ONEREQ, (st), (ptr)) # define sk_OCSP_ONEREQ_insert(st, val, i) SKM_sk_insert(OCSP_ONEREQ, (st), (val), (i)) # define sk_OCSP_ONEREQ_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_ONEREQ, (st), (cmp)) # define sk_OCSP_ONEREQ_dup(st) SKM_sk_dup(OCSP_ONEREQ, st) # define sk_OCSP_ONEREQ_pop_free(st, free_func) SKM_sk_pop_free(OCSP_ONEREQ, (st), (free_func)) # define sk_OCSP_ONEREQ_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(OCSP_ONEREQ, (st), (copy_func), (free_func)) # define sk_OCSP_ONEREQ_shift(st) SKM_sk_shift(OCSP_ONEREQ, (st)) # define sk_OCSP_ONEREQ_pop(st) SKM_sk_pop(OCSP_ONEREQ, (st)) # define sk_OCSP_ONEREQ_sort(st) SKM_sk_sort(OCSP_ONEREQ, (st)) # define sk_OCSP_ONEREQ_is_sorted(st) SKM_sk_is_sorted(OCSP_ONEREQ, (st)) # define sk_OCSP_RESPID_new(cmp) SKM_sk_new(OCSP_RESPID, (cmp)) # define sk_OCSP_RESPID_new_null() SKM_sk_new_null(OCSP_RESPID) # define sk_OCSP_RESPID_free(st) SKM_sk_free(OCSP_RESPID, (st)) # define sk_OCSP_RESPID_num(st) SKM_sk_num(OCSP_RESPID, (st)) # define sk_OCSP_RESPID_value(st, i) SKM_sk_value(OCSP_RESPID, (st), (i)) # define sk_OCSP_RESPID_set(st, i, val) SKM_sk_set(OCSP_RESPID, (st), (i), (val)) # define sk_OCSP_RESPID_zero(st) SKM_sk_zero(OCSP_RESPID, (st)) # define sk_OCSP_RESPID_push(st, val) SKM_sk_push(OCSP_RESPID, (st), (val)) # define sk_OCSP_RESPID_unshift(st, val) SKM_sk_unshift(OCSP_RESPID, (st), (val)) # define sk_OCSP_RESPID_find(st, val) SKM_sk_find(OCSP_RESPID, (st), (val)) # define sk_OCSP_RESPID_find_ex(st, val) SKM_sk_find_ex(OCSP_RESPID, (st), (val)) # define sk_OCSP_RESPID_delete(st, i) SKM_sk_delete(OCSP_RESPID, (st), (i)) # define sk_OCSP_RESPID_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_RESPID, (st), (ptr)) # define sk_OCSP_RESPID_insert(st, val, i) SKM_sk_insert(OCSP_RESPID, (st), (val), (i)) # define sk_OCSP_RESPID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_RESPID, (st), (cmp)) # define sk_OCSP_RESPID_dup(st) SKM_sk_dup(OCSP_RESPID, st) # define sk_OCSP_RESPID_pop_free(st, free_func) SKM_sk_pop_free(OCSP_RESPID, (st), (free_func)) # define sk_OCSP_RESPID_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(OCSP_RESPID, (st), (copy_func), (free_func)) # define sk_OCSP_RESPID_shift(st) SKM_sk_shift(OCSP_RESPID, (st)) # define sk_OCSP_RESPID_pop(st) SKM_sk_pop(OCSP_RESPID, (st)) # define sk_OCSP_RESPID_sort(st) SKM_sk_sort(OCSP_RESPID, (st)) # define sk_OCSP_RESPID_is_sorted(st) SKM_sk_is_sorted(OCSP_RESPID, (st)) # define sk_OCSP_SINGLERESP_new(cmp) SKM_sk_new(OCSP_SINGLERESP, (cmp)) # define sk_OCSP_SINGLERESP_new_null() SKM_sk_new_null(OCSP_SINGLERESP) # define sk_OCSP_SINGLERESP_free(st) SKM_sk_free(OCSP_SINGLERESP, (st)) # define sk_OCSP_SINGLERESP_num(st) SKM_sk_num(OCSP_SINGLERESP, (st)) # define sk_OCSP_SINGLERESP_value(st, i) SKM_sk_value(OCSP_SINGLERESP, (st), (i)) # define sk_OCSP_SINGLERESP_set(st, i, val) SKM_sk_set(OCSP_SINGLERESP, (st), (i), (val)) # define sk_OCSP_SINGLERESP_zero(st) SKM_sk_zero(OCSP_SINGLERESP, (st)) # define sk_OCSP_SINGLERESP_push(st, val) SKM_sk_push(OCSP_SINGLERESP, (st), (val)) # define sk_OCSP_SINGLERESP_unshift(st, val) SKM_sk_unshift(OCSP_SINGLERESP, (st), (val)) # define sk_OCSP_SINGLERESP_find(st, val) SKM_sk_find(OCSP_SINGLERESP, (st), (val)) # define sk_OCSP_SINGLERESP_find_ex(st, val) SKM_sk_find_ex(OCSP_SINGLERESP, (st), (val)) # define sk_OCSP_SINGLERESP_delete(st, i) SKM_sk_delete(OCSP_SINGLERESP, (st), (i)) # define sk_OCSP_SINGLERESP_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_SINGLERESP, (st), (ptr)) # define sk_OCSP_SINGLERESP_insert(st, val, i) SKM_sk_insert(OCSP_SINGLERESP, (st), (val), (i)) # define sk_OCSP_SINGLERESP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_SINGLERESP, (st), (cmp)) # define sk_OCSP_SINGLERESP_dup(st) SKM_sk_dup(OCSP_SINGLERESP, st) # define sk_OCSP_SINGLERESP_pop_free(st, free_func) SKM_sk_pop_free(OCSP_SINGLERESP, (st), (free_func)) # define sk_OCSP_SINGLERESP_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(OCSP_SINGLERESP, (st), (copy_func), (free_func)) # define sk_OCSP_SINGLERESP_shift(st) SKM_sk_shift(OCSP_SINGLERESP, (st)) # define sk_OCSP_SINGLERESP_pop(st) SKM_sk_pop(OCSP_SINGLERESP, (st)) # define sk_OCSP_SINGLERESP_sort(st) SKM_sk_sort(OCSP_SINGLERESP, (st)) # define sk_OCSP_SINGLERESP_is_sorted(st) SKM_sk_is_sorted(OCSP_SINGLERESP, (st)) # define sk_PKCS12_SAFEBAG_new(cmp) SKM_sk_new(PKCS12_SAFEBAG, (cmp)) # define sk_PKCS12_SAFEBAG_new_null() SKM_sk_new_null(PKCS12_SAFEBAG) # define sk_PKCS12_SAFEBAG_free(st) SKM_sk_free(PKCS12_SAFEBAG, (st)) # define sk_PKCS12_SAFEBAG_num(st) SKM_sk_num(PKCS12_SAFEBAG, (st)) # define sk_PKCS12_SAFEBAG_value(st, i) SKM_sk_value(PKCS12_SAFEBAG, (st), (i)) # define sk_PKCS12_SAFEBAG_set(st, i, val) SKM_sk_set(PKCS12_SAFEBAG, (st), (i), (val)) # define sk_PKCS12_SAFEBAG_zero(st) SKM_sk_zero(PKCS12_SAFEBAG, (st)) # define sk_PKCS12_SAFEBAG_push(st, val) SKM_sk_push(PKCS12_SAFEBAG, (st), (val)) # define sk_PKCS12_SAFEBAG_unshift(st, val) SKM_sk_unshift(PKCS12_SAFEBAG, (st), (val)) # define sk_PKCS12_SAFEBAG_find(st, val) SKM_sk_find(PKCS12_SAFEBAG, (st), (val)) # define sk_PKCS12_SAFEBAG_find_ex(st, val) SKM_sk_find_ex(PKCS12_SAFEBAG, (st), (val)) # define sk_PKCS12_SAFEBAG_delete(st, i) SKM_sk_delete(PKCS12_SAFEBAG, (st), (i)) # define sk_PKCS12_SAFEBAG_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS12_SAFEBAG, (st), (ptr)) # define sk_PKCS12_SAFEBAG_insert(st, val, i) SKM_sk_insert(PKCS12_SAFEBAG, (st), (val), (i)) # define sk_PKCS12_SAFEBAG_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS12_SAFEBAG, (st), (cmp)) # define sk_PKCS12_SAFEBAG_dup(st) SKM_sk_dup(PKCS12_SAFEBAG, st) # define sk_PKCS12_SAFEBAG_pop_free(st, free_func) SKM_sk_pop_free(PKCS12_SAFEBAG, (st), (free_func)) # define sk_PKCS12_SAFEBAG_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(PKCS12_SAFEBAG, (st), (copy_func), (free_func)) # define sk_PKCS12_SAFEBAG_shift(st) SKM_sk_shift(PKCS12_SAFEBAG, (st)) # define sk_PKCS12_SAFEBAG_pop(st) SKM_sk_pop(PKCS12_SAFEBAG, (st)) # define sk_PKCS12_SAFEBAG_sort(st) SKM_sk_sort(PKCS12_SAFEBAG, (st)) # define sk_PKCS12_SAFEBAG_is_sorted(st) SKM_sk_is_sorted(PKCS12_SAFEBAG, (st)) # define sk_PKCS7_new(cmp) SKM_sk_new(PKCS7, (cmp)) # define sk_PKCS7_new_null() SKM_sk_new_null(PKCS7) # define sk_PKCS7_free(st) SKM_sk_free(PKCS7, (st)) # define sk_PKCS7_num(st) SKM_sk_num(PKCS7, (st)) # define sk_PKCS7_value(st, i) SKM_sk_value(PKCS7, (st), (i)) # define sk_PKCS7_set(st, i, val) SKM_sk_set(PKCS7, (st), (i), (val)) # define sk_PKCS7_zero(st) SKM_sk_zero(PKCS7, (st)) # define sk_PKCS7_push(st, val) SKM_sk_push(PKCS7, (st), (val)) # define sk_PKCS7_unshift(st, val) SKM_sk_unshift(PKCS7, (st), (val)) # define sk_PKCS7_find(st, val) SKM_sk_find(PKCS7, (st), (val)) # define sk_PKCS7_find_ex(st, val) SKM_sk_find_ex(PKCS7, (st), (val)) # define sk_PKCS7_delete(st, i) SKM_sk_delete(PKCS7, (st), (i)) # define sk_PKCS7_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7, (st), (ptr)) # define sk_PKCS7_insert(st, val, i) SKM_sk_insert(PKCS7, (st), (val), (i)) # define sk_PKCS7_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7, (st), (cmp)) # define sk_PKCS7_dup(st) SKM_sk_dup(PKCS7, st) # define sk_PKCS7_pop_free(st, free_func) SKM_sk_pop_free(PKCS7, (st), (free_func)) # define sk_PKCS7_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(PKCS7, (st), (copy_func), (free_func)) # define sk_PKCS7_shift(st) SKM_sk_shift(PKCS7, (st)) # define sk_PKCS7_pop(st) SKM_sk_pop(PKCS7, (st)) # define sk_PKCS7_sort(st) SKM_sk_sort(PKCS7, (st)) # define sk_PKCS7_is_sorted(st) SKM_sk_is_sorted(PKCS7, (st)) # define sk_PKCS7_RECIP_INFO_new(cmp) SKM_sk_new(PKCS7_RECIP_INFO, (cmp)) # define sk_PKCS7_RECIP_INFO_new_null() SKM_sk_new_null(PKCS7_RECIP_INFO) # define sk_PKCS7_RECIP_INFO_free(st) SKM_sk_free(PKCS7_RECIP_INFO, (st)) # define sk_PKCS7_RECIP_INFO_num(st) SKM_sk_num(PKCS7_RECIP_INFO, (st)) # define sk_PKCS7_RECIP_INFO_value(st, i) SKM_sk_value(PKCS7_RECIP_INFO, (st), (i)) # define sk_PKCS7_RECIP_INFO_set(st, i, val) SKM_sk_set(PKCS7_RECIP_INFO, (st), (i), (val)) # define sk_PKCS7_RECIP_INFO_zero(st) SKM_sk_zero(PKCS7_RECIP_INFO, (st)) # define sk_PKCS7_RECIP_INFO_push(st, val) SKM_sk_push(PKCS7_RECIP_INFO, (st), (val)) # define sk_PKCS7_RECIP_INFO_unshift(st, val) SKM_sk_unshift(PKCS7_RECIP_INFO, (st), (val)) # define sk_PKCS7_RECIP_INFO_find(st, val) SKM_sk_find(PKCS7_RECIP_INFO, (st), (val)) # define sk_PKCS7_RECIP_INFO_find_ex(st, val) SKM_sk_find_ex(PKCS7_RECIP_INFO, (st), (val)) # define sk_PKCS7_RECIP_INFO_delete(st, i) SKM_sk_delete(PKCS7_RECIP_INFO, (st), (i)) # define sk_PKCS7_RECIP_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7_RECIP_INFO, (st), (ptr)) # define sk_PKCS7_RECIP_INFO_insert(st, val, i) SKM_sk_insert(PKCS7_RECIP_INFO, (st), (val), (i)) # define sk_PKCS7_RECIP_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7_RECIP_INFO, (st), (cmp)) # define sk_PKCS7_RECIP_INFO_dup(st) SKM_sk_dup(PKCS7_RECIP_INFO, st) # define sk_PKCS7_RECIP_INFO_pop_free(st, free_func) SKM_sk_pop_free(PKCS7_RECIP_INFO, (st), (free_func)) # define sk_PKCS7_RECIP_INFO_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(PKCS7_RECIP_INFO, (st), (copy_func), (free_func)) # define sk_PKCS7_RECIP_INFO_shift(st) SKM_sk_shift(PKCS7_RECIP_INFO, (st)) # define sk_PKCS7_RECIP_INFO_pop(st) SKM_sk_pop(PKCS7_RECIP_INFO, (st)) # define sk_PKCS7_RECIP_INFO_sort(st) SKM_sk_sort(PKCS7_RECIP_INFO, (st)) # define sk_PKCS7_RECIP_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_RECIP_INFO, (st)) # define sk_PKCS7_SIGNER_INFO_new(cmp) SKM_sk_new(PKCS7_SIGNER_INFO, (cmp)) # define sk_PKCS7_SIGNER_INFO_new_null() SKM_sk_new_null(PKCS7_SIGNER_INFO) # define sk_PKCS7_SIGNER_INFO_free(st) SKM_sk_free(PKCS7_SIGNER_INFO, (st)) # define sk_PKCS7_SIGNER_INFO_num(st) SKM_sk_num(PKCS7_SIGNER_INFO, (st)) # define sk_PKCS7_SIGNER_INFO_value(st, i) SKM_sk_value(PKCS7_SIGNER_INFO, (st), (i)) # define sk_PKCS7_SIGNER_INFO_set(st, i, val) SKM_sk_set(PKCS7_SIGNER_INFO, (st), (i), (val)) # define sk_PKCS7_SIGNER_INFO_zero(st) SKM_sk_zero(PKCS7_SIGNER_INFO, (st)) # define sk_PKCS7_SIGNER_INFO_push(st, val) SKM_sk_push(PKCS7_SIGNER_INFO, (st), (val)) # define sk_PKCS7_SIGNER_INFO_unshift(st, val) SKM_sk_unshift(PKCS7_SIGNER_INFO, (st), (val)) # define sk_PKCS7_SIGNER_INFO_find(st, val) SKM_sk_find(PKCS7_SIGNER_INFO, (st), (val)) # define sk_PKCS7_SIGNER_INFO_find_ex(st, val) SKM_sk_find_ex(PKCS7_SIGNER_INFO, (st), (val)) # define sk_PKCS7_SIGNER_INFO_delete(st, i) SKM_sk_delete(PKCS7_SIGNER_INFO, (st), (i)) # define sk_PKCS7_SIGNER_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7_SIGNER_INFO, (st), (ptr)) # define sk_PKCS7_SIGNER_INFO_insert(st, val, i) SKM_sk_insert(PKCS7_SIGNER_INFO, (st), (val), (i)) # define sk_PKCS7_SIGNER_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7_SIGNER_INFO, (st), (cmp)) # define sk_PKCS7_SIGNER_INFO_dup(st) SKM_sk_dup(PKCS7_SIGNER_INFO, st) # define sk_PKCS7_SIGNER_INFO_pop_free(st, free_func) SKM_sk_pop_free(PKCS7_SIGNER_INFO, (st), (free_func)) # define sk_PKCS7_SIGNER_INFO_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(PKCS7_SIGNER_INFO, (st), (copy_func), (free_func)) # define sk_PKCS7_SIGNER_INFO_shift(st) SKM_sk_shift(PKCS7_SIGNER_INFO, (st)) # define sk_PKCS7_SIGNER_INFO_pop(st) SKM_sk_pop(PKCS7_SIGNER_INFO, (st)) # define sk_PKCS7_SIGNER_INFO_sort(st) SKM_sk_sort(PKCS7_SIGNER_INFO, (st)) # define sk_PKCS7_SIGNER_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_SIGNER_INFO, (st)) # define sk_POLICYINFO_new(cmp) SKM_sk_new(POLICYINFO, (cmp)) # define sk_POLICYINFO_new_null() SKM_sk_new_null(POLICYINFO) # define sk_POLICYINFO_free(st) SKM_sk_free(POLICYINFO, (st)) # define sk_POLICYINFO_num(st) SKM_sk_num(POLICYINFO, (st)) # define sk_POLICYINFO_value(st, i) SKM_sk_value(POLICYINFO, (st), (i)) # define sk_POLICYINFO_set(st, i, val) SKM_sk_set(POLICYINFO, (st), (i), (val)) # define sk_POLICYINFO_zero(st) SKM_sk_zero(POLICYINFO, (st)) # define sk_POLICYINFO_push(st, val) SKM_sk_push(POLICYINFO, (st), (val)) # define sk_POLICYINFO_unshift(st, val) SKM_sk_unshift(POLICYINFO, (st), (val)) # define sk_POLICYINFO_find(st, val) SKM_sk_find(POLICYINFO, (st), (val)) # define sk_POLICYINFO_find_ex(st, val) SKM_sk_find_ex(POLICYINFO, (st), (val)) # define sk_POLICYINFO_delete(st, i) SKM_sk_delete(POLICYINFO, (st), (i)) # define sk_POLICYINFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICYINFO, (st), (ptr)) # define sk_POLICYINFO_insert(st, val, i) SKM_sk_insert(POLICYINFO, (st), (val), (i)) # define sk_POLICYINFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICYINFO, (st), (cmp)) # define sk_POLICYINFO_dup(st) SKM_sk_dup(POLICYINFO, st) # define sk_POLICYINFO_pop_free(st, free_func) SKM_sk_pop_free(POLICYINFO, (st), (free_func)) # define sk_POLICYINFO_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(POLICYINFO, (st), (copy_func), (free_func)) # define sk_POLICYINFO_shift(st) SKM_sk_shift(POLICYINFO, (st)) # define sk_POLICYINFO_pop(st) SKM_sk_pop(POLICYINFO, (st)) # define sk_POLICYINFO_sort(st) SKM_sk_sort(POLICYINFO, (st)) # define sk_POLICYINFO_is_sorted(st) SKM_sk_is_sorted(POLICYINFO, (st)) # define sk_POLICYQUALINFO_new(cmp) SKM_sk_new(POLICYQUALINFO, (cmp)) # define sk_POLICYQUALINFO_new_null() SKM_sk_new_null(POLICYQUALINFO) # define sk_POLICYQUALINFO_free(st) SKM_sk_free(POLICYQUALINFO, (st)) # define sk_POLICYQUALINFO_num(st) SKM_sk_num(POLICYQUALINFO, (st)) # define sk_POLICYQUALINFO_value(st, i) SKM_sk_value(POLICYQUALINFO, (st), (i)) # define sk_POLICYQUALINFO_set(st, i, val) SKM_sk_set(POLICYQUALINFO, (st), (i), (val)) # define sk_POLICYQUALINFO_zero(st) SKM_sk_zero(POLICYQUALINFO, (st)) # define sk_POLICYQUALINFO_push(st, val) SKM_sk_push(POLICYQUALINFO, (st), (val)) # define sk_POLICYQUALINFO_unshift(st, val) SKM_sk_unshift(POLICYQUALINFO, (st), (val)) # define sk_POLICYQUALINFO_find(st, val) SKM_sk_find(POLICYQUALINFO, (st), (val)) # define sk_POLICYQUALINFO_find_ex(st, val) SKM_sk_find_ex(POLICYQUALINFO, (st), (val)) # define sk_POLICYQUALINFO_delete(st, i) SKM_sk_delete(POLICYQUALINFO, (st), (i)) # define sk_POLICYQUALINFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICYQUALINFO, (st), (ptr)) # define sk_POLICYQUALINFO_insert(st, val, i) SKM_sk_insert(POLICYQUALINFO, (st), (val), (i)) # define sk_POLICYQUALINFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICYQUALINFO, (st), (cmp)) # define sk_POLICYQUALINFO_dup(st) SKM_sk_dup(POLICYQUALINFO, st) # define sk_POLICYQUALINFO_pop_free(st, free_func) SKM_sk_pop_free(POLICYQUALINFO, (st), (free_func)) # define sk_POLICYQUALINFO_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(POLICYQUALINFO, (st), (copy_func), (free_func)) # define sk_POLICYQUALINFO_shift(st) SKM_sk_shift(POLICYQUALINFO, (st)) # define sk_POLICYQUALINFO_pop(st) SKM_sk_pop(POLICYQUALINFO, (st)) # define sk_POLICYQUALINFO_sort(st) SKM_sk_sort(POLICYQUALINFO, (st)) # define sk_POLICYQUALINFO_is_sorted(st) SKM_sk_is_sorted(POLICYQUALINFO, (st)) # define sk_POLICY_MAPPING_new(cmp) SKM_sk_new(POLICY_MAPPING, (cmp)) # define sk_POLICY_MAPPING_new_null() SKM_sk_new_null(POLICY_MAPPING) # define sk_POLICY_MAPPING_free(st) SKM_sk_free(POLICY_MAPPING, (st)) # define sk_POLICY_MAPPING_num(st) SKM_sk_num(POLICY_MAPPING, (st)) # define sk_POLICY_MAPPING_value(st, i) SKM_sk_value(POLICY_MAPPING, (st), (i)) # define sk_POLICY_MAPPING_set(st, i, val) SKM_sk_set(POLICY_MAPPING, (st), (i), (val)) # define sk_POLICY_MAPPING_zero(st) SKM_sk_zero(POLICY_MAPPING, (st)) # define sk_POLICY_MAPPING_push(st, val) SKM_sk_push(POLICY_MAPPING, (st), (val)) # define sk_POLICY_MAPPING_unshift(st, val) SKM_sk_unshift(POLICY_MAPPING, (st), (val)) # define sk_POLICY_MAPPING_find(st, val) SKM_sk_find(POLICY_MAPPING, (st), (val)) # define sk_POLICY_MAPPING_find_ex(st, val) SKM_sk_find_ex(POLICY_MAPPING, (st), (val)) # define sk_POLICY_MAPPING_delete(st, i) SKM_sk_delete(POLICY_MAPPING, (st), (i)) # define sk_POLICY_MAPPING_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICY_MAPPING, (st), (ptr)) # define sk_POLICY_MAPPING_insert(st, val, i) SKM_sk_insert(POLICY_MAPPING, (st), (val), (i)) # define sk_POLICY_MAPPING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICY_MAPPING, (st), (cmp)) # define sk_POLICY_MAPPING_dup(st) SKM_sk_dup(POLICY_MAPPING, st) # define sk_POLICY_MAPPING_pop_free(st, free_func) SKM_sk_pop_free(POLICY_MAPPING, (st), (free_func)) # define sk_POLICY_MAPPING_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(POLICY_MAPPING, (st), (copy_func), (free_func)) # define sk_POLICY_MAPPING_shift(st) SKM_sk_shift(POLICY_MAPPING, (st)) # define sk_POLICY_MAPPING_pop(st) SKM_sk_pop(POLICY_MAPPING, (st)) # define sk_POLICY_MAPPING_sort(st) SKM_sk_sort(POLICY_MAPPING, (st)) # define sk_POLICY_MAPPING_is_sorted(st) SKM_sk_is_sorted(POLICY_MAPPING, (st)) # define sk_SCT_new(cmp) SKM_sk_new(SCT, (cmp)) # define sk_SCT_new_null() SKM_sk_new_null(SCT) # define sk_SCT_free(st) SKM_sk_free(SCT, (st)) # define sk_SCT_num(st) SKM_sk_num(SCT, (st)) # define sk_SCT_value(st, i) SKM_sk_value(SCT, (st), (i)) # define sk_SCT_set(st, i, val) SKM_sk_set(SCT, (st), (i), (val)) # define sk_SCT_zero(st) SKM_sk_zero(SCT, (st)) # define sk_SCT_push(st, val) SKM_sk_push(SCT, (st), (val)) # define sk_SCT_unshift(st, val) SKM_sk_unshift(SCT, (st), (val)) # define sk_SCT_find(st, val) SKM_sk_find(SCT, (st), (val)) # define sk_SCT_find_ex(st, val) SKM_sk_find_ex(SCT, (st), (val)) # define sk_SCT_delete(st, i) SKM_sk_delete(SCT, (st), (i)) # define sk_SCT_delete_ptr(st, ptr) SKM_sk_delete_ptr(SCT, (st), (ptr)) # define sk_SCT_insert(st, val, i) SKM_sk_insert(SCT, (st), (val), (i)) # define sk_SCT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SCT, (st), (cmp)) # define sk_SCT_dup(st) SKM_sk_dup(SCT, st) # define sk_SCT_pop_free(st, free_func) SKM_sk_pop_free(SCT, (st), (free_func)) # define sk_SCT_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(SCT, (st), (copy_func), (free_func)) # define sk_SCT_shift(st) SKM_sk_shift(SCT, (st)) # define sk_SCT_pop(st) SKM_sk_pop(SCT, (st)) # define sk_SCT_sort(st) SKM_sk_sort(SCT, (st)) # define sk_SCT_is_sorted(st) SKM_sk_is_sorted(SCT, (st)) # define sk_SRP_gN_new(cmp) SKM_sk_new(SRP_gN, (cmp)) # define sk_SRP_gN_new_null() SKM_sk_new_null(SRP_gN) # define sk_SRP_gN_free(st) SKM_sk_free(SRP_gN, (st)) # define sk_SRP_gN_num(st) SKM_sk_num(SRP_gN, (st)) # define sk_SRP_gN_value(st, i) SKM_sk_value(SRP_gN, (st), (i)) # define sk_SRP_gN_set(st, i, val) SKM_sk_set(SRP_gN, (st), (i), (val)) # define sk_SRP_gN_zero(st) SKM_sk_zero(SRP_gN, (st)) # define sk_SRP_gN_push(st, val) SKM_sk_push(SRP_gN, (st), (val)) # define sk_SRP_gN_unshift(st, val) SKM_sk_unshift(SRP_gN, (st), (val)) # define sk_SRP_gN_find(st, val) SKM_sk_find(SRP_gN, (st), (val)) # define sk_SRP_gN_find_ex(st, val) SKM_sk_find_ex(SRP_gN, (st), (val)) # define sk_SRP_gN_delete(st, i) SKM_sk_delete(SRP_gN, (st), (i)) # define sk_SRP_gN_delete_ptr(st, ptr) SKM_sk_delete_ptr(SRP_gN, (st), (ptr)) # define sk_SRP_gN_insert(st, val, i) SKM_sk_insert(SRP_gN, (st), (val), (i)) # define sk_SRP_gN_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SRP_gN, (st), (cmp)) # define sk_SRP_gN_dup(st) SKM_sk_dup(SRP_gN, st) # define sk_SRP_gN_pop_free(st, free_func) SKM_sk_pop_free(SRP_gN, (st), (free_func)) # define sk_SRP_gN_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(SRP_gN, (st), (copy_func), (free_func)) # define sk_SRP_gN_shift(st) SKM_sk_shift(SRP_gN, (st)) # define sk_SRP_gN_pop(st) SKM_sk_pop(SRP_gN, (st)) # define sk_SRP_gN_sort(st) SKM_sk_sort(SRP_gN, (st)) # define sk_SRP_gN_is_sorted(st) SKM_sk_is_sorted(SRP_gN, (st)) # define sk_SRP_gN_cache_new(cmp) SKM_sk_new(SRP_gN_cache, (cmp)) # define sk_SRP_gN_cache_new_null() SKM_sk_new_null(SRP_gN_cache) # define sk_SRP_gN_cache_free(st) SKM_sk_free(SRP_gN_cache, (st)) # define sk_SRP_gN_cache_num(st) SKM_sk_num(SRP_gN_cache, (st)) # define sk_SRP_gN_cache_value(st, i) SKM_sk_value(SRP_gN_cache, (st), (i)) # define sk_SRP_gN_cache_set(st, i, val) SKM_sk_set(SRP_gN_cache, (st), (i), (val)) # define sk_SRP_gN_cache_zero(st) SKM_sk_zero(SRP_gN_cache, (st)) # define sk_SRP_gN_cache_push(st, val) SKM_sk_push(SRP_gN_cache, (st), (val)) # define sk_SRP_gN_cache_unshift(st, val) SKM_sk_unshift(SRP_gN_cache, (st), (val)) # define sk_SRP_gN_cache_find(st, val) SKM_sk_find(SRP_gN_cache, (st), (val)) # define sk_SRP_gN_cache_find_ex(st, val) SKM_sk_find_ex(SRP_gN_cache, (st), (val)) # define sk_SRP_gN_cache_delete(st, i) SKM_sk_delete(SRP_gN_cache, (st), (i)) # define sk_SRP_gN_cache_delete_ptr(st, ptr) SKM_sk_delete_ptr(SRP_gN_cache, (st), (ptr)) # define sk_SRP_gN_cache_insert(st, val, i) SKM_sk_insert(SRP_gN_cache, (st), (val), (i)) # define sk_SRP_gN_cache_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SRP_gN_cache, (st), (cmp)) # define sk_SRP_gN_cache_dup(st) SKM_sk_dup(SRP_gN_cache, st) # define sk_SRP_gN_cache_pop_free(st, free_func) SKM_sk_pop_free(SRP_gN_cache, (st), (free_func)) # define sk_SRP_gN_cache_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(SRP_gN_cache, (st), (copy_func), (free_func)) # define sk_SRP_gN_cache_shift(st) SKM_sk_shift(SRP_gN_cache, (st)) # define sk_SRP_gN_cache_pop(st) SKM_sk_pop(SRP_gN_cache, (st)) # define sk_SRP_gN_cache_sort(st) SKM_sk_sort(SRP_gN_cache, (st)) # define sk_SRP_gN_cache_is_sorted(st) SKM_sk_is_sorted(SRP_gN_cache, (st)) # define sk_SRP_user_pwd_new(cmp) SKM_sk_new(SRP_user_pwd, (cmp)) # define sk_SRP_user_pwd_new_null() SKM_sk_new_null(SRP_user_pwd) # define sk_SRP_user_pwd_free(st) SKM_sk_free(SRP_user_pwd, (st)) # define sk_SRP_user_pwd_num(st) SKM_sk_num(SRP_user_pwd, (st)) # define sk_SRP_user_pwd_value(st, i) SKM_sk_value(SRP_user_pwd, (st), (i)) # define sk_SRP_user_pwd_set(st, i, val) SKM_sk_set(SRP_user_pwd, (st), (i), (val)) # define sk_SRP_user_pwd_zero(st) SKM_sk_zero(SRP_user_pwd, (st)) # define sk_SRP_user_pwd_push(st, val) SKM_sk_push(SRP_user_pwd, (st), (val)) # define sk_SRP_user_pwd_unshift(st, val) SKM_sk_unshift(SRP_user_pwd, (st), (val)) # define sk_SRP_user_pwd_find(st, val) SKM_sk_find(SRP_user_pwd, (st), (val)) # define sk_SRP_user_pwd_find_ex(st, val) SKM_sk_find_ex(SRP_user_pwd, (st), (val)) # define sk_SRP_user_pwd_delete(st, i) SKM_sk_delete(SRP_user_pwd, (st), (i)) # define sk_SRP_user_pwd_delete_ptr(st, ptr) SKM_sk_delete_ptr(SRP_user_pwd, (st), (ptr)) # define sk_SRP_user_pwd_insert(st, val, i) SKM_sk_insert(SRP_user_pwd, (st), (val), (i)) # define sk_SRP_user_pwd_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SRP_user_pwd, (st), (cmp)) # define sk_SRP_user_pwd_dup(st) SKM_sk_dup(SRP_user_pwd, st) # define sk_SRP_user_pwd_pop_free(st, free_func) SKM_sk_pop_free(SRP_user_pwd, (st), (free_func)) # define sk_SRP_user_pwd_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(SRP_user_pwd, (st), (copy_func), (free_func)) # define sk_SRP_user_pwd_shift(st) SKM_sk_shift(SRP_user_pwd, (st)) # define sk_SRP_user_pwd_pop(st) SKM_sk_pop(SRP_user_pwd, (st)) # define sk_SRP_user_pwd_sort(st) SKM_sk_sort(SRP_user_pwd, (st)) # define sk_SRP_user_pwd_is_sorted(st) SKM_sk_is_sorted(SRP_user_pwd, (st)) # define sk_SRTP_PROTECTION_PROFILE_new(cmp) SKM_sk_new(SRTP_PROTECTION_PROFILE, (cmp)) # define sk_SRTP_PROTECTION_PROFILE_new_null() SKM_sk_new_null(SRTP_PROTECTION_PROFILE) # define sk_SRTP_PROTECTION_PROFILE_free(st) SKM_sk_free(SRTP_PROTECTION_PROFILE, (st)) # define sk_SRTP_PROTECTION_PROFILE_num(st) SKM_sk_num(SRTP_PROTECTION_PROFILE, (st)) # define sk_SRTP_PROTECTION_PROFILE_value(st, i) SKM_sk_value(SRTP_PROTECTION_PROFILE, (st), (i)) # define sk_SRTP_PROTECTION_PROFILE_set(st, i, val) SKM_sk_set(SRTP_PROTECTION_PROFILE, (st), (i), (val)) # define sk_SRTP_PROTECTION_PROFILE_zero(st) SKM_sk_zero(SRTP_PROTECTION_PROFILE, (st)) # define sk_SRTP_PROTECTION_PROFILE_push(st, val) SKM_sk_push(SRTP_PROTECTION_PROFILE, (st), (val)) # define sk_SRTP_PROTECTION_PROFILE_unshift(st, val) SKM_sk_unshift(SRTP_PROTECTION_PROFILE, (st), (val)) # define sk_SRTP_PROTECTION_PROFILE_find(st, val) SKM_sk_find(SRTP_PROTECTION_PROFILE, (st), (val)) # define sk_SRTP_PROTECTION_PROFILE_find_ex(st, val) SKM_sk_find_ex(SRTP_PROTECTION_PROFILE, (st), (val)) # define sk_SRTP_PROTECTION_PROFILE_delete(st, i) SKM_sk_delete(SRTP_PROTECTION_PROFILE, (st), (i)) # define sk_SRTP_PROTECTION_PROFILE_delete_ptr(st, ptr) SKM_sk_delete_ptr(SRTP_PROTECTION_PROFILE, (st), (ptr)) # define sk_SRTP_PROTECTION_PROFILE_insert(st, val, i) SKM_sk_insert(SRTP_PROTECTION_PROFILE, (st), (val), (i)) # define sk_SRTP_PROTECTION_PROFILE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SRTP_PROTECTION_PROFILE, (st), (cmp)) # define sk_SRTP_PROTECTION_PROFILE_dup(st) SKM_sk_dup(SRTP_PROTECTION_PROFILE, st) # define sk_SRTP_PROTECTION_PROFILE_pop_free(st, free_func) SKM_sk_pop_free(SRTP_PROTECTION_PROFILE, (st), (free_func)) # define sk_SRTP_PROTECTION_PROFILE_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(SRTP_PROTECTION_PROFILE, (st), (copy_func), (free_func)) # define sk_SRTP_PROTECTION_PROFILE_shift(st) SKM_sk_shift(SRTP_PROTECTION_PROFILE, (st)) # define sk_SRTP_PROTECTION_PROFILE_pop(st) SKM_sk_pop(SRTP_PROTECTION_PROFILE, (st)) # define sk_SRTP_PROTECTION_PROFILE_sort(st) SKM_sk_sort(SRTP_PROTECTION_PROFILE, (st)) # define sk_SRTP_PROTECTION_PROFILE_is_sorted(st) SKM_sk_is_sorted(SRTP_PROTECTION_PROFILE, (st)) # define sk_SSL_CIPHER_new(cmp) SKM_sk_new(SSL_CIPHER, (cmp)) # define sk_SSL_CIPHER_new_null() SKM_sk_new_null(SSL_CIPHER) # define sk_SSL_CIPHER_free(st) SKM_sk_free(SSL_CIPHER, (st)) # define sk_SSL_CIPHER_num(st) SKM_sk_num(SSL_CIPHER, (st)) # define sk_SSL_CIPHER_value(st, i) SKM_sk_value(SSL_CIPHER, (st), (i)) # define sk_SSL_CIPHER_set(st, i, val) SKM_sk_set(SSL_CIPHER, (st), (i), (val)) # define sk_SSL_CIPHER_zero(st) SKM_sk_zero(SSL_CIPHER, (st)) # define sk_SSL_CIPHER_push(st, val) SKM_sk_push(SSL_CIPHER, (st), (val)) # define sk_SSL_CIPHER_unshift(st, val) SKM_sk_unshift(SSL_CIPHER, (st), (val)) # define sk_SSL_CIPHER_find(st, val) SKM_sk_find(SSL_CIPHER, (st), (val)) # define sk_SSL_CIPHER_find_ex(st, val) SKM_sk_find_ex(SSL_CIPHER, (st), (val)) # define sk_SSL_CIPHER_delete(st, i) SKM_sk_delete(SSL_CIPHER, (st), (i)) # define sk_SSL_CIPHER_delete_ptr(st, ptr) SKM_sk_delete_ptr(SSL_CIPHER, (st), (ptr)) # define sk_SSL_CIPHER_insert(st, val, i) SKM_sk_insert(SSL_CIPHER, (st), (val), (i)) # define sk_SSL_CIPHER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SSL_CIPHER, (st), (cmp)) # define sk_SSL_CIPHER_dup(st) SKM_sk_dup(SSL_CIPHER, st) # define sk_SSL_CIPHER_pop_free(st, free_func) SKM_sk_pop_free(SSL_CIPHER, (st), (free_func)) # define sk_SSL_CIPHER_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(SSL_CIPHER, (st), (copy_func), (free_func)) # define sk_SSL_CIPHER_shift(st) SKM_sk_shift(SSL_CIPHER, (st)) # define sk_SSL_CIPHER_pop(st) SKM_sk_pop(SSL_CIPHER, (st)) # define sk_SSL_CIPHER_sort(st) SKM_sk_sort(SSL_CIPHER, (st)) # define sk_SSL_CIPHER_is_sorted(st) SKM_sk_is_sorted(SSL_CIPHER, (st)) # define sk_SSL_COMP_new(cmp) SKM_sk_new(SSL_COMP, (cmp)) # define sk_SSL_COMP_new_null() SKM_sk_new_null(SSL_COMP) # define sk_SSL_COMP_free(st) SKM_sk_free(SSL_COMP, (st)) # define sk_SSL_COMP_num(st) SKM_sk_num(SSL_COMP, (st)) # define sk_SSL_COMP_value(st, i) SKM_sk_value(SSL_COMP, (st), (i)) # define sk_SSL_COMP_set(st, i, val) SKM_sk_set(SSL_COMP, (st), (i), (val)) # define sk_SSL_COMP_zero(st) SKM_sk_zero(SSL_COMP, (st)) # define sk_SSL_COMP_push(st, val) SKM_sk_push(SSL_COMP, (st), (val)) # define sk_SSL_COMP_unshift(st, val) SKM_sk_unshift(SSL_COMP, (st), (val)) # define sk_SSL_COMP_find(st, val) SKM_sk_find(SSL_COMP, (st), (val)) # define sk_SSL_COMP_find_ex(st, val) SKM_sk_find_ex(SSL_COMP, (st), (val)) # define sk_SSL_COMP_delete(st, i) SKM_sk_delete(SSL_COMP, (st), (i)) # define sk_SSL_COMP_delete_ptr(st, ptr) SKM_sk_delete_ptr(SSL_COMP, (st), (ptr)) # define sk_SSL_COMP_insert(st, val, i) SKM_sk_insert(SSL_COMP, (st), (val), (i)) # define sk_SSL_COMP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SSL_COMP, (st), (cmp)) # define sk_SSL_COMP_dup(st) SKM_sk_dup(SSL_COMP, st) # define sk_SSL_COMP_pop_free(st, free_func) SKM_sk_pop_free(SSL_COMP, (st), (free_func)) # define sk_SSL_COMP_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(SSL_COMP, (st), (copy_func), (free_func)) # define sk_SSL_COMP_shift(st) SKM_sk_shift(SSL_COMP, (st)) # define sk_SSL_COMP_pop(st) SKM_sk_pop(SSL_COMP, (st)) # define sk_SSL_COMP_sort(st) SKM_sk_sort(SSL_COMP, (st)) # define sk_SSL_COMP_is_sorted(st) SKM_sk_is_sorted(SSL_COMP, (st)) # define sk_STACK_OF_X509_NAME_ENTRY_new(cmp) SKM_sk_new(STACK_OF_X509_NAME_ENTRY, (cmp)) # define sk_STACK_OF_X509_NAME_ENTRY_new_null() SKM_sk_new_null(STACK_OF_X509_NAME_ENTRY) # define sk_STACK_OF_X509_NAME_ENTRY_free(st) SKM_sk_free(STACK_OF_X509_NAME_ENTRY, (st)) # define sk_STACK_OF_X509_NAME_ENTRY_num(st) SKM_sk_num(STACK_OF_X509_NAME_ENTRY, (st)) # define sk_STACK_OF_X509_NAME_ENTRY_value(st, i) SKM_sk_value(STACK_OF_X509_NAME_ENTRY, (st), (i)) # define sk_STACK_OF_X509_NAME_ENTRY_set(st, i, val) SKM_sk_set(STACK_OF_X509_NAME_ENTRY, (st), (i), (val)) # define sk_STACK_OF_X509_NAME_ENTRY_zero(st) SKM_sk_zero(STACK_OF_X509_NAME_ENTRY, (st)) # define sk_STACK_OF_X509_NAME_ENTRY_push(st, val) SKM_sk_push(STACK_OF_X509_NAME_ENTRY, (st), (val)) # define sk_STACK_OF_X509_NAME_ENTRY_unshift(st, val) SKM_sk_unshift(STACK_OF_X509_NAME_ENTRY, (st), (val)) # define sk_STACK_OF_X509_NAME_ENTRY_find(st, val) SKM_sk_find(STACK_OF_X509_NAME_ENTRY, (st), (val)) # define sk_STACK_OF_X509_NAME_ENTRY_find_ex(st, val) SKM_sk_find_ex(STACK_OF_X509_NAME_ENTRY, (st), (val)) # define sk_STACK_OF_X509_NAME_ENTRY_delete(st, i) SKM_sk_delete(STACK_OF_X509_NAME_ENTRY, (st), (i)) # define sk_STACK_OF_X509_NAME_ENTRY_delete_ptr(st, ptr) SKM_sk_delete_ptr(STACK_OF_X509_NAME_ENTRY, (st), (ptr)) # define sk_STACK_OF_X509_NAME_ENTRY_insert(st, val, i) SKM_sk_insert(STACK_OF_X509_NAME_ENTRY, (st), (val), (i)) # define sk_STACK_OF_X509_NAME_ENTRY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(STACK_OF_X509_NAME_ENTRY, (st), (cmp)) # define sk_STACK_OF_X509_NAME_ENTRY_dup(st) SKM_sk_dup(STACK_OF_X509_NAME_ENTRY, st) # define sk_STACK_OF_X509_NAME_ENTRY_pop_free(st, free_func) SKM_sk_pop_free(STACK_OF_X509_NAME_ENTRY, (st), (free_func)) # define sk_STACK_OF_X509_NAME_ENTRY_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(STACK_OF_X509_NAME_ENTRY, (st), (copy_func), (free_func)) # define sk_STACK_OF_X509_NAME_ENTRY_shift(st) SKM_sk_shift(STACK_OF_X509_NAME_ENTRY, (st)) # define sk_STACK_OF_X509_NAME_ENTRY_pop(st) SKM_sk_pop(STACK_OF_X509_NAME_ENTRY, (st)) # define sk_STACK_OF_X509_NAME_ENTRY_sort(st) SKM_sk_sort(STACK_OF_X509_NAME_ENTRY, (st)) # define sk_STACK_OF_X509_NAME_ENTRY_is_sorted(st) SKM_sk_is_sorted(STACK_OF_X509_NAME_ENTRY, (st)) # define sk_STORE_ATTR_INFO_new(cmp) SKM_sk_new(STORE_ATTR_INFO, (cmp)) # define sk_STORE_ATTR_INFO_new_null() SKM_sk_new_null(STORE_ATTR_INFO) # define sk_STORE_ATTR_INFO_free(st) SKM_sk_free(STORE_ATTR_INFO, (st)) # define sk_STORE_ATTR_INFO_num(st) SKM_sk_num(STORE_ATTR_INFO, (st)) # define sk_STORE_ATTR_INFO_value(st, i) SKM_sk_value(STORE_ATTR_INFO, (st), (i)) # define sk_STORE_ATTR_INFO_set(st, i, val) SKM_sk_set(STORE_ATTR_INFO, (st), (i), (val)) # define sk_STORE_ATTR_INFO_zero(st) SKM_sk_zero(STORE_ATTR_INFO, (st)) # define sk_STORE_ATTR_INFO_push(st, val) SKM_sk_push(STORE_ATTR_INFO, (st), (val)) # define sk_STORE_ATTR_INFO_unshift(st, val) SKM_sk_unshift(STORE_ATTR_INFO, (st), (val)) # define sk_STORE_ATTR_INFO_find(st, val) SKM_sk_find(STORE_ATTR_INFO, (st), (val)) # define sk_STORE_ATTR_INFO_find_ex(st, val) SKM_sk_find_ex(STORE_ATTR_INFO, (st), (val)) # define sk_STORE_ATTR_INFO_delete(st, i) SKM_sk_delete(STORE_ATTR_INFO, (st), (i)) # define sk_STORE_ATTR_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(STORE_ATTR_INFO, (st), (ptr)) # define sk_STORE_ATTR_INFO_insert(st, val, i) SKM_sk_insert(STORE_ATTR_INFO, (st), (val), (i)) # define sk_STORE_ATTR_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(STORE_ATTR_INFO, (st), (cmp)) # define sk_STORE_ATTR_INFO_dup(st) SKM_sk_dup(STORE_ATTR_INFO, st) # define sk_STORE_ATTR_INFO_pop_free(st, free_func) SKM_sk_pop_free(STORE_ATTR_INFO, (st), (free_func)) # define sk_STORE_ATTR_INFO_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(STORE_ATTR_INFO, (st), (copy_func), (free_func)) # define sk_STORE_ATTR_INFO_shift(st) SKM_sk_shift(STORE_ATTR_INFO, (st)) # define sk_STORE_ATTR_INFO_pop(st) SKM_sk_pop(STORE_ATTR_INFO, (st)) # define sk_STORE_ATTR_INFO_sort(st) SKM_sk_sort(STORE_ATTR_INFO, (st)) # define sk_STORE_ATTR_INFO_is_sorted(st) SKM_sk_is_sorted(STORE_ATTR_INFO, (st)) # define sk_STORE_OBJECT_new(cmp) SKM_sk_new(STORE_OBJECT, (cmp)) # define sk_STORE_OBJECT_new_null() SKM_sk_new_null(STORE_OBJECT) # define sk_STORE_OBJECT_free(st) SKM_sk_free(STORE_OBJECT, (st)) # define sk_STORE_OBJECT_num(st) SKM_sk_num(STORE_OBJECT, (st)) # define sk_STORE_OBJECT_value(st, i) SKM_sk_value(STORE_OBJECT, (st), (i)) # define sk_STORE_OBJECT_set(st, i, val) SKM_sk_set(STORE_OBJECT, (st), (i), (val)) # define sk_STORE_OBJECT_zero(st) SKM_sk_zero(STORE_OBJECT, (st)) # define sk_STORE_OBJECT_push(st, val) SKM_sk_push(STORE_OBJECT, (st), (val)) # define sk_STORE_OBJECT_unshift(st, val) SKM_sk_unshift(STORE_OBJECT, (st), (val)) # define sk_STORE_OBJECT_find(st, val) SKM_sk_find(STORE_OBJECT, (st), (val)) # define sk_STORE_OBJECT_find_ex(st, val) SKM_sk_find_ex(STORE_OBJECT, (st), (val)) # define sk_STORE_OBJECT_delete(st, i) SKM_sk_delete(STORE_OBJECT, (st), (i)) # define sk_STORE_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(STORE_OBJECT, (st), (ptr)) # define sk_STORE_OBJECT_insert(st, val, i) SKM_sk_insert(STORE_OBJECT, (st), (val), (i)) # define sk_STORE_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(STORE_OBJECT, (st), (cmp)) # define sk_STORE_OBJECT_dup(st) SKM_sk_dup(STORE_OBJECT, st) # define sk_STORE_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(STORE_OBJECT, (st), (free_func)) # define sk_STORE_OBJECT_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(STORE_OBJECT, (st), (copy_func), (free_func)) # define sk_STORE_OBJECT_shift(st) SKM_sk_shift(STORE_OBJECT, (st)) # define sk_STORE_OBJECT_pop(st) SKM_sk_pop(STORE_OBJECT, (st)) # define sk_STORE_OBJECT_sort(st) SKM_sk_sort(STORE_OBJECT, (st)) # define sk_STORE_OBJECT_is_sorted(st) SKM_sk_is_sorted(STORE_OBJECT, (st)) # define sk_SXNETID_new(cmp) SKM_sk_new(SXNETID, (cmp)) # define sk_SXNETID_new_null() SKM_sk_new_null(SXNETID) # define sk_SXNETID_free(st) SKM_sk_free(SXNETID, (st)) # define sk_SXNETID_num(st) SKM_sk_num(SXNETID, (st)) # define sk_SXNETID_value(st, i) SKM_sk_value(SXNETID, (st), (i)) # define sk_SXNETID_set(st, i, val) SKM_sk_set(SXNETID, (st), (i), (val)) # define sk_SXNETID_zero(st) SKM_sk_zero(SXNETID, (st)) # define sk_SXNETID_push(st, val) SKM_sk_push(SXNETID, (st), (val)) # define sk_SXNETID_unshift(st, val) SKM_sk_unshift(SXNETID, (st), (val)) # define sk_SXNETID_find(st, val) SKM_sk_find(SXNETID, (st), (val)) # define sk_SXNETID_find_ex(st, val) SKM_sk_find_ex(SXNETID, (st), (val)) # define sk_SXNETID_delete(st, i) SKM_sk_delete(SXNETID, (st), (i)) # define sk_SXNETID_delete_ptr(st, ptr) SKM_sk_delete_ptr(SXNETID, (st), (ptr)) # define sk_SXNETID_insert(st, val, i) SKM_sk_insert(SXNETID, (st), (val), (i)) # define sk_SXNETID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SXNETID, (st), (cmp)) # define sk_SXNETID_dup(st) SKM_sk_dup(SXNETID, st) # define sk_SXNETID_pop_free(st, free_func) SKM_sk_pop_free(SXNETID, (st), (free_func)) # define sk_SXNETID_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(SXNETID, (st), (copy_func), (free_func)) # define sk_SXNETID_shift(st) SKM_sk_shift(SXNETID, (st)) # define sk_SXNETID_pop(st) SKM_sk_pop(SXNETID, (st)) # define sk_SXNETID_sort(st) SKM_sk_sort(SXNETID, (st)) # define sk_SXNETID_is_sorted(st) SKM_sk_is_sorted(SXNETID, (st)) # define sk_UI_STRING_new(cmp) SKM_sk_new(UI_STRING, (cmp)) # define sk_UI_STRING_new_null() SKM_sk_new_null(UI_STRING) # define sk_UI_STRING_free(st) SKM_sk_free(UI_STRING, (st)) # define sk_UI_STRING_num(st) SKM_sk_num(UI_STRING, (st)) # define sk_UI_STRING_value(st, i) SKM_sk_value(UI_STRING, (st), (i)) # define sk_UI_STRING_set(st, i, val) SKM_sk_set(UI_STRING, (st), (i), (val)) # define sk_UI_STRING_zero(st) SKM_sk_zero(UI_STRING, (st)) # define sk_UI_STRING_push(st, val) SKM_sk_push(UI_STRING, (st), (val)) # define sk_UI_STRING_unshift(st, val) SKM_sk_unshift(UI_STRING, (st), (val)) # define sk_UI_STRING_find(st, val) SKM_sk_find(UI_STRING, (st), (val)) # define sk_UI_STRING_find_ex(st, val) SKM_sk_find_ex(UI_STRING, (st), (val)) # define sk_UI_STRING_delete(st, i) SKM_sk_delete(UI_STRING, (st), (i)) # define sk_UI_STRING_delete_ptr(st, ptr) SKM_sk_delete_ptr(UI_STRING, (st), (ptr)) # define sk_UI_STRING_insert(st, val, i) SKM_sk_insert(UI_STRING, (st), (val), (i)) # define sk_UI_STRING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(UI_STRING, (st), (cmp)) # define sk_UI_STRING_dup(st) SKM_sk_dup(UI_STRING, st) # define sk_UI_STRING_pop_free(st, free_func) SKM_sk_pop_free(UI_STRING, (st), (free_func)) # define sk_UI_STRING_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(UI_STRING, (st), (copy_func), (free_func)) # define sk_UI_STRING_shift(st) SKM_sk_shift(UI_STRING, (st)) # define sk_UI_STRING_pop(st) SKM_sk_pop(UI_STRING, (st)) # define sk_UI_STRING_sort(st) SKM_sk_sort(UI_STRING, (st)) # define sk_UI_STRING_is_sorted(st) SKM_sk_is_sorted(UI_STRING, (st)) # define sk_X509_new(cmp) SKM_sk_new(X509, (cmp)) # define sk_X509_new_null() SKM_sk_new_null(X509) # define sk_X509_free(st) SKM_sk_free(X509, (st)) # define sk_X509_num(st) SKM_sk_num(X509, (st)) # define sk_X509_value(st, i) SKM_sk_value(X509, (st), (i)) # define sk_X509_set(st, i, val) SKM_sk_set(X509, (st), (i), (val)) # define sk_X509_zero(st) SKM_sk_zero(X509, (st)) # define sk_X509_push(st, val) SKM_sk_push(X509, (st), (val)) # define sk_X509_unshift(st, val) SKM_sk_unshift(X509, (st), (val)) # define sk_X509_find(st, val) SKM_sk_find(X509, (st), (val)) # define sk_X509_find_ex(st, val) SKM_sk_find_ex(X509, (st), (val)) # define sk_X509_delete(st, i) SKM_sk_delete(X509, (st), (i)) # define sk_X509_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509, (st), (ptr)) # define sk_X509_insert(st, val, i) SKM_sk_insert(X509, (st), (val), (i)) # define sk_X509_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509, (st), (cmp)) # define sk_X509_dup(st) SKM_sk_dup(X509, st) # define sk_X509_pop_free(st, free_func) SKM_sk_pop_free(X509, (st), (free_func)) # define sk_X509_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(X509, (st), (copy_func), (free_func)) # define sk_X509_shift(st) SKM_sk_shift(X509, (st)) # define sk_X509_pop(st) SKM_sk_pop(X509, (st)) # define sk_X509_sort(st) SKM_sk_sort(X509, (st)) # define sk_X509_is_sorted(st) SKM_sk_is_sorted(X509, (st)) # define sk_X509V3_EXT_METHOD_new(cmp) SKM_sk_new(X509V3_EXT_METHOD, (cmp)) # define sk_X509V3_EXT_METHOD_new_null() SKM_sk_new_null(X509V3_EXT_METHOD) # define sk_X509V3_EXT_METHOD_free(st) SKM_sk_free(X509V3_EXT_METHOD, (st)) # define sk_X509V3_EXT_METHOD_num(st) SKM_sk_num(X509V3_EXT_METHOD, (st)) # define sk_X509V3_EXT_METHOD_value(st, i) SKM_sk_value(X509V3_EXT_METHOD, (st), (i)) # define sk_X509V3_EXT_METHOD_set(st, i, val) SKM_sk_set(X509V3_EXT_METHOD, (st), (i), (val)) # define sk_X509V3_EXT_METHOD_zero(st) SKM_sk_zero(X509V3_EXT_METHOD, (st)) # define sk_X509V3_EXT_METHOD_push(st, val) SKM_sk_push(X509V3_EXT_METHOD, (st), (val)) # define sk_X509V3_EXT_METHOD_unshift(st, val) SKM_sk_unshift(X509V3_EXT_METHOD, (st), (val)) # define sk_X509V3_EXT_METHOD_find(st, val) SKM_sk_find(X509V3_EXT_METHOD, (st), (val)) # define sk_X509V3_EXT_METHOD_find_ex(st, val) SKM_sk_find_ex(X509V3_EXT_METHOD, (st), (val)) # define sk_X509V3_EXT_METHOD_delete(st, i) SKM_sk_delete(X509V3_EXT_METHOD, (st), (i)) # define sk_X509V3_EXT_METHOD_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509V3_EXT_METHOD, (st), (ptr)) # define sk_X509V3_EXT_METHOD_insert(st, val, i) SKM_sk_insert(X509V3_EXT_METHOD, (st), (val), (i)) # define sk_X509V3_EXT_METHOD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509V3_EXT_METHOD, (st), (cmp)) # define sk_X509V3_EXT_METHOD_dup(st) SKM_sk_dup(X509V3_EXT_METHOD, st) # define sk_X509V3_EXT_METHOD_pop_free(st, free_func) SKM_sk_pop_free(X509V3_EXT_METHOD, (st), (free_func)) # define sk_X509V3_EXT_METHOD_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(X509V3_EXT_METHOD, (st), (copy_func), (free_func)) # define sk_X509V3_EXT_METHOD_shift(st) SKM_sk_shift(X509V3_EXT_METHOD, (st)) # define sk_X509V3_EXT_METHOD_pop(st) SKM_sk_pop(X509V3_EXT_METHOD, (st)) # define sk_X509V3_EXT_METHOD_sort(st) SKM_sk_sort(X509V3_EXT_METHOD, (st)) # define sk_X509V3_EXT_METHOD_is_sorted(st) SKM_sk_is_sorted(X509V3_EXT_METHOD, (st)) # define sk_X509_ALGOR_new(cmp) SKM_sk_new(X509_ALGOR, (cmp)) # define sk_X509_ALGOR_new_null() SKM_sk_new_null(X509_ALGOR) # define sk_X509_ALGOR_free(st) SKM_sk_free(X509_ALGOR, (st)) # define sk_X509_ALGOR_num(st) SKM_sk_num(X509_ALGOR, (st)) # define sk_X509_ALGOR_value(st, i) SKM_sk_value(X509_ALGOR, (st), (i)) # define sk_X509_ALGOR_set(st, i, val) SKM_sk_set(X509_ALGOR, (st), (i), (val)) # define sk_X509_ALGOR_zero(st) SKM_sk_zero(X509_ALGOR, (st)) # define sk_X509_ALGOR_push(st, val) SKM_sk_push(X509_ALGOR, (st), (val)) # define sk_X509_ALGOR_unshift(st, val) SKM_sk_unshift(X509_ALGOR, (st), (val)) # define sk_X509_ALGOR_find(st, val) SKM_sk_find(X509_ALGOR, (st), (val)) # define sk_X509_ALGOR_find_ex(st, val) SKM_sk_find_ex(X509_ALGOR, (st), (val)) # define sk_X509_ALGOR_delete(st, i) SKM_sk_delete(X509_ALGOR, (st), (i)) # define sk_X509_ALGOR_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_ALGOR, (st), (ptr)) # define sk_X509_ALGOR_insert(st, val, i) SKM_sk_insert(X509_ALGOR, (st), (val), (i)) # define sk_X509_ALGOR_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_ALGOR, (st), (cmp)) # define sk_X509_ALGOR_dup(st) SKM_sk_dup(X509_ALGOR, st) # define sk_X509_ALGOR_pop_free(st, free_func) SKM_sk_pop_free(X509_ALGOR, (st), (free_func)) # define sk_X509_ALGOR_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(X509_ALGOR, (st), (copy_func), (free_func)) # define sk_X509_ALGOR_shift(st) SKM_sk_shift(X509_ALGOR, (st)) # define sk_X509_ALGOR_pop(st) SKM_sk_pop(X509_ALGOR, (st)) # define sk_X509_ALGOR_sort(st) SKM_sk_sort(X509_ALGOR, (st)) # define sk_X509_ALGOR_is_sorted(st) SKM_sk_is_sorted(X509_ALGOR, (st)) # define sk_X509_ATTRIBUTE_new(cmp) SKM_sk_new(X509_ATTRIBUTE, (cmp)) # define sk_X509_ATTRIBUTE_new_null() SKM_sk_new_null(X509_ATTRIBUTE) # define sk_X509_ATTRIBUTE_free(st) SKM_sk_free(X509_ATTRIBUTE, (st)) # define sk_X509_ATTRIBUTE_num(st) SKM_sk_num(X509_ATTRIBUTE, (st)) # define sk_X509_ATTRIBUTE_value(st, i) SKM_sk_value(X509_ATTRIBUTE, (st), (i)) # define sk_X509_ATTRIBUTE_set(st, i, val) SKM_sk_set(X509_ATTRIBUTE, (st), (i), (val)) # define sk_X509_ATTRIBUTE_zero(st) SKM_sk_zero(X509_ATTRIBUTE, (st)) # define sk_X509_ATTRIBUTE_push(st, val) SKM_sk_push(X509_ATTRIBUTE, (st), (val)) # define sk_X509_ATTRIBUTE_unshift(st, val) SKM_sk_unshift(X509_ATTRIBUTE, (st), (val)) # define sk_X509_ATTRIBUTE_find(st, val) SKM_sk_find(X509_ATTRIBUTE, (st), (val)) # define sk_X509_ATTRIBUTE_find_ex(st, val) SKM_sk_find_ex(X509_ATTRIBUTE, (st), (val)) # define sk_X509_ATTRIBUTE_delete(st, i) SKM_sk_delete(X509_ATTRIBUTE, (st), (i)) # define sk_X509_ATTRIBUTE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_ATTRIBUTE, (st), (ptr)) # define sk_X509_ATTRIBUTE_insert(st, val, i) SKM_sk_insert(X509_ATTRIBUTE, (st), (val), (i)) # define sk_X509_ATTRIBUTE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_ATTRIBUTE, (st), (cmp)) # define sk_X509_ATTRIBUTE_dup(st) SKM_sk_dup(X509_ATTRIBUTE, st) # define sk_X509_ATTRIBUTE_pop_free(st, free_func) SKM_sk_pop_free(X509_ATTRIBUTE, (st), (free_func)) # define sk_X509_ATTRIBUTE_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(X509_ATTRIBUTE, (st), (copy_func), (free_func)) # define sk_X509_ATTRIBUTE_shift(st) SKM_sk_shift(X509_ATTRIBUTE, (st)) # define sk_X509_ATTRIBUTE_pop(st) SKM_sk_pop(X509_ATTRIBUTE, (st)) # define sk_X509_ATTRIBUTE_sort(st) SKM_sk_sort(X509_ATTRIBUTE, (st)) # define sk_X509_ATTRIBUTE_is_sorted(st) SKM_sk_is_sorted(X509_ATTRIBUTE, (st)) # define sk_X509_CRL_new(cmp) SKM_sk_new(X509_CRL, (cmp)) # define sk_X509_CRL_new_null() SKM_sk_new_null(X509_CRL) # define sk_X509_CRL_free(st) SKM_sk_free(X509_CRL, (st)) # define sk_X509_CRL_num(st) SKM_sk_num(X509_CRL, (st)) # define sk_X509_CRL_value(st, i) SKM_sk_value(X509_CRL, (st), (i)) # define sk_X509_CRL_set(st, i, val) SKM_sk_set(X509_CRL, (st), (i), (val)) # define sk_X509_CRL_zero(st) SKM_sk_zero(X509_CRL, (st)) # define sk_X509_CRL_push(st, val) SKM_sk_push(X509_CRL, (st), (val)) # define sk_X509_CRL_unshift(st, val) SKM_sk_unshift(X509_CRL, (st), (val)) # define sk_X509_CRL_find(st, val) SKM_sk_find(X509_CRL, (st), (val)) # define sk_X509_CRL_find_ex(st, val) SKM_sk_find_ex(X509_CRL, (st), (val)) # define sk_X509_CRL_delete(st, i) SKM_sk_delete(X509_CRL, (st), (i)) # define sk_X509_CRL_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_CRL, (st), (ptr)) # define sk_X509_CRL_insert(st, val, i) SKM_sk_insert(X509_CRL, (st), (val), (i)) # define sk_X509_CRL_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_CRL, (st), (cmp)) # define sk_X509_CRL_dup(st) SKM_sk_dup(X509_CRL, st) # define sk_X509_CRL_pop_free(st, free_func) SKM_sk_pop_free(X509_CRL, (st), (free_func)) # define sk_X509_CRL_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(X509_CRL, (st), (copy_func), (free_func)) # define sk_X509_CRL_shift(st) SKM_sk_shift(X509_CRL, (st)) # define sk_X509_CRL_pop(st) SKM_sk_pop(X509_CRL, (st)) # define sk_X509_CRL_sort(st) SKM_sk_sort(X509_CRL, (st)) # define sk_X509_CRL_is_sorted(st) SKM_sk_is_sorted(X509_CRL, (st)) # define sk_X509_EXTENSION_new(cmp) SKM_sk_new(X509_EXTENSION, (cmp)) # define sk_X509_EXTENSION_new_null() SKM_sk_new_null(X509_EXTENSION) # define sk_X509_EXTENSION_free(st) SKM_sk_free(X509_EXTENSION, (st)) # define sk_X509_EXTENSION_num(st) SKM_sk_num(X509_EXTENSION, (st)) # define sk_X509_EXTENSION_value(st, i) SKM_sk_value(X509_EXTENSION, (st), (i)) # define sk_X509_EXTENSION_set(st, i, val) SKM_sk_set(X509_EXTENSION, (st), (i), (val)) # define sk_X509_EXTENSION_zero(st) SKM_sk_zero(X509_EXTENSION, (st)) # define sk_X509_EXTENSION_push(st, val) SKM_sk_push(X509_EXTENSION, (st), (val)) # define sk_X509_EXTENSION_unshift(st, val) SKM_sk_unshift(X509_EXTENSION, (st), (val)) # define sk_X509_EXTENSION_find(st, val) SKM_sk_find(X509_EXTENSION, (st), (val)) # define sk_X509_EXTENSION_find_ex(st, val) SKM_sk_find_ex(X509_EXTENSION, (st), (val)) # define sk_X509_EXTENSION_delete(st, i) SKM_sk_delete(X509_EXTENSION, (st), (i)) # define sk_X509_EXTENSION_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_EXTENSION, (st), (ptr)) # define sk_X509_EXTENSION_insert(st, val, i) SKM_sk_insert(X509_EXTENSION, (st), (val), (i)) # define sk_X509_EXTENSION_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_EXTENSION, (st), (cmp)) # define sk_X509_EXTENSION_dup(st) SKM_sk_dup(X509_EXTENSION, st) # define sk_X509_EXTENSION_pop_free(st, free_func) SKM_sk_pop_free(X509_EXTENSION, (st), (free_func)) # define sk_X509_EXTENSION_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(X509_EXTENSION, (st), (copy_func), (free_func)) # define sk_X509_EXTENSION_shift(st) SKM_sk_shift(X509_EXTENSION, (st)) # define sk_X509_EXTENSION_pop(st) SKM_sk_pop(X509_EXTENSION, (st)) # define sk_X509_EXTENSION_sort(st) SKM_sk_sort(X509_EXTENSION, (st)) # define sk_X509_EXTENSION_is_sorted(st) SKM_sk_is_sorted(X509_EXTENSION, (st)) # define sk_X509_INFO_new(cmp) SKM_sk_new(X509_INFO, (cmp)) # define sk_X509_INFO_new_null() SKM_sk_new_null(X509_INFO) # define sk_X509_INFO_free(st) SKM_sk_free(X509_INFO, (st)) # define sk_X509_INFO_num(st) SKM_sk_num(X509_INFO, (st)) # define sk_X509_INFO_value(st, i) SKM_sk_value(X509_INFO, (st), (i)) # define sk_X509_INFO_set(st, i, val) SKM_sk_set(X509_INFO, (st), (i), (val)) # define sk_X509_INFO_zero(st) SKM_sk_zero(X509_INFO, (st)) # define sk_X509_INFO_push(st, val) SKM_sk_push(X509_INFO, (st), (val)) # define sk_X509_INFO_unshift(st, val) SKM_sk_unshift(X509_INFO, (st), (val)) # define sk_X509_INFO_find(st, val) SKM_sk_find(X509_INFO, (st), (val)) # define sk_X509_INFO_find_ex(st, val) SKM_sk_find_ex(X509_INFO, (st), (val)) # define sk_X509_INFO_delete(st, i) SKM_sk_delete(X509_INFO, (st), (i)) # define sk_X509_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_INFO, (st), (ptr)) # define sk_X509_INFO_insert(st, val, i) SKM_sk_insert(X509_INFO, (st), (val), (i)) # define sk_X509_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_INFO, (st), (cmp)) # define sk_X509_INFO_dup(st) SKM_sk_dup(X509_INFO, st) # define sk_X509_INFO_pop_free(st, free_func) SKM_sk_pop_free(X509_INFO, (st), (free_func)) # define sk_X509_INFO_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(X509_INFO, (st), (copy_func), (free_func)) # define sk_X509_INFO_shift(st) SKM_sk_shift(X509_INFO, (st)) # define sk_X509_INFO_pop(st) SKM_sk_pop(X509_INFO, (st)) # define sk_X509_INFO_sort(st) SKM_sk_sort(X509_INFO, (st)) # define sk_X509_INFO_is_sorted(st) SKM_sk_is_sorted(X509_INFO, (st)) # define sk_X509_LOOKUP_new(cmp) SKM_sk_new(X509_LOOKUP, (cmp)) # define sk_X509_LOOKUP_new_null() SKM_sk_new_null(X509_LOOKUP) # define sk_X509_LOOKUP_free(st) SKM_sk_free(X509_LOOKUP, (st)) # define sk_X509_LOOKUP_num(st) SKM_sk_num(X509_LOOKUP, (st)) # define sk_X509_LOOKUP_value(st, i) SKM_sk_value(X509_LOOKUP, (st), (i)) # define sk_X509_LOOKUP_set(st, i, val) SKM_sk_set(X509_LOOKUP, (st), (i), (val)) # define sk_X509_LOOKUP_zero(st) SKM_sk_zero(X509_LOOKUP, (st)) # define sk_X509_LOOKUP_push(st, val) SKM_sk_push(X509_LOOKUP, (st), (val)) # define sk_X509_LOOKUP_unshift(st, val) SKM_sk_unshift(X509_LOOKUP, (st), (val)) # define sk_X509_LOOKUP_find(st, val) SKM_sk_find(X509_LOOKUP, (st), (val)) # define sk_X509_LOOKUP_find_ex(st, val) SKM_sk_find_ex(X509_LOOKUP, (st), (val)) # define sk_X509_LOOKUP_delete(st, i) SKM_sk_delete(X509_LOOKUP, (st), (i)) # define sk_X509_LOOKUP_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_LOOKUP, (st), (ptr)) # define sk_X509_LOOKUP_insert(st, val, i) SKM_sk_insert(X509_LOOKUP, (st), (val), (i)) # define sk_X509_LOOKUP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_LOOKUP, (st), (cmp)) # define sk_X509_LOOKUP_dup(st) SKM_sk_dup(X509_LOOKUP, st) # define sk_X509_LOOKUP_pop_free(st, free_func) SKM_sk_pop_free(X509_LOOKUP, (st), (free_func)) # define sk_X509_LOOKUP_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(X509_LOOKUP, (st), (copy_func), (free_func)) # define sk_X509_LOOKUP_shift(st) SKM_sk_shift(X509_LOOKUP, (st)) # define sk_X509_LOOKUP_pop(st) SKM_sk_pop(X509_LOOKUP, (st)) # define sk_X509_LOOKUP_sort(st) SKM_sk_sort(X509_LOOKUP, (st)) # define sk_X509_LOOKUP_is_sorted(st) SKM_sk_is_sorted(X509_LOOKUP, (st)) # define sk_X509_NAME_new(cmp) SKM_sk_new(X509_NAME, (cmp)) # define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME) # define sk_X509_NAME_free(st) SKM_sk_free(X509_NAME, (st)) # define sk_X509_NAME_num(st) SKM_sk_num(X509_NAME, (st)) # define sk_X509_NAME_value(st, i) SKM_sk_value(X509_NAME, (st), (i)) # define sk_X509_NAME_set(st, i, val) SKM_sk_set(X509_NAME, (st), (i), (val)) # define sk_X509_NAME_zero(st) SKM_sk_zero(X509_NAME, (st)) # define sk_X509_NAME_push(st, val) SKM_sk_push(X509_NAME, (st), (val)) # define sk_X509_NAME_unshift(st, val) SKM_sk_unshift(X509_NAME, (st), (val)) # define sk_X509_NAME_find(st, val) SKM_sk_find(X509_NAME, (st), (val)) # define sk_X509_NAME_find_ex(st, val) SKM_sk_find_ex(X509_NAME, (st), (val)) # define sk_X509_NAME_delete(st, i) SKM_sk_delete(X509_NAME, (st), (i)) # define sk_X509_NAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_NAME, (st), (ptr)) # define sk_X509_NAME_insert(st, val, i) SKM_sk_insert(X509_NAME, (st), (val), (i)) # define sk_X509_NAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_NAME, (st), (cmp)) # define sk_X509_NAME_dup(st) SKM_sk_dup(X509_NAME, st) # define sk_X509_NAME_pop_free(st, free_func) SKM_sk_pop_free(X509_NAME, (st), (free_func)) # define sk_X509_NAME_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(X509_NAME, (st), (copy_func), (free_func)) # define sk_X509_NAME_shift(st) SKM_sk_shift(X509_NAME, (st)) # define sk_X509_NAME_pop(st) SKM_sk_pop(X509_NAME, (st)) # define sk_X509_NAME_sort(st) SKM_sk_sort(X509_NAME, (st)) # define sk_X509_NAME_is_sorted(st) SKM_sk_is_sorted(X509_NAME, (st)) # define sk_X509_NAME_ENTRY_new(cmp) SKM_sk_new(X509_NAME_ENTRY, (cmp)) # define sk_X509_NAME_ENTRY_new_null() SKM_sk_new_null(X509_NAME_ENTRY) # define sk_X509_NAME_ENTRY_free(st) SKM_sk_free(X509_NAME_ENTRY, (st)) # define sk_X509_NAME_ENTRY_num(st) SKM_sk_num(X509_NAME_ENTRY, (st)) # define sk_X509_NAME_ENTRY_value(st, i) SKM_sk_value(X509_NAME_ENTRY, (st), (i)) # define sk_X509_NAME_ENTRY_set(st, i, val) SKM_sk_set(X509_NAME_ENTRY, (st), (i), (val)) # define sk_X509_NAME_ENTRY_zero(st) SKM_sk_zero(X509_NAME_ENTRY, (st)) # define sk_X509_NAME_ENTRY_push(st, val) SKM_sk_push(X509_NAME_ENTRY, (st), (val)) # define sk_X509_NAME_ENTRY_unshift(st, val) SKM_sk_unshift(X509_NAME_ENTRY, (st), (val)) # define sk_X509_NAME_ENTRY_find(st, val) SKM_sk_find(X509_NAME_ENTRY, (st), (val)) # define sk_X509_NAME_ENTRY_find_ex(st, val) SKM_sk_find_ex(X509_NAME_ENTRY, (st), (val)) # define sk_X509_NAME_ENTRY_delete(st, i) SKM_sk_delete(X509_NAME_ENTRY, (st), (i)) # define sk_X509_NAME_ENTRY_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_NAME_ENTRY, (st), (ptr)) # define sk_X509_NAME_ENTRY_insert(st, val, i) SKM_sk_insert(X509_NAME_ENTRY, (st), (val), (i)) # define sk_X509_NAME_ENTRY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_NAME_ENTRY, (st), (cmp)) # define sk_X509_NAME_ENTRY_dup(st) SKM_sk_dup(X509_NAME_ENTRY, st) # define sk_X509_NAME_ENTRY_pop_free(st, free_func) SKM_sk_pop_free(X509_NAME_ENTRY, (st), (free_func)) # define sk_X509_NAME_ENTRY_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(X509_NAME_ENTRY, (st), (copy_func), (free_func)) # define sk_X509_NAME_ENTRY_shift(st) SKM_sk_shift(X509_NAME_ENTRY, (st)) # define sk_X509_NAME_ENTRY_pop(st) SKM_sk_pop(X509_NAME_ENTRY, (st)) # define sk_X509_NAME_ENTRY_sort(st) SKM_sk_sort(X509_NAME_ENTRY, (st)) # define sk_X509_NAME_ENTRY_is_sorted(st) SKM_sk_is_sorted(X509_NAME_ENTRY, (st)) # define sk_X509_OBJECT_new(cmp) SKM_sk_new(X509_OBJECT, (cmp)) # define sk_X509_OBJECT_new_null() SKM_sk_new_null(X509_OBJECT) # define sk_X509_OBJECT_free(st) SKM_sk_free(X509_OBJECT, (st)) # define sk_X509_OBJECT_num(st) SKM_sk_num(X509_OBJECT, (st)) # define sk_X509_OBJECT_value(st, i) SKM_sk_value(X509_OBJECT, (st), (i)) # define sk_X509_OBJECT_set(st, i, val) SKM_sk_set(X509_OBJECT, (st), (i), (val)) # define sk_X509_OBJECT_zero(st) SKM_sk_zero(X509_OBJECT, (st)) # define sk_X509_OBJECT_push(st, val) SKM_sk_push(X509_OBJECT, (st), (val)) # define sk_X509_OBJECT_unshift(st, val) SKM_sk_unshift(X509_OBJECT, (st), (val)) # define sk_X509_OBJECT_find(st, val) SKM_sk_find(X509_OBJECT, (st), (val)) # define sk_X509_OBJECT_find_ex(st, val) SKM_sk_find_ex(X509_OBJECT, (st), (val)) # define sk_X509_OBJECT_delete(st, i) SKM_sk_delete(X509_OBJECT, (st), (i)) # define sk_X509_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_OBJECT, (st), (ptr)) # define sk_X509_OBJECT_insert(st, val, i) SKM_sk_insert(X509_OBJECT, (st), (val), (i)) # define sk_X509_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_OBJECT, (st), (cmp)) # define sk_X509_OBJECT_dup(st) SKM_sk_dup(X509_OBJECT, st) # define sk_X509_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(X509_OBJECT, (st), (free_func)) # define sk_X509_OBJECT_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(X509_OBJECT, (st), (copy_func), (free_func)) # define sk_X509_OBJECT_shift(st) SKM_sk_shift(X509_OBJECT, (st)) # define sk_X509_OBJECT_pop(st) SKM_sk_pop(X509_OBJECT, (st)) # define sk_X509_OBJECT_sort(st) SKM_sk_sort(X509_OBJECT, (st)) # define sk_X509_OBJECT_is_sorted(st) SKM_sk_is_sorted(X509_OBJECT, (st)) # define sk_X509_POLICY_DATA_new(cmp) SKM_sk_new(X509_POLICY_DATA, (cmp)) # define sk_X509_POLICY_DATA_new_null() SKM_sk_new_null(X509_POLICY_DATA) # define sk_X509_POLICY_DATA_free(st) SKM_sk_free(X509_POLICY_DATA, (st)) # define sk_X509_POLICY_DATA_num(st) SKM_sk_num(X509_POLICY_DATA, (st)) # define sk_X509_POLICY_DATA_value(st, i) SKM_sk_value(X509_POLICY_DATA, (st), (i)) # define sk_X509_POLICY_DATA_set(st, i, val) SKM_sk_set(X509_POLICY_DATA, (st), (i), (val)) # define sk_X509_POLICY_DATA_zero(st) SKM_sk_zero(X509_POLICY_DATA, (st)) # define sk_X509_POLICY_DATA_push(st, val) SKM_sk_push(X509_POLICY_DATA, (st), (val)) # define sk_X509_POLICY_DATA_unshift(st, val) SKM_sk_unshift(X509_POLICY_DATA, (st), (val)) # define sk_X509_POLICY_DATA_find(st, val) SKM_sk_find(X509_POLICY_DATA, (st), (val)) # define sk_X509_POLICY_DATA_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_DATA, (st), (val)) # define sk_X509_POLICY_DATA_delete(st, i) SKM_sk_delete(X509_POLICY_DATA, (st), (i)) # define sk_X509_POLICY_DATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLICY_DATA, (st), (ptr)) # define sk_X509_POLICY_DATA_insert(st, val, i) SKM_sk_insert(X509_POLICY_DATA, (st), (val), (i)) # define sk_X509_POLICY_DATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_POLICY_DATA, (st), (cmp)) # define sk_X509_POLICY_DATA_dup(st) SKM_sk_dup(X509_POLICY_DATA, st) # define sk_X509_POLICY_DATA_pop_free(st, free_func) SKM_sk_pop_free(X509_POLICY_DATA, (st), (free_func)) # define sk_X509_POLICY_DATA_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(X509_POLICY_DATA, (st), (copy_func), (free_func)) # define sk_X509_POLICY_DATA_shift(st) SKM_sk_shift(X509_POLICY_DATA, (st)) # define sk_X509_POLICY_DATA_pop(st) SKM_sk_pop(X509_POLICY_DATA, (st)) # define sk_X509_POLICY_DATA_sort(st) SKM_sk_sort(X509_POLICY_DATA, (st)) # define sk_X509_POLICY_DATA_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_DATA, (st)) # define sk_X509_POLICY_NODE_new(cmp) SKM_sk_new(X509_POLICY_NODE, (cmp)) # define sk_X509_POLICY_NODE_new_null() SKM_sk_new_null(X509_POLICY_NODE) # define sk_X509_POLICY_NODE_free(st) SKM_sk_free(X509_POLICY_NODE, (st)) # define sk_X509_POLICY_NODE_num(st) SKM_sk_num(X509_POLICY_NODE, (st)) # define sk_X509_POLICY_NODE_value(st, i) SKM_sk_value(X509_POLICY_NODE, (st), (i)) # define sk_X509_POLICY_NODE_set(st, i, val) SKM_sk_set(X509_POLICY_NODE, (st), (i), (val)) # define sk_X509_POLICY_NODE_zero(st) SKM_sk_zero(X509_POLICY_NODE, (st)) # define sk_X509_POLICY_NODE_push(st, val) SKM_sk_push(X509_POLICY_NODE, (st), (val)) # define sk_X509_POLICY_NODE_unshift(st, val) SKM_sk_unshift(X509_POLICY_NODE, (st), (val)) # define sk_X509_POLICY_NODE_find(st, val) SKM_sk_find(X509_POLICY_NODE, (st), (val)) # define sk_X509_POLICY_NODE_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_NODE, (st), (val)) # define sk_X509_POLICY_NODE_delete(st, i) SKM_sk_delete(X509_POLICY_NODE, (st), (i)) # define sk_X509_POLICY_NODE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLICY_NODE, (st), (ptr)) # define sk_X509_POLICY_NODE_insert(st, val, i) SKM_sk_insert(X509_POLICY_NODE, (st), (val), (i)) # define sk_X509_POLICY_NODE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_POLICY_NODE, (st), (cmp)) # define sk_X509_POLICY_NODE_dup(st) SKM_sk_dup(X509_POLICY_NODE, st) # define sk_X509_POLICY_NODE_pop_free(st, free_func) SKM_sk_pop_free(X509_POLICY_NODE, (st), (free_func)) # define sk_X509_POLICY_NODE_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(X509_POLICY_NODE, (st), (copy_func), (free_func)) # define sk_X509_POLICY_NODE_shift(st) SKM_sk_shift(X509_POLICY_NODE, (st)) # define sk_X509_POLICY_NODE_pop(st) SKM_sk_pop(X509_POLICY_NODE, (st)) # define sk_X509_POLICY_NODE_sort(st) SKM_sk_sort(X509_POLICY_NODE, (st)) # define sk_X509_POLICY_NODE_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_NODE, (st)) # define sk_X509_PURPOSE_new(cmp) SKM_sk_new(X509_PURPOSE, (cmp)) # define sk_X509_PURPOSE_new_null() SKM_sk_new_null(X509_PURPOSE) # define sk_X509_PURPOSE_free(st) SKM_sk_free(X509_PURPOSE, (st)) # define sk_X509_PURPOSE_num(st) SKM_sk_num(X509_PURPOSE, (st)) # define sk_X509_PURPOSE_value(st, i) SKM_sk_value(X509_PURPOSE, (st), (i)) # define sk_X509_PURPOSE_set(st, i, val) SKM_sk_set(X509_PURPOSE, (st), (i), (val)) # define sk_X509_PURPOSE_zero(st) SKM_sk_zero(X509_PURPOSE, (st)) # define sk_X509_PURPOSE_push(st, val) SKM_sk_push(X509_PURPOSE, (st), (val)) # define sk_X509_PURPOSE_unshift(st, val) SKM_sk_unshift(X509_PURPOSE, (st), (val)) # define sk_X509_PURPOSE_find(st, val) SKM_sk_find(X509_PURPOSE, (st), (val)) # define sk_X509_PURPOSE_find_ex(st, val) SKM_sk_find_ex(X509_PURPOSE, (st), (val)) # define sk_X509_PURPOSE_delete(st, i) SKM_sk_delete(X509_PURPOSE, (st), (i)) # define sk_X509_PURPOSE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_PURPOSE, (st), (ptr)) # define sk_X509_PURPOSE_insert(st, val, i) SKM_sk_insert(X509_PURPOSE, (st), (val), (i)) # define sk_X509_PURPOSE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_PURPOSE, (st), (cmp)) # define sk_X509_PURPOSE_dup(st) SKM_sk_dup(X509_PURPOSE, st) # define sk_X509_PURPOSE_pop_free(st, free_func) SKM_sk_pop_free(X509_PURPOSE, (st), (free_func)) # define sk_X509_PURPOSE_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(X509_PURPOSE, (st), (copy_func), (free_func)) # define sk_X509_PURPOSE_shift(st) SKM_sk_shift(X509_PURPOSE, (st)) # define sk_X509_PURPOSE_pop(st) SKM_sk_pop(X509_PURPOSE, (st)) # define sk_X509_PURPOSE_sort(st) SKM_sk_sort(X509_PURPOSE, (st)) # define sk_X509_PURPOSE_is_sorted(st) SKM_sk_is_sorted(X509_PURPOSE, (st)) # define sk_X509_REVOKED_new(cmp) SKM_sk_new(X509_REVOKED, (cmp)) # define sk_X509_REVOKED_new_null() SKM_sk_new_null(X509_REVOKED) # define sk_X509_REVOKED_free(st) SKM_sk_free(X509_REVOKED, (st)) # define sk_X509_REVOKED_num(st) SKM_sk_num(X509_REVOKED, (st)) # define sk_X509_REVOKED_value(st, i) SKM_sk_value(X509_REVOKED, (st), (i)) # define sk_X509_REVOKED_set(st, i, val) SKM_sk_set(X509_REVOKED, (st), (i), (val)) # define sk_X509_REVOKED_zero(st) SKM_sk_zero(X509_REVOKED, (st)) # define sk_X509_REVOKED_push(st, val) SKM_sk_push(X509_REVOKED, (st), (val)) # define sk_X509_REVOKED_unshift(st, val) SKM_sk_unshift(X509_REVOKED, (st), (val)) # define sk_X509_REVOKED_find(st, val) SKM_sk_find(X509_REVOKED, (st), (val)) # define sk_X509_REVOKED_find_ex(st, val) SKM_sk_find_ex(X509_REVOKED, (st), (val)) # define sk_X509_REVOKED_delete(st, i) SKM_sk_delete(X509_REVOKED, (st), (i)) # define sk_X509_REVOKED_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_REVOKED, (st), (ptr)) # define sk_X509_REVOKED_insert(st, val, i) SKM_sk_insert(X509_REVOKED, (st), (val), (i)) # define sk_X509_REVOKED_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_REVOKED, (st), (cmp)) # define sk_X509_REVOKED_dup(st) SKM_sk_dup(X509_REVOKED, st) # define sk_X509_REVOKED_pop_free(st, free_func) SKM_sk_pop_free(X509_REVOKED, (st), (free_func)) # define sk_X509_REVOKED_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(X509_REVOKED, (st), (copy_func), (free_func)) # define sk_X509_REVOKED_shift(st) SKM_sk_shift(X509_REVOKED, (st)) # define sk_X509_REVOKED_pop(st) SKM_sk_pop(X509_REVOKED, (st)) # define sk_X509_REVOKED_sort(st) SKM_sk_sort(X509_REVOKED, (st)) # define sk_X509_REVOKED_is_sorted(st) SKM_sk_is_sorted(X509_REVOKED, (st)) # define sk_X509_TRUST_new(cmp) SKM_sk_new(X509_TRUST, (cmp)) # define sk_X509_TRUST_new_null() SKM_sk_new_null(X509_TRUST) # define sk_X509_TRUST_free(st) SKM_sk_free(X509_TRUST, (st)) # define sk_X509_TRUST_num(st) SKM_sk_num(X509_TRUST, (st)) # define sk_X509_TRUST_value(st, i) SKM_sk_value(X509_TRUST, (st), (i)) # define sk_X509_TRUST_set(st, i, val) SKM_sk_set(X509_TRUST, (st), (i), (val)) # define sk_X509_TRUST_zero(st) SKM_sk_zero(X509_TRUST, (st)) # define sk_X509_TRUST_push(st, val) SKM_sk_push(X509_TRUST, (st), (val)) # define sk_X509_TRUST_unshift(st, val) SKM_sk_unshift(X509_TRUST, (st), (val)) # define sk_X509_TRUST_find(st, val) SKM_sk_find(X509_TRUST, (st), (val)) # define sk_X509_TRUST_find_ex(st, val) SKM_sk_find_ex(X509_TRUST, (st), (val)) # define sk_X509_TRUST_delete(st, i) SKM_sk_delete(X509_TRUST, (st), (i)) # define sk_X509_TRUST_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_TRUST, (st), (ptr)) # define sk_X509_TRUST_insert(st, val, i) SKM_sk_insert(X509_TRUST, (st), (val), (i)) # define sk_X509_TRUST_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_TRUST, (st), (cmp)) # define sk_X509_TRUST_dup(st) SKM_sk_dup(X509_TRUST, st) # define sk_X509_TRUST_pop_free(st, free_func) SKM_sk_pop_free(X509_TRUST, (st), (free_func)) # define sk_X509_TRUST_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(X509_TRUST, (st), (copy_func), (free_func)) # define sk_X509_TRUST_shift(st) SKM_sk_shift(X509_TRUST, (st)) # define sk_X509_TRUST_pop(st) SKM_sk_pop(X509_TRUST, (st)) # define sk_X509_TRUST_sort(st) SKM_sk_sort(X509_TRUST, (st)) # define sk_X509_TRUST_is_sorted(st) SKM_sk_is_sorted(X509_TRUST, (st)) # define sk_X509_VERIFY_PARAM_new(cmp) SKM_sk_new(X509_VERIFY_PARAM, (cmp)) # define sk_X509_VERIFY_PARAM_new_null() SKM_sk_new_null(X509_VERIFY_PARAM) # define sk_X509_VERIFY_PARAM_free(st) SKM_sk_free(X509_VERIFY_PARAM, (st)) # define sk_X509_VERIFY_PARAM_num(st) SKM_sk_num(X509_VERIFY_PARAM, (st)) # define sk_X509_VERIFY_PARAM_value(st, i) SKM_sk_value(X509_VERIFY_PARAM, (st), (i)) # define sk_X509_VERIFY_PARAM_set(st, i, val) SKM_sk_set(X509_VERIFY_PARAM, (st), (i), (val)) # define sk_X509_VERIFY_PARAM_zero(st) SKM_sk_zero(X509_VERIFY_PARAM, (st)) # define sk_X509_VERIFY_PARAM_push(st, val) SKM_sk_push(X509_VERIFY_PARAM, (st), (val)) # define sk_X509_VERIFY_PARAM_unshift(st, val) SKM_sk_unshift(X509_VERIFY_PARAM, (st), (val)) # define sk_X509_VERIFY_PARAM_find(st, val) SKM_sk_find(X509_VERIFY_PARAM, (st), (val)) # define sk_X509_VERIFY_PARAM_find_ex(st, val) SKM_sk_find_ex(X509_VERIFY_PARAM, (st), (val)) # define sk_X509_VERIFY_PARAM_delete(st, i) SKM_sk_delete(X509_VERIFY_PARAM, (st), (i)) # define sk_X509_VERIFY_PARAM_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_VERIFY_PARAM, (st), (ptr)) # define sk_X509_VERIFY_PARAM_insert(st, val, i) SKM_sk_insert(X509_VERIFY_PARAM, (st), (val), (i)) # define sk_X509_VERIFY_PARAM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_VERIFY_PARAM, (st), (cmp)) # define sk_X509_VERIFY_PARAM_dup(st) SKM_sk_dup(X509_VERIFY_PARAM, st) # define sk_X509_VERIFY_PARAM_pop_free(st, free_func) SKM_sk_pop_free(X509_VERIFY_PARAM, (st), (free_func)) # define sk_X509_VERIFY_PARAM_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(X509_VERIFY_PARAM, (st), (copy_func), (free_func)) # define sk_X509_VERIFY_PARAM_shift(st) SKM_sk_shift(X509_VERIFY_PARAM, (st)) # define sk_X509_VERIFY_PARAM_pop(st) SKM_sk_pop(X509_VERIFY_PARAM, (st)) # define sk_X509_VERIFY_PARAM_sort(st) SKM_sk_sort(X509_VERIFY_PARAM, (st)) # define sk_X509_VERIFY_PARAM_is_sorted(st) SKM_sk_is_sorted(X509_VERIFY_PARAM, (st)) # define sk_nid_triple_new(cmp) SKM_sk_new(nid_triple, (cmp)) # define sk_nid_triple_new_null() SKM_sk_new_null(nid_triple) # define sk_nid_triple_free(st) SKM_sk_free(nid_triple, (st)) # define sk_nid_triple_num(st) SKM_sk_num(nid_triple, (st)) # define sk_nid_triple_value(st, i) SKM_sk_value(nid_triple, (st), (i)) # define sk_nid_triple_set(st, i, val) SKM_sk_set(nid_triple, (st), (i), (val)) # define sk_nid_triple_zero(st) SKM_sk_zero(nid_triple, (st)) # define sk_nid_triple_push(st, val) SKM_sk_push(nid_triple, (st), (val)) # define sk_nid_triple_unshift(st, val) SKM_sk_unshift(nid_triple, (st), (val)) # define sk_nid_triple_find(st, val) SKM_sk_find(nid_triple, (st), (val)) # define sk_nid_triple_find_ex(st, val) SKM_sk_find_ex(nid_triple, (st), (val)) # define sk_nid_triple_delete(st, i) SKM_sk_delete(nid_triple, (st), (i)) # define sk_nid_triple_delete_ptr(st, ptr) SKM_sk_delete_ptr(nid_triple, (st), (ptr)) # define sk_nid_triple_insert(st, val, i) SKM_sk_insert(nid_triple, (st), (val), (i)) # define sk_nid_triple_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(nid_triple, (st), (cmp)) # define sk_nid_triple_dup(st) SKM_sk_dup(nid_triple, st) # define sk_nid_triple_pop_free(st, free_func) SKM_sk_pop_free(nid_triple, (st), (free_func)) # define sk_nid_triple_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(nid_triple, (st), (copy_func), (free_func)) # define sk_nid_triple_shift(st) SKM_sk_shift(nid_triple, (st)) # define sk_nid_triple_pop(st) SKM_sk_pop(nid_triple, (st)) # define sk_nid_triple_sort(st) SKM_sk_sort(nid_triple, (st)) # define sk_nid_triple_is_sorted(st) SKM_sk_is_sorted(nid_triple, (st)) # define sk_void_new(cmp) SKM_sk_new(void, (cmp)) # define sk_void_new_null() SKM_sk_new_null(void) # define sk_void_free(st) SKM_sk_free(void, (st)) # define sk_void_num(st) SKM_sk_num(void, (st)) # define sk_void_value(st, i) SKM_sk_value(void, (st), (i)) # define sk_void_set(st, i, val) SKM_sk_set(void, (st), (i), (val)) # define sk_void_zero(st) SKM_sk_zero(void, (st)) # define sk_void_push(st, val) SKM_sk_push(void, (st), (val)) # define sk_void_unshift(st, val) SKM_sk_unshift(void, (st), (val)) # define sk_void_find(st, val) SKM_sk_find(void, (st), (val)) # define sk_void_find_ex(st, val) SKM_sk_find_ex(void, (st), (val)) # define sk_void_delete(st, i) SKM_sk_delete(void, (st), (i)) # define sk_void_delete_ptr(st, ptr) SKM_sk_delete_ptr(void, (st), (ptr)) # define sk_void_insert(st, val, i) SKM_sk_insert(void, (st), (val), (i)) # define sk_void_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(void, (st), (cmp)) # define sk_void_dup(st) SKM_sk_dup(void, st) # define sk_void_pop_free(st, free_func) SKM_sk_pop_free(void, (st), (free_func)) # define sk_void_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(void, (st), (copy_func), (free_func)) # define sk_void_shift(st) SKM_sk_shift(void, (st)) # define sk_void_pop(st) SKM_sk_pop(void, (st)) # define sk_void_sort(st) SKM_sk_sort(void, (st)) # define sk_void_is_sorted(st) SKM_sk_is_sorted(void, (st)) # define sk_OPENSSL_STRING_new(cmp) ((STACK_OF(OPENSSL_STRING) *)sk_new(CHECKED_SK_CMP_FUNC(char, cmp))) # define sk_OPENSSL_STRING_new_null() ((STACK_OF(OPENSSL_STRING) *)sk_new_null()) # define sk_OPENSSL_STRING_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val)) # define sk_OPENSSL_STRING_find(st, val) sk_find(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val)) # define sk_OPENSSL_STRING_value(st, i) ((OPENSSL_STRING)sk_value(CHECKED_STACK_OF(OPENSSL_STRING, st), i)) # define sk_OPENSSL_STRING_num(st) SKM_sk_num(OPENSSL_STRING, st) # define sk_OPENSSL_STRING_pop_free(st, free_func) sk_pop_free(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_SK_FREE_FUNC(char, free_func)) # define sk_OPENSSL_STRING_deep_copy(st, copy_func, free_func) ((STACK_OF(OPENSSL_STRING) *)sk_deep_copy(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_SK_COPY_FUNC(char, copy_func), CHECKED_SK_FREE_FUNC(char, free_func))) # define sk_OPENSSL_STRING_insert(st, val, i) sk_insert(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val), i) # define sk_OPENSSL_STRING_free(st) SKM_sk_free(OPENSSL_STRING, st) # define sk_OPENSSL_STRING_set(st, i, val) sk_set(CHECKED_STACK_OF(OPENSSL_STRING, st), i, CHECKED_PTR_OF(char, val)) # define sk_OPENSSL_STRING_zero(st) SKM_sk_zero(OPENSSL_STRING, (st)) # define sk_OPENSSL_STRING_unshift(st, val) sk_unshift(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val)) # define sk_OPENSSL_STRING_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_CONST_PTR_OF(char, val)) # define sk_OPENSSL_STRING_delete(st, i) SKM_sk_delete(OPENSSL_STRING, (st), (i)) # define sk_OPENSSL_STRING_delete_ptr(st, ptr) (OPENSSL_STRING *)sk_delete_ptr(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, ptr)) # define sk_OPENSSL_STRING_set_cmp_func(st, cmp) \ ((int (*)(const char * const *,const char * const *)) \ sk_set_cmp_func(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_SK_CMP_FUNC(char, cmp))) # define sk_OPENSSL_STRING_dup(st) SKM_sk_dup(OPENSSL_STRING, st) # define sk_OPENSSL_STRING_shift(st) SKM_sk_shift(OPENSSL_STRING, (st)) # define sk_OPENSSL_STRING_pop(st) (char *)sk_pop(CHECKED_STACK_OF(OPENSSL_STRING, st)) # define sk_OPENSSL_STRING_sort(st) SKM_sk_sort(OPENSSL_STRING, (st)) # define sk_OPENSSL_STRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_STRING, (st)) # define sk_OPENSSL_BLOCK_new(cmp) ((STACK_OF(OPENSSL_BLOCK) *)sk_new(CHECKED_SK_CMP_FUNC(void, cmp))) # define sk_OPENSSL_BLOCK_new_null() ((STACK_OF(OPENSSL_BLOCK) *)sk_new_null()) # define sk_OPENSSL_BLOCK_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val)) # define sk_OPENSSL_BLOCK_find(st, val) sk_find(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val)) # define sk_OPENSSL_BLOCK_value(st, i) ((OPENSSL_BLOCK)sk_value(CHECKED_STACK_OF(OPENSSL_BLOCK, st), i)) # define sk_OPENSSL_BLOCK_num(st) SKM_sk_num(OPENSSL_BLOCK, st) # define sk_OPENSSL_BLOCK_pop_free(st, free_func) sk_pop_free(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_SK_FREE_FUNC(void, free_func)) # define sk_OPENSSL_BLOCK_deep_copy(st, copy_func, free_func) ((STACK_OF(OPENSSL_BLOCK) *)sk_deep_copy(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_SK_COPY_FUNC(void, copy_func), CHECKED_SK_FREE_FUNC(void, free_func))) # define sk_OPENSSL_BLOCK_insert(st, val, i) sk_insert(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val), i) # define sk_OPENSSL_BLOCK_free(st) SKM_sk_free(OPENSSL_BLOCK, st) # define sk_OPENSSL_BLOCK_set(st, i, val) sk_set(CHECKED_STACK_OF(OPENSSL_BLOCK, st), i, CHECKED_PTR_OF(void, val)) # define sk_OPENSSL_BLOCK_zero(st) SKM_sk_zero(OPENSSL_BLOCK, (st)) # define sk_OPENSSL_BLOCK_unshift(st, val) sk_unshift(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val)) # define sk_OPENSSL_BLOCK_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_CONST_PTR_OF(void, val)) # define sk_OPENSSL_BLOCK_delete(st, i) SKM_sk_delete(OPENSSL_BLOCK, (st), (i)) # define sk_OPENSSL_BLOCK_delete_ptr(st, ptr) (OPENSSL_BLOCK *)sk_delete_ptr(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, ptr)) # define sk_OPENSSL_BLOCK_set_cmp_func(st, cmp) \ ((int (*)(const void * const *,const void * const *)) \ sk_set_cmp_func(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_SK_CMP_FUNC(void, cmp))) # define sk_OPENSSL_BLOCK_dup(st) SKM_sk_dup(OPENSSL_BLOCK, st) # define sk_OPENSSL_BLOCK_shift(st) SKM_sk_shift(OPENSSL_BLOCK, (st)) # define sk_OPENSSL_BLOCK_pop(st) (void *)sk_pop(CHECKED_STACK_OF(OPENSSL_BLOCK, st)) # define sk_OPENSSL_BLOCK_sort(st) SKM_sk_sort(OPENSSL_BLOCK, (st)) # define sk_OPENSSL_BLOCK_is_sorted(st) SKM_sk_is_sorted(OPENSSL_BLOCK, (st)) # define sk_OPENSSL_PSTRING_new(cmp) ((STACK_OF(OPENSSL_PSTRING) *)sk_new(CHECKED_SK_CMP_FUNC(OPENSSL_STRING, cmp))) # define sk_OPENSSL_PSTRING_new_null() ((STACK_OF(OPENSSL_PSTRING) *)sk_new_null()) # define sk_OPENSSL_PSTRING_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val)) # define sk_OPENSSL_PSTRING_find(st, val) sk_find(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val)) # define sk_OPENSSL_PSTRING_value(st, i) ((OPENSSL_PSTRING)sk_value(CHECKED_STACK_OF(OPENSSL_PSTRING, st), i)) # define sk_OPENSSL_PSTRING_num(st) SKM_sk_num(OPENSSL_PSTRING, st) # define sk_OPENSSL_PSTRING_pop_free(st, free_func) sk_pop_free(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_SK_FREE_FUNC(OPENSSL_STRING, free_func)) # define sk_OPENSSL_PSTRING_deep_copy(st, copy_func, free_func) ((STACK_OF(OPENSSL_PSTRING) *)sk_deep_copy(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_SK_COPY_FUNC(OPENSSL_STRING, copy_func), CHECKED_SK_FREE_FUNC(OPENSSL_STRING, free_func))) # define sk_OPENSSL_PSTRING_insert(st, val, i) sk_insert(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val), i) # define sk_OPENSSL_PSTRING_free(st) SKM_sk_free(OPENSSL_PSTRING, st) # define sk_OPENSSL_PSTRING_set(st, i, val) sk_set(CHECKED_STACK_OF(OPENSSL_PSTRING, st), i, CHECKED_PTR_OF(OPENSSL_STRING, val)) # define sk_OPENSSL_PSTRING_zero(st) SKM_sk_zero(OPENSSL_PSTRING, (st)) # define sk_OPENSSL_PSTRING_unshift(st, val) sk_unshift(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val)) # define sk_OPENSSL_PSTRING_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_CONST_PTR_OF(OPENSSL_STRING, val)) # define sk_OPENSSL_PSTRING_delete(st, i) SKM_sk_delete(OPENSSL_PSTRING, (st), (i)) # define sk_OPENSSL_PSTRING_delete_ptr(st, ptr) (OPENSSL_PSTRING *)sk_delete_ptr(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, ptr)) # define sk_OPENSSL_PSTRING_set_cmp_func(st, cmp) \ ((int (*)(const OPENSSL_STRING * const *,const OPENSSL_STRING * const *)) \ sk_set_cmp_func(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_SK_CMP_FUNC(OPENSSL_STRING, cmp))) # define sk_OPENSSL_PSTRING_dup(st) SKM_sk_dup(OPENSSL_PSTRING, st) # define sk_OPENSSL_PSTRING_shift(st) SKM_sk_shift(OPENSSL_PSTRING, (st)) # define sk_OPENSSL_PSTRING_pop(st) (OPENSSL_STRING *)sk_pop(CHECKED_STACK_OF(OPENSSL_PSTRING, st)) # define sk_OPENSSL_PSTRING_sort(st) SKM_sk_sort(OPENSSL_PSTRING, (st)) # define sk_OPENSSL_PSTRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_PSTRING, (st)) # define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(ACCESS_DESCRIPTION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(ACCESS_DESCRIPTION, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_ACCESS_DESCRIPTION(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(ACCESS_DESCRIPTION, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_ACCESS_DESCRIPTION(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(ACCESS_DESCRIPTION, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_ASN1_INTEGER(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(ASN1_INTEGER, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_ASN1_INTEGER(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(ASN1_INTEGER, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_ASN1_INTEGER(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(ASN1_INTEGER, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_ASN1_INTEGER(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(ASN1_INTEGER, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_ASN1_OBJECT(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(ASN1_OBJECT, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_ASN1_OBJECT(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(ASN1_OBJECT, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_ASN1_OBJECT(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(ASN1_OBJECT, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_ASN1_OBJECT(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(ASN1_OBJECT, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_ASN1_TYPE(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(ASN1_TYPE, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_ASN1_TYPE(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(ASN1_TYPE, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_ASN1_TYPE(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(ASN1_TYPE, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_ASN1_TYPE(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(ASN1_TYPE, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_ASN1_UTF8STRING(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(ASN1_UTF8STRING, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_ASN1_UTF8STRING(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(ASN1_UTF8STRING, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_ASN1_UTF8STRING(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(ASN1_UTF8STRING, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_ASN1_UTF8STRING(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(ASN1_UTF8STRING, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_DIST_POINT(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(DIST_POINT, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_DIST_POINT(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(DIST_POINT, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_DIST_POINT(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(DIST_POINT, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_DIST_POINT(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(DIST_POINT, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_ESS_CERT_ID(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(ESS_CERT_ID, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_ESS_CERT_ID(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(ESS_CERT_ID, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_ESS_CERT_ID(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(ESS_CERT_ID, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_ESS_CERT_ID(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(ESS_CERT_ID, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_EVP_MD(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(EVP_MD, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_EVP_MD(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(EVP_MD, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_EVP_MD(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(EVP_MD, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_EVP_MD(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(EVP_MD, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_GENERAL_NAME(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(GENERAL_NAME, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_GENERAL_NAME(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(GENERAL_NAME, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_GENERAL_NAME(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(GENERAL_NAME, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_GENERAL_NAME(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(GENERAL_NAME, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_OCSP_ONEREQ(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(OCSP_ONEREQ, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_OCSP_ONEREQ(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(OCSP_ONEREQ, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_OCSP_ONEREQ(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(OCSP_ONEREQ, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_OCSP_ONEREQ(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(OCSP_ONEREQ, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_OCSP_SINGLERESP(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(OCSP_SINGLERESP, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_OCSP_SINGLERESP(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(OCSP_SINGLERESP, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_OCSP_SINGLERESP(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(OCSP_SINGLERESP, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_OCSP_SINGLERESP(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(OCSP_SINGLERESP, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_PKCS12_SAFEBAG(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(PKCS12_SAFEBAG, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_PKCS12_SAFEBAG(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(PKCS12_SAFEBAG, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_PKCS12_SAFEBAG(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(PKCS12_SAFEBAG, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_PKCS12_SAFEBAG(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(PKCS12_SAFEBAG, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_PKCS7(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(PKCS7, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_PKCS7(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(PKCS7, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_PKCS7(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(PKCS7, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_PKCS7(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(PKCS7, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(PKCS7_RECIP_INFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(PKCS7_RECIP_INFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_PKCS7_RECIP_INFO(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(PKCS7_RECIP_INFO, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_PKCS7_RECIP_INFO(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(PKCS7_RECIP_INFO, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(PKCS7_SIGNER_INFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(PKCS7_SIGNER_INFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_PKCS7_SIGNER_INFO(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(PKCS7_SIGNER_INFO, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_PKCS7_SIGNER_INFO(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(PKCS7_SIGNER_INFO, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_POLICYINFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(POLICYINFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_POLICYINFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(POLICYINFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_POLICYINFO(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(POLICYINFO, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_POLICYINFO(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(POLICYINFO, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_POLICYQUALINFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(POLICYQUALINFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_POLICYQUALINFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(POLICYQUALINFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_POLICYQUALINFO(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(POLICYQUALINFO, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_POLICYQUALINFO(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(POLICYQUALINFO, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_SXNETID(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(SXNETID, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_SXNETID(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(SXNETID, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_SXNETID(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(SXNETID, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_SXNETID(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(SXNETID, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_X509(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(X509, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_X509(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(X509, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_X509(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(X509, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_X509(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(X509, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_X509_ALGOR(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(X509_ALGOR, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_X509_ALGOR(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(X509_ALGOR, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_X509_ALGOR(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(X509_ALGOR, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_X509_ALGOR(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(X509_ALGOR, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_X509_ATTRIBUTE(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(X509_ATTRIBUTE, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_X509_ATTRIBUTE(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(X509_ATTRIBUTE, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_X509_ATTRIBUTE(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(X509_ATTRIBUTE, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_X509_ATTRIBUTE(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(X509_ATTRIBUTE, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_X509_CRL(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(X509_CRL, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_X509_CRL(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(X509_CRL, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_X509_CRL(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(X509_CRL, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_X509_CRL(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(X509_CRL, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_X509_EXTENSION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(X509_EXTENSION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_X509_EXTENSION(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(X509_EXTENSION, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_X509_EXTENSION(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(X509_EXTENSION, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_X509_EXTENSION(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(X509_EXTENSION, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_X509_NAME_ENTRY(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(X509_NAME_ENTRY, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_X509_NAME_ENTRY(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(X509_NAME_ENTRY, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_X509_NAME_ENTRY(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(X509_NAME_ENTRY, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_X509_NAME_ENTRY(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(X509_NAME_ENTRY, (buf), (len), (d2i_func), (free_func)) # define d2i_ASN1_SET_OF_X509_REVOKED(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ SKM_ASN1_SET_OF_d2i(X509_REVOKED, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) # define i2d_ASN1_SET_OF_X509_REVOKED(st, pp, i2d_func, ex_tag, ex_class, is_set) \ SKM_ASN1_SET_OF_i2d(X509_REVOKED, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) # define ASN1_seq_pack_X509_REVOKED(st, i2d_func, buf, len) \ SKM_ASN1_seq_pack(X509_REVOKED, (st), (i2d_func), (buf), (len)) # define ASN1_seq_unpack_X509_REVOKED(buf, len, d2i_func, free_func) \ SKM_ASN1_seq_unpack(X509_REVOKED, (buf), (len), (d2i_func), (free_func)) # define PKCS12_decrypt_d2i_PKCS12_SAFEBAG(algor, d2i_func, free_func, pass, passlen, oct, seq) \ SKM_PKCS12_decrypt_d2i(PKCS12_SAFEBAG, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq)) # define PKCS12_decrypt_d2i_PKCS7(algor, d2i_func, free_func, pass, passlen, oct, seq) \ SKM_PKCS12_decrypt_d2i(PKCS7, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq)) # define lh_ADDED_OBJ_new() LHM_lh_new(ADDED_OBJ,added_obj) # define lh_ADDED_OBJ_insert(lh,inst) LHM_lh_insert(ADDED_OBJ,lh,inst) # define lh_ADDED_OBJ_retrieve(lh,inst) LHM_lh_retrieve(ADDED_OBJ,lh,inst) # define lh_ADDED_OBJ_delete(lh,inst) LHM_lh_delete(ADDED_OBJ,lh,inst) # define lh_ADDED_OBJ_doall(lh,fn) LHM_lh_doall(ADDED_OBJ,lh,fn) # define lh_ADDED_OBJ_doall_arg(lh,fn,arg_type,arg) \ LHM_lh_doall_arg(ADDED_OBJ,lh,fn,arg_type,arg) # define lh_ADDED_OBJ_error(lh) LHM_lh_error(ADDED_OBJ,lh) # define lh_ADDED_OBJ_num_items(lh) LHM_lh_num_items(ADDED_OBJ,lh) # define lh_ADDED_OBJ_down_load(lh) LHM_lh_down_load(ADDED_OBJ,lh) # define lh_ADDED_OBJ_node_stats_bio(lh,out) \ LHM_lh_node_stats_bio(ADDED_OBJ,lh,out) # define lh_ADDED_OBJ_node_usage_stats_bio(lh,out) \ LHM_lh_node_usage_stats_bio(ADDED_OBJ,lh,out) # define lh_ADDED_OBJ_stats_bio(lh,out) \ LHM_lh_stats_bio(ADDED_OBJ,lh,out) # define lh_ADDED_OBJ_free(lh) LHM_lh_free(ADDED_OBJ,lh) # define lh_APP_INFO_new() LHM_lh_new(APP_INFO,app_info) # define lh_APP_INFO_insert(lh,inst) LHM_lh_insert(APP_INFO,lh,inst) # define lh_APP_INFO_retrieve(lh,inst) LHM_lh_retrieve(APP_INFO,lh,inst) # define lh_APP_INFO_delete(lh,inst) LHM_lh_delete(APP_INFO,lh,inst) # define lh_APP_INFO_doall(lh,fn) LHM_lh_doall(APP_INFO,lh,fn) # define lh_APP_INFO_doall_arg(lh,fn,arg_type,arg) \ LHM_lh_doall_arg(APP_INFO,lh,fn,arg_type,arg) # define lh_APP_INFO_error(lh) LHM_lh_error(APP_INFO,lh) # define lh_APP_INFO_num_items(lh) LHM_lh_num_items(APP_INFO,lh) # define lh_APP_INFO_down_load(lh) LHM_lh_down_load(APP_INFO,lh) # define lh_APP_INFO_node_stats_bio(lh,out) \ LHM_lh_node_stats_bio(APP_INFO,lh,out) # define lh_APP_INFO_node_usage_stats_bio(lh,out) \ LHM_lh_node_usage_stats_bio(APP_INFO,lh,out) # define lh_APP_INFO_stats_bio(lh,out) \ LHM_lh_stats_bio(APP_INFO,lh,out) # define lh_APP_INFO_free(lh) LHM_lh_free(APP_INFO,lh) # define lh_CONF_VALUE_new() LHM_lh_new(CONF_VALUE,conf_value) # define lh_CONF_VALUE_insert(lh,inst) LHM_lh_insert(CONF_VALUE,lh,inst) # define lh_CONF_VALUE_retrieve(lh,inst) LHM_lh_retrieve(CONF_VALUE,lh,inst) # define lh_CONF_VALUE_delete(lh,inst) LHM_lh_delete(CONF_VALUE,lh,inst) # define lh_CONF_VALUE_doall(lh,fn) LHM_lh_doall(CONF_VALUE,lh,fn) # define lh_CONF_VALUE_doall_arg(lh,fn,arg_type,arg) \ LHM_lh_doall_arg(CONF_VALUE,lh,fn,arg_type,arg) # define lh_CONF_VALUE_error(lh) LHM_lh_error(CONF_VALUE,lh) # define lh_CONF_VALUE_num_items(lh) LHM_lh_num_items(CONF_VALUE,lh) # define lh_CONF_VALUE_down_load(lh) LHM_lh_down_load(CONF_VALUE,lh) # define lh_CONF_VALUE_node_stats_bio(lh,out) \ LHM_lh_node_stats_bio(CONF_VALUE,lh,out) # define lh_CONF_VALUE_node_usage_stats_bio(lh,out) \ LHM_lh_node_usage_stats_bio(CONF_VALUE,lh,out) # define lh_CONF_VALUE_stats_bio(lh,out) \ LHM_lh_stats_bio(CONF_VALUE,lh,out) # define lh_CONF_VALUE_free(lh) LHM_lh_free(CONF_VALUE,lh) # define lh_ENGINE_PILE_new() LHM_lh_new(ENGINE_PILE,engine_pile) # define lh_ENGINE_PILE_insert(lh,inst) LHM_lh_insert(ENGINE_PILE,lh,inst) # define lh_ENGINE_PILE_retrieve(lh,inst) LHM_lh_retrieve(ENGINE_PILE,lh,inst) # define lh_ENGINE_PILE_delete(lh,inst) LHM_lh_delete(ENGINE_PILE,lh,inst) # define lh_ENGINE_PILE_doall(lh,fn) LHM_lh_doall(ENGINE_PILE,lh,fn) # define lh_ENGINE_PILE_doall_arg(lh,fn,arg_type,arg) \ LHM_lh_doall_arg(ENGINE_PILE,lh,fn,arg_type,arg) # define lh_ENGINE_PILE_error(lh) LHM_lh_error(ENGINE_PILE,lh) # define lh_ENGINE_PILE_num_items(lh) LHM_lh_num_items(ENGINE_PILE,lh) # define lh_ENGINE_PILE_down_load(lh) LHM_lh_down_load(ENGINE_PILE,lh) # define lh_ENGINE_PILE_node_stats_bio(lh,out) \ LHM_lh_node_stats_bio(ENGINE_PILE,lh,out) # define lh_ENGINE_PILE_node_usage_stats_bio(lh,out) \ LHM_lh_node_usage_stats_bio(ENGINE_PILE,lh,out) # define lh_ENGINE_PILE_stats_bio(lh,out) \ LHM_lh_stats_bio(ENGINE_PILE,lh,out) # define lh_ENGINE_PILE_free(lh) LHM_lh_free(ENGINE_PILE,lh) # define lh_ERR_STATE_new() LHM_lh_new(ERR_STATE,err_state) # define lh_ERR_STATE_insert(lh,inst) LHM_lh_insert(ERR_STATE,lh,inst) # define lh_ERR_STATE_retrieve(lh,inst) LHM_lh_retrieve(ERR_STATE,lh,inst) # define lh_ERR_STATE_delete(lh,inst) LHM_lh_delete(ERR_STATE,lh,inst) # define lh_ERR_STATE_doall(lh,fn) LHM_lh_doall(ERR_STATE,lh,fn) # define lh_ERR_STATE_doall_arg(lh,fn,arg_type,arg) \ LHM_lh_doall_arg(ERR_STATE,lh,fn,arg_type,arg) # define lh_ERR_STATE_error(lh) LHM_lh_error(ERR_STATE,lh) # define lh_ERR_STATE_num_items(lh) LHM_lh_num_items(ERR_STATE,lh) # define lh_ERR_STATE_down_load(lh) LHM_lh_down_load(ERR_STATE,lh) # define lh_ERR_STATE_node_stats_bio(lh,out) \ LHM_lh_node_stats_bio(ERR_STATE,lh,out) # define lh_ERR_STATE_node_usage_stats_bio(lh,out) \ LHM_lh_node_usage_stats_bio(ERR_STATE,lh,out) # define lh_ERR_STATE_stats_bio(lh,out) \ LHM_lh_stats_bio(ERR_STATE,lh,out) # define lh_ERR_STATE_free(lh) LHM_lh_free(ERR_STATE,lh) # define lh_ERR_STRING_DATA_new() LHM_lh_new(ERR_STRING_DATA,err_string_data) # define lh_ERR_STRING_DATA_insert(lh,inst) LHM_lh_insert(ERR_STRING_DATA,lh,inst) # define lh_ERR_STRING_DATA_retrieve(lh,inst) LHM_lh_retrieve(ERR_STRING_DATA,lh,inst) # define lh_ERR_STRING_DATA_delete(lh,inst) LHM_lh_delete(ERR_STRING_DATA,lh,inst) # define lh_ERR_STRING_DATA_doall(lh,fn) LHM_lh_doall(ERR_STRING_DATA,lh,fn) # define lh_ERR_STRING_DATA_doall_arg(lh,fn,arg_type,arg) \ LHM_lh_doall_arg(ERR_STRING_DATA,lh,fn,arg_type,arg) # define lh_ERR_STRING_DATA_error(lh) LHM_lh_error(ERR_STRING_DATA,lh) # define lh_ERR_STRING_DATA_num_items(lh) LHM_lh_num_items(ERR_STRING_DATA,lh) # define lh_ERR_STRING_DATA_down_load(lh) LHM_lh_down_load(ERR_STRING_DATA,lh) # define lh_ERR_STRING_DATA_node_stats_bio(lh,out) \ LHM_lh_node_stats_bio(ERR_STRING_DATA,lh,out) # define lh_ERR_STRING_DATA_node_usage_stats_bio(lh,out) \ LHM_lh_node_usage_stats_bio(ERR_STRING_DATA,lh,out) # define lh_ERR_STRING_DATA_stats_bio(lh,out) \ LHM_lh_stats_bio(ERR_STRING_DATA,lh,out) # define lh_ERR_STRING_DATA_free(lh) LHM_lh_free(ERR_STRING_DATA,lh) # define lh_EX_CLASS_ITEM_new() LHM_lh_new(EX_CLASS_ITEM,ex_class_item) # define lh_EX_CLASS_ITEM_insert(lh,inst) LHM_lh_insert(EX_CLASS_ITEM,lh,inst) # define lh_EX_CLASS_ITEM_retrieve(lh,inst) LHM_lh_retrieve(EX_CLASS_ITEM,lh,inst) # define lh_EX_CLASS_ITEM_delete(lh,inst) LHM_lh_delete(EX_CLASS_ITEM,lh,inst) # define lh_EX_CLASS_ITEM_doall(lh,fn) LHM_lh_doall(EX_CLASS_ITEM,lh,fn) # define lh_EX_CLASS_ITEM_doall_arg(lh,fn,arg_type,arg) \ LHM_lh_doall_arg(EX_CLASS_ITEM,lh,fn,arg_type,arg) # define lh_EX_CLASS_ITEM_error(lh) LHM_lh_error(EX_CLASS_ITEM,lh) # define lh_EX_CLASS_ITEM_num_items(lh) LHM_lh_num_items(EX_CLASS_ITEM,lh) # define lh_EX_CLASS_ITEM_down_load(lh) LHM_lh_down_load(EX_CLASS_ITEM,lh) # define lh_EX_CLASS_ITEM_node_stats_bio(lh,out) \ LHM_lh_node_stats_bio(EX_CLASS_ITEM,lh,out) # define lh_EX_CLASS_ITEM_node_usage_stats_bio(lh,out) \ LHM_lh_node_usage_stats_bio(EX_CLASS_ITEM,lh,out) # define lh_EX_CLASS_ITEM_stats_bio(lh,out) \ LHM_lh_stats_bio(EX_CLASS_ITEM,lh,out) # define lh_EX_CLASS_ITEM_free(lh) LHM_lh_free(EX_CLASS_ITEM,lh) # define lh_FUNCTION_new() LHM_lh_new(FUNCTION,function) # define lh_FUNCTION_insert(lh,inst) LHM_lh_insert(FUNCTION,lh,inst) # define lh_FUNCTION_retrieve(lh,inst) LHM_lh_retrieve(FUNCTION,lh,inst) # define lh_FUNCTION_delete(lh,inst) LHM_lh_delete(FUNCTION,lh,inst) # define lh_FUNCTION_doall(lh,fn) LHM_lh_doall(FUNCTION,lh,fn) # define lh_FUNCTION_doall_arg(lh,fn,arg_type,arg) \ LHM_lh_doall_arg(FUNCTION,lh,fn,arg_type,arg) # define lh_FUNCTION_error(lh) LHM_lh_error(FUNCTION,lh) # define lh_FUNCTION_num_items(lh) LHM_lh_num_items(FUNCTION,lh) # define lh_FUNCTION_down_load(lh) LHM_lh_down_load(FUNCTION,lh) # define lh_FUNCTION_node_stats_bio(lh,out) \ LHM_lh_node_stats_bio(FUNCTION,lh,out) # define lh_FUNCTION_node_usage_stats_bio(lh,out) \ LHM_lh_node_usage_stats_bio(FUNCTION,lh,out) # define lh_FUNCTION_stats_bio(lh,out) \ LHM_lh_stats_bio(FUNCTION,lh,out) # define lh_FUNCTION_free(lh) LHM_lh_free(FUNCTION,lh) # define lh_MEM_new() LHM_lh_new(MEM,mem) # define lh_MEM_insert(lh,inst) LHM_lh_insert(MEM,lh,inst) # define lh_MEM_retrieve(lh,inst) LHM_lh_retrieve(MEM,lh,inst) # define lh_MEM_delete(lh,inst) LHM_lh_delete(MEM,lh,inst) # define lh_MEM_doall(lh,fn) LHM_lh_doall(MEM,lh,fn) # define lh_MEM_doall_arg(lh,fn,arg_type,arg) \ LHM_lh_doall_arg(MEM,lh,fn,arg_type,arg) # define lh_MEM_error(lh) LHM_lh_error(MEM,lh) # define lh_MEM_num_items(lh) LHM_lh_num_items(MEM,lh) # define lh_MEM_down_load(lh) LHM_lh_down_load(MEM,lh) # define lh_MEM_node_stats_bio(lh,out) \ LHM_lh_node_stats_bio(MEM,lh,out) # define lh_MEM_node_usage_stats_bio(lh,out) \ LHM_lh_node_usage_stats_bio(MEM,lh,out) # define lh_MEM_stats_bio(lh,out) \ LHM_lh_stats_bio(MEM,lh,out) # define lh_MEM_free(lh) LHM_lh_free(MEM,lh) # define lh_OBJ_NAME_new() LHM_lh_new(OBJ_NAME,obj_name) # define lh_OBJ_NAME_insert(lh,inst) LHM_lh_insert(OBJ_NAME,lh,inst) # define lh_OBJ_NAME_retrieve(lh,inst) LHM_lh_retrieve(OBJ_NAME,lh,inst) # define lh_OBJ_NAME_delete(lh,inst) LHM_lh_delete(OBJ_NAME,lh,inst) # define lh_OBJ_NAME_doall(lh,fn) LHM_lh_doall(OBJ_NAME,lh,fn) # define lh_OBJ_NAME_doall_arg(lh,fn,arg_type,arg) \ LHM_lh_doall_arg(OBJ_NAME,lh,fn,arg_type,arg) # define lh_OBJ_NAME_error(lh) LHM_lh_error(OBJ_NAME,lh) # define lh_OBJ_NAME_num_items(lh) LHM_lh_num_items(OBJ_NAME,lh) # define lh_OBJ_NAME_down_load(lh) LHM_lh_down_load(OBJ_NAME,lh) # define lh_OBJ_NAME_node_stats_bio(lh,out) \ LHM_lh_node_stats_bio(OBJ_NAME,lh,out) # define lh_OBJ_NAME_node_usage_stats_bio(lh,out) \ LHM_lh_node_usage_stats_bio(OBJ_NAME,lh,out) # define lh_OBJ_NAME_stats_bio(lh,out) \ LHM_lh_stats_bio(OBJ_NAME,lh,out) # define lh_OBJ_NAME_free(lh) LHM_lh_free(OBJ_NAME,lh) # define lh_OPENSSL_CSTRING_new() LHM_lh_new(OPENSSL_CSTRING,openssl_cstring) # define lh_OPENSSL_CSTRING_insert(lh,inst) LHM_lh_insert(OPENSSL_CSTRING,lh,inst) # define lh_OPENSSL_CSTRING_retrieve(lh,inst) LHM_lh_retrieve(OPENSSL_CSTRING,lh,inst) # define lh_OPENSSL_CSTRING_delete(lh,inst) LHM_lh_delete(OPENSSL_CSTRING,lh,inst) # define lh_OPENSSL_CSTRING_doall(lh,fn) LHM_lh_doall(OPENSSL_CSTRING,lh,fn) # define lh_OPENSSL_CSTRING_doall_arg(lh,fn,arg_type,arg) \ LHM_lh_doall_arg(OPENSSL_CSTRING,lh,fn,arg_type,arg) # define lh_OPENSSL_CSTRING_error(lh) LHM_lh_error(OPENSSL_CSTRING,lh) # define lh_OPENSSL_CSTRING_num_items(lh) LHM_lh_num_items(OPENSSL_CSTRING,lh) # define lh_OPENSSL_CSTRING_down_load(lh) LHM_lh_down_load(OPENSSL_CSTRING,lh) # define lh_OPENSSL_CSTRING_node_stats_bio(lh,out) \ LHM_lh_node_stats_bio(OPENSSL_CSTRING,lh,out) # define lh_OPENSSL_CSTRING_node_usage_stats_bio(lh,out) \ LHM_lh_node_usage_stats_bio(OPENSSL_CSTRING,lh,out) # define lh_OPENSSL_CSTRING_stats_bio(lh,out) \ LHM_lh_stats_bio(OPENSSL_CSTRING,lh,out) # define lh_OPENSSL_CSTRING_free(lh) LHM_lh_free(OPENSSL_CSTRING,lh) # define lh_OPENSSL_STRING_new() LHM_lh_new(OPENSSL_STRING,openssl_string) # define lh_OPENSSL_STRING_insert(lh,inst) LHM_lh_insert(OPENSSL_STRING,lh,inst) # define lh_OPENSSL_STRING_retrieve(lh,inst) LHM_lh_retrieve(OPENSSL_STRING,lh,inst) # define lh_OPENSSL_STRING_delete(lh,inst) LHM_lh_delete(OPENSSL_STRING,lh,inst) # define lh_OPENSSL_STRING_doall(lh,fn) LHM_lh_doall(OPENSSL_STRING,lh,fn) # define lh_OPENSSL_STRING_doall_arg(lh,fn,arg_type,arg) \ LHM_lh_doall_arg(OPENSSL_STRING,lh,fn,arg_type,arg) # define lh_OPENSSL_STRING_error(lh) LHM_lh_error(OPENSSL_STRING,lh) # define lh_OPENSSL_STRING_num_items(lh) LHM_lh_num_items(OPENSSL_STRING,lh) # define lh_OPENSSL_STRING_down_load(lh) LHM_lh_down_load(OPENSSL_STRING,lh) # define lh_OPENSSL_STRING_node_stats_bio(lh,out) \ LHM_lh_node_stats_bio(OPENSSL_STRING,lh,out) # define lh_OPENSSL_STRING_node_usage_stats_bio(lh,out) \ LHM_lh_node_usage_stats_bio(OPENSSL_STRING,lh,out) # define lh_OPENSSL_STRING_stats_bio(lh,out) \ LHM_lh_stats_bio(OPENSSL_STRING,lh,out) # define lh_OPENSSL_STRING_free(lh) LHM_lh_free(OPENSSL_STRING,lh) # define lh_SSL_SESSION_new() LHM_lh_new(SSL_SESSION,ssl_session) # define lh_SSL_SESSION_insert(lh,inst) LHM_lh_insert(SSL_SESSION,lh,inst) # define lh_SSL_SESSION_retrieve(lh,inst) LHM_lh_retrieve(SSL_SESSION,lh,inst) # define lh_SSL_SESSION_delete(lh,inst) LHM_lh_delete(SSL_SESSION,lh,inst) # define lh_SSL_SESSION_doall(lh,fn) LHM_lh_doall(SSL_SESSION,lh,fn) # define lh_SSL_SESSION_doall_arg(lh,fn,arg_type,arg) \ LHM_lh_doall_arg(SSL_SESSION,lh,fn,arg_type,arg) # define lh_SSL_SESSION_error(lh) LHM_lh_error(SSL_SESSION,lh) # define lh_SSL_SESSION_num_items(lh) LHM_lh_num_items(SSL_SESSION,lh) # define lh_SSL_SESSION_down_load(lh) LHM_lh_down_load(SSL_SESSION,lh) # define lh_SSL_SESSION_node_stats_bio(lh,out) \ LHM_lh_node_stats_bio(SSL_SESSION,lh,out) # define lh_SSL_SESSION_node_usage_stats_bio(lh,out) \ LHM_lh_node_usage_stats_bio(SSL_SESSION,lh,out) # define lh_SSL_SESSION_stats_bio(lh,out) \ LHM_lh_stats_bio(SSL_SESSION,lh,out) # define lh_SSL_SESSION_free(lh) LHM_lh_free(SSL_SESSION,lh) #ifdef __cplusplus } #endif #endif /* !defined HEADER_SAFESTACK_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/kssl.h��������������������������������������������������������������������������������������0000644�����������������00000015305�14763166030�0007366 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ssl/kssl.h */ /* * Written by Vern Staats <staatsvr@asc.hpc.mil> for the OpenSSL project * 2000. project 2000. */ /* ==================================================================== * Copyright (c) 2000 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * licensing@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ /* ** 19990701 VRS Started. */ #ifndef KSSL_H # define KSSL_H # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_KRB5 # include <stdio.h> # include <ctype.h> # include <krb5.h> # ifdef OPENSSL_SYS_WIN32 /* * These can sometimes get redefined indirectly by krb5 header files after * they get undefed in ossl_typ.h */ # undef X509_NAME # undef X509_EXTENSIONS # undef OCSP_REQUEST # undef OCSP_RESPONSE # endif #ifdef __cplusplus extern "C" { #endif /* * Depending on which KRB5 implementation used, some types from * the other may be missing. Resolve that here and now */ # ifdef KRB5_HEIMDAL typedef unsigned char krb5_octet; # define FAR # else # ifndef FAR # define FAR # endif # endif /*- * Uncomment this to debug kssl problems or * to trace usage of the Kerberos session key * * #define KSSL_DEBUG */ # ifndef KRB5SVC # define KRB5SVC "host" # endif # ifndef KRB5KEYTAB # define KRB5KEYTAB "/etc/krb5.keytab" # endif # ifndef KRB5SENDAUTH # define KRB5SENDAUTH 1 # endif # ifndef KRB5CHECKAUTH # define KRB5CHECKAUTH 1 # endif # ifndef KSSL_CLOCKSKEW # define KSSL_CLOCKSKEW 300; # endif # define KSSL_ERR_MAX 255 typedef struct kssl_err_st { int reason; char text[KSSL_ERR_MAX + 1]; } KSSL_ERR; /*- Context for passing * (1) Kerberos session key to SSL, and * (2) Config data between application and SSL lib */ typedef struct kssl_ctx_st { /* used by: disposition: */ char *service_name; /* C,S default ok (kssl) */ char *service_host; /* C input, REQUIRED */ char *client_princ; /* S output from krb5 ticket */ char *keytab_file; /* S NULL (/etc/krb5.keytab) */ char *cred_cache; /* C NULL (default) */ krb5_enctype enctype; int length; krb5_octet FAR *key; } KSSL_CTX; # define KSSL_CLIENT 1 # define KSSL_SERVER 2 # define KSSL_SERVICE 3 # define KSSL_KEYTAB 4 # define KSSL_CTX_OK 0 # define KSSL_CTX_ERR 1 # define KSSL_NOMEM 2 /* Public (for use by applications that use OpenSSL with Kerberos 5 support */ krb5_error_code kssl_ctx_setstring(KSSL_CTX *kssl_ctx, int which, char *text); KSSL_CTX *kssl_ctx_new(void); KSSL_CTX *kssl_ctx_free(KSSL_CTX *kssl_ctx); void kssl_ctx_show(KSSL_CTX *kssl_ctx); krb5_error_code kssl_ctx_setprinc(KSSL_CTX *kssl_ctx, int which, krb5_data *realm, krb5_data *entity, int nentities); krb5_error_code kssl_cget_tkt(KSSL_CTX *kssl_ctx, krb5_data **enc_tktp, krb5_data *authenp, KSSL_ERR *kssl_err); krb5_error_code kssl_sget_tkt(KSSL_CTX *kssl_ctx, krb5_data *indata, krb5_ticket_times *ttimes, KSSL_ERR *kssl_err); krb5_error_code kssl_ctx_setkey(KSSL_CTX *kssl_ctx, krb5_keyblock *session); void kssl_err_set(KSSL_ERR *kssl_err, int reason, char *text); void kssl_krb5_free_data_contents(krb5_context context, krb5_data *data); krb5_error_code kssl_build_principal_2(krb5_context context, krb5_principal *princ, int rlen, const char *realm, int slen, const char *svc, int hlen, const char *host); krb5_error_code kssl_validate_times(krb5_timestamp atime, krb5_ticket_times *ttimes); krb5_error_code kssl_check_authent(KSSL_CTX *kssl_ctx, krb5_data *authentp, krb5_timestamp *atimep, KSSL_ERR *kssl_err); unsigned char *kssl_skip_confound(krb5_enctype enctype, unsigned char *authn); void SSL_set0_kssl_ctx(SSL *s, KSSL_CTX *kctx); KSSL_CTX *SSL_get0_kssl_ctx(SSL *s); char *kssl_ctx_get0_client_princ(KSSL_CTX *kctx); #ifdef __cplusplus } #endif # endif /* OPENSSL_NO_KRB5 */ #endif /* KSSL_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/ssl23.h�������������������������������������������������������������������������������������0000644�����������������00000007315�14763166030�0007362 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ssl/ssl23.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_SSL23_H # define HEADER_SSL23_H #ifdef __cplusplus extern "C" { #endif /* * client */ /* write to server */ # define SSL23_ST_CW_CLNT_HELLO_A (0x210|SSL_ST_CONNECT) # define SSL23_ST_CW_CLNT_HELLO_B (0x211|SSL_ST_CONNECT) /* read from server */ # define SSL23_ST_CR_SRVR_HELLO_A (0x220|SSL_ST_CONNECT) # define SSL23_ST_CR_SRVR_HELLO_B (0x221|SSL_ST_CONNECT) /* server */ /* read from client */ # define SSL23_ST_SR_CLNT_HELLO_A (0x210|SSL_ST_ACCEPT) # define SSL23_ST_SR_CLNT_HELLO_B (0x211|SSL_ST_ACCEPT) #ifdef __cplusplus } #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/ec.h����������������������������������������������������������������������������������������0000644�����������������00000145431�14763166030�0007005 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/ec/ec.h */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ /** * \file crypto/ec/ec.h Include file for the OpenSSL EC functions * \author Originally written by Bodo Moeller for the OpenSSL project */ /* ==================================================================== * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * * Portions of the attached software ("Contribution") are developed by * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. * * The Contribution is licensed pursuant to the OpenSSL open source * license provided above. * * The elliptic curve binary polynomial software is originally written by * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories. * */ #ifndef HEADER_EC_H # define HEADER_EC_H # include <openssl/opensslconf.h> # ifdef OPENSSL_NO_EC # error EC is disabled. # endif # include <openssl/asn1.h> # include <openssl/symhacks.h> # ifndef OPENSSL_NO_DEPRECATED # include <openssl/bn.h> # endif # ifdef __cplusplus extern "C" { # elif defined(__SUNPRO_C) # if __SUNPRO_C >= 0x520 # pragma error_messages (off,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE) # endif # endif # ifndef OPENSSL_ECC_MAX_FIELD_BITS # define OPENSSL_ECC_MAX_FIELD_BITS 661 # endif /** Enum for the point conversion form as defined in X9.62 (ECDSA) * for the encoding of a elliptic curve point (x,y) */ typedef enum { /** the point is encoded as z||x, where the octet z specifies * which solution of the quadratic equation y is */ POINT_CONVERSION_COMPRESSED = 2, /** the point is encoded as z||x||y, where z is the octet 0x04 */ POINT_CONVERSION_UNCOMPRESSED = 4, /** the point is encoded as z||x||y, where the octet z specifies * which solution of the quadratic equation y is */ POINT_CONVERSION_HYBRID = 6 } point_conversion_form_t; typedef struct ec_method_st EC_METHOD; typedef struct ec_group_st /*- EC_METHOD *meth; -- field definition -- curve coefficients -- optional generator with associated information (order, cofactor) -- optional extra data (precomputed table for fast computation of multiples of generator) -- ASN1 stuff */ EC_GROUP; typedef struct ec_point_st EC_POINT; /********************************************************************/ /* EC_METHODs for curves over GF(p) */ /********************************************************************/ /** Returns the basic GFp ec methods which provides the basis for the * optimized methods. * \return EC_METHOD object */ const EC_METHOD *EC_GFp_simple_method(void); /** Returns GFp methods using montgomery multiplication. * \return EC_METHOD object */ const EC_METHOD *EC_GFp_mont_method(void); /** Returns GFp methods using optimized methods for NIST recommended curves * \return EC_METHOD object */ const EC_METHOD *EC_GFp_nist_method(void); # ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 /** Returns 64-bit optimized methods for nistp256 * \return EC_METHOD object */ const EC_METHOD *EC_GFp_nistp256_method(void); /** Returns 64-bit optimized methods for nistp521 * \return EC_METHOD object */ const EC_METHOD *EC_GFp_nistp521_method(void); # endif /********************************************************************/ /* EC_GROUP functions */ /********************************************************************/ /** Creates a new EC_GROUP object * \param meth EC_METHOD to use * \return newly created EC_GROUP object or NULL in case of an error. */ EC_GROUP *EC_GROUP_new(const EC_METHOD *meth); /** Frees a EC_GROUP object * \param group EC_GROUP object to be freed. */ void EC_GROUP_free(EC_GROUP *group); /** Clears and frees a EC_GROUP object * \param group EC_GROUP object to be cleared and freed. */ void EC_GROUP_clear_free(EC_GROUP *group); /** Copies EC_GROUP objects. Note: both EC_GROUPs must use the same EC_METHOD. * \param dst destination EC_GROUP object * \param src source EC_GROUP object * \return 1 on success and 0 if an error occurred. */ int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src); /** Creates a new EC_GROUP object and copies the copies the content * form src to the newly created EC_KEY object * \param src source EC_GROUP object * \return newly created EC_GROUP object or NULL in case of an error. */ EC_GROUP *EC_GROUP_dup(const EC_GROUP *src); /** Returns the EC_METHOD of the EC_GROUP object. * \param group EC_GROUP object * \return EC_METHOD used in this EC_GROUP object. */ const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group); /** Returns the field type of the EC_METHOD. * \param meth EC_METHOD object * \return NID of the underlying field type OID. */ int EC_METHOD_get_field_type(const EC_METHOD *meth); /** Sets the generator and it's order/cofactor of a EC_GROUP object. * \param group EC_GROUP object * \param generator EC_POINT object with the generator. * \param order the order of the group generated by the generator. * \param cofactor the index of the sub-group generated by the generator * in the group of all points on the elliptic curve. * \return 1 on success and 0 if an error occured */ int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor); /** Returns the generator of a EC_GROUP object. * \param group EC_GROUP object * \return the currently used generator (possibly NULL). */ const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group); /** Returns the montgomery data for order(Generator) * \param group EC_GROUP object * \return the currently used generator (possibly NULL). */ BN_MONT_CTX *EC_GROUP_get_mont_data(const EC_GROUP *group); /** Gets the order of a EC_GROUP * \param group EC_GROUP object * \param order BIGNUM to which the order is copied * \param ctx BN_CTX object (optional) * \return 1 on success and 0 if an error occured */ int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx); /** Gets the cofactor of a EC_GROUP * \param group EC_GROUP object * \param cofactor BIGNUM to which the cofactor is copied * \param ctx BN_CTX object (optional) * \return 1 on success and 0 if an error occured */ int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx); /** Sets the name of a EC_GROUP object * \param group EC_GROUP object * \param nid NID of the curve name OID */ void EC_GROUP_set_curve_name(EC_GROUP *group, int nid); /** Returns the curve name of a EC_GROUP object * \param group EC_GROUP object * \return NID of the curve name OID or 0 if not set. */ int EC_GROUP_get_curve_name(const EC_GROUP *group); void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); int EC_GROUP_get_asn1_flag(const EC_GROUP *group); void EC_GROUP_set_point_conversion_form(EC_GROUP *group, point_conversion_form_t form); point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x); size_t EC_GROUP_get_seed_len(const EC_GROUP *); size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); /** Sets the parameter of a ec over GFp defined by y^2 = x^3 + a*x + b * \param group EC_GROUP object * \param p BIGNUM with the prime number * \param a BIGNUM with parameter a of the equation * \param b BIGNUM with parameter b of the equation * \param ctx BN_CTX object (optional) * \return 1 on success and 0 if an error occured */ int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); /** Gets the parameter of the ec over GFp defined by y^2 = x^3 + a*x + b * \param group EC_GROUP object * \param p BIGNUM for the prime number * \param a BIGNUM for parameter a of the equation * \param b BIGNUM for parameter b of the equation * \param ctx BN_CTX object (optional) * \return 1 on success and 0 if an error occured */ int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); /** Returns the number of bits needed to represent a field element * \param group EC_GROUP object * \return number of bits needed to represent a field element */ int EC_GROUP_get_degree(const EC_GROUP *group); /** Checks whether the parameter in the EC_GROUP define a valid ec group * \param group EC_GROUP object * \param ctx BN_CTX object (optional) * \return 1 if group is a valid ec group and 0 otherwise */ int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx); /** Checks whether the discriminant of the elliptic curve is zero or not * \param group EC_GROUP object * \param ctx BN_CTX object (optional) * \return 1 if the discriminant is not zero and 0 otherwise */ int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx); /** Compares two EC_GROUP objects * \param a first EC_GROUP object * \param b second EC_GROUP object * \param ctx BN_CTX object (optional) * \return 0 if both groups are equal and 1 otherwise */ int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx); /* * EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*() after * choosing an appropriate EC_METHOD */ /** Creates a new EC_GROUP object with the specified parameters defined * over GFp (defined by the equation y^2 = x^3 + a*x + b) * \param p BIGNUM with the prime number * \param a BIGNUM with the parameter a of the equation * \param b BIGNUM with the parameter b of the equation * \param ctx BN_CTX object (optional) * \return newly created EC_GROUP object with the specified parameters */ EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); /** Creates a EC_GROUP object with a curve specified by a NID * \param nid NID of the OID of the curve name * \return newly created EC_GROUP object with specified curve or NULL * if an error occurred */ EC_GROUP *EC_GROUP_new_by_curve_name(int nid); /********************************************************************/ /* handling of internal curves */ /********************************************************************/ typedef struct { int nid; const char *comment; } EC_builtin_curve; /* * EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number of all * available curves or zero if a error occurred. In case r ist not zero * nitems EC_builtin_curve structures are filled with the data of the first * nitems internal groups */ size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems); const char *EC_curve_nid2nist(int nid); int EC_curve_nist2nid(const char *name); /********************************************************************/ /* EC_POINT functions */ /********************************************************************/ /** Creates a new EC_POINT object for the specified EC_GROUP * \param group EC_GROUP the underlying EC_GROUP object * \return newly created EC_POINT object or NULL if an error occurred */ EC_POINT *EC_POINT_new(const EC_GROUP *group); /** Frees a EC_POINT object * \param point EC_POINT object to be freed */ void EC_POINT_free(EC_POINT *point); /** Clears and frees a EC_POINT object * \param point EC_POINT object to be cleared and freed */ void EC_POINT_clear_free(EC_POINT *point); /** Copies EC_POINT object * \param dst destination EC_POINT object * \param src source EC_POINT object * \return 1 on success and 0 if an error occured */ int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src); /** Creates a new EC_POINT object and copies the content of the supplied * EC_POINT * \param src source EC_POINT object * \param group underlying the EC_GROUP object * \return newly created EC_POINT object or NULL if an error occurred */ EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group); /** Returns the EC_METHOD used in EC_POINT object * \param point EC_POINT object * \return the EC_METHOD used */ const EC_METHOD *EC_POINT_method_of(const EC_POINT *point); /** Sets a point to infinity (neutral element) * \param group underlying EC_GROUP object * \param point EC_POINT to set to infinity * \return 1 on success and 0 if an error occured */ int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point); /** Sets the jacobian projective coordinates of a EC_POINT over GFp * \param group underlying EC_GROUP object * \param p EC_POINT object * \param x BIGNUM with the x-coordinate * \param y BIGNUM with the y-coordinate * \param z BIGNUM with the z-coordinate * \param ctx BN_CTX object (optional) * \return 1 on success and 0 if an error occured */ int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx); /** Gets the jacobian projective coordinates of a EC_POINT over GFp * \param group underlying EC_GROUP object * \param p EC_POINT object * \param x BIGNUM for the x-coordinate * \param y BIGNUM for the y-coordinate * \param z BIGNUM for the z-coordinate * \param ctx BN_CTX object (optional) * \return 1 on success and 0 if an error occured */ int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, const EC_POINT *p, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx); /** Sets the affine coordinates of a EC_POINT over GFp * \param group underlying EC_GROUP object * \param p EC_POINT object * \param x BIGNUM with the x-coordinate * \param y BIGNUM with the y-coordinate * \param ctx BN_CTX object (optional) * \return 1 on success and 0 if an error occured */ int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx); /** Gets the affine coordinates of a EC_POINT over GFp * \param group underlying EC_GROUP object * \param p EC_POINT object * \param x BIGNUM for the x-coordinate * \param y BIGNUM for the y-coordinate * \param ctx BN_CTX object (optional) * \return 1 on success and 0 if an error occured */ int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx); /** Sets the x9.62 compressed coordinates of a EC_POINT over GFp * \param group underlying EC_GROUP object * \param p EC_POINT object * \param x BIGNUM with x-coordinate * \param y_bit integer with the y-Bit (either 0 or 1) * \param ctx BN_CTX object (optional) * \return 1 on success and 0 if an error occured */ int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, const BIGNUM *x, int y_bit, BN_CTX *ctx); /** Encodes a EC_POINT object to a octet string * \param group underlying EC_GROUP object * \param p EC_POINT object * \param form point conversion form * \param buf memory buffer for the result. If NULL the function returns * required buffer size. * \param len length of the memory buffer * \param ctx BN_CTX object (optional) * \return the length of the encoded octet string or 0 if an error occurred */ size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p, point_conversion_form_t form, unsigned char *buf, size_t len, BN_CTX *ctx); /** Decodes a EC_POINT from a octet string * \param group underlying EC_GROUP object * \param p EC_POINT object * \param buf memory buffer with the encoded ec point * \param len length of the encoded ec point * \param ctx BN_CTX object (optional) * \return 1 on success and 0 if an error occured */ int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p, const unsigned char *buf, size_t len, BN_CTX *ctx); /* other interfaces to point2oct/oct2point: */ BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *, point_conversion_form_t form, BIGNUM *, BN_CTX *); EC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *, EC_POINT *, BN_CTX *); char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *, point_conversion_form_t form, BN_CTX *); EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *, EC_POINT *, BN_CTX *); /********************************************************************/ /* functions for doing EC_POINT arithmetic */ /********************************************************************/ /** Computes the sum of two EC_POINT * \param group underlying EC_GROUP object * \param r EC_POINT object for the result (r = a + b) * \param a EC_POINT object with the first summand * \param b EC_POINT object with the second summand * \param ctx BN_CTX object (optional) * \return 1 on success and 0 if an error occured */ int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx); /** Computes the double of a EC_POINT * \param group underlying EC_GROUP object * \param r EC_POINT object for the result (r = 2 * a) * \param a EC_POINT object * \param ctx BN_CTX object (optional) * \return 1 on success and 0 if an error occured */ int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx); /** Computes the inverse of a EC_POINT * \param group underlying EC_GROUP object * \param a EC_POINT object to be inverted (it's used for the result as well) * \param ctx BN_CTX object (optional) * \return 1 on success and 0 if an error occured */ int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx); /** Checks whether the point is the neutral element of the group * \param group the underlying EC_GROUP object * \param p EC_POINT object * \return 1 if the point is the neutral element and 0 otherwise */ int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p); /** Checks whether the point is on the curve * \param group underlying EC_GROUP object * \param point EC_POINT object to check * \param ctx BN_CTX object (optional) * \return 1 if point if on the curve and 0 otherwise */ int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx); /** Compares two EC_POINTs * \param group underlying EC_GROUP object * \param a first EC_POINT object * \param b second EC_POINT object * \param ctx BN_CTX object (optional) * \return 0 if both points are equal and a value != 0 otherwise */ int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx); int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx); int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx); /** Computes r = generator * n sum_{i=0}^{num-1} p[i] * m[i] * \param group underlying EC_GROUP object * \param r EC_POINT object for the result * \param n BIGNUM with the multiplier for the group generator (optional) * \param num number futher summands * \param p array of size num of EC_POINT objects * \param m array of size num of BIGNUM objects * \param ctx BN_CTX object (optional) * \return 1 on success and 0 if an error occured */ int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, size_t num, const EC_POINT *p[], const BIGNUM *m[], BN_CTX *ctx); /** Computes r = generator * n + q * m * \param group underlying EC_GROUP object * \param r EC_POINT object for the result * \param n BIGNUM with the multiplier for the group generator (optional) * \param q EC_POINT object with the first factor of the second summand * \param m BIGNUM with the second factor of the second summand * \param ctx BN_CTX object (optional) * \return 1 on success and 0 if an error occured */ int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx); /** Stores multiples of generator for faster point multiplication * \param group EC_GROUP object * \param ctx BN_CTX object (optional) * \return 1 on success and 0 if an error occured */ int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx); /** Reports whether a precomputation has been done * \param group EC_GROUP object * \return 1 if a pre-computation has been done and 0 otherwise */ int EC_GROUP_have_precompute_mult(const EC_GROUP *group); /********************************************************************/ /* ASN1 stuff */ /********************************************************************/ /* * EC_GROUP_get_basis_type() returns the NID of the basis type used to * represent the field elements */ int EC_GROUP_get_basis_type(const EC_GROUP *); # define OPENSSL_EC_NAMED_CURVE 0x001 typedef struct ecpk_parameters_st ECPKPARAMETERS; EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len); int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out); # define d2i_ECPKParameters_bio(bp,x) ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x) # define i2d_ECPKParameters_bio(bp,x) ASN1_i2d_bio_of_const(EC_GROUP,i2d_ECPKParameters,bp,x) # define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL, \ (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x)) # define i2d_ECPKParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECPKParameters,(fp), \ (unsigned char *)(x)) # ifndef OPENSSL_NO_BIO int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off); # endif # ifndef OPENSSL_NO_FP_API int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off); # endif /********************************************************************/ /* EC_KEY functions */ /********************************************************************/ typedef struct ec_key_st EC_KEY; /* some values for the encoding_flag */ # define EC_PKEY_NO_PARAMETERS 0x001 # define EC_PKEY_NO_PUBKEY 0x002 /* some values for the flags field */ # define EC_FLAG_NON_FIPS_ALLOW 0x1 # define EC_FLAG_FIPS_CHECKED 0x2 /** Creates a new EC_KEY object. * \return EC_KEY object or NULL if an error occurred. */ EC_KEY *EC_KEY_new(void); int EC_KEY_get_flags(const EC_KEY *key); void EC_KEY_set_flags(EC_KEY *key, int flags); void EC_KEY_clear_flags(EC_KEY *key, int flags); /** Creates a new EC_KEY object using a named curve as underlying * EC_GROUP object. * \param nid NID of the named curve. * \return EC_KEY object or NULL if an error occurred. */ EC_KEY *EC_KEY_new_by_curve_name(int nid); /** Frees a EC_KEY object. * \param key EC_KEY object to be freed. */ void EC_KEY_free(EC_KEY *key); /** Copies a EC_KEY object. * \param dst destination EC_KEY object * \param src src EC_KEY object * \return dst or NULL if an error occurred. */ EC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src); /** Creates a new EC_KEY object and copies the content from src to it. * \param src the source EC_KEY object * \return newly created EC_KEY object or NULL if an error occurred. */ EC_KEY *EC_KEY_dup(const EC_KEY *src); /** Increases the internal reference count of a EC_KEY object. * \param key EC_KEY object * \return 1 on success and 0 if an error occurred. */ int EC_KEY_up_ref(EC_KEY *key); /** Returns the EC_GROUP object of a EC_KEY object * \param key EC_KEY object * \return the EC_GROUP object (possibly NULL). */ const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key); /** Sets the EC_GROUP of a EC_KEY object. * \param key EC_KEY object * \param group EC_GROUP to use in the EC_KEY object (note: the EC_KEY * object will use an own copy of the EC_GROUP). * \return 1 on success and 0 if an error occurred. */ int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group); /** Returns the private key of a EC_KEY object. * \param key EC_KEY object * \return a BIGNUM with the private key (possibly NULL). */ const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key); /** Sets the private key of a EC_KEY object. * \param key EC_KEY object * \param prv BIGNUM with the private key (note: the EC_KEY object * will use an own copy of the BIGNUM). * \return 1 on success and 0 if an error occurred. */ int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv); /** Returns the public key of a EC_KEY object. * \param key the EC_KEY object * \return a EC_POINT object with the public key (possibly NULL) */ const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key); /** Sets the public key of a EC_KEY object. * \param key EC_KEY object * \param pub EC_POINT object with the public key (note: the EC_KEY object * will use an own copy of the EC_POINT object). * \return 1 on success and 0 if an error occurred. */ int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); unsigned EC_KEY_get_enc_flags(const EC_KEY *key); void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags); point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key); void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform); /* functions to set/get method specific data */ void *EC_KEY_get_key_method_data(EC_KEY *key, void *(*dup_func) (void *), void (*free_func) (void *), void (*clear_free_func) (void *)); /** Sets the key method data of an EC_KEY object, if none has yet been set. * \param key EC_KEY object * \param data opaque data to install. * \param dup_func a function that duplicates |data|. * \param free_func a function that frees |data|. * \param clear_free_func a function that wipes and frees |data|. * \return the previously set data pointer, or NULL if |data| was inserted. */ void *EC_KEY_insert_key_method_data(EC_KEY *key, void *data, void *(*dup_func) (void *), void (*free_func) (void *), void (*clear_free_func) (void *)); /* wrapper functions for the underlying EC_GROUP object */ void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag); /** Creates a table of pre-computed multiples of the generator to * accelerate further EC_KEY operations. * \param key EC_KEY object * \param ctx BN_CTX object (optional) * \return 1 on success and 0 if an error occurred. */ int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx); /** Creates a new ec private (and optional a new public) key. * \param key EC_KEY object * \return 1 on success and 0 if an error occurred. */ int EC_KEY_generate_key(EC_KEY *key); /** Verifies that a private and/or public key is valid. * \param key the EC_KEY object * \return 1 on success and 0 otherwise. */ int EC_KEY_check_key(const EC_KEY *key); /** Sets a public key from affine coordindates performing * neccessary NIST PKV tests. * \param key the EC_KEY object * \param x public key x coordinate * \param y public key y coordinate * \return 1 on success and 0 otherwise. */ int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, BIGNUM *y); /********************************************************************/ /* de- and encoding functions for SEC1 ECPrivateKey */ /********************************************************************/ /** Decodes a private key from a memory buffer. * \param key a pointer to a EC_KEY object which should be used (or NULL) * \param in pointer to memory with the DER encoded private key * \param len length of the DER encoded private key * \return the decoded private key or NULL if an error occurred. */ EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len); /** Encodes a private key object and stores the result in a buffer. * \param key the EC_KEY object to encode * \param out the buffer for the result (if NULL the function returns number * of bytes needed). * \return 1 on success and 0 if an error occurred. */ int i2d_ECPrivateKey(EC_KEY *key, unsigned char **out); /********************************************************************/ /* de- and encoding functions for EC parameters */ /********************************************************************/ /** Decodes ec parameter from a memory buffer. * \param key a pointer to a EC_KEY object which should be used (or NULL) * \param in pointer to memory with the DER encoded ec parameters * \param len length of the DER encoded ec parameters * \return a EC_KEY object with the decoded parameters or NULL if an error * occurred. */ EC_KEY *d2i_ECParameters(EC_KEY **key, const unsigned char **in, long len); /** Encodes ec parameter and stores the result in a buffer. * \param key the EC_KEY object with ec paramters to encode * \param out the buffer for the result (if NULL the function returns number * of bytes needed). * \return 1 on success and 0 if an error occurred. */ int i2d_ECParameters(EC_KEY *key, unsigned char **out); /********************************************************************/ /* de- and encoding functions for EC public key */ /* (octet string, not DER -- hence 'o2i' and 'i2o') */ /********************************************************************/ /** Decodes a ec public key from a octet string. * \param key a pointer to a EC_KEY object which should be used * \param in memory buffer with the encoded public key * \param len length of the encoded public key * \return EC_KEY object with decoded public key or NULL if an error * occurred. */ EC_KEY *o2i_ECPublicKey(EC_KEY **key, const unsigned char **in, long len); /** Encodes a ec public key in an octet string. * \param key the EC_KEY object with the public key * \param out the buffer for the result (if NULL the function returns number * of bytes needed). * \return 1 on success and 0 if an error occurred */ int i2o_ECPublicKey(EC_KEY *key, unsigned char **out); # ifndef OPENSSL_NO_BIO /** Prints out the ec parameters on human readable form. * \param bp BIO object to which the information is printed * \param key EC_KEY object * \return 1 on success and 0 if an error occurred */ int ECParameters_print(BIO *bp, const EC_KEY *key); /** Prints out the contents of a EC_KEY object * \param bp BIO object to which the information is printed * \param key EC_KEY object * \param off line offset * \return 1 on success and 0 if an error occurred */ int EC_KEY_print(BIO *bp, const EC_KEY *key, int off); # endif # ifndef OPENSSL_NO_FP_API /** Prints out the ec parameters on human readable form. * \param fp file descriptor to which the information is printed * \param key EC_KEY object * \return 1 on success and 0 if an error occurred */ int ECParameters_print_fp(FILE *fp, const EC_KEY *key); /** Prints out the contents of a EC_KEY object * \param fp file descriptor to which the information is printed * \param key EC_KEY object * \param off line offset * \return 1 on success and 0 if an error occurred */ int EC_KEY_print_fp(FILE *fp, const EC_KEY *key, int off); # endif # define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x) # ifndef __cplusplus # if defined(__SUNPRO_C) # if __SUNPRO_C >= 0x520 # pragma error_messages (default,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE) # endif # endif # endif # define EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ EVP_PKEY_OP_PARAMGEN|EVP_PKEY_OP_KEYGEN, \ EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID, nid, NULL) # define EVP_PKEY_CTX_set_ec_param_enc(ctx, flag) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ EVP_PKEY_OP_PARAMGEN|EVP_PKEY_OP_KEYGEN, \ EVP_PKEY_CTRL_EC_PARAM_ENC, flag, NULL) # define EVP_PKEY_CTX_set_ecdh_cofactor_mode(ctx, flag) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_EC_ECDH_COFACTOR, flag, NULL) # define EVP_PKEY_CTX_get_ecdh_cofactor_mode(ctx) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_EC_ECDH_COFACTOR, -2, NULL) # define EVP_PKEY_CTX_set_ecdh_kdf_type(ctx, kdf) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_EC_KDF_TYPE, kdf, NULL) # define EVP_PKEY_CTX_get_ecdh_kdf_type(ctx) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_EC_KDF_TYPE, -2, NULL) # define EVP_PKEY_CTX_set_ecdh_kdf_md(ctx, md) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_EC_KDF_MD, 0, (void *)md) # define EVP_PKEY_CTX_get_ecdh_kdf_md(ctx, pmd) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_GET_EC_KDF_MD, 0, (void *)pmd) # define EVP_PKEY_CTX_set_ecdh_kdf_outlen(ctx, len) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_EC_KDF_OUTLEN, len, NULL) # define EVP_PKEY_CTX_get_ecdh_kdf_outlen(ctx, plen) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN, 0, (void *)plen) # define EVP_PKEY_CTX_set0_ecdh_kdf_ukm(ctx, p, plen) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_EC_KDF_UKM, plen, (void *)p) # define EVP_PKEY_CTX_get0_ecdh_kdf_ukm(ctx, p) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_GET_EC_KDF_UKM, 0, (void *)p) # define EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID (EVP_PKEY_ALG_CTRL + 1) # define EVP_PKEY_CTRL_EC_PARAM_ENC (EVP_PKEY_ALG_CTRL + 2) # define EVP_PKEY_CTRL_EC_ECDH_COFACTOR (EVP_PKEY_ALG_CTRL + 3) # define EVP_PKEY_CTRL_EC_KDF_TYPE (EVP_PKEY_ALG_CTRL + 4) # define EVP_PKEY_CTRL_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 5) # define EVP_PKEY_CTRL_GET_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 6) # define EVP_PKEY_CTRL_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 7) # define EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 8) # define EVP_PKEY_CTRL_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 9) # define EVP_PKEY_CTRL_GET_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 10) /* KDF types */ # define EVP_PKEY_ECDH_KDF_NONE 1 # define EVP_PKEY_ECDH_KDF_X9_62 2 /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_EC_strings(void); /* Error codes for the EC functions. */ /* Function codes. */ # define EC_F_BN_TO_FELEM 224 # define EC_F_COMPUTE_WNAF 143 # define EC_F_D2I_ECPARAMETERS 144 # define EC_F_D2I_ECPKPARAMETERS 145 # define EC_F_D2I_ECPRIVATEKEY 146 # define EC_F_DO_EC_KEY_PRINT 221 # define EC_F_ECDH_CMS_DECRYPT 238 # define EC_F_ECDH_CMS_SET_SHARED_INFO 239 # define EC_F_ECKEY_PARAM2TYPE 223 # define EC_F_ECKEY_PARAM_DECODE 212 # define EC_F_ECKEY_PRIV_DECODE 213 # define EC_F_ECKEY_PRIV_ENCODE 214 # define EC_F_ECKEY_PUB_DECODE 215 # define EC_F_ECKEY_PUB_ENCODE 216 # define EC_F_ECKEY_TYPE2PARAM 220 # define EC_F_ECPARAMETERS_PRINT 147 # define EC_F_ECPARAMETERS_PRINT_FP 148 # define EC_F_ECPKPARAMETERS_PRINT 149 # define EC_F_ECPKPARAMETERS_PRINT_FP 150 # define EC_F_ECP_NISTZ256_GET_AFFINE 240 # define EC_F_ECP_NISTZ256_MULT_PRECOMPUTE 243 # define EC_F_ECP_NISTZ256_POINTS_MUL 241 # define EC_F_ECP_NISTZ256_PRE_COMP_NEW 244 # define EC_F_ECP_NISTZ256_SET_WORDS 245 # define EC_F_ECP_NISTZ256_WINDOWED_MUL 242 # define EC_F_ECP_NIST_MOD_192 203 # define EC_F_ECP_NIST_MOD_224 204 # define EC_F_ECP_NIST_MOD_256 205 # define EC_F_ECP_NIST_MOD_521 206 # define EC_F_EC_ASN1_GROUP2CURVE 153 # define EC_F_EC_ASN1_GROUP2FIELDID 154 # define EC_F_EC_ASN1_GROUP2PARAMETERS 155 # define EC_F_EC_ASN1_GROUP2PKPARAMETERS 156 # define EC_F_EC_ASN1_PARAMETERS2GROUP 157 # define EC_F_EC_ASN1_PKPARAMETERS2GROUP 158 # define EC_F_EC_EX_DATA_SET_DATA 211 # define EC_F_EC_GF2M_MONTGOMERY_POINT_MULTIPLY 208 # define EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT 159 # define EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE 195 # define EC_F_EC_GF2M_SIMPLE_OCT2POINT 160 # define EC_F_EC_GF2M_SIMPLE_POINT2OCT 161 # define EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES 162 # define EC_F_EC_GF2M_SIMPLE_POINT_SET_AFFINE_COORDINATES 163 # define EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES 164 # define EC_F_EC_GFP_MONT_FIELD_DECODE 133 # define EC_F_EC_GFP_MONT_FIELD_ENCODE 134 # define EC_F_EC_GFP_MONT_FIELD_MUL 131 # define EC_F_EC_GFP_MONT_FIELD_SET_TO_ONE 209 # define EC_F_EC_GFP_MONT_FIELD_SQR 132 # define EC_F_EC_GFP_MONT_GROUP_SET_CURVE 189 # define EC_F_EC_GFP_MONT_GROUP_SET_CURVE_GFP 135 # define EC_F_EC_GFP_NISTP224_GROUP_SET_CURVE 225 # define EC_F_EC_GFP_NISTP224_POINTS_MUL 228 # define EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES 226 # define EC_F_EC_GFP_NISTP256_GROUP_SET_CURVE 230 # define EC_F_EC_GFP_NISTP256_POINTS_MUL 231 # define EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES 232 # define EC_F_EC_GFP_NISTP521_GROUP_SET_CURVE 233 # define EC_F_EC_GFP_NISTP521_POINTS_MUL 234 # define EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES 235 # define EC_F_EC_GFP_NIST_FIELD_MUL 200 # define EC_F_EC_GFP_NIST_FIELD_SQR 201 # define EC_F_EC_GFP_NIST_GROUP_SET_CURVE 202 # define EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT 165 # define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE 166 # define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE_GFP 100 # define EC_F_EC_GFP_SIMPLE_GROUP_SET_GENERATOR 101 # define EC_F_EC_GFP_SIMPLE_MAKE_AFFINE 102 # define EC_F_EC_GFP_SIMPLE_OCT2POINT 103 # define EC_F_EC_GFP_SIMPLE_POINT2OCT 104 # define EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE 137 # define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES 167 # define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES_GFP 105 # define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES 168 # define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES_GFP 128 # define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES 169 # define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES_GFP 129 # define EC_F_EC_GROUP_CHECK 170 # define EC_F_EC_GROUP_CHECK_DISCRIMINANT 171 # define EC_F_EC_GROUP_COPY 106 # define EC_F_EC_GROUP_GET0_GENERATOR 139 # define EC_F_EC_GROUP_GET_COFACTOR 140 # define EC_F_EC_GROUP_GET_CURVE_GF2M 172 # define EC_F_EC_GROUP_GET_CURVE_GFP 130 # define EC_F_EC_GROUP_GET_DEGREE 173 # define EC_F_EC_GROUP_GET_ORDER 141 # define EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS 193 # define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS 194 # define EC_F_EC_GROUP_NEW 108 # define EC_F_EC_GROUP_NEW_BY_CURVE_NAME 174 # define EC_F_EC_GROUP_NEW_FROM_DATA 175 # define EC_F_EC_GROUP_PRECOMPUTE_MULT 142 # define EC_F_EC_GROUP_SET_CURVE_GF2M 176 # define EC_F_EC_GROUP_SET_CURVE_GFP 109 # define EC_F_EC_GROUP_SET_EXTRA_DATA 110 # define EC_F_EC_GROUP_SET_GENERATOR 111 # define EC_F_EC_KEY_CHECK_KEY 177 # define EC_F_EC_KEY_COPY 178 # define EC_F_EC_KEY_GENERATE_KEY 179 # define EC_F_EC_KEY_NEW 182 # define EC_F_EC_KEY_PRINT 180 # define EC_F_EC_KEY_PRINT_FP 181 # define EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES 229 # define EC_F_EC_POINTS_MAKE_AFFINE 136 # define EC_F_EC_POINT_ADD 112 # define EC_F_EC_POINT_CMP 113 # define EC_F_EC_POINT_COPY 114 # define EC_F_EC_POINT_DBL 115 # define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M 183 # define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP 116 # define EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP 117 # define EC_F_EC_POINT_INVERT 210 # define EC_F_EC_POINT_IS_AT_INFINITY 118 # define EC_F_EC_POINT_IS_ON_CURVE 119 # define EC_F_EC_POINT_MAKE_AFFINE 120 # define EC_F_EC_POINT_MUL 184 # define EC_F_EC_POINT_NEW 121 # define EC_F_EC_POINT_OCT2POINT 122 # define EC_F_EC_POINT_POINT2OCT 123 # define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M 185 # define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP 124 # define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M 186 # define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP 125 # define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP 126 # define EC_F_EC_POINT_SET_TO_INFINITY 127 # define EC_F_EC_PRE_COMP_DUP 207 # define EC_F_EC_PRE_COMP_NEW 196 # define EC_F_EC_WNAF_MUL 187 # define EC_F_EC_WNAF_PRECOMPUTE_MULT 188 # define EC_F_I2D_ECPARAMETERS 190 # define EC_F_I2D_ECPKPARAMETERS 191 # define EC_F_I2D_ECPRIVATEKEY 192 # define EC_F_I2O_ECPUBLICKEY 151 # define EC_F_NISTP224_PRE_COMP_NEW 227 # define EC_F_NISTP256_PRE_COMP_NEW 236 # define EC_F_NISTP521_PRE_COMP_NEW 237 # define EC_F_O2I_ECPUBLICKEY 152 # define EC_F_OLD_EC_PRIV_DECODE 222 # define EC_F_PKEY_EC_CTRL 197 # define EC_F_PKEY_EC_CTRL_STR 198 # define EC_F_PKEY_EC_DERIVE 217 # define EC_F_PKEY_EC_KEYGEN 199 # define EC_F_PKEY_EC_PARAMGEN 219 # define EC_F_PKEY_EC_SIGN 218 /* Reason codes. */ # define EC_R_ASN1_ERROR 115 # define EC_R_ASN1_UNKNOWN_FIELD 116 # define EC_R_BIGNUM_OUT_OF_RANGE 144 # define EC_R_BUFFER_TOO_SMALL 100 # define EC_R_COORDINATES_OUT_OF_RANGE 146 # define EC_R_D2I_ECPKPARAMETERS_FAILURE 117 # define EC_R_DECODE_ERROR 142 # define EC_R_DISCRIMINANT_IS_ZERO 118 # define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119 # define EC_R_FIELD_TOO_LARGE 143 # define EC_R_GF2M_NOT_SUPPORTED 147 # define EC_R_GROUP2PKPARAMETERS_FAILURE 120 # define EC_R_I2D_ECPKPARAMETERS_FAILURE 121 # define EC_R_INCOMPATIBLE_OBJECTS 101 # define EC_R_INVALID_ARGUMENT 112 # define EC_R_INVALID_COMPRESSED_POINT 110 # define EC_R_INVALID_COMPRESSION_BIT 109 # define EC_R_INVALID_CURVE 141 # define EC_R_INVALID_DIGEST 151 # define EC_R_INVALID_DIGEST_TYPE 138 # define EC_R_INVALID_ENCODING 102 # define EC_R_INVALID_FIELD 103 # define EC_R_INVALID_FORM 104 # define EC_R_INVALID_GROUP_ORDER 122 # define EC_R_INVALID_PENTANOMIAL_BASIS 132 # define EC_R_INVALID_PRIVATE_KEY 123 # define EC_R_INVALID_TRINOMIAL_BASIS 137 # define EC_R_KDF_PARAMETER_ERROR 148 # define EC_R_KEYS_NOT_SET 140 # define EC_R_MISSING_PARAMETERS 124 # define EC_R_MISSING_PRIVATE_KEY 125 # define EC_R_NOT_A_NIST_PRIME 135 # define EC_R_NOT_A_SUPPORTED_NIST_PRIME 136 # define EC_R_NOT_IMPLEMENTED 126 # define EC_R_NOT_INITIALIZED 111 # define EC_R_NO_FIELD_MOD 133 # define EC_R_NO_PARAMETERS_SET 139 # define EC_R_PASSED_NULL_PARAMETER 134 # define EC_R_PEER_KEY_ERROR 149 # define EC_R_PKPARAMETERS2GROUP_FAILURE 127 # define EC_R_POINT_AT_INFINITY 106 # define EC_R_POINT_IS_NOT_ON_CURVE 107 # define EC_R_SHARED_INFO_ERROR 150 # define EC_R_SLOT_FULL 108 # define EC_R_UNDEFINED_GENERATOR 113 # define EC_R_UNDEFINED_ORDER 128 # define EC_R_UNKNOWN_GROUP 129 # define EC_R_UNKNOWN_ORDER 114 # define EC_R_UNSUPPORTED_FIELD 131 # define EC_R_WRONG_CURVE_PARAMETERS 145 # define EC_R_WRONG_ORDER 130 #ifdef __cplusplus } #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/ui.h����������������������������������������������������������������������������������������0000644�����������������00000044377�14763166030�0007042 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/ui/ui.h */ /* * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project * 2001. */ /* ==================================================================== * Copyright (c) 2001 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_UI_H # define HEADER_UI_H # ifndef OPENSSL_NO_DEPRECATED # include <openssl/crypto.h> # endif # include <openssl/safestack.h> # include <openssl/ossl_typ.h> #ifdef __cplusplus extern "C" { #endif /* Declared already in ossl_typ.h */ /* typedef struct ui_st UI; */ /* typedef struct ui_method_st UI_METHOD; */ /* * All the following functions return -1 or NULL on error and in some cases * (UI_process()) -2 if interrupted or in some other way cancelled. When * everything is fine, they return 0, a positive value or a non-NULL pointer, * all depending on their purpose. */ /* Creators and destructor. */ UI *UI_new(void); UI *UI_new_method(const UI_METHOD *method); void UI_free(UI *ui); /*- The following functions are used to add strings to be printed and prompt strings to prompt for data. The names are UI_{add,dup}_<function>_string and UI_{add,dup}_input_boolean. UI_{add,dup}_<function>_string have the following meanings: add add a text or prompt string. The pointers given to these functions are used verbatim, no copying is done. dup make a copy of the text or prompt string, then add the copy to the collection of strings in the user interface. <function> The function is a name for the functionality that the given string shall be used for. It can be one of: input use the string as data prompt. verify use the string as verification prompt. This is used to verify a previous input. info use the string for informational output. error use the string for error output. Honestly, there's currently no difference between info and error for the moment. UI_{add,dup}_input_boolean have the same semantics for "add" and "dup", and are typically used when one wants to prompt for a yes/no response. All of the functions in this group take a UI and a prompt string. The string input and verify addition functions also take a flag argument, a buffer for the result to end up with, a minimum input size and a maximum input size (the result buffer MUST be large enough to be able to contain the maximum number of characters). Additionally, the verify addition functions takes another buffer to compare the result against. The boolean input functions take an action description string (which should be safe to ignore if the expected user action is obvious, for example with a dialog box with an OK button and a Cancel button), a string of acceptable characters to mean OK and to mean Cancel. The two last strings are checked to make sure they don't have common characters. Additionally, the same flag argument as for the string input is taken, as well as a result buffer. The result buffer is required to be at least one byte long. Depending on the answer, the first character from the OK or the Cancel character strings will be stored in the first byte of the result buffer. No NUL will be added, so the result is *not* a string. On success, the all return an index of the added information. That index is usefull when retrieving results with UI_get0_result(). */ int UI_add_input_string(UI *ui, const char *prompt, int flags, char *result_buf, int minsize, int maxsize); int UI_dup_input_string(UI *ui, const char *prompt, int flags, char *result_buf, int minsize, int maxsize); int UI_add_verify_string(UI *ui, const char *prompt, int flags, char *result_buf, int minsize, int maxsize, const char *test_buf); int UI_dup_verify_string(UI *ui, const char *prompt, int flags, char *result_buf, int minsize, int maxsize, const char *test_buf); int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc, const char *ok_chars, const char *cancel_chars, int flags, char *result_buf); int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc, const char *ok_chars, const char *cancel_chars, int flags, char *result_buf); int UI_add_info_string(UI *ui, const char *text); int UI_dup_info_string(UI *ui, const char *text); int UI_add_error_string(UI *ui, const char *text); int UI_dup_error_string(UI *ui, const char *text); /* These are the possible flags. They can be or'ed together. */ /* Use to have echoing of input */ # define UI_INPUT_FLAG_ECHO 0x01 /* * Use a default password. Where that password is found is completely up to * the application, it might for example be in the user data set with * UI_add_user_data(). It is not recommended to have more than one input in * each UI being marked with this flag, or the application might get * confused. */ # define UI_INPUT_FLAG_DEFAULT_PWD 0x02 /*- * The user of these routines may want to define flags of their own. The core * UI won't look at those, but will pass them on to the method routines. They * must use higher bits so they don't get confused with the UI bits above. * UI_INPUT_FLAG_USER_BASE tells which is the lowest bit to use. A good * example of use is this: * * #define MY_UI_FLAG1 (0x01 << UI_INPUT_FLAG_USER_BASE) * */ # define UI_INPUT_FLAG_USER_BASE 16 /*- * The following function helps construct a prompt. object_desc is a * textual short description of the object, for example "pass phrase", * and object_name is the name of the object (might be a card name or * a file name. * The returned string shall always be allocated on the heap with * OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). * * If the ui_method doesn't contain a pointer to a user-defined prompt * constructor, a default string is built, looking like this: * * "Enter {object_desc} for {object_name}:" * * So, if object_desc has the value "pass phrase" and object_name has * the value "foo.key", the resulting string is: * * "Enter pass phrase for foo.key:" */ char *UI_construct_prompt(UI *ui_method, const char *object_desc, const char *object_name); /* * The following function is used to store a pointer to user-specific data. * Any previous such pointer will be returned and replaced. * * For callback purposes, this function makes a lot more sense than using * ex_data, since the latter requires that different parts of OpenSSL or * applications share the same ex_data index. * * Note that the UI_OpenSSL() method completely ignores the user data. Other * methods may not, however. */ void *UI_add_user_data(UI *ui, void *user_data); /* We need a user data retrieving function as well. */ void *UI_get0_user_data(UI *ui); /* Return the result associated with a prompt given with the index i. */ const char *UI_get0_result(UI *ui, int i); /* When all strings have been added, process the whole thing. */ int UI_process(UI *ui); /* * Give a user interface parametrised control commands. This can be used to * send down an integer, a data pointer or a function pointer, as well as be * used to get information from a UI. */ int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f) (void)); /* The commands */ /* * Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the * OpenSSL error stack before printing any info or added error messages and * before any prompting. */ # define UI_CTRL_PRINT_ERRORS 1 /* * Check if a UI_process() is possible to do again with the same instance of * a user interface. This makes UI_ctrl() return 1 if it is redoable, and 0 * if not. */ # define UI_CTRL_IS_REDOABLE 2 /* Some methods may use extra data */ # define UI_set_app_data(s,arg) UI_set_ex_data(s,0,arg) # define UI_get_app_data(s) UI_get_ex_data(s,0) int UI_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int UI_set_ex_data(UI *r, int idx, void *arg); void *UI_get_ex_data(UI *r, int idx); /* Use specific methods instead of the built-in one */ void UI_set_default_method(const UI_METHOD *meth); const UI_METHOD *UI_get_default_method(void); const UI_METHOD *UI_get_method(UI *ui); const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth); /* The method with all the built-in thingies */ UI_METHOD *UI_OpenSSL(void); /* ---------- For method writers ---------- */ /*- A method contains a number of functions that implement the low level of the User Interface. The functions are: an opener This function starts a session, maybe by opening a channel to a tty, or by opening a window. a writer This function is called to write a given string, maybe to the tty, maybe as a field label in a window. a flusher This function is called to flush everything that has been output so far. It can be used to actually display a dialog box after it has been built. a reader This function is called to read a given prompt, maybe from the tty, maybe from a field in a window. Note that it's called wth all string structures, not only the prompt ones, so it must check such things itself. a closer This function closes the session, maybe by closing the channel to the tty, or closing the window. All these functions are expected to return: 0 on error. 1 on success. -1 on out-of-band events, for example if some prompting has been canceled (by pressing Ctrl-C, for example). This is only checked when returned by the flusher or the reader. The way this is used, the opener is first called, then the writer for all strings, then the flusher, then the reader for all strings and finally the closer. Note that if you want to prompt from a terminal or other command line interface, the best is to have the reader also write the prompts instead of having the writer do it. If you want to prompt from a dialog box, the writer can be used to build up the contents of the box, and the flusher to actually display the box and run the event loop until all data has been given, after which the reader only grabs the given data and puts them back into the UI strings. All method functions take a UI as argument. Additionally, the writer and the reader take a UI_STRING. */ /* * The UI_STRING type is the data structure that contains all the needed info * about a string or a prompt, including test data for a verification prompt. */ typedef struct ui_string_st UI_STRING; DECLARE_STACK_OF(UI_STRING) /* * The different types of strings that are currently supported. This is only * needed by method authors. */ enum UI_string_types { UIT_NONE = 0, UIT_PROMPT, /* Prompt for a string */ UIT_VERIFY, /* Prompt for a string and verify */ UIT_BOOLEAN, /* Prompt for a yes/no response */ UIT_INFO, /* Send info to the user */ UIT_ERROR /* Send an error message to the user */ }; /* Create and manipulate methods */ UI_METHOD *UI_create_method(char *name); void UI_destroy_method(UI_METHOD *ui_method); int UI_method_set_opener(UI_METHOD *method, int (*opener) (UI *ui)); int UI_method_set_writer(UI_METHOD *method, int (*writer) (UI *ui, UI_STRING *uis)); int UI_method_set_flusher(UI_METHOD *method, int (*flusher) (UI *ui)); int UI_method_set_reader(UI_METHOD *method, int (*reader) (UI *ui, UI_STRING *uis)); int UI_method_set_closer(UI_METHOD *method, int (*closer) (UI *ui)); int UI_method_set_prompt_constructor(UI_METHOD *method, char *(*prompt_constructor) (UI *ui, const char *object_desc, const char *object_name)); int (*UI_method_get_opener(UI_METHOD *method)) (UI *); int (*UI_method_get_writer(UI_METHOD *method)) (UI *, UI_STRING *); int (*UI_method_get_flusher(UI_METHOD *method)) (UI *); int (*UI_method_get_reader(UI_METHOD *method)) (UI *, UI_STRING *); int (*UI_method_get_closer(UI_METHOD *method)) (UI *); char *(*UI_method_get_prompt_constructor(UI_METHOD *method)) (UI *, const char *, const char *); /* * The following functions are helpers for method writers to access relevant * data from a UI_STRING. */ /* Return type of the UI_STRING */ enum UI_string_types UI_get_string_type(UI_STRING *uis); /* Return input flags of the UI_STRING */ int UI_get_input_flags(UI_STRING *uis); /* Return the actual string to output (the prompt, info or error) */ const char *UI_get0_output_string(UI_STRING *uis); /* * Return the optional action string to output (the boolean promtp * instruction) */ const char *UI_get0_action_string(UI_STRING *uis); /* Return the result of a prompt */ const char *UI_get0_result_string(UI_STRING *uis); /* * Return the string to test the result against. Only useful with verifies. */ const char *UI_get0_test_string(UI_STRING *uis); /* Return the required minimum size of the result */ int UI_get_result_minsize(UI_STRING *uis); /* Return the required maximum size of the result */ int UI_get_result_maxsize(UI_STRING *uis); /* Set the result of a UI_STRING. */ int UI_set_result(UI *ui, UI_STRING *uis, const char *result); /* A couple of popular utility functions */ int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt, int verify); int UI_UTIL_read_pw(char *buf, char *buff, int size, const char *prompt, int verify); /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_UI_strings(void); /* Error codes for the UI functions. */ /* Function codes. */ # define UI_F_GENERAL_ALLOCATE_BOOLEAN 108 # define UI_F_GENERAL_ALLOCATE_PROMPT 109 # define UI_F_GENERAL_ALLOCATE_STRING 100 # define UI_F_UI_CTRL 111 # define UI_F_UI_DUP_ERROR_STRING 101 # define UI_F_UI_DUP_INFO_STRING 102 # define UI_F_UI_DUP_INPUT_BOOLEAN 110 # define UI_F_UI_DUP_INPUT_STRING 103 # define UI_F_UI_DUP_VERIFY_STRING 106 # define UI_F_UI_GET0_RESULT 107 # define UI_F_UI_NEW_METHOD 104 # define UI_F_UI_SET_RESULT 105 /* Reason codes. */ # define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS 104 # define UI_R_INDEX_TOO_LARGE 102 # define UI_R_INDEX_TOO_SMALL 103 # define UI_R_NO_RESULT_BUFFER 105 # define UI_R_RESULT_TOO_LARGE 100 # define UI_R_RESULT_TOO_SMALL 101 # define UI_R_UNKNOWN_CONTROL_COMMAND 106 #ifdef __cplusplus } #endif #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/conf_api.h����������������������������������������������������������������������������������0000644�����������������00000010063�14763166030�0010164 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* conf_api.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_CONF_API_H # define HEADER_CONF_API_H # include <openssl/lhash.h> # include <openssl/conf.h> #ifdef __cplusplus extern "C" { #endif /* Up until OpenSSL 0.9.5a, this was new_section */ CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); /* Up until OpenSSL 0.9.5a, this was get_section */ CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, const char *section); int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); char *_CONF_get_string(const CONF *conf, const char *section, const char *name); long _CONF_get_number(const CONF *conf, const char *section, const char *name); int _CONF_new_data(CONF *conf); void _CONF_free_data(CONF *conf); #ifdef __cplusplus } #endif #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/modes.h�������������������������������������������������������������������������������������0000644�����������������00000020722�14763166030�0007520 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ==================================================================== * Copyright (c) 2008 The OpenSSL Project. All rights reserved. * * Rights for redistribution and usage in source and binary * forms are granted according to the OpenSSL license. */ #include <stddef.h> #ifdef __cplusplus extern "C" { #endif typedef void (*block128_f) (const unsigned char in[16], unsigned char out[16], const void *key); typedef void (*cbc128_f) (const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], int enc); typedef void (*ctr128_f) (const unsigned char *in, unsigned char *out, size_t blocks, const void *key, const unsigned char ivec[16]); typedef void (*ccm128_f) (const unsigned char *in, unsigned char *out, size_t blocks, const void *key, const unsigned char ivec[16], unsigned char cmac[16]); void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], block128_f block); void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], block128_f block); void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], unsigned char ecount_buf[16], unsigned int *num, block128_f block); void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], unsigned char ecount_buf[16], unsigned int *num, ctr128_f ctr); void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], int *num, block128_f block); void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], int *num, int enc, block128_f block); void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out, size_t length, const void *key, unsigned char ivec[16], int *num, int enc, block128_f block); void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out, size_t bits, const void *key, unsigned char ivec[16], int *num, int enc, block128_f block); size_t CRYPTO_cts128_encrypt_block(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], block128_f block); size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], cbc128_f cbc); size_t CRYPTO_cts128_decrypt_block(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], block128_f block); size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], cbc128_f cbc); size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], block128_f block); size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], cbc128_f cbc); size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], block128_f block); size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], cbc128_f cbc); typedef struct gcm128_context GCM128_CONTEXT; GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block); void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block); void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, size_t len); int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, size_t len); int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, const unsigned char *in, unsigned char *out, size_t len); int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, const unsigned char *in, unsigned char *out, size_t len); int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, const unsigned char *in, unsigned char *out, size_t len, ctr128_f stream); int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, const unsigned char *in, unsigned char *out, size_t len, ctr128_f stream); int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag, size_t len); void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len); void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx); typedef struct ccm128_context CCM128_CONTEXT; void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx, unsigned int M, unsigned int L, void *key, block128_f block); int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, const unsigned char *nonce, size_t nlen, size_t mlen); void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, const unsigned char *aad, size_t alen); int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, unsigned char *out, size_t len); int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, unsigned char *out, size_t len); int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, unsigned char *out, size_t len, ccm128_f stream); int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, unsigned char *out, size_t len, ccm128_f stream); size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len); typedef struct xts128_context XTS128_CONTEXT; int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], const unsigned char *inp, unsigned char *out, size_t len, int enc); size_t CRYPTO_128_wrap(void *key, const unsigned char *iv, unsigned char *out, const unsigned char *in, size_t inlen, block128_f block); size_t CRYPTO_128_unwrap(void *key, const unsigned char *iv, unsigned char *out, const unsigned char *in, size_t inlen, block128_f block); size_t CRYPTO_128_wrap_pad(void *key, const unsigned char *icv, unsigned char *out, const unsigned char *in, size_t inlen, block128_f block); size_t CRYPTO_128_unwrap_pad(void *key, const unsigned char *icv, unsigned char *out, const unsigned char *in, size_t inlen, block128_f block); #ifdef __cplusplus } #endif ����������������������������������������������openssl/engine.h������������������������������������������������������������������������������������0000644�����������������00000127622�14763166030�0007665 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* openssl/engine.h */ /* * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project * 2000. */ /* ==================================================================== * Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * licensing@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * ECDH support in OpenSSL originally developed by * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. */ #ifndef HEADER_ENGINE_H # define HEADER_ENGINE_H # include <openssl/opensslconf.h> # ifdef OPENSSL_NO_ENGINE # error ENGINE is disabled. # endif # ifndef OPENSSL_NO_DEPRECATED # include <openssl/bn.h> # ifndef OPENSSL_NO_RSA # include <openssl/rsa.h> # endif # ifndef OPENSSL_NO_DSA # include <openssl/dsa.h> # endif # ifndef OPENSSL_NO_DH # include <openssl/dh.h> # endif # ifndef OPENSSL_NO_ECDH # include <openssl/ecdh.h> # endif # ifndef OPENSSL_NO_ECDSA # include <openssl/ecdsa.h> # endif # include <openssl/rand.h> # include <openssl/ui.h> # include <openssl/err.h> # endif # include <openssl/ossl_typ.h> # include <openssl/symhacks.h> # include <openssl/x509.h> #ifdef __cplusplus extern "C" { #endif /* * These flags are used to control combinations of algorithm (methods) by * bitwise "OR"ing. */ # define ENGINE_METHOD_RSA (unsigned int)0x0001 # define ENGINE_METHOD_DSA (unsigned int)0x0002 # define ENGINE_METHOD_DH (unsigned int)0x0004 # define ENGINE_METHOD_RAND (unsigned int)0x0008 # define ENGINE_METHOD_ECDH (unsigned int)0x0010 # define ENGINE_METHOD_ECDSA (unsigned int)0x0020 # define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 # define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 # define ENGINE_METHOD_STORE (unsigned int)0x0100 # define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200 # define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400 /* Obvious all-or-nothing cases. */ # define ENGINE_METHOD_ALL (unsigned int)0xFFFF # define ENGINE_METHOD_NONE (unsigned int)0x0000 /* * This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used * internally to control registration of ENGINE implementations, and can be * set by ENGINE_set_table_flags(). The "NOINIT" flag prevents attempts to * initialise registered ENGINEs if they are not already initialised. */ # define ENGINE_TABLE_FLAG_NOINIT (unsigned int)0x0001 /* ENGINE flags that can be set by ENGINE_set_flags(). */ /* Not used */ /* #define ENGINE_FLAGS_MALLOCED 0x0001 */ /* * This flag is for ENGINEs that wish to handle the various 'CMD'-related * control commands on their own. Without this flag, ENGINE_ctrl() handles * these control commands on behalf of the ENGINE using their "cmd_defns" * data. */ # define ENGINE_FLAGS_MANUAL_CMD_CTRL (int)0x0002 /* * This flag is for ENGINEs who return new duplicate structures when found * via "ENGINE_by_id()". When an ENGINE must store state (eg. if * ENGINE_ctrl() commands are called in sequence as part of some stateful * process like key-generation setup and execution), it can set this flag - * then each attempt to obtain the ENGINE will result in it being copied into * a new structure. Normally, ENGINEs don't declare this flag so * ENGINE_by_id() just increments the existing ENGINE's structural reference * count. */ # define ENGINE_FLAGS_BY_ID_COPY (int)0x0004 /* * This flag if for an ENGINE that does not want its methods registered as * part of ENGINE_register_all_complete() for example if the methods are not * usable as default methods. */ # define ENGINE_FLAGS_NO_REGISTER_ALL (int)0x0008 /* * ENGINEs can support their own command types, and these flags are used in * ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input * each command expects. Currently only numeric and string input is * supported. If a control command supports none of the _NUMERIC, _STRING, or * _NO_INPUT options, then it is regarded as an "internal" control command - * and not for use in config setting situations. As such, they're not * available to the ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl() * access. Changes to this list of 'command types' should be reflected * carefully in ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string(). */ /* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */ # define ENGINE_CMD_FLAG_NUMERIC (unsigned int)0x0001 /* * accepts string input (cast from 'void*' to 'const char *', 4th parameter * to ENGINE_ctrl) */ # define ENGINE_CMD_FLAG_STRING (unsigned int)0x0002 /* * Indicates that the control command takes *no* input. Ie. the control * command is unparameterised. */ # define ENGINE_CMD_FLAG_NO_INPUT (unsigned int)0x0004 /* * Indicates that the control command is internal. This control command won't * be shown in any output, and is only usable through the ENGINE_ctrl_cmd() * function. */ # define ENGINE_CMD_FLAG_INTERNAL (unsigned int)0x0008 /* * NB: These 3 control commands are deprecated and should not be used. * ENGINEs relying on these commands should compile conditional support for * compatibility (eg. if these symbols are defined) but should also migrate * the same functionality to their own ENGINE-specific control functions that * can be "discovered" by calling applications. The fact these control * commands wouldn't be "executable" (ie. usable by text-based config) * doesn't change the fact that application code can find and use them * without requiring per-ENGINE hacking. */ /* * These flags are used to tell the ctrl function what should be done. All * command numbers are shared between all engines, even if some don't make * sense to some engines. In such a case, they do nothing but return the * error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED. */ # define ENGINE_CTRL_SET_LOGSTREAM 1 # define ENGINE_CTRL_SET_PASSWORD_CALLBACK 2 # define ENGINE_CTRL_HUP 3/* Close and reinitialise * any handles/connections * etc. */ # define ENGINE_CTRL_SET_USER_INTERFACE 4/* Alternative to callback */ # define ENGINE_CTRL_SET_CALLBACK_DATA 5/* User-specific data, used * when calling the password * callback and the user * interface */ # define ENGINE_CTRL_LOAD_CONFIGURATION 6/* Load a configuration, * given a string that * represents a file name * or so */ # define ENGINE_CTRL_LOAD_SECTION 7/* Load data from a given * section in the already * loaded configuration */ /* * These control commands allow an application to deal with an arbitrary * engine in a dynamic way. Warn: Negative return values indicate errors FOR * THESE COMMANDS because zero is used to indicate 'end-of-list'. Other * commands, including ENGINE-specific command types, return zero for an * error. An ENGINE can choose to implement these ctrl functions, and can * internally manage things however it chooses - it does so by setting the * ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise * the ENGINE_ctrl() code handles this on the ENGINE's behalf using the * cmd_defns data (set using ENGINE_set_cmd_defns()). This means an ENGINE's * ctrl() handler need only implement its own commands - the above "meta" * commands will be taken care of. */ /* * Returns non-zero if the supplied ENGINE has a ctrl() handler. If "not", * then all the remaining control commands will return failure, so it is * worth checking this first if the caller is trying to "discover" the * engine's capabilities and doesn't want errors generated unnecessarily. */ # define ENGINE_CTRL_HAS_CTRL_FUNCTION 10 /* * Returns a positive command number for the first command supported by the * engine. Returns zero if no ctrl commands are supported. */ # define ENGINE_CTRL_GET_FIRST_CMD_TYPE 11 /* * The 'long' argument specifies a command implemented by the engine, and the * return value is the next command supported, or zero if there are no more. */ # define ENGINE_CTRL_GET_NEXT_CMD_TYPE 12 /* * The 'void*' argument is a command name (cast from 'const char *'), and the * return value is the command that corresponds to it. */ # define ENGINE_CTRL_GET_CMD_FROM_NAME 13 /* * The next two allow a command to be converted into its corresponding string * form. In each case, the 'long' argument supplies the command. In the * NAME_LEN case, the return value is the length of the command name (not * counting a trailing EOL). In the NAME case, the 'void*' argument must be a * string buffer large enough, and it will be populated with the name of the * command (WITH a trailing EOL). */ # define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD 14 # define ENGINE_CTRL_GET_NAME_FROM_CMD 15 /* The next two are similar but give a "short description" of a command. */ # define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD 16 # define ENGINE_CTRL_GET_DESC_FROM_CMD 17 /* * With this command, the return value is the OR'd combination of * ENGINE_CMD_FLAG_*** values that indicate what kind of input a given * engine-specific ctrl command expects. */ # define ENGINE_CTRL_GET_CMD_FLAGS 18 /* * ENGINE implementations should start the numbering of their own control * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). */ # define ENGINE_CMD_BASE 200 /* * NB: These 2 nCipher "chil" control commands are deprecated, and their * functionality is now available through ENGINE-specific control commands * (exposed through the above-mentioned 'CMD'-handling). Code using these 2 * commands should be migrated to the more general command handling before * these are removed. */ /* Flags specific to the nCipher "chil" engine */ # define ENGINE_CTRL_CHIL_SET_FORKCHECK 100 /* * Depending on the value of the (long)i argument, this sets or * unsets the SimpleForkCheck flag in the CHIL API to enable or * disable checking and workarounds for applications that fork(). */ # define ENGINE_CTRL_CHIL_NO_LOCKING 101 /* * This prevents the initialisation function from providing mutex * callbacks to the nCipher library. */ /* * If an ENGINE supports its own specific control commands and wishes the * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on * its behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN * entries to ENGINE_set_cmd_defns(). It should also implement a ctrl() * handler that supports the stated commands (ie. the "cmd_num" entries as * described by the array). NB: The array must be ordered in increasing order * of cmd_num. "null-terminated" means that the last ENGINE_CMD_DEFN element * has cmd_num set to zero and/or cmd_name set to NULL. */ typedef struct ENGINE_CMD_DEFN_st { unsigned int cmd_num; /* The command number */ const char *cmd_name; /* The command name itself */ const char *cmd_desc; /* A short description of the command */ unsigned int cmd_flags; /* The input the command expects */ } ENGINE_CMD_DEFN; /* Generic function pointer */ typedef int (*ENGINE_GEN_FUNC_PTR) (void); /* Generic function pointer taking no arguments */ typedef int (*ENGINE_GEN_INT_FUNC_PTR) (ENGINE *); /* Specific control function pointer */ typedef int (*ENGINE_CTRL_FUNC_PTR) (ENGINE *, int, long, void *, void (*f) (void)); /* Generic load_key function pointer */ typedef EVP_PKEY *(*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *, UI_METHOD *ui_method, void *callback_data); typedef int (*ENGINE_SSL_CLIENT_CERT_PTR) (ENGINE *, SSL *ssl, STACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **pkey, STACK_OF(X509) **pother, UI_METHOD *ui_method, void *callback_data); /*- * These callback types are for an ENGINE's handler for cipher and digest logic. * These handlers have these prototypes; * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); * int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid); * Looking at how to implement these handlers in the case of cipher support, if * the framework wants the EVP_CIPHER for 'nid', it will call; * foo(e, &p_evp_cipher, NULL, nid); (return zero for failure) * If the framework wants a list of supported 'nid's, it will call; * foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error) */ /* * Returns to a pointer to the array of supported cipher 'nid's. If the * second parameter is non-NULL it is set to the size of the returned array. */ typedef int (*ENGINE_CIPHERS_PTR) (ENGINE *, const EVP_CIPHER **, const int **, int); typedef int (*ENGINE_DIGESTS_PTR) (ENGINE *, const EVP_MD **, const int **, int); typedef int (*ENGINE_PKEY_METHS_PTR) (ENGINE *, EVP_PKEY_METHOD **, const int **, int); typedef int (*ENGINE_PKEY_ASN1_METHS_PTR) (ENGINE *, EVP_PKEY_ASN1_METHOD **, const int **, int); /* * STRUCTURE functions ... all of these functions deal with pointers to * ENGINE structures where the pointers have a "structural reference". This * means that their reference is to allowed access to the structure but it * does not imply that the structure is functional. To simply increment or * decrement the structural reference count, use ENGINE_by_id and * ENGINE_free. NB: This is not required when iterating using ENGINE_get_next * as it will automatically decrement the structural reference count of the * "current" ENGINE and increment the structural reference count of the * ENGINE it returns (unless it is NULL). */ /* Get the first/last "ENGINE" type available. */ ENGINE *ENGINE_get_first(void); ENGINE *ENGINE_get_last(void); /* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */ ENGINE *ENGINE_get_next(ENGINE *e); ENGINE *ENGINE_get_prev(ENGINE *e); /* Add another "ENGINE" type into the array. */ int ENGINE_add(ENGINE *e); /* Remove an existing "ENGINE" type from the array. */ int ENGINE_remove(ENGINE *e); /* Retrieve an engine from the list by its unique "id" value. */ ENGINE *ENGINE_by_id(const char *id); /* Add all the built-in engines. */ void ENGINE_load_openssl(void); void ENGINE_load_dynamic(void); # ifndef OPENSSL_NO_STATIC_ENGINE void ENGINE_load_4758cca(void); void ENGINE_load_aep(void); void ENGINE_load_atalla(void); void ENGINE_load_chil(void); void ENGINE_load_cswift(void); void ENGINE_load_nuron(void); void ENGINE_load_sureware(void); void ENGINE_load_ubsec(void); void ENGINE_load_padlock(void); void ENGINE_load_capi(void); # ifndef OPENSSL_NO_GMP void ENGINE_load_gmp(void); # endif # ifndef OPENSSL_NO_GOST void ENGINE_load_gost(void); # endif # endif void ENGINE_load_cryptodev(void); void ENGINE_load_rdrand(void); void ENGINE_load_builtin_engines(void); /* * Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation * "registry" handling. */ unsigned int ENGINE_get_table_flags(void); void ENGINE_set_table_flags(unsigned int flags); /*- Manage registration of ENGINEs per "table". For each type, there are 3 * functions; * ENGINE_register_***(e) - registers the implementation from 'e' (if it has one) * ENGINE_unregister_***(e) - unregister the implementation from 'e' * ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list * Cleanup is automatically registered from each table when required, so * ENGINE_cleanup() will reverse any "register" operations. */ int ENGINE_register_RSA(ENGINE *e); void ENGINE_unregister_RSA(ENGINE *e); void ENGINE_register_all_RSA(void); int ENGINE_register_DSA(ENGINE *e); void ENGINE_unregister_DSA(ENGINE *e); void ENGINE_register_all_DSA(void); int ENGINE_register_ECDH(ENGINE *e); void ENGINE_unregister_ECDH(ENGINE *e); void ENGINE_register_all_ECDH(void); int ENGINE_register_ECDSA(ENGINE *e); void ENGINE_unregister_ECDSA(ENGINE *e); void ENGINE_register_all_ECDSA(void); int ENGINE_register_DH(ENGINE *e); void ENGINE_unregister_DH(ENGINE *e); void ENGINE_register_all_DH(void); int ENGINE_register_RAND(ENGINE *e); void ENGINE_unregister_RAND(ENGINE *e); void ENGINE_register_all_RAND(void); int ENGINE_register_STORE(ENGINE *e); void ENGINE_unregister_STORE(ENGINE *e); void ENGINE_register_all_STORE(void); int ENGINE_register_ciphers(ENGINE *e); void ENGINE_unregister_ciphers(ENGINE *e); void ENGINE_register_all_ciphers(void); int ENGINE_register_digests(ENGINE *e); void ENGINE_unregister_digests(ENGINE *e); void ENGINE_register_all_digests(void); int ENGINE_register_pkey_meths(ENGINE *e); void ENGINE_unregister_pkey_meths(ENGINE *e); void ENGINE_register_all_pkey_meths(void); int ENGINE_register_pkey_asn1_meths(ENGINE *e); void ENGINE_unregister_pkey_asn1_meths(ENGINE *e); void ENGINE_register_all_pkey_asn1_meths(void); /* * These functions register all support from the above categories. Note, use * of these functions can result in static linkage of code your application * may not need. If you only need a subset of functionality, consider using * more selective initialisation. */ int ENGINE_register_complete(ENGINE *e); int ENGINE_register_all_complete(void); /* * Send parametrised control commands to the engine. The possibilities to * send down an integer, a pointer to data or a function pointer are * provided. Any of the parameters may or may not be NULL, depending on the * command number. In actuality, this function only requires a structural * (rather than functional) reference to an engine, but many control commands * may require the engine be functional. The caller should be aware of trying * commands that require an operational ENGINE, and only use functional * references in such situations. */ int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void)); /* * This function tests if an ENGINE-specific command is usable as a * "setting". Eg. in an application's config file that gets processed through * ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to * ENGINE_ctrl_cmd_string(), only ENGINE_ctrl(). */ int ENGINE_cmd_is_executable(ENGINE *e, int cmd); /* * This function works like ENGINE_ctrl() with the exception of taking a * command name instead of a command number, and can handle optional * commands. See the comment on ENGINE_ctrl_cmd_string() for an explanation * on how to use the cmd_name and cmd_optional. */ int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, long i, void *p, void (*f) (void), int cmd_optional); /* * This function passes a command-name and argument to an ENGINE. The * cmd_name is converted to a command number and the control command is * called using 'arg' as an argument (unless the ENGINE doesn't support such * a command, in which case no control command is called). The command is * checked for input flags, and if necessary the argument will be converted * to a numeric value. If cmd_optional is non-zero, then if the ENGINE * doesn't support the given cmd_name the return value will be success * anyway. This function is intended for applications to use so that users * (or config files) can supply engine-specific config data to the ENGINE at * run-time to control behaviour of specific engines. As such, it shouldn't * be used for calling ENGINE_ctrl() functions that return data, deal with * binary data, or that are otherwise supposed to be used directly through * ENGINE_ctrl() in application code. Any "return" data from an ENGINE_ctrl() * operation in this function will be lost - the return value is interpreted * as failure if the return value is zero, success otherwise, and this * function returns a boolean value as a result. In other words, vendors of * 'ENGINE'-enabled devices should write ENGINE implementations with * parameterisations that work in this scheme, so that compliant ENGINE-based * applications can work consistently with the same configuration for the * same ENGINE-enabled devices, across applications. */ int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, int cmd_optional); /* * These functions are useful for manufacturing new ENGINE structures. They * don't address reference counting at all - one uses them to populate an * ENGINE structure with personalised implementations of things prior to * using it directly or adding it to the builtin ENGINE list in OpenSSL. * These are also here so that the ENGINE structure doesn't have to be * exposed and break binary compatibility! */ ENGINE *ENGINE_new(void); int ENGINE_free(ENGINE *e); int ENGINE_up_ref(ENGINE *e); int ENGINE_set_id(ENGINE *e, const char *id); int ENGINE_set_name(ENGINE *e, const char *name); int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); int ENGINE_set_ECDH(ENGINE *e, const ECDH_METHOD *ecdh_meth); int ENGINE_set_ECDSA(ENGINE *e, const ECDSA_METHOD *ecdsa_meth); int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); int ENGINE_set_STORE(ENGINE *e, const STORE_METHOD *store_meth); int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f); int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f); int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f); int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f); int ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f); int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f); int ENGINE_set_load_ssl_client_cert_function(ENGINE *e, ENGINE_SSL_CLIENT_CERT_PTR loadssl_f); int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f); int ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f); int ENGINE_set_flags(ENGINE *e, int flags); int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns); /* These functions allow control over any per-structure ENGINE data. */ int ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg); void *ENGINE_get_ex_data(const ENGINE *e, int idx); /* * This function cleans up anything that needs it. Eg. the ENGINE_add() * function automatically ensures the list cleanup function is registered to * be called from ENGINE_cleanup(). Similarly, all ENGINE_register_*** * functions ensure ENGINE_cleanup() will clean up after them. */ void ENGINE_cleanup(void); /* * These return values from within the ENGINE structure. These can be useful * with functional references as well as structural references - it depends * which you obtained. Using the result for functional purposes if you only * obtained a structural reference may be problematic! */ const char *ENGINE_get_id(const ENGINE *e); const char *ENGINE_get_name(const ENGINE *e); const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); const ECDH_METHOD *ENGINE_get_ECDH(const ENGINE *e); const ECDSA_METHOD *ENGINE_get_ECDSA(const ENGINE *e); const DH_METHOD *ENGINE_get_DH(const ENGINE *e); const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); const STORE_METHOD *ENGINE_get_STORE(const ENGINE *e); ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e); ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e); ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e); ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e); ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e); ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e); ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE *e); ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e); ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e); ENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e); ENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e); const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid); const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid); const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid); const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid); const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e, const char *str, int len); const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe, const char *str, int len); const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e); int ENGINE_get_flags(const ENGINE *e); /* * FUNCTIONAL functions. These functions deal with ENGINE structures that * have (or will) be initialised for use. Broadly speaking, the structural * functions are useful for iterating the list of available engine types, * creating new engine types, and other "list" operations. These functions * actually deal with ENGINEs that are to be used. As such these functions * can fail (if applicable) when particular engines are unavailable - eg. if * a hardware accelerator is not attached or not functioning correctly. Each * ENGINE has 2 reference counts; structural and functional. Every time a * functional reference is obtained or released, a corresponding structural * reference is automatically obtained or released too. */ /* * Initialise a engine type for use (or up its reference count if it's * already in use). This will fail if the engine is not currently operational * and cannot initialise. */ int ENGINE_init(ENGINE *e); /* * Free a functional reference to a engine type. This does not require a * corresponding call to ENGINE_free as it also releases a structural * reference. */ int ENGINE_finish(ENGINE *e); /* * The following functions handle keys that are stored in some secondary * location, handled by the engine. The storage may be on a card or * whatever. */ EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, UI_METHOD *ui_method, void *callback_data); EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, UI_METHOD *ui_method, void *callback_data); int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s, STACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **ppkey, STACK_OF(X509) **pother, UI_METHOD *ui_method, void *callback_data); /* * This returns a pointer for the current ENGINE structure that is (by * default) performing any RSA operations. The value returned is an * incremented reference, so it should be free'd (ENGINE_finish) before it is * discarded. */ ENGINE *ENGINE_get_default_RSA(void); /* Same for the other "methods" */ ENGINE *ENGINE_get_default_DSA(void); ENGINE *ENGINE_get_default_ECDH(void); ENGINE *ENGINE_get_default_ECDSA(void); ENGINE *ENGINE_get_default_DH(void); ENGINE *ENGINE_get_default_RAND(void); /* * These functions can be used to get a functional reference to perform * ciphering or digesting corresponding to "nid". */ ENGINE *ENGINE_get_cipher_engine(int nid); ENGINE *ENGINE_get_digest_engine(int nid); ENGINE *ENGINE_get_pkey_meth_engine(int nid); ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid); /* * This sets a new default ENGINE structure for performing RSA operations. If * the result is non-zero (success) then the ENGINE structure will have had * its reference count up'd so the caller should still free their own * reference 'e'. */ int ENGINE_set_default_RSA(ENGINE *e); int ENGINE_set_default_string(ENGINE *e, const char *def_list); /* Same for the other "methods" */ int ENGINE_set_default_DSA(ENGINE *e); int ENGINE_set_default_ECDH(ENGINE *e); int ENGINE_set_default_ECDSA(ENGINE *e); int ENGINE_set_default_DH(ENGINE *e); int ENGINE_set_default_RAND(ENGINE *e); int ENGINE_set_default_ciphers(ENGINE *e); int ENGINE_set_default_digests(ENGINE *e); int ENGINE_set_default_pkey_meths(ENGINE *e); int ENGINE_set_default_pkey_asn1_meths(ENGINE *e); /* * The combination "set" - the flags are bitwise "OR"d from the * ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()" * function, this function can result in unnecessary static linkage. If your * application requires only specific functionality, consider using more * selective functions. */ int ENGINE_set_default(ENGINE *e, unsigned int flags); void ENGINE_add_conf_module(void); /* Deprecated functions ... */ /* int ENGINE_clear_defaults(void); */ /**************************/ /* DYNAMIC ENGINE SUPPORT */ /**************************/ /* Binary/behaviour compatibility levels */ # define OSSL_DYNAMIC_VERSION (unsigned long)0x00020000 /* * Binary versions older than this are too old for us (whether we're a loader * or a loadee) */ # define OSSL_DYNAMIC_OLDEST (unsigned long)0x00020000 /* * When compiling an ENGINE entirely as an external shared library, loadable * by the "dynamic" ENGINE, these types are needed. The 'dynamic_fns' * structure type provides the calling application's (or library's) error * functionality and memory management function pointers to the loaded * library. These should be used/set in the loaded library code so that the * loading application's 'state' will be used/changed in all operations. The * 'static_state' pointer allows the loaded library to know if it shares the * same static data as the calling application (or library), and thus whether * these callbacks need to be set or not. */ typedef void *(*dyn_MEM_malloc_cb) (size_t); typedef void *(*dyn_MEM_realloc_cb) (void *, size_t); typedef void (*dyn_MEM_free_cb) (void *); typedef struct st_dynamic_MEM_fns { dyn_MEM_malloc_cb malloc_cb; dyn_MEM_realloc_cb realloc_cb; dyn_MEM_free_cb free_cb; } dynamic_MEM_fns; /* * FIXME: Perhaps the memory and locking code (crypto.h) should declare and * use these types so we (and any other dependant code) can simplify a bit?? */ typedef void (*dyn_lock_locking_cb) (int, int, const char *, int); typedef int (*dyn_lock_add_lock_cb) (int *, int, int, const char *, int); typedef struct CRYPTO_dynlock_value *(*dyn_dynlock_create_cb) (const char *, int); typedef void (*dyn_dynlock_lock_cb) (int, struct CRYPTO_dynlock_value *, const char *, int); typedef void (*dyn_dynlock_destroy_cb) (struct CRYPTO_dynlock_value *, const char *, int); typedef struct st_dynamic_LOCK_fns { dyn_lock_locking_cb lock_locking_cb; dyn_lock_add_lock_cb lock_add_lock_cb; dyn_dynlock_create_cb dynlock_create_cb; dyn_dynlock_lock_cb dynlock_lock_cb; dyn_dynlock_destroy_cb dynlock_destroy_cb; } dynamic_LOCK_fns; /* The top-level structure */ typedef struct st_dynamic_fns { void *static_state; const ERR_FNS *err_fns; const CRYPTO_EX_DATA_IMPL *ex_data_fns; dynamic_MEM_fns mem_fns; dynamic_LOCK_fns lock_fns; } dynamic_fns; /* * The version checking function should be of this prototype. NB: The * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading * code. If this function returns zero, it indicates a (potential) version * incompatibility and the loaded library doesn't believe it can proceed. * Otherwise, the returned value is the (latest) version supported by the * loading library. The loader may still decide that the loaded code's * version is unsatisfactory and could veto the load. The function is * expected to be implemented with the symbol name "v_check", and a default * implementation can be fully instantiated with * IMPLEMENT_DYNAMIC_CHECK_FN(). */ typedef unsigned long (*dynamic_v_check_fn) (unsigned long ossl_version); # define IMPLEMENT_DYNAMIC_CHECK_FN() \ OPENSSL_EXPORT unsigned long v_check(unsigned long v); \ OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \ if(v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \ return 0; } /* * This function is passed the ENGINE structure to initialise with its own * function and command settings. It should not adjust the structural or * functional reference counts. If this function returns zero, (a) the load * will be aborted, (b) the previous ENGINE state will be memcpy'd back onto * the structure, and (c) the shared library will be unloaded. So * implementations should do their own internal cleanup in failure * circumstances otherwise they could leak. The 'id' parameter, if non-NULL, * represents the ENGINE id that the loader is looking for. If this is NULL, * the shared library can choose to return failure or to initialise a * 'default' ENGINE. If non-NULL, the shared library must initialise only an * ENGINE matching the passed 'id'. The function is expected to be * implemented with the symbol name "bind_engine". A standard implementation * can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where the parameter * 'fn' is a callback function that populates the ENGINE structure and * returns an int value (zero for failure). 'fn' should have prototype; * [static] int fn(ENGINE *e, const char *id); */ typedef int (*dynamic_bind_engine) (ENGINE *e, const char *id, const dynamic_fns *fns); # define IMPLEMENT_DYNAMIC_BIND_FN(fn) \ OPENSSL_EXPORT \ int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \ OPENSSL_EXPORT \ int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \ if(ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \ if(!CRYPTO_set_mem_functions(fns->mem_fns.malloc_cb, \ fns->mem_fns.realloc_cb, fns->mem_fns.free_cb)) \ return 0; \ CRYPTO_set_locking_callback(fns->lock_fns.lock_locking_cb); \ CRYPTO_set_add_lock_callback(fns->lock_fns.lock_add_lock_cb); \ CRYPTO_set_dynlock_create_callback(fns->lock_fns.dynlock_create_cb); \ CRYPTO_set_dynlock_lock_callback(fns->lock_fns.dynlock_lock_cb); \ CRYPTO_set_dynlock_destroy_callback(fns->lock_fns.dynlock_destroy_cb); \ if(!CRYPTO_set_ex_data_implementation(fns->ex_data_fns)) \ return 0; \ if(!ERR_set_implementation(fns->err_fns)) return 0; \ skip_cbs: \ if(!fn(e,id)) return 0; \ return 1; } /* * If the loading application (or library) and the loaded ENGINE library * share the same static data (eg. they're both dynamically linked to the * same libcrypto.so) we need a way to avoid trying to set system callbacks - * this would fail, and for the same reason that it's unnecessary to try. If * the loaded ENGINE has (or gets from through the loader) its own copy of * the libcrypto static data, we will need to set the callbacks. The easiest * way to detect this is to have a function that returns a pointer to some * static data and let the loading application and loaded ENGINE compare * their respective values. */ void *ENGINE_get_static_state(void); # if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV) void ENGINE_setup_bsd_cryptodev(void); # endif /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_ENGINE_strings(void); /* Error codes for the ENGINE functions. */ /* Function codes. */ # define ENGINE_F_DYNAMIC_CTRL 180 # define ENGINE_F_DYNAMIC_GET_DATA_CTX 181 # define ENGINE_F_DYNAMIC_LOAD 182 # define ENGINE_F_DYNAMIC_SET_DATA_CTX 183 # define ENGINE_F_ENGINE_ADD 105 # define ENGINE_F_ENGINE_BY_ID 106 # define ENGINE_F_ENGINE_CMD_IS_EXECUTABLE 170 # define ENGINE_F_ENGINE_CTRL 142 # define ENGINE_F_ENGINE_CTRL_CMD 178 # define ENGINE_F_ENGINE_CTRL_CMD_STRING 171 # define ENGINE_F_ENGINE_FINISH 107 # define ENGINE_F_ENGINE_FREE_UTIL 108 # define ENGINE_F_ENGINE_GET_CIPHER 185 # define ENGINE_F_ENGINE_GET_DEFAULT_TYPE 177 # define ENGINE_F_ENGINE_GET_DIGEST 186 # define ENGINE_F_ENGINE_GET_NEXT 115 # define ENGINE_F_ENGINE_GET_PKEY_ASN1_METH 193 # define ENGINE_F_ENGINE_GET_PKEY_METH 192 # define ENGINE_F_ENGINE_GET_PREV 116 # define ENGINE_F_ENGINE_INIT 119 # define ENGINE_F_ENGINE_LIST_ADD 120 # define ENGINE_F_ENGINE_LIST_REMOVE 121 # define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY 150 # define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY 151 # define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT 194 # define ENGINE_F_ENGINE_NEW 122 # define ENGINE_F_ENGINE_REMOVE 123 # define ENGINE_F_ENGINE_SET_DEFAULT_STRING 189 # define ENGINE_F_ENGINE_SET_DEFAULT_TYPE 126 # define ENGINE_F_ENGINE_SET_ID 129 # define ENGINE_F_ENGINE_SET_NAME 130 # define ENGINE_F_ENGINE_TABLE_REGISTER 184 # define ENGINE_F_ENGINE_UNLOAD_KEY 152 # define ENGINE_F_ENGINE_UNLOCKED_FINISH 191 # define ENGINE_F_ENGINE_UP_REF 190 # define ENGINE_F_INT_CTRL_HELPER 172 # define ENGINE_F_INT_ENGINE_CONFIGURE 188 # define ENGINE_F_INT_ENGINE_MODULE_INIT 187 # define ENGINE_F_LOG_MESSAGE 141 /* Reason codes. */ # define ENGINE_R_ALREADY_LOADED 100 # define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER 133 # define ENGINE_R_CMD_NOT_EXECUTABLE 134 # define ENGINE_R_COMMAND_TAKES_INPUT 135 # define ENGINE_R_COMMAND_TAKES_NO_INPUT 136 # define ENGINE_R_CONFLICTING_ENGINE_ID 103 # define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED 119 # define ENGINE_R_DH_NOT_IMPLEMENTED 139 # define ENGINE_R_DSA_NOT_IMPLEMENTED 140 # define ENGINE_R_DSO_FAILURE 104 # define ENGINE_R_DSO_NOT_FOUND 132 # define ENGINE_R_ENGINES_SECTION_ERROR 148 # define ENGINE_R_ENGINE_CONFIGURATION_ERROR 102 # define ENGINE_R_ENGINE_IS_NOT_IN_LIST 105 # define ENGINE_R_ENGINE_SECTION_ERROR 149 # define ENGINE_R_FAILED_LOADING_PRIVATE_KEY 128 # define ENGINE_R_FAILED_LOADING_PUBLIC_KEY 129 # define ENGINE_R_FINISH_FAILED 106 # define ENGINE_R_GET_HANDLE_FAILED 107 # define ENGINE_R_ID_OR_NAME_MISSING 108 # define ENGINE_R_INIT_FAILED 109 # define ENGINE_R_INTERNAL_LIST_ERROR 110 # define ENGINE_R_INVALID_ARGUMENT 143 # define ENGINE_R_INVALID_CMD_NAME 137 # define ENGINE_R_INVALID_CMD_NUMBER 138 # define ENGINE_R_INVALID_INIT_VALUE 151 # define ENGINE_R_INVALID_STRING 150 # define ENGINE_R_NOT_INITIALISED 117 # define ENGINE_R_NOT_LOADED 112 # define ENGINE_R_NO_CONTROL_FUNCTION 120 # define ENGINE_R_NO_INDEX 144 # define ENGINE_R_NO_LOAD_FUNCTION 125 # define ENGINE_R_NO_REFERENCE 130 # define ENGINE_R_NO_SUCH_ENGINE 116 # define ENGINE_R_NO_UNLOAD_FUNCTION 126 # define ENGINE_R_PROVIDE_PARAMETERS 113 # define ENGINE_R_RSA_NOT_IMPLEMENTED 141 # define ENGINE_R_UNIMPLEMENTED_CIPHER 146 # define ENGINE_R_UNIMPLEMENTED_DIGEST 147 # define ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD 101 # define ENGINE_R_VERSION_INCOMPATIBILITY 145 #ifdef __cplusplus } #endif #endif ��������������������������������������������������������������������������������������������������������������openssl/x509_vfy.h����������������������������������������������������������������������������������0000644�����������������00000071066�14763166030�0010011 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/x509/x509_vfy.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_X509_H # include <openssl/x509.h> /* * openssl/x509.h ends up #include-ing this file at about the only * appropriate moment. */ #endif #ifndef HEADER_X509_VFY_H # define HEADER_X509_VFY_H # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_LHASH # include <openssl/lhash.h> # endif # include <openssl/bio.h> # include <openssl/crypto.h> # include <openssl/symhacks.h> #ifdef __cplusplus extern "C" { #endif # if 0 /* Outer object */ typedef struct x509_hash_dir_st { int num_dirs; char **dirs; int *dirs_type; int num_dirs_alloced; } X509_HASH_DIR_CTX; # endif typedef struct x509_file_st { int num_paths; /* number of paths to files or directories */ int num_alloced; char **paths; /* the list of paths or directories */ int *path_type; } X509_CERT_FILE_CTX; /*******************************/ /*- SSL_CTX -> X509_STORE -> X509_LOOKUP ->X509_LOOKUP_METHOD -> X509_LOOKUP ->X509_LOOKUP_METHOD SSL -> X509_STORE_CTX ->X509_STORE The X509_STORE holds the tables etc for verification stuff. A X509_STORE_CTX is used while validating a single certificate. The X509_STORE has X509_LOOKUPs for looking up certs. The X509_STORE then calls a function to actually verify the certificate chain. */ # define X509_LU_RETRY -1 # define X509_LU_FAIL 0 # define X509_LU_X509 1 # define X509_LU_CRL 2 # define X509_LU_PKEY 3 typedef struct x509_object_st { /* one of the above types */ int type; union { char *ptr; X509 *x509; X509_CRL *crl; EVP_PKEY *pkey; } data; } X509_OBJECT; typedef struct x509_lookup_st X509_LOOKUP; DECLARE_STACK_OF(X509_LOOKUP) DECLARE_STACK_OF(X509_OBJECT) /* This is a static that defines the function interface */ typedef struct x509_lookup_method_st { const char *name; int (*new_item) (X509_LOOKUP *ctx); void (*free) (X509_LOOKUP *ctx); int (*init) (X509_LOOKUP *ctx); int (*shutdown) (X509_LOOKUP *ctx); int (*ctrl) (X509_LOOKUP *ctx, int cmd, const char *argc, long argl, char **ret); int (*get_by_subject) (X509_LOOKUP *ctx, int type, X509_NAME *name, X509_OBJECT *ret); int (*get_by_issuer_serial) (X509_LOOKUP *ctx, int type, X509_NAME *name, ASN1_INTEGER *serial, X509_OBJECT *ret); int (*get_by_fingerprint) (X509_LOOKUP *ctx, int type, unsigned char *bytes, int len, X509_OBJECT *ret); int (*get_by_alias) (X509_LOOKUP *ctx, int type, char *str, int len, X509_OBJECT *ret); } X509_LOOKUP_METHOD; typedef struct X509_VERIFY_PARAM_ID_st X509_VERIFY_PARAM_ID; /* * This structure hold all parameters associated with a verify operation by * including an X509_VERIFY_PARAM structure in related structures the * parameters used can be customized */ typedef struct X509_VERIFY_PARAM_st { char *name; time_t check_time; /* Time to use */ unsigned long inh_flags; /* Inheritance flags */ unsigned long flags; /* Various verify flags */ int purpose; /* purpose to check untrusted certificates */ int trust; /* trust setting to check */ int depth; /* Verify depth */ STACK_OF(ASN1_OBJECT) *policies; /* Permissible policies */ X509_VERIFY_PARAM_ID *id; /* opaque ID data */ } X509_VERIFY_PARAM; DECLARE_STACK_OF(X509_VERIFY_PARAM) /* * This is used to hold everything. It is used for all certificate * validation. Once we have a certificate chain, the 'verify' function is * then called to actually check the cert chain. */ struct x509_store_st { /* The following is a cache of trusted certs */ int cache; /* if true, stash any hits */ STACK_OF(X509_OBJECT) *objs; /* Cache of all objects */ /* These are external lookup methods */ STACK_OF(X509_LOOKUP) *get_cert_methods; X509_VERIFY_PARAM *param; /* Callbacks for various operations */ /* called to verify a certificate */ int (*verify) (X509_STORE_CTX *ctx); /* error callback */ int (*verify_cb) (int ok, X509_STORE_CTX *ctx); /* get issuers cert from ctx */ int (*get_issuer) (X509 **issuer, X509_STORE_CTX *ctx, X509 *x); /* check issued */ int (*check_issued) (X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* Check revocation status of chain */ int (*check_revocation) (X509_STORE_CTX *ctx); /* retrieve CRL */ int (*get_crl) (X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* Check CRL validity */ int (*check_crl) (X509_STORE_CTX *ctx, X509_CRL *crl); /* Check certificate against CRL */ int (*cert_crl) (X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); STACK_OF(X509) *(*lookup_certs) (X509_STORE_CTX *ctx, X509_NAME *nm); STACK_OF(X509_CRL) *(*lookup_crls) (X509_STORE_CTX *ctx, X509_NAME *nm); int (*cleanup) (X509_STORE_CTX *ctx); CRYPTO_EX_DATA ex_data; int references; } /* X509_STORE */ ; int X509_STORE_set_depth(X509_STORE *store, int depth); # define X509_STORE_set_verify_cb_func(ctx,func) ((ctx)->verify_cb=(func)) # define X509_STORE_set_verify_func(ctx,func) ((ctx)->verify=(func)) /* This is the functions plus an instance of the local variables. */ struct x509_lookup_st { int init; /* have we been started */ int skip; /* don't use us. */ X509_LOOKUP_METHOD *method; /* the functions */ char *method_data; /* method data */ X509_STORE *store_ctx; /* who owns us */ } /* X509_LOOKUP */ ; /* * This is a used when verifying cert chains. Since the gathering of the * cert chain can take some time (and have to be 'retried', this needs to be * kept and passed around. */ struct x509_store_ctx_st { /* X509_STORE_CTX */ X509_STORE *ctx; /* used when looking up certs */ int current_method; /* The following are set by the caller */ /* The cert to check */ X509 *cert; /* chain of X509s - untrusted - passed in */ STACK_OF(X509) *untrusted; /* set of CRLs passed in */ STACK_OF(X509_CRL) *crls; X509_VERIFY_PARAM *param; /* Other info for use with get_issuer() */ void *other_ctx; /* Callbacks for various operations */ /* called to verify a certificate */ int (*verify) (X509_STORE_CTX *ctx); /* error callback */ int (*verify_cb) (int ok, X509_STORE_CTX *ctx); /* get issuers cert from ctx */ int (*get_issuer) (X509 **issuer, X509_STORE_CTX *ctx, X509 *x); /* check issued */ int (*check_issued) (X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* Check revocation status of chain */ int (*check_revocation) (X509_STORE_CTX *ctx); /* retrieve CRL */ int (*get_crl) (X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* Check CRL validity */ int (*check_crl) (X509_STORE_CTX *ctx, X509_CRL *crl); /* Check certificate against CRL */ int (*cert_crl) (X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); int (*check_policy) (X509_STORE_CTX *ctx); STACK_OF(X509) *(*lookup_certs) (X509_STORE_CTX *ctx, X509_NAME *nm); STACK_OF(X509_CRL) *(*lookup_crls) (X509_STORE_CTX *ctx, X509_NAME *nm); int (*cleanup) (X509_STORE_CTX *ctx); /* The following is built up */ /* if 0, rebuild chain */ int valid; /* index of last untrusted cert */ int last_untrusted; /* chain of X509s - built up and trusted */ STACK_OF(X509) *chain; /* Valid policy tree */ X509_POLICY_TREE *tree; /* Require explicit policy value */ int explicit_policy; /* When something goes wrong, this is why */ int error_depth; int error; X509 *current_cert; /* cert currently being tested as valid issuer */ X509 *current_issuer; /* current CRL */ X509_CRL *current_crl; /* score of current CRL */ int current_crl_score; /* Reason mask */ unsigned int current_reasons; /* For CRL path validation: parent context */ X509_STORE_CTX *parent; CRYPTO_EX_DATA ex_data; } /* X509_STORE_CTX */ ; void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); # define X509_STORE_CTX_set_app_data(ctx,data) \ X509_STORE_CTX_set_ex_data(ctx,0,data) # define X509_STORE_CTX_get_app_data(ctx) \ X509_STORE_CTX_get_ex_data(ctx,0) # define X509_L_FILE_LOAD 1 # define X509_L_ADD_DIR 2 # define X509_LOOKUP_load_file(x,name,type) \ X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL) # define X509_LOOKUP_add_dir(x,name,type) \ X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL) # define X509_V_OK 0 # define X509_V_ERR_UNSPECIFIED 1 # define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2 # define X509_V_ERR_UNABLE_TO_GET_CRL 3 # define X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4 # define X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5 # define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 # define X509_V_ERR_CERT_SIGNATURE_FAILURE 7 # define X509_V_ERR_CRL_SIGNATURE_FAILURE 8 # define X509_V_ERR_CERT_NOT_YET_VALID 9 # define X509_V_ERR_CERT_HAS_EXPIRED 10 # define X509_V_ERR_CRL_NOT_YET_VALID 11 # define X509_V_ERR_CRL_HAS_EXPIRED 12 # define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13 # define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14 # define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15 # define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16 # define X509_V_ERR_OUT_OF_MEM 17 # define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18 # define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 19 # define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20 # define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21 # define X509_V_ERR_CERT_CHAIN_TOO_LONG 22 # define X509_V_ERR_CERT_REVOKED 23 # define X509_V_ERR_INVALID_CA 24 # define X509_V_ERR_PATH_LENGTH_EXCEEDED 25 # define X509_V_ERR_INVALID_PURPOSE 26 # define X509_V_ERR_CERT_UNTRUSTED 27 # define X509_V_ERR_CERT_REJECTED 28 /* These are 'informational' when looking for issuer cert */ # define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29 # define X509_V_ERR_AKID_SKID_MISMATCH 30 # define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31 # define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32 # define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER 33 # define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34 # define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35 # define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36 # define X509_V_ERR_INVALID_NON_CA 37 # define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38 # define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39 # define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40 # define X509_V_ERR_INVALID_EXTENSION 41 # define X509_V_ERR_INVALID_POLICY_EXTENSION 42 # define X509_V_ERR_NO_EXPLICIT_POLICY 43 # define X509_V_ERR_DIFFERENT_CRL_SCOPE 44 # define X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE 45 # define X509_V_ERR_UNNESTED_RESOURCE 46 # define X509_V_ERR_PERMITTED_VIOLATION 47 # define X509_V_ERR_EXCLUDED_VIOLATION 48 # define X509_V_ERR_SUBTREE_MINMAX 49 # define X509_V_ERR_APPLICATION_VERIFICATION 50 # define X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE 51 # define X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX 52 # define X509_V_ERR_UNSUPPORTED_NAME_SYNTAX 53 # define X509_V_ERR_CRL_PATH_VALIDATION_ERROR 54 /* Suite B mode algorithm violation */ # define X509_V_ERR_SUITE_B_INVALID_VERSION 56 # define X509_V_ERR_SUITE_B_INVALID_ALGORITHM 57 # define X509_V_ERR_SUITE_B_INVALID_CURVE 58 # define X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM 59 # define X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED 60 # define X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256 61 /* Host, email and IP check errors */ # define X509_V_ERR_HOSTNAME_MISMATCH 62 # define X509_V_ERR_EMAIL_MISMATCH 63 # define X509_V_ERR_IP_ADDRESS_MISMATCH 64 /* Caller error */ # define X509_V_ERR_INVALID_CALL 65 /* Issuer lookup error */ # define X509_V_ERR_STORE_LOOKUP 66 # define X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION 67 /* Certificate verify flags */ /* Send issuer+subject checks to verify_cb */ # define X509_V_FLAG_CB_ISSUER_CHECK 0x1 /* Use check time instead of current time */ # define X509_V_FLAG_USE_CHECK_TIME 0x2 /* Lookup CRLs */ # define X509_V_FLAG_CRL_CHECK 0x4 /* Lookup CRLs for whole chain */ # define X509_V_FLAG_CRL_CHECK_ALL 0x8 /* Ignore unhandled critical extensions */ # define X509_V_FLAG_IGNORE_CRITICAL 0x10 /* Disable workarounds for broken certificates */ # define X509_V_FLAG_X509_STRICT 0x20 /* Enable proxy certificate validation */ # define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40 /* Enable policy checking */ # define X509_V_FLAG_POLICY_CHECK 0x80 /* Policy variable require-explicit-policy */ # define X509_V_FLAG_EXPLICIT_POLICY 0x100 /* Policy variable inhibit-any-policy */ # define X509_V_FLAG_INHIBIT_ANY 0x200 /* Policy variable inhibit-policy-mapping */ # define X509_V_FLAG_INHIBIT_MAP 0x400 /* Notify callback that policy is OK */ # define X509_V_FLAG_NOTIFY_POLICY 0x800 /* Extended CRL features such as indirect CRLs, alternate CRL signing keys */ # define X509_V_FLAG_EXTENDED_CRL_SUPPORT 0x1000 /* Delta CRL support */ # define X509_V_FLAG_USE_DELTAS 0x2000 /* Check selfsigned CA signature */ # define X509_V_FLAG_CHECK_SS_SIGNATURE 0x4000 /* Use trusted store first */ # define X509_V_FLAG_TRUSTED_FIRST 0x8000 /* Suite B 128 bit only mode: not normally used */ # define X509_V_FLAG_SUITEB_128_LOS_ONLY 0x10000 /* Suite B 192 bit only mode */ # define X509_V_FLAG_SUITEB_192_LOS 0x20000 /* Suite B 128 bit mode allowing 192 bit algorithms */ # define X509_V_FLAG_SUITEB_128_LOS 0x30000 /* Allow partial chains if at least one certificate is in trusted store */ # define X509_V_FLAG_PARTIAL_CHAIN 0x80000 /* * If the initial chain is not trusted, do not attempt to build an alternative * chain. Alternate chain checking was introduced in 1.0.2b. Setting this flag * will force the behaviour to match that of previous versions. */ # define X509_V_FLAG_NO_ALT_CHAINS 0x100000 # define X509_VP_FLAG_DEFAULT 0x1 # define X509_VP_FLAG_OVERWRITE 0x2 # define X509_VP_FLAG_RESET_FLAGS 0x4 # define X509_VP_FLAG_LOCKED 0x8 # define X509_VP_FLAG_ONCE 0x10 /* Internal use: mask of policy related options */ # define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \ | X509_V_FLAG_EXPLICIT_POLICY \ | X509_V_FLAG_INHIBIT_ANY \ | X509_V_FLAG_INHIBIT_MAP) int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, X509_NAME *name); X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int type, X509_NAME *name); X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x); void X509_OBJECT_up_ref_count(X509_OBJECT *a); void X509_OBJECT_free_contents(X509_OBJECT *a); X509_STORE *X509_STORE_new(void); void X509_STORE_free(X509_STORE *v); STACK_OF(X509) *X509_STORE_get1_certs(X509_STORE_CTX *st, X509_NAME *nm); STACK_OF(X509_CRL) *X509_STORE_get1_crls(X509_STORE_CTX *st, X509_NAME *nm); int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags); int X509_STORE_set_purpose(X509_STORE *ctx, int purpose); int X509_STORE_set_trust(X509_STORE *ctx, int trust); int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm); void X509_STORE_set_verify_cb(X509_STORE *ctx, int (*verify_cb) (int, X509_STORE_CTX *)); void X509_STORE_set_lookup_crls_cb(X509_STORE *ctx, STACK_OF(X509_CRL) *(*cb) (X509_STORE_CTX *ctx, X509_NAME *nm)); X509_STORE_CTX *X509_STORE_CTX_new(void); int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); void X509_STORE_CTX_free(X509_STORE_CTX *ctx); int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, STACK_OF(X509) *chain); void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); X509_STORE *X509_STORE_CTX_get0_store(X509_STORE_CTX *ctx); X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m); X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void); X509_LOOKUP_METHOD *X509_LOOKUP_file(void); int X509_STORE_add_cert(X509_STORE *ctx, X509 *x); int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x); int X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name, X509_OBJECT *ret); int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl, char **ret); # ifndef OPENSSL_NO_STDIO int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type); int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type); int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type); # endif X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method); void X509_LOOKUP_free(X509_LOOKUP *ctx); int X509_LOOKUP_init(X509_LOOKUP *ctx); int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name, X509_OBJECT *ret); int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name, ASN1_INTEGER *serial, X509_OBJECT *ret); int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type, unsigned char *bytes, int len, X509_OBJECT *ret); int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str, int len, X509_OBJECT *ret); int X509_LOOKUP_shutdown(X509_LOOKUP *ctx); # ifndef OPENSSL_NO_STDIO int X509_STORE_load_locations(X509_STORE *ctx, const char *file, const char *dir); int X509_STORE_set_default_paths(X509_STORE *ctx); # endif int X509_STORE_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx, int idx, void *data); void *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx, int idx); int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int s); int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); X509 *X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx); X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx); X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx); STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx); STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx); void X509_STORE_CTX_set_cert(X509_STORE_CTX *c, X509 *x); void X509_STORE_CTX_set_chain(X509_STORE_CTX *c, STACK_OF(X509) *sk); void X509_STORE_CTX_set0_crls(X509_STORE_CTX *c, STACK_OF(X509_CRL) *sk); int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose); int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust); int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, int purpose, int trust); void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags); void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, time_t t); void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, int (*verify_cb) (int, X509_STORE_CTX *)); X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx); int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx); X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx); void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param); int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name); /* X509_VERIFY_PARAM functions */ X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void); void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param); int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to, const X509_VERIFY_PARAM *from); int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, const X509_VERIFY_PARAM *from); int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name); int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags); int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param, unsigned long flags); unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param); int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose); int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust); void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth); void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t); int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param, ASN1_OBJECT *policy); int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, STACK_OF(ASN1_OBJECT) *policies); int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param, const char *name, size_t namelen); int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param, const char *name, size_t namelen); void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param, unsigned int flags); char *X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM *); int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param, const char *email, size_t emaillen); int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param, const unsigned char *ip, size_t iplen); int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, const char *ipasc); int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param); const char *X509_VERIFY_PARAM_get0_name(const X509_VERIFY_PARAM *param); int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param); int X509_VERIFY_PARAM_get_count(void); const X509_VERIFY_PARAM *X509_VERIFY_PARAM_get0(int id); const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name); void X509_VERIFY_PARAM_table_cleanup(void); int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, STACK_OF(X509) *certs, STACK_OF(ASN1_OBJECT) *policy_oids, unsigned int flags); void X509_policy_tree_free(X509_POLICY_TREE *tree); int X509_policy_tree_level_count(const X509_POLICY_TREE *tree); X509_POLICY_LEVEL *X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, int i); STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_policies(const X509_POLICY_TREE *tree); STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_user_policies(const X509_POLICY_TREE *tree); int X509_policy_level_node_count(X509_POLICY_LEVEL *level); X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, int i); const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node); STACK_OF(POLICYQUALINFO) *X509_policy_node_get0_qualifiers(const X509_POLICY_NODE *node); const X509_POLICY_NODE *X509_policy_node_get0_parent(const X509_POLICY_NODE *node); #ifdef __cplusplus } #endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/ossl_typ.h����������������������������������������������������������������������������������0000644�����������������00000017230�14763166030�0010265 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ==================================================================== * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #ifndef HEADER_OPENSSL_TYPES_H # define HEADER_OPENSSL_TYPES_H #ifdef __cplusplus extern "C" { #endif # include <openssl/e_os2.h> # ifdef NO_ASN1_TYPEDEFS # define ASN1_INTEGER ASN1_STRING # define ASN1_ENUMERATED ASN1_STRING # define ASN1_BIT_STRING ASN1_STRING # define ASN1_OCTET_STRING ASN1_STRING # define ASN1_PRINTABLESTRING ASN1_STRING # define ASN1_T61STRING ASN1_STRING # define ASN1_IA5STRING ASN1_STRING # define ASN1_UTCTIME ASN1_STRING # define ASN1_GENERALIZEDTIME ASN1_STRING # define ASN1_TIME ASN1_STRING # define ASN1_GENERALSTRING ASN1_STRING # define ASN1_UNIVERSALSTRING ASN1_STRING # define ASN1_BMPSTRING ASN1_STRING # define ASN1_VISIBLESTRING ASN1_STRING # define ASN1_UTF8STRING ASN1_STRING # define ASN1_BOOLEAN int # define ASN1_NULL int # else typedef struct asn1_string_st ASN1_INTEGER; typedef struct asn1_string_st ASN1_ENUMERATED; typedef struct asn1_string_st ASN1_BIT_STRING; typedef struct asn1_string_st ASN1_OCTET_STRING; typedef struct asn1_string_st ASN1_PRINTABLESTRING; typedef struct asn1_string_st ASN1_T61STRING; typedef struct asn1_string_st ASN1_IA5STRING; typedef struct asn1_string_st ASN1_GENERALSTRING; typedef struct asn1_string_st ASN1_UNIVERSALSTRING; typedef struct asn1_string_st ASN1_BMPSTRING; typedef struct asn1_string_st ASN1_UTCTIME; typedef struct asn1_string_st ASN1_TIME; typedef struct asn1_string_st ASN1_GENERALIZEDTIME; typedef struct asn1_string_st ASN1_VISIBLESTRING; typedef struct asn1_string_st ASN1_UTF8STRING; typedef struct asn1_string_st ASN1_STRING; typedef int ASN1_BOOLEAN; typedef int ASN1_NULL; # endif typedef struct asn1_object_st ASN1_OBJECT; typedef struct ASN1_ITEM_st ASN1_ITEM; typedef struct asn1_pctx_st ASN1_PCTX; # ifdef OPENSSL_SYS_WIN32 # undef X509_NAME # undef X509_EXTENSIONS # undef X509_CERT_PAIR # undef PKCS7_ISSUER_AND_SERIAL # undef OCSP_REQUEST # undef OCSP_RESPONSE # endif # ifdef BIGNUM # undef BIGNUM # endif typedef struct bignum_st BIGNUM; typedef struct bignum_ctx BN_CTX; typedef struct bn_blinding_st BN_BLINDING; typedef struct bn_mont_ctx_st BN_MONT_CTX; typedef struct bn_recp_ctx_st BN_RECP_CTX; typedef struct bn_gencb_st BN_GENCB; typedef struct buf_mem_st BUF_MEM; typedef struct evp_cipher_st EVP_CIPHER; typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; typedef struct env_md_st EVP_MD; typedef struct env_md_ctx_st EVP_MD_CTX; typedef struct evp_pkey_st EVP_PKEY; typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD; typedef struct evp_pkey_method_st EVP_PKEY_METHOD; typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; typedef struct dh_st DH; typedef struct dh_method DH_METHOD; typedef struct dsa_st DSA; typedef struct dsa_method DSA_METHOD; typedef struct rsa_st RSA; typedef struct rsa_meth_st RSA_METHOD; typedef struct rand_meth_st RAND_METHOD; typedef struct ecdh_method ECDH_METHOD; typedef struct ecdsa_method ECDSA_METHOD; typedef struct x509_st X509; typedef struct X509_algor_st X509_ALGOR; typedef struct X509_crl_st X509_CRL; typedef struct x509_crl_method_st X509_CRL_METHOD; typedef struct x509_revoked_st X509_REVOKED; typedef struct X509_name_st X509_NAME; typedef struct X509_pubkey_st X509_PUBKEY; typedef struct x509_store_st X509_STORE; typedef struct x509_store_ctx_st X509_STORE_CTX; typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO; typedef struct v3_ext_ctx X509V3_CTX; typedef struct conf_st CONF; typedef struct store_st STORE; typedef struct store_method_st STORE_METHOD; typedef struct ui_st UI; typedef struct ui_method_st UI_METHOD; typedef struct st_ERR_FNS ERR_FNS; typedef struct engine_st ENGINE; typedef struct ssl_st SSL; typedef struct ssl_ctx_st SSL_CTX; typedef struct comp_method_st COMP_METHOD; typedef struct X509_POLICY_NODE_st X509_POLICY_NODE; typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL; typedef struct X509_POLICY_TREE_st X509_POLICY_TREE; typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE; typedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID; typedef struct DIST_POINT_st DIST_POINT; typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT; typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS; /* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h */ # define DECLARE_PKCS12_STACK_OF(type)/* Nothing */ # define IMPLEMENT_PKCS12_STACK_OF(type)/* Nothing */ typedef struct crypto_ex_data_st CRYPTO_EX_DATA; /* Callback types for crypto.h */ typedef int CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad, int idx, long argl, void *argp); typedef void CRYPTO_EX_free (void *parent, void *ptr, CRYPTO_EX_DATA *ad, int idx, long argl, void *argp); typedef int CRYPTO_EX_dup (CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, int idx, long argl, void *argp); typedef struct ocsp_req_ctx_st OCSP_REQ_CTX; typedef struct ocsp_response_st OCSP_RESPONSE; typedef struct ocsp_responder_id_st OCSP_RESPID; #ifdef __cplusplus } #endif #endif /* def HEADER_OPENSSL_TYPES_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/ebcdic.h������������������������������������������������������������������������������������0000644�����������������00000001150�14763166030�0007614 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/ebcdic.h */ #ifndef HEADER_EBCDIC_H # define HEADER_EBCDIC_H # include <sys/types.h> #ifdef __cplusplus extern "C" { #endif /* Avoid name clashes with other applications */ # define os_toascii _openssl_os_toascii # define os_toebcdic _openssl_os_toebcdic # define ebcdic2ascii _openssl_ebcdic2ascii # define ascii2ebcdic _openssl_ascii2ebcdic extern const unsigned char os_toascii[256]; extern const unsigned char os_toebcdic[256]; void *ebcdic2ascii(void *dest, const void *srce, size_t count); void *ascii2ebcdic(void *dest, const void *srce, size_t count); #ifdef __cplusplus } #endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/e_os2.h�������������������������������������������������������������������������������������0000644�����������������00000025301�14763166030�0007416 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_os2.h */ /* ==================================================================== * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #include <openssl/opensslconf.h> #ifndef HEADER_E_OS2_H # define HEADER_E_OS2_H #ifdef __cplusplus extern "C" { #endif /****************************************************************************** * Detect operating systems. This probably needs completing. * The result is that at least one OPENSSL_SYS_os macro should be defined. * However, if none is defined, Unix is assumed. **/ # define OPENSSL_SYS_UNIX /* ---------------------- Macintosh, before MacOS X ----------------------- */ # if defined(__MWERKS__) && defined(macintosh) || defined(OPENSSL_SYSNAME_MAC) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_MACINTOSH_CLASSIC # endif /* ---------------------- NetWare ----------------------------------------- */ # if defined(NETWARE) || defined(OPENSSL_SYSNAME_NETWARE) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_NETWARE # endif /* --------------------- Microsoft operating systems ---------------------- */ /* * Note that MSDOS actually denotes 32-bit environments running on top of * MS-DOS, such as DJGPP one. */ # if defined(OPENSSL_SYSNAME_MSDOS) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_MSDOS # endif /* * For 32 bit environment, there seems to be the CygWin environment and then * all the others that try to do the same thing Microsoft does... */ # if defined(OPENSSL_SYSNAME_UWIN) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_WIN32_UWIN # else # if defined(__CYGWIN__) || defined(OPENSSL_SYSNAME_CYGWIN) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_WIN32_CYGWIN # else # if defined(_WIN32) || defined(OPENSSL_SYSNAME_WIN32) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_WIN32 # endif # if defined(_WIN64) || defined(OPENSSL_SYSNAME_WIN64) # undef OPENSSL_SYS_UNIX # if !defined(OPENSSL_SYS_WIN64) # define OPENSSL_SYS_WIN64 # endif # endif # if defined(OPENSSL_SYSNAME_WINNT) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_WINNT # endif # if defined(OPENSSL_SYSNAME_WINCE) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_WINCE # endif # endif # endif /* Anything that tries to look like Microsoft is "Windows" */ # if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN64) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_WINDOWS # ifndef OPENSSL_SYS_MSDOS # define OPENSSL_SYS_MSDOS # endif # endif /* * DLL settings. This part is a bit tough, because it's up to the * application implementor how he or she will link the application, so it * requires some macro to be used. */ # ifdef OPENSSL_SYS_WINDOWS # ifndef OPENSSL_OPT_WINDLL # if defined(_WINDLL) /* This is used when building OpenSSL to * indicate that DLL linkage should be used */ # define OPENSSL_OPT_WINDLL # endif # endif # endif /* ------------------------------- OpenVMS -------------------------------- */ # if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYSNAME_VMS) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_VMS # if defined(__DECC) # define OPENSSL_SYS_VMS_DECC # elif defined(__DECCXX) # define OPENSSL_SYS_VMS_DECC # define OPENSSL_SYS_VMS_DECCXX # else # define OPENSSL_SYS_VMS_NODECC # endif # endif /* -------------------------------- OS/2 ---------------------------------- */ # if defined(__EMX__) || defined(__OS2__) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_OS2 # endif /* -------------------------------- Unix ---------------------------------- */ # ifdef OPENSSL_SYS_UNIX # if defined(linux) || defined(__linux__) || defined(OPENSSL_SYSNAME_LINUX) # define OPENSSL_SYS_LINUX # endif # ifdef OPENSSL_SYSNAME_MPE # define OPENSSL_SYS_MPE # endif # ifdef OPENSSL_SYSNAME_SNI # define OPENSSL_SYS_SNI # endif # ifdef OPENSSL_SYSNAME_ULTRASPARC # define OPENSSL_SYS_ULTRASPARC # endif # ifdef OPENSSL_SYSNAME_NEWS4 # define OPENSSL_SYS_NEWS4 # endif # ifdef OPENSSL_SYSNAME_MACOSX # define OPENSSL_SYS_MACOSX # endif # ifdef OPENSSL_SYSNAME_MACOSX_RHAPSODY # define OPENSSL_SYS_MACOSX_RHAPSODY # define OPENSSL_SYS_MACOSX # endif # ifdef OPENSSL_SYSNAME_SUNOS # define OPENSSL_SYS_SUNOS # endif # if defined(_CRAY) || defined(OPENSSL_SYSNAME_CRAY) # define OPENSSL_SYS_CRAY # endif # if defined(_AIX) || defined(OPENSSL_SYSNAME_AIX) # define OPENSSL_SYS_AIX # endif # endif /* -------------------------------- VOS ----------------------------------- */ # if defined(__VOS__) || defined(OPENSSL_SYSNAME_VOS) # define OPENSSL_SYS_VOS # ifdef __HPPA__ # define OPENSSL_SYS_VOS_HPPA # endif # ifdef __IA32__ # define OPENSSL_SYS_VOS_IA32 # endif # endif /* ------------------------------ VxWorks --------------------------------- */ # ifdef OPENSSL_SYSNAME_VXWORKS # define OPENSSL_SYS_VXWORKS # endif /* -------------------------------- BeOS ---------------------------------- */ # if defined(__BEOS__) # define OPENSSL_SYS_BEOS # include <sys/socket.h> # if defined(BONE_VERSION) # define OPENSSL_SYS_BEOS_BONE # else # define OPENSSL_SYS_BEOS_R5 # endif # endif /** * That's it for OS-specific stuff *****************************************************************************/ /* Specials for I/O an exit */ # ifdef OPENSSL_SYS_MSDOS # define OPENSSL_UNISTD_IO <io.h> # define OPENSSL_DECLARE_EXIT extern void exit(int); # else # define OPENSSL_UNISTD_IO OPENSSL_UNISTD # define OPENSSL_DECLARE_EXIT /* declared in unistd.h */ # endif /*- * Definitions of OPENSSL_GLOBAL and OPENSSL_EXTERN, to define and declare * certain global symbols that, with some compilers under VMS, have to be * defined and declared explicitely with globaldef and globalref. * Definitions of OPENSSL_EXPORT and OPENSSL_IMPORT, to define and declare * DLL exports and imports for compilers under Win32. These are a little * more complicated to use. Basically, for any library that exports some * global variables, the following code must be present in the header file * that declares them, before OPENSSL_EXTERN is used: * * #ifdef SOME_BUILD_FLAG_MACRO * # undef OPENSSL_EXTERN * # define OPENSSL_EXTERN OPENSSL_EXPORT * #endif * * The default is to have OPENSSL_EXPORT, OPENSSL_IMPORT and OPENSSL_GLOBAL * have some generally sensible values, and for OPENSSL_EXTERN to have the * value OPENSSL_IMPORT. */ # if defined(OPENSSL_SYS_VMS_NODECC) # define OPENSSL_EXPORT globalref # define OPENSSL_IMPORT globalref # define OPENSSL_GLOBAL globaldef # elif defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL) # define OPENSSL_EXPORT extern __declspec(dllexport) # define OPENSSL_IMPORT extern __declspec(dllimport) # define OPENSSL_GLOBAL # else # define OPENSSL_EXPORT extern # define OPENSSL_IMPORT extern # define OPENSSL_GLOBAL # endif # define OPENSSL_EXTERN OPENSSL_IMPORT /*- * Macros to allow global variables to be reached through function calls when * required (if a shared library version requires it, for example. * The way it's done allows definitions like this: * * // in foobar.c * OPENSSL_IMPLEMENT_GLOBAL(int,foobar,0) * // in foobar.h * OPENSSL_DECLARE_GLOBAL(int,foobar); * #define foobar OPENSSL_GLOBAL_REF(foobar) */ # ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION # define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) \ type *_shadow_##name(void) \ { static type _hide_##name=value; return &_hide_##name; } # define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void) # define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name())) # else # define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) OPENSSL_GLOBAL type _shadow_##name=value; # define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name # define OPENSSL_GLOBAL_REF(name) _shadow_##name # endif # if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) && macintosh==1 && !defined(MAC_OS_GUSI_SOURCE) # define ossl_ssize_t long # endif # ifdef OPENSSL_SYS_MSDOS # define ossl_ssize_t long # endif # if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) || defined(OPENSSL_SYS_SUNOS) # define ssize_t int # endif # if defined(__ultrix) && !defined(ssize_t) # define ossl_ssize_t int # endif # ifndef ossl_ssize_t # define ossl_ssize_t ssize_t # endif #ifdef __cplusplus } #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/pem.h���������������������������������������������������������������������������������������0000644�����������������00000062420�14763166030�0007173 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/pem/pem.h */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_PEM_H # define HEADER_PEM_H # include <openssl/e_os2.h> # ifndef OPENSSL_NO_BIO # include <openssl/bio.h> # endif # ifndef OPENSSL_NO_STACK # include <openssl/stack.h> # endif # include <openssl/evp.h> # include <openssl/x509.h> # include <openssl/pem2.h> #ifdef __cplusplus extern "C" { #endif # define PEM_BUFSIZE 1024 # define PEM_OBJ_UNDEF 0 # define PEM_OBJ_X509 1 # define PEM_OBJ_X509_REQ 2 # define PEM_OBJ_CRL 3 # define PEM_OBJ_SSL_SESSION 4 # define PEM_OBJ_PRIV_KEY 10 # define PEM_OBJ_PRIV_RSA 11 # define PEM_OBJ_PRIV_DSA 12 # define PEM_OBJ_PRIV_DH 13 # define PEM_OBJ_PUB_RSA 14 # define PEM_OBJ_PUB_DSA 15 # define PEM_OBJ_PUB_DH 16 # define PEM_OBJ_DHPARAMS 17 # define PEM_OBJ_DSAPARAMS 18 # define PEM_OBJ_PRIV_RSA_PUBLIC 19 # define PEM_OBJ_PRIV_ECDSA 20 # define PEM_OBJ_PUB_ECDSA 21 # define PEM_OBJ_ECPARAMETERS 22 # define PEM_ERROR 30 # define PEM_DEK_DES_CBC 40 # define PEM_DEK_IDEA_CBC 45 # define PEM_DEK_DES_EDE 50 # define PEM_DEK_DES_ECB 60 # define PEM_DEK_RSA 70 # define PEM_DEK_RSA_MD2 80 # define PEM_DEK_RSA_MD5 90 # define PEM_MD_MD2 NID_md2 # define PEM_MD_MD5 NID_md5 # define PEM_MD_SHA NID_sha # define PEM_MD_MD2_RSA NID_md2WithRSAEncryption # define PEM_MD_MD5_RSA NID_md5WithRSAEncryption # define PEM_MD_SHA_RSA NID_sha1WithRSAEncryption # define PEM_STRING_X509_OLD "X509 CERTIFICATE" # define PEM_STRING_X509 "CERTIFICATE" # define PEM_STRING_X509_PAIR "CERTIFICATE PAIR" # define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" # define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" # define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" # define PEM_STRING_X509_CRL "X509 CRL" # define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY" # define PEM_STRING_PUBLIC "PUBLIC KEY" # define PEM_STRING_RSA "RSA PRIVATE KEY" # define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" # define PEM_STRING_DSA "DSA PRIVATE KEY" # define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY" # define PEM_STRING_PKCS7 "PKCS7" # define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA" # define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY" # define PEM_STRING_PKCS8INF "PRIVATE KEY" # define PEM_STRING_DHPARAMS "DH PARAMETERS" # define PEM_STRING_DHXPARAMS "X9.42 DH PARAMETERS" # define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" # define PEM_STRING_DSAPARAMS "DSA PARAMETERS" # define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" # define PEM_STRING_ECPARAMETERS "EC PARAMETERS" # define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" # define PEM_STRING_PARAMETERS "PARAMETERS" # define PEM_STRING_CMS "CMS" /* * Note that this structure is initialised by PEM_SealInit and cleaned up * by PEM_SealFinal (at least for now) */ typedef struct PEM_Encode_Seal_st { EVP_ENCODE_CTX encode; EVP_MD_CTX md; EVP_CIPHER_CTX cipher; } PEM_ENCODE_SEAL_CTX; /* enc_type is one off */ # define PEM_TYPE_ENCRYPTED 10 # define PEM_TYPE_MIC_ONLY 20 # define PEM_TYPE_MIC_CLEAR 30 # define PEM_TYPE_CLEAR 40 typedef struct pem_recip_st { char *name; X509_NAME *dn; int cipher; int key_enc; /* char iv[8]; unused and wrong size */ } PEM_USER; typedef struct pem_ctx_st { int type; /* what type of object */ struct { int version; int mode; } proc_type; char *domain; struct { int cipher; /*- unused, and wrong size unsigned char iv[8]; */ } DEK_info; PEM_USER *originator; int num_recipient; PEM_USER **recipient; /*- XXX(ben): don#t think this is used! STACK *x509_chain; / * certificate chain */ EVP_MD *md; /* signature type */ int md_enc; /* is the md encrypted or not? */ int md_len; /* length of md_data */ char *md_data; /* message digest, could be pkey encrypted */ EVP_CIPHER *dec; /* date encryption cipher */ int key_len; /* key length */ unsigned char *key; /* key */ /*- unused, and wrong size unsigned char iv[8]; */ int data_enc; /* is the data encrypted */ int data_len; unsigned char *data; } PEM_CTX; /* * These macros make the PEM_read/PEM_write functions easier to maintain and * write. Now they are all implemented with either: IMPLEMENT_PEM_rw(...) or * IMPLEMENT_PEM_rw_cb(...) */ # ifdef OPENSSL_NO_FP_API # define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/ # define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/ # define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/ # define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/ # define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/ # else # define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\ { \ return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str,fp,(void **)x,cb,u); \ } # define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ int PEM_write_##name(FILE *fp, type *x) \ { \ return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL); \ } # define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ int PEM_write_##name(FILE *fp, const type *x) \ { \ return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,(void *)x,NULL,NULL,0,NULL,NULL); \ } # define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ unsigned char *kstr, int klen, pem_password_cb *cb, \ void *u) \ { \ return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ } # define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ unsigned char *kstr, int klen, pem_password_cb *cb, \ void *u) \ { \ return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ } # endif # define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\ { \ return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str,bp,(void **)x,cb,u); \ } # define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ int PEM_write_bio_##name(BIO *bp, type *x) \ { \ return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL); \ } # define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ int PEM_write_bio_##name(BIO *bp, const type *x) \ { \ return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,NULL,NULL,0,NULL,NULL); \ } # define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ { \ return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u); \ } # define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ { \ return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,enc,kstr,klen,cb,u); \ } # define IMPLEMENT_PEM_write(name, type, str, asn1) \ IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ IMPLEMENT_PEM_write_fp(name, type, str, asn1) # define IMPLEMENT_PEM_write_const(name, type, str, asn1) \ IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) # define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) # define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \ IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) # define IMPLEMENT_PEM_read(name, type, str, asn1) \ IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ IMPLEMENT_PEM_read_fp(name, type, str, asn1) # define IMPLEMENT_PEM_rw(name, type, str, asn1) \ IMPLEMENT_PEM_read(name, type, str, asn1) \ IMPLEMENT_PEM_write(name, type, str, asn1) # define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \ IMPLEMENT_PEM_read(name, type, str, asn1) \ IMPLEMENT_PEM_write_const(name, type, str, asn1) # define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ IMPLEMENT_PEM_read(name, type, str, asn1) \ IMPLEMENT_PEM_write_cb(name, type, str, asn1) /* These are the same except they are for the declarations */ # if defined(OPENSSL_NO_FP_API) # define DECLARE_PEM_read_fp(name, type) /**/ # define DECLARE_PEM_write_fp(name, type) /**/ # define DECLARE_PEM_write_cb_fp(name, type) /**/ # else # define DECLARE_PEM_read_fp(name, type) \ type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u); # define DECLARE_PEM_write_fp(name, type) \ int PEM_write_##name(FILE *fp, type *x); # define DECLARE_PEM_write_fp_const(name, type) \ int PEM_write_##name(FILE *fp, const type *x); # define DECLARE_PEM_write_cb_fp(name, type) \ int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ unsigned char *kstr, int klen, pem_password_cb *cb, void *u); # endif # ifndef OPENSSL_NO_BIO # define DECLARE_PEM_read_bio(name, type) \ type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u); # define DECLARE_PEM_write_bio(name, type) \ int PEM_write_bio_##name(BIO *bp, type *x); # define DECLARE_PEM_write_bio_const(name, type) \ int PEM_write_bio_##name(BIO *bp, const type *x); # define DECLARE_PEM_write_cb_bio(name, type) \ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ unsigned char *kstr, int klen, pem_password_cb *cb, void *u); # else # define DECLARE_PEM_read_bio(name, type) /**/ # define DECLARE_PEM_write_bio(name, type) /**/ # define DECLARE_PEM_write_bio_const(name, type) /**/ # define DECLARE_PEM_write_cb_bio(name, type) /**/ # endif # define DECLARE_PEM_write(name, type) \ DECLARE_PEM_write_bio(name, type) \ DECLARE_PEM_write_fp(name, type) # define DECLARE_PEM_write_const(name, type) \ DECLARE_PEM_write_bio_const(name, type) \ DECLARE_PEM_write_fp_const(name, type) # define DECLARE_PEM_write_cb(name, type) \ DECLARE_PEM_write_cb_bio(name, type) \ DECLARE_PEM_write_cb_fp(name, type) # define DECLARE_PEM_read(name, type) \ DECLARE_PEM_read_bio(name, type) \ DECLARE_PEM_read_fp(name, type) # define DECLARE_PEM_rw(name, type) \ DECLARE_PEM_read(name, type) \ DECLARE_PEM_write(name, type) # define DECLARE_PEM_rw_const(name, type) \ DECLARE_PEM_read(name, type) \ DECLARE_PEM_write_const(name, type) # define DECLARE_PEM_rw_cb(name, type) \ DECLARE_PEM_read(name, type) \ DECLARE_PEM_write_cb(name, type) # if 1 /* "userdata": new with OpenSSL 0.9.4 */ typedef int pem_password_cb (char *buf, int size, int rwflag, void *userdata); # else /* OpenSSL 0.9.3, 0.9.3a */ typedef int pem_password_cb (char *buf, int size, int rwflag); # endif int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *len, pem_password_cb *callback, void *u); # ifndef OPENSSL_NO_BIO int PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data, long *len); int PEM_write_bio(BIO *bp, const char *name, const char *hdr, const unsigned char *data, long len); int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char *name, BIO *bp, pem_password_cb *cb, void *u); void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x, pem_password_cb *cb, void *u); int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x, const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb, void *u); STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u); int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cd, void *u); # endif int PEM_read(FILE *fp, char **name, char **header, unsigned char **data, long *len); int PEM_write(FILE *fp, const char *name, const char *hdr, const unsigned char *data, long len); void *PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, pem_password_cb *cb, void *u); int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, void *x, const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *callback, void *u); STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u); int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type, unsigned char **ek, int *ekl, unsigned char *iv, EVP_PKEY **pubk, int npubk); void PEM_SealUpdate(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *out, int *outl, unsigned char *in, int inl); int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig, int *sigl, unsigned char *out, int *outl, EVP_PKEY *priv); void PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); void PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt); int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, EVP_PKEY *pkey); int PEM_def_callback(char *buf, int num, int w, void *key); void PEM_proc_type(char *buf, int type); void PEM_dek_info(char *buf, const char *type, int len, char *str); # include <openssl/symhacks.h> DECLARE_PEM_rw(X509, X509) DECLARE_PEM_rw(X509_AUX, X509) DECLARE_PEM_rw(X509_CERT_PAIR, X509_CERT_PAIR) DECLARE_PEM_rw(X509_REQ, X509_REQ) DECLARE_PEM_write(X509_REQ_NEW, X509_REQ) DECLARE_PEM_rw(X509_CRL, X509_CRL) DECLARE_PEM_rw(PKCS7, PKCS7) DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE) DECLARE_PEM_rw(PKCS8, X509_SIG) DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) # ifndef OPENSSL_NO_RSA DECLARE_PEM_rw_cb(RSAPrivateKey, RSA) DECLARE_PEM_rw_const(RSAPublicKey, RSA) DECLARE_PEM_rw(RSA_PUBKEY, RSA) # endif # ifndef OPENSSL_NO_DSA DECLARE_PEM_rw_cb(DSAPrivateKey, DSA) DECLARE_PEM_rw(DSA_PUBKEY, DSA) DECLARE_PEM_rw_const(DSAparams, DSA) # endif # ifndef OPENSSL_NO_EC DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP) DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY) DECLARE_PEM_rw(EC_PUBKEY, EC_KEY) # endif # ifndef OPENSSL_NO_DH DECLARE_PEM_rw_const(DHparams, DH) DECLARE_PEM_write_const(DHxparams, DH) # endif DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY) DECLARE_PEM_rw(PUBKEY, EVP_PKEY) int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u); int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *, char *, int, pem_password_cb *, void *); int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, char *kstr, int klen, pem_password_cb *cb, void *u); int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u); EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u); int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, char *kstr, int klen, pem_password_cb *cb, void *u); int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u); int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u); EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u); int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, char *kstr, int klen, pem_password_cb *cd, void *u); EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x); int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x); EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length); EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length); EVP_PKEY *b2i_PrivateKey_bio(BIO *in); EVP_PKEY *b2i_PublicKey_bio(BIO *in); int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk); int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk); # ifndef OPENSSL_NO_RC4 EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u); int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, pem_password_cb *cb, void *u); # endif /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_PEM_strings(void); /* Error codes for the PEM functions. */ /* Function codes. */ # define PEM_F_B2I_DSS 127 # define PEM_F_B2I_PVK_BIO 128 # define PEM_F_B2I_RSA 129 # define PEM_F_CHECK_BITLEN_DSA 130 # define PEM_F_CHECK_BITLEN_RSA 131 # define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120 # define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121 # define PEM_F_DO_B2I 132 # define PEM_F_DO_B2I_BIO 133 # define PEM_F_DO_BLOB_HEADER 134 # define PEM_F_DO_PK8PKEY 126 # define PEM_F_DO_PK8PKEY_FP 125 # define PEM_F_DO_PVK_BODY 135 # define PEM_F_DO_PVK_HEADER 136 # define PEM_F_I2B_PVK 137 # define PEM_F_I2B_PVK_BIO 138 # define PEM_F_LOAD_IV 101 # define PEM_F_PEM_ASN1_READ 102 # define PEM_F_PEM_ASN1_READ_BIO 103 # define PEM_F_PEM_ASN1_WRITE 104 # define PEM_F_PEM_ASN1_WRITE_BIO 105 # define PEM_F_PEM_DEF_CALLBACK 100 # define PEM_F_PEM_DO_HEADER 106 # define PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY 118 # define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 # define PEM_F_PEM_PK8PKEY 119 # define PEM_F_PEM_READ 108 # define PEM_F_PEM_READ_BIO 109 # define PEM_F_PEM_READ_BIO_DHPARAMS 141 # define PEM_F_PEM_READ_BIO_PARAMETERS 140 # define PEM_F_PEM_READ_BIO_PRIVATEKEY 123 # define PEM_F_PEM_READ_DHPARAMS 142 # define PEM_F_PEM_READ_PRIVATEKEY 124 # define PEM_F_PEM_SEALFINAL 110 # define PEM_F_PEM_SEALINIT 111 # define PEM_F_PEM_SIGNFINAL 112 # define PEM_F_PEM_WRITE 113 # define PEM_F_PEM_WRITE_BIO 114 # define PEM_F_PEM_WRITE_PRIVATEKEY 139 # define PEM_F_PEM_X509_INFO_READ 115 # define PEM_F_PEM_X509_INFO_READ_BIO 116 # define PEM_F_PEM_X509_INFO_WRITE_BIO 117 /* Reason codes. */ # define PEM_R_BAD_BASE64_DECODE 100 # define PEM_R_BAD_DECRYPT 101 # define PEM_R_BAD_END_LINE 102 # define PEM_R_BAD_IV_CHARS 103 # define PEM_R_BAD_MAGIC_NUMBER 116 # define PEM_R_BAD_PASSWORD_READ 104 # define PEM_R_BAD_VERSION_NUMBER 117 # define PEM_R_BIO_WRITE_FAILURE 118 # define PEM_R_CIPHER_IS_NULL 127 # define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115 # define PEM_R_EXPECTING_PRIVATE_KEY_BLOB 119 # define PEM_R_EXPECTING_PUBLIC_KEY_BLOB 120 # define PEM_R_HEADER_TOO_LONG 128 # define PEM_R_INCONSISTENT_HEADER 121 # define PEM_R_KEYBLOB_HEADER_PARSE_ERROR 122 # define PEM_R_KEYBLOB_TOO_SHORT 123 # define PEM_R_NOT_DEK_INFO 105 # define PEM_R_NOT_ENCRYPTED 106 # define PEM_R_NOT_PROC_TYPE 107 # define PEM_R_NO_START_LINE 108 # define PEM_R_PROBLEMS_GETTING_PASSWORD 109 # define PEM_R_PUBLIC_KEY_NO_RSA 110 # define PEM_R_PVK_DATA_TOO_SHORT 124 # define PEM_R_PVK_TOO_SHORT 125 # define PEM_R_READ_KEY 111 # define PEM_R_SHORT_HEADER 112 # define PEM_R_UNSUPPORTED_CIPHER 113 # define PEM_R_UNSUPPORTED_ENCRYPTION 114 # define PEM_R_UNSUPPORTED_KEY_COMPONENTS 126 # ifdef __cplusplus } # endif #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/pem2.h��������������������������������������������������������������������������������������0000644�����������������00000005456�14763166030�0007263 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ==================================================================== * Copyright (c) 1999 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * licensing@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ /* * This header only exists to break a circular dependency between pem and err * Ben 30 Jan 1999. */ #ifdef __cplusplus extern "C" { #endif #ifndef HEADER_PEM_H void ERR_load_PEM_strings(void); #endif #ifdef __cplusplus } #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/cast.h��������������������������������������������������������������������������������������0000644�����������������00000011063�14763166030�0007341 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/cast/cast.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_CAST_H # define HEADER_CAST_H #ifdef __cplusplus extern "C" { #endif # include <openssl/opensslconf.h> # ifdef OPENSSL_NO_CAST # error CAST is disabled. # endif # define CAST_ENCRYPT 1 # define CAST_DECRYPT 0 # define CAST_LONG unsigned int # define CAST_BLOCK 8 # define CAST_KEY_LENGTH 16 typedef struct cast_key_st { CAST_LONG data[32]; int short_key; /* Use reduced rounds for short key */ } CAST_KEY; # ifdef OPENSSL_FIPS void private_CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); # endif void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, const CAST_KEY *key, int enc); void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key); void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key); void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, const CAST_KEY *ks, unsigned char *iv, int enc); void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, const CAST_KEY *schedule, unsigned char *ivec, int *num, int enc); void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, const CAST_KEY *schedule, unsigned char *ivec, int *num); #ifdef __cplusplus } #endif #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/conf.h��������������������������������������������������������������������������������������0000644�����������������00000025770�14763166030�0007346 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/conf/conf.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_CONF_H # define HEADER_CONF_H # include <openssl/bio.h> # include <openssl/lhash.h> # include <openssl/stack.h> # include <openssl/safestack.h> # include <openssl/e_os2.h> # include <openssl/ossl_typ.h> #ifdef __cplusplus extern "C" { #endif typedef struct { char *section; char *name; char *value; } CONF_VALUE; DECLARE_STACK_OF(CONF_VALUE) DECLARE_LHASH_OF(CONF_VALUE); struct conf_st; struct conf_method_st; typedef struct conf_method_st CONF_METHOD; struct conf_method_st { const char *name; CONF *(*create) (CONF_METHOD *meth); int (*init) (CONF *conf); int (*destroy) (CONF *conf); int (*destroy_data) (CONF *conf); int (*load_bio) (CONF *conf, BIO *bp, long *eline); int (*dump) (const CONF *conf, BIO *bp); int (*is_number) (const CONF *conf, char c); int (*to_int) (const CONF *conf, char c); int (*load) (CONF *conf, const char *name, long *eline); }; /* Module definitions */ typedef struct conf_imodule_st CONF_IMODULE; typedef struct conf_module_st CONF_MODULE; DECLARE_STACK_OF(CONF_MODULE) DECLARE_STACK_OF(CONF_IMODULE) /* DSO module function typedefs */ typedef int conf_init_func (CONF_IMODULE *md, const CONF *cnf); typedef void conf_finish_func (CONF_IMODULE *md); # define CONF_MFLAGS_IGNORE_ERRORS 0x1 # define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2 # define CONF_MFLAGS_SILENT 0x4 # define CONF_MFLAGS_NO_DSO 0x8 # define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 # define CONF_MFLAGS_DEFAULT_SECTION 0x20 int CONF_set_default_method(CONF_METHOD *meth); void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash); LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, long *eline); # ifndef OPENSSL_NO_FP_API LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, long *eline); # endif LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, long *eline); STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, const char *section); char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, const char *name); long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group, const char *name); void CONF_free(LHASH_OF(CONF_VALUE) *conf); int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); void OPENSSL_config(const char *config_name); void OPENSSL_no_config(void); /* * New conf code. The semantics are different from the functions above. If * that wasn't the case, the above functions would have been replaced */ struct conf_st { CONF_METHOD *meth; void *meth_data; LHASH_OF(CONF_VALUE) *data; }; CONF *NCONF_new(CONF_METHOD *meth); CONF_METHOD *NCONF_default(void); CONF_METHOD *NCONF_WIN32(void); # if 0 /* Just to give you an idea of what I have in * mind */ CONF_METHOD *NCONF_XML(void); # endif void NCONF_free(CONF *conf); void NCONF_free_data(CONF *conf); int NCONF_load(CONF *conf, const char *file, long *eline); # ifndef OPENSSL_NO_FP_API int NCONF_load_fp(CONF *conf, FILE *fp, long *eline); # endif int NCONF_load_bio(CONF *conf, BIO *bp, long *eline); STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *section); char *NCONF_get_string(const CONF *conf, const char *group, const char *name); int NCONF_get_number_e(const CONF *conf, const char *group, const char *name, long *result); int NCONF_dump_fp(const CONF *conf, FILE *out); int NCONF_dump_bio(const CONF *conf, BIO *out); # if 0 /* The following function has no error * checking, and should therefore be avoided */ long NCONF_get_number(CONF *conf, char *group, char *name); # else # define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r) # endif /* Module functions */ int CONF_modules_load(const CONF *cnf, const char *appname, unsigned long flags); int CONF_modules_load_file(const char *filename, const char *appname, unsigned long flags); void CONF_modules_unload(int all); void CONF_modules_finish(void); void CONF_modules_free(void); int CONF_module_add(const char *name, conf_init_func *ifunc, conf_finish_func *ffunc); const char *CONF_imodule_get_name(const CONF_IMODULE *md); const char *CONF_imodule_get_value(const CONF_IMODULE *md); void *CONF_imodule_get_usr_data(const CONF_IMODULE *md); void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data); CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md); unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md); void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags); void *CONF_module_get_usr_data(CONF_MODULE *pmod); void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data); char *CONF_get1_default_config_file(void); int CONF_parse_list(const char *list, int sep, int nospc, int (*list_cb) (const char *elem, int len, void *usr), void *arg); void OPENSSL_load_builtin_modules(void); /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_CONF_strings(void); /* Error codes for the CONF functions. */ /* Function codes. */ # define CONF_F_CONF_DUMP_FP 104 # define CONF_F_CONF_LOAD 100 # define CONF_F_CONF_LOAD_BIO 102 # define CONF_F_CONF_LOAD_FP 103 # define CONF_F_CONF_MODULES_LOAD 116 # define CONF_F_CONF_PARSE_LIST 119 # define CONF_F_DEF_LOAD 120 # define CONF_F_DEF_LOAD_BIO 121 # define CONF_F_MODULE_INIT 115 # define CONF_F_MODULE_LOAD_DSO 117 # define CONF_F_MODULE_RUN 118 # define CONF_F_NCONF_DUMP_BIO 105 # define CONF_F_NCONF_DUMP_FP 106 # define CONF_F_NCONF_GET_NUMBER 107 # define CONF_F_NCONF_GET_NUMBER_E 112 # define CONF_F_NCONF_GET_SECTION 108 # define CONF_F_NCONF_GET_STRING 109 # define CONF_F_NCONF_LOAD 113 # define CONF_F_NCONF_LOAD_BIO 110 # define CONF_F_NCONF_LOAD_FP 114 # define CONF_F_NCONF_NEW 111 # define CONF_F_STR_COPY 101 /* Reason codes. */ # define CONF_R_ERROR_LOADING_DSO 110 # define CONF_R_LIST_CANNOT_BE_NULL 115 # define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 # define CONF_R_MISSING_EQUAL_SIGN 101 # define CONF_R_MISSING_FINISH_FUNCTION 111 # define CONF_R_MISSING_INIT_FUNCTION 112 # define CONF_R_MODULE_INITIALIZATION_ERROR 109 # define CONF_R_NO_CLOSE_BRACE 102 # define CONF_R_NO_CONF 105 # define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106 # define CONF_R_NO_SECTION 107 # define CONF_R_NO_SUCH_FILE 114 # define CONF_R_NO_VALUE 108 # define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 # define CONF_R_UNKNOWN_MODULE_NAME 113 # define CONF_R_VARIABLE_HAS_NO_VALUE 104 #ifdef __cplusplus } #endif #endif ��������openssl/rc5.h���������������������������������������������������������������������������������������0000644�����������������00000011503�14763166030�0007077 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/rc5/rc5.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_RC5_H # define HEADER_RC5_H # include <openssl/opensslconf.h>/* OPENSSL_NO_RC5 */ #ifdef __cplusplus extern "C" { #endif # ifdef OPENSSL_NO_RC5 # error RC5 is disabled. # endif # define RC5_ENCRYPT 1 # define RC5_DECRYPT 0 /* 32 bit. For Alpha, things may get weird */ # define RC5_32_INT unsigned long # define RC5_32_BLOCK 8 # define RC5_32_KEY_LENGTH 16/* This is a default, max is 255 */ /* * This are the only values supported. Tweak the code if you want more The * most supported modes will be RC5-32/12/16 RC5-32/16/8 */ # define RC5_8_ROUNDS 8 # define RC5_12_ROUNDS 12 # define RC5_16_ROUNDS 16 typedef struct rc5_key_st { /* Number of rounds */ int rounds; RC5_32_INT data[2 * (RC5_16_ROUNDS + 1)]; } RC5_32_KEY; void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, int rounds); void RC5_32_ecb_encrypt(const unsigned char *in, unsigned char *out, RC5_32_KEY *key, int enc); void RC5_32_encrypt(unsigned long *data, RC5_32_KEY *key); void RC5_32_decrypt(unsigned long *data, RC5_32_KEY *key); void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, RC5_32_KEY *ks, unsigned char *iv, int enc); void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, RC5_32_KEY *schedule, unsigned char *ivec, int *num, int enc); void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, RC5_32_KEY *schedule, unsigned char *ivec, int *num); #ifdef __cplusplus } #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/ssl2.h��������������������������������������������������������������������������������������0000644�����������������00000027421�14763166030�0007277 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ssl/ssl2.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_SSL2_H # define HEADER_SSL2_H #ifdef __cplusplus extern "C" { #endif /* Protocol Version Codes */ # define SSL2_VERSION 0x0002 # define SSL2_VERSION_MAJOR 0x00 # define SSL2_VERSION_MINOR 0x02 /* #define SSL2_CLIENT_VERSION 0x0002 */ /* #define SSL2_SERVER_VERSION 0x0002 */ /* Protocol Message Codes */ # define SSL2_MT_ERROR 0 # define SSL2_MT_CLIENT_HELLO 1 # define SSL2_MT_CLIENT_MASTER_KEY 2 # define SSL2_MT_CLIENT_FINISHED 3 # define SSL2_MT_SERVER_HELLO 4 # define SSL2_MT_SERVER_VERIFY 5 # define SSL2_MT_SERVER_FINISHED 6 # define SSL2_MT_REQUEST_CERTIFICATE 7 # define SSL2_MT_CLIENT_CERTIFICATE 8 /* Error Message Codes */ # define SSL2_PE_UNDEFINED_ERROR 0x0000 # define SSL2_PE_NO_CIPHER 0x0001 # define SSL2_PE_NO_CERTIFICATE 0x0002 # define SSL2_PE_BAD_CERTIFICATE 0x0004 # define SSL2_PE_UNSUPPORTED_CERTIFICATE_TYPE 0x0006 /* Cipher Kind Values */ # define SSL2_CK_NULL_WITH_MD5 0x02000000/* v3 */ # define SSL2_CK_RC4_128_WITH_MD5 0x02010080 # define SSL2_CK_RC4_128_EXPORT40_WITH_MD5 0x02020080 # define SSL2_CK_RC2_128_CBC_WITH_MD5 0x02030080 # define SSL2_CK_RC2_128_CBC_EXPORT40_WITH_MD5 0x02040080 # define SSL2_CK_IDEA_128_CBC_WITH_MD5 0x02050080 # define SSL2_CK_DES_64_CBC_WITH_MD5 0x02060040 # define SSL2_CK_DES_64_CBC_WITH_SHA 0x02060140/* v3 */ # define SSL2_CK_DES_192_EDE3_CBC_WITH_MD5 0x020700c0 # define SSL2_CK_DES_192_EDE3_CBC_WITH_SHA 0x020701c0/* v3 */ # define SSL2_CK_RC4_64_WITH_MD5 0x02080080/* MS hack */ # define SSL2_CK_DES_64_CFB64_WITH_MD5_1 0x02ff0800/* SSLeay */ # define SSL2_CK_NULL 0x02ff0810/* SSLeay */ # define SSL2_TXT_DES_64_CFB64_WITH_MD5_1 "DES-CFB-M1" # define SSL2_TXT_NULL_WITH_MD5 "NULL-MD5" # define SSL2_TXT_RC4_128_WITH_MD5 "RC4-MD5" # define SSL2_TXT_RC4_128_EXPORT40_WITH_MD5 "EXP-RC4-MD5" # define SSL2_TXT_RC2_128_CBC_WITH_MD5 "RC2-CBC-MD5" # define SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 "EXP-RC2-CBC-MD5" # define SSL2_TXT_IDEA_128_CBC_WITH_MD5 "IDEA-CBC-MD5" # define SSL2_TXT_DES_64_CBC_WITH_MD5 "DES-CBC-MD5" # define SSL2_TXT_DES_64_CBC_WITH_SHA "DES-CBC-SHA" # define SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5 "DES-CBC3-MD5" # define SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA "DES-CBC3-SHA" # define SSL2_TXT_RC4_64_WITH_MD5 "RC4-64-MD5" # define SSL2_TXT_NULL "NULL" /* Flags for the SSL_CIPHER.algorithm2 field */ # define SSL2_CF_5_BYTE_ENC 0x01 # define SSL2_CF_8_BYTE_ENC 0x02 /* Certificate Type Codes */ # define SSL2_CT_X509_CERTIFICATE 0x01 /* Authentication Type Code */ # define SSL2_AT_MD5_WITH_RSA_ENCRYPTION 0x01 # define SSL2_MAX_SSL_SESSION_ID_LENGTH 32 /* Upper/Lower Bounds */ # define SSL2_MAX_MASTER_KEY_LENGTH_IN_BITS 256 # ifdef OPENSSL_SYS_MPE # define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER 29998u # else # define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER 32767u /* 2^15-1 */ # endif # define SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER 16383/* 2^14-1 */ # define SSL2_CHALLENGE_LENGTH 16 /* * #define SSL2_CHALLENGE_LENGTH 32 */ # define SSL2_MIN_CHALLENGE_LENGTH 16 # define SSL2_MAX_CHALLENGE_LENGTH 32 # define SSL2_CONNECTION_ID_LENGTH 16 # define SSL2_MAX_CONNECTION_ID_LENGTH 16 # define SSL2_SSL_SESSION_ID_LENGTH 16 # define SSL2_MAX_CERT_CHALLENGE_LENGTH 32 # define SSL2_MIN_CERT_CHALLENGE_LENGTH 16 # define SSL2_MAX_KEY_MATERIAL_LENGTH 24 # ifndef HEADER_SSL_LOCL_H # define CERT char # endif # ifndef OPENSSL_NO_SSL_INTERN typedef struct ssl2_state_st { int three_byte_header; int clear_text; /* clear text */ int escape; /* not used in SSLv2 */ int ssl2_rollback; /* used if SSLv23 rolled back to SSLv2 */ /* * non-blocking io info, used to make sure the same args were passwd */ unsigned int wnum; /* number of bytes sent so far */ int wpend_tot; const unsigned char *wpend_buf; int wpend_off; /* offset to data to write */ int wpend_len; /* number of bytes passwd to write */ int wpend_ret; /* number of bytes to return to caller */ /* buffer raw data */ int rbuf_left; int rbuf_offs; unsigned char *rbuf; unsigned char *wbuf; unsigned char *write_ptr; /* used to point to the start due to 2/3 byte * header. */ unsigned int padding; unsigned int rlength; /* passed to ssl2_enc */ int ract_data_length; /* Set when things are encrypted. */ unsigned int wlength; /* passed to ssl2_enc */ int wact_data_length; /* Set when things are decrypted. */ unsigned char *ract_data; unsigned char *wact_data; unsigned char *mac_data; unsigned char *read_key; unsigned char *write_key; /* Stuff specifically to do with this SSL session */ unsigned int challenge_length; unsigned char challenge[SSL2_MAX_CHALLENGE_LENGTH]; unsigned int conn_id_length; unsigned char conn_id[SSL2_MAX_CONNECTION_ID_LENGTH]; unsigned int key_material_length; unsigned char key_material[SSL2_MAX_KEY_MATERIAL_LENGTH * 2]; unsigned long read_sequence; unsigned long write_sequence; struct { unsigned int conn_id_length; unsigned int cert_type; unsigned int cert_length; unsigned int csl; unsigned int clear; unsigned int enc; unsigned char ccl[SSL2_MAX_CERT_CHALLENGE_LENGTH]; unsigned int cipher_spec_length; unsigned int session_id_length; unsigned int clen; unsigned int rlen; } tmp; } SSL2_STATE; # endif /* SSLv2 */ /* client */ # define SSL2_ST_SEND_CLIENT_HELLO_A (0x10|SSL_ST_CONNECT) # define SSL2_ST_SEND_CLIENT_HELLO_B (0x11|SSL_ST_CONNECT) # define SSL2_ST_GET_SERVER_HELLO_A (0x20|SSL_ST_CONNECT) # define SSL2_ST_GET_SERVER_HELLO_B (0x21|SSL_ST_CONNECT) # define SSL2_ST_SEND_CLIENT_MASTER_KEY_A (0x30|SSL_ST_CONNECT) # define SSL2_ST_SEND_CLIENT_MASTER_KEY_B (0x31|SSL_ST_CONNECT) # define SSL2_ST_SEND_CLIENT_FINISHED_A (0x40|SSL_ST_CONNECT) # define SSL2_ST_SEND_CLIENT_FINISHED_B (0x41|SSL_ST_CONNECT) # define SSL2_ST_SEND_CLIENT_CERTIFICATE_A (0x50|SSL_ST_CONNECT) # define SSL2_ST_SEND_CLIENT_CERTIFICATE_B (0x51|SSL_ST_CONNECT) # define SSL2_ST_SEND_CLIENT_CERTIFICATE_C (0x52|SSL_ST_CONNECT) # define SSL2_ST_SEND_CLIENT_CERTIFICATE_D (0x53|SSL_ST_CONNECT) # define SSL2_ST_GET_SERVER_VERIFY_A (0x60|SSL_ST_CONNECT) # define SSL2_ST_GET_SERVER_VERIFY_B (0x61|SSL_ST_CONNECT) # define SSL2_ST_GET_SERVER_FINISHED_A (0x70|SSL_ST_CONNECT) # define SSL2_ST_GET_SERVER_FINISHED_B (0x71|SSL_ST_CONNECT) # define SSL2_ST_CLIENT_START_ENCRYPTION (0x80|SSL_ST_CONNECT) # define SSL2_ST_X509_GET_CLIENT_CERTIFICATE (0x90|SSL_ST_CONNECT) /* server */ # define SSL2_ST_GET_CLIENT_HELLO_A (0x10|SSL_ST_ACCEPT) # define SSL2_ST_GET_CLIENT_HELLO_B (0x11|SSL_ST_ACCEPT) # define SSL2_ST_GET_CLIENT_HELLO_C (0x12|SSL_ST_ACCEPT) # define SSL2_ST_SEND_SERVER_HELLO_A (0x20|SSL_ST_ACCEPT) # define SSL2_ST_SEND_SERVER_HELLO_B (0x21|SSL_ST_ACCEPT) # define SSL2_ST_GET_CLIENT_MASTER_KEY_A (0x30|SSL_ST_ACCEPT) # define SSL2_ST_GET_CLIENT_MASTER_KEY_B (0x31|SSL_ST_ACCEPT) # define SSL2_ST_SEND_SERVER_VERIFY_A (0x40|SSL_ST_ACCEPT) # define SSL2_ST_SEND_SERVER_VERIFY_B (0x41|SSL_ST_ACCEPT) # define SSL2_ST_SEND_SERVER_VERIFY_C (0x42|SSL_ST_ACCEPT) # define SSL2_ST_GET_CLIENT_FINISHED_A (0x50|SSL_ST_ACCEPT) # define SSL2_ST_GET_CLIENT_FINISHED_B (0x51|SSL_ST_ACCEPT) # define SSL2_ST_SEND_SERVER_FINISHED_A (0x60|SSL_ST_ACCEPT) # define SSL2_ST_SEND_SERVER_FINISHED_B (0x61|SSL_ST_ACCEPT) # define SSL2_ST_SEND_REQUEST_CERTIFICATE_A (0x70|SSL_ST_ACCEPT) # define SSL2_ST_SEND_REQUEST_CERTIFICATE_B (0x71|SSL_ST_ACCEPT) # define SSL2_ST_SEND_REQUEST_CERTIFICATE_C (0x72|SSL_ST_ACCEPT) # define SSL2_ST_SEND_REQUEST_CERTIFICATE_D (0x73|SSL_ST_ACCEPT) # define SSL2_ST_SERVER_START_ENCRYPTION (0x80|SSL_ST_ACCEPT) # define SSL2_ST_X509_GET_SERVER_CERTIFICATE (0x90|SSL_ST_ACCEPT) #ifdef __cplusplus } #endif #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������openssl/dh.h����������������������������������������������������������������������������������������0000644�����������������00000037627�14763166030�0007020 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* crypto/dh/dh.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef HEADER_DH_H # define HEADER_DH_H # include <openssl/e_os2.h> # ifdef OPENSSL_NO_DH # error DH is disabled. # endif # ifndef OPENSSL_NO_BIO # include <openssl/bio.h> # endif # include <openssl/ossl_typ.h> # ifndef OPENSSL_NO_DEPRECATED # include <openssl/bn.h> # endif # ifndef OPENSSL_DH_MAX_MODULUS_BITS # define OPENSSL_DH_MAX_MODULUS_BITS 10000 # endif # define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024 # define OPENSSL_DH_FIPS_MIN_MODULUS_BITS_GEN 2048 # define DH_FLAG_CACHE_MONT_P 0x01 /* * new with 0.9.7h; the built-in DH * implementation now uses constant time * modular exponentiation for secret exponents * by default. This flag causes the * faster variable sliding window method to * be used for all exponents. */ # define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* * If this flag is set the DH method is FIPS compliant and can be used in * FIPS mode. This is set in the validated module method. If an application * sets this flag in its own methods it is its reposibility to ensure the * result is compliant. */ # define DH_FLAG_FIPS_METHOD 0x0400 /* * If this flag is set the operations normally disabled in FIPS mode are * permitted it is then the applications responsibility to ensure that the * usage is compliant. */ # define DH_FLAG_NON_FIPS_ALLOW 0x0400 #ifdef __cplusplus extern "C" { #endif /* Already defined in ossl_typ.h */ /* typedef struct dh_st DH; */ /* typedef struct dh_method DH_METHOD; */ struct dh_method { const char *name; /* Methods here */ int (*generate_key) (DH *dh); int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh); /* Can be null */ int (*bn_mod_exp) (const DH *dh, BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); int (*init) (DH *dh); int (*finish) (DH *dh); int flags; char *app_data; /* If this is non-NULL, it will be used to generate parameters */ int (*generate_params) (DH *dh, int prime_len, int generator, BN_GENCB *cb); }; struct dh_st { /* * This first argument is used to pick up errors when a DH is passed * instead of a EVP_PKEY */ int pad; int version; BIGNUM *p; BIGNUM *g; long length; /* optional */ BIGNUM *pub_key; /* g^x % p */ BIGNUM *priv_key; /* x */ int flags; BN_MONT_CTX *method_mont_p; /* Place holders if we want to do X9.42 DH */ BIGNUM *q; BIGNUM *j; unsigned char *seed; int seedlen; BIGNUM *counter; int references; CRYPTO_EX_DATA ex_data; const DH_METHOD *meth; ENGINE *engine; }; # define DH_GENERATOR_2 2 /* #define DH_GENERATOR_3 3 */ # define DH_GENERATOR_5 5 /* DH_check error codes */ # define DH_CHECK_P_NOT_PRIME 0x01 # define DH_CHECK_P_NOT_SAFE_PRIME 0x02 # define DH_UNABLE_TO_CHECK_GENERATOR 0x04 # define DH_NOT_SUITABLE_GENERATOR 0x08 # define DH_CHECK_Q_NOT_PRIME 0x10 # define DH_CHECK_INVALID_Q_VALUE 0x20 # define DH_CHECK_INVALID_J_VALUE 0x40 /* DH_check_pub_key error codes */ # define DH_CHECK_PUBKEY_TOO_SMALL 0x01 # define DH_CHECK_PUBKEY_TOO_LARGE 0x02 # define DH_CHECK_PUBKEY_INVALID 0x04 /* * primes p where (p-1)/2 is prime too are called "safe"; we define this for * backward compatibility: */ # define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME # define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ (char *(*)())d2i_DHparams,(fp),(unsigned char **)(x)) # define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \ (unsigned char *)(x)) # define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x) # define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x) DH *DHparams_dup(DH *); const DH_METHOD *DH_OpenSSL(void); void DH_set_default_method(const DH_METHOD *meth); const DH_METHOD *DH_get_default_method(void); int DH_set_method(DH *dh, const DH_METHOD *meth); DH *DH_new_method(ENGINE *engine); DH *DH_new(void); void DH_free(DH *dh); int DH_up_ref(DH *dh); int DH_size(const DH *dh); int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int DH_set_ex_data(DH *d, int idx, void *arg); void *DH_get_ex_data(DH *d, int idx); /* Deprecated version */ # ifndef OPENSSL_NO_DEPRECATED DH *DH_generate_parameters(int prime_len, int generator, void (*callback) (int, int, void *), void *cb_arg); # endif /* !defined(OPENSSL_NO_DEPRECATED) */ /* New version */ int DH_generate_parameters_ex(DH *dh, int prime_len, int generator, BN_GENCB *cb); int DH_check(const DH *dh, int *codes); int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *codes); int DH_generate_key(DH *dh); int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); int DH_compute_key_padded(unsigned char *key, const BIGNUM *pub_key, DH *dh); DH *d2i_DHparams(DH **a, const unsigned char **pp, long length); int i2d_DHparams(const DH *a, unsigned char **pp); DH *d2i_DHxparams(DH **a, const unsigned char **pp, long length); int i2d_DHxparams(const DH *a, unsigned char **pp); # ifndef OPENSSL_NO_FP_API int DHparams_print_fp(FILE *fp, const DH *x); # endif # ifndef OPENSSL_NO_BIO int DHparams_print(BIO *bp, const DH *x); # else int DHparams_print(char *bp, const DH *x); # endif /* RFC 5114 parameters */ DH *DH_get_1024_160(void); DH *DH_get_2048_224(void); DH *DH_get_2048_256(void); /* RFC2631 KDF */ int DH_KDF_X9_42(unsigned char *out, size_t outlen, const unsigned char *Z, size_t Zlen, ASN1_OBJECT *key_oid, const unsigned char *ukm, size_t ukmlen, const EVP_MD *md); # define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN, len, NULL) # define EVP_PKEY_CTX_set_dh_paramgen_subprime_len(ctx, len) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN, len, NULL) # define EVP_PKEY_CTX_set_dh_paramgen_type(ctx, typ) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ EVP_PKEY_CTRL_DH_PARAMGEN_TYPE, typ, NULL) # define EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, gen) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, gen, NULL) # define EVP_PKEY_CTX_set_dh_rfc5114(ctx, gen) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \ EVP_PKEY_CTRL_DH_RFC5114, gen, NULL) # define EVP_PKEY_CTX_set_dhx_rfc5114(ctx, gen) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \ EVP_PKEY_CTRL_DH_RFC5114, gen, NULL) # define EVP_PKEY_CTX_set_dh_kdf_type(ctx, kdf) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_DH_KDF_TYPE, kdf, NULL) # define EVP_PKEY_CTX_get_dh_kdf_type(ctx) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_DH_KDF_TYPE, -2, NULL) # define EVP_PKEY_CTX_set0_dh_kdf_oid(ctx, oid) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_DH_KDF_OID, 0, (void *)oid) # define EVP_PKEY_CTX_get0_dh_kdf_oid(ctx, poid) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_GET_DH_KDF_OID, 0, (void *)poid) # define EVP_PKEY_CTX_set_dh_kdf_md(ctx, md) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_DH_KDF_MD, 0, (void *)md) # define EVP_PKEY_CTX_get_dh_kdf_md(ctx, pmd) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_GET_DH_KDF_MD, 0, (void *)pmd) # define EVP_PKEY_CTX_set_dh_kdf_outlen(ctx, len) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_DH_KDF_OUTLEN, len, NULL) # define EVP_PKEY_CTX_get_dh_kdf_outlen(ctx, plen) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN, 0, (void *)plen) # define EVP_PKEY_CTX_set0_dh_kdf_ukm(ctx, p, plen) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_DH_KDF_UKM, plen, (void *)p) # define EVP_PKEY_CTX_get0_dh_kdf_ukm(ctx, p) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ EVP_PKEY_OP_DERIVE, \ EVP_PKEY_CTRL_GET_DH_KDF_UKM, 0, (void *)p) # define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1) # define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2) # define EVP_PKEY_CTRL_DH_RFC5114 (EVP_PKEY_ALG_CTRL + 3) # define EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN (EVP_PKEY_ALG_CTRL + 4) # define EVP_PKEY_CTRL_DH_PARAMGEN_TYPE (EVP_PKEY_ALG_CTRL + 5) # define EVP_PKEY_CTRL_DH_KDF_TYPE (EVP_PKEY_ALG_CTRL + 6) # define EVP_PKEY_CTRL_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 7) # define EVP_PKEY_CTRL_GET_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 8) # define EVP_PKEY_CTRL_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 9) # define EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 10) # define EVP_PKEY_CTRL_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 11) # define EVP_PKEY_CTRL_GET_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 12) # define EVP_PKEY_CTRL_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 13) # define EVP_PKEY_CTRL_GET_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 14) /* KDF types */ # define EVP_PKEY_DH_KDF_NONE 1 # define EVP_PKEY_DH_KDF_X9_42 2 /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_DH_strings(void); /* Error codes for the DH functions. */ /* Function codes. */ # define DH_F_COMPUTE_KEY 102 # define DH_F_DHPARAMS_PRINT_FP 101 # define DH_F_DH_BUILTIN_GENPARAMS 106 # define DH_F_DH_CMS_DECRYPT 117 # define DH_F_DH_CMS_SET_PEERKEY 118 # define DH_F_DH_CMS_SET_SHARED_INFO 119 # define DH_F_DH_COMPUTE_KEY 114 # define DH_F_DH_GENERATE_KEY 115 # define DH_F_DH_GENERATE_PARAMETERS_EX 116 # define DH_F_DH_NEW_METHOD 105 # define DH_F_DH_PARAM_DECODE 107 # define DH_F_DH_PRIV_DECODE 110 # define DH_F_DH_PRIV_ENCODE 111 # define DH_F_DH_PUB_DECODE 108 # define DH_F_DH_PUB_ENCODE 109 # define DH_F_DO_DH_PRINT 100 # define DH_F_GENERATE_KEY 103 # define DH_F_GENERATE_PARAMETERS 104 # define DH_F_PKEY_DH_DERIVE 112 # define DH_F_PKEY_DH_KEYGEN 113 /* Reason codes. */ # define DH_R_BAD_GENERATOR 101 # define DH_R_BN_DECODE_ERROR 109 # define DH_R_BN_ERROR 106 # define DH_R_DECODE_ERROR 104 # define DH_R_INVALID_PUBKEY 102 # define DH_R_KDF_PARAMETER_ERROR 112 # define DH_R_KEYS_NOT_SET 108 # define DH_R_KEY_SIZE_TOO_SMALL 110 # define DH_R_MODULUS_TOO_LARGE 103 # define DH_R_NON_FIPS_METHOD 111 # define DH_R_NO_PARAMETERS_SET 107 # define DH_R_NO_PRIVATE_VALUE 100 # define DH_R_PARAMETER_ENCODING_ERROR 105 # define DH_R_PEER_KEY_ERROR 113 # define DH_R_SHARED_INFO_ERROR 114 #ifdef __cplusplus } #endif #endif ���������������������������������������������������������������������������������������������������������arpa/inet.h�����������������������������������������������������������������������������������������0000644�����������������00000010306�14763166030�0006605 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1997, 1999-2001, 2004, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ARPA_INET_H #define _ARPA_INET_H 1 #include <features.h> #include <netinet/in.h> /* To define `struct in_addr'. */ /* Type for length arguments in socket calls. */ #ifndef __socklen_t_defined typedef __socklen_t socklen_t; # define __socklen_t_defined #endif __BEGIN_DECLS /* Convert Internet host address from numbers-and-dots notation in CP into binary data in network byte order. */ extern in_addr_t inet_addr (const char *__cp) __THROW; /* Return the local host address part of the Internet address in IN. */ extern in_addr_t inet_lnaof (struct in_addr __in) __THROW; /* Make Internet host address in network byte order by combining the network number NET with the local address HOST. */ extern struct in_addr inet_makeaddr (in_addr_t __net, in_addr_t __host) __THROW; /* Return network number part of the Internet address IN. */ extern in_addr_t inet_netof (struct in_addr __in) __THROW; /* Extract the network number in network byte order from the address in numbers-and-dots natation starting at CP. */ extern in_addr_t inet_network (const char *__cp) __THROW; /* Convert Internet number in IN to ASCII representation. The return value is a pointer to an internal array containing the string. */ extern char *inet_ntoa (struct in_addr __in) __THROW; /* Convert from presentation format of an Internet number in buffer starting at CP to the binary network format and store result for interface type AF in buffer starting at BUF. */ extern int inet_pton (int __af, const char *__restrict __cp, void *__restrict __buf) __THROW; /* Convert a Internet address in binary network format for interface type AF in buffer starting at CP to presentation form and place result in buffer of length LEN astarting at BUF. */ extern const char *inet_ntop (int __af, const void *__restrict __cp, char *__restrict __buf, socklen_t __len) __THROW; /* The following functions are not part of XNS 5.2. */ #ifdef __USE_MISC /* Convert Internet host address from numbers-and-dots notation in CP into binary data and store the result in the structure INP. */ extern int inet_aton (const char *__cp, struct in_addr *__inp) __THROW; /* Format a network number NET into presentation format and place result in buffer starting at BUF with length of LEN bytes. */ extern char *inet_neta (in_addr_t __net, char *__buf, size_t __len) __THROW; /* Convert network number for interface type AF in buffer starting at CP to presentation format. The result will specifiy BITS bits of the number. */ extern char *inet_net_ntop (int __af, const void *__cp, int __bits, char *__buf, size_t __len) __THROW; /* Convert network number for interface type AF from presentation in buffer starting at CP to network format and store result int buffer starting at BUF of size LEN. */ extern int inet_net_pton (int __af, const char *__cp, void *__buf, size_t __len) __THROW; /* Convert ASCII representation in hexadecimal form of the Internet address to binary form and place result in buffer of length LEN starting at BUF. */ extern unsigned int inet_nsap_addr (const char *__cp, unsigned char *__buf, int __len) __THROW; /* Convert internet address in binary form in LEN bytes starting at CP a presentation form and place result in BUF. */ extern char *inet_nsap_ntoa (int __len, const unsigned char *__cp, char *__buf) __THROW; #endif __END_DECLS #endif /* arpa/inet.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������arpa/ftp.h������������������������������������������������������������������������������������������0000644�����������������00000006550�14763166030�0006445 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 1983, 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)ftp.h 8.1 (Berkeley) 6/2/93 */ #ifndef _ARPA_FTP_H #define _ARPA_FTP_H 1 /* Definitions for FTP; see RFC-765. */ /* * Reply codes. */ #define PRELIM 1 /* positive preliminary */ #define COMPLETE 2 /* positive completion */ #define CONTINUE 3 /* positive intermediate */ #define TRANSIENT 4 /* transient negative completion */ #define ERROR 5 /* permanent negative completion */ /* * Type codes */ #define TYPE_A 1 /* ASCII */ #define TYPE_E 2 /* EBCDIC */ #define TYPE_I 3 /* image */ #define TYPE_L 4 /* local byte size */ #ifdef FTP_NAMES char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" }; #endif /* * Form codes */ #define FORM_N 1 /* non-print */ #define FORM_T 2 /* telnet format effectors */ #define FORM_C 3 /* carriage control (ASA) */ #ifdef FTP_NAMES char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" }; #endif /* * Structure codes */ #define STRU_F 1 /* file (no record structure) */ #define STRU_R 2 /* record structure */ #define STRU_P 3 /* page structure */ #ifdef FTP_NAMES char *strunames[] = {"0", "File", "Record", "Page" }; #endif /* * Mode types */ #define MODE_S 1 /* stream */ #define MODE_B 2 /* block */ #define MODE_C 3 /* compressed */ #ifdef FTP_NAMES char *modenames[] = {"0", "Stream", "Block", "Compressed" }; #endif /* * Record Tokens */ #define REC_ESC '\377' /* Record-mode Escape */ #define REC_EOR '\001' /* Record-mode End-of-Record */ #define REC_EOF '\002' /* Record-mode End-of-File */ /* * Block Header */ #define BLK_EOR 0x80 /* Block is End-of-Record */ #define BLK_EOF 0x40 /* Block is End-of-File */ #define BLK_ERRORS 0x20 /* Block is suspected of containing errors */ #define BLK_RESTART 0x10 /* Block is Restart Marker */ #define BLK_BYTECOUNT 2 /* Bytes in this block */ #endif /* arpa/ftp.h */ ��������������������������������������������������������������������������������������������������������������������������������������������������������arpa/tftp.h�����������������������������������������������������������������������������������������0000644�����������������00000005753�14763166030�0006635 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)tftp.h 8.1 (Berkeley) 6/2/93 */ #ifndef _ARPA_TFTP_H #define _ARPA_TFTP_H 1 /* * Trivial File Transfer Protocol (IEN-133) */ #define SEGSIZE 512 /* data segment size */ /* * Packet types. */ #define RRQ 01 /* read request */ #define WRQ 02 /* write request */ #define DATA 03 /* data packet */ #define ACK 04 /* acknowledgement */ #define ERROR 05 /* error code */ struct tftphdr { short th_opcode; /* packet type */ union { char tu_padding[3]; /* sizeof() compat */ struct { union { unsigned short tu_block; /* block # */ short tu_code; /* error code */ } __attribute__ ((__packed__)) th_u3; char tu_data[0]; /* data or error string */ } __attribute__ ((__packed__)) th_u2; char tu_stuff[0]; /* request packet stuff */ } __attribute__ ((__packed__)) th_u1; } __attribute__ ((__packed__)); #define th_block th_u1.th_u2.th_u3.tu_block #define th_code th_u1.th_u2.th_u3.tu_code #define th_stuff th_u1.tu_stuff #define th_data th_u1.th_u2.tu_data #define th_msg th_u1.th_u2.tu_data /* * Error codes. */ #define EUNDEF 0 /* not defined */ #define ENOTFOUND 1 /* file not found */ #define EACCESS 2 /* access violation */ #define ENOSPACE 3 /* disk full or allocation exceeded */ #define EBADOP 4 /* illegal TFTP operation */ #define EBADID 5 /* unknown transfer ID */ #define EEXISTS 6 /* file already exists */ #define ENOUSER 7 /* no such user */ #endif /* arpa/tftp.h */ ���������������������arpa/nameser_compat.h�������������������������������������������������������������������������������0000644�����������������00000015601�14763166030�0010646 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (c) 1983, 1989 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _ARPA_NAMESER_COMPAT_ #define _ARPA_NAMESER_COMPAT_ #include <endian.h> /*% * Structure for query header. The order of the fields is machine- and * compiler-dependent, depending on the byte/bit order and the layout * of bit fields. We use bit fields only in int variables, as this * is all ANSI requires. This requires a somewhat confusing rearrangement. */ typedef struct { unsigned id :16; /*%< query identification number */ #if __BYTE_ORDER == __BIG_ENDIAN /* fields in third byte */ unsigned qr: 1; /*%< response flag */ unsigned opcode: 4; /*%< purpose of message */ unsigned aa: 1; /*%< authoritive answer */ unsigned tc: 1; /*%< truncated message */ unsigned rd: 1; /*%< recursion desired */ /* fields in fourth byte */ unsigned ra: 1; /*%< recursion available */ unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */ unsigned ad: 1; /*%< authentic data from named */ unsigned cd: 1; /*%< checking disabled by resolver */ unsigned rcode :4; /*%< response code */ #endif #if __BYTE_ORDER == __LITTLE_ENDIAN || __BYTE_ORDER == __PDP_ENDIAN /* fields in third byte */ unsigned rd :1; /*%< recursion desired */ unsigned tc :1; /*%< truncated message */ unsigned aa :1; /*%< authoritive answer */ unsigned opcode :4; /*%< purpose of message */ unsigned qr :1; /*%< response flag */ /* fields in fourth byte */ unsigned rcode :4; /*%< response code */ unsigned cd: 1; /*%< checking disabled by resolver */ unsigned ad: 1; /*%< authentic data from named */ unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */ unsigned ra :1; /*%< recursion available */ #endif /* remaining bytes */ unsigned qdcount :16; /*%< number of question entries */ unsigned ancount :16; /*%< number of answer entries */ unsigned nscount :16; /*%< number of authority entries */ unsigned arcount :16; /*%< number of resource entries */ } HEADER; #define PACKETSZ NS_PACKETSZ #define MAXDNAME NS_MAXDNAME #define MAXCDNAME NS_MAXCDNAME #define MAXLABEL NS_MAXLABEL #define HFIXEDSZ NS_HFIXEDSZ #define QFIXEDSZ NS_QFIXEDSZ #define RRFIXEDSZ NS_RRFIXEDSZ #define INT32SZ NS_INT32SZ #define INT16SZ NS_INT16SZ #define INT8SZ NS_INT8SZ #define INADDRSZ NS_INADDRSZ #define IN6ADDRSZ NS_IN6ADDRSZ #define INDIR_MASK NS_CMPRSFLGS #define NAMESERVER_PORT NS_DEFAULTPORT #define S_ZONE ns_s_zn #define S_PREREQ ns_s_pr #define S_UPDATE ns_s_ud #define S_ADDT ns_s_ar #define QUERY ns_o_query #define IQUERY ns_o_iquery #define STATUS ns_o_status #define NS_NOTIFY_OP ns_o_notify #define NS_UPDATE_OP ns_o_update #define NOERROR ns_r_noerror #define FORMERR ns_r_formerr #define SERVFAIL ns_r_servfail #define NXDOMAIN ns_r_nxdomain #define NOTIMP ns_r_notimpl #define REFUSED ns_r_refused #define YXDOMAIN ns_r_yxdomain #define YXRRSET ns_r_yxrrset #define NXRRSET ns_r_nxrrset #define NOTAUTH ns_r_notauth #define NOTZONE ns_r_notzone /*#define BADSIG ns_r_badsig*/ /*#define BADKEY ns_r_badkey*/ /*#define BADTIME ns_r_badtime*/ #define DELETE ns_uop_delete #define ADD ns_uop_add #define T_A ns_t_a #define T_NS ns_t_ns #define T_MD ns_t_md #define T_MF ns_t_mf #define T_CNAME ns_t_cname #define T_SOA ns_t_soa #define T_MB ns_t_mb #define T_MG ns_t_mg #define T_MR ns_t_mr #define T_NULL ns_t_null #define T_WKS ns_t_wks #define T_PTR ns_t_ptr #define T_HINFO ns_t_hinfo #define T_MINFO ns_t_minfo #define T_MX ns_t_mx #define T_TXT ns_t_txt #define T_RP ns_t_rp #define T_AFSDB ns_t_afsdb #define T_X25 ns_t_x25 #define T_ISDN ns_t_isdn #define T_RT ns_t_rt #define T_NSAP ns_t_nsap #define T_NSAP_PTR ns_t_nsap_ptr #define T_SIG ns_t_sig #define T_KEY ns_t_key #define T_PX ns_t_px #define T_GPOS ns_t_gpos #define T_AAAA ns_t_aaaa #define T_LOC ns_t_loc #define T_NXT ns_t_nxt #define T_EID ns_t_eid #define T_NIMLOC ns_t_nimloc #define T_SRV ns_t_srv #define T_ATMA ns_t_atma #define T_NAPTR ns_t_naptr #define T_KX ns_t_kx #define T_CERT ns_t_cert #define T_A6 ns_t_a6 #define T_DNAME ns_t_dname #define T_SINK ns_t_sink #define T_OPT ns_t_opt #define T_APL ns_t_apl #define T_DS ns_t_ds #define T_SSHFP ns_t_sshfp #define T_IPSECKEY ns_t_ipseckey #define T_RRSIG ns_t_rrsig #define T_NSEC ns_t_nsec #define T_DNSKEY ns_t_dnskey #define T_DHCID ns_t_dhcid #define T_NSEC3 ns_t_nsec3 #define T_NSEC3PARAM ns_t_nsec3param #define T_TLSA ns_t_tlsa #define T_SMIMEA ns_t_smimea #define T_HIP ns_t_hip #define T_NINFO ns_t_ninfo #define T_RKEY ns_t_rkey #define T_TALINK ns_t_talink #define T_CDS ns_t_cds #define T_CDNSKEY ns_t_cdnskey #define T_OPENPGPKEY ns_t_openpgpkey #define T_CSYNC ns_t_csync #define T_SPF ns_t_spf #define T_UINFO ns_t_uinfo #define T_UID ns_t_uid #define T_GID ns_t_gid #define T_UNSPEC ns_t_unspec #define T_NID ns_t_nid #define T_L32 ns_t_l32 #define T_L64 ns_t_l64 #define T_LP ns_t_lp #define T_EUI48 ns_t_eui48 #define T_EUI64 ns_t_eui64 #define T_TKEY ns_t_tkey #define T_TSIG ns_t_tsig #define T_IXFR ns_t_ixfr #define T_AXFR ns_t_axfr #define T_MAILB ns_t_mailb #define T_MAILA ns_t_maila #define T_ANY ns_t_any #define T_URI ns_t_uri #define T_CAA ns_t_caa #define T_AVC ns_t_avc #define T_TA ns_t_ta #define T_DLV ns_t_dlv #define C_IN ns_c_in #define C_CHAOS ns_c_chaos #define C_HS ns_c_hs /* BIND_UPDATE */ #define C_NONE ns_c_none #define C_ANY ns_c_any #define GETSHORT NS_GET16 #define GETLONG NS_GET32 #define PUTSHORT NS_PUT16 #define PUTLONG NS_PUT32 #endif /* _ARPA_NAMESER_COMPAT_ */ /*! \file */ �������������������������������������������������������������������������������������������������������������������������������arpa/nameser.h��������������������������������������������������������������������������������������0000644�����������������00000033563�14763166030�0007312 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 1983, 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /* * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-1999 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #ifndef _ARPA_NAMESER_H_ #define _ARPA_NAMESER_H_ #include <sys/param.h> #include <sys/types.h> #include <stdint.h> /* * Define constants based on RFC 883, RFC 1034, RFC 1035 */ #define NS_PACKETSZ 512 /*%< default UDP packet size */ #define NS_MAXDNAME 1025 /*%< maximum domain name */ #define NS_MAXMSG 65535 /*%< maximum message size */ #define NS_MAXCDNAME 255 /*%< maximum compressed domain name */ #define NS_MAXLABEL 63 /*%< maximum length of domain label */ #define NS_HFIXEDSZ 12 /*%< #/bytes of fixed data in header */ #define NS_QFIXEDSZ 4 /*%< #/bytes of fixed data in query */ #define NS_RRFIXEDSZ 10 /*%< #/bytes of fixed data in r record */ #define NS_INT32SZ 4 /*%< #/bytes of data in a uint32_t */ #define NS_INT16SZ 2 /*%< #/bytes of data in a uint16_t */ #define NS_INT8SZ 1 /*%< #/bytes of data in a uint8_t */ #define NS_INADDRSZ 4 /*%< IPv4 T_A */ #define NS_IN6ADDRSZ 16 /*%< IPv6 T_AAAA */ #define NS_CMPRSFLGS 0xc0 /*%< Flag bits indicating name compression. */ #define NS_DEFAULTPORT 53 /*%< For both TCP and UDP. */ /* * These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord() * in synch with it. */ typedef enum __ns_sect { ns_s_qd = 0, /*%< Query: Question. */ ns_s_zn = 0, /*%< Update: Zone. */ ns_s_an = 1, /*%< Query: Answer. */ ns_s_pr = 1, /*%< Update: Prerequisites. */ ns_s_ns = 2, /*%< Query: Name servers. */ ns_s_ud = 2, /*%< Update: Update. */ ns_s_ar = 3, /*%< Query|Update: Additional records. */ ns_s_max = 4 } ns_sect; /*% * This is a message handle. It is caller allocated and has no dynamic data. * This structure is intended to be opaque to all but ns_parse.c, thus the * leading _'s on the member names. Use the accessor functions, not the _'s. */ typedef struct __ns_msg { const unsigned char *_msg, *_eom; uint16_t _id, _flags, _counts[ns_s_max]; const unsigned char *_sections[ns_s_max]; ns_sect _sect; int _rrnum; const unsigned char *_msg_ptr; } ns_msg; /* Private data structure - do not use from outside library. */ struct _ns_flagdata { int mask, shift; }; extern const struct _ns_flagdata _ns_flagdata[]; /* Accessor macros - this is part of the public interface. */ #define ns_msg_id(handle) ((handle)._id + 0) #define ns_msg_base(handle) ((handle)._msg + 0) #define ns_msg_end(handle) ((handle)._eom + 0) #define ns_msg_size(handle) ((handle)._eom - (handle)._msg) #define ns_msg_count(handle, section) ((handle)._counts[section] + 0) /*% * This is a parsed record. It is caller allocated and has no dynamic data. */ typedef struct __ns_rr { char name[NS_MAXDNAME]; uint16_t type; uint16_t rr_class; uint32_t ttl; uint16_t rdlength; const unsigned char * rdata; } ns_rr; /* Accessor macros - this is part of the public interface. */ #define ns_rr_name(rr) (((rr).name[0] != '\0') ? (rr).name : ".") #define ns_rr_type(rr) ((ns_type)((rr).type + 0)) #define ns_rr_class(rr) ((ns_class)((rr).rr_class + 0)) #define ns_rr_ttl(rr) ((rr).ttl + 0) #define ns_rr_rdlen(rr) ((rr).rdlength + 0) #define ns_rr_rdata(rr) ((rr).rdata + 0) /*% * These don't have to be in the same order as in the packet flags word, * and they can even overlap in some cases, but they will need to be kept * in synch with ns_parse.c:ns_flagdata[]. */ typedef enum __ns_flag { ns_f_qr, /*%< Question/Response. */ ns_f_opcode, /*%< Operation code. */ ns_f_aa, /*%< Authoritative Answer. */ ns_f_tc, /*%< Truncation occurred. */ ns_f_rd, /*%< Recursion Desired. */ ns_f_ra, /*%< Recursion Available. */ ns_f_z, /*%< MBZ. */ ns_f_ad, /*%< Authentic Data (DNSSEC). */ ns_f_cd, /*%< Checking Disabled (DNSSEC). */ ns_f_rcode, /*%< Response code. */ ns_f_max } ns_flag; /*% * Currently defined opcodes. */ typedef enum __ns_opcode { ns_o_query = 0, /*%< Standard query. */ ns_o_iquery = 1, /*%< Inverse query (deprecated/unsupported). */ ns_o_status = 2, /*%< Name server status query (unsupported). */ /* Opcode 3 is undefined/reserved. */ ns_o_notify = 4, /*%< Zone change notification. */ ns_o_update = 5, /*%< Zone update message. */ ns_o_max = 6 } ns_opcode; /*% * Currently defined response codes. */ typedef enum __ns_rcode { ns_r_noerror = 0, /*%< No error occurred. */ ns_r_formerr = 1, /*%< Format error. */ ns_r_servfail = 2, /*%< Server failure. */ ns_r_nxdomain = 3, /*%< Name error. */ ns_r_notimpl = 4, /*%< Unimplemented. */ ns_r_refused = 5, /*%< Operation refused. */ /* these are for BIND_UPDATE */ ns_r_yxdomain = 6, /*%< Name exists */ ns_r_yxrrset = 7, /*%< RRset exists */ ns_r_nxrrset = 8, /*%< RRset does not exist */ ns_r_notauth = 9, /*%< Not authoritative for zone */ ns_r_notzone = 10, /*%< Zone of record different from zone section */ ns_r_max = 11, /* The following are EDNS extended rcodes */ ns_r_badvers = 16, /* The following are TSIG errors */ ns_r_badsig = 16, ns_r_badkey = 17, ns_r_badtime = 18 } ns_rcode; /* BIND_UPDATE */ typedef enum __ns_update_operation { ns_uop_delete = 0, ns_uop_add = 1, ns_uop_max = 2 } ns_update_operation; /*% * This structure is used for TSIG authenticated messages */ struct ns_tsig_key { char name[NS_MAXDNAME], alg[NS_MAXDNAME]; unsigned char *data; int len; }; typedef struct ns_tsig_key ns_tsig_key; /*% * This structure is used for TSIG authenticated TCP messages */ struct ns_tcp_tsig_state { int counter; struct dst_key *key; void *ctx; unsigned char sig[NS_PACKETSZ]; int siglen; }; typedef struct ns_tcp_tsig_state ns_tcp_tsig_state; #define NS_TSIG_FUDGE 300 #define NS_TSIG_TCP_COUNT 100 #define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT" #define NS_TSIG_ERROR_NO_TSIG -10 #define NS_TSIG_ERROR_NO_SPACE -11 #define NS_TSIG_ERROR_FORMERR -12 /*% * Currently defined type values for resources and queries. */ typedef enum __ns_type { ns_t_invalid = 0, ns_t_a = 1, ns_t_ns = 2, ns_t_md = 3, ns_t_mf = 4, ns_t_cname = 5, ns_t_soa = 6, ns_t_mb = 7, ns_t_mg = 8, ns_t_mr = 9, ns_t_null = 10, ns_t_wks = 11, ns_t_ptr = 12, ns_t_hinfo = 13, ns_t_minfo = 14, ns_t_mx = 15, ns_t_txt = 16, ns_t_rp = 17, ns_t_afsdb = 18, ns_t_x25 = 19, ns_t_isdn = 20, ns_t_rt = 21, ns_t_nsap = 22, ns_t_nsap_ptr = 23, ns_t_sig = 24, ns_t_key = 25, ns_t_px = 26, ns_t_gpos = 27, ns_t_aaaa = 28, ns_t_loc = 29, ns_t_nxt = 30, ns_t_eid = 31, ns_t_nimloc = 32, ns_t_srv = 33, ns_t_atma = 34, ns_t_naptr = 35, ns_t_kx = 36, ns_t_cert = 37, ns_t_a6 = 38, ns_t_dname = 39, ns_t_sink = 40, ns_t_opt = 41, ns_t_apl = 42, ns_t_ds = 43, ns_t_sshfp = 44, ns_t_ipseckey = 45, ns_t_rrsig = 46, ns_t_nsec = 47, ns_t_dnskey = 48, ns_t_dhcid = 49, ns_t_nsec3 = 50, ns_t_nsec3param = 51, ns_t_tlsa = 52, ns_t_smimea = 53, ns_t_hip = 55, ns_t_ninfo = 56, ns_t_rkey = 57, ns_t_talink = 58, ns_t_cds = 59, ns_t_cdnskey = 60, ns_t_openpgpkey = 61, ns_t_csync = 62, ns_t_spf = 99, ns_t_uinfo = 100, ns_t_uid = 101, ns_t_gid = 102, ns_t_unspec = 103, ns_t_nid = 104, ns_t_l32 = 105, ns_t_l64 = 106, ns_t_lp = 107, ns_t_eui48 = 108, ns_t_eui64 = 109, ns_t_tkey = 249, ns_t_tsig = 250, ns_t_ixfr = 251, ns_t_axfr = 252, ns_t_mailb = 253, ns_t_maila = 254, ns_t_any = 255, ns_t_uri = 256, ns_t_caa = 257, ns_t_avc = 258, ns_t_ta = 32768, ns_t_dlv = 32769, ns_t_max = 65536 } ns_type; /*% * Values for class field */ typedef enum __ns_class { ns_c_invalid = 0, /*%< Cookie. */ ns_c_in = 1, /*%< Internet. */ ns_c_2 = 2, /*%< unallocated/unsupported. */ ns_c_chaos = 3, /*%< MIT Chaos-net. */ ns_c_hs = 4, /*%< MIT Hesiod. */ /* Query class values which do not appear in resource records */ ns_c_none = 254, /*%< for prereq. sections in update requests */ ns_c_any = 255, /*%< Wildcard match. */ ns_c_max = 65536 } ns_class; /* Certificate type values in CERT resource records. */ typedef enum __ns_cert_types { cert_t_pkix = 1, /*%< PKIX (X.509v3) */ cert_t_spki = 2, /*%< SPKI */ cert_t_pgp = 3, /*%< PGP */ cert_t_url = 253, /*%< URL private type */ cert_t_oid = 254 /*%< OID private type */ } ns_cert_types; /*% * EDNS0 extended flags and option codes, host order. */ #define NS_OPT_DNSSEC_OK 0x8000U #define NS_OPT_NSID 3 /*% * Inline versions of get/put short/long. Pointer is advanced. */ #define NS_GET16(s, cp) do { \ const unsigned char *t_cp = (const unsigned char *)(cp); \ (s) = ((uint16_t)t_cp[0] << 8) \ | ((uint16_t)t_cp[1]) \ ; \ (cp) += NS_INT16SZ; \ } while (0) #define NS_GET32(l, cp) do { \ const unsigned char *t_cp = (const unsigned char *)(cp); \ (l) = ((uint32_t)t_cp[0] << 24) \ | ((uint32_t)t_cp[1] << 16) \ | ((uint32_t)t_cp[2] << 8) \ | ((uint32_t)t_cp[3]) \ ; \ (cp) += NS_INT32SZ; \ } while (0) #define NS_PUT16(s, cp) do { \ uint16_t t_s = (uint16_t)(s); \ unsigned char *t_cp = (unsigned char *)(cp); \ *t_cp++ = t_s >> 8; \ *t_cp = t_s; \ (cp) += NS_INT16SZ; \ } while (0) #define NS_PUT32(l, cp) do { \ uint32_t t_l = (uint32_t)(l); \ unsigned char *t_cp = (unsigned char *)(cp); \ *t_cp++ = t_l >> 24; \ *t_cp++ = t_l >> 16; \ *t_cp++ = t_l >> 8; \ *t_cp = t_l; \ (cp) += NS_INT32SZ; \ } while (0) __BEGIN_DECLS int ns_msg_getflag (ns_msg, int) __THROW; unsigned int ns_get16 (const unsigned char *) __THROW; unsigned long ns_get32 (const unsigned char *) __THROW; void ns_put16 (unsigned int, unsigned char *) __THROW; void ns_put32 (unsigned long, unsigned char *) __THROW; int ns_initparse (const unsigned char *, int, ns_msg *) __THROW; int ns_skiprr (const unsigned char *, const unsigned char *, ns_sect, int) __THROW; int ns_parserr (ns_msg *, ns_sect, int, ns_rr *) __THROW; int ns_sprintrr (const ns_msg *, const ns_rr *, const char *, const char *, char *, size_t) __THROW; int ns_sprintrrf (const unsigned char *, size_t, const char *, ns_class, ns_type, unsigned long, const unsigned char *, size_t, const char *, const char *, char *, size_t) __THROW; int ns_format_ttl (unsigned long, char *, size_t) __THROW; int ns_parse_ttl (const char *, unsigned long *) __THROW; uint32_t ns_datetosecs (const char *, int *) __THROW; int ns_name_ntol (const unsigned char *, unsigned char *, size_t) __THROW; int ns_name_ntop (const unsigned char *, char *, size_t) __THROW; int ns_name_pton (const char *, unsigned char *, size_t) __THROW; int ns_name_unpack (const unsigned char *, const unsigned char *, const unsigned char *, unsigned char *, size_t) __THROW; int ns_name_pack (const unsigned char *, unsigned char *, int, const unsigned char **, const unsigned char **) __THROW; int ns_name_uncompress (const unsigned char *, const unsigned char *, const unsigned char *, char *, size_t) __THROW; int ns_name_compress (const char *, unsigned char *, size_t, const unsigned char **, const unsigned char **) __THROW; int ns_name_skip (const unsigned char **, const unsigned char *) __THROW; void ns_name_rollback (const unsigned char *, const unsigned char **, const unsigned char **) __THROW; int ns_samedomain (const char *, const char *) __THROW; int ns_subdomain (const char *, const char *) __THROW; int ns_makecanon (const char *, char *, size_t) __THROW; int ns_samename (const char *, const char *) __THROW; __END_DECLS #include <arpa/nameser_compat.h> #endif /* !_ARPA_NAMESER_H_ */ /*! \file */ ���������������������������������������������������������������������������������������������������������������������������������������������arpa/telnet.h���������������������������������������������������������������������������������������0000644�����������������00000024027�14763166030�0007146 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)telnet.h 8.2 (Berkeley) 12/15/93 */ #ifndef _ARPA_TELNET_H #define _ARPA_TELNET_H 1 /* * Definitions for the TELNET protocol. */ #define IAC 255 /* interpret as command: */ #define DONT 254 /* you are not to use option */ #define DO 253 /* please, you use option */ #define WONT 252 /* I won't use option */ #define WILL 251 /* I will use option */ #define SB 250 /* interpret as subnegotiation */ #define GA 249 /* you may reverse the line */ #define EL 248 /* erase the current line */ #define EC 247 /* erase the current character */ #define AYT 246 /* are you there */ #define AO 245 /* abort output--but let prog finish */ #define IP 244 /* interrupt process--permanently */ #define BREAK 243 /* break */ #define DM 242 /* data mark--for connect. cleaning */ #define NOP 241 /* nop */ #define SE 240 /* end sub negotiation */ #define EOR 239 /* end of record (transparent mode) */ #define ABORT 238 /* Abort process */ #define SUSP 237 /* Suspend process */ #define xEOF 236 /* End of file: EOF is already used... */ #define SYNCH 242 /* for telfunc calls */ #ifdef TELCMDS char *telcmds[] = { "EOF", "SUSP", "ABORT", "EOR", "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0, }; #else extern char *telcmds[]; #endif #define TELCMD_FIRST xEOF #define TELCMD_LAST IAC #define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \ (unsigned int)(x) >= TELCMD_FIRST) #define TELCMD(x) telcmds[(x)-TELCMD_FIRST] /* telnet options */ #define TELOPT_BINARY 0 /* 8-bit data path */ #define TELOPT_ECHO 1 /* echo */ #define TELOPT_RCP 2 /* prepare to reconnect */ #define TELOPT_SGA 3 /* suppress go ahead */ #define TELOPT_NAMS 4 /* approximate message size */ #define TELOPT_STATUS 5 /* give status */ #define TELOPT_TM 6 /* timing mark */ #define TELOPT_RCTE 7 /* remote controlled transmission and echo */ #define TELOPT_NAOL 8 /* negotiate about output line width */ #define TELOPT_NAOP 9 /* negotiate about output page size */ #define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ #define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ #define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ #define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ #define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ #define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ #define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ #define TELOPT_XASCII 17 /* extended ascii character set */ #define TELOPT_LOGOUT 18 /* force logout */ #define TELOPT_BM 19 /* byte macro */ #define TELOPT_DET 20 /* data entry terminal */ #define TELOPT_SUPDUP 21 /* supdup protocol */ #define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ #define TELOPT_SNDLOC 23 /* send location */ #define TELOPT_TTYPE 24 /* terminal type */ #define TELOPT_EOR 25 /* end or record */ #define TELOPT_TUID 26 /* TACACS user identification */ #define TELOPT_OUTMRK 27 /* output marking */ #define TELOPT_TTYLOC 28 /* terminal location number */ #define TELOPT_3270REGIME 29 /* 3270 regime */ #define TELOPT_X3PAD 30 /* X.3 PAD */ #define TELOPT_NAWS 31 /* window size */ #define TELOPT_TSPEED 32 /* terminal speed */ #define TELOPT_LFLOW 33 /* remote flow control */ #define TELOPT_LINEMODE 34 /* Linemode option */ #define TELOPT_XDISPLOC 35 /* X Display Location */ #define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */ #define TELOPT_AUTHENTICATION 37/* Authenticate */ #define TELOPT_ENCRYPT 38 /* Encryption option */ #define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */ #define TELOPT_EXOPL 255 /* extended-options-list */ #define NTELOPTS (1+TELOPT_NEW_ENVIRON) #ifdef TELOPTS char *telopts[NTELOPTS+1] = { "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", "TACACS UID", "OUTPUT MARKING", "TTYLOC", "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", "ENCRYPT", "NEW-ENVIRON", 0, }; #define TELOPT_FIRST TELOPT_BINARY #define TELOPT_LAST TELOPT_NEW_ENVIRON #define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST) #define TELOPT(x) telopts[(x)-TELOPT_FIRST] #endif /* sub-option qualifiers */ #define TELQUAL_IS 0 /* option is... */ #define TELQUAL_SEND 1 /* send option */ #define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ #define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ #define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ #define LFLOW_OFF 0 /* Disable remote flow control */ #define LFLOW_ON 1 /* Enable remote flow control */ #define LFLOW_RESTART_ANY 2 /* Restart output on any char */ #define LFLOW_RESTART_XON 3 /* Restart output only on XON */ /* * LINEMODE suboptions */ #define LM_MODE 1 #define LM_FORWARDMASK 2 #define LM_SLC 3 #define MODE_EDIT 0x01 #define MODE_TRAPSIG 0x02 #define MODE_ACK 0x04 #define MODE_SOFT_TAB 0x08 #define MODE_LIT_ECHO 0x10 #define MODE_MASK 0x1f /* Not part of protocol, but needed to simplify things... */ #define MODE_FLOW 0x0100 #define MODE_ECHO 0x0200 #define MODE_INBIN 0x0400 #define MODE_OUTBIN 0x0800 #define MODE_FORCE 0x1000 #define SLC_SYNCH 1 #define SLC_BRK 2 #define SLC_IP 3 #define SLC_AO 4 #define SLC_AYT 5 #define SLC_EOR 6 #define SLC_ABORT 7 #define SLC_EOF 8 #define SLC_SUSP 9 #define SLC_EC 10 #define SLC_EL 11 #define SLC_EW 12 #define SLC_RP 13 #define SLC_LNEXT 14 #define SLC_XON 15 #define SLC_XOFF 16 #define SLC_FORW1 17 #define SLC_FORW2 18 #define NSLC 18 /* * For backwards compatibility, we define SLC_NAMES to be the * list of names if SLC_NAMES is not defined. */ #define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0, #ifdef SLC_NAMES char *slc_names[] = { SLC_NAMELIST }; #else extern char *slc_names[]; #define SLC_NAMES SLC_NAMELIST #endif #define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) #define SLC_NAME(x) slc_names[x] #define SLC_NOSUPPORT 0 #define SLC_CANTCHANGE 1 #define SLC_VARIABLE 2 #define SLC_DEFAULT 3 #define SLC_LEVELBITS 0x03 #define SLC_FUNC 0 #define SLC_FLAGS 1 #define SLC_VALUE 2 #define SLC_ACK 0x80 #define SLC_FLUSHIN 0x40 #define SLC_FLUSHOUT 0x20 #define OLD_ENV_VAR 1 #define OLD_ENV_VALUE 0 #define NEW_ENV_VAR 0 #define NEW_ENV_VALUE 1 #define ENV_ESC 2 #define ENV_USERVAR 3 /* * AUTHENTICATION suboptions */ /* * Who is authenticating who ... */ #define AUTH_WHO_CLIENT 0 /* Client authenticating server */ #define AUTH_WHO_SERVER 1 /* Server authenticating client */ #define AUTH_WHO_MASK 1 /* * amount of authentication done */ #define AUTH_HOW_ONE_WAY 0 #define AUTH_HOW_MUTUAL 2 #define AUTH_HOW_MASK 2 #define AUTHTYPE_NULL 0 #define AUTHTYPE_KERBEROS_V4 1 #define AUTHTYPE_KERBEROS_V5 2 #define AUTHTYPE_SPX 3 #define AUTHTYPE_MINK 4 #define AUTHTYPE_CNT 5 #define AUTHTYPE_TEST 99 #ifdef AUTH_NAMES char *authtype_names[] = { "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0, }; #else extern char *authtype_names[]; #endif #define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) #define AUTHTYPE_NAME(x) authtype_names[x] /* * ENCRYPTion suboptions */ #define ENCRYPT_IS 0 /* I pick encryption type ... */ #define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ #define ENCRYPT_REPLY 2 /* Initial setup response */ #define ENCRYPT_START 3 /* Am starting to send encrypted */ #define ENCRYPT_END 4 /* Am ending encrypted */ #define ENCRYPT_REQSTART 5 /* Request you start encrypting */ #define ENCRYPT_REQEND 6 /* Request you send encrypting */ #define ENCRYPT_ENC_KEYID 7 #define ENCRYPT_DEC_KEYID 8 #define ENCRYPT_CNT 9 #define ENCTYPE_ANY 0 #define ENCTYPE_DES_CFB64 1 #define ENCTYPE_DES_OFB64 2 #define ENCTYPE_CNT 3 #ifdef ENCRYPT_NAMES char *encrypt_names[] = { "IS", "SUPPORT", "REPLY", "START", "END", "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", 0, }; char *enctype_names[] = { "ANY", "DES_CFB64", "DES_OFB64", 0, }; #else extern char *encrypt_names[]; extern char *enctype_names[]; #endif #define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) #define ENCRYPT_NAME(x) encrypt_names[x] #define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) #define ENCTYPE_NAME(x) enctype_names[x] #endif /* arpa/telnet.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������execinfo.h������������������������������������������������������������������������������������������0000644�����������������00000003005�14763166030�0006521 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1998, 1999, 2004, 2005, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _EXECINFO_H #define _EXECINFO_H 1 #include <features.h> __BEGIN_DECLS /* Store up to SIZE return address of the current program state in ARRAY and return the exact number of values stored. */ extern int backtrace (void **__array, int __size) __nonnull ((1)); /* Return names of functions from the backtrace list in ARRAY in a newly malloc()ed memory block. */ extern char **backtrace_symbols (void *const *__array, int __size) __THROW __nonnull ((1)); /* This function is similar to backtrace_symbols() but it writes the result immediately to a file. */ extern void backtrace_symbols_fd (void *const *__array, int __size, int __fd) __THROW __nonnull ((1)); __END_DECLS #endif /* execinfo.h */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������semaphore.h�����������������������������������������������������������������������������������������0000644�����������������00000004557�14763166030�0006721 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2002, 2003, 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SEMAPHORE_H #define _SEMAPHORE_H 1 #include <features.h> #include <sys/types.h> #ifdef __USE_XOPEN2K # define __need_timespec # include <time.h> #endif /* Get the definition for sem_t. */ #include <bits/semaphore.h> __BEGIN_DECLS /* Initialize semaphore object SEM to VALUE. If PSHARED then share it with other processes. */ extern int sem_init (sem_t *__sem, int __pshared, unsigned int __value) __THROW; /* Free resources associated with semaphore object SEM. */ extern int sem_destroy (sem_t *__sem) __THROW; /* Open a named semaphore NAME with open flags OFLAG. */ extern sem_t *sem_open (const char *__name, int __oflag, ...) __THROW; /* Close descriptor for named semaphore SEM. */ extern int sem_close (sem_t *__sem) __THROW; /* Remove named semaphore NAME. */ extern int sem_unlink (const char *__name) __THROW; /* Wait for SEM being posted. This function is a cancellation point and therefore not marked with __THROW. */ extern int sem_wait (sem_t *__sem); #ifdef __USE_XOPEN2K /* Similar to `sem_wait' but wait only until ABSTIME. This function is a cancellation point and therefore not marked with __THROW. */ extern int sem_timedwait (sem_t *__restrict __sem, const struct timespec *__restrict __abstime); #endif /* Test whether SEM is posted. */ extern int sem_trywait (sem_t *__sem) __THROWNL; /* Post SEM. */ extern int sem_post (sem_t *__sem) __THROWNL; /* Get current value of SEM and store it in *SVAL. */ extern int sem_getvalue (sem_t *__restrict __sem, int *__restrict __sval) __THROW; __END_DECLS #endif /* semaphore.h */ �������������������������������������������������������������������������������������������������������������������������������������������������krad.h����������������������������������������������������������������������������������������������0000644�����������������00000021345�14763166030�0005651 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 2013 Red Hat, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * This API is not considered as stable as the main krb5 API. * * - We may make arbitrary incompatible changes between feature releases * (e.g. from 1.12 to 1.13). * - We will make some effort to avoid making incompatible changes for * bugfix releases, but will make them if necessary. */ #ifndef KRAD_H_ #define KRAD_H_ #include <krb5.h> #include <verto.h> #include <stddef.h> #include <stdio.h> #define KRAD_PACKET_SIZE_MAX 4096 #define KRAD_SERVICE_TYPE_LOGIN 1 #define KRAD_SERVICE_TYPE_FRAMED 2 #define KRAD_SERVICE_TYPE_CALLBACK_LOGIN 3 #define KRAD_SERVICE_TYPE_CALLBACK_FRAMED 4 #define KRAD_SERVICE_TYPE_OUTBOUND 5 #define KRAD_SERVICE_TYPE_ADMINISTRATIVE 6 #define KRAD_SERVICE_TYPE_NAS_PROMPT 7 #define KRAD_SERVICE_TYPE_AUTHENTICATE_ONLY 8 #define KRAD_SERVICE_TYPE_CALLBACK_NAS_PROMPT 9 #define KRAD_SERVICE_TYPE_CALL_CHECK 10 #define KRAD_SERVICE_TYPE_CALLBACK_ADMINISTRATIVE 11 typedef struct krad_attrset_st krad_attrset; typedef struct krad_packet_st krad_packet; typedef struct krad_client_st krad_client; typedef unsigned char krad_code; typedef unsigned char krad_attr; /* Called when a response is received or the request times out. */ typedef void (*krad_cb)(krb5_error_code retval, const krad_packet *request, const krad_packet *response, void *data); /* * Called to iterate over a set of requests. Either the callback will be * called until it returns NULL, or it will be called with cancel = TRUE to * terminate in the middle of an iteration. */ typedef const krad_packet * (*krad_packet_iter_cb)(void *data, krb5_boolean cancel); /* * Code */ /* Convert a code name to its number. Only works for codes defined * by RFC 2875 or 2882. Returns 0 if the name was not found. */ krad_code krad_code_name2num(const char *name); /* Convert a code number to its name. Only works for attributes defined * by RFC 2865 or 2882. Returns NULL if the name was not found. */ const char * krad_code_num2name(krad_code code); /* * Attribute */ /* Convert an attribute name to its number. Only works for attributes defined * by RFC 2865. Returns 0 if the name was not found. */ krad_attr krad_attr_name2num(const char *name); /* Convert an attribute number to its name. Only works for attributes defined * by RFC 2865. Returns NULL if the name was not found. */ const char * krad_attr_num2name(krad_attr type); /* * Attribute set */ /* Create a new attribute set. */ krb5_error_code krad_attrset_new(krb5_context ctx, krad_attrset **set); /* Create a deep copy of an attribute set. */ krb5_error_code krad_attrset_copy(const krad_attrset *set, krad_attrset **copy); /* Free an attribute set. */ void krad_attrset_free(krad_attrset *set); /* Add an attribute to a set. */ krb5_error_code krad_attrset_add(krad_attrset *set, krad_attr type, const krb5_data *data); /* Add a four-octet unsigned number attribute to the given set. */ krb5_error_code krad_attrset_add_number(krad_attrset *set, krad_attr type, krb5_ui_4 num); /* Delete the specified attribute. */ void krad_attrset_del(krad_attrset *set, krad_attr type, size_t indx); /* Get the specified attribute. */ const krb5_data * krad_attrset_get(const krad_attrset *set, krad_attr type, size_t indx); /* * Packet */ /* Determine the bytes needed from the socket to get the whole packet. Don't * cache the return value as it can change! Returns -1 on EBADMSG. */ ssize_t krad_packet_bytes_needed(const krb5_data *buffer); /* Free a packet. */ void krad_packet_free(krad_packet *pkt); /* * Create a new request packet. * * This function takes the attributes specified in set and converts them into a * radius packet. The packet will have a randomized id. If cb is not NULL, it * will be called passing data as the argument to iterate over a set of * outstanding requests. In this case, the id will be both random and unique * across the set of requests. */ krb5_error_code krad_packet_new_request(krb5_context ctx, const char *secret, krad_code code, const krad_attrset *set, krad_packet_iter_cb cb, void *data, krad_packet **request); /* * Create a new response packet. * * This function is similar to krad_packet_new_requst() except that it crafts a * packet in response to a request packet. This new packet will borrow values * from the request such as the id and the authenticator. */ krb5_error_code krad_packet_new_response(krb5_context ctx, const char *secret, krad_code code, const krad_attrset *set, const krad_packet *request, krad_packet **response); /* * Decode a request radius packet from krb5_data. * * The resulting decoded packet will be a request packet stored in *reqpkt. * * If cb is NULL, *duppkt will always be NULL. * * If cb is not NULL, it will be called (with the data argument) to iterate * over a set of requests currently being processed. In this case, if the * packet is a duplicate of an already received request, the original request * will be set in *duppkt. */ krb5_error_code krad_packet_decode_request(krb5_context ctx, const char *secret, const krb5_data *buffer, krad_packet_iter_cb cb, void *data, const krad_packet **duppkt, krad_packet **reqpkt); /* * Decode a response radius packet from krb5_data. * * The resulting decoded packet will be a response packet stored in *rsppkt. * * If cb is NULL, *reqpkt will always be NULL. * * If cb is not NULL, it will be called (with the data argument) to iterate * over a set of requests awaiting responses. In this case, if the response * packet matches one of these requests, the original request will be set in * *reqpkt. */ krb5_error_code krad_packet_decode_response(krb5_context ctx, const char *secret, const krb5_data *buffer, krad_packet_iter_cb cb, void *data, const krad_packet **reqpkt, krad_packet **rsppkt); /* Encode packet. */ const krb5_data * krad_packet_encode(const krad_packet *pkt); /* Get the code for the given packet. */ krad_code krad_packet_get_code(const krad_packet *pkt); /* Get the specified attribute. */ const krb5_data * krad_packet_get_attr(const krad_packet *pkt, krad_attr type, size_t indx); /* * Client */ /* Create a new client. */ krb5_error_code krad_client_new(krb5_context kctx, verto_ctx *vctx, krad_client **client); /* Free the client. */ void krad_client_free(krad_client *client); /* * Send a request to a radius server. * * The remote host may be specified by one of the following formats: * - /path/to/unix.socket * - IPv4 * - IPv4:port * - IPv4:service * - [IPv6] * - [IPv6]:port * - [IPv6]:service * - hostname * - hostname:port * - hostname:service * * The timeout parameter (milliseconds) is the total timeout across all remote * hosts (when DNS returns multiple entries) and all retries. For stream * sockets, the retries parameter is ignored and no retries are performed. * * The cb function will be called with the data argument when either a response * is received or the request times out on all possible remote hosts. */ krb5_error_code krad_client_send(krad_client *rc, krad_code code, const krad_attrset *attrs, const char *remote, const char *secret, int timeout, size_t retries, krad_cb cb, void *data); #endif /* KRAD_H_ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������sqlda-compat.h��������������������������������������������������������������������������������������0000644�����������������00000003057�14763166030�0007315 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * pgsql/src/interfaces/ecpg/include/sqlda-infx-compat.h */ #ifndef ECPG_SQLDA_COMPAT_H #define ECPG_SQLDA_COMPAT_H struct sqlvar_compat { short sqltype; /* variable type */ int sqllen; /* length in bytes */ char *sqldata; /* pointer to data */ short *sqlind; /* pointer to indicator */ char *sqlname; /* variable name */ char *sqlformat; /* reserved for future use */ short sqlitype; /* ind variable type */ short sqlilen; /* ind length in bytes */ char *sqlidata; /* ind data pointer */ int sqlxid; /* extended id type */ char *sqltypename; /* extended type name */ short sqltypelen; /* length of extended type name */ short sqlownerlen; /* length of owner name */ short sqlsourcetype; /* source type for distinct of built-ins */ char *sqlownername; /* owner name */ int sqlsourceid; /* extended id of source type */ /* * sqlilongdata is new. It supports data that exceeds the 32k limit. * sqlilen and sqlidata are for backward compatibility and they have * maximum value of <32K. */ char *sqlilongdata; /* for data field beyond 32K */ int sqlflags; /* for internal use only */ void *sqlreserved; /* reserved for future use */ }; struct sqlda_compat { short sqld; struct sqlvar_compat *sqlvar; char desc_name[19]; /* descriptor name */ short desc_occ; /* size of sqlda structure */ struct sqlda_compat *desc_next; /* pointer to next sqlda struct */ void *reserved; /* reserved for future use */ }; #endif /* ECPG_SQLDA_COMPAT_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������malloc.h��������������������������������������������������������������������������������������������0000644�����������������00000014677�14763166030�0006211 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Prototypes and definition for malloc implementation. Copyright (C) 1996,1997,1999,2000,2002-2004,2005,2007,2009,2011,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MALLOC_H #define _MALLOC_H 1 #include <features.h> #include <stddef.h> #include <stdio.h> # define __malloc_ptr_t void * /* Used by GNU libc internals. */ #define __malloc_size_t size_t #define __malloc_ptrdiff_t ptrdiff_t #ifdef __GNUC__ # define __MALLOC_P(args) args __THROW /* This macro will be used for functions which might take C++ callback functions. */ # define __MALLOC_PMT(args) args # ifdef _LIBC # define __MALLOC_HOOK_VOLATILE # define __MALLOC_DEPRECATED # else # define __MALLOC_HOOK_VOLATILE volatile # define __MALLOC_DEPRECATED __attribute_deprecated__ # endif #else /* Not GCC. */ # define __MALLOC_P(args) args # define __MALLOC_PMT(args) args # define __MALLOC_HOOK_VOLATILE # define __MALLOC_DEPRECATED __attribute_deprecated__ #endif /* GCC. */ __BEGIN_DECLS /* Allocate SIZE bytes of memory. */ extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur; /* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */ extern void *calloc (size_t __nmemb, size_t __size) __THROW __attribute_malloc__ __wur; /* Re-allocate the previously allocated block in __ptr, making the new block SIZE bytes long. */ /* __attribute_malloc__ is not used, because if realloc returns the same pointer that was passed to it, aliasing needs to be allowed between objects pointed by the old and new pointers. */ extern void *realloc (void *__ptr, size_t __size) __THROW __attribute_warn_unused_result__; /* Free a block allocated by `malloc', `realloc' or `calloc'. */ extern void free (void *__ptr) __THROW; /* Free a block allocated by `calloc'. */ extern void cfree (void *__ptr) __THROW; /* Allocate SIZE bytes allocated to ALIGNMENT bytes. */ extern void *memalign (size_t __alignment, size_t __size) __THROW __attribute_malloc__ __wur; /* Allocate SIZE bytes on a page boundary. */ extern void *valloc (size_t __size) __THROW __attribute_malloc__ __wur; /* Equivalent to valloc(minimum-page-that-holds(n)), that is, round up __size to nearest pagesize. */ extern void * pvalloc (size_t __size) __THROW __attribute_malloc__ __wur; /* Underlying allocation function; successive calls should return contiguous pieces of memory. */ extern void *(*__morecore) (ptrdiff_t __size); /* Default value of `__morecore'. */ extern void *__default_morecore (ptrdiff_t __size) __THROW __attribute_malloc__; /* SVID2/XPG mallinfo structure */ struct mallinfo { int arena; /* non-mmapped space allocated from system */ int ordblks; /* number of free chunks */ int smblks; /* number of fastbin blocks */ int hblks; /* number of mmapped regions */ int hblkhd; /* space in mmapped regions */ int usmblks; /* maximum total allocated space */ int fsmblks; /* space available in freed fastbin blocks */ int uordblks; /* total allocated space */ int fordblks; /* total free space */ int keepcost; /* top-most, releasable (via malloc_trim) space */ }; /* Returns a copy of the updated current mallinfo. */ extern struct mallinfo mallinfo (void) __THROW; /* SVID2/XPG mallopt options */ #ifndef M_MXFAST # define M_MXFAST 1 /* maximum request size for "fastbins" */ #endif #ifndef M_NLBLKS # define M_NLBLKS 2 /* UNUSED in this malloc */ #endif #ifndef M_GRAIN # define M_GRAIN 3 /* UNUSED in this malloc */ #endif #ifndef M_KEEP # define M_KEEP 4 /* UNUSED in this malloc */ #endif /* mallopt options that actually do something */ #define M_TRIM_THRESHOLD -1 #define M_TOP_PAD -2 #define M_MMAP_THRESHOLD -3 #define M_MMAP_MAX -4 #define M_CHECK_ACTION -5 #define M_PERTURB -6 #define M_ARENA_TEST -7 #define M_ARENA_MAX -8 /* General SVID/XPG interface to tunable parameters. */ extern int mallopt (int __param, int __val) __THROW; /* Release all but __pad bytes of freed top-most memory back to the system. Return 1 if successful, else 0. */ extern int malloc_trim (size_t __pad) __THROW; /* Report the number of usable allocated bytes associated with allocated chunk __ptr. */ extern size_t malloc_usable_size (void *__ptr) __THROW; /* Prints brief summary statistics on stderr. */ extern void malloc_stats (void) __THROW; /* Output information about state of allocator to stream FP. */ extern int malloc_info (int __options, FILE *__fp) __THROW; /* Record the state of all malloc variables in an opaque data structure. */ extern void *malloc_get_state (void) __THROW; /* Restore the state of all malloc variables from data obtained with malloc_get_state(). */ extern int malloc_set_state (void *__ptr) __THROW; /* Called once when malloc is initialized; redefining this variable in the application provides the preferred way to set up the hook pointers. */ extern void (*__MALLOC_HOOK_VOLATILE __malloc_initialize_hook) (void) __MALLOC_DEPRECATED; /* Hooks for debugging and user-defined versions. */ extern void (*__MALLOC_HOOK_VOLATILE __free_hook) (void *__ptr, const __malloc_ptr_t) __MALLOC_DEPRECATED; extern void *(*__MALLOC_HOOK_VOLATILE __malloc_hook) (size_t __size, const __malloc_ptr_t) __MALLOC_DEPRECATED; extern void *(*__MALLOC_HOOK_VOLATILE __realloc_hook) (void *__ptr, size_t __size, const __malloc_ptr_t) __MALLOC_DEPRECATED; extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook) (size_t __alignment, size_t __size, const __malloc_ptr_t) __MALLOC_DEPRECATED; extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void); /* Activate a standard set of debugging hooks. */ extern void __malloc_check_init (void) __THROW __MALLOC_DEPRECATED; __END_DECLS #endif /* malloc.h */ �����������������������������������������������������������������kadm5/kadm_err.h������������������������������������������������������������������������������������0000644�����������������00000010274�14763166030�0007514 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * et-h-kadm_err.h: * This file is automatically generated; please do not edit it. */ #include <et/com_err.h> #define KADM5_FAILURE (43787520L) #define KADM5_AUTH_GET (43787521L) #define KADM5_AUTH_ADD (43787522L) #define KADM5_AUTH_MODIFY (43787523L) #define KADM5_AUTH_DELETE (43787524L) #define KADM5_AUTH_INSUFFICIENT (43787525L) #define KADM5_BAD_DB (43787526L) #define KADM5_DUP (43787527L) #define KADM5_RPC_ERROR (43787528L) #define KADM5_NO_SRV (43787529L) #define KADM5_BAD_HIST_KEY (43787530L) #define KADM5_NOT_INIT (43787531L) #define KADM5_UNK_PRINC (43787532L) #define KADM5_UNK_POLICY (43787533L) #define KADM5_BAD_MASK (43787534L) #define KADM5_BAD_CLASS (43787535L) #define KADM5_BAD_LENGTH (43787536L) #define KADM5_BAD_POLICY (43787537L) #define KADM5_BAD_PRINCIPAL (43787538L) #define KADM5_BAD_AUX_ATTR (43787539L) #define KADM5_BAD_HISTORY (43787540L) #define KADM5_BAD_MIN_PASS_LIFE (43787541L) #define KADM5_PASS_Q_TOOSHORT (43787542L) #define KADM5_PASS_Q_CLASS (43787543L) #define KADM5_PASS_Q_DICT (43787544L) #define KADM5_PASS_REUSE (43787545L) #define KADM5_PASS_TOOSOON (43787546L) #define KADM5_POLICY_REF (43787547L) #define KADM5_INIT (43787548L) #define KADM5_BAD_PASSWORD (43787549L) #define KADM5_PROTECT_PRINCIPAL (43787550L) #define KADM5_BAD_SERVER_HANDLE (43787551L) #define KADM5_BAD_STRUCT_VERSION (43787552L) #define KADM5_OLD_STRUCT_VERSION (43787553L) #define KADM5_NEW_STRUCT_VERSION (43787554L) #define KADM5_BAD_API_VERSION (43787555L) #define KADM5_OLD_LIB_API_VERSION (43787556L) #define KADM5_OLD_SERVER_API_VERSION (43787557L) #define KADM5_NEW_LIB_API_VERSION (43787558L) #define KADM5_NEW_SERVER_API_VERSION (43787559L) #define KADM5_SECURE_PRINC_MISSING (43787560L) #define KADM5_NO_RENAME_SALT (43787561L) #define KADM5_BAD_CLIENT_PARAMS (43787562L) #define KADM5_BAD_SERVER_PARAMS (43787563L) #define KADM5_AUTH_LIST (43787564L) #define KADM5_AUTH_CHANGEPW (43787565L) #define KADM5_GSS_ERROR (43787566L) #define KADM5_BAD_TL_TYPE (43787567L) #define KADM5_MISSING_CONF_PARAMS (43787568L) #define KADM5_BAD_SERVER_NAME (43787569L) #define KADM5_AUTH_SETKEY (43787570L) #define KADM5_SETKEY_DUP_ENCTYPES (43787571L) #define KADM5_SETV4KEY_INVAL_ENCTYPE (43787572L) #define KADM5_SETKEY3_ETYPE_MISMATCH (43787573L) #define KADM5_MISSING_KRB5_CONF_PARAMS (43787574L) #define KADM5_XDR_FAILURE (43787575L) #define KADM5_CANT_RESOLVE (43787576L) #define KADM5_PASS_Q_GENERIC (43787577L) #define KADM5_BAD_KEYSALTS (43787578L) #define KADM5_SETKEY_BAD_KVNO (43787579L) #define KADM5_AUTH_EXTRACT (43787580L) #define KADM5_PROTECT_KEYS (43787581L) extern const struct error_table et_ovk_error_table; extern void initialize_ovk_error_table(void); /* For compatibility with Heimdal */ extern void initialize_ovk_error_table_r(struct et_list **list); #define ERROR_TABLE_BASE_ovk (43787520L) /* for compatibility with older versions... */ #define init_ovk_err_tbl initialize_ovk_error_table #define ovk_err_base ERROR_TABLE_BASE_ovk ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kadm5/admin.h���������������������������������������������������������������������������������������0000644�����������������00000050440�14763166030�0007017 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* lib/kadm5/admin.h */ /* * Copyright 2001, 2008 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of M.I.T. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a * fashion that it might be confused with the original M.I.T. software. * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. */ /* * Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved * * $Header$ */ /* * This API is not considered as stable as the main krb5 API. * * - We may make arbitrary incompatible changes between feature * releases (e.g. from 1.7 to 1.8). * - We will make some effort to avoid making incompatible changes for * bugfix releases, but will make them if necessary. */ #ifndef __KADM5_ADMIN_H__ #define __KADM5_ADMIN_H__ #include <sys/types.h> #include <gssrpc/rpc.h> #include <krb5.h> #include <kdb.h> #include <com_err.h> #include <kadm5/kadm_err.h> #include <kadm5/chpass_util_strings.h> #ifndef KADM5INT_BEGIN_DECLS #if defined(__cplusplus) #define KADM5INT_BEGIN_DECLS extern "C" { #define KADM5INT_END_DECLS } #else #define KADM5INT_BEGIN_DECLS #define KADM5INT_END_DECLS #endif #endif KADM5INT_BEGIN_DECLS #define KADM5_ADMIN_SERVICE "kadmin/admin" #define KADM5_CHANGEPW_SERVICE "kadmin/changepw" #define KADM5_HIST_PRINCIPAL "kadmin/history" #define KADM5_KIPROP_HOST_SERVICE "kiprop" typedef krb5_principal kadm5_princ_t; typedef char *kadm5_policy_t; typedef long kadm5_ret_t; #define KADM5_PW_FIRST_PROMPT \ (error_message(CHPASS_UTIL_NEW_PASSWORD_PROMPT)) #define KADM5_PW_SECOND_PROMPT \ (error_message(CHPASS_UTIL_NEW_PASSWORD_AGAIN_PROMPT)) /* * Successful return code */ #define KADM5_OK 0 /* * Field masks */ /* kadm5_principal_ent_t */ #define KADM5_PRINCIPAL 0x000001 #define KADM5_PRINC_EXPIRE_TIME 0x000002 #define KADM5_PW_EXPIRATION 0x000004 #define KADM5_LAST_PWD_CHANGE 0x000008 #define KADM5_ATTRIBUTES 0x000010 #define KADM5_MAX_LIFE 0x000020 #define KADM5_MOD_TIME 0x000040 #define KADM5_MOD_NAME 0x000080 #define KADM5_KVNO 0x000100 #define KADM5_MKVNO 0x000200 #define KADM5_AUX_ATTRIBUTES 0x000400 #define KADM5_POLICY 0x000800 #define KADM5_POLICY_CLR 0x001000 /* version 2 masks */ #define KADM5_MAX_RLIFE 0x002000 #define KADM5_LAST_SUCCESS 0x004000 #define KADM5_LAST_FAILED 0x008000 #define KADM5_FAIL_AUTH_COUNT 0x010000 #define KADM5_KEY_DATA 0x020000 #define KADM5_TL_DATA 0x040000 #ifdef notyet /* Novell */ #define KADM5_CPW_FUNCTION 0x080000 #define KADM5_RANDKEY_USED 0x100000 #endif #define KADM5_LOAD 0x200000 #define KADM5_KEY_HIST 0x400000 /* all but KEY_DATA, TL_DATA, LOAD */ #define KADM5_PRINCIPAL_NORMAL_MASK 0x41ffff /* kadm5_policy_ent_t */ #define KADM5_PW_MAX_LIFE 0x00004000 #define KADM5_PW_MIN_LIFE 0x00008000 #define KADM5_PW_MIN_LENGTH 0x00010000 #define KADM5_PW_MIN_CLASSES 0x00020000 #define KADM5_PW_HISTORY_NUM 0x00040000 #define KADM5_REF_COUNT 0x00080000 #define KADM5_PW_MAX_FAILURE 0x00100000 #define KADM5_PW_FAILURE_COUNT_INTERVAL 0x00200000 #define KADM5_PW_LOCKOUT_DURATION 0x00400000 #define KADM5_POLICY_ATTRIBUTES 0x00800000 #define KADM5_POLICY_MAX_LIFE 0x01000000 #define KADM5_POLICY_MAX_RLIFE 0x02000000 #define KADM5_POLICY_ALLOWED_KEYSALTS 0x04000000 #define KADM5_POLICY_TL_DATA 0x08000000 /* kadm5_config_params */ #define KADM5_CONFIG_REALM 0x00000001 #define KADM5_CONFIG_DBNAME 0x00000002 #define KADM5_CONFIG_MKEY_NAME 0x00000004 #define KADM5_CONFIG_MAX_LIFE 0x00000008 #define KADM5_CONFIG_MAX_RLIFE 0x00000010 #define KADM5_CONFIG_EXPIRATION 0x00000020 #define KADM5_CONFIG_FLAGS 0x00000040 /*#define KADM5_CONFIG_ADMIN_KEYTAB 0x00000080*/ #define KADM5_CONFIG_STASH_FILE 0x00000100 #define KADM5_CONFIG_ENCTYPE 0x00000200 #define KADM5_CONFIG_ADBNAME 0x00000400 #define KADM5_CONFIG_ADB_LOCKFILE 0x00000800 #define KADM5_CONFIG_KADMIND_LISTEN 0x00001000 #define KADM5_CONFIG_ACL_FILE 0x00002000 #define KADM5_CONFIG_KADMIND_PORT 0x00004000 #define KADM5_CONFIG_ENCTYPES 0x00008000 #define KADM5_CONFIG_ADMIN_SERVER 0x00010000 #define KADM5_CONFIG_DICT_FILE 0x00020000 #define KADM5_CONFIG_MKEY_FROM_KBD 0x00040000 #define KADM5_CONFIG_KPASSWD_PORT 0x00080000 #define KADM5_CONFIG_OLD_AUTH_GSSAPI 0x00100000 #define KADM5_CONFIG_NO_AUTH 0x00200000 #define KADM5_CONFIG_AUTH_NOFALLBACK 0x00400000 #define KADM5_CONFIG_KPASSWD_LISTEN 0x00800000 #define KADM5_CONFIG_IPROP_ENABLED 0x01000000 #define KADM5_CONFIG_ULOG_SIZE 0x02000000 #define KADM5_CONFIG_POLL_TIME 0x04000000 #define KADM5_CONFIG_IPROP_LOGFILE 0x08000000 #define KADM5_CONFIG_IPROP_PORT 0x10000000 #define KADM5_CONFIG_KVNO 0x20000000 #define KADM5_CONFIG_IPROP_RESYNC_TIMEOUT 0x40000000 #define KADM5_CONFIG_IPROP_LISTEN 0x80000000 /* * permission bits */ #define KADM5_PRIV_GET 0x01 #define KADM5_PRIV_ADD 0x02 #define KADM5_PRIV_MODIFY 0x04 #define KADM5_PRIV_DELETE 0x08 /* * API versioning constants */ #define KADM5_MASK_BITS 0xffffff00 #define KADM5_STRUCT_VERSION_MASK 0x12345600 #define KADM5_STRUCT_VERSION_1 (KADM5_STRUCT_VERSION_MASK|0x01) #define KADM5_STRUCT_VERSION KADM5_STRUCT_VERSION_1 #define KADM5_API_VERSION_MASK 0x12345700 #define KADM5_API_VERSION_2 (KADM5_API_VERSION_MASK|0x02) #define KADM5_API_VERSION_3 (KADM5_API_VERSION_MASK|0x03) #define KADM5_API_VERSION_4 (KADM5_API_VERSION_MASK|0x04) typedef struct _kadm5_principal_ent_t { krb5_principal principal; krb5_timestamp princ_expire_time; krb5_timestamp last_pwd_change; krb5_timestamp pw_expiration; krb5_deltat max_life; krb5_principal mod_name; krb5_timestamp mod_date; krb5_flags attributes; krb5_kvno kvno; krb5_kvno mkvno; char *policy; long aux_attributes; /* version 2 fields */ krb5_deltat max_renewable_life; krb5_timestamp last_success; krb5_timestamp last_failed; krb5_kvno fail_auth_count; krb5_int16 n_key_data; krb5_int16 n_tl_data; krb5_tl_data *tl_data; krb5_key_data *key_data; } kadm5_principal_ent_rec, *kadm5_principal_ent_t; typedef struct _kadm5_policy_ent_t { char *policy; long pw_min_life; long pw_max_life; long pw_min_length; long pw_min_classes; long pw_history_num; long policy_refcnt; /* no longer used */ /* version 3 fields */ krb5_kvno pw_max_fail; krb5_deltat pw_failcnt_interval; krb5_deltat pw_lockout_duration; /* version 4 fields */ krb5_flags attributes; krb5_deltat max_life; krb5_deltat max_renewable_life; char *allowed_keysalts; krb5_int16 n_tl_data; krb5_tl_data *tl_data; } kadm5_policy_ent_rec, *kadm5_policy_ent_t; /* * Data structure returned by kadm5_get_config_params() */ typedef struct _kadm5_config_params { long mask; char * realm; int kadmind_port; int kpasswd_port; char * admin_server; #ifdef notyet /* Novell */ /* ABI change? */ char * kpasswd_server; #endif /* Deprecated except for db2 backwards compatibility. Don't add new uses except as fallbacks for parameters that should be specified in the database module section of the config file. */ char * dbname; char * acl_file; char * dict_file; int mkey_from_kbd; char * stash_file; char * mkey_name; krb5_enctype enctype; krb5_deltat max_life; krb5_deltat max_rlife; krb5_timestamp expiration; krb5_flags flags; krb5_key_salt_tuple *keysalts; krb5_int32 num_keysalts; krb5_kvno kvno; bool_t iprop_enabled; uint32_t iprop_ulogsize; krb5_deltat iprop_poll_time; char * iprop_logfile; /* char * iprop_server;*/ int iprop_port; int iprop_resync_timeout; char * kadmind_listen; char * kpasswd_listen; char * iprop_listen; } kadm5_config_params; typedef struct _kadm5_key_data { krb5_kvno kvno; krb5_keyblock key; krb5_keysalt salt; } kadm5_key_data; /* * functions */ krb5_error_code kadm5_get_config_params(krb5_context context, int use_kdc_config, kadm5_config_params *params_in, kadm5_config_params *params_out); krb5_error_code kadm5_free_config_params(krb5_context context, kadm5_config_params *params); krb5_error_code kadm5_get_admin_service_name(krb5_context, char *, char *, size_t); /* * For all initialization functions, the caller must first initialize * a context with kadm5_init_krb5_context which will survive as long * as the resulting handle. The caller should free the context with * krb5_free_context. */ kadm5_ret_t kadm5_init(krb5_context context, char *client_name, char *pass, char *service_name, kadm5_config_params *params, krb5_ui_4 struct_version, krb5_ui_4 api_version, char **db_args, void **server_handle); kadm5_ret_t kadm5_init_anonymous(krb5_context context, char *client_name, char *service_name, kadm5_config_params *params, krb5_ui_4 struct_version, krb5_ui_4 api_version, char **db_args, void **server_handle); kadm5_ret_t kadm5_init_with_password(krb5_context context, char *client_name, char *pass, char *service_name, kadm5_config_params *params, krb5_ui_4 struct_version, krb5_ui_4 api_version, char **db_args, void **server_handle); kadm5_ret_t kadm5_init_with_skey(krb5_context context, char *client_name, char *keytab, char *service_name, kadm5_config_params *params, krb5_ui_4 struct_version, krb5_ui_4 api_version, char **db_args, void **server_handle); kadm5_ret_t kadm5_init_with_creds(krb5_context context, char *client_name, krb5_ccache cc, char *service_name, kadm5_config_params *params, krb5_ui_4 struct_version, krb5_ui_4 api_version, char **db_args, void **server_handle); kadm5_ret_t kadm5_lock(void *server_handle); kadm5_ret_t kadm5_unlock(void *server_handle); kadm5_ret_t kadm5_flush(void *server_handle); kadm5_ret_t kadm5_destroy(void *server_handle); kadm5_ret_t kadm5_create_principal(void *server_handle, kadm5_principal_ent_t ent, long mask, char *pass); kadm5_ret_t kadm5_create_principal_3(void *server_handle, kadm5_principal_ent_t ent, long mask, int n_ks_tuple, krb5_key_salt_tuple *ks_tuple, char *pass); kadm5_ret_t kadm5_delete_principal(void *server_handle, krb5_principal principal); kadm5_ret_t kadm5_modify_principal(void *server_handle, kadm5_principal_ent_t ent, long mask); kadm5_ret_t kadm5_rename_principal(void *server_handle, krb5_principal,krb5_principal); kadm5_ret_t kadm5_get_principal(void *server_handle, krb5_principal principal, kadm5_principal_ent_t ent, long mask); kadm5_ret_t kadm5_chpass_principal(void *server_handle, krb5_principal principal, char *pass); kadm5_ret_t kadm5_chpass_principal_3(void *server_handle, krb5_principal principal, krb5_boolean keepold, int n_ks_tuple, krb5_key_salt_tuple *ks_tuple, char *pass); kadm5_ret_t kadm5_randkey_principal(void *server_handle, krb5_principal principal, krb5_keyblock **keyblocks, int *n_keys); kadm5_ret_t kadm5_randkey_principal_3(void *server_handle, krb5_principal principal, krb5_boolean keepold, int n_ks_tuple, krb5_key_salt_tuple *ks_tuple, krb5_keyblock **keyblocks, int *n_keys); kadm5_ret_t kadm5_setv4key_principal(void *server_handle, krb5_principal principal, krb5_keyblock *keyblock); kadm5_ret_t kadm5_setkey_principal(void *server_handle, krb5_principal principal, krb5_keyblock *keyblocks, int n_keys); kadm5_ret_t kadm5_setkey_principal_3(void *server_handle, krb5_principal principal, krb5_boolean keepold, int n_ks_tuple, krb5_key_salt_tuple *ks_tuple, krb5_keyblock *keyblocks, int n_keys); kadm5_ret_t kadm5_setkey_principal_4(void *server_handle, krb5_principal principal, krb5_boolean keepold, kadm5_key_data *key_data, int n_key_data); kadm5_ret_t kadm5_decrypt_key(void *server_handle, kadm5_principal_ent_t entry, krb5_int32 ktype, krb5_int32 stype, krb5_int32 kvno, krb5_keyblock *keyblock, krb5_keysalt *keysalt, int *kvnop); kadm5_ret_t kadm5_create_policy(void *server_handle, kadm5_policy_ent_t ent, long mask); kadm5_ret_t kadm5_delete_policy(void *server_handle, kadm5_policy_t policy); kadm5_ret_t kadm5_modify_policy(void *server_handle, kadm5_policy_ent_t ent, long mask); kadm5_ret_t kadm5_get_policy(void *server_handle, kadm5_policy_t policy, kadm5_policy_ent_t ent); kadm5_ret_t kadm5_get_privs(void *server_handle, long *privs); kadm5_ret_t kadm5_chpass_principal_util(void *server_handle, krb5_principal princ, char *new_pw, char **ret_pw, char *msg_ret, unsigned int msg_len); kadm5_ret_t kadm5_free_principal_ent(void *server_handle, kadm5_principal_ent_t ent); kadm5_ret_t kadm5_free_policy_ent(void *server_handle, kadm5_policy_ent_t ent); kadm5_ret_t kadm5_get_principals(void *server_handle, char *exp, char ***princs, int *count); kadm5_ret_t kadm5_get_policies(void *server_handle, char *exp, char ***pols, int *count); kadm5_ret_t kadm5_free_key_data(void *server_handle, krb5_int16 *n_key_data, krb5_key_data *key_data); kadm5_ret_t kadm5_free_name_list(void *server_handle, char **names, int count); krb5_error_code kadm5_init_krb5_context (krb5_context *); krb5_error_code kadm5_init_iprop(void *server_handle, char **db_args); kadm5_ret_t kadm5_get_principal_keys(void *server_handle, krb5_principal principal, krb5_kvno kvno, kadm5_key_data **key_data, int *n_key_data); kadm5_ret_t kadm5_purgekeys(void *server_handle, krb5_principal principal, int keepkvno); kadm5_ret_t kadm5_get_strings(void *server_handle, krb5_principal principal, krb5_string_attr **strings_out, int *count_out); kadm5_ret_t kadm5_set_string(void *server_handle, krb5_principal principal, const char *key, const char *value); kadm5_ret_t kadm5_free_strings(void *server_handle, krb5_string_attr *strings, int count); kadm5_ret_t kadm5_free_kadm5_key_data(krb5_context context, int n_key_data, kadm5_key_data *key_data); KADM5INT_END_DECLS #endif /* __KADM5_ADMIN_H__ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������kadm5/chpass_util_strings.h�������������������������������������������������������������������������0000644�����������������00000003014�14763166030�0012011 0����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * et-h-chpass_util_strings.h: * This file is automatically generated; please do not edit it. */ #include <et/com_err.h> #define CHPASS_UTIL_GET_POLICY_INFO (-1492553984L) #define CHPASS_UTIL_GET_PRINC_INFO (-1492553983L) #define CHPASS_UTIL_NEW_PASSWORD_MISMATCH (-1492553982L) #define CHPASS_UTIL_NEW_PASSWORD_PROMPT (-1492553981L) #define CHPASS_UTIL_NEW_PASSWORD_AGAIN_PROMPT (-1492553980L) #define CHPASS_UTIL_NO_PASSWORD_READ (-1492553979L) #define CHPASS_UTIL_NO_POLICY_YET_Q_ERROR (-1492553978L) #define CHPASS_UTIL_PASSWORD_CHANGED (-1492553977L) #define CHPASS_UTIL_PASSWORD_IN_DICTIONARY (-1492553976L) #define CHPASS_UTIL_PASSWORD_NOT_CHANGED (-1492553975L) #define CHPASS_UTIL_PASSWORD_TOO_SHORT (-1492553974L) #define CHPASS_UTIL_TOO_FEW_CLASSES (-1492553973L) #define CHPASS_UTIL_PASSWORD_TOO_SOON (-1492553972L) #define CHPASS_UTIL_PASSWORD_REUSE (-1492553971L) #define CHPASS_UTIL_WHILE_TRYING_TO_CHANGE (-1492553970L) #define CHPASS_UTIL_WHILE_READING_PASSWORD (-1492553969L) extern const struct error_table et_ovku_error_table; extern void initialize_ovku_error_table(void); /* For compatibility with Heimdal */ extern void initialize_ovku_error_table_r(struct et_list **list); #define ERROR_TABLE_BASE_ovku (-1492553984L) /* for compatibility with older versions... */ #define init_ovku_err_tbl initialize_ovku_error_table #define ovku_err_base ERROR_TABLE_BASE_ovku ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������